@zapier/zapier-sdk 0.60.0 → 0.61.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.
Files changed (45) hide show
  1. package/CHANGELOG.md +18 -0
  2. package/README.md +147 -1
  3. package/dist/experimental.cjs +188 -10
  4. package/dist/experimental.d.mts +86 -0
  5. package/dist/experimental.d.ts +86 -0
  6. package/dist/experimental.d.ts.map +1 -1
  7. package/dist/experimental.js +10 -0
  8. package/dist/experimental.mjs +188 -10
  9. package/dist/index.cjs +3 -9
  10. package/dist/index.mjs +3 -9
  11. package/dist/plugins/codeSubstrate/createWorkflow/index.d.ts +45 -0
  12. package/dist/plugins/codeSubstrate/createWorkflow/index.d.ts.map +1 -0
  13. package/dist/plugins/codeSubstrate/createWorkflow/index.js +19 -0
  14. package/dist/plugins/codeSubstrate/createWorkflow/schemas.d.ts +16 -0
  15. package/dist/plugins/codeSubstrate/createWorkflow/schemas.d.ts.map +1 -0
  16. package/dist/plugins/codeSubstrate/createWorkflow/schemas.js +25 -0
  17. package/dist/plugins/codeSubstrate/deleteWorkflow/index.d.ts +39 -0
  18. package/dist/plugins/codeSubstrate/deleteWorkflow/index.d.ts.map +1 -0
  19. package/dist/plugins/codeSubstrate/deleteWorkflow/index.js +27 -0
  20. package/dist/plugins/codeSubstrate/deleteWorkflow/schemas.d.ts +6 -0
  21. package/dist/plugins/codeSubstrate/deleteWorkflow/schemas.d.ts.map +1 -0
  22. package/dist/plugins/codeSubstrate/deleteWorkflow/schemas.js +6 -0
  23. package/dist/plugins/codeSubstrate/disableWorkflow/index.d.ts +40 -0
  24. package/dist/plugins/codeSubstrate/disableWorkflow/index.d.ts.map +1 -0
  25. package/dist/plugins/codeSubstrate/disableWorkflow/index.js +20 -0
  26. package/dist/plugins/codeSubstrate/disableWorkflow/schemas.d.ts +11 -0
  27. package/dist/plugins/codeSubstrate/disableWorkflow/schemas.d.ts.map +1 -0
  28. package/dist/plugins/codeSubstrate/disableWorkflow/schemas.js +12 -0
  29. package/dist/plugins/codeSubstrate/enableWorkflow/index.d.ts +40 -0
  30. package/dist/plugins/codeSubstrate/enableWorkflow/index.d.ts.map +1 -0
  31. package/dist/plugins/codeSubstrate/enableWorkflow/index.js +20 -0
  32. package/dist/plugins/codeSubstrate/enableWorkflow/schemas.d.ts +11 -0
  33. package/dist/plugins/codeSubstrate/enableWorkflow/schemas.d.ts.map +1 -0
  34. package/dist/plugins/codeSubstrate/enableWorkflow/schemas.js +12 -0
  35. package/dist/plugins/codeSubstrate/updateWorkflow/index.d.ts +47 -0
  36. package/dist/plugins/codeSubstrate/updateWorkflow/index.d.ts.map +1 -0
  37. package/dist/plugins/codeSubstrate/updateWorkflow/index.js +27 -0
  38. package/dist/plugins/codeSubstrate/updateWorkflow/schemas.d.ts +18 -0
  39. package/dist/plugins/codeSubstrate/updateWorkflow/schemas.d.ts.map +1 -0
  40. package/dist/plugins/codeSubstrate/updateWorkflow/schemas.js +30 -0
  41. package/dist/plugins/deleteClientCredentials/index.d.ts.map +1 -1
  42. package/dist/plugins/deleteClientCredentials/index.js +1 -4
  43. package/dist/resolvers/clientId.d.ts.map +1 -1
  44. package/dist/resolvers/clientId.js +2 -4
  45. package/package.json +1 -1
@@ -2887,7 +2887,7 @@ async function invalidateCredentialsToken(options) {
2887
2887
  }
2888
2888
 
2889
2889
  // src/sdk-version.ts
2890
- var SDK_VERSION = (typeof process !== "undefined" && process.env ? "0.60.0" : void 0) || "unknown";
2890
+ var SDK_VERSION = (typeof process !== "undefined" && process.env ? "0.61.0" : void 0) || "unknown";
2891
2891
 
2892
2892
  // src/utils/open-url.ts
2893
2893
  var nodePrefix = "node:";
@@ -4206,10 +4206,7 @@ var clientCredentialsNameResolver = {
4206
4206
  // src/resolvers/clientId.ts
4207
4207
  var clientIdResolver = {
4208
4208
  type: "dynamic",
4209
- fetch: async (sdk) => {
4210
- const result = await sdk.listClientCredentials({ maxItems: 100 });
4211
- return result.data;
4212
- },
4209
+ fetch: async (sdk) => toIterable(sdk.listClientCredentials({})),
4213
4210
  prompt: (credentials) => ({
4214
4211
  type: "list",
4215
4212
  name: "clientId",
@@ -6149,10 +6146,7 @@ var deleteClientCredentialsPlugin = definePlugin(
6149
6146
  {
6150
6147
  authRequired: true,
6151
6148
  requiredScopes: ["credentials"],
6152
- resource: {
6153
- type: "client-credential",
6154
- id: options.clientId
6155
- }
6149
+ resource: { type: "client-credential", id: options.clientId }
6156
6150
  }
6157
6151
  );
6158
6152
  return { success: true };
@@ -10644,6 +10638,190 @@ var getWorkflowPlugin = definePlugin(
10644
10638
  }
10645
10639
  })
10646
10640
  );
10641
+ var CreateWorkflowOptionsSchema = z.object({
10642
+ name: z.string().min(1).describe("Workflow name"),
10643
+ description: z.string().optional().describe("Optional description for the workflow")
10644
+ }).describe(
10645
+ "Create a durable workflow container. Starts disabled with no version; publish a version to add code."
10646
+ );
10647
+ var CreateWorkflowResponseSchema = z.object({
10648
+ id: z.string().describe("Workflow ID (UUID)"),
10649
+ name: z.string().describe("Workflow name"),
10650
+ description: z.string().nullable().describe("Workflow description (null if unset)"),
10651
+ trigger_url: z.string().describe(
10652
+ "Public webhook URL that fires this workflow when POSTed to. Embeds a secret trigger token in the path \u2014 treat as sensitive."
10653
+ ),
10654
+ enabled: z.boolean().describe(
10655
+ "Whether the workflow currently accepts triggers. Always false on a new workflow until enabled."
10656
+ ),
10657
+ created_at: z.string().describe("When the workflow was created (ISO-8601)")
10658
+ });
10659
+
10660
+ // src/plugins/codeSubstrate/createWorkflow/index.ts
10661
+ var createWorkflowPlugin = definePlugin(
10662
+ (sdk) => createPluginMethod(sdk, {
10663
+ ...codeSubstrateDefaults,
10664
+ name: "createWorkflow",
10665
+ type: "create",
10666
+ itemType: "Workflow",
10667
+ inputSchema: CreateWorkflowOptionsSchema,
10668
+ outputSchema: CreateWorkflowResponseSchema,
10669
+ handler: async ({ sdk: sdk2, options }) => {
10670
+ const body = { name: options.name };
10671
+ if (options.description !== void 0) {
10672
+ body.description = options.description;
10673
+ }
10674
+ const data = await sdk2.context.api.post(
10675
+ "/durableworkflowzaps/api/v0/workflows",
10676
+ body,
10677
+ { authRequired: true }
10678
+ );
10679
+ return { data };
10680
+ }
10681
+ })
10682
+ );
10683
+ var UpdateWorkflowOptionsSchema = z.object({
10684
+ workflow: z.string().uuid().describe("Durable workflow ID"),
10685
+ name: z.string().min(1).optional().describe("New name for the workflow"),
10686
+ description: z.string().nullish().describe("New description for the workflow (pass null to clear)")
10687
+ }).refine((data) => data.name !== void 0 || data.description !== void 0, {
10688
+ message: "Provide name or description (at least one is required)"
10689
+ }).describe("Update a durable workflow's name and/or description");
10690
+ var UpdateWorkflowResponseSchema = z.object({
10691
+ id: z.string().describe("Workflow ID (UUID)"),
10692
+ name: z.string().describe("Workflow name (post-update)"),
10693
+ description: z.string().nullable().describe("Workflow description, post-update (null if unset)"),
10694
+ trigger_url: z.string().describe(
10695
+ "Public webhook URL that fires this workflow when POSTed to. Embeds a secret trigger token in the path \u2014 treat as sensitive."
10696
+ ),
10697
+ enabled: z.boolean().describe("Whether the workflow currently accepts triggers"),
10698
+ created_at: z.string().describe("When the workflow was created (ISO-8601)"),
10699
+ updated_at: z.string().describe("When this update was applied (ISO-8601)")
10700
+ });
10701
+
10702
+ // src/plugins/codeSubstrate/updateWorkflow/index.ts
10703
+ var updateWorkflowPlugin = definePlugin(
10704
+ (sdk) => createPluginMethod(sdk, {
10705
+ ...codeSubstrateDefaults,
10706
+ name: "updateWorkflow",
10707
+ type: "update",
10708
+ itemType: "Workflow",
10709
+ inputSchema: UpdateWorkflowOptionsSchema,
10710
+ outputSchema: UpdateWorkflowResponseSchema,
10711
+ resolvers: { workflow: workflowIdResolver },
10712
+ handler: async ({ sdk: sdk2, options }) => {
10713
+ const body = {};
10714
+ if (options.name !== void 0) {
10715
+ body.name = options.name;
10716
+ }
10717
+ if (options.description !== void 0) {
10718
+ body.description = options.description;
10719
+ }
10720
+ const data = await sdk2.context.api.patch(
10721
+ `/durableworkflowzaps/api/v0/workflows/${encodeURIComponent(options.workflow)}`,
10722
+ body,
10723
+ {
10724
+ authRequired: true,
10725
+ resource: { type: "workflow", id: options.workflow }
10726
+ }
10727
+ );
10728
+ return { data };
10729
+ }
10730
+ })
10731
+ );
10732
+ var EnableWorkflowOptionsSchema = z.object({
10733
+ workflow: z.string().uuid().describe("Durable workflow ID")
10734
+ }).describe("Enable a durable workflow so it accepts triggers");
10735
+ var EnableWorkflowResponseSchema = z.object({
10736
+ id: z.string().describe("Workflow ID (UUID)"),
10737
+ enabled: z.boolean().describe("Workflow's enabled state after the operation (always true)")
10738
+ });
10739
+
10740
+ // src/plugins/codeSubstrate/enableWorkflow/index.ts
10741
+ var enableWorkflowPlugin = definePlugin(
10742
+ (sdk) => createPluginMethod(sdk, {
10743
+ ...codeSubstrateDefaults,
10744
+ name: "enableWorkflow",
10745
+ type: "update",
10746
+ itemType: "Workflow",
10747
+ inputSchema: EnableWorkflowOptionsSchema,
10748
+ outputSchema: EnableWorkflowResponseSchema,
10749
+ resolvers: { workflow: workflowIdResolver },
10750
+ handler: async ({ sdk: sdk2, options }) => {
10751
+ const data = await sdk2.context.api.post(
10752
+ `/durableworkflowzaps/api/v0/workflows/${encodeURIComponent(options.workflow)}/enable`,
10753
+ void 0,
10754
+ {
10755
+ authRequired: true,
10756
+ resource: { type: "workflow", id: options.workflow }
10757
+ }
10758
+ );
10759
+ return { data };
10760
+ }
10761
+ })
10762
+ );
10763
+ var DisableWorkflowOptionsSchema = z.object({
10764
+ workflow: z.string().uuid().describe("Durable workflow ID")
10765
+ }).describe("Disable a durable workflow so it stops accepting triggers");
10766
+ var DisableWorkflowResponseSchema = z.object({
10767
+ id: z.string().describe("Workflow ID (UUID)"),
10768
+ enabled: z.boolean().describe(
10769
+ "Workflow's enabled state after the operation. Typically false; mirrors the row's true state in case a concurrent enable raced with this call."
10770
+ )
10771
+ });
10772
+
10773
+ // src/plugins/codeSubstrate/disableWorkflow/index.ts
10774
+ var disableWorkflowPlugin = definePlugin(
10775
+ (sdk) => createPluginMethod(sdk, {
10776
+ ...codeSubstrateDefaults,
10777
+ name: "disableWorkflow",
10778
+ type: "update",
10779
+ itemType: "Workflow",
10780
+ inputSchema: DisableWorkflowOptionsSchema,
10781
+ outputSchema: DisableWorkflowResponseSchema,
10782
+ resolvers: { workflow: workflowIdResolver },
10783
+ handler: async ({ sdk: sdk2, options }) => {
10784
+ const data = await sdk2.context.api.post(
10785
+ `/durableworkflowzaps/api/v0/workflows/${encodeURIComponent(options.workflow)}/disable`,
10786
+ void 0,
10787
+ {
10788
+ authRequired: true,
10789
+ resource: { type: "workflow", id: options.workflow }
10790
+ }
10791
+ );
10792
+ return { data };
10793
+ }
10794
+ })
10795
+ );
10796
+ var DeleteWorkflowOptionsSchema = z.object({
10797
+ workflow: z.string().uuid().describe("Durable workflow ID")
10798
+ }).describe(
10799
+ "Delete a durable workflow. Throws `ZapierNotFoundError` if the workflow doesn't exist; callers wanting idempotency should catch that themselves."
10800
+ );
10801
+
10802
+ // src/plugins/codeSubstrate/deleteWorkflow/index.ts
10803
+ var deleteWorkflowPlugin = definePlugin(
10804
+ (sdk) => createPluginMethod(sdk, {
10805
+ ...codeSubstrateDefaults,
10806
+ name: "deleteWorkflow",
10807
+ type: "delete",
10808
+ itemType: "Workflow",
10809
+ confirm: "delete",
10810
+ inputSchema: DeleteWorkflowOptionsSchema,
10811
+ resolvers: { workflow: workflowIdResolver },
10812
+ handler: async ({ sdk: sdk2, options }) => {
10813
+ await sdk2.context.api.delete(
10814
+ `/durableworkflowzaps/api/v0/workflows/${encodeURIComponent(options.workflow)}`,
10815
+ void 0,
10816
+ {
10817
+ authRequired: true,
10818
+ resource: { type: "workflow", id: options.workflow }
10819
+ }
10820
+ );
10821
+ return { data: { id: options.workflow } };
10822
+ }
10823
+ })
10824
+ );
10647
10825
 
10648
10826
  // src/utils/batch-utils.ts
10649
10827
  var DEFAULT_CONCURRENCY = 10;
@@ -10803,7 +10981,7 @@ var registryPlugin = definePlugin((_sdk) => {
10803
10981
 
10804
10982
  // src/experimental.ts
10805
10983
  function createZapierSdk2(options = {}) {
10806
- return createSdk().addPlugin(createOptionsPlugin(options)).addPlugin(eventEmissionPlugin).addPlugin(apiPlugin).addPlugin(manifestPlugin).addPlugin(capabilitiesPlugin).addPlugin(connectionsPlugin).addPlugin(listAppsPlugin).addPlugin(getAppPlugin).addPlugin(listActionsPlugin).addPlugin(getActionPlugin).addPlugin(listActionInputFieldsPlugin).addPlugin(getActionInputFieldsSchemaPlugin).addPlugin(listActionInputFieldChoicesPlugin).addPlugin(listInputFieldsDeprecatedPlugin).addPlugin(getInputFieldsSchemaDeprecatedPlugin).addPlugin(listInputFieldChoicesDeprecatedPlugin).addPlugin(runActionPlugin).addPlugin(listConnectionsPlugin).addPlugin(getConnectionPlugin).addPlugin(findFirstConnectionPlugin).addPlugin(findUniqueConnectionPlugin).addPlugin(listAuthenticationsPlugin).addPlugin(getAuthenticationPlugin).addPlugin(findFirstAuthenticationPlugin).addPlugin(findUniqueAuthenticationPlugin).addPlugin(listClientCredentialsPlugin).addPlugin(createClientCredentialsPlugin).addPlugin(deleteClientCredentialsPlugin).addPlugin(fetchPlugin).addPlugin(requestPlugin).addPlugin(createTriggerInboxPlugin).addPlugin(ensureTriggerInboxPlugin).addPlugin(listTriggerInboxesPlugin).addPlugin(getTriggerInboxPlugin).addPlugin(updateTriggerInboxPlugin).addPlugin(deleteTriggerInboxPlugin).addPlugin(pauseTriggerInboxPlugin).addPlugin(resumeTriggerInboxPlugin).addPlugin(listTriggerInboxMessagesPlugin).addPlugin(leaseTriggerInboxMessagesPlugin).addPlugin(ackTriggerInboxMessagesPlugin).addPlugin(releaseTriggerInboxMessagesPlugin).addPlugin(drainTriggerInboxPlugin).addPlugin(watchTriggerInboxPlugin).addPlugin(listTriggersPlugin).addPlugin(listTriggerInputFieldsPlugin).addPlugin(listTriggerInputFieldChoicesPlugin).addPlugin(getTriggerInputFieldsSchemaPlugin).addPlugin(listTablesPlugin).addPlugin(getTablePlugin).addPlugin(deleteTablePlugin).addPlugin(createTablePlugin).addPlugin(listTableFieldsPlugin).addPlugin(createTableFieldsPlugin).addPlugin(deleteTableFieldsPlugin).addPlugin(getTableRecordPlugin).addPlugin(listTableRecordsPlugin).addPlugin(createTableRecordsPlugin).addPlugin(deleteTableRecordsPlugin).addPlugin(updateTableRecordsPlugin).addPlugin(listWorkflowsPlugin).addPlugin(getWorkflowPlugin).addPlugin(appsPlugin).addPlugin(getProfilePlugin);
10984
+ return createSdk().addPlugin(createOptionsPlugin(options)).addPlugin(eventEmissionPlugin).addPlugin(apiPlugin).addPlugin(manifestPlugin).addPlugin(capabilitiesPlugin).addPlugin(connectionsPlugin).addPlugin(listAppsPlugin).addPlugin(getAppPlugin).addPlugin(listActionsPlugin).addPlugin(getActionPlugin).addPlugin(listActionInputFieldsPlugin).addPlugin(getActionInputFieldsSchemaPlugin).addPlugin(listActionInputFieldChoicesPlugin).addPlugin(listInputFieldsDeprecatedPlugin).addPlugin(getInputFieldsSchemaDeprecatedPlugin).addPlugin(listInputFieldChoicesDeprecatedPlugin).addPlugin(runActionPlugin).addPlugin(listConnectionsPlugin).addPlugin(getConnectionPlugin).addPlugin(findFirstConnectionPlugin).addPlugin(findUniqueConnectionPlugin).addPlugin(listAuthenticationsPlugin).addPlugin(getAuthenticationPlugin).addPlugin(findFirstAuthenticationPlugin).addPlugin(findUniqueAuthenticationPlugin).addPlugin(listClientCredentialsPlugin).addPlugin(createClientCredentialsPlugin).addPlugin(deleteClientCredentialsPlugin).addPlugin(fetchPlugin).addPlugin(requestPlugin).addPlugin(createTriggerInboxPlugin).addPlugin(ensureTriggerInboxPlugin).addPlugin(listTriggerInboxesPlugin).addPlugin(getTriggerInboxPlugin).addPlugin(updateTriggerInboxPlugin).addPlugin(deleteTriggerInboxPlugin).addPlugin(pauseTriggerInboxPlugin).addPlugin(resumeTriggerInboxPlugin).addPlugin(listTriggerInboxMessagesPlugin).addPlugin(leaseTriggerInboxMessagesPlugin).addPlugin(ackTriggerInboxMessagesPlugin).addPlugin(releaseTriggerInboxMessagesPlugin).addPlugin(drainTriggerInboxPlugin).addPlugin(watchTriggerInboxPlugin).addPlugin(listTriggersPlugin).addPlugin(listTriggerInputFieldsPlugin).addPlugin(listTriggerInputFieldChoicesPlugin).addPlugin(getTriggerInputFieldsSchemaPlugin).addPlugin(listTablesPlugin).addPlugin(getTablePlugin).addPlugin(deleteTablePlugin).addPlugin(createTablePlugin).addPlugin(listTableFieldsPlugin).addPlugin(createTableFieldsPlugin).addPlugin(deleteTableFieldsPlugin).addPlugin(getTableRecordPlugin).addPlugin(listTableRecordsPlugin).addPlugin(createTableRecordsPlugin).addPlugin(deleteTableRecordsPlugin).addPlugin(updateTableRecordsPlugin).addPlugin(listWorkflowsPlugin).addPlugin(getWorkflowPlugin).addPlugin(createWorkflowPlugin).addPlugin(updateWorkflowPlugin).addPlugin(enableWorkflowPlugin).addPlugin(disableWorkflowPlugin).addPlugin(deleteWorkflowPlugin).addPlugin(appsPlugin).addPlugin(getProfilePlugin);
10807
10985
  }
10808
10986
 
10809
10987
  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, 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 };
package/dist/index.cjs CHANGED
@@ -2512,10 +2512,7 @@ var clientCredentialsNameResolver = {
2512
2512
  // src/resolvers/clientId.ts
2513
2513
  var clientIdResolver = {
2514
2514
  type: "dynamic",
2515
- fetch: async (sdk) => {
2516
- const result = await sdk.listClientCredentials({ maxItems: 100 });
2517
- return result.data;
2518
- },
2515
+ fetch: async (sdk) => toIterable(sdk.listClientCredentials({})),
2519
2516
  prompt: (credentials) => ({
2520
2517
  type: "list",
2521
2518
  name: "clientId",
@@ -4274,10 +4271,7 @@ var deleteClientCredentialsPlugin = definePlugin(
4274
4271
  {
4275
4272
  authRequired: true,
4276
4273
  requiredScopes: ["credentials"],
4277
- resource: {
4278
- type: "client-credential",
4279
- id: options.clientId
4280
- }
4274
+ resource: { type: "client-credential", id: options.clientId }
4281
4275
  }
4282
4276
  );
4283
4277
  return { success: true };
@@ -6345,7 +6339,7 @@ async function invalidateCredentialsToken(options) {
6345
6339
  }
6346
6340
 
6347
6341
  // src/sdk-version.ts
6348
- var SDK_VERSION = (typeof process !== "undefined" && process.env ? "0.60.0" : void 0) || "unknown";
6342
+ var SDK_VERSION = (typeof process !== "undefined" && process.env ? "0.61.0" : void 0) || "unknown";
6349
6343
 
6350
6344
  // src/utils/open-url.ts
6351
6345
  var nodePrefix = "node:";
package/dist/index.mjs CHANGED
@@ -2510,10 +2510,7 @@ var clientCredentialsNameResolver = {
2510
2510
  // src/resolvers/clientId.ts
2511
2511
  var clientIdResolver = {
2512
2512
  type: "dynamic",
2513
- fetch: async (sdk) => {
2514
- const result = await sdk.listClientCredentials({ maxItems: 100 });
2515
- return result.data;
2516
- },
2513
+ fetch: async (sdk) => toIterable(sdk.listClientCredentials({})),
2517
2514
  prompt: (credentials) => ({
2518
2515
  type: "list",
2519
2516
  name: "clientId",
@@ -4272,10 +4269,7 @@ var deleteClientCredentialsPlugin = definePlugin(
4272
4269
  {
4273
4270
  authRequired: true,
4274
4271
  requiredScopes: ["credentials"],
4275
- resource: {
4276
- type: "client-credential",
4277
- id: options.clientId
4278
- }
4272
+ resource: { type: "client-credential", id: options.clientId }
4279
4273
  }
4280
4274
  );
4281
4275
  return { success: true };
@@ -6343,7 +6337,7 @@ async function invalidateCredentialsToken(options) {
6343
6337
  }
6344
6338
 
6345
6339
  // src/sdk-version.ts
6346
- var SDK_VERSION = (typeof process !== "undefined" && process.env ? "0.60.0" : void 0) || "unknown";
6340
+ var SDK_VERSION = (typeof process !== "undefined" && process.env ? "0.61.0" : void 0) || "unknown";
6347
6341
 
6348
6342
  // src/utils/open-url.ts
6349
6343
  var nodePrefix = "node:";
@@ -0,0 +1,45 @@
1
+ export declare const createWorkflowPlugin: (sdk: {
2
+ context: {
3
+ api: import("../../..").ApiClient;
4
+ resolveCredentials: () => Promise<string | {
5
+ clientId: string;
6
+ clientSecret: string;
7
+ type?: "client_credentials" | undefined;
8
+ baseUrl?: string | undefined;
9
+ scope?: string | undefined;
10
+ } | {
11
+ clientId: string;
12
+ type?: "pkce" | undefined;
13
+ baseUrl?: string | undefined;
14
+ scope?: string | undefined;
15
+ } | undefined>;
16
+ };
17
+ } & {
18
+ context: import("../../eventEmission").EventEmissionContext;
19
+ } & {
20
+ context: {
21
+ meta: Record<string, import("../../..").PluginMeta>;
22
+ };
23
+ }) => {
24
+ createWorkflow: (options?: {
25
+ name: string;
26
+ description?: string | undefined;
27
+ } | undefined) => Promise<{
28
+ data: {
29
+ id: string;
30
+ name: string;
31
+ description: string | null;
32
+ trigger_url: string;
33
+ enabled: boolean;
34
+ created_at: string;
35
+ };
36
+ }>;
37
+ } & {
38
+ context: {
39
+ meta: {
40
+ createWorkflow: import("../../..").PluginMeta;
41
+ };
42
+ };
43
+ };
44
+ export type CreateWorkflowPluginProvides = ReturnType<typeof createWorkflowPlugin>;
45
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/plugins/codeSubstrate/createWorkflow/index.ts"],"names":[],"mappings":"AAUA,eAAO,MAAM,oBAAoB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAsBhC,CAAC;AAEF,MAAM,MAAM,4BAA4B,GAAG,UAAU,CACnD,OAAO,oBAAoB,CAC5B,CAAC"}
@@ -0,0 +1,19 @@
1
+ import { definePlugin, createPluginMethod } from "../../../utils/plugin-utils";
2
+ import { codeSubstrateDefaults } from "../shared";
3
+ import { CreateWorkflowOptionsSchema, CreateWorkflowResponseSchema, } from "./schemas";
4
+ export const createWorkflowPlugin = definePlugin((sdk) => createPluginMethod(sdk, {
5
+ ...codeSubstrateDefaults,
6
+ name: "createWorkflow",
7
+ type: "create",
8
+ itemType: "Workflow",
9
+ inputSchema: CreateWorkflowOptionsSchema,
10
+ outputSchema: CreateWorkflowResponseSchema,
11
+ handler: async ({ sdk, options }) => {
12
+ const body = { name: options.name };
13
+ if (options.description !== undefined) {
14
+ body.description = options.description;
15
+ }
16
+ const data = await sdk.context.api.post("/durableworkflowzaps/api/v0/workflows", body, { authRequired: true });
17
+ return { data };
18
+ },
19
+ }));
@@ -0,0 +1,16 @@
1
+ import { z } from "zod";
2
+ export declare const CreateWorkflowOptionsSchema: z.ZodObject<{
3
+ name: z.ZodString;
4
+ description: z.ZodOptional<z.ZodString>;
5
+ }, z.core.$strip>;
6
+ export type CreateWorkflowOptions = z.infer<typeof CreateWorkflowOptionsSchema>;
7
+ export declare const CreateWorkflowResponseSchema: z.ZodObject<{
8
+ id: z.ZodString;
9
+ name: z.ZodString;
10
+ description: z.ZodNullable<z.ZodString>;
11
+ trigger_url: z.ZodString;
12
+ enabled: z.ZodBoolean;
13
+ created_at: z.ZodString;
14
+ }, z.core.$strip>;
15
+ export type CreateWorkflowResponse = z.infer<typeof CreateWorkflowResponseSchema>;
16
+ //# sourceMappingURL=schemas.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"schemas.d.ts","sourceRoot":"","sources":["../../../../src/plugins/codeSubstrate/createWorkflow/schemas.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,eAAO,MAAM,2BAA2B;;;iBAUrC,CAAC;AAEJ,MAAM,MAAM,qBAAqB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,2BAA2B,CAAC,CAAC;AAEhF,eAAO,MAAM,4BAA4B;;;;;;;iBAkBvC,CAAC;AAEH,MAAM,MAAM,sBAAsB,GAAG,CAAC,CAAC,KAAK,CAC1C,OAAO,4BAA4B,CACpC,CAAC"}
@@ -0,0 +1,25 @@
1
+ import { z } from "zod";
2
+ export const CreateWorkflowOptionsSchema = z
3
+ .object({
4
+ name: z.string().min(1).describe("Workflow name"),
5
+ description: z
6
+ .string()
7
+ .optional()
8
+ .describe("Optional description for the workflow"),
9
+ })
10
+ .describe("Create a durable workflow container. Starts disabled with no version; publish a version to add code.");
11
+ export const CreateWorkflowResponseSchema = z.object({
12
+ id: z.string().describe("Workflow ID (UUID)"),
13
+ name: z.string().describe("Workflow name"),
14
+ description: z
15
+ .string()
16
+ .nullable()
17
+ .describe("Workflow description (null if unset)"),
18
+ trigger_url: z
19
+ .string()
20
+ .describe("Public webhook URL that fires this workflow when POSTed to. Embeds a secret trigger token in the path — treat as sensitive."),
21
+ enabled: z
22
+ .boolean()
23
+ .describe("Whether the workflow currently accepts triggers. Always false on a new workflow until enabled."),
24
+ created_at: z.string().describe("When the workflow was created (ISO-8601)"),
25
+ });
@@ -0,0 +1,39 @@
1
+ export declare const deleteWorkflowPlugin: (sdk: {
2
+ context: {
3
+ api: import("../../..").ApiClient;
4
+ resolveCredentials: () => Promise<string | {
5
+ clientId: string;
6
+ clientSecret: string;
7
+ type?: "client_credentials" | undefined;
8
+ baseUrl?: string | undefined;
9
+ scope?: string | undefined;
10
+ } | {
11
+ clientId: string;
12
+ type?: "pkce" | undefined;
13
+ baseUrl?: string | undefined;
14
+ scope?: string | undefined;
15
+ } | undefined>;
16
+ };
17
+ } & {
18
+ context: import("../../eventEmission").EventEmissionContext;
19
+ } & {
20
+ context: {
21
+ meta: Record<string, import("../../..").PluginMeta>;
22
+ };
23
+ }) => {
24
+ deleteWorkflow: (options?: {
25
+ workflow: string;
26
+ } | undefined) => Promise<{
27
+ data: {
28
+ id: string;
29
+ };
30
+ }>;
31
+ } & {
32
+ context: {
33
+ meta: {
34
+ deleteWorkflow: import("../../..").PluginMeta;
35
+ };
36
+ };
37
+ };
38
+ export type DeleteWorkflowPluginProvides = ReturnType<typeof deleteWorkflowPlugin>;
39
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/plugins/codeSubstrate/deleteWorkflow/index.ts"],"names":[],"mappings":"AAOA,eAAO,MAAM,oBAAoB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA6BhC,CAAC;AAEF,MAAM,MAAM,4BAA4B,GAAG,UAAU,CACnD,OAAO,oBAAoB,CAC5B,CAAC"}
@@ -0,0 +1,27 @@
1
+ import { definePlugin, createPluginMethod } from "../../../utils/plugin-utils";
2
+ import { workflowIdResolver } from "../../../resolvers/workflowId";
3
+ import { codeSubstrateDefaults } from "../shared";
4
+ import { DeleteWorkflowOptionsSchema } from "./schemas";
5
+ export const deleteWorkflowPlugin = definePlugin((sdk) => createPluginMethod(sdk, {
6
+ ...codeSubstrateDefaults,
7
+ name: "deleteWorkflow",
8
+ type: "delete",
9
+ itemType: "Workflow",
10
+ confirm: "delete",
11
+ inputSchema: DeleteWorkflowOptionsSchema,
12
+ resolvers: { workflow: workflowIdResolver },
13
+ handler: async ({ sdk, options }) => {
14
+ // Backend returns 204 on success. 404 (workflow missing) propagates
15
+ // as ZapierNotFoundError. We intentionally don't fold 404 into a
16
+ // synthesized "already-deleted" outcome — the resource hint is
17
+ // caller-supplied (the SDK tagged the request itself), so an
18
+ // upstream / proxy / gateway 404 would falsely tell the caller
19
+ // the workflow was deleted. Callers wanting idempotency can
20
+ // catch ZapierNotFoundError themselves.
21
+ await sdk.context.api.delete(`/durableworkflowzaps/api/v0/workflows/${encodeURIComponent(options.workflow)}`, undefined, {
22
+ authRequired: true,
23
+ resource: { type: "workflow", id: options.workflow },
24
+ });
25
+ return { data: { id: options.workflow } };
26
+ },
27
+ }));
@@ -0,0 +1,6 @@
1
+ import { z } from "zod";
2
+ export declare const DeleteWorkflowOptionsSchema: z.ZodObject<{
3
+ workflow: z.ZodString;
4
+ }, z.core.$strip>;
5
+ export type DeleteWorkflowOptions = z.infer<typeof DeleteWorkflowOptionsSchema>;
6
+ //# sourceMappingURL=schemas.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"schemas.d.ts","sourceRoot":"","sources":["../../../../src/plugins/codeSubstrate/deleteWorkflow/schemas.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,eAAO,MAAM,2BAA2B;;iBAMrC,CAAC;AAEJ,MAAM,MAAM,qBAAqB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,2BAA2B,CAAC,CAAC"}
@@ -0,0 +1,6 @@
1
+ import { z } from "zod";
2
+ export const DeleteWorkflowOptionsSchema = z
3
+ .object({
4
+ workflow: z.string().uuid().describe("Durable workflow ID"),
5
+ })
6
+ .describe("Delete a durable workflow. Throws `ZapierNotFoundError` if the workflow doesn't exist; callers wanting idempotency should catch that themselves.");
@@ -0,0 +1,40 @@
1
+ export declare const disableWorkflowPlugin: (sdk: {
2
+ context: {
3
+ api: import("../../..").ApiClient;
4
+ resolveCredentials: () => Promise<string | {
5
+ clientId: string;
6
+ clientSecret: string;
7
+ type?: "client_credentials" | undefined;
8
+ baseUrl?: string | undefined;
9
+ scope?: string | undefined;
10
+ } | {
11
+ clientId: string;
12
+ type?: "pkce" | undefined;
13
+ baseUrl?: string | undefined;
14
+ scope?: string | undefined;
15
+ } | undefined>;
16
+ };
17
+ } & {
18
+ context: import("../../eventEmission").EventEmissionContext;
19
+ } & {
20
+ context: {
21
+ meta: Record<string, import("../../..").PluginMeta>;
22
+ };
23
+ }) => {
24
+ disableWorkflow: (options?: {
25
+ workflow: string;
26
+ } | undefined) => Promise<{
27
+ data: {
28
+ id: string;
29
+ enabled: boolean;
30
+ };
31
+ }>;
32
+ } & {
33
+ context: {
34
+ meta: {
35
+ disableWorkflow: import("../../..").PluginMeta;
36
+ };
37
+ };
38
+ };
39
+ export type DisableWorkflowPluginProvides = ReturnType<typeof disableWorkflowPlugin>;
40
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/plugins/codeSubstrate/disableWorkflow/index.ts"],"names":[],"mappings":"AAWA,eAAO,MAAM,qBAAqB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAsBjC,CAAC;AAEF,MAAM,MAAM,6BAA6B,GAAG,UAAU,CACpD,OAAO,qBAAqB,CAC7B,CAAC"}
@@ -0,0 +1,20 @@
1
+ import { definePlugin, createPluginMethod } from "../../../utils/plugin-utils";
2
+ import { workflowIdResolver } from "../../../resolvers/workflowId";
3
+ import { codeSubstrateDefaults } from "../shared";
4
+ import { DisableWorkflowOptionsSchema, DisableWorkflowResponseSchema, } from "./schemas";
5
+ export const disableWorkflowPlugin = definePlugin((sdk) => createPluginMethod(sdk, {
6
+ ...codeSubstrateDefaults,
7
+ name: "disableWorkflow",
8
+ type: "update",
9
+ itemType: "Workflow",
10
+ inputSchema: DisableWorkflowOptionsSchema,
11
+ outputSchema: DisableWorkflowResponseSchema,
12
+ resolvers: { workflow: workflowIdResolver },
13
+ handler: async ({ sdk, options }) => {
14
+ const data = await sdk.context.api.post(`/durableworkflowzaps/api/v0/workflows/${encodeURIComponent(options.workflow)}/disable`, undefined, {
15
+ authRequired: true,
16
+ resource: { type: "workflow", id: options.workflow },
17
+ });
18
+ return { data };
19
+ },
20
+ }));
@@ -0,0 +1,11 @@
1
+ import { z } from "zod";
2
+ export declare const DisableWorkflowOptionsSchema: z.ZodObject<{
3
+ workflow: z.ZodString;
4
+ }, z.core.$strip>;
5
+ export type DisableWorkflowOptions = z.infer<typeof DisableWorkflowOptionsSchema>;
6
+ export declare const DisableWorkflowResponseSchema: z.ZodObject<{
7
+ id: z.ZodString;
8
+ enabled: z.ZodBoolean;
9
+ }, z.core.$strip>;
10
+ export type DisableWorkflowResponse = z.infer<typeof DisableWorkflowResponseSchema>;
11
+ //# sourceMappingURL=schemas.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"schemas.d.ts","sourceRoot":"","sources":["../../../../src/plugins/codeSubstrate/disableWorkflow/schemas.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,eAAO,MAAM,4BAA4B;;iBAI+B,CAAC;AAEzE,MAAM,MAAM,sBAAsB,GAAG,CAAC,CAAC,KAAK,CAC1C,OAAO,4BAA4B,CACpC,CAAC;AAEF,eAAO,MAAM,6BAA6B;;;iBAOxC,CAAC;AAEH,MAAM,MAAM,uBAAuB,GAAG,CAAC,CAAC,KAAK,CAC3C,OAAO,6BAA6B,CACrC,CAAC"}
@@ -0,0 +1,12 @@
1
+ import { z } from "zod";
2
+ export const DisableWorkflowOptionsSchema = z
3
+ .object({
4
+ workflow: z.string().uuid().describe("Durable workflow ID"),
5
+ })
6
+ .describe("Disable a durable workflow so it stops accepting triggers");
7
+ export const DisableWorkflowResponseSchema = z.object({
8
+ id: z.string().describe("Workflow ID (UUID)"),
9
+ enabled: z
10
+ .boolean()
11
+ .describe("Workflow's enabled state after the operation. Typically false; mirrors the row's true state in case a concurrent enable raced with this call."),
12
+ });
@@ -0,0 +1,40 @@
1
+ export declare const enableWorkflowPlugin: (sdk: {
2
+ context: {
3
+ api: import("../../..").ApiClient;
4
+ resolveCredentials: () => Promise<string | {
5
+ clientId: string;
6
+ clientSecret: string;
7
+ type?: "client_credentials" | undefined;
8
+ baseUrl?: string | undefined;
9
+ scope?: string | undefined;
10
+ } | {
11
+ clientId: string;
12
+ type?: "pkce" | undefined;
13
+ baseUrl?: string | undefined;
14
+ scope?: string | undefined;
15
+ } | undefined>;
16
+ };
17
+ } & {
18
+ context: import("../../eventEmission").EventEmissionContext;
19
+ } & {
20
+ context: {
21
+ meta: Record<string, import("../../..").PluginMeta>;
22
+ };
23
+ }) => {
24
+ enableWorkflow: (options?: {
25
+ workflow: string;
26
+ } | undefined) => Promise<{
27
+ data: {
28
+ id: string;
29
+ enabled: boolean;
30
+ };
31
+ }>;
32
+ } & {
33
+ context: {
34
+ meta: {
35
+ enableWorkflow: import("../../..").PluginMeta;
36
+ };
37
+ };
38
+ };
39
+ export type EnableWorkflowPluginProvides = ReturnType<typeof enableWorkflowPlugin>;
40
+ //# sourceMappingURL=index.d.ts.map