@zapier/zapier-sdk 0.62.0 → 0.64.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 +12 -0
- package/README.md +185 -0
- package/dist/experimental.cjs +310 -2
- package/dist/experimental.d.mts +114 -2
- package/dist/experimental.d.ts +112 -0
- package/dist/experimental.d.ts.map +1 -1
- package/dist/experimental.js +10 -0
- package/dist/experimental.mjs +310 -3
- package/dist/{index-3fBEDEsp.d.mts → index-Bfvj0KLi.d.mts} +15 -1
- package/dist/{index-3fBEDEsp.d.ts → index-Bfvj0KLi.d.ts} +15 -1
- package/dist/index.cjs +22 -1
- package/dist/index.d.mts +1 -1
- package/dist/index.mjs +22 -2
- package/dist/plugins/codeSubstrate/cancelDurableRun/index.d.ts +40 -0
- package/dist/plugins/codeSubstrate/cancelDurableRun/index.d.ts.map +1 -0
- package/dist/plugins/codeSubstrate/cancelDurableRun/index.js +27 -0
- package/dist/plugins/codeSubstrate/cancelDurableRun/schemas.d.ts +11 -0
- package/dist/plugins/codeSubstrate/cancelDurableRun/schemas.d.ts.map +1 -0
- package/dist/plugins/codeSubstrate/cancelDurableRun/schemas.js +12 -0
- package/dist/plugins/codeSubstrate/getWorkflowVersion/index.d.ts +46 -0
- package/dist/plugins/codeSubstrate/getWorkflowVersion/index.d.ts.map +1 -0
- package/dist/plugins/codeSubstrate/getWorkflowVersion/index.js +25 -0
- package/dist/plugins/codeSubstrate/getWorkflowVersion/schemas.d.ts +17 -0
- package/dist/plugins/codeSubstrate/getWorkflowVersion/schemas.d.ts.map +1 -0
- package/dist/plugins/codeSubstrate/getWorkflowVersion/schemas.js +25 -0
- package/dist/plugins/codeSubstrate/listWorkflowVersions/index.d.ts +49 -0
- package/dist/plugins/codeSubstrate/listWorkflowVersions/index.d.ts.map +1 -0
- package/dist/plugins/codeSubstrate/listWorkflowVersions/index.js +34 -0
- package/dist/plugins/codeSubstrate/listWorkflowVersions/schemas.d.ts +37 -0
- package/dist/plugins/codeSubstrate/listWorkflowVersions/schemas.d.ts.map +1 -0
- package/dist/plugins/codeSubstrate/listWorkflowVersions/schemas.js +48 -0
- package/dist/plugins/codeSubstrate/publishWorkflowVersion/index.d.ts +49 -0
- package/dist/plugins/codeSubstrate/publishWorkflowVersion/index.d.ts.map +1 -0
- package/dist/plugins/codeSubstrate/publishWorkflowVersion/index.js +33 -0
- package/dist/plugins/codeSubstrate/publishWorkflowVersion/schemas.d.ts +20 -0
- package/dist/plugins/codeSubstrate/publishWorkflowVersion/schemas.d.ts.map +1 -0
- package/dist/plugins/codeSubstrate/publishWorkflowVersion/schemas.js +42 -0
- package/dist/plugins/codeSubstrate/runDurable/index.d.ts +53 -0
- package/dist/plugins/codeSubstrate/runDurable/index.d.ts.map +1 -0
- package/dist/plugins/codeSubstrate/runDurable/index.js +36 -0
- package/dist/plugins/codeSubstrate/runDurable/schemas.d.ts +24 -0
- package/dist/plugins/codeSubstrate/runDurable/schemas.d.ts.map +1 -0
- package/dist/plugins/codeSubstrate/runDurable/schemas.js +61 -0
- package/dist/resolvers/index.d.ts +1 -0
- package/dist/resolvers/index.d.ts.map +1 -1
- package/dist/resolvers/index.js +1 -0
- package/dist/resolvers/workflowVersionId.d.ts +6 -0
- package/dist/resolvers/workflowVersionId.d.ts.map +1 -0
- package/dist/resolvers/workflowVersionId.js +20 -0
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -2603,6 +2603,26 @@ var durableRunIdResolver = {
|
|
|
2603
2603
|
})
|
|
2604
2604
|
};
|
|
2605
2605
|
|
|
2606
|
+
// src/resolvers/workflowVersionId.ts
|
|
2607
|
+
var workflowVersionIdResolver = {
|
|
2608
|
+
type: "dynamic",
|
|
2609
|
+
depends: ["workflow"],
|
|
2610
|
+
fetch: async (sdk, params) => toIterable(
|
|
2611
|
+
sdk.listWorkflowVersions({
|
|
2612
|
+
workflow: params.workflow
|
|
2613
|
+
})
|
|
2614
|
+
),
|
|
2615
|
+
prompt: (versions) => ({
|
|
2616
|
+
type: "list",
|
|
2617
|
+
name: "version",
|
|
2618
|
+
message: "Select a workflow version:",
|
|
2619
|
+
choices: versions.map((v) => ({
|
|
2620
|
+
name: `${v.id} \u2014 ${v.zapier_durable_version}`,
|
|
2621
|
+
value: v.id
|
|
2622
|
+
}))
|
|
2623
|
+
})
|
|
2624
|
+
};
|
|
2625
|
+
|
|
2606
2626
|
// src/resolvers/triggerMessages.ts
|
|
2607
2627
|
var triggerMessagesResolver = {
|
|
2608
2628
|
type: "dynamic",
|
|
@@ -6352,7 +6372,7 @@ async function invalidateCredentialsToken(options) {
|
|
|
6352
6372
|
}
|
|
6353
6373
|
|
|
6354
6374
|
// src/sdk-version.ts
|
|
6355
|
-
var SDK_VERSION = (typeof process !== "undefined" && process.env ? "0.
|
|
6375
|
+
var SDK_VERSION = (typeof process !== "undefined" && process.env ? "0.64.0" : void 0) || "unknown";
|
|
6356
6376
|
|
|
6357
6377
|
// src/utils/open-url.ts
|
|
6358
6378
|
var nodePrefix = "node:";
|
|
@@ -9214,4 +9234,4 @@ var registryPlugin = definePlugin((_sdk) => {
|
|
|
9214
9234
|
return {};
|
|
9215
9235
|
});
|
|
9216
9236
|
|
|
9217
|
-
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, createZapierSdk, createZapierSdkWithoutRegistry, definePlugin, deleteClientCredentialsPlugin, deleteTableFieldsPlugin, deleteTablePlugin, deleteTableRecordsPlugin, durableRunIdResolver, eventEmissionPlugin, fetchPlugin, findFirstConnectionPlugin, findManifestEntry, findUniqueConnectionPlugin, formatErrorMessage, generateEventId, getActionInputFieldsSchemaPlugin, getActionPlugin, getAppPlugin, getBaseUrlFromCredentials, getCiPlatform, getClientIdFromCredentials, getConnectionPlugin, getCpuTime, getCurrentTimestamp, getMemoryUsage, getOrCreateApiClient, getOsInfo, getPlatformVersions, getPreferredManifestEntryKey, getProfilePlugin, getReleaseId, getTablePlugin, getTableRecordPlugin, getTokenFromCliLogin, getZapierApprovalMode, getZapierDefaultApprovalMode, getZapierSdkService, injectCliLogin, inputFieldKeyResolver, inputsAllOptionalResolver, inputsResolver, invalidateCachedToken, invalidateCredentialsToken, isCi, isCliLoginAvailable, isClientCredentials, isCredentialsFunction, isCredentialsObject, isPkceCredentials, isPositional, listActionInputFieldChoicesPlugin, listActionInputFieldsPlugin, listActionsPlugin, listAppsPlugin, listClientCredentialsPlugin, listConnectionsPlugin, listTableFieldsPlugin, listTableRecordsPlugin, listTablesPlugin, logDeprecation, manifestPlugin, parseConcurrencyEnvVar, readManifestFromFile, registryPlugin, requestPlugin, resetDeprecationWarnings, resolveAuthToken, resolveCredentials, resolveCredentialsFromEnv, runActionPlugin, runWithTelemetryContext, tableFieldIdsResolver, tableFieldsResolver, tableFiltersResolver, tableIdResolver, tableNameResolver, tableRecordIdResolver, tableRecordIdsResolver, tableRecordsResolver, tableSortResolver, tableUpdateRecordsResolver, toSnakeCase, toTitleCase, triggerInboxResolver, triggerMessagesResolver, updateTableRecordsPlugin, workflowIdResolver };
|
|
9237
|
+
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, createZapierSdk, createZapierSdkWithoutRegistry, definePlugin, deleteClientCredentialsPlugin, deleteTableFieldsPlugin, deleteTablePlugin, deleteTableRecordsPlugin, durableRunIdResolver, eventEmissionPlugin, fetchPlugin, findFirstConnectionPlugin, findManifestEntry, findUniqueConnectionPlugin, formatErrorMessage, generateEventId, getActionInputFieldsSchemaPlugin, getActionPlugin, getAppPlugin, getBaseUrlFromCredentials, getCiPlatform, getClientIdFromCredentials, getConnectionPlugin, getCpuTime, getCurrentTimestamp, getMemoryUsage, getOrCreateApiClient, getOsInfo, getPlatformVersions, getPreferredManifestEntryKey, getProfilePlugin, getReleaseId, getTablePlugin, getTableRecordPlugin, getTokenFromCliLogin, getZapierApprovalMode, getZapierDefaultApprovalMode, getZapierSdkService, injectCliLogin, inputFieldKeyResolver, inputsAllOptionalResolver, inputsResolver, invalidateCachedToken, invalidateCredentialsToken, isCi, isCliLoginAvailable, isClientCredentials, isCredentialsFunction, isCredentialsObject, isPkceCredentials, isPositional, listActionInputFieldChoicesPlugin, listActionInputFieldsPlugin, listActionsPlugin, listAppsPlugin, listClientCredentialsPlugin, listConnectionsPlugin, listTableFieldsPlugin, listTableRecordsPlugin, listTablesPlugin, logDeprecation, manifestPlugin, parseConcurrencyEnvVar, readManifestFromFile, registryPlugin, requestPlugin, resetDeprecationWarnings, resolveAuthToken, resolveCredentials, resolveCredentialsFromEnv, runActionPlugin, runWithTelemetryContext, tableFieldIdsResolver, tableFieldsResolver, tableFiltersResolver, tableIdResolver, tableNameResolver, tableRecordIdResolver, tableRecordIdsResolver, tableRecordsResolver, tableSortResolver, tableUpdateRecordsResolver, toSnakeCase, toTitleCase, triggerInboxResolver, triggerMessagesResolver, updateTableRecordsPlugin, workflowIdResolver, workflowVersionIdResolver };
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
export declare const cancelDurableRunPlugin: (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
|
+
cancelDurableRun: (options?: {
|
|
25
|
+
run: string;
|
|
26
|
+
} | undefined) => Promise<{
|
|
27
|
+
data: {
|
|
28
|
+
id: string;
|
|
29
|
+
status: "cancelled";
|
|
30
|
+
};
|
|
31
|
+
}>;
|
|
32
|
+
} & {
|
|
33
|
+
context: {
|
|
34
|
+
meta: {
|
|
35
|
+
cancelDurableRun: import("../../..").PluginMeta;
|
|
36
|
+
};
|
|
37
|
+
};
|
|
38
|
+
};
|
|
39
|
+
export type CancelDurableRunPluginProvides = ReturnType<typeof cancelDurableRunPlugin>;
|
|
40
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/plugins/codeSubstrate/cancelDurableRun/index.ts"],"names":[],"mappings":"AAOA,eAAO,MAAM,sBAAsB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA6BlC,CAAC;AAEF,MAAM,MAAM,8BAA8B,GAAG,UAAU,CACrD,OAAO,sBAAsB,CAC9B,CAAC"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { definePlugin, createPluginMethod } from "../../../utils/plugin-utils";
|
|
2
|
+
import { durableRunIdResolver } from "../../../resolvers/durableRunId";
|
|
3
|
+
import { codeSubstrateDefaults } from "../shared";
|
|
4
|
+
import { CancelDurableRunOptionsSchema } from "./schemas";
|
|
5
|
+
export const cancelDurableRunPlugin = definePlugin((sdk) => createPluginMethod(sdk, {
|
|
6
|
+
...codeSubstrateDefaults,
|
|
7
|
+
name: "cancelDurableRun",
|
|
8
|
+
type: "update",
|
|
9
|
+
itemType: "DurableRun",
|
|
10
|
+
inputSchema: CancelDurableRunOptionsSchema,
|
|
11
|
+
resolvers: { run: durableRunIdResolver },
|
|
12
|
+
handler: async ({ sdk, options }) => {
|
|
13
|
+
// Backend returns 204 on success. 404 (run missing) and 409 (run
|
|
14
|
+
// already terminal) propagate as their respective ZapierErrors so
|
|
15
|
+
// callers can distinguish — we don't soft-fold them into a status
|
|
16
|
+
// enum the way deleteWorkflow does, because cancelling an
|
|
17
|
+
// already-terminal run is a meaningfully different outcome that
|
|
18
|
+
// callers may want to surface to users.
|
|
19
|
+
await sdk.context.api.post(`/sdkdurableapi/api/v0/runs/${encodeURIComponent(options.run)}/cancel`, undefined, {
|
|
20
|
+
authRequired: true,
|
|
21
|
+
resource: { type: "run", id: options.run },
|
|
22
|
+
});
|
|
23
|
+
return {
|
|
24
|
+
data: { id: options.run, status: "cancelled" },
|
|
25
|
+
};
|
|
26
|
+
},
|
|
27
|
+
}));
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
export declare const CancelDurableRunOptionsSchema: z.ZodObject<{
|
|
3
|
+
run: z.ZodString;
|
|
4
|
+
}, z.core.$strip>;
|
|
5
|
+
export type CancelDurableRunOptions = z.infer<typeof CancelDurableRunOptionsSchema>;
|
|
6
|
+
export declare const CancelDurableRunResponseSchema: z.ZodObject<{
|
|
7
|
+
id: z.ZodString;
|
|
8
|
+
status: z.ZodLiteral<"cancelled">;
|
|
9
|
+
}, z.core.$strip>;
|
|
10
|
+
export type CancelDurableRunResponse = z.infer<typeof CancelDurableRunResponseSchema>;
|
|
11
|
+
//# sourceMappingURL=schemas.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"schemas.d.ts","sourceRoot":"","sources":["../../../../src/plugins/codeSubstrate/cancelDurableRun/schemas.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,eAAO,MAAM,6BAA6B;;iBAMvC,CAAC;AAEJ,MAAM,MAAM,uBAAuB,GAAG,CAAC,CAAC,KAAK,CAC3C,OAAO,6BAA6B,CACrC,CAAC;AAEF,eAAO,MAAM,8BAA8B;;;iBAOzC,CAAC;AAEH,MAAM,MAAM,wBAAwB,GAAG,CAAC,CAAC,KAAK,CAC5C,OAAO,8BAA8B,CACtC,CAAC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
export const CancelDurableRunOptionsSchema = z
|
|
3
|
+
.object({
|
|
4
|
+
run: z.string().uuid().describe("Durable run ID"),
|
|
5
|
+
})
|
|
6
|
+
.describe("Cancel a run-once durable run in initialized or started status. Returns 409 if the run is already terminal.");
|
|
7
|
+
export const CancelDurableRunResponseSchema = z.object({
|
|
8
|
+
id: z.string().describe("Run ID that was targeted"),
|
|
9
|
+
status: z
|
|
10
|
+
.literal("cancelled")
|
|
11
|
+
.describe("Always `cancelled` on a successful call. Synthesized client-side — the backend returns 204; callers needing the run's full state should follow up with getDurableRun."),
|
|
12
|
+
});
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
export declare const getWorkflowVersionPlugin: (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
|
+
getWorkflowVersion: (options?: {
|
|
25
|
+
workflow: string;
|
|
26
|
+
version: string;
|
|
27
|
+
} | undefined) => Promise<{
|
|
28
|
+
data: {
|
|
29
|
+
id: string;
|
|
30
|
+
workflow_id: string;
|
|
31
|
+
source_files: Record<string, string>;
|
|
32
|
+
zapier_durable_version: string;
|
|
33
|
+
dependencies: Record<string, string> | null;
|
|
34
|
+
created_by_user_id: string;
|
|
35
|
+
created_at: string;
|
|
36
|
+
};
|
|
37
|
+
}>;
|
|
38
|
+
} & {
|
|
39
|
+
context: {
|
|
40
|
+
meta: {
|
|
41
|
+
getWorkflowVersion: import("../../..").PluginMeta;
|
|
42
|
+
};
|
|
43
|
+
};
|
|
44
|
+
};
|
|
45
|
+
export type GetWorkflowVersionPluginProvides = ReturnType<typeof getWorkflowVersionPlugin>;
|
|
46
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/plugins/codeSubstrate/getWorkflowVersion/index.ts"],"names":[],"mappings":"AAWA,eAAO,MAAM,wBAAwB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAyBpC,CAAC;AAEF,MAAM,MAAM,gCAAgC,GAAG,UAAU,CACvD,OAAO,wBAAwB,CAChC,CAAC"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { definePlugin, createPluginMethod } from "../../../utils/plugin-utils";
|
|
2
|
+
import { workflowIdResolver } from "../../../resolvers/workflowId";
|
|
3
|
+
import { workflowVersionIdResolver } from "../../../resolvers/workflowVersionId";
|
|
4
|
+
import { codeSubstrateDefaults } from "../shared";
|
|
5
|
+
import { GetWorkflowVersionOptionsSchema, GetWorkflowVersionResponseSchema, } from "./schemas";
|
|
6
|
+
export const getWorkflowVersionPlugin = definePlugin((sdk) => createPluginMethod(sdk, {
|
|
7
|
+
...codeSubstrateDefaults,
|
|
8
|
+
name: "getWorkflowVersion",
|
|
9
|
+
type: "item",
|
|
10
|
+
itemType: "WorkflowVersion",
|
|
11
|
+
inputSchema: GetWorkflowVersionOptionsSchema,
|
|
12
|
+
outputSchema: GetWorkflowVersionResponseSchema,
|
|
13
|
+
resolvers: {
|
|
14
|
+
workflow: workflowIdResolver,
|
|
15
|
+
version: workflowVersionIdResolver,
|
|
16
|
+
},
|
|
17
|
+
handler: async ({ sdk, options }) => {
|
|
18
|
+
const raw = await sdk.context.api.get(`/durableworkflowzaps/api/v0/workflows/${encodeURIComponent(options.workflow)}/versions/${encodeURIComponent(options.version)}`, {
|
|
19
|
+
authRequired: true,
|
|
20
|
+
resource: { type: "workflow-version", id: options.version },
|
|
21
|
+
});
|
|
22
|
+
const data = GetWorkflowVersionResponseSchema.parse(raw);
|
|
23
|
+
return { data };
|
|
24
|
+
},
|
|
25
|
+
}));
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
export declare const GetWorkflowVersionOptionsSchema: z.ZodObject<{
|
|
3
|
+
workflow: z.ZodString;
|
|
4
|
+
version: z.ZodString;
|
|
5
|
+
}, z.core.$strip>;
|
|
6
|
+
export type GetWorkflowVersionOptions = z.infer<typeof GetWorkflowVersionOptionsSchema>;
|
|
7
|
+
export declare const GetWorkflowVersionResponseSchema: z.ZodObject<{
|
|
8
|
+
id: z.ZodString;
|
|
9
|
+
workflow_id: z.ZodString;
|
|
10
|
+
source_files: z.ZodRecord<z.ZodString, z.ZodString>;
|
|
11
|
+
zapier_durable_version: z.ZodString;
|
|
12
|
+
dependencies: z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
13
|
+
created_by_user_id: z.ZodString;
|
|
14
|
+
created_at: z.ZodString;
|
|
15
|
+
}, z.core.$strip>;
|
|
16
|
+
export type GetWorkflowVersionResponse = z.infer<typeof GetWorkflowVersionResponseSchema>;
|
|
17
|
+
//# sourceMappingURL=schemas.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"schemas.d.ts","sourceRoot":"","sources":["../../../../src/plugins/codeSubstrate/getWorkflowVersion/schemas.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,eAAO,MAAM,+BAA+B;;;iBAKgC,CAAC;AAE7E,MAAM,MAAM,yBAAyB,GAAG,CAAC,CAAC,KAAK,CAC7C,OAAO,+BAA+B,CACvC,CAAC;AAEF,eAAO,MAAM,gCAAgC;;;;;;;;iBAmB3C,CAAC;AAEH,MAAM,MAAM,0BAA0B,GAAG,CAAC,CAAC,KAAK,CAC9C,OAAO,gCAAgC,CACxC,CAAC"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
export const GetWorkflowVersionOptionsSchema = z
|
|
3
|
+
.object({
|
|
4
|
+
workflow: z.string().uuid().describe("Durable workflow ID"),
|
|
5
|
+
version: z.string().uuid().describe("Workflow version ID"),
|
|
6
|
+
})
|
|
7
|
+
.describe("Get full details of a workflow version including source files");
|
|
8
|
+
export const GetWorkflowVersionResponseSchema = z.object({
|
|
9
|
+
id: z.string().describe("Workflow version ID (UUID)"),
|
|
10
|
+
workflow_id: z.string().describe("Parent workflow ID (UUID)"),
|
|
11
|
+
source_files: z
|
|
12
|
+
.record(z.string(), z.string())
|
|
13
|
+
.describe("Source files keyed by filename → contents"),
|
|
14
|
+
zapier_durable_version: z
|
|
15
|
+
.string()
|
|
16
|
+
.describe("Pinned semver of @zapier/zapier-durable used by this version's runs"),
|
|
17
|
+
dependencies: z
|
|
18
|
+
.record(z.string(), z.string())
|
|
19
|
+
.nullable()
|
|
20
|
+
.describe("Additional npm dependencies pinned for this version (or null)"),
|
|
21
|
+
created_by_user_id: z
|
|
22
|
+
.string()
|
|
23
|
+
.describe("ID of the user who published this version"),
|
|
24
|
+
created_at: z.string().describe("When the version was published (ISO-8601)"),
|
|
25
|
+
});
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
export declare const listWorkflowVersionsPlugin: (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
|
+
listWorkflowVersions: (options?: ({
|
|
25
|
+
workflow: string;
|
|
26
|
+
pageSize?: number | undefined;
|
|
27
|
+
cursor?: string | undefined;
|
|
28
|
+
maxItems?: number | undefined;
|
|
29
|
+
} & {
|
|
30
|
+
cursor?: string;
|
|
31
|
+
pageSize?: number;
|
|
32
|
+
maxItems?: number;
|
|
33
|
+
}) | undefined) => import("../../..").PaginatedSdkResult<{
|
|
34
|
+
id: string;
|
|
35
|
+
workflow_id: string;
|
|
36
|
+
zapier_durable_version: string;
|
|
37
|
+
dependencies: Record<string, string> | null;
|
|
38
|
+
created_by_user_id: string;
|
|
39
|
+
created_at: string;
|
|
40
|
+
}>;
|
|
41
|
+
} & {
|
|
42
|
+
context: {
|
|
43
|
+
meta: {
|
|
44
|
+
listWorkflowVersions: import("../../..").PluginMeta;
|
|
45
|
+
};
|
|
46
|
+
};
|
|
47
|
+
};
|
|
48
|
+
export type ListWorkflowVersionsPluginProvides = ReturnType<typeof listWorkflowVersionsPlugin>;
|
|
49
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/plugins/codeSubstrate/listWorkflowVersions/index.ts"],"names":[],"mappings":"AAeA,eAAO,MAAM,0BAA0B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAkCtC,CAAC;AAEF,MAAM,MAAM,kCAAkC,GAAG,UAAU,CACzD,OAAO,0BAA0B,CAClC,CAAC"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { definePlugin, createPaginatedPluginMethod, } from "../../../utils/plugin-utils";
|
|
2
|
+
import { workflowIdResolver } from "../../../resolvers/workflowId";
|
|
3
|
+
import { DEFAULT_PAGE_SIZE } from "../../../constants";
|
|
4
|
+
import { codeSubstrateDefaults } from "../shared";
|
|
5
|
+
import { ListWorkflowVersionsApiResponseSchema, ListWorkflowVersionsOptionsSchema, WorkflowVersionListItemSchema, } from "./schemas";
|
|
6
|
+
export const listWorkflowVersionsPlugin = definePlugin((sdk) => createPaginatedPluginMethod(sdk, {
|
|
7
|
+
...codeSubstrateDefaults,
|
|
8
|
+
name: "listWorkflowVersions",
|
|
9
|
+
type: "list",
|
|
10
|
+
itemType: "WorkflowVersion",
|
|
11
|
+
inputSchema: ListWorkflowVersionsOptionsSchema,
|
|
12
|
+
outputSchema: WorkflowVersionListItemSchema,
|
|
13
|
+
defaultPageSize: DEFAULT_PAGE_SIZE,
|
|
14
|
+
resolvers: { workflow: workflowIdResolver },
|
|
15
|
+
handler: async ({ sdk, options }) => {
|
|
16
|
+
const searchParams = {};
|
|
17
|
+
if (options.pageSize !== undefined) {
|
|
18
|
+
searchParams.limit = options.pageSize.toString();
|
|
19
|
+
}
|
|
20
|
+
if (options.cursor) {
|
|
21
|
+
searchParams.cursor = options.cursor;
|
|
22
|
+
}
|
|
23
|
+
const raw = await sdk.context.api.get(`/durableworkflowzaps/api/v0/workflows/${encodeURIComponent(options.workflow)}/versions`, {
|
|
24
|
+
searchParams,
|
|
25
|
+
authRequired: true,
|
|
26
|
+
resource: { type: "workflow", id: options.workflow },
|
|
27
|
+
});
|
|
28
|
+
const response = ListWorkflowVersionsApiResponseSchema.parse(raw);
|
|
29
|
+
return {
|
|
30
|
+
data: response.results,
|
|
31
|
+
nextCursor: response.meta.next_cursor ?? undefined,
|
|
32
|
+
};
|
|
33
|
+
},
|
|
34
|
+
}));
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
export declare const WorkflowVersionListItemSchema: z.ZodObject<{
|
|
3
|
+
id: z.ZodString;
|
|
4
|
+
workflow_id: z.ZodString;
|
|
5
|
+
zapier_durable_version: z.ZodString;
|
|
6
|
+
dependencies: z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
7
|
+
created_by_user_id: z.ZodString;
|
|
8
|
+
created_at: z.ZodString;
|
|
9
|
+
}, z.core.$strip>;
|
|
10
|
+
export type WorkflowVersionListItem = z.infer<typeof WorkflowVersionListItemSchema>;
|
|
11
|
+
export declare const ListWorkflowVersionsOptionsSchema: z.ZodObject<{
|
|
12
|
+
workflow: z.ZodString;
|
|
13
|
+
pageSize: z.ZodOptional<z.ZodNumber>;
|
|
14
|
+
cursor: z.ZodOptional<z.ZodString>;
|
|
15
|
+
maxItems: z.ZodOptional<z.ZodNumber>;
|
|
16
|
+
}, z.core.$strip>;
|
|
17
|
+
export type ListWorkflowVersionsOptions = z.infer<typeof ListWorkflowVersionsOptionsSchema>;
|
|
18
|
+
export declare const ListWorkflowVersionsApiResponseSchema: z.ZodObject<{
|
|
19
|
+
results: z.ZodArray<z.ZodObject<{
|
|
20
|
+
id: z.ZodString;
|
|
21
|
+
workflow_id: z.ZodString;
|
|
22
|
+
zapier_durable_version: z.ZodString;
|
|
23
|
+
dependencies: z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
24
|
+
created_by_user_id: z.ZodString;
|
|
25
|
+
created_at: z.ZodString;
|
|
26
|
+
}, z.core.$strip>>;
|
|
27
|
+
meta: z.ZodObject<{
|
|
28
|
+
limit: z.ZodNumber;
|
|
29
|
+
cursor: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
30
|
+
next_cursor: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
31
|
+
}, z.core.$strip>;
|
|
32
|
+
links: z.ZodOptional<z.ZodObject<{
|
|
33
|
+
next: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
34
|
+
}, z.core.$strip>>;
|
|
35
|
+
}, z.core.$strip>;
|
|
36
|
+
export type ListWorkflowVersionsApiResponse = z.infer<typeof ListWorkflowVersionsApiResponseSchema>;
|
|
37
|
+
//# sourceMappingURL=schemas.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"schemas.d.ts","sourceRoot":"","sources":["../../../../src/plugins/codeSubstrate/listWorkflowVersions/schemas.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,eAAO,MAAM,6BAA6B;;;;;;;iBAgBxC,CAAC;AAEH,MAAM,MAAM,uBAAuB,GAAG,CAAC,CAAC,KAAK,CAC3C,OAAO,6BAA6B,CACrC,CAAC;AAEF,eAAO,MAAM,iCAAiC;;;;;iBAkBqB,CAAC;AAEpE,MAAM,MAAM,2BAA2B,GAAG,CAAC,CAAC,KAAK,CAC/C,OAAO,iCAAiC,CACzC,CAAC;AAEF,eAAO,MAAM,qCAAqC;;;;;;;;;;;;;;;;;iBAYhD,CAAC;AAEH,MAAM,MAAM,+BAA+B,GAAG,CAAC,CAAC,KAAK,CACnD,OAAO,qCAAqC,CAC7C,CAAC"}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
export const WorkflowVersionListItemSchema = z.object({
|
|
3
|
+
id: z.string().describe("Workflow version ID (UUID)"),
|
|
4
|
+
workflow_id: z.string().describe("Parent workflow ID (UUID)"),
|
|
5
|
+
zapier_durable_version: z
|
|
6
|
+
.string()
|
|
7
|
+
.describe("Pinned semver of @zapier/zapier-durable used by this version's runs"),
|
|
8
|
+
dependencies: z
|
|
9
|
+
.record(z.string(), z.string())
|
|
10
|
+
.nullable()
|
|
11
|
+
.describe("Additional npm dependencies pinned for this version (or null)"),
|
|
12
|
+
created_by_user_id: z
|
|
13
|
+
.string()
|
|
14
|
+
.describe("ID of the user who published this version"),
|
|
15
|
+
created_at: z.string().describe("When the version was published (ISO-8601)"),
|
|
16
|
+
});
|
|
17
|
+
export const ListWorkflowVersionsOptionsSchema = z
|
|
18
|
+
.object({
|
|
19
|
+
workflow: z.string().uuid().describe("Durable workflow ID"),
|
|
20
|
+
pageSize: z
|
|
21
|
+
.number()
|
|
22
|
+
.int()
|
|
23
|
+
.min(1)
|
|
24
|
+
.max(100)
|
|
25
|
+
.optional()
|
|
26
|
+
.describe("Number of versions per page (max 100)"),
|
|
27
|
+
cursor: z.string().optional().describe("Pagination cursor"),
|
|
28
|
+
maxItems: z
|
|
29
|
+
.number()
|
|
30
|
+
.int()
|
|
31
|
+
.min(1)
|
|
32
|
+
.optional()
|
|
33
|
+
.describe("Maximum total versions to return across all pages"),
|
|
34
|
+
})
|
|
35
|
+
.describe("List published versions for a workflow, newest first");
|
|
36
|
+
export const ListWorkflowVersionsApiResponseSchema = z.object({
|
|
37
|
+
results: z.array(WorkflowVersionListItemSchema),
|
|
38
|
+
meta: z.object({
|
|
39
|
+
limit: z.number(),
|
|
40
|
+
cursor: z.string().nullable().optional(),
|
|
41
|
+
next_cursor: z.string().nullable().optional(),
|
|
42
|
+
}),
|
|
43
|
+
links: z
|
|
44
|
+
.object({
|
|
45
|
+
next: z.string().nullable().optional(),
|
|
46
|
+
})
|
|
47
|
+
.optional(),
|
|
48
|
+
});
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
export declare const publishWorkflowVersionPlugin: (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
|
+
publishWorkflowVersion: (options?: {
|
|
25
|
+
workflow: string;
|
|
26
|
+
source_files: Record<string, string>;
|
|
27
|
+
dependencies?: Record<string, string> | undefined;
|
|
28
|
+
zapier_durable_version?: string | undefined;
|
|
29
|
+
enabled?: boolean | undefined;
|
|
30
|
+
} | undefined) => Promise<{
|
|
31
|
+
data: {
|
|
32
|
+
id: string;
|
|
33
|
+
workflow_id: string;
|
|
34
|
+
source_files: Record<string, string>;
|
|
35
|
+
zapier_durable_version: string;
|
|
36
|
+
dependencies: Record<string, string> | null;
|
|
37
|
+
created_by_user_id: string;
|
|
38
|
+
created_at: string;
|
|
39
|
+
};
|
|
40
|
+
}>;
|
|
41
|
+
} & {
|
|
42
|
+
context: {
|
|
43
|
+
meta: {
|
|
44
|
+
publishWorkflowVersion: import("../../..").PluginMeta;
|
|
45
|
+
};
|
|
46
|
+
};
|
|
47
|
+
};
|
|
48
|
+
export type PublishWorkflowVersionPluginProvides = ReturnType<typeof publishWorkflowVersionPlugin>;
|
|
49
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/plugins/codeSubstrate/publishWorkflowVersion/index.ts"],"names":[],"mappings":"AAUA,eAAO,MAAM,4BAA4B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAmCxC,CAAC;AAEF,MAAM,MAAM,oCAAoC,GAAG,UAAU,CAC3D,OAAO,4BAA4B,CACpC,CAAC"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { definePlugin, createPluginMethod } from "../../../utils/plugin-utils";
|
|
2
|
+
import { workflowIdResolver } from "../../../resolvers/workflowId";
|
|
3
|
+
import { codeSubstrateDefaults } from "../shared";
|
|
4
|
+
import { PublishWorkflowVersionOptionsSchema, PublishWorkflowVersionResponseSchema, } from "./schemas";
|
|
5
|
+
export const publishWorkflowVersionPlugin = definePlugin((sdk) => createPluginMethod(sdk, {
|
|
6
|
+
...codeSubstrateDefaults,
|
|
7
|
+
name: "publishWorkflowVersion",
|
|
8
|
+
type: "create",
|
|
9
|
+
itemType: "WorkflowVersion",
|
|
10
|
+
inputSchema: PublishWorkflowVersionOptionsSchema,
|
|
11
|
+
outputSchema: PublishWorkflowVersionResponseSchema,
|
|
12
|
+
resolvers: { workflow: workflowIdResolver },
|
|
13
|
+
handler: async ({ sdk, options }) => {
|
|
14
|
+
const body = {
|
|
15
|
+
source_files: options.source_files,
|
|
16
|
+
};
|
|
17
|
+
if (options.dependencies !== undefined) {
|
|
18
|
+
body.dependencies = options.dependencies;
|
|
19
|
+
}
|
|
20
|
+
if (options.zapier_durable_version !== undefined) {
|
|
21
|
+
body.zapier_durable_version = options.zapier_durable_version;
|
|
22
|
+
}
|
|
23
|
+
if (options.enabled !== undefined) {
|
|
24
|
+
body.enabled = options.enabled;
|
|
25
|
+
}
|
|
26
|
+
const raw = await sdk.context.api.post(`/durableworkflowzaps/api/v0/workflows/${encodeURIComponent(options.workflow)}/versions`, body, {
|
|
27
|
+
authRequired: true,
|
|
28
|
+
resource: { type: "workflow", id: options.workflow },
|
|
29
|
+
});
|
|
30
|
+
const data = PublishWorkflowVersionResponseSchema.parse(raw);
|
|
31
|
+
return { data };
|
|
32
|
+
},
|
|
33
|
+
}));
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
export declare const PublishWorkflowVersionOptionsSchema: z.ZodObject<{
|
|
3
|
+
workflow: z.ZodString;
|
|
4
|
+
source_files: z.ZodRecord<z.ZodString, z.ZodString>;
|
|
5
|
+
dependencies: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
6
|
+
zapier_durable_version: z.ZodOptional<z.ZodString>;
|
|
7
|
+
enabled: z.ZodOptional<z.ZodBoolean>;
|
|
8
|
+
}, z.core.$strip>;
|
|
9
|
+
export type PublishWorkflowVersionOptions = z.infer<typeof PublishWorkflowVersionOptionsSchema>;
|
|
10
|
+
export declare const PublishWorkflowVersionResponseSchema: z.ZodObject<{
|
|
11
|
+
id: z.ZodString;
|
|
12
|
+
workflow_id: z.ZodString;
|
|
13
|
+
source_files: z.ZodRecord<z.ZodString, z.ZodString>;
|
|
14
|
+
zapier_durable_version: z.ZodString;
|
|
15
|
+
dependencies: z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
16
|
+
created_by_user_id: z.ZodString;
|
|
17
|
+
created_at: z.ZodString;
|
|
18
|
+
}, z.core.$strip>;
|
|
19
|
+
export type PublishWorkflowVersionResponse = z.infer<typeof PublishWorkflowVersionResponseSchema>;
|
|
20
|
+
//# sourceMappingURL=schemas.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"schemas.d.ts","sourceRoot":"","sources":["../../../../src/plugins/codeSubstrate/publishWorkflowVersion/schemas.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,eAAO,MAAM,mCAAmC;;;;;;iBA4B7C,CAAC;AAEJ,MAAM,MAAM,6BAA6B,GAAG,CAAC,CAAC,KAAK,CACjD,OAAO,mCAAmC,CAC3C,CAAC;AAEF,eAAO,MAAM,oCAAoC;;;;;;;;iBAmB/C,CAAC;AAEH,MAAM,MAAM,8BAA8B,GAAG,CAAC,CAAC,KAAK,CAClD,OAAO,oCAAoC,CAC5C,CAAC"}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
export const PublishWorkflowVersionOptionsSchema = z
|
|
3
|
+
.object({
|
|
4
|
+
workflow: z.string().uuid().describe("Durable workflow ID"),
|
|
5
|
+
source_files: z
|
|
6
|
+
.record(z.string(), z.string())
|
|
7
|
+
.refine((files) => Object.keys(files).length > 0, {
|
|
8
|
+
message: "source_files must contain at least one file",
|
|
9
|
+
})
|
|
10
|
+
.describe("Source files keyed by filename → contents"),
|
|
11
|
+
dependencies: z
|
|
12
|
+
.record(z.string(), z.string())
|
|
13
|
+
.optional()
|
|
14
|
+
.describe("Optional npm package dependencies"),
|
|
15
|
+
zapier_durable_version: z
|
|
16
|
+
.string()
|
|
17
|
+
.optional()
|
|
18
|
+
.describe('Exact semver of @zapier/zapier-durable to use (e.g. "1.2.3"). Defaults to server-configured version if omitted.'),
|
|
19
|
+
enabled: z
|
|
20
|
+
.boolean()
|
|
21
|
+
.optional()
|
|
22
|
+
.describe("Enable the workflow after publishing. Defaults to true; pass false to publish without enabling."),
|
|
23
|
+
})
|
|
24
|
+
.describe("Publish a new version of a durable workflow. Enables the workflow by default.");
|
|
25
|
+
export const PublishWorkflowVersionResponseSchema = z.object({
|
|
26
|
+
id: z.string().describe("Workflow version ID (UUID)"),
|
|
27
|
+
workflow_id: z.string().describe("Parent workflow ID (UUID)"),
|
|
28
|
+
source_files: z
|
|
29
|
+
.record(z.string(), z.string())
|
|
30
|
+
.describe("Source files keyed by filename → contents"),
|
|
31
|
+
zapier_durable_version: z
|
|
32
|
+
.string()
|
|
33
|
+
.describe("Pinned semver of @zapier/zapier-durable used by this version's runs"),
|
|
34
|
+
dependencies: z
|
|
35
|
+
.record(z.string(), z.string())
|
|
36
|
+
.nullable()
|
|
37
|
+
.describe("Additional npm dependencies pinned for this version (or null)"),
|
|
38
|
+
created_by_user_id: z
|
|
39
|
+
.string()
|
|
40
|
+
.describe("ID of the user who published this version"),
|
|
41
|
+
created_at: z.string().describe("When the version was published (ISO-8601)"),
|
|
42
|
+
});
|