Some type cleanup

Signed-off-by: Damon Kaswell <damon.kaswell1@hp.com>
This commit is contained in:
Damon Kaswell
2022-11-17 11:20:20 -08:00
committed by Fredrik Adelöw
parent 58b627cbec
commit 5b850ac022
3 changed files with 17 additions and 25 deletions
@@ -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<IngestionUpsertIFace>,
update: Partial<IngestionUpsert>,
) {
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<IngestionUpsertIFace> = {
const update: Partial<IngestionUpsert> = {
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<IngestionUpsertIFace>) {
async updateByName(provider: string, update: Partial<IngestionUpsert>) {
await this.updateIngestionRecordByProvider(provider, update);
}
}
@@ -21,7 +21,7 @@ export type {
IncrementalEntityProviderOptions,
IngestionRecord,
IngestionRecordUpdate,
IngestionUpsertIFace,
IngestionUpsert as IngestionUpsertIFace,
MarkRecord,
MarkRecordInsert,
INCREMENTAL_ENTITY_PROVIDER_ANNOTATION,
@@ -89,23 +89,15 @@ export interface IncrementalEntityProvider<TCursor, TContext> {
*
* @public
*/
export interface EntityIteratorResult<T> {
/**
* 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<T> =
| {
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<IngestionUpsertIFace>;
update: Partial<IngestionUpsert>;
}
/**
@@ -251,7 +243,7 @@ export interface MarkRecord {
*
* @public
*/
export interface IngestionRecord extends IngestionUpsertIFace {
export interface IngestionRecord extends IngestionUpsert {
id: string;
next_action_at: Date;
/**