@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/lib/Api/Assembly.d.ts
CHANGED
|
@@ -250,11 +250,11 @@ export declare class Assembly extends Endpoint {
|
|
|
250
250
|
* descriptions, or geometry data.
|
|
251
251
|
*
|
|
252
252
|
* @param dataId - Resource file name.
|
|
253
|
+
* @param requestId - Specify a non-empty `requestId` to append the `?requestId=` search parameter to
|
|
254
|
+
* the server request. If specified, server-side caching may not work.
|
|
253
255
|
* @param ranges - A ranges of resource file contents to download. See
|
|
254
256
|
* {@link https://developer.mozilla.org/docs/Web/HTTP/Guides/Range_requests | HTTP range requests} for
|
|
255
257
|
* more details.
|
|
256
|
-
* @param requestId - Specify a non-empty `requestId` to append the `?requestId=` search parameter to
|
|
257
|
-
* the server request. If specified, server-side caching may not work.
|
|
258
258
|
* @param onProgress - Download progress callback.
|
|
259
259
|
* @param signal - An
|
|
260
260
|
* {@link https://developer.mozilla.org/docs/Web/API/AbortController | AbortController} signal. Allows
|
package/lib/Api/Client.d.ts
CHANGED
|
@@ -9,6 +9,7 @@ import { User } from "./User";
|
|
|
9
9
|
import { OAuthClient } from "./OAuthClient";
|
|
10
10
|
import { ISharedLinkPermissions } from "./ISharedLink";
|
|
11
11
|
import { SharedLink } from "./SharedLink";
|
|
12
|
+
import { Plugin } from "./Plugin";
|
|
12
13
|
/**
|
|
13
14
|
* Provides methods for managing Open Cloud Server resources such as users, files, assemblies, jobs,
|
|
14
15
|
* projects, etc.
|
|
@@ -413,8 +414,8 @@ export declare class Client extends EventEmitter2<ClientEventMap> {
|
|
|
413
414
|
* - `dwg`, `obj`, `gltf`, `glb`, `vsf`, `pdf`, `3dpdf` - Export file to the specified format.
|
|
414
415
|
* - Other custom job name. Custom job must be registered in the job templates before running.
|
|
415
416
|
*
|
|
416
|
-
* @param parameters - Parameters for the File Converter jobs or custom job. Can be given as
|
|
417
|
-
* line arguments in form `--arg=value`.
|
|
417
|
+
* @param parameters - Parameters for the File Converter jobs or custom job. Can be given as JSON
|
|
418
|
+
* object or command line arguments in form `--arg=value`.
|
|
418
419
|
*/
|
|
419
420
|
createJob(fileId: string, outputFormat: string, parameters?: string | object): Promise<Job>;
|
|
420
421
|
/**
|
|
@@ -468,8 +469,8 @@ export declare class Client extends EventEmitter2<ClientEventMap> {
|
|
|
468
469
|
* @param name - Assembly name.
|
|
469
470
|
* @param params - Additional assembly creating parameters.
|
|
470
471
|
* @param params.jobParameters - Parameters for the File Converter jobs. Use this to specify aditional
|
|
471
|
-
* parameters for generating the geometry and properties of the new assembly. Can be given as
|
|
472
|
-
* line arguments in form `--arg=value`.
|
|
472
|
+
* parameters for generating the geometry and properties of the new assembly. Can be given as JSON
|
|
473
|
+
* object or command line arguments in form `--arg=value`.
|
|
473
474
|
* @param params.waitForDone - Wait for assembly to be created.
|
|
474
475
|
* @param params.timeout - The time, in milliseconds, that the function should wait for the assembly to
|
|
475
476
|
* be created. If the assembly is not created within this time, a TimeoutError exception will be
|
|
@@ -589,4 +590,71 @@ export declare class Client extends EventEmitter2<ClientEventMap> {
|
|
|
589
590
|
* @param password - Password to get access to the file.
|
|
590
591
|
*/
|
|
591
592
|
getSharedFile(token: string, password?: string): Promise<File>;
|
|
593
|
+
/**
|
|
594
|
+
* Returns the list of installed plugins.
|
|
595
|
+
*
|
|
596
|
+
* Only administrators can get a list of plugins. If the current logged in user is not an
|
|
597
|
+
* administrator, an exception will be thrown.
|
|
598
|
+
*/
|
|
599
|
+
getPlugins(): Promise<Plugin[]>;
|
|
600
|
+
/**
|
|
601
|
+
* Returns information about the specified plugin.
|
|
602
|
+
*
|
|
603
|
+
* Only administrators can get plugins. If the current logged in user is not an administrator, they can
|
|
604
|
+
* only get themselves, otherwise an exception will be thrown.
|
|
605
|
+
*
|
|
606
|
+
* @param name - Plugin name.
|
|
607
|
+
* @param version - Plugin version.
|
|
608
|
+
*/
|
|
609
|
+
getPlugin(name: string, version: string): Promise<Plugin>;
|
|
610
|
+
/**
|
|
611
|
+
* Uploads and install a plugin package to the server. The package must be a ZIP file and undergoes
|
|
612
|
+
* verification, scanning, and health checks during installation.
|
|
613
|
+
*
|
|
614
|
+
* Only administrators can upload plugins. If the current logged in user is not an administrator, an
|
|
615
|
+
* exception will be thrown.
|
|
616
|
+
*
|
|
617
|
+
* @param file - {@link https://developer.mozilla.org/docs/Web/API/File | Web API File} object are
|
|
618
|
+
* generally retrieved from a {@link https://developer.mozilla.org/docs/Web/API/FileList | FileList}
|
|
619
|
+
* object returned as a result of a user selecting files using the HTML `<input>` element.
|
|
620
|
+
* @param onProgress - Upload progress callback.
|
|
621
|
+
*/
|
|
622
|
+
uploadPlugin(file: globalThis.File, onProgress?: (progress: number, file: globalThis.File) => void): Promise<Plugin>;
|
|
623
|
+
/**
|
|
624
|
+
* Uninstalls and deletes the specified plugin from the server.
|
|
625
|
+
*
|
|
626
|
+
* Only administrators can delete plugins. If the current logged in user is not an administrator, an
|
|
627
|
+
* exception will be thrown.
|
|
628
|
+
*
|
|
629
|
+
* @param name - Plugin name.
|
|
630
|
+
* @param version - Plugin version.
|
|
631
|
+
*/
|
|
632
|
+
deletePlugin(name: string, version: string): Promise<Plugin>;
|
|
633
|
+
/**
|
|
634
|
+
* Downloads the specified plugin package from the server.
|
|
635
|
+
*
|
|
636
|
+
* Only administrators can download plugins. If the current logged in user is not an administrator, an
|
|
637
|
+
* exception will be thrown.
|
|
638
|
+
*
|
|
639
|
+
* @param name - Plugin name.
|
|
640
|
+
* @param version - Plugin version.
|
|
641
|
+
* @param onProgress - Download progress callback.
|
|
642
|
+
* @param signal - An
|
|
643
|
+
* {@link https://developer.mozilla.org/docs/Web/API/AbortController | AbortController} signal. Allows
|
|
644
|
+
* to communicate with a fetch request and abort it if desired.
|
|
645
|
+
*/
|
|
646
|
+
downloadPlugin(name: string, version: string, onProgress?: (progress: number) => void, signal?: AbortSignal): Promise<ArrayBuffer>;
|
|
647
|
+
/**
|
|
648
|
+
* Executes a plugin command.
|
|
649
|
+
*
|
|
650
|
+
* If you have multiple versions of a plugin installed and want to run the command for the latest
|
|
651
|
+
* version of the plugin, specify `undefined` or empty string for the `version` parameter.
|
|
652
|
+
*
|
|
653
|
+
* @param name - Plugin name.
|
|
654
|
+
* @param version - Plugin version. Specify `undefined` or empty string to run the command for the
|
|
655
|
+
* latest version of the plugin.
|
|
656
|
+
* @param command - Command to execute.
|
|
657
|
+
* @param parameters - Command parameters. Command-dependent.
|
|
658
|
+
*/
|
|
659
|
+
executePluginCommand(name: string, version: string, command: string, parameters?: BodyInit | object): Promise<any>;
|
|
592
660
|
}
|
package/lib/Api/File.d.ts
CHANGED
|
@@ -375,11 +375,11 @@ export declare class File extends Endpoint {
|
|
|
375
375
|
* contain model scene descriptions, or geometry data, or exported files.
|
|
376
376
|
*
|
|
377
377
|
* @param dataId - Resource file name.
|
|
378
|
+
* @param requestId - Specify a non-empty `requestId` to append the `?requestId=` search parameter to
|
|
379
|
+
* the server request. If specified, server-side caching may not work.
|
|
378
380
|
* @param ranges - A ranges of resource file contents to download. See
|
|
379
381
|
* {@link https://developer.mozilla.org/docs/Web/HTTP/Guides/Range_requests | HTTP range requests} for
|
|
380
382
|
* more details.
|
|
381
|
-
* @param requestId - Specify a non-empty `requestId` to append the `?requestId=` search parameter to
|
|
382
|
-
* the server request. If specified, server-side caching may not work.
|
|
383
383
|
* @param onProgress - Download progress callback.
|
|
384
384
|
* @param signal - An
|
|
385
385
|
* {@link https://developer.mozilla.org/docs/Web/API/AbortController | AbortController} signal. Allows
|
|
@@ -435,8 +435,8 @@ export declare class File extends Endpoint {
|
|
|
435
435
|
* {@link downloadResource | downloadResource()} to download the exported file.
|
|
436
436
|
* - Other custom job name. Custom job must be registered in the job templates before running.
|
|
437
437
|
*
|
|
438
|
-
* @param parameters - Parameters for the File Converter jobs or custom job. Can be given as
|
|
439
|
-
* line arguments in form `--arg=value`.
|
|
438
|
+
* @param parameters - Parameters for the File Converter jobs or custom job. Can be given as JSON
|
|
439
|
+
* object or command line arguments in form `--arg=value`.
|
|
440
440
|
*/
|
|
441
441
|
createJob(outputFormat: string, parameters?: string | object): Promise<Job>;
|
|
442
442
|
/**
|
package/lib/Api/Model.d.ts
CHANGED
|
@@ -146,11 +146,11 @@ export declare class Model extends Endpoint {
|
|
|
146
146
|
* or geometry data.
|
|
147
147
|
*
|
|
148
148
|
* @param dataId - Resource file name.
|
|
149
|
+
* @param requestId - Specify a non-empty `requestId` to append the `?requestId=` search parameter to
|
|
150
|
+
* the server request. If specified, server-side caching may not work.
|
|
149
151
|
* @param ranges - A ranges of resource file contents to download. See
|
|
150
152
|
* {@link https://developer.mozilla.org/docs/Web/HTTP/Guides/Range_requests | HTTP range requests} for
|
|
151
153
|
* more details.
|
|
152
|
-
* @param requestId - Specify a non-empty `requestId` to append the `?requestId=` search parameter to
|
|
153
|
-
* the server request. If specified, server-side caching may not work.
|
|
154
154
|
* @param onProgress - Download progress callback.
|
|
155
155
|
* @param signal - An
|
|
156
156
|
* {@link https://developer.mozilla.org/docs/Web/API/AbortController | AbortController} signal. Allows
|
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
import { IHttpClient } from "./IHttpClient";
|
|
2
|
+
import { Endpoint } from "./Endpoint";
|
|
3
|
+
/**
|
|
4
|
+
* Provides properties and methods for obtaining information about a server plugin on the Open Cloud
|
|
5
|
+
* Server and managing its data.
|
|
6
|
+
*/
|
|
7
|
+
export declare class Plugin extends Endpoint {
|
|
8
|
+
private _data;
|
|
9
|
+
/**
|
|
10
|
+
* @param data - Raw plugin data received from the server. For more information, see
|
|
11
|
+
* {@link https://cloud.opendesign.com/docs//pages/server/api.html#Plugin | Open Cloud Plugins API}.
|
|
12
|
+
* @param httpClient - HTTP client instance used to send requests to the REST API server.
|
|
13
|
+
*/
|
|
14
|
+
constructor(data: any, httpClient: IHttpClient);
|
|
15
|
+
/**
|
|
16
|
+
* Plugin author information. The `author` is an object with a `name` field and optionally `url` and
|
|
17
|
+
* `email`. Or it can be shorten that all into a single string.
|
|
18
|
+
*
|
|
19
|
+
* @readonly
|
|
20
|
+
*/
|
|
21
|
+
get author(): any;
|
|
22
|
+
/**
|
|
23
|
+
* Raw plugin data received from the server. For more information, see
|
|
24
|
+
* {@link https://cloud.opendesign.com/docs//pages/server/api.html#Plugin | Open Cloud Plugins API}.
|
|
25
|
+
*/
|
|
26
|
+
get data(): any;
|
|
27
|
+
set data(value: any);
|
|
28
|
+
/**
|
|
29
|
+
* Short description of the plugin.
|
|
30
|
+
*
|
|
31
|
+
* @readonly
|
|
32
|
+
*/
|
|
33
|
+
get description(): string;
|
|
34
|
+
/**
|
|
35
|
+
* Plugin state.
|
|
36
|
+
*
|
|
37
|
+
* @readonly
|
|
38
|
+
*/
|
|
39
|
+
get enabled(): boolean;
|
|
40
|
+
/**
|
|
41
|
+
* The URL to the plugin homepage.
|
|
42
|
+
*
|
|
43
|
+
* @readonly
|
|
44
|
+
*/
|
|
45
|
+
get homepage(): string;
|
|
46
|
+
/**
|
|
47
|
+
* Unique plugin ID.
|
|
48
|
+
*
|
|
49
|
+
* @readonly
|
|
50
|
+
*/
|
|
51
|
+
get id(): string;
|
|
52
|
+
/**
|
|
53
|
+
* A license for the plugin.
|
|
54
|
+
*
|
|
55
|
+
* @readonly
|
|
56
|
+
*/
|
|
57
|
+
get license(): string;
|
|
58
|
+
/**
|
|
59
|
+
* Plugin name.
|
|
60
|
+
*
|
|
61
|
+
* @readonly
|
|
62
|
+
*/
|
|
63
|
+
get name(): string;
|
|
64
|
+
/**
|
|
65
|
+
* API permissions required.
|
|
66
|
+
*
|
|
67
|
+
* @readonly
|
|
68
|
+
*/
|
|
69
|
+
get permissions(): string[];
|
|
70
|
+
/**
|
|
71
|
+
* Plugin type. Can be set of:
|
|
72
|
+
*
|
|
73
|
+
* - `app` - Viewer plugin, the client‑side web app that the server hosts and serves as static content.
|
|
74
|
+
* - `server` - Binary dll that extends server functionality.
|
|
75
|
+
* - `jobrunner` - Binary dll that adds a new Job Runner on the server.
|
|
76
|
+
*
|
|
77
|
+
* @readonly
|
|
78
|
+
*/
|
|
79
|
+
get pluginType(): string[];
|
|
80
|
+
/**
|
|
81
|
+
* {@link https://semver.org/ | SemVer} compatible version of the plugin.
|
|
82
|
+
*
|
|
83
|
+
* @readonly
|
|
84
|
+
*/
|
|
85
|
+
get version(): number;
|
|
86
|
+
/**
|
|
87
|
+
* Reloads plugin data from the server.
|
|
88
|
+
*/
|
|
89
|
+
checkout(): Promise<this>;
|
|
90
|
+
/**
|
|
91
|
+
* Uninstalls and deletes a plugin from the server.
|
|
92
|
+
*
|
|
93
|
+
* @returns Returns the raw data of a deleted plugin. For more information, see
|
|
94
|
+
* {@link https://cloud.opendesign.com/docs//pages/server/api.html#Plugin | Open Cloud Plugins API}.
|
|
95
|
+
*/
|
|
96
|
+
delete(): Promise<any>;
|
|
97
|
+
/**
|
|
98
|
+
* Enables a plugin.
|
|
99
|
+
*/
|
|
100
|
+
enable(): Promise<this>;
|
|
101
|
+
/**
|
|
102
|
+
* Disables a plugin.
|
|
103
|
+
*/
|
|
104
|
+
disable(): Promise<this>;
|
|
105
|
+
/**
|
|
106
|
+
* Downloads the plugins package from the server.
|
|
107
|
+
*
|
|
108
|
+
* @param onProgress - Download progress callback.
|
|
109
|
+
* @param signal - An
|
|
110
|
+
* {@link https://developer.mozilla.org/docs/Web/API/AbortController | AbortController} signal. Allows
|
|
111
|
+
* to communicate with a fetch request and abort it if desired.
|
|
112
|
+
*/
|
|
113
|
+
download(onProgress?: (progress: number) => void, signal?: AbortSignal): Promise<ArrayBuffer>;
|
|
114
|
+
/**
|
|
115
|
+
* Returns a plugin manfest.
|
|
116
|
+
*/
|
|
117
|
+
getManifest(): Promise<any>;
|
|
118
|
+
/**
|
|
119
|
+
* Returns the plugin settings.
|
|
120
|
+
*
|
|
121
|
+
* @returns Returns an object with plugin settings.
|
|
122
|
+
*/
|
|
123
|
+
getSettings(): Promise<any>;
|
|
124
|
+
/**
|
|
125
|
+
* Changes the plugin settings.
|
|
126
|
+
*
|
|
127
|
+
* @param settings - An object with the new plugin settings or part of the settings.
|
|
128
|
+
* @returns Returns an object with updated plugin settings.
|
|
129
|
+
*/
|
|
130
|
+
updateSettings(settings: any): Promise<any>;
|
|
131
|
+
/**
|
|
132
|
+
* Executes a plugin command.
|
|
133
|
+
*
|
|
134
|
+
* This method executes the command for the current version of the plugin. To execute a command for the
|
|
135
|
+
* latest installed version of the plugin, use the {@link Client.executePluginCommand}.
|
|
136
|
+
*
|
|
137
|
+
* @param command - Command to execute.
|
|
138
|
+
* @param parameters - Command parameters. Command-dependent.
|
|
139
|
+
*/
|
|
140
|
+
executeCommand(command: string, parameters?: BodyInit | object): Promise<any>;
|
|
141
|
+
}
|
package/lib/index.d.ts
CHANGED
|
@@ -18,6 +18,7 @@ export { Permission } from "./Api/Permission";
|
|
|
18
18
|
export { Project } from "./Api/Project";
|
|
19
19
|
export * from "./Api/Endpoint";
|
|
20
20
|
export { Role } from "./Api/Role";
|
|
21
|
+
export * from "./Api/Plugin";
|
|
21
22
|
export * from "./Api/SharedLink";
|
|
22
23
|
export * from "./Api/SharedFile";
|
|
23
24
|
export { User } from "./Api/User";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@inweb/client",
|
|
3
|
-
"version": "26.9.
|
|
3
|
+
"version": "26.9.3",
|
|
4
4
|
"description": "JavaScript REST API client for the Open Cloud Server",
|
|
5
5
|
"homepage": "https://cloud.opendesign.com/docs/index.html",
|
|
6
6
|
"license": "SEE LICENSE IN LICENSE",
|
|
@@ -26,6 +26,9 @@
|
|
|
26
26
|
"docs": "typedoc"
|
|
27
27
|
},
|
|
28
28
|
"dependencies": {
|
|
29
|
-
"@inweb/eventemitter2": "~26.9.
|
|
29
|
+
"@inweb/eventemitter2": "~26.9.3"
|
|
30
|
+
},
|
|
31
|
+
"devDependencies": {
|
|
32
|
+
"fflate": "^0.8.2"
|
|
30
33
|
}
|
|
31
34
|
}
|
package/src/Api/Assembly.ts
CHANGED
|
@@ -435,11 +435,11 @@ export class Assembly extends Endpoint {
|
|
|
435
435
|
* descriptions, or geometry data.
|
|
436
436
|
*
|
|
437
437
|
* @param dataId - Resource file name.
|
|
438
|
+
* @param requestId - Specify a non-empty `requestId` to append the `?requestId=` search parameter to
|
|
439
|
+
* the server request. If specified, server-side caching may not work.
|
|
438
440
|
* @param ranges - A ranges of resource file contents to download. See
|
|
439
441
|
* {@link https://developer.mozilla.org/docs/Web/HTTP/Guides/Range_requests | HTTP range requests} for
|
|
440
442
|
* more details.
|
|
441
|
-
* @param requestId - Specify a non-empty `requestId` to append the `?requestId=` search parameter to
|
|
442
|
-
* the server request. If specified, server-side caching may not work.
|
|
443
443
|
* @param onProgress - Download progress callback.
|
|
444
444
|
* @param signal - An
|
|
445
445
|
* {@link https://developer.mozilla.org/docs/Web/API/AbortController | AbortController} signal. Allows
|
package/src/Api/Client.ts
CHANGED
|
@@ -36,6 +36,7 @@ import { OAuthClient } from "./OAuthClient";
|
|
|
36
36
|
import { ISharedLinkPermissions } from "./ISharedLink";
|
|
37
37
|
import { SharedLink } from "./SharedLink";
|
|
38
38
|
import { SharedFile } from "./SharedFile";
|
|
39
|
+
import { Plugin } from "./Plugin";
|
|
39
40
|
import { parseArgs } from "./Utils";
|
|
40
41
|
|
|
41
42
|
/**
|
|
@@ -168,7 +169,7 @@ export class Client extends EventEmitter2<ClientEventMap> {
|
|
|
168
169
|
.post("/register", {
|
|
169
170
|
email,
|
|
170
171
|
password,
|
|
171
|
-
userName: userName ?? (email + "").split("@").
|
|
172
|
+
userName: userName ?? (email + "").split("@").shift(),
|
|
172
173
|
})
|
|
173
174
|
.then((response) => response.json());
|
|
174
175
|
}
|
|
@@ -469,7 +470,7 @@ export class Client extends EventEmitter2<ClientEventMap> {
|
|
|
469
470
|
userBrief: {
|
|
470
471
|
...rest,
|
|
471
472
|
email,
|
|
472
|
-
userName: userName ?? (email + "").split("@").
|
|
473
|
+
userName: userName ?? (email + "").split("@").shift(),
|
|
473
474
|
},
|
|
474
475
|
password,
|
|
475
476
|
})
|
|
@@ -778,8 +779,8 @@ export class Client extends EventEmitter2<ClientEventMap> {
|
|
|
778
779
|
* - `dwg`, `obj`, `gltf`, `glb`, `vsf`, `pdf`, `3dpdf` - Export file to the specified format.
|
|
779
780
|
* - Other custom job name. Custom job must be registered in the job templates before running.
|
|
780
781
|
*
|
|
781
|
-
* @param parameters - Parameters for the File Converter jobs or custom job. Can be given as
|
|
782
|
-
* line arguments in form `--arg=value`.
|
|
782
|
+
* @param parameters - Parameters for the File Converter jobs or custom job. Can be given as JSON
|
|
783
|
+
* object or command line arguments in form `--arg=value`.
|
|
783
784
|
*/
|
|
784
785
|
createJob(fileId: string, outputFormat: string, parameters?: string | object): Promise<Job> {
|
|
785
786
|
return this.httpClient
|
|
@@ -886,8 +887,8 @@ export class Client extends EventEmitter2<ClientEventMap> {
|
|
|
886
887
|
* @param name - Assembly name.
|
|
887
888
|
* @param params - Additional assembly creating parameters.
|
|
888
889
|
* @param params.jobParameters - Parameters for the File Converter jobs. Use this to specify aditional
|
|
889
|
-
* parameters for generating the geometry and properties of the new assembly. Can be given as
|
|
890
|
-
* line arguments in form `--arg=value`.
|
|
890
|
+
* parameters for generating the geometry and properties of the new assembly. Can be given as JSON
|
|
891
|
+
* object or command line arguments in form `--arg=value`.
|
|
891
892
|
* @param params.waitForDone - Wait for assembly to be created.
|
|
892
893
|
* @param params.timeout - The time, in milliseconds, that the function should wait for the assembly to
|
|
893
894
|
* be created. If the assembly is not created within this time, a TimeoutError exception will be
|
|
@@ -1138,4 +1139,118 @@ export class Client extends EventEmitter2<ClientEventMap> {
|
|
|
1138
1139
|
.then((response) => response.json())
|
|
1139
1140
|
.then((data) => new SharedFile(data, password, this.httpClient));
|
|
1140
1141
|
}
|
|
1142
|
+
|
|
1143
|
+
/**
|
|
1144
|
+
* Returns the list of installed plugins.
|
|
1145
|
+
*
|
|
1146
|
+
* Only administrators can get a list of plugins. If the current logged in user is not an
|
|
1147
|
+
* administrator, an exception will be thrown.
|
|
1148
|
+
*/
|
|
1149
|
+
getPlugins(): Promise<Plugin[]> {
|
|
1150
|
+
return this.httpClient
|
|
1151
|
+
.get("/plugins")
|
|
1152
|
+
.then((response) => response.json())
|
|
1153
|
+
.then((array) => array.map((data) => new Plugin(data, this.httpClient)));
|
|
1154
|
+
}
|
|
1155
|
+
|
|
1156
|
+
/**
|
|
1157
|
+
* Returns information about the specified plugin.
|
|
1158
|
+
*
|
|
1159
|
+
* Only administrators can get plugins. If the current logged in user is not an administrator, they can
|
|
1160
|
+
* only get themselves, otherwise an exception will be thrown.
|
|
1161
|
+
*
|
|
1162
|
+
* @param name - Plugin name.
|
|
1163
|
+
* @param version - Plugin version.
|
|
1164
|
+
*/
|
|
1165
|
+
getPlugin(name: string, version: string): Promise<Plugin> {
|
|
1166
|
+
return this.httpClient
|
|
1167
|
+
.get(`/plugins/${name}/${version}`)
|
|
1168
|
+
.then((response) => response.json())
|
|
1169
|
+
.then((data) => new Plugin(data, this.httpClient));
|
|
1170
|
+
}
|
|
1171
|
+
|
|
1172
|
+
/**
|
|
1173
|
+
* Uploads and install a plugin package to the server. The package must be a ZIP file and undergoes
|
|
1174
|
+
* verification, scanning, and health checks during installation.
|
|
1175
|
+
*
|
|
1176
|
+
* Only administrators can upload plugins. If the current logged in user is not an administrator, an
|
|
1177
|
+
* exception will be thrown.
|
|
1178
|
+
*
|
|
1179
|
+
* @param file - {@link https://developer.mozilla.org/docs/Web/API/File | Web API File} object are
|
|
1180
|
+
* generally retrieved from a {@link https://developer.mozilla.org/docs/Web/API/FileList | FileList}
|
|
1181
|
+
* object returned as a result of a user selecting files using the HTML `<input>` element.
|
|
1182
|
+
* @param onProgress - Upload progress callback.
|
|
1183
|
+
*/
|
|
1184
|
+
async uploadPlugin(
|
|
1185
|
+
file: globalThis.File,
|
|
1186
|
+
onProgress?: (progress: number, file: globalThis.File) => void
|
|
1187
|
+
): Promise<Plugin> {
|
|
1188
|
+
return await this.httpClient
|
|
1189
|
+
.uploadFile("/plugins", file, (progress) => {
|
|
1190
|
+
this.emitEvent({ type: "uploadprogress", data: progress, file });
|
|
1191
|
+
if (onProgress) onProgress(progress, file);
|
|
1192
|
+
})
|
|
1193
|
+
.then((xhr: XMLHttpRequest) => JSON.parse(xhr.responseText))
|
|
1194
|
+
.then((data) => new Plugin(data, this.httpClient));
|
|
1195
|
+
}
|
|
1196
|
+
|
|
1197
|
+
/**
|
|
1198
|
+
* Uninstalls and deletes the specified plugin from the server.
|
|
1199
|
+
*
|
|
1200
|
+
* Only administrators can delete plugins. If the current logged in user is not an administrator, an
|
|
1201
|
+
* exception will be thrown.
|
|
1202
|
+
*
|
|
1203
|
+
* @param name - Plugin name.
|
|
1204
|
+
* @param version - Plugin version.
|
|
1205
|
+
*/
|
|
1206
|
+
deletePlugin(name: string, version: string): Promise<Plugin> {
|
|
1207
|
+
return this.httpClient.delete(`/plugins/${name}/${version}`).then((response) => response.json());
|
|
1208
|
+
}
|
|
1209
|
+
|
|
1210
|
+
/**
|
|
1211
|
+
* Downloads the specified plugin package from the server.
|
|
1212
|
+
*
|
|
1213
|
+
* Only administrators can download plugins. If the current logged in user is not an administrator, an
|
|
1214
|
+
* exception will be thrown.
|
|
1215
|
+
*
|
|
1216
|
+
* @param name - Plugin name.
|
|
1217
|
+
* @param version - Plugin version.
|
|
1218
|
+
* @param onProgress - Download progress callback.
|
|
1219
|
+
* @param signal - An
|
|
1220
|
+
* {@link https://developer.mozilla.org/docs/Web/API/AbortController | AbortController} signal. Allows
|
|
1221
|
+
* to communicate with a fetch request and abort it if desired.
|
|
1222
|
+
*/
|
|
1223
|
+
downloadPlugin(
|
|
1224
|
+
name: string,
|
|
1225
|
+
version: string,
|
|
1226
|
+
onProgress?: (progress: number) => void,
|
|
1227
|
+
signal?: AbortSignal
|
|
1228
|
+
): Promise<ArrayBuffer> {
|
|
1229
|
+
return this.httpClient
|
|
1230
|
+
.downloadFile(`/plugins/${name}/${version}/download`, onProgress, { signal })
|
|
1231
|
+
.then((response) => response.arrayBuffer());
|
|
1232
|
+
}
|
|
1233
|
+
|
|
1234
|
+
/**
|
|
1235
|
+
* Executes a plugin command.
|
|
1236
|
+
*
|
|
1237
|
+
* If you have multiple versions of a plugin installed and want to run the command for the latest
|
|
1238
|
+
* version of the plugin, specify `undefined` or empty string for the `version` parameter.
|
|
1239
|
+
*
|
|
1240
|
+
* @param name - Plugin name.
|
|
1241
|
+
* @param version - Plugin version. Specify `undefined` or empty string to run the command for the
|
|
1242
|
+
* latest version of the plugin.
|
|
1243
|
+
* @param command - Command to execute.
|
|
1244
|
+
* @param parameters - Command parameters. Command-dependent.
|
|
1245
|
+
*/
|
|
1246
|
+
executePluginCommand(name: string, version: string, command: string, parameters?: BodyInit | object): Promise<any> {
|
|
1247
|
+
const searchParams = new URLSearchParams();
|
|
1248
|
+
if (version) searchParams.set("version", version);
|
|
1249
|
+
|
|
1250
|
+
let queryString = searchParams.toString();
|
|
1251
|
+
if (queryString) queryString = "?" + queryString;
|
|
1252
|
+
return this.httpClient
|
|
1253
|
+
.post(`/plugins/${name}/commands/${command}${queryString}`, parameters)
|
|
1254
|
+
.then((response) => response.json());
|
|
1255
|
+
}
|
|
1141
1256
|
}
|
package/src/Api/File.ts
CHANGED
|
@@ -606,11 +606,11 @@ export class File extends Endpoint {
|
|
|
606
606
|
* contain model scene descriptions, or geometry data, or exported files.
|
|
607
607
|
*
|
|
608
608
|
* @param dataId - Resource file name.
|
|
609
|
+
* @param requestId - Specify a non-empty `requestId` to append the `?requestId=` search parameter to
|
|
610
|
+
* the server request. If specified, server-side caching may not work.
|
|
609
611
|
* @param ranges - A ranges of resource file contents to download. See
|
|
610
612
|
* {@link https://developer.mozilla.org/docs/Web/HTTP/Guides/Range_requests | HTTP range requests} for
|
|
611
613
|
* more details.
|
|
612
|
-
* @param requestId - Specify a non-empty `requestId` to append the `?requestId=` search parameter to
|
|
613
|
-
* the server request. If specified, server-side caching may not work.
|
|
614
614
|
* @param onProgress - Download progress callback.
|
|
615
615
|
* @param signal - An
|
|
616
616
|
* {@link https://developer.mozilla.org/docs/Web/API/AbortController | AbortController} signal. Allows
|
|
@@ -704,8 +704,8 @@ export class File extends Endpoint {
|
|
|
704
704
|
* {@link downloadResource | downloadResource()} to download the exported file.
|
|
705
705
|
* - Other custom job name. Custom job must be registered in the job templates before running.
|
|
706
706
|
*
|
|
707
|
-
* @param parameters - Parameters for the File Converter jobs or custom job. Can be given as
|
|
708
|
-
* line arguments in form `--arg=value`.
|
|
707
|
+
* @param parameters - Parameters for the File Converter jobs or custom job. Can be given as JSON
|
|
708
|
+
* object or command line arguments in form `--arg=value`.
|
|
709
709
|
*/
|
|
710
710
|
createJob(outputFormat: string, parameters?: string | object): Promise<Job> {
|
|
711
711
|
const jobs = new Endpoint("/jobs", this.httpClient, this.headers);
|
package/src/Api/Model.ts
CHANGED
|
@@ -253,11 +253,11 @@ export class Model extends Endpoint {
|
|
|
253
253
|
* or geometry data.
|
|
254
254
|
*
|
|
255
255
|
* @param dataId - Resource file name.
|
|
256
|
+
* @param requestId - Specify a non-empty `requestId` to append the `?requestId=` search parameter to
|
|
257
|
+
* the server request. If specified, server-side caching may not work.
|
|
256
258
|
* @param ranges - A ranges of resource file contents to download. See
|
|
257
259
|
* {@link https://developer.mozilla.org/docs/Web/HTTP/Guides/Range_requests | HTTP range requests} for
|
|
258
260
|
* more details.
|
|
259
|
-
* @param requestId - Specify a non-empty `requestId` to append the `?requestId=` search parameter to
|
|
260
|
-
* the server request. If specified, server-side caching may not work.
|
|
261
261
|
* @param onProgress - Download progress callback.
|
|
262
262
|
* @param signal - An
|
|
263
263
|
* {@link https://developer.mozilla.org/docs/Web/API/AbortController | AbortController} signal. Allows
|