@settlemint/sdk-cli 2.6.0-pr97c0cff8 → 2.6.0-pre8a95765
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 +224 -225
- package/dist/cli.js.map +8 -8
- package/package.json +8 -8
package/dist/cli.js
CHANGED
@@ -159681,7 +159681,7 @@ ${lanes.join(`
|
|
159681
159681
|
function generateOptionOutput(sys2, option, rightAlignOfLeft, leftAlignOfRight) {
|
159682
159682
|
var _a;
|
159683
159683
|
const text = [];
|
159684
|
-
const
|
159684
|
+
const colors2 = createColors(sys2);
|
159685
159685
|
const name2 = getDisplayNameTextOfOption(option);
|
159686
159686
|
const valueCandidates = getValueCandidate(option);
|
159687
159687
|
const defaultValueDescription = typeof option.defaultValueDescription === "object" ? getDiagnosticText(option.defaultValueDescription) : formatDefaultValue(option.defaultValueDescription, option.type === "list" || option.type === "listOrElement" ? option.element.type : option.type);
|
@@ -159702,7 +159702,7 @@ ${lanes.join(`
|
|
159702
159702
|
}
|
159703
159703
|
text.push(sys2.newLine);
|
159704
159704
|
} else {
|
159705
|
-
text.push(
|
159705
|
+
text.push(colors2.blue(name2), sys2.newLine);
|
159706
159706
|
if (option.description) {
|
159707
159707
|
const description3 = getDiagnosticText(option.description);
|
159708
159708
|
text.push(description3);
|
@@ -159747,7 +159747,7 @@ ${lanes.join(`
|
|
159747
159747
|
if (isFirstLine) {
|
159748
159748
|
curLeft = left.padStart(rightAlignOfLeft2);
|
159749
159749
|
curLeft = curLeft.padEnd(leftAlignOfRight2);
|
159750
|
-
curLeft = colorLeft ?
|
159750
|
+
curLeft = colorLeft ? colors2.blue(curLeft) : curLeft;
|
159751
159751
|
} else {
|
159752
159752
|
curLeft = "".padStart(leftAlignOfRight2);
|
159753
159753
|
}
|
@@ -159859,9 +159859,9 @@ ${lanes.join(`
|
|
159859
159859
|
return res;
|
159860
159860
|
}
|
159861
159861
|
function printEasyHelp(sys2, simpleOptions) {
|
159862
|
-
const
|
159862
|
+
const colors2 = createColors(sys2);
|
159863
159863
|
let output = [...getHeader(sys2, `${getDiagnosticText(Diagnostics.tsc_Colon_The_TypeScript_Compiler)} - ${getDiagnosticText(Diagnostics.Version_0, version2)}`)];
|
159864
|
-
output.push(
|
159864
|
+
output.push(colors2.bold(getDiagnosticText(Diagnostics.COMMON_COMMANDS)) + sys2.newLine + sys2.newLine);
|
159865
159865
|
example("tsc", Diagnostics.Compiles_the_current_project_tsconfig_json_in_the_working_directory);
|
159866
159866
|
example("tsc app.ts util.ts", Diagnostics.Ignoring_tsconfig_json_compiles_the_specified_files_with_default_compiler_options);
|
159867
159867
|
example("tsc -b", Diagnostics.Build_a_composite_project_in_the_working_directory);
|
@@ -159882,7 +159882,7 @@ ${lanes.join(`
|
|
159882
159882
|
function example(ex, desc) {
|
159883
159883
|
const examples = typeof ex === "string" ? [ex] : ex;
|
159884
159884
|
for (const example2 of examples) {
|
159885
|
-
output.push(" " +
|
159885
|
+
output.push(" " + colors2.blue(example2) + sys2.newLine);
|
159886
159886
|
}
|
159887
159887
|
output.push(" " + getDiagnosticText(desc) + sys2.newLine + sys2.newLine);
|
159888
159888
|
}
|
@@ -159905,12 +159905,12 @@ ${lanes.join(`
|
|
159905
159905
|
}
|
159906
159906
|
function getHeader(sys2, message) {
|
159907
159907
|
var _a;
|
159908
|
-
const
|
159908
|
+
const colors2 = createColors(sys2);
|
159909
159909
|
const header = [];
|
159910
159910
|
const terminalWidth = ((_a = sys2.getWidthOfTerminal) == null ? undefined : _a.call(sys2)) ?? 0;
|
159911
159911
|
const tsIconLength = 5;
|
159912
|
-
const tsIconFirstLine =
|
159913
|
-
const tsIconSecondLine =
|
159912
|
+
const tsIconFirstLine = colors2.blueBackground("".padStart(tsIconLength));
|
159913
|
+
const tsIconSecondLine = colors2.blueBackground(colors2.brightWhite("TS ".padStart(tsIconLength)));
|
159914
159914
|
if (terminalWidth >= message.length + tsIconLength) {
|
159915
159915
|
const rightAlign = terminalWidth > 120 ? 120 : terminalWidth;
|
159916
159916
|
const leftAlign = rightAlign - tsIconLength;
|
@@ -245587,10 +245587,7 @@ var {
|
|
245587
245587
|
} = import__.default;
|
245588
245588
|
|
245589
245589
|
// ../../node_modules/.bun/@inquirer+core@10.1.15+be14e1ce904ed1ef/node_modules/@inquirer/core/dist/esm/lib/key.js
|
245590
|
-
var isUpKey = (key) => key.name === "up" || key.name === "k" || key.ctrl && key.name === "p";
|
245591
|
-
var isDownKey = (key) => key.name === "down" || key.name === "j" || key.ctrl && key.name === "n";
|
245592
245590
|
var isBackspaceKey = (key) => key.name === "backspace";
|
245593
|
-
var isNumberKey = (key) => "1234567890".includes(key.name);
|
245594
245591
|
var isEnterKey = (key) => key.name === "enter" || key.name === "return";
|
245595
245592
|
// ../../node_modules/.bun/@inquirer+core@10.1.15+be14e1ce904ed1ef/node_modules/@inquirer/core/dist/esm/lib/errors.js
|
245596
245593
|
class AbortPromptError extends Error {
|
@@ -246124,22 +246121,11 @@ function usePrefix({ status = "idle", theme }) {
|
|
246124
246121
|
const iconName = status === "loading" ? "idle" : status;
|
246125
246122
|
return typeof prefix === "string" ? prefix : prefix[iconName] ?? prefix["idle"];
|
246126
246123
|
}
|
246127
|
-
// ../../node_modules/.bun/@inquirer+core@10.1.15+be14e1ce904ed1ef/node_modules/@inquirer/core/dist/esm/lib/use-memo.js
|
246128
|
-
function useMemo(fn, dependencies) {
|
246129
|
-
return withPointer((pointer) => {
|
246130
|
-
const prev = pointer.get();
|
246131
|
-
if (!prev || prev.dependencies.length !== dependencies.length || prev.dependencies.some((dep, i) => dep !== dependencies[i])) {
|
246132
|
-
const value = fn();
|
246133
|
-
pointer.set({ value, dependencies });
|
246134
|
-
return value;
|
246135
|
-
}
|
246136
|
-
return prev.value;
|
246137
|
-
});
|
246138
|
-
}
|
246139
246124
|
// ../../node_modules/.bun/@inquirer+core@10.1.15+be14e1ce904ed1ef/node_modules/@inquirer/core/dist/esm/lib/use-ref.js
|
246140
246125
|
function useRef(val) {
|
246141
246126
|
return useState({ current: val })[0];
|
246142
246127
|
}
|
246128
|
+
|
246143
246129
|
// ../../node_modules/.bun/@inquirer+core@10.1.15+be14e1ce904ed1ef/node_modules/@inquirer/core/dist/esm/lib/use-keypress.js
|
246144
246130
|
function useKeypress(userHandler) {
|
246145
246131
|
const signal = useRef(userHandler);
|
@@ -246171,72 +246157,6 @@ function readlineWidth() {
|
|
246171
246157
|
return import_cli_width.default({ defaultWidth: 80, output: readline().output });
|
246172
246158
|
}
|
246173
246159
|
|
246174
|
-
// ../../node_modules/.bun/@inquirer+core@10.1.15+be14e1ce904ed1ef/node_modules/@inquirer/core/dist/esm/lib/pagination/use-pagination.js
|
246175
|
-
function usePointerPosition({ active, renderedItems, pageSize, loop }) {
|
246176
|
-
const state = useRef({
|
246177
|
-
lastPointer: active,
|
246178
|
-
lastActive: undefined
|
246179
|
-
});
|
246180
|
-
const { lastPointer, lastActive } = state.current;
|
246181
|
-
const middle = Math.floor(pageSize / 2);
|
246182
|
-
const renderedLength = renderedItems.reduce((acc, item) => acc + item.length, 0);
|
246183
|
-
const defaultPointerPosition = renderedItems.slice(0, active).reduce((acc, item) => acc + item.length, 0);
|
246184
|
-
let pointer = defaultPointerPosition;
|
246185
|
-
if (renderedLength > pageSize) {
|
246186
|
-
if (loop) {
|
246187
|
-
pointer = lastPointer;
|
246188
|
-
if (lastActive != null && lastActive < active && active - lastActive < pageSize) {
|
246189
|
-
pointer = Math.min(middle, Math.abs(active - lastActive) === 1 ? Math.min(lastPointer + (renderedItems[lastActive]?.length ?? 0), Math.max(defaultPointerPosition, lastPointer)) : lastPointer + active - lastActive);
|
246190
|
-
}
|
246191
|
-
} else {
|
246192
|
-
const spaceUnderActive = renderedItems.slice(active).reduce((acc, item) => acc + item.length, 0);
|
246193
|
-
pointer = spaceUnderActive < pageSize - middle ? pageSize - spaceUnderActive : Math.min(defaultPointerPosition, middle);
|
246194
|
-
}
|
246195
|
-
}
|
246196
|
-
state.current.lastPointer = pointer;
|
246197
|
-
state.current.lastActive = active;
|
246198
|
-
return pointer;
|
246199
|
-
}
|
246200
|
-
function usePagination({ items, active, renderItem, pageSize, loop = true }) {
|
246201
|
-
const width = readlineWidth();
|
246202
|
-
const bound = (num) => (num % items.length + items.length) % items.length;
|
246203
|
-
const renderedItems = items.map((item, index) => {
|
246204
|
-
if (item == null)
|
246205
|
-
return [];
|
246206
|
-
return breakLines(renderItem({ item, index, isActive: index === active }), width).split(`
|
246207
|
-
`);
|
246208
|
-
});
|
246209
|
-
const renderedLength = renderedItems.reduce((acc, item) => acc + item.length, 0);
|
246210
|
-
const renderItemAtIndex = (index) => renderedItems[index] ?? [];
|
246211
|
-
const pointer = usePointerPosition({ active, renderedItems, pageSize, loop });
|
246212
|
-
const activeItem = renderItemAtIndex(active).slice(0, pageSize);
|
246213
|
-
const activeItemPosition = pointer + activeItem.length <= pageSize ? pointer : pageSize - activeItem.length;
|
246214
|
-
const pageBuffer = Array.from({ length: pageSize });
|
246215
|
-
pageBuffer.splice(activeItemPosition, activeItem.length, ...activeItem);
|
246216
|
-
const itemVisited = new Set([active]);
|
246217
|
-
let bufferPointer = activeItemPosition + activeItem.length;
|
246218
|
-
let itemPointer = bound(active + 1);
|
246219
|
-
while (bufferPointer < pageSize && !itemVisited.has(itemPointer) && (loop && renderedLength > pageSize ? itemPointer !== active : itemPointer > active)) {
|
246220
|
-
const lines = renderItemAtIndex(itemPointer);
|
246221
|
-
const linesToAdd = lines.slice(0, pageSize - bufferPointer);
|
246222
|
-
pageBuffer.splice(bufferPointer, linesToAdd.length, ...linesToAdd);
|
246223
|
-
itemVisited.add(itemPointer);
|
246224
|
-
bufferPointer += linesToAdd.length;
|
246225
|
-
itemPointer = bound(itemPointer + 1);
|
246226
|
-
}
|
246227
|
-
bufferPointer = activeItemPosition - 1;
|
246228
|
-
itemPointer = bound(active - 1);
|
246229
|
-
while (bufferPointer >= 0 && !itemVisited.has(itemPointer) && (loop && renderedLength > pageSize ? itemPointer !== active : itemPointer < active)) {
|
246230
|
-
const lines = renderItemAtIndex(itemPointer);
|
246231
|
-
const linesToAdd = lines.slice(Math.max(0, lines.length - bufferPointer - 1));
|
246232
|
-
pageBuffer.splice(bufferPointer - linesToAdd.length + 1, linesToAdd.length, ...linesToAdd);
|
246233
|
-
itemVisited.add(itemPointer);
|
246234
|
-
bufferPointer -= linesToAdd.length;
|
246235
|
-
itemPointer = bound(itemPointer - 1);
|
246236
|
-
}
|
246237
|
-
return pageBuffer.filter((line) => typeof line === "string").join(`
|
246238
|
-
`);
|
246239
|
-
}
|
246240
246160
|
// ../../node_modules/.bun/@inquirer+core@10.1.15+be14e1ce904ed1ef/node_modules/@inquirer/core/dist/esm/lib/create-prompt.js
|
246241
246161
|
var import_mute_stream = __toESM(require_lib(), 1);
|
246242
246162
|
import * as readline2 from "node:readline";
|
@@ -246619,20 +246539,6 @@ function createPrompt(view) {
|
|
246619
246539
|
};
|
246620
246540
|
return prompt;
|
246621
246541
|
}
|
246622
|
-
// ../../node_modules/.bun/@inquirer+core@10.1.15+be14e1ce904ed1ef/node_modules/@inquirer/core/dist/esm/lib/Separator.js
|
246623
|
-
var import_yoctocolors_cjs2 = __toESM(require_yoctocolors_cjs(), 1);
|
246624
|
-
class Separator {
|
246625
|
-
separator = import_yoctocolors_cjs2.default.dim(Array.from({ length: 15 }).join(esm_default.line));
|
246626
|
-
type = "separator";
|
246627
|
-
constructor(separator) {
|
246628
|
-
if (separator) {
|
246629
|
-
this.separator = separator;
|
246630
|
-
}
|
246631
|
-
}
|
246632
|
-
static isSeparator(choice) {
|
246633
|
-
return Boolean(choice && typeof choice === "object" && "type" in choice && choice.type === "separator");
|
246634
|
-
}
|
246635
|
-
}
|
246636
246542
|
// ../../node_modules/.bun/yoctocolors@2.1.2/node_modules/yoctocolors/base.js
|
246637
246543
|
import tty from "node:tty";
|
246638
246544
|
var hasColors = tty?.WriteStream?.prototype?.hasColors?.() ?? false;
|
@@ -264945,7 +264851,7 @@ function pruneCurrentEnv(currentEnv, env2) {
|
|
264945
264851
|
var package_default = {
|
264946
264852
|
name: "@settlemint/sdk-cli",
|
264947
264853
|
description: "Command-line interface for SettleMint SDK, providing development tools and project management capabilities",
|
264948
|
-
version: "2.6.0-
|
264854
|
+
version: "2.6.0-pre8a95765",
|
264949
264855
|
type: "module",
|
264950
264856
|
private: false,
|
264951
264857
|
license: "FSL-1.1-MIT",
|
@@ -264996,13 +264902,13 @@ var package_default = {
|
|
264996
264902
|
"@commander-js/extra-typings": "14.0.0",
|
264997
264903
|
commander: "14.0.0",
|
264998
264904
|
"@inquirer/confirm": "5.1.15",
|
264999
|
-
"@inquirer/input": "4.2.
|
264905
|
+
"@inquirer/input": "4.2.1",
|
265000
264906
|
"@inquirer/password": "4.0.17",
|
265001
|
-
"@inquirer/select": "4.3.
|
265002
|
-
"@settlemint/sdk-hasura": "2.6.0-
|
265003
|
-
"@settlemint/sdk-js": "2.6.0-
|
265004
|
-
"@settlemint/sdk-utils": "2.6.0-
|
265005
|
-
"@settlemint/sdk-viem": "2.6.0-
|
264907
|
+
"@inquirer/select": "4.3.2",
|
264908
|
+
"@settlemint/sdk-hasura": "2.6.0-pre8a95765",
|
264909
|
+
"@settlemint/sdk-js": "2.6.0-pre8a95765",
|
264910
|
+
"@settlemint/sdk-utils": "2.6.0-pre8a95765",
|
264911
|
+
"@settlemint/sdk-viem": "2.6.0-pre8a95765",
|
265006
264912
|
"@types/node": "24.3.0",
|
265007
264913
|
"@types/semver": "7.7.0",
|
265008
264914
|
"@types/which": "3.0.4",
|
@@ -265019,7 +264925,7 @@ var package_default = {
|
|
265019
264925
|
},
|
265020
264926
|
peerDependencies: {
|
265021
264927
|
hardhat: "<= 4",
|
265022
|
-
"@settlemint/sdk-js": "2.6.0-
|
264928
|
+
"@settlemint/sdk-js": "2.6.0-pre8a95765"
|
265023
264929
|
},
|
265024
264930
|
peerDependenciesMeta: {
|
265025
264931
|
hardhat: {
|
@@ -270889,9 +270795,101 @@ function sanitizeName(value5, length = 35) {
|
|
270889
270795
|
}).slice(0, length).replaceAll(/(^\d*)/g, "").replaceAll(/(-$)/g, "").replaceAll(/(^-)/g, "");
|
270890
270796
|
}
|
270891
270797
|
|
270798
|
+
// ../../node_modules/.bun/@inquirer+input@4.2.1+be14e1ce904ed1ef/node_modules/@inquirer/input/dist/esm/index.js
|
270799
|
+
var inputTheme = {
|
270800
|
+
validationFailureMode: "keep"
|
270801
|
+
};
|
270802
|
+
var esm_default2 = createPrompt((config3, done) => {
|
270803
|
+
const { required: required2, validate: validate3 = () => true, prefill = "tab" } = config3;
|
270804
|
+
const theme = makeTheme(inputTheme, config3.theme);
|
270805
|
+
const [status, setStatus] = useState("idle");
|
270806
|
+
const [defaultValue = "", setDefaultValue] = useState(config3.default);
|
270807
|
+
const [errorMsg, setError] = useState();
|
270808
|
+
const [value5, setValue] = useState("");
|
270809
|
+
const prefix = usePrefix({ status, theme });
|
270810
|
+
useKeypress(async (key2, rl) => {
|
270811
|
+
if (status !== "idle") {
|
270812
|
+
return;
|
270813
|
+
}
|
270814
|
+
if (isEnterKey(key2)) {
|
270815
|
+
const answer = value5 || defaultValue;
|
270816
|
+
setStatus("loading");
|
270817
|
+
const isValid = required2 && !answer ? "You must provide a value" : await validate3(answer);
|
270818
|
+
if (isValid === true) {
|
270819
|
+
setValue(answer);
|
270820
|
+
setStatus("done");
|
270821
|
+
done(answer);
|
270822
|
+
} else {
|
270823
|
+
if (theme.validationFailureMode === "clear") {
|
270824
|
+
setValue("");
|
270825
|
+
} else {
|
270826
|
+
rl.write(value5);
|
270827
|
+
}
|
270828
|
+
setError(isValid || "You must provide a valid value");
|
270829
|
+
setStatus("idle");
|
270830
|
+
}
|
270831
|
+
} else if (isBackspaceKey(key2) && !value5) {
|
270832
|
+
setDefaultValue(undefined);
|
270833
|
+
} else if (key2.name === "tab" && !value5) {
|
270834
|
+
setDefaultValue(undefined);
|
270835
|
+
rl.clearLine(0);
|
270836
|
+
rl.write(defaultValue);
|
270837
|
+
setValue(defaultValue);
|
270838
|
+
} else {
|
270839
|
+
setValue(rl.line);
|
270840
|
+
setError(undefined);
|
270841
|
+
}
|
270842
|
+
});
|
270843
|
+
useEffect((rl) => {
|
270844
|
+
if (prefill === "editable" && defaultValue) {
|
270845
|
+
rl.write(defaultValue);
|
270846
|
+
setValue(defaultValue);
|
270847
|
+
}
|
270848
|
+
}, []);
|
270849
|
+
const message = theme.style.message(config3.message, status);
|
270850
|
+
let formattedValue = value5;
|
270851
|
+
if (typeof config3.transformer === "function") {
|
270852
|
+
formattedValue = config3.transformer(value5, { isFinal: status === "done" });
|
270853
|
+
} else if (status === "done") {
|
270854
|
+
formattedValue = theme.style.answer(value5);
|
270855
|
+
}
|
270856
|
+
let defaultStr;
|
270857
|
+
if (defaultValue && status !== "done" && !value5) {
|
270858
|
+
defaultStr = theme.style.defaultAnswer(defaultValue);
|
270859
|
+
}
|
270860
|
+
let error48 = "";
|
270861
|
+
if (errorMsg) {
|
270862
|
+
error48 = theme.style.error(errorMsg);
|
270863
|
+
}
|
270864
|
+
return [
|
270865
|
+
[prefix, message, defaultStr, formattedValue].filter((v6) => v6 !== undefined).join(" "),
|
270866
|
+
error48
|
270867
|
+
];
|
270868
|
+
});
|
270869
|
+
|
270870
|
+
// src/prompts/smart-contract-set/subgraph-name.prompt.ts
|
270871
|
+
async function subgraphNamePrompt({
|
270872
|
+
defaultName,
|
270873
|
+
env: env2,
|
270874
|
+
accept
|
270875
|
+
}) {
|
270876
|
+
const defaultSubgraphName = defaultName ? sanitizeName(defaultName) : undefined;
|
270877
|
+
if (accept) {
|
270878
|
+
return defaultSubgraphName ?? env2.SETTLEMINT_THEGRAPH_DEFAULT_SUBGRAPH;
|
270879
|
+
}
|
270880
|
+
const subgraphName = await esm_default2({
|
270881
|
+
message: "What is the name of your subgraph?",
|
270882
|
+
default: defaultSubgraphName,
|
270883
|
+
required: true
|
270884
|
+
});
|
270885
|
+
return sanitizeName(subgraphName);
|
270886
|
+
}
|
270887
|
+
|
270892
270888
|
// ../../node_modules/.bun/@inquirer+core@10.2.0+be14e1ce904ed1ef/node_modules/@inquirer/core/dist/esm/lib/key.js
|
270889
|
+
var isUpKey = (key2) => key2.name === "up";
|
270890
|
+
var isDownKey = (key2) => key2.name === "down";
|
270893
270891
|
var isBackspaceKey2 = (key2) => key2.name === "backspace";
|
270894
|
-
var
|
270892
|
+
var isNumberKey = (key2) => "1234567890".includes(key2.name);
|
270895
270893
|
var isEnterKey2 = (key2) => key2.name === "enter" || key2.name === "return";
|
270896
270894
|
// ../../node_modules/.bun/@inquirer+core@10.2.0+be14e1ce904ed1ef/node_modules/@inquirer/core/dist/esm/lib/errors.js
|
270897
270895
|
class AbortPromptError2 extends Error {
|
@@ -271058,24 +271056,24 @@ function useEffect2(cb, depArray) {
|
|
271058
271056
|
}
|
271059
271057
|
|
271060
271058
|
// ../../node_modules/.bun/@inquirer+core@10.2.0+be14e1ce904ed1ef/node_modules/@inquirer/core/dist/esm/lib/theme.js
|
271061
|
-
var
|
271059
|
+
var import_yoctocolors_cjs2 = __toESM(require_yoctocolors_cjs(), 1);
|
271062
271060
|
var defaultTheme2 = {
|
271063
271061
|
prefix: {
|
271064
|
-
idle:
|
271065
|
-
done:
|
271062
|
+
idle: import_yoctocolors_cjs2.default.blue("?"),
|
271063
|
+
done: import_yoctocolors_cjs2.default.green(esm_default.tick)
|
271066
271064
|
},
|
271067
271065
|
spinner: {
|
271068
271066
|
interval: 80,
|
271069
|
-
frames: ["⠋", "⠙", "⠹", "⠸", "⠼", "⠴", "⠦", "⠧", "⠇", "⠏"].map((frame) =>
|
271067
|
+
frames: ["⠋", "⠙", "⠹", "⠸", "⠼", "⠴", "⠦", "⠧", "⠇", "⠏"].map((frame) => import_yoctocolors_cjs2.default.yellow(frame))
|
271070
271068
|
},
|
271071
271069
|
style: {
|
271072
|
-
answer:
|
271073
|
-
message:
|
271074
|
-
error: (text2) =>
|
271075
|
-
defaultAnswer: (text2) =>
|
271076
|
-
help:
|
271077
|
-
highlight:
|
271078
|
-
key: (text2) =>
|
271070
|
+
answer: import_yoctocolors_cjs2.default.cyan,
|
271071
|
+
message: import_yoctocolors_cjs2.default.bold,
|
271072
|
+
error: (text2) => import_yoctocolors_cjs2.default.red(`> ${text2}`),
|
271073
|
+
defaultAnswer: (text2) => import_yoctocolors_cjs2.default.dim(`(${text2})`),
|
271074
|
+
help: import_yoctocolors_cjs2.default.dim,
|
271075
|
+
highlight: import_yoctocolors_cjs2.default.cyan,
|
271076
|
+
key: (text2) => import_yoctocolors_cjs2.default.cyan(import_yoctocolors_cjs2.default.bold(`<${text2}>`))
|
271079
271077
|
}
|
271080
271078
|
};
|
271081
271079
|
|
@@ -271137,11 +271135,22 @@ function usePrefix2({ status = "idle", theme }) {
|
|
271137
271135
|
const iconName = status === "loading" ? "idle" : status;
|
271138
271136
|
return typeof prefix === "string" ? prefix : prefix[iconName] ?? prefix["idle"];
|
271139
271137
|
}
|
271138
|
+
// ../../node_modules/.bun/@inquirer+core@10.2.0+be14e1ce904ed1ef/node_modules/@inquirer/core/dist/esm/lib/use-memo.js
|
271139
|
+
function useMemo(fn, dependencies) {
|
271140
|
+
return withPointer2((pointer) => {
|
271141
|
+
const prev = pointer.get();
|
271142
|
+
if (!prev || prev.dependencies.length !== dependencies.length || prev.dependencies.some((dep, i7) => dep !== dependencies[i7])) {
|
271143
|
+
const value5 = fn();
|
271144
|
+
pointer.set({ value: value5, dependencies });
|
271145
|
+
return value5;
|
271146
|
+
}
|
271147
|
+
return prev.value;
|
271148
|
+
});
|
271149
|
+
}
|
271140
271150
|
// ../../node_modules/.bun/@inquirer+core@10.2.0+be14e1ce904ed1ef/node_modules/@inquirer/core/dist/esm/lib/use-ref.js
|
271141
271151
|
function useRef2(val) {
|
271142
271152
|
return useState2({ current: val })[0];
|
271143
271153
|
}
|
271144
|
-
|
271145
271154
|
// ../../node_modules/.bun/@inquirer+core@10.2.0+be14e1ce904ed1ef/node_modules/@inquirer/core/dist/esm/lib/use-keypress.js
|
271146
271155
|
function useKeypress2(userHandler) {
|
271147
271156
|
const signal = useRef2(userHandler);
|
@@ -271173,6 +271182,72 @@ function readlineWidth2() {
|
|
271173
271182
|
return import_cli_width2.default({ defaultWidth: 80, output: readline3().output });
|
271174
271183
|
}
|
271175
271184
|
|
271185
|
+
// ../../node_modules/.bun/@inquirer+core@10.2.0+be14e1ce904ed1ef/node_modules/@inquirer/core/dist/esm/lib/pagination/use-pagination.js
|
271186
|
+
function usePointerPosition({ active, renderedItems, pageSize, loop }) {
|
271187
|
+
const state = useRef2({
|
271188
|
+
lastPointer: active,
|
271189
|
+
lastActive: undefined
|
271190
|
+
});
|
271191
|
+
const { lastPointer, lastActive } = state.current;
|
271192
|
+
const middle = Math.floor(pageSize / 2);
|
271193
|
+
const renderedLength = renderedItems.reduce((acc, item) => acc + item.length, 0);
|
271194
|
+
const defaultPointerPosition = renderedItems.slice(0, active).reduce((acc, item) => acc + item.length, 0);
|
271195
|
+
let pointer = defaultPointerPosition;
|
271196
|
+
if (renderedLength > pageSize) {
|
271197
|
+
if (loop) {
|
271198
|
+
pointer = lastPointer;
|
271199
|
+
if (lastActive != null && lastActive < active && active - lastActive < pageSize) {
|
271200
|
+
pointer = Math.min(middle, Math.abs(active - lastActive) === 1 ? Math.min(lastPointer + (renderedItems[lastActive]?.length ?? 0), Math.max(defaultPointerPosition, lastPointer)) : lastPointer + active - lastActive);
|
271201
|
+
}
|
271202
|
+
} else {
|
271203
|
+
const spaceUnderActive = renderedItems.slice(active).reduce((acc, item) => acc + item.length, 0);
|
271204
|
+
pointer = spaceUnderActive < pageSize - middle ? pageSize - spaceUnderActive : Math.min(defaultPointerPosition, middle);
|
271205
|
+
}
|
271206
|
+
}
|
271207
|
+
state.current.lastPointer = pointer;
|
271208
|
+
state.current.lastActive = active;
|
271209
|
+
return pointer;
|
271210
|
+
}
|
271211
|
+
function usePagination({ items, active, renderItem, pageSize, loop = true }) {
|
271212
|
+
const width = readlineWidth2();
|
271213
|
+
const bound = (num) => (num % items.length + items.length) % items.length;
|
271214
|
+
const renderedItems = items.map((item, index) => {
|
271215
|
+
if (item == null)
|
271216
|
+
return [];
|
271217
|
+
return breakLines2(renderItem({ item, index, isActive: index === active }), width).split(`
|
271218
|
+
`);
|
271219
|
+
});
|
271220
|
+
const renderedLength = renderedItems.reduce((acc, item) => acc + item.length, 0);
|
271221
|
+
const renderItemAtIndex = (index) => renderedItems[index] ?? [];
|
271222
|
+
const pointer = usePointerPosition({ active, renderedItems, pageSize, loop });
|
271223
|
+
const activeItem = renderItemAtIndex(active).slice(0, pageSize);
|
271224
|
+
const activeItemPosition = pointer + activeItem.length <= pageSize ? pointer : pageSize - activeItem.length;
|
271225
|
+
const pageBuffer = Array.from({ length: pageSize });
|
271226
|
+
pageBuffer.splice(activeItemPosition, activeItem.length, ...activeItem);
|
271227
|
+
const itemVisited = new Set([active]);
|
271228
|
+
let bufferPointer = activeItemPosition + activeItem.length;
|
271229
|
+
let itemPointer = bound(active + 1);
|
271230
|
+
while (bufferPointer < pageSize && !itemVisited.has(itemPointer) && (loop && renderedLength > pageSize ? itemPointer !== active : itemPointer > active)) {
|
271231
|
+
const lines = renderItemAtIndex(itemPointer);
|
271232
|
+
const linesToAdd = lines.slice(0, pageSize - bufferPointer);
|
271233
|
+
pageBuffer.splice(bufferPointer, linesToAdd.length, ...linesToAdd);
|
271234
|
+
itemVisited.add(itemPointer);
|
271235
|
+
bufferPointer += linesToAdd.length;
|
271236
|
+
itemPointer = bound(itemPointer + 1);
|
271237
|
+
}
|
271238
|
+
bufferPointer = activeItemPosition - 1;
|
271239
|
+
itemPointer = bound(active - 1);
|
271240
|
+
while (bufferPointer >= 0 && !itemVisited.has(itemPointer) && (loop && renderedLength > pageSize ? itemPointer !== active : itemPointer < active)) {
|
271241
|
+
const lines = renderItemAtIndex(itemPointer);
|
271242
|
+
const linesToAdd = lines.slice(Math.max(0, lines.length - bufferPointer - 1));
|
271243
|
+
pageBuffer.splice(bufferPointer - linesToAdd.length + 1, linesToAdd.length, ...linesToAdd);
|
271244
|
+
itemVisited.add(itemPointer);
|
271245
|
+
bufferPointer -= linesToAdd.length;
|
271246
|
+
itemPointer = bound(itemPointer - 1);
|
271247
|
+
}
|
271248
|
+
return pageBuffer.filter((line) => typeof line === "string").join(`
|
271249
|
+
`);
|
271250
|
+
}
|
271176
271251
|
// ../../node_modules/.bun/@inquirer+core@10.2.0+be14e1ce904ed1ef/node_modules/@inquirer/core/dist/esm/lib/create-prompt.js
|
271177
271252
|
var import_mute_stream2 = __toESM(require_lib(), 1);
|
271178
271253
|
import * as readline4 from "node:readline";
|
@@ -271347,97 +271422,21 @@ function createPrompt2(view) {
|
|
271347
271422
|
};
|
271348
271423
|
return prompt;
|
271349
271424
|
}
|
271350
|
-
// ../../node_modules/.bun/@inquirer+
|
271351
|
-
var
|
271352
|
-
|
271353
|
-
};
|
271354
|
-
|
271355
|
-
|
271356
|
-
|
271357
|
-
|
271358
|
-
const [defaultValue = "", setDefaultValue] = useState2(config3.default);
|
271359
|
-
const [errorMsg, setError] = useState2();
|
271360
|
-
const [value5, setValue] = useState2("");
|
271361
|
-
const prefix = usePrefix2({ status, theme });
|
271362
|
-
useKeypress2(async (key3, rl) => {
|
271363
|
-
if (status !== "idle") {
|
271364
|
-
return;
|
271365
|
-
}
|
271366
|
-
if (isEnterKey2(key3)) {
|
271367
|
-
const answer = value5 || defaultValue;
|
271368
|
-
setStatus("loading");
|
271369
|
-
const isValid = required2 && !answer ? "You must provide a value" : await validate3(answer);
|
271370
|
-
if (isValid === true) {
|
271371
|
-
setValue(answer);
|
271372
|
-
setStatus("done");
|
271373
|
-
done(answer);
|
271374
|
-
} else {
|
271375
|
-
if (theme.validationFailureMode === "clear") {
|
271376
|
-
setValue("");
|
271377
|
-
} else {
|
271378
|
-
rl.write(value5);
|
271379
|
-
}
|
271380
|
-
setError(isValid || "You must provide a valid value");
|
271381
|
-
setStatus("idle");
|
271382
|
-
}
|
271383
|
-
} else if (isBackspaceKey2(key3) && !value5) {
|
271384
|
-
setDefaultValue(undefined);
|
271385
|
-
} else if (isTabKey(key3) && !value5) {
|
271386
|
-
setDefaultValue(undefined);
|
271387
|
-
rl.clearLine(0);
|
271388
|
-
rl.write(defaultValue);
|
271389
|
-
setValue(defaultValue);
|
271390
|
-
} else {
|
271391
|
-
setValue(rl.line);
|
271392
|
-
setError(undefined);
|
271393
|
-
}
|
271394
|
-
});
|
271395
|
-
useEffect2((rl) => {
|
271396
|
-
if (prefill === "editable" && defaultValue) {
|
271397
|
-
rl.write(defaultValue);
|
271398
|
-
setValue(defaultValue);
|
271425
|
+
// ../../node_modules/.bun/@inquirer+core@10.2.0+be14e1ce904ed1ef/node_modules/@inquirer/core/dist/esm/lib/Separator.js
|
271426
|
+
var import_yoctocolors_cjs3 = __toESM(require_yoctocolors_cjs(), 1);
|
271427
|
+
class Separator {
|
271428
|
+
separator = import_yoctocolors_cjs3.default.dim(Array.from({ length: 15 }).join(esm_default.line));
|
271429
|
+
type = "separator";
|
271430
|
+
constructor(separator) {
|
271431
|
+
if (separator) {
|
271432
|
+
this.separator = separator;
|
271399
271433
|
}
|
271400
|
-
}, []);
|
271401
|
-
const message = theme.style.message(config3.message, status);
|
271402
|
-
let formattedValue = value5;
|
271403
|
-
if (typeof config3.transformer === "function") {
|
271404
|
-
formattedValue = config3.transformer(value5, { isFinal: status === "done" });
|
271405
|
-
} else if (status === "done") {
|
271406
|
-
formattedValue = theme.style.answer(value5);
|
271407
|
-
}
|
271408
|
-
let defaultStr;
|
271409
|
-
if (defaultValue && status !== "done" && !value5) {
|
271410
|
-
defaultStr = theme.style.defaultAnswer(defaultValue);
|
271411
271434
|
}
|
271412
|
-
|
271413
|
-
|
271414
|
-
error48 = theme.style.error(errorMsg);
|
271415
|
-
}
|
271416
|
-
return [
|
271417
|
-
[prefix, message, defaultStr, formattedValue].filter((v6) => v6 !== undefined).join(" "),
|
271418
|
-
error48
|
271419
|
-
];
|
271420
|
-
});
|
271421
|
-
|
271422
|
-
// src/prompts/smart-contract-set/subgraph-name.prompt.ts
|
271423
|
-
async function subgraphNamePrompt({
|
271424
|
-
defaultName,
|
271425
|
-
env: env2,
|
271426
|
-
accept
|
271427
|
-
}) {
|
271428
|
-
const defaultSubgraphName = defaultName ? sanitizeName(defaultName) : undefined;
|
271429
|
-
if (accept) {
|
271430
|
-
return defaultSubgraphName ?? env2.SETTLEMINT_THEGRAPH_DEFAULT_SUBGRAPH;
|
271435
|
+
static isSeparator(choice) {
|
271436
|
+
return Boolean(choice && typeof choice === "object" && "type" in choice && choice.type === "separator");
|
271431
271437
|
}
|
271432
|
-
const subgraphName = await esm_default2({
|
271433
|
-
message: "What is the name of your subgraph?",
|
271434
|
-
default: defaultSubgraphName,
|
271435
|
-
required: true
|
271436
|
-
});
|
271437
|
-
return sanitizeName(subgraphName);
|
271438
271438
|
}
|
271439
|
-
|
271440
|
-
// ../../node_modules/.bun/@inquirer+select@4.3.1+be14e1ce904ed1ef/node_modules/@inquirer/select/dist/esm/index.js
|
271439
|
+
// ../../node_modules/.bun/@inquirer+select@4.3.2+be14e1ce904ed1ef/node_modules/@inquirer/select/dist/esm/index.js
|
271441
271440
|
var import_yoctocolors_cjs4 = __toESM(require_yoctocolors_cjs(), 1);
|
271442
271441
|
var import_ansi_escapes3 = __toESM(require_ansi_escapes(), 1);
|
271443
271442
|
var selectTheme = {
|
@@ -271477,19 +271476,19 @@ function normalizeChoices(choices) {
|
|
271477
271476
|
return normalizedChoice;
|
271478
271477
|
});
|
271479
271478
|
}
|
271480
|
-
var esm_default3 =
|
271479
|
+
var esm_default3 = createPrompt2((config3, done) => {
|
271481
271480
|
const { loop = true, pageSize = 7 } = config3;
|
271482
|
-
const firstRender =
|
271483
|
-
const theme =
|
271484
|
-
const [status, setStatus] =
|
271485
|
-
const prefix =
|
271486
|
-
const searchTimeoutRef =
|
271481
|
+
const firstRender = useRef2(true);
|
271482
|
+
const theme = makeTheme2(selectTheme, config3.theme);
|
271483
|
+
const [status, setStatus] = useState2("idle");
|
271484
|
+
const prefix = usePrefix2({ status, theme });
|
271485
|
+
const searchTimeoutRef = useRef2();
|
271487
271486
|
const items = useMemo(() => normalizeChoices(config3.choices), [config3.choices]);
|
271488
271487
|
const bounds = useMemo(() => {
|
271489
271488
|
const first = items.findIndex(isSelectable);
|
271490
271489
|
const last = items.findLastIndex(isSelectable);
|
271491
271490
|
if (first === -1) {
|
271492
|
-
throw new
|
271491
|
+
throw new ValidationError2("[select prompt] No selectable choices. All choices are disabled.");
|
271493
271492
|
}
|
271494
271493
|
return { first, last };
|
271495
271494
|
}, [items]);
|
@@ -271498,11 +271497,11 @@ var esm_default3 = createPrompt((config3, done) => {
|
|
271498
271497
|
return -1;
|
271499
271498
|
return items.findIndex((item) => isSelectable(item) && item.value === config3.default);
|
271500
271499
|
}, [config3.default, items]);
|
271501
|
-
const [active, setActive] =
|
271500
|
+
const [active, setActive] = useState2(defaultItemIndex === -1 ? bounds.first : defaultItemIndex);
|
271502
271501
|
const selectedChoice = items[active];
|
271503
|
-
|
271502
|
+
useKeypress2((key3, rl) => {
|
271504
271503
|
clearTimeout(searchTimeoutRef.current);
|
271505
|
-
if (
|
271504
|
+
if (isEnterKey2(key3)) {
|
271506
271505
|
setStatus("done");
|
271507
271506
|
done(selectedChoice.value);
|
271508
271507
|
} else if (isUpKey(key3) || isDownKey(key3)) {
|
@@ -271531,7 +271530,7 @@ var esm_default3 = createPrompt((config3, done) => {
|
|
271531
271530
|
searchTimeoutRef.current = setTimeout(() => {
|
271532
271531
|
rl.clearLine(0);
|
271533
271532
|
}, 700);
|
271534
|
-
} else if (
|
271533
|
+
} else if (isBackspaceKey2(key3)) {
|
271535
271534
|
rl.clearLine(0);
|
271536
271535
|
} else {
|
271537
271536
|
const searchTerm = rl.line.toLowerCase();
|
@@ -271548,7 +271547,7 @@ var esm_default3 = createPrompt((config3, done) => {
|
|
271548
271547
|
}, 700);
|
271549
271548
|
}
|
271550
271549
|
});
|
271551
|
-
|
271550
|
+
useEffect2(() => () => {
|
271552
271551
|
clearTimeout(searchTimeoutRef.current);
|
271553
271552
|
}, []);
|
271554
271553
|
const message = theme.style.message(config3.message, status);
|
@@ -304636,4 +304635,4 @@ async function sdkCliCommand(argv = process.argv) {
|
|
304636
304635
|
// src/cli.ts
|
304637
304636
|
sdkCliCommand();
|
304638
304637
|
|
304639
|
-
//# debugId=
|
304638
|
+
//# debugId=55C8834DE276017C64756E2164756E21
|