@settlemint/sdk-cli 0.6.44-main35b90d3 → 0.6.44-pr1f4fff3
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 +34 -22
- package/dist/cli.js.map +3 -3
- package/package.json +3 -3
package/dist/cli.js
CHANGED
|
@@ -256368,24 +256368,24 @@ 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
|
-
if (!accessToken || !adminSecret) {
|
|
256373
|
+
if (!gqlEndpoint || !accessToken || !adminSecret) {
|
|
256374
|
+
console.warn("[Codegen] Missing required Hasura environment variables");
|
|
256377
256375
|
return;
|
|
256378
256376
|
}
|
|
256379
|
-
|
|
256380
|
-
|
|
256381
|
-
|
|
256382
|
-
|
|
256383
|
-
|
|
256384
|
-
|
|
256385
|
-
|
|
256386
|
-
|
|
256387
|
-
|
|
256388
|
-
|
|
256377
|
+
if (gqlEndpoint && accessToken && adminSecret) {
|
|
256378
|
+
await generateSchema({
|
|
256379
|
+
input: gqlEndpoint,
|
|
256380
|
+
output: "hasura-schema.graphql",
|
|
256381
|
+
tsconfig: undefined,
|
|
256382
|
+
headers: {
|
|
256383
|
+
"x-hasura-admin-secret": adminSecret,
|
|
256384
|
+
"x-auth-token": accessToken
|
|
256385
|
+
}
|
|
256386
|
+
});
|
|
256387
|
+
}
|
|
256388
|
+
const hasuraTemplate = `import { createHasuraClient } from "@settlemint/sdk-hasura";
|
|
256389
256389
|
import type { introspection } from "@schemas/hasura-env";
|
|
256390
256390
|
|
|
256391
256391
|
export const { client: hasuraClient, graphql: hasuraGraphql } = createHasuraClient<{
|
|
@@ -256401,11 +256401,23 @@ export const { client: hasuraClient, graphql: hasuraGraphql } = createHasuraClie
|
|
|
256401
256401
|
Timestamp: string;
|
|
256402
256402
|
};
|
|
256403
256403
|
}>({
|
|
256404
|
-
instance: process.env.SETTLEMINT_HASURA_ENDPOINT
|
|
256405
|
-
accessToken: process.env.SETTLEMINT_ACCESS_TOKEN
|
|
256406
|
-
adminSecret: process.env.SETTLEMINT_HASURA_ADMIN_SECRET
|
|
256404
|
+
instance: process.env.SETTLEMINT_HASURA_ENDPOINT ?? "",
|
|
256405
|
+
accessToken: process.env.SETTLEMINT_ACCESS_TOKEN ?? "", // undefined in browser, by design to not leak the secrets
|
|
256406
|
+
adminSecret: process.env.SETTLEMINT_HASURA_ADMIN_SECRET ?? "", // undefined in browser, by design to not leak the secrets
|
|
256407
|
+
});`;
|
|
256408
|
+
await writeTemplate(hasuraTemplate, "/lib/settlemint", "hasura.ts");
|
|
256409
|
+
const drizzleTemplate = `import { createDrizzleClient } from "@settlemint/sdk-hasura";
|
|
256410
|
+
|
|
256411
|
+
export const drizzleClient = createDrizzleClient({
|
|
256412
|
+
databaseUrl: process.env.SETTLEMINT_HASURA_DATABASE_URL ?? "",
|
|
256413
|
+
database: process.env.SETTLEMINT_HASURA_DATABASE_DB_NAME ?? "",
|
|
256414
|
+
user: process.env.SETTLEMINT_HASURA_DATABASE_USER ?? "",
|
|
256415
|
+
password: process.env.SETTLEMINT_HASURA_DATABASE_PASSWORD ?? "",
|
|
256416
|
+
maxPoolSize: process.env.SETTLEMINT_HASURA_DATABASE_MAX_POOL_SIZE,
|
|
256417
|
+
idleTimeoutMillis: process.env.SETTLEMINT_HASURA_DATABASE_IDLE_TIMEOUT,
|
|
256418
|
+
connectionTimeoutMillis: process.env.SETTLEMINT_HASURA_DATABASE_CONNECTION_TIMEOUT,
|
|
256407
256419
|
});`;
|
|
256408
|
-
await writeTemplate(
|
|
256420
|
+
await writeTemplate(drizzleTemplate, "/lib/settlemint", "drizzle.ts");
|
|
256409
256421
|
}
|
|
256410
256422
|
|
|
256411
256423
|
// src/commands/codegen/codegen-portal.ts
|
|
@@ -272358,7 +272370,7 @@ function connectCommand() {
|
|
|
272358
272370
|
var package_default = {
|
|
272359
272371
|
name: "@settlemint/sdk-cli",
|
|
272360
272372
|
description: "SettleMint SDK, integrate SettleMint into your application with ease.",
|
|
272361
|
-
version: "0.6.44-
|
|
272373
|
+
version: "0.6.44-pr1f4fff3",
|
|
272362
272374
|
type: "module",
|
|
272363
272375
|
private: false,
|
|
272364
272376
|
license: "FSL-1.1-MIT",
|
|
@@ -272409,8 +272421,8 @@ var package_default = {
|
|
|
272409
272421
|
"@inquirer/input": "4.1.0",
|
|
272410
272422
|
"@inquirer/password": "4.0.3",
|
|
272411
272423
|
"@inquirer/select": "4.0.3",
|
|
272412
|
-
"@settlemint/sdk-js": "0.6.44-
|
|
272413
|
-
"@settlemint/sdk-utils": "0.6.44-
|
|
272424
|
+
"@settlemint/sdk-js": "0.6.44-pr1f4fff3",
|
|
272425
|
+
"@settlemint/sdk-utils": "0.6.44-pr1f4fff3",
|
|
272414
272426
|
"get-tsconfig": "4.8.1",
|
|
272415
272427
|
giget: "1.2.3"
|
|
272416
272428
|
},
|
|
@@ -275759,4 +275771,4 @@ sdkcli.parseAsync(process.argv).catch((reason) => {
|
|
|
275759
275771
|
cancel2(reason);
|
|
275760
275772
|
});
|
|
275761
275773
|
|
|
275762
|
-
//# debugId=
|
|
275774
|
+
//# debugId=D46FD3ADB8119D8E64756E2164756E21
|