@gobing-ai/ts-infra 0.3.4 → 0.3.6
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 +196 -48
- package/dist/application/index.d.ts +55 -0
- package/dist/application/index.d.ts.map +1 -0
- package/dist/application/index.js +173 -0
- package/dist/application/plugins/builtins.d.ts +64 -0
- package/dist/application/plugins/builtins.d.ts.map +1 -0
- package/dist/application/plugins/builtins.js +146 -0
- package/dist/application/plugins/host.d.ts +61 -0
- package/dist/application/plugins/host.d.ts.map +1 -0
- package/dist/application/plugins/host.js +131 -0
- package/dist/application/plugins/index.d.ts +3 -0
- package/dist/application/plugins/index.d.ts.map +1 -0
- package/dist/application/plugins/index.js +2 -0
- package/dist/application/plugins/types.d.ts +69 -0
- package/dist/application/plugins/types.d.ts.map +1 -0
- package/dist/application/plugins/types.js +10 -0
- package/dist/application/types.d.ts +195 -0
- package/dist/application/types.d.ts.map +1 -0
- package/dist/application/types.js +9 -0
- package/dist/application-node.d.ts +68 -0
- package/dist/application-node.d.ts.map +1 -0
- package/dist/application-node.js +228 -0
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/dist/scheduler/cloudflare.d.ts.map +1 -1
- package/dist/scheduler/cloudflare.js +9 -2
- package/dist/scheduler/factory.d.ts +4 -8
- package/dist/scheduler/factory.d.ts.map +1 -1
- package/dist/scheduler/factory.js +12 -22
- package/dist/scheduler/index.d.ts +1 -1
- package/dist/scheduler/index.d.ts.map +1 -1
- package/dist/scheduler/index.js +1 -1
- package/dist/scheduler/wrap-handler.d.ts +8 -4
- package/dist/scheduler/wrap-handler.d.ts.map +1 -1
- package/dist/scheduler/wrap-handler.js +8 -4
- package/dist/telemetry/index.d.ts +1 -2
- package/dist/telemetry/index.d.ts.map +1 -1
- package/dist/telemetry/index.js +1 -2
- package/dist/telemetry/metrics.d.ts +9 -1
- package/dist/telemetry/metrics.d.ts.map +1 -1
- package/dist/telemetry/metrics.js +22 -1
- package/dist/telemetry/sdk.d.ts +33 -1
- package/dist/telemetry/sdk.d.ts.map +1 -1
- package/dist/telemetry/sdk.js +14 -1
- package/package.json +16 -3
- package/src/application/index.ts +248 -0
- package/src/application/plugins/builtins.ts +178 -0
- package/src/application/plugins/host.ts +143 -0
- package/src/application/plugins/index.ts +3 -0
- package/src/application/plugins/types.ts +86 -0
- package/src/application/types.ts +210 -0
- package/src/application-node.ts +311 -0
- package/src/index.ts +0 -2
- package/src/scheduler/cloudflare.ts +16 -5
- package/src/scheduler/factory.ts +15 -26
- package/src/scheduler/index.ts +1 -1
- package/src/scheduler/wrap-handler.ts +8 -4
- package/src/telemetry/index.ts +9 -2
- package/src/telemetry/metrics.ts +22 -1
- package/src/telemetry/sdk.ts +51 -2
- package/dist/telemetry/config.d.ts +0 -41
- package/dist/telemetry/config.d.ts.map +0 -1
- package/dist/telemetry/config.js +0 -21
- package/src/telemetry/config.ts +0 -59
|
@@ -0,0 +1,146 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Built-in service plugins for the application bootstrap.
|
|
3
|
+
*
|
|
4
|
+
* Each factory returns a `Plugin` that maps an existing init/shutdown pair onto
|
|
5
|
+
* the PluginHost lifecycle: `onStart` = init, `onStop` = teardown. Absent
|
|
6
|
+
* hooks are omitted (no-op by absence, not by stub).
|
|
7
|
+
*
|
|
8
|
+
* @module application/plugins
|
|
9
|
+
*/
|
|
10
|
+
import { initializeLogger } from '../../logger.js';
|
|
11
|
+
import { initMetrics, shutdownMetrics } from '../../telemetry/metrics.js';
|
|
12
|
+
import { initTelemetry, shutdownTelemetry } from '../../telemetry/sdk.js';
|
|
13
|
+
// ── Telemetry ──────────────────────────────────────────────────────────────
|
|
14
|
+
/**
|
|
15
|
+
* Built-in plugin for telemetry + metrics.
|
|
16
|
+
*
|
|
17
|
+
* `onStart`: `initTelemetry` + `initMetrics` (pre-warm instruments).
|
|
18
|
+
* `onStop`: `shutdownMetrics` + `shutdownTelemetry` (reverse of init).
|
|
19
|
+
* `failFast: true` — a failing telemetry init aborts the bootstrap.
|
|
20
|
+
*/
|
|
21
|
+
export function telemetryPlugin(config) {
|
|
22
|
+
return {
|
|
23
|
+
name: 'builtin:telemetry',
|
|
24
|
+
version: '0.0.0',
|
|
25
|
+
failFast: true,
|
|
26
|
+
onLoad: async () => { },
|
|
27
|
+
onStart: async () => {
|
|
28
|
+
if (config.enabled) {
|
|
29
|
+
initTelemetry({
|
|
30
|
+
enabled: config.enabled,
|
|
31
|
+
serviceName: config.serviceName,
|
|
32
|
+
environment: config.environment,
|
|
33
|
+
dbStatementDebug: config.dbStatementDebug,
|
|
34
|
+
});
|
|
35
|
+
initMetrics();
|
|
36
|
+
}
|
|
37
|
+
},
|
|
38
|
+
onStop: async () => {
|
|
39
|
+
if (config.enabled) {
|
|
40
|
+
shutdownMetrics();
|
|
41
|
+
await shutdownTelemetry();
|
|
42
|
+
}
|
|
43
|
+
},
|
|
44
|
+
};
|
|
45
|
+
}
|
|
46
|
+
// ── Logger ─────────────────────────────────────────────────────────────────
|
|
47
|
+
/**
|
|
48
|
+
* Built-in plugin for the structured logger.
|
|
49
|
+
*
|
|
50
|
+
* `onStart`: `initializeLogger` (skipped when an injected logger is present).
|
|
51
|
+
* No `onStop` — the logger has no teardown.
|
|
52
|
+
* `failFast: true` — a failing logger init aborts the bootstrap.
|
|
53
|
+
*/
|
|
54
|
+
export function loggerPlugin(config, injected) {
|
|
55
|
+
return {
|
|
56
|
+
name: 'builtin:logger',
|
|
57
|
+
version: '0.0.0',
|
|
58
|
+
failFast: true,
|
|
59
|
+
onLoad: async () => { },
|
|
60
|
+
onStart: async () => {
|
|
61
|
+
if (config.enabled && !injected) {
|
|
62
|
+
await initializeLogger({
|
|
63
|
+
level: config.level,
|
|
64
|
+
console: config.console,
|
|
65
|
+
json: config.json,
|
|
66
|
+
fileSink: config.fileSink,
|
|
67
|
+
});
|
|
68
|
+
}
|
|
69
|
+
},
|
|
70
|
+
};
|
|
71
|
+
}
|
|
72
|
+
/**
|
|
73
|
+
* Built-in plugin that wraps the user's `start`/`stop` callbacks.
|
|
74
|
+
*
|
|
75
|
+
* `onStart`: calls `options.start(app)`. `failFast: true`.
|
|
76
|
+
* `onStop`: calls `options.stop(app, reason)`. Registered after services,
|
|
77
|
+
* before scheduler, so stopAll/reverse-order places it after
|
|
78
|
+
* scheduler.stop and before service teardown.
|
|
79
|
+
*/
|
|
80
|
+
export function userCallbackPlugin(start, stop, app) {
|
|
81
|
+
return {
|
|
82
|
+
name: 'builtin:user-callback',
|
|
83
|
+
version: '0.0.0',
|
|
84
|
+
failFast: true,
|
|
85
|
+
onLoad: async () => { },
|
|
86
|
+
onStart: async () => {
|
|
87
|
+
if (app)
|
|
88
|
+
await start(app);
|
|
89
|
+
},
|
|
90
|
+
onStop: stop && app
|
|
91
|
+
? async (_host, reason) => {
|
|
92
|
+
await stop(app, reason ?? 'manual');
|
|
93
|
+
}
|
|
94
|
+
: undefined,
|
|
95
|
+
};
|
|
96
|
+
}
|
|
97
|
+
/**
|
|
98
|
+
* Built-in plugin for the scheduler.
|
|
99
|
+
*
|
|
100
|
+
* `onStart`: `adapter.start()` when `autoStart` is true.
|
|
101
|
+
* `onStop`: `adapter.stop()` — fail-soft.
|
|
102
|
+
*
|
|
103
|
+
* Registered LAST so autoStart always runs after the user callback.
|
|
104
|
+
*/
|
|
105
|
+
export function schedulerPlugin(adapter, autoStart) {
|
|
106
|
+
return {
|
|
107
|
+
name: 'builtin:scheduler',
|
|
108
|
+
version: '0.0.0',
|
|
109
|
+
failFast: true,
|
|
110
|
+
onLoad: async () => { },
|
|
111
|
+
onStart: async () => {
|
|
112
|
+
if (autoStart) {
|
|
113
|
+
await adapter.start();
|
|
114
|
+
}
|
|
115
|
+
},
|
|
116
|
+
onStop: async () => {
|
|
117
|
+
// Fail-soft — the host always catches stop/unload errors
|
|
118
|
+
await adapter.stop();
|
|
119
|
+
},
|
|
120
|
+
};
|
|
121
|
+
}
|
|
122
|
+
// ── DB (reason-aware, for owned adapters only) ────────────────────────────
|
|
123
|
+
/**
|
|
124
|
+
* Built-in plugin for a DB adapter the bootstrap OWNS.
|
|
125
|
+
*
|
|
126
|
+
* `onStop(reason)`: `db.close()` — best-effort.
|
|
127
|
+
* Register ONLY when the bootstrap creates the adapter (Node subpath).
|
|
128
|
+
* Do NOT register for caller-injected `services.db` — those are caller-owned.
|
|
129
|
+
*/
|
|
130
|
+
export function dbPlugin(db) {
|
|
131
|
+
return {
|
|
132
|
+
name: 'builtin:db',
|
|
133
|
+
version: '0.0.0',
|
|
134
|
+
failFast: false,
|
|
135
|
+
onLoad: async () => { },
|
|
136
|
+
onStart: async () => { },
|
|
137
|
+
onStop: async () => {
|
|
138
|
+
try {
|
|
139
|
+
db.close();
|
|
140
|
+
}
|
|
141
|
+
catch {
|
|
142
|
+
/* best-effort */
|
|
143
|
+
}
|
|
144
|
+
},
|
|
145
|
+
};
|
|
146
|
+
}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Bare `PluginHost` — owns an insertion-ordered set of plugins and drives
|
|
3
|
+
* lifecycle fan-out (load → start → stop → unload) with fail-soft semantics
|
|
4
|
+
* for start/stop/unload and fail-fast for load.
|
|
5
|
+
*
|
|
6
|
+
* This is a runtime concern: it needs a logger and event bus, both provided
|
|
7
|
+
* by the application bootstrap. No capabilities, no trust ladder.
|
|
8
|
+
*
|
|
9
|
+
* @module application/plugins
|
|
10
|
+
*/
|
|
11
|
+
import type { EventBus } from '../../event-bus/event-bus';
|
|
12
|
+
import type { EventMap } from '../../event-bus/types';
|
|
13
|
+
import { type Logger } from '../../logger';
|
|
14
|
+
import type { Plugin, PluginSummary } from './types';
|
|
15
|
+
/**
|
|
16
|
+
* Plugin host: registers plugins in insertion order and drives their lifecycle
|
|
17
|
+
* fan-out (load → start → stop → unload).
|
|
18
|
+
*
|
|
19
|
+
* The host stores `EventBus<EventMap>` (the base event contract) rather than
|
|
20
|
+
* a narrower `TEvents` subtype, because `EventBus` is invariant in its type
|
|
21
|
+
* parameter and plugins only need the base contract.
|
|
22
|
+
*/
|
|
23
|
+
export declare class PluginHost {
|
|
24
|
+
readonly logger: Logger;
|
|
25
|
+
readonly events: EventBus<EventMap>;
|
|
26
|
+
private readonly _plugins;
|
|
27
|
+
constructor(events: EventBus<EventMap>, opts?: {
|
|
28
|
+
logger?: Logger;
|
|
29
|
+
});
|
|
30
|
+
/** Register a plugin. Throws on duplicate name. */
|
|
31
|
+
register(plugin: Plugin): void;
|
|
32
|
+
/** Remove a plugin by name. No-op if absent. */
|
|
33
|
+
unregister(name: string): void;
|
|
34
|
+
/** Check whether a plugin is registered. */
|
|
35
|
+
has(name: string): boolean;
|
|
36
|
+
/** List registered plugins in registration order. */
|
|
37
|
+
list(): readonly PluginSummary[];
|
|
38
|
+
/**
|
|
39
|
+
* Fail-fast: calls `onLoad` on every plugin in registration order.
|
|
40
|
+
* A throwing hook aborts the bootstrap.
|
|
41
|
+
*/
|
|
42
|
+
loadAll(): Promise<void>;
|
|
43
|
+
/**
|
|
44
|
+
* Calls `onStart` on every plugin in registration order.
|
|
45
|
+
* Plugins with `failFast: true` rethrow (aborting boot); others log + skip.
|
|
46
|
+
*/
|
|
47
|
+
startAll(): Promise<void>;
|
|
48
|
+
/**
|
|
49
|
+
* Fail-soft: calls `onStop` on every plugin in **reverse** registration order.
|
|
50
|
+
* A throwing hook is logged + skipped.
|
|
51
|
+
* `reason` is forwarded to each plugin's `onStop(host, reason?)`.
|
|
52
|
+
*/
|
|
53
|
+
stopAll(reason?: string): Promise<void>;
|
|
54
|
+
/**
|
|
55
|
+
* Fail-soft: calls `onUnload` on every plugin in **reverse** registration order.
|
|
56
|
+
* A throwing hook is logged + skipped.
|
|
57
|
+
* `reason` is forwarded to each plugin's `onUnload(host, reason?)`.
|
|
58
|
+
*/
|
|
59
|
+
unloadAll(reason?: string): Promise<void>;
|
|
60
|
+
}
|
|
61
|
+
//# sourceMappingURL=host.d.ts.map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1,131 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Bare `PluginHost` — owns an insertion-ordered set of plugins and drives
|
|
3
|
+
* lifecycle fan-out (load → start → stop → unload) with fail-soft semantics
|
|
4
|
+
* for start/stop/unload and fail-fast for load.
|
|
5
|
+
*
|
|
6
|
+
* This is a runtime concern: it needs a logger and event bus, both provided
|
|
7
|
+
* by the application bootstrap. No capabilities, no trust ladder.
|
|
8
|
+
*
|
|
9
|
+
* @module application/plugins
|
|
10
|
+
*/
|
|
11
|
+
import { getLogger } from '../../logger.js';
|
|
12
|
+
// ── PluginHost ─────────────────────────────────────────────────────────────
|
|
13
|
+
/**
|
|
14
|
+
* Plugin host: registers plugins in insertion order and drives their lifecycle
|
|
15
|
+
* fan-out (load → start → stop → unload).
|
|
16
|
+
*
|
|
17
|
+
* The host stores `EventBus<EventMap>` (the base event contract) rather than
|
|
18
|
+
* a narrower `TEvents` subtype, because `EventBus` is invariant in its type
|
|
19
|
+
* parameter and plugins only need the base contract.
|
|
20
|
+
*/
|
|
21
|
+
export class PluginHost {
|
|
22
|
+
logger;
|
|
23
|
+
events;
|
|
24
|
+
_plugins = new Map();
|
|
25
|
+
constructor(events, opts) {
|
|
26
|
+
this.events = events;
|
|
27
|
+
this.logger = opts?.logger ?? getLogger('plugin-host');
|
|
28
|
+
}
|
|
29
|
+
// ── Registration ────────────────────────────────────────────────────
|
|
30
|
+
/** Register a plugin. Throws on duplicate name. */
|
|
31
|
+
register(plugin) {
|
|
32
|
+
if (this._plugins.has(plugin.name)) {
|
|
33
|
+
throw new Error(`Plugin already registered: ${plugin.name}`);
|
|
34
|
+
}
|
|
35
|
+
this._plugins.set(plugin.name, plugin);
|
|
36
|
+
}
|
|
37
|
+
/** Remove a plugin by name. No-op if absent. */
|
|
38
|
+
unregister(name) {
|
|
39
|
+
this._plugins.delete(name);
|
|
40
|
+
}
|
|
41
|
+
/** Check whether a plugin is registered. */
|
|
42
|
+
has(name) {
|
|
43
|
+
return this._plugins.has(name);
|
|
44
|
+
}
|
|
45
|
+
/** List registered plugins in registration order. */
|
|
46
|
+
list() {
|
|
47
|
+
const result = [];
|
|
48
|
+
for (const p of this._plugins.values()) {
|
|
49
|
+
result.push({ name: p.name, version: p.version });
|
|
50
|
+
}
|
|
51
|
+
return result;
|
|
52
|
+
}
|
|
53
|
+
// ── Lifecycle fan-out ───────────────────────────────────────────────
|
|
54
|
+
/**
|
|
55
|
+
* Fail-fast: calls `onLoad` on every plugin in registration order.
|
|
56
|
+
* A throwing hook aborts the bootstrap.
|
|
57
|
+
*/
|
|
58
|
+
async loadAll() {
|
|
59
|
+
for (const plugin of this._plugins.values()) {
|
|
60
|
+
this.logger.debug(`Loading plugin: ${plugin.name}`, { name: plugin.name });
|
|
61
|
+
await plugin.onLoad(this);
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* Calls `onStart` on every plugin in registration order.
|
|
66
|
+
* Plugins with `failFast: true` rethrow (aborting boot); others log + skip.
|
|
67
|
+
*/
|
|
68
|
+
async startAll() {
|
|
69
|
+
for (const plugin of this._plugins.values()) {
|
|
70
|
+
if (!plugin.onStart)
|
|
71
|
+
continue;
|
|
72
|
+
try {
|
|
73
|
+
this.logger.debug(`Starting plugin: ${plugin.name}`, { name: plugin.name });
|
|
74
|
+
await plugin.onStart(this);
|
|
75
|
+
}
|
|
76
|
+
catch (err) {
|
|
77
|
+
if (plugin.failFast) {
|
|
78
|
+
throw err;
|
|
79
|
+
}
|
|
80
|
+
this.logger.error(`Plugin start hook failed: ${plugin.name}`, {
|
|
81
|
+
name: plugin.name,
|
|
82
|
+
error: err.message,
|
|
83
|
+
});
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
/**
|
|
88
|
+
* Fail-soft: calls `onStop` on every plugin in **reverse** registration order.
|
|
89
|
+
* A throwing hook is logged + skipped.
|
|
90
|
+
* `reason` is forwarded to each plugin's `onStop(host, reason?)`.
|
|
91
|
+
*/
|
|
92
|
+
async stopAll(reason) {
|
|
93
|
+
const reversed = [...this._plugins.values()].reverse();
|
|
94
|
+
for (const plugin of reversed) {
|
|
95
|
+
if (!plugin.onStop)
|
|
96
|
+
continue;
|
|
97
|
+
try {
|
|
98
|
+
this.logger.debug(`Stopping plugin: ${plugin.name}`, { name: plugin.name, reason });
|
|
99
|
+
await plugin.onStop(this, reason);
|
|
100
|
+
}
|
|
101
|
+
catch (err) {
|
|
102
|
+
this.logger.error(`Plugin stop hook failed: ${plugin.name}`, {
|
|
103
|
+
name: plugin.name,
|
|
104
|
+
error: err.message,
|
|
105
|
+
});
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
/**
|
|
110
|
+
* Fail-soft: calls `onUnload` on every plugin in **reverse** registration order.
|
|
111
|
+
* A throwing hook is logged + skipped.
|
|
112
|
+
* `reason` is forwarded to each plugin's `onUnload(host, reason?)`.
|
|
113
|
+
*/
|
|
114
|
+
async unloadAll(reason) {
|
|
115
|
+
const reversed = [...this._plugins.values()].reverse();
|
|
116
|
+
for (const plugin of reversed) {
|
|
117
|
+
if (!plugin.onUnload)
|
|
118
|
+
continue;
|
|
119
|
+
try {
|
|
120
|
+
this.logger.debug(`Unloading plugin: ${plugin.name}`, { name: plugin.name, reason });
|
|
121
|
+
await plugin.onUnload(this, reason);
|
|
122
|
+
}
|
|
123
|
+
catch (err) {
|
|
124
|
+
this.logger.error(`Plugin unload hook failed: ${plugin.name}`, {
|
|
125
|
+
name: plugin.name,
|
|
126
|
+
error: err.message,
|
|
127
|
+
});
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/application/plugins/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,MAAM,QAAQ,CAAC;AACpC,YAAY,EAAE,MAAM,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC"}
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Portable plugin lifecycle contract.
|
|
3
|
+
*
|
|
4
|
+
* The `Plugin` interface is a minimal runtime-neutral lifecycle contract:
|
|
5
|
+
* no capabilities, no trust ladder, no manifest schema — just `onLoad` / `onUnload`
|
|
6
|
+
* and `onStart` / `onStop` hooks. Names are deliberately runtime-neutral so
|
|
7
|
+
* CLI and long-lived server apps share the same semantics.
|
|
8
|
+
*
|
|
9
|
+
* @module application/plugins
|
|
10
|
+
*/
|
|
11
|
+
import type { EventBus } from '../../event-bus/event-bus';
|
|
12
|
+
import type { EventMap } from '../../event-bus/types';
|
|
13
|
+
import type { Logger } from '../../logger';
|
|
14
|
+
/**
|
|
15
|
+
* Minimal plugin lifecycle contract.
|
|
16
|
+
*
|
|
17
|
+
* All hooks receive the host reference so a plugin can access the runtime
|
|
18
|
+
* logger, event bus, and other plugins.
|
|
19
|
+
*/
|
|
20
|
+
export interface Plugin {
|
|
21
|
+
/** Unique name. Used for dedup and lookup in the host. */
|
|
22
|
+
readonly name: string;
|
|
23
|
+
/** Semver-compatible version string. Informational only in this cut. */
|
|
24
|
+
readonly version: string;
|
|
25
|
+
/**
|
|
26
|
+
* When `true`, a throwing `onStart` aborts the bootstrap (fail-fast).
|
|
27
|
+
* When absent/false, a throwing `onStart` is logged and skipped (fail-soft).
|
|
28
|
+
* Has no effect on `loadAll` (always fail-fast) or `stopAll`/`unloadAll`
|
|
29
|
+
* (always fail-soft — teardown is best-effort).
|
|
30
|
+
*/
|
|
31
|
+
readonly failFast?: boolean;
|
|
32
|
+
/**
|
|
33
|
+
* Called during `PluginHost.loadAll()` — fail-fast.
|
|
34
|
+
* A throwing `onLoad` aborts the bootstrap.
|
|
35
|
+
*/
|
|
36
|
+
onLoad(host: PluginHost): void | Promise<void>;
|
|
37
|
+
/** Called during `PluginHost.unloadAll()` — fail-soft. */
|
|
38
|
+
onUnload?(host: PluginHost, reason?: string): void | Promise<void>;
|
|
39
|
+
/** Called during `PluginHost.startAll()` — fail-soft. */
|
|
40
|
+
onStart?(host: PluginHost): void | Promise<void>;
|
|
41
|
+
/** Called during `PluginHost.stopAll()` — fail-soft. */
|
|
42
|
+
onStop?(host: PluginHost, reason?: string): void | Promise<void>;
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* Summary view of a registered plugin (no references, just metadata).
|
|
46
|
+
*/
|
|
47
|
+
export interface PluginSummary {
|
|
48
|
+
readonly name: string;
|
|
49
|
+
readonly version: string;
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* Structural contract for the plugin host.
|
|
53
|
+
*
|
|
54
|
+
* This is the shape exposed on `ApplicationRuntime.pluginHost`. Consumers
|
|
55
|
+
* that need to register/unregister plugins at runtime use this interface.
|
|
56
|
+
*/
|
|
57
|
+
export interface PluginHost {
|
|
58
|
+
readonly logger: Logger;
|
|
59
|
+
readonly events: EventBus<EventMap>;
|
|
60
|
+
register(plugin: Plugin): void;
|
|
61
|
+
unregister(name: string): void;
|
|
62
|
+
has(name: string): boolean;
|
|
63
|
+
list(): readonly PluginSummary[];
|
|
64
|
+
loadAll(): Promise<void>;
|
|
65
|
+
startAll(): Promise<void>;
|
|
66
|
+
stopAll(reason?: string): Promise<void>;
|
|
67
|
+
unloadAll(reason?: string): Promise<void>;
|
|
68
|
+
}
|
|
69
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/application/plugins/types.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,2BAA2B,CAAC;AAC1D,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AACtD,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AAI3C;;;;;GAKG;AACH,MAAM,WAAW,MAAM;IACnB,0DAA0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AAC,CAAC;IAC1B,OAAO,CAAC,MAAM,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IACxC,SAAS,CAAC,MAAM,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;CAC7C"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Portable plugin lifecycle contract.
|
|
3
|
+
*
|
|
4
|
+
* The `Plugin` interface is a minimal runtime-neutral lifecycle contract:
|
|
5
|
+
* no capabilities, no trust ladder, no manifest schema — just `onLoad` / `onUnload`
|
|
6
|
+
* and `onStart` / `onStop` hooks. Names are deliberately runtime-neutral so
|
|
7
|
+
* CLI and long-lived server apps share the same semantics.
|
|
8
|
+
*
|
|
9
|
+
* @module application/plugins
|
|
10
|
+
*/
|
|
@@ -0,0 +1,195 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Portable application bootstrap types.
|
|
3
|
+
*
|
|
4
|
+
* These types define the DI contract for `runApplication` — a thin orchestration
|
|
5
|
+
* layer over existing ts-infra primitives. The portable subpath does not import
|
|
6
|
+
* any runtime-specific adapters; everything injectable comes through the options.
|
|
7
|
+
*
|
|
8
|
+
* @module application/types
|
|
9
|
+
*/
|
|
10
|
+
import type { EventBus } from '../event-bus/event-bus';
|
|
11
|
+
import type { BusLifecycleEvents, EventMap } from '../event-bus/types';
|
|
12
|
+
import type { InfraEvents } from '../events';
|
|
13
|
+
import type { Logger, LogLevel } from '../logger';
|
|
14
|
+
import type { SchedulerAdapter } from '../scheduler/types';
|
|
15
|
+
import type { PluginHost } from './plugins/host';
|
|
16
|
+
import type { Plugin } from './plugins/types';
|
|
17
|
+
/** Logging feature flags. */
|
|
18
|
+
export interface LoggingOptions {
|
|
19
|
+
/** Enable logging. Default `true`. */
|
|
20
|
+
enabled?: boolean;
|
|
21
|
+
/** Minimum log level. Default `'info'`. */
|
|
22
|
+
level?: LogLevel;
|
|
23
|
+
/** Enable console output. Default `true`. */
|
|
24
|
+
console?: boolean;
|
|
25
|
+
/**
|
|
26
|
+
* File sink writer. The portable bootstrap never opens files — the caller
|
|
27
|
+
* (or Node convenience subpath) provides a writer.
|
|
28
|
+
*/
|
|
29
|
+
fileSink?: (line: string) => void;
|
|
30
|
+
/** JSON Lines format. Default `true`. */
|
|
31
|
+
json?: boolean;
|
|
32
|
+
}
|
|
33
|
+
/** Event bus feature flags. */
|
|
34
|
+
export interface EventsOptions<TEvents extends EventMap = InfraEvents> {
|
|
35
|
+
/** Enable event bus. Default `true`. */
|
|
36
|
+
enabled?: boolean;
|
|
37
|
+
/** Create and attach a lifecycle bus. Default `true`. */
|
|
38
|
+
lifecycle?: boolean;
|
|
39
|
+
/** Attach default observers (log + telemetry). Default `true`. */
|
|
40
|
+
defaultObservers?: boolean;
|
|
41
|
+
/** Pre-built event bus (skips creation when provided). */
|
|
42
|
+
bus?: EventBus<TEvents>;
|
|
43
|
+
}
|
|
44
|
+
/** Telemetry feature flags. */
|
|
45
|
+
export interface TelemetryOptions {
|
|
46
|
+
/** Enable telemetry instrumentation. Default `true`. */
|
|
47
|
+
enabled?: boolean;
|
|
48
|
+
/** Service name for spans. Default `'ts-libs'`. */
|
|
49
|
+
serviceName?: string;
|
|
50
|
+
/** Deployment environment. Default `'development'`. */
|
|
51
|
+
environment?: string;
|
|
52
|
+
/** Capture sanitized SQL in DB spans. Default `false`. */
|
|
53
|
+
dbStatementDebug?: boolean;
|
|
54
|
+
}
|
|
55
|
+
/** Scheduler feature flags. */
|
|
56
|
+
export interface SchedulerOptions {
|
|
57
|
+
/** Enable scheduler. Default `false`. */
|
|
58
|
+
enabled?: boolean;
|
|
59
|
+
/** Injected adapter (skips noop default when provided). */
|
|
60
|
+
adapter?: SchedulerAdapter;
|
|
61
|
+
/** Cron entries to register: `[cron, action][]`. */
|
|
62
|
+
entries?: Array<[string, () => Promise<void>]>;
|
|
63
|
+
/** Start scheduler immediately after registration. Default `true` when enabled. */
|
|
64
|
+
autoStart?: boolean;
|
|
65
|
+
}
|
|
66
|
+
/**
|
|
67
|
+
* Fully-resolved bootstrap config (all optionals filled with defaults).
|
|
68
|
+
* Constructed internally by `resolveBootstrapConfig`.
|
|
69
|
+
*/
|
|
70
|
+
export interface ApplicationBootstrapConfig {
|
|
71
|
+
readonly logging: Readonly<Required<Pick<LoggingOptions, 'enabled' | 'level' | 'console' | 'json'>> & {
|
|
72
|
+
fileSink?: (line: string) => void;
|
|
73
|
+
}>;
|
|
74
|
+
readonly events: {
|
|
75
|
+
enabled: boolean;
|
|
76
|
+
lifecycle: boolean;
|
|
77
|
+
defaultObservers: boolean;
|
|
78
|
+
};
|
|
79
|
+
readonly telemetry: {
|
|
80
|
+
enabled: boolean;
|
|
81
|
+
serviceName: string;
|
|
82
|
+
environment: string;
|
|
83
|
+
dbStatementDebug: boolean;
|
|
84
|
+
};
|
|
85
|
+
readonly scheduler: {
|
|
86
|
+
enabled: boolean;
|
|
87
|
+
autoStart: boolean;
|
|
88
|
+
};
|
|
89
|
+
}
|
|
90
|
+
/** Services that may be pre-injected instead of created by the bootstrap. */
|
|
91
|
+
export interface ApplicationServices<TEvents extends EventMap = InfraEvents> {
|
|
92
|
+
logger?: Logger;
|
|
93
|
+
events?: EventBus<TEvents>;
|
|
94
|
+
lifecycleBus?: EventBus<BusLifecycleEvents>;
|
|
95
|
+
db?: DbAdapterLike;
|
|
96
|
+
scheduler?: SchedulerAdapter;
|
|
97
|
+
/** Pre-built plugin host (when injecting instead of constructing). */
|
|
98
|
+
pluginHost?: PluginHost;
|
|
99
|
+
}
|
|
100
|
+
/**
|
|
101
|
+
* Minimal DB adapter shape the bootstrap cares about: `close()` for lifecycle.
|
|
102
|
+
* This avoids importing `ts-db` (an optional peer) from the portable subpath.
|
|
103
|
+
*/
|
|
104
|
+
export interface DbAdapterLike {
|
|
105
|
+
close(): void;
|
|
106
|
+
}
|
|
107
|
+
/** Why the application is stopping. */
|
|
108
|
+
export type ApplicationStopReason = 'manual' | 'signal' | 'error' | 'shutdown';
|
|
109
|
+
/**
|
|
110
|
+
* Runtime handle returned by `runApplication`.
|
|
111
|
+
*
|
|
112
|
+
* Exposes all resolved services and a `stop()` method for graceful shutdown.
|
|
113
|
+
*/
|
|
114
|
+
export interface ApplicationRuntime<TAppConfig = unknown, TEvents extends EventMap = InfraEvents> {
|
|
115
|
+
/** Fully-resolved bootstrap config (feature flags + defaults). */
|
|
116
|
+
readonly config: ApplicationBootstrapConfig;
|
|
117
|
+
/** Caller-provided application config, or `undefined`. */
|
|
118
|
+
readonly appConfig: TAppConfig;
|
|
119
|
+
/** Structured logger. */
|
|
120
|
+
readonly logger: Logger;
|
|
121
|
+
/** Application event bus. */
|
|
122
|
+
readonly events: EventBus<TEvents>;
|
|
123
|
+
/** Lifecycle bus (when enabled). */
|
|
124
|
+
readonly lifecycleBus?: EventBus<BusLifecycleEvents>;
|
|
125
|
+
/** DB adapter (when enabled and injected). */
|
|
126
|
+
readonly db?: DbAdapterLike;
|
|
127
|
+
/** Scheduler adapter (when enabled). */
|
|
128
|
+
readonly scheduler?: SchedulerAdapter;
|
|
129
|
+
readonly pluginHost: PluginHost;
|
|
130
|
+
/** Graceful shutdown. Idempotent — safe to call multiple times. */
|
|
131
|
+
stop(reason?: ApplicationStopReason): Promise<void>;
|
|
132
|
+
}
|
|
133
|
+
/**
|
|
134
|
+
* Options for the portable `runApplication`.
|
|
135
|
+
*/
|
|
136
|
+
export interface ApplicationBootstrapOptions<TAppConfig = unknown, TEvents extends EventMap = InfraEvents> {
|
|
137
|
+
/** Bootstrap feature flags (partial — defaults applied internally). */
|
|
138
|
+
readonly config?: {
|
|
139
|
+
logging?: LoggingOptions;
|
|
140
|
+
events?: EventsOptions<TEvents>;
|
|
141
|
+
telemetry?: TelemetryOptions;
|
|
142
|
+
scheduler?: SchedulerOptions;
|
|
143
|
+
};
|
|
144
|
+
/** Already-resolved application config. Portable — no file reads. */
|
|
145
|
+
readonly appConfig?: TAppConfig;
|
|
146
|
+
/** Pre-built services to inject instead of creating defaults. */
|
|
147
|
+
readonly services?: Partial<ApplicationServices<TEvents>>;
|
|
148
|
+
/** Plugins to register and lifecycle-manage via PluginHost. */
|
|
149
|
+
readonly plugins?: Plugin[];
|
|
150
|
+
/** User callback: application logic. Called after all services are ready. */
|
|
151
|
+
readonly start: (app: ApplicationRuntime<TAppConfig, TEvents>) => Promise<void> | void;
|
|
152
|
+
/** User callback: cleanup before services shut down. */
|
|
153
|
+
readonly stop?: (app: ApplicationRuntime<TAppConfig, TEvents>, reason: ApplicationStopReason) => Promise<void> | void;
|
|
154
|
+
}
|
|
155
|
+
/**
|
|
156
|
+
* Validation result matching the structural `safeParse` pattern.
|
|
157
|
+
* Avoids hard-coupling to a specific validation library.
|
|
158
|
+
*/
|
|
159
|
+
export interface ConfigValidationResult<T> {
|
|
160
|
+
readonly success: boolean;
|
|
161
|
+
readonly data?: T;
|
|
162
|
+
readonly errors?: ReadonlyArray<{
|
|
163
|
+
path: string;
|
|
164
|
+
message: string;
|
|
165
|
+
}>;
|
|
166
|
+
}
|
|
167
|
+
/**
|
|
168
|
+
* Config validator: structural `safeParse`-compatible adapter.
|
|
169
|
+
* Accepts any validation library that produces `{ success, data?, errors? }`.
|
|
170
|
+
*/
|
|
171
|
+
export type ApplicationConfigValidator<TAppConfig> = {
|
|
172
|
+
safeParse(raw: unknown): ConfigValidationResult<TAppConfig>;
|
|
173
|
+
} | ((raw: unknown) => TAppConfig) | {
|
|
174
|
+
validate(raw: unknown): TAppConfig;
|
|
175
|
+
} | {
|
|
176
|
+
parse(raw: unknown): TAppConfig;
|
|
177
|
+
};
|
|
178
|
+
/**
|
|
179
|
+
* Config loader options for the Node/Bun convenience subpath.
|
|
180
|
+
*/
|
|
181
|
+
export interface ApplicationConfigLoader<TAppConfig = unknown> {
|
|
182
|
+
/** Path to the YAML config file. */
|
|
183
|
+
readonly configFile?: string;
|
|
184
|
+
/** YAML section name for bootstrap config. Default `'bootstrap'`. */
|
|
185
|
+
readonly bootstrapSection?: string;
|
|
186
|
+
/** YAML section name for app-specific config. Default: remaining object. */
|
|
187
|
+
readonly appSection?: string;
|
|
188
|
+
/** Caller-provided validator for the app config section. */
|
|
189
|
+
readonly appConfig?: ApplicationConfigValidator<TAppConfig>;
|
|
190
|
+
/** Override values merged after loading. */
|
|
191
|
+
readonly overrides?: Record<string, unknown>;
|
|
192
|
+
}
|
|
193
|
+
export type { BusLifecycleEvents, EventMap } from '../event-bus/types';
|
|
194
|
+
export type { InfraEvents } from '../events';
|
|
195
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/application/types.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,wBAAwB,CAAC;AACvD,OAAO,KAAK,EAAE,kBAAkB,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AACvE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AAC7C,OAAO,KAAK,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;AAClD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAC3D,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AACjD,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAC;AAI9C,6BAA6B;AAC7B,MAAM,WAAW,cAAc;IAC3B,sCAAsC;IACtC,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,2CAA2C;IAC3C,KAAK,CAAC,EAAE,QAAQ,CAAC;IACjB,6CAA6C;IAC7C,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB;;;OAGG;IACH,QAAQ,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;IAClC,yCAAyC;IACzC,IAAI,CAAC,EAAE,OAAO,CAAC;CAClB;AAED,+BAA+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|
|
1
|
+
/**
|
|
2
|
+
* Portable application bootstrap types.
|
|
3
|
+
*
|
|
4
|
+
* These types define the DI contract for `runApplication` — a thin orchestration
|
|
5
|
+
* layer over existing ts-infra primitives. The portable subpath does not import
|
|
6
|
+
* any runtime-specific adapters; everything injectable comes through the options.
|
|
7
|
+
*
|
|
8
|
+
* @module application/types
|
|
9
|
+
*/
|