@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
|
@@ -0,0 +1,241 @@
|
|
|
1
|
+
///////////////////////////////////////////////////////////////////////////////
|
|
2
|
+
// Copyright (C) 2002-2025, Open Design Alliance (the "Alliance").
|
|
3
|
+
// All rights reserved.
|
|
4
|
+
//
|
|
5
|
+
// This software and its documentation and related materials are owned by
|
|
6
|
+
// the Alliance. The software may only be incorporated into application
|
|
7
|
+
// programs owned by members of the Alliance, subject to a signed
|
|
8
|
+
// Membership Agreement and Supplemental Software License Agreement with the
|
|
9
|
+
// Alliance. The structure and organization of this software are the valuable
|
|
10
|
+
// trade secrets of the Alliance and its suppliers. The software is also
|
|
11
|
+
// protected by copyright law and international treaty provisions. Application
|
|
12
|
+
// programs incorporating this software must include the following statement
|
|
13
|
+
// with their copyright notices:
|
|
14
|
+
//
|
|
15
|
+
// This application incorporates Open Design Alliance software pursuant to a
|
|
16
|
+
// license agreement with Open Design Alliance.
|
|
17
|
+
// Open Design Alliance Copyright (C) 2002-2025 by Open Design Alliance.
|
|
18
|
+
// All rights reserved.
|
|
19
|
+
//
|
|
20
|
+
// By use of this software, its documentation or related materials, you
|
|
21
|
+
// acknowledge and accept the above terms.
|
|
22
|
+
///////////////////////////////////////////////////////////////////////////////
|
|
23
|
+
|
|
24
|
+
import { IHttpClient } from "./IHttpClient";
|
|
25
|
+
import { Endpoint } from "./Endpoint";
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* Provides properties and methods for obtaining information about a server plugin on the Open Cloud
|
|
29
|
+
* Server and managing its data.
|
|
30
|
+
*/
|
|
31
|
+
export class Plugin extends Endpoint {
|
|
32
|
+
private _data: any;
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* @param data - Raw plugin data received from the server. For more information, see
|
|
36
|
+
* {@link https://cloud.opendesign.com/docs//pages/server/api.html#Plugin | Open Cloud Plugins API}.
|
|
37
|
+
* @param httpClient - HTTP client instance used to send requests to the REST API server.
|
|
38
|
+
*/
|
|
39
|
+
constructor(data: any, httpClient: IHttpClient) {
|
|
40
|
+
super(`/plugins/${data.name}/${data.version}`, httpClient);
|
|
41
|
+
this.data = data;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
/**
|
|
45
|
+
* Plugin author information. The `author` is an object with a `name` field and optionally `url` and
|
|
46
|
+
* `email`. Or it can be shorten that all into a single string.
|
|
47
|
+
*
|
|
48
|
+
* @readonly
|
|
49
|
+
*/
|
|
50
|
+
get author(): any {
|
|
51
|
+
return this.data.author;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
/**
|
|
55
|
+
* Raw plugin data received from the server. For more information, see
|
|
56
|
+
* {@link https://cloud.opendesign.com/docs//pages/server/api.html#Plugin | Open Cloud Plugins API}.
|
|
57
|
+
*/
|
|
58
|
+
get data(): any {
|
|
59
|
+
return this._data;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
set data(value: any) {
|
|
63
|
+
this._data = value;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
/**
|
|
67
|
+
* Short description of the plugin.
|
|
68
|
+
*
|
|
69
|
+
* @readonly
|
|
70
|
+
*/
|
|
71
|
+
get description(): string {
|
|
72
|
+
return this.data.description;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
/**
|
|
76
|
+
* Plugin state.
|
|
77
|
+
*
|
|
78
|
+
* @readonly
|
|
79
|
+
*/
|
|
80
|
+
get enabled(): boolean {
|
|
81
|
+
return this.data.enabled;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
/**
|
|
85
|
+
* The URL to the plugin homepage.
|
|
86
|
+
*
|
|
87
|
+
* @readonly
|
|
88
|
+
*/
|
|
89
|
+
get homepage(): string {
|
|
90
|
+
return this.data.homepage;
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
/**
|
|
94
|
+
* Unique plugin ID.
|
|
95
|
+
*
|
|
96
|
+
* @readonly
|
|
97
|
+
*/
|
|
98
|
+
get id(): string {
|
|
99
|
+
return this.data.id;
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
/**
|
|
103
|
+
* A license for the plugin.
|
|
104
|
+
*
|
|
105
|
+
* @readonly
|
|
106
|
+
*/
|
|
107
|
+
get license(): string {
|
|
108
|
+
return this.data.license;
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
/**
|
|
112
|
+
* Plugin name.
|
|
113
|
+
*
|
|
114
|
+
* @readonly
|
|
115
|
+
*/
|
|
116
|
+
get name(): string {
|
|
117
|
+
return this.data.name;
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
/**
|
|
121
|
+
* API permissions required.
|
|
122
|
+
*
|
|
123
|
+
* @readonly
|
|
124
|
+
*/
|
|
125
|
+
get permissions(): string[] {
|
|
126
|
+
return this.data.permissions;
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
/**
|
|
130
|
+
* Plugin type. Can be set of:
|
|
131
|
+
*
|
|
132
|
+
* - `app` - Viewer plugin, the client‑side web app that the server hosts and serves as static content.
|
|
133
|
+
* - `server` - Binary dll that extends server functionality.
|
|
134
|
+
* - `jobrunner` - Binary dll that adds a new Job Runner on the server.
|
|
135
|
+
*
|
|
136
|
+
* @readonly
|
|
137
|
+
*/
|
|
138
|
+
get pluginType(): string[] {
|
|
139
|
+
return this.data.pluginType;
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
/**
|
|
143
|
+
* {@link https://semver.org/ | SemVer} compatible version of the plugin.
|
|
144
|
+
*
|
|
145
|
+
* @readonly
|
|
146
|
+
*/
|
|
147
|
+
get version(): number {
|
|
148
|
+
return this.data.version;
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
/**
|
|
152
|
+
* Reloads plugin data from the server.
|
|
153
|
+
*/
|
|
154
|
+
async checkout(): Promise<this> {
|
|
155
|
+
const response = await this.get("");
|
|
156
|
+
this.data = await response.json();
|
|
157
|
+
return this;
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
/**
|
|
161
|
+
* Uninstalls and deletes a plugin from the server.
|
|
162
|
+
*
|
|
163
|
+
* @returns Returns the raw data of a deleted plugin. For more information, see
|
|
164
|
+
* {@link https://cloud.opendesign.com/docs//pages/server/api.html#Plugin | Open Cloud Plugins API}.
|
|
165
|
+
*/
|
|
166
|
+
override delete(): Promise<any> {
|
|
167
|
+
return super.delete("").then((response) => response.json());
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
/**
|
|
171
|
+
* Enables a plugin.
|
|
172
|
+
*/
|
|
173
|
+
async enable(): Promise<this> {
|
|
174
|
+
const response = await this.put("/enable");
|
|
175
|
+
this.data = await response.json();
|
|
176
|
+
return this;
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
/**
|
|
180
|
+
* Disables a plugin.
|
|
181
|
+
*/
|
|
182
|
+
async disable(): Promise<this> {
|
|
183
|
+
const response = await this.put("/disable");
|
|
184
|
+
this.data = await response.json();
|
|
185
|
+
return this;
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
/**
|
|
189
|
+
* Downloads the plugins package from the server.
|
|
190
|
+
*
|
|
191
|
+
* @param onProgress - Download progress callback.
|
|
192
|
+
* @param signal - An
|
|
193
|
+
* {@link https://developer.mozilla.org/docs/Web/API/AbortController | AbortController} signal. Allows
|
|
194
|
+
* to communicate with a fetch request and abort it if desired.
|
|
195
|
+
*/
|
|
196
|
+
download(onProgress?: (progress: number) => void, signal?: AbortSignal): Promise<ArrayBuffer> {
|
|
197
|
+
return this.httpClient
|
|
198
|
+
.downloadFile(this.getEndpointPath("/download"), onProgress, { signal, headers: this.headers })
|
|
199
|
+
.then((response) => response.arrayBuffer());
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
/**
|
|
203
|
+
* Returns a plugin manfest.
|
|
204
|
+
*/
|
|
205
|
+
getManifest(): Promise<any> {
|
|
206
|
+
return this.get("/manifest").then((response) => response.json());
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
/**
|
|
210
|
+
* Returns the plugin settings.
|
|
211
|
+
*
|
|
212
|
+
* @returns Returns an object with plugin settings.
|
|
213
|
+
*/
|
|
214
|
+
getSettings(): Promise<any> {
|
|
215
|
+
return this.get("/settings").then((response) => response.json());
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
/**
|
|
219
|
+
* Changes the plugin settings.
|
|
220
|
+
*
|
|
221
|
+
* @param settings - An object with the new plugin settings or part of the settings.
|
|
222
|
+
* @returns Returns an object with updated plugin settings.
|
|
223
|
+
*/
|
|
224
|
+
updateSettings(settings: any): Promise<any> {
|
|
225
|
+
return this.post("/settings", settings).then((response) => response.json());
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
/**
|
|
229
|
+
* Executes a plugin command.
|
|
230
|
+
*
|
|
231
|
+
* This method executes the command for the current version of the plugin. To execute a command for the
|
|
232
|
+
* latest installed version of the plugin, use the {@link Client.executePluginCommand}.
|
|
233
|
+
*
|
|
234
|
+
* @param command - Command to execute.
|
|
235
|
+
* @param parameters - Command parameters. Command-dependent.
|
|
236
|
+
*/
|
|
237
|
+
executeCommand(command: string, parameters?: BodyInit | object): Promise<any> {
|
|
238
|
+
const commands = new Endpoint(`/plugins/${this.name}/commands`, this.httpClient, this.headers);
|
|
239
|
+
return commands.post(`/${command}?version=${this.version}`, parameters).then((response) => response.json());
|
|
240
|
+
}
|
|
241
|
+
}
|
package/src/index.ts
CHANGED
|
@@ -41,6 +41,7 @@ export { Permission } from "./Api/Permission";
|
|
|
41
41
|
export { Project } from "./Api/Project";
|
|
42
42
|
export * from "./Api/Endpoint";
|
|
43
43
|
export { Role } from "./Api/Role";
|
|
44
|
+
export * from "./Api/Plugin";
|
|
44
45
|
export * from "./Api/SharedLink";
|
|
45
46
|
export * from "./Api/SharedFile";
|
|
46
47
|
export { User } from "./Api/User";
|