@zapier/zapier-sdk 0.91.0 → 0.92.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 +24 -0
- package/README.md +16 -15
- package/dist/{chunk-RO34ZWKR.cjs → chunk-F5I2GDLO.cjs} +274 -26
- package/dist/{chunk-SZBWDVX3.mjs → chunk-G52V3IGZ.mjs} +274 -26
- package/dist/experimental.cjs +476 -374
- package/dist/experimental.d.mts +140 -3
- package/dist/experimental.d.ts +140 -3
- package/dist/experimental.mjs +105 -3
- package/dist/{index-BBBkZ80x.d.mts → index-ixzNJW7G.d.mts} +211 -4
- package/dist/{index-BBBkZ80x.d.ts → index-ixzNJW7G.d.ts} +211 -4
- package/dist/index.cjs +272 -272
- package/dist/index.d.mts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.mjs +1 -1
- package/package.json +2 -2
package/dist/experimental.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { defineMethod, DEFAULT_PAGE_SIZE, apiPluginRef, workflowIdResolver, openEnum, durableRunIdResolver, defineResolver,
|
|
2
|
-
export { API_ID, ActionKeyPropertySchema, ActionPropertySchema, ActionTimeoutMillisecondsPropertySchema, ActionTimeoutSecondsPropertySchema, ActionTypePropertySchema, AppKeyPropertySchema, AppPropertySchema, AppsPropertySchema, AuthMechanism, AuthenticationIdPropertySchema, BaseSdkOptionsSchema, CONNECTIONS_ID, CONTEXT, CONTEXT_CACHE_MAX_SIZE, CONTEXT_CACHE_TTL_MILLISECONDS, CORE_ERROR_SYMBOL, CORE_OPTIONS_ID, CORE_SIGNAL_SYMBOL, ClientCredentialsObjectSchema, ConnectionEntrySchema, ConnectionIdPropertySchema, ConnectionPropertySchema, ConnectionsMapSchema, ConnectionsPropertySchema, CoreCancelledSignal, CoreDisposeError, CoreErrorCode, CoreSignal, CredentialsFunctionSchema, CredentialsObjectSchema, CredentialsSchema, DEFAULT_ACTION_TIMEOUT_MILLISECONDS, DEFAULT_APPROVAL_TIMEOUT_MILLISECONDS, DEFAULT_CONFIG_PATH, DEFAULT_MAX_APPROVAL_RETRIES, DEFAULT_PAGE_SIZE, DEPRECATION_NOTICE_EVENT, DebugPropertySchema, DrainTriggerInboxSchema, EVENT_EMISSION_ID, FieldsPropertySchema, InputFieldPropertySchema, InputsPropertySchema, LeaseLimitPropertySchema, LeasePropertySchema, LeaseSecondsPropertySchema, LimitPropertySchema, MANIFEST_ID, MAX_CONCURRENCY_LIMIT, MAX_PAGE_LIMIT, OffsetPropertySchema, OutputPropertySchema, ParamsPropertySchema, PkceCredentialsObjectSchema, RESOLVE_CREDENTIALS_ID, RecordPropertySchema, RecordsPropertySchema, RelayFetchSchema, RelayRequestSchema, ResolvedCredentialsSchema, SDK_OPTIONS_ID, TablePropertySchema, TablesPropertySchema, TriggerInboxKeyPropertySchema, TriggerInboxNamePropertySchema, TriggerInboxPropertySchema, WatchTriggerInboxSchema, ZAPIER_BASE_URL, ZAPIER_MAX_CONCURRENT_REQUESTS, ZAPIER_MAX_NETWORK_RETRIES, ZAPIER_MAX_NETWORK_RETRY_DELAY_MILLISECONDS, ZapierAbortDrainSignal, ZapierActionError, ZapierApiError, ZapierAppNotFoundError, ZapierApprovalError, ZapierAuthenticationError, ZapierBundleError, ZapierConfigurationError, ZapierConflictError, ZapierError, ZapierNotFoundError, ZapierRateLimitError, ZapierRelayError, ZapierReleaseTriggerMessageSignal, ZapierResourceNotFoundError, ZapierSignal, ZapierTimeoutError, ZapierUnknownError, ZapierValidationError, actionKeyResolver, actionTypeResolver, addPlugin, apiPlugin, apiPluginRef, appKeyResolver, appsPlugin, batch, buildApplicationLifecycleEvent, buildCapabilityMessage, buildErrorEvent, buildErrorEventWithContext, buildMethodCalledEvent, cleanupEventListeners, clearTokenCache, clientCredentialsNameResolver, clientIdResolver, composePlugins, connectionIdGenericResolver, connectionIdResolver, connectionsPlugin, connectionsPluginRef, createBaseEvent, createClientCredentialsPlugin, createController, createCorePlugin, createFunction, createMemoryCache, createPaginatedFunction, createPaginatedPluginMethod, createPluginMethod, createPluginStack, createSdk, createTableFieldsPlugin, createTablePlugin, createTableRecordsPlugin, createZapierApi, createZapierSdkWithoutRegistry, declareMethod, declareOptionalProperty, declarePlugin, declareProperty, defineFormatter, defineLegacyMerge, defineMethod, defineMethodOverride, definePlugin, defineProperty, defineResolver, deleteClientCredentialsPlugin, deleteTableFieldsPlugin, deleteTablePlugin, deleteTableRecordsPlugin, disposeSdk, durableRunIdResolver, eventEmissionHookPlugin, eventEmissionPlugin, eventEmissionPluginRef, fetchPlugin, findFirstConnectionPlugin, findManifestEntry, findUniqueConnectionPlugin, formatErrorMessage, fromFunctionPlugin, generateEventId, getActionInputFieldsSchemaPlugin, getActionPlugin, getAgent, getAppPlugin, getBaseUrlFromCredentials, getCallerContext, getCiPlatform, getClientIdFromCredentials, getConnectionPlugin, getContext, getCoreErrorCause, getCoreErrorCode, getCpuTime, getCurrentTimestamp, getMemoryUsage, getOrCreateApiClient, getOsInfo, getPlatformVersions, getPreferredManifestEntryKey, getProfilePlugin, getRegistryPlugin, getReleaseId, getTablePlugin, getTableRecordPlugin, getTokenFromCliLogin, getTtyContext, getZapierApprovalMode, getZapierDefaultApprovalMode, getZapierOpenAutoModeApprovalsInBrowser, getZapierSdkService, injectCliLogin, inputFieldKeyResolver, inputsAllOptionalResolver, inputsResolver, invalidateCachedToken, invalidateCredentialsToken, isCi, isCliLoginAvailable, isClientCredentials, isCoreCancelledSignal, isCoreError, isCoreSignal, isCredentialsFunction, isCredentialsObject, isPermanentHttpError, isPkceCredentials, isPositional, isZapierAbortDrainSignal, isZapierActionError, isZapierAppNotFoundError, isZapierApprovalError, isZapierAuthenticationError, isZapierBundleError, isZapierConflictError, isZapierError, isZapierNotFoundError, isZapierRateLimitError, isZapierReleaseTriggerMessageSignal, isZapierResourceNotFoundError, isZapierSignal, isZapierTimeoutError, isZapierValidationError, listActionInputFieldChoicesPlugin, listActionInputFieldsPlugin, listActionsPlugin, listAppsPlugin, listClientCredentialsPlugin, listConnectionsPlugin, listTableFieldsPlugin, listTableRecordsPlugin, listTablesPlugin, logDeprecation, manifestPlugin, manifestPluginRef, omitExports, operationAnnotatorPlugin, parseConcurrencyEnvVar, readManifestFromFile, registryPlugin, requestPlugin, resetDeprecationWarnings, resolveAuth, resolveAuthToken, resolveCredentials, resolveCredentialsFromEnv, resolveCredentialsPlugin, resolveCredentialsPluginRef, resolvePlugin, runActionPlugin, runInMethodScope, runWithCallerContext, runWithTelemetryContext, sdkOptionsPluginRef, selectExports, tableFieldIdsResolver, tableFieldsResolver, tableFiltersResolver, tableIdResolver, tableNameResolver, tableRecordIdResolver, tableRecordIdsResolver, tableRecordsResolver, tableSortResolver, tableUpdateRecordsResolver, toSnakeCase, toTitleCase, triggerInboxResolver, triggerMessagesResolver, updateTableRecordsPlugin, workflowDraftIdResolver, workflowIdResolver, workflowRunIdResolver, workflowVersionIdResolver, zapierAdaptError, zapierCoreOptions, zapierSdkPlugin } from './chunk-
|
|
1
|
+
import { defineMethod, DEFAULT_PAGE_SIZE, apiPluginRef, workflowIdResolver, openEnum, durableRunIdResolver, defineResolver, ZapierConflictError, extractErrorDetail, workflowVersionIdResolver, workflowDraftIdResolver, ZapierApiError, workflowRunIdResolver, definePlugin, zapierSdkPlugin, ZapierValidationError, createSdk, zapierCoreOptions, CORE_OPTIONS_ID, SDK_OPTIONS_ID } from './chunk-G52V3IGZ.mjs';
|
|
2
|
+
export { API_ID, ActionKeyPropertySchema, ActionPropertySchema, ActionTimeoutMillisecondsPropertySchema, ActionTimeoutSecondsPropertySchema, ActionTypePropertySchema, AppKeyPropertySchema, AppPropertySchema, AppsPropertySchema, AuthMechanism, AuthenticationIdPropertySchema, BaseSdkOptionsSchema, CONNECTIONS_ID, CONTEXT, CONTEXT_CACHE_MAX_SIZE, CONTEXT_CACHE_TTL_MILLISECONDS, CORE_ERROR_SYMBOL, CORE_OPTIONS_ID, CORE_SIGNAL_SYMBOL, ClientCredentialsObjectSchema, ConnectionEntrySchema, ConnectionIdPropertySchema, ConnectionPropertySchema, ConnectionsMapSchema, ConnectionsPropertySchema, CoreCancelledSignal, CoreDisposeError, CoreErrorCode, CoreSignal, CredentialsFunctionSchema, CredentialsObjectSchema, CredentialsSchema, DEFAULT_ACTION_TIMEOUT_MILLISECONDS, DEFAULT_APPROVAL_TIMEOUT_MILLISECONDS, DEFAULT_CONFIG_PATH, DEFAULT_MAX_APPROVAL_RETRIES, DEFAULT_PAGE_SIZE, DEPRECATION_NOTICE_EVENT, DebugPropertySchema, DrainTriggerInboxSchema, EVENT_EMISSION_ID, FieldsPropertySchema, InputFieldPropertySchema, InputsPropertySchema, LeaseLimitPropertySchema, LeasePropertySchema, LeaseSecondsPropertySchema, LimitPropertySchema, MANIFEST_ID, MAX_CONCURRENCY_LIMIT, MAX_PAGE_LIMIT, OffsetPropertySchema, OutputPropertySchema, ParamsPropertySchema, PkceCredentialsObjectSchema, RESOLVE_CREDENTIALS_ID, RecordPropertySchema, RecordsPropertySchema, RelayFetchSchema, RelayRequestSchema, ResolvedCredentialsSchema, SDK_OPTIONS_ID, TablePropertySchema, TablesPropertySchema, TriggerInboxKeyPropertySchema, TriggerInboxNamePropertySchema, TriggerInboxPropertySchema, WatchTriggerInboxSchema, ZAPIER_BASE_URL, ZAPIER_MAX_CONCURRENT_REQUESTS, ZAPIER_MAX_NETWORK_RETRIES, ZAPIER_MAX_NETWORK_RETRY_DELAY_MILLISECONDS, ZapierAbortDrainSignal, ZapierActionError, ZapierApiError, ZapierAppNotFoundError, ZapierApprovalError, ZapierAuthenticationError, ZapierBundleError, ZapierConfigurationError, ZapierConflictError, ZapierError, ZapierNotFoundError, ZapierRateLimitError, ZapierRelayError, ZapierReleaseTriggerMessageSignal, ZapierResourceNotFoundError, ZapierSignal, ZapierTimeoutError, ZapierUnknownError, ZapierValidationError, actionKeyResolver, actionTypeResolver, addPlugin, apiPlugin, apiPluginRef, appKeyResolver, appsPlugin, batch, buildApplicationLifecycleEvent, buildCapabilityMessage, buildErrorEvent, buildErrorEventWithContext, buildMethodCalledEvent, cleanupEventListeners, clearTokenCache, clientCredentialsNameResolver, clientIdResolver, composePlugins, connectionIdGenericResolver, connectionIdResolver, connectionsPlugin, connectionsPluginRef, createBaseEvent, createClientCredentialsPlugin, createController, createCorePlugin, createFunction, createMemoryCache, createPaginatedFunction, createPaginatedPluginMethod, createPluginMethod, createPluginStack, createSdk, createTableFieldsPlugin, createTablePlugin, createTableRecordsPlugin, createZapierApi, createZapierSdkWithoutRegistry, declareMethod, declareOptionalProperty, declarePlugin, declareProperty, defineFormatter, defineLegacyMerge, defineMethod, defineMethodOverride, definePlugin, defineProperty, defineResolver, deleteClientCredentialsPlugin, deleteTableFieldsPlugin, deleteTablePlugin, deleteTableRecordsPlugin, disposeSdk, durableRunIdResolver, eventEmissionHookPlugin, eventEmissionPlugin, eventEmissionPluginRef, fetchPlugin, findFirstConnectionPlugin, findManifestEntry, findUniqueConnectionPlugin, formatErrorMessage, fromFunctionPlugin, generateEventId, getActionInputFieldsSchemaPlugin, getActionPlugin, getAgent, getAppPlugin, getBaseUrlFromCredentials, getCallerContext, getCiPlatform, getClientIdFromCredentials, getConnectionPlugin, getContext, getCoreErrorCause, getCoreErrorCode, getCpuTime, getCurrentTimestamp, getMemoryUsage, getOrCreateApiClient, getOsInfo, getPlatformVersions, getPreferredManifestEntryKey, getProfilePlugin, getRegistryPlugin, getReleaseId, getTablePlugin, getTableRecordPlugin, getTokenFromCliLogin, getTtyContext, getZapierApprovalMode, getZapierDefaultApprovalMode, getZapierOpenAutoModeApprovalsInBrowser, getZapierSdkService, injectCliLogin, inputFieldKeyResolver, inputsAllOptionalResolver, inputsResolver, invalidateCachedToken, invalidateCredentialsToken, isCi, isCliLoginAvailable, isClientCredentials, isCoreCancelledSignal, isCoreError, isCoreSignal, isCredentialsFunction, isCredentialsObject, isPermanentHttpError, isPkceCredentials, isPositional, isZapierAbortDrainSignal, isZapierActionError, isZapierAppNotFoundError, isZapierApprovalError, isZapierAuthenticationError, isZapierBundleError, isZapierConflictError, isZapierError, isZapierNotFoundError, isZapierRateLimitError, isZapierReleaseTriggerMessageSignal, isZapierResourceNotFoundError, isZapierSignal, isZapierTimeoutError, isZapierValidationError, listActionInputFieldChoicesPlugin, listActionInputFieldsPlugin, listActionsPlugin, listAppsPlugin, listClientCredentialsPlugin, listConnectionsPlugin, listTableFieldsPlugin, listTableRecordsPlugin, listTablesPlugin, logDeprecation, manifestPlugin, manifestPluginRef, omitExports, operationAnnotatorPlugin, parseConcurrencyEnvVar, readManifestFromFile, registryPlugin, requestPlugin, resetDeprecationWarnings, resolveAuth, resolveAuthToken, resolveCredentials, resolveCredentialsFromEnv, resolveCredentialsPlugin, resolveCredentialsPluginRef, resolvePlugin, runActionPlugin, runInMethodScope, runWithCallerContext, runWithTelemetryContext, sdkOptionsPluginRef, selectExports, tableFieldIdsResolver, tableFieldsResolver, tableFiltersResolver, tableIdResolver, tableNameResolver, tableRecordIdResolver, tableRecordIdsResolver, tableRecordsResolver, tableSortResolver, tableUpdateRecordsResolver, toSnakeCase, toTitleCase, triggerInboxResolver, triggerMessagesResolver, updateTableRecordsPlugin, workflowDraftIdResolver, workflowIdResolver, workflowRunIdResolver, workflowVersionIdResolver, zapierAdaptError, zapierCoreOptions, zapierSdkPlugin } from './chunk-G52V3IGZ.mjs';
|
|
3
3
|
import './chunk-Y6FXYEAI.mjs';
|
|
4
4
|
import { z } from 'zod';
|
|
5
5
|
|
|
@@ -269,6 +269,7 @@ var listWorkflowsPlugin = defineMethod({
|
|
|
269
269
|
itemType: "Workflow",
|
|
270
270
|
inputSchema: ListWorkflowsOptionsSchema,
|
|
271
271
|
outputSchema: WorkflowItemSchema,
|
|
272
|
+
skipOutputValidation: true,
|
|
272
273
|
// The handler already returns a clean `{ data, nextCursor }` page, so the
|
|
273
274
|
// standard list output (no `adaptPage`) applies.
|
|
274
275
|
output: { type: "list", defaultPageSize: DEFAULT_PAGE_SIZE },
|
|
@@ -349,6 +350,7 @@ var getWorkflowPlugin = defineMethod({
|
|
|
349
350
|
itemType: "Workflow",
|
|
350
351
|
inputSchema: GetWorkflowOptionsSchema,
|
|
351
352
|
outputSchema: GetWorkflowResponseSchema,
|
|
353
|
+
skipOutputValidation: true,
|
|
352
354
|
output: "item",
|
|
353
355
|
resolvers: { workflow: workflowIdResolver },
|
|
354
356
|
run: async ({ imports, input }) => {
|
|
@@ -400,6 +402,7 @@ var createWorkflowPlugin = defineMethod({
|
|
|
400
402
|
itemType: "Workflow",
|
|
401
403
|
inputSchema: CreateWorkflowOptionsSchema,
|
|
402
404
|
outputSchema: CreateWorkflowResponseSchema,
|
|
405
|
+
skipOutputValidation: true,
|
|
403
406
|
output: "item",
|
|
404
407
|
run: async ({ imports, input }) => {
|
|
405
408
|
const api = imports.api;
|
|
@@ -451,6 +454,7 @@ var updateWorkflowPlugin = defineMethod({
|
|
|
451
454
|
itemType: "Workflow",
|
|
452
455
|
inputSchema: UpdateWorkflowOptionsSchema,
|
|
453
456
|
outputSchema: UpdateWorkflowResponseSchema,
|
|
457
|
+
skipOutputValidation: true,
|
|
454
458
|
output: "item",
|
|
455
459
|
resolvers: { workflow: workflowIdResolver },
|
|
456
460
|
run: async ({ imports, input }) => {
|
|
@@ -490,6 +494,7 @@ var enableWorkflowPlugin = defineMethod({
|
|
|
490
494
|
itemType: "Workflow",
|
|
491
495
|
inputSchema: EnableWorkflowOptionsSchema,
|
|
492
496
|
outputSchema: EnableWorkflowResponseSchema,
|
|
497
|
+
skipOutputValidation: true,
|
|
493
498
|
output: "item",
|
|
494
499
|
resolvers: { workflow: workflowIdResolver },
|
|
495
500
|
run: async ({ imports, input }) => {
|
|
@@ -524,6 +529,7 @@ var disableWorkflowPlugin = defineMethod({
|
|
|
524
529
|
itemType: "Workflow",
|
|
525
530
|
inputSchema: DisableWorkflowOptionsSchema,
|
|
526
531
|
outputSchema: DisableWorkflowResponseSchema,
|
|
532
|
+
skipOutputValidation: true,
|
|
527
533
|
output: "item",
|
|
528
534
|
resolvers: { workflow: workflowIdResolver },
|
|
529
535
|
run: async ({ imports, input }) => {
|
|
@@ -558,6 +564,7 @@ var deleteWorkflowPlugin = defineMethod({
|
|
|
558
564
|
confirm: "delete",
|
|
559
565
|
inputSchema: DeleteWorkflowOptionsSchema,
|
|
560
566
|
outputSchema: DeleteWorkflowResponseSchema,
|
|
567
|
+
skipOutputValidation: true,
|
|
561
568
|
output: "raw",
|
|
562
569
|
resolvers: { workflow: workflowIdResolver },
|
|
563
570
|
run: async ({ imports, input }) => {
|
|
@@ -628,6 +635,7 @@ var listDurableRunsPlugin = defineMethod({
|
|
|
628
635
|
itemType: "DurableRun",
|
|
629
636
|
inputSchema: ListDurableRunsOptionsSchema,
|
|
630
637
|
outputSchema: RunItemSchema,
|
|
638
|
+
skipOutputValidation: true,
|
|
631
639
|
// The handler already returns a clean `{ data, nextCursor }` page, so the
|
|
632
640
|
// standard list output (no `adaptPage`) applies.
|
|
633
641
|
output: { type: "list", defaultPageSize: DEFAULT_PAGE_SIZE },
|
|
@@ -748,6 +756,7 @@ var getDurableRunPlugin = defineMethod({
|
|
|
748
756
|
itemType: "DurableRun",
|
|
749
757
|
inputSchema: GetDurableRunOptionsSchema,
|
|
750
758
|
outputSchema: GetDurableRunResponseSchema,
|
|
759
|
+
skipOutputValidation: true,
|
|
751
760
|
output: "item",
|
|
752
761
|
resolvers: { run: durableRunIdResolver },
|
|
753
762
|
run: async ({ imports, input }) => {
|
|
@@ -848,6 +857,7 @@ var runDurablePlugin = defineMethod({
|
|
|
848
857
|
itemType: "DurableRun",
|
|
849
858
|
inputSchema: RunDurableOptionsSchema,
|
|
850
859
|
outputSchema: RunDurableResponseSchema,
|
|
860
|
+
skipOutputValidation: true,
|
|
851
861
|
output: "item",
|
|
852
862
|
resolvers: { sourceFiles: sourceFilesResolver },
|
|
853
863
|
run: async ({ imports, input }) => {
|
|
@@ -904,6 +914,7 @@ var cancelDurableRunPlugin = defineMethod({
|
|
|
904
914
|
itemType: "DurableRun",
|
|
905
915
|
inputSchema: CancelDurableRunOptionsSchema,
|
|
906
916
|
outputSchema: CancelDurableRunResponseSchema,
|
|
917
|
+
skipOutputValidation: true,
|
|
907
918
|
output: "item",
|
|
908
919
|
resolvers: { run: durableRunIdResolver },
|
|
909
920
|
run: async ({ imports, input }) => {
|
|
@@ -930,6 +941,9 @@ var PublishWorkflowVersionBaseSchema = z.object({
|
|
|
930
941
|
enabled: z.boolean().optional().describe(
|
|
931
942
|
"Enable the workflow after publishing. Defaults to true; pass false to publish without enabling."
|
|
932
943
|
),
|
|
944
|
+
ignoreOpenDrafts: z.boolean().optional().describe(
|
|
945
|
+
"Publish even though the workflow has open draft(s). Without this, the API rejects a direct publish with a 409 while any draft is open, since publishing the draft later would ship its stale content over this version."
|
|
946
|
+
),
|
|
933
947
|
connections: z.record(z.string(), ConnectionBindingSchema).nullish().describe(
|
|
934
948
|
"Map of connection aliases to Zapier connections used by the workflow. Pass `null` to clear an existing binding."
|
|
935
949
|
),
|
|
@@ -961,6 +975,46 @@ var PublishWorkflowVersionOptionsSchema = z.union([PublishWorkflowVersionSchema,
|
|
|
961
975
|
var PublishWorkflowVersionResponseSchema = WorkflowVersionSchema;
|
|
962
976
|
|
|
963
977
|
// src/plugins/codeSubstrate/publishWorkflowVersion/index.ts
|
|
978
|
+
function toOpenDraftRef(draft) {
|
|
979
|
+
if (typeof draft !== "object" || draft === null) return void 0;
|
|
980
|
+
const record = draft;
|
|
981
|
+
if (typeof record.id !== "string") return void 0;
|
|
982
|
+
const ref = { id: record.id };
|
|
983
|
+
if (typeof record.slug === "string") ref.slug = record.slug;
|
|
984
|
+
const lastEditedAt = record.last_edited_at;
|
|
985
|
+
if (typeof lastEditedAt === "string" || lastEditedAt === null) {
|
|
986
|
+
ref.last_edited_at = lastEditedAt;
|
|
987
|
+
}
|
|
988
|
+
const lastEditedByUserId = record.last_edited_by_user_id;
|
|
989
|
+
if (typeof lastEditedByUserId === "string" || lastEditedByUserId === null) {
|
|
990
|
+
ref.last_edited_by_user_id = lastEditedByUserId;
|
|
991
|
+
}
|
|
992
|
+
return ref;
|
|
993
|
+
}
|
|
994
|
+
function extractOpenDraftConflict(data) {
|
|
995
|
+
if (typeof data !== "object" || data === null) return void 0;
|
|
996
|
+
const errors = data.errors;
|
|
997
|
+
if (!Array.isArray(errors)) return void 0;
|
|
998
|
+
for (const entry of errors) {
|
|
999
|
+
if (typeof entry !== "object" || entry === null) continue;
|
|
1000
|
+
const meta = entry.meta;
|
|
1001
|
+
if (typeof meta !== "object" || meta === null) continue;
|
|
1002
|
+
const drafts = meta.open_drafts;
|
|
1003
|
+
if (!Array.isArray(drafts)) continue;
|
|
1004
|
+
const refs = drafts.map(toOpenDraftRef).filter((ref) => ref !== void 0);
|
|
1005
|
+
if (refs.length === 0) continue;
|
|
1006
|
+
const detail = entry.detail;
|
|
1007
|
+
return {
|
|
1008
|
+
openDrafts: refs,
|
|
1009
|
+
detail: typeof detail === "string" ? detail : void 0
|
|
1010
|
+
};
|
|
1011
|
+
}
|
|
1012
|
+
return void 0;
|
|
1013
|
+
}
|
|
1014
|
+
function describeOpenDraft(draft) {
|
|
1015
|
+
const label = draft.slug ? `${draft.slug} (id: ${draft.id})` : draft.id;
|
|
1016
|
+
return draft.last_edited_at ? ` \u2022 ${label}, last edited ${draft.last_edited_at}` : ` \u2022 ${label}`;
|
|
1017
|
+
}
|
|
964
1018
|
var publishWorkflowVersionPlugin = defineMethod({
|
|
965
1019
|
...codeSubstrateDefaults,
|
|
966
1020
|
name: "publishWorkflowVersion",
|
|
@@ -969,6 +1023,7 @@ var publishWorkflowVersionPlugin = defineMethod({
|
|
|
969
1023
|
itemType: "WorkflowVersion",
|
|
970
1024
|
inputSchema: PublishWorkflowVersionOptionsSchema,
|
|
971
1025
|
outputSchema: PublishWorkflowVersionResponseSchema,
|
|
1026
|
+
skipOutputValidation: true,
|
|
972
1027
|
output: "item",
|
|
973
1028
|
resolvers: { workflow: workflowIdResolver, sourceFiles: sourceFilesResolver },
|
|
974
1029
|
run: async ({ imports, input }) => {
|
|
@@ -986,6 +1041,9 @@ var publishWorkflowVersionPlugin = defineMethod({
|
|
|
986
1041
|
if (input.enabled !== void 0) {
|
|
987
1042
|
body.enabled = input.enabled;
|
|
988
1043
|
}
|
|
1044
|
+
if (input.ignoreOpenDrafts !== void 0) {
|
|
1045
|
+
body.ignore_open_drafts = input.ignoreOpenDrafts;
|
|
1046
|
+
}
|
|
989
1047
|
if (input.connections === null) {
|
|
990
1048
|
body.connections = null;
|
|
991
1049
|
} else if (input.connections !== void 0) {
|
|
@@ -1004,7 +1062,39 @@ var publishWorkflowVersionPlugin = defineMethod({
|
|
|
1004
1062
|
body,
|
|
1005
1063
|
{
|
|
1006
1064
|
authRequired: true,
|
|
1007
|
-
resource: { type: "workflow", id: input.workflow }
|
|
1065
|
+
resource: { type: "workflow", id: input.workflow },
|
|
1066
|
+
// Every 409 from this endpoint is a conflict, so every 409 maps to
|
|
1067
|
+
// ZapierConflictError — mirroring publishWorkflowDraft, and keeping
|
|
1068
|
+
// isZapierConflictError(error) reliable across both publish paths.
|
|
1069
|
+
// The open-draft publish guard's 409 additionally carries
|
|
1070
|
+
// `meta.open_drafts`; surface that list and the remediations instead
|
|
1071
|
+
// of flattening to a generic message — otherwise the caller has to
|
|
1072
|
+
// pick between force-publishing and draft-publishing without seeing
|
|
1073
|
+
// what they'd be forcing over. The structured list rides on the
|
|
1074
|
+
// error's `meta` for programmatic use (CLI --json).
|
|
1075
|
+
customErrorHandler: ({ status, data }) => {
|
|
1076
|
+
if (status !== 409) return void 0;
|
|
1077
|
+
const conflict = extractOpenDraftConflict(data);
|
|
1078
|
+
if (!conflict) {
|
|
1079
|
+
return new ZapierConflictError(
|
|
1080
|
+
extractErrorDetail(data) ?? "Workflow version publish conflict.",
|
|
1081
|
+
{ statusCode: status, resourceType: "workflow" }
|
|
1082
|
+
);
|
|
1083
|
+
}
|
|
1084
|
+
const detail = conflict.detail ?? "Cannot publish over open draft(s).";
|
|
1085
|
+
return new ZapierConflictError(
|
|
1086
|
+
[
|
|
1087
|
+
`${detail} Blocking draft(s):`,
|
|
1088
|
+
...conflict.openDrafts.map(describeOpenDraft),
|
|
1089
|
+
"To keep a draft's changes, publish it with publishWorkflowDraft (CLI: publish-workflow-draft); to abandon them, discard it with discardWorkflowDraft (CLI: discard-workflow-draft); or force-publish over it by retrying with ignoreOpenDrafts: true (CLI: --ignore-open-drafts)."
|
|
1090
|
+
].join("\n"),
|
|
1091
|
+
{
|
|
1092
|
+
statusCode: status,
|
|
1093
|
+
resourceType: "workflow",
|
|
1094
|
+
meta: { open_drafts: conflict.openDrafts }
|
|
1095
|
+
}
|
|
1096
|
+
);
|
|
1097
|
+
}
|
|
1008
1098
|
}
|
|
1009
1099
|
);
|
|
1010
1100
|
return { data: PublishWorkflowVersionResponseSchema.parse(raw) };
|
|
@@ -1052,6 +1142,7 @@ var listWorkflowVersionsPlugin = defineMethod({
|
|
|
1052
1142
|
itemType: "WorkflowVersion",
|
|
1053
1143
|
inputSchema: ListWorkflowVersionsOptionsSchema,
|
|
1054
1144
|
outputSchema: WorkflowVersionListItemSchema,
|
|
1145
|
+
skipOutputValidation: true,
|
|
1055
1146
|
// The handler already returns a clean `{ data, nextCursor }` page, so the
|
|
1056
1147
|
// standard list output (no `adaptPage`) applies.
|
|
1057
1148
|
output: { type: "list", defaultPageSize: DEFAULT_PAGE_SIZE },
|
|
@@ -1094,6 +1185,7 @@ var getWorkflowVersionPlugin = defineMethod({
|
|
|
1094
1185
|
itemType: "WorkflowVersion",
|
|
1095
1186
|
inputSchema: GetWorkflowVersionOptionsSchema,
|
|
1096
1187
|
outputSchema: GetWorkflowVersionResponseSchema,
|
|
1188
|
+
skipOutputValidation: true,
|
|
1097
1189
|
output: "item",
|
|
1098
1190
|
resolvers: {
|
|
1099
1191
|
workflow: workflowIdResolver,
|
|
@@ -1158,6 +1250,7 @@ var listWorkflowDraftsPlugin = defineMethod({
|
|
|
1158
1250
|
itemType: "WorkflowDraft",
|
|
1159
1251
|
inputSchema: ListWorkflowDraftsOptionsSchema,
|
|
1160
1252
|
outputSchema: WorkflowDraftSummarySchema,
|
|
1253
|
+
skipOutputValidation: true,
|
|
1161
1254
|
// The handler already returns a clean `{ data, nextCursor }` page, so the
|
|
1162
1255
|
// standard list output (no `adaptPage`) applies.
|
|
1163
1256
|
output: { type: "list", defaultPageSize: DEFAULT_PAGE_SIZE },
|
|
@@ -1206,6 +1299,7 @@ var getWorkflowDraftPlugin = defineMethod({
|
|
|
1206
1299
|
itemType: "WorkflowDraft",
|
|
1207
1300
|
inputSchema: GetWorkflowDraftOptionsSchema,
|
|
1208
1301
|
outputSchema: GetWorkflowDraftResponseSchema,
|
|
1302
|
+
skipOutputValidation: true,
|
|
1209
1303
|
output: "item",
|
|
1210
1304
|
resolvers: {
|
|
1211
1305
|
workflow: workflowIdResolver,
|
|
@@ -1242,6 +1336,7 @@ var createWorkflowDraftPlugin = defineMethod({
|
|
|
1242
1336
|
itemType: "WorkflowDraft",
|
|
1243
1337
|
inputSchema: CreateWorkflowDraftOptionsSchema,
|
|
1244
1338
|
outputSchema: CreateWorkflowDraftResponseSchema,
|
|
1339
|
+
skipOutputValidation: true,
|
|
1245
1340
|
output: "item",
|
|
1246
1341
|
resolvers: { workflow: workflowIdResolver },
|
|
1247
1342
|
run: async ({ imports, input }) => {
|
|
@@ -1293,6 +1388,7 @@ var updateWorkflowDraftPlugin = defineMethod({
|
|
|
1293
1388
|
itemType: "WorkflowDraft",
|
|
1294
1389
|
inputSchema: UpdateWorkflowDraftOptionsSchema,
|
|
1295
1390
|
outputSchema: UpdateWorkflowDraftResponseSchema,
|
|
1391
|
+
skipOutputValidation: true,
|
|
1296
1392
|
output: "item",
|
|
1297
1393
|
resolvers: {
|
|
1298
1394
|
workflow: workflowIdResolver,
|
|
@@ -1374,6 +1470,7 @@ var discardWorkflowDraftPlugin = defineMethod({
|
|
|
1374
1470
|
confirm: "delete",
|
|
1375
1471
|
inputSchema: DiscardWorkflowDraftOptionsSchema,
|
|
1376
1472
|
outputSchema: DiscardWorkflowDraftResponseSchema,
|
|
1473
|
+
skipOutputValidation: true,
|
|
1377
1474
|
output: "item",
|
|
1378
1475
|
resolvers: {
|
|
1379
1476
|
workflow: workflowIdResolver,
|
|
@@ -1425,6 +1522,7 @@ var publishWorkflowDraftPlugin = defineMethod({
|
|
|
1425
1522
|
returnType: "PublishWorkflowDraftResponse",
|
|
1426
1523
|
inputSchema: PublishWorkflowDraftOptionsSchema,
|
|
1427
1524
|
outputSchema: PublishWorkflowDraftResponseSchema,
|
|
1525
|
+
skipOutputValidation: true,
|
|
1428
1526
|
output: "item",
|
|
1429
1527
|
resolvers: {
|
|
1430
1528
|
workflow: workflowIdResolver,
|
|
@@ -1532,6 +1630,7 @@ var listWorkflowRunsPlugin = defineMethod({
|
|
|
1532
1630
|
itemType: "WorkflowRun",
|
|
1533
1631
|
inputSchema: ListWorkflowRunsOptionsSchema,
|
|
1534
1632
|
outputSchema: WorkflowRunListItemSchema,
|
|
1633
|
+
skipOutputValidation: true,
|
|
1535
1634
|
// The handler already returns a clean `{ data, nextCursor }` page, so the
|
|
1536
1635
|
// standard list output (no `adaptPage`) applies.
|
|
1537
1636
|
output: { type: "list", defaultPageSize: DEFAULT_PAGE_SIZE },
|
|
@@ -1595,6 +1694,7 @@ var getWorkflowRunPlugin = defineMethod({
|
|
|
1595
1694
|
itemType: "WorkflowRun",
|
|
1596
1695
|
inputSchema: GetWorkflowRunOptionsSchema,
|
|
1597
1696
|
outputSchema: GetWorkflowRunResponseSchema,
|
|
1697
|
+
skipOutputValidation: true,
|
|
1598
1698
|
output: "item",
|
|
1599
1699
|
resolvers: {
|
|
1600
1700
|
workflow: workflowIdResolver,
|
|
@@ -1639,6 +1739,7 @@ var getTriggerRunPlugin = defineMethod({
|
|
|
1639
1739
|
itemType: "WorkflowRun",
|
|
1640
1740
|
inputSchema: GetTriggerRunOptionsSchema,
|
|
1641
1741
|
outputSchema: GetTriggerRunResponseSchema,
|
|
1742
|
+
skipOutputValidation: true,
|
|
1642
1743
|
output: "item",
|
|
1643
1744
|
// No resolver for `trigger` — users typically have the trigger id
|
|
1644
1745
|
// from a recent trigger fire and pass it directly. Authoring a
|
|
@@ -1682,6 +1783,7 @@ var triggerWorkflowPlugin = defineMethod({
|
|
|
1682
1783
|
itemType: "WorkflowRun",
|
|
1683
1784
|
inputSchema: TriggerWorkflowOptionsSchema,
|
|
1684
1785
|
outputSchema: TriggerWorkflowResponseSchema,
|
|
1786
|
+
skipOutputValidation: true,
|
|
1685
1787
|
output: "item",
|
|
1686
1788
|
resolvers: { workflow: workflowIdResolver },
|
|
1687
1789
|
run: async ({ imports, input }) => {
|