@zapier/zapier-sdk 0.70.3 → 0.71.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 +35 -0
- package/README.md +248 -95
- package/dist/api/approval-review-stream.d.ts +25 -0
- package/dist/api/approval-review-stream.d.ts.map +1 -0
- package/dist/api/approval-review-stream.js +104 -0
- package/dist/api/client.d.ts.map +1 -1
- package/dist/api/client.js +215 -27
- package/dist/api/types.d.ts +13 -3
- package/dist/api/types.d.ts.map +1 -1
- package/dist/constants.d.ts +1 -0
- package/dist/constants.d.ts.map +1 -1
- package/dist/constants.js +6 -0
- package/dist/experimental.cjs +702 -67
- package/dist/experimental.d.mts +242 -2
- package/dist/experimental.d.ts +240 -0
- package/dist/experimental.d.ts.map +1 -1
- package/dist/experimental.js +10 -0
- package/dist/experimental.mjs +702 -68
- package/dist/{index-rIzBEINC.d.mts → index-B43uST61.d.mts} +248 -10
- package/dist/{index-rIzBEINC.d.ts → index-B43uST61.d.ts} +248 -10
- package/dist/index.cjs +592 -32
- package/dist/index.d.mts +1 -1
- package/dist/index.mjs +592 -33
- package/dist/plugins/api/index.d.ts.map +1 -1
- package/dist/plugins/api/index.js +2 -1
- package/dist/plugins/codeSubstrate/deleteWorkflow/index.d.ts +9 -0
- package/dist/plugins/codeSubstrate/deleteWorkflow/index.d.ts.map +1 -1
- package/dist/plugins/codeSubstrate/disableWorkflow/index.d.ts +9 -0
- package/dist/plugins/codeSubstrate/disableWorkflow/index.d.ts.map +1 -1
- package/dist/plugins/codeSubstrate/enableWorkflow/index.d.ts +9 -0
- package/dist/plugins/codeSubstrate/enableWorkflow/index.d.ts.map +1 -1
- package/dist/plugins/codeSubstrate/getDurableRun/schemas.d.ts +5 -5
- package/dist/plugins/codeSubstrate/getTriggerRun/schemas.d.ts +1 -1
- package/dist/plugins/codeSubstrate/getWorkflow/index.d.ts +31 -0
- package/dist/plugins/codeSubstrate/getWorkflow/index.d.ts.map +1 -1
- package/dist/plugins/codeSubstrate/getWorkflow/schemas.d.ts +42 -0
- package/dist/plugins/codeSubstrate/getWorkflow/schemas.d.ts.map +1 -1
- package/dist/plugins/codeSubstrate/getWorkflow/schemas.js +20 -0
- package/dist/plugins/codeSubstrate/getWorkflowRun/index.d.ts +9 -0
- package/dist/plugins/codeSubstrate/getWorkflowRun/index.d.ts.map +1 -1
- package/dist/plugins/codeSubstrate/getWorkflowRun/schemas.d.ts +1 -1
- package/dist/plugins/codeSubstrate/getWorkflowVersion/index.d.ts +35 -0
- package/dist/plugins/codeSubstrate/getWorkflowVersion/index.d.ts.map +1 -1
- package/dist/plugins/codeSubstrate/getWorkflowVersion/schemas.d.ts +13 -0
- package/dist/plugins/codeSubstrate/getWorkflowVersion/schemas.d.ts.map +1 -1
- package/dist/plugins/codeSubstrate/getWorkflowVersion/schemas.js +10 -0
- package/dist/plugins/codeSubstrate/listDurableRuns/schemas.d.ts +3 -3
- package/dist/plugins/codeSubstrate/listWorkflowRuns/index.d.ts +9 -0
- package/dist/plugins/codeSubstrate/listWorkflowRuns/index.d.ts.map +1 -1
- package/dist/plugins/codeSubstrate/listWorkflowRuns/schemas.d.ts +3 -3
- package/dist/plugins/codeSubstrate/listWorkflowVersions/index.d.ts +22 -0
- package/dist/plugins/codeSubstrate/listWorkflowVersions/index.d.ts.map +1 -1
- package/dist/plugins/codeSubstrate/listWorkflowVersions/schemas.d.ts +26 -0
- package/dist/plugins/codeSubstrate/listWorkflowVersions/schemas.d.ts.map +1 -1
- package/dist/plugins/codeSubstrate/listWorkflowVersions/schemas.js +10 -0
- package/dist/plugins/codeSubstrate/listWorkflows/index.d.ts +9 -0
- package/dist/plugins/codeSubstrate/listWorkflows/index.d.ts.map +1 -1
- package/dist/plugins/codeSubstrate/listWorkflows/schemas.d.ts +32 -0
- package/dist/plugins/codeSubstrate/listWorkflows/schemas.d.ts.map +1 -1
- package/dist/plugins/codeSubstrate/listWorkflows/schemas.js +11 -0
- package/dist/plugins/codeSubstrate/publishWorkflowVersion/index.d.ts +22 -0
- package/dist/plugins/codeSubstrate/publishWorkflowVersion/index.d.ts.map +1 -1
- package/dist/plugins/codeSubstrate/publishWorkflowVersion/schemas.d.ts +14 -1
- package/dist/plugins/codeSubstrate/publishWorkflowVersion/schemas.d.ts.map +1 -1
- package/dist/plugins/codeSubstrate/publishWorkflowVersion/schemas.js +11 -44
- package/dist/plugins/codeSubstrate/runDurable/index.d.ts +6 -0
- package/dist/plugins/codeSubstrate/runDurable/index.d.ts.map +1 -1
- package/dist/plugins/codeSubstrate/runDurable/index.js +3 -0
- package/dist/plugins/codeSubstrate/runDurable/schemas.d.ts +12 -0
- package/dist/plugins/codeSubstrate/runDurable/schemas.d.ts.map +1 -1
- package/dist/plugins/codeSubstrate/runDurable/schemas.js +33 -0
- package/dist/plugins/codeSubstrate/shared-schemas.d.ts +37 -0
- package/dist/plugins/codeSubstrate/shared-schemas.d.ts.map +1 -0
- package/dist/plugins/codeSubstrate/shared-schemas.js +69 -0
- package/dist/plugins/codeSubstrate/triggerWorkflow/index.d.ts +9 -0
- package/dist/plugins/codeSubstrate/triggerWorkflow/index.d.ts.map +1 -1
- package/dist/plugins/codeSubstrate/updateWorkflow/index.d.ts +11 -0
- package/dist/plugins/codeSubstrate/updateWorkflow/index.d.ts.map +1 -1
- package/dist/plugins/codeSubstrate/updateWorkflow/schemas.d.ts +2 -0
- package/dist/plugins/codeSubstrate/updateWorkflow/schemas.d.ts.map +1 -1
- package/dist/plugins/codeSubstrate/updateWorkflow/schemas.js +7 -0
- package/dist/plugins/createConnection/index.d.ts +189 -0
- package/dist/plugins/createConnection/index.d.ts.map +1 -0
- package/dist/plugins/createConnection/index.js +71 -0
- package/dist/plugins/createConnection/schemas.d.ts +21 -0
- package/dist/plugins/createConnection/schemas.d.ts.map +1 -0
- package/dist/plugins/createConnection/schemas.js +38 -0
- package/dist/plugins/getConnectionStartUrl/index.d.ts +206 -0
- package/dist/plugins/getConnectionStartUrl/index.d.ts.map +1 -0
- package/dist/plugins/getConnectionStartUrl/index.js +39 -0
- package/dist/plugins/getConnectionStartUrl/schemas.d.ts +15 -0
- package/dist/plugins/getConnectionStartUrl/schemas.d.ts.map +1 -0
- package/dist/plugins/getConnectionStartUrl/schemas.js +23 -0
- package/dist/plugins/waitForNewConnection/index.d.ts +209 -0
- package/dist/plugins/waitForNewConnection/index.d.ts.map +1 -0
- package/dist/plugins/waitForNewConnection/index.js +75 -0
- package/dist/plugins/waitForNewConnection/schemas.d.ts +17 -0
- package/dist/plugins/waitForNewConnection/schemas.d.ts.map +1 -0
- package/dist/plugins/waitForNewConnection/schemas.js +39 -0
- package/dist/sdk.d.ts +126 -0
- package/dist/sdk.d.ts.map +1 -1
- package/dist/sdk.js +8 -0
- package/dist/types/errors.d.ts +13 -4
- package/dist/types/errors.d.ts.map +1 -1
- package/dist/types/errors.js +2 -0
- package/dist/types/sdk.d.ts +1 -0
- package/dist/types/sdk.d.ts.map +1 -1
- package/dist/types/sdk.js +5 -1
- package/dist/utils/open-url.d.ts.map +1 -1
- package/dist/utils/open-url.js +7 -0
- package/dist/utils/should-open-browser.d.ts +24 -0
- package/dist/utils/should-open-browser.d.ts.map +1 -0
- package/dist/utils/should-open-browser.js +55 -0
- package/package.json +1 -1
package/dist/types/sdk.js
CHANGED
|
@@ -73,7 +73,11 @@ export const BaseSdkOptionsSchema = z.object({
|
|
|
73
73
|
approvalMode: z
|
|
74
74
|
.enum(["disabled", "poll", "throw"])
|
|
75
75
|
.optional()
|
|
76
|
-
.describe('Approval flow behavior. "poll" creates the approval, opens it in a browser, polls until resolved, and retries the original request. "throw" creates the approval and throws a ZapierApprovalError with the approval URL so the caller can surface it. "disabled" throws a ZapierApprovalError on approval-required responses without creating an approval. Resolution order is: explicit option, then ZAPIER_APPROVAL_MODE, then the default behavior (poll for interactive TTY, throw otherwise).'),
|
|
76
|
+
.describe('Approval flow behavior for manual approvals. "poll" creates the approval, opens it in a browser, polls until resolved, and retries the original request. "throw" creates the manual approval and throws a ZapierApprovalError with the approval URL so the caller can surface it. Server-created auto-mode approvals always poll until they reach a terminal status and retry the original request on approval, even when this option is "throw". "disabled" throws a ZapierApprovalError on approval-required responses without creating an approval. Resolution order is: explicit option, then ZAPIER_APPROVAL_MODE, then the default behavior (poll for interactive TTY, throw otherwise).'),
|
|
77
|
+
openAutoModeApprovalsInBrowser: z
|
|
78
|
+
.boolean()
|
|
79
|
+
.optional()
|
|
80
|
+
.describe("By default, auto-mode approvals do not open in a browser. Enable this option to open the approval URL and watch the approval process. Resolution order is: explicit option, then ZAPIER_OPEN_AUTO_MODE_APPROVALS_IN_BROWSER, then false."),
|
|
77
81
|
// Internal
|
|
78
82
|
manifestPath: z
|
|
79
83
|
.string()
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"open-url.d.ts","sourceRoot":"","sources":["../../src/utils/open-url.ts"],"names":[],"mappings":"AAmBA,QAAA,MAAM,OAAO,GAAU,KAAK,MAAM,KAAG,OAAO,CAAC,IAAI,
|
|
1
|
+
{"version":3,"file":"open-url.d.ts","sourceRoot":"","sources":["../../src/utils/open-url.ts"],"names":[],"mappings":"AAmBA,QAAA,MAAM,OAAO,GAAU,KAAK,MAAM,KAAG,OAAO,CAAC,IAAI,CAsEhD,CAAC;AAEF,eAAe,OAAO,CAAC"}
|
package/dist/utils/open-url.js
CHANGED
|
@@ -58,6 +58,13 @@ const openUrl = async (url) => {
|
|
|
58
58
|
command = "rundll32";
|
|
59
59
|
args = ["url.dll,FileProtocolHandler", target];
|
|
60
60
|
}
|
|
61
|
+
else if (platform === "linux") {
|
|
62
|
+
// xdg-open hands the URL to the desktop's default handler. On a headless
|
|
63
|
+
// host it exits non-zero (no handler / no display); the `error` handler
|
|
64
|
+
// below and the caller's stderr fallback cover that case.
|
|
65
|
+
command = "xdg-open";
|
|
66
|
+
args = [target];
|
|
67
|
+
}
|
|
61
68
|
else {
|
|
62
69
|
throw new Error(`Unsupported platform: ${platform}`);
|
|
63
70
|
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Decide whether `createConnection` should attempt to auto-open a browser
|
|
3
|
+
* tab. Used as the default for `browser: "auto"`. Callers can always force
|
|
4
|
+
* with `browser: "always"` or `browser: "never"`.
|
|
5
|
+
*
|
|
6
|
+
* Returns `false` only when we're confident the open would land somewhere
|
|
7
|
+
* the user can't act on:
|
|
8
|
+
*
|
|
9
|
+
* 1. CI — no human at the keyboard.
|
|
10
|
+
* 2. SSH session — the browser would launch on the remote host, not on
|
|
11
|
+
* the user's local machine.
|
|
12
|
+
* 3. Headless Linux — no display server means there's nowhere for a
|
|
13
|
+
* browser to land. (macOS / Windows are assumed to have a display.)
|
|
14
|
+
*
|
|
15
|
+
* Otherwise returns `true`. Notably this does NOT branch on `isTTY` or
|
|
16
|
+
* any agent env-var allowlist — the URL is always printed to stderr
|
|
17
|
+
* regardless, so a failed or skipped auto-open degrades gracefully to
|
|
18
|
+
* "user copies the printed URL." We bias toward opening because the cost
|
|
19
|
+
* of a false negative (user has to copy/paste) is small, while the cost
|
|
20
|
+
* of a false positive (browser opens in the wrong place) only really
|
|
21
|
+
* matters for the three scenarios above.
|
|
22
|
+
*/
|
|
23
|
+
export declare function shouldOpenBrowser(): boolean;
|
|
24
|
+
//# sourceMappingURL=should-open-browser.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"should-open-browser.d.ts","sourceRoot":"","sources":["../../src/utils/should-open-browser.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,wBAAgB,iBAAiB,IAAI,OAAO,CAY3C"}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Decide whether `createConnection` should attempt to auto-open a browser
|
|
3
|
+
* tab. Used as the default for `browser: "auto"`. Callers can always force
|
|
4
|
+
* with `browser: "always"` or `browser: "never"`.
|
|
5
|
+
*
|
|
6
|
+
* Returns `false` only when we're confident the open would land somewhere
|
|
7
|
+
* the user can't act on:
|
|
8
|
+
*
|
|
9
|
+
* 1. CI — no human at the keyboard.
|
|
10
|
+
* 2. SSH session — the browser would launch on the remote host, not on
|
|
11
|
+
* the user's local machine.
|
|
12
|
+
* 3. Headless Linux — no display server means there's nowhere for a
|
|
13
|
+
* browser to land. (macOS / Windows are assumed to have a display.)
|
|
14
|
+
*
|
|
15
|
+
* Otherwise returns `true`. Notably this does NOT branch on `isTTY` or
|
|
16
|
+
* any agent env-var allowlist — the URL is always printed to stderr
|
|
17
|
+
* regardless, so a failed or skipped auto-open degrades gracefully to
|
|
18
|
+
* "user copies the printed URL." We bias toward opening because the cost
|
|
19
|
+
* of a false negative (user has to copy/paste) is small, while the cost
|
|
20
|
+
* of a false positive (browser opens in the wrong place) only really
|
|
21
|
+
* matters for the three scenarios above.
|
|
22
|
+
*/
|
|
23
|
+
export function shouldOpenBrowser() {
|
|
24
|
+
if (isCiEnv())
|
|
25
|
+
return false;
|
|
26
|
+
const env = globalThis.process?.env;
|
|
27
|
+
if (env?.SSH_TTY || env?.SSH_CONNECTION)
|
|
28
|
+
return false;
|
|
29
|
+
if (globalThis.process?.platform === "linux" &&
|
|
30
|
+
!env?.DISPLAY &&
|
|
31
|
+
!env?.WAYLAND_DISPLAY) {
|
|
32
|
+
return false;
|
|
33
|
+
}
|
|
34
|
+
return true;
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Inlined copy of `plugins/eventEmission/utils.ts`'s `isCi()`. Inlined
|
|
38
|
+
* rather than imported so `should-open-browser.ts` (a general util) doesn't
|
|
39
|
+
* reach into a peer plugin's internals — no other `utils/` file does that.
|
|
40
|
+
* Reads `globalThis.process?.env` to match `isCi()` and the rest of the core
|
|
41
|
+
* package's universal-SDK access pattern (safe in browser bundles).
|
|
42
|
+
*/
|
|
43
|
+
function isCiEnv() {
|
|
44
|
+
const env = globalThis.process?.env;
|
|
45
|
+
return !!(env?.CI ||
|
|
46
|
+
env?.CONTINUOUS_INTEGRATION ||
|
|
47
|
+
env?.GITHUB_ACTIONS ||
|
|
48
|
+
env?.JENKINS_URL ||
|
|
49
|
+
env?.GITLAB_CI ||
|
|
50
|
+
env?.CIRCLECI ||
|
|
51
|
+
env?.TRAVIS ||
|
|
52
|
+
env?.BUILDKITE ||
|
|
53
|
+
env?.DRONE ||
|
|
54
|
+
env?.BITBUCKET_PIPELINES_UUID);
|
|
55
|
+
}
|