orchestore 0.1.6 → 0.1.7

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/README.md CHANGED
@@ -51,8 +51,9 @@ The goal is simple:
51
51
  - [Mutations](#mutations)
52
52
  - [Methods](#methods)
53
53
  - [Computed State (Planned)](#computed-state-planned)
54
- - [Nested Slices (Planned)](#nested-slices-planned)
55
- - [Runtime Paths](#runtime-paths-planned)
54
+ - [Nested Slices](#nested-slices)
55
+ - [Reusing Slices](#reusing-slices)
56
+ - [Runtime Paths](#runtime-paths)
56
57
 
57
58
  - [State Access & Subscriptions](#state-access--subscriptions)
58
59
  - [State Snapshots](#state-snapshots)
@@ -66,6 +67,12 @@ The goal is simple:
66
67
  - [Accessing Store from Slices](#accessing-store-from-slices)
67
68
  - [Root Store Type Extension (Planned)](#root-store-type-extension-planned)
68
69
 
70
+ - [Lineage & Clones](#lineage--clones)
71
+ - [Automatic Cloning](#automatic-cloning)
72
+ - [Manual Cloning](#manual-cloning)
73
+ - [Inspecting a Lineage](#inspecting-a-lineage)
74
+ - [Definition Type Checking](#definition-type-checking)
75
+
69
76
  - [Global Utilities](#global-utilities)
70
77
  - [Accessing Global Utilities](#accessing-global-utilities)
71
78
  - [Utilities Type Extension](#utilities-type-extension)
@@ -119,16 +126,17 @@ This allows state and application logic to evolve together within the same domai
119
126
 
120
127
  Many common Redux patterns are automated by default:
121
128
 
122
- | Traditional Redux Pattern | OrcheStore |
123
- | ----------------------------- | ------------------------- |
124
- | Action creators | Direct callable mutations |
125
- | Thunks | Built-in methods |
126
- | Dispatch calls | Direct function calls |
127
- | `PayloadAction` wrappers | Native function arguments |
128
- | Cross-slice imports | Root store access |
129
- | Shared service wiring | Global utilities |
130
- | Manual state tree composition | Nested slices |
131
- | Complex type declarations | Automatic inference |
129
+ | Traditional Redux Pattern | OrcheStore |
130
+ | ----------------------------- | ----------------------------------------------- |
131
+ | Action creators | Direct callable mutations |
132
+ | Thunks | Built-in methods |
133
+ | Dispatch calls | Direct function calls |
134
+ | `PayloadAction` wrappers | Native function arguments |
135
+ | Cross-slice imports | Root store access |
136
+ | Shared service wiring | Global utilities |
137
+ | Manual state tree composition | Nested slices with automatic cloning & isolation |
138
+ | Complex type declarations | Automatic inference |
139
+ | Instance identity management | Lineage-based slice model (shared definition, isolated mounts) |
132
140
 
133
141
  The result is a simpler architecture with fewer moving parts, less boilerplate, and a more direct development experience.
134
142
 
@@ -140,33 +148,35 @@ OrcheStore builds on top of Redux Toolkit while providing a higher-level API for
140
148
 
141
149
  | Feature | OrcheStore | Redux Toolkit |
142
150
  | ------------------------------ | ---------- | ------------- |
143
- | Direct callable mutations | ✅ | ❌ |
144
151
  | Multiple mutation arguments | ✅ | ❌ |
145
- | Dispatch required | | |
152
+ | Direct callable mutations | | |
146
153
  | `PayloadAction` wrappers | ❌ | ✅ |
154
+ | Dispatch required | ❌ | ✅ |
147
155
  | Built-in orchestration methods | ✅ | ❌ |
148
- | Nested slice composition | Planned | ⚠️ Manual |
149
- | Automatic path generation | ⌛ Planned | ⚠️ Manual |
156
+ | Nested slice composition | (isolated context) | ⚠️ Manual (shared state) |
157
+ | Automatic path generation | | ⚠️ Manual |
150
158
  | Global utilities | ✅ | ❌ |
151
159
  | Unified slice API | ✅ | ❌ |
152
160
  | Per-slice React hooks | ✅ | ❌ |
153
161
  | Deep TypeScript inference | ✅ | ⚠️ Partial |
162
+ | Lineage & cloning model | ✅ | ❌ |
154
163
 
155
164
  OrcheStore does not replace Redux Toolkit. Instead, it builds on top of it by automating common patterns and providing a more cohesive developer experience.
156
165
 
157
166
  ## Architecture Overview
158
167
 
159
- | Layer | Responsibility |
160
- | ----------- | ------------------------------ |
161
- | `name` | Unique slice identifier |
162
- | `state` | Slice data storage definition |
163
- | `mutations` | Synchronous state transitions |
164
- | `methods` | Orchestration and side effects |
165
- | `computed` | Derived and computed state |
166
- | `children` | Nested slice composition |
167
- | `getState` | Imperative state access |
168
- | `useSelect` | Reactive state subscriptions |
169
- | `getPath` | Hierarchical slice path |
168
+ | Layer | Responsibility |
169
+ | ----------- | ---------------------------------------- |
170
+ | `name` | Unique slice identifier |
171
+ | `path` | Hierarchical slice path |
172
+ | `state` | Slice data storage definition |
173
+ | `mutations` | Synchronous state transitions |
174
+ | `methods` | Orchestration and side effects |
175
+ | `computed` | Derived and computed state |
176
+ | `children` | Nested slice composition |
177
+ | `getState` | Imperative state access |
178
+ | `useSelect` | Reactive state subscriptions |
179
+ | `prototype` | Lineage, cloning, and instance utilities |
170
180
 
171
181
  ---
172
182
 
@@ -345,7 +355,6 @@ export default function App() {
345
355
  OrcheStore exposes direct usable child slices through a unified store instance.
346
356
 
347
357
  ```tsx
348
- // store.counter is equivalent to counter, import only one and use it
349
358
  import { store } from "./store/index";
350
359
  import { counter } from "./store/counterSlice";
351
360
 
@@ -365,6 +374,10 @@ export function CounterComponent() {
365
374
  }
366
375
  ```
367
376
 
377
+ > 📌 If the slice is mounted only once, `store.counter` and `counter` refer to the same runtime instance and can be used interchangeably.
378
+ >
379
+ > 🔄 When a slice is mounted multiple times, each mount receives its own isolated instance. See [Reusing Slices](#reusing-slices) and [Lineage & Clones](#lineage--clones) for details.
380
+
368
381
  ---
369
382
 
370
383
  # Slice Layers
@@ -385,7 +398,7 @@ const counter = createSlice({
385
398
 
386
399
  methods: {},
387
400
 
388
- children: {}, // Planned
401
+ children: {},
389
402
 
390
403
  subscribe: {}, // Planned
391
404
  });
@@ -605,80 +618,127 @@ This currently not supported
605
618
 
606
619
  ---
607
620
 
608
- ## Nested Slices (Planned)
609
-
610
- This currently not supported
621
+ ## Nested Slices
611
622
 
612
- ~~Slices can be composed by registering other slices through the `children` property.~~
623
+ Slices can be composed by registering other slice instances through the `children` property.
613
624
 
614
- ~~This allows related state and behavior to be organized into a hierarchical structure while preserving full type inference.~~
625
+ This allows related state and behavior to be organized into a hierarchical structure while preserving full type inference and ownership isolation.
615
626
 
616
627
  ```ts
617
- // import { counter } from "./counterSlice";
618
- // import { users } from "./usersSlice";
628
+ import { products } from "./productsSlice";
629
+ import { categories } from "./categoriesSlice";
619
630
 
620
- // export const app = createSlice({
621
- // name: "app",
631
+ export const shop = createSlice({
632
+ name: "shop",
622
633
 
623
- // state: {},
634
+ state: {},
624
635
 
625
- // children: {
626
- // counter,
627
- // users,
628
- // },
629
- // });
636
+ children: {
637
+ products,
638
+ categories,
639
+ },
640
+ });
641
+ ```
642
+
643
+ **Accessing Child Slices:**
644
+
645
+ Child slices are exposed directly on their parent slice.
646
+
647
+ ```ts
648
+ shop.products.add(...)
649
+ shop.categories.create(...)
650
+
651
+ console.log(shop.products.getState());
630
652
  ```
631
653
 
632
- **~~Rules:~~**
654
+ Deeply nested slice hierarchies are fully supported.
655
+
656
+ ```ts
657
+ admin.users.permissions.grant(...);
658
+
659
+ console.log(admin.users.permissions.getState());
660
+ ```
633
661
 
634
- - ~~A slice instance can only be registered once within the same state tree~~
635
- - ~~Existing slice instances cannot be wrapped again with `createSlice`~~
636
- - ~~Child slices must be registered through the `children` property~~
662
+ ### Reusing Slices
637
663
 
638
- **~~Accessing Child Slices:~~**
664
+ A slice can be mounted multiple times within the same tree.
639
665
 
640
- ~~Child slices are exposed directly on their parent slice.~~
666
+ When the same slice definition is reused, OrcheStore automatically creates a separate mounted instance for each location.
641
667
 
642
668
  ```ts
643
- // app.counter.increment(1);
669
+ const paginationSlice = createSlice({ ... });
644
670
 
645
- // console.log(app.counter.getState());
671
+ const shopSlice = createSlice({
672
+ name: "shop",
673
+
674
+ state: {},
675
+
676
+ children: {
677
+ categories: paginationSlice,
678
+ products: paginationSlice,
679
+ },
680
+ });
681
+
682
+ const adminSlice = createSlice({
683
+ name: "admin",
684
+
685
+ state: {},
686
+
687
+ children: {
688
+ products: paginationSlice,
689
+ },
690
+ });
646
691
  ```
647
692
 
648
- ~~Deeply nested slice hierarchies are fully supported.~~
693
+ Each mounted instance has:
694
+
695
+ - its own path
696
+ - its own ownership context
697
+ - its own runtime state
698
+
699
+ **Runtime identity:**
700
+
701
+ Although all mounted slices originate from `paginationSlice`, they are not necessarily the same runtime instance.
649
702
 
650
703
  ```ts
651
- // admin.users.permissions.grant(...);
704
+ paginationSlice === shopSlice.categories; // First mount uses the original instance
705
+
706
+ paginationSlice !== shopSlice.products; // Different mount location creates a clone
707
+ paginationSlice !== adminSlice.products; // Different mount location creates a clone
652
708
 
653
- // console.log(admin.users.permissions.getState());
709
+ shopSlice.products !== adminSlice.products; // Independent mounted clones
654
710
  ```
655
711
 
656
- ### Runtime Paths (Planned)
712
+ Every mount location receives its own isolated instance.
657
713
 
658
- ~~Every slice exposes a runtime path through `getPath`.~~
714
+ For a deeper explanation of how slice reuse works, see [Lineage & Clones](#lineage--clones).
715
+
716
+ ### Runtime Paths
717
+
718
+ Every slice exposes a runtime path through `slice.path`.
659
719
 
660
720
  ```ts
661
- // store.counter.name; // "counter"
662
- // store.counter.getPath(); // "counter"
721
+ store.counter.name; // "counter"
722
+ store.counter.path; // "counter"
663
723
  ```
664
724
 
665
- ~~Nested slices automatically inherit their parent path.~~
725
+ Nested slices automatically inherit their parent path.
666
726
 
667
727
  ```ts
668
- // store.admin.users.name; // "users"
669
- // store.admin.users.getPath(); // "admin.users"
728
+ store.admin.users.name; // "users"
729
+ store.admin.users.path; // "admin.users"
670
730
 
671
- // store.admin.users.permissions.name; // "permissions"
672
- // store.admin.users.permissions.getPath(); // "admin.users.permissions"
731
+ store.admin.users.permissions.name; // "permissions"
732
+ store.admin.users.permissions.path; // "admin.users.permissions"
673
733
  ```
674
734
 
675
- **~~Notes:~~**
735
+ **Notes:**
676
736
 
677
- ~~Paths are generated automatically from the slice hierarchy.~~
737
+ Paths are generated automatically from the slice hierarchy.
678
738
 
679
- ~~OrcheStore builds on the same concepts as Redux Toolkit's `reducerPath` and `combinedReducers`, but automates path generation, reducer registration, and nested slice composition.~~
739
+ OrcheStore builds on the same concepts as Redux Toolkit's `reducerPath` and `combineReducers`, but automates path generation, reducer registration, and nested slice composition.
680
740
 
681
- ~~No manual path configuration or reducer injection is required.~~
741
+ No manual path configuration or reducer injection is required.
682
742
 
683
743
  ---
684
744
 
@@ -906,6 +966,158 @@ this.root; // After: fully typed store
906
966
 
907
967
  ---
908
968
 
969
+ # Lineage & Clones
970
+
971
+ OrcheStore uses a lineage-based model for slice identity.
972
+
973
+ **Why?**
974
+
975
+ Slices can be used in multiple places in the store tree.
976
+
977
+ When this happens, OrcheStore creates a separate runtime instance for each usage. These instances are called **clones**.
978
+
979
+ A clone is an independent instance copy of a slice at runtime. It has its own state and runs separately from other clones, while still remaining part of a shared lineage.
980
+
981
+ A lineage (or family) is the set of all instances that come from the same slice definition.
982
+
983
+ **This means:**
984
+
985
+ - slices are not singletons
986
+ - a slice can appear multiple times in a tree
987
+ - each clone is fully isolated
988
+ - all instances cloned from the same slice are linked through lineage
989
+
990
+ ## Automatic Cloning
991
+
992
+ When a slice is reused through `children` or `slices`, OrcheStore automatically creates a new mounted instance for each usage.
993
+
994
+ ```ts
995
+ const paginationSlice = createSlice({ ... });
996
+
997
+ const shopSlice = createSlice({
998
+ name: "shop",
999
+
1000
+ state: {},
1001
+
1002
+ children: {
1003
+ a: paginationSlice,
1004
+ b: paginationSlice,
1005
+ },
1006
+ });
1007
+
1008
+ const adminSlice = createSlice({
1009
+ name: "admin",
1010
+
1011
+ state: {},
1012
+
1013
+ children: {
1014
+ a: paginationSlice,
1015
+ },
1016
+ });
1017
+ ```
1018
+
1019
+ Each mount becomes a separate runtime node:
1020
+
1021
+ ```ts
1022
+ shopSlice.a !== shopSlice.b;
1023
+ shopSlice.a !== adminSlice.a;
1024
+ shopSlice.b !== adminSlice.a;
1025
+ ```
1026
+
1027
+ Each instance also receives its own path and its own ownership context:
1028
+
1029
+ ```ts
1030
+ shopSlice.a.path; // "shop.a"
1031
+ shopSlice.b.path; // "shop.b"
1032
+ adminSlice.a.path; // "admin.a"
1033
+ ```
1034
+
1035
+ Although these instances are independent at runtime, they still belong to the same lineage.
1036
+
1037
+ ## Manual Cloning
1038
+
1039
+ A new detached clone can be created manually from any slice instance:
1040
+
1041
+ ```ts
1042
+ const clone = slice.prototype.clone();
1043
+ ```
1044
+
1045
+ The new instance:
1046
+
1047
+ - belongs to the same lineage
1048
+ - starts detached from the tree
1049
+ - has no mounted path initially
1050
+ - has its own ownership context
1051
+
1052
+ ## Inspecting a Lineage
1053
+
1054
+ **Get All Related Instances:**
1055
+
1056
+ Returns every instance in the lineage, **including** the current one.
1057
+
1058
+ ```ts
1059
+ const lineage = slice.prototype.getLineage();
1060
+ ```
1061
+
1062
+ Useful for:
1063
+
1064
+ - debugging slice reuse
1065
+ - inspecting mounted instances
1066
+ - understanding tree distribution
1067
+
1068
+ **Get Clones:**
1069
+
1070
+ Returns all lineage members **except** the current instance.
1071
+
1072
+ ```ts
1073
+ const siblings = slice.prototype.getClones();
1074
+ ```
1075
+
1076
+ Useful for:
1077
+
1078
+ - communicating between clones
1079
+ - broadcast or synchronization scenarios
1080
+ - comparing mounted instances
1081
+
1082
+ ## Definition Type Checking
1083
+
1084
+ You can determine whether two slices belong to the same lineage:
1085
+
1086
+ You can check whether two slices belong to the same lineage:
1087
+
1088
+ ```ts
1089
+ const isSameLineage = slice.prototype.isTypeOf(otherSlice);
1090
+ ```
1091
+
1092
+ Returns `true` when both slices originate from the same slice definition, even if they are different runtime instances.
1093
+
1094
+ ```ts
1095
+ const slice1 = createSlice(...);
1096
+ const slice2 = createSlice(...);
1097
+
1098
+ const clone1 = slice1.prototype.clone();
1099
+ const clone2 = clone1.prototype.clone();
1100
+
1101
+ slice1.prototype.isTypeOf(clone1); // true
1102
+ clone1.prototype.isTypeOf(clone2); // true
1103
+ clone2.prototype.isTypeOf(slice1); // true
1104
+
1105
+ slice1.prototype.isTypeOf(slice2); // false
1106
+ slice2.prototype.isTypeOf(clone1); // false
1107
+ ```
1108
+
1109
+ ## Summary
1110
+
1111
+ - Reusing a slice automatically creates mounted clones.
1112
+ - `clone()` creates a new detached lineage member.
1113
+ - Every clone is isolated at runtime.
1114
+ - All clones from the same definition belong to a shared lineage.
1115
+ - `getLineage()` returns all instances in a lineage.
1116
+ - `getClones()` returns all related instances except the current one.
1117
+ - `isTypeOf()` checks whether two instances belong to the same lineage.
1118
+
1119
+ ---
1120
+
909
1121
  # Global Utilities
910
1122
 
911
1123
  Global utilities allow slices and the root store to access shared runtime services through `global`.
@@ -1055,15 +1267,15 @@ const counter = createSlice({
1055
1267
  },
1056
1268
  },
1057
1269
 
1058
- // children: {
1059
- // subCounter: createSlice({
1060
- // name: "subCounter",
1270
+ children: {
1271
+ subCounter: createSlice({
1272
+ name: "subCounter",
1061
1273
 
1062
- // state: {
1063
- // value: 0,
1064
- // },
1065
- // }),
1066
- // },
1274
+ state: {
1275
+ value: 0,
1276
+ },
1277
+ }),
1278
+ },
1067
1279
  });
1068
1280
  ```
1069
1281
 
@@ -1071,11 +1283,10 @@ Automatically produces:
1071
1283
 
1072
1284
  ```ts
1073
1285
  counter.getState();
1074
- // { value: number }
1075
- // { value: number, subCounter: { value: number } } // Planned
1286
+ // { value: number, subCounter: { value: number } }
1076
1287
 
1077
- // counter.subCounter.getState();
1078
- // { value: number } // Planned
1288
+ counter.subCounter.getState();
1289
+ // { value: number }
1079
1290
 
1080
1291
  counter.increment(amount: number): void;
1081
1292
 
package/dist/index.cjs CHANGED
@@ -1,30 +1,30 @@
1
- "use strict";var ee=Object.create;var b=Object.defineProperty;var re=Object.getOwnPropertyDescriptor;var te=Object.getOwnPropertyNames;var oe=Object.getPrototypeOf,ne=Object.prototype.hasOwnProperty;var ie=(e,r)=>{for(var t in r)b(e,t,{get:r[t],enumerable:!0})},K=(e,r,t,o)=>{if(r&&typeof r=="object"||typeof r=="function")for(let n of te(r))!ne.call(e,n)&&n!==t&&b(e,n,{get:()=>r[n],enumerable:!(o=re(r,n))||o.enumerable});return e};var ae=(e,r,t)=>(t=e!=null?ee(oe(e)):{},K(r||!e||!e.__esModule?b(t,"default",{value:e,enumerable:!0}):t,e)),se=e=>K(b({},"__esModule",{value:!0}),e);var xe={};ie(xe,{StoreProvider:()=>G,configureDiagnostics:()=>P,createSlice:()=>Y,createStore:()=>Z,default:()=>be,getGlobalUtils:()=>m,provideGlobalUtils:()=>D});module.exports=se(xe);var X=require("@reduxjs/toolkit"),_=require("react-redux");var y="all",$={diagnostics:!1,prerelease:!1},q=globalThis.console?.log?.bind?.(globalThis.console)||globalThis.console?.log,le=globalThis.console?.warn?.bind?.(globalThis.console)||globalThis.console?.warn,ce=globalThis.console?.error?.bind?.(globalThis.console)||globalThis.console?.error,de=globalThis.console?.clear?.bind?.(globalThis.console)||globalThis.console?.clear;globalThis.console?.clear&&(globalThis.console.clear=(...e)=>{$.diagnostics=!1,de?.(...e)});var ue=`[OrcheStore] \u{1F6A7} Pre-release Notice
1
+ "use strict";var ue=Object.create;var C=Object.defineProperty;var pe=Object.getOwnPropertyDescriptor;var fe=Object.getOwnPropertyNames;var ye=Object.getPrototypeOf,me=Object.prototype.hasOwnProperty;var he=(e,t)=>{for(var r in t)C(e,r,{get:t[r],enumerable:!0})},_=(e,t,r,o)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of fe(t))!me.call(e,i)&&i!==r&&C(e,i,{get:()=>t[i],enumerable:!(o=pe(t,i))||o.enumerable});return e};var ge=(e,t,r)=>(r=e!=null?ue(ye(e)):{},_(t||!e||!e.__esModule?C(r,"default",{value:e,enumerable:!0}):r,e)),Se=e=>_(C({},"__esModule",{value:!0}),e);var Ne={};he(Ne,{StoreProvider:()=>J,configureDiagnostics:()=>K,createSlice:()=>le,createStore:()=>ce,default:()=>Ue,getGlobalUtils:()=>v,provideGlobalUtils:()=>L});module.exports=Se(Ne);var oe=require("@reduxjs/toolkit"),ne=require("react-redux");var R="all",k={diagnostics:!1,prerelease:!1},B=globalThis.console?.log?.bind?.(globalThis.console)||globalThis.console?.log,be=globalThis.console?.warn?.bind?.(globalThis.console)||globalThis.console?.warn,ve=globalThis.console?.error?.bind?.(globalThis.console)||globalThis.console?.error,xe=globalThis.console?.clear?.bind?.(globalThis.console)||globalThis.console?.clear;globalThis.console?.clear&&(globalThis.console.clear=(...e)=>{k.diagnostics=!1,xe?.(...e)});var Te=`[OrcheStore] \u{1F6A7} Pre-release Notice
2
2
  Thank you for your interest in OrcheStore.
3
3
  OrcheStore is currently under active development and is not yet ready for production use.
4
4
  APIs, behavior, and internal implementation details may change without notice.
5
5
  The first stable release is currently planned for 2026-06-30.
6
6
  Stay tuned for updates!
7
- `,pe=`[OrcheStore] Diagnostics are enabled.
7
+ `,we=`[OrcheStore] Diagnostics are enabled.
8
8
  OrcheStore may emit warnings and errors to help identify incorrect usage, invalid configurations, and potential runtime issues.
9
9
  Runtime exceptions that stop code execution may still occur regardless of diagnostics settings.
10
10
  Please resolve all OrcheStore warnings and errors before deploying to production.
11
11
  Diagnostics can be configured with configureDiagnostics("off" | "errors" | "all").
12
- `,s={inform(e){$[e]||($[e]=!0,y==="all"&&q?.(e==="prerelease"?ue:pe))},log(...e){y==="all"&&(s.inform("diagnostics"),q?.(...e))},warn(...e){y==="all"&&(s.inform("diagnostics"),le?.(...e))},error(...e){y!=="off"&&(s.inform("diagnostics"),ce?.(...e))}};function P(e){y=e}var z=(...e)=>{let[r,t]=[e[2],e[3]],o=`${e[0]||"Received"}: `,n=e[1]!==!1?"(type: "+typeof r+")":"";if(!t?.(r))return r==null?[`${o}(type: ${r})`]:typeof r=="number"||typeof r=="bigint"||typeof r=="boolean"?[`${o}${n} ${r}`]:typeof r=="object"?[o,r]:r===""?[`${o}Empty String`]:[`${o}${n}`,r]},g=((e,r)=>z("Received",!0,e,r));g.prefixed=(e,r,t,o)=>z(e,r,t,o);var fe=Object.assign,M=Object.getOwnPropertyDescriptor(Object,"defineProperty")?.value||Object.defineProperty,me=(e,r,t)=>{M(e,r,{get:t,enumerable:!0,configurable:!1})},Se=(e,r,t)=>{M(e,r,{value:t,writable:!1,enumerable:!0,configurable:!1})},d={assign:fe,defineProp:M,defineReadonly:me,defineMethod:Se},L={isArray:Array.isArray},x={get:Reflect.get,set:Reflect.set,delete:Reflect.deleteProperty};var k={InvalidStore:e=>({StoreType:[`[OrcheStore::StoreProvider] Expected a store instance created with createStore(...).
13
- `,...g(e)]})},v={GetMissingProp:e=>["[OrcheStore::global-utils] Attempted to access a global utility before it became available. Missing property",e,`
12
+ `,l={inform(e){k[e]||(k[e]=!0,R==="all"&&B?.(e==="prerelease"?Te:we))},log(...e){R==="all"&&(l.inform("diagnostics"),B?.(...e))},warn(...e){R==="all"&&(l.inform("diagnostics"),be?.(...e))},error(...e){R!=="off"&&(l.inform("diagnostics"),ve?.(...e))}};function K(e){R=e}var H=(...e)=>{let[t,r]=[e[2],e[3]],o=`${e[0]||"Received"}: `,i=e[1]!==!1?"(type: "+typeof t+")":"";if(!r?.(t))return t==null?[`${o}(type: ${t})`]:typeof t=="number"||typeof t=="bigint"||typeof t=="boolean"?[`${o}${i} ${t}`]:typeof t=="object"?[o,t]:t===""?[`${o}Empty String`]:[`${o}${i}`,t]},E=((e,t)=>H("Received",!0,e,t));E.prefixed=(e,t,r,o)=>H(e,t,r,o);var Oe=Object.assign,D=Object.getOwnPropertyDescriptor(Object,"defineProperty")?.value||Object.defineProperty,Ee=(e,t,r)=>{D(e,t,{get:r,enumerable:!0,configurable:!1})},Me=(e,t,r)=>{D(e,t,{value:r,writable:!1,enumerable:!0,configurable:!1})},u={assign:Oe,defineProp:D,defineReadonly:Ee,defineMethod:Me},Q={isArray:Array.isArray},I={get:Reflect.get,set:Reflect.set,delete:Reflect.deleteProperty};var V={InvalidStore:{InvalidType:e=>[`[OrcheStore::StoreProvider] Expected a store instance created with createStore(...).
13
+ `,...E(e)]}},U={GetMissingProp:e=>["[OrcheStore::global-utils] Attempted to access a global utility before it became available. Missing property",e,`
14
14
  If this utility is optional, register it as undefined using provideGlobalUtils(...) to suppress future warnings.
15
15
  `],DeleteProp:e=>["[OrcheStore::global-utils] Avoid deleting properties. Trying to delete property",e,`
16
16
  Use provideGlobalUtils(...) to set them to undefined instead for type safety.
17
17
  `],InvalidArgs:()=>`[OrcheStore::global-utils] Expected provideGlobalUtils(...) to receive a non-null object.
18
- `},T={InvalidChild:e=>`[OrcheStore::createStore] Child slice '${e}' must be a slice created with createSlice(...).`,singletonLimitation:()=>`[OrcheStore::createStore] createStore(...) was called more than once.
18
+ `},N={InvalidChild:e=>`[OrcheStore::createStore] Child slice '${e}' must be a slice created with createSlice(...).`,singletonLimitation:()=>`[OrcheStore::createStore] createStore(...) was called more than once.
19
19
  OrcheStore currently supports only a single global store instance and will return the existing store.
20
20
  If you are creating a store inside a React component, create it only once, for example:
21
21
  const [store] = useState(() => createStore(...));
22
- Avoid useState(createStore(...)) because createStore(...) will execute on every render.`},u={InvalidStore:(e,r,t)=>({StoreType:[`[OrcheStore::${r}] Unable to resolve a valid store instance.
23
- This operation requires a store created with createStore(...).
24
- `,...g(e)],NeverExposed:[`[OrcheStore::${r}] Slice {${t}} has not been exposed in any store.
25
- Ensure the slice is reachable from a store instance.
26
- This can be done by exposing the slice directly through createStore({ slices: ... }) or indirectly through a parent slice using createSlice({ children: ... }).`],NotInTree:[`[OrcheStore::${r}] Slice {${t}} is not exposed within the target store.
27
- A slice can only be accessed through stores that expose it.
28
- `,...g.prefixed("Current store",!1,e)]}),RequiredName:()=>"[OrcheStore::createSlice] Missing required slice name. Expected a non-empty string.",InvalidName:e=>`[OrcheStore::createSlice] Slice names cannot contain '.' or '/'. Received: {${e}}`,RequiredState:e=>`[OrcheStore::createSlice] Missing required state for slice {${e}}.`,InvalidState:(e,r)=>[`[OrcheStore::createSlice]${f.target({slice:e})}Slice state must be a non-null object or a function that returns a non-null object.
29
- `,...g(r)],InvalidMutation:e=>`[OrcheStore::createSlice] Mutation '${e}' must be a function.`,InvalidMethod:e=>`[OrcheStore::createSlice] Method '${e}' must be a function.`,InvalidChild:e=>`[OrcheStore::createSlice] Child slice '${e}' must be a slice created with createSlice(...).`,ReduxReducerConflict:()=>"[OrcheStore::createSlice] Redux Toolkit asyncThunk reducers are not supported inside mutations. Use methods instead."},f={target:({slice:e})=>e?` Affected slice '${e}':
30
- `:" ",RequiredName:(e,r)=>`[OrcheStore::${e.module}]${f.target(e)}${r} keys must be non-empty strings.`,InvalidName:(e,r,t)=>`[OrcheStore::${e.module}]${f.target(e)}${r} names cannot contain '.' or '/'. Received: ${t}.`,ReservedKey:(e,r,t)=>`[OrcheStore::${e.module}]${f.target(e)}'${t}' is a reserved name and cannot be used as a ${r} key.`,DuplicateKey:(e,r,t)=>`[OrcheStore::${e.module}]${f.target(e)}${r} name '${t}' conflicts with another member.`};var C=new Proxy({},{get(e,r,t){return r in e||s.error(...v.GetMissingProp(r)),x.get(e,r,t)},set(e,r,t,o){return x.set(e,r,t,o)},deleteProperty(e,r){return s.warn(...v.DeleteProp(r)),x.delete(e,r)}});function m(){return C}function D(e){let r=g(e,t=>t&&typeof t=="object"&&!L.isArray(t));return r?s.error(v.InvalidArgs(),...r):d.assign(C,e),C}function h(e,r){let t={children:{}};return Object.keys(e).filter(n=>n.startsWith(r)).map(n=>n.split(".")).sort((n,a)=>n.length-a.length).forEach(n=>{let a=t;n.slice(0,n.length-1).forEach(i=>a=a[i]||={}),a.children||={},a.children[n[n.length-1]]={...e[n.join(".")]}}),t.children}var W=(e,r)=>{if(e)if(r==="warn")s.warn(e);else if(r==="error")s.error(e);else throw new Error(e);else return!1},j=(e,r="",t="",o)=>typeof e!="string"||!e?!!W(r,o?.[0]):e.includes(".")||e.includes("/")?!!W(t,o?.[1]):!0,ge=(e,r,t,o)=>{let n=f.RequiredName(e,r),a=f.InvalidName(e,r,t);if(j(t,n,a,["error","error"])){if(o[0].includes(t))return s.error(f.ReservedKey(e,r,t));if(o[1].includes(t))return s.error(f.DuplicateKey(e,r,t))}else return;return!0},E=e=>{let r=[],t=[e.reserved,r];return(o,n,a)=>(Object.entries(n).forEach(([i,c])=>{let l=ge(e,o,i,t)?a(i,c):void 0;if(l===void 0)return delete n[i];n[i]=l,r.push(i)}),n)},O=(e,r)=>{let t={...e||{}};return r.objects?.forEach(o=>{t[o]=typeof t[o]=="object"&&t[o]?{...t[o]}:{}}),r.validate?.(t),r.redux?.forEach(o=>{t[o]!==void 0&&s.warn(`[OrcheStore::${r.method}] '${o}' property is a Redux Toolkit option and is ignored by OrcheStore.`)}),r.unsupported?.forEach(o=>{Object.keys(t[o]).length<1||s.warn(`[OrcheStore::${r.method}] '${o}' property is not yet supported and will be ignored.`)}),t};var w=require("@reduxjs/toolkit");var F=require("react-redux"),J=[],V=e=>{let r={children:{},roots:[]},t=r.slice={},o=O(e,{method:"createSlice",objects:["mutations","computed","methods","children"],unsupported:["computed","children"],redux:["reducers","extraReducers","reducerPath","initialState","selectors"],validate:ye}),n=E({module:"createSlice",slice:o.name,reserved:["name","computed","root","global","getState","useSelect","getPath"]});return n("mutation",o.mutations,(a,i)=>i?._reducerDefinitionType===w.ReducerType.asyncThunk||"reducer"in{...i||{}}?s.error(u.ReduxReducerConflict()):typeof i!="function"?s.error(u.InvalidMutation(a)):((l,A)=>i(l,...A.payload))),r.redux=(0,w.createSlice)({name:o.name,initialState:o.state,reducers:o.mutations}),d.defineReadonly(t,"name",()=>o.name),d.defineReadonly(t,"global",()=>m()),d.defineMethod(t,"getPath",()=>I(t)),d.defineMethod(t,"getState",()=>{let a=u.InvalidStore(void 0,"slice.getState",o.name),i=S(r,void 0,a).redux.getState();return h(i,I(t))}),d.defineMethod(t,"useSelect",a=>{let i=u.InvalidStore(void 0,"slice.useSelect",o.name);return S(r,void 0,i),(0,F.useSelector)(c=>{let l={global:m()};return a.call(l,h(c,I(t)),l)})}),Object.entries(r.redux.actions).map(([a,i])=>{t[a]=(...c)=>{let l=u.InvalidStore(void 0,"slice mutation",o.name);return S(r,void 0,l).redux.dispatch(i(c))}}),n("method",o.methods,(a,i)=>typeof i!="function"?s.error(u.InvalidMethod(a)):t[a]=(...c)=>i.apply(t,c)),J.push(r),t};function U(e){return J.find(r=>r.slice===e)}var N=(e,r,t,o,n)=>{let{redux:a,children:i}=r;return r.path=e,r.roots.push(o),n[e]=a.reducer,Object.entries(i).forEach(([c,l])=>{N(e+"."+c,U(l),r.slice,o,n)}),t[e]=r.slice},ye=e=>{let r=t=>{if(typeof t!="object"){let o=u.InvalidState(e.name,t);throw o.every(n=>typeof n=="string")?new Error(o.join(" ")):(s.error(...o),new Error)}if(!t)throw new Error(u.RequiredState(e.name));return t};if(j(e.name,u.RequiredName(),u.InvalidName(e.name)),typeof e.state=="function"){let t=e.state;e.state=()=>r(t())}else r(e.state)},I=e=>e.name;var R=[],B=e=>{let r={},t=r.store={},o=O(e,{method:"createStore",objects:["slices"],redux:["reducer","devTools","duplicateMiddlewareCheck","enhancers","middleware","preloadedState"]}),n=E({module:"createStore",reserved:["name","computed","global","getState","useSelect"]});d.defineReadonly(t,"name",()=>"default"),d.defineReadonly(t,"global",()=>m()),d.defineMethod(t,"getState",()=>h(r.redux.getState(),"")),d.defineMethod(t,"useSelect",i=>(0,_.useSelector)(c=>{let l={global:m()};return i.call(l,h(c,""),l)}));let a={};return n("slice",o.slices,(i,c)=>{let l=U(c);return l?N(i,l,t,t,a):s.error(T.InvalidChild(i))}),r.redux=(0,X.configureStore)({reducer:a}),R.push(r),t},S=(e,r,t={})=>{if(t===!1)return R[0];let o;if((!e||r!==void 0)&&!R.find(n=>n.store===r)?o=t.StoreType:e&&!e.roots.length?o=t.NeverExposed:e&&r&&!e.roots.includes(r)&&(o=t.NotInTree),r=e&&r===void 0?e.roots[0]:r,o)throw o.every(n=>typeof n=="string")?new Error(o.join(" ")):(s.error(...o),new Error);return R.find(n=>n.store===r)};var H=ae(require("react"),1),Q=require("react-redux");function G(e){let{store:r,...t}={...e||{}},o=S(void 0,r,k.InvalidStore(r));return H.default.createElement(Q.Provider,{...t,store:o.redux})}var Y=e=>(s.inform("prerelease"),V(e)),Z=e=>(s.inform("prerelease"),S(void 0,void 0,!1)?(s.warn(T.singletonLimitation()),S(void 0,void 0,!1).store):B(e)),be={createStore:Z,createSlice:Y,StoreProvider:G,provideGlobalUtils:D,getGlobalUtils:m,configureDiagnostics:P};0&&(module.exports={StoreProvider,configureDiagnostics,createSlice,createStore,getGlobalUtils,provideGlobalUtils});
22
+ Avoid useState(createStore(...)) because createStore(...) will execute on every render.`},b={InvalidStore:(e,t)=>({NeverExposed:[`[OrcheStore::${e}] Slice {${t}} is not reachable from any store instance.
23
+ A slice must be connected to a store via one of the following:
24
+ \u2022 createStore({ slices: ... }) \u2014 expose it directly in the root store
25
+ \u2022 createSlice({ children: ... }) \u2014 attach it under another slice that is already reachable`],InvalidType:r=>[`[OrcheStore::${e}] Slice {${t}} depends on parent slice {${r.name}}, but that parent is not reachable from any store instance.
26
+ Fix the parent first using one of the following:
27
+ \u2022 createStore({ slices: ... }) \u2014 expose the parent directly in the root store
28
+ \u2022 createSlice({ children: ... }) \u2014 attach the parent under another parent slice that is already reachable`]}),RequiredName:()=>"[OrcheStore::createSlice] Missing required slice name. Expected a non-empty string.",InvalidName:e=>`[OrcheStore::createSlice] Slice names cannot contain '.' or '/'. Received: {${e}}`,RequiredState:e=>`[OrcheStore::createSlice] Missing required state for slice {${e}}.`,InvalidState:(e,t)=>[`[OrcheStore::createSlice]${S.target({slice:e})}Slice state must be a non-null object or a function that returns a non-null object.
29
+ `,...E(t)],InvalidMutation:e=>`[OrcheStore::createSlice] Mutation '${e}' must be a function.`,InvalidMethod:e=>`[OrcheStore::createSlice] Method '${e}' must be a function.`,InvalidChild:e=>`[OrcheStore::createSlice] Child slice '${e}' must be a slice created with createSlice(...).`,ReduxReducerConflict:()=>"[OrcheStore::createSlice] Redux Toolkit asyncThunk reducers are not supported inside mutations. Use methods instead."},S={target:({slice:e})=>e?` Affected slice '${e}':
30
+ `:" ",RequiredName:(e,t)=>`[OrcheStore::${e.module}]${S.target(e)}${t} keys must be non-empty strings.`,InvalidName:(e,t,r)=>`[OrcheStore::${e.module}]${S.target(e)}${t} names cannot contain '.' or '/'. Received: ${r}.`,ReservedKey:(e,t,r)=>`[OrcheStore::${e.module}]${S.target(e)}'${r}' is a reserved name and cannot be used as a ${t} key.`,DuplicateKey:(e,t,r)=>`[OrcheStore::${e.module}]${S.target(e)}${t} name '${r}' conflicts with another member.`};var q=new Proxy({},{get(e,t,r){return t in e||l.error(...U.GetMissingProp(t)),I.get(e,t,r)},set(e,t,r,o){return I.set(e,t,r,o)},deleteProperty(e,t){return l.warn(...U.DeleteProp(t)),I.delete(e,t)}});function v(){return q}function L(e){let t=E(e,r=>r&&typeof r=="object"&&!Q.isArray(r));return t?l.error(U.InvalidArgs(),...t):u.assign(q,e),q}var{createNodeFactory:j}={createNodeFactory({factoryName:e,instantiate:t,options:r={}}){let o=new Map,i=new Map,p=d=>{d=r.adapt?r.adapt(d):d,d=r.register?r.register(d):d;let n={familyId:Symbol("family"),path:"",children:new Map,parents:[]},a={props:d,siblings:new Set};return n.node=t(d,n,a),a.siblings.add(n.node),o.set(n.node,n),i.set(n.familyId,a),n.node},x=(d,n)=>{let a=o.get(d),s=a?i.get(a.familyId):void 0;if(!a||!s){if(n?.UnknownNode)return void n?.UnknownNode?.("",d);throw new Error(`[OrcheStore] ${e} factory: Unknown node`)}return m("",[],a,s,!0,()=>{})},y=(d,n,a,s,c)=>{let f=o.get(n),w=f?i.get(f.familyId):void 0;if(!f||!w){if(c?.UnknownNode)return void c?.UnknownNode?.(d,n);throw new Error(`[OrcheStore] ${e} factory: Unknown node`)}let h=s||o.get(a);if(!h){if(c?.UnknownParent)return void c?.UnknownParent?.(d,n,a);throw new Error(`[OrcheStore] ${e} factory: Unknown parent node`)}for(let $ of[a,...h.parents])if($===n){if(c?.InfiniteOwnership)return void c?.InfiniteOwnership?.(d,n,a);throw new Error(`[OrcheStore] ${e} factory: Infinite ownership recursion`)}let O=(h.path?`${h.path}.`:"")+d,M=[a,...h.parents];return m(O,M,f,w,!1,$=>h.children.set(d,$))};function m(...d){let[n,a,s,c,f,w]=d;if(f=f||s.parents.length>0&&(s.parents[0]!==a[0]||s.path.split(".").at(-1)!==n.split(".").at(-1)),f){let h={familyId:s.familyId,path:n,children:new Map(s.children),parents:a},O=r.clone?r.clone(c.props,s,c):c.props;s=h,s.node=t(O,h,c),o.set(s.node,h),c.siblings.add(s.node)}s.path=n,s.parents=a,w?.(s.node);for(let[h,O]of[...s.children.entries()]){let M=o.get(O),$=M?i.get(M.familyId):void 0,de=`${n}${n?".":""}${h}`;m(de,[s.node,...a],M,$,!1,X=>{X!==O&&s.children.set(h,X)})}return s.node}return{families:i,instances:o,create:p,attach:y,clone:x}}};var G=require("@reduxjs/toolkit"),ee=require("react-redux");var Y=(e,t)=>{if(e)if(t==="warn")l.warn(e);else if(t==="error")l.error(e);else throw new Error(e);else return!1},z=(e,t="",r="",o)=>typeof e!="string"||!e?!!Y(t,o?.[0]):e.includes(".")||e.includes("/")?!!Y(r,o?.[1]):!0,$e=(e,t,r,o)=>{let i=S.RequiredName(e,t),p=S.InvalidName(e,t,r);if(z(r,i,p,["error","error"])){if(o[0].includes(r))return l.error(S.ReservedKey(e,t,r));if(o[1].includes(r))return l.error(S.DuplicateKey(e,t,r))}else return;return!0},A=e=>{let t=[],r=[e.reserved,t];return(o,i,p,x)=>{let y=i?[]:{};return Object.entries(p).forEach(([m,d])=>{let n=$e(e,o,m,r)?x(m,d):void 0;n!==void 0&&(i?y.push([m,n]):y[m]=n,t.push(m))}),y}},F=(e,t)=>{let r={...e||{}};return t.objects?.forEach(o=>{r[o]=typeof r[o]=="object"&&r[o]?{...r[o]}:{}}),t.validate?.(r),t.redux?.forEach(o=>{r[o]!==void 0&&l.warn(`[OrcheStore::${t.method}] '${o}' property is a Redux Toolkit option and is ignored by OrcheStore.`)}),t.unsupported?.forEach(o=>{Object.keys(r[o]).length<1||l.warn(`[OrcheStore::${t.method}] '${o}' property is not yet supported and will be ignored.`)}),r};var{families:Re,instances:P,create:Pe,attach:W,clone:Ce}=j({factoryName:"slice",instantiate(e,t,r){let o={},i=n=>T(void 0,t,n?b.InvalidStore(n,e.name):!1),p=A({module:"createSlice",slice:e.name,reserved:["name","path","computed","root","parent","prototype","global","getState","useSelect"]}),x=p("mutation",!1,e.mutations,(n,a)=>a?._reducerDefinitionType===G.ReducerType.asyncThunk||"reducer"in{...a||{}}?l.error(b.ReduxReducerConflict()):typeof a!="function"?l.error(b.InvalidMutation(n)):(c,f)=>f?.meta?.path===t.path?a(c,...f.payload):c);t.redux=(0,G.createSlice)({name:e.name,initialState:e.state,reducers:x}),u.defineReadonly(o,"name",()=>e.name),u.defineReadonly(o,"path",()=>t.path),u.defineReadonly(o,"global",()=>v()),u.defineReadonly(o,"root",()=>i().node),u.defineReadonly(o,"parent",()=>{let n=t.parents[0];return(n?P.get(n):void 0)?.node}),u.defineMethod(o,"getState",()=>{let n=i("slice.getState").redux.getState();return t.path.split(".").forEach(a=>n=(n||{})[a]),n}),u.defineMethod(o,"useSelect",n=>{let a={global:v(),root:i("slice.useSelect").node};return(0,ee.useSelector)(s=>(t.path.split(".").forEach(c=>s=(s||{})[c]),n.apply(a,[s,a])))}),u.defineReadonly(o,"computed",()=>{});let y={},m=()=>[...r.siblings.values()||[]];u.defineReadonly(o,"prototype",()=>y),u.defineMethod(y,"clone",()=>Ce(o)),u.defineMethod(y,"getLineage",()=>m()),u.defineMethod(y,"getClones",()=>m().filter(n=>n!==o)),u.defineMethod(y,"isTypeOf",n=>r===Re.get(P.get(n)?.familyId)),Object.entries(t.redux.actions).map(([n,a])=>{o[n]=(...s)=>{i("slice mutation").redux.dispatch({...a(s),meta:{path:t.path}})}}),p("method",!1,e.methods,(n,a)=>typeof a!="function"?l.error(b.InvalidMethod(n)):o[n]=(...s)=>a.apply(o,s));let d=p("child",!0,e.children,(n,a)=>{let c=W(n,a,o,t,{UnknownNode:f=>l.error(b.InvalidChild(f))});if(c)return o[n]=c,P.get(c).reducers});return t.reducers=(n,a)=>{let s=a?.meta?.path;if(typeof s=="string"&&!s.startsWith(t.path))return n;let c={...t.redux.reducer(n,a)};for(let[f,w]of d)c[f]=w(c?.[f],a);return c},o},options:{adapt(e){return F(e,{method:"createSlice",objects:["mutations","computed","methods","children"],unsupported:["computed"],redux:["reducers","extraReducers","reducerPath","initialState","selectors"],validate(t){z(t.name,b.RequiredName(),b.InvalidName(t.name));let r=t.state;if(typeof r!="function")return void Z(t.name,r);t.state=()=>Z(t.name,r())}})},clone(e,t){let r=t.redux.getInitialState();return{...e,state:r}}}}),Z=(e,t)=>{if(typeof t!="object"){let r=b.InvalidState(e,t);throw r.every(o=>typeof o=="string")?new Error(r.join(" ")):(l.error(...r),new Error)}if(!t)throw new Error(b.RequiredState(e));return t},te=e=>Pe(e);var{instances:re,create:Ie}=j({factoryName:"slice",instantiate(e,t){let r={},o=A({module:"createStore",reserved:["name","computed","global","getState","useSelect"]});return u.defineReadonly(r,"name",()=>"default"),u.defineReadonly(r,"global",()=>v()),u.defineMethod(r,"getState",()=>t.redux.getState()),u.defineMethod(r,"useSelect",i=>{let p={global:v(),root:r};return(0,ne.useSelector)(x=>i.apply(p,[x,p]))}),t.reducers=o("slice",!1,e.slices,(i,p)=>{let y=W(i,p,r,t,{UnknownNode:m=>l.error(N.InvalidChild(m))});if(y)return r[i]=y,P.get(y).reducers}),t.redux=(0,oe.configureStore)({reducer:t.reducers}),r},options:{adapt(e){return F(e,{method:"createStore",objects:["slices"],redux:["reducer","devTools","duplicateMiddlewareCheck","enhancers","middleware","preloadedState"]})}}}),T=(e,t,r=!1)=>{if(r===!0)return[...re.values()][0];e||=t?.parents?.at?.(-1);let o=e?re.get(e):void 0,i=[];if(t&&!e?i=r===!1?[]:r.NeverExposed:o||(i=r===!1?[]:r.InvalidType(e)),i&&i.length)throw i.every(p=>typeof p=="string")?new Error(i.join(" ")):(l.error(...i),new Error);return o},ae=e=>Ie(e);var ie=ge(require("react"),1),se=require("react-redux");function J(e){let{store:t,...r}={...e||{}},o=T(t,void 0,V.InvalidStore);return ie.default.createElement(se.Provider,{...r,store:o.redux})}var le=e=>(l.inform("prerelease"),te(e)),ce=e=>(l.inform("prerelease"),T(void 0,void 0,!0)?(l.warn(N.singletonLimitation()),T(void 0,void 0,!0).node):ae(e)),Ue={createStore:ce,createSlice:le,StoreProvider:J,provideGlobalUtils:L,getGlobalUtils:v,configureDiagnostics:K};0&&(module.exports={StoreProvider,configureDiagnostics,createSlice,createStore,getGlobalUtils,provideGlobalUtils});
package/dist/index.d.cts CHANGED
@@ -1,8 +1,10 @@
1
1
  import React from 'react';
2
2
  import { ProviderProps } from 'react-redux';
3
3
 
4
- /** String-keyed object map. */
4
+ /** `Record` with string keys, requiring only the value type. */
5
5
  type Dict<Value = any> = Record<string, Value>;
6
+ /** `Record` with default property keys, requiring only the value type. */
7
+ type Obj<Value = any> = Record<PropertyKey, Value>;
6
8
  /** Returns all tuple elements except the first. */
7
9
  type Tail<T extends any[]> = T extends [any, ...infer R] ? R : T extends (infer U)[] ? U[] : never;
8
10
  /** Removes properties whose value type is `never`. */
@@ -15,24 +17,44 @@ type ReadOnly<T> = T extends (...args: any[]) => any ? T : T extends readonly (i
15
17
  } : T;
16
18
 
17
19
  /** Runtime slice API exposed by createSlice(...). */
18
- type slice<S, R extends Mutations<S>, M> = GlobalUtils & {
20
+ type slice<S extends Obj, R extends Mutations<S, C>, M, C> = GlobalUtils & {
19
21
  /** Unique slice identifier. */
20
22
  readonly name: string;
23
+ /** Fully qualified runtime path of the slice. */
24
+ readonly path: string;
21
25
  /** Returns the latest immutable state snapshot. */
22
- readonly getState: () => SliceState<S, true>;
26
+ readonly getState: () => SliceState.State<S, C>;
23
27
  /** Subscribes to state changes within React components. Runs with a context-bound `this` containing `root` store, `rootState` and `global` utilities. */
24
- readonly useSelect: <T>(selector: (this: GlobalUtils, state: SliceState<S, true>, context: GlobalUtils) => T) => T;
25
- /** Returns fully qualified runtime path of the slice. */
26
- readonly getPath: () => string;
27
- } & {
28
+ readonly useSelect: <T>(selector: (this: GlobalUtils, state: SliceState.State<S, C>, context: GlobalUtils) => T) => T;
29
+ /** Root store that owns this slice instance. */
30
+ root: store<any>;
31
+ /** Parent slice in the hierarchy, if mounted under another slice. */
32
+ parent: slice<any, Mutations<any, any>, any, any> | undefined;
33
+ /** Runtime lineage and cloning utilities for this slice instance. */
34
+ readonly prototype: {
35
+ /** Creates a new detached clone within the same lineage. */
36
+ readonly clone: () => slice<S, R, M, C>;
37
+ /** Returns all slice instances in the same lineage, including this one. */
38
+ readonly getLineage: () => slice<S, R, M, C>[];
39
+ /** Returns all sibling instances in the same lineage, excluding this one. */
40
+ readonly getClones: () => slice<S, R, M, C>[];
41
+ /** Returns true if both slices belong to the same lineage. */
42
+ readonly isTypeOf: (other: any) => boolean;
43
+ };
44
+ /** Collection of derived state functions. */
45
+ readonly computed: undefined;
46
+ } & OmitNever<{
28
47
  /** Exposed mutation functions. */
29
- readonly [K in Exclude<keyof R, ReservedSliceKeys>]: (...args: Tail<Parameters<R[K]>>) => ReturnType<R[K]>;
30
- } & {
48
+ readonly [K in Exclude<keyof R, ReservedSliceKeys>]: R[K] extends (...args: any[]) => void ? (...args: Tail<Parameters<R[K]>>) => void : never;
49
+ }> & OmitNever<{
31
50
  /** Exposed method functions. */
32
- readonly [K in Exclude<keyof M, ReservedSliceKeys<R>>]: M[K];
33
- } & {};
51
+ readonly [K in Exclude<keyof M, ReservedSliceKeys<R>>]: M[K] extends (...args: any[]) => void ? M[K] : never;
52
+ }> & OmitNever<{
53
+ /** Exposed children. */
54
+ readonly [K in Exclude<keyof C, ReservedSliceKeys<R, M>>]: C[K] extends slice<infer S, infer R, infer M, infer C> ? slice<S, R, M, C> : never;
55
+ }>;
34
56
  /** Configuration object used to create a slice. */
35
- type sliceOptions<S, R extends Mutations<S>, M> = {
57
+ type sliceOptions<S extends Obj, R extends Mutations<S, C>, M, C> = {
36
58
  /** Unique slice identifier. */
37
59
  name: string;
38
60
  /** Initial state object or lazy state initializer. */
@@ -40,26 +62,44 @@ type sliceOptions<S, R extends Mutations<S>, M> = {
40
62
  /** Collection of synchronous state transition functions. */
41
63
  mutations?: R & ThisType<GlobalUtils>;
42
64
  /** Collection of slice methods and orchestration logic. */
43
- methods?: M & ThisType<slice<S, R, M> & {
65
+ methods?: M & ThisType<slice<S, R, M, C> & {
44
66
  root: RootStore;
45
67
  }>;
68
+ /** Collection of derived state functions. */ /** Collection of nested child slices. */
69
+ children?: C;
46
70
  };
47
71
  /** Defines the mutations available on a slice. */
48
- type Mutations<S> = Dict<(state: SliceState<S, false>, ...args: any[]) => void>;
72
+ type Mutations<S extends Obj, C> = Dict<(state: SliceState.Draft<S, C>, ...args: any[]) => void | S>;
49
73
  /** Derived state shape exposed by a slice, excluding internal framework fields. */
50
- type SliceState<S, isReadOnly> = isReadOnly extends true ? ReadOnly<S extends Dict ? Omit<S, "computed" | "children"> : S> : S extends Dict ? Omit<S, "computed" | "children"> : S;
74
+ declare namespace SliceState {
75
+ type InferState<C> = C extends Obj ? (C["getState"] extends () => infer S ? S extends Obj ? S : never : never) : never;
76
+ export type State<S extends Obj, C> = ReadOnly<Omit<S, "computed" | keyof OmitNever<{
77
+ [K in keyof C]: InferState<C[K]>;
78
+ }>> & OmitNever<{
79
+ [K in keyof C]: InferState<C[K]>;
80
+ }>>;
81
+ export type Draft<S extends Obj, C> = Omit<S, "computed" | keyof OmitNever<{
82
+ [K in keyof C]: C[K] extends AnySlice ? true : never;
83
+ }>> & OmitNever<{
84
+ [K in keyof C]: C[K] extends slice<infer S, infer _, infer __, infer C> ? Draft<S, C> : never;
85
+ }>;
86
+ export { };
87
+ }
51
88
  /** Reserved slice member names that cannot be overridden by user-defined APIs. */
52
- type ReservedSliceKeys<R = {}, M = {}> = ("name" | "computed" | "root" | "global" | "children" | "getState" | "useSelect" | "getPath") | (keyof R | keyof M);
89
+ type ReservedSliceKeys<R = {}, M = {}> = ("name" | "path" | "computed" | "root" | "parent" | "prototype" | "global" | "getState" | "useSelect") | (keyof R | keyof M);
90
+ type AnySlice = slice<any, Mutations<any, any>, any, any>;
53
91
 
54
92
  /** Runtime store API exposed by createStore(...). */
55
93
  type store<C> = OmitNever<GlobalUtils & {
94
+ /** Unique store identifier. Currently this is set to "default" and is nt configurable */
95
+ readonly name: "default";
56
96
  /** Returns the latest immutable state snapshot. */
57
97
  readonly getState: () => StoreState<C>;
58
98
  /** Subscribes to state changes within React components. Runs with a context-bound `this` containing `global` utilities. */
59
99
  readonly useSelect: <T>(selector: (this: GlobalUtils, state: StoreState<C>, context: GlobalUtils) => T) => T;
60
100
  } & {
61
101
  /** Exposed slices. */
62
- readonly [K in Exclude<keyof C, ReservedStoreKeys>]: C[K] extends slice<infer S, infer R, infer M> ? slice<S, R, M> : never;
102
+ readonly [K in Exclude<keyof C, ReservedStoreKeys>]: C[K] extends slice<infer S, infer R, infer M, infer C> ? slice<S, R, M, C> : never;
63
103
  }>;
64
104
  /** Configuration object used to create a store. */
65
105
  type storeOptions<C> = {
@@ -68,7 +108,7 @@ type storeOptions<C> = {
68
108
  };
69
109
  /** Derived immutable state shape of the store. */
70
110
  type StoreState<C> = ReadOnly<OmitNever<{
71
- readonly [K in Exclude<keyof C, ReservedStoreKeys>]: C[K] extends slice<infer S, infer _, infer __> ? SliceState<S, true> : never;
111
+ readonly [K in Exclude<keyof C, ReservedStoreKeys>]: C[K] extends slice<infer S, infer _, infer __, infer C> ? SliceState.State<S, C> : never;
72
112
  }>>;
73
113
  /** Props accepted by the store provider component. */
74
114
  type StoreProviderProps<T = any> = Omit<ProviderProps, "store" | "serverState" | "context"> & {
@@ -105,9 +145,9 @@ declare global {
105
145
  /** Configuration object used to create a store. */
106
146
  type StoreOptions<C> = storeOptions<C>;
107
147
  /** Runtime slice API exposed by createSlice(...). */
108
- type Slice<S, R extends Mutations<S>, M> = slice<S, R, M>;
148
+ type Slice<S extends Obj, R extends Mutations<S, C>, M, C> = slice<S, R, M, C>;
109
149
  /** Configuration object used to create a slice. */
110
- type SliceOptions<S, R extends Mutations<S>, M> = sliceOptions<S, R, M>;
150
+ type SliceOptions<S extends Obj, R extends Mutations<S, C>, M, C> = sliceOptions<S, R, M, C>;
111
151
  }
112
152
  }
113
153
 
@@ -120,14 +160,14 @@ declare function provideGlobalUtils(value: Partial<GlobalUtils["global"]>): Glob
120
160
  declare function configureDiagnostics(level: "off" | "errors" | "all"): void;
121
161
 
122
162
  /** Creates and initializes an OrcheStore slice. */
123
- declare const createSliceWrapper: <S, R extends Mutations<S>, M>(props: sliceOptions<S, R, M>) => slice<S, R, M>;
163
+ declare const createSliceWrapper: <S extends Obj, R extends Mutations<S, C>, M, C>(props: sliceOptions<S, R, M, C>) => slice<S, R, M, C>;
124
164
  /** Creates and initializes an OrcheStore instance. */
125
165
  declare const createStoreWrapper: <T>(props: storeOptions<T>) => store<T>;
126
166
  declare const defaultExport: {
127
167
  /** Creates and initializes an OrcheStore instance. */
128
168
  createStore: <T>(props: storeOptions<T>) => store<T>;
129
169
  /** Creates and initializes an OrcheStore slice. */
130
- createSlice: <S, R extends Mutations<S>, M>(props: sliceOptions<S, R, M>) => slice<S, R, M>;
170
+ createSlice: <S extends Obj, R extends Mutations<S, C>, M, C>(props: sliceOptions<S, R, M, C>) => slice<S, R, M, C>;
131
171
  /** Provides an OrcheStore instance to the React component tree. */
132
172
  StoreProvider: typeof StoreProvider;
133
173
  /** Registers or updates application-wide global utilities. */
package/dist/index.d.ts CHANGED
@@ -1,8 +1,10 @@
1
1
  import React from 'react';
2
2
  import { ProviderProps } from 'react-redux';
3
3
 
4
- /** String-keyed object map. */
4
+ /** `Record` with string keys, requiring only the value type. */
5
5
  type Dict<Value = any> = Record<string, Value>;
6
+ /** `Record` with default property keys, requiring only the value type. */
7
+ type Obj<Value = any> = Record<PropertyKey, Value>;
6
8
  /** Returns all tuple elements except the first. */
7
9
  type Tail<T extends any[]> = T extends [any, ...infer R] ? R : T extends (infer U)[] ? U[] : never;
8
10
  /** Removes properties whose value type is `never`. */
@@ -15,24 +17,44 @@ type ReadOnly<T> = T extends (...args: any[]) => any ? T : T extends readonly (i
15
17
  } : T;
16
18
 
17
19
  /** Runtime slice API exposed by createSlice(...). */
18
- type slice<S, R extends Mutations<S>, M> = GlobalUtils & {
20
+ type slice<S extends Obj, R extends Mutations<S, C>, M, C> = GlobalUtils & {
19
21
  /** Unique slice identifier. */
20
22
  readonly name: string;
23
+ /** Fully qualified runtime path of the slice. */
24
+ readonly path: string;
21
25
  /** Returns the latest immutable state snapshot. */
22
- readonly getState: () => SliceState<S, true>;
26
+ readonly getState: () => SliceState.State<S, C>;
23
27
  /** Subscribes to state changes within React components. Runs with a context-bound `this` containing `root` store, `rootState` and `global` utilities. */
24
- readonly useSelect: <T>(selector: (this: GlobalUtils, state: SliceState<S, true>, context: GlobalUtils) => T) => T;
25
- /** Returns fully qualified runtime path of the slice. */
26
- readonly getPath: () => string;
27
- } & {
28
+ readonly useSelect: <T>(selector: (this: GlobalUtils, state: SliceState.State<S, C>, context: GlobalUtils) => T) => T;
29
+ /** Root store that owns this slice instance. */
30
+ root: store<any>;
31
+ /** Parent slice in the hierarchy, if mounted under another slice. */
32
+ parent: slice<any, Mutations<any, any>, any, any> | undefined;
33
+ /** Runtime lineage and cloning utilities for this slice instance. */
34
+ readonly prototype: {
35
+ /** Creates a new detached clone within the same lineage. */
36
+ readonly clone: () => slice<S, R, M, C>;
37
+ /** Returns all slice instances in the same lineage, including this one. */
38
+ readonly getLineage: () => slice<S, R, M, C>[];
39
+ /** Returns all sibling instances in the same lineage, excluding this one. */
40
+ readonly getClones: () => slice<S, R, M, C>[];
41
+ /** Returns true if both slices belong to the same lineage. */
42
+ readonly isTypeOf: (other: any) => boolean;
43
+ };
44
+ /** Collection of derived state functions. */
45
+ readonly computed: undefined;
46
+ } & OmitNever<{
28
47
  /** Exposed mutation functions. */
29
- readonly [K in Exclude<keyof R, ReservedSliceKeys>]: (...args: Tail<Parameters<R[K]>>) => ReturnType<R[K]>;
30
- } & {
48
+ readonly [K in Exclude<keyof R, ReservedSliceKeys>]: R[K] extends (...args: any[]) => void ? (...args: Tail<Parameters<R[K]>>) => void : never;
49
+ }> & OmitNever<{
31
50
  /** Exposed method functions. */
32
- readonly [K in Exclude<keyof M, ReservedSliceKeys<R>>]: M[K];
33
- } & {};
51
+ readonly [K in Exclude<keyof M, ReservedSliceKeys<R>>]: M[K] extends (...args: any[]) => void ? M[K] : never;
52
+ }> & OmitNever<{
53
+ /** Exposed children. */
54
+ readonly [K in Exclude<keyof C, ReservedSliceKeys<R, M>>]: C[K] extends slice<infer S, infer R, infer M, infer C> ? slice<S, R, M, C> : never;
55
+ }>;
34
56
  /** Configuration object used to create a slice. */
35
- type sliceOptions<S, R extends Mutations<S>, M> = {
57
+ type sliceOptions<S extends Obj, R extends Mutations<S, C>, M, C> = {
36
58
  /** Unique slice identifier. */
37
59
  name: string;
38
60
  /** Initial state object or lazy state initializer. */
@@ -40,26 +62,44 @@ type sliceOptions<S, R extends Mutations<S>, M> = {
40
62
  /** Collection of synchronous state transition functions. */
41
63
  mutations?: R & ThisType<GlobalUtils>;
42
64
  /** Collection of slice methods and orchestration logic. */
43
- methods?: M & ThisType<slice<S, R, M> & {
65
+ methods?: M & ThisType<slice<S, R, M, C> & {
44
66
  root: RootStore;
45
67
  }>;
68
+ /** Collection of derived state functions. */ /** Collection of nested child slices. */
69
+ children?: C;
46
70
  };
47
71
  /** Defines the mutations available on a slice. */
48
- type Mutations<S> = Dict<(state: SliceState<S, false>, ...args: any[]) => void>;
72
+ type Mutations<S extends Obj, C> = Dict<(state: SliceState.Draft<S, C>, ...args: any[]) => void | S>;
49
73
  /** Derived state shape exposed by a slice, excluding internal framework fields. */
50
- type SliceState<S, isReadOnly> = isReadOnly extends true ? ReadOnly<S extends Dict ? Omit<S, "computed" | "children"> : S> : S extends Dict ? Omit<S, "computed" | "children"> : S;
74
+ declare namespace SliceState {
75
+ type InferState<C> = C extends Obj ? (C["getState"] extends () => infer S ? S extends Obj ? S : never : never) : never;
76
+ export type State<S extends Obj, C> = ReadOnly<Omit<S, "computed" | keyof OmitNever<{
77
+ [K in keyof C]: InferState<C[K]>;
78
+ }>> & OmitNever<{
79
+ [K in keyof C]: InferState<C[K]>;
80
+ }>>;
81
+ export type Draft<S extends Obj, C> = Omit<S, "computed" | keyof OmitNever<{
82
+ [K in keyof C]: C[K] extends AnySlice ? true : never;
83
+ }>> & OmitNever<{
84
+ [K in keyof C]: C[K] extends slice<infer S, infer _, infer __, infer C> ? Draft<S, C> : never;
85
+ }>;
86
+ export { };
87
+ }
51
88
  /** Reserved slice member names that cannot be overridden by user-defined APIs. */
52
- type ReservedSliceKeys<R = {}, M = {}> = ("name" | "computed" | "root" | "global" | "children" | "getState" | "useSelect" | "getPath") | (keyof R | keyof M);
89
+ type ReservedSliceKeys<R = {}, M = {}> = ("name" | "path" | "computed" | "root" | "parent" | "prototype" | "global" | "getState" | "useSelect") | (keyof R | keyof M);
90
+ type AnySlice = slice<any, Mutations<any, any>, any, any>;
53
91
 
54
92
  /** Runtime store API exposed by createStore(...). */
55
93
  type store<C> = OmitNever<GlobalUtils & {
94
+ /** Unique store identifier. Currently this is set to "default" and is nt configurable */
95
+ readonly name: "default";
56
96
  /** Returns the latest immutable state snapshot. */
57
97
  readonly getState: () => StoreState<C>;
58
98
  /** Subscribes to state changes within React components. Runs with a context-bound `this` containing `global` utilities. */
59
99
  readonly useSelect: <T>(selector: (this: GlobalUtils, state: StoreState<C>, context: GlobalUtils) => T) => T;
60
100
  } & {
61
101
  /** Exposed slices. */
62
- readonly [K in Exclude<keyof C, ReservedStoreKeys>]: C[K] extends slice<infer S, infer R, infer M> ? slice<S, R, M> : never;
102
+ readonly [K in Exclude<keyof C, ReservedStoreKeys>]: C[K] extends slice<infer S, infer R, infer M, infer C> ? slice<S, R, M, C> : never;
63
103
  }>;
64
104
  /** Configuration object used to create a store. */
65
105
  type storeOptions<C> = {
@@ -68,7 +108,7 @@ type storeOptions<C> = {
68
108
  };
69
109
  /** Derived immutable state shape of the store. */
70
110
  type StoreState<C> = ReadOnly<OmitNever<{
71
- readonly [K in Exclude<keyof C, ReservedStoreKeys>]: C[K] extends slice<infer S, infer _, infer __> ? SliceState<S, true> : never;
111
+ readonly [K in Exclude<keyof C, ReservedStoreKeys>]: C[K] extends slice<infer S, infer _, infer __, infer C> ? SliceState.State<S, C> : never;
72
112
  }>>;
73
113
  /** Props accepted by the store provider component. */
74
114
  type StoreProviderProps<T = any> = Omit<ProviderProps, "store" | "serverState" | "context"> & {
@@ -105,9 +145,9 @@ declare global {
105
145
  /** Configuration object used to create a store. */
106
146
  type StoreOptions<C> = storeOptions<C>;
107
147
  /** Runtime slice API exposed by createSlice(...). */
108
- type Slice<S, R extends Mutations<S>, M> = slice<S, R, M>;
148
+ type Slice<S extends Obj, R extends Mutations<S, C>, M, C> = slice<S, R, M, C>;
109
149
  /** Configuration object used to create a slice. */
110
- type SliceOptions<S, R extends Mutations<S>, M> = sliceOptions<S, R, M>;
150
+ type SliceOptions<S extends Obj, R extends Mutations<S, C>, M, C> = sliceOptions<S, R, M, C>;
111
151
  }
112
152
  }
113
153
 
@@ -120,14 +160,14 @@ declare function provideGlobalUtils(value: Partial<GlobalUtils["global"]>): Glob
120
160
  declare function configureDiagnostics(level: "off" | "errors" | "all"): void;
121
161
 
122
162
  /** Creates and initializes an OrcheStore slice. */
123
- declare const createSliceWrapper: <S, R extends Mutations<S>, M>(props: sliceOptions<S, R, M>) => slice<S, R, M>;
163
+ declare const createSliceWrapper: <S extends Obj, R extends Mutations<S, C>, M, C>(props: sliceOptions<S, R, M, C>) => slice<S, R, M, C>;
124
164
  /** Creates and initializes an OrcheStore instance. */
125
165
  declare const createStoreWrapper: <T>(props: storeOptions<T>) => store<T>;
126
166
  declare const defaultExport: {
127
167
  /** Creates and initializes an OrcheStore instance. */
128
168
  createStore: <T>(props: storeOptions<T>) => store<T>;
129
169
  /** Creates and initializes an OrcheStore slice. */
130
- createSlice: <S, R extends Mutations<S>, M>(props: sliceOptions<S, R, M>) => slice<S, R, M>;
170
+ createSlice: <S extends Obj, R extends Mutations<S, C>, M, C>(props: sliceOptions<S, R, M, C>) => slice<S, R, M, C>;
131
171
  /** Provides an OrcheStore instance to the React component tree. */
132
172
  StoreProvider: typeof StoreProvider;
133
173
  /** Registers or updates application-wide global utilities. */
package/dist/index.js CHANGED
@@ -1,30 +1,30 @@
1
- import{configureStore as ie}from"@reduxjs/toolkit";import{useSelector as ae}from"react-redux";var b="all",R={diagnostics:!1,prerelease:!1},U=globalThis.console?.log?.bind?.(globalThis.console)||globalThis.console?.log,J=globalThis.console?.warn?.bind?.(globalThis.console)||globalThis.console?.warn,V=globalThis.console?.error?.bind?.(globalThis.console)||globalThis.console?.error,X=globalThis.console?.clear?.bind?.(globalThis.console)||globalThis.console?.clear;globalThis.console?.clear&&(globalThis.console.clear=(...e)=>{R.diagnostics=!1,X?.(...e)});var _=`[OrcheStore] \u{1F6A7} Pre-release Notice
1
+ import{configureStore as ge}from"@reduxjs/toolkit";import{useSelector as Se}from"react-redux";var P="all",G={diagnostics:!1,prerelease:!1},z=globalThis.console?.log?.bind?.(globalThis.console)||globalThis.console?.log,re=globalThis.console?.warn?.bind?.(globalThis.console)||globalThis.console?.warn,oe=globalThis.console?.error?.bind?.(globalThis.console)||globalThis.console?.error,ne=globalThis.console?.clear?.bind?.(globalThis.console)||globalThis.console?.clear;globalThis.console?.clear&&(globalThis.console.clear=(...e)=>{G.diagnostics=!1,ne?.(...e)});var ae=`[OrcheStore] \u{1F6A7} Pre-release Notice
2
2
  Thank you for your interest in OrcheStore.
3
3
  OrcheStore is currently under active development and is not yet ready for production use.
4
4
  APIs, behavior, and internal implementation details may change without notice.
5
5
  The first stable release is currently planned for 2026-06-30.
6
6
  Stay tuned for updates!
7
- `,B=`[OrcheStore] Diagnostics are enabled.
7
+ `,ie=`[OrcheStore] Diagnostics are enabled.
8
8
  OrcheStore may emit warnings and errors to help identify incorrect usage, invalid configurations, and potential runtime issues.
9
9
  Runtime exceptions that stop code execution may still occur regardless of diagnostics settings.
10
10
  Please resolve all OrcheStore warnings and errors before deploying to production.
11
11
  Diagnostics can be configured with configureDiagnostics("off" | "errors" | "all").
12
- `,s={inform(e){R[e]||(R[e]=!0,b==="all"&&U?.(e==="prerelease"?_:B))},log(...e){b==="all"&&(s.inform("diagnostics"),U?.(...e))},warn(...e){b==="all"&&(s.inform("diagnostics"),J?.(...e))},error(...e){b!=="off"&&(s.inform("diagnostics"),V?.(...e))}};function N(e){b=e}var G=(...e)=>{let[r,t]=[e[2],e[3]],o=`${e[0]||"Received"}: `,n=e[1]!==!1?"(type: "+typeof r+")":"";if(!t?.(r))return r==null?[`${o}(type: ${r})`]:typeof r=="number"||typeof r=="bigint"||typeof r=="boolean"?[`${o}${n} ${r}`]:typeof r=="object"?[o,r]:r===""?[`${o}Empty String`]:[`${o}${n}`,r]},g=((e,r)=>G("Received",!0,e,r));g.prefixed=(e,r,t,o)=>G(e,r,t,o);var H=Object.assign,$=Object.getOwnPropertyDescriptor(Object,"defineProperty")?.value||Object.defineProperty,Q=(e,r,t)=>{$(e,r,{get:t,enumerable:!0,configurable:!1})},Y=(e,r,t)=>{$(e,r,{value:t,writable:!1,enumerable:!0,configurable:!1})},d={assign:H,defineProp:$,defineReadonly:Q,defineMethod:Y},A={isArray:Array.isArray},x={get:Reflect.get,set:Reflect.set,delete:Reflect.deleteProperty};var K={InvalidStore:e=>({StoreType:[`[OrcheStore::StoreProvider] Expected a store instance created with createStore(...).
13
- `,...g(e)]})},v={GetMissingProp:e=>["[OrcheStore::global-utils] Attempted to access a global utility before it became available. Missing property",e,`
12
+ `,l={inform(e){G[e]||(G[e]=!0,P==="all"&&z?.(e==="prerelease"?ae:ie))},log(...e){P==="all"&&(l.inform("diagnostics"),z?.(...e))},warn(...e){P==="all"&&(l.inform("diagnostics"),re?.(...e))},error(...e){P!=="off"&&(l.inform("diagnostics"),oe?.(...e))}};function W(e){P=e}var J=(...e)=>{let[t,r]=[e[2],e[3]],o=`${e[0]||"Received"}: `,s=e[1]!==!1?"(type: "+typeof t+")":"";if(!r?.(t))return t==null?[`${o}(type: ${t})`]:typeof t=="number"||typeof t=="bigint"||typeof t=="boolean"?[`${o}${s} ${t}`]:typeof t=="object"?[o,t]:t===""?[`${o}Empty String`]:[`${o}${s}`,t]},M=((e,t)=>J("Received",!0,e,t));M.prefixed=(e,t,r,o)=>J(e,t,r,o);var se=Object.assign,k=Object.getOwnPropertyDescriptor(Object,"defineProperty")?.value||Object.defineProperty,le=(e,t,r)=>{k(e,t,{get:r,enumerable:!0,configurable:!1})},ce=(e,t,r)=>{k(e,t,{value:r,writable:!1,enumerable:!0,configurable:!1})},u={assign:se,defineProp:k,defineReadonly:le,defineMethod:ce},X={isArray:Array.isArray},I={get:Reflect.get,set:Reflect.set,delete:Reflect.deleteProperty};var _={InvalidStore:{InvalidType:e=>[`[OrcheStore::StoreProvider] Expected a store instance created with createStore(...).
13
+ `,...M(e)]}},U={GetMissingProp:e=>["[OrcheStore::global-utils] Attempted to access a global utility before it became available. Missing property",e,`
14
14
  If this utility is optional, register it as undefined using provideGlobalUtils(...) to suppress future warnings.
15
15
  `],DeleteProp:e=>["[OrcheStore::global-utils] Avoid deleting properties. Trying to delete property",e,`
16
16
  Use provideGlobalUtils(...) to set them to undefined instead for type safety.
17
17
  `],InvalidArgs:()=>`[OrcheStore::global-utils] Expected provideGlobalUtils(...) to receive a non-null object.
18
- `},T={InvalidChild:e=>`[OrcheStore::createStore] Child slice '${e}' must be a slice created with createSlice(...).`,singletonLimitation:()=>`[OrcheStore::createStore] createStore(...) was called more than once.
18
+ `},N={InvalidChild:e=>`[OrcheStore::createStore] Child slice '${e}' must be a slice created with createSlice(...).`,singletonLimitation:()=>`[OrcheStore::createStore] createStore(...) was called more than once.
19
19
  OrcheStore currently supports only a single global store instance and will return the existing store.
20
20
  If you are creating a store inside a React component, create it only once, for example:
21
21
  const [store] = useState(() => createStore(...));
22
- Avoid useState(createStore(...)) because createStore(...) will execute on every render.`},u={InvalidStore:(e,r,t)=>({StoreType:[`[OrcheStore::${r}] Unable to resolve a valid store instance.
23
- This operation requires a store created with createStore(...).
24
- `,...g(e)],NeverExposed:[`[OrcheStore::${r}] Slice {${t}} has not been exposed in any store.
25
- Ensure the slice is reachable from a store instance.
26
- This can be done by exposing the slice directly through createStore({ slices: ... }) or indirectly through a parent slice using createSlice({ children: ... }).`],NotInTree:[`[OrcheStore::${r}] Slice {${t}} is not exposed within the target store.
27
- A slice can only be accessed through stores that expose it.
28
- `,...g.prefixed("Current store",!1,e)]}),RequiredName:()=>"[OrcheStore::createSlice] Missing required slice name. Expected a non-empty string.",InvalidName:e=>`[OrcheStore::createSlice] Slice names cannot contain '.' or '/'. Received: {${e}}`,RequiredState:e=>`[OrcheStore::createSlice] Missing required state for slice {${e}}.`,InvalidState:(e,r)=>[`[OrcheStore::createSlice]${m.target({slice:e})}Slice state must be a non-null object or a function that returns a non-null object.
29
- `,...g(r)],InvalidMutation:e=>`[OrcheStore::createSlice] Mutation '${e}' must be a function.`,InvalidMethod:e=>`[OrcheStore::createSlice] Method '${e}' must be a function.`,InvalidChild:e=>`[OrcheStore::createSlice] Child slice '${e}' must be a slice created with createSlice(...).`,ReduxReducerConflict:()=>"[OrcheStore::createSlice] Redux Toolkit asyncThunk reducers are not supported inside mutations. Use methods instead."},m={target:({slice:e})=>e?` Affected slice '${e}':
30
- `:" ",RequiredName:(e,r)=>`[OrcheStore::${e.module}]${m.target(e)}${r} keys must be non-empty strings.`,InvalidName:(e,r,t)=>`[OrcheStore::${e.module}]${m.target(e)}${r} names cannot contain '.' or '/'. Received: ${t}.`,ReservedKey:(e,r,t)=>`[OrcheStore::${e.module}]${m.target(e)}'${t}' is a reserved name and cannot be used as a ${r} key.`,DuplicateKey:(e,r,t)=>`[OrcheStore::${e.module}]${m.target(e)}${r} name '${t}' conflicts with another member.`};var P=new Proxy({},{get(e,r,t){return r in e||s.error(...v.GetMissingProp(r)),x.get(e,r,t)},set(e,r,t,o){return x.set(e,r,t,o)},deleteProperty(e,r){return s.warn(...v.DeleteProp(r)),x.delete(e,r)}});function h(){return P}function q(e){let r=g(e,t=>t&&typeof t=="object"&&!A.isArray(t));return r?s.error(v.InvalidArgs(),...r):d.assign(P,e),P}function y(e,r){let t={children:{}};return Object.keys(e).filter(n=>n.startsWith(r)).map(n=>n.split(".")).sort((n,a)=>n.length-a.length).forEach(n=>{let a=t;n.slice(0,n.length-1).forEach(i=>a=a[i]||={}),a.children||={},a.children[n[n.length-1]]={...e[n.join(".")]}}),t.children}var z=(e,r)=>{if(e)if(r==="warn")s.warn(e);else if(r==="error")s.error(e);else throw new Error(e);else return!1},M=(e,r="",t="",o)=>typeof e!="string"||!e?!!z(r,o?.[0]):e.includes(".")||e.includes("/")?!!z(t,o?.[1]):!0,Z=(e,r,t,o)=>{let n=m.RequiredName(e,r),a=m.InvalidName(e,r,t);if(M(t,n,a,["error","error"])){if(o[0].includes(t))return s.error(m.ReservedKey(e,r,t));if(o[1].includes(t))return s.error(m.DuplicateKey(e,r,t))}else return;return!0},E=e=>{let r=[],t=[e.reserved,r];return(o,n,a)=>(Object.entries(n).forEach(([i,c])=>{let l=Z(e,o,i,t)?a(i,c):void 0;if(l===void 0)return delete n[i];n[i]=l,r.push(i)}),n)},O=(e,r)=>{let t={...e||{}};return r.objects?.forEach(o=>{t[o]=typeof t[o]=="object"&&t[o]?{...t[o]}:{}}),r.validate?.(t),r.redux?.forEach(o=>{t[o]!==void 0&&s.warn(`[OrcheStore::${r.method}] '${o}' property is a Redux Toolkit option and is ignored by OrcheStore.`)}),r.unsupported?.forEach(o=>{Object.keys(t[o]).length<1||s.warn(`[OrcheStore::${r.method}] '${o}' property is not yet supported and will be ignored.`)}),t};import{createSlice as re,ReducerType as te}from"@reduxjs/toolkit";import{useSelector as oe}from"react-redux";var L=[],k=e=>{let r={children:{},roots:[]},t=r.slice={},o=O(e,{method:"createSlice",objects:["mutations","computed","methods","children"],unsupported:["computed","children"],redux:["reducers","extraReducers","reducerPath","initialState","selectors"],validate:ne}),n=E({module:"createSlice",slice:o.name,reserved:["name","computed","root","global","getState","useSelect","getPath"]});return n("mutation",o.mutations,(a,i)=>i?._reducerDefinitionType===te.asyncThunk||"reducer"in{...i||{}}?s.error(u.ReduxReducerConflict()):typeof i!="function"?s.error(u.InvalidMutation(a)):((l,I)=>i(l,...I.payload))),r.redux=re({name:o.name,initialState:o.state,reducers:o.mutations}),d.defineReadonly(t,"name",()=>o.name),d.defineReadonly(t,"global",()=>h()),d.defineMethod(t,"getPath",()=>C(t)),d.defineMethod(t,"getState",()=>{let a=u.InvalidStore(void 0,"slice.getState",o.name),i=S(r,void 0,a).redux.getState();return y(i,C(t))}),d.defineMethod(t,"useSelect",a=>{let i=u.InvalidStore(void 0,"slice.useSelect",o.name);return S(r,void 0,i),oe(c=>{let l={global:h()};return a.call(l,y(c,C(t)),l)})}),Object.entries(r.redux.actions).map(([a,i])=>{t[a]=(...c)=>{let l=u.InvalidStore(void 0,"slice mutation",o.name);return S(r,void 0,l).redux.dispatch(i(c))}}),n("method",o.methods,(a,i)=>typeof i!="function"?s.error(u.InvalidMethod(a)):t[a]=(...c)=>i.apply(t,c)),L.push(r),t};function D(e){return L.find(r=>r.slice===e)}var j=(e,r,t,o,n)=>{let{redux:a,children:i}=r;return r.path=e,r.roots.push(o),n[e]=a.reducer,Object.entries(i).forEach(([c,l])=>{j(e+"."+c,D(l),r.slice,o,n)}),t[e]=r.slice},ne=e=>{let r=t=>{if(typeof t!="object"){let o=u.InvalidState(e.name,t);throw o.every(n=>typeof n=="string")?new Error(o.join(" ")):(s.error(...o),new Error)}if(!t)throw new Error(u.RequiredState(e.name));return t};if(M(e.name,u.RequiredName(),u.InvalidName(e.name)),typeof e.state=="function"){let t=e.state;e.state=()=>r(t())}else r(e.state)},C=e=>e.name;var w=[],W=e=>{let r={},t=r.store={},o=O(e,{method:"createStore",objects:["slices"],redux:["reducer","devTools","duplicateMiddlewareCheck","enhancers","middleware","preloadedState"]}),n=E({module:"createStore",reserved:["name","computed","global","getState","useSelect"]});d.defineReadonly(t,"name",()=>"default"),d.defineReadonly(t,"global",()=>h()),d.defineMethod(t,"getState",()=>y(r.redux.getState(),"")),d.defineMethod(t,"useSelect",i=>ae(c=>{let l={global:h()};return i.call(l,y(c,""),l)}));let a={};return n("slice",o.slices,(i,c)=>{let l=D(c);return l?j(i,l,t,t,a):s.error(T.InvalidChild(i))}),r.redux=ie({reducer:a}),w.push(r),t},S=(e,r,t={})=>{if(t===!1)return w[0];let o;if((!e||r!==void 0)&&!w.find(n=>n.store===r)?o=t.StoreType:e&&!e.roots.length?o=t.NeverExposed:e&&r&&!e.roots.includes(r)&&(o=t.NotInTree),r=e&&r===void 0?e.roots[0]:r,o)throw o.every(n=>typeof n=="string")?new Error(o.join(" ")):(s.error(...o),new Error);return w.find(n=>n.store===r)};import se from"react";import{Provider as le}from"react-redux";function F(e){let{store:r,...t}={...e||{}},o=S(void 0,r,K.InvalidStore(r));return se.createElement(le,{...t,store:o.redux})}var ce=e=>(s.inform("prerelease"),k(e)),de=e=>(s.inform("prerelease"),S(void 0,void 0,!1)?(s.warn(T.singletonLimitation()),S(void 0,void 0,!1).store):W(e)),pr={createStore:de,createSlice:ce,StoreProvider:F,provideGlobalUtils:q,getGlobalUtils:h,configureDiagnostics:N};export{F as StoreProvider,N as configureDiagnostics,ce as createSlice,de as createStore,pr as default,h as getGlobalUtils,q as provideGlobalUtils};
22
+ Avoid useState(createStore(...)) because createStore(...) will execute on every render.`},v={InvalidStore:(e,t)=>({NeverExposed:[`[OrcheStore::${e}] Slice {${t}} is not reachable from any store instance.
23
+ A slice must be connected to a store via one of the following:
24
+ \u2022 createStore({ slices: ... }) \u2014 expose it directly in the root store
25
+ \u2022 createSlice({ children: ... }) \u2014 attach it under another slice that is already reachable`],InvalidType:r=>[`[OrcheStore::${e}] Slice {${t}} depends on parent slice {${r.name}}, but that parent is not reachable from any store instance.
26
+ Fix the parent first using one of the following:
27
+ \u2022 createStore({ slices: ... }) \u2014 expose the parent directly in the root store
28
+ \u2022 createSlice({ children: ... }) \u2014 attach the parent under another parent slice that is already reachable`]}),RequiredName:()=>"[OrcheStore::createSlice] Missing required slice name. Expected a non-empty string.",InvalidName:e=>`[OrcheStore::createSlice] Slice names cannot contain '.' or '/'. Received: {${e}}`,RequiredState:e=>`[OrcheStore::createSlice] Missing required state for slice {${e}}.`,InvalidState:(e,t)=>[`[OrcheStore::createSlice]${b.target({slice:e})}Slice state must be a non-null object or a function that returns a non-null object.
29
+ `,...M(t)],InvalidMutation:e=>`[OrcheStore::createSlice] Mutation '${e}' must be a function.`,InvalidMethod:e=>`[OrcheStore::createSlice] Method '${e}' must be a function.`,InvalidChild:e=>`[OrcheStore::createSlice] Child slice '${e}' must be a slice created with createSlice(...).`,ReduxReducerConflict:()=>"[OrcheStore::createSlice] Redux Toolkit asyncThunk reducers are not supported inside mutations. Use methods instead."},b={target:({slice:e})=>e?` Affected slice '${e}':
30
+ `:" ",RequiredName:(e,t)=>`[OrcheStore::${e.module}]${b.target(e)}${t} keys must be non-empty strings.`,InvalidName:(e,t,r)=>`[OrcheStore::${e.module}]${b.target(e)}${t} names cannot contain '.' or '/'. Received: ${r}.`,ReservedKey:(e,t,r)=>`[OrcheStore::${e.module}]${b.target(e)}'${r}' is a reserved name and cannot be used as a ${t} key.`,DuplicateKey:(e,t,r)=>`[OrcheStore::${e.module}]${b.target(e)}${t} name '${r}' conflicts with another member.`};var K=new Proxy({},{get(e,t,r){return t in e||l.error(...U.GetMissingProp(t)),I.get(e,t,r)},set(e,t,r,o){return I.set(e,t,r,o)},deleteProperty(e,t){return l.warn(...U.DeleteProp(t)),I.delete(e,t)}});function T(){return K}function B(e){let t=M(e,r=>r&&typeof r=="object"&&!X.isArray(r));return t?l.error(U.InvalidArgs(),...t):u.assign(K,e),K}var{createNodeFactory:j}={createNodeFactory({factoryName:e,instantiate:t,options:r={}}){let o=new Map,s=new Map,p=d=>{d=r.adapt?r.adapt(d):d,d=r.register?r.register(d):d;let n={familyId:Symbol("family"),path:"",children:new Map,parents:[]},a={props:d,siblings:new Set};return n.node=t(d,n,a),a.siblings.add(n.node),o.set(n.node,n),s.set(n.familyId,a),n.node},x=(d,n)=>{let a=o.get(d),i=a?s.get(a.familyId):void 0;if(!a||!i){if(n?.UnknownNode)return void n?.UnknownNode?.("",d);throw new Error(`[OrcheStore] ${e} factory: Unknown node`)}return m("",[],a,i,!0,()=>{})},y=(d,n,a,i,c)=>{let f=o.get(n),O=f?s.get(f.familyId):void 0;if(!f||!O){if(c?.UnknownNode)return void c?.UnknownNode?.(d,n);throw new Error(`[OrcheStore] ${e} factory: Unknown node`)}let h=i||o.get(a);if(!h){if(c?.UnknownParent)return void c?.UnknownParent?.(d,n,a);throw new Error(`[OrcheStore] ${e} factory: Unknown parent node`)}for(let R of[a,...h.parents])if(R===n){if(c?.InfiniteOwnership)return void c?.InfiniteOwnership?.(d,n,a);throw new Error(`[OrcheStore] ${e} factory: Infinite ownership recursion`)}let E=(h.path?`${h.path}.`:"")+d,$=[a,...h.parents];return m(E,$,f,O,!1,R=>h.children.set(d,R))};function m(...d){let[n,a,i,c,f,O]=d;if(f=f||i.parents.length>0&&(i.parents[0]!==a[0]||i.path.split(".").at(-1)!==n.split(".").at(-1)),f){let h={familyId:i.familyId,path:n,children:new Map(i.children),parents:a},E=r.clone?r.clone(c.props,i,c):c.props;i=h,i.node=t(E,h,c),o.set(i.node,h),c.siblings.add(i.node)}i.path=n,i.parents=a,O?.(i.node);for(let[h,E]of[...i.children.entries()]){let $=o.get(E),R=$?s.get($.familyId):void 0,te=`${n}${n?".":""}${h}`;m(te,[i.node,...a],$,R,!1,L=>{L!==E&&i.children.set(h,L)})}return i.node}return{families:s,instances:o,create:p,attach:y,clone:x}}};import{ReducerType as ue,createSlice as pe}from"@reduxjs/toolkit";import{useSelector as fe}from"react-redux";var H=(e,t)=>{if(e)if(t==="warn")l.warn(e);else if(t==="error")l.error(e);else throw new Error(e);else return!1},D=(e,t="",r="",o)=>typeof e!="string"||!e?!!H(t,o?.[0]):e.includes(".")||e.includes("/")?!!H(r,o?.[1]):!0,de=(e,t,r,o)=>{let s=b.RequiredName(e,t),p=b.InvalidName(e,t,r);if(D(r,s,p,["error","error"])){if(o[0].includes(r))return l.error(b.ReservedKey(e,t,r));if(o[1].includes(r))return l.error(b.DuplicateKey(e,t,r))}else return;return!0},A=e=>{let t=[],r=[e.reserved,t];return(o,s,p,x)=>{let y=s?[]:{};return Object.entries(p).forEach(([m,d])=>{let n=de(e,o,m,r)?x(m,d):void 0;n!==void 0&&(s?y.push([m,n]):y[m]=n,t.push(m))}),y}},F=(e,t)=>{let r={...e||{}};return t.objects?.forEach(o=>{r[o]=typeof r[o]=="object"&&r[o]?{...r[o]}:{}}),t.validate?.(r),t.redux?.forEach(o=>{r[o]!==void 0&&l.warn(`[OrcheStore::${t.method}] '${o}' property is a Redux Toolkit option and is ignored by OrcheStore.`)}),t.unsupported?.forEach(o=>{Object.keys(r[o]).length<1||l.warn(`[OrcheStore::${t.method}] '${o}' property is not yet supported and will be ignored.`)}),r};var{families:ye,instances:C,create:me,attach:q,clone:he}=j({factoryName:"slice",instantiate(e,t,r){let o={},s=n=>w(void 0,t,n?v.InvalidStore(n,e.name):!1),p=A({module:"createSlice",slice:e.name,reserved:["name","path","computed","root","parent","prototype","global","getState","useSelect"]}),x=p("mutation",!1,e.mutations,(n,a)=>a?._reducerDefinitionType===ue.asyncThunk||"reducer"in{...a||{}}?l.error(v.ReduxReducerConflict()):typeof a!="function"?l.error(v.InvalidMutation(n)):(c,f)=>f?.meta?.path===t.path?a(c,...f.payload):c);t.redux=pe({name:e.name,initialState:e.state,reducers:x}),u.defineReadonly(o,"name",()=>e.name),u.defineReadonly(o,"path",()=>t.path),u.defineReadonly(o,"global",()=>T()),u.defineReadonly(o,"root",()=>s().node),u.defineReadonly(o,"parent",()=>{let n=t.parents[0];return(n?C.get(n):void 0)?.node}),u.defineMethod(o,"getState",()=>{let n=s("slice.getState").redux.getState();return t.path.split(".").forEach(a=>n=(n||{})[a]),n}),u.defineMethod(o,"useSelect",n=>{let a={global:T(),root:s("slice.useSelect").node};return fe(i=>(t.path.split(".").forEach(c=>i=(i||{})[c]),n.apply(a,[i,a])))}),u.defineReadonly(o,"computed",()=>{});let y={},m=()=>[...r.siblings.values()||[]];u.defineReadonly(o,"prototype",()=>y),u.defineMethod(y,"clone",()=>he(o)),u.defineMethod(y,"getLineage",()=>m()),u.defineMethod(y,"getClones",()=>m().filter(n=>n!==o)),u.defineMethod(y,"isTypeOf",n=>r===ye.get(C.get(n)?.familyId)),Object.entries(t.redux.actions).map(([n,a])=>{o[n]=(...i)=>{s("slice mutation").redux.dispatch({...a(i),meta:{path:t.path}})}}),p("method",!1,e.methods,(n,a)=>typeof a!="function"?l.error(v.InvalidMethod(n)):o[n]=(...i)=>a.apply(o,i));let d=p("child",!0,e.children,(n,a)=>{let c=q(n,a,o,t,{UnknownNode:f=>l.error(v.InvalidChild(f))});if(c)return o[n]=c,C.get(c).reducers});return t.reducers=(n,a)=>{let i=a?.meta?.path;if(typeof i=="string"&&!i.startsWith(t.path))return n;let c={...t.redux.reducer(n,a)};for(let[f,O]of d)c[f]=O(c?.[f],a);return c},o},options:{adapt(e){return F(e,{method:"createSlice",objects:["mutations","computed","methods","children"],unsupported:["computed"],redux:["reducers","extraReducers","reducerPath","initialState","selectors"],validate(t){D(t.name,v.RequiredName(),v.InvalidName(t.name));let r=t.state;if(typeof r!="function")return void Q(t.name,r);t.state=()=>Q(t.name,r())}})},clone(e,t){let r=t.redux.getInitialState();return{...e,state:r}}}}),Q=(e,t)=>{if(typeof t!="object"){let r=v.InvalidState(e,t);throw r.every(o=>typeof o=="string")?new Error(r.join(" ")):(l.error(...r),new Error)}if(!t)throw new Error(v.RequiredState(e));return t},V=e=>me(e);var{instances:Y,create:be}=j({factoryName:"slice",instantiate(e,t){let r={},o=A({module:"createStore",reserved:["name","computed","global","getState","useSelect"]});return u.defineReadonly(r,"name",()=>"default"),u.defineReadonly(r,"global",()=>T()),u.defineMethod(r,"getState",()=>t.redux.getState()),u.defineMethod(r,"useSelect",s=>{let p={global:T(),root:r};return Se(x=>s.apply(p,[x,p]))}),t.reducers=o("slice",!1,e.slices,(s,p)=>{let y=q(s,p,r,t,{UnknownNode:m=>l.error(N.InvalidChild(m))});if(y)return r[s]=y,C.get(y).reducers}),t.redux=ge({reducer:t.reducers}),r},options:{adapt(e){return F(e,{method:"createStore",objects:["slices"],redux:["reducer","devTools","duplicateMiddlewareCheck","enhancers","middleware","preloadedState"]})}}}),w=(e,t,r=!1)=>{if(r===!0)return[...Y.values()][0];e||=t?.parents?.at?.(-1);let o=e?Y.get(e):void 0,s=[];if(t&&!e?s=r===!1?[]:r.NeverExposed:o||(s=r===!1?[]:r.InvalidType(e)),s&&s.length)throw s.every(p=>typeof p=="string")?new Error(s.join(" ")):(l.error(...s),new Error);return o},Z=e=>be(e);import ve from"react";import{Provider as xe}from"react-redux";function ee(e){let{store:t,...r}={...e||{}},o=w(t,void 0,_.InvalidStore);return ve.createElement(xe,{...r,store:o.redux})}var Te=e=>(l.inform("prerelease"),V(e)),we=e=>(l.inform("prerelease"),w(void 0,void 0,!0)?(l.warn(N.singletonLimitation()),w(void 0,void 0,!0).node):Z(e)),Et={createStore:we,createSlice:Te,StoreProvider:ee,provideGlobalUtils:B,getGlobalUtils:T,configureDiagnostics:W};export{ee as StoreProvider,W as configureDiagnostics,Te as createSlice,we as createStore,Et as default,T as getGlobalUtils,B as provideGlobalUtils};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "orchestore",
3
- "version": "0.1.6",
3
+ "version": "0.1.7",
4
4
  "description": "A function-oriented architecture built on top of Redux Toolkit for simplifying and automating application development.",
5
5
  "author": "Oussama Saadaoui",
6
6
  "license": "MIT",