@flemist/simple-utils 2.0.1 → 2.1.0

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.
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("../urlGet-BQjIy5xj.js");exports.ConsoleMessageLevel=e.ConsoleMessageLevel;exports.Lazy=e.Lazy;exports.LazyWithId=e.LazyWithId;exports.Random=e.Random;exports.UNIQUE_PSEUDO_RANDOM_MAX_COUNT=e.UNIQUE_PSEUDO_RANDOM_MAX_COUNT;exports.alertReplace=e.alertReplace;exports.consoleReplace=e.consoleReplace;exports.convertTimeZone=e.convertTimeZone;exports.createUniquePseudoRandom=e.createUniquePseudoRandom;exports.dateNowUnique=e.dateNowUnique;exports.deepCloneJsonLike=e.deepCloneJsonLike;exports.deepEqualJsonLike=e.deepEqualJsonLike;exports.deepEqualJsonLikeMap=e.deepEqualJsonLikeMap;exports.equalArray=e.equalArray;exports.escapeHtml=e.escapeHtml;exports.escapeRegExp=e.escapeRegExp;exports.fixStackTrace=e.fixStackTrace;exports.formatAny=e.formatAny;exports.formatDate=e.formatDate;exports.formatDateFileName=e.formatDateFileName;exports.getDateInet=e.getDateInet;exports.getNormalizedObject=e.getNormalizedObject;exports.getRandomFunc=e.getRandomFunc;exports.getRandomSeed=e.getRandomSeed;exports.getStackTrace=e.getStackTrace;exports.max=e.max;exports.min=e.min;exports.minMax=e.minMax;exports.numberMod=e.numberMod;exports.randomBoolean=e.randomBoolean;exports.randomEnum=e.randomEnum;exports.randomFloat=e.randomFloat;exports.randomIndexWeighted=e.randomIndexWeighted;exports.randomInt=e.randomInt;exports.randomItem=e.randomItem;exports.randomItems=e.randomItems;exports.setFuncName=e.setFuncName;exports.sha256=e.sha256;exports.sha256Buffer=e.sha256Buffer;exports.timeoutAbortController=e.timeoutAbortController;exports.toHex=e.toHex;exports.truncateString=e.truncateString;exports.urlGetBoolean=e.urlGetBoolean;exports.urlGetFloat=e.urlGetFloat;exports.urlGetInt=e.urlGetInt;exports.urlGetParams=e.urlGetParams;exports.urlGetString=e.urlGetString;exports.urlParamToBoolean=e.urlParamToBoolean;exports.urlParamToFloat=e.urlParamToFloat;exports.urlParamToInt=e.urlParamToInt;exports.withConsoleReplace=e.withConsoleReplace;exports.withTimeout=e.withTimeout;
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;
@@ -1,55 +1,117 @@
1
- import { H as s, O as o, P as t, R as n, U as r, G as m, I as l, q as d, l as u, o as i, A as c, B as p, C as g, D as I, y as R, z as T, K as f, u as x, v as N, w as h, p as E, E as F, d as L, g as M, L as P, b as S, m as U, c as k, n as q, f as A, k as C, r as D, h as G, e as y, i as B, j as O, F as b, a as w, s as z, M as J, t as _, x as v, X as H, Z as W, Y as j, Q, W as X, S as Z, V as K, T as V, J as Y, N as $ } from "../urlGet-DynBzL4r.mjs";
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
- s as ConsoleMessageLevel,
4
- o as Lazy,
5
- t as LazyWithId,
6
- n as Random,
7
- r as UNIQUE_PSEUDO_RANDOM_MAX_COUNT,
8
- m as alertReplace,
9
- l as consoleReplace,
10
- d as convertTimeZone,
11
- u as createUniquePseudoRandom,
12
- i as dateNowUnique,
13
- c as deepCloneJsonLike,
14
- p as deepEqualJsonLike,
15
- g as deepEqualJsonLikeMap,
16
- I as equalArray,
17
- R as escapeHtml,
18
- T as escapeRegExp,
19
- f as fixStackTrace,
20
- x as formatAny,
21
- N as formatDate,
22
- h as formatDateFileName,
23
- E as getDateInet,
24
- F as getNormalizedObject,
25
- L as getRandomFunc,
26
- M as getRandomSeed,
27
- P as getStackTrace,
28
- S as max,
29
- U as min,
30
- k as minMax,
31
- q as numberMod,
32
- A as randomBoolean,
33
- C as randomEnum,
34
- D as randomFloat,
35
- G as randomIndexWeighted,
36
- y as randomInt,
37
- B as randomItem,
38
- O as randomItems,
39
- b as setFuncName,
40
- w as sha256,
41
- z as sha256Buffer,
42
- J as timeoutAbortController,
43
- _ as toHex,
44
- v as truncateString,
45
- H as urlGetBoolean,
46
- W as urlGetFloat,
47
- j as urlGetInt,
48
- Q as urlGetParams,
49
- X as urlGetString,
50
- Z as urlParamToBoolean,
51
- K as urlParamToFloat,
52
- V as urlParamToInt,
53
- Y as withConsoleReplace,
54
- $ as withTimeout
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
  };
@@ -1,2 +1,3 @@
1
1
  export * from './abort';
2
2
  export * from './lazy';
3
+ export * from './retry';
@@ -0,0 +1,2 @@
1
+ export * from './types';
2
+ export * from './withRetry';
@@ -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,6 @@
1
+ export declare enum LogLevel {
2
+ none = 0,
3
+ error = 1,
4
+ warn = 2,
5
+ debug = 3
6
+ }
@@ -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 declare function withConsoleReplace(handler: (console: Console, level: ConsoleMessageLevel, args: any[]) => void): WithConsoleReplaceFunc;
13
+ export type WithConsoleReplaceHandler = (console: Console, level: ConsoleMessageLevel, args: any[]) => void;
14
+ export declare function withConsoleReplace(handler: WithConsoleReplaceHandler): WithConsoleReplaceFunc;
@@ -1,2 +1,3 @@
1
1
  export * from './alertReplace';
2
+ export * from './consoleIntercept';
2
3
  export * from './consoleReplace';
@@ -1,2 +1,3 @@
1
1
  export * from './console';
2
+ export * from './LogLevel';
2
3
  export * from './stack-trace';
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("../urlGet-BQjIy5xj.js");exports.ConsoleMessageLevel=e.ConsoleMessageLevel;exports.Lazy=e.Lazy;exports.LazyWithId=e.LazyWithId;exports.Random=e.Random;exports.UNIQUE_PSEUDO_RANDOM_MAX_COUNT=e.UNIQUE_PSEUDO_RANDOM_MAX_COUNT;exports.alertReplace=e.alertReplace;exports.consoleReplace=e.consoleReplace;exports.convertTimeZone=e.convertTimeZone;exports.createUniquePseudoRandom=e.createUniquePseudoRandom;exports.dateNowUnique=e.dateNowUnique;exports.deepCloneJsonLike=e.deepCloneJsonLike;exports.deepEqualJsonLike=e.deepEqualJsonLike;exports.deepEqualJsonLikeMap=e.deepEqualJsonLikeMap;exports.equalArray=e.equalArray;exports.escapeHtml=e.escapeHtml;exports.escapeRegExp=e.escapeRegExp;exports.fixStackTrace=e.fixStackTrace;exports.formatAny=e.formatAny;exports.formatDate=e.formatDate;exports.formatDateFileName=e.formatDateFileName;exports.getDateInet=e.getDateInet;exports.getNormalizedObject=e.getNormalizedObject;exports.getRandomFunc=e.getRandomFunc;exports.getRandomSeed=e.getRandomSeed;exports.getStackTrace=e.getStackTrace;exports.max=e.max;exports.min=e.min;exports.minMax=e.minMax;exports.numberMod=e.numberMod;exports.randomBoolean=e.randomBoolean;exports.randomEnum=e.randomEnum;exports.randomFloat=e.randomFloat;exports.randomIndexWeighted=e.randomIndexWeighted;exports.randomInt=e.randomInt;exports.randomItem=e.randomItem;exports.randomItems=e.randomItems;exports.setFuncName=e.setFuncName;exports.sha256=e.sha256;exports.sha256Buffer=e.sha256Buffer;exports.timeoutAbortController=e.timeoutAbortController;exports.toHex=e.toHex;exports.truncateString=e.truncateString;exports.urlGetBoolean=e.urlGetBoolean;exports.urlGetFloat=e.urlGetFloat;exports.urlGetInt=e.urlGetInt;exports.urlGetParams=e.urlGetParams;exports.urlGetString=e.urlGetString;exports.urlParamToBoolean=e.urlParamToBoolean;exports.urlParamToFloat=e.urlParamToFloat;exports.urlParamToInt=e.urlParamToInt;exports.withConsoleReplace=e.withConsoleReplace;exports.withTimeout=e.withTimeout;
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;
@@ -6,5 +6,7 @@ export * from './string';
6
6
  export * from './object';
7
7
  export * from './debug';
8
8
  export * from './async';
9
+ export * from './rx';
10
+ export * from './test';
9
11
  export * from './types';
10
12
  export * from './url';
@@ -1,55 +1,117 @@
1
- import { H as s, O as o, P as t, R as n, U as r, G as m, I as l, q as d, l as u, o as i, A as c, B as p, C as g, D as I, y as R, z as T, K as f, u as x, v as N, w as h, p as E, E as F, d as L, g as M, L as P, b as S, m as U, c as k, n as q, f as A, k as C, r as D, h as G, e as y, i as B, j as O, F as b, a as w, s as z, M as J, t as _, x as v, X as H, Z as W, Y as j, Q, W as X, S as Z, V as K, T as V, J as Y, N as $ } from "../urlGet-DynBzL4r.mjs";
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
- s as ConsoleMessageLevel,
4
- o as Lazy,
5
- t as LazyWithId,
6
- n as Random,
7
- r as UNIQUE_PSEUDO_RANDOM_MAX_COUNT,
8
- m as alertReplace,
9
- l as consoleReplace,
10
- d as convertTimeZone,
11
- u as createUniquePseudoRandom,
12
- i as dateNowUnique,
13
- c as deepCloneJsonLike,
14
- p as deepEqualJsonLike,
15
- g as deepEqualJsonLikeMap,
16
- I as equalArray,
17
- R as escapeHtml,
18
- T as escapeRegExp,
19
- f as fixStackTrace,
20
- x as formatAny,
21
- N as formatDate,
22
- h as formatDateFileName,
23
- E as getDateInet,
24
- F as getNormalizedObject,
25
- L as getRandomFunc,
26
- M as getRandomSeed,
27
- P as getStackTrace,
28
- S as max,
29
- U as min,
30
- k as minMax,
31
- q as numberMod,
32
- A as randomBoolean,
33
- C as randomEnum,
34
- D as randomFloat,
35
- G as randomIndexWeighted,
36
- y as randomInt,
37
- B as randomItem,
38
- O as randomItems,
39
- b as setFuncName,
40
- w as sha256,
41
- z as sha256Buffer,
42
- J as timeoutAbortController,
43
- _ as toHex,
44
- v as truncateString,
45
- H as urlGetBoolean,
46
- W as urlGetFloat,
47
- j as urlGetInt,
48
- Q as urlGetParams,
49
- X as urlGetString,
50
- Z as urlParamToBoolean,
51
- K as urlParamToFloat,
52
- V as urlParamToInt,
53
- Y as withConsoleReplace,
54
- $ as withTimeout
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,2 @@
1
+ import { IObservable } from './types';
2
+ export declare function isObservable(obj: any): obj is IObservable<any>;
@@ -0,0 +1,5 @@
1
+ export * from './types';
2
+ export * from './helpers';
3
+ export * from './Subject';
4
+ export * from './SubjectWithId';
5
+ export * from './waitObservable';
@@ -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>;
@@ -1,3 +1,4 @@
1
+ import { TruncateStringOptions } from './truncateString';
1
2
  export type FormatAnyToString = (obj: any, path: string[], toString: (obj: any) => any) => string | null | undefined | void;
2
3
  export type FormatAnyOptions = {
3
4
  pretty?: boolean;
@@ -8,5 +9,6 @@ export type FormatAnyOptions = {
8
9
  showObjectId?: boolean;
9
10
  showArrayIndex?: boolean;
10
11
  customToString?: null | FormatAnyToString;
12
+ truncateOptions?: null | TruncateStringOptions;
11
13
  };
12
14
  export declare function formatAny(obj: any, options?: null | FormatAnyOptions, path?: null | string[], visited?: null | Set<any>): string;