@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
@@ -29,9 +29,13 @@
29
29
  * [v1 to v2 Changes](#v1-to-v2-changes)
30
30
  * [Basic Usage](#basic-usage)
31
31
  * [Hooks and Events](#hooks-and-events)
32
+ * [Overriding the TTL in a BEFORE_SET Hook](#overriding-the-ttl-in-a-before_set-hook)
32
33
  * [Storage Tiering and Caching](#storage-tiering-and-caching)
33
34
  * [TTL Propagation and Storage Tiering](#ttl-propagation-and-storage-tiering)
35
+ * [Per-Store TTL per Operation](#per-store-ttl-per-operation)
34
36
  * [Shorthand for Time to Live (ttl)](#shorthand-for-time-to-live-ttl)
37
+ * [Maximum Time to Live (maxTtl)](#maximum-time-to-live-maxttl)
38
+ * [Tag Based Invalidation](#tag-based-invalidation)
35
39
  * [Iteration on Primary and Secondary Stores](#iteration-on-primary-and-secondary-stores)
36
40
  * [Non-Blocking Operations](#non-blocking-operations)
37
41
  * [Non-Blocking with @keyv/redis](#non-blocking-with-keyvredis)
@@ -39,6 +43,7 @@
39
43
  * [Cacheable Options](#cacheable-options)
40
44
  * [Cacheable Statistics (Instance Only)](#cacheable-statistics-instance-only)
41
45
  * [Cacheable - API](#cacheable---api)
46
+ * [Static Instance (Singleton)](#static-instance-singleton)
42
47
  * [CacheableMemory - In-Memory Cache](#cacheablememory---in-memory-cache)
43
48
  * [Keyv Storage Adapter - KeyvCacheableMemory](#keyv-storage-adapter---keyvcacheablememory)
44
49
  * [Wrap / Memoization for Sync and Async Functions](#wrap--memoization-for-sync-and-async-functions)
@@ -114,6 +119,61 @@ cacheable.onHook(CacheableHooks.BEFORE_SET, (data) => {
114
119
  });
115
120
  ```
116
121
 
122
+ ## Overriding the TTL in a BEFORE_SET Hook
123
+
124
+ A `BEFORE_SET` hook can change an entry's time-to-live by reassigning `data.ttl`. This works for `set()`, `getOrSet()`, and `wrap()` because they all run through `BEFORE_SET`. You can assign a single value (applied to every store) or a per-store object so the primary and secondary stores expire at different rates:
125
+
126
+ ```javascript
127
+ import { Cacheable, CacheableHooks } from 'cacheable';
128
+ import KeyvRedis from '@keyv/redis';
129
+ const secondary = new KeyvRedis('redis://user:pass@localhost:6379');
130
+ const cache = new Cacheable({ secondary });
131
+
132
+ cache.onHook(CacheableHooks.BEFORE_SET, (data) => {
133
+ // Keep this entry short-lived in memory (primary) but longer in Redis (secondary)
134
+ data.ttl = { primary: '10s', secondary: '5m' };
135
+ });
136
+ ```
137
+
138
+ Each store resolves its TTL independently, taking the first defined value down this list and then capping it with [`maxTtl`](#maximum-time-to-live-maxttl). This is the single source of truth for how *every* TTL (operation, hook, or default) is resolved:
139
+
140
+ | Precedence (highest first) | Primary store | Secondary store |
141
+ | --- | --- | --- |
142
+ | 1. `BEFORE_SET` hook | `data.ttl` (scalar, or `.primary`) | `data.ttl` (scalar, or `.secondary`) |
143
+ | 2. Operation `ttl` | `ttl` (scalar, or `.primary`) | `ttl` (scalar, or `.secondary`) |
144
+ | 3. Store default | `new Keyv({ ttl })` on the primary | `new Keyv({ ttl })` on the secondary |
145
+ | 4. Instance `ttl` | `new Cacheable({ ttl })` | `new Cacheable({ ttl })` |
146
+ | Cap (applied last) | `maxTtl` | `maxTtl` |
147
+
148
+ What happens when you override:
149
+
150
+ * **Per-store object** (`{ primary, secondary }`): each field applies to that store independently. A field you leave out falls back to that store's normal resolution — including any per-store `ttl` you passed to the operation.
151
+ * **Scalar** (a number or [shorthand string](#shorthand-for-time-to-live-ttl)): applied to **every** store, discarding any per-store `secondary` you passed to the operation. Use the object form if you want the stores to differ.
152
+ * **Any assignment counts as an override**, even assigning the value `data.ttl` already holds. Leaving `data.ttl` untouched keeps each store on its normal resolution (the default behavior).
153
+ * **`0`, `null`, or `undefined` clears the TTL** → the entry never expires, *ignoring* the cascade (store default and instance `ttl`). This matches the "disable the ttl" behavior in [Shorthand for Time to Live](#shorthand-for-time-to-live-ttl); take care when assigning a possibly-nullable value to `data.ttl`.
154
+ * **An invalid shorthand string aborts the whole write.** Assigning an unparseable string (e.g. `'10 seconds'`) throws; `set` catches it, emits the [`error` event](#hooks-and-events), and returns `false` **without caching** — so a hook typo silently disables caching for that write. Listen on `error` to catch it.
155
+ * **`maxTtl` is re-applied to each store after the hook**, so a hook can never push an entry past the cap.
156
+ * **Tag snapshots** use the longer of the two store TTLs (and never expire while either copy is immortal, including `ttl: 0`) so [tag invalidation](#tag-based-invalidation) can always reach the longest-lived copy.
157
+ * By the time **`AFTER_SET`** runs (and for [sync replication](#cacheablesync---distributed-updates)), `data.ttl` has been normalized to the effective **primary** TTL as a number; the secondary store's effective TTL is not exposed on the item. **`AFTER_SET_MANY` differs:** `setMany` does not mutate the items you passed, so a handler there still sees each `item.ttl` exactly as set (a per-store object stays an object).
158
+
159
+ > **TypeScript:** `onHook(CacheableHooks.BEFORE_SET, (data) => …)` types `data` automatically — no annotation needed, and an invalid `data.ttl` shape is a compile error. Payload types are exported too (`CacheableHookItem`, `CacheableSetItem`).
160
+
161
+ > **Note on backfills:** like a per-store `ttl` passed to an operation, a primary TTL set by a hook governs only that write — it is not persisted per key. Once the primary copy expires, the next read repopulates the primary from the secondary using the usual [TTL propagation](#ttl-propagation-and-storage-tiering) rules. Set a primary store default TTL (`new Keyv({ ttl })`) or an instance `maxTtl` if you need the primary to stay short across backfills.
162
+
163
+ > **Note on sync:** a per-store TTL writes the secondary's TTL to the (typically shared) secondary store directly; [CacheableSync](#cacheablesync---distributed-updates) replicates only the **primary** TTL to other instances' in-memory primaries. For the usual shared-secondary topology this is correct — the secondary is written once and read by every instance.
164
+
165
+ The same per-store object is accepted by `setMany` items and the `BEFORE_SET_MANY` hook:
166
+
167
+ ```javascript
168
+ cache.onHook(CacheableHooks.BEFORE_SET_MANY, (items) => {
169
+ for (const item of items) {
170
+ item.ttl = { primary: '10s', secondary: '5m' };
171
+ }
172
+ });
173
+
174
+ await cache.setMany([{ key: 'a', value: 1, ttl: { primary: '10s', secondary: '5m' } }]);
175
+ ```
176
+
117
177
  Here is an example of how to use `BEFORE_SECONDARY_SETS_PRIMARY` hook:
118
178
 
119
179
  ```javascript
@@ -125,7 +185,7 @@ cache.onHook(CacheableHooks.BEFORE_SECONDARY_SETS_PRIMARY, (data) => {
125
185
  console.log(`before secondary sets primary: ${data.key} ${data.value} ${data.ttl}`);
126
186
  });
127
187
  ```
128
- This is called when the secondary store sets the value in the primary store. This is useful if you want to do something before the value is set in the primary store such as manipulating the ttl or the value.
188
+ This is called when the secondary store sets the value in the primary store. This is useful if you want to do something before the value is set in the primary store such as manipulating the ttl or the value. Because this hook only writes the primary store, its `ttl` is a single value (a number or shorthand string), not a per-store object.
129
189
 
130
190
  The following events are provided:
131
191
 
@@ -210,6 +270,43 @@ ttl = set at the function ?? storage adapter ttl ?? cacheable ttl
210
270
 
211
271
  This means that if you set a TTL at the function level it will override the storage adapter TTL and the cacheable TTL. If you do not set a TTL at the function level it will use the storage adapter TTL and then the cacheable TTL. If you do not set a TTL at all it will use the default TTL of `undefined` which is disabled.
212
272
 
273
+ # Per-Store TTL per Operation
274
+
275
+ When you override the `ttl` on an operation it normally applies to both the primary and secondary stores. If you want each store to expire at a different rate for that specific key, pass a per-store object as the `ttl` with `primary` and/or `secondary` fields. Each field accepts a number in milliseconds or a [shorthand string](#shorthand-for-time-to-live-ttl).
276
+
277
+ ```javascript
278
+ import { Cacheable } from 'cacheable';
279
+ import { Keyv } from 'keyv';
280
+ import KeyvRedis from '@keyv/redis';
281
+ const secondary = new KeyvRedis('redis://user:pass@localhost:6379');
282
+ const cache = new Cacheable({ secondary });
283
+
284
+ // Keep this key 10 seconds in memory (primary) but 5 minutes in Redis (secondary)
285
+ await cache.set('key', 'value', { ttl: { primary: '10s', secondary: '5m' } });
286
+ ```
287
+
288
+ Any field you leave out falls back to that store's own default TTL resolution (storage adapter TTL, then the cacheable instance TTL). For example, only overriding the primary store leaves the secondary on its default:
289
+
290
+ ```javascript
291
+ const secondary = new Keyv({ store: new KeyvRedis('redis://user:pass@localhost:6379'), ttl: '1h' });
292
+ const cache = new Cacheable({ secondary });
293
+
294
+ // Primary expires in 10s; secondary keeps its own 1 hour default
295
+ await cache.set('key', 'value', { ttl: { primary: '10s' } });
296
+ ```
297
+
298
+ The per-store object works anywhere a `ttl` is accepted, including [`getOrSet`](#get-or-set-memoization-function) and [`wrap`](#wrap--memoization-for-sync-and-async-functions):
299
+
300
+ ```javascript
301
+ await cache.getOrSet('key', async () => 'value', { ttl: { primary: '10s', secondary: '5m' } });
302
+
303
+ const getUser = cache.wrap(fetchUser, { ttl: { primary: '1m', secondary: '1d' } });
304
+ ```
305
+
306
+ Passing a plain number or shorthand string (such as `'1h'`) still applies the same TTL to every store, and the [`maxTtl`](#maximum-time-to-live-maxttl) cap is applied to each store independently. The same per-store object is accepted by `setMany` items, and a [`BEFORE_SET` hook](#overriding-the-ttl-in-a-before_set-hook) can override these per-store TTLs and takes precedence over the value passed to the operation.
307
+
308
+ > **Note on backfills:** A per-store TTL (whether passed to the operation or set by a `BEFORE_SET` hook) governs the *write* of that operation. The primary TTL is not persisted per key, so once a primary (layer 1) entry expires, the next read is served from the secondary and repopulates the primary using the secondary's remaining lifetime — following the usual [TTL propagation](#ttl-propagation-and-storage-tiering) rules — rather than re-applying the original primary TTL. If you need the primary to keep a consistently shorter lifetime across backfills, set a primary store default TTL (`new Keyv({ ttl })`) or an instance `maxTtl`, which both bound the repopulated TTL.
309
+
213
310
  # Shorthand for Time to Live (ttl)
214
311
 
215
312
  By default `Cacheable` and `CacheableMemory` the `ttl` is in milliseconds but you can use shorthand for the time to live. Here are the following shorthand values:
@@ -303,42 +400,88 @@ The `hasMany` method returns an array of booleans in the same order as the input
303
400
 
304
401
  # Iteration on Primary and Secondary Stores
305
402
 
306
- The `Cacheable` class exposes both `primary` and `secondary` Keyv instances, which support iteration over their stored entries using the `iterator()` method. This allows you to access and process all keys and values in either storage layer.
403
+ The `Cacheable` class exposes both `primary` and `secondary` as [Keyv](https://keyv.org) instances. Keyv provides an `iterator()` async generator for walking every entry in a store, but **it is only available on stores that support iteration**. When a store does not support it, `keyv.iterator` is `undefined`, so you must feature-check it before calling.
404
+
405
+ Keyv enables `iterator()` for:
406
+
407
+ - A plain `new Keyv()` whose store is a `Map` (the Keyv default), and
408
+ - The server-backed adapters Keyv recognizes as iterable: `@keyv/redis`, `@keyv/valkey`, `@keyv/mongo`, `@keyv/sqlite`, `@keyv/postgres`, `@keyv/mysql`, and `@keyv/etcd`.
409
+
410
+ > **Heads up:** Cacheable's *default* primary store is the high-performance in-memory store from [`@cacheable/memory`](https://cacheable.org/docs/memory/) (created with `createKeyv()`). It is neither a raw `Map` nor one of the recognized adapters, so `cache.primary.iterator` is `undefined`. See [Iterating the default in-memory primary](#iterating-the-default-in-memory-primary) for how to walk it.
307
411
 
308
412
  **Important Notes:**
309
- - Not all storage adapters support iteration. Always check if `iterator` exists before using it.
310
- - The iterator automatically filters by namespace, skips expired entries (and deletes them), and deserializes values.
311
- - **Performance Warning:** Be careful when using `iterator()` as it can cause performance issues with large datasets.
312
413
 
313
- ## Basic Iteration Example
414
+ - Always check that `iterator` exists before using it — it is `undefined` on stores that don't support iteration.
415
+ - The iterator filters by namespace, skips expired entries (deleting them), and deserializes values for you.
416
+ - **Performance Warning:** Iterating can be expensive on large datasets (for example, `@keyv/redis` uses `SCAN` under the hood). Avoid it on hot paths.
417
+
418
+ ## Iterating a Secondary Store
419
+
420
+ A secondary store backed by a recognized adapter (Redis, Valkey, Mongo, SQLite, Postgres, MySQL, etcd) supports `iterator()` directly. Each iteration yields a `[key, value]` tuple:
314
421
 
315
422
  ```typescript
316
423
  import { Cacheable } from 'cacheable';
317
424
  import KeyvRedis from '@keyv/redis';
318
425
 
319
- // Create cache with primary (in-memory) and secondary (Redis) stores
320
426
  const secondary = new KeyvRedis('redis://user:pass@localhost:6379');
321
427
  const cache = new Cacheable({ secondary });
322
428
 
323
- // Add some data
324
429
  await cache.set('user:1', { name: 'Alice', role: 'admin' });
325
430
  await cache.set('user:2', { name: 'Bob', role: 'user' });
326
- await cache.set('session:abc', { userId: '1', active: true });
327
431
 
328
- // Iterate over primary store (in-memory)
329
- console.log('Primary store contents:');
432
+ if (cache.secondary?.iterator) {
433
+ for await (const [key, value] of cache.secondary.iterator()) {
434
+ console.log(`${key}:`, value);
435
+ }
436
+ }
437
+ ```
438
+
439
+ ## Iterating the Primary Store
440
+
441
+ If you need a primary store you can walk with `iterator()`, use a `Map`-backed `new Keyv()` (or any recognized adapter) as the primary. A plain `Keyv` is iterable because its default store is a `Map`:
442
+
443
+ ```typescript
444
+ import { Cacheable } from 'cacheable';
445
+ import { Keyv } from 'keyv';
446
+
447
+ const cache = new Cacheable({ primary: new Keyv() });
448
+
449
+ await cache.set('user:1', { name: 'Alice' });
450
+ await cache.set('user:2', { name: 'Bob' });
451
+
330
452
  if (cache.primary.iterator) {
331
453
  for await (const [key, value] of cache.primary.iterator()) {
332
- console.log(` ${key}:`, JSON.stringify(value));
454
+ console.log(`${key}:`, value);
333
455
  }
334
456
  }
457
+ ```
335
458
 
336
- // Iterate over secondary store (Redis)
337
- console.log('\nSecondary store contents:');
338
- if (cache.secondary?.iterator) {
339
- for await (const [key, value] of cache.secondary.iterator()) {
340
- console.log(` ${key}:`, JSON.stringify(value));
341
- }
459
+ ### Iterating the default in-memory primary
460
+
461
+ The default primary from `@cacheable/memory` does not provide a Keyv `iterator()`. To walk it, reach the underlying `CacheableMemory` store through `cache.primary.store` and use its `items` iterator. Each item is a `{ key, value, expires }` record (expired entries are skipped automatically), where `value` holds Keyv's stored envelope — the decoded value is at `item.value.value`:
462
+
463
+ ```typescript
464
+ import { Cacheable, KeyvCacheableMemory } from 'cacheable';
465
+
466
+ const cache = new Cacheable();
467
+ await cache.set('user:1', { name: 'Alice' });
468
+ await cache.set('user:2', { name: 'Bob' });
469
+
470
+ // cache.primary.store is the KeyvCacheableMemory adapter; its .store is the CacheableMemory
471
+ const memory = (cache.primary.store as KeyvCacheableMemory).store;
472
+
473
+ for (const item of memory.items) {
474
+ // item.value is Keyv's { value, expires } envelope
475
+ console.log(`${item.key}:`, item.value.value);
476
+ }
477
+ ```
478
+
479
+ If you'd rather not depend on the envelope shape, iterate the keys and read each entry back through the cache:
480
+
481
+ ```typescript
482
+ const memory = (cache.primary.store as KeyvCacheableMemory).store;
483
+ for (const { key } of memory.items) {
484
+ console.log(`${key}:`, await cache.get(key));
342
485
  }
343
486
  ```
344
487
 
@@ -373,18 +516,22 @@ await iterateStore(cache.primary, 'Primary');
373
516
  await iterateStore(cache.secondary, 'Secondary');
374
517
  ```
375
518
 
519
+ Note that with the default configuration the `Primary` branch above will report that it "does not support iteration" — that is expected, because the default `@cacheable/memory` primary has no `iterator()`. Use the [`CacheableMemory.items`](#iterating-the-default-in-memory-primary) approach for it.
520
+
376
521
  ## Storage Adapter Support
377
522
 
378
- The `iterator()` method is available when:
379
- - The store is a Map instance (has Symbol.iterator)
380
- - The store implements an `iterator()` method (e.g., Redis, Valkey, etc.)
381
- - The store is a supported iterable adapter
523
+ Keyv assigns an `iterator()` method only when the store is a raw `Map` or one of the adapters it recognizes as iterable. For every other store, `keyv.iterator` is `undefined`.
524
+
525
+ Stores that support `iterator()`:
526
+
527
+ - A plain `new Keyv()` (its store is a `Map`)
528
+ - `@keyv/redis` and `@keyv/valkey`
529
+ - `@keyv/mongo`, `@keyv/sqlite`, `@keyv/postgres`, `@keyv/mysql`, and `@keyv/etcd`
382
530
 
383
- Common stores that support iteration:
384
- - In-memory (Map-based stores)
385
- - @keyv/redis
386
- - @keyv/valkey
387
- - Other Keyv adapters that implement the iterator interface
531
+ Stores that do **not** support `iterator()`:
532
+
533
+ - The default `@cacheable/memory` primary (`createKeyv()`) — walk it through its [`CacheableMemory.items`](#iterating-the-default-in-memory-primary) accessor instead
534
+ - Any adapter that doesn't implement Keyv's iterable interface
388
535
 
389
536
  # Non-Blocking Operations
390
537
 
@@ -607,6 +754,94 @@ const value = await serviceB.get('config'); // undefined
607
754
  * The sync feature requires a message provider to be running and accessible by all cache instances.
608
755
  * Each cache instance has a unique `cacheId`. Events are only applied if they come from a different instance, preventing infinite loops.
609
756
 
757
+ # Maximum Time to Live (maxTtl)
758
+
759
+ You can set a `maxTtl` option to enforce an upper bound on any TTL in the cache. When `maxTtl` is set:
760
+ - Any per-entry TTL that exceeds `maxTtl` will be capped to `maxTtl`.
761
+ - Entries with no TTL (that would otherwise live indefinitely) will be capped to `maxTtl`.
762
+ - The default TTL is still respected if it is within the `maxTtl` limit.
763
+ - The `maxTtl` is enforced on both primary and secondary stores.
764
+ - A TTL set by a [`BEFORE_SET` hook](#overriding-the-ttl-in-a-before_set-hook) is also capped, per store.
765
+
766
+ This is useful when you want to guarantee that no cache entry lives longer than a certain duration, regardless of what TTL is passed to individual `set()` calls or set by a hook.
767
+
768
+ ```javascript
769
+ import { Cacheable } from 'cacheable';
770
+
771
+ // No entry can live longer than 1 hour
772
+ const cache = new Cacheable({ maxTtl: '1h' });
773
+
774
+ await cache.set('key1', 'value1', '2h'); // capped to 1 hour
775
+ await cache.set('key2', 'value2'); // also capped to 1 hour (would otherwise be indefinite)
776
+ await cache.set('key3', 'value3', '30m'); // 30 minutes is within maxTtl, so it stays as-is
777
+ ```
778
+
779
+ You can also set `maxTtl` after construction:
780
+
781
+ ```javascript
782
+ const cache = new Cacheable();
783
+ cache.maxTtl = 5000; // 5 seconds max
784
+ cache.maxTtl = '10m'; // 10 minutes max
785
+ cache.maxTtl = undefined; // disable maxTtl (no upper bound)
786
+ ```
787
+
788
+ # Tag Based Invalidation
789
+
790
+ You can associate cache entries with tags and later invalidate every entry that shares a tag in a single call. This is useful for content caching where one upstream entity (a product, a user, a CMS document) is referenced by many cache entries:
791
+
792
+ ```javascript
793
+ import { Cacheable } from 'cacheable';
794
+
795
+ const cache = new Cacheable({ tags: true });
796
+
797
+ await cache.set('page:/products', html, { ttl: '10m', tags: ['entity:42', 'collection:products'] });
798
+ await cache.set('page:/products/42', detailHtml, { ttl: '10m', tags: ['entity:42'] });
799
+
800
+ // entity 42 changed - purge everything that referenced it
801
+ await cache.tags.invalidateTag('entity:42');
802
+
803
+ await cache.get('page:/products'); // undefined
804
+ await cache.get('page:/products/42'); // undefined
805
+ ```
806
+
807
+ You can also pass tags per item with `setMany`, and invalidate several tags at once:
808
+
809
+ ```javascript
810
+ await cache.setMany([
811
+ { key: 'user:1', value: userOne, tags: ['users'] },
812
+ { key: 'user:2', value: userTwo, tags: ['users', 'org:7'] },
813
+ ]);
814
+
815
+ await cache.tags.invalidateTags(['users', 'org:7']);
816
+ ```
817
+
818
+ Tag functionality lives on the `tags` service — an instance of the `CacheTags` class from [`@cacheable/utils`](https://npmjs.com/package/@cacheable/utils) that is created by default in the constructor. Invalidation uses a lazy, constant-time model: `invalidateTag` simply bumps a version counter for the tag, no matter how many entries reference it. Each tagged entry stores a snapshot of its tags' versions, and on the next `get` / `getMany` the snapshot is compared to the live versions. If any tag has been bumped since, the entry is treated as a miss and removed from both the primary and secondary stores (and a `delete` is published via [sync](#cacheablesync---distributed-updates) when enabled). The trade-off is one additional tag-store read per cache lookup while the tag service is enabled.
819
+
820
+ Tag metadata is stored in the secondary store when one is configured, otherwise in the primary store. With a shared secondary store (such as Redis), an invalidation performed by one instance is seen by every instance:
821
+
822
+ ```javascript
823
+ import { Cacheable } from 'cacheable';
824
+ import KeyvRedis from '@keyv/redis';
825
+
826
+ // enable tags on every instance that shares the store - writers and readers
827
+ const writer = new Cacheable({ secondary: new KeyvRedis('redis://localhost:6379'), tags: true });
828
+ const reader = new Cacheable({ secondary: new KeyvRedis('redis://localhost:6379'), tags: true });
829
+
830
+ await writer.set('page:/products', html, { tags: ['entity:42'] });
831
+ await writer.tags.invalidateTag('entity:42');
832
+ await reader.get('page:/products'); // undefined - stale copy is also purged from reader's primary
833
+ ```
834
+
835
+ The tag service is disabled by default so untagged workloads pay no extra cost, and you have to turn it on to use it — either with the `tags: true` option or by setting `cache.tags.enabled = true`. While disabled, all tag operations are no-ops: values set with `tags` are stored without tag tracking and invalidations have no effect. The service never enables itself, which keeps behavior predictable across distributed instances — enable it on every instance that shares the store (writers and readers) so invalidations are honored and tag snapshots are cleaned up consistently.
836
+
837
+ The full `CacheTags` API is available on the service:
838
+
839
+ ```javascript
840
+ await cache.tags.getTags('page:/products'); // ['entity:42', 'collection:products']
841
+ await cache.tags.getKeysByTag('entity:42'); // keys referencing a tag (debugging / tests)
842
+ cache.tags.enabled; // whether freshness checks run on get / getMany
843
+ ```
844
+
610
845
  # Cacheable Options
611
846
 
612
847
  The following options are available for you to configure `cacheable`:
@@ -616,8 +851,10 @@ The following options are available for you to configure `cacheable`:
616
851
  * `nonBlocking`: If the secondary store is non-blocking. Default is `false`.
617
852
  * `stats`: To enable statistics for this instance. Default is `false`.
618
853
  * `ttl`: The default time to live for the cache in milliseconds. Default is `undefined` which is disabled.
854
+ * `maxTtl`: The maximum time to live for any cache entry. When set, TTLs exceeding this value are capped. Enforced on both primary and secondary stores. Default is `undefined` (no maximum).
619
855
  * `namespace`: The namespace for the cache. Default is `undefined`.
620
856
  * `cacheId`: A unique identifier for this cache instance. Used for sync filtering. Default is a random string.
857
+ * `tags`: Enables the tag service so tag-based invalidation can be used and freshness checks run on `get` / `getMany`. Tags must be explicitly enabled — while disabled, all tag operations are no-ops. Default is `false`.
621
858
  * `sync`: Enable distributed cache synchronization. Can be:
622
859
  - `CacheableSync` instance
623
860
  - `CacheableSyncOptions` object with `{ qified: MessageProvider | MessageProvider[] | Qified }`
@@ -642,8 +879,8 @@ _This does not enable statistics for your layer 2 cache as that is a distributed
642
879
 
643
880
  # Cacheable - API
644
881
 
645
- * `set(key, value, ttl?)`: Sets a value in the cache.
646
- * `setMany([{key, value, ttl?}])`: Sets multiple values in the cache.
882
+ * `set(key, value, ttlOrOptions?)`: Sets a value in the cache. The third argument can be a `ttl` or an options object such as `{ ttl: '1h', tags: ['entity:42'] }`.
883
+ * `setMany([{key, value, ttl?, tags?}])`: Sets multiple values in the cache.
647
884
  * `get(key)`: Gets a value from the cache.
648
885
  * `get(key, { raw: true })`: Gets a raw value from the cache.
649
886
  * `getMany([keys])`: Gets multiple values from the cache.
@@ -655,6 +892,7 @@ _This does not enable statistics for your layer 2 cache as that is a distributed
655
892
  * `delete(key)`: Deletes a value from the cache.
656
893
  * `deleteMany([keys])`: Deletes multiple values from the cache.
657
894
  * `clear()`: Clears the cache stores. Be careful with this as it will clear both layer 1 and layer 2.
895
+ * `tags`: The `CacheTags` service from `@cacheable/utils` used for tag-based invalidation, such as `tags.invalidateTag(tag)`, `tags.invalidateTags([tags])`, `tags.getTags(key)`, `tags.getKeysByTag(tag)`, and `tags.enabled`.
658
896
  * `wrap(function, WrapOptions)`: Wraps an `async` function in a cache.
659
897
  * `getOrSet(GetOrSetKey, valueFunction, GetOrSetFunctionOptions)`: Gets a value from cache or sets it if not found using the provided function.
660
898
  * `disconnect()`: Disconnects from the cache stores.
@@ -664,12 +902,51 @@ _This does not enable statistics for your layer 2 cache as that is a distributed
664
902
  * `removeListener(event, callback)`: Removes a listener.
665
903
  * `hash(object: any, algorithm = 'SHA-256'): Promise<string>`: Asynchronously hashes an object with a cryptographic algorithm (SHA-256, SHA-384, SHA-512). Default is `SHA-256`.
666
904
  * `hashSync(object: any, algorithm = 'djb2'): string`: Synchronously hashes an object with a non-cryptographic algorithm (djb2, fnv1, murmer, crc32). Default is `djb2`.
905
+ * `getStaticInstance(options?)`: Static. Gets a shared singleton instance, creating it on the first call. Options apply only on first creation; passing options after init emits an `error` event and is otherwise ignored.
906
+ * `setStaticInstance(instance?)`: Static. Sets or clears the shared singleton instance. Pass `undefined` to reset it.
667
907
  * `primary`: The primary store for the cache (layer 1) defaults to in-memory by Keyv.
668
908
  * `secondary`: The secondary store for the cache (layer 2) usually a persistent cache by Keyv.
669
909
  * `namespace`: The namespace for the cache. Default is `undefined`. This will set the namespace for the primary and secondary stores.
910
+ * `maxTtl`: The maximum time to live for any cache entry. When set, TTLs exceeding this value are capped. Default is `undefined` (no maximum).
670
911
  * `nonBlocking`: If the secondary store is non-blocking. Default is `false`.
671
912
  * `stats`: The statistics for this instance which includes `hits`, `misses`, `sets`, `deletes`, `clears`, `errors`, `count`, `vsize`, `ksize`.
672
913
 
914
+ # Static Instance (Singleton)
915
+
916
+ If you want a single cache shared across your application without constructing a `Cacheable` instance and passing it around, use the static `getStaticInstance()` accessor. The first call creates the shared instance; every later call returns that same instance:
917
+
918
+ ```javascript
919
+ import { Cacheable } from 'cacheable';
920
+
921
+ const cache = Cacheable.getStaticInstance({ ttl: '1h' });
922
+ await cache.set('key', 'value');
923
+
924
+ // Anywhere else in your app, the same instance is returned:
925
+ const same = Cacheable.getStaticInstance();
926
+ ```
927
+
928
+ Options are only applied when the instance is first created. If you pass options again after the instance already exists, they are ignored and an `error` event is emitted on the instance to surface the conflict — listen with `cache.on('error', ...)`. To reconfigure, replace the instance with `setStaticInstance()` (shown below).
929
+
930
+ You can replace or reset the shared instance with `setStaticInstance()`. Pass a `Cacheable` instance to swap it, or `undefined` to clear it so the next `getStaticInstance()` call creates a fresh one:
931
+
932
+ ```javascript
933
+ import { Cacheable } from 'cacheable';
934
+ import KeyvRedis from '@keyv/redis';
935
+
936
+ // Provide a fully configured instance as the shared one
937
+ Cacheable.setStaticInstance(new Cacheable({ secondary: new KeyvRedis('redis://localhost:6379') }));
938
+
939
+ // Reset back to no shared instance
940
+ Cacheable.setStaticInstance(undefined);
941
+ ```
942
+
943
+ Things to know:
944
+
945
+ * The shared instance is process-global and long-lived. Calling `clear()` or `disconnect()` on it affects every part of your app that uses it.
946
+ * After `disconnect()`, `getStaticInstance()` keeps returning the same (now disconnected) instance — it is not recreated automatically. Call `setStaticInstance(undefined)` first, then `getStaticInstance()` to get a fresh one.
947
+ * `setStaticInstance(undefined)` only drops the reference; it does not `disconnect()` or `clear()` the previous instance, so disconnect it first if it holds open connections.
948
+ * This package ships separate CommonJS and ESM builds. An app (or dependency graph) that loads both formats gets one shared instance *per build*, not one process-wide. For a single shared cache, use one module format, or create the instance once and share it via `setStaticInstance()`.
949
+
673
950
  # CacheableMemory - In-Memory Cache
674
951
 
675
952
  `cacheable` comes with a built-in in-memory cache called `CacheableMemory` from `@cacheable/memory`. This is a simple in-memory cache that is used as the primary store for `cacheable`. You can use this as a standalone cache or as a primary store for `cacheable`. Here is an example of how to use `CacheableMemory`:
@@ -791,13 +1068,15 @@ The `getOrSet` method that comes from [@cacheable/utils](https://cacheable.org/
791
1068
 
792
1069
  ```typescript
793
1070
  export type GetOrSetFunctionOptions = {
794
- ttl?: number | string;
1071
+ ttl?: number | string | { primary?: number | string; secondary?: number | string };
795
1072
  cacheErrors?: boolean;
796
1073
  throwErrors?: boolean;
797
1074
  nonBlocking?: boolean;
798
1075
  };
799
1076
  ```
800
1077
 
1078
+ The `ttl` also accepts a [per-store object](#per-store-ttl-per-operation) such as `{ primary: '10s', secondary: '5m' }` to give the primary and secondary stores different expirations for this operation.
1079
+
801
1080
  The `nonBlocking` option allows you to override the instance-level `nonBlocking` setting for the `get` call within `getOrSet`. When set to `false`, the `get` will block and wait for a response from the secondary store before deciding whether to call the provided function. When set to `true`, the primary store returns immediately and syncs from secondary in the background.
802
1081
 
803
1082
  Here is an example of how to use the `getOrSet` method: