@zapier/zapier-sdk-cli 0.12.0 → 0.13.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 +20 -0
- package/README.md +61 -55
- package/dist/cli.cjs +8 -28
- package/dist/cli.mjs +8 -28
- package/dist/index.cjs +5 -27
- package/dist/index.mjs +5 -27
- package/dist/package.json +1 -1
- package/dist/src/plugins/add/ast-generator.js +8 -25
- package/dist/src/utils/schema-formatter.js +5 -0
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +3 -3
- package/src/plugins/add/ast-generator.ts +22 -55
- package/src/utils/schema-formatter.ts +3 -16
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,25 @@
|
|
|
1
1
|
# @zapier/zapier-sdk-cli
|
|
2
2
|
|
|
3
|
+
## 0.13.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- 53ad336: Tweak list-apps output. Hint at slug for appKey parameters. Fix type gen for new field format. Fix action normalization.
|
|
8
|
+
|
|
9
|
+
### Patch Changes
|
|
10
|
+
|
|
11
|
+
- Updated dependencies [53ad336]
|
|
12
|
+
- @zapier/zapier-sdk@0.13.0
|
|
13
|
+
- @zapier/zapier-sdk-mcp@0.3.13
|
|
14
|
+
|
|
15
|
+
## 0.12.1
|
|
16
|
+
|
|
17
|
+
### Patch Changes
|
|
18
|
+
|
|
19
|
+
- Updated dependencies [c2f88bc]
|
|
20
|
+
- @zapier/zapier-sdk@0.12.1
|
|
21
|
+
- @zapier/zapier-sdk-mcp@0.3.12
|
|
22
|
+
|
|
3
23
|
## 0.12.0
|
|
4
24
|
|
|
5
25
|
### Minor Changes
|
package/README.md
CHANGED
|
@@ -115,11 +115,11 @@ Get detailed information about a specific action
|
|
|
115
115
|
|
|
116
116
|
**Options:**
|
|
117
117
|
|
|
118
|
-
| Option | Type | Required | Default | Possible Values | Description
|
|
119
|
-
| --------------- | -------- | -------- | ------- | ---------------------------------------------------------------------------------------------- |
|
|
120
|
-
| `<app-key>` | `string` | ✅ | — | — | App key (e.g., 'SlackCLIAPI')
|
|
121
|
-
| `<action-type>` | `string` | ✅ | — | `read`, `read_bulk`, `write`, `run`, `search`, `search_or_write`, `search_and_write`, `filter` | Action type that matches the action's defined type
|
|
122
|
-
| `<action-key>` | `string` | ✅ | — | — | Action key to execute
|
|
118
|
+
| Option | Type | Required | Default | Possible Values | Description |
|
|
119
|
+
| --------------- | -------- | -------- | ------- | ---------------------------------------------------------------------------------------------- | --------------------------------------------------- |
|
|
120
|
+
| `<app-key>` | `string` | ✅ | — | — | App key (e.g., 'SlackCLIAPI' or slug like 'github') |
|
|
121
|
+
| `<action-type>` | `string` | ✅ | — | `read`, `read_bulk`, `write`, `run`, `search`, `search_or_write`, `search_and_write`, `filter` | Action type that matches the action's defined type |
|
|
122
|
+
| `<action-key>` | `string` | ✅ | — | — | Action key to execute |
|
|
123
123
|
|
|
124
124
|
**Usage:**
|
|
125
125
|
|
|
@@ -133,17 +133,18 @@ List all actions for a specific app
|
|
|
133
133
|
|
|
134
134
|
**Options:**
|
|
135
135
|
|
|
136
|
-
| Option | Type | Required | Default | Possible Values | Description
|
|
137
|
-
| --------------- | -------- | -------- | ------- | ---------------------------------------------------------------------------------------------- |
|
|
138
|
-
| `<app-key>` | `string` | ✅ | — | — | App key of actions to list (e.g., 'SlackCLIAPI') |
|
|
139
|
-
| `--action-type` | `string` | ❌ | — | `read`, `read_bulk`, `write`, `run`, `search`, `search_or_write`, `search_and_write`, `filter` | Filter actions by type
|
|
140
|
-
| `--page-size` | `number` | ❌ | — | — | Number of actions per page
|
|
141
|
-
| `--max-items` | `number` | ❌ | — | — | Maximum total items to return across all pages
|
|
136
|
+
| Option | Type | Required | Default | Possible Values | Description |
|
|
137
|
+
| --------------- | -------- | -------- | ------- | ---------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------- |
|
|
138
|
+
| `<app-key>` | `string` | ✅ | — | — | App key of actions to list (e.g., 'SlackCLIAPI' or slug like 'github') |
|
|
139
|
+
| `--action-type` | `string` | ❌ | — | `read`, `read_bulk`, `write`, `run`, `search`, `search_or_write`, `search_and_write`, `filter` | Filter actions by type |
|
|
140
|
+
| `--page-size` | `number` | ❌ | — | — | Number of actions per page |
|
|
141
|
+
| `--max-items` | `number` | ❌ | — | — | Maximum total items to return across all pages |
|
|
142
|
+
| `--cursor` | `string` | ❌ | — | — | Cursor to start from |
|
|
142
143
|
|
|
143
144
|
**Usage:**
|
|
144
145
|
|
|
145
146
|
```bash
|
|
146
|
-
npx zapier-sdk list-actions <app-key> [--action-type] [--page-size] [--max-items]
|
|
147
|
+
npx zapier-sdk list-actions <app-key> [--action-type] [--page-size] [--max-items] [--cursor]
|
|
147
148
|
```
|
|
148
149
|
|
|
149
150
|
#### `list-input-field-choices`
|
|
@@ -154,7 +155,7 @@ Get the available choices for a dynamic dropdown input field
|
|
|
154
155
|
|
|
155
156
|
| Option | Type | Required | Default | Possible Values | Description |
|
|
156
157
|
| --------------------- | -------- | -------- | ------- | ---------------------------------------------------------------------------------------------- | ------------------------------------------------------ |
|
|
157
|
-
| `<app-key>` | `string` | ✅ | — | — | App key (e.g., 'SlackCLIAPI')
|
|
158
|
+
| `<app-key>` | `string` | ✅ | — | — | App key (e.g., 'SlackCLIAPI' or slug like 'github') |
|
|
158
159
|
| `<action-type>` | `string` | ✅ | — | `read`, `read_bulk`, `write`, `run`, `search`, `search_or_write`, `search_and_write`, `filter` | Action type that matches the action's defined type |
|
|
159
160
|
| `<action-key>` | `string` | ✅ | — | — | Action key to execute |
|
|
160
161
|
| `<input-field-key>` | `string` | ✅ | — | — | Input field key to get choices for. |
|
|
@@ -163,11 +164,12 @@ Get the available choices for a dynamic dropdown input field
|
|
|
163
164
|
| `--page` | `number` | ❌ | — | — | Page number for paginated results |
|
|
164
165
|
| `--page-size` | `number` | ❌ | — | — | Number of choices per page |
|
|
165
166
|
| `--max-items` | `number` | ❌ | — | — | Maximum total items to return across all pages |
|
|
167
|
+
| `--cursor` | `string` | ❌ | — | — | Cursor to start from |
|
|
166
168
|
|
|
167
169
|
**Usage:**
|
|
168
170
|
|
|
169
171
|
```bash
|
|
170
|
-
npx zapier-sdk list-input-field-choices <app-key> <action-type> <action-key> <input-field-key> [--authentication-id] [--inputs] [--page] [--page-size] [--max-items]
|
|
172
|
+
npx zapier-sdk list-input-field-choices <app-key> <action-type> <action-key> <input-field-key> [--authentication-id] [--inputs] [--page] [--page-size] [--max-items] [--cursor]
|
|
171
173
|
```
|
|
172
174
|
|
|
173
175
|
#### `list-input-fields`
|
|
@@ -178,18 +180,19 @@ Get the input fields required for a specific action
|
|
|
178
180
|
|
|
179
181
|
| Option | Type | Required | Default | Possible Values | Description |
|
|
180
182
|
| --------------------- | -------- | -------- | ------- | ---------------------------------------------------------------------------------------------- | ----------------------------------------------------- |
|
|
181
|
-
| `<app-key>` | `string` | ✅ | — | — | App key (e.g., 'SlackCLIAPI')
|
|
183
|
+
| `<app-key>` | `string` | ✅ | — | — | App key (e.g., 'SlackCLIAPI' or slug like 'github') |
|
|
182
184
|
| `<action-type>` | `string` | ✅ | — | `read`, `read_bulk`, `write`, `run`, `search`, `search_or_write`, `search_and_write`, `filter` | Action type that matches the action's defined type |
|
|
183
185
|
| `<action-key>` | `string` | ✅ | — | — | Action key to execute |
|
|
184
186
|
| `--authentication-id` | `string` | ❌ | — | — | Authentication ID to use for this action |
|
|
185
187
|
| `--inputs` | `object` | ❌ | — | — | Current input values that may affect available fields |
|
|
186
188
|
| `--page-size` | `number` | ❌ | — | — | Number of input fields per page |
|
|
187
189
|
| `--max-items` | `number` | ❌ | — | — | Maximum total items to return across all pages |
|
|
190
|
+
| `--cursor` | `string` | ❌ | — | — | Cursor to start from |
|
|
188
191
|
|
|
189
192
|
**Usage:**
|
|
190
193
|
|
|
191
194
|
```bash
|
|
192
|
-
npx zapier-sdk list-input-fields <app-key> <action-type> <action-key> [--authentication-id] [--inputs] [--page-size] [--max-items]
|
|
195
|
+
npx zapier-sdk list-input-fields <app-key> <action-type> <action-key> [--authentication-id] [--inputs] [--page-size] [--max-items] [--cursor]
|
|
193
196
|
```
|
|
194
197
|
|
|
195
198
|
#### `run-action`
|
|
@@ -198,20 +201,21 @@ Execute an action with the given inputs
|
|
|
198
201
|
|
|
199
202
|
**Options:**
|
|
200
203
|
|
|
201
|
-
| Option | Type | Required | Default | Possible Values | Description
|
|
202
|
-
| --------------------- | -------- | -------- | ------- | ---------------------------------------------------------------------------------------------- |
|
|
203
|
-
| `<app-key>` | `string` | ✅ | — | — | App key (e.g., 'SlackCLIAPI')
|
|
204
|
-
| `<action-type>` | `string` | ✅ | — | `read`, `read_bulk`, `write`, `run`, `search`, `search_or_write`, `search_and_write`, `filter` | Action type that matches the action's defined type
|
|
205
|
-
| `<action-key>` | `string` | ✅ | — | — | Action key to execute
|
|
206
|
-
| `--authentication-id` | `string` | ❌ | — | — | Authentication ID to use for this action
|
|
207
|
-
| `--inputs` | `object` | ❌ | — | — | Input parameters for the action
|
|
208
|
-
| `--page-size` | `number` | ❌ | — | — | Number of results per page
|
|
209
|
-
| `--max-items` | `number` | ❌ | — | — | Maximum total items to return across all pages
|
|
204
|
+
| Option | Type | Required | Default | Possible Values | Description |
|
|
205
|
+
| --------------------- | -------- | -------- | ------- | ---------------------------------------------------------------------------------------------- | --------------------------------------------------- |
|
|
206
|
+
| `<app-key>` | `string` | ✅ | — | — | App key (e.g., 'SlackCLIAPI' or slug like 'github') |
|
|
207
|
+
| `<action-type>` | `string` | ✅ | — | `read`, `read_bulk`, `write`, `run`, `search`, `search_or_write`, `search_and_write`, `filter` | Action type that matches the action's defined type |
|
|
208
|
+
| `<action-key>` | `string` | ✅ | — | — | Action key to execute |
|
|
209
|
+
| `--authentication-id` | `string` | ❌ | — | — | Authentication ID to use for this action |
|
|
210
|
+
| `--inputs` | `object` | ❌ | — | — | Input parameters for the action |
|
|
211
|
+
| `--page-size` | `number` | ❌ | — | — | Number of results per page |
|
|
212
|
+
| `--max-items` | `number` | ❌ | — | — | Maximum total items to return across all pages |
|
|
213
|
+
| `--cursor` | `string` | ❌ | — | — | Cursor to start from |
|
|
210
214
|
|
|
211
215
|
**Usage:**
|
|
212
216
|
|
|
213
217
|
```bash
|
|
214
|
-
npx zapier-sdk run-action <app-key> <action-type> <action-key> [--authentication-id] [--inputs] [--page-size] [--max-items]
|
|
218
|
+
npx zapier-sdk run-action <app-key> <action-type> <action-key> [--authentication-id] [--inputs] [--page-size] [--max-items] [--cursor]
|
|
215
219
|
```
|
|
216
220
|
|
|
217
221
|
### Apps
|
|
@@ -222,9 +226,9 @@ Get detailed information about a specific app
|
|
|
222
226
|
|
|
223
227
|
**Options:**
|
|
224
228
|
|
|
225
|
-
| Option | Type | Required | Default | Possible Values | Description
|
|
226
|
-
| ----------- | -------- | -------- | ------- | --------------- |
|
|
227
|
-
| `<app-key>` | `string` | ✅ | — | — | App key of app to fetch (e.g., 'SlackCLIAPI') |
|
|
229
|
+
| Option | Type | Required | Default | Possible Values | Description |
|
|
230
|
+
| ----------- | -------- | -------- | ------- | --------------- | ------------------------------------------------------------------- |
|
|
231
|
+
| `<app-key>` | `string` | ✅ | — | — | App key of app to fetch (e.g., 'SlackCLIAPI' or slug like 'github') |
|
|
228
232
|
|
|
229
233
|
**Usage:**
|
|
230
234
|
|
|
@@ -244,11 +248,12 @@ List all available apps with optional filtering
|
|
|
244
248
|
| `--search` | `string` | ❌ | — | — | Search for apps by name |
|
|
245
249
|
| `--page-size` | `number` | ❌ | — | — | Number of apps per page |
|
|
246
250
|
| `--max-items` | `number` | ❌ | — | — | Maximum total items to return across all pages |
|
|
251
|
+
| `--cursor` | `string` | ❌ | — | — | Cursor to start from |
|
|
247
252
|
|
|
248
253
|
**Usage:**
|
|
249
254
|
|
|
250
255
|
```bash
|
|
251
|
-
npx zapier-sdk list-apps [--app-keys] [--search] [--page-size] [--max-items]
|
|
256
|
+
npx zapier-sdk list-apps [--app-keys] [--search] [--page-size] [--max-items] [--cursor]
|
|
252
257
|
```
|
|
253
258
|
|
|
254
259
|
### Authentications
|
|
@@ -259,13 +264,13 @@ Find the first authentication matching the criteria
|
|
|
259
264
|
|
|
260
265
|
**Options:**
|
|
261
266
|
|
|
262
|
-
| Option | Type | Required | Default | Possible Values | Description
|
|
263
|
-
| -------------- | -------- | -------- | ------- | --------------- |
|
|
264
|
-
| `--app-key` | `string` | ❌ | — | — | App key of authentication to find (e.g., 'SlackCLIAPI') |
|
|
265
|
-
| `--search` | `string` | ❌ | — | — | Search term to filter authentications by title
|
|
266
|
-
| `--title` | `string` | ❌ | — | — | Filter authentications by exact title match
|
|
267
|
-
| `--account-id` | `string` | ❌ | — | — | Filter by account ID
|
|
268
|
-
| `--owner` | `string` | ❌ | — | — | Filter by owner
|
|
267
|
+
| Option | Type | Required | Default | Possible Values | Description |
|
|
268
|
+
| -------------- | -------- | -------- | ------- | --------------- | ----------------------------------------------------------------------------- |
|
|
269
|
+
| `--app-key` | `string` | ❌ | — | — | App key of authentication to find (e.g., 'SlackCLIAPI' or slug like 'github') |
|
|
270
|
+
| `--search` | `string` | ❌ | — | — | Search term to filter authentications by title |
|
|
271
|
+
| `--title` | `string` | ❌ | — | — | Filter authentications by exact title match |
|
|
272
|
+
| `--account-id` | `string` | ❌ | — | — | Filter by account ID |
|
|
273
|
+
| `--owner` | `string` | ❌ | — | — | Filter by owner |
|
|
269
274
|
|
|
270
275
|
**Usage:**
|
|
271
276
|
|
|
@@ -279,13 +284,13 @@ Find a unique authentication matching the criteria
|
|
|
279
284
|
|
|
280
285
|
**Options:**
|
|
281
286
|
|
|
282
|
-
| Option | Type | Required | Default | Possible Values | Description
|
|
283
|
-
| -------------- | -------- | -------- | ------- | --------------- |
|
|
284
|
-
| `--app-key` | `string` | ❌ | — | — | App key of authentication to find (e.g., 'SlackCLIAPI') |
|
|
285
|
-
| `--search` | `string` | ❌ | — | — | Search term to filter authentications by title
|
|
286
|
-
| `--title` | `string` | ❌ | — | — | Filter authentications by exact title match
|
|
287
|
-
| `--account-id` | `string` | ❌ | — | — | Filter by account ID
|
|
288
|
-
| `--owner` | `string` | ❌ | — | — | Filter by owner
|
|
287
|
+
| Option | Type | Required | Default | Possible Values | Description |
|
|
288
|
+
| -------------- | -------- | -------- | ------- | --------------- | ----------------------------------------------------------------------------- |
|
|
289
|
+
| `--app-key` | `string` | ❌ | — | — | App key of authentication to find (e.g., 'SlackCLIAPI' or slug like 'github') |
|
|
290
|
+
| `--search` | `string` | ❌ | — | — | Search term to filter authentications by title |
|
|
291
|
+
| `--title` | `string` | ❌ | — | — | Filter authentications by exact title match |
|
|
292
|
+
| `--account-id` | `string` | ❌ | — | — | Filter by account ID |
|
|
293
|
+
| `--owner` | `string` | ❌ | — | — | Filter by owner |
|
|
289
294
|
|
|
290
295
|
**Usage:**
|
|
291
296
|
|
|
@@ -315,21 +320,22 @@ List available authentications with optional filtering
|
|
|
315
320
|
|
|
316
321
|
**Options:**
|
|
317
322
|
|
|
318
|
-
| Option | Type | Required | Default | Possible Values | Description
|
|
319
|
-
| ---------------------- | -------- | -------- | ------- | --------------- |
|
|
320
|
-
| `--app-key` | `string` | ❌ | — | — | App key of authentications to list (e.g., 'SlackCLIAPI')
|
|
321
|
-
| `--authentication-ids` | `array` | ❌ | — | — | List of authentication IDs to filter by
|
|
322
|
-
| `--search` | `string` | ❌ | — | — | Search term to filter authentications by title
|
|
323
|
-
| `--title` | `string` | ❌ | — | — | Filter authentications by exact title match
|
|
324
|
-
| `--account-id` | `string` | ❌ | — | — | Filter by account ID
|
|
325
|
-
| `--owner` | `string` | ❌ | — | — | Filter by owner, 'me' for your own authentications or a specific user ID
|
|
326
|
-
| `--page-size` | `number` | ❌ | — | — | Number of authentications per page
|
|
327
|
-
| `--max-items` | `number` | ❌ | — | — | Maximum total items to return across all pages
|
|
323
|
+
| Option | Type | Required | Default | Possible Values | Description |
|
|
324
|
+
| ---------------------- | -------- | -------- | ------- | --------------- | ------------------------------------------------------------------------------ |
|
|
325
|
+
| `--app-key` | `string` | ❌ | — | — | App key of authentications to list (e.g., 'SlackCLIAPI' or slug like 'github') |
|
|
326
|
+
| `--authentication-ids` | `array` | ❌ | — | — | List of authentication IDs to filter by |
|
|
327
|
+
| `--search` | `string` | ❌ | — | — | Search term to filter authentications by title |
|
|
328
|
+
| `--title` | `string` | ❌ | — | — | Filter authentications by exact title match |
|
|
329
|
+
| `--account-id` | `string` | ❌ | — | — | Filter by account ID |
|
|
330
|
+
| `--owner` | `string` | ❌ | — | — | Filter by owner, 'me' for your own authentications or a specific user ID |
|
|
331
|
+
| `--page-size` | `number` | ❌ | — | — | Number of authentications per page |
|
|
332
|
+
| `--max-items` | `number` | ❌ | — | — | Maximum total items to return across all pages |
|
|
333
|
+
| `--cursor` | `string` | ❌ | — | — | Cursor to start from |
|
|
328
334
|
|
|
329
335
|
**Usage:**
|
|
330
336
|
|
|
331
337
|
```bash
|
|
332
|
-
npx zapier-sdk list-authentications [--app-key] [--authentication-ids] [--search] [--title] [--account-id] [--owner] [--page-size] [--max-items]
|
|
338
|
+
npx zapier-sdk list-authentications [--app-key] [--authentication-ids] [--search] [--title] [--account-id] [--owner] [--page-size] [--max-items] [--cursor]
|
|
333
339
|
```
|
|
334
340
|
|
|
335
341
|
### HTTP Requests
|
package/dist/cli.cjs
CHANGED
|
@@ -628,6 +628,8 @@ function formatSingleItem(formatted, itemNumber) {
|
|
|
628
628
|
let titleLine = `${chalk3__default.default.gray(`${itemNumber + 1}.`)} ${chalk3__default.default.cyan(formatted.title)}`;
|
|
629
629
|
if (formatted.id) {
|
|
630
630
|
titleLine += ` ${chalk3__default.default.gray(`(ID: ${formatted.id})`)}`;
|
|
631
|
+
} else if (formatted.keys) {
|
|
632
|
+
titleLine += ` ${chalk3__default.default.gray(`(${formatted.keys.join(", ")})`)}`;
|
|
631
633
|
} else if (formatted.key) {
|
|
632
634
|
titleLine += ` ${chalk3__default.default.gray(`(${formatted.key})`)}`;
|
|
633
635
|
}
|
|
@@ -1621,15 +1623,7 @@ var AstTypeGenerator = class {
|
|
|
1621
1623
|
actionType: action.action_type,
|
|
1622
1624
|
authenticationId
|
|
1623
1625
|
});
|
|
1624
|
-
const fields = fieldsResult.data
|
|
1625
|
-
(field) => {
|
|
1626
|
-
const fieldObj = field;
|
|
1627
|
-
return {
|
|
1628
|
-
...fieldObj,
|
|
1629
|
-
required: fieldObj.is_required || fieldObj.required || false
|
|
1630
|
-
};
|
|
1631
|
-
}
|
|
1632
|
-
);
|
|
1626
|
+
const fields = fieldsResult.data;
|
|
1633
1627
|
actionsWithFields.push({
|
|
1634
1628
|
...action,
|
|
1635
1629
|
inputFields: fields,
|
|
@@ -1827,18 +1821,18 @@ Usage:
|
|
|
1827
1821
|
)}Inputs`;
|
|
1828
1822
|
const properties = action.inputFields.map((field) => {
|
|
1829
1823
|
const fieldType = this.mapFieldTypeToTypeNode(field);
|
|
1830
|
-
const isOptional = !field.
|
|
1824
|
+
const isOptional = !field.is_required;
|
|
1831
1825
|
let property = this.factory.createPropertySignature(
|
|
1832
1826
|
void 0,
|
|
1833
1827
|
this.sanitizeFieldName(field.key),
|
|
1834
1828
|
isOptional ? this.factory.createToken(ts__namespace.SyntaxKind.QuestionToken) : void 0,
|
|
1835
1829
|
fieldType
|
|
1836
1830
|
);
|
|
1837
|
-
if (field.
|
|
1831
|
+
if (field.description) {
|
|
1838
1832
|
property = ts__namespace.addSyntheticLeadingComment(
|
|
1839
1833
|
property,
|
|
1840
1834
|
ts__namespace.SyntaxKind.MultiLineCommentTrivia,
|
|
1841
|
-
`* ${this.escapeComment(field.
|
|
1835
|
+
`* ${this.escapeComment(field.description)} `,
|
|
1842
1836
|
true
|
|
1843
1837
|
);
|
|
1844
1838
|
}
|
|
@@ -2075,21 +2069,7 @@ Usage:
|
|
|
2075
2069
|
);
|
|
2076
2070
|
}
|
|
2077
2071
|
mapFieldTypeToTypeNode(field) {
|
|
2078
|
-
|
|
2079
|
-
const choiceValues = field.choices.filter(
|
|
2080
|
-
(choice) => choice.value !== void 0 && choice.value !== null && choice.value !== ""
|
|
2081
|
-
).map(
|
|
2082
|
-
(choice) => typeof choice.value === "string" ? this.factory.createLiteralTypeNode(
|
|
2083
|
-
this.factory.createStringLiteral(choice.value)
|
|
2084
|
-
) : this.factory.createLiteralTypeNode(
|
|
2085
|
-
this.factory.createNumericLiteral(String(choice.value))
|
|
2086
|
-
)
|
|
2087
|
-
);
|
|
2088
|
-
if (choiceValues.length > 0) {
|
|
2089
|
-
return this.factory.createUnionTypeNode(choiceValues);
|
|
2090
|
-
}
|
|
2091
|
-
}
|
|
2092
|
-
switch (field.type?.toLowerCase()) {
|
|
2072
|
+
switch (field.value_type?.toLowerCase()) {
|
|
2093
2073
|
case "string":
|
|
2094
2074
|
case "text":
|
|
2095
2075
|
case "email":
|
|
@@ -2304,7 +2284,7 @@ function createZapierCliSdk(options = {}) {
|
|
|
2304
2284
|
|
|
2305
2285
|
// package.json
|
|
2306
2286
|
var package_default = {
|
|
2307
|
-
version: "0.
|
|
2287
|
+
version: "0.13.0"};
|
|
2308
2288
|
|
|
2309
2289
|
// src/cli.ts
|
|
2310
2290
|
var program = new commander.Command();
|
package/dist/cli.mjs
CHANGED
|
@@ -595,6 +595,8 @@ function formatSingleItem(formatted, itemNumber) {
|
|
|
595
595
|
let titleLine = `${chalk3.gray(`${itemNumber + 1}.`)} ${chalk3.cyan(formatted.title)}`;
|
|
596
596
|
if (formatted.id) {
|
|
597
597
|
titleLine += ` ${chalk3.gray(`(ID: ${formatted.id})`)}`;
|
|
598
|
+
} else if (formatted.keys) {
|
|
599
|
+
titleLine += ` ${chalk3.gray(`(${formatted.keys.join(", ")})`)}`;
|
|
598
600
|
} else if (formatted.key) {
|
|
599
601
|
titleLine += ` ${chalk3.gray(`(${formatted.key})`)}`;
|
|
600
602
|
}
|
|
@@ -1588,15 +1590,7 @@ var AstTypeGenerator = class {
|
|
|
1588
1590
|
actionType: action.action_type,
|
|
1589
1591
|
authenticationId
|
|
1590
1592
|
});
|
|
1591
|
-
const fields = fieldsResult.data
|
|
1592
|
-
(field) => {
|
|
1593
|
-
const fieldObj = field;
|
|
1594
|
-
return {
|
|
1595
|
-
...fieldObj,
|
|
1596
|
-
required: fieldObj.is_required || fieldObj.required || false
|
|
1597
|
-
};
|
|
1598
|
-
}
|
|
1599
|
-
);
|
|
1593
|
+
const fields = fieldsResult.data;
|
|
1600
1594
|
actionsWithFields.push({
|
|
1601
1595
|
...action,
|
|
1602
1596
|
inputFields: fields,
|
|
@@ -1794,18 +1788,18 @@ Usage:
|
|
|
1794
1788
|
)}Inputs`;
|
|
1795
1789
|
const properties = action.inputFields.map((field) => {
|
|
1796
1790
|
const fieldType = this.mapFieldTypeToTypeNode(field);
|
|
1797
|
-
const isOptional = !field.
|
|
1791
|
+
const isOptional = !field.is_required;
|
|
1798
1792
|
let property = this.factory.createPropertySignature(
|
|
1799
1793
|
void 0,
|
|
1800
1794
|
this.sanitizeFieldName(field.key),
|
|
1801
1795
|
isOptional ? this.factory.createToken(ts.SyntaxKind.QuestionToken) : void 0,
|
|
1802
1796
|
fieldType
|
|
1803
1797
|
);
|
|
1804
|
-
if (field.
|
|
1798
|
+
if (field.description) {
|
|
1805
1799
|
property = ts.addSyntheticLeadingComment(
|
|
1806
1800
|
property,
|
|
1807
1801
|
ts.SyntaxKind.MultiLineCommentTrivia,
|
|
1808
|
-
`* ${this.escapeComment(field.
|
|
1802
|
+
`* ${this.escapeComment(field.description)} `,
|
|
1809
1803
|
true
|
|
1810
1804
|
);
|
|
1811
1805
|
}
|
|
@@ -2042,21 +2036,7 @@ Usage:
|
|
|
2042
2036
|
);
|
|
2043
2037
|
}
|
|
2044
2038
|
mapFieldTypeToTypeNode(field) {
|
|
2045
|
-
|
|
2046
|
-
const choiceValues = field.choices.filter(
|
|
2047
|
-
(choice) => choice.value !== void 0 && choice.value !== null && choice.value !== ""
|
|
2048
|
-
).map(
|
|
2049
|
-
(choice) => typeof choice.value === "string" ? this.factory.createLiteralTypeNode(
|
|
2050
|
-
this.factory.createStringLiteral(choice.value)
|
|
2051
|
-
) : this.factory.createLiteralTypeNode(
|
|
2052
|
-
this.factory.createNumericLiteral(String(choice.value))
|
|
2053
|
-
)
|
|
2054
|
-
);
|
|
2055
|
-
if (choiceValues.length > 0) {
|
|
2056
|
-
return this.factory.createUnionTypeNode(choiceValues);
|
|
2057
|
-
}
|
|
2058
|
-
}
|
|
2059
|
-
switch (field.type?.toLowerCase()) {
|
|
2039
|
+
switch (field.value_type?.toLowerCase()) {
|
|
2060
2040
|
case "string":
|
|
2061
2041
|
case "text":
|
|
2062
2042
|
case "email":
|
|
@@ -2271,7 +2251,7 @@ function createZapierCliSdk(options = {}) {
|
|
|
2271
2251
|
|
|
2272
2252
|
// package.json
|
|
2273
2253
|
var package_default = {
|
|
2274
|
-
version: "0.
|
|
2254
|
+
version: "0.13.0"};
|
|
2275
2255
|
|
|
2276
2256
|
// src/cli.ts
|
|
2277
2257
|
var program = new Command();
|
package/dist/index.cjs
CHANGED
|
@@ -485,15 +485,7 @@ var AstTypeGenerator = class {
|
|
|
485
485
|
actionType: action.action_type,
|
|
486
486
|
authenticationId
|
|
487
487
|
});
|
|
488
|
-
const fields = fieldsResult.data
|
|
489
|
-
(field) => {
|
|
490
|
-
const fieldObj = field;
|
|
491
|
-
return {
|
|
492
|
-
...fieldObj,
|
|
493
|
-
required: fieldObj.is_required || fieldObj.required || false
|
|
494
|
-
};
|
|
495
|
-
}
|
|
496
|
-
);
|
|
488
|
+
const fields = fieldsResult.data;
|
|
497
489
|
actionsWithFields.push({
|
|
498
490
|
...action,
|
|
499
491
|
inputFields: fields,
|
|
@@ -691,18 +683,18 @@ Usage:
|
|
|
691
683
|
)}Inputs`;
|
|
692
684
|
const properties = action.inputFields.map((field) => {
|
|
693
685
|
const fieldType = this.mapFieldTypeToTypeNode(field);
|
|
694
|
-
const isOptional = !field.
|
|
686
|
+
const isOptional = !field.is_required;
|
|
695
687
|
let property = this.factory.createPropertySignature(
|
|
696
688
|
void 0,
|
|
697
689
|
this.sanitizeFieldName(field.key),
|
|
698
690
|
isOptional ? this.factory.createToken(ts__namespace.SyntaxKind.QuestionToken) : void 0,
|
|
699
691
|
fieldType
|
|
700
692
|
);
|
|
701
|
-
if (field.
|
|
693
|
+
if (field.description) {
|
|
702
694
|
property = ts__namespace.addSyntheticLeadingComment(
|
|
703
695
|
property,
|
|
704
696
|
ts__namespace.SyntaxKind.MultiLineCommentTrivia,
|
|
705
|
-
`* ${this.escapeComment(field.
|
|
697
|
+
`* ${this.escapeComment(field.description)} `,
|
|
706
698
|
true
|
|
707
699
|
);
|
|
708
700
|
}
|
|
@@ -939,21 +931,7 @@ Usage:
|
|
|
939
931
|
);
|
|
940
932
|
}
|
|
941
933
|
mapFieldTypeToTypeNode(field) {
|
|
942
|
-
|
|
943
|
-
const choiceValues = field.choices.filter(
|
|
944
|
-
(choice) => choice.value !== void 0 && choice.value !== null && choice.value !== ""
|
|
945
|
-
).map(
|
|
946
|
-
(choice) => typeof choice.value === "string" ? this.factory.createLiteralTypeNode(
|
|
947
|
-
this.factory.createStringLiteral(choice.value)
|
|
948
|
-
) : this.factory.createLiteralTypeNode(
|
|
949
|
-
this.factory.createNumericLiteral(String(choice.value))
|
|
950
|
-
)
|
|
951
|
-
);
|
|
952
|
-
if (choiceValues.length > 0) {
|
|
953
|
-
return this.factory.createUnionTypeNode(choiceValues);
|
|
954
|
-
}
|
|
955
|
-
}
|
|
956
|
-
switch (field.type?.toLowerCase()) {
|
|
934
|
+
switch (field.value_type?.toLowerCase()) {
|
|
957
935
|
case "string":
|
|
958
936
|
case "text":
|
|
959
937
|
case "email":
|
package/dist/index.mjs
CHANGED
|
@@ -454,15 +454,7 @@ var AstTypeGenerator = class {
|
|
|
454
454
|
actionType: action.action_type,
|
|
455
455
|
authenticationId
|
|
456
456
|
});
|
|
457
|
-
const fields = fieldsResult.data
|
|
458
|
-
(field) => {
|
|
459
|
-
const fieldObj = field;
|
|
460
|
-
return {
|
|
461
|
-
...fieldObj,
|
|
462
|
-
required: fieldObj.is_required || fieldObj.required || false
|
|
463
|
-
};
|
|
464
|
-
}
|
|
465
|
-
);
|
|
457
|
+
const fields = fieldsResult.data;
|
|
466
458
|
actionsWithFields.push({
|
|
467
459
|
...action,
|
|
468
460
|
inputFields: fields,
|
|
@@ -660,18 +652,18 @@ Usage:
|
|
|
660
652
|
)}Inputs`;
|
|
661
653
|
const properties = action.inputFields.map((field) => {
|
|
662
654
|
const fieldType = this.mapFieldTypeToTypeNode(field);
|
|
663
|
-
const isOptional = !field.
|
|
655
|
+
const isOptional = !field.is_required;
|
|
664
656
|
let property = this.factory.createPropertySignature(
|
|
665
657
|
void 0,
|
|
666
658
|
this.sanitizeFieldName(field.key),
|
|
667
659
|
isOptional ? this.factory.createToken(ts.SyntaxKind.QuestionToken) : void 0,
|
|
668
660
|
fieldType
|
|
669
661
|
);
|
|
670
|
-
if (field.
|
|
662
|
+
if (field.description) {
|
|
671
663
|
property = ts.addSyntheticLeadingComment(
|
|
672
664
|
property,
|
|
673
665
|
ts.SyntaxKind.MultiLineCommentTrivia,
|
|
674
|
-
`* ${this.escapeComment(field.
|
|
666
|
+
`* ${this.escapeComment(field.description)} `,
|
|
675
667
|
true
|
|
676
668
|
);
|
|
677
669
|
}
|
|
@@ -908,21 +900,7 @@ Usage:
|
|
|
908
900
|
);
|
|
909
901
|
}
|
|
910
902
|
mapFieldTypeToTypeNode(field) {
|
|
911
|
-
|
|
912
|
-
const choiceValues = field.choices.filter(
|
|
913
|
-
(choice) => choice.value !== void 0 && choice.value !== null && choice.value !== ""
|
|
914
|
-
).map(
|
|
915
|
-
(choice) => typeof choice.value === "string" ? this.factory.createLiteralTypeNode(
|
|
916
|
-
this.factory.createStringLiteral(choice.value)
|
|
917
|
-
) : this.factory.createLiteralTypeNode(
|
|
918
|
-
this.factory.createNumericLiteral(String(choice.value))
|
|
919
|
-
)
|
|
920
|
-
);
|
|
921
|
-
if (choiceValues.length > 0) {
|
|
922
|
-
return this.factory.createUnionTypeNode(choiceValues);
|
|
923
|
-
}
|
|
924
|
-
}
|
|
925
|
-
switch (field.type?.toLowerCase()) {
|
|
903
|
+
switch (field.value_type?.toLowerCase()) {
|
|
926
904
|
case "string":
|
|
927
905
|
case "text":
|
|
928
906
|
case "email":
|
package/dist/package.json
CHANGED
|
@@ -37,13 +37,7 @@ export class AstTypeGenerator {
|
|
|
37
37
|
actionType: action.action_type,
|
|
38
38
|
authenticationId: authenticationId,
|
|
39
39
|
});
|
|
40
|
-
const fields = fieldsResult.data
|
|
41
|
-
const fieldObj = field;
|
|
42
|
-
return {
|
|
43
|
-
...fieldObj,
|
|
44
|
-
required: fieldObj.is_required || fieldObj.required || false,
|
|
45
|
-
};
|
|
46
|
-
});
|
|
40
|
+
const fields = fieldsResult.data;
|
|
47
41
|
actionsWithFields.push({
|
|
48
42
|
...action,
|
|
49
43
|
inputFields: fields,
|
|
@@ -187,13 +181,13 @@ Usage:
|
|
|
187
181
|
const inputTypeName = `${appName}${this.capitalize(action.action_type)}${this.capitalize(this.sanitizeActionName(action.key))}Inputs`;
|
|
188
182
|
const properties = action.inputFields.map((field) => {
|
|
189
183
|
const fieldType = this.mapFieldTypeToTypeNode(field);
|
|
190
|
-
const isOptional = !field.
|
|
184
|
+
const isOptional = !field.is_required;
|
|
191
185
|
let property = this.factory.createPropertySignature(undefined, this.sanitizeFieldName(field.key), isOptional
|
|
192
186
|
? this.factory.createToken(ts.SyntaxKind.QuestionToken)
|
|
193
187
|
: undefined, fieldType);
|
|
194
|
-
// Add JSDoc comment if
|
|
195
|
-
if (field.
|
|
196
|
-
property = ts.addSyntheticLeadingComment(property, ts.SyntaxKind.MultiLineCommentTrivia, `* ${this.escapeComment(field.
|
|
188
|
+
// Add JSDoc comment if description exists
|
|
189
|
+
if (field.description) {
|
|
190
|
+
property = ts.addSyntheticLeadingComment(property, ts.SyntaxKind.MultiLineCommentTrivia, `* ${this.escapeComment(field.description)} `, true);
|
|
197
191
|
}
|
|
198
192
|
return property;
|
|
199
193
|
});
|
|
@@ -296,21 +290,10 @@ Usage:
|
|
|
296
290
|
]));
|
|
297
291
|
}
|
|
298
292
|
mapFieldTypeToTypeNode(field) {
|
|
299
|
-
// Handle choices
|
|
300
|
-
if (field.choices && field.choices.length > 0) {
|
|
301
|
-
const choiceValues = field.choices
|
|
302
|
-
.filter((choice) => choice.value !== undefined &&
|
|
303
|
-
choice.value !== null &&
|
|
304
|
-
choice.value !== "")
|
|
305
|
-
.map((choice) => typeof choice.value === "string"
|
|
306
|
-
? this.factory.createLiteralTypeNode(this.factory.createStringLiteral(choice.value))
|
|
307
|
-
: this.factory.createLiteralTypeNode(this.factory.createNumericLiteral(String(choice.value))));
|
|
308
|
-
if (choiceValues.length > 0) {
|
|
309
|
-
return this.factory.createUnionTypeNode(choiceValues);
|
|
310
|
-
}
|
|
311
|
-
}
|
|
293
|
+
// TODO: Handle choices when needed - choices are handled separately through listInputFieldChoices
|
|
312
294
|
// Map Zapier field types to TypeScript types
|
|
313
|
-
|
|
295
|
+
// Handle the new enum types from InputFieldItem.value_type
|
|
296
|
+
switch (field.value_type?.toLowerCase()) {
|
|
314
297
|
case "string":
|
|
315
298
|
case "text":
|
|
316
299
|
case "email":
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import chalk from "chalk";
|
|
2
2
|
import util from "util";
|
|
3
|
+
// These functions are internal to SDK, implementing basic formatting fallback
|
|
4
|
+
// TODO: Consider exposing these utilities or implementing proper CLI formatting
|
|
3
5
|
function getFormatMetadata(schema) {
|
|
4
6
|
return schema?._def
|
|
5
7
|
?.formatMeta;
|
|
@@ -48,6 +50,9 @@ function formatSingleItem(formatted, itemNumber) {
|
|
|
48
50
|
if (formatted.id) {
|
|
49
51
|
titleLine += ` ${chalk.gray(`(ID: ${formatted.id})`)}`;
|
|
50
52
|
}
|
|
53
|
+
else if (formatted.keys) {
|
|
54
|
+
titleLine += ` ${chalk.gray(`(${formatted.keys.join(", ")})`)}`;
|
|
55
|
+
}
|
|
51
56
|
else if (formatted.key) {
|
|
52
57
|
titleLine += ` ${chalk.gray(`(${formatted.key})`)}`;
|
|
53
58
|
}
|