@zapier/zapier-sdk 0.65.0 → 0.67.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 +41 -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-Dh0b5NAY.d.mts} +13207 -7904
- package/dist/{index-JhNxS_mq.d.ts → index-Dh0b5NAY.d.ts} +13207 -7904
- 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/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/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
|
@@ -1,245 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Generic utility functions for creating paginated SDK functions
|
|
3
|
-
*/
|
|
4
|
-
import { ZapierError, ZapierUnknownError, ZapierAuthenticationError, } from "../types/errors";
|
|
5
|
-
import { paginate } from "./pagination-utils";
|
|
6
|
-
import { createValidator, validateOptions } from "./validation";
|
|
7
|
-
import { isTelemetryNested, runWithTelemetryContext, } from "./telemetry-context";
|
|
8
|
-
/**
|
|
9
|
-
* Helper function to extract cursor from pagination data
|
|
10
|
-
* Supports JSON:API style `links.next` URLs by extracting the `offset` parameter.
|
|
11
|
-
*/
|
|
12
|
-
export function extractCursor(data) {
|
|
13
|
-
if (!data?.next) {
|
|
14
|
-
return undefined;
|
|
15
|
-
}
|
|
16
|
-
try {
|
|
17
|
-
const urlObj = new URL(data.next);
|
|
18
|
-
const offset = urlObj.searchParams.get("offset");
|
|
19
|
-
return offset || undefined;
|
|
20
|
-
}
|
|
21
|
-
catch {
|
|
22
|
-
return undefined;
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
/**
|
|
26
|
-
* Helper function to convert unknown errors to SDK errors.
|
|
27
|
-
* Recognizes errors by name (e.g., from cli-login package which can't
|
|
28
|
-
* import SDK errors directly) and converts them to proper SDK errors.
|
|
29
|
-
*/
|
|
30
|
-
function normalizeError(error) {
|
|
31
|
-
if (error instanceof ZapierError) {
|
|
32
|
-
return error;
|
|
33
|
-
}
|
|
34
|
-
const message = error instanceof Error ? error.message : String(error);
|
|
35
|
-
const cause = error instanceof Error ? error : undefined;
|
|
36
|
-
// Check for known error names from packages that can't import SDK errors
|
|
37
|
-
if (error instanceof Error) {
|
|
38
|
-
if (error.name === "ZapierAuthenticationError") {
|
|
39
|
-
return new ZapierAuthenticationError(message, { cause });
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
return new ZapierUnknownError(message, { cause });
|
|
43
|
-
}
|
|
44
|
-
/**
|
|
45
|
-
* Higher-order function that creates a function from a core function
|
|
46
|
-
*
|
|
47
|
-
* @param coreFn - Function that returns T directly or throws errors
|
|
48
|
-
* @param schema - Optional Zod schema for validation
|
|
49
|
-
* @param telemetry - Optional telemetry callbacks
|
|
50
|
-
* @returns A function that normalizes and rethrows errors
|
|
51
|
-
*/
|
|
52
|
-
export function createFunction(coreFn, schema, telemetry) {
|
|
53
|
-
const functionName = coreFn.name;
|
|
54
|
-
// Create a named function using dynamic property access
|
|
55
|
-
const namedFunctions = {
|
|
56
|
-
[functionName]: async function (options) {
|
|
57
|
-
return runWithTelemetryContext(async () => {
|
|
58
|
-
const startTime = Date.now();
|
|
59
|
-
const normalizedOptions = (options ?? {});
|
|
60
|
-
const isNested = isTelemetryNested();
|
|
61
|
-
try {
|
|
62
|
-
if (schema) {
|
|
63
|
-
const validatedOptions = validateOptions(schema, normalizedOptions);
|
|
64
|
-
const result = await coreFn({
|
|
65
|
-
...normalizedOptions,
|
|
66
|
-
...validatedOptions,
|
|
67
|
-
});
|
|
68
|
-
if (!isNested && telemetry?.onMethodCalled) {
|
|
69
|
-
const argumentCount = Object.keys(normalizedOptions).length;
|
|
70
|
-
telemetry.onMethodCalled({
|
|
71
|
-
methodName: functionName,
|
|
72
|
-
durationMs: Date.now() - startTime,
|
|
73
|
-
success: true,
|
|
74
|
-
argumentCount,
|
|
75
|
-
isPaginated: false,
|
|
76
|
-
});
|
|
77
|
-
}
|
|
78
|
-
return result;
|
|
79
|
-
}
|
|
80
|
-
const result = await coreFn(normalizedOptions);
|
|
81
|
-
if (!isNested && telemetry?.onMethodCalled) {
|
|
82
|
-
const argumentCount = Object.keys(normalizedOptions).length;
|
|
83
|
-
telemetry.onMethodCalled({
|
|
84
|
-
methodName: functionName,
|
|
85
|
-
durationMs: Date.now() - startTime,
|
|
86
|
-
success: true,
|
|
87
|
-
argumentCount,
|
|
88
|
-
isPaginated: false,
|
|
89
|
-
});
|
|
90
|
-
}
|
|
91
|
-
return result;
|
|
92
|
-
}
|
|
93
|
-
catch (error) {
|
|
94
|
-
const normalizedError = normalizeError(error);
|
|
95
|
-
if (!isNested && telemetry?.onMethodCalled) {
|
|
96
|
-
const argumentCount = Object.keys(normalizedOptions).length;
|
|
97
|
-
telemetry.onMethodCalled({
|
|
98
|
-
methodName: functionName,
|
|
99
|
-
durationMs: Date.now() - startTime,
|
|
100
|
-
success: false,
|
|
101
|
-
error: normalizedError,
|
|
102
|
-
argumentCount,
|
|
103
|
-
isPaginated: false,
|
|
104
|
-
});
|
|
105
|
-
}
|
|
106
|
-
throw normalizedError;
|
|
107
|
-
}
|
|
108
|
-
});
|
|
109
|
-
},
|
|
110
|
-
};
|
|
111
|
-
return namedFunctions[functionName];
|
|
112
|
-
}
|
|
113
|
-
/**
|
|
114
|
-
* Higher-order function that creates a page function that wraps results in {data}
|
|
115
|
-
* Internal utility used by createPaginatedFunction
|
|
116
|
-
*/
|
|
117
|
-
function createPageFunction(coreFn) {
|
|
118
|
-
const functionName = coreFn.name + "Page";
|
|
119
|
-
// Create a named function using dynamic property access
|
|
120
|
-
const namedFunctions = {
|
|
121
|
-
[functionName]: async function (options) {
|
|
122
|
-
try {
|
|
123
|
-
const result = await coreFn(options);
|
|
124
|
-
// If result already has a data property, ensure it's an array
|
|
125
|
-
if (result && typeof result === "object" && "data" in result) {
|
|
126
|
-
const paginatedResult = result;
|
|
127
|
-
// Support both nextCursor and JSON:API links.next format
|
|
128
|
-
let nextCursor;
|
|
129
|
-
if (paginatedResult.nextCursor) {
|
|
130
|
-
nextCursor = paginatedResult.nextCursor;
|
|
131
|
-
}
|
|
132
|
-
else if (paginatedResult.links?.next) {
|
|
133
|
-
// Extract cursor from fully qualified URL (JSON:API spec format)
|
|
134
|
-
nextCursor = extractCursor({ next: paginatedResult.links.next });
|
|
135
|
-
}
|
|
136
|
-
return {
|
|
137
|
-
data: Array.isArray(paginatedResult.data)
|
|
138
|
-
? paginatedResult.data
|
|
139
|
-
: [paginatedResult.data],
|
|
140
|
-
nextCursor,
|
|
141
|
-
};
|
|
142
|
-
}
|
|
143
|
-
// If result is an array, wrap in {data: result}
|
|
144
|
-
if (Array.isArray(result)) {
|
|
145
|
-
return { data: result };
|
|
146
|
-
}
|
|
147
|
-
// If result is non-array, wrap in {data: [result]}
|
|
148
|
-
return { data: [result] };
|
|
149
|
-
}
|
|
150
|
-
catch (error) {
|
|
151
|
-
// Catch and normalize any errors, then rethrow
|
|
152
|
-
throw normalizeError(error);
|
|
153
|
-
}
|
|
154
|
-
},
|
|
155
|
-
};
|
|
156
|
-
return namedFunctions[functionName];
|
|
157
|
-
}
|
|
158
|
-
export function createPaginatedFunction(coreFn, schema, telemetry, explicitFunctionName, defaultPageSize) {
|
|
159
|
-
const pageFunction = createPageFunction(coreFn);
|
|
160
|
-
const functionName = explicitFunctionName || coreFn.name;
|
|
161
|
-
const validator = schema ? createValidator(schema) : null;
|
|
162
|
-
// Create the main paginated function
|
|
163
|
-
const namedFunctions = {
|
|
164
|
-
[functionName]: function (options) {
|
|
165
|
-
return runWithTelemetryContext(() => {
|
|
166
|
-
const startTime = Date.now();
|
|
167
|
-
// Convert undefined options to empty object
|
|
168
|
-
const normalizedOptions = (options ?? {});
|
|
169
|
-
const isNested = isTelemetryNested();
|
|
170
|
-
// Validate options if schema provided (validated fields take precedence)
|
|
171
|
-
const validatedOptions = {
|
|
172
|
-
...normalizedOptions,
|
|
173
|
-
...(validator ? validator(normalizedOptions) : normalizedOptions),
|
|
174
|
-
};
|
|
175
|
-
const pageSize = validatedOptions.pageSize ?? defaultPageSize;
|
|
176
|
-
const optimizedOptions = {
|
|
177
|
-
...validatedOptions,
|
|
178
|
-
pageSize,
|
|
179
|
-
};
|
|
180
|
-
const iterator = paginate(pageFunction, optimizedOptions);
|
|
181
|
-
// Get a promise for the first iteration
|
|
182
|
-
const firstPagePromise = iterator.next().then((result) => {
|
|
183
|
-
if (result.done) {
|
|
184
|
-
throw new Error("Paginate should always iterate at least once");
|
|
185
|
-
}
|
|
186
|
-
return result.value;
|
|
187
|
-
});
|
|
188
|
-
// Emit telemetry after first page completes
|
|
189
|
-
if (!isNested && telemetry?.onMethodCalled) {
|
|
190
|
-
firstPagePromise
|
|
191
|
-
.then(() => {
|
|
192
|
-
const argumentCount = Object.keys(normalizedOptions).length;
|
|
193
|
-
telemetry.onMethodCalled({
|
|
194
|
-
methodName: functionName,
|
|
195
|
-
durationMs: Date.now() - startTime,
|
|
196
|
-
success: true,
|
|
197
|
-
argumentCount,
|
|
198
|
-
isPaginated: true,
|
|
199
|
-
});
|
|
200
|
-
})
|
|
201
|
-
.catch((error) => {
|
|
202
|
-
const argumentCount = Object.keys(normalizedOptions).length;
|
|
203
|
-
telemetry.onMethodCalled({
|
|
204
|
-
methodName: functionName,
|
|
205
|
-
durationMs: Date.now() - startTime,
|
|
206
|
-
success: false,
|
|
207
|
-
error: error instanceof Error ? error : new Error(String(error)),
|
|
208
|
-
argumentCount,
|
|
209
|
-
isPaginated: true,
|
|
210
|
-
});
|
|
211
|
-
});
|
|
212
|
-
}
|
|
213
|
-
// Add Symbol.asyncIterator to make the promise iterable
|
|
214
|
-
return Object.assign(firstPagePromise, {
|
|
215
|
-
[Symbol.asyncIterator]: async function* () {
|
|
216
|
-
// Yield the first page (await the promise)
|
|
217
|
-
yield await firstPagePromise;
|
|
218
|
-
// Yield the rest of the pages
|
|
219
|
-
for await (const page of iterator) {
|
|
220
|
-
yield page;
|
|
221
|
-
}
|
|
222
|
-
},
|
|
223
|
-
items: function () {
|
|
224
|
-
return {
|
|
225
|
-
[Symbol.asyncIterator]: async function* () {
|
|
226
|
-
// Yield the first page items
|
|
227
|
-
const firstPage = await firstPagePromise;
|
|
228
|
-
for (const item of firstPage.data) {
|
|
229
|
-
yield item;
|
|
230
|
-
}
|
|
231
|
-
// Yield items from the rest of the pages
|
|
232
|
-
for await (const page of iterator) {
|
|
233
|
-
for (const item of page.data) {
|
|
234
|
-
yield item;
|
|
235
|
-
}
|
|
236
|
-
}
|
|
237
|
-
},
|
|
238
|
-
};
|
|
239
|
-
},
|
|
240
|
-
});
|
|
241
|
-
});
|
|
242
|
-
},
|
|
243
|
-
};
|
|
244
|
-
return namedFunctions[functionName];
|
|
245
|
-
}
|
|
@@ -1,73 +0,0 @@
|
|
|
1
|
-
type TPageOptions<TOptions> = TOptions extends undefined ? {
|
|
2
|
-
cursor?: string;
|
|
3
|
-
maxItems?: number;
|
|
4
|
-
pageSize?: number;
|
|
5
|
-
} : TOptions & {
|
|
6
|
-
cursor?: string;
|
|
7
|
-
maxItems?: number;
|
|
8
|
-
pageSize?: number;
|
|
9
|
-
};
|
|
10
|
-
export declare function decodeIncomingCursor(incoming?: string): {
|
|
11
|
-
offset: number;
|
|
12
|
-
cursor: string | undefined;
|
|
13
|
-
};
|
|
14
|
-
export declare function createPrefixedCursor(prefix: string, cursor: string | undefined): string;
|
|
15
|
-
export declare function splitPrefixedCursor(cursor: string | undefined, prefixes?: string[]): [string | undefined, string | undefined];
|
|
16
|
-
/**
|
|
17
|
-
* Utility for paginating through API endpoints that return cursor-based pages.
|
|
18
|
-
* Accepts and yields SDK-encoded cursor envelopes. Any incoming cursor is decoded
|
|
19
|
-
* before being passed to the page function; all outgoing cursors are encoded.
|
|
20
|
-
*
|
|
21
|
-
* @param pageFunction - Function that fetches a single page with {data, nextCursor} structure
|
|
22
|
-
* @param pageOptions - Options to pass to the page function (cursor will be managed automatically)
|
|
23
|
-
* @returns Async iterator that yields pages with encoded cursors
|
|
24
|
-
*/
|
|
25
|
-
export declare function paginateMaxItems<TOptions, TPage extends {
|
|
26
|
-
data: any[];
|
|
27
|
-
nextCursor?: string;
|
|
28
|
-
}>(pageFunction: (options: TOptions & {
|
|
29
|
-
cursor?: string;
|
|
30
|
-
maxItems?: number;
|
|
31
|
-
pageSize?: number;
|
|
32
|
-
}) => Promise<TPage>, pageOptions?: TPageOptions<TOptions>): AsyncIterableIterator<TPage>;
|
|
33
|
-
export declare function paginateBuffered<TOptions, TPage extends {
|
|
34
|
-
data: any[];
|
|
35
|
-
nextCursor?: string;
|
|
36
|
-
}>(pageFunction: (options: TOptions & {
|
|
37
|
-
cursor?: string;
|
|
38
|
-
maxItems?: number;
|
|
39
|
-
pageSize?: number;
|
|
40
|
-
}) => Promise<TPage>, pageOptions?: TPageOptions<TOptions>): AsyncIterableIterator<TPage>;
|
|
41
|
-
export declare const paginate: typeof paginateBuffered;
|
|
42
|
-
interface PaginatedResult<TItem> {
|
|
43
|
-
data: TItem[];
|
|
44
|
-
nextCursor?: string;
|
|
45
|
-
}
|
|
46
|
-
type PaginatedSource<TItem> = () => PromiseLike<PaginatedResult<TItem>> & AsyncIterable<PaginatedResult<TItem>>;
|
|
47
|
-
/**
|
|
48
|
-
* Concatenate multiple paginated SDK results into a single paginated stream.
|
|
49
|
-
* Each source is a function returning a dual Promise+AsyncIterable (as SDK
|
|
50
|
-
* paginated methods return). Sources are drained in order.
|
|
51
|
-
*
|
|
52
|
-
* The optional `dedupe` key extractor filters items from source N against
|
|
53
|
-
* all items seen in sources 0 through N-1.
|
|
54
|
-
*
|
|
55
|
-
* Uses paginateBuffered internally to normalize page sizes across source
|
|
56
|
-
* boundaries — e.g. if the first source only has 2 items, they'll be
|
|
57
|
-
* buffered with items from the next source into a full page.
|
|
58
|
-
*
|
|
59
|
-
* Returns the same dual Promise+AsyncIterable shape that resolvers expect.
|
|
60
|
-
*/
|
|
61
|
-
export declare function concatPaginated<TItem>({ sources, dedupe, pageSize, }: {
|
|
62
|
-
sources: PaginatedSource<TItem>[];
|
|
63
|
-
dedupe?: (item: TItem) => string;
|
|
64
|
-
pageSize?: number;
|
|
65
|
-
}): PromiseLike<PaginatedResult<TItem>> & AsyncIterable<PaginatedResult<TItem>>;
|
|
66
|
-
/**
|
|
67
|
-
* Strip the PromiseLike from an async iterable, returning a plain
|
|
68
|
-
* AsyncIterable. This prevents async functions from unwrapping the
|
|
69
|
-
* iterable (since async only unwraps PromiseLike, not AsyncIterable).
|
|
70
|
-
*/
|
|
71
|
-
export declare function toIterable<T>(source: AsyncIterable<T>): AsyncIterable<T>;
|
|
72
|
-
export {};
|
|
73
|
-
//# sourceMappingURL=pagination-utils.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"pagination-utils.d.ts","sourceRoot":"","sources":["../../src/utils/pagination-utils.ts"],"names":[],"mappings":"AAsBA,KAAK,YAAY,CAAC,QAAQ,IAAI,QAAQ,SAAS,SAAS,GACpD;IAAE,MAAM,CAAC,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,EAAE,MAAM,CAAA;CAAE,GACzD,QAAQ,GAAG;IAAE,MAAM,CAAC,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,EAAE,MAAM,CAAA;CAAE,CAAC;AAmCzE,wBAAgB,oBAAoB,CAAC,QAAQ,CAAC,EAAE,MAAM,GAAG;IACvD,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC;CAC5B,CAyBA;AAED,wBAAgB,oBAAoB,CAClC,MAAM,EAAE,MAAM,EACd,MAAM,EAAE,MAAM,GAAG,SAAS,GACzB,MAAM,CAKR;AAED,wBAAgB,mBAAmB,CACjC,MAAM,EAAE,MAAM,GAAG,SAAS,EAC1B,QAAQ,CAAC,EAAE,MAAM,EAAE,GAClB,CAAC,MAAM,GAAG,SAAS,EAAE,MAAM,GAAG,SAAS,CAAC,CAkB1C;AAuDD;;;;;;;;GAQG;AACH,wBAAuB,gBAAgB,CACrC,QAAQ,EACR,KAAK,SAAS;IAAE,IAAI,EAAE,GAAG,EAAE,CAAC;IAAC,UAAU,CAAC,EAAE,MAAM,CAAA;CAAE,EAElD,YAAY,EAAE,CACZ,OAAO,EAAE,QAAQ,GAAG;IAClB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB,KACE,OAAO,CAAC,KAAK,CAAC,EACnB,WAAW,CAAC,EAAE,YAAY,CAAC,QAAQ,CAAC,GACnC,qBAAqB,CAAC,KAAK,CAAC,CAkB9B;AAED,wBAAuB,gBAAgB,CACrC,QAAQ,EACR,KAAK,SAAS;IAAE,IAAI,EAAE,GAAG,EAAE,CAAC;IAAC,UAAU,CAAC,EAAE,MAAM,CAAA;CAAE,EAElD,YAAY,EAAE,CACZ,OAAO,EAAE,QAAQ,GAAG;IAClB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB,KACE,OAAO,CAAC,KAAK,CAAC,EACnB,WAAW,CAAC,EAAE,YAAY,CAAC,QAAQ,CAAC,GACnC,qBAAqB,CAAC,KAAK,CAAC,CA2H9B;AAED,eAAO,MAAM,QAAQ,yBAAmB,CAAC;AAMzC,UAAU,eAAe,CAAC,KAAK;IAC7B,IAAI,EAAE,KAAK,EAAE,CAAC;IACd,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAED,KAAK,eAAe,CAAC,KAAK,IAAI,MAAM,WAAW,CAAC,eAAe,CAAC,KAAK,CAAC,CAAC,GACrE,aAAa,CAAC,eAAe,CAAC,KAAK,CAAC,CAAC,CAAC;AAExC;;;;;;;;;;;;;GAaG;AACH,wBAAgB,eAAe,CAAC,KAAK,EAAE,EACrC,OAAO,EACP,MAAM,EACN,QAAc,GACf,EAAE;IACD,OAAO,EAAE,eAAe,CAAC,KAAK,CAAC,EAAE,CAAC;IAClC,MAAM,CAAC,EAAE,CAAC,IAAI,EAAE,KAAK,KAAK,MAAM,CAAC;IACjC,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB,GAAG,WAAW,CAAC,eAAe,CAAC,KAAK,CAAC,CAAC,GACrC,aAAa,CAAC,eAAe,CAAC,KAAK,CAAC,CAAC,CAiFtC;AAED;;;;GAIG;AACH,wBAAgB,UAAU,CAAC,CAAC,EAAE,MAAM,EAAE,aAAa,CAAC,CAAC,CAAC,GAAG,aAAa,CAAC,CAAC,CAAC,CAExE"}
|
|
@@ -1,308 +0,0 @@
|
|
|
1
|
-
const CURSOR_VERSION = 1;
|
|
2
|
-
const CURSOR_SOURCE = {
|
|
3
|
-
API: "api",
|
|
4
|
-
SDK: "sdk",
|
|
5
|
-
};
|
|
6
|
-
function encodeBase64(str) {
|
|
7
|
-
return btoa(Array.from(new TextEncoder().encode(str), (b) => String.fromCharCode(b)).join(""));
|
|
8
|
-
}
|
|
9
|
-
function decodeBase64(str) {
|
|
10
|
-
return new TextDecoder().decode(Uint8Array.from(atob(str), (c) => c.charCodeAt(0)));
|
|
11
|
-
}
|
|
12
|
-
function encodeApiCursor(cursor) {
|
|
13
|
-
const envelope = {
|
|
14
|
-
v: CURSOR_VERSION,
|
|
15
|
-
source: CURSOR_SOURCE.API,
|
|
16
|
-
cursor,
|
|
17
|
-
};
|
|
18
|
-
return encodeBase64(JSON.stringify(envelope));
|
|
19
|
-
}
|
|
20
|
-
function encodeSdkCursor(offset, cursor) {
|
|
21
|
-
const envelope = {
|
|
22
|
-
v: CURSOR_VERSION,
|
|
23
|
-
source: CURSOR_SOURCE.SDK,
|
|
24
|
-
cursor,
|
|
25
|
-
offset,
|
|
26
|
-
};
|
|
27
|
-
return encodeBase64(JSON.stringify(envelope));
|
|
28
|
-
}
|
|
29
|
-
export function decodeIncomingCursor(incoming) {
|
|
30
|
-
if (!incoming) {
|
|
31
|
-
return { offset: 0, cursor: undefined };
|
|
32
|
-
}
|
|
33
|
-
try {
|
|
34
|
-
const decoded = decodeBase64(incoming);
|
|
35
|
-
const envelope = JSON.parse(decoded);
|
|
36
|
-
if (envelope.v !== CURSOR_VERSION) {
|
|
37
|
-
return { offset: 0, cursor: incoming };
|
|
38
|
-
}
|
|
39
|
-
if (envelope.source === CURSOR_SOURCE.SDK) {
|
|
40
|
-
return { offset: envelope.offset ?? 0, cursor: envelope.cursor };
|
|
41
|
-
}
|
|
42
|
-
if (envelope.source === CURSOR_SOURCE.API) {
|
|
43
|
-
return { offset: 0, cursor: envelope.cursor };
|
|
44
|
-
}
|
|
45
|
-
return { offset: 0, cursor: incoming };
|
|
46
|
-
}
|
|
47
|
-
catch {
|
|
48
|
-
return { offset: 0, cursor: incoming };
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
export function createPrefixedCursor(prefix, cursor) {
|
|
52
|
-
if (!cursor) {
|
|
53
|
-
return `${prefix}::`;
|
|
54
|
-
}
|
|
55
|
-
return `${prefix}::${cursor}`;
|
|
56
|
-
}
|
|
57
|
-
export function splitPrefixedCursor(cursor, prefixes) {
|
|
58
|
-
if (!cursor) {
|
|
59
|
-
return [undefined, undefined];
|
|
60
|
-
}
|
|
61
|
-
const [prefix, ...rest] = cursor.split("::");
|
|
62
|
-
if (prefixes && !prefixes.includes(prefix)) {
|
|
63
|
-
return [undefined, cursor];
|
|
64
|
-
}
|
|
65
|
-
cursor = rest.join("::");
|
|
66
|
-
if (!cursor) {
|
|
67
|
-
return [prefix, undefined];
|
|
68
|
-
}
|
|
69
|
-
return [prefix, cursor];
|
|
70
|
-
}
|
|
71
|
-
/**
|
|
72
|
-
* Internal primitive: paginates through a page function using raw (unencoded) cursors.
|
|
73
|
-
* Encoding and decoding of cursors is the responsibility of the public wrappers.
|
|
74
|
-
*/
|
|
75
|
-
async function* paginateMaxItemsWithUnencodedCursor(pageFunction, pageOptions) {
|
|
76
|
-
let cursor = pageOptions?.cursor;
|
|
77
|
-
let totalItemsYielded = 0;
|
|
78
|
-
const maxItems = pageOptions?.maxItems;
|
|
79
|
-
const pageSize = pageOptions?.pageSize;
|
|
80
|
-
do {
|
|
81
|
-
const options = {
|
|
82
|
-
...(pageOptions || {}),
|
|
83
|
-
cursor,
|
|
84
|
-
pageSize: maxItems !== undefined && pageSize !== undefined
|
|
85
|
-
? Math.min(pageSize, maxItems)
|
|
86
|
-
: pageSize,
|
|
87
|
-
};
|
|
88
|
-
const page = await pageFunction(options);
|
|
89
|
-
if (maxItems !== undefined) {
|
|
90
|
-
const remainingItems = maxItems - totalItemsYielded;
|
|
91
|
-
if (page.data.length >= remainingItems) {
|
|
92
|
-
yield {
|
|
93
|
-
...page,
|
|
94
|
-
data: page.data.slice(0, remainingItems),
|
|
95
|
-
nextCursor: undefined,
|
|
96
|
-
};
|
|
97
|
-
break;
|
|
98
|
-
}
|
|
99
|
-
}
|
|
100
|
-
yield page;
|
|
101
|
-
totalItemsYielded += page.data.length;
|
|
102
|
-
cursor = page.nextCursor;
|
|
103
|
-
} while (cursor);
|
|
104
|
-
}
|
|
105
|
-
/**
|
|
106
|
-
* Utility for paginating through API endpoints that return cursor-based pages.
|
|
107
|
-
* Accepts and yields SDK-encoded cursor envelopes. Any incoming cursor is decoded
|
|
108
|
-
* before being passed to the page function; all outgoing cursors are encoded.
|
|
109
|
-
*
|
|
110
|
-
* @param pageFunction - Function that fetches a single page with {data, nextCursor} structure
|
|
111
|
-
* @param pageOptions - Options to pass to the page function (cursor will be managed automatically)
|
|
112
|
-
* @returns Async iterator that yields pages with encoded cursors
|
|
113
|
-
*/
|
|
114
|
-
export async function* paginateMaxItems(pageFunction, pageOptions) {
|
|
115
|
-
const { cursor } = decodeIncomingCursor(pageOptions?.cursor);
|
|
116
|
-
const options = {
|
|
117
|
-
...(pageOptions || {}),
|
|
118
|
-
cursor,
|
|
119
|
-
};
|
|
120
|
-
for await (const page of paginateMaxItemsWithUnencodedCursor(pageFunction, options)) {
|
|
121
|
-
yield {
|
|
122
|
-
...page,
|
|
123
|
-
nextCursor: page.nextCursor
|
|
124
|
-
? encodeApiCursor(page.nextCursor)
|
|
125
|
-
: undefined,
|
|
126
|
-
};
|
|
127
|
-
}
|
|
128
|
-
}
|
|
129
|
-
export async function* paginateBuffered(pageFunction, pageOptions) {
|
|
130
|
-
const pageSize = pageOptions?.pageSize;
|
|
131
|
-
const { offset: cursorOffset, cursor: initialCursor } = decodeIncomingCursor(pageOptions?.cursor);
|
|
132
|
-
const requestedMaxItems = pageOptions?.maxItems;
|
|
133
|
-
const options = {
|
|
134
|
-
...(pageOptions || {}),
|
|
135
|
-
cursor: initialCursor,
|
|
136
|
-
// SDK cursors can carry an offset into a raw backend page. Since maxItems
|
|
137
|
-
// is expected to be relative to the resumed position, we add that offset
|
|
138
|
-
// so raw pagination still yields enough items after offset slicing.
|
|
139
|
-
maxItems: requestedMaxItems !== undefined && cursorOffset > 0
|
|
140
|
-
? requestedMaxItems + cursorOffset
|
|
141
|
-
: requestedMaxItems,
|
|
142
|
-
};
|
|
143
|
-
if (!pageSize) {
|
|
144
|
-
for await (const page of paginateMaxItemsWithUnencodedCursor(pageFunction, options)) {
|
|
145
|
-
yield {
|
|
146
|
-
...page,
|
|
147
|
-
nextCursor: page.nextCursor
|
|
148
|
-
? encodeApiCursor(page.nextCursor)
|
|
149
|
-
: undefined,
|
|
150
|
-
};
|
|
151
|
-
}
|
|
152
|
-
return;
|
|
153
|
-
}
|
|
154
|
-
let bufferedPages = [];
|
|
155
|
-
let isFirstPage = true;
|
|
156
|
-
let rawCursor;
|
|
157
|
-
for await (let page of paginateMaxItemsWithUnencodedCursor(pageFunction, options)) {
|
|
158
|
-
const nextRawCursor = page.nextCursor;
|
|
159
|
-
if (isFirstPage) {
|
|
160
|
-
isFirstPage = false;
|
|
161
|
-
if (cursorOffset) {
|
|
162
|
-
page = {
|
|
163
|
-
...page,
|
|
164
|
-
data: page.data.slice(cursorOffset),
|
|
165
|
-
};
|
|
166
|
-
}
|
|
167
|
-
}
|
|
168
|
-
const bufferedLength = bufferedPages.reduce((acc, p) => acc + p.data.length, 0);
|
|
169
|
-
// If we don't have enough to fill a page, buffer this page.
|
|
170
|
-
if (bufferedLength + page.data.length < pageSize) {
|
|
171
|
-
bufferedPages.push(page);
|
|
172
|
-
rawCursor = nextRawCursor;
|
|
173
|
-
continue;
|
|
174
|
-
}
|
|
175
|
-
// Let's yield a page from our buffered pages.
|
|
176
|
-
const bufferedItems = bufferedPages.map((p) => p.data).flat();
|
|
177
|
-
const allItems = [...bufferedItems, ...page.data];
|
|
178
|
-
const pageItems = allItems.slice(0, pageSize);
|
|
179
|
-
const remainingItems = allItems.slice(pageItems.length);
|
|
180
|
-
// No extra items to buffer, so we can just yield a normal page with a cursor to the next one.
|
|
181
|
-
if (remainingItems.length === 0) {
|
|
182
|
-
yield {
|
|
183
|
-
...page,
|
|
184
|
-
data: pageItems,
|
|
185
|
-
nextCursor: nextRawCursor ? encodeApiCursor(nextRawCursor) : undefined,
|
|
186
|
-
};
|
|
187
|
-
bufferedPages = [];
|
|
188
|
-
rawCursor = nextRawCursor;
|
|
189
|
-
continue;
|
|
190
|
-
}
|
|
191
|
-
// Yield our items with a cursor to offset into this page.
|
|
192
|
-
yield {
|
|
193
|
-
...page,
|
|
194
|
-
data: pageItems,
|
|
195
|
-
nextCursor: encodeSdkCursor(page.data.length - remainingItems.length, rawCursor),
|
|
196
|
-
};
|
|
197
|
-
while (remainingItems.length > pageSize) {
|
|
198
|
-
const chunkItems = remainingItems.splice(0, pageSize);
|
|
199
|
-
yield {
|
|
200
|
-
...page,
|
|
201
|
-
data: chunkItems,
|
|
202
|
-
nextCursor: encodeSdkCursor(page.data.length - remainingItems.length, rawCursor),
|
|
203
|
-
};
|
|
204
|
-
}
|
|
205
|
-
bufferedPages = [
|
|
206
|
-
{
|
|
207
|
-
...page,
|
|
208
|
-
data: remainingItems,
|
|
209
|
-
},
|
|
210
|
-
];
|
|
211
|
-
rawCursor = nextRawCursor;
|
|
212
|
-
}
|
|
213
|
-
if (bufferedPages.length > 0) {
|
|
214
|
-
const lastBufferedPage = bufferedPages.slice(-1)[0];
|
|
215
|
-
const bufferedItems = bufferedPages.map((p) => p.data).flat();
|
|
216
|
-
yield {
|
|
217
|
-
...lastBufferedPage,
|
|
218
|
-
data: bufferedItems,
|
|
219
|
-
};
|
|
220
|
-
}
|
|
221
|
-
}
|
|
222
|
-
export const paginate = paginateBuffered;
|
|
223
|
-
/**
|
|
224
|
-
* Concatenate multiple paginated SDK results into a single paginated stream.
|
|
225
|
-
* Each source is a function returning a dual Promise+AsyncIterable (as SDK
|
|
226
|
-
* paginated methods return). Sources are drained in order.
|
|
227
|
-
*
|
|
228
|
-
* The optional `dedupe` key extractor filters items from source N against
|
|
229
|
-
* all items seen in sources 0 through N-1.
|
|
230
|
-
*
|
|
231
|
-
* Uses paginateBuffered internally to normalize page sizes across source
|
|
232
|
-
* boundaries — e.g. if the first source only has 2 items, they'll be
|
|
233
|
-
* buffered with items from the next source into a full page.
|
|
234
|
-
*
|
|
235
|
-
* Returns the same dual Promise+AsyncIterable shape that resolvers expect.
|
|
236
|
-
*/
|
|
237
|
-
export function concatPaginated({ sources, dedupe, pageSize = 100, }) {
|
|
238
|
-
if (sources.length === 0) {
|
|
239
|
-
const empty = { data: [] };
|
|
240
|
-
return Object.assign(Promise.resolve(empty), {
|
|
241
|
-
[Symbol.asyncIterator]: async function* () {
|
|
242
|
-
yield empty;
|
|
243
|
-
},
|
|
244
|
-
});
|
|
245
|
-
}
|
|
246
|
-
let sourceIndex = 0;
|
|
247
|
-
let currentIterator = null;
|
|
248
|
-
const seen = new Set();
|
|
249
|
-
const pageFunction = async (_options) => {
|
|
250
|
-
while (sourceIndex < sources.length) {
|
|
251
|
-
if (!currentIterator) {
|
|
252
|
-
const result = sources[sourceIndex]();
|
|
253
|
-
currentIterator = result[Symbol.asyncIterator]();
|
|
254
|
-
}
|
|
255
|
-
const next = await currentIterator.next();
|
|
256
|
-
if (next.done) {
|
|
257
|
-
sourceIndex++;
|
|
258
|
-
currentIterator = null;
|
|
259
|
-
continue;
|
|
260
|
-
}
|
|
261
|
-
let items = next.value.data;
|
|
262
|
-
if (dedupe) {
|
|
263
|
-
if (sourceIndex > 0) {
|
|
264
|
-
items = items.filter((item) => !seen.has(dedupe(item)));
|
|
265
|
-
}
|
|
266
|
-
for (const item of items) {
|
|
267
|
-
seen.add(dedupe(item));
|
|
268
|
-
}
|
|
269
|
-
}
|
|
270
|
-
const hasMoreInSource = next.value.nextCursor != null;
|
|
271
|
-
const hasMoreSources = sourceIndex < sources.length - 1;
|
|
272
|
-
// Synthetic sentinel — not a real API cursor. It just signals to
|
|
273
|
-
// paginateBuffered that more data exists (from the current source or
|
|
274
|
-
// the next one). This works because concatPaginated manages its own
|
|
275
|
-
// iteration state internally. Currently only used by CLI resolvers;
|
|
276
|
-
// if this is ever used in user-facing SDK methods, we should replace
|
|
277
|
-
// it with a stateless composite cursor (e.g. sourceIndex + inner cursor).
|
|
278
|
-
return {
|
|
279
|
-
data: items,
|
|
280
|
-
nextCursor: hasMoreInSource || hasMoreSources ? "__has_more__" : undefined,
|
|
281
|
-
};
|
|
282
|
-
}
|
|
283
|
-
return { data: [] };
|
|
284
|
-
};
|
|
285
|
-
const iterator = paginateBuffered(pageFunction, { pageSize });
|
|
286
|
-
const firstPagePromise = iterator.next().then((result) => {
|
|
287
|
-
if (result.done) {
|
|
288
|
-
return { data: [] };
|
|
289
|
-
}
|
|
290
|
-
return result.value;
|
|
291
|
-
});
|
|
292
|
-
return Object.assign(firstPagePromise, {
|
|
293
|
-
[Symbol.asyncIterator]: async function* () {
|
|
294
|
-
yield await firstPagePromise;
|
|
295
|
-
for await (const page of { [Symbol.asyncIterator]: () => iterator }) {
|
|
296
|
-
yield page;
|
|
297
|
-
}
|
|
298
|
-
},
|
|
299
|
-
});
|
|
300
|
-
}
|
|
301
|
-
/**
|
|
302
|
-
* Strip the PromiseLike from an async iterable, returning a plain
|
|
303
|
-
* AsyncIterable. This prevents async functions from unwrapping the
|
|
304
|
-
* iterable (since async only unwraps PromiseLike, not AsyncIterable).
|
|
305
|
-
*/
|
|
306
|
-
export function toIterable(source) {
|
|
307
|
-
return { [Symbol.asyncIterator]: () => source[Symbol.asyncIterator]() };
|
|
308
|
-
}
|