@zapier/zapier-sdk 0.15.10 → 0.15.12

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 (108) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/dist/index.cjs +520 -257
  3. package/dist/index.d.mts +184 -39
  4. package/dist/index.d.ts +3 -3
  5. package/dist/index.d.ts.map +1 -1
  6. package/dist/index.js +1 -1
  7. package/dist/index.mjs +520 -258
  8. package/dist/plugins/eventEmission/builders.d.ts +3 -2
  9. package/dist/plugins/eventEmission/builders.d.ts.map +1 -1
  10. package/dist/plugins/eventEmission/builders.js +32 -0
  11. package/dist/plugins/eventEmission/index.d.ts +4 -2
  12. package/dist/plugins/eventEmission/index.d.ts.map +1 -1
  13. package/dist/plugins/eventEmission/index.js +8 -2
  14. package/dist/plugins/eventEmission/types.d.ts +10 -0
  15. package/dist/plugins/eventEmission/types.d.ts.map +1 -1
  16. package/dist/plugins/fetch/index.d.ts +2 -1
  17. package/dist/plugins/fetch/index.d.ts.map +1 -1
  18. package/dist/plugins/fetch/index.js +39 -11
  19. package/dist/plugins/findFirstAuthentication/index.d.ts +2 -1
  20. package/dist/plugins/findFirstAuthentication/index.d.ts.map +1 -1
  21. package/dist/plugins/findFirstAuthentication/index.js +7 -4
  22. package/dist/plugins/findFirstAuthentication/index.test.js +11 -4
  23. package/dist/plugins/findUniqueAuthentication/index.d.ts +2 -1
  24. package/dist/plugins/findUniqueAuthentication/index.d.ts.map +1 -1
  25. package/dist/plugins/findUniqueAuthentication/index.js +7 -4
  26. package/dist/plugins/findUniqueAuthentication/index.test.js +9 -2
  27. package/dist/plugins/getAction/index.d.ts +3 -1
  28. package/dist/plugins/getAction/index.d.ts.map +1 -1
  29. package/dist/plugins/getAction/index.js +9 -5
  30. package/dist/plugins/getAction/index.test.js +5 -3
  31. package/dist/plugins/getAction/schemas.d.ts +14 -0
  32. package/dist/plugins/getAction/schemas.d.ts.map +1 -1
  33. package/dist/plugins/getAction/schemas.js +2 -0
  34. package/dist/plugins/getApp/index.d.ts +2 -1
  35. package/dist/plugins/getApp/index.d.ts.map +1 -1
  36. package/dist/plugins/getApp/index.js +12 -5
  37. package/dist/plugins/getApp/index.test.js +7 -0
  38. package/dist/plugins/getAuthentication/index.d.ts +3 -1
  39. package/dist/plugins/getAuthentication/index.d.ts.map +1 -1
  40. package/dist/plugins/getAuthentication/index.js +5 -3
  41. package/dist/plugins/getAuthentication/index.test.js +10 -1
  42. package/dist/plugins/getInputFieldsSchema/index.d.ts +2 -1
  43. package/dist/plugins/getInputFieldsSchema/index.d.ts.map +1 -1
  44. package/dist/plugins/getInputFieldsSchema/index.js +5 -3
  45. package/dist/plugins/getInputFieldsSchema/index.test.js +3 -0
  46. package/dist/plugins/getProfile/index.d.ts +3 -1
  47. package/dist/plugins/getProfile/index.d.ts.map +1 -1
  48. package/dist/plugins/getProfile/index.js +5 -3
  49. package/dist/plugins/listActions/index.d.ts +2 -1
  50. package/dist/plugins/listActions/index.d.ts.map +1 -1
  51. package/dist/plugins/listActions/index.js +19 -14
  52. package/dist/plugins/listActions/index.test.js +7 -0
  53. package/dist/plugins/listActions/schemas.d.ts +18 -4
  54. package/dist/plugins/listActions/schemas.d.ts.map +1 -1
  55. package/dist/plugins/listActions/schemas.js +2 -0
  56. package/dist/plugins/listApps/index.d.ts +2 -1
  57. package/dist/plugins/listApps/index.d.ts.map +1 -1
  58. package/dist/plugins/listApps/index.js +7 -3
  59. package/dist/plugins/listApps/index.test.js +7 -0
  60. package/dist/plugins/listAuthentications/index.d.ts +2 -1
  61. package/dist/plugins/listAuthentications/index.d.ts.map +1 -1
  62. package/dist/plugins/listAuthentications/index.js +7 -3
  63. package/dist/plugins/listAuthentications/index.test.js +7 -0
  64. package/dist/plugins/listAuthentications/schemas.d.ts +18 -4
  65. package/dist/plugins/listAuthentications/schemas.d.ts.map +1 -1
  66. package/dist/plugins/listAuthentications/schemas.js +2 -0
  67. package/dist/plugins/listInputFieldChoices/index.d.ts +3 -1
  68. package/dist/plugins/listInputFieldChoices/index.d.ts.map +1 -1
  69. package/dist/plugins/listInputFieldChoices/index.js +7 -3
  70. package/dist/plugins/listInputFieldChoices/index.test.js +5 -2
  71. package/dist/plugins/listInputFieldChoices/schemas.d.ts +4 -4
  72. package/dist/plugins/listInputFields/index.d.ts +3 -1
  73. package/dist/plugins/listInputFields/index.d.ts.map +1 -1
  74. package/dist/plugins/listInputFields/index.js +7 -4
  75. package/dist/plugins/listInputFields/index.test.js +3 -0
  76. package/dist/plugins/listInputFields/schemas.d.ts +4 -4
  77. package/dist/plugins/manifest/index.test.js +10 -1
  78. package/dist/plugins/request/index.d.ts +3 -1
  79. package/dist/plugins/request/index.d.ts.map +1 -1
  80. package/dist/plugins/request/index.js +5 -3
  81. package/dist/plugins/request/index.test.js +10 -1
  82. package/dist/plugins/request/schemas.d.ts +28 -0
  83. package/dist/plugins/request/schemas.d.ts.map +1 -1
  84. package/dist/plugins/request/schemas.js +2 -0
  85. package/dist/plugins/runAction/index.d.ts +3 -1
  86. package/dist/plugins/runAction/index.d.ts.map +1 -1
  87. package/dist/plugins/runAction/index.js +8 -3
  88. package/dist/plugins/runAction/index.test.js +20 -8
  89. package/dist/plugins/runAction/schemas.d.ts +4 -4
  90. package/dist/temporary-internal-core/schemas/apps/index.d.ts +21 -7
  91. package/dist/temporary-internal-core/schemas/apps/index.d.ts.map +1 -1
  92. package/dist/temporary-internal-core/schemas/apps/index.js +2 -0
  93. package/dist/types/telemetry-events.d.ts +31 -2
  94. package/dist/types/telemetry-events.d.ts.map +1 -1
  95. package/dist/utils/function-utils.d.ts +42 -3
  96. package/dist/utils/function-utils.d.ts.map +1 -1
  97. package/dist/utils/function-utils.js +84 -9
  98. package/dist/utils/string-utils.d.ts +19 -0
  99. package/dist/utils/string-utils.d.ts.map +1 -1
  100. package/dist/utils/string-utils.js +21 -0
  101. package/dist/utils/string-utils.test.js +24 -1
  102. package/dist/utils/telemetry-utils.d.ts +44 -0
  103. package/dist/utils/telemetry-utils.d.ts.map +1 -0
  104. package/dist/utils/telemetry-utils.js +55 -0
  105. package/dist/utils/telemetry-utils.test.d.ts +2 -0
  106. package/dist/utils/telemetry-utils.test.d.ts.map +1 -0
  107. package/dist/utils/telemetry-utils.test.js +94 -0
  108. package/package.json +1 -1
@@ -4,6 +4,7 @@ import type { InputFieldChoiceItem } from "./schemas";
4
4
  import { ListInputFieldChoicesSchema, type ListInputFieldChoicesOptions } from "./schemas";
5
5
  import type { GetActionPluginProvides } from "../getAction";
6
6
  import type { GetVersionedImplementationId } from "../manifest/schemas";
7
+ import type { EventEmissionContext } from "../eventEmission";
7
8
  export interface ListInputFieldChoicesPluginProvides {
8
9
  listInputFieldChoices: (options: ListInputFieldChoicesOptions) => Promise<{
9
10
  data: InputFieldChoiceItem[];
@@ -23,9 +24,10 @@ export interface ListInputFieldChoicesPluginProvides {
23
24
  };
24
25
  }
25
26
  export declare const listInputFieldChoicesPlugin: Plugin<GetSdkType<GetActionPluginProvides>, // requires getAction in SDK
27
+ // requires getAction in SDK
26
28
  {
27
29
  api: ApiClient;
28
30
  getVersionedImplementationId: GetVersionedImplementationId;
29
- }, // requires api and getVersionedImplementationId in context
31
+ } & EventEmissionContext, // requires api, getVersionedImplementationId, and eventEmission in context
30
32
  ListInputFieldChoicesPluginProvides>;
31
33
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/plugins/listInputFieldChoices/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAC7D,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AAE3C,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,WAAW,CAAC;AACtD,OAAO,EACL,2BAA2B,EAC3B,KAAK,4BAA4B,EAGlC,MAAM,WAAW,CAAC;AAGnB,OAAO,KAAK,EAAE,uBAA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B,CAAC;AAcxE,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,kBAAkB,CAAC;AAe7D,MAAM,WAAW,mCAAmC;IAClD,qBAAqB,EAAE,CAAC,OAAO,EAAE,4BAA4B,KAAK,OAAO,CAAC;QACxE,IAAI,EAAE,oBAAoB,EAAE,CAAC;QAC7B,UAAU,CAAC,EAAE,MAAM,CAAC;KACrB,CAAC,GACA,aAAa,CAAC;QAAE,IAAI,EAAE,oBAAoB,EAAE,CAAC;QAAC,UAAU,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC,GAAG;QACrE,KAAK,IAAI,aAAa,CAAC,oBAAoB,CAAC,CAAC;KAC9C,CAAC;IACJ,OAAO,EAAE;QACP,IAAI,EAAE;YACJ,qBAAqB,EAAE;gBACrB,WAAW,EAAE,OAAO,2BAA2B,CAAC;aACjD,CAAC;SACH,CAAC;KACH,CAAC;CACH;AAED,eAAO,MAAM,2BAA2B,EAAE,MAAM,CAC9C,UAAU,CAAC,uBAAuB,CAAC,EAAE,4BAA4B;AACjE,AADqC,4BAA4B;AACjE;IACE,GAAG,EAAE,SAAS,CAAC;IACf,4BAA4B,EAAE,4BAA4B,CAAC;CAC5D,GAAG,oBAAoB,EAAE,2EAA2E;AACrG,mCAAmC,CAkJpC,CAAC"}
@@ -3,6 +3,8 @@ import { ZapierApiError, ZapierConfigurationError } from "../../types/errors";
3
3
  import { createPaginatedFunction } from "../../utils/function-utils";
4
4
  import { appKeyResolver, actionTypeResolver, actionKeyResolver, authenticationIdResolver, inputFieldKeyResolver, inputsAllOptionalResolver, } from "../../resolvers";
5
5
  import { fetchImplementationNeeds, fetchImplementationChoices, } from "../../services/implementations";
6
+ import { createTelemetryCallback } from "../../utils/telemetry-utils";
7
+ import { stripPageSuffix } from "../../utils/string-utils";
6
8
  // Transform NeedChoices to InputFieldChoiceItem
7
9
  function transformNeedChoicesToInputFieldChoiceItem(choice) {
8
10
  return {
@@ -13,7 +15,7 @@ function transformNeedChoicesToInputFieldChoiceItem(choice) {
13
15
  };
14
16
  }
15
17
  export const listInputFieldChoicesPlugin = ({ context, sdk }) => {
16
- const listInputFieldChoices = createPaginatedFunction(async function listInputFieldChoicesPage(options) {
18
+ async function listInputFieldChoicesPage(options) {
17
19
  const { api, getVersionedImplementationId } = context;
18
20
  // Extract parameters
19
21
  const { appKey, actionType, actionKey, inputFieldKey, authenticationId = null, inputs, page, cursor, } = options;
@@ -85,9 +87,11 @@ export const listInputFieldChoicesPlugin = ({ context, sdk }) => {
85
87
  data: choices,
86
88
  nextCursor,
87
89
  };
88
- }, ListInputFieldChoicesSchema);
90
+ }
91
+ const methodName = stripPageSuffix(listInputFieldChoicesPage.name);
92
+ const listInputFieldChoicesDefinition = createPaginatedFunction(listInputFieldChoicesPage, ListInputFieldChoicesSchema, createTelemetryCallback(context.eventEmission.emitMethodCalled, methodName), methodName);
89
93
  return {
90
- listInputFieldChoices,
94
+ listInputFieldChoices: listInputFieldChoicesDefinition,
91
95
  context: {
92
96
  meta: {
93
97
  listInputFieldChoices: {
@@ -3,6 +3,7 @@ import { ZapierValidationError, ZapierApiError } from "../../types/errors";
3
3
  import { listInputFieldChoicesPlugin } from "./index";
4
4
  import { createSdk } from "../../sdk";
5
5
  import { GetActionSchema } from "../getAction/schemas";
6
+ import { eventEmissionPlugin } from "../eventEmission";
6
7
  const mockChoices = [
7
8
  {
8
9
  key: "general",
@@ -125,8 +126,10 @@ describe("listInputFieldChoices plugin", () => {
125
126
  return createSdk({}, {}, {
126
127
  api: mockApiClient,
127
128
  meta: {},
129
+ options: {},
128
130
  getVersionedImplementationId: mockGetVersionedImplementationId,
129
131
  })
132
+ .addPlugin(eventEmissionPlugin)
130
133
  .addPlugin(mockGetActionPlugin)
131
134
  .addPlugin(listInputFieldChoicesPlugin);
132
135
  }
@@ -340,11 +343,11 @@ describe("listInputFieldChoices plugin", () => {
340
343
  actionKey: "send_message",
341
344
  inputFieldKey: "channel",
342
345
  });
343
- expect(mockGetAction).toHaveBeenCalledWith({
346
+ expect(mockGetAction).toHaveBeenCalledWith(expect.objectContaining({
344
347
  appKey: "slack",
345
348
  actionType: "read",
346
349
  actionKey: "send_message",
347
- });
350
+ }));
348
351
  expect(mockApiClient.post).toHaveBeenCalledWith("/zapier/api/v4/implementations/choices/", {
349
352
  action_id: "core:123",
350
353
  input_field_id: "channel",
@@ -39,9 +39,9 @@ export declare const ListInputFieldChoicesSchema: z.ZodObject<{
39
39
  page?: number | undefined;
40
40
  authenticationId?: number | null | undefined;
41
41
  inputs?: Record<string, unknown> | undefined;
42
- pageSize?: number | undefined;
43
- maxItems?: number | undefined;
44
42
  cursor?: string | undefined;
43
+ maxItems?: number | undefined;
44
+ pageSize?: number | undefined;
45
45
  }, {
46
46
  appKey: string;
47
47
  actionKey: string;
@@ -50,9 +50,9 @@ export declare const ListInputFieldChoicesSchema: z.ZodObject<{
50
50
  page?: number | undefined;
51
51
  authenticationId?: number | null | undefined;
52
52
  inputs?: Record<string, unknown> | undefined;
53
- pageSize?: number | undefined;
54
- maxItems?: number | undefined;
55
53
  cursor?: string | undefined;
54
+ maxItems?: number | undefined;
55
+ pageSize?: number | undefined;
56
56
  }>;
57
57
  export type ListInputFieldChoicesOptions = z.infer<typeof ListInputFieldChoicesSchema>;
58
58
  export type ListInputFieldChoicesError = ZapierConfigurationError | ZapierApiError | ZapierAuthenticationError | ZapierAppNotFoundError | ZapierValidationError | ZapierUnknownError;
@@ -5,6 +5,7 @@ import { ListInputFieldsSchema, type ListInputFieldsOptions } from "./schemas";
5
5
  import type { GetAppPluginProvides } from "../getApp";
6
6
  import type { GetActionPluginProvides } from "../getAction";
7
7
  import type { GetVersionedImplementationId } from "../manifest/schemas";
8
+ import type { EventEmissionContext } from "../eventEmission";
8
9
  export interface ListInputFieldsPluginProvides {
9
10
  listInputFields: (options?: ListInputFieldsOptions) => Promise<{
10
11
  data: RootFieldItem[];
@@ -24,9 +25,10 @@ export interface ListInputFieldsPluginProvides {
24
25
  };
25
26
  }
26
27
  export declare const listInputFieldsPlugin: Plugin<GetSdkType<GetAppPluginProvides & GetActionPluginProvides>, // requires getApp and getAction in SDK
28
+ // requires getApp and getAction in SDK
27
29
  {
28
30
  api: ApiClient;
29
31
  getVersionedImplementationId: GetVersionedImplementationId;
30
- }, // requires api and getVersionedImplementationId in context
32
+ } & EventEmissionContext, // requires api, getVersionedImplementationId, and eventEmission in context
31
33
  ListInputFieldsPluginProvides>;
32
34
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/plugins/listInputFields/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAC7D,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AAE3C,OAAO,KAAK,EACV,cAAc,EACd,aAAa,EACb,YAAY,EACZ,aAAa,EACd,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EACL,qBAAqB,EACrB,KAAK,sBAAsB,EAE5B,MAAM,WAAW,CAAC;AAGnB,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,WAAW,CAAC;AACtD,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,cAAc,CAAC;AAC5D,OAAO,KAAK,EAAE,4BAA4B,EAAE,MAAM,qBAAqB,CAAC;AAoKxE,MAAM,WAAW,6BAA6B;IAC5C,eAAe,EAAE,CAAC,OAAO,CAAC,EAAE,sBAAsB,KAAK,OAAO,CAAC;QAC7D,IAAI,EAAE,aAAa,EAAE,CAAC;QACtB,UAAU,CAAC,EAAE,MAAM,CAAC;KACrB,CAAC,GACA,aAAa,CAAC;QAAE,IAAI,EAAE,aAAa,EAAE,CAAC;QAAC,UAAU,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC,GAAG;QAC9D,KAAK,IAAI,aAAa,CAAC,cAAc,GAAG,aAAa,GAAG,YAAY,CAAC,CAAC;KACvE,CAAC;IACJ,OAAO,EAA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D,KAAK,IAAI,aAAa,CAAC,cAAc,GAAG,aAAa,GAAG,YAAY,CAAC,CAAC;KACvE,CAAC;IACJ,OAAO,EAAE;QACP,IAAI,EAAE;YACJ,eAAe,EAAE;gBACf,WAAW,EAAE,OAAO,qBAAqB,CAAC;aAC3C,CAAC;SACH,CAAC;KACH,CAAC;CACH;AAED,eAAO,MAAM,qBAAqB,EAAE,MAAM,CACxC,UAAU,CAAC,oBAAoB,GAAG,uBAAuB,CAAC,EAAE,uCAAuC;AACnG,AAD4D,uCAAuC;AACnG;IACE,GAAG,EAAE,SAAS,CAAC;IACf,4BAA4B,EAAE,4BAA4B,CAAC;CAC5D,GAAG,oBAAoB,EAAE,2EAA2E;AACrG,6BAA6B,CAsF9B,CAAC"}
@@ -3,8 +3,9 @@ import { ZapierConfigurationError } from "../../types/errors";
3
3
  import { createPaginatedFunction } from "../../utils/function-utils";
4
4
  import { appKeyResolver, actionTypeResolver, actionKeyResolver, authenticationIdResolver, inputsAllOptionalResolver, } from "../../resolvers";
5
5
  import { RootFieldItemSchema } from "../../schemas/Field";
6
- import { toTitleCase } from "../../utils/string-utils";
6
+ import { toTitleCase, stripPageSuffix } from "../../utils/string-utils";
7
7
  import { fetchImplementationNeeds } from "../../services/implementations";
8
+ import { createTelemetryCallback } from "../../utils/telemetry-utils";
8
9
  // Enums for input field transformation
9
10
  var InputFieldType;
10
11
  (function (InputFieldType) {
@@ -144,7 +145,7 @@ function transformNeedsToFields(needs) {
144
145
  return rootFields;
145
146
  }
146
147
  export const listInputFieldsPlugin = ({ sdk, context }) => {
147
- const listInputFields = createPaginatedFunction(async function listInputFieldsPage(options) {
148
+ async function listInputFieldsPage(options) {
148
149
  // Note: This function ignores pageSize and cursor since it's not actually paginated internally
149
150
  const { api, getVersionedImplementationId } = context;
150
151
  // Extract parameters
@@ -176,9 +177,11 @@ export const listInputFieldsPlugin = ({ sdk, context }) => {
176
177
  data: rootFieldset,
177
178
  nextCursor: undefined, // No pagination needed since we return all input fields
178
179
  };
179
- }, ListInputFieldsSchema);
180
+ }
181
+ const methodName = stripPageSuffix(listInputFieldsPage.name);
182
+ const listInputFieldsDefinition = createPaginatedFunction(listInputFieldsPage, ListInputFieldsSchema, createTelemetryCallback(context.eventEmission.emitMethodCalled, methodName), methodName);
180
183
  return {
181
- listInputFields,
184
+ listInputFields: listInputFieldsDefinition,
182
185
  context: {
183
186
  meta: {
184
187
  listInputFields: {
@@ -6,6 +6,7 @@ import { getAppPlugin } from "../getApp";
6
6
  import { listActionsPlugin } from "../listActions";
7
7
  import { listAppsPlugin } from "../listApps";
8
8
  import { createSdk } from "../../sdk";
9
+ import { eventEmissionPlugin } from "../eventEmission";
9
10
  const mockNeeds = [
10
11
  {
11
12
  key: "message",
@@ -77,8 +78,10 @@ describe("listInputFields plugin", () => {
77
78
  return createSdk({}, {}, {
78
79
  api: mockApiClient,
79
80
  meta: {},
81
+ options: {},
80
82
  getVersionedImplementationId: mockGetVersionedImplementationId,
81
83
  })
84
+ .addPlugin(eventEmissionPlugin)
82
85
  .addPlugin(listAppsPlugin)
83
86
  .addPlugin(listActionsPlugin)
84
87
  .addPlugin(getAppPlugin)
@@ -19,18 +19,18 @@ export declare const ListInputFieldsSchema: z.ZodObject<{
19
19
  actionType: "search" | "filter" | "read" | "read_bulk" | "run" | "search_and_write" | "search_or_write" | "write";
20
20
  authenticationId?: number | null | undefined;
21
21
  inputs?: Record<string, unknown> | undefined;
22
- pageSize?: number | undefined;
23
- maxItems?: number | undefined;
24
22
  cursor?: string | undefined;
23
+ maxItems?: number | undefined;
24
+ pageSize?: number | undefined;
25
25
  }, {
26
26
  appKey: string;
27
27
  actionKey: string;
28
28
  actionType: "search" | "filter" | "read" | "read_bulk" | "run" | "search_and_write" | "search_or_write" | "write";
29
29
  authenticationId?: number | null | undefined;
30
30
  inputs?: Record<string, unknown> | undefined;
31
- pageSize?: number | undefined;
32
- maxItems?: number | undefined;
33
31
  cursor?: string | undefined;
32
+ maxItems?: number | undefined;
33
+ pageSize?: number | undefined;
34
34
  }>;
35
35
  export type ListInputFieldsOptions = z.infer<typeof ListInputFieldsSchema>;
36
36
  export type ListInputFieldsError = ZapierConfigurationError | ZapierApiError | ZapierAuthenticationError | ZapierAppNotFoundError | ZapierValidationError | ZapierUnknownError;
@@ -1,6 +1,7 @@
1
1
  import { describe, it, expect, vi, beforeEach, afterEach } from "vitest";
2
2
  import { manifestPlugin, readManifestFromFile, findManifestEntry, getPreferredManifestEntryKey, } from "./index";
3
3
  import { createSdk } from "../../sdk";
4
+ import { eventEmissionPlugin } from "../eventEmission";
4
5
  // Mock file-utils module
5
6
  vi.mock("../../utils/file-utils", () => ({
6
7
  readFile: vi.fn(),
@@ -150,7 +151,15 @@ describe("manifestPlugin", () => {
150
151
  },
151
152
  });
152
153
  function createTestSdk(options = {}) {
153
- return createSdk(options).addPlugin(apiPlugin).addPlugin(manifestPlugin);
154
+ return createSdk(options)
155
+ .addPlugin(() => ({
156
+ context: {
157
+ options: {},
158
+ },
159
+ }))
160
+ .addPlugin(apiPlugin)
161
+ .addPlugin(eventEmissionPlugin)
162
+ .addPlugin(manifestPlugin);
154
163
  }
155
164
  describe("plugin initialization", () => {
156
165
  it("should provide helper functions with direct manifest", () => {
@@ -1,6 +1,7 @@
1
1
  import type { Plugin } from "../../types/plugin";
2
2
  import type { ApiClient } from "../../api";
3
3
  import { RelayRequestSchema, type RelayRequestOptions } from "./schemas";
4
+ import type { EventEmissionContext } from "../eventEmission";
4
5
  export interface RequestPluginProvides {
5
6
  request: (options: RelayRequestOptions) => Promise<Response>;
6
7
  context: {
@@ -12,8 +13,9 @@ export interface RequestPluginProvides {
12
13
  };
13
14
  }
14
15
  export declare const requestPlugin: Plugin<{}, // no SDK dependencies
16
+ // no SDK dependencies
15
17
  {
16
18
  api: ApiClient;
17
- }, // requires api in context
19
+ } & EventEmissionContext, // requires api in context
18
20
  RequestPluginProvides>;
19
21
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/plugins/request/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AACjD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AAC3C,OAAO,EAAE,kBAAkB,EAAE,KAAK,mBAAmB,EAAE,MAAM,WAAW,CAAC;AAmBzE,MAAM,WAAW,qBAAqB;IACpC,OAAO,EAAE,CAAC,OAAO,EAAE,mBAAmB,KAAK,OAAO,CAAC,QAAQ,CAAC,CAAC;IAC7D,OAAO,EAAE;QACP,IAAI,EAAE;YACJ,OAAO,EAAE;gBACP,WAAW,EAAE,OAAO,kBAAkB,CAAC;aACxC,CAAC;SACH,CAAC;KACH,CAAC;CACH;AAED,eAAO,MAAM,aAAa,EAAE,MAAM,CAChC,EAAE,EAAE,sBAAsB;AAC1B;IAAE,GAAG,EAAE,SAAS,CAAA;CAAE,EAAE,0BAA0B;AAC9C,qBAAqB,CAqEtB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/plugins/request/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AACjD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AAC3C,OAAO,EAAE,kBAAkB,EAAE,KAAK,mBAAmB,EAAE,MAAM,WAAW,CAAC;AAEzE,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,kBAAkB,CAAC;AAmB7D,MAAM,WAAW,qBAAqB;IACpC,OAAO,EAAE,CAAC,OAAO,EAAE,mBAAmB,KAAK,OAAO,CAAC,QAAQ,CAAC,CAAC;IAC7D,OAAO,EAAE;QACP,IAAI,EAAE;YACJ,OAAO,EAAE;gBACP,WAAW,EAAE,OAAO,kBAAkB,CAAC;aACxC,CAAC;SACH,CAAC;KACH,CAAC;CACH;AAED,eAAO,MAAM,aAAa,EAAE,MAAM,CAChC,EAAE,EAAE,sBAAsB;AAC1B,AADI,sBAAsB;AAC1B;IAAE,GAAG,EAAE,SAAS,CAAA;CAAE,GAAG,oBAAoB,EAAE,0BAA0B;AACrE,qBAAqB,CA4EtB,CAAC"}
@@ -1,5 +1,6 @@
1
1
  import { RelayRequestSchema } from "./schemas";
2
2
  import { createFunction } from "../../utils/function-utils";
3
+ import { createTelemetryCallback } from "../../utils/telemetry-utils";
3
4
  /**
4
5
  * Transforms full URLs into Relay format: /relay/{domain}/{path}
5
6
  *
@@ -14,7 +15,7 @@ function transformUrlToRelayPath(url) {
14
15
  return relayPath;
15
16
  }
16
17
  export const requestPlugin = ({ context }) => {
17
- const request = createFunction(async function request(options) {
18
+ async function request(options) {
18
19
  const { api } = context;
19
20
  const { url, method = "GET", body, headers: optionsHeaders, authenticationId, callbackUrl, authenticationTemplate, } = options;
20
21
  // Transform full URL to relay path format
@@ -48,9 +49,10 @@ export const requestPlugin = ({ context }) => {
48
49
  body,
49
50
  headers,
50
51
  });
51
- }, RelayRequestSchema);
52
+ }
53
+ const requestDefinition = createFunction(request, RelayRequestSchema, createTelemetryCallback(context.eventEmission.emitMethodCalled, request.name));
52
54
  return {
53
- request,
55
+ request: requestDefinition,
54
56
  context: {
55
57
  meta: {
56
58
  request: {
@@ -2,6 +2,7 @@ import { describe, it, expect, vi, beforeEach } from "vitest";
2
2
  import { ZapierValidationError } from "../../types/errors";
3
3
  import { requestPlugin } from "./index";
4
4
  import { createSdk } from "../../sdk";
5
+ import { eventEmissionPlugin } from "../eventEmission";
5
6
  describe("request plugin", () => {
6
7
  let mockApiClient;
7
8
  let mockFetch;
@@ -21,7 +22,15 @@ describe("request plugin", () => {
21
22
  },
22
23
  });
23
24
  function createTestSdk() {
24
- return createSdk().addPlugin(apiPlugin).addPlugin(requestPlugin);
25
+ return createSdk()
26
+ .addPlugin(() => ({
27
+ context: {
28
+ options: {},
29
+ },
30
+ }))
31
+ .addPlugin(apiPlugin)
32
+ .addPlugin(eventEmissionPlugin)
33
+ .addPlugin(requestPlugin);
25
34
  }
26
35
  describe("schema validation", () => {
27
36
  it("should throw validation error for missing url", async () => {
@@ -10,12 +10,23 @@ export declare const RelayRequestSchema: z.ZodObject<{
10
10
  headers: z.ZodOptional<z.ZodUnion<[z.ZodRecord<z.ZodString, z.ZodString>, z.ZodType<Headers, z.ZodTypeDef, Headers>, z.ZodArray<z.ZodTuple<[z.ZodString, z.ZodString], null>, "many">]>>;
11
11
  } & {
12
12
  relayBaseUrl: z.ZodOptional<z.ZodString>;
13
+ } & {
14
+ _telemetry: z.ZodOptional<z.ZodObject<{
15
+ isNested: z.ZodOptional<z.ZodBoolean>;
16
+ }, "strip", z.ZodTypeAny, {
17
+ isNested?: boolean | undefined;
18
+ }, {
19
+ isNested?: boolean | undefined;
20
+ }>>;
13
21
  }, "strip", z.ZodTypeAny, {
14
22
  url: string;
15
23
  method?: "POST" | "GET" | "PUT" | "DELETE" | "PATCH" | "HEAD" | "OPTIONS" | undefined;
16
24
  authenticationId?: number | undefined;
17
25
  headers?: Record<string, string> | [string, string][] | Headers | undefined;
18
26
  body?: any;
27
+ _telemetry?: {
28
+ isNested?: boolean | undefined;
29
+ } | undefined;
19
30
  callbackUrl?: string | undefined;
20
31
  authenticationTemplate?: string | undefined;
21
32
  relayBaseUrl?: string | undefined;
@@ -25,6 +36,9 @@ export declare const RelayRequestSchema: z.ZodObject<{
25
36
  authenticationId?: number | undefined;
26
37
  headers?: Record<string, string> | [string, string][] | Headers | undefined;
27
38
  body?: any;
39
+ _telemetry?: {
40
+ isNested?: boolean | undefined;
41
+ } | undefined;
28
42
  callbackUrl?: string | undefined;
29
43
  authenticationTemplate?: string | undefined;
30
44
  relayBaseUrl?: string | undefined;
@@ -44,12 +58,23 @@ export declare const RelayFetchSchema: z.ZodObject<{
44
58
  headers: z.ZodOptional<z.ZodUnion<[z.ZodRecord<z.ZodString, z.ZodString>, z.ZodType<Headers, z.ZodTypeDef, Headers>, z.ZodArray<z.ZodTuple<[z.ZodString, z.ZodString], null>, "many">]>>;
45
59
  } & {
46
60
  relayBaseUrl: z.ZodOptional<z.ZodString>;
61
+ } & {
62
+ _telemetry: z.ZodOptional<z.ZodObject<{
63
+ isNested: z.ZodOptional<z.ZodBoolean>;
64
+ }, "strip", z.ZodTypeAny, {
65
+ isNested?: boolean | undefined;
66
+ }, {
67
+ isNested?: boolean | undefined;
68
+ }>>;
47
69
  }, "strip", z.ZodTypeAny, {
48
70
  url: string;
49
71
  method?: "POST" | "GET" | "PUT" | "DELETE" | "PATCH" | "HEAD" | "OPTIONS" | undefined;
50
72
  authenticationId?: number | undefined;
51
73
  headers?: Record<string, string> | [string, string][] | Headers | undefined;
52
74
  body?: any;
75
+ _telemetry?: {
76
+ isNested?: boolean | undefined;
77
+ } | undefined;
53
78
  callbackUrl?: string | undefined;
54
79
  authenticationTemplate?: string | undefined;
55
80
  relayBaseUrl?: string | undefined;
@@ -59,6 +84,9 @@ export declare const RelayFetchSchema: z.ZodObject<{
59
84
  authenticationId?: number | undefined;
60
85
  headers?: Record<string, string> | [string, string][] | Headers | undefined;
61
86
  body?: any;
87
+ _telemetry?: {
88
+ isNested?: boolean | undefined;
89
+ } | undefined;
62
90
  callbackUrl?: string | undefined;
63
91
  authenticationTemplate?: string | undefined;
64
92
  relayBaseUrl?: string | undefined;
@@ -1 +1 @@
1
- {"version":3,"file":"schemas.d.ts","sourceRoot":"","sources":["../../../src/plugins/request/schemas.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,KAAK,EACV,cAAc,EACd,qBAAqB,EACrB,kBAAkB,EACnB,MAAM,oBAAoB,CAAC;AAG5B,eAAO,MAAM,kBAAkB;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAuC+C,CAAC;AAG/E,MAAM,MAAM,mBAAmB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,kBAAkB,CAAC,CAAC;AAGrE,MAAM,MAAM,iBAAiB,GACzB,cA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1,5 @@
1
1
  import { z } from "zod";
2
+ import { TelemetryMarkerSchema } from "../../utils/function-utils";
2
3
  // Pure Zod schema for the request function
3
4
  export const RelayRequestSchema = z
4
5
  .object({
@@ -37,6 +38,7 @@ export const RelayRequestSchema = z
37
38
  .extend({
38
39
  relayBaseUrl: z.string().optional().describe("Base URL for Relay service"),
39
40
  })
41
+ .merge(TelemetryMarkerSchema)
40
42
  .describe("Make authenticated HTTP requests through Zapier's Relay service");
41
43
  // Legacy exports for compatibility
42
44
  export const RelayFetchSchema = RelayRequestSchema;
@@ -4,6 +4,7 @@ import { RunActionSchema, type RunActionOptions } from "./schemas";
4
4
  import type { GetActionPluginProvides } from "../getAction";
5
5
  import type { GetAppPluginProvides } from "../getApp";
6
6
  import type { GetVersionedImplementationId } from "../manifest/schemas";
7
+ import type { EventEmissionContext } from "../eventEmission";
7
8
  export interface RunActionPluginProvides {
8
9
  runAction: (options?: RunActionOptions) => Promise<{
9
10
  data: any[];
@@ -23,9 +24,10 @@ export interface RunActionPluginProvides {
23
24
  };
24
25
  }
25
26
  export declare const runActionPlugin: Plugin<GetSdkType<GetActionPluginProvides & GetAppPluginProvides>, // requires getAction and getApp in SDK
27
+ // requires getAction and getApp in SDK
26
28
  {
27
29
  api: ApiClient;
28
30
  getVersionedImplementationId: GetVersionedImplementationId;
29
- }, // requires api in context
31
+ } & EventEmissionContext, // requires api and eventEmission in context
30
32
  RunActionPluginProvides>;
31
33
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/plugins/runAction/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAC7D,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AAC3C,OAAO,EACL,eAAe,EACf,KAAK,gBAAgB,EAEtB,MAAM,WAAW,CAAC;AAQnB,OAAO,KAAK,EAAE,uBAAu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,OAAO,KAAK,EAAE,4BAA4B,EAAE,MAAM,qBAAqB,CAAC;AAExE,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,kBAAkB,CAAC;AAG7D,MAAM,WAAW,uBAAuB;IACtC,SAAS,EAAE,CAAC,OAAO,CAAC,EAAE,gBAAgB,KAAK,OAAO,CAAC;QACjD,IAAI,EAAE,GAAG,EAAE,CAAC;QACZ,UAAU,CAAC,EAAE,MAAM,CAAC;KACrB,CAAC,GACA,aAAa,CAAC;QAAE,IAAI,EAAE,GAAG,EAAE,CAAC;QAAC,UAAU,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC,GAAG;QACpD,KAAK,IAAI,aAAa,CAAC,GAAG,CAAC,CAAC;KAC7B,CAAC;IACJ,OAAO,EAAE;QACP,IAAI,EAAE;YACJ,SAAS,EAAE;gBACT,WAAW,EAAE,OAAO,eAAe,CAAC;aACrC,CAAC;SACH,CAAC;KACH,CAAC;CACH;AAgFD,eAAO,MAAM,eAAe,EAAE,MAAM,CAClC,UAAU,CAAC,uBAAuB,GAAG,oBAAoB,CAAC,EAAE,uCAAuC;AACnG,AAD4D,uCAAuC;AACnG;IACE,GAAG,EAAE,SAAS,CAAC;IACf,4BAA4B,EAAE,4BAA4B,CAAC;CAC5D,GAAG,oBAAoB,EAAE,4CAA4C;AACtE,uBAAuB,CAkGxB,CAAC"}
@@ -3,6 +3,8 @@ import { ActionResultItemSchema } from "../../schemas/Run";
3
3
  import { ZapierValidationError, ZapierConfigurationError, ZapierActionError, } from "../../types/errors";
4
4
  import { createPaginatedFunction } from "../../utils/function-utils";
5
5
  import { appKeyResolver, actionTypeResolver, actionKeyResolver, authenticationIdResolver, inputsResolver, } from "../../resolvers";
6
+ import { createTelemetryCallback } from "../../utils/telemetry-utils";
7
+ import { stripPageSuffix } from "../../utils/string-utils";
6
8
  async function executeAction(actionOptions) {
7
9
  const { api, context, appKey, actionId, actionKey, actionType, executionOptions, authenticationId, } = actionOptions;
8
10
  // Use the manifest plugin to get the current implementation ID
@@ -35,7 +37,7 @@ async function executeAction(actionOptions) {
35
37
  });
36
38
  }
37
39
  export const runActionPlugin = ({ sdk, context }) => {
38
- const runAction = createPaginatedFunction(async function runActionPage(options) {
40
+ async function runActionPage(options) {
39
41
  const { api } = context;
40
42
  const { appKey, actionKey, actionType, authenticationId, inputs = {}, } = options;
41
43
  // Validate that the action exists using the getAction plugin
@@ -43,6 +45,7 @@ export const runActionPlugin = ({ sdk, context }) => {
43
45
  appKey: appKey,
44
46
  actionKey: actionKey,
45
47
  actionType: actionType,
48
+ _telemetry: { isNested: true },
46
49
  });
47
50
  // Validate action type matches
48
51
  if (actionData.data.action_type !== actionType) {
@@ -78,9 +81,11 @@ export const runActionPlugin = ({ sdk, context }) => {
78
81
  data: result.results || [],
79
82
  nextCursor: undefined, // No pagination implemented yet
80
83
  };
81
- }, RunActionSchema);
84
+ }
85
+ const methodName = stripPageSuffix(runActionPage.name);
86
+ const runActionDefinition = createPaginatedFunction(runActionPage, RunActionSchema, createTelemetryCallback(context.eventEmission.emitMethodCalled, methodName), methodName);
82
87
  return {
83
- runAction,
88
+ runAction: runActionDefinition,
84
89
  context: {
85
90
  meta: {
86
91
  runAction: {
@@ -38,12 +38,24 @@ describe("runAction plugin", () => {
38
38
  });
39
39
  });
40
40
  function createTestSdk() {
41
- return createSdk({}, { getAction: mockGetAction, getApp: mockGetApp }, // Provide getAction and getApp in SDK
42
- {
43
- api: mockApiClient,
44
- meta: {},
45
- getVersionedImplementationId: () => "SlackCLIAPI@1.21.1",
46
- }).addPlugin(runActionPlugin);
41
+ return createSdk()
42
+ .addPlugin(() => ({
43
+ context: {
44
+ options: {},
45
+ },
46
+ }))
47
+ .addPlugin(() => ({
48
+ getAction: mockGetAction,
49
+ getApp: mockGetApp,
50
+ context: {
51
+ api: mockApiClient,
52
+ getVersionedImplementationId: () => "SlackCLIAPI@1.21.1",
53
+ eventEmission: {
54
+ emitMethodCalled: vi.fn(),
55
+ },
56
+ },
57
+ }))
58
+ .addPlugin(runActionPlugin);
47
59
  }
48
60
  describe("schema validation", () => {
49
61
  it("should throw validation error for missing appKey", () => {
@@ -97,11 +109,11 @@ describe("runAction plugin", () => {
97
109
  actionKey: "send_message",
98
110
  inputs: { message: "Hello" },
99
111
  });
100
- expect(mockGetAction).toHaveBeenCalledWith({
112
+ expect(mockGetAction).toHaveBeenCalledWith(expect.objectContaining({
101
113
  appKey: "slack",
102
114
  actionKey: "send_message",
103
115
  actionType: "write",
104
- });
116
+ }));
105
117
  });
106
118
  it("should throw error when action type doesn't match", async () => {
107
119
  // Mock getAction to return an action with different type
@@ -18,18 +18,18 @@ export declare const RunActionSchema: z.ZodObject<{
18
18
  actionType: "search" | "filter" | "read" | "read_bulk" | "run" | "search_and_write" | "search_or_write" | "write";
19
19
  authenticationId?: number | null | undefined;
20
20
  inputs?: Record<string, unknown> | undefined;
21
- pageSize?: number | undefined;
22
- maxItems?: number | undefined;
23
21
  cursor?: string | undefined;
22
+ maxItems?: number | undefined;
23
+ pageSize?: number | undefined;
24
24
  }, {
25
25
  appKey: string;
26
26
  actionKey: string;
27
27
  actionType: "search" | "filter" | "read" | "read_bulk" | "run" | "search_and_write" | "search_or_write" | "write";
28
28
  authenticationId?: number | null | undefined;
29
29
  inputs?: Record<string, unknown> | undefined;
30
- pageSize?: number | undefined;
31
- maxItems?: number | undefined;
32
30
  cursor?: string | undefined;
31
+ maxItems?: number | undefined;
32
+ pageSize?: number | undefined;
33
33
  }>;
34
34
  export type RunActionOptions = z.infer<typeof RunActionSchema>;
35
35
  export interface RunActionPage {
@@ -19,18 +19,32 @@ export declare const ListAppsOptionsSchema: z.ZodObject<{
19
19
  pageSize: z.ZodOptional<z.ZodNumber>;
20
20
  maxItems: z.ZodOptional<z.ZodNumber>;
21
21
  cursor: z.ZodOptional<z.ZodString>;
22
+ } & {
23
+ _telemetry: z.ZodOptional<z.ZodObject<{
24
+ isNested: z.ZodOptional<z.ZodBoolean>;
25
+ }, "strip", z.ZodTypeAny, {
26
+ isNested?: boolean | undefined;
27
+ }, {
28
+ isNested?: boolean | undefined;
29
+ }>>;
22
30
  }, "strip", z.ZodTypeAny, {
23
31
  search?: string | undefined;
24
32
  appKeys?: string[] | undefined;
25
- pageSize?: number | undefined;
26
- maxItems?: number | undefined;
27
33
  cursor?: string | undefined;
34
+ maxItems?: number | undefined;
35
+ pageSize?: number | undefined;
36
+ _telemetry?: {
37
+ isNested?: boolean | undefined;
38
+ } | undefined;
28
39
  }, {
29
40
  search?: string | undefined;
30
41
  appKeys?: string[] | undefined;
31
- pageSize?: number | undefined;
32
- maxItems?: number | undefined;
33
42
  cursor?: string | undefined;
43
+ maxItems?: number | undefined;
44
+ pageSize?: number | undefined;
45
+ _telemetry?: {
46
+ isNested?: boolean | undefined;
47
+ } | undefined;
34
48
  }>;
35
49
  export type ListAppsOptions = z.infer<typeof ListAppsOptionsSchema>;
36
50
  /**
@@ -559,13 +573,13 @@ export declare const ListAppsHandlerRequestSchema: z.ZodEffects<z.ZodObject<{
559
573
  cursor: z.ZodOptional<z.ZodString>;
560
574
  }, "strip", z.ZodTypeAny, {
561
575
  search?: string | undefined;
562
- pageSize?: string | number | undefined;
563
576
  cursor?: string | undefined;
577
+ pageSize?: string | number | undefined;
564
578
  implementationIds?: string | string[] | undefined;
565
579
  }, {
566
580
  search?: string | undefined;
567
- pageSize?: string | number | undefined;
568
581
  cursor?: string | undefined;
582
+ pageSize?: string | number | undefined;
569
583
  implementationIds?: string | string[] | undefined;
570
584
  }>, {
571
585
  implementationIds: string[];
@@ -574,8 +588,8 @@ export declare const ListAppsHandlerRequestSchema: z.ZodEffects<z.ZodObject<{
574
588
  cursor: string | undefined;
575
589
  }, {
576
590
  search?: string | undefined;
577
- pageSize?: string | number | undefined;
578
591
  cursor?: string | undefined;
592
+ pageSize?: string | number | undefined;
579
593
  implementationIds?: string | string[] | undefined;
580
594
  }>;
581
595
  export type ListAppsHandlerRequest = z.infer<typeof ListAppsHandlerRequestSchema>;
@@ -1 +1 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