@daffodil/product 0.39.6 → 0.39.10
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-magento-testing.umd.js +2 -2
- package/bundles/daffodil-product-driver-magento-testing.umd.js.map +1 -1
- package/bundles/daffodil-product-driver-magento-testing.umd.min.js +2 -2
- package/bundles/daffodil-product-driver-magento-testing.umd.min.js.map +1 -1
- package/bundles/daffodil-product-testing.umd.js +3 -3
- package/bundles/daffodil-product-testing.umd.js.map +1 -1
- package/bundles/daffodil-product-testing.umd.min.js +2 -2
- package/bundles/daffodil-product-testing.umd.min.js.map +1 -1
- package/esm2015/driver/magento/testing/factories/core/product-preview.factory.js +2 -2
- package/esm2015/driver/magento/testing/factories/core/product.factory.js +2 -2
- package/esm2015/testing/factories/default-product.factory.js +3 -3
- package/esm2015/testing/factories/product-image.factory.js +2 -2
- package/fesm2015/daffodil-product-driver-magento-testing.js +1 -1
- package/fesm2015/daffodil-product-driver-magento-testing.js.map +1 -1
- package/fesm2015/daffodil-product-testing.js +2 -2
- package/fesm2015/daffodil-product-testing.js.map +1 -1
- package/package.json +4 -4
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Injectable } from '@angular/core';
|
|
2
|
-
import * as faker from 'faker/locale/en_US';
|
|
2
|
+
import * as faker from '@faker-js/faker/locale/en_US';
|
|
3
3
|
import { DaffModelFactory } from '@daffodil/core/testing';
|
|
4
4
|
import * as i0 from "@angular/core";
|
|
5
5
|
const productImageUrlsList = [
|
|
@@ -131,4 +131,4 @@ DaffProductImageFactory.decorators = [
|
|
|
131
131
|
];
|
|
132
132
|
/** @nocollapse */
|
|
133
133
|
DaffProductImageFactory.ctorParameters = () => [];
|
|
134
|
-
//# sourceMappingURL=data:application/json;base64,
|
|
134
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoicHJvZHVjdC1pbWFnZS5mYWN0b3J5LmpzIi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RbZmFrZXIuZGF0YXR5cGUubnVtYmVyKHByb2R1Y3RJbWFnZVVybHNMaXN0Lmxlbmd0aC0xKV07XG4gIGxhYmVsID0gZmFrZXIubG9yZW0uc2VudGVuY2UoKTtcbn1cblxuLyoqXG4gKiBBIGZhY3RvcnkgZm9yIGNyZWF0aW5nIERhZmZQcm9kdWN0SW1hZ2UuXG4gKi9cbkBJbmplY3RhYmxlKHtcbiAgcHJvdmlkZWRJbjogJ3Jvb3QnLFxufSlcbmV4cG9ydCBjbGFzcyBEYWZmUHJvZHVjdEltYWdlRmFjdG9yeSBleHRlbmRzIERhZmZNb2RlbEZhY3Rvcnk8RGFmZlByb2R1Y3RJbWFnZT4ge1xuICBjb25zdHJ1Y3Rvcigpe1xuICAgIHN1cGVyKE1vY2tQcm9kdWN0SW1hZ2UpO1xuICB9XG59XG4iXX0=
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { ɵɵdefineInjectable, Injectable } from '@angular/core';
|
|
2
2
|
import { DaffModelFactory } from '@daffodil/core/testing';
|
|
3
3
|
import { MagentoProductTypeEnum, MagentoProductStockStatusEnum } from '@daffodil/product/driver/magento';
|
|
4
|
-
import { datatype, random, internet, image } from 'faker/locale/en_US';
|
|
4
|
+
import { datatype, random, internet, image } from '@faker-js/faker/locale/en_US';
|
|
5
5
|
|
|
6
6
|
class MockMagentoCoreProduct {
|
|
7
7
|
constructor() {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"daffodil-product-driver-magento-testing.js","sources":["../../../libs/product/driver/magento/testing/src/factories/core/product.factory.ts","../../../libs/product/driver/magento/testing/src/factories/simple/simple.factory.ts","../../../libs/product/driver/magento/testing/src/factories/core/product-preview.factory.ts","../../../libs/product/driver/magento/testing/src/daffodil-product-driver-magento-testing.ts"],"sourcesContent":["import { Injectable } from '@angular/core';\nimport * as faker from 'faker/locale/en_US';\n\nimport { DaffModelFactory } from '@daffodil/core/testing';\nimport {\n MagentoProduct,\n MagentoProductTypeEnum,\n MagentoProductStockStatusEnum,\n} from '@daffodil/product/driver/magento';\n\nexport class MockMagentoCoreProduct implements MagentoProduct {\n\t__typename = MagentoProductTypeEnum.SimpleProduct;\n uid = faker.datatype.uuid();\n url_key = faker.random.alphaNumeric(16);\n url_suffix = '.html';\n canonical_url = faker.internet.url();\n name = faker.random.word();\n meta_title = faker.random.word();\n meta_description = faker.random.words(3);\n\tsku = faker.random.alphaNumeric(16);\n\tstock_status = MagentoProductStockStatusEnum.InStock;\n image = {\n __typename: 'ProductImage',\n label: faker.random.words(3),\n url: faker.image.imageUrl(),\n };\n thumbnail = {\n __typename: 'ProductImage',\n label: faker.random.words(3),\n url: faker.image.imageUrl(),\n };\n description = {\n __typename: 'ComplexTextValue',\n html: faker.random.words(5),\n };\n price_range = {\n __typename: 'PriceRange',\n maximum_price: {\n __typename: 'ProductPrice',\n regular_price: {\n __typename: 'Money',\n value: faker.datatype.number({ min: 100, max: 1000 }),\n currency: null,\n },\n discount: {\n __typename: 'ProductDiscount',\n amount_off: faker.datatype.number({ min: 1, max: 99 }),\n percent_off: faker.datatype.number({ min: 1, max: 99 }),\n },\n },\n };\n short_description = {\n __typename: 'ComplexTextValue',\n html: faker.random.words(3),\n };\n\tmedia_gallery_entries = [];\n}\n\n/**\n * A factory for creating stub data for {@link MagentoProduct}s.\n */\n@Injectable({\n providedIn: 'root',\n})\nexport class MagentoCoreProductFactory extends DaffModelFactory<MagentoProduct> {\n\n constructor(){\n super(MockMagentoCoreProduct);\n }\n}\n","import { Injectable } from '@angular/core';\n\nimport { DaffModelFactory } from '@daffodil/core/testing';\nimport {\n MagentoProductTypeEnum,\n MagentoSimpleProduct,\n} from '@daffodil/product/driver/magento';\n\nimport { MockMagentoCoreProduct } from '../core/product.factory';\n\nexport class MockMagentoSimpleProduct extends MockMagentoCoreProduct implements MagentoSimpleProduct {\n\t__typename = MagentoProductTypeEnum.SimpleProduct;\n}\n\n/**\n * A factory for creating stub data for {@link MagentoSimpleProduct}s.\n */\n@Injectable({\n providedIn: 'root',\n})\nexport class MagentoSimpleProductFactory extends DaffModelFactory<MagentoSimpleProduct> {\n\n constructor(){\n super(MockMagentoSimpleProduct);\n }\n}\n","import { Injectable } from '@angular/core';\nimport * as faker from 'faker/locale/en_US';\n\nimport { DaffModelFactory } from '@daffodil/core/testing';\nimport {\n MagentoProductPreview,\n MagentoProductTypeEnum,\n MagentoProductStockStatusEnum,\n} from '@daffodil/product/driver/magento';\n\nexport class MockMagentoProductPreview implements MagentoProductPreview {\n\t__typename = MagentoProductTypeEnum.SimpleProduct;\n uid = faker.datatype.uuid();\n url_key = faker.random.alphaNumeric(16);\n url_suffix = '.html';\n name = faker.random.word();\n\tsku = faker.random.alphaNumeric(16);\n\tstock_status = MagentoProductStockStatusEnum.InStock;\n thumbnail = {\n __typename: 'ProductImage',\n label: faker.random.words(3),\n url: faker.image.imageUrl(),\n };\n description = {\n __typename: 'ComplexTextValue',\n html: faker.random.words(5),\n };\n price_range = {\n __typename: 'PriceRange',\n maximum_price: {\n __typename: 'ProductPrice',\n regular_price: {\n __typename: 'Money',\n value: faker.datatype.number({ min: 100, max: 1000 }),\n currency: null,\n },\n discount: {\n __typename: 'ProductDiscount',\n amount_off: faker.datatype.number({ min: 1, max: 99 }),\n percent_off: faker.datatype.number({ min: 1, max: 99 }),\n },\n },\n };\n}\n\n@Injectable({\n providedIn: 'root',\n})\nexport class MagentoProductPreviewFactory extends DaffModelFactory<MagentoProductPreview> {\n\n constructor(){\n super(MockMagentoProductPreview);\n }\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":["faker.datatype","faker.random","faker.internet","faker.image"],"mappings":";;;;;MAUa,sBAAsB;IAAnC;QACC,eAAU,GAAG,sBAAsB,CAAC,aAAa,CAAC;QACjD,QAAG,GAAGA,QAAc,CAAC,IAAI,EAAE,CAAC;QAC5B,YAAO,GAAGC,MAAY,CAAC,YAAY,CAAC,EAAE,CAAC,CAAC;QACxC,eAAU,GAAG,OAA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;SAC5B,CAAC;QACF,gBAAW,GAAG;YACZ,UAAU,EAAE,YAAY;YACxB,aAAa,EAAE;gBACb,UAAU,EAAE,cAAc;gBAC1B,aAAa,EAAE;oBACb,UAAU,EAAE,OAAO;oBACnB,KAAK,EAAED,QAAc,CAAC,MAAM,CAAC,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,IAAI,EAAE,CAAC;oBACrD,QAAQ,EAAE,IAAI;iBACf;gBACD,QAAQ,EAAE;oBACR,UAAU,EAAE,iBAAiB;oBAC7B,UAAU,EAAEA,QAAc,CAAC,MAAM,CAAC,EAAE,GAAG,EAAE,CAAC,EAAE,GAAG,EAAE,EAAE,EAAE,CAAC;oBACtD,WAAW,EAAEA,QAAc,CAAC,MAAM,CAAC,EAAE,GAAG,EAAE,CAAC,EAAE,GAAG,EAAE,EAAE,EAAE,CAAC;iBACxD;aACF;SACF,CAAC;KACH;CAAA;MAKY,4BAA6B,SAAQ,gBAAuC;IAEvF;QACE,KAAK,CAAC,yBAAyB,CAAC,CAAC;KAClC;;;;YAPF,UAAU,SAAC;gBACV,UAAU,EAAE,MAAM;aACnB;;;;;AC/CD;;;;;;"}
|
|
1
|
+
{"version":3,"file":"daffodil-product-driver-magento-testing.js","sources":["../../../libs/product/driver/magento/testing/src/factories/core/product.factory.ts","../../../libs/product/driver/magento/testing/src/factories/simple/simple.factory.ts","../../../libs/product/driver/magento/testing/src/factories/core/product-preview.factory.ts","../../../libs/product/driver/magento/testing/src/daffodil-product-driver-magento-testing.ts"],"sourcesContent":["import { Injectable } from '@angular/core';\nimport * as faker from '@faker-js/faker/locale/en_US';\n\nimport { DaffModelFactory } from '@daffodil/core/testing';\nimport {\n MagentoProduct,\n MagentoProductTypeEnum,\n MagentoProductStockStatusEnum,\n} from '@daffodil/product/driver/magento';\n\nexport class MockMagentoCoreProduct implements MagentoProduct {\n\t__typename = MagentoProductTypeEnum.SimpleProduct;\n uid = faker.datatype.uuid();\n url_key = faker.random.alphaNumeric(16);\n url_suffix = '.html';\n canonical_url = faker.internet.url();\n name = faker.random.word();\n meta_title = faker.random.word();\n meta_description = faker.random.words(3);\n\tsku = faker.random.alphaNumeric(16);\n\tstock_status = MagentoProductStockStatusEnum.InStock;\n image = {\n __typename: 'ProductImage',\n label: faker.random.words(3),\n url: faker.image.imageUrl(),\n };\n thumbnail = {\n __typename: 'ProductImage',\n label: faker.random.words(3),\n url: faker.image.imageUrl(),\n };\n description = {\n __typename: 'ComplexTextValue',\n html: faker.random.words(5),\n };\n price_range = {\n __typename: 'PriceRange',\n maximum_price: {\n __typename: 'ProductPrice',\n regular_price: {\n __typename: 'Money',\n value: faker.datatype.number({ min: 100, max: 1000 }),\n currency: null,\n },\n discount: {\n __typename: 'ProductDiscount',\n amount_off: faker.datatype.number({ min: 1, max: 99 }),\n percent_off: faker.datatype.number({ min: 1, max: 99 }),\n },\n },\n };\n short_description = {\n __typename: 'ComplexTextValue',\n html: faker.random.words(3),\n };\n\tmedia_gallery_entries = [];\n}\n\n/**\n * A factory for creating stub data for {@link MagentoProduct}s.\n */\n@Injectable({\n providedIn: 'root',\n})\nexport class MagentoCoreProductFactory extends DaffModelFactory<MagentoProduct> {\n\n constructor(){\n super(MockMagentoCoreProduct);\n }\n}\n","import { Injectable } from '@angular/core';\n\nimport { DaffModelFactory } from '@daffodil/core/testing';\nimport {\n MagentoProductTypeEnum,\n MagentoSimpleProduct,\n} from '@daffodil/product/driver/magento';\n\nimport { MockMagentoCoreProduct } from '../core/product.factory';\n\nexport class MockMagentoSimpleProduct extends MockMagentoCoreProduct implements MagentoSimpleProduct {\n\t__typename = MagentoProductTypeEnum.SimpleProduct;\n}\n\n/**\n * A factory for creating stub data for {@link MagentoSimpleProduct}s.\n */\n@Injectable({\n providedIn: 'root',\n})\nexport class MagentoSimpleProductFactory extends DaffModelFactory<MagentoSimpleProduct> {\n\n constructor(){\n super(MockMagentoSimpleProduct);\n }\n}\n","import { Injectable } from '@angular/core';\nimport * as faker from '@faker-js/faker/locale/en_US';\n\nimport { DaffModelFactory } from '@daffodil/core/testing';\nimport {\n MagentoProductPreview,\n MagentoProductTypeEnum,\n MagentoProductStockStatusEnum,\n} from '@daffodil/product/driver/magento';\n\nexport class MockMagentoProductPreview implements MagentoProductPreview {\n\t__typename = MagentoProductTypeEnum.SimpleProduct;\n uid = faker.datatype.uuid();\n url_key = faker.random.alphaNumeric(16);\n url_suffix = '.html';\n name = faker.random.word();\n\tsku = faker.random.alphaNumeric(16);\n\tstock_status = MagentoProductStockStatusEnum.InStock;\n thumbnail = {\n __typename: 'ProductImage',\n label: faker.random.words(3),\n url: faker.image.imageUrl(),\n };\n description = {\n __typename: 'ComplexTextValue',\n html: faker.random.words(5),\n };\n price_range = {\n __typename: 'PriceRange',\n maximum_price: {\n __typename: 'ProductPrice',\n regular_price: {\n __typename: 'Money',\n value: faker.datatype.number({ min: 100, max: 1000 }),\n currency: null,\n },\n discount: {\n __typename: 'ProductDiscount',\n amount_off: faker.datatype.number({ min: 1, max: 99 }),\n percent_off: faker.datatype.number({ min: 1, max: 99 }),\n },\n },\n };\n}\n\n@Injectable({\n providedIn: 'root',\n})\nexport class MagentoProductPreviewFactory extends DaffModelFactory<MagentoProductPreview> {\n\n constructor(){\n super(MockMagentoProductPreview);\n }\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":["faker.datatype","faker.random","faker.internet","faker.image"],"mappings":";;;;;MAUa,sBAAsB;IAAnC;QACC,eAAU,GAAG,sBAAsB,CAAC,aAAa,CAAC;QACjD,QAAG,GAAGA,QAAc,CAAC,IAAI,EAAE,CAAC;QAC5B,YAAO,GAAGC,MAAY,CAAC,YAAY,CAAC,EAAE,CAAC,CAAC;QACxC,eAAU,GAAG,OAAO,CAAC;QACrB,kBAAa,GAAGC,QAAc,CAAC,GAAG,EAAE,CAAC;QACrC,SAAI,GAAGD,MAAY,CAAC,IAAI,EAAE,CAAC;QAC3B,eAAU,GAAGA,MAAY,CAAC,IAAI,EAAE,CAA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EAAED,QAAc,CAAC,MAAM,CAAC,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,IAAI,EAAE,CAAC;oBACrD,QAAQ,EAAE,IAAI;iBACf;gBACD,QAAQ,EAAE;oBACR,UAAU,EAAE,iBAAiB;oBAC7B,UAAU,EAAEA,QAAc,CAAC,MAAM,CAAC,EAAE,GAAG,EAAE,CAAC,EAAE,GAAG,EAAE,EAAE,EAAE,CAAC;oBACtD,WAAW,EAAEA,QAAc,CAAC,MAAM,CAAC,EAAE,GAAG,EAAE,CAAC,EAAE,GAAG,EAAE,EAAE,EAAE,CAAC;iBACxD;aACF;SACF,CAAC;KACH;CAAA;MAKY,4BAA6B,SAAQ,gBAAuC;IAEvF;QACE,KAAK,CAAC,yBAAyB,CAAC,CAAC;KAClC;;;;YAPF,UAAU,SAAC;gBACV,UAAU,EAAE,MAAM;aACnB;;;;;AC/CD;;;;;;"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ɵɵdefineInjectable, Injectable, InjectionToken, ɵɵinject, Inject, NgModule } from '@angular/core';
|
|
2
|
-
import { datatype, lorem,
|
|
2
|
+
import { datatype, lorem, internet, commerce, company } from '@faker-js/faker/locale/en_US';
|
|
3
3
|
import { DaffModelFactory } from '@daffodil/core/testing';
|
|
4
4
|
import { DaffProductTypeEnum } from '@daffodil/product';
|
|
5
5
|
import { sample } from '@daffodil/core';
|
|
@@ -201,7 +201,7 @@ class MockProduct {
|
|
|
201
201
|
this.stubDiscount = datatype.number({ min: 0, max: this.stubPrice - 1 });
|
|
202
202
|
this.type = DaffProductTypeEnum.Simple;
|
|
203
203
|
this.id = datatype.uuid();
|
|
204
|
-
this.url = `/${
|
|
204
|
+
this.url = `/${internet.domainWord()}.html`;
|
|
205
205
|
this.canonicalUrl = internet.url();
|
|
206
206
|
this.price = this.stubPrice;
|
|
207
207
|
this.in_stock = true;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"daffodil-product-testing.js","sources":["../../../libs/product/testing/src/factories/product-image.factory.ts","../../../libs/product/testing/src/injection-tokens/factories/type.token.ts","../../../libs/product/testing/src/injection-tokens/factories/extra.token.ts","../../../libs/product/testing/src/factories/default-product.factory.ts","../../../libs/product/testing/src/factories/kind.factory.ts","../../../libs/product/testing/src/factories/extension.factory.ts","../../../libs/product/testing/src/helpers.ts","../../../libs/product/testing/src/testing.module.ts","../../../libs/product/testing/src/daffodil-product-testing.ts"],"sourcesContent":["import { Injectable } from '@angular/core';\nimport * as faker from 'faker/locale/en_US';\n\nimport { DaffModelFactory } from '@daffodil/core/testing';\nimport { DaffProductImage } from '@daffodil/product';\n\nconst productImageUrlsList: string[] = [\n '/assets/products/0.jpg',\n '/assets/products/1.jpg',\n '/assets/products/2.jpg',\n '/assets/products/3.jpg',\n '/assets/products/4.jpg',\n '/assets/products/5.jpg',\n '/assets/products/6.jpg',\n '/assets/products/7.jpg',\n '/assets/products/8.jpg',\n '/assets/products/9.jpg',\n '/assets/products/10.jpg',\n '/assets/products/11.jpg',\n '/assets/products/12.jpg',\n '/assets/products/13.jpg',\n '/assets/products/14.jpg',\n '/assets/products/15.jpg',\n '/assets/products/16.jpg',\n '/assets/products/17.jpg',\n '/assets/products/18.jpg',\n '/assets/products/19.jpg',\n '/assets/products/20.jpg',\n '/assets/products/21.jpg',\n '/assets/products/22.jpg',\n '/assets/products/23.jpg',\n '/assets/products/24.jpg',\n '/assets/products/25.jpg',\n '/assets/products/26.jpg',\n '/assets/products/27.jpg',\n '/assets/products/28.jpg',\n '/assets/products/29.jpg',\n '/assets/products/30.jpg',\n '/assets/products/31.jpg',\n '/assets/products/32.jpg',\n '/assets/products/33.jpg',\n '/assets/products/34.jpg',\n '/assets/products/35.jpg',\n '/assets/products/36.jpg',\n '/assets/products/37.jpg',\n '/assets/products/38.jpg',\n '/assets/products/39.jpg',\n '/assets/products/40.jpg',\n '/assets/products/41.jpg',\n '/assets/products/42.jpg',\n '/assets/products/43.jpg',\n '/assets/products/44.jpg',\n '/assets/products/45.jpg',\n '/assets/products/46.jpg',\n '/assets/products/47.jpg',\n '/assets/products/48.jpg',\n '/assets/products/49.jpg',\n '/assets/products/50.jpg',\n '/assets/products/51.jpg',\n '/assets/products/52.jpg',\n '/assets/products/53.jpg',\n '/assets/products/54.jpg',\n '/assets/products/55.jpg',\n '/assets/products/56.jpg',\n '/assets/products/57.jpg',\n '/assets/products/58.jpg',\n '/assets/products/59.jpg',\n '/assets/products/60.jpg',\n '/assets/products/61.jpg',\n '/assets/products/62.jpg',\n '/assets/products/63.jpg',\n '/assets/products/64.jpg',\n '/assets/products/65.jpg',\n '/assets/products/66.jpg',\n '/assets/products/67.jpg',\n '/assets/products/68.jpg',\n '/assets/products/69.jpg',\n '/assets/products/70.jpg',\n '/assets/products/71.jpg',\n '/assets/products/72.jpg',\n '/assets/products/73.jpg',\n '/assets/products/74.jpg',\n '/assets/products/75.jpg',\n '/assets/products/76.jpg',\n '/assets/products/77.jpg',\n '/assets/products/78.jpg',\n '/assets/products/79.jpg',\n '/assets/products/80.jpg',\n '/assets/products/81.jpg',\n '/assets/products/82.jpg',\n '/assets/products/83.jpg',\n '/assets/products/84.jpg',\n '/assets/products/85.jpg',\n '/assets/products/86.jpg',\n '/assets/products/87.jpg',\n '/assets/products/88.jpg',\n '/assets/products/89.jpg',\n '/assets/products/90.jpg',\n '/assets/products/91.jpg',\n '/assets/products/92.jpg',\n '/assets/products/93.jpg',\n '/assets/products/94.jpg',\n '/assets/products/95.jpg',\n '/assets/products/96.jpg',\n '/assets/products/97.jpg',\n '/assets/products/98.jpg',\n '/assets/products/99.jpg',\n '/assets/products/100.jpg',\n];\n\n/**\n * Mocked DaffProductImage object.\n */\nexport class MockProductImage implements DaffProductImage {\n id = faker.datatype.uuid();\n url = productImageUrlsList[faker.datatype.number(productImageUrlsList.length-1)];\n label = faker.lorem.sentence();\n}\n\n/**\n * A factory for creating DaffProductImage.\n */\n@Injectable({\n providedIn: 'root',\n})\nexport class DaffProductImageFactory extends DaffModelFactory<DaffProductImage> {\n constructor(){\n super(MockProductImage);\n }\n}\n","import {\n InjectionToken,\n Provider,\n Type,\n} from '@angular/core';\n\nimport { DaffModelFactory } from '@daffodil/core/testing';\nimport { DaffProduct } from '@daffodil/product';\n\n/**\n * A multi-provider injection token for providing extra product type factories.\n * These factories correspond to different product types that may be added by other packages.\n * This is useful for backend mocks (such as the in-memory driver) to generate an accurate representation\n * of the variety of products that an application can receive in production.\n */\nexport const DAFF_PRODUCT_TYPE_FACTORIES = new InjectionToken<DaffModelFactory<DaffProduct>[]>(\n 'DAFF_PRODUCT_TYPE_FACTORIES',\n { factory: () => [], providedIn: 'root' },\n);\n\n/**\n * Provides extra product factory types.\n *\n * See {@link DAFF_PRODUCT_TYPE_FACTORIES}.\n *\n * ```ts\n * providers: [\n * ...daffProvideProductExtraFactoryTypes(\n * MyProductFactory\n * )\n * ]\n * ```\n */\nexport function daffProvideProductExtraFactoryTypes<T extends DaffProduct = DaffProduct>(...factoryTypes: Type<DaffModelFactory<T>>[]): Provider[] {\n return factoryTypes.map(factoryType => ({\n provide: DAFF_PRODUCT_TYPE_FACTORIES,\n useExisting: factoryType,\n multi: true,\n }));\n}\n","import {\n InjectionToken,\n Provider,\n Type,\n} from '@angular/core';\n\nimport { DaffModelFactory } from '@daffodil/core/testing';\nimport { DaffProduct } from '@daffodil/product';\n\n/**\n * A multi-provider injection token for providing extra product factories.\n * These extra factories represent the additional product fields that may be added by other packages.\n * This is useful for backend mocks (such as the in-memory driver) to generate an accurate representation\n * of the entire product data that an application can receive in production.\n *\n * These factories will be invoked ang the return included in {@link DaffProductFactory}.\n */\nexport const DAFF_PRODUCT_EXTRA_FACTORIES = new InjectionToken<DaffModelFactory<DaffProduct>[]>(\n 'DAFF_PRODUCT_EXTRA_FACTORIES',\n { factory: () => [], providedIn: 'root' },\n);\n\n/**\n * Provides extra product factories.\n *\n * See {@link DAFF_PRODUCT_EXTRA_FACTORIES}.\n *\n * ```ts\n * providers: [\n * ...daffProvideProductExtraProductFactories(\n * MyProductFactory\n * )\n * ]\n * ```\n */\nexport function daffProvideProductExtraProductFactories<T extends DaffProduct = DaffProduct>(...factoryTypes: Type<DaffModelFactory<T>>[]): Provider[] {\n return factoryTypes.map(factoryType => ({\n provide: DAFF_PRODUCT_EXTRA_FACTORIES,\n useExisting: factoryType,\n multi: true,\n }));\n}\n","import { Injectable } from '@angular/core';\nimport * as faker from 'faker/locale/en_US';\n\nimport { DaffModelFactory } from '@daffodil/core/testing';\nimport {\n DaffProduct,\n DaffProductTypeEnum,\n} from '@daffodil/product';\n\n/**\n * Mocked DaffProduct object.\n */\nexport class MockProduct implements DaffProduct {\n\tprivate stubPrice = faker.datatype.number({ min: 1, max: 1500 });\n\tprivate stubDiscount = faker.datatype.number({ min: 0, max: this.stubPrice - 1 });\n\n\ttype = DaffProductTypeEnum.Simple;\n\tid = faker.datatype.uuid();\n\turl = `/${faker.random.word()}.html`;\n\tcanonicalUrl = faker.internet.url();\n\tprice = this.stubPrice;\n\tin_stock = true;\n\tdiscount = {\n\t amount: this.stubDiscount,\n\t percent: Math.floor((this.stubDiscount/this.stubPrice) * 100),\n\t};\n\timages = [];\n thumbnail = null;\n name = faker.commerce.productName();\n brand = faker.company.companyName();\n description = 'Lorem ipsum dolor sit amet, accumsan ullamcorper ei eam. Sint appetere ocurreret no per, et cum lorem disputationi. Sit ut magna delenit, assum vidisse vocibus sed ut. In aperiri malorum accusamus sea, novum mediocritatem ius at. Duo agam probo honestatis ut. Nec regione splendide cu, unum graeco vivendum in duo.';\n short_description = 'Lorem ipsum dolor sit amet, accumsan ullamcorper ei eam. Sint appetere ocurreret no per, et cum lorem disputationi. Sit ut magna delenit, assum vidisse vocibus sed ut. In aperiri malorum accusamus sea, novum mediocritatem ius at. Duo agam probo honestatis ut.';\n meta_title = faker.commerce.productName();\n meta_description = 'Lorem ipsum dolor sit amet, accumsan ullamcorper ei eam. Sint appetere ocurreret no per, et cum lorem disputationi. Sit ut magna delenit, assum vidisse vocibus sed ut. In aperiri malorum accusamus sea, novum mediocritatem ius at. Duo agam probo honestatis ut. Nec regione splendide cu, unum graeco vivendum in duo.';\n}\n\n/**\n * Factory for creating simple `DaffProduct`s of no special kind.\n */\n@Injectable({\n providedIn: 'root',\n})\nexport class DaffDefaultProductFactory extends DaffModelFactory<DaffProduct> {\n constructor() {\n super(MockProduct);\n }\n}\n","import {\n Injectable,\n Inject,\n} from '@angular/core';\n\nimport { sample } from '@daffodil/core';\nimport { DaffModelFactory } from '@daffodil/core/testing';\nimport { DaffProduct } from '@daffodil/product';\n\nimport { DAFF_PRODUCT_TYPE_FACTORIES } from '../injection-tokens/public_api';\nimport { MockProduct } from './default-product.factory';\n\n/**\n * Factory for creating DaffProducts.\n * This will create a random product kind,\n * including extra product kinds that may be provided by optional product packages.\n */\n@Injectable({\n providedIn: 'root',\n})\nexport class DaffProductKindFactory extends DaffModelFactory<DaffProduct> {\n constructor(\n @Inject(DAFF_PRODUCT_TYPE_FACTORIES) private productTypeFactories: DaffModelFactory<DaffProduct>[],\n ) {\n super(MockProduct);\n }\n\n private get _randomFactory(): DaffModelFactory<DaffProduct> {\n return sample(this.productTypeFactories);\n }\n\n /**\n * Creates a mock product of random kind.\n * Includes extra product kinds that may be provided by optional product packages.\n */\n create(partial = {}): DaffProduct {\n return this._randomFactory.create(partial);\n }\n}\n","import {\n Injectable,\n Inject,\n} from '@angular/core';\n\nimport { DaffModelFactory } from '@daffodil/core/testing';\nimport { DaffProduct } from '@daffodil/product';\n\nimport { DAFF_PRODUCT_EXTRA_FACTORIES } from '../injection-tokens/public_api';\nimport { MockProduct } from './default-product.factory';\nimport { DaffProductKindFactory } from './kind.factory';\n\n/**\n * Factory for creating `DaffProduct`s with extension fields.\n * This includes all the extra extension factories that may be provided by optional product packages.\n */\n@Injectable({\n providedIn: 'root',\n})\nexport class DaffProductExtensionFactory extends DaffModelFactory<DaffProduct> {\n constructor(\n @Inject(DAFF_PRODUCT_EXTRA_FACTORIES) private extraFactories: DaffModelFactory<DaffProduct>[],\n private productKindFactory: DaffProductKindFactory,\n ) {\n super(MockProduct);\n }\n\n /**\n * Creates a mock product of random type.\n * Includes extra product types that may be provided by optional product packages.\n * This includes all the extra extension factories that may be provided by optional product packages.\n */\n create(partial = {}): DaffProduct {\n const kind = this.productKindFactory.create(partial);\n\n return Object.assign(\n {},\n kind,\n ...this.extraFactories.map(factory => factory.create(partial)),\n // spread this in last to preserve kind's type\n { type: kind.type },\n );\n }\n}\n","import { DaffProduct } from '@daffodil/product';\n\n/**\n * A helper function to verify that a model is a Product.\n *\n * @param product\n */\nexport function isProduct(product: DaffProduct): boolean {\n return !!product.id\n && !!product.price\n && !!product.name\n && !!product.brand\n && !!product.description\n && !!product.images;\n}\n","import { NgModule } from '@angular/core';\n\nimport { DaffDefaultProductFactory } from './factories/public_api';\nimport { DAFF_PRODUCT_TYPE_FACTORIES } from './injection-tokens/public_api';\n\n/**\n * Provides the default product factory as a product type factory.\n */\n@NgModule({\n providers: [\n {\n provide: DAFF_PRODUCT_TYPE_FACTORIES,\n useExisting: DaffDefaultProductFactory,\n multi: true,\n },\n ],\n})\nexport class DaffProductTestingModule { }\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":["faker.datatype","faker.lorem","faker.random","faker.internet","faker.commerce","faker.company"],"mappings":";;;;;;AAMA,MAAM,oBAAoB,GAAa;IACrC,wBAAwB;IACxB,wBAAwB;IACxB,wBAAwB;IACxB,wBAAwB;IACxB,wBAAwB;IACxB,wBAAwB;IACxB,wBAAwB;IACxB,wBAAwB;IACxB,wBAAwB;IACxB,wBAAwB;IACxB,yBAAyB;IACzB,yBAAyB;IACzB,yBAAyB;IACzB,yBAAyB;IACzB,yBAAyB;IACzB,yBAAyB;IACzB,yBAAyB;IACzB,yBAAyB;IACzB,yBAAyB;IACzB,yBAAyB;IACzB,yBAAyB;IACzB,yBAAyB;IACzB,yBAAyB;IACzB,yBAAyB;IACzB,yBAAyB;IACzB,yBAAyB;IACzB,yB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/product/testing/src/factories/product-image.factory.ts","../../../libs/product/testing/src/injection-tokens/factories/type.token.ts","../../../libs/product/testing/src/injection-tokens/factories/extra.token.ts","../../../libs/product/testing/src/factories/default-product.factory.ts","../../../libs/product/testing/src/factories/kind.factory.ts","../../../libs/product/testing/src/factories/extension.factory.ts","../../../libs/product/testing/src/helpers.ts","../../../libs/product/testing/src/testing.module.ts","../../../libs/product/testing/src/daffodil-product-testing.ts"],"sourcesContent":["import { Injectable } from '@angular/core';\nimport * as faker from '@faker-js/faker/locale/en_US';\n\nimport { DaffModelFactory } from '@daffodil/core/testing';\nimport { DaffProductImage } from '@daffodil/product';\n\nconst productImageUrlsList: string[] = [\n '/assets/products/0.jpg',\n '/assets/products/1.jpg',\n '/assets/products/2.jpg',\n '/assets/products/3.jpg',\n '/assets/products/4.jpg',\n '/assets/products/5.jpg',\n '/assets/products/6.jpg',\n '/assets/products/7.jpg',\n '/assets/products/8.jpg',\n '/assets/products/9.jpg',\n '/assets/products/10.jpg',\n '/assets/products/11.jpg',\n '/assets/products/12.jpg',\n '/assets/products/13.jpg',\n '/assets/products/14.jpg',\n '/assets/products/15.jpg',\n '/assets/products/16.jpg',\n '/assets/products/17.jpg',\n '/assets/products/18.jpg',\n '/assets/products/19.jpg',\n '/assets/products/20.jpg',\n '/assets/products/21.jpg',\n '/assets/products/22.jpg',\n '/assets/products/23.jpg',\n '/assets/products/24.jpg',\n '/assets/products/25.jpg',\n '/assets/products/26.jpg',\n '/assets/products/27.jpg',\n '/assets/products/28.jpg',\n '/assets/products/29.jpg',\n '/assets/products/30.jpg',\n '/assets/products/31.jpg',\n '/assets/products/32.jpg',\n '/assets/products/33.jpg',\n '/assets/products/34.jpg',\n '/assets/products/35.jpg',\n '/assets/products/36.jpg',\n '/assets/products/37.jpg',\n '/assets/products/38.jpg',\n '/assets/products/39.jpg',\n '/assets/products/40.jpg',\n '/assets/products/41.jpg',\n '/assets/products/42.jpg',\n '/assets/products/43.jpg',\n '/assets/products/44.jpg',\n '/assets/products/45.jpg',\n '/assets/products/46.jpg',\n '/assets/products/47.jpg',\n '/assets/products/48.jpg',\n '/assets/products/49.jpg',\n '/assets/products/50.jpg',\n '/assets/products/51.jpg',\n '/assets/products/52.jpg',\n '/assets/products/53.jpg',\n '/assets/products/54.jpg',\n '/assets/products/55.jpg',\n '/assets/products/56.jpg',\n '/assets/products/57.jpg',\n '/assets/products/58.jpg',\n '/assets/products/59.jpg',\n '/assets/products/60.jpg',\n '/assets/products/61.jpg',\n '/assets/products/62.jpg',\n '/assets/products/63.jpg',\n '/assets/products/64.jpg',\n '/assets/products/65.jpg',\n '/assets/products/66.jpg',\n '/assets/products/67.jpg',\n '/assets/products/68.jpg',\n '/assets/products/69.jpg',\n '/assets/products/70.jpg',\n '/assets/products/71.jpg',\n '/assets/products/72.jpg',\n '/assets/products/73.jpg',\n '/assets/products/74.jpg',\n '/assets/products/75.jpg',\n '/assets/products/76.jpg',\n '/assets/products/77.jpg',\n '/assets/products/78.jpg',\n '/assets/products/79.jpg',\n '/assets/products/80.jpg',\n '/assets/products/81.jpg',\n '/assets/products/82.jpg',\n '/assets/products/83.jpg',\n '/assets/products/84.jpg',\n '/assets/products/85.jpg',\n '/assets/products/86.jpg',\n '/assets/products/87.jpg',\n '/assets/products/88.jpg',\n '/assets/products/89.jpg',\n '/assets/products/90.jpg',\n '/assets/products/91.jpg',\n '/assets/products/92.jpg',\n '/assets/products/93.jpg',\n '/assets/products/94.jpg',\n '/assets/products/95.jpg',\n '/assets/products/96.jpg',\n '/assets/products/97.jpg',\n '/assets/products/98.jpg',\n '/assets/products/99.jpg',\n '/assets/products/100.jpg',\n];\n\n/**\n * Mocked DaffProductImage object.\n */\nexport class MockProductImage implements DaffProductImage {\n id = faker.datatype.uuid();\n url = productImageUrlsList[faker.datatype.number(productImageUrlsList.length-1)];\n label = faker.lorem.sentence();\n}\n\n/**\n * A factory for creating DaffProductImage.\n */\n@Injectable({\n providedIn: 'root',\n})\nexport class DaffProductImageFactory extends DaffModelFactory<DaffProductImage> {\n constructor(){\n super(MockProductImage);\n }\n}\n","import {\n InjectionToken,\n Provider,\n Type,\n} from '@angular/core';\n\nimport { DaffModelFactory } from '@daffodil/core/testing';\nimport { DaffProduct } from '@daffodil/product';\n\n/**\n * A multi-provider injection token for providing extra product type factories.\n * These factories correspond to different product types that may be added by other packages.\n * This is useful for backend mocks (such as the in-memory driver) to generate an accurate representation\n * of the variety of products that an application can receive in production.\n */\nexport const DAFF_PRODUCT_TYPE_FACTORIES = new InjectionToken<DaffModelFactory<DaffProduct>[]>(\n 'DAFF_PRODUCT_TYPE_FACTORIES',\n { factory: () => [], providedIn: 'root' },\n);\n\n/**\n * Provides extra product factory types.\n *\n * See {@link DAFF_PRODUCT_TYPE_FACTORIES}.\n *\n * ```ts\n * providers: [\n * ...daffProvideProductExtraFactoryTypes(\n * MyProductFactory\n * )\n * ]\n * ```\n */\nexport function daffProvideProductExtraFactoryTypes<T extends DaffProduct = DaffProduct>(...factoryTypes: Type<DaffModelFactory<T>>[]): Provider[] {\n return factoryTypes.map(factoryType => ({\n provide: DAFF_PRODUCT_TYPE_FACTORIES,\n useExisting: factoryType,\n multi: true,\n }));\n}\n","import {\n InjectionToken,\n Provider,\n Type,\n} from '@angular/core';\n\nimport { DaffModelFactory } from '@daffodil/core/testing';\nimport { DaffProduct } from '@daffodil/product';\n\n/**\n * A multi-provider injection token for providing extra product factories.\n * These extra factories represent the additional product fields that may be added by other packages.\n * This is useful for backend mocks (such as the in-memory driver) to generate an accurate representation\n * of the entire product data that an application can receive in production.\n *\n * These factories will be invoked ang the return included in {@link DaffProductFactory}.\n */\nexport const DAFF_PRODUCT_EXTRA_FACTORIES = new InjectionToken<DaffModelFactory<DaffProduct>[]>(\n 'DAFF_PRODUCT_EXTRA_FACTORIES',\n { factory: () => [], providedIn: 'root' },\n);\n\n/**\n * Provides extra product factories.\n *\n * See {@link DAFF_PRODUCT_EXTRA_FACTORIES}.\n *\n * ```ts\n * providers: [\n * ...daffProvideProductExtraProductFactories(\n * MyProductFactory\n * )\n * ]\n * ```\n */\nexport function daffProvideProductExtraProductFactories<T extends DaffProduct = DaffProduct>(...factoryTypes: Type<DaffModelFactory<T>>[]): Provider[] {\n return factoryTypes.map(factoryType => ({\n provide: DAFF_PRODUCT_EXTRA_FACTORIES,\n useExisting: factoryType,\n multi: true,\n }));\n}\n","import { Injectable } from '@angular/core';\nimport * as faker from '@faker-js/faker/locale/en_US';\n\nimport { DaffModelFactory } from '@daffodil/core/testing';\nimport {\n DaffProduct,\n DaffProductTypeEnum,\n} from '@daffodil/product';\n\n/**\n * Mocked DaffProduct object.\n */\nexport class MockProduct implements DaffProduct {\n\tprivate stubPrice = faker.datatype.number({ min: 1, max: 1500 });\n\tprivate stubDiscount = faker.datatype.number({ min: 0, max: this.stubPrice - 1 });\n\n\ttype = DaffProductTypeEnum.Simple;\n\tid = faker.datatype.uuid();\n\turl = `/${faker.internet.domainWord()}.html`;\n\tcanonicalUrl = faker.internet.url();\n\tprice = this.stubPrice;\n\tin_stock = true;\n\tdiscount = {\n\t amount: this.stubDiscount,\n\t percent: Math.floor((this.stubDiscount/this.stubPrice) * 100),\n\t};\n\timages = [];\n thumbnail = null;\n name = faker.commerce.productName();\n brand = faker.company.companyName();\n description = 'Lorem ipsum dolor sit amet, accumsan ullamcorper ei eam. Sint appetere ocurreret no per, et cum lorem disputationi. Sit ut magna delenit, assum vidisse vocibus sed ut. In aperiri malorum accusamus sea, novum mediocritatem ius at. Duo agam probo honestatis ut. Nec regione splendide cu, unum graeco vivendum in duo.';\n short_description = 'Lorem ipsum dolor sit amet, accumsan ullamcorper ei eam. Sint appetere ocurreret no per, et cum lorem disputationi. Sit ut magna delenit, assum vidisse vocibus sed ut. In aperiri malorum accusamus sea, novum mediocritatem ius at. Duo agam probo honestatis ut.';\n meta_title = faker.commerce.productName();\n meta_description = 'Lorem ipsum dolor sit amet, accumsan ullamcorper ei eam. Sint appetere ocurreret no per, et cum lorem disputationi. Sit ut magna delenit, assum vidisse vocibus sed ut. In aperiri malorum accusamus sea, novum mediocritatem ius at. Duo agam probo honestatis ut. Nec regione splendide cu, unum graeco vivendum in duo.';\n}\n\n/**\n * Factory for creating simple `DaffProduct`s of no special kind.\n */\n@Injectable({\n providedIn: 'root',\n})\nexport class DaffDefaultProductFactory extends DaffModelFactory<DaffProduct> {\n constructor() {\n super(MockProduct);\n }\n}\n","import {\n Injectable,\n Inject,\n} from '@angular/core';\n\nimport { sample } from '@daffodil/core';\nimport { DaffModelFactory } from '@daffodil/core/testing';\nimport { DaffProduct } from '@daffodil/product';\n\nimport { DAFF_PRODUCT_TYPE_FACTORIES } from '../injection-tokens/public_api';\nimport { MockProduct } from './default-product.factory';\n\n/**\n * Factory for creating DaffProducts.\n * This will create a random product kind,\n * including extra product kinds that may be provided by optional product packages.\n */\n@Injectable({\n providedIn: 'root',\n})\nexport class DaffProductKindFactory extends DaffModelFactory<DaffProduct> {\n constructor(\n @Inject(DAFF_PRODUCT_TYPE_FACTORIES) private productTypeFactories: DaffModelFactory<DaffProduct>[],\n ) {\n super(MockProduct);\n }\n\n private get _randomFactory(): DaffModelFactory<DaffProduct> {\n return sample(this.productTypeFactories);\n }\n\n /**\n * Creates a mock product of random kind.\n * Includes extra product kinds that may be provided by optional product packages.\n */\n create(partial = {}): DaffProduct {\n return this._randomFactory.create(partial);\n }\n}\n","import {\n Injectable,\n Inject,\n} from '@angular/core';\n\nimport { DaffModelFactory } from '@daffodil/core/testing';\nimport { DaffProduct } from '@daffodil/product';\n\nimport { DAFF_PRODUCT_EXTRA_FACTORIES } from '../injection-tokens/public_api';\nimport { MockProduct } from './default-product.factory';\nimport { DaffProductKindFactory } from './kind.factory';\n\n/**\n * Factory for creating `DaffProduct`s with extension fields.\n * This includes all the extra extension factories that may be provided by optional product packages.\n */\n@Injectable({\n providedIn: 'root',\n})\nexport class DaffProductExtensionFactory extends DaffModelFactory<DaffProduct> {\n constructor(\n @Inject(DAFF_PRODUCT_EXTRA_FACTORIES) private extraFactories: DaffModelFactory<DaffProduct>[],\n private productKindFactory: DaffProductKindFactory,\n ) {\n super(MockProduct);\n }\n\n /**\n * Creates a mock product of random type.\n * Includes extra product types that may be provided by optional product packages.\n * This includes all the extra extension factories that may be provided by optional product packages.\n */\n create(partial = {}): DaffProduct {\n const kind = this.productKindFactory.create(partial);\n\n return Object.assign(\n {},\n kind,\n ...this.extraFactories.map(factory => factory.create(partial)),\n // spread this in last to preserve kind's type\n { type: kind.type },\n );\n }\n}\n","import { DaffProduct } from '@daffodil/product';\n\n/**\n * A helper function to verify that a model is a Product.\n *\n * @param product\n */\nexport function isProduct(product: DaffProduct): boolean {\n return !!product.id\n && !!product.price\n && !!product.name\n && !!product.brand\n && !!product.description\n && !!product.images;\n}\n","import { NgModule } from '@angular/core';\n\nimport { DaffDefaultProductFactory } from './factories/public_api';\nimport { DAFF_PRODUCT_TYPE_FACTORIES } from './injection-tokens/public_api';\n\n/**\n * Provides the default product factory as a product type factory.\n */\n@NgModule({\n providers: [\n {\n provide: DAFF_PRODUCT_TYPE_FACTORIES,\n useExisting: DaffDefaultProductFactory,\n multi: true,\n },\n ],\n})\nexport class DaffProductTestingModule { }\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":["faker.datatype","faker.lorem","faker.internet","faker.commerce","faker.company"],"mappings":";;;;;;AAMA,MAAM,oBAAoB,GAAa;IACrC,wBAAwB;IACxB,wBAAwB;IACxB,wBAAwB;IACxB,wBAAwB;IACxB,wBAAwB;IACxB,wBAAwB;IACxB,wBAAwB;IACxB,wBAAwB;IACxB,wBAAwB;IACxB,wBAAwB;IACxB,yBAAyB;IACzB,yBAAyB;IACzB,yBAAyB;IACzB,yBAAyB;IACzB,yBAAyB;IACzB,yBAAyB;IACzB,yBAAyB;IACzB,yBAAyB;IACzB,yBAAyB;IACzB,yBAAyB;IACzB,yBAAyB;IACzB,yBAAyB;IACzB,yBAAyB;IACzB,yBAAyB;IACzB,yBAAyB;IACzB,yBAAyB;IAC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
|
1
1
|
{
|
|
2
2
|
"name": "@daffodil/product",
|
|
3
|
-
"version": "0.39.
|
|
3
|
+
"version": "0.39.10",
|
|
4
4
|
"description": "Interfaces built for daffodil/state",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
"peerDependencies": {
|
|
19
19
|
"@angular/common": "^11.0.0",
|
|
20
20
|
"@angular/core": "^11.0.0",
|
|
21
|
-
"@daffodil/core": "0.39.
|
|
21
|
+
"@daffodil/core": "0.39.10",
|
|
22
22
|
"@ngrx/effects": "^11.0.0",
|
|
23
23
|
"@ngrx/entity": "^11.0.0",
|
|
24
24
|
"@ngrx/store": "^11.0.0",
|
|
@@ -26,10 +26,10 @@
|
|
|
26
26
|
},
|
|
27
27
|
"optionalDependencies": {
|
|
28
28
|
"@apollo/client": "^3.0.0",
|
|
29
|
-
"@daffodil/driver": "0.39.
|
|
29
|
+
"@daffodil/driver": "0.39.10",
|
|
30
30
|
"angular-in-memory-web-api": "^0.11.0",
|
|
31
31
|
"apollo-angular": "^2.4.0",
|
|
32
|
-
"faker": "^5.5.3"
|
|
32
|
+
"@faker-js/faker": "^5.5.3"
|
|
33
33
|
},
|
|
34
34
|
"main": "bundles/daffodil-product.umd.js",
|
|
35
35
|
"module": "fesm2015/daffodil-product.js",
|