@zapier/zapier-sdk 0.3.1 → 0.4.1
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/dist/index.cjs +1962 -0
- package/dist/index.d.mts +892 -0
- package/dist/index.d.ts +892 -20
- package/dist/index.mjs +1914 -0
- package/package.json +19 -7
- package/src/api/client.ts +106 -25
- package/src/api/polling.ts +4 -8
- package/src/api/types.ts +8 -1
- package/src/auth.ts +19 -287
- package/src/functions/findFirstAuthentication/schemas.ts +3 -13
- package/src/functions/findUniqueAuthentication/schemas.ts +3 -13
- package/src/functions/generateTypes/index.ts +15 -0
- package/src/functions/generateTypes/schemas.ts +3 -10
- package/src/functions/getAction/schemas.ts +3 -13
- package/src/functions/getApp/schemas.ts +2 -13
- package/src/functions/getAuthentication/index.ts +0 -1
- package/src/functions/getAuthentication/schemas.ts +3 -17
- package/src/functions/listActions/schemas.ts +3 -13
- package/src/functions/listApps/schemas.ts +2 -13
- package/src/functions/listAuthentications/index.ts +0 -1
- package/src/functions/listAuthentications/schemas.ts +3 -15
- package/src/functions/listFields/schemas.ts +3 -13
- package/src/functions/request/index.ts +150 -0
- package/src/functions/request/info.ts +11 -0
- package/src/functions/request/schemas.ts +53 -0
- package/src/functions/runAction/index.ts +0 -1
- package/src/functions/runAction/schemas.ts +6 -15
- package/src/index.ts +8 -2
- package/src/plugins/apps/index.ts +34 -9
- package/src/plugins/apps/types.ts +17 -1
- package/src/plugins/fetch/index.ts +50 -0
- package/src/plugins/fetch/types.ts +2 -0
- package/src/sdk.ts +19 -23
- package/src/types/domain.ts +16 -0
- package/src/types/sdk.ts +17 -2
- package/tsconfig.json +2 -2
- package/tsup.config.ts +21 -0
- package/dist/api/auth.d.ts +0 -8
- package/dist/api/auth.js +0 -29
- package/dist/api/client.d.ts +0 -8
- package/dist/api/client.js +0 -119
- package/dist/api/debug.d.ts +0 -12
- package/dist/api/debug.js +0 -50
- package/dist/api/index.d.ts +0 -28
- package/dist/api/index.js +0 -52
- package/dist/api/polling.d.ts +0 -17
- package/dist/api/polling.js +0 -34
- package/dist/api/types.d.ts +0 -147
- package/dist/api/types.js +0 -9
- package/dist/auth.d.ts +0 -59
- package/dist/auth.js +0 -261
- package/dist/functions/bundleCode/index.d.ts +0 -11
- package/dist/functions/bundleCode/index.js +0 -91
- package/dist/functions/bundleCode/info.d.ts +0 -27
- package/dist/functions/bundleCode/info.js +0 -11
- package/dist/functions/bundleCode/schemas.d.ts +0 -27
- package/dist/functions/bundleCode/schemas.js +0 -22
- package/dist/functions/findFirstAuthentication/index.d.ts +0 -12
- package/dist/functions/findFirstAuthentication/index.js +0 -21
- package/dist/functions/findFirstAuthentication/info.d.ts +0 -30
- package/dist/functions/findFirstAuthentication/info.js +0 -11
- package/dist/functions/findFirstAuthentication/schemas.d.ts +0 -42
- package/dist/functions/findFirstAuthentication/schemas.js +0 -25
- package/dist/functions/findUniqueAuthentication/index.d.ts +0 -13
- package/dist/functions/findUniqueAuthentication/index.js +0 -28
- package/dist/functions/findUniqueAuthentication/info.d.ts +0 -30
- package/dist/functions/findUniqueAuthentication/info.js +0 -11
- package/dist/functions/findUniqueAuthentication/schemas.d.ts +0 -42
- package/dist/functions/findUniqueAuthentication/schemas.js +0 -25
- package/dist/functions/generateTypes/index.d.ts +0 -11
- package/dist/functions/generateTypes/index.js +0 -305
- package/dist/functions/generateTypes/info.d.ts +0 -21
- package/dist/functions/generateTypes/info.js +0 -11
- package/dist/functions/generateTypes/schemas.d.ts +0 -30
- package/dist/functions/generateTypes/schemas.js +0 -14
- package/dist/functions/getAction/index.d.ts +0 -12
- package/dist/functions/getAction/index.js +0 -26
- package/dist/functions/getAction/info.d.ts +0 -18
- package/dist/functions/getAction/info.js +0 -11
- package/dist/functions/getAction/schemas.d.ts +0 -30
- package/dist/functions/getAction/schemas.js +0 -13
- package/dist/functions/getApp/index.d.ts +0 -12
- package/dist/functions/getApp/index.js +0 -37
- package/dist/functions/getApp/info.d.ts +0 -12
- package/dist/functions/getApp/info.js +0 -11
- package/dist/functions/getApp/schemas.d.ts +0 -24
- package/dist/functions/getApp/schemas.js +0 -11
- package/dist/functions/getAuthentication/index.d.ts +0 -13
- package/dist/functions/getAuthentication/index.js +0 -38
- package/dist/functions/getAuthentication/info.d.ts +0 -12
- package/dist/functions/getAuthentication/info.js +0 -11
- package/dist/functions/getAuthentication/schemas.d.ts +0 -26
- package/dist/functions/getAuthentication/schemas.js +0 -16
- package/dist/functions/listActions/index.d.ts +0 -12
- package/dist/functions/listActions/index.js +0 -128
- package/dist/functions/listActions/info.d.ts +0 -15
- package/dist/functions/listActions/info.js +0 -11
- package/dist/functions/listActions/schemas.d.ts +0 -27
- package/dist/functions/listActions/schemas.js +0 -14
- package/dist/functions/listApps/index.d.ts +0 -12
- package/dist/functions/listApps/index.js +0 -50
- package/dist/functions/listApps/info.d.ts +0 -18
- package/dist/functions/listApps/info.js +0 -11
- package/dist/functions/listApps/schemas.d.ts +0 -30
- package/dist/functions/listApps/schemas.js +0 -15
- package/dist/functions/listAuthentications/index.d.ts +0 -12
- package/dist/functions/listAuthentications/index.js +0 -131
- package/dist/functions/listAuthentications/info.d.ts +0 -30
- package/dist/functions/listAuthentications/info.js +0 -11
- package/dist/functions/listAuthentications/schemas.d.ts +0 -44
- package/dist/functions/listAuthentications/schemas.js +0 -25
- package/dist/functions/listFields/index.d.ts +0 -12
- package/dist/functions/listFields/index.js +0 -65
- package/dist/functions/listFields/info.d.ts +0 -24
- package/dist/functions/listFields/info.js +0 -11
- package/dist/functions/listFields/schemas.d.ts +0 -36
- package/dist/functions/listFields/schemas.js +0 -17
- package/dist/functions/runAction/index.d.ts +0 -12
- package/dist/functions/runAction/index.js +0 -86
- package/dist/functions/runAction/info.d.ts +0 -24
- package/dist/functions/runAction/info.js +0 -11
- package/dist/functions/runAction/schemas.d.ts +0 -38
- package/dist/functions/runAction/schemas.js +0 -15
- package/dist/index.js +0 -57
- package/dist/plugins/apps/index.d.ts +0 -8
- package/dist/plugins/apps/index.js +0 -77
- package/dist/plugins/apps/info.d.ts +0 -6
- package/dist/plugins/apps/info.js +0 -13
- package/dist/plugins/apps/types.d.ts +0 -21
- package/dist/plugins/apps/types.js +0 -2
- package/dist/resolvers/actionKey.d.ts +0 -8
- package/dist/resolvers/actionKey.js +0 -20
- package/dist/resolvers/actionType.d.ts +0 -8
- package/dist/resolvers/actionType.js +0 -21
- package/dist/resolvers/appKey.d.ts +0 -6
- package/dist/resolvers/appKey.js +0 -8
- package/dist/resolvers/authenticationId.d.ts +0 -8
- package/dist/resolvers/authenticationId.js +0 -29
- package/dist/resolvers/index.d.ts +0 -39
- package/dist/resolvers/index.js +0 -105
- package/dist/resolvers/inputs.d.ts +0 -7
- package/dist/resolvers/inputs.js +0 -15
- package/dist/schema-utils.d.ts +0 -44
- package/dist/schema-utils.js +0 -76
- package/dist/schemas/Action.d.ts +0 -21
- package/dist/schemas/Action.js +0 -31
- package/dist/schemas/App.d.ts +0 -19
- package/dist/schemas/App.js +0 -32
- package/dist/schemas/Auth.d.ts +0 -27
- package/dist/schemas/Auth.js +0 -42
- package/dist/schemas/Field.d.ts +0 -15
- package/dist/schemas/Field.js +0 -25
- package/dist/sdk.d.ts +0 -6
- package/dist/sdk.js +0 -90
- package/dist/types/domain.d.ts +0 -25
- package/dist/types/domain.js +0 -21
- package/dist/types/events.d.ts +0 -37
- package/dist/types/events.js +0 -8
- package/dist/types/properties.d.ts +0 -21
- package/dist/types/properties.js +0 -52
- package/dist/types/sdk.d.ts +0 -24
- package/dist/types/sdk.js +0 -2
package/dist/index.d.mts
ADDED
|
@@ -0,0 +1,892 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
|
|
3
|
+
interface Integration {
|
|
4
|
+
key: string;
|
|
5
|
+
name: string;
|
|
6
|
+
description: string;
|
|
7
|
+
version: string;
|
|
8
|
+
category?: string;
|
|
9
|
+
actions: Action[];
|
|
10
|
+
triggers: Trigger[];
|
|
11
|
+
current_implementation_id?: string;
|
|
12
|
+
}
|
|
13
|
+
interface Action {
|
|
14
|
+
key: string;
|
|
15
|
+
name: string;
|
|
16
|
+
description: string;
|
|
17
|
+
appKey: string;
|
|
18
|
+
type: "read" | "read_bulk" | "write" | "run" | "search" | "search_or_write" | "search_and_write" | "filter";
|
|
19
|
+
inputFields: Field[];
|
|
20
|
+
outputFields: Field[];
|
|
21
|
+
}
|
|
22
|
+
interface Trigger {
|
|
23
|
+
key: string;
|
|
24
|
+
name: string;
|
|
25
|
+
description: string;
|
|
26
|
+
appKey: string;
|
|
27
|
+
type: "instant" | "polling" | "webhook";
|
|
28
|
+
outputFields: Field[];
|
|
29
|
+
}
|
|
30
|
+
interface Field {
|
|
31
|
+
key: string;
|
|
32
|
+
label: string;
|
|
33
|
+
type: "string" | "number" | "boolean" | "datetime" | "file" | "object" | "array";
|
|
34
|
+
required: boolean;
|
|
35
|
+
description?: string;
|
|
36
|
+
choices?: Choice[];
|
|
37
|
+
}
|
|
38
|
+
interface Choice {
|
|
39
|
+
value: string | number;
|
|
40
|
+
label: string;
|
|
41
|
+
}
|
|
42
|
+
interface ActionExecutionResult {
|
|
43
|
+
success: boolean;
|
|
44
|
+
data?: any;
|
|
45
|
+
error?: string;
|
|
46
|
+
metadata?: {
|
|
47
|
+
executionTime?: number;
|
|
48
|
+
requestId?: string;
|
|
49
|
+
};
|
|
50
|
+
}
|
|
51
|
+
interface ActionField {
|
|
52
|
+
key: string;
|
|
53
|
+
label?: string;
|
|
54
|
+
required: boolean;
|
|
55
|
+
type?: string;
|
|
56
|
+
helpText?: string;
|
|
57
|
+
helpTextHtml?: string;
|
|
58
|
+
choices?: ActionFieldChoice[];
|
|
59
|
+
default?: string;
|
|
60
|
+
placeholder?: string;
|
|
61
|
+
computed?: boolean;
|
|
62
|
+
customField?: boolean;
|
|
63
|
+
dependsOn?: string[];
|
|
64
|
+
format?: string;
|
|
65
|
+
inputFormat?: string[];
|
|
66
|
+
}
|
|
67
|
+
interface ActionFieldChoice {
|
|
68
|
+
value: string | number;
|
|
69
|
+
label: string;
|
|
70
|
+
}
|
|
71
|
+
interface NeedsRequest {
|
|
72
|
+
selected_api: string;
|
|
73
|
+
action: string;
|
|
74
|
+
type_of: string;
|
|
75
|
+
authentication_id?: number;
|
|
76
|
+
params?: Record<string, any>;
|
|
77
|
+
}
|
|
78
|
+
interface NeedsResponse {
|
|
79
|
+
success: boolean;
|
|
80
|
+
needs?: ActionField[];
|
|
81
|
+
errors?: string[];
|
|
82
|
+
}
|
|
83
|
+
interface Authentication {
|
|
84
|
+
id: number;
|
|
85
|
+
date: string;
|
|
86
|
+
lastchanged?: string;
|
|
87
|
+
account_id: number;
|
|
88
|
+
customuser_id?: number;
|
|
89
|
+
selected_api: string;
|
|
90
|
+
destination_selected_api?: string | null;
|
|
91
|
+
is_invite_only: boolean;
|
|
92
|
+
is_private: boolean;
|
|
93
|
+
shared_with_all: boolean;
|
|
94
|
+
is_stale?: string;
|
|
95
|
+
is_shared?: string;
|
|
96
|
+
marked_stale_at?: string | null;
|
|
97
|
+
label?: string | null;
|
|
98
|
+
identifier?: string | null;
|
|
99
|
+
title?: string | null;
|
|
100
|
+
url?: string;
|
|
101
|
+
groups?: string;
|
|
102
|
+
members?: string;
|
|
103
|
+
permissions?: Record<string, boolean>;
|
|
104
|
+
}
|
|
105
|
+
interface AuthenticationsResponse {
|
|
106
|
+
count: number;
|
|
107
|
+
next?: string | null;
|
|
108
|
+
previous?: string | null;
|
|
109
|
+
results: Authentication[];
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
/**
|
|
113
|
+
* SDK Event System
|
|
114
|
+
*
|
|
115
|
+
* This module provides common event type definitions for the SDK's
|
|
116
|
+
* event system, including authentication, API, and loading events.
|
|
117
|
+
*/
|
|
118
|
+
interface SdkEvent {
|
|
119
|
+
type: string;
|
|
120
|
+
payload?: Record<string, any>;
|
|
121
|
+
timestamp?: number;
|
|
122
|
+
}
|
|
123
|
+
interface AuthEvent extends SdkEvent {
|
|
124
|
+
type: "auth_refreshing" | "auth_success" | "auth_error" | "auth_logout";
|
|
125
|
+
payload?: {
|
|
126
|
+
message?: string;
|
|
127
|
+
error?: string;
|
|
128
|
+
operation?: string;
|
|
129
|
+
};
|
|
130
|
+
}
|
|
131
|
+
interface ApiEvent extends SdkEvent {
|
|
132
|
+
type: "api_request" | "api_response" | "api_error";
|
|
133
|
+
payload?: {
|
|
134
|
+
url?: string;
|
|
135
|
+
method?: string;
|
|
136
|
+
status?: number;
|
|
137
|
+
duration?: number;
|
|
138
|
+
error?: string;
|
|
139
|
+
};
|
|
140
|
+
}
|
|
141
|
+
interface LoadingEvent extends SdkEvent {
|
|
142
|
+
type: "loading_start" | "loading_end";
|
|
143
|
+
payload?: {
|
|
144
|
+
operation?: string;
|
|
145
|
+
resource?: string;
|
|
146
|
+
};
|
|
147
|
+
}
|
|
148
|
+
type EventCallback = (event: SdkEvent) => void;
|
|
149
|
+
|
|
150
|
+
interface ActionExecutionOptions {
|
|
151
|
+
inputs?: Record<string, any>;
|
|
152
|
+
authenticationId?: number;
|
|
153
|
+
}
|
|
154
|
+
interface AuthObject {
|
|
155
|
+
id: number;
|
|
156
|
+
}
|
|
157
|
+
interface BaseSdkOptions {
|
|
158
|
+
token?: string;
|
|
159
|
+
getToken?: () => Promise<string | undefined>;
|
|
160
|
+
onEvent?: EventCallback;
|
|
161
|
+
fetch?: typeof fetch;
|
|
162
|
+
baseUrl?: string;
|
|
163
|
+
debug?: boolean;
|
|
164
|
+
}
|
|
165
|
+
interface FunctionOptions {
|
|
166
|
+
/** Base URL for Zapier API */
|
|
167
|
+
baseUrl?: string;
|
|
168
|
+
/** Authentication token */
|
|
169
|
+
token?: string;
|
|
170
|
+
/** Function to dynamically resolve authentication token */
|
|
171
|
+
getToken?: () => Promise<string | undefined>;
|
|
172
|
+
/** Optional pre-instantiated API client */
|
|
173
|
+
api?: any;
|
|
174
|
+
/** Enable debug logging */
|
|
175
|
+
debug?: boolean;
|
|
176
|
+
/** Custom fetch implementation */
|
|
177
|
+
fetch?: typeof globalThis.fetch;
|
|
178
|
+
}
|
|
179
|
+
declare class ZapierSdkError extends Error {
|
|
180
|
+
code?: string | undefined;
|
|
181
|
+
constructor(message: string, code?: string | undefined);
|
|
182
|
+
}
|
|
183
|
+
declare class AppNotFoundError extends ZapierSdkError {
|
|
184
|
+
appKey: string;
|
|
185
|
+
constructor(appKey: string);
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
declare const AppKeyPropertySchema: z.ZodString;
|
|
189
|
+
declare const ActionTypePropertySchema: z.ZodEnum<["read", "read_bulk", "write", "run", "search", "search_or_write", "search_and_write", "filter"]>;
|
|
190
|
+
declare const ActionKeyPropertySchema: z.ZodString;
|
|
191
|
+
declare const AuthenticationIdPropertySchema: z.ZodNumber;
|
|
192
|
+
declare const InputsPropertySchema: z.ZodRecord<z.ZodString, z.ZodAny>;
|
|
193
|
+
declare const LimitPropertySchema: z.ZodDefault<z.ZodNumber>;
|
|
194
|
+
declare const OffsetPropertySchema: z.ZodDefault<z.ZodNumber>;
|
|
195
|
+
declare const OutputPropertySchema: z.ZodString;
|
|
196
|
+
declare const DebugPropertySchema: z.ZodDefault<z.ZodBoolean>;
|
|
197
|
+
declare const ParamsPropertySchema: z.ZodRecord<z.ZodString, z.ZodAny>;
|
|
198
|
+
type AppKeyProperty = z.infer<typeof AppKeyPropertySchema>;
|
|
199
|
+
type ActionTypeProperty = z.infer<typeof ActionTypePropertySchema>;
|
|
200
|
+
type ActionKeyProperty = z.infer<typeof ActionKeyPropertySchema>;
|
|
201
|
+
type AuthenticationIdProperty = z.infer<typeof AuthenticationIdPropertySchema>;
|
|
202
|
+
type InputsProperty = z.infer<typeof InputsPropertySchema>;
|
|
203
|
+
type LimitProperty = z.infer<typeof LimitPropertySchema>;
|
|
204
|
+
type OffsetProperty = z.infer<typeof OffsetPropertySchema>;
|
|
205
|
+
type OutputProperty = z.infer<typeof OutputPropertySchema>;
|
|
206
|
+
type DebugProperty = z.infer<typeof DebugPropertySchema>;
|
|
207
|
+
type ParamsProperty = z.infer<typeof ParamsPropertySchema>;
|
|
208
|
+
|
|
209
|
+
interface AppFactoryOptions {
|
|
210
|
+
authenticationId: number;
|
|
211
|
+
}
|
|
212
|
+
interface BaseActionTypeProxy {
|
|
213
|
+
[action: string]: (options?: ActionExecutionOptions) => Promise<ActionExecutionResult>;
|
|
214
|
+
}
|
|
215
|
+
interface FetchActionType {
|
|
216
|
+
fetch: (url: string | URL, init?: RequestInit & {
|
|
217
|
+
authenticationId?: number;
|
|
218
|
+
callbackUrl?: string;
|
|
219
|
+
authenticationTemplate?: string;
|
|
220
|
+
}) => Promise<Response>;
|
|
221
|
+
}
|
|
222
|
+
type ActionTypeProxy = BaseActionTypeProxy & Partial<FetchActionType>;
|
|
223
|
+
interface AppProxy {
|
|
224
|
+
[type: string]: ActionTypeProxy;
|
|
225
|
+
}
|
|
226
|
+
interface AppFactory {
|
|
227
|
+
(options: AppFactoryOptions): AppProxy;
|
|
228
|
+
}
|
|
229
|
+
type AppProxyWithFactory = AppFactory & AppProxy;
|
|
230
|
+
interface ActionProxy {
|
|
231
|
+
[app: string]: AppProxyWithFactory;
|
|
232
|
+
}
|
|
233
|
+
interface AppsPluginSdkExtension {
|
|
234
|
+
apps: ActionProxy;
|
|
235
|
+
}
|
|
236
|
+
|
|
237
|
+
declare const ListActionsSchema: z.ZodObject<{
|
|
238
|
+
appKey: z.ZodOptional<z.ZodString>;
|
|
239
|
+
type: z.ZodOptional<z.ZodEnum<["read", "read_bulk", "write", "run", "search", "search_or_write", "search_and_write", "filter"]>>;
|
|
240
|
+
}, "strip", z.ZodTypeAny, {
|
|
241
|
+
type?: "read" | "read_bulk" | "write" | "run" | "search" | "search_or_write" | "search_and_write" | "filter" | undefined;
|
|
242
|
+
appKey?: string | undefined;
|
|
243
|
+
}, {
|
|
244
|
+
type?: "read" | "read_bulk" | "write" | "run" | "search" | "search_or_write" | "search_and_write" | "filter" | undefined;
|
|
245
|
+
appKey?: string | undefined;
|
|
246
|
+
}>;
|
|
247
|
+
type ListActionsOptions = z.infer<typeof ListActionsSchema> & FunctionOptions;
|
|
248
|
+
interface ListActionsSdkFunction {
|
|
249
|
+
listActions: (options?: Partial<ListActionsOptions>) => Promise<Action[]>;
|
|
250
|
+
}
|
|
251
|
+
|
|
252
|
+
declare const GetActionSchema: z.ZodObject<{
|
|
253
|
+
appKey: z.ZodString;
|
|
254
|
+
actionType: z.ZodEnum<["read", "read_bulk", "write", "run", "search", "search_or_write", "search_and_write", "filter"]>;
|
|
255
|
+
actionKey: z.ZodString;
|
|
256
|
+
}, "strip", z.ZodTypeAny, {
|
|
257
|
+
appKey: string;
|
|
258
|
+
actionType: "read" | "read_bulk" | "write" | "run" | "search" | "search_or_write" | "search_and_write" | "filter";
|
|
259
|
+
actionKey: string;
|
|
260
|
+
}, {
|
|
261
|
+
appKey: string;
|
|
262
|
+
actionType: "read" | "read_bulk" | "write" | "run" | "search" | "search_or_write" | "search_and_write" | "filter";
|
|
263
|
+
actionKey: string;
|
|
264
|
+
}>;
|
|
265
|
+
type GetActionOptions = z.infer<typeof GetActionSchema> & FunctionOptions;
|
|
266
|
+
interface GetActionSdkFunction {
|
|
267
|
+
getAction: (options: GetActionOptions) => Promise<Action>;
|
|
268
|
+
}
|
|
269
|
+
|
|
270
|
+
declare const GetAppSchema: z.ZodObject<{
|
|
271
|
+
appKey: z.ZodString;
|
|
272
|
+
}, "strip", z.ZodTypeAny, {
|
|
273
|
+
appKey: string;
|
|
274
|
+
}, {
|
|
275
|
+
appKey: string;
|
|
276
|
+
}>;
|
|
277
|
+
type GetAppOptions = z.infer<typeof GetAppSchema> & FunctionOptions;
|
|
278
|
+
interface GetAppSdkFunction {
|
|
279
|
+
getApp: (options: GetAppOptions) => Promise<Integration>;
|
|
280
|
+
}
|
|
281
|
+
|
|
282
|
+
declare const RunActionSchema: z.ZodObject<{
|
|
283
|
+
appKey: z.ZodString;
|
|
284
|
+
actionType: z.ZodEnum<["read", "read_bulk", "write", "run", "search", "search_or_write", "search_and_write", "filter"]>;
|
|
285
|
+
actionKey: z.ZodString;
|
|
286
|
+
inputs: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
|
|
287
|
+
authenticationId: z.ZodOptional<z.ZodNumber>;
|
|
288
|
+
}, "strip", z.ZodTypeAny, {
|
|
289
|
+
appKey: string;
|
|
290
|
+
actionType: "read" | "read_bulk" | "write" | "run" | "search" | "search_or_write" | "search_and_write" | "filter";
|
|
291
|
+
actionKey: string;
|
|
292
|
+
inputs?: Record<string, any> | undefined;
|
|
293
|
+
authenticationId?: number | undefined;
|
|
294
|
+
}, {
|
|
295
|
+
appKey: string;
|
|
296
|
+
actionType: "read" | "read_bulk" | "write" | "run" | "search" | "search_or_write" | "search_and_write" | "filter";
|
|
297
|
+
actionKey: string;
|
|
298
|
+
inputs?: Record<string, any> | undefined;
|
|
299
|
+
authenticationId?: number | undefined;
|
|
300
|
+
}>;
|
|
301
|
+
type RunActionOptions = z.infer<typeof RunActionSchema> & FunctionOptions;
|
|
302
|
+
interface RunActionSdkFunction {
|
|
303
|
+
runAction: (options: RunActionOptions) => Promise<ActionExecutionResult>;
|
|
304
|
+
}
|
|
305
|
+
|
|
306
|
+
declare const ListFieldsSchema: z.ZodObject<{
|
|
307
|
+
appKey: z.ZodString;
|
|
308
|
+
actionType: z.ZodEnum<["read", "read_bulk", "write", "run", "search", "search_or_write", "search_and_write", "filter"]>;
|
|
309
|
+
actionKey: z.ZodString;
|
|
310
|
+
authenticationId: z.ZodOptional<z.ZodNumber>;
|
|
311
|
+
params: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
|
|
312
|
+
}, "strip", z.ZodTypeAny, {
|
|
313
|
+
appKey: string;
|
|
314
|
+
actionType: "read" | "read_bulk" | "write" | "run" | "search" | "search_or_write" | "search_and_write" | "filter";
|
|
315
|
+
actionKey: string;
|
|
316
|
+
params?: Record<string, any> | undefined;
|
|
317
|
+
authenticationId?: number | undefined;
|
|
318
|
+
}, {
|
|
319
|
+
appKey: string;
|
|
320
|
+
actionType: "read" | "read_bulk" | "write" | "run" | "search" | "search_or_write" | "search_and_write" | "filter";
|
|
321
|
+
actionKey: string;
|
|
322
|
+
params?: Record<string, any> | undefined;
|
|
323
|
+
authenticationId?: number | undefined;
|
|
324
|
+
}>;
|
|
325
|
+
type ListFieldsOptions = z.infer<typeof ListFieldsSchema> & FunctionOptions;
|
|
326
|
+
interface ListFieldsSdkFunction {
|
|
327
|
+
listFields: (options: ListFieldsOptions) => Promise<ActionField[]>;
|
|
328
|
+
}
|
|
329
|
+
|
|
330
|
+
declare const ListAuthenticationsSchema: z.ZodObject<{
|
|
331
|
+
appKey: z.ZodOptional<z.ZodString>;
|
|
332
|
+
search: z.ZodOptional<z.ZodString>;
|
|
333
|
+
title: z.ZodOptional<z.ZodString>;
|
|
334
|
+
account_id: z.ZodOptional<z.ZodString>;
|
|
335
|
+
owner: z.ZodOptional<z.ZodString>;
|
|
336
|
+
limit: z.ZodOptional<z.ZodDefault<z.ZodNumber>>;
|
|
337
|
+
offset: z.ZodOptional<z.ZodDefault<z.ZodNumber>>;
|
|
338
|
+
}, "strip", z.ZodTypeAny, {
|
|
339
|
+
search?: string | undefined;
|
|
340
|
+
appKey?: string | undefined;
|
|
341
|
+
title?: string | undefined;
|
|
342
|
+
account_id?: string | undefined;
|
|
343
|
+
owner?: string | undefined;
|
|
344
|
+
limit?: number | undefined;
|
|
345
|
+
offset?: number | undefined;
|
|
346
|
+
}, {
|
|
347
|
+
search?: string | undefined;
|
|
348
|
+
appKey?: string | undefined;
|
|
349
|
+
title?: string | undefined;
|
|
350
|
+
account_id?: string | undefined;
|
|
351
|
+
owner?: string | undefined;
|
|
352
|
+
limit?: number | undefined;
|
|
353
|
+
offset?: number | undefined;
|
|
354
|
+
}>;
|
|
355
|
+
type ListAuthenticationsOptions = z.infer<typeof ListAuthenticationsSchema> & FunctionOptions;
|
|
356
|
+
interface ListAuthenticationsSdkFunction {
|
|
357
|
+
listAuthentications: (options?: Partial<ListAuthenticationsOptions>) => Promise<Authentication[]>;
|
|
358
|
+
}
|
|
359
|
+
|
|
360
|
+
declare const GetAuthenticationSchema: z.ZodObject<{
|
|
361
|
+
authenticationId: z.ZodNumber;
|
|
362
|
+
}, "strip", z.ZodTypeAny, {
|
|
363
|
+
authenticationId: number;
|
|
364
|
+
}, {
|
|
365
|
+
authenticationId: number;
|
|
366
|
+
}>;
|
|
367
|
+
type GetAuthenticationOptions = z.infer<typeof GetAuthenticationSchema> & FunctionOptions;
|
|
368
|
+
interface GetAuthenticationSdkFunction {
|
|
369
|
+
getAuthentication: (options: GetAuthenticationOptions) => Promise<Authentication>;
|
|
370
|
+
}
|
|
371
|
+
|
|
372
|
+
declare const FindFirstAuthenticationSchema: z.ZodObject<{
|
|
373
|
+
appKey: z.ZodOptional<z.ZodString>;
|
|
374
|
+
search: z.ZodOptional<z.ZodString>;
|
|
375
|
+
title: z.ZodOptional<z.ZodString>;
|
|
376
|
+
account_id: z.ZodOptional<z.ZodString>;
|
|
377
|
+
owner: z.ZodOptional<z.ZodString>;
|
|
378
|
+
limit: z.ZodOptional<z.ZodDefault<z.ZodNumber>>;
|
|
379
|
+
offset: z.ZodOptional<z.ZodDefault<z.ZodNumber>>;
|
|
380
|
+
}, "strip", z.ZodTypeAny, {
|
|
381
|
+
search?: string | undefined;
|
|
382
|
+
appKey?: string | undefined;
|
|
383
|
+
title?: string | undefined;
|
|
384
|
+
account_id?: string | undefined;
|
|
385
|
+
owner?: string | undefined;
|
|
386
|
+
limit?: number | undefined;
|
|
387
|
+
offset?: number | undefined;
|
|
388
|
+
}, {
|
|
389
|
+
search?: string | undefined;
|
|
390
|
+
appKey?: string | undefined;
|
|
391
|
+
title?: string | undefined;
|
|
392
|
+
account_id?: string | undefined;
|
|
393
|
+
owner?: string | undefined;
|
|
394
|
+
limit?: number | undefined;
|
|
395
|
+
offset?: number | undefined;
|
|
396
|
+
}>;
|
|
397
|
+
type FindFirstAuthenticationOptions = z.infer<typeof FindFirstAuthenticationSchema> & FunctionOptions;
|
|
398
|
+
interface FindFirstAuthenticationSdkFunction {
|
|
399
|
+
findFirstAuthentication: (options?: Partial<FindFirstAuthenticationOptions>) => Promise<Authentication | null>;
|
|
400
|
+
}
|
|
401
|
+
|
|
402
|
+
declare const FindUniqueAuthenticationSchema: z.ZodObject<{
|
|
403
|
+
appKey: z.ZodOptional<z.ZodString>;
|
|
404
|
+
search: z.ZodOptional<z.ZodString>;
|
|
405
|
+
title: z.ZodOptional<z.ZodString>;
|
|
406
|
+
account_id: z.ZodOptional<z.ZodString>;
|
|
407
|
+
owner: z.ZodOptional<z.ZodString>;
|
|
408
|
+
limit: z.ZodOptional<z.ZodDefault<z.ZodNumber>>;
|
|
409
|
+
offset: z.ZodOptional<z.ZodDefault<z.ZodNumber>>;
|
|
410
|
+
}, "strip", z.ZodTypeAny, {
|
|
411
|
+
search?: string | undefined;
|
|
412
|
+
appKey?: string | undefined;
|
|
413
|
+
title?: string | undefined;
|
|
414
|
+
account_id?: string | undefined;
|
|
415
|
+
owner?: string | undefined;
|
|
416
|
+
limit?: number | undefined;
|
|
417
|
+
offset?: number | undefined;
|
|
418
|
+
}, {
|
|
419
|
+
search?: string | undefined;
|
|
420
|
+
appKey?: string | undefined;
|
|
421
|
+
title?: string | undefined;
|
|
422
|
+
account_id?: string | undefined;
|
|
423
|
+
owner?: string | undefined;
|
|
424
|
+
limit?: number | undefined;
|
|
425
|
+
offset?: number | undefined;
|
|
426
|
+
}>;
|
|
427
|
+
type FindUniqueAuthenticationOptions = z.infer<typeof FindUniqueAuthenticationSchema> & FunctionOptions;
|
|
428
|
+
interface FindUniqueAuthenticationSdkFunction {
|
|
429
|
+
findUniqueAuthentication: (options?: Partial<FindUniqueAuthenticationOptions>) => Promise<Authentication>;
|
|
430
|
+
}
|
|
431
|
+
|
|
432
|
+
declare const GenerateTypesSchema: z.ZodObject<{
|
|
433
|
+
appKey: z.ZodString;
|
|
434
|
+
authenticationId: z.ZodOptional<z.ZodNumber>;
|
|
435
|
+
output: z.ZodOptional<z.ZodString>;
|
|
436
|
+
debug: z.ZodDefault<z.ZodBoolean>;
|
|
437
|
+
}, "strip", z.ZodTypeAny, {
|
|
438
|
+
appKey: string;
|
|
439
|
+
debug: boolean;
|
|
440
|
+
authenticationId?: number | undefined;
|
|
441
|
+
output?: string | undefined;
|
|
442
|
+
}, {
|
|
443
|
+
appKey: string;
|
|
444
|
+
authenticationId?: number | undefined;
|
|
445
|
+
output?: string | undefined;
|
|
446
|
+
debug?: boolean | undefined;
|
|
447
|
+
}>;
|
|
448
|
+
type GenerateTypesOptions = z.infer<typeof GenerateTypesSchema> & FunctionOptions;
|
|
449
|
+
interface GenerateTypesSdkFunction {
|
|
450
|
+
generateTypes: (options: GenerateTypesOptions) => Promise<string>;
|
|
451
|
+
}
|
|
452
|
+
|
|
453
|
+
declare const ListAppsSchema: z.ZodObject<{
|
|
454
|
+
category: z.ZodOptional<z.ZodString>;
|
|
455
|
+
limit: z.ZodOptional<z.ZodDefault<z.ZodNumber>>;
|
|
456
|
+
offset: z.ZodOptional<z.ZodDefault<z.ZodNumber>>;
|
|
457
|
+
}, "strip", z.ZodTypeAny, {
|
|
458
|
+
limit?: number | undefined;
|
|
459
|
+
offset?: number | undefined;
|
|
460
|
+
category?: string | undefined;
|
|
461
|
+
}, {
|
|
462
|
+
limit?: number | undefined;
|
|
463
|
+
offset?: number | undefined;
|
|
464
|
+
category?: string | undefined;
|
|
465
|
+
}>;
|
|
466
|
+
type ListAppsOptions = z.infer<typeof ListAppsSchema> & FunctionOptions;
|
|
467
|
+
interface ListAppsSdkFunction {
|
|
468
|
+
listApps: (options?: Partial<ListAppsOptions>) => Promise<Integration[]>;
|
|
469
|
+
}
|
|
470
|
+
|
|
471
|
+
declare const BundleCodeSchema: z.ZodObject<{
|
|
472
|
+
input: z.ZodString;
|
|
473
|
+
output: z.ZodOptional<z.ZodString>;
|
|
474
|
+
string: z.ZodDefault<z.ZodBoolean>;
|
|
475
|
+
minify: z.ZodDefault<z.ZodBoolean>;
|
|
476
|
+
target: z.ZodDefault<z.ZodString>;
|
|
477
|
+
cjs: z.ZodDefault<z.ZodBoolean>;
|
|
478
|
+
}, "strip", z.ZodTypeAny, {
|
|
479
|
+
string: boolean;
|
|
480
|
+
input: string;
|
|
481
|
+
minify: boolean;
|
|
482
|
+
target: string;
|
|
483
|
+
cjs: boolean;
|
|
484
|
+
output?: string | undefined;
|
|
485
|
+
}, {
|
|
486
|
+
input: string;
|
|
487
|
+
string?: boolean | undefined;
|
|
488
|
+
output?: string | undefined;
|
|
489
|
+
minify?: boolean | undefined;
|
|
490
|
+
target?: string | undefined;
|
|
491
|
+
cjs?: boolean | undefined;
|
|
492
|
+
}>;
|
|
493
|
+
type BundleCodeOptions = z.infer<typeof BundleCodeSchema>;
|
|
494
|
+
interface BundleCodeSdkFunction {
|
|
495
|
+
bundleCode: (options: BundleCodeOptions) => Promise<string>;
|
|
496
|
+
}
|
|
497
|
+
|
|
498
|
+
declare const RelayRequestSchema: z.ZodObject<{
|
|
499
|
+
url: z.ZodString;
|
|
500
|
+
method: z.ZodOptional<z.ZodEnum<["GET", "POST", "PUT", "DELETE", "PATCH", "HEAD", "OPTIONS"]>>;
|
|
501
|
+
body: z.ZodOptional<z.ZodString>;
|
|
502
|
+
authenticationId: z.ZodOptional<z.ZodNumber>;
|
|
503
|
+
callbackUrl: z.ZodOptional<z.ZodString>;
|
|
504
|
+
authenticationTemplate: z.ZodOptional<z.ZodString>;
|
|
505
|
+
headers: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
506
|
+
}, "strip", z.ZodTypeAny, {
|
|
507
|
+
url: string;
|
|
508
|
+
authenticationId?: number | undefined;
|
|
509
|
+
method?: "GET" | "POST" | "PUT" | "DELETE" | "PATCH" | "HEAD" | "OPTIONS" | undefined;
|
|
510
|
+
body?: string | undefined;
|
|
511
|
+
callbackUrl?: string | undefined;
|
|
512
|
+
authenticationTemplate?: string | undefined;
|
|
513
|
+
headers?: Record<string, string> | undefined;
|
|
514
|
+
}, {
|
|
515
|
+
url: string;
|
|
516
|
+
authenticationId?: number | undefined;
|
|
517
|
+
method?: "GET" | "POST" | "PUT" | "DELETE" | "PATCH" | "HEAD" | "OPTIONS" | undefined;
|
|
518
|
+
body?: string | undefined;
|
|
519
|
+
callbackUrl?: string | undefined;
|
|
520
|
+
authenticationTemplate?: string | undefined;
|
|
521
|
+
headers?: Record<string, string> | undefined;
|
|
522
|
+
}>;
|
|
523
|
+
type RelayRequestOptions$1 = z.infer<typeof RelayRequestSchema> & FunctionOptions & {
|
|
524
|
+
/** Base URL for Relay service */
|
|
525
|
+
relayBaseUrl?: string;
|
|
526
|
+
};
|
|
527
|
+
interface RelayRequestSdkFunction {
|
|
528
|
+
request: (options: RelayRequestOptions$1) => Promise<Response>;
|
|
529
|
+
}
|
|
530
|
+
declare const RelayFetchSchema: z.ZodObject<{
|
|
531
|
+
url: z.ZodString;
|
|
532
|
+
method: z.ZodOptional<z.ZodEnum<["GET", "POST", "PUT", "DELETE", "PATCH", "HEAD", "OPTIONS"]>>;
|
|
533
|
+
body: z.ZodOptional<z.ZodString>;
|
|
534
|
+
authenticationId: z.ZodOptional<z.ZodNumber>;
|
|
535
|
+
callbackUrl: z.ZodOptional<z.ZodString>;
|
|
536
|
+
authenticationTemplate: z.ZodOptional<z.ZodString>;
|
|
537
|
+
headers: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
538
|
+
}, "strip", z.ZodTypeAny, {
|
|
539
|
+
url: string;
|
|
540
|
+
authenticationId?: number | undefined;
|
|
541
|
+
method?: "GET" | "POST" | "PUT" | "DELETE" | "PATCH" | "HEAD" | "OPTIONS" | undefined;
|
|
542
|
+
body?: string | undefined;
|
|
543
|
+
callbackUrl?: string | undefined;
|
|
544
|
+
authenticationTemplate?: string | undefined;
|
|
545
|
+
headers?: Record<string, string> | undefined;
|
|
546
|
+
}, {
|
|
547
|
+
url: string;
|
|
548
|
+
authenticationId?: number | undefined;
|
|
549
|
+
method?: "GET" | "POST" | "PUT" | "DELETE" | "PATCH" | "HEAD" | "OPTIONS" | undefined;
|
|
550
|
+
body?: string | undefined;
|
|
551
|
+
callbackUrl?: string | undefined;
|
|
552
|
+
authenticationTemplate?: string | undefined;
|
|
553
|
+
headers?: Record<string, string> | undefined;
|
|
554
|
+
}>;
|
|
555
|
+
|
|
556
|
+
interface FetchPluginOptions {
|
|
557
|
+
sdk: ZapierSdk;
|
|
558
|
+
}
|
|
559
|
+
/**
|
|
560
|
+
* Creates a fetch function with standard fetch signature that delegates to sdk.request
|
|
561
|
+
*/
|
|
562
|
+
declare function createFetchPlugin(options: FetchPluginOptions): (url: string | URL, init?: RequestInit & {
|
|
563
|
+
authenticationId?: number;
|
|
564
|
+
callbackUrl?: string;
|
|
565
|
+
authenticationTemplate?: string;
|
|
566
|
+
}) => Promise<Response>;
|
|
567
|
+
interface FetchPluginSdkExtension {
|
|
568
|
+
fetch: (url: string | URL, init?: RequestInit & {
|
|
569
|
+
authenticationId?: number;
|
|
570
|
+
callbackUrl?: string;
|
|
571
|
+
authenticationTemplate?: string;
|
|
572
|
+
}) => Promise<Response>;
|
|
573
|
+
}
|
|
574
|
+
|
|
575
|
+
interface ZapierSdkFunctions extends ListActionsSdkFunction, GetActionSdkFunction, GetAppSdkFunction, RunActionSdkFunction, ListFieldsSdkFunction, ListAuthenticationsSdkFunction, GetAuthenticationSdkFunction, FindFirstAuthenticationSdkFunction, FindUniqueAuthenticationSdkFunction, GenerateTypesSdkFunction, ListAppsSdkFunction, BundleCodeSdkFunction, RelayRequestSdkFunction {
|
|
576
|
+
}
|
|
577
|
+
interface ZapierSdkPlugins extends AppsPluginSdkExtension, FetchPluginSdkExtension {
|
|
578
|
+
}
|
|
579
|
+
interface BaseZapierSdk extends ZapierSdkFunctions {
|
|
580
|
+
__registry: Array<{
|
|
581
|
+
name: string;
|
|
582
|
+
inputSchema: any;
|
|
583
|
+
implementation: Function;
|
|
584
|
+
}>;
|
|
585
|
+
}
|
|
586
|
+
interface ZapierSdk extends ZapierSdkFunctions, ZapierSdkPlugins {
|
|
587
|
+
__registry: Array<{
|
|
588
|
+
name: string;
|
|
589
|
+
inputSchema: any;
|
|
590
|
+
implementation: Function;
|
|
591
|
+
}>;
|
|
592
|
+
}
|
|
593
|
+
|
|
594
|
+
interface AppsPluginOptions {
|
|
595
|
+
sdk: ZapierSdk;
|
|
596
|
+
}
|
|
597
|
+
declare function createAppsPlugin(options: AppsPluginOptions): ActionProxy;
|
|
598
|
+
|
|
599
|
+
declare function isPositional(schema: z.ZodType): boolean;
|
|
600
|
+
|
|
601
|
+
/**
|
|
602
|
+
* SDK Authentication Utilities
|
|
603
|
+
*
|
|
604
|
+
* This module provides SDK-level authentication utilities focused
|
|
605
|
+
* solely on token acquisition. CLI-specific functionality like login/logout
|
|
606
|
+
* is handled by the @zapier/zapier-sdk-cli-login package.
|
|
607
|
+
*/
|
|
608
|
+
|
|
609
|
+
interface AuthOptions {
|
|
610
|
+
onEvent?: EventCallback;
|
|
611
|
+
fetch?: typeof globalThis.fetch;
|
|
612
|
+
}
|
|
613
|
+
/**
|
|
614
|
+
* Gets the ZAPIER_TOKEN from environment variables.
|
|
615
|
+
* Returns undefined if not set.
|
|
616
|
+
*/
|
|
617
|
+
declare function getTokenFromEnv(): string | undefined;
|
|
618
|
+
/**
|
|
619
|
+
* Attempts to get a token by optionally importing from CLI login package.
|
|
620
|
+
* This provides a graceful fallback when the CLI login package is not available.
|
|
621
|
+
*
|
|
622
|
+
* Returns undefined if no valid token is found or CLI package is not available.
|
|
623
|
+
*/
|
|
624
|
+
declare function getTokenFromCliLogin(options?: AuthOptions): Promise<string | undefined>;
|
|
625
|
+
/**
|
|
626
|
+
* Attempts to get a token with the following precedence:
|
|
627
|
+
* 1. ZAPIER_TOKEN environment variable
|
|
628
|
+
* 2. CLI login package (if available) with auto-refresh
|
|
629
|
+
*
|
|
630
|
+
* Returns undefined if no valid token is found.
|
|
631
|
+
*/
|
|
632
|
+
declare function getTokenFromEnvOrConfig(options?: AuthOptions): Promise<string | undefined>;
|
|
633
|
+
|
|
634
|
+
interface InputsResolver {
|
|
635
|
+
type: "fields";
|
|
636
|
+
depends: readonly string[];
|
|
637
|
+
fetch: (sdk: ZapierSdk, resolvedParams: Record<string, any>) => Promise<any[]>;
|
|
638
|
+
}
|
|
639
|
+
declare const inputsResolver: InputsResolver;
|
|
640
|
+
|
|
641
|
+
interface AuthenticationIdResolver {
|
|
642
|
+
type: "dynamic";
|
|
643
|
+
depends: readonly string[];
|
|
644
|
+
fetch: (sdk: ZapierSdk, resolvedParams: Record<string, any>) => Promise<any[]>;
|
|
645
|
+
prompt: (items: any[], params: Record<string, any>) => any;
|
|
646
|
+
}
|
|
647
|
+
declare const authenticationIdResolver: AuthenticationIdResolver;
|
|
648
|
+
|
|
649
|
+
interface ActionKeyResolver {
|
|
650
|
+
type: "dynamic";
|
|
651
|
+
depends: readonly string[];
|
|
652
|
+
fetch: (sdk: ZapierSdk, resolvedParams: Record<string, any>) => Promise<any[]>;
|
|
653
|
+
prompt: (items: any[], params: Record<string, any>) => any;
|
|
654
|
+
}
|
|
655
|
+
declare const actionKeyResolver: ActionKeyResolver;
|
|
656
|
+
|
|
657
|
+
interface ActionTypeResolver {
|
|
658
|
+
type: "dynamic";
|
|
659
|
+
depends: readonly string[];
|
|
660
|
+
fetch: (sdk: ZapierSdk, resolvedParams: Record<string, any>) => Promise<any[]>;
|
|
661
|
+
prompt: (items: any[], params: Record<string, any>) => any;
|
|
662
|
+
}
|
|
663
|
+
declare const actionTypeResolver: ActionTypeResolver;
|
|
664
|
+
|
|
665
|
+
interface AppKeyResolver {
|
|
666
|
+
type: "static";
|
|
667
|
+
inputType?: "text" | "password" | "email";
|
|
668
|
+
placeholder?: string;
|
|
669
|
+
}
|
|
670
|
+
declare const appKeyResolver: AppKeyResolver;
|
|
671
|
+
|
|
672
|
+
declare const resolverRegistry: {
|
|
673
|
+
readonly appKey: AppKeyResolver;
|
|
674
|
+
readonly actionType: ActionTypeResolver;
|
|
675
|
+
readonly actionKey: ActionKeyResolver;
|
|
676
|
+
readonly authenticationId: AuthenticationIdResolver;
|
|
677
|
+
readonly inputs: InputsResolver;
|
|
678
|
+
};
|
|
679
|
+
type ResolverName = keyof typeof resolverRegistry;
|
|
680
|
+
type ResolverType = (typeof resolverRegistry)[ResolverName];
|
|
681
|
+
/**
|
|
682
|
+
* Get a resolver by name
|
|
683
|
+
*/
|
|
684
|
+
declare function getResolver(name: string): ResolverType | undefined;
|
|
685
|
+
/**
|
|
686
|
+
* Get all resolvers for a list of missing parameters
|
|
687
|
+
*/
|
|
688
|
+
declare function getResolversForMissingParams(missingParams: string[]): Record<string, ResolverType>;
|
|
689
|
+
/**
|
|
690
|
+
* Check if a parameter has a resolver
|
|
691
|
+
*/
|
|
692
|
+
declare function hasResolver(paramName: string): boolean;
|
|
693
|
+
/**
|
|
694
|
+
* Get all parameter names that have resolvers
|
|
695
|
+
*/
|
|
696
|
+
declare function getResolvableParams(): string[];
|
|
697
|
+
/**
|
|
698
|
+
* Resolve dependency chain for a parameter
|
|
699
|
+
* Returns parameters in the order they need to be resolved
|
|
700
|
+
*/
|
|
701
|
+
declare function getResolutionOrder(paramName: string, resolved?: Set<string>): string[];
|
|
702
|
+
/**
|
|
703
|
+
* Get resolution order for multiple parameters
|
|
704
|
+
*/
|
|
705
|
+
declare function getResolutionOrderForParams(paramNames: string[]): string[];
|
|
706
|
+
|
|
707
|
+
/**
|
|
708
|
+
* List available authentications with optional filtering
|
|
709
|
+
*
|
|
710
|
+
* This function can be used standalone without instantiating a full SDK,
|
|
711
|
+
* which enables better tree-shaking in applications that only need this functionality.
|
|
712
|
+
*
|
|
713
|
+
* @param options - Filtering, pagination, and API configuration options
|
|
714
|
+
* @returns Promise<Authentication[]> with pagination metadata
|
|
715
|
+
*/
|
|
716
|
+
declare function listAuthentications(options?: Partial<ListAuthenticationsOptions>): Promise<Authentication[]>;
|
|
717
|
+
|
|
718
|
+
/**
|
|
719
|
+
* Get a specific authentication by ID
|
|
720
|
+
*
|
|
721
|
+
* This function can be used standalone without instantiating a full SDK,
|
|
722
|
+
* which enables better tree-shaking in applications that only need this functionality.
|
|
723
|
+
*
|
|
724
|
+
* @param options - Authentication ID and API configuration options
|
|
725
|
+
* @returns Promise<Authentication> - The authentication details
|
|
726
|
+
* @throws Error if authentication not found or access denied
|
|
727
|
+
*/
|
|
728
|
+
declare function getAuthentication(options: GetAuthenticationOptions): Promise<Authentication>;
|
|
729
|
+
|
|
730
|
+
/**
|
|
731
|
+
* Find the first authentication matching the given criteria
|
|
732
|
+
*
|
|
733
|
+
* This function can be used standalone without instantiating a full SDK,
|
|
734
|
+
* which enables better tree-shaking in applications that only need this functionality.
|
|
735
|
+
*
|
|
736
|
+
* @param options - Filtering and API configuration options
|
|
737
|
+
* @returns Promise<Authentication | null> - First matching authentication or null if not found
|
|
738
|
+
*/
|
|
739
|
+
declare function findFirstAuthentication(options?: Partial<FindFirstAuthenticationOptions>): Promise<Authentication | null>;
|
|
740
|
+
|
|
741
|
+
/**
|
|
742
|
+
* Find a unique authentication matching the given criteria
|
|
743
|
+
*
|
|
744
|
+
* This function can be used standalone without instantiating a full SDK,
|
|
745
|
+
* which enables better tree-shaking in applications that only need this functionality.
|
|
746
|
+
*
|
|
747
|
+
* @param options - Filtering and API configuration options
|
|
748
|
+
* @returns Promise<Authentication> - The unique matching authentication
|
|
749
|
+
* @throws Error if no authentication found or multiple authentications found
|
|
750
|
+
*/
|
|
751
|
+
declare function findUniqueAuthentication(options?: Partial<FindUniqueAuthenticationOptions>): Promise<Authentication>;
|
|
752
|
+
|
|
753
|
+
/**
|
|
754
|
+
* List available apps with optional filtering
|
|
755
|
+
*
|
|
756
|
+
* This function can be used standalone without instantiating a full SDK,
|
|
757
|
+
* which enables better tree-shaking in applications that only need this functionality.
|
|
758
|
+
*
|
|
759
|
+
* @param options - Filtering, pagination, and API configuration options
|
|
760
|
+
* @returns Promise<Integration[]> with pagination metadata
|
|
761
|
+
*/
|
|
762
|
+
declare function listApps(options?: ListAppsOptions): Promise<Integration[]>;
|
|
763
|
+
|
|
764
|
+
/**
|
|
765
|
+
* Get a specific app by key
|
|
766
|
+
*
|
|
767
|
+
* This function can be used standalone without instantiating a full SDK,
|
|
768
|
+
* which enables better tree-shaking in applications that only need this functionality.
|
|
769
|
+
*
|
|
770
|
+
* @param options - App key and API configuration options
|
|
771
|
+
* @returns Promise<Integration>
|
|
772
|
+
*/
|
|
773
|
+
declare function getApp(options: GetAppOptions): Promise<Integration>;
|
|
774
|
+
|
|
775
|
+
/**
|
|
776
|
+
* List available actions with optional filtering
|
|
777
|
+
*
|
|
778
|
+
* This function can be used standalone without instantiating a full SDK,
|
|
779
|
+
* which enables better tree-shaking in applications that only need this functionality.
|
|
780
|
+
*
|
|
781
|
+
* @param options - Filtering and API configuration options
|
|
782
|
+
* @returns Promise<Action[]> with pagination metadata
|
|
783
|
+
*/
|
|
784
|
+
declare function listActions(options?: Partial<ListActionsOptions>): Promise<Action[]>;
|
|
785
|
+
|
|
786
|
+
/**
|
|
787
|
+
* Get a specific action by app, action key, and type
|
|
788
|
+
*
|
|
789
|
+
* This function can be used standalone without instantiating a full SDK,
|
|
790
|
+
* which enables better tree-shaking in applications that only need this functionality.
|
|
791
|
+
*
|
|
792
|
+
* @param options - App key, action key, type, and API configuration options
|
|
793
|
+
* @returns Promise<Action>
|
|
794
|
+
*/
|
|
795
|
+
declare function getAction(options: GetActionOptions): Promise<Action>;
|
|
796
|
+
|
|
797
|
+
/**
|
|
798
|
+
* Execute an action
|
|
799
|
+
*
|
|
800
|
+
* This function can be used standalone without instantiating a full SDK,
|
|
801
|
+
* which enables better tree-shaking in applications that only need this functionality.
|
|
802
|
+
*
|
|
803
|
+
* @param options - Action execution parameters and API configuration options
|
|
804
|
+
* @returns Promise<ActionExecutionResult>
|
|
805
|
+
*/
|
|
806
|
+
declare function runAction(options: RunActionOptions): Promise<ActionExecutionResult>;
|
|
807
|
+
|
|
808
|
+
/**
|
|
809
|
+
* List available fields for an action
|
|
810
|
+
*
|
|
811
|
+
* This function can be used standalone without instantiating a full SDK,
|
|
812
|
+
* which enables better tree-shaking in applications that only need this functionality.
|
|
813
|
+
*
|
|
814
|
+
* @param options - Action details, authentication ID, params, and API configuration options
|
|
815
|
+
* @returns Promise<ActionField[]>
|
|
816
|
+
*/
|
|
817
|
+
declare function listFields(options: ListFieldsOptions): Promise<ActionField[]>;
|
|
818
|
+
|
|
819
|
+
/**
|
|
820
|
+
* Generate TypeScript types for a specific app
|
|
821
|
+
*
|
|
822
|
+
* This function can be used standalone without instantiating a full SDK,
|
|
823
|
+
* which enables better tree-shaking in applications that only need this functionality.
|
|
824
|
+
*
|
|
825
|
+
* @param options - App key, authentication ID, output path, and API configuration options
|
|
826
|
+
* @returns Promise<string> - Generated TypeScript code
|
|
827
|
+
*/
|
|
828
|
+
declare function generateTypes(options: GenerateTypesOptions): Promise<string>;
|
|
829
|
+
|
|
830
|
+
/**
|
|
831
|
+
* Bundle TypeScript code into executable JavaScript
|
|
832
|
+
*
|
|
833
|
+
* This function can be used standalone without instantiating a full SDK,
|
|
834
|
+
* which enables better tree-shaking in applications that only need this functionality.
|
|
835
|
+
*
|
|
836
|
+
* @param options - Bundling configuration options
|
|
837
|
+
* @returns Promise<string> - Bundled JavaScript code
|
|
838
|
+
*/
|
|
839
|
+
declare function bundleCode(options: BundleCodeOptions): Promise<string>;
|
|
840
|
+
|
|
841
|
+
interface RelayRequestOptions {
|
|
842
|
+
/** HTTP method */
|
|
843
|
+
method?: string;
|
|
844
|
+
/** Request body (can be string, FormData, Blob, etc.) */
|
|
845
|
+
body?: BodyInit | null;
|
|
846
|
+
/** Request headers */
|
|
847
|
+
headers?: HeadersInit;
|
|
848
|
+
/** Zapier authentication ID to use for the request */
|
|
849
|
+
authenticationId?: number;
|
|
850
|
+
/** URL to send async response to (makes request async) */
|
|
851
|
+
callbackUrl?: string;
|
|
852
|
+
/** Optional JSON string authentication template to bypass Notary lookup */
|
|
853
|
+
authenticationTemplate?: string;
|
|
854
|
+
}
|
|
855
|
+
interface RelayFetchConfig extends FunctionOptions {
|
|
856
|
+
/** Event callback function */
|
|
857
|
+
onEvent?: (event: any) => void;
|
|
858
|
+
}
|
|
859
|
+
/**
|
|
860
|
+
* Fetch function that can make requests to external APIs through Zapier's Relay service
|
|
861
|
+
*
|
|
862
|
+
* This function takes full URLs (like https://api.github.com/user) and transforms them
|
|
863
|
+
* into the relay format (/relay/api.github.com/user) for the API client to route
|
|
864
|
+
* to relay.zapier.com.
|
|
865
|
+
*
|
|
866
|
+
* @param url - The full URL to fetch
|
|
867
|
+
* @param options - Fetch options with additional Relay-specific parameters
|
|
868
|
+
* @param config - SDK configuration options
|
|
869
|
+
* @returns Promise<Response> - The response from the request
|
|
870
|
+
*/
|
|
871
|
+
/**
|
|
872
|
+
* Schema-compatible wrapper function for the request functionality
|
|
873
|
+
*/
|
|
874
|
+
declare function request(options: {
|
|
875
|
+
url: string;
|
|
876
|
+
method?: string;
|
|
877
|
+
body?: BodyInit | null;
|
|
878
|
+
headers?: HeadersInit;
|
|
879
|
+
authenticationId?: number;
|
|
880
|
+
callbackUrl?: string;
|
|
881
|
+
authenticationTemplate?: string;
|
|
882
|
+
} & FunctionOptions): Promise<Response>;
|
|
883
|
+
/**
|
|
884
|
+
* Internal fetch implementation
|
|
885
|
+
*/
|
|
886
|
+
declare function relayFetch(url: string | URL, options?: RelayRequestOptions, config?: RelayFetchConfig): Promise<Response>;
|
|
887
|
+
|
|
888
|
+
interface ZapierSdkOptions extends BaseSdkOptions {
|
|
889
|
+
}
|
|
890
|
+
declare function createZapierSdk(options?: ZapierSdkOptions): ZapierSdk;
|
|
891
|
+
|
|
892
|
+
export { type Action, type ActionExecutionOptions, type ActionExecutionResult, type ActionField, type ActionFieldChoice, type ActionKeyProperty, ActionKeyPropertySchema, type ActionProxy, type ActionTypeProperty, ActionTypePropertySchema, type ApiEvent, type AppKeyProperty, AppKeyPropertySchema, AppNotFoundError, type AppsPluginOptions, type AppsPluginSdkExtension, type AuthEvent, type AuthObject, type AuthOptions, type Authentication, type AuthenticationIdProperty, AuthenticationIdPropertySchema, type AuthenticationsResponse, type BaseSdkOptions, type BaseZapierSdk, type Choice, type DebugProperty, DebugPropertySchema, type EventCallback, type FetchPluginOptions, type FetchPluginSdkExtension, type Field, type FunctionOptions, type InputsProperty, InputsPropertySchema, type Integration, type LimitProperty, LimitPropertySchema, type LoadingEvent, type NeedsRequest, type NeedsResponse, type OffsetProperty, OffsetPropertySchema, type OutputProperty, OutputPropertySchema, type ParamsProperty, ParamsPropertySchema, RelayFetchSchema, RelayRequestSchema, type ResolverName, type ResolverType, type SdkEvent, type Trigger, type ZapierSdk, ZapierSdkError, type ZapierSdkOptions, actionKeyResolver, actionTypeResolver, appKeyResolver, authenticationIdResolver, bundleCode, createAppsPlugin, createFetchPlugin, createZapierSdk, findFirstAuthentication, findUniqueAuthentication, generateTypes, getAction, getApp, getAuthentication, getResolutionOrder, getResolutionOrderForParams, getResolvableParams, getResolver, getResolversForMissingParams, getTokenFromCliLogin, getTokenFromEnv, getTokenFromEnvOrConfig, hasResolver, inputsResolver, isPositional, listActions, listApps, listAuthentications, listFields, relayFetch, request, resolverRegistry, runAction };
|