create-db 1.0.1-pr43-DC-4828-json-flag-17105267979.0 → 1.0.1-pr43-DC-4828-json-flag-17106021047.0
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/index.js +17 -3
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -75,6 +75,8 @@ Usage:
|
|
|
75
75
|
Options:
|
|
76
76
|
${chalk.yellow(`--region <region>, -r <region>`)} Specify the region (e.g., ${regionExamples})
|
|
77
77
|
${chalk.yellow("--interactive, -i")} Run in interactive mode to select a region and create the database
|
|
78
|
+
${chalk.yellow("--json, -j")} Output machine-readable JSON and exit
|
|
79
|
+
${chalk.yellow("--list-regions")} List available regions and exit
|
|
78
80
|
${chalk.yellow("--help, -h")} Show this help message
|
|
79
81
|
|
|
80
82
|
Examples:
|
|
@@ -82,6 +84,7 @@ Examples:
|
|
|
82
84
|
${chalk.gray(`npx ${CLI_NAME} -r us-east-1`)}
|
|
83
85
|
${chalk.gray(`npx ${CLI_NAME} --interactive`)}
|
|
84
86
|
${chalk.gray(`npx ${CLI_NAME} -i`)}
|
|
87
|
+
${chalk.gray(`npx ${CLI_NAME} --json --region us-east-1`)}
|
|
85
88
|
`);
|
|
86
89
|
process.exit(0);
|
|
87
90
|
}
|
|
@@ -317,12 +320,22 @@ async function createDatabase(name, region, returnJson = false) {
|
|
|
317
320
|
const database = result.data ? result.data.database : result.databases?.[0];
|
|
318
321
|
const projectId = result.data ? result.data.id : result.id;
|
|
319
322
|
const prismaConn = database?.connectionString;
|
|
323
|
+
|
|
320
324
|
const directConnDetails = result.data
|
|
321
325
|
? database?.apiKeys?.[0]?.directConnection
|
|
322
326
|
: result.databases?.[0]?.apiKeys?.[0]?.ppgDirectConnection;
|
|
323
|
-
const
|
|
324
|
-
?
|
|
325
|
-
:
|
|
327
|
+
const directUser = directConnDetails?.user
|
|
328
|
+
? encodeURIComponent(directConnDetails.user)
|
|
329
|
+
: "";
|
|
330
|
+
const directPass = directConnDetails?.pass
|
|
331
|
+
? encodeURIComponent(directConnDetails.pass)
|
|
332
|
+
: "";
|
|
333
|
+
const directHost = directConnDetails?.host;
|
|
334
|
+
const directConn =
|
|
335
|
+
directConnDetails && directHost
|
|
336
|
+
? `postgresql://${directUser}:${directPass}@${directHost}/postgres`
|
|
337
|
+
: null;
|
|
338
|
+
|
|
326
339
|
const claimUrl = `${CLAIM_DB_WORKER_URL}?projectID=${projectId}&utm_source=${CLI_NAME}&utm_medium=cli`;
|
|
327
340
|
const expiryDate = new Date(Date.now() + 24 * 60 * 60 * 1000);
|
|
328
341
|
|
|
@@ -426,6 +439,7 @@ async function main() {
|
|
|
426
439
|
rawArgs.includes("--interactive") || rawArgs.includes("-i"),
|
|
427
440
|
"has-help-flag": rawArgs.includes("--help") || rawArgs.includes("-h"),
|
|
428
441
|
"has-list-regions-flag": rawArgs.includes("--list-regions"),
|
|
442
|
+
"has-json-flag": rawArgs.includes("--json") || rawArgs.includes("-j"),
|
|
429
443
|
"node-version": process.version,
|
|
430
444
|
platform: process.platform,
|
|
431
445
|
arch: process.arch,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "create-db",
|
|
3
|
-
"version": "1.0.1-pr43-DC-4828-json-flag-
|
|
3
|
+
"version": "1.0.1-pr43-DC-4828-json-flag-17106021047.0",
|
|
4
4
|
"description": "Instantly create a temporary Prisma Postgres database with one command, then claim and persist it in your Prisma Data Platform project when ready.",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"author": "",
|