@settlemint/sdk-cli 2.4.1-maina8cce418 → 2.4.1-pr31b55309
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 +98 -98
- package/dist/cli.js.map +9 -8
- package/package.json +7 -6
package/dist/cli.js
CHANGED
@@ -44630,7 +44630,7 @@ var require_util = __commonJS((exports) => {
|
|
44630
44630
|
return path7;
|
44631
44631
|
}
|
44632
44632
|
exports.normalize = normalize4;
|
44633
|
-
function
|
44633
|
+
function join5(aRoot, aPath) {
|
44634
44634
|
if (aRoot === "") {
|
44635
44635
|
aRoot = ".";
|
44636
44636
|
}
|
@@ -44662,7 +44662,7 @@ var require_util = __commonJS((exports) => {
|
|
44662
44662
|
}
|
44663
44663
|
return joined;
|
44664
44664
|
}
|
44665
|
-
exports.join =
|
44665
|
+
exports.join = join5;
|
44666
44666
|
exports.isAbsolute = function(aPath) {
|
44667
44667
|
return aPath.charAt(0) === "/" || urlRegexp.test(aPath);
|
44668
44668
|
};
|
@@ -44835,7 +44835,7 @@ var require_util = __commonJS((exports) => {
|
|
44835
44835
|
parsed.path = parsed.path.substring(0, index + 1);
|
44836
44836
|
}
|
44837
44837
|
}
|
44838
|
-
sourceURL =
|
44838
|
+
sourceURL = join5(urlGenerate(parsed), sourceURL);
|
44839
44839
|
}
|
44840
44840
|
return normalize4(sourceURL);
|
44841
44841
|
}
|
@@ -48913,7 +48913,7 @@ var require_typescript = __commonJS((exports, module) => {
|
|
48913
48913
|
walkUpParenthesizedTypesAndGetParentAndChild: () => walkUpParenthesizedTypesAndGetParentAndChild,
|
48914
48914
|
whitespaceOrMapCommentRegExp: () => whitespaceOrMapCommentRegExp,
|
48915
48915
|
writeCommentRange: () => writeCommentRange,
|
48916
|
-
writeFile: () =>
|
48916
|
+
writeFile: () => writeFile3,
|
48917
48917
|
writeFileEnsuringDirectories: () => writeFileEnsuringDirectories,
|
48918
48918
|
zipWith: () => zipWith
|
48919
48919
|
});
|
@@ -66192,7 +66192,7 @@ ${lanes.join(`
|
|
66192
66192
|
sourceFilePath = isSourceFileInCommonSourceDirectory ? sourceFilePath.substring(commonSourceDirectory.length) : sourceFilePath;
|
66193
66193
|
return combinePaths(newDirPath, sourceFilePath);
|
66194
66194
|
}
|
66195
|
-
function
|
66195
|
+
function writeFile3(host, diagnostics, fileName, text, writeByteOrderMark, sourceFiles, data) {
|
66196
66196
|
host.writeFile(fileName, text, writeByteOrderMark, (hostErrorMessage) => {
|
66197
66197
|
diagnostics.add(createCompilerDiagnostic(Diagnostics.Could_not_write_file_0_Colon_1, fileName, hostErrorMessage));
|
66198
66198
|
}, sourceFiles, data);
|
@@ -148136,7 +148136,7 @@ ${lanes.join(`
|
|
148136
148136
|
return;
|
148137
148137
|
}
|
148138
148138
|
const buildInfo = host.getBuildInfo() || { version: version4 };
|
148139
|
-
|
148139
|
+
writeFile3(host, emitterDiagnostics, buildInfoPath, getBuildInfoText(buildInfo), false, undefined, { buildInfo });
|
148140
148140
|
emittedFilesList == null || emittedFilesList.push(buildInfoPath);
|
148141
148141
|
}
|
148142
148142
|
function emitJsFileOrBundle(sourceFileOrBundle, jsFilePath, sourceMapFilePath) {
|
@@ -148295,14 +148295,14 @@ ${lanes.join(`
|
|
148295
148295
|
}
|
148296
148296
|
if (sourceMapFilePath) {
|
148297
148297
|
const sourceMap = sourceMapGenerator.toString();
|
148298
|
-
|
148298
|
+
writeFile3(host, emitterDiagnostics, sourceMapFilePath, sourceMap, false, sourceFiles);
|
148299
148299
|
}
|
148300
148300
|
} else {
|
148301
148301
|
writer.writeLine();
|
148302
148302
|
}
|
148303
148303
|
const text = writer.getText();
|
148304
148304
|
const data = { sourceMapUrlPos, diagnostics: transform22.diagnostics };
|
148305
|
-
|
148305
|
+
writeFile3(host, emitterDiagnostics, jsFilePath, text, !!compilerOptions.emitBOM, sourceFiles, data);
|
148306
148306
|
writer.clear();
|
148307
148307
|
return !data.skippedDtsWrite;
|
148308
148308
|
}
|
@@ -204176,7 +204176,7 @@ ${options.prefix}` : `
|
|
204176
204176
|
walkUpParenthesizedTypesAndGetParentAndChild: () => walkUpParenthesizedTypesAndGetParentAndChild,
|
204177
204177
|
whitespaceOrMapCommentRegExp: () => whitespaceOrMapCommentRegExp,
|
204178
204178
|
writeCommentRange: () => writeCommentRange,
|
204179
|
-
writeFile: () =>
|
204179
|
+
writeFile: () => writeFile3,
|
204180
204180
|
writeFileEnsuringDirectories: () => writeFileEnsuringDirectories,
|
204181
204181
|
zipWith: () => zipWith
|
204182
204182
|
});
|
@@ -231623,7 +231623,7 @@ function size(value4) {
|
|
231623
231623
|
var init_size = () => {};
|
231624
231624
|
|
231625
231625
|
// ../../node_modules/viem/_esm/errors/version.js
|
231626
|
-
var version5 = "2.31.
|
231626
|
+
var version5 = "2.31.7";
|
231627
231627
|
|
231628
231628
|
// ../../node_modules/viem/_esm/errors/base.js
|
231629
231629
|
function walk(err, fn) {
|
@@ -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-pr31b55309",
|
265087
265087
|
type: "module",
|
265088
265088
|
private: false,
|
265089
265089
|
license: "FSL-1.1-MIT",
|
@@ -265134,10 +265134,11 @@ 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-
|
265138
|
-
"@settlemint/sdk-
|
265139
|
-
"@settlemint/sdk-
|
265140
|
-
"@
|
265137
|
+
"@settlemint/sdk-hasura": "2.4.1-pr31b55309",
|
265138
|
+
"@settlemint/sdk-js": "2.4.1-pr31b55309",
|
265139
|
+
"@settlemint/sdk-utils": "2.4.1-pr31b55309",
|
265140
|
+
"@settlemint/sdk-viem": "2.4.1-pr31b55309",
|
265141
|
+
"@types/node": "24.0.12",
|
265141
265142
|
"@types/semver": "7.7.0",
|
265142
265143
|
"@types/which": "3.0.4",
|
265143
265144
|
"get-tsconfig": "4.10.1",
|
@@ -265145,7 +265146,7 @@ var package_default = {
|
|
265145
265146
|
"is-in-ci": "1.0.0",
|
265146
265147
|
semver: "7.7.2",
|
265147
265148
|
slugify: "1.6.6",
|
265148
|
-
viem: "2.31.
|
265149
|
+
viem: "2.31.7",
|
265149
265150
|
which: "5.0.0",
|
265150
265151
|
yaml: "2.8.0",
|
265151
265152
|
yoctocolors: "2.1.1"
|
@@ -301778,17 +301779,20 @@ async function isSdkInstalledGlobally() {
|
|
301778
301779
|
}
|
301779
301780
|
}
|
301780
301781
|
|
301782
|
+
// ../../node_modules/@gql.tada/cli-utils/dist/gql-tada-cli.mjs
|
301783
|
+
init_index_chunk();
|
301784
|
+
|
301781
301785
|
// src/commands/codegen/utils/write-template.ts
|
301782
|
-
import { mkdir as
|
301783
|
-
import { join as
|
301786
|
+
import { mkdir as mkdir3, writeFile as writeFile4 } from "node:fs/promises";
|
301787
|
+
import { join as join6 } from "node:path";
|
301784
301788
|
async function writeTemplate(template, directory, filename) {
|
301785
301789
|
const projectDir = await projectRoot3();
|
301786
|
-
const hasSrcDir = await exists3(
|
301787
|
-
const basePath = hasSrcDir ?
|
301788
|
-
const codegenDir =
|
301789
|
-
await
|
301790
|
-
const filePath =
|
301791
|
-
await
|
301790
|
+
const hasSrcDir = await exists3(join6(projectDir, "src"));
|
301791
|
+
const basePath = hasSrcDir ? join6(projectDir, "src") : projectDir;
|
301792
|
+
const codegenDir = join6(basePath, directory);
|
301793
|
+
await mkdir3(codegenDir, { recursive: true });
|
301794
|
+
const filePath = join6(codegenDir, filename);
|
301795
|
+
await writeFile4(filePath, template, "utf8");
|
301792
301796
|
}
|
301793
301797
|
|
301794
301798
|
// src/error/missing-config-error.ts
|
@@ -301843,9 +301847,6 @@ var getApplicationOrPersonalAccessToken = async ({
|
|
301843
301847
|
return prefer === "personal" ? missingPersonalAccessTokenError() : missingAccessTokenError(!!personalAccessToken);
|
301844
301848
|
};
|
301845
301849
|
|
301846
|
-
// ../../node_modules/@gql.tada/cli-utils/dist/gql-tada-cli.mjs
|
301847
|
-
init_index_chunk();
|
301848
|
-
|
301849
301850
|
// src/commands/codegen/codegen-hasura.ts
|
301850
301851
|
var PACKAGE_NAME = "@settlemint/sdk-hasura";
|
301851
301852
|
async function codegenHasura(env2) {
|
@@ -301894,7 +301895,13 @@ export const { client: hasuraClient, graphql: hasuraGraphql } = createHasuraClie
|
|
301894
301895
|
adminSecret: process.env.SETTLEMINT_HASURA_ADMIN_SECRET!,
|
301895
301896
|
}, {
|
301896
301897
|
fetch: requestLogger(logger, "hasura", fetch) as typeof fetch,
|
301897
|
-
})
|
301898
|
+
});
|
301899
|
+
|
301900
|
+
export const hasuraMetadataClient = createHasuraMetadataClient({
|
301901
|
+
instance: process.env.SETTLEMINT_HASURA_ENDPOINT!,
|
301902
|
+
accessToken: process.env.SETTLEMINT_ACCESS_TOKEN,
|
301903
|
+
adminSecret: process.env.SETTLEMINT_HASURA_ADMIN_SECRET!,
|
301904
|
+
}, logger);`;
|
301898
301905
|
await writeTemplate(hasuraTemplate, "/lib/settlemint", "hasura.ts");
|
301899
301906
|
} else {
|
301900
301907
|
note("[Codegen] Missing required Hasura environment variables", "warn");
|
@@ -301956,7 +301963,7 @@ export const { client: portalClient, graphql: portalGraphql } = createPortalClie
|
|
301956
301963
|
fetch: requestLogger(logger, "portal", fetch) as typeof fetch,
|
301957
301964
|
});
|
301958
301965
|
|
301959
|
-
export const
|
301966
|
+
export const portalWebsocketClient = getWebsocketClient({
|
301960
301967
|
portalGraphqlEndpoint: process.env.SETTLEMINT_PORTAL_GRAPHQL_ENDPOINT!,
|
301961
301968
|
accessToken: process.env.SETTLEMINT_ACCESS_TOKEN,
|
301962
301969
|
});
|
@@ -302074,11 +302081,6 @@ function camelCaseToWords2(s6) {
|
|
302074
302081
|
function replaceUnderscoresAndHyphensWithSpaces(s6) {
|
302075
302082
|
return s6.replace(/[-_]/g, " ");
|
302076
302083
|
}
|
302077
|
-
function extractBaseUrlBeforeSegment(baseUrl, pathSegment) {
|
302078
|
-
const url4 = new URL(baseUrl);
|
302079
|
-
const segmentIndex = url4.pathname.indexOf(pathSegment);
|
302080
|
-
return url4.origin + (segmentIndex >= 0 ? url4.pathname.substring(0, segmentIndex) : url4.pathname);
|
302081
|
-
}
|
302082
302084
|
|
302083
302085
|
// src/commands/codegen/codegen-the-graph.ts
|
302084
302086
|
var PACKAGE_NAME3 = "@settlemint/sdk-thegraph";
|
@@ -321699,7 +321701,7 @@ function getHdPrivateKeyEnv(service) {
|
|
321699
321701
|
}
|
321700
321702
|
|
321701
321703
|
// ../utils/dist/url.js
|
321702
|
-
function
|
321704
|
+
function extractBaseUrlBeforeSegment(baseUrl, pathSegment) {
|
321703
321705
|
const url5 = new URL(baseUrl);
|
321704
321706
|
const segmentIndex = url5.pathname.indexOf(pathSegment);
|
321705
321707
|
return url5.origin + (segmentIndex >= 0 ? url5.pathname.substring(0, segmentIndex) : url5.pathname);
|
@@ -321731,7 +321733,7 @@ function getUpdatedSubgraphEndpoints({
|
|
321731
321733
|
}
|
321732
321734
|
function getTheGraphUrl(subgraphUrls) {
|
321733
321735
|
if (Array.isArray(subgraphUrls) && subgraphUrls.length > 0) {
|
321734
|
-
return
|
321736
|
+
return extractBaseUrlBeforeSegment(subgraphUrls[0], "/subgraphs");
|
321735
321737
|
}
|
321736
321738
|
return;
|
321737
321739
|
}
|
@@ -326071,6 +326073,61 @@ function createCommand2() {
|
|
326071
326073
|
});
|
326072
326074
|
}
|
326073
326075
|
|
326076
|
+
// ../hasura/dist/hasura.js
|
326077
|
+
async function trackAllTables(databaseName, client) {
|
326078
|
+
const messages = [];
|
326079
|
+
const getTablesResult = await client({
|
326080
|
+
type: "pg_get_source_tables",
|
326081
|
+
args: { source: databaseName }
|
326082
|
+
});
|
326083
|
+
if (!getTablesResult.ok) {
|
326084
|
+
throw new Error(`Failed to get tables: ${JSON.stringify(getTablesResult.data)}`);
|
326085
|
+
}
|
326086
|
+
const tables = getTablesResult.data;
|
326087
|
+
if (tables.length === 0) {
|
326088
|
+
return {
|
326089
|
+
result: "no-tables",
|
326090
|
+
messages
|
326091
|
+
};
|
326092
|
+
}
|
326093
|
+
messages.push(`Found ${tables.length} tables in database "${databaseName}"`);
|
326094
|
+
await client({
|
326095
|
+
type: "pg_untrack_tables",
|
326096
|
+
args: {
|
326097
|
+
tables: tables.map((table2) => ({ table: table2.name })),
|
326098
|
+
allow_warnings: true
|
326099
|
+
}
|
326100
|
+
});
|
326101
|
+
const trackResult = await client({
|
326102
|
+
type: "pg_track_tables",
|
326103
|
+
args: {
|
326104
|
+
tables: tables.map((table2) => ({ table: table2.name })),
|
326105
|
+
allow_warnings: true
|
326106
|
+
}
|
326107
|
+
});
|
326108
|
+
if (!trackResult.ok) {
|
326109
|
+
throw new Error(`Failed to track tables: ${JSON.stringify(trackResult.data)}`);
|
326110
|
+
}
|
326111
|
+
messages.push(`Successfully tracked ${tables.length} tables`);
|
326112
|
+
return {
|
326113
|
+
result: "success",
|
326114
|
+
messages
|
326115
|
+
};
|
326116
|
+
}
|
326117
|
+
var ClientOptionsSchema3 = exports_external.object({
|
326118
|
+
instance: UrlOrPathSchema2,
|
326119
|
+
accessToken: ApplicationAccessTokenSchema2.optional(),
|
326120
|
+
adminSecret: exports_external.string(),
|
326121
|
+
cache: exports_external.enum([
|
326122
|
+
"default",
|
326123
|
+
"force-cache",
|
326124
|
+
"no-cache",
|
326125
|
+
"no-store",
|
326126
|
+
"only-if-cached",
|
326127
|
+
"reload"
|
326128
|
+
]).optional()
|
326129
|
+
});
|
326130
|
+
|
326074
326131
|
// src/constants/resource-type.ts
|
326075
326132
|
var SETTLEMINT_CLIENT_MAP = {
|
326076
326133
|
application: "application",
|
@@ -326174,67 +326231,10 @@ function hasuraTrackCommand() {
|
|
326174
326231
|
if (!hasuraGraphqlEndpoint || !hasuraAdminSecret) {
|
326175
326232
|
return note("Could not retrieve Hasura endpoint or admin secret. Please check your configuration.");
|
326176
326233
|
}
|
326177
|
-
const
|
326178
|
-
|
326179
|
-
|
326180
|
-
|
326181
|
-
startMessage: `Tracking all tables in Hasura from database "${database}"`,
|
326182
|
-
stopMessage: "Successfully tracked all tables in Hasura",
|
326183
|
-
task: async () => {
|
326184
|
-
const executeHasuraQuery = async (query) => {
|
326185
|
-
const response = await fetch(queryEndpoint, {
|
326186
|
-
method: "POST",
|
326187
|
-
headers: appendHeaders({
|
326188
|
-
"Content-Type": "application/json",
|
326189
|
-
"X-Hasura-Admin-Secret": hasuraAdminSecret
|
326190
|
-
}, {
|
326191
|
-
"x-auth-token": accessToken
|
326192
|
-
}),
|
326193
|
-
body: JSON.stringify(query)
|
326194
|
-
});
|
326195
|
-
if (!response.ok) {
|
326196
|
-
return { ok: false, data: await response.json() };
|
326197
|
-
}
|
326198
|
-
return { ok: true, data: await response.json() };
|
326199
|
-
};
|
326200
|
-
const getTablesResult = await executeHasuraQuery({
|
326201
|
-
type: "pg_get_source_tables",
|
326202
|
-
args: {
|
326203
|
-
source: database
|
326204
|
-
}
|
326205
|
-
});
|
326206
|
-
if (!getTablesResult.ok) {
|
326207
|
-
throw new Error(`Failed to get tables: ${JSON.stringify(getTablesResult.data)}`);
|
326208
|
-
}
|
326209
|
-
const tables = getTablesResult.data;
|
326210
|
-
if (tables.length === 0) {
|
326211
|
-
return { result: "no-tables" };
|
326212
|
-
}
|
326213
|
-
messages.push(`Found ${tables.length} tables in database "${database}"`);
|
326214
|
-
await executeHasuraQuery({
|
326215
|
-
type: "pg_untrack_tables",
|
326216
|
-
args: {
|
326217
|
-
tables: tables.map((table2) => ({
|
326218
|
-
table: table2.name
|
326219
|
-
})),
|
326220
|
-
allow_warnings: true
|
326221
|
-
}
|
326222
|
-
});
|
326223
|
-
const trackResult = await executeHasuraQuery({
|
326224
|
-
type: "pg_track_tables",
|
326225
|
-
args: {
|
326226
|
-
tables: tables.map((table2) => ({
|
326227
|
-
table: table2.name
|
326228
|
-
})),
|
326229
|
-
allow_warnings: true
|
326230
|
-
}
|
326231
|
-
});
|
326232
|
-
if (!trackResult.ok) {
|
326233
|
-
throw new Error(`Failed to track tables: ${JSON.stringify(trackResult.data)}`);
|
326234
|
-
}
|
326235
|
-
messages.push(`Successfully tracked ${tables.length} tables`);
|
326236
|
-
return { result: "success" };
|
326237
|
-
}
|
326234
|
+
const { result, messages } = await trackAllTables(database, {
|
326235
|
+
instance: hasuraGraphqlEndpoint,
|
326236
|
+
accessToken,
|
326237
|
+
adminSecret: hasuraAdminSecret
|
326238
326238
|
});
|
326239
326239
|
for (const message of messages) {
|
326240
326240
|
note(message);
|
@@ -330812,4 +330812,4 @@ async function sdkCliCommand(argv = process.argv) {
|
|
330812
330812
|
// src/cli.ts
|
330813
330813
|
sdkCliCommand();
|
330814
330814
|
|
330815
|
-
//# debugId=
|
330815
|
+
//# debugId=5741BE39990C452264756E2164756E21
|