@wisemen/app-container 6.0.2 → 6.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,3 +1,3 @@
1
- export * from './express.js';
2
- export * from './job.js';
3
- export * from './worker.js';
1
+ export * from '#lib/express/express.js';
2
+ export * from '#lib/express/job.js';
3
+ export * from '#lib/express/worker.js';
@@ -1,4 +1,4 @@
1
- export * from './express.js';
2
- export * from './job.js';
3
- export * from './worker.js';
1
+ export * from '#lib/express/express.js';
2
+ export * from '#lib/express/job.js';
3
+ export * from '#lib/express/worker.js';
4
4
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../lib/express/index.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAA;AAC5B,cAAc,UAAU,CAAA;AACxB,cAAc,aAAa,CAAA"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../lib/express/index.ts"],"names":[],"mappings":"AAAA,cAAc,yBAAyB,CAAA;AACvC,cAAc,qBAAqB,CAAA;AACnC,cAAc,wBAAwB,CAAA"}
@@ -1,5 +1,5 @@
1
1
  import type { INestApplicationContext } from '@nestjs/common';
2
- import { ExpressContainer } from './express.js';
2
+ import { ExpressContainer } from '#lib/express/express.js';
3
3
  export declare abstract class JobContainer extends ExpressContainer {
4
4
  abstract execute(nest: INestApplicationContext): Promise<void>;
5
5
  protected init(): Promise<void>;
@@ -1,4 +1,4 @@
1
- import { ExpressContainer } from './express.js';
1
+ import { ExpressContainer } from '#lib/express/express.js';
2
2
  export class JobContainer extends ExpressContainer {
3
3
  async init() {
4
4
  await super.init();
@@ -1 +1 @@
1
- {"version":3,"file":"job.js","sourceRoot":"","sources":["../../lib/express/job.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAA;AAE/C,MAAM,OAAgB,YAAa,SAAQ,gBAAgB;IAG/C,KAAK,CAAC,IAAI;QAClB,MAAM,KAAK,CAAC,IAAI,EAAE,CAAA;QAElB,MAAM,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,IAAK,CAAC,CAAA;QAE9B,MAAM,IAAI,CAAC,KAAK,EAAE,CAAA;IACpB,CAAC;CACF"}
1
+ {"version":3,"file":"job.js","sourceRoot":"","sources":["../../lib/express/job.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAA;AAE1D,MAAM,OAAgB,YAAa,SAAQ,gBAAgB;IAG/C,KAAK,CAAC,IAAI;QAClB,MAAM,KAAK,CAAC,IAAI,EAAE,CAAA;QAElB,MAAM,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,IAAK,CAAC,CAAA;QAE9B,MAAM,IAAI,CAAC,KAAK,EAAE,CAAA;IACpB,CAAC;CACF"}
@@ -1,3 +1,3 @@
1
- import { ExpressContainer } from './express.js';
1
+ import { ExpressContainer } from '#lib/express/express.js';
2
2
  export declare abstract class WorkerContainer extends ExpressContainer {
3
3
  }
@@ -1,4 +1,4 @@
1
- import { ExpressContainer } from './express.js';
1
+ import { ExpressContainer } from '#lib/express/express.js';
2
2
  export class WorkerContainer extends ExpressContainer {
3
3
  }
4
4
  //# sourceMappingURL=worker.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"worker.js","sourceRoot":"","sources":["../../lib/express/worker.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAA;AAE/C,MAAM,OAAgB,eAAgB,SAAQ,gBAAgB;CAAG"}
1
+ {"version":3,"file":"worker.js","sourceRoot":"","sources":["../../lib/express/worker.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAA;AAE1D,MAAM,OAAgB,eAAgB,SAAQ,gBAAgB;CAAG"}
@@ -1,4 +1,4 @@
1
- import { INestApplicationContext } from '@nestjs/common';
1
+ import type { INestApplicationContext } from '@nestjs/common';
2
2
  import { FastifyAdapter } from '@nestjs/platform-fastify';
3
3
  import type { RawServerDefault } from 'fastify';
4
4
  export declare abstract class FastifyContainer {
@@ -1,3 +1,3 @@
1
- export * from './fastify.js';
2
- export * from './job.js';
3
- export * from './worker.js';
1
+ export * from '#lib/fastify/fastify.js';
2
+ export * from '#lib/fastify/job.js';
3
+ export * from '#lib/fastify/worker.js';
@@ -1,4 +1,4 @@
1
- export * from './fastify.js';
2
- export * from './job.js';
3
- export * from './worker.js';
1
+ export * from '#lib/fastify/fastify.js';
2
+ export * from '#lib/fastify/job.js';
3
+ export * from '#lib/fastify/worker.js';
4
4
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../lib/fastify/index.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAA;AAC5B,cAAc,UAAU,CAAA;AACxB,cAAc,aAAa,CAAA"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../lib/fastify/index.ts"],"names":[],"mappings":"AAAA,cAAc,yBAAyB,CAAA;AACvC,cAAc,qBAAqB,CAAA;AACnC,cAAc,wBAAwB,CAAA"}
@@ -1,5 +1,5 @@
1
1
  import type { INestApplicationContext } from '@nestjs/common';
2
- import { FastifyContainer } from './fastify.js';
2
+ import { FastifyContainer } from '#lib/fastify/fastify.js';
3
3
  export declare abstract class JobContainer extends FastifyContainer {
4
4
  abstract execute(nest: INestApplicationContext): Promise<void>;
5
5
  protected init(): Promise<void>;
@@ -1,4 +1,4 @@
1
- import { FastifyContainer } from './fastify.js';
1
+ import { FastifyContainer } from '#lib/fastify/fastify.js';
2
2
  export class JobContainer extends FastifyContainer {
3
3
  async init() {
4
4
  await super.init();
@@ -1 +1 @@
1
- {"version":3,"file":"job.js","sourceRoot":"","sources":["../../lib/fastify/job.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAA;AAE/C,MAAM,OAAgB,YAAa,SAAQ,gBAAgB;IAG/C,KAAK,CAAC,IAAI;QAClB,MAAM,KAAK,CAAC,IAAI,EAAE,CAAA;QAElB,MAAM,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,IAAK,CAAC,CAAA;QAE9B,MAAM,IAAI,CAAC,KAAK,EAAE,CAAA;IACpB,CAAC;CACF"}
1
+ {"version":3,"file":"job.js","sourceRoot":"","sources":["../../lib/fastify/job.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAA;AAE1D,MAAM,OAAgB,YAAa,SAAQ,gBAAgB;IAG/C,KAAK,CAAC,IAAI;QAClB,MAAM,KAAK,CAAC,IAAI,EAAE,CAAA;QAElB,MAAM,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,IAAK,CAAC,CAAA;QAE9B,MAAM,IAAI,CAAC,KAAK,EAAE,CAAA;IACpB,CAAC;CACF"}
@@ -1,3 +1,3 @@
1
- import { FastifyContainer } from './fastify.js';
1
+ import { FastifyContainer } from '#lib/fastify/fastify.js';
2
2
  export declare abstract class WorkerContainer extends FastifyContainer {
3
3
  }
@@ -1,4 +1,4 @@
1
- import { FastifyContainer } from './fastify.js';
1
+ import { FastifyContainer } from '#lib/fastify/fastify.js';
2
2
  export class WorkerContainer extends FastifyContainer {
3
3
  }
4
4
  //# sourceMappingURL=worker.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"worker.js","sourceRoot":"","sources":["../../lib/fastify/worker.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAA;AAE/C,MAAM,OAAgB,eAAgB,SAAQ,gBAAgB;CAAG"}
1
+ {"version":3,"file":"worker.js","sourceRoot":"","sources":["../../lib/fastify/worker.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAA;AAE1D,MAAM,OAAgB,eAAgB,SAAQ,gBAAgB;CAAG"}
@@ -0,0 +1,3 @@
1
+ export * from '#lib/node/node.js';
2
+ export * from '#lib/node/job.js';
3
+ export * from '#lib/node/worker.js';
@@ -0,0 +1,4 @@
1
+ export * from '#lib/node/node.js';
2
+ export * from '#lib/node/job.js';
3
+ export * from '#lib/node/worker.js';
4
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../lib/node/index.ts"],"names":[],"mappings":"AAAA,cAAc,mBAAmB,CAAA;AACjC,cAAc,kBAAkB,CAAA;AAChC,cAAc,qBAAqB,CAAA"}
@@ -0,0 +1,6 @@
1
+ import type { INestApplicationContext } from '@nestjs/common';
2
+ import { NodeContainer } from '#lib/node/node.js';
3
+ export declare abstract class JobContainer extends NodeContainer {
4
+ abstract execute(nest: INestApplicationContext): Promise<void>;
5
+ protected init(): Promise<void>;
6
+ }
@@ -0,0 +1,9 @@
1
+ import { NodeContainer } from '#lib/node/node.js';
2
+ export class JobContainer extends NodeContainer {
3
+ async init() {
4
+ await super.init();
5
+ await this.execute(this.nest);
6
+ await this.close();
7
+ }
8
+ }
9
+ //# sourceMappingURL=job.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"job.js","sourceRoot":"","sources":["../../lib/node/job.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAA;AAEjD,MAAM,OAAgB,YAAa,SAAQ,aAAa;IAG5C,KAAK,CAAC,IAAI;QAClB,MAAM,KAAK,CAAC,IAAI,EAAE,CAAA;QAElB,MAAM,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,IAAK,CAAC,CAAA;QAE9B,MAAM,IAAI,CAAC,KAAK,EAAE,CAAA;IACpB,CAAC;CACF"}
@@ -0,0 +1,18 @@
1
+ import type { INestApplicationContext } from '@nestjs/common';
2
+ import { NodeAdapter, type NodeAdapterOptions } from '@nestjs/platform-node';
3
+ export declare abstract class NodeContainer {
4
+ private adapter?;
5
+ private state;
6
+ protected nest?: INestApplicationContext;
7
+ protected getNodeOptions(): NodeAdapterOptions;
8
+ abstract bootstrap(app: NodeAdapter): Promise<INestApplicationContext>;
9
+ constructor();
10
+ private _init;
11
+ protected init(): Promise<void>;
12
+ protected close(): Promise<void>;
13
+ private enableShutdownHooks;
14
+ private enableProbes;
15
+ private liveness;
16
+ private readiness;
17
+ private version;
18
+ }
@@ -0,0 +1,101 @@
1
+ import { NodeAdapter } from '@nestjs/platform-node';
2
+ const port = Number(process.env.PORT) || 3000;
3
+ export class NodeContainer {
4
+ adapter;
5
+ state;
6
+ nest;
7
+ getNodeOptions() {
8
+ return {};
9
+ }
10
+ constructor() {
11
+ this.state = 'starting';
12
+ this.enableShutdownHooks();
13
+ void this._init();
14
+ }
15
+ async _init() {
16
+ try {
17
+ await this.init();
18
+ }
19
+ catch (e) {
20
+ await this.close();
21
+ console.log(e);
22
+ process.exit(1);
23
+ }
24
+ }
25
+ async init() {
26
+ const adapter = new NodeAdapter(this.getNodeOptions());
27
+ this.adapter = adapter;
28
+ this.enableProbes();
29
+ this.nest = await this.bootstrap(adapter);
30
+ await this.nest.init();
31
+ await new Promise((resolve, reject) => {
32
+ const server = adapter.listen(port, '0.0.0.0', () => {
33
+ server.off('error', reject);
34
+ resolve();
35
+ });
36
+ server.once('error', reject);
37
+ });
38
+ console.log('server started');
39
+ this.state = 'ready';
40
+ }
41
+ async close() {
42
+ if (this.state === 'shutdown') {
43
+ return;
44
+ }
45
+ this.state = 'shutdown';
46
+ try {
47
+ await this.adapter?.close();
48
+ await this.nest?.close();
49
+ console.log('application closed');
50
+ }
51
+ catch (e) {
52
+ console.error('error shutting down', e);
53
+ process.exit(1);
54
+ }
55
+ }
56
+ enableShutdownHooks() {
57
+ process.on('SIGTERM', () => void this.close());
58
+ process.on('SIGINT', () => void this.close());
59
+ process.on('SIGUSR2', () => void this.close());
60
+ process.on('SIGHUP', () => void this.close());
61
+ process.on('exit', () => void this.close());
62
+ }
63
+ enableProbes() {
64
+ if (this.adapter == null)
65
+ return;
66
+ const router = this.adapter.getInstance();
67
+ router.get('/', (_, res) => {
68
+ this.version(res);
69
+ });
70
+ router.get('/health', (_, res) => {
71
+ this.liveness(res);
72
+ });
73
+ router.get('/ready', (_, res) => {
74
+ this.readiness(res);
75
+ });
76
+ }
77
+ liveness(res) {
78
+ res.writeHead(200, { 'Content-Type': 'text/plain' });
79
+ res.end('OK');
80
+ }
81
+ readiness(res) {
82
+ if (this.state === 'ready') {
83
+ res.writeHead(200, { 'Content-Type': 'text/plain' });
84
+ res.end('OK');
85
+ }
86
+ else {
87
+ res.writeHead(500, { 'Content-Type': 'text/plain' });
88
+ res.end('not OK');
89
+ }
90
+ }
91
+ version(res) {
92
+ res.writeHead(200, { 'Content-Type': 'application/json' });
93
+ res.end(JSON.stringify({
94
+ env: process.env.NODE_ENV,
95
+ commit: process.env.COMMIT,
96
+ build: process.env.BUILD_NUMBER,
97
+ version: process.env.VERSION
98
+ }));
99
+ }
100
+ }
101
+ //# sourceMappingURL=node.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"node.js","sourceRoot":"","sources":["../../lib/node/node.ts"],"names":[],"mappings":"AACA,OAAO,EACL,WAAW,EAKZ,MAAM,uBAAuB,CAAA;AAE9B,MAAM,IAAI,GAAG,MAAM,CAAC,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,IAAI,IAAI,CAAA;AAI7C,MAAM,OAAgB,aAAa;IACzB,OAAO,CAAc;IACrB,KAAK,CAAO;IAEV,IAAI,CAA0B;IAC9B,cAAc;QACtB,OAAO,EAAE,CAAA;IACX,CAAC;IAID;QACE,IAAI,CAAC,KAAK,GAAG,UAAU,CAAA;QAEvB,IAAI,CAAC,mBAAmB,EAAE,CAAA;QAE1B,KAAK,IAAI,CAAC,KAAK,EAAE,CAAA;IACnB,CAAC;IAEO,KAAK,CAAC,KAAK;QACjB,IAAI,CAAC;YACH,MAAM,IAAI,CAAC,IAAI,EAAE,CAAA;QACnB,CAAC;QAAC,OAAO,CAAC,EAAE,CAAC;YACX,MAAM,IA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AAE,EAAE;YACzD,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,CAAA;QACrB,CAAC,CAAC,CAAA;IACJ,CAAC;IAEO,QAAQ,CAAE,GAAiB;QACjC,GAAG,CAAC,SAAS,CAAC,GAAG,EAAE,EAAE,cAAc,EAAE,YAAY,EAAE,CAAC,CAAA;QACpD,GAAG,CAAC,GAAG,CAAC,IAAI,CAAC,CAAA;IACf,CAAC;IAEO,SAAS,CAAE,GAAiB;QAClC,IAAI,IAAI,CAAC,KAAK,KAAK,OAAO,EAAE,CAAC;YAC3B,GAAG,CAAC,SAAS,CAAC,GAAG,EAAE,EAAE,cAAc,EAAE,YAAY,EAAE,CAAC,CAAA;YACpD,GAAG,CAAC,GAAG,CAAC,IAAI,CAAC,CAAA;QACf,CAAC;aAAM,CAAC;YACN,GAAG,CAAC,SAAS,CAAC,GAAG,EAAE,EAAE,cAAc,EAAE,YAAY,EAAE,CAAC,CAAA;YACpD,GAAG,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAA;QACnB,CAAC;IACH,CAAC;IAEO,OAAO,CAAE,GAAiB;QAChC,GAAG,CAAC,SAAS,CAAC,GAAG,EAAE,EAAE,cAAc,EAAE,kBAAkB,EAAE,CAAC,CAAA;QAC1D,GAAG,CAAC,GAAG,CAAC,IAAI,CAAC,SAAS,CAAC;YACrB,GAAG,EAAE,OAAO,CAAC,GAAG,CAAC,QAAQ;YACzB,MAAM,EAAE,OAAO,CAAC,GAAG,CAAC,MAAM;YAC1B,KAAK,EAAE,OAAO,CAAC,GAAG,CAAC,YAAY;YAC/B,OAAO,EAAE,OAAO,CAAC,GAAG,CAAC,OAAO;SAC7B,CAAC,CAAC,CAAA;IACL,CAAC;CACF"}
@@ -0,0 +1,3 @@
1
+ import { NodeContainer } from '#lib/node/node.js';
2
+ export declare abstract class WorkerContainer extends NodeContainer {
3
+ }
@@ -0,0 +1,4 @@
1
+ import { NodeContainer } from '#lib/node/node.js';
2
+ export class WorkerContainer extends NodeContainer {
3
+ }
4
+ //# sourceMappingURL=worker.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"worker.js","sourceRoot":"","sources":["../../lib/node/worker.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAA;AAEjD,MAAM,OAAgB,eAAgB,SAAQ,aAAa;CAAG"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wisemen/app-container",
3
- "version": "6.0.2",
3
+ "version": "6.1.0",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
@@ -9,6 +9,9 @@
9
9
  "example": "examples"
10
10
  },
11
11
  "type": "module",
12
+ "imports": {
13
+ "#lib/*": "./dist/*"
14
+ },
12
15
  "exports": {
13
16
  "./express": {
14
17
  "types": "./dist/express/index.d.ts",
@@ -17,6 +20,10 @@
17
20
  "./fastify": {
18
21
  "types": "./dist/fastify/index.d.ts",
19
22
  "import": "./dist/fastify/index.js"
23
+ },
24
+ "./node": {
25
+ "types": "./dist/node/index.d.ts",
26
+ "import": "./dist/node/index.js"
20
27
  }
21
28
  },
22
29
  "files": [
@@ -27,6 +34,7 @@
27
34
  "@nestjs/common": "12.0.1",
28
35
  "@nestjs/core": "12.0.1",
29
36
  "@nestjs/platform-fastify": "12.0.1",
37
+ "@nestjs/platform-node": "12.3.2",
30
38
  "@types/express": "5.0.6",
31
39
  "@types/node": "25.3.0",
32
40
  "eslint": "10.2.1",
@@ -34,12 +42,13 @@
34
42
  "oxlint": "1.59.0",
35
43
  "oxlint-tsgolint": "0.20.0",
36
44
  "typescript": "^5.9.3",
37
- "@wisemen/eslint-config-nestjs": "1.1.1"
45
+ "@wisemen/eslint-config-nestjs": "1.1.2"
38
46
  },
39
47
  "peerDependencies": {
40
48
  "@nestjs/common": "^11.1.28 || ^12.0.0",
41
49
  "@nestjs/platform-express": "^11.1.28 || ^12.0.0",
42
50
  "@nestjs/platform-fastify": ">=11.1.28",
51
+ "@nestjs/platform-node": "^12.3.0",
43
52
  "express": "^5.2.1",
44
53
  "fastify": "^5.12.5"
45
54
  },
@@ -50,6 +59,9 @@
50
59
  "@nestjs/platform-fastify": {
51
60
  "optional": true
52
61
  },
62
+ "@nestjs/platform-node": {
63
+ "optional": true
64
+ },
53
65
  "express": {
54
66
  "optional": true
55
67
  },
@@ -1,11 +1,11 @@
1
1
  ---
2
2
  name: getting-started
3
- description: Use when bootstrapping NestJS api, worker, or job containers with Express or Fastify.
3
+ description: Use when bootstrapping NestJS api, worker, or job containers with Express, Fastify, or the Nest Node adapter.
4
4
  ---
5
5
 
6
6
  # @wisemen/app-container - Getting Started
7
7
 
8
- Extend `ExpressContainer` or `FastifyContainer` to bootstrap a Nest app with
8
+ Extend `ExpressContainer`, `FastifyContainer`, or `NodeContainer` to bootstrap a Nest app with
9
9
  built-in startup, shutdown, and probe endpoints. Use `JobContainer` for
10
10
  run-once processes and `WorkerContainer` for long-running consumers.
11
11
 
@@ -32,6 +32,8 @@ class Api extends FastifyContainer {
32
32
  const _api = new Api()
33
33
  ```
34
34
 
35
- Use `@wisemen/app-container/express` for Express-based apps. Switch to
35
+ Use `@wisemen/app-container/express` for Express-based apps, or
36
+ `@wisemen/app-container/node` with `NodeAdapter` from `@nestjs/platform-node`
37
+ (Nest 12.3+) to run on plain Node.js `http` without a framework. Switch to
36
38
  `JobContainer` when the process should execute work once and shut down after
37
39
  `execute()`.