@zapier/zapier-sdk 0.65.0 → 0.68.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +48 -0
- package/README.md +64 -34
- package/dist/api/client.d.ts.map +1 -1
- package/dist/api/client.js +2 -0
- package/dist/api/debug.d.ts.map +1 -1
- package/dist/api/debug.js +6 -4
- package/dist/api/polling.d.ts +2 -0
- package/dist/api/polling.d.ts.map +1 -1
- package/dist/api/polling.js +10 -2
- package/dist/auth.d.ts.map +1 -1
- package/dist/auth.js +8 -5
- package/dist/core-stack.d.ts +24 -0
- package/dist/core-stack.d.ts.map +1 -0
- package/dist/core-stack.js +32 -0
- package/dist/experimental.cjs +1598 -1323
- package/dist/experimental.d.mts +3476 -224
- package/dist/experimental.d.ts +3508 -256
- package/dist/experimental.d.ts.map +1 -1
- package/dist/experimental.js +117 -87
- package/dist/experimental.mjs +1585 -1322
- package/dist/formatters/action.d.ts +4 -0
- package/dist/formatters/action.d.ts.map +1 -0
- package/dist/formatters/action.js +18 -0
- package/dist/formatters/actionResult.d.ts +3 -0
- package/dist/formatters/actionResult.d.ts.map +1 -0
- package/dist/formatters/actionResult.js +25 -0
- package/dist/formatters/app.d.ts +4 -0
- package/dist/formatters/app.d.ts.map +1 -0
- package/dist/formatters/app.js +10 -0
- package/dist/formatters/clientCredentials.d.ts +5 -0
- package/dist/formatters/clientCredentials.d.ts.map +1 -0
- package/dist/formatters/clientCredentials.js +27 -0
- package/dist/formatters/connection.d.ts +4 -0
- package/dist/formatters/connection.d.ts.map +1 -0
- package/dist/formatters/connection.js +26 -0
- package/dist/formatters/field.d.ts +4 -0
- package/dist/formatters/field.d.ts.map +1 -0
- package/dist/formatters/field.js +51 -0
- package/dist/formatters/inputFieldChoice.d.ts +4 -0
- package/dist/formatters/inputFieldChoice.d.ts.map +1 -0
- package/dist/formatters/inputFieldChoice.js +16 -0
- package/dist/formatters/tableField.d.ts +4 -0
- package/dist/formatters/tableField.d.ts.map +1 -0
- package/dist/formatters/tableField.js +7 -0
- package/dist/formatters/tableRecord.d.ts +5 -3
- package/dist/formatters/tableRecord.d.ts.map +1 -1
- package/dist/formatters/tableRecord.js +4 -3
- package/dist/formatters/triggerInbox.d.ts +4 -0
- package/dist/formatters/triggerInbox.d.ts.map +1 -0
- package/dist/formatters/triggerInbox.js +31 -0
- package/dist/formatters/triggerMessage.d.ts +5 -0
- package/dist/formatters/triggerMessage.d.ts.map +1 -0
- package/dist/formatters/triggerMessage.js +34 -0
- package/dist/formatters/userProfile.d.ts +4 -0
- package/dist/formatters/userProfile.d.ts.map +1 -0
- package/dist/formatters/userProfile.js +19 -0
- package/dist/{index-JhNxS_mq.d.mts → index-oRnHsPn5.d.mts} +12906 -7603
- package/dist/{index-JhNxS_mq.d.ts → index-oRnHsPn5.d.ts} +12906 -7603
- package/dist/index.cjs +1729 -1469
- package/dist/index.d.mts +2 -2
- package/dist/index.d.ts +12 -9
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +21 -7
- package/dist/index.mjs +1716 -1468
- package/dist/plugins/api/index.d.ts +1 -1
- package/dist/plugins/api/index.js +1 -1
- package/dist/plugins/apps/index.d.ts +8 -5
- package/dist/plugins/apps/index.d.ts.map +1 -1
- package/dist/plugins/apps/index.js +1 -1
- package/dist/plugins/capabilities/index.d.ts +1 -1
- package/dist/plugins/capabilities/index.js +1 -1
- package/dist/plugins/codeSubstrate/cancelDurableRun/index.d.ts +32 -2
- package/dist/plugins/codeSubstrate/cancelDurableRun/index.d.ts.map +1 -1
- package/dist/plugins/codeSubstrate/cancelDurableRun/index.js +1 -1
- package/dist/plugins/codeSubstrate/createWorkflow/index.d.ts +2 -2
- package/dist/plugins/codeSubstrate/createWorkflow/index.js +1 -1
- package/dist/plugins/codeSubstrate/deleteWorkflow/index.d.ts +27 -2
- package/dist/plugins/codeSubstrate/deleteWorkflow/index.d.ts.map +1 -1
- package/dist/plugins/codeSubstrate/deleteWorkflow/index.js +1 -1
- package/dist/plugins/codeSubstrate/disableWorkflow/index.d.ts +27 -2
- package/dist/plugins/codeSubstrate/disableWorkflow/index.d.ts.map +1 -1
- package/dist/plugins/codeSubstrate/disableWorkflow/index.js +1 -1
- package/dist/plugins/codeSubstrate/enableWorkflow/index.d.ts +27 -2
- package/dist/plugins/codeSubstrate/enableWorkflow/index.d.ts.map +1 -1
- package/dist/plugins/codeSubstrate/enableWorkflow/index.js +1 -1
- package/dist/plugins/codeSubstrate/getDurableRun/index.d.ts +32 -2
- package/dist/plugins/codeSubstrate/getDurableRun/index.d.ts.map +1 -1
- package/dist/plugins/codeSubstrate/getDurableRun/index.js +1 -1
- package/dist/plugins/codeSubstrate/getTriggerRun/index.d.ts +2 -2
- package/dist/plugins/codeSubstrate/getTriggerRun/index.js +1 -1
- package/dist/plugins/codeSubstrate/getWorkflow/index.d.ts +27 -2
- package/dist/plugins/codeSubstrate/getWorkflow/index.d.ts.map +1 -1
- package/dist/plugins/codeSubstrate/getWorkflow/index.js +1 -1
- package/dist/plugins/codeSubstrate/getWorkflowRun/index.d.ts +55 -2
- package/dist/plugins/codeSubstrate/getWorkflowRun/index.d.ts.map +1 -1
- package/dist/plugins/codeSubstrate/getWorkflowRun/index.js +1 -1
- package/dist/plugins/codeSubstrate/getWorkflowVersion/index.d.ts +51 -2
- package/dist/plugins/codeSubstrate/getWorkflowVersion/index.d.ts.map +1 -1
- package/dist/plugins/codeSubstrate/getWorkflowVersion/index.js +1 -1
- package/dist/plugins/codeSubstrate/listDurableRuns/index.d.ts +3 -3
- package/dist/plugins/codeSubstrate/listDurableRuns/index.d.ts.map +1 -1
- package/dist/plugins/codeSubstrate/listDurableRuns/index.js +1 -1
- package/dist/plugins/codeSubstrate/listWorkflowRuns/index.d.ts +28 -3
- package/dist/plugins/codeSubstrate/listWorkflowRuns/index.d.ts.map +1 -1
- package/dist/plugins/codeSubstrate/listWorkflowRuns/index.js +1 -1
- package/dist/plugins/codeSubstrate/listWorkflowVersions/index.d.ts +28 -3
- package/dist/plugins/codeSubstrate/listWorkflowVersions/index.d.ts.map +1 -1
- package/dist/plugins/codeSubstrate/listWorkflowVersions/index.js +1 -1
- package/dist/plugins/codeSubstrate/listWorkflows/index.d.ts +3 -3
- package/dist/plugins/codeSubstrate/listWorkflows/index.d.ts.map +1 -1
- package/dist/plugins/codeSubstrate/listWorkflows/index.js +2 -3
- package/dist/plugins/codeSubstrate/publishWorkflowVersion/index.d.ts +27 -2
- package/dist/plugins/codeSubstrate/publishWorkflowVersion/index.d.ts.map +1 -1
- package/dist/plugins/codeSubstrate/publishWorkflowVersion/index.js +1 -1
- package/dist/plugins/codeSubstrate/runDurable/index.d.ts +2 -2
- package/dist/plugins/codeSubstrate/runDurable/index.js +1 -1
- package/dist/plugins/codeSubstrate/triggerWorkflow/index.d.ts +73 -0
- package/dist/plugins/codeSubstrate/triggerWorkflow/index.d.ts.map +1 -0
- package/dist/plugins/codeSubstrate/triggerWorkflow/index.js +52 -0
- package/dist/plugins/codeSubstrate/triggerWorkflow/schemas.d.ts +16 -0
- package/dist/plugins/codeSubstrate/triggerWorkflow/schemas.d.ts.map +1 -0
- package/dist/plugins/codeSubstrate/triggerWorkflow/schemas.js +31 -0
- package/dist/plugins/codeSubstrate/updateWorkflow/index.d.ts +27 -2
- package/dist/plugins/codeSubstrate/updateWorkflow/index.d.ts.map +1 -1
- package/dist/plugins/codeSubstrate/updateWorkflow/index.js +1 -1
- package/dist/plugins/connections/index.d.ts +1 -1
- package/dist/plugins/connections/index.js +1 -1
- package/dist/plugins/createClientCredentials/index.d.ts +2 -2
- package/dist/plugins/createClientCredentials/index.d.ts.map +1 -1
- package/dist/plugins/createClientCredentials/index.js +4 -2
- package/dist/plugins/createClientCredentials/schemas.d.ts +1 -2
- package/dist/plugins/createClientCredentials/schemas.d.ts.map +1 -1
- package/dist/plugins/deleteClientCredentials/index.d.ts +24 -2
- package/dist/plugins/deleteClientCredentials/index.d.ts.map +1 -1
- package/dist/plugins/deleteClientCredentials/index.js +2 -2
- package/dist/plugins/deleteClientCredentials/schemas.d.ts +1 -2
- package/dist/plugins/deleteClientCredentials/schemas.d.ts.map +1 -1
- package/dist/plugins/deprecated/authentications.d.ts +144 -16
- package/dist/plugins/deprecated/authentications.d.ts.map +1 -1
- package/dist/plugins/deprecated/authentications.js +14 -5
- package/dist/plugins/deprecated/inputFields.d.ts +58 -23
- package/dist/plugins/deprecated/inputFields.d.ts.map +1 -1
- package/dist/plugins/deprecated/inputFields.js +15 -7
- package/dist/plugins/eventEmission/event-emission-hook.d.ts +10 -0
- package/dist/plugins/eventEmission/event-emission-hook.d.ts.map +1 -0
- package/dist/plugins/eventEmission/event-emission-hook.js +47 -0
- package/dist/plugins/eventEmission/index.d.ts +5 -3
- package/dist/plugins/eventEmission/index.d.ts.map +1 -1
- package/dist/plugins/eventEmission/index.js +16 -9
- package/dist/plugins/eventEmission/method-metadata.d.ts +16 -0
- package/dist/plugins/eventEmission/method-metadata.d.ts.map +1 -0
- package/dist/plugins/eventEmission/method-metadata.js +20 -0
- package/dist/plugins/eventEmission/transport.d.ts.map +1 -1
- package/dist/plugins/eventEmission/transport.js +2 -1
- package/dist/plugins/eventEmission/types.d.ts +1 -1
- package/dist/plugins/eventEmission/types.d.ts.map +1 -1
- package/dist/plugins/fetch/index.d.ts +11 -5
- package/dist/plugins/fetch/index.d.ts.map +1 -1
- package/dist/plugins/fetch/index.js +42 -32
- package/dist/plugins/fetch/schemas.d.ts +1 -1
- package/dist/plugins/findFirstConnection/index.d.ts +4 -4
- package/dist/plugins/findFirstConnection/index.d.ts.map +1 -1
- package/dist/plugins/findFirstConnection/index.js +4 -2
- package/dist/plugins/findFirstConnection/schemas.d.ts +2 -2
- package/dist/plugins/findUniqueConnection/index.d.ts +4 -4
- package/dist/plugins/findUniqueConnection/index.d.ts.map +1 -1
- package/dist/plugins/findUniqueConnection/index.js +4 -2
- package/dist/plugins/findUniqueConnection/schemas.d.ts +2 -2
- package/dist/plugins/getAction/index.d.ts +141 -4
- package/dist/plugins/getAction/index.d.ts.map +1 -1
- package/dist/plugins/getAction/index.js +5 -3
- package/dist/plugins/getAction/schemas.d.ts +6 -6
- package/dist/plugins/getActionInputFieldsSchema/index.d.ts +232 -3
- package/dist/plugins/getActionInputFieldsSchema/index.d.ts.map +1 -1
- package/dist/plugins/getActionInputFieldsSchema/index.js +3 -3
- package/dist/plugins/getActionInputFieldsSchema/schemas.d.ts +6 -6
- package/dist/plugins/getApp/index.d.ts +4 -4
- package/dist/plugins/getApp/index.d.ts.map +1 -1
- package/dist/plugins/getApp/index.js +3 -1
- package/dist/plugins/getApp/schemas.d.ts +4 -4
- package/dist/plugins/getConnection/index.d.ts +125 -2
- package/dist/plugins/getConnection/index.d.ts.map +1 -1
- package/dist/plugins/getConnection/index.js +4 -2
- package/dist/plugins/getProfile/index.d.ts +2 -2
- package/dist/plugins/getProfile/index.d.ts.map +1 -1
- package/dist/plugins/getProfile/index.js +4 -2
- package/dist/plugins/getProfile/schemas.d.ts +1 -2
- package/dist/plugins/getProfile/schemas.d.ts.map +1 -1
- package/dist/plugins/listActionInputFieldChoices/index.d.ts +287 -4
- package/dist/plugins/listActionInputFieldChoices/index.d.ts.map +1 -1
- package/dist/plugins/listActionInputFieldChoices/index.js +6 -4
- package/dist/plugins/listActionInputFieldChoices/schemas.d.ts +8 -8
- package/dist/plugins/listActionInputFieldChoices/schemas.d.ts.map +1 -1
- package/dist/plugins/listActionInputFieldChoices/schemas.js +1 -22
- package/dist/plugins/listActionInputFields/index.d.ts +168 -5
- package/dist/plugins/listActionInputFields/index.d.ts.map +1 -1
- package/dist/plugins/listActionInputFields/index.js +7 -5
- package/dist/plugins/listActionInputFields/schemas.d.ts +6 -6
- package/dist/plugins/listActions/index.d.ts +140 -3
- package/dist/plugins/listActions/index.d.ts.map +1 -1
- package/dist/plugins/listActions/index.js +6 -4
- package/dist/plugins/listActions/schemas.d.ts +4 -4
- package/dist/plugins/listApps/index.d.ts +3 -3
- package/dist/plugins/listApps/index.d.ts.map +1 -1
- package/dist/plugins/listApps/index.js +6 -4
- package/dist/plugins/listClientCredentials/index.d.ts +3 -3
- package/dist/plugins/listClientCredentials/index.d.ts.map +1 -1
- package/dist/plugins/listClientCredentials/index.js +6 -4
- package/dist/plugins/listConnections/index.d.ts +140 -3
- package/dist/plugins/listConnections/index.d.ts.map +1 -1
- package/dist/plugins/listConnections/index.js +7 -5
- package/dist/plugins/listConnections/schemas.d.ts +2 -2
- package/dist/plugins/manifest/index.d.ts +1 -1
- package/dist/plugins/manifest/index.d.ts.map +1 -1
- package/dist/plugins/manifest/index.js +6 -4
- package/dist/plugins/registry/index.d.ts +1 -1
- package/dist/plugins/registry/index.js +1 -1
- package/dist/plugins/request/index.d.ts +8 -5
- package/dist/plugins/request/index.d.ts.map +1 -1
- package/dist/plugins/request/index.js +4 -3
- package/dist/plugins/request/schemas.d.ts +2 -2
- package/dist/plugins/runAction/index.d.ts +168 -5
- package/dist/plugins/runAction/index.d.ts.map +1 -1
- package/dist/plugins/runAction/index.js +9 -5
- package/dist/plugins/runAction/schemas.d.ts +6 -6
- package/dist/plugins/tables/createTable/index.d.ts +2 -2
- package/dist/plugins/tables/createTable/index.js +2 -2
- package/dist/plugins/tables/createTable/schemas.d.ts +1 -2
- package/dist/plugins/tables/createTable/schemas.d.ts.map +1 -1
- package/dist/plugins/tables/createTableFields/index.d.ts +34 -2
- package/dist/plugins/tables/createTableFields/index.d.ts.map +1 -1
- package/dist/plugins/tables/createTableFields/index.js +4 -2
- package/dist/plugins/tables/createTableFields/schemas.d.ts +3 -4
- package/dist/plugins/tables/createTableFields/schemas.d.ts.map +1 -1
- package/dist/plugins/tables/createTableRecords/index.d.ts +63 -2
- package/dist/plugins/tables/createTableRecords/index.d.ts.map +1 -1
- package/dist/plugins/tables/createTableRecords/index.js +2 -2
- package/dist/plugins/tables/createTableRecords/schemas.d.ts +3 -4
- package/dist/plugins/tables/createTableRecords/schemas.d.ts.map +1 -1
- package/dist/plugins/tables/deleteTable/index.d.ts +34 -2
- package/dist/plugins/tables/deleteTable/index.d.ts.map +1 -1
- package/dist/plugins/tables/deleteTable/index.js +2 -2
- package/dist/plugins/tables/deleteTable/schemas.d.ts +3 -4
- package/dist/plugins/tables/deleteTable/schemas.d.ts.map +1 -1
- package/dist/plugins/tables/deleteTableFields/index.d.ts +63 -2
- package/dist/plugins/tables/deleteTableFields/index.d.ts.map +1 -1
- package/dist/plugins/tables/deleteTableFields/index.js +2 -2
- package/dist/plugins/tables/deleteTableFields/schemas.d.ts +4 -5
- package/dist/plugins/tables/deleteTableFields/schemas.d.ts.map +1 -1
- package/dist/plugins/tables/deleteTableRecords/index.d.ts +84 -2
- package/dist/plugins/tables/deleteTableRecords/index.d.ts.map +1 -1
- package/dist/plugins/tables/deleteTableRecords/index.js +2 -2
- package/dist/plugins/tables/deleteTableRecords/schemas.d.ts +4 -5
- package/dist/plugins/tables/deleteTableRecords/schemas.d.ts.map +1 -1
- package/dist/plugins/tables/getTable/index.d.ts +34 -2
- package/dist/plugins/tables/getTable/index.d.ts.map +1 -1
- package/dist/plugins/tables/getTable/index.js +2 -2
- package/dist/plugins/tables/getTable/schemas.d.ts +2 -2
- package/dist/plugins/tables/getTableRecord/index.d.ts +84 -2
- package/dist/plugins/tables/getTableRecord/index.d.ts.map +1 -1
- package/dist/plugins/tables/getTableRecord/index.js +2 -2
- package/dist/plugins/tables/getTableRecord/schemas.d.ts +6 -7
- package/dist/plugins/tables/getTableRecord/schemas.d.ts.map +1 -1
- package/dist/plugins/tables/getTableRecord/schemas.js +1 -10
- package/dist/plugins/tables/listTableFields/index.d.ts +34 -2
- package/dist/plugins/tables/listTableFields/index.d.ts.map +1 -1
- package/dist/plugins/tables/listTableFields/index.js +4 -2
- package/dist/plugins/tables/listTableFields/schemas.d.ts +4 -5
- package/dist/plugins/tables/listTableFields/schemas.d.ts.map +1 -1
- package/dist/plugins/tables/listTableFields/schemas.js +1 -9
- package/dist/plugins/tables/listTableRecords/index.d.ts +65 -4
- package/dist/plugins/tables/listTableRecords/index.d.ts.map +1 -1
- package/dist/plugins/tables/listTableRecords/index.js +3 -3
- package/dist/plugins/tables/listTableRecords/schemas.d.ts +2 -2
- package/dist/plugins/tables/listTables/index.d.ts +3 -3
- package/dist/plugins/tables/listTables/index.d.ts.map +1 -1
- package/dist/plugins/tables/listTables/index.js +4 -4
- package/dist/plugins/tables/updateTableRecords/index.d.ts +63 -2
- package/dist/plugins/tables/updateTableRecords/index.d.ts.map +1 -1
- package/dist/plugins/tables/updateTableRecords/index.js +2 -2
- package/dist/plugins/tables/updateTableRecords/schemas.d.ts +3 -4
- package/dist/plugins/tables/updateTableRecords/schemas.d.ts.map +1 -1
- package/dist/plugins/triggers/ackTriggerInboxMessages/index.d.ts +59 -2
- package/dist/plugins/triggers/ackTriggerInboxMessages/index.d.ts.map +1 -1
- package/dist/plugins/triggers/ackTriggerInboxMessages/index.js +1 -1
- package/dist/plugins/triggers/ackTriggerInboxMessages/schemas.d.ts +1 -1
- package/dist/plugins/triggers/createTriggerInbox/index.d.ts +231 -2
- package/dist/plugins/triggers/createTriggerInbox/index.d.ts.map +1 -1
- package/dist/plugins/triggers/createTriggerInbox/index.js +3 -1
- package/dist/plugins/triggers/createTriggerInbox/schemas.d.ts +3 -4
- package/dist/plugins/triggers/createTriggerInbox/schemas.d.ts.map +1 -1
- package/dist/plugins/triggers/deleteTriggerInbox/index.d.ts +33 -2
- package/dist/plugins/triggers/deleteTriggerInbox/index.d.ts.map +1 -1
- package/dist/plugins/triggers/deleteTriggerInbox/index.js +3 -1
- package/dist/plugins/triggers/deleteTriggerInbox/schemas.d.ts +2 -3
- package/dist/plugins/triggers/deleteTriggerInbox/schemas.d.ts.map +1 -1
- package/dist/plugins/triggers/drainTriggerInbox/index.d.ts +68 -6
- package/dist/plugins/triggers/drainTriggerInbox/index.d.ts.map +1 -1
- package/dist/plugins/triggers/drainTriggerInbox/index.js +1 -1
- package/dist/plugins/triggers/drainTriggerInbox/schemas.d.ts +2 -2
- package/dist/plugins/triggers/ensureTriggerInbox/index.d.ts +231 -2
- package/dist/plugins/triggers/ensureTriggerInbox/index.d.ts.map +1 -1
- package/dist/plugins/triggers/ensureTriggerInbox/index.js +3 -1
- package/dist/plugins/triggers/ensureTriggerInbox/schemas.d.ts +3 -4
- package/dist/plugins/triggers/ensureTriggerInbox/schemas.d.ts.map +1 -1
- package/dist/plugins/triggers/getTriggerInbox/index.d.ts +33 -2
- package/dist/plugins/triggers/getTriggerInbox/index.d.ts.map +1 -1
- package/dist/plugins/triggers/getTriggerInbox/index.js +3 -1
- package/dist/plugins/triggers/getTriggerInbox/schemas.d.ts +2 -3
- package/dist/plugins/triggers/getTriggerInbox/schemas.d.ts.map +1 -1
- package/dist/plugins/triggers/getTriggerInputFieldsSchema/index.d.ts +232 -3
- package/dist/plugins/triggers/getTriggerInputFieldsSchema/index.d.ts.map +1 -1
- package/dist/plugins/triggers/getTriggerInputFieldsSchema/index.js +1 -1
- package/dist/plugins/triggers/getTriggerInputFieldsSchema/schemas.d.ts +2 -2
- package/dist/plugins/triggers/leaseTriggerInboxMessages/index.d.ts +33 -2
- package/dist/plugins/triggers/leaseTriggerInboxMessages/index.d.ts.map +1 -1
- package/dist/plugins/triggers/leaseTriggerInboxMessages/index.js +1 -1
- package/dist/plugins/triggers/leaseTriggerInboxMessages/schemas.d.ts +1 -1
- package/dist/plugins/triggers/listTriggerInboxMessages/index.d.ts +34 -3
- package/dist/plugins/triggers/listTriggerInboxMessages/index.d.ts.map +1 -1
- package/dist/plugins/triggers/listTriggerInboxMessages/index.js +5 -13
- package/dist/plugins/triggers/listTriggerInboxMessages/schemas.d.ts +1 -1
- package/dist/plugins/triggers/listTriggerInboxes/index.d.ts +3 -3
- package/dist/plugins/triggers/listTriggerInboxes/index.d.ts.map +1 -1
- package/dist/plugins/triggers/listTriggerInboxes/index.js +5 -14
- package/dist/plugins/triggers/listTriggerInputFieldChoices/index.d.ts +288 -5
- package/dist/plugins/triggers/listTriggerInputFieldChoices/index.d.ts.map +1 -1
- package/dist/plugins/triggers/listTriggerInputFieldChoices/index.js +7 -5
- package/dist/plugins/triggers/listTriggerInputFieldChoices/schemas.d.ts +3 -3
- package/dist/plugins/triggers/listTriggerInputFields/index.d.ts +234 -5
- package/dist/plugins/triggers/listTriggerInputFields/index.d.ts.map +1 -1
- package/dist/plugins/triggers/listTriggerInputFields/index.js +6 -5
- package/dist/plugins/triggers/listTriggerInputFields/schemas.d.ts +2 -2
- package/dist/plugins/triggers/listTriggers/index.d.ts +142 -5
- package/dist/plugins/triggers/listTriggers/index.d.ts.map +1 -1
- package/dist/plugins/triggers/listTriggers/index.js +6 -5
- package/dist/plugins/triggers/listTriggers/schemas.d.ts +1 -1
- package/dist/plugins/triggers/pauseTriggerInbox/index.d.ts +33 -2
- package/dist/plugins/triggers/pauseTriggerInbox/index.d.ts.map +1 -1
- package/dist/plugins/triggers/pauseTriggerInbox/index.js +3 -1
- package/dist/plugins/triggers/pauseTriggerInbox/schemas.d.ts +2 -3
- package/dist/plugins/triggers/pauseTriggerInbox/schemas.d.ts.map +1 -1
- package/dist/plugins/triggers/releaseTriggerInboxMessages/index.d.ts +59 -2
- package/dist/plugins/triggers/releaseTriggerInboxMessages/index.d.ts.map +1 -1
- package/dist/plugins/triggers/releaseTriggerInboxMessages/index.js +1 -1
- package/dist/plugins/triggers/releaseTriggerInboxMessages/schemas.d.ts +1 -1
- package/dist/plugins/triggers/resumeTriggerInbox/index.d.ts +33 -2
- package/dist/plugins/triggers/resumeTriggerInbox/index.d.ts.map +1 -1
- package/dist/plugins/triggers/resumeTriggerInbox/index.js +3 -1
- package/dist/plugins/triggers/resumeTriggerInbox/schemas.d.ts +2 -3
- package/dist/plugins/triggers/resumeTriggerInbox/schemas.d.ts.map +1 -1
- package/dist/plugins/triggers/updateTriggerInbox/index.d.ts +33 -2
- package/dist/plugins/triggers/updateTriggerInbox/index.d.ts.map +1 -1
- package/dist/plugins/triggers/updateTriggerInbox/index.js +3 -1
- package/dist/plugins/triggers/updateTriggerInbox/schemas.d.ts +2 -3
- package/dist/plugins/triggers/updateTriggerInbox/schemas.d.ts.map +1 -1
- package/dist/plugins/triggers/watchTriggerInbox/index.d.ts +37 -6
- package/dist/plugins/triggers/watchTriggerInbox/index.d.ts.map +1 -1
- package/dist/plugins/triggers/watchTriggerInbox/index.js +1 -1
- package/dist/resolvers/actionKey.d.ts +3 -2
- package/dist/resolvers/actionKey.d.ts.map +1 -1
- package/dist/resolvers/actionType.d.ts +7 -2
- package/dist/resolvers/actionType.d.ts.map +1 -1
- package/dist/resolvers/actionType.js +3 -0
- package/dist/resolvers/appKey.d.ts +10 -5
- package/dist/resolvers/appKey.d.ts.map +1 -1
- package/dist/resolvers/appKey.js +3 -0
- package/dist/resolvers/clientCredentialsName.d.ts +1 -1
- package/dist/resolvers/clientCredentialsName.d.ts.map +1 -1
- package/dist/resolvers/clientId.d.ts +3 -2
- package/dist/resolvers/clientId.d.ts.map +1 -1
- package/dist/resolvers/clientId.js +1 -1
- package/dist/resolvers/connectionId.d.ts +5 -2
- package/dist/resolvers/connectionId.d.ts.map +1 -1
- package/dist/resolvers/connectionId.js +1 -1
- package/dist/resolvers/durableRunId.d.ts +3 -2
- package/dist/resolvers/durableRunId.d.ts.map +1 -1
- package/dist/resolvers/durableRunId.js +3 -2
- package/dist/resolvers/inputFieldKey.d.ts +3 -2
- package/dist/resolvers/inputFieldKey.d.ts.map +1 -1
- package/dist/resolvers/inputFieldKey.js +1 -1
- package/dist/resolvers/tableFieldIds.d.ts +3 -2
- package/dist/resolvers/tableFieldIds.d.ts.map +1 -1
- package/dist/resolvers/tableFields.d.ts +2 -2
- package/dist/resolvers/tableFields.d.ts.map +1 -1
- package/dist/resolvers/tableFilters.d.ts +3 -2
- package/dist/resolvers/tableFilters.d.ts.map +1 -1
- package/dist/resolvers/tableId.d.ts +3 -2
- package/dist/resolvers/tableId.d.ts.map +1 -1
- package/dist/resolvers/tableId.js +1 -1
- package/dist/resolvers/tableName.d.ts +1 -1
- package/dist/resolvers/tableName.d.ts.map +1 -1
- package/dist/resolvers/tableRecordId.d.ts +4 -3
- package/dist/resolvers/tableRecordId.d.ts.map +1 -1
- package/dist/resolvers/tableRecords.d.ts +4 -3
- package/dist/resolvers/tableRecords.d.ts.map +1 -1
- package/dist/resolvers/tableSort.d.ts +3 -2
- package/dist/resolvers/tableSort.d.ts.map +1 -1
- package/dist/resolvers/triggerInbox.d.ts +3 -2
- package/dist/resolvers/triggerInbox.d.ts.map +1 -1
- package/dist/resolvers/triggerInbox.js +1 -1
- package/dist/resolvers/triggerMessages.d.ts +3 -2
- package/dist/resolvers/triggerMessages.d.ts.map +1 -1
- package/dist/resolvers/triggerMessages.js +2 -4
- package/dist/resolvers/workflowId.d.ts +3 -2
- package/dist/resolvers/workflowId.d.ts.map +1 -1
- package/dist/resolvers/workflowId.js +3 -2
- package/dist/resolvers/workflowRunId.d.ts +3 -2
- package/dist/resolvers/workflowRunId.d.ts.map +1 -1
- package/dist/resolvers/workflowRunId.js +5 -5
- package/dist/resolvers/workflowVersionId.d.ts +3 -2
- package/dist/resolvers/workflowVersionId.d.ts.map +1 -1
- package/dist/resolvers/workflowVersionId.js +7 -7
- package/dist/schemas/Action.d.ts.map +1 -1
- package/dist/schemas/Action.js +6 -30
- package/dist/schemas/App.d.ts +0 -1
- package/dist/schemas/App.d.ts.map +1 -1
- package/dist/schemas/App.js +2 -14
- package/dist/schemas/ClientCredentials.d.ts.map +1 -1
- package/dist/schemas/ClientCredentials.js +3 -41
- package/dist/schemas/Connection.d.ts.map +1 -1
- package/dist/schemas/Connection.js +2 -28
- package/dist/schemas/Field.d.ts.map +1 -1
- package/dist/schemas/Field.js +3 -70
- package/dist/schemas/Run.d.ts.map +1 -1
- package/dist/schemas/Run.js +3 -29
- package/dist/schemas/TriggerInbox.d.ts.map +1 -1
- package/dist/schemas/TriggerInbox.js +1 -33
- package/dist/schemas/TriggerMessage.d.ts.map +1 -1
- package/dist/schemas/TriggerMessage.js +2 -60
- package/dist/schemas/UserProfile.d.ts +0 -1
- package/dist/schemas/UserProfile.d.ts.map +1 -1
- package/dist/schemas/UserProfile.js +1 -20
- package/dist/sdk.d.ts +2761 -441
- package/dist/sdk.d.ts.map +1 -1
- package/dist/sdk.js +93 -129
- package/dist/types/errors.d.ts +44 -42
- package/dist/types/errors.d.ts.map +1 -1
- package/dist/types/errors.js +79 -33
- package/dist/types/functions.d.ts +1 -41
- package/dist/types/functions.d.ts.map +1 -1
- package/dist/types/properties.d.ts +7 -7
- package/dist/types/properties.js +1 -1
- package/dist/types/sdk.d.ts +1 -1
- package/dist/types/sdk.d.ts.map +1 -1
- package/dist/types/telemetry-events.d.ts +1 -1
- package/dist/types/telemetry-events.d.ts.map +1 -1
- package/dist/utils/domain-utils.js +1 -1
- package/dist/utils/logging.d.ts +1 -12
- package/dist/utils/logging.d.ts.map +1 -1
- package/dist/utils/logging.js +2 -20
- package/dist/utils/pagination.d.ts +38 -0
- package/dist/utils/pagination.d.ts.map +1 -0
- package/dist/utils/pagination.js +53 -0
- package/package.json +3 -2
- package/dist/registry.d.ts +0 -9
- package/dist/registry.d.ts.map +0 -1
- package/dist/registry.js +0 -103
- package/dist/types/meta.d.ts +0 -9
- package/dist/types/meta.d.ts.map +0 -1
- package/dist/types/meta.js +0 -3
- package/dist/types/plugin.d.ts +0 -84
- package/dist/types/plugin.d.ts.map +0 -1
- package/dist/types/plugin.js +0 -13
- package/dist/types/registry.d.ts +0 -54
- package/dist/types/registry.d.ts.map +0 -1
- package/dist/types/registry.js +0 -1
- package/dist/utils/function-utils.d.ts +0 -59
- package/dist/utils/function-utils.d.ts.map +0 -1
- package/dist/utils/function-utils.js +0 -245
- package/dist/utils/pagination-utils.d.ts +0 -73
- package/dist/utils/pagination-utils.d.ts.map +0 -1
- package/dist/utils/pagination-utils.js +0 -308
- package/dist/utils/plugin-utils.d.ts +0 -245
- package/dist/utils/plugin-utils.d.ts.map +0 -1
- package/dist/utils/plugin-utils.js +0 -234
- package/dist/utils/schema-utils.d.ts +0 -211
- package/dist/utils/schema-utils.d.ts.map +0 -1
- package/dist/utils/schema-utils.js +0 -72
- package/dist/utils/string-utils.d.ts +0 -40
- package/dist/utils/string-utils.d.ts.map +0 -1
- package/dist/utils/string-utils.js +0 -69
- package/dist/utils/telemetry-context.d.ts +0 -15
- package/dist/utils/telemetry-context.d.ts.map +0 -1
- package/dist/utils/telemetry-context.js +0 -48
- package/dist/utils/telemetry-utils.d.ts +0 -44
- package/dist/utils/telemetry-utils.d.ts.map +0 -1
- package/dist/utils/telemetry-utils.js +0 -60
- package/dist/utils/validation.d.ts +0 -4
- package/dist/utils/validation.d.ts.map +0 -1
- package/dist/utils/validation.js +0 -30
package/dist/experimental.mjs
CHANGED
|
@@ -11,37 +11,64 @@ var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require
|
|
|
11
11
|
if (typeof require !== "undefined") return require.apply(this, arguments);
|
|
12
12
|
throw Error('Dynamic require of "' + x + '" is not supported');
|
|
13
13
|
});
|
|
14
|
+
function toTitleCase(input) {
|
|
15
|
+
return input.replace(/([a-z0-9])([A-Z])/g, "$1 $2").replace(/[_\-]+/g, " ").replace(/\s+/g, " ").trim().split(" ").map((word) => word.charAt(0).toUpperCase() + word.slice(1).toLowerCase()).join(" ");
|
|
16
|
+
}
|
|
17
|
+
function toSnakeCase(input) {
|
|
18
|
+
let result = input.replace(/([a-z0-9])([A-Z])/g, "$1_$2").replace(/[\s\-]+/g, "_").replace(/_+/g, "_").replace(/^_|_$/g, "").toLowerCase();
|
|
19
|
+
if (/^[0-9]/.test(result)) {
|
|
20
|
+
result = "_" + result;
|
|
21
|
+
}
|
|
22
|
+
return result;
|
|
23
|
+
}
|
|
24
|
+
function pluralize(word) {
|
|
25
|
+
if (/s$/i.test(word)) return word;
|
|
26
|
+
if (/[bcdfghjklmnpqrstvwxz]y$/i.test(word)) {
|
|
27
|
+
return word.slice(0, -1) + "ies";
|
|
28
|
+
}
|
|
29
|
+
return word + "s";
|
|
30
|
+
}
|
|
31
|
+
function pluralizeLastWord(title) {
|
|
32
|
+
const words = title.split(" ");
|
|
33
|
+
return [...words.slice(0, -1), pluralize(words[words.length - 1])].join(" ");
|
|
34
|
+
}
|
|
35
|
+
function resolveCategoryDefinition(ref) {
|
|
36
|
+
const def = typeof ref === "string" ? { key: ref } : ref;
|
|
37
|
+
const title = def.title ?? toTitleCase(def.key);
|
|
38
|
+
return {
|
|
39
|
+
key: def.key,
|
|
40
|
+
title,
|
|
41
|
+
titlePlural: def.titlePlural ?? pluralizeLastWord(title)
|
|
42
|
+
};
|
|
43
|
+
}
|
|
14
44
|
function canonicalInputSchema(schema) {
|
|
15
45
|
if (schema instanceof z.ZodUnion) {
|
|
16
46
|
return schema.options[0];
|
|
17
47
|
}
|
|
18
48
|
return schema;
|
|
19
49
|
}
|
|
20
|
-
var categoryDefinitions = {
|
|
21
|
-
account: { title: "Account" },
|
|
22
|
-
app: { title: "App", titlePlural: "Apps" },
|
|
23
|
-
connection: { title: "Connection" },
|
|
24
|
-
action: { title: "Action" },
|
|
25
|
-
"client-credentials": {
|
|
26
|
-
title: "Client Credentials",
|
|
27
|
-
titlePlural: "Client Credentials"
|
|
28
|
-
},
|
|
29
|
-
table: { title: "Table" },
|
|
30
|
-
trigger: { title: "Trigger" },
|
|
31
|
-
"code-workflow": {
|
|
32
|
-
title: "Code Workflow",
|
|
33
|
-
titlePlural: "Code Workflows"
|
|
34
|
-
},
|
|
35
|
-
http: { title: "HTTP Request" },
|
|
36
|
-
utility: { title: "Utility", titlePlural: "Utilities" },
|
|
37
|
-
other: { title: "Other" }
|
|
38
|
-
};
|
|
39
|
-
var knownCategories = Object.keys(categoryDefinitions);
|
|
40
50
|
function buildRegistry({
|
|
41
51
|
sdk,
|
|
42
52
|
meta,
|
|
43
53
|
packageFilter
|
|
44
54
|
}) {
|
|
55
|
+
const definitionsByKey = /* @__PURE__ */ new Map();
|
|
56
|
+
const objectDeclaredKeys = /* @__PURE__ */ new Set();
|
|
57
|
+
for (const m of Object.values(meta)) {
|
|
58
|
+
for (const ref of m.categories ?? []) {
|
|
59
|
+
const key = typeof ref === "string" ? ref : ref.key;
|
|
60
|
+
if (typeof ref === "object") {
|
|
61
|
+
objectDeclaredKeys.add(key);
|
|
62
|
+
definitionsByKey.set(key, resolveCategoryDefinition(ref));
|
|
63
|
+
} else if (!objectDeclaredKeys.has(key)) {
|
|
64
|
+
definitionsByKey.set(key, resolveCategoryDefinition(ref));
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
if (!definitionsByKey.has("other")) {
|
|
69
|
+
definitionsByKey.set("other", resolveCategoryDefinition("other"));
|
|
70
|
+
}
|
|
71
|
+
const knownCategories = Array.from(definitionsByKey.keys());
|
|
45
72
|
const functions = Object.keys(meta).filter((key) => {
|
|
46
73
|
const property = sdk[key];
|
|
47
74
|
if (typeof property === "function") return true;
|
|
@@ -59,7 +86,9 @@ function buildRegistry({
|
|
|
59
86
|
inputSchema: canonicalInputSchema(m.inputSchema),
|
|
60
87
|
inputParameters: m.inputParameters,
|
|
61
88
|
outputSchema: m.outputSchema,
|
|
62
|
-
categories: m.categories
|
|
89
|
+
categories: (m.categories ?? []).map(
|
|
90
|
+
(c) => typeof c === "string" ? c : c.key
|
|
91
|
+
),
|
|
63
92
|
resolvers: m.resolvers,
|
|
64
93
|
formatter: m.formatter,
|
|
65
94
|
experimental: m.experimental,
|
|
@@ -74,471 +103,134 @@ function buildRegistry({
|
|
|
74
103
|
const filteredCategories = knownCategories.slice().sort((a, b) => {
|
|
75
104
|
if (a === "other") return 1;
|
|
76
105
|
if (b === "other") return -1;
|
|
77
|
-
return
|
|
78
|
-
categoryDefinitions[b].title
|
|
79
|
-
);
|
|
106
|
+
return definitionsByKey.get(a).title.localeCompare(definitionsByKey.get(b).title);
|
|
80
107
|
}).map((categoryKey) => {
|
|
81
108
|
const categoryFunctions = filteredFunctions.filter(
|
|
82
109
|
(f) => f.categories.includes(categoryKey) || categoryKey === "other" && !f.categories.some((c) => knownCategories.includes(c))
|
|
83
110
|
).map((f) => f.name).sort();
|
|
84
|
-
const
|
|
111
|
+
const def = definitionsByKey.get(categoryKey);
|
|
85
112
|
return {
|
|
86
113
|
key: categoryKey,
|
|
87
|
-
title:
|
|
88
|
-
titlePlural:
|
|
114
|
+
title: def.title,
|
|
115
|
+
titlePlural: def.titlePlural,
|
|
89
116
|
functions: categoryFunctions
|
|
90
117
|
};
|
|
91
118
|
}).filter((category) => category.functions.length > 0);
|
|
92
119
|
return { functions: filteredFunctions, categories: filteredCategories };
|
|
93
120
|
}
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
121
|
+
function composeVoid(existing, added) {
|
|
122
|
+
if (!existing) return added;
|
|
123
|
+
if (!added) return existing;
|
|
124
|
+
return (ctx) => {
|
|
125
|
+
existing(ctx);
|
|
126
|
+
added(ctx);
|
|
127
|
+
};
|
|
101
128
|
}
|
|
102
|
-
function
|
|
103
|
-
|
|
129
|
+
function buildHooks(existing, added) {
|
|
130
|
+
const result = {};
|
|
131
|
+
const start = composeVoid(existing.onMethodStart, added.onMethodStart);
|
|
132
|
+
if (start) result.onMethodStart = start;
|
|
133
|
+
const end = composeVoid(existing.onMethodEnd, added.onMethodEnd);
|
|
134
|
+
if (end) result.onMethodEnd = end;
|
|
135
|
+
return result;
|
|
104
136
|
}
|
|
105
|
-
function
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
137
|
+
function createDeprecationLogger(tag) {
|
|
138
|
+
const loggedDeprecations = /* @__PURE__ */ new Set();
|
|
139
|
+
return {
|
|
140
|
+
logDeprecation(message) {
|
|
141
|
+
if (loggedDeprecations.has(message)) return;
|
|
142
|
+
loggedDeprecations.add(message);
|
|
143
|
+
console.warn(`[${tag}] Deprecation: ${message}`);
|
|
144
|
+
},
|
|
145
|
+
resetDeprecationWarnings() {
|
|
146
|
+
loggedDeprecations.clear();
|
|
147
|
+
}
|
|
148
|
+
};
|
|
110
149
|
}
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
150
|
+
var { logDeprecation} = createDeprecationLogger("core");
|
|
151
|
+
var CORE_ERROR_SYMBOL = Symbol.for("kitcore.error");
|
|
152
|
+
var CoreErrorCode = {
|
|
153
|
+
Validation: "VALIDATION_ERROR",
|
|
154
|
+
Unknown: "UNKNOWN_ERROR"
|
|
155
|
+
};
|
|
156
|
+
var CoreError = class extends Error {
|
|
157
|
+
constructor(message, options = {}) {
|
|
158
|
+
super(message);
|
|
159
|
+
this.name = "CoreError";
|
|
160
|
+
if (options.statusCode !== void 0) this.statusCode = options.statusCode;
|
|
161
|
+
if (options.errors !== void 0) this.errors = options.errors;
|
|
162
|
+
if (options.cause !== void 0) this.cause = options.cause;
|
|
163
|
+
if (options.response !== void 0) this.response = options.response;
|
|
164
|
+
Object.setPrototypeOf(this, new.target.prototype);
|
|
165
|
+
}
|
|
166
|
+
};
|
|
167
|
+
function createCoreError(options, adaptError) {
|
|
168
|
+
const error = adaptError?.(options) ?? new CoreError(options.message, { cause: options.cause });
|
|
169
|
+
Object.defineProperty(error, CORE_ERROR_SYMBOL, {
|
|
170
|
+
value: true,
|
|
171
|
+
enumerable: false,
|
|
172
|
+
configurable: true,
|
|
173
|
+
writable: false
|
|
114
174
|
});
|
|
115
|
-
|
|
175
|
+
Object.defineProperty(error, "coreCode", {
|
|
176
|
+
value: options.code,
|
|
177
|
+
enumerable: false,
|
|
178
|
+
configurable: true,
|
|
179
|
+
writable: false
|
|
180
|
+
});
|
|
181
|
+
return error;
|
|
116
182
|
}
|
|
117
|
-
function
|
|
118
|
-
return
|
|
183
|
+
function isCoreError(value) {
|
|
184
|
+
return Boolean(
|
|
185
|
+
value && typeof value === "object" && value[CORE_ERROR_SYMBOL] === true
|
|
186
|
+
);
|
|
119
187
|
}
|
|
120
|
-
function
|
|
121
|
-
if (
|
|
122
|
-
|
|
123
|
-
}
|
|
124
|
-
if (schema instanceof z.ZodOptional) {
|
|
125
|
-
return isPositional(schema._zod.def.innerType);
|
|
126
|
-
}
|
|
127
|
-
if (schema instanceof z.ZodDefault) {
|
|
128
|
-
return isPositional(schema._zod.def.innerType);
|
|
129
|
-
}
|
|
130
|
-
return false;
|
|
188
|
+
function getCoreErrorCode(value) {
|
|
189
|
+
if (!isCoreError(value)) return void 0;
|
|
190
|
+
return value.coreCode;
|
|
131
191
|
}
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
function getZapierSdkService() {
|
|
136
|
-
return globalThis.process?.env?.ZAPIER_SDK_SERVICE;
|
|
192
|
+
function getCoreErrorCause(value) {
|
|
193
|
+
if (!isCoreError(value)) return void 0;
|
|
194
|
+
return value.cause;
|
|
137
195
|
}
|
|
138
|
-
var
|
|
139
|
-
var
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
)
|
|
149
|
-
|
|
150
|
-
}
|
|
151
|
-
return parsed;
|
|
196
|
+
var CURSOR_VERSION = 1;
|
|
197
|
+
var CURSOR_SOURCE = {
|
|
198
|
+
API: "api",
|
|
199
|
+
SDK: "sdk"
|
|
200
|
+
};
|
|
201
|
+
function encodeBase64(str) {
|
|
202
|
+
return btoa(
|
|
203
|
+
Array.from(
|
|
204
|
+
new TextEncoder().encode(str),
|
|
205
|
+
(b) => String.fromCharCode(b)
|
|
206
|
+
).join("")
|
|
207
|
+
);
|
|
152
208
|
}
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
function parseConcurrencyEnvVar(name) {
|
|
157
|
-
const value = globalThis.process?.env?.[name];
|
|
158
|
-
if (!value) return void 0;
|
|
159
|
-
if (value === "Infinity") return Infinity;
|
|
160
|
-
if (/^[1-9]\d*$/.test(value)) {
|
|
161
|
-
const parsed = parseInt(value, 10);
|
|
162
|
-
if (parsed <= MAX_CONCURRENCY_LIMIT) return parsed;
|
|
163
|
-
}
|
|
164
|
-
console.warn(
|
|
165
|
-
`[zapier-sdk] Invalid value for ${name}: "${value}" (expected positive integer 1-${MAX_CONCURRENCY_LIMIT} or "Infinity")`
|
|
209
|
+
function decodeBase64(str) {
|
|
210
|
+
return new TextDecoder().decode(
|
|
211
|
+
Uint8Array.from(atob(str), (c) => c.charCodeAt(0))
|
|
166
212
|
);
|
|
167
|
-
return void 0;
|
|
168
213
|
}
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
214
|
+
function encodeApiCursor(cursor) {
|
|
215
|
+
const envelope = {
|
|
216
|
+
v: CURSOR_VERSION,
|
|
217
|
+
source: CURSOR_SOURCE.API,
|
|
218
|
+
cursor
|
|
219
|
+
};
|
|
220
|
+
return encodeBase64(JSON.stringify(envelope));
|
|
175
221
|
}
|
|
176
|
-
function
|
|
177
|
-
const
|
|
178
|
-
|
|
222
|
+
function encodeSdkCursor(offset, cursor) {
|
|
223
|
+
const envelope = {
|
|
224
|
+
v: CURSOR_VERSION,
|
|
225
|
+
source: CURSOR_SOURCE.SDK,
|
|
226
|
+
cursor,
|
|
227
|
+
offset
|
|
228
|
+
};
|
|
229
|
+
return encodeBase64(JSON.stringify(envelope));
|
|
179
230
|
}
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
// src/types/properties.ts
|
|
184
|
-
var AppKeyPropertySchema = withPositional(
|
|
185
|
-
z.string().min(1).describe("App key (e.g., 'SlackCLIAPI' or slug like 'github')")
|
|
186
|
-
);
|
|
187
|
-
var AppPropertySchema = withPositional(
|
|
188
|
-
z.string().min(1).describe(
|
|
189
|
-
"App slug (e.g., 'github'), implementation name (e.g., 'SlackCLIAPI'), or versioned ID (e.g., 'github@1.2.3')"
|
|
190
|
-
)
|
|
191
|
-
);
|
|
192
|
-
var ActionTypePropertySchema = z.enum([
|
|
193
|
-
"read",
|
|
194
|
-
"read_bulk",
|
|
195
|
-
"write",
|
|
196
|
-
"run",
|
|
197
|
-
"search",
|
|
198
|
-
"search_or_write",
|
|
199
|
-
"search_and_write",
|
|
200
|
-
"filter"
|
|
201
|
-
]).describe("Action type that matches the action's defined type");
|
|
202
|
-
var ActionKeyPropertySchema = z.string().min(1).describe("Action key to execute");
|
|
203
|
-
var ActionPropertySchema = withPositional(
|
|
204
|
-
z.string().min(1).describe("Action key (e.g., 'send_message' or 'find_row')")
|
|
205
|
-
);
|
|
206
|
-
var InputFieldPropertySchema = withPositional(
|
|
207
|
-
z.string().min(1).describe("Input field key to get choices for")
|
|
208
|
-
);
|
|
209
|
-
var ConnectionIdPropertySchema = z.union([z.string(), z.number().int().positive()]).describe("Connection ID to use for this action");
|
|
210
|
-
var AuthenticationIdPropertySchema = ConnectionIdPropertySchema.meta({
|
|
211
|
-
deprecated: true
|
|
212
|
-
});
|
|
213
|
-
var ConnectionPropertySchema = z.union([z.string(), z.number().int().positive()]).describe(
|
|
214
|
-
"Connection alias or connection ID (UUID or positive integer). Strings that match a key in the connections map are resolved against it; otherwise the value is used as a connection ID directly."
|
|
215
|
-
);
|
|
216
|
-
var InputsPropertySchema = z.record(z.string(), z.unknown()).describe("Input parameters for the action");
|
|
217
|
-
var LimitPropertySchema = z.number().int().min(1).max(MAX_PAGE_LIMIT).default(50).describe("Maximum number of items to return");
|
|
218
|
-
var OffsetPropertySchema = z.number().int().min(0).default(0).describe("Number of items to skip for pagination");
|
|
219
|
-
var OutputPropertySchema = z.string().describe("Output file path");
|
|
220
|
-
var DebugPropertySchema = z.boolean().default(false).describe("Enable debug logging");
|
|
221
|
-
var ParamsPropertySchema = z.record(z.string(), z.unknown()).describe("Additional parameters");
|
|
222
|
-
var ActionTimeoutMsPropertySchema = z.number().min(1e3).optional().describe(
|
|
223
|
-
`Maximum time to wait for action completion in milliseconds (default: ${DEFAULT_ACTION_TIMEOUT_MS})`
|
|
224
|
-
);
|
|
225
|
-
var TablePropertySchema = withPositional(
|
|
226
|
-
z.string().regex(/^[A-Z0-9]{26}$/, "Table ID must be a valid ULID").describe("The unique identifier of the table")
|
|
227
|
-
);
|
|
228
|
-
var RecordPropertySchema = withPositional(
|
|
229
|
-
z.string().regex(/^[A-Z0-9]{26}$/, "Record ID must be a valid ULID").describe("The unique identifier of the record")
|
|
230
|
-
);
|
|
231
|
-
var RecordsPropertySchema = z.array(z.string().regex(/^[A-Z0-9]{26}$/, "Record ID must be a valid ULID")).min(1).max(100).describe("Record IDs to operate on");
|
|
232
|
-
var FieldsPropertySchema = z.array(z.union([z.string(), z.number()])).describe(
|
|
233
|
-
'Fields to operate on. Accepts field names (e.g., "Email") or IDs (e.g., "f6", "6", or 6).'
|
|
234
|
-
);
|
|
235
|
-
var AppsPropertySchema = z.array(z.string()).describe("Filter by app keys (e.g., 'SlackCLIAPI' or slug like 'github')");
|
|
236
|
-
var TablesPropertySchema = z.array(z.string()).describe("Filter by specific table IDs");
|
|
237
|
-
var ConnectionsPropertySchema = z.array(z.string()).describe("List of connection IDs to filter by");
|
|
238
|
-
var TriggerInboxPropertySchema = withPositional(
|
|
239
|
-
z.string().min(1).describe(
|
|
240
|
-
"Trigger inbox identifier \u2014 UUID or name. Non-UUID values are resolved by name via the inbox list endpoint."
|
|
241
|
-
)
|
|
242
|
-
);
|
|
243
|
-
var TriggerInboxNamePropertySchema = z.string().min(1).max(100).describe(
|
|
244
|
-
"Inbox name; unique per (user, account). Enables get-or-create on createTriggerInbox."
|
|
245
|
-
);
|
|
246
|
-
var LeasePropertySchema = z.string().min(1).describe("Lease ID returned from leaseTriggerInboxMessages");
|
|
247
|
-
var LeaseSecondsPropertySchema = z.number().int().min(1).max(3600).describe(
|
|
248
|
-
"Seconds until the lease expires; messages return to available if not acked. API default is 300 (5 minutes)."
|
|
249
|
-
);
|
|
250
|
-
var LeaseLimitPropertySchema = z.number().int().min(1).max(100).describe("Maximum messages to lease in a single batch (1-100)");
|
|
251
|
-
|
|
252
|
-
// src/plugins/apps/schemas.ts
|
|
253
|
-
var ActionExecutionInputSchema = z.object({
|
|
254
|
-
inputs: z.record(z.string(), z.unknown()).optional(),
|
|
255
|
-
/** @deprecated Use `connection` instead. */
|
|
256
|
-
connectionId: ConnectionIdPropertySchema.optional().meta({
|
|
257
|
-
deprecated: true
|
|
258
|
-
}),
|
|
259
|
-
connection: ConnectionPropertySchema.optional(),
|
|
260
|
-
/** @deprecated Use connection instead */
|
|
261
|
-
authenticationId: AuthenticationIdPropertySchema.optional().meta({
|
|
262
|
-
deprecated: true
|
|
263
|
-
}),
|
|
264
|
-
timeoutMs: ActionTimeoutMsPropertySchema
|
|
265
|
-
}).describe(
|
|
266
|
-
"Execute an action with the given inputs for the bound app, as an alternative to runAction"
|
|
267
|
-
).meta({
|
|
268
|
-
aliases: { connectionId: "connection", authenticationId: "connection" }
|
|
269
|
-
});
|
|
270
|
-
var AppFactoryInputSchema = z.object({
|
|
271
|
-
/** @deprecated Use `connection` instead. */
|
|
272
|
-
connectionId: ConnectionIdPropertySchema.optional().meta({
|
|
273
|
-
deprecated: true
|
|
274
|
-
}),
|
|
275
|
-
connection: ConnectionPropertySchema.optional(),
|
|
276
|
-
/** @deprecated Use connection instead */
|
|
277
|
-
authenticationId: AuthenticationIdPropertySchema.optional().meta({
|
|
278
|
-
deprecated: true
|
|
279
|
-
})
|
|
280
|
-
}).describe("Bind a connection alias or numeric connectionId to an app").meta({
|
|
281
|
-
aliases: { connectionId: "connection", authenticationId: "connection" }
|
|
282
|
-
});
|
|
283
|
-
|
|
284
|
-
// src/types/errors.ts
|
|
285
|
-
var ZapierError = class extends Error {
|
|
286
|
-
constructor(message, options = {}) {
|
|
287
|
-
super(message);
|
|
288
|
-
this.statusCode = options.statusCode;
|
|
289
|
-
this.errors = options.errors;
|
|
290
|
-
this.cause = options.cause;
|
|
291
|
-
this.response = options.response;
|
|
292
|
-
Object.setPrototypeOf(this, new.target.prototype);
|
|
293
|
-
}
|
|
294
|
-
};
|
|
295
|
-
var ZapierApiError = class extends ZapierError {
|
|
296
|
-
constructor(message, options = {}) {
|
|
297
|
-
super(message, options);
|
|
298
|
-
this.name = "ZapierApiError";
|
|
299
|
-
this.code = "ZAPIER_API_ERROR";
|
|
300
|
-
}
|
|
301
|
-
};
|
|
302
|
-
var ZapierAppNotFoundError = class extends ZapierError {
|
|
303
|
-
constructor(message, options = {}) {
|
|
304
|
-
super(message, options);
|
|
305
|
-
this.name = "ZapierAppNotFoundError";
|
|
306
|
-
this.code = "ZAPIER_APP_NOT_FOUND_ERROR";
|
|
307
|
-
this.appKey = options.appKey;
|
|
308
|
-
}
|
|
309
|
-
};
|
|
310
|
-
var ZapierValidationError = class extends ZapierError {
|
|
311
|
-
constructor(message, options = {}) {
|
|
312
|
-
super(message, options);
|
|
313
|
-
this.name = "ZapierValidationError";
|
|
314
|
-
this.code = "ZAPIER_VALIDATION_ERROR";
|
|
315
|
-
this.details = options.details;
|
|
316
|
-
}
|
|
317
|
-
};
|
|
318
|
-
var ZapierUnknownError = class extends ZapierError {
|
|
319
|
-
constructor(message, options = {}) {
|
|
320
|
-
super(message, options);
|
|
321
|
-
this.name = "ZapierUnknownError";
|
|
322
|
-
this.code = "ZAPIER_UNKNOWN_ERROR";
|
|
323
|
-
}
|
|
324
|
-
};
|
|
325
|
-
var ZapierAuthenticationError = class extends ZapierError {
|
|
326
|
-
constructor(message, options = {}) {
|
|
327
|
-
super(message, options);
|
|
328
|
-
this.name = "ZapierAuthenticationError";
|
|
329
|
-
this.code = "ZAPIER_AUTHENTICATION_ERROR";
|
|
330
|
-
}
|
|
331
|
-
};
|
|
332
|
-
var ZapierNotFoundError = class extends ZapierError {
|
|
333
|
-
constructor(message, options = {}) {
|
|
334
|
-
super(message, options);
|
|
335
|
-
this.name = "ZapierNotFoundError";
|
|
336
|
-
this.code = "ZAPIER_NOT_FOUND_ERROR";
|
|
337
|
-
}
|
|
338
|
-
};
|
|
339
|
-
var ZapierResourceNotFoundError = class extends ZapierNotFoundError {
|
|
340
|
-
constructor(message, options = {}) {
|
|
341
|
-
super(message, options);
|
|
342
|
-
this.name = "ZapierResourceNotFoundError";
|
|
343
|
-
this.code = "ZAPIER_RESOURCE_NOT_FOUND_ERROR";
|
|
344
|
-
this.resourceType = options.resourceType;
|
|
345
|
-
this.resourceId = options.resourceId;
|
|
346
|
-
}
|
|
347
|
-
};
|
|
348
|
-
var ZapierConfigurationError = class extends ZapierError {
|
|
349
|
-
constructor(message, options = {}) {
|
|
350
|
-
super(message, options);
|
|
351
|
-
this.name = "ZapierConfigurationError";
|
|
352
|
-
this.code = "ZAPIER_CONFIGURATION_ERROR";
|
|
353
|
-
this.configType = options.configType;
|
|
354
|
-
}
|
|
355
|
-
};
|
|
356
|
-
var ZapierBundleError = class extends ZapierError {
|
|
357
|
-
constructor(message, options = {}) {
|
|
358
|
-
super(message, options);
|
|
359
|
-
this.name = "ZapierBundleError";
|
|
360
|
-
this.code = "ZAPIER_BUNDLE_ERROR";
|
|
361
|
-
this.buildErrors = options.buildErrors;
|
|
362
|
-
}
|
|
363
|
-
};
|
|
364
|
-
var ZapierTimeoutError = class extends ZapierError {
|
|
365
|
-
constructor(message, options = {}) {
|
|
366
|
-
super(message, options);
|
|
367
|
-
this.name = "ZapierTimeoutError";
|
|
368
|
-
this.code = "ZAPIER_TIMEOUT_ERROR";
|
|
369
|
-
this.attempts = options.attempts;
|
|
370
|
-
this.maxAttempts = options.maxAttempts;
|
|
371
|
-
}
|
|
372
|
-
};
|
|
373
|
-
var ZapierActionError = class extends ZapierError {
|
|
374
|
-
constructor(message, options = {}) {
|
|
375
|
-
super(message, options);
|
|
376
|
-
this.name = "ZapierActionError";
|
|
377
|
-
this.code = "ZAPIER_ACTION_ERROR";
|
|
378
|
-
this.appKey = options.appKey;
|
|
379
|
-
this.actionKey = options.actionKey;
|
|
380
|
-
}
|
|
381
|
-
// Legacy accessor for backward compatibility
|
|
382
|
-
get actionErrors() {
|
|
383
|
-
return this.errors;
|
|
384
|
-
}
|
|
385
|
-
};
|
|
386
|
-
var ZapierConflictError = class extends ZapierError {
|
|
387
|
-
constructor(message, options = {}) {
|
|
388
|
-
super(message, options);
|
|
389
|
-
this.name = "ZapierConflictError";
|
|
390
|
-
this.code = "ZAPIER_CONFLICT_ERROR";
|
|
391
|
-
this.resourceType = options.resourceType;
|
|
392
|
-
}
|
|
393
|
-
};
|
|
394
|
-
var ZapierRateLimitError = class extends ZapierError {
|
|
395
|
-
constructor(message, options = {}) {
|
|
396
|
-
super(message, options);
|
|
397
|
-
this.name = "ZapierRateLimitError";
|
|
398
|
-
this.code = "ZAPIER_RATE_LIMIT_ERROR";
|
|
399
|
-
this.rateLimit = options.rateLimit ?? {};
|
|
400
|
-
this.retries = options.retries ?? 0;
|
|
401
|
-
}
|
|
402
|
-
};
|
|
403
|
-
var ZapierApprovalError = class extends ZapierError {
|
|
404
|
-
constructor(message, options = {}) {
|
|
405
|
-
super(message, options);
|
|
406
|
-
this.name = "ZapierApprovalError";
|
|
407
|
-
this.code = "ZAPIER_APPROVAL_ERROR";
|
|
408
|
-
this.approvalId = options.approvalId;
|
|
409
|
-
this.approvalStatus = options.status;
|
|
410
|
-
this.approvalUrl = options.approvalUrl;
|
|
411
|
-
this.pollUrl = options.pollUrl;
|
|
412
|
-
}
|
|
413
|
-
};
|
|
414
|
-
var ZapierRelayError = class extends ZapierError {
|
|
415
|
-
constructor(message, options = {}) {
|
|
416
|
-
super(message, options);
|
|
417
|
-
this.name = "ZapierRelayError";
|
|
418
|
-
this.code = "ZAPIER_RELAY_ERROR";
|
|
419
|
-
}
|
|
420
|
-
};
|
|
421
|
-
function formatErrorMessage(error) {
|
|
422
|
-
let message = error.message;
|
|
423
|
-
if (error.errors && error.errors.length > 0) {
|
|
424
|
-
const additionalErrors = error.errors.slice(1);
|
|
425
|
-
if (additionalErrors.length > 0) {
|
|
426
|
-
const errorDetails = additionalErrors.map((err) => ` \u2022 ${err.detail || err.title || err.code}`).join("\n");
|
|
427
|
-
message += "\n\nAdditional errors:\n" + errorDetails;
|
|
428
|
-
}
|
|
429
|
-
}
|
|
430
|
-
if (error instanceof ZapierAppNotFoundError && error.appKey) {
|
|
431
|
-
message += `
|
|
432
|
-
App key: ${error.appKey}`;
|
|
433
|
-
}
|
|
434
|
-
if (error instanceof ZapierActionError && (error.appKey || error.actionKey)) {
|
|
435
|
-
const context = [];
|
|
436
|
-
if (error.appKey) context.push(`App: ${error.appKey}`);
|
|
437
|
-
if (error.actionKey) context.push(`Action: ${error.actionKey}`);
|
|
438
|
-
message += `
|
|
439
|
-
${context.join(", ")}`;
|
|
440
|
-
}
|
|
441
|
-
if (error instanceof ZapierResourceNotFoundError && (error.resourceType || error.resourceId)) {
|
|
442
|
-
const context = [];
|
|
443
|
-
if (error.resourceType) context.push(`Type: ${error.resourceType}`);
|
|
444
|
-
if (error.resourceId) context.push(`ID: ${error.resourceId}`);
|
|
445
|
-
message += `
|
|
446
|
-
${context.join(", ")}`;
|
|
447
|
-
}
|
|
448
|
-
if (error instanceof ZapierConflictError && error.resourceType) {
|
|
449
|
-
message += `
|
|
450
|
-
Type: ${error.resourceType}`;
|
|
451
|
-
}
|
|
452
|
-
if (error instanceof ZapierTimeoutError && (error.attempts || error.maxAttempts)) {
|
|
453
|
-
const context = [];
|
|
454
|
-
if (error.attempts) context.push(`Attempts: ${error.attempts}`);
|
|
455
|
-
if (error.maxAttempts) context.push(`Max attempts: ${error.maxAttempts}`);
|
|
456
|
-
message += `
|
|
457
|
-
${context.join(", ")}`;
|
|
458
|
-
}
|
|
459
|
-
if (error instanceof ZapierBundleError && error.buildErrors && error.buildErrors.length > 0) {
|
|
460
|
-
message += "\n\nBuild errors:\n" + error.buildErrors.map((err) => ` \u2022 ${err}`).join("\n");
|
|
461
|
-
}
|
|
462
|
-
if (error instanceof ZapierApprovalError && error.approvalUrl) {
|
|
463
|
-
message += `
|
|
464
|
-
Approval URL: ${error.approvalUrl}`;
|
|
465
|
-
}
|
|
466
|
-
if (error instanceof ZapierRateLimitError) {
|
|
467
|
-
const { limit, remaining, retryAfterMs } = error.rateLimit;
|
|
468
|
-
const parts = [];
|
|
469
|
-
if (limit !== void 0) {
|
|
470
|
-
const used = remaining !== void 0 ? limit - remaining : limit;
|
|
471
|
-
parts.push(`${used}/${limit} used`);
|
|
472
|
-
}
|
|
473
|
-
if (retryAfterMs !== void 0 && retryAfterMs > 0) {
|
|
474
|
-
parts.push(`retry in ${formatDuration(retryAfterMs)}`);
|
|
475
|
-
}
|
|
476
|
-
if (error.retries > 0) {
|
|
477
|
-
parts.push(
|
|
478
|
-
`after ${error.retries} retr${error.retries === 1 ? "y" : "ies"}`
|
|
479
|
-
);
|
|
480
|
-
}
|
|
481
|
-
if (parts.length > 0) {
|
|
482
|
-
message += `
|
|
483
|
-
${parts.join(", ")}`;
|
|
484
|
-
}
|
|
485
|
-
}
|
|
486
|
-
if (error.statusCode && !message.includes(`${error.statusCode}`)) {
|
|
487
|
-
message += `
|
|
488
|
-
HTTP Status: ${error.statusCode}`;
|
|
489
|
-
}
|
|
490
|
-
return message;
|
|
491
|
-
}
|
|
492
|
-
function formatDuration(ms) {
|
|
493
|
-
const seconds = Math.round(ms / 1e3);
|
|
494
|
-
if (seconds < 60) return `${seconds}s`;
|
|
495
|
-
const minutes = Math.round(seconds / 60);
|
|
496
|
-
if (minutes < 60) return `${minutes}m`;
|
|
497
|
-
const hours = Math.round(minutes / 60);
|
|
498
|
-
if (hours < 24) return `${hours}h`;
|
|
499
|
-
const days = Math.round(hours / 24);
|
|
500
|
-
return `${days}d`;
|
|
501
|
-
}
|
|
502
|
-
|
|
503
|
-
// src/utils/pagination-utils.ts
|
|
504
|
-
var CURSOR_VERSION = 1;
|
|
505
|
-
var CURSOR_SOURCE = {
|
|
506
|
-
API: "api",
|
|
507
|
-
SDK: "sdk"
|
|
508
|
-
};
|
|
509
|
-
function encodeBase64(str) {
|
|
510
|
-
return btoa(
|
|
511
|
-
Array.from(
|
|
512
|
-
new TextEncoder().encode(str),
|
|
513
|
-
(b) => String.fromCharCode(b)
|
|
514
|
-
).join("")
|
|
515
|
-
);
|
|
516
|
-
}
|
|
517
|
-
function decodeBase64(str) {
|
|
518
|
-
return new TextDecoder().decode(
|
|
519
|
-
Uint8Array.from(atob(str), (c) => c.charCodeAt(0))
|
|
520
|
-
);
|
|
521
|
-
}
|
|
522
|
-
function encodeApiCursor(cursor) {
|
|
523
|
-
const envelope = {
|
|
524
|
-
v: CURSOR_VERSION,
|
|
525
|
-
source: CURSOR_SOURCE.API,
|
|
526
|
-
cursor
|
|
527
|
-
};
|
|
528
|
-
return encodeBase64(JSON.stringify(envelope));
|
|
529
|
-
}
|
|
530
|
-
function encodeSdkCursor(offset, cursor) {
|
|
531
|
-
const envelope = {
|
|
532
|
-
v: CURSOR_VERSION,
|
|
533
|
-
source: CURSOR_SOURCE.SDK,
|
|
534
|
-
cursor,
|
|
535
|
-
offset
|
|
536
|
-
};
|
|
537
|
-
return encodeBase64(JSON.stringify(envelope));
|
|
538
|
-
}
|
|
539
|
-
function decodeIncomingCursor(incoming) {
|
|
540
|
-
if (!incoming) {
|
|
541
|
-
return { offset: 0, cursor: void 0 };
|
|
231
|
+
function decodeIncomingCursor(incoming) {
|
|
232
|
+
if (!incoming) {
|
|
233
|
+
return { offset: 0, cursor: void 0 };
|
|
542
234
|
}
|
|
543
235
|
try {
|
|
544
236
|
const decoded = decodeBase64(incoming);
|
|
@@ -753,144 +445,117 @@ function concatPaginated({
|
|
|
753
445
|
function toIterable(source) {
|
|
754
446
|
return { [Symbol.asyncIterator]: () => source[Symbol.asyncIterator]() };
|
|
755
447
|
}
|
|
756
|
-
|
|
757
|
-
// src/utils/validation.ts
|
|
758
|
-
var validate = (schema, input) => {
|
|
448
|
+
var parseOrThrow = (schema, input, { adaptError } = {}) => {
|
|
759
449
|
const result = schema.safeParse(input);
|
|
760
450
|
if (!result.success) {
|
|
761
|
-
const errorMessages = result.error.issues.map((
|
|
762
|
-
const path =
|
|
763
|
-
return `${path}: ${
|
|
764
|
-
});
|
|
765
|
-
const message = `Validation failed:
|
|
766
|
-
${errorMessages.join("\n ")}`;
|
|
767
|
-
throw new ZapierValidationError(message, {
|
|
768
|
-
details: {
|
|
769
|
-
zodErrors: result.error.issues,
|
|
770
|
-
input
|
|
771
|
-
}
|
|
451
|
+
const errorMessages = result.error.issues.map((issue) => {
|
|
452
|
+
const path = issue.path.length > 0 ? issue.path.join(".") : "input";
|
|
453
|
+
return `${path}: ${issue.message}`;
|
|
772
454
|
});
|
|
455
|
+
throw createCoreError(
|
|
456
|
+
{
|
|
457
|
+
code: CoreErrorCode.Validation,
|
|
458
|
+
message: `Validation failed:
|
|
459
|
+
${errorMessages.join("\n ")}`,
|
|
460
|
+
details: {
|
|
461
|
+
zodErrors: result.error.issues,
|
|
462
|
+
input
|
|
463
|
+
}
|
|
464
|
+
},
|
|
465
|
+
adaptError
|
|
466
|
+
);
|
|
773
467
|
}
|
|
774
468
|
return result.data;
|
|
775
469
|
};
|
|
776
|
-
function createValidator(schema) {
|
|
470
|
+
function createValidator(schema, { adaptError } = {}) {
|
|
777
471
|
return function validateFn(input) {
|
|
778
|
-
return
|
|
472
|
+
return parseOrThrow(schema, input, { adaptError });
|
|
779
473
|
};
|
|
780
474
|
}
|
|
781
|
-
var validateOptions = (schema, options) => {
|
|
782
|
-
|
|
783
|
-
};
|
|
784
|
-
var telemetryStore = null;
|
|
475
|
+
var validateOptions = (schema, options, { adaptError } = {}) => parseOrThrow(schema, options, { adaptError });
|
|
476
|
+
var scopeStore = null;
|
|
785
477
|
try {
|
|
786
|
-
|
|
478
|
+
scopeStore = new AsyncLocalStorage();
|
|
787
479
|
} catch {
|
|
788
480
|
}
|
|
789
|
-
function
|
|
790
|
-
if (!
|
|
791
|
-
|
|
792
|
-
return store !== void 0 && store.depth > 0;
|
|
481
|
+
function getCurrentScope() {
|
|
482
|
+
if (!scopeStore) return void 0;
|
|
483
|
+
return scopeStore.getStore();
|
|
793
484
|
}
|
|
794
|
-
function
|
|
795
|
-
|
|
796
|
-
const currentDepth = telemetryStore.getStore()?.depth ?? -1;
|
|
797
|
-
return telemetryStore.run({ depth: currentDepth + 1 }, fn);
|
|
485
|
+
function getCurrentDepth() {
|
|
486
|
+
return getCurrentScope()?.depth ?? 0;
|
|
798
487
|
}
|
|
799
|
-
function
|
|
800
|
-
if (!
|
|
801
|
-
const
|
|
802
|
-
|
|
803
|
-
store.methodMetadata = { ...store.methodMetadata, ...metadata };
|
|
488
|
+
function runInMethodScope(fn) {
|
|
489
|
+
if (!scopeStore) return fn();
|
|
490
|
+
const currentDepth = scopeStore.getStore()?.depth ?? -1;
|
|
491
|
+
return scopeStore.run({ depth: currentDepth + 1 }, fn);
|
|
804
492
|
}
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
|
|
493
|
+
var runWithTelemetryContext = runInMethodScope;
|
|
494
|
+
function normalizeError(error, adaptError) {
|
|
495
|
+
if (error instanceof Error) return error;
|
|
496
|
+
const message = typeof error === "object" && error !== null && "message" in error && typeof error.message === "string" ? error.message : String(error);
|
|
497
|
+
return createCoreError(
|
|
498
|
+
{
|
|
499
|
+
code: CoreErrorCode.Unknown,
|
|
500
|
+
message,
|
|
501
|
+
cause: error
|
|
502
|
+
},
|
|
503
|
+
adaptError
|
|
504
|
+
);
|
|
808
505
|
}
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
function extractCursor(data) {
|
|
812
|
-
if (!data?.next) {
|
|
813
|
-
return void 0;
|
|
814
|
-
}
|
|
815
|
-
try {
|
|
816
|
-
const urlObj = new URL(data.next);
|
|
817
|
-
const offset = urlObj.searchParams.get("offset");
|
|
818
|
-
return offset || void 0;
|
|
819
|
-
} catch {
|
|
820
|
-
return void 0;
|
|
821
|
-
}
|
|
822
|
-
}
|
|
823
|
-
function normalizeError(error) {
|
|
824
|
-
if (error instanceof ZapierError) {
|
|
825
|
-
return error;
|
|
826
|
-
}
|
|
827
|
-
const message = error instanceof Error ? error.message : String(error);
|
|
828
|
-
const cause = error instanceof Error ? error : void 0;
|
|
829
|
-
if (error instanceof Error) {
|
|
830
|
-
if (error.name === "ZapierAuthenticationError") {
|
|
831
|
-
return new ZapierAuthenticationError(message, { cause });
|
|
832
|
-
}
|
|
833
|
-
}
|
|
834
|
-
return new ZapierUnknownError(message, { cause });
|
|
835
|
-
}
|
|
836
|
-
function createFunction(coreFn, schema, telemetry) {
|
|
506
|
+
function createFunction(coreFn, options) {
|
|
507
|
+
const { sdk, schema } = options;
|
|
837
508
|
const functionName = coreFn.name;
|
|
838
509
|
const namedFunctions = {
|
|
839
|
-
[functionName]: async function(
|
|
840
|
-
return
|
|
510
|
+
[functionName]: async function(callOptions) {
|
|
511
|
+
return runInMethodScope(async () => {
|
|
841
512
|
const startTime = Date.now();
|
|
842
|
-
const normalizedOptions =
|
|
843
|
-
const
|
|
513
|
+
const normalizedOptions = callOptions ?? {};
|
|
514
|
+
const args = [normalizedOptions];
|
|
515
|
+
const depth = getCurrentDepth();
|
|
516
|
+
const hooks = sdk.context.hooks;
|
|
517
|
+
const adaptError = sdk.context.core?.adaptError;
|
|
518
|
+
hooks?.onMethodStart?.({
|
|
519
|
+
methodName: functionName,
|
|
520
|
+
args,
|
|
521
|
+
isPaginated: false,
|
|
522
|
+
depth
|
|
523
|
+
});
|
|
844
524
|
try {
|
|
525
|
+
let result;
|
|
845
526
|
if (schema) {
|
|
846
|
-
const validatedOptions = validateOptions(
|
|
847
|
-
|
|
527
|
+
const validatedOptions = validateOptions(
|
|
528
|
+
schema,
|
|
529
|
+
normalizedOptions,
|
|
530
|
+
{
|
|
531
|
+
adaptError
|
|
532
|
+
}
|
|
533
|
+
);
|
|
534
|
+
result = await coreFn({
|
|
848
535
|
...normalizedOptions,
|
|
849
536
|
...validatedOptions
|
|
850
537
|
});
|
|
851
|
-
|
|
852
|
-
|
|
853
|
-
normalizedOptions
|
|
854
|
-
).length;
|
|
855
|
-
telemetry.onMethodCalled({
|
|
856
|
-
methodName: functionName,
|
|
857
|
-
durationMs: Date.now() - startTime,
|
|
858
|
-
success: true,
|
|
859
|
-
argumentCount,
|
|
860
|
-
isPaginated: false
|
|
861
|
-
});
|
|
862
|
-
}
|
|
863
|
-
return result2;
|
|
864
|
-
}
|
|
865
|
-
const result = await coreFn(normalizedOptions);
|
|
866
|
-
if (!isNested && telemetry?.onMethodCalled) {
|
|
867
|
-
const argumentCount = Object.keys(
|
|
868
|
-
normalizedOptions
|
|
869
|
-
).length;
|
|
870
|
-
telemetry.onMethodCalled({
|
|
871
|
-
methodName: functionName,
|
|
872
|
-
durationMs: Date.now() - startTime,
|
|
873
|
-
success: true,
|
|
874
|
-
argumentCount,
|
|
875
|
-
isPaginated: false
|
|
876
|
-
});
|
|
538
|
+
} else {
|
|
539
|
+
result = await coreFn(normalizedOptions);
|
|
877
540
|
}
|
|
541
|
+
hooks?.onMethodEnd?.({
|
|
542
|
+
methodName: functionName,
|
|
543
|
+
args,
|
|
544
|
+
isPaginated: false,
|
|
545
|
+
depth,
|
|
546
|
+
durationMs: Date.now() - startTime
|
|
547
|
+
});
|
|
878
548
|
return result;
|
|
879
549
|
} catch (error) {
|
|
880
|
-
const normalizedError = normalizeError(error);
|
|
881
|
-
|
|
882
|
-
|
|
883
|
-
|
|
884
|
-
|
|
885
|
-
|
|
886
|
-
|
|
887
|
-
|
|
888
|
-
|
|
889
|
-
error: normalizedError,
|
|
890
|
-
argumentCount,
|
|
891
|
-
isPaginated: false
|
|
892
|
-
});
|
|
893
|
-
}
|
|
550
|
+
const normalizedError = normalizeError(error, adaptError);
|
|
551
|
+
hooks?.onMethodEnd?.({
|
|
552
|
+
methodName: functionName,
|
|
553
|
+
args,
|
|
554
|
+
isPaginated: false,
|
|
555
|
+
depth,
|
|
556
|
+
durationMs: Date.now() - startTime,
|
|
557
|
+
error: normalizedError
|
|
558
|
+
});
|
|
894
559
|
throw normalizedError;
|
|
895
560
|
}
|
|
896
561
|
});
|
|
@@ -898,49 +563,63 @@ function createFunction(coreFn, schema, telemetry) {
|
|
|
898
563
|
};
|
|
899
564
|
return namedFunctions[functionName];
|
|
900
565
|
}
|
|
901
|
-
function
|
|
566
|
+
function isSdkPage(value) {
|
|
567
|
+
if (typeof value !== "object" || value === null) return false;
|
|
568
|
+
const page = value;
|
|
569
|
+
if (!Array.isArray(page.data)) return false;
|
|
570
|
+
if (page.nextCursor !== void 0 && typeof page.nextCursor !== "string") {
|
|
571
|
+
return false;
|
|
572
|
+
}
|
|
573
|
+
return Object.keys(page).every((k) => k === "data" || k === "nextCursor");
|
|
574
|
+
}
|
|
575
|
+
function createPageFunction(coreFn, {
|
|
576
|
+
sdk,
|
|
577
|
+
adaptPage
|
|
578
|
+
}) {
|
|
902
579
|
const functionName = coreFn.name + "Page";
|
|
903
580
|
const namedFunctions = {
|
|
904
581
|
[functionName]: async function(options) {
|
|
905
582
|
try {
|
|
906
|
-
const
|
|
907
|
-
|
|
908
|
-
|
|
909
|
-
|
|
910
|
-
|
|
911
|
-
|
|
912
|
-
} else if (paginatedResult.links?.next) {
|
|
913
|
-
nextCursor = extractCursor({ next: paginatedResult.links.next });
|
|
914
|
-
}
|
|
915
|
-
return {
|
|
916
|
-
data: Array.isArray(paginatedResult.data) ? paginatedResult.data : [paginatedResult.data],
|
|
917
|
-
nextCursor
|
|
918
|
-
};
|
|
919
|
-
}
|
|
920
|
-
if (Array.isArray(result)) {
|
|
921
|
-
return { data: result };
|
|
583
|
+
const response = await coreFn(options);
|
|
584
|
+
const page = adaptPage ? adaptPage(response) : response;
|
|
585
|
+
if (!isSdkPage(page)) {
|
|
586
|
+
throw new Error(
|
|
587
|
+
`${functionName}: paginated result must be exactly { data: TItem[], nextCursor? } (produced by the handler or its \`adaptPage\`); got keys [${page && typeof page === "object" ? Object.keys(page).join(", ") : typeof page}]. If the handler returns a raw shape, set \`adaptPage\` to translate it; if \`adaptPage\` already runs, it must return only \`data\`/\`nextCursor\`.`
|
|
588
|
+
);
|
|
922
589
|
}
|
|
923
|
-
return
|
|
590
|
+
return page;
|
|
924
591
|
} catch (error) {
|
|
925
|
-
throw normalizeError(
|
|
592
|
+
throw normalizeError(
|
|
593
|
+
error,
|
|
594
|
+
sdk.context.core?.adaptError
|
|
595
|
+
);
|
|
926
596
|
}
|
|
927
597
|
}
|
|
928
598
|
};
|
|
929
599
|
return namedFunctions[functionName];
|
|
930
600
|
}
|
|
931
|
-
function createPaginatedFunction(coreFn,
|
|
932
|
-
const
|
|
933
|
-
const
|
|
934
|
-
const
|
|
601
|
+
function createPaginatedFunction(coreFn, options) {
|
|
602
|
+
const { sdk, schema, name, defaultPageSize, adaptPage } = options;
|
|
603
|
+
const pageFunction = createPageFunction(coreFn, { sdk, adaptPage });
|
|
604
|
+
const functionName = name || coreFn.name;
|
|
935
605
|
const namedFunctions = {
|
|
936
|
-
[functionName]: function(
|
|
937
|
-
return
|
|
606
|
+
[functionName]: function(callOptions) {
|
|
607
|
+
return runInMethodScope(() => {
|
|
938
608
|
const startTime = Date.now();
|
|
939
|
-
const normalizedOptions =
|
|
940
|
-
const
|
|
609
|
+
const normalizedOptions = callOptions ?? {};
|
|
610
|
+
const args = [normalizedOptions];
|
|
611
|
+
const depth = getCurrentDepth();
|
|
612
|
+
const hooks = sdk.context.hooks;
|
|
613
|
+
const adaptError = sdk.context.core?.adaptError;
|
|
614
|
+
hooks?.onMethodStart?.({
|
|
615
|
+
methodName: functionName,
|
|
616
|
+
args,
|
|
617
|
+
isPaginated: true,
|
|
618
|
+
depth
|
|
619
|
+
});
|
|
941
620
|
const validatedOptions = {
|
|
942
621
|
...normalizedOptions,
|
|
943
|
-
...
|
|
622
|
+
...schema ? createValidator(schema, { adaptError })(normalizedOptions) : normalizedOptions
|
|
944
623
|
};
|
|
945
624
|
const pageSize = validatedOptions.pageSize ?? defaultPageSize;
|
|
946
625
|
const optimizedOptions = {
|
|
@@ -954,29 +633,23 @@ function createPaginatedFunction(coreFn, schema, telemetry, explicitFunctionName
|
|
|
954
633
|
}
|
|
955
634
|
return result.value;
|
|
956
635
|
});
|
|
957
|
-
if (
|
|
636
|
+
if (hooks?.onMethodEnd) {
|
|
958
637
|
firstPagePromise.then(() => {
|
|
959
|
-
|
|
960
|
-
normalizedOptions
|
|
961
|
-
).length;
|
|
962
|
-
telemetry.onMethodCalled({
|
|
638
|
+
hooks.onMethodEnd({
|
|
963
639
|
methodName: functionName,
|
|
964
|
-
|
|
965
|
-
|
|
966
|
-
|
|
967
|
-
|
|
640
|
+
args,
|
|
641
|
+
isPaginated: true,
|
|
642
|
+
depth,
|
|
643
|
+
durationMs: Date.now() - startTime
|
|
968
644
|
});
|
|
969
645
|
}).catch((error) => {
|
|
970
|
-
|
|
971
|
-
normalizedOptions
|
|
972
|
-
).length;
|
|
973
|
-
telemetry.onMethodCalled({
|
|
646
|
+
hooks.onMethodEnd({
|
|
974
647
|
methodName: functionName,
|
|
648
|
+
args,
|
|
649
|
+
isPaginated: true,
|
|
650
|
+
depth,
|
|
975
651
|
durationMs: Date.now() - startTime,
|
|
976
|
-
|
|
977
|
-
error: error instanceof Error ? error : new Error(String(error)),
|
|
978
|
-
argumentCount,
|
|
979
|
-
isPaginated: true
|
|
652
|
+
error: error instanceof Error ? error : new Error(String(error))
|
|
980
653
|
});
|
|
981
654
|
});
|
|
982
655
|
}
|
|
@@ -1008,37 +681,9 @@ function createPaginatedFunction(coreFn, schema, telemetry, explicitFunctionName
|
|
|
1008
681
|
};
|
|
1009
682
|
return namedFunctions[functionName];
|
|
1010
683
|
}
|
|
1011
|
-
|
|
1012
|
-
// src/utils/telemetry-utils.ts
|
|
1013
|
-
function createTelemetryCallback(emitMethodCalled, methodName) {
|
|
1014
|
-
return {
|
|
1015
|
-
onMethodCalled: (data) => {
|
|
1016
|
-
const metadata = getMethodMetadata();
|
|
1017
|
-
emitMethodCalled({
|
|
1018
|
-
method_name: methodName,
|
|
1019
|
-
execution_duration_ms: data.durationMs,
|
|
1020
|
-
success_flag: data.success,
|
|
1021
|
-
error_message: data.error?.message ?? null,
|
|
1022
|
-
error_type: data.error?.constructor.name ?? null,
|
|
1023
|
-
argument_count: data.argumentCount,
|
|
1024
|
-
is_paginated: data.isPaginated,
|
|
1025
|
-
selected_api: metadata?.selectedApi ?? null,
|
|
1026
|
-
operation_type: metadata?.operationType ?? null,
|
|
1027
|
-
operation_key: metadata?.operationKey ?? null
|
|
1028
|
-
});
|
|
1029
|
-
}
|
|
1030
|
-
};
|
|
1031
|
-
}
|
|
1032
|
-
|
|
1033
|
-
// src/utils/plugin-utils.ts
|
|
1034
684
|
function definePlugin(fn) {
|
|
1035
685
|
return fn;
|
|
1036
686
|
}
|
|
1037
|
-
function maybeTelemetry(sdk, name) {
|
|
1038
|
-
const ctx = sdk.context;
|
|
1039
|
-
if (!ctx.eventEmission) return void 0;
|
|
1040
|
-
return createTelemetryCallback(ctx.eventEmission.emitMethodCalled, name);
|
|
1041
|
-
}
|
|
1042
687
|
function createPluginMethod(sdk, config) {
|
|
1043
688
|
const { name, inputSchema, handler, ...metaFields } = config;
|
|
1044
689
|
const namedHandlers = {
|
|
@@ -1046,11 +691,10 @@ function createPluginMethod(sdk, config) {
|
|
|
1046
691
|
return handler({ sdk, options });
|
|
1047
692
|
}
|
|
1048
693
|
};
|
|
1049
|
-
const wrappedFn = createFunction(
|
|
1050
|
-
|
|
1051
|
-
inputSchema
|
|
1052
|
-
|
|
1053
|
-
);
|
|
694
|
+
const wrappedFn = createFunction(namedHandlers[name], {
|
|
695
|
+
sdk,
|
|
696
|
+
schema: inputSchema
|
|
697
|
+
});
|
|
1054
698
|
return {
|
|
1055
699
|
[name]: wrappedFn,
|
|
1056
700
|
context: {
|
|
@@ -1068,29 +712,22 @@ function createPaginatedPluginMethod(sdk, config) {
|
|
|
1068
712
|
name,
|
|
1069
713
|
inputSchema,
|
|
1070
714
|
handler,
|
|
1071
|
-
|
|
715
|
+
adaptPage,
|
|
1072
716
|
defaultPageSize,
|
|
1073
717
|
...metaFields
|
|
1074
718
|
} = config;
|
|
1075
|
-
const
|
|
1076
|
-
[name]:
|
|
1077
|
-
|
|
1078
|
-
if (extractCursorFn) {
|
|
1079
|
-
const extracted = extractCursorFn(response);
|
|
1080
|
-
if (extracted !== void 0) {
|
|
1081
|
-
return { data: response.data, nextCursor: extracted };
|
|
1082
|
-
}
|
|
1083
|
-
}
|
|
1084
|
-
return response;
|
|
719
|
+
const namedHandlers = {
|
|
720
|
+
[name]: function(options) {
|
|
721
|
+
return handler({ sdk, options });
|
|
1085
722
|
}
|
|
1086
723
|
};
|
|
1087
|
-
const wrappedFn = createPaginatedFunction(
|
|
1088
|
-
|
|
1089
|
-
inputSchema,
|
|
1090
|
-
maybeTelemetry(sdk, name),
|
|
724
|
+
const wrappedFn = createPaginatedFunction(namedHandlers[name], {
|
|
725
|
+
sdk,
|
|
726
|
+
schema: inputSchema,
|
|
1091
727
|
name,
|
|
1092
|
-
defaultPageSize
|
|
1093
|
-
|
|
728
|
+
defaultPageSize,
|
|
729
|
+
adaptPage
|
|
730
|
+
});
|
|
1094
731
|
return {
|
|
1095
732
|
[name]: wrappedFn,
|
|
1096
733
|
context: {
|
|
@@ -1103,88 +740,682 @@ function createPaginatedPluginMethod(sdk, config) {
|
|
|
1103
740
|
}
|
|
1104
741
|
};
|
|
1105
742
|
}
|
|
1106
|
-
function
|
|
743
|
+
function splitPluginContribution(result) {
|
|
744
|
+
const { context, ...rootKeys } = result;
|
|
745
|
+
const { meta, hooks, ...contextRest } = context ?? {};
|
|
746
|
+
return {
|
|
747
|
+
rootKeys,
|
|
748
|
+
meta: meta ?? {},
|
|
749
|
+
hooks: hooks ?? {},
|
|
750
|
+
contextRest
|
|
751
|
+
};
|
|
752
|
+
}
|
|
753
|
+
var RESERVED_ROOT_KEYS = /* @__PURE__ */ new Set([
|
|
754
|
+
"context",
|
|
755
|
+
"getRegistry",
|
|
756
|
+
"addPlugin"
|
|
757
|
+
]);
|
|
758
|
+
function hasOwn(obj, key) {
|
|
759
|
+
return Object.prototype.hasOwnProperty.call(obj, key);
|
|
760
|
+
}
|
|
761
|
+
function setOwn(target, key, value) {
|
|
762
|
+
Object.defineProperty(target, key, {
|
|
763
|
+
value,
|
|
764
|
+
enumerable: true,
|
|
765
|
+
configurable: true,
|
|
766
|
+
writable: true
|
|
767
|
+
});
|
|
768
|
+
}
|
|
769
|
+
function checkCollisions(target, source, kind, callerLabel, override) {
|
|
1107
770
|
for (const key of Object.keys(source)) {
|
|
1108
|
-
if (
|
|
771
|
+
if (kind === "root key" && RESERVED_ROOT_KEYS.has(key)) {
|
|
1109
772
|
throw new Error(
|
|
1110
|
-
|
|
773
|
+
`${callerLabel}: plugin attempted to register reserved root key "${key}". The SDK uses this key for its own accessor; rename the plugin's method.`
|
|
1111
774
|
);
|
|
1112
775
|
}
|
|
1113
|
-
|
|
1114
|
-
target[key] = source[key];
|
|
1115
|
-
}
|
|
1116
|
-
}
|
|
1117
|
-
function mergeMetaKeysWithCollisionCheck(target, source, seen) {
|
|
1118
|
-
for (const key of Object.keys(source)) {
|
|
1119
|
-
if (seen.has(key)) {
|
|
776
|
+
if (!override && hasOwn(target, key)) {
|
|
1120
777
|
throw new Error(
|
|
1121
|
-
|
|
778
|
+
`${callerLabel}: duplicate ${kind} "${key}". If the override is intentional, pass { override: true } in the options.`
|
|
1122
779
|
);
|
|
1123
780
|
}
|
|
1124
|
-
seen.add(key);
|
|
1125
|
-
target[key] = source[key];
|
|
1126
781
|
}
|
|
1127
782
|
}
|
|
1128
|
-
function
|
|
783
|
+
function applyOwnProperties(target, source) {
|
|
1129
784
|
for (const key of Object.keys(source)) {
|
|
1130
|
-
|
|
1131
|
-
|
|
1132
|
-
|
|
1133
|
-
|
|
785
|
+
setOwn(target, key, source[key]);
|
|
786
|
+
}
|
|
787
|
+
}
|
|
788
|
+
function createPluginAccumulator(initialProperties = {}, initialContext = {}) {
|
|
789
|
+
const initialMeta = initialContext.meta ?? {};
|
|
790
|
+
const initialHooks = initialContext.hooks ?? {};
|
|
791
|
+
const context = {
|
|
792
|
+
...initialContext,
|
|
793
|
+
meta: { ...initialMeta },
|
|
794
|
+
hooks: { ...initialHooks }
|
|
795
|
+
};
|
|
796
|
+
const view = { ...initialProperties, context };
|
|
797
|
+
return { view, context };
|
|
798
|
+
}
|
|
799
|
+
function mergeContribution(propertiesTarget, contextTarget, contribution, options) {
|
|
800
|
+
checkCollisions(
|
|
801
|
+
propertiesTarget,
|
|
802
|
+
contribution.rootKeys,
|
|
803
|
+
"root key",
|
|
804
|
+
options.callerLabel,
|
|
805
|
+
options.override
|
|
806
|
+
);
|
|
807
|
+
checkCollisions(
|
|
808
|
+
contextTarget.meta,
|
|
809
|
+
contribution.meta,
|
|
810
|
+
"context.meta key",
|
|
811
|
+
options.callerLabel,
|
|
812
|
+
options.override
|
|
813
|
+
);
|
|
814
|
+
checkCollisions(
|
|
815
|
+
contextTarget,
|
|
816
|
+
contribution.contextRest,
|
|
817
|
+
"context key",
|
|
818
|
+
options.callerLabel,
|
|
819
|
+
options.override
|
|
820
|
+
);
|
|
821
|
+
applyOwnProperties(propertiesTarget, contribution.rootKeys);
|
|
822
|
+
applyOwnProperties(contextTarget.meta, contribution.meta);
|
|
823
|
+
applyOwnProperties(contextTarget, contribution.contextRest);
|
|
824
|
+
contextTarget.hooks = buildHooks(contextTarget.hooks, contribution.hooks);
|
|
825
|
+
}
|
|
826
|
+
function applyPluginContribution(acc, contribution, options) {
|
|
827
|
+
mergeContribution(acc.view, acc.context, contribution, options);
|
|
828
|
+
}
|
|
829
|
+
function wrapAsSdk(properties, context, opts) {
|
|
830
|
+
const sdk = {
|
|
831
|
+
...properties,
|
|
832
|
+
context,
|
|
833
|
+
getRegistry(qopts) {
|
|
834
|
+
return buildRegistry({
|
|
835
|
+
sdk,
|
|
836
|
+
meta: context.meta,
|
|
837
|
+
packageFilter: qopts?.package
|
|
838
|
+
});
|
|
839
|
+
}
|
|
840
|
+
};
|
|
841
|
+
if (opts?.addPlugin !== void 0) {
|
|
842
|
+
sdk.addPlugin = opts.addPlugin;
|
|
843
|
+
}
|
|
844
|
+
return sdk;
|
|
845
|
+
}
|
|
846
|
+
function wrapAccumulatorAsSdk(acc) {
|
|
847
|
+
const { context: _ctx, ...rootKeys } = acc.view;
|
|
848
|
+
return wrapAsSdk(
|
|
849
|
+
rootKeys,
|
|
850
|
+
acc.context
|
|
851
|
+
);
|
|
852
|
+
}
|
|
853
|
+
function applyPluginToSdk(sdk, plugin, options) {
|
|
854
|
+
const context = sdk.context;
|
|
855
|
+
const contribution = splitPluginContribution(
|
|
856
|
+
plugin(sdk)
|
|
857
|
+
);
|
|
858
|
+
mergeContribution(sdk, context, contribution, {
|
|
859
|
+
callerLabel: "addPlugin",
|
|
860
|
+
override: options.override === true
|
|
861
|
+
});
|
|
862
|
+
}
|
|
863
|
+
function buildStackAccumulator(head, callerLabel) {
|
|
864
|
+
const ordered = [];
|
|
865
|
+
let node = head;
|
|
866
|
+
while (node) {
|
|
867
|
+
ordered.unshift(node);
|
|
868
|
+
node = node.prev;
|
|
869
|
+
}
|
|
870
|
+
const acc = createPluginAccumulator();
|
|
871
|
+
for (const { plugin, override } of ordered) {
|
|
872
|
+
const contribution = splitPluginContribution(
|
|
873
|
+
plugin(acc.view)
|
|
874
|
+
);
|
|
875
|
+
applyPluginContribution(acc, contribution, { callerLabel, override });
|
|
876
|
+
}
|
|
877
|
+
return acc;
|
|
878
|
+
}
|
|
879
|
+
function addPlugin(sdk, plugin, options) {
|
|
880
|
+
applyPluginToSdk(
|
|
881
|
+
sdk,
|
|
882
|
+
plugin,
|
|
883
|
+
options ?? {}
|
|
884
|
+
);
|
|
885
|
+
}
|
|
886
|
+
function buildSdk(properties, context) {
|
|
887
|
+
const addPlugin2 = (plugin, options) => {
|
|
888
|
+
logDeprecation(
|
|
889
|
+
"sdk.addPlugin(plugin) (the chain-style extension) is deprecated. Build the SDK in one pass with createPluginStack().use(...).toSdk() instead \u2014 each .toSdk() produces fresh plugin closures and avoids the closure-sharing semantics that caused this to be deprecated."
|
|
890
|
+
);
|
|
891
|
+
const contribution = splitPluginContribution(
|
|
892
|
+
plugin({ ...properties, context })
|
|
893
|
+
);
|
|
894
|
+
const mergedProperties = { ...properties };
|
|
895
|
+
const mergedContext = {
|
|
896
|
+
...context,
|
|
897
|
+
meta: { ...context.meta },
|
|
898
|
+
hooks: { ...context.hooks }
|
|
899
|
+
};
|
|
900
|
+
mergeContribution(mergedProperties, mergedContext, contribution, {
|
|
901
|
+
callerLabel: "addPlugin",
|
|
902
|
+
override: options?.override === true
|
|
903
|
+
});
|
|
904
|
+
return buildSdk(
|
|
905
|
+
mergedProperties,
|
|
906
|
+
mergedContext
|
|
907
|
+
);
|
|
908
|
+
};
|
|
909
|
+
return wrapAsSdk(properties, context, { addPlugin: addPlugin2 });
|
|
910
|
+
}
|
|
911
|
+
function withDeprecatedAddPlugin(sdk) {
|
|
912
|
+
const initialProperties = {};
|
|
913
|
+
for (const key of Object.keys(sdk)) {
|
|
914
|
+
if (key === "context" || key === "getRegistry" || key === "addPlugin") {
|
|
915
|
+
continue;
|
|
1134
916
|
}
|
|
1135
|
-
|
|
1136
|
-
target[key] = source[key];
|
|
917
|
+
initialProperties[key] = sdk[key];
|
|
1137
918
|
}
|
|
919
|
+
const initialContext = sdk.context;
|
|
920
|
+
return buildSdk(
|
|
921
|
+
initialProperties,
|
|
922
|
+
initialContext
|
|
923
|
+
);
|
|
1138
924
|
}
|
|
1139
925
|
function composePlugins(...plugins) {
|
|
1140
|
-
|
|
1141
|
-
|
|
1142
|
-
|
|
1143
|
-
|
|
1144
|
-
|
|
1145
|
-
|
|
1146
|
-
|
|
1147
|
-
|
|
1148
|
-
|
|
1149
|
-
|
|
1150
|
-
|
|
1151
|
-
|
|
926
|
+
logDeprecation(
|
|
927
|
+
"composePlugins(...) is deprecated. Use createPluginStack().use(a).use(b).use(c).toPlugin() instead. The stack carries the same collision-detection and hook-composition behavior, supports per-step { override: true } for intentional duplicates, and progressively narrows types so dependency mistakes surface at the specific .use call."
|
|
928
|
+
);
|
|
929
|
+
let stack = buildPluginStack(
|
|
930
|
+
null,
|
|
931
|
+
"composePlugins"
|
|
932
|
+
);
|
|
933
|
+
for (const plugin of plugins) {
|
|
934
|
+
stack = stack.use(plugin);
|
|
935
|
+
}
|
|
936
|
+
return stack.toPlugin();
|
|
937
|
+
}
|
|
938
|
+
function createPluginStack() {
|
|
939
|
+
return buildPluginStack(null, "createPluginStack");
|
|
940
|
+
}
|
|
941
|
+
function buildPluginStack(head, callerLabel) {
|
|
942
|
+
return {
|
|
943
|
+
use(plugin, options) {
|
|
944
|
+
const next = {
|
|
945
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
946
|
+
plugin,
|
|
947
|
+
override: options?.override === true,
|
|
948
|
+
prev: head
|
|
949
|
+
};
|
|
950
|
+
return buildPluginStack(next, callerLabel);
|
|
951
|
+
},
|
|
952
|
+
toPlugin() {
|
|
953
|
+
const ordered = [];
|
|
954
|
+
let node = head;
|
|
955
|
+
while (node) {
|
|
956
|
+
ordered.unshift(node);
|
|
957
|
+
node = node.prev;
|
|
958
|
+
}
|
|
959
|
+
return (outerSdk) => {
|
|
960
|
+
const { context: outerContext, ...outerProperties } = outerSdk ?? {};
|
|
961
|
+
const viewAcc = createPluginAccumulator(outerProperties, outerContext);
|
|
962
|
+
const contribsAcc = createPluginAccumulator();
|
|
963
|
+
for (const { plugin: subPlugin, override } of ordered) {
|
|
964
|
+
const contribution = splitPluginContribution(
|
|
965
|
+
subPlugin(viewAcc.view)
|
|
966
|
+
);
|
|
967
|
+
applyPluginContribution(viewAcc, contribution, {
|
|
968
|
+
callerLabel,
|
|
969
|
+
override
|
|
970
|
+
});
|
|
971
|
+
applyPluginContribution(contribsAcc, contribution, {
|
|
972
|
+
callerLabel,
|
|
973
|
+
override
|
|
974
|
+
});
|
|
1152
975
|
}
|
|
1153
|
-
|
|
1154
|
-
|
|
1155
|
-
|
|
1156
|
-
|
|
1157
|
-
|
|
1158
|
-
}
|
|
976
|
+
const { context: _ignored, ...contributedRoot } = contribsAcc.view;
|
|
977
|
+
return {
|
|
978
|
+
...contributedRoot,
|
|
979
|
+
context: contribsAcc.context
|
|
980
|
+
};
|
|
981
|
+
};
|
|
982
|
+
},
|
|
983
|
+
toSdk() {
|
|
984
|
+
return wrapAccumulatorAsSdk(
|
|
985
|
+
buildStackAccumulator(head, callerLabel)
|
|
986
|
+
);
|
|
1159
987
|
}
|
|
1160
|
-
return merged;
|
|
1161
988
|
};
|
|
1162
989
|
}
|
|
1163
|
-
function
|
|
1164
|
-
|
|
1165
|
-
|
|
1166
|
-
|
|
990
|
+
function createCorePlugin(options) {
|
|
991
|
+
return () => ({
|
|
992
|
+
context: {
|
|
993
|
+
core: options
|
|
994
|
+
}
|
|
995
|
+
});
|
|
996
|
+
}
|
|
997
|
+
function withPositional(schema) {
|
|
998
|
+
Object.assign(schema._zod.def, {
|
|
999
|
+
positionalMeta: { positional: true }
|
|
1000
|
+
});
|
|
1001
|
+
return schema;
|
|
1002
|
+
}
|
|
1003
|
+
function schemaHasPositionalMeta(schema) {
|
|
1004
|
+
return "positionalMeta" in schema._zod.def;
|
|
1005
|
+
}
|
|
1006
|
+
function isPositional(schema) {
|
|
1007
|
+
if (schemaHasPositionalMeta(schema) && schema._zod.def.positionalMeta?.positional) {
|
|
1008
|
+
return true;
|
|
1009
|
+
}
|
|
1010
|
+
if (schema instanceof z.ZodOptional) {
|
|
1011
|
+
return isPositional(schema._zod.def.innerType);
|
|
1012
|
+
}
|
|
1013
|
+
if (schema instanceof z.ZodDefault) {
|
|
1014
|
+
return isPositional(schema._zod.def.innerType);
|
|
1015
|
+
}
|
|
1016
|
+
return false;
|
|
1017
|
+
}
|
|
1018
|
+
|
|
1019
|
+
// src/utils/logging.ts
|
|
1020
|
+
var { logDeprecation: logDeprecation2, resetDeprecationWarnings: resetDeprecationWarnings2 } = createDeprecationLogger("zapier-sdk");
|
|
1021
|
+
|
|
1022
|
+
// src/types/errors.ts
|
|
1023
|
+
var _a, _b;
|
|
1024
|
+
var ZapierError = class extends (_b = Error, _a = CORE_ERROR_SYMBOL, _b) {
|
|
1025
|
+
constructor(message, options = {}) {
|
|
1026
|
+
super(message);
|
|
1027
|
+
this[_a] = true;
|
|
1028
|
+
this.name = "ZapierError";
|
|
1029
|
+
this.code = "ZAPIER_ERROR";
|
|
1030
|
+
if (options.statusCode !== void 0) this.statusCode = options.statusCode;
|
|
1031
|
+
if (options.errors !== void 0) this.errors = options.errors;
|
|
1032
|
+
if (options.cause !== void 0) this.cause = options.cause;
|
|
1033
|
+
if (options.response !== void 0) this.response = options.response;
|
|
1034
|
+
Object.setPrototypeOf(this, new.target.prototype);
|
|
1035
|
+
}
|
|
1036
|
+
};
|
|
1037
|
+
var ZapierValidationError = class extends ZapierError {
|
|
1038
|
+
constructor(message, options = {}) {
|
|
1039
|
+
super(message, options);
|
|
1040
|
+
this.name = "ZapierValidationError";
|
|
1041
|
+
this.code = "ZAPIER_VALIDATION_ERROR";
|
|
1042
|
+
this.details = options.details;
|
|
1043
|
+
}
|
|
1044
|
+
};
|
|
1045
|
+
var ZapierUnknownError = class extends ZapierError {
|
|
1046
|
+
constructor() {
|
|
1047
|
+
super(...arguments);
|
|
1048
|
+
this.name = "ZapierUnknownError";
|
|
1049
|
+
this.code = "ZAPIER_UNKNOWN_ERROR";
|
|
1050
|
+
}
|
|
1051
|
+
};
|
|
1052
|
+
var ZapierAuthenticationError = class extends ZapierError {
|
|
1053
|
+
constructor() {
|
|
1054
|
+
super(...arguments);
|
|
1055
|
+
this.name = "ZapierAuthenticationError";
|
|
1056
|
+
this.code = "ZAPIER_AUTHENTICATION_ERROR";
|
|
1057
|
+
}
|
|
1058
|
+
};
|
|
1059
|
+
var zapierAdaptError = (options) => {
|
|
1060
|
+
switch (options.code) {
|
|
1061
|
+
case CoreErrorCode.Validation:
|
|
1062
|
+
return new ZapierValidationError(options.message, {
|
|
1063
|
+
cause: options.cause,
|
|
1064
|
+
details: options.details
|
|
1065
|
+
});
|
|
1066
|
+
case CoreErrorCode.Unknown:
|
|
1067
|
+
return new ZapierUnknownError(options.message, {
|
|
1068
|
+
cause: options.cause
|
|
1069
|
+
});
|
|
1070
|
+
default:
|
|
1071
|
+
return new ZapierError(options.message, { cause: options.cause });
|
|
1072
|
+
}
|
|
1073
|
+
};
|
|
1074
|
+
var ZapierApiError = class extends ZapierError {
|
|
1075
|
+
constructor(message, options = {}) {
|
|
1076
|
+
super(message, options);
|
|
1077
|
+
this.name = "ZapierApiError";
|
|
1078
|
+
this.code = "ZAPIER_API_ERROR";
|
|
1079
|
+
}
|
|
1080
|
+
};
|
|
1081
|
+
var ZapierAppNotFoundError = class extends ZapierError {
|
|
1082
|
+
constructor(message, options = {}) {
|
|
1083
|
+
super(message, options);
|
|
1084
|
+
this.name = "ZapierAppNotFoundError";
|
|
1085
|
+
this.code = "ZAPIER_APP_NOT_FOUND_ERROR";
|
|
1086
|
+
this.appKey = options.appKey;
|
|
1087
|
+
}
|
|
1088
|
+
};
|
|
1089
|
+
var ZapierNotFoundError = class extends ZapierError {
|
|
1090
|
+
constructor(message, options = {}) {
|
|
1091
|
+
super(message, options);
|
|
1092
|
+
this.name = "ZapierNotFoundError";
|
|
1093
|
+
this.code = "ZAPIER_NOT_FOUND_ERROR";
|
|
1094
|
+
}
|
|
1095
|
+
};
|
|
1096
|
+
var ZapierResourceNotFoundError = class extends ZapierNotFoundError {
|
|
1097
|
+
constructor(message, options = {}) {
|
|
1098
|
+
super(message, options);
|
|
1099
|
+
this.name = "ZapierResourceNotFoundError";
|
|
1100
|
+
this.code = "ZAPIER_RESOURCE_NOT_FOUND_ERROR";
|
|
1101
|
+
this.resourceType = options.resourceType;
|
|
1102
|
+
this.resourceId = options.resourceId;
|
|
1103
|
+
}
|
|
1104
|
+
};
|
|
1105
|
+
var ZapierConfigurationError = class extends ZapierError {
|
|
1106
|
+
constructor(message, options = {}) {
|
|
1107
|
+
super(message, options);
|
|
1108
|
+
this.name = "ZapierConfigurationError";
|
|
1109
|
+
this.code = "ZAPIER_CONFIGURATION_ERROR";
|
|
1110
|
+
this.configType = options.configType;
|
|
1111
|
+
}
|
|
1112
|
+
};
|
|
1113
|
+
var ZapierBundleError = class extends ZapierError {
|
|
1114
|
+
constructor(message, options = {}) {
|
|
1115
|
+
super(message, options);
|
|
1116
|
+
this.name = "ZapierBundleError";
|
|
1117
|
+
this.code = "ZAPIER_BUNDLE_ERROR";
|
|
1118
|
+
this.buildErrors = options.buildErrors;
|
|
1119
|
+
}
|
|
1120
|
+
};
|
|
1121
|
+
var ZapierTimeoutError = class extends ZapierError {
|
|
1122
|
+
constructor(message, options = {}) {
|
|
1123
|
+
super(message, options);
|
|
1124
|
+
this.name = "ZapierTimeoutError";
|
|
1125
|
+
this.code = "ZAPIER_TIMEOUT_ERROR";
|
|
1126
|
+
this.attempts = options.attempts;
|
|
1127
|
+
this.maxAttempts = options.maxAttempts;
|
|
1128
|
+
}
|
|
1129
|
+
};
|
|
1130
|
+
var ZapierActionError = class extends ZapierError {
|
|
1131
|
+
constructor(message, options = {}) {
|
|
1132
|
+
super(message, options);
|
|
1133
|
+
this.name = "ZapierActionError";
|
|
1134
|
+
this.code = "ZAPIER_ACTION_ERROR";
|
|
1135
|
+
this.appKey = options.appKey;
|
|
1136
|
+
this.actionKey = options.actionKey;
|
|
1137
|
+
}
|
|
1138
|
+
// Legacy accessor for backward compatibility
|
|
1139
|
+
get actionErrors() {
|
|
1140
|
+
return this.errors;
|
|
1141
|
+
}
|
|
1142
|
+
};
|
|
1143
|
+
var ZapierConflictError = class extends ZapierError {
|
|
1144
|
+
constructor(message, options = {}) {
|
|
1145
|
+
super(message, options);
|
|
1146
|
+
this.name = "ZapierConflictError";
|
|
1147
|
+
this.code = "ZAPIER_CONFLICT_ERROR";
|
|
1148
|
+
this.resourceType = options.resourceType;
|
|
1149
|
+
}
|
|
1150
|
+
};
|
|
1151
|
+
var ZapierRateLimitError = class extends ZapierError {
|
|
1152
|
+
constructor(message, options = {}) {
|
|
1153
|
+
super(message, options);
|
|
1154
|
+
this.name = "ZapierRateLimitError";
|
|
1155
|
+
this.code = "ZAPIER_RATE_LIMIT_ERROR";
|
|
1156
|
+
this.rateLimit = options.rateLimit ?? {};
|
|
1157
|
+
this.retries = options.retries ?? 0;
|
|
1158
|
+
}
|
|
1159
|
+
};
|
|
1160
|
+
var ZapierApprovalError = class extends ZapierError {
|
|
1161
|
+
constructor(message, options = {}) {
|
|
1162
|
+
super(message, options);
|
|
1163
|
+
this.name = "ZapierApprovalError";
|
|
1164
|
+
this.code = "ZAPIER_APPROVAL_ERROR";
|
|
1165
|
+
this.approvalId = options.approvalId;
|
|
1166
|
+
this.approvalStatus = options.status;
|
|
1167
|
+
this.approvalUrl = options.approvalUrl;
|
|
1168
|
+
this.pollUrl = options.pollUrl;
|
|
1169
|
+
}
|
|
1170
|
+
};
|
|
1171
|
+
var ZapierRelayError = class extends ZapierError {
|
|
1172
|
+
constructor(message, options = {}) {
|
|
1173
|
+
super(message, options);
|
|
1174
|
+
this.name = "ZapierRelayError";
|
|
1175
|
+
this.code = "ZAPIER_RELAY_ERROR";
|
|
1176
|
+
}
|
|
1177
|
+
};
|
|
1178
|
+
function formatErrorMessage(error) {
|
|
1179
|
+
let message = error.message;
|
|
1180
|
+
if (error.errors && error.errors.length > 0) {
|
|
1181
|
+
const additionalErrors = error.errors.slice(1);
|
|
1182
|
+
if (additionalErrors.length > 0) {
|
|
1183
|
+
const errorDetails = additionalErrors.map((err) => ` \u2022 ${err.detail || err.title || err.code}`).join("\n");
|
|
1184
|
+
message += "\n\nAdditional errors:\n" + errorDetails;
|
|
1185
|
+
}
|
|
1186
|
+
}
|
|
1187
|
+
if (error instanceof ZapierAppNotFoundError && error.appKey) {
|
|
1188
|
+
message += `
|
|
1189
|
+
App key: ${error.appKey}`;
|
|
1190
|
+
}
|
|
1191
|
+
if (error instanceof ZapierActionError && (error.appKey || error.actionKey)) {
|
|
1192
|
+
const context = [];
|
|
1193
|
+
if (error.appKey) context.push(`App: ${error.appKey}`);
|
|
1194
|
+
if (error.actionKey) context.push(`Action: ${error.actionKey}`);
|
|
1195
|
+
message += `
|
|
1196
|
+
${context.join(", ")}`;
|
|
1197
|
+
}
|
|
1198
|
+
if (error instanceof ZapierResourceNotFoundError && (error.resourceType || error.resourceId)) {
|
|
1199
|
+
const context = [];
|
|
1200
|
+
if (error.resourceType) context.push(`Type: ${error.resourceType}`);
|
|
1201
|
+
if (error.resourceId) context.push(`ID: ${error.resourceId}`);
|
|
1202
|
+
message += `
|
|
1203
|
+
${context.join(", ")}`;
|
|
1204
|
+
}
|
|
1205
|
+
if (error instanceof ZapierConflictError && error.resourceType) {
|
|
1206
|
+
message += `
|
|
1207
|
+
Type: ${error.resourceType}`;
|
|
1208
|
+
}
|
|
1209
|
+
if (error instanceof ZapierTimeoutError && (error.attempts || error.maxAttempts)) {
|
|
1210
|
+
const context = [];
|
|
1211
|
+
if (error.attempts) context.push(`Attempts: ${error.attempts}`);
|
|
1212
|
+
if (error.maxAttempts) context.push(`Max attempts: ${error.maxAttempts}`);
|
|
1213
|
+
message += `
|
|
1214
|
+
${context.join(", ")}`;
|
|
1215
|
+
}
|
|
1216
|
+
if (error instanceof ZapierBundleError && error.buildErrors && error.buildErrors.length > 0) {
|
|
1217
|
+
message += "\n\nBuild errors:\n" + error.buildErrors.map((err) => ` \u2022 ${err}`).join("\n");
|
|
1218
|
+
}
|
|
1219
|
+
if (error instanceof ZapierApprovalError && error.approvalUrl) {
|
|
1220
|
+
message += `
|
|
1221
|
+
Approval URL: ${error.approvalUrl}`;
|
|
1222
|
+
}
|
|
1223
|
+
if (error instanceof ZapierRateLimitError) {
|
|
1224
|
+
const { limit, remaining, retryAfterMs } = error.rateLimit;
|
|
1225
|
+
const parts = [];
|
|
1226
|
+
if (limit !== void 0) {
|
|
1227
|
+
const used = remaining !== void 0 ? limit - remaining : limit;
|
|
1228
|
+
parts.push(`${used}/${limit} used`);
|
|
1229
|
+
}
|
|
1230
|
+
if (retryAfterMs !== void 0 && retryAfterMs > 0) {
|
|
1231
|
+
parts.push(`retry in ${formatDuration(retryAfterMs)}`);
|
|
1232
|
+
}
|
|
1233
|
+
if (error.retries > 0) {
|
|
1234
|
+
parts.push(
|
|
1235
|
+
`after ${error.retries} retr${error.retries === 1 ? "y" : "ies"}`
|
|
1236
|
+
);
|
|
1237
|
+
}
|
|
1238
|
+
if (parts.length > 0) {
|
|
1239
|
+
message += `
|
|
1240
|
+
${parts.join(", ")}`;
|
|
1241
|
+
}
|
|
1242
|
+
}
|
|
1243
|
+
if (error.statusCode && !message.includes(`${error.statusCode}`)) {
|
|
1244
|
+
message += `
|
|
1245
|
+
HTTP Status: ${error.statusCode}`;
|
|
1246
|
+
}
|
|
1247
|
+
return message;
|
|
1248
|
+
}
|
|
1249
|
+
function formatDuration(ms) {
|
|
1250
|
+
const seconds = Math.round(ms / 1e3);
|
|
1251
|
+
if (seconds < 60) return `${seconds}s`;
|
|
1252
|
+
const minutes = Math.round(seconds / 60);
|
|
1253
|
+
if (minutes < 60) return `${minutes}m`;
|
|
1254
|
+
const hours = Math.round(minutes / 60);
|
|
1255
|
+
if (hours < 24) return `${hours}h`;
|
|
1256
|
+
const days = Math.round(hours / 24);
|
|
1257
|
+
return `${days}d`;
|
|
1258
|
+
}
|
|
1259
|
+
|
|
1260
|
+
// src/core-stack.ts
|
|
1261
|
+
var zapierCorePlugin = createCorePlugin({
|
|
1262
|
+
adaptError: zapierAdaptError
|
|
1263
|
+
});
|
|
1264
|
+
function createZapierCoreStack() {
|
|
1265
|
+
return createPluginStack().use(zapierCorePlugin);
|
|
1266
|
+
}
|
|
1267
|
+
|
|
1268
|
+
// src/constants.ts
|
|
1269
|
+
var ZAPIER_BASE_URL = globalThis.process?.env?.ZAPIER_BASE_URL || "https://zapier.com";
|
|
1270
|
+
function getZapierSdkService() {
|
|
1271
|
+
return globalThis.process?.env?.ZAPIER_SDK_SERVICE;
|
|
1272
|
+
}
|
|
1273
|
+
var MAX_PAGE_LIMIT = 1e4;
|
|
1274
|
+
var DEFAULT_PAGE_SIZE = 100;
|
|
1275
|
+
var DEFAULT_ACTION_TIMEOUT_MS = 18e4;
|
|
1276
|
+
function parseIntEnvVar(name) {
|
|
1277
|
+
const value = globalThis.process?.env?.[name];
|
|
1278
|
+
if (value === void 0) return void 0;
|
|
1279
|
+
const parsed = parseInt(value, 10);
|
|
1280
|
+
if (isNaN(parsed)) {
|
|
1281
|
+
console.warn(
|
|
1282
|
+
`[zapier-sdk] Invalid value for ${name}: "${value}" (expected integer)`
|
|
1283
|
+
);
|
|
1284
|
+
return void 0;
|
|
1285
|
+
}
|
|
1286
|
+
return parsed;
|
|
1287
|
+
}
|
|
1288
|
+
var ZAPIER_MAX_NETWORK_RETRIES = parseIntEnvVar("ZAPIER_MAX_NETWORK_RETRIES") ?? 3;
|
|
1289
|
+
var ZAPIER_MAX_NETWORK_RETRY_DELAY_MS = parseIntEnvVar("ZAPIER_MAX_NETWORK_RETRY_DELAY_MS") ?? 6e4;
|
|
1290
|
+
var MAX_CONCURRENCY_LIMIT = 1e4;
|
|
1291
|
+
function parseConcurrencyEnvVar(name) {
|
|
1292
|
+
const value = globalThis.process?.env?.[name];
|
|
1293
|
+
if (!value) return void 0;
|
|
1294
|
+
if (value === "Infinity") return Infinity;
|
|
1295
|
+
if (/^[1-9]\d*$/.test(value)) {
|
|
1296
|
+
const parsed = parseInt(value, 10);
|
|
1297
|
+
if (parsed <= MAX_CONCURRENCY_LIMIT) return parsed;
|
|
1167
1298
|
}
|
|
1299
|
+
console.warn(
|
|
1300
|
+
`[zapier-sdk] Invalid value for ${name}: "${value}" (expected positive integer 1-${MAX_CONCURRENCY_LIMIT} or "Infinity")`
|
|
1301
|
+
);
|
|
1168
1302
|
return void 0;
|
|
1169
1303
|
}
|
|
1170
|
-
|
|
1171
|
-
|
|
1172
|
-
const
|
|
1173
|
-
|
|
1174
|
-
|
|
1175
|
-
|
|
1176
|
-
key: getStringProperty(obj, "key"),
|
|
1177
|
-
description: getStringProperty(obj, "description"),
|
|
1178
|
-
data: item,
|
|
1179
|
-
// Let formatJsonOutput handle the JSON rendering
|
|
1180
|
-
details: []
|
|
1181
|
-
// Not used when data is provided
|
|
1182
|
-
};
|
|
1304
|
+
var ZAPIER_MAX_CONCURRENT_REQUESTS = parseConcurrencyEnvVar("ZAPIER_MAX_CONCURRENT_REQUESTS") ?? 200;
|
|
1305
|
+
function getZapierApprovalMode() {
|
|
1306
|
+
const value = globalThis.process?.env?.ZAPIER_APPROVAL_MODE;
|
|
1307
|
+
if (value === "disabled" || value === "poll" || value === "throw")
|
|
1308
|
+
return value;
|
|
1309
|
+
return void 0;
|
|
1183
1310
|
}
|
|
1184
|
-
|
|
1185
|
-
|
|
1186
|
-
|
|
1311
|
+
function getZapierDefaultApprovalMode() {
|
|
1312
|
+
const isInteractive = !!globalThis.process?.stdin?.isTTY && !!globalThis.process?.stdout?.isTTY;
|
|
1313
|
+
return isInteractive ? "poll" : "throw";
|
|
1314
|
+
}
|
|
1315
|
+
var DEFAULT_APPROVAL_TIMEOUT_MS = 10 * 60 * 1e3;
|
|
1316
|
+
var DEFAULT_MAX_APPROVAL_RETRIES = 2;
|
|
1317
|
+
|
|
1318
|
+
// src/types/properties.ts
|
|
1319
|
+
var AppKeyPropertySchema = withPositional(
|
|
1320
|
+
z.string().min(1).describe("App key (e.g., 'SlackCLIAPI' or slug like 'github')")
|
|
1321
|
+
);
|
|
1322
|
+
var AppPropertySchema = withPositional(
|
|
1323
|
+
z.string().min(1).describe(
|
|
1324
|
+
"App slug (e.g., 'github'), implementation name (e.g., 'SlackCLIAPI'), or versioned ID (e.g., 'github@1.2.3')"
|
|
1325
|
+
)
|
|
1326
|
+
);
|
|
1327
|
+
var ActionTypePropertySchema = z.enum([
|
|
1328
|
+
"read",
|
|
1329
|
+
"read_bulk",
|
|
1330
|
+
"write",
|
|
1331
|
+
"run",
|
|
1332
|
+
"search",
|
|
1333
|
+
"search_or_write",
|
|
1334
|
+
"search_and_write",
|
|
1335
|
+
"filter"
|
|
1336
|
+
]).describe("Action type that matches the action's defined type");
|
|
1337
|
+
var ActionKeyPropertySchema = z.string().min(1).describe("Action key to execute");
|
|
1338
|
+
var ActionPropertySchema = withPositional(
|
|
1339
|
+
z.string().min(1).describe("Action key (e.g., 'send_message' or 'find_row')")
|
|
1340
|
+
);
|
|
1341
|
+
var InputFieldPropertySchema = withPositional(
|
|
1342
|
+
z.string().min(1).describe("Input field key to get choices for")
|
|
1343
|
+
);
|
|
1344
|
+
var ConnectionIdPropertySchema = z.union([z.string(), z.number().int().positive()]).describe("Connection ID to use for this action");
|
|
1345
|
+
var AuthenticationIdPropertySchema = ConnectionIdPropertySchema.meta({
|
|
1346
|
+
deprecated: true
|
|
1347
|
+
});
|
|
1348
|
+
var ConnectionPropertySchema = z.union([z.string(), z.number().int().positive()]).describe(
|
|
1349
|
+
"Connection alias or connection ID (UUID or positive integer). Strings that match a key in the connections map are resolved against it; otherwise the value is used as a connection ID directly."
|
|
1350
|
+
);
|
|
1351
|
+
var InputsPropertySchema = z.record(z.string(), z.unknown()).describe("Input parameters for the action");
|
|
1352
|
+
var LimitPropertySchema = z.number().int().min(1).max(MAX_PAGE_LIMIT).default(50).describe("Maximum number of items to return");
|
|
1353
|
+
var OffsetPropertySchema = z.number().int().min(0).default(0).describe("Number of items to skip for pagination");
|
|
1354
|
+
var OutputPropertySchema = z.string().describe("Output file path");
|
|
1355
|
+
var DebugPropertySchema = z.boolean().default(false).describe("Enable debug logging");
|
|
1356
|
+
var ParamsPropertySchema = z.record(z.string(), z.unknown()).describe("Additional parameters");
|
|
1357
|
+
var ActionTimeoutMsPropertySchema = z.number().min(1e3).optional().describe(
|
|
1358
|
+
`Maximum time to wait for action completion in milliseconds (default: ${DEFAULT_ACTION_TIMEOUT_MS})`
|
|
1359
|
+
);
|
|
1360
|
+
var TablePropertySchema = withPositional(
|
|
1361
|
+
z.string().regex(/^[A-Z0-9]{26}$/, "Table ID must be a valid ULID").describe("The unique identifier of the table")
|
|
1362
|
+
);
|
|
1363
|
+
var RecordPropertySchema = withPositional(
|
|
1364
|
+
z.string().regex(/^[A-Z0-9]{26}$/, "Record ID must be a valid ULID").describe("The unique identifier of the record")
|
|
1365
|
+
);
|
|
1366
|
+
var RecordsPropertySchema = z.array(z.string().regex(/^[A-Z0-9]{26}$/, "Record ID must be a valid ULID")).min(1).max(100).describe("Record IDs to operate on");
|
|
1367
|
+
var FieldsPropertySchema = z.array(z.union([z.string(), z.number()])).describe(
|
|
1368
|
+
'Fields to operate on. Accepts field names (e.g., "Email") or IDs (e.g., "f6", "6", or 6).'
|
|
1369
|
+
);
|
|
1370
|
+
var AppsPropertySchema = z.array(z.string()).describe("Filter by app keys (e.g., 'SlackCLIAPI' or slug like 'github')");
|
|
1371
|
+
var TablesPropertySchema = z.array(z.string()).describe("Filter by specific table IDs");
|
|
1372
|
+
var ConnectionsPropertySchema = z.array(z.string()).describe("List of connection IDs to filter by");
|
|
1373
|
+
var TriggerInboxPropertySchema = withPositional(
|
|
1374
|
+
z.string().min(1).describe(
|
|
1375
|
+
"Trigger inbox identifier \u2014 UUID or name. Non-UUID values are resolved by name via the inbox list endpoint."
|
|
1376
|
+
)
|
|
1377
|
+
);
|
|
1378
|
+
var TriggerInboxNamePropertySchema = z.string().min(1).max(100).describe(
|
|
1379
|
+
"Inbox name; unique per (user, account). Enables get-or-create on createTriggerInbox."
|
|
1380
|
+
);
|
|
1381
|
+
var LeasePropertySchema = z.string().min(1).describe("Lease ID returned from leaseTriggerInboxMessages");
|
|
1382
|
+
var LeaseSecondsPropertySchema = z.number().int().min(1).max(3600).describe(
|
|
1383
|
+
"Seconds until the lease expires; messages return to available if not acked. API default is 300 (5 minutes)."
|
|
1187
1384
|
);
|
|
1385
|
+
var LeaseLimitPropertySchema = z.number().int().min(1).max(100).describe("Maximum messages to lease in a single batch (1-100)");
|
|
1386
|
+
|
|
1387
|
+
// src/plugins/apps/schemas.ts
|
|
1388
|
+
var ActionExecutionInputSchema = z.object({
|
|
1389
|
+
inputs: z.record(z.string(), z.unknown()).optional(),
|
|
1390
|
+
/** @deprecated Use `connection` instead. */
|
|
1391
|
+
connectionId: ConnectionIdPropertySchema.optional().meta({
|
|
1392
|
+
deprecated: true
|
|
1393
|
+
}),
|
|
1394
|
+
connection: ConnectionPropertySchema.optional(),
|
|
1395
|
+
/** @deprecated Use connection instead */
|
|
1396
|
+
authenticationId: AuthenticationIdPropertySchema.optional().meta({
|
|
1397
|
+
deprecated: true
|
|
1398
|
+
}),
|
|
1399
|
+
timeoutMs: ActionTimeoutMsPropertySchema
|
|
1400
|
+
}).describe(
|
|
1401
|
+
"Execute an action with the given inputs for the bound app, as an alternative to runAction"
|
|
1402
|
+
).meta({
|
|
1403
|
+
aliases: { connectionId: "connection", authenticationId: "connection" }
|
|
1404
|
+
});
|
|
1405
|
+
var AppFactoryInputSchema = z.object({
|
|
1406
|
+
/** @deprecated Use `connection` instead. */
|
|
1407
|
+
connectionId: ConnectionIdPropertySchema.optional().meta({
|
|
1408
|
+
deprecated: true
|
|
1409
|
+
}),
|
|
1410
|
+
connection: ConnectionPropertySchema.optional(),
|
|
1411
|
+
/** @deprecated Use connection instead */
|
|
1412
|
+
authenticationId: AuthenticationIdPropertySchema.optional().meta({
|
|
1413
|
+
deprecated: true
|
|
1414
|
+
})
|
|
1415
|
+
}).describe("Bind a connection alias or numeric connectionId to an app").meta({
|
|
1416
|
+
aliases: { connectionId: "connection", authenticationId: "connection" }
|
|
1417
|
+
});
|
|
1418
|
+
var ActionResultItemSchema = z.unknown().describe("Action execution result");
|
|
1188
1419
|
|
|
1189
1420
|
// src/plugins/apps/index.ts
|
|
1190
1421
|
function resolveProxyConnection({
|
|
@@ -1405,18 +1636,6 @@ var FetchInitSchema = z.object({
|
|
|
1405
1636
|
aliases: { connectionId: "connection", authenticationId: "connection" }
|
|
1406
1637
|
});
|
|
1407
1638
|
|
|
1408
|
-
// src/utils/string-utils.ts
|
|
1409
|
-
function toTitleCase(input) {
|
|
1410
|
-
return input.replace(/([a-z0-9])([A-Z])/g, "$1 $2").replace(/[_\-]+/g, " ").replace(/\s+/g, " ").trim().split(" ").map((word) => word.charAt(0).toUpperCase() + word.slice(1).toLowerCase()).join(" ");
|
|
1411
|
-
}
|
|
1412
|
-
function toSnakeCase(input) {
|
|
1413
|
-
let result = input.replace(/([a-z0-9])([A-Z])/g, "$1_$2").replace(/[\s\-]+/g, "_").replace(/_+/g, "_").replace(/^_|_$/g, "").toLowerCase();
|
|
1414
|
-
if (/^[0-9]/.test(result)) {
|
|
1415
|
-
result = "_" + result;
|
|
1416
|
-
}
|
|
1417
|
-
return result;
|
|
1418
|
-
}
|
|
1419
|
-
|
|
1420
1639
|
// src/utils/domain-utils.ts
|
|
1421
1640
|
function isConnectionId(value) {
|
|
1422
1641
|
return /^\d+$/.test(value) || isUuid(value);
|
|
@@ -1719,15 +1938,25 @@ function buildAbortHandle({
|
|
|
1719
1938
|
return combineAbortSignals({ handles });
|
|
1720
1939
|
}
|
|
1721
1940
|
var FetchInitSdkValidationSchema = z.looseObject(FetchInitZapierFieldsSchema.shape).optional();
|
|
1722
|
-
var validateFetchInit = createValidator(FetchInitSdkValidationSchema);
|
|
1723
1941
|
var fetchPlugin = definePlugin(
|
|
1724
1942
|
(sdk) => {
|
|
1943
|
+
const validateFetchInit = createValidator(FetchInitSdkValidationSchema, {
|
|
1944
|
+
adaptError: sdk.context.core?.adaptError
|
|
1945
|
+
});
|
|
1725
1946
|
return {
|
|
1726
1947
|
fetch: async function fetch2(url, init) {
|
|
1727
|
-
return
|
|
1948
|
+
return runInMethodScope(async () => {
|
|
1728
1949
|
const { api } = sdk.context;
|
|
1950
|
+
const { onMethodStart, onMethodEnd } = sdk.context.hooks;
|
|
1729
1951
|
const startTime = Date.now();
|
|
1730
|
-
const
|
|
1952
|
+
const depth = getCurrentDepth();
|
|
1953
|
+
const args = init === void 0 ? [url] : [url, init];
|
|
1954
|
+
onMethodStart?.({
|
|
1955
|
+
methodName: "fetch",
|
|
1956
|
+
args,
|
|
1957
|
+
isPaginated: false,
|
|
1958
|
+
depth
|
|
1959
|
+
});
|
|
1731
1960
|
try {
|
|
1732
1961
|
if (init) {
|
|
1733
1962
|
validateFetchInit(init);
|
|
@@ -1799,17 +2028,13 @@ var fetchPlugin = definePlugin(
|
|
|
1799
2028
|
statusCode: result.status
|
|
1800
2029
|
});
|
|
1801
2030
|
}
|
|
1802
|
-
|
|
1803
|
-
|
|
1804
|
-
|
|
1805
|
-
|
|
1806
|
-
|
|
1807
|
-
|
|
1808
|
-
|
|
1809
|
-
argument_count: init ? 2 : 1,
|
|
1810
|
-
is_paginated: false
|
|
1811
|
-
});
|
|
1812
|
-
}
|
|
2031
|
+
onMethodEnd?.({
|
|
2032
|
+
methodName: "fetch",
|
|
2033
|
+
args,
|
|
2034
|
+
isPaginated: false,
|
|
2035
|
+
depth,
|
|
2036
|
+
durationMs: Date.now() - startTime
|
|
2037
|
+
});
|
|
1813
2038
|
return result;
|
|
1814
2039
|
} catch (error) {
|
|
1815
2040
|
throw rewrapIfMaxTimeTimeout({
|
|
@@ -1821,17 +2046,14 @@ var fetchPlugin = definePlugin(
|
|
|
1821
2046
|
abortHandle?.dispose();
|
|
1822
2047
|
}
|
|
1823
2048
|
} catch (error) {
|
|
1824
|
-
|
|
1825
|
-
|
|
1826
|
-
|
|
1827
|
-
|
|
1828
|
-
|
|
1829
|
-
|
|
1830
|
-
|
|
1831
|
-
|
|
1832
|
-
is_paginated: false
|
|
1833
|
-
});
|
|
1834
|
-
}
|
|
2049
|
+
onMethodEnd?.({
|
|
2050
|
+
methodName: "fetch",
|
|
2051
|
+
args,
|
|
2052
|
+
isPaginated: false,
|
|
2053
|
+
depth,
|
|
2054
|
+
durationMs: Date.now() - startTime,
|
|
2055
|
+
error: error instanceof Error ? error : new Error(String(error))
|
|
2056
|
+
});
|
|
1835
2057
|
throw error;
|
|
1836
2058
|
}
|
|
1837
2059
|
});
|
|
@@ -1841,7 +2063,11 @@ var fetchPlugin = definePlugin(
|
|
|
1841
2063
|
fetch: {
|
|
1842
2064
|
description: "Make authenticated HTTP requests to any API through Zapier. Pass a connectionId to automatically inject the user's stored credentials (OAuth tokens, API keys, etc.) into the outgoing request. Mirrors the native fetch(url, init?) signature with additional Zapier-specific options.",
|
|
1843
2065
|
packages: ["sdk", "cli", "mcp"],
|
|
1844
|
-
|
|
2066
|
+
// Auto-derive would produce "Http"/"Https" from the key alone;
|
|
2067
|
+
// declare the title explicitly here so the registry renders
|
|
2068
|
+
// "HTTP Request". Other plugins in this category use the bare
|
|
2069
|
+
// string "http"; the object form wins regardless of order.
|
|
2070
|
+
categories: [{ key: "http", title: "HTTP Request" }],
|
|
1845
2071
|
returnType: "Response",
|
|
1846
2072
|
inputParameters: [
|
|
1847
2073
|
{ name: "url", schema: FetchUrlSchema },
|
|
@@ -1930,7 +2156,7 @@ function createDebugLogger(enabled) {
|
|
|
1930
2156
|
}
|
|
1931
2157
|
return (message, data) => {
|
|
1932
2158
|
if (data === void 0 || data === "") {
|
|
1933
|
-
console.
|
|
2159
|
+
console.error(`[Zapier SDK] ${message}`);
|
|
1934
2160
|
return;
|
|
1935
2161
|
}
|
|
1936
2162
|
if (utilModule) {
|
|
@@ -1939,9 +2165,9 @@ function createDebugLogger(enabled) {
|
|
|
1939
2165
|
depth: null,
|
|
1940
2166
|
breakLength: 80
|
|
1941
2167
|
});
|
|
1942
|
-
console.
|
|
2168
|
+
console.error(`[Zapier SDK] ${message}`, formatted);
|
|
1943
2169
|
} else {
|
|
1944
|
-
console.
|
|
2170
|
+
console.error(`[Zapier SDK] ${message}`, data);
|
|
1945
2171
|
}
|
|
1946
2172
|
};
|
|
1947
2173
|
}
|
|
@@ -2140,7 +2366,8 @@ async function pollUntilComplete(options) {
|
|
|
2140
2366
|
pendingStatus = DEFAULT_PENDING_STATUS,
|
|
2141
2367
|
isPending,
|
|
2142
2368
|
resultExtractor = (response) => response,
|
|
2143
|
-
signal
|
|
2369
|
+
signal,
|
|
2370
|
+
maxPollingIntervalMs
|
|
2144
2371
|
} = options;
|
|
2145
2372
|
if (timeoutMs <= 0) {
|
|
2146
2373
|
throw new ZapierValidationError("Timeout must be greater than 0", {
|
|
@@ -2152,6 +2379,14 @@ async function pollUntilComplete(options) {
|
|
|
2152
2379
|
details: { initialDelay }
|
|
2153
2380
|
});
|
|
2154
2381
|
}
|
|
2382
|
+
if (maxPollingIntervalMs !== void 0 && maxPollingIntervalMs <= 0) {
|
|
2383
|
+
throw new ZapierValidationError(
|
|
2384
|
+
"Max polling interval must be greater than 0",
|
|
2385
|
+
{
|
|
2386
|
+
details: { maxPollingIntervalMs }
|
|
2387
|
+
}
|
|
2388
|
+
);
|
|
2389
|
+
}
|
|
2155
2390
|
if (signal?.aborted) throw makeAbortError();
|
|
2156
2391
|
const startTime = Date.now();
|
|
2157
2392
|
let attempts = 0;
|
|
@@ -2174,7 +2409,8 @@ async function pollUntilComplete(options) {
|
|
|
2174
2409
|
if (attempts > 0) {
|
|
2175
2410
|
const interval = getPollingInterval(elapsedTime);
|
|
2176
2411
|
const waitTime = calculateErrorBackoffMs(interval, errorCount);
|
|
2177
|
-
|
|
2412
|
+
const cappedWaitTime = maxPollingIntervalMs === void 0 ? waitTime : Math.min(waitTime, maxPollingIntervalMs);
|
|
2413
|
+
await sleep(cappedWaitTime, signal);
|
|
2178
2414
|
if (signal?.aborted) throw makeAbortError();
|
|
2179
2415
|
}
|
|
2180
2416
|
attempts++;
|
|
@@ -2457,17 +2693,17 @@ function resolveCredentialsFromEnv(sdkBaseUrl) {
|
|
|
2457
2693
|
}
|
|
2458
2694
|
}
|
|
2459
2695
|
if (globalThis.process?.env?.ZAPIER_TOKEN) {
|
|
2460
|
-
|
|
2696
|
+
logDeprecation2(
|
|
2461
2697
|
"ZAPIER_TOKEN is deprecated. Use ZAPIER_CREDENTIALS instead."
|
|
2462
2698
|
);
|
|
2463
2699
|
return globalThis.process?.env?.ZAPIER_TOKEN;
|
|
2464
2700
|
}
|
|
2465
2701
|
if (globalThis.process?.env?.ZAPIER_AUTH_CLIENT_ID) {
|
|
2466
|
-
|
|
2702
|
+
logDeprecation2(
|
|
2467
2703
|
"ZAPIER_AUTH_CLIENT_ID is deprecated. Use ZAPIER_CREDENTIALS_CLIENT_ID instead."
|
|
2468
2704
|
);
|
|
2469
2705
|
if (globalThis.process?.env?.ZAPIER_AUTH_BASE_URL) {
|
|
2470
|
-
|
|
2706
|
+
logDeprecation2(
|
|
2471
2707
|
"ZAPIER_AUTH_BASE_URL is deprecated. Use ZAPIER_CREDENTIALS_BASE_URL instead."
|
|
2472
2708
|
);
|
|
2473
2709
|
}
|
|
@@ -2501,7 +2737,7 @@ async function resolveCredentials(options = {}) {
|
|
|
2501
2737
|
return options.credentials;
|
|
2502
2738
|
}
|
|
2503
2739
|
if (options.token !== void 0) {
|
|
2504
|
-
|
|
2740
|
+
logDeprecation2(
|
|
2505
2741
|
"The `token` option is deprecated. Use `credentials` instead."
|
|
2506
2742
|
);
|
|
2507
2743
|
return options.token;
|
|
@@ -2743,7 +2979,7 @@ async function tryStoredClientCredentialToken(options) {
|
|
|
2743
2979
|
const cached = await readCachedToken(cacheKey, cache);
|
|
2744
2980
|
if (cached !== void 0) {
|
|
2745
2981
|
if (options.debug)
|
|
2746
|
-
console.
|
|
2982
|
+
console.error(
|
|
2747
2983
|
`[auth] Using cached token (clientId: ${activeCredential.clientId})`
|
|
2748
2984
|
);
|
|
2749
2985
|
emitAuthResolved(options.onEvent, "client_credentials");
|
|
@@ -2762,7 +2998,7 @@ async function tryStoredClientCredentialToken(options) {
|
|
|
2762
2998
|
);
|
|
2763
2999
|
}
|
|
2764
3000
|
if (options.debug)
|
|
2765
|
-
console.
|
|
3001
|
+
console.error(
|
|
2766
3002
|
`[auth] Using stored client credential (clientId: ${storedCredential.clientId})`
|
|
2767
3003
|
);
|
|
2768
3004
|
const token = await resolveAuthTokenFromCredentials(
|
|
@@ -2784,7 +3020,7 @@ async function resolveAuthToken(options = {}) {
|
|
|
2784
3020
|
const storedToken = await tryStoredClientCredentialToken(options);
|
|
2785
3021
|
if (storedToken !== void 0) return storedToken;
|
|
2786
3022
|
if (options.debug) {
|
|
2787
|
-
console.
|
|
3023
|
+
console.error("[auth] Using JWT (no stored client credential found)");
|
|
2788
3024
|
}
|
|
2789
3025
|
const jwtToken = await getTokenFromCliLogin({
|
|
2790
3026
|
onEvent: options.onEvent,
|
|
@@ -2814,7 +3050,7 @@ async function resolveAuthTokenFromCredentials(credentials, options) {
|
|
|
2814
3050
|
const cached = await readCachedToken(cacheKey, cache);
|
|
2815
3051
|
if (cached !== void 0) {
|
|
2816
3052
|
if (options.debug) {
|
|
2817
|
-
console.
|
|
3053
|
+
console.error(`[auth] Using cached token (clientId: ${clientId})`);
|
|
2818
3054
|
}
|
|
2819
3055
|
return cached;
|
|
2820
3056
|
}
|
|
@@ -2824,7 +3060,7 @@ async function resolveAuthTokenFromCredentials(credentials, options) {
|
|
|
2824
3060
|
const recheck = await readCachedToken(cacheKey, cache);
|
|
2825
3061
|
if (recheck !== void 0) {
|
|
2826
3062
|
if (options.debug) {
|
|
2827
|
-
console.
|
|
3063
|
+
console.error(
|
|
2828
3064
|
`[auth] Using cached token (clientId: ${clientId}, locked recheck)`
|
|
2829
3065
|
);
|
|
2830
3066
|
}
|
|
@@ -2887,7 +3123,7 @@ async function invalidateCredentialsToken(options) {
|
|
|
2887
3123
|
}
|
|
2888
3124
|
|
|
2889
3125
|
// src/sdk-version.ts
|
|
2890
|
-
var SDK_VERSION = (typeof process !== "undefined" && process.env ? "0.
|
|
3126
|
+
var SDK_VERSION = (typeof process !== "undefined" && process.env ? "0.68.0" : void 0) || "unknown";
|
|
2891
3127
|
|
|
2892
3128
|
// src/utils/open-url.ts
|
|
2893
3129
|
var nodePrefix = "node:";
|
|
@@ -2972,6 +3208,7 @@ var PollApprovalResponseSchema = z.object({
|
|
|
2972
3208
|
status: ApprovalStatusSchema,
|
|
2973
3209
|
approval_id: z.string()
|
|
2974
3210
|
});
|
|
3211
|
+
var APPROVAL_MAX_POLLING_INTERVAL_MS = 5e3;
|
|
2975
3212
|
function parseRateLimitHeaders(response) {
|
|
2976
3213
|
const info = {};
|
|
2977
3214
|
const retryAfter = response.headers.get("retry-after");
|
|
@@ -3680,6 +3917,7 @@ var ZapierApiClient = class {
|
|
|
3680
3917
|
})
|
|
3681
3918
|
),
|
|
3682
3919
|
timeoutMs,
|
|
3920
|
+
maxPollingIntervalMs: APPROVAL_MAX_POLLING_INTERVAL_MS,
|
|
3683
3921
|
isPending: (body2) => {
|
|
3684
3922
|
const parsed = PollApprovalResponseSchema.safeParse(body2);
|
|
3685
3923
|
return parsed.success && parsed.data.status === "pending_approval";
|
|
@@ -3814,36 +4052,36 @@ var apiPlugin = definePlugin(
|
|
|
3814
4052
|
}
|
|
3815
4053
|
);
|
|
3816
4054
|
var GetProfileSchema = z.object({}).optional().describe("Get current user's profile information");
|
|
3817
|
-
var UserProfileItemSchema =
|
|
3818
|
-
z.
|
|
3819
|
-
|
|
3820
|
-
|
|
3821
|
-
|
|
3822
|
-
|
|
3823
|
-
|
|
3824
|
-
|
|
3825
|
-
|
|
3826
|
-
|
|
3827
|
-
|
|
3828
|
-
|
|
3829
|
-
|
|
3830
|
-
|
|
3831
|
-
|
|
3832
|
-
}
|
|
3833
|
-
|
|
3834
|
-
|
|
3835
|
-
|
|
3836
|
-
|
|
3837
|
-
|
|
3838
|
-
}
|
|
3839
|
-
return {
|
|
3840
|
-
title: item.full_name,
|
|
3841
|
-
id: item.id,
|
|
3842
|
-
details
|
|
3843
|
-
};
|
|
4055
|
+
var UserProfileItemSchema = z.object({
|
|
4056
|
+
id: z.string(),
|
|
4057
|
+
first_name: z.string(),
|
|
4058
|
+
last_name: z.string(),
|
|
4059
|
+
full_name: z.string(),
|
|
4060
|
+
email: z.string(),
|
|
4061
|
+
email_confirmed: z.boolean(),
|
|
4062
|
+
timezone: z.string()
|
|
4063
|
+
});
|
|
4064
|
+
|
|
4065
|
+
// src/formatters/userProfile.ts
|
|
4066
|
+
var userProfileItemFormatter = {
|
|
4067
|
+
format: (item) => {
|
|
4068
|
+
const details = [];
|
|
4069
|
+
if (item.email) {
|
|
4070
|
+
details.push({ text: item.email, style: "dim" });
|
|
4071
|
+
}
|
|
4072
|
+
if (item.timezone) {
|
|
4073
|
+
details.push({
|
|
4074
|
+
text: `Timezone: ${item.timezone}`,
|
|
4075
|
+
style: "accent"
|
|
4076
|
+
});
|
|
3844
4077
|
}
|
|
4078
|
+
return {
|
|
4079
|
+
title: item.full_name,
|
|
4080
|
+
id: item.id,
|
|
4081
|
+
details
|
|
4082
|
+
};
|
|
3845
4083
|
}
|
|
3846
|
-
|
|
4084
|
+
};
|
|
3847
4085
|
|
|
3848
4086
|
// src/plugins/getProfile/index.ts
|
|
3849
4087
|
var getProfilePlugin = definePlugin(
|
|
@@ -3854,6 +4092,7 @@ var getProfilePlugin = definePlugin(
|
|
|
3854
4092
|
itemType: "Profile",
|
|
3855
4093
|
inputSchema: GetProfileSchema,
|
|
3856
4094
|
outputSchema: UserProfileItemSchema,
|
|
4095
|
+
formatter: userProfileItemFormatter,
|
|
3857
4096
|
handler: async ({ sdk: sdk2 }) => {
|
|
3858
4097
|
const profile = await sdk2.context.api.get(
|
|
3859
4098
|
"/zapier/api/v4/profile/",
|
|
@@ -3873,6 +4112,29 @@ var getProfilePlugin = definePlugin(
|
|
|
3873
4112
|
}
|
|
3874
4113
|
})
|
|
3875
4114
|
);
|
|
4115
|
+
|
|
4116
|
+
// src/utils/pagination.ts
|
|
4117
|
+
function extractCursorFromUrl(url) {
|
|
4118
|
+
try {
|
|
4119
|
+
const params = new URL(url).searchParams;
|
|
4120
|
+
return params.get("offset") ?? params.get("cursor") ?? void 0;
|
|
4121
|
+
} catch {
|
|
4122
|
+
return void 0;
|
|
4123
|
+
}
|
|
4124
|
+
}
|
|
4125
|
+
function adaptZapierPage(response) {
|
|
4126
|
+
const r = response ?? {};
|
|
4127
|
+
const data = r.data;
|
|
4128
|
+
const linksNext = r.links?.next;
|
|
4129
|
+
if (typeof linksNext === "string") {
|
|
4130
|
+
return { data, nextCursor: extractCursorFromUrl(linksNext) };
|
|
4131
|
+
}
|
|
4132
|
+
if (typeof r.next === "string") {
|
|
4133
|
+
return { data, nextCursor: extractCursorFromUrl(r.next) };
|
|
4134
|
+
}
|
|
4135
|
+
return { data };
|
|
4136
|
+
}
|
|
4137
|
+
var zapierPagination = { adaptPage: adaptZapierPage };
|
|
3876
4138
|
var ListAppsSchema = ListAppsQuerySchema.omit({
|
|
3877
4139
|
offset: true,
|
|
3878
4140
|
app_keys: true,
|
|
@@ -3894,27 +4156,30 @@ var ListAppsSchema = ListAppsQuerySchema.omit({
|
|
|
3894
4156
|
// SDK specific property for pagination/iterable helpers
|
|
3895
4157
|
cursor: z.string().optional().describe("Cursor to start from")
|
|
3896
4158
|
}).describe("List all available apps with optional filtering");
|
|
3897
|
-
var AppItemSchema =
|
|
3898
|
-
|
|
3899
|
-
|
|
3900
|
-
|
|
3901
|
-
|
|
3902
|
-
|
|
3903
|
-
|
|
3904
|
-
|
|
3905
|
-
|
|
3906
|
-
|
|
3907
|
-
})
|
|
4159
|
+
var AppItemSchema = AppItemSchema$1;
|
|
4160
|
+
|
|
4161
|
+
// src/formatters/app.ts
|
|
4162
|
+
var appItemFormatter = {
|
|
4163
|
+
format: (item) => ({
|
|
4164
|
+
title: item.title,
|
|
4165
|
+
key: item.key,
|
|
4166
|
+
keys: getAppKeyList(item),
|
|
4167
|
+
description: item.description,
|
|
4168
|
+
details: []
|
|
4169
|
+
})
|
|
4170
|
+
};
|
|
3908
4171
|
|
|
3909
4172
|
// src/plugins/listApps/index.ts
|
|
3910
4173
|
var listAppsPlugin = definePlugin(
|
|
3911
4174
|
(sdk) => createPaginatedPluginMethod(sdk, {
|
|
4175
|
+
...zapierPagination,
|
|
3912
4176
|
name: "listApps",
|
|
3913
4177
|
categories: ["app"],
|
|
3914
4178
|
type: "list",
|
|
3915
4179
|
itemType: "App",
|
|
3916
4180
|
inputSchema: ListAppsSchema,
|
|
3917
4181
|
outputSchema: AppItemSchema,
|
|
4182
|
+
formatter: appItemFormatter,
|
|
3918
4183
|
defaultPageSize: DEFAULT_PAGE_SIZE,
|
|
3919
4184
|
handler: async ({ sdk: sdk2, options }) => {
|
|
3920
4185
|
const { api, resolveAppKeys: resolveAppKeys2 } = sdk2.context;
|
|
@@ -3954,8 +4219,7 @@ var listAppsPlugin = definePlugin(
|
|
|
3954
4219
|
...options.cursor && { offset: options.cursor }
|
|
3955
4220
|
}
|
|
3956
4221
|
});
|
|
3957
|
-
}
|
|
3958
|
-
extractCursor: (response) => extractCursor(response.links)
|
|
4222
|
+
}
|
|
3959
4223
|
})
|
|
3960
4224
|
);
|
|
3961
4225
|
var GetAppDescription = "Get detailed information about a specific app";
|
|
@@ -4172,7 +4436,7 @@ var inputFieldKeyResolver = {
|
|
|
4172
4436
|
type: "dynamic",
|
|
4173
4437
|
depends: ["app", "action", "actionType", "connection"],
|
|
4174
4438
|
fetch: async (sdk, resolvedParams) => {
|
|
4175
|
-
const fieldsResponse = await sdk.
|
|
4439
|
+
const fieldsResponse = await sdk.listActionInputFields({
|
|
4176
4440
|
app: resolvedParams.app,
|
|
4177
4441
|
action: resolvedParams.action,
|
|
4178
4442
|
actionType: resolvedParams.actionType,
|
|
@@ -4278,7 +4542,8 @@ var workflowIdResolver = {
|
|
|
4278
4542
|
name: "workflow",
|
|
4279
4543
|
message: "Select a workflow:",
|
|
4280
4544
|
choices: workflows.map((workflow) => ({
|
|
4281
|
-
name: workflow.
|
|
4545
|
+
name: workflow.name,
|
|
4546
|
+
hint: workflow.enabled ? void 0 : [workflow.id, "disabled"],
|
|
4282
4547
|
value: workflow.id
|
|
4283
4548
|
}))
|
|
4284
4549
|
})
|
|
@@ -4293,7 +4558,8 @@ var durableRunIdResolver = {
|
|
|
4293
4558
|
name: "run",
|
|
4294
4559
|
message: "Select a run:",
|
|
4295
4560
|
choices: runs.map((run) => ({
|
|
4296
|
-
name:
|
|
4561
|
+
name: run.id,
|
|
4562
|
+
hint: run.status,
|
|
4297
4563
|
value: run.id
|
|
4298
4564
|
}))
|
|
4299
4565
|
})
|
|
@@ -4303,11 +4569,7 @@ var durableRunIdResolver = {
|
|
|
4303
4569
|
var workflowVersionIdResolver = {
|
|
4304
4570
|
type: "dynamic",
|
|
4305
4571
|
depends: ["workflow"],
|
|
4306
|
-
fetch: async (sdk, params) => toIterable(
|
|
4307
|
-
sdk.listWorkflowVersions({
|
|
4308
|
-
workflow: params.workflow
|
|
4309
|
-
})
|
|
4310
|
-
),
|
|
4572
|
+
fetch: async (sdk, params) => toIterable(sdk.listWorkflowVersions({ workflow: params.workflow })),
|
|
4311
4573
|
prompt: (versions) => ({
|
|
4312
4574
|
type: "list",
|
|
4313
4575
|
name: "version",
|
|
@@ -4323,11 +4585,7 @@ var workflowVersionIdResolver = {
|
|
|
4323
4585
|
var workflowRunIdResolver = {
|
|
4324
4586
|
type: "dynamic",
|
|
4325
4587
|
depends: ["workflow"],
|
|
4326
|
-
fetch: async (sdk, params) => toIterable(
|
|
4327
|
-
sdk.listWorkflowRuns({
|
|
4328
|
-
workflow: params.workflow
|
|
4329
|
-
})
|
|
4330
|
-
),
|
|
4588
|
+
fetch: async (sdk, params) => toIterable(sdk.listWorkflowRuns({ workflow: params.workflow })),
|
|
4331
4589
|
prompt: (runs) => ({
|
|
4332
4590
|
type: "list",
|
|
4333
4591
|
name: "run",
|
|
@@ -4343,11 +4601,7 @@ var workflowRunIdResolver = {
|
|
|
4343
4601
|
var triggerMessagesResolver = {
|
|
4344
4602
|
type: "dynamic",
|
|
4345
4603
|
depends: ["inbox"],
|
|
4346
|
-
fetch: async (sdk, params) => toIterable(
|
|
4347
|
-
sdk.listTriggerInboxMessages({
|
|
4348
|
-
inbox: params.inbox
|
|
4349
|
-
})
|
|
4350
|
-
),
|
|
4604
|
+
fetch: async (sdk, params) => toIterable(sdk.listTriggerInboxMessages({ inbox: params.inbox })),
|
|
4351
4605
|
prompt: (messages) => ({
|
|
4352
4606
|
type: "checkbox",
|
|
4353
4607
|
name: "messages",
|
|
@@ -4721,7 +4975,7 @@ var FieldApiItemSchema = z.object({
|
|
|
4721
4975
|
var ListTableFieldsApiResponseSchema = z.object({
|
|
4722
4976
|
data: z.array(FieldApiItemSchema)
|
|
4723
4977
|
});
|
|
4724
|
-
var
|
|
4978
|
+
var FieldItemSchema = z.object({
|
|
4725
4979
|
id: z.string(),
|
|
4726
4980
|
type: FieldTypeSchema,
|
|
4727
4981
|
name: z.string(),
|
|
@@ -4731,13 +4985,6 @@ var FieldItemSchemaBase = z.object({
|
|
|
4731
4985
|
config: z.record(z.string(), z.unknown()).optional(),
|
|
4732
4986
|
deleted_at: z.string().nullable().optional()
|
|
4733
4987
|
});
|
|
4734
|
-
var FieldItemSchema = withFormatter(FieldItemSchemaBase, {
|
|
4735
|
-
format: (item) => ({
|
|
4736
|
-
title: item.name,
|
|
4737
|
-
id: item.id,
|
|
4738
|
-
details: [{ text: `Type: ${item.type}`, style: "dim" }]
|
|
4739
|
-
})
|
|
4740
|
-
});
|
|
4741
4988
|
var ListTableFieldsDescription = "List fields for a table";
|
|
4742
4989
|
var ListTableFieldsOptionsBaseSchema = z.object({
|
|
4743
4990
|
fields: FieldsPropertySchema.optional(),
|
|
@@ -4993,6 +5240,7 @@ var getAppPlugin = definePlugin(
|
|
|
4993
5240
|
itemType: "App",
|
|
4994
5241
|
inputSchema: GetAppInputSchema,
|
|
4995
5242
|
outputSchema: AppItemSchema,
|
|
5243
|
+
formatter: appItemFormatter,
|
|
4996
5244
|
resolvers: { app: appKeyResolver },
|
|
4997
5245
|
handler: async ({ sdk: sdk2, options }) => {
|
|
4998
5246
|
const appKey = "app" in options ? options.app : options.appKey;
|
|
@@ -5326,48 +5574,54 @@ z.object({
|
|
|
5326
5574
|
});
|
|
5327
5575
|
|
|
5328
5576
|
// src/schemas/Action.ts
|
|
5329
|
-
var ActionItemSchema =
|
|
5330
|
-
|
|
5331
|
-
|
|
5332
|
-
|
|
5333
|
-
|
|
5334
|
-
|
|
5335
|
-
|
|
5336
|
-
|
|
5337
|
-
|
|
5338
|
-
|
|
5339
|
-
|
|
5340
|
-
|
|
5341
|
-
|
|
5342
|
-
|
|
5343
|
-
|
|
5344
|
-
|
|
5345
|
-
|
|
5346
|
-
|
|
5347
|
-
|
|
5348
|
-
|
|
5349
|
-
|
|
5350
|
-
|
|
5351
|
-
|
|
5352
|
-
style: "normal"
|
|
5353
|
-
});
|
|
5354
|
-
}
|
|
5355
|
-
if (item.description) {
|
|
5356
|
-
details.push({
|
|
5357
|
-
text: item.description,
|
|
5358
|
-
style: "dim"
|
|
5359
|
-
});
|
|
5360
|
-
}
|
|
5361
|
-
return {
|
|
5362
|
-
title: item.title || item.key,
|
|
5363
|
-
id: item.id,
|
|
5364
|
-
key: item.key,
|
|
5365
|
-
description: item.description,
|
|
5366
|
-
details
|
|
5367
|
-
};
|
|
5577
|
+
var ActionItemSchema = ActionSchema.omit({
|
|
5578
|
+
type: true,
|
|
5579
|
+
name: true,
|
|
5580
|
+
selected_api: true
|
|
5581
|
+
}).extend({
|
|
5582
|
+
app_key: z.string(),
|
|
5583
|
+
// App key without version (extracted from selected_api)
|
|
5584
|
+
app_version: z.string().optional(),
|
|
5585
|
+
// Version extracted from selected_api
|
|
5586
|
+
action_type: ActionSchema.shape.type,
|
|
5587
|
+
// Mapped from original 'type' field
|
|
5588
|
+
title: z.string(),
|
|
5589
|
+
// Mapped from original 'name' field
|
|
5590
|
+
type: z.literal("action")
|
|
5591
|
+
// Fixed type identifier
|
|
5592
|
+
});
|
|
5593
|
+
|
|
5594
|
+
// src/formatters/action.ts
|
|
5595
|
+
var actionItemFormatter = {
|
|
5596
|
+
format: (item) => {
|
|
5597
|
+
const details = [{ text: `Type: ${item.action_type}`, style: "accent" }];
|
|
5598
|
+
if (item.app_key) {
|
|
5599
|
+
details.push({ text: `App: ${item.app_key}`, style: "normal" });
|
|
5368
5600
|
}
|
|
5601
|
+
if (item.description) {
|
|
5602
|
+
details.push({ text: item.description, style: "dim" });
|
|
5603
|
+
}
|
|
5604
|
+
return {
|
|
5605
|
+
title: item.title || item.key,
|
|
5606
|
+
id: item.id,
|
|
5607
|
+
key: item.key,
|
|
5608
|
+
description: item.description,
|
|
5609
|
+
details
|
|
5610
|
+
};
|
|
5369
5611
|
}
|
|
5370
|
-
|
|
5612
|
+
};
|
|
5613
|
+
|
|
5614
|
+
// src/plugins/eventEmission/method-metadata.ts
|
|
5615
|
+
var SCOPE_KEY = "methodMetadata";
|
|
5616
|
+
function setMethodMetadata(metadata) {
|
|
5617
|
+
const scope = getCurrentScope();
|
|
5618
|
+
if (!scope) return;
|
|
5619
|
+
const existing = scope[SCOPE_KEY];
|
|
5620
|
+
scope[SCOPE_KEY] = { ...existing, ...metadata };
|
|
5621
|
+
}
|
|
5622
|
+
function getMethodMetadata() {
|
|
5623
|
+
return getCurrentScope()?.[SCOPE_KEY];
|
|
5624
|
+
}
|
|
5371
5625
|
|
|
5372
5626
|
// src/plugins/listActions/index.ts
|
|
5373
5627
|
var listActionsPlugin = definePlugin(
|
|
@@ -5378,12 +5632,10 @@ var listActionsPlugin = definePlugin(
|
|
|
5378
5632
|
itemType: "Action",
|
|
5379
5633
|
inputSchema: ListActionsInputSchema,
|
|
5380
5634
|
outputSchema: ActionItemSchema,
|
|
5635
|
+
formatter: actionItemFormatter,
|
|
5381
5636
|
defaultPageSize: DEFAULT_PAGE_SIZE,
|
|
5382
5637
|
resolvers: { app: appKeyResolver, actionType: actionTypeResolver },
|
|
5383
|
-
handler: async ({
|
|
5384
|
-
sdk: sdk2,
|
|
5385
|
-
options
|
|
5386
|
-
}) => {
|
|
5638
|
+
handler: async ({ sdk: sdk2, options }) => {
|
|
5387
5639
|
const { api, getVersionedImplementationId } = sdk2.context;
|
|
5388
5640
|
const appKey = "app" in options ? options.app : options.appKey;
|
|
5389
5641
|
const selectedApi = await getVersionedImplementationId(appKey);
|
|
@@ -5451,6 +5703,7 @@ var getActionPlugin = definePlugin(
|
|
|
5451
5703
|
itemType: "Action",
|
|
5452
5704
|
inputSchema: GetActionInputSchema,
|
|
5453
5705
|
outputSchema: ActionItemSchema,
|
|
5706
|
+
formatter: actionItemFormatter,
|
|
5454
5707
|
resolvers: {
|
|
5455
5708
|
app: appKeyResolver,
|
|
5456
5709
|
actionType: actionTypeResolver,
|
|
@@ -5512,6 +5765,29 @@ var RunActionSchemaDeprecated = z.object({
|
|
|
5512
5765
|
actionKey: ActionKeyPropertySchema
|
|
5513
5766
|
}).merge(RunActionBaseSchema);
|
|
5514
5767
|
var RunActionInputSchema = z.union([RunActionSchema, RunActionSchemaDeprecated]).describe(RunActionDescription);
|
|
5768
|
+
|
|
5769
|
+
// src/formatters/actionResult.ts
|
|
5770
|
+
function getStringProperty(obj, key) {
|
|
5771
|
+
if (typeof obj === "object" && obj !== null && key in obj) {
|
|
5772
|
+
const value = obj[key];
|
|
5773
|
+
return typeof value === "string" ? value : void 0;
|
|
5774
|
+
}
|
|
5775
|
+
return void 0;
|
|
5776
|
+
}
|
|
5777
|
+
var actionResultItemFormatter = {
|
|
5778
|
+
format: (item) => {
|
|
5779
|
+
const obj = typeof item === "object" && item !== null ? item : {};
|
|
5780
|
+
const title = getStringProperty(obj, "title") || getStringProperty(obj, "name") || getStringProperty(obj, "label") || getStringProperty(obj, "subject") || "Action Result";
|
|
5781
|
+
return {
|
|
5782
|
+
title,
|
|
5783
|
+
id: getStringProperty(obj, "id"),
|
|
5784
|
+
key: getStringProperty(obj, "key"),
|
|
5785
|
+
description: getStringProperty(obj, "description"),
|
|
5786
|
+
data: item,
|
|
5787
|
+
details: []
|
|
5788
|
+
};
|
|
5789
|
+
}
|
|
5790
|
+
};
|
|
5515
5791
|
async function executeAction(actionOptions) {
|
|
5516
5792
|
const {
|
|
5517
5793
|
api,
|
|
@@ -5641,6 +5917,7 @@ var runActionPlugin = definePlugin(
|
|
|
5641
5917
|
itemType: "ActionResult",
|
|
5642
5918
|
inputSchema: RunActionInputSchema,
|
|
5643
5919
|
outputSchema: ActionResultItemSchema,
|
|
5920
|
+
formatter: actionResultItemFormatter,
|
|
5644
5921
|
resolvers: {
|
|
5645
5922
|
app: appKeyResolver,
|
|
5646
5923
|
actionType: actionTypeResolver,
|
|
@@ -5648,10 +5925,7 @@ var runActionPlugin = definePlugin(
|
|
|
5648
5925
|
connection: connectionIdResolver,
|
|
5649
5926
|
inputs: inputsResolver
|
|
5650
5927
|
},
|
|
5651
|
-
handler: async ({
|
|
5652
|
-
sdk: sdk2,
|
|
5653
|
-
options
|
|
5654
|
-
}) => {
|
|
5928
|
+
handler: async ({ sdk: sdk2, options }) => {
|
|
5655
5929
|
const { api } = sdk2.context;
|
|
5656
5930
|
const appKey = "app" in options ? options.app : options.appKey;
|
|
5657
5931
|
const actionKey = "action" in options ? options.action : options.actionKey;
|
|
@@ -5704,7 +5978,9 @@ var runActionPlugin = definePlugin(
|
|
|
5704
5978
|
}
|
|
5705
5979
|
return {
|
|
5706
5980
|
data: result.results || [],
|
|
5707
|
-
|
|
5981
|
+
// Coerce to a string: the API returns a numeric page index, but
|
|
5982
|
+
// `SdkPage.nextCursor` is a string (and the page guard enforces it).
|
|
5983
|
+
nextCursor: result.next_page != null ? String(result.next_page) : void 0
|
|
5708
5984
|
};
|
|
5709
5985
|
}
|
|
5710
5986
|
});
|
|
@@ -5759,7 +6035,10 @@ var ListConnectionsQuerySchema = ListConnectionsQuerySchema$1.omit({
|
|
|
5759
6035
|
// SDK specific property for pagination/iterable helpers
|
|
5760
6036
|
cursor: z.string().optional().describe("Cursor to start from")
|
|
5761
6037
|
}).describe("List available connections with optional filtering");
|
|
5762
|
-
var ConnectionItemSchema =
|
|
6038
|
+
var ConnectionItemSchema = ConnectionItemSchema$1;
|
|
6039
|
+
|
|
6040
|
+
// src/formatters/connection.ts
|
|
6041
|
+
var connectionItemFormatter = {
|
|
5763
6042
|
format: (item) => {
|
|
5764
6043
|
const details = [];
|
|
5765
6044
|
if (item.identifier) {
|
|
@@ -5784,17 +6063,19 @@ var ConnectionItemSchema = withFormatter(ConnectionItemSchema$1, {
|
|
|
5784
6063
|
details
|
|
5785
6064
|
};
|
|
5786
6065
|
}
|
|
5787
|
-
}
|
|
6066
|
+
};
|
|
5788
6067
|
|
|
5789
6068
|
// src/plugins/listConnections/index.ts
|
|
5790
6069
|
var listConnectionsPlugin = definePlugin(
|
|
5791
6070
|
(sdk) => createPaginatedPluginMethod(sdk, {
|
|
6071
|
+
...zapierPagination,
|
|
5792
6072
|
name: "listConnections",
|
|
5793
6073
|
categories: ["connection"],
|
|
5794
6074
|
type: "list",
|
|
5795
6075
|
itemType: "Connection",
|
|
5796
6076
|
inputSchema: ListConnectionsQuerySchema,
|
|
5797
6077
|
outputSchema: ConnectionItemSchema,
|
|
6078
|
+
formatter: connectionItemFormatter,
|
|
5798
6079
|
defaultPageSize: DEFAULT_PAGE_SIZE,
|
|
5799
6080
|
resolvers: { app: appKeyResolver },
|
|
5800
6081
|
handler: async ({ sdk: sdk2, options }) => {
|
|
@@ -5867,8 +6148,7 @@ var listConnectionsPlugin = definePlugin(
|
|
|
5867
6148
|
...response,
|
|
5868
6149
|
data: response.data.map(transformConnectionItem)
|
|
5869
6150
|
};
|
|
5870
|
-
}
|
|
5871
|
-
extractCursor: (response) => extractCursor(response.links)
|
|
6151
|
+
}
|
|
5872
6152
|
})
|
|
5873
6153
|
);
|
|
5874
6154
|
var GetConnectionParamSchema = z.object({
|
|
@@ -5892,6 +6172,7 @@ var getConnectionPlugin = definePlugin(
|
|
|
5892
6172
|
itemType: "Connection",
|
|
5893
6173
|
inputSchema: GetConnectionParamSchema,
|
|
5894
6174
|
outputSchema: ConnectionItemSchema,
|
|
6175
|
+
formatter: connectionItemFormatter,
|
|
5895
6176
|
resolvers: { connection: connectionIdGenericResolver },
|
|
5896
6177
|
handler: async ({ sdk: sdk2, options }) => {
|
|
5897
6178
|
const { api } = sdk2.context;
|
|
@@ -5932,6 +6213,7 @@ var findFirstConnectionPlugin = definePlugin(
|
|
|
5932
6213
|
itemType: "Connection",
|
|
5933
6214
|
inputSchema: FindFirstConnectionSchema,
|
|
5934
6215
|
outputSchema: ConnectionItemSchema,
|
|
6216
|
+
formatter: connectionItemFormatter,
|
|
5935
6217
|
handler: async ({ sdk: sdk2, options = {} }) => {
|
|
5936
6218
|
const connectionsResponse = await sdk2.listConnections({
|
|
5937
6219
|
...options,
|
|
@@ -5967,6 +6249,7 @@ var findUniqueConnectionPlugin = definePlugin(
|
|
|
5967
6249
|
itemType: "Connection",
|
|
5968
6250
|
inputSchema: FindUniqueConnectionSchema,
|
|
5969
6251
|
outputSchema: ConnectionItemSchema,
|
|
6252
|
+
formatter: connectionItemFormatter,
|
|
5970
6253
|
handler: async ({ sdk: sdk2, options = {} }) => {
|
|
5971
6254
|
const connectionsResponse = await sdk2.listConnections({
|
|
5972
6255
|
...options,
|
|
@@ -5997,11 +6280,13 @@ var listAuthenticationsPlugin = definePlugin(
|
|
|
5997
6280
|
meta: {
|
|
5998
6281
|
listAuthentications: {
|
|
5999
6282
|
packages: ["cli", "mcp"],
|
|
6000
|
-
categories: ["connection"
|
|
6283
|
+
categories: ["connection"],
|
|
6284
|
+
deprecation: { message: "Use listConnections instead." },
|
|
6001
6285
|
type: "list",
|
|
6002
6286
|
itemType: "Connection",
|
|
6003
6287
|
inputSchema: ListConnectionsQuerySchema,
|
|
6004
|
-
outputSchema: ConnectionItemSchema
|
|
6288
|
+
outputSchema: ConnectionItemSchema,
|
|
6289
|
+
formatter: connectionItemFormatter
|
|
6005
6290
|
}
|
|
6006
6291
|
}
|
|
6007
6292
|
}
|
|
@@ -6014,11 +6299,13 @@ var getAuthenticationPlugin = definePlugin(
|
|
|
6014
6299
|
meta: {
|
|
6015
6300
|
getAuthentication: {
|
|
6016
6301
|
packages: ["cli", "mcp"],
|
|
6017
|
-
categories: ["connection"
|
|
6302
|
+
categories: ["connection"],
|
|
6303
|
+
deprecation: { message: "Use getConnection instead." },
|
|
6018
6304
|
type: "item",
|
|
6019
6305
|
itemType: "Connection",
|
|
6020
6306
|
inputSchema: GetConnectionParamSchema,
|
|
6021
|
-
outputSchema: ConnectionItemSchema
|
|
6307
|
+
outputSchema: ConnectionItemSchema,
|
|
6308
|
+
formatter: connectionItemFormatter
|
|
6022
6309
|
}
|
|
6023
6310
|
}
|
|
6024
6311
|
}
|
|
@@ -6031,11 +6318,13 @@ var findFirstAuthenticationPlugin = definePlugin(
|
|
|
6031
6318
|
meta: {
|
|
6032
6319
|
findFirstAuthentication: {
|
|
6033
6320
|
packages: ["cli", "mcp"],
|
|
6034
|
-
categories: ["connection"
|
|
6321
|
+
categories: ["connection"],
|
|
6322
|
+
deprecation: { message: "Use findFirstConnection instead." },
|
|
6035
6323
|
type: "item",
|
|
6036
6324
|
itemType: "Connection",
|
|
6037
6325
|
inputSchema: FindFirstConnectionSchema,
|
|
6038
|
-
outputSchema: ConnectionItemSchema
|
|
6326
|
+
outputSchema: ConnectionItemSchema,
|
|
6327
|
+
formatter: connectionItemFormatter
|
|
6039
6328
|
}
|
|
6040
6329
|
}
|
|
6041
6330
|
}
|
|
@@ -6048,11 +6337,13 @@ var findUniqueAuthenticationPlugin = definePlugin(
|
|
|
6048
6337
|
meta: {
|
|
6049
6338
|
findUniqueAuthentication: {
|
|
6050
6339
|
packages: ["cli", "mcp"],
|
|
6051
|
-
categories: ["connection"
|
|
6340
|
+
categories: ["connection"],
|
|
6341
|
+
deprecation: { message: "Use findUniqueConnection instead." },
|
|
6052
6342
|
type: "item",
|
|
6053
6343
|
itemType: "Connection",
|
|
6054
6344
|
inputSchema: FindUniqueConnectionSchema,
|
|
6055
|
-
outputSchema: ConnectionItemSchema
|
|
6345
|
+
outputSchema: ConnectionItemSchema,
|
|
6346
|
+
formatter: connectionItemFormatter
|
|
6056
6347
|
}
|
|
6057
6348
|
}
|
|
6058
6349
|
}
|
|
@@ -6069,58 +6360,49 @@ var ListClientCredentialsQuerySchema = ListClientCredentialsQuerySchema$1.omit({
|
|
|
6069
6360
|
// SDK specific property for pagination/iterable helpers
|
|
6070
6361
|
cursor: z.string().optional().describe("Cursor to start from")
|
|
6071
6362
|
}).describe("List client credentials for the authenticated user");
|
|
6072
|
-
var ClientCredentialsItemSchema =
|
|
6073
|
-
|
|
6074
|
-
|
|
6075
|
-
|
|
6076
|
-
|
|
6077
|
-
|
|
6078
|
-
|
|
6079
|
-
|
|
6080
|
-
|
|
6081
|
-
}
|
|
6082
|
-
|
|
6083
|
-
|
|
6084
|
-
details.push({
|
|
6085
|
-
text: `Created: ${new Date(item.created_at).toLocaleDateString()}`,
|
|
6086
|
-
style: "dim"
|
|
6087
|
-
});
|
|
6088
|
-
}
|
|
6089
|
-
return {
|
|
6090
|
-
title: item.name,
|
|
6091
|
-
id: item.client_id,
|
|
6092
|
-
details
|
|
6093
|
-
};
|
|
6363
|
+
var ClientCredentialsItemSchema = ClientCredentialsItemSchema$1;
|
|
6364
|
+
var ClientCredentialsCreatedItemSchema = ClientCredentialsCreatedItemSchema$1;
|
|
6365
|
+
|
|
6366
|
+
// src/formatters/clientCredentials.ts
|
|
6367
|
+
var clientCredentialsItemFormatter = {
|
|
6368
|
+
format: (item) => {
|
|
6369
|
+
const details = [];
|
|
6370
|
+
if (item.allowed_scopes && item.allowed_scopes.length > 0) {
|
|
6371
|
+
details.push({
|
|
6372
|
+
text: `Scopes: ${item.allowed_scopes.join(", ")}`,
|
|
6373
|
+
style: "accent"
|
|
6374
|
+
});
|
|
6094
6375
|
}
|
|
6095
|
-
|
|
6096
|
-
|
|
6097
|
-
|
|
6098
|
-
|
|
6099
|
-
|
|
6100
|
-
format: (item) => {
|
|
6101
|
-
return {
|
|
6102
|
-
title: item.name,
|
|
6103
|
-
id: item.client_id,
|
|
6104
|
-
details: [
|
|
6105
|
-
{
|
|
6106
|
-
text: `Client Secret: ${item.client_secret}`,
|
|
6107
|
-
style: "accent"
|
|
6108
|
-
}
|
|
6109
|
-
]
|
|
6110
|
-
};
|
|
6376
|
+
if (item.created_at) {
|
|
6377
|
+
details.push({
|
|
6378
|
+
text: `Created: ${new Date(item.created_at).toLocaleDateString()}`,
|
|
6379
|
+
style: "dim"
|
|
6380
|
+
});
|
|
6111
6381
|
}
|
|
6382
|
+
return { title: item.name, id: item.client_id, details };
|
|
6112
6383
|
}
|
|
6113
|
-
|
|
6384
|
+
};
|
|
6385
|
+
var clientCredentialsCreatedItemFormatter = {
|
|
6386
|
+
format: (item) => ({
|
|
6387
|
+
title: item.name,
|
|
6388
|
+
id: item.client_id,
|
|
6389
|
+
details: [
|
|
6390
|
+
{ text: `Client Secret: ${item.client_secret}`, style: "accent" }
|
|
6391
|
+
]
|
|
6392
|
+
})
|
|
6393
|
+
};
|
|
6114
6394
|
|
|
6115
6395
|
// src/plugins/listClientCredentials/index.ts
|
|
6116
6396
|
var listClientCredentialsPlugin = definePlugin(
|
|
6117
6397
|
(sdk) => createPaginatedPluginMethod(sdk, {
|
|
6398
|
+
...zapierPagination,
|
|
6118
6399
|
name: "listClientCredentials",
|
|
6119
6400
|
categories: ["client-credentials"],
|
|
6120
6401
|
type: "list",
|
|
6121
6402
|
itemType: "ClientCredentials",
|
|
6122
6403
|
inputSchema: ListClientCredentialsQuerySchema,
|
|
6123
6404
|
outputSchema: ClientCredentialsItemSchema,
|
|
6405
|
+
formatter: clientCredentialsItemFormatter,
|
|
6124
6406
|
defaultPageSize: DEFAULT_PAGE_SIZE,
|
|
6125
6407
|
handler: async ({
|
|
6126
6408
|
sdk: sdk2,
|
|
@@ -6141,8 +6423,7 @@ var listClientCredentialsPlugin = definePlugin(
|
|
|
6141
6423
|
requiredScopes: ["credentials"]
|
|
6142
6424
|
}
|
|
6143
6425
|
);
|
|
6144
|
-
}
|
|
6145
|
-
extractCursor: (response) => extractCursor(response.links)
|
|
6426
|
+
}
|
|
6146
6427
|
})
|
|
6147
6428
|
);
|
|
6148
6429
|
var CreateClientCredentialsSchema = CreateClientCredentialsRequestSchema.omit({ allowed_scopes: true }).extend({
|
|
@@ -6160,6 +6441,7 @@ var createClientCredentialsPlugin = definePlugin(
|
|
|
6160
6441
|
itemType: "ClientCredentials",
|
|
6161
6442
|
inputSchema: CreateClientCredentialsSchema,
|
|
6162
6443
|
outputSchema: ClientCredentialsCreatedItemSchema,
|
|
6444
|
+
formatter: clientCredentialsCreatedItemFormatter,
|
|
6163
6445
|
confirm: "create-secret",
|
|
6164
6446
|
resolvers: { name: clientCredentialsNameResolver },
|
|
6165
6447
|
handler: async ({ sdk: sdk2, options }) => {
|
|
@@ -6249,99 +6531,36 @@ var BaseFieldItemSchema = z.object({
|
|
|
6249
6531
|
key: z.string()
|
|
6250
6532
|
// From need.key
|
|
6251
6533
|
});
|
|
6252
|
-
var InputFieldItemSchema =
|
|
6253
|
-
|
|
6254
|
-
|
|
6255
|
-
|
|
6256
|
-
|
|
6257
|
-
|
|
6258
|
-
|
|
6259
|
-
|
|
6260
|
-
|
|
6261
|
-
|
|
6262
|
-
|
|
6263
|
-
|
|
6264
|
-
|
|
6265
|
-
|
|
6266
|
-
|
|
6267
|
-
|
|
6268
|
-
|
|
6269
|
-
|
|
6270
|
-
|
|
6271
|
-
|
|
6272
|
-
|
|
6273
|
-
|
|
6274
|
-
|
|
6275
|
-
|
|
6276
|
-
|
|
6277
|
-
|
|
6278
|
-
|
|
6279
|
-
|
|
6280
|
-
|
|
6281
|
-
|
|
6282
|
-
].filter(Boolean).join(" | ");
|
|
6283
|
-
if (typeInfo) {
|
|
6284
|
-
details.push({ text: typeInfo, style: "dim" });
|
|
6285
|
-
}
|
|
6286
|
-
if (item.description) {
|
|
6287
|
-
details.push({
|
|
6288
|
-
text: item.description,
|
|
6289
|
-
style: "normal"
|
|
6290
|
-
});
|
|
6291
|
-
}
|
|
6292
|
-
if (item.default_value) {
|
|
6293
|
-
details.push({
|
|
6294
|
-
text: `Default: ${item.default_value}`,
|
|
6295
|
-
style: "accent"
|
|
6296
|
-
});
|
|
6297
|
-
}
|
|
6298
|
-
if (item.placeholder) {
|
|
6299
|
-
details.push({
|
|
6300
|
-
text: `Placeholder: ${item.placeholder}`,
|
|
6301
|
-
style: "dim"
|
|
6302
|
-
});
|
|
6303
|
-
}
|
|
6304
|
-
if (item.depends_on && item.depends_on.length > 0) {
|
|
6305
|
-
details.push({
|
|
6306
|
-
text: `Depends on: ${item.depends_on.join(", ")}`,
|
|
6307
|
-
style: "warning"
|
|
6308
|
-
});
|
|
6309
|
-
}
|
|
6310
|
-
if (item.format) {
|
|
6311
|
-
details.push({ text: `Format: ${item.format}`, style: "dim" });
|
|
6312
|
-
}
|
|
6313
|
-
if (item.items) {
|
|
6314
|
-
details.push({
|
|
6315
|
-
text: `Items type: ${item.items.type}`,
|
|
6316
|
-
style: "dim"
|
|
6317
|
-
});
|
|
6318
|
-
}
|
|
6319
|
-
return {
|
|
6320
|
-
title: item.title || item.key,
|
|
6321
|
-
key: item.key,
|
|
6322
|
-
description: item.description,
|
|
6323
|
-
details
|
|
6324
|
-
};
|
|
6325
|
-
}
|
|
6326
|
-
}
|
|
6327
|
-
);
|
|
6328
|
-
var InfoFieldItemSchema = withFormatter(
|
|
6329
|
-
BaseFieldItemSchema.extend({
|
|
6330
|
-
type: z.literal("info_field"),
|
|
6331
|
-
description: z.string(),
|
|
6332
|
-
// From need.help_text
|
|
6333
|
-
title: z.string().optional()
|
|
6334
|
-
// Optional title
|
|
6335
|
-
}),
|
|
6336
|
-
{
|
|
6337
|
-
format: (item) => ({
|
|
6338
|
-
title: item.title || "Info",
|
|
6339
|
-
key: item.key,
|
|
6340
|
-
description: item.description,
|
|
6341
|
-
details: [{ text: item.description, style: "normal" }]
|
|
6342
|
-
})
|
|
6343
|
-
}
|
|
6344
|
-
);
|
|
6534
|
+
var InputFieldItemSchema = BaseFieldItemSchema.extend({
|
|
6535
|
+
type: z.literal("input_field"),
|
|
6536
|
+
default_value: z.string(),
|
|
6537
|
+
// Mapped from 'default' with fallback to ""
|
|
6538
|
+
depends_on: z.array(z.string()),
|
|
6539
|
+
// Mapped from 'depends_on' with fallback to []
|
|
6540
|
+
description: z.string(),
|
|
6541
|
+
// Mapped from 'help_text' with fallback to ""
|
|
6542
|
+
invalidates_input_fields: z.boolean(),
|
|
6543
|
+
// Mapped from 'alters_custom_fields' with fallback to false
|
|
6544
|
+
is_required: z.boolean(),
|
|
6545
|
+
// Mapped from 'required' with fallback to false
|
|
6546
|
+
placeholder: z.string(),
|
|
6547
|
+
// Mapped from 'placeholder' with fallback to ""
|
|
6548
|
+
title: z.string(),
|
|
6549
|
+
// Mapped from 'label' with fallback to ""
|
|
6550
|
+
value_type: z.string(),
|
|
6551
|
+
// Computed from InputFieldType enum
|
|
6552
|
+
format: z.string().optional(),
|
|
6553
|
+
// Computed from InputFieldFormat enum (optional)
|
|
6554
|
+
items: z.object({ type: z.string() }).optional()
|
|
6555
|
+
// Computed from ItemsType enum (optional, only for arrays)
|
|
6556
|
+
});
|
|
6557
|
+
var InfoFieldItemSchema = BaseFieldItemSchema.extend({
|
|
6558
|
+
type: z.literal("info_field"),
|
|
6559
|
+
description: z.string(),
|
|
6560
|
+
// From need.help_text
|
|
6561
|
+
title: z.string().optional()
|
|
6562
|
+
// Optional title
|
|
6563
|
+
});
|
|
6345
6564
|
var FieldsetItemSchema = BaseFieldItemSchema.extend({
|
|
6346
6565
|
type: z.literal("fieldset"),
|
|
6347
6566
|
title: z.string(),
|
|
@@ -6361,6 +6580,53 @@ var RootFieldItemSchema = z.union([
|
|
|
6361
6580
|
FieldsetItemSchema
|
|
6362
6581
|
]);
|
|
6363
6582
|
|
|
6583
|
+
// src/formatters/field.ts
|
|
6584
|
+
function formatInputField(item) {
|
|
6585
|
+
const details = [];
|
|
6586
|
+
const typeInfo = [
|
|
6587
|
+
item.value_type && `Type: ${item.value_type}`,
|
|
6588
|
+
`Required: ${item.is_required ? "Yes" : "No"}`
|
|
6589
|
+
].filter(Boolean).join(" | ");
|
|
6590
|
+
if (typeInfo) details.push({ text: typeInfo, style: "dim" });
|
|
6591
|
+
if (item.description)
|
|
6592
|
+
details.push({ text: item.description, style: "normal" });
|
|
6593
|
+
if (item.default_value)
|
|
6594
|
+
details.push({ text: `Default: ${item.default_value}`, style: "accent" });
|
|
6595
|
+
if (item.placeholder)
|
|
6596
|
+
details.push({ text: `Placeholder: ${item.placeholder}`, style: "dim" });
|
|
6597
|
+
if (item.depends_on && item.depends_on.length > 0) {
|
|
6598
|
+
details.push({
|
|
6599
|
+
text: `Depends on: ${item.depends_on.join(", ")}`,
|
|
6600
|
+
style: "warning"
|
|
6601
|
+
});
|
|
6602
|
+
}
|
|
6603
|
+
if (item.format)
|
|
6604
|
+
details.push({ text: `Format: ${item.format}`, style: "dim" });
|
|
6605
|
+
if (item.items)
|
|
6606
|
+
details.push({ text: `Items type: ${item.items.type}`, style: "dim" });
|
|
6607
|
+
return {
|
|
6608
|
+
title: item.title || item.key,
|
|
6609
|
+
key: item.key,
|
|
6610
|
+
description: item.description,
|
|
6611
|
+
details
|
|
6612
|
+
};
|
|
6613
|
+
}
|
|
6614
|
+
function formatInfoField(item) {
|
|
6615
|
+
return {
|
|
6616
|
+
title: item.title || "Info",
|
|
6617
|
+
key: item.key,
|
|
6618
|
+
description: item.description,
|
|
6619
|
+
details: [{ text: item.description, style: "normal" }]
|
|
6620
|
+
};
|
|
6621
|
+
}
|
|
6622
|
+
var rootFieldItemFormatter = {
|
|
6623
|
+
format: (item) => {
|
|
6624
|
+
if (item.type === "input_field") return formatInputField(item);
|
|
6625
|
+
if (item.type === "info_field") return formatInfoField(item);
|
|
6626
|
+
return { title: item.title || item.key, key: item.key, details: [] };
|
|
6627
|
+
}
|
|
6628
|
+
};
|
|
6629
|
+
|
|
6364
6630
|
// src/services/implementations.ts
|
|
6365
6631
|
async function fetchImplementationNeeds({
|
|
6366
6632
|
api,
|
|
@@ -6526,6 +6792,7 @@ var listActionInputFieldsPlugin = definePlugin(
|
|
|
6526
6792
|
itemType: "RootField",
|
|
6527
6793
|
inputSchema: ListActionInputFieldsInputSchema,
|
|
6528
6794
|
outputSchema: RootFieldItemSchema,
|
|
6795
|
+
formatter: rootFieldItemFormatter,
|
|
6529
6796
|
defaultPageSize: DEFAULT_PAGE_SIZE,
|
|
6530
6797
|
resolvers: {
|
|
6531
6798
|
app: appKeyResolver,
|
|
@@ -6534,10 +6801,7 @@ var listActionInputFieldsPlugin = definePlugin(
|
|
|
6534
6801
|
connection: connectionIdResolver,
|
|
6535
6802
|
inputs: inputsAllOptionalResolver
|
|
6536
6803
|
},
|
|
6537
|
-
handler: async ({
|
|
6538
|
-
sdk: sdk2,
|
|
6539
|
-
options
|
|
6540
|
-
}) => {
|
|
6804
|
+
handler: async ({ sdk: sdk2, options }) => {
|
|
6541
6805
|
const { api, getVersionedImplementationId } = sdk2.context;
|
|
6542
6806
|
const appKey = "app" in options ? options.app : options.appKey;
|
|
6543
6807
|
const actionKey = "action" in options ? options.action : options.actionKey;
|
|
@@ -6699,26 +6963,7 @@ var getActionInputFieldsSchemaPlugin = definePlugin(
|
|
|
6699
6963
|
}
|
|
6700
6964
|
})
|
|
6701
6965
|
);
|
|
6702
|
-
var InputFieldChoiceItemSchema =
|
|
6703
|
-
format: (item) => {
|
|
6704
|
-
const title = item.label || item.key || "Choice";
|
|
6705
|
-
const details = [];
|
|
6706
|
-
if (item.label && item.key && item.label !== item.key) {
|
|
6707
|
-
details.push({ text: `Key: ${item.key}`, style: "dim" });
|
|
6708
|
-
}
|
|
6709
|
-
if (item.sample && item.sample !== item.key) {
|
|
6710
|
-
details.push({ text: `Sample: ${item.sample}`, style: "dim" });
|
|
6711
|
-
}
|
|
6712
|
-
if (item.value && item.value !== item.key) {
|
|
6713
|
-
details.push({ text: `Value: ${item.value}`, style: "normal" });
|
|
6714
|
-
}
|
|
6715
|
-
return {
|
|
6716
|
-
title,
|
|
6717
|
-
key: item.key,
|
|
6718
|
-
details
|
|
6719
|
-
};
|
|
6720
|
-
}
|
|
6721
|
-
});
|
|
6966
|
+
var InputFieldChoiceItemSchema = NeedChoicesSchema;
|
|
6722
6967
|
var ListActionInputFieldChoicesDescription = "Get the available choices for a dynamic dropdown input field";
|
|
6723
6968
|
var ListActionInputFieldChoicesBaseSchema = z.object({
|
|
6724
6969
|
connection: ConnectionPropertySchema.optional().describe(
|
|
@@ -6762,6 +7007,24 @@ var ListActionInputFieldChoicesInputSchema = z.union([
|
|
|
6762
7007
|
ListActionInputFieldChoicesSchemaDeprecated
|
|
6763
7008
|
]).describe(ListActionInputFieldChoicesDescription);
|
|
6764
7009
|
|
|
7010
|
+
// src/formatters/inputFieldChoice.ts
|
|
7011
|
+
var inputFieldChoiceItemFormatter = {
|
|
7012
|
+
format: (item) => {
|
|
7013
|
+
const title = item.label || item.key || "Choice";
|
|
7014
|
+
const details = [];
|
|
7015
|
+
if (item.label && item.key && item.label !== item.key) {
|
|
7016
|
+
details.push({ text: `Key: ${item.key}`, style: "dim" });
|
|
7017
|
+
}
|
|
7018
|
+
if (item.sample && item.sample !== item.key) {
|
|
7019
|
+
details.push({ text: `Sample: ${item.sample}`, style: "dim" });
|
|
7020
|
+
}
|
|
7021
|
+
if (item.value && item.value !== item.key) {
|
|
7022
|
+
details.push({ text: `Value: ${item.value}`, style: "normal" });
|
|
7023
|
+
}
|
|
7024
|
+
return { title, key: item.key, details };
|
|
7025
|
+
}
|
|
7026
|
+
};
|
|
7027
|
+
|
|
6765
7028
|
// src/plugins/listActionInputFieldChoices/index.ts
|
|
6766
7029
|
function transformNeedChoicesToInputFieldChoiceItem(choice) {
|
|
6767
7030
|
return {
|
|
@@ -6779,6 +7042,7 @@ var listActionInputFieldChoicesPlugin = definePlugin(
|
|
|
6779
7042
|
itemType: "InputFieldChoice",
|
|
6780
7043
|
inputSchema: ListActionInputFieldChoicesInputSchema,
|
|
6781
7044
|
outputSchema: InputFieldChoiceItemSchema,
|
|
7045
|
+
formatter: inputFieldChoiceItemFormatter,
|
|
6782
7046
|
defaultPageSize: DEFAULT_PAGE_SIZE,
|
|
6783
7047
|
resolvers: {
|
|
6784
7048
|
app: appKeyResolver,
|
|
@@ -6788,10 +7052,7 @@ var listActionInputFieldChoicesPlugin = definePlugin(
|
|
|
6788
7052
|
inputField: inputFieldKeyResolver,
|
|
6789
7053
|
inputs: inputsAllOptionalResolver
|
|
6790
7054
|
},
|
|
6791
|
-
handler: async ({
|
|
6792
|
-
sdk: sdk2,
|
|
6793
|
-
options
|
|
6794
|
-
}) => {
|
|
7055
|
+
handler: async ({ sdk: sdk2, options }) => {
|
|
6795
7056
|
const { api, getVersionedImplementationId } = sdk2.context;
|
|
6796
7057
|
const appKey = "app" in options ? options.app : options.appKey;
|
|
6797
7058
|
const actionKey = "action" in options ? options.action : options.actionKey;
|
|
@@ -6888,11 +7149,13 @@ var listInputFieldsDeprecatedPlugin = definePlugin(
|
|
|
6888
7149
|
context: {
|
|
6889
7150
|
meta: {
|
|
6890
7151
|
listInputFields: {
|
|
6891
|
-
categories: ["action"
|
|
7152
|
+
categories: ["action"],
|
|
7153
|
+
deprecation: { message: "Use listActionInputFields instead." },
|
|
6892
7154
|
type: "list",
|
|
6893
7155
|
itemType: "RootField",
|
|
6894
7156
|
inputSchema: ListActionInputFieldsInputSchema,
|
|
6895
7157
|
outputSchema: RootFieldItemSchema,
|
|
7158
|
+
formatter: rootFieldItemFormatter,
|
|
6896
7159
|
defaultPageSize: DEFAULT_PAGE_SIZE
|
|
6897
7160
|
}
|
|
6898
7161
|
}
|
|
@@ -6905,11 +7168,15 @@ var listInputFieldChoicesDeprecatedPlugin = definePlugin(
|
|
|
6905
7168
|
context: {
|
|
6906
7169
|
meta: {
|
|
6907
7170
|
listInputFieldChoices: {
|
|
6908
|
-
categories: ["action"
|
|
7171
|
+
categories: ["action"],
|
|
7172
|
+
deprecation: {
|
|
7173
|
+
message: "Use listActionInputFieldChoices instead."
|
|
7174
|
+
},
|
|
6909
7175
|
type: "list",
|
|
6910
7176
|
itemType: "InputFieldChoiceItem",
|
|
6911
7177
|
inputSchema: ListActionInputFieldChoicesInputSchema,
|
|
6912
7178
|
outputSchema: InputFieldChoiceItemSchema,
|
|
7179
|
+
formatter: inputFieldChoiceItemFormatter,
|
|
6913
7180
|
defaultPageSize: DEFAULT_PAGE_SIZE
|
|
6914
7181
|
}
|
|
6915
7182
|
}
|
|
@@ -6922,7 +7189,8 @@ var getInputFieldsSchemaDeprecatedPlugin = definePlugin(
|
|
|
6922
7189
|
context: {
|
|
6923
7190
|
meta: {
|
|
6924
7191
|
getInputFieldsSchema: {
|
|
6925
|
-
categories: ["action"
|
|
7192
|
+
categories: ["action"],
|
|
7193
|
+
deprecation: { message: "Use getActionInputFieldsSchema instead." },
|
|
6926
7194
|
type: "function",
|
|
6927
7195
|
inputSchema: GetActionInputFieldsSchemaInputSchema
|
|
6928
7196
|
}
|
|
@@ -6986,6 +7254,7 @@ var tablesDefaults = {
|
|
|
6986
7254
|
var listTablesPlugin = definePlugin(
|
|
6987
7255
|
(sdk) => createPaginatedPluginMethod(sdk, {
|
|
6988
7256
|
...tablesDefaults,
|
|
7257
|
+
...zapierPagination,
|
|
6989
7258
|
name: "listTables",
|
|
6990
7259
|
type: "list",
|
|
6991
7260
|
itemType: "Table",
|
|
@@ -7041,8 +7310,7 @@ var listTablesPlugin = definePlugin(
|
|
|
7041
7310
|
data: response.data.map(transformTableItem),
|
|
7042
7311
|
links: response.links
|
|
7043
7312
|
};
|
|
7044
|
-
}
|
|
7045
|
-
extractCursor: (response) => extractCursor(response.links)
|
|
7313
|
+
}
|
|
7046
7314
|
})
|
|
7047
7315
|
);
|
|
7048
7316
|
var GetTableApiResponseSchema = z.object({
|
|
@@ -7145,6 +7413,15 @@ var createTablePlugin = definePlugin(
|
|
|
7145
7413
|
})
|
|
7146
7414
|
);
|
|
7147
7415
|
|
|
7416
|
+
// src/formatters/tableField.ts
|
|
7417
|
+
var tableFieldItemFormatter = {
|
|
7418
|
+
format: (item) => ({
|
|
7419
|
+
title: item.name,
|
|
7420
|
+
id: item.id,
|
|
7421
|
+
details: [{ text: `Type: ${item.type}`, style: "dim" }]
|
|
7422
|
+
})
|
|
7423
|
+
};
|
|
7424
|
+
|
|
7148
7425
|
// src/plugins/tables/listTableFields/index.ts
|
|
7149
7426
|
var listTableFieldsPlugin = definePlugin(
|
|
7150
7427
|
(sdk) => createPluginMethod(sdk, {
|
|
@@ -7154,6 +7431,7 @@ var listTableFieldsPlugin = definePlugin(
|
|
|
7154
7431
|
itemType: "Field",
|
|
7155
7432
|
inputSchema: ListTableFieldsOptionsInputSchema,
|
|
7156
7433
|
outputSchema: FieldItemSchema,
|
|
7434
|
+
formatter: tableFieldItemFormatter,
|
|
7157
7435
|
resolvers: { table: tableIdResolver },
|
|
7158
7436
|
handler: async ({ sdk: sdk2, options }) => {
|
|
7159
7437
|
const { api } = sdk2.context;
|
|
@@ -7226,6 +7504,7 @@ var createTableFieldsPlugin = definePlugin(
|
|
|
7226
7504
|
returnType: "FieldItem[]",
|
|
7227
7505
|
inputSchema: CreateTableFieldsOptionsInputSchema,
|
|
7228
7506
|
outputSchema: FieldItemSchema,
|
|
7507
|
+
formatter: tableFieldItemFormatter,
|
|
7229
7508
|
resolvers: { table: tableIdResolver, fields: tableFieldsResolver },
|
|
7230
7509
|
handler: async ({ sdk: sdk2, options }) => {
|
|
7231
7510
|
const tableId = "table" in options ? options.table : options.tableId;
|
|
@@ -7304,21 +7583,13 @@ var RecordApiItemSchema = z.object({
|
|
|
7304
7583
|
is_source_record: z.boolean().nullable().optional(),
|
|
7305
7584
|
deleted_at: z.string().nullable().optional()
|
|
7306
7585
|
});
|
|
7307
|
-
var
|
|
7586
|
+
var RecordItemSchema = z.object({
|
|
7308
7587
|
id: z.string(),
|
|
7309
7588
|
data: z.record(z.string(), z.unknown()),
|
|
7310
7589
|
created_at: z.string(),
|
|
7311
7590
|
edited_at: z.string(),
|
|
7312
7591
|
deleted_at: z.string().nullable().optional()
|
|
7313
7592
|
});
|
|
7314
|
-
var RecordItemSchema = withFormatter(RecordItemSchemaBase, {
|
|
7315
|
-
format: (item) => ({
|
|
7316
|
-
title: `Record ${item.id}`,
|
|
7317
|
-
id: item.id,
|
|
7318
|
-
data: item.data,
|
|
7319
|
-
details: []
|
|
7320
|
-
})
|
|
7321
|
-
});
|
|
7322
7593
|
var GetTableRecordApiResponseSchema = z.object({
|
|
7323
7594
|
data: RecordApiItemSchema
|
|
7324
7595
|
});
|
|
@@ -7342,9 +7613,9 @@ var tableRecordFormatter = {
|
|
|
7342
7613
|
if (context) return context;
|
|
7343
7614
|
const hasFieldIds = Object.keys(item.data).some(isFieldId);
|
|
7344
7615
|
if (!hasFieldIds) return {};
|
|
7345
|
-
const
|
|
7346
|
-
|
|
7347
|
-
});
|
|
7616
|
+
const table = params.table ?? params.tableId;
|
|
7617
|
+
if (!table) return {};
|
|
7618
|
+
const { data: fields } = await sdk.listTableFields({ table });
|
|
7348
7619
|
return Object.fromEntries(fields.map((f) => [f.id, f.name]));
|
|
7349
7620
|
},
|
|
7350
7621
|
format: (item, fieldLabels) => ({
|
|
@@ -7469,10 +7740,7 @@ var listTableRecordsPlugin = definePlugin(
|
|
|
7469
7740
|
sort: tableSortResolver
|
|
7470
7741
|
},
|
|
7471
7742
|
formatter: tableRecordFormatter,
|
|
7472
|
-
handler: async ({
|
|
7473
|
-
sdk: sdk2,
|
|
7474
|
-
options
|
|
7475
|
-
}) => {
|
|
7743
|
+
handler: async ({ sdk: sdk2, options }) => {
|
|
7476
7744
|
const { api } = sdk2.context;
|
|
7477
7745
|
const tableId = "table" in options ? options.table : options.tableId;
|
|
7478
7746
|
const translator = await createFieldKeyTranslator({
|
|
@@ -7750,11 +8018,12 @@ var requestPlugin = definePlugin(
|
|
|
7750
8018
|
(sdk) => createPluginMethod(sdk, {
|
|
7751
8019
|
name: "request",
|
|
7752
8020
|
packages: ["cli", "mcp"],
|
|
7753
|
-
categories: ["http"
|
|
8021
|
+
categories: ["http"],
|
|
8022
|
+
deprecation: { message: "Use fetch() instead." },
|
|
7754
8023
|
returnType: "Response",
|
|
7755
8024
|
inputSchema: RelayRequestSchema,
|
|
7756
8025
|
handler: async ({ sdk: sdk2, options }) => {
|
|
7757
|
-
|
|
8026
|
+
logDeprecation2("request() is deprecated. Use fetch() instead.");
|
|
7758
8027
|
const {
|
|
7759
8028
|
url,
|
|
7760
8029
|
method,
|
|
@@ -7974,7 +8243,7 @@ async function listAppsForSlugsPage({
|
|
|
7974
8243
|
data: implementationsEnvelope.results.map(
|
|
7975
8244
|
normalizeImplementationMetaToAppItem
|
|
7976
8245
|
),
|
|
7977
|
-
nextCursor:
|
|
8246
|
+
nextCursor: implementationsEnvelope.next ? extractCursorFromUrl(implementationsEnvelope.next) : void 0
|
|
7978
8247
|
};
|
|
7979
8248
|
}
|
|
7980
8249
|
function findManifestEntry({
|
|
@@ -8395,7 +8664,7 @@ function createConsoleTransport() {
|
|
|
8395
8664
|
return {
|
|
8396
8665
|
async emit(subject, event) {
|
|
8397
8666
|
try {
|
|
8398
|
-
console.
|
|
8667
|
+
console.error(
|
|
8399
8668
|
"[SDK Telemetry]",
|
|
8400
8669
|
JSON.stringify({ subject, properties: event }, null, 2)
|
|
8401
8670
|
);
|
|
@@ -8604,6 +8873,35 @@ function buildMethodCalledEvent(data, context = {}) {
|
|
|
8604
8873
|
};
|
|
8605
8874
|
}
|
|
8606
8875
|
|
|
8876
|
+
// src/plugins/eventEmission/event-emission-hook.ts
|
|
8877
|
+
function computeArgumentCount(args) {
|
|
8878
|
+
if (args.length === 1) {
|
|
8879
|
+
const arg0 = args[0];
|
|
8880
|
+
if (arg0 !== null && typeof arg0 === "object" && !Array.isArray(arg0) && Object.getPrototypeOf(arg0) === Object.prototype) {
|
|
8881
|
+
return Object.keys(arg0).length;
|
|
8882
|
+
}
|
|
8883
|
+
}
|
|
8884
|
+
return args.filter((a) => a !== void 0).length;
|
|
8885
|
+
}
|
|
8886
|
+
function makeMethodEndHook(emitMethodCalled) {
|
|
8887
|
+
return ({ methodName, args, isPaginated, depth, durationMs, error }) => {
|
|
8888
|
+
if (depth > 0) return;
|
|
8889
|
+
const metadata = getMethodMetadata();
|
|
8890
|
+
emitMethodCalled({
|
|
8891
|
+
method_name: methodName,
|
|
8892
|
+
execution_duration_ms: durationMs,
|
|
8893
|
+
success_flag: !error,
|
|
8894
|
+
error_message: error?.message ?? null,
|
|
8895
|
+
error_type: error?.constructor.name ?? null,
|
|
8896
|
+
argument_count: computeArgumentCount(args),
|
|
8897
|
+
is_paginated: isPaginated,
|
|
8898
|
+
selected_api: metadata?.selectedApi ?? null,
|
|
8899
|
+
operation_type: metadata?.operationType ?? null,
|
|
8900
|
+
operation_key: metadata?.operationKey ?? null
|
|
8901
|
+
});
|
|
8902
|
+
};
|
|
8903
|
+
}
|
|
8904
|
+
|
|
8607
8905
|
// src/plugins/eventEmission/index.ts
|
|
8608
8906
|
var TELEMETRY_EMIT_TIMEOUT_MS = 300;
|
|
8609
8907
|
var registeredListeners = {};
|
|
@@ -8734,6 +9032,8 @@ var eventEmissionPlugin = definePlugin(
|
|
|
8734
9032
|
}
|
|
8735
9033
|
}
|
|
8736
9034
|
if (!config.enabled) {
|
|
9035
|
+
const noopEmitMethodCalled = () => {
|
|
9036
|
+
};
|
|
8737
9037
|
return {
|
|
8738
9038
|
context: {
|
|
8739
9039
|
eventEmission: {
|
|
@@ -8751,12 +9051,13 @@ var eventEmissionPlugin = definePlugin(
|
|
|
8751
9051
|
visitor_id: null,
|
|
8752
9052
|
correlation_id: null
|
|
8753
9053
|
}),
|
|
8754
|
-
emitMethodCalled: () => {
|
|
8755
|
-
},
|
|
8756
9054
|
flush: async () => {
|
|
8757
9055
|
},
|
|
8758
9056
|
close: async () => {
|
|
8759
9057
|
}
|
|
9058
|
+
},
|
|
9059
|
+
hooks: {
|
|
9060
|
+
onMethodEnd: makeMethodEndHook(noopEmitMethodCalled)
|
|
8760
9061
|
}
|
|
8761
9062
|
}
|
|
8762
9063
|
};
|
|
@@ -8927,6 +9228,20 @@ var eventEmissionPlugin = definePlugin(
|
|
|
8927
9228
|
);
|
|
8928
9229
|
removeExistingListeners();
|
|
8929
9230
|
};
|
|
9231
|
+
const emitMethodCalled = (data) => {
|
|
9232
|
+
const event = {
|
|
9233
|
+
...buildMethodCalledEvent(data),
|
|
9234
|
+
call_context: config.callContext ?? "sdk"
|
|
9235
|
+
};
|
|
9236
|
+
trackEmission(
|
|
9237
|
+
silentEmit(
|
|
9238
|
+
transport,
|
|
9239
|
+
METHOD_CALLED_EVENT_SUBJECT,
|
|
9240
|
+
event,
|
|
9241
|
+
getUserContext
|
|
9242
|
+
)
|
|
9243
|
+
);
|
|
9244
|
+
};
|
|
8930
9245
|
return {
|
|
8931
9246
|
context: {
|
|
8932
9247
|
eventEmission: {
|
|
@@ -8938,22 +9253,11 @@ var eventEmissionPlugin = definePlugin(
|
|
|
8938
9253
|
);
|
|
8939
9254
|
},
|
|
8940
9255
|
createBaseEvent: createBaseEventHelper,
|
|
8941
|
-
emitMethodCalled: (data) => {
|
|
8942
|
-
const event = {
|
|
8943
|
-
...buildMethodCalledEvent(data),
|
|
8944
|
-
call_context: config.callContext ?? "sdk"
|
|
8945
|
-
};
|
|
8946
|
-
trackEmission(
|
|
8947
|
-
silentEmit(
|
|
8948
|
-
transport,
|
|
8949
|
-
METHOD_CALLED_EVENT_SUBJECT,
|
|
8950
|
-
event,
|
|
8951
|
-
getUserContext
|
|
8952
|
-
)
|
|
8953
|
-
);
|
|
8954
|
-
},
|
|
8955
9256
|
flush,
|
|
8956
9257
|
close
|
|
9258
|
+
},
|
|
9259
|
+
hooks: {
|
|
9260
|
+
onMethodEnd: makeMethodEndHook(emitMethodCalled)
|
|
8957
9261
|
}
|
|
8958
9262
|
}
|
|
8959
9263
|
};
|
|
@@ -8965,78 +9269,22 @@ function createOptionsPlugin(options) {
|
|
|
8965
9269
|
return () => ({ context: { options } });
|
|
8966
9270
|
}
|
|
8967
9271
|
function createSdk() {
|
|
8968
|
-
|
|
8969
|
-
|
|
8970
|
-
|
|
8971
|
-
|
|
8972
|
-
const registryCache = /* @__PURE__ */ new Map();
|
|
8973
|
-
const sdk = {
|
|
8974
|
-
...properties,
|
|
8975
|
-
get context() {
|
|
8976
|
-
return frozenContext;
|
|
8977
|
-
},
|
|
8978
|
-
getContext: () => frozenContext,
|
|
8979
|
-
// runtime compat shim, not in types
|
|
8980
|
-
getRegistry(options) {
|
|
8981
|
-
const cacheKey = options?.package ?? "__all__";
|
|
8982
|
-
if (!registryCache.has(cacheKey)) {
|
|
8983
|
-
registryCache.set(
|
|
8984
|
-
cacheKey,
|
|
8985
|
-
buildRegistry({
|
|
8986
|
-
sdk,
|
|
8987
|
-
meta: frozenContext.meta,
|
|
8988
|
-
packageFilter: options?.package
|
|
8989
|
-
})
|
|
8990
|
-
);
|
|
8991
|
-
}
|
|
8992
|
-
return registryCache.get(cacheKey);
|
|
8993
|
-
},
|
|
8994
|
-
addPlugin(plugin, options) {
|
|
8995
|
-
const pluginResult = plugin({
|
|
8996
|
-
...properties,
|
|
8997
|
-
context: frozenContext
|
|
8998
|
-
});
|
|
8999
|
-
const { context: pluginContext, ...pluginProperties } = pluginResult;
|
|
9000
|
-
const { meta: pluginMeta, ...pluginContextRest } = pluginContext ?? {};
|
|
9001
|
-
const existingProperties = properties;
|
|
9002
|
-
const existingContext = context;
|
|
9003
|
-
const existingMeta = context.meta ?? {};
|
|
9004
|
-
const collisions = [];
|
|
9005
|
-
for (const key of Object.keys(pluginProperties)) {
|
|
9006
|
-
if (key in existingProperties) collisions.push(`method "${key}"`);
|
|
9007
|
-
}
|
|
9008
|
-
for (const key of Object.keys(pluginContextRest)) {
|
|
9009
|
-
if (key in existingContext) collisions.push(`context.${key}`);
|
|
9010
|
-
}
|
|
9011
|
-
if (collisions.length > 0 && !options?.override) {
|
|
9012
|
-
const name = plugin.name || "anonymous plugin";
|
|
9013
|
-
console.warn(
|
|
9014
|
-
`[zapier-sdk] Skipping "${name}" \u2014 duplicate registration of: ${collisions.join(", ")}. If the duplicate is intentional, pass { override: true } to addPlugin or wrap with composePlugins(...). Otherwise rename the method or remove the duplicate.`
|
|
9015
|
-
);
|
|
9016
|
-
return buildSdk(properties, context);
|
|
9017
|
-
}
|
|
9018
|
-
const mergedProperties = { ...properties, ...pluginProperties };
|
|
9019
|
-
const mergedContext = {
|
|
9020
|
-
...context,
|
|
9021
|
-
...pluginContextRest,
|
|
9022
|
-
meta: { ...existingMeta, ...pluginMeta ?? {} }
|
|
9023
|
-
};
|
|
9024
|
-
return buildSdk(
|
|
9025
|
-
mergedProperties,
|
|
9026
|
-
mergedContext
|
|
9027
|
-
);
|
|
9028
|
-
}
|
|
9029
|
-
};
|
|
9030
|
-
return sdk;
|
|
9272
|
+
logDeprecation2(
|
|
9273
|
+
"createSdk() is deprecated. Build SDKs with createPluginStack().use(...).toSdk() instead. The chain pattern shares plugin closures (and their state) across derived SDKs in ways that are rarely what callers expect; stacks produce fresh closures per .toSdk() call."
|
|
9274
|
+
);
|
|
9275
|
+
return withDeprecatedAddPlugin(createZapierCoreStack().toSdk());
|
|
9031
9276
|
}
|
|
9032
9277
|
function createZapierSdkWithoutRegistry(options = {}) {
|
|
9033
|
-
|
|
9278
|
+
logDeprecation2(
|
|
9034
9279
|
"createZapierSdkWithoutRegistry is deprecated; use createZapierSdk instead. getRegistry is now available on every sdk."
|
|
9035
9280
|
);
|
|
9036
9281
|
return createZapierSdk(options);
|
|
9037
9282
|
}
|
|
9283
|
+
function createZapierSdkStack(options = {}) {
|
|
9284
|
+
return createZapierCoreStack().use(createOptionsPlugin(options)).use(eventEmissionPlugin).use(apiPlugin).use(manifestPlugin).use(capabilitiesPlugin).use(connectionsPlugin).use(listAppsPlugin).use(getAppPlugin).use(listConnectionsPlugin).use(getConnectionPlugin).use(findFirstConnectionPlugin).use(findUniqueConnectionPlugin).use(listActionsPlugin).use(getActionPlugin).use(listActionInputFieldsPlugin).use(getActionInputFieldsSchemaPlugin).use(listActionInputFieldChoicesPlugin).use(listInputFieldsDeprecatedPlugin).use(getInputFieldsSchemaDeprecatedPlugin).use(listInputFieldChoicesDeprecatedPlugin).use(runActionPlugin).use(listAuthenticationsPlugin).use(getAuthenticationPlugin).use(findFirstAuthenticationPlugin).use(findUniqueAuthenticationPlugin).use(listClientCredentialsPlugin).use(createClientCredentialsPlugin).use(deleteClientCredentialsPlugin).use(fetchPlugin).use(requestPlugin).use(listTablesPlugin).use(getTablePlugin).use(deleteTablePlugin).use(createTablePlugin).use(listTableFieldsPlugin).use(createTableFieldsPlugin).use(deleteTableFieldsPlugin).use(listTableRecordsPlugin).use(getTableRecordPlugin).use(createTableRecordsPlugin).use(deleteTableRecordsPlugin).use(updateTableRecordsPlugin).use(appsPlugin).use(getProfilePlugin);
|
|
9285
|
+
}
|
|
9038
9286
|
function createZapierSdk(options = {}) {
|
|
9039
|
-
return
|
|
9287
|
+
return withDeprecatedAddPlugin(createZapierSdkStack(options).toSdk());
|
|
9040
9288
|
}
|
|
9041
9289
|
var TriggerInboxStatusSchema = z.union([
|
|
9042
9290
|
z.enum([
|
|
@@ -9068,7 +9316,7 @@ var TriggerSubscriptionApiSchema = z.object({
|
|
|
9068
9316
|
action_key: z.string(),
|
|
9069
9317
|
inputs: z.record(z.string(), z.unknown())
|
|
9070
9318
|
});
|
|
9071
|
-
var
|
|
9319
|
+
var TriggerInboxItemSchema = z.object({
|
|
9072
9320
|
id: z.string(),
|
|
9073
9321
|
created_at: z.string(),
|
|
9074
9322
|
name: z.string().nullable(),
|
|
@@ -9077,40 +9325,6 @@ var TriggerInboxItemSchemaBase = z.object({
|
|
|
9077
9325
|
notification_url: z.string().nullable(),
|
|
9078
9326
|
subscription: TriggerSubscriptionApiSchema
|
|
9079
9327
|
});
|
|
9080
|
-
var TriggerInboxItemSchema = withFormatter(
|
|
9081
|
-
TriggerInboxItemSchemaBase,
|
|
9082
|
-
{
|
|
9083
|
-
format: (item) => {
|
|
9084
|
-
const details = [
|
|
9085
|
-
{
|
|
9086
|
-
text: `Status: ${item.status}`,
|
|
9087
|
-
style: item.status === "active" ? "accent" : "dim"
|
|
9088
|
-
},
|
|
9089
|
-
{
|
|
9090
|
-
text: `Subscription: ${item.subscription.app_key} / ${item.subscription.action_key}`,
|
|
9091
|
-
style: "dim"
|
|
9092
|
-
}
|
|
9093
|
-
];
|
|
9094
|
-
if (item.paused_reason) {
|
|
9095
|
-
details.push({
|
|
9096
|
-
text: `Paused reason: ${item.paused_reason}`,
|
|
9097
|
-
style: "warning"
|
|
9098
|
-
});
|
|
9099
|
-
}
|
|
9100
|
-
if (item.notification_url) {
|
|
9101
|
-
details.push({
|
|
9102
|
-
text: `Notify: ${item.notification_url}`,
|
|
9103
|
-
style: "dim"
|
|
9104
|
-
});
|
|
9105
|
-
}
|
|
9106
|
-
return {
|
|
9107
|
-
title: item.name ?? `Trigger Inbox ${item.id}`,
|
|
9108
|
-
id: item.id,
|
|
9109
|
-
details
|
|
9110
|
-
};
|
|
9111
|
-
}
|
|
9112
|
-
}
|
|
9113
|
-
);
|
|
9114
9328
|
|
|
9115
9329
|
// src/plugins/triggers/createTriggerInbox/schemas.ts
|
|
9116
9330
|
var CreateTriggerInboxDescription = "Create a new trigger inbox subscription. Always creates a new inbox; use ensureTriggerInbox for get-or-create on a stable name.";
|
|
@@ -9129,6 +9343,39 @@ var CreateTriggerInboxSchema = z.object({
|
|
|
9129
9343
|
notificationUrl: z.string().url().optional().describe("Webhook URL to POST to when new messages arrive")
|
|
9130
9344
|
}).describe(CreateTriggerInboxDescription);
|
|
9131
9345
|
|
|
9346
|
+
// src/formatters/triggerInbox.ts
|
|
9347
|
+
var triggerInboxItemFormatter = {
|
|
9348
|
+
format: (item) => {
|
|
9349
|
+
const details = [
|
|
9350
|
+
{
|
|
9351
|
+
text: `Status: ${item.status}`,
|
|
9352
|
+
style: item.status === "active" ? "accent" : "dim"
|
|
9353
|
+
},
|
|
9354
|
+
{
|
|
9355
|
+
text: `Subscription: ${item.subscription.app_key} / ${item.subscription.action_key}`,
|
|
9356
|
+
style: "dim"
|
|
9357
|
+
}
|
|
9358
|
+
];
|
|
9359
|
+
if (item.paused_reason) {
|
|
9360
|
+
details.push({
|
|
9361
|
+
text: `Paused reason: ${item.paused_reason}`,
|
|
9362
|
+
style: "warning"
|
|
9363
|
+
});
|
|
9364
|
+
}
|
|
9365
|
+
if (item.notification_url) {
|
|
9366
|
+
details.push({
|
|
9367
|
+
text: `Notify: ${item.notification_url}`,
|
|
9368
|
+
style: "dim"
|
|
9369
|
+
});
|
|
9370
|
+
}
|
|
9371
|
+
return {
|
|
9372
|
+
title: item.name ?? `Trigger Inbox ${item.id}`,
|
|
9373
|
+
id: item.id,
|
|
9374
|
+
details
|
|
9375
|
+
};
|
|
9376
|
+
}
|
|
9377
|
+
};
|
|
9378
|
+
|
|
9132
9379
|
// src/plugins/triggers/shared.ts
|
|
9133
9380
|
var triggersDefaults = {
|
|
9134
9381
|
categories: ["trigger"],
|
|
@@ -9177,6 +9424,7 @@ var createTriggerInboxPlugin = definePlugin(
|
|
|
9177
9424
|
itemType: "TriggerInbox",
|
|
9178
9425
|
inputSchema: CreateTriggerInboxSchema,
|
|
9179
9426
|
outputSchema: TriggerInboxItemSchema,
|
|
9427
|
+
formatter: triggerInboxItemFormatter,
|
|
9180
9428
|
// actionKeyResolver and inputsResolver depend on actionType, which is
|
|
9181
9429
|
// always "read" for triggers. Pin it as a constant resolver so it's
|
|
9182
9430
|
// seeded into resolvedParams without polluting the user-facing schema
|
|
@@ -9270,6 +9518,7 @@ var ensureTriggerInboxPlugin = definePlugin(
|
|
|
9270
9518
|
itemType: "TriggerInbox",
|
|
9271
9519
|
inputSchema: EnsureTriggerInboxSchema,
|
|
9272
9520
|
outputSchema: TriggerInboxItemSchema,
|
|
9521
|
+
formatter: triggerInboxItemFormatter,
|
|
9273
9522
|
// actionKeyResolver and inputsResolver depend on actionType, which is
|
|
9274
9523
|
// always "read" for triggers. Pin it as a constant resolver so it's
|
|
9275
9524
|
// seeded into resolvedParams without polluting the user-facing schema.
|
|
@@ -9354,24 +9603,16 @@ var ListTriggerInboxesApiResponseSchema = z.object({
|
|
|
9354
9603
|
});
|
|
9355
9604
|
|
|
9356
9605
|
// src/plugins/triggers/listTriggerInboxes/index.ts
|
|
9357
|
-
function extractNextOffset(next) {
|
|
9358
|
-
if (!next) return void 0;
|
|
9359
|
-
try {
|
|
9360
|
-
const url = new URL(next);
|
|
9361
|
-
const offset = url.searchParams.get("offset");
|
|
9362
|
-
return offset || void 0;
|
|
9363
|
-
} catch {
|
|
9364
|
-
return void 0;
|
|
9365
|
-
}
|
|
9366
|
-
}
|
|
9367
9606
|
var listTriggerInboxesPlugin = definePlugin(
|
|
9368
9607
|
(sdk) => createPaginatedPluginMethod(sdk, {
|
|
9369
9608
|
...triggersDefaults,
|
|
9609
|
+
...zapierPagination,
|
|
9370
9610
|
name: "listTriggerInboxes",
|
|
9371
9611
|
type: "list",
|
|
9372
9612
|
itemType: "TriggerInbox",
|
|
9373
9613
|
inputSchema: ListTriggerInboxesSchema,
|
|
9374
9614
|
outputSchema: TriggerInboxItemSchema,
|
|
9615
|
+
formatter: triggerInboxItemFormatter,
|
|
9375
9616
|
defaultPageSize: DEFAULT_PAGE_SIZE,
|
|
9376
9617
|
handler: async ({ sdk: sdk2, options }) => {
|
|
9377
9618
|
const { api } = sdk2.context;
|
|
@@ -9397,8 +9638,7 @@ var listTriggerInboxesPlugin = definePlugin(
|
|
|
9397
9638
|
data: response.results,
|
|
9398
9639
|
next: response.next ?? null
|
|
9399
9640
|
};
|
|
9400
|
-
}
|
|
9401
|
-
extractCursor: (response) => extractNextOffset(response.next)
|
|
9641
|
+
}
|
|
9402
9642
|
})
|
|
9403
9643
|
);
|
|
9404
9644
|
var GetTriggerInboxSchema = z.object({
|
|
@@ -9414,6 +9654,7 @@ var getTriggerInboxPlugin = definePlugin(
|
|
|
9414
9654
|
itemType: "TriggerInbox",
|
|
9415
9655
|
inputSchema: GetTriggerInboxSchema,
|
|
9416
9656
|
outputSchema: TriggerInboxItemSchema,
|
|
9657
|
+
formatter: triggerInboxItemFormatter,
|
|
9417
9658
|
resolvers: { inbox: triggerInboxResolver },
|
|
9418
9659
|
handler: async ({ sdk: sdk2, options }) => {
|
|
9419
9660
|
const { inbox } = options;
|
|
@@ -9448,6 +9689,7 @@ var updateTriggerInboxPlugin = definePlugin(
|
|
|
9448
9689
|
itemType: "TriggerInbox",
|
|
9449
9690
|
inputSchema: UpdateTriggerInboxSchema,
|
|
9450
9691
|
outputSchema: TriggerInboxItemSchema,
|
|
9692
|
+
formatter: triggerInboxItemFormatter,
|
|
9451
9693
|
resolvers: { inbox: triggerInboxResolver },
|
|
9452
9694
|
handler: async ({ sdk: sdk2, options }) => {
|
|
9453
9695
|
const { inbox, notificationUrl } = options;
|
|
@@ -9484,6 +9726,7 @@ var deleteTriggerInboxPlugin = definePlugin(
|
|
|
9484
9726
|
itemType: "TriggerInbox",
|
|
9485
9727
|
inputSchema: DeleteTriggerInboxSchema,
|
|
9486
9728
|
outputSchema: TriggerInboxItemSchema,
|
|
9729
|
+
formatter: triggerInboxItemFormatter,
|
|
9487
9730
|
resolvers: { inbox: triggerInboxResolver },
|
|
9488
9731
|
confirm: "delete",
|
|
9489
9732
|
handler: async ({ sdk: sdk2, options }) => {
|
|
@@ -9517,6 +9760,7 @@ var pauseTriggerInboxPlugin = definePlugin(
|
|
|
9517
9760
|
itemType: "TriggerInbox",
|
|
9518
9761
|
inputSchema: PauseTriggerInboxSchema,
|
|
9519
9762
|
outputSchema: TriggerInboxItemSchema,
|
|
9763
|
+
formatter: triggerInboxItemFormatter,
|
|
9520
9764
|
resolvers: { inbox: triggerInboxResolver },
|
|
9521
9765
|
handler: async ({ sdk: sdk2, options }) => {
|
|
9522
9766
|
const { inbox } = options;
|
|
@@ -9549,6 +9793,7 @@ var resumeTriggerInboxPlugin = definePlugin(
|
|
|
9549
9793
|
itemType: "TriggerInbox",
|
|
9550
9794
|
inputSchema: ResumeTriggerInboxSchema,
|
|
9551
9795
|
outputSchema: TriggerInboxItemSchema,
|
|
9796
|
+
formatter: triggerInboxItemFormatter,
|
|
9552
9797
|
resolvers: { inbox: triggerInboxResolver },
|
|
9553
9798
|
handler: async ({ sdk: sdk2, options }) => {
|
|
9554
9799
|
const { inbox } = options;
|
|
@@ -9574,78 +9819,15 @@ var TriggerMessageAttributesSchema = z.object({
|
|
|
9574
9819
|
error_message: z.string().nullable(),
|
|
9575
9820
|
possible_duplicate_data: z.boolean()
|
|
9576
9821
|
});
|
|
9577
|
-
var
|
|
9822
|
+
var TriggerMessageItemSchema = z.object({
|
|
9578
9823
|
id: z.string(),
|
|
9579
9824
|
created_at: z.string(),
|
|
9580
9825
|
status: TriggerMessageStatusSchema,
|
|
9581
9826
|
message_attributes: TriggerMessageAttributesSchema
|
|
9582
9827
|
});
|
|
9583
|
-
var
|
|
9584
|
-
TriggerMessageItemSchemaBase,
|
|
9585
|
-
{
|
|
9586
|
-
format: (item) => {
|
|
9587
|
-
const details = [
|
|
9588
|
-
{ text: `Status: ${item.status}`, style: "dim" },
|
|
9589
|
-
{
|
|
9590
|
-
text: `Lease count: ${item.message_attributes.lease_count}`,
|
|
9591
|
-
style: "dim"
|
|
9592
|
-
}
|
|
9593
|
-
];
|
|
9594
|
-
if (item.message_attributes.error_message) {
|
|
9595
|
-
details.push({
|
|
9596
|
-
text: `Error: ${item.message_attributes.error_message}`,
|
|
9597
|
-
style: "warning"
|
|
9598
|
-
});
|
|
9599
|
-
}
|
|
9600
|
-
if (item.message_attributes.possible_duplicate_data) {
|
|
9601
|
-
details.push({
|
|
9602
|
-
text: "Possible duplicate data",
|
|
9603
|
-
style: "warning"
|
|
9604
|
-
});
|
|
9605
|
-
}
|
|
9606
|
-
return {
|
|
9607
|
-
title: `Message ${item.id}`,
|
|
9608
|
-
id: item.id,
|
|
9609
|
-
details
|
|
9610
|
-
};
|
|
9611
|
-
}
|
|
9612
|
-
}
|
|
9613
|
-
);
|
|
9614
|
-
var LeasedTriggerMessageItemSchemaBase = TriggerMessageItemSchemaBase.extend({
|
|
9828
|
+
var LeasedTriggerMessageItemSchema = TriggerMessageItemSchema.extend({
|
|
9615
9829
|
payload: z.record(z.string(), z.unknown())
|
|
9616
9830
|
});
|
|
9617
|
-
var LeasedTriggerMessageItemSchema = withFormatter(
|
|
9618
|
-
LeasedTriggerMessageItemSchemaBase,
|
|
9619
|
-
{
|
|
9620
|
-
format: (item) => {
|
|
9621
|
-
const details = [
|
|
9622
|
-
{ text: `Status: ${item.status}`, style: "dim" },
|
|
9623
|
-
{
|
|
9624
|
-
text: `Lease count: ${item.message_attributes.lease_count}`,
|
|
9625
|
-
style: "dim"
|
|
9626
|
-
}
|
|
9627
|
-
];
|
|
9628
|
-
if (item.message_attributes.error_message) {
|
|
9629
|
-
details.push({
|
|
9630
|
-
text: `Error: ${item.message_attributes.error_message}`,
|
|
9631
|
-
style: "warning"
|
|
9632
|
-
});
|
|
9633
|
-
}
|
|
9634
|
-
if (item.message_attributes.possible_duplicate_data) {
|
|
9635
|
-
details.push({
|
|
9636
|
-
text: "Possible duplicate data",
|
|
9637
|
-
style: "warning"
|
|
9638
|
-
});
|
|
9639
|
-
}
|
|
9640
|
-
return {
|
|
9641
|
-
title: `Message ${item.id}`,
|
|
9642
|
-
id: item.id,
|
|
9643
|
-
data: item.payload,
|
|
9644
|
-
details
|
|
9645
|
-
};
|
|
9646
|
-
}
|
|
9647
|
-
}
|
|
9648
|
-
);
|
|
9649
9831
|
|
|
9650
9832
|
// src/plugins/triggers/listTriggerInboxMessages/schemas.ts
|
|
9651
9833
|
var ListTriggerInboxMessagesSchema = z.object({
|
|
@@ -9660,24 +9842,45 @@ var ListTriggerInboxMessagesApiResponseSchema = z.object({
|
|
|
9660
9842
|
results: z.array(TriggerMessageItemSchema)
|
|
9661
9843
|
});
|
|
9662
9844
|
|
|
9663
|
-
// src/
|
|
9664
|
-
function
|
|
9665
|
-
|
|
9666
|
-
|
|
9667
|
-
|
|
9668
|
-
|
|
9669
|
-
|
|
9670
|
-
|
|
9845
|
+
// src/formatters/triggerMessage.ts
|
|
9846
|
+
function buildBaseDetails(item) {
|
|
9847
|
+
const details = [
|
|
9848
|
+
{ text: `Status: ${item.status}`, style: "dim" },
|
|
9849
|
+
{
|
|
9850
|
+
text: `Lease count: ${item.message_attributes.lease_count}`,
|
|
9851
|
+
style: "dim"
|
|
9852
|
+
}
|
|
9853
|
+
];
|
|
9854
|
+
if (item.message_attributes.error_message) {
|
|
9855
|
+
details.push({
|
|
9856
|
+
text: `Error: ${item.message_attributes.error_message}`,
|
|
9857
|
+
style: "warning"
|
|
9858
|
+
});
|
|
9859
|
+
}
|
|
9860
|
+
if (item.message_attributes.possible_duplicate_data) {
|
|
9861
|
+
details.push({ text: "Possible duplicate data", style: "warning" });
|
|
9671
9862
|
}
|
|
9863
|
+
return details;
|
|
9672
9864
|
}
|
|
9865
|
+
var triggerMessageItemFormatter = {
|
|
9866
|
+
format: (item) => ({
|
|
9867
|
+
title: `Message ${item.id}`,
|
|
9868
|
+
id: item.id,
|
|
9869
|
+
details: buildBaseDetails(item)
|
|
9870
|
+
})
|
|
9871
|
+
};
|
|
9872
|
+
|
|
9873
|
+
// src/plugins/triggers/listTriggerInboxMessages/index.ts
|
|
9673
9874
|
var listTriggerInboxMessagesPlugin = definePlugin(
|
|
9674
9875
|
(sdk) => createPaginatedPluginMethod(sdk, {
|
|
9675
9876
|
...triggersDefaults,
|
|
9877
|
+
...zapierPagination,
|
|
9676
9878
|
name: "listTriggerInboxMessages",
|
|
9677
9879
|
type: "list",
|
|
9678
9880
|
itemType: "TriggerMessage",
|
|
9679
9881
|
inputSchema: ListTriggerInboxMessagesSchema,
|
|
9680
9882
|
outputSchema: TriggerMessageItemSchema,
|
|
9883
|
+
formatter: triggerMessageItemFormatter,
|
|
9681
9884
|
defaultPageSize: DEFAULT_PAGE_SIZE,
|
|
9682
9885
|
resolvers: { inbox: triggerInboxResolver },
|
|
9683
9886
|
handler: async ({ sdk: sdk2, options }) => {
|
|
@@ -9702,8 +9905,7 @@ var listTriggerInboxMessagesPlugin = definePlugin(
|
|
|
9702
9905
|
data: response.results,
|
|
9703
9906
|
next: response.next ?? null
|
|
9704
9907
|
};
|
|
9705
|
-
}
|
|
9706
|
-
extractCursor: (response) => extractNextCursor(response.next)
|
|
9908
|
+
}
|
|
9707
9909
|
})
|
|
9708
9910
|
);
|
|
9709
9911
|
var LeaseTriggerInboxMessagesSchema = z.object({
|
|
@@ -10426,17 +10628,14 @@ var listTriggersPlugin = definePlugin(
|
|
|
10426
10628
|
itemType: "Action",
|
|
10427
10629
|
inputSchema: ListTriggersSchema,
|
|
10428
10630
|
outputSchema: ActionItemSchema,
|
|
10631
|
+
formatter: actionItemFormatter,
|
|
10429
10632
|
defaultPageSize: DEFAULT_PAGE_SIZE,
|
|
10430
10633
|
resolvers: { app: appKeyResolver },
|
|
10431
|
-
handler: async ({
|
|
10432
|
-
|
|
10433
|
-
options
|
|
10434
|
-
}) => {
|
|
10435
|
-
const result = await sdk2.listActions({
|
|
10634
|
+
handler: async ({ sdk: sdk2, options }) => {
|
|
10635
|
+
return await sdk2.listActions({
|
|
10436
10636
|
...options,
|
|
10437
10637
|
actionType: "read"
|
|
10438
10638
|
});
|
|
10439
|
-
return { data: result.data, nextCursor: result.nextCursor };
|
|
10440
10639
|
}
|
|
10441
10640
|
})
|
|
10442
10641
|
);
|
|
@@ -10463,6 +10662,7 @@ var listTriggerInputFieldsPlugin = definePlugin(
|
|
|
10463
10662
|
itemType: "RootField",
|
|
10464
10663
|
inputSchema: ListTriggerInputFieldsSchema,
|
|
10465
10664
|
outputSchema: RootFieldItemSchema,
|
|
10665
|
+
formatter: rootFieldItemFormatter,
|
|
10466
10666
|
defaultPageSize: DEFAULT_PAGE_SIZE,
|
|
10467
10667
|
// actionKeyResolver and inputsAllOptionalResolver depend on actionType.
|
|
10468
10668
|
// Pin it to "read" so they resolve correctly without the user setting it.
|
|
@@ -10473,15 +10673,11 @@ var listTriggerInputFieldsPlugin = definePlugin(
|
|
|
10473
10673
|
inputs: inputsAllOptionalResolver,
|
|
10474
10674
|
actionType: { type: "constant", value: "read" }
|
|
10475
10675
|
},
|
|
10476
|
-
handler: async ({
|
|
10477
|
-
|
|
10478
|
-
options
|
|
10479
|
-
}) => {
|
|
10480
|
-
const result = await sdk2.listActionInputFields({
|
|
10676
|
+
handler: async ({ sdk: sdk2, options }) => {
|
|
10677
|
+
return await sdk2.listActionInputFields({
|
|
10481
10678
|
...options,
|
|
10482
10679
|
actionType: "read"
|
|
10483
10680
|
});
|
|
10484
|
-
return { data: result.data, nextCursor: result.nextCursor };
|
|
10485
10681
|
}
|
|
10486
10682
|
})
|
|
10487
10683
|
);
|
|
@@ -10512,6 +10708,7 @@ var listTriggerInputFieldChoicesPlugin = definePlugin(
|
|
|
10512
10708
|
itemType: "InputFieldChoice",
|
|
10513
10709
|
inputSchema: ListTriggerInputFieldChoicesSchema,
|
|
10514
10710
|
outputSchema: InputFieldChoiceItemSchema,
|
|
10711
|
+
formatter: inputFieldChoiceItemFormatter,
|
|
10515
10712
|
defaultPageSize: DEFAULT_PAGE_SIZE,
|
|
10516
10713
|
resolvers: {
|
|
10517
10714
|
app: appKeyResolver,
|
|
@@ -10521,15 +10718,11 @@ var listTriggerInputFieldChoicesPlugin = definePlugin(
|
|
|
10521
10718
|
inputs: inputsAllOptionalResolver,
|
|
10522
10719
|
actionType: { type: "constant", value: "read" }
|
|
10523
10720
|
},
|
|
10524
|
-
handler: async ({
|
|
10525
|
-
|
|
10526
|
-
options
|
|
10527
|
-
}) => {
|
|
10528
|
-
const result = await sdk2.listActionInputFieldChoices({
|
|
10721
|
+
handler: async ({ sdk: sdk2, options }) => {
|
|
10722
|
+
return await sdk2.listActionInputFieldChoices({
|
|
10529
10723
|
...options,
|
|
10530
10724
|
actionType: "read"
|
|
10531
10725
|
});
|
|
10532
|
-
return { data: result.data, nextCursor: result.nextCursor };
|
|
10533
10726
|
}
|
|
10534
10727
|
})
|
|
10535
10728
|
);
|
|
@@ -10631,10 +10824,9 @@ var listWorkflowsPlugin = definePlugin(
|
|
|
10631
10824
|
const response = ListWorkflowsApiResponseSchema.parse(raw);
|
|
10632
10825
|
return {
|
|
10633
10826
|
data: response.workflows,
|
|
10634
|
-
|
|
10827
|
+
nextCursor: response.next_cursor ?? void 0
|
|
10635
10828
|
};
|
|
10636
|
-
}
|
|
10637
|
-
extractCursor: (response) => response.next ?? void 0
|
|
10829
|
+
}
|
|
10638
10830
|
})
|
|
10639
10831
|
);
|
|
10640
10832
|
var WorkflowVersionSchema = z.object({
|
|
@@ -11519,6 +11711,74 @@ var getTriggerRunPlugin = definePlugin(
|
|
|
11519
11711
|
}
|
|
11520
11712
|
})
|
|
11521
11713
|
);
|
|
11714
|
+
var TriggerWorkflowLookupResponseSchema = z.object({
|
|
11715
|
+
trigger_url: z.string()
|
|
11716
|
+
}).passthrough();
|
|
11717
|
+
var TriggerWorkflowOptionsSchema = z.object({
|
|
11718
|
+
workflow: z.string().uuid().describe("Durable workflow ID"),
|
|
11719
|
+
input: z.unknown().optional().describe(
|
|
11720
|
+
"JSON payload delivered as the trigger body. Sent as `application/json`; omit to fire with an empty body."
|
|
11721
|
+
)
|
|
11722
|
+
}).describe(
|
|
11723
|
+
"Look up a workflow's trigger URL and fire it manually. The trigger endpoint is tokenized (the URL contains a secret) and takes no auth header, so the SDK uses a raw fetch rather than the api plugin."
|
|
11724
|
+
);
|
|
11725
|
+
var TriggerWorkflowResponseSchema = z.object({
|
|
11726
|
+
workflow: z.string().describe("The workflow ID that was triggered"),
|
|
11727
|
+
status: z.number().int().describe("HTTP status returned by the trigger endpoint"),
|
|
11728
|
+
body: z.unknown().describe(
|
|
11729
|
+
"Response body from the trigger endpoint. Parsed as JSON when the response body parses, otherwise returned as the raw response text."
|
|
11730
|
+
)
|
|
11731
|
+
});
|
|
11732
|
+
|
|
11733
|
+
// src/plugins/codeSubstrate/triggerWorkflow/index.ts
|
|
11734
|
+
var triggerWorkflowPlugin = definePlugin(
|
|
11735
|
+
(sdk) => createPluginMethod(sdk, {
|
|
11736
|
+
...codeSubstrateDefaults,
|
|
11737
|
+
name: "triggerWorkflow",
|
|
11738
|
+
type: "create",
|
|
11739
|
+
itemType: "WorkflowRun",
|
|
11740
|
+
inputSchema: TriggerWorkflowOptionsSchema,
|
|
11741
|
+
outputSchema: TriggerWorkflowResponseSchema,
|
|
11742
|
+
resolvers: { workflow: workflowIdResolver },
|
|
11743
|
+
handler: async ({ sdk: sdk2, options }) => {
|
|
11744
|
+
const rawWorkflow = await sdk2.context.api.get(
|
|
11745
|
+
`/durableworkflowzaps/api/v0/workflows/${encodeURIComponent(options.workflow)}`,
|
|
11746
|
+
{
|
|
11747
|
+
authRequired: true,
|
|
11748
|
+
resource: { type: "workflow", id: options.workflow }
|
|
11749
|
+
}
|
|
11750
|
+
);
|
|
11751
|
+
const workflow = TriggerWorkflowLookupResponseSchema.parse(rawWorkflow);
|
|
11752
|
+
const fetch2 = sdk2.context.options.fetch ?? globalThis.fetch;
|
|
11753
|
+
const response = await fetch2(workflow.trigger_url, {
|
|
11754
|
+
method: "POST",
|
|
11755
|
+
headers: { "Content-Type": "application/json" },
|
|
11756
|
+
body: options.input === void 0 ? void 0 : JSON.stringify(options.input)
|
|
11757
|
+
});
|
|
11758
|
+
const text = await response.text().catch(() => "");
|
|
11759
|
+
let body = text;
|
|
11760
|
+
if (text) {
|
|
11761
|
+
try {
|
|
11762
|
+
body = JSON.parse(text);
|
|
11763
|
+
} catch {
|
|
11764
|
+
body = text;
|
|
11765
|
+
}
|
|
11766
|
+
}
|
|
11767
|
+
if (!response.ok) {
|
|
11768
|
+
throw new ZapierApiError(
|
|
11769
|
+
`Trigger failed: ${response.status} ${response.statusText}: ${text || "(empty body)"}`,
|
|
11770
|
+
{ statusCode: response.status, response: body }
|
|
11771
|
+
);
|
|
11772
|
+
}
|
|
11773
|
+
const data = {
|
|
11774
|
+
workflow: options.workflow,
|
|
11775
|
+
status: response.status,
|
|
11776
|
+
body
|
|
11777
|
+
};
|
|
11778
|
+
return { data };
|
|
11779
|
+
}
|
|
11780
|
+
})
|
|
11781
|
+
);
|
|
11522
11782
|
|
|
11523
11783
|
// src/utils/batch-utils.ts
|
|
11524
11784
|
var DEFAULT_CONCURRENCY = 10;
|
|
@@ -11670,15 +11930,18 @@ var BaseSdkOptionsSchema = z.object({
|
|
|
11670
11930
|
|
|
11671
11931
|
// src/plugins/registry/index.ts
|
|
11672
11932
|
var registryPlugin = definePlugin((_sdk) => {
|
|
11673
|
-
|
|
11933
|
+
logDeprecation2(
|
|
11674
11934
|
"registryPlugin is deprecated and a no-op; getRegistry is now built into every sdk. Remove .addPlugin(registryPlugin)."
|
|
11675
11935
|
);
|
|
11676
11936
|
return {};
|
|
11677
11937
|
});
|
|
11678
11938
|
|
|
11679
11939
|
// src/experimental.ts
|
|
11940
|
+
function createZapierSdkStack2(options = {}) {
|
|
11941
|
+
return createZapierCoreStack().use(createOptionsPlugin(options)).use(eventEmissionPlugin).use(apiPlugin).use(manifestPlugin).use(capabilitiesPlugin).use(connectionsPlugin).use(listAppsPlugin).use(getAppPlugin).use(listConnectionsPlugin).use(getConnectionPlugin).use(findFirstConnectionPlugin).use(findUniqueConnectionPlugin).use(listActionsPlugin).use(getActionPlugin).use(listActionInputFieldsPlugin).use(getActionInputFieldsSchemaPlugin).use(listActionInputFieldChoicesPlugin).use(listInputFieldsDeprecatedPlugin).use(getInputFieldsSchemaDeprecatedPlugin).use(listInputFieldChoicesDeprecatedPlugin).use(runActionPlugin).use(listAuthenticationsPlugin).use(getAuthenticationPlugin).use(findFirstAuthenticationPlugin).use(findUniqueAuthenticationPlugin).use(listClientCredentialsPlugin).use(createClientCredentialsPlugin).use(deleteClientCredentialsPlugin).use(fetchPlugin).use(requestPlugin).use(listTriggerInboxesPlugin).use(createTriggerInboxPlugin).use(ensureTriggerInboxPlugin).use(getTriggerInboxPlugin).use(updateTriggerInboxPlugin).use(deleteTriggerInboxPlugin).use(pauseTriggerInboxPlugin).use(resumeTriggerInboxPlugin).use(listTriggerInboxMessagesPlugin).use(leaseTriggerInboxMessagesPlugin).use(ackTriggerInboxMessagesPlugin).use(releaseTriggerInboxMessagesPlugin).use(drainTriggerInboxPlugin).use(watchTriggerInboxPlugin).use(listTriggersPlugin).use(listTriggerInputFieldsPlugin).use(listTriggerInputFieldChoicesPlugin).use(getTriggerInputFieldsSchemaPlugin).use(listTablesPlugin).use(getTablePlugin).use(deleteTablePlugin).use(createTablePlugin).use(listTableFieldsPlugin).use(createTableFieldsPlugin).use(deleteTableFieldsPlugin).use(listTableRecordsPlugin).use(getTableRecordPlugin).use(createTableRecordsPlugin).use(deleteTableRecordsPlugin).use(updateTableRecordsPlugin).use(listWorkflowsPlugin).use(getWorkflowPlugin).use(createWorkflowPlugin).use(updateWorkflowPlugin).use(enableWorkflowPlugin).use(disableWorkflowPlugin).use(deleteWorkflowPlugin).use(listDurableRunsPlugin).use(getDurableRunPlugin).use(runDurablePlugin).use(cancelDurableRunPlugin).use(publishWorkflowVersionPlugin).use(listWorkflowVersionsPlugin).use(getWorkflowVersionPlugin).use(listWorkflowRunsPlugin).use(getWorkflowRunPlugin).use(getTriggerRunPlugin).use(triggerWorkflowPlugin).use(appsPlugin).use(getProfilePlugin);
|
|
11942
|
+
}
|
|
11680
11943
|
function createZapierSdk2(options = {}) {
|
|
11681
|
-
return
|
|
11944
|
+
return withDeprecatedAddPlugin(createZapierSdkStack2(options).toSdk());
|
|
11682
11945
|
}
|
|
11683
11946
|
|
|
11684
|
-
export { ActionKeyPropertySchema, ActionPropertySchema, ActionTimeoutMsPropertySchema, ActionTypePropertySchema, AppKeyPropertySchema, AppPropertySchema, AppsPropertySchema, AuthenticationIdPropertySchema, BaseSdkOptionsSchema, CONTEXT_CACHE_MAX_SIZE, CONTEXT_CACHE_TTL_MS, ClientCredentialsObjectSchema, ConnectionEntrySchema, ConnectionIdPropertySchema, ConnectionPropertySchema, ConnectionsMapSchema, ConnectionsPropertySchema, CredentialsFunctionSchema, CredentialsObjectSchema, CredentialsSchema, DEFAULT_ACTION_TIMEOUT_MS, DEFAULT_APPROVAL_TIMEOUT_MS, DEFAULT_CONFIG_PATH, DEFAULT_MAX_APPROVAL_RETRIES, DEFAULT_PAGE_SIZE, DebugPropertySchema, FieldsPropertySchema, InputFieldPropertySchema, InputsPropertySchema, LeaseLimitPropertySchema, LeasePropertySchema, LeaseSecondsPropertySchema, LimitPropertySchema, MAX_CONCURRENCY_LIMIT, MAX_PAGE_LIMIT, OffsetPropertySchema, OutputPropertySchema, ParamsPropertySchema, PkceCredentialsObjectSchema, RecordPropertySchema, RecordsPropertySchema, RelayFetchSchema, RelayRequestSchema, ResolvedCredentialsSchema, TablePropertySchema, TablesPropertySchema, TriggerInboxNamePropertySchema, TriggerInboxPropertySchema, ZAPIER_BASE_URL, ZAPIER_MAX_CONCURRENT_REQUESTS, ZAPIER_MAX_NETWORK_RETRIES, ZAPIER_MAX_NETWORK_RETRY_DELAY_MS, ZapierAbortDrainSignal, ZapierActionError, ZapierApiError, ZapierAppNotFoundError, ZapierApprovalError, ZapierAuthenticationError, ZapierBundleError, ZapierConfigurationError, ZapierConflictError, ZapierError, ZapierNotFoundError, ZapierRateLimitError, ZapierRelayError, ZapierReleaseTriggerMessageSignal, ZapierResourceNotFoundError, ZapierSignal, ZapierTimeoutError, ZapierUnknownError, ZapierValidationError, actionKeyResolver, actionTypeResolver, apiPlugin, appKeyResolver, appsPlugin, connectionIdGenericResolver as authenticationIdGenericResolver, connectionIdResolver as authenticationIdResolver, batch, buildApplicationLifecycleEvent, buildCapabilityMessage, buildErrorEvent, buildErrorEventWithContext, buildMethodCalledEvent, cleanupEventListeners, clearTokenCache, clientCredentialsNameResolver, clientIdResolver, composePlugins, connectionIdGenericResolver, connectionIdResolver, connectionsPlugin, createBaseEvent, createClientCredentialsPlugin, createFunction, createMemoryCache, createOptionsPlugin, createPaginatedPluginMethod, createPluginMethod, createSdk, createTableFieldsPlugin, createTablePlugin, createTableRecordsPlugin, createZapierApi, createZapierSdk2 as createZapierSdk, createZapierSdkWithoutRegistry, definePlugin, deleteClientCredentialsPlugin, deleteTableFieldsPlugin, deleteTablePlugin, deleteTableRecordsPlugin, durableRunIdResolver, eventEmissionPlugin, fetchPlugin, findFirstConnectionPlugin, findManifestEntry, findUniqueConnectionPlugin, formatErrorMessage, generateEventId, getActionInputFieldsSchemaPlugin, getActionPlugin, getAppPlugin, getBaseUrlFromCredentials, getCiPlatform, getClientIdFromCredentials, getConnectionPlugin, getCpuTime, getCurrentTimestamp, getMemoryUsage, getOrCreateApiClient, getOsInfo, getPlatformVersions, getPreferredManifestEntryKey, getProfilePlugin, getReleaseId, getTablePlugin, getTableRecordPlugin, getTokenFromCliLogin, getZapierApprovalMode, getZapierDefaultApprovalMode, getZapierSdkService, injectCliLogin, inputFieldKeyResolver, inputsAllOptionalResolver, inputsResolver, invalidateCachedToken, invalidateCredentialsToken, isCi, isCliLoginAvailable, isClientCredentials, isCredentialsFunction, isCredentialsObject, isPkceCredentials, isPositional, listActionInputFieldChoicesPlugin, listActionInputFieldsPlugin, listActionsPlugin, listAppsPlugin, listClientCredentialsPlugin, listConnectionsPlugin, listTableFieldsPlugin, listTableRecordsPlugin, listTablesPlugin, logDeprecation, manifestPlugin, parseConcurrencyEnvVar, readManifestFromFile, registryPlugin, requestPlugin, resetDeprecationWarnings, resolveAuthToken, resolveCredentials, resolveCredentialsFromEnv, runActionPlugin, runWithTelemetryContext, tableFieldIdsResolver, tableFieldsResolver, tableFiltersResolver, tableIdResolver, tableNameResolver, tableRecordIdResolver, tableRecordIdsResolver, tableRecordsResolver, tableSortResolver, tableUpdateRecordsResolver, toSnakeCase, toTitleCase, triggerInboxResolver, triggerMessagesResolver, updateTableRecordsPlugin, workflowIdResolver, workflowRunIdResolver, workflowVersionIdResolver };
|
|
11947
|
+
export { ActionKeyPropertySchema, ActionPropertySchema, ActionTimeoutMsPropertySchema, ActionTypePropertySchema, AppKeyPropertySchema, AppPropertySchema, AppsPropertySchema, AuthenticationIdPropertySchema, BaseSdkOptionsSchema, CONTEXT_CACHE_MAX_SIZE, CONTEXT_CACHE_TTL_MS, CORE_ERROR_SYMBOL, ClientCredentialsObjectSchema, ConnectionEntrySchema, ConnectionIdPropertySchema, ConnectionPropertySchema, ConnectionsMapSchema, ConnectionsPropertySchema, CoreErrorCode, CredentialsFunctionSchema, CredentialsObjectSchema, CredentialsSchema, DEFAULT_ACTION_TIMEOUT_MS, DEFAULT_APPROVAL_TIMEOUT_MS, DEFAULT_CONFIG_PATH, DEFAULT_MAX_APPROVAL_RETRIES, DEFAULT_PAGE_SIZE, DebugPropertySchema, FieldsPropertySchema, InputFieldPropertySchema, InputsPropertySchema, LeaseLimitPropertySchema, LeasePropertySchema, LeaseSecondsPropertySchema, LimitPropertySchema, MAX_CONCURRENCY_LIMIT, MAX_PAGE_LIMIT, OffsetPropertySchema, OutputPropertySchema, ParamsPropertySchema, PkceCredentialsObjectSchema, RecordPropertySchema, RecordsPropertySchema, RelayFetchSchema, RelayRequestSchema, ResolvedCredentialsSchema, TablePropertySchema, TablesPropertySchema, TriggerInboxNamePropertySchema, TriggerInboxPropertySchema, ZAPIER_BASE_URL, ZAPIER_MAX_CONCURRENT_REQUESTS, ZAPIER_MAX_NETWORK_RETRIES, ZAPIER_MAX_NETWORK_RETRY_DELAY_MS, ZapierAbortDrainSignal, ZapierActionError, ZapierApiError, ZapierAppNotFoundError, ZapierApprovalError, ZapierAuthenticationError, ZapierBundleError, ZapierConfigurationError, ZapierConflictError, ZapierError, ZapierNotFoundError, ZapierRateLimitError, ZapierRelayError, ZapierReleaseTriggerMessageSignal, ZapierResourceNotFoundError, ZapierSignal, ZapierTimeoutError, ZapierUnknownError, ZapierValidationError, actionKeyResolver, actionTypeResolver, addPlugin, apiPlugin, appKeyResolver, appsPlugin, connectionIdGenericResolver as authenticationIdGenericResolver, connectionIdResolver as authenticationIdResolver, batch, buildApplicationLifecycleEvent, buildCapabilityMessage, buildErrorEvent, buildErrorEventWithContext, buildMethodCalledEvent, cleanupEventListeners, clearTokenCache, clientCredentialsNameResolver, clientIdResolver, composePlugins, connectionIdGenericResolver, connectionIdResolver, connectionsPlugin, createBaseEvent, createClientCredentialsPlugin, createCorePlugin, createFunction, createMemoryCache, createOptionsPlugin, createPaginatedPluginMethod, createPluginMethod, createPluginStack, createSdk, createTableFieldsPlugin, createTablePlugin, createTableRecordsPlugin, createZapierApi, createZapierCoreStack, createZapierSdk2 as createZapierSdk, createZapierSdkStack2 as createZapierSdkStack, createZapierSdkWithoutRegistry, definePlugin, deleteClientCredentialsPlugin, deleteTableFieldsPlugin, deleteTablePlugin, deleteTableRecordsPlugin, durableRunIdResolver, eventEmissionPlugin, fetchPlugin, findFirstConnectionPlugin, findManifestEntry, findUniqueConnectionPlugin, formatErrorMessage, generateEventId, getActionInputFieldsSchemaPlugin, getActionPlugin, getAppPlugin, getBaseUrlFromCredentials, getCiPlatform, getClientIdFromCredentials, getConnectionPlugin, getCoreErrorCause, getCoreErrorCode, getCpuTime, getCurrentTimestamp, getMemoryUsage, getOrCreateApiClient, getOsInfo, getPlatformVersions, getPreferredManifestEntryKey, getProfilePlugin, getReleaseId, getTablePlugin, getTableRecordPlugin, getTokenFromCliLogin, getZapierApprovalMode, getZapierDefaultApprovalMode, getZapierSdkService, injectCliLogin, inputFieldKeyResolver, inputsAllOptionalResolver, inputsResolver, invalidateCachedToken, invalidateCredentialsToken, isCi, isCliLoginAvailable, isClientCredentials, isCoreError, isCredentialsFunction, isCredentialsObject, isPkceCredentials, isPositional, listActionInputFieldChoicesPlugin, listActionInputFieldsPlugin, listActionsPlugin, listAppsPlugin, listClientCredentialsPlugin, listConnectionsPlugin, listTableFieldsPlugin, listTableRecordsPlugin, listTablesPlugin, logDeprecation2 as logDeprecation, manifestPlugin, parseConcurrencyEnvVar, readManifestFromFile, registryPlugin, requestPlugin, resetDeprecationWarnings2 as resetDeprecationWarnings, resolveAuthToken, resolveCredentials, resolveCredentialsFromEnv, runActionPlugin, runInMethodScope, runWithTelemetryContext, tableFieldIdsResolver, tableFieldsResolver, tableFiltersResolver, tableIdResolver, tableNameResolver, tableRecordIdResolver, tableRecordIdsResolver, tableRecordsResolver, tableSortResolver, tableUpdateRecordsResolver, toSnakeCase, toTitleCase, triggerInboxResolver, triggerMessagesResolver, updateTableRecordsPlugin, workflowIdResolver, workflowRunIdResolver, workflowVersionIdResolver, zapierAdaptError };
|