@zapier/zapier-sdk 0.41.2 → 0.42.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.
Files changed (139) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/README.md +1 -0
  3. package/dist/index.cjs +376 -219
  4. package/dist/index.d.mts +174 -424
  5. package/dist/index.d.ts +3 -3
  6. package/dist/index.d.ts.map +1 -1
  7. package/dist/index.js +1 -1
  8. package/dist/index.mjs +376 -220
  9. package/dist/plugins/api/index.d.ts +5 -1
  10. package/dist/plugins/api/index.d.ts.map +1 -1
  11. package/dist/plugins/api/index.js +2 -3
  12. package/dist/plugins/apps/index.d.ts +2 -3
  13. package/dist/plugins/apps/index.d.ts.map +1 -1
  14. package/dist/plugins/apps/index.js +1 -1
  15. package/dist/plugins/capabilities/index.d.ts +8 -6
  16. package/dist/plugins/capabilities/index.d.ts.map +1 -1
  17. package/dist/plugins/capabilities/index.js +3 -3
  18. package/dist/plugins/connections/index.d.ts +3 -1
  19. package/dist/plugins/connections/index.d.ts.map +1 -1
  20. package/dist/plugins/connections/index.js +2 -3
  21. package/dist/plugins/createClientCredentials/index.d.ts +6 -4
  22. package/dist/plugins/createClientCredentials/index.d.ts.map +1 -1
  23. package/dist/plugins/createClientCredentials/index.js +3 -3
  24. package/dist/plugins/deleteClientCredentials/index.d.ts +6 -4
  25. package/dist/plugins/deleteClientCredentials/index.d.ts.map +1 -1
  26. package/dist/plugins/deleteClientCredentials/index.js +3 -3
  27. package/dist/plugins/deprecated/authentications.d.ts +9 -9
  28. package/dist/plugins/deprecated/authentications.d.ts.map +1 -1
  29. package/dist/plugins/deprecated/authentications.js +4 -4
  30. package/dist/plugins/eventEmission/index.d.ts +4 -5
  31. package/dist/plugins/eventEmission/index.d.ts.map +1 -1
  32. package/dist/plugins/eventEmission/index.js +8 -7
  33. package/dist/plugins/fetch/index.d.ts +18 -23
  34. package/dist/plugins/fetch/index.d.ts.map +1 -1
  35. package/dist/plugins/fetch/index.js +88 -28
  36. package/dist/plugins/fetch/schemas.d.ts +8 -0
  37. package/dist/plugins/fetch/schemas.d.ts.map +1 -1
  38. package/dist/plugins/fetch/schemas.js +21 -12
  39. package/dist/plugins/findFirstConnection/index.d.ts +3 -4
  40. package/dist/plugins/findFirstConnection/index.d.ts.map +1 -1
  41. package/dist/plugins/findFirstConnection/index.js +2 -2
  42. package/dist/plugins/findUniqueConnection/index.d.ts +3 -4
  43. package/dist/plugins/findUniqueConnection/index.d.ts.map +1 -1
  44. package/dist/plugins/findUniqueConnection/index.js +2 -2
  45. package/dist/plugins/getAction/index.d.ts +7 -7
  46. package/dist/plugins/getAction/index.d.ts.map +1 -1
  47. package/dist/plugins/getAction/index.js +2 -2
  48. package/dist/plugins/getApp/index.d.ts +2 -3
  49. package/dist/plugins/getApp/index.d.ts.map +1 -1
  50. package/dist/plugins/getApp/index.js +2 -2
  51. package/dist/plugins/getConnection/index.d.ts +6 -6
  52. package/dist/plugins/getConnection/index.d.ts.map +1 -1
  53. package/dist/plugins/getConnection/index.js +3 -3
  54. package/dist/plugins/getInputFieldsSchema/index.d.ts +8 -6
  55. package/dist/plugins/getInputFieldsSchema/index.d.ts.map +1 -1
  56. package/dist/plugins/getInputFieldsSchema/index.js +4 -4
  57. package/dist/plugins/getProfile/index.d.ts +6 -6
  58. package/dist/plugins/getProfile/index.d.ts.map +1 -1
  59. package/dist/plugins/getProfile/index.js +3 -3
  60. package/dist/plugins/listActions/index.d.ts +8 -6
  61. package/dist/plugins/listActions/index.d.ts.map +1 -1
  62. package/dist/plugins/listActions/index.js +3 -3
  63. package/dist/plugins/listApps/index.d.ts +3 -3
  64. package/dist/plugins/listApps/index.d.ts.map +1 -1
  65. package/dist/plugins/listApps/index.js +3 -3
  66. package/dist/plugins/listClientCredentials/index.d.ts +6 -4
  67. package/dist/plugins/listClientCredentials/index.d.ts.map +1 -1
  68. package/dist/plugins/listClientCredentials/index.js +3 -3
  69. package/dist/plugins/listConnections/index.d.ts +8 -6
  70. package/dist/plugins/listConnections/index.d.ts.map +1 -1
  71. package/dist/plugins/listConnections/index.js +5 -5
  72. package/dist/plugins/listInputFieldChoices/index.d.ts +9 -8
  73. package/dist/plugins/listInputFieldChoices/index.d.ts.map +1 -1
  74. package/dist/plugins/listInputFieldChoices/index.js +4 -4
  75. package/dist/plugins/listInputFields/index.d.ts +8 -8
  76. package/dist/plugins/listInputFields/index.d.ts.map +1 -1
  77. package/dist/plugins/listInputFields/index.js +4 -4
  78. package/dist/plugins/manifest/index.d.ts +8 -3
  79. package/dist/plugins/manifest/index.d.ts.map +1 -1
  80. package/dist/plugins/manifest/index.js +2 -3
  81. package/dist/plugins/registry/index.d.ts +1 -2
  82. package/dist/plugins/registry/index.d.ts.map +1 -1
  83. package/dist/plugins/registry/index.js +3 -3
  84. package/dist/plugins/request/index.d.ts +3 -4
  85. package/dist/plugins/request/index.d.ts.map +1 -1
  86. package/dist/plugins/request/index.js +2 -2
  87. package/dist/plugins/runAction/index.d.ts +8 -8
  88. package/dist/plugins/runAction/index.d.ts.map +1 -1
  89. package/dist/plugins/runAction/index.js +5 -5
  90. package/dist/plugins/tables/createTable/index.d.ts +3 -5
  91. package/dist/plugins/tables/createTable/index.d.ts.map +1 -1
  92. package/dist/plugins/tables/createTable/index.js +3 -3
  93. package/dist/plugins/tables/createTableFields/index.d.ts +3 -5
  94. package/dist/plugins/tables/createTableFields/index.d.ts.map +1 -1
  95. package/dist/plugins/tables/createTableFields/index.js +3 -3
  96. package/dist/plugins/tables/createTableRecords/index.d.ts +3 -5
  97. package/dist/plugins/tables/createTableRecords/index.d.ts.map +1 -1
  98. package/dist/plugins/tables/createTableRecords/index.js +3 -3
  99. package/dist/plugins/tables/deleteTable/index.d.ts +5 -5
  100. package/dist/plugins/tables/deleteTable/index.d.ts.map +1 -1
  101. package/dist/plugins/tables/deleteTable/index.js +4 -4
  102. package/dist/plugins/tables/deleteTableFields/index.d.ts +3 -5
  103. package/dist/plugins/tables/deleteTableFields/index.d.ts.map +1 -1
  104. package/dist/plugins/tables/deleteTableFields/index.js +3 -3
  105. package/dist/plugins/tables/deleteTableRecords/index.d.ts +3 -5
  106. package/dist/plugins/tables/deleteTableRecords/index.d.ts.map +1 -1
  107. package/dist/plugins/tables/deleteTableRecords/index.js +3 -3
  108. package/dist/plugins/tables/getTable/index.d.ts +3 -5
  109. package/dist/plugins/tables/getTable/index.d.ts.map +1 -1
  110. package/dist/plugins/tables/getTable/index.js +3 -3
  111. package/dist/plugins/tables/getTableRecord/index.d.ts +3 -5
  112. package/dist/plugins/tables/getTableRecord/index.d.ts.map +1 -1
  113. package/dist/plugins/tables/getTableRecord/index.js +3 -3
  114. package/dist/plugins/tables/listTableFields/index.d.ts +3 -5
  115. package/dist/plugins/tables/listTableFields/index.d.ts.map +1 -1
  116. package/dist/plugins/tables/listTableFields/index.js +3 -3
  117. package/dist/plugins/tables/listTableRecords/index.d.ts +3 -3
  118. package/dist/plugins/tables/listTableRecords/index.d.ts.map +1 -1
  119. package/dist/plugins/tables/listTableRecords/index.js +3 -3
  120. package/dist/plugins/tables/listTables/index.d.ts +5 -3
  121. package/dist/plugins/tables/listTables/index.d.ts.map +1 -1
  122. package/dist/plugins/tables/listTables/index.js +4 -4
  123. package/dist/plugins/tables/updateTableRecords/index.d.ts +3 -5
  124. package/dist/plugins/tables/updateTableRecords/index.d.ts.map +1 -1
  125. package/dist/plugins/tables/updateTableRecords/index.js +3 -3
  126. package/dist/resolvers/connectionId.js +1 -1
  127. package/dist/resolvers/tableId.js +1 -1
  128. package/dist/sdk.d.ts +29 -257
  129. package/dist/sdk.d.ts.map +1 -1
  130. package/dist/sdk.js +33 -43
  131. package/dist/types/plugin.d.ts +29 -48
  132. package/dist/types/plugin.d.ts.map +1 -1
  133. package/dist/types/plugin.js +7 -3
  134. package/dist/types/sdk.d.ts +2 -3
  135. package/dist/types/sdk.d.ts.map +1 -1
  136. package/dist/utils/abort-utils.d.ts +64 -0
  137. package/dist/utils/abort-utils.d.ts.map +1 -0
  138. package/dist/utils/abort-utils.js +107 -0
  139. package/package.json +1 -1
@@ -0,0 +1,64 @@
1
+ /**
2
+ * Wraps the subset of `AbortSignal` static methods that `combineAbortSignals`
3
+ * needs. Serves two real uses:
4
+ *
5
+ * 1. Runtime feature detection. `AbortSignal.any()` isn't present on every
6
+ * platform we support (Node <19, older browsers, some sandboxed
7
+ * runtimes), so `combineAbortSignals` checks `any` at call time and
8
+ * falls back to manual listener wiring when it's missing.
9
+ * 2. Test injection. Tests pass a fake `abortSignalApi` to force a
10
+ * specific branch (native vs. fallback) regardless of what the current
11
+ * runtime actually supports.
12
+ *
13
+ * By default, `combineAbortSignals` reads the real globals via
14
+ * `getAbortSignalApi()`; callers rarely need to pass this explicitly.
15
+ */
16
+ export interface AbortSignalApi {
17
+ any?: (signals: AbortSignal[]) => AbortSignal;
18
+ }
19
+ export interface DisposableAbortSignal {
20
+ signal: AbortSignal;
21
+ /**
22
+ * Release the resources backing this signal (timers, event listeners).
23
+ * Safe to call multiple times.
24
+ */
25
+ dispose: () => void;
26
+ }
27
+ export declare function createTimeoutError(timeoutMs: number): Error;
28
+ /**
29
+ * Creates an AbortSignal that fires after `timeoutMs` using a cancellable
30
+ * `AbortController` + `setTimeout`. We intentionally don't delegate to the
31
+ * native `AbortSignal.timeout()` — its returned signal has no way to cancel
32
+ * the underlying timer, which would make `dispose()` a lie on that path and
33
+ * give us divergent abort-reason messages across runtimes.
34
+ *
35
+ * On Node-like runtimes we `unref()` the timer so a pending timeout doesn't
36
+ * keep the process alive. In browsers `.unref` is absent and the guard is a
37
+ * harmless no-op.
38
+ *
39
+ * The signal's abort reason is a `DOMException` with `name: "TimeoutError"`
40
+ * so callers can distinguish timeout-driven aborts from caller-driven ones.
41
+ *
42
+ * Always call `dispose()` when the signal is no longer needed to clear the
43
+ * pending timer.
44
+ */
45
+ export declare function createTimeoutAbortSignal({ timeoutMs, }: {
46
+ timeoutMs: number;
47
+ }): DisposableAbortSignal;
48
+ /**
49
+ * Combines multiple disposable abort handles so the result aborts when *any*
50
+ * source does. Uses native `AbortSignal.any()` when available; otherwise wires
51
+ * up listeners manually.
52
+ *
53
+ * Returns `undefined` when the array is empty, or passes through a single
54
+ * handle without wrapping it.
55
+ *
56
+ * Always call `dispose()` on the result when it is no longer needed. This
57
+ * removes event listeners from source signals and calls `dispose()` on every
58
+ * input handle (releasing timers, etc).
59
+ */
60
+ export declare function combineAbortSignals({ handles, abortSignalApi, }: {
61
+ handles: DisposableAbortSignal[];
62
+ abortSignalApi?: AbortSignalApi;
63
+ }): DisposableAbortSignal | undefined;
64
+ //# sourceMappingURL=abort-utils.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"abort-utils.d.ts","sourceRoot":"","sources":["../../src/utils/abort-utils.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AACH,MAAM,WAAW,cAAc;IAC7B,GAAG,CAAC,EAAE,CAAC,OAAO,EAAE,WAAW,EAAE,KAAK,WAAW,CAAC;CAC/C;AAED,MAAM,WAAW,qBAAqB;IACpC,MAAM,EAAE,WAAW,CAAC;IACpB;;;OAGG;IACH,OAAO,EAAE,MAAM,IAAI,CAAC;CACrB;AAOD,wBAAgB,kBAAkB,CAAC,SAAS,EAAE,MAAM,GAAG,KAAK,CAW3D;AAMD;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,wBAAwB,CAAC,EACvC,SAAS,GACV,EAAE;IACD,SAAS,EAAE,MAAM,CAAC;CACnB,GAAG,qBAAqB,CAuBxB;AAMD;;;;;;;;;;;GAWG;AACH,wBAAgB,mBAAmB,CAAC,EAClC,OAAO,EACP,cAAoC,GACrC,EAAE;IACD,OAAO,EAAE,qBAAqB,EAAE,CAAC;IACjC,cAAc,CAAC,EAAE,cAAc,CAAC;CACjC,GAAG,qBAAqB,GAAG,SAAS,CAwCpC"}
@@ -0,0 +1,107 @@
1
+ function getAbortSignalApi() {
2
+ const api = AbortSignal;
3
+ return { any: api.any };
4
+ }
5
+ export function createTimeoutError(timeoutMs) {
6
+ if (typeof DOMException !== "undefined") {
7
+ return new DOMException(`The operation timed out after ${timeoutMs}ms`, "TimeoutError");
8
+ }
9
+ const error = new Error(`The operation timed out after ${timeoutMs}ms`);
10
+ error.name = "TimeoutError";
11
+ return error;
12
+ }
13
+ // ---------------------------------------------------------------------------
14
+ // createTimeoutAbortSignal
15
+ // ---------------------------------------------------------------------------
16
+ /**
17
+ * Creates an AbortSignal that fires after `timeoutMs` using a cancellable
18
+ * `AbortController` + `setTimeout`. We intentionally don't delegate to the
19
+ * native `AbortSignal.timeout()` — its returned signal has no way to cancel
20
+ * the underlying timer, which would make `dispose()` a lie on that path and
21
+ * give us divergent abort-reason messages across runtimes.
22
+ *
23
+ * On Node-like runtimes we `unref()` the timer so a pending timeout doesn't
24
+ * keep the process alive. In browsers `.unref` is absent and the guard is a
25
+ * harmless no-op.
26
+ *
27
+ * The signal's abort reason is a `DOMException` with `name: "TimeoutError"`
28
+ * so callers can distinguish timeout-driven aborts from caller-driven ones.
29
+ *
30
+ * Always call `dispose()` when the signal is no longer needed to clear the
31
+ * pending timer.
32
+ */
33
+ export function createTimeoutAbortSignal({ timeoutMs, }) {
34
+ const controller = new AbortController();
35
+ let timer = setTimeout(() => {
36
+ timer = undefined;
37
+ controller.abort(createTimeoutError(timeoutMs));
38
+ }, timeoutMs);
39
+ // Node (and Bun/Deno): don't let a pending timeout block process exit.
40
+ // Browsers: `unref` is undefined on the numeric handle; this is a no-op.
41
+ const maybeUnref = timer.unref;
42
+ if (typeof maybeUnref === "function") {
43
+ maybeUnref.call(timer);
44
+ }
45
+ return {
46
+ signal: controller.signal,
47
+ dispose: () => {
48
+ if (timer !== undefined) {
49
+ clearTimeout(timer);
50
+ timer = undefined;
51
+ }
52
+ },
53
+ };
54
+ }
55
+ // ---------------------------------------------------------------------------
56
+ // combineAbortSignals
57
+ // ---------------------------------------------------------------------------
58
+ /**
59
+ * Combines multiple disposable abort handles so the result aborts when *any*
60
+ * source does. Uses native `AbortSignal.any()` when available; otherwise wires
61
+ * up listeners manually.
62
+ *
63
+ * Returns `undefined` when the array is empty, or passes through a single
64
+ * handle without wrapping it.
65
+ *
66
+ * Always call `dispose()` on the result when it is no longer needed. This
67
+ * removes event listeners from source signals and calls `dispose()` on every
68
+ * input handle (releasing timers, etc).
69
+ */
70
+ export function combineAbortSignals({ handles, abortSignalApi = getAbortSignalApi(), }) {
71
+ if (handles.length === 0)
72
+ return undefined;
73
+ if (handles.length === 1)
74
+ return handles[0];
75
+ const disposeInputs = () => {
76
+ for (const handle of handles)
77
+ handle.dispose();
78
+ };
79
+ if (abortSignalApi.any) {
80
+ return {
81
+ signal: abortSignalApi.any(handles.map((h) => h.signal)),
82
+ dispose: disposeInputs,
83
+ };
84
+ }
85
+ // Fallback: wire up listeners manually.
86
+ const controller = new AbortController();
87
+ const listeners = [];
88
+ for (const { signal: source } of handles) {
89
+ if (source.aborted) {
90
+ controller.abort(source.reason);
91
+ return { signal: controller.signal, dispose: disposeInputs };
92
+ }
93
+ const handler = () => controller.abort(source.reason);
94
+ source.addEventListener("abort", handler, { once: true });
95
+ listeners.push({ source, handler });
96
+ }
97
+ return {
98
+ signal: controller.signal,
99
+ dispose: () => {
100
+ for (const { source, handler } of listeners) {
101
+ source.removeEventListener("abort", handler);
102
+ }
103
+ listeners.length = 0;
104
+ disposeInputs();
105
+ },
106
+ };
107
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zapier/zapier-sdk",
3
- "version": "0.41.2",
3
+ "version": "0.42.1",
4
4
  "description": "Complete Zapier SDK - combines all Zapier SDK packages",
5
5
  "main": "dist/index.cjs",
6
6
  "module": "dist/index.mjs",