@zapier/zapier-sdk 0.5.0 → 0.5.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,19 @@
1
1
  # @zapier/zapier-sdk
2
2
 
3
+ ## 0.5.2
4
+
5
+ ### Patch Changes
6
+
7
+ - 218a3ca: reducing 'any' usage with minimal changes to runtime
8
+ - Updated dependencies [218a3ca]
9
+ - @zapier/zapier-sdk-cli-login@0.3.2
10
+
11
+ ## 0.5.1
12
+
13
+ ### Patch Changes
14
+
15
+ - c662f79: Add proper README with dynamically-listed methods
16
+
3
17
  ## 0.5.0
4
18
 
5
19
  ### Minor Changes
package/README.md ADDED
@@ -0,0 +1,343 @@
1
+ # @zapier/zapier-sdk
2
+
3
+ <!-- Generated API Reference -->
4
+
5
+ ## Table of Contents
6
+
7
+ - [Installation](#installation)
8
+ - [Quick Start](#quick-start)
9
+ - [Available Functions](#available-functions)
10
+ - [Actions](#actions)
11
+ - [`listActions`](#listactions)
12
+ - [`getAction`](#getaction)
13
+ - [`listInputFields`](#listinputfields)
14
+ - [`runAction`](#runaction)
15
+ - [Apps](#apps)
16
+ - [`listApps`](#listapps)
17
+ - [`getApp`](#getapp)
18
+ - [Authentication](#authentication)
19
+ - [`listAuthentications`](#listauthentications)
20
+ - [`getAuthentication`](#getauthentication)
21
+ - [`findFirstAuthentication`](#findfirstauthentication)
22
+ - [`findUniqueAuthentication`](#finduniqueauthentication)
23
+ - [HTTP Requests](#http-requests)
24
+ - [`request`](#request)
25
+ - [User & Profile](#user--profile)
26
+ - [`getProfile`](#getprofile)
27
+
28
+ ## Installation
29
+
30
+ ```bash
31
+ npm install @zapier/zapier-sdk
32
+ ```
33
+
34
+ ## Quick Start
35
+
36
+ ```typescript
37
+ import { createZapierSdk } from "@zapier/zapier-sdk";
38
+
39
+ const sdk = createZapierSdk({
40
+ token: "your_zapier_token_here", // or use ZAPIER_TOKEN env var
41
+ });
42
+
43
+ // List all available apps
44
+ const apps = await sdk.listApps();
45
+
46
+ // Get information about a specific app
47
+ const slackApp = await sdk.getApp({ appKey: "slack" });
48
+
49
+ // Run an action
50
+ const result = await sdk.runAction({
51
+ appKey: "slack",
52
+ actionType: "write",
53
+ actionKey: "send_message",
54
+ inputs: { channel: "#general", message: "Hello World!" },
55
+ });
56
+ ```
57
+
58
+ ## Available Functions
59
+
60
+ ### Actions
61
+
62
+ #### `listActions`
63
+
64
+ List all actions for a specific app
65
+
66
+ **Parameters:**
67
+
68
+ | Name | Type | Required | Default | Possible Values | Description |
69
+ | ------------ | -------- | -------- | ------- | ---------------------------------------------------------------------------------------------- | ------------------------------------------------ |
70
+ | `appKey` | `string` | ✅ | — | — | App key of actions to list (e.g., 'SlackCLIAPI') |
71
+ | `actionType` | `string` | ❌ | — | `read`, `read_bulk`, `write`, `run`, `search`, `search_or_write`, `search_and_write`, `filter` | Filter actions by type |
72
+ | `pageSize` | `number` | ❌ | — | — | Number of actions per page |
73
+ | `maxItems` | `number` | ❌ | — | — | Maximum total items to return across all pages |
74
+
75
+ **Returns:** `Promise<PaginatedResult<ActionItem>>`
76
+
77
+ **Example:**
78
+
79
+ ```typescript
80
+ const result = await sdk.listActions({
81
+ appKey: "example-key",
82
+ });
83
+ ```
84
+
85
+ #### `getAction`
86
+
87
+ Get detailed information about a specific action
88
+
89
+ **Parameters:**
90
+
91
+ | Name | Type | Required | Default | Possible Values | Description |
92
+ | ------------ | -------- | -------- | ------- | ---------------------------------------------------------------------------------------------- | -------------------------------------------------- |
93
+ | `appKey` | `string` | ✅ | — | — | App key (e.g., 'SlackCLIAPI') |
94
+ | `actionType` | `string` | ✅ | — | `read`, `read_bulk`, `write`, `run`, `search`, `search_or_write`, `search_and_write`, `filter` | Action type that matches the action's defined type |
95
+ | `actionKey` | `string` | ✅ | — | — | Action key to execute |
96
+
97
+ **Returns:** `Promise<ActionItem>`
98
+
99
+ **Example:**
100
+
101
+ ```typescript
102
+ const result = await sdk.getAction({
103
+ appKey: "example-key",
104
+ actionType: "read",
105
+ actionKey: "example-key",
106
+ });
107
+ ```
108
+
109
+ #### `listInputFields`
110
+
111
+ Get the input fields required for a specific action
112
+
113
+ **Parameters:**
114
+
115
+ | Name | Type | Required | Default | Possible Values | Description |
116
+ | ------------------ | -------- | -------- | ------- | ---------------------------------------------------------------------------------------------- | ----------------------------------------------------- |
117
+ | `appKey` | `string` | ✅ | — | — | App key (e.g., 'SlackCLIAPI') |
118
+ | `actionType` | `string` | ✅ | — | `read`, `read_bulk`, `write`, `run`, `search`, `search_or_write`, `search_and_write`, `filter` | Action type that matches the action's defined type |
119
+ | `actionKey` | `string` | ✅ | — | — | Action key to execute |
120
+ | `authenticationId` | `string` | ❌ | — | — | Authentication ID to use for this action |
121
+ | `inputs` | `object` | ❌ | — | — | Current input values that may affect available fields |
122
+ | `pageSize` | `number` | ❌ | — | — | Number of input fields per page |
123
+ | `maxItems` | `number` | ❌ | — | — | Maximum total items to return across all pages |
124
+
125
+ **Returns:** `Promise<PaginatedResult<ActionField>>`
126
+
127
+ **Example:**
128
+
129
+ ```typescript
130
+ const result = await sdk.listInputFields({
131
+ appKey: "example-key",
132
+ actionType: "read",
133
+ actionKey: "example-key",
134
+ });
135
+ ```
136
+
137
+ #### `runAction`
138
+
139
+ Execute an action with the given inputs
140
+
141
+ **Parameters:**
142
+
143
+ | Name | Type | Required | Default | Possible Values | Description |
144
+ | ------------------ | -------- | -------- | ------- | ---------------------------------------------------------------------------------------------- | -------------------------------------------------- |
145
+ | `appKey` | `string` | ✅ | — | — | App key (e.g., 'SlackCLIAPI') |
146
+ | `actionType` | `string` | ✅ | — | `read`, `read_bulk`, `write`, `run`, `search`, `search_or_write`, `search_and_write`, `filter` | Action type that matches the action's defined type |
147
+ | `actionKey` | `string` | ✅ | — | — | Action key to execute |
148
+ | `authenticationId` | `string` | ❌ | — | — | Authentication ID to use for this action |
149
+ | `inputs` | `object` | ❌ | — | — | Input parameters for the action |
150
+ | `pageSize` | `number` | ❌ | — | — | Number of results per page |
151
+ | `maxItems` | `number` | ❌ | — | — | Maximum total items to return across all pages |
152
+
153
+ **Returns:** `Promise<ActionExecutionResult>`
154
+
155
+ **Example:**
156
+
157
+ ```typescript
158
+ const result = await sdk.runAction({
159
+ appKey: "example-key",
160
+ actionType: "read",
161
+ actionKey: "example-key",
162
+ });
163
+ ```
164
+
165
+ ### Apps
166
+
167
+ #### `listApps`
168
+
169
+ List all available apps with optional filtering
170
+
171
+ **Parameters:**
172
+
173
+ | Name | Type | Required | Default | Possible Values | Description |
174
+ | ---------- | -------- | -------- | ------- | --------------- | ------------------------------------------------------------------- |
175
+ | `appKeys` | `array` | ❌ | — | — | Filter apps by app keys (e.g., 'SlackCLIAPI' or slug like 'github') |
176
+ | `search` | `string` | ❌ | — | — | Search for apps by name |
177
+ | `pageSize` | `number` | ❌ | — | — | Number of apps per page |
178
+ | `maxItems` | `number` | ❌ | — | — | Maximum total items to return across all pages |
179
+
180
+ **Returns:** `Promise<PaginatedResult<AppItem>>`
181
+
182
+ **Example:**
183
+
184
+ ```typescript
185
+ const result = await sdk.listApps();
186
+ ```
187
+
188
+ #### `getApp`
189
+
190
+ Get detailed information about a specific app
191
+
192
+ **Parameters:**
193
+
194
+ | Name | Type | Required | Default | Possible Values | Description |
195
+ | -------- | -------- | -------- | ------- | --------------- | --------------------------------------------- |
196
+ | `appKey` | `string` | ✅ | — | — | App key of app to fetch (e.g., 'SlackCLIAPI') |
197
+
198
+ **Returns:** `Promise<AppItem>`
199
+
200
+ **Example:**
201
+
202
+ ```typescript
203
+ const result = await sdk.getApp({
204
+ appKey: "example-key",
205
+ });
206
+ ```
207
+
208
+ ### Authentication
209
+
210
+ #### `listAuthentications`
211
+
212
+ List available authentications with optional filtering
213
+
214
+ **Parameters:**
215
+
216
+ | Name | Type | Required | Default | Possible Values | Description |
217
+ | ------------ | -------- | -------- | ------- | --------------- | -------------------------------------------------------- |
218
+ | `appKey` | `string` | ❌ | — | — | App key of authentications to list (e.g., 'SlackCLIAPI') |
219
+ | `search` | `string` | ❌ | — | — | Search term to filter authentications by title |
220
+ | `title` | `string` | ❌ | — | — | Filter authentications by exact title match |
221
+ | `account_id` | `string` | ❌ | — | — | Filter by account ID |
222
+ | `owner` | `string` | ❌ | — | — | Filter by owner |
223
+ | `pageSize` | `number` | ❌ | — | — | Number of authentications per page |
224
+ | `maxItems` | `number` | ❌ | — | — | Maximum total items to return across all pages |
225
+
226
+ **Returns:** `Promise<PaginatedResult<Authentication>>`
227
+
228
+ **Example:**
229
+
230
+ ```typescript
231
+ const result = await sdk.listAuthentications();
232
+ ```
233
+
234
+ #### `getAuthentication`
235
+
236
+ Get a specific authentication by ID
237
+
238
+ **Parameters:**
239
+
240
+ | Name | Type | Required | Default | Possible Values | Description |
241
+ | ------------------ | -------- | -------- | ------- | --------------- | ----------------------------- |
242
+ | `authenticationId` | `number` | ✅ | — | — | Authentication ID to retrieve |
243
+
244
+ **Returns:** `Promise<Authentication>`
245
+
246
+ **Example:**
247
+
248
+ ```typescript
249
+ const result = await sdk.getAuthentication({
250
+ authenticationId: 12345,
251
+ });
252
+ ```
253
+
254
+ #### `findFirstAuthentication`
255
+
256
+ Find the first authentication matching the criteria
257
+
258
+ **Parameters:**
259
+
260
+ | Name | Type | Required | Default | Possible Values | Description |
261
+ | ------------ | -------- | -------- | ------- | --------------- | ------------------------------------------------------- |
262
+ | `appKey` | `string` | ❌ | — | — | App key of authentication to find (e.g., 'SlackCLIAPI') |
263
+ | `search` | `string` | ❌ | — | — | Search term to filter authentications by title |
264
+ | `title` | `string` | ❌ | — | — | Filter authentications by exact title match |
265
+ | `account_id` | `string` | ❌ | — | — | Filter by account ID |
266
+ | `owner` | `string` | ❌ | — | — | Filter by owner |
267
+
268
+ **Returns:** `Promise<Authentication | null>`
269
+
270
+ **Example:**
271
+
272
+ ```typescript
273
+ const result = await sdk.findFirstAuthentication();
274
+ ```
275
+
276
+ #### `findUniqueAuthentication`
277
+
278
+ Find a unique authentication matching the criteria
279
+
280
+ **Parameters:**
281
+
282
+ | Name | Type | Required | Default | Possible Values | Description |
283
+ | ------------ | -------- | -------- | ------- | --------------- | ------------------------------------------------------- |
284
+ | `appKey` | `string` | ❌ | — | — | App key of authentication to find (e.g., 'SlackCLIAPI') |
285
+ | `search` | `string` | ❌ | — | — | Search term to filter authentications by title |
286
+ | `title` | `string` | ❌ | — | — | Filter authentications by exact title match |
287
+ | `account_id` | `string` | ❌ | — | — | Filter by account ID |
288
+ | `owner` | `string` | ❌ | — | — | Filter by owner |
289
+
290
+ **Returns:** `Promise<Authentication | null>`
291
+
292
+ **Example:**
293
+
294
+ ```typescript
295
+ const result = await sdk.findUniqueAuthentication();
296
+ ```
297
+
298
+ ### HTTP Requests
299
+
300
+ #### `request`
301
+
302
+ Make authenticated HTTP requests through Zapier's Relay service
303
+
304
+ **Parameters:**
305
+
306
+ | Name | Type | Required | Default | Possible Values | Description |
307
+ | ------------------------ | -------- | -------- | ------- | ---------------------------------------------------------- | -------------------------------------------------------------------- |
308
+ | `url` | `string` | ✅ | — | — | The URL to request (will be proxied through Relay) |
309
+ | `method` | `string` | ❌ | — | `GET`, `POST`, `PUT`, `DELETE`, `PATCH`, `HEAD`, `OPTIONS` | HTTP method |
310
+ | `body` | `string` | ❌ | — | — | Request body as a string |
311
+ | `authenticationId` | `number` | ❌ | — | — | Zapier authentication ID to use for the request |
312
+ | `callbackUrl` | `string` | ❌ | — | — | URL to send async response to (makes request async) |
313
+ | `authenticationTemplate` | `string` | ❌ | — | — | Optional JSON string authentication template to bypass Notary lookup |
314
+ | `headers` | `string` | ❌ | — | — | Request headers |
315
+ | `relayBaseUrl` | `string` | ❌ | — | — | Base URL for Relay service |
316
+
317
+ **Returns:** `Promise<Response>`
318
+
319
+ **Example:**
320
+
321
+ ```typescript
322
+ const result = await sdk.request({
323
+ url: "https://example.com",
324
+ });
325
+ ```
326
+
327
+ ### User & Profile
328
+
329
+ #### `getProfile`
330
+
331
+ Get current user's profile information
332
+
333
+ **Parameters:** None
334
+
335
+ **Returns:** `Promise<UserProfile>`
336
+
337
+ **Example:**
338
+
339
+ ```typescript
340
+ const result = await sdk.getProfile();
341
+ ```
342
+
343
+ <!-- End Generated API Reference -->
@@ -5,7 +5,7 @@
5
5
  * with Zapier's various APIs. It handles authentication, error handling,
6
6
  * polling, and provides consistent patterns across all services.
7
7
  */
8
- export type { ApiClient, ApiClientOptions, RequestOptions, PollOptions, DebugLogger, Action, Field, Choice, ActionExecutionResult, ActionField, ActionFieldChoice, NeedsRequest, NeedsResponse, Authentication, AuthenticationsResponse, } from "./types";
8
+ export type { ApiClient, ApiClientOptions, RequestOptions, PollOptions, DebugLogger, Action, Field, Choice, ActionExecutionResult, ActionField, ActionFieldChoice, NeedsRequest, NeedsResponse, Authentication, AuthenticationsResponse, Implementation, ImplementationsResponse, } from "./types";
9
9
  import type { ApiClient } from "./types";
10
10
  export { isJwt, getAuthorizationHeader } from "./auth";
11
11
  export { createDebugLogger, createDebugFetch } from "./debug";
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/api/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAGH,YAAY,EAEV,SAAS,EACT,gBAAgB,EAChB,cAAc,EACd,WAAW,EACX,WAAW,EAEX,MAAM,EACN,KAAK,EACL,MAAM,EACN,qBAAqB,EACrB,WAAW,EACX,iBAAiB,EACjB,YAAY,EACZ,aAAa,EACb,cAAc,EACd,uBAAuB,GACxB,MAAM,SAAS,CAAC;AAGjB,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AAGzC,OAAO,EAAE,KAAK,EAAE,sBAAsB,EAAE,MAAM,QAAQ,CAAC;AAGvD,OAAO,EAAE,iBAAiB,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAC;AAG9D,OAAO,EAAE,iBAAiB,EAAE,MAAM,WAAW,CAAC;AAG9C,OAAO,EAAE,eAAe,EAAE,MAAM,UAAU,CAAC;AAM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GAAG,SAAS,CAAC,CAAC;IAC7C,GAAG,CAAC,EAAE,SAAS,CAAC;IAChB,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,KAAK,CAAC,EAAE,OAAO,UAAU,CAAC,KAAK,CAAC;CACjC,GAAG,SAAS,CAsBZ"}
@@ -523,6 +523,7 @@ export declare const AuthenticationSchema: z.ZodObject<{
523
523
  is_invite_only: boolean;
524
524
  is_private: boolean;
525
525
  shared_with_all: boolean;
526
+ url?: string | undefined;
526
527
  title?: string | null | undefined;
527
528
  label?: string | null | undefined;
528
529
  permissions?: Record<string, boolean> | undefined;
@@ -533,7 +534,6 @@ export declare const AuthenticationSchema: z.ZodObject<{
533
534
  is_shared?: string | undefined;
534
535
  marked_stale_at?: string | null | undefined;
535
536
  identifier?: string | null | undefined;
536
- url?: string | undefined;
537
537
  groups?: string | undefined;
538
538
  members?: string | undefined;
539
539
  }, {
@@ -544,6 +544,7 @@ export declare const AuthenticationSchema: z.ZodObject<{
544
544
  is_invite_only: boolean;
545
545
  is_private: boolean;
546
546
  shared_with_all: boolean;
547
+ url?: string | undefined;
547
548
  title?: string | null | undefined;
548
549
  label?: string | null | undefined;
549
550
  permissions?: Record<string, boolean> | undefined;
@@ -554,7 +555,6 @@ export declare const AuthenticationSchema: z.ZodObject<{
554
555
  is_shared?: string | undefined;
555
556
  marked_stale_at?: string | null | undefined;
556
557
  identifier?: string | null | undefined;
557
- url?: string | undefined;
558
558
  groups?: string | undefined;
559
559
  members?: string | undefined;
560
560
  }>;
@@ -591,6 +591,7 @@ export declare const AuthenticationsResponseSchema: z.ZodObject<{
591
591
  is_invite_only: boolean;
592
592
  is_private: boolean;
593
593
  shared_with_all: boolean;
594
+ url?: string | undefined;
594
595
  title?: string | null | undefined;
595
596
  label?: string | null | undefined;
596
597
  permissions?: Record<string, boolean> | undefined;
@@ -601,7 +602,6 @@ export declare const AuthenticationsResponseSchema: z.ZodObject<{
601
602
  is_shared?: string | undefined;
602
603
  marked_stale_at?: string | null | undefined;
603
604
  identifier?: string | null | undefined;
604
- url?: string | undefined;
605
605
  groups?: string | undefined;
606
606
  members?: string | undefined;
607
607
  }, {
@@ -612,6 +612,7 @@ export declare const AuthenticationsResponseSchema: z.ZodObject<{
612
612
  is_invite_only: boolean;
613
613
  is_private: boolean;
614
614
  shared_with_all: boolean;
615
+ url?: string | undefined;
615
616
  title?: string | null | undefined;
616
617
  label?: string | null | undefined;
617
618
  permissions?: Record<string, boolean> | undefined;
@@ -622,7 +623,6 @@ export declare const AuthenticationsResponseSchema: z.ZodObject<{
622
623
  is_shared?: string | undefined;
623
624
  marked_stale_at?: string | null | undefined;
624
625
  identifier?: string | null | undefined;
625
- url?: string | undefined;
626
626
  groups?: string | undefined;
627
627
  members?: string | undefined;
628
628
  }>, "many">;
@@ -636,6 +636,7 @@ export declare const AuthenticationsResponseSchema: z.ZodObject<{
636
636
  is_invite_only: boolean;
637
637
  is_private: boolean;
638
638
  shared_with_all: boolean;
639
+ url?: string | undefined;
639
640
  title?: string | null | undefined;
640
641
  label?: string | null | undefined;
641
642
  permissions?: Record<string, boolean> | undefined;
@@ -646,7 +647,6 @@ export declare const AuthenticationsResponseSchema: z.ZodObject<{
646
647
  is_shared?: string | undefined;
647
648
  marked_stale_at?: string | null | undefined;
648
649
  identifier?: string | null | undefined;
649
- url?: string | undefined;
650
650
  groups?: string | undefined;
651
651
  members?: string | undefined;
652
652
  }[];
@@ -662,6 +662,7 @@ export declare const AuthenticationsResponseSchema: z.ZodObject<{
662
662
  is_invite_only: boolean;
663
663
  is_private: boolean;
664
664
  shared_with_all: boolean;
665
+ url?: string | undefined;
665
666
  title?: string | null | undefined;
666
667
  label?: string | null | undefined;
667
668
  permissions?: Record<string, boolean> | undefined;
@@ -672,7 +673,6 @@ export declare const AuthenticationsResponseSchema: z.ZodObject<{
672
673
  is_shared?: string | undefined;
673
674
  marked_stale_at?: string | null | undefined;
674
675
  identifier?: string | null | undefined;
675
- url?: string | undefined;
676
676
  groups?: string | undefined;
677
677
  members?: string | undefined;
678
678
  }[];
@@ -19,11 +19,11 @@ export interface ApiClientOptions {
19
19
  onEvent?: (event: any) => void;
20
20
  }
21
21
  export interface ApiClient {
22
- get: (path: string, options?: RequestOptions) => Promise<any>;
23
- post: (path: string, data?: any, options?: RequestOptions) => Promise<any>;
24
- put: (path: string, data?: any, options?: RequestOptions) => Promise<any>;
25
- delete: (path: string, options?: RequestOptions) => Promise<any>;
26
- poll: (path: string, options?: PollOptions) => Promise<any>;
22
+ get: <T = unknown>(path: string, options?: RequestOptions) => Promise<T>;
23
+ post: <T = unknown>(path: string, data?: unknown, options?: RequestOptions) => Promise<T>;
24
+ put: <T = unknown>(path: string, data?: unknown, options?: RequestOptions) => Promise<T>;
25
+ delete: <T = unknown>(path: string, options?: RequestOptions) => Promise<T>;
26
+ poll: <T = unknown>(path: string, options?: PollOptions) => Promise<T>;
27
27
  fetch: (path: string, init?: RequestInit & {
28
28
  searchParams?: Record<string, string>;
29
29
  authRequired?: boolean;
@@ -36,7 +36,7 @@ export interface RequestOptions {
36
36
  customErrorHandler?: (errorInfo: {
37
37
  status: number;
38
38
  statusText: string;
39
- data: any;
39
+ data: unknown;
40
40
  }) => Error | undefined;
41
41
  }
42
42
  export interface PollOptions extends RequestOptions {
@@ -45,7 +45,7 @@ export interface PollOptions extends RequestOptions {
45
45
  maxDelay?: number;
46
46
  successStatus?: number;
47
47
  pendingStatus?: number;
48
- resultExtractor?: (response: any) => any;
48
+ resultExtractor?: (response: unknown) => unknown;
49
49
  }
50
50
  export interface DebugLogger {
51
51
  (message: string, data?: any): void;
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/api/types.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EACL,iBAAiB,EACjB,UAAU,EACV,iBAAiB,EACjB,uBAAuB,EACvB,YAAY,EACZ,YAAY,EACZ,WAAW,EACX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O,oBAAoB,CAAC,CAAC;AAClE,MAAM,MAAM,uBAAuB,GAAG,CAAC,CAAC,KAAK,CAC3C,OAAO,6BAA6B,CACrC,CAAC;AACF,MAAM,MAAM,WAAW,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,iBAAiB,CAAC,CAAC;AAC5D,MAAM,MAAM,GAAG,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,SAAS,CAAC,CAAC;AAC5C,MAAM,MAAM,OAAO,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,aAAa,CAAC,CAAC;AACpD,MAAM,MAAM,gBAAgB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,sBAAsB,CAAC,CAAC;AAGtE,MAAM,MAAM,YAAY,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,kBAAkB,CAAC,CAAC;AAC9D,MAAM,MAAM,aAAa,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,mBAAmB,CAAC,CAAC;AAGhE,MAAM,MAAM,cAAc,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,oBAAoB,CAAC,CAAC;AAClE,MAAM,MAAM,uBAAuB,GAAG,CAAC,CAAC,KAAK,CAC3C,OAAO,6BAA6B,CACrC,CAAC;AAGF,MAAM,MAAM,kBAAkB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,wBAAwB,CAAC,CAAC;AAC1E,MAAM,MAAM,2BAA2B,GAAG,CAAC,CAAC,KAAK,CAC/C,OAAO,iCAAiC,CACzC,CAAC"}
package/dist/index.cjs CHANGED
@@ -2007,24 +2007,27 @@ var listActionsPlugin = ({ sdk, context }) => {
2007
2007
  public_only: "true",
2008
2008
  selected_apis: implementationId
2009
2009
  };
2010
- const data = await api.get("/api/v4/implementations/", {
2011
- searchParams,
2012
- customErrorHandler: ({ status }) => {
2013
- if (status === 401) {
2014
- return new ZapierAuthenticationError(
2015
- `Authentication failed. Your token may not have permission to access implementations or may be expired. (HTTP ${status})`,
2016
- { statusCode: status }
2017
- );
2018
- }
2019
- if (status === 403) {
2020
- return new ZapierAuthenticationError(
2021
- `Access forbidden. Your token may not have the required scopes to list implementations. (HTTP ${status})`,
2022
- { statusCode: status }
2023
- );
2010
+ const data = await api.get(
2011
+ "/api/v4/implementations/",
2012
+ {
2013
+ searchParams,
2014
+ customErrorHandler: ({ status }) => {
2015
+ if (status === 401) {
2016
+ return new ZapierAuthenticationError(
2017
+ `Authentication failed. Your token may not have permission to access implementations or may be expired. (HTTP ${status})`,
2018
+ { statusCode: status }
2019
+ );
2020
+ }
2021
+ if (status === 403) {
2022
+ return new ZapierAuthenticationError(
2023
+ `Access forbidden. Your token may not have the required scopes to list implementations. (HTTP ${status})`,
2024
+ { statusCode: status }
2025
+ );
2026
+ }
2027
+ return void 0;
2024
2028
  }
2025
- return void 0;
2026
2029
  }
2027
- });
2030
+ );
2028
2031
  let allActions = [];
2029
2032
  for (const implementation of data.results || []) {
2030
2033
  if (implementation.actions) {
@@ -2133,7 +2136,10 @@ async function executeAction(actionOptions) {
2133
2136
  const runRequest = {
2134
2137
  data: runRequestData
2135
2138
  };
2136
- const runData = await api.post("/api/actions/v1/runs", runRequest);
2139
+ const runData = await api.post(
2140
+ "/api/actions/v1/runs",
2141
+ runRequest
2142
+ );
2137
2143
  const runId = runData.data.id;
2138
2144
  return await api.poll(`/api/actions/v1/runs/${runId}`, {
2139
2145
  successStatus: 200,
package/dist/index.d.mts CHANGED
@@ -728,8 +728,8 @@ interface ApiError {
728
728
  code: string;
729
729
  title: string;
730
730
  detail: string;
731
- source?: any;
732
- meta?: any;
731
+ source?: unknown;
732
+ meta?: unknown;
733
733
  }
734
734
  /**
735
735
  * Base options for all error constructors
@@ -738,7 +738,7 @@ interface ErrorOptions {
738
738
  statusCode?: number;
739
739
  errors?: ApiError[];
740
740
  cause?: unknown;
741
- response?: any;
741
+ response?: unknown;
742
742
  }
743
743
  /**
744
744
  * Base class for all Zapier SDK errors
@@ -749,7 +749,7 @@ declare abstract class ZapierError extends Error {
749
749
  statusCode?: number;
750
750
  errors?: ApiError[];
751
751
  cause?: unknown;
752
- response?: any;
752
+ response?: unknown;
753
753
  constructor(message: string, options?: ErrorOptions);
754
754
  }
755
755
  /**
@@ -774,9 +774,9 @@ declare class ZapierAppNotFoundError extends ZapierError {
774
774
  */
775
775
  declare class ZapierValidationError extends ZapierError {
776
776
  readonly name = "ZapierValidationError";
777
- details?: any;
777
+ details?: unknown;
778
778
  constructor(message: string, options?: ErrorOptions & {
779
- details?: any;
779
+ details?: unknown;
780
780
  });
781
781
  }
782
782
  /**
@@ -871,7 +871,7 @@ interface AppFactoryOptions {
871
871
  authenticationId: number;
872
872
  }
873
873
  interface BaseActionTypeProxy {
874
- [action: string]: (options?: ActionExecutionOptions) => any;
874
+ [action: string]: (options?: ActionExecutionOptions) => unknown;
875
875
  }
876
876
  interface FetchActionType {
877
877
  fetch: (url: string | URL, init?: RequestInit & {
@@ -2346,7 +2346,7 @@ AppsPluginProvides>;
2346
2346
  */
2347
2347
  interface SdkEvent {
2348
2348
  type: string;
2349
- payload?: Record<string, any>;
2349
+ payload?: Record<string, unknown>;
2350
2350
  timestamp?: number;
2351
2351
  }
2352
2352
  interface AuthEvent extends SdkEvent {