@kikiutils/shared 13.5.2 → 13.6.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.
- package/dist/classes/path.d.ts.map +1 -1
- package/dist/classes/precision-number.d.ts.map +1 -1
- package/dist/classes/ssh-client.d.ts.map +1 -1
- package/dist/clipboard.d.ts.map +1 -1
- package/dist/crypto-hash.d.ts +5 -5
- package/dist/crypto-hash.d.ts.map +1 -1
- package/dist/crypto-hash.js +15 -0
- package/dist/crypto-hash.js.map +1 -1
- package/dist/datetime.d.ts.map +1 -1
- package/dist/enum.d.ts.map +1 -1
- package/dist/event-awaiter.d.ts.map +1 -1
- package/dist/general.d.ts.map +1 -1
- package/dist/hash.js +13 -0
- package/dist/hash.js.map +1 -1
- package/dist/math.d.ts.map +1 -1
- package/dist/random.js +1 -2
- package/dist/random.js.map +1 -1
- package/dist/storage/enhanced/redis/keyed-store.d.ts.map +1 -1
- package/dist/time.d.ts +5 -0
- package/dist/time.d.ts.map +1 -0
- package/dist/time.js +14 -0
- package/dist/time.js.map +1 -0
- package/dist/types/filtered-key-path.d.ts +3 -3
- package/dist/types/filtered-key-path.d.ts.map +1 -1
- package/dist/types/index.d.ts.map +1 -1
- package/dist/vue.d.ts.map +1 -1
- package/dist/web.js +1 -2
- package/dist/web.js.map +1 -1
- package/package.json +21 -21
- package/src/time.ts +14 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"path.d.ts","names":[],"sources":["../../src/classes/path.ts"],"sourcesContent":[],"mappings":";;;;;;;;;KAyBY,wBAAA,UAAkC;KACzC,uDAAuD,WAAW,+BAA+B;AAD1F,KAEA,QAAA,GAAW,EAAA,CAAG,QAFU,GAEC,IAFD;AAAkB
|
|
1
|
+
{"version":3,"file":"path.d.ts","names":[],"sources":["../../src/classes/path.ts"],"sourcesContent":[],"mappings":";;;;;;;;;KAyBY,wBAAA,UAAkC;KACzC,uDAAuD,WAAW,+BAA+B;AAD1F,KAE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2BAA2B,GAAA,CAAI,YAAS;;;;YAOpD;;;;qBAOa,2BAA2B,GAAA,CAAI,aAAU;;;;sBASxC,OAAA,CAAQ,4BAAyB;;;;qBAAjC,OAAA,CAAQ,8BAAyB;;;;qBAAjC,OAAA,CAAQ,8BAAyB;;;;8BAiBnB,gBAAa,QAAA;;;;YAOzC;;;;iCAOyB,iBAAc"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"precision-number.d.ts","names":[],"sources":["../../src/classes/precision-number.ts"],"sourcesContent":[],"mappings":";;;KAEY,oBAAA,GAAuB,OAAA,CAAQ,QAAQ;;AAAnD,CAAA
|
|
1
|
+
{"version":3,"file":"precision-number.d.ts","names":[],"sources":["../../src/classes/precision-number.ts"],"sourcesContent":[],"mappings":";;;KAEY,oBAAA,GAAuB,OAAA,CAAQ,QAAQ;;AAAnD,CAAA;AAkBA;;;;;;;;;;;;;;;;AA4HuB,cA5HV,eAAA,CA4HU;EAAoB,CAAA,OAAA;EAYxB,WAAA,CAAA,KAAA,CAAA,EAjIJ,oBAiII,EAAA,aAAA,CAAA,EAAA,MAAA,EAAA,QAAA,CAAA,EA/HD,OAAA,CAAQ,QA+HP;EAAoB,CAnHlC,MAAA,CAAO,WAAA,EAmH2B,IAAA,EAAA,MAAA,CAAA,EAAA,MAAA,GAAA,MAAA;EAI1B,IAAA,KAAA,CAAA,CAAA,EAAA,MAAA;EAIK,OAAA,OAAA,CAAA,KAAA,EA1GH,oBA0GG,EAAA,aAAA,CAAA,EAAA,MAAA,EAAA,QAAA,CAAA,EAxGA,OAAA,CAAQ,QAwGR,CAAA,EAAA,MAAA;EAAoB,aAAA,CAAA,CAAA,EAAA,IAAA;EAQ6B,SAAQ,CAAA,KAAA,EArGtD,oBAqGsD,CAAA,EAAA,IAAA;EAIxD,MAAA,CAAA,KAAA,EApGD,oBAoGC,CAAA,EAAA,OAAA;EAAoB,EAAA,CAAA,KAAA,EAhGzB,oBAgGyB,CAAA,EAAA,OAAA;EAAA,GAAA,CAAA,KAAA,EA5FxB,oBA4FwB,CAAA,EAAA,OAAA;;;;;;;YAhEzB;aAIC;eAIE;;cAUD;eAKC;qBAKE;qBAII,uBAAoB;;iBAYxB,uBAAoB;eAI1B;gBAIK,uBAAoB;;6CAQ6B,OAAA,CAAQ;iBAIxD,uBAAoB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ssh-client.d.ts","names":[],"sources":["../../src/classes/ssh-client.ts"],"sourcesContent":[],"mappings":";;;;;;;cAkBM;;EAAA,SAAA,KAAA,EAAA,CAAA;EAYO,SAAA,KAAS,EAAA,CAAA;
|
|
1
|
+
{"version":3,"file":"ssh-client.d.ts","names":[],"sources":["../../src/classes/ssh-client.ts"],"sourcesContent":[],"mappings":";;;;;;;cAkBM;;EAAA,SAAA,KAAA,EAAA,CAAA;EAYO,SAAA,KAAS,EAAA,CAAA;EAM+E,SAAA,IAAA,EAAA,CAAA;EActF,SAAA,MAAA,EAAA,CAAA;EAIE,SAAA,MAAA,EAAA,CAAA,GAAA;EAoB0B,SAAA,KAAA,EAAA,CAAA;EAAqB,SAAA,OAAA,EAAA,GAAA;EAAA,SAAA,IAAA,EAAA,CAAA;CAIf;AAAqB,cAhDzD,SAAA,CAgDyD;EAAA,CAAA,OAAA;EAa/B,WAAA,CAAA,IAAA,EAAA,MAAA,EAAA,QAAA,EAAA,MAAA,EAAA,QAAA,EAAA,MAAA,EAAA,IAAA,CAAA,EAAA,MAAA,EAAA,aAAA,CAAA,EAvD8D,MAuD9D;EAA2B,IAAA,OAAA,CAAA,CAAA,EAzCnD,OAyCmD;EAAoB,OAAA,CAAA,CAAA,EArCrE,OAqCqE,CAAA,OAAA,CAAA;EAAyB,UAAA,CAAA,CAAA,EAAA,OAAA;EAAxE,WAAA,CAAA,OAAA,EAAA,MAAA,EAAA,OAAA,CAAA,EAjBI,qBAiBJ,CAAA,EAjByB,OAiBzB,CAAA,IAAA,GAjByB,SAAA,CAAA,sBAiBzB,CAA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AyB,QAAA,CAAA,KAAA,EAAA;IAe7B,KAAA,EAoCa,QApCb;IAAQ,MAAA,EAoCuB,QApCvB;EAYS,CAAA,EAAA,EAAA,OAAA,CAAA,EAwBsC,kBAxBtC,CAAA,EAwBwD,OAxBxD,CAAA,OAAA,CAAA;EAA2B,cAAA,CAAA,KAAA,EAAA,MAAA,OAuC3B,qCAvC2B,CAAA,EAAA,IAAA"}
|
package/dist/clipboard.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"clipboard.d.ts","names":[],"sources":["../src/clipboard.ts"],"sourcesContent":[],"mappings":";KAAK,UAAA;EAAA,KAAA,EAAA,OAAU;EAgCO,EAAA,EAAA,KAAA;
|
|
1
|
+
{"version":3,"file":"clipboard.d.ts","names":[],"sources":["../src/clipboard.ts"],"sourcesContent":[],"mappings":";KAAK,UAAA;EAAA,KAAA,EAAA,OAAU;EAgCO,EAAA,EAAA,KAAA;CAA0B,GAAA;EAAgB,EAAA,EAAA,IAAA;CAA+B;;;AA8C/F;;;;;;;;;;;;;;;;;;;;;;;;;;iBA9CsB,mBAAA,OAA0B,gBAAgB,uBAAuB,QAAQ;;;;;;;;;;;;;;;;;;;;;;;;;;;iBA8CzE,mBAAA,gBAAmC,QAAQ"}
|
package/dist/crypto-hash.d.ts
CHANGED
|
@@ -3,15 +3,15 @@ import { BinaryLike, BinaryToTextEncoding } from "node:crypto";
|
|
|
3
3
|
//#region src/crypto-hash.d.ts
|
|
4
4
|
|
|
5
5
|
declare function cryptoMd5(data: BinaryLike, outputEncoding?: BinaryToTextEncoding): string;
|
|
6
|
-
declare function cryptoMd5ToBuffer(data: BinaryLike):
|
|
6
|
+
declare function cryptoMd5ToBuffer(data: BinaryLike): NonSharedBuffer;
|
|
7
7
|
declare function cryptoSha3224(data: BinaryLike, outputEncoding?: BinaryToTextEncoding): string;
|
|
8
|
-
declare function cryptoSha3224ToBuffer(data: BinaryLike):
|
|
8
|
+
declare function cryptoSha3224ToBuffer(data: BinaryLike): NonSharedBuffer;
|
|
9
9
|
declare function cryptoSha3256(data: BinaryLike, outputEncoding?: BinaryToTextEncoding): string;
|
|
10
|
-
declare function cryptoSha3256ToBuffer(data: BinaryLike):
|
|
10
|
+
declare function cryptoSha3256ToBuffer(data: BinaryLike): NonSharedBuffer;
|
|
11
11
|
declare function cryptoSha3384(data: BinaryLike, outputEncoding?: BinaryToTextEncoding): string;
|
|
12
|
-
declare function cryptoSha3384ToBuffer(data: BinaryLike):
|
|
12
|
+
declare function cryptoSha3384ToBuffer(data: BinaryLike): NonSharedBuffer;
|
|
13
13
|
declare function cryptoSha3512(data: BinaryLike, outputEncoding?: BinaryToTextEncoding): string;
|
|
14
|
-
declare function cryptoSha3512ToBuffer(data: BinaryLike):
|
|
14
|
+
declare function cryptoSha3512ToBuffer(data: BinaryLike): NonSharedBuffer;
|
|
15
15
|
//#endregion
|
|
16
16
|
export { cryptoMd5, cryptoMd5ToBuffer, cryptoSha3224, cryptoSha3224ToBuffer, cryptoSha3256, cryptoSha3256ToBuffer, cryptoSha3384, cryptoSha3384ToBuffer, cryptoSha3512, cryptoSha3512ToBuffer };
|
|
17
17
|
//# sourceMappingURL=crypto-hash.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"crypto-hash.d.ts","names":[],"sources":["../src/crypto-hash.ts"],"sourcesContent":[],"mappings":";;;;
|
|
1
|
+
{"version":3,"file":"crypto-hash.d.ts","names":[],"sources":["../src/crypto-hash.ts"],"sourcesContent":[],"mappings":";;;;iBAsBgB,SAAA,OAAgB,6BAA4B;iBAI5C,iBAAA,OAAwB,aAAU;iBAIlC,aAAA,OAAoB,6BAA4B;iBAIhD,qBAAA,OAA4B,aAAU;iBAItC,aAAA,OAAoB,6BAA4B;iBAIhD,qBAAA,OAA4B,aAAU;iBAItC,aAAA,OAAoB,6BAA4B;iBAIhD,qBAAA,OAA4B,aAAU;iBAItC,aAAA,OAAoB,6BAA4B;iBAIhD,qBAAA,OAA4B,aAAU"}
|
package/dist/crypto-hash.js
CHANGED
|
@@ -1,6 +1,21 @@
|
|
|
1
1
|
import { createHash } from "node:crypto";
|
|
2
2
|
|
|
3
3
|
//#region src/crypto-hash.ts
|
|
4
|
+
/**
|
|
5
|
+
* This file provides a set of functions for creating hash digests using different algorithms and bit lengths.
|
|
6
|
+
* It includes functions for generating SHA-3 hash digests with bit lengths of 224, 256, 384, and 512,
|
|
7
|
+
* as well as a function for generating MD5 hash digests.
|
|
8
|
+
*
|
|
9
|
+
* These functions use the Node.js crypto module to generate the hashes.
|
|
10
|
+
* Can only be used in Node.js/Deno/Bun runtimes.
|
|
11
|
+
*
|
|
12
|
+
* @example
|
|
13
|
+
* ```typescript
|
|
14
|
+
* import { cryptoSha3256 } from '@kikiutils/shared/crypto-hash';
|
|
15
|
+
*
|
|
16
|
+
* console.log(cryptoSha3256('test')); // 36f028580bb02cc8272a9a020f4200e346e276ae664e45ee80745574e2f5ab80
|
|
17
|
+
* ```
|
|
18
|
+
*/
|
|
4
19
|
function cryptoMd5(data, outputEncoding = "hex") {
|
|
5
20
|
return createHash("md5").update(data).digest(outputEncoding);
|
|
6
21
|
}
|
package/dist/crypto-hash.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"crypto-hash.js","names":[],"sources":["../src/crypto-hash.ts"],"sourcesContent":["/**\n * This file provides a set of functions for creating hash digests using different algorithms and bit lengths.\n * It includes functions for generating SHA-3 hash digests with bit lengths of 224, 256, 384, and 512,\n * as well as a function for generating MD5 hash digests.\n *\n * These functions use the Node.js crypto module to generate the hashes.\n * Can only be used in Node.js/Deno/Bun runtimes.\n *\n * @example\n * ```typescript\n * import { cryptoSha3256 } from '@kikiutils/shared/crypto-hash';\n *\n * console.log(cryptoSha3256('test')); // 36f028580bb02cc8272a9a020f4200e346e276ae664e45ee80745574e2f5ab80\n * ```\n */\n\nimport { createHash } from 'node:crypto';\nimport type {\n BinaryLike,\n BinaryToTextEncoding,\n} from 'node:crypto';\n\nexport function cryptoMd5(data: BinaryLike, outputEncoding: BinaryToTextEncoding = 'hex') {\n return createHash('md5').update(data).digest(outputEncoding);\n}\n\nexport function cryptoMd5ToBuffer(data: BinaryLike) {\n return createHash('md5').update(data).digest();\n}\n\nexport function cryptoSha3224(data: BinaryLike, outputEncoding: BinaryToTextEncoding = 'hex') {\n return createHash('sha3-224').update(data).digest(outputEncoding);\n}\n\nexport function cryptoSha3224ToBuffer(data: BinaryLike) {\n return createHash('sha3-224').update(data).digest();\n}\n\nexport function cryptoSha3256(data: BinaryLike, outputEncoding: BinaryToTextEncoding = 'hex') {\n return createHash('sha3-256').update(data).digest(outputEncoding);\n}\n\nexport function cryptoSha3256ToBuffer(data: BinaryLike) {\n return createHash('sha3-256').update(data).digest();\n}\n\nexport function cryptoSha3384(data: BinaryLike, outputEncoding: BinaryToTextEncoding = 'hex') {\n return createHash('sha3-384').update(data).digest(outputEncoding);\n}\n\nexport function cryptoSha3384ToBuffer(data: BinaryLike) {\n return createHash('sha3-384').update(data).digest();\n}\n\nexport function cryptoSha3512(data: BinaryLike, outputEncoding: BinaryToTextEncoding = 'hex') {\n return createHash('sha3-512').update(data).digest(outputEncoding);\n}\n\nexport function cryptoSha3512ToBuffer(data: BinaryLike) {\n return createHash('sha3-512').update(data).digest();\n}\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"crypto-hash.js","names":[],"sources":["../src/crypto-hash.ts"],"sourcesContent":["/**\n * This file provides a set of functions for creating hash digests using different algorithms and bit lengths.\n * It includes functions for generating SHA-3 hash digests with bit lengths of 224, 256, 384, and 512,\n * as well as a function for generating MD5 hash digests.\n *\n * These functions use the Node.js crypto module to generate the hashes.\n * Can only be used in Node.js/Deno/Bun runtimes.\n *\n * @example\n * ```typescript\n * import { cryptoSha3256 } from '@kikiutils/shared/crypto-hash';\n *\n * console.log(cryptoSha3256('test')); // 36f028580bb02cc8272a9a020f4200e346e276ae664e45ee80745574e2f5ab80\n * ```\n */\n\nimport { createHash } from 'node:crypto';\nimport type {\n BinaryLike,\n BinaryToTextEncoding,\n} from 'node:crypto';\n\nexport function cryptoMd5(data: BinaryLike, outputEncoding: BinaryToTextEncoding = 'hex') {\n return createHash('md5').update(data).digest(outputEncoding);\n}\n\nexport function cryptoMd5ToBuffer(data: BinaryLike) {\n return createHash('md5').update(data).digest();\n}\n\nexport function cryptoSha3224(data: BinaryLike, outputEncoding: BinaryToTextEncoding = 'hex') {\n return createHash('sha3-224').update(data).digest(outputEncoding);\n}\n\nexport function cryptoSha3224ToBuffer(data: BinaryLike) {\n return createHash('sha3-224').update(data).digest();\n}\n\nexport function cryptoSha3256(data: BinaryLike, outputEncoding: BinaryToTextEncoding = 'hex') {\n return createHash('sha3-256').update(data).digest(outputEncoding);\n}\n\nexport function cryptoSha3256ToBuffer(data: BinaryLike) {\n return createHash('sha3-256').update(data).digest();\n}\n\nexport function cryptoSha3384(data: BinaryLike, outputEncoding: BinaryToTextEncoding = 'hex') {\n return createHash('sha3-384').update(data).digest(outputEncoding);\n}\n\nexport function cryptoSha3384ToBuffer(data: BinaryLike) {\n return createHash('sha3-384').update(data).digest();\n}\n\nexport function cryptoSha3512(data: BinaryLike, outputEncoding: BinaryToTextEncoding = 'hex') {\n return createHash('sha3-512').update(data).digest(outputEncoding);\n}\n\nexport function cryptoSha3512ToBuffer(data: BinaryLike) {\n return createHash('sha3-512').update(data).digest();\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAsBA,SAAgB,UAAU,MAAkB,iBAAuC,OAAO;AACtF,QAAO,WAAW,MAAM,CAAC,OAAO,KAAK,CAAC,OAAO,eAAe;;AAGhE,SAAgB,kBAAkB,MAAkB;AAChD,QAAO,WAAW,MAAM,CAAC,OAAO,KAAK,CAAC,QAAQ;;AAGlD,SAAgB,cAAc,MAAkB,iBAAuC,OAAO;AAC1F,QAAO,WAAW,WAAW,CAAC,OAAO,KAAK,CAAC,OAAO,eAAe;;AAGrE,SAAgB,sBAAsB,MAAkB;AACpD,QAAO,WAAW,WAAW,CAAC,OAAO,KAAK,CAAC,QAAQ;;AAGvD,SAAgB,cAAc,MAAkB,iBAAuC,OAAO;AAC1F,QAAO,WAAW,WAAW,CAAC,OAAO,KAAK,CAAC,OAAO,eAAe;;AAGrE,SAAgB,sBAAsB,MAAkB;AACpD,QAAO,WAAW,WAAW,CAAC,OAAO,KAAK,CAAC,QAAQ;;AAGvD,SAAgB,cAAc,MAAkB,iBAAuC,OAAO;AAC1F,QAAO,WAAW,WAAW,CAAC,OAAO,KAAK,CAAC,OAAO,eAAe;;AAGrE,SAAgB,sBAAsB,MAAkB;AACpD,QAAO,WAAW,WAAW,CAAC,OAAO,KAAK,CAAC,QAAQ;;AAGvD,SAAgB,cAAc,MAAkB,iBAAuC,OAAO;AAC1F,QAAO,WAAW,WAAW,CAAC,OAAO,KAAK,CAAC,OAAO,eAAe;;AAGrE,SAAgB,sBAAsB,MAAkB;AACpD,QAAO,WAAW,WAAW,CAAC,OAAO,KAAK,CAAC,QAAQ"}
|
package/dist/datetime.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"datetime.d.ts","names":[],"sources":["../src/datetime.ts"],"sourcesContent":[],"mappings":";;;KAkBY,aAAA;;AAAZ;AA6BA
|
|
1
|
+
{"version":3,"file":"datetime.d.ts","names":[],"sources":["../src/datetime.ts"],"sourcesContent":[],"mappings":";;;KAkBY,aAAA;;AAAZ;AA6BA;;;;;AA+BA;;;;;;;AAyEA;;;;;;;;;;;;;iBAxGgB,UAAA,OAAiB,QAAQ,uCAA8D;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBA+BvF,oBAAA,OACN,YACA;;iBAGa;;;;;;;;;;;;;;;;;;;;;iBAoEP,wBAAA,uBAA+C"}
|
package/dist/enum.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"enum.d.ts","names":[],"sources":["../src/enum.ts"],"sourcesContent":[],"mappings":";;AAuBA
|
|
1
|
+
{"version":3,"file":"enum.d.ts","names":[],"sources":["../src/enum.ts"],"sourcesContent":[],"mappings":";;AAuBA;;;;;;;AA2BA;;;;;;;AAkDA;;;;;;;;iBA7EgB,8BAA8B,iCAAiC,IAAI,QAAQ,QAAQ;;;;;;;;;;;;;;;;;;;;;;;;iBA2BnF,8BAA8B,iCAAiC,IAAI,QAAQ,QAAQ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAkDnF,wBAAwB,iCAAiC,KAAK,QAAQ"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"event-awaiter.d.ts","names":[],"sources":["../src/event-awaiter.ts"],"sourcesContent":[],"mappings":";;AAYA;;;;;;;;;;;AAiIoE,cAjIvD,YAiIuD,CAAA,CAAA,CAAA,CAAA;
|
|
1
|
+
{"version":3,"file":"event-awaiter.d.ts","names":[],"sources":["../src/event-awaiter.ts"],"sourcesContent":[],"mappings":";;AAYA;;;;;;;;;;;AAiIoE,cAjIvD,YAiIuD,CAAA,CAAA,CAAA,CAAA;EAAA,CAAA,OAAA;;;;;;;;;8BAtHpC;;;;;;;;;;qBAiBV;;;;;;;;;;;;;;;;;;;;;;;;+EA4B2D,cAAW,QAAA;;;;;;;;;;;0DA2DhC,cAAW,QAAA;;;;;;;;;;;uDAcd,cAAW,QAAA"}
|
package/dist/general.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"general.d.ts","names":[],"sources":["../src/general.ts"],"sourcesContent":[],"mappings":";;AA2BA
|
|
1
|
+
{"version":3,"file":"general.d.ts","names":[],"sources":["../src/general.ts"],"sourcesContent":[],"mappings":";;AA2BA;;;;;AACA;;;;;;;;;;;;;;;;;;;iBADgB,4BAA4B,IAAI,MAAM;iBACtC,+BAA+B,IAAI,mBAAmB,IAAI,IAAI,YAAY"}
|
package/dist/hash.js
CHANGED
|
@@ -2,6 +2,19 @@ import { sha3_224, sha3_256, sha3_384, sha3_512 } from "@noble/hashes/sha3.js";
|
|
|
2
2
|
import { bytesToHex, utf8ToBytes } from "@noble/hashes/utils.js";
|
|
3
3
|
|
|
4
4
|
//#region src/hash.ts
|
|
5
|
+
/**
|
|
6
|
+
* This file provides a set of functions for creating SHA-3 hash digests
|
|
7
|
+
* using different bit lengths (224, 256, 384, 512).
|
|
8
|
+
* These functions use the [@noble/hashes](https://github.com/paulmillr/noble-hashes) library to generate the hashes.
|
|
9
|
+
* Can be used in the browser, mainly for Nuxt/Vue and other frameworks compiled and executed in the browser.
|
|
10
|
+
*
|
|
11
|
+
* @example
|
|
12
|
+
* ```typescript
|
|
13
|
+
* import { sha3256 } from '@kikiutils/shared/hash';
|
|
14
|
+
*
|
|
15
|
+
* console.log(sha3256('test')); // 36f028580bb02cc8272a9a020f4200e346e276ae664e45ee80745574e2f5ab80
|
|
16
|
+
* ```
|
|
17
|
+
*/
|
|
5
18
|
function sha3224(data) {
|
|
6
19
|
return bytesToHex(sha3_224(typeof data === "string" ? utf8ToBytes(data) : data));
|
|
7
20
|
}
|
package/dist/hash.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"hash.js","names":[],"sources":["../src/hash.ts"],"sourcesContent":["/**\n * This file provides a set of functions for creating SHA-3 hash digests\n * using different bit lengths (224, 256, 384, 512).\n * These functions use the [@noble/hashes](https://github.com/paulmillr/noble-hashes) library to generate the hashes.\n * Can be used in the browser, mainly for Nuxt/Vue and other frameworks compiled and executed in the browser.\n *\n * @example\n * ```typescript\n * import { sha3256 } from '@kikiutils/shared/hash';\n *\n * console.log(sha3256('test')); // 36f028580bb02cc8272a9a020f4200e346e276ae664e45ee80745574e2f5ab80\n * ```\n */\n\nimport {\n sha3_224,\n sha3_256,\n sha3_384,\n sha3_512,\n} from '@noble/hashes/sha3.js';\nimport {\n bytesToHex,\n utf8ToBytes,\n} from '@noble/hashes/utils.js';\n\nexport function sha3224(data: string | Uint8Array) {\n return bytesToHex(sha3_224(typeof data === 'string' ? utf8ToBytes(data) : data));\n}\n\nexport function sha3256(data: string | Uint8Array) {\n return bytesToHex(sha3_256(typeof data === 'string' ? utf8ToBytes(data) : data));\n}\n\nexport function sha3384(data: string | Uint8Array) {\n return bytesToHex(sha3_384(typeof data === 'string' ? utf8ToBytes(data) : data));\n}\n\nexport function sha3512(data: string | Uint8Array) {\n return bytesToHex(sha3_512(typeof data === 'string' ? utf8ToBytes(data) : data));\n}\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"hash.js","names":[],"sources":["../src/hash.ts"],"sourcesContent":["/**\n * This file provides a set of functions for creating SHA-3 hash digests\n * using different bit lengths (224, 256, 384, 512).\n * These functions use the [@noble/hashes](https://github.com/paulmillr/noble-hashes) library to generate the hashes.\n * Can be used in the browser, mainly for Nuxt/Vue and other frameworks compiled and executed in the browser.\n *\n * @example\n * ```typescript\n * import { sha3256 } from '@kikiutils/shared/hash';\n *\n * console.log(sha3256('test')); // 36f028580bb02cc8272a9a020f4200e346e276ae664e45ee80745574e2f5ab80\n * ```\n */\n\nimport {\n sha3_224,\n sha3_256,\n sha3_384,\n sha3_512,\n} from '@noble/hashes/sha3.js';\nimport {\n bytesToHex,\n utf8ToBytes,\n} from '@noble/hashes/utils.js';\n\nexport function sha3224(data: string | Uint8Array) {\n return bytesToHex(sha3_224(typeof data === 'string' ? utf8ToBytes(data) : data));\n}\n\nexport function sha3256(data: string | Uint8Array) {\n return bytesToHex(sha3_256(typeof data === 'string' ? utf8ToBytes(data) : data));\n}\n\nexport function sha3384(data: string | Uint8Array) {\n return bytesToHex(sha3_384(typeof data === 'string' ? utf8ToBytes(data) : data));\n}\n\nexport function sha3512(data: string | Uint8Array) {\n return bytesToHex(sha3_512(typeof data === 'string' ? utf8ToBytes(data) : data));\n}\n"],"mappings":";;;;;;;;;;;;;;;;;AAyBA,SAAgB,QAAQ,MAA2B;AAC/C,QAAO,WAAW,SAAS,OAAO,SAAS,WAAW,YAAY,KAAK,GAAG,KAAK,CAAC;;AAGpF,SAAgB,QAAQ,MAA2B;AAC/C,QAAO,WAAW,SAAS,OAAO,SAAS,WAAW,YAAY,KAAK,GAAG,KAAK,CAAC;;AAGpF,SAAgB,QAAQ,MAA2B;AAC/C,QAAO,WAAW,SAAS,OAAO,SAAS,WAAW,YAAY,KAAK,GAAG,KAAK,CAAC;;AAGpF,SAAgB,QAAQ,MAA2B;AAC/C,QAAO,WAAW,SAAS,OAAO,SAAS,WAAW,YAAY,KAAK,GAAG,KAAK,CAAC"}
|
package/dist/math.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"math.d.ts","names":[],"sources":["../src/math.ts"],"sourcesContent":[],"mappings":";;;KAEK,eAAA,GAAkB,OAAA,CAAQ;;AAFM,CAAA;AAOrC;AAsCA;;
|
|
1
|
+
{"version":3,"file":"math.d.ts","names":[],"sources":["../src/math.ts"],"sourcesContent":[],"mappings":";;;KAEK,eAAA,GAAkB,OAAA,CAAQ;;AAFM,CAAA;AAOrC;AAsCA;;AAEiB,UAxCA,yBAAA,CAwCA;EACH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAHE,kBAAA,YACD,8BACE,2BACH"}
|
package/dist/random.js
CHANGED
|
@@ -22,8 +22,7 @@
|
|
|
22
22
|
function generateWithNestedRandomLength(generator, minMin, minMax, maxMin, maxMax) {
|
|
23
23
|
const random = (min, max) => Math.floor(Math.random() * (max - min + 1)) + min;
|
|
24
24
|
const innerMin = random(minMin, minMax);
|
|
25
|
-
|
|
26
|
-
return generator(finalLength);
|
|
25
|
+
return generator(random(Math.max(innerMin, maxMin), maxMax));
|
|
27
26
|
}
|
|
28
27
|
|
|
29
28
|
//#endregion
|
package/dist/random.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"random.js","names":[],"sources":["../src/random.ts"],"sourcesContent":["/**\n * Generates a value using a provided generator function, where the input length\n * is determined by two levels of nested random ranges:\n *\n * 1. First, a random number (`innerMin`) is chosen between `minMin` and `minMax`.\n * 2. Then, a final length is chosen between `Math.max(innerMin, maxMin)` and `maxMax`.\n * 3. The generator is called with the final length and its result is returned.\n *\n * This function supports any return type by using a generic type parameter.\n *\n * @template T - The return type of the generator function\n *\n * @param {(length: number) => T} generator - A function that accepts a length and returns a value of type T\n * @param {number} minMin - Lower bound of the first random range\n * @param {number} minMax - Upper bound of the first random range\n * @param {number} maxMin - Lower bound of the second random range\n * @param {number} maxMax - Upper bound of the second random range\n *\n * @returns {T} The result of the generator function using the computed final length\n */\nexport function generateWithNestedRandomLength<T = string>(\n generator: (length: number) => T,\n minMin: number,\n minMax: number,\n maxMin: number,\n maxMax: number,\n) {\n const random = (min: number, max: number) => Math.floor(Math.random() * (max - min + 1)) + min;\n const innerMin = random(minMin, minMax);\n const finalLength = random(Math.max(innerMin, maxMin), maxMax);\n return generator(finalLength);\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAoBA,SAAgB,+BACZ,WACA,QACA,QACA,QACA,QACF;CACE,MAAM,UAAU,KAAa,QAAgB,KAAK,MAAM,KAAK,QAAQ,IAAI,MAAM,MAAM,GAAG,GAAG;CAC3F,MAAM,WAAW,OAAO,QAAQ,OAAO;
|
|
1
|
+
{"version":3,"file":"random.js","names":[],"sources":["../src/random.ts"],"sourcesContent":["/**\n * Generates a value using a provided generator function, where the input length\n * is determined by two levels of nested random ranges:\n *\n * 1. First, a random number (`innerMin`) is chosen between `minMin` and `minMax`.\n * 2. Then, a final length is chosen between `Math.max(innerMin, maxMin)` and `maxMax`.\n * 3. The generator is called with the final length and its result is returned.\n *\n * This function supports any return type by using a generic type parameter.\n *\n * @template T - The return type of the generator function\n *\n * @param {(length: number) => T} generator - A function that accepts a length and returns a value of type T\n * @param {number} minMin - Lower bound of the first random range\n * @param {number} minMax - Upper bound of the first random range\n * @param {number} maxMin - Lower bound of the second random range\n * @param {number} maxMax - Upper bound of the second random range\n *\n * @returns {T} The result of the generator function using the computed final length\n */\nexport function generateWithNestedRandomLength<T = string>(\n generator: (length: number) => T,\n minMin: number,\n minMax: number,\n maxMin: number,\n maxMax: number,\n) {\n const random = (min: number, max: number) => Math.floor(Math.random() * (max - min + 1)) + min;\n const innerMin = random(minMin, minMax);\n const finalLength = random(Math.max(innerMin, maxMin), maxMax);\n return generator(finalLength);\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAoBA,SAAgB,+BACZ,WACA,QACA,QACA,QACA,QACF;CACE,MAAM,UAAU,KAAa,QAAgB,KAAK,MAAM,KAAK,QAAQ,IAAI,MAAM,MAAM,GAAG,GAAG;CAC3F,MAAM,WAAW,OAAO,QAAQ,OAAO;AAEvC,QAAO,UADa,OAAO,KAAK,IAAI,UAAU,OAAO,EAAE,OAAO,CACjC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"keyed-store.d.ts","names":[],"sources":["../../../../src/storage/enhanced/redis/keyed-store.ts"],"sourcesContent":[],"mappings":";;;;;;AAyBA;;;;;;;;;;;;;;;;;;;;;AACmE,iBADnD,6BACmD,CAAA,IAAA,OAAA,CAAA,CAAA,OAAA,EADC,UACD,CAAA,OADmB,0BACnB,CAAA,CAAA,EAAA,CAAA,UAAA,GAAA,EAAA,CAAA,CAAA,cAAA,EAAA,CAAA,GAAA,IAAA,EAAZ,CAAY,EAAA,GAAA,MAAA,EAAA,GAAA,QAAA,CAAA;
|
|
1
|
+
{"version":3,"file":"keyed-store.d.ts","names":[],"sources":["../../../../src/storage/enhanced/redis/keyed-store.ts"],"sourcesContent":[],"mappings":";;;;;;AAyBA;;;;;;;;;;;;;;;;;;;;;AACmE,iBADnD,6BACmD,CAAA,IAAA,OAAA,CAAA,CAAA,OAAA,EADC,UACD,CAAA,OADmB,0BACnB,CAAA,CAAA,EAAA,CAAA,UAAA,GAAA,EAAA,CAAA,CAAA,cAAA,EAAA,CAAA,GAAA,IAAA,EAAZ,CAAY,EAAA,GAAA,MAAA,EAAA,GAAA,QAAA,CAAA;qBACxC,MAAC,QAAA;wBACE,MAAC;qBACJ,MAAC;wBACE,MAAC;;;;;;wBAMD;mBACL,YAAY,MAAC;yCACS,YAAY,IAAC"}
|
package/dist/time.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"time.d.ts","names":[],"sources":["../src/time.ts"],"sourcesContent":[],"mappings":";iBAAgB,cAAA,sBAAoC,cAAW"}
|
package/dist/time.js
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
//#region src/time.ts
|
|
2
|
+
function abortableDelay(ms, signal) {
|
|
3
|
+
return new Promise((resolve) => {
|
|
4
|
+
const timeout = setTimeout(resolve, ms);
|
|
5
|
+
if (signal) signal.addEventListener("abort", () => {
|
|
6
|
+
clearTimeout(timeout);
|
|
7
|
+
resolve(void 0);
|
|
8
|
+
});
|
|
9
|
+
});
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
//#endregion
|
|
13
|
+
export { abortableDelay };
|
|
14
|
+
//# sourceMappingURL=time.js.map
|
package/dist/time.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"time.js","names":[],"sources":["../src/time.ts"],"sourcesContent":["export function abortableDelay(ms: number, signal?: AbortSignal) {\n return new Promise((resolve) => {\n const timeout = setTimeout(resolve, ms);\n if (signal) {\n signal.addEventListener(\n 'abort',\n () => {\n clearTimeout(timeout);\n resolve(undefined);\n },\n );\n }\n });\n}\n"],"mappings":";AAAA,SAAgB,eAAe,IAAY,QAAsB;AAC7D,QAAO,IAAI,SAAS,YAAY;EAC5B,MAAM,UAAU,WAAW,SAAS,GAAG;AACvC,MAAI,OACA,QAAO,iBACH,eACM;AACF,gBAAa,QAAQ;AACrB,WAAQ,OAAU;IAEzB;GAEP"}
|
|
@@ -10,8 +10,8 @@ import { ObjectId } from "bson";
|
|
|
10
10
|
* Original types might have been modified to suit this project’s needs.
|
|
11
11
|
*/
|
|
12
12
|
/***/
|
|
13
|
-
type ConditionalPath<K extends number | string, V, U> = V extends U ? `${K}` : DefaultPath<K, V, U, never>;
|
|
14
|
-
type DefaultPath<K extends number | string, V, U = never, RK = `${K}`> = V extends TerminalType ? RK : `${K}.${FilteredKeyPath<V, U>}`;
|
|
13
|
+
type ConditionalPath<K$1 extends number | string, V$1, U> = V$1 extends U ? `${K$1}` : DefaultPath<K$1, V$1, U, never>;
|
|
14
|
+
type DefaultPath<K$1 extends number | string, V$1, U = never, RK = `${K$1}`> = V$1 extends TerminalType ? RK : `${K$1}.${FilteredKeyPath<V$1, U>}`;
|
|
15
15
|
/**
|
|
16
16
|
* A utility type that generates a union of key paths from a given object type `T`,
|
|
17
17
|
* filtered by a specific type `U`. If `U` is
|
|
@@ -22,7 +22,7 @@ type DefaultPath<K extends number | string, V, U = never, RK = `${K}`> = V exten
|
|
|
22
22
|
*/
|
|
23
23
|
type FilteredKeyPath<T, U = never> = T extends ReadonlyArray<infer V> ? (IsTuple<T> extends true ? { [K in TupleKey<T>]-?: PathImpl<Exclude<K, symbol>, T[K], U> }[TupleKey<T>] : PathImpl<number, V, U>) : { [K in keyof T]-?: PathImpl<Exclude<K, symbol>, T[K], U> }[keyof T];
|
|
24
24
|
type IsTuple<T extends ReadonlyArray<any>> = number extends T['length'] ? false : true;
|
|
25
|
-
type PathImpl<K extends number | string, V, U> = [U] extends [never] ? DefaultPath<K, V> : ConditionalPath<K, V, U>;
|
|
25
|
+
type PathImpl<K$1 extends number | string, V$1, U> = [U] extends [never] ? DefaultPath<K$1, V$1> : ConditionalPath<K$1, V$1, U>;
|
|
26
26
|
type TerminalType = bigint | Blob | boolean | Date | File | null | number | ObjectId | RegExp | string | symbol | undefined;
|
|
27
27
|
type TupleKey<T extends ReadonlyArray<any>> = Exclude<keyof T, keyof any[]>;
|
|
28
28
|
//#endregion
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"filtered-key-path.d.ts","names":[],"sources":["../../src/types/filtered-key-path.ts"],"sourcesContent":[],"mappings":";;;;;;AAAqC;;;;;;KAWhC,
|
|
1
|
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AAA,QAAA,CAAA,GAAA,KAAA,GAAA,IAAA;KAEjD,QAFmF,CAAA,YAAA,MAAA,GAAA,MAAA,EAAA,GAAA,EAAA,CAAA,CAAA,GAAA,CAEtC,CAFsC,CAAA,SAAA,CAAA,KAAA,CAAA,GAEjB,WAFiB,CAEL,GAFK,EAEF,GAFE,CAAA,GAEG,eAFH,CAEmB,GAFnB,EAEsB,GAFtB,EAEyB,CAFzB,CAAA;KAGnF,YAAA,GAH2E,MAAA,GAK5E,IAL4E,GAAA,OAAA,GAO5E,IAP4E,GAQ5E,IAR4E,GAAA,IAAA,GAAA,MAAA,GAW5E,QAX4E,GAY5E,MAZ4E,GAAA,MAAA,GAAA,MAAA,GAAA,SAAA;KAiB3E,QAjBsH,CAAA,UAiBnG,aAjBmG,CAAA,GAAA,CAAA,CAAA,GAiB7E,OAjB6E,CAAA,MAiB/D,CAjB+D,EAAA,MAAA,GAAA,EAAA,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","names":[],"sources":["../../src/types/index.ts"],"sourcesContent":[],"mappings":";;;;KAQY,SAAA,GAAY;KACZ,WAAA,GAAc,OAAO,SAAS,OAAO,SAAW;AADhD,KAEA,UAAA,GAFS,OAAG,GAAM,MAAA,GAAA,OAAA;AAClB,KAEA,YAFW,CAAA,CAAA,CAAA,GAEO,OAFP,CAEe,CAFf,CAAA,GAEoB,CAFpB;
|
|
1
|
+
{"version":3,"file":"index.d.ts","names":[],"sources":["../../src/types/index.ts"],"sourcesContent":[],"mappings":";;;;KAQY,SAAA,GAAY;KACZ,WAAA,GAAc,OAAO,SAAS,OAAO,SAAW;AADhD,KAEA,UAAA,GAFS,OAAG,GAAM,MAAA,GAAA,OAAA;AAClB,KAEA,YAFW,CAAA,CAAA,CAAA,GAEO,OAFP,CAEe,CAFf,CAAA,GAEoB,CAFpB;AAAG,KAGd,aAHc,CAAA,CAAA,CAAA,GAGK,QAHL,CAGc,CAHd,CAAA,GAGmB,CAHnB;AAAO,KAIrB,QAJqB,CAAA,CAAA,CAAA,GAAA,IAAA,GAIA,CAJA;AAAS,KAK9B,SAAA,GAL8B,MAAA,GAAA,MAAA;AAAO,KAMrC,aANqC,CAAA,UAAA,MAAA,GAAA,EAAA,CAAA,CAAA,GAMG,OANH,CAMW,MANX,CAMkB,CANlB,EAMqB,CANrB,CAAA,CAAA;AAAW,KAOhD,qBAPgD,CAAA,UAAA,MAAA,GAAA,EAAA,CAAA,CAAA,GAOA,QAPA,CAOS,aAPT,CAOuB,CAPvB,EAO0B,CAP1B,CAAA,CAAA;AAAQ,KAQxD,cARwD,CAAA,UAAA,MAAA,GAAA,EAAA,CAAA,CAAA,GAQf,QARe,CAQN,MARM,CAQC,CARD,EAQI,CARJ,CAAA,CAAA"}
|
package/dist/vue.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"vue.d.ts","names":[],"sources":["../src/vue.ts"],"sourcesContent":[],"mappings":";;;;;;;AAiBA;AASA;;;;
|
|
1
|
+
{"version":3,"file":"vue.d.ts","names":[],"sources":["../src/vue.ts"],"sourcesContent":[],"mappings":";;;;;;;AAiBA;AASA;;;;AAA8C,iBAT9B,wCAAA,CAS8B,GAAA,EAAA,MAAA,CAAA,EAAA,MAAA;;AAU9C;;;;AAA4C,iBAV5B,gBAAA,CAU4B,WAAA,EAVE,GAUF,CAVM,QAUN,CAVe,UAUf,CAAA,OAViC,WAUjC,CAAA,CAAA,CAAA,CAAA,EAAA,IAAA;;AAa5C;;;;AAAqF,iBAbrE,eAAA,CAaqE,UAAA,EAbzC,GAayC,CAbrC,QAaqC,CAb5B,UAa4B,CAAA,OAbV,UAaU,CAAA,CAAA,CAAA,CAAA,EAAA,IAAA;;;;;;;;;iBAArE,4BAA4B,UAAU,2BAA2B,IAAI,SAAS"}
|
package/dist/web.js
CHANGED
|
@@ -9,8 +9,7 @@ import { appendRedirectParamToUrl } from "./url.js";
|
|
|
9
9
|
* @returns {string} A new URL with the current location as the `redirect` parameter
|
|
10
10
|
*/
|
|
11
11
|
function appendRedirectParamFromCurrentLocationToUrl(url) {
|
|
12
|
-
|
|
13
|
-
return appendRedirectParamToUrl(url, currentPath);
|
|
12
|
+
return appendRedirectParamToUrl(url, `${window.location.pathname}${window.location.search}${window.location.hash}`);
|
|
14
13
|
}
|
|
15
14
|
/**
|
|
16
15
|
* Navigates to the given URL, appending the current browser location
|
package/dist/web.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"web.js","names":[],"sources":["../src/web.ts"],"sourcesContent":["import { appendRedirectParamToUrl } from './url';\n\n/**\n * Appends the current browser URL (including path, query, and hash) as the `redirect` query parameter to the given URL.\n *\n * @param {string} url - The base URL to modify\n *\n * @returns {string} A new URL with the current location as the `redirect` parameter\n */\nexport function appendRedirectParamFromCurrentLocationToUrl(url: string) {\n const currentPath = `${window.location.pathname}${window.location.search}${window.location.hash}`;\n return appendRedirectParamToUrl(url, currentPath);\n}\n\n/**\n * Navigates to the given URL, appending the current browser location\n * (path, query, and hash) as the `redirect` query parameter.\n *\n * Useful for redirecting to login or other gateways while preserving\n * the current location for post-auth navigation.\n *\n * @param {string} url - The destination URL to navigate to\n * @param {number} [delayMs] - Optional delay in milliseconds before navigation\n */\nexport function assignUrlWithRedirectParamFromCurrentLocation(url: string, delayMs?: number) {\n if (delayMs === undefined) window.location.assign(appendRedirectParamFromCurrentLocationToUrl(url));\n else return setTimeout(() => window.location.assign(appendRedirectParamFromCurrentLocationToUrl(url)), delayMs);\n}\n"],"mappings":";;;;;;;;;;AASA,SAAgB,4CAA4C,KAAa;
|
|
1
|
+
{"version":3,"file":"web.js","names":[],"sources":["../src/web.ts"],"sourcesContent":["import { appendRedirectParamToUrl } from './url';\n\n/**\n * Appends the current browser URL (including path, query, and hash) as the `redirect` query parameter to the given URL.\n *\n * @param {string} url - The base URL to modify\n *\n * @returns {string} A new URL with the current location as the `redirect` parameter\n */\nexport function appendRedirectParamFromCurrentLocationToUrl(url: string) {\n const currentPath = `${window.location.pathname}${window.location.search}${window.location.hash}`;\n return appendRedirectParamToUrl(url, currentPath);\n}\n\n/**\n * Navigates to the given URL, appending the current browser location\n * (path, query, and hash) as the `redirect` query parameter.\n *\n * Useful for redirecting to login or other gateways while preserving\n * the current location for post-auth navigation.\n *\n * @param {string} url - The destination URL to navigate to\n * @param {number} [delayMs] - Optional delay in milliseconds before navigation\n */\nexport function assignUrlWithRedirectParamFromCurrentLocation(url: string, delayMs?: number) {\n if (delayMs === undefined) window.location.assign(appendRedirectParamFromCurrentLocationToUrl(url));\n else return setTimeout(() => window.location.assign(appendRedirectParamFromCurrentLocationToUrl(url)), delayMs);\n}\n"],"mappings":";;;;;;;;;;AASA,SAAgB,4CAA4C,KAAa;AAErE,QAAO,yBAAyB,KADZ,GAAG,OAAO,SAAS,WAAW,OAAO,SAAS,SAAS,OAAO,SAAS,OAC1C;;;;;;;;;;;;AAarD,SAAgB,8CAA8C,KAAa,SAAkB;AACzF,KAAI,YAAY,OAAW,QAAO,SAAS,OAAO,4CAA4C,IAAI,CAAC;KAC9F,QAAO,iBAAiB,OAAO,SAAS,OAAO,4CAA4C,IAAI,CAAC,EAAE,QAAQ"}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kikiutils/shared",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "13.
|
|
4
|
+
"version": "13.6.0",
|
|
5
5
|
"description": "A lightweight and modular utility library for modern JavaScript and TypeScript — includes secure hashing, flexible logging, datetime tools, Vue/web helpers, storage abstraction, and more.",
|
|
6
6
|
"author": "kiki-kanri",
|
|
7
7
|
"license": "MIT",
|
|
@@ -93,7 +93,7 @@
|
|
|
93
93
|
"@types/node": "^24.5.2",
|
|
94
94
|
"@types/ssh2": "^1.15.5",
|
|
95
95
|
"async-validator": "^4.2.5",
|
|
96
|
-
"bson": "^
|
|
96
|
+
"bson": "^7.0.0",
|
|
97
97
|
"consola": "^3.4.2",
|
|
98
98
|
"date-fns": "^4.1.0",
|
|
99
99
|
"decimal.js": "^10.6.0",
|
|
@@ -175,48 +175,48 @@
|
|
|
175
175
|
}
|
|
176
176
|
},
|
|
177
177
|
"devDependencies": {
|
|
178
|
-
"@
|
|
179
|
-
"@kikiutils/eslint-config": "^
|
|
178
|
+
"@antfu/eslint-config": "^6.2.0",
|
|
179
|
+
"@kikiutils/eslint-config": "^5.0.0",
|
|
180
180
|
"@kikiutils/tsconfigs": "^5.0.5",
|
|
181
181
|
"@noble/hashes": "^2.0.1",
|
|
182
182
|
"@types/fs-extra": "^11.0.4",
|
|
183
183
|
"@types/jsonfile": "^6.1.4",
|
|
184
|
-
"@types/node": "^24.
|
|
184
|
+
"@types/node": "^24.10.1",
|
|
185
185
|
"@types/ssh2": "^1.15.5",
|
|
186
|
-
"@vitest/coverage-v8": "^
|
|
186
|
+
"@vitest/coverage-v8": "^4.0.10",
|
|
187
187
|
"async-validator": "^4.2.5",
|
|
188
|
-
"bson": "^
|
|
188
|
+
"bson": "^7.0.0",
|
|
189
|
+
"changelogen": "^0.6.2",
|
|
189
190
|
"consola": "^3.4.2",
|
|
190
191
|
"cross-env": "^10.1.0",
|
|
191
192
|
"date-fns": "^4.1.0",
|
|
192
193
|
"decimal.js": "^10.6.0",
|
|
193
194
|
"depcheck": "^1.4.7",
|
|
194
|
-
"element-plus": "^2.11.
|
|
195
|
+
"element-plus": "^2.11.8",
|
|
195
196
|
"fs-extra": "^11.3.2",
|
|
196
|
-
"ioredis": "^5.8.
|
|
197
|
-
"jsdom": "^27.
|
|
197
|
+
"ioredis": "^5.8.2",
|
|
198
|
+
"jsdom": "^27.2.0",
|
|
198
199
|
"lru-cache": "^11.2.2",
|
|
199
200
|
"millify": "^6.1.0",
|
|
200
201
|
"node-ssh": "^13.2.1",
|
|
201
|
-
"pino": "^10.
|
|
202
|
-
"pino-pretty": "^13.1.
|
|
203
|
-
"publint": "^0.3.
|
|
204
|
-
"redis": "^5.
|
|
205
|
-
"superjson": "^2.2.
|
|
202
|
+
"pino": "^10.1.0",
|
|
203
|
+
"pino-pretty": "^13.1.2",
|
|
204
|
+
"publint": "^0.3.15",
|
|
205
|
+
"redis": "^5.9.0",
|
|
206
|
+
"superjson": "^2.2.5",
|
|
206
207
|
"ts-unused-exports": "^11.0.1",
|
|
207
|
-
"tsdown": "^0.
|
|
208
|
+
"tsdown": "^0.16.5",
|
|
208
209
|
"typescript": "^5.9.3",
|
|
209
|
-
"unplugin-unused": "^0.5.
|
|
210
|
-
"vitest": "^
|
|
211
|
-
"vue": "^3.5.
|
|
212
|
-
"vue-router": "^4.
|
|
210
|
+
"unplugin-unused": "^0.5.6",
|
|
211
|
+
"vitest": "^4.0.10",
|
|
212
|
+
"vue": "^3.5.24",
|
|
213
|
+
"vue-router": "^4.6.3"
|
|
213
214
|
},
|
|
214
215
|
"pnpm": {
|
|
215
216
|
"onlyBuiltDependencies": [
|
|
216
217
|
"cpu-features",
|
|
217
218
|
"esbuild",
|
|
218
219
|
"ssh2",
|
|
219
|
-
"unrs-resolver",
|
|
220
220
|
"vue-demi"
|
|
221
221
|
]
|
|
222
222
|
}
|
package/src/time.ts
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export function abortableDelay(ms: number, signal?: AbortSignal) {
|
|
2
|
+
return new Promise((resolve) => {
|
|
3
|
+
const timeout = setTimeout(resolve, ms);
|
|
4
|
+
if (signal) {
|
|
5
|
+
signal.addEventListener(
|
|
6
|
+
'abort',
|
|
7
|
+
() => {
|
|
8
|
+
clearTimeout(timeout);
|
|
9
|
+
resolve(undefined);
|
|
10
|
+
},
|
|
11
|
+
);
|
|
12
|
+
}
|
|
13
|
+
});
|
|
14
|
+
}
|