@zapier/zapier-sdk 0.62.0 → 0.63.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 +6 -0
- package/README.md +58 -0
- package/dist/experimental.cjs +121 -2
- package/dist/experimental.d.mts +43 -0
- package/dist/experimental.d.ts +43 -0
- package/dist/experimental.d.ts.map +1 -1
- package/dist/experimental.js +4 -0
- package/dist/experimental.mjs +121 -2
- package/dist/index.cjs +1 -1
- package/dist/index.mjs +1 -1
- 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/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/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
# @zapier/zapier-sdk
|
|
2
2
|
|
|
3
|
+
## 0.63.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- dfa3cea: Add the durable-run-write experimental code-substrate plugins: `runDurable` and `cancelDurableRun`. Both are registered only in `@zapier/zapier-sdk/experimental`; the stable subpath does not expose them. `runDurable` POSTs to sdkdurableapi `/api/v0/runs` with `source_files` (filename → contents), optional `input`/`dependencies`/`zapier_durable_version`/`connections`/`app_versions`, and a `private` input that maps to `is_private` on the wire. Returns the run ID immediately in `initialized` status — callers that need terminal status poll via `getDurableRun`; no built-in polling. `cancelDurableRun` POSTs to `/api/v0/runs/:id/cancel`, returns `{ id, status: "cancelled" }` on success, and propagates `ZapierNotFoundError` (404) and `ZapierConflictError` (409 — run already terminal) so callers can distinguish those outcomes. `runDurable` passes the API response through verbatim (no client-side `.parse()` re-emission) so callers see any richer fields the server adds later without an SDK release. Input field naming follows the in-tree convention (`run` rather than `runId`); UUID-validated at the input boundary. `cancelDurableRun` reuses `durableRunIdResolver` from the reads MR for ID pickers.
|
|
8
|
+
|
|
3
9
|
## 0.62.0
|
|
4
10
|
|
|
5
11
|
### Minor Changes
|
package/README.md
CHANGED
|
@@ -27,6 +27,7 @@
|
|
|
27
27
|
- [`deleteClientCredentials`](#deleteclientcredentials)
|
|
28
28
|
- [`listClientCredentials`](#listclientcredentials)
|
|
29
29
|
- [Code Workflows (Experimental)](#code-workflows-experimental)
|
|
30
|
+
- [`cancelDurableRun`](#canceldurablerun--experimental)
|
|
30
31
|
- [`createWorkflow`](#createworkflow--experimental)
|
|
31
32
|
- [`deleteWorkflow`](#deleteworkflow--experimental)
|
|
32
33
|
- [`disableWorkflow`](#disableworkflow--experimental)
|
|
@@ -35,6 +36,7 @@
|
|
|
35
36
|
- [`getWorkflow`](#getworkflow--experimental)
|
|
36
37
|
- [`listDurableRuns`](#listdurableruns--experimental)
|
|
37
38
|
- [`listWorkflows`](#listworkflows--experimental)
|
|
39
|
+
- [`runDurable`](#rundurable--experimental)
|
|
38
40
|
- [`updateWorkflow`](#updateworkflow--experimental)
|
|
39
41
|
- [Connections](#connections)
|
|
40
42
|
- [`findFirstConnection`](#findfirstconnection)
|
|
@@ -1094,6 +1096,27 @@ for await (const clientCredentials of zapier.listClientCredentials().items()) {
|
|
|
1094
1096
|
|
|
1095
1097
|
> ℹ️ **Experimental.** Import from `"@zapier/zapier-sdk/experimental"` to use these methods. Methods and behavior may change.
|
|
1096
1098
|
|
|
1099
|
+
#### `cancelDurableRun` 🧪 _experimental_
|
|
1100
|
+
|
|
1101
|
+
Cancel a run-once durable run in initialized or started status. Returns 409 if the run is already terminal.
|
|
1102
|
+
|
|
1103
|
+
**Parameters:**
|
|
1104
|
+
|
|
1105
|
+
| Name | Type | Required | Default | Possible Values | Description |
|
|
1106
|
+
| --------- | -------- | -------- | ------- | --------------- | -------------- |
|
|
1107
|
+
| `options` | `object` | ✅ | — | — | |
|
|
1108
|
+
| ↳ `run` | `string` | ✅ | — | — | Durable run ID |
|
|
1109
|
+
|
|
1110
|
+
**Returns:** `Promise<DurableRunItem>`
|
|
1111
|
+
|
|
1112
|
+
**Example:**
|
|
1113
|
+
|
|
1114
|
+
```typescript
|
|
1115
|
+
const result = await zapier.cancelDurableRun({
|
|
1116
|
+
run: "example-run",
|
|
1117
|
+
});
|
|
1118
|
+
```
|
|
1119
|
+
|
|
1097
1120
|
#### `createWorkflow` 🧪 _experimental_
|
|
1098
1121
|
|
|
1099
1122
|
Create a durable workflow container. Starts disabled with no version; publish a version to add code.
|
|
@@ -1366,6 +1389,41 @@ for await (const workflow of zapier.listWorkflows().items()) {
|
|
|
1366
1389
|
}
|
|
1367
1390
|
```
|
|
1368
1391
|
|
|
1392
|
+
#### `runDurable` 🧪 _experimental_
|
|
1393
|
+
|
|
1394
|
+
Run a workflow source file as a run-once durable run on sdkdurableapi (no deployed workflow required). Returns the run ID immediately; poll via getDurableRun for terminal status.
|
|
1395
|
+
|
|
1396
|
+
**Parameters:**
|
|
1397
|
+
|
|
1398
|
+
| Name | Type | Required | Default | Possible Values | Description |
|
|
1399
|
+
| ---------------------------- | --------- | -------- | ------- | --------------- | --------------------------------------------------------------------------------------------------------------- |
|
|
1400
|
+
| `options` | `object` | ✅ | — | — | |
|
|
1401
|
+
| ↳ `source_files` | `object` | ✅ | — | — | Source files keyed by filename → contents |
|
|
1402
|
+
| ↳ `input` | `string` | ❌ | — | — | Input data passed to the run |
|
|
1403
|
+
| ↳ `dependencies` | `object` | ❌ | — | — | Optional npm package dependencies |
|
|
1404
|
+
| ↳ `zapier_durable_version` | `string` | ❌ | — | — | Exact semver of @zapier/zapier-durable to use (e.g. "1.2.3"). Defaults to server-configured version if omitted. |
|
|
1405
|
+
| ↳ `connections` | `object` | ❌ | — | — | Named connection aliases. Maps alias names to Zapier connection IDs. |
|
|
1406
|
+
| ↳ `app_versions` | `object` | ❌ | — | — | Pinned app versions. Maps app keys (slugs) to implementation names and versions. |
|
|
1407
|
+
| ↳ `private` | `boolean` | ❌ | — | — | Only the creating user can see the run (default false) |
|
|
1408
|
+
|
|
1409
|
+
**Returns:** `Promise<DurableRunItem>`
|
|
1410
|
+
|
|
1411
|
+
| Name | Type | Required | Possible Values | Description |
|
|
1412
|
+
| ---------------- | --------- | -------- | --------------- | ----------------------------------------------------------------------------------------------------------------------------------------- |
|
|
1413
|
+
| `data` | `object` | ✅ | — | |
|
|
1414
|
+
| ↳ `id` | `string` | ✅ | — | Run ID (UUID) — server-generated, time-sortable |
|
|
1415
|
+
| ↳ `status` | `string` | ✅ | `initialized` | Always `initialized` on creation. Poll via getDurableRun to observe the run advancing to `started` / `finished` / `failed` / `cancelled`. |
|
|
1416
|
+
| ↳ `is_private` | `boolean` | ✅ | — | When true, the run is visible only to the creating user; otherwise visible across the account. |
|
|
1417
|
+
| ↳ `created_at` | `string` | ✅ | — | When the run was created (ISO-8601) |
|
|
1418
|
+
|
|
1419
|
+
**Example:**
|
|
1420
|
+
|
|
1421
|
+
```typescript
|
|
1422
|
+
const result = await zapier.runDurable({
|
|
1423
|
+
source_files: {},
|
|
1424
|
+
});
|
|
1425
|
+
```
|
|
1426
|
+
|
|
1369
1427
|
#### `updateWorkflow` 🧪 _experimental_
|
|
1370
1428
|
|
|
1371
1429
|
Update a durable workflow's name and/or description
|
package/dist/experimental.cjs
CHANGED
|
@@ -2889,7 +2889,7 @@ async function invalidateCredentialsToken(options) {
|
|
|
2889
2889
|
}
|
|
2890
2890
|
|
|
2891
2891
|
// src/sdk-version.ts
|
|
2892
|
-
var SDK_VERSION = (typeof process !== "undefined" && process.env ? "0.
|
|
2892
|
+
var SDK_VERSION = (typeof process !== "undefined" && process.env ? "0.63.0" : void 0) || "unknown";
|
|
2893
2893
|
|
|
2894
2894
|
// src/utils/open-url.ts
|
|
2895
2895
|
var nodePrefix = "node:";
|
|
@@ -11019,6 +11019,125 @@ var getDurableRunPlugin = definePlugin(
|
|
|
11019
11019
|
}
|
|
11020
11020
|
})
|
|
11021
11021
|
);
|
|
11022
|
+
var ConnectionMapEntrySchema = zod.z.object({
|
|
11023
|
+
connection_id: zod.z.union([
|
|
11024
|
+
zod.z.string().regex(/^[1-9][0-9]*$/, "must be a positive integer string"),
|
|
11025
|
+
zod.z.string().uuid("must be a UUID"),
|
|
11026
|
+
zod.z.number().int().positive()
|
|
11027
|
+
]).describe(
|
|
11028
|
+
"Zapier connection ID. Accepts a positive integer (legacy) or a UUID string (newer connections)."
|
|
11029
|
+
)
|
|
11030
|
+
});
|
|
11031
|
+
var AppVersionMapEntrySchema = zod.z.object({
|
|
11032
|
+
implementation_name: zod.z.string().min(1).describe("Zapier app implementation name (e.g. `SlackCLIAPI`)"),
|
|
11033
|
+
version: zod.z.string().optional().describe("Pinned app version (e.g. `1.27.1`). Latest if omitted.")
|
|
11034
|
+
});
|
|
11035
|
+
var RunDurableOptionsSchema = zod.z.object({
|
|
11036
|
+
source_files: zod.z.record(zod.z.string(), zod.z.string()).refine((files) => Object.keys(files).length > 0, {
|
|
11037
|
+
message: "source_files must contain at least one file"
|
|
11038
|
+
}).describe("Source files keyed by filename \u2192 contents"),
|
|
11039
|
+
input: zod.z.unknown().optional().describe("Input data passed to the run"),
|
|
11040
|
+
dependencies: zod.z.record(zod.z.string(), zod.z.string()).optional().describe("Optional npm package dependencies"),
|
|
11041
|
+
zapier_durable_version: zod.z.string().optional().describe(
|
|
11042
|
+
'Exact semver of @zapier/zapier-durable to use (e.g. "1.2.3"). Defaults to server-configured version if omitted.'
|
|
11043
|
+
),
|
|
11044
|
+
connections: zod.z.record(zod.z.string(), ConnectionMapEntrySchema).optional().describe(
|
|
11045
|
+
"Named connection aliases. Maps alias names to Zapier connection IDs."
|
|
11046
|
+
),
|
|
11047
|
+
app_versions: zod.z.record(zod.z.string(), AppVersionMapEntrySchema).optional().describe(
|
|
11048
|
+
"Pinned app versions. Maps app keys (slugs) to implementation names and versions."
|
|
11049
|
+
),
|
|
11050
|
+
private: zod.z.boolean().optional().describe("Only the creating user can see the run (default false)")
|
|
11051
|
+
}).describe(
|
|
11052
|
+
"Run a workflow source file as a run-once durable run on sdkdurableapi (no deployed workflow required). Returns the run ID immediately; poll via getDurableRun for terminal status."
|
|
11053
|
+
);
|
|
11054
|
+
var RunDurableResponseSchema = zod.z.object({
|
|
11055
|
+
id: zod.z.string().describe("Run ID (UUID) \u2014 server-generated, time-sortable"),
|
|
11056
|
+
status: zod.z.literal("initialized").describe(
|
|
11057
|
+
"Always `initialized` on creation. Poll via getDurableRun to observe the run advancing to `started` / `finished` / `failed` / `cancelled`."
|
|
11058
|
+
),
|
|
11059
|
+
is_private: zod.z.boolean().describe(
|
|
11060
|
+
"When true, the run is visible only to the creating user; otherwise visible across the account."
|
|
11061
|
+
),
|
|
11062
|
+
created_at: zod.z.string().describe("When the run was created (ISO-8601)")
|
|
11063
|
+
});
|
|
11064
|
+
|
|
11065
|
+
// src/plugins/codeSubstrate/runDurable/index.ts
|
|
11066
|
+
var runDurablePlugin = definePlugin(
|
|
11067
|
+
(sdk) => createPluginMethod(sdk, {
|
|
11068
|
+
...codeSubstrateDefaults,
|
|
11069
|
+
name: "runDurable",
|
|
11070
|
+
type: "create",
|
|
11071
|
+
itemType: "DurableRun",
|
|
11072
|
+
inputSchema: RunDurableOptionsSchema,
|
|
11073
|
+
outputSchema: RunDurableResponseSchema,
|
|
11074
|
+
handler: async ({ sdk: sdk2, options }) => {
|
|
11075
|
+
const body = {
|
|
11076
|
+
source_files: options.source_files
|
|
11077
|
+
};
|
|
11078
|
+
if (options.input !== void 0) {
|
|
11079
|
+
body.input = options.input;
|
|
11080
|
+
}
|
|
11081
|
+
if (options.dependencies !== void 0) {
|
|
11082
|
+
body.dependencies = options.dependencies;
|
|
11083
|
+
}
|
|
11084
|
+
if (options.zapier_durable_version !== void 0) {
|
|
11085
|
+
body.zapier_durable_version = options.zapier_durable_version;
|
|
11086
|
+
}
|
|
11087
|
+
if (options.connections !== void 0) {
|
|
11088
|
+
body.connections = options.connections;
|
|
11089
|
+
}
|
|
11090
|
+
if (options.app_versions !== void 0) {
|
|
11091
|
+
body.app_versions = options.app_versions;
|
|
11092
|
+
}
|
|
11093
|
+
if (options.private !== void 0) {
|
|
11094
|
+
body.is_private = options.private;
|
|
11095
|
+
}
|
|
11096
|
+
const data = await sdk2.context.api.post(
|
|
11097
|
+
"/sdkdurableapi/api/v0/runs",
|
|
11098
|
+
body,
|
|
11099
|
+
{ authRequired: true }
|
|
11100
|
+
);
|
|
11101
|
+
return { data };
|
|
11102
|
+
}
|
|
11103
|
+
})
|
|
11104
|
+
);
|
|
11105
|
+
var CancelDurableRunOptionsSchema = zod.z.object({
|
|
11106
|
+
run: zod.z.string().uuid().describe("Durable run ID")
|
|
11107
|
+
}).describe(
|
|
11108
|
+
"Cancel a run-once durable run in initialized or started status. Returns 409 if the run is already terminal."
|
|
11109
|
+
);
|
|
11110
|
+
zod.z.object({
|
|
11111
|
+
id: zod.z.string().describe("Run ID that was targeted"),
|
|
11112
|
+
status: zod.z.literal("cancelled").describe(
|
|
11113
|
+
"Always `cancelled` on a successful call. Synthesized client-side \u2014 the backend returns 204; callers needing the run's full state should follow up with getDurableRun."
|
|
11114
|
+
)
|
|
11115
|
+
});
|
|
11116
|
+
|
|
11117
|
+
// src/plugins/codeSubstrate/cancelDurableRun/index.ts
|
|
11118
|
+
var cancelDurableRunPlugin = definePlugin(
|
|
11119
|
+
(sdk) => createPluginMethod(sdk, {
|
|
11120
|
+
...codeSubstrateDefaults,
|
|
11121
|
+
name: "cancelDurableRun",
|
|
11122
|
+
type: "update",
|
|
11123
|
+
itemType: "DurableRun",
|
|
11124
|
+
inputSchema: CancelDurableRunOptionsSchema,
|
|
11125
|
+
resolvers: { run: durableRunIdResolver },
|
|
11126
|
+
handler: async ({ sdk: sdk2, options }) => {
|
|
11127
|
+
await sdk2.context.api.post(
|
|
11128
|
+
`/sdkdurableapi/api/v0/runs/${encodeURIComponent(options.run)}/cancel`,
|
|
11129
|
+
void 0,
|
|
11130
|
+
{
|
|
11131
|
+
authRequired: true,
|
|
11132
|
+
resource: { type: "run", id: options.run }
|
|
11133
|
+
}
|
|
11134
|
+
);
|
|
11135
|
+
return {
|
|
11136
|
+
data: { id: options.run, status: "cancelled" }
|
|
11137
|
+
};
|
|
11138
|
+
}
|
|
11139
|
+
})
|
|
11140
|
+
);
|
|
11022
11141
|
|
|
11023
11142
|
// src/utils/batch-utils.ts
|
|
11024
11143
|
var DEFAULT_CONCURRENCY = 10;
|
|
@@ -11178,7 +11297,7 @@ var registryPlugin = definePlugin((_sdk) => {
|
|
|
11178
11297
|
|
|
11179
11298
|
// src/experimental.ts
|
|
11180
11299
|
function createZapierSdk2(options = {}) {
|
|
11181
|
-
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(listDurableRunsPlugin).addPlugin(getDurableRunPlugin).addPlugin(appsPlugin).addPlugin(getProfilePlugin);
|
|
11300
|
+
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(listDurableRunsPlugin).addPlugin(getDurableRunPlugin).addPlugin(runDurablePlugin).addPlugin(cancelDurableRunPlugin).addPlugin(appsPlugin).addPlugin(getProfilePlugin);
|
|
11182
11301
|
}
|
|
11183
11302
|
|
|
11184
11303
|
exports.ActionKeyPropertySchema = ActionKeyPropertySchema;
|
package/dist/experimental.d.mts
CHANGED
|
@@ -2511,6 +2511,49 @@ declare function createZapierSdk(options?: ZapierSdkOptions): WithAddPlugin<{
|
|
|
2511
2511
|
getDurableRun: PluginMeta;
|
|
2512
2512
|
};
|
|
2513
2513
|
};
|
|
2514
|
+
} & {
|
|
2515
|
+
runDurable: (options?: {
|
|
2516
|
+
source_files: Record<string, string>;
|
|
2517
|
+
input?: unknown;
|
|
2518
|
+
dependencies?: Record<string, string> | undefined;
|
|
2519
|
+
zapier_durable_version?: string | undefined;
|
|
2520
|
+
connections?: Record<string, {
|
|
2521
|
+
connection_id: string | number;
|
|
2522
|
+
}> | undefined;
|
|
2523
|
+
app_versions?: Record<string, {
|
|
2524
|
+
implementation_name: string;
|
|
2525
|
+
version?: string | undefined;
|
|
2526
|
+
}> | undefined;
|
|
2527
|
+
private?: boolean | undefined;
|
|
2528
|
+
} | undefined) => Promise<{
|
|
2529
|
+
data: {
|
|
2530
|
+
id: string;
|
|
2531
|
+
status: "initialized";
|
|
2532
|
+
is_private: boolean;
|
|
2533
|
+
created_at: string;
|
|
2534
|
+
};
|
|
2535
|
+
}>;
|
|
2536
|
+
} & {
|
|
2537
|
+
context: {
|
|
2538
|
+
meta: {
|
|
2539
|
+
runDurable: PluginMeta;
|
|
2540
|
+
};
|
|
2541
|
+
};
|
|
2542
|
+
} & {
|
|
2543
|
+
cancelDurableRun: (options?: {
|
|
2544
|
+
run: string;
|
|
2545
|
+
} | undefined) => Promise<{
|
|
2546
|
+
data: {
|
|
2547
|
+
id: string;
|
|
2548
|
+
status: "cancelled";
|
|
2549
|
+
};
|
|
2550
|
+
}>;
|
|
2551
|
+
} & {
|
|
2552
|
+
context: {
|
|
2553
|
+
meta: {
|
|
2554
|
+
cancelDurableRun: PluginMeta;
|
|
2555
|
+
};
|
|
2556
|
+
};
|
|
2514
2557
|
} & {
|
|
2515
2558
|
apps: ActionProxy & ZapierSdkApps;
|
|
2516
2559
|
context: {
|
package/dist/experimental.d.ts
CHANGED
|
@@ -2526,6 +2526,49 @@ export declare function createZapierSdk(options?: ZapierSdkOptions): import("./i
|
|
|
2526
2526
|
getDurableRun: PluginMeta;
|
|
2527
2527
|
};
|
|
2528
2528
|
};
|
|
2529
|
+
} & {
|
|
2530
|
+
runDurable: (options?: {
|
|
2531
|
+
source_files: Record<string, string>;
|
|
2532
|
+
input?: unknown;
|
|
2533
|
+
dependencies?: Record<string, string> | undefined;
|
|
2534
|
+
zapier_durable_version?: string | undefined;
|
|
2535
|
+
connections?: Record<string, {
|
|
2536
|
+
connection_id: string | number;
|
|
2537
|
+
}> | undefined;
|
|
2538
|
+
app_versions?: Record<string, {
|
|
2539
|
+
implementation_name: string;
|
|
2540
|
+
version?: string | undefined;
|
|
2541
|
+
}> | undefined;
|
|
2542
|
+
private?: boolean | undefined;
|
|
2543
|
+
} | undefined) => Promise<{
|
|
2544
|
+
data: {
|
|
2545
|
+
id: string;
|
|
2546
|
+
status: "initialized";
|
|
2547
|
+
is_private: boolean;
|
|
2548
|
+
created_at: string;
|
|
2549
|
+
};
|
|
2550
|
+
}>;
|
|
2551
|
+
} & {
|
|
2552
|
+
context: {
|
|
2553
|
+
meta: {
|
|
2554
|
+
runDurable: PluginMeta;
|
|
2555
|
+
};
|
|
2556
|
+
};
|
|
2557
|
+
} & {
|
|
2558
|
+
cancelDurableRun: (options?: {
|
|
2559
|
+
run: string;
|
|
2560
|
+
} | undefined) => Promise<{
|
|
2561
|
+
data: {
|
|
2562
|
+
id: string;
|
|
2563
|
+
status: "cancelled";
|
|
2564
|
+
};
|
|
2565
|
+
}>;
|
|
2566
|
+
} & {
|
|
2567
|
+
context: {
|
|
2568
|
+
meta: {
|
|
2569
|
+
cancelDurableRun: PluginMeta;
|
|
2570
|
+
};
|
|
2571
|
+
};
|
|
2529
2572
|
} & {
|
|
2530
2573
|
apps: import("./plugins/apps/schemas").ActionProxy & import("./index").ZapierSdkApps;
|
|
2531
2574
|
context: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"experimental.d.ts","sourceRoot":"","sources":["../src/experimental.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AAEH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAClD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;
|
|
1
|
+
{"version":3,"file":"experimental.d.ts","sourceRoot":"","sources":["../src/experimental.ts"],"names":[],"mappings":"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"}
|
package/dist/experimental.js
CHANGED
|
@@ -85,6 +85,8 @@ import { disableWorkflowPlugin } from "./plugins/codeSubstrate/disableWorkflow";
|
|
|
85
85
|
import { deleteWorkflowPlugin } from "./plugins/codeSubstrate/deleteWorkflow";
|
|
86
86
|
import { listDurableRunsPlugin } from "./plugins/codeSubstrate/listDurableRuns";
|
|
87
87
|
import { getDurableRunPlugin } from "./plugins/codeSubstrate/getDurableRun";
|
|
88
|
+
import { runDurablePlugin } from "./plugins/codeSubstrate/runDurable";
|
|
89
|
+
import { cancelDurableRunPlugin } from "./plugins/codeSubstrate/cancelDurableRun";
|
|
88
90
|
// Re-export everything from the stable index so callers importing from
|
|
89
91
|
// the experimental subpath get the full API surface (types, helpers,
|
|
90
92
|
// errors) without having to import from two paths.
|
|
@@ -169,6 +171,8 @@ export function createZapierSdk(options = {}) {
|
|
|
169
171
|
.addPlugin(deleteWorkflowPlugin)
|
|
170
172
|
.addPlugin(listDurableRunsPlugin)
|
|
171
173
|
.addPlugin(getDurableRunPlugin)
|
|
174
|
+
.addPlugin(runDurablePlugin)
|
|
175
|
+
.addPlugin(cancelDurableRunPlugin)
|
|
172
176
|
// Magic apps plugin
|
|
173
177
|
.addPlugin(appsPlugin)
|
|
174
178
|
// Profile
|
package/dist/experimental.mjs
CHANGED
|
@@ -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.
|
|
2890
|
+
var SDK_VERSION = (typeof process !== "undefined" && process.env ? "0.63.0" : void 0) || "unknown";
|
|
2891
2891
|
|
|
2892
2892
|
// src/utils/open-url.ts
|
|
2893
2893
|
var nodePrefix = "node:";
|
|
@@ -11017,6 +11017,125 @@ var getDurableRunPlugin = definePlugin(
|
|
|
11017
11017
|
}
|
|
11018
11018
|
})
|
|
11019
11019
|
);
|
|
11020
|
+
var ConnectionMapEntrySchema = z.object({
|
|
11021
|
+
connection_id: z.union([
|
|
11022
|
+
z.string().regex(/^[1-9][0-9]*$/, "must be a positive integer string"),
|
|
11023
|
+
z.string().uuid("must be a UUID"),
|
|
11024
|
+
z.number().int().positive()
|
|
11025
|
+
]).describe(
|
|
11026
|
+
"Zapier connection ID. Accepts a positive integer (legacy) or a UUID string (newer connections)."
|
|
11027
|
+
)
|
|
11028
|
+
});
|
|
11029
|
+
var AppVersionMapEntrySchema = z.object({
|
|
11030
|
+
implementation_name: z.string().min(1).describe("Zapier app implementation name (e.g. `SlackCLIAPI`)"),
|
|
11031
|
+
version: z.string().optional().describe("Pinned app version (e.g. `1.27.1`). Latest if omitted.")
|
|
11032
|
+
});
|
|
11033
|
+
var RunDurableOptionsSchema = z.object({
|
|
11034
|
+
source_files: z.record(z.string(), z.string()).refine((files) => Object.keys(files).length > 0, {
|
|
11035
|
+
message: "source_files must contain at least one file"
|
|
11036
|
+
}).describe("Source files keyed by filename \u2192 contents"),
|
|
11037
|
+
input: z.unknown().optional().describe("Input data passed to the run"),
|
|
11038
|
+
dependencies: z.record(z.string(), z.string()).optional().describe("Optional npm package dependencies"),
|
|
11039
|
+
zapier_durable_version: z.string().optional().describe(
|
|
11040
|
+
'Exact semver of @zapier/zapier-durable to use (e.g. "1.2.3"). Defaults to server-configured version if omitted.'
|
|
11041
|
+
),
|
|
11042
|
+
connections: z.record(z.string(), ConnectionMapEntrySchema).optional().describe(
|
|
11043
|
+
"Named connection aliases. Maps alias names to Zapier connection IDs."
|
|
11044
|
+
),
|
|
11045
|
+
app_versions: z.record(z.string(), AppVersionMapEntrySchema).optional().describe(
|
|
11046
|
+
"Pinned app versions. Maps app keys (slugs) to implementation names and versions."
|
|
11047
|
+
),
|
|
11048
|
+
private: z.boolean().optional().describe("Only the creating user can see the run (default false)")
|
|
11049
|
+
}).describe(
|
|
11050
|
+
"Run a workflow source file as a run-once durable run on sdkdurableapi (no deployed workflow required). Returns the run ID immediately; poll via getDurableRun for terminal status."
|
|
11051
|
+
);
|
|
11052
|
+
var RunDurableResponseSchema = z.object({
|
|
11053
|
+
id: z.string().describe("Run ID (UUID) \u2014 server-generated, time-sortable"),
|
|
11054
|
+
status: z.literal("initialized").describe(
|
|
11055
|
+
"Always `initialized` on creation. Poll via getDurableRun to observe the run advancing to `started` / `finished` / `failed` / `cancelled`."
|
|
11056
|
+
),
|
|
11057
|
+
is_private: z.boolean().describe(
|
|
11058
|
+
"When true, the run is visible only to the creating user; otherwise visible across the account."
|
|
11059
|
+
),
|
|
11060
|
+
created_at: z.string().describe("When the run was created (ISO-8601)")
|
|
11061
|
+
});
|
|
11062
|
+
|
|
11063
|
+
// src/plugins/codeSubstrate/runDurable/index.ts
|
|
11064
|
+
var runDurablePlugin = definePlugin(
|
|
11065
|
+
(sdk) => createPluginMethod(sdk, {
|
|
11066
|
+
...codeSubstrateDefaults,
|
|
11067
|
+
name: "runDurable",
|
|
11068
|
+
type: "create",
|
|
11069
|
+
itemType: "DurableRun",
|
|
11070
|
+
inputSchema: RunDurableOptionsSchema,
|
|
11071
|
+
outputSchema: RunDurableResponseSchema,
|
|
11072
|
+
handler: async ({ sdk: sdk2, options }) => {
|
|
11073
|
+
const body = {
|
|
11074
|
+
source_files: options.source_files
|
|
11075
|
+
};
|
|
11076
|
+
if (options.input !== void 0) {
|
|
11077
|
+
body.input = options.input;
|
|
11078
|
+
}
|
|
11079
|
+
if (options.dependencies !== void 0) {
|
|
11080
|
+
body.dependencies = options.dependencies;
|
|
11081
|
+
}
|
|
11082
|
+
if (options.zapier_durable_version !== void 0) {
|
|
11083
|
+
body.zapier_durable_version = options.zapier_durable_version;
|
|
11084
|
+
}
|
|
11085
|
+
if (options.connections !== void 0) {
|
|
11086
|
+
body.connections = options.connections;
|
|
11087
|
+
}
|
|
11088
|
+
if (options.app_versions !== void 0) {
|
|
11089
|
+
body.app_versions = options.app_versions;
|
|
11090
|
+
}
|
|
11091
|
+
if (options.private !== void 0) {
|
|
11092
|
+
body.is_private = options.private;
|
|
11093
|
+
}
|
|
11094
|
+
const data = await sdk2.context.api.post(
|
|
11095
|
+
"/sdkdurableapi/api/v0/runs",
|
|
11096
|
+
body,
|
|
11097
|
+
{ authRequired: true }
|
|
11098
|
+
);
|
|
11099
|
+
return { data };
|
|
11100
|
+
}
|
|
11101
|
+
})
|
|
11102
|
+
);
|
|
11103
|
+
var CancelDurableRunOptionsSchema = z.object({
|
|
11104
|
+
run: z.string().uuid().describe("Durable run ID")
|
|
11105
|
+
}).describe(
|
|
11106
|
+
"Cancel a run-once durable run in initialized or started status. Returns 409 if the run is already terminal."
|
|
11107
|
+
);
|
|
11108
|
+
z.object({
|
|
11109
|
+
id: z.string().describe("Run ID that was targeted"),
|
|
11110
|
+
status: z.literal("cancelled").describe(
|
|
11111
|
+
"Always `cancelled` on a successful call. Synthesized client-side \u2014 the backend returns 204; callers needing the run's full state should follow up with getDurableRun."
|
|
11112
|
+
)
|
|
11113
|
+
});
|
|
11114
|
+
|
|
11115
|
+
// src/plugins/codeSubstrate/cancelDurableRun/index.ts
|
|
11116
|
+
var cancelDurableRunPlugin = definePlugin(
|
|
11117
|
+
(sdk) => createPluginMethod(sdk, {
|
|
11118
|
+
...codeSubstrateDefaults,
|
|
11119
|
+
name: "cancelDurableRun",
|
|
11120
|
+
type: "update",
|
|
11121
|
+
itemType: "DurableRun",
|
|
11122
|
+
inputSchema: CancelDurableRunOptionsSchema,
|
|
11123
|
+
resolvers: { run: durableRunIdResolver },
|
|
11124
|
+
handler: async ({ sdk: sdk2, options }) => {
|
|
11125
|
+
await sdk2.context.api.post(
|
|
11126
|
+
`/sdkdurableapi/api/v0/runs/${encodeURIComponent(options.run)}/cancel`,
|
|
11127
|
+
void 0,
|
|
11128
|
+
{
|
|
11129
|
+
authRequired: true,
|
|
11130
|
+
resource: { type: "run", id: options.run }
|
|
11131
|
+
}
|
|
11132
|
+
);
|
|
11133
|
+
return {
|
|
11134
|
+
data: { id: options.run, status: "cancelled" }
|
|
11135
|
+
};
|
|
11136
|
+
}
|
|
11137
|
+
})
|
|
11138
|
+
);
|
|
11020
11139
|
|
|
11021
11140
|
// src/utils/batch-utils.ts
|
|
11022
11141
|
var DEFAULT_CONCURRENCY = 10;
|
|
@@ -11176,7 +11295,7 @@ var registryPlugin = definePlugin((_sdk) => {
|
|
|
11176
11295
|
|
|
11177
11296
|
// src/experimental.ts
|
|
11178
11297
|
function createZapierSdk2(options = {}) {
|
|
11179
|
-
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(listDurableRunsPlugin).addPlugin(getDurableRunPlugin).addPlugin(appsPlugin).addPlugin(getProfilePlugin);
|
|
11298
|
+
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(listDurableRunsPlugin).addPlugin(getDurableRunPlugin).addPlugin(runDurablePlugin).addPlugin(cancelDurableRunPlugin).addPlugin(appsPlugin).addPlugin(getProfilePlugin);
|
|
11180
11299
|
}
|
|
11181
11300
|
|
|
11182
11301
|
export { ActionKeyPropertySchema, ActionPropertySchema, ActionTimeoutMsPropertySchema, ActionTypePropertySchema, AppKeyPropertySchema, AppPropertySchema, AppsPropertySchema, AuthenticationIdPropertySchema, BaseSdkOptionsSchema, CONTEXT_CACHE_MAX_SIZE, CONTEXT_CACHE_TTL_MS, ClientCredentialsObjectSchema, ConnectionEntrySchema, ConnectionIdPropertySchema, ConnectionPropertySchema, ConnectionsMapSchema, ConnectionsPropertySchema, CredentialsFunctionSchema, CredentialsObjectSchema, CredentialsSchema, DEFAULT_ACTION_TIMEOUT_MS, DEFAULT_APPROVAL_TIMEOUT_MS, DEFAULT_CONFIG_PATH, DEFAULT_MAX_APPROVAL_RETRIES, DEFAULT_PAGE_SIZE, DebugPropertySchema, FieldsPropertySchema, InputFieldPropertySchema, InputsPropertySchema, LeaseLimitPropertySchema, LeasePropertySchema, LeaseSecondsPropertySchema, LimitPropertySchema, MAX_CONCURRENCY_LIMIT, MAX_PAGE_LIMIT, OffsetPropertySchema, OutputPropertySchema, ParamsPropertySchema, PkceCredentialsObjectSchema, RecordPropertySchema, RecordsPropertySchema, RelayFetchSchema, RelayRequestSchema, ResolvedCredentialsSchema, TablePropertySchema, TablesPropertySchema, TriggerInboxNamePropertySchema, TriggerInboxPropertySchema, ZAPIER_BASE_URL, ZAPIER_MAX_CONCURRENT_REQUESTS, ZAPIER_MAX_NETWORK_RETRIES, ZAPIER_MAX_NETWORK_RETRY_DELAY_MS, ZapierAbortDrainSignal, ZapierActionError, ZapierApiError, ZapierAppNotFoundError, ZapierApprovalError, ZapierAuthenticationError, ZapierBundleError, ZapierConfigurationError, ZapierConflictError, ZapierError, ZapierNotFoundError, ZapierRateLimitError, ZapierRelayError, ZapierReleaseTriggerMessageSignal, ZapierResourceNotFoundError, ZapierSignal, ZapierTimeoutError, ZapierUnknownError, ZapierValidationError, actionKeyResolver, actionTypeResolver, apiPlugin, appKeyResolver, appsPlugin, connectionIdGenericResolver as authenticationIdGenericResolver, connectionIdResolver as authenticationIdResolver, batch, buildApplicationLifecycleEvent, buildCapabilityMessage, buildErrorEvent, buildErrorEventWithContext, buildMethodCalledEvent, cleanupEventListeners, clearTokenCache, clientCredentialsNameResolver, clientIdResolver, composePlugins, connectionIdGenericResolver, connectionIdResolver, connectionsPlugin, createBaseEvent, createClientCredentialsPlugin, createFunction, createMemoryCache, createOptionsPlugin, createPaginatedPluginMethod, createPluginMethod, createSdk, createTableFieldsPlugin, createTablePlugin, createTableRecordsPlugin, createZapierApi, createZapierSdk2 as createZapierSdk, createZapierSdkWithoutRegistry, definePlugin, deleteClientCredentialsPlugin, deleteTableFieldsPlugin, deleteTablePlugin, deleteTableRecordsPlugin, durableRunIdResolver, eventEmissionPlugin, fetchPlugin, findFirstConnectionPlugin, findManifestEntry, findUniqueConnectionPlugin, formatErrorMessage, generateEventId, getActionInputFieldsSchemaPlugin, getActionPlugin, getAppPlugin, getBaseUrlFromCredentials, getCiPlatform, getClientIdFromCredentials, getConnectionPlugin, getCpuTime, getCurrentTimestamp, getMemoryUsage, getOrCreateApiClient, getOsInfo, getPlatformVersions, getPreferredManifestEntryKey, getProfilePlugin, getReleaseId, getTablePlugin, getTableRecordPlugin, getTokenFromCliLogin, getZapierApprovalMode, getZapierDefaultApprovalMode, getZapierSdkService, injectCliLogin, inputFieldKeyResolver, inputsAllOptionalResolver, inputsResolver, invalidateCachedToken, invalidateCredentialsToken, isCi, isCliLoginAvailable, isClientCredentials, isCredentialsFunction, isCredentialsObject, isPkceCredentials, isPositional, listActionInputFieldChoicesPlugin, listActionInputFieldsPlugin, listActionsPlugin, listAppsPlugin, listClientCredentialsPlugin, listConnectionsPlugin, listTableFieldsPlugin, listTableRecordsPlugin, listTablesPlugin, logDeprecation, manifestPlugin, parseConcurrencyEnvVar, readManifestFromFile, registryPlugin, requestPlugin, resetDeprecationWarnings, resolveAuthToken, resolveCredentials, resolveCredentialsFromEnv, runActionPlugin, runWithTelemetryContext, tableFieldIdsResolver, tableFieldsResolver, tableFiltersResolver, tableIdResolver, tableNameResolver, tableRecordIdResolver, tableRecordIdsResolver, tableRecordsResolver, tableSortResolver, tableUpdateRecordsResolver, toSnakeCase, toTitleCase, triggerInboxResolver, triggerMessagesResolver, updateTableRecordsPlugin, workflowIdResolver };
|
package/dist/index.cjs
CHANGED
|
@@ -6354,7 +6354,7 @@ async function invalidateCredentialsToken(options) {
|
|
|
6354
6354
|
}
|
|
6355
6355
|
|
|
6356
6356
|
// src/sdk-version.ts
|
|
6357
|
-
var SDK_VERSION = (typeof process !== "undefined" && process.env ? "0.
|
|
6357
|
+
var SDK_VERSION = (typeof process !== "undefined" && process.env ? "0.63.0" : void 0) || "unknown";
|
|
6358
6358
|
|
|
6359
6359
|
// src/utils/open-url.ts
|
|
6360
6360
|
var nodePrefix = "node:";
|
package/dist/index.mjs
CHANGED
|
@@ -6352,7 +6352,7 @@ async function invalidateCredentialsToken(options) {
|
|
|
6352
6352
|
}
|
|
6353
6353
|
|
|
6354
6354
|
// src/sdk-version.ts
|
|
6355
|
-
var SDK_VERSION = (typeof process !== "undefined" && process.env ? "0.
|
|
6355
|
+
var SDK_VERSION = (typeof process !== "undefined" && process.env ? "0.63.0" : void 0) || "unknown";
|
|
6356
6356
|
|
|
6357
6357
|
// src/utils/open-url.ts
|
|
6358
6358
|
var nodePrefix = "node:";
|
|
@@ -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,53 @@
|
|
|
1
|
+
export declare const runDurablePlugin: (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
|
+
runDurable: (options?: {
|
|
25
|
+
source_files: Record<string, string>;
|
|
26
|
+
input?: unknown;
|
|
27
|
+
dependencies?: Record<string, string> | undefined;
|
|
28
|
+
zapier_durable_version?: string | undefined;
|
|
29
|
+
connections?: Record<string, {
|
|
30
|
+
connection_id: string | number;
|
|
31
|
+
}> | undefined;
|
|
32
|
+
app_versions?: Record<string, {
|
|
33
|
+
implementation_name: string;
|
|
34
|
+
version?: string | undefined;
|
|
35
|
+
}> | undefined;
|
|
36
|
+
private?: boolean | undefined;
|
|
37
|
+
} | undefined) => Promise<{
|
|
38
|
+
data: {
|
|
39
|
+
id: string;
|
|
40
|
+
status: "initialized";
|
|
41
|
+
is_private: boolean;
|
|
42
|
+
created_at: string;
|
|
43
|
+
};
|
|
44
|
+
}>;
|
|
45
|
+
} & {
|
|
46
|
+
context: {
|
|
47
|
+
meta: {
|
|
48
|
+
runDurable: import("../../..").PluginMeta;
|
|
49
|
+
};
|
|
50
|
+
};
|
|
51
|
+
};
|
|
52
|
+
export type RunDurablePluginProvides = ReturnType<typeof runDurablePlugin>;
|
|
53
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/plugins/codeSubstrate/runDurable/index.ts"],"names":[],"mappings":"AAUA,eAAO,MAAM,gBAAgB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAwC5B,CAAC;AAEF,MAAM,MAAM,wBAAwB,GAAG,UAAU,CAAC,OAAO,gBAAgB,CAAC,CAAC"}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { definePlugin, createPluginMethod } from "../../../utils/plugin-utils";
|
|
2
|
+
import { codeSubstrateDefaults } from "../shared";
|
|
3
|
+
import { RunDurableOptionsSchema, RunDurableResponseSchema, } from "./schemas";
|
|
4
|
+
export const runDurablePlugin = definePlugin((sdk) => createPluginMethod(sdk, {
|
|
5
|
+
...codeSubstrateDefaults,
|
|
6
|
+
name: "runDurable",
|
|
7
|
+
type: "create",
|
|
8
|
+
itemType: "DurableRun",
|
|
9
|
+
inputSchema: RunDurableOptionsSchema,
|
|
10
|
+
outputSchema: RunDurableResponseSchema,
|
|
11
|
+
handler: async ({ sdk, options }) => {
|
|
12
|
+
const body = {
|
|
13
|
+
source_files: options.source_files,
|
|
14
|
+
};
|
|
15
|
+
if (options.input !== undefined) {
|
|
16
|
+
body.input = options.input;
|
|
17
|
+
}
|
|
18
|
+
if (options.dependencies !== undefined) {
|
|
19
|
+
body.dependencies = options.dependencies;
|
|
20
|
+
}
|
|
21
|
+
if (options.zapier_durable_version !== undefined) {
|
|
22
|
+
body.zapier_durable_version = options.zapier_durable_version;
|
|
23
|
+
}
|
|
24
|
+
if (options.connections !== undefined) {
|
|
25
|
+
body.connections = options.connections;
|
|
26
|
+
}
|
|
27
|
+
if (options.app_versions !== undefined) {
|
|
28
|
+
body.app_versions = options.app_versions;
|
|
29
|
+
}
|
|
30
|
+
if (options.private !== undefined) {
|
|
31
|
+
body.is_private = options.private;
|
|
32
|
+
}
|
|
33
|
+
const data = await sdk.context.api.post("/sdkdurableapi/api/v0/runs", body, { authRequired: true });
|
|
34
|
+
return { data };
|
|
35
|
+
},
|
|
36
|
+
}));
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
export declare const RunDurableOptionsSchema: z.ZodObject<{
|
|
3
|
+
source_files: z.ZodRecord<z.ZodString, z.ZodString>;
|
|
4
|
+
input: z.ZodOptional<z.ZodUnknown>;
|
|
5
|
+
dependencies: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
6
|
+
zapier_durable_version: z.ZodOptional<z.ZodString>;
|
|
7
|
+
connections: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{
|
|
8
|
+
connection_id: z.ZodUnion<readonly [z.ZodString, z.ZodString, z.ZodNumber]>;
|
|
9
|
+
}, z.core.$strip>>>;
|
|
10
|
+
app_versions: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{
|
|
11
|
+
implementation_name: z.ZodString;
|
|
12
|
+
version: z.ZodOptional<z.ZodString>;
|
|
13
|
+
}, z.core.$strip>>>;
|
|
14
|
+
private: z.ZodOptional<z.ZodBoolean>;
|
|
15
|
+
}, z.core.$strip>;
|
|
16
|
+
export type RunDurableOptions = z.infer<typeof RunDurableOptionsSchema>;
|
|
17
|
+
export declare const RunDurableResponseSchema: z.ZodObject<{
|
|
18
|
+
id: z.ZodString;
|
|
19
|
+
status: z.ZodLiteral<"initialized">;
|
|
20
|
+
is_private: z.ZodBoolean;
|
|
21
|
+
created_at: z.ZodString;
|
|
22
|
+
}, z.core.$strip>;
|
|
23
|
+
export type RunDurableResponse = z.infer<typeof RunDurableResponseSchema>;
|
|
24
|
+
//# sourceMappingURL=schemas.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"schemas.d.ts","sourceRoot":"","sources":["../../../../src/plugins/codeSubstrate/runDurable/schemas.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAyBxB,eAAO,MAAM,uBAAuB;;;;;;;;;;;;;iBAsCjC,CAAC;AAEJ,MAAM,MAAM,iBAAiB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,uBAAuB,CAAC,CAAC;AAExE,eAAO,MAAM,wBAAwB;;;;;iBAanC,CAAC;AAEH,MAAM,MAAM,kBAAkB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,wBAAwB,CAAC,CAAC"}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
const ConnectionMapEntrySchema = z.object({
|
|
3
|
+
connection_id: z
|
|
4
|
+
.union([
|
|
5
|
+
z.string().regex(/^[1-9][0-9]*$/, "must be a positive integer string"),
|
|
6
|
+
z.string().uuid("must be a UUID"),
|
|
7
|
+
z.number().int().positive(),
|
|
8
|
+
])
|
|
9
|
+
.describe("Zapier connection ID. Accepts a positive integer (legacy) or a UUID string (newer connections)."),
|
|
10
|
+
});
|
|
11
|
+
const AppVersionMapEntrySchema = z.object({
|
|
12
|
+
implementation_name: z
|
|
13
|
+
.string()
|
|
14
|
+
.min(1)
|
|
15
|
+
.describe("Zapier app implementation name (e.g. `SlackCLIAPI`)"),
|
|
16
|
+
version: z
|
|
17
|
+
.string()
|
|
18
|
+
.optional()
|
|
19
|
+
.describe("Pinned app version (e.g. `1.27.1`). Latest if omitted."),
|
|
20
|
+
});
|
|
21
|
+
export const RunDurableOptionsSchema = z
|
|
22
|
+
.object({
|
|
23
|
+
source_files: z
|
|
24
|
+
.record(z.string(), z.string())
|
|
25
|
+
.refine((files) => Object.keys(files).length > 0, {
|
|
26
|
+
message: "source_files must contain at least one file",
|
|
27
|
+
})
|
|
28
|
+
.describe("Source files keyed by filename → contents"),
|
|
29
|
+
input: z.unknown().optional().describe("Input data passed to the run"),
|
|
30
|
+
dependencies: z
|
|
31
|
+
.record(z.string(), z.string())
|
|
32
|
+
.optional()
|
|
33
|
+
.describe("Optional npm package dependencies"),
|
|
34
|
+
zapier_durable_version: z
|
|
35
|
+
.string()
|
|
36
|
+
.optional()
|
|
37
|
+
.describe('Exact semver of @zapier/zapier-durable to use (e.g. "1.2.3"). Defaults to server-configured version if omitted.'),
|
|
38
|
+
connections: z
|
|
39
|
+
.record(z.string(), ConnectionMapEntrySchema)
|
|
40
|
+
.optional()
|
|
41
|
+
.describe("Named connection aliases. Maps alias names to Zapier connection IDs."),
|
|
42
|
+
app_versions: z
|
|
43
|
+
.record(z.string(), AppVersionMapEntrySchema)
|
|
44
|
+
.optional()
|
|
45
|
+
.describe("Pinned app versions. Maps app keys (slugs) to implementation names and versions."),
|
|
46
|
+
private: z
|
|
47
|
+
.boolean()
|
|
48
|
+
.optional()
|
|
49
|
+
.describe("Only the creating user can see the run (default false)"),
|
|
50
|
+
})
|
|
51
|
+
.describe("Run a workflow source file as a run-once durable run on sdkdurableapi (no deployed workflow required). Returns the run ID immediately; poll via getDurableRun for terminal status.");
|
|
52
|
+
export const RunDurableResponseSchema = z.object({
|
|
53
|
+
id: z.string().describe("Run ID (UUID) — server-generated, time-sortable"),
|
|
54
|
+
status: z
|
|
55
|
+
.literal("initialized")
|
|
56
|
+
.describe("Always `initialized` on creation. Poll via getDurableRun to observe the run advancing to `started` / `finished` / `failed` / `cancelled`."),
|
|
57
|
+
is_private: z
|
|
58
|
+
.boolean()
|
|
59
|
+
.describe("When true, the run is visible only to the creating user; otherwise visible across the account."),
|
|
60
|
+
created_at: z.string().describe("When the run was created (ISO-8601)"),
|
|
61
|
+
});
|