@settlemint/sdk-cli 2.4.0-pr1e769aef → 2.4.0-pr20cda3e8

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.js CHANGED
@@ -161742,7 +161742,7 @@ ${lanes.join(`
161742
161742
  function generateOptionOutput(sys2, option, rightAlignOfLeft, leftAlignOfRight) {
161743
161743
  var _a;
161744
161744
  const text = [];
161745
- const colors3 = createColors(sys2);
161745
+ const colors2 = createColors(sys2);
161746
161746
  const name2 = getDisplayNameTextOfOption(option);
161747
161747
  const valueCandidates = getValueCandidate(option);
161748
161748
  const defaultValueDescription = typeof option.defaultValueDescription === "object" ? getDiagnosticText(option.defaultValueDescription) : formatDefaultValue(option.defaultValueDescription, option.type === "list" || option.type === "listOrElement" ? option.element.type : option.type);
@@ -161763,7 +161763,7 @@ ${lanes.join(`
161763
161763
  }
161764
161764
  text.push(sys2.newLine);
161765
161765
  } else {
161766
- text.push(colors3.blue(name2), sys2.newLine);
161766
+ text.push(colors2.blue(name2), sys2.newLine);
161767
161767
  if (option.description) {
161768
161768
  const description3 = getDiagnosticText(option.description);
161769
161769
  text.push(description3);
@@ -161808,7 +161808,7 @@ ${lanes.join(`
161808
161808
  if (isFirstLine) {
161809
161809
  curLeft = left.padStart(rightAlignOfLeft2);
161810
161810
  curLeft = curLeft.padEnd(leftAlignOfRight2);
161811
- curLeft = colorLeft ? colors3.blue(curLeft) : curLeft;
161811
+ curLeft = colorLeft ? colors2.blue(curLeft) : curLeft;
161812
161812
  } else {
161813
161813
  curLeft = "".padStart(leftAlignOfRight2);
161814
161814
  }
@@ -161920,9 +161920,9 @@ ${lanes.join(`
161920
161920
  return res;
161921
161921
  }
161922
161922
  function printEasyHelp(sys2, simpleOptions) {
161923
- const colors3 = createColors(sys2);
161923
+ const colors2 = createColors(sys2);
161924
161924
  let output = [...getHeader(sys2, `${getDiagnosticText(Diagnostics.tsc_Colon_The_TypeScript_Compiler)} - ${getDiagnosticText(Diagnostics.Version_0, version4)}`)];
161925
- output.push(colors3.bold(getDiagnosticText(Diagnostics.COMMON_COMMANDS)) + sys2.newLine + sys2.newLine);
161925
+ output.push(colors2.bold(getDiagnosticText(Diagnostics.COMMON_COMMANDS)) + sys2.newLine + sys2.newLine);
161926
161926
  example("tsc", Diagnostics.Compiles_the_current_project_tsconfig_json_in_the_working_directory);
161927
161927
  example("tsc app.ts util.ts", Diagnostics.Ignoring_tsconfig_json_compiles_the_specified_files_with_default_compiler_options);
161928
161928
  example("tsc -b", Diagnostics.Build_a_composite_project_in_the_working_directory);
@@ -161943,7 +161943,7 @@ ${lanes.join(`
161943
161943
  function example(ex, desc) {
161944
161944
  const examples = typeof ex === "string" ? [ex] : ex;
161945
161945
  for (const example2 of examples) {
161946
- output.push(" " + colors3.blue(example2) + sys2.newLine);
161946
+ output.push(" " + colors2.blue(example2) + sys2.newLine);
161947
161947
  }
161948
161948
  output.push(" " + getDiagnosticText(desc) + sys2.newLine + sys2.newLine);
161949
161949
  }
@@ -161966,12 +161966,12 @@ ${lanes.join(`
161966
161966
  }
161967
161967
  function getHeader(sys2, message) {
161968
161968
  var _a;
161969
- const colors3 = createColors(sys2);
161969
+ const colors2 = createColors(sys2);
161970
161970
  const header = [];
161971
161971
  const terminalWidth = ((_a = sys2.getWidthOfTerminal) == null ? undefined : _a.call(sys2)) ?? 0;
161972
161972
  const tsIconLength = 5;
161973
- const tsIconFirstLine = colors3.blueBackground("".padStart(tsIconLength));
161974
- const tsIconSecondLine = colors3.blueBackground(colors3.brightWhite("TS ".padStart(tsIconLength)));
161973
+ const tsIconFirstLine = colors2.blueBackground("".padStart(tsIconLength));
161974
+ const tsIconSecondLine = colors2.blueBackground(colors2.brightWhite("TS ".padStart(tsIconLength)));
161975
161975
  if (terminalWidth >= message.length + tsIconLength) {
161976
161976
  const rightAlign = terminalWidth > 120 ? 120 : terminalWidth;
161977
161977
  const leftAlign = rightAlign - tsIconLength;
@@ -263840,7 +263840,7 @@ function pruneCurrentEnv(currentEnv, env2) {
263840
263840
  var package_default = {
263841
263841
  name: "@settlemint/sdk-cli",
263842
263842
  description: "Command-line interface for SettleMint SDK, providing development tools and project management capabilities",
263843
- version: "2.4.0-pr1e769aef",
263843
+ version: "2.4.0-pr20cda3e8",
263844
263844
  type: "module",
263845
263845
  private: false,
263846
263846
  license: "FSL-1.1-MIT",
@@ -263888,12 +263888,12 @@ var package_default = {
263888
263888
  "@commander-js/extra-typings": "14.0.0",
263889
263889
  commander: "14.0.0",
263890
263890
  "@inquirer/confirm": "5.1.12",
263891
- "@inquirer/input": "4.2.0",
263891
+ "@inquirer/input": "4.1.12",
263892
263892
  "@inquirer/password": "4.0.15",
263893
- "@inquirer/select": "4.2.3",
263894
- "@settlemint/sdk-js": "2.4.0-pr1e769aef",
263895
- "@settlemint/sdk-utils": "2.4.0-pr1e769aef",
263896
- "@settlemint/sdk-viem": "2.4.0-pr1e769aef",
263893
+ "@inquirer/select": "4.2.4",
263894
+ "@settlemint/sdk-js": "2.4.0-pr20cda3e8",
263895
+ "@settlemint/sdk-utils": "2.4.0-pr20cda3e8",
263896
+ "@settlemint/sdk-viem": "2.4.0-pr20cda3e8",
263897
263897
  "@types/node": "24.0.8",
263898
263898
  "@types/semver": "7.7.0",
263899
263899
  "@types/which": "3.0.4",
@@ -263983,10 +263983,7 @@ var {
263983
263983
  } = import__.default;
263984
263984
 
263985
263985
  // ../../node_modules/@inquirer/core/dist/esm/lib/key.js
263986
- var isUpKey = (key) => key.name === "up" || key.name === "k" || key.ctrl && key.name === "p";
263987
- var isDownKey = (key) => key.name === "down" || key.name === "j" || key.ctrl && key.name === "n";
263988
263986
  var isBackspaceKey = (key) => key.name === "backspace";
263989
- var isNumberKey = (key) => "1234567890".includes(key.name);
263990
263987
  var isEnterKey = (key) => key.name === "enter" || key.name === "return";
263991
263988
  // ../../node_modules/@inquirer/core/dist/esm/lib/errors.js
263992
263989
  class AbortPromptError extends Error {
@@ -264520,22 +264517,11 @@ function usePrefix({ status = "idle", theme }) {
264520
264517
  const iconName = status === "loading" ? "idle" : status;
264521
264518
  return typeof prefix === "string" ? prefix : prefix[iconName] ?? prefix["idle"];
264522
264519
  }
264523
- // ../../node_modules/@inquirer/core/dist/esm/lib/use-memo.js
264524
- function useMemo(fn, dependencies) {
264525
- return withPointer((pointer) => {
264526
- const prev = pointer.get();
264527
- if (!prev || prev.dependencies.length !== dependencies.length || prev.dependencies.some((dep, i) => dep !== dependencies[i])) {
264528
- const value = fn();
264529
- pointer.set({ value, dependencies });
264530
- return value;
264531
- }
264532
- return prev.value;
264533
- });
264534
- }
264535
264520
  // ../../node_modules/@inquirer/core/dist/esm/lib/use-ref.js
264536
264521
  function useRef(val) {
264537
264522
  return useState({ current: val })[0];
264538
264523
  }
264524
+
264539
264525
  // ../../node_modules/@inquirer/core/dist/esm/lib/use-keypress.js
264540
264526
  function useKeypress(userHandler) {
264541
264527
  const signal = useRef(userHandler);
@@ -264567,72 +264553,6 @@ function readlineWidth() {
264567
264553
  return import_cli_width.default({ defaultWidth: 80, output: readline().output });
264568
264554
  }
264569
264555
 
264570
- // ../../node_modules/@inquirer/core/dist/esm/lib/pagination/use-pagination.js
264571
- function usePointerPosition({ active, renderedItems, pageSize, loop }) {
264572
- const state = useRef({
264573
- lastPointer: active,
264574
- lastActive: undefined
264575
- });
264576
- const { lastPointer, lastActive } = state.current;
264577
- const middle = Math.floor(pageSize / 2);
264578
- const renderedLength = renderedItems.reduce((acc, item) => acc + item.length, 0);
264579
- const defaultPointerPosition = renderedItems.slice(0, active).reduce((acc, item) => acc + item.length, 0);
264580
- let pointer = defaultPointerPosition;
264581
- if (renderedLength > pageSize) {
264582
- if (loop) {
264583
- pointer = lastPointer;
264584
- if (lastActive != null && lastActive < active && active - lastActive < pageSize) {
264585
- pointer = Math.min(middle, Math.abs(active - lastActive) === 1 ? Math.min(lastPointer + (renderedItems[lastActive]?.length ?? 0), Math.max(defaultPointerPosition, lastPointer)) : lastPointer + active - lastActive);
264586
- }
264587
- } else {
264588
- const spaceUnderActive = renderedItems.slice(active).reduce((acc, item) => acc + item.length, 0);
264589
- pointer = spaceUnderActive < pageSize - middle ? pageSize - spaceUnderActive : Math.min(defaultPointerPosition, middle);
264590
- }
264591
- }
264592
- state.current.lastPointer = pointer;
264593
- state.current.lastActive = active;
264594
- return pointer;
264595
- }
264596
- function usePagination({ items, active, renderItem, pageSize, loop = true }) {
264597
- const width = readlineWidth();
264598
- const bound = (num) => (num % items.length + items.length) % items.length;
264599
- const renderedItems = items.map((item, index) => {
264600
- if (item == null)
264601
- return [];
264602
- return breakLines(renderItem({ item, index, isActive: index === active }), width).split(`
264603
- `);
264604
- });
264605
- const renderedLength = renderedItems.reduce((acc, item) => acc + item.length, 0);
264606
- const renderItemAtIndex = (index) => renderedItems[index] ?? [];
264607
- const pointer = usePointerPosition({ active, renderedItems, pageSize, loop });
264608
- const activeItem = renderItemAtIndex(active).slice(0, pageSize);
264609
- const activeItemPosition = pointer + activeItem.length <= pageSize ? pointer : pageSize - activeItem.length;
264610
- const pageBuffer = Array.from({ length: pageSize });
264611
- pageBuffer.splice(activeItemPosition, activeItem.length, ...activeItem);
264612
- const itemVisited = new Set([active]);
264613
- let bufferPointer = activeItemPosition + activeItem.length;
264614
- let itemPointer = bound(active + 1);
264615
- while (bufferPointer < pageSize && !itemVisited.has(itemPointer) && (loop && renderedLength > pageSize ? itemPointer !== active : itemPointer > active)) {
264616
- const lines = renderItemAtIndex(itemPointer);
264617
- const linesToAdd = lines.slice(0, pageSize - bufferPointer);
264618
- pageBuffer.splice(bufferPointer, linesToAdd.length, ...linesToAdd);
264619
- itemVisited.add(itemPointer);
264620
- bufferPointer += linesToAdd.length;
264621
- itemPointer = bound(itemPointer + 1);
264622
- }
264623
- bufferPointer = activeItemPosition - 1;
264624
- itemPointer = bound(active - 1);
264625
- while (bufferPointer >= 0 && !itemVisited.has(itemPointer) && (loop && renderedLength > pageSize ? itemPointer !== active : itemPointer < active)) {
264626
- const lines = renderItemAtIndex(itemPointer);
264627
- const linesToAdd = lines.slice(Math.max(0, lines.length - bufferPointer - 1));
264628
- pageBuffer.splice(bufferPointer - linesToAdd.length + 1, linesToAdd.length, ...linesToAdd);
264629
- itemVisited.add(itemPointer);
264630
- bufferPointer -= linesToAdd.length;
264631
- itemPointer = bound(itemPointer - 1);
264632
- }
264633
- return pageBuffer.filter((line) => typeof line === "string").join(`
264634
- `);
264635
- }
264636
264556
  // ../../node_modules/@inquirer/core/dist/esm/lib/create-prompt.js
264637
264557
  var import_mute_stream = __toESM(require_lib(), 1);
264638
264558
  import * as readline2 from "node:readline";
@@ -265015,20 +264935,6 @@ function createPrompt(view) {
265015
264935
  };
265016
264936
  return prompt;
265017
264937
  }
265018
- // ../../node_modules/@inquirer/core/dist/esm/lib/Separator.js
265019
- var import_yoctocolors_cjs2 = __toESM(require_yoctocolors_cjs(), 1);
265020
- class Separator {
265021
- separator = import_yoctocolors_cjs2.default.dim(Array.from({ length: 15 }).join(esm_default.line));
265022
- type = "separator";
265023
- constructor(separator) {
265024
- if (separator) {
265025
- this.separator = separator;
265026
- }
265027
- }
265028
- static isSeparator(choice) {
265029
- return Boolean(choice && typeof choice === "object" && "type" in choice && choice.type === "separator");
265030
- }
265031
- }
265032
264938
  // ../utils/dist/terminal.js
265033
264939
  import { spawn } from "node:child_process";
265034
264940
  var import_console_table_printer2 = __toESM(require_dist2(), 1);
@@ -303229,10 +303135,97 @@ function sanitizeName(value4, length = 35) {
303229
303135
  }).slice(0, length).replaceAll(/(^\d*)/g, "").replaceAll(/(-$)/g, "").replaceAll(/(^-)/g, "");
303230
303136
  }
303231
303137
 
303232
- // ../../node_modules/@inquirer/input/node_modules/@inquirer/core/dist/esm/lib/key.js
303138
+ // ../../node_modules/@inquirer/input/dist/esm/index.js
303139
+ var inputTheme = {
303140
+ validationFailureMode: "keep"
303141
+ };
303142
+ var esm_default2 = createPrompt((config4, done) => {
303143
+ const { required: required4, validate: validate3 = () => true } = config4;
303144
+ const theme = makeTheme(inputTheme, config4.theme);
303145
+ const [status, setStatus] = useState("idle");
303146
+ const [defaultValue = "", setDefaultValue] = useState(config4.default);
303147
+ const [errorMsg, setError] = useState();
303148
+ const [value4, setValue] = useState("");
303149
+ const prefix = usePrefix({ status, theme });
303150
+ useKeypress(async (key2, rl) => {
303151
+ if (status !== "idle") {
303152
+ return;
303153
+ }
303154
+ if (isEnterKey(key2)) {
303155
+ const answer = value4 || defaultValue;
303156
+ setStatus("loading");
303157
+ const isValid = required4 && !answer ? "You must provide a value" : await validate3(answer);
303158
+ if (isValid === true) {
303159
+ setValue(answer);
303160
+ setStatus("done");
303161
+ done(answer);
303162
+ } else {
303163
+ if (theme.validationFailureMode === "clear") {
303164
+ setValue("");
303165
+ } else {
303166
+ rl.write(value4);
303167
+ }
303168
+ setError(isValid || "You must provide a valid value");
303169
+ setStatus("idle");
303170
+ }
303171
+ } else if (isBackspaceKey(key2) && !value4) {
303172
+ setDefaultValue(undefined);
303173
+ } else if (key2.name === "tab" && !value4) {
303174
+ setDefaultValue(undefined);
303175
+ rl.clearLine(0);
303176
+ rl.write(defaultValue);
303177
+ setValue(defaultValue);
303178
+ } else {
303179
+ setValue(rl.line);
303180
+ setError(undefined);
303181
+ }
303182
+ });
303183
+ const message = theme.style.message(config4.message, status);
303184
+ let formattedValue = value4;
303185
+ if (typeof config4.transformer === "function") {
303186
+ formattedValue = config4.transformer(value4, { isFinal: status === "done" });
303187
+ } else if (status === "done") {
303188
+ formattedValue = theme.style.answer(value4);
303189
+ }
303190
+ let defaultStr;
303191
+ if (defaultValue && status !== "done" && !value4) {
303192
+ defaultStr = theme.style.defaultAnswer(defaultValue);
303193
+ }
303194
+ let error44 = "";
303195
+ if (errorMsg) {
303196
+ error44 = theme.style.error(errorMsg);
303197
+ }
303198
+ return [
303199
+ [prefix, message, defaultStr, formattedValue].filter((v6) => v6 !== undefined).join(" "),
303200
+ error44
303201
+ ];
303202
+ });
303203
+
303204
+ // src/prompts/smart-contract-set/subgraph-name.prompt.ts
303205
+ async function subgraphNamePrompt({
303206
+ defaultName,
303207
+ env: env2,
303208
+ accept
303209
+ }) {
303210
+ const defaultSubgraphName = defaultName ? sanitizeName(defaultName) : undefined;
303211
+ if (accept) {
303212
+ return defaultSubgraphName ?? env2.SETTLEMINT_THEGRAPH_DEFAULT_SUBGRAPH;
303213
+ }
303214
+ const subgraphName = await esm_default2({
303215
+ message: "What is the name of your subgraph?",
303216
+ default: defaultSubgraphName,
303217
+ required: true
303218
+ });
303219
+ return sanitizeName(subgraphName);
303220
+ }
303221
+
303222
+ // ../../node_modules/@inquirer/select/node_modules/@inquirer/core/dist/esm/lib/key.js
303223
+ var isUpKey = (key2) => key2.name === "up" || key2.name === "k" || key2.ctrl && key2.name === "p";
303224
+ var isDownKey = (key2) => key2.name === "down" || key2.name === "j" || key2.ctrl && key2.name === "n";
303233
303225
  var isBackspaceKey2 = (key2) => key2.name === "backspace";
303226
+ var isNumberKey = (key2) => "1234567890".includes(key2.name);
303234
303227
  var isEnterKey2 = (key2) => key2.name === "enter" || key2.name === "return";
303235
- // ../../node_modules/@inquirer/input/node_modules/@inquirer/core/dist/esm/lib/errors.js
303228
+ // ../../node_modules/@inquirer/select/node_modules/@inquirer/core/dist/esm/lib/errors.js
303236
303229
  class AbortPromptError2 extends Error {
303237
303230
  name = "AbortPromptError";
303238
303231
  message = "Prompt was aborted";
@@ -303258,10 +303251,10 @@ class HookError2 extends Error {
303258
303251
  class ValidationError2 extends Error {
303259
303252
  name = "ValidationError";
303260
303253
  }
303261
- // ../../node_modules/@inquirer/input/node_modules/@inquirer/core/dist/esm/lib/use-state.js
303254
+ // ../../node_modules/@inquirer/select/node_modules/@inquirer/core/dist/esm/lib/use-state.js
303262
303255
  import { AsyncResource as AsyncResource5 } from "node:async_hooks";
303263
303256
 
303264
- // ../../node_modules/@inquirer/input/node_modules/@inquirer/core/dist/esm/lib/hook-engine.js
303257
+ // ../../node_modules/@inquirer/select/node_modules/@inquirer/core/dist/esm/lib/hook-engine.js
303265
303258
  import { AsyncLocalStorage as AsyncLocalStorage2, AsyncResource as AsyncResource4 } from "node:async_hooks";
303266
303259
  var hookStorage2 = new AsyncLocalStorage2;
303267
303260
  function createStore2(rl) {
@@ -303366,7 +303359,7 @@ var effectScheduler2 = {
303366
303359
  }
303367
303360
  };
303368
303361
 
303369
- // ../../node_modules/@inquirer/input/node_modules/@inquirer/core/dist/esm/lib/use-state.js
303362
+ // ../../node_modules/@inquirer/select/node_modules/@inquirer/core/dist/esm/lib/use-state.js
303370
303363
  function useState2(defaultValue) {
303371
303364
  return withPointer2((pointer) => {
303372
303365
  const setState = AsyncResource5.bind(function setState(newValue) {
@@ -303384,7 +303377,7 @@ function useState2(defaultValue) {
303384
303377
  });
303385
303378
  }
303386
303379
 
303387
- // ../../node_modules/@inquirer/input/node_modules/@inquirer/core/dist/esm/lib/use-effect.js
303380
+ // ../../node_modules/@inquirer/select/node_modules/@inquirer/core/dist/esm/lib/use-effect.js
303388
303381
  function useEffect2(cb, depArray) {
303389
303382
  withPointer2((pointer) => {
303390
303383
  const oldDeps = pointer.get();
@@ -303396,29 +303389,29 @@ function useEffect2(cb, depArray) {
303396
303389
  });
303397
303390
  }
303398
303391
 
303399
- // ../../node_modules/@inquirer/input/node_modules/@inquirer/core/dist/esm/lib/theme.js
303400
- var import_yoctocolors_cjs3 = __toESM(require_yoctocolors_cjs(), 1);
303392
+ // ../../node_modules/@inquirer/select/node_modules/@inquirer/core/dist/esm/lib/theme.js
303393
+ var import_yoctocolors_cjs2 = __toESM(require_yoctocolors_cjs(), 1);
303401
303394
  var defaultTheme2 = {
303402
303395
  prefix: {
303403
- idle: import_yoctocolors_cjs3.default.blue("?"),
303404
- done: import_yoctocolors_cjs3.default.green(esm_default.tick)
303396
+ idle: import_yoctocolors_cjs2.default.blue("?"),
303397
+ done: import_yoctocolors_cjs2.default.green(esm_default.tick)
303405
303398
  },
303406
303399
  spinner: {
303407
303400
  interval: 80,
303408
- frames: ["⠋", "⠙", "⠹", "⠸", "⠼", "⠴", "⠦", "⠧", "⠇", "⠏"].map((frame) => import_yoctocolors_cjs3.default.yellow(frame))
303401
+ frames: ["⠋", "⠙", "⠹", "⠸", "⠼", "⠴", "⠦", "⠧", "⠇", "⠏"].map((frame) => import_yoctocolors_cjs2.default.yellow(frame))
303409
303402
  },
303410
303403
  style: {
303411
- answer: import_yoctocolors_cjs3.default.cyan,
303412
- message: import_yoctocolors_cjs3.default.bold,
303413
- error: (text2) => import_yoctocolors_cjs3.default.red(`> ${text2}`),
303414
- defaultAnswer: (text2) => import_yoctocolors_cjs3.default.dim(`(${text2})`),
303415
- help: import_yoctocolors_cjs3.default.dim,
303416
- highlight: import_yoctocolors_cjs3.default.cyan,
303417
- key: (text2) => import_yoctocolors_cjs3.default.cyan(import_yoctocolors_cjs3.default.bold(`<${text2}>`))
303404
+ answer: import_yoctocolors_cjs2.default.cyan,
303405
+ message: import_yoctocolors_cjs2.default.bold,
303406
+ error: (text2) => import_yoctocolors_cjs2.default.red(`> ${text2}`),
303407
+ defaultAnswer: (text2) => import_yoctocolors_cjs2.default.dim(`(${text2})`),
303408
+ help: import_yoctocolors_cjs2.default.dim,
303409
+ highlight: import_yoctocolors_cjs2.default.cyan,
303410
+ key: (text2) => import_yoctocolors_cjs2.default.cyan(import_yoctocolors_cjs2.default.bold(`<${text2}>`))
303418
303411
  }
303419
303412
  };
303420
303413
 
303421
- // ../../node_modules/@inquirer/input/node_modules/@inquirer/core/dist/esm/lib/make-theme.js
303414
+ // ../../node_modules/@inquirer/select/node_modules/@inquirer/core/dist/esm/lib/make-theme.js
303422
303415
  function isPlainObject6(value4) {
303423
303416
  if (typeof value4 !== "object" || value4 === null)
303424
303417
  return false;
@@ -303446,7 +303439,7 @@ function makeTheme2(...themes) {
303446
303439
  return deepMerge3(...themesToMerge);
303447
303440
  }
303448
303441
 
303449
- // ../../node_modules/@inquirer/input/node_modules/@inquirer/core/dist/esm/lib/use-prefix.js
303442
+ // ../../node_modules/@inquirer/select/node_modules/@inquirer/core/dist/esm/lib/use-prefix.js
303450
303443
  function usePrefix2({ status = "idle", theme }) {
303451
303444
  const [showLoader, setShowLoader] = useState2(false);
303452
303445
  const [tick, setTick] = useState2(0);
@@ -303476,12 +303469,23 @@ function usePrefix2({ status = "idle", theme }) {
303476
303469
  const iconName = status === "loading" ? "idle" : status;
303477
303470
  return typeof prefix === "string" ? prefix : prefix[iconName] ?? prefix["idle"];
303478
303471
  }
303479
- // ../../node_modules/@inquirer/input/node_modules/@inquirer/core/dist/esm/lib/use-ref.js
303472
+ // ../../node_modules/@inquirer/select/node_modules/@inquirer/core/dist/esm/lib/use-memo.js
303473
+ function useMemo(fn, dependencies) {
303474
+ return withPointer2((pointer) => {
303475
+ const prev = pointer.get();
303476
+ if (!prev || prev.dependencies.length !== dependencies.length || prev.dependencies.some((dep, i6) => dep !== dependencies[i6])) {
303477
+ const value4 = fn();
303478
+ pointer.set({ value: value4, dependencies });
303479
+ return value4;
303480
+ }
303481
+ return prev.value;
303482
+ });
303483
+ }
303484
+ // ../../node_modules/@inquirer/select/node_modules/@inquirer/core/dist/esm/lib/use-ref.js
303480
303485
  function useRef2(val) {
303481
303486
  return useState2({ current: val })[0];
303482
303487
  }
303483
-
303484
- // ../../node_modules/@inquirer/input/node_modules/@inquirer/core/dist/esm/lib/use-keypress.js
303488
+ // ../../node_modules/@inquirer/select/node_modules/@inquirer/core/dist/esm/lib/use-keypress.js
303485
303489
  function useKeypress2(userHandler) {
303486
303490
  const signal = useRef2(userHandler);
303487
303491
  signal.current = userHandler;
@@ -303499,7 +303503,7 @@ function useKeypress2(userHandler) {
303499
303503
  };
303500
303504
  }, []);
303501
303505
  }
303502
- // ../../node_modules/@inquirer/input/node_modules/@inquirer/core/dist/esm/lib/utils.js
303506
+ // ../../node_modules/@inquirer/select/node_modules/@inquirer/core/dist/esm/lib/utils.js
303503
303507
  var import_cli_width2 = __toESM(require_cli_width(), 1);
303504
303508
  var import_wrap_ansi2 = __toESM(require_wrap_ansi(), 1);
303505
303509
  function breakLines2(content, width) {
@@ -303512,12 +303516,78 @@ function readlineWidth2() {
303512
303516
  return import_cli_width2.default({ defaultWidth: 80, output: readline3().output });
303513
303517
  }
303514
303518
 
303515
- // ../../node_modules/@inquirer/input/node_modules/@inquirer/core/dist/esm/lib/create-prompt.js
303519
+ // ../../node_modules/@inquirer/select/node_modules/@inquirer/core/dist/esm/lib/pagination/use-pagination.js
303520
+ function usePointerPosition({ active, renderedItems, pageSize, loop }) {
303521
+ const state = useRef2({
303522
+ lastPointer: active,
303523
+ lastActive: undefined
303524
+ });
303525
+ const { lastPointer, lastActive } = state.current;
303526
+ const middle = Math.floor(pageSize / 2);
303527
+ const renderedLength = renderedItems.reduce((acc, item) => acc + item.length, 0);
303528
+ const defaultPointerPosition = renderedItems.slice(0, active).reduce((acc, item) => acc + item.length, 0);
303529
+ let pointer = defaultPointerPosition;
303530
+ if (renderedLength > pageSize) {
303531
+ if (loop) {
303532
+ pointer = lastPointer;
303533
+ if (lastActive != null && lastActive < active && active - lastActive < pageSize) {
303534
+ pointer = Math.min(middle, Math.abs(active - lastActive) === 1 ? Math.min(lastPointer + (renderedItems[lastActive]?.length ?? 0), Math.max(defaultPointerPosition, lastPointer)) : lastPointer + active - lastActive);
303535
+ }
303536
+ } else {
303537
+ const spaceUnderActive = renderedItems.slice(active).reduce((acc, item) => acc + item.length, 0);
303538
+ pointer = spaceUnderActive < pageSize - middle ? pageSize - spaceUnderActive : Math.min(defaultPointerPosition, middle);
303539
+ }
303540
+ }
303541
+ state.current.lastPointer = pointer;
303542
+ state.current.lastActive = active;
303543
+ return pointer;
303544
+ }
303545
+ function usePagination({ items, active, renderItem, pageSize, loop = true }) {
303546
+ const width = readlineWidth2();
303547
+ const bound = (num) => (num % items.length + items.length) % items.length;
303548
+ const renderedItems = items.map((item, index) => {
303549
+ if (item == null)
303550
+ return [];
303551
+ return breakLines2(renderItem({ item, index, isActive: index === active }), width).split(`
303552
+ `);
303553
+ });
303554
+ const renderedLength = renderedItems.reduce((acc, item) => acc + item.length, 0);
303555
+ const renderItemAtIndex = (index) => renderedItems[index] ?? [];
303556
+ const pointer = usePointerPosition({ active, renderedItems, pageSize, loop });
303557
+ const activeItem = renderItemAtIndex(active).slice(0, pageSize);
303558
+ const activeItemPosition = pointer + activeItem.length <= pageSize ? pointer : pageSize - activeItem.length;
303559
+ const pageBuffer = Array.from({ length: pageSize });
303560
+ pageBuffer.splice(activeItemPosition, activeItem.length, ...activeItem);
303561
+ const itemVisited = new Set([active]);
303562
+ let bufferPointer = activeItemPosition + activeItem.length;
303563
+ let itemPointer = bound(active + 1);
303564
+ while (bufferPointer < pageSize && !itemVisited.has(itemPointer) && (loop && renderedLength > pageSize ? itemPointer !== active : itemPointer > active)) {
303565
+ const lines = renderItemAtIndex(itemPointer);
303566
+ const linesToAdd = lines.slice(0, pageSize - bufferPointer);
303567
+ pageBuffer.splice(bufferPointer, linesToAdd.length, ...linesToAdd);
303568
+ itemVisited.add(itemPointer);
303569
+ bufferPointer += linesToAdd.length;
303570
+ itemPointer = bound(itemPointer + 1);
303571
+ }
303572
+ bufferPointer = activeItemPosition - 1;
303573
+ itemPointer = bound(active - 1);
303574
+ while (bufferPointer >= 0 && !itemVisited.has(itemPointer) && (loop && renderedLength > pageSize ? itemPointer !== active : itemPointer < active)) {
303575
+ const lines = renderItemAtIndex(itemPointer);
303576
+ const linesToAdd = lines.slice(Math.max(0, lines.length - bufferPointer - 1));
303577
+ pageBuffer.splice(bufferPointer - linesToAdd.length + 1, linesToAdd.length, ...linesToAdd);
303578
+ itemVisited.add(itemPointer);
303579
+ bufferPointer -= linesToAdd.length;
303580
+ itemPointer = bound(itemPointer - 1);
303581
+ }
303582
+ return pageBuffer.filter((line) => typeof line === "string").join(`
303583
+ `);
303584
+ }
303585
+ // ../../node_modules/@inquirer/select/node_modules/@inquirer/core/dist/esm/lib/create-prompt.js
303516
303586
  var import_mute_stream2 = __toESM(require_lib(), 1);
303517
303587
  import * as readline4 from "node:readline";
303518
303588
  import { AsyncResource as AsyncResource6 } from "node:async_hooks";
303519
303589
 
303520
- // ../../node_modules/@inquirer/input/node_modules/@inquirer/core/dist/esm/lib/screen-manager.js
303590
+ // ../../node_modules/@inquirer/select/node_modules/@inquirer/core/dist/esm/lib/screen-manager.js
303521
303591
  var import_ansi_escapes2 = __toESM(require_ansi_escapes(), 1);
303522
303592
  import { stripVTControlCharacters as stripVTControlCharacters3 } from "node:util";
303523
303593
  var height2 = (content) => content.split(`
@@ -303587,7 +303657,7 @@ class ScreenManager2 {
303587
303657
  }
303588
303658
  }
303589
303659
 
303590
- // ../../node_modules/@inquirer/input/node_modules/@inquirer/core/dist/esm/lib/promise-polyfill.js
303660
+ // ../../node_modules/@inquirer/select/node_modules/@inquirer/core/dist/esm/lib/promise-polyfill.js
303591
303661
  class PromisePolyfill2 extends Promise {
303592
303662
  static withResolver() {
303593
303663
  let resolve5;
@@ -303600,7 +303670,7 @@ class PromisePolyfill2 extends Promise {
303600
303670
  }
303601
303671
  }
303602
303672
 
303603
- // ../../node_modules/@inquirer/input/node_modules/@inquirer/core/dist/esm/lib/create-prompt.js
303673
+ // ../../node_modules/@inquirer/select/node_modules/@inquirer/core/dist/esm/lib/create-prompt.js
303604
303674
  function getCallSites2() {
303605
303675
  const _prepareStackTrace = Error.prepareStackTrace;
303606
303676
  let result = [];
@@ -303686,96 +303756,20 @@ function createPrompt2(view) {
303686
303756
  };
303687
303757
  return prompt;
303688
303758
  }
303689
- // ../../node_modules/@inquirer/input/dist/esm/index.js
303690
- var inputTheme = {
303691
- validationFailureMode: "keep"
303692
- };
303693
- var esm_default2 = createPrompt2((config4, done) => {
303694
- const { required: required4, validate: validate3 = () => true, prefill = "tab" } = config4;
303695
- const theme = makeTheme2(inputTheme, config4.theme);
303696
- const [status, setStatus] = useState2("idle");
303697
- const [defaultValue = "", setDefaultValue] = useState2(config4.default);
303698
- const [errorMsg, setError] = useState2();
303699
- const [value4, setValue] = useState2("");
303700
- const prefix = usePrefix2({ status, theme });
303701
- useKeypress2(async (key3, rl) => {
303702
- if (status !== "idle") {
303703
- return;
303704
- }
303705
- if (isEnterKey2(key3)) {
303706
- const answer = value4 || defaultValue;
303707
- setStatus("loading");
303708
- const isValid = required4 && !answer ? "You must provide a value" : await validate3(answer);
303709
- if (isValid === true) {
303710
- setValue(answer);
303711
- setStatus("done");
303712
- done(answer);
303713
- } else {
303714
- if (theme.validationFailureMode === "clear") {
303715
- setValue("");
303716
- } else {
303717
- rl.write(value4);
303718
- }
303719
- setError(isValid || "You must provide a valid value");
303720
- setStatus("idle");
303721
- }
303722
- } else if (isBackspaceKey2(key3) && !value4) {
303723
- setDefaultValue(undefined);
303724
- } else if (key3.name === "tab" && !value4) {
303725
- setDefaultValue(undefined);
303726
- rl.clearLine(0);
303727
- rl.write(defaultValue);
303728
- setValue(defaultValue);
303729
- } else {
303730
- setValue(rl.line);
303731
- setError(undefined);
303732
- }
303733
- });
303734
- useEffect2((rl) => {
303735
- if (prefill === "editable" && defaultValue) {
303736
- rl.write(defaultValue);
303737
- setValue(defaultValue);
303759
+ // ../../node_modules/@inquirer/select/node_modules/@inquirer/core/dist/esm/lib/Separator.js
303760
+ var import_yoctocolors_cjs3 = __toESM(require_yoctocolors_cjs(), 1);
303761
+ class Separator {
303762
+ separator = import_yoctocolors_cjs3.default.dim(Array.from({ length: 15 }).join(esm_default.line));
303763
+ type = "separator";
303764
+ constructor(separator) {
303765
+ if (separator) {
303766
+ this.separator = separator;
303738
303767
  }
303739
- }, []);
303740
- const message = theme.style.message(config4.message, status);
303741
- let formattedValue = value4;
303742
- if (typeof config4.transformer === "function") {
303743
- formattedValue = config4.transformer(value4, { isFinal: status === "done" });
303744
- } else if (status === "done") {
303745
- formattedValue = theme.style.answer(value4);
303746
- }
303747
- let defaultStr;
303748
- if (defaultValue && status !== "done" && !value4) {
303749
- defaultStr = theme.style.defaultAnswer(defaultValue);
303750
303768
  }
303751
- let error44 = "";
303752
- if (errorMsg) {
303753
- error44 = theme.style.error(errorMsg);
303754
- }
303755
- return [
303756
- [prefix, message, defaultStr, formattedValue].filter((v6) => v6 !== undefined).join(" "),
303757
- error44
303758
- ];
303759
- });
303760
-
303761
- // src/prompts/smart-contract-set/subgraph-name.prompt.ts
303762
- async function subgraphNamePrompt({
303763
- defaultName,
303764
- env: env2,
303765
- accept
303766
- }) {
303767
- const defaultSubgraphName = defaultName ? sanitizeName(defaultName) : undefined;
303768
- if (accept) {
303769
- return defaultSubgraphName ?? env2.SETTLEMINT_THEGRAPH_DEFAULT_SUBGRAPH;
303769
+ static isSeparator(choice) {
303770
+ return Boolean(choice && typeof choice === "object" && "type" in choice && choice.type === "separator");
303770
303771
  }
303771
- const subgraphName = await esm_default2({
303772
- message: "What is the name of your subgraph?",
303773
- default: defaultSubgraphName,
303774
- required: true
303775
- });
303776
- return sanitizeName(subgraphName);
303777
303772
  }
303778
-
303779
303773
  // ../../node_modules/@inquirer/select/dist/esm/index.js
303780
303774
  var import_yoctocolors_cjs4 = __toESM(require_yoctocolors_cjs(), 1);
303781
303775
  var import_ansi_escapes3 = __toESM(require_ansi_escapes(), 1);
@@ -303816,19 +303810,19 @@ function normalizeChoices(choices) {
303816
303810
  return normalizedChoice;
303817
303811
  });
303818
303812
  }
303819
- var esm_default3 = createPrompt((config4, done) => {
303813
+ var esm_default3 = createPrompt2((config4, done) => {
303820
303814
  const { loop = true, pageSize = 7 } = config4;
303821
- const firstRender = useRef(true);
303822
- const theme = makeTheme(selectTheme, config4.theme);
303823
- const [status, setStatus] = useState("idle");
303824
- const prefix = usePrefix({ status, theme });
303825
- const searchTimeoutRef = useRef();
303815
+ const firstRender = useRef2(true);
303816
+ const theme = makeTheme2(selectTheme, config4.theme);
303817
+ const [status, setStatus] = useState2("idle");
303818
+ const prefix = usePrefix2({ status, theme });
303819
+ const searchTimeoutRef = useRef2();
303826
303820
  const items = useMemo(() => normalizeChoices(config4.choices), [config4.choices]);
303827
303821
  const bounds = useMemo(() => {
303828
303822
  const first = items.findIndex(isSelectable);
303829
303823
  const last = items.findLastIndex(isSelectable);
303830
303824
  if (first === -1) {
303831
- throw new ValidationError("[select prompt] No selectable choices. All choices are disabled.");
303825
+ throw new ValidationError2("[select prompt] No selectable choices. All choices are disabled.");
303832
303826
  }
303833
303827
  return { first, last };
303834
303828
  }, [items]);
@@ -303837,11 +303831,11 @@ var esm_default3 = createPrompt((config4, done) => {
303837
303831
  return -1;
303838
303832
  return items.findIndex((item) => isSelectable(item) && item.value === config4.default);
303839
303833
  }, [config4.default, items]);
303840
- const [active, setActive] = useState(defaultItemIndex === -1 ? bounds.first : defaultItemIndex);
303834
+ const [active, setActive] = useState2(defaultItemIndex === -1 ? bounds.first : defaultItemIndex);
303841
303835
  const selectedChoice = items[active];
303842
- useKeypress((key3, rl) => {
303836
+ useKeypress2((key3, rl) => {
303843
303837
  clearTimeout(searchTimeoutRef.current);
303844
- if (isEnterKey(key3)) {
303838
+ if (isEnterKey2(key3)) {
303845
303839
  setStatus("done");
303846
303840
  done(selectedChoice.value);
303847
303841
  } else if (isUpKey(key3) || isDownKey(key3)) {
@@ -303863,7 +303857,7 @@ var esm_default3 = createPrompt((config4, done) => {
303863
303857
  searchTimeoutRef.current = setTimeout(() => {
303864
303858
  rl.clearLine(0);
303865
303859
  }, 700);
303866
- } else if (isBackspaceKey(key3)) {
303860
+ } else if (isBackspaceKey2(key3)) {
303867
303861
  rl.clearLine(0);
303868
303862
  } else {
303869
303863
  const searchTerm = rl.line.toLowerCase();
@@ -303880,7 +303874,7 @@ var esm_default3 = createPrompt((config4, done) => {
303880
303874
  }, 700);
303881
303875
  }
303882
303876
  });
303883
- useEffect(() => () => {
303877
+ useEffect2(() => () => {
303884
303878
  clearTimeout(searchTimeoutRef.current);
303885
303879
  }, []);
303886
303880
  const message = theme.style.message(config4.message, status);
@@ -331243,4 +331237,4 @@ async function sdkCliCommand(argv = process.argv) {
331243
331237
  // src/cli.ts
331244
331238
  sdkCliCommand();
331245
331239
 
331246
- //# debugId=F7BC0E9C6EFE079A64756E2164756E21
331240
+ //# debugId=C73F266AF9043A0B64756E2164756E21