express-file-cluster 0.11.0 → 0.12.1
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 +8 -7
- 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 +7 -5
- package/dist/{chunk-JBOMTZT5.js → chunk-3JQWQF2M.js} +3 -3
- package/dist/chunk-3ROVNEDR.js +20 -0
- package/dist/chunk-3ROVNEDR.js.map +1 -0
- package/dist/{chunk-WHBSVYUY.cjs → chunk-4FQP6QX3.cjs} +3 -3
- package/dist/{chunk-WHBSVYUY.cjs.map → chunk-4FQP6QX3.cjs.map} +1 -1
- package/dist/chunk-546TNO2V.js +226 -0
- package/dist/chunk-546TNO2V.js.map +1 -0
- package/dist/{chunk-EJDZZ4KX.js → chunk-74R37C4I.js} +48 -21
- package/dist/chunk-74R37C4I.js.map +1 -0
- package/dist/{chunk-H2PVWCWC.cjs → chunk-A2QGDWCG.cjs} +15 -8
- package/dist/chunk-A2QGDWCG.cjs.map +1 -0
- package/dist/{chunk-DGYPIIJE.cjs → chunk-AG7PVYPE.cjs} +90 -64
- package/dist/chunk-AG7PVYPE.cjs.map +1 -0
- package/dist/{chunk-O2E7H2XA.js → chunk-BCSJOPYH.js} +2 -2
- package/dist/{chunk-OM2XJJWX.js → chunk-EBJELA7T.js} +30 -25
- package/dist/chunk-EBJELA7T.js.map +1 -0
- package/dist/{chunk-IEF6AEK3.cjs → chunk-H6MHRHUP.cjs} +104 -50
- package/dist/chunk-H6MHRHUP.cjs.map +1 -0
- package/dist/chunk-I2IVJURJ.cjs +20 -0
- package/dist/chunk-I2IVJURJ.cjs.map +1 -0
- package/dist/{chunk-6WTMRZS7.cjs → chunk-IG3V2IOK.cjs} +57 -30
- package/dist/chunk-IG3V2IOK.cjs.map +1 -0
- package/dist/chunk-JAPZYQVJ.cjs +143 -0
- package/dist/chunk-JAPZYQVJ.cjs.map +1 -0
- package/dist/{chunk-QSIP7YLW.cjs → chunk-JHCXIYJH.cjs} +25 -48
- package/dist/chunk-JHCXIYJH.cjs.map +1 -0
- package/dist/{chunk-GWMW6XY7.cjs → chunk-JVB5NLEM.cjs} +15 -13
- package/dist/chunk-JVB5NLEM.cjs.map +1 -0
- package/dist/chunk-PUM5ZDAH.js +140 -0
- package/dist/chunk-PUM5ZDAH.js.map +1 -0
- package/dist/{chunk-CGY7JU4Y.cjs → chunk-PUYBKDYD.cjs} +11 -2
- package/dist/chunk-PUYBKDYD.cjs.map +1 -0
- package/dist/{chunk-336IU55W.js → chunk-QLM3JEER.js} +5 -3
- package/dist/{chunk-336IU55W.js.map → chunk-QLM3JEER.js.map} +1 -1
- package/dist/{chunk-SOU3PBJC.cjs → chunk-SV4C4HWP.cjs} +89 -89
- package/dist/{chunk-SOU3PBJC.cjs.map → chunk-SV4C4HWP.cjs.map} +1 -1
- package/dist/{chunk-2IDRC7RK.js → chunk-UJ2ISRLP.js} +11 -34
- package/dist/chunk-UJ2ISRLP.js.map +1 -0
- package/dist/chunk-URKE3OXN.cjs +226 -0
- package/dist/chunk-URKE3OXN.cjs.map +1 -0
- package/dist/{chunk-DTMDJGRW.cjs → chunk-VLGN3XUM.cjs} +40 -35
- package/dist/chunk-VLGN3XUM.cjs.map +1 -0
- package/dist/{chunk-R6GPQZLI.js → chunk-X2B7WBKH.js} +88 -34
- package/dist/chunk-X2B7WBKH.js.map +1 -0
- package/dist/chunk-Y7I2633P.js +12 -0
- package/dist/chunk-Y7I2633P.js.map +1 -0
- package/dist/{chunk-B6MB6HEG.js → chunk-ZBQUYFI3.js} +14 -7
- package/dist/chunk-ZBQUYFI3.js.map +1 -0
- package/dist/{chunk-LECHRAU3.js → chunk-ZU2GK5WY.js} +84 -58
- package/dist/chunk-ZU2GK5WY.js.map +1 -0
- package/dist/cli/db-runner.cjs +26 -25
- package/dist/cli/db-runner.cjs.map +1 -1
- package/dist/cli/db-runner.js +5 -3
- package/dist/cli/db-runner.js.map +1 -1
- package/dist/cli/index.cjs +20 -16
- package/dist/cli/index.cjs.map +1 -1
- package/dist/cli/index.js +13 -8
- package/dist/cli/index.js.map +1 -1
- package/dist/docs/api-reference/auth.md +2 -0
- package/dist/docs/api-reference/ignite.md +4 -0
- package/dist/docs/api-reference/tasks.md +6 -2
- package/dist/docs/api-reference/testing.md +2 -0
- package/dist/docs/api-reference/tracing.md +18 -0
- package/dist/docs/cli/add.md +1 -1
- package/dist/docs/cli/diagnostics.md +1 -1
- package/dist/docs/cli/index.md +1 -1
- package/dist/docs/core-concepts/background-tasks.md +7 -1
- package/dist/docs/core-concepts/file-based-routing.md +4 -0
- package/dist/docs/core-concepts/middleware.md +2 -0
- package/dist/docs/guides/caching.md +12 -0
- package/dist/docs/guides/error-handling.md +2 -0
- package/dist/docs/guides/feature-matrix.md +7 -0
- package/dist/docs/guides/logging.md +2 -0
- package/dist/docs/guides/tracing.md +64 -0
- package/dist/docs/index.md +2 -1
- package/dist/docs/skills/SKILL.md +5 -3
- package/dist/docs/skills/api-surface.md +8 -0
- package/dist/docs/skills/auth-internals.md +4 -2
- package/dist/docs/skills/pre-flight.md +4 -0
- package/dist/docs/skills/routing-rules.md +3 -1
- package/dist/docs/skills/tasks-internals.md +12 -4
- package/dist/docs/skills/what-not-to-invent.md +2 -0
- package/dist/index.cjs +167 -71
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +5 -14
- package/dist/index.d.ts +5 -14
- package/dist/index.js +124 -27
- package/dist/index.js.map +1 -1
- package/dist/pgboss-backend-5DXF4G22.js +16 -0
- package/dist/pgboss-backend-KRTFHRNZ.cjs +16 -0
- package/dist/pgboss-backend-KRTFHRNZ.cjs.map +1 -0
- package/dist/registry/index.json +1 -1
- package/dist/tasks/index.cjs +3 -3
- package/dist/tasks/index.d.cts +2 -2
- package/dist/tasks/index.d.ts +2 -2
- package/dist/tasks/index.js +2 -1
- package/dist/testing.cjs +16 -14
- package/dist/testing.cjs.map +1 -1
- package/dist/testing.d.cts +2 -1
- package/dist/testing.d.ts +2 -1
- package/dist/testing.js +10 -7
- package/dist/testing.js.map +1 -1
- package/dist/thread-runner.cjs +5 -4
- package/dist/thread-runner.cjs.map +1 -1
- package/dist/thread-runner.d.cts +1 -1
- package/dist/thread-runner.d.ts +1 -1
- package/dist/thread-runner.js +4 -2
- package/dist/{types-D3QmZgeX.d.ts → types-Bgeqpm-n.d.cts} +12 -1
- package/dist/{types-D3QmZgeX.d.cts → types-Bgeqpm-n.d.ts} +12 -1
- package/package.json +7 -3
- package/dist/chunk-2IDRC7RK.js.map +0 -1
- package/dist/chunk-3SWI46YK.js +0 -74
- package/dist/chunk-3SWI46YK.js.map +0 -1
- package/dist/chunk-6WTMRZS7.cjs.map +0 -1
- package/dist/chunk-B6MB6HEG.js.map +0 -1
- package/dist/chunk-CGY7JU4Y.cjs.map +0 -1
- package/dist/chunk-DGYPIIJE.cjs.map +0 -1
- package/dist/chunk-DTMDJGRW.cjs.map +0 -1
- package/dist/chunk-EJDZZ4KX.js.map +0 -1
- package/dist/chunk-GWMW6XY7.cjs.map +0 -1
- package/dist/chunk-H2PVWCWC.cjs.map +0 -1
- package/dist/chunk-IEF6AEK3.cjs.map +0 -1
- package/dist/chunk-LECHRAU3.js.map +0 -1
- package/dist/chunk-OM2XJJWX.js.map +0 -1
- package/dist/chunk-QSIP7YLW.cjs.map +0 -1
- package/dist/chunk-R6GPQZLI.js.map +0 -1
- package/dist/chunk-RPL2IFWK.cjs +0 -77
- package/dist/chunk-RPL2IFWK.cjs.map +0 -1
- package/dist/pgboss-backend-PQW6I3VF.js +0 -14
- package/dist/pgboss-backend-QVXISTLP.cjs +0 -15
- package/dist/pgboss-backend-QVXISTLP.cjs.map +0 -1
- /package/dist/{chunk-JBOMTZT5.js.map → chunk-3JQWQF2M.js.map} +0 -0
- /package/dist/{chunk-O2E7H2XA.js.map → chunk-BCSJOPYH.js.map} +0 -0
- /package/dist/{pgboss-backend-PQW6I3VF.js.map → pgboss-backend-5DXF4G22.js.map} +0 -0
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import {
|
|
2
|
+
closePgBoss,
|
|
3
|
+
initPgBoss,
|
|
4
|
+
pgBossAdmin
|
|
5
|
+
} from "./chunk-74R37C4I.js";
|
|
6
|
+
import "./chunk-PUM5ZDAH.js";
|
|
7
|
+
import "./chunk-ZBQUYFI3.js";
|
|
8
|
+
import "./chunk-UJ2ISRLP.js";
|
|
9
|
+
import "./chunk-546TNO2V.js";
|
|
10
|
+
import "./chunk-Y7I2633P.js";
|
|
11
|
+
export {
|
|
12
|
+
closePgBoss,
|
|
13
|
+
initPgBoss,
|
|
14
|
+
pgBossAdmin
|
|
15
|
+
};
|
|
16
|
+
//# sourceMappingURL=pgboss-backend-5DXF4G22.js.map
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
var _chunkIG3V2IOKcjs = require('./chunk-IG3V2IOK.cjs');
|
|
6
|
+
require('./chunk-JAPZYQVJ.cjs');
|
|
7
|
+
require('./chunk-A2QGDWCG.cjs');
|
|
8
|
+
require('./chunk-JHCXIYJH.cjs');
|
|
9
|
+
require('./chunk-URKE3OXN.cjs');
|
|
10
|
+
require('./chunk-PUYBKDYD.cjs');
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
exports.closePgBoss = _chunkIG3V2IOKcjs.closePgBoss; exports.initPgBoss = _chunkIG3V2IOKcjs.initPgBoss; exports.pgBossAdmin = _chunkIG3V2IOKcjs.pgBossAdmin;
|
|
16
|
+
//# sourceMappingURL=pgboss-backend-KRTFHRNZ.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["/home/runner/work/express-file-cluster/express-file-cluster/packages/core/dist/pgboss-backend-KRTFHRNZ.cjs"],"names":[],"mappings":"AAAA;AACE;AACA;AACA;AACF,wDAA6B;AAC7B,gCAA6B;AAC7B,gCAA6B;AAC7B,gCAA6B;AAC7B,gCAA6B;AAC7B,gCAA6B;AAC7B;AACE;AACA;AACA;AACF,4JAAC","file":"/home/runner/work/express-file-cluster/express-file-cluster/packages/core/dist/pgboss-backend-KRTFHRNZ.cjs"}
|
package/dist/registry/index.json
CHANGED
package/dist/tasks/index.cjs
CHANGED
|
@@ -6,8 +6,8 @@
|
|
|
6
6
|
|
|
7
7
|
|
|
8
8
|
|
|
9
|
-
var
|
|
10
|
-
require('../chunk-
|
|
9
|
+
var _chunkA2QGDWCGcjs = require('../chunk-A2QGDWCG.cjs');
|
|
10
|
+
require('../chunk-PUYBKDYD.cjs');
|
|
11
11
|
|
|
12
12
|
|
|
13
13
|
|
|
@@ -16,5 +16,5 @@ require('../chunk-CGY7JU4Y.cjs');
|
|
|
16
16
|
|
|
17
17
|
|
|
18
18
|
|
|
19
|
-
exports.ENQUEUE_BRIDGE =
|
|
19
|
+
exports.ENQUEUE_BRIDGE = _chunkA2QGDWCGcjs.ENQUEUE_BRIDGE; exports.defineTask = _chunkA2QGDWCGcjs.defineTask; exports.enqueue = _chunkA2QGDWCGcjs.enqueue; exports.listTasks = _chunkA2QGDWCGcjs.listTasks; exports.registerTask = _chunkA2QGDWCGcjs.registerTask; exports.setEnqueueImpl = _chunkA2QGDWCGcjs.setEnqueueImpl; exports.taskRegistry = _chunkA2QGDWCGcjs.taskRegistry;
|
|
20
20
|
//# sourceMappingURL=index.cjs.map
|
package/dist/tasks/index.d.cts
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
import { T as TaskOptions, a as TaskDefinition } from '../types-
|
|
1
|
+
import { T as TaskOptions, a as TaskDefinition } from '../types-Bgeqpm-n.cjs';
|
|
2
2
|
import 'express';
|
|
3
3
|
import 'node:http';
|
|
4
4
|
import 'ws';
|
|
5
5
|
|
|
6
|
+
type EnqueueImpl = (name: string, payload: unknown) => Promise<void>;
|
|
6
7
|
declare const taskRegistry: Map<string, TaskDefinition<unknown>>;
|
|
7
8
|
type HandlerFn<T> = (payload: T) => Promise<void>;
|
|
8
9
|
type DefineTaskOverload = {
|
|
@@ -10,7 +11,6 @@ type DefineTaskOverload = {
|
|
|
10
11
|
<T>(options: TaskOptions, handler: HandlerFn<T>): TaskDefinition<T>;
|
|
11
12
|
};
|
|
12
13
|
declare const defineTask: DefineTaskOverload;
|
|
13
|
-
type EnqueueImpl = (name: string, payload: unknown) => Promise<void>;
|
|
14
14
|
declare function setEnqueueImpl(impl: EnqueueImpl): void;
|
|
15
15
|
/** Set inside `{ thread: true }` task threads: forwards enqueue() to the main thread. */
|
|
16
16
|
declare const ENQUEUE_BRIDGE: unique symbol;
|
package/dist/tasks/index.d.ts
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
import { T as TaskOptions, a as TaskDefinition } from '../types-
|
|
1
|
+
import { T as TaskOptions, a as TaskDefinition } from '../types-Bgeqpm-n.js';
|
|
2
2
|
import 'express';
|
|
3
3
|
import 'node:http';
|
|
4
4
|
import 'ws';
|
|
5
5
|
|
|
6
|
+
type EnqueueImpl = (name: string, payload: unknown) => Promise<void>;
|
|
6
7
|
declare const taskRegistry: Map<string, TaskDefinition<unknown>>;
|
|
7
8
|
type HandlerFn<T> = (payload: T) => Promise<void>;
|
|
8
9
|
type DefineTaskOverload = {
|
|
@@ -10,7 +11,6 @@ type DefineTaskOverload = {
|
|
|
10
11
|
<T>(options: TaskOptions, handler: HandlerFn<T>): TaskDefinition<T>;
|
|
11
12
|
};
|
|
12
13
|
declare const defineTask: DefineTaskOverload;
|
|
13
|
-
type EnqueueImpl = (name: string, payload: unknown) => Promise<void>;
|
|
14
14
|
declare function setEnqueueImpl(impl: EnqueueImpl): void;
|
|
15
15
|
/** Set inside `{ thread: true }` task threads: forwards enqueue() to the main thread. */
|
|
16
16
|
declare const ENQUEUE_BRIDGE: unique symbol;
|
package/dist/tasks/index.js
CHANGED
package/dist/testing.cjs
CHANGED
|
@@ -3,21 +3,22 @@
|
|
|
3
3
|
|
|
4
4
|
|
|
5
5
|
|
|
6
|
-
var
|
|
6
|
+
var _chunkAG7PVYPEcjs = require('./chunk-AG7PVYPE.cjs');
|
|
7
7
|
|
|
8
8
|
|
|
9
|
-
var
|
|
9
|
+
var _chunkH6MHRHUPcjs = require('./chunk-H6MHRHUP.cjs');
|
|
10
10
|
|
|
11
11
|
|
|
12
|
-
var
|
|
13
|
-
require('./chunk-
|
|
12
|
+
var _chunk4FQP6QX3cjs = require('./chunk-4FQP6QX3.cjs');
|
|
13
|
+
require('./chunk-VLGN3XUM.cjs');
|
|
14
14
|
require('./chunk-AGOYTFRO.cjs');
|
|
15
|
-
require('./chunk-
|
|
16
|
-
require('./chunk-
|
|
15
|
+
require('./chunk-JAPZYQVJ.cjs');
|
|
16
|
+
require('./chunk-A2QGDWCG.cjs');
|
|
17
17
|
|
|
18
18
|
|
|
19
|
-
var
|
|
20
|
-
require('./chunk-
|
|
19
|
+
var _chunkJHCXIYJHcjs = require('./chunk-JHCXIYJH.cjs');
|
|
20
|
+
require('./chunk-URKE3OXN.cjs');
|
|
21
|
+
require('./chunk-PUYBKDYD.cjs');
|
|
21
22
|
|
|
22
23
|
// src/testing.ts
|
|
23
24
|
var _path = require('path'); var _path2 = _interopRequireDefault(_path);
|
|
@@ -31,17 +32,18 @@ async function createTestApp(options) {
|
|
|
31
32
|
if (!_fs2.default.existsSync(apiDir) || !_fs2.default.statSync(apiDir).isDirectory()) {
|
|
32
33
|
throw new Error(`[EFC] createTestApp apiDir is not a directory: ${apiDir}`);
|
|
33
34
|
}
|
|
34
|
-
|
|
35
|
+
_chunkJHCXIYJHcjs.configureLogger.call(void 0, false);
|
|
35
36
|
if (options.auth) {
|
|
36
|
-
|
|
37
|
+
_chunkH6MHRHUPcjs.configureAuth.call(void 0, {
|
|
37
38
|
secret: options.auth.secret,
|
|
38
39
|
strategy: _nullishCoalesce(options.auth.strategy, () => ( "http-only")),
|
|
39
40
|
expiresIn: _nullishCoalesce(options.auth.expiresIn, () => ( "1h")),
|
|
40
41
|
...options.auth.cookieDomain !== void 0 && { cookieDomain: options.auth.cookieDomain }
|
|
41
42
|
});
|
|
42
43
|
}
|
|
43
|
-
const app =
|
|
44
|
+
const app = _chunkAG7PVYPEcjs.createHttpApp.call(void 0, {
|
|
44
45
|
cors: false,
|
|
46
|
+
...options.tracing !== void 0 && { tracing: options.tracing },
|
|
45
47
|
...options.globalMiddlewares !== void 0 && {
|
|
46
48
|
globalMiddlewares: options.globalMiddlewares
|
|
47
49
|
},
|
|
@@ -49,14 +51,14 @@ async function createTestApp(options) {
|
|
|
49
51
|
...options.trustProxy !== void 0 && { trustProxy: options.trustProxy }
|
|
50
52
|
});
|
|
51
53
|
const router = _express2.default.Router();
|
|
52
|
-
const mounted = await
|
|
54
|
+
const mounted = await _chunkAG7PVYPEcjs.mountRoutes.call(void 0, router, _chunk4FQP6QX3cjs.scanDir.call(void 0, apiDir));
|
|
53
55
|
if (options.openapi)
|
|
54
|
-
await
|
|
56
|
+
await _chunkAG7PVYPEcjs.mountOpenAPI.call(void 0, app, mounted, {
|
|
55
57
|
...options.openapi === true ? {} : options.openapi,
|
|
56
58
|
basePath: _nullishCoalesce(options.basePath, () => ( "/v1/api"))
|
|
57
59
|
});
|
|
58
60
|
app.use(_nullishCoalesce(options.basePath, () => ( "/v1/api")), router);
|
|
59
|
-
|
|
61
|
+
_chunkAG7PVYPEcjs.mountErrorHandler.call(void 0, app, options.onError);
|
|
60
62
|
return app;
|
|
61
63
|
}
|
|
62
64
|
|
package/dist/testing.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["/home/runner/work/express-file-cluster/express-file-cluster/packages/core/dist/testing.cjs","../src/testing.ts"],"names":[],"mappings":"AAAA;AACE;AACA;AACA;AACA;AACF,wDAA6B;AAC7B;AACE;AACF,wDAA6B;AAC7B;AACE;AACF,wDAA6B;AAC7B,gCAA6B;AAC7B,gCAA6B;AAC7B,gCAA6B;AAC7B,gCAA6B;AAC7B;AACE;AACF,wDAA6B;AAC7B,gCAA6B;AAC7B;AACA;
|
|
1
|
+
{"version":3,"sources":["/home/runner/work/express-file-cluster/express-file-cluster/packages/core/dist/testing.cjs","../src/testing.ts"],"names":[],"mappings":"AAAA;AACE;AACA;AACA;AACA;AACF,wDAA6B;AAC7B;AACE;AACF,wDAA6B;AAC7B;AACE;AACF,wDAA6B;AAC7B,gCAA6B;AAC7B,gCAA6B;AAC7B,gCAA6B;AAC7B,gCAA6B;AAC7B;AACE;AACF,wDAA6B;AAC7B,gCAA6B;AAC7B,gCAA6B;AAC7B;AACA;ACtBA,wEAAiB;AACjB,gEAAe;AACf,oFAAoB;AAiCpB,MAAA,SAAsB,aAAA,CAAc,OAAA,EAAmD;AACrF,EAAA,GAAA,CAAI,OAAO,OAAA,CAAQ,OAAA,IAAW,SAAA,GAAY,CAAC,OAAA,CAAQ,MAAA,CAAO,IAAA,CAAK,CAAA,EAAG;AAChE,IAAA,MAAM,IAAI,KAAA,CAAM,gDAAgD,CAAA;AAAA,EAClE;AACA,EAAA,MAAM,OAAA,EAAS,cAAA,CAAK,OAAA,CAAQ,OAAA,CAAQ,MAAM,CAAA;AAC1C,EAAA,GAAA,CAAI,CAAC,YAAA,CAAG,UAAA,CAAW,MAAM,EAAA,GAAK,CAAC,YAAA,CAAG,QAAA,CAAS,MAAM,CAAA,CAAE,WAAA,CAAY,CAAA,EAAG;AAChE,IAAA,MAAM,IAAI,KAAA,CAAM,CAAA,+CAAA,EAAkD,MAAM,CAAA,CAAA;AAC1E,EAAA;AACqB,EAAA;AACH,EAAA;AACF,IAAA;AACS,MAAA;AACc,MAAA;AACE,MAAA;AACkC,MAAA;AACxE,IAAA;AACH,EAAA;AAC0B,EAAA;AAClB,IAAA;AAC0D,IAAA;AACjB,IAAA;AAClB,MAAA;AAC7B,IAAA;AACsE,IAAA;AACG,IAAA;AAC1E,EAAA;AAC6B,EAAA;AAC2B,EAAA;AAC7C,EAAA;AACuB,IAAA;AACa,MAAA;AACd,MAAA;AAC/B,IAAA;AAC0C,EAAA;AACP,EAAA;AAC/B,EAAA;AACT;ADR6E;AACA;AACA","file":"/home/runner/work/express-file-cluster/express-file-cluster/packages/core/dist/testing.cjs","sourcesContent":[null,"import path from 'node:path';\nimport fs from 'node:fs';\nimport express from 'express';\nimport type { AuthStrategy, EFCConfig } from './types.js';\nimport { configureAuth } from './auth/index.js';\nimport { configureLogger } from './logger.js';\nimport { createHttpApp, mountErrorHandler } from './http-app.js';\nimport { scanDir } from './router/scan.js';\nimport { mountRoutes } from './router/mount.js';\nimport { mountOpenAPI } from './openapi.js';\n\nexport interface TestAppOptions {\n tracing?: EFCConfig['tracing'];\n openapi?: EFCConfig['openapi'];\n /** Explicit fixtures/app API directory. Does not change cwd or ignite() conventions. */\n apiDir: string;\n basePath?: string;\n globalMiddlewares?: express.RequestHandler[];\n requestTimeout?: number;\n trustProxy?: EFCConfig['trustProxy'];\n onError?: express.ErrorRequestHandler;\n /** Auth is process-wide, as in ignite(); use one configuration per test process. */\n auth?: {\n secret: string;\n strategy?: AuthStrategy;\n expiresIn?: string;\n cookieDomain?: string;\n };\n}\n\n/**\n * Mounts real file-based routes on an Express app for supertest (or another HTTP\n * harness). Does not listen, fork workers, start services, or install signal handlers.\n * Models and task queues need separately configured integration fixtures.\n */\nexport async function createTestApp(options: TestAppOptions): Promise<express.Express> {\n if (typeof options.apiDir !== 'string' || !options.apiDir.trim()) {\n throw new Error('[EFC] createTestApp requires a nonempty apiDir');\n }\n const apiDir = path.resolve(options.apiDir);\n if (!fs.existsSync(apiDir) || !fs.statSync(apiDir).isDirectory()) {\n throw new Error(`[EFC] createTestApp apiDir is not a directory: ${apiDir}`);\n }\n configureLogger(false);\n if (options.auth) {\n configureAuth({\n secret: options.auth.secret,\n strategy: options.auth.strategy ?? 'http-only',\n expiresIn: options.auth.expiresIn ?? '1h',\n ...(options.auth.cookieDomain !== undefined && { cookieDomain: options.auth.cookieDomain }),\n });\n }\n const app = createHttpApp({\n cors: false,\n ...(options.tracing !== undefined && { tracing: options.tracing }),\n ...(options.globalMiddlewares !== undefined && {\n globalMiddlewares: options.globalMiddlewares,\n }),\n ...(options.requestTimeout !== undefined && { requestTimeout: options.requestTimeout }),\n ...(options.trustProxy !== undefined && { trustProxy: options.trustProxy }),\n });\n const router = express.Router();\n const mounted = await mountRoutes(router, scanDir(apiDir));\n if (options.openapi)\n await mountOpenAPI(app, mounted, {\n ...(options.openapi === true ? {} : options.openapi),\n basePath: options.basePath ?? '/v1/api',\n });\n app.use(options.basePath ?? '/v1/api', router);\n mountErrorHandler(app, options.onError);\n return app;\n}\n"]}
|
package/dist/testing.d.cts
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import express from 'express';
|
|
2
|
-
import { E as EFCConfig, A as AuthStrategy } from './types-
|
|
2
|
+
import { E as EFCConfig, A as AuthStrategy } from './types-Bgeqpm-n.cjs';
|
|
3
3
|
import 'node:http';
|
|
4
4
|
import 'ws';
|
|
5
5
|
|
|
6
6
|
interface TestAppOptions {
|
|
7
|
+
tracing?: EFCConfig['tracing'];
|
|
7
8
|
openapi?: EFCConfig['openapi'];
|
|
8
9
|
/** Explicit fixtures/app API directory. Does not change cwd or ignite() conventions. */
|
|
9
10
|
apiDir: string;
|
package/dist/testing.d.ts
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import express from 'express';
|
|
2
|
-
import { E as EFCConfig, A as AuthStrategy } from './types-
|
|
2
|
+
import { E as EFCConfig, A as AuthStrategy } from './types-Bgeqpm-n.js';
|
|
3
3
|
import 'node:http';
|
|
4
4
|
import 'ws';
|
|
5
5
|
|
|
6
6
|
interface TestAppOptions {
|
|
7
|
+
tracing?: EFCConfig['tracing'];
|
|
7
8
|
openapi?: EFCConfig['openapi'];
|
|
8
9
|
/** Explicit fixtures/app API directory. Does not change cwd or ignite() conventions. */
|
|
9
10
|
apiDir: string;
|
package/dist/testing.js
CHANGED
|
@@ -3,20 +3,22 @@ import {
|
|
|
3
3
|
mountErrorHandler,
|
|
4
4
|
mountOpenAPI,
|
|
5
5
|
mountRoutes
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-ZU2GK5WY.js";
|
|
7
7
|
import {
|
|
8
8
|
configureAuth
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-X2B7WBKH.js";
|
|
10
10
|
import {
|
|
11
11
|
scanDir
|
|
12
|
-
} from "./chunk-
|
|
13
|
-
import "./chunk-
|
|
12
|
+
} from "./chunk-BCSJOPYH.js";
|
|
13
|
+
import "./chunk-EBJELA7T.js";
|
|
14
14
|
import "./chunk-XPY5TQDK.js";
|
|
15
|
-
import "./chunk-
|
|
16
|
-
import "./chunk-
|
|
15
|
+
import "./chunk-PUM5ZDAH.js";
|
|
16
|
+
import "./chunk-ZBQUYFI3.js";
|
|
17
17
|
import {
|
|
18
18
|
configureLogger
|
|
19
|
-
} from "./chunk-
|
|
19
|
+
} from "./chunk-UJ2ISRLP.js";
|
|
20
|
+
import "./chunk-546TNO2V.js";
|
|
21
|
+
import "./chunk-Y7I2633P.js";
|
|
20
22
|
|
|
21
23
|
// src/testing.ts
|
|
22
24
|
import path from "path";
|
|
@@ -41,6 +43,7 @@ async function createTestApp(options) {
|
|
|
41
43
|
}
|
|
42
44
|
const app = createHttpApp({
|
|
43
45
|
cors: false,
|
|
46
|
+
...options.tracing !== void 0 && { tracing: options.tracing },
|
|
44
47
|
...options.globalMiddlewares !== void 0 && {
|
|
45
48
|
globalMiddlewares: options.globalMiddlewares
|
|
46
49
|
},
|
package/dist/testing.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/testing.ts"],"sourcesContent":["import path from 'node:path';\nimport fs from 'node:fs';\nimport express from 'express';\nimport type { AuthStrategy, EFCConfig } from './types.js';\nimport { configureAuth } from './auth/index.js';\nimport { configureLogger } from './logger.js';\nimport { createHttpApp, mountErrorHandler } from './http-app.js';\nimport { scanDir } from './router/scan.js';\nimport { mountRoutes } from './router/mount.js';\nimport { mountOpenAPI } from './openapi.js';\n\nexport interface TestAppOptions {\n openapi?: EFCConfig['openapi'];\n /** Explicit fixtures/app API directory. Does not change cwd or ignite() conventions. */\n apiDir: string;\n basePath?: string;\n globalMiddlewares?: express.RequestHandler[];\n requestTimeout?: number;\n trustProxy?: EFCConfig['trustProxy'];\n onError?: express.ErrorRequestHandler;\n /** Auth is process-wide, as in ignite(); use one configuration per test process. */\n auth?: {\n secret: string;\n strategy?: AuthStrategy;\n expiresIn?: string;\n cookieDomain?: string;\n };\n}\n\n/**\n * Mounts real file-based routes on an Express app for supertest (or another HTTP\n * harness). Does not listen, fork workers, start services, or install signal handlers.\n * Models and task queues need separately configured integration fixtures.\n */\nexport async function createTestApp(options: TestAppOptions): Promise<express.Express> {\n if (typeof options.apiDir !== 'string' || !options.apiDir.trim()) {\n throw new Error('[EFC] createTestApp requires a nonempty apiDir');\n }\n const apiDir = path.resolve(options.apiDir);\n if (!fs.existsSync(apiDir) || !fs.statSync(apiDir).isDirectory()) {\n throw new Error(`[EFC] createTestApp apiDir is not a directory: ${apiDir}`);\n }\n configureLogger(false);\n if (options.auth) {\n configureAuth({\n secret: options.auth.secret,\n strategy: options.auth.strategy ?? 'http-only',\n expiresIn: options.auth.expiresIn ?? '1h',\n ...(options.auth.cookieDomain !== undefined && { cookieDomain: options.auth.cookieDomain }),\n });\n }\n const app = createHttpApp({\n cors: false,\n ...(options.globalMiddlewares !== undefined && {\n globalMiddlewares: options.globalMiddlewares,\n }),\n ...(options.requestTimeout !== undefined && { requestTimeout: options.requestTimeout }),\n ...(options.trustProxy !== undefined && { trustProxy: options.trustProxy }),\n });\n const router = express.Router();\n const mounted = await mountRoutes(router, scanDir(apiDir));\n if (options.openapi)\n await mountOpenAPI(app, mounted, {\n ...(options.openapi === true ? {} : options.openapi),\n basePath: options.basePath ?? '/v1/api',\n });\n app.use(options.basePath ?? '/v1/api', router);\n mountErrorHandler(app, options.onError);\n return app;\n}\n"],"mappings":"
|
|
1
|
+
{"version":3,"sources":["../src/testing.ts"],"sourcesContent":["import path from 'node:path';\nimport fs from 'node:fs';\nimport express from 'express';\nimport type { AuthStrategy, EFCConfig } from './types.js';\nimport { configureAuth } from './auth/index.js';\nimport { configureLogger } from './logger.js';\nimport { createHttpApp, mountErrorHandler } from './http-app.js';\nimport { scanDir } from './router/scan.js';\nimport { mountRoutes } from './router/mount.js';\nimport { mountOpenAPI } from './openapi.js';\n\nexport interface TestAppOptions {\n tracing?: EFCConfig['tracing'];\n openapi?: EFCConfig['openapi'];\n /** Explicit fixtures/app API directory. Does not change cwd or ignite() conventions. */\n apiDir: string;\n basePath?: string;\n globalMiddlewares?: express.RequestHandler[];\n requestTimeout?: number;\n trustProxy?: EFCConfig['trustProxy'];\n onError?: express.ErrorRequestHandler;\n /** Auth is process-wide, as in ignite(); use one configuration per test process. */\n auth?: {\n secret: string;\n strategy?: AuthStrategy;\n expiresIn?: string;\n cookieDomain?: string;\n };\n}\n\n/**\n * Mounts real file-based routes on an Express app for supertest (or another HTTP\n * harness). Does not listen, fork workers, start services, or install signal handlers.\n * Models and task queues need separately configured integration fixtures.\n */\nexport async function createTestApp(options: TestAppOptions): Promise<express.Express> {\n if (typeof options.apiDir !== 'string' || !options.apiDir.trim()) {\n throw new Error('[EFC] createTestApp requires a nonempty apiDir');\n }\n const apiDir = path.resolve(options.apiDir);\n if (!fs.existsSync(apiDir) || !fs.statSync(apiDir).isDirectory()) {\n throw new Error(`[EFC] createTestApp apiDir is not a directory: ${apiDir}`);\n }\n configureLogger(false);\n if (options.auth) {\n configureAuth({\n secret: options.auth.secret,\n strategy: options.auth.strategy ?? 'http-only',\n expiresIn: options.auth.expiresIn ?? '1h',\n ...(options.auth.cookieDomain !== undefined && { cookieDomain: options.auth.cookieDomain }),\n });\n }\n const app = createHttpApp({\n cors: false,\n ...(options.tracing !== undefined && { tracing: options.tracing }),\n ...(options.globalMiddlewares !== undefined && {\n globalMiddlewares: options.globalMiddlewares,\n }),\n ...(options.requestTimeout !== undefined && { requestTimeout: options.requestTimeout }),\n ...(options.trustProxy !== undefined && { trustProxy: options.trustProxy }),\n });\n const router = express.Router();\n const mounted = await mountRoutes(router, scanDir(apiDir));\n if (options.openapi)\n await mountOpenAPI(app, mounted, {\n ...(options.openapi === true ? {} : options.openapi),\n basePath: options.basePath ?? '/v1/api',\n });\n app.use(options.basePath ?? '/v1/api', router);\n mountErrorHandler(app, options.onError);\n return app;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAAA,OAAO,UAAU;AACjB,OAAO,QAAQ;AACf,OAAO,aAAa;AAiCpB,eAAsB,cAAc,SAAmD;AACrF,MAAI,OAAO,QAAQ,WAAW,YAAY,CAAC,QAAQ,OAAO,KAAK,GAAG;AAChE,UAAM,IAAI,MAAM,gDAAgD;AAAA,EAClE;AACA,QAAM,SAAS,KAAK,QAAQ,QAAQ,MAAM;AAC1C,MAAI,CAAC,GAAG,WAAW,MAAM,KAAK,CAAC,GAAG,SAAS,MAAM,EAAE,YAAY,GAAG;AAChE,UAAM,IAAI,MAAM,kDAAkD,MAAM,EAAE;AAAA,EAC5E;AACA,kBAAgB,KAAK;AACrB,MAAI,QAAQ,MAAM;AAChB,kBAAc;AAAA,MACZ,QAAQ,QAAQ,KAAK;AAAA,MACrB,UAAU,QAAQ,KAAK,YAAY;AAAA,MACnC,WAAW,QAAQ,KAAK,aAAa;AAAA,MACrC,GAAI,QAAQ,KAAK,iBAAiB,UAAa,EAAE,cAAc,QAAQ,KAAK,aAAa;AAAA,IAC3F,CAAC;AAAA,EACH;AACA,QAAM,MAAM,cAAc;AAAA,IACxB,MAAM;AAAA,IACN,GAAI,QAAQ,YAAY,UAAa,EAAE,SAAS,QAAQ,QAAQ;AAAA,IAChE,GAAI,QAAQ,sBAAsB,UAAa;AAAA,MAC7C,mBAAmB,QAAQ;AAAA,IAC7B;AAAA,IACA,GAAI,QAAQ,mBAAmB,UAAa,EAAE,gBAAgB,QAAQ,eAAe;AAAA,IACrF,GAAI,QAAQ,eAAe,UAAa,EAAE,YAAY,QAAQ,WAAW;AAAA,EAC3E,CAAC;AACD,QAAM,SAAS,QAAQ,OAAO;AAC9B,QAAM,UAAU,MAAM,YAAY,QAAQ,QAAQ,MAAM,CAAC;AACzD,MAAI,QAAQ;AACV,UAAM,aAAa,KAAK,SAAS;AAAA,MAC/B,GAAI,QAAQ,YAAY,OAAO,CAAC,IAAI,QAAQ;AAAA,MAC5C,UAAU,QAAQ,YAAY;AAAA,IAChC,CAAC;AACH,MAAI,IAAI,QAAQ,YAAY,WAAW,MAAM;AAC7C,oBAAkB,KAAK,QAAQ,OAAO;AACtC,SAAO;AACT;","names":[]}
|
package/dist/thread-runner.cjs
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
2
|
|
|
3
|
-
var
|
|
4
|
-
require('./chunk-
|
|
5
|
-
require('./chunk-
|
|
3
|
+
var _chunkJAPZYQVJcjs = require('./chunk-JAPZYQVJ.cjs');
|
|
4
|
+
require('./chunk-A2QGDWCG.cjs');
|
|
5
|
+
require('./chunk-URKE3OXN.cjs');
|
|
6
|
+
require('./chunk-PUYBKDYD.cjs');
|
|
6
7
|
|
|
7
8
|
|
|
8
|
-
exports.runInThread =
|
|
9
|
+
exports.runInThread = _chunkJAPZYQVJcjs.runInThread;
|
|
9
10
|
//# sourceMappingURL=thread-runner.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["/home/runner/work/express-file-cluster/express-file-cluster/packages/core/dist/thread-runner.cjs"],"names":[],"mappings":"AAAA;AACE;AACF,wDAA6B;AAC7B,gCAA6B;AAC7B,gCAA6B;AAC7B;AACE;AACF,oDAAC","file":"/home/runner/work/express-file-cluster/express-file-cluster/packages/core/dist/thread-runner.cjs"}
|
|
1
|
+
{"version":3,"sources":["/home/runner/work/express-file-cluster/express-file-cluster/packages/core/dist/thread-runner.cjs"],"names":[],"mappings":"AAAA;AACE;AACF,wDAA6B;AAC7B,gCAA6B;AAC7B,gCAA6B;AAC7B,gCAA6B;AAC7B;AACE;AACF,oDAAC","file":"/home/runner/work/express-file-cluster/express-file-cluster/packages/core/dist/thread-runner.cjs"}
|
package/dist/thread-runner.d.cts
CHANGED
package/dist/thread-runner.d.ts
CHANGED
package/dist/thread-runner.js
CHANGED
|
@@ -40,6 +40,15 @@ declare function generateOpenAPI(input: MountedRoute[] | string, options?: OpenA
|
|
|
40
40
|
basePath?: string;
|
|
41
41
|
}): Promise<OpenAPIDocument>;
|
|
42
42
|
|
|
43
|
+
interface TracingOptions {
|
|
44
|
+
/** Instrument HTTP, including upgrade handshakes. Default true. */
|
|
45
|
+
http?: boolean;
|
|
46
|
+
/** Instrument the queue backends and propagate context to tasks. Default true. */
|
|
47
|
+
tasks?: boolean;
|
|
48
|
+
/** App-owned SDK shutdown/flush, called after HTTP and tasks drain. */
|
|
49
|
+
shutdown?: () => Promise<void>;
|
|
50
|
+
}
|
|
51
|
+
|
|
43
52
|
type WebSocketHandler = (socket: WebSocket, request: Request) => void | Promise<void>;
|
|
44
53
|
interface WebSocketOptions {
|
|
45
54
|
/** Default 1 MiB. Compression is disabled. */
|
|
@@ -158,6 +167,8 @@ interface DatabasePoolConfig {
|
|
|
158
167
|
connectionTimeoutMs?: number;
|
|
159
168
|
}
|
|
160
169
|
interface EFCConfig {
|
|
170
|
+
/** Opt-in OpenTelemetry instrumentation; the app owns its SDK/exporter. */
|
|
171
|
+
tracing?: boolean | TracingOptions;
|
|
161
172
|
/** Opt-in OpenAPI 3.1 document; default URL /openapi.json. */
|
|
162
173
|
openapi?: boolean | OpenAPIOptions;
|
|
163
174
|
/** WS exports enable WebSockets by default; false disables upgrades. */
|
|
@@ -729,4 +740,4 @@ interface MigrationContext {
|
|
|
729
740
|
engine: DatabaseEngine;
|
|
730
741
|
}
|
|
731
742
|
|
|
732
|
-
export {
|
|
743
|
+
export { attachWebSockets as $, type AuthStrategy as A, type RouteSchema as B, type CollectionSchema as C, type DatabaseEngine as D, type EFCConfig as E, type FieldDefinition as F, type GeoPoint as G, type ScalarKeys as H, type InferSchema as I, type JSONSchema as J, type SchemaField as K, type LoggingConfig as L, type ModelSchema as M, type TableFieldDefinition as N, type OpenAPIDocument as O, type TableRelation as P, type QueryLogConfig as Q, type RouteEntry as R, type Simplify as S, type TaskOptions as T, type TableSchemaField as U, type TracingOptions as V, type Update as W, type ValidationIssue as X, type Validator as Y, type WebSocketHandler as Z, type WebSocketOptions as _, type TaskDefinition as a, closeWebSockets as a0, generateOpenAPI as a1, type InferCreateInput as b, type ModelOptions as c, type InferredModel as d, type TableSchema as e, type TableOptions as f, type SortDirection as g, type InferRecord as h, type CacheConfig as i, type CollectionFieldDefinition as j, type CorsConfig as k, type DatabasePoolConfig as l, type DefaultOperator as m, type Filter as n, type FilterOperators as o, type FindOptions as p, type IndexDefinition as q, type InferCreate as r, type MigrationContext as s, type ModelCRUD as t, type ModelQueryOptions as u, type ModelRecord as v, type OpenAPIOptions as w, type RequestSchema as x, type RouteMeta as y, type RouteMethodMeta as z };
|
|
@@ -40,6 +40,15 @@ declare function generateOpenAPI(input: MountedRoute[] | string, options?: OpenA
|
|
|
40
40
|
basePath?: string;
|
|
41
41
|
}): Promise<OpenAPIDocument>;
|
|
42
42
|
|
|
43
|
+
interface TracingOptions {
|
|
44
|
+
/** Instrument HTTP, including upgrade handshakes. Default true. */
|
|
45
|
+
http?: boolean;
|
|
46
|
+
/** Instrument the queue backends and propagate context to tasks. Default true. */
|
|
47
|
+
tasks?: boolean;
|
|
48
|
+
/** App-owned SDK shutdown/flush, called after HTTP and tasks drain. */
|
|
49
|
+
shutdown?: () => Promise<void>;
|
|
50
|
+
}
|
|
51
|
+
|
|
43
52
|
type WebSocketHandler = (socket: WebSocket, request: Request) => void | Promise<void>;
|
|
44
53
|
interface WebSocketOptions {
|
|
45
54
|
/** Default 1 MiB. Compression is disabled. */
|
|
@@ -158,6 +167,8 @@ interface DatabasePoolConfig {
|
|
|
158
167
|
connectionTimeoutMs?: number;
|
|
159
168
|
}
|
|
160
169
|
interface EFCConfig {
|
|
170
|
+
/** Opt-in OpenTelemetry instrumentation; the app owns its SDK/exporter. */
|
|
171
|
+
tracing?: boolean | TracingOptions;
|
|
161
172
|
/** Opt-in OpenAPI 3.1 document; default URL /openapi.json. */
|
|
162
173
|
openapi?: boolean | OpenAPIOptions;
|
|
163
174
|
/** WS exports enable WebSockets by default; false disables upgrades. */
|
|
@@ -729,4 +740,4 @@ interface MigrationContext {
|
|
|
729
740
|
engine: DatabaseEngine;
|
|
730
741
|
}
|
|
731
742
|
|
|
732
|
-
export {
|
|
743
|
+
export { attachWebSockets as $, type AuthStrategy as A, type RouteSchema as B, type CollectionSchema as C, type DatabaseEngine as D, type EFCConfig as E, type FieldDefinition as F, type GeoPoint as G, type ScalarKeys as H, type InferSchema as I, type JSONSchema as J, type SchemaField as K, type LoggingConfig as L, type ModelSchema as M, type TableFieldDefinition as N, type OpenAPIDocument as O, type TableRelation as P, type QueryLogConfig as Q, type RouteEntry as R, type Simplify as S, type TaskOptions as T, type TableSchemaField as U, type TracingOptions as V, type Update as W, type ValidationIssue as X, type Validator as Y, type WebSocketHandler as Z, type WebSocketOptions as _, type TaskDefinition as a, closeWebSockets as a0, generateOpenAPI as a1, type InferCreateInput as b, type ModelOptions as c, type InferredModel as d, type TableSchema as e, type TableOptions as f, type SortDirection as g, type InferRecord as h, type CacheConfig as i, type CollectionFieldDefinition as j, type CorsConfig as k, type DatabasePoolConfig as l, type DefaultOperator as m, type Filter as n, type FilterOperators as o, type FindOptions as p, type IndexDefinition as q, type InferCreate as r, type MigrationContext as s, type ModelCRUD as t, type ModelQueryOptions as u, type ModelRecord as v, type OpenAPIOptions as w, type RequestSchema as x, type RouteMeta as y, type RouteMethodMeta as z };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "express-file-cluster",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.12.1",
|
|
4
4
|
"description": "Enterprise-grade, zero-boilerplate backend framework with file-based routing and multi-core clustering",
|
|
5
5
|
"homepage": "https://efc.prashantadhikari7.com.np/",
|
|
6
6
|
"repository": {
|
|
@@ -50,6 +50,8 @@
|
|
|
50
50
|
"typecheck": "tsc --noEmit"
|
|
51
51
|
},
|
|
52
52
|
"dependencies": {
|
|
53
|
+
"@opentelemetry/api": "~1.9.0",
|
|
54
|
+
"@opentelemetry/core": "^2.12.0",
|
|
53
55
|
"@types/ws": "^8.18.2",
|
|
54
56
|
"chokidar": "^4.0.0",
|
|
55
57
|
"commander": "^12.0.0",
|
|
@@ -61,6 +63,8 @@
|
|
|
61
63
|
"ws": "^8.22.0"
|
|
62
64
|
},
|
|
63
65
|
"devDependencies": {
|
|
66
|
+
"@opentelemetry/context-async-hooks": "^2.12.0",
|
|
67
|
+
"@opentelemetry/sdk-trace": "^2.12.0",
|
|
64
68
|
"@types/cookie-parser": "^1.4.7",
|
|
65
69
|
"@types/cors": "^2.8.19",
|
|
66
70
|
"@types/express": "^4.17.21",
|
|
@@ -80,13 +84,13 @@
|
|
|
80
84
|
"zod": "^4.6.7"
|
|
81
85
|
},
|
|
82
86
|
"peerDependencies": {
|
|
83
|
-
"bullmq": ">=5.
|
|
87
|
+
"bullmq": ">=5.79.1",
|
|
84
88
|
"drizzle-orm": ">=0.40.0",
|
|
85
89
|
"express": "^4.19.0",
|
|
86
90
|
"ioredis": "^5.0.0",
|
|
87
91
|
"mongoose": "^8.0.0 || ^9.0.0",
|
|
88
92
|
"pg": "^8.11.0",
|
|
89
|
-
"pg-boss": ">=12.
|
|
93
|
+
"pg-boss": ">=12.38.0"
|
|
90
94
|
},
|
|
91
95
|
"peerDependenciesMeta": {
|
|
92
96
|
"bullmq": {
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/process-state.ts","../src/context.ts","../src/logger.ts","../src/db/query-log.ts","../src/db/prepared-statements.ts","../src/db/postgres.ts"],"sourcesContent":["/** Internal process state shared by the package's ESM and CommonJS module graphs. */\nexport function processState<T>(name: string, initialize: () => T): T {\n const key = Symbol.for('express-file-cluster.runtime.v1.' + name);\n const globals = globalThis as Record<symbol, unknown>;\n if (!(key in globals)) globals[key] = initialize();\n return globals[key] as T;\n}\n","import { AsyncLocalStorage } from 'node:async_hooks';\nimport type { Logger } from 'pino';\nimport { processState } from './process-state.js';\n\nexport interface RequestContext {\n user?: Record<string, unknown> | undefined;\n requestId?: string;\n log?: Logger;\n /** Model operations run so far in this request, by `Model.op` (N+1 detection). */\n queryCounts?: Map<string, number>;\n}\n\nconst storage = processState('request-context', () => new AsyncLocalStorage<RequestContext>());\n\n// Wraps one request's lifecycle in an AsyncLocalStorage context. Node propagates\n// the store through the async chain the callback initiates (awaits, .then, etc.),\n// so anything running as part of the same request — including a `$currentUser`\n// default resolved deep inside a mongoose `.create()` call — can read it back.\nexport function runWithContext<T>(ctx: RequestContext, fn: () => T): T {\n return storage.run(ctx, fn);\n}\n\nexport function getRequestContext(): RequestContext | undefined {\n return storage.getStore();\n}\n\nexport function setCurrentUser(user: Record<string, unknown> | undefined): void {\n const store = storage.getStore();\n if (store) store.user = user;\n}\n\nexport function getCurrentUser(): Record<string, unknown> | undefined {\n return storage.getStore()?.user;\n}\n","import cluster from 'node:cluster';\nimport { randomUUID } from 'node:crypto';\nimport type { RequestHandler } from 'express';\nimport pc from 'picocolors';\nimport { pino, type Logger, type DestinationStream } from 'pino';\nimport type { LoggingConfig } from './types.js';\nimport { getRequestContext } from './context.js';\n\nexport type { Logger };\n\nconst LEVEL_LABELS: Record<number, string> = {\n 10: pc.gray('TRACE'),\n 20: pc.blue('DEBUG'),\n 30: pc.green('INFO '),\n 40: pc.yellow('WARN '),\n 50: pc.red('ERROR'),\n 60: pc.bgRed('FATAL'),\n};\n\nconst OMIT = new Set(['level', 'time', 'msg', 'pid', 'hostname', 'worker', 'reqId']);\n\n// Dev-friendly one-line renderer, so readable output doesn't need pino-pretty or a\n// transport worker thread: `12:00:01 INFO [w2] a1b2c3d4 GET /users 200 (3ms)`.\nfunction prettyStream(out: NodeJS.WritableStream = process.stdout): DestinationStream {\n return {\n write(line: string) {\n let rec: Record<string, unknown>;\n try {\n rec = JSON.parse(line) as Record<string, unknown>;\n } catch {\n out.write(line);\n return;\n }\n const time = new Date(rec['time'] as number).toTimeString().slice(0, 8);\n const level = LEVEL_LABELS[rec['level'] as number] ?? String(rec['level']);\n const worker = rec['worker'] !== undefined ? pc.dim(`[${String(rec['worker'])}] `) : '';\n const reqId = rec['reqId'] ? pc.magenta(String(rec['reqId']).slice(0, 8)) + ' ' : '';\n const extra = Object.entries(rec).filter(([k]) => !OMIT.has(k));\n const err = rec['err'] as { stack?: string } | undefined;\n const fields = extra\n .filter(([k]) => k !== 'err')\n .map(([k, v]) => `${k}=${typeof v === 'string' ? v : JSON.stringify(v)}`)\n .join(' ');\n out.write(\n `${pc.dim(time)} ${level} ${worker}${reqId}${String(rec['msg'] ?? '')}` +\n (fields ? ' ' + pc.dim(fields) : '') +\n (err?.stack ? '\\n' + pc.red(err.stack) : '') +\n '\\n',\n );\n },\n };\n}\n\nfunction workerLabel(): string {\n return cluster.isWorker ? `w${cluster.worker?.id ?? '?'}` : 'primary';\n}\n\nfunction build(config: LoggingConfig | false | undefined): Logger {\n if (config === false) return pino({ level: 'silent' });\n const opts = config ?? {};\n const pretty =\n opts.pretty ?? (process.env['NODE_ENV'] !== 'production' && process.stdout.isTTY === true);\n const base = { worker: workerLabel() };\n const level = opts.level ?? 'info';\n return pretty\n ? pino({ level, base, errorKey: 'err' }, prettyStream())\n : pino({ level, base, errorKey: 'err', timestamp: pino.stdTimeFunctions.isoTime });\n}\n\nlet rootLogger: Logger = build(undefined);\nlet logRequests = true;\n\n/** Called by ignite() during Pre-Flight; before that the defaults apply. */\nexport function configureLogger(config: LoggingConfig | false | undefined): void {\n rootLogger = build(config);\n logRequests = config !== false && (config?.requests ?? true);\n}\n\n/**\n * The logger for the current scope: inside a request it is a child carrying that\n * request's `reqId`, so everything logged while handling it can be correlated;\n * elsewhere (startup, task handlers, timers) it is the root logger.\n */\nexport function getLogger(): Logger {\n return getRequestContext()?.log ?? rootLogger;\n}\n\n/** Root logger proxy — always reflects the latest configureLogger() call. */\nexport const logger: Logger = new Proxy({} as Logger, {\n get(_t, prop) {\n const target = getLogger() as unknown as Record<PropertyKey, unknown>;\n const value = target[prop];\n return typeof value === 'function'\n ? (value as (...a: unknown[]) => unknown).bind(target)\n : value;\n },\n});\n\nconst SAFE_REQUEST_ID = /^[\\w.:-]{1,128}$/;\n\n/**\n * Assigns the request ID (trusting a well-formed incoming `X-Request-Id`, e.g. from\n * a load balancer), echoes it back, attaches `req.id` / `req.log`, and logs one\n * line per completed request. Must run inside the request's context.\n */\nexport function requestLogger(): RequestHandler {\n return (req, res, next) => {\n const incoming = req.get('x-request-id');\n const id = incoming && SAFE_REQUEST_ID.test(incoming) ? incoming : randomUUID();\n const log = rootLogger.child({ reqId: id });\n\n req.id = id;\n req.log = log;\n res.setHeader('X-Request-Id', id);\n const ctx = getRequestContext();\n if (ctx) {\n ctx.requestId = id;\n ctx.log = log;\n }\n\n if (logRequests) {\n const start = process.hrtime.bigint();\n res.on('finish', () => {\n const durationMs = Number(process.hrtime.bigint() - start) / 1e6;\n const status = res.statusCode;\n const line = {\n method: req.method,\n url: req.originalUrl,\n status,\n durationMs: Math.round(durationMs * 10) / 10,\n };\n const msg = `${req.method} ${req.originalUrl} ${status}`;\n if (status >= 500) log.error(line, msg);\n else if (status >= 400) log.warn(line, msg);\n else log.info(line, msg);\n });\n }\n next();\n };\n}\n\ndeclare module 'express-serve-static-core' {\n interface Request {\n /** Request ID — the incoming `X-Request-Id` if well-formed, else a UUID. */\n id: string;\n /** Logger bound to this request's ID. */\n log: Logger;\n }\n}\n","import { AsyncLocalStorage } from 'node:async_hooks';\nimport type { LoggingConfig } from '../types.js';\nimport { getRequestContext } from '../context.js';\nimport { getLogger } from '../logger.js';\n\n// Query logging (`logging.queries`): one event per model operation — model, operation,\n// duration, how many database statements it issued, and the request ID — plus slow-query\n// warnings and an N+1 detector. Statements are counted at the driver: Drizzle's logger on\n// PostgreSQL, mongoose's debug hook on MongoDB.\n\n/** One finished model operation. */\nexport interface QueryEvent {\n model: string;\n op: string;\n durationMs: number;\n /** Database statements (SQL statements / MongoDB commands) issued, nested calls included. */\n statements: number;\n /** The request it ran in, if any. */\n reqId?: string;\n /** Set when it threw. */\n error?: string;\n}\n\n/** Aggregated per-process model operation statistics; never contains SQL/parameter values. */\nexport interface QueryMetric {\n model: string;\n op: string;\n calls: number;\n errors: number;\n statements: number;\n totalMs: number;\n minMs: number;\n maxMs: number;\n meanMs: number;\n slow: number;\n}\nexport interface QueryMetricsSnapshot {\n enabled: boolean;\n since: number;\n dropped: number;\n entries: ReadonlyArray<QueryMetric>;\n}\nconst metrics = new Map<string, QueryMetric>();\nlet metricsSince = Date.now();\nlet metricsDropped = 0;\n\n/** Returns detached, deterministically ordered counters; no logs or SQL are exposed. */\nexport function getQueryMetrics(): QueryMetricsSnapshot {\n return {\n enabled: !!config?.metricsLimit,\n since: metricsSince,\n dropped: metricsDropped,\n entries: [...metrics.values()]\n .map((entry) => ({ ...entry }))\n .sort((a, b) => a.model.localeCompare(b.model) || a.op.localeCompare(b.op)),\n };\n}\n/** Clears this process's counters/window; does not disable collection. */\nexport function resetQueryMetrics(): void {\n metrics.clear();\n metricsDropped = 0;\n metricsSince = Date.now();\n}\nfunction collectMetric(event: QueryEvent): void {\n if (!config?.metricsLimit) return;\n const key = event.model + '\\0' + event.op;\n let metric = metrics.get(key);\n if (!metric) {\n if (metrics.size >= config.metricsLimit) {\n metricsDropped++;\n return;\n }\n metric = {\n model: event.model,\n op: event.op,\n calls: 0,\n errors: 0,\n statements: 0,\n totalMs: 0,\n minMs: event.durationMs,\n maxMs: event.durationMs,\n meanMs: 0,\n slow: 0,\n };\n metrics.set(key, metric);\n }\n metric.calls++;\n if (event.error !== undefined) metric.errors++;\n metric.statements += event.statements;\n metric.totalMs += event.durationMs;\n metric.minMs = Math.min(metric.minMs, event.durationMs);\n metric.maxMs = Math.max(metric.maxMs, event.durationMs);\n metric.meanMs = metric.totalMs / metric.calls;\n if (event.durationMs >= config.slowMs) metric.slow++;\n}\n\ninterface Resolved {\n all: boolean;\n slowMs: number;\n nPlusOne: number | false;\n metricsLimit: number;\n}\n\nconst DEFAULTS = { slowMs: 500, nPlusOne: 10 } as const;\n\nlet config: Resolved | undefined;\nconst listeners = new Set<(event: QueryEvent) => void>();\nconst enableHooks: (() => void)[] = [];\n\n/** Called by ignite() during Pre-Flight, next to configureLogger(). */\nexport function configureQueryLog(logging: LoggingConfig | false | undefined): void {\n const q = logging === false ? undefined : logging?.queries;\n config = !q\n ? undefined\n : q === true\n ? { all: true, ...DEFAULTS, metricsLimit: 0 }\n : {\n all: q.all ?? false,\n slowMs: q.slowMs ?? DEFAULTS.slowMs,\n nPlusOne: q.nPlusOne ?? DEFAULTS.nPlusOne,\n metricsLimit: !q.metrics\n ? 0\n : typeof q.metrics === 'object'\n ? (q.metrics.maxEntries ?? 1000)\n : 1000,\n };\n if (config && (!Number.isSafeInteger(config.metricsLimit) || config.metricsLimit < 0)) {\n config = undefined;\n resetQueryMetrics();\n throw new Error('[EFC] logging.queries.metrics.maxEntries must be a nonnegative safe integer');\n }\n resetQueryMetrics();\n if (config) for (const hook of enableHooks) hook();\n}\n\nfunction active(): boolean {\n return config !== undefined || listeners.size > 0;\n}\n\n/**\n * Receives every model operation while subscribed (whether or not `logging.queries` is\n * on). Returns the unsubscribe function. Internal — tests use it to count statements.\n */\nexport function onQuery(listener: (event: QueryEvent) => void): () => void {\n listeners.add(listener);\n for (const hook of enableHooks) hook();\n return () => listeners.delete(listener);\n}\n\n/** Registers a driver hook to install once query tracking is first needed. */\nexport function whenQueryTracking(install: () => void): void {\n enableHooks.push(install);\n if (active()) install();\n}\n\ninterface Frame {\n statements: number;\n parent: Frame | undefined;\n}\n\nconst frames = new AsyncLocalStorage<Frame | undefined>();\n\n/** Called by the driver hooks for each statement sent to the database. */\nexport function countStatement(): void {\n for (let f = frames.getStore(); f; f = f.parent) f.statements++;\n}\n\n/** Runs `fn` outside any operation, so its statements (e.g. auto-sync) are not counted. */\nexport function untracked<R>(fn: () => R): R {\n return frames.run(undefined, fn);\n}\n\n// The first stack frame outside EFC: the line in the app that made the call.\nfunction callSite(callee: (...args: never[]) => unknown): string | undefined {\n const holder: { stack?: string } = {};\n Error.captureStackTrace(holder, callee);\n const line = holder.stack?.split('\\n')[1];\n return line?.trim().replace(/^at /, '');\n}\n\nfunction emit(event: QueryEvent, site: string | undefined, top: boolean): void {\n for (const listener of listeners) listener(event);\n if (!config) return;\n collectMetric(event);\n const log = getLogger();\n const msg = `${event.model}.${event.op} ${event.durationMs}ms`;\n // The request's logger already carries reqId.\n const fields: Partial<QueryEvent> = { ...event };\n delete fields.reqId;\n if (event.durationMs >= config.slowMs) {\n log.warn({ ...fields, slow: true }, `Slow query: ${msg}`);\n } else if (config.all) {\n log.info(fields, msg);\n }\n if (top && config.nPlusOne !== false) detectNPlusOne(event, site, config.nPlusOne);\n}\n\nfunction detectNPlusOne(event: QueryEvent, site: string | undefined, threshold: number): void {\n const ctx = getRequestContext();\n if (!ctx) return;\n const key = `${event.model}.${event.op}`;\n const counts = (ctx.queryCounts ??= new Map());\n const n = (counts.get(key) ?? 0) + 1;\n counts.set(key, n);\n if (n !== threshold) return;\n getLogger().warn(\n { model: event.model, op: event.op, count: n, ...(site !== undefined && { site }) },\n `Possible N+1: ${key} ran ${n} times in one request — load them in one query instead`,\n );\n}\n\n/**\n * Wraps a model's public operations so each call is timed, its statements counted and\n * the result reported. A no-op wrapper while query logging is off.\n */\nexport function traceOps<M extends object>(model: string, target: M, ops: readonly string[]): M {\n const t = target as Record<string, unknown>;\n for (const op of ops) {\n const fn = t[op] as (...args: unknown[]) => Promise<unknown>;\n const traced = function (this: unknown, ...args: unknown[]): Promise<unknown> {\n if (!active()) return fn.apply(this, args);\n const parent = frames.getStore();\n const frame: Frame = { statements: 0, parent };\n // Only N+1 checks need the call site; capture it while the caller is on the stack.\n const site = !parent && config && config.nPlusOne !== false ? callSite(traced) : undefined;\n const start = process.hrtime.bigint();\n const finish = (error?: unknown) => {\n const durationMs = Math.round(Number(process.hrtime.bigint() - start) / 1e5) / 10;\n const reqId = getRequestContext()?.requestId;\n emit(\n {\n model,\n op,\n durationMs,\n statements: frame.statements,\n ...(reqId !== undefined && { reqId }),\n ...(error !== undefined && { error: (error as Error)?.message ?? String(error) }),\n },\n site,\n !parent,\n );\n };\n return frames\n .run(frame, () => fn.apply(this, args))\n .then(\n (result) => {\n finish();\n return result;\n },\n (err: unknown) => {\n finish(err);\n throw err;\n },\n );\n };\n t[op] = traced;\n }\n return target;\n}\n","import { createHash } from 'node:crypto';\nimport type { Pool, PoolClient } from 'pg';\n\nconst invalidators = new WeakMap<Pool, () => void>();\n\n/** Clear reusable shapes after EFC changes a table; existing server names stay bounded. */\nexport function invalidatePreparedStatements(pool: Pool): void {\n invalidators.get(pool)?.();\n}\n\n/**\n * Private Drizzle driver view. The exported native Pool is unchanged. Each real\n * connection owns its names, including connections checked out for transactions.\n * Once its lifetime budget is full, new shapes use the ordinary unnamed protocol.\n */\nexport function preparedDriver(pool: Pool, max: number): Pool {\n if (!Number.isSafeInteger(max) || max < 0) {\n throw new Error('[EFC] databasePool.preparedStatements.max must be a nonnegative safe integer');\n }\n if (max === 0) return pool;\n let generation = 0;\n invalidators.set(pool, () => {\n generation++;\n });\n const clients = new WeakMap<PoolClient, PoolClient>();\n const wrap = (client: PoolClient): PoolClient => {\n const existing = clients.get(client);\n if (existing) return existing;\n let allocated = 0;\n let seenGeneration = generation;\n const names = new Map<string, string>();\n const proxy = new Proxy(client, {\n get(target, prop) {\n if (prop === 'query')\n return (...args: unknown[]) => {\n if (seenGeneration !== generation) {\n names.clear();\n seenGeneration = generation;\n }\n const query = args[0];\n if (query && typeof query === 'object' && 'text' in query) {\n const config = query as Record<string, unknown>;\n const text = config.text;\n // No DDL, transaction control, multi-statements, or caller-named queries.\n if (\n !config.name &&\n typeof text === 'string' &&\n /^\\s*(select|insert|update|delete|with)\\b/i.test(text) &&\n !text.trim().replace(/;$/, '').includes(';')\n ) {\n let name = names.get(text);\n if (!name && allocated < max) {\n name =\n 'efc_auto_' +\n createHash('sha256')\n .update(generation + ':' + text)\n .digest('hex')\n .slice(0, 48);\n names.set(text, name);\n allocated++;\n }\n if (name) args[0] = { ...config, name };\n }\n }\n return Reflect.apply(target.query, target, args);\n };\n const value = Reflect.get(target, prop, target) as unknown;\n return typeof value === 'function' ? value.bind(target) : value;\n },\n });\n clients.set(client, proxy);\n return proxy;\n };\n return new Proxy(pool, {\n get(target, prop) {\n if (prop === 'connect') return async () => wrap(await target.connect());\n if (prop === 'query')\n return async (...args: unknown[]) => {\n const client = await target.connect();\n // Match Pool.query's connection-error ownership while checked out: do\n // not leave a network error unhandled, and discard failed connections.\n let failure: Error | undefined;\n const onError = (err: Error) => {\n failure = err;\n };\n client.once('error', onError);\n try {\n return await Reflect.apply(wrap(client).query, wrap(client), args);\n } catch (err) {\n failure = err instanceof Error ? err : new Error(String(err));\n throw err;\n } finally {\n client.removeListener('error', onError);\n client.release(failure);\n }\n };\n const value = Reflect.get(target, prop, target) as unknown;\n return typeof value === 'function' ? value.bind(target) : value;\n },\n });\n}\n","import type { Pool } from 'pg';\nimport { getLogger } from '../logger.js';\nimport { countStatement } from './query-log.js';\nimport type { DatabasePoolConfig } from '../types.js';\nimport { preparedDriver } from './prepared-statements.js';\n\n// Pre-Flight's PostgreSQL connection: a node-postgres Pool (exposed as `db`) plus a\n// Drizzle instance over it that the model adapter queries through.\n\n/* eslint-disable @typescript-eslint/no-explicit-any -- drizzle is an optional peer, loaded dynamically */\nlet pool: Pool | undefined;\n\n/** Only a genuinely missing package becomes \"not installed\"; other load errors surface as-is. */\nexport function notInstalled(err: unknown, pkg: string, install: string): Error {\n const code = (err as { code?: string }).code;\n return code === 'ERR_MODULE_NOT_FOUND' || code === 'MODULE_NOT_FOUND'\n ? new Error(`[EFC] ${pkg} is not installed. Run: ${install}`)\n : (err as Error);\n}\nlet orm: any;\n\nexport async function connectPostgres(\n url: string,\n poolConfig: DatabasePoolConfig = {},\n): Promise<Pool> {\n let PoolCtor: typeof Pool;\n try {\n const pg = (await import('pg')) as unknown as {\n default?: { Pool: typeof Pool };\n Pool?: typeof Pool;\n };\n PoolCtor = (pg.default?.Pool ?? pg.Pool)!;\n } catch (err) {\n throw notInstalled(err, 'pg', 'npm install pg drizzle-orm');\n }\n let drizzle: (client: Pool, config: object) => unknown;\n try {\n ({ drizzle } = (await import('drizzle-orm/node-postgres')) as unknown as {\n drizzle: (client: Pool, config: object) => unknown;\n });\n } catch (err) {\n throw notInstalled(err, 'drizzle-orm', 'npm install drizzle-orm');\n }\n\n const next = new PoolCtor({\n connectionString: url,\n ...(poolConfig.max !== undefined && { max: poolConfig.max }),\n ...(poolConfig.idleTimeoutMs !== undefined && { idleTimeoutMillis: poolConfig.idleTimeoutMs }),\n ...(poolConfig.connectionTimeoutMs !== undefined && {\n connectionTimeoutMillis: poolConfig.connectionTimeoutMs,\n }),\n });\n const prepared = poolConfig.preparedStatements;\n const maxStatements =\n prepared === false ? 0 : typeof prepared === 'object' ? (prepared.max ?? 100) : 100;\n let driver: Pool;\n try {\n driver = preparedDriver(next, maxStatements);\n } catch (err) {\n await next.end();\n throw err;\n }\n // Idle-client errors (e.g. the server restarting) are emitted on the pool; unhandled\n // they would crash the process.\n next.on('error', (err) => getLogger().error({ err }, 'PostgreSQL pool error'));\n try {\n await next.query('select 1');\n } catch (err) {\n await next.end().catch(() => {});\n throw explainPostgresError(err, url);\n }\n pool = next;\n // Every model statement goes through Drizzle, in or out of a transaction: count it.\n orm = drizzle(driver, { logger: { logQuery: countStatement } });\n getLogger().info('PostgreSQL connected');\n return next;\n}\n\n/** Where a connection string points, without the password (for error messages). */\nfunction describeUrl(url: string): { where: string; user: string; database: string } {\n try {\n const u = new URL(url);\n const database = decodeURIComponent(u.pathname.slice(1)) || '(default)';\n return {\n where: `${u.hostname || 'localhost'}:${u.port || '5432'}`,\n user: decodeURIComponent(u.username) || '(none)',\n database,\n };\n } catch {\n return { where: '(unparsable DATABASE_URL)', user: '?', database: '?' };\n }\n}\n\n/**\n * node-postgres' connection errors, said in terms of DATABASE_URL — e.g. a URL with no password\n * surfaces from pg as \"SASL: SCRAM-SERVER-FIRST-MESSAGE: client password must be a string\".\n * Unrecognised errors come back unchanged. The original is kept as `cause`.\n */\nexport function explainPostgresError(err: unknown, url: string): Error {\n const e = err as { code?: string; message?: string };\n const msg = e.message ?? '';\n const { where, user, database } = describeUrl(url);\n const hosted = 'For Neon, Supabase or RDS, copy the full connection string from the dashboard.';\n let text: string | undefined;\n if (/client password must be a string/.test(msg)) {\n text = `PostgreSQL asked for a password and DATABASE_URL has none (user \"${user}\" at ${where}). Put it in the URL: postgres://${user === '(none)' ? 'user' : user}:<password>@${where}/${database === '(default)' ? 'db' : database}. ${hosted}`;\n } else if (e.code === '28P01') {\n text = `PostgreSQL rejected the password for user \"${user}\" at ${where}. Check DATABASE_URL (special characters in the password must be URL-encoded). ${hosted}`;\n } else if (e.code === '28000' && /role .* does not exist/.test(msg)) {\n text = `PostgreSQL has no user \"${user}\" at ${where}. Create it (CREATE ROLE ${user} LOGIN PASSWORD '…';) or fix the user in DATABASE_URL.`;\n } else if (/no pg_hba\\.conf entry.*no encryption/.test(msg)) {\n text = `PostgreSQL at ${where} only accepts encrypted connections. Add ?sslmode=require to DATABASE_URL.`;\n } else if (e.code === '28000') {\n text = `PostgreSQL at ${where} refused user \"${user}\": ${msg}`;\n } else if (e.code === '3D000') {\n text = `Database \"${database}\" does not exist at ${where}. Create it first: createdb ${database} (or CREATE DATABASE \"${database}\";).`;\n } else if (/does not support SSL/.test(msg)) {\n text = `PostgreSQL at ${where} doesn't support SSL. Remove sslmode / ssl from DATABASE_URL (local servers usually run without it).`;\n } else if (e.code === 'ECONNREFUSED') {\n text = `Nothing is accepting connections at ${where}. Is PostgreSQL running, and is the host/port in DATABASE_URL right?`;\n } else if (e.code === 'ENOTFOUND' || e.code === 'EAI_AGAIN') {\n text = `Can't resolve the PostgreSQL host in DATABASE_URL (${where}). Check the hostname.`;\n } else if (e.code === 'ETIMEDOUT' || /timeout/i.test(msg)) {\n text = `Timed out connecting to PostgreSQL at ${where}. Check the host, and that a firewall / the provider's IP allow-list lets this machine in.`;\n }\n return text ? new Error(`[EFC] ${text}`, { cause: err }) : (err as Error);\n}\n\n/**\n * Every cluster worker opens its own pools, so a machine's total is `workers × (pool + …)`.\n * Logs that total against the server's limit, warning when this machine alone can exhaust it.\n * Best effort: a failure to read the limit is ignored.\n */\nexport async function checkConnectionBudget(perMachine: number, breakdown: string): Promise<void> {\n const log = getLogger();\n try {\n const { rows } = await getPool().query<{ max: number; reserved: number }>(\n `select current_setting('max_connections')::int as max,\n current_setting('superuser_reserved_connections')::int as reserved`,\n );\n const { max, reserved } = rows[0]!;\n const usable = max - reserved;\n if (perMachine > usable) {\n log.warn(\n `[EFC] PostgreSQL connections: up to ${perMachine} from this machine (${breakdown}), but the server allows ${usable} (max_connections ${max} − ${reserved} reserved). Under load, queries will fail with \"too many clients\". Lower databasePool.max or workers, or put PgBouncer in front.`,\n );\n } else {\n log.info(\n `PostgreSQL connections: up to ${perMachine} from this machine (${breakdown}) of ${usable} allowed — multiply by your instance count if you run several`,\n );\n }\n } catch {\n /* can't read the limit (permissions, pooler) — nothing to compare against */\n }\n}\n\nexport function getOrm(): any {\n if (!orm) {\n throw new Error(\n '[EFC] PostgreSQL not connected — set database/databaseUrl in ignite() (or call connectPostgres)',\n );\n }\n return orm;\n}\n\nexport function getPool(): Pool {\n if (!pool) throw new Error('[EFC] PostgreSQL not connected');\n return pool;\n}\n\nexport async function closePostgres(): Promise<void> {\n const p = pool;\n pool = undefined;\n orm = undefined;\n await p?.end();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