neon-new 0.14.0 → 0.15.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.
Files changed (40) hide show
  1. package/README.md +2 -0
  2. package/dist/cli.d.ts.map +1 -1
  3. package/dist/cli.js +1 -2
  4. package/dist/cli.js.map +1 -1
  5. package/dist/lib/claim-command.d.ts.map +1 -1
  6. package/dist/lib/claim-command.js +1 -2
  7. package/dist/lib/claim-command.js.map +1 -1
  8. package/dist/lib/instant-postgres.d.ts.map +1 -1
  9. package/dist/lib/instant-postgres.js +1 -2
  10. package/dist/lib/instant-postgres.js.map +1 -1
  11. package/dist/lib/seed-database.d.ts.map +1 -1
  12. package/dist/lib/seed-database.js +1 -2
  13. package/dist/lib/seed-database.js.map +1 -1
  14. package/dist/lib/texts.d.ts.map +1 -1
  15. package/dist/lib/texts.js +8 -2
  16. package/dist/lib/texts.js.map +1 -1
  17. package/dist/lib/types.d.ts.map +1 -1
  18. package/dist/lib/types.js +1 -1
  19. package/dist/lib/utils/args.d.ts.map +1 -1
  20. package/dist/lib/utils/args.js +1 -2
  21. package/dist/lib/utils/args.js.map +1 -1
  22. package/dist/lib/utils/create-db.d.ts.map +1 -1
  23. package/dist/lib/utils/create-db.js +1 -2
  24. package/dist/lib/utils/create-db.js.map +1 -1
  25. package/dist/lib/utils/detect-claim-url.d.ts.map +1 -1
  26. package/dist/lib/utils/detect-claim-url.js +1 -2
  27. package/dist/lib/utils/detect-claim-url.js.map +1 -1
  28. package/dist/lib/utils/format.d.ts.map +1 -1
  29. package/dist/lib/utils/format.js +1 -1
  30. package/dist/lib/utils/format.js.map +1 -1
  31. package/dist/lib/utils/fs.d.ts.map +1 -1
  32. package/dist/lib/utils/fs.js +1 -2
  33. package/dist/lib/utils/fs.js.map +1 -1
  34. package/dist/lib/utils/urls.d.ts.map +1 -1
  35. package/dist/lib/utils/urls.js +1 -1
  36. package/dist/lib/utils/urls.js.map +1 -1
  37. package/dist/lib/utils/validate.d.ts.map +1 -1
  38. package/dist/lib/utils/validate.js +1 -1
  39. package/dist/lib/utils/validate.js.map +1 -1
  40. package/package.json +2 -2
package/README.md CHANGED
@@ -4,6 +4,8 @@
4
4
 
5
5
  ---
6
6
 
7
+ > **Requirements:** Node.js >= 20.19.
8
+
7
9
  ## CLI Usage
8
10
 
9
11
  The CLI provides a default referrer value, so the `--ref` flag is optional.
package/dist/cli.d.ts.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"cli.d.ts","names":[],"sources":["../src/cli.ts"],"sourcesContent":[],"mappings":";iBAae,IAAA,CAAA,CAAI,EAAA,OAAA,CAAA,IAAA,CAAA"}
1
+ {"version":3,"file":"cli.d.ts","names":[],"sources":["../src/cli.ts"],"mappings":";iBAae,IAAA,CAAA,CAAI,EAAA,OAAA,CAAA,IAAA,CAAA"}
package/dist/cli.js CHANGED
@@ -8,7 +8,6 @@ import { validateEnvKey, validateEnvPath } from "./lib/utils/validate.js";
8
8
  import { intro, isCancel, log, outro, spinner, text } from "@clack/prompts";
9
9
  import { cristal } from "gradient-string";
10
10
  import { bold } from "yoctocolors";
11
-
12
11
  //#region src/cli.ts
13
12
  async function main() {
14
13
  const { command, yes: shouldUseDefaults, ...flags } = getArgs();
@@ -133,7 +132,7 @@ async function main() {
133
132
  outro(`${bold("Connection String")}:\n\t${connString}`);
134
133
  }
135
134
  await main();
136
-
137
135
  //#endregion
138
136
  export { main as default };
137
+
139
138
  //# sourceMappingURL=cli.js.map
package/dist/cli.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"cli.js","names":[],"sources":["../src/cli.ts"],"sourcesContent":["#!/usr/bin/env node\n\nimport { intro, isCancel, log, outro, spinner, text } from \"@clack/prompts\";\nimport { cristal } from \"gradient-string\";\nimport { bold } from \"yoctocolors\";\nimport { claim } from \"./lib/claim-command.js\";\nimport { instantPostgres } from \"./lib/instant-postgres.js\";\nimport { INTRO_ART, messages } from \"./lib/texts.js\";\nimport type { Defaults } from \"./lib/types.js\";\nimport { DEFAULTS, getArgs } from \"./lib/utils/args.js\";\nimport { prepEnv } from \"./lib/utils/fs.js\";\nimport { validateEnvKey, validateEnvPath } from \"./lib/utils/validate.js\";\n\nasync function main() {\n\tconst { command, yes: shouldUseDefaults, ...flags } = getArgs();\n\n\t// Handle claim command\n\tif (command === \"claim\") {\n\t\tconst envPath = flags.env || DEFAULTS.dotEnvPath;\n\t\tawait claim(envPath, flags.prefix);\n\t\treturn;\n\t}\n\n\tif (!shouldUseDefaults) {\n\t\tconsole.log(cristal(INTRO_ART));\n\t} else {\n\t\tconsole.log(\"\\n\\n\");\n\t}\n\n\tconst s = spinner();\n\n\tintro(messages.welcome);\n\tif (!shouldUseDefaults) {\n\t\tlog.info(messages.nonInteractive);\n\t}\n\tconst userInput: Partial<Defaults> = {};\n\n\tlet connString: string;\n\n\tif (shouldUseDefaults) {\n\t\tconst envPath = flags.env || DEFAULTS.dotEnvPath;\n\t\tconst envKey = flags.key || DEFAULTS.dotEnvKey;\n\t\tconst envPrefix = flags.prefix || DEFAULTS.envPrefix;\n\t\tconst referrer = flags.ref || DEFAULTS.referrer;\n\n\t\tprepEnv(envPath, envKey);\n\t\ts.start(messages.generating);\n\n\t\tconst seedConfig = flags.seed\n\t\t\t? { type: \"sql-script\" as const, path: flags.seed }\n\t\t\t: DEFAULTS.seed;\n\n\t\tconst { databaseUrl } = await instantPostgres({\n\t\t\tdotEnvFile: envPath,\n\t\t\tdotEnvKey: envKey,\n\t\t\treferrer,\n\t\t\tseed: seedConfig,\n\t\t\tenvPrefix: envPrefix,\n\t\t\tsettings: {\n\t\t\t\tlogicalReplication: flags.logicalReplication,\n\t\t\t},\n\t\t});\n\t\tconnString = databaseUrl;\n\t} else {\n\t\t/**\n\t\t * Get Env file path (e.g.: .env)\n\t\t */\n\t\tif (flags.env) {\n\t\t\tconst isEnvPathInvalid = validateEnvPath(flags.env);\n\n\t\t\tif (isEnvPathInvalid) {\n\t\t\t\tlog.error(isEnvPathInvalid.message);\n\t\t\t\tprocess.exit(1);\n\t\t\t}\n\n\t\t\tlog.step(messages.info.defaultEnvFilePath(flags.env));\n\t\t\tuserInput.dotEnvPath = flags.env;\n\t\t} else {\n\t\t\tuserInput.dotEnvPath = (await text({\n\t\t\t\tmessage: messages.questions.dotEnvFilePath,\n\t\t\t\tvalidate: validateEnvPath,\n\t\t\t})) as Defaults[\"dotEnvPath\"];\n\n\t\t\t// user cancelled with CTRL+C\n\t\t\tif (isCancel(userInput.dotEnvPath)) {\n\t\t\t\toutro(messages.info.userCancelled);\n\t\t\t\tprocess.exit(1);\n\t\t\t}\n\n\t\t\t// user entered an empty string -- opted for default value.\n\t\t\tif (!userInput.dotEnvPath) {\n\t\t\t\tuserInput.dotEnvPath = DEFAULTS.dotEnvPath;\n\t\t\t\tlog.step(\n\t\t\t\t\tmessages.info.defaultEnvFilePath(userInput.dotEnvPath),\n\t\t\t\t);\n\t\t\t}\n\t\t}\n\n\t\t// Always set dotEnvKey from flag if present\n\t\tif (flags.key) {\n\t\t\tconst isEnvKeyInvalid = validateEnvKey(flags.key);\n\t\t\tif (isEnvKeyInvalid) {\n\t\t\t\tlog.error(isEnvKeyInvalid.message);\n\t\t\t\tprocess.exit(1);\n\t\t\t}\n\t\t\tlog.step(messages.info.defaultEnvKey(flags.key));\n\t\t\tuserInput.dotEnvKey = flags.key;\n\t\t}\n\n\t\t// Prompt for dotEnvKey if not set by flag\n\t\tif (!userInput.dotEnvKey) {\n\t\t\tuserInput.dotEnvKey = (await text({\n\t\t\t\tmessage: messages.questions.dotEnvKey,\n\t\t\t\tvalidate: validateEnvKey,\n\t\t\t})) as Defaults[\"dotEnvKey\"];\n\n\t\t\t// user cancelled with CTRL+C\n\t\t\tif (isCancel(userInput.dotEnvKey)) {\n\t\t\t\toutro(messages.info.userCancelled);\n\t\t\t\tprocess.exit(1);\n\t\t\t}\n\n\t\t\t// User accepted default value.\n\t\t\tif (!userInput.dotEnvKey) {\n\t\t\t\tuserInput.dotEnvKey = DEFAULTS.dotEnvKey;\n\t\t\t\tlog.step(messages.info.defaultEnvKey(userInput.dotEnvKey));\n\t\t\t}\n\t\t}\n\n\t\tif (!flags.seed) {\n\t\t\tuserInput.seed = {\n\t\t\t\ttype: \"sql-script\",\n\t\t\t\tpath: await text({\n\t\t\t\t\tmessage: messages.questions.seedPath,\n\t\t\t\t}),\n\t\t\t} as Defaults[\"seed\"];\n\n\t\t\tif (!userInput.seed?.path) {\n\t\t\t\tuserInput.seed = DEFAULTS.seed;\n\t\t\t}\n\t\t} else {\n\t\t\tuserInput.seed = {\n\t\t\t\ttype: \"sql-script\",\n\t\t\t\tpath: flags.seed,\n\t\t\t};\n\t\t}\n\n\t\t// Always set envPrefix from flag if present\n\t\tif (flags.prefix) {\n\t\t\tlog.step(messages.info.defaultPrefix(flags.prefix));\n\t\t\tuserInput.envPrefix = flags.prefix;\n\t\t}\n\n\t\t// Prompt for envPrefix if not set by flag\n\t\tif (!userInput.envPrefix) {\n\t\t\tuserInput.envPrefix = (await text({\n\t\t\t\tmessage: messages.questions.prefix,\n\t\t\t})) as Defaults[\"envPrefix\"];\n\n\t\t\t// user cancelled with CTRL+C\n\t\t\tif (isCancel(userInput.envPrefix)) {\n\t\t\t\toutro(messages.info.userCancelled);\n\t\t\t\tprocess.exit(1);\n\t\t\t}\n\n\t\t\t// User accepted default value.\n\t\t\tif (!userInput.envPrefix) {\n\t\t\t\tuserInput.envPrefix = DEFAULTS.envPrefix;\n\t\t\t\tlog.step(messages.info.defaultPrefix(userInput.envPrefix));\n\t\t\t}\n\t\t}\n\n\t\tprepEnv(userInput.dotEnvPath, userInput.dotEnvKey);\n\n\t\ts.start(messages.generating);\n\n\t\tconst referrer = flags.ref || DEFAULTS.referrer;\n\n\t\tconst { databaseUrl } = await instantPostgres({\n\t\t\tdotEnvFile: userInput.dotEnvPath,\n\t\t\tdotEnvKey: userInput.dotEnvKey,\n\t\t\treferrer,\n\t\t\tseed: userInput.seed,\n\t\t\tenvPrefix: userInput.envPrefix,\n\t\t\tsettings: {\n\t\t\t\tlogicalReplication: flags.logicalReplication,\n\t\t\t},\n\t\t});\n\t\tconnString = databaseUrl;\n\t}\n\ts.stop(\"Done!\");\n\toutro(`${bold(\"Connection String\")}:\\n\\t${connString}`);\n}\n\nawait main();\n\nexport default main;\n"],"mappings":"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"}
1
+ {"version":3,"file":"cli.js","names":[],"sources":["../src/cli.ts"],"sourcesContent":["#!/usr/bin/env node\n\nimport { intro, isCancel, log, outro, spinner, text } from \"@clack/prompts\";\nimport { cristal } from \"gradient-string\";\nimport { bold } from \"yoctocolors\";\nimport { claim } from \"./lib/claim-command.js\";\nimport { instantPostgres } from \"./lib/instant-postgres.js\";\nimport { INTRO_ART, messages } from \"./lib/texts.js\";\nimport type { Defaults } from \"./lib/types.js\";\nimport { DEFAULTS, getArgs } from \"./lib/utils/args.js\";\nimport { prepEnv } from \"./lib/utils/fs.js\";\nimport { validateEnvKey, validateEnvPath } from \"./lib/utils/validate.js\";\n\nasync function main() {\n\tconst { command, yes: shouldUseDefaults, ...flags } = getArgs();\n\n\t// Handle claim command\n\tif (command === \"claim\") {\n\t\tconst envPath = flags.env || DEFAULTS.dotEnvPath;\n\t\tawait claim(envPath, flags.prefix);\n\t\treturn;\n\t}\n\n\tif (!shouldUseDefaults) {\n\t\tconsole.log(cristal(INTRO_ART));\n\t} else {\n\t\tconsole.log(\"\\n\\n\");\n\t}\n\n\tconst s = spinner();\n\n\tintro(messages.welcome);\n\tif (!shouldUseDefaults) {\n\t\tlog.info(messages.nonInteractive);\n\t}\n\tconst userInput: Partial<Defaults> = {};\n\n\tlet connString: string;\n\n\tif (shouldUseDefaults) {\n\t\tconst envPath = flags.env || DEFAULTS.dotEnvPath;\n\t\tconst envKey = flags.key || DEFAULTS.dotEnvKey;\n\t\tconst envPrefix = flags.prefix || DEFAULTS.envPrefix;\n\t\tconst referrer = flags.ref || DEFAULTS.referrer;\n\n\t\tprepEnv(envPath, envKey);\n\t\ts.start(messages.generating);\n\n\t\tconst seedConfig = flags.seed\n\t\t\t? { type: \"sql-script\" as const, path: flags.seed }\n\t\t\t: DEFAULTS.seed;\n\n\t\tconst { databaseUrl } = await instantPostgres({\n\t\t\tdotEnvFile: envPath,\n\t\t\tdotEnvKey: envKey,\n\t\t\treferrer,\n\t\t\tseed: seedConfig,\n\t\t\tenvPrefix: envPrefix,\n\t\t\tsettings: {\n\t\t\t\tlogicalReplication: flags.logicalReplication,\n\t\t\t},\n\t\t});\n\t\tconnString = databaseUrl;\n\t} else {\n\t\t/**\n\t\t * Get Env file path (e.g.: .env)\n\t\t */\n\t\tif (flags.env) {\n\t\t\tconst isEnvPathInvalid = validateEnvPath(flags.env);\n\n\t\t\tif (isEnvPathInvalid) {\n\t\t\t\tlog.error(isEnvPathInvalid.message);\n\t\t\t\tprocess.exit(1);\n\t\t\t}\n\n\t\t\tlog.step(messages.info.defaultEnvFilePath(flags.env));\n\t\t\tuserInput.dotEnvPath = flags.env;\n\t\t} else {\n\t\t\tuserInput.dotEnvPath = (await text({\n\t\t\t\tmessage: messages.questions.dotEnvFilePath,\n\t\t\t\tvalidate: validateEnvPath,\n\t\t\t})) as Defaults[\"dotEnvPath\"];\n\n\t\t\t// user cancelled with CTRL+C\n\t\t\tif (isCancel(userInput.dotEnvPath)) {\n\t\t\t\toutro(messages.info.userCancelled);\n\t\t\t\tprocess.exit(1);\n\t\t\t}\n\n\t\t\t// user entered an empty string -- opted for default value.\n\t\t\tif (!userInput.dotEnvPath) {\n\t\t\t\tuserInput.dotEnvPath = DEFAULTS.dotEnvPath;\n\t\t\t\tlog.step(\n\t\t\t\t\tmessages.info.defaultEnvFilePath(userInput.dotEnvPath),\n\t\t\t\t);\n\t\t\t}\n\t\t}\n\n\t\t// Always set dotEnvKey from flag if present\n\t\tif (flags.key) {\n\t\t\tconst isEnvKeyInvalid = validateEnvKey(flags.key);\n\t\t\tif (isEnvKeyInvalid) {\n\t\t\t\tlog.error(isEnvKeyInvalid.message);\n\t\t\t\tprocess.exit(1);\n\t\t\t}\n\t\t\tlog.step(messages.info.defaultEnvKey(flags.key));\n\t\t\tuserInput.dotEnvKey = flags.key;\n\t\t}\n\n\t\t// Prompt for dotEnvKey if not set by flag\n\t\tif (!userInput.dotEnvKey) {\n\t\t\tuserInput.dotEnvKey = (await text({\n\t\t\t\tmessage: messages.questions.dotEnvKey,\n\t\t\t\tvalidate: validateEnvKey,\n\t\t\t})) as Defaults[\"dotEnvKey\"];\n\n\t\t\t// user cancelled with CTRL+C\n\t\t\tif (isCancel(userInput.dotEnvKey)) {\n\t\t\t\toutro(messages.info.userCancelled);\n\t\t\t\tprocess.exit(1);\n\t\t\t}\n\n\t\t\t// User accepted default value.\n\t\t\tif (!userInput.dotEnvKey) {\n\t\t\t\tuserInput.dotEnvKey = DEFAULTS.dotEnvKey;\n\t\t\t\tlog.step(messages.info.defaultEnvKey(userInput.dotEnvKey));\n\t\t\t}\n\t\t}\n\n\t\tif (!flags.seed) {\n\t\t\tuserInput.seed = {\n\t\t\t\ttype: \"sql-script\",\n\t\t\t\tpath: await text({\n\t\t\t\t\tmessage: messages.questions.seedPath,\n\t\t\t\t}),\n\t\t\t} as Defaults[\"seed\"];\n\n\t\t\tif (!userInput.seed?.path) {\n\t\t\t\tuserInput.seed = DEFAULTS.seed;\n\t\t\t}\n\t\t} else {\n\t\t\tuserInput.seed = {\n\t\t\t\ttype: \"sql-script\",\n\t\t\t\tpath: flags.seed,\n\t\t\t};\n\t\t}\n\n\t\t// Always set envPrefix from flag if present\n\t\tif (flags.prefix) {\n\t\t\tlog.step(messages.info.defaultPrefix(flags.prefix));\n\t\t\tuserInput.envPrefix = flags.prefix;\n\t\t}\n\n\t\t// Prompt for envPrefix if not set by flag\n\t\tif (!userInput.envPrefix) {\n\t\t\tuserInput.envPrefix = (await text({\n\t\t\t\tmessage: messages.questions.prefix,\n\t\t\t})) as Defaults[\"envPrefix\"];\n\n\t\t\t// user cancelled with CTRL+C\n\t\t\tif (isCancel(userInput.envPrefix)) {\n\t\t\t\toutro(messages.info.userCancelled);\n\t\t\t\tprocess.exit(1);\n\t\t\t}\n\n\t\t\t// User accepted default value.\n\t\t\tif (!userInput.envPrefix) {\n\t\t\t\tuserInput.envPrefix = DEFAULTS.envPrefix;\n\t\t\t\tlog.step(messages.info.defaultPrefix(userInput.envPrefix));\n\t\t\t}\n\t\t}\n\n\t\tprepEnv(userInput.dotEnvPath, userInput.dotEnvKey);\n\n\t\ts.start(messages.generating);\n\n\t\tconst referrer = flags.ref || DEFAULTS.referrer;\n\n\t\tconst { databaseUrl } = await instantPostgres({\n\t\t\tdotEnvFile: userInput.dotEnvPath,\n\t\t\tdotEnvKey: userInput.dotEnvKey,\n\t\t\treferrer,\n\t\t\tseed: userInput.seed,\n\t\t\tenvPrefix: userInput.envPrefix,\n\t\t\tsettings: {\n\t\t\t\tlogicalReplication: flags.logicalReplication,\n\t\t\t},\n\t\t});\n\t\tconnString = databaseUrl;\n\t}\n\ts.stop(\"Done!\");\n\toutro(`${bold(\"Connection String\")}:\\n\\t${connString}`);\n}\n\nawait main();\n\nexport default main;\n"],"mappings":"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"}
@@ -1 +1 @@
1
- {"version":3,"file":"claim-command.d.ts","names":[],"sources":["../../src/lib/claim-command.ts"],"sourcesContent":[],"mappings":";iBAmBsB,KAAA,0CAGnB"}
1
+ {"version":3,"file":"claim-command.d.ts","names":[],"sources":["../../src/lib/claim-command.ts"],"mappings":";iBAmBsB,KAAA,0CAGnB"}
@@ -2,7 +2,6 @@ import { detectClaimUrl } from "./utils/detect-claim-url.js";
2
2
  import { getDotEnvContent } from "./utils/fs.js";
3
3
  import { log, outro } from "@clack/prompts";
4
4
  import open from "open";
5
-
6
5
  //#region src/lib/claim-command.ts
7
6
  async function openClaimUrl(claimUrl) {
8
7
  try {
@@ -35,7 +34,7 @@ async function claim(dotEnvPath, envPrefix) {
35
34
  return;
36
35
  }
37
36
  }
38
-
39
37
  //#endregion
40
38
  export { claim };
39
+
41
40
  //# sourceMappingURL=claim-command.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"claim-command.js","names":[],"sources":["../../src/lib/claim-command.ts"],"sourcesContent":["import { log, outro } from \"@clack/prompts\";\nimport open from \"open\";\nimport { detectClaimUrl } from \"./utils/detect-claim-url.js\";\nimport { getDotEnvContent } from \"./utils/fs.js\";\n\nasync function openClaimUrl(claimUrl: string): Promise<void> {\n\ttry {\n\t\tlog.success(`URL located. Opening your default browser.`);\n\t\tawait open(claimUrl);\n\t\toutro(`You can also manually open: ${claimUrl}.`);\n\t\tprocess.exit(0);\n\t} catch (error) {\n\t\tlog.error(\n\t\t\terror instanceof Error ? error.message : \"Failed to open claim URL\",\n\t\t);\n\t\tprocess.exit(1);\n\t}\n}\n\nexport async function claim(\n\tdotEnvPath: string,\n\tenvPrefix?: string,\n): Promise<void> {\n\tconst dotEnvContent = getDotEnvContent(dotEnvPath);\n\tlet claimUrl: string | undefined;\n\n\tif (envPrefix) {\n\t\tconst claimUrlKey = `${envPrefix}POSTGRES_CLAIM_URL`;\n\t\tclaimUrl = dotEnvContent[claimUrlKey];\n\n\t\tif (!claimUrl) {\n\t\t\tlog.error(`${claimUrlKey} not found in ${dotEnvPath}.`);\n\t\t\toutro(\n\t\t\t\t`Use \\`neon-new claim -p <prefix>\\` to override URL auto-detection.`,\n\t\t\t);\n\t\t\tprocess.exit(1);\n\t\t} else {\n\t\t\tawait openClaimUrl(claimUrl);\n\t\t\treturn;\n\t\t}\n\t} else {\n\t\tclaimUrl = detectClaimUrl(dotEnvContent, dotEnvPath);\n\t\tawait openClaimUrl(claimUrl);\n\t\treturn;\n\t}\n}\n"],"mappings":";;;;;;AAKA,eAAe,aAAa,UAAiC;AAC5D,KAAI;AACH,MAAI,QAAQ,6CAA6C;AACzD,QAAM,KAAK,SAAS;AACpB,QAAM,+BAA+B,SAAS,GAAG;AACjD,UAAQ,KAAK,EAAE;UACP,OAAO;AACf,MAAI,MACH,iBAAiB,QAAQ,MAAM,UAAU,2BACzC;AACD,UAAQ,KAAK,EAAE;;;AAIjB,eAAsB,MACrB,YACA,WACgB;CAChB,MAAM,gBAAgB,iBAAiB,WAAW;CAClD,IAAI;AAEJ,KAAI,WAAW;EACd,MAAM,cAAc,GAAG,UAAU;AACjC,aAAW,cAAc;AAEzB,MAAI,CAAC,UAAU;AACd,OAAI,MAAM,GAAG,YAAY,gBAAgB,WAAW,GAAG;AACvD,SACC,qEACA;AACD,WAAQ,KAAK,EAAE;SACT;AACN,SAAM,aAAa,SAAS;AAC5B;;QAEK;AACN,aAAW,eAAe,eAAe,WAAW;AACpD,QAAM,aAAa,SAAS;AAC5B"}
1
+ {"version":3,"file":"claim-command.js","names":[],"sources":["../../src/lib/claim-command.ts"],"sourcesContent":["import { log, outro } from \"@clack/prompts\";\nimport open from \"open\";\nimport { detectClaimUrl } from \"./utils/detect-claim-url.js\";\nimport { getDotEnvContent } from \"./utils/fs.js\";\n\nasync function openClaimUrl(claimUrl: string): Promise<void> {\n\ttry {\n\t\tlog.success(`URL located. Opening your default browser.`);\n\t\tawait open(claimUrl);\n\t\toutro(`You can also manually open: ${claimUrl}.`);\n\t\tprocess.exit(0);\n\t} catch (error) {\n\t\tlog.error(\n\t\t\terror instanceof Error ? error.message : \"Failed to open claim URL\",\n\t\t);\n\t\tprocess.exit(1);\n\t}\n}\n\nexport async function claim(\n\tdotEnvPath: string,\n\tenvPrefix?: string,\n): Promise<void> {\n\tconst dotEnvContent = getDotEnvContent(dotEnvPath);\n\tlet claimUrl: string | undefined;\n\n\tif (envPrefix) {\n\t\tconst claimUrlKey = `${envPrefix}POSTGRES_CLAIM_URL`;\n\t\tclaimUrl = dotEnvContent[claimUrlKey];\n\n\t\tif (!claimUrl) {\n\t\t\tlog.error(`${claimUrlKey} not found in ${dotEnvPath}.`);\n\t\t\toutro(\n\t\t\t\t`Use \\`neon-new claim -p <prefix>\\` to override URL auto-detection.`,\n\t\t\t);\n\t\t\tprocess.exit(1);\n\t\t} else {\n\t\t\tawait openClaimUrl(claimUrl);\n\t\t\treturn;\n\t\t}\n\t} else {\n\t\tclaimUrl = detectClaimUrl(dotEnvContent, dotEnvPath);\n\t\tawait openClaimUrl(claimUrl);\n\t\treturn;\n\t}\n}\n"],"mappings":";;;;;AAKA,eAAe,aAAa,UAAiC;CAC5D,IAAI;EACH,IAAI,QAAQ,4CAA4C;EACxD,MAAM,KAAK,QAAQ;EACnB,MAAM,+BAA+B,SAAS,EAAE;EAChD,QAAQ,KAAK,CAAC;CACf,SAAS,OAAO;EACf,IAAI,MACH,iBAAiB,QAAQ,MAAM,UAAU,0BAC1C;EACA,QAAQ,KAAK,CAAC;CACf;AACD;AAEA,eAAsB,MACrB,YACA,WACgB;CAChB,MAAM,gBAAgB,iBAAiB,UAAU;CACjD,IAAI;CAEJ,IAAI,WAAW;EACd,MAAM,cAAc,GAAG,UAAU;EACjC,WAAW,cAAc;EAEzB,IAAI,CAAC,UAAU;GACd,IAAI,MAAM,GAAG,YAAY,gBAAgB,WAAW,EAAE;GACtD,MACC,oEACD;GACA,QAAQ,KAAK,CAAC;EACf,OAAO;GACN,MAAM,aAAa,QAAQ;GAC3B;EACD;CACD,OAAO;EACN,WAAW,eAAe,eAAe,UAAU;EACnD,MAAM,aAAa,QAAQ;EAC3B;CACD;AACD"}
@@ -1 +1 @@
1
- {"version":3,"file":"instant-postgres.d.ts","names":[],"sources":["../../src/lib/instant-postgres.ts"],"sourcesContent":[],"mappings":";;;;;;AAgBA;;;;AAAsC,cAAzB,eAAyB,EAAA,CAAA;EAAA,UAAA;EAAA,SAAA;EAAA,QAAA;EAAA,IAAA;EAAA,SAAA;EAAA,QAAA,EAAA;IAAA;EAAA;AAAA,CAAA,EAOnC,qBAPmC,EAAA,GAOX,OAPW,CAAA;mBAAA,EAAA,MAAA;aAAA,EAAA,MAAA;UAAA,EAAA,MAAA;gBAOnC,EAIc,IAJd;;;;AAqDH;AAA0C,cAA7B,WAA6B,EAAA,CAAA;EAAA,UAAA;EAAA,SAAA;EAAA,QAAA;EAAA,IAAA;EAAA,SAAA;EAAA,QAAA,EAAA;IAAA;EAAA;AAAA,CAAA,EArDvC,qBAqDuC,EAAA,GArDf,OAqDe,CAAA;mBAAlB,EAAA,MAAA;aAAA,EAAA,MAAA;UAAA,EAAA,MAAA;gBAAA,EAjDP,IAiDO;;;;;AArDU,KA4DtB,iBAAA,GAAoB,qBA5DE"}
1
+ {"version":3,"file":"instant-postgres.d.ts","names":[],"sources":["../../src/lib/instant-postgres.ts"],"mappings":";;;;;;AAgBA;;;;AAAsC,cAAzB,eAAyB,EAAA,CAAA;EAAA,UAAA;EAAA,SAAA;EAAA,QAAA;EAAA,IAAA;EAAA,SAAA;EAAA,QAAA,EAAA;IAAA;EAAA;AAAA,CAAA,EAOnC,qBAPmC,EAAA,GAOX,OAPW,CAAA;mBAAA,EAAA,MAAA;aAAA,EAAA,MAAA;UAAA,EAAA,MAAA;gBAOnC,EAIc,IAJd;;;AAA+B;AAqDlC;AAA0C,cAA7B,WAA6B,EAAA,CAAA;EAAA,UAAA;EAAA,SAAA;EAAA,QAAA;EAAA,IAAA;EAAA,SAAA;EAAA,QAAA,EAAA;IAAA;EAAA;AAAA,CAAA,EArDvC,qBAqDuC,EAAA,GArDf,OAqDe,CAAA;mBAAlB,EAAA,MAAA;aAAA,EAAA,MAAA;UAAA,EAAA,MAAA;gBAAA,EAjDP,IAiDO;;;;;AArDU,KA4DtB,iBAAA,GAAoB,qBA5DE"}
@@ -6,7 +6,6 @@ import { createClaimableDatabase } from "./utils/create-db.js";
6
6
  import { getConnectionStrings } from "./utils/format.js";
7
7
  import { log } from "@clack/prompts";
8
8
  import { randomUUID } from "node:crypto";
9
-
10
9
  //#region src/lib/instant-postgres.ts
11
10
  /**
12
11
  * Creates an instant Postgres connection string from Claimable Postgres by Neon
@@ -44,7 +43,7 @@ const instantPostgres = async ({ dotEnvFile = ".env", dotEnvKey = "DATABASE_URL"
44
43
  * @deprecated Use `instantPostgres` instead
45
44
  */
46
45
  const instantNeon = instantPostgres;
47
-
48
46
  //#endregion
49
47
  export { instantNeon, instantPostgres };
48
+
50
49
  //# sourceMappingURL=instant-postgres.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"instant-postgres.js","names":[],"sources":["../../src/lib/instant-postgres.ts"],"sourcesContent":["import { randomUUID } from \"node:crypto\";\nimport { log } from \"@clack/prompts\";\nimport { seedDatabase } from \"./seed-database.js\";\nimport { messages } from \"./texts.js\";\nimport type { InstantPostgresParams } from \"./types.js\";\nimport { createClaimableDatabase } from \"./utils/create-db.js\";\nimport { getConnectionStrings } from \"./utils/format.js\";\nimport { writeToEnv } from \"./utils/fs.js\";\nimport { CLAIMABLE_POSTGRES_URLS } from \"./utils/urls.js\";\n\n/**\n * Creates an instant Postgres connection string from Claimable Postgres by Neon\n * if not already set in the specified .env file.\n * Prompts the user to optionally generate a connection string,\n * saves it to the .env file, and returns the connection string.\n */\nexport const instantPostgres = async ({\n\tdotEnvFile = \".env\",\n\tdotEnvKey = \"DATABASE_URL\",\n\treferrer,\n\tseed = undefined,\n\tenvPrefix = \"PUBLIC_\",\n\tsettings: { logicalReplication = false } = {},\n}: InstantPostgresParams): Promise<{\n\tdatabaseUrlDirect: string;\n\tdatabaseUrl: string;\n\tclaimUrl: string;\n\tclaimExpiresAt: Date;\n}> => {\n\tif (!referrer || referrer.trim() === \"\") {\n\t\tconst { message, ...cause } = messages.errors.referrerIsRequired;\n\n\t\tthrow new Error(message, {\n\t\t\tcause,\n\t\t});\n\t}\n\n\tconst dbId = randomUUID();\n\tconst claimExpiresAt = new Date(Date.now() + 3 * 24 * 60 * 60 * 1000);\n\tconst claimUrl = new URL(CLAIMABLE_POSTGRES_URLS.CLAIM_DATABASE(dbId));\n\n\tconst connString = await createClaimableDatabase({\n\t\tdbId,\n\t\treferrer: `npm:neon-new|${referrer}`,\n\t\tsettings: { logicalReplication },\n\t});\n\tconst { pooler: poolerString, direct: directString } =\n\t\tgetConnectionStrings(connString);\n\n\tawait writeToEnv(\n\t\tdotEnvFile,\n\t\tdotEnvKey,\n\t\tclaimExpiresAt,\n\t\tclaimUrl,\n\t\tdirectString,\n\t\tpoolerString,\n\t\tenvPrefix,\n\t);\n\n\tif (seed) {\n\t\tlog.step(\"Pushing schema to database\");\n\t\tawait seedDatabase(seed.path, directString);\n\t\tlog.success(\"Schema pushed to database\");\n\t}\n\n\treturn {\n\t\tdatabaseUrlDirect: directString,\n\t\tdatabaseUrl: poolerString,\n\t\tclaimUrl: claimUrl.href,\n\t\tclaimExpiresAt,\n\t} as const;\n};\n\n/**\n * @deprecated Use `instantPostgres` instead\n */\nexport const instantNeon = instantPostgres;\n\nexport type { InstantPostgresParams };\n\n/**\n * @deprecated Use `InstantPostgresParams` instead\n */\nexport type InstantNeonParams = InstantPostgresParams;\n"],"mappings":";;;;;;;;;;;;;;;;AAgBA,MAAa,kBAAkB,OAAO,EACrC,aAAa,QACb,YAAY,gBACZ,UACA,OAAO,QACP,YAAY,WACZ,UAAU,EAAE,qBAAqB,UAAU,EAAE,OAMxC;AACL,KAAI,CAAC,YAAY,SAAS,MAAM,KAAK,IAAI;EACxC,MAAM,EAAE,SAAS,GAAG,UAAU,SAAS,OAAO;AAE9C,QAAM,IAAI,MAAM,SAAS,EACxB,OACA,CAAC;;CAGH,MAAM,OAAO,YAAY;CACzB,MAAM,iBAAiB,IAAI,KAAK,KAAK,KAAK,GAAG,OAAc,KAAK,IAAK;CACrE,MAAM,WAAW,IAAI,IAAI,wBAAwB,eAAe,KAAK,CAAC;CAOtE,MAAM,EAAE,QAAQ,cAAc,QAAQ,iBACrC,qBANkB,MAAM,wBAAwB;EAChD;EACA,UAAU,gBAAgB;EAC1B,UAAU,EAAE,oBAAoB;EAChC,CAAC,CAE+B;AAEjC,OAAM,WACL,YACA,WACA,gBACA,UACA,cACA,cACA,UACA;AAED,KAAI,MAAM;AACT,MAAI,KAAK,6BAA6B;AACtC,QAAM,aAAa,KAAK,MAAM,aAAa;AAC3C,MAAI,QAAQ,4BAA4B;;AAGzC,QAAO;EACN,mBAAmB;EACnB,aAAa;EACb,UAAU,SAAS;EACnB;EACA;;;;;AAMF,MAAa,cAAc"}
1
+ {"version":3,"file":"instant-postgres.js","names":[],"sources":["../../src/lib/instant-postgres.ts"],"sourcesContent":["import { randomUUID } from \"node:crypto\";\nimport { log } from \"@clack/prompts\";\nimport { seedDatabase } from \"./seed-database.js\";\nimport { messages } from \"./texts.js\";\nimport type { InstantPostgresParams } from \"./types.js\";\nimport { createClaimableDatabase } from \"./utils/create-db.js\";\nimport { getConnectionStrings } from \"./utils/format.js\";\nimport { writeToEnv } from \"./utils/fs.js\";\nimport { CLAIMABLE_POSTGRES_URLS } from \"./utils/urls.js\";\n\n/**\n * Creates an instant Postgres connection string from Claimable Postgres by Neon\n * if not already set in the specified .env file.\n * Prompts the user to optionally generate a connection string,\n * saves it to the .env file, and returns the connection string.\n */\nexport const instantPostgres = async ({\n\tdotEnvFile = \".env\",\n\tdotEnvKey = \"DATABASE_URL\",\n\treferrer,\n\tseed = undefined,\n\tenvPrefix = \"PUBLIC_\",\n\tsettings: { logicalReplication = false } = {},\n}: InstantPostgresParams): Promise<{\n\tdatabaseUrlDirect: string;\n\tdatabaseUrl: string;\n\tclaimUrl: string;\n\tclaimExpiresAt: Date;\n}> => {\n\tif (!referrer || referrer.trim() === \"\") {\n\t\tconst { message, ...cause } = messages.errors.referrerIsRequired;\n\n\t\tthrow new Error(message, {\n\t\t\tcause,\n\t\t});\n\t}\n\n\tconst dbId = randomUUID();\n\tconst claimExpiresAt = new Date(Date.now() + 3 * 24 * 60 * 60 * 1000);\n\tconst claimUrl = new URL(CLAIMABLE_POSTGRES_URLS.CLAIM_DATABASE(dbId));\n\n\tconst connString = await createClaimableDatabase({\n\t\tdbId,\n\t\treferrer: `npm:neon-new|${referrer}`,\n\t\tsettings: { logicalReplication },\n\t});\n\tconst { pooler: poolerString, direct: directString } =\n\t\tgetConnectionStrings(connString);\n\n\tawait writeToEnv(\n\t\tdotEnvFile,\n\t\tdotEnvKey,\n\t\tclaimExpiresAt,\n\t\tclaimUrl,\n\t\tdirectString,\n\t\tpoolerString,\n\t\tenvPrefix,\n\t);\n\n\tif (seed) {\n\t\tlog.step(\"Pushing schema to database\");\n\t\tawait seedDatabase(seed.path, directString);\n\t\tlog.success(\"Schema pushed to database\");\n\t}\n\n\treturn {\n\t\tdatabaseUrlDirect: directString,\n\t\tdatabaseUrl: poolerString,\n\t\tclaimUrl: claimUrl.href,\n\t\tclaimExpiresAt,\n\t} as const;\n};\n\n/**\n * @deprecated Use `instantPostgres` instead\n */\nexport const instantNeon = instantPostgres;\n\nexport type { InstantPostgresParams };\n\n/**\n * @deprecated Use `InstantPostgresParams` instead\n */\nexport type InstantNeonParams = InstantPostgresParams;\n"],"mappings":";;;;;;;;;;;;;;;AAgBA,MAAa,kBAAkB,OAAO,EACrC,aAAa,QACb,YAAY,gBACZ,UACA,OAAO,KAAA,GACP,YAAY,WACZ,UAAU,EAAE,qBAAqB,UAAU,CAAC,QAMvC;CACL,IAAI,CAAC,YAAY,SAAS,KAAK,MAAM,IAAI;EACxC,MAAM,EAAE,SAAS,GAAG,UAAU,SAAS,OAAO;EAE9C,MAAM,IAAI,MAAM,SAAS,EACxB,MACD,CAAC;CACF;CAEA,MAAM,OAAO,WAAW;CACxB,MAAM,iBAAiB,IAAI,KAAK,KAAK,IAAI,IAAI,OAAc,KAAK,GAAI;CACpE,MAAM,WAAW,IAAI,IAAI,wBAAwB,eAAe,IAAI,CAAC;CAOrE,MAAM,EAAE,QAAQ,cAAc,QAAQ,iBACrC,qBAAqB,MANG,wBAAwB;EAChD;EACA,UAAU,gBAAgB;EAC1B,UAAU,EAAE,mBAAmB;CAChC,CAAC,CAE+B;CAEhC,MAAM,WACL,YACA,WACA,gBACA,UACA,cACA,cACA,SACD;CAEA,IAAI,MAAM;EACT,IAAI,KAAK,4BAA4B;EACrC,MAAM,aAAa,KAAK,MAAM,YAAY;EAC1C,IAAI,QAAQ,2BAA2B;CACxC;CAEA,OAAO;EACN,mBAAmB;EACnB,aAAa;EACb,UAAU,SAAS;EACnB;CACD;AACD;;;;AAKA,MAAa,cAAc"}
@@ -1 +1 @@
1
- {"version":3,"file":"seed-database.d.ts","names":[],"sources":["../../src/lib/seed-database.ts"],"sourcesContent":[],"mappings":";iBAGsB,YAAA,oDAEG"}
1
+ {"version":3,"file":"seed-database.d.ts","names":[],"sources":["../../src/lib/seed-database.ts"],"mappings":";iBAGsB,YAAA,oDAEG"}
@@ -1,13 +1,12 @@
1
1
  import { getSqlCommands } from "./utils/fs.js";
2
2
  import { neon } from "@neondatabase/serverless";
3
-
4
3
  //#region src/lib/seed-database.ts
5
4
  async function seedDatabase(schemaFilePath, connectionString) {
6
5
  const client = neon(connectionString);
7
6
  const commands = getSqlCommands(schemaFilePath);
8
7
  for (const command of commands) await client.query(command);
9
8
  }
10
-
11
9
  //#endregion
12
10
  export { seedDatabase };
11
+
13
12
  //# sourceMappingURL=seed-database.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"seed-database.js","names":[],"sources":["../../src/lib/seed-database.ts"],"sourcesContent":["import { neon } from \"@neondatabase/serverless\";\nimport { getSqlCommands } from \"./utils/fs.js\";\n\nexport async function seedDatabase(\n\tschemaFilePath: string,\n\tconnectionString: string,\n) {\n\tconst client = neon(connectionString);\n\tconst commands = getSqlCommands(schemaFilePath);\n\n\tfor (const command of commands) {\n\t\tawait client.query(command);\n\t}\n}\n"],"mappings":";;;;AAGA,eAAsB,aACrB,gBACA,kBACC;CACD,MAAM,SAAS,KAAK,iBAAiB;CACrC,MAAM,WAAW,eAAe,eAAe;AAE/C,MAAK,MAAM,WAAW,SACrB,OAAM,OAAO,MAAM,QAAQ"}
1
+ {"version":3,"file":"seed-database.js","names":[],"sources":["../../src/lib/seed-database.ts"],"sourcesContent":["import { neon } from \"@neondatabase/serverless\";\nimport { getSqlCommands } from \"./utils/fs.js\";\n\nexport async function seedDatabase(\n\tschemaFilePath: string,\n\tconnectionString: string,\n) {\n\tconst client = neon(connectionString);\n\tconst commands = getSqlCommands(schemaFilePath);\n\n\tfor (const command of commands) {\n\t\tawait client.query(command);\n\t}\n}\n"],"mappings":";;;AAGA,eAAsB,aACrB,gBACA,kBACC;CACD,MAAM,SAAS,KAAK,gBAAgB;CACpC,MAAM,WAAW,eAAe,cAAc;CAE9C,KAAK,MAAM,WAAW,UACrB,MAAM,OAAO,MAAM,OAAO;AAE5B"}
@@ -1 +1 @@
1
- {"version":3,"file":"texts.d.ts","names":[],"sources":["../../src/lib/texts.ts"],"sourcesContent":[],"mappings":";cAGa,SAAA;AAAA,cAcA,QAdS,EAAA;EAcT"}
1
+ {"version":3,"file":"texts.d.ts","names":[],"sources":["../../src/lib/texts.ts"],"mappings":";cAGa,SAAA;AAAA,cAcA,QAdS,EAAA;EAcT"}
package/dist/lib/texts.js CHANGED
@@ -1,6 +1,5 @@
1
1
  import { DEFAULTS } from "./utils/args.js";
2
2
  import { bgBlack, bold, greenBright } from "yoctocolors";
3
-
4
3
  //#region src/lib/texts.ts
5
4
  const INTRO_ART = `
6
5
 
@@ -16,6 +15,13 @@ const INTRO_ART = `
16
15
 
17
16
  `;
18
17
  const messages = {
18
+ /**
19
+ * these messages must be short and concise
20
+ * exceeding 2 lines trigger a rendering issue
21
+ * in @clack/prompts
22
+ *
23
+ * @see https://github.com/bombshell-dev/clack/issues/132
24
+ */
19
25
  welcome: `Let's get you set with a Postgres database on ${bgBlack(greenBright(bold(" Neon ")))}.`,
20
26
  nonInteractive: "`neon-new --yes` for non-interactive flow with defaults.",
21
27
  generating: "Generating your database... ",
@@ -45,7 +51,7 @@ const messages = {
45
51
  }
46
52
  }
47
53
  };
48
-
49
54
  //#endregion
50
55
  export { INTRO_ART, messages };
56
+
51
57
  //# sourceMappingURL=texts.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"texts.js","names":[],"sources":["../../src/lib/texts.ts"],"sourcesContent":["import { bgBlack, bold, greenBright } from \"yoctocolors\";\nimport { DEFAULTS } from \"./utils/args.js\";\n\nexport const INTRO_ART = `\n\n\n ▟████████████▙\n ██ ██\n ██ ▗▅▖ ██ https://neon.com\n ██ ████▙ ██ ├── /docs\n ██ ██ ▜████ └── /discord\n ██ ██ ▜█▛\n ▜██████▛\n\n\n`;\n\nexport const messages = {\n\t/**\n\t * these messages must be short and concise\n\t * exceeding 2 lines trigger a rendering issue\n\t * in @clack/prompts\n\t *\n\t * @see https://github.com/bombshell-dev/clack/issues/132\n\t */\n\twelcome: `Let's get you set with a Postgres database on ${bgBlack(greenBright(bold(\" Neon \")))}.`,\n\tnonInteractive: \"`neon-new --yes` for non-interactive flow with defaults.\",\n\tgenerating: \"Generating your database... \",\n\tenvKeyExistsExit:\n\t\t\"Please try again or select a different key for your connection string.\",\n\tquestions: {\n\t\tdotEnvFilePath: `Enter the path to your environment file (default: ${DEFAULTS.dotEnvPath})`,\n\t\tdotEnvKey: `Enter the key for the database connection string (default: ${DEFAULTS.dotEnvKey})`,\n\t\tseedPath: `Enter the path to your seed (.sql) file (default: ${\n\t\t\tDEFAULTS.seed?.path || \"none\"\n\t\t})`,\n\t\tprefix: `Enter the prefix for public environment variables (default: ${DEFAULTS.envPrefix})`,\n\t},\n\tinfo: {\n\t\tdotEnvFileNotFound: \"No .env file found, creating one.\",\n\t\tuserCancelled: \"Prompt cancelled by user.\",\n\t\tdefaultEnvKey: (dotEnvKey: string) =>\n\t\t\t`using ${dotEnvKey} as the environment variable key`,\n\t\tdefaultEnvFilePath: (dotEnvPath: string) =>\n\t\t\t`using ${dotEnvPath} as the .env file`,\n\t\tdefaultPrefix: (prefix: string) =>\n\t\t\t`using ${prefix} as the prefix for public environment variables`,\n\t},\n\n\terrors: {\n\t\tinvalidEnvFile: \"Invalid .env file format \\n\",\n\t\tenvKeyExists: (dotEnvKey: string, dotEnvFile: string) =>\n\t\t\t`${dotEnvKey} already exists in ${dotEnvFile}`,\n\t\tfailedToParseEnvFile: \"Failed to parse .env file\",\n\t\treferrerIsRequired: {\n\t\t\tmessage: \"referrer parameter is required\",\n\t\t\tdescription:\n\t\t\t\t\"The referrer helps track usage for the Open Source Program\",\n\t\t\thint: \"instantPostgres({ referrer: 'your-app-name' })\",\n\t\t\tdocs: \"For more information, visit: https://neon.com/docs/reference/instagres\",\n\t\t},\n\t},\n} as const;\n"],"mappings":";;;;AAGA,MAAa,YAAY;;;;;;;;;;;;;AAczB,MAAa,WAAW;CAQvB,SAAS,iDAAiD,QAAQ,YAAY,KAAK,SAAS,CAAC,CAAC,CAAC;CAC/F,gBAAgB;CAChB,YAAY;CACZ,kBACC;CACD,WAAW;EACV,gBAAgB,qDAAqD,SAAS,WAAW;EACzF,WAAW,8DAA8D,SAAS,UAAU;EAC5F,UAAU,qDACT,SAAS,MAAM,QAAQ,OACvB;EACD,QAAQ,+DAA+D,SAAS,UAAU;EAC1F;CACD,MAAM;EACL,oBAAoB;EACpB,eAAe;EACf,gBAAgB,cACf,SAAS,UAAU;EACpB,qBAAqB,eACpB,SAAS,WAAW;EACrB,gBAAgB,WACf,SAAS,OAAO;EACjB;CAED,QAAQ;EACP,gBAAgB;EAChB,eAAe,WAAmB,eACjC,GAAG,UAAU,qBAAqB;EACnC,sBAAsB;EACtB,oBAAoB;GACnB,SAAS;GACT,aACC;GACD,MAAM;GACN,MAAM;GACN;EACD;CACD"}
1
+ {"version":3,"file":"texts.js","names":[],"sources":["../../src/lib/texts.ts"],"sourcesContent":["import { bgBlack, bold, greenBright } from \"yoctocolors\";\nimport { DEFAULTS } from \"./utils/args.js\";\n\nexport const INTRO_ART = `\n\n\n ▟████████████▙\n ██ ██\n ██ ▗▅▖ ██ https://neon.com\n ██ ████▙ ██ ├── /docs\n ██ ██ ▜████ └── /discord\n ██ ██ ▜█▛\n ▜██████▛\n\n\n`;\n\nexport const messages = {\n\t/**\n\t * these messages must be short and concise\n\t * exceeding 2 lines trigger a rendering issue\n\t * in @clack/prompts\n\t *\n\t * @see https://github.com/bombshell-dev/clack/issues/132\n\t */\n\twelcome: `Let's get you set with a Postgres database on ${bgBlack(greenBright(bold(\" Neon \")))}.`,\n\tnonInteractive: \"`neon-new --yes` for non-interactive flow with defaults.\",\n\tgenerating: \"Generating your database... \",\n\tenvKeyExistsExit:\n\t\t\"Please try again or select a different key for your connection string.\",\n\tquestions: {\n\t\tdotEnvFilePath: `Enter the path to your environment file (default: ${DEFAULTS.dotEnvPath})`,\n\t\tdotEnvKey: `Enter the key for the database connection string (default: ${DEFAULTS.dotEnvKey})`,\n\t\tseedPath: `Enter the path to your seed (.sql) file (default: ${\n\t\t\tDEFAULTS.seed?.path || \"none\"\n\t\t})`,\n\t\tprefix: `Enter the prefix for public environment variables (default: ${DEFAULTS.envPrefix})`,\n\t},\n\tinfo: {\n\t\tdotEnvFileNotFound: \"No .env file found, creating one.\",\n\t\tuserCancelled: \"Prompt cancelled by user.\",\n\t\tdefaultEnvKey: (dotEnvKey: string) =>\n\t\t\t`using ${dotEnvKey} as the environment variable key`,\n\t\tdefaultEnvFilePath: (dotEnvPath: string) =>\n\t\t\t`using ${dotEnvPath} as the .env file`,\n\t\tdefaultPrefix: (prefix: string) =>\n\t\t\t`using ${prefix} as the prefix for public environment variables`,\n\t},\n\n\terrors: {\n\t\tinvalidEnvFile: \"Invalid .env file format \\n\",\n\t\tenvKeyExists: (dotEnvKey: string, dotEnvFile: string) =>\n\t\t\t`${dotEnvKey} already exists in ${dotEnvFile}`,\n\t\tfailedToParseEnvFile: \"Failed to parse .env file\",\n\t\treferrerIsRequired: {\n\t\t\tmessage: \"referrer parameter is required\",\n\t\t\tdescription:\n\t\t\t\t\"The referrer helps track usage for the Open Source Program\",\n\t\t\thint: \"instantPostgres({ referrer: 'your-app-name' })\",\n\t\t\tdocs: \"For more information, visit: https://neon.com/docs/reference/instagres\",\n\t\t},\n\t},\n} as const;\n"],"mappings":";;;AAGA,MAAa,YAAY;;;;;;;;;;;;;AAczB,MAAa,WAAW;;;;;;;;CAQvB,SAAS,iDAAiD,QAAQ,YAAY,KAAK,QAAQ,CAAC,CAAC,EAAE;CAC/F,gBAAgB;CAChB,YAAY;CACZ,kBACC;CACD,WAAW;EACV,gBAAgB,qDAAqD,SAAS,WAAW;EACzF,WAAW,8DAA8D,SAAS,UAAU;EAC5F,UAAU,qDACT,SAAS,MAAM,QAAQ,OACvB;EACD,QAAQ,+DAA+D,SAAS,UAAU;CAC3F;CACA,MAAM;EACL,oBAAoB;EACpB,eAAe;EACf,gBAAgB,cACf,SAAS,UAAU;EACpB,qBAAqB,eACpB,SAAS,WAAW;EACrB,gBAAgB,WACf,SAAS,OAAO;CAClB;CAEA,QAAQ;EACP,gBAAgB;EAChB,eAAe,WAAmB,eACjC,GAAG,UAAU,qBAAqB;EACnC,sBAAsB;EACtB,oBAAoB;GACnB,SAAS;GACT,aACC;GACD,MAAM;GACN,MAAM;EACP;CACD;AACD"}
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","names":[],"sources":["../../src/lib/types.ts"],"sourcesContent":[],"mappings":";KAAY,SAAA;EAAA,IAAA,EAAA,YAAS;EAeJ,IAAA,EAAA,MAAA;AAWjB,CAAA;;;;;;;;;;;UAXiB,qBAAA;;;;SAIT;;;;;;UAOS,QAAA;;;SAGT"}
1
+ {"version":3,"file":"types.d.ts","names":[],"sources":["../../src/lib/types.ts"],"mappings":";KAAY,SAAA;EAAA,IAAA,EAAA,YAAS;EAeJ,IAAA,EAAA,MAAA;AAWjB,CAAA;;;;;;;;;;;UAXiB,qBAAA;;;;SAIT;;;;;;UAOS,QAAA;;;SAGT"}
package/dist/lib/types.js CHANGED
@@ -1 +1 @@
1
- export { };
1
+ export {};
@@ -1 +1 @@
1
- {"version":3,"file":"args.d.ts","names":[],"sources":["../../../src/lib/utils/args.ts"],"sourcesContent":[],"mappings":";;;cAKa,UAAU;UAWN,UAAA;EAXJ,GAAA,CAAA,EAAA,OASZ;EAEgB,GAAA,CAAA,EAAA,MAAA;EAYD,GAAA,CAAA,EAAA,MAAO;;;;;;;;iBAAP,OAAA,CAAA,GAAW"}
1
+ {"version":3,"file":"args.d.ts","names":[],"sources":["../../../src/lib/utils/args.ts"],"mappings":";;;cAKa,UAAU;UAWN,UAAA;EAXJ,GAAA,CAAA,EAAA,OASZ;EAEgB,GAAA,CAAA,EAAA,MAAA;EAYD,GAAA,CAAA,EAAA,MAAO;;;;;;;;iBAAP,OAAA,CAAA,GAAW"}
@@ -1,7 +1,6 @@
1
1
  import { bold, underline } from "yoctocolors";
2
2
  import yargs from "yargs";
3
3
  import { hideBin } from "yargs/helpers";
4
-
5
4
  //#region src/lib/utils/args.ts
6
5
  const DEFAULTS = {
7
6
  dotEnvPath: "./.env",
@@ -64,7 +63,7 @@ function getArgs() {
64
63
  command
65
64
  };
66
65
  }
67
-
68
66
  //#endregion
69
67
  export { DEFAULTS, getArgs };
68
+
70
69
  //# sourceMappingURL=args.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"args.js","names":[],"sources":["../../../src/lib/utils/args.ts"],"sourcesContent":["import yargs from \"yargs\";\nimport { hideBin } from \"yargs/helpers\";\nimport { bold, underline } from \"yoctocolors\";\nimport type { Defaults } from \"../types.js\";\n\nexport const DEFAULTS: Defaults = {\n\tdotEnvPath: \"./.env\",\n\tdotEnvKey: \"DATABASE_URL\",\n\tseed: undefined,\n\tenvPrefix: \"PUBLIC_\",\n\treferrer: \"npm:neon-new/cli\",\n\tsettings: {\n\t\tlogicalReplication: false,\n\t},\n};\n\nexport interface ParsedArgs {\n\tyes?: boolean;\n\tenv?: string;\n\tkey?: string;\n\tseed?: string;\n\tprefix?: string;\n\tref?: string;\n\tlogicalReplication?: boolean;\n\thelp?: boolean;\n\tcommand: string;\n}\n\nexport function getArgs(): ParsedArgs | never {\n\tconst argv = yargs(hideBin(process.argv))\n\t\t.scriptName(\"neon-new\")\n\t\t.usage(\"Usage: $0 [command] [options]\")\n\t\t.help()\n\t\t.version(false)\n\t\t.strict()\n\t\t.parserConfiguration({\n\t\t\t\"camel-case-expansion\": true,\n\t\t\t\"strip-aliased\": true,\n\t\t\t\"strip-dashed\": true,\n\t\t})\n\t\t.command(\"$0\", \"Create a new database (default command)\", {})\n\t\t.command(\"claim\", \"Open the claim URL from your .env file\", {})\n\t\t.group(\"logical-replication\", bold(\"Postgres Settings:\"))\n\t\t.option(\"logical-replication\", {\n\t\t\talias: \"L\",\n\t\t\ttype: \"boolean\",\n\t\t\tdescription: \"Enable logical replication\",\n\t\t\tdefault: false,\n\t\t})\n\t\t.option(\"yes\", {\n\t\t\talias: \"y\",\n\t\t\ttype: \"boolean\",\n\t\t\tdescription: \"Skip prompts / use defaults\",\n\t\t\tdefault: false,\n\t\t})\n\t\t.option(\"env\", {\n\t\t\talias: \"e\",\n\t\t\ttype: \"string\",\n\t\t\tdescription: \".env file path\",\n\t\t\tdefaultDescription: DEFAULTS.dotEnvPath,\n\t\t})\n\t\t.option(\"key\", {\n\t\t\talias: \"k\",\n\t\t\ttype: \"string\",\n\t\t\tdescription: \"connection string key\",\n\t\t\tdefaultDescription: DEFAULTS.dotEnvKey,\n\t\t})\n\t\t.option(\"seed\", {\n\t\t\talias: \"s\",\n\t\t\ttype: \"string\",\n\t\t\tdescription: \"Path to the seed (.sql) file\",\n\t\t\tdefaultDescription: DEFAULTS.seed?.path || \"none\",\n\t\t})\n\t\t.option(\"prefix\", {\n\t\t\talias: \"p\",\n\t\t\ttype: \"string\",\n\t\t\tdescription: \"Public env_var prefix\",\n\t\t\tdefaultDescription: DEFAULTS.envPrefix,\n\t\t})\n\t\t.option(\"ref\", {\n\t\t\talias: \"r\",\n\t\t\ttype: \"string\",\n\t\t\tdescription: \"Referrer id\",\n\t\t\tdefaultDescription: DEFAULTS.referrer,\n\t\t})\n\t\t.epilogue(`For more information: ${underline(\"https://neon.new\")}`)\n\t\t.parseSync();\n\n\tconst command = argv._[0]?.toString() || \"create\";\n\n\treturn {\n\t\tyes: argv.yes,\n\t\tenv: argv.env,\n\t\tkey: argv.key,\n\t\tseed: argv.seed,\n\t\tprefix: argv.prefix,\n\t\tref: argv.ref,\n\t\tlogicalReplication: argv.logicalReplication,\n\t\tcommand,\n\t};\n}\n"],"mappings":";;;;;AAKA,MAAa,WAAqB;CACjC,YAAY;CACZ,WAAW;CACX,MAAM;CACN,WAAW;CACX,UAAU;CACV,UAAU,EACT,oBAAoB,OACpB;CACD;AAcD,SAAgB,UAA8B;CAC7C,MAAM,OAAO,MAAM,QAAQ,QAAQ,KAAK,CAAC,CACvC,WAAW,WAAW,CACtB,MAAM,gCAAgC,CACtC,MAAM,CACN,QAAQ,MAAM,CACd,QAAQ,CACR,oBAAoB;EACpB,wBAAwB;EACxB,iBAAiB;EACjB,gBAAgB;EAChB,CAAC,CACD,QAAQ,MAAM,2CAA2C,EAAE,CAAC,CAC5D,QAAQ,SAAS,0CAA0C,EAAE,CAAC,CAC9D,MAAM,uBAAuB,KAAK,qBAAqB,CAAC,CACxD,OAAO,uBAAuB;EAC9B,OAAO;EACP,MAAM;EACN,aAAa;EACb,SAAS;EACT,CAAC,CACD,OAAO,OAAO;EACd,OAAO;EACP,MAAM;EACN,aAAa;EACb,SAAS;EACT,CAAC,CACD,OAAO,OAAO;EACd,OAAO;EACP,MAAM;EACN,aAAa;EACb,oBAAoB,SAAS;EAC7B,CAAC,CACD,OAAO,OAAO;EACd,OAAO;EACP,MAAM;EACN,aAAa;EACb,oBAAoB,SAAS;EAC7B,CAAC,CACD,OAAO,QAAQ;EACf,OAAO;EACP,MAAM;EACN,aAAa;EACb,oBAAoB,SAAS,MAAM,QAAQ;EAC3C,CAAC,CACD,OAAO,UAAU;EACjB,OAAO;EACP,MAAM;EACN,aAAa;EACb,oBAAoB,SAAS;EAC7B,CAAC,CACD,OAAO,OAAO;EACd,OAAO;EACP,MAAM;EACN,aAAa;EACb,oBAAoB,SAAS;EAC7B,CAAC,CACD,SAAS,yBAAyB,UAAU,mBAAmB,GAAG,CAClE,WAAW;CAEb,MAAM,UAAU,KAAK,EAAE,IAAI,UAAU,IAAI;AAEzC,QAAO;EACN,KAAK,KAAK;EACV,KAAK,KAAK;EACV,KAAK,KAAK;EACV,MAAM,KAAK;EACX,QAAQ,KAAK;EACb,KAAK,KAAK;EACV,oBAAoB,KAAK;EACzB;EACA"}
1
+ {"version":3,"file":"args.js","names":[],"sources":["../../../src/lib/utils/args.ts"],"sourcesContent":["import yargs from \"yargs\";\nimport { hideBin } from \"yargs/helpers\";\nimport { bold, underline } from \"yoctocolors\";\nimport type { Defaults } from \"../types.js\";\n\nexport const DEFAULTS: Defaults = {\n\tdotEnvPath: \"./.env\",\n\tdotEnvKey: \"DATABASE_URL\",\n\tseed: undefined,\n\tenvPrefix: \"PUBLIC_\",\n\treferrer: \"npm:neon-new/cli\",\n\tsettings: {\n\t\tlogicalReplication: false,\n\t},\n};\n\nexport interface ParsedArgs {\n\tyes?: boolean;\n\tenv?: string;\n\tkey?: string;\n\tseed?: string;\n\tprefix?: string;\n\tref?: string;\n\tlogicalReplication?: boolean;\n\thelp?: boolean;\n\tcommand: string;\n}\n\nexport function getArgs(): ParsedArgs | never {\n\tconst argv = yargs(hideBin(process.argv))\n\t\t.scriptName(\"neon-new\")\n\t\t.usage(\"Usage: $0 [command] [options]\")\n\t\t.help()\n\t\t.version(false)\n\t\t.strict()\n\t\t.parserConfiguration({\n\t\t\t\"camel-case-expansion\": true,\n\t\t\t\"strip-aliased\": true,\n\t\t\t\"strip-dashed\": true,\n\t\t})\n\t\t.command(\"$0\", \"Create a new database (default command)\", {})\n\t\t.command(\"claim\", \"Open the claim URL from your .env file\", {})\n\t\t.group(\"logical-replication\", bold(\"Postgres Settings:\"))\n\t\t.option(\"logical-replication\", {\n\t\t\talias: \"L\",\n\t\t\ttype: \"boolean\",\n\t\t\tdescription: \"Enable logical replication\",\n\t\t\tdefault: false,\n\t\t})\n\t\t.option(\"yes\", {\n\t\t\talias: \"y\",\n\t\t\ttype: \"boolean\",\n\t\t\tdescription: \"Skip prompts / use defaults\",\n\t\t\tdefault: false,\n\t\t})\n\t\t.option(\"env\", {\n\t\t\talias: \"e\",\n\t\t\ttype: \"string\",\n\t\t\tdescription: \".env file path\",\n\t\t\tdefaultDescription: DEFAULTS.dotEnvPath,\n\t\t})\n\t\t.option(\"key\", {\n\t\t\talias: \"k\",\n\t\t\ttype: \"string\",\n\t\t\tdescription: \"connection string key\",\n\t\t\tdefaultDescription: DEFAULTS.dotEnvKey,\n\t\t})\n\t\t.option(\"seed\", {\n\t\t\talias: \"s\",\n\t\t\ttype: \"string\",\n\t\t\tdescription: \"Path to the seed (.sql) file\",\n\t\t\tdefaultDescription: DEFAULTS.seed?.path || \"none\",\n\t\t})\n\t\t.option(\"prefix\", {\n\t\t\talias: \"p\",\n\t\t\ttype: \"string\",\n\t\t\tdescription: \"Public env_var prefix\",\n\t\t\tdefaultDescription: DEFAULTS.envPrefix,\n\t\t})\n\t\t.option(\"ref\", {\n\t\t\talias: \"r\",\n\t\t\ttype: \"string\",\n\t\t\tdescription: \"Referrer id\",\n\t\t\tdefaultDescription: DEFAULTS.referrer,\n\t\t})\n\t\t.epilogue(`For more information: ${underline(\"https://neon.new\")}`)\n\t\t.parseSync();\n\n\tconst command = argv._[0]?.toString() || \"create\";\n\n\treturn {\n\t\tyes: argv.yes,\n\t\tenv: argv.env,\n\t\tkey: argv.key,\n\t\tseed: argv.seed,\n\t\tprefix: argv.prefix,\n\t\tref: argv.ref,\n\t\tlogicalReplication: argv.logicalReplication,\n\t\tcommand,\n\t};\n}\n"],"mappings":";;;;AAKA,MAAa,WAAqB;CACjC,YAAY;CACZ,WAAW;CACX,MAAM,KAAA;CACN,WAAW;CACX,UAAU;CACV,UAAU,EACT,oBAAoB,MACrB;AACD;AAcA,SAAgB,UAA8B;CAC7C,MAAM,OAAO,MAAM,QAAQ,QAAQ,IAAI,CAAC,CAAC,CACvC,WAAW,UAAU,CAAC,CACtB,MAAM,+BAA+B,CAAC,CACtC,KAAK,CAAC,CACN,QAAQ,KAAK,CAAC,CACd,OAAO,CAAC,CACR,oBAAoB;EACpB,wBAAwB;EACxB,iBAAiB;EACjB,gBAAgB;CACjB,CAAC,CAAC,CACD,QAAQ,MAAM,2CAA2C,CAAC,CAAC,CAAC,CAC5D,QAAQ,SAAS,0CAA0C,CAAC,CAAC,CAAC,CAC9D,MAAM,uBAAuB,KAAK,oBAAoB,CAAC,CAAC,CACxD,OAAO,uBAAuB;EAC9B,OAAO;EACP,MAAM;EACN,aAAa;EACb,SAAS;CACV,CAAC,CAAC,CACD,OAAO,OAAO;EACd,OAAO;EACP,MAAM;EACN,aAAa;EACb,SAAS;CACV,CAAC,CAAC,CACD,OAAO,OAAO;EACd,OAAO;EACP,MAAM;EACN,aAAa;EACb,oBAAoB,SAAS;CAC9B,CAAC,CAAC,CACD,OAAO,OAAO;EACd,OAAO;EACP,MAAM;EACN,aAAa;EACb,oBAAoB,SAAS;CAC9B,CAAC,CAAC,CACD,OAAO,QAAQ;EACf,OAAO;EACP,MAAM;EACN,aAAa;EACb,oBAAoB,SAAS,MAAM,QAAQ;CAC5C,CAAC,CAAC,CACD,OAAO,UAAU;EACjB,OAAO;EACP,MAAM;EACN,aAAa;EACb,oBAAoB,SAAS;CAC9B,CAAC,CAAC,CACD,OAAO,OAAO;EACd,OAAO;EACP,MAAM;EACN,aAAa;EACb,oBAAoB,SAAS;CAC9B,CAAC,CAAC,CACD,SAAS,yBAAyB,UAAU,kBAAkB,GAAG,CAAC,CAClE,UAAU;CAEZ,MAAM,UAAU,KAAK,EAAE,EAAE,EAAE,SAAS,KAAK;CAEzC,OAAO;EACN,KAAK,KAAK;EACV,KAAK,KAAK;EACV,KAAK,KAAK;EACV,MAAM,KAAK;EACX,QAAQ,KAAK;EACb,KAAK,KAAK;EACV,oBAAoB,KAAK;EACzB;CACD;AACD"}
@@ -1 +1 @@
1
- {"version":3,"file":"create-db.d.ts","names":[],"sources":["../../../src/lib/utils/create-db.ts"],"sourcesContent":[],"mappings":";UAEU,uBAAA;EAAA,IAAA,EAAA,MAAA;EAQY,QAAA,EAAA,MAAA;EAAuB,QAAA,CAAA,EAAA;IAC5C,kBAAA,CAAA,EAAA,OAAA;;;AAGE,iBAJmB,uBAAA,CAInB;EAAA,IAAA;EAAA,QAAA;EAAA;AAAA,CAAA,EAAA,uBAAA,CAAA,EAAuB,OAAvB,CAAA,MAAA,CAAA"}
1
+ {"version":3,"file":"create-db.d.ts","names":[],"sources":["../../../src/lib/utils/create-db.ts"],"mappings":";UAEU,uBAAA;EAAA,IAAA,EAAA,MAAA;EAQY,QAAA,EAAA,MAAA;EAAuB,QAAA,CAAA,EAAA;IAC5C,kBAAA,CAAA,EAAA,OAAA;;;AAGE,iBAJmB,uBAAA,CAInB;EAAA,IAAA;EAAA,QAAA;EAAA;AAAA,CAAA,EAAA,uBAAA,CAAA,EAAuB,OAAvB,CAAA,MAAA,CAAA"}
@@ -1,5 +1,4 @@
1
1
  import { CLAIMABLE_POSTGRES_URLS } from "./urls.js";
2
-
3
2
  //#region src/lib/utils/create-db.ts
4
3
  async function createClaimableDatabase({ dbId, referrer, settings = {} }) {
5
4
  const { logicalReplication = false } = settings;
@@ -13,7 +12,7 @@ async function createClaimableDatabase({ dbId, referrer, settings = {} }) {
13
12
  headers: { "Content-Type": "application/json" }
14
13
  }).then((res) => res.json())).connection_string;
15
14
  }
16
-
17
15
  //#endregion
18
16
  export { createClaimableDatabase };
17
+
19
18
  //# sourceMappingURL=create-db.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"create-db.js","names":[],"sources":["../../../src/lib/utils/create-db.ts"],"sourcesContent":["import { CLAIMABLE_POSTGRES_URLS } from \"./urls.js\";\n\ninterface CreateClaimableDBParams {\n\tdbId: string;\n\treferrer: string;\n\tsettings?: {\n\t\tlogicalReplication?: boolean;\n\t};\n}\n\nexport async function createClaimableDatabase({\n\tdbId,\n\treferrer,\n\tsettings = {},\n}: CreateClaimableDBParams) {\n\tconst { logicalReplication = false } = settings;\n\n\tconst dbCreation = await fetch(\n\t\tCLAIMABLE_POSTGRES_URLS.CREATE_DATABASE_POST(dbId, referrer),\n\t\t{\n\t\t\tmethod: \"POST\",\n\t\t\theaders: {\n\t\t\t\t\"Content-Type\": \"application/json\",\n\t\t\t},\n\t\t\tbody: JSON.stringify({\n\t\t\t\tenable_logical_replication: logicalReplication || false,\n\t\t\t}),\n\t\t},\n\t);\n\n\tif (!dbCreation.ok) {\n\t\tthrow new Error(\"Failed to create database\");\n\t}\n\n\tconst dbInfo: { connection_string: string } = await fetch(\n\t\tCLAIMABLE_POSTGRES_URLS.GET_DATABASE_DATA(dbId),\n\t\t{\n\t\t\tmethod: \"GET\",\n\t\t\theaders: {\n\t\t\t\t\"Content-Type\": \"application/json\",\n\t\t\t},\n\t\t},\n\t).then((res) => res.json());\n\n\treturn dbInfo.connection_string;\n}\n"],"mappings":";;;AAUA,eAAsB,wBAAwB,EAC7C,MACA,UACA,WAAW,EAAE,IACc;CAC3B,MAAM,EAAE,qBAAqB,UAAU;AAevC,KAAI,EAbe,MAAM,MACxB,wBAAwB,qBAAqB,MAAM,SAAS,EAC5D;EACC,QAAQ;EACR,SAAS,EACR,gBAAgB,oBAChB;EACD,MAAM,KAAK,UAAU,EACpB,4BAA4B,sBAAsB,OAClD,CAAC;EACF,CACD,EAEe,GACf,OAAM,IAAI,MAAM,4BAA4B;AAa7C,SAV8C,MAAM,MACnD,wBAAwB,kBAAkB,KAAK,EAC/C;EACC,QAAQ;EACR,SAAS,EACR,gBAAgB,oBAChB;EACD,CACD,CAAC,MAAM,QAAQ,IAAI,MAAM,CAAC,EAEb"}
1
+ {"version":3,"file":"create-db.js","names":[],"sources":["../../../src/lib/utils/create-db.ts"],"sourcesContent":["import { CLAIMABLE_POSTGRES_URLS } from \"./urls.js\";\n\ninterface CreateClaimableDBParams {\n\tdbId: string;\n\treferrer: string;\n\tsettings?: {\n\t\tlogicalReplication?: boolean;\n\t};\n}\n\nexport async function createClaimableDatabase({\n\tdbId,\n\treferrer,\n\tsettings = {},\n}: CreateClaimableDBParams) {\n\tconst { logicalReplication = false } = settings;\n\n\tconst dbCreation = await fetch(\n\t\tCLAIMABLE_POSTGRES_URLS.CREATE_DATABASE_POST(dbId, referrer),\n\t\t{\n\t\t\tmethod: \"POST\",\n\t\t\theaders: {\n\t\t\t\t\"Content-Type\": \"application/json\",\n\t\t\t},\n\t\t\tbody: JSON.stringify({\n\t\t\t\tenable_logical_replication: logicalReplication || false,\n\t\t\t}),\n\t\t},\n\t);\n\n\tif (!dbCreation.ok) {\n\t\tthrow new Error(\"Failed to create database\");\n\t}\n\n\tconst dbInfo: { connection_string: string } = await fetch(\n\t\tCLAIMABLE_POSTGRES_URLS.GET_DATABASE_DATA(dbId),\n\t\t{\n\t\t\tmethod: \"GET\",\n\t\t\theaders: {\n\t\t\t\t\"Content-Type\": \"application/json\",\n\t\t\t},\n\t\t},\n\t).then((res) => res.json());\n\n\treturn dbInfo.connection_string;\n}\n"],"mappings":";;AAUA,eAAsB,wBAAwB,EAC7C,MACA,UACA,WAAW,CAAC,KACe;CAC3B,MAAM,EAAE,qBAAqB,UAAU;CAevC,IAAI,EAAC,MAboB,MACxB,wBAAwB,qBAAqB,MAAM,QAAQ,GAC3D;EACC,QAAQ;EACR,SAAS,EACR,gBAAgB,mBACjB;EACA,MAAM,KAAK,UAAU,EACpB,4BAA4B,sBAAsB,MACnD,CAAC;CACF,CACD,EAAA,CAEgB,IACf,MAAM,IAAI,MAAM,2BAA2B;CAa5C,QAAO,MAV6C,MACnD,wBAAwB,kBAAkB,IAAI,GAC9C;EACC,QAAQ;EACR,SAAS,EACR,gBAAgB,mBACjB;CACD,CACD,CAAC,CAAC,MAAM,QAAQ,IAAI,KAAK,CAAC,EAAA,CAEZ;AACf"}
@@ -1 +1 @@
1
- {"version":3,"file":"detect-claim-url.d.ts","names":[],"sources":["../../../src/lib/utils/detect-claim-url.ts"],"sourcesContent":[],"mappings":";iBAEgB,cAAA,gBACA"}
1
+ {"version":3,"file":"detect-claim-url.d.ts","names":[],"sources":["../../../src/lib/utils/detect-claim-url.ts"],"mappings":";iBAEgB,cAAA,gBACA"}
@@ -1,5 +1,4 @@
1
1
  import { log, outro } from "@clack/prompts";
2
-
3
2
  //#region src/lib/utils/detect-claim-url.ts
4
3
  function detectClaimUrl(dotEnvContent, dotEnvPath) {
5
4
  const claimUrlKey = Object.keys(dotEnvContent).find((key) => key.endsWith("POSTGRES_CLAIM_URL"));
@@ -17,7 +16,7 @@ function detectClaimUrl(dotEnvContent, dotEnvPath) {
17
16
  }
18
17
  return claimUrl;
19
18
  }
20
-
21
19
  //#endregion
22
20
  export { detectClaimUrl };
21
+
23
22
  //# sourceMappingURL=detect-claim-url.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"detect-claim-url.js","names":[],"sources":["../../../src/lib/utils/detect-claim-url.ts"],"sourcesContent":["import { log, outro } from \"@clack/prompts\";\n\nexport function detectClaimUrl(\n\tdotEnvContent: Record<string, string>,\n\tdotEnvPath: string,\n) {\n\tconst claimUrlKey = Object.keys(dotEnvContent).find((key) =>\n\t\tkey.endsWith(\"POSTGRES_CLAIM_URL\"),\n\t);\n\n\tif (!claimUrlKey) {\n\t\tlog.error(`Claim URL not found in ${dotEnvPath}.`);\n\t\tlog.info(\"Looking for any key ending with POSTGRES_CLAIM_URL\");\n\t\toutro(\"No claim URL found. Have you created a database yet?\");\n\t\tprocess.exit(1);\n\t}\n\n\tconst claimUrl = dotEnvContent[claimUrlKey];\n\n\tif (!claimUrl) {\n\t\tlog.error(`${claimUrlKey} found but empty.`);\n\t\toutro(\n\t\t\t\"Use `neon-new claim -p <prefix>` to override URL auto-detection. For example, use `neon-new claim -p PROD_` if your key is `PROD_POSTGRES_CLAIM_URL`.\",\n\t\t);\n\t\tprocess.exit(1);\n\t}\n\n\treturn claimUrl;\n}\n"],"mappings":";;;AAEA,SAAgB,eACf,eACA,YACC;CACD,MAAM,cAAc,OAAO,KAAK,cAAc,CAAC,MAAM,QACpD,IAAI,SAAS,qBAAqB,CAClC;AAED,KAAI,CAAC,aAAa;AACjB,MAAI,MAAM,0BAA0B,WAAW,GAAG;AAClD,MAAI,KAAK,qDAAqD;AAC9D,QAAM,uDAAuD;AAC7D,UAAQ,KAAK,EAAE;;CAGhB,MAAM,WAAW,cAAc;AAE/B,KAAI,CAAC,UAAU;AACd,MAAI,MAAM,GAAG,YAAY,mBAAmB;AAC5C,QACC,wJACA;AACD,UAAQ,KAAK,EAAE;;AAGhB,QAAO"}
1
+ {"version":3,"file":"detect-claim-url.js","names":[],"sources":["../../../src/lib/utils/detect-claim-url.ts"],"sourcesContent":["import { log, outro } from \"@clack/prompts\";\n\nexport function detectClaimUrl(\n\tdotEnvContent: Record<string, string>,\n\tdotEnvPath: string,\n) {\n\tconst claimUrlKey = Object.keys(dotEnvContent).find((key) =>\n\t\tkey.endsWith(\"POSTGRES_CLAIM_URL\"),\n\t);\n\n\tif (!claimUrlKey) {\n\t\tlog.error(`Claim URL not found in ${dotEnvPath}.`);\n\t\tlog.info(\"Looking for any key ending with POSTGRES_CLAIM_URL\");\n\t\toutro(\"No claim URL found. Have you created a database yet?\");\n\t\tprocess.exit(1);\n\t}\n\n\tconst claimUrl = dotEnvContent[claimUrlKey];\n\n\tif (!claimUrl) {\n\t\tlog.error(`${claimUrlKey} found but empty.`);\n\t\toutro(\n\t\t\t\"Use `neon-new claim -p <prefix>` to override URL auto-detection. For example, use `neon-new claim -p PROD_` if your key is `PROD_POSTGRES_CLAIM_URL`.\",\n\t\t);\n\t\tprocess.exit(1);\n\t}\n\n\treturn claimUrl;\n}\n"],"mappings":";;AAEA,SAAgB,eACf,eACA,YACC;CACD,MAAM,cAAc,OAAO,KAAK,aAAa,CAAC,CAAC,MAAM,QACpD,IAAI,SAAS,oBAAoB,CAClC;CAEA,IAAI,CAAC,aAAa;EACjB,IAAI,MAAM,0BAA0B,WAAW,EAAE;EACjD,IAAI,KAAK,oDAAoD;EAC7D,MAAM,sDAAsD;EAC5D,QAAQ,KAAK,CAAC;CACf;CAEA,MAAM,WAAW,cAAc;CAE/B,IAAI,CAAC,UAAU;EACd,IAAI,MAAM,GAAG,YAAY,kBAAkB;EAC3C,MACC,uJACD;EACA,QAAQ,KAAK,CAAC;CACf;CAEA,OAAO;AACR"}
@@ -1 +1 @@
1
- {"version":3,"file":"format.d.ts","names":[],"sources":["../../../src/lib/utils/format.ts"],"sourcesContent":[],"mappings":";iBAqBgB,oBAAA;EAAA,MAAA,EAAA,MAAA"}
1
+ {"version":3,"file":"format.d.ts","names":[],"sources":["../../../src/lib/utils/format.ts"],"mappings":";iBAqBgB,oBAAA;EAAA,MAAA,EAAA,MAAA"}
@@ -15,7 +15,7 @@ function getConnectionStrings(connString) {
15
15
  direct: getDirectString(connString)
16
16
  };
17
17
  }
18
-
19
18
  //#endregion
20
19
  export { getConnectionStrings };
20
+
21
21
  //# sourceMappingURL=format.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"format.js","names":[],"sources":["../../../src/lib/utils/format.ts"],"sourcesContent":["function getPoolerString(connString: string) {\n\tconst isPooler = connString.includes(\"pooler\");\n\tif (isPooler) {\n\t\treturn connString;\n\t}\n\n\tconst [start, ...end] = connString.split(\".\");\n\treturn `${start}-pooler.${end.join(\".\")}`;\n}\n\nfunction getDirectString(connString: string) {\n\tconst isDirect = !connString.includes(\"pooler\");\n\tif (isDirect) {\n\t\treturn connString;\n\t}\n\tconst [first, ...rest] = connString.split(\".\");\n\tconst directFirst = first.replace(\"-pooler\", \"\");\n\n\treturn [directFirst, ...rest].join(\".\");\n}\n\nexport function getConnectionStrings(connString: string) {\n\treturn {\n\t\tpooler: getPoolerString(connString),\n\t\tdirect: getDirectString(connString),\n\t};\n}\n"],"mappings":";AAAA,SAAS,gBAAgB,YAAoB;AAE5C,KADiB,WAAW,SAAS,SAAS,CAE7C,QAAO;CAGR,MAAM,CAAC,OAAO,GAAG,OAAO,WAAW,MAAM,IAAI;AAC7C,QAAO,GAAG,MAAM,UAAU,IAAI,KAAK,IAAI;;AAGxC,SAAS,gBAAgB,YAAoB;AAE5C,KADiB,CAAC,WAAW,SAAS,SAAS,CAE9C,QAAO;CAER,MAAM,CAAC,OAAO,GAAG,QAAQ,WAAW,MAAM,IAAI;AAG9C,QAAO,CAFa,MAAM,QAAQ,WAAW,GAAG,EAE3B,GAAG,KAAK,CAAC,KAAK,IAAI;;AAGxC,SAAgB,qBAAqB,YAAoB;AACxD,QAAO;EACN,QAAQ,gBAAgB,WAAW;EACnC,QAAQ,gBAAgB,WAAW;EACnC"}
1
+ {"version":3,"file":"format.js","names":[],"sources":["../../../src/lib/utils/format.ts"],"sourcesContent":["function getPoolerString(connString: string) {\n\tconst isPooler = connString.includes(\"pooler\");\n\tif (isPooler) {\n\t\treturn connString;\n\t}\n\n\tconst [start, ...end] = connString.split(\".\");\n\treturn `${start}-pooler.${end.join(\".\")}`;\n}\n\nfunction getDirectString(connString: string) {\n\tconst isDirect = !connString.includes(\"pooler\");\n\tif (isDirect) {\n\t\treturn connString;\n\t}\n\tconst [first, ...rest] = connString.split(\".\");\n\tconst directFirst = first.replace(\"-pooler\", \"\");\n\n\treturn [directFirst, ...rest].join(\".\");\n}\n\nexport function getConnectionStrings(connString: string) {\n\treturn {\n\t\tpooler: getPoolerString(connString),\n\t\tdirect: getDirectString(connString),\n\t};\n}\n"],"mappings":";AAAA,SAAS,gBAAgB,YAAoB;CAE5C,IADiB,WAAW,SAAS,QAC1B,GACV,OAAO;CAGR,MAAM,CAAC,OAAO,GAAG,OAAO,WAAW,MAAM,GAAG;CAC5C,OAAO,GAAG,MAAM,UAAU,IAAI,KAAK,GAAG;AACvC;AAEA,SAAS,gBAAgB,YAAoB;CAE5C,IAAI,CADc,WAAW,SAAS,QAAQ,GAE7C,OAAO;CAER,MAAM,CAAC,OAAO,GAAG,QAAQ,WAAW,MAAM,GAAG;CAG7C,OAAO,CAFa,MAAM,QAAQ,WAAW,EAE3B,GAAG,GAAG,IAAI,CAAC,CAAC,KAAK,GAAG;AACvC;AAEA,SAAgB,qBAAqB,YAAoB;CACxD,OAAO;EACN,QAAQ,gBAAgB,UAAU;EAClC,QAAQ,gBAAgB,UAAU;CACnC;AACD"}
@@ -1 +1 @@
1
- {"version":3,"file":"fs.d.ts","names":[],"sources":["../../../src/lib/utils/fs.ts"],"sourcesContent":[],"mappings":";iBAcgB,aAAA;AAAA,iBAeA,cAAA,CAfa,IAAA,EAAA,MAAA,CAAA,EAAA,MAAA,EAAA;AAeb,iBAYA,gBAAA,CAZc,UAAA,EAAA,MAAA,CAAA,EAYwB,MAZxB,CAAA,MAAA,EAAA,MAAA,CAAA;AAYd,iBAcA,OAAA,CAdgB,UAA4B,EAAA,MAAA,EAAA,SAAA,EAAA,MAAA,CAAA,EAAA,IAAA;AAc5C,iBA0BM,UAAA,CA1BC,UAAA,EAAA,MAAA,EAAA,SAAA,EAAA,MAAA,EAAA,cAAA,EA6BN,IA7BM,EAAA,QAAA,EA8BZ,GA9BY,EAAA,UAAA,EAAA,MAAA,EAAA,YAAA,EAAA,MAAA,EAAA,SAAA,CAAA,EAAA,MAAA,CAAA,EAiCO,OAjCP,CAAA,IAAA,CAAA"}
1
+ {"version":3,"file":"fs.d.ts","names":[],"sources":["../../../src/lib/utils/fs.ts"],"mappings":";iBAcgB,aAAA;AAAA,iBAeA,cAAA,CAfa,IAAA,EAAA,MAAA,CAAA,EAAA,MAAA,EAAA;AAeb,iBAYA,gBAAA,CAZc,UAAA,EAAA,MAAA,CAAA,EAYwB,MAZxB,CAAA,MAAA,EAAA,MAAA,CAAA;AAYd,iBAcA,OAAA,CAdgB,UAA4B,EAAA,MAAA,EAAA,SAAA,EAAA,MAAA,CAAA,EAAA,IAAA;AAc5C,iBA0BM,UAAA,CA1BC,UAAA,EAAA,MAAA,EAAA,SAAA,EAAA,MAAA,EAAA,cAAA,EA6BN,IA7BM,EAAA,QAAA,EA8BZ,GA9BY,EAAA,UAAA,EAAA,MAAA,EAAA,YAAA,EAAA,MAAA,EAAA,SAAA,CAAA,EAAA,MAAA,CAAA,EAiCO,OAjCP,CAAA,IAAA,CAAA"}
@@ -4,7 +4,6 @@ import { closeSync, existsSync, mkdirSync, openSync, readFileSync, writeSync } f
4
4
  import { dirname } from "node:path";
5
5
  import { parse } from "dotenv";
6
6
  import * as semicolons from "postgres-semicolons";
7
-
8
7
  //#region src/lib/utils/fs.ts
9
8
  function splitCommands(schema) {
10
9
  const splits = semicolons.parseSplits(schema, true);
@@ -60,7 +59,7 @@ ${envPrefix}POSTGRES_CLAIM_URL=${claimUrl.href}
60
59
  `);
61
60
  closeSync(openedFile);
62
61
  }
63
-
64
62
  //#endregion
65
63
  export { getDotEnvContent, getSqlCommands, prepEnv, splitCommands, writeToEnv };
64
+
66
65
  //# sourceMappingURL=fs.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"fs.js","names":[],"sources":["../../../src/lib/utils/fs.ts"],"sourcesContent":["import {\n\tcloseSync,\n\texistsSync,\n\tmkdirSync,\n\topenSync,\n\treadFileSync,\n\twriteSync,\n} from \"node:fs\";\nimport { dirname } from \"node:path\";\nimport { log, outro } from \"@clack/prompts\";\nimport { parse } from \"dotenv\";\nimport * as semicolons from \"postgres-semicolons\";\nimport { messages } from \"../texts.js\";\n\nexport function splitCommands(schema: string) {\n\tconst splits = semicolons.parseSplits(schema, true);\n\treturn semicolons.nonEmptyStatements(schema, splits.positions);\n}\n\nfunction validateSql(sql: string) {\n\tconst openParens = (sql.match(/\\(/g) || []).length;\n\tconst closeParens = (sql.match(/\\)/g) || []).length;\n\tif (openParens !== closeParens) {\n\t\tthrow new Error(\"SQL has unbalanced parentheses\");\n\t}\n\n\treturn sql;\n}\n\nexport function getSqlCommands(path: string) {\n\ttry {\n\t\tconst sql = validateSql(readFileSync(path, \"utf8\"));\n\t\treturn splitCommands(sql);\n\t} catch (error) {\n\t\tlog.error(\n\t\t\terror instanceof Error ? error.message : \"Failed to read SQL file.\",\n\t\t);\n\t\tprocess.exit(1);\n\t}\n}\n\nexport function getDotEnvContent(dotEnvFile: string): Record<string, string> {\n\tif (!existsSync(dotEnvFile)) {\n\t\tlog.info(messages.info.dotEnvFileNotFound);\n\t\treturn {};\n\t}\n\n\ttry {\n\t\tconst content = readFileSync(dotEnvFile);\n\t\treturn parse(content);\n\t} catch {\n\t\tthrow new Error(messages.errors.failedToParseEnvFile);\n\t}\n}\n\nexport function prepEnv(dotEnvFile: string, dotEnvKey: string) {\n\ttry {\n\t\tconst dotEnvContent = getDotEnvContent(dotEnvFile);\n\n\t\tif (dotEnvContent[dotEnvKey]) {\n\t\t\tlog.warn(messages.errors.envKeyExists(dotEnvKey, dotEnvFile));\n\t\t\toutro(messages.envKeyExistsExit);\n\t\t\tprocess.exit(0);\n\t\t}\n\n\t\treturn;\n\t} catch (error) {\n\t\t// getDotEnvContent will create empty file if it doesn't exist\n\t\t// or throw if parsing fails\n\t\tif (\n\t\t\terror instanceof Error &&\n\t\t\terror.message === messages.errors.failedToParseEnvFile\n\t\t) {\n\t\t\tconsole.error(error);\n\t\t\tlog.error(messages.errors.invalidEnvFile);\n\n\t\t\tprocess.exit(1);\n\t\t}\n\t}\n}\n\nexport async function writeToEnv(\n\tdotEnvFile: string,\n\tdotEnvKey: string,\n\tclaimExpiresAt: Date,\n\tclaimUrl: URL,\n\tconnString: string,\n\tpoolerString: string,\n\tenvPrefix: string = \"PUBLIC_\",\n) {\n\tif (!existsSync(dirname(dotEnvFile))) {\n\t\tmkdirSync(dirname(dotEnvFile), { recursive: true });\n\t}\n\n\tconst openedFile = openSync(dotEnvFile, \"a\");\n\twriteSync(\n\t\topenedFile,\n\t\t`${dotEnvKey}=${poolerString}\n${dotEnvKey}_DIRECT=${connString}\n# Claimable DB expires at: ${claimExpiresAt.toUTCString()}\n# Claim it now to your account using the link below:\n${envPrefix}POSTGRES_CLAIM_URL=${claimUrl.href}\n`,\n\t);\n\tcloseSync(openedFile);\n}\n"],"mappings":";;;;;;;;AAcA,SAAgB,cAAc,QAAgB;CAC7C,MAAM,SAAS,WAAW,YAAY,QAAQ,KAAK;AACnD,QAAO,WAAW,mBAAmB,QAAQ,OAAO,UAAU;;AAG/D,SAAS,YAAY,KAAa;AAGjC,MAFoB,IAAI,MAAM,MAAM,IAAI,EAAE,EAAE,YACvB,IAAI,MAAM,MAAM,IAAI,EAAE,EAAE,OAE5C,OAAM,IAAI,MAAM,iCAAiC;AAGlD,QAAO;;AAGR,SAAgB,eAAe,MAAc;AAC5C,KAAI;AAEH,SAAO,cADK,YAAY,aAAa,MAAM,OAAO,CAAC,CAC1B;UACjB,OAAO;AACf,MAAI,MACH,iBAAiB,QAAQ,MAAM,UAAU,2BACzC;AACD,UAAQ,KAAK,EAAE;;;AAIjB,SAAgB,iBAAiB,YAA4C;AAC5E,KAAI,CAAC,WAAW,WAAW,EAAE;AAC5B,MAAI,KAAK,SAAS,KAAK,mBAAmB;AAC1C,SAAO,EAAE;;AAGV,KAAI;AAEH,SAAO,MADS,aAAa,WAAW,CACnB;SACd;AACP,QAAM,IAAI,MAAM,SAAS,OAAO,qBAAqB;;;AAIvD,SAAgB,QAAQ,YAAoB,WAAmB;AAC9D,KAAI;AAGH,MAFsB,iBAAiB,WAAW,CAEhC,YAAY;AAC7B,OAAI,KAAK,SAAS,OAAO,aAAa,WAAW,WAAW,CAAC;AAC7D,SAAM,SAAS,iBAAiB;AAChC,WAAQ,KAAK,EAAE;;AAGhB;UACQ,OAAO;AAGf,MACC,iBAAiB,SACjB,MAAM,YAAY,SAAS,OAAO,sBACjC;AACD,WAAQ,MAAM,MAAM;AACpB,OAAI,MAAM,SAAS,OAAO,eAAe;AAEzC,WAAQ,KAAK,EAAE;;;;AAKlB,eAAsB,WACrB,YACA,WACA,gBACA,UACA,YACA,cACA,YAAoB,WACnB;AACD,KAAI,CAAC,WAAW,QAAQ,WAAW,CAAC,CACnC,WAAU,QAAQ,WAAW,EAAE,EAAE,WAAW,MAAM,CAAC;CAGpD,MAAM,aAAa,SAAS,YAAY,IAAI;AAC5C,WACC,YACA,GAAG,UAAU,GAAG,aAAa;EAC7B,UAAU,UAAU,WAAW;6BACJ,eAAe,aAAa,CAAC;;EAExD,UAAU,qBAAqB,SAAS,KAAK;EAE7C;AACD,WAAU,WAAW"}
1
+ {"version":3,"file":"fs.js","names":[],"sources":["../../../src/lib/utils/fs.ts"],"sourcesContent":["import {\n\tcloseSync,\n\texistsSync,\n\tmkdirSync,\n\topenSync,\n\treadFileSync,\n\twriteSync,\n} from \"node:fs\";\nimport { dirname } from \"node:path\";\nimport { log, outro } from \"@clack/prompts\";\nimport { parse } from \"dotenv\";\nimport * as semicolons from \"postgres-semicolons\";\nimport { messages } from \"../texts.js\";\n\nexport function splitCommands(schema: string) {\n\tconst splits = semicolons.parseSplits(schema, true);\n\treturn semicolons.nonEmptyStatements(schema, splits.positions);\n}\n\nfunction validateSql(sql: string) {\n\tconst openParens = (sql.match(/\\(/g) || []).length;\n\tconst closeParens = (sql.match(/\\)/g) || []).length;\n\tif (openParens !== closeParens) {\n\t\tthrow new Error(\"SQL has unbalanced parentheses\");\n\t}\n\n\treturn sql;\n}\n\nexport function getSqlCommands(path: string) {\n\ttry {\n\t\tconst sql = validateSql(readFileSync(path, \"utf8\"));\n\t\treturn splitCommands(sql);\n\t} catch (error) {\n\t\tlog.error(\n\t\t\terror instanceof Error ? error.message : \"Failed to read SQL file.\",\n\t\t);\n\t\tprocess.exit(1);\n\t}\n}\n\nexport function getDotEnvContent(dotEnvFile: string): Record<string, string> {\n\tif (!existsSync(dotEnvFile)) {\n\t\tlog.info(messages.info.dotEnvFileNotFound);\n\t\treturn {};\n\t}\n\n\ttry {\n\t\tconst content = readFileSync(dotEnvFile);\n\t\treturn parse(content);\n\t} catch {\n\t\tthrow new Error(messages.errors.failedToParseEnvFile);\n\t}\n}\n\nexport function prepEnv(dotEnvFile: string, dotEnvKey: string) {\n\ttry {\n\t\tconst dotEnvContent = getDotEnvContent(dotEnvFile);\n\n\t\tif (dotEnvContent[dotEnvKey]) {\n\t\t\tlog.warn(messages.errors.envKeyExists(dotEnvKey, dotEnvFile));\n\t\t\toutro(messages.envKeyExistsExit);\n\t\t\tprocess.exit(0);\n\t\t}\n\n\t\treturn;\n\t} catch (error) {\n\t\t// getDotEnvContent will create empty file if it doesn't exist\n\t\t// or throw if parsing fails\n\t\tif (\n\t\t\terror instanceof Error &&\n\t\t\terror.message === messages.errors.failedToParseEnvFile\n\t\t) {\n\t\t\tconsole.error(error);\n\t\t\tlog.error(messages.errors.invalidEnvFile);\n\n\t\t\tprocess.exit(1);\n\t\t}\n\t}\n}\n\nexport async function writeToEnv(\n\tdotEnvFile: string,\n\tdotEnvKey: string,\n\tclaimExpiresAt: Date,\n\tclaimUrl: URL,\n\tconnString: string,\n\tpoolerString: string,\n\tenvPrefix: string = \"PUBLIC_\",\n) {\n\tif (!existsSync(dirname(dotEnvFile))) {\n\t\tmkdirSync(dirname(dotEnvFile), { recursive: true });\n\t}\n\n\tconst openedFile = openSync(dotEnvFile, \"a\");\n\twriteSync(\n\t\topenedFile,\n\t\t`${dotEnvKey}=${poolerString}\n${dotEnvKey}_DIRECT=${connString}\n# Claimable DB expires at: ${claimExpiresAt.toUTCString()}\n# Claim it now to your account using the link below:\n${envPrefix}POSTGRES_CLAIM_URL=${claimUrl.href}\n`,\n\t);\n\tcloseSync(openedFile);\n}\n"],"mappings":";;;;;;;AAcA,SAAgB,cAAc,QAAgB;CAC7C,MAAM,SAAS,WAAW,YAAY,QAAQ,IAAI;CAClD,OAAO,WAAW,mBAAmB,QAAQ,OAAO,SAAS;AAC9D;AAEA,SAAS,YAAY,KAAa;CAGjC,KAFoB,IAAI,MAAM,KAAK,KAAK,CAAC,EAAA,CAAG,YACvB,IAAI,MAAM,KAAK,KAAK,CAAC,EAAA,CAAG,QAE5C,MAAM,IAAI,MAAM,gCAAgC;CAGjD,OAAO;AACR;AAEA,SAAgB,eAAe,MAAc;CAC5C,IAAI;EAEH,OAAO,cADK,YAAY,aAAa,MAAM,MAAM,CAC1B,CAAC;CACzB,SAAS,OAAO;EACf,IAAI,MACH,iBAAiB,QAAQ,MAAM,UAAU,0BAC1C;EACA,QAAQ,KAAK,CAAC;CACf;AACD;AAEA,SAAgB,iBAAiB,YAA4C;CAC5E,IAAI,CAAC,WAAW,UAAU,GAAG;EAC5B,IAAI,KAAK,SAAS,KAAK,kBAAkB;EACzC,OAAO,CAAC;CACT;CAEA,IAAI;EAEH,OAAO,MADS,aAAa,UACV,CAAC;CACrB,QAAQ;EACP,MAAM,IAAI,MAAM,SAAS,OAAO,oBAAoB;CACrD;AACD;AAEA,SAAgB,QAAQ,YAAoB,WAAmB;CAC9D,IAAI;EAGH,IAFsB,iBAAiB,UAEvB,CAAC,CAAC,YAAY;GAC7B,IAAI,KAAK,SAAS,OAAO,aAAa,WAAW,UAAU,CAAC;GAC5D,MAAM,SAAS,gBAAgB;GAC/B,QAAQ,KAAK,CAAC;EACf;EAEA;CACD,SAAS,OAAO;EAGf,IACC,iBAAiB,SACjB,MAAM,YAAY,SAAS,OAAO,sBACjC;GACD,QAAQ,MAAM,KAAK;GACnB,IAAI,MAAM,SAAS,OAAO,cAAc;GAExC,QAAQ,KAAK,CAAC;EACf;CACD;AACD;AAEA,eAAsB,WACrB,YACA,WACA,gBACA,UACA,YACA,cACA,YAAoB,WACnB;CACD,IAAI,CAAC,WAAW,QAAQ,UAAU,CAAC,GAClC,UAAU,QAAQ,UAAU,GAAG,EAAE,WAAW,KAAK,CAAC;CAGnD,MAAM,aAAa,SAAS,YAAY,GAAG;CAC3C,UACC,YACA,GAAG,UAAU,GAAG,aAAa;EAC7B,UAAU,UAAU,WAAW;6BACJ,eAAe,YAAY,EAAE;;EAExD,UAAU,qBAAqB,SAAS,KAAK;CAE9C;CACA,UAAU,UAAU;AACrB"}
@@ -1 +1 @@
1
- {"version":3,"file":"urls.d.ts","names":[],"sources":["../../../src/lib/utils/urls.ts"],"sourcesContent":[],"mappings":";cAEa;EAAA,iBAAA,EAAA,CAAA,IAAA,EAWZ,MAAA,EAAA,GAAA,MAAA"}
1
+ {"version":3,"file":"urls.d.ts","names":[],"sources":["../../../src/lib/utils/urls.ts"],"mappings":";cAEa;EAAA,iBAAA,EAAA,CAAA,IAAA,EAWZ,MAAA,EAAA,GAAA,MAAA"}
@@ -6,7 +6,7 @@ const CLAIMABLE_POSTGRES_URLS = {
6
6
  CLAIM_DATABASE: (dbId) => `${HOST}/database/${dbId}`,
7
7
  CREATE_DATABASE_POST: (dbId, referrer) => `${HOST}/api/v1/database/${dbId}${referrer ? `?referrer=${encodeURIComponent(referrer)}` : ""}`
8
8
  };
9
-
10
9
  //#endregion
11
10
  export { CLAIMABLE_POSTGRES_URLS };
11
+
12
12
  //# sourceMappingURL=urls.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"urls.js","names":[],"sources":["../../../src/lib/utils/urls.ts"],"sourcesContent":["const HOST = \"https://neon.new\";\n\nexport const CLAIMABLE_POSTGRES_URLS = {\n\tGET_DATABASE_DATA: (dbId: string) => `${HOST}/api/v1/database/${dbId}`,\n\tCREATE_CLAIMABLE_DATABASE: (dbId: string, referrer?: string) =>\n\t\t`${HOST}/db?uuid=${dbId}${\n\t\t\treferrer ? `&ref=${encodeURIComponent(referrer)}` : \"\"\n\t\t}`,\n\tCLAIM_DATABASE: (dbId: string) => `${HOST}/database/${dbId}`,\n\tCREATE_DATABASE_POST: (dbId: string, referrer?: string) =>\n\t\t`${HOST}/api/v1/database/${dbId}${\n\t\t\treferrer ? `?referrer=${encodeURIComponent(referrer)}` : \"\"\n\t\t}`,\n};\n"],"mappings":";AAAA,MAAM,OAAO;AAEb,MAAa,0BAA0B;CACtC,oBAAoB,SAAiB,GAAG,KAAK,mBAAmB;CAChE,4BAA4B,MAAc,aACzC,GAAG,KAAK,WAAW,OAClB,WAAW,QAAQ,mBAAmB,SAAS,KAAK;CAEtD,iBAAiB,SAAiB,GAAG,KAAK,YAAY;CACtD,uBAAuB,MAAc,aACpC,GAAG,KAAK,mBAAmB,OAC1B,WAAW,aAAa,mBAAmB,SAAS,KAAK;CAE3D"}
1
+ {"version":3,"file":"urls.js","names":[],"sources":["../../../src/lib/utils/urls.ts"],"sourcesContent":["const HOST = \"https://neon.new\";\n\nexport const CLAIMABLE_POSTGRES_URLS = {\n\tGET_DATABASE_DATA: (dbId: string) => `${HOST}/api/v1/database/${dbId}`,\n\tCREATE_CLAIMABLE_DATABASE: (dbId: string, referrer?: string) =>\n\t\t`${HOST}/db?uuid=${dbId}${\n\t\t\treferrer ? `&ref=${encodeURIComponent(referrer)}` : \"\"\n\t\t}`,\n\tCLAIM_DATABASE: (dbId: string) => `${HOST}/database/${dbId}`,\n\tCREATE_DATABASE_POST: (dbId: string, referrer?: string) =>\n\t\t`${HOST}/api/v1/database/${dbId}${\n\t\t\treferrer ? `?referrer=${encodeURIComponent(referrer)}` : \"\"\n\t\t}`,\n};\n"],"mappings":";AAAA,MAAM,OAAO;AAEb,MAAa,0BAA0B;CACtC,oBAAoB,SAAiB,GAAG,KAAK,mBAAmB;CAChE,4BAA4B,MAAc,aACzC,GAAG,KAAK,WAAW,OAClB,WAAW,QAAQ,mBAAmB,QAAQ,MAAM;CAEtD,iBAAiB,SAAiB,GAAG,KAAK,YAAY;CACtD,uBAAuB,MAAc,aACpC,GAAG,KAAK,mBAAmB,OAC1B,WAAW,aAAa,mBAAmB,QAAQ,MAAM;AAE5D"}
@@ -1 +1 @@
1
- {"version":3,"file":"validate.d.ts","names":[],"sources":["../../../src/lib/utils/validate.ts"],"sourcesContent":[],"mappings":";;;AAKsC;;;iBAA7B,eAAA,iBAA6B;;;;;;iBAiB7B,cAAA,iBAA4B"}
1
+ {"version":3,"file":"validate.d.ts","names":[],"sources":["../../../src/lib/utils/validate.ts"],"mappings":";;;AAKsC;;;iBAA7B,eAAA,iBAA6B;;;;;;iBAiB7B,cAAA,iBAA4B"}
@@ -17,7 +17,7 @@ function validateEnvKey(value) {
17
17
  if (!value) return void 0;
18
18
  if (!/^[A-Z][A-Z0-9_]*$/.test(value)) return /* @__PURE__ */ new Error("Please enter a valid environment variable key (e.g.: DATABASE_URL)");
19
19
  }
20
-
21
20
  //#endregion
22
21
  export { validateEnvKey, validateEnvPath };
22
+
23
23
  //# sourceMappingURL=validate.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"validate.js","names":[],"sources":["../../../src/lib/utils/validate.ts"],"sourcesContent":["/**\n * Validates the path to the .env file - it can be dotfile or not.\n * @param value - The path to the .env file\n * @returns An error if the path is invalid, otherwise undefined\n */\nfunction validateEnvPath(value: string) {\n\tif (!value) return undefined;\n\n\tif (!/^\\.?[\\w-]+(?:\\.[\\w-]+)*$/.test(value)) {\n\t\treturn new Error(\n\t\t\t\"Please enter a valid file name (e.g.: .env or .env.local)\",\n\t\t);\n\t}\n\n\treturn undefined;\n}\n\n/**\n * Validates the key for the .env file - it can only be uppercase letters or digits and underscores (SCREAMING_SNAKE_CASE).\n * @param value - The key for the .env file\n * @returns An error if the key is invalid, otherwise undefined\n */\nfunction validateEnvKey(value: string) {\n\tif (!value) return undefined;\n\n\tif (!/^[A-Z][A-Z0-9_]*$/.test(value)) {\n\t\treturn new Error(\n\t\t\t\"Please enter a valid environment variable key (e.g.: DATABASE_URL)\",\n\t\t);\n\t}\n\treturn undefined;\n}\n\nexport { validateEnvPath, validateEnvKey };\n"],"mappings":";;;;;;AAKA,SAAS,gBAAgB,OAAe;AACvC,KAAI,CAAC,MAAO,QAAO;AAEnB,KAAI,CAAC,2BAA2B,KAAK,MAAM,CAC1C,wBAAO,IAAI,MACV,4DACA;;;;;;;AAWH,SAAS,eAAe,OAAe;AACtC,KAAI,CAAC,MAAO,QAAO;AAEnB,KAAI,CAAC,oBAAoB,KAAK,MAAM,CACnC,wBAAO,IAAI,MACV,qEACA"}
1
+ {"version":3,"file":"validate.js","names":[],"sources":["../../../src/lib/utils/validate.ts"],"sourcesContent":["/**\n * Validates the path to the .env file - it can be dotfile or not.\n * @param value - The path to the .env file\n * @returns An error if the path is invalid, otherwise undefined\n */\nfunction validateEnvPath(value: string) {\n\tif (!value) return undefined;\n\n\tif (!/^\\.?[\\w-]+(?:\\.[\\w-]+)*$/.test(value)) {\n\t\treturn new Error(\n\t\t\t\"Please enter a valid file name (e.g.: .env or .env.local)\",\n\t\t);\n\t}\n\n\treturn undefined;\n}\n\n/**\n * Validates the key for the .env file - it can only be uppercase letters or digits and underscores (SCREAMING_SNAKE_CASE).\n * @param value - The key for the .env file\n * @returns An error if the key is invalid, otherwise undefined\n */\nfunction validateEnvKey(value: string) {\n\tif (!value) return undefined;\n\n\tif (!/^[A-Z][A-Z0-9_]*$/.test(value)) {\n\t\treturn new Error(\n\t\t\t\"Please enter a valid environment variable key (e.g.: DATABASE_URL)\",\n\t\t);\n\t}\n\treturn undefined;\n}\n\nexport { validateEnvPath, validateEnvKey };\n"],"mappings":";;;;;;AAKA,SAAS,gBAAgB,OAAe;CACvC,IAAI,CAAC,OAAO,OAAO,KAAA;CAEnB,IAAI,CAAC,2BAA2B,KAAK,KAAK,GACzC,uBAAO,IAAI,MACV,2DACD;AAIF;;;;;;AAOA,SAAS,eAAe,OAAe;CACtC,IAAI,CAAC,OAAO,OAAO,KAAA;CAEnB,IAAI,CAAC,oBAAoB,KAAK,KAAK,GAClC,uBAAO,IAAI,MACV,oEACD;AAGF"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "neon-new",
3
- "version": "0.14.0",
3
+ "version": "0.15.0",
4
4
  "description": "create a claimable Neon database in seconds!",
5
5
  "keywords": [
6
6
  "neon",
@@ -54,7 +54,7 @@
54
54
  "vitest": "^3.0.9"
55
55
  },
56
56
  "engines": {
57
- "node": ">=22"
57
+ "node": ">=20.19.0"
58
58
  },
59
59
  "publishConfig": {
60
60
  "provenance": false