@inweb/client 25.3.19 → 25.3.20
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 +23 -24
- package/dist/client.js.map +1 -1
- package/dist/client.min.js +1 -1
- package/dist/client.module.js +24 -24
- package/dist/client.module.js.map +1 -1
- package/lib/Api/Assembly.d.ts +8 -12
- package/lib/Api/ClashTest.d.ts +3 -3
- package/lib/Api/FetchError.d.ts +1 -1
- package/lib/Api/File.d.ts +7 -7
- package/lib/Api/Job.d.ts +3 -3
- package/lib/Api/Member.d.ts +3 -3
- package/lib/Api/Model.d.ts +1 -4
- package/lib/Api/Permission.d.ts +3 -3
- package/lib/Api/Project.d.ts +4 -4
- package/lib/Api/Role.d.ts +3 -3
- package/lib/Api/User.d.ts +3 -3
- package/lib/Api/Utils.d.ts +1 -1
- package/package.json +2 -2
- package/src/Api/Assembly.ts +14 -15
- package/src/Api/ClashTest.ts +4 -4
- package/src/Api/Client.ts +4 -8
- package/src/Api/Fetch.ts +1 -1
- package/src/Api/FetchError.ts +1 -1
- package/src/Api/File.ts +12 -12
- package/src/Api/HttpClient.ts +4 -4
- package/src/Api/Job.ts +6 -6
- package/src/Api/Member.ts +6 -6
- package/src/Api/Model.ts +1 -1
- package/src/Api/Permission.ts +6 -6
- package/src/Api/Project.ts +8 -8
- package/src/Api/Role.ts +6 -6
- package/src/Api/User.ts +4 -4
- package/src/Api/Utils.ts +6 -6
- package/src/Api/XMLHttp.ts +1 -1
package/src/Api/Job.ts
CHANGED
|
@@ -41,15 +41,15 @@ export class Job {
|
|
|
41
41
|
this.data = data;
|
|
42
42
|
}
|
|
43
43
|
|
|
44
|
-
protected internalGet() {
|
|
44
|
+
protected internalGet(): Promise<Response> {
|
|
45
45
|
return this.httpClient.get(`/jobs/${this.data.id}`);
|
|
46
46
|
}
|
|
47
47
|
|
|
48
|
-
protected internalPut(body?: BodyInit | object) {
|
|
48
|
+
protected internalPut(body?: BodyInit | object): Promise<Response> {
|
|
49
49
|
return this.httpClient.put(`/jobs/${this.data.id}`, body);
|
|
50
50
|
}
|
|
51
51
|
|
|
52
|
-
protected internalDelete() {
|
|
52
|
+
protected internalDelete(): Promise<Response> {
|
|
53
53
|
return this.httpClient.delete(`/jobs/${this.data.id}`);
|
|
54
54
|
}
|
|
55
55
|
|
|
@@ -183,7 +183,7 @@ export class Job {
|
|
|
183
183
|
*
|
|
184
184
|
* @async
|
|
185
185
|
*/
|
|
186
|
-
async checkout(): Promise<
|
|
186
|
+
async checkout(): Promise<this> {
|
|
187
187
|
const response = await this.internalGet();
|
|
188
188
|
this.data = await response.json();
|
|
189
189
|
return this;
|
|
@@ -195,7 +195,7 @@ export class Job {
|
|
|
195
195
|
* @async
|
|
196
196
|
* @param data - Raw job data.
|
|
197
197
|
*/
|
|
198
|
-
async update(data: any): Promise<
|
|
198
|
+
async update(data: any): Promise<this> {
|
|
199
199
|
const response = await this.internalPut(data);
|
|
200
200
|
this.data = await response.json();
|
|
201
201
|
return this;
|
|
@@ -242,7 +242,7 @@ export class Job {
|
|
|
242
242
|
interval?: number;
|
|
243
243
|
signal?: AbortSignal;
|
|
244
244
|
onCheckout?: (job: Job, ready: boolean) => boolean;
|
|
245
|
-
}): Promise<
|
|
245
|
+
}): Promise<this> {
|
|
246
246
|
const checkDone = () =>
|
|
247
247
|
this.checkout().then((job) => {
|
|
248
248
|
const ready = ["done", "failed"].includes(job.status);
|
package/src/Api/Member.ts
CHANGED
|
@@ -44,15 +44,15 @@ export class Member {
|
|
|
44
44
|
this.data = data;
|
|
45
45
|
}
|
|
46
46
|
|
|
47
|
-
private internalGet() {
|
|
47
|
+
private internalGet(): Promise<Response> {
|
|
48
48
|
return this.httpClient.get(`/projects/${this.projectId}/members/${this.id}`);
|
|
49
49
|
}
|
|
50
50
|
|
|
51
|
-
private internalPut(body?: BodyInit | object) {
|
|
51
|
+
private internalPut(body?: BodyInit | object): Promise<Response> {
|
|
52
52
|
return this.httpClient.put(`/projects/${this.projectId}/members/${this.id}`, body);
|
|
53
53
|
}
|
|
54
54
|
|
|
55
|
-
private internalDelete() {
|
|
55
|
+
private internalDelete(): Promise<Response> {
|
|
56
56
|
return this.httpClient.delete(`/projects/${this.projectId}/members/${this.id}`);
|
|
57
57
|
}
|
|
58
58
|
|
|
@@ -123,7 +123,7 @@ export class Member {
|
|
|
123
123
|
*
|
|
124
124
|
* @async
|
|
125
125
|
*/
|
|
126
|
-
async checkout(): Promise<
|
|
126
|
+
async checkout(): Promise<this> {
|
|
127
127
|
const response = await this.internalGet();
|
|
128
128
|
this.data = await response.json();
|
|
129
129
|
return this;
|
|
@@ -135,7 +135,7 @@ export class Member {
|
|
|
135
135
|
* @async
|
|
136
136
|
* @param data - Raw member data.
|
|
137
137
|
*/
|
|
138
|
-
async update(data: any): Promise<
|
|
138
|
+
async update(data: any): Promise<this> {
|
|
139
139
|
const response = await this.internalPut(data);
|
|
140
140
|
this.data = await response.json();
|
|
141
141
|
return this;
|
|
@@ -157,7 +157,7 @@ export class Member {
|
|
|
157
157
|
*
|
|
158
158
|
* @async
|
|
159
159
|
*/
|
|
160
|
-
save(): Promise<
|
|
160
|
+
save(): Promise<this> {
|
|
161
161
|
return this.update(this.data);
|
|
162
162
|
}
|
|
163
163
|
}
|
package/src/Api/Model.ts
CHANGED
|
@@ -339,7 +339,7 @@ export class Model {
|
|
|
339
339
|
* href="https://developer.mozilla.org/docs/Web/API/AbortController">AbortController</a>
|
|
340
340
|
* signal object instance, which can be used to abort waiting as desired.
|
|
341
341
|
*/
|
|
342
|
-
getReferences(signal?: AbortSignal) {
|
|
342
|
+
getReferences(signal?: AbortSignal): Promise<any> {
|
|
343
343
|
return this._file.getReferences(signal);
|
|
344
344
|
}
|
|
345
345
|
}
|
package/src/Api/Permission.ts
CHANGED
|
@@ -43,15 +43,15 @@ export class Permission {
|
|
|
43
43
|
this.data = data;
|
|
44
44
|
}
|
|
45
45
|
|
|
46
|
-
private internalGet() {
|
|
46
|
+
private internalGet(): Promise<Response> {
|
|
47
47
|
return this.httpClient.get(`/files/${this.fileId}/permissions/${this.id}`);
|
|
48
48
|
}
|
|
49
49
|
|
|
50
|
-
private internalPut(body?: BodyInit | object) {
|
|
50
|
+
private internalPut(body?: BodyInit | object): Promise<Response> {
|
|
51
51
|
return this.httpClient.put(`/files/${this.fileId}/permissions/${this.id}`, body);
|
|
52
52
|
}
|
|
53
53
|
|
|
54
|
-
private internalDelete() {
|
|
54
|
+
private internalDelete(): Promise<Response> {
|
|
55
55
|
return this.httpClient.delete(`/files/${this.fileId}/permissions/${this.id}`);
|
|
56
56
|
}
|
|
57
57
|
|
|
@@ -134,7 +134,7 @@ export class Permission {
|
|
|
134
134
|
*
|
|
135
135
|
* @async
|
|
136
136
|
*/
|
|
137
|
-
async checkout(): Promise<
|
|
137
|
+
async checkout(): Promise<this> {
|
|
138
138
|
const response = await this.internalGet();
|
|
139
139
|
this.data = await response.json();
|
|
140
140
|
return this;
|
|
@@ -146,7 +146,7 @@ export class Permission {
|
|
|
146
146
|
* @async
|
|
147
147
|
* @param data - Raw permission data.
|
|
148
148
|
*/
|
|
149
|
-
async update(data: any): Promise<
|
|
149
|
+
async update(data: any): Promise<this> {
|
|
150
150
|
const response = await this.internalPut(data);
|
|
151
151
|
this.data = await response.json();
|
|
152
152
|
return this;
|
|
@@ -168,7 +168,7 @@ export class Permission {
|
|
|
168
168
|
*
|
|
169
169
|
* @async
|
|
170
170
|
*/
|
|
171
|
-
save(): Promise<
|
|
171
|
+
save(): Promise<this> {
|
|
172
172
|
return this.update(this.data);
|
|
173
173
|
}
|
|
174
174
|
}
|
package/src/Api/Project.ts
CHANGED
|
@@ -43,19 +43,19 @@ export class Project {
|
|
|
43
43
|
this.data = data;
|
|
44
44
|
}
|
|
45
45
|
|
|
46
|
-
protected internalGet(relativePath: string) {
|
|
46
|
+
protected internalGet(relativePath: string): Promise<Response> {
|
|
47
47
|
return this.httpClient.get(`/projects/${this.id}${relativePath}`);
|
|
48
48
|
}
|
|
49
49
|
|
|
50
|
-
protected internalPost(relativePath: string, body?: BodyInit | object) {
|
|
50
|
+
protected internalPost(relativePath: string, body?: BodyInit | object): Promise<Response> {
|
|
51
51
|
return this.httpClient.post(`/projects/${this.id}${relativePath}`, body);
|
|
52
52
|
}
|
|
53
53
|
|
|
54
|
-
protected internalPut(relativePath: string, body?: BodyInit | object) {
|
|
54
|
+
protected internalPut(relativePath: string, body?: BodyInit | object): Promise<Response> {
|
|
55
55
|
return this.httpClient.put(`/projects/${this.id}${relativePath}`, body);
|
|
56
56
|
}
|
|
57
57
|
|
|
58
|
-
protected internalDelete(relativePath: string) {
|
|
58
|
+
protected internalDelete(relativePath: string): Promise<Response> {
|
|
59
59
|
return this.httpClient.delete(`/projects/${this.id}${relativePath}`);
|
|
60
60
|
}
|
|
61
61
|
|
|
@@ -242,7 +242,7 @@ export class Project {
|
|
|
242
242
|
*
|
|
243
243
|
* @async
|
|
244
244
|
*/
|
|
245
|
-
async checkout(): Promise<
|
|
245
|
+
async checkout(): Promise<this> {
|
|
246
246
|
const response = await this.internalGet("");
|
|
247
247
|
this.data = await response.json();
|
|
248
248
|
return this;
|
|
@@ -254,7 +254,7 @@ export class Project {
|
|
|
254
254
|
* @async
|
|
255
255
|
* @param data - Raw project data.
|
|
256
256
|
*/
|
|
257
|
-
async update(data: any): Promise<
|
|
257
|
+
async update(data: any): Promise<this> {
|
|
258
258
|
const response = await this.internalPut("", data);
|
|
259
259
|
this.data = await response.json();
|
|
260
260
|
return this;
|
|
@@ -285,7 +285,7 @@ export class Project {
|
|
|
285
285
|
*
|
|
286
286
|
* @async
|
|
287
287
|
*/
|
|
288
|
-
save(): Promise<
|
|
288
|
+
save(): Promise<this> {
|
|
289
289
|
return this.update(this.data);
|
|
290
290
|
}
|
|
291
291
|
|
|
@@ -303,7 +303,7 @@ export class Project {
|
|
|
303
303
|
* target="_blank">File</a> object. Setting the `image` to `null` will remove the preview.
|
|
304
304
|
*/
|
|
305
305
|
|
|
306
|
-
async setPreview(image: BodyInit | null) {
|
|
306
|
+
async setPreview(image: BodyInit | null): Promise<any> {
|
|
307
307
|
const response = await (image ? this.internalPost("/preview", image) : this.internalDelete("/preview"));
|
|
308
308
|
this.data = await response.json();
|
|
309
309
|
return this;
|
package/src/Api/Role.ts
CHANGED
|
@@ -42,15 +42,15 @@ export class Role {
|
|
|
42
42
|
this.data = data;
|
|
43
43
|
}
|
|
44
44
|
|
|
45
|
-
private internalGet() {
|
|
45
|
+
private internalGet(): Promise<Response> {
|
|
46
46
|
return this.httpClient.get(`/projects/${this.projectId}/roles/${this.name}`);
|
|
47
47
|
}
|
|
48
48
|
|
|
49
|
-
private internalPut(body?: BodyInit | object) {
|
|
49
|
+
private internalPut(body?: BodyInit | object): Promise<Response> {
|
|
50
50
|
return this.httpClient.put(`/projects/${this.projectId}/roles/${this.name}`, body);
|
|
51
51
|
}
|
|
52
52
|
|
|
53
|
-
private internalDelete() {
|
|
53
|
+
private internalDelete(): Promise<Response> {
|
|
54
54
|
return this.httpClient.delete(`/projects/${this.projectId}/roles/${this.name}`);
|
|
55
55
|
}
|
|
56
56
|
|
|
@@ -119,7 +119,7 @@ export class Role {
|
|
|
119
119
|
*
|
|
120
120
|
* @async
|
|
121
121
|
*/
|
|
122
|
-
async checkout(): Promise<
|
|
122
|
+
async checkout(): Promise<this> {
|
|
123
123
|
const response = await this.internalGet();
|
|
124
124
|
this.data = await response.json();
|
|
125
125
|
return this;
|
|
@@ -131,7 +131,7 @@ export class Role {
|
|
|
131
131
|
* @async
|
|
132
132
|
* @param data - Raw role data.
|
|
133
133
|
*/
|
|
134
|
-
async update(data: any): Promise<
|
|
134
|
+
async update(data: any): Promise<this> {
|
|
135
135
|
const response = await this.internalPut(data);
|
|
136
136
|
this.data = await response.json();
|
|
137
137
|
return this;
|
|
@@ -153,7 +153,7 @@ export class Role {
|
|
|
153
153
|
*
|
|
154
154
|
* @async
|
|
155
155
|
*/
|
|
156
|
-
save(): Promise<
|
|
156
|
+
save(): Promise<this> {
|
|
157
157
|
return this.update(this.data);
|
|
158
158
|
}
|
|
159
159
|
}
|
package/src/Api/User.ts
CHANGED
|
@@ -257,7 +257,7 @@ export class User {
|
|
|
257
257
|
* does not have administrator rights, hi can only checkout himself, otherwise an exception
|
|
258
258
|
* will be thrown.
|
|
259
259
|
*/
|
|
260
|
-
async checkout(): Promise<
|
|
260
|
+
async checkout(): Promise<this> {
|
|
261
261
|
if (this.id === this.httpClient.signInUserId) {
|
|
262
262
|
const response = await this.httpClient.get("/user");
|
|
263
263
|
const data = await response.json();
|
|
@@ -278,7 +278,7 @@ export class User {
|
|
|
278
278
|
* @async
|
|
279
279
|
* @param data - Raw user data.
|
|
280
280
|
*/
|
|
281
|
-
async update(data: any) {
|
|
281
|
+
async update(data: any): Promise<this> {
|
|
282
282
|
if (this.id === this.httpClient.signInUserId) {
|
|
283
283
|
const response = await this.httpClient.put("/user", data);
|
|
284
284
|
const newData = await response.json();
|
|
@@ -322,7 +322,7 @@ export class User {
|
|
|
322
322
|
*
|
|
323
323
|
* @async
|
|
324
324
|
*/
|
|
325
|
-
save(): Promise<
|
|
325
|
+
save(): Promise<this> {
|
|
326
326
|
return this.update(this.data);
|
|
327
327
|
}
|
|
328
328
|
|
|
@@ -341,7 +341,7 @@ export class User {
|
|
|
341
341
|
* Web API <a href="https://developer.mozilla.org/docs/Web/API/File"
|
|
342
342
|
* target="_blank">File</a> object. Setting the `image` to `null` will remove the avatar.
|
|
343
343
|
*/
|
|
344
|
-
async setAvatar(image: BodyInit | null): Promise<
|
|
344
|
+
async setAvatar(image: BodyInit | null): Promise<this> {
|
|
345
345
|
if (image) {
|
|
346
346
|
if (this.id === this.httpClient.signInUserId) {
|
|
347
347
|
const response = await this.httpClient.post("/user/avatar", image);
|
package/src/Api/Utils.ts
CHANGED
|
@@ -21,7 +21,7 @@
|
|
|
21
21
|
// acknowledge and accept the above terms.
|
|
22
22
|
///////////////////////////////////////////////////////////////////////////////
|
|
23
23
|
|
|
24
|
-
function delay(ms: number, signal: AbortSignal) {
|
|
24
|
+
function delay(ms: number, signal: AbortSignal): Promise<boolean> {
|
|
25
25
|
return new Promise((resolve) => {
|
|
26
26
|
let timeoutId = 0;
|
|
27
27
|
|
|
@@ -49,9 +49,9 @@ export async function waitFor(
|
|
|
49
49
|
timeoutError?: DOMException;
|
|
50
50
|
result?: any;
|
|
51
51
|
} = {}
|
|
52
|
-
) {
|
|
53
|
-
const timeout = params.timeout
|
|
54
|
-
const interval = params.interval
|
|
52
|
+
): Promise<any> {
|
|
53
|
+
const timeout = params.timeout || 600000;
|
|
54
|
+
const interval = params.interval || 3000;
|
|
55
55
|
const signal = params.signal ?? new AbortController().signal;
|
|
56
56
|
const abortError = params.abortError ?? new DOMException("Aborted", "AbortError");
|
|
57
57
|
const timeoutError = params.timeoutError ?? new DOMException("Timeout", "TimeoutError");
|
|
@@ -67,7 +67,7 @@ export async function waitFor(
|
|
|
67
67
|
return Promise.reject(timeoutError);
|
|
68
68
|
}
|
|
69
69
|
|
|
70
|
-
export function parseArgs(args
|
|
70
|
+
export function parseArgs(args?: string | object): object {
|
|
71
71
|
if (typeof args === "string") {
|
|
72
72
|
const firstArg = args.indexOf("--");
|
|
73
73
|
if (firstArg !== -1) args = args.slice(firstArg);
|
|
@@ -83,7 +83,7 @@ export function parseArgs(args: string | object): object {
|
|
|
83
83
|
.map((x) => x.concat([""]));
|
|
84
84
|
return Object.fromEntries(argArray);
|
|
85
85
|
}
|
|
86
|
-
return args
|
|
86
|
+
return args || {};
|
|
87
87
|
}
|
|
88
88
|
|
|
89
89
|
export function userFullName(firstName: string | any, lastName = "", userName = ""): string {
|
package/src/Api/XMLHttp.ts
CHANGED
|
@@ -61,7 +61,7 @@ export function $xmlhttp(
|
|
|
61
61
|
for (const key in params.headers) {
|
|
62
62
|
xhr.setRequestHeader(key, params.headers[key]);
|
|
63
63
|
}
|
|
64
|
-
function calcProgress(event: ProgressEvent) {
|
|
64
|
+
function calcProgress(event: ProgressEvent): number {
|
|
65
65
|
return event.lengthComputable ? event.loaded / event.total : 1;
|
|
66
66
|
}
|
|
67
67
|
xhr.upload.onprogress = (event) => params.uploadProgress && params.uploadProgress(calcProgress(event));
|