@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/dist/client.js
CHANGED
|
@@ -326,12 +326,12 @@
|
|
|
326
326
|
});
|
|
327
327
|
}
|
|
328
328
|
async function waitFor(func, params = {}) {
|
|
329
|
-
var _a, _b, _c
|
|
330
|
-
const timeout =
|
|
331
|
-
const interval =
|
|
332
|
-
const signal = (
|
|
333
|
-
const abortError = (
|
|
334
|
-
const timeoutError = (
|
|
329
|
+
var _a, _b, _c;
|
|
330
|
+
const timeout = params.timeout || 600000;
|
|
331
|
+
const interval = params.interval || 3000;
|
|
332
|
+
const signal = (_a = params.signal) !== null && _a !== void 0 ? _a : new AbortController().signal;
|
|
333
|
+
const abortError = (_b = params.abortError) !== null && _b !== void 0 ? _b : new DOMException("Aborted", "AbortError");
|
|
334
|
+
const timeoutError = (_c = params.timeoutError) !== null && _c !== void 0 ? _c : new DOMException("Timeout", "TimeoutError");
|
|
335
335
|
const end = performance.now() + timeout;
|
|
336
336
|
let count = timeout / interval;
|
|
337
337
|
do {
|
|
@@ -357,7 +357,7 @@
|
|
|
357
357
|
.map((x) => x.concat([""]));
|
|
358
358
|
return Object.fromEntries(argArray);
|
|
359
359
|
}
|
|
360
|
-
return args
|
|
360
|
+
return args || {};
|
|
361
361
|
}
|
|
362
362
|
function userFullName(firstName, lastName = "", userName = "") {
|
|
363
363
|
var _a;
|
|
@@ -856,8 +856,7 @@
|
|
|
856
856
|
}
|
|
857
857
|
// Reserved for future use
|
|
858
858
|
get previewUrl() {
|
|
859
|
-
|
|
860
|
-
return (_a = this.data.previewUrl) !== null && _a !== void 0 ? _a : "";
|
|
859
|
+
return this.data.previewUrl || "";
|
|
861
860
|
}
|
|
862
861
|
/**
|
|
863
862
|
* List of assembly related job IDs.
|
|
@@ -1117,7 +1116,6 @@
|
|
|
1117
1116
|
* href="https://developer.mozilla.org/docs/Web/API/AbortController">AbortController</a>
|
|
1118
1117
|
* signal object instance, which can be used to abort waiting as desired.
|
|
1119
1118
|
* @param params.onCheckout - Waiting progress callback. Return `true` to cancel waiting.
|
|
1120
|
-
* @returns {Promise<Assembly>}
|
|
1121
1119
|
*/
|
|
1122
1120
|
waitForDone(params) {
|
|
1123
1121
|
const checkDone = () => this.checkout().then((assembly) => {
|
|
@@ -1265,27 +1263,24 @@
|
|
|
1265
1263
|
|
|
1266
1264
|
class EventEmitter2 {
|
|
1267
1265
|
constructor() {
|
|
1268
|
-
this._listeners =
|
|
1266
|
+
this._listeners = {};
|
|
1269
1267
|
}
|
|
1270
1268
|
addEventListener(type, listener) {
|
|
1271
|
-
if (this._listeners === undefined) this._listeners = {};
|
|
1272
1269
|
if (this._listeners[type] === undefined) this._listeners[type] = [];
|
|
1273
1270
|
this._listeners[type].push(listener);
|
|
1274
1271
|
return this;
|
|
1275
1272
|
}
|
|
1276
1273
|
removeEventListener(type, listener) {
|
|
1277
|
-
if (this._listeners === undefined) return this;
|
|
1278
1274
|
if (this._listeners[type] === undefined) return this;
|
|
1279
1275
|
const listeners = this._listeners[type].filter((x => x !== listener));
|
|
1280
|
-
this._listeners[type] = listeners
|
|
1276
|
+
if (listeners.length !== 0) this._listeners[type] = listeners; else delete this._listeners[type];
|
|
1281
1277
|
return this;
|
|
1282
1278
|
}
|
|
1283
1279
|
removeAllListeners(type) {
|
|
1284
|
-
if (type) this._listeners[type]
|
|
1280
|
+
if (type) delete this._listeners[type]; else this._listeners = {};
|
|
1285
1281
|
return this;
|
|
1286
1282
|
}
|
|
1287
1283
|
emitEvent(event) {
|
|
1288
|
-
if (this._listeners === undefined) return false;
|
|
1289
1284
|
if (this._listeners[event.type] === undefined) return false;
|
|
1290
1285
|
const invoke = this._listeners[event.type].slice();
|
|
1291
1286
|
invoke.forEach((listener => listener.call(this, event)));
|
|
@@ -1330,7 +1325,7 @@
|
|
|
1330
1325
|
function $fetch(url, params = { method: "GET" }) {
|
|
1331
1326
|
const headers = { ...params.headers };
|
|
1332
1327
|
delete headers["Content-Type"];
|
|
1333
|
-
let body;
|
|
1328
|
+
let body = undefined;
|
|
1334
1329
|
if (params.method === "POST" || params.method === "PUT") {
|
|
1335
1330
|
if (params.body instanceof FormData) {
|
|
1336
1331
|
body = params.body;
|
|
@@ -1402,6 +1397,8 @@
|
|
|
1402
1397
|
///////////////////////////////////////////////////////////////////////////////
|
|
1403
1398
|
class HttpClient {
|
|
1404
1399
|
constructor(serverUrl) {
|
|
1400
|
+
this.headers = {};
|
|
1401
|
+
this.signInUserId = "";
|
|
1405
1402
|
this.serverUrl = serverUrl;
|
|
1406
1403
|
}
|
|
1407
1404
|
get(relativePath, signal) {
|
|
@@ -1450,7 +1447,7 @@
|
|
|
1450
1447
|
async downloadFile(relativePath, onProgress, signal) {
|
|
1451
1448
|
const response = await this.get(relativePath, signal);
|
|
1452
1449
|
const contentLength = response.headers.get("Content-Length");
|
|
1453
|
-
const total = parseInt(contentLength, 10) || 1;
|
|
1450
|
+
const total = parseInt(contentLength || "", 10) || 1;
|
|
1454
1451
|
return new Response(new ReadableStream({
|
|
1455
1452
|
async start(controller) {
|
|
1456
1453
|
const reader = response.body.getReader();
|
|
@@ -1473,7 +1470,7 @@
|
|
|
1473
1470
|
headers["Range"] = "bytes=" + ranges.map((x) => `${x.begin}-${x.end}`).join(",");
|
|
1474
1471
|
const response = await $fetch(`${this.serverUrl}${relativePath}`, { method: "GET", headers, signal });
|
|
1475
1472
|
const contentLength = response.headers.get("content-length");
|
|
1476
|
-
const total = parseInt(contentLength, 10) || 1;
|
|
1473
|
+
const total = parseInt(contentLength || "", 10) || 1;
|
|
1477
1474
|
return new Response(new ReadableStream({
|
|
1478
1475
|
async start(controller) {
|
|
1479
1476
|
const reader = response.body.getReader();
|
|
@@ -2508,7 +2505,7 @@
|
|
|
2508
2505
|
waitAll = true;
|
|
2509
2506
|
const checkDone = () => this.checkout().then((file) => {
|
|
2510
2507
|
var _a;
|
|
2511
|
-
const readyJobs = jobs.filter((x) => { var _a
|
|
2508
|
+
const readyJobs = jobs.filter((x) => { var _a; return ["none", "done", "failed"].includes(((_a = file.status[x]) === null || _a === void 0 ? void 0 : _a.state) || "none"); });
|
|
2512
2509
|
const ready = waitAll ? readyJobs.length === jobs.length : readyJobs.length > 0;
|
|
2513
2510
|
const cancel = (_a = params === null || params === void 0 ? void 0 : params.onCheckout) === null || _a === void 0 ? void 0 : _a.call(params, file, ready);
|
|
2514
2511
|
return cancel || ready;
|
|
@@ -3633,9 +3630,11 @@
|
|
|
3633
3630
|
*/
|
|
3634
3631
|
constructor(params = {}) {
|
|
3635
3632
|
super();
|
|
3636
|
-
this.
|
|
3637
|
-
this.
|
|
3633
|
+
this._serverUrl = "";
|
|
3634
|
+
this._httpClient = new HttpClient("");
|
|
3638
3635
|
this._user = null;
|
|
3636
|
+
this.eventEmitter = this;
|
|
3637
|
+
this.configure(params);
|
|
3639
3638
|
}
|
|
3640
3639
|
/**
|
|
3641
3640
|
* Open Cloud Server URL. Use {@link Client.configure()} to change server URL.
|
|
@@ -3717,7 +3716,7 @@
|
|
|
3717
3716
|
.then((data) => ({
|
|
3718
3717
|
...data,
|
|
3719
3718
|
server: data.version,
|
|
3720
|
-
client: "25.3.
|
|
3719
|
+
client: "25.3.20",
|
|
3721
3720
|
}));
|
|
3722
3721
|
}
|
|
3723
3722
|
/**
|
|
@@ -4394,7 +4393,7 @@
|
|
|
4394
4393
|
}
|
|
4395
4394
|
|
|
4396
4395
|
///////////////////////////////////////////////////////////////////////////////
|
|
4397
|
-
const version = "25.3.
|
|
4396
|
+
const version = "25.3.20";
|
|
4398
4397
|
|
|
4399
4398
|
exports.Assembly = Assembly;
|
|
4400
4399
|
exports.ClashTest = ClashTest;
|