@ngrx/signals 18.0.0-rc.0 → 18.0.0-rc.2

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.
Files changed (43) hide show
  1. package/entities/src/entity-config.d.ts +17 -0
  2. package/entities/src/helpers.d.ts +9 -9
  3. package/entities/src/index.d.ts +2 -1
  4. package/entities/src/models.d.ts +4 -7
  5. package/entities/src/updaters/add-entities.d.ts +3 -3
  6. package/entities/src/updaters/add-entity.d.ts +3 -3
  7. package/entities/src/updaters/set-all-entities.d.ts +3 -3
  8. package/entities/src/updaters/set-entities.d.ts +3 -3
  9. package/entities/src/updaters/set-entity.d.ts +3 -3
  10. package/entities/src/updaters/update-all-entities.d.ts +14 -3
  11. package/entities/src/updaters/update-entities.d.ts +45 -11
  12. package/entities/src/updaters/update-entity.d.ts +23 -6
  13. package/entities/src/with-entities.d.ts +7 -7
  14. package/esm2022/entities/src/entity-config.mjs +4 -0
  15. package/esm2022/entities/src/helpers.mjs +28 -12
  16. package/esm2022/entities/src/index.mjs +2 -1
  17. package/esm2022/entities/src/models.mjs +1 -1
  18. package/esm2022/entities/src/updaters/add-entities.mjs +4 -4
  19. package/esm2022/entities/src/updaters/add-entity.mjs +4 -4
  20. package/esm2022/entities/src/updaters/set-all-entities.mjs +4 -4
  21. package/esm2022/entities/src/updaters/set-entities.mjs +4 -4
  22. package/esm2022/entities/src/updaters/set-entity.mjs +4 -4
  23. package/esm2022/entities/src/updaters/update-all-entities.mjs +4 -3
  24. package/esm2022/entities/src/updaters/update-entities.mjs +4 -3
  25. package/esm2022/entities/src/updaters/update-entity.mjs +4 -3
  26. package/esm2022/entities/src/with-entities.mjs +1 -1
  27. package/esm2022/src/signal-store-models.mjs +1 -1
  28. package/esm2022/src/signal-store.mjs +5 -5
  29. package/esm2022/src/with-computed.mjs +10 -7
  30. package/esm2022/src/with-hooks.mjs +3 -3
  31. package/esm2022/src/with-methods.mjs +7 -7
  32. package/esm2022/src/with-state.mjs +7 -7
  33. package/fesm2022/ngrx-signals-entities.mjs +48 -25
  34. package/fesm2022/ngrx-signals-entities.mjs.map +1 -1
  35. package/fesm2022/ngrx-signals.mjs +27 -24
  36. package/fesm2022/ngrx-signals.mjs.map +1 -1
  37. package/package.json +1 -1
  38. package/schematics-core/utility/libs-version.js +1 -1
  39. package/schematics-core/utility/libs-version.js.map +1 -1
  40. package/src/signal-store-models.d.ts +10 -10
  41. package/src/with-computed.d.ts +3 -3
  42. package/src/with-hooks.d.ts +3 -3
  43. package/src/with-methods.d.ts +2 -2
@@ -8,8 +8,9 @@ var DidMutate;
8
8
  DidMutate[DidMutate["Both"] = 2] = "Both";
9
9
  })(DidMutate || (DidMutate = {}));
10
10
 
11
- function getEntityIdKey(config) {
12
- return config?.idKey ?? 'id';
11
+ const defaultSelectId = (entity) => entity.id;
12
+ function getEntityIdSelector(config) {
13
+ return config?.selectId ?? defaultSelectId;
13
14
  }
14
15
  function getEntityStateKeys(config) {
15
16
  const collection = config?.collection;
@@ -40,8 +41,8 @@ function getEntityUpdaterResult(state, stateKeys, didMutate) {
40
41
  }
41
42
  }
42
43
  }
43
- function addEntityMutably(state, entity, idKey) {
44
- const id = entity[idKey];
44
+ function addEntityMutably(state, entity, selectId) {
45
+ const id = selectId(entity);
45
46
  if (state.entityMap[id]) {
46
47
  return DidMutate.None;
47
48
  }
@@ -49,18 +50,18 @@ function addEntityMutably(state, entity, idKey) {
49
50
  state.ids.push(id);
50
51
  return DidMutate.Both;
51
52
  }
52
- function addEntitiesMutably(state, entities, idKey) {
53
+ function addEntitiesMutably(state, entities, selectId) {
53
54
  let didMutate = DidMutate.None;
54
55
  for (const entity of entities) {
55
- const result = addEntityMutably(state, entity, idKey);
56
+ const result = addEntityMutably(state, entity, selectId);
56
57
  if (result === DidMutate.Both) {
57
58
  didMutate = result;
58
59
  }
59
60
  }
60
61
  return didMutate;
61
62
  }
62
- function setEntityMutably(state, entity, idKey) {
63
- const id = entity[idKey];
63
+ function setEntityMutably(state, entity, selectId) {
64
+ const id = selectId(entity);
64
65
  if (state.entityMap[id]) {
65
66
  state.entityMap[id] = entity;
66
67
  return DidMutate.Entities;
@@ -69,10 +70,10 @@ function setEntityMutably(state, entity, idKey) {
69
70
  state.ids.push(id);
70
71
  return DidMutate.Both;
71
72
  }
72
- function setEntitiesMutably(state, entities, idKey) {
73
+ function setEntitiesMutably(state, entities, selectId) {
73
74
  let didMutate = DidMutate.None;
74
75
  for (const entity of entities) {
75
- const result = setEntityMutably(state, entity, idKey);
76
+ const result = setEntityMutably(state, entity, selectId);
76
77
  if (didMutate === DidMutate.Both) {
77
78
  continue;
78
79
  }
@@ -96,10 +97,11 @@ function removeEntitiesMutably(state, idsOrPredicate) {
96
97
  }
97
98
  return didMutate;
98
99
  }
99
- function updateEntitiesMutably(state, idsOrPredicate, changes) {
100
+ function updateEntitiesMutably(state, idsOrPredicate, changes, selectId) {
100
101
  const ids = Array.isArray(idsOrPredicate)
101
102
  ? idsOrPredicate
102
103
  : state.ids.filter((id) => idsOrPredicate(state.entityMap[id]));
104
+ let newIds = undefined;
103
105
  let didMutate = DidMutate.None;
104
106
  for (const id of ids) {
105
107
  const entity = state.entityMap[id];
@@ -107,27 +109,41 @@ function updateEntitiesMutably(state, idsOrPredicate, changes) {
107
109
  const changesRecord = typeof changes === 'function' ? changes(entity) : changes;
108
110
  state.entityMap[id] = { ...entity, ...changesRecord };
109
111
  didMutate = DidMutate.Entities;
112
+ const newId = selectId(state.entityMap[id]);
113
+ if (newId !== id) {
114
+ state.entityMap[newId] = state.entityMap[id];
115
+ delete state.entityMap[id];
116
+ newIds = newIds || {};
117
+ newIds[id] = newId;
118
+ }
110
119
  }
111
120
  }
121
+ if (newIds) {
122
+ state.ids = state.ids.map((id) => newIds[id] ?? id);
123
+ didMutate = DidMutate.Both;
124
+ }
125
+ if (ngDevMode && state.ids.length !== Object.keys(state.entityMap).length) {
126
+ console.warn('@ngrx/signals/entities: Entities with IDs:', ids, 'are not updated correctly.', 'Make sure to apply valid changes when using `updateEntity`,', '`updateEntities`, and `updateAllEntities` updaters.');
127
+ }
112
128
  return didMutate;
113
129
  }
114
130
 
115
131
  function addEntity(entity, config) {
116
- const idKey = getEntityIdKey(config);
132
+ const selectId = getEntityIdSelector(config);
117
133
  const stateKeys = getEntityStateKeys(config);
118
134
  return (state) => {
119
135
  const clonedState = cloneEntityState(state, stateKeys);
120
- const didMutate = addEntityMutably(clonedState, entity, idKey);
136
+ const didMutate = addEntityMutably(clonedState, entity, selectId);
121
137
  return getEntityUpdaterResult(clonedState, stateKeys, didMutate);
122
138
  };
123
139
  }
124
140
 
125
141
  function addEntities(entities, config) {
126
- const idKey = getEntityIdKey(config);
142
+ const selectId = getEntityIdSelector(config);
127
143
  const stateKeys = getEntityStateKeys(config);
128
144
  return (state) => {
129
145
  const clonedState = cloneEntityState(state, stateKeys);
130
- const didMutate = addEntitiesMutably(clonedState, entities, idKey);
146
+ const didMutate = addEntitiesMutably(clonedState, entities, selectId);
131
147
  return getEntityUpdaterResult(clonedState, stateKeys, didMutate);
132
148
  };
133
149
  }
@@ -159,31 +175,31 @@ function removeAllEntities(config) {
159
175
  }
160
176
 
161
177
  function setEntity(entity, config) {
162
- const idKey = getEntityIdKey(config);
178
+ const selectId = getEntityIdSelector(config);
163
179
  const stateKeys = getEntityStateKeys(config);
164
180
  return (state) => {
165
181
  const clonedState = cloneEntityState(state, stateKeys);
166
- const didMutate = setEntityMutably(clonedState, entity, idKey);
182
+ const didMutate = setEntityMutably(clonedState, entity, selectId);
167
183
  return getEntityUpdaterResult(clonedState, stateKeys, didMutate);
168
184
  };
169
185
  }
170
186
 
171
187
  function setEntities(entities, config) {
172
- const idKey = getEntityIdKey(config);
188
+ const selectId = getEntityIdSelector(config);
173
189
  const stateKeys = getEntityStateKeys(config);
174
190
  return (state) => {
175
191
  const clonedState = cloneEntityState(state, stateKeys);
176
- const didMutate = setEntitiesMutably(clonedState, entities, idKey);
192
+ const didMutate = setEntitiesMutably(clonedState, entities, selectId);
177
193
  return getEntityUpdaterResult(clonedState, stateKeys, didMutate);
178
194
  };
179
195
  }
180
196
 
181
197
  function setAllEntities(entities, config) {
182
- const idKey = getEntityIdKey(config);
198
+ const selectId = getEntityIdSelector(config);
183
199
  const stateKeys = getEntityStateKeys(config);
184
200
  return () => {
185
201
  const state = { entityMap: {}, ids: [] };
186
- setEntitiesMutably(state, entities, idKey);
202
+ setEntitiesMutably(state, entities, selectId);
187
203
  return {
188
204
  [stateKeys.entityMapKey]: state.entityMap,
189
205
  [stateKeys.idsKey]: state.ids,
@@ -192,33 +208,40 @@ function setAllEntities(entities, config) {
192
208
  }
193
209
 
194
210
  function updateEntity(update, config) {
211
+ const selectId = getEntityIdSelector(config);
195
212
  const stateKeys = getEntityStateKeys(config);
196
213
  return (state) => {
197
214
  const clonedState = cloneEntityState(state, stateKeys);
198
- const didMutate = updateEntitiesMutably(clonedState, [update.id], update.changes);
215
+ const didMutate = updateEntitiesMutably(clonedState, [update.id], update.changes, selectId);
199
216
  return getEntityUpdaterResult(clonedState, stateKeys, didMutate);
200
217
  };
201
218
  }
202
219
 
203
220
  function updateEntities(update, config) {
221
+ const selectId = getEntityIdSelector(config);
204
222
  const stateKeys = getEntityStateKeys(config);
205
223
  const idsOrPredicate = 'ids' in update ? update.ids : update.predicate;
206
224
  return (state) => {
207
225
  const clonedState = cloneEntityState(state, stateKeys);
208
- const didMutate = updateEntitiesMutably(clonedState, idsOrPredicate, update.changes);
226
+ const didMutate = updateEntitiesMutably(clonedState, idsOrPredicate, update.changes, selectId);
209
227
  return getEntityUpdaterResult(clonedState, stateKeys, didMutate);
210
228
  };
211
229
  }
212
230
 
213
231
  function updateAllEntities(changes, config) {
232
+ const selectId = getEntityIdSelector(config);
214
233
  const stateKeys = getEntityStateKeys(config);
215
234
  return (state) => {
216
235
  const clonedState = cloneEntityState(state, stateKeys);
217
- const didMutate = updateEntitiesMutably(clonedState, state[stateKeys.idsKey], changes);
236
+ const didMutate = updateEntitiesMutably(clonedState, state[stateKeys.idsKey], changes, selectId);
218
237
  return getEntityUpdaterResult(clonedState, stateKeys, didMutate);
219
238
  };
220
239
  }
221
240
 
241
+ function entityConfig(config) {
242
+ return config;
243
+ }
244
+
222
245
  function withEntities(config) {
223
246
  const { entityMapKey, idsKey, entitiesKey } = getEntityStateKeys(config);
224
247
  return signalStoreFeature(withState({
@@ -237,5 +260,5 @@ function withEntities(config) {
237
260
  * Generated bundle index. Do not edit.
238
261
  */
239
262
 
240
- export { addEntities, addEntity, removeAllEntities, removeEntities, removeEntity, setAllEntities, setEntities, setEntity, updateAllEntities, updateEntities, updateEntity, withEntities };
263
+ export { addEntities, addEntity, entityConfig, removeAllEntities, removeEntities, removeEntity, setAllEntities, setEntities, setEntity, updateAllEntities, updateEntities, updateEntity, withEntities };
241
264
  //# sourceMappingURL=ngrx-signals-entities.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"ngrx-signals-entities.mjs","sources":["../../../../modules/signals/entities/src/models.ts","../../../../modules/signals/entities/src/helpers.ts","../../../../modules/signals/entities/src/updaters/add-entity.ts","../../../../modules/signals/entities/src/updaters/add-entities.ts","../../../../modules/signals/entities/src/updaters/remove-entity.ts","../../../../modules/signals/entities/src/updaters/remove-entities.ts","../../../../modules/signals/entities/src/updaters/remove-all-entities.ts","../../../../modules/signals/entities/src/updaters/set-entity.ts","../../../../modules/signals/entities/src/updaters/set-entities.ts","../../../../modules/signals/entities/src/updaters/set-all-entities.ts","../../../../modules/signals/entities/src/updaters/update-entity.ts","../../../../modules/signals/entities/src/updaters/update-entities.ts","../../../../modules/signals/entities/src/updaters/update-all-entities.ts","../../../../modules/signals/entities/src/with-entities.ts","../../../../modules/signals/entities/ngrx-signals-entities.ts"],"sourcesContent":["import { Signal } from '@angular/core';\n\nexport type EntityId = string | number;\n\nexport type EntityMap<Entity> = Record<EntityId, Entity>;\n\nexport type EntityState<Entity> = {\n entityMap: EntityMap<Entity>;\n ids: EntityId[];\n};\n\nexport type NamedEntityState<Entity, Collection extends string> = {\n [K in keyof EntityState<Entity> as `${Collection}${Capitalize<K>}`]: EntityState<Entity>[K];\n};\n\nexport type EntitySignals<Entity> = {\n entities: Signal<Entity[]>;\n};\n\nexport type NamedEntitySignals<Entity, Collection extends string> = {\n [K in keyof EntitySignals<Entity> as `${Collection}${Capitalize<K>}`]: EntitySignals<Entity>[K];\n};\n\nexport type EntityIdProps<Entity> = {\n [K in keyof Entity as Entity[K] extends EntityId ? K : never]: Entity[K];\n};\n\nexport type EntityIdKey<Entity> = keyof EntityIdProps<Entity> & string;\n\nexport type EntityPredicate<Entity> = (entity: Entity) => boolean;\n\nexport type EntityChanges<Entity> =\n | Partial<Entity>\n | ((entity: Entity) => Partial<Entity>);\n\nexport enum DidMutate {\n None,\n Entities,\n Both,\n}\n","import {\n DidMutate,\n EntityChanges,\n EntityId,\n EntityPredicate,\n EntityState,\n} from './models';\n\nexport function getEntityIdKey(config?: { idKey?: string }): string {\n return config?.idKey ?? 'id';\n}\n\nexport function getEntityStateKeys(config?: { collection?: string }): {\n entityMapKey: string;\n idsKey: string;\n entitiesKey: string;\n} {\n const collection = config?.collection;\n const entityMapKey =\n collection === undefined ? 'entityMap' : `${collection}EntityMap`;\n const idsKey = collection === undefined ? 'ids' : `${collection}Ids`;\n const entitiesKey =\n collection === undefined ? 'entities' : `${collection}Entities`;\n\n return { entityMapKey, idsKey, entitiesKey };\n}\n\nexport function cloneEntityState(\n state: Record<string, any>,\n stateKeys: {\n entityMapKey: string;\n idsKey: string;\n }\n): EntityState<any> {\n return {\n entityMap: { ...state[stateKeys.entityMapKey] },\n ids: [...state[stateKeys.idsKey]],\n };\n}\n\nexport function getEntityUpdaterResult(\n state: EntityState<any>,\n stateKeys: {\n entityMapKey: string;\n idsKey: string;\n },\n didMutate: DidMutate\n): Record<string, any> {\n switch (didMutate) {\n case DidMutate.Both: {\n return {\n [stateKeys.entityMapKey]: state.entityMap,\n [stateKeys.idsKey]: state.ids,\n };\n }\n case DidMutate.Entities: {\n return { [stateKeys.entityMapKey]: state.entityMap };\n }\n default: {\n return {};\n }\n }\n}\n\nexport function addEntityMutably(\n state: EntityState<any>,\n entity: any,\n idKey: string\n): DidMutate {\n const id = entity[idKey];\n\n if (state.entityMap[id]) {\n return DidMutate.None;\n }\n\n state.entityMap[id] = entity;\n state.ids.push(id);\n\n return DidMutate.Both;\n}\n\nexport function addEntitiesMutably(\n state: EntityState<any>,\n entities: any[],\n idKey: string\n): DidMutate {\n let didMutate = DidMutate.None;\n\n for (const entity of entities) {\n const result = addEntityMutably(state, entity, idKey);\n\n if (result === DidMutate.Both) {\n didMutate = result;\n }\n }\n\n return didMutate;\n}\n\nexport function setEntityMutably(\n state: EntityState<any>,\n entity: any,\n idKey: string\n): DidMutate {\n const id = entity[idKey];\n\n if (state.entityMap[id]) {\n state.entityMap[id] = entity;\n return DidMutate.Entities;\n }\n\n state.entityMap[id] = entity;\n state.ids.push(id);\n\n return DidMutate.Both;\n}\n\nexport function setEntitiesMutably(\n state: EntityState<any>,\n entities: any[],\n idKey: string\n): DidMutate {\n let didMutate = DidMutate.None;\n\n for (const entity of entities) {\n const result = setEntityMutably(state, entity, idKey);\n\n if (didMutate === DidMutate.Both) {\n continue;\n }\n\n didMutate = result;\n }\n\n return didMutate;\n}\n\nexport function removeEntitiesMutably(\n state: EntityState<any>,\n idsOrPredicate: EntityId[] | EntityPredicate<any>\n): DidMutate {\n const ids = Array.isArray(idsOrPredicate)\n ? idsOrPredicate\n : state.ids.filter((id) => idsOrPredicate(state.entityMap[id]));\n let didMutate = DidMutate.None;\n\n for (const id of ids) {\n if (state.entityMap[id]) {\n delete state.entityMap[id];\n didMutate = DidMutate.Both;\n }\n }\n\n if (didMutate === DidMutate.Both) {\n state.ids = state.ids.filter((id) => id in state.entityMap);\n }\n\n return didMutate;\n}\n\nexport function updateEntitiesMutably(\n state: EntityState<any>,\n idsOrPredicate: EntityId[] | EntityPredicate<any>,\n changes: EntityChanges<any>\n): DidMutate {\n const ids = Array.isArray(idsOrPredicate)\n ? idsOrPredicate\n : state.ids.filter((id) => idsOrPredicate(state.entityMap[id]));\n let didMutate = DidMutate.None;\n\n for (const id of ids) {\n const entity = state.entityMap[id];\n\n if (entity) {\n const changesRecord =\n typeof changes === 'function' ? changes(entity) : changes;\n state.entityMap[id] = { ...entity, ...changesRecord };\n didMutate = DidMutate.Entities;\n }\n }\n\n return didMutate;\n}\n","import { PartialStateUpdater } from '@ngrx/signals';\nimport {\n EntityId,\n EntityIdKey,\n EntityState,\n NamedEntityState,\n} from '../models';\nimport {\n addEntityMutably,\n cloneEntityState,\n getEntityIdKey,\n getEntityStateKeys,\n getEntityUpdaterResult,\n} from '../helpers';\n\nexport function addEntity<Entity extends { id: EntityId }>(\n entity: Entity\n): PartialStateUpdater<EntityState<Entity>>;\nexport function addEntity<Entity, Collection extends string>(\n entity: Entity,\n config: { collection: Collection; idKey: EntityIdKey<Entity> }\n): PartialStateUpdater<NamedEntityState<Entity, Collection>>;\nexport function addEntity<\n Entity extends { id: EntityId },\n Collection extends string\n>(\n entity: Entity,\n config: { collection: Collection }\n): PartialStateUpdater<NamedEntityState<Entity, Collection>>;\nexport function addEntity<Entity>(\n entity: Entity,\n config: { idKey: EntityIdKey<Entity> }\n): PartialStateUpdater<EntityState<Entity>>;\nexport function addEntity(\n entity: any,\n config?: { collection?: string; idKey?: string }\n): PartialStateUpdater<EntityState<any> | NamedEntityState<any, string>> {\n const idKey = getEntityIdKey(config);\n const stateKeys = getEntityStateKeys(config);\n\n return (state) => {\n const clonedState = cloneEntityState(state, stateKeys);\n const didMutate = addEntityMutably(clonedState, entity, idKey);\n\n return getEntityUpdaterResult(clonedState, stateKeys, didMutate);\n };\n}\n","import { PartialStateUpdater } from '@ngrx/signals';\nimport {\n EntityId,\n EntityIdKey,\n EntityState,\n NamedEntityState,\n} from '../models';\nimport {\n addEntitiesMutably,\n cloneEntityState,\n getEntityIdKey,\n getEntityStateKeys,\n getEntityUpdaterResult,\n} from '../helpers';\n\nexport function addEntities<Entity extends { id: EntityId }>(\n entities: Entity[]\n): PartialStateUpdater<EntityState<Entity>>;\nexport function addEntities<Entity, Collection extends string>(\n entities: Entity[],\n config: { collection: Collection; idKey: EntityIdKey<Entity> }\n): PartialStateUpdater<NamedEntityState<Entity, Collection>>;\nexport function addEntities<\n Entity extends { id: EntityId },\n Collection extends string\n>(\n entities: Entity[],\n config: { collection: Collection }\n): PartialStateUpdater<NamedEntityState<Entity, Collection>>;\nexport function addEntities<Entity>(\n entities: Entity[],\n config: { idKey: EntityIdKey<Entity> }\n): PartialStateUpdater<EntityState<Entity>>;\nexport function addEntities(\n entities: any[],\n config?: { collection?: string; idKey?: string }\n): PartialStateUpdater<EntityState<any> | NamedEntityState<any, string>> {\n const idKey = getEntityIdKey(config);\n const stateKeys = getEntityStateKeys(config);\n\n return (state) => {\n const clonedState = cloneEntityState(state, stateKeys);\n const didMutate = addEntitiesMutably(clonedState, entities, idKey);\n\n return getEntityUpdaterResult(clonedState, stateKeys, didMutate);\n };\n}\n","import { PartialStateUpdater } from '@ngrx/signals';\nimport { EntityId, EntityState, NamedEntityState } from '../models';\nimport {\n cloneEntityState,\n getEntityStateKeys,\n getEntityUpdaterResult,\n removeEntitiesMutably,\n} from '../helpers';\n\nexport function removeEntity(\n id: EntityId\n): PartialStateUpdater<EntityState<any>>;\nexport function removeEntity<Collection extends string>(\n id: EntityId,\n config: { collection: Collection }\n): PartialStateUpdater<NamedEntityState<any, Collection>>;\nexport function removeEntity(\n id: EntityId,\n config?: { collection?: string }\n): PartialStateUpdater<EntityState<any> | NamedEntityState<any, string>> {\n const stateKeys = getEntityStateKeys(config);\n\n return (state) => {\n const clonedState = cloneEntityState(state, stateKeys);\n const didMutate = removeEntitiesMutably(clonedState, [id]);\n\n return getEntityUpdaterResult(clonedState, stateKeys, didMutate);\n };\n}\n","import { PartialStateUpdater } from '@ngrx/signals';\nimport {\n EntityId,\n EntityPredicate,\n EntityState,\n NamedEntityState,\n} from '../models';\nimport {\n cloneEntityState,\n getEntityStateKeys,\n getEntityUpdaterResult,\n removeEntitiesMutably,\n} from '../helpers';\n\nexport function removeEntities(\n ids: EntityId[]\n): PartialStateUpdater<EntityState<any>>;\nexport function removeEntities<Entity>(\n predicate: EntityPredicate<Entity>\n): PartialStateUpdater<EntityState<Entity>>;\nexport function removeEntities<Collection extends string>(\n ids: EntityId[],\n config: { collection: Collection }\n): PartialStateUpdater<NamedEntityState<any, Collection>>;\nexport function removeEntities<\n Collection extends string,\n State extends NamedEntityState<any, Collection>,\n Entity = State extends NamedEntityState<infer E, Collection> ? E : never\n>(\n predicate: EntityPredicate<Entity>,\n config: { collection: Collection }\n): PartialStateUpdater<State>;\nexport function removeEntities(\n idsOrPredicate: EntityId[] | EntityPredicate<any>,\n config?: { collection?: string }\n): PartialStateUpdater<EntityState<any> | NamedEntityState<any, string>> {\n const stateKeys = getEntityStateKeys(config);\n\n return (state) => {\n const clonedState = cloneEntityState(state, stateKeys);\n const didMutate = removeEntitiesMutably(clonedState, idsOrPredicate);\n\n return getEntityUpdaterResult(clonedState, stateKeys, didMutate);\n };\n}\n","import { PartialStateUpdater } from '@ngrx/signals';\nimport { EntityState, NamedEntityState } from '../models';\nimport { getEntityStateKeys } from '../helpers';\n\nexport function removeAllEntities(): PartialStateUpdater<EntityState<any>>;\nexport function removeAllEntities<Collection extends string>(config: {\n collection: Collection;\n}): PartialStateUpdater<NamedEntityState<any, Collection>>;\nexport function removeAllEntities(config?: {\n collection?: string;\n}): PartialStateUpdater<EntityState<any> | NamedEntityState<any, string>> {\n const stateKeys = getEntityStateKeys(config);\n\n return () => ({\n [stateKeys.entityMapKey]: {},\n [stateKeys.idsKey]: [],\n });\n}\n","import { PartialStateUpdater } from '@ngrx/signals';\nimport {\n EntityId,\n EntityIdKey,\n EntityState,\n NamedEntityState,\n} from '../models';\nimport {\n cloneEntityState,\n getEntityIdKey,\n getEntityStateKeys,\n getEntityUpdaterResult,\n setEntityMutably,\n} from '../helpers';\n\nexport function setEntity<Entity extends { id: EntityId }>(\n entity: Entity\n): PartialStateUpdater<EntityState<Entity>>;\nexport function setEntity<Entity, Collection extends string>(\n entity: Entity,\n config: { collection: Collection; idKey: EntityIdKey<Entity> }\n): PartialStateUpdater<NamedEntityState<Entity, Collection>>;\nexport function setEntity<\n Entity extends { id: EntityId },\n Collection extends string\n>(\n entity: Entity,\n config: { collection: Collection }\n): PartialStateUpdater<NamedEntityState<Entity, Collection>>;\nexport function setEntity<Entity>(\n entity: Entity,\n config: { idKey: EntityIdKey<Entity> }\n): PartialStateUpdater<EntityState<Entity>>;\nexport function setEntity(\n entity: any,\n config?: { collection?: string; idKey?: string }\n): PartialStateUpdater<EntityState<any> | NamedEntityState<any, string>> {\n const idKey = getEntityIdKey(config);\n const stateKeys = getEntityStateKeys(config);\n\n return (state) => {\n const clonedState = cloneEntityState(state, stateKeys);\n const didMutate = setEntityMutably(clonedState, entity, idKey);\n\n return getEntityUpdaterResult(clonedState, stateKeys, didMutate);\n };\n}\n","import { PartialStateUpdater } from '@ngrx/signals';\nimport {\n EntityId,\n EntityIdKey,\n EntityState,\n NamedEntityState,\n} from '../models';\nimport {\n cloneEntityState,\n getEntityIdKey,\n getEntityStateKeys,\n getEntityUpdaterResult,\n setEntitiesMutably,\n} from '../helpers';\n\nexport function setEntities<Entity extends { id: EntityId }>(\n entities: Entity[]\n): PartialStateUpdater<EntityState<Entity>>;\nexport function setEntities<Entity, Collection extends string>(\n entities: Entity[],\n config: { collection: Collection; idKey: EntityIdKey<Entity> }\n): PartialStateUpdater<NamedEntityState<Entity, Collection>>;\nexport function setEntities<\n Entity extends { id: EntityId },\n Collection extends string\n>(\n entities: Entity[],\n config: { collection: Collection }\n): PartialStateUpdater<NamedEntityState<Entity, Collection>>;\nexport function setEntities<Entity>(\n entities: Entity[],\n config: { idKey: EntityIdKey<Entity> }\n): PartialStateUpdater<EntityState<Entity>>;\nexport function setEntities(\n entities: any[],\n config?: { collection?: string; idKey?: string }\n): PartialStateUpdater<EntityState<any> | NamedEntityState<any, string>> {\n const idKey = getEntityIdKey(config);\n const stateKeys = getEntityStateKeys(config);\n\n return (state) => {\n const clonedState = cloneEntityState(state, stateKeys);\n const didMutate = setEntitiesMutably(clonedState, entities, idKey);\n\n return getEntityUpdaterResult(clonedState, stateKeys, didMutate);\n };\n}\n","import { PartialStateUpdater } from '@ngrx/signals';\nimport {\n EntityId,\n EntityIdKey,\n EntityState,\n NamedEntityState,\n} from '../models';\nimport {\n getEntityIdKey,\n getEntityStateKeys,\n setEntitiesMutably,\n} from '../helpers';\n\nexport function setAllEntities<Entity extends { id: EntityId }>(\n entities: Entity[]\n): PartialStateUpdater<EntityState<Entity>>;\nexport function setAllEntities<Entity, Collection extends string>(\n entities: Entity[],\n config: { collection: Collection; idKey: EntityIdKey<Entity> }\n): PartialStateUpdater<NamedEntityState<Entity, Collection>>;\nexport function setAllEntities<\n Entity extends { id: EntityId },\n Collection extends string\n>(\n entities: Entity[],\n config: { collection: Collection }\n): PartialStateUpdater<NamedEntityState<Entity, Collection>>;\nexport function setAllEntities<Entity>(\n entities: Entity[],\n config: { idKey: EntityIdKey<Entity> }\n): PartialStateUpdater<EntityState<Entity>>;\nexport function setAllEntities(\n entities: any[],\n config?: { collection?: string; idKey?: string }\n): PartialStateUpdater<EntityState<any> | NamedEntityState<any, string>> {\n const idKey = getEntityIdKey(config);\n const stateKeys = getEntityStateKeys(config);\n\n return () => {\n const state: EntityState<any> = { entityMap: {}, ids: [] };\n setEntitiesMutably(state, entities, idKey);\n\n return {\n [stateKeys.entityMapKey]: state.entityMap,\n [stateKeys.idsKey]: state.ids,\n };\n };\n}\n","import { PartialStateUpdater } from '@ngrx/signals';\nimport {\n EntityChanges,\n EntityId,\n EntityState,\n NamedEntityState,\n} from '../models';\nimport {\n cloneEntityState,\n getEntityStateKeys,\n getEntityUpdaterResult,\n updateEntitiesMutably,\n} from '../helpers';\n\nexport function updateEntity<Entity>(update: {\n id: EntityId;\n changes: EntityChanges<Entity & {}>;\n}): PartialStateUpdater<EntityState<Entity>>;\nexport function updateEntity<\n Collection extends string,\n State extends NamedEntityState<any, Collection>,\n Entity = State extends NamedEntityState<infer E, Collection> ? E : never\n>(\n update: {\n id: EntityId;\n changes: EntityChanges<Entity & {}>;\n },\n config: { collection: Collection }\n): PartialStateUpdater<State>;\nexport function updateEntity(\n update: {\n id: EntityId;\n changes: EntityChanges<any>;\n },\n config?: { collection?: string }\n): PartialStateUpdater<EntityState<any> | NamedEntityState<any, string>> {\n const stateKeys = getEntityStateKeys(config);\n\n return (state) => {\n const clonedState = cloneEntityState(state, stateKeys);\n const didMutate = updateEntitiesMutably(\n clonedState,\n [update.id],\n update.changes\n );\n\n return getEntityUpdaterResult(clonedState, stateKeys, didMutate);\n };\n}\n","import { PartialStateUpdater } from '@ngrx/signals';\nimport {\n EntityChanges,\n EntityId,\n EntityPredicate,\n EntityState,\n NamedEntityState,\n} from '../models';\nimport {\n cloneEntityState,\n getEntityStateKeys,\n getEntityUpdaterResult,\n updateEntitiesMutably,\n} from '../helpers';\n\nexport function updateEntities<Entity>(update: {\n ids: EntityId[];\n changes: EntityChanges<Entity & {}>;\n}): PartialStateUpdater<EntityState<Entity>>;\nexport function updateEntities<Entity>(update: {\n predicate: EntityPredicate<Entity>;\n changes: EntityChanges<Entity & {}>;\n}): PartialStateUpdater<EntityState<Entity>>;\nexport function updateEntities<\n Collection extends string,\n State extends NamedEntityState<any, Collection>,\n Entity = State extends NamedEntityState<infer E, Collection> ? E : never\n>(\n update: {\n ids: EntityId[];\n changes: EntityChanges<Entity & {}>;\n },\n config: { collection: Collection }\n): PartialStateUpdater<State>;\nexport function updateEntities<\n Collection extends string,\n State extends NamedEntityState<any, Collection>,\n Entity = State extends NamedEntityState<infer E, Collection> ? E : never\n>(\n update: {\n predicate: EntityPredicate<Entity>;\n changes: EntityChanges<Entity & {}>;\n },\n config: { collection: Collection }\n): PartialStateUpdater<State>;\nexport function updateEntities(\n update: ({ ids: EntityId[] } | { predicate: EntityPredicate<any> }) & {\n changes: EntityChanges<any>;\n },\n config?: { collection?: string }\n): PartialStateUpdater<EntityState<any> | NamedEntityState<any, string>> {\n const stateKeys = getEntityStateKeys(config);\n const idsOrPredicate = 'ids' in update ? update.ids : update.predicate;\n\n return (state) => {\n const clonedState = cloneEntityState(state, stateKeys);\n const didMutate = updateEntitiesMutably(\n clonedState,\n idsOrPredicate,\n update.changes\n );\n\n return getEntityUpdaterResult(clonedState, stateKeys, didMutate);\n };\n}\n","import { PartialStateUpdater } from '@ngrx/signals';\nimport { EntityChanges, EntityState, NamedEntityState } from '../models';\nimport {\n cloneEntityState,\n getEntityStateKeys,\n getEntityUpdaterResult,\n updateEntitiesMutably,\n} from '../helpers';\n\nexport function updateAllEntities<Entity>(\n changes: EntityChanges<Entity & {}>\n): PartialStateUpdater<EntityState<Entity>>;\nexport function updateAllEntities<\n Collection extends string,\n State extends NamedEntityState<any, Collection>,\n Entity = State extends NamedEntityState<infer E, Collection> ? E : never\n>(\n changes: EntityChanges<Entity & {}>,\n config: { collection: Collection }\n): PartialStateUpdater<State>;\nexport function updateAllEntities(\n changes: EntityChanges<any>,\n config?: { collection?: string }\n): PartialStateUpdater<EntityState<any> | NamedEntityState<any, string>> {\n const stateKeys = getEntityStateKeys(config);\n\n return (state) => {\n const clonedState = cloneEntityState(state, stateKeys);\n const didMutate = updateEntitiesMutably(\n clonedState,\n (state as Record<string, any>)[stateKeys.idsKey],\n changes\n );\n\n return getEntityUpdaterResult(clonedState, stateKeys, didMutate);\n };\n}\n","import { computed, Signal } from '@angular/core';\nimport {\n SignalStoreFeature,\n signalStoreFeature,\n withComputed,\n withState,\n} from '@ngrx/signals';\nimport {\n EntityId,\n EntityMap,\n EntitySignals,\n EntityState,\n NamedEntitySignals,\n NamedEntityState,\n} from './models';\nimport { getEntityStateKeys } from './helpers';\n\nexport function withEntities<Entity>(): SignalStoreFeature<\n { state: {}; signals: {}; methods: {} },\n {\n state: EntityState<Entity>;\n signals: EntitySignals<Entity>;\n methods: {};\n }\n>;\nexport function withEntities<Entity, Collection extends string>(config: {\n entity: Entity;\n collection: Collection;\n}): SignalStoreFeature<\n { state: {}; signals: {}; methods: {} },\n {\n state: NamedEntityState<Entity, Collection>;\n signals: NamedEntitySignals<Entity, Collection>;\n methods: {};\n }\n>;\nexport function withEntities<Entity>(config: {\n entity: Entity;\n}): SignalStoreFeature<\n { state: {}; signals: {}; methods: {} },\n {\n state: EntityState<Entity>;\n signals: EntitySignals<Entity>;\n methods: {};\n }\n>;\nexport function withEntities<Entity>(config?: {\n entity: Entity;\n collection?: string;\n}): SignalStoreFeature {\n const { entityMapKey, idsKey, entitiesKey } = getEntityStateKeys(config);\n\n return signalStoreFeature(\n withState({\n [entityMapKey]: {},\n [idsKey]: [],\n }),\n withComputed((store: Record<string, Signal<unknown>>) => ({\n [entitiesKey]: computed(() => {\n const entityMap = store[entityMapKey]() as EntityMap<Entity>;\n const ids = store[idsKey]() as EntityId[];\n\n return ids.map((id) => entityMap[id]);\n }),\n }))\n );\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;AAmCA,IAAY,SAIX,CAAA;AAJD,CAAA,UAAY,SAAS,EAAA;AACnB,IAAA,SAAA,CAAA,SAAA,CAAA,MAAA,CAAA,GAAA,CAAA,CAAA,GAAA,MAAI,CAAA;AACJ,IAAA,SAAA,CAAA,SAAA,CAAA,UAAA,CAAA,GAAA,CAAA,CAAA,GAAA,UAAQ,CAAA;AACR,IAAA,SAAA,CAAA,SAAA,CAAA,MAAA,CAAA,GAAA,CAAA,CAAA,GAAA,MAAI,CAAA;AACN,CAAC,EAJW,SAAS,KAAT,SAAS,GAIpB,EAAA,CAAA,CAAA;;AC/BK,SAAU,cAAc,CAAC,MAA2B,EAAA;AACxD,IAAA,OAAO,MAAM,EAAE,KAAK,IAAI,IAAI,CAAC;AAC/B,CAAC;AAEK,SAAU,kBAAkB,CAAC,MAAgC,EAAA;AAKjE,IAAA,MAAM,UAAU,GAAG,MAAM,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,kBAAkB,CAAC,MAAM,CAAC,CAAC;IAE7C,OAAO,CAAC,KAAK,KAAI;QACf,MAAM,WAAW,GAAG,gBAAgB,CAAC,KAAK,EAAE,SAAS,CAAC,CAAC;AACvD,QAAA,MAAM,SAAS,GAAG,qBAAqB,CACrC,WAAW,EACV,KAA6B,CAAC,SAAS,CAAC,MAAM,CAAC,EAChD,OAAO,CACR,CAAC;QAEF,OAAO,sBAAsB,CAAC,WAAW,EAAE,SAAS,EAAE,SAAS,CAAC,CAAC;AACnE,KAAC,CAAC;AACJ;;ACUM,SAAU,YAAY,CAAS,MAGpC,EAAA;AACC,IAAA,MAAM,EAAE,YAAY,EAAE,MAAM,EAAE,WAAW,EAAE,GAAG,kBAAkB,CAAC,MAAM,CAAC,CAAC;IAEzE,OAAO,kBAAkB,CACvB,SAAS,CAAC;QACR,CAAC,YAAY,GAAG,EAAE;QAClB,CAAC,MAAM,GAAG,EAAE;KACb,CAAC,EACF,YAAY,CAAC,CAAC,KAAsC,MAAM;AACxD,QAAA,CAAC,WAAW,GAAG,QAAQ,CAAC,MAAK;AAC3B,YAAA,MAAM,SAAS,GAAG,KAAK,CAAC,YAAY,CAAC,EAAuB,CAAC;AAC7D,YAAA,MAAM,GAAG,GAAG,KAAK,CAAC,MAAM,CAAC,EAAgB,CAAC;AAE1C,YAAA,OAAO,GAAG,CAAC,GAAG,CAAC,CAAC,EAAE,KAAK,SAAS,CAAC,EAAE,CAAC,CAAC,CAAC;AACxC,SAAC,CAAC;KACH,CAAC,CAAC,CACJ,CAAC;AACJ;;AClEA;;AAEG;;;;"}
1
+ {"version":3,"file":"ngrx-signals-entities.mjs","sources":["../../../../modules/signals/entities/src/models.ts","../../../../modules/signals/entities/src/helpers.ts","../../../../modules/signals/entities/src/updaters/add-entity.ts","../../../../modules/signals/entities/src/updaters/add-entities.ts","../../../../modules/signals/entities/src/updaters/remove-entity.ts","../../../../modules/signals/entities/src/updaters/remove-entities.ts","../../../../modules/signals/entities/src/updaters/remove-all-entities.ts","../../../../modules/signals/entities/src/updaters/set-entity.ts","../../../../modules/signals/entities/src/updaters/set-entities.ts","../../../../modules/signals/entities/src/updaters/set-all-entities.ts","../../../../modules/signals/entities/src/updaters/update-entity.ts","../../../../modules/signals/entities/src/updaters/update-entities.ts","../../../../modules/signals/entities/src/updaters/update-all-entities.ts","../../../../modules/signals/entities/src/entity-config.ts","../../../../modules/signals/entities/src/with-entities.ts","../../../../modules/signals/entities/ngrx-signals-entities.ts"],"sourcesContent":["import { Signal } from '@angular/core';\n\nexport type EntityId = string | number;\n\nexport type EntityMap<Entity> = Record<EntityId, Entity>;\n\nexport type EntityState<Entity> = {\n entityMap: EntityMap<Entity>;\n ids: EntityId[];\n};\n\nexport type NamedEntityState<Entity, Collection extends string> = {\n [K in keyof EntityState<Entity> as `${Collection}${Capitalize<K>}`]: EntityState<Entity>[K];\n};\n\nexport type EntityComputed<Entity> = {\n entities: Signal<Entity[]>;\n};\n\nexport type NamedEntityComputed<Entity, Collection extends string> = {\n [K in keyof EntityComputed<Entity> as `${Collection}${Capitalize<K>}`]: EntityComputed<Entity>[K];\n};\n\nexport type SelectEntityId<Entity> = (entity: Entity) => EntityId;\n\nexport type EntityPredicate<Entity> = (entity: Entity) => boolean;\n\nexport type EntityChanges<Entity> =\n | Partial<Entity>\n | ((entity: Entity) => Partial<Entity>);\n\nexport enum DidMutate {\n None,\n Entities,\n Both,\n}\n","import {\n DidMutate,\n EntityChanges,\n EntityId,\n EntityPredicate,\n EntityState,\n SelectEntityId,\n} from './models';\n\ndeclare const ngDevMode: unknown;\nconst defaultSelectId: SelectEntityId<{ id: EntityId }> = (entity) => entity.id;\n\nexport function getEntityIdSelector(config?: {\n selectId?: SelectEntityId<any>;\n}): SelectEntityId<any> {\n return config?.selectId ?? defaultSelectId;\n}\n\nexport function getEntityStateKeys(config?: { collection?: string }): {\n entityMapKey: string;\n idsKey: string;\n entitiesKey: string;\n} {\n const collection = config?.collection;\n const entityMapKey =\n collection === undefined ? 'entityMap' : `${collection}EntityMap`;\n const idsKey = collection === undefined ? 'ids' : `${collection}Ids`;\n const entitiesKey =\n collection === undefined ? 'entities' : `${collection}Entities`;\n\n return { entityMapKey, idsKey, entitiesKey };\n}\n\nexport function cloneEntityState(\n state: Record<string, any>,\n stateKeys: {\n entityMapKey: string;\n idsKey: string;\n }\n): EntityState<any> {\n return {\n entityMap: { ...state[stateKeys.entityMapKey] },\n ids: [...state[stateKeys.idsKey]],\n };\n}\n\nexport function getEntityUpdaterResult(\n state: EntityState<any>,\n stateKeys: {\n entityMapKey: string;\n idsKey: string;\n },\n didMutate: DidMutate\n): Record<string, any> {\n switch (didMutate) {\n case DidMutate.Both: {\n return {\n [stateKeys.entityMapKey]: state.entityMap,\n [stateKeys.idsKey]: state.ids,\n };\n }\n case DidMutate.Entities: {\n return { [stateKeys.entityMapKey]: state.entityMap };\n }\n default: {\n return {};\n }\n }\n}\n\nexport function addEntityMutably(\n state: EntityState<any>,\n entity: any,\n selectId: SelectEntityId<any>\n): DidMutate {\n const id = selectId(entity);\n\n if (state.entityMap[id]) {\n return DidMutate.None;\n }\n\n state.entityMap[id] = entity;\n state.ids.push(id);\n\n return DidMutate.Both;\n}\n\nexport function addEntitiesMutably(\n state: EntityState<any>,\n entities: any[],\n selectId: SelectEntityId<any>\n): DidMutate {\n let didMutate = DidMutate.None;\n\n for (const entity of entities) {\n const result = addEntityMutably(state, entity, selectId);\n\n if (result === DidMutate.Both) {\n didMutate = result;\n }\n }\n\n return didMutate;\n}\n\nexport function setEntityMutably(\n state: EntityState<any>,\n entity: any,\n selectId: SelectEntityId<any>\n): DidMutate {\n const id = selectId(entity);\n\n if (state.entityMap[id]) {\n state.entityMap[id] = entity;\n return DidMutate.Entities;\n }\n\n state.entityMap[id] = entity;\n state.ids.push(id);\n\n return DidMutate.Both;\n}\n\nexport function setEntitiesMutably(\n state: EntityState<any>,\n entities: any[],\n selectId: SelectEntityId<any>\n): DidMutate {\n let didMutate = DidMutate.None;\n\n for (const entity of entities) {\n const result = setEntityMutably(state, entity, selectId);\n\n if (didMutate === DidMutate.Both) {\n continue;\n }\n\n didMutate = result;\n }\n\n return didMutate;\n}\n\nexport function removeEntitiesMutably(\n state: EntityState<any>,\n idsOrPredicate: EntityId[] | EntityPredicate<any>\n): DidMutate {\n const ids = Array.isArray(idsOrPredicate)\n ? idsOrPredicate\n : state.ids.filter((id) => idsOrPredicate(state.entityMap[id]));\n let didMutate = DidMutate.None;\n\n for (const id of ids) {\n if (state.entityMap[id]) {\n delete state.entityMap[id];\n didMutate = DidMutate.Both;\n }\n }\n\n if (didMutate === DidMutate.Both) {\n state.ids = state.ids.filter((id) => id in state.entityMap);\n }\n\n return didMutate;\n}\n\nexport function updateEntitiesMutably(\n state: EntityState<any>,\n idsOrPredicate: EntityId[] | EntityPredicate<any>,\n changes: EntityChanges<any>,\n selectId: SelectEntityId<any>\n): DidMutate {\n const ids = Array.isArray(idsOrPredicate)\n ? idsOrPredicate\n : state.ids.filter((id) => idsOrPredicate(state.entityMap[id]));\n let newIds: Record<EntityId, EntityId> | undefined = undefined;\n let didMutate = DidMutate.None;\n\n for (const id of ids) {\n const entity = state.entityMap[id];\n\n if (entity) {\n const changesRecord =\n typeof changes === 'function' ? changes(entity) : changes;\n state.entityMap[id] = { ...entity, ...changesRecord };\n didMutate = DidMutate.Entities;\n\n const newId = selectId(state.entityMap[id]);\n if (newId !== id) {\n state.entityMap[newId] = state.entityMap[id];\n delete state.entityMap[id];\n\n newIds = newIds || {};\n newIds[id] = newId;\n }\n }\n }\n\n if (newIds) {\n state.ids = state.ids.map((id) => newIds[id] ?? id);\n didMutate = DidMutate.Both;\n }\n\n if (ngDevMode && state.ids.length !== Object.keys(state.entityMap).length) {\n console.warn(\n '@ngrx/signals/entities: Entities with IDs:',\n ids,\n 'are not updated correctly.',\n 'Make sure to apply valid changes when using `updateEntity`,',\n '`updateEntities`, and `updateAllEntities` updaters.'\n );\n }\n\n return didMutate;\n}\n","import { PartialStateUpdater } from '@ngrx/signals';\nimport {\n EntityId,\n EntityState,\n NamedEntityState,\n SelectEntityId,\n} from '../models';\nimport {\n addEntityMutably,\n cloneEntityState,\n getEntityIdSelector,\n getEntityStateKeys,\n getEntityUpdaterResult,\n} from '../helpers';\n\nexport function addEntity<Entity extends { id: EntityId }>(\n entity: Entity\n): PartialStateUpdater<EntityState<Entity>>;\nexport function addEntity<Entity, Collection extends string>(\n entity: Entity,\n config: { collection: Collection; selectId: SelectEntityId<NoInfer<Entity>> }\n): PartialStateUpdater<NamedEntityState<Entity, Collection>>;\nexport function addEntity<\n Entity extends { id: EntityId },\n Collection extends string\n>(\n entity: Entity,\n config: { collection: Collection }\n): PartialStateUpdater<NamedEntityState<Entity, Collection>>;\nexport function addEntity<Entity>(\n entity: Entity,\n config: { selectId: SelectEntityId<NoInfer<Entity>> }\n): PartialStateUpdater<EntityState<Entity>>;\nexport function addEntity(\n entity: any,\n config?: { collection?: string; selectId?: SelectEntityId<any> }\n): PartialStateUpdater<EntityState<any> | NamedEntityState<any, string>> {\n const selectId = getEntityIdSelector(config);\n const stateKeys = getEntityStateKeys(config);\n\n return (state) => {\n const clonedState = cloneEntityState(state, stateKeys);\n const didMutate = addEntityMutably(clonedState, entity, selectId);\n\n return getEntityUpdaterResult(clonedState, stateKeys, didMutate);\n };\n}\n","import { PartialStateUpdater } from '@ngrx/signals';\nimport {\n EntityId,\n EntityState,\n NamedEntityState,\n SelectEntityId,\n} from '../models';\nimport {\n addEntitiesMutably,\n cloneEntityState,\n getEntityIdSelector,\n getEntityStateKeys,\n getEntityUpdaterResult,\n} from '../helpers';\n\nexport function addEntities<Entity extends { id: EntityId }>(\n entities: Entity[]\n): PartialStateUpdater<EntityState<Entity>>;\nexport function addEntities<Entity, Collection extends string>(\n entities: Entity[],\n config: { collection: Collection; selectId: SelectEntityId<NoInfer<Entity>> }\n): PartialStateUpdater<NamedEntityState<Entity, Collection>>;\nexport function addEntities<\n Entity extends { id: EntityId },\n Collection extends string\n>(\n entities: Entity[],\n config: { collection: Collection }\n): PartialStateUpdater<NamedEntityState<Entity, Collection>>;\nexport function addEntities<Entity>(\n entities: Entity[],\n config: { selectId: SelectEntityId<NoInfer<Entity>> }\n): PartialStateUpdater<EntityState<Entity>>;\nexport function addEntities(\n entities: any[],\n config?: { collection?: string; selectId?: SelectEntityId<any> }\n): PartialStateUpdater<EntityState<any> | NamedEntityState<any, string>> {\n const selectId = getEntityIdSelector(config);\n const stateKeys = getEntityStateKeys(config);\n\n return (state) => {\n const clonedState = cloneEntityState(state, stateKeys);\n const didMutate = addEntitiesMutably(clonedState, entities, selectId);\n\n return getEntityUpdaterResult(clonedState, stateKeys, didMutate);\n };\n}\n","import { PartialStateUpdater } from '@ngrx/signals';\nimport { EntityId, EntityState, NamedEntityState } from '../models';\nimport {\n cloneEntityState,\n getEntityStateKeys,\n getEntityUpdaterResult,\n removeEntitiesMutably,\n} from '../helpers';\n\nexport function removeEntity(\n id: EntityId\n): PartialStateUpdater<EntityState<any>>;\nexport function removeEntity<Collection extends string>(\n id: EntityId,\n config: { collection: Collection }\n): PartialStateUpdater<NamedEntityState<any, Collection>>;\nexport function removeEntity(\n id: EntityId,\n config?: { collection?: string }\n): PartialStateUpdater<EntityState<any> | NamedEntityState<any, string>> {\n const stateKeys = getEntityStateKeys(config);\n\n return (state) => {\n const clonedState = cloneEntityState(state, stateKeys);\n const didMutate = removeEntitiesMutably(clonedState, [id]);\n\n return getEntityUpdaterResult(clonedState, stateKeys, didMutate);\n };\n}\n","import { PartialStateUpdater } from '@ngrx/signals';\nimport {\n EntityId,\n EntityPredicate,\n EntityState,\n NamedEntityState,\n} from '../models';\nimport {\n cloneEntityState,\n getEntityStateKeys,\n getEntityUpdaterResult,\n removeEntitiesMutably,\n} from '../helpers';\n\nexport function removeEntities(\n ids: EntityId[]\n): PartialStateUpdater<EntityState<any>>;\nexport function removeEntities<Entity>(\n predicate: EntityPredicate<Entity>\n): PartialStateUpdater<EntityState<Entity>>;\nexport function removeEntities<Collection extends string>(\n ids: EntityId[],\n config: { collection: Collection }\n): PartialStateUpdater<NamedEntityState<any, Collection>>;\nexport function removeEntities<\n Collection extends string,\n State extends NamedEntityState<any, Collection>,\n Entity = State extends NamedEntityState<infer E, Collection> ? E : never\n>(\n predicate: EntityPredicate<Entity>,\n config: { collection: Collection }\n): PartialStateUpdater<State>;\nexport function removeEntities(\n idsOrPredicate: EntityId[] | EntityPredicate<any>,\n config?: { collection?: string }\n): PartialStateUpdater<EntityState<any> | NamedEntityState<any, string>> {\n const stateKeys = getEntityStateKeys(config);\n\n return (state) => {\n const clonedState = cloneEntityState(state, stateKeys);\n const didMutate = removeEntitiesMutably(clonedState, idsOrPredicate);\n\n return getEntityUpdaterResult(clonedState, stateKeys, didMutate);\n };\n}\n","import { PartialStateUpdater } from '@ngrx/signals';\nimport { EntityState, NamedEntityState } from '../models';\nimport { getEntityStateKeys } from '../helpers';\n\nexport function removeAllEntities(): PartialStateUpdater<EntityState<any>>;\nexport function removeAllEntities<Collection extends string>(config: {\n collection: Collection;\n}): PartialStateUpdater<NamedEntityState<any, Collection>>;\nexport function removeAllEntities(config?: {\n collection?: string;\n}): PartialStateUpdater<EntityState<any> | NamedEntityState<any, string>> {\n const stateKeys = getEntityStateKeys(config);\n\n return () => ({\n [stateKeys.entityMapKey]: {},\n [stateKeys.idsKey]: [],\n });\n}\n","import { PartialStateUpdater } from '@ngrx/signals';\nimport {\n EntityId,\n EntityState,\n NamedEntityState,\n SelectEntityId,\n} from '../models';\nimport {\n cloneEntityState,\n getEntityIdSelector,\n getEntityStateKeys,\n getEntityUpdaterResult,\n setEntityMutably,\n} from '../helpers';\n\nexport function setEntity<Entity extends { id: EntityId }>(\n entity: Entity\n): PartialStateUpdater<EntityState<Entity>>;\nexport function setEntity<Entity, Collection extends string>(\n entity: Entity,\n config: { collection: Collection; selectId: SelectEntityId<NoInfer<Entity>> }\n): PartialStateUpdater<NamedEntityState<Entity, Collection>>;\nexport function setEntity<\n Entity extends { id: EntityId },\n Collection extends string\n>(\n entity: Entity,\n config: { collection: Collection }\n): PartialStateUpdater<NamedEntityState<Entity, Collection>>;\nexport function setEntity<Entity>(\n entity: Entity,\n config: { selectId: SelectEntityId<NoInfer<Entity>> }\n): PartialStateUpdater<EntityState<Entity>>;\nexport function setEntity(\n entity: any,\n config?: { collection?: string; selectId?: SelectEntityId<any> }\n): PartialStateUpdater<EntityState<any> | NamedEntityState<any, string>> {\n const selectId = getEntityIdSelector(config);\n const stateKeys = getEntityStateKeys(config);\n\n return (state) => {\n const clonedState = cloneEntityState(state, stateKeys);\n const didMutate = setEntityMutably(clonedState, entity, selectId);\n\n return getEntityUpdaterResult(clonedState, stateKeys, didMutate);\n };\n}\n","import { PartialStateUpdater } from '@ngrx/signals';\nimport {\n EntityId,\n EntityState,\n NamedEntityState,\n SelectEntityId,\n} from '../models';\nimport {\n cloneEntityState,\n getEntityIdSelector,\n getEntityStateKeys,\n getEntityUpdaterResult,\n setEntitiesMutably,\n} from '../helpers';\n\nexport function setEntities<Entity extends { id: EntityId }>(\n entities: Entity[]\n): PartialStateUpdater<EntityState<Entity>>;\nexport function setEntities<Entity, Collection extends string>(\n entities: Entity[],\n config: { collection: Collection; selectId: SelectEntityId<NoInfer<Entity>> }\n): PartialStateUpdater<NamedEntityState<Entity, Collection>>;\nexport function setEntities<\n Entity extends { id: EntityId },\n Collection extends string\n>(\n entities: Entity[],\n config: { collection: Collection }\n): PartialStateUpdater<NamedEntityState<Entity, Collection>>;\nexport function setEntities<Entity>(\n entities: Entity[],\n config: { selectId: SelectEntityId<NoInfer<Entity>> }\n): PartialStateUpdater<EntityState<Entity>>;\nexport function setEntities(\n entities: any[],\n config?: { collection?: string; selectId?: SelectEntityId<any> }\n): PartialStateUpdater<EntityState<any> | NamedEntityState<any, string>> {\n const selectId = getEntityIdSelector(config);\n const stateKeys = getEntityStateKeys(config);\n\n return (state) => {\n const clonedState = cloneEntityState(state, stateKeys);\n const didMutate = setEntitiesMutably(clonedState, entities, selectId);\n\n return getEntityUpdaterResult(clonedState, stateKeys, didMutate);\n };\n}\n","import { PartialStateUpdater } from '@ngrx/signals';\nimport {\n EntityId,\n EntityState,\n NamedEntityState,\n SelectEntityId,\n} from '../models';\nimport {\n getEntityIdSelector,\n getEntityStateKeys,\n setEntitiesMutably,\n} from '../helpers';\n\nexport function setAllEntities<Entity extends { id: EntityId }>(\n entities: Entity[]\n): PartialStateUpdater<EntityState<Entity>>;\nexport function setAllEntities<Entity, Collection extends string>(\n entities: Entity[],\n config: { collection: Collection; selectId: SelectEntityId<NoInfer<Entity>> }\n): PartialStateUpdater<NamedEntityState<Entity, Collection>>;\nexport function setAllEntities<\n Entity extends { id: EntityId },\n Collection extends string\n>(\n entities: Entity[],\n config: { collection: Collection }\n): PartialStateUpdater<NamedEntityState<Entity, Collection>>;\nexport function setAllEntities<Entity>(\n entities: Entity[],\n config: { selectId: SelectEntityId<NoInfer<Entity>> }\n): PartialStateUpdater<EntityState<Entity>>;\nexport function setAllEntities(\n entities: any[],\n config?: { collection?: string; selectId?: SelectEntityId<any> }\n): PartialStateUpdater<EntityState<any> | NamedEntityState<any, string>> {\n const selectId = getEntityIdSelector(config);\n const stateKeys = getEntityStateKeys(config);\n\n return () => {\n const state: EntityState<any> = { entityMap: {}, ids: [] };\n setEntitiesMutably(state, entities, selectId);\n\n return {\n [stateKeys.entityMapKey]: state.entityMap,\n [stateKeys.idsKey]: state.ids,\n };\n };\n}\n","import { PartialStateUpdater } from '@ngrx/signals';\nimport {\n EntityChanges,\n EntityId,\n EntityState,\n NamedEntityState,\n SelectEntityId,\n} from '../models';\nimport {\n cloneEntityState,\n getEntityIdSelector,\n getEntityStateKeys,\n getEntityUpdaterResult,\n updateEntitiesMutably,\n} from '../helpers';\n\nexport function updateEntity<\n Collection extends string,\n State extends NamedEntityState<any, Collection>,\n Entity = State extends NamedEntityState<infer E, Collection> ? E : never\n>(\n update: {\n id: EntityId;\n changes: EntityChanges<NoInfer<Entity>>;\n },\n config: {\n collection: Collection;\n selectId: SelectEntityId<NoInfer<Entity>>;\n }\n): PartialStateUpdater<State>;\nexport function updateEntity<\n Collection extends string,\n State extends NamedEntityState<any, Collection>,\n Entity = State extends NamedEntityState<\n infer E extends { id: EntityId },\n Collection\n >\n ? E\n : never\n>(\n update: {\n id: EntityId;\n changes: EntityChanges<NoInfer<Entity>>;\n },\n config: { collection: Collection }\n): PartialStateUpdater<State>;\nexport function updateEntity<Entity>(\n update: {\n id: EntityId;\n changes: EntityChanges<NoInfer<Entity>>;\n },\n config: { selectId: SelectEntityId<NoInfer<Entity>> }\n): PartialStateUpdater<EntityState<Entity>>;\nexport function updateEntity<Entity extends { id: EntityId }>(update: {\n id: EntityId;\n changes: EntityChanges<NoInfer<Entity>>;\n}): PartialStateUpdater<EntityState<Entity>>;\nexport function updateEntity(\n update: {\n id: EntityId;\n changes: EntityChanges<any>;\n },\n config?: { collection?: string; selectId?: SelectEntityId<any> }\n): PartialStateUpdater<EntityState<any> | NamedEntityState<any, string>> {\n const selectId = getEntityIdSelector(config);\n const stateKeys = getEntityStateKeys(config);\n\n return (state) => {\n const clonedState = cloneEntityState(state, stateKeys);\n const didMutate = updateEntitiesMutably(\n clonedState,\n [update.id],\n update.changes,\n selectId\n );\n\n return getEntityUpdaterResult(clonedState, stateKeys, didMutate);\n };\n}\n","import { PartialStateUpdater } from '@ngrx/signals';\nimport {\n EntityChanges,\n EntityId,\n EntityPredicate,\n EntityState,\n NamedEntityState,\n SelectEntityId,\n} from '../models';\nimport {\n cloneEntityState,\n getEntityIdSelector,\n getEntityStateKeys,\n getEntityUpdaterResult,\n updateEntitiesMutably,\n} from '../helpers';\n\nexport function updateEntities<\n Collection extends string,\n State extends NamedEntityState<any, Collection>,\n Entity = State extends NamedEntityState<infer E, Collection> ? E : never\n>(\n update: {\n ids: EntityId[];\n changes: EntityChanges<NoInfer<Entity>>;\n },\n config: {\n collection: Collection;\n selectId: SelectEntityId<NoInfer<Entity>>;\n }\n): PartialStateUpdater<State>;\nexport function updateEntities<\n Collection extends string,\n State extends NamedEntityState<any, Collection>,\n Entity = State extends NamedEntityState<infer E, Collection> ? E : never\n>(\n update: {\n predicate: EntityPredicate<Entity>;\n changes: EntityChanges<NoInfer<Entity>>;\n },\n config: {\n collection: Collection;\n selectId: SelectEntityId<NoInfer<Entity>>;\n }\n): PartialStateUpdater<State>;\nexport function updateEntities<\n Collection extends string,\n State extends NamedEntityState<any, Collection>,\n Entity = State extends NamedEntityState<\n infer E extends { id: EntityId },\n Collection\n >\n ? E\n : never\n>(\n update: {\n ids: EntityId[];\n changes: EntityChanges<NoInfer<Entity>>;\n },\n config: { collection: Collection }\n): PartialStateUpdater<State>;\nexport function updateEntities<\n Collection extends string,\n State extends NamedEntityState<any, Collection>,\n Entity = State extends NamedEntityState<\n infer E extends { id: EntityId },\n Collection\n >\n ? E\n : never\n>(\n update: {\n predicate: EntityPredicate<Entity>;\n changes: EntityChanges<NoInfer<Entity>>;\n },\n config: { collection: Collection }\n): PartialStateUpdater<State>;\nexport function updateEntities<Entity>(\n update: {\n ids: EntityId[];\n changes: EntityChanges<NoInfer<Entity>>;\n },\n config: { selectId: SelectEntityId<NoInfer<Entity>> }\n): PartialStateUpdater<EntityState<Entity>>;\nexport function updateEntities<Entity>(\n update: {\n predicate: EntityPredicate<Entity>;\n changes: EntityChanges<NoInfer<Entity>>;\n },\n config: { selectId: SelectEntityId<NoInfer<Entity>> }\n): PartialStateUpdater<EntityState<Entity>>;\nexport function updateEntities<Entity extends { id: EntityId }>(update: {\n ids: EntityId[];\n changes: EntityChanges<NoInfer<Entity>>;\n}): PartialStateUpdater<EntityState<Entity>>;\nexport function updateEntities<Entity extends { id: EntityId }>(update: {\n predicate: EntityPredicate<Entity>;\n changes: EntityChanges<NoInfer<Entity>>;\n}): PartialStateUpdater<EntityState<Entity>>;\nexport function updateEntities(\n update: ({ ids: EntityId[] } | { predicate: EntityPredicate<any> }) & {\n changes: EntityChanges<any>;\n },\n config?: { collection?: string; selectId?: SelectEntityId<any> }\n): PartialStateUpdater<EntityState<any> | NamedEntityState<any, string>> {\n const selectId = getEntityIdSelector(config);\n const stateKeys = getEntityStateKeys(config);\n const idsOrPredicate = 'ids' in update ? update.ids : update.predicate;\n\n return (state) => {\n const clonedState = cloneEntityState(state, stateKeys);\n const didMutate = updateEntitiesMutably(\n clonedState,\n idsOrPredicate,\n update.changes,\n selectId\n );\n\n return getEntityUpdaterResult(clonedState, stateKeys, didMutate);\n };\n}\n","import { PartialStateUpdater } from '@ngrx/signals';\nimport {\n EntityChanges,\n EntityId,\n EntityState,\n NamedEntityState,\n SelectEntityId,\n} from '../models';\nimport {\n cloneEntityState,\n getEntityIdSelector,\n getEntityStateKeys,\n getEntityUpdaterResult,\n updateEntitiesMutably,\n} from '../helpers';\n\nexport function updateAllEntities<\n Collection extends string,\n State extends NamedEntityState<any, Collection>,\n Entity = State extends NamedEntityState<infer E, Collection> ? E : never\n>(\n changes: EntityChanges<NoInfer<Entity>>,\n config: {\n collection: Collection;\n selectId: SelectEntityId<NoInfer<Entity>>;\n }\n): PartialStateUpdater<State>;\nexport function updateAllEntities<\n Collection extends string,\n State extends NamedEntityState<any, Collection>,\n Entity = State extends NamedEntityState<\n infer E extends { id: EntityId },\n Collection\n >\n ? E\n : never\n>(\n changes: EntityChanges<NoInfer<Entity>>,\n config: { collection: Collection }\n): PartialStateUpdater<State>;\nexport function updateAllEntities<Entity>(\n changes: EntityChanges<NoInfer<Entity>>,\n config: { selectId: SelectEntityId<NoInfer<Entity>> }\n): PartialStateUpdater<EntityState<Entity>>;\nexport function updateAllEntities<Entity extends { id: EntityId }>(\n changes: EntityChanges<NoInfer<Entity>>\n): PartialStateUpdater<EntityState<Entity>>;\nexport function updateAllEntities(\n changes: EntityChanges<any>,\n config?: { collection?: string; selectId?: SelectEntityId<any> }\n): PartialStateUpdater<EntityState<any> | NamedEntityState<any, string>> {\n const selectId = getEntityIdSelector(config);\n const stateKeys = getEntityStateKeys(config);\n\n return (state) => {\n const clonedState = cloneEntityState(state, stateKeys);\n const didMutate = updateEntitiesMutably(\n clonedState,\n (state as Record<string, any>)[stateKeys.idsKey],\n changes,\n selectId\n );\n\n return getEntityUpdaterResult(clonedState, stateKeys, didMutate);\n };\n}\n","import { SelectEntityId } from './models';\n\nexport function entityConfig<Entity, Collection extends string>(config: {\n entity: Entity;\n collection: Collection;\n selectId: SelectEntityId<NoInfer<Entity>>;\n}): typeof config;\nexport function entityConfig<Entity>(config: {\n entity: Entity;\n selectId: SelectEntityId<NoInfer<Entity>>;\n}): typeof config;\nexport function entityConfig<Entity, Collection extends string>(config: {\n entity: Entity;\n collection: Collection;\n}): typeof config;\nexport function entityConfig<Entity>(config: { entity: Entity }): typeof config;\nexport function entityConfig<Entity>(config: {\n entity: Entity;\n collection?: string;\n selectId?: SelectEntityId<Entity>;\n}): typeof config {\n return config;\n}\n","import { computed, Signal } from '@angular/core';\nimport {\n SignalStoreFeature,\n signalStoreFeature,\n withComputed,\n withState,\n} from '@ngrx/signals';\nimport {\n EntityComputed,\n EntityId,\n EntityMap,\n EntityState,\n NamedEntityComputed,\n NamedEntityState,\n} from './models';\nimport { getEntityStateKeys } from './helpers';\n\nexport function withEntities<Entity>(): SignalStoreFeature<\n { state: {}; computed: {}; methods: {} },\n {\n state: EntityState<Entity>;\n computed: EntityComputed<Entity>;\n methods: {};\n }\n>;\nexport function withEntities<Entity, Collection extends string>(config: {\n entity: Entity;\n collection: Collection;\n}): SignalStoreFeature<\n { state: {}; computed: {}; methods: {} },\n {\n state: NamedEntityState<Entity, Collection>;\n computed: NamedEntityComputed<Entity, Collection>;\n methods: {};\n }\n>;\nexport function withEntities<Entity>(config: {\n entity: Entity;\n}): SignalStoreFeature<\n { state: {}; computed: {}; methods: {} },\n {\n state: EntityState<Entity>;\n computed: EntityComputed<Entity>;\n methods: {};\n }\n>;\nexport function withEntities<Entity>(config?: {\n entity: Entity;\n collection?: string;\n}): SignalStoreFeature {\n const { entityMapKey, idsKey, entitiesKey } = getEntityStateKeys(config);\n\n return signalStoreFeature(\n withState({\n [entityMapKey]: {},\n [idsKey]: [],\n }),\n withComputed((store: Record<string, Signal<unknown>>) => ({\n [entitiesKey]: computed(() => {\n const entityMap = store[entityMapKey]() as EntityMap<Entity>;\n const ids = store[idsKey]() as EntityId[];\n\n return ids.map((id) => entityMap[id]);\n }),\n }))\n );\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;AA+BA,IAAY,SAIX,CAAA;AAJD,CAAA,UAAY,SAAS,EAAA;AACnB,IAAA,SAAA,CAAA,SAAA,CAAA,MAAA,CAAA,GAAA,CAAA,CAAA,GAAA,MAAI,CAAA;AACJ,IAAA,SAAA,CAAA,SAAA,CAAA,UAAA,CAAA,GAAA,CAAA,CAAA,GAAA,UAAQ,CAAA;AACR,IAAA,SAAA,CAAA,SAAA,CAAA,MAAA,CAAA,GAAA,CAAA,CAAA,GAAA,MAAI,CAAA;AACN,CAAC,EAJW,SAAS,KAAT,SAAS,GAIpB,EAAA,CAAA,CAAA;;ACzBD,MAAM,eAAe,GAAqC,CAAC,MAAM,KAAK,MAAM,CAAC,EAAE,CAAC;AAE1E,SAAU,mBAAmB,CAAC,MAEnC,EAAA;AACC,IAAA,OAAO,MAAM,EAAE,QAAQ,IAAI,eAAe,CAAC;AAC7C,CAAC;AAEK,SAAU,kBAAkB,CAAC,MAAgC,EAAA;AAKjE,IAAA,MAAM,UAAU,GAAG,MAAM,EAAE,UAAU,CAAC;AACtC,IAAA,MAAM,YAAY,GAChB,UAAU,KAAK,SAAS,GAAG,WAAW,GAAG,CAAG,EAAA,UAAU,WAAW,CAAC;AACpE,IAAA,MAAM,MAAM,GAAG,UAAU,KAAK,SAAS,GAAG,KAAK,GAAG,CAAG,EAAA,UAAU,KAAK,CAAC;AACrE,IAAA,MAAM,WAAW,GACf,UAAU,KAAK,SAAS,GAAG,UAAU,GAAG,CAAG,EAAA,UAAU,UAAU,CAAC;AAElE,IAAA,OAAO,EAAE,YAAY,EAAE,M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C,IAAA,OAAO,MAAM,CAAC;AAChB;;ACwBM,SAAU,YAAY,CAAS,MAGpC,EAAA;AACC,IAAA,MAAM,EAAE,YAAY,EAAE,MAAM,EAAE,WAAW,EAAE,GAAG,kBAAkB,CAAC,MAAM,CAAC,CAAC;IAEzE,OAAO,kBAAkB,CACvB,SAAS,CAAC;QACR,CAAC,YAAY,GAAG,EAAE;QAClB,CAAC,MAAM,GAAG,EAAE;KACb,CAAC,EACF,YAAY,CAAC,CAAC,KAAsC,MAAM;AACxD,QAAA,CAAC,WAAW,GAAG,QAAQ,CAAC,MAAK;AAC3B,YAAA,MAAM,SAAS,GAAG,KAAK,CAAC,YAAY,CAAC,EAAuB,CAAC;AAC7D,YAAA,MAAM,GAAG,GAAG,KAAK,CAAC,MAAM,CAAC,EAAgB,CAAC;AAE1C,YAAA,OAAO,GAAG,CAAC,GAAG,CAAC,CAAC,EAAE,KAAK,SAAS,CAAC,EAAE,CAAC,CAAC,CAAC;AACxC,SAAC,CAAC;KACH,CAAC,CAAC,CACJ,CAAC;AACJ;;AClEA;;AAEG;;;;"}
@@ -56,8 +56,8 @@ function signalStore(...args) {
56
56
  class SignalStore {
57
57
  constructor() {
58
58
  const innerStore = features.reduce((store, feature) => feature(store), getInitialInnerStore());
59
- const { slices, signals, methods, hooks } = innerStore;
60
- const props = { ...slices, ...signals, ...methods };
59
+ const { stateSignals, computedSignals, methods, hooks } = innerStore;
60
+ const props = { ...stateSignals, ...computedSignals, ...methods };
61
61
  this[STATE_SIGNAL] = innerStore[STATE_SIGNAL];
62
62
  for (const key in props) {
63
63
  this[key] = props[key];
@@ -82,8 +82,8 @@ function signalStore(...args) {
82
82
  function getInitialInnerStore() {
83
83
  return {
84
84
  [STATE_SIGNAL]: signal({}),
85
- slices: {},
86
- signals: {},
85
+ stateSignals: {},
86
+ computedSignals: {},
87
87
  methods: {},
88
88
  hooks: {},
89
89
  };
@@ -110,14 +110,17 @@ function excludeKeys(obj, keys) {
110
110
 
111
111
  function withComputed(signalsFactory) {
112
112
  return (store) => {
113
- const signals = signalsFactory({ ...store.slices, ...store.signals });
114
- const signalsKeys = Object.keys(signals);
115
- const slices = excludeKeys(store.slices, signalsKeys);
116
- const methods = excludeKeys(store.methods, signalsKeys);
113
+ const computedSignals = signalsFactory({
114
+ ...store.stateSignals,
115
+ ...store.computedSignals,
116
+ });
117
+ const computedSignalsKeys = Object.keys(computedSignals);
118
+ const stateSignals = excludeKeys(store.stateSignals, computedSignalsKeys);
119
+ const methods = excludeKeys(store.methods, computedSignalsKeys);
117
120
  return {
118
121
  ...store,
119
- slices,
120
- signals: { ...store.signals, ...signals },
122
+ stateSignals,
123
+ computedSignals: { ...store.computedSignals, ...computedSignals },
121
124
  methods,
122
125
  };
123
126
  };
@@ -127,8 +130,8 @@ function withHooks(hooksOrFactory) {
127
130
  return (store) => {
128
131
  const storeProps = {
129
132
  [STATE_SIGNAL]: store[STATE_SIGNAL],
130
- ...store.slices,
131
- ...store.signals,
133
+ ...store.stateSignals,
134
+ ...store.computedSignals,
132
135
  ...store.methods,
133
136
  };
134
137
  const hooks = typeof hooksOrFactory === 'function'
@@ -160,17 +163,17 @@ function withMethods(methodsFactory) {
160
163
  return (store) => {
161
164
  const methods = methodsFactory({
162
165
  [STATE_SIGNAL]: store[STATE_SIGNAL],
163
- ...store.slices,
164
- ...store.signals,
166
+ ...store.stateSignals,
167
+ ...store.computedSignals,
165
168
  ...store.methods,
166
169
  });
167
170
  const methodsKeys = Object.keys(methods);
168
- const slices = excludeKeys(store.slices, methodsKeys);
169
- const signals = excludeKeys(store.signals, methodsKeys);
171
+ const stateSignals = excludeKeys(store.stateSignals, methodsKeys);
172
+ const computedSignals = excludeKeys(store.computedSignals, methodsKeys);
170
173
  return {
171
174
  ...store,
172
- slices,
173
- signals,
175
+ stateSignals,
176
+ computedSignals,
174
177
  methods: { ...store.methods, ...methods },
175
178
  };
176
179
  };
@@ -184,16 +187,16 @@ function withState(stateOrFactory) {
184
187
  ...currentState,
185
188
  ...state,
186
189
  }));
187
- const slices = stateKeys.reduce((acc, key) => {
188
- const slice = computed(() => store[STATE_SIGNAL]()[key]);
189
- return { ...acc, [key]: toDeepSignal(slice) };
190
+ const stateSignals = stateKeys.reduce((acc, key) => {
191
+ const sliceSignal = computed(() => store[STATE_SIGNAL]()[key]);
192
+ return { ...acc, [key]: toDeepSignal(sliceSignal) };
190
193
  }, {});
191
- const signals = excludeKeys(store.signals, stateKeys);
194
+ const computedSignals = excludeKeys(store.computedSignals, stateKeys);
192
195
  const methods = excludeKeys(store.methods, stateKeys);
193
196
  return {
194
197
  ...store,
195
- slices: { ...store.slices, ...slices },
196
- signals,
198
+ stateSignals: { ...store.stateSignals, ...stateSignals },
199
+ computedSignals,
197
200
  methods,
198
201
  };
199
202
  };