@nextage/era-lib 1.0.164 → 1.0.165

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/README.md ADDED
@@ -0,0 +1,83 @@
1
+ # @nextage/era-lib
2
+
3
+ Libreria backend condivisa del progetto **ERA**. Fornisce eventi, modelli, servizi,
4
+ utility e l'orchestratore di bootstrap dei servizi, costruita sopra
5
+ [`@nextage/nx-frame-be`](https://www.npmjs.com/package/@nextage/nx-frame-be).
6
+
7
+ È consumata dai microservizi Node del backend (`auth-srv`, `app-srv`, ...) tramite il
8
+ registry npm privato Nextage: `"@nextage/era-lib": "^1.0.x"`.
9
+
10
+ ## Contenuto
11
+
12
+ | Area | Cosa | Path |
13
+ | -- | -- | -- |
14
+ | **utils** | `initConfig`, `readEnv`, `startService`, `createHealthRouter`, helper express | `src/utils` |
15
+ | **events** | `BaseEventCtrl`, publisher/listener NATS + in-memory, entità di dominio | `src/events` |
16
+ | **services** | `Password` (hash/verify), ... | `src/services` |
17
+ | **routes** | validator/formatErrors REST | `src/routes` |
18
+ | **constants / enums / interfaces / types** | costanti e tipi condivisi | `src/*` |
19
+
20
+ ## Bootstrap dei servizi — `startService()`
21
+
22
+ Orchestratore di avvio deterministico (ADR-0001). Esegue le fasi in ordine, con
23
+ **fail-fast** e **readiness gate**, al posto del vecchio avvio su `setTimeout`.
24
+
25
+ ```ts
26
+ import { startService, createHealthRouter } from '@nextage/era-lib';
27
+ import { APP } from './core/config/app.config';
28
+
29
+ await startService({
30
+ app : APP,
31
+ phases: [
32
+ { label: 'database', run: () => initDB() },
33
+ { label: 'messaging', run: () => initMessages() },
34
+ { label: 'http wiring', run: () => initHttp() }, // express/routes, NO listen
35
+ { label: 'modules', run: () => loadModules() }, // registra listener/schema
36
+ { label: 'listen', run: () => startServer() } // createServer + apollo + listen
37
+ ],
38
+ shutdown: [
39
+ () => apollo.stop(),
40
+ () => natsWrapper.close(),
41
+ () => APP.mongoose?.disconnect()
42
+ ]
43
+ });
44
+ ```
45
+
46
+ - `APP.status` passa a `OK` **solo dopo** che tutte le fasi si sono concluse.
47
+ - `createHealthRouter(APP)` espone `GET /healthz` (liveness) e `GET /readyz`
48
+ (readiness = `APP.status === OK`). Montare **prima** del middleware JWT.
49
+
50
+ ## Sviluppo
51
+
52
+ ```bash
53
+ npm install
54
+ npm run build # clean + tsc → build/
55
+ npm test # vitest run
56
+ npm run test:watch # vitest (watch)
57
+ ```
58
+
59
+ Test framework: **Vitest** (standard di progetto). Gli spec vivono accanto al codice come
60
+ `*.spec.ts` / `*.test.ts` e sono esclusi dalla build (`tsconfig.json`).
61
+
62
+ ## Pubblicare / aggiornare la libreria
63
+
64
+ La procedura completa (con la distinzione **chi fa cosa**) è documentata in
65
+ [docs/architecture/era-lib.md](../../docs/architecture/era-lib.md).
66
+
67
+ In sintesi:
68
+
69
+ 1. Aggiorna il codice e **aggiorna `CHANGELOG.md`**.
70
+ 2. Commit del codice (l'albero git deve essere pulito: `npm version` lo richiede).
71
+ 3. Bump di versione + tag: `npm run release:patch` (o `release:minor` / `release:major`).
72
+ 4. Pubblica: `npm run pub` (esegue build e `npm publish`; `prepublishOnly` garantisce
73
+ comunque la build).
74
+ 5. Aggiorna la dipendenza nei servizi consumatori e reinstalla.
75
+
76
+ > ⚠️ Il `npm publish` è un'azione condivisa e non annullabile (richiede autenticazione al
77
+ > registry). Vedi il documento sopra per la regola operativa concordata.
78
+
79
+ ## Convenzioni di codice
80
+
81
+ Vedi le convenzioni backend TypeScript del progetto: formattazione a colonne allineate,
82
+ naming `kebab.concern`, layering interfaces → model → controller → graphql, comunicazione
83
+ via eventi.
@@ -1,6 +1,6 @@
1
1
  export declare const msgWrapper: {
2
2
  client: {
3
- publish: jest.Mock<any, any, any>;
3
+ publish: import("vitest").Mock<(...args: any[]) => any>;
4
4
  };
5
5
  };
6
6
  //# sourceMappingURL=msg-wrapper.d.ts.map
@@ -1,9 +1,10 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.msgWrapper = void 0;
4
+ const vitest_1 = require("vitest");
4
5
  exports.msgWrapper = {
5
6
  client: {
6
- publish: jest.fn().mockImplementation((subject, data, options) => {
7
+ publish: vitest_1.vi.fn().mockImplementation((subject, data, options) => {
7
8
  })
8
9
  // publish: (subject: string, data: string, callback: () => void) => {
9
10
  // callback();
@@ -1 +1 @@
1
- {"version":3,"file":"msg-wrapper.js","sourceRoot":"","sources":["../../../src/events/__mocks__/msg-wrapper.ts"],"names":[],"mappings":";;;AAGa,QAAA,UAAU,GAAG;IAExB,MAAM,EAAE;QAEN,OAAO,EAAE,IAAI,CAAC,EAAE,EAAE,CAAC,kBAAkB,CACnC,CAAC,OAAe,EAAE,IAAY,EAAE,OAAkB,EAAE,EAAE;QAEtD,CAAC,CACF;QACD,sEAAsE;QACtE,gBAAgB;QAChB,KAAK;KAEN;CACF,CAAC"}
1
+ {"version":3,"file":"msg-wrapper.js","sourceRoot":"","sources":["../../../src/events/__mocks__/msg-wrapper.ts"],"names":[],"mappings":";;;AAAA,mCAAiC;AAGpB,QAAA,UAAU,GAAG;IAExB,MAAM,EAAE;QAEN,OAAO,EAAE,WAAE,CAAC,EAAE,EAAE,CAAC,kBAAkB,CACjC,CAAC,OAAe,EAAE,IAAY,EAAE,OAAkB,EAAE,EAAE;QAEtD,CAAC,CACF;QACD,sEAAsE;QACtE,gBAAgB;QAChB,KAAK;KAEN;CACF,CAAC"}
@@ -1,6 +1,6 @@
1
1
  export declare const natsWrapper: {
2
2
  client: {
3
- publish: jest.Mock<any, any, any>;
3
+ publish: import("vitest").Mock<(...args: any[]) => any>;
4
4
  };
5
5
  };
6
6
  //# sourceMappingURL=nats-wrapper.d.ts.map
@@ -1,9 +1,10 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.natsWrapper = void 0;
4
+ const vitest_1 = require("vitest");
4
5
  exports.natsWrapper = {
5
6
  client: {
6
- publish: jest.fn().mockImplementation((subject, payload, options) => {
7
+ publish: vitest_1.vi.fn().mockImplementation((subject, payload, options) => {
7
8
  })
8
9
  // publish: (subject: string, data: string, callback: () => void) => {
9
10
  // callback();
@@ -1 +1 @@
1
- {"version":3,"file":"nats-wrapper.js","sourceRoot":"","sources":["../../../src/events/__mocks__/nats-wrapper.ts"],"names":[],"mappings":";;;AAGa,QAAA,WAAW,GAAG;IAEzB,MAAM,EAAE;QAEN,OAAO,EAAE,IAAI,CAAC,EAAE,EAAE,CAAC,kBAAkB,CACnC,CAAC,OAAe,EAAE,OAAe,EAAE,OAAkB,EAAE,EAAE;QAEzD,CAAC,CACF;QACD,sEAAsE;QACtE,gBAAgB;QAChB,KAAK;KAEN;CACF,CAAC"}
1
+ {"version":3,"file":"nats-wrapper.js","sourceRoot":"","sources":["../../../src/events/__mocks__/nats-wrapper.ts"],"names":[],"mappings":";;;AAAA,mCAAiC;AAGpB,QAAA,WAAW,GAAG;IAEzB,MAAM,EAAE;QAEN,OAAO,EAAE,WAAE,CAAC,EAAE,EAAE,CAAC,kBAAkB,CACjC,CAAC,OAAe,EAAE,OAAe,EAAE,OAAkB,EAAE,EAAE;QAEzD,CAAC,CACF;QACD,sEAAsE;QACtE,gBAAgB;QAChB,KAAK;KAEN;CACF,CAAC"}
@@ -1,3 +1,4 @@
1
1
  export * from './express';
2
2
  export * from './functs';
3
+ export * from './start-service';
3
4
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":"AAAA,cAAc,WAAW,CAAC;AAC1B,cAAc,UAAU,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":"AAAA,cAAc,WAAW,CAAC;AAC1B,cAAc,UAAU,CAAC;AACzB,cAAc,iBAAiB,CAAC"}
@@ -16,4 +16,5 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
17
  __exportStar(require("./express"), exports);
18
18
  __exportStar(require("./functs"), exports);
19
+ __exportStar(require("./start-service"), exports);
19
20
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,4CAA0B;AAC1B,2CAAyB"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,4CAA0B;AAC1B,2CAAyB;AACzB,kDAAgC"}
@@ -0,0 +1,55 @@
1
+ import { Router } from 'express';
2
+ import { AppData } from '@nextage/nx-frame-be';
3
+ /**
4
+ * A single ordered startup phase.
5
+ */
6
+ export interface BootstrapPhase {
7
+ label: string;
8
+ run: () => Promise<void> | void;
9
+ }
10
+ /**
11
+ * A graceful-shutdown handler (invoked on SIGTERM/SIGINT/... in reverse order).
12
+ */
13
+ export type ShutdownHandler = () => Promise<void> | void;
14
+ /**
15
+ * Parameters for {@link startService}.
16
+ */
17
+ export interface StartServiceParams {
18
+ /** Shared application singleton (APP). */
19
+ app: AppData;
20
+ /** Ordered phases; executed sequentially, each awaited before the next. */
21
+ phases: BootstrapPhase[];
22
+ /** Optional graceful-shutdown handlers (registered on the ShutdownManager). */
23
+ shutdown?: ShutdownHandler[];
24
+ /** Abort the process on the first failing phase. Default: `true`. */
25
+ failFast?: boolean;
26
+ /**
27
+ * Called on a fail-fast abort to terminate the process. Injectable for tests;
28
+ * defaults to `process.exit`.
29
+ */
30
+ onFatal?: (code: number) => never;
31
+ }
32
+ /**
33
+ * Orchestrates a service startup as an ordered, fail-fast phase sequence.
34
+ *
35
+ * The server should perform its `listen()` inside the LAST phase; `startService`
36
+ * flips `APP.status` to `AppStatus.OK` only after ALL phases have resolved, so
37
+ * `/readyz` (see {@link createHealthRouter}) reports "ready" only once the whole
38
+ * bootstrap has completed.
39
+ *
40
+ * @param params - see {@link StartServiceParams}
41
+ */
42
+ export declare function startService(params: StartServiceParams): Promise<void>;
43
+ /**
44
+ * Builds an Express router exposing liveness/readiness probes.
45
+ *
46
+ * - `GET /healthz` → 200 as long as the process is up (liveness)
47
+ * - `GET /readyz` → 200 only when `APP.status === OK`, else 503 (readiness)
48
+ *
49
+ * Mount BEFORE the JWT/auth middleware so probes stay unauthenticated.
50
+ *
51
+ * @param app - shared application singleton (APP)
52
+ * @param extra - optional async readiness check (e.g. db/nats connectivity)
53
+ */
54
+ export declare function createHealthRouter(app: AppData, extra?: () => Promise<boolean> | boolean): Router;
55
+ //# sourceMappingURL=start-service.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"start-service.d.ts","sourceRoot":"","sources":["../../src/utils/start-service.ts"],"names":[],"mappings":"AAeA,OAAO,EAAE,MAAM,EAAE,MAAyB,SAAS,CAAC;AACpD,OAAO,EAAE,OAAO,EAAa,MAAa,sBAAsB,CAAC;AAEjE;;GAEG;AACH,MAAM,WAAW,cAAc;IAC7B,KAAK,EAAG,MAAM,CAAC;IACf,GAAG,EAAK,MAAM,OAAO,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC;CACpC;AAED;;GAEG;AACH,MAAM,MAAM,eAAe,GAAG,MAAM,OAAO,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC;AAEzD;;GAEG;AACH,MAAM,WAAW,kBAAkB;IACjC,0CAA0C;IAC1C,GAAG,EAAS,OAAO,CAAC;IACpB,2EAA2E;IAC3E,MAAM,EAAM,cAAc,EAAE,CAAC;IAC7B,+EAA+E;IAC/E,QAAQ,CAAC,EAAG,eAAe,EAAE,CAAC;IAC9B,qEAAqE;IACrE,QAAQ,CAAC,EAAG,OAAO,CAAC;IACpB;;;OAGG;IACH,OAAO,CAAC,EAAI,CAAC,IAAI,EAAE,MAAM,KAAK,KAAK,CAAC;CACrC;AAED;;;;;;;;;GASG;AACH,wBAAsB,YAAY,CAAC,MAAM,EAAE,kBAAkB,GAAG,OAAO,CAAC,IAAI,CAAC,CA2C5E;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,kBAAkB,CAAC,GAAG,EAAE,OAAO,EAAE,KAAK,CAAC,EAAE,MAAM,OAAO,CAAC,OAAO,CAAC,GAAG,OAAO,GAAG,MAAM,CAsBjG"}
@@ -0,0 +1,148 @@
1
+ "use strict";
2
+ /*───────────────────────────────────────────────────────────────────────────*\
3
+ start-service — service bootstrap orchestrator (ADR-0001)
4
+
5
+ Runs the service startup as an ORDERED, AWAITED sequence of phases instead of
6
+ the previous timer-based (`setTimeout`) approach. Guarantees:
7
+
8
+ - deterministic ordering (no race between module loading and server listen)
9
+ - fail-fast: a throwing phase aborts startup with a non-zero exit code
10
+ - readiness gate: APP.status flips to OK only after every phase completed
11
+ - graceful shutdown handlers registered on the shared ShutdownManager
12
+
13
+ Transport-agnostic: each service composes its own phases (db, messaging, http
14
+ wiring, module loading, listen). See docs/architecture/adr/0001-*.
15
+ \*───────────────────────────────────────────────────────────────────────────*/
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ exports.startService = startService;
18
+ exports.createHealthRouter = createHealthRouter;
19
+ const express_1 = require("express");
20
+ const nx_frame_be_1 = require("@nextage/nx-frame-be");
21
+ /**
22
+ * Orchestrates a service startup as an ordered, fail-fast phase sequence.
23
+ *
24
+ * The server should perform its `listen()` inside the LAST phase; `startService`
25
+ * flips `APP.status` to `AppStatus.OK` only after ALL phases have resolved, so
26
+ * `/readyz` (see {@link createHealthRouter}) reports "ready" only once the whole
27
+ * bootstrap has completed.
28
+ *
29
+ * @param params - see {@link StartServiceParams}
30
+ */
31
+ async function startService(params) {
32
+ const { app, phases } = params;
33
+ const failFast = params.failFast ?? true;
34
+ const logger = app.logger ?? console;
35
+ const onFatal = params.onFatal ?? ((code) => process.exit(code));
36
+ app.status = nx_frame_be_1.AppStatus.INIT;
37
+ logger.info(`⏳ [${app.appName}] starting service (${phases.length} phases)`);
38
+ for (let i = 0; i < phases.length; i++) {
39
+ const phase = phases[i];
40
+ const step = `${i + 1}/${phases.length}`;
41
+ try {
42
+ logger.info(`▶ [${app.appName}] (${step}) ${phase.label}`);
43
+ await phase.run();
44
+ }
45
+ catch (err) {
46
+ logger.error(`✖ [${app.appName}] (${step}) ${phase.label} failed: ${errMessage(err)}`);
47
+ if (failFast) {
48
+ await runShutdown(params.shutdown, logger);
49
+ // Non-zero exit → the orchestrator (ECS/compose) restarts the service.
50
+ onFatal(1);
51
+ return;
52
+ }
53
+ throw err;
54
+ }
55
+ }
56
+ // Register graceful-shutdown handlers AFTER a successful startup.
57
+ registerShutdown(app, params.shutdown, logger);
58
+ app.status = nx_frame_be_1.AppStatus.OK;
59
+ logger.info(`✅ [${app.appName}] service ready`);
60
+ }
61
+ /**
62
+ * Builds an Express router exposing liveness/readiness probes.
63
+ *
64
+ * - `GET /healthz` → 200 as long as the process is up (liveness)
65
+ * - `GET /readyz` → 200 only when `APP.status === OK`, else 503 (readiness)
66
+ *
67
+ * Mount BEFORE the JWT/auth middleware so probes stay unauthenticated.
68
+ *
69
+ * @param app - shared application singleton (APP)
70
+ * @param extra - optional async readiness check (e.g. db/nats connectivity)
71
+ */
72
+ function createHealthRouter(app, extra) {
73
+ const router = (0, express_1.Router)();
74
+ router.get('/healthz', (_req, res) => {
75
+ res.status(200).json({ status: 'up', service: app.appName });
76
+ });
77
+ router.get('/readyz', async (_req, res) => {
78
+ const statusReady = app.status === nx_frame_be_1.AppStatus.OK;
79
+ const extraReady = extra ? await safeCheck(extra) : true;
80
+ const ready = statusReady && extraReady;
81
+ res.status(ready ? 200 : 503).json({
82
+ status: ready ? 'ready' : 'not-ready',
83
+ service: app.appName
84
+ });
85
+ });
86
+ return router;
87
+ }
88
+ /*── internals ───────────────────────────────────────────────────────────────*/
89
+ /**
90
+ * Registers shutdown handlers on the shared ShutdownManager (reverse order so
91
+ * resources are torn down opposite to how they were created).
92
+ */
93
+ function registerShutdown(app, handlers, logger) {
94
+ if (!handlers?.length || !app.shutdownMng)
95
+ return;
96
+ for (const handler of [...handlers].reverse()) {
97
+ app.shutdownMng.addShutdownHandler(async () => {
98
+ try {
99
+ await handler();
100
+ }
101
+ catch (err) {
102
+ logger.error(`✖ [${app.appName}] shutdown handler failed: ${errMessage(err)}`);
103
+ }
104
+ });
105
+ }
106
+ }
107
+ /**
108
+ * Runs shutdown handlers inline (used on fail-fast, before the manager exists).
109
+ */
110
+ async function runShutdown(handlers, logger) {
111
+ if (!handlers?.length)
112
+ return;
113
+ for (const handler of [...handlers].reverse()) {
114
+ try {
115
+ await handler();
116
+ }
117
+ catch (err) {
118
+ logger.error(`✖ shutdown handler failed during fail-fast: ${errMessage(err)}`);
119
+ }
120
+ }
121
+ }
122
+ /**
123
+ * Runs a readiness check, swallowing errors as "not ready".
124
+ */
125
+ async function safeCheck(check) {
126
+ try {
127
+ return await check();
128
+ }
129
+ catch {
130
+ return false;
131
+ }
132
+ }
133
+ /**
134
+ * Normalises an unknown thrown value into a readable message.
135
+ */
136
+ function errMessage(err) {
137
+ if (err instanceof Error)
138
+ return err.stack ?? err.message;
139
+ if (typeof err === 'string')
140
+ return err;
141
+ try {
142
+ return JSON.stringify(err);
143
+ }
144
+ catch {
145
+ return 'unknown error';
146
+ }
147
+ }
148
+ //# sourceMappingURL=start-service.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"start-service.js","sourceRoot":"","sources":["../../src/utils/start-service.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;+EAa+E;;AA+C/E,oCA2CC;AAaD,gDAsBC;AA3HD,qCAAoD;AACpD,sDAAiE;AAkCjE;;;;;;;;;GASG;AACI,KAAK,UAAU,YAAY,CAAC,MAA0B;IAE3D,MAAM,EAAE,GAAG,EAAE,MAAM,EAAE,GAAG,MAAM,CAAC;IAC/B,MAAM,QAAQ,GAAU,MAAM,CAAC,QAAQ,IAAI,IAAI,CAAC;IAChD,MAAM,MAAM,GAAY,GAAG,CAAC,MAAM,IAAI,OAAO,CAAC;IA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G,CAAC,CAAC;IAC7B,CAAC;IACD,MAAM,CAAC;QACL,OAAO,eAAe,CAAC;IACzB,CAAC;AACH,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nextage/era-lib",
3
- "version": "1.0.164",
3
+ "version": "1.0.165",
4
4
  "main": "./build/index.js",
5
5
  "types": "./build/index.d.ts",
6
6
  "files": [
@@ -9,12 +9,18 @@
9
9
  "scripts": {
10
10
  "clean": "del ./build/*",
11
11
  "build": "npm run clean && tsc",
12
- "pub": "git add . && git commit -m \"App Library updates\" && npm version patch && npm run build && npm publish"
12
+ "test": "vitest run",
13
+ "test:watch": "vitest",
14
+ "prepublishOnly": "npm run build",
15
+ "release:patch": "npm version patch -m \"era-lib v%s\"",
16
+ "release:minor": "npm version minor -m \"era-lib v%s\"",
17
+ "release:major": "npm version major -m \"era-lib v%s\"",
18
+ "pub": "npm run build && npm publish"
13
19
  },
14
20
  "keywords": [],
15
- "author": "",
21
+ "author": "Nextage",
16
22
  "license": "ISC",
17
- "description": "",
23
+ "description": "ERA shared backend library (@nextage/era-lib): events, models, services, bootstrap orchestrator and utils on top of @nextage/nx-frame-be. See README.md and CHANGELOG.md.",
18
24
  "dependencies": {
19
25
  "@nextage/nx-frame-be": "^1.0.37",
20
26
  "@types/express-jwt": "^7.4.2",
@@ -47,9 +53,8 @@
47
53
  "ws": "^8.18.0"
48
54
  },
49
55
  "devDependencies": {
50
- "@types/jest": "^30.0.0",
51
56
  "del-cli": "^6.0.0",
52
- "jest": "^30.0.5",
53
- "mongodb-memory-server": "^10.1.4"
57
+ "mongodb-memory-server": "^10.1.4",
58
+ "vitest": "^2.1.9"
54
59
  }
55
60
  }