/ script / README.md
README.md
 1  # Indexer Script
 2  
 3  This crate provides the scripting engine used to run indexers.
 4  
 5  And indexer script is a Typescript or Javascript file that exports two values:
 6  
 7  - `config`: the indexer configuration.
 8  - a default function: the function used to transform each batch of data.
 9  
10  ```ts
11  export const config = {
12    // general configuration.
13    indexerType: "postgres",
14    indexerOptions: {
15      // postgres-specific options.
16    },
17  };
18  
19  export default function transform(batch) {
20    // do something with the batch of data.
21    return batch;
22  }
23  ```
24  
25  If you're implementing a new sink type, you shouldn't use this crate directly
26  and should use `apibara-sink-common` instead.