@zapier/zapier-sdk 0.0.3 → 0.1.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/api/auth.d.ts +8 -0
- package/dist/api/auth.js +29 -0
- package/dist/api/client.d.ts +8 -0
- package/dist/api/client.js +102 -0
- package/dist/api/debug.d.ts +12 -0
- package/dist/api/debug.js +50 -0
- package/dist/api/index.d.ts +26 -0
- package/dist/api/index.js +51 -0
- package/dist/api/polling.d.ts +17 -0
- package/dist/api/polling.js +34 -0
- package/dist/{types.d.ts → api/types.d.ts} +37 -88
- package/dist/api/types.js +9 -0
- package/dist/functions/{bundleCode.d.ts → bundleCode/index.d.ts} +1 -8
- package/dist/functions/bundleCode/info.d.ts +27 -0
- package/dist/functions/bundleCode/info.js +11 -0
- package/dist/functions/bundleCode/schemas.d.ts +27 -0
- package/dist/functions/bundleCode/schemas.js +22 -0
- package/dist/functions/findFirstAuthentication/index.d.ts +12 -0
- package/dist/functions/findFirstAuthentication/index.js +21 -0
- package/dist/functions/findFirstAuthentication/info.d.ts +30 -0
- package/dist/functions/findFirstAuthentication/info.js +11 -0
- package/dist/functions/findFirstAuthentication/schemas.d.ts +42 -0
- package/dist/functions/findFirstAuthentication/schemas.js +25 -0
- package/dist/functions/findUniqueAuthentication/index.d.ts +13 -0
- package/dist/functions/findUniqueAuthentication/index.js +28 -0
- package/dist/functions/findUniqueAuthentication/info.d.ts +30 -0
- package/dist/functions/findUniqueAuthentication/info.js +11 -0
- package/dist/functions/findUniqueAuthentication/schemas.d.ts +42 -0
- package/dist/functions/findUniqueAuthentication/schemas.js +25 -0
- package/dist/functions/{generateTypes.d.ts → generateTypes/index.d.ts} +2 -7
- package/dist/functions/{generateTypes.js → generateTypes/index.js} +58 -24
- package/dist/functions/generateTypes/info.d.ts +21 -0
- package/dist/functions/generateTypes/info.js +11 -0
- package/dist/functions/generateTypes/schemas.d.ts +30 -0
- package/dist/functions/generateTypes/schemas.js +14 -0
- package/dist/functions/{getAction.d.ts → getAction/index.d.ts} +2 -6
- package/dist/functions/{getAction.js → getAction/index.js} +6 -5
- package/dist/functions/getAction/info.d.ts +18 -0
- package/dist/functions/getAction/info.js +11 -0
- package/dist/functions/getAction/schemas.d.ts +30 -0
- package/dist/functions/getAction/schemas.js +13 -0
- package/dist/functions/{getApp.d.ts → getApp/index.d.ts} +2 -4
- package/dist/functions/{getApp.js → getApp/index.js} +6 -10
- package/dist/functions/getApp/info.d.ts +12 -0
- package/dist/functions/getApp/info.js +11 -0
- package/dist/functions/getApp/schemas.d.ts +24 -0
- package/dist/functions/getApp/schemas.js +11 -0
- package/dist/functions/{listActions.d.ts → listActions/index.d.ts} +3 -6
- package/dist/functions/{listActions.js → listActions/index.js} +4 -3
- package/dist/functions/listActions/info.d.ts +15 -0
- package/dist/functions/listActions/info.js +11 -0
- package/dist/functions/listActions/schemas.d.ts +27 -0
- package/dist/functions/listActions/schemas.js +14 -0
- package/dist/functions/{listApps.d.ts → listApps/index.d.ts} +2 -6
- package/dist/functions/{listApps.js → listApps/index.js} +1 -1
- package/dist/functions/listApps/info.d.ts +18 -0
- package/dist/functions/listApps/info.js +11 -0
- package/dist/functions/listApps/schemas.d.ts +30 -0
- package/dist/functions/listApps/schemas.js +15 -0
- package/dist/functions/{listAuths.d.ts → listAuthentications/index.d.ts} +3 -9
- package/dist/functions/{listAuths.js → listAuthentications/index.js} +28 -12
- package/dist/functions/listAuthentications/info.d.ts +30 -0
- package/dist/functions/listAuthentications/info.js +11 -0
- package/dist/functions/listAuthentications/schemas.d.ts +42 -0
- package/dist/functions/listAuthentications/schemas.js +25 -0
- package/dist/functions/{listFields.d.ts → listFields/index.d.ts} +3 -9
- package/dist/functions/{listFields.js → listFields/index.js} +8 -10
- package/dist/functions/listFields/info.d.ts +24 -0
- package/dist/functions/listFields/info.js +11 -0
- package/dist/functions/listFields/schemas.d.ts +36 -0
- package/dist/functions/listFields/schemas.js +17 -0
- package/dist/functions/{runAction.d.ts → runAction/index.d.ts} +2 -8
- package/dist/functions/{runAction.js → runAction/index.js} +15 -14
- package/dist/functions/runAction/info.d.ts +24 -0
- package/dist/functions/runAction/info.js +11 -0
- package/dist/functions/runAction/schemas.d.ts +36 -0
- package/dist/functions/runAction/schemas.js +15 -0
- package/dist/index.d.ts +10 -4
- package/dist/index.js +17 -6
- package/dist/plugins/apps/index.d.ts +8 -0
- package/dist/plugins/apps/index.js +77 -0
- package/dist/plugins/apps/info.d.ts +6 -0
- package/dist/plugins/apps/info.js +13 -0
- package/dist/plugins/apps/types.d.ts +21 -0
- package/dist/plugins/apps/types.js +2 -0
- package/dist/resolvers/actionKey.d.ts +8 -0
- package/dist/resolvers/actionKey.js +20 -0
- package/dist/resolvers/actionType.d.ts +8 -0
- package/dist/resolvers/actionType.js +21 -0
- package/dist/resolvers/appKey.d.ts +6 -0
- package/dist/resolvers/appKey.js +8 -0
- package/dist/resolvers/authenticationId.d.ts +8 -0
- package/dist/resolvers/authenticationId.js +29 -0
- package/dist/resolvers/index.d.ts +39 -0
- package/dist/resolvers/index.js +105 -0
- package/dist/resolvers/inputs.d.ts +7 -0
- package/dist/resolvers/inputs.js +15 -0
- package/dist/schema-utils.d.ts +44 -0
- package/dist/schema-utils.js +76 -0
- package/dist/schemas/Action.d.ts +21 -0
- package/dist/schemas/Action.js +31 -0
- package/dist/schemas/App.d.ts +19 -0
- package/dist/schemas/App.js +32 -0
- package/dist/schemas/Auth.d.ts +27 -0
- package/dist/schemas/Auth.js +42 -0
- package/dist/schemas/Field.d.ts +15 -0
- package/dist/schemas/Field.js +25 -0
- package/dist/sdk.d.ts +3 -4
- package/dist/sdk.js +104 -11
- package/dist/types/domain.d.ts +22 -0
- package/dist/types/domain.js +21 -0
- package/dist/types/properties.d.ts +21 -0
- package/dist/types/properties.js +43 -0
- package/dist/types/sdk.d.ts +23 -0
- package/dist/types/sdk.js +2 -0
- package/package.json +4 -2
- package/src/api/auth.ts +28 -0
- package/src/api/client.ts +148 -0
- package/src/api/debug.ts +58 -0
- package/src/api/index.ts +83 -0
- package/src/api/polling.ts +56 -0
- package/src/api/types.ts +177 -0
- package/src/functions/{bundleCode.ts → bundleCode/index.ts} +1 -8
- package/src/functions/bundleCode/info.ts +9 -0
- package/src/functions/bundleCode/schemas.ts +30 -0
- package/src/functions/findFirstAuthentication/index.ts +24 -0
- package/src/functions/findFirstAuthentication/info.ts +9 -0
- package/src/functions/findFirstAuthentication/schemas.ts +60 -0
- package/src/functions/findUniqueAuthentication/index.ts +35 -0
- package/src/functions/findUniqueAuthentication/info.ts +9 -0
- package/src/functions/findUniqueAuthentication/schemas.ts +60 -0
- package/src/functions/{generateTypes.ts → generateTypes/index.ts} +70 -31
- package/src/functions/generateTypes/info.ts +9 -0
- package/src/functions/generateTypes/schemas.ts +38 -0
- package/src/functions/{getAction.ts → getAction/index.ts} +11 -12
- package/src/functions/getAction/info.ts +9 -0
- package/src/functions/getAction/schemas.ts +35 -0
- package/src/functions/{getApp.ts → getApp/index.ts} +9 -15
- package/src/functions/getApp/info.ts +9 -0
- package/src/functions/getApp/schemas.ts +31 -0
- package/src/functions/{listActions.ts → listActions/index.ts} +8 -10
- package/src/functions/listActions/info.ts +9 -0
- package/src/functions/listActions/schemas.ts +40 -0
- package/src/functions/{listApps.ts → listApps/index.ts} +3 -8
- package/src/functions/listApps/info.ts +9 -0
- package/src/functions/listApps/schemas.ts +43 -0
- package/src/functions/{listAuths.ts → listAuthentications/index.ts} +32 -23
- package/src/functions/listAuthentications/info.ts +9 -0
- package/src/functions/listAuthentications/schemas.ts +60 -0
- package/src/functions/{listFields.ts → listFields/index.ts} +11 -20
- package/src/functions/listFields/info.ts +9 -0
- package/src/functions/listFields/schemas.ts +46 -0
- package/src/functions/{runAction.ts → runAction/index.ts} +25 -23
- package/src/functions/runAction/info.ts +9 -0
- package/src/functions/runAction/schemas.ts +41 -0
- package/src/index.ts +19 -5
- package/src/plugins/apps/index.ts +144 -0
- package/src/plugins/apps/info.ts +12 -0
- package/src/plugins/apps/types.ts +34 -0
- package/src/resolvers/actionKey.ts +33 -0
- package/src/resolvers/actionType.ts +30 -0
- package/src/resolvers/appKey.ts +11 -0
- package/src/resolvers/authenticationId.ts +38 -0
- package/src/resolvers/index.ts +117 -0
- package/src/resolvers/inputs.ts +23 -0
- package/src/schema-utils.ts +154 -0
- package/src/schemas/Action.ts +40 -0
- package/src/schemas/App.ts +43 -0
- package/src/schemas/Auth.ts +54 -0
- package/src/schemas/Field.ts +34 -0
- package/src/sdk.ts +165 -19
- package/src/types/domain.ts +54 -0
- package/src/types/properties.ts +67 -0
- package/src/types/sdk.ts +46 -0
- package/dist/actions-sdk.d.ts +0 -47
- package/dist/actions-sdk.js +0 -208
- package/dist/api.d.ts +0 -62
- package/dist/api.js +0 -227
- package/dist/output-schemas.d.ts +0 -95
- package/dist/output-schemas.js +0 -138
- package/dist/schemas.d.ts +0 -338
- package/dist/schemas.js +0 -336
- package/dist/types.js +0 -41
- package/src/actions-sdk.ts +0 -356
- package/src/api.ts +0 -361
- package/src/output-schemas.ts +0 -196
- package/src/schemas.ts +0 -467
- package/src/types.ts +0 -257
- /package/dist/functions/{bundleCode.js → bundleCode/index.js} +0 -0
package/dist/schemas.js
DELETED
|
@@ -1,336 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.SdkSchemas = exports.BundleSchema = exports.GenerateSchema = exports.AuthsFindSchema = exports.AuthsListSchema = exports.ActionsRunSchema = exports.ActionsGetSchema = exports.ActionsListSchema = exports.FieldsListSchema = exports.AppsGetSchema = exports.AppsListSchema = void 0;
|
|
4
|
-
exports.getSchemaDescription = getSchemaDescription;
|
|
5
|
-
exports.getFieldDescriptions = getFieldDescriptions;
|
|
6
|
-
const zod_1 = require("zod");
|
|
7
|
-
const output_schemas_1 = require("./output-schemas");
|
|
8
|
-
// Helper function to add resolver metadata to schemas
|
|
9
|
-
function withResolver(schema, meta) {
|
|
10
|
-
// Store resolver metadata on the schema definition
|
|
11
|
-
schema._def.resolverMeta = meta;
|
|
12
|
-
return schema;
|
|
13
|
-
}
|
|
14
|
-
// ============================================================================
|
|
15
|
-
// Base Schemas
|
|
16
|
-
// ============================================================================
|
|
17
|
-
const PaginationSchema = zod_1.z.object({
|
|
18
|
-
limit: zod_1.z
|
|
19
|
-
.number()
|
|
20
|
-
.int()
|
|
21
|
-
.min(1)
|
|
22
|
-
.max(200)
|
|
23
|
-
.optional()
|
|
24
|
-
.describe("Maximum number of items to return (1-200)"),
|
|
25
|
-
offset: zod_1.z
|
|
26
|
-
.number()
|
|
27
|
-
.int()
|
|
28
|
-
.min(0)
|
|
29
|
-
.optional()
|
|
30
|
-
.describe("Number of items to skip for pagination"),
|
|
31
|
-
});
|
|
32
|
-
// ============================================================================
|
|
33
|
-
// Apps Service Schemas
|
|
34
|
-
// ============================================================================
|
|
35
|
-
exports.AppsListSchema = (0, output_schemas_1.withOutputSchema)(zod_1.z
|
|
36
|
-
.object({
|
|
37
|
-
category: zod_1.z
|
|
38
|
-
.string()
|
|
39
|
-
.optional()
|
|
40
|
-
.describe("Filter apps by category (e.g., 'productivity', 'crm', 'hr')"),
|
|
41
|
-
...PaginationSchema.shape,
|
|
42
|
-
})
|
|
43
|
-
.describe("List available apps with optional filtering"), output_schemas_1.AppItemSchema);
|
|
44
|
-
exports.AppsGetSchema = zod_1.z
|
|
45
|
-
.object({
|
|
46
|
-
key: zod_1.z
|
|
47
|
-
.string()
|
|
48
|
-
.min(1)
|
|
49
|
-
.describe("The unique app key/slug (e.g., 'slack', 'github', '100hires-ats')"),
|
|
50
|
-
})
|
|
51
|
-
.describe("Get detailed information about a specific app");
|
|
52
|
-
// ============================================================================
|
|
53
|
-
// Shared Parameter Schemas
|
|
54
|
-
// ============================================================================
|
|
55
|
-
// Shared app parameter with resolver
|
|
56
|
-
const AppParameterSchema = withResolver(zod_1.z.string().min(1).describe("App slug (e.g., 'slack', 'github')"), {
|
|
57
|
-
resolver: {
|
|
58
|
-
type: "static",
|
|
59
|
-
},
|
|
60
|
-
});
|
|
61
|
-
// Shared type parameter with resolver that depends on app
|
|
62
|
-
const ActionTypeParameterSchema = withResolver(zod_1.z
|
|
63
|
-
.enum(["read", "write", "search", "create", "update", "delete"])
|
|
64
|
-
.describe("Action type that matches the action's defined type"), {
|
|
65
|
-
resolver: {
|
|
66
|
-
type: "dynamic",
|
|
67
|
-
depends: ["app"],
|
|
68
|
-
fetch: async (sdk, resolvedParams) => {
|
|
69
|
-
const actions = await sdk.actions.list({ appKey: resolvedParams.app });
|
|
70
|
-
const types = [...new Set(actions.map((action) => action.type))];
|
|
71
|
-
return types.map((type) => ({ key: type, name: type }));
|
|
72
|
-
},
|
|
73
|
-
prompt: (types) => ({
|
|
74
|
-
type: "list",
|
|
75
|
-
name: "type",
|
|
76
|
-
message: "Select action type:",
|
|
77
|
-
choices: types.map((type) => ({
|
|
78
|
-
name: type.name,
|
|
79
|
-
value: type.key,
|
|
80
|
-
})),
|
|
81
|
-
}),
|
|
82
|
-
},
|
|
83
|
-
});
|
|
84
|
-
// Shared action parameter with resolver that depends on app and type
|
|
85
|
-
const ActionParameterSchema = withResolver(zod_1.z.string().min(1).describe("Action key to execute"), {
|
|
86
|
-
resolver: {
|
|
87
|
-
type: "dynamic",
|
|
88
|
-
depends: ["app", "type"],
|
|
89
|
-
fetch: async (sdk, resolvedParams) => {
|
|
90
|
-
const actions = await sdk.actions.list({ appKey: resolvedParams.app });
|
|
91
|
-
return actions.filter((action) => action.type === resolvedParams.type);
|
|
92
|
-
},
|
|
93
|
-
prompt: (actions) => ({
|
|
94
|
-
type: "list",
|
|
95
|
-
name: "action",
|
|
96
|
-
message: "Select action:",
|
|
97
|
-
choices: actions.map((action) => ({
|
|
98
|
-
name: `${action.name || action.key} - ${action.description || "No description"}`,
|
|
99
|
-
value: action.key,
|
|
100
|
-
})),
|
|
101
|
-
}),
|
|
102
|
-
},
|
|
103
|
-
});
|
|
104
|
-
// Shared authId parameter with resolver that depends on app
|
|
105
|
-
const AuthIdParameterSchema = withResolver(zod_1.z
|
|
106
|
-
.number()
|
|
107
|
-
.int()
|
|
108
|
-
.optional()
|
|
109
|
-
.describe("Authentication ID to use for this action"), {
|
|
110
|
-
resolver: {
|
|
111
|
-
type: "dynamic",
|
|
112
|
-
depends: ["app"],
|
|
113
|
-
fetch: async (sdk, resolvedParams) => {
|
|
114
|
-
// Get auths for the specific app (owned auths will be prioritized automatically)
|
|
115
|
-
return await sdk.auths.list({
|
|
116
|
-
appKey: resolvedParams.app,
|
|
117
|
-
limit: 1000,
|
|
118
|
-
});
|
|
119
|
-
},
|
|
120
|
-
prompt: (auths, params) => ({
|
|
121
|
-
type: "list",
|
|
122
|
-
name: "authId",
|
|
123
|
-
message: `Select authentication for ${params.app}:`,
|
|
124
|
-
choices: [
|
|
125
|
-
...auths.map((auth) => ({
|
|
126
|
-
name: `${auth.title || auth.label || "Authentication"} (ID: ${auth.id})`,
|
|
127
|
-
value: auth.id,
|
|
128
|
-
})),
|
|
129
|
-
{
|
|
130
|
-
name: "↗ Skip authentication (may fail)",
|
|
131
|
-
value: null,
|
|
132
|
-
},
|
|
133
|
-
],
|
|
134
|
-
}),
|
|
135
|
-
},
|
|
136
|
-
});
|
|
137
|
-
// ============================================================================
|
|
138
|
-
// Fields Service Schemas
|
|
139
|
-
// ============================================================================
|
|
140
|
-
exports.FieldsListSchema = (0, output_schemas_1.withOutputSchema)(zod_1.z
|
|
141
|
-
.object({
|
|
142
|
-
app: AppParameterSchema,
|
|
143
|
-
type: ActionTypeParameterSchema,
|
|
144
|
-
action: ActionParameterSchema,
|
|
145
|
-
authId: AuthIdParameterSchema,
|
|
146
|
-
params: zod_1.z
|
|
147
|
-
.record(zod_1.z.any())
|
|
148
|
-
.optional()
|
|
149
|
-
.describe("Additional parameters that may affect available fields"),
|
|
150
|
-
})
|
|
151
|
-
.describe("Get the input fields required for a specific action"), output_schemas_1.FieldItemSchema);
|
|
152
|
-
// ============================================================================
|
|
153
|
-
// Actions Service Schemas
|
|
154
|
-
// ============================================================================
|
|
155
|
-
exports.ActionsListSchema = (0, output_schemas_1.withOutputSchema)(zod_1.z
|
|
156
|
-
.object({
|
|
157
|
-
appKey: withResolver(zod_1.z
|
|
158
|
-
.string()
|
|
159
|
-
.min(1)
|
|
160
|
-
.describe("App slug to get actions for (e.g., 'slack', 'github')"), {
|
|
161
|
-
resolver: {
|
|
162
|
-
type: "static",
|
|
163
|
-
},
|
|
164
|
-
}),
|
|
165
|
-
type: zod_1.z
|
|
166
|
-
.enum(["read", "write", "search", "create", "update", "delete"])
|
|
167
|
-
.optional()
|
|
168
|
-
.describe("Filter actions by type"),
|
|
169
|
-
})
|
|
170
|
-
.describe("List all actions for a specific app"), output_schemas_1.ActionItemSchema);
|
|
171
|
-
exports.ActionsGetSchema = zod_1.z
|
|
172
|
-
.object({
|
|
173
|
-
app: AppParameterSchema,
|
|
174
|
-
type: ActionTypeParameterSchema,
|
|
175
|
-
action: ActionParameterSchema,
|
|
176
|
-
})
|
|
177
|
-
.describe("Get detailed information about a specific action");
|
|
178
|
-
exports.ActionsRunSchema = zod_1.z
|
|
179
|
-
.object({
|
|
180
|
-
app: AppParameterSchema,
|
|
181
|
-
type: ActionTypeParameterSchema,
|
|
182
|
-
action: ActionParameterSchema,
|
|
183
|
-
inputs: withResolver(zod_1.z
|
|
184
|
-
.record(zod_1.z.any())
|
|
185
|
-
.optional()
|
|
186
|
-
.describe("Input parameters for the action as key-value pairs"), {
|
|
187
|
-
resolver: {
|
|
188
|
-
type: "fields",
|
|
189
|
-
depends: ["app", "action", "type", "authId"],
|
|
190
|
-
fetch: async (sdk, resolvedParams) => {
|
|
191
|
-
return await sdk.fields.list({
|
|
192
|
-
app: resolvedParams.app,
|
|
193
|
-
action: resolvedParams.action,
|
|
194
|
-
type: resolvedParams.type,
|
|
195
|
-
authId: resolvedParams.authId,
|
|
196
|
-
});
|
|
197
|
-
},
|
|
198
|
-
},
|
|
199
|
-
}),
|
|
200
|
-
authId: AuthIdParameterSchema,
|
|
201
|
-
})
|
|
202
|
-
.describe("Execute an action on a specific app");
|
|
203
|
-
// ============================================================================
|
|
204
|
-
// Auths Service Schemas
|
|
205
|
-
// ============================================================================
|
|
206
|
-
exports.AuthsListSchema = (0, output_schemas_1.withOutputSchema)(zod_1.z
|
|
207
|
-
.object({
|
|
208
|
-
appKey: withResolver(zod_1.z
|
|
209
|
-
.string()
|
|
210
|
-
.min(1)
|
|
211
|
-
.describe("App slug to get authentications for (e.g., 'slack', 'github')"), {
|
|
212
|
-
resolver: {
|
|
213
|
-
type: "static",
|
|
214
|
-
},
|
|
215
|
-
}),
|
|
216
|
-
account_id: zod_1.z.string().optional().describe("Filter by account ID"),
|
|
217
|
-
owner: zod_1.z.string().optional().describe("Filter by owner"),
|
|
218
|
-
...PaginationSchema.shape,
|
|
219
|
-
})
|
|
220
|
-
.describe("List available authentications with optional filtering"), output_schemas_1.AuthItemSchema);
|
|
221
|
-
exports.AuthsFindSchema = zod_1.z
|
|
222
|
-
.object({
|
|
223
|
-
appKey: zod_1.z.string().min(1).describe("App key to find authentication for"),
|
|
224
|
-
})
|
|
225
|
-
.describe("Find the authentication ID for a specific app");
|
|
226
|
-
// ============================================================================
|
|
227
|
-
// Root Tools Schemas
|
|
228
|
-
// ============================================================================
|
|
229
|
-
exports.GenerateSchema = zod_1.z
|
|
230
|
-
.object({
|
|
231
|
-
appKey: withResolver(zod_1.z.string().min(1).describe("App key to generate SDK code for"), {
|
|
232
|
-
resolver: {
|
|
233
|
-
type: "static",
|
|
234
|
-
},
|
|
235
|
-
}),
|
|
236
|
-
token: zod_1.z
|
|
237
|
-
.string()
|
|
238
|
-
.optional()
|
|
239
|
-
.describe("Zapier API token (defaults to ZAPIER_TOKEN env var)"),
|
|
240
|
-
authId: withResolver(zod_1.z.number().int().optional().describe("Authentication ID to use"), {
|
|
241
|
-
resolver: {
|
|
242
|
-
type: "dynamic",
|
|
243
|
-
depends: ["appKey"],
|
|
244
|
-
fetch: async (sdk, resolvedParams) => {
|
|
245
|
-
// Get auths for the specific app (owned auths will be prioritized automatically)
|
|
246
|
-
return await sdk.auths.list({
|
|
247
|
-
appKey: resolvedParams.appKey,
|
|
248
|
-
limit: 1000,
|
|
249
|
-
});
|
|
250
|
-
},
|
|
251
|
-
prompt: (auths, params) => ({
|
|
252
|
-
type: "list",
|
|
253
|
-
name: "authId",
|
|
254
|
-
message: `Select authentication for ${params.appKey}:`,
|
|
255
|
-
choices: [
|
|
256
|
-
...auths.map((auth) => ({
|
|
257
|
-
name: `${auth.title || auth.label || "Authentication"} (ID: ${auth.id})`,
|
|
258
|
-
value: auth.id,
|
|
259
|
-
})),
|
|
260
|
-
{
|
|
261
|
-
name: "↗ Skip authentication (may fail)",
|
|
262
|
-
value: null,
|
|
263
|
-
},
|
|
264
|
-
],
|
|
265
|
-
}),
|
|
266
|
-
},
|
|
267
|
-
}),
|
|
268
|
-
output: zod_1.z
|
|
269
|
-
.string()
|
|
270
|
-
.optional()
|
|
271
|
-
.describe("Output file path (defaults to generated/<appKey>.ts)"),
|
|
272
|
-
debug: zod_1.z
|
|
273
|
-
.boolean()
|
|
274
|
-
.default(false)
|
|
275
|
-
.describe("Enable debug logging during generation"),
|
|
276
|
-
})
|
|
277
|
-
.describe("Generate TypeScript SDK code for a specific app");
|
|
278
|
-
exports.BundleSchema = zod_1.z
|
|
279
|
-
.object({
|
|
280
|
-
input: zod_1.z.string().min(1).describe("Input TypeScript file path to bundle"),
|
|
281
|
-
output: zod_1.z
|
|
282
|
-
.string()
|
|
283
|
-
.optional()
|
|
284
|
-
.describe("Output file path (defaults to input with .js extension)"),
|
|
285
|
-
string: zod_1.z
|
|
286
|
-
.boolean()
|
|
287
|
-
.default(false)
|
|
288
|
-
.describe("Return bundled code as string instead of writing to file"),
|
|
289
|
-
minify: zod_1.z.boolean().default(false).describe("Minify the bundled output"),
|
|
290
|
-
target: zod_1.z.string().default("es2020").describe("ECMAScript target version"),
|
|
291
|
-
cjs: zod_1.z
|
|
292
|
-
.boolean()
|
|
293
|
-
.default(false)
|
|
294
|
-
.describe("Output CommonJS format instead of ESM"),
|
|
295
|
-
})
|
|
296
|
-
.describe("Bundle TypeScript code into executable JavaScript");
|
|
297
|
-
// ============================================================================
|
|
298
|
-
// SDK Schema Collection
|
|
299
|
-
// ============================================================================
|
|
300
|
-
exports.SdkSchemas = {
|
|
301
|
-
apps: {
|
|
302
|
-
list: exports.AppsListSchema,
|
|
303
|
-
get: exports.AppsGetSchema,
|
|
304
|
-
},
|
|
305
|
-
actions: {
|
|
306
|
-
list: exports.ActionsListSchema,
|
|
307
|
-
get: exports.ActionsGetSchema,
|
|
308
|
-
run: exports.ActionsRunSchema,
|
|
309
|
-
},
|
|
310
|
-
auths: {
|
|
311
|
-
list: exports.AuthsListSchema,
|
|
312
|
-
find: exports.AuthsFindSchema,
|
|
313
|
-
},
|
|
314
|
-
fields: {
|
|
315
|
-
list: exports.FieldsListSchema,
|
|
316
|
-
},
|
|
317
|
-
// Root namespace tools
|
|
318
|
-
generate: exports.GenerateSchema,
|
|
319
|
-
bundle: exports.BundleSchema,
|
|
320
|
-
};
|
|
321
|
-
// ============================================================================
|
|
322
|
-
// Schema Utilities
|
|
323
|
-
// ============================================================================
|
|
324
|
-
function getSchemaDescription(schema) {
|
|
325
|
-
return schema.description;
|
|
326
|
-
}
|
|
327
|
-
function getFieldDescriptions(schema) {
|
|
328
|
-
const descriptions = {};
|
|
329
|
-
const shape = schema.shape;
|
|
330
|
-
for (const [key, fieldSchema] of Object.entries(shape)) {
|
|
331
|
-
if (fieldSchema instanceof zod_1.z.ZodType && fieldSchema.description) {
|
|
332
|
-
descriptions[key] = fieldSchema.description;
|
|
333
|
-
}
|
|
334
|
-
}
|
|
335
|
-
return descriptions;
|
|
336
|
-
}
|
package/dist/types.js
DELETED
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.AuthenticationError = exports.ActionNotFoundError = exports.AppNotFoundError = exports.ZapierSdkError = void 0;
|
|
4
|
-
exports.combineSdks = combineSdks;
|
|
5
|
-
// Custom error classes for better error handling
|
|
6
|
-
class ZapierSdkError extends Error {
|
|
7
|
-
constructor(message, code) {
|
|
8
|
-
super(message);
|
|
9
|
-
this.code = code;
|
|
10
|
-
this.name = "ZapierSdkError";
|
|
11
|
-
}
|
|
12
|
-
}
|
|
13
|
-
exports.ZapierSdkError = ZapierSdkError;
|
|
14
|
-
class AppNotFoundError extends ZapierSdkError {
|
|
15
|
-
constructor(appKey) {
|
|
16
|
-
super(`App "${appKey}" not found`);
|
|
17
|
-
this.name = "AppNotFoundError";
|
|
18
|
-
this.code = "APP_NOT_FOUND";
|
|
19
|
-
}
|
|
20
|
-
}
|
|
21
|
-
exports.AppNotFoundError = AppNotFoundError;
|
|
22
|
-
class ActionNotFoundError extends ZapierSdkError {
|
|
23
|
-
constructor(appKey, actionKey) {
|
|
24
|
-
super(`Action "${actionKey}" not found in app "${appKey}"`);
|
|
25
|
-
this.name = "ActionNotFoundError";
|
|
26
|
-
this.code = "ACTION_NOT_FOUND";
|
|
27
|
-
}
|
|
28
|
-
}
|
|
29
|
-
exports.ActionNotFoundError = ActionNotFoundError;
|
|
30
|
-
class AuthenticationError extends ZapierSdkError {
|
|
31
|
-
constructor(message) {
|
|
32
|
-
super(message);
|
|
33
|
-
this.name = "AuthenticationError";
|
|
34
|
-
this.code = "AUTHENTICATION_ERROR";
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
exports.AuthenticationError = AuthenticationError;
|
|
38
|
-
// Utility function to combine multiple SDKs
|
|
39
|
-
function combineSdks(sdks) {
|
|
40
|
-
return { ...sdks };
|
|
41
|
-
}
|