@zapier/zapier-sdk 0.18.3 → 1.0.0
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 +17 -0
- package/README.md +1 -1
- package/dist/api/client.d.ts.map +1 -1
- package/dist/api/client.js +11 -24
- package/dist/api/client.test.js +82 -27
- package/dist/api/index.d.ts +3 -2
- package/dist/api/index.d.ts.map +1 -1
- package/dist/api/index.js +2 -3
- package/dist/api/schemas.d.ts +5 -114
- package/dist/api/schemas.d.ts.map +1 -1
- package/dist/api/schemas.js +0 -67
- package/dist/api/types.d.ts +10 -4
- package/dist/api/types.d.ts.map +1 -1
- package/dist/auth.d.ts +54 -26
- package/dist/auth.d.ts.map +1 -1
- package/dist/auth.js +211 -39
- package/dist/auth.test.js +338 -64
- package/dist/constants.d.ts +14 -0
- package/dist/constants.d.ts.map +1 -1
- package/dist/constants.js +14 -0
- package/dist/credentials.d.ts +57 -0
- package/dist/credentials.d.ts.map +1 -0
- package/dist/credentials.js +174 -0
- package/dist/index.cjs +644 -685
- package/dist/index.d.mts +265 -134
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +5 -0
- package/dist/index.mjs +624 -684
- package/dist/plugins/api/index.d.ts +2 -0
- package/dist/plugins/api/index.d.ts.map +1 -1
- package/dist/plugins/api/index.js +8 -4
- package/dist/plugins/eventEmission/index.d.ts.map +1 -1
- package/dist/plugins/eventEmission/index.js +1 -3
- package/dist/plugins/eventEmission/index.test.js +14 -17
- package/dist/plugins/getAction/schemas.d.ts +1 -1
- package/dist/plugins/getInputFieldsSchema/schemas.d.ts +1 -1
- package/dist/plugins/listActions/index.test.js +1 -0
- package/dist/plugins/listActions/schemas.d.ts +1 -1
- package/dist/plugins/listApps/index.d.ts +2 -8
- package/dist/plugins/listApps/index.d.ts.map +1 -1
- package/dist/plugins/listApps/index.js +4 -6
- package/dist/plugins/listApps/index.test.js +62 -82
- package/dist/plugins/listApps/schemas.d.ts +35 -14
- package/dist/plugins/listApps/schemas.d.ts.map +1 -1
- package/dist/plugins/listApps/schemas.js +44 -14
- package/dist/plugins/listAuthentications/index.test.js +16 -0
- package/dist/plugins/listInputFieldChoices/schemas.d.ts +1 -1
- package/dist/plugins/listInputFields/schemas.d.ts +1 -1
- package/dist/plugins/runAction/schemas.d.ts +1 -1
- package/dist/schemas/Action.d.ts +1 -1
- package/dist/schemas/App.d.ts +28 -28
- package/dist/schemas/App.d.ts.map +1 -1
- package/dist/schemas/App.js +3 -8
- package/dist/sdk.d.ts +2 -1
- package/dist/sdk.d.ts.map +1 -1
- package/dist/sdk.test.js +17 -13
- package/dist/types/credentials.d.ts +65 -0
- package/dist/types/credentials.d.ts.map +1 -0
- package/dist/types/credentials.js +42 -0
- package/dist/types/properties.d.ts +1 -1
- package/dist/types/sdk.d.ts +12 -3
- package/dist/types/sdk.d.ts.map +1 -1
- package/dist/utils/logging.d.ts +13 -0
- package/dist/utils/logging.d.ts.map +1 -0
- package/dist/utils/logging.js +20 -0
- package/package.json +2 -2
- package/dist/api/client.integration.test.d.ts +0 -5
- package/dist/api/client.integration.test.d.ts.map +0 -1
- package/dist/api/client.integration.test.js +0 -318
- package/dist/api/client.methods.test.d.ts +0 -2
- package/dist/api/client.methods.test.d.ts.map +0 -1
- package/dist/api/client.methods.test.js +0 -158
- package/dist/api/router.d.ts +0 -16
- package/dist/api/router.d.ts.map +0 -1
- package/dist/api/router.js +0 -31
- package/dist/api/router.test.d.ts +0 -2
- package/dist/api/router.test.d.ts.map +0 -1
- package/dist/api/router.test.js +0 -103
- package/dist/temporary-internal-core/handlers/listApps.d.ts +0 -67
- package/dist/temporary-internal-core/handlers/listApps.d.ts.map +0 -1
- package/dist/temporary-internal-core/handlers/listApps.js +0 -134
- package/dist/temporary-internal-core/handlers/listApps.test.d.ts +0 -2
- package/dist/temporary-internal-core/handlers/listApps.test.d.ts.map +0 -1
- package/dist/temporary-internal-core/handlers/listApps.test.js +0 -367
- package/dist/temporary-internal-core/index.d.ts +0 -18
- package/dist/temporary-internal-core/index.d.ts.map +0 -1
- package/dist/temporary-internal-core/index.js +0 -18
- package/dist/temporary-internal-core/schemas/apps/index.d.ts +0 -175
- package/dist/temporary-internal-core/schemas/apps/index.d.ts.map +0 -1
- package/dist/temporary-internal-core/schemas/apps/index.js +0 -97
- package/dist/temporary-internal-core/schemas/errors/index.d.ts +0 -139
- package/dist/temporary-internal-core/schemas/errors/index.d.ts.map +0 -1
- package/dist/temporary-internal-core/schemas/errors/index.js +0 -129
- package/dist/temporary-internal-core/schemas/implementations/index.d.ts +0 -127
- package/dist/temporary-internal-core/schemas/implementations/index.d.ts.map +0 -1
- package/dist/temporary-internal-core/schemas/implementations/index.js +0 -79
- package/dist/temporary-internal-core/types/handler.d.ts +0 -51
- package/dist/temporary-internal-core/types/handler.d.ts.map +0 -1
- package/dist/temporary-internal-core/types/handler.js +0 -8
- package/dist/temporary-internal-core/types/index.d.ts +0 -5
- package/dist/temporary-internal-core/types/index.d.ts.map +0 -1
- package/dist/temporary-internal-core/types/index.js +0 -4
- package/dist/temporary-internal-core/utils/app-locators.d.ts +0 -34
- package/dist/temporary-internal-core/utils/app-locators.d.ts.map +0 -1
- package/dist/temporary-internal-core/utils/app-locators.js +0 -39
- package/dist/temporary-internal-core/utils/string-utils.d.ts +0 -28
- package/dist/temporary-internal-core/utils/string-utils.d.ts.map +0 -1
- package/dist/temporary-internal-core/utils/string-utils.js +0 -52
- package/dist/temporary-internal-core/utils/transformations.d.ts +0 -18
- package/dist/temporary-internal-core/utils/transformations.d.ts.map +0 -1
- package/dist/temporary-internal-core/utils/transformations.js +0 -36
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,22 @@
|
|
|
1
1
|
# @zapier/zapier-sdk
|
|
2
2
|
|
|
3
|
+
## 1.0.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- 97ff6c0: Add support for client credentials.
|
|
8
|
+
|
|
9
|
+
### Patch Changes
|
|
10
|
+
|
|
11
|
+
- Updated dependencies [97ff6c0]
|
|
12
|
+
- @zapier/zapier-sdk-cli-login@0.4.0
|
|
13
|
+
|
|
14
|
+
## 0.18.4
|
|
15
|
+
|
|
16
|
+
### Patch Changes
|
|
17
|
+
|
|
18
|
+
- 3bc3cad: - Migrated `listApps` to call sdkapi endpoints directly, removing the temporary handler infrastructure. - Schemas now imported from `@zapier/zapier-sdk-core` for shared type definitions
|
|
19
|
+
|
|
3
20
|
## 0.18.3
|
|
4
21
|
|
|
5
22
|
### Patch Changes
|
package/README.md
CHANGED
|
@@ -574,7 +574,7 @@ List all available apps with optional filtering
|
|
|
574
574
|
| ------------ | -------- | -------- | ------- | --------------- | ------------------------------------------------------------------- |
|
|
575
575
|
| `options` | `object` | ✅ | — | — | |
|
|
576
576
|
| ↳ `appKeys` | `array` | ❌ | — | — | Filter apps by app keys (e.g., 'SlackCLIAPI' or slug like 'github') |
|
|
577
|
-
| ↳ `search` | `string` | ❌ | — | — | Search
|
|
577
|
+
| ↳ `search` | `string` | ❌ | — | — | Search term to filter apps by name |
|
|
578
578
|
| ↳ `pageSize` | `number` | ❌ | — | — | Number of apps per page |
|
|
579
579
|
| ↳ `maxItems` | `number` | ❌ | — | — | Maximum total items to return across all pages |
|
|
580
580
|
| ↳ `cursor` | `string` | ❌ | — | — | Cursor to start from |
|
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;AAmfjB,eAAO,MAAM,eAAe,GAAI,SAAS,gBAAgB,KAAG,SAW3D,CAAC"}
|
package/dist/api/client.js
CHANGED
|
@@ -7,10 +7,9 @@
|
|
|
7
7
|
import { getAuthorizationHeader } from "./auth";
|
|
8
8
|
import { createDebugLogger, createDebugFetch } from "./debug";
|
|
9
9
|
import { pollUntilComplete } from "./polling";
|
|
10
|
-
import { resolveAuthToken } from "../auth";
|
|
10
|
+
import { resolveAuthToken, invalidateCredentialsToken } from "../auth";
|
|
11
11
|
import { getZapierBaseUrl } from "../utils/url-utils";
|
|
12
12
|
import { ZapierApiError, ZapierAuthenticationError, ZapierValidationError, ZapierNotFoundError, } from "../types/errors";
|
|
13
|
-
import { matchRoute } from "./router";
|
|
14
13
|
// Configuration for paths
|
|
15
14
|
const pathConfig = {
|
|
16
15
|
// e.g. /relay -> https://sdkapi.zapier.com/api/v0/sdk/relay/...
|
|
@@ -69,13 +68,11 @@ class ZapierApiClient {
|
|
|
69
68
|
// Helper to get a token from the different places it could be gotten
|
|
70
69
|
async getAuthToken() {
|
|
71
70
|
return resolveAuthToken({
|
|
71
|
+
credentials: this.options.credentials,
|
|
72
72
|
token: this.options.token,
|
|
73
|
-
getToken: this.options.getToken,
|
|
74
73
|
onEvent: this.options.onEvent,
|
|
75
74
|
fetch: this.options.fetch,
|
|
76
75
|
baseUrl: this.options.baseUrl,
|
|
77
|
-
authBaseUrl: this.options.authBaseUrl,
|
|
78
|
-
authClientId: this.options.authClientId,
|
|
79
76
|
});
|
|
80
77
|
}
|
|
81
78
|
// Helper to handle responses
|
|
@@ -116,7 +113,14 @@ class ZapierApiClient {
|
|
|
116
113
|
if (response.status === 401 || response.status === 403) {
|
|
117
114
|
// If we get a 401/403 error and no auth token was provided, give helpful message
|
|
118
115
|
if (wasMissingAuthToken) {
|
|
119
|
-
throw new ZapierAuthenticationError(`Authentication required (HTTP ${response.status}). Please provide
|
|
116
|
+
throw new ZapierAuthenticationError(`Authentication required (HTTP ${response.status}). Please provide credentials in options or set ZAPIER_CREDENTIALS environment variable.`, errorOptions);
|
|
117
|
+
}
|
|
118
|
+
// On 401, invalidate cached token so next request gets a fresh one
|
|
119
|
+
if (response.status === 401) {
|
|
120
|
+
await invalidateCredentialsToken({
|
|
121
|
+
credentials: this.options.credentials,
|
|
122
|
+
token: this.options.token,
|
|
123
|
+
});
|
|
120
124
|
}
|
|
121
125
|
throw new ZapierAuthenticationError(message, errorOptions);
|
|
122
126
|
}
|
|
@@ -290,30 +294,13 @@ class ZapierApiClient {
|
|
|
290
294
|
// before we even make a request.
|
|
291
295
|
if (options.authRequired) {
|
|
292
296
|
if (headers.get("Authorization") == null && authToken == null) {
|
|
293
|
-
throw new ZapierAuthenticationError(`Authentication required but no
|
|
297
|
+
throw new ZapierAuthenticationError(`Authentication required but no credentials available. Please set ZAPIER_CREDENTIALS, or run the 'login' command with the CLI.`);
|
|
294
298
|
}
|
|
295
299
|
}
|
|
296
300
|
return headers;
|
|
297
301
|
}
|
|
298
302
|
// Helper to perform HTTP requests with JSON handling
|
|
299
303
|
async fetchJson(method, path, data, options = {}) {
|
|
300
|
-
// Check if this path has a handler override
|
|
301
|
-
const routeMatch = matchRoute(method, path);
|
|
302
|
-
if (routeMatch) {
|
|
303
|
-
// Invoke the handler instead of making an HTTP request
|
|
304
|
-
// Merge params from all sources: body, searchParams, and route params
|
|
305
|
-
const handlerRequest = {
|
|
306
|
-
...(typeof data === "object" ? data : {}),
|
|
307
|
-
...options.searchParams,
|
|
308
|
-
...routeMatch.params,
|
|
309
|
-
};
|
|
310
|
-
return routeMatch.handler({
|
|
311
|
-
request: handlerRequest,
|
|
312
|
-
deps: {
|
|
313
|
-
httpClient: this,
|
|
314
|
-
},
|
|
315
|
-
});
|
|
316
|
-
}
|
|
317
304
|
const headers = { ...options.headers };
|
|
318
305
|
// Add Content-Type for JSON requests with body data
|
|
319
306
|
if (data && typeof data === "object") {
|
package/dist/api/client.test.js
CHANGED
|
@@ -4,6 +4,7 @@ import * as auth from "../auth";
|
|
|
4
4
|
vi.mock("../auth");
|
|
5
5
|
describe("ApiClient", () => {
|
|
6
6
|
const mockResolveAuthToken = vi.mocked(auth.resolveAuthToken);
|
|
7
|
+
const mockInvalidateCredentialsToken = vi.mocked(auth.invalidateCredentialsToken);
|
|
7
8
|
beforeEach(() => {
|
|
8
9
|
vi.clearAllMocks();
|
|
9
10
|
// Prevent any actual HTTP calls
|
|
@@ -14,83 +15,137 @@ describe("ApiClient", () => {
|
|
|
14
15
|
});
|
|
15
16
|
});
|
|
16
17
|
describe("authentication token resolution", () => {
|
|
17
|
-
it("should pass
|
|
18
|
+
it("should pass credentials to resolveAuthToken when provided", async () => {
|
|
18
19
|
mockResolveAuthToken.mockResolvedValue("test-token");
|
|
20
|
+
const credentials = {
|
|
21
|
+
type: "client_credentials",
|
|
22
|
+
clientId: "my-client",
|
|
23
|
+
clientSecret: "my-secret",
|
|
24
|
+
};
|
|
19
25
|
const client = createZapierApi({
|
|
20
26
|
baseUrl: "https://api.custom.zapier.dev",
|
|
21
|
-
|
|
27
|
+
credentials,
|
|
22
28
|
debug: false,
|
|
23
29
|
});
|
|
24
30
|
// Make a request that would trigger token resolution
|
|
25
31
|
await client.get("/test", { authRequired: true });
|
|
26
32
|
expect(mockResolveAuthToken).toHaveBeenCalledWith({
|
|
33
|
+
credentials,
|
|
27
34
|
token: undefined,
|
|
28
|
-
getToken: undefined,
|
|
29
35
|
onEvent: undefined,
|
|
30
36
|
fetch: expect.any(Function),
|
|
31
37
|
baseUrl: "https://api.custom.zapier.dev",
|
|
32
|
-
authBaseUrl: "https://auth.custom.zapier.dev",
|
|
33
|
-
authClientId: undefined,
|
|
34
38
|
});
|
|
35
39
|
});
|
|
36
|
-
it("should pass undefined
|
|
40
|
+
it("should pass undefined credentials when not provided", async () => {
|
|
37
41
|
mockResolveAuthToken.mockResolvedValue("test-token");
|
|
38
42
|
const client = createZapierApi({
|
|
39
43
|
baseUrl: "https://api.custom.zapier.dev",
|
|
40
|
-
// authBaseUrl intentionally omitted
|
|
41
44
|
debug: false,
|
|
42
45
|
});
|
|
43
46
|
// Make a request that would trigger token resolution
|
|
44
47
|
await client.get("/test", { authRequired: true });
|
|
45
48
|
expect(mockResolveAuthToken).toHaveBeenCalledWith({
|
|
49
|
+
credentials: undefined,
|
|
46
50
|
token: undefined,
|
|
47
|
-
getToken: undefined,
|
|
48
51
|
onEvent: undefined,
|
|
49
52
|
fetch: expect.any(Function),
|
|
50
53
|
baseUrl: "https://api.custom.zapier.dev",
|
|
51
|
-
authBaseUrl: undefined,
|
|
52
|
-
authClientId: undefined,
|
|
53
54
|
});
|
|
54
55
|
});
|
|
55
|
-
it("should pass
|
|
56
|
-
mockResolveAuthToken.mockResolvedValue("
|
|
56
|
+
it("should pass deprecated token option to resolveAuthToken", async () => {
|
|
57
|
+
mockResolveAuthToken.mockResolvedValue("direct-token");
|
|
57
58
|
const client = createZapierApi({
|
|
59
|
+
token: "direct-token",
|
|
58
60
|
baseUrl: "https://api.custom.zapier.dev",
|
|
59
|
-
authClientId: "custom-client-id",
|
|
60
61
|
debug: false,
|
|
61
62
|
});
|
|
62
|
-
// Make a request that would
|
|
63
|
+
// Make a request that would use the direct token
|
|
63
64
|
await client.get("/test", { authRequired: true });
|
|
65
|
+
// resolveAuthToken is still called, but it returns the direct token immediately
|
|
64
66
|
expect(mockResolveAuthToken).toHaveBeenCalledWith({
|
|
67
|
+
credentials: undefined,
|
|
68
|
+
token: "direct-token",
|
|
69
|
+
onEvent: undefined,
|
|
70
|
+
fetch: expect.any(Function),
|
|
71
|
+
baseUrl: "https://api.custom.zapier.dev",
|
|
72
|
+
});
|
|
73
|
+
});
|
|
74
|
+
it("should pass string credentials to resolveAuthToken", async () => {
|
|
75
|
+
mockResolveAuthToken.mockResolvedValue("string-token");
|
|
76
|
+
const client = createZapierApi({
|
|
77
|
+
credentials: "string-token",
|
|
78
|
+
baseUrl: "https://api.custom.zapier.dev",
|
|
79
|
+
debug: false,
|
|
80
|
+
});
|
|
81
|
+
await client.get("/test", { authRequired: true });
|
|
82
|
+
expect(mockResolveAuthToken).toHaveBeenCalledWith({
|
|
83
|
+
credentials: "string-token",
|
|
65
84
|
token: undefined,
|
|
66
|
-
getToken: undefined,
|
|
67
85
|
onEvent: undefined,
|
|
68
86
|
fetch: expect.any(Function),
|
|
69
87
|
baseUrl: "https://api.custom.zapier.dev",
|
|
70
|
-
authBaseUrl: undefined,
|
|
71
|
-
authClientId: "custom-client-id",
|
|
72
88
|
});
|
|
73
89
|
});
|
|
74
|
-
it("should
|
|
75
|
-
mockResolveAuthToken.mockResolvedValue("
|
|
90
|
+
it("should pass credentials function to resolveAuthToken", async () => {
|
|
91
|
+
mockResolveAuthToken.mockResolvedValue("function-token");
|
|
92
|
+
const credentialsFn = () => Promise.resolve("dynamic-token");
|
|
76
93
|
const client = createZapierApi({
|
|
77
|
-
|
|
94
|
+
credentials: credentialsFn,
|
|
78
95
|
baseUrl: "https://api.custom.zapier.dev",
|
|
79
|
-
authBaseUrl: "https://auth.custom.zapier.dev",
|
|
80
96
|
debug: false,
|
|
81
97
|
});
|
|
82
|
-
// Make a request that would use the direct token
|
|
83
98
|
await client.get("/test", { authRequired: true });
|
|
84
|
-
// resolveAuthToken is still called, but it returns the direct token immediately
|
|
85
99
|
expect(mockResolveAuthToken).toHaveBeenCalledWith({
|
|
86
|
-
|
|
87
|
-
|
|
100
|
+
credentials: credentialsFn,
|
|
101
|
+
token: undefined,
|
|
88
102
|
onEvent: undefined,
|
|
89
103
|
fetch: expect.any(Function),
|
|
90
104
|
baseUrl: "https://api.custom.zapier.dev",
|
|
91
|
-
authBaseUrl: "https://auth.custom.zapier.dev",
|
|
92
|
-
authClientId: undefined,
|
|
93
105
|
});
|
|
94
106
|
});
|
|
95
107
|
});
|
|
108
|
+
describe("401 cache invalidation", () => {
|
|
109
|
+
it("should invalidate credentials token on 401 response", async () => {
|
|
110
|
+
mockResolveAuthToken.mockResolvedValue("test-token");
|
|
111
|
+
mockInvalidateCredentialsToken.mockResolvedValue(undefined);
|
|
112
|
+
const clientCredentials = {
|
|
113
|
+
type: "client_credentials",
|
|
114
|
+
clientId: "my-client-id",
|
|
115
|
+
clientSecret: "my-secret",
|
|
116
|
+
};
|
|
117
|
+
global.fetch = vi.fn().mockResolvedValue({
|
|
118
|
+
ok: false,
|
|
119
|
+
status: 401,
|
|
120
|
+
statusText: "Unauthorized",
|
|
121
|
+
json: () => Promise.resolve({ message: "Invalid token" }),
|
|
122
|
+
});
|
|
123
|
+
const client = createZapierApi({
|
|
124
|
+
credentials: clientCredentials,
|
|
125
|
+
baseUrl: "https://api.custom.zapier.dev",
|
|
126
|
+
debug: false,
|
|
127
|
+
});
|
|
128
|
+
await expect(client.get("/test")).rejects.toThrow();
|
|
129
|
+
expect(mockInvalidateCredentialsToken).toHaveBeenCalledWith({
|
|
130
|
+
credentials: clientCredentials,
|
|
131
|
+
token: undefined,
|
|
132
|
+
});
|
|
133
|
+
});
|
|
134
|
+
it("should not invalidate cache on 403 response", async () => {
|
|
135
|
+
mockResolveAuthToken.mockResolvedValue("test-token");
|
|
136
|
+
global.fetch = vi.fn().mockResolvedValue({
|
|
137
|
+
ok: false,
|
|
138
|
+
status: 403,
|
|
139
|
+
statusText: "Forbidden",
|
|
140
|
+
json: () => Promise.resolve({ message: "Access denied" }),
|
|
141
|
+
});
|
|
142
|
+
const client = createZapierApi({
|
|
143
|
+
credentials: "test-token",
|
|
144
|
+
baseUrl: "https://api.custom.zapier.dev",
|
|
145
|
+
debug: false,
|
|
146
|
+
});
|
|
147
|
+
await expect(client.get("/test")).rejects.toThrow();
|
|
148
|
+
expect(mockInvalidateCredentialsToken).not.toHaveBeenCalled();
|
|
149
|
+
});
|
|
150
|
+
});
|
|
96
151
|
});
|
package/dist/api/index.d.ts
CHANGED
|
@@ -7,6 +7,7 @@
|
|
|
7
7
|
*/
|
|
8
8
|
export type { ApiClient, ApiClientOptions, RequestOptions, PollOptions, DebugLogger, Action, Field, Choice, ActionExecutionResult, ActionField, ActionFieldChoice, NeedsRequest, NeedsResponse, Authentication, AuthenticationsResponse, Implementation, ImplementationsResponse, } from "./types";
|
|
9
9
|
import type { ApiClient } from "./types";
|
|
10
|
+
import type { Credentials } from "../types/credentials";
|
|
10
11
|
export { isJwt, getAuthorizationHeader } from "./auth";
|
|
11
12
|
export { createDebugLogger, createDebugFetch } from "./debug";
|
|
12
13
|
export { pollUntilComplete } from "./polling";
|
|
@@ -20,9 +21,9 @@ export declare function generateRequestId(): string;
|
|
|
20
21
|
*/
|
|
21
22
|
export declare function getOrCreateApiClient(config: {
|
|
22
23
|
baseUrl?: string;
|
|
23
|
-
|
|
24
|
+
credentials?: Credentials;
|
|
25
|
+
/** @deprecated Use `credentials` instead */
|
|
24
26
|
token?: string;
|
|
25
|
-
getToken?: () => Promise<string | undefined>;
|
|
26
27
|
api?: ApiClient;
|
|
27
28
|
debug?: boolean;
|
|
28
29
|
fetch?: typeof globalThis.fetch;
|
package/dist/api/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/api/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAGH,YAAY,EAEV,SAAS,EACT,gBAAgB,EAChB,cAAc,EACd,WAAW,EACX,WAAW,EAEX,MAAM,EACN,KAAK,EACL,MAAM,EACN,qBAAqB,EACrB,WAAW,EACX,iBAAiB,EACjB,YAAY,EACZ,aAAa,EACb,cAAc,EACd,uBAAuB,EACvB,cAAc,EACd,uBAAuB,GACxB,MAAM,SAAS,CAAC;AAGjB,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/api/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAGH,YAAY,EAEV,SAAS,EACT,gBAAgB,EAChB,cAAc,EACd,WAAW,EACX,WAAW,EAEX,MAAM,EACN,KAAK,EACL,MAAM,EACN,qBAAqB,EACrB,WAAW,EACX,iBAAiB,EACjB,YAAY,EACZ,aAAa,EACb,cAAc,EACd,uBAAuB,EACvB,cAAc,EACd,uBAAuB,GACxB,MAAM,SAAS,CAAC;AAGjB,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AACzC,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AAIxD,OAAO,EAAE,KAAK,EAAE,sBAAsB,EAAE,MAAM,QAAQ,CAAC;AAGvD,OAAO,EAAE,iBAAiB,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAC;AAG9D,OAAO,EAAE,iBAAiB,EAAE,MAAM,WAAW,CAAC;AAG9C,OAAO,EAAE,eAAe,EAAE,MAAM,UAAU,CAAC;AAM3C,wBAAgB,iBAAiB,IAAI,MAAM,CAE1C;AAED;;;;;GAKG;AACH,wBAAgB,oBAAoB,CAAC,MAAM,EAAE;IAC3C,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,WAAW,CAAC,EAAE,WAAW,CAAC;IAC1B,4CAA4C;IAC5C,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,GAAG,CAAC,EAAE,SAAS,CAAC;IAChB,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,KAAK,CAAC,EAAE,OAAO,UAAU,CAAC,KAAK,CAAC;CACjC,GAAG,SAAS,CAsBZ"}
|
package/dist/api/index.js
CHANGED
|
@@ -27,16 +27,15 @@ export function generateRequestId() {
|
|
|
27
27
|
* @returns ApiClient instance
|
|
28
28
|
*/
|
|
29
29
|
export function getOrCreateApiClient(config) {
|
|
30
|
-
const { baseUrl = ZAPIER_BASE_URL,
|
|
30
|
+
const { baseUrl = ZAPIER_BASE_URL, credentials, token, api: providedApi, debug = false, fetch: customFetch, } = config;
|
|
31
31
|
// Use provided API client or create a new one
|
|
32
32
|
if (providedApi) {
|
|
33
33
|
return providedApi;
|
|
34
34
|
}
|
|
35
35
|
return createZapierApi({
|
|
36
36
|
baseUrl,
|
|
37
|
-
|
|
37
|
+
credentials,
|
|
38
38
|
token,
|
|
39
|
-
getToken,
|
|
40
39
|
debug,
|
|
41
40
|
fetch: customFetch,
|
|
42
41
|
});
|
package/dist/api/schemas.d.ts
CHANGED
|
@@ -42,6 +42,7 @@ export declare const NeedSchema: z.ZodObject<{
|
|
|
42
42
|
type: z.ZodOptional<z.ZodEnum<{
|
|
43
43
|
string: "string";
|
|
44
44
|
boolean: "boolean";
|
|
45
|
+
filter: "filter";
|
|
45
46
|
file: "file";
|
|
46
47
|
integer: "integer";
|
|
47
48
|
text: "text";
|
|
@@ -51,7 +52,6 @@ export declare const NeedSchema: z.ZodObject<{
|
|
|
51
52
|
password: "password";
|
|
52
53
|
dict: "dict";
|
|
53
54
|
code: "code";
|
|
54
|
-
filter: "filter";
|
|
55
55
|
json: "json";
|
|
56
56
|
}>>;
|
|
57
57
|
list: z.ZodOptional<z.ZodBoolean>;
|
|
@@ -65,8 +65,8 @@ export declare const ActionPermissionsSchema: z.ZodObject<{
|
|
|
65
65
|
export declare const ActionSchema: z.ZodObject<{
|
|
66
66
|
id: z.ZodOptional<z.ZodString>;
|
|
67
67
|
type: z.ZodEnum<{
|
|
68
|
-
search: "search";
|
|
69
68
|
filter: "filter";
|
|
69
|
+
search: "search";
|
|
70
70
|
read: "read";
|
|
71
71
|
read_bulk: "read_bulk";
|
|
72
72
|
run: "run";
|
|
@@ -286,6 +286,7 @@ export declare const NeedsResponseSchema: z.ZodObject<{
|
|
|
286
286
|
type: z.ZodOptional<z.ZodEnum<{
|
|
287
287
|
string: "string";
|
|
288
288
|
boolean: "boolean";
|
|
289
|
+
filter: "filter";
|
|
289
290
|
file: "file";
|
|
290
291
|
integer: "integer";
|
|
291
292
|
text: "text";
|
|
@@ -295,7 +296,6 @@ export declare const NeedsResponseSchema: z.ZodObject<{
|
|
|
295
296
|
password: "password";
|
|
296
297
|
dict: "dict";
|
|
297
298
|
code: "code";
|
|
298
|
-
filter: "filter";
|
|
299
299
|
json: "json";
|
|
300
300
|
}>>;
|
|
301
301
|
list: z.ZodOptional<z.ZodBoolean>;
|
|
@@ -312,8 +312,8 @@ export declare const ImplementationSchema: z.ZodObject<{
|
|
|
312
312
|
actions: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
313
313
|
id: z.ZodOptional<z.ZodString>;
|
|
314
314
|
type: z.ZodEnum<{
|
|
315
|
-
search: "search";
|
|
316
315
|
filter: "filter";
|
|
316
|
+
search: "search";
|
|
317
317
|
read: "read";
|
|
318
318
|
read_bulk: "read_bulk";
|
|
319
319
|
run: "run";
|
|
@@ -354,8 +354,8 @@ export declare const ImplementationsResponseSchema: z.ZodObject<{
|
|
|
354
354
|
actions: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
355
355
|
id: z.ZodOptional<z.ZodString>;
|
|
356
356
|
type: z.ZodEnum<{
|
|
357
|
-
search: "search";
|
|
358
357
|
filter: "filter";
|
|
358
|
+
search: "search";
|
|
359
359
|
read: "read";
|
|
360
360
|
read_bulk: "read_bulk";
|
|
361
361
|
run: "run";
|
|
@@ -385,115 +385,6 @@ export declare const ImplementationsResponseSchema: z.ZodObject<{
|
|
|
385
385
|
other_implementations: z.ZodOptional<z.ZodString>;
|
|
386
386
|
}, z.core.$strip>>;
|
|
387
387
|
}, z.core.$strip>;
|
|
388
|
-
export declare const ImplementationMetaSchema: z.ZodObject<{
|
|
389
|
-
id: z.ZodString;
|
|
390
|
-
name: z.ZodString;
|
|
391
|
-
slug: z.ZodString;
|
|
392
|
-
age_in_days: z.ZodOptional<z.ZodNumber>;
|
|
393
|
-
auth_type: z.ZodOptional<z.ZodString>;
|
|
394
|
-
banner: z.ZodOptional<z.ZodString>;
|
|
395
|
-
categories: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
396
|
-
id: z.ZodNumber;
|
|
397
|
-
name: z.ZodString;
|
|
398
|
-
slug: z.ZodString;
|
|
399
|
-
}, z.core.$strip>>>;
|
|
400
|
-
images: z.ZodOptional<z.ZodObject<{
|
|
401
|
-
url_16x16: z.ZodOptional<z.ZodString>;
|
|
402
|
-
url_32x32: z.ZodOptional<z.ZodString>;
|
|
403
|
-
url_64x64: z.ZodOptional<z.ZodString>;
|
|
404
|
-
url_128x128: z.ZodOptional<z.ZodString>;
|
|
405
|
-
}, z.core.$strip>>;
|
|
406
|
-
popularity: z.ZodOptional<z.ZodNumber>;
|
|
407
|
-
has_filters: z.ZodOptional<z.ZodBoolean>;
|
|
408
|
-
has_reads: z.ZodOptional<z.ZodBoolean>;
|
|
409
|
-
has_searches: z.ZodOptional<z.ZodBoolean>;
|
|
410
|
-
has_searches_or_writes: z.ZodOptional<z.ZodBoolean>;
|
|
411
|
-
has_upfront_fields: z.ZodOptional<z.ZodBoolean>;
|
|
412
|
-
has_writes: z.ZodOptional<z.ZodBoolean>;
|
|
413
|
-
is_beta: z.ZodOptional<z.ZodBoolean>;
|
|
414
|
-
is_built_in: z.ZodOptional<z.ZodBoolean>;
|
|
415
|
-
is_deprecated: z.ZodOptional<z.ZodBoolean>;
|
|
416
|
-
is_featured: z.ZodOptional<z.ZodBoolean>;
|
|
417
|
-
is_hidden: z.ZodOptional<z.ZodBoolean>;
|
|
418
|
-
is_invite: z.ZodOptional<z.ZodBoolean>;
|
|
419
|
-
is_premium: z.ZodOptional<z.ZodBoolean>;
|
|
420
|
-
is_public: z.ZodOptional<z.ZodBoolean>;
|
|
421
|
-
is_upcoming: z.ZodOptional<z.ZodBoolean>;
|
|
422
|
-
version: z.ZodOptional<z.ZodString>;
|
|
423
|
-
visibility: z.ZodOptional<z.ZodString>;
|
|
424
|
-
actions: z.ZodOptional<z.ZodObject<{
|
|
425
|
-
read: z.ZodOptional<z.ZodNumber>;
|
|
426
|
-
read_bulk: z.ZodOptional<z.ZodNumber>;
|
|
427
|
-
write: z.ZodOptional<z.ZodNumber>;
|
|
428
|
-
search: z.ZodOptional<z.ZodNumber>;
|
|
429
|
-
search_or_write: z.ZodOptional<z.ZodNumber>;
|
|
430
|
-
search_and_write: z.ZodOptional<z.ZodNumber>;
|
|
431
|
-
filter: z.ZodOptional<z.ZodNumber>;
|
|
432
|
-
}, z.core.$strip>>;
|
|
433
|
-
description: z.ZodOptional<z.ZodString>;
|
|
434
|
-
primary_color: z.ZodOptional<z.ZodString>;
|
|
435
|
-
secondary_color: z.ZodOptional<z.ZodString>;
|
|
436
|
-
classification: z.ZodOptional<z.ZodString>;
|
|
437
|
-
api_docs_url: z.ZodOptional<z.ZodString>;
|
|
438
|
-
image: z.ZodOptional<z.ZodString>;
|
|
439
|
-
}, z.core.$strip>;
|
|
440
|
-
export declare const ImplementationsMetaResponseSchema: z.ZodObject<{
|
|
441
|
-
count: z.ZodNumber;
|
|
442
|
-
next: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
443
|
-
previous: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
444
|
-
results: z.ZodArray<z.ZodObject<{
|
|
445
|
-
id: z.ZodString;
|
|
446
|
-
name: z.ZodString;
|
|
447
|
-
slug: z.ZodString;
|
|
448
|
-
age_in_days: z.ZodOptional<z.ZodNumber>;
|
|
449
|
-
auth_type: z.ZodOptional<z.ZodString>;
|
|
450
|
-
banner: z.ZodOptional<z.ZodString>;
|
|
451
|
-
categories: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
452
|
-
id: z.ZodNumber;
|
|
453
|
-
name: z.ZodString;
|
|
454
|
-
slug: z.ZodString;
|
|
455
|
-
}, z.core.$strip>>>;
|
|
456
|
-
images: z.ZodOptional<z.ZodObject<{
|
|
457
|
-
url_16x16: z.ZodOptional<z.ZodString>;
|
|
458
|
-
url_32x32: z.ZodOptional<z.ZodString>;
|
|
459
|
-
url_64x64: z.ZodOptional<z.ZodString>;
|
|
460
|
-
url_128x128: z.ZodOptional<z.ZodString>;
|
|
461
|
-
}, z.core.$strip>>;
|
|
462
|
-
popularity: z.ZodOptional<z.ZodNumber>;
|
|
463
|
-
has_filters: z.ZodOptional<z.ZodBoolean>;
|
|
464
|
-
has_reads: z.ZodOptional<z.ZodBoolean>;
|
|
465
|
-
has_searches: z.ZodOptional<z.ZodBoolean>;
|
|
466
|
-
has_searches_or_writes: z.ZodOptional<z.ZodBoolean>;
|
|
467
|
-
has_upfront_fields: z.ZodOptional<z.ZodBoolean>;
|
|
468
|
-
has_writes: z.ZodOptional<z.ZodBoolean>;
|
|
469
|
-
is_beta: z.ZodOptional<z.ZodBoolean>;
|
|
470
|
-
is_built_in: z.ZodOptional<z.ZodBoolean>;
|
|
471
|
-
is_deprecated: z.ZodOptional<z.ZodBoolean>;
|
|
472
|
-
is_featured: z.ZodOptional<z.ZodBoolean>;
|
|
473
|
-
is_hidden: z.ZodOptional<z.ZodBoolean>;
|
|
474
|
-
is_invite: z.ZodOptional<z.ZodBoolean>;
|
|
475
|
-
is_premium: z.ZodOptional<z.ZodBoolean>;
|
|
476
|
-
is_public: z.ZodOptional<z.ZodBoolean>;
|
|
477
|
-
is_upcoming: z.ZodOptional<z.ZodBoolean>;
|
|
478
|
-
version: z.ZodOptional<z.ZodString>;
|
|
479
|
-
visibility: z.ZodOptional<z.ZodString>;
|
|
480
|
-
actions: z.ZodOptional<z.ZodObject<{
|
|
481
|
-
read: z.ZodOptional<z.ZodNumber>;
|
|
482
|
-
read_bulk: z.ZodOptional<z.ZodNumber>;
|
|
483
|
-
write: z.ZodOptional<z.ZodNumber>;
|
|
484
|
-
search: z.ZodOptional<z.ZodNumber>;
|
|
485
|
-
search_or_write: z.ZodOptional<z.ZodNumber>;
|
|
486
|
-
search_and_write: z.ZodOptional<z.ZodNumber>;
|
|
487
|
-
filter: z.ZodOptional<z.ZodNumber>;
|
|
488
|
-
}, z.core.$strip>>;
|
|
489
|
-
description: z.ZodOptional<z.ZodString>;
|
|
490
|
-
primary_color: z.ZodOptional<z.ZodString>;
|
|
491
|
-
secondary_color: z.ZodOptional<z.ZodString>;
|
|
492
|
-
classification: z.ZodOptional<z.ZodString>;
|
|
493
|
-
api_docs_url: z.ZodOptional<z.ZodString>;
|
|
494
|
-
image: z.ZodOptional<z.ZodString>;
|
|
495
|
-
}, z.core.$strip>>;
|
|
496
|
-
}, z.core.$strip>;
|
|
497
388
|
export declare const NeedChoicesResponseMetaSchema: z.ZodObject<{
|
|
498
389
|
page: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
499
390
|
}, z.core.$strip>;
|
|
@@ -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;;;;;iBAK5B,CAAC;AAEH,eAAO,MAAM,UAAU;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBA0CrB,CAAC;AAEH,eAAO,MAAM,iBAAiB;;iBAE5B,CAAC;AAEH,eAAO,MAAM,uBAAuB;;iBAElC,CAAC;AAEH,eAAO,MAAM,YAAY;;;;;;;;;;;;;;;;;;iBAkBvB,CAAC;AAEH,eAAO,MAAM,YAAY;;;iBAGvB,CAAC;AAEH,eAAO,MAAM,WAAW;;;;;;;;;;;;;;;;;;iBAetB,CAAC;AAEH,eAAO,MAAM,2BAA2B;;iBAEtC,CAAC;AAEH,eAAO,MAAM,uBAAuB;;;iBAGlC,CAAC;AAEH,eAAO,MAAM,iBAAiB;;;;;;;;;;;;;;;;;;iBAe5B,CAAC;AAMH,eAAO,MAAM,iBAAiB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAoD5B,CAAC;AAEH,eAAO,MAAM,SAAS;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBA+BpB,CAAC;AAEH,eAAO,MAAM,aAAa;;;;;;;;;;;;;iBAaxB,CAAC;AAEH,eAAO,MAAM,sBAAsB;;;;;;;;;;;;;;;;;iBAIjC,CAAC;AAMH,eAAO,MAAM,kBAAkB;;;;;;iBAM7B,CAAC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;;;;;;;;;;iBAIjC,CAAC;AAMH,eAAO,MAAM,kBAAkB;;;;;;iBAM7B,CAAC;AAEH,eAAO,MAAM,mBAAmB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAM9B,CAAC;AAMH,eAAO,MAAM,oBAAoB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAmB/B,CAAC;AAEH,eAAO,MAAM,6BAA6B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAKxC,CAAC;AAMH,eAAO,MAAM,6BAA6B;;iBAExC,CAAC;AAEH,eAAO,MAAM,8BAA8B;;;iBAGzC,CAAC;AAEH,eAAO,MAAM,wBAAwB;;;;;;;;iBAsCnC,CAAC;AAEH,eAAO,MAAM,yBAAyB;;;;;;;;;;;;;;;;;iBAOpC,CAAC"}
|
package/dist/api/schemas.js
CHANGED
|
@@ -276,73 +276,6 @@ export const ImplementationsResponseSchema = z.object({
|
|
|
276
276
|
results: z.array(ImplementationSchema),
|
|
277
277
|
});
|
|
278
278
|
// ============================================================================
|
|
279
|
-
// Lightweight Implementation Meta Schema
|
|
280
|
-
// ============================================================================
|
|
281
|
-
export const ImplementationMetaSchema = z.object({
|
|
282
|
-
id: z.string(), // e.g. "100HiresCLIAPI@1.2.1"
|
|
283
|
-
name: z.string(),
|
|
284
|
-
slug: z.string(),
|
|
285
|
-
age_in_days: z.number().optional(),
|
|
286
|
-
auth_type: z.string().optional(),
|
|
287
|
-
banner: z.string().optional(),
|
|
288
|
-
categories: z
|
|
289
|
-
.array(z.object({
|
|
290
|
-
id: z.number(),
|
|
291
|
-
name: z.string(),
|
|
292
|
-
slug: z.string(),
|
|
293
|
-
}))
|
|
294
|
-
.optional(),
|
|
295
|
-
images: z
|
|
296
|
-
.object({
|
|
297
|
-
url_16x16: z.string().optional(),
|
|
298
|
-
url_32x32: z.string().optional(),
|
|
299
|
-
url_64x64: z.string().optional(),
|
|
300
|
-
url_128x128: z.string().optional(),
|
|
301
|
-
})
|
|
302
|
-
.optional(),
|
|
303
|
-
popularity: z.number().optional(),
|
|
304
|
-
has_filters: z.boolean().optional(),
|
|
305
|
-
has_reads: z.boolean().optional(),
|
|
306
|
-
has_searches: z.boolean().optional(),
|
|
307
|
-
has_searches_or_writes: z.boolean().optional(),
|
|
308
|
-
has_upfront_fields: z.boolean().optional(),
|
|
309
|
-
has_writes: z.boolean().optional(),
|
|
310
|
-
is_beta: z.boolean().optional(),
|
|
311
|
-
is_built_in: z.boolean().optional(),
|
|
312
|
-
is_deprecated: z.boolean().optional(),
|
|
313
|
-
is_featured: z.boolean().optional(),
|
|
314
|
-
is_hidden: z.boolean().optional(),
|
|
315
|
-
is_invite: z.boolean().optional(),
|
|
316
|
-
is_premium: z.boolean().optional(),
|
|
317
|
-
is_public: z.boolean().optional(),
|
|
318
|
-
is_upcoming: z.boolean().optional(),
|
|
319
|
-
version: z.string().optional(),
|
|
320
|
-
visibility: z.string().optional(),
|
|
321
|
-
actions: z
|
|
322
|
-
.object({
|
|
323
|
-
read: z.number().optional(),
|
|
324
|
-
read_bulk: z.number().optional(),
|
|
325
|
-
write: z.number().optional(),
|
|
326
|
-
search: z.number().optional(),
|
|
327
|
-
search_or_write: z.number().optional(),
|
|
328
|
-
search_and_write: z.number().optional(),
|
|
329
|
-
filter: z.number().optional(),
|
|
330
|
-
})
|
|
331
|
-
.optional(),
|
|
332
|
-
description: z.string().optional(),
|
|
333
|
-
primary_color: z.string().optional(),
|
|
334
|
-
secondary_color: z.string().optional(),
|
|
335
|
-
classification: z.string().optional(),
|
|
336
|
-
api_docs_url: z.string().optional(),
|
|
337
|
-
image: z.string().optional(),
|
|
338
|
-
});
|
|
339
|
-
export const ImplementationsMetaResponseSchema = z.object({
|
|
340
|
-
count: z.number(),
|
|
341
|
-
next: z.string().nullable().optional(),
|
|
342
|
-
previous: z.string().nullable().optional(),
|
|
343
|
-
results: z.array(ImplementationMetaSchema),
|
|
344
|
-
});
|
|
345
|
-
// ============================================================================
|
|
346
279
|
// Need Choices Schemas (for listInputFieldChoices functionality)
|
|
347
280
|
// ============================================================================
|
|
348
281
|
export const NeedChoicesResponseMetaSchema = z.object({
|
package/dist/api/types.d.ts
CHANGED
|
@@ -9,15 +9,21 @@
|
|
|
9
9
|
* to ensure a single source of truth and eliminate duplication.
|
|
10
10
|
*/
|
|
11
11
|
import type { AuthenticationSchema, AuthenticationsResponseSchema } from "@zapier/zapier-sdk-core/v0/schemas/authentications";
|
|
12
|
+
import type { ImplementationMetaSchema, ImplementationsMetaResponseSchema } from "@zapier/zapier-sdk-core/v0/schemas/implementations";
|
|
12
13
|
import type { SdkEvent } from "../types/events";
|
|
14
|
+
import type { Credentials } from "../types/credentials";
|
|
13
15
|
import type { z } from "zod";
|
|
14
|
-
import type { NeedChoicesSchema, NeedSchema, ActionLinksSchema, ActionPermissionsSchema, ActionSchema, ChoiceSchema, FieldSchema, ActionExecutionResultSchema, ActionFieldChoiceSchema, ActionFieldSchema, UserProfileSchema, AppSchema, NeedsRequestSchema, NeedsResponseSchema, ImplementationSchema, ImplementationsResponseSchema,
|
|
16
|
+
import type { NeedChoicesSchema, NeedSchema, ActionLinksSchema, ActionPermissionsSchema, ActionSchema, ChoiceSchema, FieldSchema, ActionExecutionResultSchema, ActionFieldChoiceSchema, ActionFieldSchema, UserProfileSchema, AppSchema, NeedsRequestSchema, NeedsResponseSchema, ImplementationSchema, ImplementationsResponseSchema, ServiceSchema, ServicesResponseSchema, NeedChoicesRequestSchema, NeedChoicesResponseSchema, NeedChoicesResponseMetaSchema, NeedChoicesResponseLinksSchema } from "./schemas";
|
|
15
17
|
export interface ApiClientOptions {
|
|
16
18
|
baseUrl: string;
|
|
17
|
-
|
|
18
|
-
|
|
19
|
+
/**
|
|
20
|
+
* Authentication credentials.
|
|
21
|
+
*/
|
|
22
|
+
credentials?: Credentials;
|
|
23
|
+
/**
|
|
24
|
+
* @deprecated Use `credentials` instead.
|
|
25
|
+
*/
|
|
19
26
|
token?: string;
|
|
20
|
-
getToken?: () => Promise<string | undefined>;
|
|
21
27
|
debug?: boolean;
|
|
22
28
|
fetch?: typeof globalThis.fetch;
|
|
23
29
|
onEvent?: (event: SdkEvent) => void;
|
package/dist/api/types.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/api/types.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AACH,OAAO,KAAK,EACV,oBAAoB,EACpB,6BAA6B,EAC9B,MAAM,oDAAoD,CAAC;AAC5D,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAChD,OAAO,KAAK,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAC7B,OAAO,KAAK,EACV,iBAAiB,EACjB,UAAU,EACV,iBAAiB,EACjB,uBAAuB,EACvB,YAAY,EACZ,YAAY,EACZ,WAAW,EACX,2BAA2B,EAC3B,uBAAuB,EACvB,iBAAiB,EACjB,iBAAiB,EACjB,SAAS,EACT,kBAAkB,EAClB,mBAAmB,EACnB,oBAAoB,EACpB,6BAA6B,EAC7B,
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/api/types.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AACH,OAAO,KAAK,EACV,oBAAoB,EACpB,6BAA6B,EAC9B,MAAM,oDAAoD,CAAC;AAC5D,OAAO,KAAK,EACV,wBAAwB,EACxB,iCAAiC,EAClC,MAAM,oDAAoD,CAAC;AAC5D,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAChD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AACxD,OAAO,KAAK,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAC7B,OAAO,KAAK,EACV,iBAAiB,EACjB,UAAU,EACV,iBAAiB,EACjB,uBAAuB,EACvB,YAAY,EACZ,YAAY,EACZ,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