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.
- package/dist/auth/index.cjs +4 -5
- package/dist/auth/index.cjs.map +1 -1
- package/dist/auth/index.d.cts +7 -2
- package/dist/auth/index.d.ts +7 -2
- package/dist/auth/index.js +3 -4
- package/dist/{chunk-ATL4GYFU.js → chunk-2SETEVMO.js} +10 -8
- package/dist/{chunk-ATL4GYFU.js.map → chunk-2SETEVMO.js.map} +1 -1
- package/dist/{chunk-UBQYQPBU.js → chunk-45BWAR6P.js} +2 -2
- package/dist/{chunk-TYR2GZZE.cjs → chunk-6KHBJOLB.cjs} +13 -8
- package/dist/chunk-6KHBJOLB.cjs.map +1 -0
- package/dist/chunk-73XJUT2S.js +366 -0
- package/dist/chunk-73XJUT2S.js.map +1 -0
- package/dist/{chunk-UTM4PEVG.js → chunk-7ZESZG3J.js} +8 -3
- package/dist/chunk-7ZESZG3J.js.map +1 -0
- package/dist/{chunk-R34R7QPD.cjs → chunk-DCJOWFVD.cjs} +3 -3
- package/dist/{chunk-R34R7QPD.cjs.map → chunk-DCJOWFVD.cjs.map} +1 -1
- package/dist/chunk-DUADUR6R.cjs +366 -0
- package/dist/chunk-DUADUR6R.cjs.map +1 -0
- package/dist/{chunk-T4OHFU5T.cjs → chunk-FMA76PRH.cjs} +8 -8
- package/dist/{chunk-T4OHFU5T.cjs.map → chunk-FMA76PRH.cjs.map} +1 -1
- package/dist/{chunk-RS4MXCPW.js → chunk-NI2BNGGV.js} +2 -2
- package/dist/{chunk-RRQ2RK5M.js → chunk-OFA7OGN5.js} +26 -6
- package/dist/chunk-OFA7OGN5.js.map +1 -0
- package/dist/{chunk-ANUSWEAP.cjs → chunk-RGT4ZVHL.cjs} +17 -15
- package/dist/chunk-RGT4ZVHL.cjs.map +1 -0
- package/dist/{chunk-X2US4RAM.cjs → chunk-TYCYYLLM.cjs} +11 -13
- package/dist/chunk-TYCYYLLM.cjs.map +1 -0
- package/dist/{chunk-QKQZF573.js → chunk-ULWNHN6P.js} +4 -6
- package/dist/{chunk-QKQZF573.js.map → chunk-ULWNHN6P.js.map} +1 -1
- package/dist/{chunk-RTF7PHS2.cjs → chunk-VWSUQKCJ.cjs} +116 -96
- package/dist/chunk-VWSUQKCJ.cjs.map +1 -0
- package/dist/cli/db-runner.cjs +20 -22
- package/dist/cli/db-runner.cjs.map +1 -1
- package/dist/cli/db-runner.js +4 -6
- package/dist/cli/db-runner.js.map +1 -1
- package/dist/cli/index.cjs +70 -35
- package/dist/cli/index.cjs.map +1 -1
- package/dist/cli/index.js +50 -15
- package/dist/cli/index.js.map +1 -1
- package/dist/docs/api-reference/auth.md +10 -8
- package/dist/docs/api-reference/ignite.md +13 -3
- package/dist/docs/cli/add.md +1 -1
- package/dist/docs/contributing/index.md +1 -1
- package/dist/docs/getting-started/index.md +1 -1
- package/dist/docs/guides/authentication.md +34 -24
- package/dist/docs/guides/database.md +12 -0
- package/dist/docs/guides/oauth.md +15 -1
- package/dist/docs/index.md +2 -1
- package/dist/docs/skills/SKILL.md +2 -2
- package/dist/docs/skills/api-surface.md +5 -4
- package/dist/docs/skills/auth-internals.md +3 -3
- package/dist/docs/versioning.md +42 -0
- package/dist/index.cjs +73 -49
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +36 -12
- package/dist/index.js.map +1 -1
- package/dist/pgboss-backend-DSO3QTNK.cjs +14 -0
- package/dist/{pgboss-backend-TCHI7CHM.cjs.map → pgboss-backend-DSO3QTNK.cjs.map} +1 -1
- package/dist/{pgboss-backend-QKBXVJ6B.js → pgboss-backend-I6DFUNRM.js} +3 -3
- package/dist/registry/index.json +22 -3
- package/dist/registry/js-mongo/account-security.json +1 -1
- package/dist/registry/js-mongo/admin-users.json +1 -1
- package/dist/registry/js-mongo/auth.json +1 -1
- package/dist/registry/js-mongo/auth@apple.json +1 -1
- package/dist/registry/js-mongo/auth@google.json +1 -1
- package/dist/registry/js-mongo/email-verification.json +1 -1
- package/dist/registry/js-mongo/forgot-password.json +1 -1
- package/dist/registry/js-mongo/user-profile.json +1 -1
- package/dist/registry/js-pg-model/account-security.json +1 -1
- package/dist/registry/js-pg-model/admin-users.json +1 -1
- package/dist/registry/js-pg-model/auth.json +1 -1
- package/dist/registry/js-pg-model/auth@apple.json +1 -1
- package/dist/registry/js-pg-model/auth@google.json +1 -1
- package/dist/registry/js-pg-model/email-verification.json +1 -1
- package/dist/registry/js-pg-model/forgot-password.json +1 -1
- package/dist/registry/js-pg-model/user-profile.json +1 -1
- package/dist/registry/js-pg-table/account-security.json +1 -1
- package/dist/registry/js-pg-table/admin-users.json +1 -1
- package/dist/registry/js-pg-table/auth.json +1 -1
- package/dist/registry/js-pg-table/auth@apple.json +1 -1
- package/dist/registry/js-pg-table/auth@google.json +1 -1
- package/dist/registry/js-pg-table/email-verification.json +1 -1
- package/dist/registry/js-pg-table/forgot-password.json +1 -1
- package/dist/registry/js-pg-table/user-profile.json +1 -1
- package/dist/registry/ts-mongo/account-security.json +1 -1
- package/dist/registry/ts-mongo/admin-users.json +1 -1
- package/dist/registry/ts-mongo/auth.json +1 -1
- package/dist/registry/ts-mongo/auth@apple.json +1 -1
- package/dist/registry/ts-mongo/auth@google.json +1 -1
- package/dist/registry/ts-mongo/email-verification.json +1 -1
- package/dist/registry/ts-mongo/forgot-password.json +1 -1
- package/dist/registry/ts-mongo/user-profile.json +1 -1
- package/dist/registry/ts-pg-model/account-security.json +1 -1
- package/dist/registry/ts-pg-model/admin-users.json +1 -1
- package/dist/registry/ts-pg-model/auth.json +1 -1
- package/dist/registry/ts-pg-model/auth@apple.json +1 -1
- package/dist/registry/ts-pg-model/auth@google.json +1 -1
- package/dist/registry/ts-pg-model/email-verification.json +1 -1
- package/dist/registry/ts-pg-model/forgot-password.json +1 -1
- package/dist/registry/ts-pg-model/user-profile.json +1 -1
- package/dist/registry/ts-pg-table/account-security.json +1 -1
- package/dist/registry/ts-pg-table/admin-users.json +1 -1
- package/dist/registry/ts-pg-table/auth.json +1 -1
- package/dist/registry/ts-pg-table/auth@apple.json +1 -1
- package/dist/registry/ts-pg-table/auth@google.json +1 -1
- package/dist/registry/ts-pg-table/email-verification.json +1 -1
- package/dist/registry/ts-pg-table/forgot-password.json +1 -1
- package/dist/registry/ts-pg-table/user-profile.json +1 -1
- package/dist/tasks/index.d.cts +1 -1
- package/dist/tasks/index.d.ts +1 -1
- package/dist/{types-BY-ObnZH.d.cts → types-DAsBKVM-.d.cts} +7 -1
- package/dist/{types-BY-ObnZH.d.ts → types-DAsBKVM-.d.ts} +7 -1
- package/package.json +1 -1
- package/dist/chunk-277BSYVH.js +0 -127
- package/dist/chunk-277BSYVH.js.map +0 -1
- package/dist/chunk-ANUSWEAP.cjs.map +0 -1
- package/dist/chunk-HXV543HZ.js +0 -177
- package/dist/chunk-HXV543HZ.js.map +0 -1
- package/dist/chunk-RRQ2RK5M.js.map +0 -1
- package/dist/chunk-RTF7PHS2.cjs.map +0 -1
- package/dist/chunk-TYR2GZZE.cjs.map +0 -1
- package/dist/chunk-UTM4PEVG.js.map +0 -1
- package/dist/chunk-VQSWSYK6.cjs +0 -177
- package/dist/chunk-VQSWSYK6.cjs.map +0 -1
- package/dist/chunk-X2US4RAM.cjs.map +0 -1
- package/dist/chunk-YL37D6KM.cjs +0 -127
- package/dist/chunk-YL37D6KM.cjs.map +0 -1
- package/dist/pgboss-backend-TCHI7CHM.cjs +0 -14
- /package/dist/{chunk-UBQYQPBU.js.map → chunk-45BWAR6P.js.map} +0 -0
- /package/dist/{chunk-RS4MXCPW.js.map → chunk-NI2BNGGV.js.map} +0 -0
- /package/dist/{pgboss-backend-QKBXVJ6B.js.map → pgboss-backend-I6DFUNRM.js.map} +0 -0
package/dist/cli/index.js
CHANGED
|
@@ -1,20 +1,19 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import {
|
|
3
3
|
scanDir
|
|
4
|
-
} from "../chunk-
|
|
4
|
+
} from "../chunk-NI2BNGGV.js";
|
|
5
5
|
import {
|
|
6
6
|
parseRedisUrl
|
|
7
|
-
} from "../chunk-
|
|
7
|
+
} from "../chunk-45BWAR6P.js";
|
|
8
8
|
import {
|
|
9
9
|
writeModels
|
|
10
10
|
} from "../chunk-BBSZLGZW.js";
|
|
11
11
|
import {
|
|
12
12
|
tableNameFor
|
|
13
|
-
} from "../chunk-
|
|
14
|
-
import "../chunk-HXV543HZ.js";
|
|
13
|
+
} from "../chunk-ULWNHN6P.js";
|
|
15
14
|
import "../chunk-LJNSJFOL.js";
|
|
16
15
|
import "../chunk-HBYSKULC.js";
|
|
17
|
-
import "../chunk-
|
|
16
|
+
import "../chunk-73XJUT2S.js";
|
|
18
17
|
|
|
19
18
|
// src/cli/index.ts
|
|
20
19
|
import fs10 from "fs";
|
|
@@ -553,7 +552,7 @@ async function connect(opts) {
|
|
|
553
552
|
if (backend === "bullmq") return bullmqAdmin(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 import("../pgboss-backend-
|
|
555
|
+
const { pgBossAdmin } = await import("../pgboss-backend-I6DFUNRM.js");
|
|
557
556
|
return pgBossAdmin(databaseUrl, opts.queue);
|
|
558
557
|
}
|
|
559
558
|
throw new Error(`[EFC] Unknown task backend: ${backend}`);
|
|
@@ -1043,7 +1042,7 @@ function planAdd(cwd, registry, names, opts = {}, cfg = readEfcJson(cwd) ?? dete
|
|
|
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) => path7.join(cwd, f)).find((f) => fs7.existsSync(f));
|
|
1104
|
+
if (!file) return entries.map(([k, v]) => `efc.config: set \`${k}: '${v}'\``);
|
|
1105
|
+
let text = fs7.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 = text.match(re)?.length ?? 0;
|
|
1110
|
+
if (found === 1) text = text.replace(re, `$1${key}: '${value}'`);
|
|
1111
|
+
else manual.push(`${path7.basename(file)}: set \`${key}: '${value}'\``);
|
|
1112
|
+
}
|
|
1113
|
+
fs7.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: [],
|
|
@@ -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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
}
|
|
@@ -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
|
-
|
|
1746
|
-
|
|
1776
|
+
const where = plan.prompts.some((p) => p.config !== void 0) ? ".env / efc.config" : ".env";
|
|
1777
|
+
console.log(pc8.bold("\n Configuration") + pc8.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
|
pc8.green(` \u2713 ${result.written.length} file(s) written`) + (result.conflicts.length ? pc8.yellow(`, ${result.conflicts.length} left alone`) : "")
|
|
1756
1791
|
);
|