@configura/web-api 2.1.0-alpha.2 → 2.1.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.
- package/.eslintrc.json +5 -5
- package/LICENSE +201 -201
- package/README.md +1 -1
- package/dist/CatalogueAPI.d.ts +633 -633
- package/dist/CatalogueAPI.js +329 -329
- package/dist/CfgMeasure.d.ts +32 -32
- package/dist/CfgMeasure.js +30 -30
- package/dist/CfgProduct.d.ts +344 -344
- package/dist/CfgProduct.js +990 -990
- package/dist/CfgReferencePathHelper.d.ts +26 -26
- package/dist/CfgReferencePathHelper.js +26 -26
- package/dist/index.d.ts +24 -24
- package/dist/index.js +24 -24
- package/dist/io/CfgHistoryManager.d.ts +83 -83
- package/dist/io/CfgHistoryManager.js +144 -144
- package/dist/io/CfgHistoryToProdConfConnector.d.ts +21 -21
- package/dist/io/CfgHistoryToProdConfConnector.js +50 -50
- package/dist/io/CfgIOManager.d.ts +53 -53
- package/dist/io/CfgIOManager.js +134 -134
- package/dist/io/CfgIOProdConfConnector.d.ts +54 -54
- package/dist/io/CfgIOProdConfConnector.js +137 -137
- package/dist/io/CfgIOWarningSupplier.d.ts +3 -3
- package/dist/io/CfgIOWarningSupplier.js +1 -1
- package/dist/io/CfgObservableStateManager.d.ts +25 -25
- package/dist/io/CfgObservableStateManager.js +69 -69
- package/dist/io/CfgObservableStateToProdConfConnector.d.ts +15 -15
- package/dist/io/CfgObservableStateToProdConfConnector.js +17 -17
- package/dist/io/CfgWindowEventManager.d.ts +21 -21
- package/dist/io/CfgWindowEventManager.js +38 -38
- package/dist/io/CfgWindowMessageManager.d.ts +40 -40
- package/dist/io/CfgWindowMessageManager.js +91 -91
- package/dist/io/CfgWindowMessageToProdConfConnector.d.ts +17 -17
- package/dist/io/CfgWindowMessageToProdConfConnector.js +19 -19
- package/dist/io/index.d.ts +8 -8
- package/dist/io/index.js +8 -8
- 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 +199 -199
- package/dist/productConfiguration/CfgFeature.js +691 -691
- package/dist/productConfiguration/CfgOption.d.ts +160 -160
- package/dist/productConfiguration/CfgOption.js +464 -464
- package/dist/productConfiguration/CfgProductConfiguration.d.ts +129 -129
- package/dist/productConfiguration/CfgProductConfiguration.js +346 -346
- package/dist/productConfiguration/filters.d.ts +17 -17
- package/dist/productConfiguration/filters.js +141 -141
- 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 +87 -87
- 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 +47 -47
- package/dist/syncGroups/SyncGroupsHandler.js +370 -370
- package/dist/syncGroups/SyncGroupsPathHelper.d.ts +26 -26
- package/dist/syncGroups/SyncGroupsPathHelper.js +90 -90
- package/dist/syncGroups/SyncGroupsState.d.ts +39 -39
- package/dist/syncGroups/SyncGroupsState.js +167 -167
- package/dist/syncGroups/SyncGroupsTransaction.d.ts +154 -154
- package/dist/syncGroups/SyncGroupsTransaction.js +589 -589
- package/dist/tasks/TaskHandler.d.ts +77 -77
- package/dist/tasks/TaskHandler.js +276 -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 -32
- package/dist/tests/testData/testDataAdditionalProductInAdditionalProductInProductForTest.d.ts +11 -11
- package/dist/tests/testData/testDataAdditionalProductInAdditionalProductInProductForTest.js +282 -282
- package/dist/tests/testData/testDataCachedGetProduct.d.ts +5 -5
- package/dist/tests/testData/testDataCachedGetProduct.js +187 -187
- package/dist/tests/testData/testDataCachedPostValidate.d.ts +7 -7
- package/dist/tests/testData/testDataCachedPostValidate.js +185 -185
- package/dist/tests/testData/testDataConstraints.d.ts +3 -3
- package/dist/tests/testData/testDataConstraints.js +174 -174
- 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 +189 -189
- package/dist/tests/testData/testDataUpcharge.d.ts +8 -8
- package/dist/tests/testData/testDataUpcharge.js +121 -121
- package/dist/utilitiesCatalogueData.d.ts +47 -47
- package/dist/utilitiesCatalogueData.js +180 -180
- package/dist/utilitiesCataloguePermission.d.ts +38 -38
- package/dist/utilitiesCataloguePermission.js +79 -79
- package/dist/utilitiesConfiguration.d.ts +28 -28
- package/dist/utilitiesConfiguration.js +200 -200
- package/dist/utilitiesNumericValues.d.ts +24 -24
- package/dist/utilitiesNumericValues.js +114 -114
- package/package.json +3 -3
package/dist/CatalogueAPI.js
CHANGED
|
@@ -1,329 +1,329 @@
|
|
|
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 const dtoExportFormatNames = [
|
|
13
|
-
"glb",
|
|
14
|
-
"gltf",
|
|
15
|
-
"fbx",
|
|
16
|
-
"dwg",
|
|
17
|
-
"cmdrw",
|
|
18
|
-
"cmfav",
|
|
19
|
-
"cmsym",
|
|
20
|
-
];
|
|
21
|
-
export const dtoExportStatusStatusNames = [
|
|
22
|
-
"pending",
|
|
23
|
-
"running",
|
|
24
|
-
"finished",
|
|
25
|
-
"failed",
|
|
26
|
-
];
|
|
27
|
-
export const dtoNoteSeverityNames = ["Information", "Critical", "Warning"];
|
|
28
|
-
export const dtoRenderFormatNames = ["jpg", "png"];
|
|
29
|
-
export const dtoRenderStatusStatusNames = [
|
|
30
|
-
"pending",
|
|
31
|
-
"running",
|
|
32
|
-
"finished",
|
|
33
|
-
"failed",
|
|
34
|
-
];
|
|
35
|
-
export const dtoSyncGroupMethodsNames = ["pull", "push", "twoWay"];
|
|
36
|
-
export class DtoAPIError extends Error {
|
|
37
|
-
}
|
|
38
|
-
export class CatalogueAPI {
|
|
39
|
-
constructor(_fetch = window.fetch.bind(window)) {
|
|
40
|
-
this._fetch = _fetch;
|
|
41
|
-
}
|
|
42
|
-
// For internal use
|
|
43
|
-
_saveAlternativeReferer() {
|
|
44
|
-
if (typeof document === "undefined") {
|
|
45
|
-
return;
|
|
46
|
-
}
|
|
47
|
-
const parts = new RegExp("^(http[s]?:\\/\\/[^:\\/\\s]+)", "i").exec(document.referrer);
|
|
48
|
-
if (parts !== null) {
|
|
49
|
-
this._alternativeReferer = parts[1];
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
hasFeature(feature) {
|
|
53
|
-
return (this.auth !== undefined &&
|
|
54
|
-
this.auth.apiSession.features !== undefined &&
|
|
55
|
-
this.auth.apiSession.features.indexOf(feature) > -1);
|
|
56
|
-
}
|
|
57
|
-
fetch(url, options) {
|
|
58
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
59
|
-
let response;
|
|
60
|
-
let body;
|
|
61
|
-
let err;
|
|
62
|
-
if (options.method === "POST" && options.body) {
|
|
63
|
-
options.headers["Content-Type"] = "application/json;charset=utf-8";
|
|
64
|
-
}
|
|
65
|
-
try {
|
|
66
|
-
response = yield this._fetch(url, options);
|
|
67
|
-
body = yield response.text();
|
|
68
|
-
const parsed = JSON.parse(body);
|
|
69
|
-
if ("error" in parsed) {
|
|
70
|
-
err = new DtoAPIError(parsed.error);
|
|
71
|
-
err.body = body;
|
|
72
|
-
err.status = response.status;
|
|
73
|
-
err.parsed = parsed;
|
|
74
|
-
}
|
|
75
|
-
else {
|
|
76
|
-
return parsed;
|
|
77
|
-
}
|
|
78
|
-
}
|
|
79
|
-
catch (e) {
|
|
80
|
-
const msg = e instanceof Error ? e.message : `${e}`;
|
|
81
|
-
err = new DtoAPIError(msg);
|
|
82
|
-
err.body = body;
|
|
83
|
-
err.status = response && response.status;
|
|
84
|
-
err.error = e instanceof Error ? e : Error(msg);
|
|
85
|
-
}
|
|
86
|
-
throw err;
|
|
87
|
-
});
|
|
88
|
-
}
|
|
89
|
-
postPublicAccessTokenAuthorize(params, endpoint) {
|
|
90
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
91
|
-
const url = `/v1/access-token/public/${encodeURIComponent(params.accessTokenId)}/authorize`;
|
|
92
|
-
const options = {
|
|
93
|
-
method: "POST",
|
|
94
|
-
headers: {},
|
|
95
|
-
};
|
|
96
|
-
if (this._alternativeReferer) {
|
|
97
|
-
options.headers["Alternative-Referer"] = this._alternativeReferer;
|
|
98
|
-
}
|
|
99
|
-
return this.fetch(endpoint + url, options);
|
|
100
|
-
});
|
|
101
|
-
}
|
|
102
|
-
getApplicationAreas(params) {
|
|
103
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
104
|
-
if (this.auth === undefined) {
|
|
105
|
-
throw new Error("missing auth");
|
|
106
|
-
}
|
|
107
|
-
const url = `/v1/catalogue/${encodeURIComponent(params.lang)}/${encodeURIComponent(params.enterprise)}/${encodeURIComponent(params.prdCat)}/${encodeURIComponent(params.prdCatVersion)}/${encodeURIComponent(params.vendor)}/${encodeURIComponent(params.priceList)}/application-areas`;
|
|
108
|
-
const options = {
|
|
109
|
-
method: "GET",
|
|
110
|
-
headers: { "X-API-Key": this.auth.secretToken || "" },
|
|
111
|
-
};
|
|
112
|
-
if (this._alternativeReferer) {
|
|
113
|
-
options.headers["Alternative-Referer"] = this._alternativeReferer;
|
|
114
|
-
}
|
|
115
|
-
return this.fetch(this.auth.endpoint + url, options);
|
|
116
|
-
});
|
|
117
|
-
}
|
|
118
|
-
postExport(params, body) {
|
|
119
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
120
|
-
if (this.auth === undefined) {
|
|
121
|
-
throw new Error("missing auth");
|
|
122
|
-
}
|
|
123
|
-
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)}`;
|
|
124
|
-
const options = {
|
|
125
|
-
method: "POST",
|
|
126
|
-
headers: { "X-API-Key": this.auth.secretToken || "" },
|
|
127
|
-
body: JSON.stringify(body),
|
|
128
|
-
};
|
|
129
|
-
if (this._alternativeReferer) {
|
|
130
|
-
options.headers["Alternative-Referer"] = this._alternativeReferer;
|
|
131
|
-
}
|
|
132
|
-
return this.fetch(this.auth.endpoint + url, options);
|
|
133
|
-
});
|
|
134
|
-
}
|
|
135
|
-
getPriceLists(params) {
|
|
136
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
137
|
-
if (this.auth === undefined) {
|
|
138
|
-
throw new Error("missing auth");
|
|
139
|
-
}
|
|
140
|
-
const url = `/v1/catalogue/${encodeURIComponent(params.lang)}/${encodeURIComponent(params.enterprise)}/${encodeURIComponent(params.prdCat)}/${encodeURIComponent(params.prdCatVersion)}/${encodeURIComponent(params.vendor)}/${encodeURIComponent(params.priceList)}/price-lists`;
|
|
141
|
-
const options = {
|
|
142
|
-
method: "GET",
|
|
143
|
-
headers: { "X-API-Key": this.auth.secretToken || "" },
|
|
144
|
-
};
|
|
145
|
-
if (this._alternativeReferer) {
|
|
146
|
-
options.headers["Alternative-Referer"] = this._alternativeReferer;
|
|
147
|
-
}
|
|
148
|
-
return this.fetch(this.auth.endpoint + url, options);
|
|
149
|
-
});
|
|
150
|
-
}
|
|
151
|
-
getProductLegacyV2(params) {
|
|
152
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
153
|
-
if (this.auth === undefined) {
|
|
154
|
-
throw new Error("missing auth");
|
|
155
|
-
}
|
|
156
|
-
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)}`;
|
|
157
|
-
const options = {
|
|
158
|
-
method: "GET",
|
|
159
|
-
headers: { "X-API-Key": this.auth.secretToken || "" },
|
|
160
|
-
};
|
|
161
|
-
if (this._alternativeReferer) {
|
|
162
|
-
options.headers["Alternative-Referer"] = this._alternativeReferer;
|
|
163
|
-
}
|
|
164
|
-
return this.fetch(this.auth.endpoint + url, options);
|
|
165
|
-
});
|
|
166
|
-
}
|
|
167
|
-
getProduct(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/catalogue/${encodeURIComponent(params.lang)}/${encodeURIComponent(params.enterprise)}/${encodeURIComponent(params.prdCat)}/${encodeURIComponent(params.prdCatVersion)}/${encodeURIComponent(params.vendor)}/${encodeURIComponent(params.priceList)}/product-v3/${encodeURIComponent(params.partNumber)}`;
|
|
173
|
-
const options = {
|
|
174
|
-
method: "GET",
|
|
175
|
-
headers: { "X-API-Key": this.auth.secretToken || "" },
|
|
176
|
-
};
|
|
177
|
-
if (this._alternativeReferer) {
|
|
178
|
-
options.headers["Alternative-Referer"] = this._alternativeReferer;
|
|
179
|
-
}
|
|
180
|
-
return this.fetch(this.auth.endpoint + url, options);
|
|
181
|
-
});
|
|
182
|
-
}
|
|
183
|
-
postRender(params, body) {
|
|
184
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
185
|
-
if (this.auth === undefined) {
|
|
186
|
-
throw new Error("missing auth");
|
|
187
|
-
}
|
|
188
|
-
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`;
|
|
189
|
-
const options = {
|
|
190
|
-
method: "POST",
|
|
191
|
-
headers: { "X-API-Key": this.auth.secretToken || "" },
|
|
192
|
-
body: JSON.stringify(body),
|
|
193
|
-
};
|
|
194
|
-
if (this._alternativeReferer) {
|
|
195
|
-
options.headers["Alternative-Referer"] = this._alternativeReferer;
|
|
196
|
-
}
|
|
197
|
-
return this.fetch(this.auth.endpoint + url, options);
|
|
198
|
-
});
|
|
199
|
-
}
|
|
200
|
-
postValidateLegacyV1(params, body) {
|
|
201
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
202
|
-
if (this.auth === undefined) {
|
|
203
|
-
throw new Error("missing auth");
|
|
204
|
-
}
|
|
205
|
-
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`;
|
|
206
|
-
const options = {
|
|
207
|
-
method: "POST",
|
|
208
|
-
headers: { "X-API-Key": this.auth.secretToken || "" },
|
|
209
|
-
body: JSON.stringify(body),
|
|
210
|
-
};
|
|
211
|
-
if (this._alternativeReferer) {
|
|
212
|
-
options.headers["Alternative-Referer"] = this._alternativeReferer;
|
|
213
|
-
}
|
|
214
|
-
return this.fetch(this.auth.endpoint + url, options);
|
|
215
|
-
});
|
|
216
|
-
}
|
|
217
|
-
postValidate(params, body) {
|
|
218
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
219
|
-
if (this.auth === undefined) {
|
|
220
|
-
throw new Error("missing auth");
|
|
221
|
-
}
|
|
222
|
-
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-v2`;
|
|
223
|
-
const options = {
|
|
224
|
-
method: "POST",
|
|
225
|
-
headers: { "X-API-Key": this.auth.secretToken || "" },
|
|
226
|
-
body: JSON.stringify(body),
|
|
227
|
-
};
|
|
228
|
-
if (this._alternativeReferer) {
|
|
229
|
-
options.headers["Alternative-Referer"] = this._alternativeReferer;
|
|
230
|
-
}
|
|
231
|
-
return this.fetch(this.auth.endpoint + url, options);
|
|
232
|
-
});
|
|
233
|
-
}
|
|
234
|
-
getTocTree(params) {
|
|
235
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
236
|
-
if (this.auth === undefined) {
|
|
237
|
-
throw new Error("missing auth");
|
|
238
|
-
}
|
|
239
|
-
const url = `/v1/catalogue/${encodeURIComponent(params.lang)}/${encodeURIComponent(params.enterprise)}/${encodeURIComponent(params.prdCat)}/${encodeURIComponent(params.prdCatVersion)}/${encodeURIComponent(params.vendor)}/${encodeURIComponent(params.priceList)}/toc`;
|
|
240
|
-
const options = {
|
|
241
|
-
method: "GET",
|
|
242
|
-
headers: { "X-API-Key": this.auth.secretToken || "" },
|
|
243
|
-
};
|
|
244
|
-
if (this._alternativeReferer) {
|
|
245
|
-
options.headers["Alternative-Referer"] = this._alternativeReferer;
|
|
246
|
-
}
|
|
247
|
-
return this.fetch(this.auth.endpoint + url, options);
|
|
248
|
-
});
|
|
249
|
-
}
|
|
250
|
-
getTocFlat(params) {
|
|
251
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
252
|
-
if (this.auth === undefined) {
|
|
253
|
-
throw new Error("missing auth");
|
|
254
|
-
}
|
|
255
|
-
const url = `/v1/catalogue/${encodeURIComponent(params.lang)}/${encodeURIComponent(params.enterprise)}/${encodeURIComponent(params.prdCat)}/${encodeURIComponent(params.prdCatVersion)}/${encodeURIComponent(params.vendor)}/${encodeURIComponent(params.priceList)}/toc/flat`;
|
|
256
|
-
const options = {
|
|
257
|
-
method: "GET",
|
|
258
|
-
headers: { "X-API-Key": this.auth.secretToken || "" },
|
|
259
|
-
};
|
|
260
|
-
if (this._alternativeReferer) {
|
|
261
|
-
options.headers["Alternative-Referer"] = this._alternativeReferer;
|
|
262
|
-
}
|
|
263
|
-
return this.fetch(this.auth.endpoint + url, options);
|
|
264
|
-
});
|
|
265
|
-
}
|
|
266
|
-
getExportById(params) {
|
|
267
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
268
|
-
if (this.auth === undefined) {
|
|
269
|
-
throw new Error("missing auth");
|
|
270
|
-
}
|
|
271
|
-
const url = `/v1/export/${encodeURIComponent(params.uuid)}`;
|
|
272
|
-
const options = {
|
|
273
|
-
method: "GET",
|
|
274
|
-
headers: { "X-API-Key": this.auth.secretToken || "" },
|
|
275
|
-
};
|
|
276
|
-
if (this._alternativeReferer) {
|
|
277
|
-
options.headers["Alternative-Referer"] = this._alternativeReferer;
|
|
278
|
-
}
|
|
279
|
-
return this.fetch(this.auth.endpoint + url, options);
|
|
280
|
-
});
|
|
281
|
-
}
|
|
282
|
-
getRenderById(params) {
|
|
283
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
284
|
-
if (this.auth === undefined) {
|
|
285
|
-
throw new Error("missing auth");
|
|
286
|
-
}
|
|
287
|
-
const url = `/v1/render/${encodeURIComponent(params.uuid)}`;
|
|
288
|
-
const options = {
|
|
289
|
-
method: "GET",
|
|
290
|
-
headers: { "X-API-Key": this.auth.secretToken || "" },
|
|
291
|
-
};
|
|
292
|
-
if (this._alternativeReferer) {
|
|
293
|
-
options.headers["Alternative-Referer"] = this._alternativeReferer;
|
|
294
|
-
}
|
|
295
|
-
return this.fetch(this.auth.endpoint + url, options);
|
|
296
|
-
});
|
|
297
|
-
}
|
|
298
|
-
postSessionTokenRefresh() {
|
|
299
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
300
|
-
if (this.auth === undefined) {
|
|
301
|
-
throw new Error("missing auth");
|
|
302
|
-
}
|
|
303
|
-
const url = `/v1/session-token/refresh`;
|
|
304
|
-
const options = {
|
|
305
|
-
method: "POST",
|
|
306
|
-
headers: { "X-API-Key": this.auth.secretToken || "" },
|
|
307
|
-
};
|
|
308
|
-
if (this._alternativeReferer) {
|
|
309
|
-
options.headers["Alternative-Referer"] = this._alternativeReferer;
|
|
310
|
-
}
|
|
311
|
-
return this.fetch(this.auth.endpoint + url, options);
|
|
312
|
-
});
|
|
313
|
-
}
|
|
314
|
-
}
|
|
315
|
-
export const DTO_OPERATION_ID_TO_DEBIT_GROUP = {
|
|
316
|
-
postPublicAccessTokenAuthorize: "base",
|
|
317
|
-
getApplicationAreas: "base",
|
|
318
|
-
postExport: "export",
|
|
319
|
-
getPriceLists: "base",
|
|
320
|
-
getProductLegacyV2: "base",
|
|
321
|
-
getProduct: "base",
|
|
322
|
-
postRender: "render",
|
|
323
|
-
postValidateLegacyV1: "base",
|
|
324
|
-
postValidate: "base",
|
|
325
|
-
getTocTree: "base",
|
|
326
|
-
getTocFlat: "base",
|
|
327
|
-
getExportById: "base",
|
|
328
|
-
getRenderById: "base",
|
|
329
|
-
};
|
|
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 const dtoExportFormatNames = [
|
|
13
|
+
"glb",
|
|
14
|
+
"gltf",
|
|
15
|
+
"fbx",
|
|
16
|
+
"dwg",
|
|
17
|
+
"cmdrw",
|
|
18
|
+
"cmfav",
|
|
19
|
+
"cmsym",
|
|
20
|
+
];
|
|
21
|
+
export const dtoExportStatusStatusNames = [
|
|
22
|
+
"pending",
|
|
23
|
+
"running",
|
|
24
|
+
"finished",
|
|
25
|
+
"failed",
|
|
26
|
+
];
|
|
27
|
+
export const dtoNoteSeverityNames = ["Information", "Critical", "Warning"];
|
|
28
|
+
export const dtoRenderFormatNames = ["jpg", "png"];
|
|
29
|
+
export const dtoRenderStatusStatusNames = [
|
|
30
|
+
"pending",
|
|
31
|
+
"running",
|
|
32
|
+
"finished",
|
|
33
|
+
"failed",
|
|
34
|
+
];
|
|
35
|
+
export const dtoSyncGroupMethodsNames = ["pull", "push", "twoWay"];
|
|
36
|
+
export class DtoAPIError extends Error {
|
|
37
|
+
}
|
|
38
|
+
export class CatalogueAPI {
|
|
39
|
+
constructor(_fetch = window.fetch.bind(window)) {
|
|
40
|
+
this._fetch = _fetch;
|
|
41
|
+
}
|
|
42
|
+
// For internal use
|
|
43
|
+
_saveAlternativeReferer() {
|
|
44
|
+
if (typeof document === "undefined") {
|
|
45
|
+
return;
|
|
46
|
+
}
|
|
47
|
+
const parts = new RegExp("^(http[s]?:\\/\\/[^:\\/\\s]+)", "i").exec(document.referrer);
|
|
48
|
+
if (parts !== null) {
|
|
49
|
+
this._alternativeReferer = parts[1];
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
hasFeature(feature) {
|
|
53
|
+
return (this.auth !== undefined &&
|
|
54
|
+
this.auth.apiSession.features !== undefined &&
|
|
55
|
+
this.auth.apiSession.features.indexOf(feature) > -1);
|
|
56
|
+
}
|
|
57
|
+
fetch(url, options) {
|
|
58
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
59
|
+
let response;
|
|
60
|
+
let body;
|
|
61
|
+
let err;
|
|
62
|
+
if (options.method === "POST" && options.body) {
|
|
63
|
+
options.headers["Content-Type"] = "application/json;charset=utf-8";
|
|
64
|
+
}
|
|
65
|
+
try {
|
|
66
|
+
response = yield this._fetch(url, options);
|
|
67
|
+
body = yield response.text();
|
|
68
|
+
const parsed = JSON.parse(body);
|
|
69
|
+
if ("error" in parsed) {
|
|
70
|
+
err = new DtoAPIError(parsed.error);
|
|
71
|
+
err.body = body;
|
|
72
|
+
err.status = response.status;
|
|
73
|
+
err.parsed = parsed;
|
|
74
|
+
}
|
|
75
|
+
else {
|
|
76
|
+
return parsed;
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
catch (e) {
|
|
80
|
+
const msg = e instanceof Error ? e.message : `${e}`;
|
|
81
|
+
err = new DtoAPIError(msg);
|
|
82
|
+
err.body = body;
|
|
83
|
+
err.status = response && response.status;
|
|
84
|
+
err.error = e instanceof Error ? e : Error(msg);
|
|
85
|
+
}
|
|
86
|
+
throw err;
|
|
87
|
+
});
|
|
88
|
+
}
|
|
89
|
+
postPublicAccessTokenAuthorize(params, endpoint) {
|
|
90
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
91
|
+
const url = `/v1/access-token/public/${encodeURIComponent(params.accessTokenId)}/authorize`;
|
|
92
|
+
const options = {
|
|
93
|
+
method: "POST",
|
|
94
|
+
headers: {},
|
|
95
|
+
};
|
|
96
|
+
if (this._alternativeReferer) {
|
|
97
|
+
options.headers["Alternative-Referer"] = this._alternativeReferer;
|
|
98
|
+
}
|
|
99
|
+
return this.fetch(endpoint + url, options);
|
|
100
|
+
});
|
|
101
|
+
}
|
|
102
|
+
getApplicationAreas(params) {
|
|
103
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
104
|
+
if (this.auth === undefined) {
|
|
105
|
+
throw new Error("missing auth");
|
|
106
|
+
}
|
|
107
|
+
const url = `/v1/catalogue/${encodeURIComponent(params.lang)}/${encodeURIComponent(params.enterprise)}/${encodeURIComponent(params.prdCat)}/${encodeURIComponent(params.prdCatVersion)}/${encodeURIComponent(params.vendor)}/${encodeURIComponent(params.priceList)}/application-areas`;
|
|
108
|
+
const options = {
|
|
109
|
+
method: "GET",
|
|
110
|
+
headers: { "X-API-Key": this.auth.secretToken || "" },
|
|
111
|
+
};
|
|
112
|
+
if (this._alternativeReferer) {
|
|
113
|
+
options.headers["Alternative-Referer"] = this._alternativeReferer;
|
|
114
|
+
}
|
|
115
|
+
return this.fetch(this.auth.endpoint + url, options);
|
|
116
|
+
});
|
|
117
|
+
}
|
|
118
|
+
postExport(params, body) {
|
|
119
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
120
|
+
if (this.auth === undefined) {
|
|
121
|
+
throw new Error("missing auth");
|
|
122
|
+
}
|
|
123
|
+
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)}`;
|
|
124
|
+
const options = {
|
|
125
|
+
method: "POST",
|
|
126
|
+
headers: { "X-API-Key": this.auth.secretToken || "" },
|
|
127
|
+
body: JSON.stringify(body),
|
|
128
|
+
};
|
|
129
|
+
if (this._alternativeReferer) {
|
|
130
|
+
options.headers["Alternative-Referer"] = this._alternativeReferer;
|
|
131
|
+
}
|
|
132
|
+
return this.fetch(this.auth.endpoint + url, options);
|
|
133
|
+
});
|
|
134
|
+
}
|
|
135
|
+
getPriceLists(params) {
|
|
136
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
137
|
+
if (this.auth === undefined) {
|
|
138
|
+
throw new Error("missing auth");
|
|
139
|
+
}
|
|
140
|
+
const url = `/v1/catalogue/${encodeURIComponent(params.lang)}/${encodeURIComponent(params.enterprise)}/${encodeURIComponent(params.prdCat)}/${encodeURIComponent(params.prdCatVersion)}/${encodeURIComponent(params.vendor)}/${encodeURIComponent(params.priceList)}/price-lists`;
|
|
141
|
+
const options = {
|
|
142
|
+
method: "GET",
|
|
143
|
+
headers: { "X-API-Key": this.auth.secretToken || "" },
|
|
144
|
+
};
|
|
145
|
+
if (this._alternativeReferer) {
|
|
146
|
+
options.headers["Alternative-Referer"] = this._alternativeReferer;
|
|
147
|
+
}
|
|
148
|
+
return this.fetch(this.auth.endpoint + url, options);
|
|
149
|
+
});
|
|
150
|
+
}
|
|
151
|
+
getProductLegacyV2(params) {
|
|
152
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
153
|
+
if (this.auth === undefined) {
|
|
154
|
+
throw new Error("missing auth");
|
|
155
|
+
}
|
|
156
|
+
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)}`;
|
|
157
|
+
const options = {
|
|
158
|
+
method: "GET",
|
|
159
|
+
headers: { "X-API-Key": this.auth.secretToken || "" },
|
|
160
|
+
};
|
|
161
|
+
if (this._alternativeReferer) {
|
|
162
|
+
options.headers["Alternative-Referer"] = this._alternativeReferer;
|
|
163
|
+
}
|
|
164
|
+
return this.fetch(this.auth.endpoint + url, options);
|
|
165
|
+
});
|
|
166
|
+
}
|
|
167
|
+
getProduct(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/catalogue/${encodeURIComponent(params.lang)}/${encodeURIComponent(params.enterprise)}/${encodeURIComponent(params.prdCat)}/${encodeURIComponent(params.prdCatVersion)}/${encodeURIComponent(params.vendor)}/${encodeURIComponent(params.priceList)}/product-v3/${encodeURIComponent(params.partNumber)}`;
|
|
173
|
+
const options = {
|
|
174
|
+
method: "GET",
|
|
175
|
+
headers: { "X-API-Key": this.auth.secretToken || "" },
|
|
176
|
+
};
|
|
177
|
+
if (this._alternativeReferer) {
|
|
178
|
+
options.headers["Alternative-Referer"] = this._alternativeReferer;
|
|
179
|
+
}
|
|
180
|
+
return this.fetch(this.auth.endpoint + url, options);
|
|
181
|
+
});
|
|
182
|
+
}
|
|
183
|
+
postRender(params, body) {
|
|
184
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
185
|
+
if (this.auth === undefined) {
|
|
186
|
+
throw new Error("missing auth");
|
|
187
|
+
}
|
|
188
|
+
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`;
|
|
189
|
+
const options = {
|
|
190
|
+
method: "POST",
|
|
191
|
+
headers: { "X-API-Key": this.auth.secretToken || "" },
|
|
192
|
+
body: JSON.stringify(body),
|
|
193
|
+
};
|
|
194
|
+
if (this._alternativeReferer) {
|
|
195
|
+
options.headers["Alternative-Referer"] = this._alternativeReferer;
|
|
196
|
+
}
|
|
197
|
+
return this.fetch(this.auth.endpoint + url, options);
|
|
198
|
+
});
|
|
199
|
+
}
|
|
200
|
+
postValidateLegacyV1(params, body) {
|
|
201
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
202
|
+
if (this.auth === undefined) {
|
|
203
|
+
throw new Error("missing auth");
|
|
204
|
+
}
|
|
205
|
+
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`;
|
|
206
|
+
const options = {
|
|
207
|
+
method: "POST",
|
|
208
|
+
headers: { "X-API-Key": this.auth.secretToken || "" },
|
|
209
|
+
body: JSON.stringify(body),
|
|
210
|
+
};
|
|
211
|
+
if (this._alternativeReferer) {
|
|
212
|
+
options.headers["Alternative-Referer"] = this._alternativeReferer;
|
|
213
|
+
}
|
|
214
|
+
return this.fetch(this.auth.endpoint + url, options);
|
|
215
|
+
});
|
|
216
|
+
}
|
|
217
|
+
postValidate(params, body) {
|
|
218
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
219
|
+
if (this.auth === undefined) {
|
|
220
|
+
throw new Error("missing auth");
|
|
221
|
+
}
|
|
222
|
+
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-v2`;
|
|
223
|
+
const options = {
|
|
224
|
+
method: "POST",
|
|
225
|
+
headers: { "X-API-Key": this.auth.secretToken || "" },
|
|
226
|
+
body: JSON.stringify(body),
|
|
227
|
+
};
|
|
228
|
+
if (this._alternativeReferer) {
|
|
229
|
+
options.headers["Alternative-Referer"] = this._alternativeReferer;
|
|
230
|
+
}
|
|
231
|
+
return this.fetch(this.auth.endpoint + url, options);
|
|
232
|
+
});
|
|
233
|
+
}
|
|
234
|
+
getTocTree(params) {
|
|
235
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
236
|
+
if (this.auth === undefined) {
|
|
237
|
+
throw new Error("missing auth");
|
|
238
|
+
}
|
|
239
|
+
const url = `/v1/catalogue/${encodeURIComponent(params.lang)}/${encodeURIComponent(params.enterprise)}/${encodeURIComponent(params.prdCat)}/${encodeURIComponent(params.prdCatVersion)}/${encodeURIComponent(params.vendor)}/${encodeURIComponent(params.priceList)}/toc`;
|
|
240
|
+
const options = {
|
|
241
|
+
method: "GET",
|
|
242
|
+
headers: { "X-API-Key": this.auth.secretToken || "" },
|
|
243
|
+
};
|
|
244
|
+
if (this._alternativeReferer) {
|
|
245
|
+
options.headers["Alternative-Referer"] = this._alternativeReferer;
|
|
246
|
+
}
|
|
247
|
+
return this.fetch(this.auth.endpoint + url, options);
|
|
248
|
+
});
|
|
249
|
+
}
|
|
250
|
+
getTocFlat(params) {
|
|
251
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
252
|
+
if (this.auth === undefined) {
|
|
253
|
+
throw new Error("missing auth");
|
|
254
|
+
}
|
|
255
|
+
const url = `/v1/catalogue/${encodeURIComponent(params.lang)}/${encodeURIComponent(params.enterprise)}/${encodeURIComponent(params.prdCat)}/${encodeURIComponent(params.prdCatVersion)}/${encodeURIComponent(params.vendor)}/${encodeURIComponent(params.priceList)}/toc/flat`;
|
|
256
|
+
const options = {
|
|
257
|
+
method: "GET",
|
|
258
|
+
headers: { "X-API-Key": this.auth.secretToken || "" },
|
|
259
|
+
};
|
|
260
|
+
if (this._alternativeReferer) {
|
|
261
|
+
options.headers["Alternative-Referer"] = this._alternativeReferer;
|
|
262
|
+
}
|
|
263
|
+
return this.fetch(this.auth.endpoint + url, options);
|
|
264
|
+
});
|
|
265
|
+
}
|
|
266
|
+
getExportById(params) {
|
|
267
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
268
|
+
if (this.auth === undefined) {
|
|
269
|
+
throw new Error("missing auth");
|
|
270
|
+
}
|
|
271
|
+
const url = `/v1/export/${encodeURIComponent(params.uuid)}`;
|
|
272
|
+
const options = {
|
|
273
|
+
method: "GET",
|
|
274
|
+
headers: { "X-API-Key": this.auth.secretToken || "" },
|
|
275
|
+
};
|
|
276
|
+
if (this._alternativeReferer) {
|
|
277
|
+
options.headers["Alternative-Referer"] = this._alternativeReferer;
|
|
278
|
+
}
|
|
279
|
+
return this.fetch(this.auth.endpoint + url, options);
|
|
280
|
+
});
|
|
281
|
+
}
|
|
282
|
+
getRenderById(params) {
|
|
283
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
284
|
+
if (this.auth === undefined) {
|
|
285
|
+
throw new Error("missing auth");
|
|
286
|
+
}
|
|
287
|
+
const url = `/v1/render/${encodeURIComponent(params.uuid)}`;
|
|
288
|
+
const options = {
|
|
289
|
+
method: "GET",
|
|
290
|
+
headers: { "X-API-Key": this.auth.secretToken || "" },
|
|
291
|
+
};
|
|
292
|
+
if (this._alternativeReferer) {
|
|
293
|
+
options.headers["Alternative-Referer"] = this._alternativeReferer;
|
|
294
|
+
}
|
|
295
|
+
return this.fetch(this.auth.endpoint + url, options);
|
|
296
|
+
});
|
|
297
|
+
}
|
|
298
|
+
postSessionTokenRefresh() {
|
|
299
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
300
|
+
if (this.auth === undefined) {
|
|
301
|
+
throw new Error("missing auth");
|
|
302
|
+
}
|
|
303
|
+
const url = `/v1/session-token/refresh`;
|
|
304
|
+
const options = {
|
|
305
|
+
method: "POST",
|
|
306
|
+
headers: { "X-API-Key": this.auth.secretToken || "" },
|
|
307
|
+
};
|
|
308
|
+
if (this._alternativeReferer) {
|
|
309
|
+
options.headers["Alternative-Referer"] = this._alternativeReferer;
|
|
310
|
+
}
|
|
311
|
+
return this.fetch(this.auth.endpoint + url, options);
|
|
312
|
+
});
|
|
313
|
+
}
|
|
314
|
+
}
|
|
315
|
+
export const DTO_OPERATION_ID_TO_DEBIT_GROUP = {
|
|
316
|
+
postPublicAccessTokenAuthorize: "base",
|
|
317
|
+
getApplicationAreas: "base",
|
|
318
|
+
postExport: "export",
|
|
319
|
+
getPriceLists: "base",
|
|
320
|
+
getProductLegacyV2: "base",
|
|
321
|
+
getProduct: "base",
|
|
322
|
+
postRender: "render",
|
|
323
|
+
postValidateLegacyV1: "base",
|
|
324
|
+
postValidate: "base",
|
|
325
|
+
getTocTree: "base",
|
|
326
|
+
getTocFlat: "base",
|
|
327
|
+
getExportById: "base",
|
|
328
|
+
getRenderById: "base",
|
|
329
|
+
};
|