@zapier/zapier-sdk 0.25.2 → 0.26.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 +12 -0
- package/CLAUDE.md +273 -0
- package/README.md +9 -10
- package/dist/index.cjs +4 -28
- package/dist/index.d.mts +0 -5
- package/dist/index.mjs +4 -28
- package/dist/plugins/apps/index.d.ts.map +1 -1
- package/dist/plugins/apps/schemas.d.ts +0 -1
- package/dist/plugins/apps/schemas.d.ts.map +1 -1
- package/dist/plugins/fetch/index.d.ts +0 -2
- package/dist/plugins/fetch/index.d.ts.map +1 -1
- package/dist/plugins/fetch/index.js +1 -4
- package/dist/plugins/fetch/index.test.js +0 -2
- package/dist/plugins/fetch/schemas.d.ts +0 -1
- package/dist/plugins/fetch/schemas.d.ts.map +1 -1
- package/dist/plugins/fetch/schemas.js +0 -4
- package/dist/plugins/request/index.d.ts.map +1 -1
- package/dist/plugins/request/index.js +1 -2
- package/dist/plugins/request/index.test.js +0 -5
- package/dist/plugins/request/schemas.d.ts +0 -2
- package/dist/plugins/request/schemas.d.ts.map +1 -1
- package/dist/plugins/request/schemas.js +0 -4
- package/package.json +2 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
# @zapier/zapier-sdk
|
|
2
2
|
|
|
3
|
+
## 0.26.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- bfdd383: Remove authenticationTemplate option from fetch.
|
|
8
|
+
|
|
9
|
+
## 0.25.3
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- 7ab8539: Adding feedback command for submitting SDK feedback
|
|
14
|
+
|
|
3
15
|
## 0.25.2
|
|
4
16
|
|
|
5
17
|
### Patch Changes
|
package/CLAUDE.md
ADDED
|
@@ -0,0 +1,273 @@
|
|
|
1
|
+
# @zapier/zapier-sdk
|
|
2
|
+
|
|
3
|
+
TypeScript SDK for interacting with Zapier's API. See the [README](./README.md) for installation and quickstart instructions.
|
|
4
|
+
|
|
5
|
+
## Architecture & Mental Model
|
|
6
|
+
|
|
7
|
+
The SDK uses a **plugin-based architecture** where functionality is composed from modular plugins. Each plugin (like `listApps`, `runAction`, `apps`) adds methods to the SDK instance. This design allows for tree-shaking and modular extension.
|
|
8
|
+
|
|
9
|
+
**Key principles:**
|
|
10
|
+
|
|
11
|
+
- **Factory functions over classes**: Always use `createZapierSdk()` to create an SDK instance. The SDK never requires `new`.
|
|
12
|
+
- **Wrapped responses**: All SDK methods return `{ data }` wrappers (e.g., `{ data: app }` or `{ data: apps, nextCursor }`). This allows adding metadata in the future without breaking changes.
|
|
13
|
+
- **Single object parameters**: Methods take a single options object, making it easy to add parameters later without breaking existing code.
|
|
14
|
+
|
|
15
|
+
```typescript
|
|
16
|
+
// The SDK instance provides all methods via plugins
|
|
17
|
+
const zapier = createZapierSdk();
|
|
18
|
+
|
|
19
|
+
// Methods return wrapped responses
|
|
20
|
+
const { data: app } = await zapier.getApp({ appKey: "slack" });
|
|
21
|
+
const { data: apps, nextCursor } = await zapier.listApps();
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
## Authentication Flow
|
|
25
|
+
|
|
26
|
+
The SDK uses a unified `credentials` option that supports multiple authentication methods.
|
|
27
|
+
|
|
28
|
+
### Development: CLI Login (Recommended)
|
|
29
|
+
|
|
30
|
+
The easiest approach for local development. Run `npx zapier-sdk login` once, and the SDK automatically uses those credentials.
|
|
31
|
+
|
|
32
|
+
```typescript
|
|
33
|
+
// No credentials needed - SDK reads from CLI login automatically
|
|
34
|
+
const zapier = createZapierSdk();
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
The CLI stores tokens in `~/.zapier-sdk/config.json`. The SDK checks for this file when no credentials are provided.
|
|
38
|
+
|
|
39
|
+
### Production: Token String
|
|
40
|
+
|
|
41
|
+
For deployed applications with a pre-obtained token:
|
|
42
|
+
|
|
43
|
+
```typescript
|
|
44
|
+
// Option 1: Pass token directly via credentials
|
|
45
|
+
const zapier = createZapierSdk({ credentials: process.env.ZAPIER_CREDENTIALS });
|
|
46
|
+
|
|
47
|
+
// Option 2: Use ZAPIER_CREDENTIALS environment variable (SDK reads it automatically)
|
|
48
|
+
const zapier = createZapierSdk();
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
### Production: Client Credentials (OAuth)
|
|
52
|
+
|
|
53
|
+
For server-to-server authentication using OAuth client credentials flow:
|
|
54
|
+
|
|
55
|
+
```typescript
|
|
56
|
+
const zapier = createZapierSdk({
|
|
57
|
+
credentials: {
|
|
58
|
+
type: "client_credentials",
|
|
59
|
+
clientId: process.env.ZAPIER_CREDENTIALS_CLIENT_ID,
|
|
60
|
+
clientSecret: process.env.ZAPIER_CREDENTIALS_CLIENT_SECRET,
|
|
61
|
+
// Optional: baseUrl and scope
|
|
62
|
+
},
|
|
63
|
+
});
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
The SDK automatically exchanges these credentials for an access token and handles token refresh.
|
|
67
|
+
|
|
68
|
+
### Dynamic Credentials (Advanced)
|
|
69
|
+
|
|
70
|
+
For scenarios where credentials change at runtime (e.g., multi-tenant apps):
|
|
71
|
+
|
|
72
|
+
```typescript
|
|
73
|
+
const zapier = createZapierSdk({
|
|
74
|
+
credentials: async () => {
|
|
75
|
+
// Return a token string or credentials object
|
|
76
|
+
return await getCredentialsForCurrentUser();
|
|
77
|
+
},
|
|
78
|
+
});
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
### Credential Types Summary
|
|
82
|
+
|
|
83
|
+
| Type | Use Case | Example |
|
|
84
|
+
| ------------------ | ----------------------- | ----------------------------------------- |
|
|
85
|
+
| String | Pre-obtained token | `credentials: "your_token"` |
|
|
86
|
+
| Client Credentials | Server-to-server OAuth | `credentials: { clientId, clientSecret }` |
|
|
87
|
+
| PKCE | Interactive login (CLI) | `credentials: { clientId }` (no secret) |
|
|
88
|
+
| Function | Dynamic/lazy resolution | `credentials: async () => getToken()` |
|
|
89
|
+
|
|
90
|
+
## Working with Paginated Results
|
|
91
|
+
|
|
92
|
+
Most list methods return paginated results. Understanding pagination is essential because some lists (like apps) have thousands of items.
|
|
93
|
+
|
|
94
|
+
### Single Page
|
|
95
|
+
|
|
96
|
+
```typescript
|
|
97
|
+
// Get first page only
|
|
98
|
+
const { data: apps, nextCursor } = await zapier.listApps();
|
|
99
|
+
|
|
100
|
+
// Get next page using cursor
|
|
101
|
+
const { data: moreApps } = await zapier.listApps({ cursor: nextCursor });
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
### Iterate All Pages
|
|
105
|
+
|
|
106
|
+
```typescript
|
|
107
|
+
// Iterate over pages (each page has { data, nextCursor })
|
|
108
|
+
for await (const page of zapier.listApps()) {
|
|
109
|
+
console.log(`Got ${page.data.length} apps`);
|
|
110
|
+
}
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
### Iterate Individual Items
|
|
114
|
+
|
|
115
|
+
```typescript
|
|
116
|
+
// Iterate over individual items across all pages
|
|
117
|
+
for await (const app of zapier.listApps().items()) {
|
|
118
|
+
console.log(app.title);
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
// Collect all items (be careful with large lists!)
|
|
122
|
+
const allApps = await Array.fromAsync(zapier.listApps().items());
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
### Limit Results
|
|
126
|
+
|
|
127
|
+
```typescript
|
|
128
|
+
// Limit to 50 total items across all pages
|
|
129
|
+
for await (const app of zapier.listApps({ maxItems: 50 }).items()) {
|
|
130
|
+
console.log(app.title);
|
|
131
|
+
}
|
|
132
|
+
```
|
|
133
|
+
|
|
134
|
+
## The Apps Proxy Pattern
|
|
135
|
+
|
|
136
|
+
The `zapier.apps` proxy provides a type-safe, fluent way to execute actions. This is the recommended approach when you've generated TypeScript types for your apps.
|
|
137
|
+
|
|
138
|
+
### Basic Usage
|
|
139
|
+
|
|
140
|
+
```typescript
|
|
141
|
+
// Pattern: zapier.apps.{appKey}.{actionType}.{actionKey}(options)
|
|
142
|
+
const { data: channels } = await zapier.apps.slack.read.channels({
|
|
143
|
+
authenticationId: "123",
|
|
144
|
+
});
|
|
145
|
+
```
|
|
146
|
+
|
|
147
|
+
### Binding Authentication
|
|
148
|
+
|
|
149
|
+
Instead of passing `authenticationId` to every call, bind it once:
|
|
150
|
+
|
|
151
|
+
```typescript
|
|
152
|
+
// Create a bound app instance
|
|
153
|
+
const mySlack = zapier.apps.slack({ authenticationId: "123" });
|
|
154
|
+
|
|
155
|
+
// Now all calls use that auth
|
|
156
|
+
const { data: channels } = await mySlack.read.channels({});
|
|
157
|
+
const { data: users } = await mySlack.search.user_by_email({
|
|
158
|
+
inputs: { email: "user@example.com" },
|
|
159
|
+
});
|
|
160
|
+
```
|
|
161
|
+
|
|
162
|
+
### App Key Formats
|
|
163
|
+
|
|
164
|
+
Apps support multiple key formats. Use whichever is most convenient:
|
|
165
|
+
|
|
166
|
+
```typescript
|
|
167
|
+
// These are equivalent for Google Sheets:
|
|
168
|
+
zapier.apps.google_sheets; // snake_case (works as property)
|
|
169
|
+
zapier.apps["google-sheets"]; // slug with dashes
|
|
170
|
+
zapier.apps.GoogleSheetsV2CLIAPI; // implementation name
|
|
171
|
+
```
|
|
172
|
+
|
|
173
|
+
## App Keys and Discovery
|
|
174
|
+
|
|
175
|
+
Apps have multiple identifiers that can be used interchangeably:
|
|
176
|
+
|
|
177
|
+
- **Slug**: Human-friendly, like `slack` or `google-sheets`
|
|
178
|
+
- **Implementation name**: Internal identifier like `SlackCLIAPI` or `GoogleSheetsV2CLIAPI`
|
|
179
|
+
- **Snake_case**: Derived from slug, like `google_sheets`
|
|
180
|
+
|
|
181
|
+
### Finding Apps
|
|
182
|
+
|
|
183
|
+
```typescript
|
|
184
|
+
// Search by name
|
|
185
|
+
const { data: results } = await zapier.listApps({ search: "google sheets" });
|
|
186
|
+
// Results show all valid keys: "Google Sheets (GoogleSheetsV2CLIAPI, google-sheets, google_sheets)"
|
|
187
|
+
|
|
188
|
+
// Get specific app details
|
|
189
|
+
const { data: app } = await zapier.getApp({ appKey: "slack" });
|
|
190
|
+
```
|
|
191
|
+
|
|
192
|
+
### The Manifest (`.zapierrc`)
|
|
193
|
+
|
|
194
|
+
The manifest file locks app versions for reproducibility. When you run `npx zapier-sdk add slack`, it:
|
|
195
|
+
|
|
196
|
+
1. Records the current Slack app version in `.zapierrc`
|
|
197
|
+
2. Generates TypeScript types for that version
|
|
198
|
+
|
|
199
|
+
This ensures your code works with a known app version, not whatever happens to be latest.
|
|
200
|
+
|
|
201
|
+
## Type Generation Workflow
|
|
202
|
+
|
|
203
|
+
TypeScript types give you autocomplete for action inputs and outputs.
|
|
204
|
+
|
|
205
|
+
### Generate Types
|
|
206
|
+
|
|
207
|
+
```bash
|
|
208
|
+
# Add apps and generate types
|
|
209
|
+
npx zapier-sdk add slack google-sheets
|
|
210
|
+
|
|
211
|
+
# Types are created in src/zapier/apps/ or lib/zapier/apps/ by default
|
|
212
|
+
```
|
|
213
|
+
|
|
214
|
+
### Using Generated Types
|
|
215
|
+
|
|
216
|
+
After generation, the apps proxy becomes fully typed:
|
|
217
|
+
|
|
218
|
+
```typescript
|
|
219
|
+
// With generated types, you get autocomplete for:
|
|
220
|
+
// - Action names (read.channels, write.send_message, etc.)
|
|
221
|
+
// - Input field names and types
|
|
222
|
+
// - Output field types
|
|
223
|
+
const { data } = await zapier.apps.slack.write.send_message({
|
|
224
|
+
authenticationId: "123",
|
|
225
|
+
inputs: {
|
|
226
|
+
channel: "#general", // TypeScript knows this field exists
|
|
227
|
+
text: "Hello!",
|
|
228
|
+
},
|
|
229
|
+
});
|
|
230
|
+
```
|
|
231
|
+
|
|
232
|
+
### Regenerating Types
|
|
233
|
+
|
|
234
|
+
Run `add` again when:
|
|
235
|
+
|
|
236
|
+
- You need types for a new app
|
|
237
|
+
- An app has been updated and you want the latest fields
|
|
238
|
+
- You've deleted your generated types
|
|
239
|
+
|
|
240
|
+
## Error Handling
|
|
241
|
+
|
|
242
|
+
### Debugging
|
|
243
|
+
|
|
244
|
+
Enable debug mode to see API requests and responses:
|
|
245
|
+
|
|
246
|
+
```typescript
|
|
247
|
+
const zapier = createZapierSdk({ debug: true });
|
|
248
|
+
```
|
|
249
|
+
|
|
250
|
+
Or set the environment variable:
|
|
251
|
+
|
|
252
|
+
```bash
|
|
253
|
+
DEBUG=zapier:* node your-script.js
|
|
254
|
+
```
|
|
255
|
+
|
|
256
|
+
### Common Errors
|
|
257
|
+
|
|
258
|
+
- **"No credentials provided"**: Run `npx zapier-sdk login` or provide credentials explicitly
|
|
259
|
+
- **"Authentication not found"**: The `authenticationId` doesn't exist or you don't have access
|
|
260
|
+
- **"App not found"**: Check the app key using `listApps({ search: "..." })`
|
|
261
|
+
- **"Action not found"**: Verify the action type and key with `listActions({ appKey: "..." })`
|
|
262
|
+
|
|
263
|
+
## Environment Variables
|
|
264
|
+
|
|
265
|
+
| Variable | Purpose |
|
|
266
|
+
| ---------------------------------- | ---------------------------------------------------------- |
|
|
267
|
+
| `ZAPIER_CREDENTIALS` | Token string (alternative to passing `credentials` option) |
|
|
268
|
+
| `ZAPIER_CREDENTIALS_CLIENT_ID` | OAuth client ID for client_credentials or PKCE flow |
|
|
269
|
+
| `ZAPIER_CREDENTIALS_CLIENT_SECRET` | OAuth client secret (for client_credentials flow) |
|
|
270
|
+
| `ZAPIER_CREDENTIALS_BASE_URL` | Override auth base URL |
|
|
271
|
+
| `ZAPIER_CREDENTIALS_SCOPE` | OAuth scope |
|
|
272
|
+
| `ZAPIER_BASE_URL` | Override API base URL (for testing) |
|
|
273
|
+
| `DEBUG` | Enable debug logging (`zapier:*` for all SDK logs) |
|
package/README.md
CHANGED
|
@@ -877,16 +877,15 @@ Make authenticated HTTP requests to any API through Zapier's Relay service. Pass
|
|
|
877
877
|
|
|
878
878
|
**Parameters:**
|
|
879
879
|
|
|
880
|
-
| Name
|
|
881
|
-
|
|
|
882
|
-
| `url`
|
|
883
|
-
| `init`
|
|
884
|
-
| ↳ `method`
|
|
885
|
-
| ↳ `headers`
|
|
886
|
-
| ↳ `body`
|
|
887
|
-
| ↳ `authenticationId`
|
|
888
|
-
| ↳ `callbackUrl`
|
|
889
|
-
| ↳ `authenticationTemplate` | `string` | ❌ | — | — | Optional JSON string authentication template to bypass Notary lookup |
|
|
880
|
+
| Name | Type | Required | Default | Possible Values | Description |
|
|
881
|
+
| -------------------- | -------------------------------- | -------- | ------- | ---------------------------------------------------------- | --------------------------------------------------------------------------------------------------- |
|
|
882
|
+
| `url` | `string, custom` | ✅ | — | — | The full URL of the API endpoint to call (proxied through Zapier's Relay service) |
|
|
883
|
+
| `init` | `object` | ❌ | — | — | Request options including method, headers, body, and authentication |
|
|
884
|
+
| ↳ `method` | `string` | ❌ | — | `GET`, `POST`, `PUT`, `DELETE`, `PATCH`, `HEAD`, `OPTIONS` | HTTP method for the request (defaults to GET) |
|
|
885
|
+
| ↳ `headers` | `object` | ❌ | — | — | HTTP headers to include in the request |
|
|
886
|
+
| ↳ `body` | `string, custom, custom, record` | ❌ | — | — | Request body — plain objects and JSON strings are auto-detected and Content-Type is set accordingly |
|
|
887
|
+
| ↳ `authenticationId` | `string, number` | ❌ | — | — | Authentication ID to use for this action |
|
|
888
|
+
| ↳ `callbackUrl` | `string` | ❌ | — | — | URL to send async response to (makes request async) |
|
|
890
889
|
|
|
891
890
|
**Returns:** `Promise<Response>`
|
|
892
891
|
|
package/dist/index.cjs
CHANGED
|
@@ -409,10 +409,7 @@ var FetchInitSchema = zod.z.object({
|
|
|
409
409
|
"Request body \u2014 plain objects and JSON strings are auto-detected and Content-Type is set accordingly"
|
|
410
410
|
),
|
|
411
411
|
authenticationId: AuthenticationIdPropertySchema.optional(),
|
|
412
|
-
callbackUrl: zod.z.string().optional().describe("URL to send async response to (makes request async)")
|
|
413
|
-
authenticationTemplate: zod.z.string().optional().describe(
|
|
414
|
-
"Optional JSON string authentication template to bypass Notary lookup"
|
|
415
|
-
)
|
|
412
|
+
callbackUrl: zod.z.string().optional().describe("URL to send async response to (makes request async)")
|
|
416
413
|
}).optional().describe(
|
|
417
414
|
"Request options including method, headers, body, and authentication"
|
|
418
415
|
);
|
|
@@ -482,13 +479,7 @@ var fetchPlugin = ({ context }) => {
|
|
|
482
479
|
const startTime = Date.now();
|
|
483
480
|
const isNested = init?._telemetry?.isNested === true;
|
|
484
481
|
try {
|
|
485
|
-
const {
|
|
486
|
-
authenticationId,
|
|
487
|
-
callbackUrl,
|
|
488
|
-
authenticationTemplate,
|
|
489
|
-
_telemetry,
|
|
490
|
-
...fetchInit
|
|
491
|
-
} = init || {};
|
|
482
|
+
const { authenticationId, callbackUrl, _telemetry, ...fetchInit } = init || {};
|
|
492
483
|
const relayPath = transformUrlToRelayPath(url);
|
|
493
484
|
const headers = normalizeHeaders(
|
|
494
485
|
fetchInit.headers
|
|
@@ -513,9 +504,6 @@ var fetchPlugin = ({ context }) => {
|
|
|
513
504
|
if (callbackUrl) {
|
|
514
505
|
headers["X-Relay-Callback-Url"] = callbackUrl;
|
|
515
506
|
}
|
|
516
|
-
if (authenticationTemplate) {
|
|
517
|
-
headers["X-Authentication-Template"] = authenticationTemplate;
|
|
518
|
-
}
|
|
519
507
|
const result = await api.fetch(relayPath, {
|
|
520
508
|
method: fetchInit.method ?? "GET",
|
|
521
509
|
body: fetchInit.body,
|
|
@@ -2912,9 +2900,6 @@ var RelayRequestSchema = zod.z.object({
|
|
|
2912
2900
|
body: zod.z.any().optional().describe("Request body as a string"),
|
|
2913
2901
|
authenticationId: AuthenticationIdPropertySchema.optional(),
|
|
2914
2902
|
callbackUrl: zod.z.string().url().optional().describe("URL to send async response to (makes request async)"),
|
|
2915
|
-
authenticationTemplate: zod.z.string().optional().describe(
|
|
2916
|
-
"Optional JSON string authentication template to bypass Notary lookup"
|
|
2917
|
-
),
|
|
2918
2903
|
headers: zod.z.union([
|
|
2919
2904
|
zod.z.record(zod.z.string(), zod.z.string()),
|
|
2920
2905
|
zod.z.instanceof(Headers),
|
|
@@ -2938,22 +2923,13 @@ function resetDeprecationWarnings() {
|
|
|
2938
2923
|
var requestPlugin = ({ sdk, context }) => {
|
|
2939
2924
|
async function request(options) {
|
|
2940
2925
|
logDeprecation("request() is deprecated. Use fetch() instead.");
|
|
2941
|
-
const {
|
|
2942
|
-
url,
|
|
2943
|
-
method,
|
|
2944
|
-
body,
|
|
2945
|
-
headers,
|
|
2946
|
-
authenticationId,
|
|
2947
|
-
callbackUrl,
|
|
2948
|
-
authenticationTemplate
|
|
2949
|
-
} = options;
|
|
2926
|
+
const { url, method, body, headers, authenticationId, callbackUrl } = options;
|
|
2950
2927
|
return sdk.fetch(url, {
|
|
2951
2928
|
method,
|
|
2952
2929
|
body,
|
|
2953
2930
|
headers,
|
|
2954
2931
|
authenticationId,
|
|
2955
2932
|
callbackUrl,
|
|
2956
|
-
authenticationTemplate,
|
|
2957
2933
|
_telemetry: { isNested: true }
|
|
2958
2934
|
});
|
|
2959
2935
|
}
|
|
@@ -5155,7 +5131,7 @@ function getCpuTime() {
|
|
|
5155
5131
|
|
|
5156
5132
|
// package.json
|
|
5157
5133
|
var package_default = {
|
|
5158
|
-
version: "0.
|
|
5134
|
+
version: "0.26.0"};
|
|
5159
5135
|
|
|
5160
5136
|
// src/plugins/eventEmission/builders.ts
|
|
5161
5137
|
function createBaseEvent(context = {}) {
|
package/dist/index.d.mts
CHANGED
|
@@ -1132,7 +1132,6 @@ declare const RelayRequestSchema: z.ZodObject<{
|
|
|
1132
1132
|
body: z.ZodOptional<z.ZodAny>;
|
|
1133
1133
|
authenticationId: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>>;
|
|
1134
1134
|
callbackUrl: z.ZodOptional<z.ZodString>;
|
|
1135
|
-
authenticationTemplate: z.ZodOptional<z.ZodString>;
|
|
1136
1135
|
headers: z.ZodOptional<z.ZodUnion<readonly [z.ZodRecord<z.ZodString, z.ZodString>, z.ZodCustom<Headers, Headers>, z.ZodArray<z.ZodTuple<[z.ZodString, z.ZodString], null>>]>>;
|
|
1137
1136
|
_telemetry: z.ZodOptional<z.ZodObject<{
|
|
1138
1137
|
isNested: z.ZodOptional<z.ZodBoolean>;
|
|
@@ -1153,7 +1152,6 @@ declare const RelayFetchSchema: z.ZodObject<{
|
|
|
1153
1152
|
body: z.ZodOptional<z.ZodAny>;
|
|
1154
1153
|
authenticationId: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>>;
|
|
1155
1154
|
callbackUrl: z.ZodOptional<z.ZodString>;
|
|
1156
|
-
authenticationTemplate: z.ZodOptional<z.ZodString>;
|
|
1157
1155
|
headers: z.ZodOptional<z.ZodUnion<readonly [z.ZodRecord<z.ZodString, z.ZodString>, z.ZodCustom<Headers, Headers>, z.ZodArray<z.ZodTuple<[z.ZodString, z.ZodString], null>>]>>;
|
|
1158
1156
|
_telemetry: z.ZodOptional<z.ZodObject<{
|
|
1159
1157
|
isNested: z.ZodOptional<z.ZodBoolean>;
|
|
@@ -1268,7 +1266,6 @@ interface FetchActionType {
|
|
|
1268
1266
|
fetch: (url: string | URL, init?: RequestInit & {
|
|
1269
1267
|
authenticationId?: AuthenticationIdProperty;
|
|
1270
1268
|
callbackUrl?: string;
|
|
1271
|
-
authenticationTemplate?: string;
|
|
1272
1269
|
}) => Promise<Response>;
|
|
1273
1270
|
}
|
|
1274
1271
|
type ActionTypeProxy = BaseActionTypeProxy & Partial<FetchActionType>;
|
|
@@ -1287,7 +1284,6 @@ interface FetchPluginProvides {
|
|
|
1287
1284
|
fetch: (url: string | URL, init?: RequestInit & {
|
|
1288
1285
|
authenticationId?: string | number;
|
|
1289
1286
|
callbackUrl?: string;
|
|
1290
|
-
authenticationTemplate?: string;
|
|
1291
1287
|
_telemetry?: {
|
|
1292
1288
|
isNested?: boolean;
|
|
1293
1289
|
};
|
|
@@ -1320,7 +1316,6 @@ FetchPluginProvides>;
|
|
|
1320
1316
|
type ZapierFetchInitOptions = RequestInit & {
|
|
1321
1317
|
authenticationId?: string | number;
|
|
1322
1318
|
callbackUrl?: string;
|
|
1323
|
-
authenticationTemplate?: string;
|
|
1324
1319
|
};
|
|
1325
1320
|
|
|
1326
1321
|
declare const RunActionSchema: z.ZodObject<{
|
package/dist/index.mjs
CHANGED
|
@@ -387,10 +387,7 @@ var FetchInitSchema = z.object({
|
|
|
387
387
|
"Request body \u2014 plain objects and JSON strings are auto-detected and Content-Type is set accordingly"
|
|
388
388
|
),
|
|
389
389
|
authenticationId: AuthenticationIdPropertySchema.optional(),
|
|
390
|
-
callbackUrl: z.string().optional().describe("URL to send async response to (makes request async)")
|
|
391
|
-
authenticationTemplate: z.string().optional().describe(
|
|
392
|
-
"Optional JSON string authentication template to bypass Notary lookup"
|
|
393
|
-
)
|
|
390
|
+
callbackUrl: z.string().optional().describe("URL to send async response to (makes request async)")
|
|
394
391
|
}).optional().describe(
|
|
395
392
|
"Request options including method, headers, body, and authentication"
|
|
396
393
|
);
|
|
@@ -460,13 +457,7 @@ var fetchPlugin = ({ context }) => {
|
|
|
460
457
|
const startTime = Date.now();
|
|
461
458
|
const isNested = init?._telemetry?.isNested === true;
|
|
462
459
|
try {
|
|
463
|
-
const {
|
|
464
|
-
authenticationId,
|
|
465
|
-
callbackUrl,
|
|
466
|
-
authenticationTemplate,
|
|
467
|
-
_telemetry,
|
|
468
|
-
...fetchInit
|
|
469
|
-
} = init || {};
|
|
460
|
+
const { authenticationId, callbackUrl, _telemetry, ...fetchInit } = init || {};
|
|
470
461
|
const relayPath = transformUrlToRelayPath(url);
|
|
471
462
|
const headers = normalizeHeaders(
|
|
472
463
|
fetchInit.headers
|
|
@@ -491,9 +482,6 @@ var fetchPlugin = ({ context }) => {
|
|
|
491
482
|
if (callbackUrl) {
|
|
492
483
|
headers["X-Relay-Callback-Url"] = callbackUrl;
|
|
493
484
|
}
|
|
494
|
-
if (authenticationTemplate) {
|
|
495
|
-
headers["X-Authentication-Template"] = authenticationTemplate;
|
|
496
|
-
}
|
|
497
485
|
const result = await api.fetch(relayPath, {
|
|
498
486
|
method: fetchInit.method ?? "GET",
|
|
499
487
|
body: fetchInit.body,
|
|
@@ -2890,9 +2878,6 @@ var RelayRequestSchema = z.object({
|
|
|
2890
2878
|
body: z.any().optional().describe("Request body as a string"),
|
|
2891
2879
|
authenticationId: AuthenticationIdPropertySchema.optional(),
|
|
2892
2880
|
callbackUrl: z.string().url().optional().describe("URL to send async response to (makes request async)"),
|
|
2893
|
-
authenticationTemplate: z.string().optional().describe(
|
|
2894
|
-
"Optional JSON string authentication template to bypass Notary lookup"
|
|
2895
|
-
),
|
|
2896
2881
|
headers: z.union([
|
|
2897
2882
|
z.record(z.string(), z.string()),
|
|
2898
2883
|
z.instanceof(Headers),
|
|
@@ -2916,22 +2901,13 @@ function resetDeprecationWarnings() {
|
|
|
2916
2901
|
var requestPlugin = ({ sdk, context }) => {
|
|
2917
2902
|
async function request(options) {
|
|
2918
2903
|
logDeprecation("request() is deprecated. Use fetch() instead.");
|
|
2919
|
-
const {
|
|
2920
|
-
url,
|
|
2921
|
-
method,
|
|
2922
|
-
body,
|
|
2923
|
-
headers,
|
|
2924
|
-
authenticationId,
|
|
2925
|
-
callbackUrl,
|
|
2926
|
-
authenticationTemplate
|
|
2927
|
-
} = options;
|
|
2904
|
+
const { url, method, body, headers, authenticationId, callbackUrl } = options;
|
|
2928
2905
|
return sdk.fetch(url, {
|
|
2929
2906
|
method,
|
|
2930
2907
|
body,
|
|
2931
2908
|
headers,
|
|
2932
2909
|
authenticationId,
|
|
2933
2910
|
callbackUrl,
|
|
2934
|
-
authenticationTemplate,
|
|
2935
2911
|
_telemetry: { isNested: true }
|
|
2936
2912
|
});
|
|
2937
2913
|
}
|
|
@@ -5133,7 +5109,7 @@ function getCpuTime() {
|
|
|
5133
5109
|
|
|
5134
5110
|
// package.json
|
|
5135
5111
|
var package_default = {
|
|
5136
|
-
version: "0.
|
|
5112
|
+
version: "0.26.0"};
|
|
5137
5113
|
|
|
5138
5114
|
// src/plugins/eventEmission/builders.ts
|
|
5139
5115
|
function createBaseEvent(context = {}) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/plugins/apps/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAEV,WAAW,EAEZ,MAAM,WAAW,CAAC;AAGnB,OAAO,KAAK,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAC7D,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,gBAAgB,CAAC;AAC1D,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,oBAAoB,CAAC;AAGlE,MAAM,WAAW,kBAAkB;IACjC,IAAI,EAAE,WAAW,CAAC;CACnB;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/plugins/apps/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAEV,WAAW,EAEZ,MAAM,WAAW,CAAC;AAGnB,OAAO,KAAK,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAC7D,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,gBAAgB,CAAC;AAC1D,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,oBAAoB,CAAC;AAGlE,MAAM,WAAW,kBAAkB;IACjC,IAAI,EAAE,WAAW,CAAC;CACnB;AA2JD,eAAO,MAAM,UAAU,EAAE,MAAM,CAC7B,UAAU,CAAC,mBAAmB,GAAG,uBAAuB,CAAC,EAAE,oCAAoC;AAC/F,EAAE,EAAE,0BAA0B;AAC9B,kBAAkB,CAyBnB,CAAC;AAGF,YAAY,EAAE,sBAAsB,EAAE,MAAM,WAAW,CAAC;AACxD,YAAY,EAAE,qBAAqB,EAAE,MAAM,iBAAiB,CAAC;AAI7D,MAAM,WAAW,aAAa;CAAG"}
|
|
@@ -25,7 +25,6 @@ interface FetchActionType {
|
|
|
25
25
|
fetch: (url: string | URL, init?: RequestInit & {
|
|
26
26
|
authenticationId?: AuthenticationIdProperty;
|
|
27
27
|
callbackUrl?: string;
|
|
28
|
-
authenticationTemplate?: string;
|
|
29
28
|
}) => Promise<Response>;
|
|
30
29
|
}
|
|
31
30
|
type ActionTypeProxy = BaseActionTypeProxy & Partial<FetchActionType>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"schemas.d.ts","sourceRoot":"","sources":["../../../src/plugins/apps/schemas.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAGL,KAAK,wBAAwB,EAC9B,MAAM,wBAAwB,CAAC;AAEhC,eAAO,MAAM,0BAA0B;;;;iBAQpC,CAAC;AAGJ,MAAM,MAAM,sBAAsB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,0BAA0B,CAAC,CAAC;AAEhF,eAAO,MAAM,qBAAqB;;iBAIgB,CAAC;AAEnD,MAAM,MAAM,eAAe,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,qBAAqB,CAAC,CAAC;AAGpE,UAAU,mBAAmB;IAC3B,CAAC,MAAM,EAAE,MAAM,GAAG,CAAC,OAAO,CAAC,EAAE,sBAAsB,KAAK,OAAO,CAAC;QAC9D,IAAI,EAAE,GAAG,EAAE,CAAC;QACZ,UAAU,CAAC,EAAE,MAAM,CAAC;KACrB,CAAC,GACA,aAAa,CAAC;QAAE,IAAI,EAAE,GAAG,EAAE,CAAC;QAAC,UAAU,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC,GAAG;QACpD,KAAK,IAAI,aAAa,CAAC,GAAG,CAAC,CAAC;KAC7B,CAAC;CACL;AAGD,UAAU,eAAe;IACvB,KAAK,EAAE,CACL,GAAG,EAAE,MAAM,GAAG,GAAG,EACjB,IAAI,CAAC,EAAE,WAAW,GAAG;QACnB,gBAAgB,CAAC,EAAE,wBAAwB,CAAC;QAC5C,WAAW,CAAC,EAAE,MAAM,CAAC;
|
|
1
|
+
{"version":3,"file":"schemas.d.ts","s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AAGD,KAAK,mBAAmB,GAAG,UAAU,GAAG,QAAQ,CAAC;AAEjD,MAAM,WAAW,WAAW;IAC1B,CAAC,GAAG,EAAE,MAAM,GAAG,mBAAmB,CAAC;CACpC"}
|
|
@@ -6,7 +6,6 @@ export interface FetchPluginProvides {
|
|
|
6
6
|
fetch: (url: string | URL, init?: RequestInit & {
|
|
7
7
|
authenticationId?: string | number;
|
|
8
8
|
callbackUrl?: string;
|
|
9
|
-
authenticationTemplate?: string;
|
|
10
9
|
_telemetry?: {
|
|
11
10
|
isNested?: boolean;
|
|
12
11
|
};
|
|
@@ -39,6 +38,5 @@ FetchPluginProvides>;
|
|
|
39
38
|
export type ZapierFetchInitOptions = RequestInit & {
|
|
40
39
|
authenticationId?: string | number;
|
|
41
40
|
callbackUrl?: string;
|
|
42
|
-
authenticationTemplate?: string;
|
|
43
41
|
};
|
|
44
42
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/plugins/fetch/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AACjD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AAE3C,OAAO,KAAK,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAC7B,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,kBAAkB,CAAC;AA6D7D,MAAM,WAAW,mBAAmB;IAClC,KAAK,EAAE,CACL,GAAG,EAAE,MAAM,GAAG,GAAG,EACjB,IAAI,CAAC,EAAE,WAAW,GAAG;QACnB,gBAAgB,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;QACnC,WAAW,CAAC,EAAE,MAAM,CAAC;QACrB,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/plugins/fetch/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EA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@@ export const fetchPlugin = ({ context }) => {
|
|
|
59
59
|
const startTime = Date.now();
|
|
60
60
|
const isNested = init?._telemetry?.isNested === true;
|
|
61
61
|
try {
|
|
62
|
-
const { authenticationId, callbackUrl,
|
|
62
|
+
const { authenticationId, callbackUrl, _telemetry, ...fetchInit } = init || {};
|
|
63
63
|
const relayPath = transformUrlToRelayPath(url);
|
|
64
64
|
const headers = normalizeHeaders(fetchInit.headers);
|
|
65
65
|
const hasContentType = Object.keys(headers).some((k) => k.toLowerCase() === "content-type");
|
|
@@ -75,9 +75,6 @@ export const fetchPlugin = ({ context }) => {
|
|
|
75
75
|
if (callbackUrl) {
|
|
76
76
|
headers["X-Relay-Callback-Url"] = callbackUrl;
|
|
77
77
|
}
|
|
78
|
-
if (authenticationTemplate) {
|
|
79
|
-
headers["X-Authentication-Template"] = authenticationTemplate;
|
|
80
|
-
}
|
|
81
78
|
const result = await api.fetch(relayPath, {
|
|
82
79
|
method: fetchInit.method ?? "GET",
|
|
83
80
|
body: fetchInit.body,
|
|
@@ -80,7 +80,6 @@ describe("fetch plugin", () => {
|
|
|
80
80
|
method: "POST",
|
|
81
81
|
authenticationId: 123,
|
|
82
82
|
callbackUrl: "https://webhook.example.com/callback",
|
|
83
|
-
authenticationTemplate: '{"token": "{{auth.token}}"}',
|
|
84
83
|
});
|
|
85
84
|
expect(mockFetch).toHaveBeenCalledWith("/relay/api.example.com/data", {
|
|
86
85
|
method: "POST",
|
|
@@ -88,7 +87,6 @@ describe("fetch plugin", () => {
|
|
|
88
87
|
headers: {
|
|
89
88
|
"X-Relay-Authentication-Id": "123",
|
|
90
89
|
"X-Relay-Callback-Url": "https://webhook.example.com/callback",
|
|
91
|
-
"X-Authentication-Template": '{"token": "{{auth.token}}"}',
|
|
92
90
|
},
|
|
93
91
|
authRequired: true,
|
|
94
92
|
});
|
|
@@ -14,6 +14,5 @@ export declare const FetchInitSchema: z.ZodOptional<z.ZodObject<{
|
|
|
14
14
|
body: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodCustom<FormData, FormData>, z.ZodCustom<URLSearchParams, URLSearchParams>, z.ZodRecord<z.ZodString, z.ZodUnknown>]>>;
|
|
15
15
|
authenticationId: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>>;
|
|
16
16
|
callbackUrl: z.ZodOptional<z.ZodString>;
|
|
17
|
-
authenticationTemplate: z.ZodOptional<z.ZodString>;
|
|
18
17
|
}, z.core.$strip>>;
|
|
19
18
|
//# sourceMappingURL=schemas.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"schemas.d.ts","sourceRoot":"","sources":["../../../src/plugins/fetch/schemas.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAIxB,eAAO,MAAM,cAAc,2DAIxB,CAAC;AAEJ,eAAO,MAAM,eAAe
|
|
1
|
+
{"version":3,"file":"schemas.d.ts","sourceRoot":"","sources":["../../../src/plugins/fetch/schemas.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAIxB,eAAO,MAAM,cAAc,2DAIxB,CAAC;AAEJ,eAAO,MAAM,eAAe;;;;;;;;;;;;;;kBA8BzB,CAAC"}
|
|
@@ -28,10 +28,6 @@ export const FetchInitSchema = z
|
|
|
28
28
|
.string()
|
|
29
29
|
.optional()
|
|
30
30
|
.describe("URL to send async response to (makes request async)"),
|
|
31
|
-
authenticationTemplate: z
|
|
32
|
-
.string()
|
|
33
|
-
.optional()
|
|
34
|
-
.describe("Optional JSON string authentication template to bypass Notary lookup"),
|
|
35
31
|
})
|
|
36
32
|
.optional()
|
|
37
33
|
.describe("Request options including method, headers, body, and authentication");
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/plugins/request/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,UAAU,EAAE,MA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AC,mBAAmB,CAAC,EAAE,wBAAwB;AACzD,oBAAoB,EAAE,+CAA+C;AACrE,qBAAqB,CAwCtB,CAAC"}
|
|
@@ -9,14 +9,13 @@ import { logDeprecation } from "../../utils/logging";
|
|
|
9
9
|
export const requestPlugin = ({ sdk, context }) => {
|
|
10
10
|
async function request(options) {
|
|
11
11
|
logDeprecation("request() is deprecated. Use fetch() instead.");
|
|
12
|
-
const { url, method, body, headers, authenticationId, callbackUrl
|
|
12
|
+
const { url, method, body, headers, authenticationId, callbackUrl } = options;
|
|
13
13
|
return sdk.fetch(url, {
|
|
14
14
|
method,
|
|
15
15
|
body: body,
|
|
16
16
|
headers: headers,
|
|
17
17
|
authenticationId,
|
|
18
18
|
callbackUrl,
|
|
19
|
-
authenticationTemplate,
|
|
20
19
|
_telemetry: { isNested: true },
|
|
21
20
|
});
|
|
22
21
|
}
|
|
@@ -79,7 +79,6 @@ describe("request plugin", () => {
|
|
|
79
79
|
headers: { "Content-Type": "application/json" },
|
|
80
80
|
authenticationId: 123,
|
|
81
81
|
callbackUrl: "https://webhook.example.com/callback",
|
|
82
|
-
authenticationTemplate: '{"token": "{{auth.token}}"}',
|
|
83
82
|
});
|
|
84
83
|
expect(mockFetch).toHaveBeenCalled();
|
|
85
84
|
});
|
|
@@ -139,7 +138,6 @@ describe("request plugin", () => {
|
|
|
139
138
|
method: "POST",
|
|
140
139
|
authenticationId: 123,
|
|
141
140
|
callbackUrl: "https://webhook.example.com/callback",
|
|
142
|
-
authenticationTemplate: '{"token": "{{auth.token}}"}',
|
|
143
141
|
});
|
|
144
142
|
expect(mockFetch).toHaveBeenCalledWith("/relay/api.example.com/data", {
|
|
145
143
|
method: "POST",
|
|
@@ -147,7 +145,6 @@ describe("request plugin", () => {
|
|
|
147
145
|
headers: {
|
|
148
146
|
"X-Relay-Authentication-Id": "123",
|
|
149
147
|
"X-Relay-Callback-Url": "https://webhook.example.com/callback",
|
|
150
|
-
"X-Authentication-Template": '{"token": "{{auth.token}}"}',
|
|
151
148
|
},
|
|
152
149
|
authRequired: true,
|
|
153
150
|
});
|
|
@@ -411,7 +408,6 @@ describe("request plugin", () => {
|
|
|
411
408
|
headers: { "X-Custom": "header" },
|
|
412
409
|
authenticationId: 456,
|
|
413
410
|
callbackUrl: "https://callback.example.com/hook",
|
|
414
|
-
authenticationTemplate: '{"tok": "{{auth.tok}}"}',
|
|
415
411
|
});
|
|
416
412
|
const requestCall = mockFetch.mock.calls[0];
|
|
417
413
|
mockFetch.mockClear();
|
|
@@ -421,7 +417,6 @@ describe("request plugin", () => {
|
|
|
421
417
|
headers: { "X-Custom": "header" },
|
|
422
418
|
authenticationId: 456,
|
|
423
419
|
callbackUrl: "https://callback.example.com/hook",
|
|
424
|
-
authenticationTemplate: '{"tok": "{{auth.tok}}"}',
|
|
425
420
|
});
|
|
426
421
|
const fetchCall = mockFetch.mock.calls[0];
|
|
427
422
|
expect(requestCall).toEqual(fetchCall);
|
|
@@ -14,7 +14,6 @@ export declare const RelayRequestSchema: z.ZodObject<{
|
|
|
14
14
|
body: z.ZodOptional<z.ZodAny>;
|
|
15
15
|
authenticationId: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>>;
|
|
16
16
|
callbackUrl: z.ZodOptional<z.ZodString>;
|
|
17
|
-
authenticationTemplate: z.ZodOptional<z.ZodString>;
|
|
18
17
|
headers: z.ZodOptional<z.ZodUnion<readonly [z.ZodRecord<z.ZodString, z.ZodString>, z.ZodCustom<Headers, Headers>, z.ZodArray<z.ZodTuple<[z.ZodString, z.ZodString], null>>]>>;
|
|
19
18
|
_telemetry: z.ZodOptional<z.ZodObject<{
|
|
20
19
|
isNested: z.ZodOptional<z.ZodBoolean>;
|
|
@@ -39,7 +38,6 @@ export declare const RelayFetchSchema: z.ZodObject<{
|
|
|
39
38
|
body: z.ZodOptional<z.ZodAny>;
|
|
40
39
|
authenticationId: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>>;
|
|
41
40
|
callbackUrl: z.ZodOptional<z.ZodString>;
|
|
42
|
-
authenticationTemplate: z.ZodOptional<z.ZodString>;
|
|
43
41
|
headers: z.ZodOptional<z.ZodUnion<readonly [z.ZodRecord<z.ZodString, z.ZodString>, z.ZodCustom<Headers, Headers>, z.ZodArray<z.ZodTuple<[z.ZodString, z.ZodString], null>>]>>;
|
|
44
42
|
_telemetry: z.ZodOptional<z.ZodObject<{
|
|
45
43
|
isNested: z.ZodOptional<z.ZodBoolean>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"schemas.d.ts","sourceRoot":"","sources":["../../../src/plugins/request/schemas.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,KAAK,EACV,cAAc,EACd,qBAAqB,EACrB,kBAAkB,EACnB,MAAM,oBAAoB,CAAC;AAK5B,eAAO,MAAM,kBAAkB
|
|
1
|
+
{"version":3,"file":"schemas.d.ts","sourceRoot":"","sources":["../../../src/plugins/request/schemas.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,KAAK,EACV,cAAc,EACd,qBAAqB,EACrB,kBAAkB,EACnB,MAAM,oBAAoB,CAAC;AAK5B,eAAO,MAAM,kBAAkB;;;;;;;;;;;;;;;;;;iBA2B+C,CAAC;AAG/E,MAAM,MAAM,mBAAmB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,kBAAkB,CAAC,CAAC;AAGrE,MAAM,MAAM,iBAAiB,GACzB,cAAc,GACd,qBAAqB,GACrB,kBAAkB,CAAC;AAGvB,MAAM,WAAW,uBAAuB;IACtC,OAAO,EAAE,CAAC,OAAO,EAAE,mBAAmB,KAAK,OAAO,CAAC,QAAQ,CAAC,CAAC;CAC9D;AAGD,eAAO,MAAM,gBAAgB;;;;;;;;;;;;;;;;;;iBAAqB,CAAC;AACnD,MAAM,MAAM,iBAAiB,GAAG,mBAAmB,CAAC;AACpD,MAAM,WAAW,qBAAqB;IACpC,KAAK,EAAE,CAAC,OAAO,EAAE,iBAAiB,KAAK,OAAO,CAAC,QAAQ,CAAC,CAAC;CAC1D"}
|
|
@@ -19,10 +19,6 @@ export const RelayRequestSchema = z
|
|
|
19
19
|
.url()
|
|
20
20
|
.optional()
|
|
21
21
|
.describe("URL to send async response to (makes request async)"),
|
|
22
|
-
authenticationTemplate: z
|
|
23
|
-
.string()
|
|
24
|
-
.optional()
|
|
25
|
-
.describe("Optional JSON string authentication template to bypass Notary lookup"),
|
|
26
22
|
headers: z
|
|
27
23
|
.union([
|
|
28
24
|
z.record(z.string(), z.string()),
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zapier/zapier-sdk",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.26.0",
|
|
4
4
|
"description": "Complete Zapier SDK - combines all Zapier SDK packages",
|
|
5
5
|
"main": "dist/index.cjs",
|
|
6
6
|
"module": "dist/index.mjs",
|
|
@@ -20,6 +20,7 @@
|
|
|
20
20
|
"files": [
|
|
21
21
|
"dist",
|
|
22
22
|
"README.md",
|
|
23
|
+
"CLAUDE.md",
|
|
23
24
|
"CHANGELOG.md"
|
|
24
25
|
],
|
|
25
26
|
"keywords": [
|