express-file-cluster 0.9.6 → 0.10.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.
- package/dist/auth/index.cjs +5 -5
- package/dist/auth/index.d.cts +1 -1
- package/dist/auth/index.d.ts +1 -1
- package/dist/auth/index.js +4 -4
- package/dist/{chunk-QL6EWT4B.cjs → chunk-4DOHQU6I.cjs} +9 -7
- package/dist/chunk-4DOHQU6I.cjs.map +1 -0
- package/dist/{chunk-2SETEVMO.js → chunk-7KC2H76D.js} +42 -2
- package/dist/chunk-7KC2H76D.js.map +1 -0
- package/dist/{chunk-6KHBJOLB.cjs → chunk-7KO4DJRJ.cjs} +7 -7
- package/dist/{chunk-6KHBJOLB.cjs.map → chunk-7KO4DJRJ.cjs.map} +1 -1
- package/dist/{chunk-45BWAR6P.js → chunk-ATVD2HGC.js} +3 -3
- package/dist/{chunk-BBSZLGZW.js → chunk-EGSSZUVO.js} +8 -6
- package/dist/chunk-EGSSZUVO.js.map +1 -0
- package/dist/{chunk-TI24L4XE.cjs → chunk-GBI77W5T.cjs} +6 -2
- package/dist/chunk-GBI77W5T.cjs.map +1 -0
- package/dist/{chunk-VWSUQKCJ.cjs → chunk-HBCY7ILD.cjs} +274 -107
- package/dist/chunk-HBCY7ILD.cjs.map +1 -0
- package/dist/{chunk-RGT4ZVHL.cjs → chunk-KFVFP2Q7.cjs} +45 -5
- package/dist/chunk-KFVFP2Q7.cjs.map +1 -0
- package/dist/{chunk-TYCYYLLM.cjs → chunk-NKLOE4AK.cjs} +1 -1
- package/dist/chunk-NKLOE4AK.cjs.map +1 -0
- package/dist/{chunk-OFA7OGN5.js → chunk-PGJQK36V.js} +171 -4
- package/dist/chunk-PGJQK36V.js.map +1 -0
- package/dist/{chunk-ULWNHN6P.js → chunk-QDEDOHP7.js} +1 -1
- package/dist/chunk-QDEDOHP7.js.map +1 -0
- package/dist/{chunk-7ZESZG3J.js → chunk-R4XO4SVM.js} +3 -3
- package/dist/chunk-R52CUEGT.js +74 -0
- package/dist/chunk-R52CUEGT.js.map +1 -0
- package/dist/{chunk-HBYSKULC.js → chunk-RAB44UGX.js} +5 -1
- package/dist/chunk-RAB44UGX.js.map +1 -0
- package/dist/{chunk-7YEX4MQV.cjs → chunk-WBLUGOAG.cjs} +42 -6
- package/dist/chunk-WBLUGOAG.cjs.map +1 -0
- package/dist/{chunk-FMA76PRH.cjs → chunk-YK4ZM3CA.cjs} +8 -8
- package/dist/{chunk-FMA76PRH.cjs.map → chunk-YK4ZM3CA.cjs.map} +1 -1
- package/dist/cli/db-runner.cjs +2010 -116
- package/dist/cli/db-runner.cjs.map +1 -1
- package/dist/cli/db-runner.js +1987 -93
- package/dist/cli/db-runner.js.map +1 -1
- package/dist/cli/index.cjs +36 -13
- package/dist/cli/index.cjs.map +1 -1
- package/dist/cli/index.js +33 -10
- package/dist/cli/index.js.map +1 -1
- package/dist/docs/api-reference/collection.md +44 -1
- package/dist/docs/api-reference/ignite.md +9 -0
- package/dist/docs/api-reference/types.md +99 -0
- package/dist/docs/cli/add.md +1 -1
- package/dist/docs/cli/db.md +2 -2
- package/dist/docs/core-concepts/background-tasks.md +6 -3
- package/dist/docs/getting-started/index.md +2 -1
- package/dist/docs/guides/caching.md +32 -1
- package/dist/docs/guides/database.md +2 -0
- package/dist/docs/guides/feature-matrix.md +58 -0
- package/dist/docs/guides/migrations.md +23 -2
- package/dist/docs/guides/which-api.md +2 -2
- package/dist/docs/index.md +3 -1
- package/dist/docs/skills/SKILL.md +1 -1
- package/dist/docs/skills/api-surface.md +5 -0
- package/dist/docs/skills/tasks-internals.md +4 -3
- package/dist/docs/skills/what-not-to-invent.md +4 -3
- package/dist/index.cjs +99 -30
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +204 -3
- package/dist/index.d.ts +204 -3
- package/dist/index.js +76 -7
- package/dist/index.js.map +1 -1
- package/dist/pgboss-backend-FW42SBSM.js +14 -0
- package/dist/pgboss-backend-RVHUBJTU.cjs +14 -0
- package/dist/{pgboss-backend-DSO3QTNK.cjs.map → pgboss-backend-RVHUBJTU.cjs.map} +1 -1
- package/dist/registry/index.json +13 -1
- package/dist/registry/js-mongo/auth.json +1 -1
- package/dist/registry/js-mongo/forgot-password.json +1 -1
- package/dist/registry/js-mongo-collection/_base.json +1 -0
- package/dist/registry/js-mongo-collection/account-security.json +1 -0
- package/dist/registry/js-mongo-collection/account-settings.json +1 -0
- package/dist/registry/js-mongo-collection/admin-admins.json +1 -0
- package/dist/registry/js-mongo-collection/admin-analytics.json +1 -0
- package/dist/registry/js-mongo-collection/admin-billing.json +1 -0
- package/dist/registry/js-mongo-collection/admin-content.json +1 -0
- package/dist/registry/js-mongo-collection/admin-logs.json +1 -0
- package/dist/registry/js-mongo-collection/admin-support.json +1 -0
- package/dist/registry/js-mongo-collection/admin-system.json +1 -0
- package/dist/registry/js-mongo-collection/admin-users.json +1 -0
- package/dist/registry/js-mongo-collection/admin.json +1 -0
- package/dist/registry/js-mongo-collection/auth.json +1 -0
- package/dist/registry/js-mongo-collection/auth@apple.json +1 -0
- package/dist/registry/js-mongo-collection/auth@google.json +1 -0
- package/dist/registry/js-mongo-collection/billing.json +1 -0
- package/dist/registry/js-mongo-collection/email-client.json +1 -0
- package/dist/registry/js-mongo-collection/email-verification.json +1 -0
- package/dist/registry/js-mongo-collection/files.json +1 -0
- package/dist/registry/js-mongo-collection/forgot-password.json +1 -0
- package/dist/registry/js-mongo-collection/notifications.json +1 -0
- package/dist/registry/js-mongo-collection/support.json +1 -0
- package/dist/registry/js-mongo-collection/user-profile.json +1 -0
- package/dist/registry/js-pg-model/auth.json +1 -1
- package/dist/registry/js-pg-model/forgot-password.json +1 -1
- package/dist/registry/js-pg-table/auth.json +1 -1
- package/dist/registry/js-pg-table/forgot-password.json +1 -1
- package/dist/registry/ts-mongo/auth.json +1 -1
- package/dist/registry/ts-mongo/forgot-password.json +1 -1
- package/dist/registry/ts-mongo-collection/_base.json +1 -0
- package/dist/registry/ts-mongo-collection/account-security.json +1 -0
- package/dist/registry/ts-mongo-collection/account-settings.json +1 -0
- package/dist/registry/ts-mongo-collection/admin-admins.json +1 -0
- package/dist/registry/ts-mongo-collection/admin-analytics.json +1 -0
- package/dist/registry/ts-mongo-collection/admin-billing.json +1 -0
- package/dist/registry/ts-mongo-collection/admin-content.json +1 -0
- package/dist/registry/ts-mongo-collection/admin-logs.json +1 -0
- package/dist/registry/ts-mongo-collection/admin-support.json +1 -0
- package/dist/registry/ts-mongo-collection/admin-system.json +1 -0
- package/dist/registry/ts-mongo-collection/admin-users.json +1 -0
- package/dist/registry/ts-mongo-collection/admin.json +1 -0
- package/dist/registry/ts-mongo-collection/auth.json +1 -0
- package/dist/registry/ts-mongo-collection/auth@apple.json +1 -0
- package/dist/registry/ts-mongo-collection/auth@google.json +1 -0
- package/dist/registry/ts-mongo-collection/billing.json +1 -0
- package/dist/registry/ts-mongo-collection/email-client.json +1 -0
- package/dist/registry/ts-mongo-collection/email-verification.json +1 -0
- package/dist/registry/ts-mongo-collection/files.json +1 -0
- package/dist/registry/ts-mongo-collection/forgot-password.json +1 -0
- package/dist/registry/ts-mongo-collection/notifications.json +1 -0
- package/dist/registry/ts-mongo-collection/support.json +1 -0
- package/dist/registry/ts-mongo-collection/user-profile.json +1 -0
- package/dist/registry/ts-pg-model/auth.json +1 -1
- package/dist/registry/ts-pg-model/forgot-password.json +1 -1
- package/dist/registry/ts-pg-table/auth.json +1 -1
- package/dist/registry/ts-pg-table/forgot-password.json +1 -1
- package/dist/tasks/index.cjs +4 -2
- package/dist/tasks/index.cjs.map +1 -1
- package/dist/tasks/index.d.cts +4 -2
- package/dist/tasks/index.d.ts +4 -2
- package/dist/tasks/index.js +3 -1
- package/dist/thread-runner.cjs +8 -0
- package/dist/thread-runner.cjs.map +1 -0
- package/dist/thread-runner.d.cts +3 -0
- package/dist/thread-runner.d.ts +3 -0
- package/dist/thread-runner.js +8 -0
- package/dist/thread-runner.js.map +1 -0
- package/dist/{types-DAsBKVM-.d.cts → types-Bnxvj3l0.d.cts} +7 -1
- package/dist/{types-DAsBKVM-.d.ts → types-Bnxvj3l0.d.ts} +7 -1
- package/package.json +1 -1
- package/dist/chunk-2SETEVMO.js.map +0 -1
- package/dist/chunk-7YEX4MQV.cjs.map +0 -1
- package/dist/chunk-BBSZLGZW.js.map +0 -1
- package/dist/chunk-HBYSKULC.js.map +0 -1
- package/dist/chunk-LJNSJFOL.js +0 -38
- package/dist/chunk-LJNSJFOL.js.map +0 -1
- package/dist/chunk-OFA7OGN5.js.map +0 -1
- package/dist/chunk-QL6EWT4B.cjs.map +0 -1
- package/dist/chunk-RGT4ZVHL.cjs.map +0 -1
- package/dist/chunk-TI24L4XE.cjs.map +0 -1
- package/dist/chunk-TYCYYLLM.cjs.map +0 -1
- package/dist/chunk-ULWNHN6P.js.map +0 -1
- package/dist/chunk-VWSUQKCJ.cjs.map +0 -1
- package/dist/pgboss-backend-DSO3QTNK.cjs +0 -14
- package/dist/pgboss-backend-I6DFUNRM.js +0 -14
- /package/dist/{chunk-45BWAR6P.js.map → chunk-ATVD2HGC.js.map} +0 -0
- /package/dist/{chunk-7ZESZG3J.js.map → chunk-R4XO4SVM.js.map} +0 -0
- /package/dist/{pgboss-backend-I6DFUNRM.js.map → pgboss-backend-FW42SBSM.js.map} +0 -0
package/dist/cli/index.js
CHANGED
|
@@ -4,15 +4,15 @@ import {
|
|
|
4
4
|
} from "../chunk-NI2BNGGV.js";
|
|
5
5
|
import {
|
|
6
6
|
parseRedisUrl
|
|
7
|
-
} from "../chunk-
|
|
7
|
+
} from "../chunk-ATVD2HGC.js";
|
|
8
8
|
import {
|
|
9
9
|
writeModels
|
|
10
|
-
} from "../chunk-
|
|
10
|
+
} from "../chunk-EGSSZUVO.js";
|
|
11
11
|
import {
|
|
12
12
|
tableNameFor
|
|
13
|
-
} from "../chunk-
|
|
14
|
-
import "../chunk-
|
|
15
|
-
import "../chunk-
|
|
13
|
+
} from "../chunk-QDEDOHP7.js";
|
|
14
|
+
import "../chunk-R52CUEGT.js";
|
|
15
|
+
import "../chunk-RAB44UGX.js";
|
|
16
16
|
import "../chunk-73XJUT2S.js";
|
|
17
17
|
|
|
18
18
|
// src/cli/index.ts
|
|
@@ -552,7 +552,7 @@ async function connect(opts) {
|
|
|
552
552
|
if (backend === "bullmq") return bullmqAdmin(redisUrl ?? "redis://localhost:6379", opts.queue);
|
|
553
553
|
if (backend === "pg-boss") {
|
|
554
554
|
if (!databaseUrl) throw new Error("[EFC] pg-boss needs DATABASE_URL (or --database-url)");
|
|
555
|
-
const { pgBossAdmin } = await import("../pgboss-backend-
|
|
555
|
+
const { pgBossAdmin } = await import("../pgboss-backend-FW42SBSM.js");
|
|
556
556
|
return pgBossAdmin(databaseUrl, opts.queue);
|
|
557
557
|
}
|
|
558
558
|
throw new Error(`[EFC] Unknown task backend: ${backend}`);
|
|
@@ -818,8 +818,14 @@ function dbCommand() {
|
|
|
818
818
|
(opts) => run2("sync", opts)
|
|
819
819
|
);
|
|
820
820
|
common(
|
|
821
|
-
cmd.command("pull").description(
|
|
822
|
-
|
|
821
|
+
cmd.command("pull").description(
|
|
822
|
+
"Write models for the database: defineTable from PostgreSQL tables, defineCollection from sampled MongoDB documents"
|
|
823
|
+
)
|
|
824
|
+
).option("--out <dir>", "where to write the models", "src/model").option("--force", "overwrite model files that already exist").option(
|
|
825
|
+
"--sample <n>",
|
|
826
|
+
"MongoDB: documents sampled per collection (default 1000)",
|
|
827
|
+
(v) => Number.parseInt(v, 10)
|
|
828
|
+
).action(
|
|
823
829
|
(opts) => run2("pull", opts)
|
|
824
830
|
);
|
|
825
831
|
common(cmd.command("status").description("List applied and pending migrations")).action(
|
|
@@ -830,7 +836,9 @@ function dbCommand() {
|
|
|
830
836
|
).action(
|
|
831
837
|
(name, opts) => run2("seed", { ...opts, ...name !== void 0 && { seed: name } })
|
|
832
838
|
);
|
|
833
|
-
common(
|
|
839
|
+
common(
|
|
840
|
+
cmd.command("studio").description("Open a local database browser (read-only; --write edits through your models)")
|
|
841
|
+
).option("-p, --port <port>", "port to listen on (127.0.0.1 only)", "4983").option("--write", "allow inserting, editing and deleting rows (through src/model, validated)").action(
|
|
834
842
|
(opts) => run2("studio", { ...opts, port: Number(opts.port) })
|
|
835
843
|
);
|
|
836
844
|
return cmd;
|
|
@@ -915,7 +923,8 @@ var Registry = class {
|
|
|
915
923
|
};
|
|
916
924
|
function variantOf(cfg) {
|
|
917
925
|
const lang = cfg.language === "typescript" ? "ts" : "js";
|
|
918
|
-
if (cfg.database === "mongodb")
|
|
926
|
+
if (cfg.database === "mongodb")
|
|
927
|
+
return cfg.modelApi === "defineCollection" ? `${lang}-mongo-collection` : `${lang}-mongo`;
|
|
919
928
|
return `${lang}-pg-${cfg.modelApi === "defineTable" ? "table" : "model"}`;
|
|
920
929
|
}
|
|
921
930
|
function readJson(file) {
|
|
@@ -950,6 +959,10 @@ function detectProject(cwd, version2) {
|
|
|
950
959
|
}
|
|
951
960
|
let modelApi = database === "postgresql" ? "defineTable" : "defineModel";
|
|
952
961
|
const modelDir = path7.join(cwd, "src", "model");
|
|
962
|
+
if (database === "mongodb" && fs7.existsSync(modelDir)) {
|
|
963
|
+
const sources = fs7.readdirSync(modelDir).filter((f) => /\.[jt]s$/.test(f)).map((f) => fs7.readFileSync(path7.join(modelDir, f), "utf8")).join("\n");
|
|
964
|
+
if (/\bdefineCollection\(/.test(sources)) modelApi = "defineCollection";
|
|
965
|
+
}
|
|
953
966
|
if (database === "postgresql" && fs7.existsSync(modelDir)) {
|
|
954
967
|
const sources = fs7.readdirSync(modelDir).filter((f) => /\.[jt]s$/.test(f)).map((f) => fs7.readFileSync(path7.join(modelDir, f), "utf8")).join("\n");
|
|
955
968
|
if (/\bdefineModel\(/.test(sources) && !/\bdefineTable\(/.test(sources))
|
|
@@ -1377,8 +1390,18 @@ function entityLoginContent(pascal, slug, cfg) {
|
|
|
1377
1390
|
const typedArgs = ts ? "(req: Request, res: Response)" : "(req, res)";
|
|
1378
1391
|
const typeImport = ts ? "import type { Request, Response } from 'express';\n" : "";
|
|
1379
1392
|
return `${typeImport}import { issueToken, verifyPassword } from 'express-file-cluster/auth';
|
|
1393
|
+
import { rateLimit } from 'express-file-cluster';
|
|
1380
1394
|
import { ${pascal} } from '../../../model/${pascal}.js';
|
|
1381
1395
|
|
|
1396
|
+
// 10 attempts per 15 minutes per address and account (see TRUST_PROXY behind a proxy).
|
|
1397
|
+
export const middlewares = [
|
|
1398
|
+
rateLimit({
|
|
1399
|
+
window: '15m',
|
|
1400
|
+
max: 10,
|
|
1401
|
+
key: (req) => \`\${req.ip}:\${String(req.body?.email ?? '').toLowerCase()}\`,
|
|
1402
|
+
}),
|
|
1403
|
+
];
|
|
1404
|
+
|
|
1382
1405
|
export const POST = async ${typedArgs} => {
|
|
1383
1406
|
const { email, password } = req.body;
|
|
1384
1407
|
// Strings only: an object such as {"$ne": null} would be read as a filter operator and match any account.
|