@ngdux/form 4.0.0 → 5.0.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.
@@ -1,14 +1,17 @@
1
1
  import { RequestState } from '@ngdux/data-model-common';
2
2
  export { RequestState } from '@ngdux/data-model-common';
3
- import { createEffect, ofType } from '@ngrx/effects';
4
- import { of } from 'rxjs';
3
+ import { createEffect, ofType, Actions, provideEffects } from '@ngrx/effects';
4
+ import { of, switchMap as switchMap$1, map as map$1, catchError as catchError$1, exhaustMap as exhaustMap$1, tap as tap$1 } from 'rxjs';
5
5
  import { switchMap, map, catchError, exhaustMap, tap } from 'rxjs/operators';
6
6
  import * as i0 from '@angular/core';
7
- import { InjectionToken, Inject, Injectable } from '@angular/core';
7
+ import { InjectionToken, Inject, Injectable, inject } from '@angular/core';
8
8
  import * as i1 from '@ngrx/store';
9
- import { createAction, props, createReducer, on, createSelector, createFeatureSelector, select } from '@ngrx/store';
9
+ import { createAction, props, createReducer, on, createSelector, createFeatureSelector, select, Store, provideState } from '@ngrx/store';
10
10
  import { createRequestStateActionHandlers, createLoadingStateActionHandlers } from '@ngdux/store-common';
11
11
 
12
+ /**
13
+ * @deprecated This class is deprecated and will be removed in a future release. Please use `createFormEffects` instead.
14
+ */
12
15
  class AbstractFormEffects {
13
16
  constructor(actions$, store, service, formActions, notificationService) {
14
17
  this.actions$ = actions$;
@@ -116,6 +119,9 @@ function createFormSelectors(getFormState) {
116
119
  };
117
120
  }
118
121
 
122
+ /**
123
+ * @deprecated This class is deprecated and will be removed in a future release.
124
+ */
119
125
  class AbstractFormReducerManager {
120
126
  constructor(reducerManager, featureKey) {
121
127
  this.reducerManager = reducerManager;
@@ -137,16 +143,19 @@ class AbstractFormReducerManager {
137
143
  const getState = createFeatureSelector(this.featureKey);
138
144
  return createFormSelectors(getState);
139
145
  }
140
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.15", ngImport: i0, type: AbstractFormReducerManager, deps: [{ token: i1.ReducerManager }, { token: FORM_FEATURE_KEY }], target: i0.ɵɵFactoryTarget.Injectable }); }
141
- static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.3.15", ngImport: i0, type: AbstractFormReducerManager }); }
146
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.1.4", ngImport: i0, type: AbstractFormReducerManager, deps: [{ token: i1.ReducerManager }, { token: FORM_FEATURE_KEY }], target: i0.ɵɵFactoryTarget.Injectable }); }
147
+ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "21.1.4", ngImport: i0, type: AbstractFormReducerManager }); }
142
148
  }
143
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.15", ngImport: i0, type: AbstractFormReducerManager, decorators: [{
149
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.4", ngImport: i0, type: AbstractFormReducerManager, decorators: [{
144
150
  type: Injectable
145
151
  }], ctorParameters: () => [{ type: i1.ReducerManager }, { type: undefined, decorators: [{
146
152
  type: Inject,
147
153
  args: [FORM_FEATURE_KEY]
148
154
  }] }] });
149
155
 
156
+ /**
157
+ * @deprecated This class is deprecated and will be removed in a future release. Please use `provideFormFacade` or `createFormFacade` instead.
158
+ */
150
159
  class AbstractFormFacade {
151
160
  constructor(store, formActions, formSelectors) {
152
161
  this.store = store;
@@ -175,6 +184,95 @@ class AbstractFormFacade {
175
184
  }
176
185
  }
177
186
 
187
+ function createFormEffects(formActions, formService, notificationService) {
188
+ return {
189
+ load$: createEffect((actions$ = inject(Actions), service = formService()) => loadResourceEffect(actions$, formActions, service), {
190
+ functional: true
191
+ }),
192
+ create$: createEffect((actions$ = inject(Actions), service = formService()) => createResourceEffect(actions$, formActions, service), {
193
+ functional: true
194
+ }),
195
+ update$: createEffect((actions$ = inject(Actions), service = formService()) => updateResourceEffect(actions$, formActions, service), {
196
+ functional: true
197
+ }),
198
+ delete$: createEffect((actions$ = inject(Actions), service = formService()) => deleteResourceEffect(actions$, formActions, service), {
199
+ functional: true
200
+ }),
201
+ errorsHandler$: createEffect((actions$ = inject(Actions), service = notificationService()) => errorsHandlerEffect(actions$, formActions, service), {
202
+ functional: true,
203
+ dispatch: false
204
+ })
205
+ };
206
+ }
207
+ function loadResourceEffect(actions$, formActions, service) {
208
+ return actions$.pipe(ofType(formActions.load), switchMap$1(({ id }) => service.loadResource(id).pipe(map$1(resource => formActions.loadSuccess({ resource })), catchError$1((errors) => of(formActions.loadFailure({ errors }))))));
209
+ }
210
+ function createResourceEffect(actions$, formActions, service) {
211
+ return actions$.pipe(ofType(formActions.create), switchMap$1(action => {
212
+ if (!service.createResource) {
213
+ throw new Error('createResource not implement in the ListService');
214
+ }
215
+ return service.createResource(action.resource).pipe(map$1(resource => formActions.createSuccess({ resource })), catchError$1((errors) => of(formActions.createFailure({ errors }))));
216
+ }));
217
+ }
218
+ function updateResourceEffect(actions$, formActions, service) {
219
+ return actions$.pipe(ofType(formActions.save), switchMap$1(({ resource }) => {
220
+ if (!service.saveResource) {
221
+ throw new Error('saveResource not implement in the ListService');
222
+ }
223
+ return service.saveResource(resource).pipe(map$1(response => formActions.saveSuccess({ resource: response })), catchError$1((errors) => of(formActions.saveFailure({ errors }))));
224
+ }));
225
+ }
226
+ function deleteResourceEffect(actions$, formActions, service) {
227
+ return actions$.pipe(ofType(formActions.delete), exhaustMap$1(action => {
228
+ if (!service.deleteResource) {
229
+ throw new Error('deleteResource not implement in the ListService');
230
+ }
231
+ return service.deleteResource(action.id).pipe(map$1(() => formActions.deleteSuccess({ id: action.id })), catchError$1((errors) => of(formActions.deleteFailure({ errors }))));
232
+ }));
233
+ }
234
+ function errorsHandlerEffect(actions$, formActions, notificationService) {
235
+ return actions$.pipe(ofType(formActions.saveFailure, formActions.loadFailure, formActions.deleteFailure, formActions.createFailure), tap$1(({ errors }) => {
236
+ notificationService.onFormErrors(errors);
237
+ }));
238
+ }
239
+
240
+ function provideFormFacade(token, formActions, formSelectors) {
241
+ return {
242
+ provide: token,
243
+ useFactory: () => createFormFacade(formActions, formSelectors, inject(Store))
244
+ };
245
+ }
246
+ function createFormFacade(formActions, formSelectors, store) {
247
+ const resource$ = store.pipe(select(formSelectors.getResource));
248
+ const loadingState$ = store.pipe(select(formSelectors.getLoadingState));
249
+ const requestState$ = store.pipe(select(formSelectors.getRequestState));
250
+ const errors$ = store.pipe(select(formSelectors.getErrors));
251
+ const isReady$ = store.pipe(select(formSelectors.isReady));
252
+ return {
253
+ resource$,
254
+ loadingState$,
255
+ requestState$,
256
+ errors$,
257
+ isReady$,
258
+ create(props) {
259
+ store.dispatch(formActions.create(props));
260
+ },
261
+ load(props) {
262
+ store.dispatch(formActions.load(props));
263
+ },
264
+ save(props) {
265
+ store.dispatch(formActions.save(props));
266
+ },
267
+ delete(props) {
268
+ store.dispatch(formActions.delete(props));
269
+ },
270
+ reset() {
271
+ store.dispatch(formActions.reset());
272
+ }
273
+ };
274
+ }
275
+
178
276
  function createFormState(featureName) {
179
277
  const actions = createFormActions(featureName);
180
278
  const reducer = createFormReducer(actions);
@@ -186,10 +284,22 @@ function createFormState(featureName) {
186
284
  selectors
187
285
  };
188
286
  }
287
+ function provideFormState(featureKey, facadeToken, service, notificationService) {
288
+ const { actions, selectors, reducer } = createFormState(featureKey);
289
+ return [
290
+ provideState(featureKey, reducer),
291
+ provideFormFacade(facadeToken, actions, selectors),
292
+ provideEffects([
293
+ createFormEffects(actions, () => inject(service), () => inject(notificationService))
294
+ ]),
295
+ service,
296
+ notificationService
297
+ ];
298
+ }
189
299
 
190
300
  /**
191
301
  * Generated bundle index. Do not edit.
192
302
  */
193
303
 
194
- export { AbstractFormEffects, AbstractFormFacade, AbstractFormReducerManager, FORM_FEATURE_KEY, createFormActions, createFormReducer, createFormSelectors, createFormState };
304
+ export { AbstractFormEffects, AbstractFormFacade, AbstractFormReducerManager, FORM_FEATURE_KEY, createFormActions, createFormReducer, createFormSelectors, createFormState, provideFormState };
195
305
  //# sourceMappingURL=ngdux-form.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"ngdux-form.mjs","sources":["../../../../../../../libs/ngdux/util/store/form/src/lib/+state/abstract-form-effects.ts","../../../../../../../libs/ngdux/util/store/form/src/lib/models/form.model.ts","../../../../../../../libs/ngdux/util/store/form/src/lib/+state/form-actions.ts","../../../../../../../libs/ngdux/util/store/form/src/lib/+state/form-reducer.ts","../../../../../../../libs/ngdux/util/store/form/src/lib/+state/form-selectors.ts","../../../../../../../libs/ngdux/util/store/form/src/lib/+state/abstract-form-state.service.ts","../../../../../../../libs/ngdux/util/store/form/src/lib/+state/abstract-form.facade.ts","../../../../../../../libs/ngdux/util/store/form/src/lib/+state/form-state.ts","../../../../../../../libs/ngdux/util/store/form/src/ngdux-form.ts"],"sourcesContent":["import { FormNotificationService, FormService } from '@ngdux/data-model-common';\r\nimport { Actions, createEffect, ofType } from '@ngrx/effects';\r\nimport { Store } from '@ngrx/store';\r\nimport { of } from 'rxjs';\r\nimport { catchError, exhaustMap, map, switchMap, tap } from 'rxjs/operators';\r\nimport { FormActions } from '../models/form.model';\r\n\r\nexport abstract class AbstractFormEffects<DTO, ERROR, CREATE_DTO = DTO> {\r\n load$ = createEffect(() =>\r\n this.actions$.pipe(\r\n ofType(this.formActions.load),\r\n switchMap(({ id }) =>\r\n this.service.loadResource(id).pipe(\r\n map(resource => this.formActions.loadSuccess({ resource })),\r\n catchError((errors: ERROR) => of(this.formActions.loadFailure({ errors })))\r\n )\r\n )\r\n )\r\n );\r\n\r\n create$ = createEffect(() =>\r\n this.actions$.pipe(\r\n ofType(this.formActions.create),\r\n switchMap(action => {\r\n if (!this.service.createResource) {\r\n throw new Error('createResource not implement in the ListService');\r\n }\r\n\r\n return this.service.createResource(action.resource).pipe(\r\n map(resource => this.formActions.createSuccess({ resource })),\r\n catchError((errors: ERROR) => of(this.formActions.createFailure({ errors })))\r\n );\r\n })\r\n )\r\n );\r\n\r\n update$ = createEffect(() =>\r\n this.actions$.pipe(\r\n ofType(this.formActions.save),\r\n switchMap(({ resource }) => {\r\n if (!this.service.saveResource) {\r\n throw new Error('saveResource not implement in the ListService');\r\n }\r\n\r\n return this.service.saveResource(resource).pipe(\r\n map(response => this.formActions.saveSuccess({ resource: response })),\r\n catchError((errors: ERROR) => of(this.formActions.saveFailure({ errors })))\r\n );\r\n })\r\n )\r\n );\r\n\r\n delete$ = createEffect(() =>\r\n this.actions$.pipe(\r\n ofType(this.formActions.delete),\r\n exhaustMap(action => {\r\n if (!this.service.deleteResource) {\r\n throw new Error('deleteResource not implement in the ListService');\r\n }\r\n\r\n return this.service.deleteResource(action.id).pipe(\r\n map(() => this.formActions.deleteSuccess({ id: action.id })),\r\n catchError((errors: ERROR) => of(this.formActions.deleteFailure({ errors })))\r\n );\r\n })\r\n )\r\n );\r\n\r\n errorsHandler$ = createEffect(\r\n () =>\r\n this.actions$.pipe(\r\n ofType(\r\n this.formActions.saveFailure,\r\n this.formActions.loadFailure,\r\n this.formActions.deleteFailure,\r\n this.formActions.createFailure\r\n ),\r\n tap(({ errors }) => {\r\n this.notificationService.onFormErrors(errors);\r\n })\r\n ),\r\n { dispatch: false }\r\n );\r\n\r\n protected constructor(\r\n protected readonly actions$: Actions,\r\n protected readonly store: Store,\r\n private readonly service: FormService<DTO, CREATE_DTO>,\r\n private readonly formActions: FormActions<DTO, ERROR, CREATE_DTO>,\r\n private readonly notificationService: FormNotificationService<ERROR>\r\n ) {}\r\n}\r\n","import { InjectionToken } from '@angular/core';\r\nimport { RequestState } from '@ngdux/data-model-common';\r\nimport { ApiRequestState, LoadingState } from '@ngdux/store-common';\r\nimport { Action, ActionCreator, MemoizedSelector } from '@ngrx/store';\r\n\r\nexport const FORM_FEATURE_KEY = new InjectionToken<string>('FORM_FEATURE_KEY');\r\n\r\nexport interface FormState<T, E> extends ApiRequestState<E>, LoadingState {\r\n resource?: T;\r\n}\r\n\r\nexport interface FormSelectors<T, E> {\r\n getRequestState: MemoizedSelector<object, RequestState>;\r\n getLoadingState: MemoizedSelector<object, RequestState>;\r\n getErrors: MemoizedSelector<object, E | undefined>;\r\n getResource: MemoizedSelector<object, T | undefined>;\r\n isReady: MemoizedSelector<object, boolean>;\r\n}\r\n\r\nexport interface FormActions<DTO, ERROR, CREATE_DTO = DTO> {\r\n load: ActionCreator<string, (props: { id: string }) => { id: string } & Action<string>>;\r\n loadSuccess: ActionCreator<string, (props: { resource: DTO }) => { resource: DTO } & Action<string>>;\r\n loadFailure: ActionCreator<string, (props: { errors: ERROR }) => { errors: ERROR } & Action<string>>;\r\n\r\n save: ActionCreator<string, (props: { resource: DTO }) => { resource: DTO } & Action<string>>;\r\n saveSuccess: ActionCreator<string, (props: { resource: DTO }) => { resource: DTO } & Action<string>>;\r\n saveFailure: ActionCreator<string, (props: { errors: ERROR }) => { errors: ERROR } & Action<string>>;\r\n\r\n delete: ActionCreator<string, (props: { id: string }) => { id: string } & Action<string>>;\r\n deleteSuccess: ActionCreator<string, (props: { id: string }) => { id: string } & Action<string>>;\r\n deleteFailure: ActionCreator<string, (props: { errors: ERROR }) => { errors: ERROR } & Action<string>>;\r\n\r\n create: ActionCreator<string, (props: { resource: CREATE_DTO }) => { resource: CREATE_DTO } & Action<string>>;\r\n createSuccess: ActionCreator<string, (props: { resource: DTO }) => { resource: DTO } & Action<string>>;\r\n createFailure: ActionCreator<string, (props: { errors: ERROR }) => { errors: ERROR } & Action<string>>;\r\n\r\n reset: ActionCreator<string, () => Action<string>>;\r\n}\r\n","import { createAction, props } from '@ngrx/store';\r\nimport { FormActions } from '../models/form.model';\r\n\r\nexport function createFormActions<DTO, ERROR, CREATE_DTO = DTO>(\r\n featureName: string\r\n): FormActions<DTO, ERROR, CREATE_DTO> {\r\n const load = createAction(`[${featureName} API] Load ${featureName}`, props<{ id: string }>());\r\n const loadSuccess = createAction(`[${featureName} API] Load ${featureName} Success`, props<{ resource: DTO }>());\r\n const loadFailure = createAction(`[${featureName} API] Load ${featureName} Failure`, props<{ errors: ERROR }>());\r\n\r\n const save = createAction(`[${featureName} API] Save ${featureName}`, props<{ resource: DTO }>());\r\n const saveSuccess = createAction(`[${featureName} API] Save ${featureName} Success`, props<{ resource: DTO }>());\r\n const saveFailure = createAction(`[${featureName} API] Save ${featureName} Failure`, props<{ errors: ERROR }>());\r\n\r\n const deleteAction = createAction(`[${featureName} API] Delete ${featureName}`, props<{ id: string }>());\r\n const deleteSuccess = createAction(`[${featureName} API] Delete ${featureName} Success`, props<{ id: string }>());\r\n const deleteFailure = createAction(`[${featureName} API] Delete ${featureName} Failure`, props<{ errors: ERROR }>());\r\n\r\n const create = createAction(`[${featureName} API] Create ${featureName}`, props<{ resource: CREATE_DTO }>());\r\n const createSuccess = createAction(`[${featureName} API] Create ${featureName} Success`, props<{ resource: DTO }>());\r\n const createFailure = createAction(`[${featureName} API] Create ${featureName} Failure`, props<{ errors: ERROR }>());\r\n\r\n const reset = createAction(`[${featureName} API] Reset ${featureName}`);\r\n\r\n return {\r\n load,\r\n loadSuccess,\r\n loadFailure,\r\n save,\r\n saveSuccess,\r\n saveFailure,\r\n delete: deleteAction,\r\n deleteSuccess,\r\n deleteFailure,\r\n create,\r\n createSuccess,\r\n createFailure,\r\n reset\r\n };\r\n}\r\n","import { RequestState } from '@ngdux/data-model-common';\r\nimport { createLoadingStateActionHandlers, createRequestStateActionHandlers } from '@ngdux/store-common';\r\nimport { ActionCreator, ActionReducer, Creator, ReducerTypes, createReducer, on } from '@ngrx/store';\r\nimport { FormActions, FormState } from '../models/form.model';\r\n\r\nexport function createFormReducer<DTO, ERROR, CREATE_DTO = DTO>(\r\n actions: FormActions<DTO, ERROR, CREATE_DTO>,\r\n actionHandlers?: ReducerTypes<FormState<DTO, ERROR>, ActionCreator[]>[],\r\n initialFormState?: Record<string, any>\r\n): ActionReducer<FormState<DTO, ERROR>> {\r\n const initialState: FormState<DTO, ERROR> = { ...createInitialFormState<DTO, ERROR>(), ...initialFormState };\r\n return createReducer<FormState<DTO, ERROR>>(\r\n initialState,\r\n ...createFormActionHandlers<DTO, ERROR, CREATE_DTO>(initialState, actions),\r\n ...(actionHandlers || [])\r\n );\r\n}\r\n\r\nfunction createInitialFormState<DTO, ERROR>(): FormState<DTO, ERROR> {\r\n return {\r\n resource: undefined,\r\n loadingState: RequestState.IDLE,\r\n requestState: RequestState.IDLE,\r\n errors: undefined\r\n };\r\n}\r\n\r\nfunction createFormActionHandlers<DTO, ERROR, CREATE_DTO = DTO>(\r\n initialFormState: FormState<DTO, ERROR>,\r\n actions: FormActions<DTO, ERROR, CREATE_DTO>\r\n): ReducerTypes<FormState<DTO, ERROR>, ActionCreator<string, Creator<any[], object>>[]>[] {\r\n return [\r\n on(actions.reset, (): FormState<DTO, ERROR> => initialFormState),\r\n on(\r\n actions.loadSuccess,\r\n actions.createSuccess,\r\n actions.saveSuccess,\r\n (state: FormState<DTO, ERROR>, { resource }): FormState<DTO, ERROR> => ({ ...state, resource })\r\n ),\r\n on(\r\n actions.deleteSuccess,\r\n (state: FormState<DTO, ERROR>): FormState<DTO, ERROR> => ({\r\n ...state,\r\n resource: undefined\r\n })\r\n ),\r\n ...createRequestStateActionHandlers<FormState<DTO, ERROR>, ERROR>(\r\n actions.load,\r\n actions.save,\r\n actions.saveSuccess,\r\n actions.saveFailure\r\n ),\r\n ...createRequestStateActionHandlers<FormState<DTO, ERROR>, ERROR>(\r\n undefined,\r\n actions.create,\r\n actions.createSuccess,\r\n actions.createFailure\r\n ),\r\n ...createRequestStateActionHandlers<FormState<DTO, ERROR>, ERROR>(\r\n undefined,\r\n actions.delete,\r\n actions.deleteSuccess,\r\n actions.deleteFailure\r\n ),\r\n ...createLoadingStateActionHandlers<FormState<DTO, ERROR>>(actions.load, actions.loadSuccess, actions.loadFailure)\r\n ];\r\n}\r\n","import { RequestState } from '@ngdux/data-model-common';\r\nimport { createSelector, DefaultProjectorFn, MemoizedSelector } from '@ngrx/store';\r\nimport { FormSelectors, FormState } from '../models/form.model';\r\n\r\nexport function createFormSelectors<T, E>(\r\n getFormState: MemoizedSelector<object, FormState<T, E>, DefaultProjectorFn<FormState<T, E>>>\r\n): FormSelectors<T, E> {\r\n const getRequestState = createSelector(getFormState, state => state.requestState);\r\n const getLoadingState = createSelector(getFormState, state => state.loadingState);\r\n const getErrors = createSelector(getFormState, state => state.errors);\r\n const getResource = createSelector(getFormState, state => state.resource);\r\n\r\n const isReady = createSelector(\r\n getResource,\r\n getLoadingState,\r\n (resource, loadingState) => !!resource && loadingState === RequestState.SUCCESS\r\n );\r\n\r\n return {\r\n getRequestState,\r\n getLoadingState,\r\n getErrors,\r\n getResource,\r\n isReady\r\n };\r\n}\r\n","import { Inject, Injectable } from '@angular/core';\r\nimport { ReducerManager, createFeatureSelector } from '@ngrx/store';\r\nimport { FORM_FEATURE_KEY, FormActions, FormSelectors, FormState } from '../models/form.model';\r\nimport { createFormActions } from './form-actions';\r\nimport { createFormReducer } from './form-reducer';\r\nimport { createFormSelectors } from './form-selectors';\r\n\r\n@Injectable()\r\nexport abstract class AbstractFormReducerManager<DTO, ERROR, CREATE_DTO = DTO> {\r\n actions: FormActions<DTO, ERROR, CREATE_DTO>;\r\n selectors: FormSelectors<DTO, ERROR>;\r\n\r\n constructor(\r\n private readonly reducerManager: ReducerManager,\r\n @Inject(FORM_FEATURE_KEY) private readonly featureKey: string\r\n ) {\r\n this.actions = this.getActions();\r\n this.addReducer();\r\n this.selectors = this.getSelectors();\r\n }\r\n\r\n protected getActions() {\r\n return createFormActions<DTO, ERROR, CREATE_DTO>(this.featureKey);\r\n }\r\n\r\n protected addReducer() {\r\n if (!this.reducerManager.currentReducers[this.featureKey]) {\r\n const reducer = createFormReducer(this.actions);\r\n this.reducerManager.addReducer(this.featureKey, reducer);\r\n }\r\n }\r\n\r\n protected getSelectors() {\r\n const getState = createFeatureSelector<FormState<DTO, ERROR>>(this.featureKey);\r\n return createFormSelectors(getState);\r\n }\r\n}\r\n","import { ActionPayload } from '@ngdux/store-common';\r\nimport { select, Store } from '@ngrx/store';\r\nimport { FormActions, FormSelectors } from '../models/form.model';\r\n\r\nexport abstract class AbstractFormFacade<DTO, E, CREATE_DTO = DTO> {\r\n readonly resource$ = this.store.pipe(select(this.formSelectors.getResource));\r\n readonly loadingState$ = this.store.pipe(select(this.formSelectors.getLoadingState));\r\n readonly requestState$ = this.store.pipe(select(this.formSelectors.getRequestState));\r\n readonly errors$ = this.store.pipe(select(this.formSelectors.getErrors));\r\n readonly isReady$ = this.store.pipe(select(this.formSelectors.isReady));\r\n\r\n constructor(\r\n protected readonly store: Store,\r\n private readonly formActions: FormActions<DTO, E, CREATE_DTO>,\r\n private readonly formSelectors: FormSelectors<DTO, E>\r\n ) {}\r\n\r\n create(props: ActionPayload<FormActions<DTO, E, CREATE_DTO>['create']>): void {\r\n this.store.dispatch(this.formActions.create(props));\r\n }\r\n\r\n load(props: ActionPayload<FormActions<DTO, E, CREATE_DTO>['load']>): void {\r\n this.store.dispatch(this.formActions.load(props));\r\n }\r\n\r\n save(props: ActionPayload<FormActions<DTO, E, CREATE_DTO>['save']>): void {\r\n this.store.dispatch(this.formActions.save(props));\r\n }\r\n\r\n delete(props: ActionPayload<FormActions<DTO, E, CREATE_DTO>['delete']>): void {\r\n this.store.dispatch(this.formActions.delete(props));\r\n }\r\n\r\n reset(): void {\r\n this.store.dispatch(this.formActions.reset());\r\n }\r\n}\r\n","import { Action, createFeatureSelector } from '@ngrx/store';\r\nimport { FormState } from '../models/form.model';\r\nimport { createFormActions } from './form-actions';\r\nimport { createFormReducer } from './form-reducer';\r\nimport { createFormSelectors } from './form-selectors';\r\n\r\nexport function createFormState<DTO, ERROR, CREATE_DTO = DTO>(featureName: string) {\r\n const actions = createFormActions<DTO, ERROR, CREATE_DTO>(featureName);\r\n const reducer = createFormReducer(actions);\r\n const getState = createFeatureSelector<FormState<DTO, ERROR>>(featureName);\r\n const selectors = createFormSelectors(getState);\r\n\r\n return {\r\n actions,\r\n reducer: (state: FormState<DTO, ERROR>, action: Action): FormState<DTO, ERROR> => reducer(state, action),\r\n selectors\r\n };\r\n}\r\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;;;;;;MAOsB,mBAAmB,CAAA;IA6EvC,WAAA,CACqB,QAAiB,EACjB,KAAY,EACd,OAAqC,EACrC,WAAgD,EAChD,mBAAmD,EAAA;QAJjD,IAAA,CAAA,QAAQ,GAAR,QAAQ;QACR,IAAA,CAAA,KAAK,GAAL,KAAK;QACP,IAAA,CAAA,OAAO,GAAP,OAAO;QACP,IAAA,CAAA,WAAW,GAAX,WAAW;QACX,IAAA,CAAA,mBAAmB,GAAnB,mBAAmB;AAjFtC,QAAA,IAAA,CAAA,KAAK,GAAG,YAAY,CAAC,MACnB,IAAI,CAAC,QAAQ,CAAC,IAAI,CAChB,MAAM,CAAC,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,EAC7B,SAAS,CAAC,CAAC,EAAE,EAAE,EAAE,KACf,IAAI,CAAC,OAAO,CAAC,YAAY,CAAC,EAAE,CAAC,CAAC,IAAI,CAChC,GAAG,CAAC,QAAQ,IAAI,IAAI,CAAC,WAAW,CAAC,WAAW,CAAC,EAAE,QAAQ,EAAE,CAAC,CAAC,EAC3D,UAAU,CAAC,CAAC,MAAa,KAAK,EAAE,CAAC,IAAI,CAAC,WAAW,CAAC,WAAW,CAAC,EAAE,MAAM,EAAE,CAAC,CAAC,CAAC,CAC5E,CACF,CACF,CACF;QAED,IAAA,CAAA,OAAO,GAAG,YAAY,CAAC,MACrB,IAAI,CAAC,QAAQ,CAAC,IAAI,CAChB,MAAM,CAAC,IAAI,CAAC,WAAW,CAAC,MAAM,CAAC,EAC/B,SAAS,CAAC,MAAM,IAAG;AACjB,YAAA,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,cAAc,EAAE;AAChC,gBAAA,MAAM,IAAI,KAAK,CAAC,iDAAiD,CAAC;YACpE;YAEA,OAAO,IAAI,CAAC,OAAO,CAAC,cAA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Q,CAAC,IAAI,CAAC,WAAW,CAAC,KAAK,EAAE,CAAC;IAC/C;AACD;;AC9BK,SAAU,eAAe,CAA+B,WAAmB,EAAA;AAC/E,IAAA,MAAM,OAAO,GAAG,iBAAiB,CAAyB,WAAW,CAAC;AACtE,IAAA,MAAM,OAAO,GAAG,iBAAiB,CAAC,OAAO,CAAC;AAC1C,IAAA,MAAM,QAAQ,GAAG,qBAAqB,CAAwB,WAAW,CAAC;AAC1E,IAAA,MAAM,SAAS,GAAG,mBAAmB,CAAC,QAAQ,CAAC;IAE/C,OAAO;QACL,OAAO;AACP,QAAA,OAAO,EAAE,CAAC,KAA4B,EAAE,MAAc,KAA4B,OAAO,CAAC,KAAK,EAAE,MAAM,CAAC;QACxG;KACD;AACH;;ACjBA;;AAEG;;;;"}
1
+ {"version":3,"file":"ngdux-form.mjs","sources":["../../../../../../../libs/ngdux/util/store/form/src/lib/+state/abstract-form-effects.ts","../../../../../../../libs/ngdux/util/store/form/src/lib/models/form.model.ts","../../../../../../../libs/ngdux/util/store/form/src/lib/+state/form-actions.ts","../../../../../../../libs/ngdux/util/store/form/src/lib/+state/form-reducer.ts","../../../../../../../libs/ngdux/util/store/form/src/lib/+state/form-selectors.ts","../../../../../../../libs/ngdux/util/store/form/src/lib/+state/abstract-form-state.service.ts","../../../../../../../libs/ngdux/util/store/form/src/lib/+state/abstract-form.facade.ts","../../../../../../../libs/ngdux/util/store/form/src/lib/+state/form-effects.ts","../../../../../../../libs/ngdux/util/store/form/src/lib/+state/form-facade.ts","../../../../../../../libs/ngdux/util/store/form/src/lib/+state/form-state.ts","../../../../../../../libs/ngdux/util/store/form/src/ngdux-form.ts"],"sourcesContent":["import { FormNotificationService, FormService } from '@ngdux/data-model-common';\r\nimport { Actions, createEffect, ofType } from '@ngrx/effects';\r\nimport { Store } from '@ngrx/store';\r\nimport { of } from 'rxjs';\r\nimport { catchError, exhaustMap, map, switchMap, tap } from 'rxjs/operators';\r\nimport { FormActions } from '../models/form.model';\r\n\r\n/**\r\n * @deprecated This class is deprecated and will be removed in a future release. Please use `createFormEffects` instead.\r\n */\r\nexport abstract class AbstractFormEffects<DTO, ERROR, CREATE_DTO = DTO> {\r\n load$ = createEffect(() =>\r\n this.actions$.pipe(\r\n ofType(this.formActions.load),\r\n switchMap(({ id }) =>\r\n this.service.loadResource(id).pipe(\r\n map(resource => this.formActions.loadSuccess({ resource })),\r\n catchError((errors: ERROR) => of(this.formActions.loadFailure({ errors })))\r\n )\r\n )\r\n )\r\n );\r\n\r\n create$ = createEffect(() =>\r\n this.actions$.pipe(\r\n ofType(this.formActions.create),\r\n switchMap(action => {\r\n if (!this.service.createResource) {\r\n throw new Error('createResource not implement in the ListService');\r\n }\r\n\r\n return this.service.createResource(action.resource).pipe(\r\n map(resource => this.formActions.createSuccess({ resource })),\r\n catchError((errors: ERROR) => of(this.formActions.createFailure({ errors })))\r\n );\r\n })\r\n )\r\n );\r\n\r\n update$ = createEffect(() =>\r\n this.actions$.pipe(\r\n ofType(this.formActions.save),\r\n switchMap(({ resource }) => {\r\n if (!this.service.saveResource) {\r\n throw new Error('saveResource not implement in the ListService');\r\n }\r\n\r\n return this.service.saveResource(resource).pipe(\r\n map(response => this.formActions.saveSuccess({ resource: response })),\r\n catchError((errors: ERROR) => of(this.formActions.saveFailure({ errors })))\r\n );\r\n })\r\n )\r\n );\r\n\r\n delete$ = createEffect(() =>\r\n this.actions$.pipe(\r\n ofType(this.formActions.delete),\r\n exhaustMap(action => {\r\n if (!this.service.deleteResource) {\r\n throw new Error('deleteResource not implement in the ListService');\r\n }\r\n\r\n return this.service.deleteResource(action.id).pipe(\r\n map(() => this.formActions.deleteSuccess({ id: action.id })),\r\n catchError((errors: ERROR) => of(this.formActions.deleteFailure({ errors })))\r\n );\r\n })\r\n )\r\n );\r\n\r\n errorsHandler$ = createEffect(\r\n () =>\r\n this.actions$.pipe(\r\n ofType(\r\n this.formActions.saveFailure,\r\n this.formActions.loadFailure,\r\n this.formActions.deleteFailure,\r\n this.formActions.createFailure\r\n ),\r\n tap(({ errors }) => {\r\n this.notificationService.onFormErrors(errors);\r\n })\r\n ),\r\n { dispatch: false }\r\n );\r\n\r\n protected constructor(\r\n protected readonly actions$: Actions,\r\n protected readonly store: Store,\r\n private readonly service: FormService<DTO, CREATE_DTO>,\r\n private readonly formActions: FormActions<DTO, ERROR, CREATE_DTO>,\r\n private readonly notificationService: FormNotificationService<ERROR>\r\n ) {}\r\n}\r\n","import { InjectionToken } from '@angular/core';\r\nimport { RequestState } from '@ngdux/data-model-common';\r\nimport { ActionPayload, ApiRequestState, LoadingState } from '@ngdux/store-common';\r\nimport { Action, ActionCreator, MemoizedSelector } from '@ngrx/store';\r\nimport { Observable } from 'rxjs';\r\n\r\nexport const FORM_FEATURE_KEY = new InjectionToken<string>('FORM_FEATURE_KEY');\r\n\r\nexport interface FormState<T, E> extends ApiRequestState<E>, LoadingState {\r\n resource?: T;\r\n}\r\n\r\nexport interface FormSelectors<T, E> {\r\n getRequestState: MemoizedSelector<object, RequestState>;\r\n getLoadingState: MemoizedSelector<object, RequestState>;\r\n getErrors: MemoizedSelector<object, E | undefined>;\r\n getResource: MemoizedSelector<object, T | undefined>;\r\n isReady: MemoizedSelector<object, boolean>;\r\n}\r\n\r\nexport interface FormActions<DTO, ERROR, CREATE_DTO = DTO> {\r\n load: ActionCreator<string, (props: { id: string }) => { id: string } & Action<string>>;\r\n loadSuccess: ActionCreator<string, (props: { resource: DTO }) => { resource: DTO } & Action<string>>;\r\n loadFailure: ActionCreator<string, (props: { errors: ERROR }) => { errors: ERROR } & Action<string>>;\r\n\r\n save: ActionCreator<string, (props: { resource: DTO }) => { resource: DTO } & Action<string>>;\r\n saveSuccess: ActionCreator<string, (props: { resource: DTO }) => { resource: DTO } & Action<string>>;\r\n saveFailure: ActionCreator<string, (props: { errors: ERROR }) => { errors: ERROR } & Action<string>>;\r\n\r\n delete: ActionCreator<string, (props: { id: string }) => { id: string } & Action<string>>;\r\n deleteSuccess: ActionCreator<string, (props: { id: string }) => { id: string } & Action<string>>;\r\n deleteFailure: ActionCreator<string, (props: { errors: ERROR }) => { errors: ERROR } & Action<string>>;\r\n\r\n create: ActionCreator<string, (props: { resource: CREATE_DTO }) => { resource: CREATE_DTO } & Action<string>>;\r\n createSuccess: ActionCreator<string, (props: { resource: DTO }) => { resource: DTO } & Action<string>>;\r\n createFailure: ActionCreator<string, (props: { errors: ERROR }) => { errors: ERROR } & Action<string>>;\r\n\r\n reset: ActionCreator<string, () => Action<string>>;\r\n}\r\n\r\nexport interface FormFacade<DTO, ERROR, CREATE_DTO = DTO> {\r\n resource$: Observable<DTO | undefined>;\r\n loadingState$: Observable<RequestState>;\r\n requestState$: Observable<RequestState>;\r\n errors$: Observable<ERROR | undefined>;\r\n isReady$: Observable<boolean>;\r\n\r\n create(props: ActionPayload<FormActions<DTO, ERROR, CREATE_DTO>['create']>): void;\r\n load(props: ActionPayload<FormActions<DTO, ERROR, CREATE_DTO>['load']>): void;\r\n save(props: ActionPayload<FormActions<DTO, ERROR, CREATE_DTO>['save']>): void;\r\n delete(props: ActionPayload<FormActions<DTO, ERROR, CREATE_DTO>['delete']>): void;\r\n reset(): void;\r\n}\r\n","import { createAction, props } from '@ngrx/store';\r\nimport { FormActions } from '../models/form.model';\r\n\r\nexport function createFormActions<DTO, ERROR, CREATE_DTO = DTO>(\r\n featureName: string\r\n): FormActions<DTO, ERROR, CREATE_DTO> {\r\n const load = createAction(`[${featureName} API] Load ${featureName}`, props<{ id: string }>());\r\n const loadSuccess = createAction(`[${featureName} API] Load ${featureName} Success`, props<{ resource: DTO }>());\r\n const loadFailure = createAction(`[${featureName} API] Load ${featureName} Failure`, props<{ errors: ERROR }>());\r\n\r\n const save = createAction(`[${featureName} API] Save ${featureName}`, props<{ resource: DTO }>());\r\n const saveSuccess = createAction(`[${featureName} API] Save ${featureName} Success`, props<{ resource: DTO }>());\r\n const saveFailure = createAction(`[${featureName} API] Save ${featureName} Failure`, props<{ errors: ERROR }>());\r\n\r\n const deleteAction = createAction(`[${featureName} API] Delete ${featureName}`, props<{ id: string }>());\r\n const deleteSuccess = createAction(`[${featureName} API] Delete ${featureName} Success`, props<{ id: string }>());\r\n const deleteFailure = createAction(`[${featureName} API] Delete ${featureName} Failure`, props<{ errors: ERROR }>());\r\n\r\n const create = createAction(`[${featureName} API] Create ${featureName}`, props<{ resource: CREATE_DTO }>());\r\n const createSuccess = createAction(`[${featureName} API] Create ${featureName} Success`, props<{ resource: DTO }>());\r\n const createFailure = createAction(`[${featureName} API] Create ${featureName} Failure`, props<{ errors: ERROR }>());\r\n\r\n const reset = createAction(`[${featureName} API] Reset ${featureName}`);\r\n\r\n return {\r\n load,\r\n loadSuccess,\r\n loadFailure,\r\n save,\r\n saveSuccess,\r\n saveFailure,\r\n delete: deleteAction,\r\n deleteSuccess,\r\n deleteFailure,\r\n create,\r\n createSuccess,\r\n createFailure,\r\n reset\r\n };\r\n}\r\n","import { RequestState } from '@ngdux/data-model-common';\r\nimport { createLoadingStateActionHandlers, createRequestStateActionHandlers } from '@ngdux/store-common';\r\nimport { ActionCreator, ActionReducer, Creator, ReducerTypes, createReducer, on } from '@ngrx/store';\r\nimport { FormActions, FormState } from '../models/form.model';\r\n\r\nexport function createFormReducer<DTO, ERROR, CREATE_DTO = DTO>(\r\n actions: FormActions<DTO, ERROR, CREATE_DTO>,\r\n actionHandlers?: ReducerTypes<FormState<DTO, ERROR>, ActionCreator[]>[],\r\n initialFormState?: Record<string, any>\r\n): ActionReducer<FormState<DTO, ERROR>> {\r\n const initialState: FormState<DTO, ERROR> = { ...createInitialFormState<DTO, ERROR>(), ...initialFormState };\r\n return createReducer<FormState<DTO, ERROR>>(\r\n initialState,\r\n ...createFormActionHandlers<DTO, ERROR, CREATE_DTO>(initialState, actions),\r\n ...(actionHandlers || [])\r\n );\r\n}\r\n\r\nfunction createInitialFormState<DTO, ERROR>(): FormState<DTO, ERROR> {\r\n return {\r\n resource: undefined,\r\n loadingState: RequestState.IDLE,\r\n requestState: RequestState.IDLE,\r\n errors: undefined\r\n };\r\n}\r\n\r\nfunction createFormActionHandlers<DTO, ERROR, CREATE_DTO = DTO>(\r\n initialFormState: FormState<DTO, ERROR>,\r\n actions: FormActions<DTO, ERROR, CREATE_DTO>\r\n): ReducerTypes<FormState<DTO, ERROR>, ActionCreator<string, Creator<any[], object>>[]>[] {\r\n return [\r\n on(actions.reset, (): FormState<DTO, ERROR> => initialFormState),\r\n on(\r\n actions.loadSuccess,\r\n actions.createSuccess,\r\n actions.saveSuccess,\r\n (state: FormState<DTO, ERROR>, { resource }): FormState<DTO, ERROR> => ({ ...state, resource })\r\n ),\r\n on(\r\n actions.deleteSuccess,\r\n (state: FormState<DTO, ERROR>): FormState<DTO, ERROR> => ({\r\n ...state,\r\n resource: undefined\r\n })\r\n ),\r\n ...createRequestStateActionHandlers<FormState<DTO, ERROR>, ERROR>(\r\n actions.load,\r\n actions.save,\r\n actions.saveSuccess,\r\n actions.saveFailure\r\n ),\r\n ...createRequestStateActionHandlers<FormState<DTO, ERROR>, ERROR>(\r\n undefined,\r\n actions.create,\r\n actions.createSuccess,\r\n actions.createFailure\r\n ),\r\n ...createRequestStateActionHandlers<FormState<DTO, ERROR>, ERROR>(\r\n undefined,\r\n actions.delete,\r\n actions.deleteSuccess,\r\n actions.deleteFailure\r\n ),\r\n ...createLoadingStateActionHandlers<FormState<DTO, ERROR>>(actions.load, actions.loadSuccess, actions.loadFailure)\r\n ];\r\n}\r\n","import { RequestState } from '@ngdux/data-model-common';\r\nimport { createSelector, DefaultProjectorFn, MemoizedSelector } from '@ngrx/store';\r\nimport { FormSelectors, FormState } from '../models/form.model';\r\n\r\nexport function createFormSelectors<T, E>(\r\n getFormState: MemoizedSelector<object, FormState<T, E>, DefaultProjectorFn<FormState<T, E>>>\r\n): FormSelectors<T, E> {\r\n const getRequestState = createSelector(getFormState, state => state.requestState);\r\n const getLoadingState = createSelector(getFormState, state => state.loadingState);\r\n const getErrors = createSelector(getFormState, state => state.errors);\r\n const getResource = createSelector(getFormState, state => state.resource);\r\n\r\n const isReady = createSelector(\r\n getResource,\r\n getLoadingState,\r\n (resource, loadingState) => !!resource && loadingState === RequestState.SUCCESS\r\n );\r\n\r\n return {\r\n getRequestState,\r\n getLoadingState,\r\n getErrors,\r\n getResource,\r\n isReady\r\n };\r\n}\r\n","import { Inject, Injectable } from '@angular/core';\r\nimport { ReducerManager, createFeatureSelector } from '@ngrx/store';\r\nimport { FORM_FEATURE_KEY, FormActions, FormSelectors, FormState } from '../models/form.model';\r\nimport { createFormActions } from './form-actions';\r\nimport { createFormReducer } from './form-reducer';\r\nimport { createFormSelectors } from './form-selectors';\r\n\r\n/**\r\n * @deprecated This class is deprecated and will be removed in a future release.\r\n */\r\n@Injectable()\r\nexport abstract class AbstractFormReducerManager<DTO, ERROR, CREATE_DTO = DTO> {\r\n actions: FormActions<DTO, ERROR, CREATE_DTO>;\r\n selectors: FormSelectors<DTO, ERROR>;\r\n\r\n constructor(\r\n private readonly reducerManager: ReducerManager,\r\n @Inject(FORM_FEATURE_KEY) private readonly featureKey: string\r\n ) {\r\n this.actions = this.getActions();\r\n this.addReducer();\r\n this.selectors = this.getSelectors();\r\n }\r\n\r\n protected getActions() {\r\n return createFormActions<DTO, ERROR, CREATE_DTO>(this.featureKey);\r\n }\r\n\r\n protected addReducer() {\r\n if (!this.reducerManager.currentReducers[this.featureKey]) {\r\n const reducer = createFormReducer(this.actions);\r\n this.reducerManager.addReducer(this.featureKey, reducer);\r\n }\r\n }\r\n\r\n protected getSelectors() {\r\n const getState = createFeatureSelector<FormState<DTO, ERROR>>(this.featureKey);\r\n return createFormSelectors(getState);\r\n }\r\n}\r\n","import { ActionPayload } from '@ngdux/store-common';\r\nimport { select, Store } from '@ngrx/store';\r\nimport { FormActions, FormSelectors } from '../models/form.model';\r\n\r\n/**\r\n * @deprecated This class is deprecated and will be removed in a future release. Please use `provideFormFacade` or `createFormFacade` instead.\r\n */\r\nexport abstract class AbstractFormFacade<DTO, E, CREATE_DTO = DTO> {\r\n readonly resource$ = this.store.pipe(select(this.formSelectors.getResource));\r\n readonly loadingState$ = this.store.pipe(select(this.formSelectors.getLoadingState));\r\n readonly requestState$ = this.store.pipe(select(this.formSelectors.getRequestState));\r\n readonly errors$ = this.store.pipe(select(this.formSelectors.getErrors));\r\n readonly isReady$ = this.store.pipe(select(this.formSelectors.isReady));\r\n\r\n constructor(\r\n protected readonly store: Store,\r\n private readonly formActions: FormActions<DTO, E, CREATE_DTO>,\r\n private readonly formSelectors: FormSelectors<DTO, E>\r\n ) {}\r\n\r\n create(props: ActionPayload<FormActions<DTO, E, CREATE_DTO>['create']>): void {\r\n this.store.dispatch(this.formActions.create(props));\r\n }\r\n\r\n load(props: ActionPayload<FormActions<DTO, E, CREATE_DTO>['load']>): void {\r\n this.store.dispatch(this.formActions.load(props));\r\n }\r\n\r\n save(props: ActionPayload<FormActions<DTO, E, CREATE_DTO>['save']>): void {\r\n this.store.dispatch(this.formActions.save(props));\r\n }\r\n\r\n delete(props: ActionPayload<FormActions<DTO, E, CREATE_DTO>['delete']>): void {\r\n this.store.dispatch(this.formActions.delete(props));\r\n }\r\n\r\n reset(): void {\r\n this.store.dispatch(this.formActions.reset());\r\n }\r\n}\r\n","import { inject } from '@angular/core';\r\nimport { FormNotificationService, FormService } from '@ngdux/data-model-common';\r\nimport { Actions, createEffect, ofType } from '@ngrx/effects';\r\nimport { catchError, exhaustMap, map, of, switchMap, tap } from 'rxjs';\r\nimport { FormActions } from '../models/form.model';\r\n\r\nexport function createFormEffects<DTO, ERROR, CREATE_DTO = DTO>(\r\n formActions: FormActions<DTO, ERROR, CREATE_DTO>,\r\n formService: () => FormService<DTO, CREATE_DTO>,\r\n notificationService: () => FormNotificationService<ERROR>\r\n) {\r\n return {\r\n load$: createEffect(\r\n (actions$ = inject(Actions), service = formService()) => loadResourceEffect(actions$, formActions, service),\r\n {\r\n functional: true\r\n }\r\n ),\r\n create$: createEffect(\r\n (actions$ = inject(Actions), service = formService()) => createResourceEffect(actions$, formActions, service),\r\n {\r\n functional: true\r\n }\r\n ),\r\n update$: createEffect(\r\n (actions$ = inject(Actions), service = formService()) => updateResourceEffect(actions$, formActions, service),\r\n {\r\n functional: true\r\n }\r\n ),\r\n delete$: createEffect(\r\n (actions$ = inject(Actions), service = formService()) => deleteResourceEffect(actions$, formActions, service),\r\n {\r\n functional: true\r\n }\r\n ),\r\n errorsHandler$: createEffect(\r\n (actions$ = inject(Actions), service = notificationService()) =>\r\n errorsHandlerEffect(actions$, formActions, service),\r\n {\r\n functional: true,\r\n dispatch: false\r\n }\r\n )\r\n };\r\n}\r\n\r\nfunction loadResourceEffect<DTO, ERROR, CREATE_DTO = DTO>(\r\n actions$: Actions,\r\n formActions: FormActions<DTO, ERROR, CREATE_DTO>,\r\n service: FormService<DTO, CREATE_DTO>\r\n) {\r\n return actions$.pipe(\r\n ofType(formActions.load),\r\n switchMap(({ id }) =>\r\n service.loadResource(id).pipe(\r\n map(resource => formActions.loadSuccess({ resource })),\r\n catchError((errors: ERROR) => of(formActions.loadFailure({ errors })))\r\n )\r\n )\r\n );\r\n}\r\n\r\nfunction createResourceEffect<DTO, ERROR, CREATE_DTO = DTO>(\r\n actions$: Actions,\r\n formActions: FormActions<DTO, ERROR, CREATE_DTO>,\r\n service: FormService<DTO, CREATE_DTO>\r\n) {\r\n return actions$.pipe(\r\n ofType(formActions.create),\r\n switchMap(action => {\r\n if (!service.createResource) {\r\n throw new Error('createResource not implement in the ListService');\r\n }\r\n\r\n return service.createResource(action.resource).pipe(\r\n map(resource => formActions.createSuccess({ resource })),\r\n catchError((errors: ERROR) => of(formActions.createFailure({ errors })))\r\n );\r\n })\r\n );\r\n}\r\n\r\nfunction updateResourceEffect<DTO, ERROR, CREATE_DTO = DTO>(\r\n actions$: Actions,\r\n formActions: FormActions<DTO, ERROR, CREATE_DTO>,\r\n service: FormService<DTO, CREATE_DTO>\r\n) {\r\n return actions$.pipe(\r\n ofType(formActions.save),\r\n switchMap(({ resource }) => {\r\n if (!service.saveResource) {\r\n throw new Error('saveResource not implement in the ListService');\r\n }\r\n\r\n return service.saveResource(resource).pipe(\r\n map(response => formActions.saveSuccess({ resource: response })),\r\n catchError((errors: ERROR) => of(formActions.saveFailure({ errors })))\r\n );\r\n })\r\n );\r\n}\r\n\r\nfunction deleteResourceEffect<DTO, ERROR, CREATE_DTO = DTO>(\r\n actions$: Actions,\r\n formActions: FormActions<DTO, ERROR, CREATE_DTO>,\r\n service: FormService<DTO, CREATE_DTO>\r\n) {\r\n return actions$.pipe(\r\n ofType(formActions.delete),\r\n exhaustMap(action => {\r\n if (!service.deleteResource) {\r\n throw new Error('deleteResource not implement in the ListService');\r\n }\r\n\r\n return service.deleteResource(action.id).pipe(\r\n map(() => formActions.deleteSuccess({ id: action.id })),\r\n catchError((errors: ERROR) => of(formActions.deleteFailure({ errors })))\r\n );\r\n })\r\n );\r\n}\r\n\r\nfunction errorsHandlerEffect<DTO, ERROR, CREATE_DTO = DTO>(\r\n actions$: Actions,\r\n formActions: FormActions<DTO, ERROR, CREATE_DTO>,\r\n notificationService: FormNotificationService<ERROR>\r\n) {\r\n return actions$.pipe(\r\n ofType(formActions.saveFailure, formActions.loadFailure, formActions.deleteFailure, formActions.createFailure),\r\n tap(({ errors }) => {\r\n notificationService.onFormErrors(errors);\r\n })\r\n );\r\n}\r\n","import { inject, InjectionToken } from '@angular/core';\r\nimport { ActionPayload } from '@ngdux/store-common';\r\nimport { select, Store } from '@ngrx/store';\r\nimport { FormActions, FormFacade, FormSelectors } from '../models/form.model';\r\n\r\nexport function provideFormFacade<DTO, ERROR, CREATE_DTO = DTO>(\r\n token: InjectionToken<FormFacade<DTO, ERROR, CREATE_DTO>>,\r\n formActions: FormActions<DTO, ERROR, CREATE_DTO>,\r\n formSelectors: FormSelectors<DTO, ERROR>\r\n) {\r\n return {\r\n provide: token,\r\n useFactory: () => createFormFacade(formActions, formSelectors, inject(Store))\r\n };\r\n}\r\n\r\nexport function createFormFacade<DTO, ERROR, CREATE_DTO = DTO>(\r\n formActions: FormActions<DTO, ERROR, CREATE_DTO>,\r\n formSelectors: FormSelectors<DTO, ERROR>,\r\n store: Store\r\n): FormFacade<DTO, ERROR, CREATE_DTO> {\r\n const resource$ = store.pipe(select(formSelectors.getResource));\r\n const loadingState$ = store.pipe(select(formSelectors.getLoadingState));\r\n const requestState$ = store.pipe(select(formSelectors.getRequestState));\r\n const errors$ = store.pipe(select(formSelectors.getErrors));\r\n const isReady$ = store.pipe(select(formSelectors.isReady));\r\n\r\n return {\r\n resource$,\r\n loadingState$,\r\n requestState$,\r\n errors$,\r\n isReady$,\r\n create(props: ActionPayload<FormActions<DTO, ERROR, CREATE_DTO>['create']>): void {\r\n store.dispatch(formActions.create(props));\r\n },\r\n load(props: ActionPayload<FormActions<DTO, ERROR, CREATE_DTO>['load']>): void {\r\n store.dispatch(formActions.load(props));\r\n },\r\n save(props: ActionPayload<FormActions<DTO, ERROR, CREATE_DTO>['save']>): void {\r\n store.dispatch(formActions.save(props));\r\n },\r\n delete(props: ActionPayload<FormActions<DTO, ERROR, CREATE_DTO>['delete']>): void {\r\n store.dispatch(formActions.delete(props));\r\n },\r\n reset(): void {\r\n store.dispatch(formActions.reset());\r\n }\r\n };\r\n}\r\n","import { InjectionToken, ProviderToken, inject } from '@angular/core';\r\nimport { FormNotificationService, FormService } from '@ngdux/data-model-common';\r\nimport { provideEffects } from '@ngrx/effects';\r\nimport { Action, createFeatureSelector, provideState } from '@ngrx/store';\r\nimport { FormFacade, FormState } from '../models/form.model';\r\nimport { createFormActions } from './form-actions';\r\nimport { createFormEffects } from './form-effects';\r\nimport { provideFormFacade } from './form-facade';\r\nimport { createFormReducer } from './form-reducer';\r\nimport { createFormSelectors } from './form-selectors';\r\n\r\nexport function createFormState<DTO, ERROR, CREATE_DTO = DTO>(featureName: string) {\r\n const actions = createFormActions<DTO, ERROR, CREATE_DTO>(featureName);\r\n const reducer = createFormReducer(actions);\r\n const getState = createFeatureSelector<FormState<DTO, ERROR>>(featureName);\r\n const selectors = createFormSelectors(getState);\r\n\r\n return {\r\n actions,\r\n reducer: (state: FormState<DTO, ERROR>, action: Action): FormState<DTO, ERROR> => reducer(state, action),\r\n selectors\r\n };\r\n}\r\n\r\nexport function provideFormState<DTO, ERROR, CREATE_DTO = DTO>(\r\n featureKey: string,\r\n facadeToken: InjectionToken<FormFacade<DTO, ERROR, CREATE_DTO>>,\r\n service: ProviderToken<FormService<DTO, CREATE_DTO>>,\r\n notificationService: ProviderToken<FormNotificationService<ERROR>>\r\n) {\r\n const { actions, selectors, reducer } = createFormState<DTO, ERROR, CREATE_DTO>(featureKey);\r\n\r\n return [\r\n provideState(featureKey, reducer),\r\n provideFormFacade(facadeToken, actions, selectors),\r\n provideEffects([\r\n createFormEffects(\r\n actions,\r\n () => inject(service),\r\n () => inject(notificationService)\r\n )\r\n ]),\r\n service,\r\n notificationService\r\n ];\r\n}\r\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":["switchMap","map","catchError","exhaustMap","tap"],"mappings":";;;;;;;;;;;AAOA;;AAEG;MACmB,mBAAmB,CAAA;IA6EvC,WAAA,CACqB,QAAiB,EACjB,KAAY,EACd,OAAqC,EACrC,WAAgD,EAChD,mBAAmD,EAAA;QAJjD,IAAA,CAAA,QAAQ,GAAR,QAAQ;QACR,IAAA,CAAA,KAAK,GAAL,KAAK;QACP,IAAA,CAAA,OAAO,GAAP,OAAO;QACP,IAAA,CAAA,WAAW,GAAX,WAAW;QACX,IAAA,CAAA,mBAAmB,GAAnB,mBAAmB;AAjFtC,QAAA,IAAA,CAAA,KAAK,GAAG,YAAY,CAAC,MACnB,IAAI,CAAC,QAAQ,CAAC,IAAI,CAChB,MAAM,CAAC,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,EAC7B,SAAS,CAAC,CAAC,EAAE,EAAE,EAAE,KACf,IAAI,CAAC,OAAO,CAAC,YAAY,CAAC,EAAE,CAAC,CAAC,IAAI,CAChC,GAAG,CAAC,QAAQ,I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;KACD;AACH;AAEM,SAAU,gBAAgB,CAC9B,UAAkB,EAClB,WAA+D,EAC/D,OAAoD,EACpD,mBAAkE,EAAA;AAElE,IAAA,MAAM,EAAE,OAAO,EAAE,SAAS,EAAE,OAAO,EAAE,GAAG,eAAe,CAAyB,UAAU,CAAC;IAE3F,OAAO;AACL,QAAA,YAAY,CAAC,UAAU,EAAE,OAAO,CAAC;AACjC,QAAA,iBAAiB,CAAC,WAAW,EAAE,OAAO,EAAE,SAAS,CAAC;AAClD,QAAA,cAAc,CAAC;AACb,YAAA,iBAAiB,CACf,OAAO,EACP,MAAM,MAAM,CAAC,OAAO,CAAC,EACrB,MAAM,MAAM,CAAC,mBAAmB,CAAC;SAEpC,CAAC;QACF,OAAO;QACP;KACD;AACH;;AC7CA;;AAEG;;;;"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ngdux/form",
3
- "version": "4.0.0",
3
+ "version": "5.0.0",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "git@github.com:allanartuso/ngdux.git",
@@ -8,20 +8,20 @@
8
8
  },
9
9
  "homepage": "https://github.com/allanartuso/ngdux/tree/master/libs/ngdux/util/store/form#readme",
10
10
  "peerDependencies": {
11
- "@ngdux/data-model-common": "^3.0.0",
12
- "@angular/core": "^20.0.0",
13
- "@ngdux/store-common": "^3.0.0",
14
- "@ngrx/store": "^20.0.0",
15
- "@ngrx/effects": "^20.0.0"
11
+ "@ngdux/store-common": ">=3.0.0",
12
+ "@ngdux/data-model-common": ">=3.0.0",
13
+ "@ngrx/store": ">=21.0.0",
14
+ "@angular/core": ">=21.0.0",
15
+ "@ngrx/effects": ">=21.0.0"
16
16
  },
17
17
  "module": "fesm2022/ngdux-form.mjs",
18
- "typings": "index.d.ts",
18
+ "typings": "types/ngdux-form.d.ts",
19
19
  "exports": {
20
20
  "./package.json": {
21
21
  "default": "./package.json"
22
22
  },
23
23
  ".": {
24
- "types": "./index.d.ts",
24
+ "types": "./types/ngdux-form.d.ts",
25
25
  "default": "./fesm2022/ngdux-form.mjs"
26
26
  }
27
27
  },
@@ -1,14 +1,15 @@
1
- import * as _ngdux_data_model_common from '@ngdux/data-model-common';
2
1
  import { RequestState, FormService, FormNotificationService } from '@ngdux/data-model-common';
3
2
  export { FormNotificationService, FormService, RequestState } from '@ngdux/data-model-common';
4
3
  import * as _ngrx_effects from '@ngrx/effects';
5
4
  import { Actions } from '@ngrx/effects';
6
5
  import * as rxjs from 'rxjs';
6
+ import { Observable } from 'rxjs';
7
7
  import * as _ngrx_store from '@ngrx/store';
8
8
  import { ActionCreator, Action, MemoizedSelector, Store, ReducerManager, ReducerTypes, ActionReducer, DefaultProjectorFn } from '@ngrx/store';
9
- import * as i0 from '@angular/core';
10
- import { InjectionToken } from '@angular/core';
11
- import { ApiRequestState, LoadingState, ActionPayload } from '@ngdux/store-common';
9
+ import * as _angular_core from '@angular/core';
10
+ import { InjectionToken, ProviderToken } from '@angular/core';
11
+ import { ActionPayload, ApiRequestState, LoadingState } from '@ngdux/store-common';
12
+ import * as _ngdux_form from '@ngdux/form';
12
13
 
13
14
  declare const FORM_FEATURE_KEY: InjectionToken<string>;
14
15
  interface FormState<T, E> extends ApiRequestState<E>, LoadingState {
@@ -84,7 +85,22 @@ interface FormActions<DTO, ERROR, CREATE_DTO = DTO> {
84
85
  } & Action<string>>;
85
86
  reset: ActionCreator<string, () => Action<string>>;
86
87
  }
88
+ interface FormFacade<DTO, ERROR, CREATE_DTO = DTO> {
89
+ resource$: Observable<DTO | undefined>;
90
+ loadingState$: Observable<RequestState>;
91
+ requestState$: Observable<RequestState>;
92
+ errors$: Observable<ERROR | undefined>;
93
+ isReady$: Observable<boolean>;
94
+ create(props: ActionPayload<FormActions<DTO, ERROR, CREATE_DTO>['create']>): void;
95
+ load(props: ActionPayload<FormActions<DTO, ERROR, CREATE_DTO>['load']>): void;
96
+ save(props: ActionPayload<FormActions<DTO, ERROR, CREATE_DTO>['save']>): void;
97
+ delete(props: ActionPayload<FormActions<DTO, ERROR, CREATE_DTO>['delete']>): void;
98
+ reset(): void;
99
+ }
87
100
 
101
+ /**
102
+ * @deprecated This class is deprecated and will be removed in a future release. Please use `createFormEffects` instead.
103
+ */
88
104
  declare abstract class AbstractFormEffects<DTO, ERROR, CREATE_DTO = DTO> {
89
105
  protected readonly actions$: Actions;
90
106
  protected readonly store: Store;
@@ -123,6 +139,9 @@ declare abstract class AbstractFormEffects<DTO, ERROR, CREATE_DTO = DTO> {
123
139
  protected constructor(actions$: Actions, store: Store, service: FormService<DTO, CREATE_DTO>, formActions: FormActions<DTO, ERROR, CREATE_DTO>, notificationService: FormNotificationService<ERROR>);
124
140
  }
125
141
 
142
+ /**
143
+ * @deprecated This class is deprecated and will be removed in a future release.
144
+ */
126
145
  declare abstract class AbstractFormReducerManager<DTO, ERROR, CREATE_DTO = DTO> {
127
146
  private readonly reducerManager;
128
147
  private readonly featureKey;
@@ -132,17 +151,20 @@ declare abstract class AbstractFormReducerManager<DTO, ERROR, CREATE_DTO = DTO>
132
151
  protected getActions(): FormActions<DTO, ERROR, CREATE_DTO>;
133
152
  protected addReducer(): void;
134
153
  protected getSelectors(): FormSelectors<DTO, ERROR>;
135
- static ɵfac: i0.ɵɵFactoryDeclaration<AbstractFormReducerManager<any, any, any>, never>;
136
- static ɵprov: i0.ɵɵInjectableDeclaration<AbstractFormReducerManager<any, any, any>>;
154
+ static ɵfac: _angular_core.ɵɵFactoryDeclaration<AbstractFormReducerManager<any, any, any>, never>;
155
+ static ɵprov: _angular_core.ɵɵInjectableDeclaration<AbstractFormReducerManager<any, any, any>>;
137
156
  }
138
157
 
158
+ /**
159
+ * @deprecated This class is deprecated and will be removed in a future release. Please use `provideFormFacade` or `createFormFacade` instead.
160
+ */
139
161
  declare abstract class AbstractFormFacade<DTO, E, CREATE_DTO = DTO> {
140
162
  protected readonly store: Store;
141
163
  private readonly formActions;
142
164
  private readonly formSelectors;
143
165
  readonly resource$: rxjs.Observable<DTO | undefined>;
144
- readonly loadingState$: rxjs.Observable<_ngdux_data_model_common.RequestState>;
145
- readonly requestState$: rxjs.Observable<_ngdux_data_model_common.RequestState>;
166
+ readonly loadingState$: rxjs.Observable<_ngdux_form.RequestState>;
167
+ readonly requestState$: rxjs.Observable<_ngdux_form.RequestState>;
146
168
  readonly errors$: rxjs.Observable<E | undefined>;
147
169
  readonly isReady$: rxjs.Observable<boolean>;
148
170
  constructor(store: Store, formActions: FormActions<DTO, E, CREATE_DTO>, formSelectors: FormSelectors<DTO, E>);
@@ -160,10 +182,14 @@ declare function createFormReducer<DTO, ERROR, CREATE_DTO = DTO>(actions: FormAc
160
182
  declare function createFormSelectors<T, E>(getFormState: MemoizedSelector<object, FormState<T, E>, DefaultProjectorFn<FormState<T, E>>>): FormSelectors<T, E>;
161
183
 
162
184
  declare function createFormState<DTO, ERROR, CREATE_DTO = DTO>(featureName: string): {
163
- actions: FormActions<DTO, ERROR, CREATE_DTO>;
185
+ actions: _ngdux_form.FormActions<DTO, ERROR, CREATE_DTO>;
164
186
  reducer: (state: FormState<DTO, ERROR>, action: Action) => FormState<DTO, ERROR>;
165
- selectors: FormSelectors<DTO, ERROR>;
187
+ selectors: _ngdux_form.FormSelectors<DTO, ERROR>;
166
188
  };
189
+ declare function provideFormState<DTO, ERROR, CREATE_DTO = DTO>(featureKey: string, facadeToken: InjectionToken<FormFacade<DTO, ERROR, CREATE_DTO>>, service: ProviderToken<FormService<DTO, CREATE_DTO>>, notificationService: ProviderToken<FormNotificationService<ERROR>>): (_angular_core.Type<FormService<DTO, CREATE_DTO>> | _angular_core.AbstractType<FormService<DTO, CREATE_DTO>> | InjectionToken<FormService<DTO, CREATE_DTO>> | _angular_core.Type<FormNotificationService<ERROR>> | _angular_core.AbstractType<FormNotificationService<ERROR>> | _angular_core.EnvironmentProviders | {
190
+ provide: InjectionToken<FormFacade<DTO, ERROR, CREATE_DTO>>;
191
+ useFactory: () => FormFacade<DTO, ERROR, CREATE_DTO>;
192
+ })[];
167
193
 
168
- export { AbstractFormEffects, AbstractFormFacade, AbstractFormReducerManager, FORM_FEATURE_KEY, createFormActions, createFormReducer, createFormSelectors, createFormState };
169
- export type { FormActions, FormSelectors, FormState };
194
+ export { AbstractFormEffects, AbstractFormFacade, AbstractFormReducerManager, FORM_FEATURE_KEY, createFormActions, createFormReducer, createFormSelectors, createFormState, provideFormState };
195
+ export type { FormActions, FormFacade, FormSelectors, FormState };