strict mode check

Signed-off-by: Fredrik Adelöw <freben@gmail.com>
This commit is contained in:
Fredrik Adelöw
2023-10-07 17:13:55 +02:00
parent 8d756968f9
commit 2bc82320e2
@@ -36,8 +36,9 @@ export async function markForStitching(options: {
const entityRefs = split(options.entityRefs);
const entityIds = split(options.entityIds);
const knex = options.knex;
const mode = options.strategy.mode;
if (options.strategy.mode === 'immediate') {
if (mode === 'immediate') {
for (const chunk of entityRefs) {
await knex
.table<DbFinalEntitiesRow>('final_entities')
@@ -74,7 +75,7 @@ export async function markForStitching(options: {
})
.whereIn('entity_id', chunk);
}
} else {
} else if (mode === 'deferred') {
// It's OK that this is shared across refresh state rows; it just needs to
// be uniquely generated for every new stitch request.
const ticket = uuid();
@@ -96,6 +97,8 @@ export async function markForStitching(options: {
})
.whereIn('entity_id', chunk);
}
} else {
throw new Error(`Unknown stitching strategy mode ${mode}`);
}
}