@nx/angular 19.6.0-beta.3 → 19.6.0-beta.5

Sign up to get free protection for your applications and to get access to all the features.
@@ -2,7 +2,6 @@ import { ROUTER_NAVIGATION } from '@ngrx/router-store';
2
2
  import { isObservable, of } from 'rxjs';
3
3
  import { catchError, concatMap, filter, groupBy, map, mergeMap, switchMap, } from 'rxjs/operators';
4
4
  /**
5
- *
6
5
  * @whatItDoes Handles pessimistic updates (updating the server first).
7
6
  *
8
7
  * Updating the server, when implemented naively, suffers from race conditions and poor error handling.
@@ -57,6 +56,8 @@ import { catchError, concatMap, filter, groupBy, map, mergeMap, switchMap, } fro
57
56
  * ```
58
57
  *
59
58
  * @param opts
59
+ *
60
+ * @deprecated This will be removed in Nx v21. Import `pessimisticUpdate` from `@ngrx/router-store/data-persistence` instead.
60
61
  */
61
62
  export function pessimisticUpdate(opts) {
62
63
  return (source) => {
@@ -64,7 +65,6 @@ export function pessimisticUpdate(opts) {
64
65
  };
65
66
  }
66
67
  /**
67
- *
68
68
  * @whatItDoes Handles optimistic updates (updating the client first).
69
69
  *
70
70
  * It runs all fetches in order, which removes race conditions and forces the developer to handle errors.
@@ -120,6 +120,8 @@ export function pessimisticUpdate(opts) {
120
120
  * ```
121
121
  *
122
122
  * @param opts
123
+ *
124
+ * @deprecated This will be removed in Nx v21. Import `optimisticUpdate` from `@ngrx/router-store/data-persistence` instead.
123
125
  */
124
126
  export function optimisticUpdate(opts) {
125
127
  return (source) => {
@@ -127,7 +129,6 @@ export function optimisticUpdate(opts) {
127
129
  };
128
130
  }
129
131
  /**
130
- *
131
132
  * @whatItDoes Handles data fetching.
132
133
  *
133
134
  * Data fetching implemented naively suffers from race conditions and poor error handling.
@@ -203,6 +204,8 @@ export function optimisticUpdate(opts) {
203
204
  * In addition, if there are multiple requests for Todo 1 scheduled, it will only run the last one.
204
205
  *
205
206
  * @param opts
207
+ *
208
+ * @deprecated This will be removed in Nx v21. Import `fetch` from `@ngrx/router-store/data-persistence` instead.
206
209
  */
207
210
  export function fetch(opts) {
208
211
  return (source) => {
@@ -263,6 +266,8 @@ export function fetch(opts) {
263
266
  *
264
267
  * @param component
265
268
  * @param opts
269
+ *
270
+ * @deprecated This will be removed in Nx v21. Import `navigation` from `@ngrx/router-store/data-persistence` instead.
266
271
  */
267
272
  export function navigation(component, opts) {
268
273
  return (source) => {
@@ -341,4 +346,4 @@ function wrapIntoObservable(obj) {
341
346
  return of(obj);
342
347
  }
343
348
  }
344
- //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZGF0YS1wZXJzaXN0ZW5jZS5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uLy4uLy4uLy4uLy4uLy4uL3BhY2thZ2VzL2FuZ3VsYXIvc3JjL3J1bnRpbWUvbngvZGF0YS1wZXJzaXN0ZW5jZS50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFNQSxPQUFPLEVBQUUsaUJBQWlCLEVBQUUsTUFBTSxvQkFBb0IsQ0FBQztBQUd2RCxPQUFPLEVBQUUsWUFBWSxFQUFFLEVBQUUsRUFBRSxNQUFNLE1BQU0sQ0FBQztBQUN4QyxPQUFPLEVBQ0wsVUFBVSxFQUNWLFNBQVMsRUFDVCxNQUFNLEVBQ04sT0FBTyxFQUNQLEdBQUcsRUFDSCxRQUFRLEVBQ1IsU0FBUyxHQUNWLE1BQU0sZ0JBQWdCLENBQUM7QUFxQ3hCOzs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7OztHQXdERztBQUNILE1BQU0sVUFBVSxpQkFBaUIsQ0FDL0IsSUFBaUM7SUFFakMsT0FBTyxDQUFDLE1BQWdDLEVBQXNCLEVBQUU7UUFDOUQsT0FBTyxNQUFNLENBQUMsSUFBSSxDQUNoQixpQkFBaUIsRUFBRSxFQUNuQixTQUFTLENBQUMsb0JBQW9CLENBQUMsSUFBSS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ciB0byBoYW5kbGUgZXJyb3JzLlxuICpcbiAqICMjIEV4YW1wbGU6XG4gKlxuICogYGBgdHlwZXNjcmlwdFxuICogQEluamVjdGFibGUoKVxuICogY2xhc3MgVG9kb0VmZmVjdHMge1xuICogICBsb2FkVG9kb3MkID0gY3JlYXRlRWZmZWN0KCgpID0+XG4gKiAgICAgdGhpcy5hY3Rpb25zJC5waXBlKFxuICogICAgICAgb2ZUeXBlKCdHRVRfVE9ET1MnKSxcbiAqICAgICAgIGZldGNoKHtcbiAqICAgICAgICAgLy8gcHJvdmlkZXMgYW4gYWN0aW9uXG4gKiAgICAgICAgIHJ1bjogKGE6IEdldFRvZG9zKSA9PiB7XG4gKiAgICAgICAgICAgcmV0dXJuIHRoaXMuYmFja2VuZC5nZXRBbGwoKS5waXBlKFxuICogICAgICAgICAgICAgbWFwKChyZXNwb25zZSkgPT4gKHtcbiAqICAgICAgICAgICAgICAgdHlwZTogJ1RPRE9TJyxcbiAqICAgICAgICAgICAgICAgdG9kb3M6IHJlc3BvbnNlLnRvZG9zLFxuICogICAgICAgICAgICAgfSkpXG4gKiAgICAgICAgICAgKTtcbiAqICAgICAgICAgfSxcbiAqICAgICAgICAgb25FcnJvcjogKGFjdGlvbjogR2V0VG9kb3MsIGVycm9yOiBhbnkpID0+IHtcbiAqICAgICAgICAgICAvLyBkaXNwYXRjaCBhbiB1bmRvIGFjdGlvbiB0byB1bmRvIHRoZSBjaGFuZ2VzIGluIHRoZSBjbGllbnQgc3RhdGVcbiAqICAgICAgICAgICByZXR1cm4gbnVsbDtcbiAqICAgICAgICAgfSxcbiAqICAgICAgIH0pXG4gKiAgICAgKVxuICogICApO1xuICpcbiAqICAgY29uc3RydWN0b3IocHJpdmF0ZSBhY3Rpb25zJDogQWN0aW9ucywgcHJpdmF0ZSBiYWNrZW5kOiBCYWNrZW5kKSB7fVxuICogfVxuICogYGBgXG4gKlxuICogVGhpcyBpcyBjb3JyZWN0LCBidXQgYmVjYXVzZSBpdCBzZXQgdGhlIGNvbmN1cnJlbmN5IHRvIDEsIGl0IG1heSBub3QgYmUgcGVyZm9ybWFudC5cbiAqXG4gKiBUbyBmaXggdGhhdCwgeW91IGNhbiBwcm92aWRlIHRoZSBgaWRgIGZ1bmN0aW9uLCBsaWtlIHRoaXM6XG4gKlxuICogYGBgdHlwZXNjcmlwdFxuICogQEluamVjdGFibGUoKVxuICogY2xhc3MgVG9kb0VmZmVjdHMge1xuICogICBsb2FkVG9kbyQgPSBjcmVhdGVFZmZlY3QoKCkgPT5cbiAqICAgICB0aGlzLmFjdGlvbnMkLnBpcGUoXG4gKiAgICAgICBvZlR5cGUoJ0dFVF9UT0RPJyksXG4gKiAgICAgICBmZXRjaCh7XG4gKiAgICAgICAgIGlkOiAodG9kbzogR2V0VG9kbykgPT4ge1xuICogICAgICAgICAgIHJldHVybiB0b2RvLmlkO1xuICogICAgICAgICB9LFxuICogICAgICAgICAvLyBwcm92aWRlcyBhbiBhY3Rpb25cbiAqICAgICAgICAgcnVuOiAodG9kbzogR2V0VG9kbykgPT4ge1xuICogICAgICAgICAgIHJldHVybiB0aGlzLmJhY2tlbmQuZ2V0VG9kbyh0b2RvLmlkKS5tYXAoKHJlc3BvbnNlKSA9PiAoe1xuICogICAgICAgICAgICAgdHlwZTogJ0xPQURfVE9ET19TVUNDRVNTJyxcbiAqICAgICAgICAgICAgIHRvZG86IHJlc3BvbnNlLnRvZG8sXG4gKiAgICAgICAgICAgfSkpO1xuICogICAgICAgICB9LFxuICogICAgICAgICBvbkVycm9yOiAoYWN0aW9uOiBHZXRUb2RvLCBlcnJvcjogYW55KSA9PiB7XG4gKiAgICAgICAgICAgLy8gZGlzcGF0Y2ggYW4gdW5kbyBhY3Rpb24gdG8gdW5kbyB0aGUgY2hhbmdlcyBpbiB0aGUgY2xpZW50IHN0YXRlXG4gKiAgICAgICAgICAgcmV0dXJuIG51bGw7XG4gKiAgICAgICAgIH0sXG4gKiAgICAgICB9KVxuICogICAgIClcbiAqICAgKTtcbiAqX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gbGlzdGVucyBmb3IgdGhlIHJvdXRlck5hdmlnYXRpb24gYWN0aW9uIGZyb20gQG5ncngvcm91dGVyLXN0b3JlXG4gKiAgICAgICBuYXZpZ2F0aW9uKFRvZG9Db21wb25lbnQsIHtcbiAqICAgICAgICAgcnVuOiAoYWN0aXZhdGVkUm91dGVTbmFwc2hvdDogQWN0aXZhdGVkUm91dGVTbmFwc2hvdCkgPT4ge1xuICogICAgICAgICAgIHJldHVybiB0aGlzLmJhY2tlbmRcbiAqICAgICAgICAgICAgIC5mZXRjaFRvZG8oYWN0aXZhdGVkUm91dGVTbmFwc2hvdC5wYXJhbXNbJ2lkJ10pXG4gKiAgICAgICAgICAgICAucGlwZShcbiAqICAgICAgICAgICAgICAgbWFwKCh0b2RvKSA9PiAoe1xuICogICAgICAgICAgICAgICAgIHR5cGU6ICdMT0FEX1RPRE9fU1VDQ0VTUycsXG4gKiAgICAgICAgICAgICAgICAgdG9kbzogdG9kbyxcbiAqICAgICAgICAgICAgICAgfSkpXG4gKiAgICAgICAgICAgICApO1xuICogICAgICAgICB9LFxuICogICAgICAgICBvbkVycm9yOiAoXG4gKiAgICAgICAgICAgYWN0aXZhdGVkUm91dGVTbmFwc2hvdDogQWN0aXZhdGVkUm91dGVTbmFwc2hvdCxcbiAqICAgICAgICAgICBlcnJvcjogYW55XG4gKiAgICAgICAgICkgPT4ge1xuICogICAgICAgICAgIC8vIHdlIGNhbiBsb2cgYW5kIGVycm9yIGhlcmUgYW5kIHJldHVybiBudWxsXG4gKiAgICAgICAgICAgLy8gd2UgY2FuIGFsc28gbmF2aWdhdGUgYmFja1xuICogICAgICAgICAgIHJldHVybiBudWxsO1xuICogICAgICAgICB9LFxuICogICAgICAgfSlcbiAqICAgICApXG4gKiAgICk7XG4gKlxuICogICBjb25zdHJ1Y3Rvcihwcml2YXRlIGFjdGlvbnMkOiBBY3Rpb25zLCBwcml2YXRlIGJhY2tlbmQ6IEJhY2tlbmQpIHt9XG4gKiB9XG4gKiBgYGB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HNob3QpID0+IHtcbiAqICAgICAgICAgICByZXR1cm4gdGhpcy5iYWNrZW5kXG4gKiAgICAgICAgICAgICAuZmV0Y2hUb2RvKGFjdGl2YXRlZFJvdXRlU25hcHNob3QucGFyYW1zWydpZCddKVxuICogICAgICAgICAgICAgLnBpcGUoXG4gKiAgICAgICAgICAgICAgIG1hcCgodG9kbykgPT4gKHtcbiAqICAgICAgICAgICAgICAgICB0eXBlOiAnTE9BRF9UT0RPX1NVQ0NFU1MnLFxuICogICAgICAgICAgICAgICAgIHRvZG86IHRvZG8sXG4gKiAgICAgICAgICAgICAgIH0pKVxuICogICAgICAgICAgICAgKTtcbiAqICAgICAgICAgfSxcbiAqICAgICAgICAgb25FcnJvcjogKFxuICogICAgICAgICAgIGFjdGl2YXRlZFJvdXRlU25hcHNob3Q6IEFjdGl2YXRlZFJvdXRlU25hcHNob3QsXG4gKiAgICAgICAgICAgZXJyb3I6IGFueVxuICogICAgICAgICApID0+IHtcbiAqICAgICAgICAgICAvLyB3ZSBjYW4gbG9nIGFuZCBlcnJvciBoZXJlIGFuZCByZXR1cm4gbnVsbFxuICogICAgICAgICAgIC8vIHdlIGNhbiBhbHNvIG5hdmlnYXRlIGJhY2tcbiAqICAgICAgICAgICByZXR1cm4gbnVsbDtcbiAqICAgICAgICAgfSxcbiAqICAgICAgIH0pXG4gKiAgICAgKVxuICogICApO1xuICpcbiAqICAgY29uc3RydWN0b3IocHJpdmF0ZSBhY3Rpb25zJDogQWN0aW9ucywgcHJpdmF0ZSBiYWNrZW5kOiBCYWNrZW5kKSB7fVxuICogfVxuICogYGBgXG4gKlxuICogQHBhcmFtIGNvbXBvbmVudFxuICogQHBhcmFtIG9wdHNcbiAqXG4gKiBAZGVwcmVjYXRlZCBUaGlzIHdpbGwgYmUgcmVtb3ZlZCBpbiBOeCB2MjEuIEltcG9ydCBgbmF2aWdhdGlvbmAgZnJvbSBgQG5ncngvcm91dGVyLXN0b3JlL2RhdGEtcGVyc2lzdGVuY2VgIGlu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1cbiAgZm9yIChjb25zdCBjIG9mIHMuY2hpbGRyZW4pIHtcbiAgICBjb25zdCBzcyA9IGZpbmRTbmFwc2hvdChjb21wb25lbnQsIGMpO1xuICAgIGlmIChzcykge1xuICAgICAgcmV0dXJuIHNzO1xuICAgIH1cbiAgfVxuICByZXR1cm4gbnVsbDtcbn1cblxuZnVuY3Rpb24gd3JhcEludG9PYnNlcnZhYmxlPE8+KG9iajogT2JzZXJ2YWJsZTxPPiB8IE8gfCB2b2lkKTogT2JzZXJ2YWJsZTxPPiB7XG4gIGlmIChpc09ic2VydmFibGUob2JqKSkge1xuICAgIHJldHVybiBvYmo7XG4gIH0gZWxzZSBpZiAoIW9iaikge1xuICAgIHJldHVybiBvZigpO1xuICB9IGVsc2Uge1xuICAgIHJldHVybiBvZihvYmogYXMgTyk7XG4gIH1cbn1cbiJdfQ==
@@ -1,6 +1,7 @@
1
1
  import { first, toArray } from 'rxjs/operators';
2
2
  /**
3
- * @deprecated This will be removed in a later version of Nx. Since RxJS 7, use firstValueFrom(obs$.pipe(toArray())) or lastValueFrom(obs$.pipe(toArray())).
3
+ * @deprecated This will be removed in Nx v21. If using RxJS 7, use `firstValueFrom(obs$.pipe(toArray()))`
4
+ * or `lastValueFrom(obs$.pipe(toArray()))`. If using RxJS 6, use `obs$.pipe(toArray()).toPromise()`.
4
5
  *
5
6
  * @whatItDoes reads all the values from an observable and returns a promise
6
7
  * with an array of all values. This should be used in combination with async/await.
@@ -17,7 +18,8 @@ export function readAll(o) {
17
18
  return o.pipe(toArray()).toPromise();
18
19
  }
19
20
  /**
20
- * @deprecated This will be removed in a later version of Nx. Since RxJS 7, use firstValueFrom(obs$)
21
+ * @deprecated This will be removed in Nx v21. Since RxJS 7, use `firstValueFrom(obs$)`. If using RxJS 6,
22
+ * use `obs$.pipe(first()).toPromise()`.
21
23
  *
22
24
  * @whatItDoes reads the first value from an observable and returns a promise
23
25
  * with it. This should be used in combination with async/await.
@@ -33,4 +35,4 @@ export function readAll(o) {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WFkcyB0aGUgZmlyc3QgdmFsdWUgZnJvbSBhbiBvYnNlcnZhYmxlIGFuZCByZXR1cm5zIGEgcHJvbWlzZVxuICogd2l0aCBpdC4gVGhpcyBzaG91bGQgYmUgdXNlZCBpbiBjb21iaW5hdGlvbiB3aXRoIGFzeW5jL2F3YWl0LlxuICpcbiAqICMjIEV4YW1wbGVcbiAqXG4gKiBgYGB0eXBlc2NyaXB0XG4gKiBjb25zdCBvYnMgPSBvZigxLCAyLCAzLCA0KTtcbiAqIGNvbnN0IHJlcyA9IGF3YWl0IHJlYWRGaXJzdChvYnMpXG4gKiBleHBlY3QocmVzKS50b0VxdWFsKDEpO1xuICogYGBgXG4gKi9cbmV4cG9ydCBmdW5jdGlvbiByZWFkRmlyc3Q8VD4obzogT2JzZXJ2YWJsZTxUPik6IFByb21pc2U8VD4ge1xuICByZXR1cm4gby5waXBlKGZpcnN0KCkpLnRvUHJvbWlzZSgpO1xufVxuIl19
@@ -1,7 +1,8 @@
1
1
  import { toArray, first } from 'rxjs/operators';
2
2
 
3
3
  /**
4
- * @deprecated This will be removed in a later version of Nx. Since RxJS 7, use firstValueFrom(obs$.pipe(toArray())) or lastValueFrom(obs$.pipe(toArray())).
4
+ * @deprecated This will be removed in Nx v21. If using RxJS 7, use `firstValueFrom(obs$.pipe(toArray()))`
5
+ * or `lastValueFrom(obs$.pipe(toArray()))`. If using RxJS 6, use `obs$.pipe(toArray()).toPromise()`.
5
6
  *
6
7
  * @whatItDoes reads all the values from an observable and returns a promise
7
8
  * with an array of all values. This should be used in combination with async/await.
@@ -18,7 +19,8 @@ function readAll(o) {
18
19
  return o.pipe(toArray()).toPromise();
19
20
  }
20
21
  /**
21
- * @deprecated This will be removed in a later version of Nx. Since RxJS 7, use firstValueFrom(obs$)
22
+ * @deprecated This will be removed in Nx v21. Since RxJS 7, use `firstValueFrom(obs$)`. If using RxJS 6,
23
+ * use `obs$.pipe(first()).toPromise()`.
22
24
  *
23
25
  * @whatItDoes reads the first value from an observable and returns a promise
24
26
  * with it. This should be used in combination with async/await.
@@ -1 +1 @@
1
- {"version":3,"file":"nx-angular-testing.mjs","sources":["../../../../packages/angular/testing/src/testing-utils.ts","../../../../packages/angular/testing/nx-angular-testing.ts"],"sourcesContent":["import type { Observable } from 'rxjs';\nimport { first, toArray } from 'rxjs/operators';\n\n/**\n * @deprecated This will be removed in a later version of Nx. Since RxJS 7, use firstValueFrom(obs$.pipe(toArray())) or lastValueFrom(obs$.pipe(toArray())).\n *\n * @whatItDoes reads all the values from an observable and returns a promise\n * with an array of all values. This should be used in combination with async/await.\n *\n * ## Example\n *\n * ```typescript\n * const obs = of(1, 2, 3, 4);\n * const res = await readAll(obs)\n * expect(res).toEqual([1, 2, 3, 4]);\n * ```\n */\nexport function readAll<T>(o: Observable<T>): Promise<T[]> {\n return o.pipe(toArray()).toPromise();\n}\n\n/**\n * @deprecated This will be removed in a later version of Nx. Since RxJS 7, use firstValueFrom(obs$)\n *\n * @whatItDoes reads the first value from an observable and returns a promise\n * with it. This should be used in combination with async/await.\n *\n * ## Example\n *\n * ```typescript\n * const obs = of(1, 2, 3, 4);\n * const res = await readFirst(obs)\n * expect(res).toEqual(1);\n * ```\n */\nexport function readFirst<T>(o: Observable<T>): Promise<T> {\n return o.pipe(first()).toPromise();\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;AAGA;;;;;;;;;;;;;AAaG;AACG,SAAU,OAAO,CAAI,CAAgB,EAAA;IACzC,OAAO,CAAC,CAAC,IAAI,CAAC,OAAO,EAAE,CAAC,CAAC,SAAS,EAAE,CAAC;AACvC,CAAC;AAED;;;;;;;;;;;;;AAaG;AACG,SAAU,SAAS,CAAI,CAAgB,EAAA;IAC3C,OAAO,CAAC,CAAC,IAAI,CAAC,KAAK,EAAE,CAAC,CAAC,SAAS,EAAE,CAAC;AACrC;;ACrCA;;AAEG;;;;"}
1
+ {"version":3,"file":"nx-angular-testing.mjs","sources":["../../../../packages/angular/testing/src/testing-utils.ts","../../../../packages/angular/testing/nx-angular-testing.ts"],"sourcesContent":["import type { Observable } from 'rxjs';\nimport { first, toArray } from 'rxjs/operators';\n\n/**\n * @deprecated This will be removed in Nx v21. If using RxJS 7, use `firstValueFrom(obs$.pipe(toArray()))`\n * or `lastValueFrom(obs$.pipe(toArray()))`. If using RxJS 6, use `obs$.pipe(toArray()).toPromise()`.\n *\n * @whatItDoes reads all the values from an observable and returns a promise\n * with an array of all values. This should be used in combination with async/await.\n *\n * ## Example\n *\n * ```typescript\n * const obs = of(1, 2, 3, 4);\n * const res = await readAll(obs)\n * expect(res).toEqual([1, 2, 3, 4]);\n * ```\n */\nexport function readAll<T>(o: Observable<T>): Promise<T[]> {\n return o.pipe(toArray()).toPromise();\n}\n\n/**\n * @deprecated This will be removed in Nx v21. Since RxJS 7, use `firstValueFrom(obs$)`. If using RxJS 6,\n * use `obs$.pipe(first()).toPromise()`.\n *\n * @whatItDoes reads the first value from an observable and returns a promise\n * with it. This should be used in combination with async/await.\n *\n * ## Example\n *\n * ```typescript\n * const obs = of(1, 2, 3, 4);\n * const res = await readFirst(obs)\n * expect(res).toEqual(1);\n * ```\n */\nexport function readFirst<T>(o: Observable<T>): Promise<T> {\n return o.pipe(first()).toPromise();\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;AAGA;;;;;;;;;;;;;;AAcG;AACG,SAAU,OAAO,CAAI,CAAgB,EAAA;IACzC,OAAO,CAAC,CAAC,IAAI,CAAC,OAAO,EAAE,CAAC,CAAC,SAAS,EAAE,CAAC;AACvC,CAAC;AAED;;;;;;;;;;;;;;AAcG;AACG,SAAU,SAAS,CAAI,CAAgB,EAAA;IAC3C,OAAO,CAAC,CAAC,IAAI,CAAC,KAAK,EAAE,CAAC,CAAC,SAAS,EAAE,CAAC;AACrC;;ACvCA;;AAEG;;;;"}
@@ -3,7 +3,6 @@ import { isObservable, of } from 'rxjs';
3
3
  import { concatMap, groupBy, mergeMap, switchMap, filter, map, catchError } from 'rxjs/operators';
4
4
 
5
5
  /**
6
- *
7
6
  * @whatItDoes Handles pessimistic updates (updating the server first).
8
7
  *
9
8
  * Updating the server, when implemented naively, suffers from race conditions and poor error handling.
@@ -58,6 +57,8 @@ import { concatMap, groupBy, mergeMap, switchMap, filter, map, catchError } from
58
57
  * ```
59
58
  *
60
59
  * @param opts
60
+ *
61
+ * @deprecated This will be removed in Nx v21. Import `pessimisticUpdate` from `@ngrx/router-store/data-persistence` instead.
61
62
  */
62
63
  function pessimisticUpdate(opts) {
63
64
  return (source) => {
@@ -65,7 +66,6 @@ function pessimisticUpdate(opts) {
65
66
  };
66
67
  }
67
68
  /**
68
- *
69
69
  * @whatItDoes Handles optimistic updates (updating the client first).
70
70
  *
71
71
  * It runs all fetches in order, which removes race conditions and forces the developer to handle errors.
@@ -121,6 +121,8 @@ function pessimisticUpdate(opts) {
121
121
  * ```
122
122
  *
123
123
  * @param opts
124
+ *
125
+ * @deprecated This will be removed in Nx v21. Import `optimisticUpdate` from `@ngrx/router-store/data-persistence` instead.
124
126
  */
125
127
  function optimisticUpdate(opts) {
126
128
  return (source) => {
@@ -128,7 +130,6 @@ function optimisticUpdate(opts) {
128
130
  };
129
131
  }
130
132
  /**
131
- *
132
133
  * @whatItDoes Handles data fetching.
133
134
  *
134
135
  * Data fetching implemented naively suffers from race conditions and poor error handling.
@@ -204,6 +205,8 @@ function optimisticUpdate(opts) {
204
205
  * In addition, if there are multiple requests for Todo 1 scheduled, it will only run the last one.
205
206
  *
206
207
  * @param opts
208
+ *
209
+ * @deprecated This will be removed in Nx v21. Import `fetch` from `@ngrx/router-store/data-persistence` instead.
207
210
  */
208
211
  function fetch(opts) {
209
212
  return (source) => {
@@ -264,6 +267,8 @@ function fetch(opts) {
264
267
  *
265
268
  * @param component
266
269
  * @param opts
270
+ *
271
+ * @deprecated This will be removed in Nx v21. Import `navigation` from `@ngrx/router-store/data-persistence` instead.
267
272
  */
268
273
  function navigation(component, opts) {
269
274
  return (source) => {
@@ -1 +1 @@
1
- {"version":3,"file":"nx-angular.mjs","sources":["../../../../packages/angular/src/runtime/nx/data-persistence.ts","../../../../packages/angular/nx-angular.ts"],"sourcesContent":["import type { Type } from '@angular/core';\nimport type {\n ActivatedRouteSnapshot,\n RouterStateSnapshot,\n} from '@angular/router';\nimport type { RouterNavigationAction } from '@ngrx/router-store';\nimport { ROUTER_NAVIGATION } from '@ngrx/router-store';\nimport type { Action } from '@ngrx/store';\nimport type { Observable } from 'rxjs';\nimport { isObservable, of } from 'rxjs';\nimport {\n catchError,\n concatMap,\n filter,\n groupBy,\n map,\n mergeMap,\n switchMap,\n} from 'rxjs/operators';\n\nexport interface PessimisticUpdateOpts<T extends Array<unknown>, A> {\n run(a: A, ...slices: [...T]): Observable<Action> | Action | void;\n onError(a: A, e: any): Observable<any> | any;\n}\n\nexport interface OptimisticUpdateOpts<T extends Array<unknown>, A> {\n run(a: A, ...slices: [...T]): Observable<Action> | Action | void;\n undoAction(a: A, e: any): Observable<Action> | Action;\n}\n\nexport interface FetchOpts<T extends Array<unknown>, A> {\n id?(a: A, ...slices: [...T]): any;\n run(a: A, ...slices: [...T]): Observable<Action> | Action | void;\n onError?(a: A, e: any): Observable<any> | any;\n}\n\nexport interface HandleNavigationOpts<T extends Array<unknown>> {\n run(\n a: ActivatedRouteSnapshot,\n ...slices: [...T]\n ): Observable<Action> | Action | void;\n onError?(a: ActivatedRouteSnapshot, e: any): Observable<any> | any;\n}\n\nexport type ActionOrActionWithStates<T extends Array<unknown>, A> =\n | A\n | [A, ...T];\nexport type ActionOrActionWithState<T, A> = ActionOrActionWithStates<[T], A>;\nexport type ActionStatesStream<T extends Array<unknown>, A> = Observable<\n ActionOrActionWithStates<T, A>\n>;\nexport type ActionStateStream<T, A> = Observable<\n ActionOrActionWithStates<[T], A>\n>;\n\n/**\n *\n * @whatItDoes Handles pessimistic updates (updating the server first).\n *\n * Updating the server, when implemented naively, suffers from race conditions and poor error handling.\n *\n * `pessimisticUpdate` addresses these problems. It runs all fetches in order, which removes race conditions\n * and forces the developer to handle errors.\n *\n * ## Example:\n *\n * ```typescript\n * @Injectable()\n * class TodoEffects {\n * updateTodo$ = createEffect(() =>\n * this.actions$.pipe(\n * ofType('UPDATE_TODO'),\n * pessimisticUpdate({\n * // provides an action\n * run: (action: UpdateTodo) => {\n * // update the backend first, and then dispatch an action that will\n * // update the client side\n * return this.backend.updateTodo(action.todo.id, action.todo).pipe(\n * map((updated) => ({\n * type: 'UPDATE_TODO_SUCCESS',\n * todo: updated,\n * }))\n * );\n * },\n * onError: (action: UpdateTodo, error: any) => {\n * // we don't need to undo the changes on the client side.\n * // we can dispatch an error, or simply log the error here and return `null`\n * return null;\n * },\n * })\n * )\n * );\n *\n * constructor(private actions$: Actions, private backend: Backend) {}\n * }\n * ```\n *\n * Note that if you don't return a new action from the run callback, you must set the dispatch property\n * of the effect to false, like this:\n *\n * ```typescript\n * class TodoEffects {\n * updateTodo$ = createEffect(() =>\n * this.actions$.pipe(\n * //...\n * ), { dispatch: false }\n * );\n * }\n * ```\n *\n * @param opts\n */\nexport function pessimisticUpdate<T extends Array<unknown>, A extends Action>(\n opts: PessimisticUpdateOpts<T, A>\n) {\n return (source: ActionStatesStream<T, A>): Observable<Action> => {\n return source.pipe(\n mapActionAndState(),\n concatMap(runWithErrorHandling(opts.run, opts.onError))\n );\n };\n}\n\n/**\n *\n * @whatItDoes Handles optimistic updates (updating the client first).\n *\n * It runs all fetches in order, which removes race conditions and forces the developer to handle errors.\n *\n * When using `optimisticUpdate`, in case of a failure, the developer has already updated the state locally,\n * so the developer must provide an undo action.\n *\n * The error handling must be done in the callback, or by means of the undo action.\n *\n * ## Example:\n *\n * ```typescript\n * @Injectable()\n * class TodoEffects {\n * updateTodo$ = createEffect(() =>\n * this.actions$.pipe(\n * ofType('UPDATE_TODO'),\n * optimisticUpdate({\n * // provides an action\n * run: (action: UpdateTodo) => {\n * return this.backend.updateTodo(action.todo.id, action.todo).pipe(\n * mapTo({\n * type: 'UPDATE_TODO_SUCCESS',\n * })\n * );\n * },\n * undoAction: (action: UpdateTodo, error: any) => {\n * // dispatch an undo action to undo the changes in the client state\n * return {\n * type: 'UNDO_TODO_UPDATE',\n * todo: action.todo,\n * };\n * },\n * })\n * )\n * );\n *\n * constructor(private actions$: Actions, private backend: Backend) {}\n * }\n * ```\n *\n * Note that if you don't return a new action from the run callback, you must set the dispatch property\n * of the effect to false, like this:\n *\n * ```typescript\n * class TodoEffects {\n * updateTodo$ = createEffect(() =>\n * this.actions$.pipe(\n * //...\n * ), { dispatch: false }\n * );\n * }\n * ```\n *\n * @param opts\n */\nexport function optimisticUpdate<T extends Array<unknown>, A extends Action>(\n opts: OptimisticUpdateOpts<T, A>\n) {\n return (source: ActionStatesStream<T, A>): Observable<Action> => {\n return source.pipe(\n mapActionAndState(),\n concatMap(runWithErrorHandling(opts.run, opts.undoAction))\n );\n };\n}\n\n/**\n *\n * @whatItDoes Handles data fetching.\n *\n * Data fetching implemented naively suffers from race conditions and poor error handling.\n *\n * `fetch` addresses these problems. It runs all fetches in order, which removes race conditions\n * and forces the developer to handle errors.\n *\n * ## Example:\n *\n * ```typescript\n * @Injectable()\n * class TodoEffects {\n * loadTodos$ = createEffect(() =>\n * this.actions$.pipe(\n * ofType('GET_TODOS'),\n * fetch({\n * // provides an action\n * run: (a: GetTodos) => {\n * return this.backend.getAll().pipe(\n * map((response) => ({\n * type: 'TODOS',\n * todos: response.todos,\n * }))\n * );\n * },\n * onError: (action: GetTodos, error: any) => {\n * // dispatch an undo action to undo the changes in the client state\n * return null;\n * },\n * })\n * )\n * );\n *\n * constructor(private actions$: Actions, private backend: Backend) {}\n * }\n * ```\n *\n * This is correct, but because it set the concurrency to 1, it may not be performant.\n *\n * To fix that, you can provide the `id` function, like this:\n *\n * ```typescript\n * @Injectable()\n * class TodoEffects {\n * loadTodo$ = createEffect(() =>\n * this.actions$.pipe(\n * ofType('GET_TODO'),\n * fetch({\n * id: (todo: GetTodo) => {\n * return todo.id;\n * },\n * // provides an action\n * run: (todo: GetTodo) => {\n * return this.backend.getTodo(todo.id).map((response) => ({\n * type: 'LOAD_TODO_SUCCESS',\n * todo: response.todo,\n * }));\n * },\n * onError: (action: GetTodo, error: any) => {\n * // dispatch an undo action to undo the changes in the client state\n * return null;\n * },\n * })\n * )\n * );\n *\n * constructor(private actions$: Actions, private backend: Backend) {}\n * }\n * ```\n *\n * With this setup, the requests for Todo 1 will run concurrently with the requests for Todo 2.\n *\n * In addition, if there are multiple requests for Todo 1 scheduled, it will only run the last one.\n *\n * @param opts\n */\nexport function fetch<T extends Array<unknown>, A extends Action>(\n opts: FetchOpts<T, A>\n) {\n return (source: ActionStatesStream<T, A>): Observable<Action> => {\n if (opts.id) {\n const groupedFetches = source.pipe(\n mapActionAndState(),\n groupBy(([action, ...store]) => {\n return opts.id(action, ...store);\n })\n );\n\n return groupedFetches.pipe(\n mergeMap((pairs) =>\n pairs.pipe(switchMap(runWithErrorHandling(opts.run, opts.onError)))\n )\n );\n }\n\n return source.pipe(\n mapActionAndState(),\n concatMap(runWithErrorHandling(opts.run, opts.onError))\n );\n };\n}\n\n/**\n * @whatItDoes Handles data fetching as part of router navigation.\n *\n * Data fetching implemented naively suffers from race conditions and poor error handling.\n *\n * `navigation` addresses these problems.\n *\n * It checks if an activated router state contains the passed in component type, and, if it does, runs the `run`\n * callback. It provides the activated snapshot associated with the component and the current state. And it only runs\n * the last request.\n *\n * ## Example:\n *\n * ```typescript\n * @Injectable()\n * class TodoEffects {\n * loadTodo$ = createEffect(() =>\n * this.actions$.pipe(\n * // listens for the routerNavigation action from @ngrx/router-store\n * navigation(TodoComponent, {\n * run: (activatedRouteSnapshot: ActivatedRouteSnapshot) => {\n * return this.backend\n * .fetchTodo(activatedRouteSnapshot.params['id'])\n * .pipe(\n * map((todo) => ({\n * type: 'LOAD_TODO_SUCCESS',\n * todo: todo,\n * }))\n * );\n * },\n * onError: (\n * activatedRouteSnapshot: ActivatedRouteSnapshot,\n * error: any\n * ) => {\n * // we can log and error here and return null\n * // we can also navigate back\n * return null;\n * },\n * })\n * )\n * );\n *\n * constructor(private actions$: Actions, private backend: Backend) {}\n * }\n * ```\n *\n * @param component\n * @param opts\n */\nexport function navigation<T extends Array<unknown>, A extends Action>(\n component: Type<any>,\n opts: HandleNavigationOpts<T>\n) {\n return (source: ActionStatesStream<T, A>) => {\n const nav = source.pipe(\n mapActionAndState(),\n filter(([action]) => isStateSnapshot(action)),\n map(([action, ...slices]) => {\n if (!isStateSnapshot(action)) {\n // Because of the above filter we'll never get here,\n // but this properly type narrows `action`\n return;\n }\n\n return [\n findSnapshot(component, action.payload.routerState.root),\n ...slices,\n ] as [ActivatedRouteSnapshot, ...T];\n }),\n filter(([snapshot]) => !!snapshot)\n );\n\n return nav.pipe(switchMap(runWithErrorHandling(opts.run, opts.onError)));\n };\n}\n\nfunction isStateSnapshot(\n action: any\n): action is RouterNavigationAction<RouterStateSnapshot> {\n return action.type === ROUTER_NAVIGATION;\n}\n\nfunction runWithErrorHandling<T extends Array<unknown>, A, R>(\n run: (a: A, ...slices: [...T]) => Observable<R> | R | void,\n onError: any\n) {\n return ([action, ...slices]: [A, ...T]): Observable<R> => {\n try {\n const r = wrapIntoObservable(run(action, ...slices));\n return r.pipe(catchError((e) => wrapIntoObservable(onError(action, e))));\n } catch (e) {\n return wrapIntoObservable(onError(action, e));\n }\n };\n}\n\n/**\n * @whatItDoes maps Observable<Action | [Action, State]> to\n * Observable<[Action, State]>\n */\nfunction mapActionAndState<T extends Array<unknown>, A>() {\n return (source: Observable<ActionOrActionWithStates<T, A>>) => {\n return source.pipe(\n map((value) => normalizeActionAndState(value) as [A, ...T])\n );\n };\n}\n\n/**\n * @whatItDoes Normalizes either a bare action or an array of action and slices\n * into an array of action and slices (or undefined)\n */\nfunction normalizeActionAndState<T extends Array<unknown>, A>(\n args: ActionOrActionWithStates<T, A>\n): [A, ...T] {\n let action: A, slices: T;\n\n if (args instanceof Array) {\n [action, ...slices] = args;\n } else {\n slices = [] as T;\n action = args;\n }\n\n return [action, ...slices];\n}\n\nfunction findSnapshot(\n component: Type<any>,\n s: ActivatedRouteSnapshot\n): ActivatedRouteSnapshot {\n if (s.routeConfig && s.routeConfig.component === component) {\n return s;\n }\n for (const c of s.children) {\n const ss = findSnapshot(component, c);\n if (ss) {\n return ss;\n }\n }\n return null;\n}\n\nfunction wrapIntoObservable<O>(obj: Observable<O> | O | void): Observable<O> {\n if (isObservable(obj)) {\n return obj;\n } else if (!obj) {\n return of();\n } else {\n return of(obj as O);\n }\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;AAuDA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAwDG;AACG,SAAU,iBAAiB,CAC/B,IAAiC,EAAA;IAEjC,OAAO,CAAC,MAAgC,KAAwB;QAC9D,OAAO,MAAM,CAAC,IAAI,CAChB,iBAAiB,EAAE,EACnB,SAAS,CAAC,oBAAoB,CAAC,IAAI,CAAC,GAAG,EAAE,IAAI,CAAC,OAAO,CAAC,CAAC,CACxD,CAAC;AACJ,KAAC,CAAC;AACJ,CAAC;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAyDG;AACG,SAAU,gBAAgB,CAC9B,IAAgC,EAAA;IAEhC,OAAO,CAAC,MAAgC,KAAwB;QAC9D,OAAO,MAAM,CAAC,IAAI,CAChB,iBAAiB,EAAE,EACnB,SAAS,CAAC,oBAAoB,CAAC,IAAI,CAAC,GAAG,EAAE,IAAI,CAAC,UAAU,CAAC,CAAC,CAC3D,CAAC;AACJ,KAAC,CAAC;AACJ,CAAC;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA6EG;AACG,SAAU,KAAK,CACnB,IAAqB,EAAA;IAErB,OAAO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AAI,YAAY,KAAK,EAAE;AACzB,QAAA,CAAC,MAAM,EAAE,GAAG,MAAM,CAAC,GAAG,IAAI,CAAC;KAC5B;SAAM;QACL,MAAM,GAAG,EAAO,CAAC;QACjB,MAAM,GAAG,IAAI,CAAC;KACf;AAED,IAAA,OAAO,CAAC,MAAM,EAAE,GAAG,MAAM,CAAC,CAAC;AAC7B,CAAC;AAED,SAAS,YAAY,CACnB,SAAoB,EACpB,CAAyB,EAAA;AAEzB,IAAA,IAAI,CAAC,CAAC,WAAW,IAAI,CAAC,CAAC,WAAW,CAAC,SAAS,KAAK,SAAS,EAAE;AAC1D,QAAA,OAAO,CAAC,CAAC;KACV;AACD,IAAA,KAAK,MAAM,CAAC,IAAI,CAAC,CAAC,QAAQ,EAAE;QAC1B,MAAM,EAAE,GAAG,YAAY,CAAC,SAAS,EAAE,CAAC,CAAC,CAAC;QACtC,IAAI,EAAE,EAAE;AACN,YAAA,OAAO,EAAE,CAAC;SACX;KACF;AACD,IAAA,OAAO,IAAI,CAAC;AACd,CAAC;AAED,SAAS,kBAAkB,CAAI,GAA6B,EAAA;AAC1D,IAAA,IAAI,YAAY,CAAC,GAAG,CAAC,EAAE;AACrB,QAAA,OAAO,GAAG,CAAC;KACZ;SAAM,IAAI,CAAC,GAAG,EAAE;QACf,OAAO,EAAE,EAAE,CAAC;KACb;SAAM;AACL,QAAA,OAAO,EAAE,CAAC,GAAQ,CAAC,CAAC;KACrB;AACH;;AC/bA;;AAEG;;;;"}
1
+ {"version":3,"file":"nx-angular.mjs","sources":["../../../../packages/angular/src/runtime/nx/data-persistence.ts","../../../../packages/angular/nx-angular.ts"],"sourcesContent":["import type { Type } from '@angular/core';\nimport type {\n ActivatedRouteSnapshot,\n RouterStateSnapshot,\n} from '@angular/router';\nimport type { RouterNavigationAction } from '@ngrx/router-store';\nimport { ROUTER_NAVIGATION } from '@ngrx/router-store';\nimport type { Action } from '@ngrx/store';\nimport type { Observable } from 'rxjs';\nimport { isObservable, of } from 'rxjs';\nimport {\n catchError,\n concatMap,\n filter,\n groupBy,\n map,\n mergeMap,\n switchMap,\n} from 'rxjs/operators';\n\nexport interface PessimisticUpdateOpts<T extends Array<unknown>, A> {\n run(a: A, ...slices: [...T]): Observable<Action> | Action | void;\n onError(a: A, e: any): Observable<any> | any;\n}\n\nexport interface OptimisticUpdateOpts<T extends Array<unknown>, A> {\n run(a: A, ...slices: [...T]): Observable<Action> | Action | void;\n undoAction(a: A, e: any): Observable<Action> | Action;\n}\n\nexport interface FetchOpts<T extends Array<unknown>, A> {\n id?(a: A, ...slices: [...T]): any;\n run(a: A, ...slices: [...T]): Observable<Action> | Action | void;\n onError?(a: A, e: any): Observable<any> | any;\n}\n\nexport interface HandleNavigationOpts<T extends Array<unknown>> {\n run(\n a: ActivatedRouteSnapshot,\n ...slices: [...T]\n ): Observable<Action> | Action | void;\n onError?(a: ActivatedRouteSnapshot, e: any): Observable<any> | any;\n}\n\nexport type ActionOrActionWithStates<T extends Array<unknown>, A> =\n | A\n | [A, ...T];\nexport type ActionOrActionWithState<T, A> = ActionOrActionWithStates<[T], A>;\nexport type ActionStatesStream<T extends Array<unknown>, A> = Observable<\n ActionOrActionWithStates<T, A>\n>;\nexport type ActionStateStream<T, A> = Observable<\n ActionOrActionWithStates<[T], A>\n>;\n\n/**\n * @whatItDoes Handles pessimistic updates (updating the server first).\n *\n * Updating the server, when implemented naively, suffers from race conditions and poor error handling.\n *\n * `pessimisticUpdate` addresses these problems. It runs all fetches in order, which removes race conditions\n * and forces the developer to handle errors.\n *\n * ## Example:\n *\n * ```typescript\n * @Injectable()\n * class TodoEffects {\n * updateTodo$ = createEffect(() =>\n * this.actions$.pipe(\n * ofType('UPDATE_TODO'),\n * pessimisticUpdate({\n * // provides an action\n * run: (action: UpdateTodo) => {\n * // update the backend first, and then dispatch an action that will\n * // update the client side\n * return this.backend.updateTodo(action.todo.id, action.todo).pipe(\n * map((updated) => ({\n * type: 'UPDATE_TODO_SUCCESS',\n * todo: updated,\n * }))\n * );\n * },\n * onError: (action: UpdateTodo, error: any) => {\n * // we don't need to undo the changes on the client side.\n * // we can dispatch an error, or simply log the error here and return `null`\n * return null;\n * },\n * })\n * )\n * );\n *\n * constructor(private actions$: Actions, private backend: Backend) {}\n * }\n * ```\n *\n * Note that if you don't return a new action from the run callback, you must set the dispatch property\n * of the effect to false, like this:\n *\n * ```typescript\n * class TodoEffects {\n * updateTodo$ = createEffect(() =>\n * this.actions$.pipe(\n * //...\n * ), { dispatch: false }\n * );\n * }\n * ```\n *\n * @param opts\n *\n * @deprecated This will be removed in Nx v21. Import `pessimisticUpdate` from `@ngrx/router-store/data-persistence` instead.\n */\nexport function pessimisticUpdate<T extends Array<unknown>, A extends Action>(\n opts: PessimisticUpdateOpts<T, A>\n) {\n return (source: ActionStatesStream<T, A>): Observable<Action> => {\n return source.pipe(\n mapActionAndState(),\n concatMap(runWithErrorHandling(opts.run, opts.onError))\n );\n };\n}\n\n/**\n * @whatItDoes Handles optimistic updates (updating the client first).\n *\n * It runs all fetches in order, which removes race conditions and forces the developer to handle errors.\n *\n * When using `optimisticUpdate`, in case of a failure, the developer has already updated the state locally,\n * so the developer must provide an undo action.\n *\n * The error handling must be done in the callback, or by means of the undo action.\n *\n * ## Example:\n *\n * ```typescript\n * @Injectable()\n * class TodoEffects {\n * updateTodo$ = createEffect(() =>\n * this.actions$.pipe(\n * ofType('UPDATE_TODO'),\n * optimisticUpdate({\n * // provides an action\n * run: (action: UpdateTodo) => {\n * return this.backend.updateTodo(action.todo.id, action.todo).pipe(\n * mapTo({\n * type: 'UPDATE_TODO_SUCCESS',\n * })\n * );\n * },\n * undoAction: (action: UpdateTodo, error: any) => {\n * // dispatch an undo action to undo the changes in the client state\n * return {\n * type: 'UNDO_TODO_UPDATE',\n * todo: action.todo,\n * };\n * },\n * })\n * )\n * );\n *\n * constructor(private actions$: Actions, private backend: Backend) {}\n * }\n * ```\n *\n * Note that if you don't return a new action from the run callback, you must set the dispatch property\n * of the effect to false, like this:\n *\n * ```typescript\n * class TodoEffects {\n * updateTodo$ = createEffect(() =>\n * this.actions$.pipe(\n * //...\n * ), { dispatch: false }\n * );\n * }\n * ```\n *\n * @param opts\n *\n * @deprecated This will be removed in Nx v21. Import `optimisticUpdate` from `@ngrx/router-store/data-persistence` instead.\n */\nexport function optimisticUpdate<T extends Array<unknown>, A extends Action>(\n opts: OptimisticUpdateOpts<T, A>\n) {\n return (source: ActionStatesStream<T, A>): Observable<Action> => {\n return source.pipe(\n mapActionAndState(),\n concatMap(runWithErrorHandling(opts.run, opts.undoAction))\n );\n };\n}\n\n/**\n * @whatItDoes Handles data fetching.\n *\n * Data fetching implemented naively suffers from race conditions and poor error handling.\n *\n * `fetch` addresses these problems. It runs all fetches in order, which removes race conditions\n * and forces the developer to handle errors.\n *\n * ## Example:\n *\n * ```typescript\n * @Injectable()\n * class TodoEffects {\n * loadTodos$ = createEffect(() =>\n * this.actions$.pipe(\n * ofType('GET_TODOS'),\n * fetch({\n * // provides an action\n * run: (a: GetTodos) => {\n * return this.backend.getAll().pipe(\n * map((response) => ({\n * type: 'TODOS',\n * todos: response.todos,\n * }))\n * );\n * },\n * onError: (action: GetTodos, error: any) => {\n * // dispatch an undo action to undo the changes in the client state\n * return null;\n * },\n * })\n * )\n * );\n *\n * constructor(private actions$: Actions, private backend: Backend) {}\n * }\n * ```\n *\n * This is correct, but because it set the concurrency to 1, it may not be performant.\n *\n * To fix that, you can provide the `id` function, like this:\n *\n * ```typescript\n * @Injectable()\n * class TodoEffects {\n * loadTodo$ = createEffect(() =>\n * this.actions$.pipe(\n * ofType('GET_TODO'),\n * fetch({\n * id: (todo: GetTodo) => {\n * return todo.id;\n * },\n * // provides an action\n * run: (todo: GetTodo) => {\n * return this.backend.getTodo(todo.id).map((response) => ({\n * type: 'LOAD_TODO_SUCCESS',\n * todo: response.todo,\n * }));\n * },\n * onError: (action: GetTodo, error: any) => {\n * // dispatch an undo action to undo the changes in the client state\n * return null;\n * },\n * })\n * )\n * );\n *\n * constructor(private actions$: Actions, private backend: Backend) {}\n * }\n * ```\n *\n * With this setup, the requests for Todo 1 will run concurrently with the requests for Todo 2.\n *\n * In addition, if there are multiple requests for Todo 1 scheduled, it will only run the last one.\n *\n * @param opts\n *\n * @deprecated This will be removed in Nx v21. Import `fetch` from `@ngrx/router-store/data-persistence` instead.\n */\nexport function fetch<T extends Array<unknown>, A extends Action>(\n opts: FetchOpts<T, A>\n) {\n return (source: ActionStatesStream<T, A>): Observable<Action> => {\n if (opts.id) {\n const groupedFetches = source.pipe(\n mapActionAndState(),\n groupBy(([action, ...store]) => {\n return opts.id(action, ...store);\n })\n );\n\n return groupedFetches.pipe(\n mergeMap((pairs) =>\n pairs.pipe(switchMap(runWithErrorHandling(opts.run, opts.onError)))\n )\n );\n }\n\n return source.pipe(\n mapActionAndState(),\n concatMap(runWithErrorHandling(opts.run, opts.onError))\n );\n };\n}\n\n/**\n * @whatItDoes Handles data fetching as part of router navigation.\n *\n * Data fetching implemented naively suffers from race conditions and poor error handling.\n *\n * `navigation` addresses these problems.\n *\n * It checks if an activated router state contains the passed in component type, and, if it does, runs the `run`\n * callback. It provides the activated snapshot associated with the component and the current state. And it only runs\n * the last request.\n *\n * ## Example:\n *\n * ```typescript\n * @Injectable()\n * class TodoEffects {\n * loadTodo$ = createEffect(() =>\n * this.actions$.pipe(\n * // listens for the routerNavigation action from @ngrx/router-store\n * navigation(TodoComponent, {\n * run: (activatedRouteSnapshot: ActivatedRouteSnapshot) => {\n * return this.backend\n * .fetchTodo(activatedRouteSnapshot.params['id'])\n * .pipe(\n * map((todo) => ({\n * type: 'LOAD_TODO_SUCCESS',\n * todo: todo,\n * }))\n * );\n * },\n * onError: (\n * activatedRouteSnapshot: ActivatedRouteSnapshot,\n * error: any\n * ) => {\n * // we can log and error here and return null\n * // we can also navigate back\n * return null;\n * },\n * })\n * )\n * );\n *\n * constructor(private actions$: Actions, private backend: Backend) {}\n * }\n * ```\n *\n * @param component\n * @param opts\n *\n * @deprecated This will be removed in Nx v21. Import `navigation` from `@ngrx/router-store/data-persistence` instead.\n */\nexport function navigation<T extends Array<unknown>, A extends Action>(\n component: Type<any>,\n opts: HandleNavigationOpts<T>\n) {\n return (source: ActionStatesStream<T, A>) => {\n const nav = source.pipe(\n mapActionAndState(),\n filter(([action]) => isStateSnapshot(action)),\n map(([action, ...slices]) => {\n if (!isStateSnapshot(action)) {\n // Because of the above filter we'll never get here,\n // but this properly type narrows `action`\n return;\n }\n\n return [\n findSnapshot(component, action.payload.routerState.root),\n ...slices,\n ] as [ActivatedRouteSnapshot, ...T];\n }),\n filter(([snapshot]) => !!snapshot)\n );\n\n return nav.pipe(switchMap(runWithErrorHandling(opts.run, opts.onError)));\n };\n}\n\nfunction isStateSnapshot(\n action: any\n): action is RouterNavigationAction<RouterStateSnapshot> {\n return action.type === ROUTER_NAVIGATION;\n}\n\nfunction runWithErrorHandling<T extends Array<unknown>, A, R>(\n run: (a: A, ...slices: [...T]) => Observable<R> | R | void,\n onError: any\n) {\n return ([action, ...slices]: [A, ...T]): Observable<R> => {\n try {\n const r = wrapIntoObservable(run(action, ...slices));\n return r.pipe(catchError((e) => wrapIntoObservable(onError(action, e))));\n } catch (e) {\n return wrapIntoObservable(onError(action, e));\n }\n };\n}\n\n/**\n * @whatItDoes maps Observable<Action | [Action, State]> to\n * Observable<[Action, State]>\n */\nfunction mapActionAndState<T extends Array<unknown>, A>() {\n return (source: Observable<ActionOrActionWithStates<T, A>>) => {\n return source.pipe(\n map((value) => normalizeActionAndState(value) as [A, ...T])\n );\n };\n}\n\n/**\n * @whatItDoes Normalizes either a bare action or an array of action and slices\n * into an array of action and slices (or undefined)\n */\nfunction normalizeActionAndState<T extends Array<unknown>, A>(\n args: ActionOrActionWithStates<T, A>\n): [A, ...T] {\n let action: A, slices: T;\n\n if (args instanceof Array) {\n [action, ...slices] = args;\n } else {\n slices = [] as T;\n action = args;\n }\n\n return [action, ...slices];\n}\n\nfunction findSnapshot(\n component: Type<any>,\n s: ActivatedRouteSnapshot\n): ActivatedRouteSnapshot {\n if (s.routeConfig && s.routeConfig.component === component) {\n return s;\n }\n for (const c of s.children) {\n const ss = findSnapshot(component, c);\n if (ss) {\n return ss;\n }\n }\n return null;\n}\n\nfunction wrapIntoObservable<O>(obj: Observable<O> | O | void): Observable<O> {\n if (isObservable(obj)) {\n return obj;\n } else if (!obj) {\n return of();\n } else {\n return of(obj as O);\n }\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;AAuDA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAyDG;AACG,SAAU,iBAAiB,CAC/B,IAAiC,EAAA;IAEjC,OAAO,CAAC,MAAgC,KAAwB;QAC9D,OAAO,MAAM,CAAC,IAAI,CAChB,iBAAiB,EAAE,EACnB,SAAS,CAAC,oBAAoB,CAAC,IAAI,CAAC,GAAG,EAAE,IAAI,CAAC,OAAO,CAAC,CAAC,CACxD,CAAC;AACJ,KAAC,CAAC;AACJ,CAAC;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA0DG;AACG,SAAU,gBAAgB,CAC9B,IAAgC,EAAA;IAEhC,OAAO,CAAC,MAAgC,KAAwB;QAC9D,OAAO,MAAM,CAAC,IAAI,CAChB,iBAAiB,EAAE,EACnB,SAAS,CAAC,oBAAoB,CAAC,IAAI,CAAC,GAAG,EAAE,IAAI,CAAC,UAAU,CAAC,CAAC,CAC3D,CAAC;AACJ,KAAC,CAAC;AACJ,CAAC;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA8EG;AACG,SAAU,KAAK,CACnB,IAAqB,EAAA;IAErB,OAAO,CAAC,MAAgC,KAAwB;AAC9D,QAAA,IAAI,IAAI,CAAC,EAAE,EAAE;AACX,YAAA,MAAM,cAAc,GAAG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AC5B;SAAM;QACL,MAAM,GAAG,EAAO,CAAC;QACjB,MAAM,GAAG,IAAI,CAAC;KACf;AAED,IAAA,OAAO,CAAC,MAAM,EAAE,GAAG,MAAM,CAAC,CAAC;AAC7B,CAAC;AAED,SAAS,YAAY,CACnB,SAAoB,EACpB,CAAyB,EAAA;AAEzB,IAAA,IAAI,CAAC,CAAC,WAAW,IAAI,CAAC,CAAC,WAAW,CAAC,SAAS,KAAK,SAAS,EAAE;AAC1D,QAAA,OAAO,CAAC,CAAC;KACV;AACD,IAAA,KAAK,MAAM,CAAC,IAAI,CAAC,CAAC,QAAQ,EAAE;QAC1B,MAAM,EAAE,GAAG,YAAY,CAAC,SAAS,EAAE,CAAC,CAAC,CAAC;QACtC,IAAI,EAAE,EAAE;AACN,YAAA,OAAO,EAAE,CAAC;SACX;KACF;AACD,IAAA,OAAO,IAAI,CAAC;AACd,CAAC;AAED,SAAS,kBAAkB,CAAI,GAA6B,EAAA;AAC1D,IAAA,IAAI,YAAY,CAAC,GAAG,CAAC,EAAE;AACrB,QAAA,OAAO,GAAG,CAAC;KACZ;SAAM,IAAI,CAAC,GAAG,EAAE;QACf,OAAO,EAAE,EAAE,CAAC;KACb;SAAM;AACL,QAAA,OAAO,EAAE,CAAC,GAAQ,CAAC,CAAC;KACrB;AACH;;ACpcA;;AAEG;;;;"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nx/angular",
3
- "version": "19.6.0-beta.3",
3
+ "version": "19.6.0-beta.5",
4
4
  "private": false,
5
5
  "description": "The Nx Plugin for Angular contains executors, generators, and utilities for managing Angular applications and libraries within an Nx workspace. It provides: \n\n- Integration with libraries such as Storybook, Jest, ESLint, Tailwind CSS, Playwright and Cypress. \n\n- Generators to help scaffold code quickly (like: Micro Frontends, Libraries, both internal to your codebase and publishable to npm) \n\n- Single Component Application Modules (SCAMs) \n\n- NgRx helpers. \n\n- Utilities for automatic workspace refactoring.",
6
6
  "repository": {
@@ -79,14 +79,14 @@
79
79
  "webpack-merge": "^5.8.0",
80
80
  "webpack": "^5.88.0",
81
81
  "@module-federation/enhanced": "~0.2.3",
82
- "@nx/devkit": "19.6.0-beta.3",
83
- "@nx/js": "19.6.0-beta.3",
84
- "@nx/eslint": "19.6.0-beta.3",
85
- "@nx/webpack": "19.6.0-beta.3",
86
- "@nx/web": "19.6.0-beta.3",
87
- "@nx/workspace": "19.6.0-beta.3",
82
+ "@nx/devkit": "19.6.0-beta.5",
83
+ "@nx/js": "19.6.0-beta.5",
84
+ "@nx/eslint": "19.6.0-beta.5",
85
+ "@nx/webpack": "19.6.0-beta.5",
86
+ "@nx/web": "19.6.0-beta.5",
87
+ "@nx/workspace": "19.6.0-beta.5",
88
88
  "piscina": "^4.4.0",
89
- "@nrwl/angular": "19.6.0-beta.3"
89
+ "@nrwl/angular": "19.6.0-beta.5"
90
90
  },
91
91
  "peerDependencies": {
92
92
  "@angular-devkit/build-angular": ">= 16.0.0 < 19.0.0",
@@ -254,7 +254,7 @@ class E2eMigrator extends project_migrator_1.ProjectMigrator {
254
254
  this.tree.delete(newTsConfigPath);
255
255
  this.moveFile((0, devkit_1.joinPathFragments)(this.project.oldSourceRoot, 'tsconfig.json'), newTsConfigPath);
256
256
  // replace the generated source with the project source
257
- (0, devkit_1.visitNotIgnoredFiles)(this.tree, this.project.newSourceRoot, (filePath) => {
257
+ this.visitFiles(this.project.newSourceRoot, (filePath) => {
258
258
  this.tree.delete(filePath);
259
259
  });
260
260
  this.moveDir(this.project.oldSourceRoot, (0, devkit_1.joinPathFragments)(this.project.newSourceRoot));
@@ -18,6 +18,8 @@ export declare class ProjectMigrator<TargetType extends string = string> extends
18
18
  protected convertPath(originalPath: string): string;
19
19
  protected moveDir(from: string, to: string): void;
20
20
  protected shouldSkipTargetTypeMigration(targetType: TargetType): boolean;
21
+ protected visitFiles(dirPath: string, visitor: (path: string) => void): void;
22
+ private updateGitAndPrettierIgnore;
21
23
  private collectTargetNames;
22
24
  private createBuilderMigrators;
23
25
  private skipProjectMigration;
@@ -2,6 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.ProjectMigrator = void 0;
4
4
  const devkit_1 = require("@nx/devkit");
5
+ const node_path_1 = require("node:path");
5
6
  const utilities_1 = require("../../utilities");
6
7
  const migrator_1 = require("../migrator");
7
8
  class ProjectMigrator extends migrator_1.Migrator {
@@ -42,6 +43,7 @@ class ProjectMigrator extends migrator_1.Migrator {
42
43
  migrate() {
43
44
  const validationResult = this.validate();
44
45
  if (!validationResult) {
46
+ this.updateGitAndPrettierIgnore();
45
47
  return;
46
48
  }
47
49
  this.logger.warn((0, utilities_1.getProjectValidationResultMessage)(validationResult));
@@ -138,7 +140,7 @@ class ProjectMigrator extends migrator_1.Migrator {
138
140
  return originalPath;
139
141
  }
140
142
  moveDir(from, to) {
141
- (0, devkit_1.visitNotIgnoredFiles)(this.tree, from, (file) => {
143
+ this.visitFiles(from, (file) => {
142
144
  this.moveFile(file, (0, devkit_1.normalizePath)(file).replace(from, to), true);
143
145
  });
144
146
  }
@@ -146,6 +148,41 @@ class ProjectMigrator extends migrator_1.Migrator {
146
148
  return (Array.isArray(this.skipMigration) &&
147
149
  this.skipMigration.includes(targetType));
148
150
  }
151
+ visitFiles(dirPath, visitor) {
152
+ dirPath = (0, devkit_1.normalizePath)((0, node_path_1.relative)(this.tree.root, (0, devkit_1.joinPathFragments)(this.tree.root, dirPath)));
153
+ for (const child of this.tree.children(dirPath)) {
154
+ const fullPath = (0, devkit_1.joinPathFragments)(dirPath, child);
155
+ if (this.tree.isFile(fullPath)) {
156
+ visitor(fullPath);
157
+ }
158
+ else {
159
+ this.visitFiles(fullPath, visitor);
160
+ }
161
+ }
162
+ }
163
+ updateGitAndPrettierIgnore() {
164
+ if (!this.tree.exists('.prettierignore') &&
165
+ !this.tree.exists('.gitignore')) {
166
+ return;
167
+ }
168
+ let from = this.project.oldRoot;
169
+ let to = this.project.newRoot;
170
+ if (this.project.oldRoot === '') {
171
+ from = this.project.oldSourceRoot;
172
+ to = this.project.newSourceRoot;
173
+ }
174
+ const regex = new RegExp(`(^!?\\/?)(${from})(\\/|$)`, 'gm');
175
+ if (this.tree.exists('.gitignore')) {
176
+ const gitignore = this.tree.read('.gitignore', 'utf-8');
177
+ const content = gitignore.replace(regex, `$1${to}$3`);
178
+ this.tree.write('.gitignore', content);
179
+ }
180
+ if (this.tree.exists('.prettierignore')) {
181
+ const prettierIgnore = this.tree.read('.prettierignore', 'utf-8');
182
+ const content = prettierIgnore.replace(regex, `$1${to}$3`);
183
+ this.tree.write('.prettierignore', content);
184
+ }
185
+ }
149
186
  collectTargetNames() {
150
187
  const targetTypes = Object.keys(this.targets);
151
188
  Object.entries(this.projectConfig.targets ?? {}).forEach(([targetName, target]) => {
@@ -24,7 +24,6 @@ export type ActionOrActionWithState<T, A> = ActionOrActionWithStates<[T], A>;
24
24
  export type ActionStatesStream<T extends Array<unknown>, A> = Observable<ActionOrActionWithStates<T, A>>;
25
25
  export type ActionStateStream<T, A> = Observable<ActionOrActionWithStates<[T], A>>;
26
26
  /**
27
- *
28
27
  * @whatItDoes Handles pessimistic updates (updating the server first).
29
28
  *
30
29
  * Updating the server, when implemented naively, suffers from race conditions and poor error handling.
@@ -79,10 +78,11 @@ export type ActionStateStream<T, A> = Observable<ActionOrActionWithStates<[T], A
79
78
  * ```
80
79
  *
81
80
  * @param opts
81
+ *
82
+ * @deprecated This will be removed in Nx v21. Import `pessimisticUpdate` from `@ngrx/router-store/data-persistence` instead.
82
83
  */
83
84
  export declare function pessimisticUpdate<T extends Array<unknown>, A extends Action>(opts: PessimisticUpdateOpts<T, A>): (source: ActionStatesStream<T, A>) => Observable<Action>;
84
85
  /**
85
- *
86
86
  * @whatItDoes Handles optimistic updates (updating the client first).
87
87
  *
88
88
  * It runs all fetches in order, which removes race conditions and forces the developer to handle errors.
@@ -138,10 +138,11 @@ export declare function pessimisticUpdate<T extends Array<unknown>, A extends Ac
138
138
  * ```
139
139
  *
140
140
  * @param opts
141
+ *
142
+ * @deprecated This will be removed in Nx v21. Import `optimisticUpdate` from `@ngrx/router-store/data-persistence` instead.
141
143
  */
142
144
  export declare function optimisticUpdate<T extends Array<unknown>, A extends Action>(opts: OptimisticUpdateOpts<T, A>): (source: ActionStatesStream<T, A>) => Observable<Action>;
143
145
  /**
144
- *
145
146
  * @whatItDoes Handles data fetching.
146
147
  *
147
148
  * Data fetching implemented naively suffers from race conditions and poor error handling.
@@ -217,6 +218,8 @@ export declare function optimisticUpdate<T extends Array<unknown>, A extends Act
217
218
  * In addition, if there are multiple requests for Todo 1 scheduled, it will only run the last one.
218
219
  *
219
220
  * @param opts
221
+ *
222
+ * @deprecated This will be removed in Nx v21. Import `fetch` from `@ngrx/router-store/data-persistence` instead.
220
223
  */
221
224
  export declare function fetch<T extends Array<unknown>, A extends Action>(opts: FetchOpts<T, A>): (source: ActionStatesStream<T, A>) => Observable<Action>;
222
225
  /**
@@ -267,5 +270,7 @@ export declare function fetch<T extends Array<unknown>, A extends Action>(opts:
267
270
  *
268
271
  * @param component
269
272
  * @param opts
273
+ *
274
+ * @deprecated This will be removed in Nx v21. Import `navigation` from `@ngrx/router-store/data-persistence` instead.
270
275
  */
271
276
  export declare function navigation<T extends Array<unknown>, A extends Action>(component: Type<any>, opts: HandleNavigationOpts<T>): (source: ActionStatesStream<T, A>) => Observable<Action<string>>;
@@ -1,6 +1,7 @@
1
1
  import type { Observable } from 'rxjs';
2
2
  /**
3
- * @deprecated This will be removed in a later version of Nx. Since RxJS 7, use firstValueFrom(obs$.pipe(toArray())) or lastValueFrom(obs$.pipe(toArray())).
3
+ * @deprecated This will be removed in Nx v21. If using RxJS 7, use `firstValueFrom(obs$.pipe(toArray()))`
4
+ * or `lastValueFrom(obs$.pipe(toArray()))`. If using RxJS 6, use `obs$.pipe(toArray()).toPromise()`.
4
5
  *
5
6
  * @whatItDoes reads all the values from an observable and returns a promise
6
7
  * with an array of all values. This should be used in combination with async/await.
@@ -15,7 +16,8 @@ import type { Observable } from 'rxjs';
15
16
  */
16
17
  export declare function readAll<T>(o: Observable<T>): Promise<T[]>;
17
18
  /**
18
- * @deprecated This will be removed in a later version of Nx. Since RxJS 7, use firstValueFrom(obs$)
19
+ * @deprecated This will be removed in Nx v21. Since RxJS 7, use `firstValueFrom(obs$)`. If using RxJS 6,
20
+ * use `obs$.pipe(first()).toPromise()`.
19
21
  *
20
22
  * @whatItDoes reads the first value from an observable and returns a promise
21
23
  * with it. This should be used in combination with async/await.