@inweb/client 25.4.7 → 25.4.10

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.
@@ -99,6 +99,13 @@ export declare class Client extends EventEmitter2<ClientEventMap> {
99
99
  * @param token - An access token for authentication request. See {@link User.token} for more details.
100
100
  */
101
101
  signInWithToken(token: string): Promise<User>;
102
+ private setCurrentUser;
103
+ private clearCurrentUser;
104
+ /**
105
+ * Returns the current logged in user information. Returns `null` if the user is not logged
106
+ * in or the logged in user has deleted himself.
107
+ */
108
+ getCurrentUser(): User | null;
102
109
  /**
103
110
  * Get the list of server indentity providers.
104
111
  *
@@ -111,32 +118,45 @@ export declare class Client extends EventEmitter2<ClientEventMap> {
111
118
  * @async
112
119
  */
113
120
  getIdentityProviders(): Promise<any>;
114
- private setCurrentUser;
115
- private clearCurrentUser;
116
121
  /**
117
- * Returns the current logged in user information. Returns `null` if the user is not logged
118
- * in or the logged in user has deleted himself.
122
+ * Returns the current server settings.
123
+ *
124
+ * @async
119
125
  */
120
- getCurrentUser(): User | null;
126
+ getServerSettings(): Promise<any>;
121
127
  /**
122
- * Returns a list of server users. Only admins can get a list of users, if the current logged
123
- * in user does not have administrator rights, an exception will be thrown.
128
+ * Change server settings.
129
+ *
130
+ * Only admins can change server settings, if the current logged in user does not have
131
+ * administrator rights, an exception will be thrown.
132
+ *
133
+ * @async
134
+ */
135
+ updateServerSettings(settings: any): Promise<any>;
136
+ /**
137
+ * Returns a list of server users.
138
+ *
139
+ * Only admins can get a list of users, if the current logged in user does not have
140
+ * administrator rights, an exception will be thrown.
124
141
  *
125
142
  * @async
126
143
  */
127
144
  getUsers(): Promise<User[]>;
128
145
  /**
129
- * Returns the user information. Only admins can get other users, if the current logged in
130
- * user does not have administrator rights, hi can only get himself, otherwise an exception
131
- * will be thrown.
146
+ * Returns the user information.
147
+ *
148
+ * Only admins can get other users, if the current logged in user does not have administrator
149
+ * rights, hi can only get himself, otherwise an exception will be thrown.
132
150
  *
133
151
  * @async
134
152
  * @param userId - User ID.
135
153
  */
136
154
  getUser(userId: string): Promise<User>;
137
155
  /**
138
- * Create a new user. Only admins can create users, if the current logged in user does not
139
- * have administrator rights, an exception will be thrown.
156
+ * Create a new user.
157
+ *
158
+ * Only admins can create users, if the current logged in user does not have administrator
159
+ * rights, an exception will be thrown.
140
160
  *
141
161
  * @async
142
162
  * @param email - User email. Cannot be empty.
@@ -150,7 +170,7 @@ export declare class Client extends EventEmitter2<ClientEventMap> {
150
170
  * @param params.lastName - Last name.
151
171
  * @param params.canCreateProject - `true` if user is allowed to create a project.
152
172
  * @param params.projectsLimit - The maximum number of projects that the user can create.
153
- * @param params.storageLimit - The size of the file storage available to the user.
173
+ * @param params.storageLimit - The size of the file storage available to the user in bytes.
154
174
  */
155
175
  createUser(email: string, password: string, params?: {
156
176
  isAdmin?: boolean;
@@ -162,8 +182,10 @@ export declare class Client extends EventEmitter2<ClientEventMap> {
162
182
  storageLimit?: number;
163
183
  }): Promise<User>;
164
184
  /**
165
- * Delete a user from the server. Only admins can delete users, if the current logged in user
166
- * does not have administrator rights, an exception will be thrown.
185
+ * Delete a user from the server.
186
+ *
187
+ * Only admins can delete users, if the current logged in user does not have administrator
188
+ * rights, an exception will be thrown.
167
189
  *
168
190
  * Admins can delete themselves or other admins. An admin can only delete himself if he is
169
191
  * not the last administrator.
package/lib/Api/Job.d.ts CHANGED
@@ -67,7 +67,7 @@ export declare class Job {
67
67
  get lastUpdate(): string;
68
68
  /**
69
69
  * Job type. Can be `properties`, `geomerty`, `geomertyGltf`, `validation`, `clash`, `dwg`,
70
- * `obj`, `gltf`, `glb`, `vsf`, `pdf` or `3dpdf`.
70
+ * `obj`, `gltf`, `glb`, `vsf`, `pdf`, `3dpdf` or custom job name.
71
71
  *
72
72
  * @readonly
73
73
  */
@@ -104,7 +104,10 @@ export declare class Job {
104
104
  */
105
105
  checkout(): Promise<this>;
106
106
  /**
107
- * Update job data on the server. Only admins can update job data.
107
+ * Update job data on the server.
108
+ *
109
+ * Only admins can update job data, if the current logged in user does not have administrator
110
+ * rights, an exception will be thrown.
108
111
  *
109
112
  * @async
110
113
  * @param data - Raw job data.
@@ -1,6 +1,6 @@
1
1
  import { IHttpClient } from "./IHttpClient";
2
- import { File } from "./File";
3
- import { Assembly } from "./Assembly";
2
+ import type { File } from "./File";
3
+ import type { Assembly } from "./Assembly";
4
4
  /**
5
5
  * The class representing the is a description of view of the file or assembly. For example,
6
6
  * for `dwg` it is a `Model` space or layout, and for `rvt` files it is a `3D` view.
@@ -103,16 +103,12 @@ export declare class Model {
103
103
  /**
104
104
  * Returns model viewpoint list.
105
105
  *
106
- * _**Note**: Assemblу models do not support viewpoints_.
107
- *
108
106
  * @async
109
107
  */
110
108
  getViewpoints(): Promise<any[]>;
111
109
  /**
112
110
  * Add new model viewpoint. To create a new viewpoint use `Viewer.createViewpoint()`.
113
111
  *
114
- * _**Note**: Assemblу models do not support viewpoints_.
115
- *
116
112
  * @async
117
113
  * @param viewpoint - Viewpoint.
118
114
  */
@@ -120,8 +116,6 @@ export declare class Model {
120
116
  /**
121
117
  * Delete model viewpoint.
122
118
  *
123
- * _**Note**: Assemblу models do not support viewpoints_.
124
- *
125
119
  * @async
126
120
  * @param guid - Viewpoint GUID.
127
121
  * @returns Returns the raw data of a deleted viewpoint.
package/lib/Api/User.d.ts CHANGED
@@ -23,8 +23,8 @@ export declare class User {
23
23
  */
24
24
  get canCreateProject(): boolean;
25
25
  /**
26
- * User account registration time (UTC) in the format specified in <a
27
- * href="https://www.wikipedia.org/wiki/ISO_8601" target="_blank">ISO 8601</a>.
26
+ * Account registration time (UTC) in the format specified in
27
+ * {@link https://www.wikipedia.org/wiki/ISO_8601 | ISO 8601}.
28
28
  *
29
29
  * @readonly
30
30
  */
@@ -85,8 +85,8 @@ export declare class User {
85
85
  */
86
86
  get isEmailConfirmed(): boolean;
87
87
  /**
88
- * User last update time (UTC) in the format specified in <a
89
- * href="https://www.wikipedia.org/wiki/ISO_8601" target="_blank">ISO 8601</a>.
88
+ * User last update time (UTC) in the format specified in
89
+ * {@link https://www.wikipedia.org/wiki/ISO_8601 | ISO 8601}.
90
90
  */
91
91
  get lastModified(): string;
92
92
  /**
@@ -95,8 +95,8 @@ export declare class User {
95
95
  get lastName(): string;
96
96
  set lastName(value: string);
97
97
  /**
98
- * User last sign in time (UTC) in the format specified in <a
99
- * href="https://www.wikipedia.org/wiki/ISO_8601" target="_blank">ISO 8601</a>.
98
+ * User last sign in time (UTC) in the format specified in
99
+ * {@link https://www.wikipedia.org/wiki/ISO_8601 | ISO 8601}.
100
100
  */
101
101
  get lastSignIn(): string;
102
102
  /**
@@ -105,6 +105,10 @@ export declare class User {
105
105
  * @readonly
106
106
  */
107
107
  get projectsLimit(): number;
108
+ /**
109
+ * The identity provider used to create the account. Can be `ldap`, `oauth`, `saml` or empty.
110
+ */
111
+ get providerType(): string;
108
112
  /**
109
113
  * The user's access token (API key). Use {@link Client.signInWithToken()} to log in using token.
110
114
  *
@@ -117,23 +121,27 @@ export declare class User {
117
121
  get userName(): string;
118
122
  set userName(value: string);
119
123
  /**
120
- * Refresh user data. Only admins can checkout other users, if the current logged in user
121
- * does not have administrator rights, hi can only checkout himself, otherwise an exception
122
- * will be thrown.
124
+ * Refresh user data.
125
+ *
126
+ * Only admins can checkout other users, if the current logged in user does not have
127
+ * administrator rights, hi can only checkout himself, otherwise an exception will be thrown.
123
128
  */
124
129
  checkout(): Promise<this>;
125
130
  /**
126
- * Update user data on the server. Only admins can update other users, if the current logged
127
- * in user does not have administrator rights, hi can only update himself, otherwise an
128
- * exception will be thrown.
131
+ * Update user data on the server.
132
+ *
133
+ * Only admins can update other users, if the current logged in user does not have
134
+ * administrator rights, hi can only update himself, otherwise an exception will be thrown.
129
135
  *
130
136
  * @async
131
137
  * @param data - Raw user data.
132
138
  */
133
139
  update(data: any): Promise<this>;
134
140
  /**
135
- * Delete a user from the server. Only admins can delete users, if the current logged in user
136
- * does not have administrator rights, an exception will be thrown.
141
+ * Delete a user from the server.
142
+ *
143
+ * Only admins can delete users, if the current logged in user does not have administrator
144
+ * rights, an exception will be thrown.
137
145
  *
138
146
  * Admins can delete themselves or other admins. An admin can only delete himself if he is
139
147
  * not the last administrator.
@@ -152,9 +160,10 @@ export declare class User {
152
160
  */
153
161
  save(): Promise<this>;
154
162
  /**
155
- * Set or remove the user avatar. Only admins can set the avatar of other users, if the
156
- * current logged in user does not have administrator rights, he can only set his own avatar,
157
- * otherwise an exception will be thrown.
163
+ * Set or remove the user avatar.
164
+ *
165
+ * Only admins can set the avatar of other users, if the current logged in user does not have
166
+ * administrator rights, he can only set his own avatar, otherwise an exception will be thrown.
158
167
  *
159
168
  * @async
160
169
  * @param image - Avatar image. Can be a <a
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@inweb/client",
3
- "version": "25.4.7",
3
+ "version": "25.4.10",
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,6 @@
26
26
  "ts-docs": "typedoc"
27
27
  },
28
28
  "dependencies": {
29
- "@inweb/eventemitter2": "~25.4.7"
29
+ "@inweb/eventemitter2": "~25.4.10"
30
30
  }
31
31
  }
package/src/Api/Client.ts CHANGED
@@ -217,21 +217,6 @@ export class Client extends EventEmitter2<ClientEventMap> {
217
217
  return this.setCurrentUser(data);
218
218
  }
219
219
 
220
- /**
221
- * Get the list of server indentity providers.
222
- *
223
- * To sign in with the provider in your web application:
224
- *
225
- * - Open the `provider.url` link using `window.open()`.
226
- * - Add a `/oauth` path (server-defined) handler to the router. In this handler, show an error
227
- * message if the `error` search parameter is present, or log in with the `token` search parameter.
228
- *
229
- * @async
230
- */
231
- getIdentityProviders(): Promise<any> {
232
- return this.httpClient.get("/identity").then((response) => response.json());
233
- }
234
-
235
220
  // Save the current logged in user information for internal use.
236
221
 
237
222
  private setCurrentUser(data: any): User {
@@ -257,8 +242,46 @@ export class Client extends EventEmitter2<ClientEventMap> {
257
242
  }
258
243
 
259
244
  /**
260
- * Returns a list of server users. Only admins can get a list of users, if the current logged
261
- * in user does not have administrator rights, an exception will be thrown.
245
+ * Get the list of server indentity providers.
246
+ *
247
+ * To sign in with the provider in your web application:
248
+ *
249
+ * - Open the `provider.url` link using `window.open()`.
250
+ * - Add a `/oauth` path (server-defined) handler to the router. In this handler, show an error
251
+ * message if the `error` search parameter is present, or log in with the `token` search parameter.
252
+ *
253
+ * @async
254
+ */
255
+ getIdentityProviders(): Promise<any> {
256
+ return this.httpClient.get("/identity").then((response) => response.json());
257
+ }
258
+
259
+ /**
260
+ * Returns the current server settings.
261
+ *
262
+ * @async
263
+ */
264
+ getServerSettings(): Promise<any> {
265
+ return this.httpClient.get("/settings").then((response) => response.json());
266
+ }
267
+
268
+ /**
269
+ * Change server settings.
270
+ *
271
+ * Only admins can change server settings, if the current logged in user does not have
272
+ * administrator rights, an exception will be thrown.
273
+ *
274
+ * @async
275
+ */
276
+ updateServerSettings(settings: any): Promise<any> {
277
+ return this.httpClient.put("/settings", settings).then((response) => response.json());
278
+ }
279
+
280
+ /**
281
+ * Returns a list of server users.
282
+ *
283
+ * Only admins can get a list of users, if the current logged in user does not have
284
+ * administrator rights, an exception will be thrown.
262
285
  *
263
286
  * @async
264
287
  */
@@ -271,9 +294,10 @@ export class Client extends EventEmitter2<ClientEventMap> {
271
294
  }
272
295
 
273
296
  /**
274
- * Returns the user information. Only admins can get other users, if the current logged in
275
- * user does not have administrator rights, hi can only get himself, otherwise an exception
276
- * will be thrown.
297
+ * Returns the user information.
298
+ *
299
+ * Only admins can get other users, if the current logged in user does not have administrator
300
+ * rights, hi can only get himself, otherwise an exception will be thrown.
277
301
  *
278
302
  * @async
279
303
  * @param userId - User ID.
@@ -295,8 +319,10 @@ export class Client extends EventEmitter2<ClientEventMap> {
295
319
  }
296
320
 
297
321
  /**
298
- * Create a new user. Only admins can create users, if the current logged in user does not
299
- * have administrator rights, an exception will be thrown.
322
+ * Create a new user.
323
+ *
324
+ * Only admins can create users, if the current logged in user does not have administrator
325
+ * rights, an exception will be thrown.
300
326
  *
301
327
  * @async
302
328
  * @param email - User email. Cannot be empty.
@@ -310,7 +336,7 @@ export class Client extends EventEmitter2<ClientEventMap> {
310
336
  * @param params.lastName - Last name.
311
337
  * @param params.canCreateProject - `true` if user is allowed to create a project.
312
338
  * @param params.projectsLimit - The maximum number of projects that the user can create.
313
- * @param params.storageLimit - The size of the file storage available to the user.
339
+ * @param params.storageLimit - The size of the file storage available to the user in bytes.
314
340
  */
315
341
  createUser(
316
342
  email: string,
@@ -342,8 +368,10 @@ export class Client extends EventEmitter2<ClientEventMap> {
342
368
  }
343
369
 
344
370
  /**
345
- * Delete a user from the server. Only admins can delete users, if the current logged in user
346
- * does not have administrator rights, an exception will be thrown.
371
+ * Delete a user from the server.
372
+ *
373
+ * Only admins can delete users, if the current logged in user does not have administrator
374
+ * rights, an exception will be thrown.
347
375
  *
348
376
  * Admins can delete themselves or other admins. An admin can only delete himself if he is
349
377
  * not the last administrator.
@@ -118,6 +118,7 @@ export class FetchError extends Error {
118
118
  */
119
119
  constructor(status: number, message?: string) {
120
120
  super(message || statusText(status));
121
+ this.name = "FetchError";
121
122
  this.status = status;
122
123
  this.statusText = statusText(status);
123
124
  }
package/src/Api/Job.ts CHANGED
@@ -133,7 +133,7 @@ export class Job {
133
133
 
134
134
  /**
135
135
  * Job type. Can be `properties`, `geomerty`, `geomertyGltf`, `validation`, `clash`, `dwg`,
136
- * `obj`, `gltf`, `glb`, `vsf`, `pdf` or `3dpdf`.
136
+ * `obj`, `gltf`, `glb`, `vsf`, `pdf`, `3dpdf` or custom job name.
137
137
  *
138
138
  * @readonly
139
139
  */
@@ -190,7 +190,10 @@ export class Job {
190
190
  }
191
191
 
192
192
  /**
193
- * Update job data on the server. Only admins can update job data.
193
+ * Update job data on the server.
194
+ *
195
+ * Only admins can update job data, if the current logged in user does not have administrator
196
+ * rights, an exception will be thrown.
194
197
  *
195
198
  * @async
196
199
  * @param data - Raw job data.
package/src/Api/Model.ts CHANGED
@@ -22,8 +22,8 @@
22
22
  ///////////////////////////////////////////////////////////////////////////////
23
23
 
24
24
  import { IHttpClient } from "./IHttpClient";
25
- import { File } from "./File";
26
- import { Assembly } from "./Assembly";
25
+ import type { File } from "./File";
26
+ import type { Assembly } from "./Assembly";
27
27
 
28
28
  /**
29
29
  * The class representing the is a description of view of the file or assembly. For example,
@@ -180,8 +180,6 @@ export class Model {
180
180
  /**
181
181
  * Returns model viewpoint list.
182
182
  *
183
- * _**Note**: Assemblу models do not support viewpoints_.
184
- *
185
183
  * @async
186
184
  */
187
185
  getViewpoints(): Promise<any[]> {
@@ -197,8 +195,6 @@ export class Model {
197
195
  /**
198
196
  * Add new model viewpoint. To create a new viewpoint use `Viewer.createViewpoint()`.
199
197
  *
200
- * _**Note**: Assemblу models do not support viewpoints_.
201
- *
202
198
  * @async
203
199
  * @param viewpoint - Viewpoint.
204
200
  */
@@ -212,8 +208,6 @@ export class Model {
212
208
  /**
213
209
  * Delete model viewpoint.
214
210
  *
215
- * _**Note**: Assemblу models do not support viewpoints_.
216
- *
217
211
  * @async
218
212
  * @param guid - Viewpoint GUID.
219
213
  * @returns Returns the raw data of a deleted viewpoint.
package/src/Api/User.ts CHANGED
@@ -59,8 +59,8 @@ export class User {
59
59
  }
60
60
 
61
61
  /**
62
- * User account registration time (UTC) in the format specified in <a
63
- * href="https://www.wikipedia.org/wiki/ISO_8601" target="_blank">ISO 8601</a>.
62
+ * Account registration time (UTC) in the format specified in
63
+ * {@link https://www.wikipedia.org/wiki/ISO_8601 | ISO 8601}.
64
64
  *
65
65
  * @readonly
66
66
  */
@@ -167,8 +167,8 @@ export class User {
167
167
  }
168
168
 
169
169
  /**
170
- * User last update time (UTC) in the format specified in <a
171
- * href="https://www.wikipedia.org/wiki/ISO_8601" target="_blank">ISO 8601</a>.
170
+ * User last update time (UTC) in the format specified in
171
+ * {@link https://www.wikipedia.org/wiki/ISO_8601 | ISO 8601}.
172
172
  */
173
173
  get lastModified(): string {
174
174
  return this.data.lastModified;
@@ -186,8 +186,8 @@ export class User {
186
186
  }
187
187
 
188
188
  /**
189
- * User last sign in time (UTC) in the format specified in <a
190
- * href="https://www.wikipedia.org/wiki/ISO_8601" target="_blank">ISO 8601</a>.
189
+ * User last sign in time (UTC) in the format specified in
190
+ * {@link https://www.wikipedia.org/wiki/ISO_8601 | ISO 8601}.
191
191
  */
192
192
  get lastSignIn(): string {
193
193
  return this.data.lastSignIn;
@@ -202,6 +202,13 @@ export class User {
202
202
  return this.data.projectsLimit;
203
203
  }
204
204
 
205
+ /**
206
+ * The identity provider used to create the account. Can be `ldap`, `oauth`, `saml` or empty.
207
+ */
208
+ get providerType(): string {
209
+ return this.data.providerType;
210
+ }
211
+
205
212
  /**
206
213
  * The user's access token (API key). Use {@link Client.signInWithToken()} to log in using token.
207
214
  *
@@ -223,9 +230,10 @@ export class User {
223
230
  }
224
231
 
225
232
  /**
226
- * Refresh user data. Only admins can checkout other users, if the current logged in user
227
- * does not have administrator rights, hi can only checkout himself, otherwise an exception
228
- * will be thrown.
233
+ * Refresh user data.
234
+ *
235
+ * Only admins can checkout other users, if the current logged in user does not have
236
+ * administrator rights, hi can only checkout himself, otherwise an exception will be thrown.
229
237
  */
230
238
  async checkout(): Promise<this> {
231
239
  if (this.id === this.httpClient.signInUserId) {
@@ -241,9 +249,10 @@ export class User {
241
249
  }
242
250
 
243
251
  /**
244
- * Update user data on the server. Only admins can update other users, if the current logged
245
- * in user does not have administrator rights, hi can only update himself, otherwise an
246
- * exception will be thrown.
252
+ * Update user data on the server.
253
+ *
254
+ * Only admins can update other users, if the current logged in user does not have
255
+ * administrator rights, hi can only update himself, otherwise an exception will be thrown.
247
256
  *
248
257
  * @async
249
258
  * @param data - Raw user data.
@@ -262,8 +271,10 @@ export class User {
262
271
  }
263
272
 
264
273
  /**
265
- * Delete a user from the server. Only admins can delete users, if the current logged in user
266
- * does not have administrator rights, an exception will be thrown.
274
+ * Delete a user from the server.
275
+ *
276
+ * Only admins can delete users, if the current logged in user does not have administrator
277
+ * rights, an exception will be thrown.
267
278
  *
268
279
  * Admins can delete themselves or other admins. An admin can only delete himself if he is
269
280
  * not the last administrator.
@@ -297,9 +308,10 @@ export class User {
297
308
  }
298
309
 
299
310
  /**
300
- * Set or remove the user avatar. Only admins can set the avatar of other users, if the
301
- * current logged in user does not have administrator rights, he can only set his own avatar,
302
- * otherwise an exception will be thrown.
311
+ * Set or remove the user avatar.
312
+ *
313
+ * Only admins can set the avatar of other users, if the current logged in user does not have
314
+ * administrator rights, he can only set his own avatar, otherwise an exception will be thrown.
303
315
  *
304
316
  * @async
305
317
  * @param image - Avatar image. Can be a <a