@daffodil/product 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-product-driver-in-memory.umd.js +77 -160
- package/bundles/daffodil-product-driver-in-memory.umd.js.map +1 -1
- package/bundles/daffodil-product-driver-in-memory.umd.min.js +1 -1
- package/bundles/daffodil-product-driver-in-memory.umd.min.js.map +1 -1
- package/bundles/daffodil-product-driver-magento-testing.umd.js +12 -140
- package/bundles/daffodil-product-driver-magento-testing.umd.js.map +1 -1
- package/bundles/daffodil-product-driver-magento-testing.umd.min.js +1 -1
- package/bundles/daffodil-product-driver-magento-testing.umd.min.js.map +1 -1
- package/bundles/daffodil-product-driver-magento.umd.js +87 -676
- package/bundles/daffodil-product-driver-magento.umd.js.map +1 -1
- package/bundles/daffodil-product-driver-magento.umd.min.js +2 -2
- package/bundles/daffodil-product-driver-magento.umd.min.js.map +1 -1
- package/bundles/daffodil-product-driver-shopify.umd.js +14 -160
- package/bundles/daffodil-product-driver-shopify.umd.js.map +1 -1
- package/bundles/daffodil-product-driver-shopify.umd.min.js +1 -1
- package/bundles/daffodil-product-driver-shopify.umd.min.js.map +1 -1
- package/bundles/daffodil-product-driver-testing.umd.js +4 -62
- package/bundles/daffodil-product-driver-testing.umd.js.map +1 -1
- package/bundles/daffodil-product-driver-testing.umd.min.js +1 -1
- package/bundles/daffodil-product-driver-testing.umd.min.js.map +1 -1
- package/bundles/daffodil-product-driver.umd.js +12 -64
- package/bundles/daffodil-product-driver.umd.js.map +1 -1
- package/bundles/daffodil-product-routing.umd.js +4 -112
- package/bundles/daffodil-product-routing.umd.js.map +1 -1
- package/bundles/daffodil-product-routing.umd.min.js +1 -1
- package/bundles/daffodil-product-routing.umd.min.js.map +1 -1
- package/bundles/daffodil-product-state-testing.umd.js +15 -240
- package/bundles/daffodil-product-state-testing.umd.js.map +1 -1
- package/bundles/daffodil-product-state-testing.umd.min.js +1 -1
- package/bundles/daffodil-product-state-testing.umd.min.js.map +1 -1
- package/bundles/daffodil-product-state.umd.js +347 -2359
- package/bundles/daffodil-product-state.umd.js.map +1 -1
- package/bundles/daffodil-product-state.umd.min.js +1 -1
- package/bundles/daffodil-product-state.umd.min.js.map +1 -1
- package/bundles/daffodil-product-testing.umd.js +20 -230
- package/bundles/daffodil-product-testing.umd.js.map +1 -1
- package/bundles/daffodil-product-testing.umd.min.js +1 -1
- package/bundles/daffodil-product-testing.umd.min.js.map +1 -1
- package/bundles/daffodil-product.umd.js +21 -209
- package/bundles/daffodil-product.umd.js.map +1 -1
- package/bundles/daffodil-product.umd.min.js +1 -1
- package/bundles/daffodil-product.umd.min.js.map +1 -1
- package/driver/in-memory/backend/product.service.d.ts +3 -2
- package/driver/in-memory/daffodil-product-driver-in-memory.metadata.json +1 -1
- package/driver/in-memory/package.json +1 -1
- package/driver/magento/package.json +1 -1
- package/driver/magento/testing/package.json +1 -1
- package/driver/package.json +1 -1
- package/driver/shopify/package.json +1 -1
- package/driver/testing/package.json +1 -1
- package/esm2015/daffodil-product.js +2 -7
- package/esm2015/driver/daffodil-product-driver.js +2 -7
- package/esm2015/driver/in-memory/backend/product.service.js +62 -83
- package/esm2015/driver/in-memory/daffodil-product-driver-in-memory.js +2 -7
- package/esm2015/driver/in-memory/driver/product-driver.module.js +1 -9
- package/esm2015/driver/in-memory/driver/product.service.js +11 -53
- package/esm2015/driver/in-memory/index.js +2 -7
- package/esm2015/driver/in-memory/public_api.js +1 -6
- package/esm2015/driver/index.js +2 -7
- package/esm2015/driver/interfaces/product-service.interface.js +1 -39
- package/esm2015/driver/magento/config/default.js +2 -8
- package/esm2015/driver/magento/config/public_api.js +1 -6
- package/esm2015/driver/magento/daffodil-product-driver-magento.js +2 -7
- package/esm2015/driver/magento/index.js +2 -7
- package/esm2015/driver/magento/injection-tokens/fragments/product-preview.token.js +7 -22
- package/esm2015/driver/magento/injection-tokens/fragments/product.token.js +5 -20
- package/esm2015/driver/magento/injection-tokens/public_api.js +1 -6
- package/esm2015/driver/magento/injection-tokens/transforms/product-preview/preview-extra.token.js +6 -21
- package/esm2015/driver/magento/injection-tokens/transforms/product-preview/preview.token.js +4 -24
- package/esm2015/driver/magento/injection-tokens/transforms/product-response/response-extra.token.js +5 -20
- package/esm2015/driver/magento/injection-tokens/transforms/product-response/response.token.js +4 -25
- package/esm2015/driver/magento/interfaces/config.interface.js +3 -38
- package/esm2015/driver/magento/interfaces/product-preview-extra-transform.type.js +2 -6
- package/esm2015/driver/magento/interfaces/product-preview-transform.type.js +2 -6
- package/esm2015/driver/magento/interfaces/product-response-extra-transform.type.js +2 -6
- package/esm2015/driver/magento/interfaces/product-response-transform.type.js +2 -6
- package/esm2015/driver/magento/interfaces/public_api.js +6 -11
- package/esm2015/driver/magento/models/bundled-product.js +9 -65
- package/esm2015/driver/magento/models/configurable-product.js +2 -72
- package/esm2015/driver/magento/models/get-product-response.interface.js +2 -16
- package/esm2015/driver/magento/models/magento-product.js +7 -38
- package/esm2015/driver/magento/models/product-preview.interface.js +6 -40
- package/esm2015/driver/magento/models/public_api.js +4 -9
- package/esm2015/driver/magento/models/simple-product.js +2 -18
- package/esm2015/driver/magento/product-driver.module.js +3 -12
- package/esm2015/driver/magento/product.service.js +7 -78
- package/esm2015/driver/magento/public_api.js +7 -12
- package/esm2015/driver/magento/queries/fragments/bundled-product.js +2 -8
- package/esm2015/driver/magento/queries/fragments/configurable-product.js +1 -7
- package/esm2015/driver/magento/queries/fragments/product-preview.js +1 -7
- package/esm2015/driver/magento/queries/fragments/product.js +1 -7
- package/esm2015/driver/magento/queries/fragments/simple-product.js +1 -7
- package/esm2015/driver/magento/queries/get-all-products.js +3 -14
- package/esm2015/driver/magento/queries/get-product-by-url.js +3 -14
- package/esm2015/driver/magento/queries/get-product.js +3 -14
- package/esm2015/driver/magento/queries/public_api.js +4 -9
- package/esm2015/driver/magento/testing/daffodil-product-driver-magento-testing.js +2 -7
- package/esm2015/driver/magento/testing/factories/bundle/bundle.factory.js +4 -15
- package/esm2015/driver/magento/testing/factories/configurable/configurable.factory.js +3 -46
- package/esm2015/driver/magento/testing/factories/core/product-preview.factory.js +2 -29
- package/esm2015/driver/magento/testing/factories/core/product.factory.js +3 -46
- package/esm2015/driver/magento/testing/factories/public_api.js +6 -11
- package/esm2015/driver/magento/testing/factories/simple/simple.factory.js +3 -12
- package/esm2015/driver/magento/testing/index.js +2 -7
- package/esm2015/driver/magento/testing/public_api.js +2 -7
- package/esm2015/driver/magento/transforms/bundled-product-transformers.js +4 -25
- package/esm2015/driver/magento/transforms/configurable-product-transformers.js +4 -38
- package/esm2015/driver/magento/transforms/product-preview.js +5 -35
- package/esm2015/driver/magento/transforms/product-response.js +2 -23
- package/esm2015/driver/magento/transforms/product-transformers.js +5 -32
- package/esm2015/driver/magento/transforms/public_api.js +7 -12
- package/esm2015/driver/magento/transforms/simple-product-transformers.js +3 -31
- package/esm2015/driver/magento/transforms/truncate-url.js +2 -12
- package/esm2015/driver/models/public_api.js +2 -6
- package/esm2015/driver/models/response.interface.js +2 -28
- package/esm2015/driver/public_api.js +2 -7
- package/esm2015/driver/shopify/daffodil-product-driver-shopify.js +2 -7
- package/esm2015/driver/shopify/index.js +2 -7
- package/esm2015/driver/shopify/product-driver.module.js +2 -10
- package/esm2015/driver/shopify/product.service.js +12 -132
- package/esm2015/driver/shopify/public_api.js +1 -6
- package/esm2015/driver/testing/daffodil-product-driver-testing.js +2 -7
- package/esm2015/driver/testing/drivers/product-driver.module.js +2 -10
- package/esm2015/driver/testing/drivers/product.service.js +3 -39
- package/esm2015/driver/testing/index.js +2 -7
- package/esm2015/driver/testing/public_api.js +1 -6
- package/esm2015/helpers.js +7 -22
- package/esm2015/index.js +2 -7
- package/esm2015/injection-tokens/error-matcher.token.js +3 -12
- package/esm2015/injection-tokens/public_api.js +1 -6
- package/esm2015/models/composite-configuration-item.js +2 -25
- package/esm2015/models/composite-product-item.js +8 -62
- package/esm2015/models/composite-product.js +2 -25
- package/esm2015/models/configurable-product.js +2 -125
- package/esm2015/models/prices.js +2 -45
- package/esm2015/models/product-image.js +2 -18
- package/esm2015/models/product.js +8 -105
- package/esm2015/public_api.js +10 -15
- package/esm2015/routing/daffodil-product-routing.js +2 -7
- package/esm2015/routing/index.js +2 -7
- package/esm2015/routing/public_api.js +2 -7
- package/esm2015/routing/resolvers/product-page/product-page.resolver.js +2 -21
- package/esm2015/routing/resolvers/product-page-id/product-page-id.resolver.js +2 -33
- package/esm2015/routing/resolvers/product-page-url/product-page-url.resolver.js +2 -40
- package/esm2015/routing/resolvers/public_api.js +1 -6
- package/esm2015/state/actions/best-sellers.actions.js +9 -39
- package/esm2015/state/actions/composite-product.actions.js +9 -29
- package/esm2015/state/actions/configurable-product.actions.js +8 -56
- package/esm2015/state/actions/product-grid.actions.js +9 -39
- package/esm2015/state/actions/product-page.actions.js +10 -60
- package/esm2015/state/actions/product.actions.js +8 -39
- package/esm2015/state/actions/public_api.js +7 -12
- package/esm2015/state/daffodil-product-state.js +2 -7
- package/esm2015/state/effects/best-seller.effects.js +4 -52
- package/esm2015/state/effects/product-grid.effects.js +4 -52
- package/esm2015/state/effects/product-page.effects.js +6 -68
- package/esm2015/state/effects/product.effects.js +4 -52
- package/esm2015/state/effects/public_api.js +1 -6
- package/esm2015/state/facades/best-sellers/best-sellers.facade.js +4 -31
- package/esm2015/state/facades/composite-product/composite-product-facade.interface.js +2 -86
- package/esm2015/state/facades/composite-product/composite-product.facade.js +4 -61
- package/esm2015/state/facades/configurable-product/configurable-product-facade.interface.js +2 -108
- package/esm2015/state/facades/configurable-product/configurable-product.facade.js +4 -78
- package/esm2015/state/facades/product/product-facade.interface.js +2 -70
- package/esm2015/state/facades/product/product.facade.js +3 -58
- package/esm2015/state/facades/product-grid/product-grid-facade.interface.js +2 -23
- package/esm2015/state/facades/product-grid/product-grid.facade.js +3 -27
- package/esm2015/state/facades/product-page/facade.interface.js +2 -24
- package/esm2015/state/facades/product-page/facade.js +3 -32
- package/esm2015/state/facades/public_api.js +1 -6
- package/esm2015/state/index.js +2 -7
- package/esm2015/state/product-state.module.js +1 -6
- package/esm2015/state/public_api.js +6 -11
- package/esm2015/state/reducers/best-sellers/best-sellers-reducer-state.interface.js +2 -28
- package/esm2015/state/reducers/best-sellers/best-sellers.reducer.js +3 -24
- package/esm2015/state/reducers/composite-product-entities/composite-product-entities-reducer-adapter.js +5 -18
- package/esm2015/state/reducers/composite-product-entities/composite-product-entities.reducer.js +12 -46
- package/esm2015/state/reducers/composite-product-entities/composite-product-entity.js +2 -25
- package/esm2015/state/reducers/configurable-product-entities/configurable-product-entities-reducer-adapter.js +4 -17
- package/esm2015/state/reducers/configurable-product-entities/configurable-product-entities.reducer.js +11 -67
- package/esm2015/state/reducers/configurable-product-entities/configurable-product-entity.js +2 -40
- package/esm2015/state/reducers/injection-tokens/config.token.js +4 -13
- package/esm2015/state/reducers/injection-tokens/meta.token.js +5 -21
- package/esm2015/state/reducers/injection-tokens/public_api.js +1 -6
- package/esm2015/state/reducers/product/product-reducer-state.interface.js +2 -33
- package/esm2015/state/reducers/product/product.reducer.js +4 -11
- package/esm2015/state/reducers/product-entities/product-entities-reducer-adapter.js +4 -18
- package/esm2015/state/reducers/product-entities/product-entities.reducer.js +4 -11
- package/esm2015/state/reducers/product-grid/product-grid-reducer-state.interface.js +2 -29
- package/esm2015/state/reducers/product-grid/product-grid.reducer.js +4 -11
- package/esm2015/state/reducers/product-reducers-state.interface.js +1 -35
- package/esm2015/state/reducers/product-reducers.js +1 -7
- package/esm2015/state/reducers/product-store-feature-key.js +1 -7
- package/esm2015/state/reducers/public_api.js +3 -8
- package/esm2015/state/selectors/all-selectors.selectors.js +3 -19
- package/esm2015/state/selectors/best-sellers/best-sellers.selectors.js +12 -84
- package/esm2015/state/selectors/composite-product/composite-product.selectors.js +48 -254
- package/esm2015/state/selectors/composite-product-entities/composite-product-entities.selectors.js +16 -122
- package/esm2015/state/selectors/configurable-product/configurable-product.selectors.js +41 -387
- package/esm2015/state/selectors/configurable-product-entities/configurable-product-entities.selectors.js +12 -106
- package/esm2015/state/selectors/product/product.selectors.js +12 -80
- package/esm2015/state/selectors/product-entities/product-entities.selectors.js +16 -191
- package/esm2015/state/selectors/product-feature.selector.js +5 -29
- package/esm2015/state/selectors/product-grid/product-grid.selectors.js +10 -57
- package/esm2015/state/selectors/public_api.js +11 -16
- package/esm2015/state/testing/daffodil-product-state-testing.js +2 -7
- package/esm2015/state/testing/index.js +2 -7
- package/esm2015/state/testing/mock-best-sellers.facade.js +3 -18
- package/esm2015/state/testing/mock-composite-product-facade.js +4 -52
- package/esm2015/state/testing/mock-configurable-product-facade.js +4 -65
- package/esm2015/state/testing/mock-product-facade.js +3 -53
- package/esm2015/state/testing/mock-product-grid-facade.js +3 -19
- package/esm2015/state/testing/mock-product-page-facade.js +3 -19
- package/esm2015/state/testing/product-testing.module.js +1 -6
- package/esm2015/state/testing/public_api.js +1 -6
- package/esm2015/testing/daffodil-product-testing.js +2 -7
- package/esm2015/testing/factories/composite-product.factory.js +3 -14
- package/esm2015/testing/factories/configurable-product.factory.js +2 -45
- package/esm2015/testing/factories/default-product.factory.js +2 -53
- package/esm2015/testing/factories/extension.factory.js +3 -30
- package/esm2015/testing/factories/kind.factory.js +2 -23
- package/esm2015/testing/factories/product-image.factory.js +2 -16
- package/esm2015/testing/factories/public_api.js +7 -12
- package/esm2015/testing/helpers.js +2 -8
- package/esm2015/testing/index.js +2 -7
- package/esm2015/testing/injection-tokens/factories/extra.token.js +6 -22
- package/esm2015/testing/injection-tokens/factories/type.token.js +5 -21
- package/esm2015/testing/injection-tokens/public_api.js +1 -6
- package/esm2015/testing/public_api.js +4 -9
- package/esm2015/testing/testing.module.js +1 -6
- package/fesm2015/daffodil-product-driver-in-memory.js +73 -158
- package/fesm2015/daffodil-product-driver-in-memory.js.map +1 -1
- package/fesm2015/daffodil-product-driver-magento-testing.js +12 -165
- package/fesm2015/daffodil-product-driver-magento-testing.js.map +1 -1
- package/fesm2015/daffodil-product-driver-magento.js +81 -801
- package/fesm2015/daffodil-product-driver-magento.js.map +1 -1
- package/fesm2015/daffodil-product-driver-shopify.js +14 -156
- package/fesm2015/daffodil-product-driver-shopify.js.map +1 -1
- package/fesm2015/daffodil-product-driver-testing.js +5 -63
- package/fesm2015/daffodil-product-driver-testing.js.map +1 -1
- package/fesm2015/daffodil-product-driver.js +1 -59
- package/fesm2015/daffodil-product-driver.js.map +1 -1
- package/fesm2015/daffodil-product-routing.js +5 -113
- package/fesm2015/daffodil-product-routing.js.map +1 -1
- package/fesm2015/daffodil-product-state-testing.js +16 -241
- package/fesm2015/daffodil-product-state-testing.js.map +1 -1
- package/fesm2015/daffodil-product-state.js +294 -2412
- package/fesm2015/daffodil-product-state.js.map +1 -1
- package/fesm2015/daffodil-product-testing.js +20 -256
- package/fesm2015/daffodil-product-testing.js.map +1 -1
- package/fesm2015/daffodil-product.js +23 -454
- package/fesm2015/daffodil-product.js.map +1 -1
- package/package.json +3 -3
- package/routing/package.json +1 -1
- 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, ɵɵinject, Injectable, NgModule } from '@angular/core';
|
|
2
2
|
import { STATUS } from 'angular-in-memory-web-api';
|
|
3
3
|
import { DaffProductExtensionFactory, DaffProductImageFactory, DaffProductTestingModule } from '@daffodil/product/testing';
|
|
4
4
|
import { HttpClient } from '@angular/common/http';
|
|
@@ -6,71 +6,70 @@ import { map } from 'rxjs/operators';
|
|
|
6
6
|
import { CommonModule } from '@angular/common';
|
|
7
7
|
import { DaffProductDriver } from '@daffodil/product/driver';
|
|
8
8
|
|
|
9
|
-
/**
|
|
10
|
-
* @fileoverview added by tsickle
|
|
11
|
-
* Generated from: backend/product.service.ts
|
|
12
|
-
* @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
13
|
-
*/
|
|
14
9
|
/**
|
|
15
10
|
* An in-memory service that stubs out the backend services for getting products.
|
|
16
11
|
*
|
|
17
|
-
*
|
|
18
|
-
*
|
|
19
|
-
*
|
|
12
|
+
* @Param productFactory: DaffProductFactory instance
|
|
13
|
+
* @Param productImageFactory: DaffProductImageFactory instance
|
|
14
|
+
* @Param products: An array of Products
|
|
20
15
|
*/
|
|
21
16
|
class DaffInMemoryBackendProductService {
|
|
22
|
-
/**
|
|
23
|
-
* @param {?} productFactory
|
|
24
|
-
* @param {?} productImageFactory
|
|
25
|
-
*/
|
|
26
17
|
constructor(productFactory, productImageFactory) {
|
|
27
18
|
this.productFactory = productFactory;
|
|
28
19
|
this.productImageFactory = productImageFactory;
|
|
29
|
-
this.
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
20
|
+
this._products = [];
|
|
21
|
+
this._products = [
|
|
22
|
+
'1001',
|
|
23
|
+
'1002',
|
|
24
|
+
'1003',
|
|
25
|
+
'1004',
|
|
26
|
+
'1005',
|
|
27
|
+
'1006',
|
|
28
|
+
'1007',
|
|
29
|
+
'1008',
|
|
30
|
+
'1009',
|
|
31
|
+
'1010',
|
|
32
|
+
'1011',
|
|
33
|
+
'1012',
|
|
34
|
+
'1013',
|
|
35
|
+
'1014',
|
|
36
|
+
'1015',
|
|
37
|
+
'1016',
|
|
38
|
+
'1017',
|
|
39
|
+
'1018',
|
|
40
|
+
'1019',
|
|
41
|
+
'1020',
|
|
42
|
+
'1021',
|
|
43
|
+
'1022',
|
|
44
|
+
'1023',
|
|
45
|
+
'1024',
|
|
46
|
+
'1025',
|
|
47
|
+
'1026',
|
|
48
|
+
'1027',
|
|
49
|
+
'1028',
|
|
50
|
+
'1029',
|
|
51
|
+
'1030',
|
|
52
|
+
'1031',
|
|
53
|
+
'1032',
|
|
54
|
+
'1033',
|
|
55
|
+
'1034',
|
|
56
|
+
'1035',
|
|
57
|
+
].map(id => this.productFactory.create({ id, url: `/${id}`, images: this.productImageFactory.createMany(5) }));
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* The collection of products in the backend.
|
|
61
|
+
*/
|
|
62
|
+
get products() {
|
|
63
|
+
return this._products;
|
|
66
64
|
}
|
|
65
|
+
;
|
|
67
66
|
/**
|
|
68
67
|
* Automatically called as part of the InMemoryDbService to parse incoming urls to match the InMemory backend urls.
|
|
69
68
|
*
|
|
70
|
-
*
|
|
71
|
-
* @param
|
|
72
|
-
* @
|
|
73
|
-
* @
|
|
69
|
+
* @param url initial url
|
|
70
|
+
* @param utils utility to parse url
|
|
71
|
+
* @returns ParsedRequestUrl
|
|
72
|
+
* @docs-private
|
|
74
73
|
*/
|
|
75
74
|
parseRequestUrl(url, utils) {
|
|
76
75
|
return utils.parseRequestUrl(url);
|
|
@@ -78,33 +77,31 @@ class DaffInMemoryBackendProductService {
|
|
|
78
77
|
/**
|
|
79
78
|
* Creates a fake database of products for the product inmemory backend service.
|
|
80
79
|
*
|
|
81
|
-
*
|
|
82
|
-
* @
|
|
80
|
+
* @returns A fake database of an array of products
|
|
81
|
+
* @docs-private
|
|
83
82
|
*/
|
|
84
83
|
createDb() {
|
|
85
84
|
return {
|
|
86
|
-
products: this.
|
|
85
|
+
products: this._products,
|
|
87
86
|
};
|
|
88
87
|
}
|
|
89
88
|
/**
|
|
90
89
|
* Returns products based on the url given.
|
|
91
90
|
*
|
|
92
|
-
* @param
|
|
93
|
-
* @
|
|
91
|
+
* @param reqInfo request object
|
|
92
|
+
* @returns An http response object
|
|
94
93
|
*/
|
|
95
94
|
get(reqInfo) {
|
|
96
95
|
if (reqInfo.id === 'best-sellers') {
|
|
97
|
-
return reqInfo.utils.createResponse$((
|
|
98
|
-
|
|
99
|
-
*/
|
|
100
|
-
() => ({
|
|
101
|
-
body: this.products.slice(0, 4),
|
|
96
|
+
return reqInfo.utils.createResponse$(() => ({
|
|
97
|
+
body: this._products.slice(0, 4),
|
|
102
98
|
status: STATUS.OK,
|
|
103
|
-
}))
|
|
99
|
+
}));
|
|
104
100
|
}
|
|
105
101
|
return undefined;
|
|
106
102
|
}
|
|
107
103
|
}
|
|
104
|
+
/** @nocollapse */ DaffInMemoryBackendProductService.ɵprov = ɵɵdefineInjectable({ factory: function DaffInMemoryBackendProductService_Factory() { return new DaffInMemoryBackendProductService(ɵɵinject(DaffProductExtensionFactory), ɵɵinject(DaffProductImageFactory)); }, token: DaffInMemoryBackendProductService, providedIn: "root" });
|
|
108
105
|
DaffInMemoryBackendProductService.decorators = [
|
|
109
106
|
{ type: Injectable, args: [{
|
|
110
107
|
providedIn: 'root',
|
|
@@ -115,88 +112,41 @@ DaffInMemoryBackendProductService.ctorParameters = () => [
|
|
|
115
112
|
{ type: DaffProductExtensionFactory },
|
|
116
113
|
{ type: DaffProductImageFactory }
|
|
117
114
|
];
|
|
118
|
-
/** @nocollapse */ DaffInMemoryBackendProductService.ɵprov = ɵɵdefineInjectable({ factory: function DaffInMemoryBackendProductService_Factory() { return new DaffInMemoryBackendProductService(ɵɵinject(DaffProductExtensionFactory), ɵɵinject(DaffProductImageFactory)); }, token: DaffInMemoryBackendProductService, providedIn: "root" });
|
|
119
|
-
if (false) {
|
|
120
|
-
/**
|
|
121
|
-
* \@docs-private
|
|
122
|
-
* @type {?}
|
|
123
|
-
*/
|
|
124
|
-
DaffInMemoryBackendProductService.prototype.products;
|
|
125
|
-
/**
|
|
126
|
-
* @type {?}
|
|
127
|
-
* @private
|
|
128
|
-
*/
|
|
129
|
-
DaffInMemoryBackendProductService.prototype.productFactory;
|
|
130
|
-
/**
|
|
131
|
-
* @type {?}
|
|
132
|
-
* @private
|
|
133
|
-
*/
|
|
134
|
-
DaffInMemoryBackendProductService.prototype.productImageFactory;
|
|
135
|
-
}
|
|
136
115
|
|
|
137
|
-
/**
|
|
138
|
-
* @fileoverview added by tsickle
|
|
139
|
-
* Generated from: driver/product.service.ts
|
|
140
|
-
* @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
141
|
-
*/
|
|
142
116
|
/**
|
|
143
117
|
* The product inmemory driver to mock the product backend service.
|
|
144
118
|
*
|
|
145
|
-
*
|
|
146
|
-
*
|
|
119
|
+
* @inheritdoc
|
|
120
|
+
* @Param HttpClient
|
|
147
121
|
*/
|
|
148
122
|
class DaffInMemoryProductService {
|
|
149
|
-
/**
|
|
150
|
-
* @param {?} http
|
|
151
|
-
*/
|
|
152
123
|
constructor(http) {
|
|
153
124
|
this.http = http;
|
|
154
125
|
/**
|
|
155
|
-
*
|
|
126
|
+
* @docs-private
|
|
156
127
|
*/
|
|
157
|
-
this.url = '/api/products
|
|
128
|
+
this.url = '/api/products';
|
|
158
129
|
}
|
|
159
|
-
/**
|
|
160
|
-
* @return {?}
|
|
161
|
-
*/
|
|
162
130
|
getAll() {
|
|
163
131
|
return this.http.get(this.url);
|
|
164
132
|
}
|
|
165
|
-
/**
|
|
166
|
-
* @return {?}
|
|
167
|
-
*/
|
|
168
133
|
getBestSellers() {
|
|
169
|
-
return this.http.get(this.url
|
|
134
|
+
return this.http.get(`${this.url}/best-sellers`);
|
|
170
135
|
}
|
|
171
|
-
/**
|
|
172
|
-
* @param {?} productId
|
|
173
|
-
* @return {?}
|
|
174
|
-
*/
|
|
175
136
|
get(productId) {
|
|
176
|
-
return this.http.get(this.url
|
|
177
|
-
* @param {?} product
|
|
178
|
-
* @return {?}
|
|
179
|
-
*/
|
|
180
|
-
product => ({
|
|
137
|
+
return this.http.get(`${this.url}/${productId}`).pipe(map(product => ({
|
|
181
138
|
id: productId,
|
|
182
139
|
products: [product],
|
|
183
|
-
})))
|
|
140
|
+
})));
|
|
184
141
|
}
|
|
185
|
-
/**
|
|
186
|
-
* @param {?} url
|
|
187
|
-
* @return {?}
|
|
188
|
-
*/
|
|
189
142
|
getByUrl(url) {
|
|
190
|
-
return this.http.get(`${this.url}${url}`).pipe(map((
|
|
191
|
-
* @param {?} product
|
|
192
|
-
* @return {?}
|
|
193
|
-
*/
|
|
194
|
-
product => ({
|
|
143
|
+
return this.http.get(`${this.url}${url}`).pipe(map(product => ({
|
|
195
144
|
id: product.id,
|
|
196
145
|
products: [product],
|
|
197
|
-
})))
|
|
146
|
+
})));
|
|
198
147
|
}
|
|
199
148
|
}
|
|
149
|
+
/** @nocollapse */ DaffInMemoryProductService.ɵprov = ɵɵdefineInjectable({ factory: function DaffInMemoryProductService_Factory() { return new DaffInMemoryProductService(ɵɵinject(HttpClient)); }, token: DaffInMemoryProductService, providedIn: "root" });
|
|
200
150
|
DaffInMemoryProductService.decorators = [
|
|
201
151
|
{ type: Injectable, args: [{
|
|
202
152
|
providedIn: 'root',
|
|
@@ -206,32 +156,11 @@ DaffInMemoryProductService.decorators = [
|
|
|
206
156
|
DaffInMemoryProductService.ctorParameters = () => [
|
|
207
157
|
{ type: HttpClient }
|
|
208
158
|
];
|
|
209
|
-
/** @nocollapse */ DaffInMemoryProductService.ɵprov = ɵɵdefineInjectable({ factory: function DaffInMemoryProductService_Factory() { return new DaffInMemoryProductService(ɵɵinject(HttpClient)); }, token: DaffInMemoryProductService, providedIn: "root" });
|
|
210
|
-
if (false) {
|
|
211
|
-
/**
|
|
212
|
-
* \@docs-private
|
|
213
|
-
* @type {?}
|
|
214
|
-
*/
|
|
215
|
-
DaffInMemoryProductService.prototype.url;
|
|
216
|
-
/**
|
|
217
|
-
* @type {?}
|
|
218
|
-
* @private
|
|
219
|
-
*/
|
|
220
|
-
DaffInMemoryProductService.prototype.http;
|
|
221
|
-
}
|
|
222
159
|
|
|
223
|
-
/**
|
|
224
|
-
* @fileoverview added by tsickle
|
|
225
|
-
* Generated from: driver/product-driver.module.ts
|
|
226
|
-
* @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
227
|
-
*/
|
|
228
160
|
/**
|
|
229
161
|
* Module for providing the DaffInMemoryProductService driver to your application.
|
|
230
162
|
*/
|
|
231
163
|
class DaffProductInMemoryDriverModule {
|
|
232
|
-
/**
|
|
233
|
-
* @return {?}
|
|
234
|
-
*/
|
|
235
164
|
static forRoot() {
|
|
236
165
|
return {
|
|
237
166
|
ngModule: DaffProductInMemoryDriverModule,
|
|
@@ -254,21 +183,7 @@ DaffProductInMemoryDriverModule.decorators = [
|
|
|
254
183
|
];
|
|
255
184
|
|
|
256
185
|
/**
|
|
257
|
-
*
|
|
258
|
-
* Generated from: public_api.ts
|
|
259
|
-
* @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
260
|
-
*/
|
|
261
|
-
|
|
262
|
-
/**
|
|
263
|
-
* @fileoverview added by tsickle
|
|
264
|
-
* Generated from: index.ts
|
|
265
|
-
* @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
266
|
-
*/
|
|
267
|
-
|
|
268
|
-
/**
|
|
269
|
-
* @fileoverview added by tsickle
|
|
270
|
-
* Generated from: daffodil-product-driver-in-memory.ts
|
|
271
|
-
* @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
186
|
+
* Generated bundle index. Do not edit.
|
|
272
187
|
*/
|
|
273
188
|
|
|
274
189
|
export { DaffInMemoryBackendProductService, DaffInMemoryProductService, DaffProductInMemoryDriverModule };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"daffodil-product-driver-in-memory.js","sources":["../../../libs/product/driver/in-memory/src/backend/product.service.ts","../../../libs/product/driver/in-memory/src/driver/product.service.ts","../../../libs/product/driver/in-memory/src/driver/product-driver.module.ts"],"sourcesContent":["import { Injectable } from '@angular/core';\nimport {\n InMemoryDbService,\n RequestInfoUtilities,\n ParsedRequestUrl,\n STATUS,\n} from 'angular-in-memory-web-api';\n\nimport { DaffProduct } from '@daffodil/product';\nimport {\n DaffProductImageFactory,\n DaffProductExtensionFactory,\n} from '@daffodil/product/testing';\n\n/**\n * An in-memory service that stubs out the backend services for getting products.\n *\n * @Param productFactory: DaffProductFactory instance\n * @Param productImageFactory: DaffProductImageFactory instance\n * @Param products: An array of Products\n */\n@Injectable({\n providedIn: 'root',\n})\nexport class DaffInMemoryBackendProductService implements InMemoryDbService {\n /**\n * @docs-private\n */\n products: DaffProduct[];\n\n constructor(\n private productFactory: DaffProductExtensionFactory,\n private productImageFactory: DaffProductImageFactory) {\n this.products = [\n this.productFactory.create({ id: '1001', url: '1001', images: this.productImageFactory.createMany(5) }),\n this.productFactory.create({ id: '1002', url: '1002', images: this.productImageFactory.createMany(5) }),\n this.productFactory.create({ id: '1003', url: '1003', images: this.productImageFactory.createMany(5) }),\n this.productFactory.create({ id: '1004', url: '1004', images: this.productImageFactory.createMany(5) }),\n this.productFactory.create({ id: '1005', url: '1005', images: this.productImageFactory.createMany(5) }),\n this.productFactory.create({ id: '1006', url: '1006', images: this.productImageFactory.createMany(5) }),\n this.productFactory.create({ id: '1007', url: '1007', images: this.productImageFactory.createMany(5) }),\n this.productFactory.create({ id: '1008', url: '1008', images: this.productImageFactory.createMany(5) }),\n this.productFactory.create({ id: '1009', url: '1009', images: this.productImageFactory.createMany(5) }),\n this.productFactory.create({ id: '1010', url: '1010', images: this.productImageFactory.createMany(5) }),\n this.productFactory.create({ id: '1011', url: '1011', images: this.productImageFactory.createMany(5) }),\n this.productFactory.create({ id: '1012', url: '1012', images: this.productImageFactory.createMany(5) }),\n this.productFactory.create({ id: '1013', url: '1013', images: this.productImageFactory.createMany(5) }),\n this.productFactory.create({ id: '1014', url: '1014', images: this.productImageFactory.createMany(5) }),\n this.productFactory.create({ id: '1015', url: '1015', images: this.productImageFactory.createMany(5) }),\n this.productFactory.create({ id: '1016', url: '1016', images: this.productImageFactory.createMany(5) }),\n this.productFactory.create({ id: '1017', url: '1017', images: this.productImageFactory.createMany(5) }),\n this.productFactory.create({ id: '1018', url: '1018', images: this.productImageFactory.createMany(5) }),\n this.productFactory.create({ id: '1019', url: '1019', images: this.productImageFactory.createMany(5) }),\n this.productFactory.create({ id: '1020', url: '1020', images: this.productImageFactory.createMany(5) }),\n this.productFactory.create({ id: '1021', url: '1021', images: this.productImageFactory.createMany(5) }),\n this.productFactory.create({ id: '1022', url: '1022', images: this.productImageFactory.createMany(5) }),\n this.productFactory.create({ id: '1023', url: '1023', images: this.productImageFactory.createMany(5) }),\n this.productFactory.create({ id: '1024', url: '1024', images: this.productImageFactory.createMany(5) }),\n this.productFactory.create({ id: '1025', url: '1025', images: this.productImageFactory.createMany(5) }),\n this.productFactory.create({ id: '1026', url: '1026', images: this.productImageFactory.createMany(5) }),\n this.productFactory.create({ id: '1027', url: '1027', images: this.productImageFactory.createMany(5) }),\n this.productFactory.create({ id: '1028', url: '1028', images: this.productImageFactory.createMany(5) }),\n this.productFactory.create({ id: '1029', url: '1029', images: this.productImageFactory.createMany(5) }),\n this.productFactory.create({ id: '1030', url: '1030', images: this.productImageFactory.createMany(5) }),\n this.productFactory.create({ id: '1031', url: '1031', images: this.productImageFactory.createMany(5) }),\n this.productFactory.create({ id: '1032', url: '1032', images: this.productImageFactory.createMany(5) }),\n this.productFactory.create({ id: '1033', url: '1033', images: this.productImageFactory.createMany(5) }),\n this.productFactory.create({ id: '1034', url: '1034', images: this.productImageFactory.createMany(5) }),\n this.productFactory.create({ id: '1035', url: '1035', images: this.productImageFactory.createMany(5) }),\n ];\n }\n\n /**\n * Automatically called as part of the InMemoryDbService to parse incoming urls to match the InMemory backend urls.\n *\n * @param url initial url\n * @param utils utility to parse url\n * @returns ParsedRequestUrl\n * @docs-private\n */\n parseRequestUrl(url: string, utils: RequestInfoUtilities): ParsedRequestUrl {\n return utils.parseRequestUrl(url);\n }\n\n /**\n * Creates a fake database of products for the product inmemory backend service.\n *\n * @returns A fake database of an array of products\n * @docs-private\n */\n createDb(): any {\n return {\n products: this.products,\n };\n }\n\n /**\n * Returns products based on the url given.\n *\n * @param reqInfo request object\n * @returns An http response object\n */\n get(reqInfo: any) {\n if(reqInfo.id === 'best-sellers') {\n return reqInfo.utils.createResponse$(() => ({\n body: this.products.slice(0,4),\n status: STATUS.OK,\n }));\n }\n\n return undefined;\n }\n}\n","import { HttpClient } from '@angular/common/http';\nimport { Injectable } from '@angular/core';\nimport { Observable } from 'rxjs';\nimport { map } from 'rxjs/operators';\n\nimport { DaffProduct } from '@daffodil/product';\nimport {\n DaffProductDriverResponse,\n DaffProductServiceInterface,\n} from '@daffodil/product/driver';\n\n/**\n * The product inmemory driver to mock the product backend service.\n *\n * @inheritdoc\n * @Param HttpClient\n */\n@Injectable({\n providedIn: 'root',\n})\nexport class DaffInMemoryProductService implements DaffProductServiceInterface {\n /**\n * @docs-private\n */\n url = '/api/products/';\n\n constructor(private http: HttpClient) {}\n\n getAll(): Observable<DaffProduct[]> {\n return this.http.get<DaffProduct[]>(this.url);\n }\n\n getBestSellers(): Observable<DaffProduct[]> {\n return this.http.get<DaffProduct[]>(this.url + 'best-sellers');\n }\n\n get(productId: DaffProduct['id']): Observable<DaffProductDriverResponse> {\n return this.http.get<DaffProduct>(this.url + productId).pipe(\n map(product => ({\n id: productId,\n products: [product],\n })),\n );\n }\n\n getByUrl(url: DaffProduct['url']): Observable<DaffProductDriverResponse> {\n return this.http.get<DaffProduct>(`${this.url}${url}`).pipe(\n map(product => ({\n id: product.id,\n products: [product],\n })),\n );\n }\n}\n","import { CommonModule } from '@angular/common';\nimport {\n NgModule,\n ModuleWithProviders,\n} from '@angular/core';\n\nimport { DaffProductDriver } from '@daffodil/product/driver';\nimport { DaffProductTestingModule } from '@daffodil/product/testing';\n\nimport { DaffInMemoryProductService } from './product.service';\n\n/**\n * Module for providing the DaffInMemoryProductService driver to your application.\n */\n@NgModule({\n imports: [\n CommonModule,\n DaffProductTestingModule,\n ],\n})\nexport class DaffProductInMemoryDriverModule {\n static forRoot(): ModuleWithProviders<DaffProductInMemoryDriverModule> {\n return {\n ngModule: DaffProductInMemoryDriverModule,\n providers: [\n {\n provide: DaffProductDriver,\n useExisting: DaffInMemoryProductService,\n },\n ],\n };\n }\n}\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;MAwBa,iCAAiC;;;;;IAM5C,YACU,cAA2C,EAC3C,mBAA4C;QAD5C,mBAAc,GAAd,cAAc,CAA6B;QAC3C,wBAAmB,GAAnB,mBAAmB,CAAyB;QACpD,IAAI,CAAC,QAAQ,GAAG;YACd,IAAI,CAAC,cAAc,CAAC,MAAM,CAAC,EAAE,EAAE,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,EAAE,MAAM,EAAE,IAAI,CAAC,mBAAmB,CAAC,UAAU,CAAC,CAAC,CAAC,EAAE,CAAC;YACvG,IAAI,CAAC,cAAc,CAAC,MAAM,CAAC,EAAE,EAAE,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,EAAE,MAAM,EAAE,IAAI,CAAC,mBAAmB,CAAC,UAAU,CAAC,CAAC,CAAC,EAAE,CAAC;YACvG,IAAI,CAAC,cAAc,CAAC,MAAM,CAAC,EAAE,EAAE,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,EAAE,MAAM,EAAE,IAAI,CAAC,mBAAmB,CAAC,UAAU,CAAC,CAAC,CAAC,EAAE,CAAC;YACvG,IAAI,CAAC,cAAc,CAAC,MAAM,CAAC,EAAE,EAAE,EAAE,MAAM,EAAE,GAAG,EAA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product-driver-in-memory.js","sources":["../../../libs/product/driver/in-memory/src/backend/product.service.ts","../../../libs/product/driver/in-memory/src/driver/product.service.ts","../../../libs/product/driver/in-memory/src/driver/product-driver.module.ts","../../../libs/product/driver/in-memory/src/daffodil-product-driver-in-memory.ts"],"sourcesContent":["import { Injectable } from '@angular/core';\nimport {\n InMemoryDbService,\n RequestInfoUtilities,\n ParsedRequestUrl,\n STATUS,\n} from 'angular-in-memory-web-api';\n\nimport { DaffProduct } from '@daffodil/product';\nimport {\n DaffProductImageFactory,\n DaffProductExtensionFactory,\n} from '@daffodil/product/testing';\n\n/**\n * An in-memory service that stubs out the backend services for getting products.\n *\n * @Param productFactory: DaffProductFactory instance\n * @Param productImageFactory: DaffProductImageFactory instance\n * @Param products: An array of Products\n */\n@Injectable({\n providedIn: 'root',\n})\nexport class DaffInMemoryBackendProductService implements InMemoryDbService {\n protected _products: DaffProduct[] = [];\n\n /**\n * The collection of products in the backend.\n */\n get products(): DaffProduct[] {\n return this._products;\n };\n\n constructor(\n private productFactory: DaffProductExtensionFactory,\n private productImageFactory: DaffProductImageFactory) {\n this._products = [\n '1001',\n '1002',\n '1003',\n '1004',\n '1005',\n '1006',\n '1007',\n '1008',\n '1009',\n '1010',\n '1011',\n '1012',\n '1013',\n '1014',\n '1015',\n '1016',\n '1017',\n '1018',\n '1019',\n '1020',\n '1021',\n '1022',\n '1023',\n '1024',\n '1025',\n '1026',\n '1027',\n '1028',\n '1029',\n '1030',\n '1031',\n '1032',\n '1033',\n '1034',\n '1035',\n ].map(id => this.productFactory.create({ id, url: `/${id}`, images: this.productImageFactory.createMany(5) }));\n }\n\n /**\n * Automatically called as part of the InMemoryDbService to parse incoming urls to match the InMemory backend urls.\n *\n * @param url initial url\n * @param utils utility to parse url\n * @returns ParsedRequestUrl\n * @docs-private\n */\n parseRequestUrl(url: string, utils: RequestInfoUtilities): ParsedRequestUrl {\n return utils.parseRequestUrl(url);\n }\n\n /**\n * Creates a fake database of products for the product inmemory backend service.\n *\n * @returns A fake database of an array of products\n * @docs-private\n */\n createDb(): any {\n return {\n products: this._products,\n };\n }\n\n /**\n * Returns products based on the url given.\n *\n * @param reqInfo request object\n * @returns An http response object\n */\n get(reqInfo: any) {\n if(reqInfo.id === 'best-sellers') {\n return reqInfo.utils.createResponse$(() => ({\n body: this._products.slice(0,4),\n status: STATUS.OK,\n }));\n }\n\n return undefined;\n }\n}\n","import { HttpClient } from '@angular/common/http';\nimport { Injectable } from '@angular/core';\nimport { Observable } from 'rxjs';\nimport { map } from 'rxjs/operators';\n\nimport { DaffProduct } from '@daffodil/product';\nimport {\n DaffProductDriverResponse,\n DaffProductServiceInterface,\n} from '@daffodil/product/driver';\n\n/**\n * The product inmemory driver to mock the product backend service.\n *\n * @inheritdoc\n * @Param HttpClient\n */\n@Injectable({\n providedIn: 'root',\n})\nexport class DaffInMemoryProductService implements DaffProductServiceInterface {\n /**\n * @docs-private\n */\n url = '/api/products';\n\n constructor(private http: HttpClient) {}\n\n getAll(): Observable<DaffProduct[]> {\n return this.http.get<DaffProduct[]>(this.url);\n }\n\n getBestSellers(): Observable<DaffProduct[]> {\n return this.http.get<DaffProduct[]>(`${this.url}/best-sellers`);\n }\n\n get(productId: DaffProduct['id']): Observable<DaffProductDriverResponse> {\n return this.http.get<DaffProduct>(`${this.url}/${productId}`).pipe(\n map(product => ({\n id: productId,\n products: [product],\n })),\n );\n }\n\n getByUrl(url: DaffProduct['url']): Observable<DaffProductDriverResponse> {\n return this.http.get<DaffProduct>(`${this.url}${url}`).pipe(\n map(product => ({\n id: product.id,\n products: [product],\n })),\n );\n }\n}\n","import { CommonModule } from '@angular/common';\nimport {\n NgModule,\n ModuleWithProviders,\n} from '@angular/core';\n\nimport { DaffProductDriver } from '@daffodil/product/driver';\nimport { DaffProductTestingModule } from '@daffodil/product/testing';\n\nimport { DaffInMemoryProductService } from './product.service';\n\n/**\n * Module for providing the DaffInMemoryProductService driver to your application.\n */\n@NgModule({\n imports: [\n CommonModule,\n DaffProductTestingModule,\n ],\n})\nexport class DaffProductInMemoryDriverModule {\n static forRoot(): ModuleWithProviders<DaffProductInMemoryDriverModule> {\n return {\n ngModule: DaffProductInMemoryDriverModule,\n providers: [\n {\n provide: DaffProductDriver,\n useExisting: DaffInMemoryProductService,\n },\n ],\n };\n }\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;;;AAcA;;;;;;;MAUa,iCAAiC;IAU5C,YACU,cAA2C,EAC3C,mBAA4C;QAD5C,mBAAc,GAAd,cAAc,CAA6B;QAC3C,wBAAmB,GAAnB,mBAAmB,CAAyB;QAX5C,cAAS,GAAkB,EAAE,CAAC;QAYtC,IAAI,CAAC,SAAS,GAAG;YACf,MAAM;YACN,MAAM;YACN,MAAM;YACN,MAAM;YACN,MAAM;YACN,MAAM;YACN,MAAM;YACN,MAAM;YACN,MAAM;YACN,MAAM;YACN,MAAM;YACN,MAAM;YACN,MAAM;YACN,MAAM;YACN,MAAM;YACN,MAAM;YACN,MAAM;YACN,MAAM;YACN,MAAM;YACN,MAAM;YACN,MAAM;YACN,MAAM;YACN,MAAM;YACN,MAAM;YACN,MAAM;YACN,MAAM;YACN,MAAM;YACN,MAAM;YACN,MAAM;YACN,MAAM;YACN,MAAM;YACN,MAAM;YACN,MAAM;YACN,MAAM;YACN,MAAM;SACP,CAAC,GAAG,CAAC,EAAE,IAAI,IAAI,CAAC,cAAc,CAAC,MAAM,CAAC,EAAE,EAAE,EAAE,GAAG,EAAE,IAAI,EAAE,EAAE,EAAE,MAAM,EAAE,IAAI,CAAC,mBAAmB,CAAC,UAAU,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;KAChH;;;;IA5CD,IAAI,QAAQ;QACV,OAAO,IAAI,CAAC,SAAS,CAAC;KACvB;;;;;;;;;;IAoDD,eAAe,CAAC,GAAW,EAAE,KAA2B;QACtD,OAAO,KAAK,CAAC,eAAe,CAAC,GAAG,CAAC,CAAC;KACnC;;;;;;;I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