@configura/web-api 2.0.0-alpha.2 → 2.0.0-alpha.21

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 (100) hide show
  1. package/.eslintrc.json +5 -18
  2. package/LICENSE +201 -201
  3. package/README.md +1 -1
  4. package/dist/CatalogueAPI.d.ts +597 -551
  5. package/dist/CatalogueAPI.js +328 -293
  6. package/dist/CfgMeasure.d.ts +32 -32
  7. package/dist/CfgMeasure.js +30 -30
  8. package/dist/CfgProduct.d.ts +328 -268
  9. package/dist/CfgProduct.js +934 -778
  10. package/dist/CfgReferencePathHelper.d.ts +26 -13
  11. package/dist/CfgReferencePathHelper.js +26 -13
  12. package/dist/ConfigurationConverter.d.ts +17 -4
  13. package/dist/ConfigurationConverter.js +175 -72
  14. package/dist/index.d.ts +23 -23
  15. package/dist/index.js +23 -23
  16. package/dist/io/CfgHistoryManager.d.ts +83 -50
  17. package/dist/io/CfgHistoryManager.js +144 -82
  18. package/dist/io/CfgHistoryToProdConfConnector.d.ts +21 -20
  19. package/dist/io/CfgHistoryToProdConfConnector.js +50 -56
  20. package/dist/io/CfgIOManager.d.ts +53 -48
  21. package/dist/io/CfgIOManager.js +134 -115
  22. package/dist/io/CfgIOProdConfConnector.d.ts +64 -52
  23. package/dist/io/CfgIOProdConfConnector.js +149 -141
  24. package/dist/io/CfgIOWarningSupplier.d.ts +4 -0
  25. package/dist/io/CfgIOWarningSupplier.js +1 -0
  26. package/dist/io/CfgObservableStateManager.d.ts +25 -21
  27. package/dist/io/CfgObservableStateManager.js +69 -65
  28. package/dist/io/CfgObservableStateToProdConfConnector.d.ts +14 -14
  29. package/dist/io/CfgObservableStateToProdConfConnector.js +16 -16
  30. package/dist/io/CfgWindowEventManager.d.ts +21 -21
  31. package/dist/io/CfgWindowEventManager.js +38 -38
  32. package/dist/io/CfgWindowMessageManager.d.ts +40 -40
  33. package/dist/io/CfgWindowMessageManager.js +91 -84
  34. package/dist/io/CfgWindowMessageToProdConfConnector.d.ts +16 -16
  35. package/dist/io/CfgWindowMessageToProdConfConnector.js +18 -18
  36. package/dist/io/index.d.ts +8 -8
  37. package/dist/io/index.js +8 -8
  38. package/dist/material/CfgMaterialMapping.d.ts +7 -7
  39. package/dist/material/CfgMaterialMapping.js +181 -181
  40. package/dist/material/CfgMtrlApplication.d.ts +18 -18
  41. package/dist/material/CfgMtrlApplication.js +43 -43
  42. package/dist/material/CfgMtrlApplicationSource.d.ts +7 -7
  43. package/dist/material/CfgMtrlApplicationSource.js +8 -8
  44. package/dist/material/CfgMtrlSource.d.ts +19 -19
  45. package/dist/material/CfgMtrlSource.js +40 -40
  46. package/dist/material/CfgMtrlSourceWithMetaData.d.ts +7 -7
  47. package/dist/material/CfgMtrlSourceWithMetaData.js +1 -1
  48. package/dist/productConfiguration/CfgFeature.d.ts +189 -187
  49. package/dist/productConfiguration/CfgFeature.js +658 -645
  50. package/dist/productConfiguration/CfgOption.d.ts +151 -151
  51. package/dist/productConfiguration/CfgOption.js +422 -416
  52. package/dist/productConfiguration/CfgProductConfiguration.d.ts +129 -117
  53. package/dist/productConfiguration/CfgProductConfiguration.js +340 -307
  54. package/dist/productConfiguration/filters.d.ts +15 -15
  55. package/dist/productConfiguration/filters.js +70 -70
  56. package/dist/productConfiguration/productParamsGenerator.d.ts +15 -15
  57. package/dist/productConfiguration/productParamsGenerator.js +51 -51
  58. package/dist/productConfiguration/utilitiesProductConfiguration.d.ts +17 -17
  59. package/dist/productConfiguration/utilitiesProductConfiguration.js +87 -80
  60. package/dist/productLoader.d.ts +33 -33
  61. package/dist/productLoader.js +49 -49
  62. package/dist/syncGroups/SyncGroupsApplyMode.d.ts +20 -20
  63. package/dist/syncGroups/SyncGroupsApplyMode.js +21 -21
  64. package/dist/syncGroups/SyncGroupsHandler.d.ts +47 -40
  65. package/dist/syncGroups/SyncGroupsHandler.js +370 -359
  66. package/dist/syncGroups/SyncGroupsPathHelper.d.ts +26 -26
  67. package/dist/syncGroups/SyncGroupsPathHelper.js +90 -90
  68. package/dist/syncGroups/SyncGroupsState.d.ts +39 -35
  69. package/dist/syncGroups/SyncGroupsState.js +167 -125
  70. package/dist/syncGroups/SyncGroupsTransaction.d.ts +154 -154
  71. package/dist/syncGroups/SyncGroupsTransaction.js +589 -576
  72. package/dist/tasks/TaskHandler.d.ts +77 -77
  73. package/dist/tasks/TaskHandler.js +276 -275
  74. package/dist/tasks/formats.d.ts +4 -4
  75. package/dist/tasks/formats.js +7 -7
  76. package/dist/tests/testData/collectorForTest.d.ts +73 -73
  77. package/dist/tests/testData/collectorForTest.js +194 -194
  78. package/dist/tests/testData/dummyProductForTest.d.ts +4 -4
  79. package/dist/tests/testData/dummyProductForTest.js +32 -32
  80. package/dist/tests/testData/testDataAdditionalProductInAdditionalProductInProductForTest.d.ts +11 -11
  81. package/dist/tests/testData/testDataAdditionalProductInAdditionalProductInProductForTest.js +282 -277
  82. package/dist/tests/testData/testDataCachedGetProduct.d.ts +5 -5
  83. package/dist/tests/testData/testDataCachedGetProduct.js +187 -185
  84. package/dist/tests/testData/testDataCachedPostValidate.d.ts +7 -7
  85. package/dist/tests/testData/testDataCachedPostValidate.js +185 -183
  86. package/dist/tests/testData/testDataNoAdditionalProductNoPropagateForTest.d.ts +3 -3
  87. package/dist/tests/testData/testDataNoAdditionalProductNoPropagateForTest.js +1099 -1099
  88. package/dist/tests/testData/testDataOptions.d.ts +12 -12
  89. package/dist/tests/testData/testDataOptions.js +60 -60
  90. package/dist/tests/testData/testDataProductAggregatedPrice.d.ts +6 -6
  91. package/dist/tests/testData/testDataProductAggregatedPrice.js +189 -187
  92. package/dist/tests/testData/testDataUpcharge.d.ts +8 -8
  93. package/dist/tests/testData/testDataUpcharge.js +121 -119
  94. package/dist/utilitiesCatalogueData.d.ts +47 -42
  95. package/dist/utilitiesCatalogueData.js +180 -173
  96. package/dist/utilitiesCataloguePermission.d.ts +38 -38
  97. package/dist/utilitiesCataloguePermission.js +79 -79
  98. package/dist/utilitiesNumericValues.d.ts +24 -24
  99. package/dist/utilitiesNumericValues.js +114 -109
  100. package/package.json +3 -3
@@ -1,119 +1,121 @@
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
+ 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
+ unit: "m",
101
+ validated: true,
102
+ productData,
103
+ features: [],
104
+ };
105
+ return validateResponse;
106
+ }),
107
+ };
108
+ const product = yield CfgProduct.make(productLoader, Object.assign(Object.assign({}, dummyCatId), { partNumber: "Table" }));
109
+ const collect = new Collector(product);
110
+ const beforeSnapshot = collect.takeSnapshot();
111
+ yield testFunc(product);
112
+ const afterSnapshot = collect.takeSnapshot();
113
+ const diff = collect.compareSnapshot(beforeSnapshot, afterSnapshot);
114
+ const notifications = collect.notifications;
115
+ return {
116
+ beforeSnapshot: Collector.stripRefsForWrapper(beforeSnapshot),
117
+ afterSnapshot: Collector.stripRefsForWrapper(afterSnapshot),
118
+ diff,
119
+ notifications,
120
+ };
121
+ });
@@ -1,43 +1,48 @@
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;
1
+ import { DtoAdditionalProductRef, DtoCatalogueParams, DtoCatalogueParamsWithCid, DtoCatalogueParamsWithCidAndLang, DtoMeasureParam, DtoModel, DtoOrientation, DtoPartsData, DtoPrices, DtoProductData, DtoProductParamsWithCid, DtoProductParamsWithCidAndLang, 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: DtoCatalogueParamsWithCid) => 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: DtoProductParamsWithCid) => 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
+ /**
22
+ * Deep compare. Uses the JSON.stringify method for comparison
23
+ * @returns true if equal. Key and array order is respected.
24
+ */
25
+ export declare function compareCfgProductData(pd1: CfgProductData, pd2: CfgProductData): boolean;
26
+ export declare type CfgProductResponse = Omit<DtoProductResponse, "productData"> & {
27
+ productData: CfgProductData;
28
+ };
29
+ /** This must be kept in sync with DtoValidateResponse. */
30
+ export declare type CfgValidateResponse = Omit<DtoValidateResponse, "productData"> & {
31
+ productData: CfgProductData;
32
+ };
33
+ export declare function isModel(arg: unknown): arg is DtoModel;
34
+ /** Replace empty strings with "-" for compatibility with the API. */
35
+ export declare function correctDefaultsOnCatalogueParams<T extends DtoCatalogueParams>(catId: T): T;
36
+ export declare function recursivelyGetPriceCodeValue(priceCodes: string[], prices: DtoPrices | undefined): number | undefined;
37
+ export declare function comparePricesObjects(prices1: DtoPrices | undefined, prices2: DtoPrices | undefined): boolean;
38
+ export declare const decodeCatalogueParams: <T extends DtoCatalogueParams>(params: T) => T;
39
+ export declare const decodeProductParams: <T extends DtoProductParamsWithCid>(params: T) => T;
40
+ export declare function isSameCatalogueParams(left: DtoCatalogueParams, right: DtoCatalogueParams): boolean;
41
+ export declare function isSameVector(left: DtoVector, right: DtoVector): boolean;
42
+ export declare function isSameOrientation(left: DtoOrientation, right: DtoOrientation): boolean;
43
+ export declare function isSameAnchor(left: DtoMeasureParam, right: DtoMeasureParam): boolean;
44
+ export declare function isSameTransform(left: DtoTransform, right: DtoTransform): boolean;
45
+ export declare function isSameProductRef(left: DtoAdditionalProductRef, right: DtoAdditionalProductRef): boolean;
46
+ export declare const isSameDtoCatalogueParamsWithLang: (left: DtoCatalogueParamsWithCidAndLang, right: DtoCatalogueParamsWithCidAndLang) => boolean;
47
+ export declare const isSameDtoProductParamsWithLang: (left: DtoProductParamsWithCidAndLang, right: DtoProductParamsWithCidAndLang) => boolean;
43
48
  //# sourceMappingURL=utilitiesCatalogueData.d.ts.map