import { definePipeline, defineStream, fullSync } from '@chkit/plugin-ingest' import { circlebackConfig, type CirclebackReaderConfig } from './config.js' import { circleback_meetingsRaw, readMeetings } from './sources/meetings.js' import { circleback_meetingTranscriptsRaw, readMeetingTranscripts } from './sources/meeting-transcripts.js' import { circleback_actionItemsRaw, readActionItems } from './sources/action-items.js' import { circleback_peopleRaw, readPeople } from './sources/people.js' import { circleback_companiesRaw, readCompanies } from './sources/companies.js' export function createCirclebackPipeline(config: CirclebackReaderConfig = circlebackConfig) { const source = { ...config } const options = { incremental: fullSync() } return definePipeline({ id: source.sourceId, tags: ['provider:circleback'], maxStreams: 1, maxFetches: 1, streams: [ defineStream({ ...options, id: `${source.sourceId}.meetings`, tags: ['resource:meetings'], destination: circleback_meetingsRaw, read: (context) => readMeetings(context, source) }), defineStream({ ...options, id: `${source.sourceId}.meeting_transcripts`, tags: ['resource:meeting_transcripts'], destination: circleback_meetingTranscriptsRaw, read: (context) => readMeetingTranscripts(context, source) }), defineStream({ ...options, id: `${source.sourceId}.action_items`, tags: ['resource:action_items'], destination: circleback_actionItemsRaw, read: (context) => readActionItems(context, source) }), defineStream({ ...options, id: `${source.sourceId}.people`, tags: ['resource:people'], destination: circleback_peopleRaw, read: (context) => readPeople(context, source) }), defineStream({ ...options, id: `${source.sourceId}.companies`, tags: ['resource:companies'], destination: circleback_companiesRaw, read: (context) => readCompanies(context, source) }), ], }) } export const circlebackPipeline = createCirclebackPipeline()