@zapier/zapier-sdk 0.76.2 โ 0.77.1
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 +7 -7
- package/dist/experimental.cjs +22 -32
- package/dist/experimental.d.mts +6 -6
- package/dist/experimental.d.ts +6 -6
- package/dist/experimental.mjs +22 -32
- package/dist/index.cjs +4 -3
- package/dist/index.mjs +4 -3
- package/dist/plugins/codeSubstrate/triggerWorkflow/index.d.ts +3 -9
- package/dist/plugins/codeSubstrate/triggerWorkflow/index.d.ts.map +1 -1
- package/dist/plugins/codeSubstrate/triggerWorkflow/index.js +17 -29
- package/dist/plugins/codeSubstrate/triggerWorkflow/schemas.d.ts +3 -3
- package/dist/plugins/codeSubstrate/triggerWorkflow/schemas.d.ts.map +1 -1
- package/dist/plugins/codeSubstrate/triggerWorkflow/schemas.js +4 -9
- package/dist/plugins/runAction/index.d.ts.map +1 -1
- package/dist/plugins/runAction/index.js +3 -2
- package/package.json +3 -3
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
# @zapier/zapier-sdk
|
|
2
2
|
|
|
3
|
+
## 0.77.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 3fa9190: Upgrade `@zapier/policy-context`, which drops `@asteasolutions/zod-to-openapi` from it's dependency tree.
|
|
8
|
+
|
|
9
|
+
## 0.77.0
|
|
10
|
+
|
|
11
|
+
### Minor Changes
|
|
12
|
+
|
|
13
|
+
- 19303e0: `triggerWorkflow` (and `trigger-workflow`) now authenticates with Zapier credentials and runs the workflow as the authenticated account; triggering is limited to workflows that account can access. It now returns the trigger's `id`, `workflow_id`, and `created_at` on `data` (previously `{ workflow, status, body }`). The call is unchanged: pass the workflow id and optional `input`.
|
|
14
|
+
|
|
3
15
|
## 0.76.2
|
|
4
16
|
|
|
5
17
|
### Patch Changes
|
package/README.md
CHANGED
|
@@ -1744,7 +1744,7 @@ const result = await zapier.runDurable({
|
|
|
1744
1744
|
|
|
1745
1745
|
#### `triggerWorkflow` ๐งช _experimental_
|
|
1746
1746
|
|
|
1747
|
-
Look up a workflow's trigger URL and fire it manually
|
|
1747
|
+
Look up a workflow's trigger URL and fire it manually, as the authenticated account.
|
|
1748
1748
|
|
|
1749
1749
|
**Parameters:**
|
|
1750
1750
|
|
|
@@ -1756,12 +1756,12 @@ Look up a workflow's trigger URL and fire it manually. The trigger endpoint is t
|
|
|
1756
1756
|
|
|
1757
1757
|
**Returns:** `Promise<WorkflowRunItem>`
|
|
1758
1758
|
|
|
1759
|
-
| Name
|
|
1760
|
-
|
|
|
1761
|
-
| `data`
|
|
1762
|
-
| โย โณย `
|
|
1763
|
-
| โย โณย `
|
|
1764
|
-
| โย โณย `
|
|
1759
|
+
| Name | Type | Required | Possible Values | Description |
|
|
1760
|
+
| ----------------- | -------- | -------- | --------------- | ---------------------------------------- |
|
|
1761
|
+
| `data` | `object` | โ
| โ | |
|
|
1762
|
+
| โย โณย `id` | `string` | โ
| โ | Trigger ID (UUID) |
|
|
1763
|
+
| โย โณย `workflow_id` | `string` | โ
| โ | The workflow that was triggered (UUID) |
|
|
1764
|
+
| โย โณย `created_at` | `string` | โ
| โ | When the trigger was received (ISO-8601) |
|
|
1765
1765
|
|
|
1766
1766
|
**Example:**
|
|
1767
1767
|
|
package/dist/experimental.cjs
CHANGED
|
@@ -3403,7 +3403,7 @@ function parseApprovalReviewStreamPayload(parsed, toolNames) {
|
|
|
3403
3403
|
}
|
|
3404
3404
|
|
|
3405
3405
|
// src/sdk-version.ts
|
|
3406
|
-
var SDK_VERSION = (typeof process !== "undefined" && process.env ? "0.
|
|
3406
|
+
var SDK_VERSION = (typeof process !== "undefined" && process.env ? "0.77.1" : void 0) || "unknown";
|
|
3407
3407
|
|
|
3408
3408
|
// src/utils/open-url.ts
|
|
3409
3409
|
var nodePrefix = "node:";
|
|
@@ -6424,8 +6424,9 @@ async function executeAction(actionOptions) {
|
|
|
6424
6424
|
action_type: actionType,
|
|
6425
6425
|
action_key: actionKey,
|
|
6426
6426
|
connection_id: connectionId != null ? String(connectionId) : void 0,
|
|
6427
|
-
// Cast: inputs is Record<string, unknown> at the SDK surface
|
|
6428
|
-
// buildActionRunContext
|
|
6427
|
+
// Cast: inputs is Record<string, unknown> at the SDK surface;
|
|
6428
|
+
// buildActionRunContext validates it as JSON at runtime via zod
|
|
6429
|
+
// (non-JSON values like Date/undefined are rejected there).
|
|
6429
6430
|
inputs: executionOptions.inputs ?? {}
|
|
6430
6431
|
})
|
|
6431
6432
|
}
|
|
@@ -13099,14 +13100,12 @@ var TriggerWorkflowOptionsSchema = zod.z.object({
|
|
|
13099
13100
|
"JSON payload delivered as the trigger body. Sent as `application/json`; omit to fire with an empty body."
|
|
13100
13101
|
)
|
|
13101
13102
|
}).describe(
|
|
13102
|
-
"Look up a workflow's trigger URL and fire it manually
|
|
13103
|
+
"Look up a workflow's trigger URL and fire it manually, as the authenticated account."
|
|
13103
13104
|
);
|
|
13104
13105
|
var TriggerWorkflowResponseSchema = zod.z.object({
|
|
13105
|
-
|
|
13106
|
-
|
|
13107
|
-
|
|
13108
|
-
"Response body from the trigger endpoint. Parsed as JSON when the response body parses, otherwise returned as the raw response text."
|
|
13109
|
-
)
|
|
13106
|
+
id: zod.z.string().describe("Trigger ID (UUID)"),
|
|
13107
|
+
workflow_id: zod.z.string().describe("The workflow that was triggered (UUID)"),
|
|
13108
|
+
created_at: zod.z.string().describe("When the trigger was received (ISO-8601)")
|
|
13110
13109
|
});
|
|
13111
13110
|
|
|
13112
13111
|
// src/plugins/codeSubstrate/triggerWorkflow/index.ts
|
|
@@ -13128,32 +13127,23 @@ var triggerWorkflowPlugin = definePlugin(
|
|
|
13128
13127
|
}
|
|
13129
13128
|
);
|
|
13130
13129
|
const workflow = TriggerWorkflowLookupResponseSchema.parse(rawWorkflow);
|
|
13131
|
-
const
|
|
13132
|
-
const
|
|
13133
|
-
|
|
13134
|
-
headers: { "Content-Type": "application/json" },
|
|
13135
|
-
body: options.input === void 0 ? void 0 : JSON.stringify(options.input)
|
|
13136
|
-
});
|
|
13137
|
-
const text = await response.text().catch(() => "");
|
|
13138
|
-
let body = text;
|
|
13139
|
-
if (text) {
|
|
13140
|
-
try {
|
|
13141
|
-
body = JSON.parse(text);
|
|
13142
|
-
} catch {
|
|
13143
|
-
body = text;
|
|
13144
|
-
}
|
|
13145
|
-
}
|
|
13146
|
-
if (!response.ok) {
|
|
13130
|
+
const segments = new URL(workflow.trigger_url).pathname.split("/");
|
|
13131
|
+
const triggerToken = segments[segments.length - 1];
|
|
13132
|
+
if (!triggerToken) {
|
|
13147
13133
|
throw new ZapierApiError(
|
|
13148
|
-
`
|
|
13149
|
-
{ statusCode:
|
|
13134
|
+
`Workflow ${options.workflow} returned a malformed trigger_url`,
|
|
13135
|
+
{ statusCode: 0, response: workflow.trigger_url }
|
|
13150
13136
|
);
|
|
13151
13137
|
}
|
|
13152
|
-
const
|
|
13153
|
-
|
|
13154
|
-
|
|
13155
|
-
|
|
13156
|
-
|
|
13138
|
+
const raw = await sdk2.context.api.post(
|
|
13139
|
+
`/durableworkflowzaps/api/v0/workflows/trigger/${encodeURIComponent(triggerToken)}`,
|
|
13140
|
+
options.input,
|
|
13141
|
+
{
|
|
13142
|
+
authRequired: true,
|
|
13143
|
+
resource: { type: "workflow", id: options.workflow }
|
|
13144
|
+
}
|
|
13145
|
+
);
|
|
13146
|
+
const data = TriggerWorkflowResponseSchema.parse(raw);
|
|
13157
13147
|
return { data };
|
|
13158
13148
|
}
|
|
13159
13149
|
})
|
package/dist/experimental.d.mts
CHANGED
|
@@ -3162,9 +3162,9 @@ declare function createZapierSdkStack(options?: ZapierSdkOptions): PluginStack<o
|
|
|
3162
3162
|
input?: unknown;
|
|
3163
3163
|
} | undefined) => Promise<{
|
|
3164
3164
|
data: {
|
|
3165
|
-
|
|
3166
|
-
|
|
3167
|
-
|
|
3165
|
+
id: string;
|
|
3166
|
+
workflow_id: string;
|
|
3167
|
+
created_at: string;
|
|
3168
3168
|
};
|
|
3169
3169
|
}>;
|
|
3170
3170
|
} & {
|
|
@@ -6365,9 +6365,9 @@ declare function createZapierSdk(options?: ZapierSdkOptions): WithAddPlugin<obje
|
|
|
6365
6365
|
input?: unknown;
|
|
6366
6366
|
} | undefined) => Promise<{
|
|
6367
6367
|
data: {
|
|
6368
|
-
|
|
6369
|
-
|
|
6370
|
-
|
|
6368
|
+
id: string;
|
|
6369
|
+
workflow_id: string;
|
|
6370
|
+
created_at: string;
|
|
6371
6371
|
};
|
|
6372
6372
|
}>;
|
|
6373
6373
|
} & {
|
package/dist/experimental.d.ts
CHANGED
|
@@ -3177,9 +3177,9 @@ export declare function createZapierSdkStack(options?: ZapierSdkOptions): import
|
|
|
3177
3177
|
input?: unknown;
|
|
3178
3178
|
} | undefined) => Promise<{
|
|
3179
3179
|
data: {
|
|
3180
|
-
|
|
3181
|
-
|
|
3182
|
-
|
|
3180
|
+
id: string;
|
|
3181
|
+
workflow_id: string;
|
|
3182
|
+
created_at: string;
|
|
3183
3183
|
};
|
|
3184
3184
|
}>;
|
|
3185
3185
|
} & {
|
|
@@ -6380,9 +6380,9 @@ export declare function createZapierSdk(options?: ZapierSdkOptions): import("kit
|
|
|
6380
6380
|
input?: unknown;
|
|
6381
6381
|
} | undefined) => Promise<{
|
|
6382
6382
|
data: {
|
|
6383
|
-
|
|
6384
|
-
|
|
6385
|
-
|
|
6383
|
+
id: string;
|
|
6384
|
+
workflow_id: string;
|
|
6385
|
+
created_at: string;
|
|
6386
6386
|
};
|
|
6387
6387
|
}>;
|
|
6388
6388
|
} & {
|
package/dist/experimental.mjs
CHANGED
|
@@ -3401,7 +3401,7 @@ function parseApprovalReviewStreamPayload(parsed, toolNames) {
|
|
|
3401
3401
|
}
|
|
3402
3402
|
|
|
3403
3403
|
// src/sdk-version.ts
|
|
3404
|
-
var SDK_VERSION = (typeof process !== "undefined" && process.env ? "0.
|
|
3404
|
+
var SDK_VERSION = (typeof process !== "undefined" && process.env ? "0.77.1" : void 0) || "unknown";
|
|
3405
3405
|
|
|
3406
3406
|
// src/utils/open-url.ts
|
|
3407
3407
|
var nodePrefix = "node:";
|
|
@@ -6422,8 +6422,9 @@ async function executeAction(actionOptions) {
|
|
|
6422
6422
|
action_type: actionType,
|
|
6423
6423
|
action_key: actionKey,
|
|
6424
6424
|
connection_id: connectionId != null ? String(connectionId) : void 0,
|
|
6425
|
-
// Cast: inputs is Record<string, unknown> at the SDK surface
|
|
6426
|
-
// buildActionRunContext
|
|
6425
|
+
// Cast: inputs is Record<string, unknown> at the SDK surface;
|
|
6426
|
+
// buildActionRunContext validates it as JSON at runtime via zod
|
|
6427
|
+
// (non-JSON values like Date/undefined are rejected there).
|
|
6427
6428
|
inputs: executionOptions.inputs ?? {}
|
|
6428
6429
|
})
|
|
6429
6430
|
}
|
|
@@ -13097,14 +13098,12 @@ var TriggerWorkflowOptionsSchema = z.object({
|
|
|
13097
13098
|
"JSON payload delivered as the trigger body. Sent as `application/json`; omit to fire with an empty body."
|
|
13098
13099
|
)
|
|
13099
13100
|
}).describe(
|
|
13100
|
-
"Look up a workflow's trigger URL and fire it manually
|
|
13101
|
+
"Look up a workflow's trigger URL and fire it manually, as the authenticated account."
|
|
13101
13102
|
);
|
|
13102
13103
|
var TriggerWorkflowResponseSchema = z.object({
|
|
13103
|
-
|
|
13104
|
-
|
|
13105
|
-
|
|
13106
|
-
"Response body from the trigger endpoint. Parsed as JSON when the response body parses, otherwise returned as the raw response text."
|
|
13107
|
-
)
|
|
13104
|
+
id: z.string().describe("Trigger ID (UUID)"),
|
|
13105
|
+
workflow_id: z.string().describe("The workflow that was triggered (UUID)"),
|
|
13106
|
+
created_at: z.string().describe("When the trigger was received (ISO-8601)")
|
|
13108
13107
|
});
|
|
13109
13108
|
|
|
13110
13109
|
// src/plugins/codeSubstrate/triggerWorkflow/index.ts
|
|
@@ -13126,32 +13125,23 @@ var triggerWorkflowPlugin = definePlugin(
|
|
|
13126
13125
|
}
|
|
13127
13126
|
);
|
|
13128
13127
|
const workflow = TriggerWorkflowLookupResponseSchema.parse(rawWorkflow);
|
|
13129
|
-
const
|
|
13130
|
-
const
|
|
13131
|
-
|
|
13132
|
-
headers: { "Content-Type": "application/json" },
|
|
13133
|
-
body: options.input === void 0 ? void 0 : JSON.stringify(options.input)
|
|
13134
|
-
});
|
|
13135
|
-
const text = await response.text().catch(() => "");
|
|
13136
|
-
let body = text;
|
|
13137
|
-
if (text) {
|
|
13138
|
-
try {
|
|
13139
|
-
body = JSON.parse(text);
|
|
13140
|
-
} catch {
|
|
13141
|
-
body = text;
|
|
13142
|
-
}
|
|
13143
|
-
}
|
|
13144
|
-
if (!response.ok) {
|
|
13128
|
+
const segments = new URL(workflow.trigger_url).pathname.split("/");
|
|
13129
|
+
const triggerToken = segments[segments.length - 1];
|
|
13130
|
+
if (!triggerToken) {
|
|
13145
13131
|
throw new ZapierApiError(
|
|
13146
|
-
`
|
|
13147
|
-
{ statusCode:
|
|
13132
|
+
`Workflow ${options.workflow} returned a malformed trigger_url`,
|
|
13133
|
+
{ statusCode: 0, response: workflow.trigger_url }
|
|
13148
13134
|
);
|
|
13149
13135
|
}
|
|
13150
|
-
const
|
|
13151
|
-
|
|
13152
|
-
|
|
13153
|
-
|
|
13154
|
-
|
|
13136
|
+
const raw = await sdk2.context.api.post(
|
|
13137
|
+
`/durableworkflowzaps/api/v0/workflows/trigger/${encodeURIComponent(triggerToken)}`,
|
|
13138
|
+
options.input,
|
|
13139
|
+
{
|
|
13140
|
+
authRequired: true,
|
|
13141
|
+
resource: { type: "workflow", id: options.workflow }
|
|
13142
|
+
}
|
|
13143
|
+
);
|
|
13144
|
+
const data = TriggerWorkflowResponseSchema.parse(raw);
|
|
13155
13145
|
return { data };
|
|
13156
13146
|
}
|
|
13157
13147
|
})
|
package/dist/index.cjs
CHANGED
|
@@ -4940,8 +4940,9 @@ async function executeAction(actionOptions) {
|
|
|
4940
4940
|
action_type: actionType,
|
|
4941
4941
|
action_key: actionKey,
|
|
4942
4942
|
connection_id: connectionId != null ? String(connectionId) : void 0,
|
|
4943
|
-
// Cast: inputs is Record<string, unknown> at the SDK surface
|
|
4944
|
-
// buildActionRunContext
|
|
4943
|
+
// Cast: inputs is Record<string, unknown> at the SDK surface;
|
|
4944
|
+
// buildActionRunContext validates it as JSON at runtime via zod
|
|
4945
|
+
// (non-JSON values like Date/undefined are rejected there).
|
|
4945
4946
|
inputs: executionOptions.inputs ?? {}
|
|
4946
4947
|
})
|
|
4947
4948
|
}
|
|
@@ -6996,7 +6997,7 @@ function parseApprovalReviewStreamPayload(parsed, toolNames) {
|
|
|
6996
6997
|
}
|
|
6997
6998
|
|
|
6998
6999
|
// src/sdk-version.ts
|
|
6999
|
-
var SDK_VERSION = (typeof process !== "undefined" && process.env ? "0.
|
|
7000
|
+
var SDK_VERSION = (typeof process !== "undefined" && process.env ? "0.77.1" : void 0) || "unknown";
|
|
7000
7001
|
|
|
7001
7002
|
// src/utils/open-url.ts
|
|
7002
7003
|
var nodePrefix = "node:";
|
package/dist/index.mjs
CHANGED
|
@@ -4938,8 +4938,9 @@ async function executeAction(actionOptions) {
|
|
|
4938
4938
|
action_type: actionType,
|
|
4939
4939
|
action_key: actionKey,
|
|
4940
4940
|
connection_id: connectionId != null ? String(connectionId) : void 0,
|
|
4941
|
-
// Cast: inputs is Record<string, unknown> at the SDK surface
|
|
4942
|
-
// buildActionRunContext
|
|
4941
|
+
// Cast: inputs is Record<string, unknown> at the SDK surface;
|
|
4942
|
+
// buildActionRunContext validates it as JSON at runtime via zod
|
|
4943
|
+
// (non-JSON values like Date/undefined are rejected there).
|
|
4943
4944
|
inputs: executionOptions.inputs ?? {}
|
|
4944
4945
|
})
|
|
4945
4946
|
}
|
|
@@ -6994,7 +6995,7 @@ function parseApprovalReviewStreamPayload(parsed, toolNames) {
|
|
|
6994
6995
|
}
|
|
6995
6996
|
|
|
6996
6997
|
// src/sdk-version.ts
|
|
6997
|
-
var SDK_VERSION = (typeof process !== "undefined" && process.env ? "0.
|
|
6998
|
+
var SDK_VERSION = (typeof process !== "undefined" && process.env ? "0.77.1" : void 0) || "unknown";
|
|
6998
6999
|
|
|
6999
7000
|
// src/utils/open-url.ts
|
|
7000
7001
|
var nodePrefix = "node:";
|
|
@@ -52,12 +52,6 @@ export declare const triggerWorkflowPlugin: (sdk: {
|
|
|
52
52
|
listWorkflows: import("kitcore").PluginMeta<unknown>;
|
|
53
53
|
};
|
|
54
54
|
};
|
|
55
|
-
} & {
|
|
56
|
-
context: {
|
|
57
|
-
options: {
|
|
58
|
-
fetch?: typeof globalThis.fetch;
|
|
59
|
-
};
|
|
60
|
-
};
|
|
61
55
|
} & {
|
|
62
56
|
context: {
|
|
63
57
|
meta: Record<string, import("kitcore").PluginMeta>;
|
|
@@ -68,9 +62,9 @@ export declare const triggerWorkflowPlugin: (sdk: {
|
|
|
68
62
|
input?: unknown;
|
|
69
63
|
} | undefined) => Promise<{
|
|
70
64
|
data: {
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
65
|
+
id: string;
|
|
66
|
+
workflow_id: string;
|
|
67
|
+
created_at: string;
|
|
74
68
|
};
|
|
75
69
|
}>;
|
|
76
70
|
} & {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/plugins/codeSubstrate/triggerWorkflow/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/plugins/codeSubstrate/triggerWorkflow/index.ts"],"names":[],"mappings":"AAaA,eAAO,MAAM,qBAAqB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAoDjC,CAAC;AAEF,MAAM,MAAM,6BAA6B,GAAG,UAAU,CACpD,OAAO,qBAAqB,CAC7B,CAAC"}
|
|
@@ -12,41 +12,29 @@ export const triggerWorkflowPlugin = definePlugin((sdk) => createPluginMethod(sd
|
|
|
12
12
|
outputSchema: TriggerWorkflowResponseSchema,
|
|
13
13
|
resolvers: { workflow: workflowIdResolver },
|
|
14
14
|
handler: async ({ sdk, options }) => {
|
|
15
|
-
// Two-step: get the workflow's trigger_url
|
|
16
|
-
//
|
|
17
|
-
// auth header โ the URL itself embeds a secret token. Custom
|
|
18
|
-
// fetch (e.g. tests) flows through sdk.context.options.fetch.
|
|
15
|
+
// Two-step: get the workflow's trigger_url, then fire it. Both go
|
|
16
|
+
// through the authenticated api client.
|
|
19
17
|
const rawWorkflow = await sdk.context.api.get(`/durableworkflowzaps/api/v0/workflows/${encodeURIComponent(options.workflow)}`, {
|
|
20
18
|
authRequired: true,
|
|
21
19
|
resource: { type: "workflow", id: options.workflow },
|
|
22
20
|
});
|
|
23
21
|
const workflow = TriggerWorkflowLookupResponseSchema.parse(rawWorkflow);
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
});
|
|
32
|
-
const text = await response.text().catch(() => "");
|
|
33
|
-
let body = text;
|
|
34
|
-
if (text) {
|
|
35
|
-
try {
|
|
36
|
-
body = JSON.parse(text);
|
|
37
|
-
}
|
|
38
|
-
catch {
|
|
39
|
-
body = text;
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
if (!response.ok) {
|
|
43
|
-
throw new ZapierApiError(`Trigger failed: ${response.status} ${response.statusText}: ${text || "(empty body)"}`, { statusCode: response.status, response: body });
|
|
22
|
+
// trigger_url is an absolute URL. Take only the token (its last path
|
|
23
|
+
// segment) and rebuild the gateway path so the call routes through the
|
|
24
|
+
// authenticated proxy, the same as every other call here.
|
|
25
|
+
const segments = new URL(workflow.trigger_url).pathname.split("/");
|
|
26
|
+
const triggerToken = segments[segments.length - 1];
|
|
27
|
+
if (!triggerToken) {
|
|
28
|
+
throw new ZapierApiError(`Workflow ${options.workflow} returned a malformed trigger_url`, { statusCode: 0, response: workflow.trigger_url });
|
|
44
29
|
}
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
30
|
+
// Fire the trigger through the authenticated api client and return its
|
|
31
|
+
// response directly, the same as every other code-substrate method.
|
|
32
|
+
// api.post throws the SDK's typed errors on non-2xx.
|
|
33
|
+
const raw = await sdk.context.api.post(`/durableworkflowzaps/api/v0/workflows/trigger/${encodeURIComponent(triggerToken)}`, options.input, {
|
|
34
|
+
authRequired: true,
|
|
35
|
+
resource: { type: "workflow", id: options.workflow },
|
|
36
|
+
});
|
|
37
|
+
const data = TriggerWorkflowResponseSchema.parse(raw);
|
|
50
38
|
return { data };
|
|
51
39
|
},
|
|
52
40
|
}));
|
|
@@ -8,9 +8,9 @@ export declare const TriggerWorkflowOptionsSchema: z.ZodObject<{
|
|
|
8
8
|
}, z.core.$strip>;
|
|
9
9
|
export type TriggerWorkflowOptions = z.infer<typeof TriggerWorkflowOptionsSchema>;
|
|
10
10
|
export declare const TriggerWorkflowResponseSchema: z.ZodObject<{
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
11
|
+
id: z.ZodString;
|
|
12
|
+
workflow_id: z.ZodString;
|
|
13
|
+
created_at: z.ZodString;
|
|
14
14
|
}, z.core.$strip>;
|
|
15
15
|
export type TriggerWorkflowResponse = z.infer<typeof TriggerWorkflowResponseSchema>;
|
|
16
16
|
//# sourceMappingURL=schemas.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"schemas.d.ts","sourceRoot":"","sources":["../../../../src/plugins/codeSubstrate/triggerWorkflow/schemas.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAQxB,eAAO,MAAM,mCAAmC;;iBAIhC,CAAC;AAEjB,eAAO,MAAM,4BAA4B;;;iBAYtC,CAAC;AAEJ,MAAM,MAAM,sBAAsB,GAAG,CAAC,CAAC,KAAK,CAC1C,OAAO,4BAA4B,CACpC,CAAC;AAEF,eAAO,MAAM,6BAA6B;;;;
|
|
1
|
+
{"version":3,"file":"schemas.d.ts","sourceRoot":"","sources":["../../../../src/plugins/codeSubstrate/triggerWorkflow/schemas.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAQxB,eAAO,MAAM,mCAAmC;;iBAIhC,CAAC;AAEjB,eAAO,MAAM,4BAA4B;;;iBAYtC,CAAC;AAEJ,MAAM,MAAM,sBAAsB,GAAG,CAAC,CAAC,KAAK,CAC1C,OAAO,4BAA4B,CACpC,CAAC;AAEF,eAAO,MAAM,6BAA6B;;;;iBAIxC,CAAC;AAEH,MAAM,MAAM,uBAAuB,GAAG,CAAC,CAAC,KAAK,CAC3C,OAAO,6BAA6B,CACrC,CAAC"}
|
|
@@ -18,14 +18,9 @@ export const TriggerWorkflowOptionsSchema = z
|
|
|
18
18
|
.optional()
|
|
19
19
|
.describe("JSON payload delivered as the trigger body. Sent as `application/json`; omit to fire with an empty body."),
|
|
20
20
|
})
|
|
21
|
-
.describe("Look up a workflow's trigger URL and fire it manually
|
|
21
|
+
.describe("Look up a workflow's trigger URL and fire it manually, as the authenticated account.");
|
|
22
22
|
export const TriggerWorkflowResponseSchema = z.object({
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
.int()
|
|
27
|
-
.describe("HTTP status returned by the trigger endpoint"),
|
|
28
|
-
body: z
|
|
29
|
-
.unknown()
|
|
30
|
-
.describe("Response body from the trigger endpoint. Parsed as JSON when the response body parses, otherwise returned as the raw response text."),
|
|
23
|
+
id: z.string().describe("Trigger ID (UUID)"),
|
|
24
|
+
workflow_id: z.string().describe("The workflow that was triggered (UUID)"),
|
|
25
|
+
created_at: z.string().describe("When the trigger was received (ISO-8601)"),
|
|
31
26
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/plugins/runAction/index.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AAqB3C,OAAO,KAAK,EAAE,4BAA4B,EAAE,MAAM,qBAAqB,CAAC;AACxE,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,gBAAgB,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/plugins/runAction/index.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AAqB3C,OAAO,KAAK,EAAE,4BAA4B,EAAE,MAAM,qBAAqB,CAAC;AACxE,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,gBAAgB,CAAC;AA6GhE,eAAO,MAAM,oBAAoB,QAAS,CAAC;AAC3C,eAAO,MAAM,sBAAsB,MAAM,CAAC;AAE1C,eAAO,MAAM,eAAe;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;aAOX;QACP,GAAG,EAAE,SAAS,CAAC;QACf,4BAA4B,EAAE,4BAA4B,CAAC;KAC5D,GAAG,yBAAyB,CAAC,SAAS,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAwL/C,CAAC;AAEF,MAAM,MAAM,uBAAuB,GAAG,UAAU,CAAC,OAAO,eAAe,CAAC,CAAC"}
|
|
@@ -35,8 +35,9 @@ async function executeAction(actionOptions) {
|
|
|
35
35
|
action_type: actionType,
|
|
36
36
|
action_key: actionKey,
|
|
37
37
|
connection_id: connectionId != null ? String(connectionId) : undefined,
|
|
38
|
-
// Cast: inputs is Record<string, unknown> at the SDK surface
|
|
39
|
-
// buildActionRunContext
|
|
38
|
+
// Cast: inputs is Record<string, unknown> at the SDK surface;
|
|
39
|
+
// buildActionRunContext validates it as JSON at runtime via zod
|
|
40
|
+
// (non-JSON values like Date/undefined are rejected there).
|
|
40
41
|
inputs: (executionOptions.inputs ?? {}),
|
|
41
42
|
}),
|
|
42
43
|
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zapier/zapier-sdk",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.77.1",
|
|
4
4
|
"description": "Complete Zapier SDK - combines all Zapier SDK packages",
|
|
5
5
|
"main": "dist/index.cjs",
|
|
6
6
|
"module": "dist/index.mjs",
|
|
@@ -85,8 +85,8 @@
|
|
|
85
85
|
"access": "public"
|
|
86
86
|
},
|
|
87
87
|
"dependencies": {
|
|
88
|
-
"@zapier/policy-context": "
|
|
89
|
-
"@zapier/policy-schema": "0.
|
|
88
|
+
"@zapier/policy-context": "1.2.2",
|
|
89
|
+
"@zapier/policy-schema": "0.15.0",
|
|
90
90
|
"@zapier/zapier-sdk-core": "0.12.0",
|
|
91
91
|
"zod": "4.3.6"
|
|
92
92
|
},
|