express-file-cluster 0.9.2 → 0.9.6

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 (136) hide show
  1. package/dist/auth/index.cjs +4 -5
  2. package/dist/auth/index.cjs.map +1 -1
  3. package/dist/auth/index.d.cts +7 -2
  4. package/dist/auth/index.d.ts +7 -2
  5. package/dist/auth/index.js +3 -4
  6. package/dist/{chunk-ATL4GYFU.js → chunk-2SETEVMO.js} +10 -8
  7. package/dist/{chunk-ATL4GYFU.js.map → chunk-2SETEVMO.js.map} +1 -1
  8. package/dist/{chunk-UBQYQPBU.js → chunk-45BWAR6P.js} +2 -2
  9. package/dist/{chunk-TYR2GZZE.cjs → chunk-6KHBJOLB.cjs} +13 -8
  10. package/dist/chunk-6KHBJOLB.cjs.map +1 -0
  11. package/dist/chunk-73XJUT2S.js +366 -0
  12. package/dist/chunk-73XJUT2S.js.map +1 -0
  13. package/dist/{chunk-UTM4PEVG.js → chunk-7ZESZG3J.js} +8 -3
  14. package/dist/chunk-7ZESZG3J.js.map +1 -0
  15. package/dist/{chunk-R34R7QPD.cjs → chunk-DCJOWFVD.cjs} +3 -3
  16. package/dist/{chunk-R34R7QPD.cjs.map → chunk-DCJOWFVD.cjs.map} +1 -1
  17. package/dist/chunk-DUADUR6R.cjs +366 -0
  18. package/dist/chunk-DUADUR6R.cjs.map +1 -0
  19. package/dist/{chunk-T4OHFU5T.cjs → chunk-FMA76PRH.cjs} +8 -8
  20. package/dist/{chunk-T4OHFU5T.cjs.map → chunk-FMA76PRH.cjs.map} +1 -1
  21. package/dist/{chunk-RS4MXCPW.js → chunk-NI2BNGGV.js} +2 -2
  22. package/dist/{chunk-RRQ2RK5M.js → chunk-OFA7OGN5.js} +26 -6
  23. package/dist/chunk-OFA7OGN5.js.map +1 -0
  24. package/dist/{chunk-ANUSWEAP.cjs → chunk-RGT4ZVHL.cjs} +17 -15
  25. package/dist/chunk-RGT4ZVHL.cjs.map +1 -0
  26. package/dist/{chunk-X2US4RAM.cjs → chunk-TYCYYLLM.cjs} +11 -13
  27. package/dist/chunk-TYCYYLLM.cjs.map +1 -0
  28. package/dist/{chunk-QKQZF573.js → chunk-ULWNHN6P.js} +4 -6
  29. package/dist/{chunk-QKQZF573.js.map → chunk-ULWNHN6P.js.map} +1 -1
  30. package/dist/{chunk-RTF7PHS2.cjs → chunk-VWSUQKCJ.cjs} +116 -96
  31. package/dist/chunk-VWSUQKCJ.cjs.map +1 -0
  32. package/dist/cli/db-runner.cjs +20 -22
  33. package/dist/cli/db-runner.cjs.map +1 -1
  34. package/dist/cli/db-runner.js +4 -6
  35. package/dist/cli/db-runner.js.map +1 -1
  36. package/dist/cli/index.cjs +95 -58
  37. package/dist/cli/index.cjs.map +1 -1
  38. package/dist/cli/index.js +126 -89
  39. package/dist/cli/index.js.map +1 -1
  40. package/dist/docs/api-reference/auth.md +10 -8
  41. package/dist/docs/api-reference/ignite.md +13 -3
  42. package/dist/docs/cli/add.md +1 -1
  43. package/dist/docs/cli/start.md +1 -1
  44. package/dist/docs/contributing/index.md +1 -1
  45. package/dist/docs/getting-started/index.md +1 -1
  46. package/dist/docs/guides/authentication.md +34 -24
  47. package/dist/docs/guides/database.md +12 -0
  48. package/dist/docs/guides/deployment.md +1 -1
  49. package/dist/docs/guides/environment-variables.md +1 -1
  50. package/dist/docs/guides/oauth.md +15 -1
  51. package/dist/docs/index.md +2 -1
  52. package/dist/docs/skills/SKILL.md +2 -2
  53. package/dist/docs/skills/api-surface.md +5 -4
  54. package/dist/docs/skills/auth-internals.md +3 -3
  55. package/dist/docs/versioning.md +42 -0
  56. package/dist/index.cjs +73 -49
  57. package/dist/index.cjs.map +1 -1
  58. package/dist/index.d.cts +2 -2
  59. package/dist/index.d.ts +2 -2
  60. package/dist/index.js +36 -12
  61. package/dist/index.js.map +1 -1
  62. package/dist/pgboss-backend-DSO3QTNK.cjs +14 -0
  63. package/dist/{pgboss-backend-TCHI7CHM.cjs.map → pgboss-backend-DSO3QTNK.cjs.map} +1 -1
  64. package/dist/{pgboss-backend-QKBXVJ6B.js → pgboss-backend-I6DFUNRM.js} +3 -3
  65. package/dist/registry/index.json +22 -3
  66. package/dist/registry/js-mongo/account-security.json +1 -1
  67. package/dist/registry/js-mongo/admin-users.json +1 -1
  68. package/dist/registry/js-mongo/auth.json +1 -1
  69. package/dist/registry/js-mongo/auth@apple.json +1 -1
  70. package/dist/registry/js-mongo/auth@google.json +1 -1
  71. package/dist/registry/js-mongo/email-verification.json +1 -1
  72. package/dist/registry/js-mongo/forgot-password.json +1 -1
  73. package/dist/registry/js-mongo/user-profile.json +1 -1
  74. package/dist/registry/js-pg-model/account-security.json +1 -1
  75. package/dist/registry/js-pg-model/admin-users.json +1 -1
  76. package/dist/registry/js-pg-model/auth.json +1 -1
  77. package/dist/registry/js-pg-model/auth@apple.json +1 -1
  78. package/dist/registry/js-pg-model/auth@google.json +1 -1
  79. package/dist/registry/js-pg-model/email-verification.json +1 -1
  80. package/dist/registry/js-pg-model/forgot-password.json +1 -1
  81. package/dist/registry/js-pg-model/user-profile.json +1 -1
  82. package/dist/registry/js-pg-table/account-security.json +1 -1
  83. package/dist/registry/js-pg-table/admin-users.json +1 -1
  84. package/dist/registry/js-pg-table/auth.json +1 -1
  85. package/dist/registry/js-pg-table/auth@apple.json +1 -1
  86. package/dist/registry/js-pg-table/auth@google.json +1 -1
  87. package/dist/registry/js-pg-table/email-verification.json +1 -1
  88. package/dist/registry/js-pg-table/forgot-password.json +1 -1
  89. package/dist/registry/js-pg-table/user-profile.json +1 -1
  90. package/dist/registry/ts-mongo/account-security.json +1 -1
  91. package/dist/registry/ts-mongo/admin-users.json +1 -1
  92. package/dist/registry/ts-mongo/auth.json +1 -1
  93. package/dist/registry/ts-mongo/auth@apple.json +1 -1
  94. package/dist/registry/ts-mongo/auth@google.json +1 -1
  95. package/dist/registry/ts-mongo/email-verification.json +1 -1
  96. package/dist/registry/ts-mongo/forgot-password.json +1 -1
  97. package/dist/registry/ts-mongo/user-profile.json +1 -1
  98. package/dist/registry/ts-pg-model/account-security.json +1 -1
  99. package/dist/registry/ts-pg-model/admin-users.json +1 -1
  100. package/dist/registry/ts-pg-model/auth.json +1 -1
  101. package/dist/registry/ts-pg-model/auth@apple.json +1 -1
  102. package/dist/registry/ts-pg-model/auth@google.json +1 -1
  103. package/dist/registry/ts-pg-model/email-verification.json +1 -1
  104. package/dist/registry/ts-pg-model/forgot-password.json +1 -1
  105. package/dist/registry/ts-pg-model/user-profile.json +1 -1
  106. package/dist/registry/ts-pg-table/account-security.json +1 -1
  107. package/dist/registry/ts-pg-table/admin-users.json +1 -1
  108. package/dist/registry/ts-pg-table/auth.json +1 -1
  109. package/dist/registry/ts-pg-table/auth@apple.json +1 -1
  110. package/dist/registry/ts-pg-table/auth@google.json +1 -1
  111. package/dist/registry/ts-pg-table/email-verification.json +1 -1
  112. package/dist/registry/ts-pg-table/forgot-password.json +1 -1
  113. package/dist/registry/ts-pg-table/user-profile.json +1 -1
  114. package/dist/tasks/index.d.cts +1 -1
  115. package/dist/tasks/index.d.ts +1 -1
  116. package/dist/{types-BY-ObnZH.d.cts → types-DAsBKVM-.d.cts} +7 -1
  117. package/dist/{types-BY-ObnZH.d.ts → types-DAsBKVM-.d.ts} +7 -1
  118. package/package.json +1 -1
  119. package/dist/chunk-277BSYVH.js +0 -127
  120. package/dist/chunk-277BSYVH.js.map +0 -1
  121. package/dist/chunk-ANUSWEAP.cjs.map +0 -1
  122. package/dist/chunk-HXV543HZ.js +0 -177
  123. package/dist/chunk-HXV543HZ.js.map +0 -1
  124. package/dist/chunk-RRQ2RK5M.js.map +0 -1
  125. package/dist/chunk-RTF7PHS2.cjs.map +0 -1
  126. package/dist/chunk-TYR2GZZE.cjs.map +0 -1
  127. package/dist/chunk-UTM4PEVG.js.map +0 -1
  128. package/dist/chunk-VQSWSYK6.cjs +0 -177
  129. package/dist/chunk-VQSWSYK6.cjs.map +0 -1
  130. package/dist/chunk-X2US4RAM.cjs.map +0 -1
  131. package/dist/chunk-YL37D6KM.cjs +0 -127
  132. package/dist/chunk-YL37D6KM.cjs.map +0 -1
  133. package/dist/pgboss-backend-TCHI7CHM.cjs +0 -14
  134. /package/dist/{chunk-UBQYQPBU.js.map → chunk-45BWAR6P.js.map} +0 -0
  135. /package/dist/{chunk-RS4MXCPW.js.map → chunk-NI2BNGGV.js.map} +0 -0
  136. /package/dist/{pgboss-backend-QKBXVJ6B.js.map → pgboss-backend-I6DFUNRM.js.map} +0 -0
@@ -1,20 +1,19 @@
1
1
  #!/usr/bin/env node
2
2
  "use strict"; function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { newObj[key] = obj[key]; } } } newObj.default = obj; return newObj; } } function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }
3
3
 
4
- var _chunkR34R7QPDcjs = require('../chunk-R34R7QPD.cjs');
4
+ var _chunkDCJOWFVDcjs = require('../chunk-DCJOWFVD.cjs');
5
5
 
6
6
 
7
- var _chunkT4OHFU5Tcjs = require('../chunk-T4OHFU5T.cjs');
7
+ var _chunkFMA76PRHcjs = require('../chunk-FMA76PRH.cjs');
8
8
 
9
9
 
10
10
  var _chunkQL6EWT4Bcjs = require('../chunk-QL6EWT4B.cjs');
11
11
 
12
12
 
13
- var _chunkX2US4RAMcjs = require('../chunk-X2US4RAM.cjs');
14
- require('../chunk-VQSWSYK6.cjs');
13
+ var _chunkTYCYYLLMcjs = require('../chunk-TYCYYLLM.cjs');
15
14
  require('../chunk-7YEX4MQV.cjs');
16
15
  require('../chunk-TI24L4XE.cjs');
17
- require('../chunk-YL37D6KM.cjs');
16
+ require('../chunk-DUADUR6R.cjs');
18
17
 
19
18
  // src/cli/index.ts
20
19
  var _fs = require('fs'); var _fs2 = _interopRequireDefault(_fs);
@@ -29,6 +28,30 @@ var _commander = require('commander');
29
28
 
30
29
 
31
30
  var _picocolors = require('picocolors'); var _picocolors2 = _interopRequireDefault(_picocolors);
31
+
32
+ // src/cli/env.ts
33
+
34
+
35
+ function readEnvFile(cwd = process.cwd()) {
36
+ const envPath = _path2.default.join(cwd, ".env");
37
+ if (!_fs2.default.existsSync(envPath)) return {};
38
+ const vars = {};
39
+ for (const line of _fs2.default.readFileSync(envPath, "utf8").split("\n")) {
40
+ const trimmed = line.trim();
41
+ if (!trimmed || trimmed.startsWith("#")) continue;
42
+ const eq = trimmed.indexOf("=");
43
+ if (eq === -1) continue;
44
+ const key = trimmed.slice(0, eq).trim();
45
+ const raw = trimmed.slice(eq + 1).trim();
46
+ vars[key] = raw.replace(/^(['"])(.*)\1$/, "$2");
47
+ }
48
+ return vars;
49
+ }
50
+ function envVar(key, cwd = process.cwd()) {
51
+ return process.env[key] || readEnvFile(cwd)[key] || void 0;
52
+ }
53
+
54
+ // src/cli/commands/start.ts
32
55
  function startCommand() {
33
56
  const cmd = new (0, _commander.Command)("start");
34
57
  cmd.argument("<mode>", "dev | prod").description("Start the EFC server").action((mode) => {
@@ -145,7 +168,7 @@ function startProd() {
145
168
  console.log(_picocolors2.default.cyan("[EFC] Starting production server\u2026"));
146
169
  const child = _child_process.spawn.call(void 0, "node", [distEntry], {
147
170
  stdio: "inherit",
148
- env: { ...process.env, NODE_ENV: "production" }
171
+ env: { ...readEnvFile(cwd), ...process.env, NODE_ENV: "production" }
149
172
  });
150
173
  forwardSignals(child);
151
174
  }
@@ -466,28 +489,6 @@ export default async function seed(${ctx}) {
466
489
 
467
490
 
468
491
 
469
- // src/cli/env.ts
470
-
471
-
472
- function readEnvFile(cwd = process.cwd()) {
473
- const envPath = _path2.default.join(cwd, ".env");
474
- if (!_fs2.default.existsSync(envPath)) return {};
475
- const vars = {};
476
- for (const line of _fs2.default.readFileSync(envPath, "utf8").split("\n")) {
477
- const trimmed = line.trim();
478
- if (!trimmed || trimmed.startsWith("#")) continue;
479
- const eq = trimmed.indexOf("=");
480
- if (eq === -1) continue;
481
- const key = trimmed.slice(0, eq).trim();
482
- const raw = trimmed.slice(eq + 1).trim();
483
- vars[key] = raw.replace(/^(['"])(.*)\1$/, "$2");
484
- }
485
- return vars;
486
- }
487
- function envVar(key, cwd = process.cwd()) {
488
- return process.env[key] || readEnvFile(cwd)[key] || void 0;
489
- }
490
-
491
492
  // src/cli/commands/task-admin.ts
492
493
 
493
494
 
@@ -500,7 +501,7 @@ async function bullmqAdmin(redisUrl, queueName = "efc") {
500
501
  } catch (e2) {
501
502
  throw new Error("[EFC] bullmq is not installed. Run: npm install bullmq");
502
503
  }
503
- const queue = new bullmq.Queue(queueName, { connection: _chunkT4OHFU5Tcjs.parseRedisUrl.call(void 0, redisUrl) });
504
+ const queue = new bullmq.Queue(queueName, { connection: _chunkFMA76PRHcjs.parseRedisUrl.call(void 0, redisUrl) });
504
505
  const failedJobs = async (ids2) => {
505
506
  if (ids2.length === 0) return queue.getFailed(0, -1);
506
507
  const jobs = await Promise.all(ids2.map((id) => queue.getJob(id)));
@@ -551,7 +552,7 @@ async function connect(opts) {
551
552
  if (backend === "bullmq") return bullmqAdmin(_nullishCoalesce(redisUrl, () => ( "redis://localhost:6379")), opts.queue);
552
553
  if (backend === "pg-boss") {
553
554
  if (!databaseUrl) throw new Error("[EFC] pg-boss needs DATABASE_URL (or --database-url)");
554
- const { pgBossAdmin } = await Promise.resolve().then(() => _interopRequireWildcard(require("../pgboss-backend-TCHI7CHM.cjs")));
555
+ const { pgBossAdmin } = await Promise.resolve().then(() => _interopRequireWildcard(require("../pgboss-backend-DSO3QTNK.cjs")));
555
556
  return pgBossAdmin(databaseUrl, opts.queue);
556
557
  }
557
558
  throw new Error(`[EFC] Unknown task backend: ${backend}`);
@@ -645,7 +646,7 @@ function routesCommand() {
645
646
  console.error(_picocolors2.default.red("[EFC] Could not find apiDir (expected src/api)"));
646
647
  process.exit(1);
647
648
  }
648
- const routes = _chunkR34R7QPDcjs.scanDir.call(void 0, apiDir);
649
+ const routes = _chunkDCJOWFVDcjs.scanDir.call(void 0, apiDir);
649
650
  if (routes.length === 0) {
650
651
  console.log(_picocolors2.default.yellow("No routes found."));
651
652
  return;
@@ -1041,7 +1042,7 @@ function planAdd(cwd, registry, names, opts = {}, cfg = _nullishCoalesce(readEfc
1041
1042
  const dup = plan.prompts.some(
1042
1043
  (q) => q.name === p.name && JSON.stringify(q.when) === JSON.stringify(p.when)
1043
1044
  );
1044
- if (!dup && sets(p)) plan.prompts.push(p);
1045
+ if (!dup && (p.config !== void 0 || sets(p))) plan.prompts.push(p);
1045
1046
  }
1046
1047
  }
1047
1048
  return plan;
@@ -1087,11 +1088,36 @@ function envFromAnswers(prompts, answers) {
1087
1088
  }
1088
1089
  return env;
1089
1090
  }
1091
+ function configFromAnswers(prompts, answers) {
1092
+ const config = {};
1093
+ for (const p of prompts) {
1094
+ if (p.config !== void 0 && p.name in answers && promptApplies(p, answers)) {
1095
+ config[p.config] = answers[p.name];
1096
+ }
1097
+ }
1098
+ return config;
1099
+ }
1100
+ function setConfigValues(cwd, values) {
1101
+ const entries = Object.entries(values);
1102
+ if (entries.length === 0) return [];
1103
+ const file = ["efc.config.ts", "efc.config.js", "efc.config.mjs"].map((f) => _path2.default.join(cwd, f)).find((f) => _fs2.default.existsSync(f));
1104
+ if (!file) return entries.map(([k, v]) => `efc.config: set \`${k}: '${v}'\``);
1105
+ let text = _fs2.default.readFileSync(file, "utf8");
1106
+ const manual = [];
1107
+ for (const [key, value] of entries) {
1108
+ const re = new RegExp(`^(\\s*)${key}:\\s*(['"])[^'"\\n]*\\2`, "gm");
1109
+ const found = _nullishCoalesce(_optionalChain([text, 'access', _32 => _32.match, 'call', _33 => _33(re), 'optionalAccess', _34 => _34.length]), () => ( 0));
1110
+ if (found === 1) text = text.replace(re, `$1${key}: '${value}'`);
1111
+ else manual.push(`${_path2.default.basename(file)}: set \`${key}: '${value}'\``);
1112
+ }
1113
+ _fs2.default.writeFileSync(file, text);
1114
+ return manual;
1115
+ }
1090
1116
  function envLine(key, value) {
1091
1117
  if (!/[\s#"'`]/.test(value)) return `${key}=${value}`;
1092
1118
  return value.includes("'") ? `${key}="${value.replace(/"/g, '\\"')}"` : `${key}='${value}'`;
1093
1119
  }
1094
- function applyAdd(cwd, plan, registry, env = {}) {
1120
+ function applyAdd(cwd, plan, registry, env = {}, config = {}) {
1095
1121
  const result = {
1096
1122
  written: [],
1097
1123
  skipped: [],
@@ -1114,7 +1140,7 @@ function applyAdd(cwd, plan, registry, env = {}) {
1114
1140
  _fs2.default.mkdirSync(_path2.default.dirname(abs), { recursive: true });
1115
1141
  _fs2.default.writeFileSync(abs, f.content);
1116
1142
  result.written.push(f.path);
1117
- const model = _optionalChain([/^src\/model\/([A-Za-z0-9_]+)\.[jt]s$/, 'access', _32 => _32.exec, 'call', _33 => _33(f.path), 'optionalAccess', _34 => _34[1]]);
1143
+ const model = _optionalChain([/^src\/model\/([A-Za-z0-9_]+)\.[jt]s$/, 'access', _35 => _35.exec, 'call', _36 => _36(f.path), 'optionalAccess', _37 => _37[1]]);
1118
1144
  if (model && model !== "index" && !existed) newModels.push(model);
1119
1145
  }
1120
1146
  cfg.files[f.path] = sha256(f.content);
@@ -1148,6 +1174,7 @@ function applyAdd(cwd, plan, registry, env = {}) {
1148
1174
  plan.env.filter((v) => !readEnvKeys(exampleFile).includes(v.key)).map((v) => `${v.key}=${v.example}`)
1149
1175
  );
1150
1176
  }
1177
+ result.manual.push(...setConfigValues(cwd, config));
1151
1178
  if (cfg.modelApi === "defineTable" && cfg.database === "postgresql" && newModels.length) {
1152
1179
  result.manual.push(...registerModels(cwd, cfg.language, newModels));
1153
1180
  }
@@ -1331,7 +1358,8 @@ import { ${pascal} } from '../../../model/${pascal}.js';
1331
1358
 
1332
1359
  export const POST = async ${typedArgs} => {
1333
1360
  const { name, email, password } = req.body;
1334
- if (!name || !email || !password) {
1361
+ // Strings only: an object such as {"$ne": null} would be read as a filter operator and match any account.
1362
+ if (typeof name !== 'string' || typeof email !== 'string' || typeof password !== 'string' || !name || !email || !password) {
1335
1363
  return res.status(400).json({ error: 'name, email and password are required' });
1336
1364
  }
1337
1365
  const existing = await ${db.findOne(pascal, "{ email }")};
@@ -1353,15 +1381,19 @@ import { ${pascal} } from '../../../model/${pascal}.js';
1353
1381
 
1354
1382
  export const POST = async ${typedArgs} => {
1355
1383
  const { email, password } = req.body;
1356
- if (!email || !password) return res.status(400).json({ error: 'email and password are required' });
1384
+ // Strings only: an object such as {"$ne": null} would be read as a filter operator and match any account.
1385
+ if (typeof email !== 'string' || typeof password !== 'string' || !email || !password) {
1386
+ return res.status(400).json({ error: 'email and password are required' });
1387
+ }
1357
1388
 
1358
1389
  const record = await ${db.findOne(pascal, "{ email }")};
1359
1390
  if (!record) return res.status(401).json({ error: 'Invalid credentials' });
1360
1391
  const match = await verifyPassword(password, record.password);
1361
1392
  if (!match) return res.status(401).json({ error: 'Invalid credentials' });
1362
1393
  if (!record.isActive) return res.status(403).json({ error: 'Account suspended' });
1363
- await issueToken(res, { id: record.id, role: record.role, email: record.email });
1364
- res.json({ message: 'Logged in as ${slug}' });
1394
+ const token = await issueToken(res, { id: record.id, role: record.role, email: record.email });
1395
+ // bearer: the client stores the token itself; http-only: it's a cookie.
1396
+ res.json({ message: 'Logged in as ${slug}', ...(token ? { token } : {}) });
1365
1397
  };
1366
1398
  `;
1367
1399
  }
@@ -1424,19 +1456,19 @@ function generateEntityAuth(cwd, entityName, cfg, options) {
1424
1456
  for (const f of files) {
1425
1457
  const abs = _path2.default.join(cwd, f.rel);
1426
1458
  const exists = _fs2.default.existsSync(abs);
1427
- if (exists && !_optionalChain([options, 'optionalAccess', _35 => _35.overwrite])) {
1459
+ if (exists && !_optionalChain([options, 'optionalAccess', _38 => _38.overwrite])) {
1428
1460
  result.conflicts.push(f.rel);
1429
1461
  result.manual.push(`${f.rel} already exists \u2014 skipped (pass --overwrite to replace)`);
1430
1462
  continue;
1431
1463
  }
1432
1464
  result.written.push(f.rel);
1433
- if (!_optionalChain([options, 'optionalAccess', _36 => _36.dryRun])) {
1465
+ if (!_optionalChain([options, 'optionalAccess', _39 => _39.dryRun])) {
1434
1466
  _fs2.default.mkdirSync(_path2.default.dirname(abs), { recursive: true });
1435
1467
  _fs2.default.writeFileSync(abs, f.content);
1436
1468
  cfg.files[f.rel] = sha256(f.content);
1437
1469
  }
1438
1470
  }
1439
- if (entityUsesTables(cfg) && !_optionalChain([options, 'optionalAccess', _37 => _37.dryRun])) {
1471
+ if (entityUsesTables(cfg) && !_optionalChain([options, 'optionalAccess', _40 => _40.dryRun])) {
1440
1472
  result.manual.push(...registerModels(cwd, cfg.language, [pascal]));
1441
1473
  }
1442
1474
  const envFile = _path2.default.join(cwd, ".env");
@@ -1444,7 +1476,7 @@ function generateEntityAuth(cwd, entityName, cfg, options) {
1444
1476
  const envKeys = readEnvKeys(envFile);
1445
1477
  if (!envKeys.includes("JWT_SECRET")) {
1446
1478
  const secret = _crypto2.default.randomBytes(64).toString("hex");
1447
- if (!_optionalChain([options, 'optionalAccess', _38 => _38.dryRun])) {
1479
+ if (!_optionalChain([options, 'optionalAccess', _41 => _41.dryRun])) {
1448
1480
  appendEnv(envFile, [`JWT_SECRET=${secret}`]);
1449
1481
  const exampleFile = _path2.default.join(cwd, ".env.example");
1450
1482
  if (_fs2.default.existsSync(exampleFile) && !readEnvKeys(exampleFile).includes("JWT_SECRET")) {
@@ -1456,7 +1488,7 @@ function generateEntityAuth(cwd, entityName, cfg, options) {
1456
1488
  }
1457
1489
  const itemName = `auth:${slug}`;
1458
1490
  if (!cfg.items.includes(itemName)) cfg.items.push(itemName);
1459
- if (!_optionalChain([options, 'optionalAccess', _39 => _39.dryRun])) {
1491
+ if (!_optionalChain([options, 'optionalAccess', _42 => _42.dryRun])) {
1460
1492
  writeEfcJson(cwd, cfg);
1461
1493
  }
1462
1494
  return result;
@@ -1732,6 +1764,7 @@ function addCommand() {
1732
1764
  if (!opts.yes && !tty) fail("Not a terminal \u2014 pass --yes to add without confirming.");
1733
1765
  const ask = opts.prompt && tty && plan.prompts.length > 0;
1734
1766
  let env = {};
1767
+ let config = {};
1735
1768
  if (!opts.yes || ask) {
1736
1769
  const term = openTerminal();
1737
1770
  try {
@@ -1740,15 +1773,19 @@ function addCommand() {
1740
1773
  return;
1741
1774
  }
1742
1775
  if (ask) {
1743
- console.log(_picocolors2.default.bold("\n Configuration") + _picocolors2.default.dim(" (saved to .env)\n"));
1744
- env = envFromAnswers(plan.prompts, await askPrompts(term, plan.prompts, cwd));
1776
+ const where = plan.prompts.some((p) => p.config !== void 0) ? ".env / efc.config" : ".env";
1777
+ console.log(_picocolors2.default.bold("\n Configuration") + _picocolors2.default.dim(` (saved to ${where})
1778
+ `));
1779
+ const answers = await askPrompts(term, plan.prompts, cwd);
1780
+ env = envFromAnswers(plan.prompts, answers);
1781
+ config = configFromAnswers(plan.prompts, answers);
1745
1782
  console.log();
1746
1783
  }
1747
1784
  } finally {
1748
1785
  term.close();
1749
1786
  }
1750
1787
  }
1751
- const result = applyAdd(cwd, plan, registry, env);
1788
+ const result = applyAdd(cwd, plan, registry, env, config);
1752
1789
  console.log(
1753
1790
  _picocolors2.default.green(` \u2713 ${result.written.length} file(s) written`) + (result.conflicts.length ? _picocolors2.default.yellow(`, ${result.conflicts.length} left alone`) : "")
1754
1791
  );
@@ -1796,7 +1833,7 @@ function listCommand() {
1796
1833
  try {
1797
1834
  const cwd = process.cwd();
1798
1835
  const registry = new Registry();
1799
- const installed = new Set(_nullishCoalesce(_optionalChain([readEfcJson, 'call', _40 => _40(cwd), 'optionalAccess', _41 => _41.items]), () => ( [])));
1836
+ const installed = new Set(_nullishCoalesce(_optionalChain([readEfcJson, 'call', _43 => _43(cwd), 'optionalAccess', _44 => _44.items]), () => ( [])));
1800
1837
  const groups = [...new Set(registry.index.items.map((i) => i.group))];
1801
1838
  for (const group of groups) {
1802
1839
  console.log(_picocolors2.default.bold(`
@@ -1807,7 +1844,7 @@ function listCommand() {
1807
1844
  console.log(` ${mark} ${_picocolors2.default.cyan(item.name.padEnd(20))} ${item.description}${deps}`);
1808
1845
  }
1809
1846
  }
1810
- const entities = (_nullishCoalesce(_optionalChain([readEfcJson, 'call', _42 => _42(cwd), 'optionalAccess', _43 => _43.items]), () => ( []))).filter((i) => i.startsWith("auth:")).map((i) => i.slice(5));
1847
+ const entities = (_nullishCoalesce(_optionalChain([readEfcJson, 'call', _45 => _45(cwd), 'optionalAccess', _46 => _46.items]), () => ( []))).filter((i) => i.startsWith("auth:")).map((i) => i.slice(5));
1811
1848
  if (entities.length > 0) {
1812
1849
  console.log(_picocolors2.default.bold("\n custom auth entities"));
1813
1850
  for (const e of entities) {
@@ -1965,15 +2002,15 @@ function parseAttrs(s) {
1965
2002
  return out;
1966
2003
  }
1967
2004
  function arg(a, name) {
1968
- if (!_optionalChain([a, 'optionalAccess', _44 => _44.args])) return void 0;
2005
+ if (!_optionalChain([a, 'optionalAccess', _47 => _47.args])) return void 0;
1969
2006
  const parts = splitTop(a.args, ",");
1970
2007
  if (name) {
1971
2008
  const p = parts.find((x) => x.startsWith(`${name}:`));
1972
- return _optionalChain([p, 'optionalAccess', _45 => _45.slice, 'call', _46 => _46(name.length + 1), 'access', _47 => _47.trim, 'call', _48 => _48()]);
2009
+ return _optionalChain([p, 'optionalAccess', _48 => _48.slice, 'call', _49 => _49(name.length + 1), 'access', _50 => _50.trim, 'call', _51 => _51()]);
1973
2010
  }
1974
2011
  return parts.find((x) => !/^\w+\s*:/.test(x));
1975
2012
  }
1976
- var unquote = (s) => _optionalChain([s, 'optionalAccess', _49 => _49.replace, 'call', _50 => _50(/^"(.*)"$/, "$1")]);
2013
+ var unquote = (s) => _optionalChain([s, 'optionalAccess', _52 => _52.replace, 'call', _53 => _53(/^"(.*)"$/, "$1")]);
1977
2014
  var list = (s) => s ? splitTop(s.replace(/^\[|\]$/g, ""), ",").map((x) => x.trim()).filter(Boolean) : [];
1978
2015
  function parsePrisma(source) {
1979
2016
  const text = source.replace(/\/\/.*$/gm, "");
@@ -1986,7 +2023,7 @@ function parsePrisma(source) {
1986
2023
  const [, kind, name, body] = block;
1987
2024
  const lines = body.split("\n").map((l) => l.trim()).filter(Boolean);
1988
2025
  if (kind === "datasource") {
1989
- provider = unquote(_optionalChain([/provider\s*=\s*("[^"]*")/, 'access', _51 => _51.exec, 'call', _52 => _52(body), 'optionalAccess', _53 => _53[1]]));
2026
+ provider = unquote(_optionalChain([/provider\s*=\s*("[^"]*")/, 'access', _54 => _54.exec, 'call', _55 => _55(body), 'optionalAccess', _56 => _56[1]]));
1990
2027
  } else if (kind === "enum") {
1991
2028
  const values = [];
1992
2029
  const names = [];
@@ -2048,7 +2085,7 @@ function importPrisma(source) {
2048
2085
  const def = _nullishCoalesce(arg(attr(_nullishCoalesce(id, () => ( { attrs: [] })), "@default")), () => ( ""));
2049
2086
  idKind.set(
2050
2087
  m.name,
2051
- _optionalChain([id, 'optionalAccess', _54 => _54.type]) === "Int" && /autoincrement/.test(def) ? "serial" : _optionalChain([id, 'optionalAccess', _55 => _55.type]) === "BigInt" && /autoincrement/.test(def) ? "bigserial" : "uuid"
2088
+ _optionalChain([id, 'optionalAccess', _57 => _57.type]) === "Int" && /autoincrement/.test(def) ? "serial" : _optionalChain([id, 'optionalAccess', _58 => _58.type]) === "BigInt" && /autoincrement/.test(def) ? "bigserial" : "uuid"
2052
2089
  );
2053
2090
  }
2054
2091
  const rels = [];
@@ -2078,7 +2115,7 @@ function importPrisma(source) {
2078
2115
  const fields = [];
2079
2116
  const relations = {};
2080
2117
  const table = _nullishCoalesce(unquote(arg(blocks(m, "@@map")[0])), () => ( m.name));
2081
- if (table !== _chunkX2US4RAMcjs.tableNameFor.call(void 0, m.name)) options["collection"] = table;
2118
+ if (table !== _chunkTYCYYLLMcjs.tableNameFor.call(void 0, m.name)) options["collection"] = table;
2082
2119
  const kind = idKind.get(m.name);
2083
2120
  if (kind !== "uuid") options["id"] = kind;
2084
2121
  if (blocks(m, "@@id").length) {
@@ -2134,7 +2171,7 @@ function importPrisma(source) {
2134
2171
  continue;
2135
2172
  }
2136
2173
  const other = partner(r);
2137
- if (r.list && _optionalChain([other, 'optionalAccess', _56 => _56.list])) {
2174
+ if (r.list && _optionalChain([other, 'optionalAccess', _59 => _59.list])) {
2138
2175
  if (m.name < r.target || m.name === r.target && f.name < other.field) {
2139
2176
  fields.push([
2140
2177
  f.name,
@@ -2204,7 +2241,7 @@ function importPrisma(source) {
2204
2241
  }
2205
2242
  function scalarDef(f, enums, notes) {
2206
2243
  const db = f.attrs.find((a) => a.name.startsWith("@db."));
2207
- const dbType = _optionalChain([db, 'optionalAccess', _57 => _57.name, 'access', _58 => _58.slice, 'call', _59 => _59(4)]);
2244
+ const dbType = _optionalChain([db, 'optionalAccess', _60 => _60.name, 'access', _61 => _61.slice, 'call', _62 => _62(4)]);
2208
2245
  let def;
2209
2246
  const e = enums.get(f.type);
2210
2247
  if (e) def = { type: "string", enum: e.values, nativeEnum: true };
@@ -2212,7 +2249,7 @@ function scalarDef(f, enums, notes) {
2212
2249
  switch (f.type) {
2213
2250
  case "String":
2214
2251
  if (dbType === "Uuid") def = { type: "uuid" };
2215
- else if (dbType === "VarChar" && _optionalChain([db, 'optionalAccess', _60 => _60.args]))
2252
+ else if (dbType === "VarChar" && _optionalChain([db, 'optionalAccess', _63 => _63.args]))
2216
2253
  def = { type: "string", maxLength: Number(db.args) };
2217
2254
  else def = { type: "string" };
2218
2255
  break;
@@ -2226,7 +2263,7 @@ function scalarDef(f, enums, notes) {
2226
2263
  def = { type: "number" };
2227
2264
  break;
2228
2265
  case "Decimal": {
2229
- const [p, s] = (_nullishCoalesce(_optionalChain([db, 'optionalAccess', _61 => _61.args]), () => ( ""))).split(",").map((x) => Number(x.trim()));
2266
+ const [p, s] = (_nullishCoalesce(_optionalChain([db, 'optionalAccess', _64 => _64.args]), () => ( ""))).split(",").map((x) => Number(x.trim()));
2230
2267
  def = p ? { type: "decimal", precision: p, scale: _nullishCoalesce(s, () => ( 0)) } : { type: "decimal" };
2231
2268
  break;
2232
2269
  }