create-graphene 0.0.19 → 0.0.21

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.
Files changed (2) hide show
  1. package/dist/cli.js +40 -3
  2. package/package.json +2 -1
package/dist/cli.js CHANGED
@@ -11,7 +11,7 @@ import { styleText } from "node:util";
11
11
  // ../cli/package.json
12
12
  var package_default = {
13
13
  name: "@graphenedata/cli",
14
- version: "0.0.19",
14
+ version: "0.0.21",
15
15
  private: true,
16
16
  license: "Elastic-2.0",
17
17
  author: "Graphene Systems Inc",
@@ -68,7 +68,7 @@ var package_default = {
68
68
  devDependencies: {
69
69
  "@aws-sdk/client-athena": "^3.1049.0",
70
70
  "@clickhouse/client": "^1.18.2",
71
- "@duckdb/node-api": "1.3.2-alpha.26",
71
+ "@duckdb/node-api": "1.5.3-r.3",
72
72
  "@google-cloud/bigquery": "^8.3.1",
73
73
  "@types/fs-extra": "^11.0.4",
74
74
  "@types/node": "^20.0.0",
@@ -84,7 +84,7 @@ var package_default = {
84
84
  peerDependencies: {
85
85
  "@aws-sdk/client-athena": "^3.1049.0",
86
86
  "@clickhouse/client": "^1.18.2",
87
- "@duckdb/node-api": "1.3.2-alpha.26",
87
+ "@duckdb/node-api": "1.5.3-r.3",
88
88
  "@google-cloud/bigquery": "^8.2.0",
89
89
  pg: "8.13.3",
90
90
  "snowflake-sdk": "2.4.0"
@@ -187,6 +187,8 @@ function renderTemplate({ answers, cliVersion }) {
187
187
  if (answers.defaultNamespace) graphene.defaultNamespace = answers.defaultNamespace;
188
188
  if (answers.database === "duckdb") {
189
189
  if (answers.duckdbPath) graphene.duckdb = { path: answers.duckdbPath };
190
+ } else if (answers.database === "motherduck") {
191
+ graphene.motherduck = { database: answers.motherduckDatabase || "sample_data" };
190
192
  } else if (answers.database === "snowflake") {
191
193
  graphene.snowflake = { account: answers.snowflakeAccount || "", username: answers.snowflakeUsername || "" };
192
194
  } else if (answers.database === "bigquery") {
@@ -277,6 +279,7 @@ function renderCodexConfig() {
277
279
  ].join("\n") + "\n";
278
280
  }
279
281
  function databaseLabel(database) {
282
+ if (database === "motherduck") return "MotherDuck";
280
283
  if (database === "snowflake") return "Snowflake";
281
284
  if (database === "bigquery") return "BigQuery";
282
285
  if (database === "clickhouse") return "ClickHouse";
@@ -291,6 +294,8 @@ function renderEnvFile(answers) {
291
294
  if (answers.database === "snowflake") {
292
295
  lines.push(`SNOWFLAKE_PRI_KEY_PATH=${answers.snowflakeKeyPath || ""}`);
293
296
  if (answers.snowflakePassphrase) lines.push(`SNOWFLAKE_PRI_PASSPHRASE=${answers.snowflakePassphrase}`);
297
+ } else if (answers.database === "motherduck") {
298
+ lines.push(`MOTHERDUCK_TOKEN=${answers.motherduckToken || ""}`);
294
299
  } else if (answers.database === "bigquery") {
295
300
  lines.push(`GOOGLE_APPLICATION_CREDENTIALS=${answers.bigqueryKeyPath || ""}`);
296
301
  } else if (answers.database === "clickhouse") {
@@ -382,6 +387,25 @@ function getWarehouseClientVersion(packageName) {
382
387
  return version;
383
388
  }
384
389
  async function promptWarehouseCredentials(answers, input, output) {
390
+ if (answers.database === "motherduck") {
391
+ answers.motherduckDatabase = unwrapPrompt(
392
+ await clack.text({
393
+ message: "MotherDuck database",
394
+ placeholder: "sample_data",
395
+ initialValue: answers.motherduckDatabase || "sample_data",
396
+ validate: validateRequired("MotherDuck database is required"),
397
+ ...promptOptions(input, output)
398
+ })
399
+ );
400
+ answers.motherduckToken = unwrapPrompt(
401
+ await clack.password({
402
+ message: "MotherDuck token",
403
+ validate: validateRequired("MotherDuck token is required"),
404
+ ...promptOptions(input, output)
405
+ })
406
+ );
407
+ return;
408
+ }
385
409
  if (answers.database === "snowflake") {
386
410
  answers.snowflakeAccount = unwrapPrompt(
387
411
  await clack.text({
@@ -562,12 +586,24 @@ async function withTimeout(promise, ms, message) {
562
586
  }
563
587
  }
564
588
  function runWarehouseCredentialTest(answers) {
589
+ if (answers.database === "motherduck") return testMotherDuckCredentials(answers);
565
590
  if (answers.database === "snowflake") return testSnowflakeCredentials(answers);
566
591
  if (answers.database === "bigquery") return testBigQueryCredentials(answers);
567
592
  if (answers.database === "clickhouse") return testClickHouseCredentials(answers);
568
593
  if (answers.database === "postgres") return testPostgresCredentials(answers);
569
594
  return Promise.resolve();
570
595
  }
596
+ async function testMotherDuckCredentials(answers) {
597
+ let { DuckDBInstance } = await import("@duckdb/node-api");
598
+ let db = await DuckDBInstance.create(`md:${answers.motherduckDatabase || "sample_data"}`, { motherduck_token: answers.motherduckToken || "", custom_user_agent: "graphene" });
599
+ let conn = await db.connect();
600
+ try {
601
+ await conn.runAndReadAll("SELECT 1");
602
+ } finally {
603
+ conn.closeSync();
604
+ db.closeSync();
605
+ }
606
+ }
571
607
  async function testSnowflakeCredentials(answers) {
572
608
  let snowflake = (await import("snowflake-sdk")).default;
573
609
  snowflake.configure({ logLevel: "WARN", logFilePath: "/dev/null" });
@@ -664,6 +700,7 @@ async function collectAnswers({ options, packageManager, input, output }) {
664
700
  message: "Database",
665
701
  options: [
666
702
  { value: "snowflake", label: "Snowflake" },
703
+ { value: "motherduck", label: "MotherDuck" },
667
704
  { value: "bigquery", label: "BigQuery" },
668
705
  { value: "clickhouse", label: "ClickHouse" },
669
706
  { value: "postgres", label: "Postgres" },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-graphene",
3
- "version": "0.0.19",
3
+ "version": "0.0.21",
4
4
  "license": "Elastic-2.0",
5
5
  "author": "Graphene Systems Inc",
6
6
  "repository": {
@@ -27,6 +27,7 @@
27
27
  "dependencies": {
28
28
  "@clack/prompts": "^1.2.0",
29
29
  "@clickhouse/client": "^1.18.2",
30
+ "@duckdb/node-api": "1.5.3-r.3",
30
31
  "@google-cloud/bigquery": "^8.3.1",
31
32
  "pg": "8.13.3",
32
33
  "snowflake-sdk": "2.4.0"