@kikiutils/shared 10.3.0 → 10.4.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (120) hide show
  1. package/dist/buffer.cjs +43 -0
  2. package/dist/buffer.cjs.map +1 -0
  3. package/dist/buffer.d.ts +35 -0
  4. package/dist/buffer.d.ts.map +1 -0
  5. package/dist/buffer.mjs +41 -0
  6. package/dist/buffer.mjs.map +1 -0
  7. package/dist/clipboard.cjs +4 -4
  8. package/dist/clipboard.cjs.map +1 -1
  9. package/dist/clipboard.d.ts +3 -3
  10. package/dist/clipboard.mjs +4 -4
  11. package/dist/clipboard.mjs.map +1 -1
  12. package/dist/datetime.cjs +13 -13
  13. package/dist/datetime.cjs.map +1 -1
  14. package/dist/datetime.d.ts +12 -12
  15. package/dist/datetime.mjs +13 -13
  16. package/dist/datetime.mjs.map +1 -1
  17. package/dist/element-plus.cjs +6 -6
  18. package/dist/element-plus.cjs.map +1 -1
  19. package/dist/element-plus.d.ts +6 -6
  20. package/dist/element-plus.mjs +6 -6
  21. package/dist/element-plus.mjs.map +1 -1
  22. package/dist/enum.cjs +12 -12
  23. package/dist/enum.cjs.map +1 -1
  24. package/dist/enum.d.ts +12 -12
  25. package/dist/enum.mjs +12 -12
  26. package/dist/enum.mjs.map +1 -1
  27. package/dist/env.cjs +4 -4
  28. package/dist/env.cjs.map +1 -1
  29. package/dist/env.d.ts +4 -4
  30. package/dist/env.mjs +4 -4
  31. package/dist/env.mjs.map +1 -1
  32. package/dist/general.cjs.map +1 -1
  33. package/dist/general.d.ts +5 -5
  34. package/dist/general.mjs.map +1 -1
  35. package/dist/math.cjs +4 -4
  36. package/dist/math.cjs.map +1 -1
  37. package/dist/math.d.ts +4 -4
  38. package/dist/math.mjs +4 -4
  39. package/dist/math.mjs.map +1 -1
  40. package/dist/number.cjs +3 -3
  41. package/dist/number.cjs.map +1 -1
  42. package/dist/number.d.ts +3 -3
  43. package/dist/number.mjs +3 -3
  44. package/dist/number.mjs.map +1 -1
  45. package/dist/object.cjs +4 -4
  46. package/dist/object.cjs.map +1 -1
  47. package/dist/object.d.ts +4 -4
  48. package/dist/object.mjs +4 -4
  49. package/dist/object.mjs.map +1 -1
  50. package/dist/random.cjs +7 -7
  51. package/dist/random.cjs.map +1 -1
  52. package/dist/random.d.ts +7 -7
  53. package/dist/random.mjs +7 -7
  54. package/dist/random.mjs.map +1 -1
  55. package/dist/storage/enhanced/local/core.cjs +11 -11
  56. package/dist/storage/enhanced/local/core.cjs.map +1 -1
  57. package/dist/storage/enhanced/local/core.d.ts +9 -9
  58. package/dist/storage/enhanced/local/core.mjs +11 -11
  59. package/dist/storage/enhanced/local/core.mjs.map +1 -1
  60. package/dist/storage/enhanced/local/keyed-store.cjs +3 -3
  61. package/dist/storage/enhanced/local/keyed-store.cjs.map +1 -1
  62. package/dist/storage/enhanced/local/keyed-store.d.ts +3 -3
  63. package/dist/storage/enhanced/local/keyed-store.mjs +3 -3
  64. package/dist/storage/enhanced/local/keyed-store.mjs.map +1 -1
  65. package/dist/storage/enhanced/redis/core.cjs +18 -18
  66. package/dist/storage/enhanced/redis/core.cjs.map +1 -1
  67. package/dist/storage/enhanced/redis/core.d.ts +16 -16
  68. package/dist/storage/enhanced/redis/core.mjs +18 -18
  69. package/dist/storage/enhanced/redis/core.mjs.map +1 -1
  70. package/dist/storage/enhanced/redis/keyed-store.cjs +4 -4
  71. package/dist/storage/enhanced/redis/keyed-store.cjs.map +1 -1
  72. package/dist/storage/enhanced/redis/keyed-store.d.ts +4 -4
  73. package/dist/storage/enhanced/redis/keyed-store.mjs +4 -4
  74. package/dist/storage/enhanced/redis/keyed-store.mjs.map +1 -1
  75. package/dist/storage/lru/keyed-store.cjs +3 -3
  76. package/dist/storage/lru/keyed-store.cjs.map +1 -1
  77. package/dist/storage/lru/keyed-store.d.ts +3 -3
  78. package/dist/storage/lru/keyed-store.mjs +3 -3
  79. package/dist/storage/lru/keyed-store.mjs.map +1 -1
  80. package/dist/string.cjs +5 -5
  81. package/dist/string.cjs.map +1 -1
  82. package/dist/string.d.ts +4 -4
  83. package/dist/string.mjs +5 -5
  84. package/dist/string.mjs.map +1 -1
  85. package/dist/url.cjs +3 -3
  86. package/dist/url.cjs.map +1 -1
  87. package/dist/url.d.ts +3 -3
  88. package/dist/url.mjs +3 -3
  89. package/dist/url.mjs.map +1 -1
  90. package/dist/vue.cjs +6 -6
  91. package/dist/vue.cjs.map +1 -1
  92. package/dist/vue.d.ts +6 -6
  93. package/dist/vue.mjs +6 -6
  94. package/dist/vue.mjs.map +1 -1
  95. package/dist/web.cjs +4 -4
  96. package/dist/web.cjs.map +1 -1
  97. package/dist/web.d.ts +4 -4
  98. package/dist/web.mjs +4 -4
  99. package/dist/web.mjs.map +1 -1
  100. package/package.json +2 -2
  101. package/src/buffer.ts +41 -0
  102. package/src/clipboard.ts +4 -4
  103. package/src/datetime.ts +13 -13
  104. package/src/element-plus.ts +6 -6
  105. package/src/enum.ts +12 -12
  106. package/src/env.ts +4 -4
  107. package/src/general.ts +5 -5
  108. package/src/math.ts +4 -4
  109. package/src/number.ts +3 -3
  110. package/src/object.ts +4 -4
  111. package/src/random.ts +7 -7
  112. package/src/storage/enhanced/local/core.ts +11 -11
  113. package/src/storage/enhanced/local/keyed-store.ts +3 -3
  114. package/src/storage/enhanced/redis/core.ts +18 -18
  115. package/src/storage/enhanced/redis/keyed-store.ts +4 -4
  116. package/src/storage/lru/keyed-store.ts +3 -3
  117. package/src/string.ts +5 -5
  118. package/src/url.ts +3 -3
  119. package/src/vue.ts +6 -6
  120. package/src/web.ts +4 -4
@@ -1 +1 @@
1
- {"version":3,"file":"random.cjs","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"],"names":[],"mappings":";;AAAA;;;;;;;;;;;;;;;;;;;AAmBG;AACG,SAAU,8BAA8B,CAC1C,SAAgC,EAChC,MAAc,EACd,MAAc,EACd,MAAc,EACd,MAAc,EAAA;AAEd,IAAA,MAAM,MAAM,GAAG,CAAC,GAAW,EAAE,GAAW,KAAK,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,MAAM,EAAE,IAAI,GAAG,GAAG,GAAG,GAAG,CAAC,CAAC,CAAC,GAAG,GAAG;IAC9F,MAAM,QAAQ,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC;AACvC,IAAA,MAAM,WAAW,GAAG,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,QAAQ,EAAE,MAAM,CAAC,EAAE,MAAM,CAAC;AAC9D,IAAA,OAAO,SAAS,CAAC,WAAW,CAAC;AACjC;;;;"}
1
+ {"version":3,"file":"random.cjs","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"],"names":[],"mappings":";;AAAA;;;;;;;;;;;;;;;;;;;AAmBG;AACG,SAAU,8BAA8B,CAC1C,SAAgC,EAChC,MAAc,EACd,MAAc,EACd,MAAc,EACd,MAAc,EAAA;AAEd,IAAA,MAAM,MAAM,GAAG,CAAC,GAAW,EAAE,GAAW,KAAK,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,MAAM,EAAE,IAAI,GAAG,GAAG,GAAG,GAAG,CAAC,CAAC,CAAC,GAAG,GAAG;IAC9F,MAAM,QAAQ,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC;AACvC,IAAA,MAAM,WAAW,GAAG,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,QAAQ,EAAE,MAAM,CAAC,EAAE,MAAM,CAAC;AAC9D,IAAA,OAAO,SAAS,CAAC,WAAW,CAAC;AACjC;;;;"}
package/dist/random.d.ts CHANGED
@@ -8,15 +8,15 @@
8
8
  *
9
9
  * This function supports any return type by using a generic type parameter.
10
10
  *
11
- * @template T - The return type of the generator function.
11
+ * @template T - The return type of the generator function
12
12
  *
13
- * @param {(length: number) => T} generator - A function that accepts a length and returns a value of type T.
14
- * @param {number} minMin - Lower bound of the first random range.
15
- * @param {number} minMax - Upper bound of the first random range.
16
- * @param {number} maxMin - Lower bound of the second random range.
17
- * @param {number} maxMax - Upper bound of the second random range.
13
+ * @param {(length: number) => T} generator - A function that accepts a length and returns a value of type T
14
+ * @param {number} minMin - Lower bound of the first random range
15
+ * @param {number} minMax - Upper bound of the first random range
16
+ * @param {number} maxMin - Lower bound of the second random range
17
+ * @param {number} maxMax - Upper bound of the second random range
18
18
  *
19
- * @returns {T} The result of the generator function using the computed final length.
19
+ * @returns {T} The result of the generator function using the computed final length
20
20
  */
21
21
  export declare function generateWithNestedRandomLength<T = string>(generator: (length: number) => T, minMin: number, minMax: number, maxMin: number, maxMax: number): T;
22
22
  //# sourceMappingURL=random.d.ts.map
package/dist/random.mjs CHANGED
@@ -8,15 +8,15 @@
8
8
  *
9
9
  * This function supports any return type by using a generic type parameter.
10
10
  *
11
- * @template T - The return type of the generator function.
11
+ * @template T - The return type of the generator function
12
12
  *
13
- * @param {(length: number) => T} generator - A function that accepts a length and returns a value of type T.
14
- * @param {number} minMin - Lower bound of the first random range.
15
- * @param {number} minMax - Upper bound of the first random range.
16
- * @param {number} maxMin - Lower bound of the second random range.
17
- * @param {number} maxMax - Upper bound of the second random range.
13
+ * @param {(length: number) => T} generator - A function that accepts a length and returns a value of type T
14
+ * @param {number} minMin - Lower bound of the first random range
15
+ * @param {number} minMax - Upper bound of the first random range
16
+ * @param {number} maxMin - Lower bound of the second random range
17
+ * @param {number} maxMax - Upper bound of the second random range
18
18
  *
19
- * @returns {T} The result of the generator function using the computed final length.
19
+ * @returns {T} The result of the generator function using the computed final length
20
20
  */
21
21
  function generateWithNestedRandomLength(generator, minMin, minMax, maxMin, maxMax) {
22
22
  const random = (min, max) => Math.floor(Math.random() * (max - min + 1)) + min;
@@ -1 +1 @@
1
- {"version":3,"file":"random.mjs","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"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;AAmBG;AACG,SAAU,8BAA8B,CAC1C,SAAgC,EAChC,MAAc,EACd,MAAc,EACd,MAAc,EACd,MAAc,EAAA;AAEd,IAAA,MAAM,MAAM,GAAG,CAAC,GAAW,EAAE,GAAW,KAAK,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,MAAM,EAAE,IAAI,GAAG,GAAG,GAAG,GAAG,CAAC,CAAC,CAAC,GAAG,GAAG;IAC9F,MAAM,QAAQ,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC;AACvC,IAAA,MAAM,WAAW,GAAG,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,QAAQ,EAAE,MAAM,CAAC,EAAE,MAAM,CAAC;AAC9D,IAAA,OAAO,SAAS,CAAC,WAAW,CAAC;AACjC;;;;"}
1
+ {"version":3,"file":"random.mjs","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"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;AAmBG;AACG,SAAU,8BAA8B,CAC1C,SAAgC,EAChC,MAAc,EACd,MAAc,EACd,MAAc,EACd,MAAc,EAAA;AAEd,IAAA,MAAM,MAAM,GAAG,CAAC,GAAW,EAAE,GAAW,KAAK,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,MAAM,EAAE,IAAI,GAAG,GAAG,GAAG,GAAG,CAAC,CAAC,CAAC,GAAG,GAAG;IAC9F,MAAM,QAAQ,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC;AACvC,IAAA,MAAM,WAAW,GAAG,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,QAAQ,EAAE,MAAM,CAAC,EAAE,MAAM,CAAC;AAC9D,IAAA,OAAO,SAAS,CAAC,WAAW,CAAC;AACjC;;;;"}
@@ -32,11 +32,11 @@ const enhancedLocalStorage = Object.freeze({
32
32
  /**
33
33
  * Retrieves a value by key and decodes it using SuperJSON or raw string.
34
34
  *
35
- * @template T - The expected type of the value.
35
+ * @template T - The expected type of the value
36
36
  *
37
- * @param {string} key - The key of the value to retrieve.
37
+ * @param {string} key - The key of the value to retrieve
38
38
  *
39
- * @returns {null | T} The decoded value or null if not found.
39
+ * @returns {null | T} The decoded value or null if not found
40
40
  */
41
41
  getItem(key) {
42
42
  const rawValue = window.localStorage.getItem(key);
@@ -45,15 +45,15 @@ const enhancedLocalStorage = Object.freeze({
45
45
  /**
46
46
  * Checks whether a key exists in localStorage.
47
47
  *
48
- * @param {string} key - The key to check.
48
+ * @param {string} key - The key to check
49
49
  *
50
- * @returns {boolean} True if the key exists, false otherwise.
50
+ * @returns {boolean} True if the key exists, false otherwise
51
51
  */
52
52
  hasItem: (key) => window.localStorage.getItem(key) !== null,
53
53
  /**
54
54
  * Returns the number of items stored in localStorage.
55
55
  *
56
- * @returns {number} The number of items stored in localStorage.
56
+ * @returns {number} The number of items stored in localStorage
57
57
  */
58
58
  get length() {
59
59
  return window.localStorage.length;
@@ -61,14 +61,14 @@ const enhancedLocalStorage = Object.freeze({
61
61
  /**
62
62
  * Removes a specific key from localStorage.
63
63
  *
64
- * @param {string} key - The key to remove.
64
+ * @param {string} key - The key to remove
65
65
  */
66
66
  removeItem: (key) => window.localStorage.removeItem(key),
67
67
  /**
68
68
  * Stores a value in localStorage with automatic serialization.
69
69
  *
70
- * @param {string} key - The key to store the value under.
71
- * @param {any} value - The value to store.
70
+ * @param {string} key - The key to store the value under
71
+ * @param {any} value - The value to store
72
72
  */
73
73
  setItem: (key, value) => window.localStorage.setItem(key, encodeToStorageValue(value)),
74
74
  });
@@ -83,11 +83,11 @@ function decodeStorageValue(data) {
83
83
  return superjson.deserialize(JSON.parse(payload));
84
84
  }
85
85
  catch {
86
- throw new Error('[EnhancedLocalStorage] Failed to parse JSON payload.');
86
+ throw new Error('[EnhancedLocalStorage] Failed to parse JSON payload');
87
87
  }
88
88
  case StorageValueEncodingType.String: return payload;
89
89
  default:
90
- throw new Error(`[EnhancedLocalStorage] Unknown encoding type: ${type}.`);
90
+ throw new Error(`[EnhancedLocalStorage] Unknown encoding type: ${type}`);
91
91
  }
92
92
  }
93
93
  function encodeToStorageValue(value) {
@@ -1 +1 @@
1
- {"version":3,"file":"core.cjs","sources":["../../../../src/storage/enhanced/local/core.ts"],"sourcesContent":["import {\n deserialize,\n serialize,\n} from 'superjson';\n\nenum StorageValueEncodingType {\n Json = '0',\n String = '1',\n}\n\nconst customValueHeader = '​⁠';\nconst customValueHeaderLength = customValueHeader.length + 1;\nconst toCustomValue = (type: StorageValueEncodingType, payload: string) => `${customValueHeader}${type}${payload}`;\n\n/**\n * An enhanced localStorage wrapper that supports storing\n * complex data types (e.g. Dates, Maps, Sets) using SuperJSON encoding.\n *\n * This utility preserves type structure when saving and retrieving values.\n *\n * @example\n * ```typescript\n * import { enhancedLocalStorage } from '@kikiutils/shared/storage/enhanced/local';\n *\n * enhancedLocalStorage.setItem('user', { name: 'user', createdAt: new Date() });\n * const user = enhancedLocalStorage.getItem<{ name: string, createdAt: Date }>('user');\n * ```\n */\nexport const enhancedLocalStorage = Object.freeze({\n /**\n * Removes all items from localStorage.\n */\n clear: () => window.localStorage.clear(),\n /**\n * Retrieves a value by key and decodes it using SuperJSON or raw string.\n *\n * @template T - The expected type of the value.\n *\n * @param {string} key - The key of the value to retrieve.\n *\n * @returns {null | T} The decoded value or null if not found.\n */\n getItem<T = unknown>(key: string) {\n const rawValue = window.localStorage.getItem(key);\n return rawValue ? decodeStorageValue(rawValue) as T : null;\n },\n /**\n * Checks whether a key exists in localStorage.\n *\n * @param {string} key - The key to check.\n *\n * @returns {boolean} True if the key exists, false otherwise.\n */\n hasItem: (key: string) => window.localStorage.getItem(key) !== null,\n /**\n * Returns the number of items stored in localStorage.\n *\n * @returns {number} The number of items stored in localStorage.\n */\n get length() {\n return window.localStorage.length;\n },\n /**\n * Removes a specific key from localStorage.\n *\n * @param {string} key - The key to remove.\n */\n removeItem: (key: string) => window.localStorage.removeItem(key),\n /**\n * Stores a value in localStorage with automatic serialization.\n *\n * @param {string} key - The key to store the value under.\n * @param {any} value - The value to store.\n */\n setItem: (key: string, value: any) => window.localStorage.setItem(key, encodeToStorageValue(value)),\n});\n\nfunction decodeStorageValue(data: string) {\n if (!isCustomFormat(data)) return data;\n const payload = data.substring(customValueHeaderLength);\n const type = data.charAt(customValueHeader.length);\n switch (type) {\n case StorageValueEncodingType.Json:\n try {\n return deserialize(JSON.parse(payload));\n } catch {\n throw new Error('[EnhancedLocalStorage] Failed to parse JSON payload.');\n }\n case StorageValueEncodingType.String: return payload;\n default:\n throw new Error(`[EnhancedLocalStorage] Unknown encoding type: ${type}.`);\n }\n}\n\nfunction encodeToStorageValue(value: any) {\n if (typeof value === 'string') return toCustomValue(StorageValueEncodingType.String, value);\n return toCustomValue(StorageValueEncodingType.Json, JSON.stringify(serialize(value)));\n}\n\nfunction isCustomFormat(data: string) {\n return (\n data.length >= customValueHeaderLength\n && data[0] === customValueHeader[0]\n && data[1] === customValueHeader[1]\n );\n}\n"],"names":["deserialize","serialize"],"mappings":";;;;AAKA,IAAK,wBAGJ;AAHD,CAAA,UAAK,wBAAwB,EAAA;AACzB,IAAA,wBAAA,CAAA,MAAA,CAAA,GAAA,GAAU;AACV,IAAA,wBAAA,CAAA,QAAA,CAAA,GAAA,GAAY;AAChB,CAAC,EAHI,wBAAwB,KAAxB,wBAAwB,GAAA,EAAA,CAAA,CAAA;AAK7B,MAAM,iBAAiB,GAAG,IAAI;AAC9B,MAAM,uBAAuB,GAAG,iBAAiB,CAAC,MAAM,GAAG,CAAC;AAC5D,MAAM,aAAa,GAAG,CAAC,IAA8B,EAAE,OAAe,KAAK,CAAA,EAAG,iBAAiB,CAAA,EAAG,IAAI,CAAA,EAAG,OAAO,EAAE;AAElH;;;;;;;;;;;;;AAaG;AACI,MAAM,oBAAoB,GAAG,MAAM,CAAC,MAAM,CAAC;AAC9C;;AAEG;IACH,KAAK,EAAE,MAAM,MAAM,CAAC,YAAY,CAAC,KAAK,EAAE;AACxC;;;;;;;;AAQG;AACH,IAAA,OAAO,CAAc,GAAW,EAAA;QAC5B,MAAM,QAAQ,GAAG,MAAM,CAAC,YAAY,CAAC,OAAO,CAAC,GAAG,CAAC;AACjD,Q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,KAAK,KAAK,QAAQ;QAAE,OAAO,aAAa,CAAC,wBAAwB,CAAC,MAAM,EAAE,KAAK,CAAC;AAC3F,IAAA,OAAO,aAAa,CAAC,wBAAwB,CAAC,IAAI,EAAE,IAAI,CAAC,SAAS,CAACC,mBAAS,CAAC,KAAK,CAAC,CAAC,CAAC;AACzF;AAEA,SAAS,cAAc,CAAC,IAAY,EAAA;AAChC,IAAA,QACI,IAAI,CAAC,MAAM,IAAI;AACZ,WAAA,IAAI,CAAC,CAAC,CAAC,KAAK,iBAAiB,CAAC,CAAC;WAC/B,IAAI,CAAC,CAAC,CAAC,KAAK,iBAAiB,CAAC,CAAC,CAAC;AAE3C;;;;"}
1
+ {"version":3,"file":"core.cjs","sources":["../../../../src/storage/enhanced/local/core.ts"],"sourcesContent":["import {\n deserialize,\n serialize,\n} from 'superjson';\n\nenum StorageValueEncodingType {\n Json = '0',\n String = '1',\n}\n\nconst customValueHeader = '​⁠';\nconst customValueHeaderLength = customValueHeader.length + 1;\nconst toCustomValue = (type: StorageValueEncodingType, payload: string) => `${customValueHeader}${type}${payload}`;\n\n/**\n * An enhanced localStorage wrapper that supports storing\n * complex data types (e.g. Dates, Maps, Sets) using SuperJSON encoding.\n *\n * This utility preserves type structure when saving and retrieving values.\n *\n * @example\n * ```typescript\n * import { enhancedLocalStorage } from '@kikiutils/shared/storage/enhanced/local';\n *\n * enhancedLocalStorage.setItem('user', { name: 'user', createdAt: new Date() });\n * const user = enhancedLocalStorage.getItem<{ name: string, createdAt: Date }>('user');\n * ```\n */\nexport const enhancedLocalStorage = Object.freeze({\n /**\n * Removes all items from localStorage.\n */\n clear: () => window.localStorage.clear(),\n /**\n * Retrieves a value by key and decodes it using SuperJSON or raw string.\n *\n * @template T - The expected type of the value\n *\n * @param {string} key - The key of the value to retrieve\n *\n * @returns {null | T} The decoded value or null if not found\n */\n getItem<T = unknown>(key: string) {\n const rawValue = window.localStorage.getItem(key);\n return rawValue ? decodeStorageValue(rawValue) as T : null;\n },\n /**\n * Checks whether a key exists in localStorage.\n *\n * @param {string} key - The key to check\n *\n * @returns {boolean} True if the key exists, false otherwise\n */\n hasItem: (key: string) => window.localStorage.getItem(key) !== null,\n /**\n * Returns the number of items stored in localStorage.\n *\n * @returns {number} The number of items stored in localStorage\n */\n get length() {\n return window.localStorage.length;\n },\n /**\n * Removes a specific key from localStorage.\n *\n * @param {string} key - The key to remove\n */\n removeItem: (key: string) => window.localStorage.removeItem(key),\n /**\n * Stores a value in localStorage with automatic serialization.\n *\n * @param {string} key - The key to store the value under\n * @param {any} value - The value to store\n */\n setItem: (key: string, value: any) => window.localStorage.setItem(key, encodeToStorageValue(value)),\n});\n\nfunction decodeStorageValue(data: string) {\n if (!isCustomFormat(data)) return data;\n const payload = data.substring(customValueHeaderLength);\n const type = data.charAt(customValueHeader.length);\n switch (type) {\n case StorageValueEncodingType.Json:\n try {\n return deserialize(JSON.parse(payload));\n } catch {\n throw new Error('[EnhancedLocalStorage] Failed to parse JSON payload');\n }\n case StorageValueEncodingType.String: return payload;\n default:\n throw new Error(`[EnhancedLocalStorage] Unknown encoding type: ${type}`);\n }\n}\n\nfunction encodeToStorageValue(value: any) {\n if (typeof value === 'string') return toCustomValue(StorageValueEncodingType.String, value);\n return toCustomValue(StorageValueEncodingType.Json, JSON.stringify(serialize(value)));\n}\n\nfunction isCustomFormat(data: string) {\n return (\n data.length >= customValueHeaderLength\n && data[0] === customValueHeader[0]\n && data[1] === customValueHeader[1]\n );\n}\n"],"names":["deserialize","serialize"],"mappings":";;;;AAKA,IAAK,wBAGJ;AAHD,CAAA,UAAK,wBAAwB,EAAA;AACzB,IAAA,wBAAA,CAAA,MAAA,CAAA,GAAA,GAAU;AACV,IAAA,wBAAA,CAAA,QAAA,CAAA,GAAA,GAAY;AAChB,CAAC,EAHI,wBAAwB,KAAxB,wBAAwB,GAAA,EAAA,CAAA,CAAA;AAK7B,MAAM,iBAAiB,GAAG,IAAI;AAC9B,MAAM,uBAAuB,GAAG,iBAAiB,C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;IAClD,QAAQ,IAAI;QACR,KAAK,wBAAwB,CAAC,IAAI;AAC9B,YAAA,IAAI;gBACA,OAAOA,qBAAW,CAAC,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;YAC3C;AAAE,YAAA,MAAM;AACJ,gBAAA,MAAM,IAAI,KAAK,CAAC,qDAAqD,CAAC;YAC1E;AACJ,QAAA,KAAK,wBAAwB,CAAC,MAAM,EAAE,OAAO,OAAO;AACpD,QAAA;AACI,YAAA,MAAM,IAAI,KAAK,CAAC,iDAAiD,IAAI,CAAA,CAAE,CAAC;;AAEpF;AAEA,SAAS,oBAAoB,CAAC,KAAU,EAAA;IACpC,IAAI,OAAO,KAAK,KAAK,QAAQ;QAAE,OAAO,aAAa,CAAC,wBAAwB,CAAC,MAAM,EAAE,KAAK,CAAC;AAC3F,IAAA,OAAO,aAAa,CAAC,wBAAwB,CAAC,IAAI,EAAE,IAAI,CAAC,SAAS,CAACC,mBAAS,CAAC,KAAK,CAAC,CAAC,CAAC;AACzF;AAEA,SAAS,cAAc,CAAC,IAAY,EAAA;AAChC,IAAA,QACI,IAAI,CAAC,MAAM,IAAI;AACZ,WAAA,IAAI,CAAC,CAAC,CAAC,KAAK,iBAAiB,CAAC,CAAC;WAC/B,IAAI,CAAC,CAAC,CAAC,KAAK,iBAAiB,CAAC,CAAC,CAAC;AAE3C;;;;"}
@@ -20,38 +20,38 @@ export declare const enhancedLocalStorage: Readonly<{
20
20
  /**
21
21
  * Retrieves a value by key and decodes it using SuperJSON or raw string.
22
22
  *
23
- * @template T - The expected type of the value.
23
+ * @template T - The expected type of the value
24
24
  *
25
- * @param {string} key - The key of the value to retrieve.
25
+ * @param {string} key - The key of the value to retrieve
26
26
  *
27
- * @returns {null | T} The decoded value or null if not found.
27
+ * @returns {null | T} The decoded value or null if not found
28
28
  */
29
29
  getItem<T = unknown>(key: string): T | null;
30
30
  /**
31
31
  * Checks whether a key exists in localStorage.
32
32
  *
33
- * @param {string} key - The key to check.
33
+ * @param {string} key - The key to check
34
34
  *
35
- * @returns {boolean} True if the key exists, false otherwise.
35
+ * @returns {boolean} True if the key exists, false otherwise
36
36
  */
37
37
  hasItem: (key: string) => boolean;
38
38
  /**
39
39
  * Returns the number of items stored in localStorage.
40
40
  *
41
- * @returns {number} The number of items stored in localStorage.
41
+ * @returns {number} The number of items stored in localStorage
42
42
  */
43
43
  readonly length: number;
44
44
  /**
45
45
  * Removes a specific key from localStorage.
46
46
  *
47
- * @param {string} key - The key to remove.
47
+ * @param {string} key - The key to remove
48
48
  */
49
49
  removeItem: (key: string) => void;
50
50
  /**
51
51
  * Stores a value in localStorage with automatic serialization.
52
52
  *
53
- * @param {string} key - The key to store the value under.
54
- * @param {any} value - The value to store.
53
+ * @param {string} key - The key to store the value under
54
+ * @param {any} value - The value to store
55
55
  */
56
56
  setItem: (key: string, value: any) => void;
57
57
  }>;
@@ -30,11 +30,11 @@ const enhancedLocalStorage = Object.freeze({
30
30
  /**
31
31
  * Retrieves a value by key and decodes it using SuperJSON or raw string.
32
32
  *
33
- * @template T - The expected type of the value.
33
+ * @template T - The expected type of the value
34
34
  *
35
- * @param {string} key - The key of the value to retrieve.
35
+ * @param {string} key - The key of the value to retrieve
36
36
  *
37
- * @returns {null | T} The decoded value or null if not found.
37
+ * @returns {null | T} The decoded value or null if not found
38
38
  */
39
39
  getItem(key) {
40
40
  const rawValue = window.localStorage.getItem(key);
@@ -43,15 +43,15 @@ const enhancedLocalStorage = Object.freeze({
43
43
  /**
44
44
  * Checks whether a key exists in localStorage.
45
45
  *
46
- * @param {string} key - The key to check.
46
+ * @param {string} key - The key to check
47
47
  *
48
- * @returns {boolean} True if the key exists, false otherwise.
48
+ * @returns {boolean} True if the key exists, false otherwise
49
49
  */
50
50
  hasItem: (key) => window.localStorage.getItem(key) !== null,
51
51
  /**
52
52
  * Returns the number of items stored in localStorage.
53
53
  *
54
- * @returns {number} The number of items stored in localStorage.
54
+ * @returns {number} The number of items stored in localStorage
55
55
  */
56
56
  get length() {
57
57
  return window.localStorage.length;
@@ -59,14 +59,14 @@ const enhancedLocalStorage = Object.freeze({
59
59
  /**
60
60
  * Removes a specific key from localStorage.
61
61
  *
62
- * @param {string} key - The key to remove.
62
+ * @param {string} key - The key to remove
63
63
  */
64
64
  removeItem: (key) => window.localStorage.removeItem(key),
65
65
  /**
66
66
  * Stores a value in localStorage with automatic serialization.
67
67
  *
68
- * @param {string} key - The key to store the value under.
69
- * @param {any} value - The value to store.
68
+ * @param {string} key - The key to store the value under
69
+ * @param {any} value - The value to store
70
70
  */
71
71
  setItem: (key, value) => window.localStorage.setItem(key, encodeToStorageValue(value)),
72
72
  });
@@ -81,11 +81,11 @@ function decodeStorageValue(data) {
81
81
  return deserialize(JSON.parse(payload));
82
82
  }
83
83
  catch {
84
- throw new Error('[EnhancedLocalStorage] Failed to parse JSON payload.');
84
+ throw new Error('[EnhancedLocalStorage] Failed to parse JSON payload');
85
85
  }
86
86
  case StorageValueEncodingType.String: return payload;
87
87
  default:
88
- throw new Error(`[EnhancedLocalStorage] Unknown encoding type: ${type}.`);
88
+ throw new Error(`[EnhancedLocalStorage] Unknown encoding type: ${type}`);
89
89
  }
90
90
  }
91
91
  function encodeToStorageValue(value) {
@@ -1 +1 @@
1
- {"version":3,"file":"core.mjs","sources":["../../../../src/storage/enhanced/local/core.ts"],"sourcesContent":["import {\n deserialize,\n serialize,\n} from 'superjson';\n\nenum StorageValueEncodingType {\n Json = '0',\n String = '1',\n}\n\nconst customValueHeader = '​⁠';\nconst customValueHeaderLength = customValueHeader.length + 1;\nconst toCustomValue = (type: StorageValueEncodingType, payload: string) => `${customValueHeader}${type}${payload}`;\n\n/**\n * An enhanced localStorage wrapper that supports storing\n * complex data types (e.g. Dates, Maps, Sets) using SuperJSON encoding.\n *\n * This utility preserves type structure when saving and retrieving values.\n *\n * @example\n * ```typescript\n * import { enhancedLocalStorage } from '@kikiutils/shared/storage/enhanced/local';\n *\n * enhancedLocalStorage.setItem('user', { name: 'user', createdAt: new Date() });\n * const user = enhancedLocalStorage.getItem<{ name: string, createdAt: Date }>('user');\n * ```\n */\nexport const enhancedLocalStorage = Object.freeze({\n /**\n * Removes all items from localStorage.\n */\n clear: () => window.localStorage.clear(),\n /**\n * Retrieves a value by key and decodes it using SuperJSON or raw string.\n *\n * @template T - The expected type of the value.\n *\n * @param {string} key - The key of the value to retrieve.\n *\n * @returns {null | T} The decoded value or null if not found.\n */\n getItem<T = unknown>(key: string) {\n const rawValue = window.localStorage.getItem(key);\n return rawValue ? decodeStorageValue(rawValue) as T : null;\n },\n /**\n * Checks whether a key exists in localStorage.\n *\n * @param {string} key - The key to check.\n *\n * @returns {boolean} True if the key exists, false otherwise.\n */\n hasItem: (key: string) => window.localStorage.getItem(key) !== null,\n /**\n * Returns the number of items stored in localStorage.\n *\n * @returns {number} The number of items stored in localStorage.\n */\n get length() {\n return window.localStorage.length;\n },\n /**\n * Removes a specific key from localStorage.\n *\n * @param {string} key - The key to remove.\n */\n removeItem: (key: string) => window.localStorage.removeItem(key),\n /**\n * Stores a value in localStorage with automatic serialization.\n *\n * @param {string} key - The key to store the value under.\n * @param {any} value - The value to store.\n */\n setItem: (key: string, value: any) => window.localStorage.setItem(key, encodeToStorageValue(value)),\n});\n\nfunction decodeStorageValue(data: string) {\n if (!isCustomFormat(data)) return data;\n const payload = data.substring(customValueHeaderLength);\n const type = data.charAt(customValueHeader.length);\n switch (type) {\n case StorageValueEncodingType.Json:\n try {\n return deserialize(JSON.parse(payload));\n } catch {\n throw new Error('[EnhancedLocalStorage] Failed to parse JSON payload.');\n }\n case StorageValueEncodingType.String: return payload;\n default:\n throw new Error(`[EnhancedLocalStorage] Unknown encoding type: ${type}.`);\n }\n}\n\nfunction encodeToStorageValue(value: any) {\n if (typeof value === 'string') return toCustomValue(StorageValueEncodingType.String, value);\n return toCustomValue(StorageValueEncodingType.Json, JSON.stringify(serialize(value)));\n}\n\nfunction isCustomFormat(data: string) {\n return (\n data.length >= customValueHeaderLength\n && data[0] === customValueH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hanced/local/core.ts"],"sourcesContent":["import {\n deserialize,\n serialize,\n} from 'superjson';\n\nenum StorageValueEncodingType {\n Json = '0',\n String = '1',\n}\n\nconst customValueHeader = '​⁠';\nconst customValueHeaderLength = customValueHeader.length + 1;\nconst toCustomValue = (type: StorageValueEncodingType, payload: string) => `${customValueHeader}${type}${payload}`;\n\n/**\n * An enhanced localStorage wrapper that supports storing\n * complex data types (e.g. Dates, Maps, Sets) using SuperJSON encoding.\n *\n * This utility preserves type structure when saving and retrieving values.\n *\n * @example\n * ```typescript\n * import { enhancedLocalStorage } from '@kikiutils/shared/storage/enhanced/local';\n *\n * enhancedLocalStorage.setItem('user', { name: 'user', createdAt: new Date() });\n * const user = enhancedLocalStorage.getItem<{ name: string, createdAt: Date }>('user');\n * ```\n */\nexport const enhancedLocalStorage = Object.freeze({\n /**\n * Removes all items from localStorage.\n */\n clear: () => window.localStorage.clear(),\n /**\n * Retrieves a value by key and decodes it using SuperJSON or raw string.\n *\n * @template T - The expected type of the value\n *\n * @param {string} key - The key of the value to retrieve\n *\n * @returns {null | T} The decoded value or null if not found\n */\n getItem<T = unknown>(key: string) {\n const rawValue = window.localStorage.getItem(key);\n return rawValue ? decodeStorageValue(rawValue) as T : null;\n },\n /**\n * Checks whether a key exists in localStorage.\n *\n * @param {string} key - The key to check\n *\n * @returns {boolean} True if the key exists, false otherwise\n */\n hasItem: (key: string) => window.localStorage.getItem(key) !== null,\n /**\n * Returns the number of items stored in localStorage.\n *\n * @returns {number} The number of items stored in localStorage\n */\n get length() {\n return window.localStorage.length;\n },\n /**\n * Removes a specific key from localStorage.\n *\n * @param {string} key - The key to remove\n */\n removeItem: (key: string) => window.localStorage.removeItem(key),\n /**\n * Stores a value in localStorage with automatic serialization.\n *\n * @param {string} key - The key to store the value under\n * @param {any} value - The value to store\n */\n setItem: (key: string, value: any) => window.localStorage.setItem(key, encodeToStorageValue(value)),\n});\n\nfunction decodeStorageValue(data: string) {\n if (!isCustomFormat(data)) return data;\n const payload = data.substring(customValueHeaderLength);\n const type = data.charAt(customValueHeader.length);\n switch (type) {\n case StorageValueEncodingType.Json:\n try {\n return deserialize(JSON.parse(payload));\n } catch {\n throw new Error('[EnhancedLocalStorage] Failed to parse JSON payload');\n }\n case StorageValueEncodingType.String: return payload;\n default:\n throw new Error(`[EnhancedLocalStorage] Unknown encoding type: ${type}`);\n }\n}\n\nfunction encodeToStorageValue(value: any) {\n if (typeof value === 'string') return toCustomValue(StorageValueEncodingType.String, value);\n return toCustomValue(StorageValueEncodingType.Json, JSON.stringify(serialize(value)));\n}\n\nfunction isCustomFormat(data: string) {\n return (\n data.length >= customValueHeaderLength\n && data[0] === customValueHeader[0]\n && data[1] === customValueHeader[1]\n );\n}\n"],"names":[],"mappings":";;AAKA,IAAK,wBAGJ;AAHD,CAAA,UAAK,wBAAwB,EAAA;AACzB,IAAA,wBAAA,CAAA,MAAA,CAAA,GAAA,GAAU;AACV,IAAA,wBAAA,CAAA,QAAA,CAAA,GAAA,GAAY;AAChB,CAAC,EAHI,wBAAwB,KAAxB,wBAAwB,GAAA,EAAA,CAAA,CAAA;AAK7B,MAAM,iBAAiB,GAAG,IAAI;AAC9B,MAAM,uBAAuB,GAAG,iBAAiB,CAAC,MAAM,GAAG,CAAC;AAC5D,MAAM,aAAa,GAAG,CAAC,IAA8B,EAAE,OAAe,KAAK,CAAA,EAAG,iBAAiB,CAAA,EAAG,IAAI,CAAA,EAAG,OAAO,EAAE;AAElH;;;;;;;;;;;;;AAaG;AACI,MAAM,oBAAoB,GAAG,MAAM,CAAC,MAAM,CAAC;AAC9C;;AAEG;IACH,KAAK,EAAE,MAAM,MAAM,CAAC,YAAY,CAAC,KAAK,EAAE;AACxC;;;;;;;;AAQG;AACH,IAAA,OAAO,CAAc,GAAW,EAAA;QAC5B,MAAM,QAAQ,GAAG,MAAM,CAAC,YAAY,CAAC,OAAO,CAAC,GAAG,CAAC;AACjD,QAAA,OAAO,QAAQ,GAAG,kBAAkB,CAAC,QAAQ,CAAM,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MAAM,EAAE,KAAK,CAAC;AAC3F,IAAA,OAAO,aAAa,CAAC,wBAAwB,CAAC,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC,CAAC;AACzF;AAEA,SAAS,cAAc,CAAC,IAAY,EAAA;AAChC,IAAA,QACI,IAAI,CAAC,MAAM,IAAI;AACZ,WAAA,IAAI,CAAC,CAAC,CAAC,KAAK,iBAAiB,CAAC,CAAC;WAC/B,IAAI,CAAC,CAAC,CAAC,KAAK,iBAAiB,CAAC,CAAC,CAAC;AAE3C;;;;"}
@@ -9,9 +9,9 @@ const core = require('./core.cjs');
9
9
  * This utility allows you to abstract away key construction logic and work directly
10
10
  * with scoped key-value operations like `getItem`, `setItem`, and `removeItem`.
11
11
  *
12
- * @template D - The value type to store.
12
+ * @template D - The value type to store
13
13
  *
14
- * @returns A factory that accepts a key generator function and returns a scoped storage interface.
14
+ * @returns A factory that accepts a key generator function and returns a scoped storage interface
15
15
  *
16
16
  * @example
17
17
  * ```typescript
@@ -30,7 +30,7 @@ function createKeyedEnhancedLocalStore() {
30
30
  /**
31
31
  * Resolves the storage key from the given arguments.
32
32
  *
33
- * @returns {string} The final string key used internally.
33
+ * @returns {string} The final string key used internally
34
34
  */
35
35
  resolveKey: (...args) => getKeyFunction(...args),
36
36
  setItem: (value, ...args) => core.enhancedLocalStorage.setItem(getKeyFunction(...args), value),
@@ -1 +1 @@
1
- {"version":3,"file":"keyed-store.cjs","sources":["../../../../src/storage/enhanced/local/keyed-store.ts"],"sourcesContent":["import { enhancedLocalStorage } from './core';\n\n/**\n * Creates a reusable, type-safe storage interface based on `enhancedLocalStorage`\n * and a dynamic key-generation function.\n *\n * This utility allows you to abstract away key construction logic and work directly\n * with scoped key-value operations like `getItem`, `setItem`, and `removeItem`.\n *\n * @template D - The value type to store.\n *\n * @returns A factory that accepts a key generator function and returns a scoped storage interface.\n *\n * @example\n * ```typescript\n * import { createKeyedEnhancedLocalStore } from '@kikiutils/shared/storage/enhanced/local';\n *\n * const userStore = createKeyedEnhancedLocalStore<User>()((id: number) => `user:${id}`);\n * userStore.setItem({ id: 123, name: 'user' }, 123);\n * const user = userStore.getItem(123);\n * ```\n */\nexport function createKeyedEnhancedLocalStore<D = unknown>() {\n return <P extends any[]>(getKeyFunction: (...args: P) => string) => Object.freeze({\n getItem: (...args: P) => enhancedLocalStorage.getItem<D>(getKeyFunction(...args)),\n hasItem: (...args: P) => enhancedLocalStorage.hasItem(getKeyFunction(...args)),\n removeItem: (...args: P) => enhancedLocalStorage.removeItem(getKeyFunction(...args)),\n /**\n * Resolves the storage key from the given arguments.\n *\n * @returns {string} The final string key used internally.\n */\n resolveKey: (...args: P) => getKeyFunction(...args),\n setItem: (value: D, ...args: P) => enhancedLocalStorage.setItem(getKeyFunction(...args), value),\n });\n}\n"],"names":["enhancedLocalStorage"],"mappings":";;;;AAEA;;;;;;;;;;;;;;;;;;;AAmBG;SACa,6BAA6B,GAAA;IACzC,OAAO,CAAkB,cAAsC,KAAK,MAAM,CAAC,MAAM,CAAC;AAC9E,QAAA,OAAO,EAAE,CAAC,GAAG,IAAO,KAAKA,yBAAoB,CAAC,OAAO,CAAI,cAAc,CAAC,GAAG,IAAI,CAAC,CAAC;AACjF,QAAA,OAAO,EAAE,CAAC,GAAG,IAAO,KAAKA,yBAAoB,CAAC,OAAO,CAAC,cAAc,CAAC,GAAG,IAAI,CAAC,CAAC;AAC9E,QAAA,UAAU,EAAE,CAAC,GAAG,IAAO,KAAKA,yBAAoB,CAAC,UAAU,CAAC,cAAc,CAAC,GAAG,IAAI,CAAC,CAAC;AACpF;;;;AAIG;QACH,UAAU,EAAE,CAAC,GAAG,IAAO,KAAK,cAAc,CAAC,GAAG,IAAI,CAAC;QACnD,OAAO,EAAE,CAAC,KAAQ,EAAE,GAAG,IAAO,KAAKA,yBAAoB,CAAC,OAAO,CAAC,cAAc,CAAC,GAAG,IAAI,CAAC,EAAE,KAAK,CAAC;AAClG,KAAA,CAAC;AACN;;;;"}
1
+ {"version":3,"file":"keyed-store.cjs","sources":["../../../../src/storage/enhanced/local/keyed-store.ts"],"sourcesContent":["import { enhancedLocalStorage } from './core';\n\n/**\n * Creates a reusable, type-safe storage interface based on `enhancedLocalStorage`\n * and a dynamic key-generation function.\n *\n * This utility allows you to abstract away key construction logic and work directly\n * with scoped key-value operations like `getItem`, `setItem`, and `removeItem`.\n *\n * @template D - The value type to store\n *\n * @returns A factory that accepts a key generator function and returns a scoped storage interface\n *\n * @example\n * ```typescript\n * import { createKeyedEnhancedLocalStore } from '@kikiutils/shared/storage/enhanced/local';\n *\n * const userStore = createKeyedEnhancedLocalStore<User>()((id: number) => `user:${id}`);\n * userStore.setItem({ id: 123, name: 'user' }, 123);\n * const user = userStore.getItem(123);\n * ```\n */\nexport function createKeyedEnhancedLocalStore<D = unknown>() {\n return <P extends any[]>(getKeyFunction: (...args: P) => string) => Object.freeze({\n getItem: (...args: P) => enhancedLocalStorage.getItem<D>(getKeyFunction(...args)),\n hasItem: (...args: P) => enhancedLocalStorage.hasItem(getKeyFunction(...args)),\n removeItem: (...args: P) => enhancedLocalStorage.removeItem(getKeyFunction(...args)),\n /**\n * Resolves the storage key from the given arguments.\n *\n * @returns {string} The final string key used internally\n */\n resolveKey: (...args: P) => getKeyFunction(...args),\n setItem: (value: D, ...args: P) => enhancedLocalStorage.setItem(getKeyFunction(...args), value),\n });\n}\n"],"names":["enhancedLocalStorage"],"mappings":";;;;AAEA;;;;;;;;;;;;;;;;;;;AAmBG;SACa,6BAA6B,GAAA;IACzC,OAAO,CAAkB,cAAsC,KAAK,MAAM,CAAC,MAAM,CAAC;AAC9E,QAAA,OAAO,EAAE,CAAC,GAAG,IAAO,KAAKA,yBAAoB,CAAC,OAAO,CAAI,cAAc,CAAC,GAAG,IAAI,CAAC,CAAC;AACjF,QAAA,OAAO,EAAE,CAAC,GAAG,IAAO,KAAKA,yBAAoB,CAAC,OAAO,CAAC,cAAc,CAAC,GAAG,IAAI,CAAC,CAAC;AAC9E,QAAA,UAAU,EAAE,CAAC,GAAG,IAAO,KAAKA,yBAAoB,CAAC,UAAU,CAAC,cAAc,CAAC,GAAG,IAAI,CAAC,CAAC;AACpF;;;;AAIG;QACH,UAAU,EAAE,CAAC,GAAG,IAAO,KAAK,cAAc,CAAC,GAAG,IAAI,CAAC;QACnD,OAAO,EAAE,CAAC,KAAQ,EAAE,GAAG,IAAO,KAAKA,yBAAoB,CAAC,OAAO,CAAC,cAAc,CAAC,GAAG,IAAI,CAAC,EAAE,KAAK,CAAC;AAClG,KAAA,CAAC;AACN;;;;"}
@@ -5,9 +5,9 @@
5
5
  * This utility allows you to abstract away key construction logic and work directly
6
6
  * with scoped key-value operations like `getItem`, `setItem`, and `removeItem`.
7
7
  *
8
- * @template D - The value type to store.
8
+ * @template D - The value type to store
9
9
  *
10
- * @returns A factory that accepts a key generator function and returns a scoped storage interface.
10
+ * @returns A factory that accepts a key generator function and returns a scoped storage interface
11
11
  *
12
12
  * @example
13
13
  * ```typescript
@@ -25,7 +25,7 @@ export declare function createKeyedEnhancedLocalStore<D = unknown>(): <P extends
25
25
  /**
26
26
  * Resolves the storage key from the given arguments.
27
27
  *
28
- * @returns {string} The final string key used internally.
28
+ * @returns {string} The final string key used internally
29
29
  */
30
30
  resolveKey: (...args: P) => string;
31
31
  setItem: (value: D, ...args: P) => void;
@@ -7,9 +7,9 @@ import { enhancedLocalStorage } from './core.mjs';
7
7
  * This utility allows you to abstract away key construction logic and work directly
8
8
  * with scoped key-value operations like `getItem`, `setItem`, and `removeItem`.
9
9
  *
10
- * @template D - The value type to store.
10
+ * @template D - The value type to store
11
11
  *
12
- * @returns A factory that accepts a key generator function and returns a scoped storage interface.
12
+ * @returns A factory that accepts a key generator function and returns a scoped storage interface
13
13
  *
14
14
  * @example
15
15
  * ```typescript
@@ -28,7 +28,7 @@ function createKeyedEnhancedLocalStore() {
28
28
  /**
29
29
  * Resolves the storage key from the given arguments.
30
30
  *
31
- * @returns {string} The final string key used internally.
31
+ * @returns {string} The final string key used internally
32
32
  */
33
33
  resolveKey: (...args) => getKeyFunction(...args),
34
34
  setItem: (value, ...args) => enhancedLocalStorage.setItem(getKeyFunction(...args), value),
@@ -1 +1 @@
1
- {"version":3,"file":"keyed-store.mjs","sources":["../../../../src/storage/enhanced/local/keyed-store.ts"],"sourcesContent":["import { enhancedLocalStorage } from './core';\n\n/**\n * Creates a reusable, type-safe storage interface based on `enhancedLocalStorage`\n * and a dynamic key-generation function.\n *\n * This utility allows you to abstract away key construction logic and work directly\n * with scoped key-value operations like `getItem`, `setItem`, and `removeItem`.\n *\n * @template D - The value type to store.\n *\n * @returns A factory that accepts a key generator function and returns a scoped storage interface.\n *\n * @example\n * ```typescript\n * import { createKeyedEnhancedLocalStore } from '@kikiutils/shared/storage/enhanced/local';\n *\n * const userStore = createKeyedEnhancedLocalStore<User>()((id: number) => `user:${id}`);\n * userStore.setItem({ id: 123, name: 'user' }, 123);\n * const user = userStore.getItem(123);\n * ```\n */\nexport function createKeyedEnhancedLocalStore<D = unknown>() {\n return <P extends any[]>(getKeyFunction: (...args: P) => string) => Object.freeze({\n getItem: (...args: P) => enhancedLocalStorage.getItem<D>(getKeyFunction(...args)),\n hasItem: (...args: P) => enhancedLocalStorage.hasItem(getKeyFunction(...args)),\n removeItem: (...args: P) => enhancedLocalStorage.removeItem(getKeyFunction(...args)),\n /**\n * Resolves the storage key from the given arguments.\n *\n * @returns {string} The final string key used internally.\n */\n resolveKey: (...args: P) => getKeyFunction(...args),\n setItem: (value: D, ...args: P) => enhancedLocalStorage.setItem(getKeyFunction(...args), value),\n });\n}\n"],"names":[],"mappings":";;AAEA;;;;;;;;;;;;;;;;;;;AAmBG;SACa,6BAA6B,GAAA;IACzC,OAAO,CAAkB,cAAsC,KAAK,MAAM,CAAC,MAAM,CAAC;AAC9E,QAAA,OAAO,EAAE,CAAC,GAAG,IAAO,KAAK,oBAAoB,CAAC,OAAO,CAAI,cAAc,CAAC,GAAG,IAAI,CAAC,CAAC;AACjF,QAAA,OAAO,EAAE,CAAC,GAAG,IAAO,KAAK,oBAAoB,CAAC,OAAO,CAAC,cAAc,CAAC,GAAG,IAAI,CAAC,CAAC;AAC9E,QAAA,UAAU,EAAE,CAAC,GAAG,IAAO,KAAK,oBAAoB,CAAC,UAAU,CAAC,cAAc,CAAC,GAAG,IAAI,CAAC,CAAC;AACpF;;;;AAIG;QACH,UAAU,EAAE,CAAC,GAAG,IAAO,KAAK,cAAc,CAAC,GAAG,IAAI,CAAC;QACnD,OAAO,EAAE,CAAC,KAAQ,EAAE,GAAG,IAAO,KAAK,oBAAoB,CAAC,OAAO,CAAC,cAAc,CAAC,GAAG,IAAI,CAAC,EAAE,KAAK,CAAC;AAClG,KAAA,CAAC;AACN;;;;"}
1
+ {"version":3,"file":"keyed-store.mjs","sources":["../../../../src/storage/enhanced/local/keyed-store.ts"],"sourcesContent":["import { enhancedLocalStorage } from './core';\n\n/**\n * Creates a reusable, type-safe storage interface based on `enhancedLocalStorage`\n * and a dynamic key-generation function.\n *\n * This utility allows you to abstract away key construction logic and work directly\n * with scoped key-value operations like `getItem`, `setItem`, and `removeItem`.\n *\n * @template D - The value type to store\n *\n * @returns A factory that accepts a key generator function and returns a scoped storage interface\n *\n * @example\n * ```typescript\n * import { createKeyedEnhancedLocalStore } from '@kikiutils/shared/storage/enhanced/local';\n *\n * const userStore = createKeyedEnhancedLocalStore<User>()((id: number) => `user:${id}`);\n * userStore.setItem({ id: 123, name: 'user' }, 123);\n * const user = userStore.getItem(123);\n * ```\n */\nexport function createKeyedEnhancedLocalStore<D = unknown>() {\n return <P extends any[]>(getKeyFunction: (...args: P) => string) => Object.freeze({\n getItem: (...args: P) => enhancedLocalStorage.getItem<D>(getKeyFunction(...args)),\n hasItem: (...args: P) => enhancedLocalStorage.hasItem(getKeyFunction(...args)),\n removeItem: (...args: P) => enhancedLocalStorage.removeItem(getKeyFunction(...args)),\n /**\n * Resolves the storage key from the given arguments.\n *\n * @returns {string} The final string key used internally\n */\n resolveKey: (...args: P) => getKeyFunction(...args),\n setItem: (value: D, ...args: P) => enhancedLocalStorage.setItem(getKeyFunction(...args), value),\n });\n}\n"],"names":[],"mappings":";;AAEA;;;;;;;;;;;;;;;;;;;AAmBG;SACa,6BAA6B,GAAA;IACzC,OAAO,CAAkB,cAAsC,KAAK,MAAM,CAAC,MAAM,CAAC;AAC9E,QAAA,OAAO,EAAE,CAAC,GAAG,IAAO,KAAK,oBAAoB,CAAC,OAAO,CAAI,cAAc,CAAC,GAAG,IAAI,CAAC,CAAC;AACjF,QAAA,OAAO,EAAE,CAAC,GAAG,IAAO,KAAK,oBAAoB,CAAC,OAAO,CAAC,cAAc,CAAC,GAAG,IAAI,CAAC,CAAC;AAC9E,QAAA,UAAU,EAAE,CAAC,GAAG,IAAO,KAAK,oBAAoB,CAAC,UAAU,CAAC,cAAc,CAAC,GAAG,IAAI,CAAC,CAAC;AACpF;;;;AAIG;QACH,UAAU,EAAE,CAAC,GAAG,IAAO,KAAK,cAAc,CAAC,GAAG,IAAI,CAAC;QACnD,OAAO,EAAE,CAAC,KAAQ,EAAE,GAAG,IAAO,KAAK,oBAAoB,CAAC,OAAO,CAAC,cAAc,CAAC,GAAG,IAAI,CAAC,EAAE,KAAK,CAAC;AAClG,KAAA,CAAC;AACN;;;;"}
@@ -18,9 +18,9 @@ const customValueHeaderLength = customValueHeader.byteLength + 1;
18
18
  * This utility provides a typed, serializable key-value store backed by Redis,
19
19
  * supporting TTL operations and safe deserialization of complex types (e.g. Date, Map).
20
20
  *
21
- * @param {Redis | string} ioRedisInstanceOrUrl - Either an existing `ioredis` instance or a Redis connection string.
21
+ * @param {Redis | string} ioRedisInstanceOrUrl - Either an existing `ioredis` instance or a Redis connection string
22
22
  *
23
- * @returns A frozen object that wraps Redis commands with typed get/set logic and encoding.
23
+ * @returns A frozen object that wraps Redis commands with typed get/set logic and encoding
24
24
  *
25
25
  * @example
26
26
  * ```typescript
@@ -37,11 +37,11 @@ function createEnhancedRedisStorage(ioRedisInstanceOrUrl) {
37
37
  /**
38
38
  * Retrieves a value from Redis and decodes it.
39
39
  *
40
- * @template T - The expected return type.
40
+ * @template T - The expected return type
41
41
  *
42
- * @param {string} key - The Redis key.
42
+ * @param {string} key - The Redis key
43
43
  *
44
- * @returns {Promise<null | T>} The decoded value or null if not found.
44
+ * @returns {Promise<null | T>} The decoded value or null if not found
45
45
  */
46
46
  async getItem(key) {
47
47
  const rawValue = await instance.getBuffer(key);
@@ -50,24 +50,24 @@ function createEnhancedRedisStorage(ioRedisInstanceOrUrl) {
50
50
  /**
51
51
  * Gets the remaining TTL (in seconds) for a given key.
52
52
  *
53
- * @param {string} key - The Redis key.
53
+ * @param {string} key - The Redis key
54
54
  *
55
- * @returns {Promise<number>} The number of seconds until the key expires, or -1 if no expiration is set.
55
+ * @returns {Promise<number>} The number of seconds until the key expires, or -1 if no expiration is set
56
56
  */
57
57
  getItemTtl: (key) => instance.ttl(key),
58
58
  /**
59
59
  * Checks whether a key exists in Redis.
60
60
  *
61
- * @param {string} key - The Redis key.
61
+ * @param {string} key - The Redis key
62
62
  *
63
- * @returns {Promise<boolean>} True if the key exists, false otherwise.
63
+ * @returns {Promise<boolean>} True if the key exists, false otherwise
64
64
  */
65
65
  hasItem: async (key) => await instance.exists(key) === 1,
66
66
  /**
67
67
  * The underlying Redis instance, exposed for advanced operations.
68
68
  * Use with caution; most use cases should rely on the wrapper methods.
69
69
  *
70
- * @returns {Redis} The underlying Redis instance.
70
+ * @returns {Redis} The underlying Redis instance
71
71
  */
72
72
  get instance() {
73
73
  return instance;
@@ -75,7 +75,7 @@ function createEnhancedRedisStorage(ioRedisInstanceOrUrl) {
75
75
  /**
76
76
  * Removes a key from Redis.
77
77
  *
78
- * @param {string} key - The Redis key to delete.
78
+ * @param {string} key - The Redis key to delete
79
79
  *
80
80
  * @returns {Promise<boolean>} A Promise that resolves to `true` if the key was removed,
81
81
  * or `false` if it did not exist.
@@ -84,16 +84,16 @@ function createEnhancedRedisStorage(ioRedisInstanceOrUrl) {
84
84
  /**
85
85
  * Stores a value in Redis without expiration.
86
86
  *
87
- * @param {string} key - The Redis key.
88
- * @param {any} value - The value to store. Will be serialized.
87
+ * @param {string} key - The Redis key
88
+ * @param {any} value - The value to store. Will be serialized
89
89
  */
90
90
  setItem: (key, value) => instance.set(key, encodeToStorageValue(value)),
91
91
  /**
92
92
  * Stores a value in Redis with a time-to-live (TTL).
93
93
  *
94
- * @param {string} key - The Redis key.
95
- * @param {number} seconds - Expiration time in seconds.
96
- * @param {any} value - The value to store. Will be serialized.
94
+ * @param {string} key - The Redis key
95
+ * @param {number} seconds - Expiration time in seconds
96
+ * @param {any} value - The value to store. Will be serialized
97
97
  */
98
98
  setItemWithTtl(key, seconds, value) {
99
99
  return instance.setex(key, seconds, encodeToStorageValue(value));
@@ -112,11 +112,11 @@ function decodeStorageValue(data) {
112
112
  return superjson.deserialize(JSON.parse(payload.toString()));
113
113
  }
114
114
  catch {
115
- throw new Error('[RedisStorage] Failed to parse JSON payload.');
115
+ throw new Error('[RedisStorage] Failed to parse JSON payload');
116
116
  }
117
117
  case StorageValueEncodingType.String: return payload.toString();
118
118
  default:
119
- throw new Error(`[RedisStorage] Unknown encoding type: ${type}.`);
119
+ throw new Error(`[RedisStorage] Unknown encoding type: ${type}`);
120
120
  }
121
121
  }
122
122
  function encodeToStorageValue(value) {
@@ -1 +1 @@
1
- {"version":3,"file":"core.cjs","sources":["../../../../src/storage/enhanced/redis/core.ts"],"sourcesContent":["import { Buffer } from 'node:buffer';\n\nimport { Redis } from 'ioredis';\nimport {\n deserialize,\n serialize,\n} from 'superjson';\n\nenum StorageValueEncodingType {\n Buffer = 0,\n Json = 1,\n String = 2,\n}\n\nconst customValueHeader = Buffer.of(\n 0xE2,\n 0x81,\n 0xA0,\n);\n\nconst customValueHeaderLength = customValueHeader.byteLength + 1;\n\n/**\n * Creates an enhanced Redis-based storage interface using SuperJSON encoding.\n *\n * This utility provides a typed, serializable key-value store backed by Redis,\n * supporting TTL operations and safe deserialization of complex types (e.g. Date, Map).\n *\n * @param {Redis | string} ioRedisInstanceOrUrl - Either an existing `ioredis` instance or a Redis connection string.\n *\n * @returns A frozen object that wraps Redis commands with typed get/set logic and encoding.\n *\n * @example\n * ```typescript\n * import { createEnhancedRedisStorage } from '@kikiutils/shared/storage/enhanced/redis';\n *\n * const redisStorage = createEnhancedRedisStorage('redis://localhost');\n * await redisStorage.setItem('user:1', { name: 'user' });\n * const user = await redisStorage.getItem<{ name: string }>('user:1');\n * ```\n */\nexport function createEnhancedRedisStorage(ioRedisInstanceOrUrl: Redis | string) {\n const instance = ioRedisInstanceOrUrl instanceof Redis ? ioRedisInstanceOrUrl : new Redis(ioRedisInstanceOrUrl);\n return Object.freeze({\n /**\n * Retrieves a value from Redis and decodes it.\n *\n * @template T - The expected return type.\n *\n * @param {string} key - The Redis key.\n *\n * @returns {Promise<null | T>} The decoded value or null if not found.\n */\n async getItem<T = unknown>(key: string) {\n const rawValue = await instance.getBuffer(key);\n return rawValue ? decodeStorageValue(rawValue) as T : null;\n },\n /**\n * Gets the remaining TTL (in seconds) for a given key.\n *\n * @param {string} key - The Redis key.\n *\n * @returns {Promise<number>} The number of seconds until the key expires, or -1 if no expiration is set.\n */\n getItemTtl: (key: string) => instance.ttl(key),\n /**\n * Checks whether a key exists in Redis.\n *\n * @param {string} key - The Redis key.\n *\n * @returns {Promise<boolean>} True if the key exists, false otherwise.\n */\n hasItem: async (key: string) => await instance.exists(key) === 1,\n /**\n * The underlying Redis instance, exposed for advanced operations.\n * Use with caution; most use cases should rely on the wrapper methods.\n *\n * @returns {Redis} The underlying Redis instance.\n */\n get instance() {\n return instance;\n },\n /**\n * Removes a key from Redis.\n *\n * @param {string} key - The Redis key to delete.\n *\n * @returns {Promise<boolean>} A Promise that resolves to `true` if the key was removed,\n * or `false` if it did not exist.\n */\n removeItem: async (key: string) => await instance.del(key) === 1,\n /**\n * Stores a value in Redis without expiration.\n *\n * @param {string} key - The Redis key.\n * @param {any} value - The value to store. Will be serialized.\n */\n setItem: (key: string, value: any) => instance.set(key, encodeToStorageValue(value)),\n /**\n * Stores a value in Redis with a time-to-live (TTL).\n *\n * @param {string} key - The Redis key.\n * @param {number} seconds - Expiration time in seconds.\n * @param {any} value - The value to store. Will be serialized.\n */\n setItemWithTtl(key: string, seconds: number, value: any) {\n return instance.setex(key, seconds, encodeToStorageValue(value));\n },\n });\n}\n\nfunction decodeStorageValue(data: Buffer) {\n if (!isCustomFormat(data)) return data;\n const payload = data.subarray(customValueHeaderLength);\n const type = data[customValueHeader.byteLength];\n switch (type) {\n case StorageValueEncodingType.Buffer: return payload;\n case StorageValueEncodingType.Json:\n try {\n return deserialize(JSON.parse(payload.toString()));\n } catch {\n throw new Error('[RedisStorage] Failed to parse JSON payload.');\n }\n case StorageValueEncodingType.String: return payload.toString();\n default:\n throw new Error(`[RedisStorage] Unknown encoding type: ${type}.`);\n }\n}\n\nfunction encodeToStorageValue(value: any) {\n if (Buffer.isBuffer(value)) return toCustomValue(StorageValueEncodingType.Buffer, value);\n if (typeof value === 'string') return toCustomValue(StorageValueEncodingType.String, Buffer.from(value));\n return toCustomValue(StorageValueEncodingType.Json, Buffer.from(JSON.stringify(serialize(value))));\n}\n\nfunction isCustomFormat(buffer: Buffer) {\n return (\n buffer.length >= customValueHeaderLength\n && buffer[0] === customValueHeader[0]\n && buffer[1] === customValueHeader[1]\n && buffer[2] === customValueHeader[2]\n );\n}\n\nfunction toCustomValue(type: StorageValueEncodingType, payload: Buffer) {\n return Buffer.concat([\n customValueHeader,\n Buffer.of(type),\n payload,\n ]);\n}\n"],"names":["Buffer","Redis","deserialize","serialize"],"mappings":";;;;;;AAQA,IAAK,wBAIJ;AAJD,CAAA,UAAK,wBAAwB,EAAA;AACzB,IAAA,wBAAA,CAAA,wBAAA,CAAA,QAAA,CAAA,GAAA,CAAA,CAAA,GAAA,QAAU;AACV,IAAA,wBAAA,CAAA,wBAAA,CAAA,MAAA,CAAA,GAAA,CAAA,CAAA,GA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CAAC,KAAK,CAAC,CAAC;IACxG,OAAO,aAAa,CAAC,wBAAwB,CAAC,IAAI,EAAEA,kBAAM,CAAC,IAAI,CAAC,IAAI,CAAC,SAAS,CAACG,mBAAS,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;AACtG;AAEA,SAAS,cAAc,CAAC,MAAc,EAAA;AAClC,IAAA,QACI,MAAM,CAAC,MAAM,IAAI;AACd,WAAA,MAAM,CAAC,CAAC,CAAC,KAAK,iBAAiB,CAAC,CAAC;AACjC,WAAA,MAAM,CAAC,CAAC,CAAC,KAAK,iBAAiB,CAAC,CAAC;WACjC,MAAM,CAAC,CAAC,CAAC,KAAK,iBAAiB,CAAC,CAAC,CAAC;AAE7C;AAEA,SAAS,aAAa,CAAC,IAA8B,EAAE,OAAe,EAAA;IAClE,OAAOH,kBAAM,CAAC,MAAM,CAAC;QACjB,iBAAiB;AACjB,QAAAA,kBAAM,CAAC,EAAE,CAAC,IAAI,CAAC;QACf,OAAO;AACV,KAAA,CAAC;AACN;;;;"}
1
+ {"version":3,"file":"core.cjs","sources":["../../../../src/storage/enhanced/redis/core.ts"],"sourcesContent":["import { Buffer } from 'node:buffer';\n\nimport { Redis } from 'ioredis';\nimport {\n deserialize,\n serialize,\n} from 'superjson';\n\nenum StorageValueEncodingType {\n Buffer = 0,\n Json = 1,\n String = 2,\n}\n\nconst customValueHeader = Buffer.of(\n 0xE2,\n 0x81,\n 0xA0,\n);\n\nconst customValueHeaderLength = customValueHeader.byteLength + 1;\n\n/**\n * Creates an enhanced Redis-based storage interface using SuperJSON encoding.\n *\n * This utility provides a typed, serializable key-value store backed by Redis,\n * supporting TTL operations and safe deserialization of complex types (e.g. Date, Map).\n *\n * @param {Redis | string} ioRedisInstanceOrUrl - Either an existing `ioredis` instance or a Redis connection string\n *\n * @returns A frozen object that wraps Redis commands with typed get/set logic and encoding\n *\n * @example\n * ```typescript\n * import { createEnhancedRedisStorage } from '@kikiutils/shared/storage/enhanced/redis';\n *\n * const redisStorage = createEnhancedRedisStorage('redis://localhost');\n * await redisStorage.setItem('user:1', { name: 'user' });\n * const user = await redisStorage.getItem<{ name: string }>('user:1');\n * ```\n */\nexport function createEnhancedRedisStorage(ioRedisInstanceOrUrl: Redis | string) {\n const instance = ioRedisInstanceOrUrl instanceof Redis ? ioRedisInstanceOrUrl : new Redis(ioRedisInstanceOrUrl);\n return Object.freeze({\n /**\n * Retrieves a value from Redis and decodes it.\n *\n * @template T - The expected return type\n *\n * @param {string} key - The Redis key\n *\n * @returns {Promise<null | T>} The decoded value or null if not found\n */\n async getItem<T = unknown>(key: string) {\n const rawValue = await instance.getBuffer(key);\n return rawValue ? decodeStorageValue(rawValue) as T : null;\n },\n /**\n * Gets the remaining TTL (in seconds) for a given key.\n *\n * @param {string} key - The Redis key\n *\n * @returns {Promise<number>} The number of seconds until the key expires, or -1 if no expiration is set\n */\n getItemTtl: (key: string) => instance.ttl(key),\n /**\n * Checks whether a key exists in Redis.\n *\n * @param {string} key - The Redis key\n *\n * @returns {Promise<boolean>} True if the key exists, false otherwise\n */\n hasItem: async (key: string) => await instance.exists(key) === 1,\n /**\n * The underlying Redis instance, exposed for advanced operations.\n * Use with caution; most use cases should rely on the wrapper methods.\n *\n * @returns {Redis} The underlying Redis instance\n */\n get instance() {\n return instance;\n },\n /**\n * Removes a key from Redis.\n *\n * @param {string} key - The Redis key to delete\n *\n * @returns {Promise<boolean>} A Promise that resolves to `true` if the key was removed,\n * or `false` if it did not exist.\n */\n removeItem: async (key: string) => await instance.del(key) === 1,\n /**\n * Stores a value in Redis without expiration.\n *\n * @param {string} key - The Redis key\n * @param {any} value - The value to store. Will be serialized\n */\n setItem: (key: string, value: any) => instance.set(key, encodeToStorageValue(value)),\n /**\n * Stores a value in Redis with a time-to-live (TTL).\n *\n * @param {string} key - The Redis key\n * @param {number} seconds - Expiration time in seconds\n * @param {any} value - The value to store. Will be serialized\n */\n setItemWithTtl(key: string, seconds: number, value: any) {\n return instance.setex(key, seconds, encodeToStorageValue(value));\n },\n });\n}\n\nfunction decodeStorageValue(data: Buffer) {\n if (!isCustomFormat(data)) return data;\n const payload = data.subarray(customValueHeaderLength);\n const type = data[customValueHeader.byteLength];\n switch (type) {\n case StorageValueEncodingType.Buffer: return payload;\n case StorageValueEncodingType.Json:\n try {\n return deserialize(JSON.parse(payload.toString()));\n } catch {\n throw new Error('[RedisStorage] Failed to parse JSON payload');\n }\n case StorageValueEncodingType.String: return payload.toString();\n default:\n throw new Error(`[RedisStorage] Unknown encoding type: ${type}`);\n }\n}\n\nfunction encodeToStorageValue(value: any) {\n if (Buffer.isBuffer(value)) return toCustomValue(StorageValueEncodingType.Buffer, value);\n if (typeof value === 'string') return toCustomValue(StorageValueEncodingType.String, Buffer.from(value));\n return toCustomValue(StorageValueEncodingType.Json, Buffer.from(JSON.stringify(serialize(value))));\n}\n\nfunction isCustomFormat(buffer: Buffer) {\n return (\n buffer.length >= customValueHeaderLength\n && buffer[0] === customValueHeader[0]\n && buffer[1] === customValueHeader[1]\n && buffer[2] === customValueHeader[2]\n );\n}\n\nfunction toCustomValue(type: StorageValueEncodingType, payload: Buffer) {\n return Buffer.concat([\n customValueHeader,\n Buffer.of(type),\n payload,\n ]);\n}\n"],"names":["Buffer","Redis","deserialize","serialize"],"mappings":";;;;;;AAQA,IAAK,wBAIJ;AAJD,CAAA,UAAK,wBAAwB,EAAA;AACzB,IAAA,wBAAA,CAAA,wBAAA,CAAA,QAAA,CAAA,GAAA,CAAA,CAAA,GAAA,QAAU;AACV,IAAA,wBAAA,CAAA,wBAAA,CAAA,MAAA,CAAA,GAAA,CAAA,CAAA,GAAA,MAAQ;AACR,IAAA,wBAAA,CAAA,wBAAA,CAAA,QAAA,CAAA,GAAA,CAAA,CAAA,GAAA,QAAU;AACd,CAAC,EAJI,wBAAwB,KAAxB,wBAAwB,GAAA,EAAA,CAAA,CAAA;AAM7B,MAAM,iBAAiB,GAAGA,kBAAM,CAAC,EAAE,CAC/B,IAAI,EACJ,IAAI,EACJ,IA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