express-file-cluster 0.9.3 → 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 (133) 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 +70 -35
  37. package/dist/cli/index.cjs.map +1 -1
  38. package/dist/cli/index.js +50 -15
  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/contributing/index.md +1 -1
  44. package/dist/docs/getting-started/index.md +1 -1
  45. package/dist/docs/guides/authentication.md +34 -24
  46. package/dist/docs/guides/database.md +12 -0
  47. package/dist/docs/guides/oauth.md +15 -1
  48. package/dist/docs/index.md +2 -1
  49. package/dist/docs/skills/SKILL.md +2 -2
  50. package/dist/docs/skills/api-surface.md +5 -4
  51. package/dist/docs/skills/auth-internals.md +3 -3
  52. package/dist/docs/versioning.md +42 -0
  53. package/dist/index.cjs +73 -49
  54. package/dist/index.cjs.map +1 -1
  55. package/dist/index.d.cts +2 -2
  56. package/dist/index.d.ts +2 -2
  57. package/dist/index.js +36 -12
  58. package/dist/index.js.map +1 -1
  59. package/dist/pgboss-backend-DSO3QTNK.cjs +14 -0
  60. package/dist/{pgboss-backend-TCHI7CHM.cjs.map → pgboss-backend-DSO3QTNK.cjs.map} +1 -1
  61. package/dist/{pgboss-backend-QKBXVJ6B.js → pgboss-backend-I6DFUNRM.js} +3 -3
  62. package/dist/registry/index.json +22 -3
  63. package/dist/registry/js-mongo/account-security.json +1 -1
  64. package/dist/registry/js-mongo/admin-users.json +1 -1
  65. package/dist/registry/js-mongo/auth.json +1 -1
  66. package/dist/registry/js-mongo/auth@apple.json +1 -1
  67. package/dist/registry/js-mongo/auth@google.json +1 -1
  68. package/dist/registry/js-mongo/email-verification.json +1 -1
  69. package/dist/registry/js-mongo/forgot-password.json +1 -1
  70. package/dist/registry/js-mongo/user-profile.json +1 -1
  71. package/dist/registry/js-pg-model/account-security.json +1 -1
  72. package/dist/registry/js-pg-model/admin-users.json +1 -1
  73. package/dist/registry/js-pg-model/auth.json +1 -1
  74. package/dist/registry/js-pg-model/auth@apple.json +1 -1
  75. package/dist/registry/js-pg-model/auth@google.json +1 -1
  76. package/dist/registry/js-pg-model/email-verification.json +1 -1
  77. package/dist/registry/js-pg-model/forgot-password.json +1 -1
  78. package/dist/registry/js-pg-model/user-profile.json +1 -1
  79. package/dist/registry/js-pg-table/account-security.json +1 -1
  80. package/dist/registry/js-pg-table/admin-users.json +1 -1
  81. package/dist/registry/js-pg-table/auth.json +1 -1
  82. package/dist/registry/js-pg-table/auth@apple.json +1 -1
  83. package/dist/registry/js-pg-table/auth@google.json +1 -1
  84. package/dist/registry/js-pg-table/email-verification.json +1 -1
  85. package/dist/registry/js-pg-table/forgot-password.json +1 -1
  86. package/dist/registry/js-pg-table/user-profile.json +1 -1
  87. package/dist/registry/ts-mongo/account-security.json +1 -1
  88. package/dist/registry/ts-mongo/admin-users.json +1 -1
  89. package/dist/registry/ts-mongo/auth.json +1 -1
  90. package/dist/registry/ts-mongo/auth@apple.json +1 -1
  91. package/dist/registry/ts-mongo/auth@google.json +1 -1
  92. package/dist/registry/ts-mongo/email-verification.json +1 -1
  93. package/dist/registry/ts-mongo/forgot-password.json +1 -1
  94. package/dist/registry/ts-mongo/user-profile.json +1 -1
  95. package/dist/registry/ts-pg-model/account-security.json +1 -1
  96. package/dist/registry/ts-pg-model/admin-users.json +1 -1
  97. package/dist/registry/ts-pg-model/auth.json +1 -1
  98. package/dist/registry/ts-pg-model/auth@apple.json +1 -1
  99. package/dist/registry/ts-pg-model/auth@google.json +1 -1
  100. package/dist/registry/ts-pg-model/email-verification.json +1 -1
  101. package/dist/registry/ts-pg-model/forgot-password.json +1 -1
  102. package/dist/registry/ts-pg-model/user-profile.json +1 -1
  103. package/dist/registry/ts-pg-table/account-security.json +1 -1
  104. package/dist/registry/ts-pg-table/admin-users.json +1 -1
  105. package/dist/registry/ts-pg-table/auth.json +1 -1
  106. package/dist/registry/ts-pg-table/auth@apple.json +1 -1
  107. package/dist/registry/ts-pg-table/auth@google.json +1 -1
  108. package/dist/registry/ts-pg-table/email-verification.json +1 -1
  109. package/dist/registry/ts-pg-table/forgot-password.json +1 -1
  110. package/dist/registry/ts-pg-table/user-profile.json +1 -1
  111. package/dist/tasks/index.d.cts +1 -1
  112. package/dist/tasks/index.d.ts +1 -1
  113. package/dist/{types-BY-ObnZH.d.cts → types-DAsBKVM-.d.cts} +7 -1
  114. package/dist/{types-BY-ObnZH.d.ts → types-DAsBKVM-.d.ts} +7 -1
  115. package/package.json +1 -1
  116. package/dist/chunk-277BSYVH.js +0 -127
  117. package/dist/chunk-277BSYVH.js.map +0 -1
  118. package/dist/chunk-ANUSWEAP.cjs.map +0 -1
  119. package/dist/chunk-HXV543HZ.js +0 -177
  120. package/dist/chunk-HXV543HZ.js.map +0 -1
  121. package/dist/chunk-RRQ2RK5M.js.map +0 -1
  122. package/dist/chunk-RTF7PHS2.cjs.map +0 -1
  123. package/dist/chunk-TYR2GZZE.cjs.map +0 -1
  124. package/dist/chunk-UTM4PEVG.js.map +0 -1
  125. package/dist/chunk-VQSWSYK6.cjs +0 -177
  126. package/dist/chunk-VQSWSYK6.cjs.map +0 -1
  127. package/dist/chunk-X2US4RAM.cjs.map +0 -1
  128. package/dist/chunk-YL37D6KM.cjs +0 -127
  129. package/dist/chunk-YL37D6KM.cjs.map +0 -1
  130. package/dist/pgboss-backend-TCHI7CHM.cjs +0 -14
  131. /package/dist/{chunk-UBQYQPBU.js.map → chunk-45BWAR6P.js.map} +0 -0
  132. /package/dist/{chunk-RS4MXCPW.js.map → chunk-NI2BNGGV.js.map} +0 -0
  133. /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);
@@ -502,7 +501,7 @@ async function bullmqAdmin(redisUrl, queueName = "efc") {
502
501
  } catch (e2) {
503
502
  throw new Error("[EFC] bullmq is not installed. Run: npm install bullmq");
504
503
  }
505
- 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) });
506
505
  const failedJobs = async (ids2) => {
507
506
  if (ids2.length === 0) return queue.getFailed(0, -1);
508
507
  const jobs = await Promise.all(ids2.map((id) => queue.getJob(id)));
@@ -553,7 +552,7 @@ async function connect(opts) {
553
552
  if (backend === "bullmq") return bullmqAdmin(_nullishCoalesce(redisUrl, () => ( "redis://localhost:6379")), opts.queue);
554
553
  if (backend === "pg-boss") {
555
554
  if (!databaseUrl) throw new Error("[EFC] pg-boss needs DATABASE_URL (or --database-url)");
556
- 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")));
557
556
  return pgBossAdmin(databaseUrl, opts.queue);
558
557
  }
559
558
  throw new Error(`[EFC] Unknown task backend: ${backend}`);
@@ -647,7 +646,7 @@ function routesCommand() {
647
646
  console.error(_picocolors2.default.red("[EFC] Could not find apiDir (expected src/api)"));
648
647
  process.exit(1);
649
648
  }
650
- const routes = _chunkR34R7QPDcjs.scanDir.call(void 0, apiDir);
649
+ const routes = _chunkDCJOWFVDcjs.scanDir.call(void 0, apiDir);
651
650
  if (routes.length === 0) {
652
651
  console.log(_picocolors2.default.yellow("No routes found."));
653
652
  return;
@@ -1043,7 +1042,7 @@ function planAdd(cwd, registry, names, opts = {}, cfg = _nullishCoalesce(readEfc
1043
1042
  const dup = plan.prompts.some(
1044
1043
  (q) => q.name === p.name && JSON.stringify(q.when) === JSON.stringify(p.when)
1045
1044
  );
1046
- if (!dup && sets(p)) plan.prompts.push(p);
1045
+ if (!dup && (p.config !== void 0 || sets(p))) plan.prompts.push(p);
1047
1046
  }
1048
1047
  }
1049
1048
  return plan;
@@ -1089,11 +1088,36 @@ function envFromAnswers(prompts, answers) {
1089
1088
  }
1090
1089
  return env;
1091
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
+ }
1092
1116
  function envLine(key, value) {
1093
1117
  if (!/[\s#"'`]/.test(value)) return `${key}=${value}`;
1094
1118
  return value.includes("'") ? `${key}="${value.replace(/"/g, '\\"')}"` : `${key}='${value}'`;
1095
1119
  }
1096
- function applyAdd(cwd, plan, registry, env = {}) {
1120
+ function applyAdd(cwd, plan, registry, env = {}, config = {}) {
1097
1121
  const result = {
1098
1122
  written: [],
1099
1123
  skipped: [],
@@ -1116,7 +1140,7 @@ function applyAdd(cwd, plan, registry, env = {}) {
1116
1140
  _fs2.default.mkdirSync(_path2.default.dirname(abs), { recursive: true });
1117
1141
  _fs2.default.writeFileSync(abs, f.content);
1118
1142
  result.written.push(f.path);
1119
- 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]]);
1120
1144
  if (model && model !== "index" && !existed) newModels.push(model);
1121
1145
  }
1122
1146
  cfg.files[f.path] = sha256(f.content);
@@ -1150,6 +1174,7 @@ function applyAdd(cwd, plan, registry, env = {}) {
1150
1174
  plan.env.filter((v) => !readEnvKeys(exampleFile).includes(v.key)).map((v) => `${v.key}=${v.example}`)
1151
1175
  );
1152
1176
  }
1177
+ result.manual.push(...setConfigValues(cwd, config));
1153
1178
  if (cfg.modelApi === "defineTable" && cfg.database === "postgresql" && newModels.length) {
1154
1179
  result.manual.push(...registerModels(cwd, cfg.language, newModels));
1155
1180
  }
@@ -1333,7 +1358,8 @@ import { ${pascal} } from '../../../model/${pascal}.js';
1333
1358
 
1334
1359
  export const POST = async ${typedArgs} => {
1335
1360
  const { name, email, password } = req.body;
1336
- 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) {
1337
1363
  return res.status(400).json({ error: 'name, email and password are required' });
1338
1364
  }
1339
1365
  const existing = await ${db.findOne(pascal, "{ email }")};
@@ -1355,15 +1381,19 @@ import { ${pascal} } from '../../../model/${pascal}.js';
1355
1381
 
1356
1382
  export const POST = async ${typedArgs} => {
1357
1383
  const { email, password } = req.body;
1358
- 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
+ }
1359
1388
 
1360
1389
  const record = await ${db.findOne(pascal, "{ email }")};
1361
1390
  if (!record) return res.status(401).json({ error: 'Invalid credentials' });
1362
1391
  const match = await verifyPassword(password, record.password);
1363
1392
  if (!match) return res.status(401).json({ error: 'Invalid credentials' });
1364
1393
  if (!record.isActive) return res.status(403).json({ error: 'Account suspended' });
1365
- await issueToken(res, { id: record.id, role: record.role, email: record.email });
1366
- 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 } : {}) });
1367
1397
  };
1368
1398
  `;
1369
1399
  }
@@ -1426,19 +1456,19 @@ function generateEntityAuth(cwd, entityName, cfg, options) {
1426
1456
  for (const f of files) {
1427
1457
  const abs = _path2.default.join(cwd, f.rel);
1428
1458
  const exists = _fs2.default.existsSync(abs);
1429
- if (exists && !_optionalChain([options, 'optionalAccess', _35 => _35.overwrite])) {
1459
+ if (exists && !_optionalChain([options, 'optionalAccess', _38 => _38.overwrite])) {
1430
1460
  result.conflicts.push(f.rel);
1431
1461
  result.manual.push(`${f.rel} already exists \u2014 skipped (pass --overwrite to replace)`);
1432
1462
  continue;
1433
1463
  }
1434
1464
  result.written.push(f.rel);
1435
- if (!_optionalChain([options, 'optionalAccess', _36 => _36.dryRun])) {
1465
+ if (!_optionalChain([options, 'optionalAccess', _39 => _39.dryRun])) {
1436
1466
  _fs2.default.mkdirSync(_path2.default.dirname(abs), { recursive: true });
1437
1467
  _fs2.default.writeFileSync(abs, f.content);
1438
1468
  cfg.files[f.rel] = sha256(f.content);
1439
1469
  }
1440
1470
  }
1441
- if (entityUsesTables(cfg) && !_optionalChain([options, 'optionalAccess', _37 => _37.dryRun])) {
1471
+ if (entityUsesTables(cfg) && !_optionalChain([options, 'optionalAccess', _40 => _40.dryRun])) {
1442
1472
  result.manual.push(...registerModels(cwd, cfg.language, [pascal]));
1443
1473
  }
1444
1474
  const envFile = _path2.default.join(cwd, ".env");
@@ -1446,7 +1476,7 @@ function generateEntityAuth(cwd, entityName, cfg, options) {
1446
1476
  const envKeys = readEnvKeys(envFile);
1447
1477
  if (!envKeys.includes("JWT_SECRET")) {
1448
1478
  const secret = _crypto2.default.randomBytes(64).toString("hex");
1449
- if (!_optionalChain([options, 'optionalAccess', _38 => _38.dryRun])) {
1479
+ if (!_optionalChain([options, 'optionalAccess', _41 => _41.dryRun])) {
1450
1480
  appendEnv(envFile, [`JWT_SECRET=${secret}`]);
1451
1481
  const exampleFile = _path2.default.join(cwd, ".env.example");
1452
1482
  if (_fs2.default.existsSync(exampleFile) && !readEnvKeys(exampleFile).includes("JWT_SECRET")) {
@@ -1458,7 +1488,7 @@ function generateEntityAuth(cwd, entityName, cfg, options) {
1458
1488
  }
1459
1489
  const itemName = `auth:${slug}`;
1460
1490
  if (!cfg.items.includes(itemName)) cfg.items.push(itemName);
1461
- if (!_optionalChain([options, 'optionalAccess', _39 => _39.dryRun])) {
1491
+ if (!_optionalChain([options, 'optionalAccess', _42 => _42.dryRun])) {
1462
1492
  writeEfcJson(cwd, cfg);
1463
1493
  }
1464
1494
  return result;
@@ -1734,6 +1764,7 @@ function addCommand() {
1734
1764
  if (!opts.yes && !tty) fail("Not a terminal \u2014 pass --yes to add without confirming.");
1735
1765
  const ask = opts.prompt && tty && plan.prompts.length > 0;
1736
1766
  let env = {};
1767
+ let config = {};
1737
1768
  if (!opts.yes || ask) {
1738
1769
  const term = openTerminal();
1739
1770
  try {
@@ -1742,15 +1773,19 @@ function addCommand() {
1742
1773
  return;
1743
1774
  }
1744
1775
  if (ask) {
1745
- console.log(_picocolors2.default.bold("\n Configuration") + _picocolors2.default.dim(" (saved to .env)\n"));
1746
- 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);
1747
1782
  console.log();
1748
1783
  }
1749
1784
  } finally {
1750
1785
  term.close();
1751
1786
  }
1752
1787
  }
1753
- const result = applyAdd(cwd, plan, registry, env);
1788
+ const result = applyAdd(cwd, plan, registry, env, config);
1754
1789
  console.log(
1755
1790
  _picocolors2.default.green(` \u2713 ${result.written.length} file(s) written`) + (result.conflicts.length ? _picocolors2.default.yellow(`, ${result.conflicts.length} left alone`) : "")
1756
1791
  );
@@ -1798,7 +1833,7 @@ function listCommand() {
1798
1833
  try {
1799
1834
  const cwd = process.cwd();
1800
1835
  const registry = new Registry();
1801
- 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]), () => ( [])));
1802
1837
  const groups = [...new Set(registry.index.items.map((i) => i.group))];
1803
1838
  for (const group of groups) {
1804
1839
  console.log(_picocolors2.default.bold(`
@@ -1809,7 +1844,7 @@ function listCommand() {
1809
1844
  console.log(` ${mark} ${_picocolors2.default.cyan(item.name.padEnd(20))} ${item.description}${deps}`);
1810
1845
  }
1811
1846
  }
1812
- 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));
1813
1848
  if (entities.length > 0) {
1814
1849
  console.log(_picocolors2.default.bold("\n custom auth entities"));
1815
1850
  for (const e of entities) {
@@ -1967,15 +2002,15 @@ function parseAttrs(s) {
1967
2002
  return out;
1968
2003
  }
1969
2004
  function arg(a, name) {
1970
- if (!_optionalChain([a, 'optionalAccess', _44 => _44.args])) return void 0;
2005
+ if (!_optionalChain([a, 'optionalAccess', _47 => _47.args])) return void 0;
1971
2006
  const parts = splitTop(a.args, ",");
1972
2007
  if (name) {
1973
2008
  const p = parts.find((x) => x.startsWith(`${name}:`));
1974
- 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()]);
1975
2010
  }
1976
2011
  return parts.find((x) => !/^\w+\s*:/.test(x));
1977
2012
  }
1978
- 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")]);
1979
2014
  var list = (s) => s ? splitTop(s.replace(/^\[|\]$/g, ""), ",").map((x) => x.trim()).filter(Boolean) : [];
1980
2015
  function parsePrisma(source) {
1981
2016
  const text = source.replace(/\/\/.*$/gm, "");
@@ -1988,7 +2023,7 @@ function parsePrisma(source) {
1988
2023
  const [, kind, name, body] = block;
1989
2024
  const lines = body.split("\n").map((l) => l.trim()).filter(Boolean);
1990
2025
  if (kind === "datasource") {
1991
- 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]]));
1992
2027
  } else if (kind === "enum") {
1993
2028
  const values = [];
1994
2029
  const names = [];
@@ -2050,7 +2085,7 @@ function importPrisma(source) {
2050
2085
  const def = _nullishCoalesce(arg(attr(_nullishCoalesce(id, () => ( { attrs: [] })), "@default")), () => ( ""));
2051
2086
  idKind.set(
2052
2087
  m.name,
2053
- _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"
2054
2089
  );
2055
2090
  }
2056
2091
  const rels = [];
@@ -2080,7 +2115,7 @@ function importPrisma(source) {
2080
2115
  const fields = [];
2081
2116
  const relations = {};
2082
2117
  const table = _nullishCoalesce(unquote(arg(blocks(m, "@@map")[0])), () => ( m.name));
2083
- 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;
2084
2119
  const kind = idKind.get(m.name);
2085
2120
  if (kind !== "uuid") options["id"] = kind;
2086
2121
  if (blocks(m, "@@id").length) {
@@ -2136,7 +2171,7 @@ function importPrisma(source) {
2136
2171
  continue;
2137
2172
  }
2138
2173
  const other = partner(r);
2139
- if (r.list && _optionalChain([other, 'optionalAccess', _56 => _56.list])) {
2174
+ if (r.list && _optionalChain([other, 'optionalAccess', _59 => _59.list])) {
2140
2175
  if (m.name < r.target || m.name === r.target && f.name < other.field) {
2141
2176
  fields.push([
2142
2177
  f.name,
@@ -2206,7 +2241,7 @@ function importPrisma(source) {
2206
2241
  }
2207
2242
  function scalarDef(f, enums, notes) {
2208
2243
  const db = f.attrs.find((a) => a.name.startsWith("@db."));
2209
- 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)]);
2210
2245
  let def;
2211
2246
  const e = enums.get(f.type);
2212
2247
  if (e) def = { type: "string", enum: e.values, nativeEnum: true };
@@ -2214,7 +2249,7 @@ function scalarDef(f, enums, notes) {
2214
2249
  switch (f.type) {
2215
2250
  case "String":
2216
2251
  if (dbType === "Uuid") def = { type: "uuid" };
2217
- else if (dbType === "VarChar" && _optionalChain([db, 'optionalAccess', _60 => _60.args]))
2252
+ else if (dbType === "VarChar" && _optionalChain([db, 'optionalAccess', _63 => _63.args]))
2218
2253
  def = { type: "string", maxLength: Number(db.args) };
2219
2254
  else def = { type: "string" };
2220
2255
  break;
@@ -2228,7 +2263,7 @@ function scalarDef(f, enums, notes) {
2228
2263
  def = { type: "number" };
2229
2264
  break;
2230
2265
  case "Decimal": {
2231
- 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()));
2232
2267
  def = p ? { type: "decimal", precision: p, scale: _nullishCoalesce(s, () => ( 0)) } : { type: "decimal" };
2233
2268
  break;
2234
2269
  }