diff --git a/plugins/incremental-ingestion-backend/src/database/IncrementalIngestionDatabaseManager.ts b/plugins/incremental-ingestion-backend/src/database/IncrementalIngestionDatabaseManager.ts index 1a7a880901..6a8a69b886 100644 --- a/plugins/incremental-ingestion-backend/src/database/IncrementalIngestionDatabaseManager.ts +++ b/plugins/incremental-ingestion-backend/src/database/IncrementalIngestionDatabaseManager.ts @@ -23,7 +23,7 @@ import { INCREMENTAL_ENTITY_PROVIDER_ANNOTATION, IngestionRecord, IngestionRecordUpdate, - IngestionUpsertIFace, + IngestionUpsert, MarkRecord, MarkRecordInsert, } from '../types'; @@ -54,7 +54,7 @@ export class IncrementalIngestionDatabaseManager { */ async updateIngestionRecordByProvider( provider: string, - update: Partial, + update: Partial, ) { await this.client.transaction(async tx => { await tx('ingestions') @@ -68,7 +68,7 @@ export class IncrementalIngestionDatabaseManager { * Performs an insert into the `ingestions` table with the supplied values. * @param record - IngestionUpsertIFace */ - async insertIngestionRecord(record: IngestionUpsertIFace) { + async insertIngestionRecord(record: IngestionUpsert) { await this.client.transaction(async tx => { await tx('ingestions').insert(record); }); @@ -455,7 +455,7 @@ export class IncrementalIngestionDatabaseManager { * @param message - string (optional) */ async setProviderCanceling(ingestionId: string, message?: string) { - const update: Partial = { + const update: Partial = { next_action: 'cancel', last_error: message ? message : undefined, next_action_at: new Date(), @@ -580,7 +580,7 @@ export class IncrementalIngestionDatabaseManager { }); } - async updateByName(provider: string, update: Partial) { + async updateByName(provider: string, update: Partial) { await this.updateIngestionRecordByProvider(provider, update); } } diff --git a/plugins/incremental-ingestion-backend/src/index.ts b/plugins/incremental-ingestion-backend/src/index.ts index da50c6b37f..142b6ba836 100644 --- a/plugins/incremental-ingestion-backend/src/index.ts +++ b/plugins/incremental-ingestion-backend/src/index.ts @@ -21,7 +21,7 @@ export type { IncrementalEntityProviderOptions, IngestionRecord, IngestionRecordUpdate, - IngestionUpsertIFace, + IngestionUpsert as IngestionUpsertIFace, MarkRecord, MarkRecordInsert, INCREMENTAL_ENTITY_PROVIDER_ANNOTATION, diff --git a/plugins/incremental-ingestion-backend/src/types.ts b/plugins/incremental-ingestion-backend/src/types.ts index 3f1971e97d..138b9ba0ee 100644 --- a/plugins/incremental-ingestion-backend/src/types.ts +++ b/plugins/incremental-ingestion-backend/src/types.ts @@ -89,23 +89,15 @@ export interface IncrementalEntityProvider { * * @public */ -export interface EntityIteratorResult { - /** - * Indicates whether there are any further pages of entities to - * ingest after this one. - */ - done: boolean; - - /** - * A value that marks the page of entities after this one. It will - * be used to pass into the following invocation of `next()` - */ - cursor?: T; - - /** - * The entities to ingest. - */ +export type EntityIteratorResult = +| { + done: false; + entities: DeferredEntity[]; + cursor: T; +} | { + done: true; entities?: DeferredEntity[]; + cursor?: T; } /** @public */ @@ -168,7 +160,7 @@ export interface IterationEngineOptions { * * @public */ -export interface IngestionUpsertIFace { +export interface IngestionUpsert { /** * The ingestion record id. */ @@ -230,7 +222,7 @@ export interface IngestionUpsertIFace { */ export interface IngestionRecordUpdate { ingestionId: string; - update: Partial; + update: Partial; } /** @@ -251,7 +243,7 @@ export interface MarkRecord { * * @public */ -export interface IngestionRecord extends IngestionUpsertIFace { +export interface IngestionRecord extends IngestionUpsert { id: string; next_action_at: Date; /**