@settlemint/sdk-cli 1.0.0-pr54b00224 → 1.0.0-pr5d85fa1e
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 +414 -334
- package/dist/cli.js.map +16 -15
- 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.DvV03aiRph:/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.DvV03aiRph:/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.DvV03aiRph:/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.DvV03aiRph:/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-pr5d85fa1e",
|
|
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.DvV03aiRph:/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-pr5d85fa1e",
|
|
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-pr5d85fa1e",
|
|
256845
|
+
"@settlemint/sdk-utils": "1.0.0-pr5d85fa1e",
|
|
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.DvV03aiRph:/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,
|
|
@@ -268203,6 +268203,37 @@ async function exists2(path5) {
|
|
|
268203
268203
|
return false;
|
|
268204
268204
|
}
|
|
268205
268205
|
}
|
|
268206
|
+
async function getPackageManager(targetDir) {
|
|
268207
|
+
const packageManager = await detect({ cwd: targetDir || process.cwd() });
|
|
268208
|
+
return packageManager?.name ?? "npm";
|
|
268209
|
+
}
|
|
268210
|
+
async function getPackageManagerExecutable(targetDir) {
|
|
268211
|
+
const packageManager = await getPackageManager(targetDir ?? process.cwd());
|
|
268212
|
+
switch (packageManager) {
|
|
268213
|
+
case "pnpm":
|
|
268214
|
+
return { command: "pnpm", args: ["dlx"] };
|
|
268215
|
+
case "bun":
|
|
268216
|
+
return { command: "bunx", args: [] };
|
|
268217
|
+
case "yarn":
|
|
268218
|
+
return { command: "yarn", args: ["create"] };
|
|
268219
|
+
}
|
|
268220
|
+
return { command: "npx", args: [] };
|
|
268221
|
+
}
|
|
268222
|
+
async function installDependencies(pkgs, cwd) {
|
|
268223
|
+
try {
|
|
268224
|
+
await installPackage(pkgs, { silent: true, additionalArgs: ["--exact"], cwd });
|
|
268225
|
+
} catch (err) {
|
|
268226
|
+
const error = err instanceof Error ? err.message : "Unknown error";
|
|
268227
|
+
note2(`Failed to install ${Array.isArray(pkgs) ? `dependencies '${pkgs.join(", ")}'` : `dependency '${pkgs}'`}: ${error}`, "warn");
|
|
268228
|
+
}
|
|
268229
|
+
}
|
|
268230
|
+
async function isPackageInstalled(name, path5) {
|
|
268231
|
+
const pkgJson = await import_package_json.default.load(path5 ?? await projectRoot2());
|
|
268232
|
+
const inDependencies = !!pkgJson.content.dependencies?.[name];
|
|
268233
|
+
const inDevDependencies = !!pkgJson.content.devDependencies?.[name];
|
|
268234
|
+
const inPeerDependencies = !!pkgJson.content.peerDependencies?.[name];
|
|
268235
|
+
return inDependencies || inDevDependencies || inPeerDependencies;
|
|
268236
|
+
}
|
|
268206
268237
|
async function retryWhenFailed(fn, maxRetries = 5, initialSleepTime = 3000, stopOnError) {
|
|
268207
268238
|
let attempt = 0;
|
|
268208
268239
|
while (attempt < maxRetries) {
|
|
@@ -268238,47 +268269,6 @@ async function fetchWithRetry(input, init, maxRetries = 5, initialSleepTime = 30
|
|
|
268238
268269
|
throw new Error(`HTTP error! status: ${response.status} ${response.statusText}`);
|
|
268239
268270
|
}, maxRetries, initialSleepTime);
|
|
268240
268271
|
}
|
|
268241
|
-
async function graphqlFetchWithRetry(input, init, maxRetries = 5, initialSleepTime = 3000) {
|
|
268242
|
-
return retryWhenFailed(async () => {
|
|
268243
|
-
const response = await fetchWithRetry(input, init);
|
|
268244
|
-
const json = await response.json();
|
|
268245
|
-
if (json.errors) {
|
|
268246
|
-
throw new Error(`GraphQL errors in response: ${json.errors.map((error) => error.message).join(", ")}`);
|
|
268247
|
-
}
|
|
268248
|
-
return json.data;
|
|
268249
|
-
}, maxRetries, initialSleepTime);
|
|
268250
|
-
}
|
|
268251
|
-
async function getPackageManager(targetDir) {
|
|
268252
|
-
const packageManager = await detect({ cwd: targetDir || process.cwd() });
|
|
268253
|
-
return packageManager?.name ?? "npm";
|
|
268254
|
-
}
|
|
268255
|
-
async function getPackageManagerExecutable(targetDir) {
|
|
268256
|
-
const packageManager = await getPackageManager(targetDir ?? process.cwd());
|
|
268257
|
-
switch (packageManager) {
|
|
268258
|
-
case "pnpm":
|
|
268259
|
-
return { command: "pnpm", args: ["dlx"] };
|
|
268260
|
-
case "bun":
|
|
268261
|
-
return { command: "bunx", args: [] };
|
|
268262
|
-
case "yarn":
|
|
268263
|
-
return { command: "yarn", args: ["create"] };
|
|
268264
|
-
}
|
|
268265
|
-
return { command: "npx", args: [] };
|
|
268266
|
-
}
|
|
268267
|
-
async function installDependencies(pkgs, cwd) {
|
|
268268
|
-
try {
|
|
268269
|
-
await installPackage(pkgs, { silent: true, additionalArgs: ["--exact"], cwd });
|
|
268270
|
-
} catch (err) {
|
|
268271
|
-
const error = err instanceof Error ? err.message : "Unknown error";
|
|
268272
|
-
note2(`Failed to install ${Array.isArray(pkgs) ? `dependencies '${pkgs.join(", ")}'` : `dependency '${pkgs}'`}: ${error}`, "warn");
|
|
268273
|
-
}
|
|
268274
|
-
}
|
|
268275
|
-
async function isPackageInstalled(name, path5) {
|
|
268276
|
-
const pkgJson = await import_package_json.default.load(path5 ?? await projectRoot2());
|
|
268277
|
-
const inDependencies = !!pkgJson.content.dependencies?.[name];
|
|
268278
|
-
const inDevDependencies = !!pkgJson.content.devDependencies?.[name];
|
|
268279
|
-
const inPeerDependencies = !!pkgJson.content.peerDependencies?.[name];
|
|
268280
|
-
return inDependencies || inDevDependencies || inPeerDependencies;
|
|
268281
|
-
}
|
|
268282
268272
|
function capitalizeFirstLetter(val) {
|
|
268283
268273
|
return String(val).charAt(0).toUpperCase() + String(val).slice(1);
|
|
268284
268274
|
}
|
|
@@ -268566,7 +268556,7 @@ async function testGqlEndpoint({
|
|
|
268566
268556
|
if (!gqlEndpoint) {
|
|
268567
268557
|
return false;
|
|
268568
268558
|
}
|
|
268569
|
-
await
|
|
268559
|
+
const response = await fetchWithRetry(gqlEndpoint, {
|
|
268570
268560
|
method: "POST",
|
|
268571
268561
|
headers: {
|
|
268572
268562
|
"x-auth-token": accessToken,
|
|
@@ -268585,6 +268575,10 @@ async function testGqlEndpoint({
|
|
|
268585
268575
|
`
|
|
268586
268576
|
})
|
|
268587
268577
|
});
|
|
268578
|
+
const data = await response.json();
|
|
268579
|
+
if (data.errors) {
|
|
268580
|
+
throw new Error("GraphQL errors in response");
|
|
268581
|
+
}
|
|
268588
268582
|
return true;
|
|
268589
268583
|
}
|
|
268590
268584
|
|
|
@@ -270837,6 +270831,39 @@ function stringify2(obj) {
|
|
|
270837
270831
|
`);
|
|
270838
270832
|
}
|
|
270839
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
|
+
await Promise.race([
|
|
270847
|
+
fetch(`${targetInstance}/cm/telemetry`, {
|
|
270848
|
+
method: "POST",
|
|
270849
|
+
headers: {
|
|
270850
|
+
"Content-Type": "application/json"
|
|
270851
|
+
},
|
|
270852
|
+
body: JSON.stringify({
|
|
270853
|
+
command,
|
|
270854
|
+
status,
|
|
270855
|
+
message,
|
|
270856
|
+
workspace: env2.SETTLEMINT_WORKSPACE,
|
|
270857
|
+
application: env2.SETTLEMINT_APPLICATION
|
|
270858
|
+
})
|
|
270859
|
+
}).catch(() => {
|
|
270860
|
+
}),
|
|
270861
|
+
new Promise((resolve4) => setTimeout(resolve4, 500))
|
|
270862
|
+
]);
|
|
270863
|
+
} catch {
|
|
270864
|
+
}
|
|
270865
|
+
}
|
|
270866
|
+
|
|
270840
270867
|
// src/commands/codegen/codegen-blockscout.ts
|
|
270841
270868
|
import { rm, writeFile as writeFile6 } from "node:fs/promises";
|
|
270842
270869
|
import { basename, resolve as resolve4 } from "node:path";
|
|
@@ -270854,7 +270881,7 @@ async function codegenBlockscout(env2) {
|
|
|
270854
270881
|
if (!accessToken) {
|
|
270855
270882
|
return;
|
|
270856
270883
|
}
|
|
270857
|
-
const
|
|
270884
|
+
const response = await fetch(endpoint, {
|
|
270858
270885
|
method: "POST",
|
|
270859
270886
|
headers: {
|
|
270860
270887
|
"x-auth-token": accessToken,
|
|
@@ -270963,8 +270990,15 @@ async function codegenBlockscout(env2) {
|
|
|
270963
270990
|
`
|
|
270964
270991
|
})
|
|
270965
270992
|
});
|
|
270993
|
+
if (!response.ok) {
|
|
270994
|
+
throw new Error(`HTTP error! status: ${response.status}`);
|
|
270995
|
+
}
|
|
270996
|
+
const data = await response.json();
|
|
270997
|
+
if (data.errors) {
|
|
270998
|
+
throw new Error("GraphQL errors in response");
|
|
270999
|
+
}
|
|
270966
271000
|
const introspectionJsonPath = resolve4(process.cwd(), "__blockscout-introspection__.json");
|
|
270967
|
-
await writeFile6(introspectionJsonPath, JSON.stringify(data));
|
|
271001
|
+
await writeFile6(introspectionJsonPath, JSON.stringify(data.data));
|
|
270968
271002
|
try {
|
|
270969
271003
|
await generateSchema({
|
|
270970
271004
|
input: basename(introspectionJsonPath),
|
|
@@ -271077,53 +271111,66 @@ function codegenCommand() {
|
|
|
271077
271111
|
}
|
|
271078
271112
|
])).action(async ({ prod, thegraphSubgraphNames }) => {
|
|
271079
271113
|
intro("Generating GraphQL types and queries for your dApp");
|
|
271080
|
-
|
|
271081
|
-
|
|
271082
|
-
|
|
271083
|
-
|
|
271084
|
-
|
|
271085
|
-
|
|
271086
|
-
|
|
271087
|
-
|
|
271088
|
-
|
|
271089
|
-
|
|
271090
|
-
|
|
271091
|
-
const promises = [];
|
|
271092
|
-
if (hasura) {
|
|
271093
|
-
note("Generating Hasura resources");
|
|
271094
|
-
promises.push(codegenHasura(env2));
|
|
271095
|
-
}
|
|
271096
|
-
if (portal) {
|
|
271097
|
-
note("Generating Portal resources");
|
|
271098
|
-
promises.push(codegenPortal(env2));
|
|
271099
|
-
}
|
|
271100
|
-
if (thegraph) {
|
|
271101
|
-
note("Generating TheGraph resources");
|
|
271102
|
-
promises.push(codegenTheGraph(env2, thegraphSubgraphNames));
|
|
271103
|
-
}
|
|
271104
|
-
if (blockscout) {
|
|
271105
|
-
note("Generating Blockscout resources");
|
|
271106
|
-
promises.push(codegenBlockscout(env2));
|
|
271107
|
-
}
|
|
271108
|
-
if (shouldCodegenMinio(env2)) {
|
|
271109
|
-
note("Generating Minio resources");
|
|
271110
|
-
promises.push(codegenMinio(env2));
|
|
271111
|
-
}
|
|
271112
|
-
if (shouldCodegenIpfs(env2)) {
|
|
271113
|
-
note("Generating IPFS resources");
|
|
271114
|
-
promises.push(codegenIpfs(env2));
|
|
271115
|
-
}
|
|
271116
|
-
const results = await Promise.allSettled(promises);
|
|
271117
|
-
if (results.some((r6) => r6.status === "rejected")) {
|
|
271118
|
-
cancel("An error occurred while generating resources");
|
|
271119
|
-
}
|
|
271120
|
-
if (hasura || portal || thegraph || blockscout) {
|
|
271121
|
-
await generateOutput({
|
|
271122
|
-
output: undefined,
|
|
271123
|
-
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"
|
|
271124
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;
|
|
271125
271173
|
}
|
|
271126
|
-
outro("Codegen complete");
|
|
271127
271174
|
});
|
|
271128
271175
|
}
|
|
271129
271176
|
|
|
@@ -271186,19 +271233,15 @@ async function writeEnvSpinner(prod, env2) {
|
|
|
271186
271233
|
}
|
|
271187
271234
|
|
|
271188
271235
|
// src/utils/get-cluster-service-endpoint.ts
|
|
271189
|
-
async function getGraphEndpoint(
|
|
271236
|
+
async function getGraphEndpoint(service, env2, graphName) {
|
|
271190
271237
|
if (!service || service.__typename !== "HAGraphMiddleware") {
|
|
271191
271238
|
return {};
|
|
271192
271239
|
}
|
|
271193
|
-
const middleware = await retryWhenFailed(() => settlemint.middleware.graphSubgraphs(service.uniqueName, !!graphName));
|
|
271194
|
-
if (!middleware || middleware.__typename !== "HAGraphMiddleware") {
|
|
271195
|
-
return {};
|
|
271196
|
-
}
|
|
271197
271240
|
const isStarterKit = (id) => id.endsWith("-starterkits");
|
|
271198
|
-
const testEndpoint =
|
|
271199
|
-
const starterKitEndpoint =
|
|
271241
|
+
const testEndpoint = service.subgraphs.find(({ graphqlQueryEndpoint }) => graphName ? graphqlQueryEndpoint?.id.endsWith(graphName) : !isStarterKit(graphqlQueryEndpoint?.id))?.graphqlQueryEndpoint?.displayValue;
|
|
271242
|
+
const starterKitEndpoint = service.subgraphs.find(({ graphqlQueryEndpoint }) => isStarterKit(graphqlQueryEndpoint?.id))?.graphqlQueryEndpoint?.displayValue;
|
|
271200
271243
|
const hasEndpoint = testEndpoint && env2.SETTLEMINT_ACCESS_TOKEN ? await testGqlEndpoint({ accessToken: env2.SETTLEMINT_ACCESS_TOKEN, gqlEndpoint: testEndpoint }) : false;
|
|
271201
|
-
const endpoints = hasEndpoint ?
|
|
271244
|
+
const endpoints = hasEndpoint ? service.subgraphs.map(({ graphqlQueryEndpoint }) => graphqlQueryEndpoint?.displayValue) : starterKitEndpoint ? [starterKitEndpoint] : [];
|
|
271202
271245
|
if (endpoints.length === 0) {
|
|
271203
271246
|
return {};
|
|
271204
271247
|
}
|
|
@@ -272944,11 +272987,18 @@ var MiddlewareFragment = graphql(`
|
|
|
272944
272987
|
}
|
|
272945
272988
|
... on HAGraphMiddleware {
|
|
272946
272989
|
specVersion
|
|
272990
|
+
subgraphs(noCache: $noCache) {
|
|
272991
|
+
name
|
|
272992
|
+
graphqlQueryEndpoint {
|
|
272993
|
+
displayValue
|
|
272994
|
+
id
|
|
272995
|
+
}
|
|
272996
|
+
}
|
|
272947
272997
|
}
|
|
272948
272998
|
}
|
|
272949
272999
|
`);
|
|
272950
273000
|
var getMiddlewares = graphql(`
|
|
272951
|
-
query GetMiddlewares($applicationUniqueName: String
|
|
273001
|
+
query GetMiddlewares($applicationUniqueName: String!, $noCache: Boolean = false) {
|
|
272952
273002
|
middlewaresByUniqueName(applicationUniqueName: $applicationUniqueName) {
|
|
272953
273003
|
items {
|
|
272954
273004
|
...Middleware
|
|
@@ -272957,25 +273007,9 @@ var getMiddlewares = graphql(`
|
|
|
272957
273007
|
}
|
|
272958
273008
|
`, [MiddlewareFragment]);
|
|
272959
273009
|
var getMiddleware = graphql(`
|
|
272960
|
-
query GetMiddleware($uniqueName: String
|
|
272961
|
-
middlewareByUniqueName(uniqueName: $uniqueName) {
|
|
272962
|
-
...Middleware
|
|
272963
|
-
}
|
|
272964
|
-
}
|
|
272965
|
-
`, [MiddlewareFragment]);
|
|
272966
|
-
var getGraphMiddlewareSubgraphs = graphql(`
|
|
272967
|
-
query GetMiddleware($uniqueName: String!, $noCache: Boolean = false) {
|
|
273010
|
+
query GetMiddleware($uniqueName: String!, $noCache: Boolean = true) {
|
|
272968
273011
|
middlewareByUniqueName(uniqueName: $uniqueName) {
|
|
272969
273012
|
...Middleware
|
|
272970
|
-
... on HAGraphMiddleware {
|
|
272971
|
-
subgraphs(noCache: $noCache) {
|
|
272972
|
-
name
|
|
272973
|
-
graphqlQueryEndpoint {
|
|
272974
|
-
displayValue
|
|
272975
|
-
id
|
|
272976
|
-
}
|
|
272977
|
-
}
|
|
272978
|
-
}
|
|
272979
273013
|
}
|
|
272980
273014
|
}
|
|
272981
273015
|
`, [MiddlewareFragment]);
|
|
@@ -272993,6 +273027,7 @@ var createMiddleware = graphql(`
|
|
|
272993
273027
|
$loadBalancerId: ID
|
|
272994
273028
|
$abis: [SmartContractPortalMiddlewareAbiInputDto!]
|
|
272995
273029
|
$includePredeployedAbis: [String!]
|
|
273030
|
+
$noCache: Boolean = false
|
|
272996
273031
|
) {
|
|
272997
273032
|
createMiddleware(
|
|
272998
273033
|
applicationId: $applicationId
|
|
@@ -273013,7 +273048,7 @@ var createMiddleware = graphql(`
|
|
|
273013
273048
|
}
|
|
273014
273049
|
`, [MiddlewareFragment]);
|
|
273015
273050
|
var restartMiddleware = graphql(`
|
|
273016
|
-
mutation RestartMiddleware($uniqueName: String
|
|
273051
|
+
mutation RestartMiddleware($uniqueName: String!, $noCache: Boolean = false) {
|
|
273017
273052
|
restartMiddlewareByUniqueName(uniqueName: $uniqueName) {
|
|
273018
273053
|
...Middleware
|
|
273019
273054
|
}
|
|
@@ -273035,15 +273070,6 @@ var middlewareRead = (gqlClient) => {
|
|
|
273035
273070
|
return middleware;
|
|
273036
273071
|
};
|
|
273037
273072
|
};
|
|
273038
|
-
var graphMiddlewareSubgraphs = (gqlClient) => {
|
|
273039
|
-
return async (middlewareUniqueName, noCache = false) => {
|
|
273040
|
-
const { middlewareByUniqueName: middleware } = await gqlClient.request(getGraphMiddlewareSubgraphs, {
|
|
273041
|
-
uniqueName: middlewareUniqueName,
|
|
273042
|
-
noCache
|
|
273043
|
-
});
|
|
273044
|
-
return middleware;
|
|
273045
|
-
};
|
|
273046
|
-
};
|
|
273047
273073
|
var middlewareCreate = (gqlClient) => {
|
|
273048
273074
|
return async (args) => {
|
|
273049
273075
|
const { applicationUniqueName, blockchainNodeUniqueName, loadBalancerUniqueName, storageUniqueName, ...otherArgs } = args;
|
|
@@ -273242,7 +273268,6 @@ function createSettleMintClient(options) {
|
|
|
273242
273268
|
middleware: {
|
|
273243
273269
|
list: middlewareList(gqlClient),
|
|
273244
273270
|
read: middlewareRead(gqlClient),
|
|
273245
|
-
graphSubgraphs: graphMiddlewareSubgraphs(gqlClient),
|
|
273246
273271
|
create: middlewareCreate(gqlClient),
|
|
273247
273272
|
restart: middlewareRestart(gqlClient)
|
|
273248
273273
|
},
|
|
@@ -273950,112 +273975,125 @@ async function workspacePrompt(env2, workspaces, accept) {
|
|
|
273950
273975
|
// src/commands/connect.ts
|
|
273951
273976
|
function connectCommand() {
|
|
273952
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 }) => {
|
|
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
|
-
|
|
274015
|
-
|
|
274016
|
-
|
|
274017
|
-
|
|
274018
|
-
|
|
274019
|
-
|
|
274020
|
-
|
|
274021
|
-
|
|
274022
|
-
|
|
274023
|
-
|
|
274024
|
-
|
|
274025
|
-
|
|
274026
|
-
|
|
274027
|
-
|
|
274028
|
-
|
|
274029
|
-
|
|
274030
|
-
|
|
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:
|
|
274031
274057
|
• ${selectedServices.filter(Boolean).join(`
|
|
274032
274058
|
• `)}
|
|
274033
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;
|
|
274034
274096
|
}
|
|
274035
|
-
await writeEnvSpinner(!!prod, {
|
|
274036
|
-
SETTLEMINT_ACCESS_TOKEN: aatToken,
|
|
274037
|
-
SETTLEMINT_INSTANCE: selectedInstance,
|
|
274038
|
-
SETTLEMINT_WORKSPACE: workspace.uniqueName,
|
|
274039
|
-
SETTLEMINT_APPLICATION: application.uniqueName,
|
|
274040
|
-
SETTLEMINT_BLOCKCHAIN_NETWORK: blockchainNode?.blockchainNetwork?.uniqueName,
|
|
274041
|
-
SETTLEMINT_BLOCKCHAIN_NODE: blockchainNode?.uniqueName,
|
|
274042
|
-
SETTLEMINT_HASURA: hasura?.uniqueName,
|
|
274043
|
-
...getHasuraEndpoints(hasura),
|
|
274044
|
-
SETTLEMINT_THEGRAPH: thegraph?.uniqueName,
|
|
274045
|
-
...await getGraphEndpoint(settlemint, thegraph, env2),
|
|
274046
|
-
SETTLEMINT_PORTAL: portal?.uniqueName,
|
|
274047
|
-
...getPortalEndpoints(portal),
|
|
274048
|
-
SETTLEMINT_HD_PRIVATE_KEY: hdPrivateKey?.uniqueName,
|
|
274049
|
-
SETTLEMINT_MINIO: minio?.uniqueName,
|
|
274050
|
-
...getMinioEndpoints(minio),
|
|
274051
|
-
SETTLEMINT_IPFS: ipfs?.uniqueName,
|
|
274052
|
-
...getIpfsEndpoints(ipfs),
|
|
274053
|
-
SETTLEMINT_CUSTOM_DEPLOYMENT: cDeployment?.uniqueName,
|
|
274054
|
-
SETTLEMINT_CUSTOM_DEPLOYMENT_ENDPOINT: cDeployment?.endpoints.find((endpoint) => endpoint.id.includes("internal"))?.displayValue,
|
|
274055
|
-
SETTLEMINT_BLOCKSCOUT: blockscout?.uniqueName,
|
|
274056
|
-
...getBlockscoutEndpoints(blockscout)
|
|
274057
|
-
});
|
|
274058
|
-
outro("Connected to SettleMint");
|
|
274059
274097
|
});
|
|
274060
274098
|
}
|
|
274061
274099
|
|
|
@@ -274863,36 +274901,50 @@ async function downloadAndExtractNpmPackage(template, targetDir) {
|
|
|
274863
274901
|
function createCommand2() {
|
|
274864
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 }) => {
|
|
274865
274903
|
intro("Creating a new SettleMint project");
|
|
274866
|
-
|
|
274867
|
-
|
|
274868
|
-
|
|
274869
|
-
|
|
274870
|
-
|
|
274871
|
-
await
|
|
274872
|
-
|
|
274873
|
-
|
|
274874
|
-
|
|
274875
|
-
|
|
274876
|
-
|
|
274877
|
-
|
|
274878
|
-
|
|
274879
|
-
|
|
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);
|
|
274880
274921
|
}
|
|
274881
|
-
await
|
|
274882
|
-
|
|
274883
|
-
|
|
274884
|
-
|
|
274885
|
-
|
|
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;
|
|
274886
274947
|
}
|
|
274887
|
-
await spinner({
|
|
274888
|
-
startMessage: "Scaffolding the project",
|
|
274889
|
-
task: async () => {
|
|
274890
|
-
await downloadAndExtractNpmPackage(selectedTemplate.value, projectDir);
|
|
274891
|
-
await setName(name2, projectDir);
|
|
274892
|
-
},
|
|
274893
|
-
stopMessage: "Project fully scaffolded"
|
|
274894
|
-
});
|
|
274895
|
-
outro("Your project is ready to go!");
|
|
274896
274948
|
});
|
|
274897
274949
|
}
|
|
274898
274950
|
|
|
@@ -274951,49 +275003,63 @@ function loginCommand() {
|
|
|
274951
275003
|
}
|
|
274952
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) => {
|
|
274953
275005
|
intro("Login to your SettleMint account");
|
|
274954
|
-
|
|
274955
|
-
|
|
274956
|
-
|
|
274957
|
-
|
|
274958
|
-
|
|
274959
|
-
|
|
274960
|
-
|
|
274961
|
-
|
|
274962
|
-
if (
|
|
274963
|
-
|
|
274964
|
-
|
|
274965
|
-
|
|
274966
|
-
|
|
274967
|
-
|
|
274968
|
-
|
|
274969
|
-
|
|
274970
|
-
|
|
274971
|
-
|
|
274972
|
-
|
|
274973
|
-
|
|
274974
|
-
|
|
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
|
+
});
|
|
274975
275040
|
try {
|
|
274976
|
-
|
|
274977
|
-
} catch {
|
|
274978
|
-
cancel(
|
|
275041
|
+
await loginSpinner(client);
|
|
275042
|
+
} catch (error5) {
|
|
275043
|
+
cancel(`Invalid personal access token for instance ${selectedInstance}`);
|
|
274979
275044
|
}
|
|
274980
|
-
|
|
274981
|
-
|
|
274982
|
-
|
|
274983
|
-
|
|
274984
|
-
|
|
274985
|
-
|
|
274986
|
-
|
|
274987
|
-
|
|
274988
|
-
|
|
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
|
+
});
|
|
274989
275055
|
} catch (error5) {
|
|
274990
|
-
|
|
274991
|
-
|
|
274992
|
-
|
|
274993
|
-
|
|
274994
|
-
|
|
275056
|
+
await telemetry({
|
|
275057
|
+
command: "login",
|
|
275058
|
+
status: "error",
|
|
275059
|
+
message: error5.message
|
|
275060
|
+
});
|
|
275061
|
+
throw error5;
|
|
274995
275062
|
}
|
|
274996
|
-
outro("Successfully logged in to SettleMint!");
|
|
274997
275063
|
});
|
|
274998
275064
|
}
|
|
274999
275065
|
|
|
@@ -275001,33 +275067,47 @@ function loginCommand() {
|
|
|
275001
275067
|
function logoutCommand() {
|
|
275002
275068
|
return new Command("logout").description("Logout from your SettleMint account").option("--all", "Logout from all instances").action(async (options) => {
|
|
275003
275069
|
intro("Logging out from SettleMint");
|
|
275004
|
-
|
|
275005
|
-
|
|
275006
|
-
|
|
275007
|
-
|
|
275008
|
-
|
|
275009
|
-
|
|
275010
|
-
|
|
275011
|
-
|
|
275012
|
-
|
|
275013
|
-
|
|
275014
|
-
|
|
275015
|
-
|
|
275016
|
-
|
|
275017
|
-
|
|
275018
|
-
|
|
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;
|
|
275019
275110
|
}
|
|
275020
|
-
const defaultInstance = await getDefaultInstance();
|
|
275021
|
-
const instance = await esm_default2({
|
|
275022
|
-
message: "Select the instance to logout from:",
|
|
275023
|
-
choices: instances.map((instance2) => ({
|
|
275024
|
-
value: instance2,
|
|
275025
|
-
label: instance2,
|
|
275026
|
-
description: instance2 === defaultInstance ? "(default)" : undefined
|
|
275027
|
-
}))
|
|
275028
|
-
});
|
|
275029
|
-
await removeCredentials(instance);
|
|
275030
|
-
outro(`Successfully logged out from ${instance}`);
|
|
275031
275111
|
});
|
|
275032
275112
|
}
|
|
275033
275113
|
|
|
@@ -275936,7 +276016,7 @@ function graphMiddlewareCreateCommand() {
|
|
|
275936
276016
|
return {
|
|
275937
276017
|
SETTLEMINT_APPLICATION: applicationUniqueName,
|
|
275938
276018
|
SETTLEMINT_THEGRAPH: result.uniqueName,
|
|
275939
|
-
...await getGraphEndpoint(
|
|
276019
|
+
...await getGraphEndpoint(graphMiddleware, env2)
|
|
275940
276020
|
};
|
|
275941
276021
|
}
|
|
275942
276022
|
};
|
|
@@ -277610,7 +277690,7 @@ function subgraphDeployCommand() {
|
|
|
277610
277690
|
instance
|
|
277611
277691
|
});
|
|
277612
277692
|
const middleware = await settlemintClient.middleware.read(theGraphMiddleware.uniqueName);
|
|
277613
|
-
const graphEndpoints = await getGraphEndpoint(
|
|
277693
|
+
const graphEndpoints = await getGraphEndpoint(middleware, env2, graphName);
|
|
277614
277694
|
await writeEnvSpinner(!!prod, {
|
|
277615
277695
|
...env2,
|
|
277616
277696
|
SETTLEMINT_THEGRAPH: theGraphMiddleware.uniqueName,
|
|
@@ -277670,4 +277750,4 @@ function sdkCliCommand(exitOverride = undefined) {
|
|
|
277670
277750
|
ascii();
|
|
277671
277751
|
sdkCliCommand();
|
|
277672
277752
|
|
|
277673
|
-
//# debugId=
|
|
277753
|
+
//# debugId=46F64ACE52E15AAD64756E2164756E21
|