@settlemint/sdk-cli 0.6.44 → 0.6.45
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 +43 -22
- package/dist/cli.js.map +3 -3
- package/package.json +3 -3
package/dist/cli.js
CHANGED
|
@@ -256368,24 +256368,27 @@ init_index_chunk();
|
|
|
256368
256368
|
// src/commands/codegen/codegen-hasura.ts
|
|
256369
256369
|
async function codegenHasura(env) {
|
|
256370
256370
|
const gqlEndpoint = env.SETTLEMINT_HASURA_ENDPOINT;
|
|
256371
|
-
if (!gqlEndpoint) {
|
|
256372
|
-
return;
|
|
256373
|
-
}
|
|
256374
256371
|
const accessToken = env.SETTLEMINT_ACCESS_TOKEN;
|
|
256375
256372
|
const adminSecret = env.SETTLEMINT_HASURA_ADMIN_SECRET;
|
|
256376
|
-
|
|
256373
|
+
const databaseUrl = env.SETTLEMINT_HASURA_DATABASE_URL;
|
|
256374
|
+
const databaseUsername = env.SETTLEMINT_HASURA_DATABASE_USERNAME;
|
|
256375
|
+
const databasePassword = env.SETTLEMINT_HASURA_DATABASE_PASSWORD;
|
|
256376
|
+
if (!gqlEndpoint || !accessToken || !adminSecret) {
|
|
256377
|
+
console.warn("[Codegen] Missing required Hasura environment variables");
|
|
256377
256378
|
return;
|
|
256378
256379
|
}
|
|
256379
|
-
|
|
256380
|
-
|
|
256381
|
-
|
|
256382
|
-
|
|
256383
|
-
|
|
256384
|
-
|
|
256385
|
-
|
|
256386
|
-
|
|
256387
|
-
|
|
256388
|
-
|
|
256380
|
+
if (gqlEndpoint && accessToken && adminSecret) {
|
|
256381
|
+
await generateSchema({
|
|
256382
|
+
input: gqlEndpoint,
|
|
256383
|
+
output: "hasura-schema.graphql",
|
|
256384
|
+
tsconfig: undefined,
|
|
256385
|
+
headers: {
|
|
256386
|
+
"x-hasura-admin-secret": adminSecret,
|
|
256387
|
+
"x-auth-token": accessToken
|
|
256388
|
+
}
|
|
256389
|
+
});
|
|
256390
|
+
}
|
|
256391
|
+
const hasuraTemplate = `import { createHasuraClient } from "@settlemint/sdk-hasura";
|
|
256389
256392
|
import type { introspection } from "@schemas/hasura-env";
|
|
256390
256393
|
|
|
256391
256394
|
export const { client: hasuraClient, graphql: hasuraGraphql } = createHasuraClient<{
|
|
@@ -256401,11 +256404,29 @@ export const { client: hasuraClient, graphql: hasuraGraphql } = createHasuraClie
|
|
|
256401
256404
|
Timestamp: string;
|
|
256402
256405
|
};
|
|
256403
256406
|
}>({
|
|
256404
|
-
instance: process.env.SETTLEMINT_HASURA_ENDPOINT
|
|
256405
|
-
accessToken: process.env.SETTLEMINT_ACCESS_TOKEN
|
|
256406
|
-
adminSecret: process.env.SETTLEMINT_HASURA_ADMIN_SECRET
|
|
256407
|
+
instance: process.env.SETTLEMINT_HASURA_ENDPOINT ?? "",
|
|
256408
|
+
accessToken: process.env.SETTLEMINT_ACCESS_TOKEN ?? "", // undefined in browser, by design to not leak the secrets
|
|
256409
|
+
adminSecret: process.env.SETTLEMINT_HASURA_ADMIN_SECRET ?? "", // undefined in browser, by design to not leak the secrets
|
|
256407
256410
|
});`;
|
|
256408
|
-
await writeTemplate(
|
|
256411
|
+
await writeTemplate(hasuraTemplate, "/lib/settlemint", "hasura.ts");
|
|
256412
|
+
const drizzleTemplate = `import { createDrizzleClient } from "@settlemint/sdk-hasura";
|
|
256413
|
+
import type { NodePgDatabase } from "drizzle-orm/node-postgres";
|
|
256414
|
+
|
|
256415
|
+
export const drizzleClient: NodePgDatabase = createDrizzleClient({
|
|
256416
|
+
databaseUrl: process.env.SETTLEMINT_HASURA_DATABASE_URL ?? "",
|
|
256417
|
+
database: process.env.SETTLEMINT_HASURA_DATABASE_DB_NAME ?? "",
|
|
256418
|
+
user: process.env.SETTLEMINT_HASURA_DATABASE_USER ?? "",
|
|
256419
|
+
password: process.env.SETTLEMINT_HASURA_DATABASE_PASSWORD ?? "",
|
|
256420
|
+
maxPoolSize: Number(process.env.SETTLEMINT_HASURA_DATABASE_MAX_POOL_SIZE),
|
|
256421
|
+
idleTimeoutMillis: Number(process.env.SETTLEMINT_HASURA_DATABASE_IDLE_TIMEOUT),
|
|
256422
|
+
connectionTimeoutMillis: Number(process.env.SETTLEMINT_HASURA_DATABASE_CONNECTION_TIMEOUT),
|
|
256423
|
+
maxRetries: Number(process.env.SETTLEMINT_HASURA_DATABASE_MAX_RETRIES),
|
|
256424
|
+
retryDelayMs: Number(process.env.SETTLEMINT_HASURA_DATABASE_RETRY_DELAY),
|
|
256425
|
+
});`;
|
|
256426
|
+
await writeTemplate(drizzleTemplate, "/lib/settlemint", "drizzle.ts");
|
|
256427
|
+
if (!databaseUrl || !databaseUsername || !databasePassword) {
|
|
256428
|
+
console.warn("[Codegen] Missing database environment variables");
|
|
256429
|
+
}
|
|
256409
256430
|
}
|
|
256410
256431
|
|
|
256411
256432
|
// src/commands/codegen/codegen-portal.ts
|
|
@@ -272358,7 +272379,7 @@ function connectCommand() {
|
|
|
272358
272379
|
var package_default = {
|
|
272359
272380
|
name: "@settlemint/sdk-cli",
|
|
272360
272381
|
description: "SettleMint SDK, integrate SettleMint into your application with ease.",
|
|
272361
|
-
version: "0.6.
|
|
272382
|
+
version: "0.6.45",
|
|
272362
272383
|
type: "module",
|
|
272363
272384
|
private: false,
|
|
272364
272385
|
license: "FSL-1.1-MIT",
|
|
@@ -272409,8 +272430,8 @@ var package_default = {
|
|
|
272409
272430
|
"@inquirer/input": "4.1.0",
|
|
272410
272431
|
"@inquirer/password": "4.0.3",
|
|
272411
272432
|
"@inquirer/select": "4.0.3",
|
|
272412
|
-
"@settlemint/sdk-js": "0.6.
|
|
272413
|
-
"@settlemint/sdk-utils": "0.6.
|
|
272433
|
+
"@settlemint/sdk-js": "0.6.45",
|
|
272434
|
+
"@settlemint/sdk-utils": "0.6.45",
|
|
272414
272435
|
"get-tsconfig": "4.8.1",
|
|
272415
272436
|
giget: "1.2.3"
|
|
272416
272437
|
},
|
|
@@ -275759,4 +275780,4 @@ sdkcli.parseAsync(process.argv).catch((reason) => {
|
|
|
275759
275780
|
cancel2(reason);
|
|
275760
275781
|
});
|
|
275761
275782
|
|
|
275762
|
-
//# debugId=
|
|
275783
|
+
//# debugId=882E87057EB9420B64756E2164756E21
|