@zapier/zapier-sdk 0.13.2 → 0.13.4

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 (86) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/dist/api/debug.d.ts.map +1 -1
  3. package/dist/api/debug.js +36 -1
  4. package/dist/api/schemas.d.ts +174 -174
  5. package/dist/constants.d.ts +4 -0
  6. package/dist/constants.d.ts.map +1 -1
  7. package/dist/constants.js +4 -0
  8. package/dist/index.cjs +475 -9
  9. package/dist/index.d.mts +381 -157
  10. package/dist/index.d.ts +3 -0
  11. package/dist/index.d.ts.map +1 -1
  12. package/dist/index.js +1 -0
  13. package/dist/index.mjs +446 -13
  14. package/dist/plugins/api/index.d.ts +1 -3
  15. package/dist/plugins/api/index.d.ts.map +1 -1
  16. package/dist/plugins/eventEmission/builders.d.ts +13 -0
  17. package/dist/plugins/eventEmission/builders.d.ts.map +1 -0
  18. package/dist/plugins/eventEmission/builders.js +78 -0
  19. package/dist/plugins/eventEmission/index.d.ts +34 -0
  20. package/dist/plugins/eventEmission/index.d.ts.map +1 -0
  21. package/dist/plugins/eventEmission/index.js +216 -0
  22. package/dist/plugins/eventEmission/index.test.d.ts +5 -0
  23. package/dist/plugins/eventEmission/index.test.d.ts.map +1 -0
  24. package/dist/plugins/eventEmission/index.test.js +143 -0
  25. package/dist/plugins/eventEmission/transport.d.ts +37 -0
  26. package/dist/plugins/eventEmission/transport.d.ts.map +1 -0
  27. package/dist/plugins/eventEmission/transport.js +96 -0
  28. package/dist/plugins/eventEmission/transport.test.d.ts +5 -0
  29. package/dist/plugins/eventEmission/transport.test.d.ts.map +1 -0
  30. package/dist/plugins/eventEmission/transport.test.js +153 -0
  31. package/dist/plugins/eventEmission/types.d.ts +53 -0
  32. package/dist/plugins/eventEmission/types.d.ts.map +1 -0
  33. package/dist/plugins/eventEmission/types.js +1 -0
  34. package/dist/plugins/eventEmission/utils.d.ts +45 -0
  35. package/dist/plugins/eventEmission/utils.d.ts.map +1 -0
  36. package/dist/plugins/eventEmission/utils.js +114 -0
  37. package/dist/plugins/fetch/schemas.d.ts +4 -4
  38. package/dist/plugins/getAction/index.d.ts.map +1 -1
  39. package/dist/plugins/getAction/index.js +3 -2
  40. package/dist/plugins/getAction/schemas.d.ts +2 -2
  41. package/dist/plugins/listActions/schemas.d.ts +2 -2
  42. package/dist/plugins/listInputFieldChoices/schemas.d.ts +4 -4
  43. package/dist/plugins/listInputFields/index.d.ts +2 -1
  44. package/dist/plugins/listInputFields/index.d.ts.map +1 -1
  45. package/dist/plugins/listInputFields/index.js +7 -2
  46. package/dist/plugins/listInputFields/index.test.js +36 -5
  47. package/dist/plugins/listInputFields/schemas.d.ts +2 -2
  48. package/dist/plugins/request/schemas.d.ts +4 -4
  49. package/dist/plugins/runAction/index.d.ts.map +1 -1
  50. package/dist/plugins/runAction/index.js +6 -1
  51. package/dist/plugins/runAction/schemas.d.ts +2 -2
  52. package/dist/resolvers/actionType.d.ts.map +1 -1
  53. package/dist/resolvers/actionType.js +2 -3
  54. package/dist/resolvers/authenticationId.d.ts.map +1 -1
  55. package/dist/schemas/Action.d.ts +2 -2
  56. package/dist/schemas/App.d.ts +30 -30
  57. package/dist/sdk.d.ts +2 -2
  58. package/dist/sdk.d.ts.map +1 -1
  59. package/dist/sdk.js +4 -1
  60. package/dist/types/sdk.d.ts +5 -1
  61. package/dist/types/sdk.d.ts.map +1 -1
  62. package/dist/types/telemetry-events.d.ts +76 -0
  63. package/dist/types/telemetry-events.d.ts.map +1 -0
  64. package/dist/types/telemetry-events.js +8 -0
  65. package/package.json +1 -1
  66. package/src/api/debug.ts +44 -1
  67. package/src/constants.ts +6 -0
  68. package/src/index.ts +24 -0
  69. package/src/plugins/api/index.ts +1 -5
  70. package/src/plugins/eventEmission/builders.ts +115 -0
  71. package/src/plugins/eventEmission/index.test.ts +169 -0
  72. package/src/plugins/eventEmission/index.ts +294 -0
  73. package/src/plugins/eventEmission/transport.test.ts +214 -0
  74. package/src/plugins/eventEmission/transport.ts +135 -0
  75. package/src/plugins/eventEmission/types.ts +58 -0
  76. package/src/plugins/eventEmission/utils.ts +121 -0
  77. package/src/plugins/getAction/index.ts +5 -2
  78. package/src/plugins/listInputFields/index.test.ts +37 -5
  79. package/src/plugins/listInputFields/index.ts +10 -3
  80. package/src/plugins/runAction/index.ts +9 -0
  81. package/src/resolvers/actionType.ts +4 -3
  82. package/src/resolvers/authenticationId.ts +2 -1
  83. package/src/sdk.ts +5 -1
  84. package/src/types/sdk.ts +7 -1
  85. package/src/types/telemetry-events.ts +85 -0
  86. package/tsconfig.tsbuildinfo +1 -1
@@ -12,7 +12,7 @@ export declare const RelayRequestSchema: z.ZodObject<{
12
12
  relayBaseUrl: z.ZodOptional<z.ZodString>;
13
13
  }, "strip", z.ZodTypeAny, {
14
14
  url: string;
15
- method?: "GET" | "POST" | "PUT" | "DELETE" | "PATCH" | "HEAD" | "OPTIONS" | undefined;
15
+ method?: "POST" | "GET" | "PUT" | "DELETE" | "PATCH" | "HEAD" | "OPTIONS" | undefined;
16
16
  authenticationId?: number | undefined;
17
17
  body?: any;
18
18
  callbackUrl?: string | undefined;
@@ -21,7 +21,7 @@ export declare const RelayRequestSchema: z.ZodObject<{
21
21
  relayBaseUrl?: string | undefined;
22
22
  }, {
23
23
  url: string;
24
- method?: "GET" | "POST" | "PUT" | "DELETE" | "PATCH" | "HEAD" | "OPTIONS" | undefined;
24
+ method?: "POST" | "GET" | "PUT" | "DELETE" | "PATCH" | "HEAD" | "OPTIONS" | undefined;
25
25
  authenticationId?: number | undefined;
26
26
  body?: any;
27
27
  callbackUrl?: string | undefined;
@@ -46,7 +46,7 @@ export declare const RelayFetchSchema: z.ZodObject<{
46
46
  relayBaseUrl: z.ZodOptional<z.ZodString>;
47
47
  }, "strip", z.ZodTypeAny, {
48
48
  url: string;
49
- method?: "GET" | "POST" | "PUT" | "DELETE" | "PATCH" | "HEAD" | "OPTIONS" | undefined;
49
+ method?: "POST" | "GET" | "PUT" | "DELETE" | "PATCH" | "HEAD" | "OPTIONS" | undefined;
50
50
  authenticationId?: number | undefined;
51
51
  body?: any;
52
52
  callbackUrl?: string | undefined;
@@ -55,7 +55,7 @@ export declare const RelayFetchSchema: z.ZodObject<{
55
55
  relayBaseUrl?: string | undefined;
56
56
  }, {
57
57
  url: string;
58
- method?: "GET" | "POST" | "PUT" | "DELETE" | "PATCH" | "HEAD" | "OPTIONS" | undefined;
58
+ method?: "POST" | "GET" | "PUT" | "DELETE" | "PATCH" | "HEAD" | "OPTIONS" | undefined;
59
59
  authenticationId?: number | undefined;
60
60
  body?: any;
61
61
  callbackUrl?: string | undefined;
@@ -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,uBAAuB,EAAE,MAAM,cAAc,CAAC;AAC5D,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,WAAW,CAAC;AAQtD,OAAO,KAAK,EAAE,4BAA4B,EAAE,MAAM,qBAAqB,CAAC;AAExE,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,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ACH,CAAC;KACH,CAAC;CACH;AAgFD,eAAO,MAAM,eAAe,EAAE,MAAM,CAClC,UAAU,CAAC,uBAAuB,GAAG,oBAAoB,CAAC,EAAE,uCAAuC;AACnG;IACE,GAAG,EAAE,SAAS,CAAC;IACf,4BAA4B,EAAE,4BAA4B,CAAC;CAC5D,EAAE,0BAA0B;AAC7B,uBAAuB,CAwFxB,CAAC"}
@@ -4,7 +4,7 @@ import { ZapierValidationError, ZapierConfigurationError, ZapierActionError, } f
4
4
  import { createPaginatedFunction } from "../../utils/function-utils";
5
5
  import { appKeyResolver, actionTypeResolver, actionKeyResolver, authenticationIdResolver, inputsResolver, } from "../../resolvers";
6
6
  async function executeAction(actionOptions) {
7
- const { api, context, appKey, actionKey, actionType, executionOptions, authenticationId, } = actionOptions;
7
+ const { api, context, appKey, actionId, actionKey, actionType, executionOptions, authenticationId, } = actionOptions;
8
8
  // Use the manifest plugin to get the current implementation ID
9
9
  const selectedApi = await context.getVersionedImplementationId(appKey);
10
10
  if (!selectedApi) {
@@ -13,6 +13,7 @@ async function executeAction(actionOptions) {
13
13
  // Step 1: POST to /actions/v1/runs to start execution
14
14
  const runRequestData = {
15
15
  selected_api: selectedApi,
16
+ action_id: actionId,
16
17
  action_key: actionKey,
17
18
  action_type: actionType,
18
19
  inputs: executionOptions.inputs || {},
@@ -47,11 +48,15 @@ export const runActionPlugin = ({ sdk, context }) => {
47
48
  if (actionData.data.action_type !== actionType) {
48
49
  throw new ZapierValidationError(`Action type mismatch: expected ${actionType}, got ${actionData.data.action_type}`);
49
50
  }
51
+ const actionId = actionData.data.id;
50
52
  // Execute the action using the Actions API (supports all action types)
51
53
  const result = await executeAction({
52
54
  api,
53
55
  context,
54
56
  appKey,
57
+ // Some actions require the action ID to run them, but technically the ID is not guaranteed to be available when
58
+ // we retrieve actions (probably legacy reasons), so we just pass along all the things!
59
+ actionId,
55
60
  actionKey,
56
61
  actionType,
57
62
  executionOptions: { inputs },
@@ -14,7 +14,7 @@ export declare const RunActionSchema: z.ZodObject<{
14
14
  cursor: z.ZodOptional<z.ZodString>;
15
15
  }, "strip", z.ZodTypeAny, {
16
16
  appKey: string;
17
- actionType: "filter" | "read" | "read_bulk" | "write" | "run" | "search" | "search_or_write" | "search_and_write";
17
+ actionType: "search" | "filter" | "read" | "read_bulk" | "write" | "run" | "search_or_write" | "search_and_write";
18
18
  actionKey: string;
19
19
  authenticationId?: number | null | undefined;
20
20
  inputs?: Record<string, unknown> | undefined;
@@ -23,7 +23,7 @@ export declare const RunActionSchema: z.ZodObject<{
23
23
  cursor?: string | undefined;
24
24
  }, {
25
25
  appKey: string;
26
- actionType: "filter" | "read" | "read_bulk" | "write" | "run" | "search" | "search_or_write" | "search_and_write";
26
+ actionType: "search" | "filter" | "read" | "read_bulk" | "write" | "run" | "search_or_write" | "search_and_write";
27
27
  actionKey: string;
28
28
  authenticationId?: number | null | undefined;
29
29
  inputs?: Record<string, unknown> | undefined;
@@ -1 +1 @@
1
- {"version":3,"file":"actionType.d.ts","sourceRoot":"","sources":["../../src/resolvers/actionType.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAE7D,UAAU,cAAc;IACtB,GAAG,EAAE,MAAM,CAAC;IACZ,IAAI,EAAE,MAAM,CAAC;CACd;AAED,eAAO,MAAM,kBAAkB,EAAE,eAAe,CAC9C,cAAc,EACd;IAAE,MAAM,EAAE,MAAM,CAAA;CAAE,CAuBnB,CAAC"}
1
+ {"version":3,"file":"actionType.d.ts","sourceRoot":"","sources":["../../src/resolvers/actionType.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAE7D,UAAU,cAAc;IACtB,GAAG,EAAE,MAAM,CAAC;IACZ,IAAI,EAAE,MAAM,CAAC;CACd;AAED,eAAO,MAAM,kBAAkB,EAAE,eAAe,CAC9C,cAAc,EACd;IAAE,MAAM,EAAE,MAAM,CAAA;CAAE,CAwBnB,CAAC"}
@@ -5,9 +5,8 @@ export const actionTypeResolver = {
5
5
  const actionsResponse = await sdk.listActions({
6
6
  appKey: resolvedParams.appKey,
7
7
  });
8
- const types = [
9
- ...new Set(actionsResponse.data.map((action) => action.action_type)),
10
- ];
8
+ const actionTypes = actionsResponse.data.map((action) => action.action_type);
9
+ const types = [...new Set(actionTypes)];
11
10
  return types.map((type) => ({ key: type, name: type }));
12
11
  },
13
12
  prompt: (types) => ({
@@ -1 +1 @@
1
- {"version":3,"file":"authenticationId.d.ts","sourceRoot":"","sources":["../../src/resolvers/authenticationId.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAC7D,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAEhD,KAAK,wBAAwB,GAAG,eAAe,CAAC,QAAQ,EAAE;IAAE,MAAM,CAAC,EAAE,MAAM,CAAA;CAAE,CAAC,CAAC;AAE/E,eAAO,MAAM,wBAAwB,EAAE,wBAyCtC,CAAC;AAGF,eAAO,MAAM,+BAA+B,EAAE,wBAG7C,CAAC"}
1
+ {"version":3,"file":"authenticationId.d.ts","sourceRoot":"","sources":["../../src/resolvers/authenticationId.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAC7D,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAEhD,KAAK,wBAAwB,GAAG,eAAe,CAAC,QAAQ,EAAE;IAAE,MAAM,CAAC,EAAE,MAAM,CAAA;CAAE,CAAC,CAAC;AAE/E,eAAO,MAAM,wBAAwB,EAAE,wBA0CtC,CAAC;AAGF,eAAO,MAAM,+BAA+B,EAAE,wBAG7C,CAAC"}
@@ -20,7 +20,7 @@ export declare const ActionItemSchema: z.ZodObject<Omit<{
20
20
  description: string;
21
21
  title: string;
22
22
  app_key: string;
23
- action_type: "filter" | "read" | "read_bulk" | "write" | "run" | "search" | "search_or_write" | "search_and_write";
23
+ action_type: "search" | "filter" | "read" | "read_bulk" | "write" | "run" | "search_or_write" | "search_and_write";
24
24
  id?: string | undefined;
25
25
  is_important?: boolean | undefined;
26
26
  is_hidden?: boolean | undefined;
@@ -31,7 +31,7 @@ export declare const ActionItemSchema: z.ZodObject<Omit<{
31
31
  description: string;
32
32
  title: string;
33
33
  app_key: string;
34
- action_type: "filter" | "read" | "read_bulk" | "write" | "run" | "search" | "search_or_write" | "search_and_write";
34
+ action_type: "search" | "filter" | "read" | "read_bulk" | "write" | "run" | "search_or_write" | "search_and_write";
35
35
  id?: string | undefined;
36
36
  is_important?: boolean | undefined;
37
37
  is_hidden?: boolean | undefined;
@@ -63,19 +63,19 @@ export declare const AppItemSchema: z.ZodObject<Omit<{
63
63
  search_and_write: z.ZodOptional<z.ZodNumber>;
64
64
  filter: z.ZodOptional<z.ZodNumber>;
65
65
  }, "strip", z.ZodTypeAny, {
66
+ search?: number | undefined;
66
67
  filter?: number | undefined;
67
68
  read?: number | undefined;
68
69
  read_bulk?: number | undefined;
69
70
  write?: number | undefined;
70
- search?: number | undefined;
71
71
  search_or_write?: number | undefined;
72
72
  search_and_write?: number | undefined;
73
73
  }, {
74
+ search?: number | undefined;
74
75
  filter?: number | undefined;
75
76
  read?: number | undefined;
76
77
  read_bulk?: number | undefined;
77
78
  write?: number | undefined;
78
- search?: number | undefined;
79
79
  search_or_write?: number | undefined;
80
80
  search_and_write?: number | undefined;
81
81
  }>>;
@@ -94,16 +94,25 @@ export declare const AppItemSchema: z.ZodObject<Omit<{
94
94
  title: string;
95
95
  slug: string;
96
96
  implementation_id: string;
97
- description?: string | undefined;
98
- is_hidden?: boolean | undefined;
99
- age_in_days?: number | undefined;
100
- api_docs_url?: string | undefined;
101
- banner?: string | undefined;
102
97
  categories?: {
103
98
  id: number;
104
99
  name: string;
105
100
  slug: string;
106
101
  }[] | undefined;
102
+ actions?: {
103
+ search?: number | undefined;
104
+ filter?: number | undefined;
105
+ read?: number | undefined;
106
+ read_bulk?: number | undefined;
107
+ write?: number | undefined;
108
+ search_or_write?: number | undefined;
109
+ search_and_write?: number | undefined;
110
+ } | undefined;
111
+ description?: string | undefined;
112
+ is_hidden?: boolean | undefined;
113
+ age_in_days?: number | undefined;
114
+ api_docs_url?: string | undefined;
115
+ banner?: string | undefined;
107
116
  image?: string | undefined;
108
117
  images?: {
109
118
  url_16x16?: string | undefined;
@@ -120,15 +129,6 @@ export declare const AppItemSchema: z.ZodObject<Omit<{
120
129
  popularity?: number | undefined;
121
130
  primary_color?: string | undefined;
122
131
  auth_type?: string | undefined;
123
- actions?: {
124
- filter?: number | undefined;
125
- read?: number | undefined;
126
- read_bulk?: number | undefined;
127
- write?: number | undefined;
128
- search?: number | undefined;
129
- search_or_write?: number | undefined;
130
- search_and_write?: number | undefined;
131
- } | undefined;
132
132
  is_deprecated?: boolean | undefined;
133
133
  secondary_color?: string | undefined;
134
134
  has_filters?: boolean | undefined;
@@ -146,16 +146,25 @@ export declare const AppItemSchema: z.ZodObject<Omit<{
146
146
  title: string;
147
147
  slug: string;
148
148
  implementation_id: string;
149
- description?: string | undefined;
150
- is_hidden?: boolean | undefined;
151
- age_in_days?: number | undefined;
152
- api_docs_url?: string | undefined;
153
- banner?: string | undefined;
154
149
  categories?: {
155
150
  id: number;
156
151
  name: string;
157
152
  slug: string;
158
153
  }[] | undefined;
154
+ actions?: {
155
+ search?: number | undefined;
156
+ filter?: number | undefined;
157
+ read?: number | undefined;
158
+ read_bulk?: number | undefined;
159
+ write?: number | undefined;
160
+ search_or_write?: number | undefined;
161
+ search_and_write?: number | undefined;
162
+ } | undefined;
163
+ description?: string | undefined;
164
+ is_hidden?: boolean | undefined;
165
+ age_in_days?: number | undefined;
166
+ api_docs_url?: string | undefined;
167
+ banner?: string | undefined;
159
168
  image?: string | undefined;
160
169
  images?: {
161
170
  url_16x16?: string | undefined;
@@ -172,15 +181,6 @@ export declare const AppItemSchema: z.ZodObject<Omit<{
172
181
  popularity?: number | undefined;
173
182
  primary_color?: string | undefined;
174
183
  auth_type?: string | undefined;
175
- actions?: {
176
- filter?: number | undefined;
177
- read?: number | undefined;
178
- read_bulk?: number | undefined;
179
- write?: number | undefined;
180
- search?: number | undefined;
181
- search_or_write?: number | undefined;
182
- search_and_write?: number | undefined;
183
- } | undefined;
184
184
  is_deprecated?: boolean | undefined;
185
185
  secondary_color?: string | undefined;
186
186
  has_filters?: boolean | undefined;
package/dist/sdk.d.ts CHANGED
@@ -13,9 +13,9 @@ export declare function createSdk<TCurrentSdk = {}, TCurrentContext extends {
13
13
  getContext(): TCurrentContext;
14
14
  }, TRequiresContext, TProvides>, addPluginOptions?: Record<string, unknown>): Sdk<TCurrentSdk & ExtractSdkProperties<TProvides>, TCurrentContext & NonNullable<ExtractContextProperties<TProvides>>>;
15
15
  };
16
- export declare function createZapierSdkWithoutRegistry(options?: ZapierSdkOptions): Sdk<ExtractSdkProperties<import(".").ApiPluginProvides> & ExtractSdkProperties<import(".").ManifestPluginProvides> & ExtractSdkProperties<import(".").ListAppsPluginProvides> & ExtractSdkProperties<import(".").GetAppPluginProvides> & ExtractSdkProperties<import(".").ListActionsPluginProvides> & ExtractSdkProperties<import(".").GetActionPluginProvides> & ExtractSdkProperties<import(".").ListInputFieldsPluginProvides> & ExtractSdkProperties<import("./plugins/listInputFieldChoices").ListInputFieldChoicesPluginProvides> & ExtractSdkProperties<import(".").RunActionPluginProvides> & ExtractSdkProperties<import(".").ListAuthenticationsPluginProvides> & ExtractSdkProperties<import(".").GetAuthenticationPluginProvides> & ExtractSdkProperties<import(".").FindFirstAuthenticationPluginProvides> & ExtractSdkProperties<import(".").FindUniqueAuthenticationPluginProvides> & ExtractSdkProperties<import(".").RequestPluginProvides> & ExtractSdkProperties<import(".").FetchPluginProvides> & ExtractSdkProperties<import(".").AppsPluginProvides> & ExtractSdkProperties<import(".").GetProfilePluginProvides>, {
16
+ export declare function createZapierSdkWithoutRegistry(options?: ZapierSdkOptions): Sdk<ExtractSdkProperties<import("./plugins/eventEmission").EventEmissionProvides> & ExtractSdkProperties<import(".").ApiPluginProvides> & ExtractSdkProperties<import(".").ManifestPluginProvides> & ExtractSdkProperties<import(".").ListAppsPluginProvides> & ExtractSdkProperties<import(".").GetAppPluginProvides> & ExtractSdkProperties<import(".").ListActionsPluginProvides> & ExtractSdkProperties<import(".").GetActionPluginProvides> & ExtractSdkProperties<import(".").ListInputFieldsPluginProvides> & ExtractSdkProperties<import("./plugins/listInputFieldChoices").ListInputFieldChoicesPluginProvides> & ExtractSdkProperties<import(".").RunActionPluginProvides> & ExtractSdkProperties<import(".").ListAuthenticationsPluginProvides> & ExtractSdkProperties<import(".").GetAuthenticationPluginProvides> & ExtractSdkProperties<import(".").FindFirstAuthenticationPluginProvides> & ExtractSdkProperties<import(".").FindUniqueAuthenticationPluginProvides> & ExtractSdkProperties<import(".").RequestPluginProvides> & ExtractSdkProperties<import(".").FetchPluginProvides> & ExtractSdkProperties<import(".").AppsPluginProvides> & ExtractSdkProperties<import(".").GetProfilePluginProvides>, {
17
17
  meta: Record<string, PluginMeta>;
18
- } & {
18
+ } & import(".").EventEmissionContext & {
19
19
  api: import("./api").ApiClient;
20
20
  } & {
21
21
  getVersionedImplementationId: import("./plugins/manifest/schemas").GetVersionedImplementationId;
package/dist/sdk.d.ts.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"sdk.d.ts","sourceRoot":"","sources":["../src/sdk.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAMlD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAC7C,OAAO,KAAK,EACV,GAAG,EACH,MAAM,EACN,wBAAwB,EACxB,oBAAoB,EACpB,cAAc,EACd,UAAU,EACX,MAAM,gBAAgB,CAAC;AAyBxB,MAAM,WAAW,gBAAiB,SAAQ,cAAc;CAAG;AAG3D,wBAAgB,SAAS,CACvB,WAAW,GAAG,EAAE,EAChB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E,EAChB,eAAe,SAAS;IAAE,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,UAAU,CAAC,CAAA;CAAE,GAAG;IAC7D,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,UAAU,CAAC,CAAC;CAClC,EAED,OAAO,GAAE,gBAAqB,EAC9B,UAAU,GAAE,WAA+B,EAC3C,cAAc,GAAE,eAAiD;;cAKrD,gBAAgB,EAAE,SAAS,SAAS,cAAc,UAClD,MAAM,CACZ,WAAW,GAAG;QAAE,UAAU,IAAI,eAAe,CAAA;KAAE,EAC/C,gBAAgB,EAChB,SAAS,CACV,qBACiB,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GACxC,GAAG,CACJ,WAAW,GAAG,oBAAoB,CAAC,SAAS,CAAC,EAC7C,eAAe,GAAG,WAAW,CAAC,wBAAwB,CAAC,SAAS,CAAC,CAAC,CACnE;EA8DJ;AAED,wBAAgB,8BAA8B,CAAC,OAAO,GAAE,gBAAqB;UApFnE,MAAM,CAAC,MAAM,EAAE,UAAU,CAAC;;;;;;+GAhB2B,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2I/D;AAED,wBAAgB,eAAe,CAAC,OAAO,GAAE,gBAAqB,GAAG,SAAS,CAMzE"}
package/dist/sdk.js CHANGED
@@ -17,6 +17,7 @@ import { listInputFieldsPlugin } from "./plugins/listInputFields";
17
17
  import { listInputFieldChoicesPlugin } from "./plugins/listInputFieldChoices";
18
18
  import { requestPlugin } from "./plugins/request";
19
19
  import { manifestPlugin } from "./plugins/manifest";
20
+ import { eventEmissionPlugin } from "./plugins/eventEmission";
20
21
  // Create SDK that supports flat plugins - returns an SDK, not a builder
21
22
  export function createSdk(options = {}, initialSdk = {}, initialContext = { meta: {} }) {
22
23
  return {
@@ -74,9 +75,11 @@ export function createSdk(options = {}, initialSdk = {}, initialContext = { meta
74
75
  }
75
76
  export function createZapierSdkWithoutRegistry(options = {}) {
76
77
  return (createSdk(options)
78
+ // Event emission (must be first to be available to other plugins)
79
+ .addPlugin(eventEmissionPlugin)
77
80
  // Provides the API client in context
78
81
  .addPlugin(apiPlugin)
79
- // Manifest plugin (provides version locking context)
82
+ // Manifest plugin (provides version locking context) - must come after apiPlugin
80
83
  .addPlugin(manifestPlugin)
81
84
  // Apps/actions/fields
82
85
  .addPlugin(listAppsPlugin)
@@ -2,6 +2,7 @@
2
2
  * SDK-related types and interfaces
3
3
  */
4
4
  import type { EventCallback } from "./events";
5
+ import type { EventEmissionConfig } from "../plugins/eventEmission";
5
6
  export interface BaseSdkOptions {
6
7
  token?: string;
7
8
  getToken?: () => Promise<string | undefined>;
@@ -18,6 +19,7 @@ export interface BaseSdkOptions {
18
19
  };
19
20
  };
20
21
  };
22
+ eventEmission?: EventEmissionConfig;
21
23
  }
22
24
  import type { ListInputFieldsSdkFunction } from "../plugins/listInputFields/schemas";
23
25
  import type { GetAuthenticationSdkFunction } from "../plugins/getAuthentication/schemas";
@@ -27,6 +29,8 @@ import type { RelayRequestSdkFunction } from "../plugins/request/schemas";
27
29
  import type { z } from "zod";
28
30
  import type { RegistryPluginProvides } from "../plugins/registry";
29
31
  import type { GetProfilePluginProvides } from "../plugins/getProfile";
32
+ import type { EventEmissionProvides } from "../plugins/eventEmission";
33
+ import type { ApiPluginProvides } from "../plugins/api";
30
34
  import type { AppsPluginProvides, ZapierSdkApps } from "../plugins/apps";
31
35
  import type { ActionProxy } from "../plugins/apps/schemas";
32
36
  import type { FetchPluginProvides } from "../plugins/fetch";
@@ -61,7 +65,7 @@ export interface FunctionRegistryEntry {
61
65
  }
62
66
  export interface ZapierSdkFunctions extends ListInputFieldsSdkFunction, GetAuthenticationSdkFunction, FindFirstAuthenticationSdkFunction, FindUniqueAuthenticationSdkFunction, RelayRequestSdkFunction {
63
67
  }
64
- export interface ZapierSdk extends GetSdkType<RegistryPluginProvides & FetchPluginProvides & AppsPluginProvides & ListAppsPluginProvides & ManifestPluginProvides & GetAppPluginProvides & ListActionsPluginProvides & GetActionPluginProvides & RunActionPluginProvides & ListAuthenticationsPluginProvides & GetAuthenticationPluginProvides & FindFirstAuthenticationPluginProvides & FindUniqueAuthenticationPluginProvides & ListInputFieldsPluginProvides & ListInputFieldChoicesPluginProvides & RequestPluginProvides & GetProfilePluginProvides> {
68
+ export interface ZapierSdk extends GetSdkType<RegistryPluginProvides & FetchPluginProvides & AppsPluginProvides & ListAppsPluginProvides & ManifestPluginProvides & GetAppPluginProvides & ListActionsPluginProvides & GetActionPluginProvides & RunActionPluginProvides & ListAuthenticationsPluginProvides & GetAuthenticationPluginProvides & FindFirstAuthenticationPluginProvides & FindUniqueAuthenticationPluginProvides & ListInputFieldsPluginProvides & ListInputFieldChoicesPluginProvides & RequestPluginProvides & GetProfilePluginProvides & EventEmissionProvides & ApiPluginProvides> {
65
69
  apps: ActionProxy & ZapierSdkApps;
66
70
  }
67
71
  //# sourceMappingURL=sdk.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"sdk.d.ts","sourceRoot":"","sources":["../../src/types/sdk.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAG9C,MAAM,WAAW,cAAc;IAC7B,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,MAAM,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC,CAAC;IAC7C,OAAO,CAAC,EAAE,aAAa,CAAC;IACxB,KAAK,CAAC,EAAE,OAAO,KAAK,CAAC;IACrB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,EAAE;QACT,IAAI,EAAE;YACJ,CAAC,MAAM,EAAE,MAAM,GAAG;gBAChB,kBAAkB,EAAE,MAAM,CAAC;gBAC3B,OAA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IACpC,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IACvB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,WAAW,CAAC,EAAE,CAAC,CAAC,SAAS,CAAC;IAC1B,eAAe,CAAC,EAAE,KAAK,CAAC;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,CAAC,CAAC,SAAS,CAAA;KAAE,CAAC,CAAC;IAC/D,YAAY,CAAC,EAAE,CAAC,CAAC,SAAS,CAAC;IAC3B,UAAU,EAAE,MAAM,EAAE,CAAC;IACrB,SAAS,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;IAChC,QAAQ,CAAC,EAAE,MAAM,EAAE,CAAC;CACrB;AAGD,MAAM,WAAW,kBACf,SAAQ,0BAA0B,EAChC,4BAA4B,EAC5B,kCAAkC,EAClC,mCAAmC,EACnC,uBAAuB;CAE1B;AAUD,MAAM,WAAW,SACf,SAAQ,UAAU,CAChB,sBAAsB,GACpB,mBAAmB,GACnB,kBAAkB,GAClB,sBAAsB,GACtB,sBAAsB,GACtB,oBAAoB,GACpB,yBAAyB,GACzB,uBAAuB,GACvB,uBAAuB,GACvB,iCAAiC,GACjC,+BAA+B,GAC/B,qCAAqC,GACrC,sCAAsC,GACtC,6BAA6B,GAC7B,mCAAmC,GACnC,qBAAqB,GACrB,wBAAwB,GACxB,qBAAqB,GACrB,iBAAiB,CACpB;IAED,IAAI,EAAE,WAAW,GAAG,aAAa,CAAC;CACnC"}
@@ -0,0 +1,76 @@
1
+ /**
2
+ * Event emission types matching Avro schemas for SDK telemetry
3
+ *
4
+ * These interfaces correspond to the Avro schemas:
5
+ * - application_lifecycle_event.avsc
6
+ * - error_occurred_event.avsc
7
+ */
8
+ export interface BaseEvent {
9
+ event_id: string;
10
+ timestamp_ms: number;
11
+ release_id: string;
12
+ customuser_id?: number | null;
13
+ account_id?: number | null;
14
+ identity_id?: number | null;
15
+ visitor_id?: string | null;
16
+ correlation_id?: string | null;
17
+ }
18
+ export interface ErrorOccurredEvent extends BaseEvent {
19
+ zap_id?: number | null;
20
+ node_id?: number | null;
21
+ selected_api?: string | null;
22
+ app_id?: number | null;
23
+ app_version_id?: number | null;
24
+ error_message: string;
25
+ error_type?: string | null;
26
+ error_status_code?: number | null;
27
+ error_stack_trace?: string | null;
28
+ error_source_method?: string | null;
29
+ error_source_file?: string | null;
30
+ error_line_number?: number | null;
31
+ operation_type?: string | null;
32
+ operation_key?: string | null;
33
+ error_severity?: string | null;
34
+ is_user_facing: boolean;
35
+ is_recoverable?: boolean | null;
36
+ sdk_version?: string | null;
37
+ error_metadata?: Record<string, string | null> | null;
38
+ parent_error_id?: string | null;
39
+ error_occurred_timestamp_ms?: number | null;
40
+ error_code?: string | null;
41
+ recovery_attempted?: boolean | null;
42
+ recovery_action?: string | null;
43
+ recovery_successful?: boolean | null;
44
+ environment?: string | null;
45
+ execution_time_before_error_ms?: number | null;
46
+ }
47
+ export interface ApplicationLifecycleEvent extends BaseEvent {
48
+ lifecycle_event_type: "startup" | "exit" | "signal_termination";
49
+ selected_api?: string | null;
50
+ app_id?: number | null;
51
+ app_version_id?: number | null;
52
+ sdk_version?: string | null;
53
+ cli_version?: string | null;
54
+ exit_code?: number | null;
55
+ signal_name?: string | null;
56
+ uptime_ms?: number | null;
57
+ memory_usage_bytes?: number | null;
58
+ peak_memory_usage_bytes?: number | null;
59
+ cpu_time_ms?: number | null;
60
+ os_platform?: string | null;
61
+ os_release?: string | null;
62
+ os_architecture?: string | null;
63
+ platform_versions?: Record<string, string | null> | null;
64
+ environment?: string | null;
65
+ is_ci_environment?: boolean | null;
66
+ ci_platform?: string | null;
67
+ session_id?: string | null;
68
+ metadata?: Record<string, string | null> | null;
69
+ process_argv?: (string | null)[] | null;
70
+ is_graceful_shutdown?: boolean | null;
71
+ shutdown_duration_ms?: number | null;
72
+ active_requests_count?: number | null;
73
+ }
74
+ export type TelemetryEvent = ErrorOccurredEvent | ApplicationLifecycleEvent;
75
+ export type TelemetryEventType = "error_occurred" | "application_lifecycle";
76
+ //# sourceMappingURL=telemetry-events.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"telemetry-events.d.ts","sourceRoot":"","sources":["../../src/types/telemetry-events.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAGH,MAAM,WAAW,SAAS;IACxB,QAAQ,EAAE,MAAM,CAAC;IACjB,YAAY,EAAE,MAAM,CAAC;IACrB,UAAU,EAAE,MAAM,CAAC;IACnB,aAAa,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC9B,UAAU,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC3B,WAAW,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC5B,UAAU,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC3B,cAAc,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CAChC;AAGD,MAAM,WAAW,kBAAmB,SAAQ,SAAS;IACnD,MAAM,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACvB,OAAO,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACxB,YAAY,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC7B,MAAM,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACvB,cAAc,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC/B,aAAa,EAAE,MAAM,CAAC;IACtB,UAAU,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC3B,iBAAiB,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAClC,iBAAiB,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAClC,mBAAmB,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACpC,iBAAiB,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAClC,iBAAiB,CAAC,EAAE,MAAM,GAAG,IAAI,C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AAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC1B,kBAAkB,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACnC,uBAAuB,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACxC,WAAW,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC5B,WAAW,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC5B,UAAU,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC3B,eAAe,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAChC,iBAAiB,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC,GAAG,IAAI,CAAC;IACzD,WAAW,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC5B,iBAAiB,CAAC,EAAE,OAAO,GAAG,IAAI,CAAC;IACnC,WAAW,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC5B,UAAU,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC3B,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC,GAAG,IAAI,CAAC;IAChD,YAAY,CAAC,EAAE,CAAC,MAAM,GAAG,IAAI,CAAC,EAAE,GAAG,IAAI,CAAC;IACxC,oBAAoB,CAAC,EAAE,OAAO,GAAG,IAAI,CAAC;IACtC,oBAAoB,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACrC,qBAAqB,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CACvC;AAGD,MAAM,MAAM,cAAc,GAAG,kBAAkB,GAAG,yBAAyB,CAAC;AAG5E,MAAM,MAAM,kBAAkB,GAAG,gBAAgB,GAAG,uBAAuB,CAAC"}
@@ -0,0 +1,8 @@
1
+ /**
2
+ * Event emission types matching Avro schemas for SDK telemetry
3
+ *
4
+ * These interfaces correspond to the Avro schemas:
5
+ * - application_lifecycle_event.avsc
6
+ * - error_occurred_event.avsc
7
+ */
8
+ export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zapier/zapier-sdk",
3
- "version": "0.13.2",
3
+ "version": "0.13.4",
4
4
  "description": "Complete Zapier SDK - combines all Zapier SDK packages",
5
5
  "main": "dist/index.cjs",
6
6
  "module": "dist/index.mjs",
package/src/api/debug.ts CHANGED
@@ -7,13 +7,56 @@
7
7
 
8
8
  import type { DebugLogger } from "./types";
9
9
 
10
+ import type { InspectOptions } from "util";
11
+
12
+ type UtilModule = {
13
+ inspect: (object: unknown, options?: InspectOptions) => string;
14
+ };
15
+
16
+ // We don't want to import util since it might not work in a browser. So we'll lazily load it and cache the result so
17
+ // we can use it synchronously after that. The types above are just to make our linter happy.
18
+ let utilModule: UtilModule | null = null;
19
+ let utilPromise: Promise<UtilModule | null> | null = null;
20
+
10
21
  export function createDebugLogger(enabled: boolean): DebugLogger {
11
22
  if (!enabled) {
12
23
  return () => {}; // No-op function when debug is disabled
13
24
  }
14
25
 
26
+ // Try to load util module on first use.
27
+ if (!utilPromise) {
28
+ utilPromise = import("util")
29
+ .then((util) => {
30
+ utilModule = util;
31
+ return util;
32
+ })
33
+ .catch(() => {
34
+ utilModule = null;
35
+ return null;
36
+ });
37
+ }
38
+
15
39
  return (message: string, data?: unknown) => {
16
- console.log(`[Zapier SDK] ${message}`, data || "");
40
+ if (data === undefined || data === "") {
41
+ console.log(`[Zapier SDK] ${message}`);
42
+ return;
43
+ }
44
+
45
+ // Use cached module if available for sync logging. Yes, this means if the util module isn't yet loaded, we'll fall
46
+ // back to a plain old console.log, which might mean we don't see proper formatting/nesting. But that's unlikely
47
+ // since this logging happens during async fetching. Alternatively, we could switch to async logging, but this
48
+ // seems fine since we have to have a fallback anyway.
49
+ if (utilModule) {
50
+ const formatted = utilModule.inspect(data, {
51
+ colors: true,
52
+ depth: null,
53
+ breakLength: 80,
54
+ });
55
+ console.log(`[Zapier SDK] ${message}`, formatted);
56
+ } else {
57
+ // Fallback - browser will handle formatting automatically
58
+ console.log(`[Zapier SDK] ${message}`, data);
59
+ }
17
60
  };
18
61
  }
19
62
 
package/src/constants.ts CHANGED
@@ -8,3 +8,9 @@
8
8
  * Maximum number of items that can be requested per page across all paginated functions
9
9
  */
10
10
  export const MAX_PAGE_LIMIT = 10000;
11
+
12
+ /**
13
+ * Default telemetry endpoint for the Tracking API
14
+ */
15
+ export const TRACKING_API_ENDPOINT =
16
+ "https://zapier.com/api/v4/tracking/event/";
package/src/index.ts CHANGED
@@ -85,3 +85,27 @@ export { registryPlugin } from "./plugins/registry";
85
85
 
86
86
  // Export ZapierSdk from sdk.ts (it's now ReturnType<typeof createZapierSdk>)
87
87
  export type { ZapierSdk } from "./types/sdk";
88
+
89
+ // Export event types and utilities for external packages
90
+ export type { BaseEvent } from "./types/telemetry-events";
91
+ export type {
92
+ EventEmissionContext,
93
+ EventContext,
94
+ ApplicationLifecycleEventData,
95
+ EnhancedErrorEventData,
96
+ } from "./plugins/eventEmission";
97
+ export {
98
+ generateEventId,
99
+ getCurrentTimestamp,
100
+ getReleaseId,
101
+ getOsInfo,
102
+ getPlatformVersions,
103
+ isCi,
104
+ getCiPlatform,
105
+ getMemoryUsage,
106
+ getCpuTime,
107
+ buildApplicationLifecycleEvent,
108
+ buildErrorEventWithContext,
109
+ buildErrorEvent,
110
+ createBaseEvent,
111
+ } from "./plugins/eventEmission";
@@ -13,11 +13,7 @@ export interface ApiPluginProvides {
13
13
  }
14
14
 
15
15
  // API plugin requires no context and provides api in context
16
- export const apiPlugin: Plugin<
17
- {}, // no SDK dependencies
18
- {}, // requires no context
19
- ApiPluginProvides
20
- > = (params) => {
16
+ export const apiPlugin: Plugin<{}, {}, ApiPluginProvides> = (params) => {
21
17
  // Extract all options - everything passed to the plugin
22
18
  const {
23
19
  fetch: customFetch = globalThis.fetch,