@configura/web-api 1.3.0-alpha.3 → 1.3.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/LICENSE +201 -201
- package/README.md +1 -1
- package/dist/CatalogueAPI.d.ts +502 -448
- package/dist/CatalogueAPI.js +206 -206
- package/dist/CfgMeasure.d.ts +33 -0
- package/dist/CfgMeasure.js +30 -0
- package/dist/CfgProduct.d.ts +217 -116
- package/dist/CfgProduct.js +634 -588
- package/dist/index.d.ts +16 -15
- package/dist/index.js +16 -15
- package/dist/material/CfgMaterialMapping.d.ts +7 -7
- package/dist/material/CfgMaterialMapping.js +181 -176
- 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 +160 -134
- package/dist/productConfiguration/CfgFeature.js +593 -483
- package/dist/productConfiguration/CfgOption.d.ts +128 -112
- package/dist/productConfiguration/CfgOption.js +394 -293
- package/dist/productConfiguration/CfgProductConfiguration.d.ts +120 -50
- package/dist/productConfiguration/CfgProductConfiguration.js +307 -198
- package/dist/productConfiguration/filters.d.ts +7 -7
- package/dist/productConfiguration/filters.js +29 -29
- package/dist/productConfiguration/productParamsGenerator.d.ts +15 -15
- package/dist/productConfiguration/productParamsGenerator.js +51 -51
- package/dist/productConfiguration/utilitiesProductConfiguration.d.ts +17 -9
- package/dist/productConfiguration/utilitiesProductConfiguration.js +80 -61
- package/dist/productLoader.d.ts +33 -11
- package/dist/productLoader.js +49 -41
- package/dist/tests/testData/collectorForTest.d.ts +73 -73
- package/dist/tests/testData/collectorForTest.js +195 -195
- package/dist/tests/testData/dummyProductForTest.d.ts +4 -4
- package/dist/tests/testData/dummyProductForTest.js +36 -35
- package/dist/tests/testData/testDataAdditionalProductInAdditionalProductInProductForTest.d.ts +32 -32
- package/dist/tests/testData/testDataAdditionalProductInAdditionalProductInProductForTest.js +381 -368
- package/dist/tests/testData/testDataCachedGetProduct.d.ts +5 -5
- package/dist/tests/testData/testDataCachedGetProduct.js +205 -199
- package/dist/tests/testData/testDataCachedPostValidate.d.ts +7 -7
- package/dist/tests/testData/testDataCachedPostValidate.js +195 -189
- package/dist/tests/testData/testDataNoAdditionalProductNoPropagateForTest.d.ts +3 -3
- package/dist/tests/testData/testDataNoAdditionalProductNoPropagateForTest.js +1119 -1117
- package/dist/tests/testData/testDataProductAggregatedPrice.d.ts +28 -28
- package/dist/tests/testData/testDataProductAggregatedPrice.js +210 -205
- package/dist/tests/testData/testDataUpcharge.d.ts +29 -29
- package/dist/tests/testData/testDataUpcharge.js +163 -159
- package/dist/utilitiesCatalogueData.d.ts +22 -20
- package/dist/utilitiesCatalogueData.js +64 -64
- package/dist/utilitiesCataloguePermission.d.ts +39 -39
- package/dist/utilitiesCataloguePermission.js +84 -84
- package/dist/utilitiesNumericValues.d.ts +25 -0
- package/dist/utilitiesNumericValues.js +109 -0
- package/package.json +3 -3
package/dist/CatalogueAPI.js
CHANGED
|
@@ -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/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
|
-
}
|
|
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
|
+
}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { Measurement, ValueWithUnit } from "./CatalogueAPI";
|
|
2
|
+
/**
|
|
3
|
+
* Measures can be used to Anchor items (Models or Additional Products).
|
|
4
|
+
*
|
|
5
|
+
* Measures originates in Models, and can then be used in Products. There is nothing stopping
|
|
6
|
+
* having multiple Models in the same Product that use the same Measure name. If so it is ambiguous
|
|
7
|
+
* which of the Models in the Product to anchor to.
|
|
8
|
+
*
|
|
9
|
+
* Measure Priority tries to solve this by allowing MeasureParams to contain an ordered list
|
|
10
|
+
* containing which Model should have highest priority (i.e. gets "first dibs") when Anchoring.
|
|
11
|
+
*
|
|
12
|
+
* Unfortunately the solution is currently a bit limited - we can not differentiate between Models
|
|
13
|
+
* pointing to the same URL in a Product. However, we consistently pick the first one.
|
|
14
|
+
* Lower index = higher priority
|
|
15
|
+
*/
|
|
16
|
+
export declare type CfgMeasurePriority = {
|
|
17
|
+
index: number;
|
|
18
|
+
modelLocalFilePath: string;
|
|
19
|
+
};
|
|
20
|
+
/**
|
|
21
|
+
* This class strips the Measurement of things that are not actually used or relevant
|
|
22
|
+
* to Stage, specifically anchoring and stretching. Measurments can also contain
|
|
23
|
+
* volume and area, but these are ignored. Here Measures are used to define defaults
|
|
24
|
+
* such as its preferences when dealing with ambiguity or its default value.
|
|
25
|
+
*/
|
|
26
|
+
export declare class CfgMeasureDefinition {
|
|
27
|
+
readonly measureParamCode: string;
|
|
28
|
+
readonly numericValue: ValueWithUnit | undefined;
|
|
29
|
+
readonly measurePriorities: CfgMeasurePriority[];
|
|
30
|
+
static make(measurement: Measurement): CfgMeasureDefinition | undefined;
|
|
31
|
+
private constructor();
|
|
32
|
+
}
|
|
33
|
+
//# sourceMappingURL=CfgMeasure.d.ts.map
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This class strips the Measurement of things that are not actually used or relevant
|
|
3
|
+
* to Stage, specifically anchoring and stretching. Measurments can also contain
|
|
4
|
+
* volume and area, but these are ignored. Here Measures are used to define defaults
|
|
5
|
+
* such as its preferences when dealing with ambiguity or its default value.
|
|
6
|
+
*/
|
|
7
|
+
export class CfgMeasureDefinition {
|
|
8
|
+
constructor(measureParamCode, numericValue, measurePriorities) {
|
|
9
|
+
this.measureParamCode = measureParamCode;
|
|
10
|
+
this.numericValue = numericValue;
|
|
11
|
+
this.measurePriorities = measurePriorities;
|
|
12
|
+
}
|
|
13
|
+
static make(measurement) {
|
|
14
|
+
// The measurement.code seems to be used in CET to connect the value to
|
|
15
|
+
// pre-existing fields in the product, such as width, height and depth.
|
|
16
|
+
// We however only use this for anchoring and stretching and so it is the
|
|
17
|
+
// code of the measureParam that is relevant. Hence Measurements with no
|
|
18
|
+
// measureParam are ignored.
|
|
19
|
+
var _a;
|
|
20
|
+
const measureParam = measurement.measureParam;
|
|
21
|
+
if (measureParam === undefined) {
|
|
22
|
+
return undefined;
|
|
23
|
+
}
|
|
24
|
+
const code = measureParam.code;
|
|
25
|
+
return new this(code, measurement.numericValue, ((_a = measureParam.measurePriority) !== null && _a !== void 0 ? _a : []).map((p, index) => ({
|
|
26
|
+
modelLocalFilePath: p.url,
|
|
27
|
+
index,
|
|
28
|
+
})));
|
|
29
|
+
}
|
|
30
|
+
}
|