@v1nt1248/3nclient-lib 0.3.15 → 0.3.17
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/ui3n-utils.js
CHANGED
|
@@ -4199,30 +4199,29 @@ var Me = class extends Error {
|
|
|
4199
4199
|
}
|
|
4200
4200
|
};
|
|
4201
4201
|
async function J(e) {
|
|
4202
|
-
let { fn: t, fnArgs: n,
|
|
4203
|
-
for (let e = 1; e <=
|
|
4204
|
-
let
|
|
4202
|
+
let { fn: t, fnArgs: n, passSignal: r = !1, defaultValue: i, doesErrorPropagateStop: a = !1, timeoutValue: o = 5e3, retryCount: s = 0, retryDelay: c = 1e3, errorText: l = "An error occurred while executing the function.", actionIfError: u, actionIfSuccess: d, actionInFinally: f } = e, p = n, m = s + 1, h;
|
|
4203
|
+
for (let e = 1; e <= m; e++) {
|
|
4204
|
+
let n = new AbortController(), i = null;
|
|
4205
4205
|
try {
|
|
4206
|
-
let s = new Promise((t,
|
|
4207
|
-
|
|
4208
|
-
|
|
4206
|
+
let a = (async () => r ? t(n.signal, ...p) : t(...p))(), s = new Promise((t, r) => {
|
|
4207
|
+
o > 0 && (i = setTimeout(() => {
|
|
4208
|
+
n.abort(), r(new Me(`Attempt ${e}/${m} timed out.`, {
|
|
4209
4209
|
cause: "timeout",
|
|
4210
|
-
fnArgs:
|
|
4210
|
+
fnArgs: p
|
|
4211
4211
|
}));
|
|
4212
|
-
},
|
|
4213
|
-
}), c =
|
|
4214
|
-
return
|
|
4212
|
+
}, o));
|
|
4213
|
+
}), c = await Promise.race([a, s]);
|
|
4214
|
+
return i && clearTimeout(i), d?.(), f?.(), c;
|
|
4215
4215
|
} catch (t) {
|
|
4216
|
-
|
|
4217
|
-
console.warn(`Attempt ${e} failed. Retrying in ${s}ms...`, t), s > 0 && await b(s);
|
|
4216
|
+
i && clearTimeout(i), h = t, e < m && (console.warn(`[executeFunc] Attempt ${e} failed. Retrying in ${c}ms...`, t), c > 0 && await b(c));
|
|
4218
4217
|
}
|
|
4219
4218
|
}
|
|
4220
|
-
let
|
|
4221
|
-
cause:
|
|
4222
|
-
fnArgs:
|
|
4219
|
+
let g = h instanceof Me && h.cause === "timeout", _ = h?.name === "AbortError" || h?.name === "CanceledError", v = g ? h : new Me(_ ? "Operation aborted" : l, {
|
|
4220
|
+
cause: h,
|
|
4221
|
+
fnArgs: p
|
|
4223
4222
|
});
|
|
4224
|
-
if (console.error(`All ${
|
|
4225
|
-
return
|
|
4223
|
+
if (console.error(`[executeFunc] All ${m} attempts failed.`, v), u?.(v), f?.(), !a) throw v;
|
|
4224
|
+
return i;
|
|
4226
4225
|
}
|
|
4227
4226
|
//#endregion
|
|
4228
4227
|
//#region src/utils/remove-whitespace-in-string.ts
|
|
@@ -4277,7 +4276,7 @@ function ze(n, r = {}) {
|
|
|
4277
4276
|
return n ? n(r).some((n) => n.type === e || Array.isArray(n.children) && !n.children.length ? !1 : n.type !== t || typeof n.children == "string" && n.children.trim() !== "") : !1;
|
|
4278
4277
|
}
|
|
4279
4278
|
//#endregion
|
|
4280
|
-
//#region src/utils/ui/
|
|
4279
|
+
//#region src/utils/ui/generate-color.ts
|
|
4281
4280
|
function Be(e) {
|
|
4282
4281
|
let t = 0;
|
|
4283
4282
|
for (let n = 0; n < e.length; n++) t = e.charCodeAt(n) + ((t << 5) - t);
|
|
@@ -7248,4 +7247,4 @@ function jt(e) {
|
|
|
7248
7247
|
return e.replace(/[A-Z]/g, (e) => `_${e.toLowerCase()}`);
|
|
7249
7248
|
}
|
|
7250
7249
|
//#endregion
|
|
7251
|
-
export { g as DIALOGS_KEY,
|
|
7250
|
+
export { g as DIALOGS_KEY, _ as NOTIFICATIONS_KEY, T as NamedProcs, Et as SQLiteOn3NStorage, w as SingleCyclicProc, x as SingleProc, O as TaskRunner, v as VUEBUS_KEY, lt as b64ToBlob, ut as blobFromDataURL, ct as blobToB64, qe as capitalize, je as copyToClipboard, pt as createVideoThumbnail, y as defer, h as emoticons, J as executeFunc, ft as fileToUint8Array, Ye as formatFileSize, Be as generateColor, ke as getDeliveryErrors, G as getFileExtension, A as getRandomId, ze as hasSlotContent, He as html2text, Ve as invertColor, st as isFileArchive, it as isFileAudio, Qe as isFileImage, tt as isFileVideo, m as mailReg, C as makeSyncedFunc, Re as markSearch, K as mimeTypes, ne as patchTextareaMaxRowsSupport, Ke as prepareDateAsSting, Ne as removeWhitespaceInString, dt as resizeImage, k as round, D as schedulerYield, Fe as selectAll, Le as selectEnd, Ie as selectStart, b as sleep, q as transformFileToWeb3NFile, Ae as transformWeb3nFileToFile, ht as tryOnScopeDispose, X as uint8ToDataURL, mt as unrefElement };
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
type ExtractArgs<F> = F extends (signal: AbortSignal, ...args: infer P) => any ? P : F extends (...args: infer P) => any ? P : never;
|
|
2
|
+
interface BaseProps<F extends (...args: any[]) => any, V> {
|
|
3
3
|
fn: F;
|
|
4
4
|
fnArgs: ExtractArgs<F>;
|
|
5
|
+
passSignal?: boolean;
|
|
5
6
|
timeoutValue?: number;
|
|
6
7
|
retryCount?: number;
|
|
7
8
|
retryDelay?: number;
|
|
@@ -10,20 +11,14 @@ export interface ExecuteFnBaseProps<F extends (...args: any[]) => any, V> {
|
|
|
10
11
|
actionIfSuccess?: () => void;
|
|
11
12
|
actionInFinally?: () => void;
|
|
12
13
|
}
|
|
13
|
-
|
|
14
|
+
interface ExecuteFunctionPropsNoCatchError<F extends (...args: any[]) => any, V = Awaited<ReturnType<F>>> extends BaseProps<F, V> {
|
|
14
15
|
doesErrorPropagateStop: true;
|
|
15
16
|
defaultValue: V;
|
|
16
17
|
}
|
|
17
|
-
|
|
18
|
+
interface ExecuteFunctionPropsCatchError<F extends (...args: any[]) => any, V = Awaited<ReturnType<F>>> extends BaseProps<F, V> {
|
|
18
19
|
doesErrorPropagateStop?: false;
|
|
19
20
|
defaultValue?: undefined;
|
|
20
21
|
}
|
|
21
|
-
|
|
22
|
-
export declare class ExecuteFunctionError extends Error {
|
|
23
|
-
cause: unknown;
|
|
24
|
-
constructor(message: string, data?: {
|
|
25
|
-
cause?: unknown;
|
|
26
|
-
fnArgs?: unknown[];
|
|
27
|
-
});
|
|
28
|
-
}
|
|
22
|
+
type ExecuteFunctionProps<F extends (...args: any[]) => any, V = Awaited<ReturnType<F>>> = ExecuteFunctionPropsCatchError<F, V> | ExecuteFunctionPropsNoCatchError<F, V>;
|
|
29
23
|
export declare function executeFunc<F extends (...args: any[]) => any, V = Awaited<ReturnType<F>>>(props: ExecuteFunctionProps<F, V>): Promise<V>;
|
|
24
|
+
export {};
|
package/dist/utils/index.d.ts
CHANGED
|
@@ -14,7 +14,7 @@ export * from './remove-whitespace-in-string';
|
|
|
14
14
|
export * from './ui/selection';
|
|
15
15
|
export * from './ui/mark-search';
|
|
16
16
|
export * from './ui/has-slot-content';
|
|
17
|
-
export * from './ui/
|
|
17
|
+
export * from './ui/generate-color';
|
|
18
18
|
export * from './ui/invert-color';
|
|
19
19
|
export * from './ui/html2text';
|
|
20
20
|
export * from './ui/prepare-date-as-string';
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "@v1nt1248/3nclient-lib",
|
|
3
3
|
"license": "AGPL-3.0-or-later",
|
|
4
4
|
"author": "v1nt1248",
|
|
5
|
-
"version": "0.3.
|
|
5
|
+
"version": "0.3.17",
|
|
6
6
|
"description": "Library for 3NWeb clients",
|
|
7
7
|
"type": "module",
|
|
8
8
|
"files": [
|
|
@@ -56,25 +56,25 @@
|
|
|
56
56
|
"dayjs": "1.11.20",
|
|
57
57
|
"lodash": "4.18.1",
|
|
58
58
|
"mitt": "3.0.1",
|
|
59
|
-
"sanitize-html": "2.17.
|
|
59
|
+
"sanitize-html": "2.17.4",
|
|
60
60
|
"vuedraggable": "4.1.0"
|
|
61
61
|
},
|
|
62
62
|
"peerDependencies": {
|
|
63
63
|
"pinia": "3.0.4",
|
|
64
|
-
"vue": "3.5.
|
|
64
|
+
"vue": "3.5.34"
|
|
65
65
|
},
|
|
66
66
|
"devDependencies": {
|
|
67
67
|
"@eslint/eslintrc": "3.3.5",
|
|
68
68
|
"@eslint/js": "10.0.1",
|
|
69
69
|
"@types/lodash": "4.17.24",
|
|
70
|
-
"@types/node": "24.12.
|
|
70
|
+
"@types/node": "24.12.4",
|
|
71
71
|
"@types/sanitize-html": "2.16.1",
|
|
72
72
|
"@typescript-eslint/eslint-plugin": "8.59.0",
|
|
73
73
|
"@typescript-eslint/parser": "8.59.0",
|
|
74
74
|
"@vitejs/plugin-vue": "6.0.6",
|
|
75
|
-
"@vue/compiler-core": "3.5.
|
|
75
|
+
"@vue/compiler-core": "3.5.34",
|
|
76
76
|
"@vue/eslint-config-typescript": "14.7.0",
|
|
77
|
-
"@vue/runtime-core": "3.5.
|
|
77
|
+
"@vue/runtime-core": "3.5.34",
|
|
78
78
|
"@vuedx/typescript-plugin-vue": "0.7.6",
|
|
79
79
|
"eslint": "10.2.1",
|
|
80
80
|
"eslint-config-prettier": "10.1.8",
|
|
@@ -102,9 +102,9 @@
|
|
|
102
102
|
"vite": "8.0.10",
|
|
103
103
|
"vite-plugin-css-injected-by-js": "4.0.1",
|
|
104
104
|
"vite-plugin-dts": "4.5.4",
|
|
105
|
-
"vite-plugin-vue-devtools": "8.1.
|
|
105
|
+
"vite-plugin-vue-devtools": "8.1.2",
|
|
106
106
|
"vitepress": "1.6.4",
|
|
107
|
-
"vue": "3.5.
|
|
107
|
+
"vue": "3.5.34",
|
|
108
108
|
"vue-component-meta": "3.2.7",
|
|
109
109
|
"vue-docgen-api": "4.79.2",
|
|
110
110
|
"vue-eslint-parser": "10.4.0",
|
|
File without changes
|