@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.
- package/CHANGELOG.md +12 -0
- package/README.md +1 -0
- package/dist/index.cjs +376 -219
- package/dist/index.d.mts +174 -424
- package/dist/index.d.ts +3 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.mjs +376 -220
- package/dist/plugins/api/index.d.ts +5 -1
- package/dist/plugins/api/index.d.ts.map +1 -1
- package/dist/plugins/api/index.js +2 -3
- package/dist/plugins/apps/index.d.ts +2 -3
- package/dist/plugins/apps/index.d.ts.map +1 -1
- package/dist/plugins/apps/index.js +1 -1
- package/dist/plugins/capabilities/index.d.ts +8 -6
- package/dist/plugins/capabilities/index.d.ts.map +1 -1
- package/dist/plugins/capabilities/index.js +3 -3
- package/dist/plugins/connections/index.d.ts +3 -1
- package/dist/plugins/connections/index.d.ts.map +1 -1
- package/dist/plugins/connections/index.js +2 -3
- package/dist/plugins/createClientCredentials/index.d.ts +6 -4
- package/dist/plugins/createClientCredentials/index.d.ts.map +1 -1
- package/dist/plugins/createClientCredentials/index.js +3 -3
- package/dist/plugins/deleteClientCredentials/index.d.ts +6 -4
- package/dist/plugins/deleteClientCredentials/index.d.ts.map +1 -1
- package/dist/plugins/deleteClientCredentials/index.js +3 -3
- package/dist/plugins/deprecated/authentications.d.ts +9 -9
- package/dist/plugins/deprecated/authentications.d.ts.map +1 -1
- package/dist/plugins/deprecated/authentications.js +4 -4
- package/dist/plugins/eventEmission/index.d.ts +4 -5
- package/dist/plugins/eventEmission/index.d.ts.map +1 -1
- package/dist/plugins/eventEmission/index.js +8 -7
- package/dist/plugins/fetch/index.d.ts +18 -23
- package/dist/plugins/fetch/index.d.ts.map +1 -1
- package/dist/plugins/fetch/index.js +88 -28
- package/dist/plugins/fetch/schemas.d.ts +8 -0
- package/dist/plugins/fetch/schemas.d.ts.map +1 -1
- package/dist/plugins/fetch/schemas.js +21 -12
- package/dist/plugins/findFirstConnection/index.d.ts +3 -4
- package/dist/plugins/findFirstConnection/index.d.ts.map +1 -1
- package/dist/plugins/findFirstConnection/index.js +2 -2
- package/dist/plugins/findUniqueConnection/index.d.ts +3 -4
- package/dist/plugins/findUniqueConnection/index.d.ts.map +1 -1
- package/dist/plugins/findUniqueConnection/index.js +2 -2
- package/dist/plugins/getAction/index.d.ts +7 -7
- package/dist/plugins/getAction/index.d.ts.map +1 -1
- package/dist/plugins/getAction/index.js +2 -2
- package/dist/plugins/getApp/index.d.ts +2 -3
- package/dist/plugins/getApp/index.d.ts.map +1 -1
- package/dist/plugins/getApp/index.js +2 -2
- package/dist/plugins/getConnection/index.d.ts +6 -6
- package/dist/plugins/getConnection/index.d.ts.map +1 -1
- package/dist/plugins/getConnection/index.js +3 -3
- package/dist/plugins/getInputFieldsSchema/index.d.ts +8 -6
- package/dist/plugins/getInputFieldsSchema/index.d.ts.map +1 -1
- package/dist/plugins/getInputFieldsSchema/index.js +4 -4
- package/dist/plugins/getProfile/index.d.ts +6 -6
- package/dist/plugins/getProfile/index.d.ts.map +1 -1
- package/dist/plugins/getProfile/index.js +3 -3
- package/dist/plugins/listActions/index.d.ts +8 -6
- package/dist/plugins/listActions/index.d.ts.map +1 -1
- package/dist/plugins/listActions/index.js +3 -3
- package/dist/plugins/listApps/index.d.ts +3 -3
- package/dist/plugins/listApps/index.d.ts.map +1 -1
- package/dist/plugins/listApps/index.js +3 -3
- package/dist/plugins/listClientCredentials/index.d.ts +6 -4
- package/dist/plugins/listClientCredentials/index.d.ts.map +1 -1
- package/dist/plugins/listClientCredentials/index.js +3 -3
- package/dist/plugins/listConnections/index.d.ts +8 -6
- package/dist/plugins/listConnections/index.d.ts.map +1 -1
- package/dist/plugins/listConnections/index.js +5 -5
- package/dist/plugins/listInputFieldChoices/index.d.ts +9 -8
- package/dist/plugins/listInputFieldChoices/index.d.ts.map +1 -1
- package/dist/plugins/listInputFieldChoices/index.js +4 -4
- package/dist/plugins/listInputFields/index.d.ts +8 -8
- package/dist/plugins/listInputFields/index.d.ts.map +1 -1
- package/dist/plugins/listInputFields/index.js +4 -4
- package/dist/plugins/manifest/index.d.ts +8 -3
- package/dist/plugins/manifest/index.d.ts.map +1 -1
- package/dist/plugins/manifest/index.js +2 -3
- package/dist/plugins/registry/index.d.ts +1 -2
- package/dist/plugins/registry/index.d.ts.map +1 -1
- package/dist/plugins/registry/index.js +3 -3
- package/dist/plugins/request/index.d.ts +3 -4
- package/dist/plugins/request/index.d.ts.map +1 -1
- package/dist/plugins/request/index.js +2 -2
- package/dist/plugins/runAction/index.d.ts +8 -8
- package/dist/plugins/runAction/index.d.ts.map +1 -1
- package/dist/plugins/runAction/index.js +5 -5
- package/dist/plugins/tables/createTable/index.d.ts +3 -5
- package/dist/plugins/tables/createTable/index.d.ts.map +1 -1
- package/dist/plugins/tables/createTable/index.js +3 -3
- package/dist/plugins/tables/createTableFields/index.d.ts +3 -5
- package/dist/plugins/tables/createTableFields/index.d.ts.map +1 -1
- package/dist/plugins/tables/createTableFields/index.js +3 -3
- package/dist/plugins/tables/createTableRecords/index.d.ts +3 -5
- package/dist/plugins/tables/createTableRecords/index.d.ts.map +1 -1
- package/dist/plugins/tables/createTableRecords/index.js +3 -3
- package/dist/plugins/tables/deleteTable/index.d.ts +5 -5
- package/dist/plugins/tables/deleteTable/index.d.ts.map +1 -1
- package/dist/plugins/tables/deleteTable/index.js +4 -4
- package/dist/plugins/tables/deleteTableFields/index.d.ts +3 -5
- package/dist/plugins/tables/deleteTableFields/index.d.ts.map +1 -1
- package/dist/plugins/tables/deleteTableFields/index.js +3 -3
- package/dist/plugins/tables/deleteTableRecords/index.d.ts +3 -5
- package/dist/plugins/tables/deleteTableRecords/index.d.ts.map +1 -1
- package/dist/plugins/tables/deleteTableRecords/index.js +3 -3
- package/dist/plugins/tables/getTable/index.d.ts +3 -5
- package/dist/plugins/tables/getTable/index.d.ts.map +1 -1
- package/dist/plugins/tables/getTable/index.js +3 -3
- package/dist/plugins/tables/getTableRecord/index.d.ts +3 -5
- package/dist/plugins/tables/getTableRecord/index.d.ts.map +1 -1
- package/dist/plugins/tables/getTableRecord/index.js +3 -3
- package/dist/plugins/tables/listTableFields/index.d.ts +3 -5
- package/dist/plugins/tables/listTableFields/index.d.ts.map +1 -1
- package/dist/plugins/tables/listTableFields/index.js +3 -3
- package/dist/plugins/tables/listTableRecords/index.d.ts +3 -3
- package/dist/plugins/tables/listTableRecords/index.d.ts.map +1 -1
- package/dist/plugins/tables/listTableRecords/index.js +3 -3
- package/dist/plugins/tables/listTables/index.d.ts +5 -3
- package/dist/plugins/tables/listTables/index.d.ts.map +1 -1
- package/dist/plugins/tables/listTables/index.js +4 -4
- package/dist/plugins/tables/updateTableRecords/index.d.ts +3 -5
- package/dist/plugins/tables/updateTableRecords/index.d.ts.map +1 -1
- package/dist/plugins/tables/updateTableRecords/index.js +3 -3
- package/dist/resolvers/connectionId.js +1 -1
- package/dist/resolvers/tableId.js +1 -1
- package/dist/sdk.d.ts +29 -257
- package/dist/sdk.d.ts.map +1 -1
- package/dist/sdk.js +33 -43
- package/dist/types/plugin.d.ts +29 -48
- package/dist/types/plugin.d.ts.map +1 -1
- package/dist/types/plugin.js +7 -3
- package/dist/types/sdk.d.ts +2 -3
- package/dist/types/sdk.d.ts.map +1 -1
- package/dist/utils/abort-utils.d.ts +64 -0
- package/dist/utils/abort-utils.d.ts.map +1 -0
- package/dist/utils/abort-utils.js +107 -0
- 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
|
+
}
|