@inweb/client 26.9.0 → 26.9.2
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 +326 -8
- package/dist/client.js.map +1 -1
- package/dist/client.min.js +1 -1
- package/dist/client.module.js +114 -3
- package/dist/client.module.js.map +1 -1
- package/lib/Api/Client.d.ts +72 -4
- package/lib/Api/File.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/Client.ts +119 -4
- package/src/Api/File.ts +2 -2
- package/src/Api/Plugin.ts +241 -0
- package/src/index.ts +1 -0
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
|
@@ -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
|
|
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);
|
|
@@ -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.
|
|
4843
|
+
client: "26.9.2",
|
|
4629
4844
|
}));
|
|
4630
4845
|
}
|
|
4631
4846
|
/**
|
|
@@ -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
|
|
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
|
|
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.
|
|
5844
|
+
const version = "26.9.2";
|
|
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;
|