@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,903 @@
1
+ import { Keyv } from "keyv";
2
+
3
+ //#region src/shorthand-time.d.ts
4
+ /**
5
+ * Converts a shorthand time string or number into milliseconds.
6
+ * The shorthand can be a string like '1s', '2m', '3h', '4d', or a number representing milliseconds.
7
+ * If the input is undefined, it returns undefined.
8
+ * If the input is a string that does not match the expected format, it throws an error.
9
+ * @param shorthand - A shorthand time string or number representing milliseconds.
10
+ * @returns The equivalent time in milliseconds or undefined.
11
+ */
12
+ declare const shorthandToMilliseconds: (shorthand?: string | number) => number | undefined;
13
+ /**
14
+ * Converts a shorthand time string or number into a timestamp.
15
+ * If the shorthand is undefined, it returns the current date's timestamp.
16
+ * If the shorthand is a valid time format, it adds that duration to the current date's timestamp.
17
+ * @param shorthand - A shorthand time string or number representing milliseconds.
18
+ * @param fromDate - An optional Date object to calculate from. Defaults to the current date if not provided.
19
+ * @returns The timestamp in milliseconds since epoch.
20
+ */
21
+ declare const shorthandToTime: (shorthand?: string | number, fromDate?: Date) => number;
22
+ //#endregion
23
+ //#region src/cache-tags.d.ts
24
+ /**
25
+ * Options for constructing a {@link CacheTags}.
26
+ * @typedef {Object} CacheTagsOptions
27
+ * @property {Keyv} store - The Keyv store used to persist tag versions and key snapshots.
28
+ * @property {string} [namespace] - An optional namespace that isolates this service's tags
29
+ * and keys from others sharing the same store. Defaults to `"default"`.
30
+ * @property {boolean} [enabled] - Whether the service is enabled. While disabled, every method
31
+ * is a no-op: read methods return their neutral value ({@link CacheTags.isKeyFresh} returns
32
+ * `true`, {@link CacheTags.isKeyStale} returns `false`, etc.) and writes are skipped. The
33
+ * service must be explicitly enabled to use tags. Defaults to `true`.
34
+ * @property {(error: unknown) => void} [onError] - Invoked with errors from non-blocking
35
+ * (fire-and-forget) operations, which cannot be thrown to the caller. Defaults to ignoring them.
36
+ */
37
+ type CacheTagsOptions = {
38
+ store: Keyv;
39
+ namespace?: string;
40
+ enabled?: boolean;
41
+ onError?: (error: unknown) => void;
42
+ };
43
+ /**
44
+ * Options for {@link CacheTags.setKeyTags}.
45
+ * @typedef {Object} SetKeyTagsOptions
46
+ * @property {number} [ttl] - Time-to-live in milliseconds for the key's tag snapshot. Should
47
+ * match the TTL of the cached value it tracks so the snapshot expires alongside it. If omitted,
48
+ * the snapshot does not expire.
49
+ * @property {boolean} [nonBlocking] - When `true`, the snapshot write is fire-and-forget:
50
+ * the call resolves immediately and failures are reported via the `onError` option.
51
+ */
52
+ type SetKeyTagsOptions = {
53
+ ttl?: number;
54
+ nonBlocking?: boolean;
55
+ };
56
+ /**
57
+ * Options for {@link CacheTags.removeKey} and {@link CacheTags.removeKeys}.
58
+ * @typedef {Object} RemoveKeysOptions
59
+ * @property {boolean} [nonBlocking] - When `true`, the removal is fire-and-forget:
60
+ * the call resolves immediately and failures are reported via the `onError` option.
61
+ */
62
+ type RemoveKeysOptions = {
63
+ nonBlocking?: boolean;
64
+ };
65
+ /**
66
+ * The metadata stored for a tagged key. It records the version of each tag at the moment the key
67
+ * was written, allowing {@link CacheTags.isKeyFresh} to detect later invalidations.
68
+ * @typedef {Object} KeyTagEntry
69
+ * @property {Record<string, number>} tags - A snapshot mapping each tag name to its version at set time.
70
+ */
71
+ type KeyTagEntry = {
72
+ tags: Record<string, number>;
73
+ };
74
+ /**
75
+ * Provides tag-based cache invalidation on top of any {@link Keyv} store. It is store-agnostic and
76
+ * requires no adapter changes.
77
+ *
78
+ * The service uses a lazy invalidation model rather than scanning and deleting keys. Each tag has a
79
+ * monotonically increasing version counter; {@link CacheTags.invalidateTag} simply increments
80
+ * it. When a key is tagged via {@link CacheTags.setKeyTags}, a snapshot of its tags' current
81
+ * versions is stored alongside it. {@link CacheTags.isKeyFresh} compares that snapshot against
82
+ * the live versions — if any tag has been incremented since, the key is considered stale. Stale
83
+ * entries are not deleted explicitly; they are expected to fall out of the cache via their TTL.
84
+ *
85
+ * This keeps invalidation constant-time regardless of how many keys reference a tag, at the cost of
86
+ * one additional `isKeyFresh` read per cache lookup.
87
+ *
88
+ * The service can be disabled via the `enabled` option or property so integrations pay no cost for
89
+ * untagged workloads: while disabled, every method is a no-op — reads return their neutral value
90
+ * and writes are skipped. The service must be explicitly enabled to use tags; it never enables
91
+ * itself, which keeps behavior consistent across distributed instances sharing a store.
92
+ *
93
+ * All metadata is written under a reserved prefix so it cannot collide with user keys:
94
+ * - `--cacheable--tags--:<namespace>:tag:<tag>` → integer version counter (stored without TTL).
95
+ * - `--cacheable--tags--:<namespace>:key:<key>` → the {@link KeyTagEntry} snapshot.
96
+ *
97
+ * Note: the read-version-then-write-snapshot sequence in `setKeyTags` is not atomic across
98
+ * processes. A concurrent `invalidateTag` running between the read and the write can leave a freshly
99
+ * written key referencing a stale version.
100
+ *
101
+ * @example
102
+ * ```typescript
103
+ * const cacheTags = new CacheTags({ store: new Keyv(), namespace: 'app' });
104
+ * await cacheTags.setKeyTags('user:42', ['users', 'org:7'], { ttl: 3600000 });
105
+ * await cacheTags.isKeyFresh('user:42'); // true
106
+ * await cacheTags.invalidateTag('users');
107
+ * await cacheTags.isKeyFresh('user:42'); // false
108
+ * ```
109
+ */
110
+ declare class CacheTags {
111
+ private readonly _store;
112
+ private readonly _namespace;
113
+ private _enabled;
114
+ private readonly _onError?;
115
+ /**
116
+ * Creates a new tag service.
117
+ * @param {CacheTagsOptions} options - The store, optional namespace, enabled state, and
118
+ * non-blocking error handler to use.
119
+ */
120
+ constructor(options: CacheTagsOptions);
121
+ /**
122
+ * The Keyv store backing this service.
123
+ * @returns {Keyv} The store provided to the constructor.
124
+ */
125
+ get store(): Keyv;
126
+ /**
127
+ * The namespace isolating this service's tags and keys within the store.
128
+ * @returns {string} The configured namespace, or `"default"` if none was provided.
129
+ */
130
+ get namespace(): string;
131
+ /**
132
+ * Whether the service is enabled. While disabled, every method is a no-op — read methods
133
+ * return their neutral value and writes are skipped — so integrations pay no extra store
134
+ * reads for untagged workloads. The service must be explicitly enabled to use tags; it never
135
+ * enables itself.
136
+ * @returns {boolean} Whether the service is enabled.
137
+ */
138
+ get enabled(): boolean;
139
+ /**
140
+ * Sets whether the service is enabled.
141
+ * @param {boolean} enabled Whether the service is enabled.
142
+ */
143
+ set enabled(enabled: boolean);
144
+ /**
145
+ * Builds the reserved store key under which a tag's version counter is stored.
146
+ * @param tag - The tag name.
147
+ * @returns {string} The namespaced store key for the tag's version.
148
+ */
149
+ private tagKey;
150
+ /**
151
+ * Builds the reserved store key under which a cache key's tag snapshot is stored.
152
+ * @param key - The cache key being tagged.
153
+ * @returns {string} The namespaced store key for the key's snapshot.
154
+ */
155
+ private keyEntryKey;
156
+ /**
157
+ * Builds the common prefix shared by every key-snapshot entry in this namespace. Used to filter
158
+ * key entries when iterating the store.
159
+ * @returns {string} The namespaced key-entry prefix.
160
+ */
161
+ private keyPrefix;
162
+ /**
163
+ * Reads the current version of a single tag.
164
+ * @param tag - The tag name.
165
+ * @returns {Promise<number>} The tag's version, or `0` if it has never been invalidated.
166
+ */
167
+ private getTagVersion;
168
+ /**
169
+ * Reads the current versions of multiple tags in a single batched store read.
170
+ * @param tags - The tag names to look up.
171
+ * @returns {Promise<number[]>} The versions in the same order as `tags`; entries that have never
172
+ * been invalidated resolve to `0`. Returns an empty array when `tags` is empty.
173
+ */
174
+ private getTagVersions;
175
+ /**
176
+ * Reports a fire-and-forget failure to the `onError` handler, if one was provided.
177
+ * @param error - The error raised by the non-blocking operation.
178
+ */
179
+ private handleNonBlockingError;
180
+ /**
181
+ * Reads the version snapshot of each tag and writes the key's tag snapshot to the store.
182
+ * @param key - The cache key to tag.
183
+ * @param tags - The tags to associate with the key.
184
+ * @param ttl - Time-to-live in milliseconds for the snapshot.
185
+ * @returns {Promise<void>} Resolves once the snapshot has been written.
186
+ */
187
+ private writeKeyTags;
188
+ /**
189
+ * Associates a cache key with a set of tags by recording a snapshot of each tag's current
190
+ * version. Call this whenever you write a fresh value to the cache. Duplicate tags are ignored.
191
+ * No-op while the service is disabled.
192
+ * @param key - The cache key to tag.
193
+ * @param tags - The tags to associate with the key.
194
+ * @param {SetKeyTagsOptions} [options] - Optional settings, such as a `ttl` for the snapshot or
195
+ * `nonBlocking` to fire-and-forget the write.
196
+ * @returns {Promise<void>} Resolves once the snapshot has been written, or immediately when
197
+ * `nonBlocking` is set.
198
+ */
199
+ setKeyTags(key: string, tags: string[], options?: SetKeyTagsOptions): Promise<void>;
200
+ /**
201
+ * Removes a key's tag snapshot. After this, {@link CacheTags.isKeyFresh} returns `false`
202
+ * for the key. Use when the cached value itself is deleted. No-op while the service is
203
+ * disabled.
204
+ * @param key - The cache key whose snapshot should be removed.
205
+ * @param {RemoveKeysOptions} [options] - Optional settings, such as `nonBlocking` to
206
+ * fire-and-forget the removal.
207
+ * @returns {Promise<void>} Resolves once the snapshot has been deleted, or immediately when
208
+ * `nonBlocking` is set.
209
+ */
210
+ removeKey(key: string, options?: RemoveKeysOptions): Promise<void>;
211
+ /**
212
+ * Removes multiple keys' tag snapshots in a single batched store delete. After this,
213
+ * {@link CacheTags.isKeyFresh} returns `false` for each key. An empty list is a no-op, as is
214
+ * the entire call while the service is disabled.
215
+ * @param keys - The cache keys whose snapshots should be removed.
216
+ * @param {RemoveKeysOptions} [options] - Optional settings, such as `nonBlocking` to
217
+ * fire-and-forget the removal.
218
+ * @returns {Promise<void>} Resolves once the snapshots have been deleted, or immediately when
219
+ * `nonBlocking` is set.
220
+ */
221
+ removeKeys(keys: string[], options?: RemoveKeysOptions): Promise<void>;
222
+ /**
223
+ * Determines whether a key's cached value can still be trusted. A key is fresh only when a
224
+ * snapshot exists for it and every tag in that snapshot still has the version it had at set time.
225
+ * A key with no tags is trivially fresh. Call this before returning a value from your cache.
226
+ * Always returns `true` while the service is disabled.
227
+ * @param key - The cache key to check.
228
+ * @returns {Promise<boolean>} `true` if the key is still fresh; `false` if it is unknown or any of
229
+ * its tags has been invalidated since the snapshot was taken.
230
+ */
231
+ isKeyFresh(key: string): Promise<boolean>;
232
+ /**
233
+ * Determines whether a key's cached value is known to be stale due to tag invalidation. This is
234
+ * the complement of {@link CacheTags.isKeyFresh} for tagged keys, but treats keys without a
235
+ * snapshot as not stale — making it safe to call for every cache lookup, including keys that were
236
+ * never tagged. Always returns `false` while the service is disabled.
237
+ * @param key - The cache key to check.
238
+ * @returns {Promise<boolean>} `true` only when a snapshot exists for the key and at least one of
239
+ * its tags has been invalidated since the snapshot was taken; `false` otherwise (including when
240
+ * the key has no snapshot).
241
+ */
242
+ isKeyStale(key: string): Promise<boolean>;
243
+ /**
244
+ * Determines which of the given keys are known to be stale due to tag invalidation, using two
245
+ * batched store reads regardless of how many keys are checked: one for the snapshots and one for
246
+ * the union of their tag versions. Keys without a snapshot are not considered stale. Returns an
247
+ * empty array while the service is disabled.
248
+ * @param keys - The cache keys to check.
249
+ * @returns {Promise<string[]>} The subset of `keys` whose snapshot references at least one tag
250
+ * that has been invalidated since the snapshot was taken.
251
+ */
252
+ getStaleKeys(keys: string[]): Promise<string[]>;
253
+ /**
254
+ * Returns the tags currently associated with a key. Returns `undefined` while the service is
255
+ * disabled.
256
+ * @param key - The cache key to look up.
257
+ * @returns {Promise<string[] | undefined>} The tag names from the key's snapshot, or `undefined`
258
+ * if the key has no snapshot.
259
+ */
260
+ getTags(key: string): Promise<string[] | undefined>;
261
+ /**
262
+ * Returns all cache keys whose snapshot references the given tag. This scans every key entry in
263
+ * the namespace via the Keyv iterator, making it an `O(N)` operation intended for debugging and
264
+ * tests rather than hot paths. Returns an empty array if the underlying store exposes no iterator
265
+ * or while the service is disabled.
266
+ * @param tag - The tag to search for.
267
+ * @returns {Promise<string[]>} The cache keys (with the reserved prefix stripped) referencing the tag.
268
+ */
269
+ getKeysByTag(tag: string): Promise<string[]>;
270
+ /**
271
+ * Invalidates a single tag by incrementing its version counter. Every key whose snapshot
272
+ * references this tag becomes stale immediately. Runs in constant time regardless of how many
273
+ * keys reference the tag. No-op while the service is disabled.
274
+ * @param tag - The tag to invalidate.
275
+ * @returns {Promise<string[]>} A single-element array containing the invalidated tag, or an
276
+ * empty array while the service is disabled.
277
+ */
278
+ invalidateTag(tag: string): Promise<string[]>;
279
+ /**
280
+ * Invalidates multiple tags by incrementing each of their version counters in a single batched
281
+ * store write. Duplicate tags are bumped once. An empty list is a no-op, as is the entire call
282
+ * while the service is disabled.
283
+ * @param tags - The tags to invalidate.
284
+ * @returns {Promise<string[]>} The `tags` argument as provided (including any duplicates), or
285
+ * an empty array while the service is disabled.
286
+ */
287
+ invalidateTags(tags: string[]): Promise<string[]>;
288
+ }
289
+ //#endregion
290
+ //#region src/cacheable-item-types.d.ts
291
+ /**
292
+ * CacheableItem
293
+ * @typedef {Object} CacheableItem
294
+ * @property {string} key - The key of the cacheable item
295
+ * @property {any} value - The value of the cacheable item
296
+ * @property {number|string} [ttl] - Time to Live - If you set a number it is miliseconds, if you set a string it is a human-readable
297
+ * format such as `1s` for 1 second or `1h` for 1 hour. Setting undefined means that it will use the default time-to-live. If both are
298
+ * undefined then it will not have a time-to-live.
299
+ */
300
+ type CacheableItem = {
301
+ key: string;
302
+ value: any;
303
+ ttl?: number | string;
304
+ };
305
+ /**
306
+ * CacheableStoreItem
307
+ * @typedef {Object} CacheableStoreItem
308
+ * @property {string} key - The key of the cacheable store item
309
+ * @property {any} value - The value of the cacheable store item
310
+ * @property {number} [expires] - The expiration time in milliseconds since epoch. If not set, the item does not expire.
311
+ */
312
+ type CacheableStoreItem = {
313
+ key: string;
314
+ value: any;
315
+ expires?: number;
316
+ };
317
+ //#endregion
318
+ //#region src/coalesce-async.d.ts
319
+ /**
320
+ * Enqueue a promise for the group identified by `key`.
321
+ *
322
+ * All requests received for the same key while a request for that key
323
+ * is already being executed will wait. Once the running request settles
324
+ * then all the waiting requests in the group will settle, too.
325
+ * This minimizes how many times the function itself runs at the same time.
326
+ * This function resolves or rejects according to the given function argument.
327
+ *
328
+ * @url https://github.com/douglascayers/promise-coalesce
329
+ */
330
+ declare function coalesceAsync<T>(
331
+ /**
332
+ * Any identifier to group requests together.
333
+ */
334
+
335
+ key: string,
336
+ /**
337
+ * The function to run.
338
+ */
339
+
340
+ fnc: () => T | PromiseLike<T>): Promise<T>;
341
+ //#endregion
342
+ //#region src/hash.d.ts
343
+ declare enum HashAlgorithm {
344
+ SHA256 = "SHA-256",
345
+ SHA384 = "SHA-384",
346
+ SHA512 = "SHA-512",
347
+ DJB2 = "djb2",
348
+ FNV1 = "fnv1",
349
+ MURMER = "murmer",
350
+ CRC32 = "crc32"
351
+ }
352
+ type HashOptions = {
353
+ algorithm?: HashAlgorithm;
354
+ serialize?: (object: any) => string;
355
+ };
356
+ type HashToNumberOptions = HashOptions & {
357
+ min?: number;
358
+ max?: number;
359
+ hashLength?: number;
360
+ };
361
+ /**
362
+ * Hashes an object asynchronously using the specified cryptographic algorithm.
363
+ * This method should be used for cryptographic algorithms (SHA-256, SHA-384, SHA-512).
364
+ * For non-cryptographic algorithms, use hashSync() for better performance.
365
+ * @param object The object to hash
366
+ * @param options The hash options to use
367
+ * @returns {Promise<string>} The hash of the object
368
+ */
369
+ declare function hash(object: any, options?: HashOptions): Promise<string>;
370
+ /**
371
+ * Hashes an object synchronously using the specified non-cryptographic algorithm.
372
+ * This method should be used for non-cryptographic algorithms (DJB2, FNV1, MURMER, CRC32).
373
+ * For cryptographic algorithms, use hash() instead.
374
+ * @param object The object to hash
375
+ * @param options The hash options to use
376
+ * @returns {string} The hash of the object
377
+ */
378
+ declare function hashSync(object: any, options?: HashOptions): string;
379
+ /**
380
+ * Hashes an object asynchronously and converts it to a number within a specified range.
381
+ * This method should be used for cryptographic algorithms (SHA-256, SHA-384, SHA-512).
382
+ * For non-cryptographic algorithms, use hashToNumberSync() for better performance.
383
+ * @param object The object to hash
384
+ * @param options The hash options to use including min/max range
385
+ * @returns {Promise<number>} A number within the specified range
386
+ */
387
+ declare function hashToNumber(object: any, options?: HashToNumberOptions): Promise<number>;
388
+ /**
389
+ * Hashes an object synchronously and converts it to a number within a specified range.
390
+ * This method should be used for non-cryptographic algorithms (DJB2, FNV1, MURMER, CRC32).
391
+ * For cryptographic algorithms, use hashToNumber() instead.
392
+ * @param object The object to hash
393
+ * @param options The hash options to use including min/max range
394
+ * @returns {number} A number within the specified range
395
+ */
396
+ declare function hashToNumberSync(object: any, options?: HashToNumberOptions): number;
397
+ //#endregion
398
+ //#region src/is-keyv-instance.d.ts
399
+ declare function isKeyvInstance(keyv: any): boolean;
400
+ //#endregion
401
+ //#region src/is-object.d.ts
402
+ declare function isObject<T = Record<string, unknown>>(value: unknown): value is T;
403
+ //#endregion
404
+ //#region src/less-than.d.ts
405
+ declare function lessThan(number1?: number, number2?: number): boolean;
406
+ //#endregion
407
+ //#region src/ttl.d.ts
408
+ /**
409
+ * A per-store time-to-live override. Each field is a normal TTL (a number in milliseconds or a
410
+ * human-readable shorthand such as `1s`, `1m`, `1h`, `1d`) applied to that specific store. Fields
411
+ * left undefined fall back to that store's own default TTL resolution.
412
+ */
413
+ type PerStoreTtl = {
414
+ /**
415
+ * The time-to-live to use for the primary store.
416
+ */
417
+ primary?: number | string;
418
+ /**
419
+ * The time-to-live to use for the secondary store.
420
+ */
421
+ secondary?: number | string;
422
+ };
423
+ /**
424
+ * Normalizes a TTL input into per-store milliseconds. When given an object it resolves the
425
+ * `primary` and `secondary` fields independently; when given a number or shorthand string it
426
+ * applies the same value to both stores. Undefined fields (or undefined input) resolve to
427
+ * `undefined` so the caller can fall back to its own default TTL.
428
+ * @param ttl - The TTL input: a number (ms), a shorthand string, or a {@link PerStoreTtl} object.
429
+ * @returns {{ primary?: number; secondary?: number }} The resolved per-store TTLs in milliseconds.
430
+ */
431
+ declare function resolvePerStoreTtl(ttl?: number | string | PerStoreTtl): {
432
+ primary?: number;
433
+ secondary?: number;
434
+ };
435
+ /**
436
+ * Converts a exspires value to a TTL value.
437
+ * @param expires - The expires value to convert.
438
+ * @returns {number | undefined} The TTL value in milliseconds, or undefined if the expires value is not valid.
439
+ */
440
+ declare function getTtlFromExpires(expires: number | undefined): number | undefined;
441
+ /**
442
+ * Get the TTL value from the cacheableTtl, primaryTtl, and secondaryTtl values.
443
+ * @param cacheableTtl - The cacheableTtl value to use.
444
+ * @param primaryTtl - The primaryTtl value to use.
445
+ * @param secondaryTtl - The secondaryTtl value to use.
446
+ * @returns {number | undefined} The TTL value in milliseconds, or undefined if all values are undefined.
447
+ */
448
+ declare function getCascadingTtl(cacheableTtl?: number | string, primaryTtl?: number, secondaryTtl?: number): number | undefined;
449
+ /**
450
+ * Calculate the TTL value from the expires value. If the ttl is undefined, it will be set to the expires value. If the
451
+ * expires value is undefined, it will be set to the ttl value. If both values are defined, the smaller of the two will be used.
452
+ * @param ttl
453
+ * @param expires
454
+ * @returns
455
+ */
456
+ declare function calculateTtlFromExpiration(ttl: number | undefined, expires: number | undefined): number | undefined;
457
+ //#endregion
458
+ //#region src/memoize.d.ts
459
+ type CacheInstance = {
460
+ get: (key: string) => Promise<any | undefined>;
461
+ has: (key: string) => Promise<boolean>;
462
+ set: (key: string, value: any, ttl?: number | string | PerStoreTtl) => Promise<void>;
463
+ on: (event: string, listener: (...args: any[]) => void) => void;
464
+ emit: (event: string, ...args: any[]) => boolean;
465
+ };
466
+ type CacheSyncInstance = {
467
+ get: (key: string) => any | undefined;
468
+ has: (key: string) => boolean;
469
+ set: (key: string, value: any, ttl?: number | string) => void;
470
+ on: (event: string, listener: (...args: any[]) => void) => void;
471
+ emit: (event: string, ...args: any[]) => boolean;
472
+ };
473
+ type GetOrSetKey = string | ((options?: GetOrSetOptions) => string);
474
+ type GetOrSetThrowErrorsContext = "function" | "store";
475
+ type GetOrSetFunctionOptions = {
476
+ ttl?: number | string;
477
+ cacheErrors?: boolean;
478
+ /** Whether or not to throw errors:
479
+ * - `false` (default) - do not throw any errors
480
+ * - `true` - throw any error
481
+ * - `"function"` - only throw errors that occur in the provided function / setter
482
+ * - `"store"` - only throw errors that occur when getting/setting the cache
483
+ */
484
+ throwErrors?: boolean | GetOrSetThrowErrorsContext;
485
+ /**
486
+ * If set, this will bypass the instances nonBlocking setting for the get call.
487
+ * @type {boolean}
488
+ */
489
+ nonBlocking?: boolean;
490
+ };
491
+ type GetOrSetOptions = Omit<GetOrSetFunctionOptions, "ttl"> & {
492
+ ttl?: number | string | PerStoreTtl;
493
+ cacheId?: string;
494
+ cache: CacheInstance;
495
+ };
496
+ /**
497
+ * Options for {@link getOrSetSync}, the synchronous counterpart to {@link GetOrSetOptions}. It
498
+ * targets a {@link CacheSyncInstance} and its `ttl` is always a single value (a number in
499
+ * milliseconds or a shorthand string), never a per-store object. The inherited `nonBlocking`
500
+ * option has no effect on a single, synchronous store.
501
+ */
502
+ type GetOrSetSyncOptions = GetOrSetFunctionOptions & {
503
+ cache: CacheSyncInstance;
504
+ };
505
+ /**
506
+ * A cache key for {@link getOrSetSync}: either a string or a function that derives the key from the
507
+ * resolved {@link GetOrSetSyncOptions}.
508
+ */
509
+ type GetOrSetSyncKey = string | ((options?: GetOrSetSyncOptions) => string);
510
+ type CreateWrapKey = (function_: AnyFunction, arguments_: any[], options?: WrapFunctionOptions) => string;
511
+ type WrapFunctionOptions = {
512
+ ttl?: number | string;
513
+ keyPrefix?: string;
514
+ createKey?: CreateWrapKey;
515
+ cacheErrors?: boolean;
516
+ cacheId?: string;
517
+ serialize?: (object: any) => string;
518
+ };
519
+ type WrapOptions = Omit<WrapFunctionOptions, "ttl"> & {
520
+ ttl?: number | string | PerStoreTtl;
521
+ cache: CacheInstance;
522
+ serialize?: (object: any) => string;
523
+ };
524
+ type WrapSyncOptions = WrapFunctionOptions & {
525
+ cache: CacheSyncInstance;
526
+ serialize?: (object: any) => string;
527
+ };
528
+ type AnyFunction = (...arguments_: any[]) => any;
529
+ declare function wrapSync<T>(function_: AnyFunction, options: WrapSyncOptions): AnyFunction;
530
+ declare function getOrSet<T>(key: GetOrSetKey, function_: () => Promise<T>, options: GetOrSetOptions): Promise<T | undefined>;
531
+ /**
532
+ * Synchronous counterpart to {@link getOrSet}. Reads `key` from the cache and, on a miss, computes
533
+ * the value with `function_`, stores it, and returns it.
534
+ *
535
+ * Unlike {@link getOrSet} there is no request coalescing: synchronous code runs to completion
536
+ * without interleaving, so concurrent callers cannot stampede the setter the way they can with an
537
+ * async cache.
538
+ *
539
+ * Error handling mirrors {@link getOrSet}: errors are emitted on the cache's `error` event, can be
540
+ * cached when `cacheErrors` is set, and can be rethrown selectively via `throwErrors` (`true` for
541
+ * any error, `"function"` for setter errors, `"store"` for cache read/write errors).
542
+ *
543
+ * @param key - The cache key, or a function that derives it from the resolved options.
544
+ * @param function_ - The setter invoked on a cache miss to compute the value.
545
+ * @param options - The {@link GetOrSetSyncOptions} including the target synchronous cache.
546
+ * @returns The cached or freshly computed value, or `undefined`.
547
+ */
548
+ declare function getOrSetSync<T>(key: GetOrSetSyncKey, function_: () => T, options: GetOrSetSyncOptions): T | undefined;
549
+ declare function wrap<T>(function_: AnyFunction, options: WrapOptions): AnyFunction;
550
+ type CreateWrapKeyOptions = {
551
+ keyPrefix?: string;
552
+ serialize?: (object: any) => string;
553
+ };
554
+ declare function createWrapKey(function_: AnyFunction, arguments_: any[], options?: CreateWrapKeyOptions): string;
555
+ //#endregion
556
+ //#region src/run-if-fn.d.ts
557
+ type Function_<P, T> = (...arguments_: P[]) => T;
558
+ declare function runIfFn<T, P>(valueOrFunction: T | Function_<P, T>, ...arguments_: P[]): T;
559
+ //#endregion
560
+ //#region src/sleep.d.ts
561
+ declare const sleep: (ms: number) => Promise<unknown>;
562
+ //#endregion
563
+ //#region src/stats.d.ts
564
+ /**
565
+ * A counter field that can be incremented or decremented via the unified
566
+ * {@link Stats.increment} / {@link Stats.decrement} API or an event map.
567
+ */
568
+ type StatField = "hits" | "misses" | "gets" | "sets" | "deletes" | "clears" | "count";
569
+ /**
570
+ * A duck-typed event emitter. This intentionally matches both `Hookified`
571
+ * (used by `cacheable`, `node-cache`, `memory`, `flat-cache`) and Node's
572
+ * built-in `EventEmitter` (used by `cache-manager`, `cacheable-request`)
573
+ * without adding a hard dependency on either.
574
+ */
575
+ type StatsEmitter = {
576
+ on(event: string, listener: (...args: any[]) => void): unknown;
577
+ off?(event: string, listener: (...args: any[]) => void): unknown;
578
+ removeListener?(event: string, listener: (...args: any[]) => void): unknown;
579
+ };
580
+ /**
581
+ * A custom handler invoked when a subscribed event fires. It receives the
582
+ * {@link Stats} instance and the raw event arguments (which may be positional,
583
+ * e.g. node-cache emits `(key, value)`).
584
+ */
585
+ type StatsEventHandler = (stats: Stats, ...args: any[]) => void;
586
+ /**
587
+ * Maps an event name to the stat update it should perform: a single field to
588
+ * increment, an array of fields to increment, or a custom handler.
589
+ */
590
+ type StatsEventMap = Record<string, StatField | StatField[] | StatsEventHandler>;
591
+ /**
592
+ * A counter field that can be recorded per key via {@link Stats.recordKey}.
593
+ * This is the subset of {@link StatField} that makes sense for a single key
594
+ * (`clears` and `count` are cache-wide).
595
+ */
596
+ type KeyStatField = "hits" | "misses" | "gets" | "sets" | "deletes";
597
+ /**
598
+ * Per-key statistics returned by {@link Stats.mostUsedKeys},
599
+ * {@link Stats.leastUsedKeys}, and {@link Stats.keyStats}.
600
+ */
601
+ type StatsKeyEntry = {
602
+ key: string; /** Total recorded operations for this key (sum of all fields). */
603
+ count: number;
604
+ hits: number;
605
+ misses: number;
606
+ gets: number;
607
+ sets: number;
608
+ deletes: number; /** `hits / (hits + misses)` for this key, or `0` when there have been no lookups. */
609
+ hitRate: number;
610
+ };
611
+ /**
612
+ * A plain-object snapshot of a {@link Stats} instance, suitable for logging,
613
+ * metrics, or serialization. Returned by {@link Stats.toJSON}.
614
+ */
615
+ type StatsSnapshot = {
616
+ enabled: boolean;
617
+ hits: number;
618
+ misses: number;
619
+ gets: number;
620
+ sets: number;
621
+ deletes: number;
622
+ clears: number;
623
+ vsize: number;
624
+ ksize: number;
625
+ count: number;
626
+ hitRate: number;
627
+ missRate: number; /** Number of unique keys currently tracked (0 when key tracking is off). */
628
+ trackedKeys: number;
629
+ lastUpdated?: number;
630
+ lastReset?: number;
631
+ };
632
+ type StatsOptions = {
633
+ /** Whether the stats are enabled. Defaults to `false`. */enabled?: boolean; /** Optionally subscribe to an emitter immediately on construction. */
634
+ emitter?: StatsEmitter; /** The event map to use. Required when `emitter` is provided. */
635
+ eventMap?: StatsEventMap; /** Track per-key statistics via {@link Stats.recordKey}. Defaults to `false`. */
636
+ trackKeys?: boolean;
637
+ /**
638
+ * Safety cap on the number of unique keys tracked. When exceeded, the
639
+ * lowest-count keys are pruned, which keeps {@link Stats.mostUsedKeys}
640
+ * approximately accurate but makes {@link Stats.leastUsedKeys} unreliable.
641
+ * Unbounded when unset.
642
+ */
643
+ maxTrackedKeys?: number;
644
+ };
645
+ /**
646
+ * Event map for `@cacheable/node-cache` instances. node-cache emits with
647
+ * positional arguments (e.g. `set(key, value)`), and emits each lifecycle
648
+ * event exactly once, so the counts map cleanly. `flush` clears the cache data
649
+ * and `flush_stats` resets the stats counters, mirroring node-cache's
650
+ * `flushAll()` / `flushStats()` lifecycle.
651
+ *
652
+ * Presets for `cacheable` and `cache-manager` are intentionally not provided:
653
+ * their event streams emit per-store probes (and, for cache-manager, do not
654
+ * emit an event on a normal miss), so a simple map cannot faithfully reproduce
655
+ * their imperative stats. Wire those up with a custom map or imperative calls.
656
+ */
657
+ declare const nodeCacheStatsEventMap: StatsEventMap;
658
+ /**
659
+ * Raw per-key counters stored in {@link Stats.trackedKeys}: the
660
+ * `hits`/`misses`/`gets`/`sets`/`deletes` totals for a single cache key.
661
+ */
662
+ type KeyCounters = Record<KeyStatField, number>;
663
+ declare class Stats {
664
+ private _counters;
665
+ private _vsize;
666
+ private _ksize;
667
+ private _enabled;
668
+ private _lastUpdated;
669
+ private _lastReset;
670
+ private _subscriptions;
671
+ /** Backing store for the public {@link trackedKeys} read-only view. */
672
+ private _trackedKeys;
673
+ private _trackKeys;
674
+ private _maxTrackedKeys;
675
+ constructor(options?: StatsOptions);
676
+ /**
677
+ * @returns {boolean} - Whether the stats are enabled
678
+ */
679
+ get enabled(): boolean;
680
+ /**
681
+ * @param {boolean} enabled - Whether to enable the stats
682
+ */
683
+ set enabled(enabled: boolean);
684
+ /**
685
+ * @returns {boolean} - Whether per-key statistics are tracked
686
+ */
687
+ get trackKeys(): boolean;
688
+ /**
689
+ * @param {boolean} trackKeys - Whether to track per-key statistics
690
+ */
691
+ set trackKeys(trackKeys: boolean);
692
+ /**
693
+ * @returns {number | undefined} - The cap on unique keys tracked, or
694
+ * `undefined` when unbounded
695
+ */
696
+ get maxTrackedKeys(): number | undefined;
697
+ /**
698
+ * @param {number | undefined} maxTrackedKeys - The cap on unique keys
699
+ * tracked. Set `undefined` for unbounded.
700
+ */
701
+ set maxTrackedKeys(maxTrackedKeys: number | undefined);
702
+ /**
703
+ * Per-key statistics, keyed by cache key, holding each key's raw
704
+ * `hits`/`misses`/`gets`/`sets`/`deletes` counters. Populated by
705
+ * {@link recordKey} when {@link trackKeys} is enabled; read `trackedKeys.size`
706
+ * for the number of unique keys currently tracked. The returned map is a
707
+ * read-only view — mutate per-key stats via {@link recordKey} /
708
+ * {@link clearKeys} / {@link reset}.
709
+ * @returns {ReadonlyMap<string, Readonly<KeyCounters>>}
710
+ * @readonly
711
+ */
712
+ get trackedKeys(): ReadonlyMap<string, Readonly<KeyCounters>>;
713
+ /**
714
+ * @returns {number} - The number of hits
715
+ * @readonly
716
+ */
717
+ get hits(): number;
718
+ /**
719
+ * @returns {number} - The number of misses
720
+ * @readonly
721
+ */
722
+ get misses(): number;
723
+ /**
724
+ * @returns {number} - The number of gets
725
+ * @readonly
726
+ */
727
+ get gets(): number;
728
+ /**
729
+ * @returns {number} - The number of sets
730
+ * @readonly
731
+ */
732
+ get sets(): number;
733
+ /**
734
+ * @returns {number} - The number of deletes
735
+ * @readonly
736
+ */
737
+ get deletes(): number;
738
+ /**
739
+ * @returns {number} - The number of clears
740
+ * @readonly
741
+ */
742
+ get clears(): number;
743
+ /**
744
+ * @returns {number} - The vsize (value size) of the cache instance
745
+ * @readonly
746
+ */
747
+ get vsize(): number;
748
+ /**
749
+ * @returns {number} - The ksize (key size) of the cache instance
750
+ * @readonly
751
+ */
752
+ get ksize(): number;
753
+ /**
754
+ * @returns {number} - The count of the cache instance
755
+ * @readonly
756
+ */
757
+ get count(): number;
758
+ /**
759
+ * The ratio of hits to total lookups (hits + misses). Returns `0` when there
760
+ * have been no lookups.
761
+ * @returns {number} - A value between 0 and 1
762
+ * @readonly
763
+ */
764
+ get hitRate(): number;
765
+ /**
766
+ * The ratio of misses to total lookups (hits + misses). Returns `0` when
767
+ * there have been no lookups.
768
+ * @returns {number} - A value between 0 and 1
769
+ * @readonly
770
+ */
771
+ get missRate(): number;
772
+ /**
773
+ * The timestamp (ms since epoch) of the last mutation while enabled, or
774
+ * `undefined` if there have been none since the last reset.
775
+ * @returns {number | undefined}
776
+ * @readonly
777
+ */
778
+ get lastUpdated(): number | undefined;
779
+ /**
780
+ * The timestamp (ms since epoch) of the last {@link reset}/{@link clear}, or
781
+ * `undefined` if it has never been reset.
782
+ * @returns {number | undefined}
783
+ * @readonly
784
+ */
785
+ get lastReset(): number | undefined;
786
+ /**
787
+ * Increment a counter field by `amount` (default `1`). No-op when disabled.
788
+ * @param {StatField} field - The counter to increment
789
+ * @param {number} amount - The amount to add (default 1)
790
+ */
791
+ increment(field: StatField, amount?: number): void;
792
+ /**
793
+ * Decrement a counter field by `amount` (default `1`). No-op when disabled.
794
+ * @param {StatField} field - The counter to decrement
795
+ * @param {number} amount - The amount to subtract (default 1)
796
+ */
797
+ decrement(field: StatField, amount?: number): void;
798
+ incrementHits(amount?: number): void;
799
+ incrementMisses(amount?: number): void;
800
+ incrementGets(amount?: number): void;
801
+ incrementSets(amount?: number): void;
802
+ incrementDeletes(amount?: number): void;
803
+ incrementClears(amount?: number): void;
804
+ incrementVSize(value: any): void;
805
+ decreaseVSize(value: any): void;
806
+ incrementKSize(key: string): void;
807
+ decreaseKSize(key: string): void;
808
+ incrementCount(amount?: number): void;
809
+ decreaseCount(amount?: number): void;
810
+ setCount(count: number): void;
811
+ roughSizeOfString(value: string): number;
812
+ roughSizeOfObject(object: any): number;
813
+ /**
814
+ * Enable stat tracking. Equivalent to setting {@link enabled} to `true`.
815
+ */
816
+ enable(): void;
817
+ /**
818
+ * Disable stat tracking. Equivalent to setting {@link enabled} to `false`.
819
+ */
820
+ disable(): void;
821
+ /**
822
+ * Reset all counters to zero and record the reset timestamp. Alias of
823
+ * {@link reset}.
824
+ */
825
+ clear(): void;
826
+ reset(): void;
827
+ resetStoreValues(): void;
828
+ /**
829
+ * @returns {StatsSnapshot} - A plain-object snapshot of the current stats,
830
+ * including computed `hitRate`/`missRate` and timestamps.
831
+ */
832
+ toJSON(): StatsSnapshot;
833
+ /**
834
+ * @returns {StatsSnapshot} - A plain-object snapshot of the current stats.
835
+ * Alias of {@link toJSON}.
836
+ */
837
+ snapshot(): StatsSnapshot;
838
+ /**
839
+ * Record an operation against a specific key for per-key statistics. No-op
840
+ * unless both {@link enabled} and {@link trackKeys} are `true`.
841
+ * @param {string} key - The cache key the operation touched
842
+ * @param {KeyStatField} field - The per-key counter to increment
843
+ * @param {number} amount - The amount to add (default 1)
844
+ */
845
+ recordKey(key: string, field: KeyStatField, amount?: number): void;
846
+ /**
847
+ * The most-used keys, sorted descending. Sorts by total recorded operations,
848
+ * or by a single field when `field` is provided. Ties order by key.
849
+ * @param {number} limit - Maximum entries to return (default 100)
850
+ * @param {KeyStatField} [field] - Optionally rank by one counter (e.g. "hits")
851
+ * @returns {StatsKeyEntry[]}
852
+ */
853
+ mostUsedKeys(limit?: number, field?: KeyStatField): StatsKeyEntry[];
854
+ /**
855
+ * The least-used keys, sorted ascending. Sorts by total recorded operations,
856
+ * or by a single field when `field` is provided. Ties order by key. Note:
857
+ * only keys that have been recorded at least once can be ranked, and when
858
+ * {@link maxTrackedKeys} pruning has occurred the true least-used keys may
859
+ * have been evicted.
860
+ * @param {number} limit - Maximum entries to return (default 100)
861
+ * @param {KeyStatField} [field] - Optionally rank by one counter (e.g. "gets")
862
+ * @returns {StatsKeyEntry[]}
863
+ */
864
+ leastUsedKeys(limit?: number, field?: KeyStatField): StatsKeyEntry[];
865
+ /**
866
+ * @param {string} key - The key to look up
867
+ * @returns {StatsKeyEntry | undefined} - The per-key statistics, or
868
+ * `undefined` if the key has not been recorded
869
+ */
870
+ keyStats(key: string): StatsKeyEntry | undefined;
871
+ /**
872
+ * Clear all per-key statistics without touching the aggregate counters.
873
+ */
874
+ clearKeys(): void;
875
+ private totalOf;
876
+ private toKeyEntry;
877
+ private sortedKeyEntries;
878
+ /**
879
+ * When over {@link maxTrackedKeys}, prune the lowest-count keys down to 90%
880
+ * of the cap (batched so the sort cost amortizes across inserts). The key
881
+ * that was just recorded is never pruned.
882
+ */
883
+ private pruneTrackedKeys;
884
+ /**
885
+ * Subscribe to an emitter so that matching events automatically update the
886
+ * stats. Counting is gated by {@link enabled}, so you may subscribe first and
887
+ * toggle enablement later. Call {@link unsubscribe} to detach.
888
+ * @param {StatsEmitter} emitter - The emitter to listen on
889
+ * @param {StatsEventMap} eventMap - The event-to-stat mapping (e.g.
890
+ * {@link nodeCacheStatsEventMap} or a custom map)
891
+ */
892
+ subscribe(emitter: StatsEmitter, eventMap: StatsEventMap): void;
893
+ /**
894
+ * Detach listeners previously attached via {@link subscribe}. When `emitter`
895
+ * is provided, only that emitter's listeners are removed; otherwise all are.
896
+ * @param {StatsEmitter} [emitter] - The emitter to detach from
897
+ */
898
+ unsubscribe(emitter?: StatsEmitter): void;
899
+ private applyEvent;
900
+ private touch;
901
+ }
902
+ //#endregion
903
+ export { type AnyFunction, type CacheInstance, type CacheSyncInstance, CacheTags, type CacheTagsOptions, type CacheableItem, type CacheableStoreItem, type CreateWrapKey, type CreateWrapKeyOptions, type GetOrSetFunctionOptions, type GetOrSetKey, type GetOrSetOptions, type GetOrSetSyncKey, type GetOrSetSyncOptions, HashAlgorithm, type HashOptions, type HashToNumberOptions, type KeyCounters, type KeyStatField, type KeyTagEntry, type PerStoreTtl, type RemoveKeysOptions, type SetKeyTagsOptions, type StatField, Stats, type StatsEmitter, type StatsEventHandler, type StatsEventMap, type StatsKeyEntry, type StatsOptions, type StatsSnapshot, type WrapFunctionOptions, type WrapOptions, type WrapSyncOptions, calculateTtlFromExpiration, coalesceAsync, createWrapKey, getCascadingTtl, getOrSet, getOrSetSync, getTtlFromExpires, hash, hashSync, hashToNumber, hashToNumberSync, isKeyvInstance, isObject, lessThan, nodeCacheStatsEventMap, resolvePerStoreTtl, runIfFn, shorthandToMilliseconds, shorthandToTime, sleep, wrap, wrapSync };