@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.
Files changed (98) hide show
  1. package/.eslintrc.json +18 -18
  2. package/LICENSE +201 -201
  3. package/README.md +1 -1
  4. package/dist/CatalogueAPI.d.ts +551 -507
  5. package/dist/CatalogueAPI.js +293 -280
  6. package/dist/CfgMeasure.d.ts +32 -32
  7. package/dist/CfgMeasure.js +30 -30
  8. package/dist/CfgProduct.d.ts +268 -258
  9. package/dist/CfgProduct.js +778 -747
  10. package/dist/CfgReferencePathHelper.d.ts +14 -0
  11. package/dist/CfgReferencePathHelper.js +13 -0
  12. package/dist/ConfigurationConverter.d.ts +5 -0
  13. package/dist/ConfigurationConverter.js +72 -0
  14. package/dist/index.d.ts +23 -20
  15. package/dist/index.js +23 -20
  16. package/dist/io/CfgHistoryManager.d.ts +51 -0
  17. package/dist/io/CfgHistoryManager.js +82 -0
  18. package/dist/io/CfgHistoryToProdConfConnector.d.ts +21 -0
  19. package/dist/io/CfgHistoryToProdConfConnector.js +56 -0
  20. package/dist/io/CfgIOManager.d.ts +49 -0
  21. package/dist/io/CfgIOManager.js +115 -0
  22. package/dist/io/CfgIOProdConfConnector.d.ts +53 -0
  23. package/dist/io/CfgIOProdConfConnector.js +141 -0
  24. package/dist/io/CfgObservableStateManager.d.ts +22 -0
  25. package/dist/io/CfgObservableStateManager.js +65 -0
  26. package/dist/io/CfgObservableStateToProdConfConnector.d.ts +15 -0
  27. package/dist/io/CfgObservableStateToProdConfConnector.js +16 -0
  28. package/dist/io/CfgWindowEventManager.d.ts +22 -0
  29. package/dist/io/CfgWindowEventManager.js +38 -0
  30. package/dist/io/CfgWindowMessageManager.d.ts +41 -0
  31. package/dist/io/CfgWindowMessageManager.js +84 -0
  32. package/dist/io/CfgWindowMessageToProdConfConnector.d.ts +17 -0
  33. package/dist/io/CfgWindowMessageToProdConfConnector.js +18 -0
  34. package/dist/io/index.d.ts +9 -0
  35. package/dist/io/index.js +8 -0
  36. package/dist/material/CfgMaterialMapping.d.ts +7 -7
  37. package/dist/material/CfgMaterialMapping.js +181 -181
  38. package/dist/material/CfgMtrlApplication.d.ts +18 -18
  39. package/dist/material/CfgMtrlApplication.js +43 -43
  40. package/dist/material/CfgMtrlApplicationSource.d.ts +7 -7
  41. package/dist/material/CfgMtrlApplicationSource.js +8 -8
  42. package/dist/material/CfgMtrlSource.d.ts +19 -19
  43. package/dist/material/CfgMtrlSource.js +40 -40
  44. package/dist/material/CfgMtrlSourceWithMetaData.d.ts +7 -7
  45. package/dist/material/CfgMtrlSourceWithMetaData.js +1 -1
  46. package/dist/productConfiguration/CfgFeature.d.ts +187 -188
  47. package/dist/productConfiguration/CfgFeature.js +645 -636
  48. package/dist/productConfiguration/CfgOption.d.ts +151 -150
  49. package/dist/productConfiguration/CfgOption.js +416 -426
  50. package/dist/productConfiguration/CfgProductConfiguration.d.ts +117 -120
  51. package/dist/productConfiguration/CfgProductConfiguration.js +307 -309
  52. package/dist/productConfiguration/filters.d.ts +15 -15
  53. package/dist/productConfiguration/filters.js +70 -70
  54. package/dist/productConfiguration/productParamsGenerator.d.ts +15 -15
  55. package/dist/productConfiguration/productParamsGenerator.js +51 -51
  56. package/dist/productConfiguration/utilitiesProductConfiguration.d.ts +17 -17
  57. package/dist/productConfiguration/utilitiesProductConfiguration.js +80 -80
  58. package/dist/productLoader.d.ts +33 -33
  59. package/dist/productLoader.js +49 -49
  60. package/dist/syncGroups/SyncGroupsApplyMode.d.ts +20 -20
  61. package/dist/syncGroups/SyncGroupsApplyMode.js +21 -21
  62. package/dist/syncGroups/SyncGroupsHandler.d.ts +40 -40
  63. package/dist/syncGroups/SyncGroupsHandler.js +359 -358
  64. package/dist/syncGroups/SyncGroupsPathHelper.d.ts +26 -26
  65. package/dist/syncGroups/SyncGroupsPathHelper.js +90 -90
  66. package/dist/syncGroups/SyncGroupsState.d.ts +35 -35
  67. package/dist/syncGroups/SyncGroupsState.js +125 -125
  68. package/dist/syncGroups/SyncGroupsTransaction.d.ts +154 -154
  69. package/dist/syncGroups/SyncGroupsTransaction.js +576 -576
  70. package/dist/tasks/TaskHandler.d.ts +77 -78
  71. package/dist/tasks/TaskHandler.js +275 -276
  72. package/dist/tasks/formats.d.ts +4 -4
  73. package/dist/tasks/formats.js +7 -7
  74. package/dist/tests/testData/collectorForTest.d.ts +73 -73
  75. package/dist/tests/testData/collectorForTest.js +194 -194
  76. package/dist/tests/testData/dummyProductForTest.d.ts +4 -4
  77. package/dist/tests/testData/dummyProductForTest.js +32 -36
  78. package/dist/tests/testData/testDataAdditionalProductInAdditionalProductInProductForTest.d.ts +11 -11
  79. package/dist/tests/testData/testDataAdditionalProductInAdditionalProductInProductForTest.js +277 -277
  80. package/dist/tests/testData/testDataCachedGetProduct.d.ts +5 -5
  81. package/dist/tests/testData/testDataCachedGetProduct.js +185 -185
  82. package/dist/tests/testData/testDataCachedPostValidate.d.ts +7 -7
  83. package/dist/tests/testData/testDataCachedPostValidate.js +183 -183
  84. package/dist/tests/testData/testDataNoAdditionalProductNoPropagateForTest.d.ts +3 -3
  85. package/dist/tests/testData/testDataNoAdditionalProductNoPropagateForTest.js +1099 -1099
  86. package/dist/tests/testData/testDataOptions.d.ts +12 -12
  87. package/dist/tests/testData/testDataOptions.js +60 -60
  88. package/dist/tests/testData/testDataProductAggregatedPrice.d.ts +6 -6
  89. package/dist/tests/testData/testDataProductAggregatedPrice.js +187 -187
  90. package/dist/tests/testData/testDataUpcharge.d.ts +8 -8
  91. package/dist/tests/testData/testDataUpcharge.js +119 -119
  92. package/dist/utilitiesCatalogueData.d.ts +42 -31
  93. package/dist/utilitiesCatalogueData.js +173 -162
  94. package/dist/utilitiesCataloguePermission.d.ts +38 -37
  95. package/dist/utilitiesCataloguePermission.js +79 -80
  96. package/dist/utilitiesNumericValues.d.ts +24 -24
  97. package/dist/utilitiesNumericValues.js +109 -109
  98. package/package.json +3 -3
@@ -1,185 +1,185 @@
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 { wrapWithGetProductCache } from "../../productLoader.js";
12
- import { dummyCatId } from "./dummyProductForTest.js";
13
- import { letterOptionCodeA, letterOptions } from "./testDataOptions.js";
14
- let prodKeyArray = [];
15
- const A = () => ({
16
- uuid: "A",
17
- unit: "m",
18
- features: [
19
- {
20
- code: "featureA",
21
- description: "",
22
- numericOrder: false,
23
- options: [
24
- Object.assign(Object.assign({}, letterOptions[0]), { additionalProductRefs: [
25
- { refKey: "C_0", catId: dummyCatId, partNumber: "C" },
26
- { refKey: "B_0", catId: dummyCatId, partNumber: "B" },
27
- ] }),
28
- Object.assign(Object.assign({}, letterOptions[1]), { additionalProductRefs: [{ refKey: "E", catId: dummyCatId, partNumber: "E" }] }),
29
- Object.assign(Object.assign({}, letterOptions[2]), { additionalProductRefs: [{ refKey: "D", catId: dummyCatId, partNumber: "D" }] }),
30
- ],
31
- },
32
- ],
33
- productData: {
34
- sku: "A",
35
- partsData: {
36
- basePrice: 40,
37
- currency: "EURO",
38
- listPrice: 50,
39
- pkgCount: 0,
40
- styleNr: "",
41
- selOptions: [
42
- {
43
- code: "!~!",
44
- next: {
45
- [letterOptionCodeA]: {
46
- code: letterOptionCodeA,
47
- },
48
- },
49
- },
50
- ],
51
- },
52
- additionalProductRefs: [
53
- { refKey: "B_1", catId: dummyCatId, partNumber: "B", optional: true },
54
- ],
55
- },
56
- rootFeatureRefs: [{ code: "featureA" }],
57
- });
58
- const B = () => ({
59
- uuid: "B",
60
- unit: "m",
61
- features: [],
62
- productData: {
63
- sku: "B",
64
- partsData: {
65
- basePrice: 30,
66
- currency: "EURO",
67
- listPrice: 40,
68
- pkgCount: 0,
69
- selOptions: [],
70
- styleNr: "",
71
- },
72
- additionalProductRefs: [{ refKey: "C_0", catId: dummyCatId, partNumber: "C" }],
73
- },
74
- rootFeatureRefs: [],
75
- });
76
- const C = () => ({
77
- uuid: "C",
78
- unit: "m",
79
- features: [],
80
- productData: {
81
- sku: "C",
82
- partsData: {
83
- basePrice: 20,
84
- currency: "EURO",
85
- listPrice: 30,
86
- pkgCount: 0,
87
- selOptions: [],
88
- styleNr: "",
89
- },
90
- },
91
- rootFeatureRefs: [],
92
- });
93
- const D = () => ({
94
- uuid: "D",
95
- unit: "m",
96
- features: [],
97
- productData: {
98
- sku: "D",
99
- partsData: {
100
- basePrice: 10,
101
- currency: "EURO",
102
- listPrice: 20,
103
- pkgCount: 0,
104
- selOptions: [],
105
- styleNr: "",
106
- },
107
- },
108
- rootFeatureRefs: [],
109
- });
110
- const E = () => ({
111
- uuid: "E",
112
- unit: "m",
113
- features: [],
114
- productData: {
115
- sku: "E",
116
- partsData: {
117
- basePrice: 15,
118
- currency: "USD",
119
- listPrice: 25,
120
- pkgCount: 0,
121
- selOptions: [],
122
- styleNr: "",
123
- },
124
- },
125
- rootFeatureRefs: [],
126
- });
127
- export const getTestProduct = (params, validateCall) => {
128
- const partNumber = params.partNumber;
129
- if (validateCall !== true) {
130
- if (prodKeyArray.indexOf(partNumber) > -1) {
131
- throw new Error("Duplicate call!");
132
- }
133
- else {
134
- prodKeyArray.push(partNumber);
135
- }
136
- }
137
- switch (partNumber) {
138
- case "A":
139
- return Promise.resolve(A());
140
- case "B":
141
- return Promise.resolve(B());
142
- case "C":
143
- return Promise.resolve(C());
144
- case "D":
145
- return Promise.resolve(D());
146
- case "E":
147
- return Promise.resolve(E());
148
- }
149
- throw new Error("No such part");
150
- };
151
- export const cachedProductLoaderTest = () => __awaiter(void 0, void 0, void 0, function* () {
152
- prodKeyArray = [];
153
- const productLoader = {
154
- getProduct: getTestProduct,
155
- postValidate: (params, _body) => __awaiter(void 0, void 0, void 0, function* () {
156
- const productData = (yield getTestProduct(params, true)).productData;
157
- let code = letterOptionCodeA;
158
- for (const test in _body.selOptions[0].next) {
159
- code = test;
160
- break;
161
- }
162
- productData.partsData.selOptions = [
163
- {
164
- code: _body.selOptions[0].code,
165
- next: {
166
- [code]: {
167
- code: code,
168
- },
169
- },
170
- },
171
- ];
172
- const validateResponse = {
173
- uuid: "",
174
- validated: true,
175
- productData,
176
- };
177
- return validateResponse;
178
- }),
179
- };
180
- const productWrapper = yield CfgProduct.make({
181
- getProduct: wrapWithGetProductCache(productLoader.getProduct.bind(productLoader)),
182
- postValidate: productLoader.postValidate.bind(productLoader),
183
- }, "lang", dummyCatId, "A");
184
- return productWrapper;
185
- });
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 { wrapWithGetProductCache } from "../../productLoader.js";
12
+ import { dummyCatId } from "./dummyProductForTest.js";
13
+ import { letterOptionCodeA, letterOptions } from "./testDataOptions.js";
14
+ let prodKeyArray = [];
15
+ const A = () => ({
16
+ uuid: "A",
17
+ unit: "m",
18
+ features: [
19
+ {
20
+ code: "featureA",
21
+ description: "",
22
+ numericOrder: false,
23
+ options: [
24
+ Object.assign(Object.assign({}, letterOptions[0]), { additionalProductRefs: [
25
+ { refKey: "C_0", catId: dummyCatId, partNumber: "C" },
26
+ { refKey: "B_0", catId: dummyCatId, partNumber: "B" },
27
+ ] }),
28
+ Object.assign(Object.assign({}, letterOptions[1]), { additionalProductRefs: [{ refKey: "E", catId: dummyCatId, partNumber: "E" }] }),
29
+ Object.assign(Object.assign({}, letterOptions[2]), { additionalProductRefs: [{ refKey: "D", catId: dummyCatId, partNumber: "D" }] }),
30
+ ],
31
+ },
32
+ ],
33
+ productData: {
34
+ sku: "A",
35
+ partsData: {
36
+ basePrice: 40,
37
+ currency: "EURO",
38
+ listPrice: 50,
39
+ pkgCount: 0,
40
+ styleNr: "",
41
+ selOptions: [
42
+ {
43
+ code: "!~!",
44
+ next: {
45
+ [letterOptionCodeA]: {
46
+ code: letterOptionCodeA,
47
+ },
48
+ },
49
+ },
50
+ ],
51
+ },
52
+ additionalProductRefs: [
53
+ { refKey: "B_1", catId: dummyCatId, partNumber: "B", optional: true },
54
+ ],
55
+ },
56
+ rootFeatureRefs: [{ code: "featureA" }],
57
+ });
58
+ const B = () => ({
59
+ uuid: "B",
60
+ unit: "m",
61
+ features: [],
62
+ productData: {
63
+ sku: "B",
64
+ partsData: {
65
+ basePrice: 30,
66
+ currency: "EURO",
67
+ listPrice: 40,
68
+ pkgCount: 0,
69
+ selOptions: [],
70
+ styleNr: "",
71
+ },
72
+ additionalProductRefs: [{ refKey: "C_0", catId: dummyCatId, partNumber: "C" }],
73
+ },
74
+ rootFeatureRefs: [],
75
+ });
76
+ const C = () => ({
77
+ uuid: "C",
78
+ unit: "m",
79
+ features: [],
80
+ productData: {
81
+ sku: "C",
82
+ partsData: {
83
+ basePrice: 20,
84
+ currency: "EURO",
85
+ listPrice: 30,
86
+ pkgCount: 0,
87
+ selOptions: [],
88
+ styleNr: "",
89
+ },
90
+ },
91
+ rootFeatureRefs: [],
92
+ });
93
+ const D = () => ({
94
+ uuid: "D",
95
+ unit: "m",
96
+ features: [],
97
+ productData: {
98
+ sku: "D",
99
+ partsData: {
100
+ basePrice: 10,
101
+ currency: "EURO",
102
+ listPrice: 20,
103
+ pkgCount: 0,
104
+ selOptions: [],
105
+ styleNr: "",
106
+ },
107
+ },
108
+ rootFeatureRefs: [],
109
+ });
110
+ const E = () => ({
111
+ uuid: "E",
112
+ unit: "m",
113
+ features: [],
114
+ productData: {
115
+ sku: "E",
116
+ partsData: {
117
+ basePrice: 15,
118
+ currency: "USD",
119
+ listPrice: 25,
120
+ pkgCount: 0,
121
+ selOptions: [],
122
+ styleNr: "",
123
+ },
124
+ },
125
+ rootFeatureRefs: [],
126
+ });
127
+ export const getTestProduct = (params, validateCall) => {
128
+ const partNumber = params.partNumber;
129
+ if (validateCall !== true) {
130
+ if (prodKeyArray.indexOf(partNumber) > -1) {
131
+ throw new Error("Duplicate call!");
132
+ }
133
+ else {
134
+ prodKeyArray.push(partNumber);
135
+ }
136
+ }
137
+ switch (partNumber) {
138
+ case "A":
139
+ return Promise.resolve(A());
140
+ case "B":
141
+ return Promise.resolve(B());
142
+ case "C":
143
+ return Promise.resolve(C());
144
+ case "D":
145
+ return Promise.resolve(D());
146
+ case "E":
147
+ return Promise.resolve(E());
148
+ }
149
+ throw new Error("No such part");
150
+ };
151
+ export const cachedProductLoaderTest = () => __awaiter(void 0, void 0, void 0, function* () {
152
+ prodKeyArray = [];
153
+ const productLoader = {
154
+ getProduct: getTestProduct,
155
+ postValidate: (params, _body) => __awaiter(void 0, void 0, void 0, function* () {
156
+ const productData = (yield getTestProduct(params, true)).productData;
157
+ let code = letterOptionCodeA;
158
+ for (const test in _body.selOptions[0].next) {
159
+ code = test;
160
+ break;
161
+ }
162
+ productData.partsData.selOptions = [
163
+ {
164
+ code: _body.selOptions[0].code,
165
+ next: {
166
+ [code]: {
167
+ code: code,
168
+ },
169
+ },
170
+ },
171
+ ];
172
+ const validateResponse = {
173
+ uuid: "",
174
+ validated: true,
175
+ productData,
176
+ };
177
+ return validateResponse;
178
+ }),
179
+ };
180
+ const productWrapper = yield CfgProduct.make({
181
+ getProduct: wrapWithGetProductCache(productLoader.getProduct.bind(productLoader)),
182
+ postValidate: productLoader.postValidate.bind(productLoader),
183
+ }, Object.assign(Object.assign({}, dummyCatId), { partNumber: "A" }));
184
+ return productWrapper;
185
+ });
@@ -1,8 +1,8 @@
1
- import { CfgProduct } from "../../CfgProduct.js";
2
- export declare const cachedProductLoaderTest: () => Promise<{
3
- product: CfgProduct;
4
- validateCounter: {
5
- count: number;
6
- };
7
- }>;
1
+ import { CfgProduct } from "../../CfgProduct.js";
2
+ export declare const cachedProductLoaderTest: () => Promise<{
3
+ product: CfgProduct;
4
+ validateCounter: {
5
+ count: number;
6
+ };
7
+ }>;
8
8
  //# sourceMappingURL=testDataCachedPostValidate.d.ts.map