@inweb/client 26.9.1 → 26.9.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/README.md +2 -0
- package/dist/client.js +360 -42
- package/dist/client.js.map +1 -1
- package/dist/client.min.js +1 -1
- package/dist/client.module.js +311 -200
- package/dist/client.module.js.map +1 -1
- package/lib/Api/Assembly.d.ts +2 -2
- package/lib/Api/Client.d.ts +72 -4
- package/lib/Api/File.d.ts +4 -4
- package/lib/Api/Model.d.ts +2 -2
- package/lib/Api/Plugin.d.ts +141 -0
- package/lib/index.d.ts +1 -0
- package/package.json +5 -2
- package/src/Api/Assembly.ts +2 -2
- package/src/Api/Client.ts +121 -6
- package/src/Api/File.ts +4 -4
- package/src/Api/Model.ts +2 -2
- package/src/Api/Plugin.ts +241 -0
- package/src/index.ts +1 -0
package/dist/client.module.js
CHANGED
|
@@ -177,10 +177,10 @@ class Model extends Endpoint {
|
|
|
177
177
|
return this.file.getModelTransformMatrix(handle);
|
|
178
178
|
}
|
|
179
179
|
setModelTransformMatrix(handle, transform) {
|
|
180
|
-
return this.file.setModelTransformMatrix(handle, transform).then((
|
|
180
|
+
return this.file.setModelTransformMatrix(handle, transform).then(() => this);
|
|
181
181
|
}
|
|
182
182
|
getViewpoints() {
|
|
183
|
-
return this._file.getViewpoints().then(
|
|
183
|
+
return this._file.getViewpoints().then(array => array.filter(({custom_fields: custom_fields = {}}) => custom_fields.modelId === this.id || custom_fields.modelName === this.name));
|
|
184
184
|
}
|
|
185
185
|
saveViewpoint(viewpoint) {
|
|
186
186
|
return this._file.saveViewpoint({
|
|
@@ -215,11 +215,11 @@ class Model extends Endpoint {
|
|
|
215
215
|
if (!records) return;
|
|
216
216
|
let ranges = [];
|
|
217
217
|
if (records.length) {
|
|
218
|
-
ranges = records.map(
|
|
218
|
+
ranges = records.map(record => ({
|
|
219
219
|
begin: Number(record.begin),
|
|
220
220
|
end: Number(record.end),
|
|
221
221
|
requestId: record.reqId
|
|
222
|
-
}))
|
|
222
|
+
}));
|
|
223
223
|
} else {
|
|
224
224
|
for (let i = 0; i < records.size(); i++) {
|
|
225
225
|
const record = records.get(i);
|
|
@@ -239,29 +239,29 @@ class Model extends Endpoint {
|
|
|
239
239
|
}
|
|
240
240
|
|
|
241
241
|
function delay(ms, signal) {
|
|
242
|
-
return new Promise(
|
|
242
|
+
return new Promise(resolve => {
|
|
243
243
|
let timeoutId = 0;
|
|
244
244
|
const abortHandler = () => {
|
|
245
245
|
clearTimeout(timeoutId);
|
|
246
246
|
resolve(true);
|
|
247
247
|
};
|
|
248
|
-
timeoutId = window.setTimeout((
|
|
248
|
+
timeoutId = window.setTimeout(() => {
|
|
249
249
|
signal.removeEventListener("abort", abortHandler);
|
|
250
250
|
resolve(false);
|
|
251
|
-
}
|
|
251
|
+
}, ms);
|
|
252
252
|
signal.addEventListener("abort", abortHandler, {
|
|
253
253
|
once: true
|
|
254
254
|
});
|
|
255
|
-
})
|
|
255
|
+
});
|
|
256
256
|
}
|
|
257
257
|
|
|
258
258
|
async function waitFor(func, params = {}) {
|
|
259
259
|
var _a, _b, _c;
|
|
260
260
|
const timeout = params.timeout || 6e5;
|
|
261
261
|
const interval = params.interval || 3e3;
|
|
262
|
-
const signal = (_a = params.signal) !== null && _a !==
|
|
263
|
-
const abortError = (_b = params.abortError) !== null && _b !==
|
|
264
|
-
const timeoutError = (_c = params.timeoutError) !== null && _c !==
|
|
262
|
+
const signal = (_a = params.signal) !== null && _a !== void 0 ? _a : (new AbortController).signal;
|
|
263
|
+
const abortError = (_b = params.abortError) !== null && _b !== void 0 ? _b : new DOMException("Aborted", "AbortError");
|
|
264
|
+
const timeoutError = (_c = params.timeoutError) !== null && _c !== void 0 ? _c : new DOMException("Timeout", "TimeoutError");
|
|
265
265
|
const end = performance.now() + timeout;
|
|
266
266
|
let count = timeout / interval;
|
|
267
267
|
do {
|
|
@@ -275,7 +275,7 @@ function parseArgs(args) {
|
|
|
275
275
|
if (typeof args === "string") {
|
|
276
276
|
const firstArg = args.indexOf("--");
|
|
277
277
|
if (firstArg !== -1) args = args.slice(firstArg);
|
|
278
|
-
const argArray = args.split("--").map(
|
|
278
|
+
const argArray = args.split("--").map(x => x.split("=").map(y => y.split(" ")).flat()).filter(x => x[0]).map(x => x.concat([ "" ]));
|
|
279
279
|
return Object.fromEntries(argArray);
|
|
280
280
|
}
|
|
281
281
|
return args || {};
|
|
@@ -284,17 +284,17 @@ function parseArgs(args) {
|
|
|
284
284
|
function userFullName(firstName, lastName = "", userName = "") {
|
|
285
285
|
var _a;
|
|
286
286
|
if (firstName && typeof firstName !== "string") {
|
|
287
|
-
return userFullName((_a = firstName.firstName) !== null && _a !==
|
|
287
|
+
return userFullName((_a = firstName.firstName) !== null && _a !== void 0 ? _a : firstName.name, firstName.lastName, firstName.userName);
|
|
288
288
|
}
|
|
289
|
-
return `${firstName !== null && firstName !==
|
|
289
|
+
return `${firstName !== null && firstName !== void 0 ? firstName : ""} ${lastName !== null && lastName !== void 0 ? lastName : ""}`.trim() || userName;
|
|
290
290
|
}
|
|
291
291
|
|
|
292
292
|
function userInitials(fullName = "") {
|
|
293
|
-
const names = fullName.split(" ").filter(
|
|
294
|
-
return names.reduce((
|
|
293
|
+
const names = fullName.split(" ").filter(x => x);
|
|
294
|
+
return names.reduce((initials, name, index) => {
|
|
295
295
|
if (index === 0 || index === names.length - 1) initials += name.charAt(0);
|
|
296
296
|
return initials;
|
|
297
|
-
}
|
|
297
|
+
}, "").toUpperCase();
|
|
298
298
|
}
|
|
299
299
|
|
|
300
300
|
class ClashTest extends Endpoint {
|
|
@@ -361,22 +361,22 @@ class ClashTest extends Endpoint {
|
|
|
361
361
|
return this;
|
|
362
362
|
}
|
|
363
363
|
delete() {
|
|
364
|
-
return super.delete("").then(
|
|
364
|
+
return super.delete("").then(response => response.json());
|
|
365
365
|
}
|
|
366
366
|
save() {
|
|
367
367
|
return this.update(this.data);
|
|
368
368
|
}
|
|
369
369
|
waitForDone(params) {
|
|
370
|
-
const checkDone = () => this.checkout().then(
|
|
370
|
+
const checkDone = () => this.checkout().then(test => {
|
|
371
371
|
var _a;
|
|
372
372
|
const ready = [ "done", "failed" ].includes(test.status);
|
|
373
|
-
const cancel = (_a = params === null || params ===
|
|
373
|
+
const cancel = (_a = params === null || params === void 0 ? void 0 : params.onCheckout) === null || _a === void 0 ? void 0 : _a.call(params, test, ready);
|
|
374
374
|
return cancel || ready;
|
|
375
|
-
})
|
|
376
|
-
return waitFor(checkDone, params).then((
|
|
375
|
+
});
|
|
376
|
+
return waitFor(checkDone, params).then(() => this);
|
|
377
377
|
}
|
|
378
378
|
getReport() {
|
|
379
|
-
return this.get("/report").then(
|
|
379
|
+
return this.get("/report").then(response => response.json());
|
|
380
380
|
}
|
|
381
381
|
}
|
|
382
382
|
|
|
@@ -404,8 +404,8 @@ class Assembly extends Endpoint {
|
|
|
404
404
|
this._data.owner.avatarUrl = `${this.httpClient.serverUrl}/users/${this._data.owner.userId}/avatar`;
|
|
405
405
|
this._data.owner.fullName = userFullName(this._data.owner);
|
|
406
406
|
this._data.owner.initials = userInitials(this._data.owner.fullName);
|
|
407
|
-
(_a = (_b = this._data).associatedFiles) !== null && _a !==
|
|
408
|
-
this._data.associatedFiles.forEach(
|
|
407
|
+
(_a = (_b = this._data).associatedFiles) !== null && _a !== void 0 ? _a : _b.associatedFiles = [];
|
|
408
|
+
this._data.associatedFiles.forEach(file => file.link = `${this.httpClient.serverUrl}/files/${file.fileId}`);
|
|
409
409
|
}
|
|
410
410
|
get files() {
|
|
411
411
|
return this.data.files;
|
|
@@ -457,7 +457,7 @@ class Assembly extends Endpoint {
|
|
|
457
457
|
return this;
|
|
458
458
|
}
|
|
459
459
|
delete() {
|
|
460
|
-
return super.delete("").then(
|
|
460
|
+
return super.delete("").then(response => response.json());
|
|
461
461
|
}
|
|
462
462
|
save() {
|
|
463
463
|
return this.update(this.data);
|
|
@@ -471,7 +471,7 @@ class Assembly extends Endpoint {
|
|
|
471
471
|
return Promise.resolve(this);
|
|
472
472
|
}
|
|
473
473
|
getModels() {
|
|
474
|
-
return this.get("/geometry").then(
|
|
474
|
+
return this.get("/geometry").then(response => response.json()).then(array => array.map(data => new Model(data, this)));
|
|
475
475
|
}
|
|
476
476
|
getModelTransformMatrix(handle) {
|
|
477
477
|
return this.data.transform[handle];
|
|
@@ -495,40 +495,40 @@ class Assembly extends Endpoint {
|
|
|
495
495
|
if (group) searchParams.set("group", "true");
|
|
496
496
|
let queryString = searchParams.toString();
|
|
497
497
|
if (queryString) queryString = "?" + queryString;
|
|
498
|
-
return this.get(`/properties${queryString}`).then(
|
|
498
|
+
return this.get(`/properties${queryString}`).then(response => response.json());
|
|
499
499
|
}
|
|
500
500
|
searchProperties(searchPattern) {
|
|
501
|
-
return this.post("/properties/search", searchPattern).then(
|
|
501
|
+
return this.post("/properties/search", searchPattern).then(response => response.json());
|
|
502
502
|
}
|
|
503
503
|
getCdaTree() {
|
|
504
|
-
return this.get(`/properties/tree`).then(
|
|
504
|
+
return this.get(`/properties/tree`).then(response => response.json());
|
|
505
505
|
}
|
|
506
506
|
getViewpoints() {
|
|
507
|
-
return this.get("/viewpoints").then(
|
|
507
|
+
return this.get("/viewpoints").then(response => response.json()).then(viewpoints => viewpoints.result);
|
|
508
508
|
}
|
|
509
509
|
saveViewpoint(viewpoint) {
|
|
510
|
-
return this.post("/viewpoints", viewpoint).then(
|
|
510
|
+
return this.post("/viewpoints", viewpoint).then(response => response.json());
|
|
511
511
|
}
|
|
512
512
|
deleteViewpoint(guid) {
|
|
513
|
-
return super.delete(`/viewpoints/${guid}`).then(
|
|
513
|
+
return super.delete(`/viewpoints/${guid}`).then(response => response.json());
|
|
514
514
|
}
|
|
515
515
|
getSnapshot(guid) {
|
|
516
|
-
return this.get(`/viewpoints/${guid}/snapshot`).then(
|
|
516
|
+
return this.get(`/viewpoints/${guid}/snapshot`).then(response => response.text());
|
|
517
517
|
}
|
|
518
518
|
getSnapshotData(guid, bitmapGuid) {
|
|
519
|
-
return this.get(`/viewpoints/${guid}/bitmaps/${bitmapGuid}`).then(
|
|
519
|
+
return this.get(`/viewpoints/${guid}/bitmaps/${bitmapGuid}`).then(response => response.text());
|
|
520
520
|
}
|
|
521
521
|
downloadResource(dataId, onProgress, signal) {
|
|
522
522
|
return this.httpClient.downloadFile(this.getEndpointPath(`/downloads/${dataId}`), onProgress, {
|
|
523
523
|
signal: signal,
|
|
524
524
|
headers: this.headers
|
|
525
|
-
}).then(
|
|
525
|
+
}).then(response => response.arrayBuffer());
|
|
526
526
|
}
|
|
527
527
|
downloadResourceRange(dataId, requestId, ranges, onProgress, signal) {
|
|
528
528
|
return this.httpClient.downloadFileRange(this.getEndpointPath(`/downloads/${dataId}${requestId ? "?requestId=" + requestId : ""}`), requestId, ranges, onProgress, {
|
|
529
529
|
signal: signal,
|
|
530
530
|
headers: this.headers
|
|
531
|
-
}).then(
|
|
531
|
+
}).then(response => response.arrayBuffer());
|
|
532
532
|
}
|
|
533
533
|
partialDownloadResource(dataId, onProgress, signal) {
|
|
534
534
|
console.warn("Assembly.partialDownloadResource() has been deprecated since 25.3 and will be removed in a future release, use Assembly.downloadResource() instead.");
|
|
@@ -539,20 +539,20 @@ class Assembly extends Endpoint {
|
|
|
539
539
|
}
|
|
540
540
|
async getReferences(signal) {
|
|
541
541
|
const files = new Endpoint("/files", this.httpClient, this.headers);
|
|
542
|
-
const references = await Promise.all(this.associatedFiles.map(
|
|
542
|
+
const references = await Promise.all(this.associatedFiles.map(file => `/${file.fileId}/references`).map(link => files.get(link, signal).then(response => response.json()))).then(references => references.map(x => x.references)).then(references => references.reduce((x, v) => [ ...v, ...x ], [])).then(references => [ ...new Set(references.map(JSON.stringify)) ].map(x => JSON.parse(x)));
|
|
543
543
|
return {
|
|
544
544
|
id: "",
|
|
545
545
|
references: references
|
|
546
546
|
};
|
|
547
547
|
}
|
|
548
548
|
waitForDone(params) {
|
|
549
|
-
const checkDone = () => this.checkout().then(
|
|
549
|
+
const checkDone = () => this.checkout().then(assembly => {
|
|
550
550
|
var _a;
|
|
551
551
|
const ready = [ "done", "failed" ].includes(assembly.status);
|
|
552
|
-
const cancel = (_a = params === null || params ===
|
|
552
|
+
const cancel = (_a = params === null || params === void 0 ? void 0 : params.onCheckout) === null || _a === void 0 ? void 0 : _a.call(params, assembly, ready);
|
|
553
553
|
return cancel || ready;
|
|
554
|
-
})
|
|
555
|
-
return waitFor(checkDone, params).then((
|
|
554
|
+
});
|
|
555
|
+
return waitFor(checkDone, params).then(() => this);
|
|
556
556
|
}
|
|
557
557
|
getClashTests(start, limit, name, ids, sortByDesc, sortField) {
|
|
558
558
|
const searchParams = new URLSearchParams;
|
|
@@ -568,16 +568,16 @@ class Assembly extends Endpoint {
|
|
|
568
568
|
if (sortField) searchParams.set("sortField", sortField);
|
|
569
569
|
let queryString = searchParams.toString();
|
|
570
570
|
if (queryString) queryString = "?" + queryString;
|
|
571
|
-
return this.get(`/clashes${queryString}`).then(
|
|
571
|
+
return this.get(`/clashes${queryString}`).then(response => response.json()).then(tests => ({
|
|
572
572
|
...tests,
|
|
573
|
-
result: tests.result.map(
|
|
574
|
-
}))
|
|
573
|
+
result: tests.result.map(data => new ClashTest(data, this.path, this.httpClient))
|
|
574
|
+
}));
|
|
575
575
|
}
|
|
576
576
|
getClashTest(testId) {
|
|
577
|
-
return this.get(`/clashes/${testId}`).then(
|
|
577
|
+
return this.get(`/clashes/${testId}`).then(response => response.json()).then(data => new ClashTest(data, this.path, this.httpClient));
|
|
578
578
|
}
|
|
579
579
|
createClashTest(name, selectionTypeA, selectionTypeB, selectionSetA, selectionSetB, params) {
|
|
580
|
-
const {tolerance: tolerance, clearance: clearance, waitForDone: waitForDone} = params !== null && params !==
|
|
580
|
+
const {tolerance: tolerance, clearance: clearance, waitForDone: waitForDone} = params !== null && params !== void 0 ? params : {};
|
|
581
581
|
if (!Array.isArray(selectionSetA)) selectionSetA = [ selectionSetA ];
|
|
582
582
|
if (!Array.isArray(selectionSetB)) selectionSetB = [ selectionSetB ];
|
|
583
583
|
return this.post("/clashes", {
|
|
@@ -588,10 +588,10 @@ class Assembly extends Endpoint {
|
|
|
588
588
|
selectionSetB: selectionSetB,
|
|
589
589
|
tolerance: tolerance,
|
|
590
590
|
clearance: clearance
|
|
591
|
-
}).then(
|
|
591
|
+
}).then(response => response.json()).then(data => new ClashTest(data, this.path, this.httpClient)).then(result => waitForDone ? result.waitForDone(params) : result);
|
|
592
592
|
}
|
|
593
593
|
deleteClashTest(testId) {
|
|
594
|
-
return super.delete(`/clashes/${testId}`).then(
|
|
594
|
+
return super.delete(`/clashes/${testId}`).then(response => response.json());
|
|
595
595
|
}
|
|
596
596
|
updateVersion(files, params = {
|
|
597
597
|
waitForDone: false
|
|
@@ -628,18 +628,18 @@ function handleFetchError(response) {
|
|
|
628
628
|
switch (response.status) {
|
|
629
629
|
case 400:
|
|
630
630
|
{
|
|
631
|
-
return response.text().then(
|
|
631
|
+
return response.text().then(text => {
|
|
632
632
|
console.error(text);
|
|
633
633
|
return Promise.reject(new FetchError(400, error400(text)));
|
|
634
|
-
})
|
|
634
|
+
});
|
|
635
635
|
}
|
|
636
636
|
|
|
637
637
|
case 500:
|
|
638
638
|
{
|
|
639
|
-
return response.text().then(
|
|
639
|
+
return response.text().then(text => {
|
|
640
640
|
console.error(error400(text, text));
|
|
641
641
|
return Promise.reject(new FetchError(500));
|
|
642
|
-
})
|
|
642
|
+
});
|
|
643
643
|
}
|
|
644
644
|
|
|
645
645
|
default:
|
|
@@ -656,7 +656,7 @@ function $fetch(url, init = {
|
|
|
656
656
|
...init.headers
|
|
657
657
|
};
|
|
658
658
|
delete headers["Content-Type"];
|
|
659
|
-
Object.keys(headers).filter(
|
|
659
|
+
Object.keys(headers).filter(x => headers[x] === undefined).forEach(x => delete headers[x]);
|
|
660
660
|
let body = undefined;
|
|
661
661
|
if (init.method === "POST" || init.method === "PUT") {
|
|
662
662
|
if (init.body instanceof FormData) {
|
|
@@ -712,7 +712,7 @@ function handleXMLHttpError(xhr) {
|
|
|
712
712
|
function $xmlhttp(url, params = {
|
|
713
713
|
method: "GET"
|
|
714
714
|
}) {
|
|
715
|
-
return new Promise((
|
|
715
|
+
return new Promise((resolve, reject) => {
|
|
716
716
|
const xhr = new XMLHttpRequest;
|
|
717
717
|
xhr.open(params.method, url, true);
|
|
718
718
|
for (const key in params.headers) {
|
|
@@ -725,7 +725,7 @@ function $xmlhttp(url, params = {
|
|
|
725
725
|
xhr.onprogress = event => params.downloadProgress && params.downloadProgress(calcProgress(event));
|
|
726
726
|
xhr.onloadend = event => handleXMLHttpError(event.target).then(resolve, reject);
|
|
727
727
|
xhr.send(params.body);
|
|
728
|
-
})
|
|
728
|
+
});
|
|
729
729
|
}
|
|
730
730
|
|
|
731
731
|
class HttpClient {
|
|
@@ -814,7 +814,7 @@ class HttpClient {
|
|
|
814
814
|
async downloadFileRange(relativePath, reserved, ranges, onProgress, init = {}) {
|
|
815
815
|
const headers = {
|
|
816
816
|
...init.headers,
|
|
817
|
-
Range: "bytes=" + ranges.map(
|
|
817
|
+
Range: "bytes=" + ranges.map(x => `${x.begin}-${x.end}`).join(",")
|
|
818
818
|
};
|
|
819
819
|
const response = await this.get(relativePath, {
|
|
820
820
|
...init,
|
|
@@ -904,7 +904,7 @@ class Permission extends Endpoint {
|
|
|
904
904
|
return this;
|
|
905
905
|
}
|
|
906
906
|
delete() {
|
|
907
|
-
return super.delete("").then(
|
|
907
|
+
return super.delete("").then(response => response.json());
|
|
908
908
|
}
|
|
909
909
|
save() {
|
|
910
910
|
return this.update(this.data);
|
|
@@ -969,16 +969,16 @@ class Job extends Endpoint {
|
|
|
969
969
|
return this;
|
|
970
970
|
}
|
|
971
971
|
delete() {
|
|
972
|
-
return super.delete("").then(
|
|
972
|
+
return super.delete("").then(response => response.json());
|
|
973
973
|
}
|
|
974
974
|
waitForDone(params) {
|
|
975
|
-
const checkDone = () => this.checkout().then(
|
|
975
|
+
const checkDone = () => this.checkout().then(job => {
|
|
976
976
|
var _a;
|
|
977
977
|
const ready = [ "done", "failed" ].includes(job.status);
|
|
978
|
-
const cancel = (_a = params === null || params ===
|
|
978
|
+
const cancel = (_a = params === null || params === void 0 ? void 0 : params.onCheckout) === null || _a === void 0 ? void 0 : _a.call(params, job, ready);
|
|
979
979
|
return cancel || ready;
|
|
980
|
-
})
|
|
981
|
-
return waitFor(checkDone, params).then((
|
|
980
|
+
});
|
|
981
|
+
return waitFor(checkDone, params).then(() => this);
|
|
982
982
|
}
|
|
983
983
|
}
|
|
984
984
|
|
|
@@ -1022,7 +1022,7 @@ class SharedLink extends Endpoint {
|
|
|
1022
1022
|
return this;
|
|
1023
1023
|
}
|
|
1024
1024
|
delete() {
|
|
1025
|
-
return super.delete("").then(
|
|
1025
|
+
return super.delete("").then(response => response.json());
|
|
1026
1026
|
}
|
|
1027
1027
|
save() {
|
|
1028
1028
|
return this.update(this.data);
|
|
@@ -1057,32 +1057,32 @@ class File extends Endpoint {
|
|
|
1057
1057
|
if (typeof this._data.owner === "string") this._data.owner = {
|
|
1058
1058
|
userId: this._data.owner
|
|
1059
1059
|
};
|
|
1060
|
-
(_a = (_p = this._data).owner) !== null && _a !==
|
|
1060
|
+
(_a = (_p = this._data).owner) !== null && _a !== void 0 ? _a : _p.owner = {};
|
|
1061
1061
|
this._data.owner.avatarUrl = `${this.httpClient.serverUrl}/users/${this._data.owner.userId}/avatar`;
|
|
1062
1062
|
this._data.owner.fullName = userFullName(this._data.owner);
|
|
1063
1063
|
this._data.owner.initials = userInitials(this._data.owner.fullName);
|
|
1064
|
-
(_b = (_q = this._data).status) !== null && _b !==
|
|
1065
|
-
(_c = (_r = this._data.status).geometry) !== null && _c !==
|
|
1066
|
-
state: (_d = this._data.geometryStatus) !== null && _d !==
|
|
1064
|
+
(_b = (_q = this._data).status) !== null && _b !== void 0 ? _b : _q.status = {};
|
|
1065
|
+
(_c = (_r = this._data.status).geometry) !== null && _c !== void 0 ? _c : _r.geometry = {
|
|
1066
|
+
state: (_d = this._data.geometryStatus) !== null && _d !== void 0 ? _d : "none"
|
|
1067
1067
|
};
|
|
1068
|
-
(_e = (_s = this._data.status).properties) !== null && _e !==
|
|
1069
|
-
state: (_f = this._data.propertiesStatus) !== null && _f !==
|
|
1068
|
+
(_e = (_s = this._data.status).properties) !== null && _e !== void 0 ? _e : _s.properties = {
|
|
1069
|
+
state: (_f = this._data.propertiesStatus) !== null && _f !== void 0 ? _f : "none"
|
|
1070
1070
|
};
|
|
1071
|
-
(_g = (_t = this._data.status).validation) !== null && _g !==
|
|
1072
|
-
state: (_h = this._data.validationStatus) !== null && _h !==
|
|
1071
|
+
(_g = (_t = this._data.status).validation) !== null && _g !== void 0 ? _g : _t.validation = {
|
|
1072
|
+
state: (_h = this._data.validationStatus) !== null && _h !== void 0 ? _h : "none"
|
|
1073
1073
|
};
|
|
1074
|
-
(_j = (_u = this._data).updatedBy) !== null && _j !==
|
|
1074
|
+
(_j = (_u = this._data).updatedBy) !== null && _j !== void 0 ? _j : _u.updatedBy = {};
|
|
1075
1075
|
this._data.updatedBy.avatarUrl = `${this.httpClient.serverUrl}/users/${this._data.updatedBy.userId}/avatar`;
|
|
1076
1076
|
this._data.updatedBy.fullName = userFullName(this._data.updatedBy);
|
|
1077
1077
|
this._data.updatedBy.initials = userInitials(this._data.updatedBy.fullName);
|
|
1078
|
-
(_k = (_v = this._data).versions) !== null && _k !==
|
|
1078
|
+
(_k = (_v = this._data).versions) !== null && _k !== void 0 ? _k : _v.versions = [ {
|
|
1079
1079
|
...value
|
|
1080
1080
|
} ];
|
|
1081
|
-
(_l = (_w = this._data.status).geometryGltf) !== null && _l !==
|
|
1081
|
+
(_l = (_w = this._data.status).geometryGltf) !== null && _l !== void 0 ? _l : _w.geometryGltf = {
|
|
1082
1082
|
state: "none"
|
|
1083
1083
|
};
|
|
1084
|
-
(_m = (_x = this._data).isFileDeleted) !== null && _m !==
|
|
1085
|
-
(_o = (_y = this._data).sharedLinkToken) !== null && _o !==
|
|
1084
|
+
(_m = (_x = this._data).isFileDeleted) !== null && _m !== void 0 ? _m : _x.isFileDeleted = false;
|
|
1085
|
+
(_o = (_y = this._data).sharedLinkToken) !== null && _o !== void 0 ? _o : _y.sharedLinkToken = null;
|
|
1086
1086
|
}
|
|
1087
1087
|
get exports() {
|
|
1088
1088
|
return this.data.exports;
|
|
@@ -1149,7 +1149,7 @@ class File extends Endpoint {
|
|
|
1149
1149
|
return this;
|
|
1150
1150
|
}
|
|
1151
1151
|
delete() {
|
|
1152
|
-
return super.delete("").then(
|
|
1152
|
+
return super.delete("").then(response => response.json());
|
|
1153
1153
|
}
|
|
1154
1154
|
save() {
|
|
1155
1155
|
return this.update(this.data);
|
|
@@ -1169,7 +1169,7 @@ class File extends Endpoint {
|
|
|
1169
1169
|
return this;
|
|
1170
1170
|
}
|
|
1171
1171
|
getModels() {
|
|
1172
|
-
return this.get("/geometry").then(
|
|
1172
|
+
return this.get("/geometry").then(response => response.json()).then(array => array.map(data => new Model(data, this)));
|
|
1173
1173
|
}
|
|
1174
1174
|
getModelTransformMatrix(handle) {
|
|
1175
1175
|
return undefined;
|
|
@@ -1188,46 +1188,46 @@ class File extends Endpoint {
|
|
|
1188
1188
|
if (group) searchParams.set("group", "true");
|
|
1189
1189
|
let queryString = searchParams.toString();
|
|
1190
1190
|
if (queryString) queryString = "?" + queryString;
|
|
1191
|
-
return this.get(`/properties${queryString}`).then(
|
|
1191
|
+
return this.get(`/properties${queryString}`).then(response => response.json());
|
|
1192
1192
|
}
|
|
1193
1193
|
searchProperties(searchPattern) {
|
|
1194
|
-
return this.post("/properties/search", searchPattern).then(
|
|
1194
|
+
return this.post("/properties/search", searchPattern).then(response => response.json());
|
|
1195
1195
|
}
|
|
1196
1196
|
getCdaTree() {
|
|
1197
|
-
return this.get(`/properties/tree`).then(
|
|
1197
|
+
return this.get(`/properties/tree`).then(response => response.json());
|
|
1198
1198
|
}
|
|
1199
1199
|
getViewpoints() {
|
|
1200
|
-
return this.get("/viewpoints").then(
|
|
1200
|
+
return this.get("/viewpoints").then(response => response.json()).then(viewpoints => viewpoints.result);
|
|
1201
1201
|
}
|
|
1202
1202
|
saveViewpoint(viewpoint) {
|
|
1203
|
-
return this.post("/viewpoints", viewpoint).then(
|
|
1203
|
+
return this.post("/viewpoints", viewpoint).then(response => response.json());
|
|
1204
1204
|
}
|
|
1205
1205
|
deleteViewpoint(guid) {
|
|
1206
|
-
return super.delete(`/viewpoints/${guid}`).then(
|
|
1206
|
+
return super.delete(`/viewpoints/${guid}`).then(response => response.json());
|
|
1207
1207
|
}
|
|
1208
1208
|
getSnapshot(guid) {
|
|
1209
|
-
return this.get(`/viewpoints/${guid}/snapshot`).then(
|
|
1209
|
+
return this.get(`/viewpoints/${guid}/snapshot`).then(response => response.text());
|
|
1210
1210
|
}
|
|
1211
1211
|
getSnapshotData(guid, bitmapGuid) {
|
|
1212
|
-
return this.get(`/viewpoints/${guid}/bitmaps/${bitmapGuid}`).then(
|
|
1212
|
+
return this.get(`/viewpoints/${guid}/bitmaps/${bitmapGuid}`).then(response => response.text());
|
|
1213
1213
|
}
|
|
1214
1214
|
download(onProgress, signal) {
|
|
1215
1215
|
return this.httpClient.downloadFile(this.getEndpointPath("/downloads"), onProgress, {
|
|
1216
1216
|
signal: signal,
|
|
1217
1217
|
headers: this.headers
|
|
1218
|
-
}).then(
|
|
1218
|
+
}).then(response => response.arrayBuffer());
|
|
1219
1219
|
}
|
|
1220
1220
|
downloadResource(dataId, onProgress, signal) {
|
|
1221
1221
|
return this.httpClient.downloadFile(this.getEndpointPath(`/downloads/${dataId}`), onProgress, {
|
|
1222
1222
|
signal: signal,
|
|
1223
1223
|
headers: this.headers
|
|
1224
|
-
}).then(
|
|
1224
|
+
}).then(response => response.arrayBuffer());
|
|
1225
1225
|
}
|
|
1226
1226
|
downloadResourceRange(dataId, requestId, ranges, onProgress, signal) {
|
|
1227
1227
|
return this.httpClient.downloadFileRange(this.getEndpointPath(`/downloads/${dataId}${requestId ? "?requestId=" + requestId : ""}`), requestId, ranges, onProgress, {
|
|
1228
1228
|
signal: signal,
|
|
1229
1229
|
headers: this.headers
|
|
1230
|
-
}).then(
|
|
1230
|
+
}).then(response => response.arrayBuffer());
|
|
1231
1231
|
}
|
|
1232
1232
|
partialDownloadResource(dataId, onProgress, signal) {
|
|
1233
1233
|
console.warn("File.partialDownloadResource() has been deprecated since 25.3 and will be removed in a future release, use File.downloadResource() instead.");
|
|
@@ -1237,10 +1237,10 @@ class File extends Endpoint {
|
|
|
1237
1237
|
await this.downloadResourceRange(dataId, requestId, records, onProgress, signal);
|
|
1238
1238
|
}
|
|
1239
1239
|
getReferences(signal) {
|
|
1240
|
-
return this.get("/references", signal).then(
|
|
1240
|
+
return this.get("/references", signal).then(response => response.json());
|
|
1241
1241
|
}
|
|
1242
1242
|
setReferences(references) {
|
|
1243
|
-
return this.put("/references", references).then(
|
|
1243
|
+
return this.put("/references", references).then(response => response.json());
|
|
1244
1244
|
}
|
|
1245
1245
|
createJob(outputFormat, parameters) {
|
|
1246
1246
|
const jobs = new Endpoint("/jobs", this.httpClient, this.headers);
|
|
@@ -1248,7 +1248,7 @@ class File extends Endpoint {
|
|
|
1248
1248
|
fileId: this.id,
|
|
1249
1249
|
outputFormat: outputFormat,
|
|
1250
1250
|
parameters: parseArgs(parameters)
|
|
1251
|
-
}).then(
|
|
1251
|
+
}).then(response => response.json()).then(data => new Job(data, this.httpClient));
|
|
1252
1252
|
}
|
|
1253
1253
|
extractGeometry(type, parameters) {
|
|
1254
1254
|
return this.createJob(type === "gltf" ? "geometryGltf" : "geometry", parameters);
|
|
@@ -1262,43 +1262,43 @@ class File extends Endpoint {
|
|
|
1262
1262
|
waitForDone(jobs, waitAll, params) {
|
|
1263
1263
|
const waitJobs = Array.isArray(jobs) ? jobs : [ jobs ];
|
|
1264
1264
|
if (waitAll === undefined) waitAll = true;
|
|
1265
|
-
const checkDone = () => this.checkout().then(
|
|
1265
|
+
const checkDone = () => this.checkout().then(file => {
|
|
1266
1266
|
var _a;
|
|
1267
|
-
const readyJobs = waitJobs.filter(
|
|
1267
|
+
const readyJobs = waitJobs.filter(job => {
|
|
1268
1268
|
const jobStatus = file.status[job] || {};
|
|
1269
1269
|
return [ "none", "done", "failed" ].includes(jobStatus.state || "none");
|
|
1270
|
-
})
|
|
1270
|
+
});
|
|
1271
1271
|
const ready = waitAll ? readyJobs.length === waitJobs.length : readyJobs.length > 0;
|
|
1272
|
-
const cancel = (_a = params === null || params ===
|
|
1272
|
+
const cancel = (_a = params === null || params === void 0 ? void 0 : params.onCheckout) === null || _a === void 0 ? void 0 : _a.call(params, file, ready);
|
|
1273
1273
|
return cancel || ready;
|
|
1274
|
-
})
|
|
1275
|
-
return waitFor(checkDone, params).then((
|
|
1274
|
+
});
|
|
1275
|
+
return waitFor(checkDone, params).then(() => this);
|
|
1276
1276
|
}
|
|
1277
1277
|
getPermissions() {
|
|
1278
|
-
return this.get("/permissions").then(
|
|
1278
|
+
return this.get("/permissions").then(response => response.json()).then(array => array.map(data => new Permission(data, this.id, this.httpClient)));
|
|
1279
1279
|
}
|
|
1280
1280
|
getPermission(permissionId) {
|
|
1281
|
-
return this.get(`/permissions/${permissionId}`).then(
|
|
1281
|
+
return this.get(`/permissions/${permissionId}`).then(response => response.json()).then(data => new Permission(data, this.id, this.httpClient));
|
|
1282
1282
|
}
|
|
1283
1283
|
createPermission(actions, grantedTo, _public) {
|
|
1284
1284
|
return this.post("/permissions", {
|
|
1285
1285
|
actions: Array.isArray(actions) ? actions : [ actions ],
|
|
1286
1286
|
grantedTo: grantedTo,
|
|
1287
1287
|
public: _public
|
|
1288
|
-
}).then(
|
|
1288
|
+
}).then(response => response.json()).then(data => new Permission(data, this.id, this.httpClient));
|
|
1289
1289
|
}
|
|
1290
1290
|
deletePermission(permissionId) {
|
|
1291
|
-
return super.delete(`/permissions/${permissionId}`).then(
|
|
1291
|
+
return super.delete(`/permissions/${permissionId}`).then(response => response.json());
|
|
1292
1292
|
}
|
|
1293
1293
|
async uploadVersion(file, params = {
|
|
1294
1294
|
waitForDone: false
|
|
1295
1295
|
}) {
|
|
1296
|
-
const result = await this.httpClient.uploadFile(this.getEndpointPath("/versions"), file,
|
|
1296
|
+
const result = await this.httpClient.uploadFile(this.getEndpointPath("/versions"), file, progress => {
|
|
1297
1297
|
var _a;
|
|
1298
|
-
return (_a = params.onProgress) === null || _a ===
|
|
1299
|
-
}
|
|
1298
|
+
return (_a = params.onProgress) === null || _a === void 0 ? void 0 : _a.call(params, progress, file);
|
|
1299
|
+
}, {
|
|
1300
1300
|
headers: this.headers
|
|
1301
|
-
}).then(
|
|
1301
|
+
}).then(xhr => JSON.parse(xhr.responseText)).then(data => new File(data, this.httpClient));
|
|
1302
1302
|
let geometryType = "";
|
|
1303
1303
|
if (this.versions[0].status.geometryGltf.state !== "none") geometryType = "gltf";
|
|
1304
1304
|
if (this.versions[0].status.geometry.state !== "none") geometryType = "vsfx";
|
|
@@ -1315,10 +1315,10 @@ class File extends Endpoint {
|
|
|
1315
1315
|
return result;
|
|
1316
1316
|
}
|
|
1317
1317
|
getVersions() {
|
|
1318
|
-
return this.get("/versions").then(
|
|
1318
|
+
return this.get("/versions").then(response => response.json()).then(files => files.map(data => new File(data, this.httpClient))).then(files => files.map(file => file.id == file.originalFileId ? file.useVersion(0) : file));
|
|
1319
1319
|
}
|
|
1320
1320
|
getVersion(version) {
|
|
1321
|
-
return this.get(`/versions/${version}`).then(
|
|
1321
|
+
return this.get(`/versions/${version}`).then(response => response.json()).then(data => new File(data, this.httpClient)).then(file => file.id == file.originalFileId ? file.useVersion(0) : file);
|
|
1322
1322
|
}
|
|
1323
1323
|
async deleteVersion(version) {
|
|
1324
1324
|
const response = await super.delete(`/versions/${version}`);
|
|
@@ -1407,7 +1407,7 @@ class Role extends Endpoint {
|
|
|
1407
1407
|
return this;
|
|
1408
1408
|
}
|
|
1409
1409
|
delete() {
|
|
1410
|
-
return super.delete("").then(
|
|
1410
|
+
return super.delete("").then(response => response.json());
|
|
1411
1411
|
}
|
|
1412
1412
|
save() {
|
|
1413
1413
|
return this.update(this.data);
|
|
@@ -1454,7 +1454,7 @@ class Member extends Endpoint {
|
|
|
1454
1454
|
return this;
|
|
1455
1455
|
}
|
|
1456
1456
|
delete() {
|
|
1457
|
-
return super.delete("").then(
|
|
1457
|
+
return super.delete("").then(response => response.json());
|
|
1458
1458
|
}
|
|
1459
1459
|
save() {
|
|
1460
1460
|
return this.update(this.data);
|
|
@@ -1550,7 +1550,7 @@ class Project extends Endpoint {
|
|
|
1550
1550
|
return this;
|
|
1551
1551
|
}
|
|
1552
1552
|
delete() {
|
|
1553
|
-
return super.delete("").then(
|
|
1553
|
+
return super.delete("").then(response => response.text()).then(text => {
|
|
1554
1554
|
try {
|
|
1555
1555
|
return JSON.parse(text);
|
|
1556
1556
|
} catch {
|
|
@@ -1558,7 +1558,7 @@ class Project extends Endpoint {
|
|
|
1558
1558
|
id: this.id
|
|
1559
1559
|
};
|
|
1560
1560
|
}
|
|
1561
|
-
})
|
|
1561
|
+
});
|
|
1562
1562
|
}
|
|
1563
1563
|
save() {
|
|
1564
1564
|
return this.update(this.data);
|
|
@@ -1578,41 +1578,41 @@ class Project extends Endpoint {
|
|
|
1578
1578
|
return this;
|
|
1579
1579
|
}
|
|
1580
1580
|
getRoles() {
|
|
1581
|
-
return this.get("/roles").then(
|
|
1581
|
+
return this.get("/roles").then(response => response.json()).then(array => array.map(data => new Role(data, this.id, this.httpClient)));
|
|
1582
1582
|
}
|
|
1583
1583
|
getRole(name) {
|
|
1584
|
-
return this.get(`/roles/${name}`).then(
|
|
1584
|
+
return this.get(`/roles/${name}`).then(response => response.json()).then(data => new Role(data, this.id, this.httpClient));
|
|
1585
1585
|
}
|
|
1586
1586
|
createRole(name, description, permissions) {
|
|
1587
1587
|
return this.post("/roles", {
|
|
1588
1588
|
name: name,
|
|
1589
1589
|
description: description,
|
|
1590
1590
|
permissions: permissions || {}
|
|
1591
|
-
}).then(
|
|
1591
|
+
}).then(response => response.json()).then(data => new Role(data, this.id, this.httpClient));
|
|
1592
1592
|
}
|
|
1593
1593
|
deleteRole(name) {
|
|
1594
|
-
return super.delete(`/roles/${name}`).then(
|
|
1594
|
+
return super.delete(`/roles/${name}`).then(response => response.json());
|
|
1595
1595
|
}
|
|
1596
1596
|
getMembers() {
|
|
1597
|
-
return this.get("/members").then(
|
|
1597
|
+
return this.get("/members").then(response => response.json()).then(array => array.map(data => new Member(data, this.id, this.httpClient)));
|
|
1598
1598
|
}
|
|
1599
1599
|
getMember(memberId) {
|
|
1600
|
-
return this.get(`/members/${memberId}`).then(
|
|
1600
|
+
return this.get(`/members/${memberId}`).then(response => response.json()).then(data => new Member(data, this.id, this.httpClient));
|
|
1601
1601
|
}
|
|
1602
1602
|
addMember(userId, role) {
|
|
1603
1603
|
return this.post("/members", {
|
|
1604
1604
|
userId: userId,
|
|
1605
1605
|
role: role
|
|
1606
|
-
}).then(
|
|
1606
|
+
}).then(response => response.json()).then(data => new Member(data, this.id, this.httpClient));
|
|
1607
1607
|
}
|
|
1608
1608
|
removeMember(memberId) {
|
|
1609
|
-
return super.delete(`/members/${memberId}`).then(
|
|
1609
|
+
return super.delete(`/members/${memberId}`).then(response => response.json());
|
|
1610
1610
|
}
|
|
1611
1611
|
getFilesInformation() {
|
|
1612
1612
|
const bcfProjects = new Endpoint("/bcf/3.0/projects", this.httpClient, this.headers);
|
|
1613
|
-
return bcfProjects.get(`/${this.id}/files_information`).then(
|
|
1614
|
-
items.forEach(
|
|
1615
|
-
const getFieldValue = displayName => (item.display_information.find(
|
|
1613
|
+
return bcfProjects.get(`/${this.id}/files_information`).then(response => response.json()).then(items => {
|
|
1614
|
+
items.forEach(item => {
|
|
1615
|
+
const getFieldValue = displayName => (item.display_information.find(x => x.field_display_name === displayName) || {}).field_value;
|
|
1616
1616
|
const previewUrl = `${this.httpClient.serverUrl}/files/${item.file.reference}/preview`;
|
|
1617
1617
|
const ownerAvatarUrl = `${this.httpClient.serverUrl}/users/${getFieldValue("Owner")}/avatar`;
|
|
1618
1618
|
const ownerFirstName = getFieldValue("Owner First Name");
|
|
@@ -1661,19 +1661,19 @@ class Project extends Endpoint {
|
|
|
1661
1661
|
field_display_name: "Geometry Type",
|
|
1662
1662
|
field_value: geometryType
|
|
1663
1663
|
});
|
|
1664
|
-
})
|
|
1664
|
+
});
|
|
1665
1665
|
return items;
|
|
1666
|
-
})
|
|
1666
|
+
});
|
|
1667
1667
|
}
|
|
1668
1668
|
getModels() {
|
|
1669
|
-
return this.getFilesInformation().then(
|
|
1669
|
+
return this.getFilesInformation().then(filesInformation => filesInformation.map(item => item.file.reference)).then(ids => {
|
|
1670
1670
|
const files = new Endpoint("/files", this.httpClient, this.headers);
|
|
1671
1671
|
return files.get(`?id=${ids.join("|")}`);
|
|
1672
|
-
})
|
|
1672
|
+
}).then(response => response.json()).then(files => files.result.map(data => new File(data, this.httpClient)));
|
|
1673
1673
|
}
|
|
1674
1674
|
async addModel(fileId, actions, _public) {
|
|
1675
1675
|
const files = new Endpoint("/files", this.httpClient, this.headers);
|
|
1676
|
-
const file = await files.get(`/${fileId}`).then(
|
|
1676
|
+
const file = await files.get(`/${fileId}`).then(response => response.json()).then(data => new File(data, this.httpClient));
|
|
1677
1677
|
const grantedTo = [ {
|
|
1678
1678
|
project: {
|
|
1679
1679
|
id: this.id,
|
|
@@ -1685,12 +1685,12 @@ class Project extends Endpoint {
|
|
|
1685
1685
|
}
|
|
1686
1686
|
async removeModel(fileId) {
|
|
1687
1687
|
const files = new Endpoint("/files", this.httpClient, this.headers);
|
|
1688
|
-
const file = await files.get(`/${fileId}`).then(
|
|
1688
|
+
const file = await files.get(`/${fileId}`).then(response => response.json()).then(data => new File(data, this.httpClient));
|
|
1689
1689
|
const permissions = await file.getPermissions();
|
|
1690
|
-
await Promise.allSettled(permissions.filter(
|
|
1690
|
+
await Promise.allSettled(permissions.filter(permission => permission.grantedTo.some(x => {
|
|
1691
1691
|
var _a;
|
|
1692
|
-
return ((_a = x.project) === null || _a ===
|
|
1693
|
-
}))
|
|
1692
|
+
return ((_a = x.project) === null || _a === void 0 ? void 0 : _a.id) === this.id;
|
|
1693
|
+
})).map(permission => permission.delete()));
|
|
1694
1694
|
return file;
|
|
1695
1695
|
}
|
|
1696
1696
|
}
|
|
@@ -1844,14 +1844,14 @@ class User extends Endpoint {
|
|
|
1844
1844
|
}
|
|
1845
1845
|
delete() {
|
|
1846
1846
|
if (this.httpClient.signInUserIsAdmin) {
|
|
1847
|
-
return super.delete(`/users/${this.id}`).then(
|
|
1847
|
+
return super.delete(`/users/${this.id}`).then(response => response.json()).then(data => {
|
|
1848
1848
|
if (this.id === this.httpClient.signInUserId) {
|
|
1849
1849
|
delete this.httpClient.headers["Authorization"];
|
|
1850
1850
|
this.httpClient.signInUserId = "";
|
|
1851
1851
|
this.httpClient.signInUserIsAdmin = false;
|
|
1852
1852
|
}
|
|
1853
1853
|
return data;
|
|
1854
|
-
})
|
|
1854
|
+
});
|
|
1855
1855
|
} else {
|
|
1856
1856
|
return Promise.reject(new FetchError(403));
|
|
1857
1857
|
}
|
|
@@ -1986,7 +1986,7 @@ class OAuthClient extends Endpoint {
|
|
|
1986
1986
|
return this;
|
|
1987
1987
|
}
|
|
1988
1988
|
delete() {
|
|
1989
|
-
return super.delete("").then(
|
|
1989
|
+
return super.delete("").then(response => response.json());
|
|
1990
1990
|
}
|
|
1991
1991
|
save() {
|
|
1992
1992
|
return this.update(this.data);
|
|
@@ -2024,6 +2024,86 @@ class SharedFile extends File {
|
|
|
2024
2024
|
}
|
|
2025
2025
|
}
|
|
2026
2026
|
|
|
2027
|
+
class Plugin extends Endpoint {
|
|
2028
|
+
constructor(data, httpClient) {
|
|
2029
|
+
super(`/plugins/${data.name}/${data.version}`, httpClient);
|
|
2030
|
+
this.data = data;
|
|
2031
|
+
}
|
|
2032
|
+
get author() {
|
|
2033
|
+
return this.data.author;
|
|
2034
|
+
}
|
|
2035
|
+
get data() {
|
|
2036
|
+
return this._data;
|
|
2037
|
+
}
|
|
2038
|
+
set data(value) {
|
|
2039
|
+
this._data = value;
|
|
2040
|
+
}
|
|
2041
|
+
get description() {
|
|
2042
|
+
return this.data.description;
|
|
2043
|
+
}
|
|
2044
|
+
get enabled() {
|
|
2045
|
+
return this.data.enabled;
|
|
2046
|
+
}
|
|
2047
|
+
get homepage() {
|
|
2048
|
+
return this.data.homepage;
|
|
2049
|
+
}
|
|
2050
|
+
get id() {
|
|
2051
|
+
return this.data.id;
|
|
2052
|
+
}
|
|
2053
|
+
get license() {
|
|
2054
|
+
return this.data.license;
|
|
2055
|
+
}
|
|
2056
|
+
get name() {
|
|
2057
|
+
return this.data.name;
|
|
2058
|
+
}
|
|
2059
|
+
get permissions() {
|
|
2060
|
+
return this.data.permissions;
|
|
2061
|
+
}
|
|
2062
|
+
get pluginType() {
|
|
2063
|
+
return this.data.pluginType;
|
|
2064
|
+
}
|
|
2065
|
+
get version() {
|
|
2066
|
+
return this.data.version;
|
|
2067
|
+
}
|
|
2068
|
+
async checkout() {
|
|
2069
|
+
const response = await this.get("");
|
|
2070
|
+
this.data = await response.json();
|
|
2071
|
+
return this;
|
|
2072
|
+
}
|
|
2073
|
+
delete() {
|
|
2074
|
+
return super.delete("").then(response => response.json());
|
|
2075
|
+
}
|
|
2076
|
+
async enable() {
|
|
2077
|
+
const response = await this.put("/enable");
|
|
2078
|
+
this.data = await response.json();
|
|
2079
|
+
return this;
|
|
2080
|
+
}
|
|
2081
|
+
async disable() {
|
|
2082
|
+
const response = await this.put("/disable");
|
|
2083
|
+
this.data = await response.json();
|
|
2084
|
+
return this;
|
|
2085
|
+
}
|
|
2086
|
+
download(onProgress, signal) {
|
|
2087
|
+
return this.httpClient.downloadFile(this.getEndpointPath("/download"), onProgress, {
|
|
2088
|
+
signal: signal,
|
|
2089
|
+
headers: this.headers
|
|
2090
|
+
}).then(response => response.arrayBuffer());
|
|
2091
|
+
}
|
|
2092
|
+
getManifest() {
|
|
2093
|
+
return this.get("/manifest").then(response => response.json());
|
|
2094
|
+
}
|
|
2095
|
+
getSettings() {
|
|
2096
|
+
return this.get("/settings").then(response => response.json());
|
|
2097
|
+
}
|
|
2098
|
+
updateSettings(settings) {
|
|
2099
|
+
return this.post("/settings", settings).then(response => response.json());
|
|
2100
|
+
}
|
|
2101
|
+
executeCommand(command, parameters) {
|
|
2102
|
+
const commands = new Endpoint(`/plugins/${this.name}/commands`, this.httpClient, this.headers);
|
|
2103
|
+
return commands.post(`/${command}?version=${this.version}`, parameters).then(response => response.json());
|
|
2104
|
+
}
|
|
2105
|
+
}
|
|
2106
|
+
|
|
2027
2107
|
class Client extends EventEmitter2 {
|
|
2028
2108
|
constructor(params = {}) {
|
|
2029
2109
|
super();
|
|
@@ -2095,27 +2175,27 @@ class Client extends EventEmitter2 {
|
|
|
2095
2175
|
return this;
|
|
2096
2176
|
}
|
|
2097
2177
|
version() {
|
|
2098
|
-
return this.httpClient.get("/version").then(
|
|
2178
|
+
return this.httpClient.get("/version").then(response => response.json()).then(data => ({
|
|
2099
2179
|
...data,
|
|
2100
2180
|
server: data.version,
|
|
2101
|
-
client: "26.9.
|
|
2102
|
-
}))
|
|
2181
|
+
client: "26.9.3"
|
|
2182
|
+
}));
|
|
2103
2183
|
}
|
|
2104
2184
|
registerUser(email, password, userName) {
|
|
2105
2185
|
return this.httpClient.post("/register", {
|
|
2106
2186
|
email: email,
|
|
2107
2187
|
password: password,
|
|
2108
|
-
userName: userName !== null && userName !==
|
|
2109
|
-
}).then(
|
|
2188
|
+
userName: userName !== null && userName !== void 0 ? userName : (email + "").split("@").shift()
|
|
2189
|
+
}).then(response => response.json());
|
|
2110
2190
|
}
|
|
2111
2191
|
resendConfirmationEmail(email, password) {
|
|
2112
2192
|
return this.httpClient.post("/register/email-confirmation", {
|
|
2113
2193
|
email: email,
|
|
2114
2194
|
password: password
|
|
2115
|
-
}).then(
|
|
2195
|
+
}).then(response => response.json());
|
|
2116
2196
|
}
|
|
2117
2197
|
confirmUserEmail(emailConfirmationId) {
|
|
2118
|
-
return this.httpClient.get(`/register/email-confirmation/${emailConfirmationId}`).then(
|
|
2198
|
+
return this.httpClient.get(`/register/email-confirmation/${emailConfirmationId}`).then(response => response.json());
|
|
2119
2199
|
}
|
|
2120
2200
|
async signInWithEmail(email, password) {
|
|
2121
2201
|
const credentials = btoa(unescape(encodeURIComponent(email + ":" + password)));
|
|
@@ -2151,13 +2231,13 @@ class Client extends EventEmitter2 {
|
|
|
2151
2231
|
return this._user;
|
|
2152
2232
|
}
|
|
2153
2233
|
getIdentityProviders() {
|
|
2154
|
-
return this.httpClient.get("/identity").then(
|
|
2234
|
+
return this.httpClient.get("/identity").then(response => response.json());
|
|
2155
2235
|
}
|
|
2156
2236
|
getServerSettings() {
|
|
2157
|
-
return this.httpClient.get("/settings").then(
|
|
2237
|
+
return this.httpClient.get("/settings").then(response => response.json());
|
|
2158
2238
|
}
|
|
2159
2239
|
updateServerSettings(settings) {
|
|
2160
|
-
return this.httpClient.put("/settings", settings).then(
|
|
2240
|
+
return this.httpClient.put("/settings", settings).then(response => response.json());
|
|
2161
2241
|
}
|
|
2162
2242
|
getOAuthClients(start, limit) {
|
|
2163
2243
|
const searchParams = new URLSearchParams;
|
|
@@ -2165,41 +2245,41 @@ class Client extends EventEmitter2 {
|
|
|
2165
2245
|
if (limit > 0) searchParams.set("limit", limit.toString());
|
|
2166
2246
|
let queryString = searchParams.toString();
|
|
2167
2247
|
if (queryString) queryString = "?" + queryString;
|
|
2168
|
-
return this.httpClient.get(`/oauth/clients${queryString}`).then(
|
|
2248
|
+
return this.httpClient.get(`/oauth/clients${queryString}`).then(response => response.json()).then(clients => ({
|
|
2169
2249
|
...clients,
|
|
2170
|
-
result: clients.result.map(
|
|
2171
|
-
}))
|
|
2250
|
+
result: clients.result.map(data => new OAuthClient(data, this.httpClient))
|
|
2251
|
+
}));
|
|
2172
2252
|
}
|
|
2173
2253
|
getOAuthClient(clientId) {
|
|
2174
|
-
return this.httpClient.get(`/oauth/clients/${clientId}`).then(
|
|
2254
|
+
return this.httpClient.get(`/oauth/clients/${clientId}`).then(response => response.json()).then(data => new OAuthClient(data, this.httpClient));
|
|
2175
2255
|
}
|
|
2176
2256
|
createOAuthClient(name, redirectUrl, description) {
|
|
2177
2257
|
return this.httpClient.post("/oauth/clients", {
|
|
2178
2258
|
name: name,
|
|
2179
2259
|
redirectUrl: redirectUrl,
|
|
2180
2260
|
description: description
|
|
2181
|
-
}).then(
|
|
2261
|
+
}).then(response => response.json()).then(data => new OAuthClient(data, this.httpClient));
|
|
2182
2262
|
}
|
|
2183
2263
|
deleteOAuthClient(clientId) {
|
|
2184
|
-
return this.httpClient.delete(`/oauth/clients/${clientId}`).then(
|
|
2264
|
+
return this.httpClient.delete(`/oauth/clients/${clientId}`).then(response => response.json());
|
|
2185
2265
|
}
|
|
2186
2266
|
getUsers() {
|
|
2187
|
-
return this.httpClient.get("/users").then(
|
|
2267
|
+
return this.httpClient.get("/users").then(response => response.json()).then(array => array.map(data => ({
|
|
2188
2268
|
id: data.id,
|
|
2189
2269
|
...data.userBrief
|
|
2190
|
-
})))
|
|
2270
|
+
}))).then(array => array.map(data => new User(data, this.httpClient)));
|
|
2191
2271
|
}
|
|
2192
2272
|
getUser(userId) {
|
|
2193
2273
|
if (this.httpClient.signInUserIsAdmin) {
|
|
2194
|
-
return this.httpClient.get(`/users/${userId}`).then(
|
|
2274
|
+
return this.httpClient.get(`/users/${userId}`).then(response => response.json()).then(data => ({
|
|
2195
2275
|
id: data.id,
|
|
2196
2276
|
...data.userBrief
|
|
2197
|
-
}))
|
|
2277
|
+
})).then(data => new User(data, this.httpClient));
|
|
2198
2278
|
} else if (userId === this.httpClient.signInUserId) {
|
|
2199
|
-
return this.httpClient.get("/user").then(
|
|
2279
|
+
return this.httpClient.get("/user").then(response => response.json()).then(data => ({
|
|
2200
2280
|
id: userId,
|
|
2201
2281
|
...data
|
|
2202
|
-
}))
|
|
2282
|
+
})).then(data => new User(data, this.httpClient));
|
|
2203
2283
|
} else {
|
|
2204
2284
|
return Promise.reject(new FetchError(403));
|
|
2205
2285
|
}
|
|
@@ -2211,22 +2291,22 @@ class Client extends EventEmitter2 {
|
|
|
2211
2291
|
userBrief: {
|
|
2212
2292
|
...rest,
|
|
2213
2293
|
email: email,
|
|
2214
|
-
userName: userName !== null && userName !==
|
|
2294
|
+
userName: userName !== null && userName !== void 0 ? userName : (email + "").split("@").shift()
|
|
2215
2295
|
},
|
|
2216
2296
|
password: password
|
|
2217
|
-
}).then(
|
|
2297
|
+
}).then(response => response.json()).then(data => ({
|
|
2218
2298
|
id: data.id,
|
|
2219
2299
|
...data.userBrief
|
|
2220
|
-
}))
|
|
2300
|
+
})).then(data => new User(data, this.httpClient));
|
|
2221
2301
|
}
|
|
2222
2302
|
deleteUser(userId) {
|
|
2223
2303
|
if (this.httpClient.signInUserIsAdmin) {
|
|
2224
|
-
return this.httpClient.delete(`/users/${userId}`).then(
|
|
2304
|
+
return this.httpClient.delete(`/users/${userId}`).then(response => response.json()).then(data => {
|
|
2225
2305
|
if (userId === this.httpClient.signInUserId) {
|
|
2226
2306
|
this.clearCurrentUser();
|
|
2227
2307
|
}
|
|
2228
2308
|
return data;
|
|
2229
|
-
})
|
|
2309
|
+
});
|
|
2230
2310
|
} else {
|
|
2231
2311
|
return Promise.reject(new FetchError(403));
|
|
2232
2312
|
}
|
|
@@ -2250,28 +2330,28 @@ class Client extends EventEmitter2 {
|
|
|
2250
2330
|
if (shared) searchParams.set("shared", "true");
|
|
2251
2331
|
let queryString = searchParams.toString();
|
|
2252
2332
|
if (queryString) queryString = "?" + queryString;
|
|
2253
|
-
return this.httpClient.get(`/files${queryString}`).then(
|
|
2333
|
+
return this.httpClient.get(`/files${queryString}`).then(response => response.json()).then(files => ({
|
|
2254
2334
|
...files,
|
|
2255
|
-
result: files.result.map(
|
|
2256
|
-
}))
|
|
2335
|
+
result: files.result.map(data => new File(data, this.httpClient))
|
|
2336
|
+
}));
|
|
2257
2337
|
}
|
|
2258
2338
|
getFile(fileId) {
|
|
2259
|
-
return this.httpClient.get(`/files/${fileId}`).then(
|
|
2339
|
+
return this.httpClient.get(`/files/${fileId}`).then(response => response.json()).then(data => new File(data, this.httpClient));
|
|
2260
2340
|
}
|
|
2261
2341
|
async uploadFile(file, params = {
|
|
2262
2342
|
geometry: true,
|
|
2263
2343
|
properties: false,
|
|
2264
2344
|
waitForDone: false
|
|
2265
2345
|
}) {
|
|
2266
|
-
const result = await this.httpClient.uploadFile("/files", file,
|
|
2346
|
+
const result = await this.httpClient.uploadFile("/files", file, progress => {
|
|
2267
2347
|
var _a;
|
|
2268
2348
|
this.emitEvent({
|
|
2269
2349
|
type: "uploadprogress",
|
|
2270
2350
|
data: progress,
|
|
2271
2351
|
file: file
|
|
2272
2352
|
});
|
|
2273
|
-
(_a = params.onProgress) === null || _a ===
|
|
2274
|
-
})
|
|
2353
|
+
(_a = params.onProgress) === null || _a === void 0 ? void 0 : _a.call(params, progress, file);
|
|
2354
|
+
}).then(xhr => JSON.parse(xhr.responseText)).then(data => new File(data, this.httpClient));
|
|
2275
2355
|
const geometryType = typeof params.geometry === "string" ? params.geometry : "vsfx";
|
|
2276
2356
|
const jobParameters = params.jobParameters || {};
|
|
2277
2357
|
const jobs = [];
|
|
@@ -2281,12 +2361,12 @@ class Client extends EventEmitter2 {
|
|
|
2281
2361
|
return result;
|
|
2282
2362
|
}
|
|
2283
2363
|
deleteFile(fileId) {
|
|
2284
|
-
return this.httpClient.delete(`/files/${fileId}`).then(
|
|
2364
|
+
return this.httpClient.delete(`/files/${fileId}`).then(response => response.json());
|
|
2285
2365
|
}
|
|
2286
2366
|
downloadFile(fileId, onProgress, signal) {
|
|
2287
2367
|
return this.httpClient.downloadFile(`/files/${fileId}/downloads`, onProgress, {
|
|
2288
2368
|
signal: signal
|
|
2289
|
-
}).then(
|
|
2369
|
+
}).then(response => response.arrayBuffer());
|
|
2290
2370
|
}
|
|
2291
2371
|
getJobs(status, limit, start, sortByDesc, sortField) {
|
|
2292
2372
|
const searchParams = new URLSearchParams;
|
|
@@ -2301,23 +2381,23 @@ class Client extends EventEmitter2 {
|
|
|
2301
2381
|
if (sortField) searchParams.set("sortField", sortField);
|
|
2302
2382
|
let queryString = searchParams.toString();
|
|
2303
2383
|
if (queryString) queryString = "?" + queryString;
|
|
2304
|
-
return this.httpClient.get(`/jobs${queryString}`).then(
|
|
2384
|
+
return this.httpClient.get(`/jobs${queryString}`).then(response => response.json()).then(jobs => ({
|
|
2305
2385
|
...jobs,
|
|
2306
|
-
result: jobs.result.map(
|
|
2307
|
-
}))
|
|
2386
|
+
result: jobs.result.map(data => new Job(data, this.httpClient))
|
|
2387
|
+
}));
|
|
2308
2388
|
}
|
|
2309
2389
|
getJob(jobId) {
|
|
2310
|
-
return this.httpClient.get(`/jobs/${jobId}`).then(
|
|
2390
|
+
return this.httpClient.get(`/jobs/${jobId}`).then(response => response.json()).then(data => new Job(data, this.httpClient));
|
|
2311
2391
|
}
|
|
2312
2392
|
createJob(fileId, outputFormat, parameters) {
|
|
2313
2393
|
return this.httpClient.post("/jobs", {
|
|
2314
2394
|
fileId: fileId,
|
|
2315
2395
|
outputFormat: outputFormat,
|
|
2316
2396
|
parameters: parseArgs(parameters)
|
|
2317
|
-
}).then(
|
|
2397
|
+
}).then(response => response.json()).then(data => new Job(data, this.httpClient));
|
|
2318
2398
|
}
|
|
2319
2399
|
deleteJob(jobId) {
|
|
2320
|
-
return this.httpClient.delete(`/jobs/${jobId}`).then(
|
|
2400
|
+
return this.httpClient.delete(`/jobs/${jobId}`).then(response => response.json());
|
|
2321
2401
|
}
|
|
2322
2402
|
getAssemblies(start, limit, name, ids, sortByDesc, sortField) {
|
|
2323
2403
|
const searchParams = new URLSearchParams;
|
|
@@ -2333,13 +2413,13 @@ class Client extends EventEmitter2 {
|
|
|
2333
2413
|
if (sortField) searchParams.set("sortField", sortField);
|
|
2334
2414
|
let queryString = searchParams.toString();
|
|
2335
2415
|
if (queryString) queryString = "?" + queryString;
|
|
2336
|
-
return this.httpClient.get(`/assemblies${queryString}`).then(
|
|
2416
|
+
return this.httpClient.get(`/assemblies${queryString}`).then(response => response.json()).then(assemblies => ({
|
|
2337
2417
|
...assemblies,
|
|
2338
|
-
result: assemblies.result.map(
|
|
2339
|
-
}))
|
|
2418
|
+
result: assemblies.result.map(data => new Assembly(data, this.httpClient))
|
|
2419
|
+
}));
|
|
2340
2420
|
}
|
|
2341
2421
|
getAssembly(assemblyId) {
|
|
2342
|
-
return this.httpClient.get(`/assemblies/${assemblyId}`).then(
|
|
2422
|
+
return this.httpClient.get(`/assemblies/${assemblyId}`).then(response => response.json()).then(data => new Assembly(data, this.httpClient));
|
|
2343
2423
|
}
|
|
2344
2424
|
createAssembly(files, name, params = {}) {
|
|
2345
2425
|
const jobParameters = params.jobParameters || {};
|
|
@@ -2350,10 +2430,10 @@ class Client extends EventEmitter2 {
|
|
|
2350
2430
|
geometry: parseArgs(jobParameters.geometry),
|
|
2351
2431
|
properties: parseArgs(jobParameters.properties)
|
|
2352
2432
|
}
|
|
2353
|
-
}).then(
|
|
2433
|
+
}).then(response => response.json()).then(data => new Assembly(data, this.httpClient)).then(result => params.waitForDone ? result.waitForDone(params) : result);
|
|
2354
2434
|
}
|
|
2355
2435
|
deleteAssembly(assemblyId) {
|
|
2356
|
-
return this.httpClient.delete(`/assemblies/${assemblyId}`).then(
|
|
2436
|
+
return this.httpClient.delete(`/assemblies/${assemblyId}`).then(response => response.json());
|
|
2357
2437
|
}
|
|
2358
2438
|
getProjects(start, limit, name, ids, sortByDesc) {
|
|
2359
2439
|
const searchParams = new URLSearchParams;
|
|
@@ -2368,11 +2448,11 @@ class Client extends EventEmitter2 {
|
|
|
2368
2448
|
if (sortByDesc !== undefined) searchParams.set("sortBy", sortByDesc ? "desc" : "asc");
|
|
2369
2449
|
let queryString = searchParams.toString();
|
|
2370
2450
|
if (queryString) queryString = "?" + queryString;
|
|
2371
|
-
return this.httpClient.get(`/projects${queryString}`).then(
|
|
2451
|
+
return this.httpClient.get(`/projects${queryString}`).then(response => response.json()).then(projects => {
|
|
2372
2452
|
if (Array.isArray(projects)) {
|
|
2373
2453
|
let result = projects;
|
|
2374
|
-
if (ids) result = result.filter(
|
|
2375
|
-
if (name) result = result.filter(
|
|
2454
|
+
if (ids) result = result.filter(x => ids.includes(x.id));
|
|
2455
|
+
if (name) result = result.filter(x => x.name.includes(name));
|
|
2376
2456
|
if (limit > 0) {
|
|
2377
2457
|
const begin = start > 0 ? start : 0;
|
|
2378
2458
|
result = result.slice(begin, begin + limit);
|
|
@@ -2386,13 +2466,13 @@ class Client extends EventEmitter2 {
|
|
|
2386
2466
|
};
|
|
2387
2467
|
}
|
|
2388
2468
|
return projects;
|
|
2389
|
-
})
|
|
2469
|
+
}).then(projects => ({
|
|
2390
2470
|
...projects,
|
|
2391
|
-
result: projects.result.map(
|
|
2392
|
-
}))
|
|
2471
|
+
result: projects.result.map(data => new Project(data, this.httpClient))
|
|
2472
|
+
}));
|
|
2393
2473
|
}
|
|
2394
2474
|
getProject(projectId) {
|
|
2395
|
-
return this.httpClient.get(`/projects/${projectId}`).then(
|
|
2475
|
+
return this.httpClient.get(`/projects/${projectId}`).then(response => response.json()).then(data => new Project(data, this.httpClient));
|
|
2396
2476
|
}
|
|
2397
2477
|
createProject(name, description, startDate, endDate) {
|
|
2398
2478
|
return this.httpClient.post("/projects", {
|
|
@@ -2400,10 +2480,10 @@ class Client extends EventEmitter2 {
|
|
|
2400
2480
|
description: description,
|
|
2401
2481
|
startDate: startDate instanceof Date ? startDate.toISOString() : startDate,
|
|
2402
2482
|
endDate: endDate instanceof Date ? endDate.toISOString() : endDate
|
|
2403
|
-
}).then(
|
|
2483
|
+
}).then(response => response.json()).then(data => new Project(data, this.httpClient));
|
|
2404
2484
|
}
|
|
2405
2485
|
deleteProject(projectId) {
|
|
2406
|
-
return this.httpClient.delete(`/projects/${projectId}`).then(
|
|
2486
|
+
return this.httpClient.delete(`/projects/${projectId}`).then(response => response.text()).then(text => {
|
|
2407
2487
|
try {
|
|
2408
2488
|
return JSON.parse(text);
|
|
2409
2489
|
} catch {
|
|
@@ -2411,30 +2491,61 @@ class Client extends EventEmitter2 {
|
|
|
2411
2491
|
id: projectId
|
|
2412
2492
|
};
|
|
2413
2493
|
}
|
|
2414
|
-
})
|
|
2494
|
+
});
|
|
2415
2495
|
}
|
|
2416
2496
|
getSharedLink(token) {
|
|
2417
|
-
return this.httpClient.get(`/shares/${token}`).then(
|
|
2497
|
+
return this.httpClient.get(`/shares/${token}`).then(response => response.json()).then(data => new SharedLink(data, this.httpClient));
|
|
2418
2498
|
}
|
|
2419
2499
|
createSharedLink(fileId, permissions) {
|
|
2420
2500
|
return this.httpClient.post("/shares", {
|
|
2421
2501
|
fileId: fileId,
|
|
2422
2502
|
permissions: permissions
|
|
2423
|
-
}).then(
|
|
2503
|
+
}).then(response => response.json()).then(data => new SharedLink(data, this.httpClient));
|
|
2424
2504
|
}
|
|
2425
2505
|
deleteSharedLink(token) {
|
|
2426
|
-
return this.httpClient.delete(`/shares/${token}`).then(
|
|
2506
|
+
return this.httpClient.delete(`/shares/${token}`).then(response => response.json());
|
|
2427
2507
|
}
|
|
2428
2508
|
getSharedFile(token, password) {
|
|
2429
2509
|
return this.httpClient.get(`/shares/${token}/info`, {
|
|
2430
2510
|
headers: {
|
|
2431
2511
|
"InWeb-Password": password
|
|
2432
2512
|
}
|
|
2433
|
-
}).then(
|
|
2513
|
+
}).then(response => response.json()).then(data => new SharedFile(data, password, this.httpClient));
|
|
2514
|
+
}
|
|
2515
|
+
getPlugins() {
|
|
2516
|
+
return this.httpClient.get("/plugins").then(response => response.json()).then(array => array.map(data => new Plugin(data, this.httpClient)));
|
|
2517
|
+
}
|
|
2518
|
+
getPlugin(name, version) {
|
|
2519
|
+
return this.httpClient.get(`/plugins/${name}/${version}`).then(response => response.json()).then(data => new Plugin(data, this.httpClient));
|
|
2520
|
+
}
|
|
2521
|
+
async uploadPlugin(file, onProgress) {
|
|
2522
|
+
return await this.httpClient.uploadFile("/plugins", file, progress => {
|
|
2523
|
+
this.emitEvent({
|
|
2524
|
+
type: "uploadprogress",
|
|
2525
|
+
data: progress,
|
|
2526
|
+
file: file
|
|
2527
|
+
});
|
|
2528
|
+
if (onProgress) onProgress(progress, file);
|
|
2529
|
+
}).then(xhr => JSON.parse(xhr.responseText)).then(data => new Plugin(data, this.httpClient));
|
|
2530
|
+
}
|
|
2531
|
+
deletePlugin(name, version) {
|
|
2532
|
+
return this.httpClient.delete(`/plugins/${name}/${version}`).then(response => response.json());
|
|
2533
|
+
}
|
|
2534
|
+
downloadPlugin(name, version, onProgress, signal) {
|
|
2535
|
+
return this.httpClient.downloadFile(`/plugins/${name}/${version}/download`, onProgress, {
|
|
2536
|
+
signal: signal
|
|
2537
|
+
}).then(response => response.arrayBuffer());
|
|
2538
|
+
}
|
|
2539
|
+
executePluginCommand(name, version, command, parameters) {
|
|
2540
|
+
const searchParams = new URLSearchParams;
|
|
2541
|
+
if (version) searchParams.set("version", version);
|
|
2542
|
+
let queryString = searchParams.toString();
|
|
2543
|
+
if (queryString) queryString = "?" + queryString;
|
|
2544
|
+
return this.httpClient.post(`/plugins/${name}/commands/${command}${queryString}`, parameters).then(response => response.json());
|
|
2434
2545
|
}
|
|
2435
2546
|
}
|
|
2436
2547
|
|
|
2437
|
-
const version = "26.9.
|
|
2548
|
+
const version = "26.9.3";
|
|
2438
2549
|
|
|
2439
|
-
export { Assembly, ClashTest, Client, Endpoint, FetchError, File, Job, Member, Model, OAuthClient, Permission, Project, Role, SharedFile, SharedLink, User, parseArgs, statusText, userFullName, userInitials, version, waitFor };
|
|
2550
|
+
export { Assembly, ClashTest, Client, Endpoint, FetchError, File, Job, Member, Model, OAuthClient, Permission, Plugin, Project, Role, SharedFile, SharedLink, User, parseArgs, statusText, userFullName, userInitials, version, waitFor };
|
|
2440
2551
|
//# sourceMappingURL=client.module.js.map
|