@daffodil/geography 0.38.9 → 0.39.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/bundles/daffodil-geography-driver-in-memory.umd.js +12 -124
- package/bundles/daffodil-geography-driver-in-memory.umd.js.map +1 -1
- package/bundles/daffodil-geography-driver-in-memory.umd.min.js +1 -1
- package/bundles/daffodil-geography-driver-in-memory.umd.min.js.map +1 -1
- package/bundles/daffodil-geography-driver-magento.umd.js +15 -170
- package/bundles/daffodil-geography-driver-magento.umd.js.map +1 -1
- package/bundles/daffodil-geography-driver-magento.umd.min.js +1 -1
- package/bundles/daffodil-geography-driver-magento.umd.min.js.map +1 -1
- package/bundles/daffodil-geography-driver-testing.umd.js +3 -59
- package/bundles/daffodil-geography-driver-testing.umd.js.map +1 -1
- package/bundles/daffodil-geography-driver-testing.umd.min.js +1 -1
- package/bundles/daffodil-geography-driver-testing.umd.min.js.map +1 -1
- package/bundles/daffodil-geography-driver.umd.js +2 -58
- package/bundles/daffodil-geography-driver.umd.js.map +1 -1
- package/bundles/daffodil-geography-driver.umd.min.js +1 -1
- package/bundles/daffodil-geography-driver.umd.min.js.map +1 -1
- package/bundles/daffodil-geography-state-testing.umd.js +3 -58
- package/bundles/daffodil-geography-state-testing.umd.js.map +1 -1
- package/bundles/daffodil-geography-state-testing.umd.min.js +1 -1
- package/bundles/daffodil-geography-state-testing.umd.min.js.map +1 -1
- package/bundles/daffodil-geography-state.umd.js +63 -489
- package/bundles/daffodil-geography-state.umd.js.map +1 -1
- package/bundles/daffodil-geography-state.umd.min.js +2 -2
- package/bundles/daffodil-geography-state.umd.min.js.map +1 -1
- package/bundles/daffodil-geography-testing.umd.js +6 -78
- package/bundles/daffodil-geography-testing.umd.js.map +1 -1
- package/bundles/daffodil-geography-testing.umd.min.js +2 -2
- package/bundles/daffodil-geography-testing.umd.min.js.map +1 -1
- package/bundles/daffodil-geography.umd.js +8 -44
- package/bundles/daffodil-geography.umd.js.map +1 -1
- package/bundles/daffodil-geography.umd.min.js.map +1 -1
- package/driver/in-memory/package.json +1 -1
- package/driver/magento/package.json +1 -1
- package/driver/package.json +1 -1
- package/driver/testing/package.json +1 -1
- package/esm2015/comparators/address.js +3 -9
- package/esm2015/comparators/personal-address.js +3 -9
- package/esm2015/comparators/public_api.js +1 -6
- package/esm2015/daffodil-geography.js +2 -7
- package/esm2015/driver/daffodil-geography-driver.js +2 -7
- package/esm2015/driver/errors/country-not-found.js +1 -15
- package/esm2015/driver/errors/invalid-api-response.js +1 -15
- package/esm2015/driver/errors/public_api.js +1 -6
- package/esm2015/driver/in-memory/backend/geography.service.js +9 -57
- package/esm2015/driver/in-memory/daffodil-geography-driver-in-memory.js +2 -7
- package/esm2015/driver/in-memory/drivers/geography-driver.module.js +1 -9
- package/esm2015/driver/in-memory/drivers/geography.service.js +4 -36
- package/esm2015/driver/in-memory/drivers/public_api.js +1 -6
- package/esm2015/driver/in-memory/index.js +2 -7
- package/esm2015/driver/in-memory/public_api.js +2 -7
- package/esm2015/driver/index.js +2 -7
- package/esm2015/driver/interfaces/geography-service.interface.js +1 -25
- package/esm2015/driver/magento/daffodil-geography-driver-magento.js +2 -7
- package/esm2015/driver/magento/errors/codes.js +5 -11
- package/esm2015/driver/magento/errors/map.js +1 -7
- package/esm2015/driver/magento/errors/transform.js +1 -10
- package/esm2015/driver/magento/geography-driver.module.js +1 -9
- package/esm2015/driver/magento/geography.service.js +5 -50
- package/esm2015/driver/magento/index.js +2 -7
- package/esm2015/driver/magento/models/responses/country.js +2 -26
- package/esm2015/driver/magento/models/responses/public_api.js +2 -6
- package/esm2015/driver/magento/models/responses/region.js +2 -20
- package/esm2015/driver/magento/public_api.js +3 -8
- package/esm2015/driver/magento/queries/fragments/country.js +1 -7
- package/esm2015/driver/magento/queries/fragments/public_api.js +1 -6
- package/esm2015/driver/magento/queries/fragments/region.js +1 -7
- package/esm2015/driver/magento/queries/get-countries.js +1 -7
- package/esm2015/driver/magento/queries/get-country.js +1 -7
- package/esm2015/driver/magento/queries/public_api.js +3 -8
- package/esm2015/driver/magento/queries/responses/get-countries.js +2 -14
- package/esm2015/driver/magento/queries/responses/get-country.js +2 -14
- package/esm2015/driver/magento/queries/responses/public_api.js +2 -6
- package/esm2015/driver/magento/transforms/responses/country.service.js +3 -26
- package/esm2015/driver/magento/transforms/responses/subdivision.service.js +2 -9
- package/esm2015/driver/magento/validators/get-countries.js +3 -13
- package/esm2015/driver/magento/validators/public_api.js +1 -6
- package/esm2015/driver/testing/daffodil-geography-driver-testing.js +2 -7
- package/esm2015/driver/testing/drivers/geography-driver.module.js +1 -9
- package/esm2015/driver/testing/drivers/geography.service.js +3 -31
- package/esm2015/driver/testing/drivers/public_api.js +1 -6
- package/esm2015/driver/testing/index.js +2 -7
- package/esm2015/driver/testing/public_api.js +2 -7
- package/esm2015/index.js +2 -7
- package/esm2015/injection-tokens/error-matcher.token.js +2 -11
- package/esm2015/injection-tokens/public_api.js +1 -6
- package/esm2015/models/address.js +2 -34
- package/esm2015/models/country.js +2 -30
- package/esm2015/models/personal-address.js +2 -28
- package/esm2015/models/public_api.js +2 -6
- package/esm2015/models/subdivision.js +2 -18
- package/esm2015/public_api.js +4 -9
- package/esm2015/state/actions/geography.actions.js +10 -74
- package/esm2015/state/actions/public_api.js +2 -7
- package/esm2015/state/daffodil-geography-state.js +2 -7
- package/esm2015/state/effects/geography.effects.js +3 -61
- package/esm2015/state/facades/geography/geography-facade.interface.js +2 -40
- package/esm2015/state/facades/geography/geography.facade.js +3 -62
- package/esm2015/state/geography-state.module.js +1 -6
- package/esm2015/state/index.js +4 -9
- package/esm2015/state/reducers/country-entities/country-entities-adapter.js +4 -18
- package/esm2015/state/reducers/country-entities/country-entities-initial-state.js +1 -7
- package/esm2015/state/reducers/country-entities/country-entities-state.interface.js +2 -6
- package/esm2015/state/reducers/country-entities/country-entities.reducer.js +7 -17
- package/esm2015/state/reducers/country-entities/public_api.js +1 -6
- package/esm2015/state/reducers/geography/geography-initial-state.js +1 -7
- package/esm2015/state/reducers/geography/geography-state.interface.js +2 -16
- package/esm2015/state/reducers/geography/geography.reducer.js +1 -12
- package/esm2015/state/reducers/geography/public_api.js +1 -6
- package/esm2015/state/reducers/geography-reducers-state.interface.js +1 -26
- package/esm2015/state/reducers/geography-reducers.js +1 -7
- package/esm2015/state/reducers/geography-store-feature-key.js +1 -7
- package/esm2015/state/reducers/public_api.js +3 -8
- package/esm2015/state/selectors/country-entities.selector.js +10 -84
- package/esm2015/state/selectors/geography-all.selector.js +4 -23
- package/esm2015/state/selectors/geography-feature.selector.js +5 -28
- package/esm2015/state/selectors/geography.selector.js +9 -55
- package/esm2015/state/selectors/public_api.js +2 -7
- package/esm2015/state/testing/daffodil-geography-state-testing.js +2 -7
- package/esm2015/state/testing/geography-testing.module.js +1 -6
- package/esm2015/state/testing/index.js +2 -7
- package/esm2015/state/testing/mock-geography-facade.js +3 -39
- package/esm2015/state/testing/public_api.js +1 -6
- package/esm2015/testing/daffodil-geography-testing.js +2 -7
- package/esm2015/testing/factories/address.factory.js +2 -21
- package/esm2015/testing/factories/country.factory.js +2 -21
- package/esm2015/testing/factories/personal-address.factory.js +2 -23
- package/esm2015/testing/factories/public_api.js +5 -10
- package/esm2015/testing/factories/subdivision.factory.js +2 -15
- package/esm2015/testing/index.js +2 -7
- package/esm2015/testing/public_api.js +2 -7
- package/fesm2015/daffodil-geography-driver-in-memory.js +13 -121
- package/fesm2015/daffodil-geography-driver-in-memory.js.map +1 -1
- package/fesm2015/daffodil-geography-driver-magento.js +15 -196
- package/fesm2015/daffodil-geography-driver-magento.js.map +1 -1
- package/fesm2015/daffodil-geography-driver-testing.js +4 -60
- package/fesm2015/daffodil-geography-driver-testing.js.map +1 -1
- package/fesm2015/daffodil-geography-driver.js +1 -67
- package/fesm2015/daffodil-geography-driver.js.map +1 -1
- package/fesm2015/daffodil-geography-state-testing.js +4 -59
- package/fesm2015/daffodil-geography-state-testing.js.map +1 -1
- package/fesm2015/daffodil-geography-state.js +49 -488
- package/fesm2015/daffodil-geography-state.js.map +1 -1
- package/fesm2015/daffodil-geography-testing.js +6 -98
- package/fesm2015/daffodil-geography-testing.js.map +1 -1
- package/fesm2015/daffodil-geography.js +8 -57
- package/fesm2015/daffodil-geography.js.map +1 -1
- package/package.json +3 -3
- package/state/package.json +1 -1
- package/state/testing/package.json +1 -1
- package/testing/package.json +1 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ɵɵdefineInjectable, Injectable, ɵɵinject, NgModule } from '@angular/core';
|
|
2
2
|
import { gql, Apollo } from 'apollo-angular';
|
|
3
3
|
import { throwError } from 'rxjs';
|
|
4
4
|
import { map, catchError } from 'rxjs/operators';
|
|
@@ -6,67 +6,42 @@ import { daffTransformMagentoError } from '@daffodil/driver/magento';
|
|
|
6
6
|
import { DaffCountryNotFoundError, DaffGeographyInvalidAPIResponseError, DaffGeographyDriver } from '@daffodil/geography/driver';
|
|
7
7
|
import { CommonModule } from '@angular/common';
|
|
8
8
|
|
|
9
|
-
/**
|
|
10
|
-
* @fileoverview added by tsickle
|
|
11
|
-
* Generated from: transforms/responses/subdivision.service.ts
|
|
12
|
-
* @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
13
|
-
*/
|
|
14
9
|
/**
|
|
15
10
|
* Transforms magento carts into an object usable by daffodil.
|
|
16
11
|
*/
|
|
17
12
|
class DaffMagentoSubdivisionTransformer {
|
|
18
13
|
/**
|
|
19
14
|
* Transforms the MagentoRegion from the magento region query into a DaffSubdivision.
|
|
20
|
-
* @param {?} region
|
|
21
|
-
* @return {?}
|
|
22
15
|
*/
|
|
23
16
|
transform(region) {
|
|
24
17
|
return region ? Object.assign({ magento_region: region }, { id: String(region.id), name: region.name, iso_3166_2: region.code }) : null;
|
|
25
18
|
}
|
|
26
19
|
}
|
|
20
|
+
/** @nocollapse */ DaffMagentoSubdivisionTransformer.ɵprov = ɵɵdefineInjectable({ factory: function DaffMagentoSubdivisionTransformer_Factory() { return new DaffMagentoSubdivisionTransformer(); }, token: DaffMagentoSubdivisionTransformer, providedIn: "root" });
|
|
27
21
|
DaffMagentoSubdivisionTransformer.decorators = [
|
|
28
22
|
{ type: Injectable, args: [{
|
|
29
23
|
providedIn: 'root',
|
|
30
24
|
},] }
|
|
31
25
|
];
|
|
32
|
-
/** @nocollapse */ DaffMagentoSubdivisionTransformer.ɵprov = ɵɵdefineInjectable({ factory: function DaffMagentoSubdivisionTransformer_Factory() { return new DaffMagentoSubdivisionTransformer(); }, token: DaffMagentoSubdivisionTransformer, providedIn: "root" });
|
|
33
26
|
|
|
34
|
-
/**
|
|
35
|
-
* @fileoverview added by tsickle
|
|
36
|
-
* Generated from: transforms/responses/country.service.ts
|
|
37
|
-
* @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
38
|
-
*/
|
|
39
27
|
/**
|
|
40
28
|
* Transforms magento carts into an object usable by daffodil.
|
|
41
29
|
*/
|
|
42
30
|
class DaffMagentoCountryTransformer {
|
|
43
|
-
/**
|
|
44
|
-
* @param {?} subdivisionTransformer
|
|
45
|
-
*/
|
|
46
31
|
constructor(subdivisionTransformer) {
|
|
47
32
|
this.subdivisionTransformer = subdivisionTransformer;
|
|
48
33
|
}
|
|
49
|
-
/**
|
|
50
|
-
* @private
|
|
51
|
-
* @param {?} regions
|
|
52
|
-
* @return {?}
|
|
53
|
-
*/
|
|
54
34
|
transformSubdivisions(regions) {
|
|
55
|
-
return regions.map((
|
|
56
|
-
* @param {?} region
|
|
57
|
-
* @return {?}
|
|
58
|
-
*/
|
|
59
|
-
region => this.subdivisionTransformer.transform(region)));
|
|
35
|
+
return regions.map(region => this.subdivisionTransformer.transform(region));
|
|
60
36
|
}
|
|
61
37
|
/**
|
|
62
38
|
* Transforms the MagentoCountry from the magento country query into a DaffCountry.
|
|
63
|
-
* @param {?} country
|
|
64
|
-
* @return {?}
|
|
65
39
|
*/
|
|
66
40
|
transform(country) {
|
|
67
41
|
return country ? Object.assign({ magento_country: country }, { subdivisions: this.transformSubdivisions(country.available_regions || []), id: country.id, name: country.full_name_locale, name_en: country.full_name_english, alpha2: country.two_letter_abbreviation, alpha3: country.three_letter_abbreviation }) : null;
|
|
68
42
|
}
|
|
69
43
|
}
|
|
44
|
+
/** @nocollapse */ DaffMagentoCountryTransformer.ɵprov = ɵɵdefineInjectable({ factory: function DaffMagentoCountryTransformer_Factory() { return new DaffMagentoCountryTransformer(ɵɵinject(DaffMagentoSubdivisionTransformer)); }, token: DaffMagentoCountryTransformer, providedIn: "root" });
|
|
70
45
|
DaffMagentoCountryTransformer.decorators = [
|
|
71
46
|
{ type: Injectable, args: [{
|
|
72
47
|
providedIn: 'root',
|
|
@@ -76,24 +51,7 @@ DaffMagentoCountryTransformer.decorators = [
|
|
|
76
51
|
DaffMagentoCountryTransformer.ctorParameters = () => [
|
|
77
52
|
{ type: DaffMagentoSubdivisionTransformer }
|
|
78
53
|
];
|
|
79
|
-
/** @nocollapse */ DaffMagentoCountryTransformer.ɵprov = ɵɵdefineInjectable({ factory: function DaffMagentoCountryTransformer_Factory() { return new DaffMagentoCountryTransformer(ɵɵinject(DaffMagentoSubdivisionTransformer)); }, token: DaffMagentoCountryTransformer, providedIn: "root" });
|
|
80
|
-
if (false) {
|
|
81
|
-
/** @type {?} */
|
|
82
|
-
DaffMagentoCountryTransformer.prototype.subdivisionTransformer;
|
|
83
|
-
}
|
|
84
54
|
|
|
85
|
-
/**
|
|
86
|
-
* @fileoverview added by tsickle
|
|
87
|
-
* Generated from: models/responses/public_api.ts
|
|
88
|
-
* @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
89
|
-
*/
|
|
90
|
-
|
|
91
|
-
/**
|
|
92
|
-
* @fileoverview added by tsickle
|
|
93
|
-
* Generated from: queries/fragments/country.ts
|
|
94
|
-
* @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
95
|
-
*/
|
|
96
|
-
/** @type {?} */
|
|
97
55
|
const countryFragment = gql `
|
|
98
56
|
fragment country on Country {
|
|
99
57
|
id
|
|
@@ -104,12 +62,6 @@ const countryFragment = gql `
|
|
|
104
62
|
}
|
|
105
63
|
`;
|
|
106
64
|
|
|
107
|
-
/**
|
|
108
|
-
* @fileoverview added by tsickle
|
|
109
|
-
* Generated from: queries/fragments/region.ts
|
|
110
|
-
* @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
111
|
-
*/
|
|
112
|
-
/** @type {?} */
|
|
113
65
|
const regionFragment = gql `
|
|
114
66
|
fragment region on Region {
|
|
115
67
|
code
|
|
@@ -118,24 +70,6 @@ const regionFragment = gql `
|
|
|
118
70
|
}
|
|
119
71
|
`;
|
|
120
72
|
|
|
121
|
-
/**
|
|
122
|
-
* @fileoverview added by tsickle
|
|
123
|
-
* Generated from: queries/fragments/public_api.ts
|
|
124
|
-
* @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
125
|
-
*/
|
|
126
|
-
|
|
127
|
-
/**
|
|
128
|
-
* @fileoverview added by tsickle
|
|
129
|
-
* Generated from: queries/responses/public_api.ts
|
|
130
|
-
* @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
131
|
-
*/
|
|
132
|
-
|
|
133
|
-
/**
|
|
134
|
-
* @fileoverview added by tsickle
|
|
135
|
-
* Generated from: queries/get-countries.ts
|
|
136
|
-
* @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
137
|
-
*/
|
|
138
|
-
/** @type {?} */
|
|
139
73
|
const getCountries = gql `
|
|
140
74
|
query MagentoGetCountries {
|
|
141
75
|
countries {
|
|
@@ -145,12 +79,6 @@ const getCountries = gql `
|
|
|
145
79
|
${countryFragment}
|
|
146
80
|
`;
|
|
147
81
|
|
|
148
|
-
/**
|
|
149
|
-
* @fileoverview added by tsickle
|
|
150
|
-
* Generated from: queries/get-country.ts
|
|
151
|
-
* @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
152
|
-
*/
|
|
153
|
-
/** @type {?} */
|
|
154
82
|
const getCountry = gql `
|
|
155
83
|
query MagentoGetCountry($countryId: String!) {
|
|
156
84
|
country(id: $countryId) {
|
|
@@ -164,130 +92,53 @@ const getCountry = gql `
|
|
|
164
92
|
${regionFragment}
|
|
165
93
|
`;
|
|
166
94
|
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
*/
|
|
172
|
-
|
|
173
|
-
/**
|
|
174
|
-
* @fileoverview added by tsickle
|
|
175
|
-
* Generated from: errors/codes.ts
|
|
176
|
-
* @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
177
|
-
*/
|
|
178
|
-
/** @enum {string} */
|
|
179
|
-
const MagentoGeographyGraphQlErrorCode = {
|
|
180
|
-
COUNTRY_NOT_FOUND: "graphql-no-such-entity",
|
|
181
|
-
};
|
|
95
|
+
var MagentoGeographyGraphQlErrorCode;
|
|
96
|
+
(function (MagentoGeographyGraphQlErrorCode) {
|
|
97
|
+
MagentoGeographyGraphQlErrorCode["COUNTRY_NOT_FOUND"] = "graphql-no-such-entity";
|
|
98
|
+
})(MagentoGeographyGraphQlErrorCode || (MagentoGeographyGraphQlErrorCode = {}));
|
|
182
99
|
|
|
183
|
-
/**
|
|
184
|
-
* @fileoverview added by tsickle
|
|
185
|
-
* Generated from: errors/map.ts
|
|
186
|
-
* @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
187
|
-
*/
|
|
188
|
-
/** @type {?} */
|
|
189
100
|
const DaffGeographyMagentoErrorMap = {
|
|
190
101
|
[MagentoGeographyGraphQlErrorCode.COUNTRY_NOT_FOUND]: DaffCountryNotFoundError,
|
|
191
102
|
};
|
|
192
103
|
|
|
193
|
-
/**
|
|
194
|
-
* @fileoverview added by tsickle
|
|
195
|
-
* Generated from: errors/transform.ts
|
|
196
|
-
* @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
197
|
-
*/
|
|
198
|
-
/**
|
|
199
|
-
* @param {?} error
|
|
200
|
-
* @return {?}
|
|
201
|
-
*/
|
|
202
104
|
function transformMagentoGeographyError(error) {
|
|
203
105
|
return daffTransformMagentoError(error, DaffGeographyMagentoErrorMap);
|
|
204
106
|
}
|
|
205
107
|
|
|
206
|
-
|
|
207
|
-
* @fileoverview added by tsickle
|
|
208
|
-
* Generated from: validators/get-countries.ts
|
|
209
|
-
* @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
210
|
-
*/
|
|
211
|
-
/** @type {?} */
|
|
212
|
-
const validateGetCountriesResponse = (/**
|
|
213
|
-
* @param {?} response
|
|
214
|
-
* @return {?}
|
|
215
|
-
*/
|
|
216
|
-
(response) => {
|
|
108
|
+
const validateGetCountriesResponse = (response) => {
|
|
217
109
|
if (response.data.countries) {
|
|
218
110
|
return response;
|
|
219
111
|
}
|
|
220
112
|
else {
|
|
221
113
|
throw new DaffGeographyInvalidAPIResponseError('Get countries response does not contain a valid list of countries.');
|
|
222
114
|
}
|
|
223
|
-
}
|
|
224
|
-
|
|
225
|
-
/**
|
|
226
|
-
* @fileoverview added by tsickle
|
|
227
|
-
* Generated from: validators/public_api.ts
|
|
228
|
-
* @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
229
|
-
*/
|
|
115
|
+
};
|
|
230
116
|
|
|
231
|
-
/**
|
|
232
|
-
* @fileoverview added by tsickle
|
|
233
|
-
* Generated from: geography.service.ts
|
|
234
|
-
* @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
235
|
-
*/
|
|
236
117
|
/**
|
|
237
118
|
* A service for making Magento GraphQL queries for carts.
|
|
238
119
|
*
|
|
239
|
-
*
|
|
120
|
+
* @inheritdoc
|
|
240
121
|
*/
|
|
241
122
|
class DaffGeographyMagentoService {
|
|
242
|
-
/**
|
|
243
|
-
* @param {?} apollo
|
|
244
|
-
* @param {?} countryTransformer
|
|
245
|
-
*/
|
|
246
123
|
constructor(apollo, countryTransformer) {
|
|
247
124
|
this.apollo = apollo;
|
|
248
125
|
this.countryTransformer = countryTransformer;
|
|
249
126
|
}
|
|
250
|
-
/**
|
|
251
|
-
* @return {?}
|
|
252
|
-
*/
|
|
253
127
|
list() {
|
|
254
128
|
return this.apollo.query({
|
|
255
129
|
query: getCountries,
|
|
256
|
-
}).pipe(map(validateGetCountriesResponse), map((
|
|
257
|
-
* @param {?} result
|
|
258
|
-
* @return {?}
|
|
259
|
-
*/
|
|
260
|
-
result => result.data.countries.map((/**
|
|
261
|
-
* @param {?} country
|
|
262
|
-
* @return {?}
|
|
263
|
-
*/
|
|
264
|
-
country => this.countryTransformer.transform(country))))), catchError((/**
|
|
265
|
-
* @param {?} err
|
|
266
|
-
* @return {?}
|
|
267
|
-
*/
|
|
268
|
-
err => throwError(transformMagentoGeographyError(err)))));
|
|
130
|
+
}).pipe(map(validateGetCountriesResponse), map(result => result.data.countries.map(country => this.countryTransformer.transform(country))), catchError(err => throwError(transformMagentoGeographyError(err))));
|
|
269
131
|
}
|
|
270
|
-
/**
|
|
271
|
-
* @param {?} countryId
|
|
272
|
-
* @return {?}
|
|
273
|
-
*/
|
|
274
132
|
get(countryId) {
|
|
275
133
|
return this.apollo.query({
|
|
276
134
|
query: getCountry,
|
|
277
135
|
variables: {
|
|
278
136
|
countryId,
|
|
279
137
|
},
|
|
280
|
-
}).pipe(map((
|
|
281
|
-
* @param {?} result
|
|
282
|
-
* @return {?}
|
|
283
|
-
*/
|
|
284
|
-
result => this.countryTransformer.transform(result.data.country))), catchError((/**
|
|
285
|
-
* @param {?} err
|
|
286
|
-
* @return {?}
|
|
287
|
-
*/
|
|
288
|
-
err => throwError(transformMagentoGeographyError(err)))));
|
|
138
|
+
}).pipe(map(result => this.countryTransformer.transform(result.data.country)), catchError(err => throwError(transformMagentoGeographyError(err))));
|
|
289
139
|
}
|
|
290
140
|
}
|
|
141
|
+
/** @nocollapse */ DaffGeographyMagentoService.ɵprov = ɵɵdefineInjectable({ factory: function DaffGeographyMagentoService_Factory() { return new DaffGeographyMagentoService(ɵɵinject(Apollo), ɵɵinject(DaffMagentoCountryTransformer)); }, token: DaffGeographyMagentoService, providedIn: "root" });
|
|
291
142
|
DaffGeographyMagentoService.decorators = [
|
|
292
143
|
{ type: Injectable, args: [{
|
|
293
144
|
providedIn: 'root',
|
|
@@ -298,26 +149,8 @@ DaffGeographyMagentoService.ctorParameters = () => [
|
|
|
298
149
|
{ type: Apollo },
|
|
299
150
|
{ type: DaffMagentoCountryTransformer }
|
|
300
151
|
];
|
|
301
|
-
/** @nocollapse */ DaffGeographyMagentoService.ɵprov = ɵɵdefineInjectable({ factory: function DaffGeographyMagentoService_Factory() { return new DaffGeographyMagentoService(ɵɵinject(Apollo), ɵɵinject(DaffMagentoCountryTransformer)); }, token: DaffGeographyMagentoService, providedIn: "root" });
|
|
302
|
-
if (false) {
|
|
303
|
-
/**
|
|
304
|
-
* @type {?}
|
|
305
|
-
* @private
|
|
306
|
-
*/
|
|
307
|
-
DaffGeographyMagentoService.prototype.apollo;
|
|
308
|
-
/** @type {?} */
|
|
309
|
-
DaffGeographyMagentoService.prototype.countryTransformer;
|
|
310
|
-
}
|
|
311
152
|
|
|
312
|
-
/**
|
|
313
|
-
* @fileoverview added by tsickle
|
|
314
|
-
* Generated from: geography-driver.module.ts
|
|
315
|
-
* @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
316
|
-
*/
|
|
317
153
|
class DaffGeographyMagentoDriverModule {
|
|
318
|
-
/**
|
|
319
|
-
* @return {?}
|
|
320
|
-
*/
|
|
321
154
|
static forRoot() {
|
|
322
155
|
return {
|
|
323
156
|
ngModule: DaffGeographyMagentoDriverModule,
|
|
@@ -339,21 +172,7 @@ DaffGeographyMagentoDriverModule.decorators = [
|
|
|
339
172
|
];
|
|
340
173
|
|
|
341
174
|
/**
|
|
342
|
-
*
|
|
343
|
-
* Generated from: public_api.ts
|
|
344
|
-
* @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
345
|
-
*/
|
|
346
|
-
|
|
347
|
-
/**
|
|
348
|
-
* @fileoverview added by tsickle
|
|
349
|
-
* Generated from: index.ts
|
|
350
|
-
* @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
351
|
-
*/
|
|
352
|
-
|
|
353
|
-
/**
|
|
354
|
-
* @fileoverview added by tsickle
|
|
355
|
-
* Generated from: daffodil-geography-driver-magento.ts
|
|
356
|
-
* @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
175
|
+
* Generated bundle index. Do not edit.
|
|
357
176
|
*/
|
|
358
177
|
|
|
359
178
|
export { DaffGeographyMagentoDriverModule, DaffGeographyMagentoService, DaffMagentoCountryTransformer, DaffMagentoSubdivisionTransformer, countryFragment, getCountries, getCountry, regionFragment };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"daffodil-geography-driver-magento.js","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"],"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 { MagentoCountry } from '../../models/responses/country';\nimport { DaffMagentoSubdivisionTransformer } from './subdivision.service';\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 getCountries = gql`\n query MagentoGetCountries {\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 getCountry = gql`\n query MagentoGetCountry($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\tCOUNTRY_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 { DaffGeographyDriver } from '@daffodil/geography/driver';\n\nimport { DaffGeographyMagentoService } from './geography.service';\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 {\n provide: DaffGeographyDriver,\n useExisting: DaffGeographyMagentoService,\n },\n ],\n };\n }\n}\n"],"names":[],"mappings":"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"}
|
|
1
|
+
{"version":3,"file":"daffodil-geography-driver-magento.js","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 { MagentoCountry } from '../../models/responses/country';\nimport { DaffMagentoSubdivisionTransformer } from './subdivision.service';\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 getCountries = gql`\n query MagentoGetCountries {\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 getCountry = gql`\n query MagentoGetCountry($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\tCOUNTRY_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 { DaffGeographyDriver } from '@daffodil/geography/driver';\n\nimport { DaffGeographyMagentoService } from './geography.service';\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 {\n provide: DaffGeographyDriver,\n useExisting: DaffGeographyMagentoService,\n },\n ],\n };\n }\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":"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"}
|
|
@@ -1,43 +1,28 @@
|
|
|
1
1
|
import { CommonModule } from '@angular/common';
|
|
2
|
-
import {
|
|
2
|
+
import { ɵɵdefineInjectable, ɵɵinject, Injectable, NgModule } from '@angular/core';
|
|
3
3
|
import { DaffGeographyDriver } from '@daffodil/geography/driver';
|
|
4
4
|
import { of } from 'rxjs';
|
|
5
5
|
import { DaffCountryFactory, DaffSubdivisionFactory } from '@daffodil/geography/testing';
|
|
6
6
|
|
|
7
7
|
/**
|
|
8
|
-
* @
|
|
9
|
-
* Generated from: drivers/geography.service.ts
|
|
10
|
-
* @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
11
|
-
*/
|
|
12
|
-
/**
|
|
13
|
-
* \@inheritdoc
|
|
8
|
+
* @inheritdoc
|
|
14
9
|
*/
|
|
15
10
|
class DaffTestingGeographyService {
|
|
16
|
-
/**
|
|
17
|
-
* @param {?} countryFactory
|
|
18
|
-
* @param {?} subdivisionFactory
|
|
19
|
-
*/
|
|
20
11
|
constructor(countryFactory, subdivisionFactory) {
|
|
21
12
|
this.countryFactory = countryFactory;
|
|
22
13
|
this.subdivisionFactory = subdivisionFactory;
|
|
23
14
|
}
|
|
24
|
-
/**
|
|
25
|
-
* @param {?} countryId
|
|
26
|
-
* @return {?}
|
|
27
|
-
*/
|
|
28
15
|
get(countryId) {
|
|
29
16
|
return of(this.countryFactory.create({
|
|
30
17
|
id: countryId,
|
|
31
18
|
subdivisions: this.subdivisionFactory.createMany(3),
|
|
32
19
|
}));
|
|
33
20
|
}
|
|
34
|
-
/**
|
|
35
|
-
* @return {?}
|
|
36
|
-
*/
|
|
37
21
|
list() {
|
|
38
22
|
return of(this.countryFactory.createMany(5));
|
|
39
23
|
}
|
|
40
24
|
}
|
|
25
|
+
/** @nocollapse */ DaffTestingGeographyService.ɵprov = ɵɵdefineInjectable({ factory: function DaffTestingGeographyService_Factory() { return new DaffTestingGeographyService(ɵɵinject(DaffCountryFactory), ɵɵinject(DaffSubdivisionFactory)); }, token: DaffTestingGeographyService, providedIn: "root" });
|
|
41
26
|
DaffTestingGeographyService.decorators = [
|
|
42
27
|
{ type: Injectable, args: [{
|
|
43
28
|
providedIn: 'root',
|
|
@@ -48,29 +33,8 @@ DaffTestingGeographyService.ctorParameters = () => [
|
|
|
48
33
|
{ type: DaffCountryFactory },
|
|
49
34
|
{ type: DaffSubdivisionFactory }
|
|
50
35
|
];
|
|
51
|
-
/** @nocollapse */ DaffTestingGeographyService.ɵprov = ɵɵdefineInjectable({ factory: function DaffTestingGeographyService_Factory() { return new DaffTestingGeographyService(ɵɵinject(DaffCountryFactory), ɵɵinject(DaffSubdivisionFactory)); }, token: DaffTestingGeographyService, providedIn: "root" });
|
|
52
|
-
if (false) {
|
|
53
|
-
/**
|
|
54
|
-
* @type {?}
|
|
55
|
-
* @private
|
|
56
|
-
*/
|
|
57
|
-
DaffTestingGeographyService.prototype.countryFactory;
|
|
58
|
-
/**
|
|
59
|
-
* @type {?}
|
|
60
|
-
* @private
|
|
61
|
-
*/
|
|
62
|
-
DaffTestingGeographyService.prototype.subdivisionFactory;
|
|
63
|
-
}
|
|
64
36
|
|
|
65
|
-
/**
|
|
66
|
-
* @fileoverview added by tsickle
|
|
67
|
-
* Generated from: drivers/geography-driver.module.ts
|
|
68
|
-
* @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
69
|
-
*/
|
|
70
37
|
class DaffGeographyTestingDriverModule {
|
|
71
|
-
/**
|
|
72
|
-
* @return {?}
|
|
73
|
-
*/
|
|
74
38
|
static forRoot() {
|
|
75
39
|
return {
|
|
76
40
|
ngModule: DaffGeographyTestingDriverModule,
|
|
@@ -92,27 +56,7 @@ DaffGeographyTestingDriverModule.decorators = [
|
|
|
92
56
|
];
|
|
93
57
|
|
|
94
58
|
/**
|
|
95
|
-
*
|
|
96
|
-
* Generated from: drivers/public_api.ts
|
|
97
|
-
* @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
98
|
-
*/
|
|
99
|
-
|
|
100
|
-
/**
|
|
101
|
-
* @fileoverview added by tsickle
|
|
102
|
-
* Generated from: public_api.ts
|
|
103
|
-
* @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
104
|
-
*/
|
|
105
|
-
|
|
106
|
-
/**
|
|
107
|
-
* @fileoverview added by tsickle
|
|
108
|
-
* Generated from: index.ts
|
|
109
|
-
* @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
110
|
-
*/
|
|
111
|
-
|
|
112
|
-
/**
|
|
113
|
-
* @fileoverview added by tsickle
|
|
114
|
-
* Generated from: daffodil-geography-driver-testing.ts
|
|
115
|
-
* @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
59
|
+
* Generated bundle index. Do not edit.
|
|
116
60
|
*/
|
|
117
61
|
|
|
118
62
|
export { DaffGeographyTestingDriverModule, DaffTestingGeographyService };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"daffodil-geography-driver-testing.js","sources":["../../../libs/geography/driver/testing/src/drivers/geography.service.ts","../../../libs/geography/driver/testing/src/drivers/geography-driver.module.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 { DaffGeographyDriver } 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 {\n provide: DaffGeographyDriver,\n useExisting: DaffTestingGeographyService,\n },\n ],\n };\n }\n}\n"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"daffodil-geography-driver-testing.js","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 { DaffGeographyDriver } 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 {\n provide: DaffGeographyDriver,\n useExisting: DaffTestingGeographyService,\n },\n ],\n };\n }\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;AAaA;;;MAMa,2BAA2B;IAEtC,YACU,cAAkC,EAClC,kBAA0C;QAD1C,mBAAc,GAAd,cAAc,CAAoB;QAClC,uBAAkB,GAAlB,kBAAkB,CAAwB;KAChD;IAEJ,GAAG,CAAC,SAA4B;QAC9B,OAAO,EAAE,CAAC,IAAI,CAAC,cAAc,CAAC,MAAM,CAAC;YACnC,EAAE,EAAE,SAAS;YACb,YAAY,EAAE,IAAI,CAAC,kBAAkB,CAAC,UAAU,CAAC,CAAC,CAAC;SACpD,CAAC,CAAC,CAAC;KACL;IAED,IAAI;QACF,OAAO,EAAE,CAAC,IAAI,CAAC,cAAc,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,CAAC;KAC9C;;;;YAnBF,UAAU,SAAC;gBACV,UAAU,EAAE,MAAM;aACnB;;;;YATC,kBAAkB;YAClB,sBAAsB;;;MCKX,gCAAgC;IAC3C,OAAO,OAAO;QACZ,OAAO;YACL,QAAQ,EAAE,gCAAgC;YAC1C,SAAS,EAAE;gBACT;oBACE,OAAO,EAAE,mBAAmB;oBAC5B,WAAW,EAAE,2BAA2B;iBACzC;aACF;SACF,CAAC;KACH;;;YAhBF,QAAQ,SAAC;gBACR,OAAO,EAAE;oBACP,YAAY;iBACb;aACF;;;ACdD;;;;;;"}
|
|
@@ -1,92 +1,26 @@
|
|
|
1
1
|
import { DaffInheritableError } from '@daffodil/core';
|
|
2
2
|
import { InjectionToken } from '@angular/core';
|
|
3
3
|
|
|
4
|
-
/**
|
|
5
|
-
* @fileoverview added by tsickle
|
|
6
|
-
* Generated from: errors/country-not-found.ts
|
|
7
|
-
* @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
8
|
-
*/
|
|
9
4
|
class DaffCountryNotFoundError extends DaffInheritableError {
|
|
10
|
-
/**
|
|
11
|
-
* @param {?} message
|
|
12
|
-
*/
|
|
13
5
|
constructor(message) {
|
|
14
6
|
super(message);
|
|
15
7
|
this.message = message;
|
|
16
8
|
this.code = 'DAFF_GEOGRAPHY_COUNTRY_NOT_FOUND';
|
|
17
9
|
}
|
|
18
10
|
}
|
|
19
|
-
if (false) {
|
|
20
|
-
/** @type {?} */
|
|
21
|
-
DaffCountryNotFoundError.prototype.code;
|
|
22
|
-
/** @type {?} */
|
|
23
|
-
DaffCountryNotFoundError.prototype.message;
|
|
24
|
-
}
|
|
25
11
|
|
|
26
|
-
/**
|
|
27
|
-
* @fileoverview added by tsickle
|
|
28
|
-
* Generated from: errors/invalid-api-response.ts
|
|
29
|
-
* @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
30
|
-
*/
|
|
31
12
|
class DaffGeographyInvalidAPIResponseError extends DaffInheritableError {
|
|
32
|
-
/**
|
|
33
|
-
* @param {?} message
|
|
34
|
-
*/
|
|
35
13
|
constructor(message) {
|
|
36
14
|
super(message);
|
|
37
15
|
this.message = message;
|
|
38
16
|
this.code = 'DAFF_GEOGRAPHY_INVALID_API_RESPONSE';
|
|
39
17
|
}
|
|
40
18
|
}
|
|
41
|
-
if (false) {
|
|
42
|
-
/** @type {?} */
|
|
43
|
-
DaffGeographyInvalidAPIResponseError.prototype.code;
|
|
44
|
-
/** @type {?} */
|
|
45
|
-
DaffGeographyInvalidAPIResponseError.prototype.message;
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
/**
|
|
49
|
-
* @fileoverview added by tsickle
|
|
50
|
-
* Generated from: errors/public_api.ts
|
|
51
|
-
* @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
52
|
-
*/
|
|
53
19
|
|
|
54
|
-
/**
|
|
55
|
-
* @fileoverview added by tsickle
|
|
56
|
-
* Generated from: interfaces/geography-service.interface.ts
|
|
57
|
-
* @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
58
|
-
*/
|
|
59
|
-
/** @type {?} */
|
|
60
20
|
const DaffGeographyDriver = new InjectionToken('DaffGeographyDriver');
|
|
61
|
-
/**
|
|
62
|
-
* @record
|
|
63
|
-
* @template T
|
|
64
|
-
*/
|
|
65
|
-
function DaffGeographyServiceInterface() { }
|
|
66
|
-
if (false) {
|
|
67
|
-
/**
|
|
68
|
-
* Retrieves the list of countries available to the given store.
|
|
69
|
-
* @return {?}
|
|
70
|
-
*/
|
|
71
|
-
DaffGeographyServiceInterface.prototype.list = function () { };
|
|
72
|
-
/**
|
|
73
|
-
* Retrieve precise information about a specific country.
|
|
74
|
-
* @param {?} id
|
|
75
|
-
* @return {?}
|
|
76
|
-
*/
|
|
77
|
-
DaffGeographyServiceInterface.prototype.get = function (id) { };
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
/**
|
|
81
|
-
* @fileoverview added by tsickle
|
|
82
|
-
* Generated from: index.ts
|
|
83
|
-
* @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
84
|
-
*/
|
|
85
21
|
|
|
86
22
|
/**
|
|
87
|
-
*
|
|
88
|
-
* Generated from: daffodil-geography-driver.ts
|
|
89
|
-
* @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
23
|
+
* Generated bundle index. Do not edit.
|
|
90
24
|
*/
|
|
91
25
|
|
|
92
26
|
export { DaffCountryNotFoundError, DaffGeographyDriver, DaffGeographyInvalidAPIResponseError };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"daffodil-geography-driver.js","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"],"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 { InjectionToken } from '@angular/core';\nimport { Observable } from 'rxjs';\n\nimport { DaffCountry } from '@daffodil/geography';\n\nexport const DaffGeographyDriver = new InjectionToken<DaffGeographyServiceInterface>('DaffGeographyDriver');\n\nexport interface DaffGeographyServiceInterface<T extends DaffCountry = DaffCountry> {\n\t/**\n\t * Retrieves the list of countries available to the given store.\n\t */\n\tlist(): Observable<T[]>;\n\n\t/**\n\t * Retrieve precise information about a specific country.\n\t */\n\tget(id: T['id']): Observable<T>;\n}\n"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"daffodil-geography-driver.js","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 { InjectionToken } from '@angular/core';\nimport { Observable } from 'rxjs';\n\nimport { DaffCountry } from '@daffodil/geography';\n\nexport const DaffGeographyDriver = new InjectionToken<DaffGeographyServiceInterface>('DaffGeographyDriver');\n\nexport interface DaffGeographyServiceInterface<T extends DaffCountry = DaffCountry> {\n\t/**\n\t * Retrieves the list of countries available to the given store.\n\t */\n\tlist(): Observable<T[]>;\n\n\t/**\n\t * Retrieve precise information about a specific country.\n\t */\n\tget(id: T['id']): Observable<T>;\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;MAKa,wBAAyB,SAAQ,oBAAoB;IAGhE,YAAmB,OAAe;QAChC,KAAK,CAAC,OAAO,CAAC,CAAC;QADE,YAAO,GAAP,OAAO,CAAQ;QAFlB,SAAI,GAAW,kCAAkC,CAAC;KAIjE;;;MCLU,oCAAqC,SAAQ,oBAAoB;IAG5E,YAAmB,OAAe;QAChC,KAAK,CAAC,OAAO,CAAC,CAAC;QADE,YAAO,GAAP,OAAO,CAAQ;QAFlB,SAAI,GAAW,qCAAqC,CAAC;KAIpE;;;MCLU,mBAAmB,GAAG,IAAI,cAAc,CAAgC,qBAAqB;;ACL1G;;;;;;"}
|