@settlemint/sdk-cli 2.4.1-pr31b55309 → 2.4.1-pr4122454f
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 +95 -9
- package/dist/cli.js.map +3 -3
- package/package.json +5 -5
package/dist/cli.js
CHANGED
@@ -265083,7 +265083,7 @@ function pruneCurrentEnv(currentEnv, env2) {
|
|
265083
265083
|
var package_default = {
|
265084
265084
|
name: "@settlemint/sdk-cli",
|
265085
265085
|
description: "Command-line interface for SettleMint SDK, providing development tools and project management capabilities",
|
265086
|
-
version: "2.4.1-
|
265086
|
+
version: "2.4.1-pr4122454f",
|
265087
265087
|
type: "module",
|
265088
265088
|
private: false,
|
265089
265089
|
license: "FSL-1.1-MIT",
|
@@ -265134,10 +265134,10 @@ var package_default = {
|
|
265134
265134
|
"@inquirer/input": "4.2.0",
|
265135
265135
|
"@inquirer/password": "4.0.16",
|
265136
265136
|
"@inquirer/select": "4.2.4",
|
265137
|
-
"@settlemint/sdk-hasura": "2.4.1-
|
265138
|
-
"@settlemint/sdk-js": "2.4.1-
|
265139
|
-
"@settlemint/sdk-utils": "2.4.1-
|
265140
|
-
"@settlemint/sdk-viem": "2.4.1-
|
265137
|
+
"@settlemint/sdk-hasura": "2.4.1-pr4122454f",
|
265138
|
+
"@settlemint/sdk-js": "2.4.1-pr4122454f",
|
265139
|
+
"@settlemint/sdk-utils": "2.4.1-pr4122454f",
|
265140
|
+
"@settlemint/sdk-viem": "2.4.1-pr4122454f",
|
265141
265141
|
"@types/node": "24.0.12",
|
265142
265142
|
"@types/semver": "7.7.0",
|
265143
265143
|
"@types/which": "3.0.4",
|
@@ -302081,6 +302081,11 @@ function camelCaseToWords2(s6) {
|
|
302081
302081
|
function replaceUnderscoresAndHyphensWithSpaces(s6) {
|
302082
302082
|
return s6.replace(/[-_]/g, " ");
|
302083
302083
|
}
|
302084
|
+
function extractBaseUrlBeforeSegment(baseUrl, pathSegment) {
|
302085
|
+
const url4 = new URL(baseUrl);
|
302086
|
+
const segmentIndex = url4.pathname.indexOf(pathSegment);
|
302087
|
+
return url4.origin + (segmentIndex >= 0 ? url4.pathname.substring(0, segmentIndex) : url4.pathname);
|
302088
|
+
}
|
302084
302089
|
|
302085
302090
|
// src/commands/codegen/codegen-the-graph.ts
|
302086
302091
|
var PACKAGE_NAME3 = "@settlemint/sdk-thegraph";
|
@@ -321701,7 +321706,7 @@ function getHdPrivateKeyEnv(service) {
|
|
321701
321706
|
}
|
321702
321707
|
|
321703
321708
|
// ../utils/dist/url.js
|
321704
|
-
function
|
321709
|
+
function extractBaseUrlBeforeSegment2(baseUrl, pathSegment) {
|
321705
321710
|
const url5 = new URL(baseUrl);
|
321706
321711
|
const segmentIndex = url5.pathname.indexOf(pathSegment);
|
321707
321712
|
return url5.origin + (segmentIndex >= 0 ? url5.pathname.substring(0, segmentIndex) : url5.pathname);
|
@@ -321733,7 +321738,7 @@ function getUpdatedSubgraphEndpoints({
|
|
321733
321738
|
}
|
321734
321739
|
function getTheGraphUrl(subgraphUrls) {
|
321735
321740
|
if (Array.isArray(subgraphUrls) && subgraphUrls.length > 0) {
|
321736
|
-
return
|
321741
|
+
return extractBaseUrlBeforeSegment2(subgraphUrls[0], "/subgraphs");
|
321737
321742
|
}
|
321738
321743
|
return;
|
321739
321744
|
}
|
@@ -321810,6 +321815,59 @@ ${JSON.stringify(arg, null, 2)}`;
|
|
321810
321815
|
};
|
321811
321816
|
}
|
321812
321817
|
var logger4 = createLogger4();
|
321818
|
+
function truncate(value4, maxLength) {
|
321819
|
+
if (value4.length <= maxLength) {
|
321820
|
+
return value4;
|
321821
|
+
}
|
321822
|
+
return `${value4.slice(0, maxLength)}...`;
|
321823
|
+
}
|
321824
|
+
var WARNING_THRESHOLD = 500;
|
321825
|
+
var TRUNCATE_LENGTH = 50;
|
321826
|
+
function requestLogger(logger$1, name3, fn) {
|
321827
|
+
return async (...args) => {
|
321828
|
+
const start3 = Date.now();
|
321829
|
+
try {
|
321830
|
+
return await fn(...args);
|
321831
|
+
} finally {
|
321832
|
+
const end = Date.now();
|
321833
|
+
const duration6 = end - start3;
|
321834
|
+
const body = extractInfoFromBody(args[1]?.body ?? "{}");
|
321835
|
+
const message = `${name3} path: ${args[0]}, took ${formatDuration(duration6)}`;
|
321836
|
+
if (duration6 > WARNING_THRESHOLD) {
|
321837
|
+
logger$1.warn(message, body);
|
321838
|
+
} else {
|
321839
|
+
logger$1.info(message, body);
|
321840
|
+
}
|
321841
|
+
}
|
321842
|
+
};
|
321843
|
+
}
|
321844
|
+
function formatDuration(duration6) {
|
321845
|
+
return duration6 < 1000 ? `${duration6}ms` : `${(duration6 / 1000).toFixed(3)}s`;
|
321846
|
+
}
|
321847
|
+
function extractInfoFromBody(body) {
|
321848
|
+
try {
|
321849
|
+
const parsedBody = typeof body === "string" ? JSON.parse(body) : body;
|
321850
|
+
if (parsedBody === null || parsedBody === undefined || Object.keys(parsedBody).length === 0) {
|
321851
|
+
return null;
|
321852
|
+
}
|
321853
|
+
const dataToKeep = {};
|
321854
|
+
if ("query" in parsedBody) {
|
321855
|
+
dataToKeep.query = truncate(parsedBody.query, TRUNCATE_LENGTH);
|
321856
|
+
}
|
321857
|
+
if ("variables" in parsedBody) {
|
321858
|
+
dataToKeep.variables = truncate(JSON.stringify(parsedBody.variables), TRUNCATE_LENGTH);
|
321859
|
+
}
|
321860
|
+
if ("operationName" in parsedBody) {
|
321861
|
+
dataToKeep.operationName = truncate(parsedBody.operationName, TRUNCATE_LENGTH);
|
321862
|
+
}
|
321863
|
+
if (Object.keys(dataToKeep).length > 0) {
|
321864
|
+
return JSON.stringify(dataToKeep);
|
321865
|
+
}
|
321866
|
+
return truncate(JSON.stringify(parsedBody || "{}"), TRUNCATE_LENGTH);
|
321867
|
+
} catch {
|
321868
|
+
return "{}";
|
321869
|
+
}
|
321870
|
+
}
|
321813
321871
|
|
321814
321872
|
// src/prompts/standalone/service-value.prompt.ts
|
321815
321873
|
async function serviceValuePrompt({
|
@@ -326127,6 +326185,33 @@ var ClientOptionsSchema3 = exports_external.object({
|
|
326127
326185
|
"reload"
|
326128
326186
|
]).optional()
|
326129
326187
|
});
|
326188
|
+
function createHasuraMetadataClient(options, logger5) {
|
326189
|
+
ensureServer();
|
326190
|
+
const validatedOptions = validate2(ClientOptionsSchema3, options);
|
326191
|
+
const baseUrl = extractBaseUrlBeforeSegment(options.instance, "/v1/graphql");
|
326192
|
+
const queryEndpoint = new URL(`${baseUrl}/v1/metadata`).toString();
|
326193
|
+
const fetchInstance = logger5 ? requestLogger(logger5, "hasura", fetch) : fetch;
|
326194
|
+
return async (query) => {
|
326195
|
+
const response = await fetchInstance(queryEndpoint, {
|
326196
|
+
method: "POST",
|
326197
|
+
headers: appendHeaders({ "Content-Type": "application/json" }, {
|
326198
|
+
"x-auth-token": validatedOptions.accessToken,
|
326199
|
+
"x-hasura-admin-secret": validatedOptions.adminSecret
|
326200
|
+
}),
|
326201
|
+
body: JSON.stringify(query)
|
326202
|
+
});
|
326203
|
+
if (!response.ok) {
|
326204
|
+
return {
|
326205
|
+
ok: false,
|
326206
|
+
data: await response.json()
|
326207
|
+
};
|
326208
|
+
}
|
326209
|
+
return {
|
326210
|
+
ok: true,
|
326211
|
+
data: await response.json()
|
326212
|
+
};
|
326213
|
+
};
|
326214
|
+
}
|
326130
326215
|
|
326131
326216
|
// src/constants/resource-type.ts
|
326132
326217
|
var SETTLEMINT_CLIENT_MAP = {
|
@@ -326231,11 +326316,12 @@ function hasuraTrackCommand() {
|
|
326231
326316
|
if (!hasuraGraphqlEndpoint || !hasuraAdminSecret) {
|
326232
326317
|
return note("Could not retrieve Hasura endpoint or admin secret. Please check your configuration.");
|
326233
326318
|
}
|
326234
|
-
const
|
326319
|
+
const hasuraMetadataClient = createHasuraMetadataClient({
|
326235
326320
|
instance: hasuraGraphqlEndpoint,
|
326236
326321
|
accessToken,
|
326237
326322
|
adminSecret: hasuraAdminSecret
|
326238
326323
|
});
|
326324
|
+
const { result, messages } = await trackAllTables(database, hasuraMetadataClient);
|
326239
326325
|
for (const message of messages) {
|
326240
326326
|
note(message);
|
326241
326327
|
}
|
@@ -330812,4 +330898,4 @@ async function sdkCliCommand(argv = process.argv) {
|
|
330812
330898
|
// src/cli.ts
|
330813
330899
|
sdkCliCommand();
|
330814
330900
|
|
330815
|
-
//# debugId=
|
330901
|
+
//# debugId=72C4AB408CED4BB464756E2164756E21
|