sanity-dataset-manipulation v0.0.1
ahm-sanity-dataset-manipulation
This project contains source code for the Sanity dataset manipulation Lamdba function and associated command line utility.
Usage
Command-line usage
The command-line program exists in src/command.ts and can be invoked like so:
1. Execute npm i to install the required dependencies.
1. Run the command with: npm run start -- -p <project_id> -i <input_dataset> -o <output_dataset> -t <token_with_create_and_write_permissions>
Lambda function
The Lambda handler exists in src/index.ts.
1. Build the project by executing npm run build.
1. The Lambda entry point should be located in dist/index.js.
Adding additional document filters
Document filters are located in src/utils/filter-document/filters and handle filtration of document fragments.
We define fragments as any value associated to a key within a document (JS object).
Adding a document filter is simple:
1. Create a new filter and associated tests in src/utils/filter-document/filters. Filters should return false only if the document fragment should be omitted from the resulting dataset.
1. Extend the filters constant in src/utils/filter-document/index.ts to include a reference to your new filter. Filters should be ordered so that the most likely to return false are executed first.
6 years ago