@zapier/zapier-sdk 0.14.0 → 0.15.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/CHANGELOG.md +12 -0
- package/README.md +28 -0
- package/dist/api/client.d.ts.map +1 -1
- package/dist/api/client.js +45 -22
- package/dist/api/schemas.d.ts +3 -0
- package/dist/api/schemas.d.ts.map +1 -1
- package/dist/api/schemas.js +1 -0
- package/dist/index.cjs +181 -87
- package/dist/index.d.mts +47 -2
- package/dist/index.mjs +181 -87
- package/dist/plugins/getAuthentication/index.js +1 -1
- package/dist/plugins/getAuthentication/index.test.js +1 -1
- package/dist/plugins/getInputFieldsSchema/index.d.ts +22 -0
- package/dist/plugins/getInputFieldsSchema/index.d.ts.map +1 -0
- package/dist/plugins/getInputFieldsSchema/index.js +51 -0
- package/dist/plugins/getInputFieldsSchema/index.test.d.ts +2 -0
- package/dist/plugins/getInputFieldsSchema/index.test.d.ts.map +1 -0
- package/dist/plugins/getInputFieldsSchema/index.test.js +288 -0
- package/dist/plugins/getInputFieldsSchema/schemas.d.ts +31 -0
- package/dist/plugins/getInputFieldsSchema/schemas.d.ts.map +1 -0
- package/dist/plugins/getInputFieldsSchema/schemas.js +13 -0
- package/dist/plugins/getProfile/index.d.ts.map +1 -1
- package/dist/plugins/getProfile/index.js +1 -1
- package/dist/plugins/listActions/index.js +1 -1
- package/dist/plugins/listActions/index.test.js +1 -1
- package/dist/plugins/listApps/index.js +2 -2
- package/dist/plugins/listApps/index.test.js +1 -1
- package/dist/plugins/listAuthentications/index.js +1 -1
- package/dist/plugins/listAuthentications/index.test.js +13 -13
- package/dist/plugins/listInputFieldChoices/index.test.js +19 -19
- package/dist/plugins/listInputFields/index.d.ts.map +1 -1
- package/dist/plugins/listInputFields/index.js +2 -0
- package/dist/plugins/listInputFields/index.test.js +4 -4
- package/dist/plugins/manifest/index.js +2 -2
- package/dist/plugins/manifest/index.test.js +3 -3
- package/dist/plugins/runAction/index.js +2 -2
- package/dist/plugins/runAction/index.test.js +4 -4
- package/dist/sdk.d.ts +7 -1
- package/dist/sdk.d.ts.map +1 -1
- package/dist/sdk.js +2 -0
- package/dist/sdk.test.js +1 -1
- package/dist/services/implementations.js +2 -2
- package/dist/temporary-internal-core/index.d.ts +14 -0
- package/dist/temporary-internal-core/index.d.ts.map +1 -0
- package/dist/temporary-internal-core/index.js +14 -0
- package/dist/types/sdk.d.ts +2 -1
- package/dist/types/sdk.d.ts.map +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
# @zapier/zapier-sdk
|
|
2
2
|
|
|
3
|
+
## 0.15.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 4c78fb0: Added `getInputFieldsSchema` plugin to retrieve JSON Schema for action inputs
|
|
8
|
+
|
|
9
|
+
## 0.15.0
|
|
10
|
+
|
|
11
|
+
### Minor Changes
|
|
12
|
+
|
|
13
|
+
- f92bc07: Route all API requests through new service.
|
|
14
|
+
|
|
3
15
|
## 0.14.0
|
|
4
16
|
|
|
5
17
|
### Minor Changes
|
package/README.md
CHANGED
|
@@ -9,6 +9,7 @@
|
|
|
9
9
|
- [`getProfile`](#getprofile)
|
|
10
10
|
- [Actions](#actions)
|
|
11
11
|
- [`getAction`](#getaction)
|
|
12
|
+
- [`getInputFieldsSchema`](#getinputfieldsschema)
|
|
12
13
|
- [`listActions`](#listactions)
|
|
13
14
|
- [`listInputFieldChoices`](#listinputfieldchoices)
|
|
14
15
|
- [`listInputFields`](#listinputfields)
|
|
@@ -256,6 +257,33 @@ const { data: action } = await sdk.getAction({
|
|
|
256
257
|
});
|
|
257
258
|
```
|
|
258
259
|
|
|
260
|
+
#### `getInputFieldsSchema`
|
|
261
|
+
|
|
262
|
+
Get the JSON Schema representation of input fields for an action. Returns a JSON Schema object describing the structure, types, and validation rules for the action's input parameters.
|
|
263
|
+
|
|
264
|
+
**Parameters:**
|
|
265
|
+
|
|
266
|
+
| Name | Type | Required | Default | Possible Values | Description |
|
|
267
|
+
| -------------------- | -------- | -------- | ------- | ---------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------- |
|
|
268
|
+
| `options` | `object` | ✅ | — | — | |
|
|
269
|
+
| ↳ `appKey` | `string` | ✅ | — | — | App key (e.g., 'SlackCLIAPI' or slug like 'github') to get the input schema for |
|
|
270
|
+
| ↳ `actionType` | `string` | ✅ | — | `read`, `read_bulk`, `write`, `run`, `search`, `search_or_write`, `search_and_write`, `filter` | Action type that matches the action's defined type |
|
|
271
|
+
| ↳ `actionKey` | `string` | ✅ | — | — | Action key to get the input schema for |
|
|
272
|
+
| ↳ `authenticationId` | `string` | ❌ | — | — | Authentication ID to use when fetching the schema. Required if the action needs authentication to determine available fields. |
|
|
273
|
+
| ↳ `inputs` | `object` | ❌ | — | — | Current input values that may affect the schema (e.g., when fields depend on other field values) |
|
|
274
|
+
|
|
275
|
+
**Returns:** `Promise<InputSchemaItem>`
|
|
276
|
+
|
|
277
|
+
**Example:**
|
|
278
|
+
|
|
279
|
+
```typescript
|
|
280
|
+
const { data: inputSchema } = await sdk.getInputFieldsSchema({
|
|
281
|
+
appKey: "example-key",
|
|
282
|
+
actionType: "read",
|
|
283
|
+
actionKey: "example-key",
|
|
284
|
+
});
|
|
285
|
+
```
|
|
286
|
+
|
|
259
287
|
#### `listActions`
|
|
260
288
|
|
|
261
289
|
List all actions for a specific app
|
package/dist/api/client.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../src/api/client.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EACV,SAAS,EACT,gBAAgB,EAGjB,MAAM,SAAS,CAAC;
|
|
1
|
+
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../src/api/client.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EACV,SAAS,EACT,gBAAgB,EAGjB,MAAM,SAAS,CAAC;AAwejB,eAAO,MAAM,eAAe,GAAI,SAAS,gBAAgB,KAAG,SAW3D,CAAC"}
|
package/dist/api/client.js
CHANGED
|
@@ -8,11 +8,18 @@ import { getAuthorizationHeader } from "./auth";
|
|
|
8
8
|
import { createDebugLogger, createDebugFetch } from "./debug";
|
|
9
9
|
import { pollUntilComplete } from "./polling";
|
|
10
10
|
import { getTokenFromEnvOrConfig } from "../auth";
|
|
11
|
+
import { getZapierBaseUrl } from "../utils/url-utils";
|
|
11
12
|
import { ZapierApiError, ZapierAuthenticationError, ZapierValidationError, ZapierNotFoundError, } from "../types/errors";
|
|
12
|
-
const
|
|
13
|
-
// e.g. https://
|
|
14
|
-
relay: {
|
|
13
|
+
const pathConfig = {
|
|
14
|
+
// e.g. /relay -> https://sdkapi.zapier.com/api/v0/sdk/relay/...
|
|
15
|
+
"/relay": {
|
|
15
16
|
authHeader: "X-Relay-Authorization",
|
|
17
|
+
pathPrefix: "/api/v0/sdk/relay",
|
|
18
|
+
},
|
|
19
|
+
// e.g. /zapier -> https://sdkapi.zapier.com/api/v0/sdk/zapier/...
|
|
20
|
+
"/zapier": {
|
|
21
|
+
authHeader: "Authorization",
|
|
22
|
+
pathPrefix: "/api/v0/sdk/zapier",
|
|
16
23
|
},
|
|
17
24
|
};
|
|
18
25
|
class ZapierApiClient {
|
|
@@ -223,37 +230,53 @@ class ZapierApiClient {
|
|
|
223
230
|
return { message: fallbackMessage };
|
|
224
231
|
}
|
|
225
232
|
}
|
|
226
|
-
//
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
const
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
233
|
+
// Apply any special routing logic for configured paths.
|
|
234
|
+
applyPathConfiguration(path) {
|
|
235
|
+
// Find matching path configuration.
|
|
236
|
+
const matchingPathKey = Object.keys(pathConfig).find((configPath) => path === configPath || path.startsWith(configPath + "/"));
|
|
237
|
+
const config = matchingPathKey ? pathConfig[matchingPathKey] : undefined;
|
|
238
|
+
// Check if baseUrl is a Zapier-inferred base URL.
|
|
239
|
+
const zapierBaseUrl = getZapierBaseUrl(this.options.baseUrl);
|
|
240
|
+
// Let's remain compatible with a base URL that is set to a Zapier-inferred
|
|
241
|
+
// domain, rather than requiring the base URL to go to our proxy. Later, the
|
|
242
|
+
// proxy will be removed, so this should make that transition easier.
|
|
243
|
+
if (zapierBaseUrl === this.options.baseUrl) {
|
|
244
|
+
// If baseUrl is already the Zapier base URL, use sdkapi subdomain.
|
|
235
245
|
const originalBaseUrl = new URL(this.options.baseUrl);
|
|
236
|
-
const finalBaseUrl = `https
|
|
237
|
-
|
|
238
|
-
|
|
246
|
+
const finalBaseUrl = `https://sdkapi.${originalBaseUrl.hostname}`;
|
|
247
|
+
// Only prepend pathPrefix if there's a matching config with pathPrefix.
|
|
248
|
+
let finalPath = path;
|
|
249
|
+
if (config &&
|
|
250
|
+
"pathPrefix" in config &&
|
|
251
|
+
config.pathPrefix &&
|
|
252
|
+
matchingPathKey) {
|
|
253
|
+
// Strip the matching path key, and use the pathPrefix instead.
|
|
254
|
+
const pathWithoutPrefix = path.slice(matchingPathKey.length) || "/";
|
|
255
|
+
finalPath = `${config.pathPrefix}${pathWithoutPrefix}`;
|
|
256
|
+
}
|
|
257
|
+
return {
|
|
258
|
+
url: new URL(finalPath, finalBaseUrl),
|
|
259
|
+
pathConfig: config,
|
|
260
|
+
};
|
|
239
261
|
}
|
|
262
|
+
// For a base URL that isn't a Zapier-inferred domain, use the whole base URL.
|
|
240
263
|
return {
|
|
241
264
|
url: new URL(path, this.options.baseUrl),
|
|
242
|
-
|
|
265
|
+
pathConfig: config,
|
|
243
266
|
};
|
|
244
267
|
}
|
|
245
268
|
// Helper to build full URLs and return routing info
|
|
246
269
|
buildUrl(path, searchParams) {
|
|
247
|
-
const { url,
|
|
270
|
+
const { url, pathConfig: config } = this.applyPathConfiguration(path);
|
|
248
271
|
if (searchParams) {
|
|
249
272
|
Object.entries(searchParams).forEach(([key, value]) => {
|
|
250
273
|
url.searchParams.set(key, value);
|
|
251
274
|
});
|
|
252
275
|
}
|
|
253
|
-
return { url: url.toString(),
|
|
276
|
+
return { url: url.toString(), pathConfig: config };
|
|
254
277
|
}
|
|
255
278
|
// Helper to build headers
|
|
256
|
-
async buildHeaders(options = {},
|
|
279
|
+
async buildHeaders(options = {}, pathConfig) {
|
|
257
280
|
const headers = new Headers(options.headers ?? {});
|
|
258
281
|
// Even if auth is not required, we still want to add it in case it adds
|
|
259
282
|
// useful context to the API. The session is a good example of this. Auth
|
|
@@ -261,7 +284,7 @@ class ZapierApiClient {
|
|
|
261
284
|
// session!
|
|
262
285
|
const authToken = await this.getAuthToken();
|
|
263
286
|
if (authToken) {
|
|
264
|
-
const authHeaderName =
|
|
287
|
+
const authHeaderName = pathConfig?.authHeader || "Authorization";
|
|
265
288
|
headers.set(authHeaderName, getAuthorizationHeader(authToken));
|
|
266
289
|
}
|
|
267
290
|
// If we know auth is required, and we don't have a token, throw an error
|
|
@@ -307,8 +330,8 @@ class ZapierApiClient {
|
|
|
307
330
|
if (fetchOptions?.body && typeof fetchOptions.body === "object") {
|
|
308
331
|
fetchOptions.body = JSON.stringify(fetchOptions.body);
|
|
309
332
|
}
|
|
310
|
-
const { url,
|
|
311
|
-
const builtHeaders = await this.buildHeaders(fetchOptions,
|
|
333
|
+
const { url, pathConfig } = this.buildUrl(path, fetchOptions?.searchParams);
|
|
334
|
+
const builtHeaders = await this.buildHeaders(fetchOptions, pathConfig);
|
|
312
335
|
const inputHeaders = new Headers(fetchOptions?.headers ?? {});
|
|
313
336
|
const mergedHeaders = new Headers();
|
|
314
337
|
builtHeaders.forEach((value, key) => {
|
package/dist/api/schemas.d.ts
CHANGED
|
@@ -972,6 +972,7 @@ export declare const NeedsResponseSchema: z.ZodObject<{
|
|
|
972
972
|
}>, "many">>;
|
|
973
973
|
errors: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
974
974
|
last_fetched_at: z.ZodOptional<z.ZodString>;
|
|
975
|
+
schema: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
975
976
|
}, "strip", z.ZodTypeAny, {
|
|
976
977
|
success: boolean;
|
|
977
978
|
needs?: {
|
|
@@ -1008,6 +1009,7 @@ export declare const NeedsResponseSchema: z.ZodObject<{
|
|
|
1008
1009
|
}[] | undefined;
|
|
1009
1010
|
errors?: string[] | undefined;
|
|
1010
1011
|
last_fetched_at?: string | undefined;
|
|
1012
|
+
schema?: Record<string, unknown> | undefined;
|
|
1011
1013
|
}, {
|
|
1012
1014
|
success: boolean;
|
|
1013
1015
|
needs?: {
|
|
@@ -1044,6 +1046,7 @@ export declare const NeedsResponseSchema: z.ZodObject<{
|
|
|
1044
1046
|
}[] | undefined;
|
|
1045
1047
|
errors?: string[] | undefined;
|
|
1046
1048
|
last_fetched_at?: string | undefined;
|
|
1049
|
+
schema?: Record<string, unknown> | undefined;
|
|
1047
1050
|
}>;
|
|
1048
1051
|
export declare const ImplementationSchema: z.ZodObject<{
|
|
1049
1052
|
selected_api: z.ZodString;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"schemas.d.ts","sourceRoot":"","sources":["../../src/api/schemas.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB;;;;GAIG;AAMH,eAAO,MAAM,iBAAiB;;;;;;;;;;;;;;;EAK5B,CAAC;AAEH,eAAO,MAAM,UAAU;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA0CrB,CAAC;AAEH,eAAO,MAAM,iBAAiB;;;;;;EAE5B,CAAC;AAEH,eAAO,MAAM,uBAAuB;;;;;;EAElC,CAAC;AAEH,eAAO,MAAM,YAAY;;;;;;;;;;;;;;;;;;;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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAKxC,CAAC;AAMH,eAAO,MAAM,wBAAwB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA2DnC,CAAC;AAEH,eAAO,MAAM,iCAAiC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAK5C,CAAC;AAMH,eAAO,MAAM,6BAA6B;;;;;;EAExC,CAAC;AAEH,eAAO,MAAM,8BAA8B;;;;;;;;;EAGzC,CAAC;AAEH,eAAO,MAAM,wBAAwB;;;;;;;;;;;;;;;;;;;;;;;;EAsCnC,CAAC;AAEH,eAAO,MAAM,yBAAyB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAOpC,CAAC"}
|
package/dist/api/schemas.js
CHANGED
|
@@ -272,6 +272,7 @@ export const NeedsResponseSchema = z.object({
|
|
|
272
272
|
needs: z.array(NeedSchema).optional(),
|
|
273
273
|
errors: z.array(z.string()).optional(),
|
|
274
274
|
last_fetched_at: z.string().optional(),
|
|
275
|
+
schema: z.record(z.unknown()).optional(),
|
|
275
276
|
});
|
|
276
277
|
// ============================================================================
|
|
277
278
|
// Implementation Schema
|
package/dist/index.cjs
CHANGED
|
@@ -978,7 +978,8 @@ zod.z.object({
|
|
|
978
978
|
success: zod.z.boolean(),
|
|
979
979
|
needs: zod.z.array(NeedSchema).optional(),
|
|
980
980
|
errors: zod.z.array(zod.z.string()).optional(),
|
|
981
|
-
last_fetched_at: zod.z.string().optional()
|
|
981
|
+
last_fetched_at: zod.z.string().optional(),
|
|
982
|
+
schema: zod.z.record(zod.z.unknown()).optional()
|
|
982
983
|
});
|
|
983
984
|
var ImplementationSchema = zod.z.object({
|
|
984
985
|
selected_api: zod.z.string(),
|
|
@@ -1295,7 +1296,7 @@ var listAppsPlugin = ({ context }) => {
|
|
|
1295
1296
|
const searchParams2 = {};
|
|
1296
1297
|
searchParams2.term = options.search;
|
|
1297
1298
|
const searchEnvelope = await api.get(
|
|
1298
|
-
"/api/v4/implementations-meta/search/",
|
|
1299
|
+
"/zapier/api/v4/implementations-meta/search/",
|
|
1299
1300
|
{
|
|
1300
1301
|
searchParams: searchParams2
|
|
1301
1302
|
}
|
|
@@ -1335,7 +1336,7 @@ var listAppsPlugin = ({ context }) => {
|
|
|
1335
1336
|
};
|
|
1336
1337
|
}
|
|
1337
1338
|
const implementationsEnvelope = await api.get(
|
|
1338
|
-
"/api/v4/implementations-meta/lookup/",
|
|
1339
|
+
"/zapier/api/v4/implementations-meta/lookup/",
|
|
1339
1340
|
{
|
|
1340
1341
|
searchParams
|
|
1341
1342
|
}
|
|
@@ -1621,7 +1622,7 @@ var listActionsPlugin = ({ context }) => {
|
|
|
1621
1622
|
selected_apis: selectedApi
|
|
1622
1623
|
};
|
|
1623
1624
|
const data = await api.get(
|
|
1624
|
-
"/api/v4/implementations/",
|
|
1625
|
+
"/zapier/api/v4/implementations/",
|
|
1625
1626
|
{
|
|
1626
1627
|
searchParams,
|
|
1627
1628
|
customErrorHandler: ({ status }) => {
|
|
@@ -1831,7 +1832,7 @@ async function fetchImplementationNeeds({
|
|
|
1831
1832
|
request.authentication_id = authenticationId;
|
|
1832
1833
|
}
|
|
1833
1834
|
const response = await api.post(
|
|
1834
|
-
"/api/v4/implementations/needs/",
|
|
1835
|
+
"/zapier/api/v4/implementations/needs/",
|
|
1835
1836
|
request
|
|
1836
1837
|
);
|
|
1837
1838
|
if (!response.success) {
|
|
@@ -1859,7 +1860,7 @@ async function fetchImplementationChoices({
|
|
|
1859
1860
|
request.authentication_id = authenticationId;
|
|
1860
1861
|
}
|
|
1861
1862
|
const response = await api.post(
|
|
1862
|
-
"/api/v4/implementations/choices/",
|
|
1863
|
+
"/zapier/api/v4/implementations/choices/",
|
|
1863
1864
|
request
|
|
1864
1865
|
);
|
|
1865
1866
|
if (!response.success) {
|
|
@@ -2124,7 +2125,7 @@ var listAuthenticationsPlugin = ({ context }) => {
|
|
|
2124
2125
|
searchParams.offset = options.cursor;
|
|
2125
2126
|
}
|
|
2126
2127
|
const data = await api.get(
|
|
2127
|
-
"/api/v4/authentications/",
|
|
2128
|
+
"/zapier/api/v4/authentications/",
|
|
2128
2129
|
{
|
|
2129
2130
|
searchParams,
|
|
2130
2131
|
customErrorHandler: ({ status }) => {
|
|
@@ -2264,7 +2265,7 @@ var getAuthenticationPlugin = ({ context }) => {
|
|
|
2264
2265
|
const { api } = context;
|
|
2265
2266
|
const { authenticationId } = options;
|
|
2266
2267
|
const data = await api.get(
|
|
2267
|
-
`/api/v4/authentications/${authenticationId}/`,
|
|
2268
|
+
`/zapier/api/v4/authentications/${authenticationId}/`,
|
|
2268
2269
|
{
|
|
2269
2270
|
customErrorHandler: ({ status }) => {
|
|
2270
2271
|
if (status === 401) {
|
|
@@ -2457,11 +2458,11 @@ async function executeAction(actionOptions) {
|
|
|
2457
2458
|
data: runRequestData
|
|
2458
2459
|
};
|
|
2459
2460
|
const runData = await api.post(
|
|
2460
|
-
"/api/actions/v1/runs",
|
|
2461
|
+
"/zapier/api/actions/v1/runs",
|
|
2461
2462
|
runRequest
|
|
2462
2463
|
);
|
|
2463
2464
|
const runId = runData.data.id;
|
|
2464
|
-
return await api.poll(`/api/actions/v1/runs/${runId}`, {
|
|
2465
|
+
return await api.poll(`/zapier/api/actions/v1/runs/${runId}`, {
|
|
2465
2466
|
successStatus: 200,
|
|
2466
2467
|
pendingStatus: 202,
|
|
2467
2468
|
resultExtractor: (result) => result.data
|
|
@@ -2742,7 +2743,7 @@ async function getPreferredManifestEntryKey({
|
|
|
2742
2743
|
}
|
|
2743
2744
|
if (locator.implementationName) {
|
|
2744
2745
|
try {
|
|
2745
|
-
const implementationsEnvelope = await api.get(`/api/v4/implementations-meta/lookup/`, {
|
|
2746
|
+
const implementationsEnvelope = await api.get(`/zapier/api/v4/implementations-meta/lookup/`, {
|
|
2746
2747
|
searchParams: {
|
|
2747
2748
|
selected_apis: locator.implementationName
|
|
2748
2749
|
}
|
|
@@ -2769,7 +2770,7 @@ async function listAppsForSlugsPage({
|
|
|
2769
2770
|
searchParams.offset = cursor;
|
|
2770
2771
|
}
|
|
2771
2772
|
const implementationsEnvelope = await api.get(
|
|
2772
|
-
"/api/v4/implementations-meta/lookup/",
|
|
2773
|
+
"/zapier/api/v4/implementations-meta/lookup/",
|
|
2773
2774
|
{
|
|
2774
2775
|
searchParams
|
|
2775
2776
|
}
|
|
@@ -3008,9 +3009,12 @@ var UserProfileItemSchema = withFormatter(
|
|
|
3008
3009
|
// src/plugins/getProfile/index.ts
|
|
3009
3010
|
var getProfilePlugin = ({ context }) => {
|
|
3010
3011
|
const getProfile = createFunction(async function getProfile2() {
|
|
3011
|
-
const profile = await context.api.get(
|
|
3012
|
-
|
|
3013
|
-
|
|
3012
|
+
const profile = await context.api.get(
|
|
3013
|
+
"/zapier/api/v4/profile/",
|
|
3014
|
+
{
|
|
3015
|
+
authRequired: true
|
|
3016
|
+
}
|
|
3017
|
+
);
|
|
3014
3018
|
const { user_id: _unusedUserId, ...data } = profile;
|
|
3015
3019
|
return {
|
|
3016
3020
|
data: {
|
|
@@ -3337,11 +3341,63 @@ async function getTokenFromEnvOrConfig(options = {}) {
|
|
|
3337
3341
|
return getTokenFromCliLogin(options);
|
|
3338
3342
|
}
|
|
3339
3343
|
|
|
3344
|
+
// src/utils/url-utils.ts
|
|
3345
|
+
function getZapierBaseUrl(baseUrl) {
|
|
3346
|
+
if (!baseUrl) {
|
|
3347
|
+
return void 0;
|
|
3348
|
+
}
|
|
3349
|
+
try {
|
|
3350
|
+
const url = new URL(baseUrl);
|
|
3351
|
+
const hostname = url.hostname;
|
|
3352
|
+
const hostParts = hostname.split(".");
|
|
3353
|
+
if (hostParts.length < 2) {
|
|
3354
|
+
return void 0;
|
|
3355
|
+
}
|
|
3356
|
+
const hasZapierPart = hostParts.some(
|
|
3357
|
+
(part) => part === "zapier" || part.startsWith("zapier-")
|
|
3358
|
+
);
|
|
3359
|
+
if (!hasZapierPart) {
|
|
3360
|
+
return void 0;
|
|
3361
|
+
}
|
|
3362
|
+
const rootDomain = hostParts.slice(-2).join(".");
|
|
3363
|
+
return `${url.protocol}//${rootDomain}`;
|
|
3364
|
+
} catch {
|
|
3365
|
+
return void 0;
|
|
3366
|
+
}
|
|
3367
|
+
}
|
|
3368
|
+
function getTrackingBaseUrl({
|
|
3369
|
+
trackingBaseUrl,
|
|
3370
|
+
baseUrl
|
|
3371
|
+
}) {
|
|
3372
|
+
if (trackingBaseUrl) {
|
|
3373
|
+
return trackingBaseUrl;
|
|
3374
|
+
}
|
|
3375
|
+
if (process.env.ZAPIER_TRACKING_BASE_URL) {
|
|
3376
|
+
return process.env.ZAPIER_TRACKING_BASE_URL;
|
|
3377
|
+
}
|
|
3378
|
+
if (baseUrl) {
|
|
3379
|
+
const zapierBaseUrl = getZapierBaseUrl(baseUrl);
|
|
3380
|
+
if (zapierBaseUrl) {
|
|
3381
|
+
return zapierBaseUrl;
|
|
3382
|
+
}
|
|
3383
|
+
}
|
|
3384
|
+
if (baseUrl) {
|
|
3385
|
+
return baseUrl;
|
|
3386
|
+
}
|
|
3387
|
+
return ZAPIER_BASE_URL;
|
|
3388
|
+
}
|
|
3389
|
+
|
|
3340
3390
|
// src/api/client.ts
|
|
3341
|
-
var
|
|
3342
|
-
// e.g. https://
|
|
3343
|
-
relay: {
|
|
3344
|
-
authHeader: "X-Relay-Authorization"
|
|
3391
|
+
var pathConfig = {
|
|
3392
|
+
// e.g. /relay -> https://sdkapi.zapier.com/api/v0/sdk/relay/...
|
|
3393
|
+
"/relay": {
|
|
3394
|
+
authHeader: "X-Relay-Authorization",
|
|
3395
|
+
pathPrefix: "/api/v0/sdk/relay"
|
|
3396
|
+
},
|
|
3397
|
+
// e.g. /zapier -> https://sdkapi.zapier.com/api/v0/sdk/zapier/...
|
|
3398
|
+
"/zapier": {
|
|
3399
|
+
authHeader: "Authorization",
|
|
3400
|
+
pathPrefix: "/api/v0/sdk/zapier"
|
|
3345
3401
|
}
|
|
3346
3402
|
};
|
|
3347
3403
|
var ZapierApiClient = class {
|
|
@@ -3530,39 +3586,47 @@ var ZapierApiClient = class {
|
|
|
3530
3586
|
return { message: fallbackMessage };
|
|
3531
3587
|
}
|
|
3532
3588
|
}
|
|
3533
|
-
//
|
|
3534
|
-
|
|
3535
|
-
|
|
3536
|
-
|
|
3537
|
-
|
|
3538
|
-
|
|
3539
|
-
|
|
3589
|
+
// Apply any special routing logic for configured paths.
|
|
3590
|
+
applyPathConfiguration(path) {
|
|
3591
|
+
const matchingPathKey = Object.keys(pathConfig).find(
|
|
3592
|
+
(configPath) => path === configPath || path.startsWith(configPath + "/")
|
|
3593
|
+
);
|
|
3594
|
+
const config = matchingPathKey ? pathConfig[matchingPathKey] : void 0;
|
|
3595
|
+
const zapierBaseUrl = getZapierBaseUrl(this.options.baseUrl);
|
|
3596
|
+
if (zapierBaseUrl === this.options.baseUrl) {
|
|
3540
3597
|
const originalBaseUrl = new URL(this.options.baseUrl);
|
|
3541
|
-
const finalBaseUrl = `https
|
|
3542
|
-
|
|
3543
|
-
|
|
3598
|
+
const finalBaseUrl = `https://sdkapi.${originalBaseUrl.hostname}`;
|
|
3599
|
+
let finalPath = path;
|
|
3600
|
+
if (config && "pathPrefix" in config && config.pathPrefix && matchingPathKey) {
|
|
3601
|
+
const pathWithoutPrefix = path.slice(matchingPathKey.length) || "/";
|
|
3602
|
+
finalPath = `${config.pathPrefix}${pathWithoutPrefix}`;
|
|
3603
|
+
}
|
|
3604
|
+
return {
|
|
3605
|
+
url: new URL(finalPath, finalBaseUrl),
|
|
3606
|
+
pathConfig: config
|
|
3607
|
+
};
|
|
3544
3608
|
}
|
|
3545
3609
|
return {
|
|
3546
3610
|
url: new URL(path, this.options.baseUrl),
|
|
3547
|
-
|
|
3611
|
+
pathConfig: config
|
|
3548
3612
|
};
|
|
3549
3613
|
}
|
|
3550
3614
|
// Helper to build full URLs and return routing info
|
|
3551
3615
|
buildUrl(path, searchParams) {
|
|
3552
|
-
const { url,
|
|
3616
|
+
const { url, pathConfig: config } = this.applyPathConfiguration(path);
|
|
3553
3617
|
if (searchParams) {
|
|
3554
3618
|
Object.entries(searchParams).forEach(([key, value]) => {
|
|
3555
3619
|
url.searchParams.set(key, value);
|
|
3556
3620
|
});
|
|
3557
3621
|
}
|
|
3558
|
-
return { url: url.toString(),
|
|
3622
|
+
return { url: url.toString(), pathConfig: config };
|
|
3559
3623
|
}
|
|
3560
3624
|
// Helper to build headers
|
|
3561
|
-
async buildHeaders(options = {},
|
|
3625
|
+
async buildHeaders(options = {}, pathConfig2) {
|
|
3562
3626
|
const headers = new Headers(options.headers ?? {});
|
|
3563
3627
|
const authToken = await this.getAuthToken();
|
|
3564
3628
|
if (authToken) {
|
|
3565
|
-
const authHeaderName =
|
|
3629
|
+
const authHeaderName = pathConfig2?.authHeader || "Authorization";
|
|
3566
3630
|
headers.set(authHeaderName, getAuthorizationHeader(authToken));
|
|
3567
3631
|
}
|
|
3568
3632
|
if (options.authRequired) {
|
|
@@ -3609,13 +3673,10 @@ var ZapierApiClient = class {
|
|
|
3609
3673
|
if (fetchOptions?.body && typeof fetchOptions.body === "object") {
|
|
3610
3674
|
fetchOptions.body = JSON.stringify(fetchOptions.body);
|
|
3611
3675
|
}
|
|
3612
|
-
const { url,
|
|
3613
|
-
path,
|
|
3614
|
-
fetchOptions?.searchParams
|
|
3615
|
-
);
|
|
3676
|
+
const { url, pathConfig: pathConfig2 } = this.buildUrl(path, fetchOptions?.searchParams);
|
|
3616
3677
|
const builtHeaders = await this.buildHeaders(
|
|
3617
3678
|
fetchOptions,
|
|
3618
|
-
|
|
3679
|
+
pathConfig2
|
|
3619
3680
|
);
|
|
3620
3681
|
const inputHeaders = new Headers(fetchOptions?.headers ?? {});
|
|
3621
3682
|
const mergedHeaders = new Headers();
|
|
@@ -3859,6 +3920,85 @@ var registryPlugin = ({ sdk, context }) => {
|
|
|
3859
3920
|
getRegistry
|
|
3860
3921
|
};
|
|
3861
3922
|
};
|
|
3923
|
+
var GetInputFieldsSchemaSchema = zod.z.object({
|
|
3924
|
+
appKey: AppKeyPropertySchema.describe(
|
|
3925
|
+
"App key (e.g., 'SlackCLIAPI' or slug like 'github') to get the input schema for"
|
|
3926
|
+
),
|
|
3927
|
+
actionType: ActionTypePropertySchema.describe(
|
|
3928
|
+
"Action type that matches the action's defined type"
|
|
3929
|
+
),
|
|
3930
|
+
actionKey: ActionKeyPropertySchema.describe(
|
|
3931
|
+
"Action key to get the input schema for"
|
|
3932
|
+
),
|
|
3933
|
+
authenticationId: AuthenticationIdPropertySchema.nullable().optional().describe(
|
|
3934
|
+
"Authentication ID to use when fetching the schema. Required if the action needs authentication to determine available fields."
|
|
3935
|
+
),
|
|
3936
|
+
inputs: InputsPropertySchema.optional().describe(
|
|
3937
|
+
"Current input values that may affect the schema (e.g., when fields depend on other field values)"
|
|
3938
|
+
)
|
|
3939
|
+
}).describe(
|
|
3940
|
+
"Get the JSON Schema representation of input fields for an action. Returns a JSON Schema object describing the structure, types, and validation rules for the action's input parameters."
|
|
3941
|
+
);
|
|
3942
|
+
|
|
3943
|
+
// src/plugins/getInputFieldsSchema/index.ts
|
|
3944
|
+
var getInputFieldsSchemaPlugin = ({ sdk, context }) => {
|
|
3945
|
+
const getInputFieldsSchema = createFunction(
|
|
3946
|
+
async function getInputFieldsSchema2(options) {
|
|
3947
|
+
const { api, getVersionedImplementationId } = context;
|
|
3948
|
+
const {
|
|
3949
|
+
appKey,
|
|
3950
|
+
actionKey,
|
|
3951
|
+
actionType,
|
|
3952
|
+
authenticationId = null,
|
|
3953
|
+
inputs
|
|
3954
|
+
} = options;
|
|
3955
|
+
const selectedApi = await getVersionedImplementationId(appKey);
|
|
3956
|
+
if (!selectedApi) {
|
|
3957
|
+
throw new ZapierConfigurationError(
|
|
3958
|
+
"No current_implementation_id found for app",
|
|
3959
|
+
{ configType: "current_implementation_id" }
|
|
3960
|
+
);
|
|
3961
|
+
}
|
|
3962
|
+
const { data: action } = await sdk.getAction({
|
|
3963
|
+
appKey,
|
|
3964
|
+
actionType,
|
|
3965
|
+
actionKey
|
|
3966
|
+
});
|
|
3967
|
+
const needsData = await fetchImplementationNeeds({
|
|
3968
|
+
api,
|
|
3969
|
+
selectedApi,
|
|
3970
|
+
action: action.key,
|
|
3971
|
+
actionType,
|
|
3972
|
+
authenticationId,
|
|
3973
|
+
inputs
|
|
3974
|
+
});
|
|
3975
|
+
return {
|
|
3976
|
+
data: needsData.schema || {}
|
|
3977
|
+
};
|
|
3978
|
+
},
|
|
3979
|
+
GetInputFieldsSchemaSchema
|
|
3980
|
+
);
|
|
3981
|
+
return {
|
|
3982
|
+
getInputFieldsSchema,
|
|
3983
|
+
context: {
|
|
3984
|
+
meta: {
|
|
3985
|
+
getInputFieldsSchema: {
|
|
3986
|
+
categories: ["action"],
|
|
3987
|
+
type: "item",
|
|
3988
|
+
itemType: "InputSchema",
|
|
3989
|
+
inputSchema: GetInputFieldsSchemaSchema,
|
|
3990
|
+
resolvers: {
|
|
3991
|
+
appKey: appKeyResolver,
|
|
3992
|
+
actionType: actionTypeResolver,
|
|
3993
|
+
actionKey: actionKeyResolver,
|
|
3994
|
+
authenticationId: authenticationIdResolver,
|
|
3995
|
+
inputs: inputsAllOptionalResolver
|
|
3996
|
+
}
|
|
3997
|
+
}
|
|
3998
|
+
}
|
|
3999
|
+
}
|
|
4000
|
+
};
|
|
4001
|
+
};
|
|
3862
4002
|
var InputFieldChoiceItemSchema = withFormatter(NeedChoicesSchema, {
|
|
3863
4003
|
format: (item) => {
|
|
3864
4004
|
const title = item.label || item.key || "Choice";
|
|
@@ -4162,7 +4302,7 @@ function getCpuTime() {
|
|
|
4162
4302
|
|
|
4163
4303
|
// package.json
|
|
4164
4304
|
var package_default = {
|
|
4165
|
-
version: "0.
|
|
4305
|
+
version: "0.15.1"};
|
|
4166
4306
|
|
|
4167
4307
|
// src/plugins/eventEmission/builders.ts
|
|
4168
4308
|
function createBaseEvent(context = {}) {
|
|
@@ -4232,52 +4372,6 @@ function buildErrorEventWithContext(data, context = {}) {
|
|
|
4232
4372
|
};
|
|
4233
4373
|
}
|
|
4234
4374
|
|
|
4235
|
-
// src/utils/url-utils.ts
|
|
4236
|
-
function getZapierBaseUrl(baseUrl) {
|
|
4237
|
-
if (!baseUrl) {
|
|
4238
|
-
return void 0;
|
|
4239
|
-
}
|
|
4240
|
-
try {
|
|
4241
|
-
const url = new URL(baseUrl);
|
|
4242
|
-
const hostname = url.hostname;
|
|
4243
|
-
const hostParts = hostname.split(".");
|
|
4244
|
-
if (hostParts.length < 2) {
|
|
4245
|
-
return void 0;
|
|
4246
|
-
}
|
|
4247
|
-
const hasZapierPart = hostParts.some(
|
|
4248
|
-
(part) => part === "zapier" || part.startsWith("zapier-")
|
|
4249
|
-
);
|
|
4250
|
-
if (!hasZapierPart) {
|
|
4251
|
-
return void 0;
|
|
4252
|
-
}
|
|
4253
|
-
const rootDomain = hostParts.slice(-2).join(".");
|
|
4254
|
-
return `${url.protocol}//${rootDomain}`;
|
|
4255
|
-
} catch {
|
|
4256
|
-
return void 0;
|
|
4257
|
-
}
|
|
4258
|
-
}
|
|
4259
|
-
function getTrackingBaseUrl({
|
|
4260
|
-
trackingBaseUrl,
|
|
4261
|
-
baseUrl
|
|
4262
|
-
}) {
|
|
4263
|
-
if (trackingBaseUrl) {
|
|
4264
|
-
return trackingBaseUrl;
|
|
4265
|
-
}
|
|
4266
|
-
if (process.env.ZAPIER_TRACKING_BASE_URL) {
|
|
4267
|
-
return process.env.ZAPIER_TRACKING_BASE_URL;
|
|
4268
|
-
}
|
|
4269
|
-
if (baseUrl) {
|
|
4270
|
-
const zapierBaseUrl = getZapierBaseUrl(baseUrl);
|
|
4271
|
-
if (zapierBaseUrl) {
|
|
4272
|
-
return zapierBaseUrl;
|
|
4273
|
-
}
|
|
4274
|
-
}
|
|
4275
|
-
if (baseUrl) {
|
|
4276
|
-
return baseUrl;
|
|
4277
|
-
}
|
|
4278
|
-
return ZAPIER_BASE_URL;
|
|
4279
|
-
}
|
|
4280
|
-
|
|
4281
4375
|
// src/plugins/eventEmission/index.ts
|
|
4282
4376
|
var APPLICATION_LIFECYCLE_EVENT_SUBJECT = "platform.sdk.ApplicationLifecycleEvent";
|
|
4283
4377
|
var ERROR_OCCURRED_EVENT_SUBJECT = "platform.sdk.ErrorOccurredEvent";
|
|
@@ -4524,7 +4618,7 @@ function createSdk(options = {}, initialSdk = {}, initialContext = { meta: {} })
|
|
|
4524
4618
|
};
|
|
4525
4619
|
}
|
|
4526
4620
|
function createZapierSdkWithoutRegistry(options = {}) {
|
|
4527
|
-
return createSdk(options).addPlugin(eventEmissionPlugin).addPlugin(apiPlugin).addPlugin(manifestPlugin).addPlugin(listAppsPlugin).addPlugin(getAppPlugin).addPlugin(listActionsPlugin).addPlugin(getActionPlugin).addPlugin(listInputFieldsPlugin).addPlugin(listInputFieldChoicesPlugin).addPlugin(runActionPlugin).addPlugin(listAuthenticationsPlugin).addPlugin(getAuthenticationPlugin).addPlugin(findFirstAuthenticationPlugin).addPlugin(findUniqueAuthenticationPlugin).addPlugin(requestPlugin).addPlugin(fetchPlugin).addPlugin(appsPlugin).addPlugin(getProfilePlugin);
|
|
4621
|
+
return createSdk(options).addPlugin(eventEmissionPlugin).addPlugin(apiPlugin).addPlugin(manifestPlugin).addPlugin(listAppsPlugin).addPlugin(getAppPlugin).addPlugin(listActionsPlugin).addPlugin(getActionPlugin).addPlugin(listInputFieldsPlugin).addPlugin(getInputFieldsSchemaPlugin).addPlugin(listInputFieldChoicesPlugin).addPlugin(runActionPlugin).addPlugin(listAuthenticationsPlugin).addPlugin(getAuthenticationPlugin).addPlugin(findFirstAuthenticationPlugin).addPlugin(findUniqueAuthenticationPlugin).addPlugin(requestPlugin).addPlugin(fetchPlugin).addPlugin(appsPlugin).addPlugin(getProfilePlugin);
|
|
4528
4622
|
}
|
|
4529
4623
|
function createZapierSdk(options = {}) {
|
|
4530
4624
|
return createZapierSdkWithoutRegistry(options).addPlugin(registryPlugin);
|