@flurryx/store 1.0.0 → 1.1.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.
package/dist/index.cjs CHANGED
@@ -21,6 +21,7 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
21
21
  var index_exports = {};
22
22
  __export(index_exports, {
23
23
  BaseStore: () => BaseStore,
24
+ INVALID_STORE_KEY_ERROR: () => INVALID_STORE_KEY_ERROR,
24
25
  LazyStore: () => LazyStore,
25
26
  Store: () => Store,
26
27
  clearAllStores: () => clearAllStores,
@@ -37,7 +38,7 @@ __export(index_exports, {
37
38
  module.exports = __toCommonJS(index_exports);
38
39
 
39
40
  // src/base-store.ts
40
- var import_core2 = require("@angular/core");
41
+ var import_core3 = require("@angular/core");
41
42
 
42
43
  // src/store-clone.ts
43
44
  function cloneValue(value) {
@@ -120,10 +121,260 @@ function createSnapshotRestorePatch(currentState, snapshotState) {
120
121
  return patch;
121
122
  }
122
123
 
124
+ // src/store-replay.ts
125
+ var import_core2 = require("@angular/core");
126
+
123
127
  // src/store-messages.ts
124
128
  var INVALID_HISTORY_INDEX_ERROR = "History index is out of range";
125
129
  var INVALID_HISTORY_MESSAGE_ID_ERROR = "History message id is out of range";
126
130
  var MESSAGE_NOT_ACKNOWLEDGED_ERROR = "Message was not acknowledged";
131
+ var INVALID_STORE_KEY_ERROR = "Invalid store key";
132
+
133
+ // src/store-message-consumer.ts
134
+ var import_core = require("@flurryx/core");
135
+ function createDefaultState() {
136
+ return {
137
+ data: void 0,
138
+ isLoading: false,
139
+ status: void 0,
140
+ errors: void 0
141
+ };
142
+ }
143
+ function createStoreMessageConsumer(signals, notifier) {
144
+ function applyUpdate(key, newState, notify = true) {
145
+ const sig = signals.getOrCreate(key);
146
+ const previousState = sig();
147
+ sig.update((state) => ({ ...state, ...newState }));
148
+ if (notify) {
149
+ const updatedState = sig();
150
+ notifier.notify(key, updatedState, previousState);
151
+ }
152
+ return true;
153
+ }
154
+ function applyClear(key) {
155
+ const sig = signals.getOrCreate(key);
156
+ const previousState = sig();
157
+ sig.set(createDefaultState());
158
+ const nextState = sig();
159
+ notifier.notify(key, nextState, previousState);
160
+ return true;
161
+ }
162
+ function applyClearAll() {
163
+ const keys = Array.from(signals.getAllKeys());
164
+ if (keys.length === 0) {
165
+ return false;
166
+ }
167
+ keys.forEach((key) => {
168
+ applyClear(key);
169
+ });
170
+ return true;
171
+ }
172
+ function applyStartLoading(key) {
173
+ const sig = signals.getOrCreate(key);
174
+ sig.update(
175
+ (state) => ({
176
+ ...state,
177
+ status: void 0,
178
+ isLoading: true,
179
+ errors: void 0
180
+ })
181
+ );
182
+ return true;
183
+ }
184
+ function applyStopLoading(key) {
185
+ const sig = signals.getOrCreate(key);
186
+ sig.update(
187
+ (state) => ({
188
+ ...state,
189
+ isLoading: false
190
+ })
191
+ );
192
+ return true;
193
+ }
194
+ function applyUpdateKeyedOne(key, resourceKey, entity) {
195
+ const sig = signals.getOrCreate(key);
196
+ const state = sig();
197
+ const data = (0, import_core.isKeyedResourceData)(state.data) ? state.data : (0, import_core.createKeyedResourceData)();
198
+ const nextErrors = { ...data.errors };
199
+ delete nextErrors[resourceKey];
200
+ const nextData = {
201
+ ...data,
202
+ entities: { ...data.entities, [resourceKey]: entity },
203
+ isLoading: { ...data.isLoading, [resourceKey]: false },
204
+ status: { ...data.status, [resourceKey]: "Success" },
205
+ errors: nextErrors
206
+ };
207
+ return applyUpdate(key, {
208
+ data: nextData,
209
+ isLoading: (0, import_core.isAnyKeyLoading)(nextData.isLoading),
210
+ status: void 0,
211
+ errors: void 0
212
+ });
213
+ }
214
+ function applyClearKeyedOne(key, resourceKey) {
215
+ const sig = signals.getOrCreate(key);
216
+ const previousState = sig();
217
+ const state = previousState;
218
+ if (!(0, import_core.isKeyedResourceData)(state.data)) {
219
+ return true;
220
+ }
221
+ const data = state.data;
222
+ const nextEntities = { ...data.entities };
223
+ delete nextEntities[resourceKey];
224
+ const nextIsLoading = { ...data.isLoading };
225
+ delete nextIsLoading[resourceKey];
226
+ const nextStatus = { ...data.status };
227
+ delete nextStatus[resourceKey];
228
+ const nextErrors = { ...data.errors };
229
+ delete nextErrors[resourceKey];
230
+ const nextData = {
231
+ ...data,
232
+ entities: nextEntities,
233
+ isLoading: nextIsLoading,
234
+ status: nextStatus,
235
+ errors: nextErrors
236
+ };
237
+ sig.update(
238
+ (prev) => ({
239
+ ...prev,
240
+ data: nextData,
241
+ status: void 0,
242
+ isLoading: (0, import_core.isAnyKeyLoading)(nextIsLoading),
243
+ errors: void 0
244
+ })
245
+ );
246
+ const updatedState = sig();
247
+ notifier.notify(key, updatedState, previousState);
248
+ return true;
249
+ }
250
+ function applyStartKeyedLoading(key, resourceKey) {
251
+ const sig = signals.getOrCreate(key);
252
+ const state = sig();
253
+ if (!(0, import_core.isKeyedResourceData)(state.data)) {
254
+ return applyStartLoading(key);
255
+ }
256
+ const previousState = state;
257
+ const data = state.data;
258
+ const nextIsLoading = {
259
+ ...data.isLoading,
260
+ [resourceKey]: true
261
+ };
262
+ const nextStatus = { ...data.status };
263
+ delete nextStatus[resourceKey];
264
+ const nextErrors = { ...data.errors };
265
+ delete nextErrors[resourceKey];
266
+ const nextData = {
267
+ ...data,
268
+ isLoading: nextIsLoading,
269
+ status: nextStatus,
270
+ errors: nextErrors
271
+ };
272
+ sig.update(
273
+ (previous) => ({
274
+ ...previous,
275
+ data: nextData,
276
+ status: void 0,
277
+ isLoading: (0, import_core.isAnyKeyLoading)(nextIsLoading),
278
+ errors: void 0
279
+ })
280
+ );
281
+ const updatedState = sig();
282
+ notifier.notify(key, updatedState, previousState);
283
+ return true;
284
+ }
285
+ function applyMessage(message) {
286
+ switch (message.type) {
287
+ case "update":
288
+ return applyUpdate(message.key, cloneValue(message.state));
289
+ case "clear":
290
+ return applyClear(message.key);
291
+ case "clearAll":
292
+ return applyClearAll();
293
+ case "startLoading":
294
+ return applyStartLoading(message.key);
295
+ case "stopLoading":
296
+ return applyStopLoading(message.key);
297
+ case "updateKeyedOne":
298
+ return applyUpdateKeyedOne(
299
+ message.key,
300
+ message.resourceKey,
301
+ cloneValue(message.entity)
302
+ );
303
+ case "clearKeyedOne":
304
+ return applyClearKeyedOne(message.key, message.resourceKey);
305
+ case "startKeyedLoading":
306
+ return applyStartKeyedLoading(message.key, message.resourceKey);
307
+ }
308
+ }
309
+ function applySnapshot(snapshot) {
310
+ const keys = /* @__PURE__ */ new Set([
311
+ ...Array.from(signals.getAllKeys()),
312
+ ...Object.keys(snapshot)
313
+ ]);
314
+ keys.forEach((rawKey) => {
315
+ const key = rawKey;
316
+ const sig = signals.getOrCreate(key);
317
+ const snapshotState = snapshot[key] ?? createDefaultState();
318
+ applyUpdate(key, createSnapshotRestorePatch(sig(), snapshotState), true);
319
+ });
320
+ }
321
+ function captureSnapshot() {
322
+ const entries = Array.from(signals.getAllKeys()).map((key) => [
323
+ key,
324
+ cloneValue(signals.getOrCreate(key)())
325
+ ]);
326
+ return Object.fromEntries(entries);
327
+ }
328
+ function applyKeyUpdate(key, snapshotState) {
329
+ const sig = signals.getOrCreate(key);
330
+ const currentState = sig();
331
+ const patch = createSnapshotRestorePatch(currentState, snapshotState);
332
+ applyUpdate(key, patch, true);
333
+ }
334
+ return {
335
+ applyMessage,
336
+ applySnapshot,
337
+ applyKeyUpdate,
338
+ createSnapshot: captureSnapshot
339
+ };
340
+ }
341
+ function createUpdateMessage(key, state) {
342
+ return { type: "update", key, state };
343
+ }
344
+ function createClearMessage(key) {
345
+ return { type: "clear", key };
346
+ }
347
+ function createClearAllMessage() {
348
+ return { type: "clearAll" };
349
+ }
350
+ function createStartLoadingMessage(key) {
351
+ return { type: "startLoading", key };
352
+ }
353
+ function createStopLoadingMessage(key) {
354
+ return { type: "stopLoading", key };
355
+ }
356
+ function createUpdateKeyedOneMessage(key, resourceKey, entity) {
357
+ return {
358
+ type: "updateKeyedOne",
359
+ key,
360
+ resourceKey,
361
+ entity
362
+ };
363
+ }
364
+ function createClearKeyedOneMessage(key, resourceKey) {
365
+ return {
366
+ type: "clearKeyedOne",
367
+ key,
368
+ resourceKey
369
+ };
370
+ }
371
+ function createStartKeyedLoadingMessage(key, resourceKey) {
372
+ return {
373
+ type: "startKeyedLoading",
374
+ key,
375
+ resourceKey
376
+ };
377
+ }
127
378
 
128
379
  // src/store-channels.ts
129
380
  function serializeStoreMessageChannelValue(value) {
@@ -426,31 +677,162 @@ function toDeadLetterEntry(record) {
426
677
  failedAt: record.lastAttemptedAt ?? record.createdAt
427
678
  };
428
679
  }
429
- function createStoreHistory(config) {
430
- const messageChannel = config.channel ?? createInMemoryStoreMessageChannel();
431
- const clock = config.clock ?? Date.now;
432
- let history = [
433
- {
434
- id: null,
435
- index: 0,
436
- message: null,
437
- snapshot: config.captureSnapshot(),
438
- acknowledgedAt: null
680
+ function areValuesEquivalent(left, right, seen = /* @__PURE__ */ new WeakMap()) {
681
+ if (Object.is(left, right)) {
682
+ return true;
683
+ }
684
+ if (typeof left !== typeof right || left === null || right === null) {
685
+ return false;
686
+ }
687
+ if (typeof left !== "object" || typeof right !== "object") {
688
+ return false;
689
+ }
690
+ let seenRights = seen.get(left);
691
+ if (seenRights?.has(right)) {
692
+ return true;
693
+ }
694
+ if (!seenRights) {
695
+ seenRights = /* @__PURE__ */ new WeakSet();
696
+ seen.set(left, seenRights);
697
+ }
698
+ seenRights.add(right);
699
+ if (left instanceof Date || right instanceof Date) {
700
+ return left instanceof Date && right instanceof Date && left.getTime() === right.getTime();
701
+ }
702
+ if (left instanceof Map || right instanceof Map) {
703
+ if (!(left instanceof Map) || !(right instanceof Map)) {
704
+ return false;
705
+ }
706
+ const leftEntries = Array.from(left.entries());
707
+ const rightEntries = Array.from(right.entries());
708
+ if (leftEntries.length !== rightEntries.length) {
709
+ return false;
710
+ }
711
+ return leftEntries.every(([leftKey, leftValue], index) => {
712
+ const rightEntry = rightEntries[index];
713
+ if (!rightEntry) {
714
+ return false;
715
+ }
716
+ return areValuesEquivalent(leftKey, rightEntry[0], seen) && areValuesEquivalent(leftValue, rightEntry[1], seen);
717
+ });
718
+ }
719
+ if (left instanceof Set || right instanceof Set) {
720
+ if (!(left instanceof Set) || !(right instanceof Set)) {
721
+ return false;
722
+ }
723
+ const leftValues = Array.from(left.values());
724
+ const rightValues = Array.from(right.values());
725
+ if (leftValues.length !== rightValues.length) {
726
+ return false;
727
+ }
728
+ return leftValues.every(
729
+ (leftValue, index) => areValuesEquivalent(leftValue, rightValues[index], seen)
730
+ );
731
+ }
732
+ if (Array.isArray(left) || Array.isArray(right)) {
733
+ if (!Array.isArray(left) || !Array.isArray(right)) {
734
+ return false;
735
+ }
736
+ if (left.length !== right.length) {
737
+ return false;
738
+ }
739
+ return left.every(
740
+ (leftValue, index) => areValuesEquivalent(leftValue, right[index], seen)
741
+ );
742
+ }
743
+ if (Object.getPrototypeOf(left) !== Object.getPrototypeOf(right)) {
744
+ return false;
745
+ }
746
+ const leftRecord = left;
747
+ const rightRecord = right;
748
+ const leftKeys = Reflect.ownKeys(leftRecord);
749
+ const rightKeys = Reflect.ownKeys(rightRecord);
750
+ if (leftKeys.length !== rightKeys.length) {
751
+ return false;
752
+ }
753
+ return leftKeys.every((key) => {
754
+ if (!Object.prototype.hasOwnProperty.call(rightRecord, key)) {
755
+ return false;
756
+ }
757
+ return areValuesEquivalent(leftRecord[key], rightRecord[key], seen);
758
+ });
759
+ }
760
+ function areStoreMessageRecordsEquivalent(sourceRecord, cachedRecord) {
761
+ return sourceRecord.id === cachedRecord.id && sourceRecord.status === cachedRecord.status && sourceRecord.attempts === cachedRecord.attempts && sourceRecord.createdAt === cachedRecord.createdAt && sourceRecord.lastAttemptedAt === cachedRecord.lastAttemptedAt && sourceRecord.acknowledgedAt === cachedRecord.acknowledgedAt && sourceRecord.error === cachedRecord.error && areValuesEquivalent(sourceRecord.message, cachedRecord.message);
762
+ }
763
+ function createStableReadonlyCollection(items) {
764
+ return Object.freeze([...items]);
765
+ }
766
+ function appendStableReadonlyCollectionItem(input) {
767
+ return createStableReadonlyCollection([...input.items, input.item]);
768
+ }
769
+ function upsertStableReadonlyCollectionItem(input) {
770
+ const existingIndex = input.items.findIndex(
771
+ (candidate) => candidate.id === input.item.id
772
+ );
773
+ if (existingIndex === -1) {
774
+ return appendStableReadonlyCollectionItem(input);
775
+ }
776
+ if (Object.is(input.items[existingIndex], input.item)) {
777
+ return input.items;
778
+ }
779
+ const nextItems = [...input.items];
780
+ nextItems[existingIndex] = input.item;
781
+ return createStableReadonlyCollection(nextItems);
782
+ }
783
+ function syncStableReadonlyCollectionById(input) {
784
+ const cachedItemsById = /* @__PURE__ */ new Map();
785
+ input.items.forEach((item) => {
786
+ cachedItemsById.set(item.id, item);
787
+ });
788
+ let didChange = input.items.length !== input.sourceItems.length;
789
+ const nextItems = input.sourceItems.map((sourceItem, index) => {
790
+ const cachedItem = cachedItemsById.get(input.getSourceId(sourceItem));
791
+ const nextItem = cachedItem && input.areEquivalent(sourceItem, cachedItem) ? cachedItem : input.createItem(sourceItem);
792
+ if (!didChange && input.items[index] !== nextItem) {
793
+ didChange = true;
794
+ }
795
+ return nextItem;
796
+ });
797
+ return didChange ? createStableReadonlyCollection(nextItems) : input.items;
798
+ }
799
+ function createStoreHistory(config) {
800
+ const messageChannel = config.channel ?? createInMemoryStoreMessageChannel();
801
+ const clock = config.clock ?? Date.now;
802
+ let history = [
803
+ {
804
+ id: null,
805
+ index: 0,
806
+ message: null,
807
+ snapshot: config.captureSnapshot(),
808
+ acknowledgedAt: null
439
809
  }
440
810
  ];
441
811
  let currentIndex = 0;
812
+ let historyCollection = createStableReadonlyCollection(
813
+ history.map((entry) => cloneValue(entry))
814
+ );
815
+ let messageCollection = createStableReadonlyCollection(
816
+ messageChannel.getMessages().map((record) => cloneValue(record))
817
+ );
818
+ const version = (0, import_core2.signal)(0);
819
+ function notifyVersion() {
820
+ version.update((v) => v + 1);
821
+ }
442
822
  function recordSnapshot(record) {
443
823
  const nextIndex = history.length;
444
- history = [
445
- ...history,
446
- {
447
- id: record.id,
448
- index: nextIndex,
449
- message: cloneValue(record.message),
450
- snapshot: config.captureSnapshot(),
451
- acknowledgedAt: record.acknowledgedAt
452
- }
453
- ];
824
+ const nextHistoryEntry = {
825
+ id: record.id,
826
+ index: nextIndex,
827
+ message: cloneValue(record.message),
828
+ snapshot: config.captureSnapshot(),
829
+ acknowledgedAt: record.acknowledgedAt
830
+ };
831
+ history = [...history, nextHistoryEntry];
832
+ historyCollection = appendStableReadonlyCollectionItem({
833
+ items: historyCollection,
834
+ item: cloneValue(nextHistoryEntry)
835
+ });
454
836
  currentIndex = nextIndex;
455
837
  }
456
838
  function truncateFutureHistory() {
@@ -458,29 +840,45 @@ function createStoreHistory(config) {
458
840
  return;
459
841
  }
460
842
  history = history.slice(0, currentIndex + 1);
843
+ historyCollection = createStableReadonlyCollection(
844
+ historyCollection.slice(0, currentIndex + 1)
845
+ );
461
846
  }
462
847
  function ensureIndexInRange(index) {
463
848
  if (!Number.isInteger(index) || index < 0 || index >= history.length) {
464
849
  throw new Error(INVALID_HISTORY_INDEX_ERROR);
465
850
  }
466
851
  }
467
- function travelTo(index) {
852
+ function restoreStoreAt(index) {
468
853
  ensureIndexInRange(index);
469
854
  config.applySnapshot(history[index].snapshot);
470
855
  currentIndex = index;
856
+ notifyVersion();
857
+ }
858
+ function restoreResource(key, index) {
859
+ const targetIndex = index !== void 0 ? index : currentIndex;
860
+ ensureIndexInRange(targetIndex);
861
+ const allKeys = new Set(Array.from(config.getAllKeys()));
862
+ if (!allKeys.has(key)) {
863
+ throw new Error(INVALID_STORE_KEY_ERROR);
864
+ }
865
+ const snapshot = history[targetIndex].snapshot;
866
+ const snapshotState = snapshot[key];
867
+ config.applyKeyUpdate(key, snapshotState ?? createDefaultState());
868
+ notifyVersion();
471
869
  }
472
870
  function undo() {
473
871
  if (currentIndex === 0) {
474
872
  return false;
475
873
  }
476
- travelTo(currentIndex - 1);
874
+ restoreStoreAt(currentIndex - 1);
477
875
  return true;
478
876
  }
479
877
  function redo() {
480
878
  if (currentIndex >= history.length - 1) {
481
879
  return false;
482
880
  }
483
- travelTo(currentIndex + 1);
881
+ restoreStoreAt(currentIndex + 1);
484
882
  return true;
485
883
  }
486
884
  function getErrorMessage(error) {
@@ -500,6 +898,10 @@ function createStoreHistory(config) {
500
898
  error
501
899
  };
502
900
  messageChannel.saveMessage(nextRecord);
901
+ messageCollection = upsertStableReadonlyCollectionItem({
902
+ items: messageCollection,
903
+ item: cloneValue(nextRecord)
904
+ });
503
905
  return nextRecord;
504
906
  }
505
907
  function consumeRecord(record, options) {
@@ -523,6 +925,7 @@ function createStoreHistory(config) {
523
925
  truncateFutureHistory();
524
926
  recordSnapshot(acknowledgedRecord);
525
927
  }
928
+ notifyVersion();
526
929
  return true;
527
930
  } catch (error) {
528
931
  persistMessageAttempt(
@@ -534,6 +937,7 @@ function createStoreHistory(config) {
534
937
  getErrorMessage(error),
535
938
  attemptedAt
536
939
  );
940
+ notifyVersion();
537
941
  return false;
538
942
  }
539
943
  }
@@ -577,15 +981,42 @@ function createStoreHistory(config) {
577
981
  });
578
982
  return acknowledgedCount;
579
983
  }
984
+ const historySignal = (0, import_core2.computed)(() => {
985
+ version();
986
+ return historyCollection;
987
+ });
988
+ const messagesSignal = (0, import_core2.computed)(() => {
989
+ version();
990
+ messageCollection = syncStableReadonlyCollectionById({
991
+ items: messageCollection,
992
+ sourceItems: messageChannel.getMessages(),
993
+ getSourceId: (record) => record.id,
994
+ createItem: (record) => cloneValue(record),
995
+ areEquivalent: areStoreMessageRecordsEquivalent
996
+ });
997
+ return messageCollection;
998
+ });
999
+ const currentIndexSignal = (0, import_core2.computed)(() => {
1000
+ version();
1001
+ return currentIndex;
1002
+ });
580
1003
  return {
1004
+ historySignal,
1005
+ messagesSignal,
1006
+ currentIndexSignal,
581
1007
  publish(message) {
582
1008
  const record = messageChannel.publish(message);
1009
+ messageCollection = appendStableReadonlyCollectionItem({
1010
+ items: messageCollection,
1011
+ item: cloneValue(record)
1012
+ });
583
1013
  return consumeRecord(record);
584
1014
  },
585
1015
  replay(input) {
586
1016
  return replayByIds(input);
587
1017
  },
588
- travelTo,
1018
+ restoreStoreAt,
1019
+ restoreResource,
589
1020
  undo,
590
1021
  redo,
591
1022
  getHistory(key) {
@@ -628,245 +1059,6 @@ function clearAllStores() {
628
1059
  }
629
1060
  }
630
1061
 
631
- // src/store-message-consumer.ts
632
- var import_core = require("@flurryx/core");
633
- function createDefaultState() {
634
- return {
635
- data: void 0,
636
- isLoading: false,
637
- status: void 0,
638
- errors: void 0
639
- };
640
- }
641
- function createStoreMessageConsumer(signals, notifier) {
642
- function applyUpdate(key, newState, notify = true) {
643
- const sig = signals.getOrCreate(key);
644
- const previousState = sig();
645
- sig.update((state) => ({ ...state, ...newState }));
646
- if (notify) {
647
- const updatedState = sig();
648
- notifier.notify(key, updatedState, previousState);
649
- }
650
- return true;
651
- }
652
- function applyClear(key) {
653
- const sig = signals.getOrCreate(key);
654
- const previousState = sig();
655
- sig.set(createDefaultState());
656
- const nextState = sig();
657
- notifier.notify(key, nextState, previousState);
658
- return true;
659
- }
660
- function applyClearAll() {
661
- const keys = Array.from(signals.getAllKeys());
662
- if (keys.length === 0) {
663
- return false;
664
- }
665
- keys.forEach((key) => {
666
- applyClear(key);
667
- });
668
- return true;
669
- }
670
- function applyStartLoading(key) {
671
- const sig = signals.getOrCreate(key);
672
- sig.update(
673
- (state) => ({
674
- ...state,
675
- status: void 0,
676
- isLoading: true,
677
- errors: void 0
678
- })
679
- );
680
- return true;
681
- }
682
- function applyStopLoading(key) {
683
- const sig = signals.getOrCreate(key);
684
- sig.update(
685
- (state) => ({
686
- ...state,
687
- isLoading: false
688
- })
689
- );
690
- return true;
691
- }
692
- function applyUpdateKeyedOne(key, resourceKey, entity) {
693
- const sig = signals.getOrCreate(key);
694
- const state = sig();
695
- const data = (0, import_core.isKeyedResourceData)(state.data) ? state.data : (0, import_core.createKeyedResourceData)();
696
- const nextErrors = { ...data.errors };
697
- delete nextErrors[resourceKey];
698
- const nextData = {
699
- ...data,
700
- entities: { ...data.entities, [resourceKey]: entity },
701
- isLoading: { ...data.isLoading, [resourceKey]: false },
702
- status: { ...data.status, [resourceKey]: "Success" },
703
- errors: nextErrors
704
- };
705
- return applyUpdate(key, {
706
- data: nextData,
707
- isLoading: (0, import_core.isAnyKeyLoading)(nextData.isLoading),
708
- status: void 0,
709
- errors: void 0
710
- });
711
- }
712
- function applyClearKeyedOne(key, resourceKey) {
713
- const sig = signals.getOrCreate(key);
714
- const previousState = sig();
715
- const state = previousState;
716
- if (!(0, import_core.isKeyedResourceData)(state.data)) {
717
- return true;
718
- }
719
- const data = state.data;
720
- const nextEntities = { ...data.entities };
721
- delete nextEntities[resourceKey];
722
- const nextIsLoading = { ...data.isLoading };
723
- delete nextIsLoading[resourceKey];
724
- const nextStatus = { ...data.status };
725
- delete nextStatus[resourceKey];
726
- const nextErrors = { ...data.errors };
727
- delete nextErrors[resourceKey];
728
- const nextData = {
729
- ...data,
730
- entities: nextEntities,
731
- isLoading: nextIsLoading,
732
- status: nextStatus,
733
- errors: nextErrors
734
- };
735
- sig.update(
736
- (prev) => ({
737
- ...prev,
738
- data: nextData,
739
- status: void 0,
740
- isLoading: (0, import_core.isAnyKeyLoading)(nextIsLoading),
741
- errors: void 0
742
- })
743
- );
744
- const updatedState = sig();
745
- notifier.notify(key, updatedState, previousState);
746
- return true;
747
- }
748
- function applyStartKeyedLoading(key, resourceKey) {
749
- const sig = signals.getOrCreate(key);
750
- const state = sig();
751
- if (!(0, import_core.isKeyedResourceData)(state.data)) {
752
- return applyStartLoading(key);
753
- }
754
- const previousState = state;
755
- const data = state.data;
756
- const nextIsLoading = {
757
- ...data.isLoading,
758
- [resourceKey]: true
759
- };
760
- const nextStatus = { ...data.status };
761
- delete nextStatus[resourceKey];
762
- const nextErrors = { ...data.errors };
763
- delete nextErrors[resourceKey];
764
- const nextData = {
765
- ...data,
766
- isLoading: nextIsLoading,
767
- status: nextStatus,
768
- errors: nextErrors
769
- };
770
- sig.update(
771
- (previous) => ({
772
- ...previous,
773
- data: nextData,
774
- status: void 0,
775
- isLoading: (0, import_core.isAnyKeyLoading)(nextIsLoading),
776
- errors: void 0
777
- })
778
- );
779
- const updatedState = sig();
780
- notifier.notify(key, updatedState, previousState);
781
- return true;
782
- }
783
- function applyMessage(message) {
784
- switch (message.type) {
785
- case "update":
786
- return applyUpdate(message.key, cloneValue(message.state));
787
- case "clear":
788
- return applyClear(message.key);
789
- case "clearAll":
790
- return applyClearAll();
791
- case "startLoading":
792
- return applyStartLoading(message.key);
793
- case "stopLoading":
794
- return applyStopLoading(message.key);
795
- case "updateKeyedOne":
796
- return applyUpdateKeyedOne(
797
- message.key,
798
- message.resourceKey,
799
- cloneValue(message.entity)
800
- );
801
- case "clearKeyedOne":
802
- return applyClearKeyedOne(message.key, message.resourceKey);
803
- case "startKeyedLoading":
804
- return applyStartKeyedLoading(message.key, message.resourceKey);
805
- }
806
- }
807
- function applySnapshot(snapshot) {
808
- const keys = /* @__PURE__ */ new Set([
809
- ...Array.from(signals.getAllKeys()),
810
- ...Object.keys(snapshot)
811
- ]);
812
- keys.forEach((rawKey) => {
813
- const key = rawKey;
814
- const sig = signals.getOrCreate(key);
815
- const snapshotState = snapshot[key] ?? createDefaultState();
816
- applyUpdate(key, createSnapshotRestorePatch(sig(), snapshotState), true);
817
- });
818
- }
819
- function captureSnapshot() {
820
- const entries = Array.from(signals.getAllKeys()).map((key) => [
821
- key,
822
- cloneValue(signals.getOrCreate(key)())
823
- ]);
824
- return Object.fromEntries(entries);
825
- }
826
- return {
827
- applyMessage,
828
- applySnapshot,
829
- createSnapshot: captureSnapshot
830
- };
831
- }
832
- function createUpdateMessage(key, state) {
833
- return { type: "update", key, state };
834
- }
835
- function createClearMessage(key) {
836
- return { type: "clear", key };
837
- }
838
- function createClearAllMessage() {
839
- return { type: "clearAll" };
840
- }
841
- function createStartLoadingMessage(key) {
842
- return { type: "startLoading", key };
843
- }
844
- function createStopLoadingMessage(key) {
845
- return { type: "stopLoading", key };
846
- }
847
- function createUpdateKeyedOneMessage(key, resourceKey, entity) {
848
- return {
849
- type: "updateKeyedOne",
850
- key,
851
- resourceKey,
852
- entity
853
- };
854
- }
855
- function createClearKeyedOneMessage(key, resourceKey) {
856
- return {
857
- type: "clearKeyedOne",
858
- key,
859
- resourceKey
860
- };
861
- }
862
- function createStartKeyedLoadingMessage(key, resourceKey) {
863
- return {
864
- type: "startKeyedLoading",
865
- key,
866
- resourceKey
867
- };
868
- }
869
-
870
1062
  // src/base-store.ts
871
1063
  var updateHooksMap = /* @__PURE__ */ new WeakMap();
872
1064
  var BaseStore = class {
@@ -884,48 +1076,64 @@ var BaseStore = class {
884
1076
  notify: (key, next, prev) => this.notifyUpdateHooks(key, next, prev)
885
1077
  }
886
1078
  );
887
- this.history = createStoreHistory({
1079
+ this.historyDriver = createStoreHistory({
888
1080
  captureSnapshot: () => consumer.createSnapshot(),
889
1081
  applySnapshot: (snapshot) => consumer.applySnapshot(snapshot),
1082
+ applyKeyUpdate: (key, snapshotState) => consumer.applyKeyUpdate(key, snapshotState),
1083
+ getAllKeys: () => this.storeKeys,
890
1084
  applyMessage: (message) => consumer.applyMessage(message),
891
1085
  channel: options?.channel
892
1086
  });
1087
+ this.history = this.historyDriver.historySignal;
1088
+ this.messages = this.historyDriver.messagesSignal;
1089
+ this.currentIndex = this.historyDriver.currentIndexSignal;
1090
+ this.keys = (0, import_core3.signal)([...this.storeKeys]).asReadonly();
893
1091
  trackStore(this);
894
1092
  }
895
1093
  signalsState = /* @__PURE__ */ new Map();
896
1094
  storeKeys;
897
- history;
1095
+ historyDriver;
1096
+ /** @inheritDoc */
1097
+ restoreStoreAt = (index) => this.historyDriver.restoreStoreAt(index);
1098
+ /** @inheritDoc */
1099
+ restoreResource = (key, index) => this.historyDriver.restoreResource(key, index);
1100
+ /** @inheritDoc */
1101
+ undo = () => this.historyDriver.undo();
898
1102
  /** @inheritDoc */
899
- travelTo = (index) => this.history.travelTo(index);
1103
+ redo = () => this.historyDriver.redo();
900
1104
  /** @inheritDoc */
901
- undo = () => this.history.undo();
1105
+ getDeadLetters = () => this.historyDriver.getDeadLetters();
902
1106
  /** @inheritDoc */
903
- redo = () => this.history.redo();
1107
+ replayDeadLetter = (id) => this.historyDriver.replayDeadLetter(id);
904
1108
  /** @inheritDoc */
905
- getDeadLetters = () => this.history.getDeadLetters();
1109
+ replayDeadLetters = () => this.historyDriver.replayDeadLetters();
906
1110
  /** @inheritDoc */
907
- replayDeadLetter = (id) => this.history.replayDeadLetter(id);
1111
+ getCurrentIndex = () => this.historyDriver.getCurrentIndex();
908
1112
  /** @inheritDoc */
909
- replayDeadLetters = () => this.history.replayDeadLetters();
1113
+ history;
1114
+ /** @inheritDoc */
1115
+ messages;
1116
+ /** @inheritDoc */
1117
+ currentIndex;
910
1118
  /** @inheritDoc */
911
- getCurrentIndex = () => this.history.getCurrentIndex();
1119
+ keys;
912
1120
  replay(idOrIds) {
913
1121
  if (Array.isArray(idOrIds)) {
914
- return this.history.replay(idOrIds);
1122
+ return this.historyDriver.replay(idOrIds);
915
1123
  }
916
- return this.history.replay(idOrIds);
1124
+ return this.historyDriver.replay(idOrIds);
917
1125
  }
918
1126
  getHistory(key) {
919
1127
  if (key === void 0) {
920
- return this.history.getHistory();
1128
+ return this.historyDriver.getHistory();
921
1129
  }
922
- return this.history.getHistory(key);
1130
+ return this.historyDriver.getHistory(key);
923
1131
  }
924
1132
  getMessages(key) {
925
1133
  if (key === void 0) {
926
- return this.history.getMessages();
1134
+ return this.historyDriver.getMessages();
927
1135
  }
928
- return this.history.getMessages(key);
1136
+ return this.historyDriver.getMessages(key);
929
1137
  }
930
1138
  /**
931
1139
  * Returns a **read-only** `Signal` for the given store slot.
@@ -971,13 +1179,13 @@ var BaseStore = class {
971
1179
  * @param newState - Partial state to merge (e.g. `{ data: newData, status: 'Success' }`).
972
1180
  */
973
1181
  update(key, newState) {
974
- this.history.publish(
1182
+ this.historyDriver.publish(
975
1183
  createUpdateMessage(key, cloneValue(newState))
976
1184
  );
977
1185
  }
978
1186
  /** Resets every slot in this store to its initial idle state. */
979
1187
  clearAll() {
980
- this.history.publish(createClearAllMessage());
1188
+ this.historyDriver.publish(createClearAllMessage());
981
1189
  }
982
1190
  /**
983
1191
  * Resets a single slot to `{ data: undefined, isLoading: false, status: undefined, errors: undefined }`.
@@ -985,7 +1193,7 @@ var BaseStore = class {
985
1193
  * @param key - The slot to clear.
986
1194
  */
987
1195
  clear(key) {
988
- this.history.publish(createClearMessage(key));
1196
+ this.historyDriver.publish(createClearMessage(key));
989
1197
  }
990
1198
  /**
991
1199
  * Marks a slot as loading: sets `isLoading: true` and clears `status` and `errors`.
@@ -993,7 +1201,7 @@ var BaseStore = class {
993
1201
  * @param key - The slot to mark as loading.
994
1202
  */
995
1203
  startLoading(key) {
996
- this.history.publish(createStartLoadingMessage(key));
1204
+ this.historyDriver.publish(createStartLoadingMessage(key));
997
1205
  }
998
1206
  /**
999
1207
  * Marks a slot as no longer loading: sets `isLoading: false`.
@@ -1002,7 +1210,7 @@ var BaseStore = class {
1002
1210
  * @param key - The slot to stop loading.
1003
1211
  */
1004
1212
  stopLoading(key) {
1005
- this.history.publish(createStopLoadingMessage(key));
1213
+ this.historyDriver.publish(createStopLoadingMessage(key));
1006
1214
  }
1007
1215
  /**
1008
1216
  * Merges a single entity into a {@link KeyedResourceData} slot.
@@ -1014,7 +1222,7 @@ var BaseStore = class {
1014
1222
  * @param entity - The entity value to store.
1015
1223
  */
1016
1224
  updateKeyedOne(key, resourceKey, entity) {
1017
- this.history.publish(
1225
+ this.historyDriver.publish(
1018
1226
  createUpdateKeyedOneMessage(
1019
1227
  key,
1020
1228
  resourceKey,
@@ -1031,7 +1239,7 @@ var BaseStore = class {
1031
1239
  * @param resourceKey - The entity identifier to remove.
1032
1240
  */
1033
1241
  clearKeyedOne(key, resourceKey) {
1034
- this.history.publish(
1242
+ this.historyDriver.publish(
1035
1243
  createClearKeyedOneMessage(key, resourceKey)
1036
1244
  );
1037
1245
  }
@@ -1044,7 +1252,7 @@ var BaseStore = class {
1044
1252
  * @param resourceKey - The entity identifier to mark as loading.
1045
1253
  */
1046
1254
  startKeyedLoading(key, resourceKey) {
1047
- this.history.publish(
1255
+ this.historyDriver.publish(
1048
1256
  createStartKeyedLoadingMessage(key, resourceKey)
1049
1257
  );
1050
1258
  }
@@ -1081,49 +1289,59 @@ var BaseStore = class {
1081
1289
  this.storeKeys.forEach((key) => {
1082
1290
  this.signalsState.set(
1083
1291
  key,
1084
- (0, import_core2.signal)(createDefaultState())
1292
+ (0, import_core3.signal)(createDefaultState())
1085
1293
  );
1086
1294
  });
1087
1295
  }
1088
1296
  };
1089
1297
 
1090
1298
  // src/lazy-store.ts
1091
- var import_core3 = require("@angular/core");
1299
+ var import_core4 = require("@angular/core");
1092
1300
  var LazyStore = class {
1093
1301
  signals = /* @__PURE__ */ new Map();
1094
1302
  hooks = /* @__PURE__ */ new Map();
1095
- history;
1303
+ historyDriver;
1096
1304
  /** @inheritDoc */
1097
- travelTo = (index) => this.history.travelTo(index);
1305
+ restoreStoreAt = (index) => this.historyDriver.restoreStoreAt(index);
1098
1306
  /** @inheritDoc */
1099
- undo = () => this.history.undo();
1307
+ restoreResource = (key, index) => this.historyDriver.restoreResource(key, index);
1100
1308
  /** @inheritDoc */
1101
- redo = () => this.history.redo();
1309
+ undo = () => this.historyDriver.undo();
1310
+ /** @inheritDoc */
1311
+ redo = () => this.historyDriver.redo();
1102
1312
  getMessages(key) {
1103
1313
  if (key === void 0) {
1104
- return this.history.getMessages();
1314
+ return this.historyDriver.getMessages();
1105
1315
  }
1106
- return this.history.getMessages(key);
1316
+ return this.historyDriver.getMessages(key);
1107
1317
  }
1318
+ getDeadLetters = () => this.historyDriver.getDeadLetters();
1319
+ /** @inheritDoc */
1320
+ replayDeadLetter = (id) => this.historyDriver.replayDeadLetter(id);
1321
+ /** @inheritDoc */
1322
+ replayDeadLetters = () => this.historyDriver.replayDeadLetters();
1108
1323
  /** @inheritDoc */
1109
- getDeadLetters = () => this.history.getDeadLetters();
1324
+ getCurrentIndex = () => this.historyDriver.getCurrentIndex();
1325
+ /** @inheritDoc */
1326
+ history;
1110
1327
  /** @inheritDoc */
1111
- replayDeadLetter = (id) => this.history.replayDeadLetter(id);
1328
+ messages;
1112
1329
  /** @inheritDoc */
1113
- replayDeadLetters = () => this.history.replayDeadLetters();
1330
+ currentIndex;
1114
1331
  /** @inheritDoc */
1115
- getCurrentIndex = () => this.history.getCurrentIndex();
1332
+ keys;
1333
+ keysSignal = (0, import_core4.signal)([]);
1116
1334
  replay(idOrIds) {
1117
1335
  if (Array.isArray(idOrIds)) {
1118
- return this.history.replay(idOrIds);
1336
+ return this.historyDriver.replay(idOrIds);
1119
1337
  }
1120
- return this.history.replay(idOrIds);
1338
+ return this.historyDriver.replay(idOrIds);
1121
1339
  }
1122
1340
  getHistory(key) {
1123
1341
  if (key === void 0) {
1124
- return this.history.getHistory();
1342
+ return this.historyDriver.getHistory();
1125
1343
  }
1126
- return this.history.getHistory(key);
1344
+ return this.historyDriver.getHistory(key);
1127
1345
  }
1128
1346
  constructor(options) {
1129
1347
  const consumer = createStoreMessageConsumer(
@@ -1135,19 +1353,26 @@ var LazyStore = class {
1135
1353
  notify: (key, next, prev) => this.notifyHooks(key, next, prev)
1136
1354
  }
1137
1355
  );
1138
- this.history = createStoreHistory({
1356
+ this.historyDriver = createStoreHistory({
1139
1357
  captureSnapshot: () => consumer.createSnapshot(),
1140
1358
  applySnapshot: (snapshot) => consumer.applySnapshot(snapshot),
1359
+ applyKeyUpdate: (key, snapshotState) => consumer.applyKeyUpdate(key, snapshotState),
1360
+ getAllKeys: () => this.signals.keys(),
1141
1361
  applyMessage: (message) => consumer.applyMessage(message),
1142
1362
  channel: options?.channel
1143
1363
  });
1364
+ this.history = this.historyDriver.historySignal;
1365
+ this.messages = this.historyDriver.messagesSignal;
1366
+ this.currentIndex = this.historyDriver.currentIndexSignal;
1367
+ this.keys = this.keysSignal.asReadonly();
1144
1368
  trackStore(this);
1145
1369
  }
1146
1370
  getOrCreate(key) {
1147
1371
  let sig = this.signals.get(key);
1148
1372
  if (!sig) {
1149
- sig = (0, import_core3.signal)(createDefaultState());
1373
+ sig = (0, import_core4.signal)(createDefaultState());
1150
1374
  this.signals.set(key, sig);
1375
+ this.keysSignal.update((prev) => [...prev, key]);
1151
1376
  }
1152
1377
  return sig;
1153
1378
  }
@@ -1157,29 +1382,29 @@ var LazyStore = class {
1157
1382
  }
1158
1383
  /** @inheritDoc */
1159
1384
  update(key, newState) {
1160
- this.history.publish(
1385
+ this.historyDriver.publish(
1161
1386
  createUpdateMessage(key, cloneValue(newState))
1162
1387
  );
1163
1388
  }
1164
1389
  /** @inheritDoc */
1165
1390
  clear(key) {
1166
- this.history.publish(createClearMessage(key));
1391
+ this.historyDriver.publish(createClearMessage(key));
1167
1392
  }
1168
1393
  /** @inheritDoc */
1169
1394
  clearAll() {
1170
- this.history.publish(createClearAllMessage());
1395
+ this.historyDriver.publish(createClearAllMessage());
1171
1396
  }
1172
1397
  /** @inheritDoc */
1173
1398
  startLoading(key) {
1174
- this.history.publish(createStartLoadingMessage(key));
1399
+ this.historyDriver.publish(createStartLoadingMessage(key));
1175
1400
  }
1176
1401
  /** @inheritDoc */
1177
1402
  stopLoading(key) {
1178
- this.history.publish(createStopLoadingMessage(key));
1403
+ this.historyDriver.publish(createStopLoadingMessage(key));
1179
1404
  }
1180
1405
  /** @inheritDoc */
1181
1406
  updateKeyedOne(key, resourceKey, entity) {
1182
- this.history.publish(
1407
+ this.historyDriver.publish(
1183
1408
  createUpdateKeyedOneMessage(
1184
1409
  key,
1185
1410
  resourceKey,
@@ -1189,13 +1414,13 @@ var LazyStore = class {
1189
1414
  }
1190
1415
  /** @inheritDoc */
1191
1416
  clearKeyedOne(key, resourceKey) {
1192
- this.history.publish(
1417
+ this.historyDriver.publish(
1193
1418
  createClearKeyedOneMessage(key, resourceKey)
1194
1419
  );
1195
1420
  }
1196
1421
  /** @inheritDoc */
1197
1422
  startKeyedLoading(key, resourceKey) {
1198
- this.history.publish(
1423
+ this.historyDriver.publish(
1199
1424
  createStartKeyedLoadingMessage(key, resourceKey)
1200
1425
  );
1201
1426
  }
@@ -1248,7 +1473,7 @@ var LazyStore = class {
1248
1473
  };
1249
1474
 
1250
1475
  // src/store-builder.ts
1251
- var import_core5 = require("@angular/core");
1476
+ var import_core6 = require("@angular/core");
1252
1477
 
1253
1478
  // src/dynamic-store.ts
1254
1479
  var DynamicStore = class extends BaseStore {
@@ -1278,12 +1503,12 @@ function mirrorKey(source, sourceKey, target, targetKeyOrOptions, options) {
1278
1503
  }
1279
1504
 
1280
1505
  // src/collect-keyed.ts
1281
- var import_core4 = require("@flurryx/core");
1506
+ var import_core5 = require("@flurryx/core");
1282
1507
  function collectKeyed(source, sourceKey, target, targetKeyOrOptions, options) {
1283
1508
  const resolvedTargetKey = typeof targetKeyOrOptions === "string" ? targetKeyOrOptions : sourceKey;
1284
1509
  const resolvedOptions = typeof targetKeyOrOptions === "object" ? targetKeyOrOptions : options;
1285
1510
  target.update(resolvedTargetKey, {
1286
- data: (0, import_core4.createKeyedResourceData)()
1511
+ data: (0, import_core5.createKeyedResourceData)()
1287
1512
  });
1288
1513
  let previousId;
1289
1514
  const cleanup = source.onUpdate(sourceKey, (state) => {
@@ -1314,7 +1539,7 @@ function collectKeyed(source, sourceKey, target, targetKeyOrOptions, options) {
1314
1539
  };
1315
1540
  target.update(resolvedTargetKey, {
1316
1541
  data: updatedKeyed,
1317
- isLoading: (0, import_core4.isAnyKeyLoading)(newIsLoading),
1542
+ isLoading: (0, import_core5.isAnyKeyLoading)(newIsLoading),
1318
1543
  status: "Success"
1319
1544
  });
1320
1545
  previousId = currentId;
@@ -1336,7 +1561,7 @@ function collectKeyed(source, sourceKey, target, targetKeyOrOptions, options) {
1336
1561
  };
1337
1562
  target.update(resolvedTargetKey, {
1338
1563
  data: updatedKeyed,
1339
- isLoading: (0, import_core4.isAnyKeyLoading)(newIsLoading)
1564
+ isLoading: (0, import_core5.isAnyKeyLoading)(newIsLoading)
1340
1565
  });
1341
1566
  previousId = currentId;
1342
1567
  } else if (resourceState.data === void 0 && previousId !== void 0) {
@@ -1352,7 +1577,7 @@ function collectKeyed(source, sourceKey, target, targetKeyOrOptions, options) {
1352
1577
  };
1353
1578
  target.update(resolvedTargetKey, {
1354
1579
  data: updatedKeyed,
1355
- isLoading: (0, import_core4.isAnyKeyLoading)(remainingLoading)
1580
+ isLoading: (0, import_core5.isAnyKeyLoading)(remainingLoading)
1356
1581
  });
1357
1582
  previousId = void 0;
1358
1583
  } else if (resourceState.isLoading && currentId !== void 0) {
@@ -1384,7 +1609,7 @@ function resource() {
1384
1609
  // src/store-builder.ts
1385
1610
  function wireMirrors(store, mirrors) {
1386
1611
  for (const def of mirrors) {
1387
- const sourceStore = (0, import_core5.inject)(def.sourceToken);
1612
+ const sourceStore = (0, import_core6.inject)(def.sourceToken);
1388
1613
  mirrorKey(
1389
1614
  sourceStore,
1390
1615
  def.sourceKey,
@@ -1395,7 +1620,7 @@ function wireMirrors(store, mirrors) {
1395
1620
  }
1396
1621
  function wireMirrorKeyed(store, defs) {
1397
1622
  for (const def of defs) {
1398
- const sourceStore = (0, import_core5.inject)(def.sourceToken);
1623
+ const sourceStore = (0, import_core6.inject)(def.sourceToken);
1399
1624
  collectKeyed(
1400
1625
  sourceStore,
1401
1626
  def.sourceKey,
@@ -1477,7 +1702,7 @@ function createBuilder(accum, mirrors = [], mirrorKeyedDefs = [], selfMirrors =
1477
1702
  );
1478
1703
  },
1479
1704
  build(options) {
1480
- return new import_core5.InjectionToken("FlurryxStore", {
1705
+ return new import_core6.InjectionToken("FlurryxStore", {
1481
1706
  providedIn: "root",
1482
1707
  factory: () => {
1483
1708
  const store = new DynamicStore(accum, options);
@@ -1552,7 +1777,7 @@ function createConstrainedBuilder(_enumObj, accum, mirrors = [], mirrorKeyedDefs
1552
1777
  );
1553
1778
  },
1554
1779
  build(options) {
1555
- return new import_core5.InjectionToken("FlurryxStore", {
1780
+ return new import_core6.InjectionToken("FlurryxStore", {
1556
1781
  providedIn: "root",
1557
1782
  factory: () => {
1558
1783
  const store = new DynamicStore(accum, options);
@@ -1603,7 +1828,7 @@ function createInterfaceBuilder(mirrors = [], mirrorKeyedDefs = [], selfMirrors
1603
1828
  );
1604
1829
  },
1605
1830
  build(options) {
1606
- return new import_core5.InjectionToken("FlurryxStore", {
1831
+ return new import_core6.InjectionToken("FlurryxStore", {
1607
1832
  providedIn: "root",
1608
1833
  factory: () => {
1609
1834
  const store = new LazyStore(options);
@@ -1629,6 +1854,7 @@ function createStoreFor(enumObj) {
1629
1854
  // Annotate the CommonJS export names for ESM import in node:
1630
1855
  0 && (module.exports = {
1631
1856
  BaseStore,
1857
+ INVALID_STORE_KEY_ERROR,
1632
1858
  LazyStore,
1633
1859
  Store,
1634
1860
  clearAllStores,