@daffodil/geography 0.88.1 → 0.90.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/driver/in-memory/index.d.ts +59 -1
- package/driver/index.d.ts +32 -1
- package/driver/magento/index.d.ts +95 -1
- package/driver/testing/index.d.ts +29 -1
- package/fesm2022/daffodil-geography-driver-in-memory.mjs +10 -10
- package/fesm2022/daffodil-geography-driver-in-memory.mjs.map +1 -1
- package/fesm2022/daffodil-geography-driver-magento.mjs +13 -13
- package/fesm2022/daffodil-geography-driver-magento.mjs.map +1 -1
- package/fesm2022/daffodil-geography-driver-testing.mjs +7 -7
- package/fesm2022/daffodil-geography-driver-testing.mjs.map +1 -1
- package/fesm2022/daffodil-geography-driver.mjs.map +1 -1
- package/fesm2022/daffodil-geography-state-testing.mjs +7 -7
- package/fesm2022/daffodil-geography-state-testing.mjs.map +1 -1
- package/fesm2022/daffodil-geography-state.mjs +10 -10
- package/fesm2022/daffodil-geography-state.mjs.map +1 -1
- package/fesm2022/daffodil-geography-testing.mjs +12 -12
- package/fesm2022/daffodil-geography-testing.mjs.map +1 -1
- package/fesm2022/daffodil-geography.mjs.map +1 -1
- package/index.d.ts +77 -1
- package/package.json +1 -1
- package/state/index.d.ts +163 -1
- package/state/testing/index.d.ts +33 -1
- package/testing/index.d.ts +63 -1
- package/comparators/address.d.ts +0 -8
- package/comparators/personal-address.d.ts +0 -8
- package/comparators/public_api.d.ts +0 -2
- package/driver/errors/country-not-found.d.ts +0 -6
- package/driver/errors/invalid-api-response.d.ts +0 -6
- package/driver/errors/public_api.d.ts +0 -2
- package/driver/in-memory/backend/geography.service.d.ts +0 -32
- package/driver/in-memory/collection-name.const.d.ts +0 -1
- package/driver/in-memory/drivers/geography-driver.module.d.ts +0 -9
- package/driver/in-memory/drivers/geography.service.d.ts +0 -18
- package/driver/in-memory/drivers/public_api.d.ts +0 -2
- package/driver/in-memory/public_api.d.ts +0 -2
- package/driver/interfaces/geography-service.interface.d.ts +0 -13
- package/driver/magento/errors/codes.d.ts +0 -3
- package/driver/magento/errors/map.d.ts +0 -2
- package/driver/magento/errors/transform.d.ts +0 -1
- package/driver/magento/geography-driver.module.d.ts +0 -9
- package/driver/magento/geography.service.d.ts +0 -20
- package/driver/magento/models/responses/country.d.ts +0 -10
- package/driver/magento/models/responses/public_api.d.ts +0 -2
- package/driver/magento/models/responses/region.d.ts +0 -6
- package/driver/magento/public_api.d.ts +0 -6
- package/driver/magento/queries/fragments/country.d.ts +0 -1
- package/driver/magento/queries/fragments/public_api.d.ts +0 -2
- package/driver/magento/queries/fragments/region.d.ts +0 -1
- package/driver/magento/queries/get-countries.d.ts +0 -2
- package/driver/magento/queries/get-country.d.ts +0 -2
- package/driver/magento/queries/public_api.d.ts +0 -4
- package/driver/magento/queries/responses/get-countries.d.ts +0 -4
- package/driver/magento/queries/responses/get-country.d.ts +0 -4
- package/driver/magento/queries/responses/public_api.d.ts +0 -2
- package/driver/magento/transforms/responses/country.service.d.ts +0 -18
- package/driver/magento/transforms/responses/subdivision.service.d.ts +0 -14
- package/driver/magento/validators/get-countries.d.ts +0 -3
- package/driver/magento/validators/public_api.d.ts +0 -1
- package/driver/public_api.d.ts +0 -2
- package/driver/testing/drivers/geography-driver.module.d.ts +0 -9
- package/driver/testing/drivers/geography.service.d.ts +0 -17
- package/driver/testing/drivers/public_api.d.ts +0 -2
- package/driver/testing/public_api.d.ts +0 -1
- package/models/address.d.ts +0 -18
- package/models/country.d.ts +0 -18
- package/models/personal-address.d.ts +0 -14
- package/models/public_api.d.ts +0 -4
- package/models/subdivision.d.ts +0 -9
- package/public_api.d.ts +0 -2
- package/state/actions/geography.actions.d.ts +0 -40
- package/state/actions/public_api.d.ts +0 -1
- package/state/effects/geography.effects.d.ts +0 -16
- package/state/facades/geography/geography-facade.interface.d.ts +0 -16
- package/state/facades/geography/geography.facade.d.ts +0 -30
- package/state/geography-state.module.d.ts +0 -8
- package/state/injection-tokens/error-matcher.token.d.ts +0 -6
- package/state/injection-tokens/public_api.d.ts +0 -1
- package/state/public_api.d.ts +0 -7
- package/state/reducers/country-entities/country-entities-adapter.d.ts +0 -6
- package/state/reducers/country-entities/country-entities-initial-state.d.ts +0 -5
- package/state/reducers/country-entities/country-entities-state.interface.d.ts +0 -6
- package/state/reducers/country-entities/country-entities.reducer.d.ts +0 -7
- package/state/reducers/country-entities/public_api.d.ts +0 -4
- package/state/reducers/geography/geography-initial-state.d.ts +0 -2
- package/state/reducers/geography/geography-state.interface.d.ts +0 -5
- package/state/reducers/geography/geography.reducer.d.ts +0 -4
- package/state/reducers/geography/public_api.d.ts +0 -3
- package/state/reducers/geography-reducers-state.interface.d.ts +0 -11
- package/state/reducers/geography-reducers.d.ts +0 -3
- package/state/reducers/geography-store-feature-key.d.ts +0 -1
- package/state/reducers/public_api.d.ts +0 -5
- package/state/selectors/country-entities.selector.d.ts +0 -16
- package/state/selectors/geography-all.selector.d.ts +0 -7
- package/state/selectors/geography-feature.selector.d.ts +0 -8
- package/state/selectors/geography.selector.d.ts +0 -11
- package/state/selectors/public_api.d.ts +0 -1
- package/state/testing/geography-testing.module.d.ts +0 -6
- package/state/testing/mock-geography-facade.d.ts +0 -24
- package/state/testing/public_api.d.ts +0 -2
- package/testing/factories/address.factory.d.ts +0 -17
- package/testing/factories/country.factory.d.ts +0 -19
- package/testing/factories/personal-address.factory.d.ts +0 -18
- package/testing/factories/public_api.d.ts +0 -4
- package/testing/factories/subdivision.factory.d.ts +0 -13
- package/testing/public_api.d.ts +0 -1
|
@@ -1 +1,59 @@
|
|
|
1
|
-
|
|
1
|
+
import * as i0 from '@angular/core';
|
|
2
|
+
import { ModuleWithProviders } from '@angular/core';
|
|
3
|
+
import * as i1 from '@angular/common';
|
|
4
|
+
import { HttpClient } from '@angular/common/http';
|
|
5
|
+
import { InMemoryBackendConfig, InMemoryDbService, RequestInfo } from 'angular-in-memory-web-api';
|
|
6
|
+
import { Observable } from 'rxjs';
|
|
7
|
+
import { DaffInMemoryDriverBase, DaffInMemorySingleRouteableBackend } from '@daffodil/driver/in-memory';
|
|
8
|
+
import { DaffCountry } from '@daffodil/geography';
|
|
9
|
+
import { DaffGeographyServiceInterface } from '@daffodil/geography/driver';
|
|
10
|
+
import { DaffCountryFactory, DaffSubdivisionFactory } from '@daffodil/geography/testing';
|
|
11
|
+
|
|
12
|
+
declare class DaffGeographyInMemoryDriverModule {
|
|
13
|
+
static forRoot(): ModuleWithProviders<DaffGeographyInMemoryDriverModule>;
|
|
14
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<DaffGeographyInMemoryDriverModule, never>;
|
|
15
|
+
static ɵmod: i0.ɵɵNgModuleDeclaration<DaffGeographyInMemoryDriverModule, never, [typeof i1.CommonModule], never>;
|
|
16
|
+
static ɵinj: i0.ɵɵInjectorDeclaration<DaffGeographyInMemoryDriverModule>;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* @inheritdoc
|
|
21
|
+
*/
|
|
22
|
+
declare class DaffInMemoryGeographyService extends DaffInMemoryDriverBase implements DaffGeographyServiceInterface<DaffCountry> {
|
|
23
|
+
private http;
|
|
24
|
+
constructor(http: HttpClient, config: InMemoryBackendConfig);
|
|
25
|
+
get(countryId: DaffCountry['id']): Observable<DaffCountry>;
|
|
26
|
+
list(): Observable<DaffCountry[]>;
|
|
27
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<DaffInMemoryGeographyService, never>;
|
|
28
|
+
static ɵprov: i0.ɵɵInjectableDeclaration<DaffInMemoryGeographyService>;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* An in-memory service that stubs out the backend services for getting countries.
|
|
33
|
+
*
|
|
34
|
+
* @inheritdoc
|
|
35
|
+
*/
|
|
36
|
+
declare class DaffInMemoryBackendGeographyService implements InMemoryDbService, DaffInMemorySingleRouteableBackend {
|
|
37
|
+
private countryFactory;
|
|
38
|
+
private subdivisionFactory;
|
|
39
|
+
readonly collectionName = "countries";
|
|
40
|
+
countries: DaffCountry[];
|
|
41
|
+
constructor(countryFactory: DaffCountryFactory, subdivisionFactory: DaffSubdivisionFactory);
|
|
42
|
+
/**
|
|
43
|
+
* Creates a fake database of countries for the geography inmemory backend service.
|
|
44
|
+
*
|
|
45
|
+
* @docs-private
|
|
46
|
+
* @returns A fake database of an array of countries
|
|
47
|
+
*/
|
|
48
|
+
createDb(reqInfo: RequestInfo): any;
|
|
49
|
+
/**
|
|
50
|
+
* Responds to GET requests.
|
|
51
|
+
*/
|
|
52
|
+
get(reqInfo: RequestInfo): any;
|
|
53
|
+
private getCountry;
|
|
54
|
+
private listCountries;
|
|
55
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<DaffInMemoryBackendGeographyService, never>;
|
|
56
|
+
static ɵprov: i0.ɵɵInjectableDeclaration<DaffInMemoryBackendGeographyService>;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
export { DaffGeographyInMemoryDriverModule, DaffInMemoryBackendGeographyService, DaffInMemoryGeographyService };
|
package/driver/index.d.ts
CHANGED
|
@@ -1 +1,32 @@
|
|
|
1
|
-
|
|
1
|
+
import { DaffInheritableError, DaffError } from '@daffodil/core';
|
|
2
|
+
import * as _angular_core from '@angular/core';
|
|
3
|
+
import { Observable } from 'rxjs';
|
|
4
|
+
import { DaffCountry } from '@daffodil/geography';
|
|
5
|
+
|
|
6
|
+
declare class DaffCountryNotFoundError extends DaffInheritableError implements DaffError {
|
|
7
|
+
message: string;
|
|
8
|
+
readonly code: string;
|
|
9
|
+
constructor(message: string);
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
declare class DaffGeographyInvalidAPIResponseError extends DaffInheritableError implements DaffError {
|
|
13
|
+
message: string;
|
|
14
|
+
readonly code: string;
|
|
15
|
+
constructor(message: string);
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
declare const DaffGeographyDriver: _angular_core.InjectionToken<DaffGeographyServiceInterface<DaffCountry>>;
|
|
19
|
+
declare const provideDaffGeographyDriver: <R extends DaffGeographyServiceInterface<DaffCountry> = DaffGeographyServiceInterface<DaffCountry>>(klass: _angular_core.Type<R>) => _angular_core.ExistingProvider;
|
|
20
|
+
interface DaffGeographyServiceInterface<T extends DaffCountry = DaffCountry> {
|
|
21
|
+
/**
|
|
22
|
+
* Retrieves the list of countries available to the given store.
|
|
23
|
+
*/
|
|
24
|
+
list(): Observable<T[]>;
|
|
25
|
+
/**
|
|
26
|
+
* Retrieve precise information about a specific country.
|
|
27
|
+
*/
|
|
28
|
+
get(id: T['id']): Observable<T>;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
export { DaffCountryNotFoundError, DaffGeographyDriver, DaffGeographyInvalidAPIResponseError, provideDaffGeographyDriver };
|
|
32
|
+
export type { DaffGeographyServiceInterface };
|
|
@@ -1 +1,95 @@
|
|
|
1
|
-
|
|
1
|
+
import { DaffSubdivision, DaffCountry } from '@daffodil/geography';
|
|
2
|
+
import * as i0 from '@angular/core';
|
|
3
|
+
import { ModuleWithProviders } from '@angular/core';
|
|
4
|
+
import * as apollo_angular from 'apollo-angular';
|
|
5
|
+
import { Apollo } from 'apollo-angular';
|
|
6
|
+
import { Observable } from 'rxjs';
|
|
7
|
+
import { DaffGeographyServiceInterface } from '@daffodil/geography/driver';
|
|
8
|
+
import * as i1 from '@angular/common';
|
|
9
|
+
|
|
10
|
+
interface MagentoRegion {
|
|
11
|
+
__typename?: 'Region';
|
|
12
|
+
id: number;
|
|
13
|
+
code: string;
|
|
14
|
+
name: string;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* Transforms magento carts into an object usable by daffodil.
|
|
19
|
+
*/
|
|
20
|
+
declare class DaffMagentoSubdivisionTransformer {
|
|
21
|
+
/**
|
|
22
|
+
* Transforms the MagentoRegion from the magento region query into a DaffSubdivision.
|
|
23
|
+
*/
|
|
24
|
+
transform(region: MagentoRegion): DaffSubdivision;
|
|
25
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<DaffMagentoSubdivisionTransformer, never>;
|
|
26
|
+
static ɵprov: i0.ɵɵInjectableDeclaration<DaffMagentoSubdivisionTransformer>;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
interface MagentoCountry {
|
|
30
|
+
__typename?: 'Country';
|
|
31
|
+
id: string;
|
|
32
|
+
available_regions?: MagentoRegion[];
|
|
33
|
+
full_name_english: string;
|
|
34
|
+
full_name_locale: string;
|
|
35
|
+
three_letter_abbreviation: string;
|
|
36
|
+
two_letter_abbreviation: string;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* Transforms magento carts into an object usable by daffodil.
|
|
41
|
+
*/
|
|
42
|
+
declare class DaffMagentoCountryTransformer {
|
|
43
|
+
subdivisionTransformer: DaffMagentoSubdivisionTransformer;
|
|
44
|
+
constructor(subdivisionTransformer: DaffMagentoSubdivisionTransformer);
|
|
45
|
+
private transformSubdivisions;
|
|
46
|
+
/**
|
|
47
|
+
* Transforms the MagentoCountry from the magento country query into a DaffCountry.
|
|
48
|
+
*/
|
|
49
|
+
transform(country: MagentoCountry): DaffCountry;
|
|
50
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<DaffMagentoCountryTransformer, never>;
|
|
51
|
+
static ɵprov: i0.ɵɵInjectableDeclaration<DaffMagentoCountryTransformer>;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
declare const countryFragment: apollo_angular.TypedDocumentNode<unknown, unknown>;
|
|
55
|
+
|
|
56
|
+
declare const regionFragment: apollo_angular.TypedDocumentNode<unknown, unknown>;
|
|
57
|
+
|
|
58
|
+
interface MagentoGetCountriesResponse {
|
|
59
|
+
countries: MagentoCountry[];
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
interface MagentoGetCountryResponse {
|
|
63
|
+
country: MagentoCountry;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
declare const MAGENTO_GET_COUNTRIES_QUERY_NAME = "MagentoGetCountries";
|
|
67
|
+
declare const getCountries: apollo_angular.TypedDocumentNode<unknown, unknown>;
|
|
68
|
+
|
|
69
|
+
declare const MAGENTO_GET_COUNTRY_QUERY_NAME = "MagentoGetCountry";
|
|
70
|
+
declare const getCountry: apollo_angular.TypedDocumentNode<unknown, unknown>;
|
|
71
|
+
|
|
72
|
+
/**
|
|
73
|
+
* A service for making Magento GraphQL queries for carts.
|
|
74
|
+
*
|
|
75
|
+
* @inheritdoc
|
|
76
|
+
*/
|
|
77
|
+
declare class DaffGeographyMagentoService implements DaffGeographyServiceInterface<DaffCountry> {
|
|
78
|
+
private apollo;
|
|
79
|
+
countryTransformer: DaffMagentoCountryTransformer;
|
|
80
|
+
constructor(apollo: Apollo, countryTransformer: DaffMagentoCountryTransformer);
|
|
81
|
+
list(): Observable<DaffCountry[]>;
|
|
82
|
+
get(countryId: DaffCountry['id']): Observable<DaffCountry>;
|
|
83
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<DaffGeographyMagentoService, never>;
|
|
84
|
+
static ɵprov: i0.ɵɵInjectableDeclaration<DaffGeographyMagentoService>;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
declare class DaffGeographyMagentoDriverModule {
|
|
88
|
+
static forRoot(): ModuleWithProviders<DaffGeographyMagentoDriverModule>;
|
|
89
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<DaffGeographyMagentoDriverModule, never>;
|
|
90
|
+
static ɵmod: i0.ɵɵNgModuleDeclaration<DaffGeographyMagentoDriverModule, never, [typeof i1.CommonModule], never>;
|
|
91
|
+
static ɵinj: i0.ɵɵInjectorDeclaration<DaffGeographyMagentoDriverModule>;
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
export { DaffGeographyMagentoDriverModule, DaffGeographyMagentoService, DaffMagentoCountryTransformer, DaffMagentoSubdivisionTransformer, MAGENTO_GET_COUNTRIES_QUERY_NAME, MAGENTO_GET_COUNTRY_QUERY_NAME, countryFragment, getCountries, getCountry, regionFragment };
|
|
95
|
+
export type { MagentoCountry, MagentoGetCountriesResponse, MagentoGetCountryResponse, MagentoRegion };
|
|
@@ -1 +1,29 @@
|
|
|
1
|
-
|
|
1
|
+
import * as i0 from '@angular/core';
|
|
2
|
+
import { ModuleWithProviders } from '@angular/core';
|
|
3
|
+
import * as i1 from '@angular/common';
|
|
4
|
+
import { Observable } from 'rxjs';
|
|
5
|
+
import { DaffCountry } from '@daffodil/geography';
|
|
6
|
+
import { DaffGeographyServiceInterface } from '@daffodil/geography/driver';
|
|
7
|
+
import { DaffCountryFactory, DaffSubdivisionFactory } from '@daffodil/geography/testing';
|
|
8
|
+
|
|
9
|
+
declare class DaffGeographyTestingDriverModule {
|
|
10
|
+
static forRoot(): ModuleWithProviders<DaffGeographyTestingDriverModule>;
|
|
11
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<DaffGeographyTestingDriverModule, never>;
|
|
12
|
+
static ɵmod: i0.ɵɵNgModuleDeclaration<DaffGeographyTestingDriverModule, never, [typeof i1.CommonModule], never>;
|
|
13
|
+
static ɵinj: i0.ɵɵInjectorDeclaration<DaffGeographyTestingDriverModule>;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* @inheritdoc
|
|
18
|
+
*/
|
|
19
|
+
declare class DaffTestingGeographyService implements DaffGeographyServiceInterface<DaffCountry> {
|
|
20
|
+
private countryFactory;
|
|
21
|
+
private subdivisionFactory;
|
|
22
|
+
constructor(countryFactory: DaffCountryFactory, subdivisionFactory: DaffSubdivisionFactory);
|
|
23
|
+
get(countryId: DaffCountry['id']): Observable<DaffCountry>;
|
|
24
|
+
list(): Observable<DaffCountry[]>;
|
|
25
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<DaffTestingGeographyService, never>;
|
|
26
|
+
static ɵprov: i0.ɵɵInjectableDeclaration<DaffTestingGeographyService>;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
export { DaffGeographyTestingDriverModule, DaffTestingGeographyService };
|
|
@@ -26,10 +26,10 @@ class DaffInMemoryGeographyService extends DaffInMemoryDriverBase {
|
|
|
26
26
|
list() {
|
|
27
27
|
return this.http.get(`${this.url}/`);
|
|
28
28
|
}
|
|
29
|
-
/** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
30
|
-
/** @nocollapse */ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "
|
|
29
|
+
/** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.1", ngImport: i0, type: DaffInMemoryGeographyService, deps: [{ token: i1.HttpClient }, { token: i2.InMemoryBackendConfig }], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
30
|
+
/** @nocollapse */ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.3.1", ngImport: i0, type: DaffInMemoryGeographyService, providedIn: 'root' }); }
|
|
31
31
|
}
|
|
32
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
32
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.1", ngImport: i0, type: DaffInMemoryGeographyService, decorators: [{
|
|
33
33
|
type: Injectable,
|
|
34
34
|
args: [{
|
|
35
35
|
providedIn: 'root',
|
|
@@ -81,10 +81,10 @@ class DaffInMemoryBackendGeographyService {
|
|
|
81
81
|
listCountries(reqInfo) {
|
|
82
82
|
return this.countries;
|
|
83
83
|
}
|
|
84
|
-
/** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
85
|
-
/** @nocollapse */ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "
|
|
84
|
+
/** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.1", ngImport: i0, type: DaffInMemoryBackendGeographyService, deps: [{ token: i1$1.DaffCountryFactory }, { token: i1$1.DaffSubdivisionFactory }], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
85
|
+
/** @nocollapse */ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.3.1", ngImport: i0, type: DaffInMemoryBackendGeographyService, providedIn: 'root' }); }
|
|
86
86
|
}
|
|
87
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
87
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.1", ngImport: i0, type: DaffInMemoryBackendGeographyService, decorators: [{
|
|
88
88
|
type: Injectable,
|
|
89
89
|
args: [{
|
|
90
90
|
providedIn: 'root',
|
|
@@ -101,11 +101,11 @@ class DaffGeographyInMemoryDriverModule {
|
|
|
101
101
|
],
|
|
102
102
|
};
|
|
103
103
|
}
|
|
104
|
-
/** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
105
|
-
/** @nocollapse */ static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "
|
|
106
|
-
/** @nocollapse */ static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "
|
|
104
|
+
/** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.1", ngImport: i0, type: DaffGeographyInMemoryDriverModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
|
|
105
|
+
/** @nocollapse */ static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "20.3.1", ngImport: i0, type: DaffGeographyInMemoryDriverModule, imports: [CommonModule] }); }
|
|
106
|
+
/** @nocollapse */ static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "20.3.1", ngImport: i0, type: DaffGeographyInMemoryDriverModule, imports: [CommonModule] }); }
|
|
107
107
|
}
|
|
108
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
108
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.1", ngImport: i0, type: DaffGeographyInMemoryDriverModule, decorators: [{
|
|
109
109
|
type: NgModule,
|
|
110
110
|
args: [{
|
|
111
111
|
imports: [
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"daffodil-geography-driver-in-memory.mjs","sources":["../../../libs/geography/driver/in-memory/src/collection-name.const.ts","../../../libs/geography/driver/in-memory/src/drivers/geography.service.ts","../../../libs/geography/driver/in-memory/src/backend/geography.service.ts","../../../libs/geography/driver/in-memory/src/drivers/geography-driver.module.ts","../../../libs/geography/driver/in-memory/src/daffodil-geography-driver-in-memory.ts"],"sourcesContent":["export const DAFF_GEOGRAPHY_IN_MEMORY_COLLECTION_NAME = 'countries';\n","import { HttpClient } from '@angular/common/http';\nimport { Injectable } from '@angular/core';\nimport { InMemoryBackendConfig } from 'angular-in-memory-web-api';\nimport {\n Observable,\n throwError,\n} from 'rxjs';\nimport {\n catchError,\n map,\n} from 'rxjs/operators';\n\nimport { DaffInMemoryDriverBase } from '@daffodil/driver/in-memory';\nimport { DaffCountry } from '@daffodil/geography';\nimport {\n DaffGeographyServiceInterface,\n DaffCountryNotFoundError,\n} from '@daffodil/geography/driver';\n\nimport { DAFF_GEOGRAPHY_IN_MEMORY_COLLECTION_NAME } from '../collection-name.const';\n\n/**\n * @inheritdoc\n */\n@Injectable({\n providedIn: 'root',\n})\nexport class DaffInMemoryGeographyService extends DaffInMemoryDriverBase implements DaffGeographyServiceInterface<DaffCountry> {\n constructor(\n private http: HttpClient,\n config: InMemoryBackendConfig,\n ) {\n super(config, DAFF_GEOGRAPHY_IN_MEMORY_COLLECTION_NAME);\n }\n\n get(countryId: DaffCountry['id']): Observable<DaffCountry> {\n return this.http.get<DaffCountry>(`${this.url}/${countryId}`).pipe(\n catchError((error: Error) => throwError(() => new DaffCountryNotFoundError('Country could not be found'))),\n map(result => result),\n );\n }\n\n list(): Observable<DaffCountry[]> {\n return this.http.get<DaffCountry[]>(`${this.url}/`);\n }\n}\n","import { Injectable } from '@angular/core';\nimport {\n InMemoryDbService,\n RequestInfo,\n STATUS,\n} from 'angular-in-memory-web-api';\n\nimport { DaffInMemorySingleRouteableBackend } from '@daffodil/driver/in-memory';\nimport { DaffCountry } from '@daffodil/geography';\nimport {\n DaffCountryFactory,\n DaffSubdivisionFactory,\n} from '@daffodil/geography/testing';\n\nimport { DAFF_GEOGRAPHY_IN_MEMORY_COLLECTION_NAME } from '../collection-name.const';\n\n/**\n * An in-memory service that stubs out the backend services for getting countries.\n *\n * @inheritdoc\n */\n@Injectable({\n providedIn: 'root',\n})\nexport class DaffInMemoryBackendGeographyService implements InMemoryDbService, DaffInMemorySingleRouteableBackend {\n readonly collectionName = DAFF_GEOGRAPHY_IN_MEMORY_COLLECTION_NAME;\n\n countries: DaffCountry[];\n\n constructor(\n private countryFactory: DaffCountryFactory,\n private subdivisionFactory: DaffSubdivisionFactory,\n ) {\n this.countries = this.countryFactory.createMany(5);\n this.countries.forEach(country => country.subdivisions = this.subdivisionFactory.createMany(5));\n }\n\n /**\n * Creates a fake database of countries for the geography inmemory backend service.\n *\n * @docs-private\n * @returns A fake database of an array of countries\n */\n createDb(reqInfo: RequestInfo): any {\n if (reqInfo) {\n const seedData = reqInfo.utils.getJsonBody(reqInfo.req).countries;\n if (seedData) {\n this.countries = seedData;\n }\n }\n\n return {\n countries: this.countries,\n };\n }\n\n /**\n * Responds to GET requests.\n */\n get(reqInfo: RequestInfo): any {\n return reqInfo.utils.createResponse$(() => ({\n body: reqInfo.id ? this.getCountry(reqInfo) : this.listCountries(reqInfo),\n status: STATUS.OK,\n }));\n }\n\n private getCountry(reqInfo: RequestInfo) {\n return this.countries.find(country => country.id === reqInfo.id);\n }\n\n private listCountries(reqInfo: RequestInfo) {\n return this.countries;\n }\n}\n","import { CommonModule } from '@angular/common';\nimport {\n NgModule,\n ModuleWithProviders,\n} from '@angular/core';\n\nimport { provideDaffInMemoryBackends } from '@daffodil/driver/in-memory';\nimport { provideDaffGeographyDriver } from '@daffodil/geography/driver';\n\nimport { DaffInMemoryGeographyService } from './geography.service';\nimport { DaffInMemoryBackendGeographyService } from '../backend/geography.service';\n\n@NgModule({\n imports: [\n CommonModule,\n ],\n})\nexport class DaffGeographyInMemoryDriverModule {\n static forRoot(): ModuleWithProviders<DaffGeographyInMemoryDriverModule> {\n return {\n ngModule: DaffGeographyInMemoryDriverModule,\n providers: [\n provideDaffGeographyDriver(DaffInMemoryGeographyService),\n provideDaffInMemoryBackends(DaffInMemoryBackendGeographyService),\n ],\n };\n }\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":["i1"],"mappings":";;;;;;;;;;;;AAAO,MAAM,wCAAwC,GAAG,WAAW;;ACqBnE;;AAEG;AAIG,MAAO,4BAA6B,SAAQ,sBAAsB,CAAA;IACtE,
|
|
1
|
+
{"version":3,"file":"daffodil-geography-driver-in-memory.mjs","sources":["../../../libs/geography/driver/in-memory/src/collection-name.const.ts","../../../libs/geography/driver/in-memory/src/drivers/geography.service.ts","../../../libs/geography/driver/in-memory/src/backend/geography.service.ts","../../../libs/geography/driver/in-memory/src/drivers/geography-driver.module.ts","../../../libs/geography/driver/in-memory/src/daffodil-geography-driver-in-memory.ts"],"sourcesContent":["export const DAFF_GEOGRAPHY_IN_MEMORY_COLLECTION_NAME = 'countries';\n","import { HttpClient } from '@angular/common/http';\nimport { Injectable } from '@angular/core';\nimport { InMemoryBackendConfig } from 'angular-in-memory-web-api';\nimport {\n Observable,\n throwError,\n} from 'rxjs';\nimport {\n catchError,\n map,\n} from 'rxjs/operators';\n\nimport { DaffInMemoryDriverBase } from '@daffodil/driver/in-memory';\nimport { DaffCountry } from '@daffodil/geography';\nimport {\n DaffGeographyServiceInterface,\n DaffCountryNotFoundError,\n} from '@daffodil/geography/driver';\n\nimport { DAFF_GEOGRAPHY_IN_MEMORY_COLLECTION_NAME } from '../collection-name.const';\n\n/**\n * @inheritdoc\n */\n@Injectable({\n providedIn: 'root',\n})\nexport class DaffInMemoryGeographyService extends DaffInMemoryDriverBase implements DaffGeographyServiceInterface<DaffCountry> {\n constructor(\n private http: HttpClient,\n config: InMemoryBackendConfig,\n ) {\n super(config, DAFF_GEOGRAPHY_IN_MEMORY_COLLECTION_NAME);\n }\n\n get(countryId: DaffCountry['id']): Observable<DaffCountry> {\n return this.http.get<DaffCountry>(`${this.url}/${countryId}`).pipe(\n catchError((error: Error) => throwError(() => new DaffCountryNotFoundError('Country could not be found'))),\n map(result => result),\n );\n }\n\n list(): Observable<DaffCountry[]> {\n return this.http.get<DaffCountry[]>(`${this.url}/`);\n }\n}\n","import { Injectable } from '@angular/core';\nimport {\n InMemoryDbService,\n RequestInfo,\n STATUS,\n} from 'angular-in-memory-web-api';\n\nimport { DaffInMemorySingleRouteableBackend } from '@daffodil/driver/in-memory';\nimport { DaffCountry } from '@daffodil/geography';\nimport {\n DaffCountryFactory,\n DaffSubdivisionFactory,\n} from '@daffodil/geography/testing';\n\nimport { DAFF_GEOGRAPHY_IN_MEMORY_COLLECTION_NAME } from '../collection-name.const';\n\n/**\n * An in-memory service that stubs out the backend services for getting countries.\n *\n * @inheritdoc\n */\n@Injectable({\n providedIn: 'root',\n})\nexport class DaffInMemoryBackendGeographyService implements InMemoryDbService, DaffInMemorySingleRouteableBackend {\n readonly collectionName = DAFF_GEOGRAPHY_IN_MEMORY_COLLECTION_NAME;\n\n countries: DaffCountry[];\n\n constructor(\n private countryFactory: DaffCountryFactory,\n private subdivisionFactory: DaffSubdivisionFactory,\n ) {\n this.countries = this.countryFactory.createMany(5);\n this.countries.forEach(country => country.subdivisions = this.subdivisionFactory.createMany(5));\n }\n\n /**\n * Creates a fake database of countries for the geography inmemory backend service.\n *\n * @docs-private\n * @returns A fake database of an array of countries\n */\n createDb(reqInfo: RequestInfo): any {\n if (reqInfo) {\n const seedData = reqInfo.utils.getJsonBody(reqInfo.req).countries;\n if (seedData) {\n this.countries = seedData;\n }\n }\n\n return {\n countries: this.countries,\n };\n }\n\n /**\n * Responds to GET requests.\n */\n get(reqInfo: RequestInfo): any {\n return reqInfo.utils.createResponse$(() => ({\n body: reqInfo.id ? this.getCountry(reqInfo) : this.listCountries(reqInfo),\n status: STATUS.OK,\n }));\n }\n\n private getCountry(reqInfo: RequestInfo) {\n return this.countries.find(country => country.id === reqInfo.id);\n }\n\n private listCountries(reqInfo: RequestInfo) {\n return this.countries;\n }\n}\n","import { CommonModule } from '@angular/common';\nimport {\n NgModule,\n ModuleWithProviders,\n} from '@angular/core';\n\nimport { provideDaffInMemoryBackends } from '@daffodil/driver/in-memory';\nimport { provideDaffGeographyDriver } from '@daffodil/geography/driver';\n\nimport { DaffInMemoryGeographyService } from './geography.service';\nimport { DaffInMemoryBackendGeographyService } from '../backend/geography.service';\n\n@NgModule({\n imports: [\n CommonModule,\n ],\n})\nexport class DaffGeographyInMemoryDriverModule {\n static forRoot(): ModuleWithProviders<DaffGeographyInMemoryDriverModule> {\n return {\n ngModule: DaffGeographyInMemoryDriverModule,\n providers: [\n provideDaffGeographyDriver(DaffInMemoryGeographyService),\n provideDaffInMemoryBackends(DaffInMemoryBackendGeographyService),\n ],\n };\n }\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":["i1"],"mappings":";;;;;;;;;;;;AAAO,MAAM,wCAAwC,GAAG,WAAW;;ACqBnE;;AAEG;AAIG,MAAO,4BAA6B,SAAQ,sBAAsB,CAAA;IACtE,WAAA,CACU,IAAgB,EACxB,MAA6B,EAAA;AAE7B,QAAA,KAAK,CAAC,MAAM,EAAE,wCAAwC,CAAC;QAH/C,IAAA,CAAA,IAAI,GAAJ,IAAI;IAId;AAEA,IAAA,GAAG,CAAC,SAA4B,EAAA;QAC9B,OAAO,IAAI,CAAC,IAAI,CAAC,GAAG,CAAc,CAAA,EAAG,IAAI,CAAC,GAAG,IAAI,SAAS,CAAA,CAAE,CAAC,CAAC,IAAI,CAChE,UAAU,CAAC,CAAC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A,CAAA;;2FAEP,mCAAmC,EAAA,UAAA,EAAA,CAAA;kBAH/C,UAAU;AAAC,YAAA,IAAA,EAAA,CAAA;AACV,oBAAA,UAAU,EAAE,MAAM;AACnB,iBAAA;;;MCNY,iCAAiC,CAAA;AAC5C,IAAA,OAAO,OAAO,GAAA;QACZ,OAAO;AACL,YAAA,QAAQ,EAAE,iCAAiC;AAC3C,YAAA,SAAS,EAAE;gBACT,0BAA0B,CAAC,4BAA4B,CAAC;gBACxD,2BAA2B,CAAC,mCAAmC,CAAC;AACjE,aAAA;SACF;IACH;iIATW,iCAAiC,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,QAAA,EAAA,CAAA,CAAA;AAAjC,uBAAA,SAAA,IAAA,CAAA,IAAA,GAAA,EAAA,CAAA,mBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,QAAA,EAAA,QAAA,EAAA,EAAA,EAAA,IAAA,EAAA,iCAAiC,YAH1C,YAAY,CAAA,EAAA,CAAA,CAAA;AAGH,uBAAA,SAAA,IAAA,CAAA,IAAA,GAAA,EAAA,CAAA,mBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,QAAA,EAAA,QAAA,EAAA,EAAA,EAAA,IAAA,EAAA,iCAAiC,YAH1C,YAAY,CAAA,EAAA,CAAA,CAAA;;2FAGH,iCAAiC,EAAA,UAAA,EAAA,CAAA;kBAL7C,QAAQ;AAAC,YAAA,IAAA,EAAA,CAAA;AACR,oBAAA,OAAO,EAAE;wBACP,YAAY;AACb,qBAAA;AACF,iBAAA;;;AChBD;;AAEG;;;;"}
|
|
@@ -23,10 +23,10 @@ class DaffMagentoSubdivisionTransformer {
|
|
|
23
23
|
iso_3166_2: region.code,
|
|
24
24
|
} : null;
|
|
25
25
|
}
|
|
26
|
-
/** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
27
|
-
/** @nocollapse */ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "
|
|
26
|
+
/** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.1", ngImport: i0, type: DaffMagentoSubdivisionTransformer, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
27
|
+
/** @nocollapse */ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.3.1", ngImport: i0, type: DaffMagentoSubdivisionTransformer, providedIn: 'root' }); }
|
|
28
28
|
}
|
|
29
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
29
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.1", ngImport: i0, type: DaffMagentoSubdivisionTransformer, decorators: [{
|
|
30
30
|
type: Injectable,
|
|
31
31
|
args: [{
|
|
32
32
|
providedIn: 'root',
|
|
@@ -57,10 +57,10 @@ class DaffMagentoCountryTransformer {
|
|
|
57
57
|
alpha3: country.three_letter_abbreviation,
|
|
58
58
|
} : null;
|
|
59
59
|
}
|
|
60
|
-
/** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
61
|
-
/** @nocollapse */ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "
|
|
60
|
+
/** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.1", ngImport: i0, type: DaffMagentoCountryTransformer, deps: [{ token: DaffMagentoSubdivisionTransformer }], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
61
|
+
/** @nocollapse */ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.3.1", ngImport: i0, type: DaffMagentoCountryTransformer, providedIn: 'root' }); }
|
|
62
62
|
}
|
|
63
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
63
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.1", ngImport: i0, type: DaffMagentoCountryTransformer, decorators: [{
|
|
64
64
|
type: Injectable,
|
|
65
65
|
args: [{
|
|
66
66
|
providedIn: 'root',
|
|
@@ -154,10 +154,10 @@ class DaffGeographyMagentoService {
|
|
|
154
154
|
},
|
|
155
155
|
}).pipe(map(result => this.countryTransformer.transform(result.data.country)), catchError(err => throwError(() => transformMagentoGeographyError(err))));
|
|
156
156
|
}
|
|
157
|
-
/** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
158
|
-
/** @nocollapse */ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "
|
|
157
|
+
/** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.1", ngImport: i0, type: DaffGeographyMagentoService, deps: [{ token: i1.Apollo }, { token: DaffMagentoCountryTransformer }], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
158
|
+
/** @nocollapse */ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.3.1", ngImport: i0, type: DaffGeographyMagentoService, providedIn: 'root' }); }
|
|
159
159
|
}
|
|
160
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
160
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.1", ngImport: i0, type: DaffGeographyMagentoService, decorators: [{
|
|
161
161
|
type: Injectable,
|
|
162
162
|
args: [{
|
|
163
163
|
providedIn: 'root',
|
|
@@ -175,11 +175,11 @@ class DaffGeographyMagentoDriverModule {
|
|
|
175
175
|
],
|
|
176
176
|
};
|
|
177
177
|
}
|
|
178
|
-
/** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
179
|
-
/** @nocollapse */ static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "
|
|
180
|
-
/** @nocollapse */ static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "
|
|
178
|
+
/** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.1", ngImport: i0, type: DaffGeographyMagentoDriverModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
|
|
179
|
+
/** @nocollapse */ static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "20.3.1", ngImport: i0, type: DaffGeographyMagentoDriverModule, imports: [CommonModule] }); }
|
|
180
|
+
/** @nocollapse */ static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "20.3.1", ngImport: i0, type: DaffGeographyMagentoDriverModule, imports: [CommonModule] }); }
|
|
181
181
|
}
|
|
182
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
182
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.1", ngImport: i0, type: DaffGeographyMagentoDriverModule, decorators: [{
|
|
183
183
|
type: NgModule,
|
|
184
184
|
args: [{
|
|
185
185
|
imports: [
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"daffodil-geography-driver-magento.mjs","sources":["../../../libs/geography/driver/magento/src/transforms/responses/subdivision.service.ts","../../../libs/geography/driver/magento/src/transforms/responses/country.service.ts","../../../libs/geography/driver/magento/src/queries/fragments/country.ts","../../../libs/geography/driver/magento/src/queries/fragments/region.ts","../../../libs/geography/driver/magento/src/queries/get-countries.ts","../../../libs/geography/driver/magento/src/queries/get-country.ts","../../../libs/geography/driver/magento/src/errors/codes.ts","../../../libs/geography/driver/magento/src/errors/map.ts","../../../libs/geography/driver/magento/src/errors/transform.ts","../../../libs/geography/driver/magento/src/validators/get-countries.ts","../../../libs/geography/driver/magento/src/geography.service.ts","../../../libs/geography/driver/magento/src/geography-driver.module.ts","../../../libs/geography/driver/magento/src/daffodil-geography-driver-magento.ts"],"sourcesContent":["import { Injectable } from '@angular/core';\n\nimport { DaffSubdivision } from '@daffodil/geography';\n\nimport { MagentoRegion } from '../../models/responses/region';\n\n/**\n * Transforms magento carts into an object usable by daffodil.\n */\n@Injectable({\n providedIn: 'root',\n})\nexport class DaffMagentoSubdivisionTransformer {\n /**\n * Transforms the MagentoRegion from the magento region query into a DaffSubdivision.\n */\n transform(region: MagentoRegion): DaffSubdivision {\n return region ? {\n ...{ magento_region: region },\n\n id: String(region.id),\n name: region.name,\n iso_3166_2: region.code,\n } : null;\n }\n}\n","import { Injectable } from '@angular/core';\n\nimport { DaffCountry } from '@daffodil/geography';\n\nimport { DaffMagentoSubdivisionTransformer } from './subdivision.service';\nimport { MagentoCountry } from '../../models/responses/country';\n\n/**\n * Transforms magento carts into an object usable by daffodil.\n */\n@Injectable({\n providedIn: 'root',\n})\nexport class DaffMagentoCountryTransformer {\n constructor(public subdivisionTransformer: DaffMagentoSubdivisionTransformer) {}\n\n private transformSubdivisions(regions: MagentoCountry['available_regions']): DaffCountry['subdivisions'] {\n return regions.map(region => this.subdivisionTransformer.transform(region));\n }\n\n /**\n * Transforms the MagentoCountry from the magento country query into a DaffCountry.\n */\n transform(country: MagentoCountry): DaffCountry {\n return country ? {\n ...{ magento_country: country },\n\n subdivisions: this.transformSubdivisions(country.available_regions || []),\n\n id: country.id,\n name: country.full_name_locale,\n name_en: country.full_name_english,\n alpha2: country.two_letter_abbreviation,\n alpha3: country.three_letter_abbreviation,\n } : null;\n }\n}\n","import { gql } from 'apollo-angular';\n\n\nexport const countryFragment = gql`\n fragment country on Country {\n id\n full_name_english\n full_name_locale\n three_letter_abbreviation\n two_letter_abbreviation\n }\n`;\n","import { gql } from 'apollo-angular';\n\n\nexport const regionFragment = gql`\n fragment region on Region {\n code\n id\n name\n }\n`;\n","import { gql } from 'apollo-angular';\n\nimport { countryFragment } from './fragments/public_api';\n\nexport const MAGENTO_GET_COUNTRIES_QUERY_NAME = 'MagentoGetCountries';\n\nexport const getCountries = gql`\n query ${MAGENTO_GET_COUNTRIES_QUERY_NAME} {\n countries {\n ...country\n }\n }\n ${countryFragment}\n`;\n","import { gql } from 'apollo-angular';\n\nimport {\n countryFragment,\n regionFragment,\n} from './fragments/public_api';\n\nexport const MAGENTO_GET_COUNTRY_QUERY_NAME = 'MagentoGetCountry';\n\nexport const getCountry = gql`\n query ${MAGENTO_GET_COUNTRY_QUERY_NAME}($countryId: String!) {\n country(id: $countryId) {\n ...country\n available_regions {\n ...region\n }\n }\n }\n ${countryFragment}\n ${regionFragment}\n`;\n","export enum MagentoGeographyGraphQlErrorCode {\n COUNTRY_NOT_FOUND = 'graphql-no-such-entity',\n}\n","import { DaffErrorCodeMap } from '@daffodil/core';\nimport { DaffCountryNotFoundError } from '@daffodil/geography/driver';\n\nimport { MagentoGeographyGraphQlErrorCode } from './codes';\n\nexport const DaffGeographyMagentoErrorMap: DaffErrorCodeMap = {\n [MagentoGeographyGraphQlErrorCode.COUNTRY_NOT_FOUND]: DaffCountryNotFoundError,\n};\n","import { daffTransformMagentoError } from '@daffodil/driver/magento';\n\nimport { DaffGeographyMagentoErrorMap } from './map';\n\nexport function transformMagentoGeographyError(error: any) {\n return daffTransformMagentoError(error, DaffGeographyMagentoErrorMap);\n}\n","import { ApolloQueryResult } from '@apollo/client/core';\n\nimport { DaffGeographyInvalidAPIResponseError } from '@daffodil/geography/driver';\n\nimport { MagentoGetCountriesResponse } from '../queries/public_api';\n\nexport const validateGetCountriesResponse = (response: ApolloQueryResult<MagentoGetCountriesResponse>) => {\n if (response.data.countries) {\n return response;\n } else {\n throw new DaffGeographyInvalidAPIResponseError('Get countries response does not contain a valid list of countries.');\n }\n};\n","import { Injectable } from '@angular/core';\nimport { Apollo } from 'apollo-angular';\nimport {\n Observable,\n throwError,\n} from 'rxjs';\nimport {\n map,\n catchError,\n} from 'rxjs/operators';\n\nimport { DaffCountry } from '@daffodil/geography';\nimport { DaffGeographyServiceInterface } from '@daffodil/geography/driver';\n\nimport { transformMagentoGeographyError } from './errors/transform';\nimport { getCountry } from './queries/get-country';\nimport {\n getCountries,\n MagentoGetCountriesResponse,\n} from './queries/public_api';\nimport { MagentoGetCountryResponse } from './queries/responses/get-country';\nimport { DaffMagentoCountryTransformer } from './transforms/responses/country.service';\nimport { validateGetCountriesResponse } from './validators/public_api';\n\n/**\n * A service for making Magento GraphQL queries for carts.\n *\n * @inheritdoc\n */\n@Injectable({\n providedIn: 'root',\n})\nexport class DaffGeographyMagentoService implements DaffGeographyServiceInterface<DaffCountry> {\n constructor(\n private apollo: Apollo,\n public countryTransformer: DaffMagentoCountryTransformer,\n ) {}\n\n list(): Observable<DaffCountry[]> {\n return this.apollo.query<MagentoGetCountriesResponse>({\n query: getCountries,\n }).pipe(\n map(validateGetCountriesResponse),\n map(result => result.data.countries.map(country => this.countryTransformer.transform(country))),\n catchError(err => throwError(() => transformMagentoGeographyError(err))),\n );\n }\n\n get(countryId: DaffCountry['id']): Observable<DaffCountry> {\n return this.apollo.query<MagentoGetCountryResponse>({\n query: getCountry,\n variables: {\n countryId,\n },\n }).pipe(\n map(result => this.countryTransformer.transform(result.data.country)),\n catchError(err => throwError(() => transformMagentoGeographyError(err))),\n );\n }\n}\n","import { CommonModule } from '@angular/common';\nimport {\n NgModule,\n ModuleWithProviders,\n} from '@angular/core';\n\nimport { provideDaffMagentoCacheableOperation } from '@daffodil/driver/magento';\nimport { provideDaffGeographyDriver } from '@daffodil/geography/driver';\n\nimport { DaffGeographyMagentoService } from './geography.service';\nimport {\n MAGENTO_GET_COUNTRIES_QUERY_NAME,\n MAGENTO_GET_COUNTRY_QUERY_NAME,\n} from './queries/public_api';\n\n@NgModule({\n imports: [\n CommonModule,\n ],\n})\nexport class DaffGeographyMagentoDriverModule {\n static forRoot(): ModuleWithProviders<DaffGeographyMagentoDriverModule> {\n return {\n ngModule: DaffGeographyMagentoDriverModule,\n providers: [\n provideDaffGeographyDriver(DaffGeographyMagentoService),\n provideDaffMagentoCacheableOperation(MAGENTO_GET_COUNTRY_QUERY_NAME),\n provideDaffMagentoCacheableOperation(MAGENTO_GET_COUNTRIES_QUERY_NAME),\n ],\n };\n }\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":["i1.DaffMagentoSubdivisionTransformer","i2.DaffMagentoCountryTransformer"],"mappings":";;;;;;;;;;AAMA;;AAEG;MAIU,iCAAiC,CAAA;AAC5C;;AAEG;AACH,IAAA,SAAS,CAAC,MAAqB,EAAA;QAC7B,OAAO,MAAM,GAAG;AACd,YAAA,GAAG,EAAE,cAAc,EAAE,MAAM,EAAE;AAE7B,YAAA,EAAE,EAAE,MAAM,CAAC,MAAM,CAAC,EAAE,CAAC;YACrB,IAAI,EAAE,MAAM,CAAC,IAAI;YACjB,UAAU,EAAE,MAAM,CAAC,IAAI;SACxB,GAAG,IAAI;;kIAXC,iCAAiC,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,UAAA,EAAA,CAAA,CAAA;AAAjC,uBAAA,SAAA,IAAA,CAAA,KAAA,GAAA,EAAA,CAAA,qBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,SAAA,EAAA,QAAA,EAAA,EAAA,EAAA,IAAA,EAAA,iCAAiC,cAFhC,MAAM,EAAA,CAAA,CAAA;;4FAEP,iCAAiC,EAAA,UAAA,EAAA,CAAA;kBAH7C,UAAU;AAAC,YAAA,IAAA,EAAA,CAAA;AACV,oBAAA,UAAU,EAAE,MAAM;AACnB,iBAAA;;;ACJD;;AAEG;MAIU,6BAA6B,CAAA;AACxC,IAAA,WAAA,CAAmB,sBAAyD,EAAA;QAAzD,IAAsB,CAAA,sBAAA,GAAtB,sBAAsB;;AAEjC,IAAA,qBAAqB,CAAC,OAA4C,EAAA;AACxE,QAAA,OAAO,OAAO,CAAC,GAAG,CAAC,MAAM,IAAI,I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uBAAA,SAAA,IAAA,CAAA,IAAA,GAAA,EAAA,CAAA,mBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,SAAA,EAAA,QAAA,EAAA,EAAA,EAAA,IAAA,EAAA,gCAAgC,YAHzC,YAAY,CAAA,EAAA,CAAA,CAAA;AAGH,uBAAA,SAAA,IAAA,CAAA,IAAA,GAAA,EAAA,CAAA,mBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,SAAA,EAAA,QAAA,EAAA,EAAA,EAAA,IAAA,EAAA,gCAAgC,YAHzC,YAAY,CAAA,EAAA,CAAA,CAAA;;4FAGH,gCAAgC,EAAA,UAAA,EAAA,CAAA;kBAL5C,QAAQ;AAAC,YAAA,IAAA,EAAA,CAAA;AACR,oBAAA,OAAO,EAAE;wBACP,YAAY;AACb,qBAAA;AACF,iBAAA;;;ACnBD;;AAEG;;;;"}
|
|
1
|
+
{"version":3,"file":"daffodil-geography-driver-magento.mjs","sources":["../../../libs/geography/driver/magento/src/transforms/responses/subdivision.service.ts","../../../libs/geography/driver/magento/src/transforms/responses/country.service.ts","../../../libs/geography/driver/magento/src/queries/fragments/country.ts","../../../libs/geography/driver/magento/src/queries/fragments/region.ts","../../../libs/geography/driver/magento/src/queries/get-countries.ts","../../../libs/geography/driver/magento/src/queries/get-country.ts","../../../libs/geography/driver/magento/src/errors/codes.ts","../../../libs/geography/driver/magento/src/errors/map.ts","../../../libs/geography/driver/magento/src/errors/transform.ts","../../../libs/geography/driver/magento/src/validators/get-countries.ts","../../../libs/geography/driver/magento/src/geography.service.ts","../../../libs/geography/driver/magento/src/geography-driver.module.ts","../../../libs/geography/driver/magento/src/daffodil-geography-driver-magento.ts"],"sourcesContent":["import { Injectable } from '@angular/core';\n\nimport { DaffSubdivision } from '@daffodil/geography';\n\nimport { MagentoRegion } from '../../models/responses/region';\n\n/**\n * Transforms magento carts into an object usable by daffodil.\n */\n@Injectable({\n providedIn: 'root',\n})\nexport class DaffMagentoSubdivisionTransformer {\n /**\n * Transforms the MagentoRegion from the magento region query into a DaffSubdivision.\n */\n transform(region: MagentoRegion): DaffSubdivision {\n return region ? {\n ...{ magento_region: region },\n\n id: String(region.id),\n name: region.name,\n iso_3166_2: region.code,\n } : null;\n }\n}\n","import { Injectable } from '@angular/core';\n\nimport { DaffCountry } from '@daffodil/geography';\n\nimport { DaffMagentoSubdivisionTransformer } from './subdivision.service';\nimport { MagentoCountry } from '../../models/responses/country';\n\n/**\n * Transforms magento carts into an object usable by daffodil.\n */\n@Injectable({\n providedIn: 'root',\n})\nexport class DaffMagentoCountryTransformer {\n constructor(public subdivisionTransformer: DaffMagentoSubdivisionTransformer) {}\n\n private transformSubdivisions(regions: MagentoCountry['available_regions']): DaffCountry['subdivisions'] {\n return regions.map(region => this.subdivisionTransformer.transform(region));\n }\n\n /**\n * Transforms the MagentoCountry from the magento country query into a DaffCountry.\n */\n transform(country: MagentoCountry): DaffCountry {\n return country ? {\n ...{ magento_country: country },\n\n subdivisions: this.transformSubdivisions(country.available_regions || []),\n\n id: country.id,\n name: country.full_name_locale,\n name_en: country.full_name_english,\n alpha2: country.two_letter_abbreviation,\n alpha3: country.three_letter_abbreviation,\n } : null;\n }\n}\n","import { gql } from 'apollo-angular';\n\n\nexport const countryFragment = gql`\n fragment country on Country {\n id\n full_name_english\n full_name_locale\n three_letter_abbreviation\n two_letter_abbreviation\n }\n`;\n","import { gql } from 'apollo-angular';\n\n\nexport const regionFragment = gql`\n fragment region on Region {\n code\n id\n name\n }\n`;\n","import { gql } from 'apollo-angular';\n\nimport { countryFragment } from './fragments/public_api';\n\nexport const MAGENTO_GET_COUNTRIES_QUERY_NAME = 'MagentoGetCountries';\n\nexport const getCountries = gql`\n query ${MAGENTO_GET_COUNTRIES_QUERY_NAME} {\n countries {\n ...country\n }\n }\n ${countryFragment}\n`;\n","import { gql } from 'apollo-angular';\n\nimport {\n countryFragment,\n regionFragment,\n} from './fragments/public_api';\n\nexport const MAGENTO_GET_COUNTRY_QUERY_NAME = 'MagentoGetCountry';\n\nexport const getCountry = gql`\n query ${MAGENTO_GET_COUNTRY_QUERY_NAME}($countryId: String!) {\n country(id: $countryId) {\n ...country\n available_regions {\n ...region\n }\n }\n }\n ${countryFragment}\n ${regionFragment}\n`;\n","export enum MagentoGeographyGraphQlErrorCode {\n COUNTRY_NOT_FOUND = 'graphql-no-such-entity',\n}\n","import { DaffErrorCodeMap } from '@daffodil/core';\nimport { DaffCountryNotFoundError } from '@daffodil/geography/driver';\n\nimport { MagentoGeographyGraphQlErrorCode } from './codes';\n\nexport const DaffGeographyMagentoErrorMap: DaffErrorCodeMap = {\n [MagentoGeographyGraphQlErrorCode.COUNTRY_NOT_FOUND]: DaffCountryNotFoundError,\n};\n","import { daffTransformMagentoError } from '@daffodil/driver/magento';\n\nimport { DaffGeographyMagentoErrorMap } from './map';\n\nexport function transformMagentoGeographyError(error: any) {\n return daffTransformMagentoError(error, DaffGeographyMagentoErrorMap);\n}\n","import { ApolloQueryResult } from '@apollo/client/core';\n\nimport { DaffGeographyInvalidAPIResponseError } from '@daffodil/geography/driver';\n\nimport { MagentoGetCountriesResponse } from '../queries/public_api';\n\nexport const validateGetCountriesResponse = (response: ApolloQueryResult<MagentoGetCountriesResponse>) => {\n if (response.data.countries) {\n return response;\n } else {\n throw new DaffGeographyInvalidAPIResponseError('Get countries response does not contain a valid list of countries.');\n }\n};\n","import { Injectable } from '@angular/core';\nimport { Apollo } from 'apollo-angular';\nimport {\n Observable,\n throwError,\n} from 'rxjs';\nimport {\n map,\n catchError,\n} from 'rxjs/operators';\n\nimport { DaffCountry } from '@daffodil/geography';\nimport { DaffGeographyServiceInterface } from '@daffodil/geography/driver';\n\nimport { transformMagentoGeographyError } from './errors/transform';\nimport { getCountry } from './queries/get-country';\nimport {\n getCountries,\n MagentoGetCountriesResponse,\n} from './queries/public_api';\nimport { MagentoGetCountryResponse } from './queries/responses/get-country';\nimport { DaffMagentoCountryTransformer } from './transforms/responses/country.service';\nimport { validateGetCountriesResponse } from './validators/public_api';\n\n/**\n * A service for making Magento GraphQL queries for carts.\n *\n * @inheritdoc\n */\n@Injectable({\n providedIn: 'root',\n})\nexport class DaffGeographyMagentoService implements DaffGeographyServiceInterface<DaffCountry> {\n constructor(\n private apollo: Apollo,\n public countryTransformer: DaffMagentoCountryTransformer,\n ) {}\n\n list(): Observable<DaffCountry[]> {\n return this.apollo.query<MagentoGetCountriesResponse>({\n query: getCountries,\n }).pipe(\n map(validateGetCountriesResponse),\n map(result => result.data.countries.map(country => this.countryTransformer.transform(country))),\n catchError(err => throwError(() => transformMagentoGeographyError(err))),\n );\n }\n\n get(countryId: DaffCountry['id']): Observable<DaffCountry> {\n return this.apollo.query<MagentoGetCountryResponse>({\n query: getCountry,\n variables: {\n countryId,\n },\n }).pipe(\n map(result => this.countryTransformer.transform(result.data.country)),\n catchError(err => throwError(() => transformMagentoGeographyError(err))),\n );\n }\n}\n","import { CommonModule } from '@angular/common';\nimport {\n NgModule,\n ModuleWithProviders,\n} from '@angular/core';\n\nimport { provideDaffMagentoCacheableOperation } from '@daffodil/driver/magento';\nimport { provideDaffGeographyDriver } from '@daffodil/geography/driver';\n\nimport { DaffGeographyMagentoService } from './geography.service';\nimport {\n MAGENTO_GET_COUNTRIES_QUERY_NAME,\n MAGENTO_GET_COUNTRY_QUERY_NAME,\n} from './queries/public_api';\n\n@NgModule({\n imports: [\n CommonModule,\n ],\n})\nexport class DaffGeographyMagentoDriverModule {\n static forRoot(): ModuleWithProviders<DaffGeographyMagentoDriverModule> {\n return {\n ngModule: DaffGeographyMagentoDriverModule,\n providers: [\n provideDaffGeographyDriver(DaffGeographyMagentoService),\n provideDaffMagentoCacheableOperation(MAGENTO_GET_COUNTRY_QUERY_NAME),\n provideDaffMagentoCacheableOperation(MAGENTO_GET_COUNTRIES_QUERY_NAME),\n ],\n };\n }\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":["i1.DaffMagentoSubdivisionT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A,CAAA,CAAA;AAGH,uBAAA,SAAA,IAAA,CAAA,IAAA,GAAA,EAAA,CAAA,mBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,QAAA,EAAA,QAAA,EAAA,EAAA,EAAA,IAAA,EAAA,gCAAgC,YAHzC,YAAY,CAAA,EAAA,CAAA,CAAA;;2FAGH,gCAAgC,EAAA,UAAA,EAAA,CAAA;kBAL5C,QAAQ;AAAC,YAAA,IAAA,EAAA,CAAA;AACR,oBAAA,OAAO,EAAE;wBACP,YAAY;AACb,qBAAA;AACF,iBAAA;;;ACnBD;;AAEG;;;;"}
|
|
@@ -22,10 +22,10 @@ class DaffTestingGeographyService {
|
|
|
22
22
|
list() {
|
|
23
23
|
return of(this.countryFactory.createMany(5));
|
|
24
24
|
}
|
|
25
|
-
/** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
26
|
-
/** @nocollapse */ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "
|
|
25
|
+
/** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.1", ngImport: i0, type: DaffTestingGeographyService, deps: [{ token: i1.DaffCountryFactory }, { token: i1.DaffSubdivisionFactory }], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
26
|
+
/** @nocollapse */ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.3.1", ngImport: i0, type: DaffTestingGeographyService, providedIn: 'root' }); }
|
|
27
27
|
}
|
|
28
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
28
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.1", ngImport: i0, type: DaffTestingGeographyService, decorators: [{
|
|
29
29
|
type: Injectable,
|
|
30
30
|
args: [{
|
|
31
31
|
providedIn: 'root',
|
|
@@ -41,11 +41,11 @@ class DaffGeographyTestingDriverModule {
|
|
|
41
41
|
],
|
|
42
42
|
};
|
|
43
43
|
}
|
|
44
|
-
/** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
45
|
-
/** @nocollapse */ static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "
|
|
46
|
-
/** @nocollapse */ static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "
|
|
44
|
+
/** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.1", ngImport: i0, type: DaffGeographyTestingDriverModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
|
|
45
|
+
/** @nocollapse */ static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "20.3.1", ngImport: i0, type: DaffGeographyTestingDriverModule, imports: [CommonModule] }); }
|
|
46
|
+
/** @nocollapse */ static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "20.3.1", ngImport: i0, type: DaffGeographyTestingDriverModule, imports: [CommonModule] }); }
|
|
47
47
|
}
|
|
48
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
48
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.1", ngImport: i0, type: DaffGeographyTestingDriverModule, decorators: [{
|
|
49
49
|
type: NgModule,
|
|
50
50
|
args: [{
|
|
51
51
|
imports: [
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"daffodil-geography-driver-testing.mjs","sources":["../../../libs/geography/driver/testing/src/drivers/geography.service.ts","../../../libs/geography/driver/testing/src/drivers/geography-driver.module.ts","../../../libs/geography/driver/testing/src/daffodil-geography-driver-testing.ts"],"sourcesContent":["import { Injectable } from '@angular/core';\nimport {\n Observable,\n of,\n} from 'rxjs';\n\nimport { DaffCountry } from '@daffodil/geography';\nimport { DaffGeographyServiceInterface } from '@daffodil/geography/driver';\nimport {\n DaffCountryFactory,\n DaffSubdivisionFactory,\n} from '@daffodil/geography/testing';\n\n/**\n * @inheritdoc\n */\n@Injectable({\n providedIn: 'root',\n})\nexport class DaffTestingGeographyService implements DaffGeographyServiceInterface<DaffCountry> {\n\n constructor(\n private countryFactory: DaffCountryFactory,\n private subdivisionFactory: DaffSubdivisionFactory,\n ) {}\n\n get(countryId: DaffCountry['id']): Observable<DaffCountry> {\n return of(this.countryFactory.create({\n id: countryId,\n subdivisions: this.subdivisionFactory.createMany(3),\n }));\n }\n\n list(): Observable<DaffCountry[]> {\n return of(this.countryFactory.createMany(5));\n }\n}\n","import { CommonModule } from '@angular/common';\nimport {\n NgModule,\n ModuleWithProviders,\n} from '@angular/core';\n\nimport { provideDaffGeographyDriver } from '@daffodil/geography/driver';\n\nimport { DaffTestingGeographyService } from './geography.service';\n\n@NgModule({\n imports: [\n CommonModule,\n ],\n})\nexport class DaffGeographyTestingDriverModule {\n static forRoot(): ModuleWithProviders<DaffGeographyTestingDriverModule> {\n return {\n ngModule: DaffGeographyTestingDriverModule,\n providers: [\n provideDaffGeographyDriver(DaffTestingGeographyService),\n ],\n };\n }\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;;AAaA;;AAEG;MAIU,2BAA2B,CAAA;IAEtC,
|
|
1
|
+
{"version":3,"file":"daffodil-geography-driver-testing.mjs","sources":["../../../libs/geography/driver/testing/src/drivers/geography.service.ts","../../../libs/geography/driver/testing/src/drivers/geography-driver.module.ts","../../../libs/geography/driver/testing/src/daffodil-geography-driver-testing.ts"],"sourcesContent":["import { Injectable } from '@angular/core';\nimport {\n Observable,\n of,\n} from 'rxjs';\n\nimport { DaffCountry } from '@daffodil/geography';\nimport { DaffGeographyServiceInterface } from '@daffodil/geography/driver';\nimport {\n DaffCountryFactory,\n DaffSubdivisionFactory,\n} from '@daffodil/geography/testing';\n\n/**\n * @inheritdoc\n */\n@Injectable({\n providedIn: 'root',\n})\nexport class DaffTestingGeographyService implements DaffGeographyServiceInterface<DaffCountry> {\n\n constructor(\n private countryFactory: DaffCountryFactory,\n private subdivisionFactory: DaffSubdivisionFactory,\n ) {}\n\n get(countryId: DaffCountry['id']): Observable<DaffCountry> {\n return of(this.countryFactory.create({\n id: countryId,\n subdivisions: this.subdivisionFactory.createMany(3),\n }));\n }\n\n list(): Observable<DaffCountry[]> {\n return of(this.countryFactory.createMany(5));\n }\n}\n","import { CommonModule } from '@angular/common';\nimport {\n NgModule,\n ModuleWithProviders,\n} from '@angular/core';\n\nimport { provideDaffGeographyDriver } from '@daffodil/geography/driver';\n\nimport { DaffTestingGeographyService } from './geography.service';\n\n@NgModule({\n imports: [\n CommonModule,\n ],\n})\nexport class DaffGeographyTestingDriverModule {\n static forRoot(): ModuleWithProviders<DaffGeographyTestingDriverModule> {\n return {\n ngModule: DaffGeographyTestingDriverModule,\n providers: [\n provideDaffGeographyDriver(DaffTestingGeographyService),\n ],\n };\n }\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;;AAaA;;AAEG;MAIU,2BAA2B,CAAA;IAEtC,WAAA,CACU,cAAkC,EAClC,kBAA0C,EAAA;QAD1C,IAAA,CAAA,cAAc,GAAd,cAAc;QACd,IAAA,CAAA,kBAAkB,GAAlB,kBAAkB;IACzB;AAEH,IAAA,GAAG,CAAC,SAA4B,EAAA;AAC9B,QAAA,OAAO,EAAE,CAAC,IAAI,CAAC,cAAc,CAAC,MAAM,CAAC;AACnC,YAAA,EAAE,EAAE,SAAS;YACb,YAAY,EAAE,IAAI,CAAC,kBAAkB,CAAC,UAAU,CAAC,CAAC,CAAC;AACpD,SAAA,CAAC,CAAC;IACL;IAEA,IAAI,GAAA;QACF,OAAO,EAAE,CAAC,IAAI,CAAC,cAAc,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC;IAC9C;iIAhBW,2BAA2B,EAAA,IAAA,EA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,CAAA;kBAL5C,QAAQ;AAAC,YAAA,IAAA,EAAA,CAAA;AACR,oBAAA,OAAO,EAAE;wBACP,YAAY;AACb,qBAAA;AACF,iBAAA;;;ACdD;;AAEG;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"daffodil-geography-driver.mjs","sources":["../../../libs/geography/driver/src/errors/country-not-found.ts","../../../libs/geography/driver/src/errors/invalid-api-response.ts","../../../libs/geography/driver/src/interfaces/geography-service.interface.ts","../../../libs/geography/driver/src/daffodil-geography-driver.ts"],"sourcesContent":["import {\n DaffError,\n DaffInheritableError,\n} from '@daffodil/core';\n\nexport class DaffCountryNotFoundError extends DaffInheritableError implements DaffError {\n public readonly code: string = 'DAFF_GEOGRAPHY_COUNTRY_NOT_FOUND';\n\n constructor(public message: string) {\n super(message);\n }\n}\n","import {\n DaffError,\n DaffInheritableError,\n} from '@daffodil/core';\n\nexport class DaffGeographyInvalidAPIResponseError extends DaffInheritableError implements DaffError {\n public readonly code: string = 'DAFF_GEOGRAPHY_INVALID_API_RESPONSE';\n\n constructor(public message: string) {\n super(message);\n }\n}\n","import { Observable } from 'rxjs';\n\nimport { createSingletonInjectionToken } from '@daffodil/core';\nimport { DaffCountry } from '@daffodil/geography';\n\nexport const {\n token: DaffGeographyDriver,\n /**\n * Provider function for {@link DaffGeographyDriver}.\n */\n provider: provideDaffGeographyDriver,\n} = createSingletonInjectionToken<DaffGeographyServiceInterface>('DaffGeographyDriver');\n\nexport interface DaffGeographyServiceInterface<T extends DaffCountry = DaffCountry> {\n /**\n * Retrieves the list of countries available to the given store.\n */\n list(): Observable<T[]>;\n\n /**\n * Retrieve precise information about a specific country.\n */\n get(id: T['id']): Observable<T>;\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;AAKM,MAAO,wBAAyB,SAAQ,oBAAoB,CAAA;AAGhE,IAAA,WAAA,CAAmB,OAAe,EAAA;QAChC,KAAK,CAAC,OAAO,CAAC;QADG,
|
|
1
|
+
{"version":3,"file":"daffodil-geography-driver.mjs","sources":["../../../libs/geography/driver/src/errors/country-not-found.ts","../../../libs/geography/driver/src/errors/invalid-api-response.ts","../../../libs/geography/driver/src/interfaces/geography-service.interface.ts","../../../libs/geography/driver/src/daffodil-geography-driver.ts"],"sourcesContent":["import {\n DaffError,\n DaffInheritableError,\n} from '@daffodil/core';\n\nexport class DaffCountryNotFoundError extends DaffInheritableError implements DaffError {\n public readonly code: string = 'DAFF_GEOGRAPHY_COUNTRY_NOT_FOUND';\n\n constructor(public message: string) {\n super(message);\n }\n}\n","import {\n DaffError,\n DaffInheritableError,\n} from '@daffodil/core';\n\nexport class DaffGeographyInvalidAPIResponseError extends DaffInheritableError implements DaffError {\n public readonly code: string = 'DAFF_GEOGRAPHY_INVALID_API_RESPONSE';\n\n constructor(public message: string) {\n super(message);\n }\n}\n","import { Observable } from 'rxjs';\n\nimport { createSingletonInjectionToken } from '@daffodil/core';\nimport { DaffCountry } from '@daffodil/geography';\n\nexport const {\n token: DaffGeographyDriver,\n /**\n * Provider function for {@link DaffGeographyDriver}.\n */\n provider: provideDaffGeographyDriver,\n} = createSingletonInjectionToken<DaffGeographyServiceInterface>('DaffGeographyDriver');\n\nexport interface DaffGeographyServiceInterface<T extends DaffCountry = DaffCountry> {\n /**\n * Retrieves the list of countries available to the given store.\n */\n list(): Observable<T[]>;\n\n /**\n * Retrieve precise information about a specific country.\n */\n get(id: T['id']): Observable<T>;\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;AAKM,MAAO,wBAAyB,SAAQ,oBAAoB,CAAA;AAGhE,IAAA,WAAA,CAAmB,OAAe,EAAA;QAChC,KAAK,CAAC,OAAO,CAAC;QADG,IAAA,CAAA,OAAO,GAAP,OAAO;QAFV,IAAA,CAAA,IAAI,GAAW,kCAAkC;IAIjE;AACD;;ACNK,MAAO,oCAAqC,SAAQ,oBAAoB,CAAA;AAG5E,IAAA,WAAA,CAAmB,OAAe,EAAA;QAChC,KAAK,CAAC,OAAO,CAAC;QADG,IAAA,CAAA,OAAO,GAAP,OAAO;QAFV,IAAA,CAAA,IAAI,GAAW,qCAAqC;IAIpE;AACD;;ACNM,MAAM,EACX,KAAK,EAAE,mBAAmB;AAC1B;;AAEG;AACH,QAAQ,EAAE,0BAA0B,GACrC,GAAG,6BAA6B,CAAgC,qBAAqB;;ACXtF;;AAEG;;;;"}
|
|
@@ -26,22 +26,22 @@ class MockDaffGeographyFacade {
|
|
|
26
26
|
}
|
|
27
27
|
dispatch(action) { }
|
|
28
28
|
;
|
|
29
|
-
/** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
30
|
-
/** @nocollapse */ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "
|
|
29
|
+
/** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.1", ngImport: i0, type: MockDaffGeographyFacade, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
30
|
+
/** @nocollapse */ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.3.1", ngImport: i0, type: MockDaffGeographyFacade, providedIn: 'root' }); }
|
|
31
31
|
}
|
|
32
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
32
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.1", ngImport: i0, type: MockDaffGeographyFacade, decorators: [{
|
|
33
33
|
type: Injectable,
|
|
34
34
|
args: [{ providedIn: 'root' }]
|
|
35
35
|
}] });
|
|
36
36
|
|
|
37
37
|
class DaffGeographyStateTestingModule {
|
|
38
|
-
/** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
39
|
-
/** @nocollapse */ static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "
|
|
40
|
-
/** @nocollapse */ static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "
|
|
38
|
+
/** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.1", ngImport: i0, type: DaffGeographyStateTestingModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
|
|
39
|
+
/** @nocollapse */ static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "20.3.1", ngImport: i0, type: DaffGeographyStateTestingModule }); }
|
|
40
|
+
/** @nocollapse */ static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "20.3.1", ngImport: i0, type: DaffGeographyStateTestingModule, providers: [
|
|
41
41
|
{ provide: DaffGeographyFacade, useExisting: MockDaffGeographyFacade },
|
|
42
42
|
] }); }
|
|
43
43
|
}
|
|
44
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
44
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.1", ngImport: i0, type: DaffGeographyStateTestingModule, decorators: [{
|
|
45
45
|
type: NgModule,
|
|
46
46
|
args: [{
|
|
47
47
|
providers: [
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"daffodil-geography-state-testing.mjs","sources":["../../../libs/geography/state/testing/src/mock-geography-facade.ts","../../../libs/geography/state/testing/src/geography-testing.module.ts","../../../libs/geography/state/testing/src/daffodil-geography-state-testing.ts"],"sourcesContent":["import { Injectable } from '@angular/core';\nimport { Dictionary } from '@ngrx/entity';\nimport { Action } from '@ngrx/store';\nimport { BehaviorSubject } from 'rxjs';\n\nimport { DaffStateError } from '@daffodil/core/state';\nimport { DaffCountry } from '@daffodil/geography';\nimport { DaffGeographyFacadeInterface } from '@daffodil/geography/state';\n\n/**\n * @inheritdoc\n */\n@Injectable({ providedIn: 'root' })\nexport class MockDaffGeographyFacade implements DaffGeographyFacadeInterface {\n loading$: BehaviorSubject<boolean> = new BehaviorSubject(null);\n errors$: BehaviorSubject<DaffStateError[]> = new BehaviorSubject([]);\n countries$: BehaviorSubject<DaffCountry[]> = new BehaviorSubject([]);\n countryIds$: BehaviorSubject<DaffCountry['id'][]> = new BehaviorSubject([]);\n countryCount$: BehaviorSubject<number> = new BehaviorSubject(null);\n countryEntities$: BehaviorSubject<Dictionary<DaffCountry>> = new BehaviorSubject(null);\n\n getCountry(id) {\n return new BehaviorSubject(null);\n }\n\n getCountrySubdivisions(id) {\n return new BehaviorSubject([]);\n }\n\n isCountryFullyLoaded(id) {\n return new BehaviorSubject(false);\n }\n\n dispatch(action: Action) {};\n}\n","import { NgModule } from '@angular/core';\n\nimport { DaffGeographyFacade } from '@daffodil/geography/state';\n\nimport { MockDaffGeographyFacade } from './mock-geography-facade';\n\n@NgModule({\n providers: [\n { provide: DaffGeographyFacade, useExisting: MockDaffGeographyFacade },\n ],\n})\nexport class DaffGeographyStateTestingModule {}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;AASA;;AAEG;MAEU,uBAAuB,CAAA;AADpC,IAAA,WAAA,GAAA;AAEE,QAAA,IAAA,CAAA,QAAQ,GAA6B,IAAI,eAAe,CAAC,IAAI,CAAC;AAC9D,QAAA,IAAA,CAAA,OAAO,GAAsC,IAAI,eAAe,CAAC,EAAE,CAAC;AACpE,QAAA,IAAA,CAAA,UAAU,GAAmC,IAAI,eAAe,CAAC,EAAE,CAAC;AACpE,QAAA,IAAA,CAAA,WAAW,GAAyC,IAAI,eAAe,CAAC,EAAE,CAAC;AAC3E,QAAA,IAAA,CAAA,aAAa,GAA4B,IAAI,eAAe,CAAC,IAAI,CAAC;AAClE,QAAA,IAAA,CAAA,gBAAgB,GAA6C,IAAI,eAAe,CAAC,IAAI,CAAC;AAevF;AAbC,IAAA,UAAU,CAAC,EAAE,EAAA;AACX,QAAA,OAAO,IAAI,eAAe,CAAC,IAAI,CAAC
|
|
1
|
+
{"version":3,"file":"daffodil-geography-state-testing.mjs","sources":["../../../libs/geography/state/testing/src/mock-geography-facade.ts","../../../libs/geography/state/testing/src/geography-testing.module.ts","../../../libs/geography/state/testing/src/daffodil-geography-state-testing.ts"],"sourcesContent":["import { Injectable } from '@angular/core';\nimport { Dictionary } from '@ngrx/entity';\nimport { Action } from '@ngrx/store';\nimport { BehaviorSubject } from 'rxjs';\n\nimport { DaffStateError } from '@daffodil/core/state';\nimport { DaffCountry } from '@daffodil/geography';\nimport { DaffGeographyFacadeInterface } from '@daffodil/geography/state';\n\n/**\n * @inheritdoc\n */\n@Injectable({ providedIn: 'root' })\nexport class MockDaffGeographyFacade implements DaffGeographyFacadeInterface {\n loading$: BehaviorSubject<boolean> = new BehaviorSubject(null);\n errors$: BehaviorSubject<DaffStateError[]> = new BehaviorSubject([]);\n countries$: BehaviorSubject<DaffCountry[]> = new BehaviorSubject([]);\n countryIds$: BehaviorSubject<DaffCountry['id'][]> = new BehaviorSubject([]);\n countryCount$: BehaviorSubject<number> = new BehaviorSubject(null);\n countryEntities$: BehaviorSubject<Dictionary<DaffCountry>> = new BehaviorSubject(null);\n\n getCountry(id) {\n return new BehaviorSubject(null);\n }\n\n getCountrySubdivisions(id) {\n return new BehaviorSubject([]);\n }\n\n isCountryFullyLoaded(id) {\n return new BehaviorSubject(false);\n }\n\n dispatch(action: Action) {};\n}\n","import { NgModule } from '@angular/core';\n\nimport { DaffGeographyFacade } from '@daffodil/geography/state';\n\nimport { MockDaffGeographyFacade } from './mock-geography-facade';\n\n@NgModule({\n providers: [\n { provide: DaffGeographyFacade, useExisting: MockDaffGeographyFacade },\n ],\n})\nexport class DaffGeographyStateTestingModule {}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;AASA;;AAEG;MAEU,uBAAuB,CAAA;AADpC,IAAA,WAAA,GAAA;AAEE,QAAA,IAAA,CAAA,QAAQ,GAA6B,IAA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