@nx/angular 19.1.0-beta.1 → 19.1.0-beta.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/executors.json +1 -1
- package/migrations.json +82 -0
- package/package.json +14 -13
- package/src/builders/dev-server/dev-server.impl.js +1 -1
- package/src/builders/dev-server/schema.json +1 -1
- package/src/builders/module-federation-dev-ssr/module-federation-dev-ssr.impl.js +4 -1
- package/src/builders/utilities/module-federation.d.ts +2 -1
- package/src/builders/utilities/module-federation.js +17 -3
- package/src/builders/webpack-browser/schema.json +4 -3
- package/src/builders/webpack-browser/webpack-browser.impl.js +1 -1
- package/src/builders/webpack-server/schema.json +7 -6
- package/src/builders/webpack-server/webpack-server.impl.js +3 -5
- package/src/executors/application/application.impl.d.ts +2 -1
- package/src/executors/application/application.impl.js +2 -2
- package/src/executors/application/schema.json +4 -3
- package/src/executors/browser-esbuild/browser-esbuild.impl.d.ts +2 -7
- package/src/executors/browser-esbuild/browser-esbuild.impl.js +2 -2
- package/src/executors/browser-esbuild/schema.json +4 -3
- package/src/executors/extract-i18n/extract-i18n.impl.js +2 -2
- package/src/executors/module-federation-dev-server/lib/start-static-remotes-file-server.js +2 -1
- package/src/executors/module-federation-dev-server/module-federation-dev-server.impl.js +8 -4
- package/src/executors/module-federation-dev-server/schema.json +1 -1
- package/src/executors/ng-packagr-lite/ng-packagr-adjustments/ng-packagr.js +6 -6
- package/src/executors/ng-packagr-lite/ng-packagr-adjustments/pre-v17/ng-package/entry-point/compile-ngc.transform.js +3 -2
- package/src/executors/ng-packagr-lite/ng-packagr-adjustments/pre-v17/ng-package/entry-point/write-package.transform.js +2 -1
- package/src/executors/ng-packagr-lite/ng-packagr-adjustments/pre-v17/ng-package/options.di.js +2 -1
- package/src/executors/ng-packagr-lite/ng-packagr-adjustments/pre-v17/ngc/compile-source-files.d.ts +1 -2
- package/src/executors/ng-packagr-lite/ng-packagr-adjustments/pre-v17/ngc/compile-source-files.js +5 -4
- package/src/executors/ng-packagr-lite/ng-packagr-adjustments/pre-v17/styles/stylesheet-processor.js +11 -11
- package/src/executors/ng-packagr-lite/ng-packagr-adjustments/v17+/ng-package/entry-point/write-package.transform.js +2 -1
- package/src/executors/ng-packagr-lite/schema.json +1 -1
- package/src/executors/package/ng-packagr-adjustments/ng-package/entry-point/compile-ngc.transform.js +5 -4
- package/src/executors/package/ng-packagr-adjustments/ng-package/options.di.js +2 -1
- package/src/executors/package/ng-packagr-adjustments/ng-packagr.js +4 -4
- package/src/executors/package/ng-packagr-adjustments/ngc/compile-source-files.d.ts +1 -2
- package/src/executors/package/ng-packagr-adjustments/ngc/compile-source-files.js +5 -4
- package/src/executors/package/ng-packagr-adjustments/styles/stylesheet-processor.js +11 -11
- package/src/executors/utilities/esbuild-extensions.d.ts +2 -4
- package/src/executors/utilities/module-loader.d.ts +1 -2
- package/src/executors/utilities/ng-packagr/stylesheet-processor.js +22 -8
- package/src/executors/utilities/typescript.d.ts +1 -2
- package/src/executors/utilities/typescript.js +4 -3
- package/src/generators/add-linting/lib/create-eslint-configuration.d.ts +2 -2
- package/src/generators/add-linting/schema.json +1 -1
- package/src/generators/application/files/base-pre18/src/favicon.ico +0 -0
- package/src/generators/application/files/ng-module/src/main.ts__tpl__ +3 -1
- package/src/generators/application/files/standalone-components/src/app/app.config.ts__tpl__ +2 -2
- package/src/generators/application/lib/add-linting.js +2 -1
- package/src/generators/application/lib/create-files.js +7 -0
- package/src/generators/application/lib/create-project.js +12 -5
- package/src/generators/component-test/component-test.js +1 -1
- package/src/generators/cypress-component-configuration/cypress-component-configuration.js +3 -3
- package/src/generators/federate-module/lib/add-remote.js +2 -1
- package/src/generators/host/host.js +3 -2
- package/src/generators/library/library.js +4 -3
- package/src/generators/ng-add/migrators/builders/angular-devkit-karma.migrator.js +3 -2
- package/src/generators/ng-add/migrators/migrator.d.ts +1 -1
- package/src/generators/ng-add/migrators/migrator.js +7 -7
- package/src/generators/ng-add/migrators/projects/app.migrator.js +2 -2
- package/src/generators/ng-add/migrators/projects/e2e.migrator.js +1 -1
- package/src/generators/ng-add/utilities/validation-logging.js +2 -1
- package/src/generators/ngrx-root-store/ngrx-root-store.js +2 -1
- package/src/generators/setup-mf/lib/add-remote-to-host.js +13 -4
- package/src/generators/setup-mf/lib/fix-bootstrap.d.ts +1 -1
- package/src/generators/setup-mf/lib/fix-bootstrap.js +12 -5
- package/src/generators/setup-mf/lib/setup-host-if-dynamic.js +5 -1
- package/src/generators/setup-mf/setup-mf.js +1 -1
- package/src/generators/setup-ssr/files/server/application-builder/__serverFileName__ +4 -3
- package/src/generators/setup-ssr/files/server/server-builder/v17+/__serverFileName__ +4 -3
- package/src/generators/setup-ssr/lib/add-dependencies.js +2 -1
- package/src/generators/setup-ssr/lib/generate-files.js +1 -7
- package/src/generators/setup-ssr/lib/index.d.ts +0 -1
- package/src/generators/setup-ssr/lib/index.js +0 -1
- package/src/generators/setup-ssr/lib/validate-options.js +0 -13
- package/src/generators/setup-ssr/schema.json +4 -3
- package/src/generators/setup-ssr/setup-ssr.js +0 -3
- package/src/generators/stories/stories.js +3 -2
- package/src/generators/storybook-configuration/lib/generate-stories.js +1 -1
- package/src/generators/utils/storybook-ast/tree-utilities.js +2 -1
- package/src/generators/utils/version-utils.js +4 -3
- package/src/migrations/update-15-2-0/remove-browserlist-config.js +1 -1
- package/src/migrations/update-15-2-0/remove-platform-server-exports.js +2 -1
- package/src/migrations/update-15-2-0/update-karma-main-file.js +2 -1
- package/src/migrations/update-16-1-0/remove-render-module-platform-server-exports.js +2 -1
- package/src/migrations/update-19-1-0/update-angular-cli.d.ts +3 -0
- package/src/migrations/update-19-1-0/update-angular-cli.js +23 -0
- package/src/utils/backward-compatible-versions.d.ts +10 -5
- package/src/utils/backward-compatible-versions.js +18 -19
- package/src/utils/file-change-recorder.js +2 -1
- package/src/utils/mf/with-module-federation.js +3 -2
- package/src/utils/version-utils.d.ts +2 -2
- package/src/utils/version-utils.js +2 -1
- package/src/utils/versions.d.ts +4 -4
- package/src/utils/versions.js +4 -4
- package/index.js +0 -8
- package/mf/index.js +0 -7
- package/mf/mf.js +0 -53
- package/src/builders/webpack-server/validate-options.d.ts +0 -2
- package/src/builders/webpack-server/validate-options.js +0 -33
- package/src/executors/utilities/ng-compiler-cli.d.ts +0 -1
- package/src/executors/utilities/ng-compiler-cli.js +0 -8
- package/src/generators/setup-ssr/files/ngmodule/pre-v15-2/src/main.ts__tpl__ +0 -14
- package/src/generators/setup-ssr/lib/update-app-module.d.ts +0 -3
- package/src/generators/setup-ssr/lib/update-app-module.js +0 -27
- package/src/runtime/nx/data-persistence.js +0 -350
- package/testing/index.js +0 -6
- package/testing/src/testing-utils.js +0 -40
- /package/src/generators/application/files/{base/src → base-18+/public}/favicon.ico +0 -0
- /package/src/generators/application/files/{base → base-pre18}/src/assets/.gitkeep__tpl__ +0 -0
- /package/src/generators/setup-ssr/files/ngmodule/{base/src → src}/__main__ +0 -0
- /package/src/generators/setup-ssr/files/ngmodule/{base/src → src}/app/__rootModuleFileName__ +0 -0
|
@@ -1,350 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.navigation = exports.fetch = exports.optimisticUpdate = exports.pessimisticUpdate = void 0;
|
|
4
|
-
const router_store_1 = require("@ngrx/router-store");
|
|
5
|
-
const rxjs_1 = require("rxjs");
|
|
6
|
-
const operators_1 = require("rxjs/operators");
|
|
7
|
-
/**
|
|
8
|
-
*
|
|
9
|
-
* @whatItDoes Handles pessimistic updates (updating the server first).
|
|
10
|
-
*
|
|
11
|
-
* Updating the server, when implemented naively, suffers from race conditions and poor error handling.
|
|
12
|
-
*
|
|
13
|
-
* `pessimisticUpdate` addresses these problems. It runs all fetches in order, which removes race conditions
|
|
14
|
-
* and forces the developer to handle errors.
|
|
15
|
-
*
|
|
16
|
-
* ## Example:
|
|
17
|
-
*
|
|
18
|
-
* ```typescript
|
|
19
|
-
* @Injectable()
|
|
20
|
-
* class TodoEffects {
|
|
21
|
-
* updateTodo$ = createEffect(() =>
|
|
22
|
-
* this.actions$.pipe(
|
|
23
|
-
* ofType('UPDATE_TODO'),
|
|
24
|
-
* pessimisticUpdate({
|
|
25
|
-
* // provides an action
|
|
26
|
-
* run: (action: UpdateTodo) => {
|
|
27
|
-
* // update the backend first, and then dispatch an action that will
|
|
28
|
-
* // update the client side
|
|
29
|
-
* return this.backend.updateTodo(action.todo.id, action.todo).pipe(
|
|
30
|
-
* map((updated) => ({
|
|
31
|
-
* type: 'UPDATE_TODO_SUCCESS',
|
|
32
|
-
* todo: updated,
|
|
33
|
-
* }))
|
|
34
|
-
* );
|
|
35
|
-
* },
|
|
36
|
-
* onError: (action: UpdateTodo, error: any) => {
|
|
37
|
-
* // we don't need to undo the changes on the client side.
|
|
38
|
-
* // we can dispatch an error, or simply log the error here and return `null`
|
|
39
|
-
* return null;
|
|
40
|
-
* },
|
|
41
|
-
* })
|
|
42
|
-
* )
|
|
43
|
-
* );
|
|
44
|
-
*
|
|
45
|
-
* constructor(private actions$: Actions, private backend: Backend) {}
|
|
46
|
-
* }
|
|
47
|
-
* ```
|
|
48
|
-
*
|
|
49
|
-
* Note that if you don't return a new action from the run callback, you must set the dispatch property
|
|
50
|
-
* of the effect to false, like this:
|
|
51
|
-
*
|
|
52
|
-
* ```typescript
|
|
53
|
-
* class TodoEffects {
|
|
54
|
-
* updateTodo$ = createEffect(() =>
|
|
55
|
-
* this.actions$.pipe(
|
|
56
|
-
* //...
|
|
57
|
-
* ), { dispatch: false }
|
|
58
|
-
* );
|
|
59
|
-
* }
|
|
60
|
-
* ```
|
|
61
|
-
*
|
|
62
|
-
* @param opts
|
|
63
|
-
*/
|
|
64
|
-
function pessimisticUpdate(opts) {
|
|
65
|
-
return (source) => {
|
|
66
|
-
return source.pipe(mapActionAndState(), (0, operators_1.concatMap)(runWithErrorHandling(opts.run, opts.onError)));
|
|
67
|
-
};
|
|
68
|
-
}
|
|
69
|
-
exports.pessimisticUpdate = pessimisticUpdate;
|
|
70
|
-
/**
|
|
71
|
-
*
|
|
72
|
-
* @whatItDoes Handles optimistic updates (updating the client first).
|
|
73
|
-
*
|
|
74
|
-
* It runs all fetches in order, which removes race conditions and forces the developer to handle errors.
|
|
75
|
-
*
|
|
76
|
-
* When using `optimisticUpdate`, in case of a failure, the developer has already updated the state locally,
|
|
77
|
-
* so the developer must provide an undo action.
|
|
78
|
-
*
|
|
79
|
-
* The error handling must be done in the callback, or by means of the undo action.
|
|
80
|
-
*
|
|
81
|
-
* ## Example:
|
|
82
|
-
*
|
|
83
|
-
* ```typescript
|
|
84
|
-
* @Injectable()
|
|
85
|
-
* class TodoEffects {
|
|
86
|
-
* updateTodo$ = createEffect(() =>
|
|
87
|
-
* this.actions$.pipe(
|
|
88
|
-
* ofType('UPDATE_TODO'),
|
|
89
|
-
* optimisticUpdate({
|
|
90
|
-
* // provides an action
|
|
91
|
-
* run: (action: UpdateTodo) => {
|
|
92
|
-
* return this.backend.updateTodo(action.todo.id, action.todo).pipe(
|
|
93
|
-
* mapTo({
|
|
94
|
-
* type: 'UPDATE_TODO_SUCCESS',
|
|
95
|
-
* })
|
|
96
|
-
* );
|
|
97
|
-
* },
|
|
98
|
-
* undoAction: (action: UpdateTodo, error: any) => {
|
|
99
|
-
* // dispatch an undo action to undo the changes in the client state
|
|
100
|
-
* return {
|
|
101
|
-
* type: 'UNDO_TODO_UPDATE',
|
|
102
|
-
* todo: action.todo,
|
|
103
|
-
* };
|
|
104
|
-
* },
|
|
105
|
-
* })
|
|
106
|
-
* )
|
|
107
|
-
* );
|
|
108
|
-
*
|
|
109
|
-
* constructor(private actions$: Actions, private backend: Backend) {}
|
|
110
|
-
* }
|
|
111
|
-
* ```
|
|
112
|
-
*
|
|
113
|
-
* Note that if you don't return a new action from the run callback, you must set the dispatch property
|
|
114
|
-
* of the effect to false, like this:
|
|
115
|
-
*
|
|
116
|
-
* ```typescript
|
|
117
|
-
* class TodoEffects {
|
|
118
|
-
* updateTodo$ = createEffect(() =>
|
|
119
|
-
* this.actions$.pipe(
|
|
120
|
-
* //...
|
|
121
|
-
* ), { dispatch: false }
|
|
122
|
-
* );
|
|
123
|
-
* }
|
|
124
|
-
* ```
|
|
125
|
-
*
|
|
126
|
-
* @param opts
|
|
127
|
-
*/
|
|
128
|
-
function optimisticUpdate(opts) {
|
|
129
|
-
return (source) => {
|
|
130
|
-
return source.pipe(mapActionAndState(), (0, operators_1.concatMap)(runWithErrorHandling(opts.run, opts.undoAction)));
|
|
131
|
-
};
|
|
132
|
-
}
|
|
133
|
-
exports.optimisticUpdate = optimisticUpdate;
|
|
134
|
-
/**
|
|
135
|
-
*
|
|
136
|
-
* @whatItDoes Handles data fetching.
|
|
137
|
-
*
|
|
138
|
-
* Data fetching implemented naively suffers from race conditions and poor error handling.
|
|
139
|
-
*
|
|
140
|
-
* `fetch` addresses these problems. It runs all fetches in order, which removes race conditions
|
|
141
|
-
* and forces the developer to handle errors.
|
|
142
|
-
*
|
|
143
|
-
* ## Example:
|
|
144
|
-
*
|
|
145
|
-
* ```typescript
|
|
146
|
-
* @Injectable()
|
|
147
|
-
* class TodoEffects {
|
|
148
|
-
* loadTodos$ = createEffect(() =>
|
|
149
|
-
* this.actions$.pipe(
|
|
150
|
-
* ofType('GET_TODOS'),
|
|
151
|
-
* fetch({
|
|
152
|
-
* // provides an action
|
|
153
|
-
* run: (a: GetTodos) => {
|
|
154
|
-
* return this.backend.getAll().pipe(
|
|
155
|
-
* map((response) => ({
|
|
156
|
-
* type: 'TODOS',
|
|
157
|
-
* todos: response.todos,
|
|
158
|
-
* }))
|
|
159
|
-
* );
|
|
160
|
-
* },
|
|
161
|
-
* onError: (action: GetTodos, error: any) => {
|
|
162
|
-
* // dispatch an undo action to undo the changes in the client state
|
|
163
|
-
* return null;
|
|
164
|
-
* },
|
|
165
|
-
* })
|
|
166
|
-
* )
|
|
167
|
-
* );
|
|
168
|
-
*
|
|
169
|
-
* constructor(private actions$: Actions, private backend: Backend) {}
|
|
170
|
-
* }
|
|
171
|
-
* ```
|
|
172
|
-
*
|
|
173
|
-
* This is correct, but because it set the concurrency to 1, it may not be performant.
|
|
174
|
-
*
|
|
175
|
-
* To fix that, you can provide the `id` function, like this:
|
|
176
|
-
*
|
|
177
|
-
* ```typescript
|
|
178
|
-
* @Injectable()
|
|
179
|
-
* class TodoEffects {
|
|
180
|
-
* loadTodo$ = createEffect(() =>
|
|
181
|
-
* this.actions$.pipe(
|
|
182
|
-
* ofType('GET_TODO'),
|
|
183
|
-
* fetch({
|
|
184
|
-
* id: (todo: GetTodo) => {
|
|
185
|
-
* return todo.id;
|
|
186
|
-
* },
|
|
187
|
-
* // provides an action
|
|
188
|
-
* run: (todo: GetTodo) => {
|
|
189
|
-
* return this.backend.getTodo(todo.id).map((response) => ({
|
|
190
|
-
* type: 'LOAD_TODO_SUCCESS',
|
|
191
|
-
* todo: response.todo,
|
|
192
|
-
* }));
|
|
193
|
-
* },
|
|
194
|
-
* onError: (action: GetTodo, error: any) => {
|
|
195
|
-
* // dispatch an undo action to undo the changes in the client state
|
|
196
|
-
* return null;
|
|
197
|
-
* },
|
|
198
|
-
* })
|
|
199
|
-
* )
|
|
200
|
-
* );
|
|
201
|
-
*
|
|
202
|
-
* constructor(private actions$: Actions, private backend: Backend) {}
|
|
203
|
-
* }
|
|
204
|
-
* ```
|
|
205
|
-
*
|
|
206
|
-
* With this setup, the requests for Todo 1 will run concurrently with the requests for Todo 2.
|
|
207
|
-
*
|
|
208
|
-
* In addition, if there are multiple requests for Todo 1 scheduled, it will only run the last one.
|
|
209
|
-
*
|
|
210
|
-
* @param opts
|
|
211
|
-
*/
|
|
212
|
-
function fetch(opts) {
|
|
213
|
-
return (source) => {
|
|
214
|
-
if (opts.id) {
|
|
215
|
-
const groupedFetches = source.pipe(mapActionAndState(), (0, operators_1.groupBy)(([action, ...store]) => {
|
|
216
|
-
return opts.id(action, ...store);
|
|
217
|
-
}));
|
|
218
|
-
return groupedFetches.pipe((0, operators_1.mergeMap)((pairs) => pairs.pipe((0, operators_1.switchMap)(runWithErrorHandling(opts.run, opts.onError)))));
|
|
219
|
-
}
|
|
220
|
-
return source.pipe(mapActionAndState(), (0, operators_1.concatMap)(runWithErrorHandling(opts.run, opts.onError)));
|
|
221
|
-
};
|
|
222
|
-
}
|
|
223
|
-
exports.fetch = fetch;
|
|
224
|
-
/**
|
|
225
|
-
* @whatItDoes Handles data fetching as part of router navigation.
|
|
226
|
-
*
|
|
227
|
-
* Data fetching implemented naively suffers from race conditions and poor error handling.
|
|
228
|
-
*
|
|
229
|
-
* `navigation` addresses these problems.
|
|
230
|
-
*
|
|
231
|
-
* It checks if an activated router state contains the passed in component type, and, if it does, runs the `run`
|
|
232
|
-
* callback. It provides the activated snapshot associated with the component and the current state. And it only runs
|
|
233
|
-
* the last request.
|
|
234
|
-
*
|
|
235
|
-
* ## Example:
|
|
236
|
-
*
|
|
237
|
-
* ```typescript
|
|
238
|
-
* @Injectable()
|
|
239
|
-
* class TodoEffects {
|
|
240
|
-
* loadTodo$ = createEffect(() =>
|
|
241
|
-
* this.actions$.pipe(
|
|
242
|
-
* // listens for the routerNavigation action from @ngrx/router-store
|
|
243
|
-
* navigation(TodoComponent, {
|
|
244
|
-
* run: (activatedRouteSnapshot: ActivatedRouteSnapshot) => {
|
|
245
|
-
* return this.backend
|
|
246
|
-
* .fetchTodo(activatedRouteSnapshot.params['id'])
|
|
247
|
-
* .pipe(
|
|
248
|
-
* map((todo) => ({
|
|
249
|
-
* type: 'LOAD_TODO_SUCCESS',
|
|
250
|
-
* todo: todo,
|
|
251
|
-
* }))
|
|
252
|
-
* );
|
|
253
|
-
* },
|
|
254
|
-
* onError: (
|
|
255
|
-
* activatedRouteSnapshot: ActivatedRouteSnapshot,
|
|
256
|
-
* error: any
|
|
257
|
-
* ) => {
|
|
258
|
-
* // we can log and error here and return null
|
|
259
|
-
* // we can also navigate back
|
|
260
|
-
* return null;
|
|
261
|
-
* },
|
|
262
|
-
* })
|
|
263
|
-
* )
|
|
264
|
-
* );
|
|
265
|
-
*
|
|
266
|
-
* constructor(private actions$: Actions, private backend: Backend) {}
|
|
267
|
-
* }
|
|
268
|
-
* ```
|
|
269
|
-
*
|
|
270
|
-
* @param component
|
|
271
|
-
* @param opts
|
|
272
|
-
*/
|
|
273
|
-
function navigation(component, opts) {
|
|
274
|
-
return (source) => {
|
|
275
|
-
const nav = source.pipe(mapActionAndState(), (0, operators_1.filter)(([action]) => isStateSnapshot(action)), (0, operators_1.map)(([action, ...slices]) => {
|
|
276
|
-
if (!isStateSnapshot(action)) {
|
|
277
|
-
// Because of the above filter we'll never get here,
|
|
278
|
-
// but this properly type narrows `action`
|
|
279
|
-
return;
|
|
280
|
-
}
|
|
281
|
-
return [
|
|
282
|
-
findSnapshot(component, action.payload.routerState.root),
|
|
283
|
-
...slices,
|
|
284
|
-
];
|
|
285
|
-
}), (0, operators_1.filter)(([snapshot]) => !!snapshot));
|
|
286
|
-
return nav.pipe((0, operators_1.switchMap)(runWithErrorHandling(opts.run, opts.onError)));
|
|
287
|
-
};
|
|
288
|
-
}
|
|
289
|
-
exports.navigation = navigation;
|
|
290
|
-
function isStateSnapshot(action) {
|
|
291
|
-
return action.type === router_store_1.ROUTER_NAVIGATION;
|
|
292
|
-
}
|
|
293
|
-
function runWithErrorHandling(run, onError) {
|
|
294
|
-
return ([action, ...slices]) => {
|
|
295
|
-
try {
|
|
296
|
-
const r = wrapIntoObservable(run(action, ...slices));
|
|
297
|
-
return r.pipe((0, operators_1.catchError)((e) => wrapIntoObservable(onError(action, e))));
|
|
298
|
-
}
|
|
299
|
-
catch (e) {
|
|
300
|
-
return wrapIntoObservable(onError(action, e));
|
|
301
|
-
}
|
|
302
|
-
};
|
|
303
|
-
}
|
|
304
|
-
/**
|
|
305
|
-
* @whatItDoes maps Observable<Action | [Action, State]> to
|
|
306
|
-
* Observable<[Action, State]>
|
|
307
|
-
*/
|
|
308
|
-
function mapActionAndState() {
|
|
309
|
-
return (source) => {
|
|
310
|
-
return source.pipe((0, operators_1.map)((value) => normalizeActionAndState(value)));
|
|
311
|
-
};
|
|
312
|
-
}
|
|
313
|
-
/**
|
|
314
|
-
* @whatItDoes Normalizes either a bare action or an array of action and slices
|
|
315
|
-
* into an array of action and slices (or undefined)
|
|
316
|
-
*/
|
|
317
|
-
function normalizeActionAndState(args) {
|
|
318
|
-
let action, slices;
|
|
319
|
-
if (args instanceof Array) {
|
|
320
|
-
[action, ...slices] = args;
|
|
321
|
-
}
|
|
322
|
-
else {
|
|
323
|
-
slices = [];
|
|
324
|
-
action = args;
|
|
325
|
-
}
|
|
326
|
-
return [action, ...slices];
|
|
327
|
-
}
|
|
328
|
-
function findSnapshot(component, s) {
|
|
329
|
-
if (s.routeConfig && s.routeConfig.component === component) {
|
|
330
|
-
return s;
|
|
331
|
-
}
|
|
332
|
-
for (const c of s.children) {
|
|
333
|
-
const ss = findSnapshot(component, c);
|
|
334
|
-
if (ss) {
|
|
335
|
-
return ss;
|
|
336
|
-
}
|
|
337
|
-
}
|
|
338
|
-
return null;
|
|
339
|
-
}
|
|
340
|
-
function wrapIntoObservable(obj) {
|
|
341
|
-
if ((0, rxjs_1.isObservable)(obj)) {
|
|
342
|
-
return obj;
|
|
343
|
-
}
|
|
344
|
-
else if (!obj) {
|
|
345
|
-
return (0, rxjs_1.of)();
|
|
346
|
-
}
|
|
347
|
-
else {
|
|
348
|
-
return (0, rxjs_1.of)(obj);
|
|
349
|
-
}
|
|
350
|
-
}
|
package/testing/index.js
DELETED
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.readFirst = exports.readAll = void 0;
|
|
4
|
-
var testing_utils_1 = require("./src/testing-utils");
|
|
5
|
-
Object.defineProperty(exports, "readAll", { enumerable: true, get: function () { return testing_utils_1.readAll; } });
|
|
6
|
-
Object.defineProperty(exports, "readFirst", { enumerable: true, get: function () { return testing_utils_1.readFirst; } });
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.readFirst = exports.readAll = void 0;
|
|
4
|
-
const operators_1 = require("rxjs/operators");
|
|
5
|
-
/**
|
|
6
|
-
* @deprecated This will be removed in a later version of Nx. Since RxJS 7, use firstValueFrom(obs$.pipe(toArray())) or lastValueFrom(obs$.pipe(toArray())).
|
|
7
|
-
*
|
|
8
|
-
* @whatItDoes reads all the values from an observable and returns a promise
|
|
9
|
-
* with an array of all values. This should be used in combination with async/await.
|
|
10
|
-
*
|
|
11
|
-
* ## Example
|
|
12
|
-
*
|
|
13
|
-
* ```typescript
|
|
14
|
-
* const obs = of(1, 2, 3, 4);
|
|
15
|
-
* const res = await readAll(obs)
|
|
16
|
-
* expect(res).toEqual([1, 2, 3, 4]);
|
|
17
|
-
* ```
|
|
18
|
-
*/
|
|
19
|
-
function readAll(o) {
|
|
20
|
-
return o.pipe((0, operators_1.toArray)()).toPromise();
|
|
21
|
-
}
|
|
22
|
-
exports.readAll = readAll;
|
|
23
|
-
/**
|
|
24
|
-
* @deprecated This will be removed in a later version of Nx. Since RxJS 7, use firstValueFrom(obs$)
|
|
25
|
-
*
|
|
26
|
-
* @whatItDoes reads the first value from an observable and returns a promise
|
|
27
|
-
* with it. This should be used in combination with async/await.
|
|
28
|
-
*
|
|
29
|
-
* ## Example
|
|
30
|
-
*
|
|
31
|
-
* ```typescript
|
|
32
|
-
* const obs = of(1, 2, 3, 4);
|
|
33
|
-
* const res = await readFirst(obs)
|
|
34
|
-
* expect(res).toEqual(1);
|
|
35
|
-
* ```
|
|
36
|
-
*/
|
|
37
|
-
function readFirst(o) {
|
|
38
|
-
return o.pipe((0, operators_1.first)()).toPromise();
|
|
39
|
-
}
|
|
40
|
-
exports.readFirst = readFirst;
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
/package/src/generators/setup-ssr/files/ngmodule/{base/src → src}/app/__rootModuleFileName__
RENAMED
|
File without changes
|