express-file-cluster 0.10.0 → 0.10.2
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 +7 -6
- package/dist/auth/index.cjs.map +1 -1
- package/dist/auth/index.d.cts +1 -1
- package/dist/auth/index.d.ts +1 -1
- package/dist/auth/index.js +5 -5
- package/dist/{chunk-R52CUEGT.js → chunk-3SWI46YK.js} +2 -2
- package/dist/{chunk-DCJOWFVD.cjs → chunk-4GHK27JA.cjs} +3 -3
- package/dist/{chunk-DCJOWFVD.cjs.map → chunk-4GHK27JA.cjs.map} +1 -1
- package/dist/{chunk-NI2BNGGV.js → chunk-5LPRKZPB.js} +2 -2
- package/dist/chunk-74BSJXWD.cjs +220 -0
- package/dist/chunk-74BSJXWD.cjs.map +1 -0
- package/dist/{chunk-7KO4DJRJ.cjs → chunk-7BC3AN7R.cjs} +14 -14
- package/dist/{chunk-7KO4DJRJ.cjs.map → chunk-7BC3AN7R.cjs.map} +1 -1
- package/dist/chunk-AGOYTFRO.cjs +42 -0
- package/dist/chunk-AGOYTFRO.cjs.map +1 -0
- package/dist/{chunk-RAB44UGX.js → chunk-B6MB6HEG.js} +1 -1
- package/dist/{chunk-PGJQK36V.js → chunk-BG4A7Z32.js} +7 -5
- package/dist/{chunk-PGJQK36V.js.map → chunk-BG4A7Z32.js.map} +1 -1
- package/dist/{chunk-ATVD2HGC.js → chunk-C2FOZ7ME.js} +4 -4
- package/dist/chunk-CGY7JU4Y.cjs +8 -0
- package/dist/chunk-CGY7JU4Y.cjs.map +1 -0
- package/dist/{chunk-EGSSZUVO.js → chunk-DN4TCGYB.js} +38 -11
- package/dist/chunk-DN4TCGYB.js.map +1 -0
- package/dist/{chunk-GBI77W5T.cjs → chunk-H2PVWCWC.cjs} +1 -1
- package/dist/{chunk-GBI77W5T.cjs.map → chunk-H2PVWCWC.cjs.map} +1 -1
- package/dist/{chunk-NKLOE4AK.cjs → chunk-IUZ6A7PB.cjs} +20 -53
- package/dist/chunk-IUZ6A7PB.cjs.map +1 -0
- package/dist/{chunk-DUADUR6R.cjs → chunk-JP36TLL4.cjs} +171 -14
- package/dist/chunk-JP36TLL4.cjs.map +1 -0
- package/dist/chunk-KLWL7XSC.js +220 -0
- package/dist/chunk-KLWL7XSC.js.map +1 -0
- package/dist/{chunk-4DOHQU6I.cjs → chunk-M53GODCX.cjs} +39 -12
- package/dist/chunk-M53GODCX.cjs.map +1 -0
- package/dist/{chunk-R4XO4SVM.js → chunk-MUVO7MGS.js} +4 -4
- package/dist/{chunk-HBCY7ILD.cjs → chunk-R2K7AFIB.cjs} +97 -95
- package/dist/chunk-R2K7AFIB.cjs.map +1 -0
- package/dist/{chunk-QDEDOHP7.js → chunk-RETV3GKE.js} +9 -42
- package/dist/chunk-RETV3GKE.js.map +1 -0
- package/dist/{chunk-WBLUGOAG.cjs → chunk-RPL2IFWK.cjs} +8 -5
- package/dist/chunk-RPL2IFWK.cjs.map +1 -0
- package/dist/{chunk-YK4ZM3CA.cjs → chunk-TBIVIR6L.cjs} +15 -15
- package/dist/{chunk-YK4ZM3CA.cjs.map → chunk-TBIVIR6L.cjs.map} +1 -1
- package/dist/{chunk-73XJUT2S.js → chunk-V73R76I4.js} +162 -5
- package/dist/chunk-V73R76I4.js.map +1 -0
- package/dist/chunk-XPY5TQDK.js +42 -0
- package/dist/chunk-XPY5TQDK.js.map +1 -0
- package/dist/{chunk-KFVFP2Q7.cjs → chunk-Y4NKIXUL.cjs} +70 -55
- package/dist/chunk-Y4NKIXUL.cjs.map +1 -0
- package/dist/{chunk-7KC2H76D.js → chunk-Y75V5FCU.js} +62 -47
- package/dist/chunk-Y75V5FCU.js.map +1 -0
- package/dist/cli/db-runner.cjs +81 -42
- package/dist/cli/db-runner.cjs.map +1 -1
- package/dist/cli/db-runner.js +54 -16
- package/dist/cli/db-runner.js.map +1 -1
- package/dist/cli/index.cjs +23 -25
- package/dist/cli/index.cjs.map +1 -1
- package/dist/cli/index.js +12 -17
- package/dist/cli/index.js.map +1 -1
- package/dist/docs/api-reference/auth.md +23 -0
- package/dist/docs/api-reference/compose.md +1 -1
- package/dist/docs/api-reference/db.md +8 -0
- package/dist/docs/api-reference/ignite.md +4 -1
- package/dist/docs/api-reference/testing.md +26 -0
- package/dist/docs/cli/add.md +2 -2
- package/dist/docs/core-concepts/file-based-routing.md +2 -0
- package/dist/docs/core-concepts/middleware.md +2 -2
- package/dist/docs/getting-started/index.md +4 -0
- package/dist/docs/guides/authentication.md +33 -0
- package/dist/docs/guides/caching.md +2 -0
- package/dist/docs/guides/database.md +15 -0
- package/dist/docs/guides/environment-variables.md +6 -0
- package/dist/docs/guides/generated-portals.md +3 -1
- package/dist/docs/guides/logging.md +17 -0
- package/dist/docs/guides/migrations.md +4 -2
- package/dist/docs/guides/testing.md +31 -0
- package/dist/docs/index.md +2 -1
- package/dist/docs/skills/SKILL.md +5 -1
- package/dist/docs/skills/api-surface.md +20 -4
- package/dist/docs/skills/auth-internals.md +14 -1
- package/dist/docs/skills/pre-flight.md +6 -0
- package/dist/docs/skills/routing-rules.md +1 -1
- package/dist/docs/skills/what-not-to-invent.md +9 -1
- package/dist/docs/versioning.md +1 -1
- package/dist/index.cjs +75 -264
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +27 -3
- package/dist/index.d.ts +27 -3
- package/dist/index.js +28 -218
- package/dist/index.js.map +1 -1
- package/dist/pgboss-backend-4X2YT4RB.js +14 -0
- package/dist/pgboss-backend-UXQ3O2WT.cjs +15 -0
- package/dist/pgboss-backend-UXQ3O2WT.cjs.map +1 -0
- package/dist/registry/index.json +27 -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/forgot-password.json +1 -1
- package/dist/registry/js-mongo/user-profile.json +1 -1
- package/dist/registry/js-mongo-collection/account-security.json +1 -1
- package/dist/registry/js-mongo-collection/admin-users.json +1 -1
- package/dist/registry/js-mongo-collection/auth.json +1 -1
- package/dist/registry/js-mongo-collection/auth@apple.json +1 -1
- package/dist/registry/js-mongo-collection/auth@google.json +1 -1
- package/dist/registry/js-mongo-collection/forgot-password.json +1 -1
- package/dist/registry/js-mongo-collection/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/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/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/forgot-password.json +1 -1
- package/dist/registry/ts-mongo/user-profile.json +1 -1
- package/dist/registry/ts-mongo-collection/account-security.json +1 -1
- package/dist/registry/ts-mongo-collection/admin-users.json +1 -1
- package/dist/registry/ts-mongo-collection/auth.json +1 -1
- package/dist/registry/ts-mongo-collection/auth@apple.json +1 -1
- package/dist/registry/ts-mongo-collection/auth@google.json +1 -1
- package/dist/registry/ts-mongo-collection/forgot-password.json +1 -1
- package/dist/registry/ts-mongo-collection/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/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/forgot-password.json +1 -1
- package/dist/registry/ts-pg-table/user-profile.json +1 -1
- package/dist/tasks/index.cjs +3 -2
- package/dist/tasks/index.cjs.map +1 -1
- package/dist/tasks/index.d.cts +1 -1
- package/dist/tasks/index.d.ts +1 -1
- package/dist/tasks/index.js +1 -1
- package/dist/testing-cjs.cjs +5 -0
- package/dist/testing.cjs +59 -0
- package/dist/testing.cjs.map +1 -0
- package/dist/testing.d.cts +27 -0
- package/dist/testing.d.ts +27 -0
- package/dist/testing.js +58 -0
- package/dist/testing.js.map +1 -0
- package/dist/thread-runner.cjs +4 -3
- package/dist/thread-runner.cjs.map +1 -1
- package/dist/thread-runner.js +2 -2
- package/dist/{types-Bnxvj3l0.d.ts → types-CPMFTVXm.d.cts} +8 -0
- package/dist/{types-Bnxvj3l0.d.cts → types-CPMFTVXm.d.ts} +8 -0
- package/package.json +6 -1
- package/dist/chunk-4DOHQU6I.cjs.map +0 -1
- package/dist/chunk-73XJUT2S.js.map +0 -1
- package/dist/chunk-7KC2H76D.js.map +0 -1
- package/dist/chunk-DUADUR6R.cjs.map +0 -1
- package/dist/chunk-EGSSZUVO.js.map +0 -1
- package/dist/chunk-HBCY7ILD.cjs.map +0 -1
- package/dist/chunk-KFVFP2Q7.cjs.map +0 -1
- package/dist/chunk-NKLOE4AK.cjs.map +0 -1
- package/dist/chunk-QDEDOHP7.js.map +0 -1
- package/dist/chunk-WBLUGOAG.cjs.map +0 -1
- package/dist/pgboss-backend-FW42SBSM.js +0 -14
- package/dist/pgboss-backend-RVHUBJTU.cjs +0 -14
- package/dist/pgboss-backend-RVHUBJTU.cjs.map +0 -1
- /package/dist/{chunk-R52CUEGT.js.map → chunk-3SWI46YK.js.map} +0 -0
- /package/dist/{chunk-NI2BNGGV.js.map → chunk-5LPRKZPB.js.map} +0 -0
- /package/dist/{chunk-RAB44UGX.js.map → chunk-B6MB6HEG.js.map} +0 -0
- /package/dist/{chunk-ATVD2HGC.js.map → chunk-C2FOZ7ME.js.map} +0 -0
- /package/dist/{chunk-R4XO4SVM.js.map → chunk-MUVO7MGS.js.map} +0 -0
- /package/dist/{pgboss-backend-FW42SBSM.js.map → pgboss-backend-4X2YT4RB.js.map} +0 -0
package/dist/cli/db-runner.js
CHANGED
|
@@ -2,7 +2,7 @@ import {
|
|
|
2
2
|
connectMongo,
|
|
3
3
|
loadMongoose,
|
|
4
4
|
setDbClient
|
|
5
|
-
} from "../chunk-
|
|
5
|
+
} from "../chunk-BG4A7Z32.js";
|
|
6
6
|
import {
|
|
7
7
|
camel,
|
|
8
8
|
lcFirst,
|
|
@@ -10,7 +10,7 @@ import {
|
|
|
10
10
|
plural,
|
|
11
11
|
singular,
|
|
12
12
|
writeModels
|
|
13
|
-
} from "../chunk-
|
|
13
|
+
} from "../chunk-DN4TCGYB.js";
|
|
14
14
|
import {
|
|
15
15
|
registeredModels,
|
|
16
16
|
setAutoSync,
|
|
@@ -18,12 +18,13 @@ import {
|
|
|
18
18
|
setSyncSuppressed,
|
|
19
19
|
snakeCase,
|
|
20
20
|
tableNameFor
|
|
21
|
-
} from "../chunk-
|
|
21
|
+
} from "../chunk-RETV3GKE.js";
|
|
22
|
+
import "../chunk-XPY5TQDK.js";
|
|
22
23
|
import {
|
|
23
24
|
closePostgres,
|
|
24
25
|
configureLogger,
|
|
25
26
|
connectPostgres
|
|
26
|
-
} from "../chunk-
|
|
27
|
+
} from "../chunk-V73R76I4.js";
|
|
27
28
|
|
|
28
29
|
// src/cli/db-runner.ts
|
|
29
30
|
import pc from "picocolors";
|
|
@@ -2186,7 +2187,7 @@ function scalarType(type) {
|
|
|
2186
2187
|
if (type === "jsonb" || type === "json") return { def: { type: "json" } };
|
|
2187
2188
|
return { def: { type: "json" }, note: `${type} has no EFC type \u2014 mapped to json` };
|
|
2188
2189
|
}
|
|
2189
|
-
async function pullPostgres(pool) {
|
|
2190
|
+
async function pullPostgres(pool, names = /* @__PURE__ */ new Map()) {
|
|
2190
2191
|
const q = async (sql) => (await pool.query(sql)).rows;
|
|
2191
2192
|
const tables = (await q(
|
|
2192
2193
|
`SELECT c.relname AS name FROM pg_class c JOIN pg_namespace n ON n.oid = c.relnamespace
|
|
@@ -2227,8 +2228,8 @@ async function pullPostgres(pool) {
|
|
|
2227
2228
|
const fksOf = (t) => fks.filter((f) => f.table === t);
|
|
2228
2229
|
const joinTables = /* @__PURE__ */ new Map();
|
|
2229
2230
|
for (const t of tables) {
|
|
2230
|
-
const
|
|
2231
|
-
if (
|
|
2231
|
+
const names2 = colsOf(t).map((c) => c.name).sort().join(",");
|
|
2232
|
+
if (names2 !== "owner_id,position,ref_id") continue;
|
|
2232
2233
|
const owner = fksOf(t).find((f) => f.columns[0] === "owner_id")?.target;
|
|
2233
2234
|
const target = fksOf(t).find((f) => f.columns[0] === "ref_id")?.target;
|
|
2234
2235
|
if (owner && target && t.startsWith(`${owner}_`))
|
|
@@ -2249,7 +2250,7 @@ async function pullPostgres(pool) {
|
|
|
2249
2250
|
skipped.push(t);
|
|
2250
2251
|
continue;
|
|
2251
2252
|
}
|
|
2252
|
-
models.set(t, { table: t, name: pascal(singular(t)), idKind });
|
|
2253
|
+
models.set(t, { table: t, name: names.get(t) ?? pascal(singular(t)), idKind });
|
|
2253
2254
|
}
|
|
2254
2255
|
const modelName = (t) => models.get(t)?.name;
|
|
2255
2256
|
const out = [];
|
|
@@ -2422,7 +2423,7 @@ async function pullPostgres(pool) {
|
|
|
2422
2423
|
relations.set(target, rels);
|
|
2423
2424
|
}
|
|
2424
2425
|
}
|
|
2425
|
-
out.push({ name, fields, options, notes });
|
|
2426
|
+
out.push({ name, fields, options, notes, table });
|
|
2426
2427
|
}
|
|
2427
2428
|
for (const model of out) {
|
|
2428
2429
|
const rels = relations.get(model.name);
|
|
@@ -2556,7 +2557,9 @@ async function pullMongo(conn, pluralize, opts = {}) {
|
|
|
2556
2557
|
const sampleSize = opts.sample ?? 1e3;
|
|
2557
2558
|
const db = conn.db;
|
|
2558
2559
|
const collections = (await db.listCollections({ type: "collection" }).toArray()).map((c) => c.name).filter((n) => !n.startsWith("system.") && !INTERNAL2.has(n)).sort();
|
|
2559
|
-
const nameOf2 = new Map(
|
|
2560
|
+
const nameOf2 = new Map(
|
|
2561
|
+
collections.map((c) => [c, opts.names?.get(c) ?? (pascal(singular(c)) || "Model")])
|
|
2562
|
+
);
|
|
2560
2563
|
const ctxModels = new Map([...nameOf2.values()].map((m) => [m.toLowerCase(), m]));
|
|
2561
2564
|
const models = [];
|
|
2562
2565
|
const skipped = [];
|
|
@@ -2645,7 +2648,14 @@ async function pullMongo(conn, pluralize, opts = {}) {
|
|
|
2645
2648
|
ctx.notes.unshift(
|
|
2646
2649
|
docs.length ? `Pulled from ${docs.length} sampled document(s) of "${collection}": a field is required only when every sample had a value.` : `"${collection}" is empty \u2014 no fields could be inferred.`
|
|
2647
2650
|
);
|
|
2648
|
-
models.push({
|
|
2651
|
+
models.push({
|
|
2652
|
+
name,
|
|
2653
|
+
fields,
|
|
2654
|
+
options,
|
|
2655
|
+
notes: ctx.notes,
|
|
2656
|
+
api: "defineCollection",
|
|
2657
|
+
table: collection
|
|
2658
|
+
});
|
|
2649
2659
|
}
|
|
2650
2660
|
return { models, skipped };
|
|
2651
2661
|
}
|
|
@@ -2667,6 +2677,27 @@ async function importModels(root) {
|
|
|
2667
2677
|
for (const f of files.sort()) await import(pathToFileURL2(f).href);
|
|
2668
2678
|
return registeredModels();
|
|
2669
2679
|
}
|
|
2680
|
+
async function existingModels(dir) {
|
|
2681
|
+
const out = /* @__PURE__ */ new Map();
|
|
2682
|
+
if (!fs2.existsSync(dir)) return out;
|
|
2683
|
+
const files = fs2.readdirSync(dir).filter((f) => /\.(ts|js|mts|mjs)$/.test(f) && !f.endsWith(".d.ts")).sort((a, b) => Number(/^index\./.test(a)) - Number(/^index\./.test(b)) || a.localeCompare(b));
|
|
2684
|
+
const fileOf = /* @__PURE__ */ new Map();
|
|
2685
|
+
for (const f of files) {
|
|
2686
|
+
const file = path2.join(dir, f);
|
|
2687
|
+
try {
|
|
2688
|
+
await import(pathToFileURL2(file).href);
|
|
2689
|
+
} catch (err) {
|
|
2690
|
+
console.log(pc.yellow(` ! ${f} didn't load (${err.message.split("\n")[0]})`));
|
|
2691
|
+
continue;
|
|
2692
|
+
}
|
|
2693
|
+
for (const m of registeredModels()) if (!fileOf.has(m.name)) fileOf.set(m.name, file);
|
|
2694
|
+
}
|
|
2695
|
+
for (const m of registeredModels()) {
|
|
2696
|
+
const storage = await m.studio?.storage().catch(() => void 0);
|
|
2697
|
+
if (storage && !out.has(storage)) out.set(storage, { name: m.name, file: fileOf.get(m.name) });
|
|
2698
|
+
}
|
|
2699
|
+
return out;
|
|
2700
|
+
}
|
|
2670
2701
|
function shadowUrl(url, engine, name) {
|
|
2671
2702
|
if (engine === "mongodb")
|
|
2672
2703
|
return url.replace(/^(mongodb(?:\+srv)?:\/\/[^/?]+)(\/[^?]*)?/, `$1/${name}`);
|
|
@@ -2860,10 +2891,17 @@ async function main() {
|
|
|
2860
2891
|
break;
|
|
2861
2892
|
}
|
|
2862
2893
|
case "pull": {
|
|
2863
|
-
|
|
2894
|
+
setAutoSync(false);
|
|
2895
|
+
const dir = path2.resolve(process.cwd(), opts.out ?? path2.join("src", "model"));
|
|
2896
|
+
const existing = await existingModels(dir);
|
|
2897
|
+
const names = new Map([...existing].map(([table, m]) => [table, m.name]));
|
|
2898
|
+
const { models, skipped: notPulled } = engine === "postgresql" ? await pullPostgres(client, names) : await pullMongo(
|
|
2864
2899
|
client,
|
|
2865
2900
|
(await loadMongoose()).pluralize(),
|
|
2866
|
-
|
|
2901
|
+
{
|
|
2902
|
+
...opts.sample !== void 0 && { sample: opts.sample },
|
|
2903
|
+
names
|
|
2904
|
+
}
|
|
2867
2905
|
);
|
|
2868
2906
|
if (models.length === 0) {
|
|
2869
2907
|
console.log(
|
|
@@ -2874,9 +2912,9 @@ async function main() {
|
|
|
2874
2912
|
break;
|
|
2875
2913
|
}
|
|
2876
2914
|
const typescript = fs2.existsSync(path2.join(process.cwd(), "tsconfig.json"));
|
|
2877
|
-
const dir = path2.resolve(process.cwd(), opts.out ?? path2.join("src", "model"));
|
|
2878
2915
|
const { written, skipped } = writeModels(dir, models, {
|
|
2879
2916
|
typescript,
|
|
2917
|
+
existing,
|
|
2880
2918
|
...opts.force && { force: true }
|
|
2881
2919
|
});
|
|
2882
2920
|
console.log(pc.bold(`
|
|
@@ -2884,9 +2922,9 @@ async function main() {
|
|
|
2884
2922
|
`));
|
|
2885
2923
|
for (const f of written)
|
|
2886
2924
|
console.log(` ${pc.green("+")} ${path2.relative(process.cwd(), f)}`);
|
|
2887
|
-
for (const
|
|
2925
|
+
for (const { file, reason } of skipped)
|
|
2888
2926
|
console.log(
|
|
2889
|
-
` ${pc.yellow("\u2022")} ${path2.relative(process.cwd(),
|
|
2927
|
+
` ${pc.yellow("\u2022")} ${path2.relative(process.cwd(), file)} ${pc.dim(reason)}`
|
|
2890
2928
|
);
|
|
2891
2929
|
if (notPulled.length)
|
|
2892
2930
|
console.log(
|