@zapier/zapier-sdk-cli 0.52.9 → 0.52.12
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 +52 -0
- package/README.md +74 -1
- package/dist/cli.cjs +80 -82
- package/dist/cli.mjs +81 -83
- package/dist/experimental.cjs +17 -26
- package/dist/experimental.d.mts +1 -1
- package/dist/experimental.d.ts +1 -1
- package/dist/experimental.mjs +16 -25
- package/dist/index.cjs +18 -27
- package/dist/index.d.mts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.mjs +16 -25
- package/dist/login.cjs +8 -10
- package/dist/login.d.mts +2 -10
- package/dist/login.d.ts +2 -10
- package/dist/login.mjs +5 -9
- package/dist/package.json +1 -1
- package/dist/{sdk-B3nKAZdN.d.mts → sdk-Sa1HjzUj.d.mts} +14 -14
- package/dist/{sdk-B3nKAZdN.d.ts → sdk-Sa1HjzUj.d.ts} +14 -14
- package/dist/src/experimental.js +29 -27
- package/dist/src/login/index.d.ts +1 -9
- package/dist/src/login/index.js +12 -14
- package/dist/src/plugins/add/index.d.ts +15 -15
- package/dist/src/plugins/add/index.js +1 -1
- package/dist/src/plugins/buildManifest/index.d.ts +2 -2
- package/dist/src/plugins/bundleCode/index.d.ts +1 -1
- package/dist/src/plugins/bundleCode/index.js +2 -1
- package/dist/src/plugins/cliOverrides/index.d.ts +5 -10
- package/dist/src/plugins/cliOverrides/index.js +2 -6
- package/dist/src/plugins/curl/index.d.ts +2 -2
- package/dist/src/plugins/curl/schemas.d.ts +2 -2
- package/dist/src/plugins/feedback/index.d.ts +1 -1
- package/dist/src/plugins/generateAppTypes/index.d.ts +11 -11
- package/dist/src/plugins/getLoginConfigPath/index.d.ts +1 -1
- package/dist/src/plugins/index.d.ts +1 -1
- package/dist/src/plugins/index.js +1 -1
- package/dist/src/plugins/init/index.d.ts +1 -1
- package/dist/src/plugins/login/index.d.ts +1 -1
- package/dist/src/plugins/logout/index.d.ts +1 -1
- package/dist/src/plugins/mcp/index.d.ts +1 -1
- package/dist/src/sdk.js +31 -20
- package/dist/src/utils/cli-generator.js +14 -7
- package/dist/src/utils/cli-renderer.d.ts +13 -3
- package/dist/src/utils/cli-renderer.js +27 -20
- package/dist/src/utils/log.js +9 -4
- package/dist/src/utils/parameter-resolver.js +3 -1
- package/dist/src/utils/schema-formatter.d.ts +2 -2
- package/dist/src/utils/schema-formatter.js +4 -30
- package/dist/src/utils/version-checker.js +8 -3
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +3 -3
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,57 @@
|
|
|
1
1
|
# @zapier/zapier-sdk-cli
|
|
2
2
|
|
|
3
|
+
## 0.52.12
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- a950509: Route all debug, diagnostic, and telemetry log output to stderr (`console.error`) instead of stdout (`console.log`) across the SDK and CLI packages. The CLI now reserves stdout exclusively for the program's data payload — command output, JSON envelopes, response bodies — so callers can safely pipe CLI output through `jq`, `> redirect`, or `JSON.parse` even when `--debug` is on or telemetry/logging flags are enabled. Interactive terminal users see no change since both streams interleave in a TTY.
|
|
8
|
+
- 9096184: Extract the plugin framework into a new sibling package `kitcore` that
|
|
9
|
+
`@zapier/zapier-sdk` consumes as a workspace devDependency (bundled into
|
|
10
|
+
the published dist, not a runtime dep). Existing SDK code is unaffected:
|
|
11
|
+
`createZapierSdk`, `createSdk`, the `ZapierSdk` type, every SDK method, and
|
|
12
|
+
the full `Zapier*` error hierarchy keep their names, codes, and `instanceof`
|
|
13
|
+
semantics. Internally `createZapierSdk` now builds via the linear
|
|
14
|
+
`createPluginStack().use(...).toSdk()` path, which substantially speeds up
|
|
15
|
+
construction. One behavior change to note: `normalizeError` no longer wraps
|
|
16
|
+
thrown `Error` subclasses, so a handler's `TypeError` or a userland
|
|
17
|
+
`MyAppError` bubbles through unchanged and `instanceof` works again; only
|
|
18
|
+
non-`Error` throws get wrapped.
|
|
19
|
+
|
|
20
|
+
New stack-based composition surface for building on top of the SDK:
|
|
21
|
+
`createZapierSdkStack(options)` (from the root and `/experimental`) returns
|
|
22
|
+
the unsealed `PluginStack` that `createZapierSdk` materializes, and
|
|
23
|
+
`createPluginStack`, `createCorePlugin`, and `addPlugin` are re-exported from
|
|
24
|
+
the root. Build by chaining `.use(...)` and sealing with `.toSdk()`, or
|
|
25
|
+
extend a sealed SDK in place with `addPlugin(sdk, plugin)`. The chain-style
|
|
26
|
+
`createSdk().addPlugin(...)` pattern is deprecated (now logs a one-time
|
|
27
|
+
warning) but still works; the CLI and MCP packages moved their internal
|
|
28
|
+
assembly to stacks with no change to their commands or tools.
|
|
29
|
+
|
|
30
|
+
- Updated dependencies [a950509]
|
|
31
|
+
- Updated dependencies [9096184]
|
|
32
|
+
- @zapier/zapier-sdk@0.67.0
|
|
33
|
+
- @zapier/zapier-sdk-mcp@0.13.21
|
|
34
|
+
|
|
35
|
+
## 0.52.11
|
|
36
|
+
|
|
37
|
+
### Patch Changes
|
|
38
|
+
|
|
39
|
+
- 0eb6a76: Add the `triggerWorkflow` experimental code-substrate plugin. Lives behind `@zapier/zapier-sdk/experimental` only — the stable subpath does not surface it. Looks up the workflow's `trigger_url` via the durableworkflowzaps API, then POSTs the user-supplied JSON payload to that URL. The trigger endpoint is tokenized (the URL embeds a secret) and takes no auth header, so the SDK uses a raw `fetch` rather than the api plugin for the second leg. Custom fetch flows through `sdk.context.options.fetch` for tests. The workflow id is UUID-validated at the input boundary; trigger endpoint failures (non-2xx, or workflow with no published version) surface as descriptive errors. The CLI gets the `workflowIdResolver` picker for the workflow input.
|
|
40
|
+
- Updated dependencies [66db7cb]
|
|
41
|
+
- Updated dependencies [c7c8f64]
|
|
42
|
+
- Updated dependencies [0eb6a76]
|
|
43
|
+
- @zapier/zapier-sdk@0.66.0
|
|
44
|
+
- @zapier/zapier-sdk-mcp@0.13.20
|
|
45
|
+
|
|
46
|
+
## 0.52.10
|
|
47
|
+
|
|
48
|
+
### Patch Changes
|
|
49
|
+
|
|
50
|
+
- 9138968: Add the workflow-run experimental code-substrate plugins: `listWorkflowRuns`, `getWorkflowRun`, and `getTriggerRun`. All three live behind `@zapier/zapier-sdk/experimental` only — the stable subpath does not surface them. `listWorkflowRuns` is paginated against the backend's cursor + limit contract; `getWorkflowRun` looks up a run by id; `getTriggerRun` walks from a trigger id to its associated run, useful immediately after firing a trigger when the caller has the trigger id but not yet the run id. All ID inputs are UUID-validated at the schema boundary. Handlers pass the API response through verbatim — schemas stay as `outputSchema` for docs and types, but consumers see any richer fields the server adds without an SDK release. Adds `workflowRunIdResolver` — a dependent resolver scoped to the parent workflow — so CLI commands taking a run id present an interactive picker via `sdk.listWorkflowRuns({ workflow })`. `getTriggerRun` does not register a picker for `trigger`; users typically have the trigger id from a recent fire and pass it directly.
|
|
51
|
+
- Updated dependencies [9138968]
|
|
52
|
+
- @zapier/zapier-sdk@0.65.0
|
|
53
|
+
- @zapier/zapier-sdk-mcp@0.13.19
|
|
54
|
+
|
|
3
55
|
## 0.52.9
|
|
4
56
|
|
|
5
57
|
### Patch Changes
|
package/README.md
CHANGED
|
@@ -32,13 +32,17 @@
|
|
|
32
32
|
- [`disable-workflow`](#disable-workflow--experimental)
|
|
33
33
|
- [`enable-workflow`](#enable-workflow--experimental)
|
|
34
34
|
- [`get-durable-run`](#get-durable-run--experimental)
|
|
35
|
+
- [`get-trigger-run`](#get-trigger-run--experimental)
|
|
35
36
|
- [`get-workflow`](#get-workflow--experimental)
|
|
37
|
+
- [`get-workflow-run`](#get-workflow-run--experimental)
|
|
36
38
|
- [`get-workflow-version`](#get-workflow-version--experimental)
|
|
37
39
|
- [`list-durable-runs`](#list-durable-runs--experimental)
|
|
40
|
+
- [`list-workflow-runs`](#list-workflow-runs--experimental)
|
|
38
41
|
- [`list-workflow-versions`](#list-workflow-versions--experimental)
|
|
39
42
|
- [`list-workflows`](#list-workflows--experimental)
|
|
40
43
|
- [`publish-workflow-version`](#publish-workflow-version--experimental)
|
|
41
44
|
- [`run-durable`](#run-durable--experimental)
|
|
45
|
+
- [`trigger-workflow`](#trigger-workflow--experimental)
|
|
42
46
|
- [`update-workflow`](#update-workflow--experimental)
|
|
43
47
|
- [Connections](#connections)
|
|
44
48
|
- [`find-first-connection`](#find-first-connection)
|
|
@@ -539,6 +543,22 @@ Get the full state of a run-once durable run, including its operations journal
|
|
|
539
543
|
npx zapier-sdk get-durable-run <run>
|
|
540
544
|
```
|
|
541
545
|
|
|
546
|
+
#### `get-trigger-run` 🧪 _experimental_
|
|
547
|
+
|
|
548
|
+
Get the workflow run associated with a deployed workflow's trigger. Useful immediately after firing a trigger, when you have the trigger ID but not yet the run ID.
|
|
549
|
+
|
|
550
|
+
**Options:**
|
|
551
|
+
|
|
552
|
+
| Option | Type | Required | Default | Possible Values | Description |
|
|
553
|
+
| ----------- | -------- | -------- | ------- | --------------- | ------------------- |
|
|
554
|
+
| `<trigger>` | `string` | ✅ | — | — | Workflow trigger ID |
|
|
555
|
+
|
|
556
|
+
**Usage:**
|
|
557
|
+
|
|
558
|
+
```bash
|
|
559
|
+
npx zapier-sdk get-trigger-run <trigger>
|
|
560
|
+
```
|
|
561
|
+
|
|
542
562
|
#### `get-workflow` 🧪 _experimental_
|
|
543
563
|
|
|
544
564
|
Get a durable workflow with its current version details and trigger claim status
|
|
@@ -555,6 +575,23 @@ Get a durable workflow with its current version details and trigger claim status
|
|
|
555
575
|
npx zapier-sdk get-workflow <workflow>
|
|
556
576
|
```
|
|
557
577
|
|
|
578
|
+
#### `get-workflow-run` 🧪 _experimental_
|
|
579
|
+
|
|
580
|
+
Get the current state of a workflow run (a triggered execution of a deployed workflow)
|
|
581
|
+
|
|
582
|
+
**Options:**
|
|
583
|
+
|
|
584
|
+
| Option | Type | Required | Default | Possible Values | Description |
|
|
585
|
+
| ------------ | -------- | -------- | ------- | --------------- | --------------------------------------------------------------------------------------- |
|
|
586
|
+
| `<run>` | `string` | ✅ | — | — | Workflow run ID |
|
|
587
|
+
| `--workflow` | `string` | ❌ | — | — | Parent workflow ID — used only to scope the CLI run-id picker; ignored by the API call. |
|
|
588
|
+
|
|
589
|
+
**Usage:**
|
|
590
|
+
|
|
591
|
+
```bash
|
|
592
|
+
npx zapier-sdk get-workflow-run <run> [--workflow]
|
|
593
|
+
```
|
|
594
|
+
|
|
558
595
|
#### `get-workflow-version` 🧪 _experimental_
|
|
559
596
|
|
|
560
597
|
Get full details of a workflow version including source files
|
|
@@ -590,6 +627,25 @@ List run-once durable runs for the authenticated account, newest first
|
|
|
590
627
|
npx zapier-sdk list-durable-runs [--page-size] [--cursor] [--max-items]
|
|
591
628
|
```
|
|
592
629
|
|
|
630
|
+
#### `list-workflow-runs` 🧪 _experimental_
|
|
631
|
+
|
|
632
|
+
List workflow runs (triggered executions) for a specific deployed workflow, newest first
|
|
633
|
+
|
|
634
|
+
**Options:**
|
|
635
|
+
|
|
636
|
+
| Option | Type | Required | Default | Possible Values | Description |
|
|
637
|
+
| ------------- | -------- | -------- | ------- | --------------- | --------------------------------------------- |
|
|
638
|
+
| `<workflow>` | `string` | ✅ | — | — | Durable workflow ID |
|
|
639
|
+
| `--page-size` | `number` | ❌ | — | — | Number of runs per page (max 100) |
|
|
640
|
+
| `--cursor` | `string` | ❌ | — | — | Pagination cursor |
|
|
641
|
+
| `--max-items` | `number` | ❌ | — | — | Maximum total runs to return across all pages |
|
|
642
|
+
|
|
643
|
+
**Usage:**
|
|
644
|
+
|
|
645
|
+
```bash
|
|
646
|
+
npx zapier-sdk list-workflow-runs <workflow> [--page-size] [--cursor] [--max-items]
|
|
647
|
+
```
|
|
648
|
+
|
|
593
649
|
#### `list-workflow-versions` 🧪 _experimental_
|
|
594
650
|
|
|
595
651
|
List published versions for a workflow, newest first
|
|
@@ -656,7 +712,7 @@ Run a workflow source file as a run-once durable run on sdkdurableapi (no deploy
|
|
|
656
712
|
| Option | Type | Required | Default | Possible Values | Description |
|
|
657
713
|
| -------------------------- | --------- | -------- | ------- | --------------- | --------------------------------------------------------------------------------------------------------------- |
|
|
658
714
|
| `<source_files>` | `object` | ✅ | — | — | Source files keyed by filename → contents |
|
|
659
|
-
| `--input` | `
|
|
715
|
+
| `--input` | `unknown` | ❌ | — | — | Input data passed to the run |
|
|
660
716
|
| `--dependencies` | `object` | ❌ | — | — | Optional npm package dependencies |
|
|
661
717
|
| `--zapier_durable_version` | `string` | ❌ | — | — | Exact semver of @zapier/zapier-durable to use (e.g. "1.2.3"). Defaults to server-configured version if omitted. |
|
|
662
718
|
| `--connections` | `object` | ❌ | — | — | Named connection aliases. Maps alias names to Zapier connection IDs. |
|
|
@@ -669,6 +725,23 @@ Run a workflow source file as a run-once durable run on sdkdurableapi (no deploy
|
|
|
669
725
|
npx zapier-sdk run-durable <source_files> [--input] [--dependencies] [--zapier_durable_version] [--connections] [--app_versions] [--private]
|
|
670
726
|
```
|
|
671
727
|
|
|
728
|
+
#### `trigger-workflow` 🧪 _experimental_
|
|
729
|
+
|
|
730
|
+
Look up a workflow's trigger URL and fire it manually. The trigger endpoint is tokenized (the URL contains a secret) and takes no auth header, so the SDK uses a raw fetch rather than the api plugin.
|
|
731
|
+
|
|
732
|
+
**Options:**
|
|
733
|
+
|
|
734
|
+
| Option | Type | Required | Default | Possible Values | Description |
|
|
735
|
+
| ------------ | --------- | -------- | ------- | --------------- | -------------------------------------------------------------------------------------------------------- |
|
|
736
|
+
| `<workflow>` | `string` | ✅ | — | — | Durable workflow ID |
|
|
737
|
+
| `--input` | `unknown` | ❌ | — | — | JSON payload delivered as the trigger body. Sent as `application/json`; omit to fire with an empty body. |
|
|
738
|
+
|
|
739
|
+
**Usage:**
|
|
740
|
+
|
|
741
|
+
```bash
|
|
742
|
+
npx zapier-sdk trigger-workflow <workflow> [--input]
|
|
743
|
+
```
|
|
744
|
+
|
|
672
745
|
#### `update-workflow` 🧪 _experimental_
|
|
673
746
|
|
|
674
747
|
Update a durable workflow's name and/or description
|
package/dist/cli.cjs
CHANGED
|
@@ -200,7 +200,7 @@ var SchemaParameterResolver = class {
|
|
|
200
200
|
debugLog(message) {
|
|
201
201
|
if (this.debug) {
|
|
202
202
|
this.stopSpinner();
|
|
203
|
-
console.
|
|
203
|
+
console.error(chalk__default.default.gray(`[Zapier CLI] ${message}`));
|
|
204
204
|
}
|
|
205
205
|
}
|
|
206
206
|
startSpinner() {
|
|
@@ -1572,7 +1572,7 @@ var SHARED_COMMAND_CLI_OPTIONS = [
|
|
|
1572
1572
|
|
|
1573
1573
|
// package.json
|
|
1574
1574
|
var package_default = {
|
|
1575
|
-
version: "0.52.
|
|
1575
|
+
version: "0.52.12"};
|
|
1576
1576
|
|
|
1577
1577
|
// src/telemetry/builders.ts
|
|
1578
1578
|
function createCliBaseEvent(context = {}) {
|
|
@@ -1626,12 +1626,6 @@ function buildCliCommandExecutedEvent({
|
|
|
1626
1626
|
subprocess_count: data.subprocess_count ?? null
|
|
1627
1627
|
};
|
|
1628
1628
|
}
|
|
1629
|
-
function getFormatMetadata(schema) {
|
|
1630
|
-
return schema?._zod?.def?.formatMeta;
|
|
1631
|
-
}
|
|
1632
|
-
function getOutputSchema(schema) {
|
|
1633
|
-
return schema?._zod?.def?.outputSchema;
|
|
1634
|
-
}
|
|
1635
1629
|
function formatJsonOutput(data) {
|
|
1636
1630
|
if (data === void 0) {
|
|
1637
1631
|
return;
|
|
@@ -1640,21 +1634,26 @@ function formatJsonOutput(data) {
|
|
|
1640
1634
|
util__default.default.inspect(data, { colors: true, depth: null, breakLength: 80 })
|
|
1641
1635
|
);
|
|
1642
1636
|
}
|
|
1643
|
-
async function formatItemsFromSchema(
|
|
1644
|
-
|
|
1645
|
-
|
|
1646
|
-
|
|
1647
|
-
|
|
1648
|
-
|
|
1649
|
-
|
|
1650
|
-
|
|
1651
|
-
|
|
1637
|
+
async function formatItemsFromSchema(_functionInfo, items, startingNumber = 0, options) {
|
|
1638
|
+
if (options?.formatter) {
|
|
1639
|
+
let context;
|
|
1640
|
+
if (options.formatter.fetch && options.sdk && options.params) {
|
|
1641
|
+
for (const item of items) {
|
|
1642
|
+
context = await options.formatter.fetch(
|
|
1643
|
+
options.sdk,
|
|
1644
|
+
options.params,
|
|
1645
|
+
item,
|
|
1646
|
+
context
|
|
1647
|
+
);
|
|
1648
|
+
}
|
|
1649
|
+
}
|
|
1650
|
+
items.forEach((item, index) => {
|
|
1651
|
+
const formatted = options.formatter.format(item, context);
|
|
1652
|
+
formatSingleItem(formatted, startingNumber + index);
|
|
1653
|
+
});
|
|
1652
1654
|
return;
|
|
1653
1655
|
}
|
|
1654
|
-
items
|
|
1655
|
-
const formatted = formatMeta.format(item);
|
|
1656
|
-
formatSingleItem(formatted, startingNumber + index);
|
|
1657
|
-
});
|
|
1656
|
+
formatItemsGeneric(items, startingNumber);
|
|
1658
1657
|
}
|
|
1659
1658
|
function formatSingleItem(formatted, itemNumber) {
|
|
1660
1659
|
let titleLine = `${chalk__default.default.gray(`${itemNumber + 1}.`)} ${chalk__default.default.cyan(formatted.title)}`;
|
|
@@ -1814,7 +1813,7 @@ function createJsonRenderer() {
|
|
|
1814
1813
|
errors: []
|
|
1815
1814
|
});
|
|
1816
1815
|
},
|
|
1817
|
-
renderCollectedList(items, _options) {
|
|
1816
|
+
async renderCollectedList(items, _options) {
|
|
1818
1817
|
outputJson({ data: items, errors: [] });
|
|
1819
1818
|
},
|
|
1820
1819
|
renderItem(value, options) {
|
|
@@ -1846,27 +1845,32 @@ function getListTitle(functionInfo) {
|
|
|
1846
1845
|
if (functionInfo.itemType) return `Available ${functionInfo.itemType} items`;
|
|
1847
1846
|
return "items";
|
|
1848
1847
|
}
|
|
1849
|
-
function
|
|
1850
|
-
|
|
1851
|
-
|
|
1852
|
-
|
|
1853
|
-
|
|
1854
|
-
|
|
1855
|
-
|
|
1856
|
-
|
|
1857
|
-
|
|
1858
|
-
|
|
1859
|
-
|
|
1860
|
-
|
|
1861
|
-
`${chalk__default.default.gray(`${startingNumber + index + 1}.`)} ${chalk__default.default.cyan(String(name))}`
|
|
1848
|
+
function createInteractiveRenderer(context = {}) {
|
|
1849
|
+
async function renderItemsForDisplay(items, functionInfo, startingNumber = 0) {
|
|
1850
|
+
if (functionInfo?.inputSchema) {
|
|
1851
|
+
await formatItemsFromSchema(
|
|
1852
|
+
functionInfo,
|
|
1853
|
+
items,
|
|
1854
|
+
startingNumber,
|
|
1855
|
+
{
|
|
1856
|
+
formatter: functionInfo.formatter,
|
|
1857
|
+
sdk: context.sdk,
|
|
1858
|
+
params: context.params
|
|
1859
|
+
}
|
|
1862
1860
|
);
|
|
1863
|
-
|
|
1864
|
-
|
|
1865
|
-
|
|
1866
|
-
|
|
1861
|
+
} else {
|
|
1862
|
+
items.forEach((item, index) => {
|
|
1863
|
+
const obj = item;
|
|
1864
|
+
const name = obj?.name || obj?.key || obj?.id || "Item";
|
|
1865
|
+
console.log(
|
|
1866
|
+
`${chalk__default.default.gray(`${startingNumber + index + 1}.`)} ${chalk__default.default.cyan(String(name))}`
|
|
1867
|
+
);
|
|
1868
|
+
if (obj?.description)
|
|
1869
|
+
console.log(` ${chalk__default.default.dim(String(obj.description))}`);
|
|
1870
|
+
console.log();
|
|
1871
|
+
});
|
|
1872
|
+
}
|
|
1867
1873
|
}
|
|
1868
|
-
}
|
|
1869
|
-
function createInteractiveRenderer() {
|
|
1870
1874
|
return {
|
|
1871
1875
|
async renderPaginatedList(source, functionInfo) {
|
|
1872
1876
|
const itemName = getItemName(functionInfo);
|
|
@@ -1876,7 +1880,7 @@ function createInteractiveRenderer() {
|
|
|
1876
1880
|
console.log(chalk__default.default.yellow(`No ${itemName} found.`));
|
|
1877
1881
|
return;
|
|
1878
1882
|
}
|
|
1879
|
-
renderItemsForDisplay(items, functionInfo, 0);
|
|
1883
|
+
await renderItemsForDisplay(items, functionInfo, 0);
|
|
1880
1884
|
console.log(chalk__default.default.green(`
|
|
1881
1885
|
\u2705 Showing ${items.length} ${itemName}`));
|
|
1882
1886
|
return;
|
|
@@ -1898,7 +1902,7 @@ function createInteractiveRenderer() {
|
|
|
1898
1902
|
console.log(chalk__default.default.blue(`\u{1F4CB} ${getListTitle(functionInfo)}
|
|
1899
1903
|
`));
|
|
1900
1904
|
}
|
|
1901
|
-
renderItemsForDisplay(items, functionInfo, totalShown);
|
|
1905
|
+
await renderItemsForDisplay(items, functionInfo, totalShown);
|
|
1902
1906
|
totalShown += items.length;
|
|
1903
1907
|
console.log(
|
|
1904
1908
|
chalk__default.default.green(
|
|
@@ -1923,7 +1927,7 @@ function createInteractiveRenderer() {
|
|
|
1923
1927
|
console.log(chalk__default.default.gray(`
|
|
1924
1928
|
\u{1F4C4} Finished browsing ${itemName}`));
|
|
1925
1929
|
},
|
|
1926
|
-
renderCollectedList(items, { maxItems, userSpecifiedMaxItems, functionInfo } = {}) {
|
|
1930
|
+
async renderCollectedList(items, { maxItems, userSpecifiedMaxItems, functionInfo } = {}) {
|
|
1927
1931
|
if (!Array.isArray(items)) {
|
|
1928
1932
|
formatJsonOutput(items);
|
|
1929
1933
|
return;
|
|
@@ -1936,7 +1940,7 @@ function createInteractiveRenderer() {
|
|
|
1936
1940
|
console.log(chalk__default.default.green(`
|
|
1937
1941
|
\u2705 Found ${items.length} ${itemName}:
|
|
1938
1942
|
`));
|
|
1939
|
-
renderItemsForDisplay(items, functionInfo);
|
|
1943
|
+
await renderItemsForDisplay(items, functionInfo);
|
|
1940
1944
|
if (userSpecifiedMaxItems && maxItems) {
|
|
1941
1945
|
console.log(
|
|
1942
1946
|
chalk__default.default.gray(
|
|
@@ -2399,11 +2403,11 @@ function createCommandConfig(cliCommandName, functionInfo, sdk) {
|
|
|
2399
2403
|
const startTime = Date.now();
|
|
2400
2404
|
let success = true;
|
|
2401
2405
|
let errorMessage = null;
|
|
2402
|
-
|
|
2406
|
+
const resolvedParams = {};
|
|
2403
2407
|
const commandObj = args[args.length - 1];
|
|
2404
2408
|
const options = commandObj.opts();
|
|
2405
2409
|
const interactiveMode = !options.json;
|
|
2406
|
-
const renderer = interactiveMode ? createInteractiveRenderer() : createJsonRenderer();
|
|
2410
|
+
const renderer = interactiveMode ? createInteractiveRenderer({ sdk, params: resolvedParams }) : createJsonRenderer();
|
|
2407
2411
|
try {
|
|
2408
2412
|
emitDeprecationWarning({
|
|
2409
2413
|
cliCommandName,
|
|
@@ -2436,7 +2440,7 @@ function createCommandConfig(cliCommandName, functionInfo, sdk) {
|
|
|
2436
2440
|
}
|
|
2437
2441
|
if (schema && !usesInputParameters) {
|
|
2438
2442
|
const resolver = new SchemaParameterResolver();
|
|
2439
|
-
|
|
2443
|
+
const resolved = await resolver.resolveParameters(
|
|
2440
2444
|
schema,
|
|
2441
2445
|
rawParams,
|
|
2442
2446
|
sdk,
|
|
@@ -2446,8 +2450,9 @@ function createCommandConfig(cliCommandName, functionInfo, sdk) {
|
|
|
2446
2450
|
debug: !!options.debug || process.env.DEBUG === "true" || process.argv.includes("--debug")
|
|
2447
2451
|
}
|
|
2448
2452
|
);
|
|
2453
|
+
Object.assign(resolvedParams, resolved);
|
|
2449
2454
|
} else {
|
|
2450
|
-
resolvedParams
|
|
2455
|
+
Object.assign(resolvedParams, rawParams);
|
|
2451
2456
|
}
|
|
2452
2457
|
const confirm = functionInfo.confirm;
|
|
2453
2458
|
let confirmMessageAfter;
|
|
@@ -2476,7 +2481,7 @@ function createCommandConfig(cliCommandName, functionInfo, sdk) {
|
|
|
2476
2481
|
sdkResult,
|
|
2477
2482
|
maxItems
|
|
2478
2483
|
});
|
|
2479
|
-
renderer.renderCollectedList(allItems, {
|
|
2484
|
+
await renderer.renderCollectedList(allItems, {
|
|
2480
2485
|
maxItems,
|
|
2481
2486
|
userSpecifiedMaxItems: hasUserSpecifiedMaxItems,
|
|
2482
2487
|
functionInfo
|
|
@@ -2510,7 +2515,7 @@ function createCommandConfig(cliCommandName, functionInfo, sdk) {
|
|
|
2510
2515
|
if (normalizedResult.kind === "response") {
|
|
2511
2516
|
await renderer.renderResponse(normalizedResult.value);
|
|
2512
2517
|
} else if (normalizedResult.kind === "list") {
|
|
2513
|
-
renderer.renderCollectedList(normalizedResult.data, {
|
|
2518
|
+
await renderer.renderCollectedList(normalizedResult.data, {
|
|
2514
2519
|
maxItems: resolvedParams.maxItems,
|
|
2515
2520
|
userSpecifiedMaxItems: hasUserSpecifiedMaxItems,
|
|
2516
2521
|
functionInfo
|
|
@@ -2566,7 +2571,7 @@ ${confirmMessageAfter}`));
|
|
|
2566
2571
|
description,
|
|
2567
2572
|
parameters,
|
|
2568
2573
|
handler,
|
|
2569
|
-
hidden: functionInfo.
|
|
2574
|
+
hidden: !!functionInfo.deprecation,
|
|
2570
2575
|
aliases: functionInfo.aliases,
|
|
2571
2576
|
supportsJsonOutput: functionInfo.supportsJsonOutput
|
|
2572
2577
|
};
|
|
@@ -2725,7 +2730,7 @@ var login_exports = {};
|
|
|
2725
2730
|
__export(login_exports, {
|
|
2726
2731
|
AUTH_MODE_HEADER: () => AUTH_MODE_HEADER,
|
|
2727
2732
|
DEFAULT_AUTH_BASE_URL: () => DEFAULT_AUTH_BASE_URL,
|
|
2728
|
-
ZapierAuthenticationError: () => ZapierAuthenticationError,
|
|
2733
|
+
ZapierAuthenticationError: () => zapierSdk.ZapierAuthenticationError,
|
|
2729
2734
|
clearTokensFromKeychain: () => clearTokensFromKeychain,
|
|
2730
2735
|
createCache: () => createCache,
|
|
2731
2736
|
getActiveCredentials: () => getActiveCredentials,
|
|
@@ -3129,12 +3134,6 @@ async function deleteStoredClientCredentials({
|
|
|
3129
3134
|
}
|
|
3130
3135
|
|
|
3131
3136
|
// src/login/index.ts
|
|
3132
|
-
var ZapierAuthenticationError = class extends Error {
|
|
3133
|
-
constructor(message) {
|
|
3134
|
-
super(message);
|
|
3135
|
-
this.name = "ZapierAuthenticationError";
|
|
3136
|
-
}
|
|
3137
|
-
};
|
|
3138
3137
|
var DEFAULT_AUTH_CLIENT_ID = "grwWZD5hUWGvb4V8ODBuOtXer3h0DBEZ2HR8aay6";
|
|
3139
3138
|
var TOKEN_REFRESH_BUFFER_MS = 5 * 60 * 1e3;
|
|
3140
3139
|
function createDebugLog(enabled) {
|
|
@@ -3144,9 +3143,9 @@ function createDebugLog(enabled) {
|
|
|
3144
3143
|
}
|
|
3145
3144
|
return (message, data) => {
|
|
3146
3145
|
if (data === void 0) {
|
|
3147
|
-
console.
|
|
3146
|
+
console.error(`[Zapier SDK CLI Login] ${message}`);
|
|
3148
3147
|
} else {
|
|
3149
|
-
console.
|
|
3148
|
+
console.error(`[Zapier SDK CLI Login] ${message}`, data);
|
|
3150
3149
|
}
|
|
3151
3150
|
};
|
|
3152
3151
|
}
|
|
@@ -3392,7 +3391,7 @@ async function getToken(options = {}) {
|
|
|
3392
3391
|
return await resolveOrRefreshToken(options);
|
|
3393
3392
|
} catch (error) {
|
|
3394
3393
|
const message = error instanceof Error ? error.message : "Token refresh failed";
|
|
3395
|
-
throw new ZapierAuthenticationError(
|
|
3394
|
+
throw new zapierSdk.ZapierAuthenticationError(
|
|
3396
3395
|
`${message}
|
|
3397
3396
|
Please run 'login' to authenticate again.`
|
|
3398
3397
|
);
|
|
@@ -3566,20 +3565,20 @@ var spinPromise = async (promise, text) => {
|
|
|
3566
3565
|
};
|
|
3567
3566
|
var log = {
|
|
3568
3567
|
info: (message, ...args) => {
|
|
3569
|
-
console.
|
|
3568
|
+
console.error(chalk__default.default.blue("\u2139"), message, ...args);
|
|
3570
3569
|
},
|
|
3571
3570
|
error: (message, ...args) => {
|
|
3572
3571
|
console.error(chalk__default.default.red("\u2716"), message, ...args);
|
|
3573
3572
|
},
|
|
3574
3573
|
success: (message, ...args) => {
|
|
3575
|
-
console.
|
|
3574
|
+
console.error(chalk__default.default.green("\u2713"), message, ...args);
|
|
3576
3575
|
},
|
|
3577
3576
|
warn: (message, ...args) => {
|
|
3578
|
-
console.
|
|
3577
|
+
console.error(chalk__default.default.yellow("\u26A0"), message, ...args);
|
|
3579
3578
|
},
|
|
3580
3579
|
debug: (message, ...args) => {
|
|
3581
3580
|
if (process.env.DEBUG === "true" || process.argv.includes("--debug")) {
|
|
3582
|
-
console.
|
|
3581
|
+
console.error(chalk__default.default.gray("\u{1F41B}"), message, ...args);
|
|
3583
3582
|
}
|
|
3584
3583
|
}
|
|
3585
3584
|
};
|
|
@@ -4168,7 +4167,8 @@ var BundleCodeSchema = zod.z.object({
|
|
|
4168
4167
|
var bundleCodePlugin = zapierSdk.definePlugin(
|
|
4169
4168
|
(sdk) => zapierSdk.createPluginMethod(sdk, {
|
|
4170
4169
|
name: "bundleCode",
|
|
4171
|
-
categories: ["utility"
|
|
4170
|
+
categories: ["utility"],
|
|
4171
|
+
deprecation: { message: "bundleCode is no longer maintained." },
|
|
4172
4172
|
inputSchema: BundleCodeSchema,
|
|
4173
4173
|
handler: async ({ options }) => bundleCode(options)
|
|
4174
4174
|
})
|
|
@@ -4264,7 +4264,7 @@ async function detectTypesOutputDirectory() {
|
|
|
4264
4264
|
}
|
|
4265
4265
|
return "./zapier/apps/";
|
|
4266
4266
|
}
|
|
4267
|
-
var
|
|
4267
|
+
var addAppsPlugin = zapierSdk.definePlugin(
|
|
4268
4268
|
(sdk) => zapierSdk.createPluginMethod(sdk, {
|
|
4269
4269
|
name: "add",
|
|
4270
4270
|
categories: ["utility"],
|
|
@@ -5669,10 +5669,6 @@ var cliOverridesPlugin = zapierSdk.definePlugin(
|
|
|
5669
5669
|
if (sdk.context.meta.fetch) {
|
|
5670
5670
|
meta.fetch = {
|
|
5671
5671
|
...sdk.context.meta.fetch,
|
|
5672
|
-
categories: [
|
|
5673
|
-
...sdk.context.meta.fetch.categories || [],
|
|
5674
|
-
"deprecated"
|
|
5675
|
-
],
|
|
5676
5672
|
deprecation: {
|
|
5677
5673
|
message: "This command is deprecated and will be removed soon. Use `curl` instead. Learn more: https://docs.zapier.com/sdk/cli-reference#curl"
|
|
5678
5674
|
}
|
|
@@ -6653,7 +6649,7 @@ var watchTriggerInboxCliPlugin = zapierSdk.definePlugin(
|
|
|
6653
6649
|
// package.json with { type: 'json' }
|
|
6654
6650
|
var package_default2 = {
|
|
6655
6651
|
name: "@zapier/zapier-sdk-cli",
|
|
6656
|
-
version: "0.52.
|
|
6652
|
+
version: "0.52.12"};
|
|
6657
6653
|
|
|
6658
6654
|
// src/sdk.ts
|
|
6659
6655
|
zapierSdk.injectCliLogin(login_exports);
|
|
@@ -6662,21 +6658,21 @@ function createZapierCliSdk(options = {}) {
|
|
|
6662
6658
|
const extensionsContextPlugin = () => ({
|
|
6663
6659
|
context: { extensions }
|
|
6664
6660
|
});
|
|
6665
|
-
|
|
6661
|
+
const sdk = zapierSdk.createZapierSdkStack({
|
|
6666
6662
|
...sdkOptions,
|
|
6667
6663
|
eventEmission: { ...sdkOptions.eventEmission, callContext: "cli" },
|
|
6668
6664
|
callerPackage: { name: package_default2.name, version: package_default2.version }
|
|
6669
|
-
}).
|
|
6665
|
+
}).use(extensionsContextPlugin).use(generateAppTypesPlugin).use(buildManifestPlugin).use(bundleCodePlugin).use(getLoginConfigPathPlugin).use(addAppsPlugin).use(feedbackPlugin).use(curlPlugin).use(initPlugin).use(mcpPlugin).use(loginPlugin).use(logoutPlugin).use(cliOverridesPlugin, { override: true }).toSdk();
|
|
6670
6666
|
for (const ext of extensions) {
|
|
6671
6667
|
try {
|
|
6672
|
-
|
|
6668
|
+
zapierSdk.addPlugin(sdk, ext);
|
|
6673
6669
|
} catch (err) {
|
|
6674
6670
|
console.warn(
|
|
6675
6671
|
`Extension plugin failed to construct: ${err.message}; skipping.`
|
|
6676
6672
|
);
|
|
6677
6673
|
}
|
|
6678
6674
|
}
|
|
6679
|
-
return
|
|
6675
|
+
return sdk;
|
|
6680
6676
|
}
|
|
6681
6677
|
experimental.injectCliLogin(login_exports);
|
|
6682
6678
|
function createZapierCliSdk2(options = {}) {
|
|
@@ -6687,21 +6683,21 @@ function createZapierCliSdk2(options = {}) {
|
|
|
6687
6683
|
const experimentalContextPlugin = () => ({
|
|
6688
6684
|
context: { experimental: true }
|
|
6689
6685
|
});
|
|
6690
|
-
|
|
6686
|
+
const sdk = experimental.createZapierSdkStack({
|
|
6691
6687
|
...sdkOptions,
|
|
6692
6688
|
eventEmission: { ...sdkOptions.eventEmission, callContext: "cli" },
|
|
6693
6689
|
callerPackage: { name: package_default2.name, version: package_default2.version }
|
|
6694
|
-
}).
|
|
6690
|
+
}).use(extensionsContextPlugin).use(experimentalContextPlugin).use(generateAppTypesPlugin).use(buildManifestPlugin).use(bundleCodePlugin).use(getLoginConfigPathPlugin).use(addAppsPlugin).use(feedbackPlugin).use(curlPlugin).use(initPlugin).use(drainTriggerInboxCliPlugin, { override: true }).use(watchTriggerInboxCliPlugin, { override: true }).use(mcpPlugin).use(loginPlugin).use(logoutPlugin).use(cliOverridesPlugin, { override: true }).toSdk();
|
|
6695
6691
|
for (const ext of extensions) {
|
|
6696
6692
|
try {
|
|
6697
|
-
|
|
6693
|
+
experimental.addPlugin(sdk, ext);
|
|
6698
6694
|
} catch (err) {
|
|
6699
6695
|
console.warn(
|
|
6700
6696
|
`Extension plugin failed to construct: ${err.message}; skipping.`
|
|
6701
6697
|
);
|
|
6702
6698
|
}
|
|
6703
6699
|
}
|
|
6704
|
-
return
|
|
6700
|
+
return sdk;
|
|
6705
6701
|
}
|
|
6706
6702
|
|
|
6707
6703
|
// src/utils/extensions.ts
|
|
@@ -6835,7 +6831,9 @@ async function checkForUpdates({
|
|
|
6835
6831
|
currentVersion
|
|
6836
6832
|
);
|
|
6837
6833
|
} catch (error) {
|
|
6838
|
-
|
|
6834
|
+
if (!(error instanceof packageJsonLib.VersionNotFoundError)) {
|
|
6835
|
+
log_default.debug(`Failed to check deprecation for current version: ${error}`);
|
|
6836
|
+
}
|
|
6839
6837
|
currentPackageInfo = latestPackageInfo;
|
|
6840
6838
|
}
|
|
6841
6839
|
const isDeprecated = Boolean(currentPackageInfo.deprecated);
|