@zapier/zapier-sdk-cli 0.65.4 → 0.65.7

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/dist/cli.mjs CHANGED
@@ -6,8 +6,8 @@ import inquirer from 'inquirer';
6
6
  import search from '@inquirer/search';
7
7
  import chalk from 'chalk';
8
8
  import ora from 'ora';
9
- import util from 'util';
10
- import wrapAnsi from 'wrap-ansi';
9
+ import util, { stripVTControlCharacters } from 'util';
10
+ import wrapAnsi3 from 'wrap-ansi';
11
11
  import * as jwt from 'jsonwebtoken';
12
12
  import { deletePassword, getKeyring, setPassword, getPassword } from 'cross-keychain';
13
13
  import Conf from 'conf';
@@ -33,8 +33,7 @@ import { fileURLToPath } from 'url';
33
33
  import { triggerInboxResolver, DrainTriggerInboxSchema, WatchTriggerInboxSchema, injectCliLogin as injectCliLogin$1, definePlugin as definePlugin$1, omitExports as omitExports$1, zapierExperimentalSdkPlugin, createSdk, CORE_OPTIONS_ID, SDK_OPTIONS_ID, addPlugin } from '@zapier/zapier-sdk/experimental';
34
34
  import packageJsonLib, { VersionNotFoundError } from 'package-json';
35
35
  import semver from 'semver';
36
- import React from 'react';
37
- import { jsx, jsxs } from 'react/jsx-runtime';
36
+ import * as readline from 'readline';
38
37
 
39
38
  var __defProp = Object.defineProperty;
40
39
  var __export = (target, all) => {
@@ -595,25 +594,25 @@ var SchemaParameterResolver = class {
595
594
  name: chalk.dim("(Try a different search)"),
596
595
  value: TRY_AGAIN_SENTINEL
597
596
  };
598
- const out = [];
597
+ const out2 = [];
599
598
  if (orderedMatches.length === 0) {
600
- out.push(useAsIsChoice);
601
- out.push(tryAgainChoice);
602
- out.push(...skipChoice);
599
+ out2.push(useAsIsChoice);
600
+ out2.push(tryAgainChoice);
601
+ out2.push(...skipChoice);
603
602
  } else {
604
- out.push(...orderedMatches);
605
- out.push(...skipChoice);
606
- out.push(useAsIsChoice);
607
- out.push(tryAgainChoice);
603
+ out2.push(...orderedMatches);
604
+ out2.push(...skipChoice);
605
+ out2.push(useAsIsChoice);
606
+ out2.push(tryAgainChoice);
608
607
  }
609
608
  for (const message2 of capabilityHintMessages) {
610
- out.push({
609
+ out2.push({
611
610
  name: chalk.dim(message2),
612
611
  value: SKIP_SENTINEL,
613
612
  disabled: true
614
613
  });
615
614
  }
616
- return out;
615
+ return out2;
617
616
  }
618
617
  });
619
618
  if (selected === SKIP_SENTINEL) return void 0;
@@ -795,7 +794,7 @@ var SchemaParameterResolver = class {
795
794
  const matches = trimmed ? dataChoices.filter(
796
795
  (c) => c.name.toLowerCase().includes(lower)
797
796
  ) : dataChoices;
798
- const out = [];
797
+ const out2 = [];
799
798
  const skipChoice = isOptional ? [
800
799
  {
801
800
  name: chalk.dim("(Skip)"),
@@ -813,24 +812,24 @@ var SchemaParameterResolver = class {
813
812
  value: LOAD_MORE_SENTINEL
814
813
  } : null;
815
814
  if (matchesFirst && orderedMatches.length > 0) {
816
- out.push(...orderedMatches);
817
- out.push(...skipChoice);
818
- out.push(customValueChoice);
819
- if (loadMoreChoice) out.push(loadMoreChoice);
815
+ out2.push(...orderedMatches);
816
+ out2.push(...skipChoice);
817
+ out2.push(customValueChoice);
818
+ if (loadMoreChoice) out2.push(loadMoreChoice);
820
819
  } else if (matchesFirst) {
821
- out.push(customValueChoice);
822
- if (loadMoreChoice) out.push(loadMoreChoice);
823
- out.push(...skipChoice);
820
+ out2.push(customValueChoice);
821
+ if (loadMoreChoice) out2.push(loadMoreChoice);
822
+ out2.push(...skipChoice);
824
823
  } else {
825
- out.push(...skipChoice);
826
- out.push(customValueChoice);
827
- out.push(...orderedMatches);
828
- if (loadMoreChoice) out.push(loadMoreChoice);
824
+ out2.push(...skipChoice);
825
+ out2.push(customValueChoice);
826
+ out2.push(...orderedMatches);
827
+ if (loadMoreChoice) out2.push(loadMoreChoice);
829
828
  }
830
829
  if (capabilityHints.length > 0 && (!trimmed || matches.length > 0)) {
831
- out.push(...capabilityHints);
830
+ out2.push(...capabilityHints);
832
831
  }
833
- return out;
832
+ return out2;
834
833
  }
835
834
  });
836
835
  } else {
@@ -1272,7 +1271,7 @@ Optional fields${pathContext}:`));
1272
1271
  const trimmed = (term ?? "").trim();
1273
1272
  const lower = trimmed.toLowerCase();
1274
1273
  const matches = trimmed ? dataChoices.filter((c) => c.name.toLowerCase().includes(lower)) : dataChoices;
1275
- const out = [];
1274
+ const out2 = [];
1276
1275
  const skipChoice = !fieldMeta.isRequired ? [{ name: chalk.dim("(Skip)"), value: SKIP_SENTINEL }] : [];
1277
1276
  const customValueChoice = {
1278
1277
  name: chalk.dim("(Enter custom value)"),
@@ -1283,21 +1282,21 @@ Optional fields${pathContext}:`));
1283
1282
  value: LOAD_MORE_SENTINEL
1284
1283
  } : null;
1285
1284
  if (trimmed && matches.length > 0) {
1286
- out.push(...matches);
1287
- out.push(...skipChoice);
1288
- out.push(customValueChoice);
1289
- if (loadMoreChoice) out.push(loadMoreChoice);
1285
+ out2.push(...matches);
1286
+ out2.push(...skipChoice);
1287
+ out2.push(customValueChoice);
1288
+ if (loadMoreChoice) out2.push(loadMoreChoice);
1290
1289
  } else if (trimmed) {
1291
- out.push(customValueChoice);
1292
- if (loadMoreChoice) out.push(loadMoreChoice);
1293
- out.push(...skipChoice);
1290
+ out2.push(customValueChoice);
1291
+ if (loadMoreChoice) out2.push(loadMoreChoice);
1292
+ out2.push(...skipChoice);
1294
1293
  } else {
1295
- out.push(...skipChoice);
1296
- out.push(customValueChoice);
1297
- out.push(...matches);
1298
- if (loadMoreChoice) out.push(loadMoreChoice);
1294
+ out2.push(...skipChoice);
1295
+ out2.push(customValueChoice);
1296
+ out2.push(...matches);
1297
+ if (loadMoreChoice) out2.push(loadMoreChoice);
1299
1298
  }
1300
- return out;
1299
+ return out2;
1301
1300
  }
1302
1301
  });
1303
1302
  if (selectedValue === SKIP_SENTINEL) {
@@ -1717,7 +1716,7 @@ var SHARED_COMMAND_CLI_OPTIONS = [
1717
1716
 
1718
1717
  // package.json
1719
1718
  var package_default = {
1720
- version: "0.65.4"};
1719
+ version: "0.65.7"};
1721
1720
 
1722
1721
  // src/telemetry/builders.ts
1723
1722
  function createCliBaseEvent(context = {}) {
@@ -1860,7 +1859,7 @@ var DETAIL_INDENT = " ";
1860
1859
  var DETAIL_MAX_LINES = 5;
1861
1860
  function formatDetailText(text, indent = DETAIL_INDENT) {
1862
1861
  const columns = Math.max((process.stdout.columns || 80) - indent.length, 40);
1863
- const wrapped = wrapAnsi(text, columns, { hard: true, trim: false });
1862
+ const wrapped = wrapAnsi3(text, columns, { hard: true, trim: false });
1864
1863
  const lines = wrapped.split("\n");
1865
1864
  if (lines.length <= DETAIL_MAX_LINES) {
1866
1865
  return lines.join("\n" + indent);
@@ -6615,27 +6614,27 @@ function formatWriteOut(params) {
6615
6614
  "%{url_effective}": params.urlEffective,
6616
6615
  "%{content_type}": params.contentType ?? ""
6617
6616
  };
6618
- let out = template;
6617
+ let out2 = template;
6619
6618
  for (const [token, value] of Object.entries(replacements)) {
6620
- out = out.split(token).join(value);
6619
+ out2 = out2.split(token).join(value);
6621
6620
  }
6622
- return decodeWriteOutEscapes(out);
6621
+ return decodeWriteOutEscapes(out2);
6623
6622
  }
6624
6623
  function appendQueryParams(url, dataParts) {
6625
- const out = new URL(url.toString());
6624
+ const out2 = new URL(url.toString());
6626
6625
  for (const part of dataParts) {
6627
6626
  const segments = part.split("&");
6628
6627
  for (const seg of segments) {
6629
6628
  if (!seg) continue;
6630
6629
  const idx = seg.indexOf("=");
6631
6630
  if (idx === -1) {
6632
- out.searchParams.append(seg, "");
6631
+ out2.searchParams.append(seg, "");
6633
6632
  } else {
6634
- out.searchParams.append(seg.slice(0, idx), seg.slice(idx + 1));
6633
+ out2.searchParams.append(seg.slice(0, idx), seg.slice(idx + 1));
6635
6634
  }
6636
6635
  }
6637
6636
  }
6638
- return out;
6637
+ return out2;
6639
6638
  }
6640
6639
  async function readAllStdin() {
6641
6640
  const chunks = [];
@@ -7965,7 +7964,7 @@ function renderDeprecationNotices() {
7965
7964
  function buildBoxLines(message) {
7966
7965
  const innerWidth = BOX_WIDTH - 4;
7967
7966
  const pad = (line) => `\u2502 ${line.padEnd(innerWidth)} \u2502`;
7968
- const wrapped = wrapAnsi(message, innerWidth, { hard: true }).split("\n");
7967
+ const wrapped = wrapAnsi3(message, innerWidth, { hard: true }).split("\n");
7969
7968
  return [
7970
7969
  `\u256D${"\u2500".repeat(BOX_WIDTH - 2)}\u256E`,
7971
7970
  pad(BOX_TITLE),
@@ -7978,7 +7977,7 @@ function buildBoxLines(message) {
7978
7977
  // package.json with { type: 'json' }
7979
7978
  var package_default2 = {
7980
7979
  name: "@zapier/zapier-sdk-cli",
7981
- version: "0.65.4"};
7980
+ version: "0.65.7"};
7982
7981
 
7983
7982
  // src/sdk.ts
7984
7983
  var warnedDeprecatedMethods = /* @__PURE__ */ new Set();
@@ -8316,16 +8315,63 @@ async function checkAndNotifyUpdates({
8316
8315
  const versionInfo = await checkForUpdates({ packageName, currentVersion });
8317
8316
  displayUpdateNotification(versionInfo, packageName);
8318
8317
  }
8318
+ var EMOJI_PRESENTATION_PATTERN = /\p{Emoji_Presentation}/u;
8319
+ var WIDE_CODE_POINT_RANGES = [
8320
+ [4352, 4447],
8321
+ // Hangul Jamo
8322
+ [11904, 12350],
8323
+ // CJK Radicals ... CJK Symbols and Punctuation
8324
+ [12353, 13311],
8325
+ // Hiragana ... CJK Compatibility
8326
+ [13312, 19903],
8327
+ // CJK Unified Ideographs Extension A
8328
+ [19968, 40959],
8329
+ // CJK Unified Ideographs
8330
+ [40960, 42191],
8331
+ // Yi Syllables, Yi Radicals
8332
+ [44032, 55203],
8333
+ // Hangul Syllables
8334
+ [63744, 64255],
8335
+ // CJK Compatibility Ideographs
8336
+ [65040, 65049],
8337
+ // Vertical Forms
8338
+ [65072, 65131],
8339
+ // CJK Compatibility Forms, Small Form Variants
8340
+ [65281, 65376],
8341
+ // Fullwidth Forms
8342
+ [65504, 65510],
8343
+ // Fullwidth Signs
8344
+ [110592, 110593],
8345
+ // Kana Supplement
8346
+ [131072, 262141]
8347
+ // CJK Unified Ideographs Extension B and beyond
8348
+ ];
8349
+ function isWideCodePoint(codePoint) {
8350
+ return WIDE_CODE_POINT_RANGES.some(
8351
+ ([start, end]) => codePoint >= start && codePoint <= end
8352
+ );
8353
+ }
8354
+ function displayWidth(text) {
8355
+ let width = 0;
8356
+ for (const character of stripVTControlCharacters(text)) {
8357
+ const codePoint = character.codePointAt(0);
8358
+ if (codePoint === void 0) continue;
8359
+ width += isWideCodePoint(codePoint) || EMOJI_PRESENTATION_PATTERN.test(character) ? 2 : 1;
8360
+ }
8361
+ return width;
8362
+ }
8363
+
8364
+ // src/utils/approval-progress.ts
8319
8365
  var FALLBACK_PANEL_WIDTH = 72;
8320
8366
  var MIN_PANEL_WIDTH = 36;
8321
8367
  var MAX_PANEL_WIDTH = 88;
8322
8368
  var SPINNER_INTERVAL_MS = 80;
8323
8369
  var SPINNER_FRAMES = ["\u280B", "\u2819", "\u2839", "\u2838", "\u283C", "\u2834", "\u2826", "\u2827", "\u2807", "\u280F"];
8324
- var inkImportPromise;
8325
- function loadInk() {
8326
- inkImportPromise ?? (inkImportPromise = import('ink'));
8327
- return inkImportPromise;
8328
- }
8370
+ var ESC = String.fromCharCode(27);
8371
+ var HIDE_CURSOR = `${ESC}[?25l`;
8372
+ var SHOW_CURSOR = `${ESC}[?25h`;
8373
+ var CURSOR_RESTORE_SIGNALS = ["SIGINT", "SIGTERM"];
8374
+ var out = process.stderr;
8329
8375
  function createInitialState() {
8330
8376
  return {
8331
8377
  messages: [],
@@ -8333,7 +8379,7 @@ function createInitialState() {
8333
8379
  };
8334
8380
  }
8335
8381
  function getPanelWidth() {
8336
- const terminalColumns = process.stderr.columns;
8382
+ const terminalColumns = out.columns;
8337
8383
  if (!terminalColumns) return FALLBACK_PANEL_WIDTH;
8338
8384
  return Math.min(
8339
8385
  Math.max(terminalColumns - 4, MIN_PANEL_WIDTH),
@@ -8355,128 +8401,186 @@ function getApprovedVerdict(decision, reason) {
8355
8401
  reason
8356
8402
  };
8357
8403
  }
8358
- function Spinner({ text }) {
8359
- const [frameIndex, setFrameIndex] = React.useState(0);
8360
- const InkText = text;
8361
- React.useEffect(() => {
8362
- const timer = setInterval(() => {
8363
- setFrameIndex((index) => (index + 1) % SPINNER_FRAMES.length);
8364
- }, SPINNER_INTERVAL_MS);
8365
- return () => clearInterval(timer);
8366
- }, []);
8367
- return /* @__PURE__ */ jsx(InkText, { color: "yellow", children: `${SPINNER_FRAMES[frameIndex]} Checking approval...` });
8368
- }
8369
- function ApprovalProgressView({
8370
- state,
8371
- box,
8372
- text
8373
- }) {
8374
- if (!state.active) return null;
8375
- const InkBox = box;
8376
- const InkText = text;
8404
+ function buildFrameLines(state, frameIndex) {
8405
+ const width = getPanelWidth();
8406
+ const innerWidth = width - 4;
8407
+ const bodyWidth = width - 2;
8408
+ const bodyTextWidth = innerWidth - 2;
8409
+ const content = [];
8410
+ content.push(chalk.bold.cyan("Approval review"));
8411
+ content.push("");
8412
+ if (!state.verdict) {
8413
+ content.push(
8414
+ chalk.yellow(`${SPINNER_FRAMES[frameIndex]} Checking approval...`)
8415
+ );
8416
+ }
8377
8417
  const recentMessages = state.messages.slice(-5);
8378
8418
  const hasMessages = recentMessages.length > 0;
8379
- return /* @__PURE__ */ jsxs(
8380
- InkBox,
8381
- {
8382
- borderColor: "cyan",
8383
- borderStyle: "round",
8384
- flexDirection: "column",
8385
- paddingX: 1,
8386
- width: getPanelWidth(),
8387
- children: [
8388
- /* @__PURE__ */ jsx(InkText, { bold: true, color: "cyan", children: "Approval review" }),
8389
- /* @__PURE__ */ jsxs(InkBox, { flexDirection: "column", marginTop: 1, children: [
8390
- !state.verdict && /* @__PURE__ */ jsx(Spinner, { text }),
8391
- recentMessages.map((message, index) => /* @__PURE__ */ jsxs(InkBox, { flexDirection: "row", children: [
8392
- /* @__PURE__ */ jsx(InkText, { color: "cyan", children: "> " }),
8393
- /* @__PURE__ */ jsx(
8394
- InkText,
8395
- {
8396
- dimColor: Boolean(state.verdict) || index < recentMessages.length - 1,
8397
- wrap: "wrap",
8398
- children: message
8399
- }
8400
- )
8401
- ] }, `${index}-${message}`)),
8402
- state.streamError && /* @__PURE__ */ jsxs(
8403
- InkBox,
8404
- {
8405
- flexDirection: "column",
8406
- marginTop: hasMessages || !state.verdict ? 1 : 0,
8407
- children: [
8408
- /* @__PURE__ */ jsx(InkText, { bold: true, color: "red", children: "Approval stream error" }),
8409
- /* @__PURE__ */ jsx(InkText, { wrap: "wrap", children: ` ${state.streamError}` })
8410
- ]
8411
- }
8412
- ),
8413
- state.verdict && /* @__PURE__ */ jsxs(
8414
- InkBox,
8415
- {
8416
- flexDirection: "column",
8417
- marginTop: hasMessages || state.streamError ? 1 : 0,
8418
- children: [
8419
- /* @__PURE__ */ jsx(InkText, { bold: true, color: state.verdict.color, children: `${state.verdict.icon} ${state.verdict.label}` }),
8420
- state.verdict.reason && /* @__PURE__ */ jsx(InkText, { wrap: "wrap", children: ` ${state.verdict.reason}` })
8421
- ]
8422
- }
8423
- )
8424
- ] })
8425
- ]
8419
+ recentMessages.forEach((message, index) => {
8420
+ const dimmed = Boolean(state.verdict) || index < recentMessages.length - 1;
8421
+ const segments = wrapAnsi3(message, bodyTextWidth, { hard: true }).split(
8422
+ "\n"
8423
+ );
8424
+ segments.forEach((segment, segmentIndex) => {
8425
+ const prefix = segmentIndex === 0 ? chalk.cyan("> ") : " ";
8426
+ content.push(`${prefix}${dimmed ? chalk.dim(segment) : segment}`);
8427
+ });
8428
+ });
8429
+ if (state.streamError) {
8430
+ if (hasMessages || !state.verdict) content.push("");
8431
+ content.push(chalk.bold.red("Approval stream error"));
8432
+ for (const segment of wrapAnsi3(state.streamError, bodyTextWidth, {
8433
+ hard: true
8434
+ }).split("\n")) {
8435
+ content.push(` ${segment}`);
8436
+ }
8437
+ }
8438
+ if (state.verdict) {
8439
+ if (hasMessages || state.streamError) content.push("");
8440
+ content.push(
8441
+ chalk.bold.green(`${state.verdict.icon} ${state.verdict.label}`)
8442
+ );
8443
+ if (state.verdict.reason) {
8444
+ for (const segment of wrapAnsi3(state.verdict.reason, bodyTextWidth, {
8445
+ hard: true
8446
+ }).split("\n")) {
8447
+ content.push(` ${segment}`);
8448
+ }
8426
8449
  }
8427
- );
8450
+ }
8451
+ const pad = (line) => {
8452
+ const padding = " ".repeat(Math.max(0, innerWidth - displayWidth(line)));
8453
+ return `${chalk.cyan("\u2502")} ${line}${padding} ${chalk.cyan("\u2502")}`;
8454
+ };
8455
+ return [
8456
+ chalk.cyan(`\u256D${"\u2500".repeat(bodyWidth)}\u256E`),
8457
+ ...content.map(pad),
8458
+ chalk.cyan(`\u2570${"\u2500".repeat(bodyWidth)}\u256F`)
8459
+ ];
8428
8460
  }
8429
8461
  function createApprovalProgressRenderer({
8430
8462
  enabled,
8431
8463
  onEvent
8432
8464
  }) {
8433
- let instance;
8434
8465
  let currentState = createInitialState();
8435
- let renderQueue = Promise.resolve();
8436
- let renderGeneration = 0;
8437
8466
  let renderEnabled = enabled;
8467
+ let disposed = false;
8438
8468
  let renderErrorReported = false;
8469
+ let lastFrameLineCount = 0;
8470
+ let spinnerFrameIndex = 0;
8471
+ let spinnerTimer;
8472
+ let cursorHidden = false;
8473
+ let signalHandlers = [];
8474
+ function restoreCursor() {
8475
+ if (cursorHidden) {
8476
+ try {
8477
+ out.write(SHOW_CURSOR);
8478
+ } catch {
8479
+ }
8480
+ cursorHidden = false;
8481
+ }
8482
+ for (const { signal, handler } of signalHandlers) {
8483
+ process.removeListener(signal, handler);
8484
+ }
8485
+ signalHandlers = [];
8486
+ }
8487
+ function ensureCursorHidden() {
8488
+ if (cursorHidden) return;
8489
+ out.write(HIDE_CURSOR);
8490
+ cursorHidden = true;
8491
+ for (const signal of CURSOR_RESTORE_SIGNALS) {
8492
+ const handler = () => {
8493
+ restoreCursor();
8494
+ if (process.listenerCount(signal) === 0) {
8495
+ process.kill(process.pid, signal);
8496
+ }
8497
+ };
8498
+ signalHandlers.push({ signal, handler });
8499
+ process.once(signal, handler);
8500
+ }
8501
+ }
8502
+ function eraseFrame() {
8503
+ if (lastFrameLineCount === 0) return;
8504
+ readline.moveCursor(out, 0, -lastFrameLineCount);
8505
+ readline.cursorTo(out, 0);
8506
+ readline.clearScreenDown(out);
8507
+ lastFrameLineCount = 0;
8508
+ }
8509
+ function paint(lines) {
8510
+ eraseFrame();
8511
+ out.write(`${lines.join("\n")}
8512
+ `);
8513
+ lastFrameLineCount = lines.length;
8514
+ }
8515
+ function renderFrame(state) {
8516
+ paint(buildFrameLines(state, spinnerFrameIndex));
8517
+ }
8518
+ function stopSpinnerTimer() {
8519
+ if (spinnerTimer) {
8520
+ clearInterval(spinnerTimer);
8521
+ spinnerTimer = void 0;
8522
+ }
8523
+ }
8524
+ function disableAfterError(error) {
8525
+ renderEnabled = false;
8526
+ stopSpinnerTimer();
8527
+ restoreCursor();
8528
+ lastFrameLineCount = 0;
8529
+ currentState = createInitialState();
8530
+ if (renderErrorReported) return;
8531
+ renderErrorReported = true;
8532
+ const message = error instanceof Error ? error.message : String(error);
8533
+ try {
8534
+ out.write(`Approval progress unavailable: ${message}
8535
+ `);
8536
+ } catch {
8537
+ }
8538
+ }
8539
+ function ensureSpinnerTimer() {
8540
+ if (spinnerTimer) return;
8541
+ spinnerTimer = setInterval(() => {
8542
+ if (!renderEnabled || !currentState.active || currentState.verdict) {
8543
+ return;
8544
+ }
8545
+ spinnerFrameIndex = (spinnerFrameIndex + 1) % SPINNER_FRAMES.length;
8546
+ try {
8547
+ renderFrame(currentState);
8548
+ } catch (error) {
8549
+ disableAfterError(error);
8550
+ }
8551
+ }, SPINNER_INTERVAL_MS);
8552
+ spinnerTimer.unref?.();
8553
+ }
8439
8554
  function update(nextState, { complete = false } = {}) {
8440
- const generation = renderGeneration;
8441
- currentState = complete ? createInitialState() : nextState;
8442
- renderQueue = renderQueue.then(async () => {
8443
- if (generation !== renderGeneration) return;
8444
- const { Box, Text, render } = await loadInk();
8445
- if (generation !== renderGeneration) return;
8446
- const element = /* @__PURE__ */ jsx(ApprovalProgressView, { state: nextState, box: Box, text: Text });
8447
- if (!instance) {
8448
- instance = render(element, {
8449
- stdout: process.stderr,
8450
- stderr: process.stderr
8451
- });
8555
+ try {
8556
+ ensureCursorHidden();
8557
+ renderFrame(nextState);
8558
+ if (complete) {
8559
+ stopSpinnerTimer();
8560
+ restoreCursor();
8561
+ lastFrameLineCount = 0;
8562
+ currentState = createInitialState();
8452
8563
  } else {
8453
- instance.rerender(element);
8564
+ currentState = nextState;
8565
+ ensureSpinnerTimer();
8454
8566
  }
8455
- if (complete) {
8456
- instance.unmount();
8457
- instance = void 0;
8458
- }
8459
- }).catch((error) => {
8460
- if (generation !== renderGeneration) return;
8461
- renderEnabled = false;
8462
- currentState = createInitialState();
8463
- if (renderErrorReported) return;
8464
- renderErrorReported = true;
8465
- const message = error instanceof Error ? error.message : String(error);
8466
- process.stderr.write(`Approval progress unavailable: ${message}
8467
- `);
8468
- });
8567
+ } catch (error) {
8568
+ disableAfterError(error);
8569
+ }
8469
8570
  }
8470
8571
  function dismiss() {
8471
- renderGeneration++;
8572
+ stopSpinnerTimer();
8573
+ try {
8574
+ eraseFrame();
8575
+ } catch {
8576
+ }
8577
+ restoreCursor();
8472
8578
  currentState = createInitialState();
8473
- instance?.unmount();
8474
- instance = void 0;
8475
8579
  }
8476
8580
  return {
8477
8581
  onEvent(event) {
8478
8582
  onEvent?.(event);
8479
- if (!renderEnabled) return;
8583
+ if (disposed || !renderEnabled) return;
8480
8584
  if (event.type === "approval:required") {
8481
8585
  if (event.payload?.mode !== "auto") return;
8482
8586
  update({
@@ -8537,6 +8641,11 @@ function createApprovalProgressRenderer({
8537
8641
  if (event.type === "approval:denied" || event.type === "approval:failed" || event.type === "approval:timeout" || event.type === "approval:error") {
8538
8642
  dismiss();
8539
8643
  }
8644
+ },
8645
+ dispose() {
8646
+ disposed = true;
8647
+ stopSpinnerTimer();
8648
+ restoreCursor();
8540
8649
  }
8541
8650
  };
8542
8651
  }
@@ -8682,6 +8791,8 @@ program.exitOverride();
8682
8791
  console.error("Unexpected error:", error);
8683
8792
  exitCode = 1;
8684
8793
  }
8794
+ } finally {
8795
+ approvalProgress.dispose();
8685
8796
  }
8686
8797
  await versionCheckPromise;
8687
8798
  await disposeSdk(sdk, { exitCode }).catch(() => {
@@ -5109,7 +5109,7 @@ function collectDeprecationNoticeAndForward(event, onEvent) {
5109
5109
  // package.json with { type: 'json' }
5110
5110
  var package_default = {
5111
5111
  name: "@zapier/zapier-sdk-cli",
5112
- version: "0.65.4"};
5112
+ version: "0.65.7"};
5113
5113
 
5114
5114
  // src/sdk.ts
5115
5115
  var warnedDeprecatedMethods = /* @__PURE__ */ new Set();
@@ -5073,7 +5073,7 @@ function collectDeprecationNoticeAndForward(event, onEvent) {
5073
5073
  // package.json with { type: 'json' }
5074
5074
  var package_default = {
5075
5075
  name: "@zapier/zapier-sdk-cli",
5076
- version: "0.65.4"};
5076
+ version: "0.65.7"};
5077
5077
 
5078
5078
  // src/sdk.ts
5079
5079
  var warnedDeprecatedMethods = /* @__PURE__ */ new Set();
package/dist/index.cjs CHANGED
@@ -5109,7 +5109,7 @@ function collectDeprecationNoticeAndForward(event, onEvent) {
5109
5109
  // package.json with { type: 'json' }
5110
5110
  var package_default = {
5111
5111
  name: "@zapier/zapier-sdk-cli",
5112
- version: "0.65.4"};
5112
+ version: "0.65.7"};
5113
5113
 
5114
5114
  // src/sdk.ts
5115
5115
  var warnedDeprecatedMethods = /* @__PURE__ */ new Set();
@@ -5192,7 +5192,7 @@ function createZapierCliSdk(options = {}) {
5192
5192
 
5193
5193
  // package.json
5194
5194
  var package_default2 = {
5195
- version: "0.65.4"};
5195
+ version: "0.65.7"};
5196
5196
 
5197
5197
  // src/telemetry/builders.ts
5198
5198
  function createCliBaseEvent(context = {}) {
package/dist/index.mjs CHANGED
@@ -5073,7 +5073,7 @@ function collectDeprecationNoticeAndForward(event, onEvent) {
5073
5073
  // package.json with { type: 'json' }
5074
5074
  var package_default = {
5075
5075
  name: "@zapier/zapier-sdk-cli",
5076
- version: "0.65.4"};
5076
+ version: "0.65.7"};
5077
5077
 
5078
5078
  // src/sdk.ts
5079
5079
  var warnedDeprecatedMethods = /* @__PURE__ */ new Set();
@@ -5156,7 +5156,7 @@ function createZapierCliSdk(options = {}) {
5156
5156
 
5157
5157
  // package.json
5158
5158
  var package_default2 = {
5159
- version: "0.65.4"};
5159
+ version: "0.65.7"};
5160
5160
 
5161
5161
  // src/telemetry/builders.ts
5162
5162
  function createCliBaseEvent(context = {}) {