@almadar/runtime 2.2.2 → 2.4.0

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,4 +1,4 @@
1
- import { I as IEventBus } from './types-E5o2Jqe6.js';
1
+ import { I as IEventBus } from './types-BrbvZxzX.js';
2
2
 
3
3
  /**
4
4
  * ServerBridge - Client-Server Trait Communication
@@ -549,8 +549,8 @@ var StateMachineManager = class {
549
549
 
550
550
  // src/types.ts
551
551
  var HANDLER_MANIFEST = {
552
- client: ["render-ui", "render", "navigate", "notify", "emit", "set", "log"],
553
- server: ["persist", "fetch", "call-service", "emit", "set", "spawn", "despawn", "log", "os/watch-files", "os/watch-process", "os/watch-port", "os/watch-http", "os/watch-cron", "os/watch-signal", "os/watch-env", "os/debounce"],
552
+ client: ["render-ui", "render", "navigate", "notify", "emit", "set", "log", "ref", "deref", "watch"],
553
+ server: ["persist", "fetch", "call-service", "emit", "set", "spawn", "despawn", "log", "ref", "deref", "swap!", "atomic", "os/watch-files", "os/watch-process", "os/watch-port", "os/watch-http", "os/watch-cron", "os/watch-signal", "os/watch-env", "os/debounce"],
554
554
  test: [
555
555
  "render-ui",
556
556
  "render",
@@ -563,9 +563,14 @@ var HANDLER_MANIFEST = {
563
563
  "call-service",
564
564
  "spawn",
565
565
  "despawn",
566
- "log"
566
+ "log",
567
+ "ref",
568
+ "deref",
569
+ "swap!",
570
+ "watch",
571
+ "atomic"
567
572
  ],
568
- ssr: ["render-ui", "render", "fetch", "emit", "set", "log"]
573
+ ssr: ["render-ui", "render", "fetch", "emit", "set", "log", "ref", "deref"]
569
574
  };
570
575
 
571
576
  // src/EffectExecutor.ts
@@ -650,7 +655,12 @@ var EffectExecutor = class {
650
655
  "render": this.handlers.renderUI,
651
656
  "navigate": this.handlers.navigate,
652
657
  "notify": this.handlers.notify,
653
- "log": this.handlers.log
658
+ "log": this.handlers.log,
659
+ "ref": this.handlers.ref,
660
+ "deref": this.handlers.deref,
661
+ "swap!": this.handlers.swap,
662
+ "watch": this.handlers.watch,
663
+ "atomic": this.handlers.atomic
654
664
  };
655
665
  for (const [name, handler] of Object.entries(handlerMap)) {
656
666
  if (handler) {
@@ -792,6 +802,70 @@ var EffectExecutor = class {
792
802
  }
793
803
  break;
794
804
  }
805
+ // === Resource Operators ===
806
+ case "ref": {
807
+ if (this.handlers.ref) {
808
+ const refEntityType = args[0];
809
+ const refOptions = args[1];
810
+ await this.handlers.ref(refEntityType, refOptions);
811
+ } else if (this.handlers.fetch) {
812
+ const refEntityType = args[0];
813
+ const refOptions = args[1];
814
+ await this.handlers.fetch(refEntityType, refOptions);
815
+ } else {
816
+ this.logUnsupported("ref");
817
+ }
818
+ break;
819
+ }
820
+ case "deref": {
821
+ if (this.handlers.deref) {
822
+ const derefEntityType = args[0];
823
+ const derefOptions = args[1];
824
+ await this.handlers.deref(derefEntityType, derefOptions);
825
+ } else if (this.handlers.fetch) {
826
+ const derefEntityType = args[0];
827
+ const derefOptions = args[1];
828
+ await this.handlers.fetch(derefEntityType, derefOptions);
829
+ } else {
830
+ this.logUnsupported("deref");
831
+ }
832
+ break;
833
+ }
834
+ case "swap!": {
835
+ if (this.handlers.swap) {
836
+ const swapEntityType = args[0];
837
+ const swapEntityId = args[1];
838
+ const swapTransform = args[2];
839
+ await this.handlers.swap(swapEntityType, swapEntityId, swapTransform);
840
+ } else {
841
+ this.logUnsupported("swap!");
842
+ }
843
+ break;
844
+ }
845
+ case "watch": {
846
+ if (this.handlers.watch) {
847
+ const watchEntityType = args[0];
848
+ const watchOptions = args[1];
849
+ this.handlers.watch(watchEntityType, watchOptions);
850
+ } else {
851
+ if (this.debug) {
852
+ console.log("[EffectExecutor] watch is a no-op on server:", args[0]);
853
+ }
854
+ }
855
+ break;
856
+ }
857
+ case "atomic": {
858
+ if (this.handlers.atomic) {
859
+ const atomicEffects = args;
860
+ await this.handlers.atomic(atomicEffects);
861
+ } else {
862
+ const atomicEffects = args;
863
+ for (const inner of atomicEffects) {
864
+ await this.execute(inner);
865
+ }
866
+ }
867
+ break;
868
+ }
795
869
  case "spawn": {
796
870
  if (this.handlers.spawn) {
797
871
  const entityType = args[0];
@@ -2185,5 +2259,5 @@ function parseNamespacedEvent(eventName) {
2185
2259
  }
2186
2260
 
2187
2261
  export { EffectExecutor, EventBus, HANDLER_MANIFEST, StateMachineManager, containsBindings, createContextFromBindings, createInitialTraitState, createTestExecutor, createUnifiedLoader, extractBindings, findInitialState, findTransition, getIsolatedCollectionName, getNamespacedEvent, interpolateProps, interpolateValue, isNamespacedEvent, normalizeEventKey, parseNamespacedEvent, preprocessSchema, processEvent };
2188
- //# sourceMappingURL=chunk-57PUFAKH.js.map
2189
- //# sourceMappingURL=chunk-57PUFAKH.js.map
2262
+ //# sourceMappingURL=chunk-GCRRQAGZ.js.map
2263
+ //# sourceMappingURL=chunk-GCRRQAGZ.js.map