export async function sqlTrigger()

in app/v4/src/functions/sqlTrigger.ts [6:25]


export async function sqlTrigger(changes: SqlChange[], context: InvocationContext): Promise<void> {
    context.log(`sqlTrigger processed ${changes.length} changes`);
    for (const change of changes) {
        let operation: string;
        switch (change.Operation) {
            case SqlChangeOperation.Insert:
                operation = 'insert';
                break;
            case SqlChangeOperation.Update:
                operation = 'update';
                break;
            case SqlChangeOperation.Delete:
                operation = 'delete';
                break;
            default:
                throw RangeError(`Unrecognized operation "${change.Operation}"`);
        }
        context.log(`sqlTrigger was triggered by operation "${operation}" for "${JSON.stringify(change.Item)}"`);
    }
}