@daffodil/product 0.94.1 → 0.95.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/fesm2022/daffodil-product-driver-in-memory.mjs +200 -227
- package/fesm2022/daffodil-product-driver-in-memory.mjs.map +1 -1
- package/fesm2022/daffodil-product-driver-magento-2.4.7-testing.mjs +444 -0
- package/fesm2022/daffodil-product-driver-magento-2.4.7-testing.mjs.map +1 -0
- package/fesm2022/daffodil-product-driver-magento-2.4.7.mjs +704 -0
- package/fesm2022/daffodil-product-driver-magento-2.4.7.mjs.map +1 -0
- package/fesm2022/daffodil-product-driver-magento-auto-testing.mjs +7 -0
- package/fesm2022/daffodil-product-driver-magento-auto-testing.mjs.map +1 -0
- package/fesm2022/daffodil-product-driver-magento-auto.mjs +7 -0
- package/fesm2022/daffodil-product-driver-magento-auto.mjs.map +1 -0
- package/fesm2022/daffodil-product-driver-shopify.mjs +99 -127
- package/fesm2022/daffodil-product-driver-shopify.mjs.map +1 -1
- package/fesm2022/daffodil-product-driver-testing.mjs +117 -87
- package/fesm2022/daffodil-product-driver-testing.mjs.map +1 -1
- package/fesm2022/daffodil-product-driver.mjs +22 -45
- package/fesm2022/daffodil-product-driver.mjs.map +1 -1
- package/fesm2022/daffodil-product-routing.mjs +347 -285
- package/fesm2022/daffodil-product-routing.mjs.map +1 -1
- package/fesm2022/daffodil-product-state-testing.mjs +189 -106
- package/fesm2022/daffodil-product-state-testing.mjs.map +1 -1
- package/fesm2022/daffodil-product-state.mjs +566 -659
- package/fesm2022/daffodil-product-state.mjs.map +1 -1
- package/fesm2022/daffodil-product-testing.mjs +316 -276
- package/fesm2022/daffodil-product-testing.mjs.map +1 -1
- package/fesm2022/daffodil-product.mjs +8 -29
- package/fesm2022/daffodil-product.mjs.map +1 -1
- package/package.json +1 -1
- package/types/daffodil-product-driver-in-memory.d.ts +65 -75
- package/types/daffodil-product-driver-magento-2.4.7-testing.d.ts +105 -0
- package/types/daffodil-product-driver-magento-2.4.7.d.ts +337 -0
- package/types/daffodil-product-driver-magento-auto-testing.d.ts +1 -0
- package/types/daffodil-product-driver-magento-auto.d.ts +1 -0
- package/types/daffodil-product-driver-shopify.d.ts +31 -43
- package/types/daffodil-product-driver-testing.d.ts +28 -26
- package/types/daffodil-product-driver.d.ts +50 -61
- package/types/daffodil-product-routing.d.ts +101 -110
- package/types/daffodil-product-state-testing.d.ts +45 -43
- package/types/daffodil-product-state.d.ts +347 -375
- package/types/daffodil-product-testing.d.ts +82 -89
- package/types/daffodil-product.d.ts +93 -102
- package/fesm2022/daffodil-product-driver-magento-testing.mjs +0 -275
- package/fesm2022/daffodil-product-driver-magento-testing.mjs.map +0 -1
- package/fesm2022/daffodil-product-driver-magento.mjs +0 -855
- package/fesm2022/daffodil-product-driver-magento.mjs.map +0 -1
- package/types/daffodil-product-driver-magento-testing.d.ts +0 -114
- package/types/daffodil-product-driver-magento.d.ts +0 -396
|
@@ -1,88 +1,118 @@
|
|
|
1
|
-
import * as i0 from
|
|
2
|
-
import { Injectable, NgModule } from
|
|
3
|
-
import { of } from
|
|
4
|
-
import * as i1 from
|
|
5
|
-
import {
|
|
6
|
-
import { CommonModule } from
|
|
7
|
-
import { provideDaffProductDriver } from
|
|
1
|
+
import * as i0 from "@angular/core";
|
|
2
|
+
import { Injectable, NgModule, makeEnvironmentProviders } from "@angular/core";
|
|
3
|
+
import { of } from "rxjs";
|
|
4
|
+
import * as i1 from "@daffodil/product/testing";
|
|
5
|
+
import { provideDaffProductTesting } from "@daffodil/product/testing";
|
|
6
|
+
import { CommonModule } from "@angular/common";
|
|
7
|
+
import { provideDaffProductDriver } from "@daffodil/product/driver";
|
|
8
|
+
var DaffTestingProductService = class DaffTestingProductService {
|
|
9
|
+
constructor(productFactory, productImageFactory) {
|
|
10
|
+
this.productFactory = productFactory;
|
|
11
|
+
this.productImageFactory = productImageFactory;
|
|
12
|
+
}
|
|
13
|
+
getAll() {
|
|
14
|
+
return of([
|
|
15
|
+
this.productFactory.create({ images: this.productImageFactory.createMany(5) }),
|
|
16
|
+
this.productFactory.create({ images: this.productImageFactory.createMany(5) }),
|
|
17
|
+
this.productFactory.create({ images: this.productImageFactory.createMany(5) }),
|
|
18
|
+
this.productFactory.create({ images: this.productImageFactory.createMany(5) }),
|
|
19
|
+
this.productFactory.create({ images: this.productImageFactory.createMany(5) })
|
|
20
|
+
]);
|
|
21
|
+
}
|
|
22
|
+
get(productId) {
|
|
23
|
+
return of({
|
|
24
|
+
id: productId,
|
|
25
|
+
products: [this.productFactory.create({ images: this.productImageFactory.createMany(5) })]
|
|
26
|
+
});
|
|
27
|
+
}
|
|
28
|
+
getByUrl(url) {
|
|
29
|
+
const product = this.productFactory.create({
|
|
30
|
+
images: this.productImageFactory.createMany(5),
|
|
31
|
+
url
|
|
32
|
+
});
|
|
33
|
+
return of({
|
|
34
|
+
id: product.id,
|
|
35
|
+
products: [product]
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
static {
|
|
39
|
+
this.ɵfac = i0.ɵɵngDeclareFactory({
|
|
40
|
+
minVersion: "12.0.0",
|
|
41
|
+
version: "22.2.4",
|
|
42
|
+
ngImport: i0,
|
|
43
|
+
type: DaffTestingProductService,
|
|
44
|
+
deps: [{ token: i1.DaffProductExtensionFactory }, { token: i1.DaffProductImageFactory }],
|
|
45
|
+
target: i0.ɵɵFactoryTarget.Injectable
|
|
46
|
+
});
|
|
47
|
+
}
|
|
48
|
+
static {
|
|
49
|
+
this.ɵprov = i0.ɵɵngDeclareInjectable({
|
|
50
|
+
minVersion: "12.0.0",
|
|
51
|
+
version: "22.2.4",
|
|
52
|
+
ngImport: i0,
|
|
53
|
+
type: DaffTestingProductService,
|
|
54
|
+
providedIn: "root"
|
|
55
|
+
});
|
|
56
|
+
}
|
|
57
|
+
};
|
|
58
|
+
i0.ɵɵngDeclareClassMetadata({
|
|
59
|
+
minVersion: "12.0.0",
|
|
60
|
+
version: "22.2.4",
|
|
61
|
+
ngImport: i0,
|
|
62
|
+
type: DaffTestingProductService,
|
|
63
|
+
decorators: [{
|
|
64
|
+
type: Injectable,
|
|
65
|
+
args: [{ providedIn: "root" }]
|
|
66
|
+
}],
|
|
67
|
+
ctorParameters: () => [{ type: i1.DaffProductExtensionFactory }, { type: i1.DaffProductImageFactory }]
|
|
68
|
+
});
|
|
69
|
+
const provideDaffProductTestingDriver = () => makeEnvironmentProviders([provideDaffProductTesting(), provideDaffProductDriver(DaffTestingProductService)]);
|
|
70
|
+
var DaffProductTestingDriverModule = class DaffProductTestingDriverModule {
|
|
71
|
+
static forRoot() {
|
|
72
|
+
return {
|
|
73
|
+
ngModule: DaffProductTestingDriverModule,
|
|
74
|
+
providers: [provideDaffProductTestingDriver()]
|
|
75
|
+
};
|
|
76
|
+
}
|
|
77
|
+
static {
|
|
78
|
+
this.ɵfac = i0.ɵɵngDeclareFactory({
|
|
79
|
+
minVersion: "12.0.0",
|
|
80
|
+
version: "22.2.4",
|
|
81
|
+
ngImport: i0,
|
|
82
|
+
type: DaffProductTestingDriverModule,
|
|
83
|
+
deps: [],
|
|
84
|
+
target: i0.ɵɵFactoryTarget.NgModule
|
|
85
|
+
});
|
|
86
|
+
}
|
|
87
|
+
static {
|
|
88
|
+
this.ɵmod = i0.ɵɵngDeclareNgModule({
|
|
89
|
+
minVersion: "14.0.0",
|
|
90
|
+
version: "22.2.4",
|
|
91
|
+
ngImport: i0,
|
|
92
|
+
type: DaffProductTestingDriverModule,
|
|
93
|
+
imports: [CommonModule]
|
|
94
|
+
});
|
|
95
|
+
}
|
|
96
|
+
static {
|
|
97
|
+
this.ɵinj = i0.ɵɵngDeclareInjector({
|
|
98
|
+
minVersion: "12.0.0",
|
|
99
|
+
version: "22.2.4",
|
|
100
|
+
ngImport: i0,
|
|
101
|
+
type: DaffProductTestingDriverModule,
|
|
102
|
+
imports: [CommonModule]
|
|
103
|
+
});
|
|
104
|
+
}
|
|
105
|
+
};
|
|
106
|
+
i0.ɵɵngDeclareClassMetadata({
|
|
107
|
+
minVersion: "12.0.0",
|
|
108
|
+
version: "22.2.4",
|
|
109
|
+
ngImport: i0,
|
|
110
|
+
type: DaffProductTestingDriverModule,
|
|
111
|
+
decorators: [{
|
|
112
|
+
type: NgModule,
|
|
113
|
+
args: [{ imports: [CommonModule] }]
|
|
114
|
+
}]
|
|
115
|
+
});
|
|
116
|
+
export { DaffProductTestingDriverModule, DaffTestingProductService, provideDaffProductTestingDriver };
|
|
8
117
|
|
|
9
|
-
|
|
10
|
-
* The product testing driver to mock the backend product service.
|
|
11
|
-
*
|
|
12
|
-
* @inheritdoc
|
|
13
|
-
* @param productFactory - A DaffProductFactory instance
|
|
14
|
-
* @param productImageFactory - A DaffProductImageFactory instance
|
|
15
|
-
*/
|
|
16
|
-
class DaffTestingProductService {
|
|
17
|
-
constructor(productFactory, productImageFactory) {
|
|
18
|
-
this.productFactory = productFactory;
|
|
19
|
-
this.productImageFactory = productImageFactory;
|
|
20
|
-
}
|
|
21
|
-
getAll() {
|
|
22
|
-
return of([
|
|
23
|
-
this.productFactory.create({ images: this.productImageFactory.createMany(5) }),
|
|
24
|
-
this.productFactory.create({ images: this.productImageFactory.createMany(5) }),
|
|
25
|
-
this.productFactory.create({ images: this.productImageFactory.createMany(5) }),
|
|
26
|
-
this.productFactory.create({ images: this.productImageFactory.createMany(5) }),
|
|
27
|
-
this.productFactory.create({ images: this.productImageFactory.createMany(5) }),
|
|
28
|
-
]);
|
|
29
|
-
}
|
|
30
|
-
get(productId) {
|
|
31
|
-
return of({
|
|
32
|
-
id: productId,
|
|
33
|
-
products: [
|
|
34
|
-
this.productFactory.create({ images: this.productImageFactory.createMany(5) }),
|
|
35
|
-
],
|
|
36
|
-
});
|
|
37
|
-
}
|
|
38
|
-
getByUrl(url) {
|
|
39
|
-
const product = this.productFactory.create({ images: this.productImageFactory.createMany(5), url });
|
|
40
|
-
return of({
|
|
41
|
-
id: product.id,
|
|
42
|
-
products: [product],
|
|
43
|
-
});
|
|
44
|
-
}
|
|
45
|
-
/** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: DaffTestingProductService, deps: [{ token: i1.DaffProductExtensionFactory }, { token: i1.DaffProductImageFactory }], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
46
|
-
/** @nocollapse */ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: DaffTestingProductService, providedIn: 'root' }); }
|
|
47
|
-
}
|
|
48
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: DaffTestingProductService, decorators: [{
|
|
49
|
-
type: Injectable,
|
|
50
|
-
args: [{
|
|
51
|
-
providedIn: 'root',
|
|
52
|
-
}]
|
|
53
|
-
}], ctorParameters: () => [{ type: i1.DaffProductExtensionFactory }, { type: i1.DaffProductImageFactory }] });
|
|
54
|
-
|
|
55
|
-
/**
|
|
56
|
-
* Module for providing the {@link DaffProductTestingService} driver as the {@link DaffProductDriver}.
|
|
57
|
-
*/
|
|
58
|
-
class DaffProductTestingDriverModule {
|
|
59
|
-
static forRoot() {
|
|
60
|
-
return {
|
|
61
|
-
ngModule: DaffProductTestingDriverModule,
|
|
62
|
-
providers: [
|
|
63
|
-
provideDaffProductDriver(DaffTestingProductService),
|
|
64
|
-
],
|
|
65
|
-
};
|
|
66
|
-
}
|
|
67
|
-
/** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: DaffProductTestingDriverModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
|
|
68
|
-
/** @nocollapse */ static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "21.2.9", ngImport: i0, type: DaffProductTestingDriverModule, imports: [CommonModule,
|
|
69
|
-
DaffProductTestingModule] }); }
|
|
70
|
-
/** @nocollapse */ static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: DaffProductTestingDriverModule, imports: [CommonModule,
|
|
71
|
-
DaffProductTestingModule] }); }
|
|
72
|
-
}
|
|
73
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: DaffProductTestingDriverModule, decorators: [{
|
|
74
|
-
type: NgModule,
|
|
75
|
-
args: [{
|
|
76
|
-
imports: [
|
|
77
|
-
CommonModule,
|
|
78
|
-
DaffProductTestingModule,
|
|
79
|
-
],
|
|
80
|
-
}]
|
|
81
|
-
}] });
|
|
82
|
-
|
|
83
|
-
/**
|
|
84
|
-
* Generated bundle index. Do not edit.
|
|
85
|
-
*/
|
|
86
|
-
|
|
87
|
-
export { DaffProductTestingDriverModule, DaffTestingProductService };
|
|
88
|
-
//# sourceMappingURL=daffodil-product-driver-testing.mjs.map
|
|
118
|
+
//# sourceMappingURL=daffodil-product-driver-testing.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"daffodil-product-driver-testing.mjs","sources":["../../../libs/product/driver/testing/src/drivers/product.service.ts","../../../libs/product/driver/testing/src/drivers/
|
|
1
|
+
{"version":3,"file":"daffodil-product-driver-testing.mjs","names":[],"sources":["../../../libs/product/driver/testing/src/drivers/product.service.ts","../../../libs/product/driver/testing/src/drivers/provider.ts","../../../libs/product/driver/testing/src/drivers/product-driver.module.ts"],"sourcesContent":["import { Injectable } from '@angular/core';\nimport {\n Observable,\n of,\n} from 'rxjs';\n\nimport { DaffProduct } from '@daffodil/product';\nimport {\n DaffProductDriverResponse,\n DaffProductServiceInterface,\n} from '@daffodil/product/driver';\nimport {\n DaffProductImageFactory,\n DaffProductExtensionFactory,\n} from '@daffodil/product/testing';\n\n/**\n * The product testing driver to mock the backend product service.\n *\n * @inheritdoc\n * @param productFactory - A DaffProductFactory instance\n * @param productImageFactory - A DaffProductImageFactory instance\n */\n@Injectable({\n providedIn: 'root',\n})\nexport class DaffTestingProductService implements DaffProductServiceInterface {\n\n constructor(\n private productFactory: DaffProductExtensionFactory,\n private productImageFactory: DaffProductImageFactory,\n ) {}\n\n getAll(): Observable<DaffProduct[]> {\n return of([\n this.productFactory.create({ images: this.productImageFactory.createMany(5) }),\n this.productFactory.create({ images: this.productImageFactory.createMany(5) }),\n this.productFactory.create({ images: this.productImageFactory.createMany(5) }),\n this.productFactory.create({ images: this.productImageFactory.createMany(5) }),\n this.productFactory.create({ images: this.productImageFactory.createMany(5) }),\n ]);\n }\n\n get(productId: DaffProduct['id']): Observable<DaffProductDriverResponse> {\n return of({\n id: productId,\n products: [\n this.productFactory.create({ images: this.productImageFactory.createMany(5) }),\n ],\n });\n }\n\n getByUrl(url: DaffProduct['url']): Observable<DaffProductDriverResponse> {\n const product = this.productFactory.create({ images: this.productImageFactory.createMany(5), url });\n return of({\n id: product.id,\n products: [product],\n });\n }\n}\n","import {\n EnvironmentProviders,\n makeEnvironmentProviders,\n} from '@angular/core';\n\nimport { provideDaffProductDriver } from '@daffodil/product/driver';\nimport { provideDaffProductTesting } from '@daffodil/product/testing';\n\nimport { DaffTestingProductService } from './product.service';\n\n/**\n * Provides the {@link DaffTestingProductService} driver as the {@link DaffProductDriver}.\n * Includes {@link provideDaffProductTesting}.\n */\nexport const provideDaffProductTestingDriver = (): EnvironmentProviders => makeEnvironmentProviders([\n provideDaffProductTesting(),\n provideDaffProductDriver(DaffTestingProductService),\n]);\n","import { CommonModule } from '@angular/common';\nimport {\n NgModule,\n ModuleWithProviders,\n} from '@angular/core';\n\nimport { provideDaffProductTestingDriver } from './provider';\n\n/**\n * Module for providing the {@link DaffProductTestingService} driver as the {@link DaffProductDriver}.\n *\n * @deprecated in favor of {@link provideDaffProductTestingDriver} Deprecated in version 0.95.0. Will be removed in version 0.98.0.\n */\n@NgModule({\n imports: [\n CommonModule,\n ],\n})\nexport class DaffProductTestingDriverModule {\n static forRoot(): ModuleWithProviders<DaffProductTestingDriverModule> {\n return {\n ngModule: DaffProductTestingDriverModule,\n providers: [\n provideDaffProductTestingDriver(),\n ],\n };\n }\n}\n"],"mappings":";;;;;;;AA0BA,IAAa,4BAAb,MAAa,0BAAyB;CAEpC,YACU,gBACA,qBAA4C;EAD5C,KAAA,iBAAA;EACA,KAAA,sBAAA;CACP;CAEH,SAAM;EACJ,OAAO,GAAG;GACR,KAAK,eAAe,OAAO,EAAE,QAAQ,KAAK,oBAAoB,WAAW,CAAC,EAAC,CAAE;GAC7E,KAAK,eAAe,OAAO,EAAE,QAAQ,KAAK,oBAAoB,WAAW,CAAC,EAAC,CAAE;GAC7E,KAAK,eAAe,OAAO,EAAE,QAAQ,KAAK,oBAAoB,WAAW,CAAC,EAAC,CAAE;GAC7E,KAAK,eAAe,OAAO,EAAE,QAAQ,KAAK,oBAAoB,WAAW,CAAC,EAAC,CAAE;GAC7E,KAAK,eAAe,OAAO,EAAE,QAAQ,KAAK,oBAAoB,WAAW,CAAC,EAAC,CAAE;EAC9E,CAAA;CACH;CAEA,IAAI,WAA4B;EAC9B,OAAO,GAAG;GACR,IAAI;GACJ,UAAU,CACR,KAAK,eAAe,OAAO,EAAE,QAAQ,KAAK,oBAAoB,WAAW,CAAC,EAAC,CAAE,CAC9E;EACF,CAAA;CACH;CAEA,SAAS,KAAuB;EAC9B,MAAM,UAAU,KAAK,eAAe,OAAO;GAAE,QAAQ,KAAK,oBAAoB,WAAW,CAAC;GAAG;EAAG,CAAE;EAClG,OAAO,GAAG;GACR,IAAI,QAAQ;GACZ,UAAU,CAAC,OAAO;EACnB,CAAA;CACH;CAhCW;EAAA,KAAA,OAAA,GAAA,mBAAA;GAAA,YAAA;GAAA,SAAA;GAAA,UAAA;GAAA,MAAA;GAAyB,MAAA,CAAA,EAAA,OAAA,GAAA,4BAAA,GAAA,EAAA,OAAA,GAAA,wBAAA,CAAA;GAAA,QAAA,GAAA,gBAAA;EAAA,CAAA;CAAA;CAAzB;EAAA,KAAA,QAAA,GAAA,sBAAA;GAAA,YAAA;GAAA,SAAA;GAAA,UAAA;GAAA,MAAA;GAAyB,YAFxB;EAAM,CAAA;CAAA;;AAEP,GAAA,yBAAA;CAAA,YAAA;CAAA,SAAA;CAAA,UAAA;CAAA,MAAA;CAAyB,YAAA,CAAA;EAHrC,MAAA;EAAW,MAAA,CAAA,EACV,YAAY,OACb,CAAA;;;;ACXD,MAAa,wCAA8D,yBAAyB,CAClG,0BAAyB,GACzB,yBAAyB,yBAAyB,CACnD,CAAA;ACCD,IAAa,iCAAb,MAAa,+BAA8B;CACzC,OAAO,UAAO;EACZ,OAAO;GACL,UAAU;GACV,WAAW,CACT,gCAA+B,CAChC;EACF;CACH;CARW;EAAA,KAAA,OAAA,GAAA,mBAAA;GAAA,YAAA;GAAA,SAAA;GAAA,UAAA;GAAA,MAAA;GAA8B,MAAA,CAAA;GAAA,QAAA,GAAA,gBAAA;EAAA,CAAA;CAAA;CAA9B;EAAA,KAAA,OAAA,GAAA,oBAAA;GAAA,YAAA;GAAA,SAAA;GAAA,UAAA;GAAA,MAAA;GAA8B,SAAA,CAHvC,YAAY;EAAA,CAAA;CAAA;CAGH;EAAA,KAAA,OAAA,GAAA,oBAAA;GAAA,YAAA;GAAA,SAAA;GAAA,UAAA;GAAA,MAAA;GAA8B,SAAA,CAHvC,YAAY;EAAA,CAAA;CAAA;;AAGH,GAAA,yBAAA;CAAA,YAAA;CAAA,SAAA;CAAA,UAAA;CAAA,MAAA;CAA8B,YAAA,CAAA;EAL1C,MAAA;EAAS,MAAA,CAAA,EACR,SAAS,CACP,YACD,EACF,CAAA"}
|
|
@@ -1,50 +1,27 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
const {
|
|
4
|
-
/**
|
|
5
|
-
* Injection token that serves as a placeholder for any service that implements the DaffProductServiceInterface.
|
|
6
|
-
*/
|
|
7
|
-
token: DaffProductDriver,
|
|
8
|
-
/**
|
|
9
|
-
* Provider function for {@link DaffProductDriver}.
|
|
10
|
-
*/
|
|
11
|
-
provider: provideDaffProductDriver, } = createSingletonInjectionToken('DaffProductDriver');
|
|
12
|
-
|
|
1
|
+
import { DaffInheritableError, createSingletonInjectionToken } from "@daffodil/core";
|
|
2
|
+
const { token: DaffProductDriver, provider: provideDaffProductDriver } = createSingletonInjectionToken("DaffProductDriver");
|
|
13
3
|
var DaffProductDriverErrorCodes;
|
|
14
|
-
(function
|
|
15
|
-
|
|
16
|
-
|
|
4
|
+
(function(DaffProductDriverErrorCodes) {
|
|
5
|
+
DaffProductDriverErrorCodes["PRODUCT_NOT_FOUND"] = "DAFF_PRODUCT_NOT_FOUND";
|
|
6
|
+
DaffProductDriverErrorCodes["INVALID_API_RESPONSE"] = "DAFF_PRODUCT_INVALID_API_RESPONSE";
|
|
17
7
|
})(DaffProductDriverErrorCodes || (DaffProductDriverErrorCodes = {}));
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
constructor(message) {
|
|
32
|
-
super(message);
|
|
33
|
-
this.code = DaffProductDriverErrorCodes.PRODUCT_NOT_FOUND;
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
/**
|
|
38
|
-
* A mapping from error codes to error class constructors.
|
|
39
|
-
*/
|
|
8
|
+
var DaffProductInvalidAPIResponseError = class extends DaffInheritableError {
|
|
9
|
+
constructor(message) {
|
|
10
|
+
super(message);
|
|
11
|
+
this.message = message;
|
|
12
|
+
this.code = DaffProductDriverErrorCodes.INVALID_API_RESPONSE;
|
|
13
|
+
}
|
|
14
|
+
};
|
|
15
|
+
var DaffProductNotFoundError = class extends DaffInheritableError {
|
|
16
|
+
constructor(message) {
|
|
17
|
+
super(message);
|
|
18
|
+
this.code = DaffProductDriverErrorCodes.PRODUCT_NOT_FOUND;
|
|
19
|
+
}
|
|
20
|
+
};
|
|
40
21
|
const DaffProductDriverErrorMap = {
|
|
41
|
-
|
|
42
|
-
|
|
22
|
+
[DaffProductDriverErrorCodes.PRODUCT_NOT_FOUND]: DaffProductNotFoundError,
|
|
23
|
+
[DaffProductDriverErrorCodes.INVALID_API_RESPONSE]: DaffProductInvalidAPIResponseError
|
|
43
24
|
};
|
|
44
|
-
|
|
45
|
-
/**
|
|
46
|
-
* Generated bundle index. Do not edit.
|
|
47
|
-
*/
|
|
48
|
-
|
|
49
25
|
export { DaffProductDriver, DaffProductDriverErrorCodes, DaffProductDriverErrorMap, DaffProductInvalidAPIResponseError, DaffProductNotFoundError, provideDaffProductDriver };
|
|
50
|
-
|
|
26
|
+
|
|
27
|
+
//# sourceMappingURL=daffodil-product-driver.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"daffodil-product-driver.mjs","sources":["../../../libs/product/driver/src/interfaces/product-service.interface.ts","../../../libs/product/driver/src/errors/codes.enum.ts","../../../libs/product/driver/src/errors/invalid-api-response.ts","../../../libs/product/driver/src/errors/product-not-found.ts","../../../libs/product/driver/src/errors/map.ts"
|
|
1
|
+
{"version":3,"file":"daffodil-product-driver.mjs","names":[],"sources":["../../../libs/product/driver/src/interfaces/product-service.interface.ts","../../../libs/product/driver/src/errors/codes.enum.ts","../../../libs/product/driver/src/errors/invalid-api-response.ts","../../../libs/product/driver/src/errors/product-not-found.ts","../../../libs/product/driver/src/errors/map.ts"],"sourcesContent":["import { Observable } from 'rxjs';\n\nimport { createSingletonInjectionToken } from '@daffodil/core';\nimport { DaffProduct } from '@daffodil/product';\n\nimport { DaffProductDriverResponse } from '../models/response.interface';\n\nexport const {\n /**\n * Injection token that serves as a placeholder for any service that implements the DaffProductServiceInterface.\n */\n token: DaffProductDriver,\n /**\n * Provider function for {@link DaffProductDriver}.\n */\n provider: provideDaffProductDriver,\n} = createSingletonInjectionToken<DaffProductServiceInterface>('DaffProductDriver');\n\n\n/**\n * An interface for any Product service drivers.\n */\nexport interface DaffProductServiceInterface<T extends DaffProduct = DaffProduct> {\n /**\n * Get all products.\n */\n getAll(): Observable<T[]>;\n /**\n * Get a product by Id.\n *\n * @param productId - A string of the product ID.\n */\n get(productId: T['id']): Observable<DaffProductDriverResponse<T>>;\n /**\n * Get a product by URL.\n *\n * @param url - A string of the product URL.\n *\n * See {@link DaffLocatable} for more information on the requirements for the url argument of {@link DaffProduct}.\n */\n getByUrl(url: DaffProduct['url']): Observable<DaffProductDriverResponse<T>>;\n}\n","export enum DaffProductDriverErrorCodes {\n PRODUCT_NOT_FOUND = 'DAFF_PRODUCT_NOT_FOUND',\n INVALID_API_RESPONSE = 'DAFF_PRODUCT_INVALID_API_RESPONSE',\n}\n","import {\n DaffError,\n DaffInheritableError,\n} from '@daffodil/core';\n\nimport { DaffProductDriverErrorCodes } from './codes.enum';\n\nexport class DaffProductInvalidAPIResponseError extends DaffInheritableError implements DaffError {\n public readonly code: string = DaffProductDriverErrorCodes.INVALID_API_RESPONSE;\n\n constructor(public message: string) {\n super(message);\n }\n}\n","import {\n DaffError,\n DaffInheritableError,\n} from '@daffodil/core';\n\nimport { DaffProductDriverErrorCodes } from './codes.enum';\n\n/**\n * An error thrown when the requested product cannot be found.\n */\nexport class DaffProductNotFoundError extends DaffInheritableError implements DaffError {\n public readonly code: string = DaffProductDriverErrorCodes.PRODUCT_NOT_FOUND;\n\n constructor(message?: string) {\n super(message);\n }\n}\n","import { DaffProductDriverErrorCodes } from './codes.enum';\nimport { DaffProductInvalidAPIResponseError } from './invalid-api-response';\nimport { DaffProductNotFoundError } from './product-not-found';\n\n/**\n * A mapping from error codes to error class constructors.\n */\nexport const DaffProductDriverErrorMap = {\n [DaffProductDriverErrorCodes.PRODUCT_NOT_FOUND]: DaffProductNotFoundError,\n [DaffProductDriverErrorCodes.INVALID_API_RESPONSE]: DaffProductInvalidAPIResponseError,\n};\n"],"mappings":";AAOA,MAAa,EAIX,OAAO,mBAIP,UAAU,6BACR,8BAA2D,mBAAmB;AChBlF,IAAY;CAAZ,SAAY,6BAA2B;CACrC,4BAAA,uBAAA;CACA,4BAAA,0BAAA;AACF,EAAA,CAHY,gCAAA,8BAA2B,CAAA,EAAA;ACOvC,IAAa,qCAAb,cAAwD,qBAAoB;CAG1E,YAAmB,SAAe;EAChC,MAAM,OAAO;EADI,KAAA,UAAA;EAFH,KAAA,OAAe,4BAA4B;CAI3D;AACD;ACHD,IAAa,2BAAb,cAA8C,qBAAoB;CAGhE,YAAY,SAAgB;EAC1B,MAAM,OAAO;EAHC,KAAA,OAAe,4BAA4B;CAI3D;AACD;ACTD,MAAa,4BAA4B;EACtC,4BAA4B,oBAAoB;EAChD,4BAA4B,uBAAuB;AACrD"}
|