@configura/web-api 1.2.1 → 1.3.0-alpha.3

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 (53) hide show
  1. package/LICENSE +201 -201
  2. package/README.md +1 -1
  3. package/dist/CatalogueAPI.d.ts +448 -448
  4. package/dist/CatalogueAPI.js +206 -206
  5. package/dist/CfgProduct.d.ts +116 -116
  6. package/dist/CfgProduct.js +588 -588
  7. package/dist/index.d.ts +15 -15
  8. package/dist/index.js +15 -15
  9. package/dist/material/CfgMaterialMapping.d.ts +7 -7
  10. package/dist/material/CfgMaterialMapping.js +176 -176
  11. package/dist/material/CfgMtrlApplication.d.ts +18 -18
  12. package/dist/material/CfgMtrlApplication.js +43 -43
  13. package/dist/material/CfgMtrlApplicationSource.d.ts +7 -7
  14. package/dist/material/CfgMtrlApplicationSource.js +8 -8
  15. package/dist/material/CfgMtrlSource.d.ts +19 -19
  16. package/dist/material/CfgMtrlSource.js +40 -40
  17. package/dist/material/CfgMtrlSourceWithMetaData.d.ts +7 -7
  18. package/dist/material/CfgMtrlSourceWithMetaData.js +1 -1
  19. package/dist/productConfiguration/CfgFeature.d.ts +134 -134
  20. package/dist/productConfiguration/CfgFeature.js +483 -483
  21. package/dist/productConfiguration/CfgOption.d.ts +112 -112
  22. package/dist/productConfiguration/CfgOption.js +293 -293
  23. package/dist/productConfiguration/CfgProductConfiguration.d.ts +50 -50
  24. package/dist/productConfiguration/CfgProductConfiguration.js +198 -198
  25. package/dist/productConfiguration/filters.d.ts +7 -7
  26. package/dist/productConfiguration/filters.js +29 -29
  27. package/dist/productConfiguration/productParamsGenerator.d.ts +15 -15
  28. package/dist/productConfiguration/productParamsGenerator.js +51 -51
  29. package/dist/productConfiguration/utilitiesProductConfiguration.d.ts +9 -9
  30. package/dist/productConfiguration/utilitiesProductConfiguration.js +61 -61
  31. package/dist/productLoader.d.ts +11 -11
  32. package/dist/productLoader.js +41 -41
  33. package/dist/tests/testData/collectorForTest.d.ts +73 -73
  34. package/dist/tests/testData/collectorForTest.js +195 -195
  35. package/dist/tests/testData/dummyProductForTest.d.ts +4 -4
  36. package/dist/tests/testData/dummyProductForTest.js +35 -35
  37. package/dist/tests/testData/testDataAdditionalProductInAdditionalProductInProductForTest.d.ts +32 -32
  38. package/dist/tests/testData/testDataAdditionalProductInAdditionalProductInProductForTest.js +368 -368
  39. package/dist/tests/testData/testDataCachedGetProduct.d.ts +5 -5
  40. package/dist/tests/testData/testDataCachedGetProduct.js +199 -199
  41. package/dist/tests/testData/testDataCachedPostValidate.d.ts +7 -7
  42. package/dist/tests/testData/testDataCachedPostValidate.js +189 -189
  43. package/dist/tests/testData/testDataNoAdditionalProductNoPropagateForTest.d.ts +3 -3
  44. package/dist/tests/testData/testDataNoAdditionalProductNoPropagateForTest.js +1117 -1117
  45. package/dist/tests/testData/testDataProductAggregatedPrice.d.ts +28 -28
  46. package/dist/tests/testData/testDataProductAggregatedPrice.js +205 -205
  47. package/dist/tests/testData/testDataUpcharge.d.ts +29 -29
  48. package/dist/tests/testData/testDataUpcharge.js +159 -159
  49. package/dist/utilitiesCatalogueData.d.ts +20 -18
  50. package/dist/utilitiesCatalogueData.js +64 -56
  51. package/dist/utilitiesCataloguePermission.d.ts +39 -39
  52. package/dist/utilitiesCataloguePermission.js +84 -84
  53. package/package.json +3 -3
@@ -1,206 +1,206 @@
1
- // WARNING: This file was auto generated by the code in web-rnd/tygen.
2
- // Do not commit manual changes to this file.
3
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
4
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
5
- return new (P || (P = Promise))(function (resolve, reject) {
6
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
7
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
8
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
9
- step((generator = generator.apply(thisArg, _arguments || [])).next());
10
- });
11
- };
12
- export class APIError extends Error {
13
- }
14
- export class CatalogueAPI {
15
- hasFeature(feature) {
16
- return this.auth !== undefined && this.auth.apiSession.features !== undefined && this.auth.apiSession.features.indexOf(feature) > -1;
17
- }
18
- fetch(url, options) {
19
- return __awaiter(this, void 0, void 0, function* () {
20
- let response;
21
- let body;
22
- let err;
23
- if (options.method === "POST" && options.body) {
24
- options.headers["Content-Type"] = "application/json;charset=utf-8";
25
- }
26
- try {
27
- response = yield fetch(url, options);
28
- body = yield response.text();
29
- const parsed = JSON.parse(body);
30
- if ("error" in parsed) {
31
- err = new APIError(parsed.error);
32
- err.body = body;
33
- err.status = response.status;
34
- err.parsed = parsed;
35
- }
36
- else {
37
- return parsed;
38
- }
39
- }
40
- catch (e) {
41
- const msg = e instanceof Error ? e.message : `${e}`;
42
- err = new APIError(msg);
43
- err.body = body;
44
- err.status = response && response.status;
45
- err.error = e instanceof Error ? e : Error(e);
46
- }
47
- throw err;
48
- });
49
- }
50
- postPublicAccessTokenAuthorize(params, endpoint) {
51
- return __awaiter(this, void 0, void 0, function* () {
52
- const url = `/v1/catadmin/access-token/public/${encodeURIComponent(params.pk)}/authorize`;
53
- const options = {
54
- method: "POST",
55
- headers: {},
56
- };
57
- return this.fetch(endpoint + url, options);
58
- });
59
- }
60
- getApplicationAreas(params) {
61
- return __awaiter(this, void 0, void 0, function* () {
62
- if (this.auth === undefined) {
63
- throw new Error("missing auth");
64
- }
65
- const url = `/v1/catalogue/${encodeURIComponent(params.lang)}/${encodeURIComponent(params.enterprise)}/${encodeURIComponent(params.prdCat)}/${encodeURIComponent(params.prdCatVersion)}/${encodeURIComponent(params.vendor)}/${encodeURIComponent(params.priceList)}/application-areas`;
66
- const options = {
67
- method: "GET",
68
- headers: { "X-API-Key": this.auth.secretToken || "" },
69
- };
70
- return this.fetch(this.auth.endpoint + url, options);
71
- });
72
- }
73
- postExport(params, body) {
74
- return __awaiter(this, void 0, void 0, function* () {
75
- if (this.auth === undefined) {
76
- throw new Error("missing auth");
77
- }
78
- const url = `/v1/catalogue/${encodeURIComponent(params.lang)}/${encodeURIComponent(params.enterprise)}/${encodeURIComponent(params.prdCat)}/${encodeURIComponent(params.prdCatVersion)}/${encodeURIComponent(params.vendor)}/${encodeURIComponent(params.priceList)}/export/${encodeURIComponent(params.partNumber)}`;
79
- const options = {
80
- method: "POST",
81
- headers: { "X-API-Key": this.auth.secretToken || "" },
82
- body: JSON.stringify(body),
83
- };
84
- return this.fetch(this.auth.endpoint + url, options);
85
- });
86
- }
87
- getPriceLists(params) {
88
- return __awaiter(this, void 0, void 0, function* () {
89
- if (this.auth === undefined) {
90
- throw new Error("missing auth");
91
- }
92
- const url = `/v1/catalogue/${encodeURIComponent(params.lang)}/${encodeURIComponent(params.enterprise)}/${encodeURIComponent(params.prdCat)}/${encodeURIComponent(params.prdCatVersion)}/${encodeURIComponent(params.vendor)}/${encodeURIComponent(params.priceList)}/price-lists`;
93
- const options = {
94
- method: "GET",
95
- headers: { "X-API-Key": this.auth.secretToken || "" },
96
- };
97
- return this.fetch(this.auth.endpoint + url, options);
98
- });
99
- }
100
- getProduct(params) {
101
- return __awaiter(this, void 0, void 0, function* () {
102
- if (this.auth === undefined) {
103
- throw new Error("missing auth");
104
- }
105
- const url = `/v1/catalogue/${encodeURIComponent(params.lang)}/${encodeURIComponent(params.enterprise)}/${encodeURIComponent(params.prdCat)}/${encodeURIComponent(params.prdCatVersion)}/${encodeURIComponent(params.vendor)}/${encodeURIComponent(params.priceList)}/product-v2/${encodeURIComponent(params.partNumber)}`;
106
- const options = {
107
- method: "GET",
108
- headers: { "X-API-Key": this.auth.secretToken || "" },
109
- };
110
- return this.fetch(this.auth.endpoint + url, options);
111
- });
112
- }
113
- postRender(params, body) {
114
- return __awaiter(this, void 0, void 0, function* () {
115
- if (this.auth === undefined) {
116
- throw new Error("missing auth");
117
- }
118
- const url = `/v1/catalogue/${encodeURIComponent(params.lang)}/${encodeURIComponent(params.enterprise)}/${encodeURIComponent(params.prdCat)}/${encodeURIComponent(params.prdCatVersion)}/${encodeURIComponent(params.vendor)}/${encodeURIComponent(params.priceList)}/product/${encodeURIComponent(params.partNumber)}/render`;
119
- const options = {
120
- method: "POST",
121
- headers: { "X-API-Key": this.auth.secretToken || "" },
122
- body: JSON.stringify(body),
123
- };
124
- return this.fetch(this.auth.endpoint + url, options);
125
- });
126
- }
127
- postValidate(params, body) {
128
- return __awaiter(this, void 0, void 0, function* () {
129
- if (this.auth === undefined) {
130
- throw new Error("missing auth");
131
- }
132
- const url = `/v1/catalogue/${encodeURIComponent(params.lang)}/${encodeURIComponent(params.enterprise)}/${encodeURIComponent(params.prdCat)}/${encodeURIComponent(params.prdCatVersion)}/${encodeURIComponent(params.vendor)}/${encodeURIComponent(params.priceList)}/product/${encodeURIComponent(params.partNumber)}/validate`;
133
- const options = {
134
- method: "POST",
135
- headers: { "X-API-Key": this.auth.secretToken || "" },
136
- body: JSON.stringify(body),
137
- };
138
- return this.fetch(this.auth.endpoint + url, options);
139
- });
140
- }
141
- getTocTree(params) {
142
- return __awaiter(this, void 0, void 0, function* () {
143
- if (this.auth === undefined) {
144
- throw new Error("missing auth");
145
- }
146
- const url = `/v1/catalogue/${encodeURIComponent(params.lang)}/${encodeURIComponent(params.enterprise)}/${encodeURIComponent(params.prdCat)}/${encodeURIComponent(params.prdCatVersion)}/${encodeURIComponent(params.vendor)}/${encodeURIComponent(params.priceList)}/toc`;
147
- const options = {
148
- method: "GET",
149
- headers: { "X-API-Key": this.auth.secretToken || "" },
150
- };
151
- return this.fetch(this.auth.endpoint + url, options);
152
- });
153
- }
154
- getTocFlat(params) {
155
- return __awaiter(this, void 0, void 0, function* () {
156
- if (this.auth === undefined) {
157
- throw new Error("missing auth");
158
- }
159
- const url = `/v1/catalogue/${encodeURIComponent(params.lang)}/${encodeURIComponent(params.enterprise)}/${encodeURIComponent(params.prdCat)}/${encodeURIComponent(params.prdCatVersion)}/${encodeURIComponent(params.vendor)}/${encodeURIComponent(params.priceList)}/toc/flat`;
160
- const options = {
161
- method: "GET",
162
- headers: { "X-API-Key": this.auth.secretToken || "" },
163
- };
164
- return this.fetch(this.auth.endpoint + url, options);
165
- });
166
- }
167
- getExportById(params) {
168
- return __awaiter(this, void 0, void 0, function* () {
169
- if (this.auth === undefined) {
170
- throw new Error("missing auth");
171
- }
172
- const url = `/v1/export/${encodeURIComponent(params.uuid)}`;
173
- const options = {
174
- method: "GET",
175
- headers: { "X-API-Key": this.auth.secretToken || "" },
176
- };
177
- return this.fetch(this.auth.endpoint + url, options);
178
- });
179
- }
180
- getRenderById(params) {
181
- return __awaiter(this, void 0, void 0, function* () {
182
- if (this.auth === undefined) {
183
- throw new Error("missing auth");
184
- }
185
- const url = `/v1/render/${encodeURIComponent(params.uuid)}`;
186
- const options = {
187
- method: "GET",
188
- headers: { "X-API-Key": this.auth.secretToken || "" },
189
- };
190
- return this.fetch(this.auth.endpoint + url, options);
191
- });
192
- }
193
- postSessionTokenRefresh() {
194
- return __awaiter(this, void 0, void 0, function* () {
195
- if (this.auth === undefined) {
196
- throw new Error("missing auth");
197
- }
198
- const url = `/v1/session-token/refresh`;
199
- const options = {
200
- method: "POST",
201
- headers: { "X-API-Key": this.auth.secretToken || "" },
202
- };
203
- return this.fetch(this.auth.endpoint + url, options);
204
- });
205
- }
206
- }
1
+ // WARNING: This file was auto generated by the code in web-rnd/tygen.
2
+ // Do not commit manual changes to this file.
3
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
4
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
5
+ return new (P || (P = Promise))(function (resolve, reject) {
6
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
7
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
8
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
9
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
10
+ });
11
+ };
12
+ export class APIError extends Error {
13
+ }
14
+ export class CatalogueAPI {
15
+ hasFeature(feature) {
16
+ return this.auth !== undefined && this.auth.apiSession.features !== undefined && this.auth.apiSession.features.indexOf(feature) > -1;
17
+ }
18
+ fetch(url, options) {
19
+ return __awaiter(this, void 0, void 0, function* () {
20
+ let response;
21
+ let body;
22
+ let err;
23
+ if (options.method === "POST" && options.body) {
24
+ options.headers["Content-Type"] = "application/json;charset=utf-8";
25
+ }
26
+ try {
27
+ response = yield fetch(url, options);
28
+ body = yield response.text();
29
+ const parsed = JSON.parse(body);
30
+ if ("error" in parsed) {
31
+ err = new APIError(parsed.error);
32
+ err.body = body;
33
+ err.status = response.status;
34
+ err.parsed = parsed;
35
+ }
36
+ else {
37
+ return parsed;
38
+ }
39
+ }
40
+ catch (e) {
41
+ const msg = e instanceof Error ? e.message : `${e}`;
42
+ err = new APIError(msg);
43
+ err.body = body;
44
+ err.status = response && response.status;
45
+ err.error = e instanceof Error ? e : Error(e);
46
+ }
47
+ throw err;
48
+ });
49
+ }
50
+ postPublicAccessTokenAuthorize(params, endpoint) {
51
+ return __awaiter(this, void 0, void 0, function* () {
52
+ const url = `/v1/access-token/public/${encodeURIComponent(params.accessTokenId)}/authorize`;
53
+ const options = {
54
+ method: "POST",
55
+ headers: {},
56
+ };
57
+ return this.fetch(endpoint + url, options);
58
+ });
59
+ }
60
+ getApplicationAreas(params) {
61
+ return __awaiter(this, void 0, void 0, function* () {
62
+ if (this.auth === undefined) {
63
+ throw new Error("missing auth");
64
+ }
65
+ const url = `/v1/catalogue/${encodeURIComponent(params.lang)}/${encodeURIComponent(params.enterprise)}/${encodeURIComponent(params.prdCat)}/${encodeURIComponent(params.prdCatVersion)}/${encodeURIComponent(params.vendor)}/${encodeURIComponent(params.priceList)}/application-areas`;
66
+ const options = {
67
+ method: "GET",
68
+ headers: { "X-API-Key": this.auth.secretToken || "" },
69
+ };
70
+ return this.fetch(this.auth.endpoint + url, options);
71
+ });
72
+ }
73
+ postExport(params, body) {
74
+ return __awaiter(this, void 0, void 0, function* () {
75
+ if (this.auth === undefined) {
76
+ throw new Error("missing auth");
77
+ }
78
+ const url = `/v1/catalogue/${encodeURIComponent(params.lang)}/${encodeURIComponent(params.enterprise)}/${encodeURIComponent(params.prdCat)}/${encodeURIComponent(params.prdCatVersion)}/${encodeURIComponent(params.vendor)}/${encodeURIComponent(params.priceList)}/export/${encodeURIComponent(params.partNumber)}`;
79
+ const options = {
80
+ method: "POST",
81
+ headers: { "X-API-Key": this.auth.secretToken || "" },
82
+ body: JSON.stringify(body),
83
+ };
84
+ return this.fetch(this.auth.endpoint + url, options);
85
+ });
86
+ }
87
+ getPriceLists(params) {
88
+ return __awaiter(this, void 0, void 0, function* () {
89
+ if (this.auth === undefined) {
90
+ throw new Error("missing auth");
91
+ }
92
+ const url = `/v1/catalogue/${encodeURIComponent(params.lang)}/${encodeURIComponent(params.enterprise)}/${encodeURIComponent(params.prdCat)}/${encodeURIComponent(params.prdCatVersion)}/${encodeURIComponent(params.vendor)}/${encodeURIComponent(params.priceList)}/price-lists`;
93
+ const options = {
94
+ method: "GET",
95
+ headers: { "X-API-Key": this.auth.secretToken || "" },
96
+ };
97
+ return this.fetch(this.auth.endpoint + url, options);
98
+ });
99
+ }
100
+ getProduct(params) {
101
+ return __awaiter(this, void 0, void 0, function* () {
102
+ if (this.auth === undefined) {
103
+ throw new Error("missing auth");
104
+ }
105
+ const url = `/v1/catalogue/${encodeURIComponent(params.lang)}/${encodeURIComponent(params.enterprise)}/${encodeURIComponent(params.prdCat)}/${encodeURIComponent(params.prdCatVersion)}/${encodeURIComponent(params.vendor)}/${encodeURIComponent(params.priceList)}/product-v2/${encodeURIComponent(params.partNumber)}`;
106
+ const options = {
107
+ method: "GET",
108
+ headers: { "X-API-Key": this.auth.secretToken || "" },
109
+ };
110
+ return this.fetch(this.auth.endpoint + url, options);
111
+ });
112
+ }
113
+ postRender(params, body) {
114
+ return __awaiter(this, void 0, void 0, function* () {
115
+ if (this.auth === undefined) {
116
+ throw new Error("missing auth");
117
+ }
118
+ const url = `/v1/catalogue/${encodeURIComponent(params.lang)}/${encodeURIComponent(params.enterprise)}/${encodeURIComponent(params.prdCat)}/${encodeURIComponent(params.prdCatVersion)}/${encodeURIComponent(params.vendor)}/${encodeURIComponent(params.priceList)}/product/${encodeURIComponent(params.partNumber)}/render`;
119
+ const options = {
120
+ method: "POST",
121
+ headers: { "X-API-Key": this.auth.secretToken || "" },
122
+ body: JSON.stringify(body),
123
+ };
124
+ return this.fetch(this.auth.endpoint + url, options);
125
+ });
126
+ }
127
+ postValidate(params, body) {
128
+ return __awaiter(this, void 0, void 0, function* () {
129
+ if (this.auth === undefined) {
130
+ throw new Error("missing auth");
131
+ }
132
+ const url = `/v1/catalogue/${encodeURIComponent(params.lang)}/${encodeURIComponent(params.enterprise)}/${encodeURIComponent(params.prdCat)}/${encodeURIComponent(params.prdCatVersion)}/${encodeURIComponent(params.vendor)}/${encodeURIComponent(params.priceList)}/product/${encodeURIComponent(params.partNumber)}/validate`;
133
+ const options = {
134
+ method: "POST",
135
+ headers: { "X-API-Key": this.auth.secretToken || "" },
136
+ body: JSON.stringify(body),
137
+ };
138
+ return this.fetch(this.auth.endpoint + url, options);
139
+ });
140
+ }
141
+ getTocTree(params) {
142
+ return __awaiter(this, void 0, void 0, function* () {
143
+ if (this.auth === undefined) {
144
+ throw new Error("missing auth");
145
+ }
146
+ const url = `/v1/catalogue/${encodeURIComponent(params.lang)}/${encodeURIComponent(params.enterprise)}/${encodeURIComponent(params.prdCat)}/${encodeURIComponent(params.prdCatVersion)}/${encodeURIComponent(params.vendor)}/${encodeURIComponent(params.priceList)}/toc`;
147
+ const options = {
148
+ method: "GET",
149
+ headers: { "X-API-Key": this.auth.secretToken || "" },
150
+ };
151
+ return this.fetch(this.auth.endpoint + url, options);
152
+ });
153
+ }
154
+ getTocFlat(params) {
155
+ return __awaiter(this, void 0, void 0, function* () {
156
+ if (this.auth === undefined) {
157
+ throw new Error("missing auth");
158
+ }
159
+ const url = `/v1/catalogue/${encodeURIComponent(params.lang)}/${encodeURIComponent(params.enterprise)}/${encodeURIComponent(params.prdCat)}/${encodeURIComponent(params.prdCatVersion)}/${encodeURIComponent(params.vendor)}/${encodeURIComponent(params.priceList)}/toc/flat`;
160
+ const options = {
161
+ method: "GET",
162
+ headers: { "X-API-Key": this.auth.secretToken || "" },
163
+ };
164
+ return this.fetch(this.auth.endpoint + url, options);
165
+ });
166
+ }
167
+ getExportById(params) {
168
+ return __awaiter(this, void 0, void 0, function* () {
169
+ if (this.auth === undefined) {
170
+ throw new Error("missing auth");
171
+ }
172
+ const url = `/v1/export/${encodeURIComponent(params.uuid)}`;
173
+ const options = {
174
+ method: "GET",
175
+ headers: { "X-API-Key": this.auth.secretToken || "" },
176
+ };
177
+ return this.fetch(this.auth.endpoint + url, options);
178
+ });
179
+ }
180
+ getRenderById(params) {
181
+ return __awaiter(this, void 0, void 0, function* () {
182
+ if (this.auth === undefined) {
183
+ throw new Error("missing auth");
184
+ }
185
+ const url = `/v1/render/${encodeURIComponent(params.uuid)}`;
186
+ const options = {
187
+ method: "GET",
188
+ headers: { "X-API-Key": this.auth.secretToken || "" },
189
+ };
190
+ return this.fetch(this.auth.endpoint + url, options);
191
+ });
192
+ }
193
+ postSessionTokenRefresh() {
194
+ return __awaiter(this, void 0, void 0, function* () {
195
+ if (this.auth === undefined) {
196
+ throw new Error("missing auth");
197
+ }
198
+ const url = `/v1/session-token/refresh`;
199
+ const options = {
200
+ method: "POST",
201
+ headers: { "X-API-Key": this.auth.secretToken || "" },
202
+ };
203
+ return this.fetch(this.auth.endpoint + url, options);
204
+ });
205
+ }
206
+ }