@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 CHANGED
@@ -13,6 +13,7 @@ Core capabilities:
13
13
  - Create and manage assemblies.
14
14
  - Create projects, manage project models and members.
15
15
  - Change server settings.
16
+ - Manage server plugins.
16
17
 
17
18
  This library is a part of [CDE SDK](https://www.opendesign.com/products/cde) by [Open Design Alliance](https://opendesign.com).
18
19
 
@@ -46,6 +47,7 @@ The `Client.js` package will be downloaded and installed. Then you're ready to i
46
47
 
47
48
  ```javascript
48
49
  import { Client } from "@inweb/client";
50
+
49
51
  const client = new Client({ serverUrl: "https://cloud.opendesign.com/api" });
50
52
  ```
51
53
 
package/dist/client.js CHANGED
@@ -444,11 +444,11 @@
444
444
  * or geometry data.
445
445
  *
446
446
  * @param dataId - Resource file name.
447
+ * @param requestId - Specify a non-empty `requestId` to append the `?requestId=` search parameter to
448
+ * the server request. If specified, server-side caching may not work.
447
449
  * @param ranges - A ranges of resource file contents to download. See
448
450
  * {@link https://developer.mozilla.org/docs/Web/HTTP/Guides/Range_requests | HTTP range requests} for
449
451
  * more details.
450
- * @param requestId - Specify a non-empty `requestId` to append the `?requestId=` search parameter to
451
- * the server request. If specified, server-side caching may not work.
452
452
  * @param onProgress - Download progress callback.
453
453
  * @param signal - An
454
454
  * {@link https://developer.mozilla.org/docs/Web/API/AbortController | AbortController} signal. Allows
@@ -545,9 +545,9 @@
545
545
  var _a, _b, _c;
546
546
  const timeout = params.timeout || 600000;
547
547
  const interval = params.interval || 3000;
548
- const signal = (_a = params.signal) !== null && _a !== undefined ? _a : new AbortController().signal;
549
- const abortError = (_b = params.abortError) !== null && _b !== undefined ? _b : new DOMException("Aborted", "AbortError");
550
- const timeoutError = (_c = params.timeoutError) !== null && _c !== undefined ? _c : new DOMException("Timeout", "TimeoutError");
548
+ const signal = (_a = params.signal) !== null && _a !== void 0 ? _a : new AbortController().signal;
549
+ const abortError = (_b = params.abortError) !== null && _b !== void 0 ? _b : new DOMException("Aborted", "AbortError");
550
+ const timeoutError = (_c = params.timeoutError) !== null && _c !== void 0 ? _c : new DOMException("Timeout", "TimeoutError");
551
551
  const end = performance.now() + timeout;
552
552
  let count = timeout / interval;
553
553
  do {
@@ -578,9 +578,9 @@
578
578
  function userFullName(firstName, lastName = "", userName = "") {
579
579
  var _a;
580
580
  if (firstName && typeof firstName !== "string") {
581
- return userFullName((_a = firstName.firstName) !== null && _a !== undefined ? _a : firstName.name, firstName.lastName, firstName.userName);
581
+ return userFullName((_a = firstName.firstName) !== null && _a !== void 0 ? _a : firstName.name, firstName.lastName, firstName.userName);
582
582
  }
583
- return `${firstName !== null && firstName !== undefined ? firstName : ""} ${lastName !== null && lastName !== undefined ? lastName : ""}`.trim() || userName;
583
+ return `${firstName !== null && firstName !== void 0 ? firstName : ""} ${lastName !== null && lastName !== void 0 ? lastName : ""}`.trim() || userName;
584
584
  }
585
585
  function userInitials(fullName = "") {
586
586
  const names = fullName.split(" ").filter((x) => x);
@@ -812,7 +812,7 @@
812
812
  const checkDone = () => this.checkout().then((test) => {
813
813
  var _a;
814
814
  const ready = ["done", "failed"].includes(test.status);
815
- const cancel = (_a = params === null || params === undefined ? undefined : params.onCheckout) === null || _a === undefined ? undefined : _a.call(params, test, ready);
815
+ const cancel = (_a = params === null || params === void 0 ? void 0 : params.onCheckout) === null || _a === void 0 ? void 0 : _a.call(params, test, ready);
816
816
  return cancel || ready;
817
817
  });
818
818
  return waitFor(checkDone, params).then(() => this);
@@ -897,7 +897,7 @@
897
897
  this._data.owner.fullName = userFullName(this._data.owner);
898
898
  this._data.owner.initials = userInitials(this._data.owner.fullName);
899
899
  // associatedFiles since 23.12
900
- (_a = (_b = this._data).associatedFiles) !== null && _a !== undefined ? _a : (_b.associatedFiles = []);
900
+ (_a = (_b = this._data).associatedFiles) !== null && _a !== void 0 ? _a : (_b.associatedFiles = []);
901
901
  this._data.associatedFiles.forEach((file) => (file.link = `${this.httpClient.serverUrl}/files/${file.fileId}`));
902
902
  }
903
903
  /**
@@ -1205,11 +1205,11 @@
1205
1205
  * descriptions, or geometry data.
1206
1206
  *
1207
1207
  * @param dataId - Resource file name.
1208
+ * @param requestId - Specify a non-empty `requestId` to append the `?requestId=` search parameter to
1209
+ * the server request. If specified, server-side caching may not work.
1208
1210
  * @param ranges - A ranges of resource file contents to download. See
1209
1211
  * {@link https://developer.mozilla.org/docs/Web/HTTP/Guides/Range_requests | HTTP range requests} for
1210
1212
  * more details.
1211
- * @param requestId - Specify a non-empty `requestId` to append the `?requestId=` search parameter to
1212
- * the server request. If specified, server-side caching may not work.
1213
1213
  * @param onProgress - Download progress callback.
1214
1214
  * @param signal - An
1215
1215
  * {@link https://developer.mozilla.org/docs/Web/API/AbortController | AbortController} signal. Allows
@@ -1272,7 +1272,7 @@
1272
1272
  const checkDone = () => this.checkout().then((assembly) => {
1273
1273
  var _a;
1274
1274
  const ready = ["done", "failed"].includes(assembly.status);
1275
- const cancel = (_a = params === null || params === undefined ? undefined : params.onCheckout) === null || _a === undefined ? undefined : _a.call(params, assembly, ready);
1275
+ const cancel = (_a = params === null || params === void 0 ? void 0 : params.onCheckout) === null || _a === void 0 ? void 0 : _a.call(params, assembly, ready);
1276
1276
  return cancel || ready;
1277
1277
  });
1278
1278
  return waitFor(checkDone, params).then(() => this);
@@ -1372,7 +1372,7 @@
1372
1372
  * can be used to abort waiting as desired.
1373
1373
  */
1374
1374
  createClashTest(name, selectionTypeA, selectionTypeB, selectionSetA, selectionSetB, params) {
1375
- const { tolerance, clearance, waitForDone } = params !== null && params !== undefined ? params : {};
1375
+ const { tolerance, clearance, waitForDone } = params !== null && params !== void 0 ? params : {};
1376
1376
  if (!Array.isArray(selectionSetA))
1377
1377
  selectionSetA = [selectionSetA];
1378
1378
  if (!Array.isArray(selectionSetB))
@@ -1441,7 +1441,7 @@
1441
1441
  }
1442
1442
  removeEventListener(type, listener) {
1443
1443
  if (this._listeners[type] === undefined) return this;
1444
- const listeners = this._listeners[type].filter((x => x !== listener));
1444
+ const listeners = this._listeners[type].filter(x => x !== listener);
1445
1445
  if (listeners.length !== 0) this._listeners[type] = listeners; else delete this._listeners[type];
1446
1446
  return this;
1447
1447
  }
@@ -1452,7 +1452,7 @@
1452
1452
  emitEvent(event) {
1453
1453
  if (this._listeners[event.type] === undefined) return false;
1454
1454
  const invoke = this._listeners[event.type].slice();
1455
- invoke.forEach((listener => listener.call(this, event)));
1455
+ invoke.forEach(listener => listener.call(this, event));
1456
1456
  return true;
1457
1457
  }
1458
1458
  on(type, listener) {
@@ -2100,7 +2100,7 @@
2100
2100
  const checkDone = () => this.checkout().then((job) => {
2101
2101
  var _a;
2102
2102
  const ready = ["done", "failed"].includes(job.status);
2103
- const cancel = (_a = params === null || params === undefined ? undefined : params.onCheckout) === null || _a === undefined ? undefined : _a.call(params, job, ready);
2103
+ const cancel = (_a = params === null || params === void 0 ? void 0 : params.onCheckout) === null || _a === void 0 ? void 0 : _a.call(params, job, ready);
2104
2104
  return cancel || ready;
2105
2105
  });
2106
2106
  return waitFor(checkDone, params).then(() => this);
@@ -2306,28 +2306,28 @@
2306
2306
  // owner since 24.8
2307
2307
  if (typeof this._data.owner === "string")
2308
2308
  this._data.owner = { userId: this._data.owner };
2309
- (_a = (_p = this._data).owner) !== null && _a !== undefined ? _a : (_p.owner = {});
2309
+ (_a = (_p = this._data).owner) !== null && _a !== void 0 ? _a : (_p.owner = {});
2310
2310
  this._data.owner.avatarUrl = `${this.httpClient.serverUrl}/users/${this._data.owner.userId}/avatar`;
2311
2311
  this._data.owner.fullName = userFullName(this._data.owner);
2312
2312
  this._data.owner.initials = userInitials(this._data.owner.fullName);
2313
2313
  // status since 24.9
2314
- (_b = (_q = this._data).status) !== null && _b !== undefined ? _b : (_q.status = {});
2315
- (_c = (_r = this._data.status).geometry) !== null && _c !== undefined ? _c : (_r.geometry = { state: (_d = this._data.geometryStatus) !== null && _d !== undefined ? _d : "none" });
2316
- (_e = (_s = this._data.status).properties) !== null && _e !== undefined ? _e : (_s.properties = { state: (_f = this._data.propertiesStatus) !== null && _f !== undefined ? _f : "none" });
2317
- (_g = (_t = this._data.status).validation) !== null && _g !== undefined ? _g : (_t.validation = { state: (_h = this._data.validationStatus) !== null && _h !== undefined ? _h : "none" });
2314
+ (_b = (_q = this._data).status) !== null && _b !== void 0 ? _b : (_q.status = {});
2315
+ (_c = (_r = this._data.status).geometry) !== null && _c !== void 0 ? _c : (_r.geometry = { state: (_d = this._data.geometryStatus) !== null && _d !== void 0 ? _d : "none" });
2316
+ (_e = (_s = this._data.status).properties) !== null && _e !== void 0 ? _e : (_s.properties = { state: (_f = this._data.propertiesStatus) !== null && _f !== void 0 ? _f : "none" });
2317
+ (_g = (_t = this._data.status).validation) !== null && _g !== void 0 ? _g : (_t.validation = { state: (_h = this._data.validationStatus) !== null && _h !== void 0 ? _h : "none" });
2318
2318
  // updatedBy since 24.10
2319
- (_j = (_u = this._data).updatedBy) !== null && _j !== undefined ? _j : (_u.updatedBy = {});
2319
+ (_j = (_u = this._data).updatedBy) !== null && _j !== void 0 ? _j : (_u.updatedBy = {});
2320
2320
  this._data.updatedBy.avatarUrl = `${this.httpClient.serverUrl}/users/${this._data.updatedBy.userId}/avatar`;
2321
2321
  this._data.updatedBy.fullName = userFullName(this._data.updatedBy);
2322
2322
  this._data.updatedBy.initials = userInitials(this._data.updatedBy.fullName);
2323
2323
  // versions since 24.10
2324
- (_k = (_v = this._data).versions) !== null && _k !== undefined ? _k : (_v.versions = [{ ...value }]);
2324
+ (_k = (_v = this._data).versions) !== null && _k !== void 0 ? _k : (_v.versions = [{ ...value }]);
2325
2325
  // geometryGltf status since 24.12
2326
- (_l = (_w = this._data.status).geometryGltf) !== null && _l !== undefined ? _l : (_w.geometryGltf = { state: "none" });
2326
+ (_l = (_w = this._data.status).geometryGltf) !== null && _l !== void 0 ? _l : (_w.geometryGltf = { state: "none" });
2327
2327
  // isFileDeleted since 25.7
2328
- (_m = (_x = this._data).isFileDeleted) !== null && _m !== undefined ? _m : (_x.isFileDeleted = false);
2328
+ (_m = (_x = this._data).isFileDeleted) !== null && _m !== void 0 ? _m : (_x.isFileDeleted = false);
2329
2329
  // sharedLinkToken since 26.0
2330
- (_o = (_y = this._data).sharedLinkToken) !== null && _o !== undefined ? _o : (_y.sharedLinkToken = null);
2330
+ (_o = (_y = this._data).sharedLinkToken) !== null && _o !== void 0 ? _o : (_y.sharedLinkToken = null);
2331
2331
  }
2332
2332
  /**
2333
2333
  * Returns a list of file formats in which the active version of the file was exported.
@@ -2775,11 +2775,11 @@
2775
2775
  * contain model scene descriptions, or geometry data, or exported files.
2776
2776
  *
2777
2777
  * @param dataId - Resource file name.
2778
+ * @param requestId - Specify a non-empty `requestId` to append the `?requestId=` search parameter to
2779
+ * the server request. If specified, server-side caching may not work.
2778
2780
  * @param ranges - A ranges of resource file contents to download. See
2779
2781
  * {@link https://developer.mozilla.org/docs/Web/HTTP/Guides/Range_requests | HTTP range requests} for
2780
2782
  * more details.
2781
- * @param requestId - Specify a non-empty `requestId` to append the `?requestId=` search parameter to
2782
- * the server request. If specified, server-side caching may not work.
2783
2783
  * @param onProgress - Download progress callback.
2784
2784
  * @param signal - An
2785
2785
  * {@link https://developer.mozilla.org/docs/Web/API/AbortController | AbortController} signal. Allows
@@ -2844,8 +2844,8 @@
2844
2844
  * {@link downloadResource | downloadResource()} to download the exported file.
2845
2845
  * - Other custom job name. Custom job must be registered in the job templates before running.
2846
2846
  *
2847
- * @param parameters - Parameters for the File Converter jobs or custom job. Can be given as command
2848
- * line arguments in form `--arg=value`.
2847
+ * @param parameters - Parameters for the File Converter jobs or custom job. Can be given as JSON
2848
+ * object or command line arguments in form `--arg=value`.
2849
2849
  */
2850
2850
  createJob(outputFormat, parameters) {
2851
2851
  const jobs = new Endpoint("/jobs", this.httpClient, this.headers);
@@ -2925,7 +2925,7 @@
2925
2925
  return ["none", "done", "failed"].includes(jobStatus.state || "none");
2926
2926
  });
2927
2927
  const ready = waitAll ? readyJobs.length === waitJobs.length : readyJobs.length > 0;
2928
- const cancel = (_a = params === null || params === undefined ? undefined : params.onCheckout) === null || _a === undefined ? undefined : _a.call(params, file, ready);
2928
+ const cancel = (_a = params === null || params === void 0 ? void 0 : params.onCheckout) === null || _a === void 0 ? void 0 : _a.call(params, file, ready);
2929
2929
  return cancel || ready;
2930
2930
  });
2931
2931
  return waitFor(checkDone, params).then(() => this);
@@ -3022,7 +3022,7 @@
3022
3022
  waitForDone: false,
3023
3023
  }) {
3024
3024
  const result = await this.httpClient
3025
- .uploadFile(this.getEndpointPath("/versions"), file, (progress) => { var _a; return (_a = params.onProgress) === null || _a === undefined ? undefined : _a.call(params, progress, file); }, {
3025
+ .uploadFile(this.getEndpointPath("/versions"), file, (progress) => { var _a; return (_a = params.onProgress) === null || _a === void 0 ? void 0 : _a.call(params, progress, file); }, {
3026
3026
  headers: this.headers,
3027
3027
  })
3028
3028
  .then((xhr) => JSON.parse(xhr.responseText))
@@ -3863,7 +3863,7 @@
3863
3863
  .then((data) => new File(data, this.httpClient));
3864
3864
  const permissions = await file.getPermissions();
3865
3865
  await Promise.allSettled(permissions
3866
- .filter((permission) => permission.grantedTo.some((x) => { var _a; return ((_a = x.project) === null || _a === undefined ? undefined : _a.id) === this.id; }))
3866
+ .filter((permission) => permission.grantedTo.some((x) => { var _a; return ((_a = x.project) === null || _a === void 0 ? void 0 : _a.id) === this.id; }))
3867
3867
  .map((permission) => permission.delete()));
3868
3868
  return file;
3869
3869
  }
@@ -4501,6 +4501,221 @@
4501
4501
  }
4502
4502
  }
4503
4503
 
4504
+ ///////////////////////////////////////////////////////////////////////////////
4505
+ // Copyright (C) 2002-2025, Open Design Alliance (the "Alliance").
4506
+ // All rights reserved.
4507
+ //
4508
+ // This software and its documentation and related materials are owned by
4509
+ // the Alliance. The software may only be incorporated into application
4510
+ // programs owned by members of the Alliance, subject to a signed
4511
+ // Membership Agreement and Supplemental Software License Agreement with the
4512
+ // Alliance. The structure and organization of this software are the valuable
4513
+ // trade secrets of the Alliance and its suppliers. The software is also
4514
+ // protected by copyright law and international treaty provisions. Application
4515
+ // programs incorporating this software must include the following statement
4516
+ // with their copyright notices:
4517
+ //
4518
+ // This application incorporates Open Design Alliance software pursuant to a
4519
+ // license agreement with Open Design Alliance.
4520
+ // Open Design Alliance Copyright (C) 2002-2025 by Open Design Alliance.
4521
+ // All rights reserved.
4522
+ //
4523
+ // By use of this software, its documentation or related materials, you
4524
+ // acknowledge and accept the above terms.
4525
+ ///////////////////////////////////////////////////////////////////////////////
4526
+ /**
4527
+ * Provides properties and methods for obtaining information about a server plugin on the Open Cloud
4528
+ * Server and managing its data.
4529
+ */
4530
+ class Plugin extends Endpoint {
4531
+ /**
4532
+ * @param data - Raw plugin data received from the server. For more information, see
4533
+ * {@link https://cloud.opendesign.com/docs//pages/server/api.html#Plugin | Open Cloud Plugins API}.
4534
+ * @param httpClient - HTTP client instance used to send requests to the REST API server.
4535
+ */
4536
+ constructor(data, httpClient) {
4537
+ super(`/plugins/${data.name}/${data.version}`, httpClient);
4538
+ this.data = data;
4539
+ }
4540
+ /**
4541
+ * Plugin author information. The `author` is an object with a `name` field and optionally `url` and
4542
+ * `email`. Or it can be shorten that all into a single string.
4543
+ *
4544
+ * @readonly
4545
+ */
4546
+ get author() {
4547
+ return this.data.author;
4548
+ }
4549
+ /**
4550
+ * Raw plugin data received from the server. For more information, see
4551
+ * {@link https://cloud.opendesign.com/docs//pages/server/api.html#Plugin | Open Cloud Plugins API}.
4552
+ */
4553
+ get data() {
4554
+ return this._data;
4555
+ }
4556
+ set data(value) {
4557
+ this._data = value;
4558
+ }
4559
+ /**
4560
+ * Short description of the plugin.
4561
+ *
4562
+ * @readonly
4563
+ */
4564
+ get description() {
4565
+ return this.data.description;
4566
+ }
4567
+ /**
4568
+ * Plugin state.
4569
+ *
4570
+ * @readonly
4571
+ */
4572
+ get enabled() {
4573
+ return this.data.enabled;
4574
+ }
4575
+ /**
4576
+ * The URL to the plugin homepage.
4577
+ *
4578
+ * @readonly
4579
+ */
4580
+ get homepage() {
4581
+ return this.data.homepage;
4582
+ }
4583
+ /**
4584
+ * Unique plugin ID.
4585
+ *
4586
+ * @readonly
4587
+ */
4588
+ get id() {
4589
+ return this.data.id;
4590
+ }
4591
+ /**
4592
+ * A license for the plugin.
4593
+ *
4594
+ * @readonly
4595
+ */
4596
+ get license() {
4597
+ return this.data.license;
4598
+ }
4599
+ /**
4600
+ * Plugin name.
4601
+ *
4602
+ * @readonly
4603
+ */
4604
+ get name() {
4605
+ return this.data.name;
4606
+ }
4607
+ /**
4608
+ * API permissions required.
4609
+ *
4610
+ * @readonly
4611
+ */
4612
+ get permissions() {
4613
+ return this.data.permissions;
4614
+ }
4615
+ /**
4616
+ * Plugin type. Can be set of:
4617
+ *
4618
+ * - `app` - Viewer plugin, the client‑side web app that the server hosts and serves as static content.
4619
+ * - `server` - Binary dll that extends server functionality.
4620
+ * - `jobrunner` - Binary dll that adds a new Job Runner on the server.
4621
+ *
4622
+ * @readonly
4623
+ */
4624
+ get pluginType() {
4625
+ return this.data.pluginType;
4626
+ }
4627
+ /**
4628
+ * {@link https://semver.org/ | SemVer} compatible version of the plugin.
4629
+ *
4630
+ * @readonly
4631
+ */
4632
+ get version() {
4633
+ return this.data.version;
4634
+ }
4635
+ /**
4636
+ * Reloads plugin data from the server.
4637
+ */
4638
+ async checkout() {
4639
+ const response = await this.get("");
4640
+ this.data = await response.json();
4641
+ return this;
4642
+ }
4643
+ /**
4644
+ * Uninstalls and deletes a plugin from the server.
4645
+ *
4646
+ * @returns Returns the raw data of a deleted plugin. For more information, see
4647
+ * {@link https://cloud.opendesign.com/docs//pages/server/api.html#Plugin | Open Cloud Plugins API}.
4648
+ */
4649
+ delete() {
4650
+ return super.delete("").then((response) => response.json());
4651
+ }
4652
+ /**
4653
+ * Enables a plugin.
4654
+ */
4655
+ async enable() {
4656
+ const response = await this.put("/enable");
4657
+ this.data = await response.json();
4658
+ return this;
4659
+ }
4660
+ /**
4661
+ * Disables a plugin.
4662
+ */
4663
+ async disable() {
4664
+ const response = await this.put("/disable");
4665
+ this.data = await response.json();
4666
+ return this;
4667
+ }
4668
+ /**
4669
+ * Downloads the plugins package from the server.
4670
+ *
4671
+ * @param onProgress - Download progress callback.
4672
+ * @param signal - An
4673
+ * {@link https://developer.mozilla.org/docs/Web/API/AbortController | AbortController} signal. Allows
4674
+ * to communicate with a fetch request and abort it if desired.
4675
+ */
4676
+ download(onProgress, signal) {
4677
+ return this.httpClient
4678
+ .downloadFile(this.getEndpointPath("/download"), onProgress, { signal, headers: this.headers })
4679
+ .then((response) => response.arrayBuffer());
4680
+ }
4681
+ /**
4682
+ * Returns a plugin manfest.
4683
+ */
4684
+ getManifest() {
4685
+ return this.get("/manifest").then((response) => response.json());
4686
+ }
4687
+ /**
4688
+ * Returns the plugin settings.
4689
+ *
4690
+ * @returns Returns an object with plugin settings.
4691
+ */
4692
+ getSettings() {
4693
+ return this.get("/settings").then((response) => response.json());
4694
+ }
4695
+ /**
4696
+ * Changes the plugin settings.
4697
+ *
4698
+ * @param settings - An object with the new plugin settings or part of the settings.
4699
+ * @returns Returns an object with updated plugin settings.
4700
+ */
4701
+ updateSettings(settings) {
4702
+ return this.post("/settings", settings).then((response) => response.json());
4703
+ }
4704
+ /**
4705
+ * Executes a plugin command.
4706
+ *
4707
+ * This method executes the command for the current version of the plugin. To execute a command for the
4708
+ * latest installed version of the plugin, use the {@link Client.executePluginCommand}.
4709
+ *
4710
+ * @param command - Command to execute.
4711
+ * @param parameters - Command parameters. Command-dependent.
4712
+ */
4713
+ executeCommand(command, parameters) {
4714
+ const commands = new Endpoint(`/plugins/${this.name}/commands`, this.httpClient, this.headers);
4715
+ return commands.post(`/${command}?version=${this.version}`, parameters).then((response) => response.json());
4716
+ }
4717
+ }
4718
+
4504
4719
  ///////////////////////////////////////////////////////////////////////////////
4505
4720
  // Copyright (C) 2002-2025, Open Design Alliance (the "Alliance").
4506
4721
  // All rights reserved.
@@ -4625,7 +4840,7 @@
4625
4840
  .then((data) => ({
4626
4841
  ...data,
4627
4842
  server: data.version,
4628
- client: "26.9.1",
4843
+ client: "26.9.3",
4629
4844
  }));
4630
4845
  }
4631
4846
  /**
@@ -4644,7 +4859,7 @@
4644
4859
  .post("/register", {
4645
4860
  email,
4646
4861
  password,
4647
- userName: userName !== null && userName !== undefined ? userName : (email + "").split("@").at(0),
4862
+ userName: userName !== null && userName !== void 0 ? userName : (email + "").split("@").shift(),
4648
4863
  })
4649
4864
  .then((response) => response.json());
4650
4865
  }
@@ -4908,7 +5123,7 @@
4908
5123
  userBrief: {
4909
5124
  ...rest,
4910
5125
  email,
4911
- userName: userName !== null && userName !== undefined ? userName : (email + "").split("@").at(0),
5126
+ userName: userName !== null && userName !== void 0 ? userName : (email + "").split("@").shift(),
4912
5127
  },
4913
5128
  password,
4914
5129
  })
@@ -5064,7 +5279,7 @@
5064
5279
  .uploadFile("/files", file, (progress) => {
5065
5280
  var _a;
5066
5281
  this.emitEvent({ type: "uploadprogress", data: progress, file });
5067
- (_a = params.onProgress) === null || _a === undefined ? undefined : _a.call(params, progress, file);
5282
+ (_a = params.onProgress) === null || _a === void 0 ? void 0 : _a.call(params, progress, file);
5068
5283
  })
5069
5284
  .then((xhr) => JSON.parse(xhr.responseText))
5070
5285
  .then((data) => new File(data, this.httpClient));
@@ -5182,8 +5397,8 @@
5182
5397
  * - `dwg`, `obj`, `gltf`, `glb`, `vsf`, `pdf`, `3dpdf` - Export file to the specified format.
5183
5398
  * - Other custom job name. Custom job must be registered in the job templates before running.
5184
5399
  *
5185
- * @param parameters - Parameters for the File Converter jobs or custom job. Can be given as command
5186
- * line arguments in form `--arg=value`.
5400
+ * @param parameters - Parameters for the File Converter jobs or custom job. Can be given as JSON
5401
+ * object or command line arguments in form `--arg=value`.
5187
5402
  */
5188
5403
  createJob(fileId, outputFormat, parameters) {
5189
5404
  return this.httpClient
@@ -5279,8 +5494,8 @@
5279
5494
  * @param name - Assembly name.
5280
5495
  * @param params - Additional assembly creating parameters.
5281
5496
  * @param params.jobParameters - Parameters for the File Converter jobs. Use this to specify aditional
5282
- * parameters for generating the geometry and properties of the new assembly. Can be given as command
5283
- * line arguments in form `--arg=value`.
5497
+ * parameters for generating the geometry and properties of the new assembly. Can be given as JSON
5498
+ * object or command line arguments in form `--arg=value`.
5284
5499
  * @param params.waitForDone - Wait for assembly to be created.
5285
5500
  * @param params.timeout - The time, in milliseconds, that the function should wait for the assembly to
5286
5501
  * be created. If the assembly is not created within this time, a TimeoutError exception will be
@@ -5500,6 +5715,108 @@
5500
5715
  .then((response) => response.json())
5501
5716
  .then((data) => new SharedFile(data, password, this.httpClient));
5502
5717
  }
5718
+ /**
5719
+ * Returns the list of installed plugins.
5720
+ *
5721
+ * Only administrators can get a list of plugins. If the current logged in user is not an
5722
+ * administrator, an exception will be thrown.
5723
+ */
5724
+ getPlugins() {
5725
+ return this.httpClient
5726
+ .get("/plugins")
5727
+ .then((response) => response.json())
5728
+ .then((array) => array.map((data) => new Plugin(data, this.httpClient)));
5729
+ }
5730
+ /**
5731
+ * Returns information about the specified plugin.
5732
+ *
5733
+ * Only administrators can get plugins. If the current logged in user is not an administrator, they can
5734
+ * only get themselves, otherwise an exception will be thrown.
5735
+ *
5736
+ * @param name - Plugin name.
5737
+ * @param version - Plugin version.
5738
+ */
5739
+ getPlugin(name, version) {
5740
+ return this.httpClient
5741
+ .get(`/plugins/${name}/${version}`)
5742
+ .then((response) => response.json())
5743
+ .then((data) => new Plugin(data, this.httpClient));
5744
+ }
5745
+ /**
5746
+ * Uploads and install a plugin package to the server. The package must be a ZIP file and undergoes
5747
+ * verification, scanning, and health checks during installation.
5748
+ *
5749
+ * Only administrators can upload plugins. If the current logged in user is not an administrator, an
5750
+ * exception will be thrown.
5751
+ *
5752
+ * @param file - {@link https://developer.mozilla.org/docs/Web/API/File | Web API File} object are
5753
+ * generally retrieved from a {@link https://developer.mozilla.org/docs/Web/API/FileList | FileList}
5754
+ * object returned as a result of a user selecting files using the HTML `<input>` element.
5755
+ * @param onProgress - Upload progress callback.
5756
+ */
5757
+ async uploadPlugin(file, onProgress) {
5758
+ return await this.httpClient
5759
+ .uploadFile("/plugins", file, (progress) => {
5760
+ this.emitEvent({ type: "uploadprogress", data: progress, file });
5761
+ if (onProgress)
5762
+ onProgress(progress, file);
5763
+ })
5764
+ .then((xhr) => JSON.parse(xhr.responseText))
5765
+ .then((data) => new Plugin(data, this.httpClient));
5766
+ }
5767
+ /**
5768
+ * Uninstalls and deletes the specified plugin from the server.
5769
+ *
5770
+ * Only administrators can delete plugins. If the current logged in user is not an administrator, an
5771
+ * exception will be thrown.
5772
+ *
5773
+ * @param name - Plugin name.
5774
+ * @param version - Plugin version.
5775
+ */
5776
+ deletePlugin(name, version) {
5777
+ return this.httpClient.delete(`/plugins/${name}/${version}`).then((response) => response.json());
5778
+ }
5779
+ /**
5780
+ * Downloads the specified plugin package from the server.
5781
+ *
5782
+ * Only administrators can download plugins. If the current logged in user is not an administrator, an
5783
+ * exception will be thrown.
5784
+ *
5785
+ * @param name - Plugin name.
5786
+ * @param version - Plugin version.
5787
+ * @param onProgress - Download progress callback.
5788
+ * @param signal - An
5789
+ * {@link https://developer.mozilla.org/docs/Web/API/AbortController | AbortController} signal. Allows
5790
+ * to communicate with a fetch request and abort it if desired.
5791
+ */
5792
+ downloadPlugin(name, version, onProgress, signal) {
5793
+ return this.httpClient
5794
+ .downloadFile(`/plugins/${name}/${version}/download`, onProgress, { signal })
5795
+ .then((response) => response.arrayBuffer());
5796
+ }
5797
+ /**
5798
+ * Executes a plugin command.
5799
+ *
5800
+ * If you have multiple versions of a plugin installed and want to run the command for the latest
5801
+ * version of the plugin, specify `undefined` or empty string for the `version` parameter.
5802
+ *
5803
+ * @param name - Plugin name.
5804
+ * @param version - Plugin version. Specify `undefined` or empty string to run the command for the
5805
+ * latest version of the plugin.
5806
+ * @param command - Command to execute.
5807
+ * @param parameters - Command parameters. Command-dependent.
5808
+ */
5809
+ executePluginCommand(name, version, command, parameters) {
5810
+ const searchParams = new URLSearchParams();
5811
+ if (version)
5812
+ searchParams.set("version", version);
5813
+ let queryString = searchParams.toString();
5814
+ if (queryString)
5815
+ queryString = "?" + queryString;
5816
+ return this.httpClient
5817
+ .post(`/plugins/${name}/commands/${command}${queryString}`, parameters)
5818
+ .then((response) => response.json());
5819
+ }
5503
5820
  }
5504
5821
 
5505
5822
  ///////////////////////////////////////////////////////////////////////////////
@@ -5524,7 +5841,7 @@
5524
5841
  // By use of this software, its documentation or related materials, you
5525
5842
  // acknowledge and accept the above terms.
5526
5843
  ///////////////////////////////////////////////////////////////////////////////
5527
- const version = "26.9.1";
5844
+ const version = "26.9.3";
5528
5845
 
5529
5846
  exports.Assembly = Assembly;
5530
5847
  exports.ClashTest = ClashTest;
@@ -5537,6 +5854,7 @@
5537
5854
  exports.Model = Model;
5538
5855
  exports.OAuthClient = OAuthClient;
5539
5856
  exports.Permission = Permission;
5857
+ exports.Plugin = Plugin;
5540
5858
  exports.Project = Project;
5541
5859
  exports.Role = Role;
5542
5860
  exports.SharedFile = SharedFile;