@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.
Files changed (63) hide show
  1. package/CHANGELOG.md +15 -0
  2. package/README.md +1 -1
  3. package/dist/index.cjs +216 -202
  4. package/dist/index.d.mts +2 -30
  5. package/dist/index.mjs +216 -202
  6. package/dist/plugins/createClientCredentials/schemas.d.ts +0 -3
  7. package/dist/plugins/createClientCredentials/schemas.d.ts.map +1 -1
  8. package/dist/plugins/createClientCredentials/schemas.js +0 -2
  9. package/dist/plugins/deleteClientCredentials/schemas.d.ts +0 -3
  10. package/dist/plugins/deleteClientCredentials/schemas.d.ts.map +1 -1
  11. package/dist/plugins/deleteClientCredentials/schemas.js +0 -2
  12. package/dist/plugins/fetch/index.d.ts +0 -3
  13. package/dist/plugins/fetch/index.d.ts.map +1 -1
  14. package/dist/plugins/fetch/index.js +60 -52
  15. package/dist/plugins/findFirstConnection/index.d.ts.map +1 -1
  16. package/dist/plugins/findFirstConnection/index.js +0 -1
  17. package/dist/plugins/findFirstConnection/schemas.d.ts.map +1 -1
  18. package/dist/plugins/findFirstConnection/schemas.js +0 -1
  19. package/dist/plugins/findUniqueConnection/index.d.ts.map +1 -1
  20. package/dist/plugins/findUniqueConnection/index.js +0 -1
  21. package/dist/plugins/findUniqueConnection/schemas.d.ts.map +1 -1
  22. package/dist/plugins/findUniqueConnection/schemas.js +0 -1
  23. package/dist/plugins/getAction/index.d.ts.map +1 -1
  24. package/dist/plugins/getAction/index.js +1 -3
  25. package/dist/plugins/getAction/schemas.d.ts +0 -3
  26. package/dist/plugins/getAction/schemas.d.ts.map +1 -1
  27. package/dist/plugins/getAction/schemas.js +0 -2
  28. package/dist/plugins/getApp/index.d.ts.map +1 -1
  29. package/dist/plugins/getApp/index.js +0 -1
  30. package/dist/plugins/listActions/schemas.d.ts +0 -3
  31. package/dist/plugins/listActions/schemas.d.ts.map +1 -1
  32. package/dist/plugins/listActions/schemas.js +0 -2
  33. package/dist/plugins/listApps/schemas.d.ts +0 -3
  34. package/dist/plugins/listApps/schemas.d.ts.map +1 -1
  35. package/dist/plugins/listApps/schemas.js +0 -2
  36. package/dist/plugins/listClientCredentials/schemas.d.ts +0 -3
  37. package/dist/plugins/listClientCredentials/schemas.d.ts.map +1 -1
  38. package/dist/plugins/listClientCredentials/schemas.js +0 -2
  39. package/dist/plugins/listConnections/schemas.d.ts +0 -3
  40. package/dist/plugins/listConnections/schemas.d.ts.map +1 -1
  41. package/dist/plugins/listConnections/schemas.js +0 -2
  42. package/dist/plugins/registry/index.d.ts.map +1 -1
  43. package/dist/plugins/registry/index.js +1 -0
  44. package/dist/plugins/request/index.d.ts.map +1 -1
  45. package/dist/plugins/request/index.js +0 -1
  46. package/dist/plugins/request/schemas.d.ts +0 -6
  47. package/dist/plugins/request/schemas.d.ts.map +1 -1
  48. package/dist/plugins/request/schemas.js +0 -2
  49. package/dist/plugins/runAction/index.d.ts.map +1 -1
  50. package/dist/plugins/runAction/index.js +0 -1
  51. package/dist/types/sdk.d.ts +2 -0
  52. package/dist/types/sdk.d.ts.map +1 -1
  53. package/dist/utils/function-utils.d.ts +1 -14
  54. package/dist/utils/function-utils.d.ts.map +1 -1
  55. package/dist/utils/function-utils.js +115 -123
  56. package/dist/utils/function-utils.test.js +79 -1
  57. package/dist/utils/telemetry-context.d.ts +3 -0
  58. package/dist/utils/telemetry-context.d.ts.map +1 -0
  59. package/dist/utils/telemetry-context.js +23 -0
  60. package/dist/utils/telemetry-context.test.d.ts +2 -0
  61. package/dist/utils/telemetry-context.test.d.ts.map +1 -0
  62. package/dist/utils/telemetry-context.test.js +92 -0
  63. package/package.json +1 -1
package/dist/index.mjs CHANGED
@@ -5,7 +5,12 @@ import { ListClientCredentialsQuerySchema as ListClientCredentialsQuerySchema$1,
5
5
  import { setTimeout as setTimeout$1 } from 'timers/promises';
6
6
  import * as os from 'os';
7
7
 
8
- // src/types/properties.ts
8
+ var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, {
9
+ get: (a, b) => (typeof require !== "undefined" ? require : a)[b]
10
+ }) : x)(function(x) {
11
+ if (typeof require !== "undefined") return require.apply(this, arguments);
12
+ throw Error('Dynamic require of "' + x + '" is not supported');
13
+ });
9
14
  function withFormatter(schema, formatMeta) {
10
15
  Object.assign(schema._zod.def, {
11
16
  formatMeta
@@ -447,6 +452,24 @@ function isPlainObject(value) {
447
452
  return proto === Object.prototype || proto === null;
448
453
  }
449
454
 
455
+ // src/utils/telemetry-context.ts
456
+ var telemetryStore = null;
457
+ try {
458
+ const mod = __require("async_hooks");
459
+ telemetryStore = new mod.AsyncLocalStorage();
460
+ } catch {
461
+ }
462
+ function isTelemetryNested() {
463
+ if (!telemetryStore) return true;
464
+ const store = telemetryStore.getStore();
465
+ return store !== void 0 && store.depth > 0;
466
+ }
467
+ function runWithTelemetryContext(fn) {
468
+ if (!telemetryStore) return fn();
469
+ const currentDepth = telemetryStore.getStore()?.depth ?? -1;
470
+ return telemetryStore.run({ depth: currentDepth + 1 }, fn);
471
+ }
472
+
450
473
  // src/plugins/fetch/index.ts
451
474
  function transformUrlToRelayPath(url) {
452
475
  const targetUrl = new URL(url);
@@ -487,79 +510,77 @@ function inferContentType(body) {
487
510
  var fetchPlugin = ({ context }) => {
488
511
  return {
489
512
  fetch: async function fetch2(url, init) {
490
- const { api } = context;
491
- const startTime = Date.now();
492
- const isNested = init?._telemetry?.isNested === true;
493
- try {
494
- const {
495
- connectionId,
496
- authenticationId,
497
- callbackUrl,
498
- _telemetry,
499
- ...fetchInit
500
- } = init || {};
501
- const resolvedConnectionId = connectionId ?? authenticationId;
502
- const relayPath = transformUrlToRelayPath(url);
503
- const headers = normalizeHeaders(
504
- fetchInit.headers
505
- );
506
- const hasContentType = Object.keys(headers).some(
507
- (k) => k.toLowerCase() === "content-type"
508
- );
509
- if (fetchInit.body && !hasContentType) {
510
- const inferred = inferContentType(
511
- fetchInit.body
513
+ return runWithTelemetryContext(async () => {
514
+ const { api } = context;
515
+ const startTime = Date.now();
516
+ const isNested = isTelemetryNested();
517
+ try {
518
+ const { connectionId, authenticationId, callbackUrl, ...fetchInit } = init || {};
519
+ const resolvedConnectionId = connectionId ?? authenticationId;
520
+ const relayPath = transformUrlToRelayPath(url);
521
+ const headers = normalizeHeaders(
522
+ fetchInit.headers
523
+ );
524
+ const hasContentType = Object.keys(headers).some(
525
+ (k) => k.toLowerCase() === "content-type"
512
526
  );
513
- if (inferred) {
514
- headers["Content-Type"] = inferred;
527
+ if (fetchInit.body && !hasContentType) {
528
+ const inferred = inferContentType(
529
+ fetchInit.body
530
+ );
531
+ if (inferred) {
532
+ headers["Content-Type"] = inferred;
533
+ }
515
534
  }
516
- }
517
- if (resolvedConnectionId) {
518
- headers["X-Relay-Authentication-Id"] = coerceToNumericId(
519
- "connectionId",
520
- resolvedConnectionId
521
- ).toString();
522
- }
523
- if (callbackUrl) {
524
- headers["X-Relay-Callback-Url"] = callbackUrl;
525
- }
526
- const result = await api.fetch(relayPath, {
527
- method: fetchInit.method ?? "GET",
528
- body: fetchInit.body,
529
- headers,
530
- authRequired: true
531
- });
532
- if (!isNested) {
533
- context.eventEmission.emitMethodCalled({
534
- method_name: "fetch",
535
- execution_duration_ms: Date.now() - startTime,
536
- success_flag: true,
537
- error_message: null,
538
- error_type: null,
539
- argument_count: init ? 2 : 1,
540
- is_paginated: false
541
- });
542
- }
543
- return result;
544
- } catch (error) {
545
- if (!isNested) {
546
- context.eventEmission.emitMethodCalled({
547
- method_name: "fetch",
548
- execution_duration_ms: Date.now() - startTime,
549
- success_flag: false,
550
- error_message: error instanceof Error ? error.message : String(error),
551
- error_type: error instanceof Error ? error.constructor.name : "Unknown",
552
- argument_count: init ? 2 : 1,
553
- is_paginated: false
535
+ if (resolvedConnectionId) {
536
+ headers["X-Relay-Authentication-Id"] = coerceToNumericId(
537
+ "connectionId",
538
+ resolvedConnectionId
539
+ ).toString();
540
+ }
541
+ if (callbackUrl) {
542
+ headers["X-Relay-Callback-Url"] = callbackUrl;
543
+ }
544
+ const result = await api.fetch(relayPath, {
545
+ method: fetchInit.method ?? "GET",
546
+ body: fetchInit.body,
547
+ headers,
548
+ redirect: fetchInit.redirect,
549
+ signal: fetchInit.signal,
550
+ authRequired: true
554
551
  });
552
+ if (!isNested) {
553
+ context.eventEmission.emitMethodCalled({
554
+ method_name: "fetch",
555
+ execution_duration_ms: Date.now() - startTime,
556
+ success_flag: true,
557
+ error_message: null,
558
+ error_type: null,
559
+ argument_count: init ? 2 : 1,
560
+ is_paginated: false
561
+ });
562
+ }
563
+ return result;
564
+ } catch (error) {
565
+ if (!isNested) {
566
+ context.eventEmission.emitMethodCalled({
567
+ method_name: "fetch",
568
+ execution_duration_ms: Date.now() - startTime,
569
+ success_flag: false,
570
+ error_message: error instanceof Error ? error.message : String(error),
571
+ error_type: error instanceof Error ? error.constructor.name : "Unknown",
572
+ argument_count: init ? 2 : 1,
573
+ is_paginated: false
574
+ });
575
+ }
576
+ throw error;
555
577
  }
556
- throw error;
557
- }
578
+ });
558
579
  },
559
580
  context: {
560
581
  meta: {
561
582
  fetch: {
562
- description: "Make authenticated HTTP requests to any API through Zapier's Relay service. 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.",
583
+ 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.",
563
584
  packages: ["sdk", "cli", "mcp"],
564
585
  categories: ["http"],
565
586
  returnType: "Response",
@@ -745,11 +766,6 @@ var validateOptions = (schema, options) => {
745
766
  };
746
767
 
747
768
  // src/utils/function-utils.ts
748
- var TelemetryMarkerSchema = z.object({
749
- _telemetry: z.object({
750
- isNested: z.boolean().optional()
751
- }).optional()
752
- });
753
769
  function extractCursor(data) {
754
770
  if (!data?.next) {
755
771
  return void 0;
@@ -779,20 +795,36 @@ function createFunction(coreFn, schema, telemetry) {
779
795
  const functionName = coreFn.name;
780
796
  const namedFunctions = {
781
797
  [functionName]: async function(options) {
782
- const startTime = Date.now();
783
- const normalizedOptions = options ?? {};
784
- const isNested = normalizedOptions?._telemetry?.isNested === true;
785
- try {
786
- if (schema) {
787
- const validatedOptions = validateOptions(schema, normalizedOptions);
788
- const result2 = await coreFn({
789
- ...normalizedOptions,
790
- ...validatedOptions
791
- });
798
+ return runWithTelemetryContext(async () => {
799
+ const startTime = Date.now();
800
+ const normalizedOptions = options ?? {};
801
+ const isNested = isTelemetryNested();
802
+ try {
803
+ if (schema) {
804
+ const validatedOptions = validateOptions(schema, normalizedOptions);
805
+ const result2 = await coreFn({
806
+ ...normalizedOptions,
807
+ ...validatedOptions
808
+ });
809
+ if (!isNested && telemetry?.onMethodCalled) {
810
+ const argumentCount = Object.keys(
811
+ normalizedOptions
812
+ ).length;
813
+ telemetry.onMethodCalled({
814
+ methodName: functionName,
815
+ durationMs: Date.now() - startTime,
816
+ success: true,
817
+ argumentCount,
818
+ isPaginated: false
819
+ });
820
+ }
821
+ return result2;
822
+ }
823
+ const result = await coreFn(normalizedOptions);
792
824
  if (!isNested && telemetry?.onMethodCalled) {
793
825
  const argumentCount = Object.keys(
794
826
  normalizedOptions
795
- ).filter((k) => k !== "_telemetry").length;
827
+ ).length;
796
828
  telemetry.onMethodCalled({
797
829
  methodName: functionName,
798
830
  durationMs: Date.now() - startTime,
@@ -801,39 +833,25 @@ function createFunction(coreFn, schema, telemetry) {
801
833
  isPaginated: false
802
834
  });
803
835
  }
804
- return result2;
805
- }
806
- const result = await coreFn(normalizedOptions);
807
- if (!isNested && telemetry?.onMethodCalled) {
808
- const argumentCount = Object.keys(normalizedOptions).filter(
809
- (k) => k !== "_telemetry"
810
- ).length;
811
- telemetry.onMethodCalled({
812
- methodName: functionName,
813
- durationMs: Date.now() - startTime,
814
- success: true,
815
- argumentCount,
816
- isPaginated: false
817
- });
818
- }
819
- return result;
820
- } catch (error) {
821
- const normalizedError = normalizeError(error);
822
- if (!isNested && telemetry?.onMethodCalled) {
823
- const argumentCount = Object.keys(normalizedOptions).filter(
824
- (k) => k !== "_telemetry"
825
- ).length;
826
- telemetry.onMethodCalled({
827
- methodName: functionName,
828
- durationMs: Date.now() - startTime,
829
- success: false,
830
- error: normalizedError,
831
- argumentCount,
832
- isPaginated: false
833
- });
836
+ return result;
837
+ } catch (error) {
838
+ const normalizedError = normalizeError(error);
839
+ if (!isNested && telemetry?.onMethodCalled) {
840
+ const argumentCount = Object.keys(
841
+ normalizedOptions
842
+ ).length;
843
+ telemetry.onMethodCalled({
844
+ methodName: functionName,
845
+ durationMs: Date.now() - startTime,
846
+ success: false,
847
+ error: normalizedError,
848
+ argumentCount,
849
+ isPaginated: false
850
+ });
851
+ }
852
+ throw normalizedError;
834
853
  }
835
- throw normalizedError;
836
- }
854
+ });
837
855
  }
838
856
  };
839
857
  return namedFunctions[functionName];
@@ -874,73 +892,75 @@ function createPaginatedFunction(coreFn, schema, telemetry, explicitFunctionName
874
892
  const validator = schema ? createValidator(schema) : null;
875
893
  const namedFunctions = {
876
894
  [functionName]: function(options) {
877
- const startTime = Date.now();
878
- const normalizedOptions = options ?? {};
879
- const isNested = normalizedOptions?._telemetry?.isNested === true;
880
- const validatedOptions = {
881
- ...normalizedOptions,
882
- ...validator ? validator(normalizedOptions) : normalizedOptions
883
- };
884
- const pageSize = validatedOptions.pageSize || 100;
885
- const optimizedOptions = {
886
- ...validatedOptions,
887
- pageSize
888
- };
889
- const iterator = paginate(pageFunction, optimizedOptions);
890
- const firstPagePromise = iterator.next().then((result) => {
891
- if (result.done) {
892
- throw new Error("Paginate should always iterate at least once");
893
- }
894
- return result.value;
895
- });
896
- if (!isNested && telemetry?.onMethodCalled) {
897
- firstPagePromise.then(() => {
898
- const argumentCount = Object.keys(
899
- normalizedOptions
900
- ).filter((k) => k !== "_telemetry").length;
901
- telemetry.onMethodCalled({
902
- methodName: functionName,
903
- durationMs: Date.now() - startTime,
904
- success: true,
905
- argumentCount,
906
- isPaginated: true
907
- });
908
- }).catch((error) => {
909
- const argumentCount = Object.keys(
910
- normalizedOptions
911
- ).filter((k) => k !== "_telemetry").length;
912
- telemetry.onMethodCalled({
913
- methodName: functionName,
914
- durationMs: Date.now() - startTime,
915
- success: false,
916
- error: error instanceof Error ? error : new Error(String(error)),
917
- argumentCount,
918
- isPaginated: true
919
- });
920
- });
921
- }
922
- return Object.assign(firstPagePromise, {
923
- [Symbol.asyncIterator]: async function* () {
924
- yield await firstPagePromise;
925
- for await (const page of iterator) {
926
- yield page;
895
+ return runWithTelemetryContext(() => {
896
+ const startTime = Date.now();
897
+ const normalizedOptions = options ?? {};
898
+ const isNested = isTelemetryNested();
899
+ const validatedOptions = {
900
+ ...normalizedOptions,
901
+ ...validator ? validator(normalizedOptions) : normalizedOptions
902
+ };
903
+ const pageSize = validatedOptions.pageSize || 100;
904
+ const optimizedOptions = {
905
+ ...validatedOptions,
906
+ pageSize
907
+ };
908
+ const iterator = paginate(pageFunction, optimizedOptions);
909
+ const firstPagePromise = iterator.next().then((result) => {
910
+ if (result.done) {
911
+ throw new Error("Paginate should always iterate at least once");
927
912
  }
928
- },
929
- items: function() {
930
- return {
931
- [Symbol.asyncIterator]: async function* () {
932
- const firstPage = await firstPagePromise;
933
- for (const item of firstPage.data) {
934
- yield item;
935
- }
936
- for await (const page of iterator) {
937
- for (const item of page.data) {
913
+ return result.value;
914
+ });
915
+ if (!isNested && telemetry?.onMethodCalled) {
916
+ firstPagePromise.then(() => {
917
+ const argumentCount = Object.keys(
918
+ normalizedOptions
919
+ ).length;
920
+ telemetry.onMethodCalled({
921
+ methodName: functionName,
922
+ durationMs: Date.now() - startTime,
923
+ success: true,
924
+ argumentCount,
925
+ isPaginated: true
926
+ });
927
+ }).catch((error) => {
928
+ const argumentCount = Object.keys(
929
+ normalizedOptions
930
+ ).length;
931
+ telemetry.onMethodCalled({
932
+ methodName: functionName,
933
+ durationMs: Date.now() - startTime,
934
+ success: false,
935
+ error: error instanceof Error ? error : new Error(String(error)),
936
+ argumentCount,
937
+ isPaginated: true
938
+ });
939
+ });
940
+ }
941
+ return Object.assign(firstPagePromise, {
942
+ [Symbol.asyncIterator]: async function* () {
943
+ yield await firstPagePromise;
944
+ for await (const page of iterator) {
945
+ yield page;
946
+ }
947
+ },
948
+ items: function() {
949
+ return {
950
+ [Symbol.asyncIterator]: async function* () {
951
+ const firstPage = await firstPagePromise;
952
+ for (const item of firstPage.data) {
938
953
  yield item;
939
954
  }
955
+ for await (const page of iterator) {
956
+ for (const item of page.data) {
957
+ yield item;
958
+ }
959
+ }
940
960
  }
941
- }
942
- };
943
- }
961
+ };
962
+ }
963
+ });
944
964
  });
945
965
  }
946
966
  };
@@ -959,7 +979,7 @@ var ListAppsSchema = ListAppsQuerySchema.omit({
959
979
  maxItems: z.number().min(1).optional().describe("Maximum total items to return across all pages"),
960
980
  // SDK specific property for pagination/iterable helpers
961
981
  cursor: z.string().optional().describe("Cursor to start from")
962
- }).merge(TelemetryMarkerSchema).describe("List all available apps with optional filtering");
982
+ }).describe("List all available apps with optional filtering");
963
983
 
964
984
  // src/utils/string-utils.ts
965
985
  function toTitleCase(input) {
@@ -1169,7 +1189,7 @@ var ListActionsSchema = z.object({
1169
1189
  pageSize: z.number().min(1).optional().describe("Number of actions per page"),
1170
1190
  maxItems: z.number().min(1).optional().describe("Maximum total items to return across all pages"),
1171
1191
  cursor: z.string().optional().describe("Cursor to start from")
1172
- }).merge(TelemetryMarkerSchema).describe("List all actions for a specific app");
1192
+ }).describe("List all actions for a specific app");
1173
1193
  var NeedChoicesSchema = z.object({
1174
1194
  key: z.string().optional(),
1175
1195
  label: z.string().optional(),
@@ -2205,7 +2225,7 @@ var ListConnectionsQuerySchema = ListConnectionsQuerySchema$1.omit({
2205
2225
  maxItems: z.number().min(1).optional().describe("Maximum total items to return across all pages"),
2206
2226
  // SDK specific property for pagination/iterable helpers
2207
2227
  cursor: z.string().optional().describe("Cursor to start from")
2208
- }).merge(TelemetryMarkerSchema).describe("List available connections with optional filtering");
2228
+ }).describe("List available connections with optional filtering");
2209
2229
  var ConnectionItemSchema = withFormatter(ConnectionItemSchema$1, {
2210
2230
  format: (item) => {
2211
2231
  const details = [];
@@ -2332,7 +2352,7 @@ var ListClientCredentialsQuerySchema = ListClientCredentialsQuerySchema$1.omit({
2332
2352
  maxItems: z.number().min(1).optional().describe("Maximum total items to return across all pages"),
2333
2353
  // SDK specific property for pagination/iterable helpers
2334
2354
  cursor: z.string().optional().describe("Cursor to start from")
2335
- }).merge(TelemetryMarkerSchema).describe("List client credentials for the authenticated user");
2355
+ }).describe("List client credentials for the authenticated user");
2336
2356
  var ClientCredentialsItemSchema = withFormatter(
2337
2357
  ClientCredentialsItemSchema$1,
2338
2358
  {
@@ -2435,7 +2455,7 @@ var listClientCredentialsPlugin = ({ context }) => {
2435
2455
  };
2436
2456
  var CreateClientCredentialsSchema = CreateClientCredentialsRequestSchema.omit({ allowed_scopes: true }).extend({
2437
2457
  allowedScopes: z.array(z.enum(["credentials", "external"])).default(["external"]).describe("Scopes to allow for these credentials")
2438
- }).merge(TelemetryMarkerSchema).describe("Create new client credentials for the authenticated user");
2458
+ }).describe("Create new client credentials for the authenticated user");
2439
2459
 
2440
2460
  // src/plugins/createClientCredentials/index.ts
2441
2461
  var createClientCredentialsPlugin = ({ context }) => {
@@ -2500,7 +2520,7 @@ var createClientCredentialsPlugin = ({ context }) => {
2500
2520
  };
2501
2521
  var DeleteClientCredentialsSchema = z.object({
2502
2522
  clientId: z.string().describe("The client ID of the client credentials to delete")
2503
- }).merge(TelemetryMarkerSchema).describe("Delete client credentials by client ID");
2523
+ }).describe("Delete client credentials by client ID");
2504
2524
 
2505
2525
  // src/plugins/deleteClientCredentials/index.ts
2506
2526
  var deleteClientCredentialsPlugin = ({ context }) => {
@@ -2564,8 +2584,7 @@ var GetAppSchema = z.object({
2564
2584
  var getAppPlugin = ({ sdk, context }) => {
2565
2585
  async function getApp(options) {
2566
2586
  const appsIterable = sdk.listApps({
2567
- appKeys: [options.appKey],
2568
- _telemetry: { isNested: true }
2587
+ appKeys: [options.appKey]
2569
2588
  }).items();
2570
2589
  for await (const app of appsIterable) {
2571
2590
  return {
@@ -2606,13 +2625,13 @@ var GetActionSchema = z.object({
2606
2625
  appKey: AppKeyPropertySchema,
2607
2626
  actionType: ActionTypePropertySchema,
2608
2627
  actionKey: ActionKeyPropertySchema
2609
- }).merge(TelemetryMarkerSchema).describe("Get detailed information about a specific action");
2628
+ }).describe("Get detailed information about a specific action");
2610
2629
 
2611
2630
  // src/plugins/getAction/index.ts
2612
2631
  var getActionPlugin = ({ sdk, context }) => {
2613
2632
  async function getAction(options) {
2614
2633
  const { actionKey, actionType, appKey } = options;
2615
- for await (const action of sdk.listActions({ appKey, _telemetry: { isNested: true } }).items()) {
2634
+ for await (const action of sdk.listActions({ appKey }).items()) {
2616
2635
  if ((action.key === actionKey || action.id === actionKey) && action.action_type === actionType) {
2617
2636
  return { data: action };
2618
2637
  }
@@ -2701,8 +2720,7 @@ var FindFirstConnectionSchema = ListConnectionsQuerySchema.omit({
2701
2720
  connectionIds: true,
2702
2721
  pageSize: true,
2703
2722
  maxItems: true,
2704
- cursor: true,
2705
- _telemetry: true
2723
+ cursor: true
2706
2724
  }).describe("Find the first connection matching the criteria");
2707
2725
 
2708
2726
  // src/plugins/findFirstConnection/index.ts
@@ -2710,8 +2728,7 @@ var findFirstConnectionPlugin = ({ sdk, context }) => {
2710
2728
  async function findFirstConnection(options = {}) {
2711
2729
  const connectionsResponse = await sdk.listConnections({
2712
2730
  ...options,
2713
- maxItems: 1,
2714
- _telemetry: { isNested: true }
2731
+ maxItems: 1
2715
2732
  });
2716
2733
  if (connectionsResponse.data.length === 0) {
2717
2734
  throw new ZapierResourceNotFoundError(
@@ -2753,8 +2770,7 @@ var FindUniqueConnectionSchema = ListConnectionsQuerySchema.omit({
2753
2770
  connectionIds: true,
2754
2771
  pageSize: true,
2755
2772
  maxItems: true,
2756
- cursor: true,
2757
- _telemetry: true
2773
+ cursor: true
2758
2774
  }).describe("Find a unique connection matching the criteria");
2759
2775
 
2760
2776
  // src/plugins/findUniqueConnection/index.ts
@@ -2762,9 +2778,8 @@ var findUniqueConnectionPlugin = ({ sdk, context }) => {
2762
2778
  async function findUniqueConnection(options = {}) {
2763
2779
  const connectionsResponse = await sdk.listConnections({
2764
2780
  ...options,
2765
- maxItems: 2,
2781
+ maxItems: 2
2766
2782
  // Get up to 2 to check for uniqueness
2767
- _telemetry: { isNested: true }
2768
2783
  });
2769
2784
  if (connectionsResponse.data.length === 0) {
2770
2785
  throw new ZapierResourceNotFoundError(
@@ -2886,8 +2901,7 @@ var runActionPlugin = ({ sdk, context }) => {
2886
2901
  const actionData = await sdk.getAction({
2887
2902
  appKey,
2888
2903
  actionKey,
2889
- actionType,
2890
- _telemetry: { isNested: true }
2904
+ actionType
2891
2905
  });
2892
2906
  if (actionData.data.action_type !== actionType) {
2893
2907
  throw new ZapierValidationError(
@@ -2966,7 +2980,7 @@ var RelayRequestSchema = z.object({
2966
2980
  z.instanceof(Headers),
2967
2981
  z.array(z.tuple([z.string(), z.string()]))
2968
2982
  ]).optional().describe("Request headers")
2969
- }).merge(TelemetryMarkerSchema).describe("Make authenticated HTTP requests through Zapier's Relay service");
2983
+ }).describe("Make authenticated HTTP requests through Zapier's Relay service");
2970
2984
  var RelayFetchSchema = RelayRequestSchema;
2971
2985
 
2972
2986
  // src/utils/logging.ts
@@ -2999,8 +3013,7 @@ var requestPlugin = ({ sdk, context }) => {
2999
3013
  body,
3000
3014
  headers,
3001
3015
  connectionId: resolvedConnectionId,
3002
- callbackUrl,
3003
- _telemetry: { isNested: true }
3016
+ callbackUrl
3004
3017
  });
3005
3018
  }
3006
3019
  const requestDefinition = createFunction(
@@ -4842,7 +4855,8 @@ var registryPlugin = ({ sdk, context }) => {
4842
4855
  packages: meta.packages,
4843
4856
  // Auto-infer confirm: "delete" from type: "delete" (all deletes should confirm)
4844
4857
  confirm: meta.confirm ?? (meta.type === "delete" ? "delete" : void 0),
4845
- deprecatedParameters: meta.deprecatedParameters
4858
+ deprecatedParameters: meta.deprecatedParameters,
4859
+ aliases: meta.aliases
4846
4860
  };
4847
4861
  }).sort((a, b) => a.name.localeCompare(b.name));
4848
4862
  const knownCategories = Object.keys(categoryDefinitions);
@@ -5366,7 +5380,7 @@ function getCpuTime() {
5366
5380
 
5367
5381
  // package.json
5368
5382
  var package_default = {
5369
- version: "0.28.0"};
5383
+ version: "0.30.0"};
5370
5384
 
5371
5385
  // src/plugins/eventEmission/builders.ts
5372
5386
  function createBaseEvent(context = {}) {
@@ -8,9 +8,6 @@ export declare const CreateClientCredentialsSchema: z.ZodObject<{
8
8
  external: "external";
9
9
  credentials: "credentials";
10
10
  }>>>;
11
- _telemetry: z.ZodOptional<z.ZodObject<{
12
- isNested: z.ZodOptional<z.ZodBoolean>;
13
- }, z.core.$strip>>;
14
11
  }, z.core.$strip>;
15
12
  export type CreateClientCredentialsOptions = z.infer<typeof CreateClientCredentialsSchema> & FunctionOptions;
16
13
  export interface CreateClientCredentialsResult {
@@ -1 +1 @@
1
- {"version":3,"file":"schemas.d.ts","sourceRoot":"","sources":["../../../src/plugins/createClientCredentials/schemas.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAC7D,OAAO,KAAK,EAAE,4BAA4B,EAAE,MAAM,uDAAuD,CAAC;AAE1G,OAAO,KAAK,EACV,yBAAyB,EACzB,cAAc,EACd,qBAAqB,EACrB,kBAAkB,EACnB,MAAM,oBAAoB,CAAC;AAG5B,eAAO,MAAM,6BAA6B;;;;;;;;;iBAS+B,CAAC;AAG1E,MAAM,MAAM,8BAA8B,GAAG,CAAC,CAAC,KAAK,CAClD,OAAO,6BAA6B,CACrC,GACC,eAAe,CAAC;AAGlB,MAAM,WAAW,6BAA6B;IAC5C,IAAI,EAAE,4BAA4B,CAAC;CACpC;AAGD,MAAM,MAAM,4BAA4B,GACpC,yBAAyB,GACzB,cAAc,GACd,qBAAqB,GACrB,kBAAkB,CAAC;AAGvB,MAAM,WAAW,kCAAkC;IACjD,uBAAuB,EAAE,CACvB,OAAO,EAAE,8BAA8B,KACpC,OAAO,CAAC,6BAA6B,CAAC,CAAC;CAC7C"}
1
+ {"version":3,"file":"schemas.d.ts","sourceRoot":"","sources":["../../../src/plugins/createClientCredentials/schemas.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAC7D,OAAO,KAAK,EAAE,4BAA4B,EAAE,MAAM,uDAAuD,CAAC;AAE1G,OAAO,KAAK,EACV,yBAAyB,EACzB,cAAc,EACd,qBAAqB,EACrB,kBAAkB,EACnB,MAAM,oBAAoB,CAAC;AAC5B,eAAO,MAAM,6BAA6B;;;;;;iBAQ+B,CAAC;AAG1E,MAAM,MAAM,8BAA8B,GAAG,CAAC,CAAC,KAAK,CAClD,OAAO,6BAA6B,CACrC,GACC,eAAe,CAAC;AAGlB,MAAM,WAAW,6BAA6B;IAC5C,IAAI,EAAE,4BAA4B,CAAC;CACpC;AAGD,MAAM,MAAM,4BAA4B,GACpC,yBAAyB,GACzB,cAAc,GACd,qBAAqB,GACrB,kBAAkB,CAAC;AAGvB,MAAM,WAAW,kCAAkC;IACjD,uBAAuB,EAAE,CACvB,OAAO,EAAE,8BAA8B,KACpC,OAAO,CAAC,6BAA6B,CAAC,CAAC;CAC7C"}
@@ -1,6 +1,5 @@
1
1
  import { z } from "zod";
2
2
  import { CreateClientCredentialsRequestSchema } from "@zapier/zapier-sdk-core/v0/schemas/client-credentials";
3
- import { TelemetryMarkerSchema } from "../../utils/function-utils";
4
3
  export const CreateClientCredentialsSchema = CreateClientCredentialsRequestSchema.omit({ allowed_scopes: true })
5
4
  .extend({
6
5
  allowedScopes: z
@@ -8,5 +7,4 @@ export const CreateClientCredentialsSchema = CreateClientCredentialsRequestSchem
8
7
  .default(["external"])
9
8
  .describe("Scopes to allow for these credentials"),
10
9
  })
11
- .merge(TelemetryMarkerSchema)
12
10
  .describe("Create new client credentials for the authenticated user");
@@ -3,9 +3,6 @@ import type { FunctionOptions } from "../../types/functions";
3
3
  import type { ZapierAuthenticationError, ZapierApiError, ZapierValidationError, ZapierNotFoundError, ZapierUnknownError } from "../../types/errors";
4
4
  export declare const DeleteClientCredentialsSchema: z.ZodObject<{
5
5
  clientId: z.ZodString;
6
- _telemetry: z.ZodOptional<z.ZodObject<{
7
- isNested: z.ZodOptional<z.ZodBoolean>;
8
- }, z.core.$strip>>;
9
6
  }, z.core.$strip>;
10
7
  export type DeleteClientCredentialsOptions = z.infer<typeof DeleteClientCredentialsSchema> & FunctionOptions;
11
8
  export interface DeleteClientCredentialsResult {
@@ -1 +1 @@
1
- {"version":3,"file":"schemas.d.ts","sourceRoot":"","sources":["../../../src/plugins/deleteClientCredentials/schemas.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAC7D,OAAO,KAAK,EACV,yBAAyB,EACzB,cAAc,EACd,qBAAqB,EACrB,mBAAmB,EACnB,kBAAkB,EACnB,MAAM,oBAAoB,CAAC;AAG5B,eAAO,MAAM,6BAA6B;;;;;iBAOW,CAAC;AAGtD,MAAM,MAAM,8BAA8B,GAAG,CAAC,CAAC,KAAK,CAClD,OAAO,6BAA6B,CACrC,GACC,eAAe,CAAC;AAGlB,MAAM,WAAW,6BAA6B;IAC5C,OAAO,EAAE,OAAO,CAAC;CAClB;AAGD,MAAM,MAAM,4BAA4B,GACpC,yBAAyB,GACzB,cAAc,GACd,qBAAqB,GACrB,mBAAmB,GACnB,kBAAkB,CAAC;AAGvB,MAAM,WAAW,kCAAkC;IACjD,uBAAuB,EAAE,CACvB,OAAO,EAAE,8BAA8B,KACpC,OAAO,CAAC,6BAA6B,CAAC,CAAC;CAC7C"}
1
+ {"version":3,"file":"schemas.d.ts","sourceRoot":"","sources":["../../../src/plugins/deleteClientCredentials/schemas.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAC7D,OAAO,KAAK,EACV,yBAAyB,EACzB,cAAc,EACd,qBAAqB,EACrB,mBAAmB,EACnB,kBAAkB,EACnB,MAAM,oBAAoB,CAAC;AAC5B,eAAO,MAAM,6BAA6B;;iBAMW,CAAC;AAGtD,MAAM,MAAM,8BAA8B,GAAG,CAAC,CAAC,KAAK,CAClD,OAAO,6BAA6B,CACrC,GACC,eAAe,CAAC;AAGlB,MAAM,WAAW,6BAA6B;IAC5C,OAAO,EAAE,OAAO,CAAC;CAClB;AAGD,MAAM,MAAM,4BAA4B,GACpC,yBAAyB,GACzB,cAAc,GACd,qBAAqB,GACrB,mBAAmB,GACnB,kBAAkB,CAAC;AAGvB,MAAM,WAAW,kCAAkC;IACjD,uBAAuB,EAAE,CACvB,OAAO,EAAE,8BAA8B,KACpC,OAAO,CAAC,6BAA6B,CAAC,CAAC;CAC7C"}
@@ -1,10 +1,8 @@
1
1
  import { z } from "zod";
2
- import { TelemetryMarkerSchema } from "../../utils/function-utils";
3
2
  export const DeleteClientCredentialsSchema = z
4
3
  .object({
5
4
  clientId: z
6
5
  .string()
7
6
  .describe("The client ID of the client credentials to delete"),
8
7
  })
9
- .merge(TelemetryMarkerSchema)
10
8
  .describe("Delete client credentials by client ID");