@angular-architects/ngrx-toolkit 19.0.2 → 19.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/fesm2022/angular-architects-ngrx-toolkit-redux-connector.mjs +3 -3
- package/fesm2022/angular-architects-ngrx-toolkit.mjs +179 -67
- package/fesm2022/angular-architects-ngrx-toolkit.mjs.map +1 -1
- package/index.d.ts +3 -0
- package/lib/devtools/with-devtools.d.ts +0 -1
- package/lib/immutable-state/deep-freeze.d.ts +11 -0
- package/lib/immutable-state/is-dev-mode.d.ts +1 -0
- package/lib/immutable-state/with-immutable-state.d.ts +60 -0
- package/lib/with-conditional.d.ts +50 -0
- package/lib/with-feature-factory.d.ts +26 -0
- package/lib/with-pagination.d.ts +5 -31
- package/package.json +1 -1
|
@@ -42,10 +42,10 @@ class SignalReduxStore {
|
|
|
42
42
|
resultMethod: mapper.resultMethod
|
|
43
43
|
}));
|
|
44
44
|
}
|
|
45
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.
|
|
46
|
-
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.
|
|
45
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.1.4", ngImport: i0, type: SignalReduxStore, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
46
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.1.4", ngImport: i0, type: SignalReduxStore, providedIn: 'root' }); }
|
|
47
47
|
}
|
|
48
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.
|
|
48
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.4", ngImport: i0, type: SignalReduxStore, decorators: [{
|
|
49
49
|
type: Injectable,
|
|
50
50
|
args: [{
|
|
51
51
|
providedIn: 'root'
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { getState, signalStoreFeature, withMethods, withHooks, watchState, patchState as patchState$1, withState, withComputed, withProps } from '@ngrx/signals';
|
|
2
2
|
import * as i0 from '@angular/core';
|
|
3
|
-
import { inject, PLATFORM_ID, Injectable, signal, effect, computed, isSignal, untracked } from '@angular/core';
|
|
3
|
+
import { inject, PLATFORM_ID, Injectable, signal, effect, InjectionToken, computed, isSignal, untracked, isDevMode as isDevMode$1 } from '@angular/core';
|
|
4
4
|
import { isPlatformBrowser, isPlatformServer } from '@angular/common';
|
|
5
5
|
import { Subject } from 'rxjs';
|
|
6
6
|
import { setAllEntities, addEntity, updateEntity, removeEntity } from '@ngrx/signals/entities';
|
|
@@ -106,7 +106,9 @@ class DevtoolsSyncer {
|
|
|
106
106
|
let storeName = name;
|
|
107
107
|
const names = Object.values(this.#stores).map((store) => store.name);
|
|
108
108
|
if (names.includes(storeName)) {
|
|
109
|
-
const { options } = throwIfNull(
|
|
109
|
+
// const { options } = throwIfNull(
|
|
110
|
+
// Object.values(this.#stores).find((store) => store.name === storeName)
|
|
111
|
+
// );
|
|
110
112
|
if (!options.indexNames) {
|
|
111
113
|
throw new Error(`An instance of the store ${storeName} already exists. \
|
|
112
114
|
Enable automatic indexing via withDevTools('${storeName}', { indexNames: true }), or rename it upon instantiation.`);
|
|
@@ -166,10 +168,10 @@ Enable automatic indexing via withDevTools('${storeName}', { indexNames: true })
|
|
|
166
168
|
}, {});
|
|
167
169
|
this.#trackers.forEach((tracker) => tracker.notifyRenamedStore(id));
|
|
168
170
|
}
|
|
169
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.
|
|
170
|
-
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.
|
|
171
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.1.4", ngImport: i0, type: DevtoolsSyncer, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
172
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.1.4", ngImport: i0, type: DevtoolsSyncer, providedIn: 'root' }); }
|
|
171
173
|
}
|
|
172
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.
|
|
174
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.4", ngImport: i0, type: DevtoolsSyncer, decorators: [{
|
|
173
175
|
type: Injectable,
|
|
174
176
|
args: [{ providedIn: 'root' }]
|
|
175
177
|
}], ctorParameters: () => [] });
|
|
@@ -214,17 +216,17 @@ class DefaultTracker {
|
|
|
214
216
|
});
|
|
215
217
|
}
|
|
216
218
|
}
|
|
217
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.
|
|
218
|
-
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.
|
|
219
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.1.4", ngImport: i0, type: DefaultTracker, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
220
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.1.4", ngImport: i0, type: DefaultTracker, providedIn: 'root' }); }
|
|
219
221
|
}
|
|
220
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.
|
|
222
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.4", ngImport: i0, type: DefaultTracker, decorators: [{
|
|
221
223
|
type: Injectable,
|
|
222
224
|
args: [{ providedIn: 'root' }]
|
|
223
225
|
}] });
|
|
224
226
|
|
|
225
|
-
const existingNames = new Map();
|
|
226
227
|
const renameDevtoolsMethodName = '___renameDevtoolsName';
|
|
227
228
|
const uniqueDevtoolsId = '___uniqueDevtoolsId';
|
|
229
|
+
const EXISTING_NAMES = new InjectionToken('Array contain existing names for the signal stores', { factory: () => [], providedIn: 'root' });
|
|
228
230
|
/**
|
|
229
231
|
* Adds this store as a feature state to the Redux DevTools.
|
|
230
232
|
*
|
|
@@ -239,10 +241,6 @@ const uniqueDevtoolsId = '___uniqueDevtoolsId';
|
|
|
239
241
|
* @param features features to extend or modify the behavior of the Devtools
|
|
240
242
|
*/
|
|
241
243
|
function withDevtools(name, ...features) {
|
|
242
|
-
if (existingNames.has(name)) {
|
|
243
|
-
throw new Error(`The store "${name}" has already been registered in the DevTools. Duplicate registration is not allowed.`);
|
|
244
|
-
}
|
|
245
|
-
existingNames.set(name, true);
|
|
246
244
|
return signalStoreFeature(withMethods(() => {
|
|
247
245
|
const syncer = inject(DevtoolsSyncer);
|
|
248
246
|
const id = syncer.getNextId();
|
|
@@ -382,10 +380,10 @@ class GlitchTrackerService {
|
|
|
382
380
|
this.#callback({ [id]: getState(this.#stores[id].store) });
|
|
383
381
|
}
|
|
384
382
|
}
|
|
385
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.
|
|
386
|
-
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.
|
|
383
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.1.4", ngImport: i0, type: GlitchTrackerService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
384
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.1.4", ngImport: i0, type: GlitchTrackerService, providedIn: 'root' }); }
|
|
387
385
|
}
|
|
388
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.
|
|
386
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.4", ngImport: i0, type: GlitchTrackerService, decorators: [{
|
|
389
387
|
type: Injectable,
|
|
390
388
|
args: [{ providedIn: 'root' }]
|
|
391
389
|
}] });
|
|
@@ -645,7 +643,7 @@ function withRedux(redux) {
|
|
|
645
643
|
const { methods } = processRedux(redux.actions, redux.reducer, redux.effects, store);
|
|
646
644
|
return {
|
|
647
645
|
...store,
|
|
648
|
-
methods,
|
|
646
|
+
methods: { ...store.methods, ...methods },
|
|
649
647
|
};
|
|
650
648
|
};
|
|
651
649
|
}
|
|
@@ -1087,7 +1085,7 @@ function withStorageSync(configOrKey) {
|
|
|
1087
1085
|
* This feature implements the local pagination.
|
|
1088
1086
|
*/
|
|
1089
1087
|
function withPagination(options) {
|
|
1090
|
-
const { pageKey, pageSizeKey, entitiesKey, selectedPageEntitiesKey, totalCountKey, pageCountKey, pageNavigationArrayMaxKey, pageNavigationArrayKey,
|
|
1088
|
+
const { pageKey, pageSizeKey, entitiesKey, selectedPageEntitiesKey, totalCountKey, pageCountKey, pageNavigationArrayMaxKey, pageNavigationArrayKey, hasNextPageKey, hasPreviousPageKey, } = createPaginationKeys(options);
|
|
1091
1089
|
return signalStoreFeature(withState({
|
|
1092
1090
|
[pageKey]: 0,
|
|
1093
1091
|
[pageSizeKey]: 10,
|
|
@@ -1121,30 +1119,6 @@ function withPagination(options) {
|
|
|
1121
1119
|
return page() > 1;
|
|
1122
1120
|
}),
|
|
1123
1121
|
};
|
|
1124
|
-
}), withMethods((store) => {
|
|
1125
|
-
return {
|
|
1126
|
-
[setPageSizeKey]: (size) => {
|
|
1127
|
-
patchState$1(store, setPageSize(size, options));
|
|
1128
|
-
},
|
|
1129
|
-
[nextPageKey]: () => {
|
|
1130
|
-
patchState$1(store, nextPage(options));
|
|
1131
|
-
},
|
|
1132
|
-
[previousPageKey]: () => {
|
|
1133
|
-
patchState$1(store, previousPage(options));
|
|
1134
|
-
},
|
|
1135
|
-
[lastPageKey]: () => {
|
|
1136
|
-
const lastPage = store[pageCountKey]();
|
|
1137
|
-
if (lastPage === 0)
|
|
1138
|
-
return;
|
|
1139
|
-
patchState$1(store, gotoPage(lastPage - 1, options));
|
|
1140
|
-
},
|
|
1141
|
-
[firstPageKey]: () => {
|
|
1142
|
-
patchState$1(store, firstPage());
|
|
1143
|
-
},
|
|
1144
|
-
[gotoPageKey]: (page) => {
|
|
1145
|
-
patchState$1(store, gotoPage(page, options));
|
|
1146
|
-
},
|
|
1147
|
-
};
|
|
1148
1122
|
}));
|
|
1149
1123
|
}
|
|
1150
1124
|
function gotoPage(page, options) {
|
|
@@ -1208,24 +1182,6 @@ function createPaginationKeys(options) {
|
|
|
1208
1182
|
const pageNavigationArrayKey = options?.collection
|
|
1209
1183
|
? `${options.collection}PageNavigationArray`
|
|
1210
1184
|
: 'pageNavigationArray';
|
|
1211
|
-
const setPageSizeKey = options?.collection
|
|
1212
|
-
? `set${capitalize(options.collection)}PageSize`
|
|
1213
|
-
: 'setPageSize';
|
|
1214
|
-
const nextPageKey = options?.collection
|
|
1215
|
-
? `next${capitalize(options.collection)}Page`
|
|
1216
|
-
: 'nextPage';
|
|
1217
|
-
const previousPageKey = options?.collection
|
|
1218
|
-
? `previous${capitalize(options.collection)}Page`
|
|
1219
|
-
: 'previousPage';
|
|
1220
|
-
const lastPageKey = options?.collection
|
|
1221
|
-
? `last${capitalize(options.collection)}Page`
|
|
1222
|
-
: 'lastPage';
|
|
1223
|
-
const firstPageKey = options?.collection
|
|
1224
|
-
? `first${capitalize(options.collection)}Page`
|
|
1225
|
-
: 'firstPage';
|
|
1226
|
-
const gotoPageKey = options?.collection
|
|
1227
|
-
? `goto${capitalize(options.collection)}Page`
|
|
1228
|
-
: 'gotoPage';
|
|
1229
1185
|
const hasNextPageKey = options?.collection
|
|
1230
1186
|
? `hasNext${capitalize(options.collection)}Page`
|
|
1231
1187
|
: 'hasNextPage';
|
|
@@ -1241,12 +1197,6 @@ function createPaginationKeys(options) {
|
|
|
1241
1197
|
pageCountKey,
|
|
1242
1198
|
pageNavigationArrayKey,
|
|
1243
1199
|
pageNavigationArrayMaxKey,
|
|
1244
|
-
setPageSizeKey,
|
|
1245
|
-
nextPageKey,
|
|
1246
|
-
previousPageKey,
|
|
1247
|
-
lastPageKey,
|
|
1248
|
-
firstPageKey,
|
|
1249
|
-
gotoPageKey,
|
|
1250
1200
|
hasNextPageKey,
|
|
1251
1201
|
hasPreviousPageKey,
|
|
1252
1202
|
};
|
|
@@ -1323,9 +1273,171 @@ function setResetState(store, state) {
|
|
|
1323
1273
|
store.__setResetState__(state);
|
|
1324
1274
|
}
|
|
1325
1275
|
|
|
1276
|
+
/**
|
|
1277
|
+
* Deep freezes a state object along its properties with primitive values
|
|
1278
|
+
* on the first level.
|
|
1279
|
+
*
|
|
1280
|
+
* The reason for this is that the final state is a merge of all
|
|
1281
|
+
* root properties of all states, i.e. `withState`,....
|
|
1282
|
+
*
|
|
1283
|
+
* Since the root object will not be part of the state (shadow clone),
|
|
1284
|
+
* we are not freezing it.
|
|
1285
|
+
*/
|
|
1286
|
+
function deepFreeze(target,
|
|
1287
|
+
// if empty all properties will be frozen
|
|
1288
|
+
propertyNamesToBeFrozen,
|
|
1289
|
+
// also means that we are on the first level
|
|
1290
|
+
isRoot = true) {
|
|
1291
|
+
const runPropertyNameCheck = propertyNamesToBeFrozen.length > 0;
|
|
1292
|
+
for (const key of Reflect.ownKeys(target)) {
|
|
1293
|
+
if (runPropertyNameCheck && !propertyNamesToBeFrozen.includes(key)) {
|
|
1294
|
+
continue;
|
|
1295
|
+
}
|
|
1296
|
+
const propValue = target[key];
|
|
1297
|
+
if (isRecordLike(propValue) && !Object.isFrozen(propValue)) {
|
|
1298
|
+
Object.freeze(propValue);
|
|
1299
|
+
deepFreeze(propValue, [], false);
|
|
1300
|
+
}
|
|
1301
|
+
else if (isRoot) {
|
|
1302
|
+
Object.defineProperty(target, key, {
|
|
1303
|
+
value: propValue,
|
|
1304
|
+
writable: false,
|
|
1305
|
+
configurable: false,
|
|
1306
|
+
});
|
|
1307
|
+
}
|
|
1308
|
+
}
|
|
1309
|
+
}
|
|
1310
|
+
function isRecordLike(target) {
|
|
1311
|
+
return typeof target === 'object' && target !== null;
|
|
1312
|
+
}
|
|
1313
|
+
|
|
1314
|
+
// necessary wrapper function to test prod mode
|
|
1315
|
+
function isDevMode() {
|
|
1316
|
+
return isDevMode$1();
|
|
1317
|
+
}
|
|
1318
|
+
|
|
1319
|
+
function withImmutableState(stateOrFactory, options) {
|
|
1320
|
+
const immutableState = typeof stateOrFactory === 'function' ? stateOrFactory() : stateOrFactory;
|
|
1321
|
+
const stateKeys = Reflect.ownKeys(immutableState);
|
|
1322
|
+
const applyFreezing = isDevMode() || options?.enableInProduction === true;
|
|
1323
|
+
return signalStoreFeature(withState(immutableState), withHooks((store) => ({
|
|
1324
|
+
onInit() {
|
|
1325
|
+
if (!applyFreezing) {
|
|
1326
|
+
return;
|
|
1327
|
+
}
|
|
1328
|
+
/**
|
|
1329
|
+
* `immutableState` will be initially frozen. That is because
|
|
1330
|
+
* of potential mutations outside the SignalStore
|
|
1331
|
+
*
|
|
1332
|
+
* ```ts
|
|
1333
|
+
* const initialState = {id: 1};
|
|
1334
|
+
* signalStore(withImmutableState(initialState));
|
|
1335
|
+
*
|
|
1336
|
+
* initialState.id = 2; // must throw immutability
|
|
1337
|
+
* ```
|
|
1338
|
+
*/
|
|
1339
|
+
Object.freeze(immutableState);
|
|
1340
|
+
watchState(store, (state) => {
|
|
1341
|
+
deepFreeze(state, stateKeys);
|
|
1342
|
+
});
|
|
1343
|
+
},
|
|
1344
|
+
})));
|
|
1345
|
+
}
|
|
1346
|
+
|
|
1347
|
+
/**
|
|
1348
|
+
* Allows to pass properties, methods, or signals from a SignalStore
|
|
1349
|
+
* to a feature.
|
|
1350
|
+
*
|
|
1351
|
+
* Typically, a `signalStoreFeature` can have input constraints on
|
|
1352
|
+
*
|
|
1353
|
+
* ```typescript
|
|
1354
|
+
* function withSum(a: Signal<number>, b: Signal<number>) {
|
|
1355
|
+
* return signalStoreFeature(
|
|
1356
|
+
* withComputed(() => ({
|
|
1357
|
+
* sum: computed(() => a() + b())
|
|
1358
|
+
* }))
|
|
1359
|
+
* );
|
|
1360
|
+
* }
|
|
1361
|
+
*
|
|
1362
|
+
* signalStore(
|
|
1363
|
+
* withState({ a: 1, b: 2 }),
|
|
1364
|
+
* withFeatureFactory((store) => withSum(store.a, store.b))
|
|
1365
|
+
* );
|
|
1366
|
+
* ```
|
|
1367
|
+
* @param factoryFn
|
|
1368
|
+
*/
|
|
1369
|
+
function withFeatureFactory(factoryFn) {
|
|
1370
|
+
return (store) => {
|
|
1371
|
+
const storeForFactory = {
|
|
1372
|
+
...store['stateSignals'],
|
|
1373
|
+
...store['props'],
|
|
1374
|
+
...store['methods'],
|
|
1375
|
+
};
|
|
1376
|
+
const feature = factoryFn(storeForFactory);
|
|
1377
|
+
return feature(store);
|
|
1378
|
+
};
|
|
1379
|
+
}
|
|
1380
|
+
|
|
1381
|
+
/**
|
|
1382
|
+
* `withConditional` activates a feature based on a given condition.
|
|
1383
|
+
*
|
|
1384
|
+
* **Use Cases**
|
|
1385
|
+
* - Conditionally activate features based on the **store state** or other criteria.
|
|
1386
|
+
* - Choose between **two different implementations** of a feature.
|
|
1387
|
+
*
|
|
1388
|
+
* **Type Constraints**
|
|
1389
|
+
* Both features must have **exactly the same state, props, and methods**.
|
|
1390
|
+
* Otherwise, a type error will occur.
|
|
1391
|
+
*
|
|
1392
|
+
*
|
|
1393
|
+
* **Usage**
|
|
1394
|
+
*
|
|
1395
|
+
* ```typescript
|
|
1396
|
+
* const withUser = signalStoreFeature(
|
|
1397
|
+
* withState({ id: 1, name: 'Konrad' }),
|
|
1398
|
+
* withHooks(store => ({
|
|
1399
|
+
* onInit() {
|
|
1400
|
+
* // user loading logic
|
|
1401
|
+
* }
|
|
1402
|
+
* }))
|
|
1403
|
+
* );
|
|
1404
|
+
*
|
|
1405
|
+
* function withFakeUser() {
|
|
1406
|
+
* return signalStoreFeature(
|
|
1407
|
+
* withState({ id: 0, name: 'anonymous' })
|
|
1408
|
+
* );
|
|
1409
|
+
* }
|
|
1410
|
+
*
|
|
1411
|
+
* signalStore(
|
|
1412
|
+
* withMethods(() => ({
|
|
1413
|
+
* useRealUser: () => true
|
|
1414
|
+
* })),
|
|
1415
|
+
* withConditional((store) => store.useRealUser(), withUser, withFakeUser)
|
|
1416
|
+
* )
|
|
1417
|
+
* ```
|
|
1418
|
+
*
|
|
1419
|
+
* @param condition - A function that determines which feature to activate based on the store state.
|
|
1420
|
+
* @param featureIfTrue - The feature to activate if the condition evaluates to `true`.
|
|
1421
|
+
* @param featureIfFalse - The feature to activate if the condition evaluates to `false`.
|
|
1422
|
+
* @returns A `SignalStoreFeature` that applies the selected feature based on the condition.
|
|
1423
|
+
*/
|
|
1424
|
+
function withConditional(condition, featureIfTrue, featureIfFalse) {
|
|
1425
|
+
return (store) => {
|
|
1426
|
+
const conditionStore = {
|
|
1427
|
+
...store['stateSignals'],
|
|
1428
|
+
...store['props'],
|
|
1429
|
+
...store['methods'],
|
|
1430
|
+
};
|
|
1431
|
+
return condition(conditionStore)
|
|
1432
|
+
? featureIfTrue(store)
|
|
1433
|
+
: featureIfFalse(store);
|
|
1434
|
+
};
|
|
1435
|
+
}
|
|
1436
|
+
const emptyFeature = signalStoreFeature(withState({}));
|
|
1437
|
+
|
|
1326
1438
|
/**
|
|
1327
1439
|
* Generated bundle index. Do not edit.
|
|
1328
1440
|
*/
|
|
1329
1441
|
|
|
1330
|
-
export { capitalize, createEffects, createPageArray, createReducer, firstPage, getCallStateKeys, getDataServiceKeys, getUndoRedoKeys, gotoPage, nextPage, noPayload, patchState, payload, previousPage, renameDevtoolsName, setError, setLoaded, setLoading, setMaxPageNavigationArrayItems, setPageSize, setResetState, updateState, withCallState, withDataService, withDevToolsStub, withDevtools, withDisabledNameIndices, withGlitchTracking, withMapper, withPagination, withRedux, withReset, withStorageSync, withUndoRedo };
|
|
1442
|
+
export { capitalize, createEffects, createPageArray, createReducer, emptyFeature, firstPage, getCallStateKeys, getDataServiceKeys, getUndoRedoKeys, gotoPage, nextPage, noPayload, patchState, payload, previousPage, renameDevtoolsName, setError, setLoaded, setLoading, setMaxPageNavigationArrayItems, setPageSize, setResetState, updateState, withCallState, withConditional, withDataService, withDevToolsStub, withDevtools, withDisabledNameIndices, withFeatureFactory, withGlitchTracking, withImmutableState, withMapper, withPagination, withRedux, withReset, withStorageSync, withUndoRedo };
|
|
1331
1443
|
//# sourceMappingURL=angular-architects-ngrx-toolkit.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"angular-architects-ngrx-toolkit.mjs","sources":["../../../../libs/ngrx-toolkit/src/lib/devtools/with-dev-tools-stub.ts","../../../../libs/ngrx-toolkit/src/lib/devtools/internal/current-action-names.ts","../../../../libs/ngrx-toolkit/src/lib/shared/throw-if-null.ts","../../../../libs/ngrx-toolkit/src/lib/devtools/internal/devtools-syncer.service.ts","../../../../libs/ngrx-toolkit/src/lib/devtools/internal/default-tracker.ts","../../../../libs/ngrx-toolkit/src/lib/devtools/with-devtools.ts","../../../../libs/ngrx-toolkit/src/lib/devtools/internal/devtools-feature.ts","../../../../libs/ngrx-toolkit/src/lib/devtools/features/with-disabled-name-indicies.ts","../../../../libs/ngrx-toolkit/src/lib/devtools/features/with-mapper.ts","../../../../libs/ngrx-toolkit/src/lib/devtools/internal/glitch-tracker.service.ts","../../../../libs/ngrx-toolkit/src/lib/devtools/features/with-glitch-tracking.ts","../../../../libs/ngrx-toolkit/src/lib/devtools/update-state.ts","../../../../libs/ngrx-toolkit/src/lib/devtools/rename-devtools-name.ts","../../../../libs/ngrx-toolkit/src/lib/assertions/assertions.ts","../../../../libs/ngrx-toolkit/src/lib/with-redux.ts","../../../../libs/ngrx-toolkit/src/lib/with-call-state.ts","../../../../libs/ngrx-toolkit/src/lib/with-data-service.ts","../../../../libs/ngrx-toolkit/src/lib/with-undo-redo.ts","../../../../libs/ngrx-toolkit/src/lib/with-storage-sync.ts","../../../../libs/ngrx-toolkit/src/lib/with-pagination.ts","../../../../libs/ngrx-toolkit/src/lib/with-reset.ts","../../../../libs/ngrx-toolkit/src/angular-architects-ngrx-toolkit.ts"],"sourcesContent":["import { withDevtools } from './with-devtools';\n\n/**\n * Stub for DevTools integration. Can be used to disable DevTools in production.\n */\nexport const withDevToolsStub: typeof withDevtools = () => (store) => store;\n","export const currentActionNames = new Set<string>();\n","export function throwIfNull<T>(obj: T): NonNullable<T> {\n if (obj === null || obj === undefined) {\n throw new Error('');\n }\n\n return obj;\n}\n","import { inject, Injectable, OnDestroy, PLATFORM_ID } from '@angular/core';\nimport { currentActionNames } from './current-action-names';\nimport { isPlatformBrowser } from '@angular/common';\nimport { StateSource } from '@ngrx/signals';\nimport { DevtoolsInnerOptions } from './devtools-feature';\nimport { throwIfNull } from '../../shared/throw-if-null';\nimport { Connection, StoreRegistry, Tracker } from './models';\n\nconst dummyConnection: Connection = {\n send: () => void true,\n};\n\n/**\n * A service provided by the root injector is\n * required because the synchronization runs\n * globally.\n *\n * The SignalStore could be provided in a component.\n * If the effect starts in the injection\n * context of the SignalStore, the complete sync\n * process would shut down once the component gets\n * destroyed.\n */\n@Injectable({ providedIn: 'root' })\nexport class DevtoolsSyncer implements OnDestroy {\n /**\n * Stores all SignalStores that are connected to the\n * DevTools along their options, names and id.\n */\n #stores: StoreRegistry = {};\n readonly #isBrowser = isPlatformBrowser(inject(PLATFORM_ID));\n readonly #trackers = [] as Tracker[];\n\n /**\n * Maintains the current states of all stores to avoid conflicts\n * between glitch-free and glitched trackers when used simultaneously.\n *\n * The challenge lies in ensuring that glitched trackers do not\n * interfere with the synchronization process of glitch-free trackers.\n * Specifically, glitched trackers could cause the synchronization to\n * read the current state of stores managed by glitch-free trackers.\n *\n * Therefore, the synchronization process doesn't read the state from\n * each store, but relies on #currentState.\n *\n * Please note, that here the key is the name and not the id.\n */\n #currentState: Record<string, object> = {};\n #currentId = 1;\n\n readonly #connection: Connection = this.#isBrowser\n ? window.__REDUX_DEVTOOLS_EXTENSION__\n ? window.__REDUX_DEVTOOLS_EXTENSION__.connect({\n name: 'NgRx SignalStore',\n })\n : dummyConnection\n : dummyConnection;\n\n constructor() {\n if (!this.#isBrowser) {\n return;\n }\n\n const isToolkitAvailable = Boolean(window.__REDUX_DEVTOOLS_EXTENSION__);\n if (!isToolkitAvailable) {\n console.info(\n 'NgRx Toolkit/DevTools: Redux DevTools Extension is not available.'\n );\n }\n }\n\n ngOnDestroy(): void {\n currentActionNames.clear();\n }\n\n syncToDevTools(changedStatePerId: Record<string, object>) {\n const mappedChangedStatePerName = Object.entries(changedStatePerId).reduce(\n (acc, [id, store]) => {\n const { options, name } = this.#stores[id];\n acc[name] = options.map(store);\n return acc;\n },\n {} as Record<string, object>\n );\n this.#currentState = {\n ...this.#currentState,\n ...mappedChangedStatePerName,\n };\n\n const names = Array.from(currentActionNames);\n const type = names.length ? names.join(', ') : 'Store Update';\n currentActionNames.clear();\n\n this.#connection.send({ type }, this.#currentState);\n }\n\n getNextId() {\n return String(this.#currentId++);\n }\n\n /**\n * Consumer provides the id. That is because we can only start\n * tracking the store in the init hook.\n * Unfortunately, methods for renaming having the final id\n * need to be defined already before.\n * That's why `withDevtools` requests first the id and\n * then registers itself later.\n */\n addStore(\n id: string,\n name: string,\n store: StateSource<object>,\n options: DevtoolsInnerOptions\n ) {\n let storeName = name;\n const names = Object.values(this.#stores).map((store) => store.name);\n\n if (names.includes(storeName)) {\n const { options } = throwIfNull(\n Object.values(this.#stores).find((store) => store.name === storeName)\n );\n if (!options.indexNames) {\n throw new Error(`An instance of the store ${storeName} already exists. \\\nEnable automatic indexing via withDevTools('${storeName}', { indexNames: true }), or rename it upon instantiation.`);\n }\n }\n\n for (let i = 1; names.includes(storeName); i++) {\n storeName = `${name}-${i}`;\n }\n this.#stores[id] = { name: storeName, options };\n\n const tracker = options.tracker;\n if (!this.#trackers.includes(tracker)) {\n this.#trackers.push(tracker);\n }\n\n tracker.onChange((changedState) => this.syncToDevTools(changedState));\n tracker.track(id, store);\n }\n\n removeStore(id: string) {\n const name = this.#stores[id].name;\n this.#stores = Object.entries(this.#stores).reduce(\n (newStore, [storeId, value]) => {\n if (storeId !== id) {\n newStore[storeId] = value;\n }\n return newStore;\n },\n {} as StoreRegistry\n );\n\n this.#currentState = Object.entries(this.#currentState).reduce(\n (newState, [storeName, state]) => {\n if (storeName !== name) {\n newState[name] = state;\n }\n return newState;\n },\n {} as Record<string, object>\n );\n\n for (const tracker of this.#trackers) {\n tracker.removeStore(id);\n }\n }\n\n renameStore(oldName: string, newName: string) {\n const storeNames = Object.values(this.#stores).map((store) => store.name);\n const id = throwIfNull(\n Object.keys(this.#stores).find((id) => this.#stores[id].name === oldName)\n );\n if (storeNames.includes(newName)) {\n throw new Error(\n `NgRx Toolkit/DevTools: cannot rename from ${oldName} to ${newName}. ${newName} is already assigned to another SignalStore instance.`\n );\n }\n\n this.#stores = Object.entries(this.#stores).reduce(\n (newStore, [id, value]) => {\n if (value.name === oldName) {\n newStore[id] = { ...value, name: newName };\n } else {\n newStore[id] = value;\n }\n return newStore;\n },\n {} as StoreRegistry\n );\n\n // we don't rename in #currentState but wait for tracker to notify\n // us with a changed state that contains that name.\n this.#currentState = Object.entries(this.#currentState).reduce(\n (newState, [storeName, state]) => {\n if (storeName !== oldName) {\n newState[storeName] = state;\n }\n return newState;\n },\n {} as Record<string, object>\n );\n\n this.#trackers.forEach((tracker) => tracker.notifyRenamedStore(id));\n }\n}\n","import { effect, Injectable, signal } from '@angular/core';\nimport { getState, StateSource } from '@ngrx/signals';\nimport { Tracker, TrackerStores } from './models';\n\n@Injectable({ providedIn: 'root' })\nexport class DefaultTracker implements Tracker {\n readonly #stores = signal<TrackerStores>({});\n\n get stores(): TrackerStores {\n return this.#stores();\n }\n\n #trackCallback: undefined | ((changedState: Record<string, object>) => void);\n\n #trackingEffect = effect(() => {\n if (this.#trackCallback === undefined) {\n throw new Error('no callback function defined');\n }\n const stores = this.#stores();\n\n const fullState = Object.entries(stores).reduce((acc, [id, store]) => {\n return { ...acc, [id]: getState(store) };\n }, {} as Record<string, object>);\n\n this.#trackCallback(fullState);\n });\n\n track(id: string, store: StateSource<object>): void {\n this.#stores.update((value) => ({\n ...value,\n [id]: store,\n }));\n }\n\n onChange(callback: (changedState: Record<string, object>) => void): void {\n this.#trackCallback = callback;\n }\n\n removeStore(id: string) {\n this.#stores.update((stores) =>\n Object.entries(stores).reduce((newStore, [storeId, state]) => {\n if (storeId !== id) {\n newStore[storeId] = state;\n }\n return newStore;\n }, {} as TrackerStores)\n );\n }\n\n notifyRenamedStore(id: string): void {\n if (this.#stores()[id]) {\n this.#stores.update((stores) => {\n return { ...stores };\n });\n }\n }\n}\n","import { signalStoreFeature, withHooks, withMethods } from '@ngrx/signals';\nimport { inject } from '@angular/core';\nimport { DevtoolsSyncer } from './internal/devtools-syncer.service';\nimport {\n DevtoolsFeature,\n DevtoolsInnerOptions,\n} from './internal/devtools-feature';\nimport { DefaultTracker } from './internal/default-tracker';\nimport { ReduxDevtoolsExtension } from './internal/models';\n\ndeclare global {\n interface Window {\n __REDUX_DEVTOOLS_EXTENSION__: ReduxDevtoolsExtension | undefined;\n }\n}\n\nexport const existingNames = new Map<string, unknown>();\n\nexport const renameDevtoolsMethodName = '___renameDevtoolsName';\nexport const uniqueDevtoolsId = '___uniqueDevtoolsId';\n\n/**\n * Adds this store as a feature state to the Redux DevTools.\n *\n * By default, the action name is 'Store Update'. You can\n * change that via the {@link updateState} method, which has as second\n * parameter the action name.\n *\n * The standalone function {@link renameDevtoolsName} can rename\n * the store name.\n *\n * @param name name of the store as it should appear in the DevTools\n * @param features features to extend or modify the behavior of the Devtools\n */\nexport function withDevtools(name: string, ...features: DevtoolsFeature[]) {\n if (existingNames.has(name)) {\n throw new Error(\n `The store \"${name}\" has already been registered in the DevTools. Duplicate registration is not allowed.`\n );\n }\n existingNames.set(name, true);\n\n return signalStoreFeature(\n withMethods(() => {\n const syncer = inject(DevtoolsSyncer);\n const id = syncer.getNextId();\n\n // TODO: use withProps and symbols\n return {\n [renameDevtoolsMethodName]: (newName: string) => {\n syncer.renameStore(name, newName);\n },\n [uniqueDevtoolsId]: () => id,\n } as Record<string, (newName?: unknown) => unknown>;\n }),\n withHooks((store) => {\n const syncer = inject(DevtoolsSyncer);\n const id = String(store[uniqueDevtoolsId]());\n return {\n onInit() {\n const id = String(store[uniqueDevtoolsId]());\n const finalOptions: DevtoolsInnerOptions = {\n indexNames: !features.some((f) => f.indexNames === false),\n map: features.find((f) => f.map)?.map ?? ((state) => state),\n tracker: inject(\n features.find((f) => f.tracker)?.tracker || DefaultTracker\n ),\n };\n\n syncer.addStore(id, name, store, finalOptions);\n },\n onDestroy() {\n syncer.removeStore(id);\n },\n };\n })\n );\n}\n","import { Tracker } from './models';\n\nexport const DEVTOOLS_FEATURE = Symbol('DEVTOOLS_FEATURE');\n\nexport type Mapper = (state: object) => object;\n\nexport type DevtoolsOptions = {\n indexNames?: boolean; // defines if names should be indexed.\n map?: Mapper; // defines a mapper for the state.\n tracker?: new () => Tracker; // defines a tracker for the state\n};\n\nexport type DevtoolsInnerOptions = {\n indexNames: boolean;\n map: Mapper;\n tracker: Tracker;\n};\n\n/**\n * A DevtoolsFeature adds or modifies the behavior of the\n * devtools extension.\n *\n * We use them (function calls) instead of a config object,\n * because of tree-shaking.\n */\nexport type DevtoolsFeature = {\n [DEVTOOLS_FEATURE]: true;\n} & Partial<DevtoolsOptions>;\n\nexport function createDevtoolsFeature(\n options: DevtoolsOptions\n): DevtoolsFeature {\n return {\n [DEVTOOLS_FEATURE]: true,\n ...options,\n };\n}\n","import { createDevtoolsFeature } from '../internal/devtools-feature';\n\n/**\n * If multiple instances of the same SignalStore class\n * exist, their devtool names are indexed.\n *\n * For example:\n *\n * ```typescript\n * const Store = signalStore(\n * withDevtools('flights')\n * )\n *\n * const store1 = new Store(); // will show up as 'flights'\n * const store2 = new Store(); // will show up as 'flights-1'\n * ```\n *\n * With adding `withDisabledNameIndices` to the store:\n * ```typescript\n * const Store = signalStore(\n * withDevtools('flights', withDisabledNameIndices())\n * )\n *\n * const store1 = new Store(); // will show up as 'flights'\n * const store2 = new Store(); //💥 throws an error\n * ```\n *\n */\nexport function withDisabledNameIndices() {\n return createDevtoolsFeature({ indexNames: false });\n}\n","import { createDevtoolsFeature, Mapper } from '../internal/devtools-feature';\n\n/**\n * Allows you to define a function to map the state.\n *\n * It is needed for huge states, that slows down the Devtools and where\n * you don't need to see the whole state or other reasons.\n *\n * Example:\n *\n * ```typescript\n * const initialState = {\n * id: 1,\n * email: 'john.list@host.com',\n * name: 'John List',\n * enteredPassword: ''\n * }\n *\n * const Store = signalStore(\n * withState(initialState),\n * withDevtools(\n * 'user',\n * withMapper(state => ({...state, enteredPassword: '***' }))\n * )\n * )\n * ```\n *\n * @param map function which maps the state\n */\nexport function withMapper<State extends object>(\n map: (state: State) => Record<string, unknown>\n) {\n return createDevtoolsFeature({ map: map as Mapper });\n}\n","import { Injectable } from '@angular/core';\nimport { Tracker, TrackerStores } from './models';\nimport { getState, StateSource, watchState } from '@ngrx/signals';\nimport { throwIfNull } from '../../shared/throw-if-null';\n\ntype Stores = Record<\n string,\n { destroyWatcher: () => void; store: StateSource<object> }\n>;\n\n/**\n * Internal Service used by {@link withGlitchTracking}. It does not rely\n * on `effect` as {@link DefaultTracker} does but uses the NgRx function\n * `watchState` to track all state changes.\n */\n@Injectable({ providedIn: 'root' })\nexport class GlitchTrackerService implements Tracker {\n #stores: Stores = {};\n #callback: ((changedState: Record<string, object>) => void) | undefined;\n\n get stores() {\n return Object.entries(this.#stores).reduce((acc, [id, { store }]) => {\n acc[id] = store;\n return acc;\n }, {} as TrackerStores);\n }\n\n onChange(callback: (changedState: Record<string, object>) => void): void {\n this.#callback = callback;\n }\n\n removeStore(id: string): void {\n this.#stores = Object.entries(this.#stores).reduce(\n (newStore, [storeId, value]) => {\n if (storeId !== id) {\n newStore[storeId] = value;\n } else {\n value.destroyWatcher();\n }\n return newStore;\n },\n {} as Stores\n );\n\n throwIfNull(this.#callback)({});\n }\n\n track(id: string, store: StateSource<object>): void {\n const watcher = watchState(store, (state) => {\n throwIfNull(this.#callback)({ [id]: state });\n });\n\n this.#stores[id] = { destroyWatcher: watcher.destroy, store };\n }\n\n notifyRenamedStore(id: string): void {\n if (Object.keys(this.#stores).includes(id) && this.#callback) {\n this.#callback({ [id]: getState(this.#stores[id].store) });\n }\n }\n}\n","import { createDevtoolsFeature } from '../internal/devtools-feature';\nimport { GlitchTrackerService } from '../internal/glitch-tracker.service';\n\n/**\n * It tracks all state changes of the State, including intermediary updates\n * that are typically suppressed by Angular's glitch-free mechanism.\n *\n * This feature is especially useful for debugging.\n *\n * Example:\n *\n * ```typescript\n * const Store = signalStore(\n * { providedIn: 'root' },\n * withState({ count: 0 }),\n * withDevtools('counter', withGlitchTracking()),\n * withMethods((store) => ({\n * increase: () =>\n * patchState(store, (value) => ({ count: value.count + 1 })),\n * }))\n * );\n *\n * // would show up in the DevTools with value 0\n * const store = inject(Store);\n *\n * store.increase(); // would show up in the DevTools with value 1\n * store.increase(); // would show up in the DevTools with value 2\n * store.increase(); // would show up in the DevTools with value 3\n * ```\n *\n * Without `withGlitchTracking`, the DevTools would only show the final value of 3.\n */\nexport function withGlitchTracking() {\n return createDevtoolsFeature({ tracker: GlitchTrackerService });\n}\n","import { patchState as originalPatchState } from '@ngrx/signals';\nimport { PartialStateUpdater, WritableStateSource } from '@ngrx/signals';\nimport { Prettify } from '../shared/prettify';\nimport { currentActionNames } from './internal/current-action-names';\n\ntype PatchFn = typeof originalPatchState extends (\n arg1: infer First,\n ...args: infer Rest\n) => infer Returner\n ? (state: First, action: string, ...rest: Rest) => Returner\n : never;\n\n/**\n * @deprecated Has been renamed to `updateState`\n */\nexport const patchState: PatchFn = (state, action, ...rest) => {\n updateState(state, action, ...rest);\n};\n\n/**\n * Wrapper of `patchState` for DevTools integration. Next to updating the state,\n * it also sends the action to the DevTools.\n * @param stateSource state of Signal Store\n * @param action name of action how it will show in DevTools\n * @param updaters updater functions or objects\n */\nexport function updateState<State extends object>(\n stateSource: WritableStateSource<State>,\n action: string,\n ...updaters: Array<\n Partial<Prettify<State>> | PartialStateUpdater<Prettify<State>>\n >\n): void {\n currentActionNames.add(action);\n return originalPatchState(stateSource, ...updaters);\n}\n","import { StateSource } from '@ngrx/signals';\nimport { renameDevtoolsMethodName } from './with-devtools';\n\n/**\n * Renames the name of a store how it appears in the Devtools.\n * @param store instance of the SignalStore\n * @param newName new name for the Devtools\n */\nexport function renameDevtoolsName<State extends object>(\n store: StateSource<State>,\n newName: string\n): void {\n const renameMethod = (store as Record<string, (newName: string) => void>)[\n renameDevtoolsMethodName\n ];\n if (!renameMethod) {\n throw new Error(\"Devtools extensions haven't been added to this store.\");\n }\n\n renameMethod(newName);\n}\n","import { ActionsFnSpecs } from '../with-redux';\n\nexport function assertActionFnSpecs(\n obj: unknown\n): asserts obj is ActionsFnSpecs {\n if (!obj || typeof obj !== 'object') {\n throw new Error('%o is not an Action Specification');\n }\n}\n","import { Observable, Subject } from 'rxjs';\nimport {\n EmptyFeatureResult,\n SignalStoreFeature,\n SignalStoreFeatureResult,\n WritableStateSource,\n} from '@ngrx/signals';\nimport { assertActionFnSpecs } from './assertions/assertions';\n\n/** Actions **/\n\ntype Payload = Record<string, unknown>;\n\ntype ActionFn<\n Type extends string = string,\n ActionPayload extends Payload = Payload\n> = ((payload: ActionPayload) => ActionPayload & { type: Type }) & {\n type: Type;\n};\n\ntype ActionFns = Record<string, ActionFn>;\n\nexport type ActionsFnSpecs = Record<string, Payload>;\n\ntype ActionFnCreator<Spec extends ActionsFnSpecs> = {\n [ActionName in keyof Spec]: (Record<never, never> extends Spec[ActionName]\n ? () => Spec[ActionName] & { type: ActionName }\n : (\n payload: Spec[ActionName]\n ) => Spec[ActionName] & { type: ActionName }) & {\n type: ActionName & string;\n };\n};\n\ntype ActionFnPayload<Action> = Action extends (payload: infer Payload) => void\n ? Payload\n : never;\n\ntype ActionFnsCreator<Spec extends ActionsFnSpecs> = Spec extends {\n private: Record<string, Payload>;\n public: Record<string, Payload>;\n}\n ? ActionFnCreator<Spec['private']> & ActionFnCreator<Spec['public']>\n : ActionFnCreator<Spec>;\n\ntype PublicActionFns<Spec extends ActionsFnSpecs> = Spec extends {\n public: Record<string, Payload>;\n}\n ? ActionFnCreator<Spec['public']>\n : ActionFnCreator<Spec>;\n\nexport function payload<Type extends Payload>(): Type {\n return {} as Type;\n}\n\nexport const noPayload = {};\n\n/** Reducer **/\n\ntype ReducerFunction<ReducerAction, State> = (\n state: State,\n action: ActionFnPayload<ReducerAction>\n) => void;\n\ntype ReducerFactory<StateActionFns extends ActionFns, State> = (\n actions: StateActionFns,\n on: <ReducerAction extends { type: string }>(\n action: ReducerAction,\n reducerFn: ReducerFunction<ReducerAction, State>\n ) => void\n) => void;\n\n/**\n * Creates a reducer function to separate the reducer logic into another file.\n *\n * ```typescript\n * interface FlightState {\n * flights: Flight[];\n * effect1: boolean;\n * effect2: boolean;\n * }\n *\n * const initialState: FlightState = {\n * flights: [],\n * effect1: false,\n * effect2: false,\n * };\n *\n * const actions = {\n * init: noPayload,\n * updateEffect1: payload<{ value: boolean }>(),\n * updateEffect2: payload<{ value: boolean }>(),\n * };\n *\n * const reducer = createReducer<FlightState, typeof actions>((actions, on) => {\n * on(actions.updateEffect1, (state, { value }) => {\n * patchState(state, { effect1: value });\n * });\n *\n * on(actions.updateEffect2, (state, { value }) => {\n * patchState(state, { effect2: value });\n * });\n * });\n *\n * signalStore(\n * withState(initialState),\n * withRedux({\n * actions,\n * reducer,\n * })\n * );\n * ```\n * @param reducerFactory\n */\nexport function createReducer<\n State extends object,\n Actions extends ActionsFnSpecs\n>(\n reducerFactory: ReducerFactory<\n ActionFnsCreator<Actions>,\n WritableStateSource<State>\n >\n) {\n return reducerFactory;\n}\n\n/** Effect **/\n\ntype EffectsFactory<StateActionFns extends ActionFns> = (\n actions: StateActionFns,\n create: <EffectAction extends { type: string }>(\n action: EffectAction\n ) => Observable<ActionFnPayload<EffectAction>>\n) => Record<string, Observable<unknown>>;\n\n/**\n * Creates the effects function to separate the effects logic into another file.\n *\n * ```typescript\n * interface FlightState {\n * flights: Flight[];\n * effect1: boolean;\n * effect2: boolean;\n * }\n *\n * const initialState: FlightState = {\n * flights: [],\n * effect1: false,\n * effect2: false,\n * };\n *\n * const actions = {\n * init: noPayload,\n * updateEffect1: payload<{ value: boolean }>(),\n * updateEffect2: payload<{ value: boolean }>(),\n * };\n *\n * const effects = createEffects(actions, (actions, create) => {\n * return {\n * init1$: create(actions.init).pipe(\n * map(() => actions.updateEffect1({ value: true }))\n * ),\n * init2$: create(actions.init).pipe(\n * map(() => actions.updateEffect2({ value: true }))\n * ),\n * };\n * });\n *\n * signalStore(\n * withState(initialState),\n * withRedux({\n * actions,\n * effects,\n * })\n * );\n * ```\n * @param actions\n * @param effectsFactory\n */\nexport function createEffects<Actions extends ActionsFnSpecs>(\n actions: Actions,\n effectsFactory: EffectsFactory<ActionFnsCreator<Actions>>\n) {\n return effectsFactory;\n}\n\n// internal types\n\n/**\n * Record which holds all effects for a specific action type.\n * The values are Subject which the effect are subscribed to.\n * `createActionFns` will call next on these subjects.\n */\ntype EffectsRegistry = Record<string, Subject<ActionFnPayload<unknown>>[]>;\n\nfunction createActionFns<Spec extends ActionsFnSpecs>(\n actionFnSpecs: Spec,\n reducerRegistry: Record<\n string,\n (state: unknown, payload: ActionFnPayload<unknown>) => void\n >,\n effectsRegistry: EffectsRegistry,\n state: unknown\n) {\n const actionFns: Record<string, ActionFn> = {};\n\n for (const type in actionFnSpecs) {\n const actionFn = (payload: Payload) => {\n const fullPayload = { ...payload, type };\n const reducer = reducerRegistry[type];\n if (reducer) {\n (reducer as (state: unknown, payload: unknown) => void)(\n state,\n fullPayload as unknown\n );\n }\n const effectSubjects = effectsRegistry[type];\n if (effectSubjects?.length) {\n for (const effectSubject of effectSubjects) {\n (effectSubject as unknown as Subject<unknown>).next(fullPayload);\n }\n }\n return fullPayload;\n };\n actionFn.type = type.toString();\n actionFns[type] = actionFn;\n }\n\n return actionFns;\n}\n\nfunction createPublicAndAllActionsFns<Spec extends ActionsFnSpecs>(\n actionFnSpecs: Spec,\n reducerRegistry: Record<\n string,\n (state: unknown, payload: ActionFnPayload<unknown>) => void\n >,\n effectsRegistry: EffectsRegistry,\n state: unknown\n): { all: ActionFns; publics: ActionFns } {\n if ('public' in actionFnSpecs || 'private' in actionFnSpecs) {\n const privates = actionFnSpecs['private'] || {};\n const publics = actionFnSpecs['public'] || {};\n\n assertActionFnSpecs(privates);\n assertActionFnSpecs(publics);\n\n const privateActionFns = createActionFns(\n privates,\n reducerRegistry,\n effectsRegistry,\n state\n );\n const publicActionFns = createActionFns(\n publics,\n reducerRegistry,\n effectsRegistry,\n state\n );\n\n return {\n all: { ...privateActionFns, ...publicActionFns },\n publics: publicActionFns,\n };\n }\n\n const actionFns = createActionFns(\n actionFnSpecs,\n reducerRegistry,\n effectsRegistry,\n state\n );\n\n return { all: actionFns, publics: actionFns };\n}\n\nfunction fillReducerRegistry(\n reducer: ReducerFactory<ActionFns, unknown>,\n actionFns: ActionFns,\n reducerRegistry: Record<\n string,\n (state: unknown, payload: ActionFnPayload<unknown>) => void\n >\n) {\n function on(\n action: { type: string },\n reducerFn: (state: unknown, payload: ActionFnPayload<unknown>) => void\n ) {\n reducerRegistry[action.type] = reducerFn;\n }\n\n reducer(actionFns, on);\n\n return reducerRegistry;\n}\n\nfunction fillEffects(\n effects: EffectsFactory<ActionFns>,\n actionFns: ActionFns,\n effectsRegistry: EffectsRegistry = {}\n): Observable<unknown>[] {\n function create(action: { type: string }) {\n const subject = new Subject<ActionFnPayload<unknown>>();\n if (!(action.type in effectsRegistry)) {\n effectsRegistry[action.type] = [];\n }\n effectsRegistry[action.type].push(subject);\n return subject.asObservable();\n }\n\n const effectObservables = effects(actionFns, create);\n return Object.values(effectObservables);\n}\n\nfunction startSubscriptions(observables: Observable<unknown>[]) {\n return observables.map((observable) => observable.subscribe());\n}\n\nfunction processRedux<Spec extends ActionsFnSpecs, ReturnType>(\n actionFnSpecs: Spec,\n reducer: ReducerFactory<ActionFns, unknown>,\n effects: EffectsFactory<ActionFns>,\n store: unknown\n) {\n const reducerRegistry: Record<\n string,\n (state: unknown, payload: ActionFnPayload<unknown>) => void\n > = {};\n const effectsRegistry: Record<string, Subject<ActionFnPayload<unknown>>[]> =\n {};\n const actionsMap = createPublicAndAllActionsFns(\n actionFnSpecs,\n reducerRegistry,\n effectsRegistry,\n store\n );\n const actionFns = actionsMap.all;\n const publicActionsFns = actionsMap.publics;\n\n fillReducerRegistry(reducer, actionFns, reducerRegistry);\n const effectObservables = fillEffects(effects, actionFns, effectsRegistry);\n const subscriptions = startSubscriptions(effectObservables);\n\n return {\n methods: publicActionsFns as ReturnType,\n subscriptions: subscriptions,\n };\n}\n\n/**\n * @param redux redux\n *\n * properties do not start with `with` since they are not extension functions on their own.\n *\n * no dependency to NgRx\n *\n * actions are passed to reducer and effects, but it is also possible to use other actions.\n * effects provide forAction and do not return anything. that is important because effects should stay inaccessible\n */\nexport function withRedux<\n Spec extends ActionsFnSpecs,\n Input extends SignalStoreFeatureResult,\n StateActionFns extends ActionFnsCreator<Spec> = ActionFnsCreator<Spec>,\n PublicStoreActionFns extends PublicActionFns<Spec> = PublicActionFns<Spec>\n>(redux: {\n actions: Spec;\n reducer: ReducerFactory<StateActionFns, WritableStateSource<Input['state']>>;\n effects: EffectsFactory<StateActionFns>;\n}): SignalStoreFeature<\n Input,\n EmptyFeatureResult & { methods: PublicStoreActionFns }\n> {\n return (store) => {\n const { methods } = processRedux<Spec, PublicStoreActionFns>(\n redux.actions,\n redux.reducer as ReducerFactory<ActionFns, unknown>,\n redux.effects as EffectsFactory<ActionFns>,\n store\n );\n return {\n ...store,\n methods,\n };\n };\n}\n","import { Signal, computed } from '@angular/core';\nimport {\n EmptyFeatureResult,\n SignalStoreFeature,\n signalStoreFeature,\n withComputed,\n withState,\n} from '@ngrx/signals';\n\nexport type CallState = 'init' | 'loading' | 'loaded' | { error: string };\n\nexport type CallStateSlice = {\n callState: CallState;\n};\n\nexport type NamedCallStateSlice<Collection extends string> = {\n [K in keyof CallStateSlice as `${Collection}${Capitalize<K>}`]: CallStateSlice[K];\n};\n\nexport type CallStateSignals = {\n loading: Signal<boolean>;\n loaded: Signal<boolean>;\n error: Signal<string | null>;\n};\n\nexport type NamedCallStateSignals<Prop extends string> = {\n [K in keyof CallStateSignals as `${Prop}${Capitalize<K>}`]: CallStateSignals[K];\n};\n\nexport type SetCallState<Prop extends string | undefined> = Prop extends string\n ? NamedCallStateSlice<Prop>\n : CallStateSlice;\n\nexport function getCallStateKeys(config?: { collection?: string }) {\n const prop = config?.collection;\n return {\n callStateKey: prop ? `${config.collection}CallState` : 'callState',\n loadingKey: prop ? `${config.collection}Loading` : 'loading',\n loadedKey: prop ? `${config.collection}Loaded` : 'loaded',\n errorKey: prop ? `${config.collection}Error` : 'error',\n };\n}\n\nexport function withCallState<Collection extends string>(config: {\n collection: Collection;\n}): SignalStoreFeature<\n EmptyFeatureResult,\n EmptyFeatureResult & {\n state: NamedCallStateSlice<Collection>;\n props: NamedCallStateSignals<Collection>;\n }\n>;\nexport function withCallState(): SignalStoreFeature<\n EmptyFeatureResult,\n EmptyFeatureResult & {\n state: CallStateSlice;\n props: CallStateSignals;\n }\n>;\nexport function withCallState<Collection extends string>(config?: {\n collection: Collection;\n}): SignalStoreFeature {\n const { callStateKey, errorKey, loadedKey, loadingKey } =\n getCallStateKeys(config);\n\n return signalStoreFeature(\n withState({ [callStateKey]: 'init' }),\n withComputed((state: Record<string, Signal<unknown>>) => {\n const callState = state[callStateKey] as Signal<CallState>;\n\n return {\n [loadingKey]: computed(() => callState() === 'loading'),\n [loadedKey]: computed(() => callState() === 'loaded'),\n [errorKey]: computed(() => {\n const v = callState();\n return typeof v === 'object' ? v.error : null;\n }),\n };\n })\n );\n}\n\nexport function setLoading<Prop extends string | undefined = undefined>(\n prop?: Prop\n): SetCallState<Prop> {\n if (prop) {\n return { [`${prop}CallState`]: 'loading' } as SetCallState<Prop>;\n }\n\n return { callState: 'loading' } as SetCallState<Prop>;\n}\n\nexport function setLoaded<Prop extends string | undefined = undefined>(\n prop?: Prop\n): SetCallState<Prop> {\n if (prop) {\n return { [`${prop}CallState`]: 'loaded' } as SetCallState<Prop>;\n } else {\n return { callState: 'loaded' } as SetCallState<Prop>;\n }\n}\n\nexport function setError<Prop extends string | undefined = undefined>(\n error: unknown,\n prop?: Prop\n): SetCallState<Prop> {\n let errorMessage: string;\n\n if (!error) {\n errorMessage = '';\n } else if (typeof error === 'object' && 'message' in error) {\n errorMessage = String(error.message);\n } else {\n errorMessage = String(error);\n }\n\n if (prop) {\n return {\n [`${prop}CallState`]: { error: errorMessage },\n } as SetCallState<Prop>;\n } else {\n return { callState: { error: errorMessage } } as SetCallState<Prop>;\n }\n}\n","import { ProviderToken, Signal, computed, inject } from '@angular/core';\nimport {\n SignalStoreFeature,\n patchState,\n signalStoreFeature,\n withComputed,\n withMethods,\n withState,\n EmptyFeatureResult,\n WritableStateSource,\n} from '@ngrx/signals';\nimport {\n CallState,\n getCallStateKeys,\n setError,\n setLoaded,\n setLoading,\n} from './with-call-state';\nimport {\n setAllEntities,\n EntityId,\n addEntity,\n updateEntity,\n removeEntity,\n} from '@ngrx/signals/entities';\nimport { EntityState, NamedEntityComputed } from './shared/signal-store-models';\n\nexport type Filter = Record<string, unknown>;\nexport type Entity = { id: EntityId };\n\nexport interface DataService<E extends Entity, F extends Filter> {\n load(filter: F): Promise<E[]>;\n\n loadById(id: EntityId): Promise<E>;\n\n create(entity: E): Promise<E>;\n\n update(entity: E): Promise<E>;\n\n updateAll(entity: E[]): Promise<E[]>;\n\n delete(entity: E): Promise<void>;\n}\n\nexport function capitalize(str: string): string {\n return str ? str[0].toUpperCase() + str.substring(1) : str;\n}\n\nexport function getDataServiceKeys(options: { collection?: string }) {\n const filterKey = options.collection\n ? `${options.collection}Filter`\n : 'filter';\n const selectedIdsKey = options.collection\n ? `selected${capitalize(options.collection)}Ids`\n : 'selectedIds';\n const selectedEntitiesKey = options.collection\n ? `selected${capitalize(options.collection)}Entities`\n : 'selectedEntities';\n\n const updateFilterKey = options.collection\n ? `update${capitalize(options.collection)}Filter`\n : 'updateFilter';\n const updateSelectedKey = options.collection\n ? `updateSelected${capitalize(options.collection)}Entities`\n : 'updateSelected';\n const loadKey = options.collection\n ? `load${capitalize(options.collection)}Entities`\n : 'load';\n\n const currentKey = options.collection\n ? `current${capitalize(options.collection)}`\n : 'current';\n const loadByIdKey = options.collection\n ? `load${capitalize(options.collection)}ById`\n : 'loadById';\n const setCurrentKey = options.collection\n ? `setCurrent${capitalize(options.collection)}`\n : 'setCurrent';\n const createKey = options.collection\n ? `create${capitalize(options.collection)}`\n : 'create';\n const updateKey = options.collection\n ? `update${capitalize(options.collection)}`\n : 'update';\n const updateAllKey = options.collection\n ? `updateAll${capitalize(options.collection)}`\n : 'updateAll';\n const deleteKey = options.collection\n ? `delete${capitalize(options.collection)}`\n : 'delete';\n\n // TODO: Take these from @ngrx/signals/entities, when they are exported\n const entitiesKey = options.collection\n ? `${options.collection}Entities`\n : 'entities';\n const entityMapKey = options.collection\n ? `${options.collection}EntityMap`\n : 'entityMap';\n const idsKey = options.collection ? `${options.collection}Ids` : 'ids';\n\n return {\n filterKey,\n selectedIdsKey,\n selectedEntitiesKey,\n updateFilterKey,\n updateSelectedKey,\n loadKey,\n entitiesKey,\n entityMapKey,\n idsKey,\n\n currentKey,\n loadByIdKey,\n setCurrentKey,\n createKey,\n updateKey,\n updateAllKey,\n deleteKey,\n };\n}\n\nexport type NamedDataServiceState<\n E extends Entity,\n F extends Filter,\n Collection extends string\n> = {\n [K in Collection as `${K}Filter`]: F;\n} & {\n [K in Collection as `selected${Capitalize<K>}Ids`]: Record<EntityId, boolean>;\n} & {\n [K in Collection as `current${Capitalize<K>}`]: E;\n};\n\nexport type DataServiceState<E extends Entity, F extends Filter> = {\n filter: F;\n selectedIds: Record<EntityId, boolean>;\n current: E;\n};\n\nexport type DataServiceComputed<E extends Entity> = {\n selectedEntities: Signal<E[]>;\n};\n\nexport type NamedDataServiceComputed<\n E extends Entity,\n Collection extends string\n> = {\n [K in Collection as `selected${Capitalize<K>}Entities`]: Signal<E[]>;\n};\n\nexport type NamedDataServiceMethods<\n E extends Entity,\n F extends Filter,\n Collection extends string\n> = {\n [K in Collection as `update${Capitalize<K>}Filter`]: (filter: F) => void;\n} & {\n [K in Collection as `updateSelected${Capitalize<K>}Entities`]: (\n id: EntityId,\n selected: boolean\n ) => void;\n} & {\n [K in Collection as `load${Capitalize<K>}Entities`]: () => Promise<void>;\n} & {\n [K in Collection as `setCurrent${Capitalize<K>}`]: (entity: E) => void;\n} & {\n [K in Collection as `load${Capitalize<K>}ById`]: (\n id: EntityId\n ) => Promise<void>;\n} & {\n [K in Collection as `create${Capitalize<K>}`]: (entity: E) => Promise<void>;\n} & {\n [K in Collection as `update${Capitalize<K>}`]: (entity: E) => Promise<void>;\n} & {\n [K in Collection as `updateAll${Capitalize<K>}`]: (\n entity: E[]\n ) => Promise<void>;\n} & {\n [K in Collection as `delete${Capitalize<K>}`]: (entity: E) => Promise<void>;\n};\n\nexport type DataServiceMethods<E extends Entity, F extends Filter> = {\n updateFilter: (filter: F) => void;\n updateSelected: (id: EntityId, selected: boolean) => void;\n load: () => Promise<void>;\n\n setCurrent(entity: E): void;\n loadById(id: EntityId): Promise<void>;\n create(entity: E): Promise<void>;\n update(entity: E): Promise<void>;\n updateAll(entities: E[]): Promise<void>;\n delete(entity: E): Promise<void>;\n};\n\nexport function withDataService<\n E extends Entity,\n F extends Filter,\n Collection extends string\n>(options: {\n dataServiceType: ProviderToken<DataService<E, F>>;\n filter: F;\n collection: Collection;\n}): SignalStoreFeature<\n // These alternatives break type inference:\n // state: { callState: CallState } & NamedEntityState<E, Collection>,\n // state: NamedEntityState<E, Collection>,\n EmptyFeatureResult & { props: NamedEntityComputed<E, Collection> },\n {\n state: NamedDataServiceState<E, F, Collection>;\n props: NamedDataServiceComputed<E, Collection>;\n methods: NamedDataServiceMethods<E, F, Collection>;\n }\n>;\nexport function withDataService<E extends Entity, F extends Filter>(options: {\n dataServiceType: ProviderToken<DataService<E, F>>;\n filter: F;\n}): SignalStoreFeature<\n EmptyFeatureResult & { state: { callState: CallState } & EntityState<E> },\n {\n state: DataServiceState<E, F>;\n props: DataServiceComputed<E>;\n methods: DataServiceMethods<E, F>;\n }\n>;\n\nexport function withDataService<\n E extends Entity,\n F extends Filter,\n Collection extends string\n>(options: {\n dataServiceType: ProviderToken<DataService<E, F>>;\n filter: F;\n collection?: Collection;\n}): /* eslint-disable @typescript-eslint/no-explicit-any */\nSignalStoreFeature<any, any> {\n const { dataServiceType, filter, collection: prefix } = options;\n const {\n entitiesKey,\n filterKey,\n loadKey,\n selectedEntitiesKey,\n selectedIdsKey,\n updateFilterKey,\n updateSelectedKey,\n\n currentKey,\n createKey,\n updateKey,\n updateAllKey,\n deleteKey,\n loadByIdKey,\n setCurrentKey,\n } = getDataServiceKeys(options);\n\n const { callStateKey } = getCallStateKeys({ collection: prefix });\n\n return signalStoreFeature(\n withState(() => ({\n [filterKey]: filter,\n [selectedIdsKey]: {} as Record<EntityId, boolean>,\n [currentKey]: undefined as E | undefined,\n })),\n withComputed((store: Record<string, unknown>) => {\n const entities = store[entitiesKey] as Signal<E[]>;\n const selectedIds = store[selectedIdsKey] as Signal<\n Record<EntityId, boolean>\n >;\n\n return {\n [selectedEntitiesKey]: computed(() =>\n entities().filter((e) => selectedIds()[e.id])\n ),\n };\n }),\n withMethods(\n (store: Record<string, unknown> & WritableStateSource<object>) => {\n const dataService = inject(dataServiceType);\n return {\n [updateFilterKey]: (filter: F): void => {\n patchState(store, { [filterKey]: filter });\n },\n [updateSelectedKey]: (id: EntityId, selected: boolean): void => {\n patchState(store, (state: Record<string, unknown>) => ({\n [selectedIdsKey]: {\n ...(state[selectedIdsKey] as Record<EntityId, boolean>),\n [id]: selected,\n },\n }));\n },\n [loadKey]: async (): Promise<void> => {\n const filter = store[filterKey] as Signal<F>;\n (() =>\n store[callStateKey] && patchState(store, setLoading(prefix)))();\n\n try {\n const result = await dataService.load(filter());\n patchState(\n store,\n prefix\n ? setAllEntities(result, { collection: prefix })\n : setAllEntities(result)\n );\n (() =>\n store[callStateKey] && patchState(store, setLoaded(prefix)))();\n } catch (e) {\n (() =>\n store[callStateKey] &&\n patchState(store, setError(e, prefix)))();\n throw e;\n }\n },\n [loadByIdKey]: async (id: EntityId): Promise<void> => {\n (() =>\n store[callStateKey] && patchState(store, setLoading(prefix)))();\n\n try {\n const current = await dataService.loadById(id);\n (() =>\n store[callStateKey] && patchState(store, setLoaded(prefix)))();\n patchState(store, { [currentKey]: current });\n } catch (e) {\n (() =>\n store[callStateKey] &&\n patchState(store, setError(e, prefix)))();\n throw e;\n }\n },\n [setCurrentKey]: (current: E): void => {\n patchState(store, { [currentKey]: current });\n },\n [createKey]: async (entity: E): Promise<void> => {\n patchState(store, { [currentKey]: entity });\n (() =>\n store[callStateKey] && patchState(store, setLoading(prefix)))();\n\n try {\n const created = await dataService.create(entity);\n patchState(store, { [currentKey]: created });\n patchState(\n store,\n prefix\n ? addEntity(created, { collection: prefix })\n : addEntity(created)\n );\n (() =>\n store[callStateKey] && patchState(store, setLoaded(prefix)))();\n } catch (e) {\n (() =>\n store[callStateKey] &&\n patchState(store, setError(e, prefix)))();\n throw e;\n }\n },\n [updateKey]: async (entity: E): Promise<void> => {\n patchState(store, { [currentKey]: entity });\n (() =>\n store[callStateKey] && patchState(store, setLoading(prefix)))();\n\n try {\n const updated = await dataService.update(entity);\n patchState(store, { [currentKey]: updated });\n\n const updateArg = {\n id: updated.id,\n changes: updated,\n };\n\n const updater = (collection: string) =>\n updateEntity(updateArg, { collection });\n\n patchState(\n store,\n prefix ? updater(prefix) : updateEntity(updateArg)\n );\n (() =>\n store[callStateKey] && patchState(store, setLoaded(prefix)))();\n } catch (e) {\n (() =>\n store[callStateKey] &&\n patchState(store, setError(e, prefix)))();\n throw e;\n }\n },\n [updateAllKey]: async (entities: E[]): Promise<void> => {\n (() =>\n store[callStateKey] && patchState(store, setLoading(prefix)))();\n\n try {\n const result = await dataService.updateAll(entities);\n patchState(\n store,\n prefix\n ? setAllEntities(result, { collection: prefix })\n : setAllEntities(result)\n );\n (() =>\n store[callStateKey] && patchState(store, setLoaded(prefix)))();\n } catch (e) {\n (() =>\n store[callStateKey] &&\n patchState(store, setError(e, prefix)))();\n throw e;\n }\n },\n [deleteKey]: async (entity: E): Promise<void> => {\n patchState(store, { [currentKey]: entity });\n (() =>\n store[callStateKey] && patchState(store, setLoading(prefix)))();\n\n try {\n await dataService.delete(entity);\n patchState(store, { [currentKey]: undefined });\n patchState(\n store,\n prefix\n ? removeEntity(entity.id, { collection: prefix })\n : removeEntity(entity.id)\n );\n (() =>\n store[callStateKey] && patchState(store, setLoaded(prefix)))();\n } catch (e) {\n (() =>\n store[callStateKey] &&\n patchState(store, setError(e, prefix)))();\n throw e;\n }\n },\n };\n }\n )\n );\n}\n","import {\n SignalStoreFeature,\n patchState,\n signalStoreFeature,\n withComputed,\n withHooks,\n withMethods,\n EmptyFeatureResult, SignalStoreFeatureResult\n} from '@ngrx/signals';\nimport { Signal, effect, signal, untracked, isSignal } from '@angular/core';\nimport { capitalize } from './with-data-service';\n\nexport type StackItem = Record<string, unknown>;\n\nexport type NormalizedUndoRedoOptions = {\n maxStackSize: number;\n collections?: string[];\n keys: string[];\n skip: number,\n};\n\nconst defaultOptions: NormalizedUndoRedoOptions = {\n maxStackSize: 100,\n keys: [],\n skip: 0,\n};\n\nexport function getUndoRedoKeys(collections?: string[]): string[] {\n if (collections) {\n return collections.flatMap((c) => [\n `${c}EntityMap`,\n `${c}Ids`,\n `selected${capitalize(c)}Ids`,\n `${c}Filter`,\n ]);\n }\n return ['entityMap', 'ids', 'selectedIds', 'filter'];\n}\n\ntype NonNever<T> = T extends never ? never : T;\n\ntype ExtractEntityCollection<T> = T extends `${infer U}Entities` ? U : never;\n\ntype ExtractEntityCollections<Store extends SignalStoreFeatureResult> = NonNever<{\n [K in keyof Store['props']]: ExtractEntityCollection<K>;\n}[keyof Store['props']]>;\n\ntype OptionsForState<Store extends SignalStoreFeatureResult> = Partial<Omit<NormalizedUndoRedoOptions, 'collections' | 'keys'>> & {\n collections?: ExtractEntityCollections<Store>[];\n keys?: (keyof Store['state'])[];\n};\n\nexport function withUndoRedo<\n Input extends EmptyFeatureResult>(options?: OptionsForState<Input>): SignalStoreFeature<\n Input,\n EmptyFeatureResult & {\n props: {\n canUndo: Signal<boolean>;\n canRedo: Signal<boolean>;\n };\n methods: {\n undo: () => void;\n redo: () => void;\n clearStack: () => void;\n };\n}\n> {\n let previous: StackItem | null = null;\n let skipOnce = false;\n\n const normalized = {\n ...defaultOptions,\n ...options,\n };\n\n //\n // Design Decision: This feature has its own\n // internal state.\n //\n\n const undoStack: StackItem[] = [];\n const redoStack: StackItem[] = [];\n\n const canUndo = signal(false);\n const canRedo = signal(false);\n\n const updateInternal = () => {\n canUndo.set(undoStack.length !== 0);\n canRedo.set(redoStack.length !== 0);\n };\n\n const keys = [...getUndoRedoKeys(normalized.collections), ...normalized.keys];\n\n return signalStoreFeature(\n withComputed(() => ({\n canUndo: canUndo.asReadonly(),\n canRedo: canRedo.asReadonly(),\n })),\n withMethods((store) => ({\n undo(): void {\n const item = undoStack.pop();\n\n if (item && previous) {\n redoStack.push(previous);\n }\n\n if (item) {\n skipOnce = true;\n patchState(store, item);\n previous = item;\n }\n\n updateInternal();\n },\n redo(): void {\n const item = redoStack.pop();\n\n if (item && previous) {\n undoStack.push(previous);\n }\n\n if (item) {\n skipOnce = true;\n patchState(store, item);\n previous = item;\n }\n\n updateInternal();\n },\n clearStack(): void {\n undoStack.splice(0);\n redoStack.splice(0);\n updateInternal();\n },\n })),\n withHooks({\n onInit(store) {\n effect(() => {\n const cand = keys.reduce((acc, key) => {\n const s = (store as Record<string | keyof Input['state'], unknown>)[key];\n if (s && isSignal(s)) {\n return {\n ...acc,\n [key]: s(),\n };\n }\n return acc;\n }, {});\n\n if (normalized.skip > 0) {\n normalized.skip--;\n return;\n }\n\n if (skipOnce) {\n skipOnce = false;\n return;\n }\n\n //\n // Deep Comparison to prevent duplicated entries\n // on the stack. This can e.g. happen after an undo\n // if the component sends back the undone filter\n // to the store.\n //\n if (JSON.stringify(cand) === JSON.stringify(previous)) {\n return;\n }\n\n // Clear redoStack after recorded action\n redoStack.splice(0);\n\n if (previous) {\n undoStack.push(previous);\n }\n\n if (redoStack.length > normalized.maxStackSize) {\n undoStack.unshift();\n }\n\n previous = cand;\n\n // Don't propogate current reactive context\n untracked(() => updateInternal());\n });\n },\n })\n );\n}\n","import { isPlatformServer } from '@angular/common';\nimport { PLATFORM_ID, effect, inject } from '@angular/core';\nimport {\n SignalStoreFeature,\n getState,\n patchState,\n signalStoreFeature,\n withHooks,\n withMethods,\n SignalStoreFeatureResult,\n EmptyFeatureResult,\n} from '@ngrx/signals';\n\nconst NOOP = () => void true;\n\ntype WithStorageSyncFeatureResult = EmptyFeatureResult & {\n methods: {\n clearStorage(): void;\n readFromStorage(): void;\n writeToStorage(): void;\n };\n};\n\nconst StorageSyncStub: Pick<\n WithStorageSyncFeatureResult,\n 'methods'\n>['methods'] = {\n clearStorage: NOOP,\n readFromStorage: NOOP,\n writeToStorage: NOOP,\n};\n\nexport type SyncConfig<State> = {\n /**\n * The key which is used to access the storage.\n */\n key: string;\n /**\n * Flag indicating if the store should read from storage on init and write to storage on every state change.\n *\n * `true` by default\n */\n autoSync?: boolean;\n /**\n * Function to select that portion of the state which should be stored.\n *\n * Returns the whole state object by default\n */\n select?: (state: State) => Partial<State>;\n /**\n * Function used to parse the state coming from storage.\n *\n * `JSON.parse()` by default\n */\n parse?: (stateString: string) => State;\n /**\n * Function used to tranform the state into a string representation.\n *\n * `JSON.stringify()` by default\n */\n stringify?: (state: State) => string;\n /**\n * Factory function used to select the storage.\n *\n * `localstorage` by default\n */\n storage?: () => Storage;\n};\n\n/**\n * Enables store synchronization with storage.\n *\n * Only works on browser platform.\n */\nexport function withStorageSync<Input extends SignalStoreFeatureResult>(\n key: string\n): SignalStoreFeature<Input, WithStorageSyncFeatureResult>;\nexport function withStorageSync<Input extends SignalStoreFeatureResult>(\n config: SyncConfig<Input['state']>\n): SignalStoreFeature<Input, WithStorageSyncFeatureResult>;\nexport function withStorageSync<\n State extends object,\n Input extends SignalStoreFeatureResult\n>(\n configOrKey: SyncConfig<Input['state']> | string\n): SignalStoreFeature<Input, WithStorageSyncFeatureResult> {\n const {\n key,\n autoSync = true,\n select = (state: State) => state,\n parse = JSON.parse,\n stringify = JSON.stringify,\n storage: storageFactory = () => localStorage,\n } = typeof configOrKey === 'string' ? { key: configOrKey } : configOrKey;\n\n return signalStoreFeature(\n withMethods((store, platformId = inject(PLATFORM_ID)) => {\n if (isPlatformServer(platformId)) {\n console.warn(\n `'withStorageSync' provides non-functional implementation due to server-side execution`\n );\n return StorageSyncStub;\n }\n\n const storage = storageFactory();\n\n return {\n /**\n * Removes the item stored in storage.\n */\n clearStorage(): void {\n storage.removeItem(key);\n },\n /**\n * Reads item from storage and patches the state.\n */\n readFromStorage(): void {\n const stateString = storage.getItem(key);\n if (stateString) {\n patchState(store, parse(stateString));\n }\n },\n /**\n * Writes selected portion to storage.\n */\n writeToStorage(): void {\n const slicedState = select(getState(store) as State);\n storage.setItem(key, stringify(slicedState));\n },\n };\n }),\n withHooks({\n onInit(store, platformId = inject(PLATFORM_ID)) {\n if (isPlatformServer(platformId)) {\n return;\n }\n\n if (autoSync) {\n store.readFromStorage();\n\n effect(() => {\n store.writeToStorage();\n });\n }\n },\n })\n );\n}\n","/** With pagination comes in two flavors the first one is local pagination or in memory pagination. For example we have 2000 items which we want\n * to display in a table and the response payload is small enough to be stored in the memory. But we can not display all 2000 items at once\n * so we need to paginate the data. The second flavor is server side pagination where the response payload is too large to be stored in the memory\n * and we need to fetch the data from the server in chunks. In the second case we 'could' also cache the data in the memory but that could lead to\n * other problems like memory leaks and stale data. So we will not cache the data in the memory in the second case.\n * This feature implements the local pagination.\n */\n\nimport { Signal, computed } from '@angular/core';\nimport {\n SignalStoreFeature,\n patchState,\n signalStoreFeature,\n withComputed,\n withMethods,\n withState,\n WritableStateSource,\n EmptyFeatureResult,\n} from '@ngrx/signals';\nimport { capitalize } from './with-data-service';\nimport {\n EntityComputed,\n EntityState,\n NamedEntityComputed,\n} from './shared/signal-store-models';\n\n// This is a virtual page which is can be used to create a pagination control\nexport type Page = { label: string | number; value: number };\n\nexport type NamedPaginationServiceState<E, Collection extends string> = {\n [K in Collection as `selectedPage${Capitalize<K>}Entities`]: Array<E>;\n} & {\n [K in Collection as `${Lowercase<K>}CurrentPage`]: number;\n} & {\n [K in Collection as `${Lowercase<K>}PageSize`]: number;\n} & {\n [K in Collection as `${Lowercase<K>}TotalCount`]: number;\n} & {\n [K in Collection as `${Lowercase<K>}PageCount`]: number;\n} & {\n [K in Collection as `${Lowercase<K>}PageNavigationArray`]: number;\n} & {\n [K in Collection as `${Lowercase<K>}PageNavigationArrayMax`]: number;\n};\n\nexport type NamedPaginationServiceSignals<E, Collection extends string> = {\n [K in Collection as `selectedPage${Capitalize<K>}Entities`]: Signal<E[]>;\n} & {\n [K in Collection as `${Lowercase<K>}CurrentPage`]: Signal<number>;\n} & {\n [K in Collection as `${Lowercase<K>}PageSize`]: Signal<number>;\n} & {\n [K in Collection as `${Lowercase<K>}TotalCount`]: Signal<number>;\n} & {\n [K in Collection as `${Lowercase<K>}PageCount`]: Signal<number>;\n} & {\n [K in Collection as `${Lowercase<K>}PageNavigationArray`]: Signal<Page[]>;\n} & {\n [K in Collection as `${Lowercase<K>}PageNavigationArrayMax`]: Signal<number>;\n} & {\n [K in Collection as `hasNext${Capitalize<K>}Page`]: Signal<boolean>;\n} & {\n [K in Collection as `hasPrevious${Capitalize<K>}Page`]: Signal<boolean>;\n};\n\nexport type NamedPaginationServiceMethods<Collection extends string> = {\n [K in Collection as `set${Capitalize<K>}PageSize`]: (size: number) => void;\n} & {\n [K in Collection as `next${Capitalize<K>}Page`]: () => void;\n} & {\n [K in Collection as `previous${Capitalize<K>}Page`]: () => void;\n} & {\n [K in Collection as `last${Capitalize<K>}Page`]: () => void;\n} & {\n [K in Collection as `first${Capitalize<K>}Page`]: () => void;\n} & {\n [K in Collection as `goto${Capitalize<K>}Page`]: (page: number) => void;\n};\n\nexport type PaginationServiceState<E> = {\n selectedPageEntities: Array<E>;\n currentPage: number;\n pageSize: number;\n totalCount: number;\n pageCount: number;\n pageNavigationArray: Page[];\n pageNavigationArrayMax: number;\n};\n\nexport type PaginationServiceSignals<E> = {\n selectedPageEntities: Signal<E[]>;\n currentPage: Signal<number>;\n pageSize: Signal<number>;\n totalCount: Signal<number>;\n pageCount: Signal<number>;\n pageNavigationArray: Signal<Page[]>;\n pageNavigationArrayMax: Signal<number>;\n hasNextPage: Signal<boolean>;\n hasPreviousPage: Signal<boolean>;\n};\n\nexport type PaginationServiceMethods = {\n setPageSize: (size: number) => void;\n nextPageKey: () => void;\n previousPage: () => void;\n lastPage: () => void;\n firstPage: () => void;\n gotoPage: (page: number) => void;\n};\n\nexport type SetPaginationState<\n E,\n Collection extends string | undefined\n> = Collection extends string\n ? NamedPaginationServiceState<E, Collection>\n : PaginationServiceState<E>;\n\nexport function withPagination<E, Collection extends string>(options: {\n entity: E;\n collection: Collection;\n}): SignalStoreFeature<\n EmptyFeatureResult & { props: NamedEntityComputed<E, Collection> },\n {\n state: NamedPaginationServiceState<E, Collection>;\n props: NamedPaginationServiceSignals<E, Collection>;\n methods: NamedPaginationServiceMethods<Collection>;\n }\n>;\n\nexport function withPagination<E>(): SignalStoreFeature<\n EmptyFeatureResult & {\n state: EntityState<E>;\n props: EntityComputed<E>;\n },\n {\n state: PaginationServiceState<E>;\n props: PaginationServiceSignals<E>;\n methods: PaginationServiceMethods;\n }\n>;\n\nexport function withPagination<E, Collection extends string>(options?: {\n entity: E;\n collection: Collection;\n}): /* eslint-disable @typescript-eslint/no-explicit-any */\nSignalStoreFeature<any, any> {\n const {\n pageKey,\n pageSizeKey,\n entitiesKey,\n selectedPageEntitiesKey,\n totalCountKey,\n pageCountKey,\n pageNavigationArrayMaxKey,\n pageNavigationArrayKey,\n setPageSizeKey,\n nextPageKey,\n previousPageKey,\n lastPageKey,\n firstPageKey,\n gotoPageKey,\n hasNextPageKey,\n hasPreviousPageKey,\n } = createPaginationKeys<Collection>(options);\n\n return signalStoreFeature(\n withState({\n [pageKey]: 0,\n [pageSizeKey]: 10,\n [pageNavigationArrayMaxKey]: 7,\n }),\n withComputed((store: Record<string, unknown>) => {\n const entities = store[entitiesKey] as Signal<E[]>;\n const page = store[pageKey] as Signal<number>;\n const pageSize = store[pageSizeKey] as Signal<number>;\n const pageNavigationArrayMax = store[\n pageNavigationArrayMaxKey\n ] as Signal<number>;\n\n return {\n // The derived enitites which are displayed on the current page\n [selectedPageEntitiesKey]: computed<E[]>(() => {\n const pageSizeValue = pageSize();\n const pageValue = page();\n\n return entities().slice(\n pageValue * pageSizeValue,\n (pageValue + 1) * pageSizeValue\n ) as E[];\n }),\n [totalCountKey]: computed(() => entities().length),\n [pageCountKey]: computed(() => {\n const totalCountValue = entities().length;\n const pageSizeValue = pageSize();\n\n if (totalCountValue === 0) {\n return 0;\n }\n\n return Math.ceil(totalCountValue / pageSizeValue);\n }),\n [pageNavigationArrayKey]: computed(() =>\n createPageArray(\n page(),\n pageSize(),\n entities().length,\n pageNavigationArrayMax()\n )\n ),\n\n [hasNextPageKey]: computed(() => {\n return page() < pageSize();\n }),\n\n [hasPreviousPageKey]: computed(() => {\n return page() > 1;\n }),\n };\n }),\n withMethods(\n (store: Record<string, unknown> & WritableStateSource<object>) => {\n return {\n [setPageSizeKey]: (size: number) => {\n patchState(store, setPageSize(size, options));\n },\n [nextPageKey]: () => {\n patchState(store, nextPage(options));\n },\n\n [previousPageKey]: () => {\n patchState(store, previousPage(options));\n },\n\n [lastPageKey]: () => {\n const lastPage = (store[pageCountKey] as Signal<number>)();\n if (lastPage === 0) return;\n patchState(store, gotoPage(lastPage - 1, options));\n },\n\n [firstPageKey]: () => {\n patchState(store, firstPage());\n },\n\n [gotoPageKey]: (page: number) => {\n patchState(store, gotoPage(page, options));\n },\n };\n }\n )\n );\n}\n\nexport function gotoPage<E, Collection extends string>(\n page: number,\n options?: {\n collection: Collection;\n }\n): Partial<SetPaginationState<E, Collection>> {\n const { pageKey } = createPaginationKeys<Collection>(options);\n\n return {\n [pageKey]: page,\n } as Partial<SetPaginationState<E, Collection>>;\n}\n\nexport function setPageSize<E, Collection extends string>(\n pageSize: number,\n options?: {\n collection: Collection;\n }\n): Partial<SetPaginationState<E, Collection>> {\n const { pageSizeKey } = createPaginationKeys<Collection>(options);\n\n return {\n [pageSizeKey]: pageSize,\n } as Partial<SetPaginationState<E, Collection>>;\n}\n\nexport function nextPage<E, Collection extends string>(options?: {\n collection: Collection;\n}): Partial<SetPaginationState<E, Collection>> {\n const { pageKey } = createPaginationKeys<Collection>(options);\n\n return {\n [pageKey]: (currentPage: number) => currentPage + 1,\n } as Partial<SetPaginationState<E, Collection>>;\n}\n\nexport function previousPage<E, Collection extends string>(options?: {\n collection: Collection;\n}): Partial<SetPaginationState<E, Collection>> {\n const { pageKey } = createPaginationKeys<Collection>(options);\n\n return {\n [pageKey]: (currentPage: number) => Math.max(currentPage - 1, 1),\n } as Partial<SetPaginationState<E, Collection>>;\n}\n\nexport function firstPage<E, Collection extends string>(options?: {\n collection: Collection;\n}): Partial<SetPaginationState<E, Collection>> {\n const { pageKey } = createPaginationKeys<Collection>(options);\n\n return {\n [pageKey]: 1,\n } as Partial<SetPaginationState<E, Collection>>;\n}\n\nexport function setMaxPageNavigationArrayItems<E, Collection extends string>(\n maxPageNavigationArrayItems: number,\n options?: {\n collection: Collection;\n }\n): Partial<SetPaginationState<E, Collection>> {\n const { pageNavigationArrayMaxKey } =\n createPaginationKeys<Collection>(options);\n\n return {\n [pageNavigationArrayMaxKey]: maxPageNavigationArrayItems,\n } as Partial<SetPaginationState<E, Collection>>;\n}\n\nfunction createPaginationKeys<Collection extends string>(\n options: { collection: Collection } | undefined\n) {\n const entitiesKey = options?.collection\n ? `${options.collection}Entities`\n : 'entities';\n\n const selectedPageEntitiesKey = options?.collection\n ? `selectedPage${capitalize(options?.collection)}Entities`\n : 'selectedPageEntities';\n const pageKey = options?.collection\n ? `${options.collection}CurrentPage`\n : 'currentPage';\n const pageSizeKey = options?.collection\n ? `${options.collection}PageSize`\n : 'pageSize';\n const totalCountKey = options?.collection\n ? `${options.collection}TotalCount`\n : 'totalCount';\n const pageCountKey = options?.collection\n ? `${options.collection}PageCount`\n : 'pageCount';\n const pageNavigationArrayMaxKey = options?.collection\n ? `${options.collection}PageNavigationArrayMax`\n : 'pageNavigationArrayMax';\n const pageNavigationArrayKey = options?.collection\n ? `${options.collection}PageNavigationArray`\n : 'pageNavigationArray';\n\n const setPageSizeKey = options?.collection\n ? `set${capitalize(options.collection)}PageSize`\n : 'setPageSize';\n\n const nextPageKey = options?.collection\n ? `next${capitalize(options.collection)}Page`\n : 'nextPage';\n\n const previousPageKey = options?.collection\n ? `previous${capitalize(options.collection)}Page`\n : 'previousPage';\n\n const lastPageKey = options?.collection\n ? `last${capitalize(options.collection)}Page`\n : 'lastPage';\n\n const firstPageKey = options?.collection\n ? `first${capitalize(options.collection)}Page`\n : 'firstPage';\n\n const gotoPageKey = options?.collection\n ? `goto${capitalize(options.collection)}Page`\n : 'gotoPage';\n\n const hasNextPageKey = options?.collection\n ? `hasNext${capitalize(options.collection)}Page`\n : 'hasNextPage';\n\n const hasPreviousPageKey = options?.collection\n ? `hasPrevious${capitalize(options.collection)}Page`\n : 'hasPreviousPage';\n\n return {\n pageKey,\n pageSizeKey,\n entitiesKey,\n selectedPageEntitiesKey,\n totalCountKey,\n pageCountKey,\n pageNavigationArrayKey,\n pageNavigationArrayMaxKey,\n setPageSizeKey,\n nextPageKey,\n previousPageKey,\n lastPageKey,\n firstPageKey,\n gotoPageKey,\n hasNextPageKey,\n hasPreviousPageKey,\n };\n}\n\nexport function createPageArray(\n currentPage: number,\n itemsPerPage: number,\n totalItems: number,\n paginationRange: number\n): Page[] {\n // Convert paginationRange to number in case it's a string\n paginationRange = +paginationRange;\n\n // Calculate total number of pages\n const totalPages = Math.max(Math.ceil(totalItems / itemsPerPage), 1);\n const halfWay = Math.ceil(paginationRange / 2);\n\n const isStart = currentPage <= halfWay;\n const isEnd = totalPages - halfWay < currentPage;\n const isMiddle = !isStart && !isEnd;\n\n const ellipsesNeeded = paginationRange < totalPages;\n const pages: Page[] = [];\n\n for (let i = 1; i <= totalPages && i <= paginationRange; i++) {\n let pageNumber = i;\n\n if (i === paginationRange) {\n pageNumber = totalPages;\n } else if (ellipsesNeeded) {\n if (isEnd) {\n pageNumber = totalPages - paginationRange + i;\n } else if (isMiddle) {\n pageNumber = currentPage - halfWay + i;\n }\n }\n\n const openingEllipsesNeeded = i === 2 && (isMiddle || isEnd);\n const closingEllipsesNeeded =\n i === paginationRange - 1 && (isMiddle || isStart);\n\n const label =\n ellipsesNeeded && (openingEllipsesNeeded || closingEllipsesNeeded)\n ? '...'\n : pageNumber;\n\n pages.push({ label, value: pageNumber });\n }\n\n return pages;\n}\n","import {\n getState,\n patchState,\n signalStoreFeature,\n StateSource,\n withHooks,\n withMethods,\n withProps,\n} from '@ngrx/signals';\n\nexport type PublicMethods = {\n resetState(): void;\n};\n\n/**\n * Adds a `resetState` method to the store, which resets the state\n * to the initial state.\n *\n * If you want to set a custom initial state, you can use {@link setResetState}.\n */\nexport function withReset() {\n return signalStoreFeature(\n withProps(() => ({ _resetState: { value: {} } })),\n withMethods((store): PublicMethods => {\n // workaround to TS excessive property check\n const methods = {\n resetState() {\n patchState(store, store._resetState.value);\n },\n __setResetState__(state: object) {\n store._resetState.value = state;\n },\n };\n\n return methods;\n }),\n withHooks((store) => ({\n onInit() {\n store._resetState.value = getState(store);\n },\n }))\n );\n}\n\n/**\n * Sets the reset state of the store to the given state.\n *\n * Throws an error if the store is not configured with {@link withReset}.\n * @param store the instance of a SignalStore\n * @param state the state to set as the reset state\n */\nexport function setResetState<State extends object>(\n store: StateSource<State>,\n state: State\n): void {\n if (!('__setResetState__' in store)) {\n throw new Error(\n 'Cannot set reset state, since store is not configured with withReset()'\n );\n }\n (store.__setResetState__ as (state: State) => void)(state);\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":["originalPatchState","patchState"],"mappings":";;;;;;;AAEA;;AAEG;AACI,MAAM,gBAAgB,GAAwB,MAAM,CAAC,KAAK,KAAK;;ACL/D,MAAM,kBAAkB,GAAG,IAAI,GAAG,EAAU;;ACA7C,SAAU,WAAW,CAAI,GAAM,EAAA;IACnC,IAAI,GAAG,KAAK,IAAI,IAAI,GAAG,KAAK,SAAS,EAAE;AACrC,QAAA,MAAM,IAAI,KAAK,CAAC,EAAE,CAAC;;AAGrB,IAAA,OAAO,GAAG;AACZ;;ACEA,MAAM,eAAe,GAAe;AAClC,IAAA,IAAI,EAAE,MAAM,KAAK,IAAI;CACtB;AAED;;;;;;;;;;AAUG;MAEU,cAAc,CAAA;AACzB;;;AAGG;IACH,OAAO,GAAkB,EAAE;IAClB,UAAU,GAAG,iBAAiB,CAAC,MAAM,CAAC,WAAW,CAAC,CAAC;IACnD,SAAS,GAAG,EAAe;AAEpC;;;;;;;;;;;;;AAaG;IACH,aAAa,GAA2B,EAAE;IAC1C,UAAU,GAAG,CAAC;IAEL,WAAW,GAAe,IAAI,CAAC;UACpC,MAAM,CAAC;AACP,cAAE,MAAM,CAAC,4BAA4B,CAAC,OAAO,CAAC;AAC1C,gBAAA,IAAI,EAAE,kBAAkB;aACzB;AACH,cAAE;UACF,eAAe;AAEnB,IAAA,WAAA,GAAA;AACE,QAAA,IAAI,CAAC,IAAI,CAAC,UAAU,EAAE;YACpB;;QAGF,MAAM,kBAAkB,GAAG,OAAO,CAAC,MAAM,CAAC,4BAA4B,CAAC;QACvE,IAAI,CAAC,kBAAkB,EAAE;AACvB,YAAA,OAAO,CAAC,IAAI,CACV,mEAAmE,CACpE;;;IAIL,WAAW,GAAA;QACT,kBAAkB,CAAC,KAAK,EAAE;;AAG5B,IAAA,cAAc,CAAC,iBAAyC,EAAA;Q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AK,EAAE,KAAK,CAAC,WAAW,CAAC,KAAK,CAAC;aAC3C;AACD,YAAA,iBAAiB,CAAC,KAAa,EAAA;AAC7B,gBAAA,KAAK,CAAC,WAAW,CAAC,KAAK,GAAG,KAAK;aAChC;SACF;AAED,QAAA,OAAO,OAAO;KACf,CAAC,EACF,SAAS,CAAC,CAAC,KAAK,MAAM;QACpB,MAAM,GAAA;YACJ,KAAK,CAAC,WAAW,CAAC,KAAK,GAAG,QAAQ,CAAC,KAAK,CAAC;SAC1C;KACF,CAAC,CAAC,CACJ;AACH;AAEA;;;;;;AAMG;AACa,SAAA,aAAa,CAC3B,KAAyB,EACzB,KAAY,EAAA;AAEZ,IAAA,IAAI,EAAE,mBAAmB,IAAI,KAAK,CAAC,EAAE;AACnC,QAAA,MAAM,IAAI,KAAK,CACb,wEAAwE,CACzE;;AAEF,IAAA,KAAK,CAAC,iBAA4C,CAAC,KAAK,CAAC;AAC5D;;AC7DA;;AAEG;;;;"}
|
|
1
|
+
{"version":3,"file":"angular-architects-ngrx-toolkit.mjs","sources":["../../../../libs/ngrx-toolkit/src/lib/devtools/with-dev-tools-stub.ts","../../../../libs/ngrx-toolkit/src/lib/devtools/internal/current-action-names.ts","../../../../libs/ngrx-toolkit/src/lib/shared/throw-if-null.ts","../../../../libs/ngrx-toolkit/src/lib/devtools/internal/devtools-syncer.service.ts","../../../../libs/ngrx-toolkit/src/lib/devtools/internal/default-tracker.ts","../../../../libs/ngrx-toolkit/src/lib/devtools/with-devtools.ts","../../../../libs/ngrx-toolkit/src/lib/devtools/internal/devtools-feature.ts","../../../../libs/ngrx-toolkit/src/lib/devtools/features/with-disabled-name-indicies.ts","../../../../libs/ngrx-toolkit/src/lib/devtools/features/with-mapper.ts","../../../../libs/ngrx-toolkit/src/lib/devtools/internal/glitch-tracker.service.ts","../../../../libs/ngrx-toolkit/src/lib/devtools/features/with-glitch-tracking.ts","../../../../libs/ngrx-toolkit/src/lib/devtools/update-state.ts","../../../../libs/ngrx-toolkit/src/lib/devtools/rename-devtools-name.ts","../../../../libs/ngrx-toolkit/src/lib/assertions/assertions.ts","../../../../libs/ngrx-toolkit/src/lib/with-redux.ts","../../../../libs/ngrx-toolkit/src/lib/with-call-state.ts","../../../../libs/ngrx-toolkit/src/lib/with-data-service.ts","../../../../libs/ngrx-toolkit/src/lib/with-undo-redo.ts","../../../../libs/ngrx-toolkit/src/lib/with-storage-sync.ts","../../../../libs/ngrx-toolkit/src/lib/with-pagination.ts","../../../../libs/ngrx-toolkit/src/lib/with-reset.ts","../../../../libs/ngrx-toolkit/src/lib/immutable-state/deep-freeze.ts","../../../../libs/ngrx-toolkit/src/lib/immutable-state/is-dev-mode.ts","../../../../libs/ngrx-toolkit/src/lib/immutable-state/with-immutable-state.ts","../../../../libs/ngrx-toolkit/src/lib/with-feature-factory.ts","../../../../libs/ngrx-toolkit/src/lib/with-conditional.ts","../../../../libs/ngrx-toolkit/src/angular-architects-ngrx-toolkit.ts"],"sourcesContent":["import { withDevtools } from './with-devtools';\n\n/**\n * Stub for DevTools integration. Can be used to disable DevTools in production.\n */\nexport const withDevToolsStub: typeof withDevtools = () => (store) => store;\n","export const currentActionNames = new Set<string>();\n","export function throwIfNull<T>(obj: T): NonNullable<T> {\n if (obj === null || obj === undefined) {\n throw new Error('');\n }\n\n return obj;\n}\n","import { inject, Injectable, OnDestroy, PLATFORM_ID } from '@angular/core';\nimport { currentActionNames } from './current-action-names';\nimport { isPlatformBrowser } from '@angular/common';\nimport { StateSource } from '@ngrx/signals';\nimport { DevtoolsInnerOptions } from './devtools-feature';\nimport { throwIfNull } from '../../shared/throw-if-null';\nimport { Connection, StoreRegistry, Tracker } from './models';\n\nconst dummyConnection: Connection = {\n send: () => void true,\n};\n\n/**\n * A service provided by the root injector is\n * required because the synchronization runs\n * globally.\n *\n * The SignalStore could be provided in a component.\n * If the effect starts in the injection\n * context of the SignalStore, the complete sync\n * process would shut down once the component gets\n * destroyed.\n */\n@Injectable({ providedIn: 'root' })\nexport class DevtoolsSyncer implements OnDestroy {\n /**\n * Stores all SignalStores that are connected to the\n * DevTools along their options, names and id.\n */\n #stores: StoreRegistry = {};\n readonly #isBrowser = isPlatformBrowser(inject(PLATFORM_ID));\n readonly #trackers = [] as Tracker[];\n\n /**\n * Maintains the current states of all stores to avoid conflicts\n * between glitch-free and glitched trackers when used simultaneously.\n *\n * The challenge lies in ensuring that glitched trackers do not\n * interfere with the synchronization process of glitch-free trackers.\n * Specifically, glitched trackers could cause the synchronization to\n * read the current state of stores managed by glitch-free trackers.\n *\n * Therefore, the synchronization process doesn't read the state from\n * each store, but relies on #currentState.\n *\n * Please note, that here the key is the name and not the id.\n */\n #currentState: Record<string, object> = {};\n #currentId = 1;\n\n readonly #connection: Connection = this.#isBrowser\n ? window.__REDUX_DEVTOOLS_EXTENSION__\n ? window.__REDUX_DEVTOOLS_EXTENSION__.connect({\n name: 'NgRx SignalStore',\n })\n : dummyConnection\n : dummyConnection;\n\n constructor() {\n if (!this.#isBrowser) {\n return;\n }\n\n const isToolkitAvailable = Boolean(window.__REDUX_DEVTOOLS_EXTENSION__);\n if (!isToolkitAvailable) {\n console.info(\n 'NgRx Toolkit/DevTools: Redux DevTools Extension is not available.'\n );\n }\n }\n\n ngOnDestroy(): void {\n currentActionNames.clear();\n }\n\n syncToDevTools(changedStatePerId: Record<string, object>) {\n const mappedChangedStatePerName = Object.entries(changedStatePerId).reduce(\n (acc, [id, store]) => {\n const { options, name } = this.#stores[id];\n acc[name] = options.map(store);\n return acc;\n },\n {} as Record<string, object>\n );\n this.#currentState = {\n ...this.#currentState,\n ...mappedChangedStatePerName,\n };\n\n const names = Array.from(currentActionNames);\n const type = names.length ? names.join(', ') : 'Store Update';\n currentActionNames.clear();\n\n this.#connection.send({ type }, this.#currentState);\n }\n\n getNextId() {\n return String(this.#currentId++);\n }\n\n /**\n * Consumer provides the id. That is because we can only start\n * tracking the store in the init hook.\n * Unfortunately, methods for renaming having the final id\n * need to be defined already before.\n * That's why `withDevtools` requests first the id and\n * then registers itself later.\n */\n addStore(\n id: string,\n name: string,\n store: StateSource<object>,\n options: DevtoolsInnerOptions\n ) {\n let storeName = name;\n const names = Object.values(this.#stores).map((store) => store.name);\n\n if (names.includes(storeName)) {\n // const { options } = throwIfNull(\n // Object.values(this.#stores).find((store) => store.name === storeName)\n // );\n if (!options.indexNames) {\n throw new Error(`An instance of the store ${storeName} already exists. \\\nEnable automatic indexing via withDevTools('${storeName}', { indexNames: true }), or rename it upon instantiation.`);\n }\n }\n\n for (let i = 1; names.includes(storeName); i++) {\n storeName = `${name}-${i}`;\n }\n this.#stores[id] = { name: storeName, options };\n\n const tracker = options.tracker;\n if (!this.#trackers.includes(tracker)) {\n this.#trackers.push(tracker);\n }\n\n tracker.onChange((changedState) => this.syncToDevTools(changedState));\n tracker.track(id, store);\n }\n\n removeStore(id: string) {\n const name = this.#stores[id].name;\n this.#stores = Object.entries(this.#stores).reduce(\n (newStore, [storeId, value]) => {\n if (storeId !== id) {\n newStore[storeId] = value;\n }\n return newStore;\n },\n {} as StoreRegistry\n );\n\n this.#currentState = Object.entries(this.#currentState).reduce(\n (newState, [storeName, state]) => {\n if (storeName !== name) {\n newState[name] = state;\n }\n return newState;\n },\n {} as Record<string, object>\n );\n\n for (const tracker of this.#trackers) {\n tracker.removeStore(id);\n }\n }\n\n renameStore(oldName: string, newName: string) {\n const storeNames = Object.values(this.#stores).map((store) => store.name);\n const id = throwIfNull(\n Object.keys(this.#stores).find((id) => this.#stores[id].name === oldName)\n );\n if (storeNames.includes(newName)) {\n throw new Error(\n `NgRx Toolkit/DevTools: cannot rename from ${oldName} to ${newName}. ${newName} is already assigned to another SignalStore instance.`\n );\n }\n\n this.#stores = Object.entries(this.#stores).reduce(\n (newStore, [id, value]) => {\n if (value.name === oldName) {\n newStore[id] = { ...value, name: newName };\n } else {\n newStore[id] = value;\n }\n return newStore;\n },\n {} as StoreRegistry\n );\n\n // we don't rename in #currentState but wait for tracker to notify\n // us with a changed state that contains that name.\n this.#currentState = Object.entries(this.#currentState).reduce(\n (newState, [storeName, state]) => {\n if (storeName !== oldName) {\n newState[storeName] = state;\n }\n return newState;\n },\n {} as Record<string, object>\n );\n\n this.#trackers.forEach((tracker) => tracker.notifyRenamedStore(id));\n }\n}\n","import { effect, Injectable, signal } from '@angular/core';\nimport { getState, StateSource } from '@ngrx/signals';\nimport { Tracker, TrackerStores } from './models';\n\n@Injectable({ providedIn: 'root' })\nexport class DefaultTracker implements Tracker {\n readonly #stores = signal<TrackerStores>({});\n\n get stores(): TrackerStores {\n return this.#stores();\n }\n\n #trackCallback: undefined | ((changedState: Record<string, object>) => void);\n\n #trackingEffect = effect(() => {\n if (this.#trackCallback === undefined) {\n throw new Error('no callback function defined');\n }\n const stores = this.#stores();\n\n const fullState = Object.entries(stores).reduce((acc, [id, store]) => {\n return { ...acc, [id]: getState(store) };\n }, {} as Record<string, object>);\n\n this.#trackCallback(fullState);\n });\n\n track(id: string, store: StateSource<object>): void {\n this.#stores.update((value) => ({\n ...value,\n [id]: store,\n }));\n }\n\n onChange(callback: (changedState: Record<string, object>) => void): void {\n this.#trackCallback = callback;\n }\n\n removeStore(id: string) {\n this.#stores.update((stores) =>\n Object.entries(stores).reduce((newStore, [storeId, state]) => {\n if (storeId !== id) {\n newStore[storeId] = state;\n }\n return newStore;\n }, {} as TrackerStores)\n );\n }\n\n notifyRenamedStore(id: string): void {\n if (this.#stores()[id]) {\n this.#stores.update((stores) => {\n return { ...stores };\n });\n }\n }\n}\n","import { signalStoreFeature, withHooks, withMethods } from '@ngrx/signals';\nimport { inject, InjectionToken } from '@angular/core';\nimport { DevtoolsSyncer } from './internal/devtools-syncer.service';\nimport {\n DevtoolsFeature,\n DevtoolsInnerOptions,\n} from './internal/devtools-feature';\nimport { DefaultTracker } from './internal/default-tracker';\nimport { ReduxDevtoolsExtension } from './internal/models';\n\ndeclare global {\n interface Window {\n __REDUX_DEVTOOLS_EXTENSION__: ReduxDevtoolsExtension | undefined;\n }\n}\n\nexport const renameDevtoolsMethodName = '___renameDevtoolsName';\nexport const uniqueDevtoolsId = '___uniqueDevtoolsId';\n\nconst EXISTING_NAMES = new InjectionToken(\n 'Array contain existing names for the signal stores',\n { factory: () => [] as string[], providedIn: 'root' }\n);\n\n/**\n * Adds this store as a feature state to the Redux DevTools.\n *\n * By default, the action name is 'Store Update'. You can\n * change that via the {@link updateState} method, which has as second\n * parameter the action name.\n *\n * The standalone function {@link renameDevtoolsName} can rename\n * the store name.\n *\n * @param name name of the store as it should appear in the DevTools\n * @param features features to extend or modify the behavior of the Devtools\n */\nexport function withDevtools(name: string, ...features: DevtoolsFeature[]) {\n return signalStoreFeature(\n withMethods(() => {\n const syncer = inject(DevtoolsSyncer);\n\n const id = syncer.getNextId();\n\n // TODO: use withProps and symbols\n return {\n [renameDevtoolsMethodName]: (newName: string) => {\n syncer.renameStore(name, newName);\n },\n [uniqueDevtoolsId]: () => id,\n } as Record<string, (newName?: unknown) => unknown>;\n }),\n withHooks((store) => {\n const syncer = inject(DevtoolsSyncer);\n const id = String(store[uniqueDevtoolsId]());\n return {\n onInit() {\n const id = String(store[uniqueDevtoolsId]());\n const finalOptions: DevtoolsInnerOptions = {\n indexNames: !features.some((f) => f.indexNames === false),\n map: features.find((f) => f.map)?.map ?? ((state) => state),\n tracker: inject(\n features.find((f) => f.tracker)?.tracker || DefaultTracker\n ),\n };\n\n syncer.addStore(id, name, store, finalOptions);\n },\n onDestroy() {\n syncer.removeStore(id);\n },\n };\n })\n );\n}\n","import { Tracker } from './models';\n\nexport const DEVTOOLS_FEATURE = Symbol('DEVTOOLS_FEATURE');\n\nexport type Mapper = (state: object) => object;\n\nexport type DevtoolsOptions = {\n indexNames?: boolean; // defines if names should be indexed.\n map?: Mapper; // defines a mapper for the state.\n tracker?: new () => Tracker; // defines a tracker for the state\n};\n\nexport type DevtoolsInnerOptions = {\n indexNames: boolean;\n map: Mapper;\n tracker: Tracker;\n};\n\n/**\n * A DevtoolsFeature adds or modifies the behavior of the\n * devtools extension.\n *\n * We use them (function calls) instead of a config object,\n * because of tree-shaking.\n */\nexport type DevtoolsFeature = {\n [DEVTOOLS_FEATURE]: true;\n} & Partial<DevtoolsOptions>;\n\nexport function createDevtoolsFeature(\n options: DevtoolsOptions\n): DevtoolsFeature {\n return {\n [DEVTOOLS_FEATURE]: true,\n ...options,\n };\n}\n","import { createDevtoolsFeature } from '../internal/devtools-feature';\n\n/**\n * If multiple instances of the same SignalStore class\n * exist, their devtool names are indexed.\n *\n * For example:\n *\n * ```typescript\n * const Store = signalStore(\n * withDevtools('flights')\n * )\n *\n * const store1 = new Store(); // will show up as 'flights'\n * const store2 = new Store(); // will show up as 'flights-1'\n * ```\n *\n * With adding `withDisabledNameIndices` to the store:\n * ```typescript\n * const Store = signalStore(\n * withDevtools('flights', withDisabledNameIndices())\n * )\n *\n * const store1 = new Store(); // will show up as 'flights'\n * const store2 = new Store(); //💥 throws an error\n * ```\n *\n */\nexport function withDisabledNameIndices() {\n return createDevtoolsFeature({ indexNames: false });\n}\n","import { createDevtoolsFeature, Mapper } from '../internal/devtools-feature';\n\n/**\n * Allows you to define a function to map the state.\n *\n * It is needed for huge states, that slows down the Devtools and where\n * you don't need to see the whole state or other reasons.\n *\n * Example:\n *\n * ```typescript\n * const initialState = {\n * id: 1,\n * email: 'john.list@host.com',\n * name: 'John List',\n * enteredPassword: ''\n * }\n *\n * const Store = signalStore(\n * withState(initialState),\n * withDevtools(\n * 'user',\n * withMapper(state => ({...state, enteredPassword: '***' }))\n * )\n * )\n * ```\n *\n * @param map function which maps the state\n */\nexport function withMapper<State extends object>(\n map: (state: State) => Record<string, unknown>\n) {\n return createDevtoolsFeature({ map: map as Mapper });\n}\n","import { Injectable } from '@angular/core';\nimport { Tracker, TrackerStores } from './models';\nimport { getState, StateSource, watchState } from '@ngrx/signals';\nimport { throwIfNull } from '../../shared/throw-if-null';\n\ntype Stores = Record<\n string,\n { destroyWatcher: () => void; store: StateSource<object> }\n>;\n\n/**\n * Internal Service used by {@link withGlitchTracking}. It does not rely\n * on `effect` as {@link DefaultTracker} does but uses the NgRx function\n * `watchState` to track all state changes.\n */\n@Injectable({ providedIn: 'root' })\nexport class GlitchTrackerService implements Tracker {\n #stores: Stores = {};\n #callback: ((changedState: Record<string, object>) => void) | undefined;\n\n get stores() {\n return Object.entries(this.#stores).reduce((acc, [id, { store }]) => {\n acc[id] = store;\n return acc;\n }, {} as TrackerStores);\n }\n\n onChange(callback: (changedState: Record<string, object>) => void): void {\n this.#callback = callback;\n }\n\n removeStore(id: string): void {\n this.#stores = Object.entries(this.#stores).reduce(\n (newStore, [storeId, value]) => {\n if (storeId !== id) {\n newStore[storeId] = value;\n } else {\n value.destroyWatcher();\n }\n return newStore;\n },\n {} as Stores\n );\n\n throwIfNull(this.#callback)({});\n }\n\n track(id: string, store: StateSource<object>): void {\n const watcher = watchState(store, (state) => {\n throwIfNull(this.#callback)({ [id]: state });\n });\n\n this.#stores[id] = { destroyWatcher: watcher.destroy, store };\n }\n\n notifyRenamedStore(id: string): void {\n if (Object.keys(this.#stores).includes(id) && this.#callback) {\n this.#callback({ [id]: getState(this.#stores[id].store) });\n }\n }\n}\n","import { createDevtoolsFeature } from '../internal/devtools-feature';\nimport { GlitchTrackerService } from '../internal/glitch-tracker.service';\n\n/**\n * It tracks all state changes of the State, including intermediary updates\n * that are typically suppressed by Angular's glitch-free mechanism.\n *\n * This feature is especially useful for debugging.\n *\n * Example:\n *\n * ```typescript\n * const Store = signalStore(\n * { providedIn: 'root' },\n * withState({ count: 0 }),\n * withDevtools('counter', withGlitchTracking()),\n * withMethods((store) => ({\n * increase: () =>\n * patchState(store, (value) => ({ count: value.count + 1 })),\n * }))\n * );\n *\n * // would show up in the DevTools with value 0\n * const store = inject(Store);\n *\n * store.increase(); // would show up in the DevTools with value 1\n * store.increase(); // would show up in the DevTools with value 2\n * store.increase(); // would show up in the DevTools with value 3\n * ```\n *\n * Without `withGlitchTracking`, the DevTools would only show the final value of 3.\n */\nexport function withGlitchTracking() {\n return createDevtoolsFeature({ tracker: GlitchTrackerService });\n}\n","import { patchState as originalPatchState } from '@ngrx/signals';\nimport { PartialStateUpdater, WritableStateSource } from '@ngrx/signals';\nimport { Prettify } from '../shared/prettify';\nimport { currentActionNames } from './internal/current-action-names';\n\ntype PatchFn = typeof originalPatchState extends (\n arg1: infer First,\n ...args: infer Rest\n) => infer Returner\n ? (state: First, action: string, ...rest: Rest) => Returner\n : never;\n\n/**\n * @deprecated Has been renamed to `updateState`\n */\nexport const patchState: PatchFn = (state, action, ...rest) => {\n updateState(state, action, ...rest);\n};\n\n/**\n * Wrapper of `patchState` for DevTools integration. Next to updating the state,\n * it also sends the action to the DevTools.\n * @param stateSource state of Signal Store\n * @param action name of action how it will show in DevTools\n * @param updaters updater functions or objects\n */\nexport function updateState<State extends object>(\n stateSource: WritableStateSource<State>,\n action: string,\n ...updaters: Array<\n Partial<Prettify<State>> | PartialStateUpdater<Prettify<State>>\n >\n): void {\n currentActionNames.add(action);\n return originalPatchState(stateSource, ...updaters);\n}\n","import { StateSource } from '@ngrx/signals';\nimport { renameDevtoolsMethodName } from './with-devtools';\n\n/**\n * Renames the name of a store how it appears in the Devtools.\n * @param store instance of the SignalStore\n * @param newName new name for the Devtools\n */\nexport function renameDevtoolsName<State extends object>(\n store: StateSource<State>,\n newName: string\n): void {\n const renameMethod = (store as Record<string, (newName: string) => void>)[\n renameDevtoolsMethodName\n ];\n if (!renameMethod) {\n throw new Error(\"Devtools extensions haven't been added to this store.\");\n }\n\n renameMethod(newName);\n}\n","import { ActionsFnSpecs } from '../with-redux';\n\nexport function assertActionFnSpecs(\n obj: unknown\n): asserts obj is ActionsFnSpecs {\n if (!obj || typeof obj !== 'object') {\n throw new Error('%o is not an Action Specification');\n }\n}\n","import { Observable, Subject } from 'rxjs';\nimport {\n EmptyFeatureResult,\n SignalStoreFeature,\n SignalStoreFeatureResult,\n WritableStateSource,\n} from '@ngrx/signals';\nimport { assertActionFnSpecs } from './assertions/assertions';\n\n/** Actions **/\n\ntype Payload = Record<string, unknown>;\n\ntype ActionFn<\n Type extends string = string,\n ActionPayload extends Payload = Payload\n> = ((payload: ActionPayload) => ActionPayload & { type: Type }) & {\n type: Type;\n};\n\ntype ActionFns = Record<string, ActionFn>;\n\nexport type ActionsFnSpecs = Record<string, Payload>;\n\ntype ActionFnCreator<Spec extends ActionsFnSpecs> = {\n [ActionName in keyof Spec]: (Record<never, never> extends Spec[ActionName]\n ? () => Spec[ActionName] & { type: ActionName }\n : (\n payload: Spec[ActionName]\n ) => Spec[ActionName] & { type: ActionName }) & {\n type: ActionName & string;\n };\n};\n\ntype ActionFnPayload<Action> = Action extends (payload: infer Payload) => void\n ? Payload\n : never;\n\ntype ActionFnsCreator<Spec extends ActionsFnSpecs> = Spec extends {\n private: Record<string, Payload>;\n public: Record<string, Payload>;\n}\n ? ActionFnCreator<Spec['private']> & ActionFnCreator<Spec['public']>\n : ActionFnCreator<Spec>;\n\ntype PublicActionFns<Spec extends ActionsFnSpecs> = Spec extends {\n public: Record<string, Payload>;\n}\n ? ActionFnCreator<Spec['public']>\n : ActionFnCreator<Spec>;\n\nexport function payload<Type extends Payload>(): Type {\n return {} as Type;\n}\n\nexport const noPayload = {};\n\n/** Reducer **/\n\ntype ReducerFunction<ReducerAction, State> = (\n state: State,\n action: ActionFnPayload<ReducerAction>\n) => void;\n\ntype ReducerFactory<StateActionFns extends ActionFns, State> = (\n actions: StateActionFns,\n on: <ReducerAction extends { type: string }>(\n action: ReducerAction,\n reducerFn: ReducerFunction<ReducerAction, State>\n ) => void\n) => void;\n\n/**\n * Creates a reducer function to separate the reducer logic into another file.\n *\n * ```typescript\n * interface FlightState {\n * flights: Flight[];\n * effect1: boolean;\n * effect2: boolean;\n * }\n *\n * const initialState: FlightState = {\n * flights: [],\n * effect1: false,\n * effect2: false,\n * };\n *\n * const actions = {\n * init: noPayload,\n * updateEffect1: payload<{ value: boolean }>(),\n * updateEffect2: payload<{ value: boolean }>(),\n * };\n *\n * const reducer = createReducer<FlightState, typeof actions>((actions, on) => {\n * on(actions.updateEffect1, (state, { value }) => {\n * patchState(state, { effect1: value });\n * });\n *\n * on(actions.updateEffect2, (state, { value }) => {\n * patchState(state, { effect2: value });\n * });\n * });\n *\n * signalStore(\n * withState(initialState),\n * withRedux({\n * actions,\n * reducer,\n * })\n * );\n * ```\n * @param reducerFactory\n */\nexport function createReducer<\n State extends object,\n Actions extends ActionsFnSpecs\n>(\n reducerFactory: ReducerFactory<\n ActionFnsCreator<Actions>,\n WritableStateSource<State>\n >\n) {\n return reducerFactory;\n}\n\n/** Effect **/\n\ntype EffectsFactory<StateActionFns extends ActionFns> = (\n actions: StateActionFns,\n create: <EffectAction extends { type: string }>(\n action: EffectAction\n ) => Observable<ActionFnPayload<EffectAction>>\n) => Record<string, Observable<unknown>>;\n\n/**\n * Creates the effects function to separate the effects logic into another file.\n *\n * ```typescript\n * interface FlightState {\n * flights: Flight[];\n * effect1: boolean;\n * effect2: boolean;\n * }\n *\n * const initialState: FlightState = {\n * flights: [],\n * effect1: false,\n * effect2: false,\n * };\n *\n * const actions = {\n * init: noPayload,\n * updateEffect1: payload<{ value: boolean }>(),\n * updateEffect2: payload<{ value: boolean }>(),\n * };\n *\n * const effects = createEffects(actions, (actions, create) => {\n * return {\n * init1$: create(actions.init).pipe(\n * map(() => actions.updateEffect1({ value: true }))\n * ),\n * init2$: create(actions.init).pipe(\n * map(() => actions.updateEffect2({ value: true }))\n * ),\n * };\n * });\n *\n * signalStore(\n * withState(initialState),\n * withRedux({\n * actions,\n * effects,\n * })\n * );\n * ```\n * @param actions\n * @param effectsFactory\n */\nexport function createEffects<Actions extends ActionsFnSpecs>(\n actions: Actions,\n effectsFactory: EffectsFactory<ActionFnsCreator<Actions>>\n) {\n return effectsFactory;\n}\n\n// internal types\n\n/**\n * Record which holds all effects for a specific action type.\n * The values are Subject which the effect are subscribed to.\n * `createActionFns` will call next on these subjects.\n */\ntype EffectsRegistry = Record<string, Subject<ActionFnPayload<unknown>>[]>;\n\nfunction createActionFns<Spec extends ActionsFnSpecs>(\n actionFnSpecs: Spec,\n reducerRegistry: Record<\n string,\n (state: unknown, payload: ActionFnPayload<unknown>) => void\n >,\n effectsRegistry: EffectsRegistry,\n state: unknown\n) {\n const actionFns: Record<string, ActionFn> = {};\n\n for (const type in actionFnSpecs) {\n const actionFn = (payload: Payload) => {\n const fullPayload = { ...payload, type };\n const reducer = reducerRegistry[type];\n if (reducer) {\n (reducer as (state: unknown, payload: unknown) => void)(\n state,\n fullPayload as unknown\n );\n }\n const effectSubjects = effectsRegistry[type];\n if (effectSubjects?.length) {\n for (const effectSubject of effectSubjects) {\n (effectSubject as unknown as Subject<unknown>).next(fullPayload);\n }\n }\n return fullPayload;\n };\n actionFn.type = type.toString();\n actionFns[type] = actionFn;\n }\n\n return actionFns;\n}\n\nfunction createPublicAndAllActionsFns<Spec extends ActionsFnSpecs>(\n actionFnSpecs: Spec,\n reducerRegistry: Record<\n string,\n (state: unknown, payload: ActionFnPayload<unknown>) => void\n >,\n effectsRegistry: EffectsRegistry,\n state: unknown\n): { all: ActionFns; publics: ActionFns } {\n if ('public' in actionFnSpecs || 'private' in actionFnSpecs) {\n const privates = actionFnSpecs['private'] || {};\n const publics = actionFnSpecs['public'] || {};\n\n assertActionFnSpecs(privates);\n assertActionFnSpecs(publics);\n\n const privateActionFns = createActionFns(\n privates,\n reducerRegistry,\n effectsRegistry,\n state\n );\n const publicActionFns = createActionFns(\n publics,\n reducerRegistry,\n effectsRegistry,\n state\n );\n\n return {\n all: { ...privateActionFns, ...publicActionFns },\n publics: publicActionFns,\n };\n }\n\n const actionFns = createActionFns(\n actionFnSpecs,\n reducerRegistry,\n effectsRegistry,\n state\n );\n\n return { all: actionFns, publics: actionFns };\n}\n\nfunction fillReducerRegistry(\n reducer: ReducerFactory<ActionFns, unknown>,\n actionFns: ActionFns,\n reducerRegistry: Record<\n string,\n (state: unknown, payload: ActionFnPayload<unknown>) => void\n >\n) {\n function on(\n action: { type: string },\n reducerFn: (state: unknown, payload: ActionFnPayload<unknown>) => void\n ) {\n reducerRegistry[action.type] = reducerFn;\n }\n\n reducer(actionFns, on);\n\n return reducerRegistry;\n}\n\nfunction fillEffects(\n effects: EffectsFactory<ActionFns>,\n actionFns: ActionFns,\n effectsRegistry: EffectsRegistry = {}\n): Observable<unknown>[] {\n function create(action: { type: string }) {\n const subject = new Subject<ActionFnPayload<unknown>>();\n if (!(action.type in effectsRegistry)) {\n effectsRegistry[action.type] = [];\n }\n effectsRegistry[action.type].push(subject);\n return subject.asObservable();\n }\n\n const effectObservables = effects(actionFns, create);\n return Object.values(effectObservables);\n}\n\nfunction startSubscriptions(observables: Observable<unknown>[]) {\n return observables.map((observable) => observable.subscribe());\n}\n\nfunction processRedux<Spec extends ActionsFnSpecs, ReturnType>(\n actionFnSpecs: Spec,\n reducer: ReducerFactory<ActionFns, unknown>,\n effects: EffectsFactory<ActionFns>,\n store: unknown\n) {\n const reducerRegistry: Record<\n string,\n (state: unknown, payload: ActionFnPayload<unknown>) => void\n > = {};\n const effectsRegistry: Record<string, Subject<ActionFnPayload<unknown>>[]> =\n {};\n const actionsMap = createPublicAndAllActionsFns(\n actionFnSpecs,\n reducerRegistry,\n effectsRegistry,\n store\n );\n const actionFns = actionsMap.all;\n const publicActionsFns = actionsMap.publics;\n\n fillReducerRegistry(reducer, actionFns, reducerRegistry);\n const effectObservables = fillEffects(effects, actionFns, effectsRegistry);\n const subscriptions = startSubscriptions(effectObservables);\n\n return {\n methods: publicActionsFns as ReturnType,\n subscriptions: subscriptions,\n };\n}\n\n/**\n * @param redux redux\n *\n * properties do not start with `with` since they are not extension functions on their own.\n *\n * no dependency to NgRx\n *\n * actions are passed to reducer and effects, but it is also possible to use other actions.\n * effects provide forAction and do not return anything. that is important because effects should stay inaccessible\n */\nexport function withRedux<\n Spec extends ActionsFnSpecs,\n Input extends SignalStoreFeatureResult,\n StateActionFns extends ActionFnsCreator<Spec> = ActionFnsCreator<Spec>,\n PublicStoreActionFns extends PublicActionFns<Spec> = PublicActionFns<Spec>\n>(redux: {\n actions: Spec;\n reducer: ReducerFactory<StateActionFns, WritableStateSource<Input['state']>>;\n effects: EffectsFactory<StateActionFns>;\n}): SignalStoreFeature<\n Input,\n EmptyFeatureResult & { methods: PublicStoreActionFns }\n> {\n return (store) => {\n const { methods } = processRedux<Spec, PublicStoreActionFns>(\n redux.actions,\n redux.reducer as ReducerFactory<ActionFns, unknown>,\n redux.effects as EffectsFactory<ActionFns>,\n store\n );\n return {\n ...store,\n methods: { ...store.methods, ...methods },\n };\n };\n}\n","import { Signal, computed } from '@angular/core';\nimport {\n EmptyFeatureResult,\n SignalStoreFeature,\n signalStoreFeature,\n withComputed,\n withState,\n} from '@ngrx/signals';\n\nexport type CallState = 'init' | 'loading' | 'loaded' | { error: string };\n\nexport type CallStateSlice = {\n callState: CallState;\n};\n\nexport type NamedCallStateSlice<Collection extends string> = {\n [K in keyof CallStateSlice as `${Collection}${Capitalize<K>}`]: CallStateSlice[K];\n};\n\nexport type CallStateSignals = {\n loading: Signal<boolean>;\n loaded: Signal<boolean>;\n error: Signal<string | null>;\n};\n\nexport type NamedCallStateSignals<Prop extends string> = {\n [K in keyof CallStateSignals as `${Prop}${Capitalize<K>}`]: CallStateSignals[K];\n};\n\nexport type SetCallState<Prop extends string | undefined> = Prop extends string\n ? NamedCallStateSlice<Prop>\n : CallStateSlice;\n\nexport function getCallStateKeys(config?: { collection?: string }) {\n const prop = config?.collection;\n return {\n callStateKey: prop ? `${config.collection}CallState` : 'callState',\n loadingKey: prop ? `${config.collection}Loading` : 'loading',\n loadedKey: prop ? `${config.collection}Loaded` : 'loaded',\n errorKey: prop ? `${config.collection}Error` : 'error',\n };\n}\n\nexport function withCallState<Collection extends string>(config: {\n collection: Collection;\n}): SignalStoreFeature<\n EmptyFeatureResult,\n EmptyFeatureResult & {\n state: NamedCallStateSlice<Collection>;\n props: NamedCallStateSignals<Collection>;\n }\n>;\nexport function withCallState(): SignalStoreFeature<\n EmptyFeatureResult,\n EmptyFeatureResult & {\n state: CallStateSlice;\n props: CallStateSignals;\n }\n>;\nexport function withCallState<Collection extends string>(config?: {\n collection: Collection;\n}): SignalStoreFeature {\n const { callStateKey, errorKey, loadedKey, loadingKey } =\n getCallStateKeys(config);\n\n return signalStoreFeature(\n withState({ [callStateKey]: 'init' }),\n withComputed((state: Record<string, Signal<unknown>>) => {\n const callState = state[callStateKey] as Signal<CallState>;\n\n return {\n [loadingKey]: computed(() => callState() === 'loading'),\n [loadedKey]: computed(() => callState() === 'loaded'),\n [errorKey]: computed(() => {\n const v = callState();\n return typeof v === 'object' ? v.error : null;\n }),\n };\n })\n );\n}\n\nexport function setLoading<Prop extends string | undefined = undefined>(\n prop?: Prop\n): SetCallState<Prop> {\n if (prop) {\n return { [`${prop}CallState`]: 'loading' } as SetCallState<Prop>;\n }\n\n return { callState: 'loading' } as SetCallState<Prop>;\n}\n\nexport function setLoaded<Prop extends string | undefined = undefined>(\n prop?: Prop\n): SetCallState<Prop> {\n if (prop) {\n return { [`${prop}CallState`]: 'loaded' } as SetCallState<Prop>;\n } else {\n return { callState: 'loaded' } as SetCallState<Prop>;\n }\n}\n\nexport function setError<Prop extends string | undefined = undefined>(\n error: unknown,\n prop?: Prop\n): SetCallState<Prop> {\n let errorMessage: string;\n\n if (!error) {\n errorMessage = '';\n } else if (typeof error === 'object' && 'message' in error) {\n errorMessage = String(error.message);\n } else {\n errorMessage = String(error);\n }\n\n if (prop) {\n return {\n [`${prop}CallState`]: { error: errorMessage },\n } as SetCallState<Prop>;\n } else {\n return { callState: { error: errorMessage } } as SetCallState<Prop>;\n }\n}\n","import { ProviderToken, Signal, computed, inject } from '@angular/core';\nimport {\n SignalStoreFeature,\n patchState,\n signalStoreFeature,\n withComputed,\n withMethods,\n withState,\n EmptyFeatureResult,\n WritableStateSource,\n} from '@ngrx/signals';\nimport {\n CallState,\n getCallStateKeys,\n setError,\n setLoaded,\n setLoading,\n} from './with-call-state';\nimport {\n setAllEntities,\n EntityId,\n addEntity,\n updateEntity,\n removeEntity,\n} from '@ngrx/signals/entities';\nimport { EntityState, NamedEntityComputed } from './shared/signal-store-models';\n\nexport type Filter = Record<string, unknown>;\nexport type Entity = { id: EntityId };\n\nexport interface DataService<E extends Entity, F extends Filter> {\n load(filter: F): Promise<E[]>;\n\n loadById(id: EntityId): Promise<E>;\n\n create(entity: E): Promise<E>;\n\n update(entity: E): Promise<E>;\n\n updateAll(entity: E[]): Promise<E[]>;\n\n delete(entity: E): Promise<void>;\n}\n\nexport function capitalize(str: string): string {\n return str ? str[0].toUpperCase() + str.substring(1) : str;\n}\n\nexport function getDataServiceKeys(options: { collection?: string }) {\n const filterKey = options.collection\n ? `${options.collection}Filter`\n : 'filter';\n const selectedIdsKey = options.collection\n ? `selected${capitalize(options.collection)}Ids`\n : 'selectedIds';\n const selectedEntitiesKey = options.collection\n ? `selected${capitalize(options.collection)}Entities`\n : 'selectedEntities';\n\n const updateFilterKey = options.collection\n ? `update${capitalize(options.collection)}Filter`\n : 'updateFilter';\n const updateSelectedKey = options.collection\n ? `updateSelected${capitalize(options.collection)}Entities`\n : 'updateSelected';\n const loadKey = options.collection\n ? `load${capitalize(options.collection)}Entities`\n : 'load';\n\n const currentKey = options.collection\n ? `current${capitalize(options.collection)}`\n : 'current';\n const loadByIdKey = options.collection\n ? `load${capitalize(options.collection)}ById`\n : 'loadById';\n const setCurrentKey = options.collection\n ? `setCurrent${capitalize(options.collection)}`\n : 'setCurrent';\n const createKey = options.collection\n ? `create${capitalize(options.collection)}`\n : 'create';\n const updateKey = options.collection\n ? `update${capitalize(options.collection)}`\n : 'update';\n const updateAllKey = options.collection\n ? `updateAll${capitalize(options.collection)}`\n : 'updateAll';\n const deleteKey = options.collection\n ? `delete${capitalize(options.collection)}`\n : 'delete';\n\n // TODO: Take these from @ngrx/signals/entities, when they are exported\n const entitiesKey = options.collection\n ? `${options.collection}Entities`\n : 'entities';\n const entityMapKey = options.collection\n ? `${options.collection}EntityMap`\n : 'entityMap';\n const idsKey = options.collection ? `${options.collection}Ids` : 'ids';\n\n return {\n filterKey,\n selectedIdsKey,\n selectedEntitiesKey,\n updateFilterKey,\n updateSelectedKey,\n loadKey,\n entitiesKey,\n entityMapKey,\n idsKey,\n\n currentKey,\n loadByIdKey,\n setCurrentKey,\n createKey,\n updateKey,\n updateAllKey,\n deleteKey,\n };\n}\n\nexport type NamedDataServiceState<\n E extends Entity,\n F extends Filter,\n Collection extends string\n> = {\n [K in Collection as `${K}Filter`]: F;\n} & {\n [K in Collection as `selected${Capitalize<K>}Ids`]: Record<EntityId, boolean>;\n} & {\n [K in Collection as `current${Capitalize<K>}`]: E;\n};\n\nexport type DataServiceState<E extends Entity, F extends Filter> = {\n filter: F;\n selectedIds: Record<EntityId, boolean>;\n current: E;\n};\n\nexport type DataServiceComputed<E extends Entity> = {\n selectedEntities: Signal<E[]>;\n};\n\nexport type NamedDataServiceComputed<\n E extends Entity,\n Collection extends string\n> = {\n [K in Collection as `selected${Capitalize<K>}Entities`]: Signal<E[]>;\n};\n\nexport type NamedDataServiceMethods<\n E extends Entity,\n F extends Filter,\n Collection extends string\n> = {\n [K in Collection as `update${Capitalize<K>}Filter`]: (filter: F) => void;\n} & {\n [K in Collection as `updateSelected${Capitalize<K>}Entities`]: (\n id: EntityId,\n selected: boolean\n ) => void;\n} & {\n [K in Collection as `load${Capitalize<K>}Entities`]: () => Promise<void>;\n} & {\n [K in Collection as `setCurrent${Capitalize<K>}`]: (entity: E) => void;\n} & {\n [K in Collection as `load${Capitalize<K>}ById`]: (\n id: EntityId\n ) => Promise<void>;\n} & {\n [K in Collection as `create${Capitalize<K>}`]: (entity: E) => Promise<void>;\n} & {\n [K in Collection as `update${Capitalize<K>}`]: (entity: E) => Promise<void>;\n} & {\n [K in Collection as `updateAll${Capitalize<K>}`]: (\n entity: E[]\n ) => Promise<void>;\n} & {\n [K in Collection as `delete${Capitalize<K>}`]: (entity: E) => Promise<void>;\n};\n\nexport type DataServiceMethods<E extends Entity, F extends Filter> = {\n updateFilter: (filter: F) => void;\n updateSelected: (id: EntityId, selected: boolean) => void;\n load: () => Promise<void>;\n\n setCurrent(entity: E): void;\n loadById(id: EntityId): Promise<void>;\n create(entity: E): Promise<void>;\n update(entity: E): Promise<void>;\n updateAll(entities: E[]): Promise<void>;\n delete(entity: E): Promise<void>;\n};\n\nexport function withDataService<\n E extends Entity,\n F extends Filter,\n Collection extends string\n>(options: {\n dataServiceType: ProviderToken<DataService<E, F>>;\n filter: F;\n collection: Collection;\n}): SignalStoreFeature<\n // These alternatives break type inference:\n // state: { callState: CallState } & NamedEntityState<E, Collection>,\n // state: NamedEntityState<E, Collection>,\n EmptyFeatureResult & { props: NamedEntityComputed<E, Collection> },\n {\n state: NamedDataServiceState<E, F, Collection>;\n props: NamedDataServiceComputed<E, Collection>;\n methods: NamedDataServiceMethods<E, F, Collection>;\n }\n>;\nexport function withDataService<E extends Entity, F extends Filter>(options: {\n dataServiceType: ProviderToken<DataService<E, F>>;\n filter: F;\n}): SignalStoreFeature<\n EmptyFeatureResult & { state: { callState: CallState } & EntityState<E> },\n {\n state: DataServiceState<E, F>;\n props: DataServiceComputed<E>;\n methods: DataServiceMethods<E, F>;\n }\n>;\n\nexport function withDataService<\n E extends Entity,\n F extends Filter,\n Collection extends string\n>(options: {\n dataServiceType: ProviderToken<DataService<E, F>>;\n filter: F;\n collection?: Collection;\n}): /* eslint-disable @typescript-eslint/no-explicit-any */\nSignalStoreFeature<any, any> {\n const { dataServiceType, filter, collection: prefix } = options;\n const {\n entitiesKey,\n filterKey,\n loadKey,\n selectedEntitiesKey,\n selectedIdsKey,\n updateFilterKey,\n updateSelectedKey,\n\n currentKey,\n createKey,\n updateKey,\n updateAllKey,\n deleteKey,\n loadByIdKey,\n setCurrentKey,\n } = getDataServiceKeys(options);\n\n const { callStateKey } = getCallStateKeys({ collection: prefix });\n\n return signalStoreFeature(\n withState(() => ({\n [filterKey]: filter,\n [selectedIdsKey]: {} as Record<EntityId, boolean>,\n [currentKey]: undefined as E | undefined,\n })),\n withComputed((store: Record<string, unknown>) => {\n const entities = store[entitiesKey] as Signal<E[]>;\n const selectedIds = store[selectedIdsKey] as Signal<\n Record<EntityId, boolean>\n >;\n\n return {\n [selectedEntitiesKey]: computed(() =>\n entities().filter((e) => selectedIds()[e.id])\n ),\n };\n }),\n withMethods(\n (store: Record<string, unknown> & WritableStateSource<object>) => {\n const dataService = inject(dataServiceType);\n return {\n [updateFilterKey]: (filter: F): void => {\n patchState(store, { [filterKey]: filter });\n },\n [updateSelectedKey]: (id: EntityId, selected: boolean): void => {\n patchState(store, (state: Record<string, unknown>) => ({\n [selectedIdsKey]: {\n ...(state[selectedIdsKey] as Record<EntityId, boolean>),\n [id]: selected,\n },\n }));\n },\n [loadKey]: async (): Promise<void> => {\n const filter = store[filterKey] as Signal<F>;\n (() =>\n store[callStateKey] && patchState(store, setLoading(prefix)))();\n\n try {\n const result = await dataService.load(filter());\n patchState(\n store,\n prefix\n ? setAllEntities(result, { collection: prefix })\n : setAllEntities(result)\n );\n (() =>\n store[callStateKey] && patchState(store, setLoaded(prefix)))();\n } catch (e) {\n (() =>\n store[callStateKey] &&\n patchState(store, setError(e, prefix)))();\n throw e;\n }\n },\n [loadByIdKey]: async (id: EntityId): Promise<void> => {\n (() =>\n store[callStateKey] && patchState(store, setLoading(prefix)))();\n\n try {\n const current = await dataService.loadById(id);\n (() =>\n store[callStateKey] && patchState(store, setLoaded(prefix)))();\n patchState(store, { [currentKey]: current });\n } catch (e) {\n (() =>\n store[callStateKey] &&\n patchState(store, setError(e, prefix)))();\n throw e;\n }\n },\n [setCurrentKey]: (current: E): void => {\n patchState(store, { [currentKey]: current });\n },\n [createKey]: async (entity: E): Promise<void> => {\n patchState(store, { [currentKey]: entity });\n (() =>\n store[callStateKey] && patchState(store, setLoading(prefix)))();\n\n try {\n const created = await dataService.create(entity);\n patchState(store, { [currentKey]: created });\n patchState(\n store,\n prefix\n ? addEntity(created, { collection: prefix })\n : addEntity(created)\n );\n (() =>\n store[callStateKey] && patchState(store, setLoaded(prefix)))();\n } catch (e) {\n (() =>\n store[callStateKey] &&\n patchState(store, setError(e, prefix)))();\n throw e;\n }\n },\n [updateKey]: async (entity: E): Promise<void> => {\n patchState(store, { [currentKey]: entity });\n (() =>\n store[callStateKey] && patchState(store, setLoading(prefix)))();\n\n try {\n const updated = await dataService.update(entity);\n patchState(store, { [currentKey]: updated });\n\n const updateArg = {\n id: updated.id,\n changes: updated,\n };\n\n const updater = (collection: string) =>\n updateEntity(updateArg, { collection });\n\n patchState(\n store,\n prefix ? updater(prefix) : updateEntity(updateArg)\n );\n (() =>\n store[callStateKey] && patchState(store, setLoaded(prefix)))();\n } catch (e) {\n (() =>\n store[callStateKey] &&\n patchState(store, setError(e, prefix)))();\n throw e;\n }\n },\n [updateAllKey]: async (entities: E[]): Promise<void> => {\n (() =>\n store[callStateKey] && patchState(store, setLoading(prefix)))();\n\n try {\n const result = await dataService.updateAll(entities);\n patchState(\n store,\n prefix\n ? setAllEntities(result, { collection: prefix })\n : setAllEntities(result)\n );\n (() =>\n store[callStateKey] && patchState(store, setLoaded(prefix)))();\n } catch (e) {\n (() =>\n store[callStateKey] &&\n patchState(store, setError(e, prefix)))();\n throw e;\n }\n },\n [deleteKey]: async (entity: E): Promise<void> => {\n patchState(store, { [currentKey]: entity });\n (() =>\n store[callStateKey] && patchState(store, setLoading(prefix)))();\n\n try {\n await dataService.delete(entity);\n patchState(store, { [currentKey]: undefined });\n patchState(\n store,\n prefix\n ? removeEntity(entity.id, { collection: prefix })\n : removeEntity(entity.id)\n );\n (() =>\n store[callStateKey] && patchState(store, setLoaded(prefix)))();\n } catch (e) {\n (() =>\n store[callStateKey] &&\n patchState(store, setError(e, prefix)))();\n throw e;\n }\n },\n };\n }\n )\n );\n}\n","import {\n SignalStoreFeature,\n patchState,\n signalStoreFeature,\n withComputed,\n withHooks,\n withMethods,\n EmptyFeatureResult, SignalStoreFeatureResult\n} from '@ngrx/signals';\nimport { Signal, effect, signal, untracked, isSignal } from '@angular/core';\nimport { capitalize } from './with-data-service';\n\nexport type StackItem = Record<string, unknown>;\n\nexport type NormalizedUndoRedoOptions = {\n maxStackSize: number;\n collections?: string[];\n keys: string[];\n skip: number,\n};\n\nconst defaultOptions: NormalizedUndoRedoOptions = {\n maxStackSize: 100,\n keys: [],\n skip: 0,\n};\n\nexport function getUndoRedoKeys(collections?: string[]): string[] {\n if (collections) {\n return collections.flatMap((c) => [\n `${c}EntityMap`,\n `${c}Ids`,\n `selected${capitalize(c)}Ids`,\n `${c}Filter`,\n ]);\n }\n return ['entityMap', 'ids', 'selectedIds', 'filter'];\n}\n\ntype NonNever<T> = T extends never ? never : T;\n\ntype ExtractEntityCollection<T> = T extends `${infer U}Entities` ? U : never;\n\ntype ExtractEntityCollections<Store extends SignalStoreFeatureResult> = NonNever<{\n [K in keyof Store['props']]: ExtractEntityCollection<K>;\n}[keyof Store['props']]>;\n\ntype OptionsForState<Store extends SignalStoreFeatureResult> = Partial<Omit<NormalizedUndoRedoOptions, 'collections' | 'keys'>> & {\n collections?: ExtractEntityCollections<Store>[];\n keys?: (keyof Store['state'])[];\n};\n\nexport function withUndoRedo<\n Input extends EmptyFeatureResult>(options?: OptionsForState<Input>): SignalStoreFeature<\n Input,\n EmptyFeatureResult & {\n props: {\n canUndo: Signal<boolean>;\n canRedo: Signal<boolean>;\n };\n methods: {\n undo: () => void;\n redo: () => void;\n clearStack: () => void;\n };\n}\n> {\n let previous: StackItem | null = null;\n let skipOnce = false;\n\n const normalized = {\n ...defaultOptions,\n ...options,\n };\n\n //\n // Design Decision: This feature has its own\n // internal state.\n //\n\n const undoStack: StackItem[] = [];\n const redoStack: StackItem[] = [];\n\n const canUndo = signal(false);\n const canRedo = signal(false);\n\n const updateInternal = () => {\n canUndo.set(undoStack.length !== 0);\n canRedo.set(redoStack.length !== 0);\n };\n\n const keys = [...getUndoRedoKeys(normalized.collections), ...normalized.keys];\n\n return signalStoreFeature(\n withComputed(() => ({\n canUndo: canUndo.asReadonly(),\n canRedo: canRedo.asReadonly(),\n })),\n withMethods((store) => ({\n undo(): void {\n const item = undoStack.pop();\n\n if (item && previous) {\n redoStack.push(previous);\n }\n\n if (item) {\n skipOnce = true;\n patchState(store, item);\n previous = item;\n }\n\n updateInternal();\n },\n redo(): void {\n const item = redoStack.pop();\n\n if (item && previous) {\n undoStack.push(previous);\n }\n\n if (item) {\n skipOnce = true;\n patchState(store, item);\n previous = item;\n }\n\n updateInternal();\n },\n clearStack(): void {\n undoStack.splice(0);\n redoStack.splice(0);\n updateInternal();\n },\n })),\n withHooks({\n onInit(store) {\n effect(() => {\n const cand = keys.reduce((acc, key) => {\n const s = (store as Record<string | keyof Input['state'], unknown>)[key];\n if (s && isSignal(s)) {\n return {\n ...acc,\n [key]: s(),\n };\n }\n return acc;\n }, {});\n\n if (normalized.skip > 0) {\n normalized.skip--;\n return;\n }\n\n if (skipOnce) {\n skipOnce = false;\n return;\n }\n\n //\n // Deep Comparison to prevent duplicated entries\n // on the stack. This can e.g. happen after an undo\n // if the component sends back the undone filter\n // to the store.\n //\n if (JSON.stringify(cand) === JSON.stringify(previous)) {\n return;\n }\n\n // Clear redoStack after recorded action\n redoStack.splice(0);\n\n if (previous) {\n undoStack.push(previous);\n }\n\n if (redoStack.length > normalized.maxStackSize) {\n undoStack.unshift();\n }\n\n previous = cand;\n\n // Don't propogate current reactive context\n untracked(() => updateInternal());\n });\n },\n })\n );\n}\n","import { isPlatformServer } from '@angular/common';\nimport { PLATFORM_ID, effect, inject } from '@angular/core';\nimport {\n SignalStoreFeature,\n getState,\n patchState,\n signalStoreFeature,\n withHooks,\n withMethods,\n SignalStoreFeatureResult,\n EmptyFeatureResult,\n} from '@ngrx/signals';\n\nconst NOOP = () => void true;\n\ntype WithStorageSyncFeatureResult = EmptyFeatureResult & {\n methods: {\n clearStorage(): void;\n readFromStorage(): void;\n writeToStorage(): void;\n };\n};\n\nconst StorageSyncStub: Pick<\n WithStorageSyncFeatureResult,\n 'methods'\n>['methods'] = {\n clearStorage: NOOP,\n readFromStorage: NOOP,\n writeToStorage: NOOP,\n};\n\nexport type SyncConfig<State> = {\n /**\n * The key which is used to access the storage.\n */\n key: string;\n /**\n * Flag indicating if the store should read from storage on init and write to storage on every state change.\n *\n * `true` by default\n */\n autoSync?: boolean;\n /**\n * Function to select that portion of the state which should be stored.\n *\n * Returns the whole state object by default\n */\n select?: (state: State) => Partial<State>;\n /**\n * Function used to parse the state coming from storage.\n *\n * `JSON.parse()` by default\n */\n parse?: (stateString: string) => State;\n /**\n * Function used to tranform the state into a string representation.\n *\n * `JSON.stringify()` by default\n */\n stringify?: (state: State) => string;\n /**\n * Factory function used to select the storage.\n *\n * `localstorage` by default\n */\n storage?: () => Storage;\n};\n\n/**\n * Enables store synchronization with storage.\n *\n * Only works on browser platform.\n */\nexport function withStorageSync<Input extends SignalStoreFeatureResult>(\n key: string\n): SignalStoreFeature<Input, WithStorageSyncFeatureResult>;\nexport function withStorageSync<Input extends SignalStoreFeatureResult>(\n config: SyncConfig<Input['state']>\n): SignalStoreFeature<Input, WithStorageSyncFeatureResult>;\nexport function withStorageSync<\n State extends object,\n Input extends SignalStoreFeatureResult\n>(\n configOrKey: SyncConfig<Input['state']> | string\n): SignalStoreFeature<Input, WithStorageSyncFeatureResult> {\n const {\n key,\n autoSync = true,\n select = (state: State) => state,\n parse = JSON.parse,\n stringify = JSON.stringify,\n storage: storageFactory = () => localStorage,\n } = typeof configOrKey === 'string' ? { key: configOrKey } : configOrKey;\n\n return signalStoreFeature(\n withMethods((store, platformId = inject(PLATFORM_ID)) => {\n if (isPlatformServer(platformId)) {\n console.warn(\n `'withStorageSync' provides non-functional implementation due to server-side execution`\n );\n return StorageSyncStub;\n }\n\n const storage = storageFactory();\n\n return {\n /**\n * Removes the item stored in storage.\n */\n clearStorage(): void {\n storage.removeItem(key);\n },\n /**\n * Reads item from storage and patches the state.\n */\n readFromStorage(): void {\n const stateString = storage.getItem(key);\n if (stateString) {\n patchState(store, parse(stateString));\n }\n },\n /**\n * Writes selected portion to storage.\n */\n writeToStorage(): void {\n const slicedState = select(getState(store) as State);\n storage.setItem(key, stringify(slicedState));\n },\n };\n }),\n withHooks({\n onInit(store, platformId = inject(PLATFORM_ID)) {\n if (isPlatformServer(platformId)) {\n return;\n }\n\n if (autoSync) {\n store.readFromStorage();\n\n effect(() => {\n store.writeToStorage();\n });\n }\n },\n })\n );\n}\n","/** With pagination comes in two flavors the first one is local pagination or in memory pagination. For example we have 2000 items which we want\n * to display in a table and the response payload is small enough to be stored in the memory. But we can not display all 2000 items at once\n * so we need to paginate the data. The second flavor is server side pagination where the response payload is too large to be stored in the memory\n * and we need to fetch the data from the server in chunks. In the second case we 'could' also cache the data in the memory but that could lead to\n * other problems like memory leaks and stale data. So we will not cache the data in the memory in the second case.\n * This feature implements the local pagination.\n */\n\nimport { Signal, computed } from '@angular/core';\nimport {\n SignalStoreFeature,\n signalStoreFeature,\n withComputed,\n withState,\n EmptyFeatureResult,\n} from '@ngrx/signals';\nimport { capitalize } from './with-data-service';\nimport { MethodsDictionary } from '@ngrx/signals/src/signal-store-models';\n\n// This is a virtual page which is can be used to create a pagination control\nexport type Page = { label: string | number; value: number };\n\nexport type NamedPaginationServiceState<E, Collection extends string> = {\n [K in Collection as `selectedPage${Capitalize<K>}Entities`]: Array<E>;\n} & {\n [K in Collection as `${Lowercase<K>}CurrentPage`]: number;\n} & {\n [K in Collection as `${Lowercase<K>}PageSize`]: number;\n} & {\n [K in Collection as `${Lowercase<K>}TotalCount`]: number;\n} & {\n [K in Collection as `${Lowercase<K>}PageCount`]: number;\n} & {\n [K in Collection as `${Lowercase<K>}PageNavigationArray`]: number;\n} & {\n [K in Collection as `${Lowercase<K>}PageNavigationArrayMax`]: number;\n};\n\nexport type NamedPaginationServiceSignals<E, Collection extends string> = {\n [K in Collection as `selectedPage${Capitalize<K>}Entities`]: Signal<E[]>;\n} & {\n [K in Collection as `${Lowercase<K>}CurrentPage`]: Signal<number>;\n} & {\n [K in Collection as `${Lowercase<K>}PageSize`]: Signal<number>;\n} & {\n [K in Collection as `${Lowercase<K>}TotalCount`]: Signal<number>;\n} & {\n [K in Collection as `${Lowercase<K>}PageCount`]: Signal<number>;\n} & {\n [K in Collection as `${Lowercase<K>}PageNavigationArray`]: Signal<Page[]>;\n} & {\n [K in Collection as `${Lowercase<K>}PageNavigationArrayMax`]: Signal<number>;\n} & {\n [K in Collection as `hasNext${Capitalize<K>}Page`]: Signal<boolean>;\n} & {\n [K in Collection as `hasPrevious${Capitalize<K>}Page`]: Signal<boolean>;\n};\n\nexport type PaginationServiceState<E> = {\n selectedPageEntities: Array<E>;\n currentPage: number;\n pageSize: number;\n totalCount: number;\n pageCount: number;\n pageNavigationArray: Page[];\n pageNavigationArrayMax: number;\n};\n\nexport type PaginationServiceSignals<E> = {\n selectedPageEntities: Signal<E[]>;\n currentPage: Signal<number>;\n pageSize: Signal<number>;\n totalCount: Signal<number>;\n pageCount: Signal<number>;\n pageNavigationArray: Signal<Page[]>;\n pageNavigationArrayMax: Signal<number>;\n hasNextPage: Signal<boolean>;\n hasPreviousPage: Signal<boolean>;\n};\n\nexport type SetPaginationState<\n E,\n Collection extends string | undefined\n> = Collection extends string\n ? NamedPaginationServiceState<E, Collection>\n : PaginationServiceState<E>;\n\nexport function withPagination<E, Collection extends string>(options: {\n entity: E;\n collection: Collection;\n}): SignalStoreFeature<\n EmptyFeatureResult,\n {\n state: NamedPaginationServiceState<E, Collection>;\n props: NamedPaginationServiceSignals<E, Collection>;\n methods: MethodsDictionary;\n }\n>;\n\nexport function withPagination<E>(): SignalStoreFeature<\n EmptyFeatureResult,\n {\n state: PaginationServiceState<E>;\n props: PaginationServiceSignals<E>;\n methods: MethodsDictionary;\n }\n>;\n\nexport function withPagination<E, Collection extends string>(options?: {\n entity: E;\n collection: Collection;\n}): SignalStoreFeature {\n const {\n pageKey,\n pageSizeKey,\n entitiesKey,\n selectedPageEntitiesKey,\n totalCountKey,\n pageCountKey,\n pageNavigationArrayMaxKey,\n pageNavigationArrayKey,\n hasNextPageKey,\n hasPreviousPageKey,\n } = createPaginationKeys<Collection>(options);\n\n return signalStoreFeature(\n withState({\n [pageKey]: 0,\n [pageSizeKey]: 10,\n [pageNavigationArrayMaxKey]: 7,\n }),\n withComputed((store: Record<string, unknown>) => {\n const entities = store[entitiesKey] as Signal<E[]>;\n const page = store[pageKey] as Signal<number>;\n const pageSize = store[pageSizeKey] as Signal<number>;\n const pageNavigationArrayMax = store[\n pageNavigationArrayMaxKey\n ] as Signal<number>;\n\n return {\n // The derived enitites which are displayed on the current page\n [selectedPageEntitiesKey]: computed<E[]>(() => {\n const pageSizeValue = pageSize();\n const pageValue = page();\n\n return entities().slice(\n pageValue * pageSizeValue,\n (pageValue + 1) * pageSizeValue\n ) as E[];\n }),\n [totalCountKey]: computed(() => entities().length),\n [pageCountKey]: computed(() => {\n const totalCountValue = entities().length;\n const pageSizeValue = pageSize();\n\n if (totalCountValue === 0) {\n return 0;\n }\n\n return Math.ceil(totalCountValue / pageSizeValue);\n }),\n [pageNavigationArrayKey]: computed(() =>\n createPageArray(\n page(),\n pageSize(),\n entities().length,\n pageNavigationArrayMax()\n )\n ),\n\n [hasNextPageKey]: computed(() => {\n return page() < pageSize();\n }),\n\n [hasPreviousPageKey]: computed(() => {\n return page() > 1;\n }),\n };\n })\n );\n}\n\nexport function gotoPage<E, Collection extends string>(\n page: number,\n options?: {\n collection: Collection;\n }\n): Partial<SetPaginationState<E, Collection>> {\n const { pageKey } = createPaginationKeys<Collection>(options);\n\n return {\n [pageKey]: page,\n } as Partial<SetPaginationState<E, Collection>>;\n}\n\nexport function setPageSize<E, Collection extends string>(\n pageSize: number,\n options?: {\n collection: Collection;\n }\n): Partial<SetPaginationState<E, Collection>> {\n const { pageSizeKey } = createPaginationKeys<Collection>(options);\n\n return {\n [pageSizeKey]: pageSize,\n } as Partial<SetPaginationState<E, Collection>>;\n}\n\nexport function nextPage<E, Collection extends string>(options?: {\n collection: Collection;\n}): Partial<SetPaginationState<E, Collection>> {\n const { pageKey } = createPaginationKeys<Collection>(options);\n\n return {\n [pageKey]: (currentPage: number) => currentPage + 1,\n } as Partial<SetPaginationState<E, Collection>>;\n}\n\nexport function previousPage<E, Collection extends string>(options?: {\n collection: Collection;\n}): Partial<SetPaginationState<E, Collection>> {\n const { pageKey } = createPaginationKeys<Collection>(options);\n\n return {\n [pageKey]: (currentPage: number) => Math.max(currentPage - 1, 1),\n } as Partial<SetPaginationState<E, Collection>>;\n}\n\nexport function firstPage<E, Collection extends string>(options?: {\n collection: Collection;\n}): Partial<SetPaginationState<E, Collection>> {\n const { pageKey } = createPaginationKeys<Collection>(options);\n\n return {\n [pageKey]: 1,\n } as Partial<SetPaginationState<E, Collection>>;\n}\n\nexport function setMaxPageNavigationArrayItems<E, Collection extends string>(\n maxPageNavigationArrayItems: number,\n options?: {\n collection: Collection;\n }\n): Partial<SetPaginationState<E, Collection>> {\n const { pageNavigationArrayMaxKey } =\n createPaginationKeys<Collection>(options);\n\n return {\n [pageNavigationArrayMaxKey]: maxPageNavigationArrayItems,\n } as Partial<SetPaginationState<E, Collection>>;\n}\n\nfunction createPaginationKeys<Collection extends string>(\n options: { collection: Collection } | undefined\n) {\n const entitiesKey = options?.collection\n ? `${options.collection}Entities`\n : 'entities';\n\n const selectedPageEntitiesKey = options?.collection\n ? `selectedPage${capitalize(options?.collection)}Entities`\n : 'selectedPageEntities';\n\n const pageKey = options?.collection\n ? `${options.collection}CurrentPage`\n : 'currentPage';\n\n const pageSizeKey = options?.collection\n ? `${options.collection}PageSize`\n : 'pageSize';\n\n const totalCountKey = options?.collection\n ? `${options.collection}TotalCount`\n : 'totalCount';\n\n const pageCountKey = options?.collection\n ? `${options.collection}PageCount`\n : 'pageCount';\n\n const pageNavigationArrayMaxKey = options?.collection\n ? `${options.collection}PageNavigationArrayMax`\n : 'pageNavigationArrayMax';\n\n const pageNavigationArrayKey = options?.collection\n ? `${options.collection}PageNavigationArray`\n : 'pageNavigationArray';\n\n const hasNextPageKey = options?.collection\n ? `hasNext${capitalize(options.collection)}Page`\n : 'hasNextPage';\n\n const hasPreviousPageKey = options?.collection\n ? `hasPrevious${capitalize(options.collection)}Page`\n : 'hasPreviousPage';\n\n return {\n pageKey,\n pageSizeKey,\n entitiesKey,\n selectedPageEntitiesKey,\n totalCountKey,\n pageCountKey,\n pageNavigationArrayKey,\n pageNavigationArrayMaxKey,\n hasNextPageKey,\n hasPreviousPageKey,\n };\n}\n\nexport function createPageArray(\n currentPage: number,\n itemsPerPage: number,\n totalItems: number,\n paginationRange: number\n): Page[] {\n // Convert paginationRange to number in case it's a string\n paginationRange = +paginationRange;\n\n // Calculate total number of pages\n const totalPages = Math.max(Math.ceil(totalItems / itemsPerPage), 1);\n const halfWay = Math.ceil(paginationRange / 2);\n\n const isStart = currentPage <= halfWay;\n const isEnd = totalPages - halfWay < currentPage;\n const isMiddle = !isStart && !isEnd;\n\n const ellipsesNeeded = paginationRange < totalPages;\n const pages: Page[] = [];\n\n for (let i = 1; i <= totalPages && i <= paginationRange; i++) {\n let pageNumber = i;\n\n if (i === paginationRange) {\n pageNumber = totalPages;\n } else if (ellipsesNeeded) {\n if (isEnd) {\n pageNumber = totalPages - paginationRange + i;\n } else if (isMiddle) {\n pageNumber = currentPage - halfWay + i;\n }\n }\n\n const openingEllipsesNeeded = i === 2 && (isMiddle || isEnd);\n const closingEllipsesNeeded =\n i === paginationRange - 1 && (isMiddle || isStart);\n\n const label =\n ellipsesNeeded && (openingEllipsesNeeded || closingEllipsesNeeded)\n ? '...'\n : pageNumber;\n\n pages.push({ label, value: pageNumber });\n }\n\n return pages;\n}\n","import {\n getState,\n patchState,\n signalStoreFeature,\n StateSource,\n withHooks,\n withMethods,\n withProps,\n} from '@ngrx/signals';\n\nexport type PublicMethods = {\n resetState(): void;\n};\n\n/**\n * Adds a `resetState` method to the store, which resets the state\n * to the initial state.\n *\n * If you want to set a custom initial state, you can use {@link setResetState}.\n */\nexport function withReset() {\n return signalStoreFeature(\n withProps(() => ({ _resetState: { value: {} } })),\n withMethods((store): PublicMethods => {\n // workaround to TS excessive property check\n const methods = {\n resetState() {\n patchState(store, store._resetState.value);\n },\n __setResetState__(state: object) {\n store._resetState.value = state;\n },\n };\n\n return methods;\n }),\n withHooks((store) => ({\n onInit() {\n store._resetState.value = getState(store);\n },\n }))\n );\n}\n\n/**\n * Sets the reset state of the store to the given state.\n *\n * Throws an error if the store is not configured with {@link withReset}.\n * @param store the instance of a SignalStore\n * @param state the state to set as the reset state\n */\nexport function setResetState<State extends object>(\n store: StateSource<State>,\n state: State\n): void {\n if (!('__setResetState__' in store)) {\n throw new Error(\n 'Cannot set reset state, since store is not configured with withReset()'\n );\n }\n (store.__setResetState__ as (state: State) => void)(state);\n}\n","/**\n * Deep freezes a state object along its properties with primitive values\n * on the first level.\n *\n * The reason for this is that the final state is a merge of all\n * root properties of all states, i.e. `withState`,....\n *\n * Since the root object will not be part of the state (shadow clone),\n * we are not freezing it.\n */\n\nexport function deepFreeze<T extends Record<string | symbol, unknown>>(\n target: T,\n // if empty all properties will be frozen\n propertyNamesToBeFrozen: (string | symbol)[],\n // also means that we are on the first level\n isRoot = true\n): void {\n const runPropertyNameCheck = propertyNamesToBeFrozen.length > 0;\n for (const key of Reflect.ownKeys(target)) {\n if (runPropertyNameCheck && !propertyNamesToBeFrozen.includes(key)) {\n continue;\n }\n\n const propValue = target[key];\n if (isRecordLike(propValue) && !Object.isFrozen(propValue)) {\n Object.freeze(propValue);\n deepFreeze(propValue, [], false);\n } else if (isRoot) {\n Object.defineProperty(target, key, {\n value: propValue,\n writable: false,\n configurable: false,\n });\n }\n }\n}\n\nfunction isRecordLike(\n target: unknown\n): target is Record<string | symbol, unknown> {\n return typeof target === 'object' && target !== null;\n}\n","import { isDevMode as ngIsInDevMode } from '@angular/core';\n\n// necessary wrapper function to test prod mode\nexport function isDevMode() {\n return ngIsInDevMode();\n}\n","import {\n EmptyFeatureResult,\n signalStoreFeature,\n SignalStoreFeature,\n SignalStoreFeatureResult,\n withHooks,\n withState,\n watchState,\n} from '@ngrx/signals';\nimport { deepFreeze } from './deep-freeze';\nimport { isDevMode } from './is-dev-mode';\n\n/**\n * The implementation of this feature is a little bit tricky.\n *\n * `signalStore` does a shallow clone in the initial phase, in order to\n * merge all different states together.\n *\n * Shallow cloning also happens in `patchState`.\n *\n * With shallow cloning, the root state object is replaced, which means,\n * the freezing only stays for its nested properties but not for\n * the primitive and immediate properties.\n *\n * For example:\n *\n * ```ts\n * const state = {\n * id: 1,\n * address: {\n * street: 'Main St',\n * city: 'Springfield',\n * }\n * }\n * ```\n *\n * Running `Object.freeze` on `state` will freeze the `address` object, and\n * the `id`. But since `state` is shallow cloned, the \"frozing\" state of the\n * `id` is lost. `address`, being an object, is still frozen.\n *\n * To overcome that, we run `watchState` and run `deepFreeze`\n * on every change.\n */\n\n/**\n * Prevents mutation of the state.\n *\n * This is done by deeply applying `Object.freeze`. Any mutable change within\n * or outside the `SignalStore` will throw an error.\n *\n * @param state the state object\n * @param options enable protection in production (default: false)\n */\nexport function withImmutableState<State extends object>(\n state: State,\n options?: { enableInProduction?: boolean }\n): SignalStoreFeature<\n SignalStoreFeatureResult,\n EmptyFeatureResult & { state: State }\n>;\n/**\n * Prevents mutation of the state.\n *\n * This is done by deeply applying `Object.freeze`. Any mutable change within\n * or outside the `SignalStore` will throw an error.\n *\n * @param stateFactory a function returning the state object\n * @param options enable protection in production (default: false)\n */\nexport function withImmutableState<State extends object>(\n stateFactory: () => State,\n options?: { enableInProduction?: boolean }\n): SignalStoreFeature<\n SignalStoreFeatureResult,\n EmptyFeatureResult & { state: State }\n>;\nexport function withImmutableState<State extends object>(\n stateOrFactory: State | (() => State),\n options?: { enableInProduction?: boolean }\n): SignalStoreFeature<\n SignalStoreFeatureResult,\n EmptyFeatureResult & { state: State }\n> {\n const immutableState =\n typeof stateOrFactory === 'function' ? stateOrFactory() : stateOrFactory;\n const stateKeys = Reflect.ownKeys(immutableState);\n\n const applyFreezing = isDevMode() || options?.enableInProduction === true;\n return signalStoreFeature(\n withState(immutableState),\n withHooks((store) => ({\n onInit() {\n if (!applyFreezing) {\n return;\n }\n /**\n * `immutableState` will be initially frozen. That is because\n * of potential mutations outside the SignalStore\n *\n * ```ts\n * const initialState = {id: 1};\n * signalStore(withImmutableState(initialState));\n *\n * initialState.id = 2; // must throw immutability\n * ```\n */\n\n Object.freeze(immutableState);\n watchState(store, (state) => {\n deepFreeze(state, stateKeys);\n });\n },\n }))\n );\n}\n","import {\n SignalStoreFeature,\n SignalStoreFeatureResult,\n StateSignals,\n} from '@ngrx/signals';\n\ntype StoreForFactory<Input extends SignalStoreFeatureResult> = StateSignals<\n Input['state']\n> &\n Input['props'] &\n Input['methods'];\n\n/**\n * Allows to pass properties, methods, or signals from a SignalStore\n * to a feature.\n *\n * Typically, a `signalStoreFeature` can have input constraints on\n *\n * ```typescript\n * function withSum(a: Signal<number>, b: Signal<number>) {\n * return signalStoreFeature(\n * withComputed(() => ({\n * sum: computed(() => a() + b())\n * }))\n * );\n * }\n *\n * signalStore(\n * withState({ a: 1, b: 2 }),\n * withFeatureFactory((store) => withSum(store.a, store.b))\n * );\n * ```\n * @param factoryFn\n */\nexport function withFeatureFactory<\n Input extends SignalStoreFeatureResult,\n Output extends SignalStoreFeatureResult\n>(\n factoryFn: (\n store: StoreForFactory<Input>\n ) => SignalStoreFeature<Input, Output>\n): SignalStoreFeature<Input, Output> {\n return (store) => {\n const storeForFactory = {\n ...store['stateSignals'],\n ...store['props'],\n ...store['methods'],\n } as StoreForFactory<Input>;\n\n const feature = factoryFn(storeForFactory);\n\n return feature(store);\n };\n}\n","import {\n signalStoreFeature,\n SignalStoreFeature,\n SignalStoreFeatureResult,\n StateSignals,\n withState,\n} from '@ngrx/signals';\n\n/**\n * `withConditional` activates a feature based on a given condition.\n *\n * **Use Cases**\n * - Conditionally activate features based on the **store state** or other criteria.\n * - Choose between **two different implementations** of a feature.\n *\n * **Type Constraints**\n * Both features must have **exactly the same state, props, and methods**.\n * Otherwise, a type error will occur.\n *\n *\n * **Usage**\n *\n * ```typescript\n * const withUser = signalStoreFeature(\n * withState({ id: 1, name: 'Konrad' }),\n * withHooks(store => ({\n * onInit() {\n * // user loading logic\n * }\n * }))\n * );\n *\n * function withFakeUser() {\n * return signalStoreFeature(\n * withState({ id: 0, name: 'anonymous' })\n * );\n * }\n *\n * signalStore(\n * withMethods(() => ({\n * useRealUser: () => true\n * })),\n * withConditional((store) => store.useRealUser(), withUser, withFakeUser)\n * )\n * ```\n *\n * @param condition - A function that determines which feature to activate based on the store state.\n * @param featureIfTrue - The feature to activate if the condition evaluates to `true`.\n * @param featureIfFalse - The feature to activate if the condition evaluates to `false`.\n * @returns A `SignalStoreFeature` that applies the selected feature based on the condition.\n */\nexport function withConditional<\n Input extends SignalStoreFeatureResult,\n Output extends SignalStoreFeatureResult\n>(\n condition: (\n store: StateSignals<Input['state']> & Input['props'] & Input['methods']\n ) => boolean,\n featureIfTrue: SignalStoreFeature<NoInfer<Input>, Output>,\n featureIfFalse: SignalStoreFeature<NoInfer<Input>, NoInfer<Output>>\n): SignalStoreFeature<Input, Output> {\n return (store) => {\n const conditionStore = {\n ...store['stateSignals'],\n ...store['props'],\n ...store['methods'],\n };\n return condition(conditionStore)\n ? featureIfTrue(store)\n : featureIfFalse(store);\n };\n}\n\nexport const emptyFeature = signalStoreFeature(withState({}));\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":["originalPatchState","patchState","ngIsInDevMode"],"mappings":";;;;;;;AAEA;;AAEG;AACI,MAAM,gBAAgB,GAAwB,MAAM,CAAC,KAAK,KAAK;;ACL/D,MAAM,kBAAkB,GAAG,IAAI,GAAG,EAAU;;ACA7C,SAAU,WAAW,CAAI,GAAM,EAAA;IACnC,IAAI,GAAG,KAAK,IAAI,IAAI,GAAG,KAAK,SAAS,EAAE;AACrC,QAAA,MAAM,IAAI,KAAK,CAAC,EAAE,CAAC;;AAGrB,IAAA,OAAO,GAAG;AACZ;;ACEA,MAA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AAC,OAAO,CAAC;YACjB,GAAG,KAAK,CAAC,SAAS,CAAC;SACM;AAE3B,QAAA,MAAM,OAAO,GAAG,SAAS,CAAC,eAAe,CAAC;AAE1C,QAAA,OAAO,OAAO,CAAC,KAAK,CAAC;AACvB,KAAC;AACH;;AC7CA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA0CG;SACa,eAAe,CAI7B,SAEY,EACZ,aAAyD,EACzD,cAAmE,EAAA;IAEnE,OAAO,CAAC,KAAK,KAAI;AACf,QAAA,MAAM,cAAc,GAAG;YACrB,GAAG,KAAK,CAAC,cAAc,CAAC;YACxB,GAAG,KAAK,CAAC,OAAO,CAAC;YACjB,GAAG,KAAK,CAAC,SAAS,CAAC;SACpB;QACD,OAAO,SAAS,CAAC,cAAc;AAC7B,cAAE,aAAa,CAAC,KAAK;AACrB,cAAE,cAAc,CAAC,KAAK,CAAC;AAC3B,KAAC;AACH;AAEa,MAAA,YAAY,GAAG,kBAAkB,CAAC,SAAS,CAAC,EAAE,CAAC;;ACzE5D;;AAEG;;;;"}
|
package/index.d.ts
CHANGED
|
@@ -12,3 +12,6 @@ export * from './lib/with-data-service';
|
|
|
12
12
|
export { withStorageSync, SyncConfig } from './lib/with-storage-sync';
|
|
13
13
|
export * from './lib/with-pagination';
|
|
14
14
|
export { withReset, setResetState } from './lib/with-reset';
|
|
15
|
+
export { withImmutableState } from './lib/immutable-state/with-immutable-state';
|
|
16
|
+
export { withFeatureFactory } from './lib/with-feature-factory';
|
|
17
|
+
export { withConditional, emptyFeature } from './lib/with-conditional';
|
|
@@ -5,7 +5,6 @@ declare global {
|
|
|
5
5
|
__REDUX_DEVTOOLS_EXTENSION__: ReduxDevtoolsExtension | undefined;
|
|
6
6
|
}
|
|
7
7
|
}
|
|
8
|
-
export declare const existingNames: Map<string, unknown>;
|
|
9
8
|
export declare const renameDevtoolsMethodName = "___renameDevtoolsName";
|
|
10
9
|
export declare const uniqueDevtoolsId = "___uniqueDevtoolsId";
|
|
11
10
|
/**
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Deep freezes a state object along its properties with primitive values
|
|
3
|
+
* on the first level.
|
|
4
|
+
*
|
|
5
|
+
* The reason for this is that the final state is a merge of all
|
|
6
|
+
* root properties of all states, i.e. `withState`,....
|
|
7
|
+
*
|
|
8
|
+
* Since the root object will not be part of the state (shadow clone),
|
|
9
|
+
* we are not freezing it.
|
|
10
|
+
*/
|
|
11
|
+
export declare function deepFreeze<T extends Record<string | symbol, unknown>>(target: T, propertyNamesToBeFrozen: (string | symbol)[], isRoot?: boolean): void;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function isDevMode(): boolean;
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import { EmptyFeatureResult, SignalStoreFeature, SignalStoreFeatureResult } from '@ngrx/signals';
|
|
2
|
+
/**
|
|
3
|
+
* The implementation of this feature is a little bit tricky.
|
|
4
|
+
*
|
|
5
|
+
* `signalStore` does a shallow clone in the initial phase, in order to
|
|
6
|
+
* merge all different states together.
|
|
7
|
+
*
|
|
8
|
+
* Shallow cloning also happens in `patchState`.
|
|
9
|
+
*
|
|
10
|
+
* With shallow cloning, the root state object is replaced, which means,
|
|
11
|
+
* the freezing only stays for its nested properties but not for
|
|
12
|
+
* the primitive and immediate properties.
|
|
13
|
+
*
|
|
14
|
+
* For example:
|
|
15
|
+
*
|
|
16
|
+
* ```ts
|
|
17
|
+
* const state = {
|
|
18
|
+
* id: 1,
|
|
19
|
+
* address: {
|
|
20
|
+
* street: 'Main St',
|
|
21
|
+
* city: 'Springfield',
|
|
22
|
+
* }
|
|
23
|
+
* }
|
|
24
|
+
* ```
|
|
25
|
+
*
|
|
26
|
+
* Running `Object.freeze` on `state` will freeze the `address` object, and
|
|
27
|
+
* the `id`. But since `state` is shallow cloned, the "frozing" state of the
|
|
28
|
+
* `id` is lost. `address`, being an object, is still frozen.
|
|
29
|
+
*
|
|
30
|
+
* To overcome that, we run `watchState` and run `deepFreeze`
|
|
31
|
+
* on every change.
|
|
32
|
+
*/
|
|
33
|
+
/**
|
|
34
|
+
* Prevents mutation of the state.
|
|
35
|
+
*
|
|
36
|
+
* This is done by deeply applying `Object.freeze`. Any mutable change within
|
|
37
|
+
* or outside the `SignalStore` will throw an error.
|
|
38
|
+
*
|
|
39
|
+
* @param state the state object
|
|
40
|
+
* @param options enable protection in production (default: false)
|
|
41
|
+
*/
|
|
42
|
+
export declare function withImmutableState<State extends object>(state: State, options?: {
|
|
43
|
+
enableInProduction?: boolean;
|
|
44
|
+
}): SignalStoreFeature<SignalStoreFeatureResult, EmptyFeatureResult & {
|
|
45
|
+
state: State;
|
|
46
|
+
}>;
|
|
47
|
+
/**
|
|
48
|
+
* Prevents mutation of the state.
|
|
49
|
+
*
|
|
50
|
+
* This is done by deeply applying `Object.freeze`. Any mutable change within
|
|
51
|
+
* or outside the `SignalStore` will throw an error.
|
|
52
|
+
*
|
|
53
|
+
* @param stateFactory a function returning the state object
|
|
54
|
+
* @param options enable protection in production (default: false)
|
|
55
|
+
*/
|
|
56
|
+
export declare function withImmutableState<State extends object>(stateFactory: () => State, options?: {
|
|
57
|
+
enableInProduction?: boolean;
|
|
58
|
+
}): SignalStoreFeature<SignalStoreFeatureResult, EmptyFeatureResult & {
|
|
59
|
+
state: State;
|
|
60
|
+
}>;
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { SignalStoreFeature, SignalStoreFeatureResult, StateSignals } from '@ngrx/signals';
|
|
2
|
+
/**
|
|
3
|
+
* `withConditional` activates a feature based on a given condition.
|
|
4
|
+
*
|
|
5
|
+
* **Use Cases**
|
|
6
|
+
* - Conditionally activate features based on the **store state** or other criteria.
|
|
7
|
+
* - Choose between **two different implementations** of a feature.
|
|
8
|
+
*
|
|
9
|
+
* **Type Constraints**
|
|
10
|
+
* Both features must have **exactly the same state, props, and methods**.
|
|
11
|
+
* Otherwise, a type error will occur.
|
|
12
|
+
*
|
|
13
|
+
*
|
|
14
|
+
* **Usage**
|
|
15
|
+
*
|
|
16
|
+
* ```typescript
|
|
17
|
+
* const withUser = signalStoreFeature(
|
|
18
|
+
* withState({ id: 1, name: 'Konrad' }),
|
|
19
|
+
* withHooks(store => ({
|
|
20
|
+
* onInit() {
|
|
21
|
+
* // user loading logic
|
|
22
|
+
* }
|
|
23
|
+
* }))
|
|
24
|
+
* );
|
|
25
|
+
*
|
|
26
|
+
* function withFakeUser() {
|
|
27
|
+
* return signalStoreFeature(
|
|
28
|
+
* withState({ id: 0, name: 'anonymous' })
|
|
29
|
+
* );
|
|
30
|
+
* }
|
|
31
|
+
*
|
|
32
|
+
* signalStore(
|
|
33
|
+
* withMethods(() => ({
|
|
34
|
+
* useRealUser: () => true
|
|
35
|
+
* })),
|
|
36
|
+
* withConditional((store) => store.useRealUser(), withUser, withFakeUser)
|
|
37
|
+
* )
|
|
38
|
+
* ```
|
|
39
|
+
*
|
|
40
|
+
* @param condition - A function that determines which feature to activate based on the store state.
|
|
41
|
+
* @param featureIfTrue - The feature to activate if the condition evaluates to `true`.
|
|
42
|
+
* @param featureIfFalse - The feature to activate if the condition evaluates to `false`.
|
|
43
|
+
* @returns A `SignalStoreFeature` that applies the selected feature based on the condition.
|
|
44
|
+
*/
|
|
45
|
+
export declare function withConditional<Input extends SignalStoreFeatureResult, Output extends SignalStoreFeatureResult>(condition: (store: StateSignals<Input['state']> & Input['props'] & Input['methods']) => boolean, featureIfTrue: SignalStoreFeature<NoInfer<Input>, Output>, featureIfFalse: SignalStoreFeature<NoInfer<Input>, NoInfer<Output>>): SignalStoreFeature<Input, Output>;
|
|
46
|
+
export declare const emptyFeature: SignalStoreFeature<import("@ngrx/signals").EmptyFeatureResult, {
|
|
47
|
+
state: {};
|
|
48
|
+
props: {};
|
|
49
|
+
methods: {};
|
|
50
|
+
}>;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { SignalStoreFeature, SignalStoreFeatureResult, StateSignals } from '@ngrx/signals';
|
|
2
|
+
type StoreForFactory<Input extends SignalStoreFeatureResult> = StateSignals<Input['state']> & Input['props'] & Input['methods'];
|
|
3
|
+
/**
|
|
4
|
+
* Allows to pass properties, methods, or signals from a SignalStore
|
|
5
|
+
* to a feature.
|
|
6
|
+
*
|
|
7
|
+
* Typically, a `signalStoreFeature` can have input constraints on
|
|
8
|
+
*
|
|
9
|
+
* ```typescript
|
|
10
|
+
* function withSum(a: Signal<number>, b: Signal<number>) {
|
|
11
|
+
* return signalStoreFeature(
|
|
12
|
+
* withComputed(() => ({
|
|
13
|
+
* sum: computed(() => a() + b())
|
|
14
|
+
* }))
|
|
15
|
+
* );
|
|
16
|
+
* }
|
|
17
|
+
*
|
|
18
|
+
* signalStore(
|
|
19
|
+
* withState({ a: 1, b: 2 }),
|
|
20
|
+
* withFeatureFactory((store) => withSum(store.a, store.b))
|
|
21
|
+
* );
|
|
22
|
+
* ```
|
|
23
|
+
* @param factoryFn
|
|
24
|
+
*/
|
|
25
|
+
export declare function withFeatureFactory<Input extends SignalStoreFeatureResult, Output extends SignalStoreFeatureResult>(factoryFn: (store: StoreForFactory<Input>) => SignalStoreFeature<Input, Output>): SignalStoreFeature<Input, Output>;
|
|
26
|
+
export {};
|
package/lib/with-pagination.d.ts
CHANGED
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
*/
|
|
8
8
|
import { Signal } from '@angular/core';
|
|
9
9
|
import { SignalStoreFeature, EmptyFeatureResult } from '@ngrx/signals';
|
|
10
|
-
import {
|
|
10
|
+
import { MethodsDictionary } from '@ngrx/signals/src/signal-store-models';
|
|
11
11
|
export type Page = {
|
|
12
12
|
label: string | number;
|
|
13
13
|
value: number;
|
|
@@ -46,19 +46,6 @@ export type NamedPaginationServiceSignals<E, Collection extends string> = {
|
|
|
46
46
|
} & {
|
|
47
47
|
[K in Collection as `hasPrevious${Capitalize<K>}Page`]: Signal<boolean>;
|
|
48
48
|
};
|
|
49
|
-
export type NamedPaginationServiceMethods<Collection extends string> = {
|
|
50
|
-
[K in Collection as `set${Capitalize<K>}PageSize`]: (size: number) => void;
|
|
51
|
-
} & {
|
|
52
|
-
[K in Collection as `next${Capitalize<K>}Page`]: () => void;
|
|
53
|
-
} & {
|
|
54
|
-
[K in Collection as `previous${Capitalize<K>}Page`]: () => void;
|
|
55
|
-
} & {
|
|
56
|
-
[K in Collection as `last${Capitalize<K>}Page`]: () => void;
|
|
57
|
-
} & {
|
|
58
|
-
[K in Collection as `first${Capitalize<K>}Page`]: () => void;
|
|
59
|
-
} & {
|
|
60
|
-
[K in Collection as `goto${Capitalize<K>}Page`]: (page: number) => void;
|
|
61
|
-
};
|
|
62
49
|
export type PaginationServiceState<E> = {
|
|
63
50
|
selectedPageEntities: Array<E>;
|
|
64
51
|
currentPage: number;
|
|
@@ -79,32 +66,19 @@ export type PaginationServiceSignals<E> = {
|
|
|
79
66
|
hasNextPage: Signal<boolean>;
|
|
80
67
|
hasPreviousPage: Signal<boolean>;
|
|
81
68
|
};
|
|
82
|
-
export type PaginationServiceMethods = {
|
|
83
|
-
setPageSize: (size: number) => void;
|
|
84
|
-
nextPageKey: () => void;
|
|
85
|
-
previousPage: () => void;
|
|
86
|
-
lastPage: () => void;
|
|
87
|
-
firstPage: () => void;
|
|
88
|
-
gotoPage: (page: number) => void;
|
|
89
|
-
};
|
|
90
69
|
export type SetPaginationState<E, Collection extends string | undefined> = Collection extends string ? NamedPaginationServiceState<E, Collection> : PaginationServiceState<E>;
|
|
91
70
|
export declare function withPagination<E, Collection extends string>(options: {
|
|
92
71
|
entity: E;
|
|
93
72
|
collection: Collection;
|
|
94
|
-
}): SignalStoreFeature<EmptyFeatureResult
|
|
95
|
-
props: NamedEntityComputed<E, Collection>;
|
|
96
|
-
}, {
|
|
73
|
+
}): SignalStoreFeature<EmptyFeatureResult, {
|
|
97
74
|
state: NamedPaginationServiceState<E, Collection>;
|
|
98
75
|
props: NamedPaginationServiceSignals<E, Collection>;
|
|
99
|
-
methods:
|
|
76
|
+
methods: MethodsDictionary;
|
|
100
77
|
}>;
|
|
101
|
-
export declare function withPagination<E>(): SignalStoreFeature<EmptyFeatureResult
|
|
102
|
-
state: EntityState<E>;
|
|
103
|
-
props: EntityComputed<E>;
|
|
104
|
-
}, {
|
|
78
|
+
export declare function withPagination<E>(): SignalStoreFeature<EmptyFeatureResult, {
|
|
105
79
|
state: PaginationServiceState<E>;
|
|
106
80
|
props: PaginationServiceSignals<E>;
|
|
107
|
-
methods:
|
|
81
|
+
methods: MethodsDictionary;
|
|
108
82
|
}>;
|
|
109
83
|
export declare function gotoPage<E, Collection extends string>(page: number, options?: {
|
|
110
84
|
collection: Collection;
|