@kikiutils/shared 16.0.0 → 18.0.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/buffer.d.ts +0 -1
- package/dist/buffer.d.ts.map +1 -1
- package/dist/classes/path.d.ts +0 -1
- package/dist/classes/path.d.ts.map +1 -1
- package/dist/classes/precision-number.d.ts +0 -1
- package/dist/classes/precision-number.d.ts.map +1 -1
- package/dist/classes/ssh-client.d.ts +0 -1
- package/dist/classes/ssh-client.d.ts.map +1 -1
- package/dist/clipboard.d.ts.map +1 -1
- package/dist/consola.d.ts.map +1 -1
- package/dist/crypto-hash.d.ts +0 -1
- package/dist/crypto-hash.d.ts.map +1 -1
- package/dist/datetime.d.ts +0 -1
- package/dist/datetime.d.ts.map +1 -1
- package/dist/element-plus.d.ts +0 -1
- package/dist/element-plus.d.ts.map +1 -1
- package/dist/enum.d.ts.map +1 -1
- package/dist/env.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.d.ts.map +1 -1
- package/dist/math.d.ts +0 -1
- package/dist/math.d.ts.map +1 -1
- package/dist/number.d.ts +0 -1
- package/dist/number.d.ts.map +1 -1
- package/dist/object.d.ts.map +1 -1
- package/dist/pino.d.ts.map +1 -1
- package/dist/pino.js +10 -5
- package/dist/pino.js.map +1 -1
- package/dist/random.d.ts.map +1 -1
- package/dist/storages/lru/keyed-store.d.ts +0 -1
- package/dist/storages/lru/keyed-store.d.ts.map +1 -1
- package/dist/storages/redis/keyed-store.d.ts +0 -1
- package/dist/storages/redis/keyed-store.d.ts.map +1 -1
- package/dist/storages/redis/msgpack.d.ts +0 -1
- package/dist/storages/redis/msgpack.d.ts.map +1 -1
- package/dist/storages/redis/types.d.ts.map +1 -1
- package/dist/string.d.ts.map +1 -1
- package/dist/time.d.ts +9 -7
- package/dist/time.d.ts.map +1 -1
- package/dist/time.js +22 -12
- package/dist/time.js.map +1 -1
- package/dist/types/filtered-key-path.d.ts +1 -2
- package/dist/types/filtered-key-path.d.ts.map +1 -1
- package/dist/types/index.d.ts +0 -1
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/vue.d.ts +0 -1
- package/dist/types/vue.d.ts.map +1 -1
- package/dist/url.d.ts.map +1 -1
- package/dist/vue.d.ts +0 -1
- package/dist/vue.d.ts.map +1 -1
- package/dist/web.d.ts.map +1 -1
- package/dist/web.js +2 -1
- package/dist/web.js.map +1 -1
- package/package.json +20 -20
- package/src/time.ts +28 -16
package/dist/buffer.d.ts
CHANGED
package/dist/buffer.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"buffer.d.ts","names":[],"sources":["../src/buffer.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"buffer.d.ts","names":[],"sources":["../src/buffer.ts"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAkCsB,SAAS,OAAO,cAAW,QAAA,OAAA"}
|
package/dist/classes/path.d.ts
CHANGED
|
@@ -3,7 +3,6 @@ import * as fsp from "node:fs/promises";
|
|
|
3
3
|
import * as nodePath from "node:path";
|
|
4
4
|
import { Abortable } from "node:events";
|
|
5
5
|
import * as fs from "node:fs";
|
|
6
|
-
|
|
7
6
|
//#region src/classes/path.d.ts
|
|
8
7
|
type DropFirstParameters<T extends (...args: any) => any> = Parameters<T> extends [any, ...infer R] ? R : never;
|
|
9
8
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"path.d.ts","names":[],"sources":["../../src/classes/path.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"path.d.ts","names":[],"sources":["../../src/classes/path.ts"],"mappings":";;;;;;KAmBK,oBAAoB,cAAc,qBAAqB,WAAW,0BAA0B,KAAK;;;;KAK1F,WAAW,GAAG,WAAW;;;;;;;cAQxB;;;;;;;EAQG,eAAG,OAAO;GASrB,OAAO,aAAa;;;;MAmBjB,UAAM;;;;MAON;;;;SASG,OAAO,YAAY,SAAS,wBAAqB;;;;SAOjD,WAAW,OAAO,aAAU;;;;EASnC,SAAS;;;;EAOT,WAAO;;;;EAOP;;;;EAOA;;;;EAOA,aAAS;;;;EAOT,QAAQ,OAAO,aAAU;;;;EAOzB,SAAK,SAAA;;;;EAOL,SAAS,IAAI,WAAQ;;;;EAOrB,WAAO;EAIP;;;;EAOA;;;;;;EASA;;;;EASA,UAAU,MAAM,2BAA2B,IAAI,UAAO;;;;EAOtD,cAAc,MAAM,2BAA2B,IAAI,cAAW;;;;EAO9D,SAAS,MAAM,2BAA2B,IAAI,SAAM;;;;EAOpD,SAAS,MAAM,2BAA2B,IAAI,SAAM;;;;EAOpD,YAAY,MAAM,2BAA2B,IAAI,YAAS;;;;EAO1D,MACI,SAAS,GAAG;IACR;MAEL;EACH,MACI,WACK,GAAG;IACF;OAEF,GAAG,cAER;EACH,MAAM,UAAU,GAAG,uBAAuB,GAAG,cAAc;;;;EAQ3D,QAAQ,MAAM,2BAA2B,IAAI,QAAK,QAAA,GAAA,SAAA;;;;EAOlD,QACI,MAAM,UACN,UACI,kBACC,GAAG;IACF;IACA;cAGP;EACH,QACI,MAAM,UACN;IAGM;IACA;IACA;MAEP,QAAQ;EACX,QACI,MAAM,UACN,UACI,kBACC,GAAG;IACF;IACA;cAGP,QAAQ;EACX,QACI,MAAM,UACN,SAAS,GAAG;IACR;IACA;MAEL,QAAQ,GAAG;EACd,QACI,MAAM,UACN;IACI;IACA;IACA;MAEL,QAAQ,GAAG,OAAO;;;;EAQrB,SACI,WACK;IACC;IACA,OAAO,GAAG;cAGjB,QAAQ;EACX,SACI,UACK;IACC,UAAU;IACV,OAAO,GAAG;OAEZ,iBACL;EACH,SACI,WAEQ,YACA,GAAG;IACD,OAAO,GAAG;OAEd,wBAEP,QAAQ;;;;EAQX,OAAO,SAAS,WAAQ;;;;EAOxB,MAAM,MAAM,2BAA2B,IAAI,MAAG;;;;EAO9C,SAAS,MAAM,2BAA2B,IAAI,SAAM;;;;EAOpD,KACI,OAAO,GAAG;IACN;MAEL,QAAQ,GAAG;EACd,KACI,MAAM,GAAG;IACL;MAEL,QAAQ,GAAG;EACd,KAAK,OAAO,GAAG,cAAc,QAAQ,GAAG,cAAc,GAAG;;;;EAQzD,YAAY,MAAM,2BAA2B,IAAI,YAAS;;;;EAO1D,UAAM;;;;EAON,aAAa,MAAM,2BAA2B,IAAI,aAAU"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"precision-number.d.ts","names":[],"sources":["../../src/classes/precision-number.ts"],"mappings":";;;;;
|
|
1
|
+
{"version":3,"file":"precision-number.d.ts","names":[],"sources":["../../src/classes/precision-number.ts"],"mappings":";;;;;KAKY,uBAAuB,QAAQ,QAAQ;EAAoB;;;;;;;;;;;;;;;;;;;;;cAqB1D;;;;;;;;;EAcL,YAAA,QAAO,sBACP,wBACA,WAAU,QAAQ;;;;;;GAqBrB,OAAO,aAAa;;;;MAmBjB;;;;MAOA,YAAQ,QAAA;;;;MAOR;;;;;;;;;;SAaG,QACH,OAAO,sBACP,wBACA,WAAU,QAAQ;;;;;;EAYtB;;;;;;;;EAYA;;;;;;;;;;;EAeA,MAAM,KAAK,sBAAsB,KAAK;;;;EAWtC,SAAK;;;;;;;;EAWL,UAAU,OAAO;;;;;;;;EAYjB,OAAO,OAAO;;;;;;;;EAWd;;;;EAQA,GAAG,OAAO;;;;EAOV,IAAI,OAAO;;;;EAOX;;;;EAOA;;;;EAOA;;;;EAOA;;;;EAOA;;;;EAOA;;;;EAOA,GAAG,OAAO;;;;EAOV,IAAI,OAAO;;;;EAOX,MAAM,OAAO;;;;;;;;EAYb,OAAO,OAAO;;;;EAQd;;;;EAQA,KAAK,OAAO;;;;;;;;EAYZ,IAAI,OAAO;;;;EAQX,MAAM,OAAO;;;;EAQb,mBAAe;;;;EAOf,UAAM;;;;;;;;;EAYN,UAAU,KAAK,sBAAsB,KAAK,uBAAoB;;;;EAO9D,YAAY,OAAO,uBAAoB;;;;EAWvC,WAAO;;;;EAOP;;;;EAOA,QAAQ,OAAO,uBAAoB;;;;EAWnC,SAAS,OAAO,uBAAoB;;;;EAWpC,aAAS;;;;EAOT,OAAO,OAAO,uBAAoB;;;;EAOlC,MAAM,OAAO,uBAAoB;;;;;;EASjC;;;;EAOA;;;;EAOA,QAAQ,wBAA6C,WAAU,QAAQ;;;;EAOvE,QAAQ,OAAO,uBAAoB"}
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { PathLike } from "./path.js";
|
|
2
2
|
import { Config, NodeSSH, SSHExecCommandOptions, SSHGetPutDirectoryOptions, SSHPutFilesOptions } from "node-ssh";
|
|
3
3
|
import { SFTPWrapper, TransferOptions } from "ssh2";
|
|
4
|
-
|
|
5
4
|
//#region src/classes/ssh-client.d.ts
|
|
6
5
|
declare const loggerLevelStringToConsolaLogLevelMap: {
|
|
7
6
|
readonly debug: 4;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ssh-client.d.ts","names":[],"sources":["../../src/classes/ssh-client.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"ssh-client.d.ts","names":[],"sources":["../../src/classes/ssh-client.ts"],"mappings":";;;;cAgBM;;;;;;;;;;;cAYO;;EAMG,YAAA,cAAc,kBAAkB,kBAAkB,eAAmB,gBAAgB;MAc7F,WAAO;EAIL,WAAO;EAUb;EAUA,YAAY,iBAAiB,UAAU,wBAAqB,kCAAA;EAI5D,kBAAkB,iBAAiB,UAAU,wBAAqB,kCAAA;EAWlE,SAAM,gBAE6B,UAAQ,iBAAmB,UAAQ,UAAY,8BAAyB;EAArG,aAAa,gBAAgB,UAAU,iBAAiB,UAAU,UAAU,4BAAyB;EASrG,QACF,WAAW,UACX,YAAY,UACZ,mBAAmB,aACnB,yBAAyB,kBAAe;EAW5C;EAIM,MAAM,MAAM,WAAQ;EAU1B,SAAM,gBAE6B,UAAQ,iBAAmB,UAAQ,UAAY,8BAAyB;EAArG,aAAa,gBAAgB,UAAU,iBAAiB,UAAU,UAAU,4BAAyB;EASrG,QACF,WAAW,UACX,YAAY,UACZ,mBAAmB,aACnB,yBAAyB,kBAAe;EAWtC,SAAS;IAAS,OAAO;IAAU,QAAQ;OAAc,UAAU,qBAAkB;EAe3F,eAAe,oBAAoB"}
|
package/dist/clipboard.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"clipboard.d.ts","names":[],"sources":["../src/clipboard.ts"],"mappings":";KAAK
|
|
1
|
+
{"version":3,"file":"clipboard.d.ts","names":[],"sources":["../src/clipboard.ts"],"mappings":";KAAK;EACC;EAAgB;;EAChB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBA8BgB,oBAAoB,MAAM,MAAM,UAAU,uBAAuB,QAAQ;;;;;;;;;;;;;;;;;;;;;;;;;;;iBA8CzE,oBAAoB,eAAe,QAAQ"}
|
package/dist/consola.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"consola.d.ts","names":[],"sources":["../src/consola.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"consola.d.ts","names":[],"sources":["../src/consola.ts"],"mappings":";;;;;;;;;;;;;;;;;;;;;;cAuBa,iCAAa;cACb,0BAAM"}
|
package/dist/crypto-hash.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"crypto-hash.d.ts","names":[],"sources":["../src/crypto-hash.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"crypto-hash.d.ts","names":[],"sources":["../src/crypto-hash.ts"],"mappings":";;;;;;;;;;;;;;;;;iBAmBgB,UAAU,MAAM,YAAY,iBAAgB;;;;;;;;;;;;;;;iBAkB5C,kBAAkB,MAAM,aAAU;;;;;;;;;;;;;;;;iBAmBlC,cAAc,MAAM,YAAY,iBAAgB;;;;;;;;;;;;;;;iBAkBhD,sBAAsB,MAAM,aAAU;;;;;;;;;;;;;;;;iBAmBtC,cAAc,MAAM,YAAY,iBAAgB;;;;;;;;;;;;;;;iBAkBhD,sBAAsB,MAAM,aAAU;;;;;;;;;;;;;;;;iBAmBtC,cAAc,MAAM,YAAY,iBAAgB;;;;;;;;;;;;;;;iBAkBhD,sBAAsB,MAAM,aAAU;;;;;;;;;;;;;;;;iBAmBtC,cAAc,MAAM,YAAY,iBAAgB;;;;;;;;;;;;;;;iBAkBhD,sBAAsB,MAAM,aAAU"}
|
package/dist/datetime.d.ts
CHANGED
package/dist/datetime.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"datetime.d.ts","names":[],"sources":["../src/datetime.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"datetime.d.ts","names":[],"sources":["../src/datetime.ts"],"mappings":";;KAkBY;;;;;;;;;;;;;;;;;;;;;;;;;;iBA2BI,WAAW,MAAM,QAAQ,YAAY,iBAAwC,UAAU;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBA+BvF,qBACZ,MAAM,MACN,MAAM,eACN;EACI;EACA,eAAe;;;;;;;;;;;;;;;;;;;;;iBAoEP,yBAAyB,sBAAsB"}
|
package/dist/element-plus.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"element-plus.d.ts","names":[],"sources":["../src/element-plus.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"element-plus.d.ts","names":[],"sources":["../src/element-plus.ts"],"mappings":";;;KAGY,2BAA2B;;;;;;;;;;;;;;;;;;;;;;;;iBAyBvB,iCACZ,SAAS,yBACT,UAAS,eACV"}
|
package/dist/enum.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"enum.d.ts","names":[],"sources":["../src/enum.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"enum.d.ts","names":[],"sources":["../src/enum.ts"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;iBAuBgB,oBAAoB,UAAU,qBAAqB,YAAY,IAAI,QAAQ,QAAQ;;;;;;;;;;;;;;;;;;;;;;;;iBA2BnF,oBAAoB,UAAU,qBAAqB,YAAY,IAAI,QAAQ,QAAQ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAkDnF,cAAc,UAAU,qBAAqB,YAAY,KAAK,QAAQ"}
|
package/dist/env.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"env.d.ts","names":[],"sources":["../src/env.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"env.d.ts","names":[],"sources":["../src/env.ts"],"mappings":";;;;;;;;cAOa,iCAAiC;WACjC;;;;;;EAOG,YAAA;;;;;;;;;;;;;;;;;;;;;;;;;iBA+BA,oBAAoB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"event-awaiter.d.ts","names":[],"sources":["../src/event-awaiter.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"event-awaiter.d.ts","names":[],"sources":["../src/event-awaiter.ts"],"mappings":";;;;;;;;;;;;;cAYa,aAAa;;;;;;;;;;EAWtB,QAAQ,aAAa,OAAO;;;;;;;;;;EAiB5B,WAAW,QAAO;;;;;;;;;;;;;;;;;;;;;;;;EA4BlB,KAAK,aAAa,oBAAoB,8BAA8B,SAAS,cAAW,QAAA;;;;;;;;;;;EA2DxF,cAAc,aAAa,oBAAoB,SAAS,cAAW,QAAA;;;;;;;;;;;EAcnE,WAAW,aAAa,oBAAoB,SAAS,cAAW,QAAA"}
|
package/dist/general.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"general.d.ts","names":[],"sources":["../src/general.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"general.d.ts","names":[],"sources":["../src/general.ts"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;iBA2BgB,kBAAkB,GAAG,OAAO,IAAI,MAAM;iBACtC,kBAAkB,GAAG,GAAG,OAAO,IAAI,KAAK,cAAc,IAAI,IAAI,YAAY"}
|
package/dist/hash.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"hash.d.ts","names":[],"sources":["../src/hash.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"hash.d.ts","names":[],"sources":["../src/hash.ts"],"mappings":";;;;;;;;;;;;;;;iBAyBgB,QAAQ,eAAe;;;;;;;;;;;;;;;iBAkBvB,QAAQ,eAAe;;;;;;;;;;;;;;;iBAkBvB,QAAQ,eAAe;;;;;;;;;;;;;;;iBAkBvB,QAAQ,eAAe"}
|
package/dist/math.d.ts
CHANGED
package/dist/math.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"math.d.ts","names":[],"sources":["../src/math.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"math.d.ts","names":[],"sources":["../src/math.ts"],"mappings":";;KAEK,kBAAkB,QAAQ;EAAU;;;;;UAKxB;;;;;;EAMb;;;;;;EAOA;;;;;;;;;;;;;;;;;;;;;;;;iBAyBY,mBACZ,WAAW,iBACX,aAAa,iBACb,UAAU"}
|
package/dist/number.d.ts
CHANGED
package/dist/number.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"number.d.ts","names":[],"sources":["../src/number.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"number.d.ts","names":[],"sources":["../src/number.ts"],"mappings":";;;;;;;;;;;;;;;;;;;;iBAoBgB,sBAAsB,eAAe,UAAU,kBAAkB"}
|
package/dist/object.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"object.d.ts","names":[],"sources":["../src/object.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"object.d.ts","names":[],"sources":["../src/object.ts"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;iBA2BgB,iCACZ,OAAO,qBACP,sBACA"}
|
package/dist/pino.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pino.d.ts","names":[],"sources":["../src/pino.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"pino.d.ts","names":[],"sources":["../src/pino.ts"],"mappings":";;;;;;;;;;;;;;;;;;;;;;cAiCa,2BAAU;cACV,uBAAM"}
|
package/dist/pino.js
CHANGED
|
@@ -1,5 +1,14 @@
|
|
|
1
1
|
import { pino } from "pino";
|
|
2
2
|
import { PinoPretty } from "pino-pretty";
|
|
3
|
+
//#region src/pino.ts
|
|
4
|
+
/**
|
|
5
|
+
* Configure pinoPretty to enhance the log output.
|
|
6
|
+
*/
|
|
7
|
+
const stream = PinoPretty({
|
|
8
|
+
colorize: true,
|
|
9
|
+
ignore: "hostname,pid",
|
|
10
|
+
translateTime: "SYS:yyyy-mm-dd HH:MM:ss.l"
|
|
11
|
+
});
|
|
3
12
|
/**
|
|
4
13
|
* A pino logger instance with the configured stream.
|
|
5
14
|
*
|
|
@@ -21,11 +30,7 @@ import { PinoPretty } from "pino-pretty";
|
|
|
21
30
|
* logger.level = 'info';
|
|
22
31
|
* ```
|
|
23
32
|
*/
|
|
24
|
-
const pinoLogger = pino({},
|
|
25
|
-
colorize: true,
|
|
26
|
-
ignore: "hostname,pid",
|
|
27
|
-
translateTime: "SYS:yyyy-mm-dd HH:MM:ss.l"
|
|
28
|
-
}));
|
|
33
|
+
const pinoLogger = pino({}, stream);
|
|
29
34
|
const logger = pinoLogger;
|
|
30
35
|
pinoLogger.level = process.env.PINO_LOGGER_LEVEL || (process.env.NODE_ENV === "production" ? "error" : pinoLogger.level);
|
|
31
36
|
//#endregion
|
package/dist/pino.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pino.js","names":[],"sources":["../src/pino.ts"],"sourcesContent":["import { pino } from 'pino';\nimport { PinoPretty } from 'pino-pretty';\n\n/**\n * Configure pinoPretty to enhance the log output.\n */\nconst stream = PinoPretty({\n colorize: true, // Enable colored output for better readability\n ignore: 'hostname,pid', // Exclude 'hostname' and 'pid' fields from the logs\n translateTime: 'SYS:yyyy-mm-dd HH:MM:ss.l', // Format the timestamp in 'yyyy-mm-dd HH:MM:ss.l' format\n});\n\n/**\n * A pino logger instance with the configured stream.\n *\n * The logger's level is determined based on the `PINO_LOGGER_LEVEL` and `NODE_ENV` environment variables.\n * If `PINO_LOGGER_LEVEL` is set, it will be used; otherwise, if `NODE_ENV` is `production`,\n * the level will be set to `error`.\n *\n * To manually change the level, assign the desired level to `logger.level`.\n *\n * See available levels [here](https://getpino.io/#/docs/api?id=level-string).\n *\n * @example\n * ```typescript\n * import { logger } from '@kikiutils/shared/pino';\n *\n * logger.info('test'); // [2024-07-11 12:12:30.085] INFO: test\n *\n * // Manually change the level\n * logger.level = 'info';\n * ```\n */\nexport const pinoLogger = pino({}, stream);\nexport const logger = pinoLogger;\n// eslint-disable-next-line style/max-len\npinoLogger.level = process.env.PINO_LOGGER_LEVEL || (process.env.NODE_ENV === 'production' ? 'error' : pinoLogger.level);\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"pino.js","names":[],"sources":["../src/pino.ts"],"sourcesContent":["import { pino } from 'pino';\nimport { PinoPretty } from 'pino-pretty';\n\n/**\n * Configure pinoPretty to enhance the log output.\n */\nconst stream = PinoPretty({\n colorize: true, // Enable colored output for better readability\n ignore: 'hostname,pid', // Exclude 'hostname' and 'pid' fields from the logs\n translateTime: 'SYS:yyyy-mm-dd HH:MM:ss.l', // Format the timestamp in 'yyyy-mm-dd HH:MM:ss.l' format\n});\n\n/**\n * A pino logger instance with the configured stream.\n *\n * The logger's level is determined based on the `PINO_LOGGER_LEVEL` and `NODE_ENV` environment variables.\n * If `PINO_LOGGER_LEVEL` is set, it will be used; otherwise, if `NODE_ENV` is `production`,\n * the level will be set to `error`.\n *\n * To manually change the level, assign the desired level to `logger.level`.\n *\n * See available levels [here](https://getpino.io/#/docs/api?id=level-string).\n *\n * @example\n * ```typescript\n * import { logger } from '@kikiutils/shared/pino';\n *\n * logger.info('test'); // [2024-07-11 12:12:30.085] INFO: test\n *\n * // Manually change the level\n * logger.level = 'info';\n * ```\n */\nexport const pinoLogger = pino({}, stream);\nexport const logger = pinoLogger;\n// eslint-disable-next-line style/max-len\npinoLogger.level = process.env.PINO_LOGGER_LEVEL || (process.env.NODE_ENV === 'production' ? 'error' : pinoLogger.level);\n"],"mappings":";;;;;;AAMA,MAAM,SAAS,WAAW;CACtB,UAAU;CACV,QAAQ;CACR,eAAe;AACnB,CAAC;;;;;;;;;;;;;;;;;;;;;;AAuBD,MAAa,aAAa,KAAK,CAAC,GAAG,MAAM;AACzC,MAAa,SAAS;AAEtB,WAAW,QAAQ,QAAQ,IAAI,sBAAsB,QAAQ,IAAI,aAAa,eAAe,UAAU,WAAW"}
|
package/dist/random.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"random.d.ts","names":[],"sources":["../src/random.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"random.d.ts","names":[],"sources":["../src/random.ts"],"mappings":";;;;;;;;;;;;;;;;;;;;;iBAoBgB,+BAA+B,YAC3C,YAAY,mBAAmB,GAC/B,gBACA,gBACA,gBACA,iBAAc"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"keyed-store.d.ts","names":[],"sources":["../../../src/storages/lru/keyed-store.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"keyed-store.d.ts","names":[],"sources":["../../../src/storages/lru/keyed-store.ts"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;iBAwBgB,oBAAoB,aAAa,aAAa,2BAClD,iBAAiB,WAAW,MAAM,iBAAY;;;;;;EAMjC,WAAA,MAAA,IAAC,YAAA;EAII,gBAAA,MAAA;EACH,aAAA,MAAA;EACG,gBAAA,MAAA;;;;EAIA,gBAAA,MAAA;EACL,UAAA,OAAA,MAAC,MAAW,MAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"keyed-store.d.ts","names":[],"sources":["../../../src/storages/redis/keyed-store.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"keyed-store.d.ts","names":[],"sources":["../../../src/storages/redis/keyed-store.ts"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;iBA6BgB,sBAAsB,aAAa,SAAS,cAAc,qBAC9D,iBAAiB,WAAW,MAAM,iBAAY;EAC/B,aAAA,MAAA,MAAC,QAAA;EACE,gBAAA,MAAA,MAAC;EACJ,aAAA,MAAA,MAAC;EACE,gBAAA,MAAA,MAAC;EACD,gBAAA,MAAA;EACL,UAAA,OAAA,MAAC,MAAW,MAAC;EACH,eAAA,oBAAM,OAAS,MAAC,MAAW,IAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"msgpack.d.ts","names":[],"sources":["../../../src/storages/redis/msgpack.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"msgpack.d.ts","names":[],"sources":["../../../src/storages/redis/msgpack.ts"],"mappings":";;;;;;;;;;;;;;;;;;;;;;iBAmCgB,0BAA0B,SAAS,mBAAmB,SAAS"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","names":[],"sources":["../../../src/storages/redis/types.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"types.d.ts","names":[],"sources":["../../../src/storages/redis/types.ts"],"mappings":";;;;UAGiB;;;;EAIb,SAAS,gBAAgB;;;;EAKzB,YAAY,gBAAgB,eAAe;;;;EAK3C,MAAM,gBAAgB;;;;EAKtB,YAAY,aAAa,OAAO,eAAe;;;;EAK/C,cAAc,aAAa,oBAAoB,OAAO,eAAe;;;;EAKrE,MAAM,gBAAgB;;;;;UAMT;;;;EAIb,UAAU,aAAa,gBAAgB,eAAe;;;;EAKtD,aAAa,gBAAgB;;;;EAK7B,UAAU,gBAAgB;;;;EAK1B,aAAa,gBAAgB;;;;EAK7B,UAAU,aAAa,eAAe;;;;EAKtC,iBAAiB,aAAa,oBAAoB,eAAe"}
|
package/dist/string.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"string.d.ts","names":[],"sources":["../src/string.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"string.d.ts","names":[],"sources":["../src/string.ts"],"mappings":";;;;KAGY;;;;;;;;;;;;;;;;;;;;;;;iBA4CI,aAAa,gBAAgB,OAAM"}
|
package/dist/time.d.ts
CHANGED
|
@@ -1,22 +1,24 @@
|
|
|
1
1
|
//#region src/time.d.ts
|
|
2
2
|
/**
|
|
3
|
-
*
|
|
3
|
+
* Delays execution until the specified duration elapses or the signal is aborted.
|
|
4
|
+
*
|
|
5
|
+
* Aborting the signal rejects the promise with the signal's abort reason.
|
|
4
6
|
*
|
|
5
7
|
* @param {number} ms - Delay duration in milliseconds
|
|
6
|
-
* @param {AbortSignal} [signal] - Optional
|
|
8
|
+
* @param {AbortSignal} [signal] - Optional signal used to abort the delay
|
|
7
9
|
*
|
|
8
|
-
* @returns {Promise<
|
|
10
|
+
* @returns {Promise<void>} Resolves when the delay completes or rejects when the signal is aborted
|
|
9
11
|
*
|
|
10
12
|
* @example
|
|
11
13
|
* ```typescript
|
|
12
|
-
* import {
|
|
14
|
+
* import { delayOrThrow } from '@kikiutils/shared/time';
|
|
13
15
|
*
|
|
14
16
|
* const controller = new AbortController();
|
|
15
17
|
* setTimeout(() => controller.abort(), 1000);
|
|
16
|
-
* await
|
|
18
|
+
* await delayOrThrow(5000, controller.signal); // rejects after ~1s
|
|
17
19
|
* ```
|
|
18
20
|
*/
|
|
19
|
-
declare function
|
|
21
|
+
declare function delayOrThrow(ms: number, signal?: AbortSignal): Promise<void>;
|
|
20
22
|
//#endregion
|
|
21
|
-
export {
|
|
23
|
+
export { delayOrThrow };
|
|
22
24
|
//# sourceMappingURL=time.d.ts.map
|
package/dist/time.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"time.d.ts","names":[],"sources":["../src/time.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"time.d.ts","names":[],"sources":["../src/time.ts"],"mappings":";;;;;;;;;;;;;;;;;;;;iBAmBgB,aAAa,YAAY,SAAS,cAAc"}
|
package/dist/time.js
CHANGED
|
@@ -1,31 +1,41 @@
|
|
|
1
1
|
//#region src/time.ts
|
|
2
2
|
/**
|
|
3
|
-
*
|
|
3
|
+
* Delays execution until the specified duration elapses or the signal is aborted.
|
|
4
|
+
*
|
|
5
|
+
* Aborting the signal rejects the promise with the signal's abort reason.
|
|
4
6
|
*
|
|
5
7
|
* @param {number} ms - Delay duration in milliseconds
|
|
6
|
-
* @param {AbortSignal} [signal] - Optional
|
|
8
|
+
* @param {AbortSignal} [signal] - Optional signal used to abort the delay
|
|
7
9
|
*
|
|
8
|
-
* @returns {Promise<
|
|
10
|
+
* @returns {Promise<void>} Resolves when the delay completes or rejects when the signal is aborted
|
|
9
11
|
*
|
|
10
12
|
* @example
|
|
11
13
|
* ```typescript
|
|
12
|
-
* import {
|
|
14
|
+
* import { delayOrThrow } from '@kikiutils/shared/time';
|
|
13
15
|
*
|
|
14
16
|
* const controller = new AbortController();
|
|
15
17
|
* setTimeout(() => controller.abort(), 1000);
|
|
16
|
-
* await
|
|
18
|
+
* await delayOrThrow(5000, controller.signal); // rejects after ~1s
|
|
17
19
|
* ```
|
|
18
20
|
*/
|
|
19
|
-
function
|
|
20
|
-
return new Promise((resolve) => {
|
|
21
|
-
|
|
22
|
-
|
|
21
|
+
function delayOrThrow(ms, signal) {
|
|
22
|
+
return new Promise((resolve, reject) => {
|
|
23
|
+
if (signal?.aborted) {
|
|
24
|
+
reject(signal.reason);
|
|
25
|
+
return;
|
|
26
|
+
}
|
|
27
|
+
const onAbort = () => {
|
|
23
28
|
clearTimeout(timeout);
|
|
24
|
-
|
|
25
|
-
}
|
|
29
|
+
reject(signal.reason);
|
|
30
|
+
};
|
|
31
|
+
const timeout = setTimeout(() => {
|
|
32
|
+
signal?.removeEventListener("abort", onAbort);
|
|
33
|
+
resolve();
|
|
34
|
+
}, ms);
|
|
35
|
+
signal?.addEventListener("abort", onAbort, { once: true });
|
|
26
36
|
});
|
|
27
37
|
}
|
|
28
38
|
//#endregion
|
|
29
|
-
export {
|
|
39
|
+
export { delayOrThrow };
|
|
30
40
|
|
|
31
41
|
//# sourceMappingURL=time.js.map
|
package/dist/time.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"time.js","names":[],"sources":["../src/time.ts"],"sourcesContent":["/**\n *
|
|
1
|
+
{"version":3,"file":"time.js","names":[],"sources":["../src/time.ts"],"sourcesContent":["/**\n * Delays execution until the specified duration elapses or the signal is aborted.\n *\n * Aborting the signal rejects the promise with the signal's abort reason.\n *\n * @param {number} ms - Delay duration in milliseconds\n * @param {AbortSignal} [signal] - Optional signal used to abort the delay\n *\n * @returns {Promise<void>} Resolves when the delay completes or rejects when the signal is aborted\n *\n * @example\n * ```typescript\n * import { delayOrThrow } from '@kikiutils/shared/time';\n *\n * const controller = new AbortController();\n * setTimeout(() => controller.abort(), 1000);\n * await delayOrThrow(5000, controller.signal); // rejects after ~1s\n * ```\n */\nexport function delayOrThrow(ms: number, signal?: AbortSignal): Promise<void> {\n return new Promise((resolve, reject) => {\n if (signal?.aborted) {\n reject(signal.reason);\n return;\n }\n\n const onAbort = () => {\n // eslint-disable-next-line ts/no-use-before-define\n clearTimeout(timeout);\n reject(signal!.reason);\n };\n\n const timeout = setTimeout(\n () => {\n signal?.removeEventListener('abort', onAbort);\n resolve();\n },\n ms,\n );\n\n signal?.addEventListener('abort', onAbort, { once: true });\n });\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAmBA,SAAgB,aAAa,IAAY,QAAqC;CAC1E,OAAO,IAAI,SAAS,SAAS,WAAW;EACpC,IAAI,QAAQ,SAAS;GACjB,OAAO,OAAO,MAAM;GACpB;EACJ;EAEA,MAAM,gBAAgB;GAElB,aAAa,OAAO;GACpB,OAAO,OAAQ,MAAM;EACzB;EAEA,MAAM,UAAU,iBACN;GACF,QAAQ,oBAAoB,SAAS,OAAO;GAC5C,QAAQ;EACZ,GACA,EACJ;EAEA,QAAQ,iBAAiB,SAAS,SAAS,EAAE,MAAM,KAAK,CAAC;CAC7D,CAAC;AACL"}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { ObjectId } from "bson";
|
|
2
|
-
|
|
3
2
|
//#region src/types/filtered-key-path.d.ts
|
|
4
3
|
/**
|
|
5
4
|
* The following types are based on or inspired by types from the Element Plus project.
|
|
@@ -19,7 +18,7 @@ type DefaultPath<K extends number | string, V, U = never, RK = `${K}`> = V exten
|
|
|
19
18
|
* @template T - The object type to traverse.
|
|
20
19
|
* @template U - The type used to filter key paths. Defaults to `never`, meaning no filtering.
|
|
21
20
|
*/
|
|
22
|
-
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
|
|
21
|
+
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];
|
|
23
22
|
type IsTuple<T extends ReadonlyArray<any>> = number extends T['length'] ? false : true;
|
|
24
23
|
type PathImpl<K extends number | string, V, U> = [U] extends [never] ? DefaultPath<K, V> : ConditionalPath<K, V, U>;
|
|
25
24
|
type TerminalType = bigint | Blob | boolean | Date | File | null | number | ObjectId | RegExp | string | symbol | undefined;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"filtered-key-path.d.ts","names":[],"sources":["../../src/types/filtered-key-path.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"filtered-key-path.d.ts","names":[],"sources":["../../src/types/filtered-key-path.ts"],"mappings":";;;;;;;;;;KAWK,gBAAgB,2BAA2B,GAAG,KAAK,UAAU,OAAO,MAAM,YAAY,GAAG,GAAG;KAC5F,YACD,2BACA,GACA,WACA,QAAQ,OACR,UAAU,eAAe,QAAQ,KAAK,gBAAgB,GAAG;;;;;;;;;KAWjD,gBAAgB,GAAG,aAAa,UAAU,oBAAoB,MAAM,QAAQ,qBAAqB,KAAK,SAAS,OAAO,SAAS,QAAQ,YAAY,EAAE,IAAI,MAAK,SAAS,MAAM,iBAAiB,GAAG,SAAS,WAAW,MAAM,SAAS,QAAQ,YAAY,EAAE,IAAI,YAAW;KAChR,QAAQ,UAAU,qCAAqC;KACvD,SAAS,2BAA2B,GAAG,MAAM,qBAAqB,YAAY,GAAG,KAAK,gBAAgB,GAAG,GAAG;KAC5G,wBAED,iBAEA,OACA,uBAGA,WACA;KAKC,SAAS,UAAU,sBAAsB,cAAc"}
|
package/dist/types/index.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","names":[],"sources":["../../src/types/index.ts"],"mappings":";;;;;;
|
|
1
|
+
{"version":3,"file":"index.d.ts","names":[],"sources":["../../src/types/index.ts"],"mappings":";;;;;;KAWY,YAAY;;;;KAKZ,cAAc,cAAc,OAAO,SAAS,OAAO,SAAW,SAAW;;;;KAKzE;;;;KAKA,aAAa,KAAK,QAAQ,KAAK;;;;KAK/B,cAAc,KAAK,SAAS,KAAK;;;;KAKjC;;;;KAKA,cAAc,qBAAqB,KAAK,QAAQ,OAAO,GAAG;;;;KAK1D,sBAAsB,qBAAqB,KAAK,SAAS,cAAc,GAAG;;;;KAK1E,eAAe,qBAAqB,KAAK,SAAS,OAAO,GAAG"}
|
package/dist/types/vue.d.ts
CHANGED
package/dist/types/vue.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"vue.d.ts","names":[],"sources":["../../src/types/vue.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"vue.d.ts","names":[],"sources":["../../src/types/vue.ts"],"mappings":";;;;;;;;;;;;;;;KAeY,aAAa,gBAAgB,oBAAoB,aAAa,iBAAiB"}
|
package/dist/url.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"url.d.ts","names":[],"sources":["../src/url.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"url.d.ts","names":[],"sources":["../src/url.ts"],"mappings":";;;;;;;;;;;;;;iBAagB,yBAAyB,aAAa;;;;;;;;;;;;iBAuBtC,mBAAmB,iBAAiB;;;;;;;;;;;;iBAmBpC,sBAAsB,gBAAgB"}
|
package/dist/vue.d.ts
CHANGED
package/dist/vue.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"vue.d.ts","names":[],"sources":["../src/vue.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"vue.d.ts","names":[],"sources":["../src/vue.ts"],"mappings":";;;;;;;;;iBAgBgB,yCAAyC;;;;;;iBASzC,iBAAiB,aAAa,WAAW,kBAAkB;;;;;;iBAU3D,gBAAgB,YAAY,WAAW,kBAAkB;;;;;;;;;;;;;;;iBAmBzD,kBAAkB,UAAU,UAAU,aAAa,cAAc,WAAW"}
|
package/dist/web.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"web.d.ts","names":[],"sources":["../src/web.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"web.d.ts","names":[],"sources":["../src/web.ts"],"mappings":";;;;;;;;iBASgB,4CAA4C;;;;;;;;;;;iBAe5C,8CAA8C,aAAa,mBAAgB,OAAA"}
|
package/dist/web.js
CHANGED
|
@@ -8,7 +8,8 @@ import { appendRedirectParamToUrl } from "./url.js";
|
|
|
8
8
|
* @returns {string} A new URL with the current location as the `redirect` parameter
|
|
9
9
|
*/
|
|
10
10
|
function appendRedirectParamFromCurrentLocationToUrl(url) {
|
|
11
|
-
|
|
11
|
+
const currentPath = `${window.location.pathname}${window.location.search}${window.location.hash}`;
|
|
12
|
+
return appendRedirectParamToUrl(url, currentPath);
|
|
12
13
|
}
|
|
13
14
|
/**
|
|
14
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;CACrE,MAAM,cAAc,GAAG,OAAO,SAAS,WAAW,OAAO,SAAS,SAAS,OAAO,SAAS;CAC3F,OAAO,yBAAyB,KAAK,WAAW;AACpD;;;;;;;;;;;AAYA,SAAgB,8CAA8C,KAAa,SAAkB;CACzF,IAAI,YAAY,KAAA,GAAW,OAAO,SAAS,OAAO,4CAA4C,GAAG,CAAC;MAC7F,OAAO,iBAAiB,OAAO,SAAS,OAAO,4CAA4C,GAAG,CAAC,GAAG,OAAO;AAClH"}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kikiutils/shared",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "
|
|
4
|
+
"version": "18.0.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",
|
|
@@ -67,21 +67,21 @@
|
|
|
67
67
|
"typecheck": "tsc -b --noEmit"
|
|
68
68
|
},
|
|
69
69
|
"peerDependencies": {
|
|
70
|
-
"@noble/hashes": "^2.
|
|
70
|
+
"@noble/hashes": "^2.3.0",
|
|
71
71
|
"@types/ssh2": "^1.15.5",
|
|
72
72
|
"async-validator": "^4.2.5",
|
|
73
|
-
"bson": "^7.3.
|
|
73
|
+
"bson": "^7.3.2",
|
|
74
74
|
"consola": "^3.4.2",
|
|
75
75
|
"date-fns": "^4.4.0",
|
|
76
76
|
"decimal.js": "^10.6.0",
|
|
77
|
-
"element-plus": "^2.14.
|
|
77
|
+
"element-plus": "^2.14.4",
|
|
78
78
|
"lru-cache": "^11.5.2",
|
|
79
79
|
"millify": "^6.1.0",
|
|
80
|
-
"msgpackr": "^2.0.
|
|
80
|
+
"msgpackr": "^2.0.5",
|
|
81
81
|
"node-ssh": "^13.2.1",
|
|
82
82
|
"pino": "^10.3.1",
|
|
83
83
|
"pino-pretty": "^13.1.3",
|
|
84
|
-
"vue": "^3.5.
|
|
84
|
+
"vue": "^3.5.41",
|
|
85
85
|
"vue-router": ">= 4.6.4"
|
|
86
86
|
},
|
|
87
87
|
"peerDependenciesMeta": {
|
|
@@ -135,36 +135,36 @@
|
|
|
135
135
|
}
|
|
136
136
|
},
|
|
137
137
|
"devDependencies": {
|
|
138
|
-
"@antfu/eslint-config": "^9.
|
|
138
|
+
"@antfu/eslint-config": "^9.3.0",
|
|
139
139
|
"@kikiutils/eslint-config": "^9.2.0",
|
|
140
140
|
"@kikiutils/tsconfigs": "^7.0.0",
|
|
141
|
-
"@noble/hashes": "^2.
|
|
142
|
-
"@types/node": "^26.
|
|
141
|
+
"@noble/hashes": "^2.3.0",
|
|
142
|
+
"@types/node": "^26.2.0",
|
|
143
143
|
"@types/ssh2": "^1.15.5",
|
|
144
144
|
"@vitest/coverage-v8": "^4.1.10",
|
|
145
145
|
"async-validator": "^4.2.5",
|
|
146
|
-
"bson": "^7.3.
|
|
146
|
+
"bson": "^7.3.2",
|
|
147
147
|
"changelogen": "^0.6.2",
|
|
148
148
|
"consola": "^3.4.2",
|
|
149
149
|
"cross-env": "^10.1.0",
|
|
150
150
|
"date-fns": "^4.4.0",
|
|
151
151
|
"decimal.js": "^10.6.0",
|
|
152
|
-
"element-plus": "^2.14.
|
|
153
|
-
"eslint": "^10.
|
|
154
|
-
"jsdom": "^
|
|
155
|
-
"knip": "^6.
|
|
152
|
+
"element-plus": "^2.14.4",
|
|
153
|
+
"eslint": "^10.8.1",
|
|
154
|
+
"jsdom": "^30.0.1",
|
|
155
|
+
"knip": "^6.32.2",
|
|
156
156
|
"lru-cache": "^11.5.2",
|
|
157
157
|
"millify": "^6.1.0",
|
|
158
|
-
"msgpackr": "^2.0.
|
|
158
|
+
"msgpackr": "^2.0.5",
|
|
159
159
|
"node-ssh": "^13.2.1",
|
|
160
160
|
"pino": "^10.3.1",
|
|
161
161
|
"pino-pretty": "^13.1.3",
|
|
162
|
-
"publint": "^0.3.
|
|
163
|
-
"tsdown": "^0.22.
|
|
162
|
+
"publint": "^0.3.23",
|
|
163
|
+
"tsdown": "^0.22.14",
|
|
164
164
|
"typescript": "^6.0.3",
|
|
165
|
-
"unplugin-unused": "^0.
|
|
165
|
+
"unplugin-unused": "^0.6.0",
|
|
166
166
|
"vitest": "^4.1.10",
|
|
167
|
-
"vue": "^3.5.
|
|
168
|
-
"vue-router": "^5.
|
|
167
|
+
"vue": "^3.5.41",
|
|
168
|
+
"vue-router": "^5.2.0"
|
|
169
169
|
}
|
|
170
170
|
}
|
package/src/time.ts
CHANGED
|
@@ -1,31 +1,43 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
2
|
+
* Delays execution until the specified duration elapses or the signal is aborted.
|
|
3
|
+
*
|
|
4
|
+
* Aborting the signal rejects the promise with the signal's abort reason.
|
|
3
5
|
*
|
|
4
6
|
* @param {number} ms - Delay duration in milliseconds
|
|
5
|
-
* @param {AbortSignal} [signal] - Optional
|
|
7
|
+
* @param {AbortSignal} [signal] - Optional signal used to abort the delay
|
|
6
8
|
*
|
|
7
|
-
* @returns {Promise<
|
|
9
|
+
* @returns {Promise<void>} Resolves when the delay completes or rejects when the signal is aborted
|
|
8
10
|
*
|
|
9
11
|
* @example
|
|
10
12
|
* ```typescript
|
|
11
|
-
* import {
|
|
13
|
+
* import { delayOrThrow } from '@kikiutils/shared/time';
|
|
12
14
|
*
|
|
13
15
|
* const controller = new AbortController();
|
|
14
16
|
* setTimeout(() => controller.abort(), 1000);
|
|
15
|
-
* await
|
|
17
|
+
* await delayOrThrow(5000, controller.signal); // rejects after ~1s
|
|
16
18
|
* ```
|
|
17
19
|
*/
|
|
18
|
-
export function
|
|
19
|
-
return new Promise((resolve) => {
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
'abort',
|
|
24
|
-
() => {
|
|
25
|
-
clearTimeout(timeout);
|
|
26
|
-
resolve(undefined);
|
|
27
|
-
},
|
|
28
|
-
);
|
|
20
|
+
export function delayOrThrow(ms: number, signal?: AbortSignal): Promise<void> {
|
|
21
|
+
return new Promise((resolve, reject) => {
|
|
22
|
+
if (signal?.aborted) {
|
|
23
|
+
reject(signal.reason);
|
|
24
|
+
return;
|
|
29
25
|
}
|
|
26
|
+
|
|
27
|
+
const onAbort = () => {
|
|
28
|
+
// eslint-disable-next-line ts/no-use-before-define
|
|
29
|
+
clearTimeout(timeout);
|
|
30
|
+
reject(signal!.reason);
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
const timeout = setTimeout(
|
|
34
|
+
() => {
|
|
35
|
+
signal?.removeEventListener('abort', onAbort);
|
|
36
|
+
resolve();
|
|
37
|
+
},
|
|
38
|
+
ms,
|
|
39
|
+
);
|
|
40
|
+
|
|
41
|
+
signal?.addEventListener('abort', onAbort, { once: true });
|
|
30
42
|
});
|
|
31
43
|
}
|