@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
|
@@ -5,45 +5,22 @@
|
|
|
5
5
|
}(this, (function (exports, common, i0, driver, i1, rxjs, operators, angularInMemoryWebApi, i1$1) { 'use strict';
|
|
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
|
var DaffInMemoryGeographyService = /** @class */ (function () {
|
|
16
|
-
/**
|
|
17
|
-
* @param {?} http
|
|
18
|
-
*/
|
|
19
11
|
function DaffInMemoryGeographyService(http) {
|
|
20
12
|
this.http = http;
|
|
21
13
|
this.url = '/api/countries';
|
|
22
14
|
}
|
|
23
|
-
/**
|
|
24
|
-
* @param {?} countryId
|
|
25
|
-
* @return {?}
|
|
26
|
-
*/
|
|
27
15
|
DaffInMemoryGeographyService.prototype.get = function (countryId) {
|
|
28
|
-
return this.http.get(this.url + "/" + countryId).pipe(operators.catchError((
|
|
29
|
-
* @param {?} error
|
|
30
|
-
* @return {?}
|
|
31
|
-
*/function (error) { return rxjs.throwError(driver.DaffCountryNotFoundError); })), operators.map(( /**
|
|
32
|
-
* @param {?} result
|
|
33
|
-
* @return {?}
|
|
34
|
-
*/function (/**
|
|
35
|
-
* @param {?} result
|
|
36
|
-
* @return {?}
|
|
37
|
-
*/ result) { return result; })));
|
|
16
|
+
return this.http.get(this.url + "/" + countryId).pipe(operators.catchError(function (error) { return rxjs.throwError(driver.DaffCountryNotFoundError); }), operators.map(function (result) { return result; }));
|
|
38
17
|
};
|
|
39
|
-
/**
|
|
40
|
-
* @return {?}
|
|
41
|
-
*/
|
|
42
18
|
DaffInMemoryGeographyService.prototype.list = function () {
|
|
43
19
|
return this.http.get(this.url + "/");
|
|
44
20
|
};
|
|
45
21
|
return DaffInMemoryGeographyService;
|
|
46
22
|
}());
|
|
23
|
+
/** @nocollapse */ DaffInMemoryGeographyService.ɵprov = i0.ɵɵdefineInjectable({ factory: function DaffInMemoryGeographyService_Factory() { return new DaffInMemoryGeographyService(i0.ɵɵinject(i1.HttpClient)); }, token: DaffInMemoryGeographyService, providedIn: "root" });
|
|
47
24
|
DaffInMemoryGeographyService.decorators = [
|
|
48
25
|
{ type: i0.Injectable, args: [{
|
|
49
26
|
providedIn: 'root',
|
|
@@ -53,28 +30,10 @@
|
|
|
53
30
|
DaffInMemoryGeographyService.ctorParameters = function () { return [
|
|
54
31
|
{ type: i1.HttpClient }
|
|
55
32
|
]; };
|
|
56
|
-
/** @nocollapse */ DaffInMemoryGeographyService.ɵprov = i0.ɵɵdefineInjectable({ factory: function DaffInMemoryGeographyService_Factory() { return new DaffInMemoryGeographyService(i0.ɵɵinject(i1.HttpClient)); }, token: DaffInMemoryGeographyService, providedIn: "root" });
|
|
57
|
-
if (false) {
|
|
58
|
-
/** @type {?} */
|
|
59
|
-
DaffInMemoryGeographyService.prototype.url;
|
|
60
|
-
/**
|
|
61
|
-
* @type {?}
|
|
62
|
-
* @private
|
|
63
|
-
*/
|
|
64
|
-
DaffInMemoryGeographyService.prototype.http;
|
|
65
|
-
}
|
|
66
33
|
|
|
67
|
-
/**
|
|
68
|
-
* @fileoverview added by tsickle
|
|
69
|
-
* Generated from: drivers/geography-driver.module.ts
|
|
70
|
-
* @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
71
|
-
*/
|
|
72
34
|
var DaffGeographyInMemoryDriverModule = /** @class */ (function () {
|
|
73
35
|
function DaffGeographyInMemoryDriverModule() {
|
|
74
36
|
}
|
|
75
|
-
/**
|
|
76
|
-
* @return {?}
|
|
77
|
-
*/
|
|
78
37
|
DaffGeographyInMemoryDriverModule.forRoot = function () {
|
|
79
38
|
return {
|
|
80
39
|
ngModule: DaffGeographyInMemoryDriverModule,
|
|
@@ -96,50 +55,27 @@
|
|
|
96
55
|
},] }
|
|
97
56
|
];
|
|
98
57
|
|
|
99
|
-
/**
|
|
100
|
-
* @fileoverview added by tsickle
|
|
101
|
-
* Generated from: drivers/public_api.ts
|
|
102
|
-
* @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
103
|
-
*/
|
|
104
|
-
|
|
105
|
-
/**
|
|
106
|
-
* @fileoverview added by tsickle
|
|
107
|
-
* Generated from: backend/geography.service.ts
|
|
108
|
-
* @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
109
|
-
*/
|
|
110
58
|
/**
|
|
111
59
|
* An in-memory service that stubs out the backend services for getting countries.
|
|
112
60
|
*
|
|
113
|
-
*
|
|
61
|
+
* @inheritdoc
|
|
114
62
|
*/
|
|
115
63
|
var DaffInMemoryBackendGeographyService = /** @class */ (function () {
|
|
116
|
-
/**
|
|
117
|
-
* @param {?} countryFactory
|
|
118
|
-
* @param {?} subdivisionFactory
|
|
119
|
-
*/
|
|
120
64
|
function DaffInMemoryBackendGeographyService(countryFactory, subdivisionFactory) {
|
|
121
65
|
var _this = this;
|
|
122
66
|
this.countryFactory = countryFactory;
|
|
123
67
|
this.subdivisionFactory = subdivisionFactory;
|
|
124
68
|
this.countries = this.countryFactory.createMany(5);
|
|
125
|
-
this.countries.forEach((
|
|
126
|
-
* @param {?} country
|
|
127
|
-
* @return {?}
|
|
128
|
-
*/function (/**
|
|
129
|
-
* @param {?} country
|
|
130
|
-
* @return {?}
|
|
131
|
-
*/ country) { return country.subdivisions = _this.subdivisionFactory.createMany(5); }));
|
|
69
|
+
this.countries.forEach(function (country) { return country.subdivisions = _this.subdivisionFactory.createMany(5); });
|
|
132
70
|
}
|
|
133
71
|
/**
|
|
134
72
|
* Creates a fake database of countries for the geography inmemory backend service.
|
|
135
73
|
*
|
|
136
|
-
*
|
|
137
|
-
* @
|
|
138
|
-
* @return {?} A fake database of an array of countries
|
|
74
|
+
* @docs-private
|
|
75
|
+
* @returns A fake database of an array of countries
|
|
139
76
|
*/
|
|
140
77
|
DaffInMemoryBackendGeographyService.prototype.createDb = function (reqInfo) {
|
|
141
78
|
if (reqInfo) {
|
|
142
|
-
/** @type {?} */
|
|
143
79
|
var seedData = reqInfo.utils.getJsonBody(reqInfo.req).countries;
|
|
144
80
|
if (seedData) {
|
|
145
81
|
this.countries = seedData;
|
|
@@ -151,42 +87,23 @@
|
|
|
151
87
|
};
|
|
152
88
|
/**
|
|
153
89
|
* Responds to GET requests.
|
|
154
|
-
* @param {?} reqInfo
|
|
155
|
-
* @return {?}
|
|
156
90
|
*/
|
|
157
91
|
DaffInMemoryBackendGeographyService.prototype.get = function (reqInfo) {
|
|
158
92
|
var _this = this;
|
|
159
|
-
return reqInfo.utils.createResponse$((
|
|
160
|
-
* @return {?}
|
|
161
|
-
*/function () { return ({
|
|
93
|
+
return reqInfo.utils.createResponse$(function () { return ({
|
|
162
94
|
body: reqInfo.id ? _this.getCountry(reqInfo) : _this.listCountries(reqInfo),
|
|
163
95
|
status: angularInMemoryWebApi.STATUS.OK,
|
|
164
|
-
}); })
|
|
96
|
+
}); });
|
|
165
97
|
};
|
|
166
|
-
/**
|
|
167
|
-
* @private
|
|
168
|
-
* @param {?} reqInfo
|
|
169
|
-
* @return {?}
|
|
170
|
-
*/
|
|
171
98
|
DaffInMemoryBackendGeographyService.prototype.getCountry = function (reqInfo) {
|
|
172
|
-
return reqInfo.collection.find((
|
|
173
|
-
* @param {?} country
|
|
174
|
-
* @return {?}
|
|
175
|
-
*/function (/**
|
|
176
|
-
* @param {?} country
|
|
177
|
-
* @return {?}
|
|
178
|
-
*/ country) { return country.id === reqInfo.id; }));
|
|
99
|
+
return reqInfo.collection.find(function (country) { return country.id === reqInfo.id; });
|
|
179
100
|
};
|
|
180
|
-
/**
|
|
181
|
-
* @private
|
|
182
|
-
* @param {?} reqInfo
|
|
183
|
-
* @return {?}
|
|
184
|
-
*/
|
|
185
101
|
DaffInMemoryBackendGeographyService.prototype.listCountries = function (reqInfo) {
|
|
186
102
|
return reqInfo.collection;
|
|
187
103
|
};
|
|
188
104
|
return DaffInMemoryBackendGeographyService;
|
|
189
105
|
}());
|
|
106
|
+
/** @nocollapse */ DaffInMemoryBackendGeographyService.ɵprov = i0.ɵɵdefineInjectable({ factory: function DaffInMemoryBackendGeographyService_Factory() { return new DaffInMemoryBackendGeographyService(i0.ɵɵinject(i1$1.DaffCountryFactory), i0.ɵɵinject(i1$1.DaffSubdivisionFactory)); }, token: DaffInMemoryBackendGeographyService, providedIn: "root" });
|
|
190
107
|
DaffInMemoryBackendGeographyService.decorators = [
|
|
191
108
|
{ type: i0.Injectable, args: [{
|
|
192
109
|
providedIn: 'root',
|
|
@@ -197,38 +114,9 @@
|
|
|
197
114
|
{ type: i1$1.DaffCountryFactory },
|
|
198
115
|
{ type: i1$1.DaffSubdivisionFactory }
|
|
199
116
|
]; };
|
|
200
|
-
/** @nocollapse */ DaffInMemoryBackendGeographyService.ɵprov = i0.ɵɵdefineInjectable({ factory: function DaffInMemoryBackendGeographyService_Factory() { return new DaffInMemoryBackendGeographyService(i0.ɵɵinject(i1$1.DaffCountryFactory), i0.ɵɵinject(i1$1.DaffSubdivisionFactory)); }, token: DaffInMemoryBackendGeographyService, providedIn: "root" });
|
|
201
|
-
if (false) {
|
|
202
|
-
/** @type {?} */
|
|
203
|
-
DaffInMemoryBackendGeographyService.prototype.countries;
|
|
204
|
-
/**
|
|
205
|
-
* @type {?}
|
|
206
|
-
* @private
|
|
207
|
-
*/
|
|
208
|
-
DaffInMemoryBackendGeographyService.prototype.countryFactory;
|
|
209
|
-
/**
|
|
210
|
-
* @type {?}
|
|
211
|
-
* @private
|
|
212
|
-
*/
|
|
213
|
-
DaffInMemoryBackendGeographyService.prototype.subdivisionFactory;
|
|
214
|
-
}
|
|
215
|
-
|
|
216
|
-
/**
|
|
217
|
-
* @fileoverview added by tsickle
|
|
218
|
-
* Generated from: public_api.ts
|
|
219
|
-
* @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
220
|
-
*/
|
|
221
|
-
|
|
222
|
-
/**
|
|
223
|
-
* @fileoverview added by tsickle
|
|
224
|
-
* Generated from: index.ts
|
|
225
|
-
* @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
226
|
-
*/
|
|
227
117
|
|
|
228
118
|
/**
|
|
229
|
-
*
|
|
230
|
-
* Generated from: daffodil-geography-driver-in-memory.ts
|
|
231
|
-
* @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
119
|
+
* Generated bundle index. Do not edit.
|
|
232
120
|
*/
|
|
233
121
|
|
|
234
122
|
exports.DaffGeographyInMemoryDriverModule = DaffGeographyInMemoryDriverModule;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"daffodil-geography-driver-in-memory.umd.js","sources":["../../../libs/geography/driver/in-memory/src/drivers/geography.service.ts","../../../libs/geography/driver/in-memory/src/drivers/geography-driver.module.ts","../../../libs/geography/driver/in-memory/src/backend/geography.service.ts"],"sourcesContent":["import { HttpClient } from '@angular/common/http';\nimport { Injectable } from '@angular/core';\nimport {\n Observable,\n throwError,\n} from 'rxjs';\nimport {\n catchError,\n map,\n} from 'rxjs/operators';\n\nimport { DaffCountry } from '@daffodil/geography';\nimport {\n DaffGeographyServiceInterface,\n DaffCountryNotFoundError,\n} from '@daffodil/geography/driver';\n\n/**\n * @inheritdoc\n */\n@Injectable({\n providedIn: 'root',\n})\nexport class DaffInMemoryGeographyService implements DaffGeographyServiceInterface<DaffCountry> {\n url = '/api/countries';\n\n constructor(private http: HttpClient) {}\n\n get(countryId: DaffCountry['id']): Observable<DaffCountry> {\n return this.http.get<DaffCountry>(`${this.url}/${countryId}`).pipe(\n catchError((error: Error) => throwError(DaffCountryNotFoundError)),\n map(result => result),\n );\n }\n\n list(): Observable<DaffCountry[]> {\n return this.http.get<DaffCountry[]>(`${this.url}/`);\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 { DaffInMemoryGeographyService } from './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 {\n provide: DaffGeographyDriver,\n useExisting: DaffInMemoryGeographyService,\n },\n ],\n };\n }\n}\n","import { Injectable } from '@angular/core';\nimport {\n InMemoryDbService,\n RequestInfo,\n STATUS,\n} from 'angular-in-memory-web-api';\n\nimport { DaffInMemoryDataServiceInterface } from '@daffodil/core/testing';\nimport { DaffCountry } from '@daffodil/geography';\nimport {\n DaffCountryFactory,\n DaffSubdivisionFactory,\n} from '@daffodil/geography/testing';\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, DaffInMemoryDataServiceInterface {\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 reqInfo.collection.find(country => country.id === reqInfo.id);\n }\n\n private listCountries(reqInfo: RequestInfo) {\n return reqInfo.collection;\n }\n}\n"],"names":["catchError","throwError","DaffCountryNotFoundError","map","Injectable","HttpClient","DaffGeographyDriver","NgModule","CommonModule","STATUS","DaffCountryFactory","DaffSubdivisionFactory"],"mappings":"
|
|
1
|
+
{"version":3,"file":"daffodil-geography-driver-in-memory.umd.js","sources":["../../../libs/geography/driver/in-memory/src/drivers/geography.service.ts","../../../libs/geography/driver/in-memory/src/drivers/geography-driver.module.ts","../../../libs/geography/driver/in-memory/src/backend/geography.service.ts","../../../libs/geography/driver/in-memory/src/daffodil-geography-driver-in-memory.ts"],"sourcesContent":["import { HttpClient } from '@angular/common/http';\nimport { Injectable } from '@angular/core';\nimport {\n Observable,\n throwError,\n} from 'rxjs';\nimport {\n catchError,\n map,\n} from 'rxjs/operators';\n\nimport { DaffCountry } from '@daffodil/geography';\nimport {\n DaffGeographyServiceInterface,\n DaffCountryNotFoundError,\n} from '@daffodil/geography/driver';\n\n/**\n * @inheritdoc\n */\n@Injectable({\n providedIn: 'root',\n})\nexport class DaffInMemoryGeographyService implements DaffGeographyServiceInterface<DaffCountry> {\n url = '/api/countries';\n\n constructor(private http: HttpClient) {}\n\n get(countryId: DaffCountry['id']): Observable<DaffCountry> {\n return this.http.get<DaffCountry>(`${this.url}/${countryId}`).pipe(\n catchError((error: Error) => throwError(DaffCountryNotFoundError)),\n map(result => result),\n );\n }\n\n list(): Observable<DaffCountry[]> {\n return this.http.get<DaffCountry[]>(`${this.url}/`);\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 { DaffInMemoryGeographyService } from './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 {\n provide: DaffGeographyDriver,\n useExisting: DaffInMemoryGeographyService,\n },\n ],\n };\n }\n}\n","import { Injectable } from '@angular/core';\nimport {\n InMemoryDbService,\n RequestInfo,\n STATUS,\n} from 'angular-in-memory-web-api';\n\nimport { DaffInMemoryDataServiceInterface } from '@daffodil/core/testing';\nimport { DaffCountry } from '@daffodil/geography';\nimport {\n DaffCountryFactory,\n DaffSubdivisionFactory,\n} from '@daffodil/geography/testing';\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, DaffInMemoryDataServiceInterface {\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 reqInfo.collection.find(country => country.id === reqInfo.id);\n }\n\n private listCountries(reqInfo: RequestInfo) {\n return reqInfo.collection;\n }\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":["catchError","throwError","DaffCountryNotFoundError","map","Injectable","HttpClient","DaffGeographyDriver","NgModule","CommonModule","STATUS","DaffCountryFactory","DaffSubdivisionFactory"],"mappings":";;;;;;IAiBA;;;;QASE,sCAAoB,IAAgB;YAAhB,SAAI,GAAJ,IAAI,CAAY;YAFpC,QAAG,GAAG,gBAAgB,CAAC;SAEiB;QAExC,0CAAG,GAAH,UAAI,SAA4B;YAC9B,OAAO,IAAI,CAAC,IAAI,CAAC,GAAG,CAAiB,IAAI,CAAC,GAAG,SAAI,SAAW,CAAC,CAAC,IAAI,CAChEA,oBAAU,CAAC,UAAC,KAAY,IAAK,OAAAC,eAAU,CAACC,+BAAwB,CAAC,GAAA,CAAC,EAClEC,aAAG,CAAC,UAAA,MAAM,IAAI,OAAA,MAAM,GAAA,CAAC,CACtB,CAAC;SACH;QAED,2CAAI,GAAJ;YACE,OAAO,IAAI,CAAC,IAAI,CAAC,GAAG,CAAmB,IAAI,CAAC,GAAG,MAAG,CAAC,CAAC;SACrD;;;;;gBAjBFC,aAAU,SAAC;oBACV,UAAU,EAAE,MAAM;iBACnB;;;;gBAtBQC,aAAU;;;;QCenB;;QACS,yCAAO,GAAd;YACE,OAAO;gBACL,QAAQ,EAAE,iCAAiC;gBAC3C,SAAS,EAAE;oBACT;wBACE,OAAO,EAAEC,0BAAmB;wBAC5B,WAAW,EAAE,4BAA4B;qBAC1C;iBACF;aACF,CAAC;SACH;;;;gBAhBFC,WAAQ,SAAC;oBACR,OAAO,EAAE;wBACPC,mBAAY;qBACb;iBACF;;;ICAD;;;;;;QAWE,6CACU,cAAkC,EAClC,kBAA0C;YAFpD,iBAMC;YALS,mBAAc,GAAd,cAAc,CAAoB;YAClC,uBAAkB,GAAlB,kBAAkB,CAAwB;YAElD,IAAI,CAAC,SAAS,GAAG,IAAI,CAAC,cAAc,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC;YACnD,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,UAAA,OAAO,IAAI,OAAA,OAAO,CAAC,YAAY,GAAG,KAAI,CAAC,kBAAkB,CAAC,UAAU,CAAC,CAAC,CAAC,GAAA,CAAC,CAAC;SACjG;;;;;;;QAQD,sDAAQ,GAAR,UAAS,OAAoB;YAC3B,IAAI,OAAO,EAAE;gBACX,IAAM,QAAQ,GAAG,OAAO,CAAC,KAAK,CAAC,WAAW,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,SAAS,CAAC;gBAClE,IAAI,QAAQ,EAAE;oBACZ,IAAI,CAAC,SAAS,GAAG,QAAQ,CAAC;iBAC3B;aACF;YAED,OAAO;gBACL,SAAS,EAAE,IAAI,CAAC,SAAS;aAC1B,CAAC;SACH;;;;QAKD,iDAAG,GAAH,UAAI,OAAoB;YAAxB,iBAKC;YAJC,OAAO,OAAO,CAAC,KAAK,CAAC,eAAe,CAAC,cAAM,QAAC;gBAC1C,IAAI,EAAE,OAAO,CAAC,EAAE,GAAG,KAAI,CAAC,UAAU,CAAC,OAAO,CAAC,GAAG,KAAI,CAAC,aAAa,CAAC,OAAO,CAAC;gBACzE,MAAM,EAAEC,4BAAM,CAAC,EAAE;aAClB,IAAC,CAAC,CAAC;SACL;QAEO,wDAAU,GAAV,UAAW,OAAoB;YACrC,OAAO,OAAO,CAAC,UAAU,CAAC,IAAI,CAAC,UAAA,OAAO,IAAI,OAAA,OAAO,CAAC,EAAE,KAAK,OAAO,CAAC,EAAE,GAAA,CAAC,CAAC;SACtE;QAEO,2DAAa,GAAb,UAAc,OAAoB;YACxC,OAAO,OAAO,CAAC,UAAU,CAAC;SAC3B;;;;;gBAjDFL,aAAU,SAAC;oBACV,UAAU,EAAE,MAAM;iBACnB;;;;gBAXCM,uBAAkB;gBAClBC,2BAAsB;;;ICXxB;;;;;;;;;;;;;;"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
!function(r,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports,require("@angular/common"),require("@angular/core"),require("@daffodil/geography/driver"),require("@angular/common/http"),require("rxjs"),require("rxjs/operators"),require("angular-in-memory-web-api"),require("@daffodil/geography/testing")):"function"==typeof define&&define.amd?define("@daffodil/geography/driver/in-memory",["exports","@angular/common","@angular/core","@daffodil/geography/driver","@angular/common/http","rxjs","rxjs/operators","angular-in-memory-web-api","@daffodil/geography/testing"],e):e(((r="undefined"!=typeof globalThis?globalThis:r||self).daffodil=r.daffodil||{},r.daffodil.geography=r.daffodil.geography||{},r.daffodil.geography.driver=r.daffodil.geography.driver||{},r.daffodil.geography.driver["in-memory"]={}),r.ng.common,r.ng.core,r.daffodil.geography.driver,r.ng.common.http,r.rxjs,r.rxjs.operators,r.angularInMemoryWebApi,r.daffodil.geography.testing)}(this,(function(r,e,o,t,n,i,a,u,f){"use strict";var c=function(){function r(r){this.http=r,this.url="/api/countries"}return r.prototype.get=function(r){return this.http.get(this.url+"/"+r).pipe(a.catchError((function(r){return i.throwError(t.DaffCountryNotFoundError)})),a.map((function(r){return r})))},r.prototype.list=function(){return this.http.get(this.url+"/")},r}();c.decorators=[{type:o.Injectable,args:[{providedIn:"root"}]}],c.ctorParameters=function(){return[{type:n.HttpClient}]}
|
|
1
|
+
!function(r,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports,require("@angular/common"),require("@angular/core"),require("@daffodil/geography/driver"),require("@angular/common/http"),require("rxjs"),require("rxjs/operators"),require("angular-in-memory-web-api"),require("@daffodil/geography/testing")):"function"==typeof define&&define.amd?define("@daffodil/geography/driver/in-memory",["exports","@angular/common","@angular/core","@daffodil/geography/driver","@angular/common/http","rxjs","rxjs/operators","angular-in-memory-web-api","@daffodil/geography/testing"],e):e(((r="undefined"!=typeof globalThis?globalThis:r||self).daffodil=r.daffodil||{},r.daffodil.geography=r.daffodil.geography||{},r.daffodil.geography.driver=r.daffodil.geography.driver||{},r.daffodil.geography.driver["in-memory"]={}),r.ng.common,r.ng.core,r.daffodil.geography.driver,r.ng.common.http,r.rxjs,r.rxjs.operators,r.angularInMemoryWebApi,r.daffodil.geography.testing)}(this,(function(r,e,o,t,n,i,a,u,f){"use strict";var c=function(){function r(r){this.http=r,this.url="/api/countries"}return r.prototype.get=function(r){return this.http.get(this.url+"/"+r).pipe(a.catchError((function(r){return i.throwError(t.DaffCountryNotFoundError)})),a.map((function(r){return r})))},r.prototype.list=function(){return this.http.get(this.url+"/")},r}();c.ɵprov=o.ɵɵdefineInjectable({factory:function(){return new c(o.ɵɵinject(n.HttpClient))},token:c,providedIn:"root"}),c.decorators=[{type:o.Injectable,args:[{providedIn:"root"}]}],c.ctorParameters=function(){return[{type:n.HttpClient}]};var d=function(){function r(){}return r.forRoot=function(){return{ngModule:r,providers:[{provide:t.DaffGeographyDriver,useExisting:c}]}},r}();d.decorators=[{type:o.NgModule,args:[{imports:[e.CommonModule]}]}];var s=function(){function r(r,e){var o=this;this.countryFactory=r,this.subdivisionFactory=e,this.countries=this.countryFactory.createMany(5),this.countries.forEach((function(r){return r.subdivisions=o.subdivisionFactory.createMany(5)}))}return r.prototype.createDb=function(r){if(r){var e=r.utils.getJsonBody(r.req).countries;e&&(this.countries=e)}return{countries:this.countries}},r.prototype.get=function(r){var e=this;return r.utils.createResponse$((function(){return{body:r.id?e.getCountry(r):e.listCountries(r),status:u.STATUS.OK}}))},r.prototype.getCountry=function(r){return r.collection.find((function(e){return e.id===r.id}))},r.prototype.listCountries=function(r){return r.collection},r}();s.ɵprov=o.ɵɵdefineInjectable({factory:function(){return new s(o.ɵɵinject(f.DaffCountryFactory),o.ɵɵinject(f.DaffSubdivisionFactory))},token:s,providedIn:"root"}),s.decorators=[{type:o.Injectable,args:[{providedIn:"root"}]}],s.ctorParameters=function(){return[{type:f.DaffCountryFactory},{type:f.DaffSubdivisionFactory}]},r.DaffGeographyInMemoryDriverModule=d,r.DaffInMemoryBackendGeographyService=s,r.DaffInMemoryGeographyService=c,Object.defineProperty(r,"__esModule",{value:!0})}));
|
|
2
2
|
//# sourceMappingURL=daffodil-geography-driver-in-memory.umd.min.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../libs/geography/driver/in-memory/src/drivers/geography.service.ts","../../../libs/geography/driver/in-memory/src/drivers/geography-driver.module.ts","../../../libs/geography/driver/in-memory/src/backend/geography.service.ts"],"names":["DaffInMemoryGeographyService","http","this","url","prototype","get","countryId","pipe","catchError","error","throwError","DaffCountryNotFoundError","map","result","list","Injectable","args","providedIn","HttpClient","DaffGeographyInMemoryDriverModule","forRoot","ngModule","providers","provide","DaffGeographyDriver","useExisting","NgModule","imports","CommonModule","DaffInMemoryBackendGeographyService","countryFactory","subdivisionFactory","_this","countries","createMany","forEach","country","subdivisions","createDb","reqInfo","seedData","utils","getJsonBody","req","createResponse$","body","id","getCountry","listCountries","status","STATUS","OK","collection","find","DaffCountryFactory","DaffSubdivisionFactory"],"mappings":"ogCA0BE,SAAAA,EAAoBC,GAAAC,KAAAD,KAAAA,EAFpBC,KAAAC,IAAM,wBAINH,EAAAI,UAAAC,IAAA,SAAIC,GACF,OAAOJ,KAAKD,KAAKI,IAAoBH,KAAKC,IAAG,IAAIG,GAAaC,KAC5DC,EAAAA,
|
|
1
|
+
{"version":3,"sources":["../../../libs/geography/driver/in-memory/src/drivers/geography.service.ts","../../../libs/geography/driver/in-memory/src/drivers/geography-driver.module.ts","../../../libs/geography/driver/in-memory/src/backend/geography.service.ts"],"names":["DaffInMemoryGeographyService","http","this","url","prototype","get","countryId","pipe","catchError","error","throwError","DaffCountryNotFoundError","map","result","list","Injectable","args","providedIn","HttpClient","DaffGeographyInMemoryDriverModule","forRoot","ngModule","providers","provide","DaffGeographyDriver","useExisting","NgModule","imports","CommonModule","DaffInMemoryBackendGeographyService","countryFactory","subdivisionFactory","_this","countries","createMany","forEach","country","subdivisions","createDb","reqInfo","seedData","utils","getJsonBody","req","createResponse$","body","id","getCountry","listCountries","status","STATUS","OK","collection","find","DaffCountryFactory","DaffSubdivisionFactory"],"mappings":"ogCA0BE,SAAAA,EAAoBC,GAAAC,KAAAD,KAAAA,EAFpBC,KAAAC,IAAM,wBAINH,EAAAI,UAAAC,IAAA,SAAIC,GACF,OAAOJ,KAAKD,KAAKI,IAAoBH,KAAKC,IAAG,IAAIG,GAAaC,KAC5DC,EAAAA,YAAW,SAACC,GAAiB,OAAAC,EAAAA,WAAWC,EAAAA,6BACxCC,EAAAA,KAAI,SAAAC,GAAU,OAAAA,OAIlBb,EAAAI,UAAAU,KAAA,WACE,OAAOZ,KAAKD,KAAKI,IAAsBH,KAAKC,IAAG,oJAhBlDY,EAAAA,WAAUC,KAAA,CAAC,CACVC,WAAY,oDArBLC,EAAAA,+BCeT,SAAAC,YACSA,EAAAC,QAAP,WACE,MAAO,CACLC,SAAUF,EACVG,UAAW,CACT,CACEC,QAASC,EAAAA,oBACTC,YAAazB,+BAZtB0B,EAAAA,SAAQV,KAAA,CAAC,CACRW,QAAS,CACPC,EAAAA,mCCaF,SAAAC,EACUC,EACAC,GAFV,IAAAC,EAAA9B,KACUA,KAAA4B,eAAAA,EACA5B,KAAA6B,mBAAAA,EAER7B,KAAK+B,UAAY/B,KAAK4B,eAAeI,WAAW,GAChDhC,KAAK+B,UAAUE,SAAQ,SAAAC,GAAW,OAAAA,EAAQC,aAAeL,EAAKD,mBAAmBG,WAAW,aAS9FL,EAAAzB,UAAAkC,SAAA,SAASC,GACP,GAAIA,EAAS,CACX,IAAMC,EAAWD,EAAQE,MAAMC,YAAYH,EAAQI,KAAKV,UACpDO,IACFtC,KAAK+B,UAAYO,GAIrB,MAAO,CACLP,UAAW/B,KAAK+B,YAOpBJ,EAAAzB,UAAAC,IAAA,SAAIkC,GAAJ,IAAAP,EAAA9B,KACE,OAAOqC,EAAQE,MAAMG,iBAAgB,WAAM,MAAA,CACzCC,KAAMN,EAAQO,GAAKd,EAAKe,WAAWR,GAAWP,EAAKgB,cAAcT,GACjEU,OAAQC,EAAAA,OAAOC,QAIXtB,EAAAzB,UAAA2C,WAAA,SAAWR,GACjB,OAAOA,EAAQa,WAAWC,MAAK,SAAAjB,GAAW,OAAAA,EAAQU,KAAOP,EAAQO,OAG3DjB,EAAAzB,UAAA4C,cAAA,SAAcT,GACpB,OAAOA,EAAQa,uMAhDlBrC,EAAAA,WAAUC,KAAA,CAAC,CACVC,WAAY,oDAVZqC,EAAAA,0BACAC,EAAAA","sourcesContent":["import { HttpClient } from '@angular/common/http';\nimport { Injectable } from '@angular/core';\nimport {\n Observable,\n throwError,\n} from 'rxjs';\nimport {\n catchError,\n map,\n} from 'rxjs/operators';\n\nimport { DaffCountry } from '@daffodil/geography';\nimport {\n DaffGeographyServiceInterface,\n DaffCountryNotFoundError,\n} from '@daffodil/geography/driver';\n\n/**\n * @inheritdoc\n */\n@Injectable({\n providedIn: 'root',\n})\nexport class DaffInMemoryGeographyService implements DaffGeographyServiceInterface<DaffCountry> {\n url = '/api/countries';\n\n constructor(private http: HttpClient) {}\n\n get(countryId: DaffCountry['id']): Observable<DaffCountry> {\n return this.http.get<DaffCountry>(`${this.url}/${countryId}`).pipe(\n catchError((error: Error) => throwError(DaffCountryNotFoundError)),\n map(result => result),\n );\n }\n\n list(): Observable<DaffCountry[]> {\n return this.http.get<DaffCountry[]>(`${this.url}/`);\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 { DaffInMemoryGeographyService } from './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 {\n provide: DaffGeographyDriver,\n useExisting: DaffInMemoryGeographyService,\n },\n ],\n };\n }\n}\n","import { Injectable } from '@angular/core';\nimport {\n InMemoryDbService,\n RequestInfo,\n STATUS,\n} from 'angular-in-memory-web-api';\n\nimport { DaffInMemoryDataServiceInterface } from '@daffodil/core/testing';\nimport { DaffCountry } from '@daffodil/geography';\nimport {\n DaffCountryFactory,\n DaffSubdivisionFactory,\n} from '@daffodil/geography/testing';\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, DaffInMemoryDataServiceInterface {\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 reqInfo.collection.find(country => country.id === reqInfo.id);\n }\n\n private listCountries(reqInfo: RequestInfo) {\n return reqInfo.collection;\n }\n}\n"]}
|
|
@@ -4,11 +4,6 @@
|
|
|
4
4
|
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory((global.daffodil = global.daffodil || {}, global.daffodil.geography = global.daffodil.geography || {}, global.daffodil.geography.driver = global.daffodil.geography.driver || {}, global.daffodil.geography.driver.magento = {}), global.ng.core, global.i1, global.rxjs, global.rxjs.operators, global.magento, global.daffodil.geography.driver, global.ng.common));
|
|
5
5
|
}(this, (function (exports, i0, i1, rxjs, operators, magento, driver, common) { 'use strict';
|
|
6
6
|
|
|
7
|
-
/**
|
|
8
|
-
* @fileoverview added by tsickle
|
|
9
|
-
* Generated from: transforms/responses/subdivision.service.ts
|
|
10
|
-
* @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
11
|
-
*/
|
|
12
7
|
/**
|
|
13
8
|
* Transforms magento carts into an object usable by daffodil.
|
|
14
9
|
*/
|
|
@@ -17,61 +12,39 @@
|
|
|
17
12
|
}
|
|
18
13
|
/**
|
|
19
14
|
* Transforms the MagentoRegion from the magento region query into a DaffSubdivision.
|
|
20
|
-
* @param {?} region
|
|
21
|
-
* @return {?}
|
|
22
15
|
*/
|
|
23
16
|
DaffMagentoSubdivisionTransformer.prototype.transform = function (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
|
return DaffMagentoSubdivisionTransformer;
|
|
27
20
|
}());
|
|
21
|
+
/** @nocollapse */ DaffMagentoSubdivisionTransformer.ɵprov = i0.ɵɵdefineInjectable({ factory: function DaffMagentoSubdivisionTransformer_Factory() { return new DaffMagentoSubdivisionTransformer(); }, token: DaffMagentoSubdivisionTransformer, providedIn: "root" });
|
|
28
22
|
DaffMagentoSubdivisionTransformer.decorators = [
|
|
29
23
|
{ type: i0.Injectable, args: [{
|
|
30
24
|
providedIn: 'root',
|
|
31
25
|
},] }
|
|
32
26
|
];
|
|
33
|
-
/** @nocollapse */ DaffMagentoSubdivisionTransformer.ɵprov = i0.ɵɵdefineInjectable({ factory: function DaffMagentoSubdivisionTransformer_Factory() { return new DaffMagentoSubdivisionTransformer(); }, token: DaffMagentoSubdivisionTransformer, providedIn: "root" });
|
|
34
27
|
|
|
35
|
-
/**
|
|
36
|
-
* @fileoverview added by tsickle
|
|
37
|
-
* Generated from: transforms/responses/country.service.ts
|
|
38
|
-
* @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
39
|
-
*/
|
|
40
28
|
/**
|
|
41
29
|
* Transforms magento carts into an object usable by daffodil.
|
|
42
30
|
*/
|
|
43
31
|
var DaffMagentoCountryTransformer = /** @class */ (function () {
|
|
44
|
-
/**
|
|
45
|
-
* @param {?} subdivisionTransformer
|
|
46
|
-
*/
|
|
47
32
|
function DaffMagentoCountryTransformer(subdivisionTransformer) {
|
|
48
33
|
this.subdivisionTransformer = subdivisionTransformer;
|
|
49
34
|
}
|
|
50
|
-
/**
|
|
51
|
-
* @private
|
|
52
|
-
* @param {?} regions
|
|
53
|
-
* @return {?}
|
|
54
|
-
*/
|
|
55
35
|
DaffMagentoCountryTransformer.prototype.transformSubdivisions = function (regions) {
|
|
56
36
|
var _this = this;
|
|
57
|
-
return regions.map((
|
|
58
|
-
* @param {?} region
|
|
59
|
-
* @return {?}
|
|
60
|
-
*/function (/**
|
|
61
|
-
* @param {?} region
|
|
62
|
-
* @return {?}
|
|
63
|
-
*/ region) { return _this.subdivisionTransformer.transform(region); }));
|
|
37
|
+
return regions.map(function (region) { return _this.subdivisionTransformer.transform(region); });
|
|
64
38
|
};
|
|
65
39
|
/**
|
|
66
40
|
* Transforms the MagentoCountry from the magento country query into a DaffCountry.
|
|
67
|
-
* @param {?} country
|
|
68
|
-
* @return {?}
|
|
69
41
|
*/
|
|
70
42
|
DaffMagentoCountryTransformer.prototype.transform = function (country) {
|
|
71
43
|
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;
|
|
72
44
|
};
|
|
73
45
|
return DaffMagentoCountryTransformer;
|
|
74
46
|
}());
|
|
47
|
+
/** @nocollapse */ DaffMagentoCountryTransformer.ɵprov = i0.ɵɵdefineInjectable({ factory: function DaffMagentoCountryTransformer_Factory() { return new DaffMagentoCountryTransformer(i0.ɵɵinject(DaffMagentoSubdivisionTransformer)); }, token: DaffMagentoCountryTransformer, providedIn: "root" });
|
|
75
48
|
DaffMagentoCountryTransformer.decorators = [
|
|
76
49
|
{ type: i0.Injectable, args: [{
|
|
77
50
|
providedIn: 'root',
|
|
@@ -81,11 +54,6 @@
|
|
|
81
54
|
DaffMagentoCountryTransformer.ctorParameters = function () { return [
|
|
82
55
|
{ type: DaffMagentoSubdivisionTransformer }
|
|
83
56
|
]; };
|
|
84
|
-
/** @nocollapse */ DaffMagentoCountryTransformer.ɵprov = i0.ɵɵdefineInjectable({ factory: function DaffMagentoCountryTransformer_Factory() { return new DaffMagentoCountryTransformer(i0.ɵɵinject(DaffMagentoSubdivisionTransformer)); }, token: DaffMagentoCountryTransformer, providedIn: "root" });
|
|
85
|
-
if (false) {
|
|
86
|
-
/** @type {?} */
|
|
87
|
-
DaffMagentoCountryTransformer.prototype.subdivisionTransformer;
|
|
88
|
-
}
|
|
89
57
|
|
|
90
58
|
/*! *****************************************************************************
|
|
91
59
|
Copyright (c) Microsoft Corporation.
|
|
@@ -322,7 +290,7 @@
|
|
|
322
290
|
ar[i] = from[i];
|
|
323
291
|
}
|
|
324
292
|
}
|
|
325
|
-
return to.concat(ar || from);
|
|
293
|
+
return to.concat(ar || Array.prototype.slice.call(from));
|
|
326
294
|
}
|
|
327
295
|
function __await(v) {
|
|
328
296
|
return this instanceof __await ? (this.v = v, this) : new __await(v);
|
|
@@ -405,137 +373,57 @@
|
|
|
405
373
|
return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
|
|
406
374
|
}
|
|
407
375
|
|
|
408
|
-
/** @type {?} */
|
|
409
376
|
var countryFragment = i1.gql(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\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 fragment country on Country {\n id\n full_name_english\n full_name_locale\n three_letter_abbreviation\n two_letter_abbreviation\n }\n"])));
|
|
410
377
|
var templateObject_1;
|
|
411
378
|
|
|
412
|
-
/** @type {?} */
|
|
413
379
|
var regionFragment = i1.gql(templateObject_1$1 || (templateObject_1$1 = __makeTemplateObject(["\n fragment region on Region {\n code\n id\n name\n }\n"], ["\n fragment region on Region {\n code\n id\n name\n }\n"])));
|
|
414
380
|
var templateObject_1$1;
|
|
415
381
|
|
|
416
|
-
/**
|
|
417
|
-
* @fileoverview added by tsickle
|
|
418
|
-
* Generated from: queries/fragments/public_api.ts
|
|
419
|
-
* @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
420
|
-
*/
|
|
421
|
-
|
|
422
|
-
/** @type {?} */
|
|
423
382
|
var getCountries = i1.gql(templateObject_1$2 || (templateObject_1$2 = __makeTemplateObject(["\n query MagentoGetCountries {\n countries {\n ...country\n }\n }\n ", "\n"], ["\n query MagentoGetCountries {\n countries {\n ...country\n }\n }\n ", "\n"])), countryFragment);
|
|
424
383
|
var templateObject_1$2;
|
|
425
384
|
|
|
426
|
-
/** @type {?} */
|
|
427
385
|
var getCountry = i1.gql(templateObject_1$3 || (templateObject_1$3 = __makeTemplateObject(["\n query MagentoGetCountry($countryId: String!) {\n country(id: $countryId) {\n ...country\n available_regions {\n ...region\n }\n }\n }\n ", "\n ", "\n"], ["\n query MagentoGetCountry($countryId: String!) {\n country(id: $countryId) {\n ...country\n available_regions {\n ...region\n }\n }\n }\n ", "\n ", "\n"])), countryFragment, regionFragment);
|
|
428
386
|
var templateObject_1$3;
|
|
429
387
|
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
*/
|
|
435
|
-
|
|
436
|
-
/**
|
|
437
|
-
* @fileoverview added by tsickle
|
|
438
|
-
* Generated from: errors/codes.ts
|
|
439
|
-
* @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
440
|
-
*/
|
|
441
|
-
/** @enum {string} */
|
|
442
|
-
var MagentoGeographyGraphQlErrorCode = {
|
|
443
|
-
COUNTRY_NOT_FOUND: "graphql-no-such-entity",
|
|
444
|
-
};
|
|
388
|
+
var MagentoGeographyGraphQlErrorCode;
|
|
389
|
+
(function (MagentoGeographyGraphQlErrorCode) {
|
|
390
|
+
MagentoGeographyGraphQlErrorCode["COUNTRY_NOT_FOUND"] = "graphql-no-such-entity";
|
|
391
|
+
})(MagentoGeographyGraphQlErrorCode || (MagentoGeographyGraphQlErrorCode = {}));
|
|
445
392
|
|
|
446
393
|
var _a;
|
|
447
|
-
/** @type {?} */
|
|
448
394
|
var DaffGeographyMagentoErrorMap = (_a = {},
|
|
449
395
|
_a[MagentoGeographyGraphQlErrorCode.COUNTRY_NOT_FOUND] = driver.DaffCountryNotFoundError,
|
|
450
396
|
_a);
|
|
451
397
|
|
|
452
|
-
/**
|
|
453
|
-
* @fileoverview added by tsickle
|
|
454
|
-
* Generated from: errors/transform.ts
|
|
455
|
-
* @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
456
|
-
*/
|
|
457
|
-
/**
|
|
458
|
-
* @param {?} error
|
|
459
|
-
* @return {?}
|
|
460
|
-
*/
|
|
461
398
|
function transformMagentoGeographyError(error) {
|
|
462
399
|
return magento.daffTransformMagentoError(error, DaffGeographyMagentoErrorMap);
|
|
463
400
|
}
|
|
464
401
|
|
|
465
|
-
|
|
466
|
-
* @fileoverview added by tsickle
|
|
467
|
-
* Generated from: validators/get-countries.ts
|
|
468
|
-
* @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
469
|
-
*/
|
|
470
|
-
/** @type {?} */
|
|
471
|
-
var validateGetCountriesResponse = ( /**
|
|
472
|
-
* @param {?} response
|
|
473
|
-
* @return {?}
|
|
474
|
-
*/function (response) {
|
|
402
|
+
var validateGetCountriesResponse = function (response) {
|
|
475
403
|
if (response.data.countries) {
|
|
476
404
|
return response;
|
|
477
405
|
}
|
|
478
406
|
else {
|
|
479
407
|
throw new driver.DaffGeographyInvalidAPIResponseError('Get countries response does not contain a valid list of countries.');
|
|
480
408
|
}
|
|
481
|
-
}
|
|
482
|
-
|
|
483
|
-
/**
|
|
484
|
-
* @fileoverview added by tsickle
|
|
485
|
-
* Generated from: validators/public_api.ts
|
|
486
|
-
* @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
487
|
-
*/
|
|
409
|
+
};
|
|
488
410
|
|
|
489
|
-
/**
|
|
490
|
-
* @fileoverview added by tsickle
|
|
491
|
-
* Generated from: geography.service.ts
|
|
492
|
-
* @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
493
|
-
*/
|
|
494
411
|
/**
|
|
495
412
|
* A service for making Magento GraphQL queries for carts.
|
|
496
413
|
*
|
|
497
|
-
*
|
|
414
|
+
* @inheritdoc
|
|
498
415
|
*/
|
|
499
416
|
var DaffGeographyMagentoService = /** @class */ (function () {
|
|
500
|
-
/**
|
|
501
|
-
* @param {?} apollo
|
|
502
|
-
* @param {?} countryTransformer
|
|
503
|
-
*/
|
|
504
417
|
function DaffGeographyMagentoService(apollo, countryTransformer) {
|
|
505
418
|
this.apollo = apollo;
|
|
506
419
|
this.countryTransformer = countryTransformer;
|
|
507
420
|
}
|
|
508
|
-
/**
|
|
509
|
-
* @return {?}
|
|
510
|
-
*/
|
|
511
421
|
DaffGeographyMagentoService.prototype.list = function () {
|
|
512
422
|
var _this = this;
|
|
513
423
|
return this.apollo.query({
|
|
514
424
|
query: getCountries,
|
|
515
|
-
}).pipe(operators.map(validateGetCountriesResponse), operators.map((
|
|
516
|
-
* @param {?} result
|
|
517
|
-
* @return {?}
|
|
518
|
-
*/function (/**
|
|
519
|
-
* @param {?} result
|
|
520
|
-
* @return {?}
|
|
521
|
-
*/ result) { return result.data.countries.map(( /**
|
|
522
|
-
* @param {?} country
|
|
523
|
-
* @return {?}
|
|
524
|
-
*/function (/**
|
|
525
|
-
* @param {?} country
|
|
526
|
-
* @return {?}
|
|
527
|
-
*/ country) { return _this.countryTransformer.transform(country); })); })), operators.catchError(( /**
|
|
528
|
-
* @param {?} err
|
|
529
|
-
* @return {?}
|
|
530
|
-
*/function (/**
|
|
531
|
-
* @param {?} err
|
|
532
|
-
* @return {?}
|
|
533
|
-
*/ err) { return rxjs.throwError(transformMagentoGeographyError(err)); })));
|
|
425
|
+
}).pipe(operators.map(validateGetCountriesResponse), operators.map(function (result) { return result.data.countries.map(function (country) { return _this.countryTransformer.transform(country); }); }), operators.catchError(function (err) { return rxjs.throwError(transformMagentoGeographyError(err)); }));
|
|
534
426
|
};
|
|
535
|
-
/**
|
|
536
|
-
* @param {?} countryId
|
|
537
|
-
* @return {?}
|
|
538
|
-
*/
|
|
539
427
|
DaffGeographyMagentoService.prototype.get = function (countryId) {
|
|
540
428
|
var _this = this;
|
|
541
429
|
return this.apollo.query({
|
|
@@ -543,22 +431,11 @@
|
|
|
543
431
|
variables: {
|
|
544
432
|
countryId: countryId,
|
|
545
433
|
},
|
|
546
|
-
}).pipe(operators.map((
|
|
547
|
-
* @param {?} result
|
|
548
|
-
* @return {?}
|
|
549
|
-
*/function (/**
|
|
550
|
-
* @param {?} result
|
|
551
|
-
* @return {?}
|
|
552
|
-
*/ result) { return _this.countryTransformer.transform(result.data.country); })), operators.catchError(( /**
|
|
553
|
-
* @param {?} err
|
|
554
|
-
* @return {?}
|
|
555
|
-
*/function (/**
|
|
556
|
-
* @param {?} err
|
|
557
|
-
* @return {?}
|
|
558
|
-
*/ err) { return rxjs.throwError(transformMagentoGeographyError(err)); })));
|
|
434
|
+
}).pipe(operators.map(function (result) { return _this.countryTransformer.transform(result.data.country); }), operators.catchError(function (err) { return rxjs.throwError(transformMagentoGeographyError(err)); }));
|
|
559
435
|
};
|
|
560
436
|
return DaffGeographyMagentoService;
|
|
561
437
|
}());
|
|
438
|
+
/** @nocollapse */ DaffGeographyMagentoService.ɵprov = i0.ɵɵdefineInjectable({ factory: function DaffGeographyMagentoService_Factory() { return new DaffGeographyMagentoService(i0.ɵɵinject(i1.Apollo), i0.ɵɵinject(DaffMagentoCountryTransformer)); }, token: DaffGeographyMagentoService, providedIn: "root" });
|
|
562
439
|
DaffGeographyMagentoService.decorators = [
|
|
563
440
|
{ type: i0.Injectable, args: [{
|
|
564
441
|
providedIn: 'root',
|
|
@@ -569,28 +446,10 @@
|
|
|
569
446
|
{ type: i1.Apollo },
|
|
570
447
|
{ type: DaffMagentoCountryTransformer }
|
|
571
448
|
]; };
|
|
572
|
-
/** @nocollapse */ DaffGeographyMagentoService.ɵprov = i0.ɵɵdefineInjectable({ factory: function DaffGeographyMagentoService_Factory() { return new DaffGeographyMagentoService(i0.ɵɵinject(i1.Apollo), i0.ɵɵinject(DaffMagentoCountryTransformer)); }, token: DaffGeographyMagentoService, providedIn: "root" });
|
|
573
|
-
if (false) {
|
|
574
|
-
/**
|
|
575
|
-
* @type {?}
|
|
576
|
-
* @private
|
|
577
|
-
*/
|
|
578
|
-
DaffGeographyMagentoService.prototype.apollo;
|
|
579
|
-
/** @type {?} */
|
|
580
|
-
DaffGeographyMagentoService.prototype.countryTransformer;
|
|
581
|
-
}
|
|
582
449
|
|
|
583
|
-
/**
|
|
584
|
-
* @fileoverview added by tsickle
|
|
585
|
-
* Generated from: geography-driver.module.ts
|
|
586
|
-
* @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
587
|
-
*/
|
|
588
450
|
var DaffGeographyMagentoDriverModule = /** @class */ (function () {
|
|
589
451
|
function DaffGeographyMagentoDriverModule() {
|
|
590
452
|
}
|
|
591
|
-
/**
|
|
592
|
-
* @return {?}
|
|
593
|
-
*/
|
|
594
453
|
DaffGeographyMagentoDriverModule.forRoot = function () {
|
|
595
454
|
return {
|
|
596
455
|
ngModule: DaffGeographyMagentoDriverModule,
|
|
@@ -613,21 +472,7 @@
|
|
|
613
472
|
];
|
|
614
473
|
|
|
615
474
|
/**
|
|
616
|
-
*
|
|
617
|
-
* Generated from: public_api.ts
|
|
618
|
-
* @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
619
|
-
*/
|
|
620
|
-
|
|
621
|
-
/**
|
|
622
|
-
* @fileoverview added by tsickle
|
|
623
|
-
* Generated from: index.ts
|
|
624
|
-
* @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
625
|
-
*/
|
|
626
|
-
|
|
627
|
-
/**
|
|
628
|
-
* @fileoverview added by tsickle
|
|
629
|
-
* Generated from: daffodil-geography-driver-magento.ts
|
|
630
|
-
* @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
475
|
+
* Generated bundle index. Do not edit.
|
|
631
476
|
*/
|
|
632
477
|
|
|
633
478
|
exports.DaffGeographyMagentoDriverModule = DaffGeographyMagentoDriverModule;
|