@objectstack/core 4.0.1 → 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 +11 -11
- package/CHANGELOG.md +13 -0
- package/dist/index.cjs +66 -0
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +28 -1
- package/dist/index.d.ts +28 -1
- package/dist/index.js +65 -0
- package/dist/index.js.map +1 -1
- package/package.json +4 -4
- package/src/fallbacks/fallbacks.test.ts +2 -2
- package/src/fallbacks/index.ts +3 -0
- package/src/fallbacks/memory-metadata.ts +50 -0
- package/src/kernel.ts +28 -0
package/.turbo/turbo-build.log
CHANGED
|
@@ -1,22 +1,22 @@
|
|
|
1
1
|
|
|
2
|
-
> @objectstack/core@4.0.
|
|
2
|
+
> @objectstack/core@4.0.3 build /home/runner/work/framework/framework/packages/core
|
|
3
3
|
> tsup --config ../../tsup.config.ts
|
|
4
4
|
|
|
5
5
|
[34mCLI[39m Building entry: src/index.ts
|
|
6
6
|
[34mCLI[39m Using tsconfig: tsconfig.json
|
|
7
7
|
[34mCLI[39m tsup v8.5.1
|
|
8
|
-
[34mCLI[39m Using tsup config: /home/runner/work/
|
|
8
|
+
[34mCLI[39m Using tsup config: /home/runner/work/framework/framework/tsup.config.ts
|
|
9
9
|
[34mCLI[39m Target: es2020
|
|
10
10
|
[34mCLI[39m Cleaning output folder
|
|
11
11
|
[34mESM[39m Build start
|
|
12
12
|
[34mCJS[39m Build start
|
|
13
|
-
[32mESM[39m [1mdist/index.js [22m[
|
|
14
|
-
[32mESM[39m [1mdist/index.js.map [22m[
|
|
15
|
-
[32mESM[39m ⚡️ Build success in
|
|
16
|
-
[32mCJS[39m [1mdist/index.cjs [22m[
|
|
17
|
-
[32mCJS[39m [1mdist/index.cjs.map [22m[
|
|
18
|
-
[32mCJS[39m ⚡️ Build success in
|
|
13
|
+
[32mESM[39m [1mdist/index.js [22m[32m152.14 KB[39m
|
|
14
|
+
[32mESM[39m [1mdist/index.js.map [22m[32m322.73 KB[39m
|
|
15
|
+
[32mESM[39m ⚡️ Build success in 67ms
|
|
16
|
+
[32mCJS[39m [1mdist/index.cjs [22m[32m155.32 KB[39m
|
|
17
|
+
[32mCJS[39m [1mdist/index.cjs.map [22m[32m324.45 KB[39m
|
|
18
|
+
[32mCJS[39m ⚡️ Build success in 75ms
|
|
19
19
|
[34mDTS[39m Build start
|
|
20
|
-
[32mDTS[39m ⚡️ Build success in
|
|
21
|
-
[32mDTS[39m [1mdist/index.d.ts [22m[
|
|
22
|
-
[32mDTS[39m [1mdist/index.d.cts [22m[
|
|
20
|
+
[32mDTS[39m ⚡️ Build success in 2677ms
|
|
21
|
+
[32mDTS[39m [1mdist/index.d.ts [22m[32m64.24 KB[39m
|
|
22
|
+
[32mDTS[39m [1mdist/index.d.cts [22m[32m64.24 KB[39m
|
package/CHANGELOG.md
CHANGED
package/dist/index.cjs
CHANGED
|
@@ -57,6 +57,7 @@ __export(index_exports, {
|
|
|
57
57
|
createMemoryCache: () => createMemoryCache,
|
|
58
58
|
createMemoryI18n: () => createMemoryI18n,
|
|
59
59
|
createMemoryJob: () => createMemoryJob,
|
|
60
|
+
createMemoryMetadata: () => createMemoryMetadata,
|
|
60
61
|
createMemoryQueue: () => createMemoryQueue,
|
|
61
62
|
createPluginConfigValidator: () => createPluginConfigValidator,
|
|
62
63
|
createPluginPermissionEnforcer: () => createPluginPermissionEnforcer,
|
|
@@ -1156,8 +1157,50 @@ function createMemoryI18n() {
|
|
|
1156
1157
|
};
|
|
1157
1158
|
}
|
|
1158
1159
|
|
|
1160
|
+
// src/fallbacks/memory-metadata.ts
|
|
1161
|
+
function createMemoryMetadata() {
|
|
1162
|
+
const store = /* @__PURE__ */ new Map();
|
|
1163
|
+
function getTypeMap(type) {
|
|
1164
|
+
let map = store.get(type);
|
|
1165
|
+
if (!map) {
|
|
1166
|
+
map = /* @__PURE__ */ new Map();
|
|
1167
|
+
store.set(type, map);
|
|
1168
|
+
}
|
|
1169
|
+
return map;
|
|
1170
|
+
}
|
|
1171
|
+
return {
|
|
1172
|
+
_fallback: true,
|
|
1173
|
+
_serviceName: "metadata",
|
|
1174
|
+
async register(type, name, data) {
|
|
1175
|
+
getTypeMap(type).set(name, data);
|
|
1176
|
+
},
|
|
1177
|
+
async get(type, name) {
|
|
1178
|
+
return getTypeMap(type).get(name);
|
|
1179
|
+
},
|
|
1180
|
+
async list(type) {
|
|
1181
|
+
return Array.from(getTypeMap(type).values());
|
|
1182
|
+
},
|
|
1183
|
+
async unregister(type, name) {
|
|
1184
|
+
getTypeMap(type).delete(name);
|
|
1185
|
+
},
|
|
1186
|
+
async exists(type, name) {
|
|
1187
|
+
return getTypeMap(type).has(name);
|
|
1188
|
+
},
|
|
1189
|
+
async listNames(type) {
|
|
1190
|
+
return Array.from(getTypeMap(type).keys());
|
|
1191
|
+
},
|
|
1192
|
+
async getObject(name) {
|
|
1193
|
+
return getTypeMap("object").get(name);
|
|
1194
|
+
},
|
|
1195
|
+
async listObjects() {
|
|
1196
|
+
return Array.from(getTypeMap("object").values());
|
|
1197
|
+
}
|
|
1198
|
+
};
|
|
1199
|
+
}
|
|
1200
|
+
|
|
1159
1201
|
// src/fallbacks/index.ts
|
|
1160
1202
|
var CORE_FALLBACK_FACTORIES = {
|
|
1203
|
+
metadata: createMemoryMetadata,
|
|
1161
1204
|
cache: createMemoryCache,
|
|
1162
1205
|
queue: createMemoryQueue,
|
|
1163
1206
|
job: createMemoryJob,
|
|
@@ -1294,6 +1337,27 @@ var ObjectKernel = class {
|
|
|
1294
1337
|
});
|
|
1295
1338
|
return this;
|
|
1296
1339
|
}
|
|
1340
|
+
/**
|
|
1341
|
+
* Pre-inject in-memory fallbacks for 'core' services that were not registered
|
|
1342
|
+
* by plugins during Phase 1. Called before Phase 2 so that all core services
|
|
1343
|
+
* (e.g. 'metadata', 'cache', 'queue') are resolvable via ctx.getService()
|
|
1344
|
+
* when plugin start() methods execute.
|
|
1345
|
+
*/
|
|
1346
|
+
preInjectCoreFallbacks() {
|
|
1347
|
+
if (this.config.skipSystemValidation) return;
|
|
1348
|
+
for (const [serviceName, criticality] of Object.entries(import_system.ServiceRequirementDef)) {
|
|
1349
|
+
if (criticality !== "core") continue;
|
|
1350
|
+
const hasService = this.services.has(serviceName) || this.pluginLoader.hasService(serviceName);
|
|
1351
|
+
if (!hasService) {
|
|
1352
|
+
const factory = CORE_FALLBACK_FACTORIES[serviceName];
|
|
1353
|
+
if (factory) {
|
|
1354
|
+
const fallback = factory();
|
|
1355
|
+
this.registerService(serviceName, fallback);
|
|
1356
|
+
this.logger.debug(`[Kernel] Pre-injected in-memory fallback for '${serviceName}' before Phase 2`);
|
|
1357
|
+
}
|
|
1358
|
+
}
|
|
1359
|
+
}
|
|
1360
|
+
}
|
|
1297
1361
|
/**
|
|
1298
1362
|
* Validate Critical System Requirements
|
|
1299
1363
|
*/
|
|
@@ -1355,6 +1419,7 @@ var ObjectKernel = class {
|
|
|
1355
1419
|
for (const plugin of orderedPlugins) {
|
|
1356
1420
|
await this.initPluginWithTimeout(plugin);
|
|
1357
1421
|
}
|
|
1422
|
+
this.preInjectCoreFallbacks();
|
|
1358
1423
|
this.logger.info("Phase 2: Start plugins");
|
|
1359
1424
|
this.state = "running";
|
|
1360
1425
|
for (const plugin of orderedPlugins) {
|
|
@@ -4986,6 +5051,7 @@ var PackageManager = class {
|
|
|
4986
5051
|
createMemoryCache,
|
|
4987
5052
|
createMemoryI18n,
|
|
4988
5053
|
createMemoryJob,
|
|
5054
|
+
createMemoryMetadata,
|
|
4989
5055
|
createMemoryQueue,
|
|
4990
5056
|
createPluginConfigValidator,
|
|
4991
5057
|
createPluginPermissionEnforcer,
|