@settlemint/sdk-cli 1.0.0-pr895881b7 → 1.0.0-pr8acfb090
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 +357 -258
- package/dist/cli.js.map +10 -9
- package/package.json +3 -3
package/dist/cli.js
CHANGED
|
@@ -19613,7 +19613,7 @@ var require_lib4 = __commonJS((exports, module) => {
|
|
|
19613
19613
|
var rRel = new RegExp(`^\\.${rSlash.source}`);
|
|
19614
19614
|
var getNotFoundError = (cmd) => Object.assign(new Error(`not found: ${cmd}`), { code: "ENOENT" });
|
|
19615
19615
|
var getPathInfo = (cmd, {
|
|
19616
|
-
path: optPath = "/home/runner/work/sdk/sdk/sdk/cli/node_modules/.bin:/home/runner/work/sdk/sdk/sdk/cli/node_modules/.bin:/home/runner/work/sdk/sdk/sdk/node_modules/.bin:/home/runner/work/sdk/sdk/node_modules/.bin:/home/runner/work/sdk/node_modules/.bin:/home/runner/work/node_modules/.bin:/home/runner/node_modules/.bin:/home/node_modules/.bin:/node_modules/.bin:/tmp/bunx-1001-turbo@latest/node_modules/.bin:/home/runner/work/sdk/sdk/node_modules/.bin:/home/runner/work/sdk/sdk/node_modules/.bin:/home/runner/work/sdk/node_modules/.bin:/home/runner/work/node_modules/.bin:/home/runner/node_modules/.bin:/home/node_modules/.bin:/node_modules/.bin:/opt/hostedtoolcache/node/22.12.0/x64/bin:/home/runner/.bun/bin:/tmp/tmp.
|
|
19616
|
+
path: optPath = "/home/runner/work/sdk/sdk/sdk/cli/node_modules/.bin:/home/runner/work/sdk/sdk/sdk/cli/node_modules/.bin:/home/runner/work/sdk/sdk/sdk/node_modules/.bin:/home/runner/work/sdk/sdk/node_modules/.bin:/home/runner/work/sdk/node_modules/.bin:/home/runner/work/node_modules/.bin:/home/runner/node_modules/.bin:/home/node_modules/.bin:/node_modules/.bin:/tmp/bunx-1001-turbo@latest/node_modules/.bin:/home/runner/work/sdk/sdk/node_modules/.bin:/home/runner/work/sdk/sdk/node_modules/.bin:/home/runner/work/sdk/node_modules/.bin:/home/runner/work/node_modules/.bin:/home/runner/node_modules/.bin:/home/node_modules/.bin:/node_modules/.bin:/opt/hostedtoolcache/node/22.12.0/x64/bin:/home/runner/.bun/bin:/tmp/tmp.Gc9yy3bYzK:/nsc/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/home/runner/.local/bin:/opt/pipx_bin:/home/runner/.config/composer/vendor/bin:/usr/local/.ghcup/bin:/snap/bin/:/usr/games:/usr/local/games:/home/linuxbrew/.linuxbrew/bin:/home/runner/.config/composer/vendor/bin:/home/runner/.dotnet/tools:/home/runner/.cargo/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin",
|
|
19617
19617
|
pathExt: optPathExt = process.env.PATHEXT,
|
|
19618
19618
|
delimiter: optDelimiter = delimiter
|
|
19619
19619
|
}) => {
|
|
@@ -19817,7 +19817,7 @@ var require_lib5 = __commonJS((exports, module) => {
|
|
|
19817
19817
|
let pathToInitial;
|
|
19818
19818
|
try {
|
|
19819
19819
|
pathToInitial = which.sync(initialCmd, {
|
|
19820
|
-
path: options.env && findInObject(options.env, "PATH") || "/home/runner/work/sdk/sdk/sdk/cli/node_modules/.bin:/home/runner/work/sdk/sdk/sdk/cli/node_modules/.bin:/home/runner/work/sdk/sdk/sdk/node_modules/.bin:/home/runner/work/sdk/sdk/node_modules/.bin:/home/runner/work/sdk/node_modules/.bin:/home/runner/work/node_modules/.bin:/home/runner/node_modules/.bin:/home/node_modules/.bin:/node_modules/.bin:/tmp/bunx-1001-turbo@latest/node_modules/.bin:/home/runner/work/sdk/sdk/node_modules/.bin:/home/runner/work/sdk/sdk/node_modules/.bin:/home/runner/work/sdk/node_modules/.bin:/home/runner/work/node_modules/.bin:/home/runner/node_modules/.bin:/home/node_modules/.bin:/node_modules/.bin:/opt/hostedtoolcache/node/22.12.0/x64/bin:/home/runner/.bun/bin:/tmp/tmp.
|
|
19820
|
+
path: options.env && findInObject(options.env, "PATH") || "/home/runner/work/sdk/sdk/sdk/cli/node_modules/.bin:/home/runner/work/sdk/sdk/sdk/cli/node_modules/.bin:/home/runner/work/sdk/sdk/sdk/node_modules/.bin:/home/runner/work/sdk/sdk/node_modules/.bin:/home/runner/work/sdk/node_modules/.bin:/home/runner/work/node_modules/.bin:/home/runner/node_modules/.bin:/home/node_modules/.bin:/node_modules/.bin:/tmp/bunx-1001-turbo@latest/node_modules/.bin:/home/runner/work/sdk/sdk/node_modules/.bin:/home/runner/work/sdk/sdk/node_modules/.bin:/home/runner/work/sdk/node_modules/.bin:/home/runner/work/node_modules/.bin:/home/runner/node_modules/.bin:/home/node_modules/.bin:/node_modules/.bin:/opt/hostedtoolcache/node/22.12.0/x64/bin:/home/runner/.bun/bin:/tmp/tmp.Gc9yy3bYzK:/nsc/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/home/runner/.local/bin:/opt/pipx_bin:/home/runner/.config/composer/vendor/bin:/usr/local/.ghcup/bin:/snap/bin/:/usr/games:/usr/local/games:/home/linuxbrew/.linuxbrew/bin:/home/runner/.config/composer/vendor/bin:/home/runner/.dotnet/tools:/home/runner/.cargo/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin",
|
|
19821
19821
|
pathext: options.env && findInObject(options.env, "PATHEXT") || process.env.PATHEXT
|
|
19822
19822
|
}).toLowerCase();
|
|
19823
19823
|
} catch (err) {
|
|
@@ -20534,7 +20534,7 @@ var require_lib6 = __commonJS((exports, module) => {
|
|
|
20534
20534
|
var rRel = new RegExp(`^\\.${rSlash.source}`);
|
|
20535
20535
|
var getNotFoundError = (cmd) => Object.assign(new Error(`not found: ${cmd}`), { code: "ENOENT" });
|
|
20536
20536
|
var getPathInfo = (cmd, {
|
|
20537
|
-
path: optPath = "/home/runner/work/sdk/sdk/sdk/cli/node_modules/.bin:/home/runner/work/sdk/sdk/sdk/cli/node_modules/.bin:/home/runner/work/sdk/sdk/sdk/node_modules/.bin:/home/runner/work/sdk/sdk/node_modules/.bin:/home/runner/work/sdk/node_modules/.bin:/home/runner/work/node_modules/.bin:/home/runner/node_modules/.bin:/home/node_modules/.bin:/node_modules/.bin:/tmp/bunx-1001-turbo@latest/node_modules/.bin:/home/runner/work/sdk/sdk/node_modules/.bin:/home/runner/work/sdk/sdk/node_modules/.bin:/home/runner/work/sdk/node_modules/.bin:/home/runner/work/node_modules/.bin:/home/runner/node_modules/.bin:/home/node_modules/.bin:/node_modules/.bin:/opt/hostedtoolcache/node/22.12.0/x64/bin:/home/runner/.bun/bin:/tmp/tmp.
|
|
20537
|
+
path: optPath = "/home/runner/work/sdk/sdk/sdk/cli/node_modules/.bin:/home/runner/work/sdk/sdk/sdk/cli/node_modules/.bin:/home/runner/work/sdk/sdk/sdk/node_modules/.bin:/home/runner/work/sdk/sdk/node_modules/.bin:/home/runner/work/sdk/node_modules/.bin:/home/runner/work/node_modules/.bin:/home/runner/node_modules/.bin:/home/node_modules/.bin:/node_modules/.bin:/tmp/bunx-1001-turbo@latest/node_modules/.bin:/home/runner/work/sdk/sdk/node_modules/.bin:/home/runner/work/sdk/sdk/node_modules/.bin:/home/runner/work/sdk/node_modules/.bin:/home/runner/work/node_modules/.bin:/home/runner/node_modules/.bin:/home/node_modules/.bin:/node_modules/.bin:/opt/hostedtoolcache/node/22.12.0/x64/bin:/home/runner/.bun/bin:/tmp/tmp.Gc9yy3bYzK:/nsc/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/home/runner/.local/bin:/opt/pipx_bin:/home/runner/.config/composer/vendor/bin:/usr/local/.ghcup/bin:/snap/bin/:/usr/games:/usr/local/games:/home/linuxbrew/.linuxbrew/bin:/home/runner/.config/composer/vendor/bin:/home/runner/.dotnet/tools:/home/runner/.cargo/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin",
|
|
20538
20538
|
pathExt: optPathExt = process.env.PATHEXT,
|
|
20539
20539
|
delimiter: optDelimiter = delimiter
|
|
20540
20540
|
}) => {
|
|
@@ -223327,7 +223327,7 @@ ${Bt.cyan(Yt)}
|
|
|
223327
223327
|
code: "ENOENT"
|
|
223328
223328
|
}), getPathInfo = (e9, t7) => {
|
|
223329
223329
|
var r6 = t7.colon || or;
|
|
223330
|
-
var i6 = e9.match(/\//) || nr && e9.match(/\\/) ? [""] : [...nr ? [process.cwd()] : [], ...(t7.path || "/home/runner/work/sdk/sdk/sdk/cli/node_modules/.bin:/home/runner/work/sdk/sdk/sdk/cli/node_modules/.bin:/home/runner/work/sdk/sdk/sdk/node_modules/.bin:/home/runner/work/sdk/sdk/node_modules/.bin:/home/runner/work/sdk/node_modules/.bin:/home/runner/work/node_modules/.bin:/home/runner/node_modules/.bin:/home/node_modules/.bin:/node_modules/.bin:/tmp/bunx-1001-turbo@latest/node_modules/.bin:/home/runner/work/sdk/sdk/node_modules/.bin:/home/runner/work/sdk/sdk/node_modules/.bin:/home/runner/work/sdk/node_modules/.bin:/home/runner/work/node_modules/.bin:/home/runner/node_modules/.bin:/home/node_modules/.bin:/node_modules/.bin:/opt/hostedtoolcache/node/22.12.0/x64/bin:/home/runner/.bun/bin:/tmp/tmp.
|
|
223330
|
+
var i6 = e9.match(/\//) || nr && e9.match(/\\/) ? [""] : [...nr ? [process.cwd()] : [], ...(t7.path || "/home/runner/work/sdk/sdk/sdk/cli/node_modules/.bin:/home/runner/work/sdk/sdk/sdk/cli/node_modules/.bin:/home/runner/work/sdk/sdk/sdk/node_modules/.bin:/home/runner/work/sdk/sdk/node_modules/.bin:/home/runner/work/sdk/node_modules/.bin:/home/runner/work/node_modules/.bin:/home/runner/node_modules/.bin:/home/node_modules/.bin:/node_modules/.bin:/tmp/bunx-1001-turbo@latest/node_modules/.bin:/home/runner/work/sdk/sdk/node_modules/.bin:/home/runner/work/sdk/sdk/node_modules/.bin:/home/runner/work/sdk/node_modules/.bin:/home/runner/work/node_modules/.bin:/home/runner/node_modules/.bin:/home/node_modules/.bin:/node_modules/.bin:/opt/hostedtoolcache/node/22.12.0/x64/bin:/home/runner/.bun/bin:/tmp/tmp.Gc9yy3bYzK:/nsc/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/home/runner/.local/bin:/opt/pipx_bin:/home/runner/.config/composer/vendor/bin:/usr/local/.ghcup/bin:/snap/bin/:/usr/games:/usr/local/games:/home/linuxbrew/.linuxbrew/bin:/home/runner/.config/composer/vendor/bin:/home/runner/.dotnet/tools:/home/runner/.cargo/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin").split(r6)];
|
|
223331
223331
|
var n6 = nr ? t7.pathExt || process.env.PATHEXT || ".EXE;.CMD;.BAT;.COM" : "";
|
|
223332
223332
|
var a5 = nr ? n6.split(r6) : [""];
|
|
223333
223333
|
if (nr) {
|
|
@@ -226464,7 +226464,7 @@ ${whileRunning(e9)}`;
|
|
|
226464
226464
|
};
|
|
226465
226465
|
ni = Object.assign(async function _main() {
|
|
226466
226466
|
var e9 = new Cli({
|
|
226467
|
-
binaryVersion: "1.0.0-
|
|
226467
|
+
binaryVersion: "1.0.0-pr8acfb090",
|
|
226468
226468
|
binaryLabel: "gql.tada CLI",
|
|
226469
226469
|
binaryName: "gql.tada"
|
|
226470
226470
|
});
|
|
@@ -234964,7 +234964,7 @@ var require_which2 = __commonJS((exports, module) => {
|
|
|
234964
234964
|
const colon = opt2.colon || COLON;
|
|
234965
234965
|
const pathEnv = cmd2.match(/\//) || isWindows2 && cmd2.match(/\\/) ? [""] : [
|
|
234966
234966
|
...isWindows2 ? [process.cwd()] : [],
|
|
234967
|
-
...(opt2.path || "/home/runner/work/sdk/sdk/sdk/cli/node_modules/.bin:/home/runner/work/sdk/sdk/sdk/cli/node_modules/.bin:/home/runner/work/sdk/sdk/sdk/node_modules/.bin:/home/runner/work/sdk/sdk/node_modules/.bin:/home/runner/work/sdk/node_modules/.bin:/home/runner/work/node_modules/.bin:/home/runner/node_modules/.bin:/home/node_modules/.bin:/node_modules/.bin:/tmp/bunx-1001-turbo@latest/node_modules/.bin:/home/runner/work/sdk/sdk/node_modules/.bin:/home/runner/work/sdk/sdk/node_modules/.bin:/home/runner/work/sdk/node_modules/.bin:/home/runner/work/node_modules/.bin:/home/runner/node_modules/.bin:/home/node_modules/.bin:/node_modules/.bin:/opt/hostedtoolcache/node/22.12.0/x64/bin:/home/runner/.bun/bin:/tmp/tmp.
|
|
234967
|
+
...(opt2.path || "/home/runner/work/sdk/sdk/sdk/cli/node_modules/.bin:/home/runner/work/sdk/sdk/sdk/cli/node_modules/.bin:/home/runner/work/sdk/sdk/sdk/node_modules/.bin:/home/runner/work/sdk/sdk/node_modules/.bin:/home/runner/work/sdk/node_modules/.bin:/home/runner/work/node_modules/.bin:/home/runner/node_modules/.bin:/home/node_modules/.bin:/node_modules/.bin:/tmp/bunx-1001-turbo@latest/node_modules/.bin:/home/runner/work/sdk/sdk/node_modules/.bin:/home/runner/work/sdk/sdk/node_modules/.bin:/home/runner/work/sdk/node_modules/.bin:/home/runner/work/node_modules/.bin:/home/runner/node_modules/.bin:/home/node_modules/.bin:/node_modules/.bin:/opt/hostedtoolcache/node/22.12.0/x64/bin:/home/runner/.bun/bin:/tmp/tmp.Gc9yy3bYzK:/nsc/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/home/runner/.local/bin:/opt/pipx_bin:/home/runner/.config/composer/vendor/bin:/usr/local/.ghcup/bin:/snap/bin/:/usr/games:/usr/local/games:/home/linuxbrew/.linuxbrew/bin:/home/runner/.config/composer/vendor/bin:/home/runner/.dotnet/tools:/home/runner/.cargo/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin").split(colon)
|
|
234968
234968
|
];
|
|
234969
234969
|
const pathExtExe = isWindows2 ? opt2.pathExt || process.env.PATHEXT || ".EXE;.CMD;.BAT;.COM" : "";
|
|
234970
234970
|
const pathExt = isWindows2 ? pathExtExe.split(colon) : [""];
|
|
@@ -256788,7 +256788,7 @@ ${error.stack}`));
|
|
|
256788
256788
|
var package_default = {
|
|
256789
256789
|
name: "@settlemint/sdk-cli",
|
|
256790
256790
|
description: "Command-line interface for SettleMint SDK, providing development tools and project management capabilities",
|
|
256791
|
-
version: "1.0.0-
|
|
256791
|
+
version: "1.0.0-pr8acfb090",
|
|
256792
256792
|
type: "module",
|
|
256793
256793
|
private: false,
|
|
256794
256794
|
license: "FSL-1.1-MIT",
|
|
@@ -256841,8 +256841,8 @@ var package_default = {
|
|
|
256841
256841
|
"@inquirer/input": "4.1.3",
|
|
256842
256842
|
"@inquirer/password": "4.0.6",
|
|
256843
256843
|
"@inquirer/select": "4.0.6",
|
|
256844
|
-
"@settlemint/sdk-js": "1.0.0-
|
|
256845
|
-
"@settlemint/sdk-utils": "1.0.0-
|
|
256844
|
+
"@settlemint/sdk-js": "1.0.0-pr8acfb090",
|
|
256845
|
+
"@settlemint/sdk-utils": "1.0.0-pr8acfb090",
|
|
256846
256846
|
"get-tsconfig": "4.8.1",
|
|
256847
256847
|
giget: "1.2.3"
|
|
256848
256848
|
},
|
|
@@ -267563,7 +267563,7 @@ var et = l((Re, tt) => {
|
|
|
267563
267563
|
var g = process.platform === "win32" || process.env.OSTYPE === "cygwin" || process.env.OSTYPE === "msys", Y = h("path"), Bt = g ? ";" : ":", V = U(), J = (t) => Object.assign(new Error(`not found: ${t}`), { code: "ENOENT" }), Q = (t, e) => {
|
|
267564
267564
|
let n = e.colon || Bt, r = t.match(/\//) || g && t.match(/\\/) ? [""] : [
|
|
267565
267565
|
...g ? [process.cwd()] : [],
|
|
267566
|
-
...(e.path || "/home/runner/work/sdk/sdk/sdk/cli/node_modules/.bin:/home/runner/work/sdk/sdk/sdk/cli/node_modules/.bin:/home/runner/work/sdk/sdk/sdk/node_modules/.bin:/home/runner/work/sdk/sdk/node_modules/.bin:/home/runner/work/sdk/node_modules/.bin:/home/runner/work/node_modules/.bin:/home/runner/node_modules/.bin:/home/node_modules/.bin:/node_modules/.bin:/tmp/bunx-1001-turbo@latest/node_modules/.bin:/home/runner/work/sdk/sdk/node_modules/.bin:/home/runner/work/sdk/sdk/node_modules/.bin:/home/runner/work/sdk/node_modules/.bin:/home/runner/work/node_modules/.bin:/home/runner/node_modules/.bin:/home/node_modules/.bin:/node_modules/.bin:/opt/hostedtoolcache/node/22.12.0/x64/bin:/home/runner/.bun/bin:/tmp/tmp.
|
|
267566
|
+
...(e.path || "/home/runner/work/sdk/sdk/sdk/cli/node_modules/.bin:/home/runner/work/sdk/sdk/sdk/cli/node_modules/.bin:/home/runner/work/sdk/sdk/sdk/node_modules/.bin:/home/runner/work/sdk/sdk/node_modules/.bin:/home/runner/work/sdk/node_modules/.bin:/home/runner/work/node_modules/.bin:/home/runner/node_modules/.bin:/home/node_modules/.bin:/node_modules/.bin:/tmp/bunx-1001-turbo@latest/node_modules/.bin:/home/runner/work/sdk/sdk/node_modules/.bin:/home/runner/work/sdk/sdk/node_modules/.bin:/home/runner/work/sdk/node_modules/.bin:/home/runner/work/node_modules/.bin:/home/runner/node_modules/.bin:/home/node_modules/.bin:/node_modules/.bin:/opt/hostedtoolcache/node/22.12.0/x64/bin:/home/runner/.bun/bin:/tmp/tmp.Gc9yy3bYzK:/nsc/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/home/runner/.local/bin:/opt/pipx_bin:/home/runner/.config/composer/vendor/bin:/usr/local/.ghcup/bin:/snap/bin/:/usr/games:/usr/local/games:/home/linuxbrew/.linuxbrew/bin:/home/runner/.config/composer/vendor/bin:/home/runner/.dotnet/tools:/home/runner/.cargo/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin").split(n)
|
|
267567
267567
|
], s = g ? e.pathExt || process.env.PATHEXT || ".EXE;.CMD;.BAT;.COM" : "", o = g ? s.split(n) : [""];
|
|
267568
267568
|
return g && t.indexOf(".") !== -1 && o[0] !== "" && o.unshift(""), {
|
|
267569
267569
|
pathEnv: r,
|
|
@@ -270831,6 +270831,39 @@ function stringify2(obj) {
|
|
|
270831
270831
|
`);
|
|
270832
270832
|
}
|
|
270833
270833
|
|
|
270834
|
+
// src/utils/telemetry.ts
|
|
270835
|
+
async function telemetry(data) {
|
|
270836
|
+
if (process.env.SETTLEMINT_DISABLE_TELEMETRY) {
|
|
270837
|
+
return;
|
|
270838
|
+
}
|
|
270839
|
+
try {
|
|
270840
|
+
const { prod, command, status, message, instance } = data;
|
|
270841
|
+
const env2 = await loadEnv2(false, !!prod);
|
|
270842
|
+
const targetInstance = instance ?? env2.SETTLEMINT_INSTANCE;
|
|
270843
|
+
if (!targetInstance) {
|
|
270844
|
+
return;
|
|
270845
|
+
}
|
|
270846
|
+
const controller = new AbortController;
|
|
270847
|
+
const timeout = setTimeout(() => controller.abort(), 500);
|
|
270848
|
+
await fetch(`${targetInstance}/cm/telemetry`, {
|
|
270849
|
+
method: "POST",
|
|
270850
|
+
headers: {
|
|
270851
|
+
"Content-Type": "application/json"
|
|
270852
|
+
},
|
|
270853
|
+
body: JSON.stringify({
|
|
270854
|
+
command,
|
|
270855
|
+
status,
|
|
270856
|
+
message,
|
|
270857
|
+
workspace: env2.SETTLEMINT_WORKSPACE,
|
|
270858
|
+
application: env2.SETTLEMINT_APPLICATION
|
|
270859
|
+
}),
|
|
270860
|
+
signal: controller.signal
|
|
270861
|
+
});
|
|
270862
|
+
clearTimeout(timeout);
|
|
270863
|
+
} catch {
|
|
270864
|
+
}
|
|
270865
|
+
}
|
|
270866
|
+
|
|
270834
270867
|
// src/commands/codegen/codegen-blockscout.ts
|
|
270835
270868
|
import { rm, writeFile as writeFile6 } from "node:fs/promises";
|
|
270836
270869
|
import { basename, resolve as resolve4 } from "node:path";
|
|
@@ -271078,53 +271111,66 @@ function codegenCommand() {
|
|
|
271078
271111
|
}
|
|
271079
271112
|
])).action(async ({ prod, thegraphSubgraphNames }) => {
|
|
271080
271113
|
intro("Generating GraphQL types and queries for your dApp");
|
|
271081
|
-
|
|
271082
|
-
|
|
271083
|
-
|
|
271084
|
-
|
|
271085
|
-
|
|
271086
|
-
|
|
271087
|
-
|
|
271088
|
-
|
|
271089
|
-
|
|
271090
|
-
|
|
271091
|
-
|
|
271092
|
-
const promises = [];
|
|
271093
|
-
if (hasura) {
|
|
271094
|
-
note("Generating Hasura resources");
|
|
271095
|
-
promises.push(codegenHasura(env2));
|
|
271096
|
-
}
|
|
271097
|
-
if (portal) {
|
|
271098
|
-
note("Generating Portal resources");
|
|
271099
|
-
promises.push(codegenPortal(env2));
|
|
271100
|
-
}
|
|
271101
|
-
if (thegraph) {
|
|
271102
|
-
note("Generating TheGraph resources");
|
|
271103
|
-
promises.push(codegenTheGraph(env2, thegraphSubgraphNames));
|
|
271104
|
-
}
|
|
271105
|
-
if (blockscout) {
|
|
271106
|
-
note("Generating Blockscout resources");
|
|
271107
|
-
promises.push(codegenBlockscout(env2));
|
|
271108
|
-
}
|
|
271109
|
-
if (shouldCodegenMinio(env2)) {
|
|
271110
|
-
note("Generating Minio resources");
|
|
271111
|
-
promises.push(codegenMinio(env2));
|
|
271112
|
-
}
|
|
271113
|
-
if (shouldCodegenIpfs(env2)) {
|
|
271114
|
-
note("Generating IPFS resources");
|
|
271115
|
-
promises.push(codegenIpfs(env2));
|
|
271116
|
-
}
|
|
271117
|
-
const results = await Promise.allSettled(promises);
|
|
271118
|
-
if (results.some((r6) => r6.status === "rejected")) {
|
|
271119
|
-
cancel("An error occurred while generating resources");
|
|
271120
|
-
}
|
|
271121
|
-
if (hasura || portal || thegraph || blockscout) {
|
|
271122
|
-
await generateOutput({
|
|
271123
|
-
output: undefined,
|
|
271124
|
-
tsconfig: undefined
|
|
271114
|
+
try {
|
|
271115
|
+
const env2 = await loadEnv2(true, !!prod);
|
|
271116
|
+
if (!Array.isArray(thegraphSubgraphNames)) {
|
|
271117
|
+
thegraphSubgraphNames = await subgraphNamePrompt(env2);
|
|
271118
|
+
}
|
|
271119
|
+
const { hasura, portal, thegraph, blockscout } = await spinner({
|
|
271120
|
+
startMessage: "Testing configured GraphQL schema",
|
|
271121
|
+
task: async () => {
|
|
271122
|
+
return codegenTsconfig(env2, thegraphSubgraphNames);
|
|
271123
|
+
},
|
|
271124
|
+
stopMessage: "Tested GraphQL schemas"
|
|
271125
271125
|
});
|
|
271126
|
+
const promises = [];
|
|
271127
|
+
if (hasura) {
|
|
271128
|
+
note("Generating Hasura resources");
|
|
271129
|
+
promises.push(codegenHasura(env2));
|
|
271130
|
+
}
|
|
271131
|
+
if (portal) {
|
|
271132
|
+
note("Generating Portal resources");
|
|
271133
|
+
promises.push(codegenPortal(env2));
|
|
271134
|
+
}
|
|
271135
|
+
if (thegraph) {
|
|
271136
|
+
note("Generating TheGraph resources");
|
|
271137
|
+
promises.push(codegenTheGraph(env2, thegraphSubgraphNames));
|
|
271138
|
+
}
|
|
271139
|
+
if (blockscout) {
|
|
271140
|
+
note("Generating Blockscout resources");
|
|
271141
|
+
promises.push(codegenBlockscout(env2));
|
|
271142
|
+
}
|
|
271143
|
+
if (shouldCodegenMinio(env2)) {
|
|
271144
|
+
note("Generating Minio resources");
|
|
271145
|
+
promises.push(codegenMinio(env2));
|
|
271146
|
+
}
|
|
271147
|
+
if (shouldCodegenIpfs(env2)) {
|
|
271148
|
+
note("Generating IPFS resources");
|
|
271149
|
+
promises.push(codegenIpfs(env2));
|
|
271150
|
+
}
|
|
271151
|
+
const results = await Promise.allSettled(promises);
|
|
271152
|
+
if (results.some((r6) => r6.status === "rejected")) {
|
|
271153
|
+
cancel("An error occurred while generating resources");
|
|
271154
|
+
}
|
|
271155
|
+
if (hasura || portal || thegraph || blockscout) {
|
|
271156
|
+
await generateOutput({
|
|
271157
|
+
output: undefined,
|
|
271158
|
+
tsconfig: undefined
|
|
271159
|
+
});
|
|
271160
|
+
}
|
|
271161
|
+
outro("Codegen complete");
|
|
271162
|
+
await telemetry({
|
|
271163
|
+
command: "codegen",
|
|
271164
|
+
status: "success"
|
|
271165
|
+
});
|
|
271166
|
+
} catch (error5) {
|
|
271167
|
+
await telemetry({
|
|
271168
|
+
command: "codegen",
|
|
271169
|
+
status: "error",
|
|
271170
|
+
message: error5.message
|
|
271171
|
+
});
|
|
271172
|
+
throw error5;
|
|
271126
271173
|
}
|
|
271127
|
-
outro("Codegen complete");
|
|
271128
271174
|
});
|
|
271129
271175
|
}
|
|
271130
271176
|
|
|
@@ -273718,23 +273764,18 @@ async function hdPrivateKeyPrompt({
|
|
|
273718
273764
|
}
|
|
273719
273765
|
|
|
273720
273766
|
// src/commands/connect/instance.prompt.ts
|
|
273721
|
-
async function instancePrompt(env2, accept, freeTextInput = false
|
|
273767
|
+
async function instancePrompt(env2, accept, freeTextInput = false) {
|
|
273722
273768
|
const knownInstances = await getInstances();
|
|
273723
|
-
const autoAccept = !!accept ||
|
|
273724
|
-
const defaultInstance = env2.SETTLEMINT_INSTANCE;
|
|
273769
|
+
const autoAccept = !!accept || is_in_ci_default;
|
|
273770
|
+
const defaultInstance = env2.SETTLEMINT_INSTANCE ?? knownInstances[0] ?? "https://console.settlemint.com";
|
|
273725
273771
|
const defaultPossible = autoAccept && defaultInstance;
|
|
273726
273772
|
if (defaultPossible) {
|
|
273727
273773
|
return defaultInstance;
|
|
273728
273774
|
}
|
|
273729
|
-
const defaultLoginInstance = await getDefaultInstance();
|
|
273730
|
-
const defaultPromptInstance = defaultInstance ?? defaultLoginInstance ?? "https://console.settlemint.com";
|
|
273731
|
-
if (isCi) {
|
|
273732
|
-
return defaultPromptInstance;
|
|
273733
|
-
}
|
|
273734
273775
|
if (freeTextInput) {
|
|
273735
273776
|
const instance = await esm_default4({
|
|
273736
273777
|
message: "What is the URL of your SettleMint instance?",
|
|
273737
|
-
default:
|
|
273778
|
+
default: defaultInstance,
|
|
273738
273779
|
required: true,
|
|
273739
273780
|
validate(value4) {
|
|
273740
273781
|
try {
|
|
@@ -273762,7 +273803,7 @@ async function instancePrompt(env2, accept, freeTextInput = false, isCi = is_in_
|
|
|
273762
273803
|
value: instance
|
|
273763
273804
|
}))
|
|
273764
273805
|
],
|
|
273765
|
-
default:
|
|
273806
|
+
default: defaultInstance
|
|
273766
273807
|
});
|
|
273767
273808
|
}
|
|
273768
273809
|
|
|
@@ -273934,112 +273975,125 @@ async function workspacePrompt(env2, workspaces, accept) {
|
|
|
273934
273975
|
// src/commands/connect.ts
|
|
273935
273976
|
function connectCommand() {
|
|
273936
273977
|
return new Command("connect").option("--prod", "Connect to your production environment").option("-a, --accept-defaults", "Accept the default and previously set values").option("-i, --instance <instance>", "The instance to connect to (defaults to the instance in the .env file)").description("Connects your project to your application on SettleMint").action(async ({ acceptDefaults, prod, instance }) => {
|
|
273937
|
-
|
|
273938
|
-
|
|
273939
|
-
|
|
273940
|
-
|
|
273941
|
-
|
|
273942
|
-
|
|
273943
|
-
|
|
273944
|
-
|
|
273945
|
-
|
|
273946
|
-
|
|
273947
|
-
|
|
273948
|
-
|
|
273949
|
-
|
|
273950
|
-
|
|
273951
|
-
|
|
273952
|
-
|
|
273953
|
-
|
|
273954
|
-
|
|
273955
|
-
|
|
273956
|
-
|
|
273957
|
-
|
|
273958
|
-
|
|
273959
|
-
|
|
273960
|
-
|
|
273961
|
-
|
|
273962
|
-
|
|
273963
|
-
|
|
273964
|
-
|
|
273965
|
-
|
|
273966
|
-
|
|
273967
|
-
|
|
273968
|
-
|
|
273969
|
-
|
|
273970
|
-
|
|
273971
|
-
|
|
273972
|
-
|
|
273973
|
-
|
|
273974
|
-
|
|
273975
|
-
|
|
273976
|
-
|
|
273977
|
-
|
|
273978
|
-
|
|
273979
|
-
|
|
273980
|
-
|
|
273981
|
-
|
|
273982
|
-
|
|
273983
|
-
|
|
273984
|
-
|
|
273985
|
-
|
|
273986
|
-
|
|
273987
|
-
|
|
273988
|
-
|
|
273989
|
-
|
|
273990
|
-
|
|
273991
|
-
|
|
273992
|
-
|
|
273993
|
-
|
|
273994
|
-
|
|
273995
|
-
|
|
273996
|
-
|
|
273997
|
-
|
|
273998
|
-
|
|
273999
|
-
|
|
274000
|
-
|
|
274001
|
-
|
|
274002
|
-
|
|
274003
|
-
|
|
274004
|
-
|
|
274005
|
-
|
|
274006
|
-
|
|
274007
|
-
|
|
274008
|
-
|
|
274009
|
-
|
|
274010
|
-
|
|
274011
|
-
|
|
274012
|
-
|
|
274013
|
-
|
|
274014
|
-
|
|
273978
|
+
try {
|
|
273979
|
+
intro("Connecting your dApp to SettleMint");
|
|
273980
|
+
const env2 = await loadEnv2(false, !!prod);
|
|
273981
|
+
const selectedInstance = instance ? sanitizeAndValidateInstanceUrl(instance) : await instancePrompt(env2, true);
|
|
273982
|
+
const personalAccessToken = await getInstanceCredentials(selectedInstance);
|
|
273983
|
+
if (!personalAccessToken) {
|
|
273984
|
+
return missingPersonalAccessTokenError();
|
|
273985
|
+
}
|
|
273986
|
+
const accessToken = personalAccessToken.personalAccessToken;
|
|
273987
|
+
const settlemint = createSettleMintClient({
|
|
273988
|
+
accessToken,
|
|
273989
|
+
instance: selectedInstance
|
|
273990
|
+
});
|
|
273991
|
+
const workspaces = await workspaceSpinner(settlemint);
|
|
273992
|
+
const workspace = await workspacePrompt(env2, workspaces, acceptDefaults);
|
|
273993
|
+
const application = await applicationPrompt(env2, workspace?.applications ?? [], acceptDefaults);
|
|
273994
|
+
const aatToken = await applicationAccessTokenPrompt(env2, application, settlemint, acceptDefaults);
|
|
273995
|
+
const { middlewares, integrationTools, storages, privateKeys, insights, customDeployments, blockchainNodes } = await servicesSpinner(settlemint, application);
|
|
273996
|
+
const blockchainNode = await blockchainNodePrompt({
|
|
273997
|
+
env: env2,
|
|
273998
|
+
nodes: blockchainNodes,
|
|
273999
|
+
accept: acceptDefaults
|
|
274000
|
+
});
|
|
274001
|
+
const hasura = await hasuraPrompt({
|
|
274002
|
+
env: env2,
|
|
274003
|
+
integrations: integrationTools,
|
|
274004
|
+
accept: acceptDefaults
|
|
274005
|
+
});
|
|
274006
|
+
const thegraph = await theGraphPrompt({
|
|
274007
|
+
env: env2,
|
|
274008
|
+
middlewares,
|
|
274009
|
+
accept: acceptDefaults
|
|
274010
|
+
});
|
|
274011
|
+
const portal = await portalPrompt({
|
|
274012
|
+
env: env2,
|
|
274013
|
+
middlewares,
|
|
274014
|
+
accept: acceptDefaults
|
|
274015
|
+
});
|
|
274016
|
+
const ipfs = await ipfsPrompt({
|
|
274017
|
+
env: env2,
|
|
274018
|
+
storages,
|
|
274019
|
+
accept: acceptDefaults
|
|
274020
|
+
});
|
|
274021
|
+
const minio = await minioPrompt({
|
|
274022
|
+
env: env2,
|
|
274023
|
+
storages,
|
|
274024
|
+
accept: acceptDefaults
|
|
274025
|
+
});
|
|
274026
|
+
const hdPrivateKey = await hdPrivateKeyPrompt({
|
|
274027
|
+
env: env2,
|
|
274028
|
+
privateKeys,
|
|
274029
|
+
accept: acceptDefaults
|
|
274030
|
+
});
|
|
274031
|
+
const cDeployment = await customDeploymentPrompt({
|
|
274032
|
+
env: env2,
|
|
274033
|
+
customDeployments,
|
|
274034
|
+
accept: acceptDefaults
|
|
274035
|
+
});
|
|
274036
|
+
const blockscout = await blockscoutPrompt({
|
|
274037
|
+
env: env2,
|
|
274038
|
+
insights,
|
|
274039
|
+
accept: acceptDefaults
|
|
274040
|
+
});
|
|
274041
|
+
if (acceptDefaults) {
|
|
274042
|
+
const selectedServices = [
|
|
274043
|
+
`Workspace: ${workspace.name}`,
|
|
274044
|
+
`Application: ${application.name}`,
|
|
274045
|
+
blockchainNode && `Blockchain Network: ${blockchainNode?.blockchainNetwork?.name}`,
|
|
274046
|
+
blockchainNode && `Blockchain Node: ${blockchainNode?.name}`,
|
|
274047
|
+
hasura && `Hasura: ${hasura?.name}`,
|
|
274048
|
+
thegraph && `TheGraph: ${thegraph?.name}`,
|
|
274049
|
+
portal && `Portal: ${portal?.name}`,
|
|
274050
|
+
ipfs && `IPFS: ${ipfs?.name}`,
|
|
274051
|
+
minio && `MinIO: ${minio?.name}`,
|
|
274052
|
+
hdPrivateKey && `HD Private Key: ${hdPrivateKey?.name}`,
|
|
274053
|
+
cDeployment && `Custom Deployment: ${cDeployment?.name}`,
|
|
274054
|
+
blockscout && `Blockscout: ${blockscout?.name}`
|
|
274055
|
+
];
|
|
274056
|
+
note2(`Selected services:
|
|
274015
274057
|
• ${selectedServices.filter(Boolean).join(`
|
|
274016
274058
|
• `)}
|
|
274017
274059
|
`);
|
|
274060
|
+
}
|
|
274061
|
+
await writeEnvSpinner(!!prod, {
|
|
274062
|
+
SETTLEMINT_ACCESS_TOKEN: aatToken,
|
|
274063
|
+
SETTLEMINT_INSTANCE: selectedInstance,
|
|
274064
|
+
SETTLEMINT_WORKSPACE: workspace.uniqueName,
|
|
274065
|
+
SETTLEMINT_APPLICATION: application.uniqueName,
|
|
274066
|
+
SETTLEMINT_BLOCKCHAIN_NETWORK: blockchainNode?.blockchainNetwork?.uniqueName,
|
|
274067
|
+
SETTLEMINT_BLOCKCHAIN_NODE: blockchainNode?.uniqueName,
|
|
274068
|
+
SETTLEMINT_HASURA: hasura?.uniqueName,
|
|
274069
|
+
...getHasuraEndpoints(hasura),
|
|
274070
|
+
SETTLEMINT_THEGRAPH: thegraph?.uniqueName,
|
|
274071
|
+
...await getGraphEndpoint(thegraph, env2),
|
|
274072
|
+
SETTLEMINT_PORTAL: portal?.uniqueName,
|
|
274073
|
+
...getPortalEndpoints(portal),
|
|
274074
|
+
SETTLEMINT_HD_PRIVATE_KEY: hdPrivateKey?.uniqueName,
|
|
274075
|
+
SETTLEMINT_MINIO: minio?.uniqueName,
|
|
274076
|
+
...getMinioEndpoints(minio),
|
|
274077
|
+
SETTLEMINT_IPFS: ipfs?.uniqueName,
|
|
274078
|
+
...getIpfsEndpoints(ipfs),
|
|
274079
|
+
SETTLEMINT_CUSTOM_DEPLOYMENT: cDeployment?.uniqueName,
|
|
274080
|
+
SETTLEMINT_CUSTOM_DEPLOYMENT_ENDPOINT: cDeployment?.endpoints.find((endpoint) => endpoint.id.includes("internal"))?.displayValue,
|
|
274081
|
+
SETTLEMINT_BLOCKSCOUT: blockscout?.uniqueName,
|
|
274082
|
+
...getBlockscoutEndpoints(blockscout)
|
|
274083
|
+
});
|
|
274084
|
+
outro("Connected to SettleMint");
|
|
274085
|
+
await telemetry({
|
|
274086
|
+
command: "connect",
|
|
274087
|
+
status: "success"
|
|
274088
|
+
});
|
|
274089
|
+
} catch (error5) {
|
|
274090
|
+
await telemetry({
|
|
274091
|
+
command: "connect",
|
|
274092
|
+
status: "error",
|
|
274093
|
+
message: error5.message
|
|
274094
|
+
});
|
|
274095
|
+
throw error5;
|
|
274018
274096
|
}
|
|
274019
|
-
await writeEnvSpinner(!!prod, {
|
|
274020
|
-
SETTLEMINT_ACCESS_TOKEN: aatToken,
|
|
274021
|
-
SETTLEMINT_INSTANCE: selectedInstance,
|
|
274022
|
-
SETTLEMINT_WORKSPACE: workspace.uniqueName,
|
|
274023
|
-
SETTLEMINT_APPLICATION: application.uniqueName,
|
|
274024
|
-
SETTLEMINT_BLOCKCHAIN_NETWORK: blockchainNode?.blockchainNetwork?.uniqueName,
|
|
274025
|
-
SETTLEMINT_BLOCKCHAIN_NODE: blockchainNode?.uniqueName,
|
|
274026
|
-
SETTLEMINT_HASURA: hasura?.uniqueName,
|
|
274027
|
-
...getHasuraEndpoints(hasura),
|
|
274028
|
-
SETTLEMINT_THEGRAPH: thegraph?.uniqueName,
|
|
274029
|
-
...await getGraphEndpoint(thegraph, env2),
|
|
274030
|
-
SETTLEMINT_PORTAL: portal?.uniqueName,
|
|
274031
|
-
...getPortalEndpoints(portal),
|
|
274032
|
-
SETTLEMINT_HD_PRIVATE_KEY: hdPrivateKey?.uniqueName,
|
|
274033
|
-
SETTLEMINT_MINIO: minio?.uniqueName,
|
|
274034
|
-
...getMinioEndpoints(minio),
|
|
274035
|
-
SETTLEMINT_IPFS: ipfs?.uniqueName,
|
|
274036
|
-
...getIpfsEndpoints(ipfs),
|
|
274037
|
-
SETTLEMINT_CUSTOM_DEPLOYMENT: cDeployment?.uniqueName,
|
|
274038
|
-
SETTLEMINT_CUSTOM_DEPLOYMENT_ENDPOINT: cDeployment?.endpoints.find((endpoint) => endpoint.id.includes("internal"))?.displayValue,
|
|
274039
|
-
SETTLEMINT_BLOCKSCOUT: blockscout?.uniqueName,
|
|
274040
|
-
...getBlockscoutEndpoints(blockscout)
|
|
274041
|
-
});
|
|
274042
|
-
outro("Connected to SettleMint");
|
|
274043
274097
|
});
|
|
274044
274098
|
}
|
|
274045
274099
|
|
|
@@ -274847,36 +274901,50 @@ async function downloadAndExtractNpmPackage(template, targetDir) {
|
|
|
274847
274901
|
function createCommand2() {
|
|
274848
274902
|
return new Command("create").description("Bootstrap your SettleMint project").option("-n, --project-name <name>", "The name for your SettleMint project").addOption(new Option("-t, --template <template>", "Thehe template for your SettleMint project").choices(templates.map((templates2) => templates2.value))).action(async ({ projectName, template }) => {
|
|
274849
274903
|
intro("Creating a new SettleMint project");
|
|
274850
|
-
|
|
274851
|
-
|
|
274852
|
-
|
|
274853
|
-
|
|
274854
|
-
|
|
274855
|
-
await
|
|
274856
|
-
|
|
274857
|
-
|
|
274858
|
-
|
|
274859
|
-
|
|
274860
|
-
|
|
274861
|
-
|
|
274862
|
-
|
|
274863
|
-
|
|
274904
|
+
try {
|
|
274905
|
+
const env2 = await loadEnv2(false, false);
|
|
274906
|
+
const name2 = await namePrompt(env2, projectName);
|
|
274907
|
+
const targetDir = formatTargetDir(name2);
|
|
274908
|
+
const projectDir = join7(process.cwd(), targetDir);
|
|
274909
|
+
if (!await exists(projectDir)) {
|
|
274910
|
+
await mkdir6(projectDir, { recursive: true });
|
|
274911
|
+
}
|
|
274912
|
+
if (!await isEmpty(projectDir)) {
|
|
274913
|
+
const confirmEmpty = await esm_default3({
|
|
274914
|
+
message: `The folder ${projectDir} already exists. Do you want to empty it?`,
|
|
274915
|
+
default: false
|
|
274916
|
+
});
|
|
274917
|
+
if (!confirmEmpty) {
|
|
274918
|
+
cancel(`Error: A folder with the name ${targetDir} already exists in the current directory.`);
|
|
274919
|
+
}
|
|
274920
|
+
await emptyDir(projectDir);
|
|
274864
274921
|
}
|
|
274865
|
-
await
|
|
274866
|
-
|
|
274867
|
-
|
|
274868
|
-
|
|
274869
|
-
|
|
274922
|
+
const selectedTemplate = await templatePrompt(templates, template);
|
|
274923
|
+
if (!selectedTemplate) {
|
|
274924
|
+
return nothingSelectedError("template");
|
|
274925
|
+
}
|
|
274926
|
+
await spinner({
|
|
274927
|
+
startMessage: "Scaffolding the project",
|
|
274928
|
+
task: async () => {
|
|
274929
|
+
await downloadAndExtractNpmPackage(selectedTemplate.value, projectDir);
|
|
274930
|
+
await setName(name2, projectDir);
|
|
274931
|
+
},
|
|
274932
|
+
stopMessage: "Project fully scaffolded"
|
|
274933
|
+
});
|
|
274934
|
+
outro("Your project is ready to go!");
|
|
274935
|
+
await telemetry({
|
|
274936
|
+
command: "create",
|
|
274937
|
+
status: "success",
|
|
274938
|
+
message: selectedTemplate.value
|
|
274939
|
+
});
|
|
274940
|
+
} catch (error5) {
|
|
274941
|
+
await telemetry({
|
|
274942
|
+
command: "create",
|
|
274943
|
+
status: "error",
|
|
274944
|
+
message: error5.message
|
|
274945
|
+
});
|
|
274946
|
+
throw error5;
|
|
274870
274947
|
}
|
|
274871
|
-
await spinner({
|
|
274872
|
-
startMessage: "Scaffolding the project",
|
|
274873
|
-
task: async () => {
|
|
274874
|
-
await downloadAndExtractNpmPackage(selectedTemplate.value, projectDir);
|
|
274875
|
-
await setName(name2, projectDir);
|
|
274876
|
-
},
|
|
274877
|
-
stopMessage: "Project fully scaffolded"
|
|
274878
|
-
});
|
|
274879
|
-
outro("Your project is ready to go!");
|
|
274880
274948
|
});
|
|
274881
274949
|
}
|
|
274882
274950
|
|
|
@@ -274935,46 +275003,63 @@ function loginCommand() {
|
|
|
274935
275003
|
}
|
|
274936
275004
|
])).option("-a, --accept-defaults", "Accept the default and previously set values").option("-d, --default", "Set this instance as the default").option("--token-stdin", "Provide a token using STDIN").option("-i, --instance <instance>", "The instance to login to (defaults to the instance in the .env file)").action(async ({ acceptDefaults, default: isDefault, tokenStdin, instance }, cmd2) => {
|
|
274937
275005
|
intro("Login to your SettleMint account");
|
|
274938
|
-
|
|
274939
|
-
|
|
274940
|
-
|
|
274941
|
-
|
|
274942
|
-
|
|
274943
|
-
|
|
274944
|
-
|
|
274945
|
-
|
|
274946
|
-
|
|
274947
|
-
(
|
|
274948
|
-
|
|
274949
|
-
|
|
274950
|
-
|
|
274951
|
-
|
|
274952
|
-
|
|
274953
|
-
|
|
274954
|
-
|
|
274955
|
-
|
|
275006
|
+
try {
|
|
275007
|
+
const autoAccept = !!acceptDefaults || !!tokenStdin;
|
|
275008
|
+
const env2 = await loadEnv2(false, false);
|
|
275009
|
+
if (instance) {
|
|
275010
|
+
validate3(UrlSchema, instance);
|
|
275011
|
+
}
|
|
275012
|
+
const selectedInstance = instance ? sanitizeAndValidateInstanceUrl(instance) : await instancePrompt(env2, autoAccept, true);
|
|
275013
|
+
let personalAccessToken = "";
|
|
275014
|
+
if (tokenStdin) {
|
|
275015
|
+
if (cmd2.args.length > 0) {
|
|
275016
|
+
cancel("A token should be provided using STDIN, not as an argument");
|
|
275017
|
+
}
|
|
275018
|
+
personalAccessToken = await Promise.race([
|
|
275019
|
+
(async () => {
|
|
275020
|
+
const chunks = [];
|
|
275021
|
+
for await (const chunk of process.stdin) {
|
|
275022
|
+
chunks.push(Buffer.from(chunk));
|
|
275023
|
+
}
|
|
275024
|
+
return Buffer.concat(chunks).toString().trim();
|
|
275025
|
+
})(),
|
|
275026
|
+
new Promise((resolve7) => setTimeout(() => resolve7(""), 1000))
|
|
275027
|
+
]);
|
|
275028
|
+
try {
|
|
275029
|
+
validate3(PersonalAccessTokenSchema3, personalAccessToken);
|
|
275030
|
+
} catch {
|
|
275031
|
+
cancel("Invalid personal access token");
|
|
275032
|
+
}
|
|
275033
|
+
} else {
|
|
275034
|
+
personalAccessToken = await personalAccessTokenPrompt(env2, selectedInstance, autoAccept);
|
|
275035
|
+
}
|
|
275036
|
+
const client = createSettleMintClient({
|
|
275037
|
+
instance: selectedInstance,
|
|
275038
|
+
accessToken: personalAccessToken
|
|
275039
|
+
});
|
|
274956
275040
|
try {
|
|
274957
|
-
|
|
274958
|
-
} catch {
|
|
274959
|
-
cancel(
|
|
275041
|
+
await loginSpinner(client);
|
|
275042
|
+
} catch (error5) {
|
|
275043
|
+
cancel(`Invalid personal access token for instance ${selectedInstance}`);
|
|
274960
275044
|
}
|
|
274961
|
-
|
|
274962
|
-
|
|
274963
|
-
|
|
274964
|
-
|
|
274965
|
-
|
|
274966
|
-
|
|
274967
|
-
|
|
274968
|
-
|
|
274969
|
-
|
|
275045
|
+
await storeCredentials(personalAccessToken, selectedInstance);
|
|
275046
|
+
if (isDefault) {
|
|
275047
|
+
await setDefaultInstance(selectedInstance);
|
|
275048
|
+
}
|
|
275049
|
+
outro("Successfully logged in to SettleMint!");
|
|
275050
|
+
await telemetry({
|
|
275051
|
+
command: "login",
|
|
275052
|
+
status: "success",
|
|
275053
|
+
instance: selectedInstance
|
|
275054
|
+
});
|
|
274970
275055
|
} catch (error5) {
|
|
274971
|
-
|
|
274972
|
-
|
|
274973
|
-
|
|
274974
|
-
|
|
274975
|
-
|
|
275056
|
+
await telemetry({
|
|
275057
|
+
command: "login",
|
|
275058
|
+
status: "error",
|
|
275059
|
+
message: error5.message
|
|
275060
|
+
});
|
|
275061
|
+
throw error5;
|
|
274976
275062
|
}
|
|
274977
|
-
outro("Successfully logged in to SettleMint!");
|
|
274978
275063
|
});
|
|
274979
275064
|
}
|
|
274980
275065
|
|
|
@@ -274982,33 +275067,47 @@ function loginCommand() {
|
|
|
274982
275067
|
function logoutCommand() {
|
|
274983
275068
|
return new Command("logout").description("Logout from your SettleMint account").option("--all", "Logout from all instances").action(async (options) => {
|
|
274984
275069
|
intro("Logging out from SettleMint");
|
|
274985
|
-
|
|
274986
|
-
|
|
274987
|
-
|
|
274988
|
-
|
|
274989
|
-
|
|
274990
|
-
|
|
274991
|
-
|
|
274992
|
-
|
|
274993
|
-
|
|
274994
|
-
|
|
274995
|
-
|
|
274996
|
-
|
|
274997
|
-
|
|
274998
|
-
|
|
274999
|
-
|
|
275070
|
+
try {
|
|
275071
|
+
const instances = await getInstances();
|
|
275072
|
+
if (instances.length === 0) {
|
|
275073
|
+
outro("No instances to logout from");
|
|
275074
|
+
return;
|
|
275075
|
+
}
|
|
275076
|
+
if (options.all) {
|
|
275077
|
+
await Promise.all(instances.map((instance2) => removeCredentials(instance2)));
|
|
275078
|
+
outro("Successfully logged out from all instances");
|
|
275079
|
+
return;
|
|
275080
|
+
}
|
|
275081
|
+
if (instances.length === 1) {
|
|
275082
|
+
const instance2 = instances[0];
|
|
275083
|
+
await removeCredentials(instance2);
|
|
275084
|
+
outro(`Successfully logged out from ${instance2}`);
|
|
275085
|
+
return;
|
|
275086
|
+
}
|
|
275087
|
+
const defaultInstance = await getDefaultInstance();
|
|
275088
|
+
const instance = await esm_default2({
|
|
275089
|
+
message: "Select the instance to logout from:",
|
|
275090
|
+
choices: instances.map((instance2) => ({
|
|
275091
|
+
value: instance2,
|
|
275092
|
+
label: instance2,
|
|
275093
|
+
description: instance2 === defaultInstance ? "(default)" : undefined
|
|
275094
|
+
}))
|
|
275095
|
+
});
|
|
275096
|
+
await removeCredentials(instance);
|
|
275097
|
+
outro(`Successfully logged out from ${instance}`);
|
|
275098
|
+
await telemetry({
|
|
275099
|
+
command: "logout",
|
|
275100
|
+
status: "success",
|
|
275101
|
+
instance
|
|
275102
|
+
});
|
|
275103
|
+
} catch (error5) {
|
|
275104
|
+
await telemetry({
|
|
275105
|
+
command: "logout",
|
|
275106
|
+
status: "error",
|
|
275107
|
+
message: error5.message
|
|
275108
|
+
});
|
|
275109
|
+
throw error5;
|
|
275000
275110
|
}
|
|
275001
|
-
const defaultInstance = await getDefaultInstance();
|
|
275002
|
-
const instance = await esm_default2({
|
|
275003
|
-
message: "Select the instance to logout from:",
|
|
275004
|
-
choices: instances.map((instance2) => ({
|
|
275005
|
-
value: instance2,
|
|
275006
|
-
label: instance2,
|
|
275007
|
-
description: instance2 === defaultInstance ? "(default)" : undefined
|
|
275008
|
-
}))
|
|
275009
|
-
});
|
|
275010
|
-
await removeCredentials(instance);
|
|
275011
|
-
outro(`Successfully logged out from ${instance}`);
|
|
275012
275111
|
});
|
|
275013
275112
|
}
|
|
275014
275113
|
|
|
@@ -277651,4 +277750,4 @@ function sdkCliCommand(exitOverride = undefined) {
|
|
|
277651
277750
|
ascii();
|
|
277652
277751
|
sdkCliCommand();
|
|
277653
277752
|
|
|
277654
|
-
//# debugId=
|
|
277753
|
+
//# debugId=7B7B4BA6719A658164756E2164756E21
|