@daffodil/product 0.94.1 → 0.95.1

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 (46) hide show
  1. package/fesm2022/daffodil-product-driver-in-memory.mjs +200 -227
  2. package/fesm2022/daffodil-product-driver-in-memory.mjs.map +1 -1
  3. package/fesm2022/daffodil-product-driver-magento-2.4.7-testing.mjs +444 -0
  4. package/fesm2022/daffodil-product-driver-magento-2.4.7-testing.mjs.map +1 -0
  5. package/fesm2022/daffodil-product-driver-magento-2.4.7.mjs +704 -0
  6. package/fesm2022/daffodil-product-driver-magento-2.4.7.mjs.map +1 -0
  7. package/fesm2022/daffodil-product-driver-magento-auto-testing.mjs +7 -0
  8. package/fesm2022/daffodil-product-driver-magento-auto-testing.mjs.map +1 -0
  9. package/fesm2022/daffodil-product-driver-magento-auto.mjs +7 -0
  10. package/fesm2022/daffodil-product-driver-magento-auto.mjs.map +1 -0
  11. package/fesm2022/daffodil-product-driver-shopify.mjs +99 -127
  12. package/fesm2022/daffodil-product-driver-shopify.mjs.map +1 -1
  13. package/fesm2022/daffodil-product-driver-testing.mjs +117 -87
  14. package/fesm2022/daffodil-product-driver-testing.mjs.map +1 -1
  15. package/fesm2022/daffodil-product-driver.mjs +22 -45
  16. package/fesm2022/daffodil-product-driver.mjs.map +1 -1
  17. package/fesm2022/daffodil-product-routing.mjs +347 -285
  18. package/fesm2022/daffodil-product-routing.mjs.map +1 -1
  19. package/fesm2022/daffodil-product-state-testing.mjs +189 -106
  20. package/fesm2022/daffodil-product-state-testing.mjs.map +1 -1
  21. package/fesm2022/daffodil-product-state.mjs +566 -659
  22. package/fesm2022/daffodil-product-state.mjs.map +1 -1
  23. package/fesm2022/daffodil-product-testing.mjs +316 -276
  24. package/fesm2022/daffodil-product-testing.mjs.map +1 -1
  25. package/fesm2022/daffodil-product.mjs +8 -29
  26. package/fesm2022/daffodil-product.mjs.map +1 -1
  27. package/package.json +1 -1
  28. package/types/daffodil-product-driver-in-memory.d.ts +65 -75
  29. package/types/daffodil-product-driver-magento-2.4.7-testing.d.ts +105 -0
  30. package/types/daffodil-product-driver-magento-2.4.7.d.ts +337 -0
  31. package/types/daffodil-product-driver-magento-auto-testing.d.ts +1 -0
  32. package/types/daffodil-product-driver-magento-auto.d.ts +1 -0
  33. package/types/daffodil-product-driver-shopify.d.ts +31 -43
  34. package/types/daffodil-product-driver-testing.d.ts +28 -26
  35. package/types/daffodil-product-driver.d.ts +50 -61
  36. package/types/daffodil-product-routing.d.ts +101 -110
  37. package/types/daffodil-product-state-testing.d.ts +45 -43
  38. package/types/daffodil-product-state.d.ts +347 -375
  39. package/types/daffodil-product-testing.d.ts +82 -89
  40. package/types/daffodil-product.d.ts +93 -102
  41. package/fesm2022/daffodil-product-driver-magento-testing.mjs +0 -275
  42. package/fesm2022/daffodil-product-driver-magento-testing.mjs.map +0 -1
  43. package/fesm2022/daffodil-product-driver-magento.mjs +0 -855
  44. package/fesm2022/daffodil-product-driver-magento.mjs.map +0 -1
  45. package/types/daffodil-product-driver-magento-testing.d.ts +0 -114
  46. package/types/daffodil-product-driver-magento.d.ts +0 -396
@@ -1,281 +1,321 @@
1
- import * as i0 from '@angular/core';
2
- import { Injectable, Inject, NgModule } from '@angular/core';
3
- import { faker } from '@faker-js/faker/locale/en_US';
4
- import * as i2 from '@daffodil/core/testing';
5
- import { DaffModelFactory, MockCollection } from '@daffodil/core/testing';
6
- import { createServicesInjectionToken, sample } from '@daffodil/core';
7
- import { DaffProductTypeEnum } from '@daffodil/product';
8
-
1
+ import * as i0 from "@angular/core";
2
+ import { Inject, Injectable, NgModule, makeEnvironmentProviders } from "@angular/core";
3
+ import { faker } from "@faker-js/faker/locale/en_US";
4
+ import * as i2 from "@daffodil/core/testing";
5
+ import { DaffModelFactory, MockCollection } from "@daffodil/core/testing";
6
+ import { createServicesInjectionToken, sample } from "@daffodil/core";
7
+ import { DaffProductTypeEnum } from "@daffodil/product";
9
8
  const productImageUrlsList = [
10
- 'https://assets.daff.io/elegant_gold_soap.png',
11
- 'https://assets.daff.io/elegant_plastic_gloves.png',
12
- 'https://assets.daff.io/ergonomic_bronze_pants.png',
13
- 'https://assets.daff.io/fantastic_aluminum_keyboard.png',
14
- 'https://assets.daff.io/frozen_metal_soap_bubbles.png',
15
- 'https://assets.daff.io/frozen_metal_soap.png',
16
- 'https://assets.daff.io/handcrafted_bamboo_cheese.png',
17
- 'https://assets.daff.io/incredible_ceramic_bike_blue.png',
18
- 'https://assets.daff.io/modern_bronze_chair.png',
19
- 'https://assets.daff.io/modern_granite_tuna.png',
20
- 'https://assets.daff.io/recycled_wooden_table.png',
21
- 'https://assets.daff.io/refined_cotton_pants.png',
22
- 'https://assets.daff.io/refined_rubber_gloves.png',
23
- 'https://assets.daff.io/rustic_bronze_computer.png',
24
- 'https://assets.daff.io/rustic_ceramic_chips.png',
25
- 'https://assets.daff.io/sleek_metal_shirt.png',
26
- 'https://assets.daff.io/soft_granite_pants.png',
27
- 'https://assets.daff.io/tasty_wooden_sausages.png',
9
+ "https://assets.daff.io/elegant_gold_soap.png",
10
+ "https://assets.daff.io/elegant_plastic_gloves.png",
11
+ "https://assets.daff.io/ergonomic_bronze_pants.png",
12
+ "https://assets.daff.io/fantastic_aluminum_keyboard.png",
13
+ "https://assets.daff.io/frozen_metal_soap_bubbles.png",
14
+ "https://assets.daff.io/frozen_metal_soap.png",
15
+ "https://assets.daff.io/handcrafted_bamboo_cheese.png",
16
+ "https://assets.daff.io/incredible_ceramic_bike_blue.png",
17
+ "https://assets.daff.io/modern_bronze_chair.png",
18
+ "https://assets.daff.io/modern_granite_tuna.png",
19
+ "https://assets.daff.io/recycled_wooden_table.png",
20
+ "https://assets.daff.io/refined_cotton_pants.png",
21
+ "https://assets.daff.io/refined_rubber_gloves.png",
22
+ "https://assets.daff.io/rustic_bronze_computer.png",
23
+ "https://assets.daff.io/rustic_ceramic_chips.png",
24
+ "https://assets.daff.io/sleek_metal_shirt.png",
25
+ "https://assets.daff.io/soft_granite_pants.png",
26
+ "https://assets.daff.io/tasty_wooden_sausages.png"
28
27
  ];
29
- /**
30
- * Mocked DaffProductImage object.
31
- */
32
- class MockProductImage {
33
- constructor() {
34
- this.id = faker.string.uuid();
35
- this.url = productImageUrlsList[faker.number.int(productImageUrlsList.length - 1)];
36
- this.label = faker.lorem.sentence();
37
- }
38
- }
39
- /**
40
- * A factory for creating DaffProductImage.
41
- */
42
- class DaffProductImageFactory extends DaffModelFactory {
43
- constructor() {
44
- super(MockProductImage);
45
- }
46
- /** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: DaffProductImageFactory, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
47
- /** @nocollapse */ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: DaffProductImageFactory, providedIn: 'root' }); }
48
- }
49
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: DaffProductImageFactory, decorators: [{
50
- type: Injectable,
51
- args: [{
52
- providedIn: 'root',
53
- }]
54
- }], ctorParameters: () => [] });
55
-
56
- /**
57
- * Mocked DaffProduct object.
58
- */
59
- class MockProduct {
60
- constructor(imageFactory) {
61
- this.imageFactory = imageFactory;
62
- this.stubPrice = faker.number.int({ min: 1, max: 1500 });
63
- this.stubDiscount = faker.number.int({ min: 0, max: this.stubPrice - 1 });
64
- this.type = DaffProductTypeEnum.Simple;
65
- this.id = faker.string.uuid();
66
- this.url = `/${faker.internet.domainWord()}.html`;
67
- this.canonicalUrl = faker.internet.url();
68
- this.price = this.stubPrice;
69
- this.in_stock = true;
70
- this.discount = {
71
- amount: this.stubDiscount,
72
- percent: Math.floor((this.stubDiscount / this.stubPrice) * 100),
73
- };
74
- this.images = this.imageFactory.createMany(faker.number.int({ min: 1, max: 10 }));
75
- this.thumbnail = this.imageFactory.create();
76
- this.name = faker.commerce.productName();
77
- this.brand = faker.company.name();
78
- this.description = faker.commerce.productDescription();
79
- this.short_description = faker.commerce.productDescription();
80
- this.meta_title = faker.commerce.productName();
81
- this.meta_description = faker.commerce.productDescription();
82
- }
83
- }
84
- /**
85
- * Factory for creating simple `DaffProduct`s of no special kind.
86
- */
87
- class DaffDefaultProductFactory extends DaffModelFactory {
88
- constructor(imageFactory) {
89
- super(MockProduct, imageFactory);
90
- }
91
- /** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: DaffDefaultProductFactory, deps: [{ token: DaffProductImageFactory }], target: i0.ɵɵFactoryTarget.Injectable }); }
92
- /** @nocollapse */ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: DaffDefaultProductFactory, providedIn: 'root' }); }
93
- }
94
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: DaffDefaultProductFactory, decorators: [{
95
- type: Injectable,
96
- args: [{
97
- providedIn: 'root',
98
- }]
99
- }], ctorParameters: () => [{ type: DaffProductImageFactory }] });
100
-
101
- const {
102
- /**
103
- * A multi-provider injection token for providing extra product type factories.
104
- * These factories correspond to different product types that may be added by other packages.
105
- * This is useful for backend mocks (such as the in-memory driver) to generate an accurate representation
106
- * of the variety of products that an application can receive in production.
107
- */
108
- token: DAFF_PRODUCT_TYPE_FACTORIES,
109
- /**
110
- * Provides extra product factory types.
111
- *
112
- * See {@link DAFF_PRODUCT_TYPE_FACTORIES}.
113
- *
114
- * @example
115
- * ```ts
116
- * providers: [
117
- * ...provideDaffProductExtraFactoryTypes(
118
- * MyProductFactory
119
- * )
120
- * ]
121
- * ```
122
- */
123
- provider: provideDaffProductExtraFactoryTypes, } = createServicesInjectionToken('DAFF_PRODUCT_TYPE_FACTORIES', { providedIn: 'root' });
124
-
125
- const {
126
- /**
127
- * A multi-provider injection token for providing extra product factories.
128
- * These extra factories represent the additional product fields that may be added by other packages.
129
- * This is useful for backend mocks (such as the in-memory driver) to generate an accurate representation
130
- * of the entire product data that an application can receive in production.
131
- *
132
- * These factories will be invoked ang the return included in {@link DaffProductFactory}.
133
- */
134
- token: DAFF_PRODUCT_EXTRA_FACTORIES,
135
- /**
136
- * Provides extra product factories.
137
- *
138
- * See {@link DAFF_PRODUCT_EXTRA_FACTORIES}.
139
- *
140
- * @example
141
- * ```ts
142
- * providers: [
143
- * ...provideDaffProductExtraProductFactories(
144
- * MyProductFactory
145
- * )
146
- * ]
147
- * ```
148
- */
149
- provider: provideDaffProductExtraProductFactories, } = createServicesInjectionToken('DAFF_PRODUCT_EXTRA_FACTORIES', { providedIn: 'root' });
150
-
151
- /**
152
- * Factory for creating DaffProducts.
153
- * This will create a random product kind,
154
- * including extra product kinds that may be provided by optional product packages.
155
- */
156
- class DaffProductKindFactory extends DaffModelFactory {
157
- constructor(productTypeFactories) {
158
- super(MockProduct);
159
- this.productTypeFactories = productTypeFactories;
160
- }
161
- get _randomFactory() {
162
- return sample(this.productTypeFactories);
163
- }
164
- /**
165
- * Creates a mock product of random kind.
166
- * Includes extra product kinds that may be provided by optional product packages.
167
- */
168
- create(partial = {}) {
169
- return this._randomFactory.create(partial);
170
- }
171
- /** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: DaffProductKindFactory, deps: [{ token: DAFF_PRODUCT_TYPE_FACTORIES }], target: i0.ɵɵFactoryTarget.Injectable }); }
172
- /** @nocollapse */ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: DaffProductKindFactory, providedIn: 'root' }); }
173
- }
174
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: DaffProductKindFactory, decorators: [{
175
- type: Injectable,
176
- args: [{
177
- providedIn: 'root',
178
- }]
179
- }], ctorParameters: () => [{ type: undefined, decorators: [{
180
- type: Inject,
181
- args: [DAFF_PRODUCT_TYPE_FACTORIES]
182
- }] }] });
183
-
184
- /**
185
- * Factory for creating `DaffProduct`s with extension fields.
186
- * This includes all the extra extension factories that may be provided by optional product packages.
187
- */
188
- class DaffProductExtensionFactory extends DaffModelFactory {
189
- constructor(extraFactories, productKindFactory) {
190
- super(null);
191
- this.extraFactories = extraFactories;
192
- this.productKindFactory = productKindFactory;
193
- }
194
- /**
195
- * Creates a mock product of random type.
196
- * Includes extra product types that may be provided by optional product packages.
197
- * This includes all the extra extension factories that may be provided by optional product packages.
198
- */
199
- create(partial = {}) {
200
- const kind = this.productKindFactory.create(partial);
201
- return Object.assign({}, kind, ...this.extraFactories.map(factory => factory.create(partial)),
202
- // spread this in last to preserve kind's type
203
- { type: kind.type });
204
- }
205
- /** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: DaffProductExtensionFactory, deps: [{ token: DAFF_PRODUCT_EXTRA_FACTORIES }, { token: DaffProductKindFactory }], target: i0.ɵɵFactoryTarget.Injectable }); }
206
- /** @nocollapse */ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: DaffProductExtensionFactory, providedIn: 'root' }); }
207
- }
208
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: DaffProductExtensionFactory, decorators: [{
209
- type: Injectable,
210
- args: [{
211
- providedIn: 'root',
212
- }]
213
- }], ctorParameters: () => [{ type: undefined, decorators: [{
214
- type: Inject,
215
- args: [DAFF_PRODUCT_EXTRA_FACTORIES]
216
- }] }, { type: DaffProductKindFactory }] });
217
-
218
- /**
219
- * Mocked {@link DaffProductCollection} object.
220
- */
221
- class MockProductCollection extends MockCollection {
222
- constructor(productFactory, metadataFactory) {
223
- super(productFactory, metadataFactory);
224
- }
225
- }
226
- /**
227
- * Factory for creating {@link DaffProductCollection}s.
228
- */
229
- class DaffProductCollectionFactory extends DaffModelFactory {
230
- constructor(productFactory, metadataFactory) {
231
- super(MockProductCollection, productFactory, metadataFactory);
232
- }
233
- /** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: DaffProductCollectionFactory, deps: [{ token: DaffProductKindFactory }, { token: i2.DaffCollectionMetadataFactory }], target: i0.ɵɵFactoryTarget.Injectable }); }
234
- /** @nocollapse */ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: DaffProductCollectionFactory, providedIn: 'root' }); }
235
- }
236
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: DaffProductCollectionFactory, decorators: [{
237
- type: Injectable,
238
- args: [{
239
- providedIn: 'root',
240
- }]
241
- }], ctorParameters: () => [{ type: DaffProductKindFactory }, { type: i2.DaffCollectionMetadataFactory }] });
242
-
243
- /**
244
- * A helper function to verify that a model is a Product.
245
- *
246
- * @param product
247
- */
28
+ var MockProductImage = class {
29
+ constructor() {
30
+ this.id = faker.string.uuid();
31
+ this.url = productImageUrlsList[faker.number.int(productImageUrlsList.length - 1)];
32
+ this.label = faker.lorem.sentence();
33
+ }
34
+ };
35
+ var DaffProductImageFactory = class DaffProductImageFactory extends DaffModelFactory {
36
+ constructor() {
37
+ super(MockProductImage);
38
+ }
39
+ static {
40
+ this.ɵfac = i0.ɵɵngDeclareFactory({
41
+ minVersion: "12.0.0",
42
+ version: "22.2.4",
43
+ ngImport: i0,
44
+ type: DaffProductImageFactory,
45
+ deps: [],
46
+ target: i0.ɵɵFactoryTarget.Injectable
47
+ });
48
+ }
49
+ static {
50
+ this.ɵprov = i0.ɵɵngDeclareInjectable({
51
+ minVersion: "12.0.0",
52
+ version: "22.2.4",
53
+ ngImport: i0,
54
+ type: DaffProductImageFactory,
55
+ providedIn: "root"
56
+ });
57
+ }
58
+ };
59
+ i0.ɵɵngDeclareClassMetadata({
60
+ minVersion: "12.0.0",
61
+ version: "22.2.4",
62
+ ngImport: i0,
63
+ type: DaffProductImageFactory,
64
+ decorators: [{
65
+ type: Injectable,
66
+ args: [{ providedIn: "root" }]
67
+ }],
68
+ ctorParameters: () => []
69
+ });
70
+ var MockProduct = class {
71
+ constructor(imageFactory) {
72
+ this.imageFactory = imageFactory;
73
+ this.stubPrice = faker.number.int({
74
+ min: 1,
75
+ max: 1500
76
+ });
77
+ this.stubDiscount = faker.number.int({
78
+ min: 0,
79
+ max: this.stubPrice - 1
80
+ });
81
+ this.type = DaffProductTypeEnum.Simple;
82
+ this.id = faker.string.uuid();
83
+ this.url = `/${faker.internet.domainWord()}.html`;
84
+ this.canonicalUrl = faker.internet.url();
85
+ this.price = this.stubPrice;
86
+ this.in_stock = true;
87
+ this.discount = {
88
+ amount: this.stubDiscount,
89
+ percent: Math.floor(this.stubDiscount / this.stubPrice * 100)
90
+ };
91
+ this.images = this.imageFactory.createMany(faker.number.int({
92
+ min: 1,
93
+ max: 10
94
+ }));
95
+ this.thumbnail = this.imageFactory.create();
96
+ this.name = faker.commerce.productName();
97
+ this.brand = faker.company.name();
98
+ this.description = faker.commerce.productDescription();
99
+ this.short_description = faker.commerce.productDescription();
100
+ this.meta_title = faker.commerce.productName();
101
+ this.meta_description = faker.commerce.productDescription();
102
+ }
103
+ };
104
+ var DaffDefaultProductFactory = class DaffDefaultProductFactory extends DaffModelFactory {
105
+ constructor(imageFactory) {
106
+ super(MockProduct, imageFactory);
107
+ }
108
+ static {
109
+ this.ɵfac = i0.ɵɵngDeclareFactory({
110
+ minVersion: "12.0.0",
111
+ version: "22.2.4",
112
+ ngImport: i0,
113
+ type: DaffDefaultProductFactory,
114
+ deps: [{ token: DaffProductImageFactory }],
115
+ target: i0.ɵɵFactoryTarget.Injectable
116
+ });
117
+ }
118
+ static {
119
+ this.ɵprov = i0.ɵɵngDeclareInjectable({
120
+ minVersion: "12.0.0",
121
+ version: "22.2.4",
122
+ ngImport: i0,
123
+ type: DaffDefaultProductFactory,
124
+ providedIn: "root"
125
+ });
126
+ }
127
+ };
128
+ i0.ɵɵngDeclareClassMetadata({
129
+ minVersion: "12.0.0",
130
+ version: "22.2.4",
131
+ ngImport: i0,
132
+ type: DaffDefaultProductFactory,
133
+ decorators: [{
134
+ type: Injectable,
135
+ args: [{ providedIn: "root" }]
136
+ }],
137
+ ctorParameters: () => [{ type: DaffProductImageFactory }]
138
+ });
139
+ const { token: DAFF_PRODUCT_TYPE_FACTORIES, provider: provideDaffProductExtraFactoryTypes } = createServicesInjectionToken("DAFF_PRODUCT_TYPE_FACTORIES", { providedIn: "root" });
140
+ const { token: DAFF_PRODUCT_EXTRA_FACTORIES, provider: provideDaffProductExtraProductFactories } = createServicesInjectionToken("DAFF_PRODUCT_EXTRA_FACTORIES", { providedIn: "root" });
141
+ var DaffProductKindFactory = class DaffProductKindFactory extends DaffModelFactory {
142
+ constructor(productTypeFactories) {
143
+ super(MockProduct);
144
+ this.productTypeFactories = productTypeFactories;
145
+ }
146
+ get _randomFactory() {
147
+ return sample(this.productTypeFactories);
148
+ }
149
+ create(partial = {}) {
150
+ return this._randomFactory.create(partial);
151
+ }
152
+ static {
153
+ this.ɵfac = i0.ɵɵngDeclareFactory({
154
+ minVersion: "12.0.0",
155
+ version: "22.2.4",
156
+ ngImport: i0,
157
+ type: DaffProductKindFactory,
158
+ deps: [{ token: DAFF_PRODUCT_TYPE_FACTORIES }],
159
+ target: i0.ɵɵFactoryTarget.Injectable
160
+ });
161
+ }
162
+ static {
163
+ this.ɵprov = i0.ɵɵngDeclareInjectable({
164
+ minVersion: "12.0.0",
165
+ version: "22.2.4",
166
+ ngImport: i0,
167
+ type: DaffProductKindFactory,
168
+ providedIn: "root"
169
+ });
170
+ }
171
+ };
172
+ i0.ɵɵngDeclareClassMetadata({
173
+ minVersion: "12.0.0",
174
+ version: "22.2.4",
175
+ ngImport: i0,
176
+ type: DaffProductKindFactory,
177
+ decorators: [{
178
+ type: Injectable,
179
+ args: [{ providedIn: "root" }]
180
+ }],
181
+ ctorParameters: () => [{
182
+ type: void 0,
183
+ decorators: [{
184
+ type: Inject,
185
+ args: [DAFF_PRODUCT_TYPE_FACTORIES]
186
+ }]
187
+ }]
188
+ });
189
+ var DaffProductExtensionFactory = class DaffProductExtensionFactory extends DaffModelFactory {
190
+ constructor(extraFactories, productKindFactory) {
191
+ super(null);
192
+ this.extraFactories = extraFactories;
193
+ this.productKindFactory = productKindFactory;
194
+ }
195
+ create(partial = {}) {
196
+ const kind = this.productKindFactory.create(partial);
197
+ return Object.assign({}, kind, ...this.extraFactories.map((factory) => factory.create(partial)), { type: kind.type });
198
+ }
199
+ static {
200
+ this.ɵfac = i0.ɵɵngDeclareFactory({
201
+ minVersion: "12.0.0",
202
+ version: "22.2.4",
203
+ ngImport: i0,
204
+ type: DaffProductExtensionFactory,
205
+ deps: [{ token: DAFF_PRODUCT_EXTRA_FACTORIES }, { token: DaffProductKindFactory }],
206
+ target: i0.ɵɵFactoryTarget.Injectable
207
+ });
208
+ }
209
+ static {
210
+ this.ɵprov = i0.ɵɵngDeclareInjectable({
211
+ minVersion: "12.0.0",
212
+ version: "22.2.4",
213
+ ngImport: i0,
214
+ type: DaffProductExtensionFactory,
215
+ providedIn: "root"
216
+ });
217
+ }
218
+ };
219
+ i0.ɵɵngDeclareClassMetadata({
220
+ minVersion: "12.0.0",
221
+ version: "22.2.4",
222
+ ngImport: i0,
223
+ type: DaffProductExtensionFactory,
224
+ decorators: [{
225
+ type: Injectable,
226
+ args: [{ providedIn: "root" }]
227
+ }],
228
+ ctorParameters: () => [{
229
+ type: void 0,
230
+ decorators: [{
231
+ type: Inject,
232
+ args: [DAFF_PRODUCT_EXTRA_FACTORIES]
233
+ }]
234
+ }, { type: DaffProductKindFactory }]
235
+ });
236
+ var MockProductCollection = class extends MockCollection {
237
+ constructor(productFactory, metadataFactory) {
238
+ super(productFactory, metadataFactory);
239
+ }
240
+ };
241
+ var DaffProductCollectionFactory = class DaffProductCollectionFactory extends DaffModelFactory {
242
+ constructor(productFactory, metadataFactory) {
243
+ super(MockProductCollection, productFactory, metadataFactory);
244
+ }
245
+ static {
246
+ this.ɵfac = i0.ɵɵngDeclareFactory({
247
+ minVersion: "12.0.0",
248
+ version: "22.2.4",
249
+ ngImport: i0,
250
+ type: DaffProductCollectionFactory,
251
+ deps: [{ token: DaffProductKindFactory }, { token: i2.DaffCollectionMetadataFactory }],
252
+ target: i0.ɵɵFactoryTarget.Injectable
253
+ });
254
+ }
255
+ static {
256
+ this.ɵprov = i0.ɵɵngDeclareInjectable({
257
+ minVersion: "12.0.0",
258
+ version: "22.2.4",
259
+ ngImport: i0,
260
+ type: DaffProductCollectionFactory,
261
+ providedIn: "root"
262
+ });
263
+ }
264
+ };
265
+ i0.ɵɵngDeclareClassMetadata({
266
+ minVersion: "12.0.0",
267
+ version: "22.2.4",
268
+ ngImport: i0,
269
+ type: DaffProductCollectionFactory,
270
+ decorators: [{
271
+ type: Injectable,
272
+ args: [{ providedIn: "root" }]
273
+ }],
274
+ ctorParameters: () => [{ type: DaffProductKindFactory }, { type: i2.DaffCollectionMetadataFactory }]
275
+ });
248
276
  function isProduct(product) {
249
- return !!product.id
250
- && !!product.price
251
- && !!product.name
252
- && !!product.brand
253
- && !!product.description
254
- && !!product.images;
255
- }
256
-
257
- /**
258
- * Provides the default product factory as a product type factory.
259
- */
260
- class DaffProductTestingModule {
261
- /** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: DaffProductTestingModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
262
- /** @nocollapse */ static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "21.2.9", ngImport: i0, type: DaffProductTestingModule }); }
263
- /** @nocollapse */ static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: DaffProductTestingModule, providers: [
264
- provideDaffProductExtraFactoryTypes(DaffDefaultProductFactory),
265
- ] }); }
277
+ return !!product.id && !!product.price && !!product.name && !!product.brand && !!product.description && !!product.images;
266
278
  }
267
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: DaffProductTestingModule, decorators: [{
268
- type: NgModule,
269
- args: [{
270
- providers: [
271
- provideDaffProductExtraFactoryTypes(DaffDefaultProductFactory),
272
- ],
273
- }]
274
- }] });
275
-
276
- /**
277
- * Generated bundle index. Do not edit.
278
- */
279
+ const provideDaffProductTesting = () => makeEnvironmentProviders([provideDaffProductExtraFactoryTypes(DaffDefaultProductFactory)]);
280
+ var DaffProductTestingModule = class DaffProductTestingModule {
281
+ static {
282
+ this.ɵfac = i0.ɵɵngDeclareFactory({
283
+ minVersion: "12.0.0",
284
+ version: "22.2.4",
285
+ ngImport: i0,
286
+ type: DaffProductTestingModule,
287
+ deps: [],
288
+ target: i0.ɵɵFactoryTarget.NgModule
289
+ });
290
+ }
291
+ static {
292
+ this.ɵmod = i0.ɵɵngDeclareNgModule({
293
+ minVersion: "14.0.0",
294
+ version: "22.2.4",
295
+ ngImport: i0,
296
+ type: DaffProductTestingModule
297
+ });
298
+ }
299
+ static {
300
+ this.ɵinj = i0.ɵɵngDeclareInjector({
301
+ minVersion: "12.0.0",
302
+ version: "22.2.4",
303
+ ngImport: i0,
304
+ type: DaffProductTestingModule,
305
+ providers: [provideDaffProductTesting()]
306
+ });
307
+ }
308
+ };
309
+ i0.ɵɵngDeclareClassMetadata({
310
+ minVersion: "12.0.0",
311
+ version: "22.2.4",
312
+ ngImport: i0,
313
+ type: DaffProductTestingModule,
314
+ decorators: [{
315
+ type: NgModule,
316
+ args: [{ providers: [provideDaffProductTesting()] }]
317
+ }]
318
+ });
319
+ export { DAFF_PRODUCT_EXTRA_FACTORIES, DAFF_PRODUCT_TYPE_FACTORIES, DaffDefaultProductFactory, DaffDefaultProductFactory as DaffProductFactory, DaffProductCollectionFactory, DaffProductExtensionFactory, DaffProductImageFactory, DaffProductKindFactory, DaffProductTestingModule, MockProduct, MockProductCollection, MockProductImage, isProduct, provideDaffProductExtraFactoryTypes, provideDaffProductExtraProductFactories, provideDaffProductTesting };
279
320
 
280
- export { DAFF_PRODUCT_EXTRA_FACTORIES, DAFF_PRODUCT_TYPE_FACTORIES, DaffDefaultProductFactory, DaffProductCollectionFactory, DaffProductExtensionFactory, DaffDefaultProductFactory as DaffProductFactory, DaffProductImageFactory, DaffProductKindFactory, DaffProductTestingModule, MockProduct, MockProductCollection, MockProductImage, isProduct, provideDaffProductExtraFactoryTypes, provideDaffProductExtraProductFactories };
281
- //# sourceMappingURL=daffodil-product-testing.mjs.map
321
+ //# sourceMappingURL=daffodil-product-testing.mjs.map