Skip to content

Commit

Permalink
FAI-14503: Batch Hermes GraphQL queries
Browse files Browse the repository at this point in the history
1. fix logic error
  • Loading branch information
ted-faros committed Jan 23, 2025
1 parent df3a4e3 commit 030d04b
Showing 1 changed file with 10 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import {AirbyteRecord} from 'faros-airbyte-cdk';
import {FarosGraphSchema} from 'faros-js-client';
import {Dictionary} from 'ts-essentials';

import {Edition} from '../../common/types';
import {
Converter,
DestinationModel,
Expand Down Expand Up @@ -71,18 +70,16 @@ export class FarosFeed extends Converter {
if (!modelRecord) return [];
const {model, rec} = modelRecord;

if (ctx.config.edition_configs.edition === Edition.COMMUNITY) {
// Full model deletion records.
// E.g., {"vcs_TeamMembership__Deletion":{"where":"my-source"}}
// These are issued by the feed and are only applicable to the V1 API
// We accumulate the model names in 'resetModels' to reset them in topological order
if (model.endsWith('__Deletion') && Object.entries(rec).length == 1) {
const [key, value] = Object.entries(rec).pop();
if (key === 'where' && typeof value == 'string') {
const [baseModel] = model.split('__', 1);
ctx.registerStreamResetModels('faros_feed', new Set([baseModel]));
return [];
}
// Full model deletion records.
// E.g., {"vcs_TeamMembership__Deletion":{"where":"my-source"}}
// These are issued by the feed and are only applicable to the V1 API
// We accumulate the model names in 'resetModels' to reset them in topological order
if (model.endsWith('__Deletion') && Object.entries(rec).length == 1) {
const [key, value] = Object.entries(rec).pop();
if (key === 'where' && typeof value == 'string') {
const [baseModel] = model.split('__', 1);
ctx.registerStreamResetModels('faros_feed', new Set([baseModel]));
return [];
}
}

Expand Down

0 comments on commit 030d04b

Please sign in to comment.