@flemist/simple-utils 2.0.2 → 2.1.1
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/build/browser/index.cjs +1 -1
- package/build/browser/index.mjs +115 -53
- package/build/common/async/index.d.ts +1 -0
- package/build/common/async/retry/index.d.ts +2 -0
- package/build/common/async/retry/types.d.ts +15 -0
- package/build/common/async/retry/withRetry.d.ts +28 -0
- package/build/common/debug/LogLevel.d.ts +6 -0
- package/build/common/debug/console/consoleIntercept.d.ts +18 -0
- package/build/common/debug/console/consoleReplace.d.ts +2 -1
- package/build/common/debug/console/index.d.ts +1 -0
- package/build/common/debug/index.d.ts +1 -0
- package/build/common/index.cjs +1 -1
- package/build/common/index.d.ts +2 -0
- package/build/common/index.mjs +115 -53
- package/build/common/rx/Derived.d.ts +11 -0
- package/build/common/rx/Subject.d.ts +35 -0
- package/build/common/rx/SubjectWithId.d.ts +15 -0
- package/build/common/rx/helpers.d.ts +2 -0
- package/build/common/rx/index.d.ts +5 -0
- package/build/common/rx/types.d.ts +35 -0
- package/build/common/rx/waitObservable.d.ts +3 -0
- package/build/node/index.cjs +9 -2
- package/build/node/index.d.ts +2 -0
- package/build/node/index.mjs +1044 -238
- package/build/node/process/exec.d.ts +2 -0
- package/build/node/process/index.d.ts +2 -0
- package/build/node/process/nodeBeep.d.ts +1 -0
- package/build/urlGet-BCW9jvAm.mjs +1947 -0
- package/build/urlGet-BOGFUahf.js +17 -0
- package/package.json +2 -2
- package/build/urlGet-gscwyYHD.mjs +0 -780
- package/build/urlGet-jyEOC24k.js +0 -11
package/build/browser/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("../urlGet-BOGFUahf.js");exports.ConsoleMessageLevel=t.ConsoleMessageLevel;exports.Lazy=t.Lazy;exports.LazyWithId=t.LazyWithId;exports.LogLevel=t.LogLevel;exports.Random=t.Random;exports.Subject=t.Subject;exports.SubjectWithId=t.SubjectWithId;exports.UNIQUE_PSEUDO_RANDOM_MAX_COUNT=t.UNIQUE_PSEUDO_RANDOM_MAX_COUNT;exports.alertConsole=t.alertConsole;exports.alertReplace=t.alertReplace;exports.check=t.check;exports.consoleIntercept=t.consoleIntercept;exports.consoleMessageToString=t.consoleMessageToString;exports.consoleReplace=t.consoleReplace;exports.convertTimeZone=t.convertTimeZone;exports.createTaskDelayRetry=t.createTaskDelayRetry;exports.createUniquePseudoRandom=t.createUniquePseudoRandom;exports.dateNowUnique=t.dateNowUnique;exports.deepCloneJsonLike=t.deepCloneJsonLike;exports.deepEqualJsonLike=t.deepEqualJsonLike;exports.deepEqualJsonLikeMap=t.deepEqualJsonLikeMap;exports.equalArray=t.equalArray;exports.escapeHtml=t.escapeHtml;exports.escapeRegExp=t.escapeRegExp;exports.fixStackTrace=t.fixStackTrace;exports.formatAny=t.formatAny;exports.formatDate=t.formatDate;exports.formatDateFileName=t.formatDateFileName;exports.getConsoleMessages=t.getConsoleMessages;exports.getDateInet=t.getDateInet;exports.getNormalizedObject=t.getNormalizedObject;exports.getRandomFunc=t.getRandomFunc;exports.getRandomSeed=t.getRandomSeed;exports.getStackTrace=t.getStackTrace;exports.isObservable=t.isObservable;exports.match=t.match;exports.matchAnd=t.matchAnd;exports.matchAndPipe=t.matchAndPipe;exports.matchAny=t.matchAny;exports.matchArray=t.matchArray;exports.matchArrayBuffer=t.matchArrayBuffer;exports.matchArrayIncludes=t.matchArrayIncludes;exports.matchArrayItem=t.matchArrayItem;exports.matchArrayLength=t.matchArrayLength;exports.matchArrayWith=t.matchArrayWith;exports.matchBoolean=t.matchBoolean;exports.matchConstructor=t.matchConstructor;exports.matchConvert=t.matchConvert;exports.matchCustom=t.matchCustom;exports.matchDeep=t.matchDeep;exports.matchEnum=t.matchEnum;exports.matchFloat=t.matchFloat;exports.matchIn=t.matchIn;exports.matchInstanceOf=t.matchInstanceOf;exports.matchInt=t.matchInt;exports.matchIntDate=t.matchIntDate;exports.matchIs=t.matchIs;exports.matchIsNonStrict=t.matchIsNonStrict;exports.matchNever=t.matchNever;exports.matchNot=t.matchNot;exports.matchNotNullish=t.matchNotNullish;exports.matchNullish=t.matchNullish;exports.matchNumber=t.matchNumber;exports.matchObject=t.matchObject;exports.matchObjectEntries=t.matchObjectEntries;exports.matchObjectEntry=t.matchObjectEntry;exports.matchObjectKey=t.matchObjectKey;exports.matchObjectKeyValue=t.matchObjectKeyValue;exports.matchObjectKeys=t.matchObjectKeys;exports.matchObjectKeysNotNull=t.matchObjectKeysNotNull;exports.matchObjectPartial=t.matchObjectPartial;exports.matchObjectValue=t.matchObjectValue;exports.matchObjectValues=t.matchObjectValues;exports.matchObjectWith=t.matchObjectWith;exports.matchOptional=t.matchOptional;exports.matchOr=t.matchOr;exports.matchOrPipe=t.matchOrPipe;exports.matchRange=t.matchRange;exports.matchRangeDate=t.matchRangeDate;exports.matchRef=t.matchRef;exports.matchString=t.matchString;exports.matchStringLength=t.matchStringLength;exports.matchTypeOf=t.matchTypeOf;exports.matchUuid=t.matchUuid;exports.matchValueState=t.matchValueState;exports.max=t.max;exports.min=t.min;exports.minMax=t.minMax;exports.numberMod=t.numberMod;exports.randomBoolean=t.randomBoolean;exports.randomEnum=t.randomEnum;exports.randomFloat=t.randomFloat;exports.randomIndexWeighted=t.randomIndexWeighted;exports.randomInt=t.randomInt;exports.randomItem=t.randomItem;exports.randomItems=t.randomItems;exports.setFuncName=t.setFuncName;exports.sha256=t.sha256;exports.sha256Buffer=t.sha256Buffer;exports.timeoutAbortController=t.timeoutAbortController;exports.toHex=t.toHex;exports.truncateString=t.truncateString;exports.urlGetBoolean=t.urlGetBoolean;exports.urlGetFloat=t.urlGetFloat;exports.urlGetInt=t.urlGetInt;exports.urlGetParams=t.urlGetParams;exports.urlGetString=t.urlGetString;exports.urlParamToBoolean=t.urlParamToBoolean;exports.urlParamToFloat=t.urlParamToFloat;exports.urlParamToInt=t.urlParamToInt;exports.waitObservable=t.waitObservable;exports.withConsoleReplace=t.withConsoleReplace;exports.withRetry=t.withRetry;exports.withTimeout=t.withTimeout;
|
package/build/browser/index.mjs
CHANGED
|
@@ -1,55 +1,117 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { L as t, V as e, W as c, O as m, R as r, _ as o, $ as n, U as h, K as l, G as u, a2 as i, J as d, H as O, M as b, q as g, Y as y, l as I, o as p, A as N, B as j, C as A, D as R, y as S, z as f, P as T, u as C, v as L, w as D, I as E, p as P, E as M, d as k, g as v, Q as x, Z as F, a1 as U, aq as B, as as q, a5 as w, a3 as G, aP as W, a4 as K, a8 as V, au as z, ax as J, am as _, al as H, a9 as Q, aI as X, ag as Z, aH as Y, ae as $, aG as aa, aj as sa, ad as ta, aJ as ea, ab as ca, aa as ma, a7 as ra, aM as oa, ao as na, an as ha, ac as la, af as ua, aA as ia, aB as da, aC as Oa, aE as ba, ay as ga, aF as ya, ah as Ia, aD as pa, az as Na, aw as ja, at as Aa, ap as Ra, ar as Sa, aK as fa, aL as Ta, a6 as Ca, ai as La, av as Da, ak as Ea, aN as Pa, aO as Ma, b as ka, m as va, c as xa, n as Fa, f as Ua, k as Ba, r as qa, h as wa, e as Ga, i as Wa, j as Ka, F as Va, a as za, s as Ja, S as _a, t as Ha, x as Qa, aV as Xa, aX as Za, aW as Ya, aQ as $a, aU as as, aR as ss, aT as ts, aS as es, a0 as cs, N as ms, X as rs, T as os } from "../urlGet-BCW9jvAm.mjs";
|
|
2
2
|
export {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
r as
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
N as
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
Y as
|
|
54
|
-
$ as
|
|
3
|
+
t as ConsoleMessageLevel,
|
|
4
|
+
e as Lazy,
|
|
5
|
+
c as LazyWithId,
|
|
6
|
+
m as LogLevel,
|
|
7
|
+
r as Random,
|
|
8
|
+
o as Subject,
|
|
9
|
+
n as SubjectWithId,
|
|
10
|
+
h as UNIQUE_PSEUDO_RANDOM_MAX_COUNT,
|
|
11
|
+
l as alertConsole,
|
|
12
|
+
u as alertReplace,
|
|
13
|
+
i as check,
|
|
14
|
+
d as consoleIntercept,
|
|
15
|
+
O as consoleMessageToString,
|
|
16
|
+
b as consoleReplace,
|
|
17
|
+
g as convertTimeZone,
|
|
18
|
+
y as createTaskDelayRetry,
|
|
19
|
+
I as createUniquePseudoRandom,
|
|
20
|
+
p as dateNowUnique,
|
|
21
|
+
N as deepCloneJsonLike,
|
|
22
|
+
j as deepEqualJsonLike,
|
|
23
|
+
A as deepEqualJsonLikeMap,
|
|
24
|
+
R as equalArray,
|
|
25
|
+
S as escapeHtml,
|
|
26
|
+
f as escapeRegExp,
|
|
27
|
+
T as fixStackTrace,
|
|
28
|
+
C as formatAny,
|
|
29
|
+
L as formatDate,
|
|
30
|
+
D as formatDateFileName,
|
|
31
|
+
E as getConsoleMessages,
|
|
32
|
+
P as getDateInet,
|
|
33
|
+
M as getNormalizedObject,
|
|
34
|
+
k as getRandomFunc,
|
|
35
|
+
v as getRandomSeed,
|
|
36
|
+
x as getStackTrace,
|
|
37
|
+
F as isObservable,
|
|
38
|
+
U as match,
|
|
39
|
+
B as matchAnd,
|
|
40
|
+
q as matchAndPipe,
|
|
41
|
+
w as matchAny,
|
|
42
|
+
G as matchArray,
|
|
43
|
+
W as matchArrayBuffer,
|
|
44
|
+
K as matchArrayIncludes,
|
|
45
|
+
V as matchArrayItem,
|
|
46
|
+
z as matchArrayLength,
|
|
47
|
+
J as matchArrayWith,
|
|
48
|
+
_ as matchBoolean,
|
|
49
|
+
H as matchConstructor,
|
|
50
|
+
Q as matchConvert,
|
|
51
|
+
X as matchCustom,
|
|
52
|
+
Z as matchDeep,
|
|
53
|
+
Y as matchEnum,
|
|
54
|
+
$ as matchFloat,
|
|
55
|
+
aa as matchIn,
|
|
56
|
+
sa as matchInstanceOf,
|
|
57
|
+
ta as matchInt,
|
|
58
|
+
ea as matchIntDate,
|
|
59
|
+
ca as matchIs,
|
|
60
|
+
ma as matchIsNonStrict,
|
|
61
|
+
ra as matchNever,
|
|
62
|
+
oa as matchNot,
|
|
63
|
+
na as matchNotNullish,
|
|
64
|
+
ha as matchNullish,
|
|
65
|
+
la as matchNumber,
|
|
66
|
+
ua as matchObject,
|
|
67
|
+
ia as matchObjectEntries,
|
|
68
|
+
da as matchObjectEntry,
|
|
69
|
+
Oa as matchObjectKey,
|
|
70
|
+
ba as matchObjectKeyValue,
|
|
71
|
+
ga as matchObjectKeys,
|
|
72
|
+
ya as matchObjectKeysNotNull,
|
|
73
|
+
Ia as matchObjectPartial,
|
|
74
|
+
pa as matchObjectValue,
|
|
75
|
+
Na as matchObjectValues,
|
|
76
|
+
ja as matchObjectWith,
|
|
77
|
+
Aa as matchOptional,
|
|
78
|
+
Ra as matchOr,
|
|
79
|
+
Sa as matchOrPipe,
|
|
80
|
+
fa as matchRange,
|
|
81
|
+
Ta as matchRangeDate,
|
|
82
|
+
Ca as matchRef,
|
|
83
|
+
La as matchString,
|
|
84
|
+
Da as matchStringLength,
|
|
85
|
+
Ea as matchTypeOf,
|
|
86
|
+
Pa as matchUuid,
|
|
87
|
+
Ma as matchValueState,
|
|
88
|
+
ka as max,
|
|
89
|
+
va as min,
|
|
90
|
+
xa as minMax,
|
|
91
|
+
Fa as numberMod,
|
|
92
|
+
Ua as randomBoolean,
|
|
93
|
+
Ba as randomEnum,
|
|
94
|
+
qa as randomFloat,
|
|
95
|
+
wa as randomIndexWeighted,
|
|
96
|
+
Ga as randomInt,
|
|
97
|
+
Wa as randomItem,
|
|
98
|
+
Ka as randomItems,
|
|
99
|
+
Va as setFuncName,
|
|
100
|
+
za as sha256,
|
|
101
|
+
Ja as sha256Buffer,
|
|
102
|
+
_a as timeoutAbortController,
|
|
103
|
+
Ha as toHex,
|
|
104
|
+
Qa as truncateString,
|
|
105
|
+
Xa as urlGetBoolean,
|
|
106
|
+
Za as urlGetFloat,
|
|
107
|
+
Ya as urlGetInt,
|
|
108
|
+
$a as urlGetParams,
|
|
109
|
+
as as urlGetString,
|
|
110
|
+
ss as urlParamToBoolean,
|
|
111
|
+
ts as urlParamToFloat,
|
|
112
|
+
es as urlParamToInt,
|
|
113
|
+
cs as waitObservable,
|
|
114
|
+
ms as withConsoleReplace,
|
|
115
|
+
rs as withRetry,
|
|
116
|
+
os as withTimeout
|
|
55
117
|
};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { IAbortSignalFast } from '@flemist/abort-controller-fast';
|
|
2
|
+
export type TaskDelayArg = {
|
|
3
|
+
/** Last error that occurred, or null if no error */
|
|
4
|
+
error: any;
|
|
5
|
+
/** Retry count since last success: null = no error, 0 = first retry, 1 = second retry, etc */
|
|
6
|
+
retryCount: null | number;
|
|
7
|
+
abortSignal: IAbortSignalFast | null;
|
|
8
|
+
};
|
|
9
|
+
/**
|
|
10
|
+
* Returns:
|
|
11
|
+
* - null: stop execution
|
|
12
|
+
* - number: delay in milliseconds
|
|
13
|
+
* - () => Promise: custom async wait function
|
|
14
|
+
*/
|
|
15
|
+
export type TaskDelay = (args: TaskDelayArg) => null | (() => Promise<any>) | number;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { IAbortSignalFast } from '@flemist/abort-controller-fast';
|
|
2
|
+
import { PromiseOrValue } from '../../types/common';
|
|
3
|
+
import { ITimeController } from '@flemist/time-controller';
|
|
4
|
+
import { LogLevel } from '../../debug/LogLevel';
|
|
5
|
+
import { TaskDelay } from './types';
|
|
6
|
+
export type WithRetryFuncArg = {
|
|
7
|
+
abortSignal: IAbortSignalFast | null;
|
|
8
|
+
};
|
|
9
|
+
export type WithRetryFunc<T> = (args: WithRetryFuncArg) => PromiseOrValue<T>;
|
|
10
|
+
export type WithRetryOptions<T> = {
|
|
11
|
+
func: WithRetryFunc<T>;
|
|
12
|
+
delay: TaskDelay;
|
|
13
|
+
abortSignal?: null | IAbortSignalFast;
|
|
14
|
+
timeController?: null | ITimeController;
|
|
15
|
+
logLevel?: null | LogLevel;
|
|
16
|
+
};
|
|
17
|
+
export declare function withRetry<T>(options: WithRetryOptions<T>): Promise<T>;
|
|
18
|
+
export type CreateTaskDelayRetryOptions = {
|
|
19
|
+
maxRetries?: null | number;
|
|
20
|
+
delays: number[] | {
|
|
21
|
+
min: number;
|
|
22
|
+
max: number;
|
|
23
|
+
mult?: null | number;
|
|
24
|
+
};
|
|
25
|
+
isRetriableError?: null | ((error: any) => boolean);
|
|
26
|
+
};
|
|
27
|
+
/** Creates a TaskDelay for retrying failed operations with exponential or fixed delays */
|
|
28
|
+
export declare function createTaskDelayRetry({ maxRetries, delays, isRetriableError, }: CreateTaskDelayRetryOptions): TaskDelay;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { ConsoleMessageLevel } from './consoleReplace';
|
|
2
|
+
import { IObservable } from '../../rx/types';
|
|
3
|
+
import { Unsubscribe } from '../..';
|
|
4
|
+
export type ConsoleMessage = {
|
|
5
|
+
date: number;
|
|
6
|
+
level: ConsoleMessageLevel;
|
|
7
|
+
args: string[];
|
|
8
|
+
};
|
|
9
|
+
export declare function consoleMessageToString(message: ConsoleMessage): string;
|
|
10
|
+
export declare function getConsoleMessages(): IObservable<ConsoleMessage>;
|
|
11
|
+
export declare function consoleIntercept(): () => void;
|
|
12
|
+
export declare function alertConsole(args: {
|
|
13
|
+
levels?: null | ConsoleMessageLevel[];
|
|
14
|
+
predicate?: null | ((args: {
|
|
15
|
+
text: string;
|
|
16
|
+
message: ConsoleMessage;
|
|
17
|
+
}) => boolean);
|
|
18
|
+
}): Unsubscribe;
|
|
@@ -10,4 +10,5 @@ export declare enum ConsoleMessageLevel {
|
|
|
10
10
|
export type Console = Record<ConsoleMessageLevel, (...args: any[]) => void>;
|
|
11
11
|
export declare function consoleReplace(handler: (console: Console, level: ConsoleMessageLevel, args: any[]) => void): () => void;
|
|
12
12
|
export type WithConsoleReplaceFunc = <T>(callback: () => T) => T;
|
|
13
|
-
export
|
|
13
|
+
export type WithConsoleReplaceHandler = (console: Console, level: ConsoleMessageLevel, args: any[]) => void;
|
|
14
|
+
export declare function withConsoleReplace(handler: WithConsoleReplaceHandler): WithConsoleReplaceFunc;
|
package/build/common/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("../urlGet-BOGFUahf.js");exports.ConsoleMessageLevel=t.ConsoleMessageLevel;exports.Lazy=t.Lazy;exports.LazyWithId=t.LazyWithId;exports.LogLevel=t.LogLevel;exports.Random=t.Random;exports.Subject=t.Subject;exports.SubjectWithId=t.SubjectWithId;exports.UNIQUE_PSEUDO_RANDOM_MAX_COUNT=t.UNIQUE_PSEUDO_RANDOM_MAX_COUNT;exports.alertConsole=t.alertConsole;exports.alertReplace=t.alertReplace;exports.check=t.check;exports.consoleIntercept=t.consoleIntercept;exports.consoleMessageToString=t.consoleMessageToString;exports.consoleReplace=t.consoleReplace;exports.convertTimeZone=t.convertTimeZone;exports.createTaskDelayRetry=t.createTaskDelayRetry;exports.createUniquePseudoRandom=t.createUniquePseudoRandom;exports.dateNowUnique=t.dateNowUnique;exports.deepCloneJsonLike=t.deepCloneJsonLike;exports.deepEqualJsonLike=t.deepEqualJsonLike;exports.deepEqualJsonLikeMap=t.deepEqualJsonLikeMap;exports.equalArray=t.equalArray;exports.escapeHtml=t.escapeHtml;exports.escapeRegExp=t.escapeRegExp;exports.fixStackTrace=t.fixStackTrace;exports.formatAny=t.formatAny;exports.formatDate=t.formatDate;exports.formatDateFileName=t.formatDateFileName;exports.getConsoleMessages=t.getConsoleMessages;exports.getDateInet=t.getDateInet;exports.getNormalizedObject=t.getNormalizedObject;exports.getRandomFunc=t.getRandomFunc;exports.getRandomSeed=t.getRandomSeed;exports.getStackTrace=t.getStackTrace;exports.isObservable=t.isObservable;exports.match=t.match;exports.matchAnd=t.matchAnd;exports.matchAndPipe=t.matchAndPipe;exports.matchAny=t.matchAny;exports.matchArray=t.matchArray;exports.matchArrayBuffer=t.matchArrayBuffer;exports.matchArrayIncludes=t.matchArrayIncludes;exports.matchArrayItem=t.matchArrayItem;exports.matchArrayLength=t.matchArrayLength;exports.matchArrayWith=t.matchArrayWith;exports.matchBoolean=t.matchBoolean;exports.matchConstructor=t.matchConstructor;exports.matchConvert=t.matchConvert;exports.matchCustom=t.matchCustom;exports.matchDeep=t.matchDeep;exports.matchEnum=t.matchEnum;exports.matchFloat=t.matchFloat;exports.matchIn=t.matchIn;exports.matchInstanceOf=t.matchInstanceOf;exports.matchInt=t.matchInt;exports.matchIntDate=t.matchIntDate;exports.matchIs=t.matchIs;exports.matchIsNonStrict=t.matchIsNonStrict;exports.matchNever=t.matchNever;exports.matchNot=t.matchNot;exports.matchNotNullish=t.matchNotNullish;exports.matchNullish=t.matchNullish;exports.matchNumber=t.matchNumber;exports.matchObject=t.matchObject;exports.matchObjectEntries=t.matchObjectEntries;exports.matchObjectEntry=t.matchObjectEntry;exports.matchObjectKey=t.matchObjectKey;exports.matchObjectKeyValue=t.matchObjectKeyValue;exports.matchObjectKeys=t.matchObjectKeys;exports.matchObjectKeysNotNull=t.matchObjectKeysNotNull;exports.matchObjectPartial=t.matchObjectPartial;exports.matchObjectValue=t.matchObjectValue;exports.matchObjectValues=t.matchObjectValues;exports.matchObjectWith=t.matchObjectWith;exports.matchOptional=t.matchOptional;exports.matchOr=t.matchOr;exports.matchOrPipe=t.matchOrPipe;exports.matchRange=t.matchRange;exports.matchRangeDate=t.matchRangeDate;exports.matchRef=t.matchRef;exports.matchString=t.matchString;exports.matchStringLength=t.matchStringLength;exports.matchTypeOf=t.matchTypeOf;exports.matchUuid=t.matchUuid;exports.matchValueState=t.matchValueState;exports.max=t.max;exports.min=t.min;exports.minMax=t.minMax;exports.numberMod=t.numberMod;exports.randomBoolean=t.randomBoolean;exports.randomEnum=t.randomEnum;exports.randomFloat=t.randomFloat;exports.randomIndexWeighted=t.randomIndexWeighted;exports.randomInt=t.randomInt;exports.randomItem=t.randomItem;exports.randomItems=t.randomItems;exports.setFuncName=t.setFuncName;exports.sha256=t.sha256;exports.sha256Buffer=t.sha256Buffer;exports.timeoutAbortController=t.timeoutAbortController;exports.toHex=t.toHex;exports.truncateString=t.truncateString;exports.urlGetBoolean=t.urlGetBoolean;exports.urlGetFloat=t.urlGetFloat;exports.urlGetInt=t.urlGetInt;exports.urlGetParams=t.urlGetParams;exports.urlGetString=t.urlGetString;exports.urlParamToBoolean=t.urlParamToBoolean;exports.urlParamToFloat=t.urlParamToFloat;exports.urlParamToInt=t.urlParamToInt;exports.waitObservable=t.waitObservable;exports.withConsoleReplace=t.withConsoleReplace;exports.withRetry=t.withRetry;exports.withTimeout=t.withTimeout;
|
package/build/common/index.d.ts
CHANGED
package/build/common/index.mjs
CHANGED
|
@@ -1,55 +1,117 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { L as t, V as e, W as c, O as m, R as r, _ as o, $ as n, U as h, K as l, G as u, a2 as i, J as d, H as O, M as b, q as g, Y as y, l as I, o as p, A as N, B as j, C as A, D as R, y as S, z as f, P as T, u as C, v as L, w as D, I as E, p as P, E as M, d as k, g as v, Q as x, Z as F, a1 as U, aq as B, as as q, a5 as w, a3 as G, aP as W, a4 as K, a8 as V, au as z, ax as J, am as _, al as H, a9 as Q, aI as X, ag as Z, aH as Y, ae as $, aG as aa, aj as sa, ad as ta, aJ as ea, ab as ca, aa as ma, a7 as ra, aM as oa, ao as na, an as ha, ac as la, af as ua, aA as ia, aB as da, aC as Oa, aE as ba, ay as ga, aF as ya, ah as Ia, aD as pa, az as Na, aw as ja, at as Aa, ap as Ra, ar as Sa, aK as fa, aL as Ta, a6 as Ca, ai as La, av as Da, ak as Ea, aN as Pa, aO as Ma, b as ka, m as va, c as xa, n as Fa, f as Ua, k as Ba, r as qa, h as wa, e as Ga, i as Wa, j as Ka, F as Va, a as za, s as Ja, S as _a, t as Ha, x as Qa, aV as Xa, aX as Za, aW as Ya, aQ as $a, aU as as, aR as ss, aT as ts, aS as es, a0 as cs, N as ms, X as rs, T as os } from "../urlGet-BCW9jvAm.mjs";
|
|
2
2
|
export {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
r as
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
N as
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
Y as
|
|
54
|
-
$ as
|
|
3
|
+
t as ConsoleMessageLevel,
|
|
4
|
+
e as Lazy,
|
|
5
|
+
c as LazyWithId,
|
|
6
|
+
m as LogLevel,
|
|
7
|
+
r as Random,
|
|
8
|
+
o as Subject,
|
|
9
|
+
n as SubjectWithId,
|
|
10
|
+
h as UNIQUE_PSEUDO_RANDOM_MAX_COUNT,
|
|
11
|
+
l as alertConsole,
|
|
12
|
+
u as alertReplace,
|
|
13
|
+
i as check,
|
|
14
|
+
d as consoleIntercept,
|
|
15
|
+
O as consoleMessageToString,
|
|
16
|
+
b as consoleReplace,
|
|
17
|
+
g as convertTimeZone,
|
|
18
|
+
y as createTaskDelayRetry,
|
|
19
|
+
I as createUniquePseudoRandom,
|
|
20
|
+
p as dateNowUnique,
|
|
21
|
+
N as deepCloneJsonLike,
|
|
22
|
+
j as deepEqualJsonLike,
|
|
23
|
+
A as deepEqualJsonLikeMap,
|
|
24
|
+
R as equalArray,
|
|
25
|
+
S as escapeHtml,
|
|
26
|
+
f as escapeRegExp,
|
|
27
|
+
T as fixStackTrace,
|
|
28
|
+
C as formatAny,
|
|
29
|
+
L as formatDate,
|
|
30
|
+
D as formatDateFileName,
|
|
31
|
+
E as getConsoleMessages,
|
|
32
|
+
P as getDateInet,
|
|
33
|
+
M as getNormalizedObject,
|
|
34
|
+
k as getRandomFunc,
|
|
35
|
+
v as getRandomSeed,
|
|
36
|
+
x as getStackTrace,
|
|
37
|
+
F as isObservable,
|
|
38
|
+
U as match,
|
|
39
|
+
B as matchAnd,
|
|
40
|
+
q as matchAndPipe,
|
|
41
|
+
w as matchAny,
|
|
42
|
+
G as matchArray,
|
|
43
|
+
W as matchArrayBuffer,
|
|
44
|
+
K as matchArrayIncludes,
|
|
45
|
+
V as matchArrayItem,
|
|
46
|
+
z as matchArrayLength,
|
|
47
|
+
J as matchArrayWith,
|
|
48
|
+
_ as matchBoolean,
|
|
49
|
+
H as matchConstructor,
|
|
50
|
+
Q as matchConvert,
|
|
51
|
+
X as matchCustom,
|
|
52
|
+
Z as matchDeep,
|
|
53
|
+
Y as matchEnum,
|
|
54
|
+
$ as matchFloat,
|
|
55
|
+
aa as matchIn,
|
|
56
|
+
sa as matchInstanceOf,
|
|
57
|
+
ta as matchInt,
|
|
58
|
+
ea as matchIntDate,
|
|
59
|
+
ca as matchIs,
|
|
60
|
+
ma as matchIsNonStrict,
|
|
61
|
+
ra as matchNever,
|
|
62
|
+
oa as matchNot,
|
|
63
|
+
na as matchNotNullish,
|
|
64
|
+
ha as matchNullish,
|
|
65
|
+
la as matchNumber,
|
|
66
|
+
ua as matchObject,
|
|
67
|
+
ia as matchObjectEntries,
|
|
68
|
+
da as matchObjectEntry,
|
|
69
|
+
Oa as matchObjectKey,
|
|
70
|
+
ba as matchObjectKeyValue,
|
|
71
|
+
ga as matchObjectKeys,
|
|
72
|
+
ya as matchObjectKeysNotNull,
|
|
73
|
+
Ia as matchObjectPartial,
|
|
74
|
+
pa as matchObjectValue,
|
|
75
|
+
Na as matchObjectValues,
|
|
76
|
+
ja as matchObjectWith,
|
|
77
|
+
Aa as matchOptional,
|
|
78
|
+
Ra as matchOr,
|
|
79
|
+
Sa as matchOrPipe,
|
|
80
|
+
fa as matchRange,
|
|
81
|
+
Ta as matchRangeDate,
|
|
82
|
+
Ca as matchRef,
|
|
83
|
+
La as matchString,
|
|
84
|
+
Da as matchStringLength,
|
|
85
|
+
Ea as matchTypeOf,
|
|
86
|
+
Pa as matchUuid,
|
|
87
|
+
Ma as matchValueState,
|
|
88
|
+
ka as max,
|
|
89
|
+
va as min,
|
|
90
|
+
xa as minMax,
|
|
91
|
+
Fa as numberMod,
|
|
92
|
+
Ua as randomBoolean,
|
|
93
|
+
Ba as randomEnum,
|
|
94
|
+
qa as randomFloat,
|
|
95
|
+
wa as randomIndexWeighted,
|
|
96
|
+
Ga as randomInt,
|
|
97
|
+
Wa as randomItem,
|
|
98
|
+
Ka as randomItems,
|
|
99
|
+
Va as setFuncName,
|
|
100
|
+
za as sha256,
|
|
101
|
+
Ja as sha256Buffer,
|
|
102
|
+
_a as timeoutAbortController,
|
|
103
|
+
Ha as toHex,
|
|
104
|
+
Qa as truncateString,
|
|
105
|
+
Xa as urlGetBoolean,
|
|
106
|
+
Za as urlGetFloat,
|
|
107
|
+
Ya as urlGetInt,
|
|
108
|
+
$a as urlGetParams,
|
|
109
|
+
as as urlGetString,
|
|
110
|
+
ss as urlParamToBoolean,
|
|
111
|
+
ts as urlParamToFloat,
|
|
112
|
+
es as urlParamToInt,
|
|
113
|
+
cs as waitObservable,
|
|
114
|
+
ms as withConsoleReplace,
|
|
115
|
+
rs as withRetry,
|
|
116
|
+
os as withTimeout
|
|
55
117
|
};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { IObservable, Listener, Stores, StoresValues } from './types';
|
|
2
|
+
import { Unsubscribe } from '../types/common';
|
|
3
|
+
import { Emit } from './Subject';
|
|
4
|
+
export type DerivedFunc<S extends Stores, T> = (values: StoresValues<S>, emit: Emit<T>, update: (updater: (event: T) => T) => void) => T | Unsubscribe;
|
|
5
|
+
/** @deprecated Incompleted, use svelte derived instead */
|
|
6
|
+
export declare class Derived<S extends Stores, T> implements IObservable<T> {
|
|
7
|
+
private readonly _source;
|
|
8
|
+
private readonly _subject;
|
|
9
|
+
constructor(source: S, func: DerivedFunc<S, T>);
|
|
10
|
+
subscribe(listener: Listener<T>): Unsubscribe;
|
|
11
|
+
}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { ISubject, Listener } from './types';
|
|
2
|
+
import { PromiseOrValue, Unsubscribe } from '../types/common';
|
|
3
|
+
export type Emit<T> = (value: T) => PromiseOrValue<void>;
|
|
4
|
+
export type Updater<T> = (event: T) => T;
|
|
5
|
+
export type Update<T> = (updater: Updater<T>) => void;
|
|
6
|
+
export type StartStopNotifier<T> = (emit: Emit<T>, update: Update<T>) => void | Unsubscribe;
|
|
7
|
+
export type ActionOnCycle = 'emitLast' | 'throw' | false;
|
|
8
|
+
export type SubjectOptions<T> = {
|
|
9
|
+
emitLastEvent?: null | boolean;
|
|
10
|
+
startStopNotifier?: null | StartStopNotifier<T>;
|
|
11
|
+
hasLast?: null | boolean;
|
|
12
|
+
last?: T;
|
|
13
|
+
actionOnCycle?: null | ActionOnCycle;
|
|
14
|
+
};
|
|
15
|
+
export declare class Subject<T = void> implements ISubject<T> {
|
|
16
|
+
private readonly _listeners;
|
|
17
|
+
private readonly _listenersAdd;
|
|
18
|
+
private readonly _startStopNotifier;
|
|
19
|
+
private readonly _emit;
|
|
20
|
+
private readonly _update;
|
|
21
|
+
private _unsubscribeNotifier;
|
|
22
|
+
private readonly _emitLast;
|
|
23
|
+
private _hasLast;
|
|
24
|
+
private _last;
|
|
25
|
+
private _emitting;
|
|
26
|
+
private _subscribing;
|
|
27
|
+
private readonly _actionOnCycle;
|
|
28
|
+
constructor({ emitLastEvent, startStopNotifier, hasLast, last, actionOnCycle, }?: SubjectOptions<T>);
|
|
29
|
+
get hasLast(): boolean;
|
|
30
|
+
get last(): T | undefined;
|
|
31
|
+
get hasListeners(): boolean;
|
|
32
|
+
subscribe(listener: Listener<T>): Unsubscribe;
|
|
33
|
+
emit(event: T): PromiseOrValue<void>;
|
|
34
|
+
update(updater: (event: T) => T): PromiseOrValue<void>;
|
|
35
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { IEmitter, IObservable, ISubject, ISubjectWithId, Listener } from './types';
|
|
2
|
+
import { PromiseOrValue, Unsubscribe } from '../types/common';
|
|
3
|
+
export declare class SubjectWithId<Id, T = void> implements ISubjectWithId<Id, T> {
|
|
4
|
+
private readonly _subjects;
|
|
5
|
+
private readonly _getLastEvent?;
|
|
6
|
+
constructor({ getLastEvent, }?: {
|
|
7
|
+
getLastEvent?: null | ((id: Id) => T);
|
|
8
|
+
});
|
|
9
|
+
subscribe(id: Id, listener: Listener<T>): Unsubscribe;
|
|
10
|
+
emit(id: Id, event: T): PromiseOrValue<void>;
|
|
11
|
+
forEach(callback: (emitter: IEmitter<T>, id: Id) => void): void;
|
|
12
|
+
observable(id: Id): IObservable<T>;
|
|
13
|
+
emitter(id: Id): IEmitter<T>;
|
|
14
|
+
subject(id: Id): ISubject<T>;
|
|
15
|
+
}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { PromiseOrValue, Unsubscribe } from '../types/common';
|
|
2
|
+
import { ValueState } from '@flemist/async-utils';
|
|
3
|
+
export type Listener<T = void> = (event: T) => PromiseOrValue<void>;
|
|
4
|
+
export interface IObservable<T = void> {
|
|
5
|
+
subscribe(listener: Listener<T>): Unsubscribe;
|
|
6
|
+
}
|
|
7
|
+
export interface IEmitter<T = void> {
|
|
8
|
+
emit(event: T): PromiseOrValue<void>;
|
|
9
|
+
}
|
|
10
|
+
export interface ISubject<T = void> extends IObservable<T>, IEmitter<T> {
|
|
11
|
+
}
|
|
12
|
+
export interface IObservableWithId<Id, T = void> {
|
|
13
|
+
subscribe(id: Id, listener: Listener<T>): Unsubscribe;
|
|
14
|
+
observable(id: Id): IObservable<T>;
|
|
15
|
+
}
|
|
16
|
+
export interface IEmitterWithId<Id, T = void> {
|
|
17
|
+
emit(id: Id, event: T): PromiseOrValue<void>;
|
|
18
|
+
forEach(callback: (emitter: IEmitter<T>, id: Id) => void): void;
|
|
19
|
+
emitter(id: Id): IEmitter<T>;
|
|
20
|
+
}
|
|
21
|
+
export interface ISubjectWithId<Id, T = void> extends IObservableWithId<Id, T>, IEmitterWithId<Id, T> {
|
|
22
|
+
subject(id: Id): ISubject<T>;
|
|
23
|
+
}
|
|
24
|
+
export type ObservableValueState<T> = IObservable<ValueState<T>>;
|
|
25
|
+
export type OfObservable<T> = T extends IObservable<infer U> ? U : never;
|
|
26
|
+
export type ObservableOrValue<T = void> = IObservable<T> | T;
|
|
27
|
+
export type Stores = [ObservableOrValue<any>, ...Array<ObservableOrValue<any>>] | Array<ObservableOrValue<any>>;
|
|
28
|
+
export type StoresValues<T> = {
|
|
29
|
+
[K in keyof T]: T[K] extends ObservableOrValue<infer U> ? U : T[K];
|
|
30
|
+
};
|
|
31
|
+
export type Observables<T> = {
|
|
32
|
+
[K in keyof T]: T[K] extends IObservable<any> ? T[K] : IObservable<T[K]>;
|
|
33
|
+
};
|
|
34
|
+
export type DerivedOrValueFunc<Value, T> = (value: Value) => ObservableOrValue<T>;
|
|
35
|
+
export type DerivedOrValuesFunc<S extends Stores, T> = (values: StoresValues<S>) => ObservableOrValue<T>;
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import { IObservable } from './types';
|
|
2
|
+
import { IAbortSignalFast } from '@flemist/abort-controller-fast';
|
|
3
|
+
export declare function waitObservable<T>(observable: IObservable<T>, predicate?: null | ((value: T, first: boolean) => boolean | null | undefined), abortSignal?: null | IAbortSignalFast): Promise<T>;
|