@zapier/zapier-sdk 0.28.0 → 0.30.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 +15 -0
- package/README.md +1 -1
- package/dist/index.cjs +216 -202
- package/dist/index.d.mts +2 -30
- package/dist/index.mjs +216 -202
- package/dist/plugins/createClientCredentials/schemas.d.ts +0 -3
- package/dist/plugins/createClientCredentials/schemas.d.ts.map +1 -1
- package/dist/plugins/createClientCredentials/schemas.js +0 -2
- package/dist/plugins/deleteClientCredentials/schemas.d.ts +0 -3
- package/dist/plugins/deleteClientCredentials/schemas.d.ts.map +1 -1
- package/dist/plugins/deleteClientCredentials/schemas.js +0 -2
- package/dist/plugins/fetch/index.d.ts +0 -3
- package/dist/plugins/fetch/index.d.ts.map +1 -1
- package/dist/plugins/fetch/index.js +60 -52
- package/dist/plugins/findFirstConnection/index.d.ts.map +1 -1
- package/dist/plugins/findFirstConnection/index.js +0 -1
- package/dist/plugins/findFirstConnection/schemas.d.ts.map +1 -1
- package/dist/plugins/findFirstConnection/schemas.js +0 -1
- package/dist/plugins/findUniqueConnection/index.d.ts.map +1 -1
- package/dist/plugins/findUniqueConnection/index.js +0 -1
- package/dist/plugins/findUniqueConnection/schemas.d.ts.map +1 -1
- package/dist/plugins/findUniqueConnection/schemas.js +0 -1
- package/dist/plugins/getAction/index.d.ts.map +1 -1
- package/dist/plugins/getAction/index.js +1 -3
- package/dist/plugins/getAction/schemas.d.ts +0 -3
- package/dist/plugins/getAction/schemas.d.ts.map +1 -1
- package/dist/plugins/getAction/schemas.js +0 -2
- package/dist/plugins/getApp/index.d.ts.map +1 -1
- package/dist/plugins/getApp/index.js +0 -1
- package/dist/plugins/listActions/schemas.d.ts +0 -3
- package/dist/plugins/listActions/schemas.d.ts.map +1 -1
- package/dist/plugins/listActions/schemas.js +0 -2
- package/dist/plugins/listApps/schemas.d.ts +0 -3
- package/dist/plugins/listApps/schemas.d.ts.map +1 -1
- package/dist/plugins/listApps/schemas.js +0 -2
- package/dist/plugins/listClientCredentials/schemas.d.ts +0 -3
- package/dist/plugins/listClientCredentials/schemas.d.ts.map +1 -1
- package/dist/plugins/listClientCredentials/schemas.js +0 -2
- package/dist/plugins/listConnections/schemas.d.ts +0 -3
- package/dist/plugins/listConnections/schemas.d.ts.map +1 -1
- package/dist/plugins/listConnections/schemas.js +0 -2
- package/dist/plugins/registry/index.d.ts.map +1 -1
- package/dist/plugins/registry/index.js +1 -0
- package/dist/plugins/request/index.d.ts.map +1 -1
- package/dist/plugins/request/index.js +0 -1
- package/dist/plugins/request/schemas.d.ts +0 -6
- package/dist/plugins/request/schemas.d.ts.map +1 -1
- package/dist/plugins/request/schemas.js +0 -2
- package/dist/plugins/runAction/index.d.ts.map +1 -1
- package/dist/plugins/runAction/index.js +0 -1
- package/dist/types/sdk.d.ts +2 -0
- package/dist/types/sdk.d.ts.map +1 -1
- package/dist/utils/function-utils.d.ts +1 -14
- package/dist/utils/function-utils.d.ts.map +1 -1
- package/dist/utils/function-utils.js +115 -123
- package/dist/utils/function-utils.test.js +79 -1
- package/dist/utils/telemetry-context.d.ts +3 -0
- package/dist/utils/telemetry-context.d.ts.map +1 -0
- package/dist/utils/telemetry-context.js +23 -0
- package/dist/utils/telemetry-context.test.d.ts +2 -0
- package/dist/utils/telemetry-context.test.d.ts.map +1 -0
- package/dist/utils/telemetry-context.test.js +92 -0
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,20 @@
|
|
|
1
1
|
# @zapier/zapier-sdk
|
|
2
2
|
|
|
3
|
+
## 0.30.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- 0055854: Remove internal `_telemetry` property from all method option types
|
|
8
|
+
|
|
9
|
+
## 0.29.0
|
|
10
|
+
|
|
11
|
+
### Minor Changes
|
|
12
|
+
|
|
13
|
+
- ad5ee3b: Adds a new curl plugin.
|
|
14
|
+
Switch -v flag to -V for version information.
|
|
15
|
+
Fix CLI to properly handle string and object types.
|
|
16
|
+
Add redirect passthrough to fetch plugin (to support curl plugin).
|
|
17
|
+
|
|
3
18
|
## 0.28.0
|
|
4
19
|
|
|
5
20
|
### Minor Changes
|
package/README.md
CHANGED
|
@@ -868,7 +868,7 @@ for await (const connection of zapier.listConnections().items()) {
|
|
|
868
868
|
|
|
869
869
|
#### `fetch`
|
|
870
870
|
|
|
871
|
-
Make authenticated HTTP requests to any API through Zapier
|
|
871
|
+
Make authenticated HTTP requests to any API through Zapier. Pass a connectionId to automatically inject the user's stored credentials (OAuth tokens, API keys, etc.) into the outgoing request. Mirrors the native fetch(url, init?) signature with additional Zapier-specific options.
|
|
872
872
|
|
|
873
873
|
**Parameters:**
|
|
874
874
|
|
package/dist/index.cjs
CHANGED
|
@@ -27,7 +27,12 @@ function _interopNamespace(e) {
|
|
|
27
27
|
|
|
28
28
|
var os__namespace = /*#__PURE__*/_interopNamespace(os);
|
|
29
29
|
|
|
30
|
-
|
|
30
|
+
var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, {
|
|
31
|
+
get: (a, b) => (typeof require !== "undefined" ? require : a)[b]
|
|
32
|
+
}) : x)(function(x) {
|
|
33
|
+
if (typeof require !== "undefined") return require.apply(this, arguments);
|
|
34
|
+
throw Error('Dynamic require of "' + x + '" is not supported');
|
|
35
|
+
});
|
|
31
36
|
function withFormatter(schema, formatMeta) {
|
|
32
37
|
Object.assign(schema._zod.def, {
|
|
33
38
|
formatMeta
|
|
@@ -469,6 +474,24 @@ function isPlainObject(value) {
|
|
|
469
474
|
return proto === Object.prototype || proto === null;
|
|
470
475
|
}
|
|
471
476
|
|
|
477
|
+
// src/utils/telemetry-context.ts
|
|
478
|
+
var telemetryStore = null;
|
|
479
|
+
try {
|
|
480
|
+
const mod = __require("async_hooks");
|
|
481
|
+
telemetryStore = new mod.AsyncLocalStorage();
|
|
482
|
+
} catch {
|
|
483
|
+
}
|
|
484
|
+
function isTelemetryNested() {
|
|
485
|
+
if (!telemetryStore) return true;
|
|
486
|
+
const store = telemetryStore.getStore();
|
|
487
|
+
return store !== void 0 && store.depth > 0;
|
|
488
|
+
}
|
|
489
|
+
function runWithTelemetryContext(fn) {
|
|
490
|
+
if (!telemetryStore) return fn();
|
|
491
|
+
const currentDepth = telemetryStore.getStore()?.depth ?? -1;
|
|
492
|
+
return telemetryStore.run({ depth: currentDepth + 1 }, fn);
|
|
493
|
+
}
|
|
494
|
+
|
|
472
495
|
// src/plugins/fetch/index.ts
|
|
473
496
|
function transformUrlToRelayPath(url) {
|
|
474
497
|
const targetUrl = new URL(url);
|
|
@@ -509,79 +532,77 @@ function inferContentType(body) {
|
|
|
509
532
|
var fetchPlugin = ({ context }) => {
|
|
510
533
|
return {
|
|
511
534
|
fetch: async function fetch2(url, init) {
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
connectionId,
|
|
518
|
-
authenticationId
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
const headers = normalizeHeaders(
|
|
526
|
-
fetchInit.headers
|
|
527
|
-
);
|
|
528
|
-
const hasContentType = Object.keys(headers).some(
|
|
529
|
-
(k) => k.toLowerCase() === "content-type"
|
|
530
|
-
);
|
|
531
|
-
if (fetchInit.body && !hasContentType) {
|
|
532
|
-
const inferred = inferContentType(
|
|
533
|
-
fetchInit.body
|
|
535
|
+
return runWithTelemetryContext(async () => {
|
|
536
|
+
const { api } = context;
|
|
537
|
+
const startTime = Date.now();
|
|
538
|
+
const isNested = isTelemetryNested();
|
|
539
|
+
try {
|
|
540
|
+
const { connectionId, authenticationId, callbackUrl, ...fetchInit } = init || {};
|
|
541
|
+
const resolvedConnectionId = connectionId ?? authenticationId;
|
|
542
|
+
const relayPath = transformUrlToRelayPath(url);
|
|
543
|
+
const headers = normalizeHeaders(
|
|
544
|
+
fetchInit.headers
|
|
545
|
+
);
|
|
546
|
+
const hasContentType = Object.keys(headers).some(
|
|
547
|
+
(k) => k.toLowerCase() === "content-type"
|
|
534
548
|
);
|
|
535
|
-
if (
|
|
536
|
-
|
|
549
|
+
if (fetchInit.body && !hasContentType) {
|
|
550
|
+
const inferred = inferContentType(
|
|
551
|
+
fetchInit.body
|
|
552
|
+
);
|
|
553
|
+
if (inferred) {
|
|
554
|
+
headers["Content-Type"] = inferred;
|
|
555
|
+
}
|
|
537
556
|
}
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
if (!isNested) {
|
|
555
|
-
context.eventEmission.emitMethodCalled({
|
|
556
|
-
method_name: "fetch",
|
|
557
|
-
execution_duration_ms: Date.now() - startTime,
|
|
558
|
-
success_flag: true,
|
|
559
|
-
error_message: null,
|
|
560
|
-
error_type: null,
|
|
561
|
-
argument_count: init ? 2 : 1,
|
|
562
|
-
is_paginated: false
|
|
563
|
-
});
|
|
564
|
-
}
|
|
565
|
-
return result;
|
|
566
|
-
} catch (error) {
|
|
567
|
-
if (!isNested) {
|
|
568
|
-
context.eventEmission.emitMethodCalled({
|
|
569
|
-
method_name: "fetch",
|
|
570
|
-
execution_duration_ms: Date.now() - startTime,
|
|
571
|
-
success_flag: false,
|
|
572
|
-
error_message: error instanceof Error ? error.message : String(error),
|
|
573
|
-
error_type: error instanceof Error ? error.constructor.name : "Unknown",
|
|
574
|
-
argument_count: init ? 2 : 1,
|
|
575
|
-
is_paginated: false
|
|
557
|
+
if (resolvedConnectionId) {
|
|
558
|
+
headers["X-Relay-Authentication-Id"] = coerceToNumericId(
|
|
559
|
+
"connectionId",
|
|
560
|
+
resolvedConnectionId
|
|
561
|
+
).toString();
|
|
562
|
+
}
|
|
563
|
+
if (callbackUrl) {
|
|
564
|
+
headers["X-Relay-Callback-Url"] = callbackUrl;
|
|
565
|
+
}
|
|
566
|
+
const result = await api.fetch(relayPath, {
|
|
567
|
+
method: fetchInit.method ?? "GET",
|
|
568
|
+
body: fetchInit.body,
|
|
569
|
+
headers,
|
|
570
|
+
redirect: fetchInit.redirect,
|
|
571
|
+
signal: fetchInit.signal,
|
|
572
|
+
authRequired: true
|
|
576
573
|
});
|
|
574
|
+
if (!isNested) {
|
|
575
|
+
context.eventEmission.emitMethodCalled({
|
|
576
|
+
method_name: "fetch",
|
|
577
|
+
execution_duration_ms: Date.now() - startTime,
|
|
578
|
+
success_flag: true,
|
|
579
|
+
error_message: null,
|
|
580
|
+
error_type: null,
|
|
581
|
+
argument_count: init ? 2 : 1,
|
|
582
|
+
is_paginated: false
|
|
583
|
+
});
|
|
584
|
+
}
|
|
585
|
+
return result;
|
|
586
|
+
} catch (error) {
|
|
587
|
+
if (!isNested) {
|
|
588
|
+
context.eventEmission.emitMethodCalled({
|
|
589
|
+
method_name: "fetch",
|
|
590
|
+
execution_duration_ms: Date.now() - startTime,
|
|
591
|
+
success_flag: false,
|
|
592
|
+
error_message: error instanceof Error ? error.message : String(error),
|
|
593
|
+
error_type: error instanceof Error ? error.constructor.name : "Unknown",
|
|
594
|
+
argument_count: init ? 2 : 1,
|
|
595
|
+
is_paginated: false
|
|
596
|
+
});
|
|
597
|
+
}
|
|
598
|
+
throw error;
|
|
577
599
|
}
|
|
578
|
-
|
|
579
|
-
}
|
|
600
|
+
});
|
|
580
601
|
},
|
|
581
602
|
context: {
|
|
582
603
|
meta: {
|
|
583
604
|
fetch: {
|
|
584
|
-
description: "Make authenticated HTTP requests to any API through Zapier
|
|
605
|
+
description: "Make authenticated HTTP requests to any API through Zapier. Pass a connectionId to automatically inject the user's stored credentials (OAuth tokens, API keys, etc.) into the outgoing request. Mirrors the native fetch(url, init?) signature with additional Zapier-specific options.",
|
|
585
606
|
packages: ["sdk", "cli", "mcp"],
|
|
586
607
|
categories: ["http"],
|
|
587
608
|
returnType: "Response",
|
|
@@ -767,11 +788,6 @@ var validateOptions = (schema, options) => {
|
|
|
767
788
|
};
|
|
768
789
|
|
|
769
790
|
// src/utils/function-utils.ts
|
|
770
|
-
var TelemetryMarkerSchema = zod.z.object({
|
|
771
|
-
_telemetry: zod.z.object({
|
|
772
|
-
isNested: zod.z.boolean().optional()
|
|
773
|
-
}).optional()
|
|
774
|
-
});
|
|
775
791
|
function extractCursor(data) {
|
|
776
792
|
if (!data?.next) {
|
|
777
793
|
return void 0;
|
|
@@ -801,20 +817,36 @@ function createFunction(coreFn, schema, telemetry) {
|
|
|
801
817
|
const functionName = coreFn.name;
|
|
802
818
|
const namedFunctions = {
|
|
803
819
|
[functionName]: async function(options) {
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
|
|
813
|
-
|
|
820
|
+
return runWithTelemetryContext(async () => {
|
|
821
|
+
const startTime = Date.now();
|
|
822
|
+
const normalizedOptions = options ?? {};
|
|
823
|
+
const isNested = isTelemetryNested();
|
|
824
|
+
try {
|
|
825
|
+
if (schema) {
|
|
826
|
+
const validatedOptions = validateOptions(schema, normalizedOptions);
|
|
827
|
+
const result2 = await coreFn({
|
|
828
|
+
...normalizedOptions,
|
|
829
|
+
...validatedOptions
|
|
830
|
+
});
|
|
831
|
+
if (!isNested && telemetry?.onMethodCalled) {
|
|
832
|
+
const argumentCount = Object.keys(
|
|
833
|
+
normalizedOptions
|
|
834
|
+
).length;
|
|
835
|
+
telemetry.onMethodCalled({
|
|
836
|
+
methodName: functionName,
|
|
837
|
+
durationMs: Date.now() - startTime,
|
|
838
|
+
success: true,
|
|
839
|
+
argumentCount,
|
|
840
|
+
isPaginated: false
|
|
841
|
+
});
|
|
842
|
+
}
|
|
843
|
+
return result2;
|
|
844
|
+
}
|
|
845
|
+
const result = await coreFn(normalizedOptions);
|
|
814
846
|
if (!isNested && telemetry?.onMethodCalled) {
|
|
815
847
|
const argumentCount = Object.keys(
|
|
816
848
|
normalizedOptions
|
|
817
|
-
).
|
|
849
|
+
).length;
|
|
818
850
|
telemetry.onMethodCalled({
|
|
819
851
|
methodName: functionName,
|
|
820
852
|
durationMs: Date.now() - startTime,
|
|
@@ -823,39 +855,25 @@ function createFunction(coreFn, schema, telemetry) {
|
|
|
823
855
|
isPaginated: false
|
|
824
856
|
});
|
|
825
857
|
}
|
|
826
|
-
return
|
|
827
|
-
}
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
|
|
837
|
-
|
|
838
|
-
|
|
839
|
-
|
|
840
|
-
|
|
841
|
-
|
|
842
|
-
|
|
843
|
-
const normalizedError = normalizeError(error);
|
|
844
|
-
if (!isNested && telemetry?.onMethodCalled) {
|
|
845
|
-
const argumentCount = Object.keys(normalizedOptions).filter(
|
|
846
|
-
(k) => k !== "_telemetry"
|
|
847
|
-
).length;
|
|
848
|
-
telemetry.onMethodCalled({
|
|
849
|
-
methodName: functionName,
|
|
850
|
-
durationMs: Date.now() - startTime,
|
|
851
|
-
success: false,
|
|
852
|
-
error: normalizedError,
|
|
853
|
-
argumentCount,
|
|
854
|
-
isPaginated: false
|
|
855
|
-
});
|
|
858
|
+
return result;
|
|
859
|
+
} catch (error) {
|
|
860
|
+
const normalizedError = normalizeError(error);
|
|
861
|
+
if (!isNested && telemetry?.onMethodCalled) {
|
|
862
|
+
const argumentCount = Object.keys(
|
|
863
|
+
normalizedOptions
|
|
864
|
+
).length;
|
|
865
|
+
telemetry.onMethodCalled({
|
|
866
|
+
methodName: functionName,
|
|
867
|
+
durationMs: Date.now() - startTime,
|
|
868
|
+
success: false,
|
|
869
|
+
error: normalizedError,
|
|
870
|
+
argumentCount,
|
|
871
|
+
isPaginated: false
|
|
872
|
+
});
|
|
873
|
+
}
|
|
874
|
+
throw normalizedError;
|
|
856
875
|
}
|
|
857
|
-
|
|
858
|
-
}
|
|
876
|
+
});
|
|
859
877
|
}
|
|
860
878
|
};
|
|
861
879
|
return namedFunctions[functionName];
|
|
@@ -896,73 +914,75 @@ function createPaginatedFunction(coreFn, schema, telemetry, explicitFunctionName
|
|
|
896
914
|
const validator = schema ? createValidator(schema) : null;
|
|
897
915
|
const namedFunctions = {
|
|
898
916
|
[functionName]: function(options) {
|
|
899
|
-
|
|
900
|
-
|
|
901
|
-
|
|
902
|
-
|
|
903
|
-
|
|
904
|
-
|
|
905
|
-
|
|
906
|
-
|
|
907
|
-
|
|
908
|
-
|
|
909
|
-
|
|
910
|
-
|
|
911
|
-
|
|
912
|
-
|
|
913
|
-
|
|
914
|
-
|
|
915
|
-
|
|
916
|
-
return result.value;
|
|
917
|
-
});
|
|
918
|
-
if (!isNested && telemetry?.onMethodCalled) {
|
|
919
|
-
firstPagePromise.then(() => {
|
|
920
|
-
const argumentCount = Object.keys(
|
|
921
|
-
normalizedOptions
|
|
922
|
-
).filter((k) => k !== "_telemetry").length;
|
|
923
|
-
telemetry.onMethodCalled({
|
|
924
|
-
methodName: functionName,
|
|
925
|
-
durationMs: Date.now() - startTime,
|
|
926
|
-
success: true,
|
|
927
|
-
argumentCount,
|
|
928
|
-
isPaginated: true
|
|
929
|
-
});
|
|
930
|
-
}).catch((error) => {
|
|
931
|
-
const argumentCount = Object.keys(
|
|
932
|
-
normalizedOptions
|
|
933
|
-
).filter((k) => k !== "_telemetry").length;
|
|
934
|
-
telemetry.onMethodCalled({
|
|
935
|
-
methodName: functionName,
|
|
936
|
-
durationMs: Date.now() - startTime,
|
|
937
|
-
success: false,
|
|
938
|
-
error: error instanceof Error ? error : new Error(String(error)),
|
|
939
|
-
argumentCount,
|
|
940
|
-
isPaginated: true
|
|
941
|
-
});
|
|
942
|
-
});
|
|
943
|
-
}
|
|
944
|
-
return Object.assign(firstPagePromise, {
|
|
945
|
-
[Symbol.asyncIterator]: async function* () {
|
|
946
|
-
yield await firstPagePromise;
|
|
947
|
-
for await (const page of iterator) {
|
|
948
|
-
yield page;
|
|
917
|
+
return runWithTelemetryContext(() => {
|
|
918
|
+
const startTime = Date.now();
|
|
919
|
+
const normalizedOptions = options ?? {};
|
|
920
|
+
const isNested = isTelemetryNested();
|
|
921
|
+
const validatedOptions = {
|
|
922
|
+
...normalizedOptions,
|
|
923
|
+
...validator ? validator(normalizedOptions) : normalizedOptions
|
|
924
|
+
};
|
|
925
|
+
const pageSize = validatedOptions.pageSize || 100;
|
|
926
|
+
const optimizedOptions = {
|
|
927
|
+
...validatedOptions,
|
|
928
|
+
pageSize
|
|
929
|
+
};
|
|
930
|
+
const iterator = paginate(pageFunction, optimizedOptions);
|
|
931
|
+
const firstPagePromise = iterator.next().then((result) => {
|
|
932
|
+
if (result.done) {
|
|
933
|
+
throw new Error("Paginate should always iterate at least once");
|
|
949
934
|
}
|
|
950
|
-
|
|
951
|
-
|
|
952
|
-
|
|
953
|
-
|
|
954
|
-
|
|
955
|
-
|
|
956
|
-
|
|
957
|
-
|
|
958
|
-
|
|
959
|
-
|
|
935
|
+
return result.value;
|
|
936
|
+
});
|
|
937
|
+
if (!isNested && telemetry?.onMethodCalled) {
|
|
938
|
+
firstPagePromise.then(() => {
|
|
939
|
+
const argumentCount = Object.keys(
|
|
940
|
+
normalizedOptions
|
|
941
|
+
).length;
|
|
942
|
+
telemetry.onMethodCalled({
|
|
943
|
+
methodName: functionName,
|
|
944
|
+
durationMs: Date.now() - startTime,
|
|
945
|
+
success: true,
|
|
946
|
+
argumentCount,
|
|
947
|
+
isPaginated: true
|
|
948
|
+
});
|
|
949
|
+
}).catch((error) => {
|
|
950
|
+
const argumentCount = Object.keys(
|
|
951
|
+
normalizedOptions
|
|
952
|
+
).length;
|
|
953
|
+
telemetry.onMethodCalled({
|
|
954
|
+
methodName: functionName,
|
|
955
|
+
durationMs: Date.now() - startTime,
|
|
956
|
+
success: false,
|
|
957
|
+
error: error instanceof Error ? error : new Error(String(error)),
|
|
958
|
+
argumentCount,
|
|
959
|
+
isPaginated: true
|
|
960
|
+
});
|
|
961
|
+
});
|
|
962
|
+
}
|
|
963
|
+
return Object.assign(firstPagePromise, {
|
|
964
|
+
[Symbol.asyncIterator]: async function* () {
|
|
965
|
+
yield await firstPagePromise;
|
|
966
|
+
for await (const page of iterator) {
|
|
967
|
+
yield page;
|
|
968
|
+
}
|
|
969
|
+
},
|
|
970
|
+
items: function() {
|
|
971
|
+
return {
|
|
972
|
+
[Symbol.asyncIterator]: async function* () {
|
|
973
|
+
const firstPage = await firstPagePromise;
|
|
974
|
+
for (const item of firstPage.data) {
|
|
960
975
|
yield item;
|
|
961
976
|
}
|
|
977
|
+
for await (const page of iterator) {
|
|
978
|
+
for (const item of page.data) {
|
|
979
|
+
yield item;
|
|
980
|
+
}
|
|
981
|
+
}
|
|
962
982
|
}
|
|
963
|
-
}
|
|
964
|
-
}
|
|
965
|
-
}
|
|
983
|
+
};
|
|
984
|
+
}
|
|
985
|
+
});
|
|
966
986
|
});
|
|
967
987
|
}
|
|
968
988
|
};
|
|
@@ -981,7 +1001,7 @@ var ListAppsSchema = apps.ListAppsQuerySchema.omit({
|
|
|
981
1001
|
maxItems: zod.z.number().min(1).optional().describe("Maximum total items to return across all pages"),
|
|
982
1002
|
// SDK specific property for pagination/iterable helpers
|
|
983
1003
|
cursor: zod.z.string().optional().describe("Cursor to start from")
|
|
984
|
-
}).
|
|
1004
|
+
}).describe("List all available apps with optional filtering");
|
|
985
1005
|
|
|
986
1006
|
// src/utils/string-utils.ts
|
|
987
1007
|
function toTitleCase(input) {
|
|
@@ -1191,7 +1211,7 @@ var ListActionsSchema = zod.z.object({
|
|
|
1191
1211
|
pageSize: zod.z.number().min(1).optional().describe("Number of actions per page"),
|
|
1192
1212
|
maxItems: zod.z.number().min(1).optional().describe("Maximum total items to return across all pages"),
|
|
1193
1213
|
cursor: zod.z.string().optional().describe("Cursor to start from")
|
|
1194
|
-
}).
|
|
1214
|
+
}).describe("List all actions for a specific app");
|
|
1195
1215
|
var NeedChoicesSchema = zod.z.object({
|
|
1196
1216
|
key: zod.z.string().optional(),
|
|
1197
1217
|
label: zod.z.string().optional(),
|
|
@@ -2227,7 +2247,7 @@ var ListConnectionsQuerySchema = connections.ListConnectionsQuerySchema.omit({
|
|
|
2227
2247
|
maxItems: zod.z.number().min(1).optional().describe("Maximum total items to return across all pages"),
|
|
2228
2248
|
// SDK specific property for pagination/iterable helpers
|
|
2229
2249
|
cursor: zod.z.string().optional().describe("Cursor to start from")
|
|
2230
|
-
}).
|
|
2250
|
+
}).describe("List available connections with optional filtering");
|
|
2231
2251
|
var ConnectionItemSchema = withFormatter(connections.ConnectionItemSchema, {
|
|
2232
2252
|
format: (item) => {
|
|
2233
2253
|
const details = [];
|
|
@@ -2354,7 +2374,7 @@ var ListClientCredentialsQuerySchema = clientCredentials.ListClientCredentialsQu
|
|
|
2354
2374
|
maxItems: zod.z.number().min(1).optional().describe("Maximum total items to return across all pages"),
|
|
2355
2375
|
// SDK specific property for pagination/iterable helpers
|
|
2356
2376
|
cursor: zod.z.string().optional().describe("Cursor to start from")
|
|
2357
|
-
}).
|
|
2377
|
+
}).describe("List client credentials for the authenticated user");
|
|
2358
2378
|
var ClientCredentialsItemSchema = withFormatter(
|
|
2359
2379
|
clientCredentials.ClientCredentialsItemSchema,
|
|
2360
2380
|
{
|
|
@@ -2457,7 +2477,7 @@ var listClientCredentialsPlugin = ({ context }) => {
|
|
|
2457
2477
|
};
|
|
2458
2478
|
var CreateClientCredentialsSchema = clientCredentials.CreateClientCredentialsRequestSchema.omit({ allowed_scopes: true }).extend({
|
|
2459
2479
|
allowedScopes: zod.z.array(zod.z.enum(["credentials", "external"])).default(["external"]).describe("Scopes to allow for these credentials")
|
|
2460
|
-
}).
|
|
2480
|
+
}).describe("Create new client credentials for the authenticated user");
|
|
2461
2481
|
|
|
2462
2482
|
// src/plugins/createClientCredentials/index.ts
|
|
2463
2483
|
var createClientCredentialsPlugin = ({ context }) => {
|
|
@@ -2522,7 +2542,7 @@ var createClientCredentialsPlugin = ({ context }) => {
|
|
|
2522
2542
|
};
|
|
2523
2543
|
var DeleteClientCredentialsSchema = zod.z.object({
|
|
2524
2544
|
clientId: zod.z.string().describe("The client ID of the client credentials to delete")
|
|
2525
|
-
}).
|
|
2545
|
+
}).describe("Delete client credentials by client ID");
|
|
2526
2546
|
|
|
2527
2547
|
// src/plugins/deleteClientCredentials/index.ts
|
|
2528
2548
|
var deleteClientCredentialsPlugin = ({ context }) => {
|
|
@@ -2586,8 +2606,7 @@ var GetAppSchema = zod.z.object({
|
|
|
2586
2606
|
var getAppPlugin = ({ sdk, context }) => {
|
|
2587
2607
|
async function getApp(options) {
|
|
2588
2608
|
const appsIterable = sdk.listApps({
|
|
2589
|
-
appKeys: [options.appKey]
|
|
2590
|
-
_telemetry: { isNested: true }
|
|
2609
|
+
appKeys: [options.appKey]
|
|
2591
2610
|
}).items();
|
|
2592
2611
|
for await (const app of appsIterable) {
|
|
2593
2612
|
return {
|
|
@@ -2628,13 +2647,13 @@ var GetActionSchema = zod.z.object({
|
|
|
2628
2647
|
appKey: AppKeyPropertySchema,
|
|
2629
2648
|
actionType: ActionTypePropertySchema,
|
|
2630
2649
|
actionKey: ActionKeyPropertySchema
|
|
2631
|
-
}).
|
|
2650
|
+
}).describe("Get detailed information about a specific action");
|
|
2632
2651
|
|
|
2633
2652
|
// src/plugins/getAction/index.ts
|
|
2634
2653
|
var getActionPlugin = ({ sdk, context }) => {
|
|
2635
2654
|
async function getAction(options) {
|
|
2636
2655
|
const { actionKey, actionType, appKey } = options;
|
|
2637
|
-
for await (const action of sdk.listActions({ appKey
|
|
2656
|
+
for await (const action of sdk.listActions({ appKey }).items()) {
|
|
2638
2657
|
if ((action.key === actionKey || action.id === actionKey) && action.action_type === actionType) {
|
|
2639
2658
|
return { data: action };
|
|
2640
2659
|
}
|
|
@@ -2723,8 +2742,7 @@ var FindFirstConnectionSchema = ListConnectionsQuerySchema.omit({
|
|
|
2723
2742
|
connectionIds: true,
|
|
2724
2743
|
pageSize: true,
|
|
2725
2744
|
maxItems: true,
|
|
2726
|
-
cursor: true
|
|
2727
|
-
_telemetry: true
|
|
2745
|
+
cursor: true
|
|
2728
2746
|
}).describe("Find the first connection matching the criteria");
|
|
2729
2747
|
|
|
2730
2748
|
// src/plugins/findFirstConnection/index.ts
|
|
@@ -2732,8 +2750,7 @@ var findFirstConnectionPlugin = ({ sdk, context }) => {
|
|
|
2732
2750
|
async function findFirstConnection(options = {}) {
|
|
2733
2751
|
const connectionsResponse = await sdk.listConnections({
|
|
2734
2752
|
...options,
|
|
2735
|
-
maxItems: 1
|
|
2736
|
-
_telemetry: { isNested: true }
|
|
2753
|
+
maxItems: 1
|
|
2737
2754
|
});
|
|
2738
2755
|
if (connectionsResponse.data.length === 0) {
|
|
2739
2756
|
throw new ZapierResourceNotFoundError(
|
|
@@ -2775,8 +2792,7 @@ var FindUniqueConnectionSchema = ListConnectionsQuerySchema.omit({
|
|
|
2775
2792
|
connectionIds: true,
|
|
2776
2793
|
pageSize: true,
|
|
2777
2794
|
maxItems: true,
|
|
2778
|
-
cursor: true
|
|
2779
|
-
_telemetry: true
|
|
2795
|
+
cursor: true
|
|
2780
2796
|
}).describe("Find a unique connection matching the criteria");
|
|
2781
2797
|
|
|
2782
2798
|
// src/plugins/findUniqueConnection/index.ts
|
|
@@ -2784,9 +2800,8 @@ var findUniqueConnectionPlugin = ({ sdk, context }) => {
|
|
|
2784
2800
|
async function findUniqueConnection(options = {}) {
|
|
2785
2801
|
const connectionsResponse = await sdk.listConnections({
|
|
2786
2802
|
...options,
|
|
2787
|
-
maxItems: 2
|
|
2803
|
+
maxItems: 2
|
|
2788
2804
|
// Get up to 2 to check for uniqueness
|
|
2789
|
-
_telemetry: { isNested: true }
|
|
2790
2805
|
});
|
|
2791
2806
|
if (connectionsResponse.data.length === 0) {
|
|
2792
2807
|
throw new ZapierResourceNotFoundError(
|
|
@@ -2908,8 +2923,7 @@ var runActionPlugin = ({ sdk, context }) => {
|
|
|
2908
2923
|
const actionData = await sdk.getAction({
|
|
2909
2924
|
appKey,
|
|
2910
2925
|
actionKey,
|
|
2911
|
-
actionType
|
|
2912
|
-
_telemetry: { isNested: true }
|
|
2926
|
+
actionType
|
|
2913
2927
|
});
|
|
2914
2928
|
if (actionData.data.action_type !== actionType) {
|
|
2915
2929
|
throw new ZapierValidationError(
|
|
@@ -2988,7 +3002,7 @@ var RelayRequestSchema = zod.z.object({
|
|
|
2988
3002
|
zod.z.instanceof(Headers),
|
|
2989
3003
|
zod.z.array(zod.z.tuple([zod.z.string(), zod.z.string()]))
|
|
2990
3004
|
]).optional().describe("Request headers")
|
|
2991
|
-
}).
|
|
3005
|
+
}).describe("Make authenticated HTTP requests through Zapier's Relay service");
|
|
2992
3006
|
var RelayFetchSchema = RelayRequestSchema;
|
|
2993
3007
|
|
|
2994
3008
|
// src/utils/logging.ts
|
|
@@ -3021,8 +3035,7 @@ var requestPlugin = ({ sdk, context }) => {
|
|
|
3021
3035
|
body,
|
|
3022
3036
|
headers,
|
|
3023
3037
|
connectionId: resolvedConnectionId,
|
|
3024
|
-
callbackUrl
|
|
3025
|
-
_telemetry: { isNested: true }
|
|
3038
|
+
callbackUrl
|
|
3026
3039
|
});
|
|
3027
3040
|
}
|
|
3028
3041
|
const requestDefinition = createFunction(
|
|
@@ -4864,7 +4877,8 @@ var registryPlugin = ({ sdk, context }) => {
|
|
|
4864
4877
|
packages: meta.packages,
|
|
4865
4878
|
// Auto-infer confirm: "delete" from type: "delete" (all deletes should confirm)
|
|
4866
4879
|
confirm: meta.confirm ?? (meta.type === "delete" ? "delete" : void 0),
|
|
4867
|
-
deprecatedParameters: meta.deprecatedParameters
|
|
4880
|
+
deprecatedParameters: meta.deprecatedParameters,
|
|
4881
|
+
aliases: meta.aliases
|
|
4868
4882
|
};
|
|
4869
4883
|
}).sort((a, b) => a.name.localeCompare(b.name));
|
|
4870
4884
|
const knownCategories = Object.keys(categoryDefinitions);
|
|
@@ -5388,7 +5402,7 @@ function getCpuTime() {
|
|
|
5388
5402
|
|
|
5389
5403
|
// package.json
|
|
5390
5404
|
var package_default = {
|
|
5391
|
-
version: "0.
|
|
5405
|
+
version: "0.30.0"};
|
|
5392
5406
|
|
|
5393
5407
|
// src/plugins/eventEmission/builders.ts
|
|
5394
5408
|
function createBaseEvent(context = {}) {
|