@daffodil/geography 0.94.1-rc.0 → 0.95.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.
Files changed (31) hide show
  1. package/fesm2022/daffodil-geography-driver-in-memory.mjs +161 -121
  2. package/fesm2022/daffodil-geography-driver-in-memory.mjs.map +1 -1
  3. package/fesm2022/daffodil-geography-driver-magento-2.4.7.mjs +246 -0
  4. package/fesm2022/daffodil-geography-driver-magento-2.4.7.mjs.map +1 -0
  5. package/fesm2022/daffodil-geography-driver-magento-auto.mjs +7 -0
  6. package/fesm2022/daffodil-geography-driver-magento-auto.mjs.map +1 -0
  7. package/fesm2022/daffodil-geography-driver-testing.mjs +100 -61
  8. package/fesm2022/daffodil-geography-driver-testing.mjs.map +1 -1
  9. package/fesm2022/daffodil-geography-driver.mjs +18 -29
  10. package/fesm2022/daffodil-geography-driver.mjs.map +1 -1
  11. package/fesm2022/daffodil-geography-state-testing.mjs +98 -57
  12. package/fesm2022/daffodil-geography-state-testing.mjs.map +1 -1
  13. package/fesm2022/daffodil-geography-state.mjs +275 -275
  14. package/fesm2022/daffodil-geography-state.mjs.map +1 -1
  15. package/fesm2022/daffodil-geography-testing.mjs +190 -107
  16. package/fesm2022/daffodil-geography-testing.mjs.map +1 -1
  17. package/fesm2022/daffodil-geography.mjs +21 -43
  18. package/fesm2022/daffodil-geography.mjs.map +1 -1
  19. package/package.json +1 -1
  20. package/types/daffodil-geography-driver-in-memory.d.ts +51 -49
  21. package/types/daffodil-geography-driver-magento-2.4.7.d.ts +86 -0
  22. package/types/daffodil-geography-driver-magento-auto.d.ts +1 -0
  23. package/types/daffodil-geography-driver-testing.d.ts +28 -25
  24. package/types/daffodil-geography-driver.d.ts +22 -30
  25. package/types/daffodil-geography-state-testing.d.ts +33 -29
  26. package/types/daffodil-geography-state.d.ts +124 -139
  27. package/types/daffodil-geography-testing.d.ts +56 -63
  28. package/types/daffodil-geography.d.ts +37 -46
  29. package/fesm2022/daffodil-geography-driver-magento.mjs +0 -196
  30. package/fesm2022/daffodil-geography-driver-magento.mjs.map +0 -1
  31. package/types/daffodil-geography-driver-magento.d.ts +0 -95
@@ -1,163 +1,148 @@
1
- import { DaffCountry } from '@daffodil/geography';
2
- import { EntityState, EntityAdapter, Dictionary } from '@ngrx/entity';
3
- import * as i1 from '@ngrx/store';
4
- import { ActionReducerMap, Action, MemoizedSelector, Store } from '@ngrx/store';
5
- import { DaffStateError, daffTransformErrorToStateError, DaffStoreFacade } from '@daffodil/core/state';
6
- import * as i0 from '@angular/core';
7
- import { Observable } from 'rxjs';
8
- import * as i2 from '@ngrx/effects';
9
-
1
+ import { DaffCountry } from "@daffodil/geography";
2
+ import { Dictionary, EntityAdapter, EntityState } from "@ngrx/entity";
3
+ import * as i1 from "@ngrx/store";
4
+ import { Action, ActionReducerMap, MemoizedSelector, Store } from "@ngrx/store";
5
+ import { DaffStateError, DaffStoreFacade, daffTransformErrorToStateError } from "@daffodil/core/state";
6
+ import { Observable } from "rxjs";
7
+ import * as i0 from "@angular/core";
8
+ import { EnvironmentProviders } from "@angular/core";
9
+ import * as i2 from "@ngrx/effects";
10
10
  /**
11
11
  * Interface for country entity state.
12
12
  */
13
- type DaffCountryEntityState<T extends DaffCountry = DaffCountry> = EntityState<T>;
14
-
15
- interface DaffGeographyReducerState {
16
- loading: boolean;
17
- errors: DaffStateError[];
18
- }
19
-
20
- declare const DAFF_GEOGRAPHY_STORE_FEATURE_KEY = "daffGeography";
21
-
22
- interface DaffGeographyFeatureState<T extends DaffCountry = DaffCountry> {
23
- geography: DaffGeographyReducerState;
24
- countries: DaffCountryEntityState<T>;
25
- }
26
- interface DaffGeographyStateRootSlice<T extends DaffCountry = DaffCountry> {
27
- [DAFF_GEOGRAPHY_STORE_FEATURE_KEY]: DaffGeographyFeatureState<T>;
28
- }
29
-
30
- declare const daffGeographyReducers: ActionReducerMap<DaffGeographyFeatureState>;
31
-
13
+ export type DaffCountryEntityState<T extends DaffCountry = DaffCountry> = EntityState<T>;
14
+ export interface DaffGeographyReducerState {
15
+ loading: boolean;
16
+ errors: DaffStateError[];
17
+ }
18
+ export declare const DAFF_GEOGRAPHY_STORE_FEATURE_KEY = "daffGeography";
19
+ export interface DaffGeographyFeatureState<T extends DaffCountry = DaffCountry> {
20
+ geography: DaffGeographyReducerState;
21
+ countries: DaffCountryEntityState<T>;
22
+ }
23
+ export interface DaffGeographyStateRootSlice<T extends DaffCountry = DaffCountry> {
24
+ [DAFF_GEOGRAPHY_STORE_FEATURE_KEY]: DaffGeographyFeatureState<T>;
25
+ }
26
+ export declare const daffGeographyReducers: ActionReducerMap<DaffGeographyFeatureState>;
32
27
  /**
33
28
  * Country Adapter for changing/overwriting entity state.
34
29
  */
35
- declare const getCountryAdapter: <T extends DaffCountry = DaffCountry>() => EntityAdapter<T>;
36
-
30
+ export declare const getCountryAdapter: <T extends DaffCountry = DaffCountry>() => EntityAdapter<T>;
37
31
  /**
38
32
  * Initial state for country entity state.
39
33
  */
40
- declare const daffCountryEntitiesInitialState: DaffCountryEntityState<any>;
41
-
42
- declare enum DaffGeographyActionTypes {
43
- CountryLoadAction = "[@daffodil/geography] Country Load Action",
44
- CountryLoadSuccessAction = "[@daffodil/geography] Country Load Success Action",
45
- CountryLoadFailureAction = "[@daffodil/geography] Country Load Failure Action",
46
- CountryListAction = "[@daffodil/geography] Country List Action",
47
- CountryListSuccessAction = "[@daffodil/geography] Country List Success Action",
48
- CountryListFailureAction = "[@daffodil/geography] Country List Failure Action"
49
- }
50
- declare class DaffCountryLoad<T extends DaffCountry> implements Action {
51
- payload: T['id'];
52
- readonly type = DaffGeographyActionTypes.CountryLoadAction;
53
- constructor(payload: T['id']);
54
- }
55
- declare class DaffCountryLoadSuccess<T extends DaffCountry> implements Action {
56
- payload: T;
57
- readonly type = DaffGeographyActionTypes.CountryLoadSuccessAction;
58
- constructor(payload: T);
59
- }
60
- declare class DaffCountryLoadFailure implements Action {
61
- payload: DaffStateError;
62
- readonly type = DaffGeographyActionTypes.CountryLoadFailureAction;
63
- constructor(payload: DaffStateError);
64
- }
65
- declare class DaffCountryList implements Action {
66
- readonly type = DaffGeographyActionTypes.CountryListAction;
67
- }
68
- declare class DaffCountryListSuccess<T extends DaffCountry> implements Action {
69
- payload: T[];
70
- readonly type = DaffGeographyActionTypes.CountryListSuccessAction;
71
- constructor(payload: T[]);
72
- }
73
- declare class DaffCountryListFailure implements Action {
74
- payload: DaffStateError;
75
- readonly type = DaffGeographyActionTypes.CountryListFailureAction;
76
- constructor(payload: DaffStateError);
77
- }
78
- type DaffGeographyActions<T extends DaffCountry> = DaffCountryLoad<T> | DaffCountryLoadSuccess<T> | DaffCountryLoadFailure | DaffCountryList | DaffCountryListSuccess<T> | DaffCountryListFailure;
79
-
34
+ export declare const daffCountryEntitiesInitialState: DaffCountryEntityState<any>;
35
+ export declare enum DaffGeographyActionTypes {
36
+ CountryLoadAction = "[@daffodil/geography] Country Load Action",
37
+ CountryLoadSuccessAction = "[@daffodil/geography] Country Load Success Action",
38
+ CountryLoadFailureAction = "[@daffodil/geography] Country Load Failure Action",
39
+ CountryListAction = "[@daffodil/geography] Country List Action",
40
+ CountryListSuccessAction = "[@daffodil/geography] Country List Success Action",
41
+ CountryListFailureAction = "[@daffodil/geography] Country List Failure Action"
42
+ }
43
+ export declare class DaffCountryLoad<T extends DaffCountry> implements Action {
44
+ payload: T['id'];
45
+ readonly type = DaffGeographyActionTypes.CountryLoadAction;
46
+ constructor(payload: T['id']);
47
+ }
48
+ export declare class DaffCountryLoadSuccess<T extends DaffCountry> implements Action {
49
+ payload: T;
50
+ readonly type = DaffGeographyActionTypes.CountryLoadSuccessAction;
51
+ constructor(payload: T);
52
+ }
53
+ export declare class DaffCountryLoadFailure implements Action {
54
+ payload: DaffStateError;
55
+ readonly type = DaffGeographyActionTypes.CountryLoadFailureAction;
56
+ constructor(payload: DaffStateError);
57
+ }
58
+ export declare class DaffCountryList implements Action {
59
+ readonly type = DaffGeographyActionTypes.CountryListAction;
60
+ }
61
+ export declare class DaffCountryListSuccess<T extends DaffCountry> implements Action {
62
+ payload: T[];
63
+ readonly type = DaffGeographyActionTypes.CountryListSuccessAction;
64
+ constructor(payload: T[]);
65
+ }
66
+ export declare class DaffCountryListFailure implements Action {
67
+ payload: DaffStateError;
68
+ readonly type = DaffGeographyActionTypes.CountryListFailureAction;
69
+ constructor(payload: DaffStateError);
70
+ }
71
+ export type DaffGeographyActions<T extends DaffCountry> = DaffCountryLoad<T> | DaffCountryLoadSuccess<T> | DaffCountryLoadFailure | DaffCountryList | DaffCountryListSuccess<T> | DaffCountryListFailure;
80
72
  /**
81
73
  * Reducer function that catches actions and changes/overwrites country entities state.
82
74
  */
83
- declare function daffCountryEntitiesReducer<T extends DaffCountry = DaffCountry>(state: DaffCountryEntityState<any>, action: DaffGeographyActions<T>): DaffCountryEntityState<T>;
84
-
85
- declare function daffGeographyReducer<T extends DaffCountry>(state: DaffGeographyReducerState, action: DaffGeographyActions<T>): DaffGeographyReducerState;
86
-
87
- declare const daffGeographyInitialState: DaffGeographyReducerState;
88
-
75
+ export declare function daffCountryEntitiesReducer<T extends DaffCountry = DaffCountry>(state: DaffCountryEntityState<any>, action: DaffGeographyActions<T>): DaffCountryEntityState<T>;
76
+ export declare function daffGeographyReducer<T extends DaffCountry>(state: DaffGeographyReducerState, action: DaffGeographyActions<T>): DaffGeographyReducerState;
77
+ export declare const daffGeographyInitialState: DaffGeographyReducerState;
89
78
  interface DaffCountryEntitySelectors<T extends DaffCountry = DaffCountry> {
90
- selectCountryEntitiesState: MemoizedSelector<DaffGeographyStateRootSlice<T>, DaffCountryEntityState<T>>;
91
- selectCountryIds: MemoizedSelector<DaffGeographyStateRootSlice<T>, T['id'][]>;
92
- selectCountryEntities: MemoizedSelector<DaffGeographyStateRootSlice<T>, Dictionary<T>>;
93
- selectAllCountries: MemoizedSelector<DaffGeographyStateRootSlice<T>, T[]>;
94
- selectCountryTotal: MemoizedSelector<DaffGeographyStateRootSlice<T>, number>;
95
- selectCountry: (id: T['id']) => MemoizedSelector<DaffGeographyStateRootSlice<T>, T>;
96
- selectCountrySubdivisions: (id: T['id']) => MemoizedSelector<DaffGeographyStateRootSlice<T>, T['subdivisions']>;
97
- selectIsCountryFullyLoaded: (id: T['id']) => MemoizedSelector<DaffGeographyStateRootSlice<T>, boolean>;
98
- }
99
-
79
+ selectCountryEntitiesState: MemoizedSelector<DaffGeographyStateRootSlice<T>, DaffCountryEntityState<T>>;
80
+ selectCountryIds: MemoizedSelector<DaffGeographyStateRootSlice<T>, T['id'][]>;
81
+ selectCountryEntities: MemoizedSelector<DaffGeographyStateRootSlice<T>, Dictionary<T>>;
82
+ selectAllCountries: MemoizedSelector<DaffGeographyStateRootSlice<T>, T[]>;
83
+ selectCountryTotal: MemoizedSelector<DaffGeographyStateRootSlice<T>, number>;
84
+ selectCountry: (id: T['id']) => MemoizedSelector<DaffGeographyStateRootSlice<T>, T>;
85
+ selectCountrySubdivisions: (id: T['id']) => MemoizedSelector<DaffGeographyStateRootSlice<T>, T['subdivisions']>;
86
+ selectIsCountryFullyLoaded: (id: T['id']) => MemoizedSelector<DaffGeographyStateRootSlice<T>, boolean>;
87
+ }
100
88
  interface DaffGeographyFeatureSelector<T extends DaffCountry = DaffCountry> {
101
- selectGeographyFeatureState: MemoizedSelector<DaffGeographyStateRootSlice<T>, DaffGeographyFeatureState<T>>;
89
+ selectGeographyFeatureState: MemoizedSelector<DaffGeographyStateRootSlice<T>, DaffGeographyFeatureState<T>>;
102
90
  }
103
-
104
91
  interface DaffGeographySelectors {
105
- selectGeographyState: MemoizedSelector<DaffGeographyStateRootSlice, DaffGeographyReducerState>;
106
- selectGeographyLoading: MemoizedSelector<DaffGeographyStateRootSlice, boolean>;
107
- selectGeographyErrors: MemoizedSelector<DaffGeographyStateRootSlice, DaffStateError[]>;
108
- }
109
-
110
- interface DaffGeographyAllSelectors<T extends DaffCountry = DaffCountry> extends DaffCountryEntitySelectors<T>, DaffGeographySelectors, DaffGeographyFeatureSelector<T> {
92
+ selectGeographyState: MemoizedSelector<DaffGeographyStateRootSlice, DaffGeographyReducerState>;
93
+ selectGeographyLoading: MemoizedSelector<DaffGeographyStateRootSlice, boolean>;
94
+ selectGeographyErrors: MemoizedSelector<DaffGeographyStateRootSlice, DaffStateError[]>;
111
95
  }
112
- declare const getDaffGeographySelectors: <T extends DaffCountry = DaffCountry>() => DaffGeographyAllSelectors<T>;
113
-
96
+ export interface DaffGeographyAllSelectors<T extends DaffCountry = DaffCountry> extends DaffCountryEntitySelectors<T>, DaffGeographySelectors, DaffGeographyFeatureSelector<T> {}
97
+ export declare const getDaffGeographySelectors: <T extends DaffCountry = DaffCountry>() => DaffGeographyAllSelectors<T>;
114
98
  /**
115
99
  * Transforms `DaffError`s into `DaffStateError`s before they are serialized into state.
116
100
  * Can be used to further refine Daffodil errors into more specific app errors.
117
101
  */
118
- declare const DAFF_GEOGRAPHY_ERROR_MATCHER: i0.InjectionToken<typeof daffTransformErrorToStateError>;
119
- declare const provideDaffGeographyErrorMatcher: <R extends typeof daffTransformErrorToStateError = typeof daffTransformErrorToStateError>(value: R) => i0.ValueProvider;
120
-
121
- interface DaffGeographyFacadeInterface<T extends DaffCountry = DaffCountry> extends DaffStoreFacade<Action> {
122
- loading$: Observable<boolean>;
123
- errors$: Observable<DaffStateError[]>;
124
- countries$: Observable<T[]>;
125
- countryIds$: Observable<T['id'][]>;
126
- countryCount$: Observable<number>;
127
- countryEntities$: Observable<Dictionary<T>>;
128
- getCountry(id: T['id']): Observable<T>;
129
- getCountrySubdivisions(id: T['id']): Observable<T['subdivisions']>;
130
- isCountryFullyLoaded(id: T['id']): Observable<boolean>;
131
- }
132
-
102
+ export declare const DAFF_GEOGRAPHY_ERROR_MATCHER: import("@angular/core").InjectionToken<typeof daffTransformErrorToStateError>, provideDaffGeographyErrorMatcher: <R extends typeof daffTransformErrorToStateError = typeof daffTransformErrorToStateError>(value: R) => import("@angular/core").ValueProvider;
103
+ export interface DaffGeographyFacadeInterface<T extends DaffCountry = DaffCountry> extends DaffStoreFacade<Action> {
104
+ loading$: Observable<boolean>;
105
+ errors$: Observable<DaffStateError[]>;
106
+ countries$: Observable<T[]>;
107
+ countryIds$: Observable<T['id'][]>;
108
+ countryCount$: Observable<number>;
109
+ countryEntities$: Observable<Dictionary<T>>;
110
+ getCountry(id: T['id']): Observable<T>;
111
+ getCountrySubdivisions(id: T['id']): Observable<T['subdivisions']>;
112
+ isCountryFullyLoaded(id: T['id']): Observable<boolean>;
113
+ }
133
114
  /**
134
115
  * @inheritdoc
135
116
  */
136
- declare class DaffGeographyFacade<T extends DaffCountry = DaffCountry> implements DaffGeographyFacadeInterface<T> {
137
- private store;
138
- loading$: Observable<boolean>;
139
- errors$: Observable<DaffStateError[]>;
140
- countries$: Observable<T[]>;
141
- countryIds$: Observable<T['id'][]>;
142
- countryCount$: Observable<number>;
143
- countryEntities$: Observable<Dictionary<T>>;
144
- private _selectCountry;
145
- private _selectCountrySubdivisions;
146
- private _selectIsCountryFullyLoaded;
147
- constructor(store: Store<DaffGeographyStateRootSlice<T>>);
148
- getCountry(id: T['id']): Observable<T>;
149
- getCountrySubdivisions(id: T['id']): Observable<T['subdivisions']>;
150
- isCountryFullyLoaded(id: T['id']): Observable<boolean>;
151
- dispatch(action: Action): void;
152
- static ɵfac: i0.ɵɵFactoryDeclaration<DaffGeographyFacade<any>, never>;
153
- static ɵprov: i0.ɵɵInjectableDeclaration<DaffGeographyFacade<any>>;
154
- }
155
-
156
- declare class DaffGeographyStateModule {
157
- static ɵfac: i0.ɵɵFactoryDeclaration<DaffGeographyStateModule, never>;
158
- static ɵmod: i0.ɵɵNgModuleDeclaration<DaffGeographyStateModule, never, [typeof i1.StoreFeatureModule, typeof i2.EffectsFeatureModule], never>;
159
- static ɵinj: i0.ɵɵInjectorDeclaration<DaffGeographyStateModule>;
160
- }
161
-
162
- export { DAFF_GEOGRAPHY_ERROR_MATCHER, DAFF_GEOGRAPHY_STORE_FEATURE_KEY, DaffCountryList, DaffCountryListFailure, DaffCountryListSuccess, DaffCountryLoad, DaffCountryLoadFailure, DaffCountryLoadSuccess, DaffGeographyActionTypes, DaffGeographyFacade, DaffGeographyStateModule, daffCountryEntitiesInitialState, daffCountryEntitiesReducer, daffGeographyInitialState, daffGeographyReducer, daffGeographyReducers, getCountryAdapter, getDaffGeographySelectors, provideDaffGeographyErrorMatcher };
163
- export type { DaffCountryEntityState, DaffGeographyActions, DaffGeographyAllSelectors, DaffGeographyFacadeInterface, DaffGeographyFeatureState, DaffGeographyReducerState, DaffGeographyStateRootSlice };
117
+ export declare class DaffGeographyFacade<T extends DaffCountry = DaffCountry> implements DaffGeographyFacadeInterface<T> {
118
+ private store;
119
+ loading$: Observable<boolean>;
120
+ errors$: Observable<DaffStateError[]>;
121
+ countries$: Observable<T[]>;
122
+ countryIds$: Observable<T['id'][]>;
123
+ countryCount$: Observable<number>;
124
+ countryEntities$: Observable<Dictionary<T>>;
125
+ private _selectCountry;
126
+ private _selectCountrySubdivisions;
127
+ private _selectIsCountryFullyLoaded;
128
+ constructor(store: Store<DaffGeographyStateRootSlice<T>>);
129
+ getCountry(id: T['id']): Observable<T>;
130
+ getCountrySubdivisions(id: T['id']): Observable<T['subdivisions']>;
131
+ isCountryFullyLoaded(id: T['id']): Observable<boolean>;
132
+ dispatch(action: Action): void;
133
+ static ɵfac: i0.ɵɵFactoryDeclaration<DaffGeographyFacade<any>, never>;
134
+ static ɵprov: i0.ɵɵInjectableDeclaration<any>;
135
+ }
136
+ /**
137
+ * @deprecated in favor of {@link provideDaffGeographyState} Deprecated in version 0.95.0. Will be removed in version 0.98.0.
138
+ */
139
+ export declare class DaffGeographyStateModule {
140
+ static ɵfac: i0.ɵɵFactoryDeclaration<DaffGeographyStateModule, never>;
141
+ static ɵmod: i0.ɵɵNgModuleDeclaration<DaffGeographyStateModule, never, [typeof i1.StoreFeatureModule, typeof i2.EffectsFeatureModule], never>;
142
+ static ɵinj: i0.ɵɵInjectorDeclaration<DaffGeographyStateModule>;
143
+ }
144
+ /**
145
+ * Provides the `@daffodil/geography/state` feature state and effects.
146
+ */
147
+ export declare const provideDaffGeographyState: () => EnvironmentProviders;
148
+ export {};
@@ -1,63 +1,56 @@
1
- import { DaffModelFactory } from '@daffodil/core/testing';
2
- import * as _daffodil_geography from '@daffodil/geography';
3
- import { DaffAddress, DaffPersonalAddress, DaffSubdivision, DaffCountry } from '@daffodil/geography';
4
- import * as i0 from '@angular/core';
5
-
6
- declare class MockDaffAddress implements DaffAddress {
7
- street: string;
8
- street2: string;
9
- city: string;
10
- region: string;
11
- region_code: string;
12
- postcode: string;
13
- country: string;
14
- }
15
- declare class DaffAddressFactory extends DaffModelFactory<DaffAddress> {
16
- constructor();
17
- static ɵfac: i0.ɵɵFactoryDeclaration<DaffAddressFactory, never>;
18
- static ɵprov: i0.ɵɵInjectableDeclaration<DaffAddressFactory>;
19
- }
20
-
21
- declare class MockDaffPersonalAddress extends MockDaffAddress implements DaffPersonalAddress {
22
- prefix: string;
23
- suffix: string;
24
- firstname: string;
25
- middlename: string;
26
- lastname: string;
27
- email: string;
28
- telephone: string;
29
- }
30
- declare class DaffPersonalAddressFactory extends DaffModelFactory<DaffPersonalAddress> {
31
- constructor();
32
- static ɵfac: i0.ɵɵFactoryDeclaration<DaffPersonalAddressFactory, never>;
33
- static ɵprov: i0.ɵɵInjectableDeclaration<DaffPersonalAddressFactory>;
34
- }
35
-
36
- declare class MockSubdivision implements DaffSubdivision {
37
- id: string;
38
- name: string;
39
- iso_3166_2: string;
40
- }
41
- declare class DaffSubdivisionFactory extends DaffModelFactory<DaffSubdivision> {
42
- constructor();
43
- static ɵfac: i0.ɵɵFactoryDeclaration<DaffSubdivisionFactory, never>;
44
- static ɵprov: i0.ɵɵInjectableDeclaration<DaffSubdivisionFactory>;
45
- }
46
-
47
- declare class MockCountry implements DaffCountry {
48
- protected subdivisionFactory: DaffSubdivisionFactory;
49
- id: string;
50
- name: string;
51
- name_en: string;
52
- alpha2: string;
53
- alpha3: string;
54
- subdivisions: _daffodil_geography.DaffSubdivision[];
55
- constructor(subdivisionFactory: DaffSubdivisionFactory);
56
- }
57
- declare class DaffCountryFactory extends DaffModelFactory<DaffCountry> {
58
- constructor(subdivisionFactory: DaffSubdivisionFactory);
59
- static ɵfac: i0.ɵɵFactoryDeclaration<DaffCountryFactory, never>;
60
- static ɵprov: i0.ɵɵInjectableDeclaration<DaffCountryFactory>;
61
- }
62
-
63
- export { DaffAddressFactory, DaffCountryFactory, DaffPersonalAddressFactory, DaffSubdivisionFactory, MockCountry, MockDaffAddress, MockDaffPersonalAddress, MockSubdivision };
1
+ import { DaffModelFactory } from "@daffodil/core/testing";
2
+ import { DaffAddress, DaffCountry, DaffPersonalAddress, DaffSubdivision } from "@daffodil/geography";
3
+ import * as i0 from "@angular/core";
4
+ export declare class MockDaffAddress implements DaffAddress {
5
+ street: string;
6
+ street2: string;
7
+ city: string;
8
+ region: string;
9
+ region_code: string;
10
+ postcode: string;
11
+ country: string;
12
+ }
13
+ export declare class DaffAddressFactory extends DaffModelFactory<DaffAddress> {
14
+ constructor();
15
+ static ɵfac: i0.ɵɵFactoryDeclaration<DaffAddressFactory, never>;
16
+ static ɵprov: i0.ɵɵInjectableDeclaration<any>;
17
+ }
18
+ export declare class MockDaffPersonalAddress extends MockDaffAddress implements DaffPersonalAddress {
19
+ prefix: string;
20
+ suffix: string;
21
+ firstname: string;
22
+ middlename: string;
23
+ lastname: string;
24
+ email: string;
25
+ telephone: string;
26
+ }
27
+ export declare class DaffPersonalAddressFactory extends DaffModelFactory<DaffPersonalAddress> {
28
+ constructor();
29
+ static ɵfac: i0.ɵɵFactoryDeclaration<DaffPersonalAddressFactory, never>;
30
+ static ɵprov: i0.ɵɵInjectableDeclaration<any>;
31
+ }
32
+ export declare class MockSubdivision implements DaffSubdivision {
33
+ id: string;
34
+ name: string;
35
+ iso_3166_2: string;
36
+ }
37
+ export declare class DaffSubdivisionFactory extends DaffModelFactory<DaffSubdivision> {
38
+ constructor();
39
+ static ɵfac: i0.ɵɵFactoryDeclaration<DaffSubdivisionFactory, never>;
40
+ static ɵprov: i0.ɵɵInjectableDeclaration<any>;
41
+ }
42
+ export declare class MockCountry implements DaffCountry {
43
+ protected subdivisionFactory: DaffSubdivisionFactory;
44
+ id: string;
45
+ name: string;
46
+ name_en: string;
47
+ alpha2: string;
48
+ alpha3: string;
49
+ subdivisions: import("@daffodil/geography").DaffSubdivision[];
50
+ constructor(subdivisionFactory: DaffSubdivisionFactory);
51
+ }
52
+ export declare class DaffCountryFactory extends DaffModelFactory<DaffCountry> {
53
+ constructor(subdivisionFactory: DaffSubdivisionFactory);
54
+ static ɵfac: i0.ɵɵFactoryDeclaration<DaffCountryFactory, never>;
55
+ static ɵprov: i0.ɵɵInjectableDeclaration<any>;
56
+ }
@@ -1,77 +1,68 @@
1
- import { DaffIdentifiable, ID } from '@daffodil/core';
2
-
1
+ import { DaffIdentifiable, ID } from "@daffodil/core";
3
2
  /**
4
3
  * The subdivisions of a country as per ISO-3166-2
5
4
  * For the United States this is commonly termed as "States"
6
5
  */
7
- interface DaffSubdivision extends DaffIdentifiable {
8
- name: string;
9
- iso_3166_2: string;
6
+ export interface DaffSubdivision extends DaffIdentifiable {
7
+ name: string;
8
+ iso_3166_2: string;
10
9
  }
11
-
12
10
  /**
13
11
  * A basic model of an address
14
12
  */
15
- interface DaffAddress {
16
- street: string;
17
- street2?: string;
18
- city: string;
19
- /**
20
- * The ID of the {@link DaffSubdivision}.
21
- */
22
- region: DaffSubdivision['id'];
23
- region_code?: DaffSubdivision['iso_3166_2'];
24
- country?: ID;
25
- country_id?: ID;
26
- postcode: string;
13
+ export interface DaffAddress {
14
+ street: string;
15
+ street2?: string;
16
+ city: string;
17
+ /**
18
+ * The ID of the {@link DaffSubdivision}.
19
+ */
20
+ region: DaffSubdivision['id'];
21
+ region_code?: DaffSubdivision['iso_3166_2'];
22
+ country?: ID;
23
+ country_id?: ID;
24
+ postcode: string;
27
25
  }
28
-
29
26
  /**
30
27
  * A specialized type of address useful for associating a physical address
31
28
  * with a particular individual.
32
29
  */
33
- interface DaffPersonalAddress extends DaffAddress {
34
- prefix?: string;
35
- suffix?: string;
36
- firstname: string;
37
- middlename?: string;
38
- lastname: string;
39
- telephone: string;
40
- email?: string;
30
+ export interface DaffPersonalAddress extends DaffAddress {
31
+ prefix?: string;
32
+ suffix?: string;
33
+ firstname: string;
34
+ middlename?: string;
35
+ lastname: string;
36
+ telephone: string;
37
+ email?: string;
41
38
  }
42
-
43
39
  /**
44
40
  * A representation of a country on the planet Earth.
45
41
  * See: ISO-3166
46
42
  */
47
- interface DaffCountry extends DaffIdentifiable {
48
- name: string;
49
- name_en: string;
50
- alpha2: string;
51
- alpha3: string;
52
- subdivisions: DaffSubdivision[];
53
- /**
54
- * Whether or not the country has been fully loaded.
55
- * If true, the subdivisions field will be populated if any exist.
56
- */
57
- loaded?: boolean;
43
+ export interface DaffCountry extends DaffIdentifiable {
44
+ name: string;
45
+ name_en: string;
46
+ alpha2: string;
47
+ alpha3: string;
48
+ subdivisions: DaffSubdivision[];
49
+ /**
50
+ * Whether or not the country has been fully loaded.
51
+ * If true, the subdivisions field will be populated if any exist.
52
+ */
53
+ loaded?: boolean;
58
54
  }
59
-
60
55
  /**
61
56
  * Compares two addresses and returns true if all of their fields are equal.
62
57
  *
63
58
  * @param address0 An address.
64
59
  * @param address1 An address.
65
60
  */
66
- declare function daffCompareAddresses(address0: DaffAddress, address1: DaffAddress): boolean;
67
-
61
+ export declare function daffCompareAddresses(address0: DaffAddress, address1: DaffAddress): boolean;
68
62
  /**
69
63
  * Compares two personal addresses and returns true if all of their fields are equal.
70
64
  *
71
65
  * @param address0 A personal address.
72
66
  * @param address1 A personal address.
73
67
  */
74
- declare function daffComparePersonalAddresses(address0: DaffPersonalAddress, address1: DaffPersonalAddress): boolean;
75
-
76
- export { daffCompareAddresses, daffComparePersonalAddresses };
77
- export type { DaffAddress, DaffCountry, DaffPersonalAddress, DaffSubdivision };
68
+ export declare function daffComparePersonalAddresses(address0: DaffPersonalAddress, address1: DaffPersonalAddress): boolean;