@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.
Files changed (114) hide show
  1. package/CHANGELOG.md +35 -0
  2. package/README.md +248 -95
  3. package/dist/api/approval-review-stream.d.ts +25 -0
  4. package/dist/api/approval-review-stream.d.ts.map +1 -0
  5. package/dist/api/approval-review-stream.js +104 -0
  6. package/dist/api/client.d.ts.map +1 -1
  7. package/dist/api/client.js +215 -27
  8. package/dist/api/types.d.ts +13 -3
  9. package/dist/api/types.d.ts.map +1 -1
  10. package/dist/constants.d.ts +1 -0
  11. package/dist/constants.d.ts.map +1 -1
  12. package/dist/constants.js +6 -0
  13. package/dist/experimental.cjs +702 -67
  14. package/dist/experimental.d.mts +242 -2
  15. package/dist/experimental.d.ts +240 -0
  16. package/dist/experimental.d.ts.map +1 -1
  17. package/dist/experimental.js +10 -0
  18. package/dist/experimental.mjs +702 -68
  19. package/dist/{index-rIzBEINC.d.mts → index-B43uST61.d.mts} +248 -10
  20. package/dist/{index-rIzBEINC.d.ts → index-B43uST61.d.ts} +248 -10
  21. package/dist/index.cjs +592 -32
  22. package/dist/index.d.mts +1 -1
  23. package/dist/index.mjs +592 -33
  24. package/dist/plugins/api/index.d.ts.map +1 -1
  25. package/dist/plugins/api/index.js +2 -1
  26. package/dist/plugins/codeSubstrate/deleteWorkflow/index.d.ts +9 -0
  27. package/dist/plugins/codeSubstrate/deleteWorkflow/index.d.ts.map +1 -1
  28. package/dist/plugins/codeSubstrate/disableWorkflow/index.d.ts +9 -0
  29. package/dist/plugins/codeSubstrate/disableWorkflow/index.d.ts.map +1 -1
  30. package/dist/plugins/codeSubstrate/enableWorkflow/index.d.ts +9 -0
  31. package/dist/plugins/codeSubstrate/enableWorkflow/index.d.ts.map +1 -1
  32. package/dist/plugins/codeSubstrate/getDurableRun/schemas.d.ts +5 -5
  33. package/dist/plugins/codeSubstrate/getTriggerRun/schemas.d.ts +1 -1
  34. package/dist/plugins/codeSubstrate/getWorkflow/index.d.ts +31 -0
  35. package/dist/plugins/codeSubstrate/getWorkflow/index.d.ts.map +1 -1
  36. package/dist/plugins/codeSubstrate/getWorkflow/schemas.d.ts +42 -0
  37. package/dist/plugins/codeSubstrate/getWorkflow/schemas.d.ts.map +1 -1
  38. package/dist/plugins/codeSubstrate/getWorkflow/schemas.js +20 -0
  39. package/dist/plugins/codeSubstrate/getWorkflowRun/index.d.ts +9 -0
  40. package/dist/plugins/codeSubstrate/getWorkflowRun/index.d.ts.map +1 -1
  41. package/dist/plugins/codeSubstrate/getWorkflowRun/schemas.d.ts +1 -1
  42. package/dist/plugins/codeSubstrate/getWorkflowVersion/index.d.ts +35 -0
  43. package/dist/plugins/codeSubstrate/getWorkflowVersion/index.d.ts.map +1 -1
  44. package/dist/plugins/codeSubstrate/getWorkflowVersion/schemas.d.ts +13 -0
  45. package/dist/plugins/codeSubstrate/getWorkflowVersion/schemas.d.ts.map +1 -1
  46. package/dist/plugins/codeSubstrate/getWorkflowVersion/schemas.js +10 -0
  47. package/dist/plugins/codeSubstrate/listDurableRuns/schemas.d.ts +3 -3
  48. package/dist/plugins/codeSubstrate/listWorkflowRuns/index.d.ts +9 -0
  49. package/dist/plugins/codeSubstrate/listWorkflowRuns/index.d.ts.map +1 -1
  50. package/dist/plugins/codeSubstrate/listWorkflowRuns/schemas.d.ts +3 -3
  51. package/dist/plugins/codeSubstrate/listWorkflowVersions/index.d.ts +22 -0
  52. package/dist/plugins/codeSubstrate/listWorkflowVersions/index.d.ts.map +1 -1
  53. package/dist/plugins/codeSubstrate/listWorkflowVersions/schemas.d.ts +26 -0
  54. package/dist/plugins/codeSubstrate/listWorkflowVersions/schemas.d.ts.map +1 -1
  55. package/dist/plugins/codeSubstrate/listWorkflowVersions/schemas.js +10 -0
  56. package/dist/plugins/codeSubstrate/listWorkflows/index.d.ts +9 -0
  57. package/dist/plugins/codeSubstrate/listWorkflows/index.d.ts.map +1 -1
  58. package/dist/plugins/codeSubstrate/listWorkflows/schemas.d.ts +32 -0
  59. package/dist/plugins/codeSubstrate/listWorkflows/schemas.d.ts.map +1 -1
  60. package/dist/plugins/codeSubstrate/listWorkflows/schemas.js +11 -0
  61. package/dist/plugins/codeSubstrate/publishWorkflowVersion/index.d.ts +22 -0
  62. package/dist/plugins/codeSubstrate/publishWorkflowVersion/index.d.ts.map +1 -1
  63. package/dist/plugins/codeSubstrate/publishWorkflowVersion/schemas.d.ts +14 -1
  64. package/dist/plugins/codeSubstrate/publishWorkflowVersion/schemas.d.ts.map +1 -1
  65. package/dist/plugins/codeSubstrate/publishWorkflowVersion/schemas.js +11 -44
  66. package/dist/plugins/codeSubstrate/runDurable/index.d.ts +6 -0
  67. package/dist/plugins/codeSubstrate/runDurable/index.d.ts.map +1 -1
  68. package/dist/plugins/codeSubstrate/runDurable/index.js +3 -0
  69. package/dist/plugins/codeSubstrate/runDurable/schemas.d.ts +12 -0
  70. package/dist/plugins/codeSubstrate/runDurable/schemas.d.ts.map +1 -1
  71. package/dist/plugins/codeSubstrate/runDurable/schemas.js +33 -0
  72. package/dist/plugins/codeSubstrate/shared-schemas.d.ts +37 -0
  73. package/dist/plugins/codeSubstrate/shared-schemas.d.ts.map +1 -0
  74. package/dist/plugins/codeSubstrate/shared-schemas.js +69 -0
  75. package/dist/plugins/codeSubstrate/triggerWorkflow/index.d.ts +9 -0
  76. package/dist/plugins/codeSubstrate/triggerWorkflow/index.d.ts.map +1 -1
  77. package/dist/plugins/codeSubstrate/updateWorkflow/index.d.ts +11 -0
  78. package/dist/plugins/codeSubstrate/updateWorkflow/index.d.ts.map +1 -1
  79. package/dist/plugins/codeSubstrate/updateWorkflow/schemas.d.ts +2 -0
  80. package/dist/plugins/codeSubstrate/updateWorkflow/schemas.d.ts.map +1 -1
  81. package/dist/plugins/codeSubstrate/updateWorkflow/schemas.js +7 -0
  82. package/dist/plugins/createConnection/index.d.ts +189 -0
  83. package/dist/plugins/createConnection/index.d.ts.map +1 -0
  84. package/dist/plugins/createConnection/index.js +71 -0
  85. package/dist/plugins/createConnection/schemas.d.ts +21 -0
  86. package/dist/plugins/createConnection/schemas.d.ts.map +1 -0
  87. package/dist/plugins/createConnection/schemas.js +38 -0
  88. package/dist/plugins/getConnectionStartUrl/index.d.ts +206 -0
  89. package/dist/plugins/getConnectionStartUrl/index.d.ts.map +1 -0
  90. package/dist/plugins/getConnectionStartUrl/index.js +39 -0
  91. package/dist/plugins/getConnectionStartUrl/schemas.d.ts +15 -0
  92. package/dist/plugins/getConnectionStartUrl/schemas.d.ts.map +1 -0
  93. package/dist/plugins/getConnectionStartUrl/schemas.js +23 -0
  94. package/dist/plugins/waitForNewConnection/index.d.ts +209 -0
  95. package/dist/plugins/waitForNewConnection/index.d.ts.map +1 -0
  96. package/dist/plugins/waitForNewConnection/index.js +75 -0
  97. package/dist/plugins/waitForNewConnection/schemas.d.ts +17 -0
  98. package/dist/plugins/waitForNewConnection/schemas.d.ts.map +1 -0
  99. package/dist/plugins/waitForNewConnection/schemas.js +39 -0
  100. package/dist/sdk.d.ts +126 -0
  101. package/dist/sdk.d.ts.map +1 -1
  102. package/dist/sdk.js +8 -0
  103. package/dist/types/errors.d.ts +13 -4
  104. package/dist/types/errors.d.ts.map +1 -1
  105. package/dist/types/errors.js +2 -0
  106. package/dist/types/sdk.d.ts +1 -0
  107. package/dist/types/sdk.d.ts.map +1 -1
  108. package/dist/types/sdk.js +5 -1
  109. package/dist/utils/open-url.d.ts.map +1 -1
  110. package/dist/utils/open-url.js +7 -0
  111. package/dist/utils/should-open-browser.d.ts +24 -0
  112. package/dist/utils/should-open-browser.d.ts.map +1 -0
  113. package/dist/utils/should-open-browser.js +55 -0
  114. 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,CAgEhD,CAAC;AAEF,eAAe,OAAO,CAAC"}
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"}
@@ -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
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zapier/zapier-sdk",
3
- "version": "0.70.3",
3
+ "version": "0.71.0",
4
4
  "description": "Complete Zapier SDK - combines all Zapier SDK packages",
5
5
  "main": "dist/index.cjs",
6
6
  "module": "dist/index.mjs",