@flemist/simple-utils 2.1.5 → 2.1.7

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.
Files changed (49) hide show
  1. package/build/browser/index.cjs +1 -1
  2. package/build/browser/index.mjs +178 -146
  3. package/build/common/async/Locker.d.ts +28 -0
  4. package/build/common/async/index.d.ts +2 -0
  5. package/build/common/async/promise.d.ts +7 -0
  6. package/build/common/cache/Cache.d.ts +46 -0
  7. package/build/common/cache/CacheStats.d.ts +20 -0
  8. package/build/common/cache/MemoryStorage.d.ts +11 -0
  9. package/build/common/cache/getHashKey.d.ts +1 -0
  10. package/build/common/cache/getJsonKey.d.ts +1 -0
  11. package/build/common/cache/index.d.ts +6 -0
  12. package/build/common/cache/types.d.ts +28 -0
  13. package/build/common/converter/converterBufferToGzip.d.ts +4 -0
  14. package/build/common/converter/converterErrorToBuffer.d.ts +2 -0
  15. package/build/common/converter/converterErrorToGzip.d.ts +4 -0
  16. package/build/common/converter/converterJson.d.ts +2 -0
  17. package/build/common/converter/converterJsonBuffer.d.ts +2 -0
  18. package/build/common/converter/converterJsonGzip.d.ts +4 -0
  19. package/build/common/converter/converterStringToBuffer.d.ts +2 -0
  20. package/build/common/converter/helpers.d.ts +13 -0
  21. package/build/common/converter/index.d.ts +11 -0
  22. package/build/common/converter/mapObjectConverter.d.ts +2 -0
  23. package/build/common/converter/setArrayConverter.d.ts +2 -0
  24. package/build/common/converter/types.d.ts +41 -0
  25. package/build/common/gzip/compressGzip.d.ts +35 -0
  26. package/build/common/gzip/decompressGzip.d.ts +2 -0
  27. package/build/common/gzip/index.d.ts +2 -0
  28. package/build/common/index.cjs +1 -1
  29. package/build/common/index.d.ts +3 -0
  30. package/build/common/index.mjs +178 -146
  31. package/build/common/string/index.d.ts +1 -1
  32. package/build/node/cache/FileStatStorage.d.ts +23 -0
  33. package/build/node/cache/FileStorage.d.ts +29 -0
  34. package/build/node/cache/createConverterSubPath.d.ts +12 -0
  35. package/build/node/cache/createFileCacheOptions.d.ts +17 -0
  36. package/build/node/cache/generateTempFileName.d.ts +1 -0
  37. package/build/node/cache/index.d.ts +6 -0
  38. package/build/node/cache/writeFileThroughTmp.d.ts +2 -0
  39. package/build/node/fs/index.d.ts +1 -0
  40. package/build/node/fs/readDirRecursive.d.ts +6 -0
  41. package/build/node/index.cjs +8 -8
  42. package/build/node/index.d.ts +1 -0
  43. package/build/node/index.mjs +1000 -701
  44. package/build/urlGet-BtyqjC2r.mjs +2452 -0
  45. package/build/urlGet-BukRa7Gq.js +17 -0
  46. package/package.json +37 -38
  47. package/build/common/time/dateToString.d.ts +0 -2
  48. package/build/urlGet-CerQ1cKh.js +0 -17
  49. package/build/urlGet-DZEwtNXt.mjs +0 -2000
@@ -0,0 +1,41 @@
1
+ import { PromiseOrValue } from '../types/common';
2
+ export type Correct<T> = (value: T) => T;
3
+ export type CorrectWithDefault<T> = (value: T, correctDefault: Correct<T>) => T;
4
+ export type ConvertTo<From, To> = (from: From) => To;
5
+ export type ConvertFrom<From, To> = (to: To) => From;
6
+ export type ConverterTo<From, To> = {
7
+ to: ConvertTo<From, To>;
8
+ };
9
+ export type ConverterFrom<From, To> = {
10
+ from: ConvertFrom<From, To>;
11
+ };
12
+ /** ToFrom => (ToTo ... FromTo) => FromFrom */
13
+ export type Converter<ToFrom, ToTo, FromTo = ToTo, FromFrom = ToFrom> = ConverterTo<ToFrom, ToTo> & ConverterFrom<FromFrom, FromTo>;
14
+ export type ConvertWithDefaultTo<From, To> = (from: From, convertDefault: ConvertTo<From, To>) => To;
15
+ export type ConvertWithDefaultFrom<From, To> = (to: To, convertDefault: ConvertFrom<From, To>) => From;
16
+ export type ConverterWithDefaultTo<From, To> = {
17
+ to: ConvertWithDefaultTo<From, To>;
18
+ };
19
+ export type ConverterWithDefaultFrom<From, To> = {
20
+ from: ConvertWithDefaultFrom<From, To>;
21
+ };
22
+ export type ConverterWithDefault<ToFrom, ToTo, FromTo = ToTo, FromFrom = ToFrom> = ConverterWithDefaultTo<ToFrom, ToTo> & ConverterWithDefaultFrom<FromFrom, FromTo>;
23
+ export type ConvertToAsync<From, To> = (from: From) => PromiseOrValue<To>;
24
+ export type ConvertFromAsync<From, To> = (to: To) => PromiseOrValue<From>;
25
+ export type ConverterToAsync<From, To> = {
26
+ to: ConvertToAsync<From, To>;
27
+ };
28
+ export type ConverterFromAsync<From, To> = {
29
+ from: ConvertFromAsync<From, To>;
30
+ };
31
+ /** ToFrom => (ToTo ... FromTo) => FromFrom */
32
+ export type ConverterAsync<ToFrom, ToTo, FromTo = ToTo, FromFrom = ToFrom> = ConverterToAsync<ToFrom, ToTo> & ConverterFromAsync<FromFrom, FromTo>;
33
+ export type ConvertWithDefaultToAsync<From, To> = (from: From, convertDefault: ConvertToAsync<From, To>) => PromiseOrValue<To>;
34
+ export type ConvertWithDefaultFromAsync<From, To> = (to: To, convertDefault: ConvertFromAsync<From, To>) => PromiseOrValue<From>;
35
+ export type ConverterWithDefaultToAsync<From, To> = {
36
+ to: ConvertWithDefaultToAsync<From, To>;
37
+ };
38
+ export type ConverterWithDefaultFromAsync<From, To> = {
39
+ from: ConvertWithDefaultFromAsync<From, To>;
40
+ };
41
+ export type ConverterWithDefaultAsync<ToFrom, ToTo, FromTo = ToTo, FromFrom = ToFrom> = ConverterWithDefaultToAsync<ToFrom, ToTo> & ConverterWithDefaultFromAsync<FromFrom, FromTo>;
@@ -0,0 +1,35 @@
1
+ /**
2
+ * The level of compression to use, ranging from 0-9.
3
+ *
4
+ * 0 will store the data without compression.
5
+ * 1 is fastest but compresses the worst, 9 is slowest but compresses the best.
6
+ * The default level is 6.
7
+ *
8
+ * Typically, binary data benefits much more from higher values than text data.
9
+ * In both cases, higher values usually take disproportionately longer than the reduction in final size that results.
10
+ *
11
+ * For example, a 1 MB text file could:
12
+ * - become 1.01 MB with level 0 in 1ms
13
+ * - become 400 kB with level 1 in 10ms
14
+ * - become 320 kB with level 9 in 100ms
15
+ */
16
+ export type CompressLevel = 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9;
17
+ export type CompressGzipOptions = {
18
+ level: CompressLevel;
19
+ };
20
+ /**
21
+ * The level of compression to use, ranging from 0-9.
22
+ *
23
+ * 0 will store the data without compression.
24
+ * 1 is fastest but compresses the worst, 9 is slowest but compresses the best.
25
+ * The default level is 6.
26
+ *
27
+ * Typically, binary data benefits much more from higher values than text data.
28
+ * In both cases, higher values usually take disproportionately longer than the reduction in final size that results.
29
+ *
30
+ * For example, a 1 MB text file could:
31
+ * - become 1.01 MB with level 0 in 1ms
32
+ * - become 400 kB with level 1 in 10ms
33
+ * - become 320 kB with level 9 in 100ms
34
+ */
35
+ export declare function compressGzip(buffer: Uint8Array, options: CompressGzipOptions): Promise<Uint8Array>;
@@ -0,0 +1,2 @@
1
+ export declare function isGzipCompressed(data: any): boolean;
2
+ export declare function decompressGzip(buffer: Uint8Array): Promise<Uint8Array>;
@@ -0,0 +1,2 @@
1
+ export * from './compressGzip';
2
+ export * from './decompressGzip';
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("../urlGet-CerQ1cKh.js");exports.CheckError=t.CheckError;exports.ConsoleMessageLevel=t.ConsoleMessageLevel;exports.Lazy=t.Lazy;exports.LazyWithId=t.LazyWithId;exports.LogLevel=t.LogLevel;exports.MAX_REPORT_ITEMS_DEFAULT=t.MAX_REPORT_ITEMS_DEFAULT;exports.MatchInternalError=t.MatchInternalError;exports.Matcher=t.Matcher;exports.MatcherAny=t.MatcherAny;exports.MatcherArray=t.MatcherArray;exports.MatcherArrayItem=t.MatcherArrayItem;exports.MatcherConvert=t.MatcherConvert;exports.MatcherCustom=t.MatcherCustom;exports.MatcherFew=t.MatcherFew;exports.MatcherIn=t.MatcherIn;exports.MatcherInstanceOf=t.MatcherInstanceOf;exports.MatcherIs=t.MatcherIs;exports.MatcherNever=t.MatcherNever;exports.MatcherNot=t.MatcherNot;exports.MatcherNumber=t.MatcherNumber;exports.MatcherObject=t.MatcherObject;exports.MatcherObjectEntry=t.MatcherObjectEntry;exports.MatcherRef=t.MatcherRef;exports.MatcherString=t.MatcherString;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.argsToString=t.argsToString;exports.check=t.check;exports.checkFunc=t.checkFunc;exports.consoleIntercept=t.consoleIntercept;exports.consoleMessageToString=t.consoleMessageToString;exports.consoleReplace=t.consoleReplace;exports.convertTimeZone=t.convertTimeZone;exports.createMatchResult=t.createMatchResult;exports.createMatchResultBoolean=t.createMatchResultBoolean;exports.createMatchResultError=t.createMatchResultError;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.expectedToString=t.expectedToString;exports.filterMatchResult=t.filterMatchResult;exports.filterMatchResultNested=t.filterMatchResultNested;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.getObjectId=t.getObjectId;exports.getRandomFunc=t.getRandomFunc;exports.getRandomSeed=t.getRandomSeed;exports.getStackTrace=t.getStackTrace;exports.isMatcher=t.isMatcher;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.matchResultNestedToString=t.matchResultNestedToString;exports.matchResultToString=t.matchResultToString;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.validateMatchResult=t.validateMatchResult;exports.waitObservable=t.waitObservable;exports.withConsoleReplace=t.withConsoleReplace;exports.withRetry=t.withRetry;exports.withTimeout=t.withTimeout;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("../urlGet-BukRa7Gq.js");exports.Cache=e.Cache;exports.CacheStats=e.CacheStats;exports.CheckError=e.CheckError;exports.ConsoleMessageLevel=e.ConsoleMessageLevel;exports.Lazy=e.Lazy;exports.LazyWithId=e.LazyWithId;exports.Locker=e.Locker;exports.LockerWithId=e.LockerWithId;exports.LogLevel=e.LogLevel;exports.MAX_REPORT_ITEMS_DEFAULT=e.MAX_REPORT_ITEMS_DEFAULT;exports.MatchInternalError=e.MatchInternalError;exports.Matcher=e.Matcher;exports.MatcherAny=e.MatcherAny;exports.MatcherArray=e.MatcherArray;exports.MatcherArrayItem=e.MatcherArrayItem;exports.MatcherConvert=e.MatcherConvert;exports.MatcherCustom=e.MatcherCustom;exports.MatcherFew=e.MatcherFew;exports.MatcherIn=e.MatcherIn;exports.MatcherInstanceOf=e.MatcherInstanceOf;exports.MatcherIs=e.MatcherIs;exports.MatcherNever=e.MatcherNever;exports.MatcherNot=e.MatcherNot;exports.MatcherNumber=e.MatcherNumber;exports.MatcherObject=e.MatcherObject;exports.MatcherObjectEntry=e.MatcherObjectEntry;exports.MatcherRef=e.MatcherRef;exports.MatcherString=e.MatcherString;exports.MemoryStorage=e.MemoryStorage;exports.Random=e.Random;exports.Subject=e.Subject;exports.SubjectWithId=e.SubjectWithId;exports.UNIQUE_PSEUDO_RANDOM_MAX_COUNT=e.UNIQUE_PSEUDO_RANDOM_MAX_COUNT;exports.alertConsole=e.alertConsole;exports.alertReplace=e.alertReplace;exports.argsToString=e.argsToString;exports.check=e.check;exports.checkFunc=e.checkFunc;exports.compressGzip=e.compressGzip;exports.consoleIntercept=e.consoleIntercept;exports.consoleMessageToString=e.consoleMessageToString;exports.consoleReplace=e.consoleReplace;exports.convertTimeZone=e.convertTimeZone;exports.converterErrorToBuffer=e.converterErrorToBuffer;exports.converterJson=e.converterJson;exports.converterJsonBuffer=e.converterJsonBuffer;exports.converterStringToBuffer=e.converterStringToBuffer;exports.createConverterBufferToGzip=e.createConverterBufferToGzip;exports.createConverterErrorToGzip=e.createConverterErrorToGzip;exports.createConverterJsonGzip=e.createConverterJsonGzip;exports.createMatchResult=e.createMatchResult;exports.createMatchResultBoolean=e.createMatchResultBoolean;exports.createMatchResultError=e.createMatchResultError;exports.createTaskDelayRetry=e.createTaskDelayRetry;exports.createUniquePseudoRandom=e.createUniquePseudoRandom;exports.dateNowUnique=e.dateNowUnique;exports.decompressGzip=e.decompressGzip;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.expectedToString=e.expectedToString;exports.filterMatchResult=e.filterMatchResult;exports.filterMatchResultNested=e.filterMatchResultNested;exports.fixStackTrace=e.fixStackTrace;exports.formatAny=e.formatAny;exports.formatDate=e.formatDate;exports.formatDateFileName=e.formatDateFileName;exports.getConsoleMessages=e.getConsoleMessages;exports.getDateInet=e.getDateInet;exports.getHashKey=e.getHashKey;exports.getJsonKey=e.getJsonKey;exports.getNormalizedObject=e.getNormalizedObject;exports.getObjectId=e.getObjectId;exports.getRandomFunc=e.getRandomFunc;exports.getRandomSeed=e.getRandomSeed;exports.getStackTrace=e.getStackTrace;exports.isGzipCompressed=e.isGzipCompressed;exports.isMatcher=e.isMatcher;exports.isObservable=e.isObservable;exports.mapObjectConverter=e.mapObjectConverter;exports.match=e.match;exports.matchAnd=e.matchAnd;exports.matchAndPipe=e.matchAndPipe;exports.matchAny=e.matchAny;exports.matchArray=e.matchArray;exports.matchArrayBuffer=e.matchArrayBuffer;exports.matchArrayIncludes=e.matchArrayIncludes;exports.matchArrayItem=e.matchArrayItem;exports.matchArrayLength=e.matchArrayLength;exports.matchArrayWith=e.matchArrayWith;exports.matchBoolean=e.matchBoolean;exports.matchConstructor=e.matchConstructor;exports.matchConvert=e.matchConvert;exports.matchCustom=e.matchCustom;exports.matchDeep=e.matchDeep;exports.matchEnum=e.matchEnum;exports.matchFloat=e.matchFloat;exports.matchIn=e.matchIn;exports.matchInstanceOf=e.matchInstanceOf;exports.matchInt=e.matchInt;exports.matchIntDate=e.matchIntDate;exports.matchIs=e.matchIs;exports.matchIsNonStrict=e.matchIsNonStrict;exports.matchNever=e.matchNever;exports.matchNot=e.matchNot;exports.matchNotNullish=e.matchNotNullish;exports.matchNullish=e.matchNullish;exports.matchNumber=e.matchNumber;exports.matchObject=e.matchObject;exports.matchObjectEntries=e.matchObjectEntries;exports.matchObjectEntry=e.matchObjectEntry;exports.matchObjectKey=e.matchObjectKey;exports.matchObjectKeyValue=e.matchObjectKeyValue;exports.matchObjectKeys=e.matchObjectKeys;exports.matchObjectKeysNotNull=e.matchObjectKeysNotNull;exports.matchObjectPartial=e.matchObjectPartial;exports.matchObjectValue=e.matchObjectValue;exports.matchObjectValues=e.matchObjectValues;exports.matchObjectWith=e.matchObjectWith;exports.matchOptional=e.matchOptional;exports.matchOr=e.matchOr;exports.matchOrPipe=e.matchOrPipe;exports.matchRange=e.matchRange;exports.matchRangeDate=e.matchRangeDate;exports.matchRef=e.matchRef;exports.matchResultNestedToString=e.matchResultNestedToString;exports.matchResultToString=e.matchResultToString;exports.matchString=e.matchString;exports.matchStringLength=e.matchStringLength;exports.matchTypeOf=e.matchTypeOf;exports.matchUuid=e.matchUuid;exports.matchValueState=e.matchValueState;exports.max=e.max;exports.min=e.min;exports.minMax=e.minMax;exports.numberMod=e.numberMod;exports.promiseAllWait=e.promiseAllWait;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.setArrayConverter=e.setArrayConverter;exports.setFuncName=e.setFuncName;exports.sha256=e.sha256;exports.sha256Buffer=e.sha256Buffer;exports.timeoutAbortController=e.timeoutAbortController;exports.toConvertFrom=e.toConvertFrom;exports.toConvertTo=e.toConvertTo;exports.toConvertWithDefaultFrom=e.toConvertWithDefaultFrom;exports.toConvertWithDefaultTo=e.toConvertWithDefaultTo;exports.toConverter=e.toConverter;exports.toConverterFrom=e.toConverterFrom;exports.toConverterTo=e.toConverterTo;exports.toConverterWithDefault=e.toConverterWithDefault;exports.toConverterWithDefaultFrom=e.toConverterWithDefaultFrom;exports.toConverterWithDefaultTo=e.toConverterWithDefaultTo;exports.toCorrect=e.toCorrect;exports.toCorrectWithDefault=e.toCorrectWithDefault;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.validateMatchResult=e.validateMatchResult;exports.waitObservable=e.waitObservable;exports.withConsoleReplace=e.withConsoleReplace;exports.withRetry=e.withRetry;exports.withTimeout=e.withTimeout;
@@ -1,4 +1,7 @@
1
+ export * from './cache';
2
+ export * from './converter';
1
3
  export * from './crypto';
4
+ export * from './gzip';
2
5
  export * from './number';
3
6
  export * from './random';
4
7
  export * from './time';
@@ -1,150 +1,182 @@
1
- import { ac as e, M as s, W as c, X as r, P as h, aj as m, a2 as n, a3 as o, b5 as l, b6 as b, b7 as u, b8 as i, b9 as M, ba as d, bb as g, bk as O, bc as I, bd as R, be as y, bf as N, bg as p, bh as A, bi as S, bj as j, R as T, $ as f, a0 as E, U as C, L, H as k, a6 as v, ad as D, ae as F, K as P, I as x, N as U, q as B, aa as _, a9 as q, a8 as w, Z as G, l as W, o as K, B as V, C as z, D as J, E as H, z as X, A as Q, a5 as Z, ag as Y, af as $, Q as aa, u as ta, v as ea, w as sa, J as ca, p as ra, F as ha, x as ma, d as na, g as oa, S as la, a4 as ba, _ as ua, ab as ia, aH as Ma, aJ as da, am as ga, ak as Oa, b4 as Ia, al as Ra, ap as ya, aL as Na, aO as pa, aD as Aa, aC as Sa, aq as ja, aZ as Ta, ax as fa, aY as Ea, av as Ca, aX as La, aA as ka, au as va, a_ as Da, as as Fa, ar as Pa, ao as xa, b1 as Ua, aF as Ba, aE as _a, at as qa, aw as wa, aR as Ga, aS as Wa, aT as Ka, aV as Va, aP as za, aW as Ja, ay as Ha, aU as Xa, aQ as Qa, aN as Za, aK as Ya, aG as $a, aI as at, a$ as tt, b0 as et, an as st, ah as ct, ai as rt, az as ht, aM as mt, aB as nt, b2 as ot, b3 as lt, b as bt, m as ut, c as it, n as Mt, f as dt, k as gt, r as Ot, h as It, e as Rt, i as yt, j as Nt, G as pt, a as At, s as St, T as jt, t as Tt, y as ft, bq as Et, bs as Ct, br as Lt, bl as kt, bp as vt, bm as Dt, bo as Ft, bn as Pt, a7 as xt, a1 as Ut, O as Bt, Y as _t, V as qt } from "../urlGet-DZEwtNXt.mjs";
1
+ import { C as t, b as s, aI as r, af as c, an as o, ao as n, ap as h, aq as m, ai as b, aP as l, ay as i, az as u, bB as M, bC as d, bD as C, bE as g, bF as f, bG as p, bH as v, bQ as y, bI as O, bJ as I, bK as T, bL as R, bM as S, bN as A, bO as N, bP as j, M as E, R as D, av as F, aw as L, U as W, ae as k, aa as B, aC as G, aJ as P, aK as z, B as x, ad as U, ab as J, ag as w, Y as K, u as _, o as q, q as V, p as H, r as X, v as Q, s as Y, aG as Z, aF as $, aE as aa, as as ea, V as ta, W as sa, E as ra, a4 as ca, a5 as oa, a6 as na, a7 as ha, Z as ma, _ as ba, aB as la, aM as ia, aL as ua, aj as Ma, $ as da, a0 as Ca, a1 as ga, ac as fa, X as pa, a as va, g as ya, a8 as Oa, a2 as Ia, K as Ta, J as Ra, ak as Sa, D as Aa, aA as Na, au as ja, w as Ea, aH as Da, bb as Fa, bd as La, aS as Wa, aQ as ka, bA as Ba, aR as Ga, aV as Pa, bf as za, bi as xa, b7 as Ua, b6 as Ja, aW as wa, bt as Ka, b1 as _a, bs as qa, a$ as Va, br as Ha, b4 as Xa, a_ as Qa, bu as Ya, aY as Za, aX as $a, aU as ae, bx as ee, b9 as te, b8 as se, aZ as re, b0 as ce, bl as oe, bm as ne, bn as he, bp as me, bj as be, bq as le, b2 as ie, bo as ue, bk as Me, bh as de, be as Ce, ba as ge, bc as fe, bv as pe, bw as ve, aT as ye, aN as Oe, aO as Ie, b3 as Te, bg as Re, b5 as Se, by as Ae, bz as Ne, G as je, F as Ee, H as De, I as Fe, at as Le, O as We, T as ke, L as Be, P as Ge, N as Pe, Q as ze, S as xe, x as Ue, a9 as Je, z as we, y as Ke, al as _e, k as qe, j as Ve, e as He, d as Xe, n as Qe, m as Ye, l as Ze, i as $e, h as at, f as et, c as tt, t as st, A as rt, a3 as ct, bW as ot, bY as nt, bX as ht, bR as mt, bV as bt, bS as lt, bU as it, bT as ut, aD as Mt, ax as dt, ah as Ct, ar as gt, am as ft } from "../urlGet-BtyqjC2r.mjs";
2
2
  export {
3
- e as CheckError,
4
- s as ConsoleMessageLevel,
5
- c as Lazy,
6
- r as LazyWithId,
7
- h as LogLevel,
8
- m as MAX_REPORT_ITEMS_DEFAULT,
9
- n as MatchInternalError,
10
- o as Matcher,
11
- l as MatcherAny,
12
- b as MatcherArray,
13
- u as MatcherArrayItem,
14
- i as MatcherConvert,
15
- M as MatcherCustom,
16
- d as MatcherFew,
17
- g as MatcherIn,
18
- O as MatcherInstanceOf,
19
- I as MatcherIs,
20
- R as MatcherNever,
21
- y as MatcherNot,
22
- N as MatcherNumber,
23
- p as MatcherObject,
3
+ t as Cache,
4
+ s as CacheStats,
5
+ r as CheckError,
6
+ c as ConsoleMessageLevel,
7
+ o as Lazy,
8
+ n as LazyWithId,
9
+ h as Locker,
10
+ m as LockerWithId,
11
+ b as LogLevel,
12
+ l as MAX_REPORT_ITEMS_DEFAULT,
13
+ i as MatchInternalError,
14
+ u as Matcher,
15
+ M as MatcherAny,
16
+ d as MatcherArray,
17
+ C as MatcherArrayItem,
18
+ g as MatcherConvert,
19
+ f as MatcherCustom,
20
+ p as MatcherFew,
21
+ v as MatcherIn,
22
+ y as MatcherInstanceOf,
23
+ O as MatcherIs,
24
+ I as MatcherNever,
25
+ T as MatcherNot,
26
+ R as MatcherNumber,
27
+ S as MatcherObject,
24
28
  A as MatcherObjectEntry,
25
- S as MatcherRef,
29
+ N as MatcherRef,
26
30
  j as MatcherString,
27
- T as Random,
28
- f as Subject,
29
- E as SubjectWithId,
30
- C as UNIQUE_PSEUDO_RANDOM_MAX_COUNT,
31
- L as alertConsole,
32
- k as alertReplace,
33
- v as argsToString,
34
- D as check,
35
- F as checkFunc,
36
- P as consoleIntercept,
37
- x as consoleMessageToString,
38
- U as consoleReplace,
39
- B as convertTimeZone,
40
- _ as createMatchResult,
41
- q as createMatchResultBoolean,
42
- w as createMatchResultError,
43
- G as createTaskDelayRetry,
44
- W as createUniquePseudoRandom,
45
- K as dateNowUnique,
46
- V as deepCloneJsonLike,
47
- z as deepEqualJsonLike,
48
- J as deepEqualJsonLikeMap,
49
- H as equalArray,
50
- X as escapeHtml,
51
- Q as escapeRegExp,
52
- Z as expectedToString,
53
- Y as filterMatchResult,
54
- $ as filterMatchResultNested,
55
- aa as fixStackTrace,
56
- ta as formatAny,
57
- ea as formatDate,
58
- sa as formatDateFileName,
59
- ca as getConsoleMessages,
60
- ra as getDateInet,
61
- ha as getNormalizedObject,
62
- ma as getObjectId,
63
- na as getRandomFunc,
64
- oa as getRandomSeed,
65
- la as getStackTrace,
66
- ba as isMatcher,
67
- ua as isObservable,
68
- ia as match,
69
- Ma as matchAnd,
70
- da as matchAndPipe,
71
- ga as matchAny,
72
- Oa as matchArray,
73
- Ia as matchArrayBuffer,
74
- Ra as matchArrayIncludes,
75
- ya as matchArrayItem,
76
- Na as matchArrayLength,
77
- pa as matchArrayWith,
78
- Aa as matchBoolean,
79
- Sa as matchConstructor,
80
- ja as matchConvert,
81
- Ta as matchCustom,
82
- fa as matchDeep,
83
- Ea as matchEnum,
84
- Ca as matchFloat,
85
- La as matchIn,
86
- ka as matchInstanceOf,
87
- va as matchInt,
88
- Da as matchIntDate,
89
- Fa as matchIs,
90
- Pa as matchIsNonStrict,
91
- xa as matchNever,
92
- Ua as matchNot,
93
- Ba as matchNotNullish,
94
- _a as matchNullish,
95
- qa as matchNumber,
96
- wa as matchObject,
97
- Ga as matchObjectEntries,
98
- Wa as matchObjectEntry,
99
- Ka as matchObjectKey,
100
- Va as matchObjectKeyValue,
101
- za as matchObjectKeys,
102
- Ja as matchObjectKeysNotNull,
103
- Ha as matchObjectPartial,
104
- Xa as matchObjectValue,
105
- Qa as matchObjectValues,
106
- Za as matchObjectWith,
107
- Ya as matchOptional,
108
- $a as matchOr,
109
- at as matchOrPipe,
110
- tt as matchRange,
111
- et as matchRangeDate,
112
- st as matchRef,
113
- ct as matchResultNestedToString,
114
- rt as matchResultToString,
115
- ht as matchString,
116
- mt as matchStringLength,
117
- nt as matchTypeOf,
118
- ot as matchUuid,
119
- lt as matchValueState,
120
- bt as max,
121
- ut as min,
122
- it as minMax,
123
- Mt as numberMod,
124
- dt as randomBoolean,
125
- gt as randomEnum,
126
- Ot as randomFloat,
127
- It as randomIndexWeighted,
128
- Rt as randomInt,
129
- yt as randomItem,
130
- Nt as randomItems,
131
- pt as setFuncName,
132
- At as sha256,
133
- St as sha256Buffer,
134
- jt as timeoutAbortController,
135
- Tt as toHex,
136
- ft as truncateString,
137
- Et as urlGetBoolean,
138
- Ct as urlGetFloat,
139
- Lt as urlGetInt,
140
- kt as urlGetParams,
141
- vt as urlGetString,
142
- Dt as urlParamToBoolean,
143
- Ft as urlParamToFloat,
144
- Pt as urlParamToInt,
145
- xt as validateMatchResult,
146
- Ut as waitObservable,
147
- Bt as withConsoleReplace,
148
- _t as withRetry,
149
- qt as withTimeout
31
+ E as MemoryStorage,
32
+ D as Random,
33
+ F as Subject,
34
+ L as SubjectWithId,
35
+ W as UNIQUE_PSEUDO_RANDOM_MAX_COUNT,
36
+ k as alertConsole,
37
+ B as alertReplace,
38
+ G as argsToString,
39
+ P as check,
40
+ z as checkFunc,
41
+ x as compressGzip,
42
+ U as consoleIntercept,
43
+ J as consoleMessageToString,
44
+ w as consoleReplace,
45
+ K as convertTimeZone,
46
+ _ as converterErrorToBuffer,
47
+ q as converterJson,
48
+ V as converterJsonBuffer,
49
+ H as converterStringToBuffer,
50
+ X as createConverterBufferToGzip,
51
+ Q as createConverterErrorToGzip,
52
+ Y as createConverterJsonGzip,
53
+ Z as createMatchResult,
54
+ $ as createMatchResultBoolean,
55
+ aa as createMatchResultError,
56
+ ea as createTaskDelayRetry,
57
+ ta as createUniquePseudoRandom,
58
+ sa as dateNowUnique,
59
+ ra as decompressGzip,
60
+ ca as deepCloneJsonLike,
61
+ oa as deepEqualJsonLike,
62
+ na as deepEqualJsonLikeMap,
63
+ ha as equalArray,
64
+ ma as escapeHtml,
65
+ ba as escapeRegExp,
66
+ la as expectedToString,
67
+ ia as filterMatchResult,
68
+ ua as filterMatchResultNested,
69
+ Ma as fixStackTrace,
70
+ da as formatAny,
71
+ Ca as formatDate,
72
+ ga as formatDateFileName,
73
+ fa as getConsoleMessages,
74
+ pa as getDateInet,
75
+ va as getHashKey,
76
+ ya as getJsonKey,
77
+ Oa as getNormalizedObject,
78
+ Ia as getObjectId,
79
+ Ta as getRandomFunc,
80
+ Ra as getRandomSeed,
81
+ Sa as getStackTrace,
82
+ Aa as isGzipCompressed,
83
+ Na as isMatcher,
84
+ ja as isObservable,
85
+ Ea as mapObjectConverter,
86
+ Da as match,
87
+ Fa as matchAnd,
88
+ La as matchAndPipe,
89
+ Wa as matchAny,
90
+ ka as matchArray,
91
+ Ba as matchArrayBuffer,
92
+ Ga as matchArrayIncludes,
93
+ Pa as matchArrayItem,
94
+ za as matchArrayLength,
95
+ xa as matchArrayWith,
96
+ Ua as matchBoolean,
97
+ Ja as matchConstructor,
98
+ wa as matchConvert,
99
+ Ka as matchCustom,
100
+ _a as matchDeep,
101
+ qa as matchEnum,
102
+ Va as matchFloat,
103
+ Ha as matchIn,
104
+ Xa as matchInstanceOf,
105
+ Qa as matchInt,
106
+ Ya as matchIntDate,
107
+ Za as matchIs,
108
+ $a as matchIsNonStrict,
109
+ ae as matchNever,
110
+ ee as matchNot,
111
+ te as matchNotNullish,
112
+ se as matchNullish,
113
+ re as matchNumber,
114
+ ce as matchObject,
115
+ oe as matchObjectEntries,
116
+ ne as matchObjectEntry,
117
+ he as matchObjectKey,
118
+ me as matchObjectKeyValue,
119
+ be as matchObjectKeys,
120
+ le as matchObjectKeysNotNull,
121
+ ie as matchObjectPartial,
122
+ ue as matchObjectValue,
123
+ Me as matchObjectValues,
124
+ de as matchObjectWith,
125
+ Ce as matchOptional,
126
+ ge as matchOr,
127
+ fe as matchOrPipe,
128
+ pe as matchRange,
129
+ ve as matchRangeDate,
130
+ ye as matchRef,
131
+ Oe as matchResultNestedToString,
132
+ Ie as matchResultToString,
133
+ Te as matchString,
134
+ Re as matchStringLength,
135
+ Se as matchTypeOf,
136
+ Ae as matchUuid,
137
+ Ne as matchValueState,
138
+ je as max,
139
+ Ee as min,
140
+ De as minMax,
141
+ Fe as numberMod,
142
+ Le as promiseAllWait,
143
+ We as randomBoolean,
144
+ ke as randomEnum,
145
+ Be as randomFloat,
146
+ Ge as randomIndexWeighted,
147
+ Pe as randomInt,
148
+ ze as randomItem,
149
+ xe as randomItems,
150
+ Ue as setArrayConverter,
151
+ Je as setFuncName,
152
+ we as sha256,
153
+ Ke as sha256Buffer,
154
+ _e as timeoutAbortController,
155
+ qe as toConvertFrom,
156
+ Ve as toConvertTo,
157
+ He as toConvertWithDefaultFrom,
158
+ Xe as toConvertWithDefaultTo,
159
+ Qe as toConverter,
160
+ Ye as toConverterFrom,
161
+ Ze as toConverterTo,
162
+ $e as toConverterWithDefault,
163
+ at as toConverterWithDefaultFrom,
164
+ et as toConverterWithDefaultTo,
165
+ tt as toCorrect,
166
+ st as toCorrectWithDefault,
167
+ rt as toHex,
168
+ ct as truncateString,
169
+ ot as urlGetBoolean,
170
+ nt as urlGetFloat,
171
+ ht as urlGetInt,
172
+ mt as urlGetParams,
173
+ bt as urlGetString,
174
+ lt as urlParamToBoolean,
175
+ it as urlParamToFloat,
176
+ ut as urlParamToInt,
177
+ Mt as validateMatchResult,
178
+ dt as waitObservable,
179
+ Ct as withConsoleReplace,
180
+ gt as withRetry,
181
+ ft as withTimeout
150
182
  };
@@ -1,2 +1,2 @@
1
- export * from './format';
2
1
  export * from './escape';
2
+ export * from './format';
@@ -0,0 +1,23 @@
1
+ import { IPool } from '@flemist/time-limits';
2
+ import { CacheStat, IStorageDb } from '../../common';
3
+ import { IFileStorage } from './FileStorage';
4
+ export type FileStatStorageOptions = {
5
+ storages: {
6
+ value: IFileStorage;
7
+ error: IFileStorage;
8
+ };
9
+ pool?: null | IPool;
10
+ };
11
+ export declare class FileStatStorage implements IStorageDb<string, CacheStat> {
12
+ private readonly _options;
13
+ private readonly _entries;
14
+ private _entriesLoaded;
15
+ constructor(options: FileStatStorageOptions);
16
+ set(key: string, value: CacheStat): Promise<void>;
17
+ get(key: string): Promise<CacheStat | undefined>;
18
+ delete(key: string): Promise<void>;
19
+ clear(): Promise<void>;
20
+ private _getKeys;
21
+ getEntries(): Promise<ReadonlyMap<string, CacheStat>>;
22
+ getKeys(): Promise<string[]>;
23
+ }
@@ -0,0 +1,29 @@
1
+ import { IPool } from '@flemist/time-limits';
2
+ import { IStorage } from '../../common/cache/types';
3
+ import { Converter } from '../../common';
4
+ export type FileStorageOptionsBase = {
5
+ dir: string;
6
+ converterSubPath: Converter<string, string, string, string | null>;
7
+ };
8
+ export type FileStorageOptions = FileStorageOptionsBase & {
9
+ /**
10
+ * Temp dir should be on the same device as dir to be meaningful.
11
+ * The temp dir can be shared between multiple cache instances
12
+ */
13
+ tmpDir: string;
14
+ getTempFileName?: null | ((key: string) => string);
15
+ pool?: null | IPool;
16
+ };
17
+ export type IFileStorage = IStorage<string, Uint8Array> & {
18
+ readonly options: FileStorageOptionsBase;
19
+ };
20
+ export declare class FileStorage implements IFileStorage {
21
+ private readonly _options;
22
+ constructor(options: FileStorageOptions);
23
+ get options(): FileStorageOptionsBase;
24
+ set(key: string, value: Uint8Array): Promise<void>;
25
+ get(key: string): Promise<Uint8Array | undefined>;
26
+ delete(key: string): Promise<void>;
27
+ clear(): Promise<void>;
28
+ getKeys(): Promise<string[]>;
29
+ }
@@ -0,0 +1,12 @@
1
+ import { Converter } from '../../common';
2
+ export type CacheConverterSubPathOptions = {
3
+ prefix?: null | string;
4
+ suffix?: null | string;
5
+ /**
6
+ * Split key by dirs as normalized path with "/"
7
+ * and without prepending and trailing slash.
8
+ * For 2 letters the key "abcdef" will be "a/b/cdef"
9
+ */
10
+ splitKeyLetters?: null | number;
11
+ };
12
+ export declare function createConverterSubPath(options: CacheConverterSubPathOptions): Converter<string, string, string, string | null>;
@@ -0,0 +1,17 @@
1
+ import { ConverterAsync, ConvertToAsync } from '../../common/converter';
2
+ import { CacheOptions } from '../../common/cache/Cache';
3
+ import { CacheStat, NumberRange } from '../../common';
4
+ import { CompressGzipOptions } from '../../common/gzip/compressGzip';
5
+ export declare function createFileCacheOptions<Input, Value>(options: {
6
+ dir: string;
7
+ /**
8
+ * Temp dir should be on the same device as dir to be meaningful.
9
+ * The temp dir can be shared between multiple cache instances
10
+ */
11
+ tmpDir: string;
12
+ totalSize?: null | NumberRange;
13
+ converterInput?: null | ConvertToAsync<Input, string>;
14
+ converterValue?: null | ConverterAsync<Value, Uint8Array>;
15
+ isExpired?: null | ((stat: CacheStat) => boolean);
16
+ compressOptions?: null | CompressGzipOptions;
17
+ }): CacheOptions<Input, Value, any, CacheStat, string, Uint8Array, Uint8Array, CacheStat>;
@@ -0,0 +1 @@
1
+ export declare function generateTempFileName(): string;
@@ -0,0 +1,6 @@
1
+ export * from './FileStorage';
2
+ export * from './createConverterSubPath';
3
+ export * from './createFileCacheOptions';
4
+ export * from './generateTempFileName';
5
+ export * from './writeFileThroughTmp';
6
+ export * from './FileStatStorage';
@@ -0,0 +1,2 @@
1
+ import { IPool } from '@flemist/time-limits';
2
+ export declare function writeFileThroughTmp(filePath: string, tmpPath: string, data: Uint8Array, pool?: null | IPool): Promise<void>;
@@ -3,3 +3,4 @@ export * from './pathNormalize';
3
3
  export * from './pools';
4
4
  export * from './walk';
5
5
  export * from './glob';
6
+ export * from './readDirRecursive';
@@ -0,0 +1,6 @@
1
+ import { IPool } from '@flemist/time-limits';
2
+ import { Dirent } from 'fs';
3
+ /**
4
+ * @return [normalized subPath, Dirent][]
5
+ */
6
+ export declare function readDirRecursive(dir: string, pool?: null | IPool): Promise<[string, Dirent][]>;