express-file-cluster 0.9.6 → 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-3SWI46YK.js +74 -0
- package/dist/chunk-3SWI46YK.js.map +1 -0
- 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-6KHBJOLB.cjs → chunk-7BC3AN7R.cjs} +14 -14
- package/dist/{chunk-6KHBJOLB.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-HBYSKULC.js → chunk-B6MB6HEG.js} +5 -1
- package/dist/chunk-B6MB6HEG.js.map +1 -0
- package/dist/{chunk-OFA7OGN5.js → chunk-BG4A7Z32.js} +176 -7
- package/dist/chunk-BG4A7Z32.js.map +1 -0
- package/dist/{chunk-45BWAR6P.js → chunk-C2FOZ7ME.js} +4 -4
- package/dist/chunk-CGY7JU4Y.cjs +8 -0
- package/dist/chunk-CGY7JU4Y.cjs.map +1 -0
- package/dist/{chunk-BBSZLGZW.js → chunk-DN4TCGYB.js} +43 -14
- package/dist/chunk-DN4TCGYB.js.map +1 -0
- package/dist/{chunk-TI24L4XE.cjs → chunk-H2PVWCWC.cjs} +6 -2
- package/dist/chunk-H2PVWCWC.cjs.map +1 -0
- package/dist/{chunk-TYCYYLLM.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-QL6EWT4B.cjs → chunk-M53GODCX.cjs} +44 -15
- package/dist/chunk-M53GODCX.cjs.map +1 -0
- package/dist/{chunk-7ZESZG3J.js → chunk-MUVO7MGS.js} +4 -4
- package/dist/{chunk-VWSUQKCJ.cjs → chunk-R2K7AFIB.cjs} +286 -117
- package/dist/chunk-R2K7AFIB.cjs.map +1 -0
- package/dist/{chunk-ULWNHN6P.js → chunk-RETV3GKE.js} +9 -42
- package/dist/chunk-RETV3GKE.js.map +1 -0
- package/dist/{chunk-7YEX4MQV.cjs → chunk-RPL2IFWK.cjs} +46 -7
- package/dist/chunk-RPL2IFWK.cjs.map +1 -0
- package/dist/{chunk-FMA76PRH.cjs → chunk-TBIVIR6L.cjs} +15 -15
- package/dist/{chunk-FMA76PRH.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-RGT4ZVHL.cjs → chunk-Y4NKIXUL.cjs} +110 -55
- package/dist/chunk-Y4NKIXUL.cjs.map +1 -0
- package/dist/{chunk-2SETEVMO.js → chunk-Y75V5FCU.js} +100 -45
- package/dist/chunk-Y75V5FCU.js.map +1 -0
- package/dist/cli/db-runner.cjs +2059 -126
- package/dist/cli/db-runner.cjs.map +1 -1
- package/dist/cli/db-runner.js +2034 -102
- package/dist/cli/db-runner.js.map +1 -1
- package/dist/cli/index.cjs +50 -29
- package/dist/cli/index.cjs.map +1 -1
- package/dist/cli/index.js +39 -21
- package/dist/cli/index.js.map +1 -1
- package/dist/docs/api-reference/auth.md +23 -0
- package/dist/docs/api-reference/collection.md +44 -1
- 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 +13 -1
- package/dist/docs/api-reference/testing.md +26 -0
- package/dist/docs/api-reference/types.md +99 -0
- package/dist/docs/cli/add.md +2 -2
- package/dist/docs/cli/db.md +2 -2
- package/dist/docs/core-concepts/background-tasks.md +6 -3
- 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 +6 -1
- package/dist/docs/guides/authentication.md +33 -0
- package/dist/docs/guides/caching.md +34 -1
- package/dist/docs/guides/database.md +17 -0
- package/dist/docs/guides/environment-variables.md +6 -0
- package/dist/docs/guides/feature-matrix.md +58 -0
- package/dist/docs/guides/generated-portals.md +3 -1
- package/dist/docs/guides/logging.md +17 -0
- package/dist/docs/guides/migrations.md +26 -3
- package/dist/docs/guides/testing.md +31 -0
- package/dist/docs/guides/which-api.md +2 -2
- package/dist/docs/index.md +4 -1
- package/dist/docs/skills/SKILL.md +5 -1
- package/dist/docs/skills/api-surface.md +25 -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/tasks-internals.md +4 -3
- package/dist/docs/skills/what-not-to-invent.md +13 -4
- package/dist/docs/versioning.md +1 -1
- package/dist/index.cjs +135 -255
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +228 -3
- package/dist/index.d.ts +228 -3
- package/dist/index.js +96 -217
- 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 +39 -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/_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/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/_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/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 +5 -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/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 +9 -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.ts → types-CPMFTVXm.d.cts} +15 -1
- package/dist/{types-DAsBKVM-.d.cts → types-CPMFTVXm.d.ts} +15 -1
- package/package.json +6 -1
- package/dist/chunk-2SETEVMO.js.map +0 -1
- package/dist/chunk-73XJUT2S.js.map +0 -1
- package/dist/chunk-7YEX4MQV.cjs.map +0 -1
- package/dist/chunk-BBSZLGZW.js.map +0 -1
- package/dist/chunk-DUADUR6R.cjs.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-DSO3QTNK.cjs.map +0 -1
- package/dist/pgboss-backend-I6DFUNRM.js +0 -14
- /package/dist/{chunk-NI2BNGGV.js.map → chunk-5LPRKZPB.js.map} +0 -0
- /package/dist/{chunk-45BWAR6P.js.map → chunk-C2FOZ7ME.js.map} +0 -0
- /package/dist/{chunk-7ZESZG3J.js.map → chunk-MUVO7MGS.js.map} +0 -0
- /package/dist/{pgboss-backend-I6DFUNRM.js.map → pgboss-backend-4X2YT4RB.js.map} +0 -0
package/dist/cli/index.cjs
CHANGED
|
@@ -1,19 +1,23 @@
|
|
|
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
|
|
4
|
+
var _chunk4GHK27JAcjs = require('../chunk-4GHK27JA.cjs');
|
|
5
5
|
|
|
6
6
|
|
|
7
|
-
var
|
|
7
|
+
var _chunkTBIVIR6Lcjs = require('../chunk-TBIVIR6L.cjs');
|
|
8
8
|
|
|
9
9
|
|
|
10
|
-
var
|
|
10
|
+
var _chunkM53GODCXcjs = require('../chunk-M53GODCX.cjs');
|
|
11
11
|
|
|
12
12
|
|
|
13
|
-
var
|
|
14
|
-
require('../chunk-
|
|
15
|
-
require('../chunk-
|
|
16
|
-
require('../chunk-
|
|
13
|
+
var _chunkIUZ6A7PBcjs = require('../chunk-IUZ6A7PB.cjs');
|
|
14
|
+
require('../chunk-AGOYTFRO.cjs');
|
|
15
|
+
require('../chunk-RPL2IFWK.cjs');
|
|
16
|
+
require('../chunk-H2PVWCWC.cjs');
|
|
17
|
+
require('../chunk-JP36TLL4.cjs');
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
var _chunkCGY7JU4Ycjs = require('../chunk-CGY7JU4Y.cjs');
|
|
17
21
|
|
|
18
22
|
// src/cli/index.ts
|
|
19
23
|
var _fs = require('fs'); var _fs2 = _interopRequireDefault(_fs);
|
|
@@ -501,7 +505,7 @@ async function bullmqAdmin(redisUrl, queueName = "efc") {
|
|
|
501
505
|
} catch (e2) {
|
|
502
506
|
throw new Error("[EFC] bullmq is not installed. Run: npm install bullmq");
|
|
503
507
|
}
|
|
504
|
-
const queue = new bullmq.Queue(queueName, { connection:
|
|
508
|
+
const queue = new bullmq.Queue(queueName, { connection: _chunkTBIVIR6Lcjs.parseRedisUrl.call(void 0, redisUrl) });
|
|
505
509
|
const failedJobs = async (ids2) => {
|
|
506
510
|
if (ids2.length === 0) return queue.getFailed(0, -1);
|
|
507
511
|
const jobs = await Promise.all(ids2.map((id) => queue.getJob(id)));
|
|
@@ -552,7 +556,7 @@ async function connect(opts) {
|
|
|
552
556
|
if (backend === "bullmq") return bullmqAdmin(_nullishCoalesce(redisUrl, () => ( "redis://localhost:6379")), opts.queue);
|
|
553
557
|
if (backend === "pg-boss") {
|
|
554
558
|
if (!databaseUrl) throw new Error("[EFC] pg-boss needs DATABASE_URL (or --database-url)");
|
|
555
|
-
const { pgBossAdmin } = await Promise.resolve().then(() => _interopRequireWildcard(require("../pgboss-backend-
|
|
559
|
+
const { pgBossAdmin } = await Promise.resolve().then(() => _interopRequireWildcard(require("../pgboss-backend-UXQ3O2WT.cjs")));
|
|
556
560
|
return pgBossAdmin(databaseUrl, opts.queue);
|
|
557
561
|
}
|
|
558
562
|
throw new Error(`[EFC] Unknown task backend: ${backend}`);
|
|
@@ -646,7 +650,7 @@ function routesCommand() {
|
|
|
646
650
|
console.error(_picocolors2.default.red("[EFC] Could not find apiDir (expected src/api)"));
|
|
647
651
|
process.exit(1);
|
|
648
652
|
}
|
|
649
|
-
const routes =
|
|
653
|
+
const routes = _chunk4GHK27JAcjs.scanDir.call(void 0, apiDir);
|
|
650
654
|
if (routes.length === 0) {
|
|
651
655
|
console.log(_picocolors2.default.yellow("No routes found."));
|
|
652
656
|
return;
|
|
@@ -775,7 +779,7 @@ function resolveRuntime(useDist) {
|
|
|
775
779
|
}
|
|
776
780
|
function run2(command, opts) {
|
|
777
781
|
const { exec, root } = resolveRuntime(Boolean(opts.dist));
|
|
778
|
-
const runner = _path2.default.join(_path2.default.dirname(_url.fileURLToPath.call(void 0,
|
|
782
|
+
const runner = _path2.default.join(_path2.default.dirname(_url.fileURLToPath.call(void 0, _chunkCGY7JU4Ycjs.importMetaUrl)), "db-runner.js");
|
|
779
783
|
const payload = JSON.stringify({ ...opts, root });
|
|
780
784
|
const env = { ...readEnvFile(), ...process.env };
|
|
781
785
|
const child = _child_process.spawn.call(void 0, exec, [runner, command, payload], { stdio: "inherit", env });
|
|
@@ -818,8 +822,14 @@ function dbCommand() {
|
|
|
818
822
|
(opts) => run2("sync", opts)
|
|
819
823
|
);
|
|
820
824
|
common(
|
|
821
|
-
cmd.command("pull").description(
|
|
822
|
-
|
|
825
|
+
cmd.command("pull").description(
|
|
826
|
+
"Write models for the database: defineTable from PostgreSQL tables, defineCollection from sampled MongoDB documents"
|
|
827
|
+
)
|
|
828
|
+
).option("--out <dir>", "where to write the models", "src/model").option("--force", "overwrite model files that already exist").option(
|
|
829
|
+
"--sample <n>",
|
|
830
|
+
"MongoDB: documents sampled per collection (default 1000)",
|
|
831
|
+
(v) => Number.parseInt(v, 10)
|
|
832
|
+
).action(
|
|
823
833
|
(opts) => run2("pull", opts)
|
|
824
834
|
);
|
|
825
835
|
common(cmd.command("status").description("List applied and pending migrations")).action(
|
|
@@ -830,7 +840,9 @@ function dbCommand() {
|
|
|
830
840
|
).action(
|
|
831
841
|
(name, opts) => run2("seed", { ...opts, ...name !== void 0 && { seed: name } })
|
|
832
842
|
);
|
|
833
|
-
common(
|
|
843
|
+
common(
|
|
844
|
+
cmd.command("studio").description("Open a local database browser (read-only; --write edits through your models)")
|
|
845
|
+
).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
846
|
(opts) => run2("studio", { ...opts, port: Number(opts.port) })
|
|
835
847
|
);
|
|
836
848
|
return cmd;
|
|
@@ -857,7 +869,7 @@ function sha256(content) {
|
|
|
857
869
|
function registryDir() {
|
|
858
870
|
const override = process.env["EFC_REGISTRY_DIR"];
|
|
859
871
|
if (override) return _path2.default.resolve(override);
|
|
860
|
-
for (let dir = _path2.default.dirname(_url.fileURLToPath.call(void 0,
|
|
872
|
+
for (let dir = _path2.default.dirname(_url.fileURLToPath.call(void 0, _chunkCGY7JU4Ycjs.importMetaUrl)); ; dir = _path2.default.dirname(dir)) {
|
|
861
873
|
const pkg = _path2.default.join(dir, "package.json");
|
|
862
874
|
if (_fs2.default.existsSync(pkg)) {
|
|
863
875
|
const { name } = JSON.parse(_fs2.default.readFileSync(pkg, "utf8"));
|
|
@@ -915,7 +927,8 @@ var Registry = class {
|
|
|
915
927
|
};
|
|
916
928
|
function variantOf(cfg) {
|
|
917
929
|
const lang = cfg.language === "typescript" ? "ts" : "js";
|
|
918
|
-
if (cfg.database === "mongodb")
|
|
930
|
+
if (cfg.database === "mongodb")
|
|
931
|
+
return cfg.modelApi === "defineCollection" ? `${lang}-mongo-collection` : `${lang}-mongo`;
|
|
919
932
|
return `${lang}-pg-${cfg.modelApi === "defineTable" ? "table" : "model"}`;
|
|
920
933
|
}
|
|
921
934
|
function readJson(file) {
|
|
@@ -950,6 +963,10 @@ function detectProject(cwd, version2) {
|
|
|
950
963
|
}
|
|
951
964
|
let modelApi = database === "postgresql" ? "defineTable" : "defineModel";
|
|
952
965
|
const modelDir = _path2.default.join(cwd, "src", "model");
|
|
966
|
+
if (database === "mongodb" && _fs2.default.existsSync(modelDir)) {
|
|
967
|
+
const sources = _fs2.default.readdirSync(modelDir).filter((f) => /\.[jt]s$/.test(f)).map((f) => _fs2.default.readFileSync(_path2.default.join(modelDir, f), "utf8")).join("\n");
|
|
968
|
+
if (/\bdefineCollection\(/.test(sources)) modelApi = "defineCollection";
|
|
969
|
+
}
|
|
953
970
|
if (database === "postgresql" && _fs2.default.existsSync(modelDir)) {
|
|
954
971
|
const sources = _fs2.default.readdirSync(modelDir).filter((f) => /\.[jt]s$/.test(f)).map((f) => _fs2.default.readFileSync(_path2.default.join(modelDir, f), "utf8")).join("\n");
|
|
955
972
|
if (/\bdefineModel\(/.test(sources) && !/\bdefineTable\(/.test(sources))
|
|
@@ -1377,8 +1394,18 @@ function entityLoginContent(pascal, slug, cfg) {
|
|
|
1377
1394
|
const typedArgs = ts ? "(req: Request, res: Response)" : "(req, res)";
|
|
1378
1395
|
const typeImport = ts ? "import type { Request, Response } from 'express';\n" : "";
|
|
1379
1396
|
return `${typeImport}import { issueToken, verifyPassword } from 'express-file-cluster/auth';
|
|
1397
|
+
import { rateLimit } from 'express-file-cluster';
|
|
1380
1398
|
import { ${pascal} } from '../../../model/${pascal}.js';
|
|
1381
1399
|
|
|
1400
|
+
// 10 attempts per 15 minutes per address and account (see TRUST_PROXY behind a proxy).
|
|
1401
|
+
export const middlewares = [
|
|
1402
|
+
rateLimit({
|
|
1403
|
+
window: '15m',
|
|
1404
|
+
max: 10,
|
|
1405
|
+
key: (req) => \`\${req.ip}:\${String(req.body?.email ?? '').toLowerCase()}\`,
|
|
1406
|
+
}),
|
|
1407
|
+
];
|
|
1408
|
+
|
|
1382
1409
|
export const POST = async ${typedArgs} => {
|
|
1383
1410
|
const { email, password } = req.body;
|
|
1384
1411
|
// Strings only: an object such as {"$ne": null} would be read as a filter operator and match any account.
|
|
@@ -1406,11 +1433,7 @@ function entityLogoutContent(cfg) {
|
|
|
1406
1433
|
export const middlewares = [requireAuth];
|
|
1407
1434
|
|
|
1408
1435
|
export const POST = async ${typedArgs} => {
|
|
1409
|
-
|
|
1410
|
-
await revokeSession(req, res);
|
|
1411
|
-
} catch {
|
|
1412
|
-
res.clearCookie('efc_token');
|
|
1413
|
-
}
|
|
1436
|
+
await revokeSession(req, res);
|
|
1414
1437
|
res.json({ message: 'Logged out successfully' });
|
|
1415
1438
|
};
|
|
1416
1439
|
`;
|
|
@@ -2115,7 +2138,7 @@ function importPrisma(source) {
|
|
|
2115
2138
|
const fields = [];
|
|
2116
2139
|
const relations = {};
|
|
2117
2140
|
const table = _nullishCoalesce(unquote(arg(blocks(m, "@@map")[0])), () => ( m.name));
|
|
2118
|
-
if (table !==
|
|
2141
|
+
if (table !== _chunkIUZ6A7PBcjs.tableNameFor.call(void 0, m.name)) options["collection"] = table;
|
|
2119
2142
|
const kind = idKind.get(m.name);
|
|
2120
2143
|
if (kind !== "uuid") options["id"] = kind;
|
|
2121
2144
|
if (blocks(m, "@@id").length) {
|
|
@@ -2302,7 +2325,7 @@ function importPrismaCommand() {
|
|
|
2302
2325
|
const { models, warnings } = importPrisma(_fs2.default.readFileSync(file, "utf8"));
|
|
2303
2326
|
const typescript = _fs2.default.existsSync(_path2.default.join(process.cwd(), "tsconfig.json"));
|
|
2304
2327
|
const dir = _path2.default.resolve(opts.out);
|
|
2305
|
-
const { written, skipped } =
|
|
2328
|
+
const { written, skipped } = _chunkM53GODCXcjs.writeModels.call(void 0, dir, models, {
|
|
2306
2329
|
typescript,
|
|
2307
2330
|
...opts.force && { force: true }
|
|
2308
2331
|
});
|
|
@@ -2310,10 +2333,8 @@ function importPrismaCommand() {
|
|
|
2310
2333
|
Imported ${models.length} model(s) from ${schema}
|
|
2311
2334
|
`));
|
|
2312
2335
|
for (const f of written) console.log(` ${_picocolors2.default.green("+")} ${_path2.default.relative(process.cwd(), f)}`);
|
|
2313
|
-
for (const
|
|
2314
|
-
console.log(
|
|
2315
|
-
` ${_picocolors2.default.yellow("\u2022")} ${_path2.default.relative(process.cwd(), f)} ${_picocolors2.default.dim("exists \u2014 kept (--force overwrites)")}`
|
|
2316
|
-
);
|
|
2336
|
+
for (const { file: file2, reason } of skipped)
|
|
2337
|
+
console.log(` ${_picocolors2.default.yellow("\u2022")} ${_path2.default.relative(process.cwd(), file2)} ${_picocolors2.default.dim(reason)}`);
|
|
2317
2338
|
for (const w of warnings) console.log(_picocolors2.default.yellow(` ! ${w}`));
|
|
2318
2339
|
const notes = models.reduce((n, m) => n + m.notes.length, 0);
|
|
2319
2340
|
if (notes)
|
|
@@ -2331,11 +2352,11 @@ function importPrismaCommand() {
|
|
|
2331
2352
|
|
|
2332
2353
|
// src/cli/index.ts
|
|
2333
2354
|
var { version } = JSON.parse(
|
|
2334
|
-
_fs2.default.readFileSync(new URL("../../package.json",
|
|
2355
|
+
_fs2.default.readFileSync(new URL("../../package.json", _chunkCGY7JU4Ycjs.importMetaUrl), "utf8")
|
|
2335
2356
|
);
|
|
2336
2357
|
function localCli() {
|
|
2337
2358
|
if (process.env["EFC_CLI_DELEGATED"]) return void 0;
|
|
2338
|
-
const self = _fs2.default.realpathSync(_url.fileURLToPath.call(void 0, new URL("../..",
|
|
2359
|
+
const self = _fs2.default.realpathSync(_url.fileURLToPath.call(void 0, new URL("../..", _chunkCGY7JU4Ycjs.importMetaUrl)));
|
|
2339
2360
|
for (let dir = process.cwd(); ; dir = _path2.default.dirname(dir)) {
|
|
2340
2361
|
const pkgDir = _path2.default.join(dir, "node_modules", "express-file-cluster");
|
|
2341
2362
|
if (_fs2.default.existsSync(_path2.default.join(pkgDir, "package.json"))) {
|