@openclaw/whatsapp 2026.7.1-beta.2 → 2026.7.1-beta.4

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 (516) hide show
  1. package/dist/{access-control-88UPniDc.js → access-control-DYE5dXna.js} +5 -3
  2. package/dist/{accounts-DgViSyJx.js → accounts-4YgwroRU.js} +1 -1
  3. package/dist/{action-runtime-hqza0J8B.js → action-runtime-DPahAqxV.js} +2 -2
  4. package/dist/action-runtime-api.js +1 -1
  5. package/dist/action-runtime.runtime.js +1 -1
  6. package/dist/{active-listener-CFwkn3ho.js → active-listener-B4SDebQ6.js} +1 -1
  7. package/dist/api.js +14 -13
  8. package/dist/{approval-handler.runtime-9_SV7vhc.js → approval-handler.runtime-DNWS4aYQ.js} +1 -1
  9. package/dist/auth-presence.js +1 -1
  10. package/dist/{auth-store-ECx4h57q.js → auth-store-Db-wfApd.js} +23 -13
  11. package/dist/call-tool-api.js +233 -0
  12. package/dist/{channel-fcXxWXic.js → channel-BWp7h1uY.js} +44 -18
  13. package/dist/channel-config-api.js +1 -1
  14. package/dist/channel-plugin-api.js +1 -1
  15. package/dist/{channel-react-action-Dgy9uUMl.js → channel-react-action-CKJHL_Wf.js} +3 -3
  16. package/dist/{channel.runtime-B4ThooGF.js → channel.runtime-CAssfx9p.js} +5 -5
  17. package/dist/{channel.setup-C_WEdyJR.js → channel.setup-CURc5rEt.js} +2 -2
  18. package/dist/{config-schema-CROZuhT-.js → config-schema-mBX2nmn1.js} +4 -0
  19. package/dist/{connection-controller-u-tfAFhJ.js → connection-controller-DkbrFSIn.js} +6 -5
  20. package/dist/connection-controller-registry-TSX_udJp.js +22 -0
  21. package/dist/contract-api.js +1 -1
  22. package/dist/{quoted-message-CpA_ujXK.js → group-session-key-BhC1RQOE.js} +31 -2
  23. package/dist/{identity-CmsTmkKR.js → identity-Dqft3mFA.js} +2 -1
  24. package/dist/index.js +9 -2
  25. package/dist/light-runtime-api.js +3 -3
  26. package/dist/{login-8lHwLmXj.js → login-C48y0jlx.js} +14 -7
  27. package/dist/{login-qr-BEZZqrTb.js → login-qr-BjId7dll.js} +7 -7
  28. package/dist/login-qr-runtime.js +1 -1
  29. package/dist/{monitor-BqkJ4MpT.js → monitor-DD8bXohk.js} +249 -160
  30. package/dist/runtime-api.js +9 -9
  31. package/dist/{send-i8Xk5mBQ.js → send-C5CpFcBG.js} +27 -9
  32. package/dist/{send-api-DndiBJhN.js → send-api-DLlXl8CH.js} +6 -5
  33. package/dist/{session-WU4SVP8f.js → session-DriaHt7V.js} +3 -3
  34. package/dist/{session-errors-CbsoQqoy.js → session-errors-BAj9D2La.js} +1 -22
  35. package/dist/{setup-core-KjSBbWX4.js → setup-core-DH-DFPLY.js} +4 -4
  36. package/dist/{setup-finalize-WedNP30s.js → setup-finalize-c8dl34sO.js} +3 -3
  37. package/dist/setup-plugin-api.js +1 -1
  38. package/dist/{setup-surface-IOdkbWsQ.js → setup-surface-DlWb0Z09.js} +3 -3
  39. package/dist/{socket-timing-DvMNkIge.js → socket-timing-DhbVFjah.js} +17 -5
  40. package/dist/{text-runtime-C88QkuU9.js → targets-runtime-C-GiVn6Y.js} +2 -3
  41. package/dist/text-runtime-DdX6-mC_.js +4 -0
  42. package/node_modules/@cacheable/memory/README.md +177 -0
  43. package/node_modules/@cacheable/memory/dist/index.cjs +867 -820
  44. package/node_modules/@cacheable/memory/dist/index.d.cts +382 -280
  45. package/node_modules/@cacheable/memory/dist/index.d.mts +412 -0
  46. package/node_modules/@cacheable/memory/dist/index.mjs +841 -0
  47. package/node_modules/@cacheable/memory/package.json +9 -9
  48. package/node_modules/@cacheable/utils/README.md +342 -8
  49. package/node_modules/@cacheable/utils/dist/index.cjs +1322 -619
  50. package/node_modules/@cacheable/utils/dist/index.d.cts +769 -173
  51. package/node_modules/@cacheable/utils/dist/index.d.mts +903 -0
  52. package/node_modules/@cacheable/utils/dist/index.mjs +1355 -0
  53. package/node_modules/@cacheable/utils/package.json +8 -8
  54. package/node_modules/@types/node/README.md +1 -1
  55. package/node_modules/@types/node/assert/strict.d.ts +10 -1
  56. package/node_modules/@types/node/assert.d.ts +144 -17
  57. package/node_modules/@types/node/async_hooks.d.ts +9 -9
  58. package/node_modules/@types/node/buffer.d.ts +64 -30
  59. package/node_modules/@types/node/child_process.d.ts +17 -21
  60. package/node_modules/@types/node/cluster.d.ts +13 -13
  61. package/node_modules/@types/node/console.d.ts +1 -1
  62. package/node_modules/@types/node/crypto.d.ts +471 -575
  63. package/node_modules/@types/node/diagnostics_channel.d.ts +274 -32
  64. package/node_modules/@types/node/dns.d.ts +15 -15
  65. package/node_modules/@types/node/events.d.ts +3 -3
  66. package/node_modules/@types/node/ffi.d.ts +486 -0
  67. package/node_modules/@types/node/fs/promises.d.ts +7 -4
  68. package/node_modules/@types/node/fs.d.ts +24 -18
  69. package/node_modules/@types/node/globals.d.ts +4 -4
  70. package/node_modules/@types/node/http.d.ts +30 -5
  71. package/node_modules/@types/node/http2.d.ts +5 -1
  72. package/node_modules/@types/node/index.d.ts +1 -3
  73. package/node_modules/@types/node/inspector.d.ts +1 -1
  74. package/node_modules/@types/node/module.d.ts +16 -45
  75. package/node_modules/@types/node/net.d.ts +1 -1
  76. package/node_modules/@types/node/os.d.ts +2 -2
  77. package/node_modules/@types/node/package.json +4 -4
  78. package/node_modules/@types/node/perf_hooks.d.ts +1 -9
  79. package/node_modules/@types/node/process.d.ts +25 -12
  80. package/node_modules/@types/node/quic.d.ts +92 -11
  81. package/node_modules/@types/node/readline.d.ts +12 -11
  82. package/node_modules/@types/node/repl.d.ts +10 -10
  83. package/node_modules/@types/node/sqlite.d.ts +56 -1
  84. package/node_modules/@types/node/stream/iter.d.ts +150 -0
  85. package/node_modules/@types/node/stream/promises.d.ts +2 -2
  86. package/node_modules/@types/node/stream/web.d.ts +1 -1
  87. package/node_modules/@types/node/stream.d.ts +37 -5
  88. package/node_modules/@types/node/test/reporters.d.ts +1 -1
  89. package/node_modules/@types/node/test.d.ts +120 -10
  90. package/node_modules/@types/node/tls.d.ts +1 -1
  91. package/node_modules/@types/node/ts5.6/index.d.ts +2 -4
  92. package/node_modules/@types/node/ts5.7/index.d.ts +1 -3
  93. package/node_modules/@types/node/url.d.ts +3 -3
  94. package/node_modules/@types/node/util/types.d.ts +1 -1
  95. package/node_modules/@types/node/util.d.ts +22 -22
  96. package/node_modules/@types/node/v8.d.ts +85 -3
  97. package/node_modules/@types/node/vm.d.ts +9 -9
  98. package/node_modules/@types/node/web-globals/domexception.d.ts +15 -0
  99. package/node_modules/@types/node/worker_threads.d.ts +10 -12
  100. package/node_modules/@types/node/zlib.d.ts +3 -3
  101. package/node_modules/cacheable/README.md +309 -30
  102. package/node_modules/cacheable/dist/index.cjs +1307 -1153
  103. package/node_modules/cacheable/dist/index.d.cts +741 -469
  104. package/node_modules/cacheable/dist/index.d.mts +766 -0
  105. package/node_modules/cacheable/dist/index.mjs +1210 -0
  106. package/node_modules/cacheable/package.json +10 -10
  107. package/node_modules/content-type/README.md +32 -57
  108. package/node_modules/content-type/dist/index.d.ts +26 -0
  109. package/node_modules/content-type/dist/index.js +170 -0
  110. package/node_modules/content-type/dist/index.js.map +1 -0
  111. package/node_modules/content-type/package.json +35 -25
  112. package/node_modules/media-typer/README.md +19 -33
  113. package/node_modules/media-typer/dist/index.d.ts +29 -0
  114. package/node_modules/media-typer/dist/index.js +64 -0
  115. package/node_modules/media-typer/dist/index.js.map +1 -0
  116. package/node_modules/media-typer/package.json +37 -22
  117. package/node_modules/music-metadata/lib/id3v1/ID3v1Parser.js +2 -2
  118. package/node_modules/music-metadata/lib/mp4/AtomToken.js +65 -13
  119. package/node_modules/music-metadata/lib/wav/WaveChunk.d.ts +10 -0
  120. package/node_modules/music-metadata/lib/wav/WaveChunk.js +13 -3
  121. package/node_modules/music-metadata/lib/wav/WaveParser.d.ts +1 -0
  122. package/node_modules/music-metadata/lib/wav/WaveParser.js +6 -5
  123. package/node_modules/music-metadata/package.json +5 -5
  124. package/node_modules/typebox/build/compile/validator.d.mts +2 -7
  125. package/node_modules/typebox/build/compile/validator.mjs +6 -36
  126. package/node_modules/typebox/build/error/errors.d.mts +1 -7
  127. package/node_modules/typebox/build/format/_idna.mjs +36 -6
  128. package/node_modules/typebox/build/format/_puny.mjs +4 -1
  129. package/node_modules/typebox/build/format/uuid.d.mts +2 -2
  130. package/node_modules/typebox/build/format/uuid.mjs +3 -3
  131. package/node_modules/typebox/build/guard/emit.d.mts +0 -4
  132. package/node_modules/typebox/build/guard/emit.mjs +0 -8
  133. package/node_modules/typebox/build/guard/guard.d.mts +4 -8
  134. package/node_modules/typebox/build/guard/guard.mjs +5 -13
  135. package/node_modules/typebox/build/schema/engine/boolean.d.mts +3 -3
  136. package/node_modules/typebox/build/schema/engine/boolean.mjs +4 -4
  137. package/node_modules/typebox/build/schema/engine/index.d.mts +0 -1
  138. package/node_modules/typebox/build/schema/engine/index.mjs +0 -1
  139. package/node_modules/typebox/build/schema/engine/schema.mjs +5 -10
  140. package/node_modules/typebox/build/schema/engine/type.mjs +14 -18
  141. package/node_modules/typebox/build/schema/types/dependencies.mjs +1 -1
  142. package/node_modules/typebox/build/schema/types/index.d.mts +0 -1
  143. package/node_modules/typebox/build/schema/types/index.mjs +0 -1
  144. package/node_modules/typebox/build/schema/types/schema.d.mts +1 -1
  145. package/node_modules/typebox/build/schema/types/schema.mjs +2 -2
  146. package/node_modules/typebox/build/system/locale/ar_001.mjs +0 -1
  147. package/node_modules/typebox/build/system/locale/bn_BD.mjs +0 -1
  148. package/node_modules/typebox/build/system/locale/cs_CZ.mjs +0 -1
  149. package/node_modules/typebox/build/system/locale/de_DE.mjs +0 -1
  150. package/node_modules/typebox/build/system/locale/el_GR.mjs +0 -1
  151. package/node_modules/typebox/build/system/locale/en_US.mjs +0 -1
  152. package/node_modules/typebox/build/system/locale/es_419.mjs +0 -1
  153. package/node_modules/typebox/build/system/locale/es_AR.mjs +0 -1
  154. package/node_modules/typebox/build/system/locale/es_ES.mjs +0 -1
  155. package/node_modules/typebox/build/system/locale/es_MX.mjs +0 -1
  156. package/node_modules/typebox/build/system/locale/fa_IR.mjs +0 -1
  157. package/node_modules/typebox/build/system/locale/fil_PH.mjs +0 -1
  158. package/node_modules/typebox/build/system/locale/fr_CA.mjs +0 -1
  159. package/node_modules/typebox/build/system/locale/fr_FR.mjs +0 -1
  160. package/node_modules/typebox/build/system/locale/ha_NG.mjs +0 -1
  161. package/node_modules/typebox/build/system/locale/hi_IN.mjs +0 -1
  162. package/node_modules/typebox/build/system/locale/hu_HU.mjs +0 -1
  163. package/node_modules/typebox/build/system/locale/id_ID.mjs +0 -1
  164. package/node_modules/typebox/build/system/locale/it_IT.mjs +0 -1
  165. package/node_modules/typebox/build/system/locale/ja_JP.mjs +0 -1
  166. package/node_modules/typebox/build/system/locale/ko_KR.mjs +0 -1
  167. package/node_modules/typebox/build/system/locale/ms_MY.mjs +0 -1
  168. package/node_modules/typebox/build/system/locale/nl_NL.mjs +0 -1
  169. package/node_modules/typebox/build/system/locale/pl_PL.mjs +0 -1
  170. package/node_modules/typebox/build/system/locale/pt_BR.mjs +0 -1
  171. package/node_modules/typebox/build/system/locale/pt_PT.mjs +0 -1
  172. package/node_modules/typebox/build/system/locale/ro_RO.mjs +0 -1
  173. package/node_modules/typebox/build/system/locale/ru_RU.mjs +0 -1
  174. package/node_modules/typebox/build/system/locale/sv_SE.mjs +0 -1
  175. package/node_modules/typebox/build/system/locale/sw_TZ.mjs +0 -1
  176. package/node_modules/typebox/build/system/locale/th_TH.mjs +0 -1
  177. package/node_modules/typebox/build/system/locale/tr_TR.mjs +0 -1
  178. package/node_modules/typebox/build/system/locale/uk_UA.mjs +0 -1
  179. package/node_modules/typebox/build/system/locale/ur_PK.mjs +0 -1
  180. package/node_modules/typebox/build/system/locale/vi_VN.mjs +0 -1
  181. package/node_modules/typebox/build/system/locale/yo_NG.mjs +0 -1
  182. package/node_modules/typebox/build/system/locale/zh_Hans.mjs +0 -1
  183. package/node_modules/typebox/build/system/locale/zh_Hant.mjs +0 -1
  184. package/node_modules/typebox/build/system/memory/clone.d.mts +2 -3
  185. package/node_modules/typebox/build/system/memory/clone.mjs +73 -26
  186. package/node_modules/typebox/build/system/settings/settings.d.mts +15 -0
  187. package/node_modules/typebox/build/system/settings/settings.mjs +3 -1
  188. package/node_modules/typebox/build/type/action/_add_immutable.d.mts +11 -0
  189. package/node_modules/typebox/build/type/action/_add_immutable.mjs +11 -0
  190. package/node_modules/typebox/build/type/action/_add_optional.d.mts +11 -0
  191. package/node_modules/typebox/build/type/action/_add_optional.mjs +11 -0
  192. package/node_modules/typebox/build/type/action/_add_readonly.d.mts +11 -0
  193. package/node_modules/typebox/build/type/action/_add_readonly.mjs +11 -0
  194. package/node_modules/typebox/build/type/action/_remove_immutable.d.mts +11 -0
  195. package/node_modules/typebox/build/type/action/_remove_immutable.mjs +11 -0
  196. package/node_modules/typebox/build/type/action/_remove_optional.d.mts +11 -0
  197. package/node_modules/typebox/build/type/action/_remove_optional.mjs +11 -0
  198. package/node_modules/typebox/build/type/action/_remove_readonly.d.mts +11 -0
  199. package/node_modules/typebox/build/type/action/_remove_readonly.mjs +11 -0
  200. package/node_modules/typebox/build/type/action/conditional.d.mts +2 -3
  201. package/node_modules/typebox/build/type/action/conditional.mjs +2 -1
  202. package/node_modules/typebox/build/type/action/index.d.mts +7 -4
  203. package/node_modules/typebox/build/type/action/index.mjs +7 -4
  204. package/node_modules/typebox/build/type/action/mapped.d.mts +2 -3
  205. package/node_modules/typebox/build/type/action/mapped.mjs +2 -1
  206. package/node_modules/typebox/build/type/action/module.d.mts +8 -7
  207. package/node_modules/typebox/build/type/action/module.mjs +7 -6
  208. package/node_modules/typebox/build/type/action/readonly_object.d.mts +0 -5
  209. package/node_modules/typebox/build/type/action/readonly_object.mjs +0 -5
  210. package/node_modules/typebox/build/type/action/with.d.mts +11 -0
  211. package/node_modules/typebox/build/type/action/with.mjs +11 -0
  212. package/node_modules/typebox/build/type/engine/call/distribute_arguments.mjs +1 -1
  213. package/node_modules/typebox/build/type/engine/call/instantiate.d.mts +1 -3
  214. package/node_modules/typebox/build/type/engine/call/instantiate.mjs +3 -2
  215. package/node_modules/typebox/build/type/engine/call/resolve_arguments.mjs +2 -2
  216. package/node_modules/typebox/build/type/engine/constructor_parameters/instantiate.d.mts +3 -4
  217. package/node_modules/typebox/build/type/engine/constructor_parameters/instantiate.mjs +2 -1
  218. package/node_modules/typebox/build/type/engine/cyclic/candidates.d.mts +2 -3
  219. package/node_modules/typebox/build/type/engine/cyclic/candidates.mjs +3 -6
  220. package/node_modules/typebox/build/type/engine/cyclic/check.d.mts +6 -9
  221. package/node_modules/typebox/build/type/engine/cyclic/check.mjs +10 -16
  222. package/node_modules/typebox/build/type/engine/cyclic/dependencies.d.mts +1 -4
  223. package/node_modules/typebox/build/type/engine/cyclic/dependencies.mjs +9 -15
  224. package/node_modules/typebox/build/type/engine/cyclic/extends.d.mts +1 -4
  225. package/node_modules/typebox/build/type/engine/cyclic/extends.mjs +8 -14
  226. package/node_modules/typebox/build/type/engine/cyclic/instantiate.d.mts +2 -5
  227. package/node_modules/typebox/build/type/engine/cyclic/instantiate.mjs +3 -2
  228. package/node_modules/typebox/build/type/engine/enum/index.d.mts +0 -1
  229. package/node_modules/typebox/build/type/engine/enum/index.mjs +0 -1
  230. package/node_modules/typebox/build/type/engine/evaluate/broaden.d.mts +1 -2
  231. package/node_modules/typebox/build/type/engine/evaluate/broaden.mjs +2 -6
  232. package/node_modules/typebox/build/type/engine/evaluate/composite.d.mts +10 -6
  233. package/node_modules/typebox/build/type/engine/evaluate/composite.mjs +10 -6
  234. package/node_modules/typebox/build/type/engine/evaluate/distribute.d.mts +2 -1
  235. package/node_modules/typebox/build/type/engine/evaluate/distribute.mjs +3 -3
  236. package/node_modules/typebox/build/type/engine/evaluate/evaluate.d.mts +17 -5
  237. package/node_modules/typebox/build/type/engine/evaluate/evaluate.mjs +34 -8
  238. package/node_modules/typebox/build/type/engine/exclude/operation.d.mts +5 -6
  239. package/node_modules/typebox/build/type/engine/exclude/operation.mjs +11 -12
  240. package/node_modules/typebox/build/type/engine/extract/operation.d.mts +5 -6
  241. package/node_modules/typebox/build/type/engine/extract/operation.mjs +11 -12
  242. package/node_modules/typebox/build/type/engine/immutable/instantiate_add.d.mts +10 -0
  243. package/node_modules/typebox/build/type/engine/immutable/instantiate_add.mjs +14 -0
  244. package/node_modules/typebox/build/type/engine/immutable/instantiate_remove.d.mts +10 -0
  245. package/node_modules/typebox/build/type/engine/immutable/instantiate_remove.mjs +14 -0
  246. package/node_modules/typebox/build/type/engine/index.d.mts +2 -2
  247. package/node_modules/typebox/build/type/engine/index.mjs +2 -2
  248. package/node_modules/typebox/build/type/engine/indexable/from_dependent.d.mts +5 -0
  249. package/node_modules/typebox/build/type/engine/indexable/from_dependent.mjs +8 -0
  250. package/node_modules/typebox/build/type/engine/indexable/from_enum.d.mts +3 -3
  251. package/node_modules/typebox/build/type/engine/indexable/from_enum.mjs +4 -4
  252. package/node_modules/typebox/build/type/engine/indexable/from_template_literal.d.mts +2 -2
  253. package/node_modules/typebox/build/type/engine/indexable/from_template_literal.mjs +3 -3
  254. package/node_modules/typebox/build/type/engine/indexable/from_type.d.mts +3 -1
  255. package/node_modules/typebox/build/type/engine/indexable/from_type.mjs +9 -6
  256. package/node_modules/typebox/build/type/engine/indexed/instantiate.d.mts +2 -1
  257. package/node_modules/typebox/build/type/engine/indexed/instantiate.mjs +5 -2
  258. package/node_modules/typebox/build/type/engine/instantiate.d.mts +44 -31
  259. package/node_modules/typebox/build/type/engine/instantiate.mjs +82 -83
  260. package/node_modules/typebox/build/type/engine/interface/instantiate.d.mts +3 -6
  261. package/node_modules/typebox/build/type/engine/intrinsics/from_template_literal.d.mts +2 -2
  262. package/node_modules/typebox/build/type/engine/intrinsics/from_template_literal.mjs +3 -3
  263. package/node_modules/typebox/build/type/engine/keyof/instantiate.d.mts +2 -1
  264. package/node_modules/typebox/build/type/engine/keyof/instantiate.mjs +5 -1
  265. package/node_modules/typebox/build/type/engine/mapped/mapped_operation.d.mts +4 -4
  266. package/node_modules/typebox/build/type/engine/mapped/mapped_operation.mjs +3 -3
  267. package/node_modules/typebox/build/type/engine/mapped/mapped_variants.d.mts +5 -4
  268. package/node_modules/typebox/build/type/engine/mapped/mapped_variants.mjs +10 -5
  269. package/node_modules/typebox/build/type/engine/module/instantiate.d.mts +7 -9
  270. package/node_modules/typebox/build/type/engine/module/instantiate.mjs +17 -15
  271. package/node_modules/typebox/build/type/engine/object/from_dependent.d.mts +5 -0
  272. package/node_modules/typebox/build/type/engine/object/from_dependent.mjs +8 -0
  273. package/node_modules/typebox/build/type/engine/object/from_type.d.mts +3 -1
  274. package/node_modules/typebox/build/type/engine/object/from_type.mjs +8 -5
  275. package/node_modules/typebox/build/type/engine/object/from_union.mjs +2 -2
  276. package/node_modules/typebox/build/type/engine/optional/instantiate_add.d.mts +10 -0
  277. package/node_modules/typebox/build/type/engine/optional/instantiate_add.mjs +14 -0
  278. package/node_modules/typebox/build/type/engine/optional/instantiate_remove.d.mts +10 -0
  279. package/node_modules/typebox/build/type/engine/optional/instantiate_remove.mjs +14 -0
  280. package/node_modules/typebox/build/type/engine/parameters/instantiate.d.mts +3 -4
  281. package/node_modules/typebox/build/type/engine/parameters/instantiate.mjs +2 -1
  282. package/node_modules/typebox/build/type/engine/partial/from_dependent.d.mts +5 -0
  283. package/node_modules/typebox/build/type/engine/partial/from_dependent.mjs +8 -0
  284. package/node_modules/typebox/build/type/engine/partial/from_intersect.d.mts +1 -1
  285. package/node_modules/typebox/build/type/engine/partial/from_intersect.mjs +3 -2
  286. package/node_modules/typebox/build/type/engine/partial/from_object.d.mts +2 -2
  287. package/node_modules/typebox/build/type/engine/partial/from_object.mjs +2 -2
  288. package/node_modules/typebox/build/type/engine/partial/from_type.d.mts +3 -1
  289. package/node_modules/typebox/build/type/engine/partial/from_type.mjs +7 -4
  290. package/node_modules/typebox/build/type/engine/priority/index.d.mts +1 -0
  291. package/node_modules/typebox/build/type/engine/priority/index.mjs +1 -0
  292. package/node_modules/typebox/build/type/engine/priority/priority.d.mts +20 -0
  293. package/node_modules/typebox/build/type/engine/priority/priority.mjs +28 -0
  294. package/node_modules/typebox/build/type/engine/readonly/instantiate_add.d.mts +10 -0
  295. package/node_modules/typebox/build/type/engine/readonly/instantiate_add.mjs +14 -0
  296. package/node_modules/typebox/build/type/engine/readonly/instantiate_remove.d.mts +10 -0
  297. package/node_modules/typebox/build/type/engine/readonly/instantiate_remove.mjs +14 -0
  298. package/node_modules/typebox/build/type/engine/readonly_object/from_array.d.mts +2 -2
  299. package/node_modules/typebox/build/type/engine/readonly_object/from_array.mjs +2 -2
  300. package/node_modules/typebox/build/type/engine/readonly_object/from_dependent.d.mts +5 -0
  301. package/node_modules/typebox/build/type/engine/readonly_object/from_dependent.mjs +8 -0
  302. package/node_modules/typebox/build/type/engine/readonly_object/from_intersect.d.mts +1 -1
  303. package/node_modules/typebox/build/type/engine/readonly_object/from_intersect.mjs +3 -2
  304. package/node_modules/typebox/build/type/engine/readonly_object/from_object.d.mts +2 -2
  305. package/node_modules/typebox/build/type/engine/readonly_object/from_object.mjs +2 -2
  306. package/node_modules/typebox/build/type/engine/readonly_object/from_tuple.d.mts +2 -2
  307. package/node_modules/typebox/build/type/engine/readonly_object/from_tuple.mjs +2 -2
  308. package/node_modules/typebox/build/type/engine/readonly_object/from_type.d.mts +3 -1
  309. package/node_modules/typebox/build/type/engine/readonly_object/from_type.mjs +8 -5
  310. package/node_modules/typebox/build/type/engine/record/from_key_enum.d.mts +2 -2
  311. package/node_modules/typebox/build/type/engine/record/from_key_enum.mjs +2 -2
  312. package/node_modules/typebox/build/type/engine/record/from_key_template_literal.d.mts +2 -2
  313. package/node_modules/typebox/build/type/engine/record/from_key_template_literal.mjs +2 -2
  314. package/node_modules/typebox/build/type/engine/ref/instantiate.d.mts +3 -3
  315. package/node_modules/typebox/build/type/engine/ref/instantiate.mjs +6 -6
  316. package/node_modules/typebox/build/type/engine/required/from_dependent.d.mts +5 -0
  317. package/node_modules/typebox/build/type/engine/required/from_dependent.mjs +8 -0
  318. package/node_modules/typebox/build/type/engine/required/from_intersect.d.mts +1 -1
  319. package/node_modules/typebox/build/type/engine/required/from_intersect.mjs +3 -2
  320. package/node_modules/typebox/build/type/engine/required/from_object.d.mts +2 -2
  321. package/node_modules/typebox/build/type/engine/required/from_object.mjs +2 -2
  322. package/node_modules/typebox/build/type/engine/required/from_type.d.mts +3 -1
  323. package/node_modules/typebox/build/type/engine/required/from_type.mjs +7 -4
  324. package/node_modules/typebox/build/type/engine/template_literal/decode.mjs +3 -3
  325. package/node_modules/typebox/build/type/engine/template_literal/encode.d.mts +2 -2
  326. package/node_modules/typebox/build/type/engine/template_literal/encode.mjs +6 -6
  327. package/node_modules/typebox/build/type/engine/template_literal/is_finite.mjs +1 -1
  328. package/node_modules/typebox/build/type/engine/template_literal/is_pattern.mjs +1 -0
  329. package/node_modules/typebox/build/type/engine/this/expand_this.d.mts +1 -4
  330. package/node_modules/typebox/build/type/engine/this/expand_this.mjs +7 -13
  331. package/node_modules/typebox/build/type/engine/with/instantiate.d.mts +8 -0
  332. package/node_modules/typebox/build/type/engine/{options → with}/instantiate.mjs +5 -5
  333. package/node_modules/typebox/build/type/extends/dependent.d.mts +6 -0
  334. package/node_modules/typebox/build/type/extends/dependent.mjs +6 -0
  335. package/node_modules/typebox/build/type/extends/enum.d.mts +4 -4
  336. package/node_modules/typebox/build/type/extends/enum.mjs +3 -2
  337. package/node_modules/typebox/build/type/extends/extends_left.d.mts +5 -7
  338. package/node_modules/typebox/build/type/extends/extends_left.mjs +24 -27
  339. package/node_modules/typebox/build/type/extends/extends_right.d.mts +7 -5
  340. package/node_modules/typebox/build/type/extends/extends_right.mjs +20 -15
  341. package/node_modules/typebox/build/type/extends/inference.mjs +1 -1
  342. package/node_modules/typebox/build/type/extends/object.d.mts +8 -1
  343. package/node_modules/typebox/build/type/extends/object.mjs +25 -3
  344. package/node_modules/typebox/build/type/extends/parameters.mjs +2 -2
  345. package/node_modules/typebox/build/type/extends/record.d.mts +13 -0
  346. package/node_modules/typebox/build/type/extends/record.mjs +23 -0
  347. package/node_modules/typebox/build/type/extends/template_literal.d.mts +3 -3
  348. package/node_modules/typebox/build/type/extends/template_literal.mjs +3 -3
  349. package/node_modules/typebox/build/type/extends/tuple.d.mts +3 -6
  350. package/node_modules/typebox/build/type/extends/tuple.mjs +6 -5
  351. package/node_modules/typebox/build/type/extends/union.mjs +2 -2
  352. package/node_modules/typebox/build/type/script/mapping.d.mts +84 -99
  353. package/node_modules/typebox/build/type/script/mapping.mjs +81 -85
  354. package/node_modules/typebox/build/type/script/parser.d.mts +40 -40
  355. package/node_modules/typebox/build/type/script/parser.mjs +22 -22
  356. package/node_modules/typebox/build/type/script/script.d.mts +3 -4
  357. package/node_modules/typebox/build/type/script/script.mjs +3 -2
  358. package/node_modules/typebox/build/type/script/token/internal/guard.d.mts +1 -1
  359. package/node_modules/typebox/build/type/script/token/internal/guard.mjs +1 -1
  360. package/node_modules/typebox/build/type/script/token/internal/take.mjs +1 -1
  361. package/node_modules/typebox/build/type/script/token/until.mjs +2 -2
  362. package/node_modules/typebox/build/type/types/_codec.d.mts +12 -12
  363. package/node_modules/typebox/build/type/types/_codec.mjs +0 -1
  364. package/node_modules/typebox/build/type/types/_immutable.d.mts +2 -9
  365. package/node_modules/typebox/build/type/types/_immutable.mjs +2 -10
  366. package/node_modules/typebox/build/type/types/_optional.d.mts +2 -9
  367. package/node_modules/typebox/build/type/types/_optional.mjs +2 -11
  368. package/node_modules/typebox/build/type/types/_readonly.d.mts +2 -9
  369. package/node_modules/typebox/build/type/types/_readonly.mjs +2 -10
  370. package/node_modules/typebox/build/type/types/_refine.d.mts +8 -10
  371. package/node_modules/typebox/build/type/types/_refine.mjs +1 -2
  372. package/node_modules/typebox/build/type/types/call.d.mts +3 -3
  373. package/node_modules/typebox/build/type/types/call.mjs +3 -2
  374. package/node_modules/typebox/build/type/types/deferred.d.mts +1 -0
  375. package/node_modules/typebox/build/type/types/deferred.mjs +1 -1
  376. package/node_modules/typebox/build/type/types/dependent.d.mts +17 -0
  377. package/node_modules/typebox/build/type/types/dependent.mjs +24 -0
  378. package/node_modules/typebox/build/type/types/enum.d.mts +3 -1
  379. package/node_modules/typebox/build/type/types/enum.mjs +5 -0
  380. package/node_modules/typebox/build/type/types/index.d.mts +1 -4
  381. package/node_modules/typebox/build/type/types/index.mjs +1 -4
  382. package/node_modules/typebox/build/type/types/number.d.mts +1 -1
  383. package/node_modules/typebox/build/type/types/number.mjs +1 -1
  384. package/node_modules/typebox/build/type/types/record.d.mts +13 -7
  385. package/node_modules/typebox/build/type/types/record.mjs +15 -9
  386. package/node_modules/typebox/build/type/types/static.d.mts +2 -5
  387. package/node_modules/typebox/build/typebox.d.mts +4 -8
  388. package/node_modules/typebox/build/typebox.mjs +4 -8
  389. package/node_modules/typebox/build/value/clean/clean.mjs +4 -2
  390. package/node_modules/typebox/build/value/clean/from_intersect.mjs +2 -2
  391. package/node_modules/typebox/build/value/clean/from_type.mjs +8 -10
  392. package/node_modules/typebox/build/value/clean/from_union.d.mts +1 -1
  393. package/node_modules/typebox/build/value/clean/from_union.mjs +1 -2
  394. package/node_modules/typebox/build/value/clone/clone.mjs +2 -73
  395. package/node_modules/typebox/build/value/codec/decode.mjs +4 -2
  396. package/node_modules/typebox/build/value/codec/encode.mjs +4 -2
  397. package/node_modules/typebox/build/value/codec/from_array.mjs +1 -4
  398. package/node_modules/typebox/build/value/codec/from_object.mjs +1 -4
  399. package/node_modules/typebox/build/value/codec/from_record.mjs +2 -7
  400. package/node_modules/typebox/build/value/codec/from_tuple.mjs +1 -4
  401. package/node_modules/typebox/build/value/codec/from_union.mjs +2 -3
  402. package/node_modules/typebox/build/value/convert/from_enum.mjs +3 -4
  403. package/node_modules/typebox/build/value/convert/from_template_literal.d.mts +1 -1
  404. package/node_modules/typebox/build/value/convert/from_template_literal.mjs +2 -3
  405. package/node_modules/typebox/build/value/convert/from_type.mjs +19 -21
  406. package/node_modules/typebox/build/value/create/from_enum.mjs +2 -2
  407. package/node_modules/typebox/build/value/create/from_type.mjs +23 -31
  408. package/node_modules/typebox/build/value/default/from_object.mjs +1 -1
  409. package/node_modules/typebox/build/value/default/from_type.mjs +8 -10
  410. package/node_modules/typebox/build/value/index.d.mts +0 -1
  411. package/node_modules/typebox/build/value/index.mjs +0 -1
  412. package/node_modules/typebox/build/value/repair/from_enum.mjs +2 -3
  413. package/node_modules/typebox/build/value/repair/from_type.mjs +24 -22
  414. package/node_modules/typebox/build/value/shared/union_priority_sort.d.mts +6 -2
  415. package/node_modules/typebox/build/value/shared/union_priority_sort.mjs +62 -26
  416. package/node_modules/typebox/build/value/value.d.mts +0 -1
  417. package/node_modules/typebox/build/value/value.mjs +0 -1
  418. package/node_modules/typebox/package.json +25 -25
  419. package/node_modules/typebox/readme.md +97 -80
  420. package/node_modules/undici-types/agent.d.ts +0 -2
  421. package/node_modules/undici-types/client.d.ts +25 -19
  422. package/node_modules/undici-types/dispatcher.d.ts +7 -33
  423. package/node_modules/undici-types/dispatcher1-wrapper.d.ts +7 -0
  424. package/node_modules/undici-types/fetch.d.ts +24 -4
  425. package/node_modules/undici-types/h2c-client.d.ts +6 -6
  426. package/node_modules/undici-types/handlers.d.ts +1 -2
  427. package/node_modules/undici-types/header.d.ts +5 -0
  428. package/node_modules/undici-types/index.d.ts +3 -1
  429. package/node_modules/undici-types/interceptors.d.ts +1 -1
  430. package/node_modules/undici-types/package.json +1 -1
  431. package/node_modules/undici-types/pool.d.ts +0 -2
  432. package/node_modules/undici-types/proxy-agent.d.ts +2 -2
  433. package/node_modules/undici-types/round-robin-pool.d.ts +0 -2
  434. package/node_modules/undici-types/snapshot-agent.d.ts +4 -0
  435. package/node_modules/undici-types/socks5-proxy-agent.d.ts +2 -2
  436. package/node_modules/undici-types/webidl.d.ts +0 -1
  437. package/npm-shrinkwrap.json +49 -41
  438. package/openclaw.plugin.json +12 -0
  439. package/package.json +5 -5
  440. package/node_modules/@cacheable/memory/dist/index.d.ts +0 -310
  441. package/node_modules/@cacheable/memory/dist/index.js +0 -807
  442. package/node_modules/@cacheable/utils/dist/index.d.ts +0 -307
  443. package/node_modules/@cacheable/utils/dist/index.js +0 -630
  444. package/node_modules/@types/node/compatibility/iterators.d.ts +0 -21
  445. package/node_modules/cacheable/dist/index.d.ts +0 -494
  446. package/node_modules/cacheable/dist/index.js +0 -1141
  447. package/node_modules/content-type/HISTORY.md +0 -29
  448. package/node_modules/content-type/index.js +0 -225
  449. package/node_modules/media-typer/HISTORY.md +0 -50
  450. package/node_modules/media-typer/index.js +0 -143
  451. package/node_modules/typebox/build/schema/engine/_guard.d.mts +0 -6
  452. package/node_modules/typebox/build/schema/engine/_guard.mjs +0 -26
  453. package/node_modules/typebox/build/schema/types/_guard.d.mts +0 -10
  454. package/node_modules/typebox/build/schema/types/_guard.mjs +0 -16
  455. package/node_modules/typebox/build/type/action/_optional.d.mts +0 -19
  456. package/node_modules/typebox/build/type/action/_optional.mjs +0 -40
  457. package/node_modules/typebox/build/type/action/_readonly.d.mts +0 -19
  458. package/node_modules/typebox/build/type/action/_readonly.mjs +0 -40
  459. package/node_modules/typebox/build/type/action/awaited.d.mts +0 -15
  460. package/node_modules/typebox/build/type/action/awaited.mjs +0 -15
  461. package/node_modules/typebox/build/type/action/options.d.mts +0 -11
  462. package/node_modules/typebox/build/type/action/options.mjs +0 -11
  463. package/node_modules/typebox/build/type/engine/awaited/instantiate.d.mts +0 -11
  464. package/node_modules/typebox/build/type/engine/awaited/instantiate.mjs +0 -20
  465. package/node_modules/typebox/build/type/engine/enum/enum_to_union.d.mts +0 -14
  466. package/node_modules/typebox/build/type/engine/enum/enum_to_union.mjs +0 -24
  467. package/node_modules/typebox/build/type/engine/options/index.d.mts +0 -1
  468. package/node_modules/typebox/build/type/engine/options/index.mjs +0 -1
  469. package/node_modules/typebox/build/type/engine/options/instantiate.d.mts +0 -8
  470. package/node_modules/typebox/build/type/extends/async_iterator.d.mts +0 -7
  471. package/node_modules/typebox/build/type/extends/async_iterator.mjs +0 -9
  472. package/node_modules/typebox/build/type/extends/iterator.d.mts +0 -7
  473. package/node_modules/typebox/build/type/extends/iterator.mjs +0 -9
  474. package/node_modules/typebox/build/type/extends/promise.d.mts +0 -7
  475. package/node_modules/typebox/build/type/extends/promise.mjs +0 -9
  476. package/node_modules/typebox/build/type/types/async_iterator.d.mts +0 -20
  477. package/node_modules/typebox/build/type/types/async_iterator.mjs +0 -28
  478. package/node_modules/typebox/build/type/types/base.d.mts +0 -50
  479. package/node_modules/typebox/build/type/types/base.mjs +0 -84
  480. package/node_modules/typebox/build/type/types/iterator.d.mts +0 -20
  481. package/node_modules/typebox/build/type/types/iterator.mjs +0 -28
  482. package/node_modules/typebox/build/type/types/promise.d.mts +0 -21
  483. package/node_modules/typebox/build/type/types/promise.mjs +0 -29
  484. package/node_modules/typebox/build/value/clean/from_base.d.mts +0 -2
  485. package/node_modules/typebox/build/value/clean/from_base.mjs +0 -4
  486. package/node_modules/typebox/build/value/convert/from_base.d.mts +0 -2
  487. package/node_modules/typebox/build/value/convert/from_base.mjs +0 -4
  488. package/node_modules/typebox/build/value/create/from_async_iterator.d.mts +0 -2
  489. package/node_modules/typebox/build/value/create/from_async_iterator.mjs +0 -5
  490. package/node_modules/typebox/build/value/create/from_base.d.mts +0 -2
  491. package/node_modules/typebox/build/value/create/from_base.mjs +0 -4
  492. package/node_modules/typebox/build/value/create/from_iterator.d.mts +0 -2
  493. package/node_modules/typebox/build/value/create/from_iterator.mjs +0 -5
  494. package/node_modules/typebox/build/value/create/from_promise.d.mts +0 -2
  495. package/node_modules/typebox/build/value/create/from_promise.mjs +0 -5
  496. package/node_modules/typebox/build/value/default/from_base.d.mts +0 -2
  497. package/node_modules/typebox/build/value/default/from_base.mjs +0 -5
  498. package/node_modules/typebox/build/value/mutate/error.d.mts +0 -3
  499. package/node_modules/typebox/build/value/mutate/error.mjs +0 -6
  500. package/node_modules/typebox/build/value/mutate/from_array.d.mts +0 -2
  501. package/node_modules/typebox/build/value/mutate/from_array.mjs +0 -16
  502. package/node_modules/typebox/build/value/mutate/from_object.d.mts +0 -2
  503. package/node_modules/typebox/build/value/mutate/from_object.mjs +0 -40
  504. package/node_modules/typebox/build/value/mutate/from_unknown.d.mts +0 -2
  505. package/node_modules/typebox/build/value/mutate/from_unknown.mjs +0 -7
  506. package/node_modules/typebox/build/value/mutate/from_value.d.mts +0 -2
  507. package/node_modules/typebox/build/value/mutate/from_value.mjs +0 -12
  508. package/node_modules/typebox/build/value/mutate/index.d.mts +0 -1
  509. package/node_modules/typebox/build/value/mutate/index.mjs +0 -1
  510. package/node_modules/typebox/build/value/mutate/mutate.d.mts +0 -11
  511. package/node_modules/typebox/build/value/mutate/mutate.mjs +0 -41
  512. package/node_modules/typebox/build/value/repair/from_base.d.mts +0 -2
  513. package/node_modules/typebox/build/value/repair/from_base.mjs +0 -8
  514. package/dist/{approval-resolver-e1hAVRRy.js → approval-resolver-DF-lu8k5.js} +1 -1
  515. /package/node_modules/typebox/build/type/engine/{awaited → with}/index.d.mts +0 -0
  516. /package/node_modules/typebox/build/type/engine/{awaited → with}/index.mjs +0 -0
@@ -0,0 +1,841 @@
1
+ import { HashAlgorithm, HashAlgorithm as HashAlgorithm$1, Stats, Stats as Stats$1, getOrSetSync, getOrSetSync as getOrSetSync$1, hash, hashToNumber, hashToNumberSync, shorthandToTime, wrapSync } from "@cacheable/utils";
2
+ import { Hookified } from "hookified";
3
+ import { Keyv } from "keyv";
4
+ //#region src/memory-lru.ts
5
+ var ListNode = class {
6
+ value;
7
+ prev = void 0;
8
+ next = void 0;
9
+ constructor(value) {
10
+ this.value = value;
11
+ }
12
+ };
13
+ var DoublyLinkedList = class {
14
+ head = void 0;
15
+ tail = void 0;
16
+ nodesMap = /* @__PURE__ */ new Map();
17
+ addToFront(value) {
18
+ const newNode = new ListNode(value);
19
+ if (this.head) {
20
+ newNode.next = this.head;
21
+ this.head.prev = newNode;
22
+ this.head = newNode;
23
+ } else this.head = this.tail = newNode;
24
+ this.nodesMap.set(value, newNode);
25
+ }
26
+ moveToFront(value) {
27
+ const node = this.nodesMap.get(value);
28
+ if (!node || this.head === node) return;
29
+ /* v8 ignore next -- @preserve */
30
+ if (node.prev) node.prev.next = node.next;
31
+ /* v8 ignore next -- @preserve */
32
+ if (node.next) node.next.prev = node.prev;
33
+ /* v8 ignore next -- @preserve */
34
+ if (node === this.tail) this.tail = node.prev;
35
+ node.prev = void 0;
36
+ node.next = this.head;
37
+ /* v8 ignore next -- @preserve */
38
+ if (this.head) this.head.prev = node;
39
+ this.head = node;
40
+ this.tail ??= node;
41
+ }
42
+ getOldest() {
43
+ /* v8 ignore next -- @preserve */
44
+ return this.tail ? this.tail.value : void 0;
45
+ }
46
+ removeOldest() {
47
+ /* v8 ignore next -- @preserve */
48
+ if (!this.tail) return;
49
+ const oldValue = this.tail.value;
50
+ /* v8 ignore next -- @preserve */
51
+ if (this.tail.prev) {
52
+ this.tail = this.tail.prev;
53
+ this.tail.next = void 0;
54
+ } else
55
+ /* v8 ignore next -- @preserve */
56
+ this.head = this.tail = void 0;
57
+ this.nodesMap.delete(oldValue);
58
+ return oldValue;
59
+ }
60
+ remove(value) {
61
+ const node = this.nodesMap.get(value);
62
+ if (!node) return false;
63
+ if (node.prev) node.prev.next = node.next;
64
+ else {
65
+ this.head = node.next;
66
+ if (this.head) this.head.prev = void 0;
67
+ }
68
+ if (node.next) node.next.prev = node.prev;
69
+ else {
70
+ this.tail = node.prev;
71
+ if (this.tail) this.tail.next = void 0;
72
+ }
73
+ this.nodesMap.delete(value);
74
+ return true;
75
+ }
76
+ get size() {
77
+ return this.nodesMap.size;
78
+ }
79
+ };
80
+ //#endregion
81
+ //#region src/keyv-memory.ts
82
+ var KeyvCacheableMemory = class {
83
+ opts = {
84
+ ttl: 0,
85
+ useClone: true,
86
+ lruSize: 0,
87
+ checkInterval: 0
88
+ };
89
+ _defaultCache = new CacheableMemory();
90
+ _nCache = /* @__PURE__ */ new Map();
91
+ _namespace;
92
+ constructor(options) {
93
+ if (options) {
94
+ this.opts = options;
95
+ this._defaultCache = new CacheableMemory(options);
96
+ if (options.namespace) {
97
+ this._namespace = options.namespace;
98
+ this._nCache.set(this._namespace, new CacheableMemory(options));
99
+ }
100
+ }
101
+ }
102
+ get namespace() {
103
+ return this._namespace;
104
+ }
105
+ set namespace(value) {
106
+ this._namespace = value;
107
+ }
108
+ get store() {
109
+ return this.getStore(this._namespace);
110
+ }
111
+ async get(key) {
112
+ const result = this.getStore(this._namespace).get(key);
113
+ if (result) return result;
114
+ }
115
+ async getMany(keys) {
116
+ return this.getStore(this._namespace).getMany(keys);
117
+ }
118
+ async set(key, value, ttl) {
119
+ this.getStore(this._namespace).set(key, value, ttl);
120
+ }
121
+ async setMany(values) {
122
+ this.getStore(this._namespace).setMany(values);
123
+ }
124
+ async delete(key) {
125
+ this.getStore(this._namespace).delete(key);
126
+ return true;
127
+ }
128
+ async deleteMany(key) {
129
+ this.getStore(this._namespace).deleteMany(key);
130
+ return true;
131
+ }
132
+ async clear() {
133
+ this.getStore(this._namespace).clear();
134
+ }
135
+ async has(key) {
136
+ return this.getStore(this._namespace).has(key);
137
+ }
138
+ on(event, listener) {
139
+ this.getStore(this._namespace).on(event, listener);
140
+ return this;
141
+ }
142
+ getStore(namespace) {
143
+ if (!namespace) return this._defaultCache;
144
+ if (!this._nCache.has(namespace)) this._nCache.set(namespace, new CacheableMemory(this.opts));
145
+ return this._nCache.get(namespace);
146
+ }
147
+ };
148
+ /**
149
+ * Creates a new Keyv instance with a new KeyvCacheableMemory store. This also removes the serialize/deserialize methods from the Keyv instance for optimization.
150
+ * @param options
151
+ * @returns
152
+ */
153
+ function createKeyv(options) {
154
+ const store = new KeyvCacheableMemory(options);
155
+ const namespace = options?.namespace;
156
+ let ttl;
157
+ /* v8 ignore next -- @preserve */
158
+ if (options?.ttl && Number.isInteger(options.ttl)) ttl = options?.ttl;
159
+ const keyv = new Keyv({
160
+ store,
161
+ namespace,
162
+ ttl
163
+ });
164
+ keyv.serialize = void 0;
165
+ keyv.deserialize = void 0;
166
+ return keyv;
167
+ }
168
+ //#endregion
169
+ //#region src/index.ts
170
+ /**
171
+ * Lifecycle hooks fired by {@link CacheableMemory}. Register handlers with the inherited
172
+ * `onHook(hook, handler)` method. Hooks are dispatched synchronously via `hookSync`, which skips
173
+ * `async` handler functions entirely — register only synchronous handlers.
174
+ */
175
+ let CacheableMemoryHooks = /* @__PURE__ */ function(CacheableMemoryHooks) {
176
+ CacheableMemoryHooks["BEFORE_SET"] = "BEFORE_SET";
177
+ CacheableMemoryHooks["AFTER_SET"] = "AFTER_SET";
178
+ CacheableMemoryHooks["BEFORE_SET_MANY"] = "BEFORE_SET_MANY";
179
+ CacheableMemoryHooks["AFTER_SET_MANY"] = "AFTER_SET_MANY";
180
+ CacheableMemoryHooks["BEFORE_GET"] = "BEFORE_GET";
181
+ CacheableMemoryHooks["AFTER_GET"] = "AFTER_GET";
182
+ CacheableMemoryHooks["BEFORE_GET_MANY"] = "BEFORE_GET_MANY";
183
+ CacheableMemoryHooks["AFTER_GET_MANY"] = "AFTER_GET_MANY";
184
+ CacheableMemoryHooks["BEFORE_DELETE"] = "BEFORE_DELETE";
185
+ CacheableMemoryHooks["AFTER_DELETE"] = "AFTER_DELETE";
186
+ CacheableMemoryHooks["BEFORE_DELETE_MANY"] = "BEFORE_DELETE_MANY";
187
+ CacheableMemoryHooks["AFTER_DELETE_MANY"] = "AFTER_DELETE_MANY";
188
+ CacheableMemoryHooks["BEFORE_CLEAR"] = "BEFORE_CLEAR";
189
+ CacheableMemoryHooks["AFTER_CLEAR"] = "AFTER_CLEAR";
190
+ return CacheableMemoryHooks;
191
+ }({});
192
+ const defaultStoreHashSize = 16;
193
+ const maximumMapSize = 16777216;
194
+ var CacheableMemory = class extends Hookified {
195
+ _lru = new DoublyLinkedList();
196
+ _storeHashSize = 16;
197
+ _storeHashAlgorithm = HashAlgorithm$1.DJB2;
198
+ _store = Array.from({ length: this._storeHashSize }, () => /* @__PURE__ */ new Map());
199
+ _ttl;
200
+ _maxTtl;
201
+ _useClone = true;
202
+ _lruSize = 0;
203
+ _checkInterval = 0;
204
+ _interval = 0;
205
+ _stats = new Stats$1({ enabled: false });
206
+ /**
207
+ * @constructor
208
+ * @param {CacheableMemoryOptions} [options] - The options for the CacheableMemory
209
+ */
210
+ constructor(options) {
211
+ super();
212
+ if (options?.ttl) this.setTtl(options.ttl);
213
+ if (options?.maxTtl !== void 0) this.setMaxTtl(options.maxTtl);
214
+ if (options?.useClone !== void 0) this._useClone = options.useClone;
215
+ if (options?.stats) this._stats.enabled = options.stats;
216
+ if (options?.storeHashSize && options.storeHashSize > 0) this._storeHashSize = options.storeHashSize;
217
+ if (options?.lruSize) if (options.lruSize > 16777216) this.emit("error", /* @__PURE__ */ new Error(`LRU size cannot be larger than ${maximumMapSize} due to Map limitations.`));
218
+ else this._lruSize = options.lruSize;
219
+ if (options?.checkInterval) this._checkInterval = options.checkInterval;
220
+ if (options?.storeHashAlgorithm) this._storeHashAlgorithm = options.storeHashAlgorithm;
221
+ this._store = Array.from({ length: this._storeHashSize }, () => /* @__PURE__ */ new Map());
222
+ this.startIntervalCheck();
223
+ }
224
+ /**
225
+ * Gets the time-to-live
226
+ * @returns {number|string|undefined} - The time-to-live in miliseconds or a human-readable format. If undefined, it will not have a time-to-live.
227
+ */
228
+ get ttl() {
229
+ return this._ttl;
230
+ }
231
+ /**
232
+ * Sets the time-to-live
233
+ * @param {number|string|undefined} value - The time-to-live in miliseconds or a human-readable format (example '1s' = 1 second, '1h' = 1 hour). If undefined, it will not have a time-to-live.
234
+ */
235
+ set ttl(value) {
236
+ this.setTtl(value);
237
+ }
238
+ /**
239
+ * Gets the maximum time-to-live. When set, any TTL that exceeds this value is capped to maxTtl.
240
+ * Entries with no TTL will also be capped to maxTtl. Default is `undefined` (no maximum).
241
+ * @returns {number|string|undefined} - The maximum TTL in milliseconds, human-readable format, or undefined.
242
+ */
243
+ get maxTtl() {
244
+ return this._maxTtl;
245
+ }
246
+ /**
247
+ * Sets the maximum time-to-live. When set, any TTL that exceeds this value is capped to maxTtl.
248
+ * Entries with no TTL will also be capped to maxTtl.
249
+ * @param {number|string|undefined} value - The maximum TTL in milliseconds or human-readable format (e.g. '1s', '1h'). If undefined, no maximum is enforced.
250
+ */
251
+ set maxTtl(value) {
252
+ this.setMaxTtl(value);
253
+ }
254
+ /**
255
+ * Gets whether to use clone
256
+ * @returns {boolean} - If true, it will clone the value before returning it. If false, it will return the value directly. Default is true.
257
+ */
258
+ get useClone() {
259
+ return this._useClone;
260
+ }
261
+ /**
262
+ * Sets whether to use clone
263
+ * @param {boolean} value - If true, it will clone the value before returning it. If false, it will return the value directly. Default is true.
264
+ */
265
+ set useClone(value) {
266
+ this._useClone = value;
267
+ }
268
+ /**
269
+ * Gets the size of the LRU cache
270
+ * @returns {number} - The size of the LRU cache. If set to 0, it will not use LRU cache. Default is 0. If you are using LRU then the limit is based on Map() size 17mm.
271
+ */
272
+ get lruSize() {
273
+ return this._lruSize;
274
+ }
275
+ /**
276
+ * Sets the size of the LRU cache
277
+ * @param {number} value - The size of the LRU cache. If set to 0, it will not use LRU cache. Default is 0. If you are using LRU then the limit is based on Map() size 17mm.
278
+ */
279
+ set lruSize(value) {
280
+ if (value > 16777216) {
281
+ this.emit("error", /* @__PURE__ */ new Error(`LRU size cannot be larger than ${maximumMapSize} due to Map limitations.`));
282
+ return;
283
+ }
284
+ this._lruSize = value;
285
+ if (this._lruSize === 0) {
286
+ this._lru = new DoublyLinkedList();
287
+ return;
288
+ }
289
+ this.lruResize();
290
+ }
291
+ /**
292
+ * Gets the check interval
293
+ * @returns {number} - The interval to check for expired items. If set to 0, it will not check for expired items. Default is 0.
294
+ */
295
+ get checkInterval() {
296
+ return this._checkInterval;
297
+ }
298
+ /**
299
+ * Sets the check interval
300
+ * @param {number} value - The interval to check for expired items. If set to 0, it will not check for expired items. Default is 0.
301
+ */
302
+ set checkInterval(value) {
303
+ this._checkInterval = value;
304
+ }
305
+ /**
306
+ * Gets the size of the cache
307
+ * @returns {number} - The size of the cache
308
+ */
309
+ get size() {
310
+ let size = 0;
311
+ for (const store of this._store) size += store.size;
312
+ return size;
313
+ }
314
+ /**
315
+ * Gets the statistics of the cache. Statistics track aggregate counters such as `hits`, `misses`,
316
+ * `gets`, `sets`, `deletes`, `clears`, `count`, `ksize`, and `vsize`. They are disabled by default;
317
+ * enable them via the `stats` option or by setting `cache.stats.enabled = true`.
318
+ * @returns {Stats} - The statistics for this CacheableMemory instance
319
+ */
320
+ get stats() {
321
+ return this._stats;
322
+ }
323
+ /**
324
+ * Gets the number of hash stores
325
+ * @returns {number} - The number of hash stores
326
+ */
327
+ get storeHashSize() {
328
+ return this._storeHashSize;
329
+ }
330
+ /**
331
+ * Sets the number of hash stores. This will recreate the store and all data will be cleared
332
+ * @param {number} value - The number of hash stores
333
+ */
334
+ set storeHashSize(value) {
335
+ if (value === this._storeHashSize) return;
336
+ this._storeHashSize = value;
337
+ this._store = Array.from({ length: this._storeHashSize }, () => /* @__PURE__ */ new Map());
338
+ if (this._stats.enabled) this._stats.resetStoreValues();
339
+ }
340
+ /**
341
+ * Gets the store hash algorithm
342
+ * @returns {HashAlgorithm | StoreHashAlgorithmFunction} - The store hash algorithm
343
+ */
344
+ get storeHashAlgorithm() {
345
+ return this._storeHashAlgorithm;
346
+ }
347
+ /**
348
+ * Sets the store hash algorithm. This will recreate the store and all data will be cleared
349
+ * @param {HashAlgorithm | HashAlgorithmFunction} value - The store hash algorithm
350
+ */
351
+ set storeHashAlgorithm(value) {
352
+ this._storeHashAlgorithm = value;
353
+ }
354
+ /**
355
+ * Gets the keys
356
+ * @returns {IterableIterator<string>} - The keys
357
+ */
358
+ get keys() {
359
+ const keys = [];
360
+ for (const store of this._store) for (const key of store.keys()) {
361
+ const item = store.get(key);
362
+ if (item && this.hasExpired(item)) {
363
+ this.recordExpiration(item);
364
+ store.delete(key);
365
+ this.lruRemove(key);
366
+ continue;
367
+ }
368
+ keys.push(key);
369
+ }
370
+ return keys.values();
371
+ }
372
+ /**
373
+ * Gets the items
374
+ * @returns {IterableIterator<CacheableStoreItem>} - The items
375
+ */
376
+ get items() {
377
+ const items = [];
378
+ for (const store of this._store) for (const item of store.values()) {
379
+ if (this.hasExpired(item)) {
380
+ this.recordExpiration(item);
381
+ store.delete(item.key);
382
+ this.lruRemove(item.key);
383
+ continue;
384
+ }
385
+ items.push(item);
386
+ }
387
+ return items.values();
388
+ }
389
+ /**
390
+ * Gets the store
391
+ * @returns {Array<Map<string, CacheableStoreItem>>} - The store
392
+ */
393
+ get store() {
394
+ return this._store;
395
+ }
396
+ /**
397
+ * Gets the value of the key
398
+ * @param {string} key - The key to get the value
399
+ * @returns {T | undefined} - The value of the key
400
+ */
401
+ get(key) {
402
+ this.hookSync("BEFORE_GET", key);
403
+ const store = this.getStore(key);
404
+ const item = store.get(key);
405
+ if (!item) {
406
+ this.recordRead(false);
407
+ this.hookSync("AFTER_GET", {
408
+ key,
409
+ result: void 0
410
+ });
411
+ return;
412
+ }
413
+ if (item.expires && Date.now() > item.expires) {
414
+ this.recordExpiration(item);
415
+ store.delete(key);
416
+ this.lruRemove(key);
417
+ this.recordRead(false);
418
+ this.hookSync("AFTER_GET", {
419
+ key,
420
+ result: void 0
421
+ });
422
+ return;
423
+ }
424
+ this.lruMoveToFront(key);
425
+ let result;
426
+ if (!this._useClone) result = item.value;
427
+ else result = this.clone(item.value);
428
+ this.recordRead(true);
429
+ this.hookSync("AFTER_GET", {
430
+ key,
431
+ result
432
+ });
433
+ return result;
434
+ }
435
+ /**
436
+ * Gets the values of the keys
437
+ * @param {string[]} keys - The keys to get the values
438
+ * @returns {T[]} - The values of the keys
439
+ */
440
+ getMany(keys) {
441
+ this.hookSync("BEFORE_GET_MANY", keys);
442
+ const result = [];
443
+ for (const key of keys) result.push(this.get(key));
444
+ this.hookSync("AFTER_GET_MANY", {
445
+ keys,
446
+ result
447
+ });
448
+ return result;
449
+ }
450
+ /**
451
+ * Gets the raw value of the key
452
+ * @param {string} key - The key to get the value
453
+ * @returns {CacheableStoreItem | undefined} - The raw value of the key
454
+ */
455
+ getRaw(key) {
456
+ const store = this.getStore(key);
457
+ const item = store.get(key);
458
+ if (!item) {
459
+ this.recordRead(false);
460
+ return;
461
+ }
462
+ if (item.expires && Date.now() > item.expires) {
463
+ this.recordExpiration(item);
464
+ store.delete(key);
465
+ this.lruRemove(key);
466
+ this.recordRead(false);
467
+ return;
468
+ }
469
+ this.lruMoveToFront(key);
470
+ this.recordRead(true);
471
+ return item;
472
+ }
473
+ /**
474
+ * Gets the raw values of the keys
475
+ * @param {string[]} keys - The keys to get the values
476
+ * @returns {CacheableStoreItem[]} - The raw values of the keys
477
+ */
478
+ getManyRaw(keys) {
479
+ const result = [];
480
+ for (const key of keys) result.push(this.getRaw(key));
481
+ return result;
482
+ }
483
+ /**
484
+ * Sets the value of the key
485
+ * @param {string} key - The key to set the value
486
+ * @param {any} value - The value to set
487
+ * @param {number|string|SetOptions} [ttl] - Time to Live - If you set a number it is miliseconds, if you set a string it is a human-readable.
488
+ * If you want to set expire directly you can do that by setting the expire property in the SetOptions.
489
+ * If you set undefined, it will use the default time-to-live. If both are undefined then it will not have a time-to-live.
490
+ * @returns {void}
491
+ */
492
+ set(key, value, ttl) {
493
+ const hookItem = {
494
+ key,
495
+ value,
496
+ ttl
497
+ };
498
+ this.hookSync("BEFORE_SET", hookItem);
499
+ const store = this.getStore(hookItem.key);
500
+ let expires;
501
+ const effectiveTtl = hookItem.ttl;
502
+ if (effectiveTtl !== void 0 || this._ttl !== void 0) if (typeof effectiveTtl === "object") {
503
+ if (effectiveTtl.expire) expires = typeof effectiveTtl.expire === "number" ? effectiveTtl.expire : effectiveTtl.expire.getTime();
504
+ if (effectiveTtl.ttl) {
505
+ const finalTtl = shorthandToTime(effectiveTtl.ttl);
506
+ /* v8 ignore next -- @preserve */
507
+ if (finalTtl !== void 0) expires = finalTtl;
508
+ }
509
+ } else {
510
+ const finalTtl = shorthandToTime(effectiveTtl ?? this._ttl);
511
+ /* v8 ignore next -- @preserve */
512
+ if (finalTtl !== void 0) expires = finalTtl;
513
+ }
514
+ if (this._maxTtl !== void 0) {
515
+ const maxExpires = shorthandToTime(this._maxTtl);
516
+ if (expires === void 0) expires = maxExpires;
517
+ else if (expires > maxExpires) expires = maxExpires;
518
+ }
519
+ if (this._lruSize > 0) if (store.has(hookItem.key)) this.lruMoveToFront(hookItem.key);
520
+ else {
521
+ this.lruAddToFront(hookItem.key);
522
+ if (this._lru.size > this._lruSize) {
523
+ const oldestKey = this._lru.getOldest();
524
+ /* v8 ignore next -- @preserve */
525
+ if (oldestKey) {
526
+ this._lru.removeOldest();
527
+ this.delete(oldestKey);
528
+ }
529
+ }
530
+ }
531
+ if (this._stats.enabled) {
532
+ const existing = store.get(hookItem.key);
533
+ if (existing) this._stats.decreaseVSize(existing.value);
534
+ else {
535
+ this._stats.incrementKSize(hookItem.key);
536
+ this._stats.incrementCount();
537
+ }
538
+ this._stats.incrementVSize(hookItem.value);
539
+ this._stats.incrementSets();
540
+ }
541
+ const item = {
542
+ key: hookItem.key,
543
+ value: hookItem.value,
544
+ expires
545
+ };
546
+ store.set(hookItem.key, item);
547
+ this.hookSync("AFTER_SET", hookItem);
548
+ }
549
+ /**
550
+ * Sets the values of the keys
551
+ * @param {CacheableItem[]} items - The items to set
552
+ * @returns {void}
553
+ */
554
+ setMany(items) {
555
+ this.hookSync("BEFORE_SET_MANY", items);
556
+ for (const item of items) this.set(item.key, item.value, item.ttl);
557
+ this.hookSync("AFTER_SET_MANY", items);
558
+ }
559
+ /**
560
+ * Checks if the key exists
561
+ * @param {string} key - The key to check
562
+ * @returns {boolean} - If true, the key exists. If false, the key does not exist.
563
+ */
564
+ has(key) {
565
+ const item = this.get(key);
566
+ return Boolean(item);
567
+ }
568
+ /**
569
+ * @function hasMany
570
+ * @param {string[]} keys - The keys to check
571
+ * @returns {boolean[]} - If true, the key exists. If false, the key does not exist.
572
+ */
573
+ hasMany(keys) {
574
+ const result = [];
575
+ for (const key of keys) {
576
+ const item = this.get(key);
577
+ result.push(Boolean(item));
578
+ }
579
+ return result;
580
+ }
581
+ /**
582
+ * Take will get the key and delete the entry from cache
583
+ * @param {string} key - The key to take
584
+ * @returns {T | undefined} - The value of the key
585
+ */
586
+ take(key) {
587
+ const item = this.get(key);
588
+ if (!item) return;
589
+ this.delete(key);
590
+ return item;
591
+ }
592
+ /**
593
+ * TakeMany will get the keys and delete the entries from cache
594
+ * @param {string[]} keys - The keys to take
595
+ * @returns {T[]} - The values of the keys
596
+ */
597
+ takeMany(keys) {
598
+ const result = [];
599
+ for (const key of keys) result.push(this.take(key));
600
+ return result;
601
+ }
602
+ /**
603
+ * Delete the key
604
+ * @param {string} key - The key to delete
605
+ * @returns {void}
606
+ */
607
+ delete(key) {
608
+ this.hookSync("BEFORE_DELETE", key);
609
+ const store = this.getStore(key);
610
+ if (this._stats.enabled) {
611
+ const item = store.get(key);
612
+ if (item) {
613
+ this._stats.decreaseKSize(key);
614
+ this._stats.decreaseVSize(item.value);
615
+ this._stats.decreaseCount();
616
+ this._stats.incrementDeletes();
617
+ }
618
+ }
619
+ store.delete(key);
620
+ this.lruRemove(key);
621
+ this.hookSync("AFTER_DELETE", key);
622
+ }
623
+ /**
624
+ * Delete the keys
625
+ * @param {string[]} keys - The keys to delete
626
+ * @returns {void}
627
+ */
628
+ deleteMany(keys) {
629
+ this.hookSync("BEFORE_DELETE_MANY", keys);
630
+ for (const key of keys) this.delete(key);
631
+ this.hookSync("AFTER_DELETE_MANY", keys);
632
+ }
633
+ /**
634
+ * Clear the cache
635
+ * @returns {void}
636
+ */
637
+ clear() {
638
+ this.hookSync("BEFORE_CLEAR");
639
+ this._store = Array.from({ length: this._storeHashSize }, () => /* @__PURE__ */ new Map());
640
+ this._lru = new DoublyLinkedList();
641
+ if (this._stats.enabled) {
642
+ this._stats.resetStoreValues();
643
+ this._stats.incrementClears();
644
+ }
645
+ this.hookSync("AFTER_CLEAR");
646
+ }
647
+ /**
648
+ * Get the store based on the key (internal use)
649
+ * @param {string} key - The key to get the store
650
+ * @returns {CacheableHashStore} - The store
651
+ */
652
+ getStore(key) {
653
+ const hash = this.getKeyStoreHash(key);
654
+ this._store[hash] ||= /* @__PURE__ */ new Map();
655
+ return this._store[hash];
656
+ }
657
+ /**
658
+ * Hash the key for which store to go to (internal use)
659
+ * @param {string} key - The key to hash
660
+ * Available algorithms are: SHA256, SHA1, MD5, and djb2Hash.
661
+ * @returns {number} - The hashed key as a number
662
+ */
663
+ getKeyStoreHash(key) {
664
+ if (this._store.length === 1) return 0;
665
+ if (typeof this._storeHashAlgorithm === "function") return this._storeHashAlgorithm(key, this._storeHashSize);
666
+ return hashToNumberSync(key, {
667
+ min: 0,
668
+ max: this._storeHashSize - 1,
669
+ algorithm: this._storeHashAlgorithm
670
+ });
671
+ }
672
+ /**
673
+ * Clone the value. This is for internal use
674
+ * @param {any} value - The value to clone
675
+ * @returns {any} - The cloned value
676
+ */
677
+ clone(value) {
678
+ if (this.isPrimitive(value)) return value;
679
+ return structuredClone(value);
680
+ }
681
+ /**
682
+ * Add to the front of the LRU cache. This is for internal use
683
+ * @param {string} key - The key to add to the front
684
+ * @returns {void}
685
+ */
686
+ lruAddToFront(key) {
687
+ if (this._lruSize === 0) return;
688
+ this._lru.addToFront(key);
689
+ }
690
+ /**
691
+ * Move to the front of the LRU cache. This is for internal use
692
+ * @param {string} key - The key to move to the front
693
+ * @returns {void}
694
+ */
695
+ lruMoveToFront(key) {
696
+ if (this._lruSize === 0) return;
697
+ this._lru.moveToFront(key);
698
+ }
699
+ /**
700
+ * Remove a key from the LRU cache. This is for internal use
701
+ * @param {string} key - The key to remove
702
+ * @returns {void}
703
+ */
704
+ lruRemove(key) {
705
+ if (this._lruSize === 0) return;
706
+ this._lru.remove(key);
707
+ }
708
+ /**
709
+ * Resize the LRU cache. This is for internal use.
710
+ * @returns {void}
711
+ */
712
+ lruResize() {
713
+ while (this._lru.size > this._lruSize) {
714
+ const oldestKey = this._lru.getOldest();
715
+ /* v8 ignore next -- @preserve */
716
+ if (oldestKey) {
717
+ this._lru.removeOldest();
718
+ this.delete(oldestKey);
719
+ }
720
+ }
721
+ }
722
+ /**
723
+ * Check for expiration. This is for internal use
724
+ * @returns {void}
725
+ */
726
+ checkExpiration() {
727
+ for (const store of this._store) for (const item of store.values()) if (item.expires && Date.now() > item.expires) {
728
+ this.recordExpiration(item);
729
+ store.delete(item.key);
730
+ this.lruRemove(item.key);
731
+ }
732
+ }
733
+ /**
734
+ * Start the interval check. This is for internal use
735
+ * @returns {void}
736
+ */
737
+ startIntervalCheck() {
738
+ if (this._checkInterval > 0) {
739
+ /* v8 ignore next -- @preserve */
740
+ if (this._interval)
741
+ /* v8 ignore next -- @preserve */
742
+ clearInterval(this._interval);
743
+ this._interval = setInterval(() => {
744
+ this.checkExpiration();
745
+ }, this._checkInterval).unref();
746
+ }
747
+ }
748
+ /**
749
+ * Stop the interval check. This is for internal use
750
+ * @returns {void}
751
+ */
752
+ stopIntervalCheck() {
753
+ /* v8 ignore next -- @preserve */
754
+ if (this._interval) clearInterval(this._interval);
755
+ this._interval = 0;
756
+ this._checkInterval = 0;
757
+ }
758
+ /**
759
+ * Wrap the function for caching
760
+ * @param {Function} function_ - The function to wrap
761
+ * @param {Object} [options] - The options to wrap
762
+ * @returns {Function} - The wrapped function
763
+ */
764
+ wrap(function_, options) {
765
+ return wrapSync(function_, {
766
+ ttl: options?.ttl ?? this._ttl,
767
+ keyPrefix: options?.keyPrefix,
768
+ createKey: options?.createKey,
769
+ cache: this
770
+ });
771
+ }
772
+ /**
773
+ * Gets the value of the key, or computes and stores it on a cache miss. This is the synchronous
774
+ * cache-aside helper: if the key is present its value is returned, otherwise `function_` is
775
+ * invoked, its result is stored, and that result is returned.
776
+ *
777
+ * The value is stored using `options.ttl`, falling back to the instance default `ttl`. Because
778
+ * the cache is synchronous there is no request coalescing — concurrent callers cannot stampede
779
+ * the setter the way they can with an async cache.
780
+ * @param {GetOrSetSyncKey} key - The key to get or set. Can also be a function that returns the key.
781
+ * @param {() => T} function_ - The function that computes the value on a cache miss.
782
+ * @param {GetOrSetFunctionOptions} [options] - Options such as `ttl`, `cacheErrors`, and `throwErrors`.
783
+ * @returns {T | undefined} - The cached or freshly computed value
784
+ */
785
+ getOrSet(key, function_, options) {
786
+ return getOrSetSync$1(key, function_, {
787
+ cache: this,
788
+ ttl: options?.ttl ?? this._ttl,
789
+ cacheErrors: options?.cacheErrors,
790
+ throwErrors: options?.throwErrors
791
+ });
792
+ }
793
+ /**
794
+ * Records a single read against the statistics counters. Each read increments `gets` and either
795
+ * `hits` or `misses`. No-op when statistics are disabled. This is for internal use.
796
+ * @param {boolean} hit - Whether the read found a (non-expired) value
797
+ * @returns {void}
798
+ */
799
+ recordRead(hit) {
800
+ if (!this._stats.enabled) return;
801
+ if (hit) this._stats.incrementHits();
802
+ else this._stats.incrementMisses();
803
+ this._stats.incrementGets();
804
+ }
805
+ /**
806
+ * Decrements the size statistics (`count`, `ksize`, and `vsize`) for an entry that is being removed
807
+ * because it expired. Expirations are not counted as `deletes` since they are not user-initiated.
808
+ * No-op when statistics are disabled. This is for internal use.
809
+ * @param {CacheableStoreItem} item - The expired item being removed from the store
810
+ * @returns {void}
811
+ */
812
+ recordExpiration(item) {
813
+ if (!this._stats.enabled) return;
814
+ this._stats.decreaseKSize(item.key);
815
+ this._stats.decreaseVSize(item.value);
816
+ this._stats.decreaseCount();
817
+ }
818
+ isPrimitive(value) {
819
+ const result = false;
820
+ /* v8 ignore next -- @preserve */
821
+ if (value === null || value === void 0) return true;
822
+ if (typeof value === "string" || typeof value === "number" || typeof value === "boolean") return true;
823
+ return result;
824
+ }
825
+ setTtl(ttl) {
826
+ if (typeof ttl === "string" || ttl === void 0) this._ttl = ttl;
827
+ else if (ttl > 0) this._ttl = ttl;
828
+ else this._ttl = void 0;
829
+ }
830
+ setMaxTtl(maxTtl) {
831
+ if (typeof maxTtl === "string" || maxTtl === void 0) this._maxTtl = maxTtl;
832
+ else if (maxTtl > 0) this._maxTtl = maxTtl;
833
+ else this._maxTtl = void 0;
834
+ }
835
+ hasExpired(item) {
836
+ if (item.expires && Date.now() > item.expires) return true;
837
+ return false;
838
+ }
839
+ };
840
+ //#endregion
841
+ export { CacheableMemory, CacheableMemoryHooks, HashAlgorithm, KeyvCacheableMemory, Stats, createKeyv, defaultStoreHashSize, getOrSetSync, hash, hashToNumber, maximumMapSize };