create-db 1.0.8-pr51-DC-4933-env-flag-17283424880.0 → 1.0.8-pr51-DC-4933-env-flag-17293927997.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 +9 -8
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -513,7 +513,7 @@ async function createDatabase(name, region, userAgent, silent = false) {
|
|
|
513
513
|
? `postgresql://${directUser}:${directPass}@${directHost}${directPort}/${directDbName}?sslmode=require`
|
|
514
514
|
: null;
|
|
515
515
|
|
|
516
|
-
const claimUrl = `${CLAIM_DB_WORKER_URL}?projectID=${projectId}&utm_source=${userAgent}&utm_medium=cli`;
|
|
516
|
+
const claimUrl = `${CLAIM_DB_WORKER_URL}?projectID=${projectId}&utm_source=${userAgent || CLI_NAME}&utm_medium=cli`;
|
|
517
517
|
const expiryDate = new Date(Date.now() + 24 * 60 * 60 * 1000);
|
|
518
518
|
|
|
519
519
|
if (silent && !result.error) {
|
|
@@ -540,7 +540,7 @@ async function createDatabase(name, region, userAgent, silent = false) {
|
|
|
540
540
|
error: "api_error",
|
|
541
541
|
message: result.error.message || "Unknown error",
|
|
542
542
|
details: result.error,
|
|
543
|
-
status: result.error.status,
|
|
543
|
+
status: result.error.status ?? resp.status,
|
|
544
544
|
};
|
|
545
545
|
}
|
|
546
546
|
|
|
@@ -652,8 +652,11 @@ async function main() {
|
|
|
652
652
|
}
|
|
653
653
|
|
|
654
654
|
let name = new Date().toISOString();
|
|
655
|
-
let
|
|
656
|
-
|
|
655
|
+
let region = flags.region || "us-east-1";
|
|
656
|
+
if (!flags.region || !flags.interactive) {
|
|
657
|
+
const userLocation = await detectUserLocation();
|
|
658
|
+
region = getRegionClosestToLocation(userLocation) || region;
|
|
659
|
+
}
|
|
657
660
|
let chooseRegionPrompt = false;
|
|
658
661
|
|
|
659
662
|
if (flags.help) {
|
|
@@ -714,10 +717,8 @@ async function main() {
|
|
|
714
717
|
console.error(result.message || "Unknown error");
|
|
715
718
|
process.exit(1);
|
|
716
719
|
}
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
"\n\n# Claim your database at: " + result.claimUrl
|
|
720
|
-
);
|
|
720
|
+
console.log(`DATABASE_URL="${result.directConnectionString}"`);
|
|
721
|
+
console.error("\n# Claim your database at: " + result.claimUrl);
|
|
721
722
|
process.exit(0);
|
|
722
723
|
} catch (e) {
|
|
723
724
|
console.error(e?.message || String(e));
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "create-db",
|
|
3
|
-
"version": "1.0.8-pr51-DC-4933-env-flag-
|
|
3
|
+
"version": "1.0.8-pr51-DC-4933-env-flag-17293927997.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": "",
|