Rename 'deltaMapper' to 'onEvent'

Signed-off-by: Damon Kaswell <damon.kaswell1@hp.com>
This commit is contained in:
Damon Kaswell
2023-01-13 08:33:46 -08:00
parent b7154302ea
commit c01b1f0ac5
3 changed files with 14 additions and 11 deletions
@@ -50,7 +50,12 @@ export class IncrementalCatalogBuilder {
// @public
export interface IncrementalEntityProvider<TCursor, TContext> {
around(burst: (context: TContext) => Promise<void>): Promise<void>;
deltaMapper?: (payload: unknown) => {
getProviderName(): string;
next(
context: TContext,
cursor?: TCursor,
): Promise<EntityIteratorResult<TCursor>>;
onEvent?: (payload: unknown) => {
delta:
| {
added: DeferredEntity[];
@@ -60,11 +65,6 @@ export interface IncrementalEntityProvider<TCursor, TContext> {
}
| undefined;
};
getProviderName(): string;
next(
context: TContext,
cursor?: TCursor,
): Promise<EntityIteratorResult<TCursor>>;
}
// @public (undocumented)
@@ -347,11 +347,11 @@ export class IncrementalIngestionEngine
`incremental-engine: Received ${this.providerEventTopic} event`,
);
if (!provider.deltaMapper) {
if (!provider.onEvent) {
return;
}
const update = provider.deltaMapper(eventPayload);
const update = provider.onEvent(eventPayload);
if (update.delta) {
if (update.delta.added.length > 0) {
@@ -77,10 +77,13 @@ export interface IncrementalEntityProvider<TCursor, TContext> {
around(burst: (context: TContext) => Promise<void>): Promise<void>;
/**
* If present, this method maps incoming payloads to apply updates
* outside of the incremental ingestion schedule.
* If present, this method accepts an incoming event, and maps the
* payload to an object containing a delta mutation.
*
* If a delta is present, the incremental entity provider will apply
* it automatically.
*/
deltaMapper?: (payload: unknown) => {
onEvent?: (payload: unknown) => {
delta:
| {
added: DeferredEntity[];