@objectstack/core 4.0.2 → 4.0.3
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/.turbo/turbo-build.log +10 -10
- package/CHANGELOG.md +6 -0
- package/dist/index.cjs +22 -0
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +7 -0
- package/dist/index.d.ts +7 -0
- package/dist/index.js +22 -0
- package/dist/index.js.map +1 -1
- package/package.json +4 -4
- package/src/kernel.ts +28 -0
package/dist/index.d.cts
CHANGED
|
@@ -222,6 +222,13 @@ declare class ObjectKernel {
|
|
|
222
222
|
* Register a service factory with lifecycle management
|
|
223
223
|
*/
|
|
224
224
|
registerServiceFactory<T>(name: string, factory: ServiceFactory<T>, lifecycle?: ServiceLifecycle, dependencies?: string[]): this;
|
|
225
|
+
/**
|
|
226
|
+
* Pre-inject in-memory fallbacks for 'core' services that were not registered
|
|
227
|
+
* by plugins during Phase 1. Called before Phase 2 so that all core services
|
|
228
|
+
* (e.g. 'metadata', 'cache', 'queue') are resolvable via ctx.getService()
|
|
229
|
+
* when plugin start() methods execute.
|
|
230
|
+
*/
|
|
231
|
+
private preInjectCoreFallbacks;
|
|
225
232
|
/**
|
|
226
233
|
* Validate Critical System Requirements
|
|
227
234
|
*/
|
package/dist/index.d.ts
CHANGED
|
@@ -222,6 +222,13 @@ declare class ObjectKernel {
|
|
|
222
222
|
* Register a service factory with lifecycle management
|
|
223
223
|
*/
|
|
224
224
|
registerServiceFactory<T>(name: string, factory: ServiceFactory<T>, lifecycle?: ServiceLifecycle, dependencies?: string[]): this;
|
|
225
|
+
/**
|
|
226
|
+
* Pre-inject in-memory fallbacks for 'core' services that were not registered
|
|
227
|
+
* by plugins during Phase 1. Called before Phase 2 so that all core services
|
|
228
|
+
* (e.g. 'metadata', 'cache', 'queue') are resolvable via ctx.getService()
|
|
229
|
+
* when plugin start() methods execute.
|
|
230
|
+
*/
|
|
231
|
+
private preInjectCoreFallbacks;
|
|
225
232
|
/**
|
|
226
233
|
* Validate Critical System Requirements
|
|
227
234
|
*/
|
package/dist/index.js
CHANGED
|
@@ -1271,6 +1271,27 @@ var ObjectKernel = class {
|
|
|
1271
1271
|
});
|
|
1272
1272
|
return this;
|
|
1273
1273
|
}
|
|
1274
|
+
/**
|
|
1275
|
+
* Pre-inject in-memory fallbacks for 'core' services that were not registered
|
|
1276
|
+
* by plugins during Phase 1. Called before Phase 2 so that all core services
|
|
1277
|
+
* (e.g. 'metadata', 'cache', 'queue') are resolvable via ctx.getService()
|
|
1278
|
+
* when plugin start() methods execute.
|
|
1279
|
+
*/
|
|
1280
|
+
preInjectCoreFallbacks() {
|
|
1281
|
+
if (this.config.skipSystemValidation) return;
|
|
1282
|
+
for (const [serviceName, criticality] of Object.entries(ServiceRequirementDef)) {
|
|
1283
|
+
if (criticality !== "core") continue;
|
|
1284
|
+
const hasService = this.services.has(serviceName) || this.pluginLoader.hasService(serviceName);
|
|
1285
|
+
if (!hasService) {
|
|
1286
|
+
const factory = CORE_FALLBACK_FACTORIES[serviceName];
|
|
1287
|
+
if (factory) {
|
|
1288
|
+
const fallback = factory();
|
|
1289
|
+
this.registerService(serviceName, fallback);
|
|
1290
|
+
this.logger.debug(`[Kernel] Pre-injected in-memory fallback for '${serviceName}' before Phase 2`);
|
|
1291
|
+
}
|
|
1292
|
+
}
|
|
1293
|
+
}
|
|
1294
|
+
}
|
|
1274
1295
|
/**
|
|
1275
1296
|
* Validate Critical System Requirements
|
|
1276
1297
|
*/
|
|
@@ -1332,6 +1353,7 @@ var ObjectKernel = class {
|
|
|
1332
1353
|
for (const plugin of orderedPlugins) {
|
|
1333
1354
|
await this.initPluginWithTimeout(plugin);
|
|
1334
1355
|
}
|
|
1356
|
+
this.preInjectCoreFallbacks();
|
|
1335
1357
|
this.logger.info("Phase 2: Start plugins");
|
|
1336
1358
|
this.state = "running";
|
|
1337
1359
|
for (const plugin of orderedPlugins) {
|