@zapier/zapier-sdk-cli 0.59.0 → 0.59.2
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 +33 -0
- package/dist/cli.cjs +2 -2
- package/dist/cli.mjs +2 -2
- package/dist/experimental.cjs +1 -1
- package/dist/experimental.mjs +1 -1
- package/dist/index.cjs +2 -2
- package/dist/index.mjs +2 -2
- package/package.json +4 -4
- package/dist/package.json +0 -121
- package/dist/src/cli.d.ts +0 -2
- package/dist/src/cli.js +0 -219
- package/dist/src/experimental.d.ts +0 -33
- package/dist/src/experimental.js +0 -86
- package/dist/src/generators/ast-generator.d.ts +0 -41
- package/dist/src/generators/ast-generator.js +0 -405
- package/dist/src/index.d.ts +0 -5
- package/dist/src/index.js +0 -5
- package/dist/src/login/config.d.ts +0 -4
- package/dist/src/login/config.js +0 -21
- package/dist/src/login/credentials-revoke.d.ts +0 -14
- package/dist/src/login/credentials-revoke.js +0 -95
- package/dist/src/login/credentials-store.d.ts +0 -60
- package/dist/src/login/credentials-store.js +0 -181
- package/dist/src/login/filesystem-cache.d.ts +0 -25
- package/dist/src/login/filesystem-cache.js +0 -195
- package/dist/src/login/index.d.ts +0 -110
- package/dist/src/login/index.js +0 -424
- package/dist/src/login/keychain.d.ts +0 -18
- package/dist/src/login/keychain.js +0 -74
- package/dist/src/login/legacy-jwt.d.ts +0 -4
- package/dist/src/login/legacy-jwt.js +0 -18
- package/dist/src/login.d.ts +0 -10
- package/dist/src/login.js +0 -10
- package/dist/src/paths.d.ts +0 -1
- package/dist/src/paths.js +0 -6
- package/dist/src/plugins/add/index.d.ts +0 -254
- package/dist/src/plugins/add/index.js +0 -95
- package/dist/src/plugins/add/schemas.d.ts +0 -8
- package/dist/src/plugins/add/schemas.js +0 -22
- package/dist/src/plugins/auth/credentials-base-url.d.ts +0 -11
- package/dist/src/plugins/auth/credentials-base-url.js +0 -24
- package/dist/src/plugins/buildManifest/index.d.ts +0 -120
- package/dist/src/plugins/buildManifest/index.js +0 -71
- package/dist/src/plugins/buildManifest/schemas.d.ts +0 -44
- package/dist/src/plugins/buildManifest/schemas.js +0 -17
- package/dist/src/plugins/bundleCode/index.d.ts +0 -23
- package/dist/src/plugins/bundleCode/index.js +0 -62
- package/dist/src/plugins/bundleCode/schemas.d.ts +0 -10
- package/dist/src/plugins/bundleCode/schemas.js +0 -19
- package/dist/src/plugins/cliOverrides/index.d.ts +0 -21
- package/dist/src/plugins/cliOverrides/index.js +0 -17
- package/dist/src/plugins/curl/index.d.ts +0 -76
- package/dist/src/plugins/curl/index.js +0 -236
- package/dist/src/plugins/curl/schemas.d.ts +0 -40
- package/dist/src/plugins/curl/schemas.js +0 -108
- package/dist/src/plugins/curl/utils.d.ts +0 -34
- package/dist/src/plugins/curl/utils.js +0 -150
- package/dist/src/plugins/drainTriggerInbox/index.d.ts +0 -46
- package/dist/src/plugins/drainTriggerInbox/index.js +0 -178
- package/dist/src/plugins/feedback/index.d.ts +0 -24
- package/dist/src/plugins/feedback/index.js +0 -52
- package/dist/src/plugins/feedback/schemas.d.ts +0 -5
- package/dist/src/plugins/feedback/schemas.js +0 -8
- package/dist/src/plugins/generateAppTypes/index.d.ts +0 -265
- package/dist/src/plugins/generateAppTypes/index.js +0 -129
- package/dist/src/plugins/generateAppTypes/schemas.d.ts +0 -58
- package/dist/src/plugins/generateAppTypes/schemas.js +0 -21
- package/dist/src/plugins/getLoginConfigPath/index.d.ts +0 -16
- package/dist/src/plugins/getLoginConfigPath/index.js +0 -9
- package/dist/src/plugins/getLoginConfigPath/schemas.d.ts +0 -3
- package/dist/src/plugins/getLoginConfigPath/schemas.js +0 -5
- package/dist/src/plugins/index.d.ts +0 -15
- package/dist/src/plugins/index.js +0 -15
- package/dist/src/plugins/init/display.d.ts +0 -9
- package/dist/src/plugins/init/display.js +0 -72
- package/dist/src/plugins/init/index.d.ts +0 -21
- package/dist/src/plugins/init/index.js +0 -56
- package/dist/src/plugins/init/schemas.d.ts +0 -9
- package/dist/src/plugins/init/schemas.js +0 -19
- package/dist/src/plugins/init/steps.d.ts +0 -39
- package/dist/src/plugins/init/steps.js +0 -141
- package/dist/src/plugins/init/types.d.ts +0 -31
- package/dist/src/plugins/init/types.js +0 -1
- package/dist/src/plugins/init/utils.d.ts +0 -48
- package/dist/src/plugins/init/utils.js +0 -135
- package/dist/src/plugins/login/index.d.ts +0 -25
- package/dist/src/plugins/login/index.js +0 -12
- package/dist/src/plugins/login/schemas.d.ts +0 -9
- package/dist/src/plugins/login/schemas.js +0 -27
- package/dist/src/plugins/logout/index.d.ts +0 -30
- package/dist/src/plugins/logout/index.js +0 -33
- package/dist/src/plugins/logout/schemas.d.ts +0 -2
- package/dist/src/plugins/logout/schemas.js +0 -4
- package/dist/src/plugins/mcp/index.d.ts +0 -28
- package/dist/src/plugins/mcp/index.js +0 -24
- package/dist/src/plugins/mcp/schemas.d.ts +0 -5
- package/dist/src/plugins/mcp/schemas.js +0 -10
- package/dist/src/plugins/signup/index.d.ts +0 -25
- package/dist/src/plugins/signup/index.js +0 -12
- package/dist/src/plugins/signup/schemas.d.ts +0 -9
- package/dist/src/plugins/signup/schemas.js +0 -26
- package/dist/src/plugins/signup/test-harness.d.ts +0 -34
- package/dist/src/plugins/signup/test-harness.js +0 -76
- package/dist/src/plugins/watchTriggerInbox/index.d.ts +0 -46
- package/dist/src/plugins/watchTriggerInbox/index.js +0 -166
- package/dist/src/sdk.d.ts +0 -17
- package/dist/src/sdk.js +0 -67
- package/dist/src/telemetry/builders.d.ts +0 -44
- package/dist/src/telemetry/builders.js +0 -59
- package/dist/src/telemetry/events.d.ts +0 -40
- package/dist/src/telemetry/events.js +0 -4
- package/dist/src/types/sdk.d.ts +0 -6
- package/dist/src/types/sdk.js +0 -1
- package/dist/src/utils/api/client.d.ts +0 -15
- package/dist/src/utils/api/client.js +0 -27
- package/dist/src/utils/approval-errors.d.ts +0 -1
- package/dist/src/utils/approval-errors.js +0 -9
- package/dist/src/utils/approval-progress.d.ts +0 -12
- package/dist/src/utils/approval-progress.js +0 -179
- package/dist/src/utils/auth/account-auth.d.ts +0 -33
- package/dist/src/utils/auth/account-auth.js +0 -302
- package/dist/src/utils/auth/client-credentials.d.ts +0 -26
- package/dist/src/utils/auth/client-credentials.js +0 -67
- package/dist/src/utils/auth/oauth-callback.d.ts +0 -6
- package/dist/src/utils/auth/oauth-callback.js +0 -28
- package/dist/src/utils/auth/oauth-errors.d.ts +0 -2
- package/dist/src/utils/auth/oauth-errors.js +0 -39
- package/dist/src/utils/auth/oauth-flow.d.ts +0 -37
- package/dist/src/utils/auth/oauth-flow.js +0 -313
- package/dist/src/utils/auth/oauth-transaction.d.ts +0 -35
- package/dist/src/utils/auth/oauth-transaction.js +0 -69
- package/dist/src/utils/cli-generator-utils.d.ts +0 -14
- package/dist/src/utils/cli-generator-utils.js +0 -122
- package/dist/src/utils/cli-generator.d.ts +0 -4
- package/dist/src/utils/cli-generator.js +0 -831
- package/dist/src/utils/cli-options.d.ts +0 -16
- package/dist/src/utils/cli-options.js +0 -34
- package/dist/src/utils/cli-renderer.d.ts +0 -53
- package/dist/src/utils/cli-renderer.js +0 -265
- package/dist/src/utils/constants.d.ts +0 -3
- package/dist/src/utils/constants.js +0 -5
- package/dist/src/utils/directory-detection.d.ts +0 -5
- package/dist/src/utils/directory-detection.js +0 -21
- package/dist/src/utils/errors.d.ts +0 -33
- package/dist/src/utils/errors.js +0 -36
- package/dist/src/utils/extensions.d.ts +0 -20
- package/dist/src/utils/extensions.js +0 -66
- package/dist/src/utils/getCallablePromise.d.ts +0 -6
- package/dist/src/utils/getCallablePromise.js +0 -14
- package/dist/src/utils/log.d.ts +0 -8
- package/dist/src/utils/log.js +0 -26
- package/dist/src/utils/manifest-helpers.d.ts +0 -10
- package/dist/src/utils/manifest-helpers.js +0 -19
- package/dist/src/utils/non-interactive.d.ts +0 -14
- package/dist/src/utils/non-interactive.js +0 -15
- package/dist/src/utils/package-manager-detector.d.ts +0 -18
- package/dist/src/utils/package-manager-detector.js +0 -72
- package/dist/src/utils/parameter-resolver.d.ts +0 -179
- package/dist/src/utils/parameter-resolver.js +0 -1554
- package/dist/src/utils/retry.d.ts +0 -6
- package/dist/src/utils/retry.js +0 -21
- package/dist/src/utils/schema-formatter.d.ts +0 -11
- package/dist/src/utils/schema-formatter.js +0 -131
- package/dist/src/utils/serializeAsync.d.ts +0 -2
- package/dist/src/utils/serializeAsync.js +0 -16
- package/dist/src/utils/spinner.d.ts +0 -1
- package/dist/src/utils/spinner.js +0 -21
- package/dist/src/utils/string-utils.d.ts +0 -1
- package/dist/src/utils/string-utils.js +0 -6
- package/dist/src/utils/triggerDrain.d.ts +0 -144
- package/dist/src/utils/triggerDrain.js +0 -351
- package/dist/src/utils/version-checker.d.ts +0 -17
- package/dist/src/utils/version-checker.js +0 -154
- package/dist/tsconfig.tsbuildinfo +0 -1
package/dist/src/utils/retry.js
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
function sleep(ms) {
|
|
2
|
-
return new Promise((resolve) => setTimeout(resolve, ms));
|
|
3
|
-
}
|
|
4
|
-
export async function withRetry({ action, attempts = 3, initialDelayMs = 100, shouldRetry = () => true, }) {
|
|
5
|
-
if (attempts <= 0) {
|
|
6
|
-
throw new Error("withRetry: attempts must be greater than 0");
|
|
7
|
-
}
|
|
8
|
-
let lastError;
|
|
9
|
-
for (let i = 0; i < attempts; i++) {
|
|
10
|
-
try {
|
|
11
|
-
return await action();
|
|
12
|
-
}
|
|
13
|
-
catch (err) {
|
|
14
|
-
lastError = err;
|
|
15
|
-
if (!shouldRetry(err) || i >= attempts - 1)
|
|
16
|
-
break;
|
|
17
|
-
await sleep(initialDelayMs * 2 ** i);
|
|
18
|
-
}
|
|
19
|
-
}
|
|
20
|
-
throw lastError;
|
|
21
|
-
}
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import type { z } from "zod";
|
|
2
|
-
import type { OutputFormatter, ZapierSdk } from "@zapier/zapier-sdk";
|
|
3
|
-
export declare function formatJsonOutput(data: unknown): void;
|
|
4
|
-
export declare function formatItemsFromSchema(_functionInfo: {
|
|
5
|
-
inputSchema: z.ZodType;
|
|
6
|
-
outputSchema?: z.ZodType;
|
|
7
|
-
}, items: unknown[], startingNumber?: number, options?: {
|
|
8
|
-
formatter?: OutputFormatter<ZapierSdk>;
|
|
9
|
-
sdk?: ZapierSdk;
|
|
10
|
-
params?: Record<string, unknown>;
|
|
11
|
-
}): Promise<void>;
|
|
@@ -1,131 +0,0 @@
|
|
|
1
|
-
import chalk from "chalk";
|
|
2
|
-
import util from "util";
|
|
3
|
-
import wrapAnsi from "wrap-ansi";
|
|
4
|
-
// ============================================================================
|
|
5
|
-
// JSON Formatting
|
|
6
|
-
// ============================================================================
|
|
7
|
-
export function formatJsonOutput(data) {
|
|
8
|
-
// Don't print anything for undefined results (commands that just perform actions)
|
|
9
|
-
if (data === undefined) {
|
|
10
|
-
return;
|
|
11
|
-
}
|
|
12
|
-
// Use util.inspect for colored output
|
|
13
|
-
console.log(util.inspect(data, { colors: true, depth: null, breakLength: 80 }));
|
|
14
|
-
}
|
|
15
|
-
// ============================================================================
|
|
16
|
-
// Generic Schema-Driven Formatter
|
|
17
|
-
// ============================================================================
|
|
18
|
-
export async function formatItemsFromSchema(_functionInfo, items, startingNumber = 0, options) {
|
|
19
|
-
// Use the registry-level formatter when the plugin declared one.
|
|
20
|
-
if (options?.formatter) {
|
|
21
|
-
let context;
|
|
22
|
-
if (options.formatter.fetch && options.sdk && options.params) {
|
|
23
|
-
for (const item of items) {
|
|
24
|
-
context = await options.formatter.fetch(options.sdk, options.params, item, context);
|
|
25
|
-
}
|
|
26
|
-
}
|
|
27
|
-
items.forEach((item, index) => {
|
|
28
|
-
const formatted = options.formatter.format(item, context);
|
|
29
|
-
formatSingleItem(formatted, startingNumber + index);
|
|
30
|
-
});
|
|
31
|
-
return;
|
|
32
|
-
}
|
|
33
|
-
// No formatter declared; fall back to generic field-sniffing.
|
|
34
|
-
formatItemsGeneric(items, startingNumber);
|
|
35
|
-
}
|
|
36
|
-
function formatSingleItem(formatted, itemNumber) {
|
|
37
|
-
// Build the main title line with optional subtitle
|
|
38
|
-
let titleLine = `${chalk.gray(`${itemNumber + 1}.`)} ${chalk.cyan(formatted.title)}`;
|
|
39
|
-
// Generate subtitle - always show key if available, then ID if available
|
|
40
|
-
const subtitleParts = [];
|
|
41
|
-
if (formatted.keys) {
|
|
42
|
-
subtitleParts.push(...formatted.keys);
|
|
43
|
-
}
|
|
44
|
-
else if (formatted.key) {
|
|
45
|
-
subtitleParts.push(formatted.key);
|
|
46
|
-
}
|
|
47
|
-
if (formatted.id) {
|
|
48
|
-
subtitleParts.push(formatted.id);
|
|
49
|
-
}
|
|
50
|
-
// Remove duplicates while preserving order
|
|
51
|
-
const uniqueParts = [...new Set(subtitleParts)];
|
|
52
|
-
if (uniqueParts.length > 0) {
|
|
53
|
-
titleLine += ` ${chalk.gray(`(${uniqueParts.join(", ")})`)}`;
|
|
54
|
-
}
|
|
55
|
-
console.log(titleLine);
|
|
56
|
-
// Show description if available
|
|
57
|
-
if (formatted.description) {
|
|
58
|
-
console.log(` ${chalk.dim(formatted.description)}`);
|
|
59
|
-
}
|
|
60
|
-
// If data is provided, use JSON formatting instead of details
|
|
61
|
-
if (formatted.data !== undefined) {
|
|
62
|
-
formatJsonOutput(formatted.data);
|
|
63
|
-
console.log(); // Empty line between items
|
|
64
|
-
return;
|
|
65
|
-
}
|
|
66
|
-
// Format detail lines
|
|
67
|
-
for (const detail of formatted.details) {
|
|
68
|
-
if (detail.label) {
|
|
69
|
-
const isMultiline = detail.text.includes("\n");
|
|
70
|
-
if (isMultiline) {
|
|
71
|
-
console.log(` ${chalk.gray(detail.label + ":")}`);
|
|
72
|
-
const displayText = formatDetailText(detail.text, DETAIL_INDENT + " ");
|
|
73
|
-
const styledText = applyStyle(displayText, detail.style);
|
|
74
|
-
console.log(`${DETAIL_INDENT} ${styledText}`);
|
|
75
|
-
}
|
|
76
|
-
else {
|
|
77
|
-
const styledValue = applyStyle(detail.text, detail.style);
|
|
78
|
-
console.log(` ${chalk.gray(detail.label + ":")} ${styledValue}`);
|
|
79
|
-
}
|
|
80
|
-
}
|
|
81
|
-
else {
|
|
82
|
-
const displayText = formatDetailText(detail.text, DETAIL_INDENT);
|
|
83
|
-
const styledText = applyStyle(displayText, detail.style);
|
|
84
|
-
console.log(` ${styledText}`);
|
|
85
|
-
}
|
|
86
|
-
}
|
|
87
|
-
console.log(); // Empty line between items
|
|
88
|
-
}
|
|
89
|
-
const DETAIL_INDENT = " ";
|
|
90
|
-
const DETAIL_MAX_LINES = 5;
|
|
91
|
-
function formatDetailText(text, indent = DETAIL_INDENT) {
|
|
92
|
-
const columns = Math.max((process.stdout.columns || 80) - indent.length, 40);
|
|
93
|
-
const wrapped = wrapAnsi(text, columns, { hard: true, trim: false });
|
|
94
|
-
const lines = wrapped.split("\n");
|
|
95
|
-
if (lines.length <= DETAIL_MAX_LINES) {
|
|
96
|
-
return lines.join("\n" + indent);
|
|
97
|
-
}
|
|
98
|
-
return (lines.slice(0, DETAIL_MAX_LINES).join("\n" + indent) + "\n" + indent + "…");
|
|
99
|
-
}
|
|
100
|
-
function applyStyle(value, style) {
|
|
101
|
-
switch (style) {
|
|
102
|
-
case "dim":
|
|
103
|
-
return chalk.dim(value);
|
|
104
|
-
case "accent":
|
|
105
|
-
return chalk.magenta(value);
|
|
106
|
-
case "warning":
|
|
107
|
-
return chalk.red(value);
|
|
108
|
-
case "success":
|
|
109
|
-
return chalk.green(value);
|
|
110
|
-
case "normal":
|
|
111
|
-
default:
|
|
112
|
-
return chalk.blue(value);
|
|
113
|
-
}
|
|
114
|
-
}
|
|
115
|
-
function convertGenericItemToFormattedItem(item) {
|
|
116
|
-
const itemObj = item;
|
|
117
|
-
return {
|
|
118
|
-
title: itemObj.title || itemObj.name || itemObj.key || itemObj.id || "Item",
|
|
119
|
-
id: itemObj.id,
|
|
120
|
-
key: itemObj.key,
|
|
121
|
-
description: itemObj.description,
|
|
122
|
-
details: [],
|
|
123
|
-
};
|
|
124
|
-
}
|
|
125
|
-
function formatItemsGeneric(items, startingNumber = 0) {
|
|
126
|
-
// Convert generic items to FormattedItem and use formatSingleItem
|
|
127
|
-
items.forEach((item, index) => {
|
|
128
|
-
const formatted = convertGenericItemToFormattedItem(item);
|
|
129
|
-
formatSingleItem(formatted, startingNumber + index);
|
|
130
|
-
});
|
|
131
|
-
}
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import { createHash } from "node:crypto";
|
|
2
|
-
const promises = {};
|
|
3
|
-
const serializeAsync = (fn) => async (...args) => {
|
|
4
|
-
const hash = createHash("sha256")
|
|
5
|
-
.update(fn.toString(), "utf8")
|
|
6
|
-
.digest()
|
|
7
|
-
.toString("hex");
|
|
8
|
-
const promise = promises[hash];
|
|
9
|
-
if (!promise) {
|
|
10
|
-
promises[hash] = fn(...args).finally(() => {
|
|
11
|
-
delete promises[hash];
|
|
12
|
-
});
|
|
13
|
-
}
|
|
14
|
-
return promises[hash];
|
|
15
|
-
};
|
|
16
|
-
export default serializeAsync;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare const spinPromise: <T>(promise: Promise<T>, text: string) => Promise<T>;
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import ora from "ora";
|
|
2
|
-
import { ZapierCliUserCancellationError } from "./errors";
|
|
3
|
-
export const spinPromise = async (promise, text) => {
|
|
4
|
-
const spinner = ora(text).start();
|
|
5
|
-
try {
|
|
6
|
-
const result = await promise;
|
|
7
|
-
spinner.succeed();
|
|
8
|
-
return result;
|
|
9
|
-
}
|
|
10
|
-
catch (error) {
|
|
11
|
-
if (error instanceof ZapierCliUserCancellationError) {
|
|
12
|
-
// For user cancellation, just stop the spinner without showing failure
|
|
13
|
-
spinner.stop();
|
|
14
|
-
}
|
|
15
|
-
else {
|
|
16
|
-
// For actual errors, show failure
|
|
17
|
-
spinner.fail();
|
|
18
|
-
}
|
|
19
|
-
throw error;
|
|
20
|
-
}
|
|
21
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare function toKebabCase(str: string): string;
|
|
@@ -1,144 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Shared CLI helpers for the `drain-trigger-inbox` and
|
|
3
|
-
* `watch-trigger-inbox` commands. Both wrap the eager SDK callback API
|
|
4
|
-
* and dispatch on the same flag set: interactive default (TTY),
|
|
5
|
-
* `--exec` (binary + argv, no shell), `--exec-shell` (shell handler),
|
|
6
|
-
* `--json` (drain: collect-and-print; watch: NDJSON streaming).
|
|
7
|
-
*/
|
|
8
|
-
import { type LeasedTriggerMessageItem } from "@zapier/zapier-sdk";
|
|
9
|
-
export type Callback = (message: LeasedTriggerMessageItem) => Promise<void>;
|
|
10
|
-
/**
|
|
11
|
-
* Marker error thrown by `createInteractiveCallback` when the user
|
|
12
|
-
* picks "Skip (let lease expire)". The SDK treats it like any other
|
|
13
|
-
* Error subclass — leave-leased per default `releaseOnError: false`
|
|
14
|
-
* — so the lease-timeout recovery path is preserved. The CLI uses
|
|
15
|
-
* the marker type to distinguish a deliberate skip from an unhandled
|
|
16
|
-
* exception when counting summary lines. Not a `ZapierSignal`: the
|
|
17
|
-
* SDK's signal-handling auto-releases the message, which is exactly
|
|
18
|
-
* what skip-expire does *not* want.
|
|
19
|
-
*/
|
|
20
|
-
export declare class CliSkipLeaseExpireError extends Error {
|
|
21
|
-
readonly name = "CliSkipLeaseExpireError";
|
|
22
|
-
constructor();
|
|
23
|
-
}
|
|
24
|
-
/**
|
|
25
|
-
* Prompts the user per message. Choices:
|
|
26
|
-
*
|
|
27
|
-
* - **Ack**: returns normally so the SDK acks the message.
|
|
28
|
-
* - **Skip (release after draining)**: throws
|
|
29
|
-
* `ZapierReleaseTriggerMessageSignal`. The SDK marks the message for
|
|
30
|
-
* release; the actual release call is deferred until the drain
|
|
31
|
-
* finishes so the same drain doesn't immediately re-lease it. After
|
|
32
|
-
* drain ends, the message returns to `available` for a future drain
|
|
33
|
-
* run or another consumer.
|
|
34
|
-
* - **Skip (let lease expire)**: throws `CliSkipLeaseExpireError` so
|
|
35
|
-
* the SDK leaves the message leased (it's not a `ZapierSignal`,
|
|
36
|
-
* so the SDK's catch-all "leave on error" path applies); the lease
|
|
37
|
-
* timeout (~5 min default) is the recovery path. Use this when you
|
|
38
|
-
* want backpressure on reprocessing. The CLI catches the marker
|
|
39
|
-
* to count it as a skip in the drain summary.
|
|
40
|
-
* - **Quit**: throws `ZapierAbortDrainSignal` so the SDK stops draining
|
|
41
|
-
* after the current batch finishes (in-flight callbacks complete;
|
|
42
|
-
* not-yet-started messages in the batch are released).
|
|
43
|
-
*
|
|
44
|
-
* Ctrl-C during the prompt is translated to `ZapierAbortDrainSignal`
|
|
45
|
-
* (same as Quit) — inquirer raises `ExitPromptError`, which we catch
|
|
46
|
-
* and re-throw as the abort signal.
|
|
47
|
-
*/
|
|
48
|
-
export declare function createInteractiveCallback(): Callback;
|
|
49
|
-
/**
|
|
50
|
-
* Writes one JSON object per line to stdout (NDJSON) for piping. Acks
|
|
51
|
-
* each message after the write resolves; if stdout is closed mid-drain
|
|
52
|
-
* (broken pipe), the write throws and the message stays unacked.
|
|
53
|
-
*
|
|
54
|
-
* The write callback alone provides backpressure: it doesn't fire until
|
|
55
|
-
* the chunk is fully committed to the underlying resource, so awaiting
|
|
56
|
-
* it pauses the drain when stdout is busy. No separate `drain` listener
|
|
57
|
-
* needed — and adding one would race with the callback (drain fires at
|
|
58
|
-
* highWaterMark, callback fires after full commit; if drain wins, the
|
|
59
|
-
* later callback's error gets dropped on the floor).
|
|
60
|
-
*/
|
|
61
|
-
export declare function createNdjsonCallback(): Callback;
|
|
62
|
-
export declare function runShellCommand(command: string, message: LeasedTriggerMessageItem, signal?: AbortSignal): Promise<void>;
|
|
63
|
-
/**
|
|
64
|
-
* Run a binary per message with no shell interpretation. `argv[0]` is
|
|
65
|
-
* the executable; the rest are passed literally as argv to the child.
|
|
66
|
-
* Otherwise identical to `runShellCommand`: stdin = message JSON, exit
|
|
67
|
-
* code 0 acks, non-zero rejects, abort signal kills the child.
|
|
68
|
-
*/
|
|
69
|
-
export declare function runExecCommand(argv: string[], message: LeasedTriggerMessageItem, signal?: AbortSignal): Promise<void>;
|
|
70
|
-
/**
|
|
71
|
-
* Print a single per-message error to stderr. Used as the live
|
|
72
|
-
* `onError` body so failures surface as they happen (vs accumulated
|
|
73
|
-
* and dumped at the end, which is broken for `watch-trigger-inbox`
|
|
74
|
-
* where "the end" is Ctrl-C).
|
|
75
|
-
*/
|
|
76
|
-
export declare function printDrainError(reason: unknown, message: LeasedTriggerMessageItem): void;
|
|
77
|
-
/**
|
|
78
|
-
* One-line summary printed when the CLI finished a drain in a mode
|
|
79
|
-
* where the data array is uninformative (interactive, exec, exec-shell).
|
|
80
|
-
* Both the bounded and forever variants use the same format.
|
|
81
|
-
*
|
|
82
|
-
* `skipped` is the interactive-mode count of user-driven Skip choices
|
|
83
|
-
* (release-after-draining + let-lease-expire). Omitted when zero so the
|
|
84
|
-
* subprocess modes — which have no skip semantics — keep their original
|
|
85
|
-
* two-part summary.
|
|
86
|
-
*/
|
|
87
|
-
export declare function printDrainSummary(counts: {
|
|
88
|
-
fulfilled: number;
|
|
89
|
-
rejected: number;
|
|
90
|
-
skipped?: number;
|
|
91
|
-
}): void;
|
|
92
|
-
/**
|
|
93
|
-
* Warn on stderr that interactive mode is overriding an explicit
|
|
94
|
-
* `continueOnError: false`. Only fires when the caller (programmatic
|
|
95
|
-
* SDK consumer or future flag form that takes `=false`) opted into
|
|
96
|
-
* fail-fast — bare `--continue-on-error` flag absence leaves it
|
|
97
|
-
* `undefined` and doesn't trigger this. Interactive mode mechanically
|
|
98
|
-
* requires continue-on-error: the "Skip (let lease expire)" choice
|
|
99
|
-
* throws a plain Error to leave the message leased, and a fail-fast
|
|
100
|
-
* drain would tear down on the first skip.
|
|
101
|
-
*/
|
|
102
|
-
export declare function warnInteractiveContinueOnErrorOverride(): void;
|
|
103
|
-
/**
|
|
104
|
-
* Throw a CliValidationError if the current process isn't attached to
|
|
105
|
-
* a real terminal on both stdin and stdout. Used by the interactive
|
|
106
|
-
* default to fail fast with a useful message instead of letting
|
|
107
|
-
* inquirer fall over later.
|
|
108
|
-
*/
|
|
109
|
-
export declare function requireInteractiveTty(commandName: string): void;
|
|
110
|
-
/**
|
|
111
|
-
* Reject more than one of `--exec`, `--exec-shell`, and `--json`.
|
|
112
|
-
* Each is a non-interactive output path and choosing implicitly is
|
|
113
|
-
* ambiguous.
|
|
114
|
-
*/
|
|
115
|
-
export declare function rejectExecJsonMutex(opts: {
|
|
116
|
-
exec?: unknown;
|
|
117
|
-
execShell?: unknown;
|
|
118
|
-
json?: unknown;
|
|
119
|
-
}): void;
|
|
120
|
-
/**
|
|
121
|
-
* Pull argv tokens after the first `--` separator out of `process.argv`.
|
|
122
|
-
* Returns `[]` when there's no `--`. Used by drain/watch to append
|
|
123
|
-
* post-`--` args to the `--exec` binary, mirroring `xargs`, `gh`, and
|
|
124
|
-
* `npm run -- ...` semantics.
|
|
125
|
-
*
|
|
126
|
-
* Read from `process.argv` rather than threading via cli-generator
|
|
127
|
-
* because Commander already consumes `--` at parse time and there's
|
|
128
|
-
* no per-command API for "the args after `--`" exposed through the
|
|
129
|
-
* SDK options object.
|
|
130
|
-
*/
|
|
131
|
-
export declare function getPostDashArgs(argv?: string[]): string[];
|
|
132
|
-
/**
|
|
133
|
-
* Combine an optional user signal with an internal one (typically the
|
|
134
|
-
* SIGINT controller) into a single AbortSignal that fires when either
|
|
135
|
-
* source aborts. Returns a `dispose` to detach the listeners; safe to
|
|
136
|
-
* call regardless of whether the combined signal fired.
|
|
137
|
-
*
|
|
138
|
-
* Plain shape rather than the SDK's `combineAbortSignals`, which works
|
|
139
|
-
* over `DisposableAbortSignal` handles and returns a different shape.
|
|
140
|
-
*/
|
|
141
|
-
export declare function combineSignals(a: AbortSignal | undefined, b: AbortSignal): {
|
|
142
|
-
signal: AbortSignal;
|
|
143
|
-
dispose: () => void;
|
|
144
|
-
};
|