UNPKG

@ngrx/signals

Version:

Reactive Store and Set of Utilities for Angular Signals

1 lines 47.3 kB
{"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/prepend-entity.ts","../../../../modules/signals/entities/src/updaters/prepend-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/updaters/upsert-entity.ts","../../../../modules/signals/entities/src/updaters/upsert-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 EntityProps<Entity> = {\n entities: Signal<Entity[]>;\n};\n\nexport type NamedEntityProps<Entity, Collection extends string> = {\n [K in keyof EntityProps<Entity> as `${Collection}${Capitalize<K>}`]: EntityProps<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 prepend = false\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\n if (prepend) {\n state.ids.unshift(id);\n } else {\n state.ids.push(id);\n }\n\n return DidMutate.Both;\n}\n\nexport function addEntitiesMutably(\n state: EntityState<any>,\n entities: any[],\n selectId: SelectEntityId<any>,\n prepend = false\n): DidMutate {\n let didMutate = DidMutate.None;\n\n for (const entity of entities) {\n const result = addEntityMutably(state, entity, selectId, prepend);\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 replace = true\n): DidMutate {\n const id = selectId(entity);\n\n if (state.entityMap[id]) {\n state.entityMap[id] = replace\n ? entity\n : { ...state.entityMap[id], ...entity };\n\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 replace = true\n): DidMutate {\n let didMutate = DidMutate.None;\n\n for (const entity of entities) {\n const result = setEntityMutably(state, entity, selectId, replace);\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 (\n typeof ngDevMode !== 'undefined' &&\n ngDevMode &&\n state.ids.length !== Object.keys(state.entityMap).length\n ) {\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 {\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 prependEntity<Entity extends { id: EntityId }>(\n entity: Entity\n): PartialStateUpdater<EntityState<Entity>>;\nexport function prependEntity<Entity, Collection extends string>(\n entity: Entity,\n config: { collection: Collection; selectId: SelectEntityId<NoInfer<Entity>> }\n): PartialStateUpdater<NamedEntityState<Entity, Collection>>;\nexport function prependEntity<\n Entity extends { id: EntityId },\n Collection extends string\n>(\n entity: Entity,\n config: { collection: Collection }\n): PartialStateUpdater<NamedEntityState<Entity, Collection>>;\nexport function prependEntity<Entity>(\n entity: Entity,\n config: { selectId: SelectEntityId<NoInfer<Entity>> }\n): PartialStateUpdater<EntityState<Entity>>;\nexport function prependEntity(\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, true);\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 prependEntities<Entity extends { id: EntityId }>(\n entities: Entity[]\n): PartialStateUpdater<EntityState<Entity>>;\nexport function prependEntities<Entity, Collection extends string>(\n entities: Entity[],\n config: { collection: Collection; selectId: SelectEntityId<NoInfer<Entity>> }\n): PartialStateUpdater<NamedEntityState<Entity, Collection>>;\nexport function prependEntities<\n Entity extends { id: EntityId },\n Collection extends string\n>(\n entities: Entity[],\n config: { collection: Collection }\n): PartialStateUpdater<NamedEntityState<Entity, Collection>>;\nexport function prependEntities<Entity>(\n entities: Entity[],\n config: { selectId: SelectEntityId<NoInfer<Entity>> }\n): PartialStateUpdater<EntityState<Entity>>;\nexport function prependEntities(\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\n const uniqueEntities: any[] = [];\n const seenIds = new Set<EntityId>();\n\n for (const entity of entities) {\n const id = selectId(entity);\n\n if (!seenIds.has(id)) {\n uniqueEntities.unshift(entity);\n seenIds.add(id);\n }\n }\n\n const didMutate = addEntitiesMutably(\n clonedState,\n uniqueEntities,\n selectId,\n true\n );\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 { 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 upsertEntity<Entity extends { id: EntityId }>(\n entity: Entity\n): PartialStateUpdater<EntityState<Entity>>;\nexport function upsertEntity<Entity, Collection extends string>(\n entity: Entity,\n config: { collection: Collection; selectId: SelectEntityId<NoInfer<Entity>> }\n): PartialStateUpdater<NamedEntityState<Entity, Collection>>;\nexport function upsertEntity<\n Entity extends { id: EntityId },\n Collection extends string\n>(\n entity: Entity,\n config: { collection: Collection }\n): PartialStateUpdater<NamedEntityState<Entity, Collection>>;\nexport function upsertEntity<Entity>(\n entity: Entity,\n config: { selectId: SelectEntityId<NoInfer<Entity>> }\n): PartialStateUpdater<EntityState<Entity>>;\nexport function upsertEntity(\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, false);\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 upsertEntities<Entity extends { id: EntityId }>(\n entities: Entity[]\n): PartialStateUpdater<EntityState<Entity>>;\nexport function upsertEntities<Entity, Collection extends string>(\n entities: Entity[],\n config: { collection: Collection; selectId: SelectEntityId<NoInfer<Entity>> }\n): PartialStateUpdater<NamedEntityState<Entity, Collection>>;\nexport function upsertEntities<\n Entity extends { id: EntityId },\n Collection extends string\n>(\n entities: Entity[],\n config: { collection: Collection }\n): PartialStateUpdater<NamedEntityState<Entity, Collection>>;\nexport function upsertEntities<Entity>(\n entities: Entity[],\n config: { selectId: SelectEntityId<NoInfer<Entity>> }\n): PartialStateUpdater<EntityState<Entity>>;\nexport function upsertEntities(\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(\n clonedState,\n entities,\n selectId,\n false\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 EmptyFeatureResult,\n SignalStoreFeature,\n signalStoreFeature,\n withComputed,\n withState,\n} from '@ngrx/signals';\nimport {\n EntityProps,\n EntityId,\n EntityMap,\n EntityState,\n NamedEntityProps,\n NamedEntityState,\n} from './models';\nimport { getEntityStateKeys } from './helpers';\n\nexport function withEntities<Entity>(): SignalStoreFeature<\n EmptyFeatureResult,\n {\n state: EntityState<Entity>;\n props: EntityProps<Entity>;\n methods: {};\n }\n>;\nexport function withEntities<Entity, Collection extends string>(config: {\n entity: Entity;\n collection: Collection;\n}): SignalStoreFeature<\n EmptyFeatureResult,\n {\n state: NamedEntityState<Entity, Collection>;\n props: NamedEntityProps<Entity, Collection>;\n methods: {};\n }\n>;\nexport function withEntities<Entity>(config: {\n entity: Entity;\n}): SignalStoreFeature<\n EmptyFeatureResult,\n {\n state: EntityState<Entity>;\n props: EntityProps<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;AAJD,CAAA,UAAY,SAAS,EAAA;AACnB,IAAA,SAAA,CAAA,SAAA,CAAA,MAAA,CAAA,GAAA,CAAA,CAAA,GAAA,MAAI;AACJ,IAAA,SAAA,CAAA,SAAA,CAAA,UAAA,CAAA,GAAA,CAAA,CAAA,GAAA,UAAQ;AACR,IAAA,SAAA,CAAA,SAAA,CAAA,MAAA,CAAA,GAAA,CAAA,CAAA,GAAA,MAAI;AACN,CAAC,EAJW,SAAS,KAAT,SAAS,GAAA,EAAA,CAAA,CAAA;;ACrBrB,MAAM,eAAe,GAAqC,CAAC,MAAM,KAAK,MAAM,CAAC,EAAE;AAEzE,SAAU,mBAAmB,CAAC,MAEnC,EAAA;AACC,IAAA,OAAO,MAAM,EAAE,QAAQ,IAAI,eAAe;AAC5C;AAEM,SAAU,kBAAkB,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