@objectstack/core 2.0.4 → 2.0.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.
@@ -1,5 +1,5 @@
1
1
 
2
- > @objectstack/core@2.0.4 build /home/runner/work/spec/spec/packages/core
2
+ > @objectstack/core@2.0.6 build /home/runner/work/spec/spec/packages/core
3
3
  > tsup --config ../../tsup.config.ts
4
4
 
5
5
  CLI Building entry: src/index.ts
@@ -10,13 +10,13 @@
10
10
  CLI Cleaning output folder
11
11
  ESM Build start
12
12
  CJS Build start
13
- CJS dist/index.cjs 134.46 KB
14
- CJS dist/index.cjs.map 278.04 KB
15
- CJS ⚡️ Build success in 96ms
16
- ESM dist/index.js 131.69 KB
17
- ESM dist/index.js.map 276.68 KB
18
- ESM ⚡️ Build success in 97ms
13
+ CJS dist/index.cjs 136.06 KB
14
+ CJS dist/index.cjs.map 281.06 KB
15
+ CJS ⚡️ Build success in 108ms
16
+ ESM dist/index.js 133.29 KB
17
+ ESM dist/index.js.map 279.69 KB
18
+ ESM ⚡️ Build success in 108ms
19
19
  DTS Build start
20
- DTS ⚡️ Build success in 3175ms
21
- DTS dist/index.d.ts 52.28 KB
22
- DTS dist/index.d.cts 52.28 KB
20
+ DTS ⚡️ Build success in 3199ms
21
+ DTS dist/index.d.ts 52.98 KB
22
+ DTS dist/index.d.cts 52.98 KB
package/CHANGELOG.md CHANGED
@@ -1,5 +1,20 @@
1
1
  # @objectstack/core
2
2
 
3
+ ## 2.0.6
4
+
5
+ ### Patch Changes
6
+
7
+ - Patch release for maintenance and stability improvements
8
+ - Updated dependencies
9
+ - @objectstack/spec@2.0.6
10
+
11
+ ## 2.0.5
12
+
13
+ ### Patch Changes
14
+
15
+ - Updated dependencies
16
+ - @objectstack/spec@2.0.5
17
+
3
18
  ## 2.0.4
4
19
 
5
20
  ### Patch Changes
package/dist/index.cjs CHANGED
@@ -117,6 +117,20 @@ var ObjectKernelBase = class {
117
117
  return this.services.get(name);
118
118
  }
119
119
  },
120
+ replaceService: (name, implementation) => {
121
+ if (this.services instanceof Map) {
122
+ if (!this.services.has(name)) {
123
+ throw new Error(`[Kernel] Service '${name}' not found. Use registerService() to add new services.`);
124
+ }
125
+ this.services.set(name, implementation);
126
+ } else {
127
+ if (!this.services.has(name)) {
128
+ throw new Error(`[Kernel] Service '${name}' not found. Use registerService() to add new services.`);
129
+ }
130
+ this.services.register(name, implementation);
131
+ }
132
+ this.logger.info(`Service '${name}' replaced`, { service: name });
133
+ },
120
134
  hook: (name, handler) => {
121
135
  if (!this.hooks.has(name)) {
122
136
  this.hooks.set(name, []);
@@ -792,6 +806,17 @@ var PluginLoader = class {
792
806
  }
793
807
  this.serviceInstances.set(name, service);
794
808
  }
809
+ /**
810
+ * Replace an existing service instance.
811
+ * Used by optimization plugins to swap kernel internals.
812
+ * @throws Error if service does not exist
813
+ */
814
+ replaceService(name, service) {
815
+ if (!this.hasService(name)) {
816
+ throw new Error(`Service '${name}' not found`);
817
+ }
818
+ this.serviceInstances.set(name, service);
819
+ }
795
820
  /**
796
821
  * Check if a service is registered (either as instance or factory)
797
822
  */
@@ -1027,6 +1052,15 @@ var ObjectKernel = class {
1027
1052
  throw new Error(`[Kernel] Service '${name}' not found`);
1028
1053
  }
1029
1054
  },
1055
+ replaceService: (name, implementation) => {
1056
+ const hasService = this.services.has(name) || this.pluginLoader.hasService(name);
1057
+ if (!hasService) {
1058
+ throw new Error(`[Kernel] Service '${name}' not found. Use registerService() to add new services.`);
1059
+ }
1060
+ this.services.set(name, implementation);
1061
+ this.pluginLoader.replaceService(name, implementation);
1062
+ this.logger.info(`Service '${name}' replaced`, { service: name });
1063
+ },
1030
1064
  hook: (name, handler) => {
1031
1065
  if (!this.hooks.has(name)) {
1032
1066
  this.hooks.set(name, []);
@@ -2795,6 +2829,10 @@ var SecurePluginContext = class {
2795
2829
  this.permissionEnforcer.enforceServiceAccess(this.pluginName, name);
2796
2830
  return this.baseContext.getService(name);
2797
2831
  }
2832
+ replaceService(name, implementation) {
2833
+ this.permissionEnforcer.enforceServiceAccess(this.pluginName, name);
2834
+ this.baseContext.replaceService(name, implementation);
2835
+ }
2798
2836
  getServices() {
2799
2837
  return this.baseContext.getServices();
2800
2838
  }