@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
@@ -1,494 +1,766 @@
1
- import { Stats, CacheableItem, WrapFunctionOptions, GetOrSetKey, GetOrSetFunctionOptions, HashAlgorithm } from '@cacheable/utils';
2
- export { CacheableItem, Stats as CacheableStats, GetOrSetFunctionOptions, GetOrSetKey, GetOrSetOptions, HashAlgorithm, WrapOptions, WrapSyncOptions, calculateTtlFromExpiration, getCascadingTtl, getOrSet, hash, shorthandToMilliseconds, shorthandToTime, wrap, wrapSync } from '@cacheable/utils';
3
- import { Hookified, HookifiedOptions } from 'hookified';
4
- import { Keyv, KeyvStoreAdapter, StoredDataRaw } from 'keyv';
5
- export { Keyv, KeyvHooks, KeyvOptions, KeyvStoreAdapter } from 'keyv';
6
- import { Qified, MessageProvider } from 'qified';
7
- export { CacheableMemory, CacheableMemoryOptions, KeyvCacheableMemory, KeyvCacheableMemoryOptions, createKeyv } from '@cacheable/memory';
1
+ import { CacheTags, CacheTags as CacheTags$1, CacheTagsOptions, CacheableItem, CacheableItem as CacheableItem$1, GetOrSetFunctionOptions as GetOrSetFunctionOptions$1, GetOrSetKey, GetOrSetKey as GetOrSetKey$1, GetOrSetOptions, HashAlgorithm, HashAlgorithm as HashAlgorithm$1, KeyTagEntry, PerStoreTtl, PerStoreTtl as PerStoreTtl$1, SetKeyTagsOptions, Stats, Stats as CacheableStats, WrapFunctionOptions as WrapFunctionOptions$1, WrapOptions, WrapSyncOptions, calculateTtlFromExpiration, getCascadingTtl, getOrSet, hash, shorthandToMilliseconds, shorthandToTime, wrap, wrapSync } from "@cacheable/utils";
2
+ import { Hook, Hookified, HookifiedOptions } from "hookified";
3
+ import { Keyv, Keyv as Keyv$1, KeyvHooks, KeyvOptions, KeyvStoreAdapter, KeyvStoreAdapter as KeyvStoreAdapter$1, StoredDataRaw } from "keyv";
4
+ import { MessageProvider, Qified } from "qified";
5
+ import { CacheableMemory, CacheableMemoryOptions, KeyvCacheableMemory, KeyvCacheableMemoryOptions, createKeyv } from "@cacheable/memory";
8
6
 
7
+ //#region src/enums.d.ts
8
+ declare enum CacheableHooks {
9
+ BEFORE_SET = "BEFORE_SET",
10
+ AFTER_SET = "AFTER_SET",
11
+ BEFORE_SET_MANY = "BEFORE_SET_MANY",
12
+ AFTER_SET_MANY = "AFTER_SET_MANY",
13
+ BEFORE_GET = "BEFORE_GET",
14
+ AFTER_GET = "AFTER_GET",
15
+ BEFORE_GET_MANY = "BEFORE_GET_MANY",
16
+ AFTER_GET_MANY = "AFTER_GET_MANY",
17
+ BEFORE_SECONDARY_SETS_PRIMARY = "BEFORE_SECONDARY_SETS_PRIMARY"
18
+ }
19
+ declare enum CacheableEvents {
20
+ ERROR = "error",
21
+ CACHE_HIT = "cache:hit",
22
+ CACHE_MISS = "cache:miss"
23
+ }
24
+ //#endregion
25
+ //#region src/sync.d.ts
9
26
  /**
10
27
  * Events emitted by CacheableSync
11
28
  */
12
29
  declare enum CacheableSyncEvents {
13
- ERROR = "error",
14
- SET = "cache:set",
15
- DELETE = "cache:delete"
30
+ ERROR = "error",
31
+ SET = "cache:set",
32
+ DELETE = "cache:delete"
16
33
  }
17
34
  /**
18
35
  * Configuration options for CacheableSync
19
36
  */
20
37
  type CacheableSyncOptions = {
21
- /**
22
- * Qified instance or message provider(s) for synchronization
23
- */
24
- qified: Qified | MessageProvider | MessageProvider[];
25
- /**
26
- * The namespace for sync events. It can be a string or a function that returns a string.
27
- * When set, event names will be prefixed with the namespace (e.g., "my-namespace::cache:set")
28
- */
29
- namespace?: string | (() => string);
38
+ /**
39
+ * Qified instance or message provider(s) for synchronization
40
+ */
41
+ qified: Qified | MessageProvider | MessageProvider[];
42
+ /**
43
+ * The namespace for sync events. It can be a string or a function that returns a string.
44
+ * When set, event names will be prefixed with the namespace (e.g., "my-namespace::cache:set")
45
+ */
46
+ namespace?: string | (() => string);
30
47
  } & HookifiedOptions;
31
48
  type CacheableSyncItem = {
32
- cacheId: string;
33
- key: string;
34
- value?: unknown;
35
- ttl?: number;
49
+ cacheId: string;
50
+ key: string;
51
+ value?: unknown;
52
+ ttl?: number;
36
53
  };
37
54
  /**
38
55
  * CacheableSync provides synchronization capabilities for cacheable items
39
56
  * using message providers from Qified
40
57
  */
41
58
  declare class CacheableSync extends Hookified {
42
- private _qified;
43
- private _namespace?;
44
- private _storage?;
45
- private _cacheId?;
46
- /**
47
- * Creates an instance of CacheableSync
48
- * @param options - Configuration options for CacheableSync
49
- */
50
- constructor(options: CacheableSyncOptions);
51
- /**
52
- * Gets the Qified instance used for synchronization
53
- * @returns The Qified instance
54
- */
55
- get qified(): Qified;
56
- /**
57
- * Sets the Qified instance used for synchronization
58
- * @param value - Either an existing Qified instance or MessageProvider(s)
59
- */
60
- set qified(value: Qified | MessageProvider | MessageProvider[]);
61
- /**
62
- * Gets the namespace for sync events
63
- * @returns The namespace or undefined if not set
64
- */
65
- get namespace(): string | (() => string) | undefined;
66
- /**
67
- * Sets the namespace for sync events and resubscribes if needed
68
- * @param namespace - The namespace string or function
69
- */
70
- set namespace(namespace: string | (() => string) | undefined);
71
- /**
72
- * Publishes a cache event to all the cache instances
73
- * @param data - The cache item data containing cacheId, key, value, and optional ttl
74
- */
75
- publish(event: CacheableSyncEvents, data: CacheableSyncItem): Promise<void>;
76
- /**
77
- * Subscribes to sync events and updates the provided storage
78
- * @param storage - The Keyv storage instance to update
79
- * @param cacheId - The cache ID to identify this instance
80
- */
81
- subscribe(storage: Keyv, cacheId: string): void;
82
- /**
83
- * Creates or returns a Qified instance from the provided value
84
- * @param value - Either an existing Qified instance or MessageProvider(s)
85
- * @returns A Qified instance configured with the provided message provider(s)
86
- */
87
- createQified(value: Qified | MessageProvider | MessageProvider[]): Qified;
88
- /**
89
- * Gets the namespace prefix to use for event names
90
- * @returns The resolved namespace string or undefined
91
- */
92
- private getNamespace;
93
- /**
94
- * Prefixes an event name with the namespace if one is set
95
- * @param event - The event to prefix
96
- * @returns The prefixed event name or the original event
97
- */
98
- private getPrefixedEvent;
59
+ private _qified;
60
+ private _namespace?;
61
+ private _storage?;
62
+ private _cacheId?;
63
+ /**
64
+ * Creates an instance of CacheableSync
65
+ * @param options - Configuration options for CacheableSync
66
+ */
67
+ constructor(options: CacheableSyncOptions);
68
+ /**
69
+ * Gets the Qified instance used for synchronization
70
+ * @returns The Qified instance
71
+ */
72
+ get qified(): Qified;
73
+ /**
74
+ * Sets the Qified instance used for synchronization
75
+ * @param value - Either an existing Qified instance or MessageProvider(s)
76
+ */
77
+ set qified(value: Qified | MessageProvider | MessageProvider[]);
78
+ /**
79
+ * Gets the namespace for sync events
80
+ * @returns The namespace or undefined if not set
81
+ */
82
+ get namespace(): string | (() => string) | undefined;
83
+ /**
84
+ * Sets the namespace for sync events and resubscribes if needed
85
+ * @param namespace - The namespace string or function
86
+ */
87
+ set namespace(namespace: string | (() => string) | undefined);
88
+ /**
89
+ * Publishes a cache event to all the cache instances
90
+ * @param data - The cache item data containing cacheId, key, value, and optional ttl
91
+ */
92
+ publish(event: CacheableSyncEvents, data: CacheableSyncItem): Promise<void>;
93
+ /**
94
+ * Subscribes to sync events and updates the provided storage
95
+ * @param storage - The Keyv storage instance to update
96
+ * @param cacheId - The cache ID to identify this instance
97
+ */
98
+ subscribe(storage: Keyv$1, cacheId: string): void;
99
+ /**
100
+ * Creates or returns a Qified instance from the provided value
101
+ * @param value - Either an existing Qified instance or MessageProvider(s)
102
+ * @returns A Qified instance configured with the provided message provider(s)
103
+ */
104
+ createQified(value: Qified | MessageProvider | MessageProvider[]): Qified;
105
+ /**
106
+ * Gets the namespace prefix to use for event names
107
+ * @returns The resolved namespace string or undefined
108
+ */
109
+ private getNamespace;
110
+ /**
111
+ * Prefixes an event name with the namespace if one is set
112
+ * @param event - The event to prefix
113
+ * @returns The prefixed event name or the original event
114
+ */
115
+ private getPrefixedEvent;
99
116
  }
100
-
117
+ //#endregion
118
+ //#region src/types.d.ts
119
+ /**
120
+ * Options for {@link Cacheable.getOrSet}. Identical to the shared
121
+ * `GetOrSetFunctionOptions` from `@cacheable/utils`, except `ttl` also accepts a per-store object
122
+ * (`{ primary, secondary }`) so the primary and secondary stores can be given different
123
+ * expirations for that operation.
124
+ */
125
+ type GetOrSetFunctionOptions = Omit<GetOrSetFunctionOptions$1, "ttl"> & {
126
+ ttl?: number | string | PerStoreTtl$1;
127
+ };
128
+ /**
129
+ * Options for {@link Cacheable.wrap}. Identical to the shared `WrapFunctionOptions` from
130
+ * `@cacheable/utils`, except `ttl` also accepts a per-store object (`{ primary, secondary }`) so the
131
+ * primary and secondary stores can be given different expirations for the wrapped value.
132
+ */
133
+ type WrapFunctionOptions = Omit<WrapFunctionOptions$1, "ttl"> & {
134
+ ttl?: number | string | PerStoreTtl$1;
135
+ };
101
136
  type CacheableOptions = {
102
- /**
103
- * The primary store for the cacheable instance
104
- */
105
- primary?: Keyv | KeyvStoreAdapter;
106
- /**
107
- * The secondary store for the cacheable instance
108
- */
109
- secondary?: Keyv | KeyvStoreAdapter;
110
- /**
111
- * Whether to enable statistics for the cacheable instance
112
- */
113
- stats?: boolean;
114
- /**
115
- * Whether the secondary store is non-blocking mode. It is set to false by default.
116
- * If it is set to true then the secondary store will not block the primary store.
117
- */
118
- nonBlocking?: boolean;
119
- /**
120
- * The time-to-live for the cacheable instance and will be used as the default value.
121
- * can be a number in milliseconds or a human-readable format such as `1s` for 1 second or `1h` for 1 hour
122
- * or undefined if there is no time-to-live.
123
- */
124
- ttl?: number | string;
125
- /**
126
- * The namespace for the cacheable instance. It can be a string or a function that returns a string.
127
- */
128
- namespace?: string | (() => string);
129
- /**
130
- * The cacheId for the cacheable instance. This is primarily used for the wrap function to not have conflicts.
131
- * If it is not set then it will be a random string that is generated
132
- */
133
- cacheId?: string;
134
- /**
135
- * The sync instance for the cacheable instance to enable synchronization across cache instances
136
- */
137
- sync?: CacheableSync | CacheableSyncOptions;
137
+ /**
138
+ * The primary store for the cacheable instance
139
+ */
140
+ primary?: Keyv$1 | KeyvStoreAdapter$1;
141
+ /**
142
+ * The secondary store for the cacheable instance
143
+ */
144
+ secondary?: Keyv$1 | KeyvStoreAdapter$1;
145
+ /**
146
+ * Whether to enable statistics for the cacheable instance
147
+ */
148
+ stats?: boolean;
149
+ /**
150
+ * Whether the secondary store is non-blocking mode. It is set to false by default.
151
+ * If it is set to true then the secondary store will not block the primary store.
152
+ */
153
+ nonBlocking?: boolean;
154
+ /**
155
+ * The time-to-live for the cacheable instance and will be used as the default value.
156
+ * can be a number in milliseconds or a human-readable format such as `1s` for 1 second or `1h` for 1 hour
157
+ * or undefined if there is no time-to-live.
158
+ */
159
+ ttl?: number | string;
160
+ /**
161
+ * The maximum time-to-live for the cacheable instance. When set, any TTL that exceeds this value
162
+ * is capped to maxTtl. Entries with no TTL will also be capped to maxTtl.
163
+ * Can be a number in milliseconds or a human-readable format such as `1s`, `1m`, `1h`, `1d`.
164
+ * Default is `undefined` (no maximum).
165
+ */
166
+ maxTtl?: number | string;
167
+ /**
168
+ * The namespace for the cacheable instance. It can be a string or a function that returns a string.
169
+ */
170
+ namespace?: string | (() => string);
171
+ /**
172
+ * The cacheId for the cacheable instance. This is primarily used for the wrap function to not have conflicts.
173
+ * If it is not set then it will be a random string that is generated
174
+ */
175
+ cacheId?: string;
176
+ /**
177
+ * The sync instance for the cacheable instance to enable synchronization across cache instances
178
+ */
179
+ sync?: CacheableSync | CacheableSyncOptions;
180
+ /**
181
+ * Enables the tag service so tag-based invalidation can be used and freshness checks run on
182
+ * every `get` / `getMany`. Tags must be explicitly enabled — while disabled, all tag
183
+ * operations are no-ops and values set with `tags` are stored without tag tracking. Enable
184
+ * this on every instance that shares the store (writers and readers) so invalidations are
185
+ * honored consistently across distributed instances. Default is `false`.
186
+ */
187
+ tags?: boolean;
138
188
  };
139
189
  type GetOptions = {
140
- /**
141
- * If set, this will bypass the instances nonBlocking setting.
142
- * @type {boolean}
143
- */
144
- nonBlocking?: boolean;
190
+ /**
191
+ * If set, this will bypass the instances nonBlocking setting.
192
+ * @type {boolean}
193
+ */
194
+ nonBlocking?: boolean;
195
+ };
196
+ type SetOptions = {
197
+ /**
198
+ * If set, this will bypass the instances nonBlocking setting.
199
+ * @type {boolean}
200
+ */
201
+ nonBlocking?: boolean;
202
+ /**
203
+ * Time-to-live. If you set a number it is milliseconds, if you set a string it is a
204
+ * human-readable format such as `1s` for 1 second or `1h` for 1 hour. Setting undefined means
205
+ * that it will use the default time-to-live.
206
+ *
207
+ * You can also pass a per-store object to give each store its own TTL for this operation, such
208
+ * as `{ primary: '10s', secondary: '5m' }`. Any field left undefined falls back to that store's
209
+ * own default TTL resolution. This is useful for multi-layer caches where the in-memory primary
210
+ * and a distributed secondary should expire at different rates.
211
+ * @type {number | string | PerStoreTtl}
212
+ */
213
+ ttl?: number | string | PerStoreTtl$1;
214
+ /**
215
+ * Tags to associate with the entry for tag-based invalidation. Invalidating any of these tags
216
+ * via `invalidateTag` / `invalidateTags` makes the entry stale, causing the next `get` to treat
217
+ * it as a miss and remove it.
218
+ * @type {string[]}
219
+ */
220
+ tags?: string[];
221
+ };
222
+ /**
223
+ * An item for `setMany` that can optionally carry tags for tag-based invalidation.
224
+ */
225
+ type CacheableSetItem = Omit<CacheableItem$1, "ttl"> & {
226
+ /**
227
+ * Time-to-live. If you set a number it is milliseconds, if you set a string it is a
228
+ * human-readable format such as `1s` for 1 second or `1h` for 1 hour. Setting undefined means
229
+ * that it will use the default time-to-live.
230
+ *
231
+ * You can also pass a per-store object to give each store its own TTL for this item, such as
232
+ * `{ primary: '10s', secondary: '5m' }`. Any field left undefined falls back to that store's own
233
+ * default TTL resolution.
234
+ * @type {number | string | PerStoreTtl}
235
+ */
236
+ ttl?: number | string | PerStoreTtl$1;
237
+ /**
238
+ * Tags to associate with the entry for tag-based invalidation. Invalidating any of these tags
239
+ * via `invalidateTag` / `invalidateTags` makes the entry stale, causing the next `get` to treat
240
+ * it as a miss and remove it.
241
+ * @type {string[]}
242
+ */
243
+ tags?: string[];
244
+ };
245
+ /**
246
+ * The mutable item passed to the `BEFORE_SET` and `AFTER_SET` hooks. Within a `BEFORE_SET` handler
247
+ * you may reassign `ttl` to give the entry a new expiration — either a single value (a number in
248
+ * milliseconds or a shorthand string, applied to every store) or a per-store object
249
+ * (`{ primary, secondary }`) so the primary and secondary stores expire at different rates. Any
250
+ * assignment counts as an override (even assigning the value it already holds); a field omitted from
251
+ * a per-store object falls back to that store's normal TTL resolution.
252
+ *
253
+ * By the time `AFTER_SET` runs, `ttl` has been normalized to the effective **primary** TTL as a
254
+ * number (the value written to the primary store, after `maxTtl` capping); the secondary store's
255
+ * effective TTL is not exposed on the item.
256
+ */
257
+ type CacheableHookItem<T = unknown> = {
258
+ key: string;
259
+ value: T;
260
+ ttl?: number | string | PerStoreTtl$1;
261
+ tags?: string[];
262
+ };
263
+ /**
264
+ * The item passed to the `AFTER_GET` hook after a `get` / `getRaw`.
265
+ */
266
+ type CacheableAfterGetItem = {
267
+ key: string;
268
+ result?: StoredDataRaw<unknown>;
269
+ ttl?: number | string;
270
+ };
271
+ /**
272
+ * The item passed to the `AFTER_GET_MANY` hook after a `getMany` / `getManyRaw`.
273
+ */
274
+ type CacheableAfterGetManyItem = {
275
+ keys: string[];
276
+ result: Array<StoredDataRaw<unknown>>;
277
+ };
278
+ /**
279
+ * The item passed to the `BEFORE_SECONDARY_SETS_PRIMARY` hook. This hook only writes the primary
280
+ * store, so its `ttl` is a single value (a number in milliseconds or a shorthand string), not a
281
+ * per-store object.
282
+ */
283
+ type CacheableSecondarySetsPrimaryItem<T = unknown> = {
284
+ key: string;
285
+ value: T;
286
+ ttl?: number | string;
287
+ };
288
+ //#endregion
289
+ //#region src/index.d.ts
290
+ /**
291
+ * Maps each {@link CacheableHooks} name to the payload its handler receives, so `onHook` can be
292
+ * strongly typed. Within `BEFORE_SET` you can reassign `item.ttl` (including to a per-store
293
+ * `{ primary, secondary }` object); `BEFORE_SECONDARY_SETS_PRIMARY` only writes the primary store,
294
+ * so its `ttl` is a single value.
295
+ */
296
+ type CacheableHookHandlerMap = {
297
+ [CacheableHooks.BEFORE_SET]: (item: CacheableHookItem) => void | Promise<void>;
298
+ [CacheableHooks.AFTER_SET]: (item: CacheableHookItem) => void | Promise<void>;
299
+ [CacheableHooks.BEFORE_SET_MANY]: (items: CacheableSetItem[]) => void | Promise<void>;
300
+ [CacheableHooks.AFTER_SET_MANY]: (items: CacheableSetItem[]) => void | Promise<void>;
301
+ [CacheableHooks.BEFORE_GET]: (key: string) => void | Promise<void>;
302
+ [CacheableHooks.AFTER_GET]: (item: CacheableAfterGetItem) => void | Promise<void>;
303
+ [CacheableHooks.BEFORE_GET_MANY]: (keys: string[]) => void | Promise<void>;
304
+ [CacheableHooks.AFTER_GET_MANY]: (item: CacheableAfterGetManyItem) => void | Promise<void>;
305
+ [CacheableHooks.BEFORE_SECONDARY_SETS_PRIMARY]: (item: CacheableSecondarySetsPrimaryItem) => void | Promise<void>;
145
306
  };
146
-
147
- declare enum CacheableHooks {
148
- BEFORE_SET = "BEFORE_SET",
149
- AFTER_SET = "AFTER_SET",
150
- BEFORE_SET_MANY = "BEFORE_SET_MANY",
151
- AFTER_SET_MANY = "AFTER_SET_MANY",
152
- BEFORE_GET = "BEFORE_GET",
153
- AFTER_GET = "AFTER_GET",
154
- BEFORE_GET_MANY = "BEFORE_GET_MANY",
155
- AFTER_GET_MANY = "AFTER_GET_MANY",
156
- BEFORE_SECONDARY_SETS_PRIMARY = "BEFORE_SECONDARY_SETS_PRIMARY"
157
- }
158
- declare enum CacheableEvents {
159
- ERROR = "error",
160
- CACHE_HIT = "cache:hit",
161
- CACHE_MISS = "cache:miss"
162
- }
163
-
164
307
  declare class Cacheable extends Hookified {
165
- private _primary;
166
- private _secondary;
167
- private _nonBlocking;
168
- private _ttl?;
169
- private readonly _stats;
170
- private _namespace?;
171
- private _cacheId;
172
- private _sync?;
173
- /**
174
- * Creates a new cacheable instance
175
- * @param {CacheableOptions} [options] The options for the cacheable instance
176
- */
177
- constructor(options?: CacheableOptions);
178
- /**
179
- * The namespace for the cacheable instance
180
- * @returns {string | (() => string) | undefined} The namespace for the cacheable instance
181
- */
182
- get namespace(): string | (() => string) | undefined;
183
- /**
184
- * Sets the namespace for the cacheable instance
185
- * @param {string | (() => string) | undefined} namespace The namespace for the cacheable instance
186
- * @returns {void}
187
- */
188
- set namespace(namespace: string | (() => string) | undefined);
189
- /**
190
- * The statistics for the cacheable instance
191
- * @returns {CacheableStats} The statistics for the cacheable instance
192
- */
193
- get stats(): Stats;
194
- /**
195
- * The primary store for the cacheable instance
196
- * @returns {Keyv} The primary store for the cacheable instance
197
- */
198
- get primary(): Keyv;
199
- /**
200
- * Sets the primary store for the cacheable instance
201
- * @param {Keyv} primary The primary store for the cacheable instance
202
- */
203
- set primary(primary: Keyv);
204
- /**
205
- * The secondary store for the cacheable instance
206
- * @returns {Keyv | undefined} The secondary store for the cacheable instance
207
- */
208
- get secondary(): Keyv | undefined;
209
- /**
210
- * Sets the secondary store for the cacheable instance. If it is set to undefined then the secondary store is disabled.
211
- * @param {Keyv | undefined} secondary The secondary store for the cacheable instance
212
- * @returns {void}
213
- */
214
- set secondary(secondary: Keyv | undefined);
215
- /**
216
- * Gets whether the secondary store is non-blocking mode. It is set to false by default.
217
- * If it is set to true then the secondary store will not block the primary store.
218
- *
219
- * [Learn more about non-blocking mode](https://cacheable.org/docs/cacheable/#non-blocking-operations).
220
- *
221
- * @returns {boolean} Whether the cacheable instance is non-blocking
222
- */
223
- get nonBlocking(): boolean;
224
- /**
225
- * Sets whether the secondary store is non-blocking mode. It is set to false by default.
226
- * If it is set to true then the secondary store will not block the primary store.
227
- *
228
- * [Learn more about non-blocking mode](https://cacheable.org/docs/cacheable/#non-blocking-operations).
229
- *
230
- * @param {boolean} nonBlocking Whether the cacheable instance is non-blocking
231
- * @returns {void}
232
- */
233
- set nonBlocking(nonBlocking: boolean);
234
- /**
235
- * The time-to-live for the cacheable instance and will be used as the default value.
236
- * can be a number in milliseconds or a human-readable format such as `1s` for 1 second or `1h` for 1 hour
237
- * or undefined if there is no time-to-live.
238
- *
239
- * [Learn more about time-to-live](https://cacheable.org/docs/cacheable/#shorthand-for-time-to-live-ttl).
240
- *
241
- * @returns {number | string | undefined} The time-to-live for the cacheable instance in milliseconds, human-readable format or undefined
242
- * @example
243
- * ```typescript
244
- * const cacheable = new Cacheable({ ttl: '1h' });
245
- * console.log(cacheable.ttl); // 1h
246
- * ```
247
- */
248
- get ttl(): number | string | undefined;
249
- /**
250
- * Sets the time-to-live for the cacheable instance and will be used as the default value.
251
- * If you set a number it is miliseconds, if you set a string it is a human-readable
252
- * format such as `1s` for 1 second or `1h` for 1 hour. Setting undefined means that
253
- * there is no time-to-live.
254
- *
255
- * [Learn more about time-to-live](https://cacheable.org/docs/cacheable/#shorthand-for-time-to-live-ttl).
256
- *
257
- * @param {number | string | undefined} ttl The time-to-live for the cacheable instance
258
- * @example
259
- * ```typescript
260
- * const cacheable = new Cacheable();
261
- * cacheable.ttl = '1h'; // Set the time-to-live to 1 hour
262
- * ```
263
- * or setting the time-to-live in milliseconds
264
- * ```typescript
265
- * const cacheable = new Cacheable();
266
- * cacheable.ttl = 3600000; // Set the time-to-live to 1 hour
267
- * ```
268
- */
269
- set ttl(ttl: number | string | undefined);
270
- /**
271
- * The cacheId for the cacheable instance. This is primarily used for the wrap function to not have conflicts.
272
- * If it is not set then it will be a random string that is generated
273
- * @returns {string} The cacheId for the cacheable instance
274
- */
275
- get cacheId(): string;
276
- /**
277
- * Sets the cacheId for the cacheable instance. This is primarily used for the wrap function to not have conflicts.
278
- * If it is not set then it will be a random string that is generated
279
- * @param {string} cacheId The cacheId for the cacheable instance
280
- */
281
- set cacheId(cacheId: string);
282
- /**
283
- * Gets the sync instance for the cacheable instance
284
- * @returns {CacheableSync | undefined} The sync instance for the cacheable instance
285
- */
286
- get sync(): CacheableSync | undefined;
287
- /**
288
- * Sets the sync instance for the cacheable instance
289
- * @param {CacheableSync | undefined} sync The sync instance for the cacheable instance
290
- */
291
- set sync(sync: CacheableSync | undefined);
292
- /**
293
- * Sets the primary store for the cacheable instance
294
- * @param {Keyv | KeyvStoreAdapter} primary The primary store for the cacheable instance
295
- * @returns {void}
296
- */
297
- setPrimary(primary: Keyv | KeyvStoreAdapter): void;
298
- /**
299
- * Sets the secondary store for the cacheable instance. If it is set to undefined then the secondary store is disabled.
300
- * @param {Keyv | KeyvStoreAdapter} secondary The secondary store for the cacheable instance
301
- * @returns {void}
302
- */
303
- setSecondary(secondary: Keyv | KeyvStoreAdapter): void;
304
- getNameSpace(): string | undefined;
305
- /**
306
- * Retrieves an entry from the cache.
307
- *
308
- * Checks the primary store first; if not found and a secondary store is configured,
309
- * it will fetch from the secondary, repopulate the primary, and return the result.
310
- *
311
- * @typeParam T - The expected type of the stored value.
312
- * @param {string} key - The cache key to retrieve.
313
- * @param {GetOptions} - options such as to bypass `nonBlocking` for this call
314
- * @returns {Promise<T | undefined>}
315
- * A promise that resolves to the cached value if found, or `undefined`.
316
- */
317
- get<T>(key: string, options?: GetOptions): Promise<T | undefined>;
318
- /**
319
- * Retrieves the raw entry from the cache including metadata like expiration.
320
- *
321
- * Checks the primary store first; if not found and a secondary store is configured,
322
- * it will fetch from the secondary, repopulate the primary, and return the result.
323
- *
324
- * @typeParam T - The expected type of the stored value.
325
- * @param {string} key - The cache key to retrieve.
326
- * @param {GetOptions} - options such as to bypass `nonBlocking` for this call
327
- * @returns {Promise<StoredDataRaw<T>>}
328
- * A promise that resolves to the full raw data object if found, or undefined.
329
- */
330
- getRaw<T>(key: string, options?: GetOptions): Promise<StoredDataRaw<T>>;
331
- /**
332
- * Retrieves multiple raw entries from the cache including metadata like expiration.
333
- *
334
- * Checks the primary store for each key; if a key is missing and a secondary store is configured,
335
- * it will fetch from the secondary store, repopulate the primary store, and return the results.
336
- *
337
- * @typeParam T - The expected type of the stored values.
338
- * @param {string[]} keys - The cache keys to retrieve.
339
- * @param {GetOptions} - options such as to bypass `nonBlocking` on this call
340
- * @returns {Promise<Array<StoredDataRaw<T>>>}
341
- * A promise that resolves to an array of raw data objects.
342
- */
343
- getManyRaw<T>(keys: string[], options?: GetOptions): Promise<Array<StoredDataRaw<T>>>;
344
- /**
345
- * Retrieves multiple entries from the cache.
346
- * Checks the primary store for each key; if a key is missing and a secondary store is configured,
347
- * it will fetch from the secondary store, repopulate the primary store, and return the results.
348
- *
349
- * @typeParam T - The expected type of the stored values.
350
- * @param {string[]} keys - The cache keys to retrieve.
351
- * @param {GetOptions} - options such as to bypass `nonBlocking` on this call
352
- * @returns {Promise<Array<T | undefined>>}
353
- * A promise that resolves to an array of cached values or `undefined` for misses.
354
- */
355
- getMany<T>(keys: string[], options?: GetOptions): Promise<Array<T | undefined>>;
356
- /**
357
- * Sets the value of the key. If the secondary store is set then it will also set the value in the secondary store.
358
- * @param {string} key the key to set the value of
359
- * @param {T} value The value to set
360
- * @param {number | string} [ttl] set a number it is miliseconds, set a string it is a human-readable
361
- * format such as `1s` for 1 second or `1h` for 1 hour. Setting undefined means that it will use the default time-to-live.
362
- * @returns {boolean} Whether the value was set
363
- */
364
- set<T>(key: string, value: T, ttl?: number | string): Promise<boolean>;
365
- /**
366
- * Sets the values of the keys. If the secondary store is set then it will also set the values in the secondary store.
367
- * @param {CacheableItem[]} items The items to set
368
- * @returns {boolean} Whether the values were set
369
- */
370
- setMany(items: CacheableItem[]): Promise<boolean>;
371
- /**
372
- * Takes the value of the key and deletes the key. If the key does not exist then it will return undefined.
373
- * @param {string} key The key to take the value of
374
- * @returns {Promise<T | undefined>} The value of the key or undefined if the key does not exist
375
- */
376
- take<T>(key: string): Promise<T | undefined>;
377
- /**
378
- * Takes the values of the keys and deletes the keys. If the key does not exist then it will return undefined.
379
- * @param {string[]} keys The keys to take the values of
380
- * @returns {Promise<Array<T | undefined>>} The values of the keys or undefined if the key does not exist
381
- */
382
- takeMany<T>(keys: string[]): Promise<Array<T | undefined>>;
383
- /**
384
- * Checks if the key exists in the primary store. If it does not exist then it will check the secondary store.
385
- * @param {string} key The key to check
386
- * @returns {Promise<boolean>} Whether the key exists
387
- */
388
- has(key: string): Promise<boolean>;
389
- /**
390
- * Checks if the keys exist in the primary store. If it does not exist then it will check the secondary store.
391
- * @param {string[]} keys The keys to check
392
- * @returns {Promise<boolean[]>} Whether the keys exist
393
- */
394
- hasMany(keys: string[]): Promise<boolean[]>;
395
- /**
396
- * Deletes the key from the primary store. If the secondary store is set then it will also delete the key from the secondary store.
397
- * @param {string} key The key to delete
398
- * @returns {Promise<boolean>} Whether the key was deleted
399
- */
400
- delete(key: string): Promise<boolean>;
401
- /**
402
- * Deletes the keys from the primary store. If the secondary store is set then it will also delete the keys from the secondary store.
403
- * @param {string[]} keys The keys to delete
404
- * @returns {Promise<boolean>} Whether the keys were deleted
405
- */
406
- deleteMany(keys: string[]): Promise<boolean>;
407
- /**
408
- * Clears the primary store. If the secondary store is set then it will also clear the secondary store.
409
- * @returns {Promise<void>}
410
- */
411
- clear(): Promise<void>;
412
- /**
413
- * Disconnects the primary store. If the secondary store is set then it will also disconnect the secondary store.
414
- * @returns {Promise<void>}
415
- */
416
- disconnect(): Promise<void>;
417
- /**
418
- * Wraps a function with caching
419
- *
420
- * [Learn more about wrapping functions](https://cacheable.org/docs/cacheable/#wrap--memoization-for-sync-and-async-functions).
421
- * @param {Function} function_ The function to wrap
422
- * @param {WrapOptions} [options] The options for the wrap function
423
- * @returns {Function} The wrapped function
424
- */
425
- wrap<T, Arguments extends any[]>(function_: (...arguments_: Arguments) => T, options?: WrapFunctionOptions): (...arguments_: Arguments) => T;
426
- /**
427
- * Retrieves the value associated with the given key from the cache. If the key is not found,
428
- * invokes the provided function to calculate the value, stores it in the cache, and then returns it.
429
- *
430
- * @param {GetOrSetKey} key - The key to retrieve or set in the cache. This can also be a function that returns a string key.
431
- * If a function is provided, it will be called with the cache options to generate the key.
432
- * @param {() => Promise<T>} function_ - The asynchronous function that computes the value to be cached if the key does not exist.
433
- * @param {GetOrSetFunctionOptions} [options] - Optional settings for caching, such as the time to live (TTL) or whether to cache errors.
434
- * @return {Promise<T | undefined>} - A promise that resolves to the cached or newly computed value, or undefined if an error occurs and caching is not configured for errors.
435
- */
436
- getOrSet<T>(key: GetOrSetKey, function_: () => Promise<T>, options?: GetOrSetFunctionOptions): Promise<T | undefined>;
437
- /**
438
- * Will hash an object asynchronously using the specified cryptographic algorithm.
439
- * Use this for cryptographic algorithms (SHA-256, SHA-384, SHA-512).
440
- * For non-cryptographic algorithms, use hashSync() for better performance.
441
- * @param {any} object the object to hash
442
- * @param {string} algorithm the hash algorithm to use. The default is 'SHA-256'
443
- * @returns {Promise<string>} the hash of the object
444
- */
445
- hash(object: any, algorithm?: HashAlgorithm): Promise<string>;
446
- /**
447
- * Will hash an object synchronously using the specified non-cryptographic algorithm.
448
- * Use this for non-cryptographic algorithms (DJB2, FNV1, MURMER, CRC32).
449
- * For cryptographic algorithms, use hash() instead.
450
- * @param {any} object the object to hash
451
- * @param {string} algorithm the hash algorithm to use. The default is 'djb2'
452
- * @returns {string} the hash of the object
453
- */
454
- hashSync(object: any, algorithm?: HashAlgorithm): string;
455
- private setManyKeyv;
456
- /**
457
- * Processes a single key from secondary store for getRaw operation
458
- * @param primary - the primary store to use
459
- * @param secondary - the secondary store to use
460
- * @param key - The key to retrieve from secondary store
461
- * @returns Promise containing the result and TTL information
462
- */
463
- private processSecondaryForGetRaw;
464
- /**
465
- * Processes a single key from secondary store for getRaw operation in non-blocking mode
466
- * Non-blocking mode means we don't wait for secondary operations that update primary store
467
- * @param primary - the primary store to use
468
- * @param secondary - the secondary store to use
469
- * @param key - The key to retrieve from secondary store
470
- * @returns Promise containing the result and TTL information
471
- */
472
- private processSecondaryForGetRawNonBlocking;
473
- /**
474
- * Processes missing keys from secondary store for getManyRaw operation
475
- * @param primary - the primary store to use
476
- * @param secondary - the secondary store to use
477
- * @param keys - The original array of keys requested
478
- * @param result - The result array from primary store (will be modified)
479
- * @returns Promise<void>
480
- */
481
- private processSecondaryForGetManyRaw;
482
- /**
483
- * Processes missing keys from secondary store for getManyRaw operation in non-blocking mode
484
- * Non-blocking mode means we don't wait for secondary operations that update primary store
485
- * @param secondary - the secondary store to use
486
- * @param keys - The original array of keys requested
487
- * @param result - The result array from primary store (will be modified)
488
- * @returns Promise<void>
489
- */
490
- private processSecondaryForGetManyRawNonBlocking;
491
- private setTtl;
308
+ private static _instance?;
309
+ private _primary;
310
+ private _secondary;
311
+ private _nonBlocking;
312
+ private _ttl?;
313
+ private _maxTtl?;
314
+ private readonly _stats;
315
+ private _namespace?;
316
+ private _cacheId;
317
+ private _sync?;
318
+ private _tags;
319
+ /**
320
+ * Creates a new cacheable instance
321
+ * @param {CacheableOptions} [options] The options for the cacheable instance
322
+ */
323
+ constructor(options?: CacheableOptions);
324
+ /**
325
+ * Gets a shared static (singleton) instance of {@link Cacheable}. The first call creates the
326
+ * instance using the provided options; every later call returns that same instance. Passing
327
+ * `options` again after the instance already exists does NOT reconfigure it — the options are
328
+ * ignored and a {@link CacheableEvents.ERROR} event is emitted on the instance to surface the
329
+ * conflict (listen with `instance.on("error", ...)`). To reconfigure, replace it via
330
+ * {@link Cacheable.setStaticInstance} (clear with `undefined`, then call this again).
331
+ *
332
+ * Note: this package ships separate CommonJS and ESM builds, so an app that loads both formats
333
+ * gets one shared instance per build. For a single shared cache, use one module format or share
334
+ * an explicit instance via {@link Cacheable.setStaticInstance}.
335
+ * @param {CacheableOptions} [options] Options applied only when the instance is first created
336
+ * @returns {Cacheable} The shared static instance
337
+ * @example
338
+ * ```ts
339
+ * const cache = Cacheable.getStaticInstance({ ttl: "1h" });
340
+ * await cache.set("key", "value");
341
+ * ```
342
+ */
343
+ static getStaticInstance(options?: CacheableOptions): Cacheable;
344
+ /**
345
+ * Sets or clears the shared static instance returned by {@link Cacheable.getStaticInstance}.
346
+ * Pass a {@link Cacheable} instance to make it the shared instance, or `undefined` to clear it
347
+ * so the next {@link Cacheable.getStaticInstance} call creates a fresh one. Clearing only drops
348
+ * the reference it does not `disconnect()` or `clear()` the previous instance, so disconnect
349
+ * it first if it holds open connections.
350
+ * @param {Cacheable} [instance] The instance to share, or `undefined` to clear it
351
+ */
352
+ static setStaticInstance(instance?: Cacheable): void;
353
+ /**
354
+ * Registers a handler for a hook. Built-in {@link CacheableHooks} names get a strongly-typed
355
+ * payload (e.g. `BEFORE_SET` receives a {@link CacheableHookItem} whose `ttl` you can reassign);
356
+ * any other event name falls back to the loose Hookified signature.
357
+ * @param hook The hook to register the handler for
358
+ * @param handler The handler to call when the hook is triggered
359
+ */
360
+ onHook<K extends CacheableHooks>(hook: K, handler: CacheableHookHandlerMap[K]): void;
361
+ onHook(event: string, handler: Hook): void;
362
+ /**
363
+ * The namespace for the cacheable instance
364
+ * @returns {string | (() => string) | undefined} The namespace for the cacheable instance
365
+ */
366
+ get namespace(): string | (() => string) | undefined;
367
+ /**
368
+ * Sets the namespace for the cacheable instance
369
+ * @param {string | (() => string) | undefined} namespace The namespace for the cacheable instance
370
+ * @returns {void}
371
+ */
372
+ set namespace(namespace: string | (() => string) | undefined);
373
+ /**
374
+ * The statistics for the cacheable instance
375
+ * @returns {CacheableStats} The statistics for the cacheable instance
376
+ */
377
+ get stats(): Stats;
378
+ /**
379
+ * The primary store for the cacheable instance
380
+ * @returns {Keyv} The primary store for the cacheable instance
381
+ */
382
+ get primary(): Keyv$1;
383
+ /**
384
+ * Sets the primary store for the cacheable instance
385
+ * @param {Keyv} primary The primary store for the cacheable instance
386
+ */
387
+ set primary(primary: Keyv$1);
388
+ /**
389
+ * The secondary store for the cacheable instance
390
+ * @returns {Keyv | undefined} The secondary store for the cacheable instance
391
+ */
392
+ get secondary(): Keyv$1 | undefined;
393
+ /**
394
+ * Sets the secondary store for the cacheable instance. If it is set to undefined then the secondary store is disabled.
395
+ * @param {Keyv | undefined} secondary The secondary store for the cacheable instance
396
+ * @returns {void}
397
+ */
398
+ set secondary(secondary: Keyv$1 | undefined);
399
+ /**
400
+ * Gets whether the secondary store is non-blocking mode. It is set to false by default.
401
+ * If it is set to true then the secondary store will not block the primary store.
402
+ *
403
+ * [Learn more about non-blocking mode](https://cacheable.org/docs/cacheable/#non-blocking-operations).
404
+ *
405
+ * @returns {boolean} Whether the cacheable instance is non-blocking
406
+ */
407
+ get nonBlocking(): boolean;
408
+ /**
409
+ * Sets whether the secondary store is non-blocking mode. It is set to false by default.
410
+ * If it is set to true then the secondary store will not block the primary store.
411
+ *
412
+ * [Learn more about non-blocking mode](https://cacheable.org/docs/cacheable/#non-blocking-operations).
413
+ *
414
+ * @param {boolean} nonBlocking Whether the cacheable instance is non-blocking
415
+ * @returns {void}
416
+ */
417
+ set nonBlocking(nonBlocking: boolean);
418
+ /**
419
+ * The time-to-live for the cacheable instance and will be used as the default value.
420
+ * can be a number in milliseconds or a human-readable format such as `1s` for 1 second or `1h` for 1 hour
421
+ * or undefined if there is no time-to-live.
422
+ *
423
+ * [Learn more about time-to-live](https://cacheable.org/docs/cacheable/#shorthand-for-time-to-live-ttl).
424
+ *
425
+ * @returns {number | string | undefined} The time-to-live for the cacheable instance in milliseconds, human-readable format or undefined
426
+ * @example
427
+ * ```typescript
428
+ * const cacheable = new Cacheable({ ttl: '1h' });
429
+ * console.log(cacheable.ttl); // 1h
430
+ * ```
431
+ */
432
+ get ttl(): number | string | undefined;
433
+ /**
434
+ * Sets the time-to-live for the cacheable instance and will be used as the default value.
435
+ * If you set a number it is miliseconds, if you set a string it is a human-readable
436
+ * format such as `1s` for 1 second or `1h` for 1 hour. Setting undefined means that
437
+ * there is no time-to-live.
438
+ *
439
+ * [Learn more about time-to-live](https://cacheable.org/docs/cacheable/#shorthand-for-time-to-live-ttl).
440
+ *
441
+ * @param {number | string | undefined} ttl The time-to-live for the cacheable instance
442
+ * @example
443
+ * ```typescript
444
+ * const cacheable = new Cacheable();
445
+ * cacheable.ttl = '1h'; // Set the time-to-live to 1 hour
446
+ * ```
447
+ * or setting the time-to-live in milliseconds
448
+ * ```typescript
449
+ * const cacheable = new Cacheable();
450
+ * cacheable.ttl = 3600000; // Set the time-to-live to 1 hour
451
+ * ```
452
+ */
453
+ set ttl(ttl: number | string | undefined);
454
+ /**
455
+ * Gets the maximum time-to-live for the cacheable instance. When set, any TTL that exceeds this
456
+ * value is capped to maxTtl. Entries with no TTL will also be capped to maxTtl.
457
+ * Can be a number in milliseconds or a human-readable format such as `1s`, `1m`, `1h`, `1d`.
458
+ * Default is `undefined` (no maximum).
459
+ *
460
+ * @returns {number | string | undefined} The maximum time-to-live or undefined if not set
461
+ * @example
462
+ * ```typescript
463
+ * const cacheable = new Cacheable({ maxTtl: '1h' });
464
+ * console.log(cacheable.maxTtl); // '1h'
465
+ * ```
466
+ */
467
+ get maxTtl(): number | string | undefined;
468
+ /**
469
+ * Sets the maximum time-to-live for the cacheable instance. When set, any TTL that exceeds this
470
+ * value is capped to maxTtl. Entries with no TTL will also be capped to maxTtl.
471
+ * If you set a number it is milliseconds, if you set a string it is a human-readable
472
+ * format such as `1s` for 1 second or `1h` for 1 hour. Setting undefined disables the maximum.
473
+ *
474
+ * @param {number | string | undefined} maxTtl The maximum time-to-live
475
+ * @example
476
+ * ```typescript
477
+ * const cacheable = new Cacheable();
478
+ * cacheable.maxTtl = '1h'; // Set the max TTL to 1 hour
479
+ * ```
480
+ */
481
+ set maxTtl(maxTtl: number | string | undefined);
482
+ /**
483
+ * The cacheId for the cacheable instance. This is primarily used for the wrap function to not have conflicts.
484
+ * If it is not set then it will be a random string that is generated
485
+ * @returns {string} The cacheId for the cacheable instance
486
+ */
487
+ get cacheId(): string;
488
+ /**
489
+ * Sets the cacheId for the cacheable instance. This is primarily used for the wrap function to not have conflicts.
490
+ * If it is not set then it will be a random string that is generated
491
+ * @param {string} cacheId The cacheId for the cacheable instance
492
+ */
493
+ set cacheId(cacheId: string);
494
+ /**
495
+ * Gets the sync instance for the cacheable instance
496
+ * @returns {CacheableSync | undefined} The sync instance for the cacheable instance
497
+ */
498
+ get sync(): CacheableSync | undefined;
499
+ /**
500
+ * Sets the sync instance for the cacheable instance
501
+ * @param {CacheableSync | undefined} sync The sync instance for the cacheable instance
502
+ */
503
+ set sync(sync: CacheableSync | undefined);
504
+ /**
505
+ * The tag service for the cacheable instance, used for tag-based invalidation. It is created
506
+ * by default in the constructor and persists tag metadata in the secondary store when one is
507
+ * configured (so invalidations are shared across instances), otherwise the primary store.
508
+ *
509
+ * The service starts disabled so untagged workloads pay no extra store reads, and must be
510
+ * explicitly enabled to use tags via the `tags: true` option or the `tags.enabled`
511
+ * property. While disabled, all tag operations are no-ops. Enable it on every instance that
512
+ * shares the store so behavior is consistent across distributed instances. While enabled,
513
+ * `get` / `getMany` perform tag freshness checks and remove stale entries.
514
+ *
515
+ * [Learn more about tag-based invalidation](https://cacheable.org/docs/cacheable/#tag-based-invalidation).
516
+ *
517
+ * @returns {CacheTags} The tag service for the cacheable instance
518
+ * @example
519
+ * ```typescript
520
+ * const cache = new Cacheable({ tags: true });
521
+ * await cache.set('page:/products', html, { tags: ['entity:42'] });
522
+ * await cache.tags.invalidateTag('entity:42');
523
+ * await cache.get('page:/products'); // undefined
524
+ * ```
525
+ */
526
+ get tags(): CacheTags$1;
527
+ /**
528
+ * Creates the tag service backed by the secondary store when one is configured, otherwise the
529
+ * primary store, preserving the enabled state of any previous service and reporting
530
+ * non-blocking failures as error events.
531
+ */
532
+ private createCacheTags;
533
+ /**
534
+ * Sets the primary store for the cacheable instance
535
+ * @param {Keyv | KeyvStoreAdapter} primary The primary store for the cacheable instance
536
+ * @returns {void}
537
+ */
538
+ setPrimary(primary: Keyv$1 | KeyvStoreAdapter$1): void;
539
+ /**
540
+ * Sets the secondary store for the cacheable instance. If it is set to undefined then the secondary store is disabled.
541
+ * @param {Keyv | KeyvStoreAdapter} secondary The secondary store for the cacheable instance
542
+ * @returns {void}
543
+ */
544
+ setSecondary(secondary: Keyv$1 | KeyvStoreAdapter$1): void;
545
+ getNameSpace(): string | undefined;
546
+ /**
547
+ * Retrieves an entry from the cache.
548
+ *
549
+ * Checks the primary store first; if not found and a secondary store is configured,
550
+ * it will fetch from the secondary, repopulate the primary, and return the result.
551
+ *
552
+ * @typeParam T - The expected type of the stored value.
553
+ * @param {string} key - The cache key to retrieve.
554
+ * @param {GetOptions} - options such as to bypass `nonBlocking` for this call
555
+ * @returns {Promise<T | undefined>}
556
+ * A promise that resolves to the cached value if found, or `undefined`.
557
+ */
558
+ get<T>(key: string, options?: GetOptions): Promise<T | undefined>;
559
+ /**
560
+ * Retrieves the raw entry from the cache including metadata like expiration.
561
+ *
562
+ * Checks the primary store first; if not found and a secondary store is configured,
563
+ * it will fetch from the secondary, repopulate the primary, and return the result.
564
+ *
565
+ * @typeParam T - The expected type of the stored value.
566
+ * @param {string} key - The cache key to retrieve.
567
+ * @param {GetOptions} - options such as to bypass `nonBlocking` for this call
568
+ * @returns {Promise<StoredDataRaw<T>>}
569
+ * A promise that resolves to the full raw data object if found, or undefined.
570
+ */
571
+ getRaw<T>(key: string, options?: GetOptions): Promise<StoredDataRaw<T>>;
572
+ /**
573
+ * Retrieves multiple raw entries from the cache including metadata like expiration.
574
+ *
575
+ * Checks the primary store for each key; if a key is missing and a secondary store is configured,
576
+ * it will fetch from the secondary store, repopulate the primary store, and return the results.
577
+ *
578
+ * @typeParam T - The expected type of the stored values.
579
+ * @param {string[]} keys - The cache keys to retrieve.
580
+ * @param {GetOptions} - options such as to bypass `nonBlocking` on this call
581
+ * @returns {Promise<Array<StoredDataRaw<T>>>}
582
+ * A promise that resolves to an array of raw data objects.
583
+ */
584
+ getManyRaw<T>(keys: string[], options?: GetOptions): Promise<Array<StoredDataRaw<T>>>;
585
+ /**
586
+ * Retrieves multiple entries from the cache.
587
+ * Checks the primary store for each key; if a key is missing and a secondary store is configured,
588
+ * it will fetch from the secondary store, repopulate the primary store, and return the results.
589
+ *
590
+ * @typeParam T - The expected type of the stored values.
591
+ * @param {string[]} keys - The cache keys to retrieve.
592
+ * @param {GetOptions} - options such as to bypass `nonBlocking` on this call
593
+ * @returns {Promise<Array<T | undefined>>}
594
+ * A promise that resolves to an array of cached values or `undefined` for misses.
595
+ */
596
+ getMany<T>(keys: string[], options?: GetOptions): Promise<Array<T | undefined>>;
597
+ /**
598
+ * Sets the value of the key. If the secondary store is set then it will also set the value in the secondary store.
599
+ * @param {string} key the key to set the value of
600
+ * @param {T} value The value to set
601
+ * @param {number | string | SetOptions} [ttlOrOptions] set a number it is miliseconds, set a string it is a human-readable
602
+ * format such as `1s` for 1 second or `1h` for 1 hour. Setting undefined means that it will use the default time-to-live.
603
+ * You can also pass a {@link SetOptions} object such as `{ ttl: '1h', tags: ['user:42'] }` to associate the entry with
604
+ * tags for tag-based invalidation. To give each store its own TTL for this operation, pass a per-store object as the
605
+ * `ttl`, such as `{ ttl: { primary: '10s', secondary: '5m' } }`.
606
+ * @returns {boolean} Whether the value was set
607
+ */
608
+ set<T>(key: string, value: T, ttlOrOptions?: number | string | SetOptions): Promise<boolean>;
609
+ /**
610
+ * Sets the values of the keys. If the secondary store is set then it will also set the values in the secondary store.
611
+ * Items can include `tags` to associate the entry with tags for tag-based invalidation.
612
+ * @param {CacheableSetItem[]} items The items to set
613
+ * @returns {boolean} Whether the values were set
614
+ */
615
+ setMany(items: CacheableSetItem[]): Promise<boolean>;
616
+ /**
617
+ * Takes the value of the key and deletes the key. If the key does not exist then it will return undefined.
618
+ * @param {string} key The key to take the value of
619
+ * @returns {Promise<T | undefined>} The value of the key or undefined if the key does not exist
620
+ */
621
+ take<T>(key: string): Promise<T | undefined>;
622
+ /**
623
+ * Takes the values of the keys and deletes the keys. If the key does not exist then it will return undefined.
624
+ * @param {string[]} keys The keys to take the values of
625
+ * @returns {Promise<Array<T | undefined>>} The values of the keys or undefined if the key does not exist
626
+ */
627
+ takeMany<T>(keys: string[]): Promise<Array<T | undefined>>;
628
+ /**
629
+ * Checks if the key exists in the primary store. If it does not exist then it will check the secondary store.
630
+ * @param {string} key The key to check
631
+ * @returns {Promise<boolean>} Whether the key exists
632
+ */
633
+ has(key: string): Promise<boolean>;
634
+ /**
635
+ * Checks if the keys exist in the primary store. If it does not exist then it will check the secondary store.
636
+ * @param {string[]} keys The keys to check
637
+ * @returns {Promise<boolean[]>} Whether the keys exist
638
+ */
639
+ hasMany(keys: string[]): Promise<boolean[]>;
640
+ /**
641
+ * Deletes the key from the primary store. If the secondary store is set then it will also delete the key from the secondary store.
642
+ * @param {string} key The key to delete
643
+ * @returns {Promise<boolean>} Whether the key was deleted
644
+ */
645
+ delete(key: string): Promise<boolean>;
646
+ /**
647
+ * Deletes the keys from the primary store. If the secondary store is set then it will also delete the keys from the secondary store.
648
+ * @param {string[]} keys The keys to delete
649
+ * @returns {Promise<boolean>} Whether the keys were deleted
650
+ */
651
+ deleteMany(keys: string[]): Promise<boolean>;
652
+ /**
653
+ * Clears the primary store. If the secondary store is set then it will also clear the secondary store.
654
+ * @returns {Promise<void>}
655
+ */
656
+ clear(): Promise<void>;
657
+ /**
658
+ * Disconnects the primary store. If the secondary store is set then it will also disconnect the secondary store.
659
+ * @returns {Promise<void>}
660
+ */
661
+ disconnect(): Promise<void>;
662
+ /**
663
+ * Wraps a function with caching
664
+ *
665
+ * [Learn more about wrapping functions](https://cacheable.org/docs/cacheable/#wrap--memoization-for-sync-and-async-functions).
666
+ * @param {Function} function_ The function to wrap
667
+ * @param {WrapOptions} [options] The options for the wrap function
668
+ * @returns {Function} The wrapped function
669
+ */
670
+ wrap<T, Arguments extends any[]>(function_: (...arguments_: Arguments) => T, options?: WrapFunctionOptions): (...arguments_: Arguments) => T;
671
+ /**
672
+ * Retrieves the value associated with the given key from the cache. If the key is not found,
673
+ * invokes the provided function to calculate the value, stores it in the cache, and then returns it.
674
+ *
675
+ * @param {GetOrSetKey} key - The key to retrieve or set in the cache. This can also be a function that returns a string key.
676
+ * If a function is provided, it will be called with the cache options to generate the key.
677
+ * @param {() => Promise<T>} function_ - The asynchronous function that computes the value to be cached if the key does not exist.
678
+ * @param {GetOrSetFunctionOptions} [options] - Optional settings for caching, such as the time to live (TTL) or whether to cache errors.
679
+ * @return {Promise<T | undefined>} - A promise that resolves to the cached or newly computed value, or undefined if an error occurs and caching is not configured for errors.
680
+ */
681
+ getOrSet<T>(key: GetOrSetKey$1, function_: () => Promise<T>, options?: GetOrSetFunctionOptions): Promise<T | undefined>;
682
+ /**
683
+ * Will hash an object asynchronously using the specified cryptographic algorithm.
684
+ * Use this for cryptographic algorithms (SHA-256, SHA-384, SHA-512).
685
+ * For non-cryptographic algorithms, use hashSync() for better performance.
686
+ * @param {any} object the object to hash
687
+ * @param {string} algorithm the hash algorithm to use. The default is 'SHA-256'
688
+ * @returns {Promise<string>} the hash of the object
689
+ */
690
+ hash(object: any, algorithm?: HashAlgorithm$1): Promise<string>;
691
+ /**
692
+ * Will hash an object synchronously using the specified non-cryptographic algorithm.
693
+ * Use this for non-cryptographic algorithms (DJB2, FNV1, MURMER, CRC32).
694
+ * For cryptographic algorithms, use hash() instead.
695
+ * @param {any} object the object to hash
696
+ * @param {string} algorithm the hash algorithm to use. The default is 'djb2'
697
+ * @returns {string} the hash of the object
698
+ */
699
+ hashSync(object: any, algorithm?: HashAlgorithm$1): string;
700
+ private setManyKeyv;
701
+ /**
702
+ * Writes tag snapshots for `setMany` items that carry tags and removes any previous snapshots
703
+ * for items that do not.
704
+ */
705
+ private setManyKeyTags;
706
+ /**
707
+ * Processes a single key from secondary store for getRaw operation
708
+ * @param primary - the primary store to use
709
+ * @param secondary - the secondary store to use
710
+ * @param key - The key to retrieve from secondary store
711
+ * @returns Promise containing the result and TTL information
712
+ */
713
+ private processSecondaryForGetRaw;
714
+ /**
715
+ * Processes a single key from secondary store for getRaw operation in non-blocking mode
716
+ * Non-blocking mode means we don't wait for secondary operations that update primary store
717
+ * @param primary - the primary store to use
718
+ * @param secondary - the secondary store to use
719
+ * @param key - The key to retrieve from secondary store
720
+ * @returns Promise containing the result and TTL information
721
+ */
722
+ private processSecondaryForGetRawNonBlocking;
723
+ /**
724
+ * Processes missing keys from secondary store for getManyRaw operation
725
+ * @param primary - the primary store to use
726
+ * @param secondary - the secondary store to use
727
+ * @param keys - The original array of keys requested
728
+ * @param result - The result array from primary store (will be modified)
729
+ * @returns Promise<void>
730
+ */
731
+ private processSecondaryForGetManyRaw;
732
+ /**
733
+ * Processes missing keys from secondary store for getManyRaw operation in non-blocking mode
734
+ * Non-blocking mode means we don't wait for secondary operations that update primary store
735
+ * @param secondary - the secondary store to use
736
+ * @param keys - The original array of keys requested
737
+ * @param result - The result array from primary store (will be modified)
738
+ * @returns Promise<void>
739
+ */
740
+ private processSecondaryForGetManyRawNonBlocking;
741
+ private setTtl;
742
+ private setMaxTtl;
743
+ private capTtl;
744
+ /**
745
+ * Resolves the ttl for a tag snapshot so it outlives the longest-lived copy of the value across
746
+ * the stores. With a secondary store the snapshot uses the larger of the two ttls and never
747
+ * expires if either copy never expires; with only a primary store it tracks the primary ttl.
748
+ * @param primaryTtl - the resolved primary store ttl in milliseconds, or undefined for no expiry
749
+ * @param secondaryTtl - the resolved secondary store ttl in milliseconds, or undefined for no expiry
750
+ * @returns {number | undefined} The tag snapshot ttl in milliseconds, or undefined for no expiry
751
+ */
752
+ private maxStoreTtl;
753
+ /**
754
+ * Resolves the effective ttl actually written to one store for a `setMany` item: the per-store
755
+ * explicit value (a scalar applies to both stores; a `{ primary, secondary }` object is honored
756
+ * per field) cascaded with the store default and instance ttl, then capped by maxTtl.
757
+ * @param itemTtl - the item's ttl (number, shorthand string, or per-store object)
758
+ * @param storeTtl - the target store's default ttl in milliseconds
759
+ * @param store - which store's field to resolve from a per-store object
760
+ * @param maxTtlMs - the resolved maxTtl in milliseconds, or undefined for no cap
761
+ * @returns {number | undefined} The effective ttl in milliseconds, or undefined for no expiry
762
+ */
763
+ private resolveStoreTtl;
492
764
  }
493
-
494
- export { Cacheable, CacheableEvents, CacheableHooks, type CacheableOptions, CacheableSync, CacheableSyncEvents, type CacheableSyncItem, type CacheableSyncOptions };
765
+ //#endregion
766
+ export { CacheTags, type CacheTagsOptions, Cacheable, type CacheableAfterGetItem, type CacheableAfterGetManyItem, CacheableEvents, CacheableHookHandlerMap, type CacheableHookItem, CacheableHooks, type CacheableItem, CacheableMemory, type CacheableMemoryOptions, type CacheableOptions, type CacheableSecondarySetsPrimaryItem, type CacheableSetItem, CacheableStats, CacheableSync, CacheableSyncEvents, type CacheableSyncItem, type CacheableSyncOptions, type GetOptions, type GetOrSetFunctionOptions, type GetOrSetKey, type GetOrSetOptions, HashAlgorithm, type KeyTagEntry, Keyv, KeyvCacheableMemory, type KeyvCacheableMemoryOptions, KeyvHooks, type KeyvOptions, type KeyvStoreAdapter, type PerStoreTtl, type SetKeyTagsOptions, type SetOptions, type WrapFunctionOptions, type WrapOptions, type WrapSyncOptions, calculateTtlFromExpiration, createKeyv, getCascadingTtl, getOrSet, hash, shorthandToMilliseconds, shorthandToTime, wrap, wrapSync };