@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.
@@ -1,22 +1,22 @@
1
1
 
2
- > @objectstack/core@4.0.1 build /home/runner/work/spec/spec/packages/core
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
  CLI Building entry: src/index.ts
6
6
  CLI Using tsconfig: tsconfig.json
7
7
  CLI tsup v8.5.1
8
- CLI Using tsup config: /home/runner/work/spec/spec/tsup.config.ts
8
+ CLI Using tsup config: /home/runner/work/framework/framework/tsup.config.ts
9
9
  CLI Target: es2020
10
10
  CLI Cleaning output folder
11
11
  ESM Build start
12
12
  CJS Build start
13
- ESM dist/index.js 150.14 KB
14
- ESM dist/index.js.map 318.23 KB
15
- ESM ⚡️ Build success in 112ms
16
- CJS dist/index.cjs 153.26 KB
17
- CJS dist/index.cjs.map 319.94 KB
18
- CJS ⚡️ Build success in 112ms
13
+ ESM dist/index.js 152.14 KB
14
+ ESM dist/index.js.map 322.73 KB
15
+ ESM ⚡️ Build success in 67ms
16
+ CJS dist/index.cjs 155.32 KB
17
+ CJS dist/index.cjs.map 324.45 KB
18
+ CJS ⚡️ Build success in 75ms
19
19
  DTS Build start
20
- DTS ⚡️ Build success in 3328ms
21
- DTS dist/index.d.ts 63.13 KB
22
- DTS dist/index.d.cts 63.13 KB
20
+ DTS ⚡️ Build success in 2677ms
21
+ DTS dist/index.d.ts 64.24 KB
22
+ DTS dist/index.d.cts 64.24 KB
package/CHANGELOG.md CHANGED
@@ -1,5 +1,18 @@
1
1
  # @objectstack/core
2
2
 
3
+ ## 4.0.3
4
+
5
+ ### Patch Changes
6
+
7
+ - @objectstack/spec@4.0.3
8
+
9
+ ## 4.0.2
10
+
11
+ ### Patch Changes
12
+
13
+ - Updated dependencies [5f659e9]
14
+ - @objectstack/spec@4.0.2
15
+
3
16
  ## 4.0.0
4
17
 
5
18
  ### Minor Changes
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,