@zapier/zapier-sdk 0.29.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 +6 -0
- package/dist/index.cjs +213 -202
- package/dist/index.d.mts +0 -30
- package/dist/index.mjs +213 -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 +59 -53
- 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/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/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
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,76 +532,72 @@ 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
|
-
authRequired: true
|
|
555
|
-
});
|
|
556
|
-
if (!isNested) {
|
|
557
|
-
context.eventEmission.emitMethodCalled({
|
|
558
|
-
method_name: "fetch",
|
|
559
|
-
execution_duration_ms: Date.now() - startTime,
|
|
560
|
-
success_flag: true,
|
|
561
|
-
error_message: null,
|
|
562
|
-
error_type: null,
|
|
563
|
-
argument_count: init ? 2 : 1,
|
|
564
|
-
is_paginated: false
|
|
565
|
-
});
|
|
566
|
-
}
|
|
567
|
-
return result;
|
|
568
|
-
} catch (error) {
|
|
569
|
-
if (!isNested) {
|
|
570
|
-
context.eventEmission.emitMethodCalled({
|
|
571
|
-
method_name: "fetch",
|
|
572
|
-
execution_duration_ms: Date.now() - startTime,
|
|
573
|
-
success_flag: false,
|
|
574
|
-
error_message: error instanceof Error ? error.message : String(error),
|
|
575
|
-
error_type: error instanceof Error ? error.constructor.name : "Unknown",
|
|
576
|
-
argument_count: init ? 2 : 1,
|
|
577
|
-
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
|
|
578
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;
|
|
579
599
|
}
|
|
580
|
-
|
|
581
|
-
}
|
|
600
|
+
});
|
|
582
601
|
},
|
|
583
602
|
context: {
|
|
584
603
|
meta: {
|
|
@@ -769,11 +788,6 @@ var validateOptions = (schema, options) => {
|
|
|
769
788
|
};
|
|
770
789
|
|
|
771
790
|
// src/utils/function-utils.ts
|
|
772
|
-
var TelemetryMarkerSchema = zod.z.object({
|
|
773
|
-
_telemetry: zod.z.object({
|
|
774
|
-
isNested: zod.z.boolean().optional()
|
|
775
|
-
}).optional()
|
|
776
|
-
});
|
|
777
791
|
function extractCursor(data) {
|
|
778
792
|
if (!data?.next) {
|
|
779
793
|
return void 0;
|
|
@@ -803,20 +817,36 @@ function createFunction(coreFn, schema, telemetry) {
|
|
|
803
817
|
const functionName = coreFn.name;
|
|
804
818
|
const namedFunctions = {
|
|
805
819
|
[functionName]: async function(options) {
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
|
|
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);
|
|
816
846
|
if (!isNested && telemetry?.onMethodCalled) {
|
|
817
847
|
const argumentCount = Object.keys(
|
|
818
848
|
normalizedOptions
|
|
819
|
-
).
|
|
849
|
+
).length;
|
|
820
850
|
telemetry.onMethodCalled({
|
|
821
851
|
methodName: functionName,
|
|
822
852
|
durationMs: Date.now() - startTime,
|
|
@@ -825,39 +855,25 @@ function createFunction(coreFn, schema, telemetry) {
|
|
|
825
855
|
isPaginated: false
|
|
826
856
|
});
|
|
827
857
|
}
|
|
828
|
-
return
|
|
829
|
-
}
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
|
|
837
|
-
|
|
838
|
-
|
|
839
|
-
|
|
840
|
-
|
|
841
|
-
|
|
842
|
-
|
|
843
|
-
|
|
844
|
-
|
|
845
|
-
const normalizedError = normalizeError(error);
|
|
846
|
-
if (!isNested && telemetry?.onMethodCalled) {
|
|
847
|
-
const argumentCount = Object.keys(normalizedOptions).filter(
|
|
848
|
-
(k) => k !== "_telemetry"
|
|
849
|
-
).length;
|
|
850
|
-
telemetry.onMethodCalled({
|
|
851
|
-
methodName: functionName,
|
|
852
|
-
durationMs: Date.now() - startTime,
|
|
853
|
-
success: false,
|
|
854
|
-
error: normalizedError,
|
|
855
|
-
argumentCount,
|
|
856
|
-
isPaginated: false
|
|
857
|
-
});
|
|
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;
|
|
858
875
|
}
|
|
859
|
-
|
|
860
|
-
}
|
|
876
|
+
});
|
|
861
877
|
}
|
|
862
878
|
};
|
|
863
879
|
return namedFunctions[functionName];
|
|
@@ -898,73 +914,75 @@ function createPaginatedFunction(coreFn, schema, telemetry, explicitFunctionName
|
|
|
898
914
|
const validator = schema ? createValidator(schema) : null;
|
|
899
915
|
const namedFunctions = {
|
|
900
916
|
[functionName]: function(options) {
|
|
901
|
-
|
|
902
|
-
|
|
903
|
-
|
|
904
|
-
|
|
905
|
-
|
|
906
|
-
|
|
907
|
-
|
|
908
|
-
|
|
909
|
-
|
|
910
|
-
|
|
911
|
-
|
|
912
|
-
|
|
913
|
-
|
|
914
|
-
|
|
915
|
-
|
|
916
|
-
|
|
917
|
-
|
|
918
|
-
return result.value;
|
|
919
|
-
});
|
|
920
|
-
if (!isNested && telemetry?.onMethodCalled) {
|
|
921
|
-
firstPagePromise.then(() => {
|
|
922
|
-
const argumentCount = Object.keys(
|
|
923
|
-
normalizedOptions
|
|
924
|
-
).filter((k) => k !== "_telemetry").length;
|
|
925
|
-
telemetry.onMethodCalled({
|
|
926
|
-
methodName: functionName,
|
|
927
|
-
durationMs: Date.now() - startTime,
|
|
928
|
-
success: true,
|
|
929
|
-
argumentCount,
|
|
930
|
-
isPaginated: true
|
|
931
|
-
});
|
|
932
|
-
}).catch((error) => {
|
|
933
|
-
const argumentCount = Object.keys(
|
|
934
|
-
normalizedOptions
|
|
935
|
-
).filter((k) => k !== "_telemetry").length;
|
|
936
|
-
telemetry.onMethodCalled({
|
|
937
|
-
methodName: functionName,
|
|
938
|
-
durationMs: Date.now() - startTime,
|
|
939
|
-
success: false,
|
|
940
|
-
error: error instanceof Error ? error : new Error(String(error)),
|
|
941
|
-
argumentCount,
|
|
942
|
-
isPaginated: true
|
|
943
|
-
});
|
|
944
|
-
});
|
|
945
|
-
}
|
|
946
|
-
return Object.assign(firstPagePromise, {
|
|
947
|
-
[Symbol.asyncIterator]: async function* () {
|
|
948
|
-
yield await firstPagePromise;
|
|
949
|
-
for await (const page of iterator) {
|
|
950
|
-
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");
|
|
951
934
|
}
|
|
952
|
-
|
|
953
|
-
|
|
954
|
-
|
|
955
|
-
|
|
956
|
-
|
|
957
|
-
|
|
958
|
-
|
|
959
|
-
|
|
960
|
-
|
|
961
|
-
|
|
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) {
|
|
962
975
|
yield item;
|
|
963
976
|
}
|
|
977
|
+
for await (const page of iterator) {
|
|
978
|
+
for (const item of page.data) {
|
|
979
|
+
yield item;
|
|
980
|
+
}
|
|
981
|
+
}
|
|
964
982
|
}
|
|
965
|
-
}
|
|
966
|
-
}
|
|
967
|
-
}
|
|
983
|
+
};
|
|
984
|
+
}
|
|
985
|
+
});
|
|
968
986
|
});
|
|
969
987
|
}
|
|
970
988
|
};
|
|
@@ -983,7 +1001,7 @@ var ListAppsSchema = apps.ListAppsQuerySchema.omit({
|
|
|
983
1001
|
maxItems: zod.z.number().min(1).optional().describe("Maximum total items to return across all pages"),
|
|
984
1002
|
// SDK specific property for pagination/iterable helpers
|
|
985
1003
|
cursor: zod.z.string().optional().describe("Cursor to start from")
|
|
986
|
-
}).
|
|
1004
|
+
}).describe("List all available apps with optional filtering");
|
|
987
1005
|
|
|
988
1006
|
// src/utils/string-utils.ts
|
|
989
1007
|
function toTitleCase(input) {
|
|
@@ -1193,7 +1211,7 @@ var ListActionsSchema = zod.z.object({
|
|
|
1193
1211
|
pageSize: zod.z.number().min(1).optional().describe("Number of actions per page"),
|
|
1194
1212
|
maxItems: zod.z.number().min(1).optional().describe("Maximum total items to return across all pages"),
|
|
1195
1213
|
cursor: zod.z.string().optional().describe("Cursor to start from")
|
|
1196
|
-
}).
|
|
1214
|
+
}).describe("List all actions for a specific app");
|
|
1197
1215
|
var NeedChoicesSchema = zod.z.object({
|
|
1198
1216
|
key: zod.z.string().optional(),
|
|
1199
1217
|
label: zod.z.string().optional(),
|
|
@@ -2229,7 +2247,7 @@ var ListConnectionsQuerySchema = connections.ListConnectionsQuerySchema.omit({
|
|
|
2229
2247
|
maxItems: zod.z.number().min(1).optional().describe("Maximum total items to return across all pages"),
|
|
2230
2248
|
// SDK specific property for pagination/iterable helpers
|
|
2231
2249
|
cursor: zod.z.string().optional().describe("Cursor to start from")
|
|
2232
|
-
}).
|
|
2250
|
+
}).describe("List available connections with optional filtering");
|
|
2233
2251
|
var ConnectionItemSchema = withFormatter(connections.ConnectionItemSchema, {
|
|
2234
2252
|
format: (item) => {
|
|
2235
2253
|
const details = [];
|
|
@@ -2356,7 +2374,7 @@ var ListClientCredentialsQuerySchema = clientCredentials.ListClientCredentialsQu
|
|
|
2356
2374
|
maxItems: zod.z.number().min(1).optional().describe("Maximum total items to return across all pages"),
|
|
2357
2375
|
// SDK specific property for pagination/iterable helpers
|
|
2358
2376
|
cursor: zod.z.string().optional().describe("Cursor to start from")
|
|
2359
|
-
}).
|
|
2377
|
+
}).describe("List client credentials for the authenticated user");
|
|
2360
2378
|
var ClientCredentialsItemSchema = withFormatter(
|
|
2361
2379
|
clientCredentials.ClientCredentialsItemSchema,
|
|
2362
2380
|
{
|
|
@@ -2459,7 +2477,7 @@ var listClientCredentialsPlugin = ({ context }) => {
|
|
|
2459
2477
|
};
|
|
2460
2478
|
var CreateClientCredentialsSchema = clientCredentials.CreateClientCredentialsRequestSchema.omit({ allowed_scopes: true }).extend({
|
|
2461
2479
|
allowedScopes: zod.z.array(zod.z.enum(["credentials", "external"])).default(["external"]).describe("Scopes to allow for these credentials")
|
|
2462
|
-
}).
|
|
2480
|
+
}).describe("Create new client credentials for the authenticated user");
|
|
2463
2481
|
|
|
2464
2482
|
// src/plugins/createClientCredentials/index.ts
|
|
2465
2483
|
var createClientCredentialsPlugin = ({ context }) => {
|
|
@@ -2524,7 +2542,7 @@ var createClientCredentialsPlugin = ({ context }) => {
|
|
|
2524
2542
|
};
|
|
2525
2543
|
var DeleteClientCredentialsSchema = zod.z.object({
|
|
2526
2544
|
clientId: zod.z.string().describe("The client ID of the client credentials to delete")
|
|
2527
|
-
}).
|
|
2545
|
+
}).describe("Delete client credentials by client ID");
|
|
2528
2546
|
|
|
2529
2547
|
// src/plugins/deleteClientCredentials/index.ts
|
|
2530
2548
|
var deleteClientCredentialsPlugin = ({ context }) => {
|
|
@@ -2588,8 +2606,7 @@ var GetAppSchema = zod.z.object({
|
|
|
2588
2606
|
var getAppPlugin = ({ sdk, context }) => {
|
|
2589
2607
|
async function getApp(options) {
|
|
2590
2608
|
const appsIterable = sdk.listApps({
|
|
2591
|
-
appKeys: [options.appKey]
|
|
2592
|
-
_telemetry: { isNested: true }
|
|
2609
|
+
appKeys: [options.appKey]
|
|
2593
2610
|
}).items();
|
|
2594
2611
|
for await (const app of appsIterable) {
|
|
2595
2612
|
return {
|
|
@@ -2630,13 +2647,13 @@ var GetActionSchema = zod.z.object({
|
|
|
2630
2647
|
appKey: AppKeyPropertySchema,
|
|
2631
2648
|
actionType: ActionTypePropertySchema,
|
|
2632
2649
|
actionKey: ActionKeyPropertySchema
|
|
2633
|
-
}).
|
|
2650
|
+
}).describe("Get detailed information about a specific action");
|
|
2634
2651
|
|
|
2635
2652
|
// src/plugins/getAction/index.ts
|
|
2636
2653
|
var getActionPlugin = ({ sdk, context }) => {
|
|
2637
2654
|
async function getAction(options) {
|
|
2638
2655
|
const { actionKey, actionType, appKey } = options;
|
|
2639
|
-
for await (const action of sdk.listActions({ appKey
|
|
2656
|
+
for await (const action of sdk.listActions({ appKey }).items()) {
|
|
2640
2657
|
if ((action.key === actionKey || action.id === actionKey) && action.action_type === actionType) {
|
|
2641
2658
|
return { data: action };
|
|
2642
2659
|
}
|
|
@@ -2725,8 +2742,7 @@ var FindFirstConnectionSchema = ListConnectionsQuerySchema.omit({
|
|
|
2725
2742
|
connectionIds: true,
|
|
2726
2743
|
pageSize: true,
|
|
2727
2744
|
maxItems: true,
|
|
2728
|
-
cursor: true
|
|
2729
|
-
_telemetry: true
|
|
2745
|
+
cursor: true
|
|
2730
2746
|
}).describe("Find the first connection matching the criteria");
|
|
2731
2747
|
|
|
2732
2748
|
// src/plugins/findFirstConnection/index.ts
|
|
@@ -2734,8 +2750,7 @@ var findFirstConnectionPlugin = ({ sdk, context }) => {
|
|
|
2734
2750
|
async function findFirstConnection(options = {}) {
|
|
2735
2751
|
const connectionsResponse = await sdk.listConnections({
|
|
2736
2752
|
...options,
|
|
2737
|
-
maxItems: 1
|
|
2738
|
-
_telemetry: { isNested: true }
|
|
2753
|
+
maxItems: 1
|
|
2739
2754
|
});
|
|
2740
2755
|
if (connectionsResponse.data.length === 0) {
|
|
2741
2756
|
throw new ZapierResourceNotFoundError(
|
|
@@ -2777,8 +2792,7 @@ var FindUniqueConnectionSchema = ListConnectionsQuerySchema.omit({
|
|
|
2777
2792
|
connectionIds: true,
|
|
2778
2793
|
pageSize: true,
|
|
2779
2794
|
maxItems: true,
|
|
2780
|
-
cursor: true
|
|
2781
|
-
_telemetry: true
|
|
2795
|
+
cursor: true
|
|
2782
2796
|
}).describe("Find a unique connection matching the criteria");
|
|
2783
2797
|
|
|
2784
2798
|
// src/plugins/findUniqueConnection/index.ts
|
|
@@ -2786,9 +2800,8 @@ var findUniqueConnectionPlugin = ({ sdk, context }) => {
|
|
|
2786
2800
|
async function findUniqueConnection(options = {}) {
|
|
2787
2801
|
const connectionsResponse = await sdk.listConnections({
|
|
2788
2802
|
...options,
|
|
2789
|
-
maxItems: 2
|
|
2803
|
+
maxItems: 2
|
|
2790
2804
|
// Get up to 2 to check for uniqueness
|
|
2791
|
-
_telemetry: { isNested: true }
|
|
2792
2805
|
});
|
|
2793
2806
|
if (connectionsResponse.data.length === 0) {
|
|
2794
2807
|
throw new ZapierResourceNotFoundError(
|
|
@@ -2910,8 +2923,7 @@ var runActionPlugin = ({ sdk, context }) => {
|
|
|
2910
2923
|
const actionData = await sdk.getAction({
|
|
2911
2924
|
appKey,
|
|
2912
2925
|
actionKey,
|
|
2913
|
-
actionType
|
|
2914
|
-
_telemetry: { isNested: true }
|
|
2926
|
+
actionType
|
|
2915
2927
|
});
|
|
2916
2928
|
if (actionData.data.action_type !== actionType) {
|
|
2917
2929
|
throw new ZapierValidationError(
|
|
@@ -2990,7 +3002,7 @@ var RelayRequestSchema = zod.z.object({
|
|
|
2990
3002
|
zod.z.instanceof(Headers),
|
|
2991
3003
|
zod.z.array(zod.z.tuple([zod.z.string(), zod.z.string()]))
|
|
2992
3004
|
]).optional().describe("Request headers")
|
|
2993
|
-
}).
|
|
3005
|
+
}).describe("Make authenticated HTTP requests through Zapier's Relay service");
|
|
2994
3006
|
var RelayFetchSchema = RelayRequestSchema;
|
|
2995
3007
|
|
|
2996
3008
|
// src/utils/logging.ts
|
|
@@ -3023,8 +3035,7 @@ var requestPlugin = ({ sdk, context }) => {
|
|
|
3023
3035
|
body,
|
|
3024
3036
|
headers,
|
|
3025
3037
|
connectionId: resolvedConnectionId,
|
|
3026
|
-
callbackUrl
|
|
3027
|
-
_telemetry: { isNested: true }
|
|
3038
|
+
callbackUrl
|
|
3028
3039
|
});
|
|
3029
3040
|
}
|
|
3030
3041
|
const requestDefinition = createFunction(
|
|
@@ -5391,7 +5402,7 @@ function getCpuTime() {
|
|
|
5391
5402
|
|
|
5392
5403
|
// package.json
|
|
5393
5404
|
var package_default = {
|
|
5394
|
-
version: "0.
|
|
5405
|
+
version: "0.30.0"};
|
|
5395
5406
|
|
|
5396
5407
|
// src/plugins/eventEmission/builders.ts
|
|
5397
5408
|
function createBaseEvent(context = {}) {
|