@configura/web-api 1.6.1 → 2.0.0-alpha.2
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/.eslintrc.json +18 -18
- package/LICENSE +201 -201
- package/README.md +1 -1
- package/dist/CatalogueAPI.d.ts +551 -507
- package/dist/CatalogueAPI.js +293 -280
- package/dist/CfgMeasure.d.ts +32 -32
- package/dist/CfgMeasure.js +30 -30
- package/dist/CfgProduct.d.ts +268 -258
- package/dist/CfgProduct.js +778 -747
- package/dist/CfgReferencePathHelper.d.ts +14 -0
- package/dist/CfgReferencePathHelper.js +13 -0
- package/dist/ConfigurationConverter.d.ts +5 -0
- package/dist/ConfigurationConverter.js +72 -0
- package/dist/index.d.ts +23 -20
- package/dist/index.js +23 -20
- package/dist/io/CfgHistoryManager.d.ts +51 -0
- package/dist/io/CfgHistoryManager.js +82 -0
- package/dist/io/CfgHistoryToProdConfConnector.d.ts +21 -0
- package/dist/io/CfgHistoryToProdConfConnector.js +56 -0
- package/dist/io/CfgIOManager.d.ts +49 -0
- package/dist/io/CfgIOManager.js +115 -0
- package/dist/io/CfgIOProdConfConnector.d.ts +53 -0
- package/dist/io/CfgIOProdConfConnector.js +141 -0
- package/dist/io/CfgObservableStateManager.d.ts +22 -0
- package/dist/io/CfgObservableStateManager.js +65 -0
- package/dist/io/CfgObservableStateToProdConfConnector.d.ts +15 -0
- package/dist/io/CfgObservableStateToProdConfConnector.js +16 -0
- package/dist/io/CfgWindowEventManager.d.ts +22 -0
- package/dist/io/CfgWindowEventManager.js +38 -0
- package/dist/io/CfgWindowMessageManager.d.ts +41 -0
- package/dist/io/CfgWindowMessageManager.js +84 -0
- package/dist/io/CfgWindowMessageToProdConfConnector.d.ts +17 -0
- package/dist/io/CfgWindowMessageToProdConfConnector.js +18 -0
- package/dist/io/index.d.ts +9 -0
- package/dist/io/index.js +8 -0
- package/dist/material/CfgMaterialMapping.d.ts +7 -7
- package/dist/material/CfgMaterialMapping.js +181 -181
- package/dist/material/CfgMtrlApplication.d.ts +18 -18
- package/dist/material/CfgMtrlApplication.js +43 -43
- package/dist/material/CfgMtrlApplicationSource.d.ts +7 -7
- package/dist/material/CfgMtrlApplicationSource.js +8 -8
- package/dist/material/CfgMtrlSource.d.ts +19 -19
- package/dist/material/CfgMtrlSource.js +40 -40
- package/dist/material/CfgMtrlSourceWithMetaData.d.ts +7 -7
- package/dist/material/CfgMtrlSourceWithMetaData.js +1 -1
- package/dist/productConfiguration/CfgFeature.d.ts +187 -188
- package/dist/productConfiguration/CfgFeature.js +645 -636
- package/dist/productConfiguration/CfgOption.d.ts +151 -150
- package/dist/productConfiguration/CfgOption.js +416 -426
- package/dist/productConfiguration/CfgProductConfiguration.d.ts +117 -120
- package/dist/productConfiguration/CfgProductConfiguration.js +307 -309
- package/dist/productConfiguration/filters.d.ts +15 -15
- package/dist/productConfiguration/filters.js +70 -70
- package/dist/productConfiguration/productParamsGenerator.d.ts +15 -15
- package/dist/productConfiguration/productParamsGenerator.js +51 -51
- package/dist/productConfiguration/utilitiesProductConfiguration.d.ts +17 -17
- package/dist/productConfiguration/utilitiesProductConfiguration.js +80 -80
- package/dist/productLoader.d.ts +33 -33
- package/dist/productLoader.js +49 -49
- package/dist/syncGroups/SyncGroupsApplyMode.d.ts +20 -20
- package/dist/syncGroups/SyncGroupsApplyMode.js +21 -21
- package/dist/syncGroups/SyncGroupsHandler.d.ts +40 -40
- package/dist/syncGroups/SyncGroupsHandler.js +359 -358
- package/dist/syncGroups/SyncGroupsPathHelper.d.ts +26 -26
- package/dist/syncGroups/SyncGroupsPathHelper.js +90 -90
- package/dist/syncGroups/SyncGroupsState.d.ts +35 -35
- package/dist/syncGroups/SyncGroupsState.js +125 -125
- package/dist/syncGroups/SyncGroupsTransaction.d.ts +154 -154
- package/dist/syncGroups/SyncGroupsTransaction.js +576 -576
- package/dist/tasks/TaskHandler.d.ts +77 -78
- package/dist/tasks/TaskHandler.js +275 -276
- package/dist/tasks/formats.d.ts +4 -4
- package/dist/tasks/formats.js +7 -7
- package/dist/tests/testData/collectorForTest.d.ts +73 -73
- package/dist/tests/testData/collectorForTest.js +194 -194
- package/dist/tests/testData/dummyProductForTest.d.ts +4 -4
- package/dist/tests/testData/dummyProductForTest.js +32 -36
- package/dist/tests/testData/testDataAdditionalProductInAdditionalProductInProductForTest.d.ts +11 -11
- package/dist/tests/testData/testDataAdditionalProductInAdditionalProductInProductForTest.js +277 -277
- package/dist/tests/testData/testDataCachedGetProduct.d.ts +5 -5
- package/dist/tests/testData/testDataCachedGetProduct.js +185 -185
- package/dist/tests/testData/testDataCachedPostValidate.d.ts +7 -7
- package/dist/tests/testData/testDataCachedPostValidate.js +183 -183
- package/dist/tests/testData/testDataNoAdditionalProductNoPropagateForTest.d.ts +3 -3
- package/dist/tests/testData/testDataNoAdditionalProductNoPropagateForTest.js +1099 -1099
- package/dist/tests/testData/testDataOptions.d.ts +12 -12
- package/dist/tests/testData/testDataOptions.js +60 -60
- package/dist/tests/testData/testDataProductAggregatedPrice.d.ts +6 -6
- package/dist/tests/testData/testDataProductAggregatedPrice.js +187 -187
- package/dist/tests/testData/testDataUpcharge.d.ts +8 -8
- package/dist/tests/testData/testDataUpcharge.js +119 -119
- package/dist/utilitiesCatalogueData.d.ts +42 -31
- package/dist/utilitiesCatalogueData.js +173 -162
- package/dist/utilitiesCataloguePermission.d.ts +38 -37
- package/dist/utilitiesCataloguePermission.js +79 -80
- package/dist/utilitiesNumericValues.d.ts +24 -24
- package/dist/utilitiesNumericValues.js +109 -109
- package/package.json +3 -3
|
@@ -1,119 +1,119 @@
|
|
|
1
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
2
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
3
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
4
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
5
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
6
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
7
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
|
-
});
|
|
9
|
-
};
|
|
10
|
-
import { CfgProduct } from "../../CfgProduct.js";
|
|
11
|
-
import { Collector } from "./collectorForTest.js";
|
|
12
|
-
import { dummyCatId } from "./dummyProductForTest.js";
|
|
13
|
-
import { letterOptionCodeA, letterOptions } from "./testDataOptions.js";
|
|
14
|
-
const Prd = () => ({
|
|
15
|
-
uuid: "Prd",
|
|
16
|
-
unit: "m",
|
|
17
|
-
features: [
|
|
18
|
-
{
|
|
19
|
-
code: "NoUpcharge",
|
|
20
|
-
description: "",
|
|
21
|
-
numericOrder: false,
|
|
22
|
-
options: [
|
|
23
|
-
letterOptions[0],
|
|
24
|
-
Object.assign(Object.assign({}, letterOptions[1]), { upcharge: undefined }),
|
|
25
|
-
Object.assign(Object.assign({}, letterOptions[2]), { upcharge: 0 }),
|
|
26
|
-
],
|
|
27
|
-
},
|
|
28
|
-
{
|
|
29
|
-
code: "WithUpcharge",
|
|
30
|
-
description: "",
|
|
31
|
-
numericOrder: false,
|
|
32
|
-
options: [
|
|
33
|
-
letterOptions[0],
|
|
34
|
-
Object.assign(Object.assign({}, letterOptions[1]), { upcharge: undefined }),
|
|
35
|
-
Object.assign(Object.assign({}, letterOptions[2]), { upcharge: 10 }),
|
|
36
|
-
],
|
|
37
|
-
},
|
|
38
|
-
{
|
|
39
|
-
code: "WithUpchargeSelectMany",
|
|
40
|
-
description: "",
|
|
41
|
-
numericOrder: false,
|
|
42
|
-
optional: true,
|
|
43
|
-
options: [
|
|
44
|
-
letterOptions[0],
|
|
45
|
-
Object.assign(Object.assign({}, letterOptions[1]), { upcharge: undefined }),
|
|
46
|
-
Object.assign(Object.assign({}, letterOptions[2]), { upcharge: 10 }),
|
|
47
|
-
],
|
|
48
|
-
},
|
|
49
|
-
],
|
|
50
|
-
productData: {
|
|
51
|
-
sku: "Prd",
|
|
52
|
-
partsData: {
|
|
53
|
-
basePrice: 40,
|
|
54
|
-
currency: "EURO",
|
|
55
|
-
listPrice: 50,
|
|
56
|
-
pkgCount: 0,
|
|
57
|
-
styleNr: "",
|
|
58
|
-
selOptions: [
|
|
59
|
-
{
|
|
60
|
-
code: "!~!",
|
|
61
|
-
next: {
|
|
62
|
-
[letterOptionCodeA]: {
|
|
63
|
-
code: letterOptionCodeA,
|
|
64
|
-
},
|
|
65
|
-
},
|
|
66
|
-
},
|
|
67
|
-
{
|
|
68
|
-
code: "!~!",
|
|
69
|
-
next: {
|
|
70
|
-
[letterOptionCodeA]: {
|
|
71
|
-
code: letterOptionCodeA,
|
|
72
|
-
},
|
|
73
|
-
},
|
|
74
|
-
},
|
|
75
|
-
{
|
|
76
|
-
code: "!~!",
|
|
77
|
-
next: {
|
|
78
|
-
[letterOptionCodeA]: {
|
|
79
|
-
code: letterOptionCodeA,
|
|
80
|
-
},
|
|
81
|
-
},
|
|
82
|
-
},
|
|
83
|
-
],
|
|
84
|
-
},
|
|
85
|
-
},
|
|
86
|
-
rootFeatureRefs: [
|
|
87
|
-
{ code: "NoUpcharge" },
|
|
88
|
-
{ code: "WithUpcharge" },
|
|
89
|
-
{ code: "WithUpchargeSelectMany" },
|
|
90
|
-
],
|
|
91
|
-
});
|
|
92
|
-
const getProduct = (params) => Promise.resolve(Prd());
|
|
93
|
-
export const getUpchargeProduct = (testFunc) => __awaiter(void 0, void 0, void 0, function* () {
|
|
94
|
-
const productLoader = {
|
|
95
|
-
getProduct,
|
|
96
|
-
postValidate: (params, _body) => __awaiter(void 0, void 0, void 0, function* () {
|
|
97
|
-
const productData = (yield getProduct(params)).productData;
|
|
98
|
-
const validateResponse = {
|
|
99
|
-
uuid: "",
|
|
100
|
-
validated: true,
|
|
101
|
-
productData,
|
|
102
|
-
};
|
|
103
|
-
return validateResponse;
|
|
104
|
-
}),
|
|
105
|
-
};
|
|
106
|
-
const product = yield CfgProduct.make(productLoader,
|
|
107
|
-
const collect = new Collector(product);
|
|
108
|
-
const beforeSnapshot = collect.takeSnapshot();
|
|
109
|
-
yield testFunc(product);
|
|
110
|
-
const afterSnapshot = collect.takeSnapshot();
|
|
111
|
-
const diff = collect.compareSnapshot(beforeSnapshot, afterSnapshot);
|
|
112
|
-
const notifications = collect.notifications;
|
|
113
|
-
return {
|
|
114
|
-
beforeSnapshot: Collector.stripRefsForWrapper(beforeSnapshot),
|
|
115
|
-
afterSnapshot: Collector.stripRefsForWrapper(afterSnapshot),
|
|
116
|
-
diff,
|
|
117
|
-
notifications,
|
|
118
|
-
};
|
|
119
|
-
});
|
|
1
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
2
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
3
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
4
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
5
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
6
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
7
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
|
+
});
|
|
9
|
+
};
|
|
10
|
+
import { CfgProduct } from "../../CfgProduct.js";
|
|
11
|
+
import { Collector } from "./collectorForTest.js";
|
|
12
|
+
import { dummyCatId } from "./dummyProductForTest.js";
|
|
13
|
+
import { letterOptionCodeA, letterOptions } from "./testDataOptions.js";
|
|
14
|
+
const Prd = () => ({
|
|
15
|
+
uuid: "Prd",
|
|
16
|
+
unit: "m",
|
|
17
|
+
features: [
|
|
18
|
+
{
|
|
19
|
+
code: "NoUpcharge",
|
|
20
|
+
description: "",
|
|
21
|
+
numericOrder: false,
|
|
22
|
+
options: [
|
|
23
|
+
letterOptions[0],
|
|
24
|
+
Object.assign(Object.assign({}, letterOptions[1]), { upcharge: undefined }),
|
|
25
|
+
Object.assign(Object.assign({}, letterOptions[2]), { upcharge: 0 }),
|
|
26
|
+
],
|
|
27
|
+
},
|
|
28
|
+
{
|
|
29
|
+
code: "WithUpcharge",
|
|
30
|
+
description: "",
|
|
31
|
+
numericOrder: false,
|
|
32
|
+
options: [
|
|
33
|
+
letterOptions[0],
|
|
34
|
+
Object.assign(Object.assign({}, letterOptions[1]), { upcharge: undefined }),
|
|
35
|
+
Object.assign(Object.assign({}, letterOptions[2]), { upcharge: 10 }),
|
|
36
|
+
],
|
|
37
|
+
},
|
|
38
|
+
{
|
|
39
|
+
code: "WithUpchargeSelectMany",
|
|
40
|
+
description: "",
|
|
41
|
+
numericOrder: false,
|
|
42
|
+
optional: true,
|
|
43
|
+
options: [
|
|
44
|
+
letterOptions[0],
|
|
45
|
+
Object.assign(Object.assign({}, letterOptions[1]), { upcharge: undefined }),
|
|
46
|
+
Object.assign(Object.assign({}, letterOptions[2]), { upcharge: 10 }),
|
|
47
|
+
],
|
|
48
|
+
},
|
|
49
|
+
],
|
|
50
|
+
productData: {
|
|
51
|
+
sku: "Prd",
|
|
52
|
+
partsData: {
|
|
53
|
+
basePrice: 40,
|
|
54
|
+
currency: "EURO",
|
|
55
|
+
listPrice: 50,
|
|
56
|
+
pkgCount: 0,
|
|
57
|
+
styleNr: "",
|
|
58
|
+
selOptions: [
|
|
59
|
+
{
|
|
60
|
+
code: "!~!",
|
|
61
|
+
next: {
|
|
62
|
+
[letterOptionCodeA]: {
|
|
63
|
+
code: letterOptionCodeA,
|
|
64
|
+
},
|
|
65
|
+
},
|
|
66
|
+
},
|
|
67
|
+
{
|
|
68
|
+
code: "!~!",
|
|
69
|
+
next: {
|
|
70
|
+
[letterOptionCodeA]: {
|
|
71
|
+
code: letterOptionCodeA,
|
|
72
|
+
},
|
|
73
|
+
},
|
|
74
|
+
},
|
|
75
|
+
{
|
|
76
|
+
code: "!~!",
|
|
77
|
+
next: {
|
|
78
|
+
[letterOptionCodeA]: {
|
|
79
|
+
code: letterOptionCodeA,
|
|
80
|
+
},
|
|
81
|
+
},
|
|
82
|
+
},
|
|
83
|
+
],
|
|
84
|
+
},
|
|
85
|
+
},
|
|
86
|
+
rootFeatureRefs: [
|
|
87
|
+
{ code: "NoUpcharge" },
|
|
88
|
+
{ code: "WithUpcharge" },
|
|
89
|
+
{ code: "WithUpchargeSelectMany" },
|
|
90
|
+
],
|
|
91
|
+
});
|
|
92
|
+
const getProduct = (params) => Promise.resolve(Prd());
|
|
93
|
+
export const getUpchargeProduct = (testFunc) => __awaiter(void 0, void 0, void 0, function* () {
|
|
94
|
+
const productLoader = {
|
|
95
|
+
getProduct,
|
|
96
|
+
postValidate: (params, _body) => __awaiter(void 0, void 0, void 0, function* () {
|
|
97
|
+
const productData = (yield getProduct(params)).productData;
|
|
98
|
+
const validateResponse = {
|
|
99
|
+
uuid: "",
|
|
100
|
+
validated: true,
|
|
101
|
+
productData,
|
|
102
|
+
};
|
|
103
|
+
return validateResponse;
|
|
104
|
+
}),
|
|
105
|
+
};
|
|
106
|
+
const product = yield CfgProduct.make(productLoader, Object.assign(Object.assign({}, dummyCatId), { partNumber: "Table" }));
|
|
107
|
+
const collect = new Collector(product);
|
|
108
|
+
const beforeSnapshot = collect.takeSnapshot();
|
|
109
|
+
yield testFunc(product);
|
|
110
|
+
const afterSnapshot = collect.takeSnapshot();
|
|
111
|
+
const diff = collect.compareSnapshot(beforeSnapshot, afterSnapshot);
|
|
112
|
+
const notifications = collect.notifications;
|
|
113
|
+
return {
|
|
114
|
+
beforeSnapshot: Collector.stripRefsForWrapper(beforeSnapshot),
|
|
115
|
+
afterSnapshot: Collector.stripRefsForWrapper(afterSnapshot),
|
|
116
|
+
diff,
|
|
117
|
+
notifications,
|
|
118
|
+
};
|
|
119
|
+
});
|
|
@@ -1,32 +1,43 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
export declare
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
export declare
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
export declare
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
export declare function
|
|
29
|
-
|
|
30
|
-
export declare function
|
|
31
|
-
export declare function
|
|
1
|
+
import { DtoAdditionalProductRef, DtoCatalogueParams, DtoCatalogueParamsWithLang, DtoCatalogueParamsWithoutCid, DtoMeasureParam, DtoModel, DtoOrientation, DtoPartsData, DtoPrices, DtoProductData, DtoProductParams, DtoProductParamsWithLang, DtoProductResponse, DtoSelectedOption, DtoTransform, DtoValidateResponse, DtoVector } from "./CatalogueAPI.js";
|
|
2
|
+
/**
|
|
3
|
+
* Makes a string from the params which can be used as a key in for example React. Language is not respected.
|
|
4
|
+
*/
|
|
5
|
+
export declare const makeCatalogueKey: (cat: DtoCatalogueParams) => string;
|
|
6
|
+
/**
|
|
7
|
+
* Makes a string from the params which can be used as a key in for example React. Language is not respected.
|
|
8
|
+
*/
|
|
9
|
+
export declare const makeProductKey: (prod: DtoProductParams) => string;
|
|
10
|
+
/**
|
|
11
|
+
* Makes a string from selected options, can be used as a key for a selection.
|
|
12
|
+
*/
|
|
13
|
+
export declare const makeSelOptionsKey: (options: DtoSelectedOption[]) => string;
|
|
14
|
+
export declare type RootNodeSource = DtoModel | File;
|
|
15
|
+
export declare type CfgProductData = Omit<Omit<DtoProductData, "models">, "partsData"> & {
|
|
16
|
+
models?: RootNodeSource[];
|
|
17
|
+
partsData: Omit<DtoPartsData, "selOptions"> & {
|
|
18
|
+
selOptions: DtoSelectedOption[];
|
|
19
|
+
};
|
|
20
|
+
};
|
|
21
|
+
export declare type CfgProductResponse = Omit<DtoProductResponse, "productData"> & {
|
|
22
|
+
productData: CfgProductData;
|
|
23
|
+
};
|
|
24
|
+
/** This must be kept in sync with DtoValidateResponse. */
|
|
25
|
+
export declare type CfgValidateResponse = Omit<DtoValidateResponse, "productData"> & {
|
|
26
|
+
productData: CfgProductData;
|
|
27
|
+
};
|
|
28
|
+
export declare function isModel(arg: unknown): arg is DtoModel;
|
|
29
|
+
/** Replace empty strings with "-" for compatibility with the API. */
|
|
30
|
+
export declare function correctDefaultsOnCatalogueParams<T extends DtoCatalogueParamsWithoutCid>(catId: T): T;
|
|
31
|
+
export declare function recursivelyGetPriceCodeValue(priceCodes: string[], prices: DtoPrices | undefined): number | undefined;
|
|
32
|
+
export declare function comparePricesObjects(prices1: DtoPrices | undefined, prices2: DtoPrices | undefined): boolean;
|
|
33
|
+
export declare const decodeCatalogueParams: <T extends DtoCatalogueParamsWithoutCid>(params: T) => T;
|
|
34
|
+
export declare const decodeProductParams: <T extends DtoProductParams>(params: T) => T;
|
|
35
|
+
export declare function isSameCatalogueParams(left: DtoCatalogueParamsWithoutCid, right: DtoCatalogueParamsWithoutCid): boolean;
|
|
36
|
+
export declare function isSameVector(left: DtoVector, right: DtoVector): boolean;
|
|
37
|
+
export declare function isSameOrientation(left: DtoOrientation, right: DtoOrientation): boolean;
|
|
38
|
+
export declare function isSameAnchor(left: DtoMeasureParam, right: DtoMeasureParam): boolean;
|
|
39
|
+
export declare function isSameTransform(left: DtoTransform, right: DtoTransform): boolean;
|
|
40
|
+
export declare function isSameProductRef(left: DtoAdditionalProductRef, right: DtoAdditionalProductRef): boolean;
|
|
41
|
+
export declare const isSameDtoCatalogueParamsWithLang: (left: DtoCatalogueParamsWithLang, right: DtoCatalogueParamsWithLang) => boolean;
|
|
42
|
+
export declare const isSameDtoProductParamsWithLang: (left: DtoProductParamsWithLang, right: DtoProductParamsWithLang) => boolean;
|
|
32
43
|
//# sourceMappingURL=utilitiesCatalogueData.d.ts.map
|