@inweb/client 25.8.16 → 25.8.19

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.
@@ -7,41 +7,47 @@ import { Job } from "./Job";
7
7
  import { Project } from "./Project";
8
8
  import { User } from "./User";
9
9
  /**
10
- * The `Client.js` library class that provides methods to access the
11
- * {@link https://cloud.opendesign.com/docs/index.html#/opencloud_server | Open Cloud Server}
12
- * resources like Projects, Files, Issues etc.
10
+ * Provides methods for managing server resources such as users, files, assemblies, jobs, projects, etc.
13
11
  */
14
12
  export declare class Client extends EventEmitter2<ClientEventMap> {
15
13
  private _serverUrl;
16
- httpClient: IHttpClient;
14
+ private _httpClient;
17
15
  private _user;
18
16
  eventEmitter: EventEmitter2;
19
17
  /**
20
18
  * @param params - An object containing client configuration parameters.
21
- * @param params.serverUrl - Open Cloud Server URL.
19
+ * @param params.serverUrl - Open Cloud Server REST API base URL.
20
+ * @param params.url - Deprecated since `25.8`. Use `serverUrl` instead.
22
21
  */
23
22
  constructor(params?: {
24
23
  serverUrl?: string;
25
24
  url?: string;
26
25
  });
27
26
  /**
28
- * Open Cloud Server URL. Use {@link configure | configure()} to change server URL.
27
+ * Open Cloud Server REST API base URL. Use {@link configure | configure()} to change server URL.
29
28
  *
30
29
  * @readonly
31
30
  */
32
31
  get serverUrl(): string;
33
32
  /**
34
- * Deprecated since `25.3`. Use `Viewer.options()` instead to change Viewer parameters.
33
+ * HTTP client instance used to send REST API requests and receive responses from the server.
34
+ *
35
+ * @readonly
36
+ */
37
+ get httpClient(): IHttpClient;
38
+ /**
39
+ * Deprecated since `25.3`. Use `Viewer.options()` instead to change `Viewer` parameters.
35
40
  *
36
41
  * @deprecated
37
42
  */
38
43
  get options(): any;
39
44
  /**
40
- * Change the client configuration parameters.
45
+ * Changes the client parameters.
41
46
  *
42
- * @param params - An object containing new configuration parameters.
43
- * @param params.serverUrl - Open Cloud Server URL.
44
- * @returns Returns a reference to the `Client`.
47
+ * After changing the parameters, you must re-login.
48
+ *
49
+ * @param params - An object containing new parameters.
50
+ * @param params.serverUrl - Open Cloud Server REST API base URL.
45
51
  */
46
52
  configure(params: {
47
53
  serverUrl?: string;
@@ -54,21 +60,21 @@ export declare class Client extends EventEmitter2<ClientEventMap> {
54
60
  * @property {string} hash - Build hash.
55
61
  */
56
62
  /**
57
- * Returns server version.
63
+ * Returns client and server versions.
58
64
  */
59
65
  version(): Promise<any>;
60
66
  /**
61
- * Register a new user with the specified email and password.
67
+ * Registers a new user on the server.
62
68
  *
63
- * @param email - User email. Cannot be empty.
69
+ * @param email - User email. Cannot be empty. Must be unique within the server.
64
70
  * @param password - User password. Cannot be empty. Password can only contain letters (a-z,
65
71
  * A-Z), numbers (0-9), and special characters (~!@#$%^&*()_-+={}[]<>|/'":;.,?).
66
- * @param userName - User name. Cannot be empty or blank if defined. Leave undefined to use
67
- * `username` from email.
72
+ * @param userName - User name. Cannot be empty or blank if defined. this to `undefined` to
73
+ * use `username` from email.
68
74
  */
69
75
  registerUser(email: string, password: string, userName?: string): Promise<any>;
70
76
  /**
71
- * Resend the Confirmation Email to new user. If the user's email is already confirmed, an
77
+ * Resends a Confirmation Email to the new user. If the user's email is already confirmed, an
72
78
  * exception will be thrown.
73
79
  *
74
80
  * @param email - User email.
@@ -76,7 +82,8 @@ export declare class Client extends EventEmitter2<ClientEventMap> {
76
82
  */
77
83
  resendConfirmationEmail(email: string, password: string): Promise<any>;
78
84
  /**
79
- * Confirm the user's email. If the user's email is already confirmed, an exception will be thrown.
85
+ * Marks the user's email address as confirmed. If the user's email is already confirmed, an
86
+ * exception will be thrown.
80
87
  *
81
88
  * @param emailConfirmationId - Confirmation code from the Confirmation Email.
82
89
  */
@@ -97,18 +104,12 @@ export declare class Client extends EventEmitter2<ClientEventMap> {
97
104
  private setCurrentUser;
98
105
  private clearCurrentUser;
99
106
  /**
100
- * Returns the current logged in user information. Returns `null` if the user is not logged
101
- * in or the logged in user has deleted himself.
107
+ * Returns the current logged in user. Returns `null` if the user is not logged in or the
108
+ * logged in user has deleted themself.
102
109
  */
103
110
  getCurrentUser(): User | null;
104
111
  /**
105
- * Get the list of server indentity providers.
106
- *
107
- * To sign in with the provider in your web application:
108
- *
109
- * - Open the `provider.url` link using `window.open()`.
110
- * - Add a `/oauth` path (server-defined) handler to the router. In this handler, show an error
111
- * message if the `error` search parameter is present, or log in with the `token` search parameter.
112
+ * Returns the list of server enabled indentity providers.
112
113
  */
113
114
  getIdentityProviders(): Promise<any>;
114
115
  /**
@@ -116,21 +117,21 @@ export declare class Client extends EventEmitter2<ClientEventMap> {
116
117
  */
117
118
  getServerSettings(): Promise<any>;
118
119
  /**
119
- * Change server settings.
120
+ * Changes the server settings.
120
121
  *
121
122
  * Only administrators can change server settings. If the current logged in user is not an
122
123
  * administrator, an exception will be thrown.
123
124
  */
124
125
  updateServerSettings(settings: any): Promise<any>;
125
126
  /**
126
- * Returns a list of server users.
127
+ * Returns the list of server users.
127
128
  *
128
129
  * Only administrators can get a list of users. If the current logged in user is not an
129
130
  * administrator, an exception will be thrown.
130
131
  */
131
132
  getUsers(): Promise<User[]>;
132
133
  /**
133
- * Returns the user information.
134
+ * Returns information about the specified user.
134
135
  *
135
136
  * Only administrators can get other users. If the current logged in user is not an
136
137
  * administrator, they can only get themselves, otherwise an exception will be thrown.
@@ -139,18 +140,18 @@ export declare class Client extends EventEmitter2<ClientEventMap> {
139
140
  */
140
141
  getUser(userId: string): Promise<User>;
141
142
  /**
142
- * Create a new user.
143
+ * Creates a new user on the server.
143
144
  *
144
145
  * Only administrators can create users. If the current logged in user is not an
145
146
  * administrator, an exception will be thrown.
146
147
  *
147
- * @param email - User email. Cannot be empty.
148
+ * @param email - User email. Cannot be empty. Must be unique within the server.
148
149
  * @param password - User password. Cannot be empty. Password can only contain latin letters
149
150
  * (a-z, A-Z), numbers (0-9), and special characters (~!@#$%^&*()_-+={}[]<>|/'":;.,?).
150
151
  * @param params - Additional user data.
151
152
  * @param params.isAdmin - `true` if user is an administrator.
152
- * @param params.userName - User name. Cannot be empty or blank if defined. Leave undefined
153
- * to use `username` from email.
153
+ * @param params.userName - User name. Cannot be empty or blank if defined. Specify
154
+ * `undefined` to use `username` from email.
154
155
  * @param params.firstName - First name.
155
156
  * @param params.lastName - Last name.
156
157
  * @param params.canCreateProject - `true` if user is allowed to create a project.
@@ -167,7 +168,7 @@ export declare class Client extends EventEmitter2<ClientEventMap> {
167
168
  storageLimit?: number;
168
169
  }): Promise<User>;
169
170
  /**
170
- * Delete a user from the server.
171
+ * Deletes the specified user from the server.
171
172
  *
172
173
  * Only administrators can delete users. If the current logged in user is not an
173
174
  * administrator, an exception will be thrown.
@@ -175,7 +176,7 @@ export declare class Client extends EventEmitter2<ClientEventMap> {
175
176
  * Administrators can delete themselves or other administrators. An administrator can only
176
177
  * delete themself if they is not the last administrator.
177
178
  *
178
- * You need to re-login to continue working after deleting the current logged in user.
179
+ * You need to re-login after deleting the current logged in user.
179
180
  *
180
181
  * @param userId - User ID.
181
182
  * @returns Returns the raw data of a deleted user.
@@ -192,17 +193,15 @@ export declare class Client extends EventEmitter2<ClientEventMap> {
192
193
  * @property {number} size - The number of files in the result list.
193
194
  */
194
195
  /**
195
- * Returns a list of files the user has access to.
196
+ * Returns a list of files that the current logged in user has uploaded to the server or has access to.
196
197
  *
197
198
  * @param start - The starting index in the file list. Used for paging.
198
199
  * @param limit - The maximum number of files that should be returned per request. Used for paging.
199
- * @param name - Filter the files by part of the name.
200
+ * @param name - Filter the files by part of the name. Case sensitive.
200
201
  * @param ext - Filter the files by extension. Extension can be `dgn`, `dwf`, `dwg`, `dxf`,
201
202
  * `ifc`, `ifczip`, `nwc`, `nwd`, `obj`, `rcs`, `rfa`, `rvt`, `step`, `stl`, `stp`, `vsf`,
202
- * or any other drawing or reference file type extension. You can specify multiple
203
- * extensions on one string by separating them with a `|`.
204
- * @param ids - List of file IDs to return. You can specify multiple IDs on one `string` by
205
- * separating them with a `|`.
203
+ * or any other file type extension.
204
+ * @param ids - List of file IDs to return.
206
205
  * @param sortByDesc - Allows to specify the descending order of the result. By default,
207
206
  * files are sorted by name in ascending order.
208
207
  * @param {string} sortField - Allows to specify sort field.
@@ -215,7 +214,7 @@ export declare class Client extends EventEmitter2<ClientEventMap> {
215
214
  size: number;
216
215
  }>;
217
216
  /**
218
- * Returns the file information.
217
+ * Returns information about the specified file.
219
218
  *
220
219
  * @param fileId - File ID.
221
220
  */
@@ -227,16 +226,16 @@ export declare class Client extends EventEmitter2<ClientEventMap> {
227
226
  *
228
227
  * - {@link UploadProgressEvent | uploadprogress}
229
228
  *
230
- * @param file - Web API {@link https://developer.mozilla.org/docs/Web/API/File | File} object
229
+ * @param file - {@link https://developer.mozilla.org/docs/Web/API/File | Web API File} object
231
230
  * are generally retrieved from a
232
231
  * {@link https://developer.mozilla.org/docs/Web/API/FileList | FileList} object returned as
233
232
  * a result of a user selecting files using the HTML `<input>` element.
234
233
  * @param params - An object containing upload parameters.
235
- * @param params.geometry - Create job to extract file geometry data. Can be:
234
+ * @param params.geometry - Create job to convert file geometry data. Can be:
236
235
  *
237
- * - `true` - Extract file geometry data into `VSFX` to open the file in `VisualizeJS` viewer.
238
- * - `vsfx` - Extract file geometry data into `VSFX` to open the file in `VisualizeJS` viewer.
239
- * - `gltf` - Extract file geometry data into `glTF` to open the file in `Three.js` viewer.
236
+ * - `true` - Convert file geometry data to `VSFX` format to open the file in `VisualizeJS` viewer.
237
+ * - `vsfx` - Convert file geometry data to `VSFX` format to open the file in `VisualizeJS` viewer.
238
+ * - `gltf` - Convert file geometry data to `glTF` format to open the file in `Three.js` viewer.
240
239
  *
241
240
  * @param params.properties - Create job to extract file properties.
242
241
  * @param params.waitForDone - Wait for geometry and properties jobs to complete.
@@ -245,7 +244,7 @@ export declare class Client extends EventEmitter2<ClientEventMap> {
245
244
  * @param params.interval - The time, in milliseconds, the function should delay in between
246
245
  * checking jobs status.
247
246
  * @param params.signal - An
248
- * {@link https://developer.mozilla.org/docs/Web/API/AbortController | AbortController} *
247
+ * {@link https://developer.mozilla.org/docs/Web/API/AbortController | AbortController}
249
248
  * signal, which can be used to abort waiting as desired.
250
249
  * @param params.onProgress - Upload progress callback.
251
250
  */
@@ -259,14 +258,17 @@ export declare class Client extends EventEmitter2<ClientEventMap> {
259
258
  onProgress?: (progress: number, file: globalThis.File) => void;
260
259
  }): Promise<File>;
261
260
  /**
262
- * Delete the drawing or reference file from the server.
261
+ * Deletes the specified file and all its versions from the server.
262
+ *
263
+ * You cannot delete a version file using `deleteFile()`, only the original file. To delete a
264
+ * version file use {@link File.deleteVersion | File.deleteVersion()}.
263
265
  *
264
266
  * @param fileId - File ID.
265
267
  * @returns Returns the raw data of a deleted file.
266
268
  */
267
269
  deleteFile(fileId: string): Promise<any>;
268
270
  /**
269
- * Download the drawing or reference file.
271
+ * Downloads the specified file from the server.
270
272
  *
271
273
  * @param fileId - File ID.
272
274
  * @param onProgress - Download progress callback.
@@ -286,10 +288,9 @@ export declare class Client extends EventEmitter2<ClientEventMap> {
286
288
  * @property {number} size - The number of jobs in the result list.
287
289
  */
288
290
  /**
289
- * Returns a list of jobs created by current user.
291
+ * Returns a list of jobs started by the current logged in user.
290
292
  *
291
- * @param status - Filter the jobs by status. Status can be `waiting`, `inpogress`, `done` or
292
- * `failed`. You can specify multiple statuses on one `string` by separating them with a "|".
293
+ * @param status - Filter the jobs by status. Status can be `waiting`, `inpogress`, `done` or `failed`.
293
294
  * @param limit - The maximum number of jobs that should be returned per request. Used for paging.
294
295
  * @param start - The starting index in the job list. Used for paging.
295
296
  * @param sortByDesc - Allows to specify the descending order of the result. By default, jobs
@@ -304,21 +305,21 @@ export declare class Client extends EventEmitter2<ClientEventMap> {
304
305
  size: number;
305
306
  }>;
306
307
  /**
307
- * Returns the job information.
308
+ * Returns information about the specified job.
308
309
  *
309
310
  * @param jobId - Job ID.
310
311
  */
311
312
  getJob(jobId: string): Promise<Job>;
312
313
  /**
313
- * Create a new job.
314
+ * Runs a new job on the server for the sepecified file.
314
315
  *
315
316
  * @param fileId - File ID.
316
317
  * @param outputFormat - The job type. Can be one of:
317
318
  *
318
- * - `geometry` - Extract file geometry data into `VSFX`.
319
- * - `geometryGltf` - Extract file geometry data into `glTF`.
319
+ * - `geometry` - Convert file geometry data to `VSFX` format suitable for `VisualizeJS` viewer.
320
+ * - `geometryGltf` - Convert file geometry data to `glTF` format suitable for `Three.js` viewer.
320
321
  * - `properties` - Extract file properties.
321
- * - `validation` - Validate the file. Only for `IFC`.
322
+ * - `validation` - Validate the file. Only for `IFC` files.
322
323
  * - `dwg`, `obj`, `gltf`, `glb`, `vsf`, `pdf`, `3dpdf` - Export file to the one of the supported format.
323
324
  * - Other custom job name. Custom job runner must be registered in the job templates table
324
325
  * before creating a job.
@@ -328,8 +329,8 @@ export declare class Client extends EventEmitter2<ClientEventMap> {
328
329
  */
329
330
  createJob(fileId: string, outputFormat: string, parameters?: string | object): Promise<Job>;
330
331
  /**
331
- * Remove a job from the server job list. The method does not delete or stop jobs that are
332
- * already being executed.
332
+ * Deletes the specified job from the server job list. Jobs that are in progress or have
333
+ * already been completed cannot be deleted.
333
334
  *
334
335
  * @param jobId - Job ID.
335
336
  * @returns Returns the raw data of a deleted job.
@@ -346,14 +347,13 @@ export declare class Client extends EventEmitter2<ClientEventMap> {
346
347
  * @property {number} size - The number of assemblies in the result list.
347
348
  */
348
349
  /**
349
- * Returns a list of assemblies the user has access to.
350
+ * Returns a list of assemblies created by the current logged in user.
350
351
  *
351
352
  * @param start - The starting index in the assembly list. Used for paging.
352
353
  * @param limit - The maximum number of assemblies that should be returned per request. Used
353
354
  * for paging.
354
- * @param name - Filter the assemblies by part of the name.
355
- * @param ids - List of assembly IDs to return. You can specify multiple IDs on one `string`
356
- * by separating them with a "|".
355
+ * @param name - Filter the assemblies by part of the name. Case sensitive.
356
+ * @param ids - List of assembly IDs to return.
357
357
  * @param sortByDesc - Allows to specify the descending order of the result. By default
358
358
  * assemblies are sorted by name in ascending order.
359
359
  * @param sortField - Allows to specify sort field.
@@ -366,27 +366,37 @@ export declare class Client extends EventEmitter2<ClientEventMap> {
366
366
  size: number;
367
367
  }>;
368
368
  /**
369
- * Get assembly information.
369
+ * Returns information about the specified assembly.
370
370
  *
371
371
  * @param assemblyId - Assembly ID.
372
372
  */
373
373
  getAssembly(assemblyId: string): Promise<Assembly>;
374
374
  /**
375
- * Create a new assembly.
375
+ * Creates a new assembly on the server.
376
376
  *
377
377
  * @param files - List of file IDs.
378
378
  * @param name - Assembly name.
379
- * @param params - An object containing upload parameters.
379
+ * @param params - Additional assembly creating parameters.
380
380
  * @param params.waitForDone - Wait for assembly to be created.
381
+ * @param params.timeout - The time, in milliseconds, that the function should wait for the
382
+ * assembly to be created. If the assembly is not created within this time, a TimeoutError
383
+ * exception will be thrown.
384
+ * @param params.interval - The time, in milliseconds, the function should delay in between
385
+ * checking assembly status.
386
+ * @param params.signal - An
387
+ * {@link https://developer.mozilla.org/docs/Web/API/AbortController | AbortController}
388
+ * signal, which can be used to abort waiting as desired.
389
+ * @param params.onCheckout - Waiting progress callback. Return `true` to cancel waiting.
381
390
  */
382
391
  createAssembly(files: string[], name: string, params?: {
383
392
  waitForDone?: boolean;
384
393
  timeout?: number;
385
394
  interval?: number;
386
395
  signal?: AbortSignal;
396
+ onCheckout?: (assembly: Assembly, ready: boolean) => boolean;
387
397
  }): Promise<Assembly>;
388
398
  /**
389
- * Delete the assembly from the server.
399
+ * Deletes the specified assembly from the server.
390
400
  *
391
401
  * @param assemblyId - Assembly ID.
392
402
  * @returns Returns the raw data of a deleted assembly.
@@ -403,13 +413,12 @@ export declare class Client extends EventEmitter2<ClientEventMap> {
403
413
  * @property {number} size - The number of projects in the result list.
404
414
  */
405
415
  /**
406
- * Returns a list of projects the user has access to.
416
+ * Returns a list of projects that the currently logged in user has created or has access to.
407
417
  *
408
418
  * @param start - The starting index in the project list. Used for paging.
409
419
  * @param limit - The maximum number of projects that should be returned per request. Used for paging.
410
- * @param name - Filter the projects by part of the name.
411
- * @param ids - List of project IDs to return. You can specify multiple IDs on one `string`
412
- * by separating them with a "|".
420
+ * @param name - Filter the projects by part of the name. Case sensitive.
421
+ * @param ids - List of project IDs to return.
413
422
  * @param sortByDesc - Allows to specify the descending order of the result. By default
414
423
  * projects are sorted by name in ascending order.
415
424
  */
@@ -421,13 +430,13 @@ export declare class Client extends EventEmitter2<ClientEventMap> {
421
430
  size: number;
422
431
  }>;
423
432
  /**
424
- * Returns the project information.
433
+ * Returns information about the specified project.
425
434
  *
426
435
  * @param projectId - Project ID.
427
436
  */
428
437
  getProject(projectId: string): Promise<Project>;
429
438
  /**
430
- * Create a new project.
439
+ * Creates a new project on the server.
431
440
  *
432
441
  * @param name - Project name.
433
442
  * @param description - Project description.
@@ -436,7 +445,7 @@ export declare class Client extends EventEmitter2<ClientEventMap> {
436
445
  */
437
446
  createProject(name: string, description?: string, startDate?: Date | string, endDate?: Date | string): Promise<Project>;
438
447
  /**
439
- * Delete the project from the server.
448
+ * Deletes the specified project from the server.
440
449
  *
441
450
  * @param projectId - Project ID.
442
451
  * @returns Returns the raw data of a deleted project.
@@ -13,7 +13,7 @@ export interface UploadProgressEvent {
13
13
  */
14
14
  data: number;
15
15
  /**
16
- * File object to upload.
16
+ * {@link https://developer.mozilla.org/docs/Web/API/File | Web API File} object to upload.
17
17
  */
18
18
  file: globalThis.File;
19
19
  }