@fluojs/runtime 1.0.0-beta.9 → 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.ko.md +35 -13
- package/README.md +35 -13
- package/dist/bootstrap.d.ts.map +1 -1
- package/dist/bootstrap.js +113 -21
- package/dist/health/diagnostics.d.ts.map +1 -1
- package/dist/health/diagnostics.js +4 -4
- package/dist/health/health.d.ts +17 -4
- package/dist/health/health.d.ts.map +1 -1
- package/dist/health/health.js +34 -11
- package/dist/http-adapter-shared.d.ts.map +1 -1
- package/dist/http-adapter-shared.js +31 -4
- package/dist/internal/core-metadata.d.ts +84 -0
- package/dist/internal/core-metadata.d.ts.map +1 -0
- package/dist/internal/core-metadata.js +83 -0
- package/dist/internal/http-runtime.d.ts +5 -0
- package/dist/internal/http-runtime.d.ts.map +1 -0
- package/dist/internal/http-runtime.js +4 -0
- package/dist/internal.d.ts +2 -1
- package/dist/internal.d.ts.map +1 -1
- package/dist/internal.js +1 -1
- package/dist/logging/logger.d.ts +30 -1
- package/dist/logging/logger.d.ts.map +1 -1
- package/dist/logging/logger.js +63 -5
- package/dist/module-graph.d.ts +1 -1
- package/dist/module-graph.d.ts.map +1 -1
- package/dist/module-graph.js +5 -5
- package/dist/tokens.d.ts +12 -0
- package/dist/tokens.d.ts.map +1 -1
- package/dist/tokens.js +11 -1
- package/dist/types.d.ts +2 -0
- package/dist/types.d.ts.map +1 -1
- package/dist/web.js +3 -3
- package/package.json +6 -6
package/dist/health/health.d.ts
CHANGED
|
@@ -28,12 +28,25 @@ export interface HealthModuleOptions {
|
|
|
28
28
|
/**
|
|
29
29
|
* Defines the readiness check type.
|
|
30
30
|
*/
|
|
31
|
-
export type ReadinessCheck = () => boolean | Promise<boolean>;
|
|
31
|
+
export type ReadinessCheck = (ctx: import('@fluojs/http').RequestContext) => boolean | Promise<boolean>;
|
|
32
32
|
/**
|
|
33
|
-
*
|
|
33
|
+
* Runtime health module facade for application module imports.
|
|
34
|
+
*/
|
|
35
|
+
export declare class HealthModule {
|
|
36
|
+
/**
|
|
37
|
+
* Creates a runtime-owned `/health` and `/ready` module.
|
|
38
|
+
*
|
|
39
|
+
* @param options Runtime health endpoint options.
|
|
40
|
+
* @returns A module class that can be imported into an application module.
|
|
41
|
+
*/
|
|
42
|
+
static forRoot(options?: HealthModuleOptions): ModuleType;
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* Creates a runtime-owned `/health` and `/ready` module.
|
|
34
46
|
*
|
|
35
|
-
* @
|
|
36
|
-
* @
|
|
47
|
+
* @deprecated Prefer `HealthModule.forRoot(...)` for application-facing module registration.
|
|
48
|
+
* @param options Runtime health endpoint options.
|
|
49
|
+
* @returns A module class that can be imported into an application module.
|
|
37
50
|
*/
|
|
38
51
|
export declare function createHealthModule(options?: HealthModuleOptions): ModuleType;
|
|
39
52
|
//# sourceMappingURL=health.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"health.d.ts","sourceRoot":"","sources":["../../src/health/health.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAE9C;;GAEG;AACH,MAAM,WAAW,YAAY;IAC3B,MAAM,EAAE,IAAI,GAAG,aAAa,CAAC;CAC9B;AAED;;GAEG;AACH,MAAM,WAAW,mBAAmB;IAClC,IAAI,EAAE,OAAO,CAAC;IACd,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAED;;GAEG;AACH,MAAM,WAAW,eAAe;IAC9B,MAAM,EAAE,OAAO,GAAG,UAAU,GAAG,aAAa,CAAC;CAC9C;AAED;;GAEG;AACH,MAAM,WAAW,mBAAmB;IAClC,WAAW,CAAC,EAAE,CAAC,GAAG,EAAE,OAAO,cAAc,EAAE,cAAc,KACrD,YAAY,GACZ,mBAAmB,GACnB,OAAO,CAAC,YAAY,GAAG,mBAAmB,CAAC,CAAC;IAChD,IAAI,CAAC,EAAE,MAAM,CAAC;CACf;AAED;;GAEG;AACH,MAAM,MAAM,cAAc,GAAG,
|
|
1
|
+
{"version":3,"file":"health.d.ts","sourceRoot":"","sources":["../../src/health/health.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAE9C;;GAEG;AACH,MAAM,WAAW,YAAY;IAC3B,MAAM,EAAE,IAAI,GAAG,aAAa,CAAC;CAC9B;AAED;;GAEG;AACH,MAAM,WAAW,mBAAmB;IAClC,IAAI,EAAE,OAAO,CAAC;IACd,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAED;;GAEG;AACH,MAAM,WAAW,eAAe;IAC9B,MAAM,EAAE,OAAO,GAAG,UAAU,GAAG,aAAa,CAAC;CAC9C;AAED;;GAEG;AACH,MAAM,WAAW,mBAAmB;IAClC,WAAW,CAAC,EAAE,CAAC,GAAG,EAAE,OAAO,cAAc,EAAE,cAAc,KACrD,YAAY,GACZ,mBAAmB,GACnB,OAAO,CAAC,YAAY,GAAG,mBAAmB,CAAC,CAAC;IAChD,IAAI,CAAC,EAAE,MAAM,CAAC;CACf;AAED;;GAEG;AACH,MAAM,MAAM,cAAc,GAAG,CAAC,GAAG,EAAE,OAAO,cAAc,EAAE,cAAc,KAAK,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;AAkFxG;;GAEG;AACH,qBAAa,YAAY;IACvB;;;;;OAKG;IACH,MAAM,CAAC,OAAO,CAAC,OAAO,GAAE,mBAAwB,GAAG,UAAU;CAG9D;AAED;;;;;;GAMG;AACH,wBAAgB,kBAAkB,CAAC,OAAO,GAAE,mBAAwB,GAAG,UAAU,CAEhF"}
|
package/dist/health/health.js
CHANGED
|
@@ -26,13 +26,7 @@ import { defineModule } from '../bootstrap.js';
|
|
|
26
26
|
* Defines the readiness check type.
|
|
27
27
|
*/
|
|
28
28
|
|
|
29
|
-
|
|
30
|
-
* Create health module.
|
|
31
|
-
*
|
|
32
|
-
* @param options The options.
|
|
33
|
-
* @returns The create health module result.
|
|
34
|
-
*/
|
|
35
|
-
export function createHealthModule(options = {}) {
|
|
29
|
+
function createRuntimeHealthModule(options = {}) {
|
|
36
30
|
let _initProto, _initClass;
|
|
37
31
|
const basePath = options.path ?? '';
|
|
38
32
|
const readinessChecks = [];
|
|
@@ -75,7 +69,7 @@ export function createHealthModule(options = {}) {
|
|
|
75
69
|
};
|
|
76
70
|
}
|
|
77
71
|
for (const check of readinessChecks) {
|
|
78
|
-
const result = await check();
|
|
72
|
+
const result = await check(ctx);
|
|
79
73
|
if (!result) {
|
|
80
74
|
ctx.response.setStatus(503);
|
|
81
75
|
return {
|
|
@@ -91,7 +85,7 @@ export function createHealthModule(options = {}) {
|
|
|
91
85
|
_initClass();
|
|
92
86
|
}
|
|
93
87
|
}
|
|
94
|
-
class
|
|
88
|
+
class RuntimeHealthModule {
|
|
95
89
|
static addReadinessCheck(fn) {
|
|
96
90
|
readinessChecks.push(fn);
|
|
97
91
|
}
|
|
@@ -102,8 +96,37 @@ export function createHealthModule(options = {}) {
|
|
|
102
96
|
ready = false;
|
|
103
97
|
}
|
|
104
98
|
}
|
|
105
|
-
|
|
99
|
+
Object.defineProperty(RuntimeHealthModule, 'name', {
|
|
100
|
+
value: 'HealthModule'
|
|
101
|
+
});
|
|
102
|
+
defineModule(RuntimeHealthModule, {
|
|
106
103
|
controllers: [_HealthController]
|
|
107
104
|
});
|
|
108
|
-
return
|
|
105
|
+
return RuntimeHealthModule;
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
/**
|
|
109
|
+
* Runtime health module facade for application module imports.
|
|
110
|
+
*/
|
|
111
|
+
export class HealthModule {
|
|
112
|
+
/**
|
|
113
|
+
* Creates a runtime-owned `/health` and `/ready` module.
|
|
114
|
+
*
|
|
115
|
+
* @param options Runtime health endpoint options.
|
|
116
|
+
* @returns A module class that can be imported into an application module.
|
|
117
|
+
*/
|
|
118
|
+
static forRoot(options = {}) {
|
|
119
|
+
return createRuntimeHealthModule(options);
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
/**
|
|
124
|
+
* Creates a runtime-owned `/health` and `/ready` module.
|
|
125
|
+
*
|
|
126
|
+
* @deprecated Prefer `HealthModule.forRoot(...)` for application-facing module registration.
|
|
127
|
+
* @param options Runtime health endpoint options.
|
|
128
|
+
* @returns A module class that can be imported into an application module.
|
|
129
|
+
*/
|
|
130
|
+
export function createHealthModule(options = {}) {
|
|
131
|
+
return HealthModule.forRoot(options);
|
|
109
132
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"http-adapter-shared.d.ts","sourceRoot":"","sources":["../src/http-adapter-shared.ts"],"names":[],"mappings":"AAAA,OAAO,EAOL,KAAK,WAAW,EAEhB,KAAK,sBAAsB,EAE3B,KAAK,cAAc,EAEnB,KAAK,sBAAsB,EAC5B,MAAM,cAAc,CAAC;AAItB,OAAO,KAAK,EAAE,WAAW,EAAE,iBAAiB,EAAE,wBAAwB,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAEvG;;GAEG;AACH,MAAM,MAAM,oBAAoB,GAAG,KAAK,GAAG,MAAM,GAAG,MAAM,EAAE,GAAG,WAAW,CAAC;AAE3E;;GAEG;AACH,MAAM,WAAW,uBAAuB;IACtC,wDAAwD;IACxD,UAAU,EAAE,MAAM,CAAC;IACnB,4CAA4C;IAC5C,GAAG,EAAE,MAAM,CAAC;CACb;AAED;;GAEG;AACH,MAAM,WAAW,4BAA4B;IAC3C,0CAA0C;IAC1C,IAAI,CAAC,EAAE,oBAAoB,CAAC;IAC5B,2CAA2C;IAC3C,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,gEAAgE;IAChE,mBAAmB,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IACxC,6DAA6D;IAC7D,UAAU,CAAC,EAAE,cAAc,EAAE,CAAC;IAC9B,qCAAqC;IACrC,eAAe,CAAC,EAAE,KAAK,GAAG,sBAAsB,CAAC;CAClD;AAED;;GAEG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G,CAAC,MAAM,IAAI,CAAC,CAAC;AAEzB,KAAK,6BAA6B,GAAG,sBAAsB,GAAG;IAC5D,eAAe,IAAI,uBAAuB,CAAC;CAC5C,CAAC;AAEF;;;;;;;GAOG;AACH,wBAAsB,+BAA+B,CACnD,UAAU,EAAE,UAAU,EACtB,OAAO,EAAE,sCAAsC,EAC/C,OAAO,EAAE,sBAAsB,GAC9B,OAAO,CAAC,WAAW,CAAC,CAQtB;AAED;;;;;GAKG;AACH,wBAAgB,2BAA2B,CAAC,OAAO,EAAE,4BAA4B,GAAG,cAAc,EAAE,CAkBnG;AAED;;;;;GAKG;AACH,wBAAgB,8BAA8B,CAAC,MAAM,EAAE,uBAAuB,GAAG,MAAM,CAItF;AAED;;;;;;;;GAQG;AACH,wBAAsB,yBAAyB,CAC7C,UAAU,EAAE,UAAU,EACtB,OAAO,EAAE,gCAAgC,EACzC,OAAO,EAAE,6BAA6B,GACrC,OAAO,CAAC,WAAW,CAAC,CA+EtB"}
|
|
@@ -106,15 +106,42 @@ export async function runHttpAdapterApplication(rootModule, options, adapter) {
|
|
|
106
106
|
}
|
|
107
107
|
throw error;
|
|
108
108
|
}
|
|
109
|
-
|
|
109
|
+
let unregisterShutdownSignals;
|
|
110
|
+
try {
|
|
111
|
+
unregisterShutdownSignals = options.shutdownRegistration?.(app, logger, options.forceExitTimeoutMs) ?? (() => {});
|
|
112
|
+
} catch (error) {
|
|
113
|
+
logger.error('Failed to register shutdown signals.', error, 'FluoFactory');
|
|
114
|
+
try {
|
|
115
|
+
await app.close('bootstrap-failed');
|
|
116
|
+
} catch (closeError) {
|
|
117
|
+
logger.error('Failed to close application after shutdown registration failure.', closeError, 'FluoFactory');
|
|
118
|
+
}
|
|
119
|
+
throw error;
|
|
120
|
+
}
|
|
110
121
|
const close = app.close.bind(app);
|
|
111
122
|
let shutdownSignalsUnregistered = false;
|
|
112
123
|
app.close = async signal => {
|
|
124
|
+
let unregisterError;
|
|
113
125
|
if (!shutdownSignalsUnregistered) {
|
|
114
|
-
|
|
115
|
-
|
|
126
|
+
try {
|
|
127
|
+
unregisterShutdownSignals();
|
|
128
|
+
} catch (error) {
|
|
129
|
+
unregisterError = error;
|
|
130
|
+
} finally {
|
|
131
|
+
shutdownSignalsUnregistered = true;
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
try {
|
|
135
|
+
await close(signal);
|
|
136
|
+
} catch (closeError) {
|
|
137
|
+
if (unregisterError) {
|
|
138
|
+
throw new AggregateError([unregisterError, closeError], 'Application close failed during shutdown signal cleanup.');
|
|
139
|
+
}
|
|
140
|
+
throw closeError;
|
|
141
|
+
}
|
|
142
|
+
if (unregisterError) {
|
|
143
|
+
throw unregisterError;
|
|
116
144
|
}
|
|
117
|
-
await close(signal);
|
|
118
145
|
};
|
|
119
146
|
return app;
|
|
120
147
|
}
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
import type { InjectionToken, Token } from '@fluojs/core';
|
|
2
|
+
import type { Scope } from '@fluojs/di';
|
|
3
|
+
import type { ModuleDefinition } from '../types.js';
|
|
4
|
+
/** Runtime-local view of DI forward references consumed by module graph compilation. */
|
|
5
|
+
export type RuntimeForwardRef = {
|
|
6
|
+
__forwardRef__: true;
|
|
7
|
+
forwardRef: () => Token;
|
|
8
|
+
};
|
|
9
|
+
/** Runtime-local view of optional DI tokens consumed by module graph compilation. */
|
|
10
|
+
export type RuntimeOptionalToken = {
|
|
11
|
+
__optional__: true;
|
|
12
|
+
token: Token;
|
|
13
|
+
};
|
|
14
|
+
/** Runtime-local union for DI dependency metadata consumed by module graph compilation. */
|
|
15
|
+
export type RuntimeInjectionToken = Token | RuntimeForwardRef | RuntimeOptionalToken;
|
|
16
|
+
/** Runtime-local class DI metadata view used for provider scope and dependency validation. */
|
|
17
|
+
export interface RuntimeClassDiMetadata {
|
|
18
|
+
inject?: readonly RuntimeInjectionToken[];
|
|
19
|
+
scope?: Scope;
|
|
20
|
+
}
|
|
21
|
+
/** Runtime-local writable class DI metadata shape used by explicit metadata-version tests. */
|
|
22
|
+
export interface RuntimeWritableClassDiMetadata {
|
|
23
|
+
inject?: InjectionToken[];
|
|
24
|
+
scope?: Scope;
|
|
25
|
+
}
|
|
26
|
+
/** Runtime-local module metadata view used while compiling application module graphs. */
|
|
27
|
+
export type RuntimeModuleMetadata = Pick<ModuleDefinition, 'controllers' | 'exports' | 'global' | 'imports' | 'middleware' | 'providers'>;
|
|
28
|
+
/** Runtime-local writable module metadata shape used by decorators, tests, and dynamic module normalization. */
|
|
29
|
+
export interface RuntimeWritableModuleMetadata {
|
|
30
|
+
controllers?: unknown[];
|
|
31
|
+
exports?: unknown[];
|
|
32
|
+
global?: boolean;
|
|
33
|
+
imports?: unknown[];
|
|
34
|
+
middleware?: unknown[];
|
|
35
|
+
providers?: unknown[];
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* Writes runtime-visible module metadata through the runtime-owned core metadata seam.
|
|
39
|
+
*
|
|
40
|
+
* @param target Module constructor that should receive the metadata snapshot.
|
|
41
|
+
* @param metadata Module metadata used by decorators, tests, or dynamic module normalization.
|
|
42
|
+
*/
|
|
43
|
+
export declare function defineRuntimeModuleMetadata(target: Function, metadata: RuntimeWritableModuleMetadata): void;
|
|
44
|
+
/**
|
|
45
|
+
* Writes runtime-visible class DI metadata through the runtime-owned core metadata seam.
|
|
46
|
+
*
|
|
47
|
+
* @param target Class constructor that should receive DI metadata.
|
|
48
|
+
* @param metadata DI metadata used by explicit runtime metadata-version tests.
|
|
49
|
+
*/
|
|
50
|
+
export declare function defineRuntimeClassDiMetadata(target: Function, metadata: RuntimeWritableClassDiMetadata): void;
|
|
51
|
+
/**
|
|
52
|
+
* Reads runtime-visible class DI metadata without spreading peer internal imports.
|
|
53
|
+
*
|
|
54
|
+
* @param target Class constructor whose effective DI metadata should be read.
|
|
55
|
+
* @returns The effective class DI metadata when present.
|
|
56
|
+
*/
|
|
57
|
+
export declare function getRuntimeClassDiMetadata(target: Function): RuntimeClassDiMetadata | undefined;
|
|
58
|
+
/**
|
|
59
|
+
* Reads own runtime-visible class DI metadata without inherited metadata fallback.
|
|
60
|
+
*
|
|
61
|
+
* @param target Class constructor whose own DI metadata should be read.
|
|
62
|
+
* @returns The own class DI metadata when present.
|
|
63
|
+
*/
|
|
64
|
+
export declare function getOwnRuntimeClassDiMetadata(target: Function): RuntimeClassDiMetadata | undefined;
|
|
65
|
+
/**
|
|
66
|
+
* Reads the current module metadata version for runtime compile-cache keys.
|
|
67
|
+
*
|
|
68
|
+
* @returns Monotonic module metadata version maintained by the core metadata store.
|
|
69
|
+
*/
|
|
70
|
+
export declare function getRuntimeModuleMetadataVersion(): number;
|
|
71
|
+
/**
|
|
72
|
+
* Reads the current class DI metadata version for runtime compile-cache keys.
|
|
73
|
+
*
|
|
74
|
+
* @returns Monotonic class DI metadata version maintained by the core metadata store.
|
|
75
|
+
*/
|
|
76
|
+
export declare function getRuntimeClassDiMetadataVersion(): number;
|
|
77
|
+
/**
|
|
78
|
+
* Reads runtime-visible module metadata during graph compilation.
|
|
79
|
+
*
|
|
80
|
+
* @param target Module constructor whose metadata should be read.
|
|
81
|
+
* @returns Module metadata normalized by the core metadata store.
|
|
82
|
+
*/
|
|
83
|
+
export declare function getRuntimeModuleMetadata(target: Function): RuntimeModuleMetadata;
|
|
84
|
+
//# sourceMappingURL=core-metadata.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"core-metadata.d.ts","sourceRoot":"","sources":["../../src/internal/core-metadata.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,KAAK,EAAE,MAAM,cAAc,CAAC;AAU1D,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AAExC,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAEpD,wFAAwF;AACxF,MAAM,MAAM,iBAAiB,GAAG;IAAE,cAAc,EAAE,IAAI,CAAC;IAAC,UAAU,EAAE,MAAM,KAAK,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AAG,SAAS,CAE9F;AAED;;;;;GAKG;AACH,wBAAgB,4BAA4B,CAAC,MAAM,EAAE,QAAQ,GAAG,sBAAsB,GAAG,SAAS,CAEjG;AAED;;;;GAIG;AACH,wBAAgB,+BAA+B,IAAI,MAAM,CAExD;AAED;;;;GAIG;AACH,wBAAgB,gCAAgC,IAAI,MAAM,CAEzD;AAED;;;;;GAKG;AACH,wBAAgB,wBAAwB,CAAC,MAAM,EAAE,QAAQ,GAAG,qBAAqB,CAEhF"}
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
import { defineClassDiMetadata as definePeerClassDiMetadata, defineModuleMetadata as definePeerModuleMetadata, getClassDiMetadata as getPeerClassDiMetadata, getClassDiMetadataVersion as getPeerClassDiMetadataVersion, getModuleMetadata as getPeerModuleMetadata, getModuleMetadataVersion as getPeerModuleMetadataVersion, getOwnClassDiMetadata as getPeerOwnClassDiMetadata } from '@fluojs/core/internal';
|
|
2
|
+
|
|
3
|
+
/** Runtime-local view of DI forward references consumed by module graph compilation. */
|
|
4
|
+
|
|
5
|
+
/** Runtime-local view of optional DI tokens consumed by module graph compilation. */
|
|
6
|
+
|
|
7
|
+
/** Runtime-local union for DI dependency metadata consumed by module graph compilation. */
|
|
8
|
+
|
|
9
|
+
/** Runtime-local class DI metadata view used for provider scope and dependency validation. */
|
|
10
|
+
|
|
11
|
+
/** Runtime-local writable class DI metadata shape used by explicit metadata-version tests. */
|
|
12
|
+
|
|
13
|
+
/** Runtime-local module metadata view used while compiling application module graphs. */
|
|
14
|
+
|
|
15
|
+
/** Runtime-local writable module metadata shape used by decorators, tests, and dynamic module normalization. */
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* Writes runtime-visible module metadata through the runtime-owned core metadata seam.
|
|
19
|
+
*
|
|
20
|
+
* @param target Module constructor that should receive the metadata snapshot.
|
|
21
|
+
* @param metadata Module metadata used by decorators, tests, or dynamic module normalization.
|
|
22
|
+
*/
|
|
23
|
+
export function defineRuntimeModuleMetadata(target, metadata) {
|
|
24
|
+
definePeerModuleMetadata(target, metadata);
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* Writes runtime-visible class DI metadata through the runtime-owned core metadata seam.
|
|
29
|
+
*
|
|
30
|
+
* @param target Class constructor that should receive DI metadata.
|
|
31
|
+
* @param metadata DI metadata used by explicit runtime metadata-version tests.
|
|
32
|
+
*/
|
|
33
|
+
export function defineRuntimeClassDiMetadata(target, metadata) {
|
|
34
|
+
definePeerClassDiMetadata(target, metadata);
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* Reads runtime-visible class DI metadata without spreading peer internal imports.
|
|
39
|
+
*
|
|
40
|
+
* @param target Class constructor whose effective DI metadata should be read.
|
|
41
|
+
* @returns The effective class DI metadata when present.
|
|
42
|
+
*/
|
|
43
|
+
export function getRuntimeClassDiMetadata(target) {
|
|
44
|
+
return getPeerClassDiMetadata(target);
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
/**
|
|
48
|
+
* Reads own runtime-visible class DI metadata without inherited metadata fallback.
|
|
49
|
+
*
|
|
50
|
+
* @param target Class constructor whose own DI metadata should be read.
|
|
51
|
+
* @returns The own class DI metadata when present.
|
|
52
|
+
*/
|
|
53
|
+
export function getOwnRuntimeClassDiMetadata(target) {
|
|
54
|
+
return getPeerOwnClassDiMetadata(target);
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
/**
|
|
58
|
+
* Reads the current module metadata version for runtime compile-cache keys.
|
|
59
|
+
*
|
|
60
|
+
* @returns Monotonic module metadata version maintained by the core metadata store.
|
|
61
|
+
*/
|
|
62
|
+
export function getRuntimeModuleMetadataVersion() {
|
|
63
|
+
return getPeerModuleMetadataVersion();
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
/**
|
|
67
|
+
* Reads the current class DI metadata version for runtime compile-cache keys.
|
|
68
|
+
*
|
|
69
|
+
* @returns Monotonic class DI metadata version maintained by the core metadata store.
|
|
70
|
+
*/
|
|
71
|
+
export function getRuntimeClassDiMetadataVersion() {
|
|
72
|
+
return getPeerClassDiMetadataVersion();
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
/**
|
|
76
|
+
* Reads runtime-visible module metadata during graph compilation.
|
|
77
|
+
*
|
|
78
|
+
* @param target Module constructor whose metadata should be read.
|
|
79
|
+
* @returns Module metadata normalized by the core metadata store.
|
|
80
|
+
*/
|
|
81
|
+
export function getRuntimeModuleMetadata(target) {
|
|
82
|
+
return getPeerModuleMetadata(target);
|
|
83
|
+
}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { DefaultBinder } from '@fluojs/http/internal';
|
|
2
|
+
import { attachFrameworkRequestNativeRouteHandoff, consumeRawRequestNativeRouteHandoff } from '@fluojs/http/internal';
|
|
3
|
+
export { DefaultBinder as RuntimeDefaultBinder };
|
|
4
|
+
export { attachFrameworkRequestNativeRouteHandoff as attachRuntimeFrameworkRequestNativeRouteHandoff, consumeRawRequestNativeRouteHandoff as consumeRuntimeRawRequestNativeRouteHandoff, };
|
|
5
|
+
//# sourceMappingURL=http-runtime.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"http-runtime.d.ts","sourceRoot":"","sources":["../../src/internal/http-runtime.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AACtD,OAAO,EACL,wCAAwC,EACxC,mCAAmC,EACpC,MAAM,uBAAuB,CAAC;AAE/B,OAAO,EAAE,aAAa,IAAI,oBAAoB,EAAE,CAAC;AACjD,OAAO,EACL,wCAAwC,IAAI,+CAA+C,EAC3F,mCAAmC,IAAI,0CAA0C,GAClF,CAAC"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { DefaultBinder } from '@fluojs/http/internal';
|
|
2
|
+
import { attachFrameworkRequestNativeRouteHandoff, consumeRawRequestNativeRouteHandoff } from '@fluojs/http/internal';
|
|
3
|
+
export { DefaultBinder as RuntimeDefaultBinder };
|
|
4
|
+
export { attachFrameworkRequestNativeRouteHandoff as attachRuntimeFrameworkRequestNativeRouteHandoff, consumeRawRequestNativeRouteHandoff as consumeRuntimeRawRequestNativeRouteHandoff };
|
package/dist/internal.d.ts
CHANGED
|
@@ -1,2 +1,3 @@
|
|
|
1
|
-
export { APPLICATION_LOGGER, COMPILED_MODULES, HTTP_APPLICATION_ADAPTER, PLATFORM_SHELL, RUNTIME_CONTAINER, } from './tokens.js';
|
|
1
|
+
export { APPLICATION_LOGGER, BOOTSTRAP_READY_SIGNAL, COMPILED_MODULES, HTTP_APPLICATION_ADAPTER, PLATFORM_SHELL, RUNTIME_CONTAINER, RUNTIME_CLEANUP_REGISTRATION, } from './tokens.js';
|
|
2
|
+
export type { BootstrapReadySignal } from './tokens.js';
|
|
2
3
|
//# sourceMappingURL=internal.d.ts.map
|
package/dist/internal.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"internal.d.ts","sourceRoot":"","sources":["../src/internal.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,kBAAkB,EAClB,gBAAgB,EAChB,wBAAwB,EACxB,cAAc,EACd,iBAAiB,
|
|
1
|
+
{"version":3,"file":"internal.d.ts","sourceRoot":"","sources":["../src/internal.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,kBAAkB,EAClB,sBAAsB,EACtB,gBAAgB,EAChB,wBAAwB,EACxB,cAAc,EACd,iBAAiB,EACjB,4BAA4B,GAC7B,MAAM,aAAa,CAAC;AACrB,YAAY,EAAE,oBAAoB,EAAE,MAAM,aAAa,CAAC"}
|
package/dist/internal.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export { APPLICATION_LOGGER, COMPILED_MODULES, HTTP_APPLICATION_ADAPTER, PLATFORM_SHELL, RUNTIME_CONTAINER } from './tokens.js';
|
|
1
|
+
export { APPLICATION_LOGGER, BOOTSTRAP_READY_SIGNAL, COMPILED_MODULES, HTTP_APPLICATION_ADAPTER, PLATFORM_SHELL, RUNTIME_CONTAINER, RUNTIME_CLEANUP_REGISTRATION } from './tokens.js';
|
package/dist/logging/logger.d.ts
CHANGED
|
@@ -1,8 +1,37 @@
|
|
|
1
1
|
import type { ApplicationLogger } from '../types.js';
|
|
2
|
+
/** Severity threshold accepted by `createConsoleApplicationLogger(...)`. */
|
|
3
|
+
export type ConsoleApplicationLoggerLevel = 'debug' | 'error' | 'log' | 'warn';
|
|
4
|
+
/** Console formatting mode accepted by `createConsoleApplicationLogger(...)`. */
|
|
5
|
+
export type ConsoleApplicationLoggerMode = 'minimal' | 'pretty' | 'silent';
|
|
6
|
+
/** Options used to tune the Node console logger without replacing the runtime logger contract. */
|
|
7
|
+
export interface ConsoleApplicationLoggerOptions {
|
|
8
|
+
/**
|
|
9
|
+
* Controls console formatting.
|
|
10
|
+
*
|
|
11
|
+
* - `pretty` keeps the historical timestamp, pid, level, context, and message format.
|
|
12
|
+
* - `minimal` writes only `[fluo] LEVEL [context] message`.
|
|
13
|
+
* - `silent` suppresses all logger methods.
|
|
14
|
+
*/
|
|
15
|
+
mode?: ConsoleApplicationLoggerMode;
|
|
16
|
+
/** Lowest severity emitted by the logger. Defaults to `debug`, preserving existing output. */
|
|
17
|
+
level?: ConsoleApplicationLoggerLevel;
|
|
18
|
+
/** Override TTY-aware ANSI color detection. */
|
|
19
|
+
color?: boolean;
|
|
20
|
+
/** Explicit host color environment passed from the application/bootstrap boundary. */
|
|
21
|
+
environment?: ConsoleApplicationLoggerEnvironment;
|
|
22
|
+
}
|
|
23
|
+
/** Host color environment used by `createConsoleApplicationLogger(...)` without reading globals directly. */
|
|
24
|
+
export interface ConsoleApplicationLoggerEnvironment {
|
|
25
|
+
/** Whether `NO_COLOR`-style color suppression is enabled. */
|
|
26
|
+
noColor?: boolean;
|
|
27
|
+
/** `FORCE_COLOR`-style value used to force ANSI color output when truthy. */
|
|
28
|
+
forceColor?: string;
|
|
29
|
+
}
|
|
2
30
|
/**
|
|
3
31
|
* Create console application logger.
|
|
4
32
|
*
|
|
33
|
+
* @param options Console logger mode, severity threshold, and color override.
|
|
5
34
|
* @returns The create console application logger result.
|
|
6
35
|
*/
|
|
7
|
-
export declare function createConsoleApplicationLogger(): ApplicationLogger;
|
|
36
|
+
export declare function createConsoleApplicationLogger(options?: ConsoleApplicationLoggerOptions): ApplicationLogger;
|
|
8
37
|
//# sourceMappingURL=logger.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"logger.d.ts","sourceRoot":"","sources":["../../src/logging/logger.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"logger.d.ts","sourceRoot":"","sources":["../../src/logging/logger.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAErD,4EAA4E;AAC5E,MAAM,MAAM,6BAA6B,GAAG,OAAO,GAAG,OAAO,GAAG,KAAK,GAAG,MAAM,CAAC;AAC/E,iFAAiF;AACjF,MAAM,MAAM,4BAA4B,GAAG,SAAS,GAAG,QAAQ,GAAG,QAAQ,CAAC;AAE3E,kGAAkG;AAClG,MAAM,WAAW,+BAA+B;IAC9C;;;;;;OAMG;IACH,IAAI,CAAC,EAAE,4BAA4B,CAAC;IACpC,8FAA8F;IAC9F,KAAK,CAAC,EAAE,6BAA6B,CAAC;IACtC,+CAA+C;IAC/C,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,sFAAsF;IACtF,WAAW,CAAC,EAAE,mCAAmC,CAAC;CACnD;AAED,6GAA6G;AAC7G,MAAM,WAAW,mCAAmC;IAClD,6DAA6D;IAC7D,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,6EAA6E;IAC7E,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AA2DD;;;;;GAKG;AACH,wBAAgB,8BAA8B,CAAC,OAAO,GAAE,+BAAoC,GAAG,iBAAiB,CA2C/G"}
|
package/dist/logging/logger.js
CHANGED
|
@@ -1,8 +1,22 @@
|
|
|
1
|
+
/** Severity threshold accepted by `createConsoleApplicationLogger(...)`. */
|
|
2
|
+
|
|
3
|
+
/** Console formatting mode accepted by `createConsoleApplicationLogger(...)`. */
|
|
4
|
+
|
|
5
|
+
/** Options used to tune the Node console logger without replacing the runtime logger contract. */
|
|
6
|
+
|
|
7
|
+
/** Host color environment used by `createConsoleApplicationLogger(...)` without reading globals directly. */
|
|
8
|
+
|
|
1
9
|
const RESET = '\u001B[0m';
|
|
2
10
|
const BRIGHT_GREEN = '\u001B[32m';
|
|
3
11
|
const BRIGHT_RED = '\u001B[31m';
|
|
4
12
|
const BRIGHT_YELLOW = '\u001B[33m';
|
|
5
13
|
const DIM = '\u001B[2m';
|
|
14
|
+
const LEVEL_PRIORITY = {
|
|
15
|
+
debug: 10,
|
|
16
|
+
log: 20,
|
|
17
|
+
warn: 30,
|
|
18
|
+
error: 40
|
|
19
|
+
};
|
|
6
20
|
function colorize(value, color, enabled) {
|
|
7
21
|
return enabled ? `${color}${value}${RESET}` : value;
|
|
8
22
|
}
|
|
@@ -15,28 +29,72 @@ function formatLog(level, context, message, color) {
|
|
|
15
29
|
const contextLabel = colorize(`[${context}]`, BRIGHT_YELLOW, color);
|
|
16
30
|
return `${prefix} ${pid} - ${timestamp} ${levelLabel} ${contextLabel} ${message}`;
|
|
17
31
|
}
|
|
32
|
+
function formatMinimalLog(level, context, message, color) {
|
|
33
|
+
const prefix = colorize('[fluo]', BRIGHT_GREEN, color);
|
|
34
|
+
const levelColor = level === 'ERROR' || level === 'WARN' ? BRIGHT_RED : BRIGHT_GREEN;
|
|
35
|
+
const levelLabel = colorize(level, levelColor, color);
|
|
36
|
+
const contextLabel = colorize(`[${context}]`, BRIGHT_YELLOW, color);
|
|
37
|
+
return `${prefix} ${levelLabel} ${contextLabel} ${message}`;
|
|
38
|
+
}
|
|
39
|
+
function shouldLog(currentLevel, configuredLevel) {
|
|
40
|
+
return LEVEL_PRIORITY[currentLevel] >= LEVEL_PRIORITY[configuredLevel];
|
|
41
|
+
}
|
|
42
|
+
function isForceColorEnabled(value) {
|
|
43
|
+
return value !== undefined && value !== '' && value !== '0' && value !== 'false' && value !== 'no' && value !== 'off';
|
|
44
|
+
}
|
|
45
|
+
function shouldUseColor(stream, environment) {
|
|
46
|
+
if (environment.noColor === true) {
|
|
47
|
+
return false;
|
|
48
|
+
}
|
|
49
|
+
if (isForceColorEnabled(environment.forceColor)) {
|
|
50
|
+
return true;
|
|
51
|
+
}
|
|
52
|
+
return Boolean(stream.isTTY);
|
|
53
|
+
}
|
|
18
54
|
|
|
19
55
|
/**
|
|
20
56
|
* Create console application logger.
|
|
21
57
|
*
|
|
58
|
+
* @param options Console logger mode, severity threshold, and color override.
|
|
22
59
|
* @returns The create console application logger result.
|
|
23
60
|
*/
|
|
24
|
-
export function createConsoleApplicationLogger() {
|
|
61
|
+
export function createConsoleApplicationLogger(options = {}) {
|
|
62
|
+
const mode = options.mode ?? 'pretty';
|
|
63
|
+
const level = options.level ?? 'debug';
|
|
64
|
+
const environment = options.environment ?? {};
|
|
65
|
+
const format = mode === 'minimal' ? formatMinimalLog : formatLog;
|
|
66
|
+
if (mode === 'silent') {
|
|
67
|
+
return {
|
|
68
|
+
debug() {},
|
|
69
|
+
error() {},
|
|
70
|
+
log() {},
|
|
71
|
+
warn() {}
|
|
72
|
+
};
|
|
73
|
+
}
|
|
25
74
|
return {
|
|
26
75
|
debug(message, context = 'fluo') {
|
|
27
|
-
|
|
76
|
+
if (shouldLog('debug', level)) {
|
|
77
|
+
console.debug(format('DEBUG', context, message, options.color ?? shouldUseColor(process.stdout, environment)));
|
|
78
|
+
}
|
|
28
79
|
},
|
|
29
80
|
error(message, error, context = 'fluo') {
|
|
30
|
-
|
|
81
|
+
if (!shouldLog('error', level)) {
|
|
82
|
+
return;
|
|
83
|
+
}
|
|
84
|
+
console.error(format('ERROR', context, message, options.color ?? shouldUseColor(process.stderr, environment)));
|
|
31
85
|
if (error) {
|
|
32
86
|
console.error(error);
|
|
33
87
|
}
|
|
34
88
|
},
|
|
35
89
|
log(message, context = 'fluo') {
|
|
36
|
-
|
|
90
|
+
if (shouldLog('log', level)) {
|
|
91
|
+
console.log(format('LOG', context, message, options.color ?? shouldUseColor(process.stdout, environment)));
|
|
92
|
+
}
|
|
37
93
|
},
|
|
38
94
|
warn(message, context = 'fluo') {
|
|
39
|
-
|
|
95
|
+
if (shouldLog('warn', level)) {
|
|
96
|
+
console.warn(format('WARN', context, message, options.color ?? shouldUseColor(process.stderr, environment)));
|
|
97
|
+
}
|
|
40
98
|
}
|
|
41
99
|
};
|
|
42
100
|
}
|
package/dist/module-graph.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { Provider } from '@fluojs/di';
|
|
2
1
|
import type { Token } from '@fluojs/core';
|
|
2
|
+
import type { Provider } from '@fluojs/di';
|
|
3
3
|
import type { BootstrapModuleOptions, CompiledModule, ModuleType } from './types.js';
|
|
4
4
|
/**
|
|
5
5
|
* Returns the public token represented by a provider declaration.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"module-graph.d.ts","sourceRoot":"","sources":["../src/module-graph.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"module-graph.d.ts","sourceRoot":"","sources":["../src/module-graph.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,cAAc,CAAC;AAC1C,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAY3C,OAAO,KAAK,EAAE,sBAAsB,EAAE,cAAc,EAAoB,UAAU,EAAE,MAAM,YAAY,CAAC;AAEvG;;;;;GAKG;AACH,wBAAgB,aAAa,CAAC,QAAQ,EAAE,QAAQ,GAAG,KAAK,CAMvD;AAiBD,yFAAyF;AACzF,wBAAgB,sCAAsC,IAAI,IAAI,CAE7D;AAED;;;;GAIG;AACH,wBAAgB,wCAAwC,IAAI,MAAM,CAEjE;AAgFD;;;;;;GAMG;AACH,wBAAgB,yBAAyB,CAAC,UAAU,EAAE,UAAU,EAAE,OAAO,GAAE,sBAA2B,GAAG,MAAM,CAY9G;AAiRD;;;;;GAKG;AACH,wBAAgB,qBAAqB,CAAC,SAAS,GAAE,QAAQ,EAAO,GAAG,GAAG,CAAC,KAAK,CAAC,CAE5E;AA8UD;;;;;;GAMG;AACH,wBAAgB,kBAAkB,CAAC,UAAU,EAAE,UAAU,EAAE,OAAO,GAAE,sBAA2B,GAAG,cAAc,EAAE,CA4BjH"}
|
package/dist/module-graph.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { getRuntimeClassDiMetadata, getRuntimeClassDiMetadataVersion, getOwnRuntimeClassDiMetadata, getRuntimeModuleMetadata, getRuntimeModuleMetadataVersion } from './internal/core-metadata.js';
|
|
2
2
|
import { ModuleGraphError, ModuleInjectionMetadataError, ModuleVisibilityError } from './errors.js';
|
|
3
3
|
/**
|
|
4
4
|
* Returns the public token represented by a provider declaration.
|
|
@@ -98,7 +98,7 @@ function describeProviderForCacheKey(provider) {
|
|
|
98
98
|
export function createModuleGraphCacheKey(rootModule, options = {}) {
|
|
99
99
|
const runtimeProviders = (options.providers ?? []).map(describeProviderForCacheKey).join('|');
|
|
100
100
|
const validationTokens = (options.validationTokens ?? []).map(describeTokenForCacheKey).join('|');
|
|
101
|
-
return [`root:${describeTokenForCacheKey(rootModule)}`, `module:${
|
|
101
|
+
return [`root:${describeTokenForCacheKey(rootModule)}`, `module:${getRuntimeModuleMetadataVersion()}`, `class-di:${getRuntimeClassDiMetadataVersion()}`, `algorithm:${MODULE_GRAPH_COMPILE_ALGORITHM_VERSION}`, `runtime:${runtimeProviders}`, `validation:${validationTokens}`].join(';');
|
|
102
102
|
}
|
|
103
103
|
function cloneModuleDefinition(definition) {
|
|
104
104
|
return {
|
|
@@ -287,7 +287,7 @@ function createModuleGraphCacheSnapshot(modules) {
|
|
|
287
287
|
return Object.freeze(cloneCompiledModules(modules).map(compiledModule => freezeCompiledModule(compiledModule)));
|
|
288
288
|
}
|
|
289
289
|
function getEffectiveClassDiMetadata(target) {
|
|
290
|
-
const metadata =
|
|
290
|
+
const metadata = getRuntimeClassDiMetadata(target);
|
|
291
291
|
if (!metadata) {
|
|
292
292
|
return undefined;
|
|
293
293
|
}
|
|
@@ -335,7 +335,7 @@ function mergeRuntimeTokenSets(providers = [], validationTokens = []) {
|
|
|
335
335
|
return new Set([...createRuntimeTokenSet(providers), ...validationTokens]);
|
|
336
336
|
}
|
|
337
337
|
function requiredConstructorParameters(target) {
|
|
338
|
-
if (
|
|
338
|
+
if (getOwnRuntimeClassDiMetadata(target)?.inject !== undefined) {
|
|
339
339
|
return 0;
|
|
340
340
|
}
|
|
341
341
|
return target.length;
|
|
@@ -398,7 +398,7 @@ function compileModule(moduleType, runtimeProviderTokens, compiled = new Map(),
|
|
|
398
398
|
});
|
|
399
399
|
}
|
|
400
400
|
visiting.add(moduleType);
|
|
401
|
-
const definition = normalizeModuleDefinition(
|
|
401
|
+
const definition = normalizeModuleDefinition(getRuntimeModuleMetadata(moduleType));
|
|
402
402
|
for (const imported of definition.imports ?? []) {
|
|
403
403
|
compileModule(imported, runtimeProviderTokens, compiled, visiting, ordered);
|
|
404
404
|
}
|
package/dist/tokens.d.ts
CHANGED
|
@@ -3,7 +3,13 @@ import type { Container } from '@fluojs/di';
|
|
|
3
3
|
import type { HttpApplicationAdapter } from '@fluojs/http';
|
|
4
4
|
import type { ApplicationLogger } from './types.js';
|
|
5
5
|
import type { CompiledModule } from './types.js';
|
|
6
|
+
import type { RuntimeCleanupRegistration } from './types.js';
|
|
6
7
|
import type { PlatformShell } from './platform-contract.js';
|
|
8
|
+
/** Internal signal that resolves only after application bootstrap reaches runtime readiness. */
|
|
9
|
+
export interface BootstrapReadySignal {
|
|
10
|
+
/** Waits until every bootstrap hook and runtime readiness transition has completed. */
|
|
11
|
+
wait(): Promise<void>;
|
|
12
|
+
}
|
|
7
13
|
/**
|
|
8
14
|
* Injection token for the application logger.
|
|
9
15
|
*/
|
|
@@ -24,4 +30,10 @@ export declare const HTTP_APPLICATION_ADAPTER: Token<HttpApplicationAdapter>;
|
|
|
24
30
|
* Injection token for the platform shell.
|
|
25
31
|
*/
|
|
26
32
|
export declare const PLATFORM_SHELL: Token<PlatformShell>;
|
|
33
|
+
/**
|
|
34
|
+
* Internal injection token for registering runtime-owned cleanup callbacks.
|
|
35
|
+
*/
|
|
36
|
+
export declare const RUNTIME_CLEANUP_REGISTRATION: Token<RuntimeCleanupRegistration>;
|
|
37
|
+
/** Internal injection token for integrations that must defer work until full runtime readiness. */
|
|
38
|
+
export declare const BOOTSTRAP_READY_SIGNAL: Token<BootstrapReadySignal>;
|
|
27
39
|
//# sourceMappingURL=tokens.d.ts.map
|
package/dist/tokens.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tokens.d.ts","sourceRoot":"","sources":["../src/tokens.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,cAAc,CAAC;AAC1C,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAC5C,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,cAAc,CAAC;AAE3D,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAC;AACpD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AACjD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AAE5D;;GAEG;AACH,eAAO,MAAM,kBAAkB,EAAE,KAAK,CAAC,iBAAiB,CAAiD,CAAC;AAE1G;;GAEG;AACH,eAAO,MAAM,iBAAiB,EAAE,KAAK,CAAC,SAAS,CAA+B,CAAC;AAE/E;;GAEG;AACH,eAAO,MAAM,gBAAgB,EAAE,KAAK,CAAC,SAAS,cAA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AC;AAEtH,mGAAmG;AACnG,eAAO,MAAM,sBAAsB,EAAE,KAAK,CAAC,oBAAoB,CAAoC,CAAC"}
|
package/dist/tokens.js
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
/** Internal signal that resolves only after application bootstrap reaches runtime readiness. */
|
|
2
|
+
|
|
1
3
|
/**
|
|
2
4
|
* Injection token for the application logger.
|
|
3
5
|
*/
|
|
@@ -21,4 +23,12 @@ export const HTTP_APPLICATION_ADAPTER = Symbol('HTTP_APPLICATION_ADAPTER');
|
|
|
21
23
|
/**
|
|
22
24
|
* Injection token for the platform shell.
|
|
23
25
|
*/
|
|
24
|
-
export const PLATFORM_SHELL = Symbol('PLATFORM_SHELL');
|
|
26
|
+
export const PLATFORM_SHELL = Symbol('PLATFORM_SHELL');
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* Internal injection token for registering runtime-owned cleanup callbacks.
|
|
30
|
+
*/
|
|
31
|
+
export const RUNTIME_CLEANUP_REGISTRATION = Symbol('RUNTIME_CLEANUP_REGISTRATION');
|
|
32
|
+
|
|
33
|
+
/** Internal injection token for integrations that must defer work until full runtime readiness. */
|
|
34
|
+
export const BOOTSTRAP_READY_SIGNAL = Symbol('BOOTSTRAP_READY_SIGNAL');
|
package/dist/types.d.ts
CHANGED
|
@@ -81,6 +81,8 @@ export interface ApplicationLogger {
|
|
|
81
81
|
log(message: string, context?: string): void;
|
|
82
82
|
warn(message: string, context?: string): void;
|
|
83
83
|
}
|
|
84
|
+
/** Registers runtime-owned cleanup callbacks that must run during bootstrap failure or shutdown. */
|
|
85
|
+
export type RuntimeCleanupRegistration = (cleanup: () => void) => () => void;
|
|
84
86
|
/** Runtime-visible application states for HTTP and microservice shells. */
|
|
85
87
|
export type ApplicationState = 'bootstrapped' | 'ready' | 'closed';
|
|
86
88
|
/**
|