6071 return only updated fields of records in zapier update trigger (#8193)
- move webhook triggers into `entity-events-to-db.listener.ts` - refactor event management - add a `@OnDatabaseEvent` decorator to manage database events - add updatedFields in updated events - update openApi webhooks docs - update zapier integration
This commit is contained in:
@ -1,20 +1,21 @@
|
||||
import { Bundle, ZObject } from 'zapier-platform-core';
|
||||
|
||||
import { findObjectNamesSingularKey } from '../triggers/find_object_names_singular';
|
||||
import {
|
||||
listSample,
|
||||
Operation,
|
||||
perform,
|
||||
performSubscribe,
|
||||
performUnsubscribe,
|
||||
subscribe,
|
||||
perform,
|
||||
performList,
|
||||
DatabaseEventAction,
|
||||
} from '../utils/triggers/triggers.utils';
|
||||
|
||||
export const triggerRecordKey = 'trigger_record';
|
||||
|
||||
const performSubscribe = (z: ZObject, bundle: Bundle) =>
|
||||
subscribe(z, bundle, bundle.inputData.operation);
|
||||
const performList = (z: ZObject, bundle: Bundle) =>
|
||||
listSample(z, bundle, bundle.inputData.operation === Operation.delete);
|
||||
const choices = Object.values(DatabaseEventAction).reduce(
|
||||
(acc, action) => {
|
||||
acc[action] = action;
|
||||
return acc;
|
||||
},
|
||||
{} as Record<DatabaseEventAction, DatabaseEventAction>,
|
||||
);
|
||||
|
||||
export default {
|
||||
key: triggerRecordKey,
|
||||
@ -37,12 +38,7 @@ export default {
|
||||
key: 'operation',
|
||||
required: true,
|
||||
label: 'Operation',
|
||||
choices: {
|
||||
[Operation.create]: Operation.create,
|
||||
[Operation.update]: Operation.update,
|
||||
[Operation.delete]: Operation.delete,
|
||||
[Operation.destroy]: Operation.destroy,
|
||||
},
|
||||
choices,
|
||||
altersDynamicFields: true,
|
||||
},
|
||||
],
|
||||
|
||||
Reference in New Issue
Block a user