@inweb/client 25.3.17 → 25.3.18
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/dist/client.js +698 -527
- package/dist/client.js.map +1 -1
- package/dist/client.min.js +1 -1
- package/dist/client.module.js +473 -484
- package/dist/client.module.js.map +1 -1
- package/lib/Api/Assembly.d.ts +32 -8
- package/lib/Api/ClashTest.d.ts +1 -1
- package/lib/Api/Client.d.ts +2 -3
- package/lib/Api/Fetch.d.ts +6 -0
- package/lib/Api/{impl/FetchError.d.ts → FetchError.d.ts} +2 -0
- package/lib/Api/File.d.ts +34 -10
- package/lib/Api/HttpClient.d.ts +9 -3
- package/lib/Api/IHttpClient.d.ts +10 -4
- package/lib/Api/Job.d.ts +1 -1
- package/lib/Api/Model.d.ts +33 -9
- package/lib/Api/Project.d.ts +3 -3
- package/lib/Api/User.d.ts +1 -1
- package/lib/Api/Utils.d.ts +11 -0
- package/lib/Api/XMLHttp.d.ts +7 -0
- package/lib/index.d.ts +1 -1
- package/package.json +1 -1
- package/src/Api/Assembly.ts +76 -70
- package/src/Api/ClashTest.ts +10 -19
- package/src/Api/Client.ts +92 -56
- package/src/Api/Fetch.ts +84 -0
- package/src/Api/{impl/http.ts → FetchError.ts} +33 -1
- package/src/Api/File.ts +112 -117
- package/src/Api/HttpClient.ts +107 -20
- package/src/Api/IHttpClient.ts +17 -12
- package/src/Api/Job.ts +7 -5
- package/src/Api/Member.ts +7 -5
- package/src/Api/Model.ts +61 -14
- package/src/Api/Permission.ts +6 -5
- package/src/Api/Project.ts +93 -88
- package/src/Api/Role.ts +6 -5
- package/src/Api/User.ts +28 -17
- package/src/Api/Utils.ts +104 -0
- package/src/Api/XMLHttp.ts +72 -0
- package/src/index.ts +1 -1
- package/lib/Api/impl/Utils.d.ts +0 -32
- package/lib/Api/impl/http.d.ts +0 -66
- package/src/Api/impl/FetchError.ts +0 -48
- package/src/Api/impl/Utils.ts +0 -367
package/src/Api/Job.ts
CHANGED
|
@@ -22,7 +22,7 @@
|
|
|
22
22
|
///////////////////////////////////////////////////////////////////////////////
|
|
23
23
|
|
|
24
24
|
import { IHttpClient } from "./IHttpClient";
|
|
25
|
-
import {
|
|
25
|
+
import { waitFor } from "./Utils";
|
|
26
26
|
|
|
27
27
|
/**
|
|
28
28
|
* The class representing a `job` entity describes the process of converting a file from one
|
|
@@ -45,7 +45,7 @@ export class Job {
|
|
|
45
45
|
return this.httpClient.get(`/jobs/${this.data.id}`);
|
|
46
46
|
}
|
|
47
47
|
|
|
48
|
-
protected internalPut(body?:
|
|
48
|
+
protected internalPut(body?: BodyInit | object) {
|
|
49
49
|
return this.httpClient.put(`/jobs/${this.data.id}`, body);
|
|
50
50
|
}
|
|
51
51
|
|
|
@@ -184,7 +184,8 @@ export class Job {
|
|
|
184
184
|
* @async
|
|
185
185
|
*/
|
|
186
186
|
async checkout(): Promise<Job> {
|
|
187
|
-
|
|
187
|
+
const response = await this.internalGet();
|
|
188
|
+
this.data = await response.json();
|
|
188
189
|
return this;
|
|
189
190
|
}
|
|
190
191
|
|
|
@@ -195,7 +196,8 @@ export class Job {
|
|
|
195
196
|
* @param data - Raw job data.
|
|
196
197
|
*/
|
|
197
198
|
async update(data: any): Promise<Job> {
|
|
198
|
-
|
|
199
|
+
const response = await this.internalPut(data);
|
|
200
|
+
this.data = await response.json();
|
|
199
201
|
return this;
|
|
200
202
|
}
|
|
201
203
|
|
|
@@ -207,7 +209,7 @@ export class Job {
|
|
|
207
209
|
* @returns Returns the raw data of a deleted job.
|
|
208
210
|
*/
|
|
209
211
|
delete(): Promise<any> {
|
|
210
|
-
return
|
|
212
|
+
return this.internalDelete().then((response) => response.json());
|
|
211
213
|
}
|
|
212
214
|
|
|
213
215
|
// /**
|
package/src/Api/Member.ts
CHANGED
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
|
|
24
24
|
import { IHttpClient } from "./IHttpClient";
|
|
25
25
|
import { IShortUserDescription } from "./IUser";
|
|
26
|
-
import {
|
|
26
|
+
import { userFullName, userInitials } from "./Utils";
|
|
27
27
|
|
|
28
28
|
/**
|
|
29
29
|
* Members are the {@link User | users} who have access to the {@link Project | project}.
|
|
@@ -48,7 +48,7 @@ export class Member {
|
|
|
48
48
|
return this.httpClient.get(`/projects/${this.projectId}/members/${this.id}`);
|
|
49
49
|
}
|
|
50
50
|
|
|
51
|
-
private internalPut(body?:
|
|
51
|
+
private internalPut(body?: BodyInit | object) {
|
|
52
52
|
return this.httpClient.put(`/projects/${this.projectId}/members/${this.id}`, body);
|
|
53
53
|
}
|
|
54
54
|
|
|
@@ -124,7 +124,8 @@ export class Member {
|
|
|
124
124
|
* @async
|
|
125
125
|
*/
|
|
126
126
|
async checkout(): Promise<Member> {
|
|
127
|
-
|
|
127
|
+
const response = await this.internalGet();
|
|
128
|
+
this.data = await response.json();
|
|
128
129
|
return this;
|
|
129
130
|
}
|
|
130
131
|
|
|
@@ -135,7 +136,8 @@ export class Member {
|
|
|
135
136
|
* @param data - Raw member data.
|
|
136
137
|
*/
|
|
137
138
|
async update(data: any): Promise<Member> {
|
|
138
|
-
|
|
139
|
+
const response = await this.internalPut(data);
|
|
140
|
+
this.data = await response.json();
|
|
139
141
|
return this;
|
|
140
142
|
}
|
|
141
143
|
|
|
@@ -146,7 +148,7 @@ export class Member {
|
|
|
146
148
|
* @returns Returns the raw data of a deleted member.
|
|
147
149
|
*/
|
|
148
150
|
delete(): Promise<any> {
|
|
149
|
-
return
|
|
151
|
+
return this.internalDelete().then((response) => response.json());
|
|
150
152
|
}
|
|
151
153
|
|
|
152
154
|
/**
|
package/src/Api/Model.ts
CHANGED
|
@@ -69,8 +69,8 @@ export class Model {
|
|
|
69
69
|
}
|
|
70
70
|
|
|
71
71
|
/**
|
|
72
|
-
* Scene description file
|
|
73
|
-
*
|
|
72
|
+
* Scene description resource file name. Use {@link Model.downloadResource()} to download
|
|
73
|
+
* scene description file.
|
|
74
74
|
*
|
|
75
75
|
* @readonly
|
|
76
76
|
*/
|
|
@@ -106,8 +106,8 @@ export class Model {
|
|
|
106
106
|
}
|
|
107
107
|
|
|
108
108
|
/**
|
|
109
|
-
* The list of
|
|
110
|
-
*
|
|
109
|
+
* The list of geometry data resource files. Use {@link Model.downloadResource()} to download
|
|
110
|
+
* geometry data files.
|
|
111
111
|
*
|
|
112
112
|
* @readonly
|
|
113
113
|
*/
|
|
@@ -247,10 +247,11 @@ export class Model {
|
|
|
247
247
|
}
|
|
248
248
|
|
|
249
249
|
/**
|
|
250
|
-
*
|
|
250
|
+
* Download model resource file. Resource files are files that contain model scene
|
|
251
|
+
* descriptions, or geometry data.
|
|
251
252
|
*
|
|
252
253
|
* @async
|
|
253
|
-
* @param
|
|
254
|
+
* @param dataId - Resource file name.
|
|
254
255
|
* @param onProgress - Download progress callback.
|
|
255
256
|
* @param signal - An <a href="https://developer.mozilla.org/docs/Web/API/AbortSignal" target
|
|
256
257
|
* ="_blank">AbortSignal</a> object instance. Allows to communicate with a fetch request
|
|
@@ -258,30 +259,76 @@ export class Model {
|
|
|
258
259
|
*/
|
|
259
260
|
downloadResource(
|
|
260
261
|
dataId: string,
|
|
261
|
-
onProgress?: (progress: number) => void,
|
|
262
|
+
onProgress?: (progress: number, chunk: Uint8Array) => void,
|
|
262
263
|
signal?: AbortSignal
|
|
263
264
|
): Promise<ArrayBuffer> {
|
|
264
265
|
return this._file.downloadResource(dataId, onProgress, signal);
|
|
265
266
|
}
|
|
266
267
|
|
|
267
|
-
|
|
268
|
+
/**
|
|
269
|
+
* Download a part of model resource file. Resource files are files that contain model scene
|
|
270
|
+
* descriptions, or geometry data.
|
|
271
|
+
*
|
|
272
|
+
* @param dataId - Resource file name.
|
|
273
|
+
* @param ranges - A range of resource file contents to download.
|
|
274
|
+
* @param requestId - Request ID for download progress callback.
|
|
275
|
+
* @param onProgress - Download progress callback.
|
|
276
|
+
* @param signal - An <a href="https://developer.mozilla.org/docs/Web/API/AbortSignal" target
|
|
277
|
+
* ="_blank">AbortSignal</a> object instance. Allows to communicate with a fetch request
|
|
278
|
+
* and abort it if desired.
|
|
279
|
+
*/
|
|
280
|
+
downloadResourceRange(
|
|
281
|
+
dataId: string,
|
|
282
|
+
ranges: Array<{ begin: number; end: number; requestId: number }>,
|
|
283
|
+
requestId: number,
|
|
284
|
+
onProgress?: (progress: number, chunk: Uint8Array, requestId: number) => void,
|
|
285
|
+
signal?: AbortSignal
|
|
286
|
+
): Promise<ArrayBuffer> {
|
|
287
|
+
return this._file.downloadResourceRange(dataId, ranges, requestId, onProgress, signal);
|
|
288
|
+
}
|
|
268
289
|
|
|
290
|
+
/**
|
|
291
|
+
* Deprecated since `25.3`. Use {@link Model.downloadResource()} instead.
|
|
292
|
+
*/
|
|
269
293
|
partialDownloadResource(
|
|
270
294
|
dataId: string,
|
|
271
|
-
onProgress?: (progress: number,
|
|
295
|
+
onProgress?: (progress: number, chunk: Uint8Array) => void,
|
|
272
296
|
signal?: AbortSignal
|
|
273
|
-
): Promise<
|
|
274
|
-
|
|
297
|
+
): Promise<ArrayBuffer> {
|
|
298
|
+
console.warn(
|
|
299
|
+
"Model.partialDownloadResource() has been deprecated since 25.3 and will be removed in a future release, use Model.downloadResource() instead."
|
|
300
|
+
);
|
|
301
|
+
return this.downloadResource(dataId, onProgress, signal);
|
|
275
302
|
}
|
|
276
303
|
|
|
277
|
-
|
|
304
|
+
/**
|
|
305
|
+
* Deprecated since `25.3`. Use {@link Model.downloadResourceRange()} instead.
|
|
306
|
+
*/
|
|
307
|
+
async downloadFileRange(
|
|
278
308
|
requestId: number,
|
|
279
309
|
records: any | null,
|
|
280
310
|
dataId: string,
|
|
281
|
-
onProgress?: (progress: number,
|
|
311
|
+
onProgress?: (progress: number, chunk: Uint8Array, requestId: number) => void,
|
|
282
312
|
signal?: AbortSignal
|
|
283
313
|
): Promise<void> {
|
|
284
|
-
|
|
314
|
+
if (!records) return;
|
|
315
|
+
|
|
316
|
+
let ranges = [];
|
|
317
|
+
if (records.length) {
|
|
318
|
+
ranges = records.map((record) => ({
|
|
319
|
+
begin: Number(record.begin),
|
|
320
|
+
end: Number(record.end),
|
|
321
|
+
requestId: record.reqId,
|
|
322
|
+
}));
|
|
323
|
+
} else {
|
|
324
|
+
for (let i = 0; i < records.size(); i++) {
|
|
325
|
+
const record = records.get(i);
|
|
326
|
+
ranges.push({ begin: Number(record.begin), end: Number(record.end), requestId });
|
|
327
|
+
record.delete();
|
|
328
|
+
}
|
|
329
|
+
}
|
|
330
|
+
|
|
331
|
+
await this.downloadResourceRange(dataId, ranges, requestId, onProgress, signal);
|
|
285
332
|
}
|
|
286
333
|
|
|
287
334
|
/**
|
package/src/Api/Permission.ts
CHANGED
|
@@ -22,7 +22,6 @@
|
|
|
22
22
|
///////////////////////////////////////////////////////////////////////////////
|
|
23
23
|
|
|
24
24
|
import { IHttpClient } from "./IHttpClient";
|
|
25
|
-
import { json } from "./impl/Utils";
|
|
26
25
|
|
|
27
26
|
/**
|
|
28
27
|
* A permission provides information about {@link File | file} sharing granted to a specific
|
|
@@ -48,7 +47,7 @@ export class Permission {
|
|
|
48
47
|
return this.httpClient.get(`/files/${this.fileId}/permissions/${this.id}`);
|
|
49
48
|
}
|
|
50
49
|
|
|
51
|
-
private internalPut(body?:
|
|
50
|
+
private internalPut(body?: BodyInit | object) {
|
|
52
51
|
return this.httpClient.put(`/files/${this.fileId}/permissions/${this.id}`, body);
|
|
53
52
|
}
|
|
54
53
|
|
|
@@ -136,7 +135,8 @@ export class Permission {
|
|
|
136
135
|
* @async
|
|
137
136
|
*/
|
|
138
137
|
async checkout(): Promise<Permission> {
|
|
139
|
-
|
|
138
|
+
const response = await this.internalGet();
|
|
139
|
+
this.data = await response.json();
|
|
140
140
|
return this;
|
|
141
141
|
}
|
|
142
142
|
|
|
@@ -147,7 +147,8 @@ export class Permission {
|
|
|
147
147
|
* @param data - Raw permission data.
|
|
148
148
|
*/
|
|
149
149
|
async update(data: any): Promise<Permission> {
|
|
150
|
-
|
|
150
|
+
const response = await this.internalPut(data);
|
|
151
|
+
this.data = await response.json();
|
|
151
152
|
return this;
|
|
152
153
|
}
|
|
153
154
|
|
|
@@ -158,7 +159,7 @@ export class Permission {
|
|
|
158
159
|
* @returns Returns the raw data of a deleted permission.
|
|
159
160
|
*/
|
|
160
161
|
delete(): Promise<any> {
|
|
161
|
-
return
|
|
162
|
+
return this.internalDelete().then((response) => response.json());
|
|
162
163
|
}
|
|
163
164
|
|
|
164
165
|
/**
|
package/src/Api/Project.ts
CHANGED
|
@@ -25,7 +25,7 @@ import { IHttpClient } from "./IHttpClient";
|
|
|
25
25
|
import { IShortUserDescription } from "./IUser";
|
|
26
26
|
import { Role } from "./Role";
|
|
27
27
|
import { Member } from "./Member";
|
|
28
|
-
import {
|
|
28
|
+
import { userFullName, userInitials } from "./Utils";
|
|
29
29
|
|
|
30
30
|
/**
|
|
31
31
|
* Projects are used to collaborate on models and track issues.
|
|
@@ -47,17 +47,11 @@ export class Project {
|
|
|
47
47
|
return this.httpClient.get(`/projects/${this.id}${relativePath}`);
|
|
48
48
|
}
|
|
49
49
|
|
|
50
|
-
protected internalPost(
|
|
51
|
-
relativePath: string,
|
|
52
|
-
body?: ArrayBuffer | Blob | globalThis.File | FormData | object | string | null
|
|
53
|
-
) {
|
|
50
|
+
protected internalPost(relativePath: string, body?: BodyInit | object) {
|
|
54
51
|
return this.httpClient.post(`/projects/${this.id}${relativePath}`, body);
|
|
55
52
|
}
|
|
56
53
|
|
|
57
|
-
protected internalPut(
|
|
58
|
-
relativePath: string,
|
|
59
|
-
body?: ArrayBuffer | Blob | globalThis.File | FormData | object | string | null
|
|
60
|
-
) {
|
|
54
|
+
protected internalPut(relativePath: string, body?: BodyInit | object) {
|
|
61
55
|
return this.httpClient.put(`/projects/${this.id}${relativePath}`, body);
|
|
62
56
|
}
|
|
63
57
|
|
|
@@ -249,7 +243,8 @@ export class Project {
|
|
|
249
243
|
* @async
|
|
250
244
|
*/
|
|
251
245
|
async checkout(): Promise<Project> {
|
|
252
|
-
|
|
246
|
+
const response = await this.internalGet("");
|
|
247
|
+
this.data = await response.json();
|
|
253
248
|
return this;
|
|
254
249
|
}
|
|
255
250
|
|
|
@@ -260,7 +255,8 @@ export class Project {
|
|
|
260
255
|
* @param data - Raw project data.
|
|
261
256
|
*/
|
|
262
257
|
async update(data: any): Promise<Project> {
|
|
263
|
-
|
|
258
|
+
const response = await this.internalPut("", data);
|
|
259
|
+
this.data = await response.json();
|
|
264
260
|
return this;
|
|
265
261
|
}
|
|
266
262
|
|
|
@@ -271,14 +267,16 @@ export class Project {
|
|
|
271
267
|
* @returns Returns the raw data of a deleted project.
|
|
272
268
|
*/
|
|
273
269
|
delete(): Promise<any> {
|
|
274
|
-
return
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
270
|
+
return this.internalDelete("")
|
|
271
|
+
.then((response) => response.text())
|
|
272
|
+
.then((text) => {
|
|
273
|
+
// TODO fix for server 23.5 and below
|
|
274
|
+
try {
|
|
275
|
+
return JSON.parse(text);
|
|
276
|
+
} catch {
|
|
277
|
+
return { id: this.id };
|
|
278
|
+
}
|
|
279
|
+
});
|
|
282
280
|
}
|
|
283
281
|
|
|
284
282
|
/**
|
|
@@ -305,12 +303,9 @@ export class Project {
|
|
|
305
303
|
* target="_blank">File</a> object. Setting the `image` to `null` will remove the preview.
|
|
306
304
|
*/
|
|
307
305
|
|
|
308
|
-
async setPreview(image
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
} else {
|
|
312
|
-
this.data = await json(this.internalDelete("/preview"));
|
|
313
|
-
}
|
|
306
|
+
async setPreview(image: BodyInit | null) {
|
|
307
|
+
const response = await (image ? this.internalPost("/preview", image) : this.internalDelete("/preview"));
|
|
308
|
+
this.data = await response.json();
|
|
314
309
|
return this;
|
|
315
310
|
}
|
|
316
311
|
|
|
@@ -321,9 +316,9 @@ export class Project {
|
|
|
321
316
|
* @async
|
|
322
317
|
*/
|
|
323
318
|
getRoles(): Promise<Role[]> {
|
|
324
|
-
return
|
|
325
|
-
|
|
326
|
-
|
|
319
|
+
return this.internalGet("/roles")
|
|
320
|
+
.then((response) => response.json())
|
|
321
|
+
.then((array) => array.map((data) => new Role(data, this.id, this.httpClient)));
|
|
327
322
|
}
|
|
328
323
|
|
|
329
324
|
/**
|
|
@@ -333,7 +328,9 @@ export class Project {
|
|
|
333
328
|
* @param name - Role name.
|
|
334
329
|
*/
|
|
335
330
|
getRole(name: string): Promise<Role> {
|
|
336
|
-
return
|
|
331
|
+
return this.internalGet(`/roles/${name}`)
|
|
332
|
+
.then((response) => response.json())
|
|
333
|
+
.then((data) => new Role(data, this.id, this.httpClient));
|
|
337
334
|
}
|
|
338
335
|
|
|
339
336
|
/**
|
|
@@ -346,13 +343,13 @@ export class Project {
|
|
|
346
343
|
* {@link Role#permissions | Role.permissions} for more details.
|
|
347
344
|
*/
|
|
348
345
|
createRole(name: string, description: string, permissions: any): Promise<Role> {
|
|
349
|
-
return
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
346
|
+
return this.internalPost("/roles", {
|
|
347
|
+
name,
|
|
348
|
+
description,
|
|
349
|
+
permissions: permissions || {},
|
|
350
|
+
})
|
|
351
|
+
.then((response) => response.json())
|
|
352
|
+
.then((data) => new Role(data, this.id, this.httpClient));
|
|
356
353
|
}
|
|
357
354
|
|
|
358
355
|
/**
|
|
@@ -363,7 +360,7 @@ export class Project {
|
|
|
363
360
|
* @returns Returns the raw data of a deleted role.
|
|
364
361
|
*/
|
|
365
362
|
deleteRole(name: string): Promise<any> {
|
|
366
|
-
return
|
|
363
|
+
return this.internalDelete(`/roles/${name}`).then((response) => response.json());
|
|
367
364
|
}
|
|
368
365
|
|
|
369
366
|
/**
|
|
@@ -372,9 +369,9 @@ export class Project {
|
|
|
372
369
|
* @async
|
|
373
370
|
*/
|
|
374
371
|
getMembers(): Promise<Member[]> {
|
|
375
|
-
return
|
|
376
|
-
|
|
377
|
-
|
|
372
|
+
return this.internalGet("/members")
|
|
373
|
+
.then((response) => response.json())
|
|
374
|
+
.then((array) => array.map((data) => new Member(data, this.id, this.httpClient)));
|
|
378
375
|
}
|
|
379
376
|
|
|
380
377
|
/**
|
|
@@ -384,7 +381,9 @@ export class Project {
|
|
|
384
381
|
* @param memberId - Member ID.
|
|
385
382
|
*/
|
|
386
383
|
getMember(memberId: string): Promise<Member> {
|
|
387
|
-
return
|
|
384
|
+
return this.internalGet(`/members/${memberId}`)
|
|
385
|
+
.then((response) => response.json())
|
|
386
|
+
.then((data) => new Member(data, this.id, this.httpClient));
|
|
388
387
|
}
|
|
389
388
|
|
|
390
389
|
/**
|
|
@@ -395,9 +394,9 @@ export class Project {
|
|
|
395
394
|
* @param role - User role from the list of project roles.
|
|
396
395
|
*/
|
|
397
396
|
addMember(userId: string, role: string): Promise<Member> {
|
|
398
|
-
return
|
|
399
|
-
(
|
|
400
|
-
|
|
397
|
+
return this.internalPost("/members", { userId, role })
|
|
398
|
+
.then((response) => response.json())
|
|
399
|
+
.then((data) => new Member(data, this.id, this.httpClient));
|
|
401
400
|
}
|
|
402
401
|
|
|
403
402
|
/**
|
|
@@ -408,7 +407,7 @@ export class Project {
|
|
|
408
407
|
* @returns Returns the raw data of a deleted member.
|
|
409
408
|
*/
|
|
410
409
|
removeMember(memberId: string): Promise<any> {
|
|
411
|
-
return
|
|
410
|
+
return this.internalDelete(`/members/${memberId}`).then((response) => response.json());
|
|
412
411
|
}
|
|
413
412
|
|
|
414
413
|
/**
|
|
@@ -431,49 +430,55 @@ export class Project {
|
|
|
431
430
|
* @async
|
|
432
431
|
*/
|
|
433
432
|
getFilesInformation(): Promise<any[]> {
|
|
434
|
-
return
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
433
|
+
return this.httpClient
|
|
434
|
+
.get(`/bcf/3.0/projects/${this.data.id}/files_information`)
|
|
435
|
+
.then((response) => response.json())
|
|
436
|
+
.then((items) => {
|
|
437
|
+
items.forEach((item) => {
|
|
438
|
+
const getFieldValue = (displayName: string) => {
|
|
439
|
+
return (item.display_information.find((x) => x.field_display_name === displayName) || {}).field_value;
|
|
440
|
+
};
|
|
441
|
+
|
|
442
|
+
const previewUrl = `${this.httpClient.serverUrl}/files/${item.file.reference}/preview`;
|
|
443
|
+
const ownerAvatarUrl = `${this.httpClient.serverUrl}/users/${getFieldValue("Owner")}/avatar`;
|
|
444
|
+
|
|
445
|
+
const ownerFirstName = getFieldValue("Owner First Name");
|
|
446
|
+
const ownerLastName = getFieldValue("Owner Last Name");
|
|
447
|
+
const ownerUserName = getFieldValue("Owner User Name");
|
|
448
|
+
const ownerFullName = userFullName(ownerFirstName, ownerLastName, ownerUserName);
|
|
449
|
+
const ownerInitials = userInitials(ownerFullName);
|
|
450
|
+
|
|
451
|
+
item.display_information.push({ field_display_name: "Preview URL", field_value: previewUrl });
|
|
452
|
+
item.display_information.push({ field_display_name: "Owner Avatar URL", field_value: ownerAvatarUrl });
|
|
453
|
+
item.display_information.push({ field_display_name: "Owner Full Name", field_value: ownerFullName });
|
|
454
|
+
item.display_information.push({ field_display_name: "Owner Initials", field_value: ownerInitials });
|
|
455
|
+
|
|
456
|
+
// updatedBy since 24.10
|
|
457
|
+
|
|
458
|
+
const updatedByAvatarUrl = `${this.httpClient.serverUrl}/users/${getFieldValue("Updated By")}/avatar`;
|
|
459
|
+
|
|
460
|
+
const updatedByFirstName = getFieldValue("Updated By First Name");
|
|
461
|
+
const updatedByLastName = getFieldValue("Updated By Last Name");
|
|
462
|
+
const updatedByUserName = getFieldValue("Updated By User Name");
|
|
463
|
+
const updatedByFullName = userFullName(updatedByFirstName, updatedByLastName, updatedByUserName);
|
|
464
|
+
const updatedByInitials = userInitials(updatedByFullName);
|
|
465
|
+
|
|
466
|
+
item.display_information.push({
|
|
467
|
+
field_display_name: "Updated By Avatar URL",
|
|
468
|
+
field_value: updatedByAvatarUrl,
|
|
469
|
+
});
|
|
470
|
+
item.display_information.push({ field_display_name: "Updated By Full Name", field_value: updatedByFullName });
|
|
471
|
+
item.display_information.push({ field_display_name: "Updated By Initials", field_value: updatedByInitials });
|
|
472
|
+
|
|
473
|
+
// geometryType since 24.12
|
|
474
|
+
|
|
475
|
+
const geometry = getFieldValue("Geometry Status");
|
|
476
|
+
const geometryGltf = getFieldValue("GeometryGltf Status");
|
|
477
|
+
const geometryType = geometry === "done" ? "vsfx" : geometryGltf === "done" ? "gltf" : "";
|
|
478
|
+
|
|
479
|
+
item.display_information.push({ field_display_name: "Geometry Type", field_value: geometryType });
|
|
480
|
+
});
|
|
481
|
+
return items;
|
|
475
482
|
});
|
|
476
|
-
return items;
|
|
477
|
-
});
|
|
478
483
|
}
|
|
479
484
|
}
|
package/src/Api/Role.ts
CHANGED
|
@@ -22,7 +22,6 @@
|
|
|
22
22
|
///////////////////////////////////////////////////////////////////////////////
|
|
23
23
|
|
|
24
24
|
import { IHttpClient } from "./IHttpClient";
|
|
25
|
-
import { json } from "./impl/Utils";
|
|
26
25
|
|
|
27
26
|
/**
|
|
28
27
|
* A roles determines what permissions {@link User | users} have on a {@link Project | project}.
|
|
@@ -47,7 +46,7 @@ export class Role {
|
|
|
47
46
|
return this.httpClient.get(`/projects/${this.projectId}/roles/${this.name}`);
|
|
48
47
|
}
|
|
49
48
|
|
|
50
|
-
private internalPut(body?:
|
|
49
|
+
private internalPut(body?: BodyInit | object) {
|
|
51
50
|
return this.httpClient.put(`/projects/${this.projectId}/roles/${this.name}`, body);
|
|
52
51
|
}
|
|
53
52
|
|
|
@@ -121,7 +120,8 @@ export class Role {
|
|
|
121
120
|
* @async
|
|
122
121
|
*/
|
|
123
122
|
async checkout(): Promise<Role> {
|
|
124
|
-
|
|
123
|
+
const response = await this.internalGet();
|
|
124
|
+
this.data = await response.json();
|
|
125
125
|
return this;
|
|
126
126
|
}
|
|
127
127
|
|
|
@@ -132,7 +132,8 @@ export class Role {
|
|
|
132
132
|
* @param data - Raw role data.
|
|
133
133
|
*/
|
|
134
134
|
async update(data: any): Promise<Role> {
|
|
135
|
-
|
|
135
|
+
const response = await this.internalPut(data);
|
|
136
|
+
this.data = await response.json();
|
|
136
137
|
return this;
|
|
137
138
|
}
|
|
138
139
|
|
|
@@ -143,7 +144,7 @@ export class Role {
|
|
|
143
144
|
* @returns Returns the raw data of a deleted role.
|
|
144
145
|
*/
|
|
145
146
|
delete(): Promise<any> {
|
|
146
|
-
return
|
|
147
|
+
return this.internalDelete().then((response) => response.json());
|
|
147
148
|
}
|
|
148
149
|
|
|
149
150
|
/**
|