{"version":3,"file":"ngrx-signals-testing.mjs","sources":["../../../../modules/signals/testing/src/unprotected.ts","../../../../modules/signals/testing/ngrx-signals-testing.ts"],"sourcesContent":["import {\n  isWritableStateSource,\n  Prettify,\n  StateSource,\n  WritableStateSource,\n} from '@ngrx/signals';\n\ntype UnprotectedSource<Source extends StateSource<object>> =\n  Source extends StateSource<infer State>\n    ? Prettify<\n        Omit<Source, keyof StateSource<State>> & WritableStateSource<State>\n      >\n    : never;\n\n/**\n * @description\n *\n * Allows updating the protected state of a SignalStore for testing purposes.\n *\n * @usageNotes\n *\n * ```ts\n * import { TestBed } from '@angular/core/testing';\n * import {\n *   patchState,\n *   signalStore,\n *   withState,\n *   withComputed,\n * } from '@ngrx/signals';\n * import { unprotected } from '@ngrx/signals/testing';\n *\n * const UserStore = signalStore(\n *   { providedIn: 'root' },\n *   withState({ firstName: 'Eric', lastName: 'Clapton' }),\n *   withComputed(({ firstName, lastName }) => ({\n *     fullName: () => `${firstName()} ${lastName()}`,\n *   }))\n * );\n *\n * describe('UserStore', () => {\n *   it('recomputes fullName on firstName changes', () => {\n *     const userStore = TestBed.inject(UserStore);\n *\n *     patchState(unprotected(userStore), { firstName: 'Patrick' });\n *     expect(userStore.fullName()).toBe('Patrick Clapton');\n *   });\n * });\n * ```\n */\nexport function unprotected<Source extends StateSource<object>>(\n  source: Source\n): UnprotectedSource<Source> {\n  if (isWritableStateSource(source)) {\n    return source as UnprotectedSource<Source>;\n  }\n\n  throw new Error('@ngrx/signals: The provided source is not writable.');\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;AAcA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAkCG;AACG,SAAU,WAAW,CACzB,MAAc,EAAA;AAEd,IAAA,IAAI,qBAAqB,CAAC,MAAM,CAAC,EAAE;AACjC,QAAA,OAAO,MAAmC;IAC5C;AAEA,IAAA,MAAM,IAAI,KAAK,CAAC,qDAAqD,CAAC;AACxE;;ACzDA;;AAEG;;;;"}