@daffodil/product 0.64.1 → 0.66.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.
Files changed (41) hide show
  1. package/esm2020/driver/in-memory/backend/product.service.mjs +2 -2
  2. package/esm2020/driver/in-memory/driver/product-driver.module.mjs +3 -2
  3. package/esm2020/public_api.mjs +1 -2
  4. package/esm2020/state/effects/best-seller.effects.mjs +2 -2
  5. package/esm2020/state/effects/product-grid.effects.mjs +2 -2
  6. package/esm2020/state/effects/product-page.effects.mjs +2 -2
  7. package/esm2020/state/effects/product.effects.mjs +2 -2
  8. package/esm2020/state/injection-tokens/error-matcher.token.mjs +8 -0
  9. package/esm2020/state/injection-tokens/public_api.mjs +2 -0
  10. package/esm2020/state/public_api.mjs +2 -1
  11. package/esm2020/testing/factories/default-product.factory.mjs +15 -12
  12. package/esm2020/testing/factories/extension.factory.mjs +1 -1
  13. package/esm2020/testing/factories/kind.factory.mjs +1 -1
  14. package/fesm2015/daffodil-product-driver-in-memory.mjs +3 -2
  15. package/fesm2015/daffodil-product-driver-in-memory.mjs.map +1 -1
  16. package/fesm2015/daffodil-product-state.mjs +9 -4
  17. package/fesm2015/daffodil-product-state.mjs.map +1 -1
  18. package/fesm2015/daffodil-product-testing.mjs +12 -11
  19. package/fesm2015/daffodil-product-testing.mjs.map +1 -1
  20. package/fesm2015/daffodil-product.mjs +1 -10
  21. package/fesm2015/daffodil-product.mjs.map +1 -1
  22. package/fesm2020/daffodil-product-driver-in-memory.mjs +3 -2
  23. package/fesm2020/daffodil-product-driver-in-memory.mjs.map +1 -1
  24. package/fesm2020/daffodil-product-state.mjs +9 -4
  25. package/fesm2020/daffodil-product-state.mjs.map +1 -1
  26. package/fesm2020/daffodil-product-testing.mjs +12 -11
  27. package/fesm2020/daffodil-product-testing.mjs.map +1 -1
  28. package/fesm2020/daffodil-product.mjs +1 -10
  29. package/fesm2020/daffodil-product.mjs.map +1 -1
  30. package/package.json +1 -1
  31. package/public_api.d.ts +0 -1
  32. package/state/public_api.d.ts +1 -0
  33. package/testing/factories/default-product.factory.d.ts +6 -3
  34. package/testing/factories/extension.factory.d.ts +1 -1
  35. package/testing/factories/kind.factory.d.ts +1 -1
  36. package/testing/injection-tokens/factories/extra.token.d.ts +1 -1
  37. package/testing/injection-tokens/factories/type.token.d.ts +1 -1
  38. package/esm2020/injection-tokens/error-matcher.token.mjs +0 -8
  39. package/esm2020/injection-tokens/public_api.mjs +0 -2
  40. /package/{injection-tokens → state/injection-tokens}/error-matcher.token.d.ts +0 -0
  41. /package/{injection-tokens → state/injection-tokens}/public_api.d.ts +0 -0
@@ -140,7 +140,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImpor
140
140
  * Mocked DaffProduct object.
141
141
  */
142
142
  class MockProduct {
143
- constructor() {
143
+ constructor(imageFactory) {
144
+ this.imageFactory = imageFactory;
144
145
  this.stubPrice = faker.datatype.number({ min: 1, max: 1500 });
145
146
  this.stubDiscount = faker.datatype.number({ min: 0, max: this.stubPrice - 1 });
146
147
  this.type = DaffProductTypeEnum.Simple;
@@ -153,32 +154,32 @@ class MockProduct {
153
154
  amount: this.stubDiscount,
154
155
  percent: Math.floor((this.stubDiscount / this.stubPrice) * 100),
155
156
  };
156
- this.images = [];
157
- this.thumbnail = null;
157
+ this.images = this.imageFactory.createMany(faker.datatype.number({ min: 1, max: 10 }));
158
+ this.thumbnail = this.imageFactory.create();
158
159
  this.name = faker.commerce.productName();
159
- this.brand = faker.company.companyName();
160
- this.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.';
161
- this.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.';
160
+ this.brand = faker.company.name();
161
+ this.description = faker.commerce.productDescription();
162
+ this.short_description = faker.commerce.productDescription();
162
163
  this.meta_title = faker.commerce.productName();
163
- this.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.';
164
+ this.meta_description = faker.commerce.productDescription();
164
165
  }
165
166
  }
166
167
  /**
167
168
  * Factory for creating simple `DaffProduct`s of no special kind.
168
169
  */
169
170
  class DaffDefaultProductFactory extends DaffModelFactory {
170
- constructor() {
171
- super(MockProduct);
171
+ constructor(imageFactory) {
172
+ super(MockProduct, imageFactory);
172
173
  }
173
174
  }
174
- /** @nocollapse */ DaffDefaultProductFactory.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: DaffDefaultProductFactory, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
175
+ /** @nocollapse */ DaffDefaultProductFactory.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: DaffDefaultProductFactory, deps: [{ token: DaffProductImageFactory }], target: i0.ɵɵFactoryTarget.Injectable });
175
176
  /** @nocollapse */ DaffDefaultProductFactory.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: DaffDefaultProductFactory, providedIn: 'root' });
176
177
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: DaffDefaultProductFactory, decorators: [{
177
178
  type: Injectable,
178
179
  args: [{
179
180
  providedIn: 'root',
180
181
  }]
181
- }], ctorParameters: function () { return []; } });
182
+ }], ctorParameters: function () { return [{ type: DaffProductImageFactory }]; } });
182
183
 
183
184
  /**
184
185
  * A multi-provider injection token for providing extra product type factories.
@@ -1 +1 @@
1
- {"version":3,"file":"daffodil-product-testing.mjs","sources":["../../../libs/product/testing/src/factories/product-image.factory.ts","../../../libs/product/testing/src/factories/default-product.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/kind.factory.ts","../../../libs/product/testing/src/factories/extension.factory.ts","../../../libs/product/testing/src/factories/collection.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 { 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 { Injectable } from '@angular/core';\nimport { 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 private stubPrice = faker.datatype.number({ min: 1, max: 1500 });\n private stubDiscount = faker.datatype.number({ min: 0, max: this.stubPrice - 1 });\n\n type = DaffProductTypeEnum.Simple;\n id = faker.datatype.uuid();\n url = `/${faker.internet.domainWord()}.html`;\n canonicalUrl = faker.internet.url();\n price = this.stubPrice;\n in_stock = true;\n discount = {\n\t amount: this.stubDiscount,\n\t percent: Math.floor((this.stubDiscount/this.stubPrice) * 100),\n };\n images = [];\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 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 {\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 { MockProduct } from './default-product.factory';\nimport { DAFF_PRODUCT_TYPE_FACTORIES } from '../injection-tokens/public_api';\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 { MockProduct } from './default-product.factory';\nimport { DaffProductKindFactory } from './kind.factory';\nimport { DAFF_PRODUCT_EXTRA_FACTORIES } from '../injection-tokens/public_api';\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<T extends DaffProduct = DaffProduct> extends DaffModelFactory<T> {\n constructor(\n @Inject(DAFF_PRODUCT_EXTRA_FACTORIES) private extraFactories: DaffModelFactory<T>[],\n private productKindFactory: DaffProductKindFactory,\n ) {\n super(null);\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 = {}): T {\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 { Injectable } from '@angular/core';\n\nimport {\n DaffCollectionMetadataFactory,\n DaffModelFactory,\n MockCollection,\n} from '@daffodil/core/testing';\nimport {\n DaffProduct,\n DaffProductCollection,\n} from '@daffodil/product';\n\nimport { DaffProductKindFactory } from './kind.factory';\n\n/**\n * Mocked {@link DaffProductCollection} object.\n */\nexport class MockProductCollection extends MockCollection<DaffProduct> implements DaffProductCollection {\n constructor(\n productFactory: DaffProductKindFactory,\n metadataFactory: DaffCollectionMetadataFactory,\n ) {\n super(\n productFactory,\n metadataFactory,\n );\n }\n}\n\n/**\n * Factory for creating {@link DaffProductCollection}s.\n */\n@Injectable({\n providedIn: 'root',\n})\nexport class DaffProductCollectionFactory extends DaffModelFactory<DaffProductCollection> {\n constructor(\n productFactory: DaffProductKindFactory,\n metadataFactory: DaffCollectionMetadataFactory,\n ) {\n super(MockProductCollection, productFactory, metadataFactory);\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":["i1.DaffProductKindFactory"],"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,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,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,yBAAyB;IACzB,yBAAyB;IACzB,yBAAyB;IACzB,yBAAyB;IACzB,yBAAyB;IACzB,yBAAyB;IACzB,yBAAyB;IACzB,yB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AAU,EAAE,MAAM;AACnB,iBAAA,CAAA;;;AChCD;;;;AAIG;AACG,SAAU,SAAS,CAAC,OAAoB,EAAA;AAC5C,IAAA,OAAO,CAAC,CAAC,OAAO,CAAC,EAAE;WACd,CAAC,CAAC,OAAO,CAAC,KAAK;WACf,CAAC,CAAC,OAAO,CAAC,IAAI;WACd,CAAC,CAAC,OAAO,CAAC,KAAK;WACf,CAAC,CAAC,OAAO,CAAC,WAAW;AACrB,WAAA,CAAC,CAAC,OAAO,CAAC,MAAM,CAAC;AACxB;;ACTA;;AAEG;MAUU,wBAAwB,CAAA;;wIAAxB,wBAAwB,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,QAAA,EAAA,CAAA,CAAA;yIAAxB,wBAAwB,EAAA,CAAA,CAAA;AAAxB,mBAAA,wBAAA,CAAA,IAAA,GAAA,EAAA,CAAA,mBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,QAAA,EAAA,QAAA,EAAA,EAAA,EAAA,IAAA,EAAA,wBAAwB,EARxB,SAAA,EAAA;AACT,QAAA;AACE,YAAA,OAAO,EAAE,2BAA2B;AACpC,YAAA,WAAW,EAAE,yBAAyB;AACtC,YAAA,KAAK,EAAE,IAAI;AACZ,SAAA;AACF,KAAA,EAAA,CAAA,CAAA;2FAEU,wBAAwB,EAAA,UAAA,EAAA,CAAA;kBATpC,QAAQ;AAAC,YAAA,IAAA,EAAA,CAAA;AACR,oBAAA,SAAS,EAAE;AACT,wBAAA;AACE,4BAAA,OAAO,EAAE,2BAA2B;AACpC,4BAAA,WAAW,EAAE,yBAAyB;AACtC,4BAAA,KAAK,EAAE,IAAI;AACZ,yBAAA;AACF,qBAAA;AACF,iBAAA,CAAA;;;AChBD;;AAEG;;;;"}
1
+ {"version":3,"file":"daffodil-product-testing.mjs","sources":["../../../libs/product/testing/src/factories/product-image.factory.ts","../../../libs/product/testing/src/factories/default-product.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/kind.factory.ts","../../../libs/product/testing/src/factories/extension.factory.ts","../../../libs/product/testing/src/factories/collection.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 { 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 { Injectable } from '@angular/core';\nimport { 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\nimport { DaffProductImageFactory } from './product-image.factory';\n\n/**\n * Mocked DaffProduct object.\n */\nexport class MockProduct implements DaffProduct {\n private stubPrice = faker.datatype.number({ min: 1, max: 1500 });\n private stubDiscount = faker.datatype.number({ min: 0, max: this.stubPrice - 1 });\n\n type = DaffProductTypeEnum.Simple;\n id = faker.datatype.uuid();\n url = `/${faker.internet.domainWord()}.html`;\n canonicalUrl = faker.internet.url();\n price = this.stubPrice;\n in_stock = true;\n discount = {\n\t amount: this.stubDiscount,\n\t percent: Math.floor((this.stubDiscount/this.stubPrice) * 100),\n };\n images = this.imageFactory.createMany(faker.datatype.number({ min: 1, max: 10 }));\n thumbnail = this.imageFactory.create();\n name = faker.commerce.productName();\n brand = faker.company.name();\n description = faker.commerce.productDescription();\n short_description = faker.commerce.productDescription();\n meta_title = faker.commerce.productName();\n meta_description = faker.commerce.productDescription();\n\n constructor(\n protected imageFactory: DaffProductImageFactory,\n ) {}\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 imageFactory: DaffProductImageFactory,\n ) {\n super(MockProduct, imageFactory);\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 {\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 { MockProduct } from './default-product.factory';\nimport { DAFF_PRODUCT_TYPE_FACTORIES } from '../injection-tokens/public_api';\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: Partial<DaffProduct> = {}): 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 { MockProduct } from './default-product.factory';\nimport { DaffProductKindFactory } from './kind.factory';\nimport { DAFF_PRODUCT_EXTRA_FACTORIES } from '../injection-tokens/public_api';\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<T extends DaffProduct = DaffProduct> extends DaffModelFactory<T> {\n constructor(\n @Inject(DAFF_PRODUCT_EXTRA_FACTORIES) private extraFactories: DaffModelFactory<T>[],\n private productKindFactory: DaffProductKindFactory,\n ) {\n super(null);\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: Partial<T> = {}): T {\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 { Injectable } from '@angular/core';\n\nimport {\n DaffCollectionMetadataFactory,\n DaffModelFactory,\n MockCollection,\n} from '@daffodil/core/testing';\nimport {\n DaffProduct,\n DaffProductCollection,\n} from '@daffodil/product';\n\nimport { DaffProductKindFactory } from './kind.factory';\n\n/**\n * Mocked {@link DaffProductCollection} object.\n */\nexport class MockProductCollection extends MockCollection<DaffProduct> implements DaffProductCollection {\n constructor(\n productFactory: DaffProductKindFactory,\n metadataFactory: DaffCollectionMetadataFactory,\n ) {\n super(\n productFactory,\n metadataFactory,\n );\n }\n}\n\n/**\n * Factory for creating {@link DaffProductCollection}s.\n */\n@Injectable({\n providedIn: 'root',\n})\nexport class DaffProductCollectionFactory extends DaffModelFactory<DaffProductCollection> {\n constructor(\n productFactory: DaffProductKindFactory,\n metadataFactory: DaffCollectionMetadataFactory,\n ) {\n super(MockProductCollection, productFactory, metadataFactory);\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":["i1.DaffProductImageFactory","i1.DaffProductKindFactory"],"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,yBAA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S,CAAC,OAAoB,EAAA;AAC5C,IAAA,OAAO,CAAC,CAAC,OAAO,CAAC,EAAE;WACd,CAAC,CAAC,OAAO,CAAC,KAAK;WACf,CAAC,CAAC,OAAO,CAAC,IAAI;WACd,CAAC,CAAC,OAAO,CAAC,KAAK;WACf,CAAC,CAAC,OAAO,CAAC,WAAW;AACrB,WAAA,CAAC,CAAC,OAAO,CAAC,MAAM,CAAC;AACxB;;ACTA;;AAEG;MAUU,wBAAwB,CAAA;;wIAAxB,wBAAwB,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,QAAA,EAAA,CAAA,CAAA;yIAAxB,wBAAwB,EAAA,CAAA,CAAA;AAAxB,mBAAA,wBAAA,CAAA,IAAA,GAAA,EAAA,CAAA,mBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,QAAA,EAAA,QAAA,EAAA,EAAA,EAAA,IAAA,EAAA,wBAAwB,EARxB,SAAA,EAAA;AACT,QAAA;AACE,YAAA,OAAO,EAAE,2BAA2B;AACpC,YAAA,WAAW,EAAE,yBAAyB;AACtC,YAAA,KAAK,EAAE,IAAI;AACZ,SAAA;AACF,KAAA,EAAA,CAAA,CAAA;2FAEU,wBAAwB,EAAA,UAAA,EAAA,CAAA;kBATpC,QAAQ;AAAC,YAAA,IAAA,EAAA,CAAA;AACR,oBAAA,SAAS,EAAE;AACT,wBAAA;AACE,4BAAA,OAAO,EAAE,2BAA2B;AACpC,4BAAA,WAAW,EAAE,yBAAyB;AACtC,4BAAA,KAAK,EAAE,IAAI;AACZ,yBAAA;AACF,qBAAA;AACF,iBAAA,CAAA;;;AChBD;;AAEG;;;;"}
@@ -1,6 +1,3 @@
1
- import { InjectionToken } from '@angular/core';
2
- import { daffTransformErrorToStateError } from '@daffodil/core/state';
3
-
4
1
  /**
5
2
  * The possible product types.
6
3
  */
@@ -27,15 +24,9 @@ const productPriceRangeHasDiscount = (priceRange) => priceRange.minPrice.origina
27
24
  const productPriceRangeHasPriceRange = (priceRange) => priceRange.minPrice.originalPrice !== priceRange.maxPrice.originalPrice ||
28
25
  priceRange.minPrice.discountedPrice !== priceRange.maxPrice.discountedPrice;
29
26
 
30
- /**
31
- * Transforms {@link DaffError}s into {@link DaffStateError}s before they are serialized into state.
32
- * Can be used to further refine Daffodil errors into more specific app errors.
33
- */
34
- const DAFF_PRODUCT_ERROR_MATCHER = new InjectionToken('DAFF_PRODUCT_ERROR_MATCHER', { factory: () => daffTransformErrorToStateError });
35
-
36
27
  /**
37
28
  * Generated bundle index. Do not edit.
38
29
  */
39
30
 
40
- export { DAFF_PRODUCT_ERROR_MATCHER, DaffProductTypeEnum, productPriceRangeHasDiscount, productPriceRangeHasPriceRange };
31
+ export { DaffProductTypeEnum, productPriceRangeHasDiscount, productPriceRangeHasPriceRange };
41
32
  //# sourceMappingURL=daffodil-product.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"daffodil-product.mjs","sources":["../../../libs/product/src/models/product.ts","../../../libs/product/src/helpers/has-discount.ts","../../../libs/product/src/helpers/has-price-range.ts","../../../libs/product/src/injection-tokens/error-matcher.token.ts","../../../libs/product/src/daffodil-product.ts"],"sourcesContent":["import {\n DaffIdentifiable,\n DaffLocatable,\n DaffCanonicallyLocatable,\n} from '@daffodil/core';\n\nimport { DaffProductImage } from './product-image';\n\n/**\n * The possible product types.\n */\nexport enum DaffProductTypeEnum {\n Simple = 'simple',\n Composite = 'composite',\n Configurable = 'configurable'\n}\n\n/**\n * An interface for a product usable by the @daffodil/product library.\n */\nexport interface DaffProduct\n extends DaffLocatable, DaffIdentifiable, Partial<DaffCanonicallyLocatable> {\n\n /**\n * The type of product.\n */\n type: DaffProductTypeEnum;\n\n /**\n * The product name.\n */\n name: string;\n\n /**\n * An image to concisely visualize the product.\n */\n thumbnail: DaffProductImage;\n\n /**\n * An array of images for the product.\n */\n images?: DaffProductImage[];\n\n // TODO: move to subtypes\n /**\n * The price of the product.\n */\n price?: number;\n\n /**\n * The total discounts associated with this product.\n */\n discount?: DaffProductDiscount;\n\n /**\n * Whether or not the product is in stock.\n */\n in_stock?: boolean;\n\n // TODO: move to meta object\n /**\n * The product brand.\n */\n brand?: string;\n\n /**\n * Describes the product.\n */\n description?: string;\n\n /**\n * A shorter description of the product.\n */\n short_description?: string;\n\n /**\n * A title for the product to display in the browser tab title.\n */\n meta_title?: string;\n\n /**\n * A description of the product for usage in search engine results.\n */\n meta_description?: string;\n}\n\n/**\n * The discount for a product.\n */\nexport interface DaffProductDiscount {\n /**\n * The discount represented as some amount of currency.\n */\n amount: number;\n\n /**\n * The discount represented as a percent of the original product price.\n */\n percent: number;\n}\n","import { DaffPriceRange } from '../models/public_api';\n\n/**\n * Returns whether a DaffPriceRange has a discount.\n *\n * @param priceRange a DaffPriceRange\n */\nexport const productPriceRangeHasDiscount = (priceRange: DaffPriceRange): boolean => priceRange.minPrice.originalPrice !== priceRange.minPrice.discountedPrice ||\n\t\tpriceRange.maxPrice.originalPrice !== priceRange.maxPrice.discountedPrice;\n","import { DaffPriceRange } from '../models/public_api';\n\n/**\n * Returns whether the min and max prices of a DaffPriceRange are different.\n *\n * @param priceRange a DaffPriceRange\n */\nexport const productPriceRangeHasPriceRange = (priceRange: DaffPriceRange): boolean => priceRange.minPrice.originalPrice !== priceRange.maxPrice.originalPrice ||\n\t\tpriceRange.minPrice.discountedPrice !== priceRange.maxPrice.discountedPrice;\n","import { InjectionToken } from '@angular/core';\n\nimport { daffTransformErrorToStateError } from '@daffodil/core/state';\n\n/**\n * Transforms {@link DaffError}s into {@link DaffStateError}s before they are serialized into state.\n * Can be used to further refine Daffodil errors into more specific app errors.\n */\nexport const DAFF_PRODUCT_ERROR_MATCHER = new InjectionToken<typeof daffTransformErrorToStateError>(\n 'DAFF_PRODUCT_ERROR_MATCHER',\n { factory: () => daffTransformErrorToStateError },\n);\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;AAQA;;AAEG;IACS,oBAIX;AAJD,CAAA,UAAY,mBAAmB,EAAA;AAC7B,IAAA,mBAAA,CAAA,QAAA,CAAA,GAAA,QAAiB,CAAA;AACjB,IAAA,mBAAA,CAAA,WAAA,CAAA,GAAA,WAAuB,CAAA;AACvB,IAAA,mBAAA,CAAA,cAAA,CAAA,GAAA,cAA6B,CAAA;AAC/B,CAAC,EAJW,mBAAmB,KAAnB,mBAAmB,GAI9B,EAAA,CAAA,CAAA;;ACbD;;;;AAIG;AACU,MAAA,4BAA4B,GAAG,CAAC,UAA0B,KAAc,UAAU,CAAC,QAAQ,CAAC,aAAa,KAAK,UAAU,CAAC,QAAQ,CAAC,eAAe;IAC5J,UAAU,CAAC,QAAQ,CAAC,aAAa,KAAK,UAAU,CAAC,QAAQ,CAAC;;ACN5D;;;;AAIG;AACU,MAAA,8BAA8B,GAAG,CAAC,UAA0B,KAAc,UAAU,CAAC,QAAQ,CAAC,aAAa,KAAK,UAAU,CAAC,QAAQ,CAAC,aAAa;IAC5J,UAAU,CAAC,QAAQ,CAAC,eAAe,KAAK,UAAU,CAAC,QAAQ,CAAC;;ACJ9D;;;AAGG;AACU,MAAA,0BAA0B,GAAG,IAAI,cAAc,CAC1D,4BAA4B,EAC5B,EAAE,OAAO,EAAE,MAAM,8BAA8B,EAAE;;ACVnD;;AAEG;;;;"}
1
+ {"version":3,"file":"daffodil-product.mjs","sources":["../../../libs/product/src/models/product.ts","../../../libs/product/src/helpers/has-discount.ts","../../../libs/product/src/helpers/has-price-range.ts","../../../libs/product/src/daffodil-product.ts"],"sourcesContent":["import {\n DaffIdentifiable,\n DaffLocatable,\n DaffCanonicallyLocatable,\n} from '@daffodil/core';\n\nimport { DaffProductImage } from './product-image';\n\n/**\n * The possible product types.\n */\nexport enum DaffProductTypeEnum {\n Simple = 'simple',\n Composite = 'composite',\n Configurable = 'configurable'\n}\n\n/**\n * An interface for a product usable by the @daffodil/product library.\n */\nexport interface DaffProduct\n extends DaffLocatable, DaffIdentifiable, Partial<DaffCanonicallyLocatable> {\n\n /**\n * The type of product.\n */\n type: DaffProductTypeEnum;\n\n /**\n * The product name.\n */\n name: string;\n\n /**\n * An image to concisely visualize the product.\n */\n thumbnail: DaffProductImage;\n\n /**\n * An array of images for the product.\n */\n images?: DaffProductImage[];\n\n // TODO: move to subtypes\n /**\n * The price of the product.\n */\n price?: number;\n\n /**\n * The total discounts associated with this product.\n */\n discount?: DaffProductDiscount;\n\n /**\n * Whether or not the product is in stock.\n */\n in_stock?: boolean;\n\n // TODO: move to meta object\n /**\n * The product brand.\n */\n brand?: string;\n\n /**\n * Describes the product.\n */\n description?: string;\n\n /**\n * A shorter description of the product.\n */\n short_description?: string;\n\n /**\n * A title for the product to display in the browser tab title.\n */\n meta_title?: string;\n\n /**\n * A description of the product for usage in search engine results.\n */\n meta_description?: string;\n}\n\n/**\n * The discount for a product.\n */\nexport interface DaffProductDiscount {\n /**\n * The discount represented as some amount of currency.\n */\n amount: number;\n\n /**\n * The discount represented as a percent of the original product price.\n */\n percent: number;\n}\n","import { DaffPriceRange } from '../models/public_api';\n\n/**\n * Returns whether a DaffPriceRange has a discount.\n *\n * @param priceRange a DaffPriceRange\n */\nexport const productPriceRangeHasDiscount = (priceRange: DaffPriceRange): boolean => priceRange.minPrice.originalPrice !== priceRange.minPrice.discountedPrice ||\n\t\tpriceRange.maxPrice.originalPrice !== priceRange.maxPrice.discountedPrice;\n","import { DaffPriceRange } from '../models/public_api';\n\n/**\n * Returns whether the min and max prices of a DaffPriceRange are different.\n *\n * @param priceRange a DaffPriceRange\n */\nexport const productPriceRangeHasPriceRange = (priceRange: DaffPriceRange): boolean => priceRange.minPrice.originalPrice !== priceRange.maxPrice.originalPrice ||\n\t\tpriceRange.minPrice.discountedPrice !== priceRange.maxPrice.discountedPrice;\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":"AAQA;;AAEG;IACS,oBAIX;AAJD,CAAA,UAAY,mBAAmB,EAAA;AAC7B,IAAA,mBAAA,CAAA,QAAA,CAAA,GAAA,QAAiB,CAAA;AACjB,IAAA,mBAAA,CAAA,WAAA,CAAA,GAAA,WAAuB,CAAA;AACvB,IAAA,mBAAA,CAAA,cAAA,CAAA,GAAA,cAA6B,CAAA;AAC/B,CAAC,EAJW,mBAAmB,KAAnB,mBAAmB,GAI9B,EAAA,CAAA,CAAA;;ACbD;;;;AAIG;AACU,MAAA,4BAA4B,GAAG,CAAC,UAA0B,KAAc,UAAU,CAAC,QAAQ,CAAC,aAAa,KAAK,UAAU,CAAC,QAAQ,CAAC,eAAe;IAC5J,UAAU,CAAC,QAAQ,CAAC,aAAa,KAAK,UAAU,CAAC,QAAQ,CAAC;;ACN5D;;;;AAIG;AACU,MAAA,8BAA8B,GAAG,CAAC,UAA0B,KAAc,UAAU,CAAC,QAAQ,CAAC,aAAa,KAAK,UAAU,CAAC,QAAQ,CAAC,aAAa;IAC5J,UAAU,CAAC,QAAQ,CAAC,eAAe,KAAK,UAAU,CAAC,QAAQ,CAAC;;ACR9D;;AAEG;;;;"}
package/package.json CHANGED
@@ -1 +1 @@
1
- {"name":"@daffodil/product","nx":{"targets":{"build":{"outputs":["{workspaceRoot}/dist/product"]}}},"version":"0.64.1","description":"Interfaces built for daffodil/state","repository":{"type":"git","url":"https://github.com/graycoreio/daffodil"},"author":"Graycore LLC","license":"MIT","bugs":{"url":"https://github.com/graycoreio/daffodil/issues"},"publishConfig":{"directory":"../../dist/product"},"homepage":"https://github.com/graycoreio/daffodil","peerDependencies":{"@angular/common":"^15.0.0","@angular/core":"^15.0.0","@daffodil/core":"0.64.1","@ngrx/effects":"^15.0.0","@ngrx/entity":"^15.0.0","@ngrx/store":"^15.0.0","rxjs":"7.8.1"},"optionalDependencies":{"@apollo/client":"^3.0.0","@daffodil/driver":"0.64.1","angular-in-memory-web-api":"^0.15.0","apollo-angular":"^5.0.0","@faker-js/faker":"^7.6.0"},"module":"fesm2015/daffodil-product.mjs","es2020":"fesm2020/daffodil-product.mjs","esm2020":"esm2020/daffodil-product.mjs","fesm2020":"fesm2020/daffodil-product.mjs","fesm2015":"fesm2015/daffodil-product.mjs","typings":"index.d.ts","exports":{"./package.json":{"default":"./package.json"},".":{"types":"./index.d.ts","esm2020":"./esm2020/daffodil-product.mjs","es2020":"./fesm2020/daffodil-product.mjs","es2015":"./fesm2015/daffodil-product.mjs","node":"./fesm2015/daffodil-product.mjs","default":"./fesm2020/daffodil-product.mjs"},"./driver/in-memory":{"types":"./driver/in-memory/index.d.ts","esm2020":"./esm2020/driver/in-memory/daffodil-product-driver-in-memory.mjs","es2020":"./fesm2020/daffodil-product-driver-in-memory.mjs","es2015":"./fesm2015/daffodil-product-driver-in-memory.mjs","node":"./fesm2015/daffodil-product-driver-in-memory.mjs","default":"./fesm2020/daffodil-product-driver-in-memory.mjs"},"./driver/magento":{"types":"./driver/magento/index.d.ts","esm2020":"./esm2020/driver/magento/daffodil-product-driver-magento.mjs","es2020":"./fesm2020/daffodil-product-driver-magento.mjs","es2015":"./fesm2015/daffodil-product-driver-magento.mjs","node":"./fesm2015/daffodil-product-driver-magento.mjs","default":"./fesm2020/daffodil-product-driver-magento.mjs"},"./driver/magento/testing":{"types":"./driver/magento/testing/index.d.ts","esm2020":"./esm2020/driver/magento/testing/daffodil-product-driver-magento-testing.mjs","es2020":"./fesm2020/daffodil-product-driver-magento-testing.mjs","es2015":"./fesm2015/daffodil-product-driver-magento-testing.mjs","node":"./fesm2015/daffodil-product-driver-magento-testing.mjs","default":"./fesm2020/daffodil-product-driver-magento-testing.mjs"},"./driver":{"types":"./driver/index.d.ts","esm2020":"./esm2020/driver/daffodil-product-driver.mjs","es2020":"./fesm2020/daffodil-product-driver.mjs","es2015":"./fesm2015/daffodil-product-driver.mjs","node":"./fesm2015/daffodil-product-driver.mjs","default":"./fesm2020/daffodil-product-driver.mjs"},"./driver/shopify":{"types":"./driver/shopify/index.d.ts","esm2020":"./esm2020/driver/shopify/daffodil-product-driver-shopify.mjs","es2020":"./fesm2020/daffodil-product-driver-shopify.mjs","es2015":"./fesm2015/daffodil-product-driver-shopify.mjs","node":"./fesm2015/daffodil-product-driver-shopify.mjs","default":"./fesm2020/daffodil-product-driver-shopify.mjs"},"./driver/testing":{"types":"./driver/testing/index.d.ts","esm2020":"./esm2020/driver/testing/daffodil-product-driver-testing.mjs","es2020":"./fesm2020/daffodil-product-driver-testing.mjs","es2015":"./fesm2015/daffodil-product-driver-testing.mjs","node":"./fesm2015/daffodil-product-driver-testing.mjs","default":"./fesm2020/daffodil-product-driver-testing.mjs"},"./routing":{"types":"./routing/index.d.ts","esm2020":"./esm2020/routing/daffodil-product-routing.mjs","es2020":"./fesm2020/daffodil-product-routing.mjs","es2015":"./fesm2015/daffodil-product-routing.mjs","node":"./fesm2015/daffodil-product-routing.mjs","default":"./fesm2020/daffodil-product-routing.mjs"},"./state":{"types":"./state/index.d.ts","esm2020":"./esm2020/state/daffodil-product-state.mjs","es2020":"./fesm2020/daffodil-product-state.mjs","es2015":"./fesm2015/daffodil-product-state.mjs","node":"./fesm2015/daffodil-product-state.mjs","default":"./fesm2020/daffodil-product-state.mjs"},"./state/testing":{"types":"./state/testing/index.d.ts","esm2020":"./esm2020/state/testing/daffodil-product-state-testing.mjs","es2020":"./fesm2020/daffodil-product-state-testing.mjs","es2015":"./fesm2015/daffodil-product-state-testing.mjs","node":"./fesm2015/daffodil-product-state-testing.mjs","default":"./fesm2020/daffodil-product-state-testing.mjs"},"./testing":{"types":"./testing/index.d.ts","esm2020":"./esm2020/testing/daffodil-product-testing.mjs","es2020":"./fesm2020/daffodil-product-testing.mjs","es2015":"./fesm2015/daffodil-product-testing.mjs","node":"./fesm2015/daffodil-product-testing.mjs","default":"./fesm2020/daffodil-product-testing.mjs"}},"sideEffects":false,"dependencies":{"tslib":"^2.3.0"}}
1
+ {"name":"@daffodil/product","nx":{"targets":{"build":{"outputs":["{workspaceRoot}/dist/product"]}}},"version":"0.66.0","description":"Interfaces built for daffodil/state","repository":{"type":"git","url":"https://github.com/graycoreio/daffodil"},"author":"Graycore LLC","license":"MIT","bugs":{"url":"https://github.com/graycoreio/daffodil/issues"},"publishConfig":{"directory":"../../dist/product"},"homepage":"https://github.com/graycoreio/daffodil","peerDependencies":{"@angular/common":"^15.0.0","@angular/core":"^15.0.0","@daffodil/core":"0.66.0","@ngrx/effects":"^15.0.0","@ngrx/entity":"^15.0.0","@ngrx/store":"^15.0.0","rxjs":"7.8.1"},"optionalDependencies":{"@apollo/client":"^3.0.0","@daffodil/driver":"0.66.0","angular-in-memory-web-api":"^0.15.0","apollo-angular":"^5.0.2","@faker-js/faker":"^7.6.0"},"module":"fesm2015/daffodil-product.mjs","es2020":"fesm2020/daffodil-product.mjs","esm2020":"esm2020/daffodil-product.mjs","fesm2020":"fesm2020/daffodil-product.mjs","fesm2015":"fesm2015/daffodil-product.mjs","typings":"index.d.ts","exports":{"./package.json":{"default":"./package.json"},".":{"types":"./index.d.ts","esm2020":"./esm2020/daffodil-product.mjs","es2020":"./fesm2020/daffodil-product.mjs","es2015":"./fesm2015/daffodil-product.mjs","node":"./fesm2015/daffodil-product.mjs","default":"./fesm2020/daffodil-product.mjs"},"./driver/in-memory":{"types":"./driver/in-memory/index.d.ts","esm2020":"./esm2020/driver/in-memory/daffodil-product-driver-in-memory.mjs","es2020":"./fesm2020/daffodil-product-driver-in-memory.mjs","es2015":"./fesm2015/daffodil-product-driver-in-memory.mjs","node":"./fesm2015/daffodil-product-driver-in-memory.mjs","default":"./fesm2020/daffodil-product-driver-in-memory.mjs"},"./driver/magento":{"types":"./driver/magento/index.d.ts","esm2020":"./esm2020/driver/magento/daffodil-product-driver-magento.mjs","es2020":"./fesm2020/daffodil-product-driver-magento.mjs","es2015":"./fesm2015/daffodil-product-driver-magento.mjs","node":"./fesm2015/daffodil-product-driver-magento.mjs","default":"./fesm2020/daffodil-product-driver-magento.mjs"},"./driver/magento/testing":{"types":"./driver/magento/testing/index.d.ts","esm2020":"./esm2020/driver/magento/testing/daffodil-product-driver-magento-testing.mjs","es2020":"./fesm2020/daffodil-product-driver-magento-testing.mjs","es2015":"./fesm2015/daffodil-product-driver-magento-testing.mjs","node":"./fesm2015/daffodil-product-driver-magento-testing.mjs","default":"./fesm2020/daffodil-product-driver-magento-testing.mjs"},"./driver":{"types":"./driver/index.d.ts","esm2020":"./esm2020/driver/daffodil-product-driver.mjs","es2020":"./fesm2020/daffodil-product-driver.mjs","es2015":"./fesm2015/daffodil-product-driver.mjs","node":"./fesm2015/daffodil-product-driver.mjs","default":"./fesm2020/daffodil-product-driver.mjs"},"./driver/shopify":{"types":"./driver/shopify/index.d.ts","esm2020":"./esm2020/driver/shopify/daffodil-product-driver-shopify.mjs","es2020":"./fesm2020/daffodil-product-driver-shopify.mjs","es2015":"./fesm2015/daffodil-product-driver-shopify.mjs","node":"./fesm2015/daffodil-product-driver-shopify.mjs","default":"./fesm2020/daffodil-product-driver-shopify.mjs"},"./driver/testing":{"types":"./driver/testing/index.d.ts","esm2020":"./esm2020/driver/testing/daffodil-product-driver-testing.mjs","es2020":"./fesm2020/daffodil-product-driver-testing.mjs","es2015":"./fesm2015/daffodil-product-driver-testing.mjs","node":"./fesm2015/daffodil-product-driver-testing.mjs","default":"./fesm2020/daffodil-product-driver-testing.mjs"},"./routing":{"types":"./routing/index.d.ts","esm2020":"./esm2020/routing/daffodil-product-routing.mjs","es2020":"./fesm2020/daffodil-product-routing.mjs","es2015":"./fesm2015/daffodil-product-routing.mjs","node":"./fesm2015/daffodil-product-routing.mjs","default":"./fesm2020/daffodil-product-routing.mjs"},"./state":{"types":"./state/index.d.ts","esm2020":"./esm2020/state/daffodil-product-state.mjs","es2020":"./fesm2020/daffodil-product-state.mjs","es2015":"./fesm2015/daffodil-product-state.mjs","node":"./fesm2015/daffodil-product-state.mjs","default":"./fesm2020/daffodil-product-state.mjs"},"./state/testing":{"types":"./state/testing/index.d.ts","esm2020":"./esm2020/state/testing/daffodil-product-state-testing.mjs","es2020":"./fesm2020/daffodil-product-state-testing.mjs","es2015":"./fesm2015/daffodil-product-state-testing.mjs","node":"./fesm2015/daffodil-product-state-testing.mjs","default":"./fesm2020/daffodil-product-state-testing.mjs"},"./testing":{"types":"./testing/index.d.ts","esm2020":"./esm2020/testing/daffodil-product-testing.mjs","es2020":"./fesm2020/daffodil-product-testing.mjs","es2015":"./fesm2015/daffodil-product-testing.mjs","node":"./fesm2015/daffodil-product-testing.mjs","default":"./fesm2020/daffodil-product-testing.mjs"}},"sideEffects":false,"dependencies":{"tslib":"^2.3.0"}}
package/public_api.d.ts CHANGED
@@ -1,3 +1,2 @@
1
1
  export * from './models/public_api';
2
2
  export * from './helpers/public_api';
3
- export * from './injection-tokens/public_api';
@@ -3,4 +3,5 @@ export * from './effects/public_api';
3
3
  export * from './facades/public_api';
4
4
  export * from './reducers/public_api';
5
5
  export * from './selectors/public_api';
6
+ export * from './injection-tokens/public_api';
6
7
  export { DaffProductStateModule } from './product-state.module';
@@ -1,10 +1,12 @@
1
1
  import { DaffModelFactory } from '@daffodil/core/testing';
2
2
  import { DaffProduct, DaffProductTypeEnum } from '@daffodil/product';
3
+ import { DaffProductImageFactory } from './product-image.factory';
3
4
  import * as i0 from "@angular/core";
4
5
  /**
5
6
  * Mocked DaffProduct object.
6
7
  */
7
8
  export declare class MockProduct implements DaffProduct {
9
+ protected imageFactory: DaffProductImageFactory;
8
10
  private stubPrice;
9
11
  private stubDiscount;
10
12
  type: DaffProductTypeEnum;
@@ -17,20 +19,21 @@ export declare class MockProduct implements DaffProduct {
17
19
  amount: number;
18
20
  percent: number;
19
21
  };
20
- images: any[];
21
- thumbnail: any;
22
+ images: import("@daffodil/product").DaffProductImage[];
23
+ thumbnail: import("@daffodil/product").DaffProductImage;
22
24
  name: string;
23
25
  brand: string;
24
26
  description: string;
25
27
  short_description: string;
26
28
  meta_title: string;
27
29
  meta_description: string;
30
+ constructor(imageFactory: DaffProductImageFactory);
28
31
  }
29
32
  /**
30
33
  * Factory for creating simple `DaffProduct`s of no special kind.
31
34
  */
32
35
  export declare class DaffDefaultProductFactory extends DaffModelFactory<DaffProduct> {
33
- constructor();
36
+ constructor(imageFactory: DaffProductImageFactory);
34
37
  static ɵfac: i0.ɵɵFactoryDeclaration<DaffDefaultProductFactory, never>;
35
38
  static ɵprov: i0.ɵɵInjectableDeclaration<DaffDefaultProductFactory>;
36
39
  }
@@ -15,7 +15,7 @@ export declare class DaffProductExtensionFactory<T extends DaffProduct = DaffPro
15
15
  * Includes extra product types that may be provided by optional product packages.
16
16
  * This includes all the extra extension factories that may be provided by optional product packages.
17
17
  */
18
- create(partial?: {}): T;
18
+ create(partial?: Partial<T>): T;
19
19
  static ɵfac: i0.ɵɵFactoryDeclaration<DaffProductExtensionFactory<any>, never>;
20
20
  static ɵprov: i0.ɵɵInjectableDeclaration<DaffProductExtensionFactory<any>>;
21
21
  }
@@ -14,7 +14,7 @@ export declare class DaffProductKindFactory extends DaffModelFactory<DaffProduct
14
14
  * Creates a mock product of random kind.
15
15
  * Includes extra product kinds that may be provided by optional product packages.
16
16
  */
17
- create(partial?: {}): DaffProduct;
17
+ create(partial?: Partial<DaffProduct>): DaffProduct;
18
18
  static ɵfac: i0.ɵɵFactoryDeclaration<DaffProductKindFactory, never>;
19
19
  static ɵprov: i0.ɵɵInjectableDeclaration<DaffProductKindFactory>;
20
20
  }
@@ -9,7 +9,7 @@ import { DaffProduct } from '@daffodil/product';
9
9
  *
10
10
  * These factories will be invoked ang the return included in {@link DaffProductFactory}.
11
11
  */
12
- export declare const DAFF_PRODUCT_EXTRA_FACTORIES: InjectionToken<DaffModelFactory<DaffProduct>[]>;
12
+ export declare const DAFF_PRODUCT_EXTRA_FACTORIES: InjectionToken<DaffModelFactory<DaffProduct, import("@daffodil/core").Constructable<DaffProduct>>[]>;
13
13
  /**
14
14
  * Provides extra product factories.
15
15
  *
@@ -7,7 +7,7 @@ import { DaffProduct } from '@daffodil/product';
7
7
  * This is useful for backend mocks (such as the in-memory driver) to generate an accurate representation
8
8
  * of the variety of products that an application can receive in production.
9
9
  */
10
- export declare const DAFF_PRODUCT_TYPE_FACTORIES: InjectionToken<DaffModelFactory<DaffProduct>[]>;
10
+ export declare const DAFF_PRODUCT_TYPE_FACTORIES: InjectionToken<DaffModelFactory<DaffProduct, import("@daffodil/core").Constructable<DaffProduct>>[]>;
11
11
  /**
12
12
  * Provides extra product factory types.
13
13
  *
@@ -1,8 +0,0 @@
1
- import { InjectionToken } from '@angular/core';
2
- import { daffTransformErrorToStateError } from '@daffodil/core/state';
3
- /**
4
- * Transforms {@link DaffError}s into {@link DaffStateError}s before they are serialized into state.
5
- * Can be used to further refine Daffodil errors into more specific app errors.
6
- */
7
- export const DAFF_PRODUCT_ERROR_MATCHER = new InjectionToken('DAFF_PRODUCT_ERROR_MATCHER', { factory: () => daffTransformErrorToStateError });
8
- //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZXJyb3ItbWF0Y2hlci50b2tlbi5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uLy4uLy4uL2xpYnMvcHJvZHVjdC9zcmMvaW5qZWN0aW9uLXRva2Vucy9lcnJvci1tYXRjaGVyLnRva2VuLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBLE9BQU8sRUFBRSxjQUFjLEVBQUUsTUFBTSxlQUFlLENBQUM7QUFFL0MsT0FBTyxFQUFFLDhCQUE4QixFQUFFLE1BQU0sc0JBQXNCLENBQUM7QUFFdEU7OztHQUdHO0FBQ0gsTUFBTSxDQUFDLE1BQU0sMEJBQTBCLEdBQUcsSUFBSSxjQUFjLENBQzFELDRCQUE0QixFQUM1QixFQUFFLE9BQU8sRUFBRSxHQUFHLEVBQUUsQ0FBQyw4QkFBOEIsRUFBRSxDQUNsRCxDQUFDIiwic291cmNlc0NvbnRlbnQiOlsiaW1wb3J0IHsgSW5qZWN0aW9uVG9rZW4gfSBmcm9tICdAYW5ndWxhci9jb3JlJztcblxuaW1wb3J0IHsgZGFmZlRy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