-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathprocessor.ts
44 lines (38 loc) · 1.3 KB
/
processor.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
import { Axios } from 'axios';
import { BlocksClient } from '../clients/blocks';
import { CatalogClient } from '../clients/catalog';
import { EVMClient } from '../clients/evm';
import { IPFSClient } from '../clients/ipfs';
import { NOIZDClient } from '../clients/noizd';
import { SolanaClient } from '../clients/solana';
import { SoundClient } from '../clients/sound';
import { DBClient } from '../db/db';
import { ChainId } from './chain';
import { ProcessedTrack } from './track';
import { Cursor, Trigger } from './trigger';
export type TrackAPIClient = {
fetchTracksByTrackId: (trackIds: string[]) => Promise<any[]>;
}
export type TrackAPIClientWithPremints = TrackAPIClient & {
fetchLatestTrackCursor: () => Promise<string>;
getTracksFrom: (cursor: string) => Promise<any[]>;
getAPITrackCursor: (track: any) => string
mapAPITrack: (apiTrack: any) => ProcessedTrack
}
export type Clients = {
db: DBClient,
blocks: BlocksClient,
axios: Axios,
ipfs: IPFSClient,
catalog: CatalogClient,
sound: SoundClient,
noizd: NOIZDClient
solana: SolanaClient;
evmChain: { [chainId in ChainId]: EVMClient };
}
export type Processor = {
name?: string,
trigger: Trigger<Cursor | undefined>,
processorFunction: (newTriggerItems: any, clients: Clients) => Promise<void>;
initialCursor?: Cursor | undefined;
};