@tonysamperi/ts-mapi-core 1.8.0-next.0 → 1.8.0

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 (255) hide show
  1. package/changelog.md +0 -1
  2. package/dist/cjs/index.cjs +1 -1
  3. package/dist/cjs/index.cjs.map +1 -1
  4. package/dist/cjs/index.d.cts +1273 -66
  5. package/dist/esm/{chunk-JE3FPJGV.js → chunk-D2XOH6K4.js} +1 -1
  6. package/dist/esm/chunk-LD5COSFG.js +1 -0
  7. package/dist/esm/{chunk-QTWLHW3D.js → chunk-STU5GUNH.js} +1 -1
  8. package/dist/esm/chunk-V6NBH54E.js +1 -0
  9. package/dist/esm/chunk-WTLVPDI2.js +1 -0
  10. package/dist/esm/chunk-XF457SYA.js +1 -0
  11. package/dist/esm/index.d.ts +2 -3
  12. package/dist/esm/index.js +1 -1
  13. package/dist/esm/services/firebase/index.d.ts +1 -1
  14. package/dist/esm/services/firebase/index.js +1 -1
  15. package/dist/esm/services/firebase/smp-firebase-service-config.interface.d.ts +1 -1
  16. package/dist/esm/services/firebase/smp-firebase.service.d.ts +1 -1
  17. package/dist/esm/services/firebase/smp-firebase.service.js +1 -1
  18. package/dist/esm/services/http/index.js +1 -1
  19. package/dist/esm/services/http/smp-http.service.js +1 -1
  20. package/dist/esm/services/index.d.ts +1 -1
  21. package/dist/esm/services/index.js +1 -1
  22. package/dist/esm/services/smp-dynamo.service.d.ts +1 -1
  23. package/dist/esm/services/smp-dynamo.service.js +1 -1
  24. package/dist/esm/shared/api/index.d.ts +1 -1
  25. package/dist/esm/shared/api/index.js +1 -1
  26. package/dist/esm/shared/api/smp-api-common-utils.class.d.ts +1 -1
  27. package/dist/esm/shared/api/smp-api-common-utils.class.js +1 -1
  28. package/dist/esm/shared/crypto/index.js +1 -1
  29. package/dist/esm/shared/crypto/smp-secure-code.class.js +1 -1
  30. package/dist/esm/shared/giftcard/index.d.ts +1 -1
  31. package/dist/esm/shared/giftcard/smp-giftcard-transaction.class.d.ts +1 -1
  32. package/dist/esm/shared/utils/index.d.ts +1 -1
  33. package/dist/esm/shared/utils/index.js +1 -1
  34. package/dist/esm/shared/utils/smp-noop.function.d.ts +1 -3
  35. package/dist/esm/shared/utils/smp-noop.function.js +1 -1
  36. package/package.json +2 -1
  37. package/dist/cjs/services/firebase/index.cjs +0 -2
  38. package/dist/cjs/services/firebase/index.cjs.map +0 -1
  39. package/dist/cjs/services/firebase/index.d.cts +0 -7
  40. package/dist/cjs/services/firebase/smp-firebase-service-config.interface.cjs +0 -2
  41. package/dist/cjs/services/firebase/smp-firebase-service-config.interface.cjs.map +0 -1
  42. package/dist/cjs/services/firebase/smp-firebase-service-config.interface.d.cts +0 -12
  43. package/dist/cjs/services/firebase/smp-firebase.service.cjs +0 -2
  44. package/dist/cjs/services/firebase/smp-firebase.service.cjs.map +0 -1
  45. package/dist/cjs/services/firebase/smp-firebase.service.d.cts +0 -56
  46. package/dist/cjs/services/http/index.cjs +0 -2
  47. package/dist/cjs/services/http/index.cjs.map +0 -1
  48. package/dist/cjs/services/http/index.d.cts +0 -12
  49. package/dist/cjs/services/http/smp-dynamic-fetch-return.type.cjs +0 -2
  50. package/dist/cjs/services/http/smp-dynamic-fetch-return.type.cjs.map +0 -1
  51. package/dist/cjs/services/http/smp-dynamic-fetch-return.type.d.cts +0 -3
  52. package/dist/cjs/services/http/smp-http-config.interface.cjs +0 -2
  53. package/dist/cjs/services/http/smp-http-config.interface.cjs.map +0 -1
  54. package/dist/cjs/services/http/smp-http-config.interface.d.cts +0 -16
  55. package/dist/cjs/services/http/smp-http-session-storage-cache.class.cjs +0 -2
  56. package/dist/cjs/services/http/smp-http-session-storage-cache.class.cjs.map +0 -1
  57. package/dist/cjs/services/http/smp-http-session-storage-cache.class.d.cts +0 -11
  58. package/dist/cjs/services/http/smp-http-status-code.enum.cjs +0 -2
  59. package/dist/cjs/services/http/smp-http-status-code.enum.cjs.map +0 -1
  60. package/dist/cjs/services/http/smp-http-status-code.enum.d.cts +0 -70
  61. package/dist/cjs/services/http/smp-http.service.cjs +0 -2
  62. package/dist/cjs/services/http/smp-http.service.cjs.map +0 -1
  63. package/dist/cjs/services/http/smp-http.service.d.cts +0 -46
  64. package/dist/cjs/services/index.cjs +0 -2
  65. package/dist/cjs/services/index.cjs.map +0 -1
  66. package/dist/cjs/services/index.d.cts +0 -22
  67. package/dist/cjs/services/smp-dynamo.service.cjs +0 -2
  68. package/dist/cjs/services/smp-dynamo.service.cjs.map +0 -1
  69. package/dist/cjs/services/smp-dynamo.service.d.cts +0 -39
  70. package/dist/cjs/shared/api/index.cjs +0 -2
  71. package/dist/cjs/shared/api/index.cjs.map +0 -1
  72. package/dist/cjs/shared/api/index.d.cts +0 -11
  73. package/dist/cjs/shared/api/smp-api-common-utils.class.cjs +0 -2
  74. package/dist/cjs/shared/api/smp-api-common-utils.class.cjs.map +0 -1
  75. package/dist/cjs/shared/api/smp-api-common-utils.class.d.cts +0 -15
  76. package/dist/cjs/shared/api/smp-error-response-create-opts.interface.cjs +0 -2
  77. package/dist/cjs/shared/api/smp-error-response-create-opts.interface.cjs.map +0 -1
  78. package/dist/cjs/shared/api/smp-error-response-create-opts.interface.d.cts +0 -13
  79. package/dist/cjs/shared/api/smp-error-response.class.cjs +0 -2
  80. package/dist/cjs/shared/api/smp-error-response.class.cjs.map +0 -1
  81. package/dist/cjs/shared/api/smp-error-response.class.d.cts +0 -25
  82. package/dist/cjs/shared/api/smp-generic-response-base.interface.cjs +0 -2
  83. package/dist/cjs/shared/api/smp-generic-response-base.interface.cjs.map +0 -1
  84. package/dist/cjs/shared/api/smp-generic-response-base.interface.d.cts +0 -9
  85. package/dist/cjs/shared/api/smp-generic-response.class.cjs +0 -2
  86. package/dist/cjs/shared/api/smp-generic-response.class.cjs.map +0 -1
  87. package/dist/cjs/shared/api/smp-generic-response.class.d.cts +0 -20
  88. package/dist/cjs/shared/api/smp-healtz.const.cjs +0 -2
  89. package/dist/cjs/shared/api/smp-healtz.const.cjs.map +0 -1
  90. package/dist/cjs/shared/api/smp-healtz.const.d.cts +0 -5
  91. package/dist/cjs/shared/api/smp-response-message-base.interface.cjs +0 -2
  92. package/dist/cjs/shared/api/smp-response-message-base.interface.cjs.map +0 -1
  93. package/dist/cjs/shared/api/smp-response-message-base.interface.d.cts +0 -8
  94. package/dist/cjs/shared/api/smp-response-message-types.enum.cjs +0 -2
  95. package/dist/cjs/shared/api/smp-response-message-types.enum.cjs.map +0 -1
  96. package/dist/cjs/shared/api/smp-response-message-types.enum.d.cts +0 -8
  97. package/dist/cjs/shared/api/smp-response-message.class.cjs +0 -2
  98. package/dist/cjs/shared/api/smp-response-message.class.cjs.map +0 -1
  99. package/dist/cjs/shared/api/smp-response-message.class.d.cts +0 -13
  100. package/dist/cjs/shared/api/smp-rest-verbs.enum.cjs +0 -2
  101. package/dist/cjs/shared/api/smp-rest-verbs.enum.cjs.map +0 -1
  102. package/dist/cjs/shared/api/smp-rest-verbs.enum.d.cts +0 -9
  103. package/dist/cjs/shared/common/index.cjs +0 -2
  104. package/dist/cjs/shared/common/index.cjs.map +0 -1
  105. package/dist/cjs/shared/common/index.d.cts +0 -6
  106. package/dist/cjs/shared/common/smp-base-jwt-token-plain.interface.cjs +0 -2
  107. package/dist/cjs/shared/common/smp-base-jwt-token-plain.interface.cjs.map +0 -1
  108. package/dist/cjs/shared/common/smp-base-jwt-token-plain.interface.d.cts +0 -7
  109. package/dist/cjs/shared/common/smp-base-jwt-token.class.cjs +0 -2
  110. package/dist/cjs/shared/common/smp-base-jwt-token.class.cjs.map +0 -1
  111. package/dist/cjs/shared/common/smp-base-jwt-token.class.d.cts +0 -14
  112. package/dist/cjs/shared/common/smp-generic-constructor.type.cjs +0 -2
  113. package/dist/cjs/shared/common/smp-generic-constructor.type.cjs.map +0 -1
  114. package/dist/cjs/shared/common/smp-generic-constructor.type.d.cts +0 -3
  115. package/dist/cjs/shared/common/smp-primitive.type.cjs +0 -2
  116. package/dist/cjs/shared/common/smp-primitive.type.cjs.map +0 -1
  117. package/dist/cjs/shared/common/smp-primitive.type.d.cts +0 -3
  118. package/dist/cjs/shared/common/smp-social-sign-in-keys.enum.cjs +0 -2
  119. package/dist/cjs/shared/common/smp-social-sign-in-keys.enum.cjs.map +0 -1
  120. package/dist/cjs/shared/common/smp-social-sign-in-keys.enum.d.cts +0 -7
  121. package/dist/cjs/shared/common/smp-social-sign-in-ux-modes.enum.cjs +0 -2
  122. package/dist/cjs/shared/common/smp-social-sign-in-ux-modes.enum.cjs.map +0 -1
  123. package/dist/cjs/shared/common/smp-social-sign-in-ux-modes.enum.d.cts +0 -6
  124. package/dist/cjs/shared/crypto/index.cjs +0 -2
  125. package/dist/cjs/shared/crypto/index.cjs.map +0 -1
  126. package/dist/cjs/shared/crypto/index.d.cts +0 -3
  127. package/dist/cjs/shared/crypto/smp-aes-crypt.class.cjs +0 -2
  128. package/dist/cjs/shared/crypto/smp-aes-crypt.class.cjs.map +0 -1
  129. package/dist/cjs/shared/crypto/smp-aes-crypt.class.d.cts +0 -1
  130. package/dist/cjs/shared/crypto/smp-crypto.class.cjs +0 -2
  131. package/dist/cjs/shared/crypto/smp-crypto.class.cjs.map +0 -1
  132. package/dist/cjs/shared/crypto/smp-crypto.class.d.cts +0 -10
  133. package/dist/cjs/shared/crypto/smp-secure-code.class.cjs +0 -2
  134. package/dist/cjs/shared/crypto/smp-secure-code.class.cjs.map +0 -1
  135. package/dist/cjs/shared/crypto/smp-secure-code.class.d.cts +0 -20
  136. package/dist/cjs/shared/firebase/index.cjs +0 -2
  137. package/dist/cjs/shared/firebase/index.cjs.map +0 -1
  138. package/dist/cjs/shared/firebase/index.d.cts +0 -1
  139. package/dist/cjs/shared/firebase/smp-firebase-errors.enum.cjs +0 -2
  140. package/dist/cjs/shared/firebase/smp-firebase-errors.enum.cjs.map +0 -1
  141. package/dist/cjs/shared/firebase/smp-firebase-errors.enum.d.cts +0 -14
  142. package/dist/cjs/shared/giftcard/index.cjs +0 -2
  143. package/dist/cjs/shared/giftcard/index.cjs.map +0 -1
  144. package/dist/cjs/shared/giftcard/index.d.cts +0 -8
  145. package/dist/cjs/shared/giftcard/smp-giftcard-transaction-config.interface.cjs +0 -2
  146. package/dist/cjs/shared/giftcard/smp-giftcard-transaction-config.interface.cjs.map +0 -1
  147. package/dist/cjs/shared/giftcard/smp-giftcard-transaction-config.interface.d.cts +0 -11
  148. package/dist/cjs/shared/giftcard/smp-giftcard-transaction-hash-strategies.enum.cjs +0 -2
  149. package/dist/cjs/shared/giftcard/smp-giftcard-transaction-hash-strategies.enum.cjs.map +0 -1
  150. package/dist/cjs/shared/giftcard/smp-giftcard-transaction-hash-strategies.enum.d.cts +0 -8
  151. package/dist/cjs/shared/giftcard/smp-giftcard-transaction-ops.enum.cjs +0 -2
  152. package/dist/cjs/shared/giftcard/smp-giftcard-transaction-ops.enum.cjs.map +0 -1
  153. package/dist/cjs/shared/giftcard/smp-giftcard-transaction-ops.enum.d.cts +0 -16
  154. package/dist/cjs/shared/giftcard/smp-giftcard-transaction-plain.interface.cjs +0 -2
  155. package/dist/cjs/shared/giftcard/smp-giftcard-transaction-plain.interface.cjs.map +0 -1
  156. package/dist/cjs/shared/giftcard/smp-giftcard-transaction-plain.interface.d.cts +0 -8
  157. package/dist/cjs/shared/giftcard/smp-giftcard-transaction.class.cjs +0 -2
  158. package/dist/cjs/shared/giftcard/smp-giftcard-transaction.class.cjs.map +0 -1
  159. package/dist/cjs/shared/giftcard/smp-giftcard-transaction.class.d.cts +0 -56
  160. package/dist/cjs/shared/marketing-cloud/index.cjs +0 -2
  161. package/dist/cjs/shared/marketing-cloud/index.cjs.map +0 -1
  162. package/dist/cjs/shared/marketing-cloud/index.d.cts +0 -2
  163. package/dist/cjs/shared/marketing-cloud/smp-marketing-cloud-validation-response.interface.cjs +0 -2
  164. package/dist/cjs/shared/marketing-cloud/smp-marketing-cloud-validation-response.interface.cjs.map +0 -1
  165. package/dist/cjs/shared/marketing-cloud/smp-marketing-cloud-validation-response.interface.d.cts +0 -14
  166. package/dist/cjs/shared/marketing-cloud/smp-marketing-cloud-validators.enum.cjs +0 -2
  167. package/dist/cjs/shared/marketing-cloud/smp-marketing-cloud-validators.enum.cjs.map +0 -1
  168. package/dist/cjs/shared/marketing-cloud/smp-marketing-cloud-validators.enum.d.cts +0 -7
  169. package/dist/cjs/shared/rxjs/index.cjs +0 -2
  170. package/dist/cjs/shared/rxjs/index.cjs.map +0 -1
  171. package/dist/cjs/shared/rxjs/index.d.cts +0 -10
  172. package/dist/cjs/shared/rxjs/smp-abstract-rxjs-ttl-cache-strategy.class.cjs +0 -2
  173. package/dist/cjs/shared/rxjs/smp-abstract-rxjs-ttl-cache-strategy.class.cjs.map +0 -1
  174. package/dist/cjs/shared/rxjs/smp-abstract-rxjs-ttl-cache-strategy.class.d.cts +0 -17
  175. package/dist/cjs/shared/rxjs/smp-rxjs-catch-only.function.cjs +0 -2
  176. package/dist/cjs/shared/rxjs/smp-rxjs-catch-only.function.cjs.map +0 -1
  177. package/dist/cjs/shared/rxjs/smp-rxjs-catch-only.function.d.cts +0 -5
  178. package/dist/cjs/shared/rxjs/smp-rxjs-in-memory-cache.class.cjs +0 -2
  179. package/dist/cjs/shared/rxjs/smp-rxjs-in-memory-cache.class.cjs.map +0 -1
  180. package/dist/cjs/shared/rxjs/smp-rxjs-in-memory-cache.class.d.cts +0 -15
  181. package/dist/cjs/shared/rxjs/smp-rxjs-queue.function.cjs +0 -2
  182. package/dist/cjs/shared/rxjs/smp-rxjs-queue.function.cjs.map +0 -1
  183. package/dist/cjs/shared/rxjs/smp-rxjs-queue.function.d.cts +0 -11
  184. package/dist/cjs/shared/rxjs/smp-rxjs-sequence.function.cjs +0 -2
  185. package/dist/cjs/shared/rxjs/smp-rxjs-sequence.function.cjs.map +0 -1
  186. package/dist/cjs/shared/rxjs/smp-rxjs-sequence.function.d.cts +0 -12
  187. package/dist/cjs/shared/rxjs/smp-rxjs-throw-if-empty.function.cjs +0 -2
  188. package/dist/cjs/shared/rxjs/smp-rxjs-throw-if-empty.function.cjs.map +0 -1
  189. package/dist/cjs/shared/rxjs/smp-rxjs-throw-if-empty.function.d.cts +0 -38
  190. package/dist/cjs/shared/rxjs/smp-rxjs-throw-on-condition.function.cjs +0 -2
  191. package/dist/cjs/shared/rxjs/smp-rxjs-throw-on-condition.function.cjs.map +0 -1
  192. package/dist/cjs/shared/rxjs/smp-rxjs-throw-on-condition.function.d.cts +0 -30
  193. package/dist/cjs/shared/utils/cache/index.cjs +0 -2
  194. package/dist/cjs/shared/utils/cache/index.cjs.map +0 -1
  195. package/dist/cjs/shared/utils/cache/index.d.cts +0 -7
  196. package/dist/cjs/shared/utils/cache/smp-abstract-cache-strategy.class.cjs +0 -2
  197. package/dist/cjs/shared/utils/cache/smp-abstract-cache-strategy.class.cjs.map +0 -1
  198. package/dist/cjs/shared/utils/cache/smp-abstract-cache-strategy.class.d.cts +0 -16
  199. package/dist/cjs/shared/utils/cache/smp-abstract-ttl-cache-strategy.class.cjs +0 -2
  200. package/dist/cjs/shared/utils/cache/smp-abstract-ttl-cache-strategy.class.cjs.map +0 -1
  201. package/dist/cjs/shared/utils/cache/smp-abstract-ttl-cache-strategy.class.d.cts +0 -17
  202. package/dist/cjs/shared/utils/cache/smp-browser-cache.class.cjs +0 -2
  203. package/dist/cjs/shared/utils/cache/smp-browser-cache.class.cjs.map +0 -1
  204. package/dist/cjs/shared/utils/cache/smp-browser-cache.class.d.cts +0 -16
  205. package/dist/cjs/shared/utils/cache/smp-cached-value.interface.cjs +0 -2
  206. package/dist/cjs/shared/utils/cache/smp-cached-value.interface.cjs.map +0 -1
  207. package/dist/cjs/shared/utils/cache/smp-cached-value.interface.d.cts +0 -6
  208. package/dist/cjs/shared/utils/cache/smp-in-memory-cache.class.cjs +0 -2
  209. package/dist/cjs/shared/utils/cache/smp-in-memory-cache.class.cjs.map +0 -1
  210. package/dist/cjs/shared/utils/cache/smp-in-memory-cache.class.d.cts +0 -15
  211. package/dist/cjs/shared/utils/cache/smp-is-smp-cached-value.function.cjs +0 -2
  212. package/dist/cjs/shared/utils/cache/smp-is-smp-cached-value.function.cjs.map +0 -1
  213. package/dist/cjs/shared/utils/cache/smp-is-smp-cached-value.function.d.cts +0 -9
  214. package/dist/cjs/shared/utils/index.cjs +0 -2
  215. package/dist/cjs/shared/utils/index.cjs.map +0 -1
  216. package/dist/cjs/shared/utils/index.d.cts +0 -15
  217. package/dist/cjs/shared/utils/smp-apply-mixin.function.cjs +0 -2
  218. package/dist/cjs/shared/utils/smp-apply-mixin.function.cjs.map +0 -1
  219. package/dist/cjs/shared/utils/smp-apply-mixin.function.d.cts +0 -5
  220. package/dist/cjs/shared/utils/smp-ascii-words.function.cjs +0 -2
  221. package/dist/cjs/shared/utils/smp-ascii-words.function.cjs.map +0 -1
  222. package/dist/cjs/shared/utils/smp-ascii-words.function.d.cts +0 -3
  223. package/dist/cjs/shared/utils/smp-common-utils.class.cjs +0 -2
  224. package/dist/cjs/shared/utils/smp-common-utils.class.cjs.map +0 -1
  225. package/dist/cjs/shared/utils/smp-common-utils.class.d.cts +0 -101
  226. package/dist/cjs/shared/utils/smp-filter-exception.class.cjs +0 -2
  227. package/dist/cjs/shared/utils/smp-filter-exception.class.cjs.map +0 -1
  228. package/dist/cjs/shared/utils/smp-filter-exception.class.d.cts +0 -7
  229. package/dist/cjs/shared/utils/smp-noop.function.cjs +0 -2
  230. package/dist/cjs/shared/utils/smp-noop.function.cjs.map +0 -1
  231. package/dist/cjs/shared/utils/smp-noop.function.d.cts +0 -3
  232. package/dist/cjs/shared/utils/smp-regular-expressions.class.cjs +0 -2
  233. package/dist/cjs/shared/utils/smp-regular-expressions.class.cjs.map +0 -1
  234. package/dist/cjs/shared/utils/smp-regular-expressions.class.d.cts +0 -16
  235. package/dist/cjs/shared/utils/smp-sid.class.cjs +0 -2
  236. package/dist/cjs/shared/utils/smp-sid.class.cjs.map +0 -1
  237. package/dist/cjs/shared/utils/smp-sid.class.d.cts +0 -18
  238. package/dist/cjs/shared/utils/smp-unicode-words.class.cjs +0 -2
  239. package/dist/cjs/shared/utils/smp-unicode-words.class.cjs.map +0 -1
  240. package/dist/cjs/shared/utils/smp-unicode-words.class.d.cts +0 -15
  241. package/dist/cjs/shared/zod/index.cjs +0 -2
  242. package/dist/cjs/shared/zod/index.cjs.map +0 -1
  243. package/dist/cjs/shared/zod/index.d.cts +0 -3
  244. package/dist/cjs/shared/zod/smp-zod-date-time.definition.cjs +0 -2
  245. package/dist/cjs/shared/zod/smp-zod-date-time.definition.cjs.map +0 -1
  246. package/dist/cjs/shared/zod/smp-zod-date-time.definition.d.cts +0 -28
  247. package/dist/cjs/smp-aes-crypt.class-CI82T7GV.d.cts +0 -470
  248. package/dist/cjs/smp-logger-methods.class-F7p-lMeQ.d.cts +0 -66
  249. package/dist/esm/chunk-C3LKT6AF.js +0 -1
  250. package/dist/esm/chunk-FUHGPBNJ.js +0 -1
  251. package/dist/esm/chunk-NIN4PUZX.js +0 -0
  252. package/dist/esm/chunk-RCI7NEJO.js +0 -1
  253. package/dist/esm/chunk-TSC2BSSL.js +0 -1
  254. package/dist/esm/chunk-ZNC4KYAS.js +0 -1
  255. package/dist/esm/smp-logger-methods.class-F7p-lMeQ.d.ts +0 -66
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../../../src/shared/rxjs/index.ts","../../../../src/shared/rxjs/smp-abstract-rxjs-ttl-cache-strategy.class.ts","../../../../src/shared/utils/cache/smp-abstract-cache-strategy.class.ts","../../../../src/shared/utils/cache/smp-is-smp-cached-value.function.ts","../../../../src/shared/rxjs/smp-rxjs-catch-only.function.ts","../../../../src/shared/rxjs/smp-rxjs-in-memory-cache.class.ts","../../../../src/shared/rxjs/smp-rxjs-queue.function.ts","../../../../src/shared/rxjs/smp-rxjs-sequence.function.ts","../../../../src/shared/rxjs/smp-rxjs-throw-if-empty.function.ts","../../../../src/shared/rxjs/smp-rxjs-throw-on-condition.function.ts"],"sourcesContent":["export {SmpAbstractRxjsTtlCacheStrategy} from \"./smp-abstract-rxjs-ttl-cache-strategy.class.js\";\nexport {smpRxjsCatchOnly} from \"./smp-rxjs-catch-only.function.js\";\nexport {SmpRxjsInMemoryCache} from \"./smp-rxjs-in-memory-cache.class.js\";\nexport {smpRxjsQueue} from \"./smp-rxjs-queue.function.js\";\nexport {smpRxjsSequence} from \"./smp-rxjs-sequence.function.js\";\nexport {smpRxjsThrowIfEmpty} from \"./smp-rxjs-throw-if-empty.function.js\";\nexport {smpRxjsThrowOnCondition} from \"./smp-rxjs-throw-on-condition.function.js\";\n","import {map, Observable} from \"rxjs\";\nimport {DateTime} from \"ts-luxon\";\n//\nimport {SmpAbstractCacheStrategy} from \"../utils/cache/smp-abstract-cache-strategy.class.js\";\nimport {SmpCachedValue} from \"../utils/cache/smp-cached-value.interface.js\";\nimport {smpIsSmpCachedValue} from \"../utils/cache/smp-is-smp-cached-value.function.js\";\n\nexport abstract class SmpAbstractRxjsTtlCacheStrategy extends SmpAbstractCacheStrategy {\n\n protected abstract _flushRaw(): Observable<void>;\n\n protected abstract _readRaw(key: string): Observable<unknown | undefined>;\n\n protected abstract _removeRaw(key: string): Observable<void>;\n\n protected abstract _writeRaw(key: string, value: unknown, ttl?: number): Observable<void>;\n\n flush(): Observable<void> {\n return this._flushRaw();\n }\n\n read<T = unknown>(key: string): Observable<T | undefined> {\n return this._readRaw(key).pipe(\n map((storedValue) => {\n if (this._isSmpCachedValue<T>(storedValue)) {\n if (storedValue.expiry >= DateTime.now().ts) {\n return storedValue.value as T;\n }\n this._removeRaw(key).subscribe(); // fire-and-forget\n\n return void 0;\n }\n\n return storedValue as T | undefined;\n })\n );\n }\n\n remove(key: string) {\n return this._removeRaw(key);\n }\n\n write<T = unknown>(key: string, value: T, ttl?: number): Observable<void> {\n if (isNaN(+ttl!) || +ttl! <= 0) {\n return this._writeRaw(key, value, ttl);\n }\n\n const expiry = DateTime.now().ts + ttl! * 1000;\n const wrappedValue: SmpCachedValue<T> = {\n value,\n expiry\n };\n\n return this._writeRaw(key, wrappedValue, ttl);\n }\n\n protected _isSmpCachedValue<T>(value: unknown): value is SmpCachedValue<T> {\n return smpIsSmpCachedValue(value);\n }\n}\n","import {Observable} from \"rxjs\";\n\n/**\n * Abstract class representing a caching strategy. This class is intended to be extended by concrete implementations\n * and provides an interface for performing common caching operations such as reading, writing, removing, and flushing cache entries.\n * You shouldn't need to implement this: you can go with SmpAbstractTtlCacheStrategy or SmpRxjsAbstractCacheStrategy, depending on what type of cache you want to implement.\n * For instance, for a local cache, you may stay sync, while for a Valkey cache, you should start with the rxjs.\n */\nexport abstract class SmpAbstractCacheStrategy {\n abstract read<T = unknown>(key: string): T | undefined | Observable<T | undefined>;\n\n abstract write<T = unknown>(key: string, value: T, ttl?: number): void | Observable<void>;\n\n abstract remove(key: string): void | Observable<void>;\n\n abstract flush(): void | Observable<void>;\n}\n","import {SmpCachedValue} from \"./smp-cached-value.interface.js\";\n\n/**\n * Tells you if a value is a SmpCachedValue\n * @param value\n */\nexport function smpIsSmpCachedValue<T>(value: unknown): value is SmpCachedValue<T> {\n return (\n typeof value === \"object\" &&\n value !== null &&\n \"value\" in value &&\n \"expiry\" in value &&\n typeof (value as any).expiry === \"number\"\n );\n}\n","import {Observable, OperatorFunction, catchError, throwError} from \"rxjs\";\nimport type {ObservableInput, ObservedValueOf} from \"rxjs\";\n\nexport function smpRxjsCatchOnly<T, E extends Error, O extends ObservableInput<any>>(\n errorFilter: (new (...args: any[]) => E) | ((err: unknown) => boolean),\n selector: (err: E) => O\n): OperatorFunction<T, T | ObservedValueOf<O>> {\n return (source: Observable<T>) =>\n source.pipe(\n catchError((err: unknown) => {\n const matches = typeof errorFilter === typeof isNaN\n ? isConstructor(errorFilter)\n ? isExactInstance(err, errorFilter as new (...args: any[]) => E)\n : (errorFilter as (err: unknown) => boolean)(err)\n : false;\n\n if (matches) {\n return selector(err as E);\n }\n return throwError(() => err);\n })\n );\n}\n\n// eslint-disable-next-line @typescript-eslint/no-unsafe-function-type\nfunction isConstructor(fn: unknown): fn is Function {\n try {\n // try creating a dummy instance\n Reflect.construct(String, [], fn as any);\n return true;\n }\n catch {\n return false;\n }\n}\n\n// Ensures that the error is an *exact* instance of the given error constructor, not a subclass\nfunction isExactInstance<E extends Error>(err: unknown, ctor: new (...args: any[]) => E): boolean {\n return (\n typeof err === \"object\" &&\n err !== null &&\n err.constructor === ctor\n );\n}\n","import {defer, Observable, of} from \"rxjs\";\n//\nimport {SmpAbstractRxjsTtlCacheStrategy} from \"./smp-abstract-rxjs-ttl-cache-strategy.class.js\";\n\nexport class SmpRxjsInMemoryCache extends SmpAbstractRxjsTtlCacheStrategy {\n\n private static _storage = new Map<string, unknown>();\n\n protected get _staticSelf(): typeof SmpRxjsInMemoryCache {\n return this.constructor as typeof SmpRxjsInMemoryCache;\n }\n\n protected _flushRaw(): Observable<void> {\n return defer(() => {\n this._staticSelf._storage.clear();\n\n return of(void 0);\n });\n }\n\n protected _readRaw(key: string): Observable<unknown | undefined> {\n return defer(() => {\n\n return of(this._staticSelf._storage.get(key));\n });\n }\n\n protected _removeRaw(key: string): Observable<void> {\n return defer(() => {\n this._staticSelf._storage.delete(key);\n\n return of(void 0);\n });\n }\n\n protected _writeRaw(key: string, value: unknown): Observable<void> {\n return defer(() => {\n this._staticSelf._storage.set(key, value);\n\n return of(void 0);\n });\n }\n}\n\n","import {map, Observable, of, defer, switchMap} from \"rxjs\";\n\nfunction smpRxjsSequence<T extends any[]>(steps: { [K in keyof T]: () => Observable<T[K]> }): Observable<T> {\n const results: Partial<T>[] = [];\n\n function runStep(index: number): Observable<T> {\n if (index >= steps.length) {\n return of(results as T);\n }\n\n return defer(() => steps[index]()).pipe(\n switchMap((value) => {\n results[index] = value;\n return runStep(index + 1);\n })\n );\n }\n\n return runStep(0);\n}\n\n// Overloads for array or object input\ntype ObsFnMap = Record<string, () => Observable<any>>;\n\nexport function smpRxjsQueue<T extends any[]>(source: { [K in keyof T]: () => Observable<T[K]> }): Observable<T>;\nexport function smpRxjsQueue<T extends ObsFnMap>(source: T): Observable<{ [K in keyof T]: T[K] extends () => Observable<infer U> ? U : never }>;\nexport function smpRxjsQueue(\n source: (() => Observable<any>)[] | ObsFnMap\n): Observable<any> {\n if (Array.isArray(source)) {\n // use a strongly typed sequence for the array of steps\n return smpRxjsSequence(source as any);\n }\n else {\n // for object, convert values, then reconstruct object mapping with correct types\n const keys = Object.keys(source);\n const stepsArray = keys.map((key) => source[key]);\n\n return smpRxjsSequence(stepsArray as any).pipe(\n map((results: any[]) => {\n const acc: any = {};\n keys.forEach((key, i) => {\n acc[key] = results[i];\n });\n return acc;\n })\n );\n }\n}\n\n\n","import {concatMap, from, Observable, toArray} from \"rxjs\";\n\n/**\n * Old version of the sequence. Now rewritten using recursion, which is way faster.\n * But you can use this if you want to stick with the rxjs pattern\n * @param steps\n */\nexport function smpRxjsSequence<T extends any[]>(\n steps: { [K in keyof T]: () => Observable<T[K]> }\n): Observable<T> {\n // Cast to readonly tuple of functions to keep tuple inference\n const stepFunctions = steps as readonly (() => Observable<T[number]>)[];\n\n return from(stepFunctions).pipe(\n concatMap(step => step()),\n toArray()\n // TS loses tuple typing here, so we cast the result back to T\n // This cast is safe because we control the input and ordering\n ) as Observable<T>;\n}\n","import {map, Observable, OperatorFunction} from \"rxjs\";\n\n/**\n * If the source observable completes emitting an empty value (empty array or object will be considered empty), it will emit\n * an error. The error will be created at that time by the optional\n * `errorFactory` argument, otherwise, the error will be {@link Error}.\n *\n * ## Example\n *\n * Throw an error if the query didn't match anything\n *\n * ```ts\n * import { of, takeUntil, timer, throwIfEmpty } from 'rxjs';\n *\n * const query$ = of([]);\n *\n * query$.pipe(\n * smpRxjsThrowIfEmpty(() => new Error('The query had no results'))\n * )\n * .subscribe({\n * next() {\n * console.log(\"The query had results\");\n * },\n * error(err) {\n * console.error(err.message);\n * }\n * });\n * ```\n *\n * @param errorFactory A factory function called to produce the\n * error to be thrown when the source observable completes without emitting a\n * value.\n * @return A function that returns an Observable that throws an error if the\n * source Observable completed without emitting.\n */\nexport function smpRxjsThrowIfEmpty<T>(errorFactory: (value: T) => any = defaultErrorFactory): OperatorFunction<T, T> {\n return (source: Observable<T>) => source.pipe(\n map(v => {\n if (~emptyValues.indexOf(JSON.stringify(v))) {\n throw errorFactory(v);\n }\n\n return v;\n })\n );\n}\n\nconst emptyValues = [void 0, null, false, 0, \"\", \"0\", [], {}].map((v) =>\n JSON.stringify(v)\n);\n\nconst defaultErrorFactory = (): Error => new Error();\n","import {defaultIfEmpty, filter, Observable, OperatorFunction} from \"rxjs\";\n//\nimport {smpRxjsThrowIfEmpty} from \"./smp-rxjs-throw-if-empty.function.js\";\n\n/**\n * Custom RxJS operator that filters the source observable based on a condition\n * and throws an error if the resulting observable is empty.\n *\n * @template T The type of items emitted by the source observable.\n * @param {function(T): boolean} condition - A function that takes a value from the source observable and returns a boolean.\n * If the function returns `true`, the value will be emitted; otherwise, it will be filtered out.\n * @param {function(): Error} [errorFactory] - An optional function that returns an error to be thrown if the resulting observable is empty.\n * If not provided, a default error will be thrown.\n * @returns {OperatorFunction<T, T>} An operator function that can be used in the RxJS pipeline.\n *\n * @example\n * import { of } from 'rxjs';\n * import { smpRxjsThrowOnCondition } from \"./path-to-your-file\";\n *\n * const source$ = of(1, 5, -3, 7, 12).pipe(\n * smpRxjsThrowOnCondition(value => value >= 0, () => new Error(\"Value is less than 0\")),\n * smpRxjsThrowOnCondition(value => value > 12, () => new Error(\"Value is lower than 12\"))\n * );\n *\n * source$.subscribe({\n * next: value => console.log(\"Value:\", value),\n * error: err => console.error(\"Error:\", err)\n * });\n */\nexport function smpRxjsThrowOnCondition<T>(\n condition: (value: T) => boolean,\n errorFactory?: () => any\n): OperatorFunction<T, T> {\n return (source: Observable<T>) =>\n source.pipe(\n filter((v: T) => !condition(v)), // Invert the condition because if I need to throw on that condition we should filter all that don't match\n defaultIfEmpty(false as unknown as T), // We nuke type errors, cause when falsy smpRxjsThrowIfEmpty will throw\n smpRxjsThrowIfEmpty(errorFactory)\n );\n}\n"],"mappings":"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","names":["rxjs_exports","__export","SmpAbstractRxjsTtlCacheStrategy","SmpRxjsInMemoryCache","smpRxjsCatchOnly","smpRxjsQueue","smpRxjsSequence","smpRxjsThrowIfEmpty","smpRxjsThrowOnCondition","__toCommonJS","import_rxjs","import_ts_luxon","SmpAbstractCacheStrategy","smpIsSmpCachedValue","value","expiry","SmpAbstractRxjsTtlCacheStrategy","SmpAbstractCacheStrategy","flush","_flushRaw","read","key","_readRaw","pipe","map","storedValue","_isSmpCachedValue","expiry","DateTime","now","ts","value","_removeRaw","subscribe","remove","write","ttl","isNaN","_writeRaw","wrappedValue","smpIsSmpCachedValue","import_rxjs","smpRxjsCatchOnly","errorFilter","selector","source","pipe","catchError","err","isNaN","isConstructor","isExactInstance","throwError","fn","Reflect","construct","String","ctor","import_rxjs","SmpRxjsInMemoryCache","SmpAbstractRxjsTtlCacheStrategy","_storage","Map","_staticSelf","_flushRaw","defer","clear","of","_readRaw","key","get","_removeRaw","delete","_writeRaw","value","set","import_rxjs","smpRxjsSequence","steps","results","runStep","index","length","of","defer","pipe","switchMap","value","smpRxjsQueue","source","Array","isArray","keys","Object","stepsArray","map","key","acc","forEach","i","import_rxjs","smpRxjsSequence","steps","from","stepFunctions","pipe","concatMap","step","toArray","import_rxjs","smpRxjsThrowIfEmpty","errorFactory","defaultErrorFactory","source","pipe","map","v","emptyValues","indexOf","JSON","stringify","__name","Error","import_rxjs","smpRxjsThrowOnCondition","condition","errorFactory","source","pipe","filter","v","defaultIfEmpty","smpRxjsThrowIfEmpty"]}
@@ -1,10 +0,0 @@
1
- export { SmpAbstractRxjsTtlCacheStrategy } from './smp-abstract-rxjs-ttl-cache-strategy.class.cjs';
2
- export { smpRxjsCatchOnly } from './smp-rxjs-catch-only.function.cjs';
3
- export { SmpRxjsInMemoryCache } from './smp-rxjs-in-memory-cache.class.cjs';
4
- export { smpRxjsQueue } from './smp-rxjs-queue.function.cjs';
5
- export { smpRxjsSequence } from './smp-rxjs-sequence.function.cjs';
6
- export { smpRxjsThrowIfEmpty } from './smp-rxjs-throw-if-empty.function.cjs';
7
- export { smpRxjsThrowOnCondition } from './smp-rxjs-throw-on-condition.function.cjs';
8
- import 'rxjs';
9
- import '../utils/cache/smp-abstract-cache-strategy.class.cjs';
10
- import '../utils/cache/smp-cached-value.interface.cjs';
@@ -1,2 +0,0 @@
1
- "use strict";var t=Object.defineProperty;var w=Object.getOwnPropertyDescriptor;var c=Object.getOwnPropertyNames;var _=Object.prototype.hasOwnProperty;var n=(e,r)=>t(e,"name",{value:r,configurable:!0});var x=(e,r)=>{for(var i in r)t(e,i,{get:r[i],enumerable:!0})},d=(e,r,i,p)=>{if(r&&typeof r=="object"||typeof r=="function")for(let s of c(r))!_.call(e,s)&&s!==i&&t(e,s,{get:()=>r[s],enumerable:!(p=w(r,s))||p.enumerable});return e};var R=e=>d(t({},"__esModule",{value:!0}),e);var b={};x(b,{SmpAbstractRxjsTtlCacheStrategy:()=>u});module.exports=R(b);var f=require("rxjs"),m=require("ts-luxon");var o=class{static{n(this,"SmpAbstractCacheStrategy")}};function a(e){return typeof e=="object"&&e!==null&&"value"in e&&"expiry"in e&&typeof e.expiry=="number"}n(a,"smpIsSmpCachedValue");var u=class extends o{static{n(this,"SmpAbstractRxjsTtlCacheStrategy")}flush(){return this._flushRaw()}read(r){return this._readRaw(r).pipe((0,f.map)(i=>{if(this._isSmpCachedValue(i)){if(i.expiry>=m.DateTime.now().ts)return i.value;this._removeRaw(r).subscribe();return}return i}))}remove(r){return this._removeRaw(r)}write(r,i,p){if(isNaN(+p)||+p<=0)return this._writeRaw(r,i,p);let s=m.DateTime.now().ts+p*1e3,h={value:i,expiry:s};return this._writeRaw(r,h,p)}_isSmpCachedValue(r){return a(r)}};0&&(module.exports={SmpAbstractRxjsTtlCacheStrategy});
2
- //# sourceMappingURL=smp-abstract-rxjs-ttl-cache-strategy.class.cjs.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../../../src/shared/rxjs/smp-abstract-rxjs-ttl-cache-strategy.class.ts","../../../../src/shared/utils/cache/smp-abstract-cache-strategy.class.ts","../../../../src/shared/utils/cache/smp-is-smp-cached-value.function.ts"],"sourcesContent":["import {map, Observable} from \"rxjs\";\nimport {DateTime} from \"ts-luxon\";\n//\nimport {SmpAbstractCacheStrategy} from \"../utils/cache/smp-abstract-cache-strategy.class.js\";\nimport {SmpCachedValue} from \"../utils/cache/smp-cached-value.interface.js\";\nimport {smpIsSmpCachedValue} from \"../utils/cache/smp-is-smp-cached-value.function.js\";\n\nexport abstract class SmpAbstractRxjsTtlCacheStrategy extends SmpAbstractCacheStrategy {\n\n protected abstract _flushRaw(): Observable<void>;\n\n protected abstract _readRaw(key: string): Observable<unknown | undefined>;\n\n protected abstract _removeRaw(key: string): Observable<void>;\n\n protected abstract _writeRaw(key: string, value: unknown, ttl?: number): Observable<void>;\n\n flush(): Observable<void> {\n return this._flushRaw();\n }\n\n read<T = unknown>(key: string): Observable<T | undefined> {\n return this._readRaw(key).pipe(\n map((storedValue) => {\n if (this._isSmpCachedValue<T>(storedValue)) {\n if (storedValue.expiry >= DateTime.now().ts) {\n return storedValue.value as T;\n }\n this._removeRaw(key).subscribe(); // fire-and-forget\n\n return void 0;\n }\n\n return storedValue as T | undefined;\n })\n );\n }\n\n remove(key: string) {\n return this._removeRaw(key);\n }\n\n write<T = unknown>(key: string, value: T, ttl?: number): Observable<void> {\n if (isNaN(+ttl!) || +ttl! <= 0) {\n return this._writeRaw(key, value, ttl);\n }\n\n const expiry = DateTime.now().ts + ttl! * 1000;\n const wrappedValue: SmpCachedValue<T> = {\n value,\n expiry\n };\n\n return this._writeRaw(key, wrappedValue, ttl);\n }\n\n protected _isSmpCachedValue<T>(value: unknown): value is SmpCachedValue<T> {\n return smpIsSmpCachedValue(value);\n }\n}\n","import {Observable} from \"rxjs\";\n\n/**\n * Abstract class representing a caching strategy. This class is intended to be extended by concrete implementations\n * and provides an interface for performing common caching operations such as reading, writing, removing, and flushing cache entries.\n * You shouldn't need to implement this: you can go with SmpAbstractTtlCacheStrategy or SmpRxjsAbstractCacheStrategy, depending on what type of cache you want to implement.\n * For instance, for a local cache, you may stay sync, while for a Valkey cache, you should start with the rxjs.\n */\nexport abstract class SmpAbstractCacheStrategy {\n abstract read<T = unknown>(key: string): T | undefined | Observable<T | undefined>;\n\n abstract write<T = unknown>(key: string, value: T, ttl?: number): void | Observable<void>;\n\n abstract remove(key: string): void | Observable<void>;\n\n abstract flush(): void | Observable<void>;\n}\n","import {SmpCachedValue} from \"./smp-cached-value.interface.js\";\n\n/**\n * Tells you if a value is a SmpCachedValue\n * @param value\n */\nexport function smpIsSmpCachedValue<T>(value: unknown): value is SmpCachedValue<T> {\n return (\n typeof value === \"object\" &&\n value !== null &&\n \"value\" in value &&\n \"expiry\" in value &&\n typeof (value as any).expiry === \"number\"\n );\n}\n"],"mappings":"4dAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,qCAAAE,IAAA,eAAAC,EAAAH,GAAA,IAAAI,EAA8B,gBAC9BC,EAAuB,oBCOhB,IAAeC,EAAf,KAAeA,CANtB,MAMsBA,CAAAA,EAAAA,iCAQtB,ECVO,SAASC,EAAuBC,EAAc,CACjD,OACI,OAAOA,GAAU,UACjBA,IAAU,MACV,UAAWA,GACX,WAAYA,GACZ,OAAQA,EAAcC,QAAW,QAEzC,CARgBF,EAAAA,EAAAA,uBFCT,IAAeG,EAAf,cAAuDC,CAAAA,CAP9D,MAO8DA,CAAAA,EAAAA,wCAU1DC,OAA0B,CACtB,OAAO,KAAKC,UAAS,CACzB,CAEAC,KAAkBC,EAAwC,CACtD,OAAO,KAAKC,SAASD,CAAAA,EAAKE,QACtBC,OAAKC,GAAAA,CACD,GAAI,KAAKC,kBAAqBD,CAAAA,EAAc,CACxC,GAAIA,EAAYE,QAAUC,WAASC,IAAG,EAAGC,GACrC,OAAOL,EAAYM,MAEvB,KAAKC,WAAWX,CAAAA,EAAKY,UAAS,EAE9B,MACJ,CAEA,OAAOR,CACX,CAAA,CAAA,CAER,CAEAS,OAAOb,EAAa,CAChB,OAAO,KAAKW,WAAWX,CAAAA,CAC3B,CAEAc,MAAmBd,EAAaU,EAAUK,EAAgC,CACtE,GAAIC,MAAM,CAACD,CAAAA,GAAS,CAACA,GAAQ,EACzB,OAAO,KAAKE,UAAUjB,EAAKU,EAAOK,CAAAA,EAGtC,IAAMT,EAASC,WAASC,IAAG,EAAGC,GAAKM,EAAO,IACpCG,EAAkC,CACpCR,MAAAA,EACAJ,OAAAA,CACJ,EAEA,OAAO,KAAKW,UAAUjB,EAAKkB,EAAcH,CAAAA,CAC7C,CAEUV,kBAAqBK,EAA4C,CACvE,OAAOS,EAAoBT,CAAAA,CAC/B,CACJ","names":["smp_abstract_rxjs_ttl_cache_strategy_class_exports","__export","SmpAbstractRxjsTtlCacheStrategy","__toCommonJS","import_rxjs","import_ts_luxon","SmpAbstractCacheStrategy","smpIsSmpCachedValue","value","expiry","SmpAbstractRxjsTtlCacheStrategy","SmpAbstractCacheStrategy","flush","_flushRaw","read","key","_readRaw","pipe","map","storedValue","_isSmpCachedValue","expiry","DateTime","now","ts","value","_removeRaw","subscribe","remove","write","ttl","isNaN","_writeRaw","wrappedValue","smpIsSmpCachedValue"]}
@@ -1,17 +0,0 @@
1
- import { Observable } from 'rxjs';
2
- import { SmpAbstractCacheStrategy } from '../utils/cache/smp-abstract-cache-strategy.class.cjs';
3
- import { SmpCachedValue } from '../utils/cache/smp-cached-value.interface.cjs';
4
-
5
- declare abstract class SmpAbstractRxjsTtlCacheStrategy extends SmpAbstractCacheStrategy {
6
- protected abstract _flushRaw(): Observable<void>;
7
- protected abstract _readRaw(key: string): Observable<unknown | undefined>;
8
- protected abstract _removeRaw(key: string): Observable<void>;
9
- protected abstract _writeRaw(key: string, value: unknown, ttl?: number): Observable<void>;
10
- flush(): Observable<void>;
11
- read<T = unknown>(key: string): Observable<T | undefined>;
12
- remove(key: string): Observable<void>;
13
- write<T = unknown>(key: string, value: T, ttl?: number): Observable<void>;
14
- protected _isSmpCachedValue<T>(value: unknown): value is SmpCachedValue<T>;
15
- }
16
-
17
- export { SmpAbstractRxjsTtlCacheStrategy };
@@ -1,2 +0,0 @@
1
- "use strict";var u=Object.defineProperty;var e=Object.getOwnPropertyDescriptor;var p=Object.getOwnPropertyNames;var r=Object.prototype.hasOwnProperty;var f=(t,n)=>u(t,"name",{value:n,configurable:!0});var i=(t,n)=>{for(var o in n)u(t,o,{get:n[o],enumerable:!0})},h=(t,n,o,c)=>{if(n&&typeof n=="object"||typeof n=="function")for(let s of p(n))!r.call(t,s)&&s!==o&&u(t,s,{get:()=>n[s],enumerable:!(c=e(n,s))||c.enumerable});return t};var m=t=>h(u({},"__esModule",{value:!0}),t);var E={};i(E,{smpRxjsCatchOnly:()=>y});module.exports=m(E);var a=require("rxjs");function y(t,n){return o=>o.pipe((0,a.catchError)(c=>(typeof t==typeof isNaN?l(t)?x(c,t):t(c):!1)?n(c):(0,a.throwError)(()=>c)))}f(y,"smpRxjsCatchOnly");function l(t){try{return Reflect.construct(String,[],t),!0}catch{return!1}}f(l,"isConstructor");function x(t,n){return typeof t=="object"&&t!==null&&t.constructor===n}f(x,"isExactInstance");0&&(module.exports={smpRxjsCatchOnly});
2
- //# sourceMappingURL=smp-rxjs-catch-only.function.cjs.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../../../src/shared/rxjs/smp-rxjs-catch-only.function.ts"],"sourcesContent":["import {Observable, OperatorFunction, catchError, throwError} from \"rxjs\";\nimport type {ObservableInput, ObservedValueOf} from \"rxjs\";\n\nexport function smpRxjsCatchOnly<T, E extends Error, O extends ObservableInput<any>>(\n errorFilter: (new (...args: any[]) => E) | ((err: unknown) => boolean),\n selector: (err: E) => O\n): OperatorFunction<T, T | ObservedValueOf<O>> {\n return (source: Observable<T>) =>\n source.pipe(\n catchError((err: unknown) => {\n const matches = typeof errorFilter === typeof isNaN\n ? isConstructor(errorFilter)\n ? isExactInstance(err, errorFilter as new (...args: any[]) => E)\n : (errorFilter as (err: unknown) => boolean)(err)\n : false;\n\n if (matches) {\n return selector(err as E);\n }\n return throwError(() => err);\n })\n );\n}\n\n// eslint-disable-next-line @typescript-eslint/no-unsafe-function-type\nfunction isConstructor(fn: unknown): fn is Function {\n try {\n // try creating a dummy instance\n Reflect.construct(String, [], fn as any);\n return true;\n }\n catch {\n return false;\n }\n}\n\n// Ensures that the error is an *exact* instance of the given error constructor, not a subclass\nfunction isExactInstance<E extends Error>(err: unknown, ctor: new (...args: any[]) => E): boolean {\n return (\n typeof err === \"object\" &&\n err !== null &&\n err.constructor === ctor\n );\n}\n"],"mappings":"4dAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,sBAAAE,IAAA,eAAAC,EAAAH,GAAA,IAAAI,EAAmE,gBAG5D,SAASC,EACZC,EACAC,EAAuB,CAEvB,OAAQC,GACJA,EAAOC,QACHC,cAAYC,IACQ,OAAOL,GAAgB,OAAOM,MACxCC,EAAcP,CAAAA,EACVQ,EAAgBH,EAAKL,CAAAA,EACpBA,EAA0CK,CAAAA,EAC/C,IAGKJ,EAASI,CAAAA,KAEbI,cAAW,IAAMJ,CAAAA,CAC5B,CAAA,CAEZ,CAnBgBN,EAAAA,EAAAA,oBAsBhB,SAASQ,EAAcG,EAAW,CAC9B,GAAI,CAEAC,eAAQC,UAAUC,OAAQ,CAAA,EAAIH,CAAAA,EACvB,EACX,MACM,CACF,MAAO,EACX,CACJ,CATSH,EAAAA,EAAAA,iBAYT,SAASC,EAAiCH,EAAcS,EAA+B,CACnF,OACI,OAAOT,GAAQ,UACfA,IAAQ,MACRA,EAAI,cAAgBS,CAE5B,CANSN,EAAAA,EAAAA","names":["smp_rxjs_catch_only_function_exports","__export","smpRxjsCatchOnly","__toCommonJS","import_rxjs","smpRxjsCatchOnly","errorFilter","selector","source","pipe","catchError","err","isNaN","isConstructor","isExactInstance","throwError","fn","Reflect","construct","String","ctor"]}
@@ -1,5 +0,0 @@
1
- import { ObservableInput, OperatorFunction, ObservedValueOf } from 'rxjs';
2
-
3
- declare function smpRxjsCatchOnly<T, E extends Error, O extends ObservableInput<any>>(errorFilter: (new (...args: any[]) => E) | ((err: unknown) => boolean), selector: (err: E) => O): OperatorFunction<T, T | ObservedValueOf<O>>;
4
-
5
- export { smpRxjsCatchOnly };
@@ -1,2 +0,0 @@
1
- "use strict";var n=Object.defineProperty;var w=Object.getOwnPropertyDescriptor;var d=Object.getOwnPropertyNames;var l=Object.prototype.hasOwnProperty;var o=(e,r)=>n(e,"name",{value:r,configurable:!0});var x=(e,r)=>{for(var t in r)n(e,t,{get:r[t],enumerable:!0})},R=(e,r,t,s)=>{if(r&&typeof r=="object"||typeof r=="function")for(let a of d(r))!l.call(e,a)&&a!==t&&n(e,a,{get:()=>r[a],enumerable:!(s=w(r,a))||s.enumerable});return e};var S=e=>R(n({},"__esModule",{value:!0}),e);var g={};x(g,{SmpRxjsInMemoryCache:()=>f});module.exports=S(g);var i=require("rxjs");var c=require("rxjs"),m=require("ts-luxon");var p=class{static{o(this,"SmpAbstractCacheStrategy")}};function _(e){return typeof e=="object"&&e!==null&&"value"in e&&"expiry"in e&&typeof e.expiry=="number"}o(_,"smpIsSmpCachedValue");var u=class extends p{static{o(this,"SmpAbstractRxjsTtlCacheStrategy")}flush(){return this._flushRaw()}read(r){return this._readRaw(r).pipe((0,c.map)(t=>{if(this._isSmpCachedValue(t)){if(t.expiry>=m.DateTime.now().ts)return t.value;this._removeRaw(r).subscribe();return}return t}))}remove(r){return this._removeRaw(r)}write(r,t,s){if(isNaN(+s)||+s<=0)return this._writeRaw(r,t,s);let a=m.DateTime.now().ts+s*1e3,h={value:t,expiry:a};return this._writeRaw(r,h,s)}_isSmpCachedValue(r){return _(r)}};var f=class extends u{static{o(this,"SmpRxjsInMemoryCache")}static _storage=new Map;get _staticSelf(){return this.constructor}_flushRaw(){return(0,i.defer)(()=>(this._staticSelf._storage.clear(),(0,i.of)(void 0)))}_readRaw(r){return(0,i.defer)(()=>(0,i.of)(this._staticSelf._storage.get(r)))}_removeRaw(r){return(0,i.defer)(()=>(this._staticSelf._storage.delete(r),(0,i.of)(void 0)))}_writeRaw(r,t){return(0,i.defer)(()=>(this._staticSelf._storage.set(r,t),(0,i.of)(void 0)))}};0&&(module.exports={SmpRxjsInMemoryCache});
2
- //# sourceMappingURL=smp-rxjs-in-memory-cache.class.cjs.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../../../src/shared/rxjs/smp-rxjs-in-memory-cache.class.ts","../../../../src/shared/rxjs/smp-abstract-rxjs-ttl-cache-strategy.class.ts","../../../../src/shared/utils/cache/smp-abstract-cache-strategy.class.ts","../../../../src/shared/utils/cache/smp-is-smp-cached-value.function.ts"],"sourcesContent":["import {defer, Observable, of} from \"rxjs\";\n//\nimport {SmpAbstractRxjsTtlCacheStrategy} from \"./smp-abstract-rxjs-ttl-cache-strategy.class.js\";\n\nexport class SmpRxjsInMemoryCache extends SmpAbstractRxjsTtlCacheStrategy {\n\n private static _storage = new Map<string, unknown>();\n\n protected get _staticSelf(): typeof SmpRxjsInMemoryCache {\n return this.constructor as typeof SmpRxjsInMemoryCache;\n }\n\n protected _flushRaw(): Observable<void> {\n return defer(() => {\n this._staticSelf._storage.clear();\n\n return of(void 0);\n });\n }\n\n protected _readRaw(key: string): Observable<unknown | undefined> {\n return defer(() => {\n\n return of(this._staticSelf._storage.get(key));\n });\n }\n\n protected _removeRaw(key: string): Observable<void> {\n return defer(() => {\n this._staticSelf._storage.delete(key);\n\n return of(void 0);\n });\n }\n\n protected _writeRaw(key: string, value: unknown): Observable<void> {\n return defer(() => {\n this._staticSelf._storage.set(key, value);\n\n return of(void 0);\n });\n }\n}\n\n","import {map, Observable} from \"rxjs\";\nimport {DateTime} from \"ts-luxon\";\n//\nimport {SmpAbstractCacheStrategy} from \"../utils/cache/smp-abstract-cache-strategy.class.js\";\nimport {SmpCachedValue} from \"../utils/cache/smp-cached-value.interface.js\";\nimport {smpIsSmpCachedValue} from \"../utils/cache/smp-is-smp-cached-value.function.js\";\n\nexport abstract class SmpAbstractRxjsTtlCacheStrategy extends SmpAbstractCacheStrategy {\n\n protected abstract _flushRaw(): Observable<void>;\n\n protected abstract _readRaw(key: string): Observable<unknown | undefined>;\n\n protected abstract _removeRaw(key: string): Observable<void>;\n\n protected abstract _writeRaw(key: string, value: unknown, ttl?: number): Observable<void>;\n\n flush(): Observable<void> {\n return this._flushRaw();\n }\n\n read<T = unknown>(key: string): Observable<T | undefined> {\n return this._readRaw(key).pipe(\n map((storedValue) => {\n if (this._isSmpCachedValue<T>(storedValue)) {\n if (storedValue.expiry >= DateTime.now().ts) {\n return storedValue.value as T;\n }\n this._removeRaw(key).subscribe(); // fire-and-forget\n\n return void 0;\n }\n\n return storedValue as T | undefined;\n })\n );\n }\n\n remove(key: string) {\n return this._removeRaw(key);\n }\n\n write<T = unknown>(key: string, value: T, ttl?: number): Observable<void> {\n if (isNaN(+ttl!) || +ttl! <= 0) {\n return this._writeRaw(key, value, ttl);\n }\n\n const expiry = DateTime.now().ts + ttl! * 1000;\n const wrappedValue: SmpCachedValue<T> = {\n value,\n expiry\n };\n\n return this._writeRaw(key, wrappedValue, ttl);\n }\n\n protected _isSmpCachedValue<T>(value: unknown): value is SmpCachedValue<T> {\n return smpIsSmpCachedValue(value);\n }\n}\n","import {Observable} from \"rxjs\";\n\n/**\n * Abstract class representing a caching strategy. This class is intended to be extended by concrete implementations\n * and provides an interface for performing common caching operations such as reading, writing, removing, and flushing cache entries.\n * You shouldn't need to implement this: you can go with SmpAbstractTtlCacheStrategy or SmpRxjsAbstractCacheStrategy, depending on what type of cache you want to implement.\n * For instance, for a local cache, you may stay sync, while for a Valkey cache, you should start with the rxjs.\n */\nexport abstract class SmpAbstractCacheStrategy {\n abstract read<T = unknown>(key: string): T | undefined | Observable<T | undefined>;\n\n abstract write<T = unknown>(key: string, value: T, ttl?: number): void | Observable<void>;\n\n abstract remove(key: string): void | Observable<void>;\n\n abstract flush(): void | Observable<void>;\n}\n","import {SmpCachedValue} from \"./smp-cached-value.interface.js\";\n\n/**\n * Tells you if a value is a SmpCachedValue\n * @param value\n */\nexport function smpIsSmpCachedValue<T>(value: unknown): value is SmpCachedValue<T> {\n return (\n typeof value === \"object\" &&\n value !== null &&\n \"value\" in value &&\n \"expiry\" in value &&\n typeof (value as any).expiry === \"number\"\n );\n}\n"],"mappings":"4dAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,0BAAAE,IAAA,eAAAC,EAAAH,GAAA,IAAAI,EAAoC,gBCApC,IAAAC,EAA8B,gBAC9BC,EAAuB,oBCOhB,IAAeC,EAAf,KAAeA,CANtB,MAMsBA,CAAAA,EAAAA,iCAQtB,ECVO,SAASC,EAAuBC,EAAc,CACjD,OACI,OAAOA,GAAU,UACjBA,IAAU,MACV,UAAWA,GACX,WAAYA,GACZ,OAAQA,EAAcC,QAAW,QAEzC,CARgBF,EAAAA,EAAAA,uBFCT,IAAeG,EAAf,cAAuDC,CAAAA,CAP9D,MAO8DA,CAAAA,EAAAA,wCAU1DC,OAA0B,CACtB,OAAO,KAAKC,UAAS,CACzB,CAEAC,KAAkBC,EAAwC,CACtD,OAAO,KAAKC,SAASD,CAAAA,EAAKE,QACtBC,OAAKC,GAAAA,CACD,GAAI,KAAKC,kBAAqBD,CAAAA,EAAc,CACxC,GAAIA,EAAYE,QAAUC,WAASC,IAAG,EAAGC,GACrC,OAAOL,EAAYM,MAEvB,KAAKC,WAAWX,CAAAA,EAAKY,UAAS,EAE9B,MACJ,CAEA,OAAOR,CACX,CAAA,CAAA,CAER,CAEAS,OAAOb,EAAa,CAChB,OAAO,KAAKW,WAAWX,CAAAA,CAC3B,CAEAc,MAAmBd,EAAaU,EAAUK,EAAgC,CACtE,GAAIC,MAAM,CAACD,CAAAA,GAAS,CAACA,GAAQ,EACzB,OAAO,KAAKE,UAAUjB,EAAKU,EAAOK,CAAAA,EAGtC,IAAMT,EAASC,WAASC,IAAG,EAAGC,GAAKM,EAAO,IACpCG,EAAkC,CACpCR,MAAAA,EACAJ,OAAAA,CACJ,EAEA,OAAO,KAAKW,UAAUjB,EAAKkB,EAAcH,CAAAA,CAC7C,CAEUV,kBAAqBK,EAA4C,CACvE,OAAOS,EAAoBT,CAAAA,CAC/B,CACJ,EDvDO,IAAMU,EAAN,cAAmCC,CAAAA,CAJ1C,MAI0CA,CAAAA,EAAAA,6BAEtC,OAAeC,SAAW,IAAIC,IAE9B,IAAcC,aAA2C,CACrD,OAAO,KAAK,WAChB,CAEUC,WAA8B,CACpC,SAAOC,SAAM,KACT,KAAKF,YAAYF,SAASK,MAAK,KAExBC,MAAG,MAAK,EACnB,CACJ,CAEUC,SAASC,EAA8C,CAC7D,SAAOJ,SAAM,OAEFE,MAAG,KAAKJ,YAAYF,SAASS,IAAID,CAAAA,CAAAA,CAC5C,CACJ,CAEUE,WAAWF,EAA+B,CAChD,SAAOJ,SAAM,KACT,KAAKF,YAAYF,SAASW,OAAOH,CAAAA,KAE1BF,MAAG,MAAK,EACnB,CACJ,CAEUM,UAAUJ,EAAaK,EAAkC,CAC/D,SAAOT,SAAM,KACT,KAAKF,YAAYF,SAASc,IAAIN,EAAKK,CAAAA,KAE5BP,MAAG,MAAK,EACnB,CACJ,CACJ","names":["smp_rxjs_in_memory_cache_class_exports","__export","SmpRxjsInMemoryCache","__toCommonJS","import_rxjs","import_rxjs","import_ts_luxon","SmpAbstractCacheStrategy","smpIsSmpCachedValue","value","expiry","SmpAbstractRxjsTtlCacheStrategy","SmpAbstractCacheStrategy","flush","_flushRaw","read","key","_readRaw","pipe","map","storedValue","_isSmpCachedValue","expiry","DateTime","now","ts","value","_removeRaw","subscribe","remove","write","ttl","isNaN","_writeRaw","wrappedValue","smpIsSmpCachedValue","SmpRxjsInMemoryCache","SmpAbstractRxjsTtlCacheStrategy","_storage","Map","_staticSelf","_flushRaw","defer","clear","of","_readRaw","key","get","_removeRaw","delete","_writeRaw","value","set"]}
@@ -1,15 +0,0 @@
1
- import { Observable } from 'rxjs';
2
- import { SmpAbstractRxjsTtlCacheStrategy } from './smp-abstract-rxjs-ttl-cache-strategy.class.cjs';
3
- import '../utils/cache/smp-abstract-cache-strategy.class.cjs';
4
- import '../utils/cache/smp-cached-value.interface.cjs';
5
-
6
- declare class SmpRxjsInMemoryCache extends SmpAbstractRxjsTtlCacheStrategy {
7
- private static _storage;
8
- protected get _staticSelf(): typeof SmpRxjsInMemoryCache;
9
- protected _flushRaw(): Observable<void>;
10
- protected _readRaw(key: string): Observable<unknown | undefined>;
11
- protected _removeRaw(key: string): Observable<void>;
12
- protected _writeRaw(key: string, value: unknown): Observable<void>;
13
- }
14
-
15
- export { SmpRxjsInMemoryCache };
@@ -1,2 +0,0 @@
1
- "use strict";var u=Object.defineProperty;var i=Object.getOwnPropertyDescriptor;var m=Object.getOwnPropertyNames;var y=Object.prototype.hasOwnProperty;var c=(r,t)=>u(r,"name",{value:t,configurable:!0});var h=(r,t)=>{for(var p in t)u(r,p,{get:t[p],enumerable:!0})},j=(r,t,p,e)=>{if(t&&typeof t=="object"||typeof t=="function")for(let n of m(t))!y.call(r,n)&&n!==p&&u(r,n,{get:()=>t[n],enumerable:!(e=i(t,n))||e.enumerable});return r};var l=r=>j(u({},"__esModule",{value:!0}),r);var k={};h(k,{smpRxjsQueue:()=>A});module.exports=l(k);var s=require("rxjs");function f(r){let t=[];function p(e){return e>=r.length?(0,s.of)(t):(0,s.defer)(()=>r[e]()).pipe((0,s.switchMap)(n=>(t[e]=n,p(e+1))))}return c(p,"runStep"),p(0)}c(f,"smpRxjsSequence");function A(r){if(Array.isArray(r))return f(r);{let t=Object.keys(r),p=t.map(e=>r[e]);return f(p).pipe((0,s.map)(e=>{let n={};return t.forEach((o,a)=>{n[o]=e[a]}),n}))}}c(A,"smpRxjsQueue");0&&(module.exports={smpRxjsQueue});
2
- //# sourceMappingURL=smp-rxjs-queue.function.cjs.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../../../src/shared/rxjs/smp-rxjs-queue.function.ts"],"sourcesContent":["import {map, Observable, of, defer, switchMap} from \"rxjs\";\n\nfunction smpRxjsSequence<T extends any[]>(steps: { [K in keyof T]: () => Observable<T[K]> }): Observable<T> {\n const results: Partial<T>[] = [];\n\n function runStep(index: number): Observable<T> {\n if (index >= steps.length) {\n return of(results as T);\n }\n\n return defer(() => steps[index]()).pipe(\n switchMap((value) => {\n results[index] = value;\n return runStep(index + 1);\n })\n );\n }\n\n return runStep(0);\n}\n\n// Overloads for array or object input\ntype ObsFnMap = Record<string, () => Observable<any>>;\n\nexport function smpRxjsQueue<T extends any[]>(source: { [K in keyof T]: () => Observable<T[K]> }): Observable<T>;\nexport function smpRxjsQueue<T extends ObsFnMap>(source: T): Observable<{ [K in keyof T]: T[K] extends () => Observable<infer U> ? U : never }>;\nexport function smpRxjsQueue(\n source: (() => Observable<any>)[] | ObsFnMap\n): Observable<any> {\n if (Array.isArray(source)) {\n // use a strongly typed sequence for the array of steps\n return smpRxjsSequence(source as any);\n }\n else {\n // for object, convert values, then reconstruct object mapping with correct types\n const keys = Object.keys(source);\n const stepsArray = keys.map((key) => source[key]);\n\n return smpRxjsSequence(stepsArray as any).pipe(\n map((results: any[]) => {\n const acc: any = {};\n keys.forEach((key, i) => {\n acc[key] = results[i];\n });\n return acc;\n })\n );\n }\n}\n\n\n"],"mappings":"4dAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,kBAAAE,IAAA,eAAAC,EAAAH,GAAA,IAAAI,EAAoD,gBAEpD,SAASC,EAAiCC,EAAiD,CACvF,IAAMC,EAAwB,CAAA,EAE9B,SAASC,EAAQC,EAAa,CAC1B,OAAIA,GAASH,EAAMI,UACRC,MAAGJ,CAAAA,KAGPK,SAAM,IAAMN,EAAMG,CAAAA,EAAM,CAAA,EAAII,QAC/BC,aAAWC,IACPR,EAAQE,CAAAA,EAASM,EACVP,EAAQC,EAAQ,CAAA,EAC3B,CAAA,CAER,CAXSD,OAAAA,EAAAA,EAAAA,WAaFA,EAAQ,CAAA,CACnB,CAjBSH,EAAAA,EAAAA,mBAwBF,SAASW,EACZC,EAA4C,CAE5C,GAAIC,MAAMC,QAAQF,CAAAA,EAEd,OAAOZ,EAAgBY,CAAAA,EAEtB,CAED,IAAMG,EAAOC,OAAOD,KAAKH,CAAAA,EACnBK,EAAaF,EAAKG,IAAKC,GAAQP,EAAOO,CAAAA,CAAI,EAEhD,OAAOnB,EAAgBiB,CAAAA,EAAmBT,QACtCU,OAAKhB,GAAAA,CACD,IAAMkB,EAAW,CAAC,EAClBL,OAAAA,EAAKM,QAAQ,CAACF,EAAKG,IAAAA,CACfF,EAAID,CAAAA,EAAOjB,EAAQoB,CAAAA,CACvB,CAAA,EACOF,CACX,CAAA,CAAA,CAER,CACJ,CAtBgBT,EAAAA,EAAAA","names":["smp_rxjs_queue_function_exports","__export","smpRxjsQueue","__toCommonJS","import_rxjs","smpRxjsSequence","steps","results","runStep","index","length","of","defer","pipe","switchMap","value","smpRxjsQueue","source","Array","isArray","keys","Object","stepsArray","map","key","acc","forEach","i"]}
@@ -1,11 +0,0 @@
1
- import { Observable } from 'rxjs';
2
-
3
- type ObsFnMap = Record<string, () => Observable<any>>;
4
- declare function smpRxjsQueue<T extends any[]>(source: {
5
- [K in keyof T]: () => Observable<T[K]>;
6
- }): Observable<T>;
7
- declare function smpRxjsQueue<T extends ObsFnMap>(source: T): Observable<{
8
- [K in keyof T]: T[K] extends () => Observable<infer U> ? U : never;
9
- }>;
10
-
11
- export { smpRxjsQueue };
@@ -1,2 +0,0 @@
1
- "use strict";var r=Object.defineProperty;var i=Object.getOwnPropertyDescriptor;var u=Object.getOwnPropertyNames;var m=Object.prototype.hasOwnProperty;var s=(n,t)=>r(n,"name",{value:t,configurable:!0});var a=(n,t)=>{for(var o in t)r(n,o,{get:t[o],enumerable:!0})},f=(n,t,o,c)=>{if(t&&typeof t=="object"||typeof t=="function")for(let p of u(t))!m.call(n,p)&&p!==o&&r(n,p,{get:()=>t[p],enumerable:!(c=i(t,p))||c.enumerable});return n};var x=n=>f(r({},"__esModule",{value:!0}),n);var j={};a(j,{smpRxjsSequence:()=>F});module.exports=x(j);var e=require("rxjs");function F(n){return(0,e.from)(n).pipe((0,e.concatMap)(o=>o()),(0,e.toArray)())}s(F,"smpRxjsSequence");0&&(module.exports={smpRxjsSequence});
2
- //# sourceMappingURL=smp-rxjs-sequence.function.cjs.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../../../src/shared/rxjs/smp-rxjs-sequence.function.ts"],"sourcesContent":["import {concatMap, from, Observable, toArray} from \"rxjs\";\n\n/**\n * Old version of the sequence. Now rewritten using recursion, which is way faster.\n * But you can use this if you want to stick with the rxjs pattern\n * @param steps\n */\nexport function smpRxjsSequence<T extends any[]>(\n steps: { [K in keyof T]: () => Observable<T[K]> }\n): Observable<T> {\n // Cast to readonly tuple of functions to keep tuple inference\n const stepFunctions = steps as readonly (() => Observable<T[number]>)[];\n\n return from(stepFunctions).pipe(\n concatMap(step => step()),\n toArray()\n // TS loses tuple typing here, so we cast the result back to T\n // This cast is safe because we control the input and ordering\n ) as Observable<T>;\n}\n"],"mappings":"4dAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,qBAAAE,IAAA,eAAAC,EAAAH,GAAA,IAAAI,EAAmD,gBAO5C,SAASC,EACZC,EAAiD,CAKjD,SAAOC,QAFeD,CAEVE,EAAeC,QACvBC,aAAUC,GAAQA,EAAAA,CAAAA,KAClBC,WAAAA,CAAAA,CAIR,CAZgBP,EAAAA,EAAAA","names":["smp_rxjs_sequence_function_exports","__export","smpRxjsSequence","__toCommonJS","import_rxjs","smpRxjsSequence","steps","from","stepFunctions","pipe","concatMap","step","toArray"]}
@@ -1,12 +0,0 @@
1
- import { Observable } from 'rxjs';
2
-
3
- /**
4
- * Old version of the sequence. Now rewritten using recursion, which is way faster.
5
- * But you can use this if you want to stick with the rxjs pattern
6
- * @param steps
7
- */
8
- declare function smpRxjsSequence<T extends any[]>(steps: {
9
- [K in keyof T]: () => Observable<T[K]>;
10
- }): Observable<T>;
11
-
12
- export { smpRxjsSequence };
@@ -1,2 +0,0 @@
1
- "use strict";var e=Object.defineProperty;var s=Object.getOwnPropertyDescriptor;var m=Object.getOwnPropertyNames;var a=Object.prototype.hasOwnProperty;var i=(r,t)=>e(r,"name",{value:t,configurable:!0});var u=(r,t)=>{for(var o in t)e(r,o,{get:t[o],enumerable:!0})},l=(r,t,o,f)=>{if(t&&typeof t=="object"||typeof t=="function")for(let n of m(t))!a.call(r,n)&&n!==o&&e(r,n,{get:()=>t[n],enumerable:!(f=s(t,n))||f.enumerable});return r};var y=r=>l(e({},"__esModule",{value:!0}),r);var x={};u(x,{smpRxjsThrowIfEmpty:()=>c});module.exports=y(x);var p=require("rxjs");function c(r=w){return t=>t.pipe((0,p.map)(o=>{if(~d.indexOf(JSON.stringify(o)))throw r(o);return o}))}i(c,"smpRxjsThrowIfEmpty");var d=[void 0,null,!1,0,"","0",[],{}].map(r=>JSON.stringify(r)),w=i(()=>new Error,"defaultErrorFactory");0&&(module.exports={smpRxjsThrowIfEmpty});
2
- //# sourceMappingURL=smp-rxjs-throw-if-empty.function.cjs.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../../../src/shared/rxjs/smp-rxjs-throw-if-empty.function.ts"],"sourcesContent":["import {map, Observable, OperatorFunction} from \"rxjs\";\n\n/**\n * If the source observable completes emitting an empty value (empty array or object will be considered empty), it will emit\n * an error. The error will be created at that time by the optional\n * `errorFactory` argument, otherwise, the error will be {@link Error}.\n *\n * ## Example\n *\n * Throw an error if the query didn't match anything\n *\n * ```ts\n * import { of, takeUntil, timer, throwIfEmpty } from 'rxjs';\n *\n * const query$ = of([]);\n *\n * query$.pipe(\n * smpRxjsThrowIfEmpty(() => new Error('The query had no results'))\n * )\n * .subscribe({\n * next() {\n * console.log(\"The query had results\");\n * },\n * error(err) {\n * console.error(err.message);\n * }\n * });\n * ```\n *\n * @param errorFactory A factory function called to produce the\n * error to be thrown when the source observable completes without emitting a\n * value.\n * @return A function that returns an Observable that throws an error if the\n * source Observable completed without emitting.\n */\nexport function smpRxjsThrowIfEmpty<T>(errorFactory: (value: T) => any = defaultErrorFactory): OperatorFunction<T, T> {\n return (source: Observable<T>) => source.pipe(\n map(v => {\n if (~emptyValues.indexOf(JSON.stringify(v))) {\n throw errorFactory(v);\n }\n\n return v;\n })\n );\n}\n\nconst emptyValues = [void 0, null, false, 0, \"\", \"0\", [], {}].map((v) =>\n JSON.stringify(v)\n);\n\nconst defaultErrorFactory = (): Error => new Error();\n"],"mappings":"4dAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,yBAAAE,IAAA,eAAAC,EAAAH,GAAA,IAAAI,EAAgD,gBAmCzC,SAASC,EAAuBC,EAAkCC,EAAmB,CACxF,OAAQC,GAA0BA,EAAOC,QACrCC,OAAIC,GAAAA,CACA,GAAI,CAACC,EAAYC,QAAQC,KAAKC,UAAUJ,CAAAA,CAAAA,EACpC,MAAML,EAAaK,CAAAA,EAGvB,OAAOA,CACX,CAAA,CAAA,CAER,CAVgBN,EAAAA,EAAAA,uBAYhB,IAAMO,EAAc,CAAC,OAAQ,KAAM,GAAO,EAAG,GAAI,IAAK,CAAA,EAAI,CAAC,GAAGF,IAAKC,GAC/DG,KAAKC,UAAUJ,CAAAA,CAAAA,EAGbJ,EAAsBS,EAAA,IAAa,IAAIC,MAAjB","names":["smp_rxjs_throw_if_empty_function_exports","__export","smpRxjsThrowIfEmpty","__toCommonJS","import_rxjs","smpRxjsThrowIfEmpty","errorFactory","defaultErrorFactory","source","pipe","map","v","emptyValues","indexOf","JSON","stringify","__name","Error"]}
@@ -1,38 +0,0 @@
1
- import { OperatorFunction } from 'rxjs';
2
-
3
- /**
4
- * If the source observable completes emitting an empty value (empty array or object will be considered empty), it will emit
5
- * an error. The error will be created at that time by the optional
6
- * `errorFactory` argument, otherwise, the error will be {@link Error}.
7
- *
8
- * ## Example
9
- *
10
- * Throw an error if the query didn't match anything
11
- *
12
- * ```ts
13
- * import { of, takeUntil, timer, throwIfEmpty } from 'rxjs';
14
- *
15
- * const query$ = of([]);
16
- *
17
- * query$.pipe(
18
- * smpRxjsThrowIfEmpty(() => new Error('The query had no results'))
19
- * )
20
- * .subscribe({
21
- * next() {
22
- * console.log("The query had results");
23
- * },
24
- * error(err) {
25
- * console.error(err.message);
26
- * }
27
- * });
28
- * ```
29
- *
30
- * @param errorFactory A factory function called to produce the
31
- * error to be thrown when the source observable completes without emitting a
32
- * value.
33
- * @return A function that returns an Observable that throws an error if the
34
- * source Observable completed without emitting.
35
- */
36
- declare function smpRxjsThrowIfEmpty<T>(errorFactory?: (value: T) => any): OperatorFunction<T, T>;
37
-
38
- export { smpRxjsThrowIfEmpty };
@@ -1,2 +0,0 @@
1
- "use strict";var n=Object.defineProperty;var u=Object.getOwnPropertyDescriptor;var a=Object.getOwnPropertyNames;var l=Object.prototype.hasOwnProperty;var f=(r,t)=>n(r,"name",{value:t,configurable:!0});var y=(r,t)=>{for(var o in t)n(r,o,{get:t[o],enumerable:!0})},x=(r,t,o,i)=>{if(t&&typeof t=="object"||typeof t=="function")for(let p of a(t))!l.call(r,p)&&p!==o&&n(r,p,{get:()=>t[p],enumerable:!(i=u(t,p))||i.enumerable});return r};var c=r=>x(n({},"__esModule",{value:!0}),r);var h={};y(h,{smpRxjsThrowOnCondition:()=>E});module.exports=c(h);var e=require("rxjs");var m=require("rxjs");function s(r=w){return t=>t.pipe((0,m.map)(o=>{if(~d.indexOf(JSON.stringify(o)))throw r(o);return o}))}f(s,"smpRxjsThrowIfEmpty");var d=[void 0,null,!1,0,"","0",[],{}].map(r=>JSON.stringify(r)),w=f(()=>new Error,"defaultErrorFactory");function E(r,t){return o=>o.pipe((0,e.filter)(i=>!r(i)),(0,e.defaultIfEmpty)(!1),s(t))}f(E,"smpRxjsThrowOnCondition");0&&(module.exports={smpRxjsThrowOnCondition});
2
- //# sourceMappingURL=smp-rxjs-throw-on-condition.function.cjs.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../../../src/shared/rxjs/smp-rxjs-throw-on-condition.function.ts","../../../../src/shared/rxjs/smp-rxjs-throw-if-empty.function.ts"],"sourcesContent":["import {defaultIfEmpty, filter, Observable, OperatorFunction} from \"rxjs\";\n//\nimport {smpRxjsThrowIfEmpty} from \"./smp-rxjs-throw-if-empty.function.js\";\n\n/**\n * Custom RxJS operator that filters the source observable based on a condition\n * and throws an error if the resulting observable is empty.\n *\n * @template T The type of items emitted by the source observable.\n * @param {function(T): boolean} condition - A function that takes a value from the source observable and returns a boolean.\n * If the function returns `true`, the value will be emitted; otherwise, it will be filtered out.\n * @param {function(): Error} [errorFactory] - An optional function that returns an error to be thrown if the resulting observable is empty.\n * If not provided, a default error will be thrown.\n * @returns {OperatorFunction<T, T>} An operator function that can be used in the RxJS pipeline.\n *\n * @example\n * import { of } from 'rxjs';\n * import { smpRxjsThrowOnCondition } from \"./path-to-your-file\";\n *\n * const source$ = of(1, 5, -3, 7, 12).pipe(\n * smpRxjsThrowOnCondition(value => value >= 0, () => new Error(\"Value is less than 0\")),\n * smpRxjsThrowOnCondition(value => value > 12, () => new Error(\"Value is lower than 12\"))\n * );\n *\n * source$.subscribe({\n * next: value => console.log(\"Value:\", value),\n * error: err => console.error(\"Error:\", err)\n * });\n */\nexport function smpRxjsThrowOnCondition<T>(\n condition: (value: T) => boolean,\n errorFactory?: () => any\n): OperatorFunction<T, T> {\n return (source: Observable<T>) =>\n source.pipe(\n filter((v: T) => !condition(v)), // Invert the condition because if I need to throw on that condition we should filter all that don't match\n defaultIfEmpty(false as unknown as T), // We nuke type errors, cause when falsy smpRxjsThrowIfEmpty will throw\n smpRxjsThrowIfEmpty(errorFactory)\n );\n}\n","import {map, Observable, OperatorFunction} from \"rxjs\";\n\n/**\n * If the source observable completes emitting an empty value (empty array or object will be considered empty), it will emit\n * an error. The error will be created at that time by the optional\n * `errorFactory` argument, otherwise, the error will be {@link Error}.\n *\n * ## Example\n *\n * Throw an error if the query didn't match anything\n *\n * ```ts\n * import { of, takeUntil, timer, throwIfEmpty } from 'rxjs';\n *\n * const query$ = of([]);\n *\n * query$.pipe(\n * smpRxjsThrowIfEmpty(() => new Error('The query had no results'))\n * )\n * .subscribe({\n * next() {\n * console.log(\"The query had results\");\n * },\n * error(err) {\n * console.error(err.message);\n * }\n * });\n * ```\n *\n * @param errorFactory A factory function called to produce the\n * error to be thrown when the source observable completes without emitting a\n * value.\n * @return A function that returns an Observable that throws an error if the\n * source Observable completed without emitting.\n */\nexport function smpRxjsThrowIfEmpty<T>(errorFactory: (value: T) => any = defaultErrorFactory): OperatorFunction<T, T> {\n return (source: Observable<T>) => source.pipe(\n map(v => {\n if (~emptyValues.indexOf(JSON.stringify(v))) {\n throw errorFactory(v);\n }\n\n return v;\n })\n );\n}\n\nconst emptyValues = [void 0, null, false, 0, \"\", \"0\", [], {}].map((v) =>\n JSON.stringify(v)\n);\n\nconst defaultErrorFactory = (): Error => new Error();\n"],"mappings":"4dAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,6BAAAE,IAAA,eAAAC,EAAAH,GAAA,IAAAI,EAAmE,gBCAnE,IAAAC,EAAgD,gBAmCzC,SAASC,EAAuBC,EAAkCC,EAAmB,CACxF,OAAQC,GAA0BA,EAAOC,QACrCC,OAAIC,GAAAA,CACA,GAAI,CAACC,EAAYC,QAAQC,KAAKC,UAAUJ,CAAAA,CAAAA,EACpC,MAAML,EAAaK,CAAAA,EAGvB,OAAOA,CACX,CAAA,CAAA,CAER,CAVgBN,EAAAA,EAAAA,uBAYhB,IAAMO,EAAc,CAAC,OAAQ,KAAM,GAAO,EAAG,GAAI,IAAK,CAAA,EAAI,CAAC,GAAGF,IAAKC,GAC/DG,KAAKC,UAAUJ,CAAAA,CAAAA,EAGbJ,EAAsBS,EAAA,IAAa,IAAIC,MAAjB,uBDtBrB,SAASC,EACZC,EACAC,EAAwB,CAExB,OAAQC,GACJA,EAAOC,QACHC,UAAQC,GAAS,CAACL,EAAUK,CAAAA,CAAAA,KAC5BC,kBAAe,EAAA,EACfC,EAAoBN,CAAAA,CAAAA,CAEhC,CAVgBF,EAAAA,EAAAA","names":["smp_rxjs_throw_on_condition_function_exports","__export","smpRxjsThrowOnCondition","__toCommonJS","import_rxjs","import_rxjs","smpRxjsThrowIfEmpty","errorFactory","defaultErrorFactory","source","pipe","map","v","emptyValues","indexOf","JSON","stringify","__name","Error","smpRxjsThrowOnCondition","condition","errorFactory","source","pipe","filter","v","defaultIfEmpty","smpRxjsThrowIfEmpty"]}
@@ -1,30 +0,0 @@
1
- import { OperatorFunction } from 'rxjs';
2
-
3
- /**
4
- * Custom RxJS operator that filters the source observable based on a condition
5
- * and throws an error if the resulting observable is empty.
6
- *
7
- * @template T The type of items emitted by the source observable.
8
- * @param {function(T): boolean} condition - A function that takes a value from the source observable and returns a boolean.
9
- * If the function returns `true`, the value will be emitted; otherwise, it will be filtered out.
10
- * @param {function(): Error} [errorFactory] - An optional function that returns an error to be thrown if the resulting observable is empty.
11
- * If not provided, a default error will be thrown.
12
- * @returns {OperatorFunction<T, T>} An operator function that can be used in the RxJS pipeline.
13
- *
14
- * @example
15
- * import { of } from 'rxjs';
16
- * import { smpRxjsThrowOnCondition } from "./path-to-your-file";
17
- *
18
- * const source$ = of(1, 5, -3, 7, 12).pipe(
19
- * smpRxjsThrowOnCondition(value => value >= 0, () => new Error("Value is less than 0")),
20
- * smpRxjsThrowOnCondition(value => value > 12, () => new Error("Value is lower than 12"))
21
- * );
22
- *
23
- * source$.subscribe({
24
- * next: value => console.log("Value:", value),
25
- * error: err => console.error("Error:", err)
26
- * });
27
- */
28
- declare function smpRxjsThrowOnCondition<T>(condition: (value: T) => boolean, errorFactory?: () => any): OperatorFunction<T, T>;
29
-
30
- export { smpRxjsThrowOnCondition };
@@ -1,2 +0,0 @@
1
- "use strict";var p=Object.defineProperty;var u=Object.getOwnPropertyDescriptor;var w=Object.getOwnPropertyNames;var l=Object.prototype.hasOwnProperty;var i=(r,e)=>p(r,"name",{value:e,configurable:!0});var x=(r,e)=>{for(var t in e)p(r,t,{get:e[t],enumerable:!0})},d=(r,e,t,s)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of w(e))!l.call(r,o)&&o!==t&&p(r,o,{get:()=>e[o],enumerable:!(s=u(e,o))||s.enumerable});return r};var g=r=>d(p({},"__esModule",{value:!0}),r);var R={};x(R,{SmpAbstractCacheStrategy:()=>h,SmpAbstractTtlCacheStrategy:()=>a,SmpBrowserCache:()=>c,SmpInMemoryCache:()=>f,smpIsSmpCachedValue:()=>n});module.exports=g(R);var h=class{static{i(this,"SmpAbstractCacheStrategy")}};var _=require("ts-luxon");function n(r){return typeof r=="object"&&r!==null&&"value"in r&&"expiry"in r&&typeof r.expiry=="number"}i(n,"smpIsSmpCachedValue");var a=class extends h{static{i(this,"SmpAbstractTtlCacheStrategy")}flush(){this._flushRaw()}read(e){let t=this._readRaw(e);if(this._isSmpCachedValue(t)){if(t.expiry>=_.DateTime.now().ts)return t.value;this._removeRaw(e);return}return t}remove(e){this._removeRaw(e)}write(e,t,s){if(isNaN(+s)||+s<=0){this._writeRaw(e,t,s);return}let o=_.DateTime.now().ts+s*1e3,m={value:t,expiry:o};this._writeRaw(e,m,s)}_isSmpCachedValue(e){return n(e)}};var c=class extends a{static{i(this,"SmpBrowserCache")}_storage;_prefix;constructor(e,t){super(),this._storage=e,this._prefix=t}_flushRaw(){let e=[],t=-1;for(;++t<this._storage.length;){let s=this._storage.key(t);s&&s.startsWith(this._prefix)&&e.push(s)}for(t=-1;++t<e.length;)this._storage.removeItem(e[t])}_readRaw(e){let t=this._storage.getItem(this._prefix+e);try{return t?JSON.parse(t):void 0}catch{console.warn(`${this.constructor.name}: failed to parse cache item for key ${this._prefix+e}`);return}}_removeRaw(e){this._storage.removeItem(this._prefix+e)}_writeRaw(e,t){try{this._storage.setItem(this._prefix+e,JSON.stringify(t))}catch(s){console.warn(`${this.constructor.name}: failed to write cache item for key ${this._prefix+e}`,s)}}};var f=class extends a{static{i(this,"SmpInMemoryCache")}static _storage=new Map;get _staticSelf(){return this.constructor}_flushRaw(){this._staticSelf._storage.clear()}_readRaw(e){return this._staticSelf._storage.get(e)}_removeRaw(e){this._staticSelf._storage.delete(e)}_writeRaw(e,t){this._staticSelf._storage.set(e,t)}};0&&(module.exports={SmpAbstractCacheStrategy,SmpAbstractTtlCacheStrategy,SmpBrowserCache,SmpInMemoryCache,smpIsSmpCachedValue});
2
- //# sourceMappingURL=index.cjs.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../../../../src/shared/utils/cache/index.ts","../../../../../src/shared/utils/cache/smp-abstract-cache-strategy.class.ts","../../../../../src/shared/utils/cache/smp-abstract-ttl-cache-strategy.class.ts","../../../../../src/shared/utils/cache/smp-is-smp-cached-value.function.ts","../../../../../src/shared/utils/cache/smp-browser-cache.class.ts","../../../../../src/shared/utils/cache/smp-in-memory-cache.class.ts"],"sourcesContent":["export * from \"./smp-abstract-cache-strategy.class.js\";\nexport * from \"./smp-abstract-ttl-cache-strategy.class.js\";\nexport * from \"./smp-browser-cache.class.js\";\nexport * from \"./smp-cached-value.interface.js\";\nexport * from \"./smp-in-memory-cache.class.js\";\nexport * from \"./smp-is-smp-cached-value.function.js\";\n","import {Observable} from \"rxjs\";\n\n/**\n * Abstract class representing a caching strategy. This class is intended to be extended by concrete implementations\n * and provides an interface for performing common caching operations such as reading, writing, removing, and flushing cache entries.\n * You shouldn't need to implement this: you can go with SmpAbstractTtlCacheStrategy or SmpRxjsAbstractCacheStrategy, depending on what type of cache you want to implement.\n * For instance, for a local cache, you may stay sync, while for a Valkey cache, you should start with the rxjs.\n */\nexport abstract class SmpAbstractCacheStrategy {\n abstract read<T = unknown>(key: string): T | undefined | Observable<T | undefined>;\n\n abstract write<T = unknown>(key: string, value: T, ttl?: number): void | Observable<void>;\n\n abstract remove(key: string): void | Observable<void>;\n\n abstract flush(): void | Observable<void>;\n}\n","import {DateTime} from \"ts-luxon\";\n//\nimport {SmpAbstractCacheStrategy} from \"./smp-abstract-cache-strategy.class.js\";\nimport {SmpCachedValue} from \"./smp-cached-value.interface.js\";\nimport {smpIsSmpCachedValue} from \"./smp-is-smp-cached-value.function.js\";\n\nexport abstract class SmpAbstractTtlCacheStrategy extends SmpAbstractCacheStrategy {\n\n protected abstract _flushRaw(): void;\n\n protected abstract _readRaw(key: string): unknown | undefined;\n\n protected abstract _removeRaw(key: string): void;\n\n protected abstract _writeRaw(key: string, value: unknown, ttl?: number): void;\n\n flush(): void {\n this._flushRaw();\n }\n\n read<T = unknown>(key: string): T | undefined {\n const storedValue = this._readRaw(key);\n if (this._isSmpCachedValue<T>(storedValue)) {\n if (storedValue.expiry >= DateTime.now().ts) {\n return storedValue.value as T;\n }\n this._removeRaw(key);\n\n return void 0;\n }\n return storedValue as T | undefined;\n }\n\n remove(key: string): void {\n this._removeRaw(key);\n }\n\n\n write<T = unknown>(key: string, value: T, ttl?: number): void {\n if (isNaN(+ttl!) || +ttl! <= 0) {\n this._writeRaw(key, value, ttl);\n return;\n }\n const expiry = DateTime.now().ts + ttl! * 1000;\n const wrappedValue: SmpCachedValue<T> = {\n value: value,\n expiry: expiry\n };\n this._writeRaw(key, wrappedValue, ttl);\n }\n\n protected _isSmpCachedValue<T>(value: unknown): value is SmpCachedValue<T> {\n return smpIsSmpCachedValue(value);\n }\n}\n","import {SmpCachedValue} from \"./smp-cached-value.interface.js\";\n\n/**\n * Tells you if a value is a SmpCachedValue\n * @param value\n */\nexport function smpIsSmpCachedValue<T>(value: unknown): value is SmpCachedValue<T> {\n return (\n typeof value === \"object\" &&\n value !== null &&\n \"value\" in value &&\n \"expiry\" in value &&\n typeof (value as any).expiry === \"number\"\n );\n}\n","import {SmpAbstractTtlCacheStrategy} from \"./smp-abstract-ttl-cache-strategy.class.js\";\n\nexport class SmpBrowserCache extends SmpAbstractTtlCacheStrategy {\n\n constructor(protected _storage: typeof localStorage | typeof sessionStorage,\n protected _prefix: string) {\n super();\n }\n\n protected _flushRaw(): void {\n const keysToRemove: string[] = [];\n let i = -1;\n while (++i < this._storage.length) {\n const key = this._storage.key(i);\n if (key && key.startsWith(this._prefix)) {\n keysToRemove.push(key);\n }\n }\n i = -1;\n while (++i < keysToRemove.length) {\n this._storage.removeItem(keysToRemove[i]);\n }\n }\n\n protected _readRaw(key: string): unknown | undefined {\n const raw = this._storage.getItem(this._prefix + key);\n try {\n return raw ? JSON.parse(raw) : undefined;\n }\n catch {\n console.warn(`${this.constructor.name}: failed to parse cache item for key ${this._prefix + key}`);\n\n return void 0;\n }\n }\n\n protected _removeRaw(key: string): void {\n this._storage.removeItem(this._prefix + key);\n }\n\n protected _writeRaw(key: string, value: unknown): void {\n try {\n this._storage.setItem(this._prefix + key, JSON.stringify(value));\n }\n catch (e) {\n console.warn(`${this.constructor.name}: failed to write cache item for key ${this._prefix + key}`, e);\n }\n }\n\n}\n\n\n","import {SmpAbstractTtlCacheStrategy} from \"./smp-abstract-ttl-cache-strategy.class.js\";\n\nexport class SmpInMemoryCache extends SmpAbstractTtlCacheStrategy {\n\n private static _storage = new Map<string, unknown>();\n\n protected get _staticSelf(): typeof SmpInMemoryCache {\n return (this.constructor as typeof SmpInMemoryCache);\n }\n\n protected _flushRaw(): void {\n this._staticSelf._storage.clear();\n }\n\n protected _readRaw(key: string): unknown | undefined {\n return this._staticSelf._storage.get(key);\n }\n\n protected _removeRaw(key: string): void {\n this._staticSelf._storage.delete(key);\n }\n\n protected _writeRaw(key: string, value: unknown): void {\n this._staticSelf._storage.set(key, value);\n }\n\n}\n"],"mappings":"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","names":["cache_exports","__export","SmpAbstractCacheStrategy","SmpAbstractTtlCacheStrategy","SmpBrowserCache","SmpInMemoryCache","smpIsSmpCachedValue","__toCommonJS","SmpAbstractCacheStrategy","import_ts_luxon","smpIsSmpCachedValue","value","expiry","SmpAbstractTtlCacheStrategy","SmpAbstractCacheStrategy","flush","_flushRaw","read","key","storedValue","_readRaw","_isSmpCachedValue","expiry","DateTime","now","ts","value","_removeRaw","remove","write","ttl","isNaN","_writeRaw","wrappedValue","smpIsSmpCachedValue","SmpBrowserCache","SmpAbstractTtlCacheStrategy","_storage","_prefix","_flushRaw","keysToRemove","i","length","key","startsWith","push","removeItem","_readRaw","raw","getItem","JSON","parse","undefined","console","warn","name","_removeRaw","_writeRaw","value","setItem","stringify","e","SmpInMemoryCache","SmpAbstractTtlCacheStrategy","_storage","Map","_staticSelf","_flushRaw","clear","_readRaw","key","get","_removeRaw","delete","_writeRaw","value","set"]}
@@ -1,7 +0,0 @@
1
- export { SmpAbstractCacheStrategy } from './smp-abstract-cache-strategy.class.cjs';
2
- export { SmpAbstractTtlCacheStrategy } from './smp-abstract-ttl-cache-strategy.class.cjs';
3
- export { SmpBrowserCache } from './smp-browser-cache.class.cjs';
4
- export { SmpCachedValue } from './smp-cached-value.interface.cjs';
5
- export { SmpInMemoryCache } from './smp-in-memory-cache.class.cjs';
6
- export { smpIsSmpCachedValue } from './smp-is-smp-cached-value.function.cjs';
7
- import 'rxjs';
@@ -1,2 +0,0 @@
1
- "use strict";var d=Object.defineProperty;var k=Object.getOwnPropertyDescriptor;var n=Object.getOwnPropertyNames;var p=Object.prototype.hasOwnProperty;var j=(o,l)=>d(o,"name",{value:l,configurable:!0});var q=(o,l)=>{for(var x in l)d(o,x,{get:l[x],enumerable:!0})},u=(o,l,x,i)=>{if(l&&typeof l=="object"||typeof l=="function")for(let s of n(l))!p.call(o,s)&&s!==x&&d(o,s,{get:()=>l[s],enumerable:!(i=k(l,s))||i.enumerable});return o};var v=o=>u(d({},"__esModule",{value:!0}),o);var w={};q(w,{SmpAbstractCacheStrategy:()=>f});module.exports=v(w);var f=class{static{j(this,"SmpAbstractCacheStrategy")}};0&&(module.exports={SmpAbstractCacheStrategy});
2
- //# sourceMappingURL=smp-abstract-cache-strategy.class.cjs.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../../../../src/shared/utils/cache/smp-abstract-cache-strategy.class.ts"],"sourcesContent":["import {Observable} from \"rxjs\";\n\n/**\n * Abstract class representing a caching strategy. This class is intended to be extended by concrete implementations\n * and provides an interface for performing common caching operations such as reading, writing, removing, and flushing cache entries.\n * You shouldn't need to implement this: you can go with SmpAbstractTtlCacheStrategy or SmpRxjsAbstractCacheStrategy, depending on what type of cache you want to implement.\n * For instance, for a local cache, you may stay sync, while for a Valkey cache, you should start with the rxjs.\n */\nexport abstract class SmpAbstractCacheStrategy {\n abstract read<T = unknown>(key: string): T | undefined | Observable<T | undefined>;\n\n abstract write<T = unknown>(key: string, value: T, ttl?: number): void | Observable<void>;\n\n abstract remove(key: string): void | Observable<void>;\n\n abstract flush(): void | Observable<void>;\n}\n"],"mappings":"4dAEA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,8BAAAE,IAAA,eAAAC,EAAAH,GAMO,IAAeI,EAAf,KAAeA,CANtB,MAMsBA,CAAAA,EAAAA,iCAQtB","names":["smp_abstract_cache_strategy_class_exports","__export","SmpAbstractCacheStrategy","__toCommonJS","SmpAbstractCacheStrategy"]}
@@ -1,16 +0,0 @@
1
- import { Observable } from 'rxjs';
2
-
3
- /**
4
- * Abstract class representing a caching strategy. This class is intended to be extended by concrete implementations
5
- * and provides an interface for performing common caching operations such as reading, writing, removing, and flushing cache entries.
6
- * You shouldn't need to implement this: you can go with SmpAbstractTtlCacheStrategy or SmpRxjsAbstractCacheStrategy, depending on what type of cache you want to implement.
7
- * For instance, for a local cache, you may stay sync, while for a Valkey cache, you should start with the rxjs.
8
- */
9
- declare abstract class SmpAbstractCacheStrategy {
10
- abstract read<T = unknown>(key: string): T | undefined | Observable<T | undefined>;
11
- abstract write<T = unknown>(key: string, value: T, ttl?: number): void | Observable<void>;
12
- abstract remove(key: string): void | Observable<void>;
13
- abstract flush(): void | Observable<void>;
14
- }
15
-
16
- export { SmpAbstractCacheStrategy };
@@ -1,2 +0,0 @@
1
- "use strict";var p=Object.defineProperty;var w=Object.getOwnPropertyDescriptor;var f=Object.getOwnPropertyNames;var d=Object.prototype.hasOwnProperty;var t=(r,e)=>p(r,"name",{value:e,configurable:!0});var c=(r,e)=>{for(var i in e)p(r,i,{get:e[i],enumerable:!0})},x=(r,e,i,s)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of f(e))!d.call(r,o)&&o!==i&&p(r,o,{get:()=>e[o],enumerable:!(s=w(e,o))||s.enumerable});return r};var _=r=>x(p({},"__esModule",{value:!0}),r);var R={};c(R,{SmpAbstractTtlCacheStrategy:()=>m});module.exports=_(R);var n=require("ts-luxon");var a=class{static{t(this,"SmpAbstractCacheStrategy")}};function u(r){return typeof r=="object"&&r!==null&&"value"in r&&"expiry"in r&&typeof r.expiry=="number"}t(u,"smpIsSmpCachedValue");var m=class extends a{static{t(this,"SmpAbstractTtlCacheStrategy")}flush(){this._flushRaw()}read(e){let i=this._readRaw(e);if(this._isSmpCachedValue(i)){if(i.expiry>=n.DateTime.now().ts)return i.value;this._removeRaw(e);return}return i}remove(e){this._removeRaw(e)}write(e,i,s){if(isNaN(+s)||+s<=0){this._writeRaw(e,i,s);return}let o=n.DateTime.now().ts+s*1e3,h={value:i,expiry:o};this._writeRaw(e,h,s)}_isSmpCachedValue(e){return u(e)}};0&&(module.exports={SmpAbstractTtlCacheStrategy});
2
- //# sourceMappingURL=smp-abstract-ttl-cache-strategy.class.cjs.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../../../../src/shared/utils/cache/smp-abstract-ttl-cache-strategy.class.ts","../../../../../src/shared/utils/cache/smp-abstract-cache-strategy.class.ts","../../../../../src/shared/utils/cache/smp-is-smp-cached-value.function.ts"],"sourcesContent":["import {DateTime} from \"ts-luxon\";\n//\nimport {SmpAbstractCacheStrategy} from \"./smp-abstract-cache-strategy.class.js\";\nimport {SmpCachedValue} from \"./smp-cached-value.interface.js\";\nimport {smpIsSmpCachedValue} from \"./smp-is-smp-cached-value.function.js\";\n\nexport abstract class SmpAbstractTtlCacheStrategy extends SmpAbstractCacheStrategy {\n\n protected abstract _flushRaw(): void;\n\n protected abstract _readRaw(key: string): unknown | undefined;\n\n protected abstract _removeRaw(key: string): void;\n\n protected abstract _writeRaw(key: string, value: unknown, ttl?: number): void;\n\n flush(): void {\n this._flushRaw();\n }\n\n read<T = unknown>(key: string): T | undefined {\n const storedValue = this._readRaw(key);\n if (this._isSmpCachedValue<T>(storedValue)) {\n if (storedValue.expiry >= DateTime.now().ts) {\n return storedValue.value as T;\n }\n this._removeRaw(key);\n\n return void 0;\n }\n return storedValue as T | undefined;\n }\n\n remove(key: string): void {\n this._removeRaw(key);\n }\n\n\n write<T = unknown>(key: string, value: T, ttl?: number): void {\n if (isNaN(+ttl!) || +ttl! <= 0) {\n this._writeRaw(key, value, ttl);\n return;\n }\n const expiry = DateTime.now().ts + ttl! * 1000;\n const wrappedValue: SmpCachedValue<T> = {\n value: value,\n expiry: expiry\n };\n this._writeRaw(key, wrappedValue, ttl);\n }\n\n protected _isSmpCachedValue<T>(value: unknown): value is SmpCachedValue<T> {\n return smpIsSmpCachedValue(value);\n }\n}\n","import {Observable} from \"rxjs\";\n\n/**\n * Abstract class representing a caching strategy. This class is intended to be extended by concrete implementations\n * and provides an interface for performing common caching operations such as reading, writing, removing, and flushing cache entries.\n * You shouldn't need to implement this: you can go with SmpAbstractTtlCacheStrategy or SmpRxjsAbstractCacheStrategy, depending on what type of cache you want to implement.\n * For instance, for a local cache, you may stay sync, while for a Valkey cache, you should start with the rxjs.\n */\nexport abstract class SmpAbstractCacheStrategy {\n abstract read<T = unknown>(key: string): T | undefined | Observable<T | undefined>;\n\n abstract write<T = unknown>(key: string, value: T, ttl?: number): void | Observable<void>;\n\n abstract remove(key: string): void | Observable<void>;\n\n abstract flush(): void | Observable<void>;\n}\n","import {SmpCachedValue} from \"./smp-cached-value.interface.js\";\n\n/**\n * Tells you if a value is a SmpCachedValue\n * @param value\n */\nexport function smpIsSmpCachedValue<T>(value: unknown): value is SmpCachedValue<T> {\n return (\n typeof value === \"object\" &&\n value !== null &&\n \"value\" in value &&\n \"expiry\" in value &&\n typeof (value as any).expiry === \"number\"\n );\n}\n"],"mappings":"4dAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,iCAAAE,IAAA,eAAAC,EAAAH,GAAA,IAAAI,EAAuB,oBCQhB,IAAeC,EAAf,KAAeA,CANtB,MAMsBA,CAAAA,EAAAA,iCAQtB,ECVO,SAASC,EAAuBC,EAAc,CACjD,OACI,OAAOA,GAAU,UACjBA,IAAU,MACV,UAAWA,GACX,WAAYA,GACZ,OAAQA,EAAcC,QAAW,QAEzC,CARgBF,EAAAA,EAAAA,uBFAT,IAAeG,EAAf,cAAmDC,CAAAA,CAN1D,MAM0DA,CAAAA,EAAAA,oCAUtDC,OAAc,CACV,KAAKC,UAAS,CAClB,CAEAC,KAAkBC,EAA4B,CAC1C,IAAMC,EAAc,KAAKC,SAASF,CAAAA,EAClC,GAAI,KAAKG,kBAAqBF,CAAAA,EAAc,CACxC,GAAIA,EAAYG,QAAUC,WAASC,IAAG,EAAGC,GACrC,OAAON,EAAYO,MAEvB,KAAKC,WAAWT,CAAAA,EAEhB,MACJ,CACA,OAAOC,CACX,CAEAS,OAAOV,EAAmB,CACtB,KAAKS,WAAWT,CAAAA,CACpB,CAGAW,MAAmBX,EAAaQ,EAAUI,EAAoB,CAC1D,GAAIC,MAAM,CAACD,CAAAA,GAAS,CAACA,GAAQ,EAAG,CAC5B,KAAKE,UAAUd,EAAKQ,EAAOI,CAAAA,EAC3B,MACJ,CACA,IAAMR,EAASC,WAASC,IAAG,EAAGC,GAAKK,EAAO,IACpCG,EAAkC,CACpCP,MAAOA,EACPJ,OAAQA,CACZ,EACA,KAAKU,UAAUd,EAAKe,EAAcH,CAAAA,CACtC,CAEUT,kBAAqBK,EAA4C,CACvE,OAAOQ,EAAoBR,CAAAA,CAC/B,CACJ","names":["smp_abstract_ttl_cache_strategy_class_exports","__export","SmpAbstractTtlCacheStrategy","__toCommonJS","import_ts_luxon","SmpAbstractCacheStrategy","smpIsSmpCachedValue","value","expiry","SmpAbstractTtlCacheStrategy","SmpAbstractCacheStrategy","flush","_flushRaw","read","key","storedValue","_readRaw","_isSmpCachedValue","expiry","DateTime","now","ts","value","_removeRaw","remove","write","ttl","isNaN","_writeRaw","wrappedValue","smpIsSmpCachedValue"]}
@@ -1,17 +0,0 @@
1
- import { SmpAbstractCacheStrategy } from './smp-abstract-cache-strategy.class.cjs';
2
- import { SmpCachedValue } from './smp-cached-value.interface.cjs';
3
- import 'rxjs';
4
-
5
- declare abstract class SmpAbstractTtlCacheStrategy extends SmpAbstractCacheStrategy {
6
- protected abstract _flushRaw(): void;
7
- protected abstract _readRaw(key: string): unknown | undefined;
8
- protected abstract _removeRaw(key: string): void;
9
- protected abstract _writeRaw(key: string, value: unknown, ttl?: number): void;
10
- flush(): void;
11
- read<T = unknown>(key: string): T | undefined;
12
- remove(key: string): void;
13
- write<T = unknown>(key: string, value: T, ttl?: number): void;
14
- protected _isSmpCachedValue<T>(value: unknown): value is SmpCachedValue<T>;
15
- }
16
-
17
- export { SmpAbstractTtlCacheStrategy };
@@ -1,2 +0,0 @@
1
- "use strict";var a=Object.defineProperty;var _=Object.getOwnPropertyDescriptor;var u=Object.getOwnPropertyNames;var w=Object.prototype.hasOwnProperty;var i=(r,e)=>a(r,"name",{value:e,configurable:!0});var x=(r,e)=>{for(var t in e)a(r,t,{get:e[t],enumerable:!0})},d=(r,e,t,s)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of u(e))!w.call(r,o)&&o!==t&&a(r,o,{get:()=>e[o],enumerable:!(s=_(e,o))||s.enumerable});return r};var l=r=>d(a({},"__esModule",{value:!0}),r);var g={};x(g,{SmpBrowserCache:()=>c});module.exports=l(g);var p=require("ts-luxon");var h=class{static{i(this,"SmpAbstractCacheStrategy")}};function m(r){return typeof r=="object"&&r!==null&&"value"in r&&"expiry"in r&&typeof r.expiry=="number"}i(m,"smpIsSmpCachedValue");var n=class extends h{static{i(this,"SmpAbstractTtlCacheStrategy")}flush(){this._flushRaw()}read(e){let t=this._readRaw(e);if(this._isSmpCachedValue(t)){if(t.expiry>=p.DateTime.now().ts)return t.value;this._removeRaw(e);return}return t}remove(e){this._removeRaw(e)}write(e,t,s){if(isNaN(+s)||+s<=0){this._writeRaw(e,t,s);return}let o=p.DateTime.now().ts+s*1e3,f={value:t,expiry:o};this._writeRaw(e,f,s)}_isSmpCachedValue(e){return m(e)}};var c=class extends n{static{i(this,"SmpBrowserCache")}_storage;_prefix;constructor(e,t){super(),this._storage=e,this._prefix=t}_flushRaw(){let e=[],t=-1;for(;++t<this._storage.length;){let s=this._storage.key(t);s&&s.startsWith(this._prefix)&&e.push(s)}for(t=-1;++t<e.length;)this._storage.removeItem(e[t])}_readRaw(e){let t=this._storage.getItem(this._prefix+e);try{return t?JSON.parse(t):void 0}catch{console.warn(`${this.constructor.name}: failed to parse cache item for key ${this._prefix+e}`);return}}_removeRaw(e){this._storage.removeItem(this._prefix+e)}_writeRaw(e,t){try{this._storage.setItem(this._prefix+e,JSON.stringify(t))}catch(s){console.warn(`${this.constructor.name}: failed to write cache item for key ${this._prefix+e}`,s)}}};0&&(module.exports={SmpBrowserCache});
2
- //# sourceMappingURL=smp-browser-cache.class.cjs.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../../../../src/shared/utils/cache/smp-browser-cache.class.ts","../../../../../src/shared/utils/cache/smp-abstract-ttl-cache-strategy.class.ts","../../../../../src/shared/utils/cache/smp-abstract-cache-strategy.class.ts","../../../../../src/shared/utils/cache/smp-is-smp-cached-value.function.ts"],"sourcesContent":["import {SmpAbstractTtlCacheStrategy} from \"./smp-abstract-ttl-cache-strategy.class.js\";\n\nexport class SmpBrowserCache extends SmpAbstractTtlCacheStrategy {\n\n constructor(protected _storage: typeof localStorage | typeof sessionStorage,\n protected _prefix: string) {\n super();\n }\n\n protected _flushRaw(): void {\n const keysToRemove: string[] = [];\n let i = -1;\n while (++i < this._storage.length) {\n const key = this._storage.key(i);\n if (key && key.startsWith(this._prefix)) {\n keysToRemove.push(key);\n }\n }\n i = -1;\n while (++i < keysToRemove.length) {\n this._storage.removeItem(keysToRemove[i]);\n }\n }\n\n protected _readRaw(key: string): unknown | undefined {\n const raw = this._storage.getItem(this._prefix + key);\n try {\n return raw ? JSON.parse(raw) : undefined;\n }\n catch {\n console.warn(`${this.constructor.name}: failed to parse cache item for key ${this._prefix + key}`);\n\n return void 0;\n }\n }\n\n protected _removeRaw(key: string): void {\n this._storage.removeItem(this._prefix + key);\n }\n\n protected _writeRaw(key: string, value: unknown): void {\n try {\n this._storage.setItem(this._prefix + key, JSON.stringify(value));\n }\n catch (e) {\n console.warn(`${this.constructor.name}: failed to write cache item for key ${this._prefix + key}`, e);\n }\n }\n\n}\n\n\n","import {DateTime} from \"ts-luxon\";\n//\nimport {SmpAbstractCacheStrategy} from \"./smp-abstract-cache-strategy.class.js\";\nimport {SmpCachedValue} from \"./smp-cached-value.interface.js\";\nimport {smpIsSmpCachedValue} from \"./smp-is-smp-cached-value.function.js\";\n\nexport abstract class SmpAbstractTtlCacheStrategy extends SmpAbstractCacheStrategy {\n\n protected abstract _flushRaw(): void;\n\n protected abstract _readRaw(key: string): unknown | undefined;\n\n protected abstract _removeRaw(key: string): void;\n\n protected abstract _writeRaw(key: string, value: unknown, ttl?: number): void;\n\n flush(): void {\n this._flushRaw();\n }\n\n read<T = unknown>(key: string): T | undefined {\n const storedValue = this._readRaw(key);\n if (this._isSmpCachedValue<T>(storedValue)) {\n if (storedValue.expiry >= DateTime.now().ts) {\n return storedValue.value as T;\n }\n this._removeRaw(key);\n\n return void 0;\n }\n return storedValue as T | undefined;\n }\n\n remove(key: string): void {\n this._removeRaw(key);\n }\n\n\n write<T = unknown>(key: string, value: T, ttl?: number): void {\n if (isNaN(+ttl!) || +ttl! <= 0) {\n this._writeRaw(key, value, ttl);\n return;\n }\n const expiry = DateTime.now().ts + ttl! * 1000;\n const wrappedValue: SmpCachedValue<T> = {\n value: value,\n expiry: expiry\n };\n this._writeRaw(key, wrappedValue, ttl);\n }\n\n protected _isSmpCachedValue<T>(value: unknown): value is SmpCachedValue<T> {\n return smpIsSmpCachedValue(value);\n }\n}\n","import {Observable} from \"rxjs\";\n\n/**\n * Abstract class representing a caching strategy. This class is intended to be extended by concrete implementations\n * and provides an interface for performing common caching operations such as reading, writing, removing, and flushing cache entries.\n * You shouldn't need to implement this: you can go with SmpAbstractTtlCacheStrategy or SmpRxjsAbstractCacheStrategy, depending on what type of cache you want to implement.\n * For instance, for a local cache, you may stay sync, while for a Valkey cache, you should start with the rxjs.\n */\nexport abstract class SmpAbstractCacheStrategy {\n abstract read<T = unknown>(key: string): T | undefined | Observable<T | undefined>;\n\n abstract write<T = unknown>(key: string, value: T, ttl?: number): void | Observable<void>;\n\n abstract remove(key: string): void | Observable<void>;\n\n abstract flush(): void | Observable<void>;\n}\n","import {SmpCachedValue} from \"./smp-cached-value.interface.js\";\n\n/**\n * Tells you if a value is a SmpCachedValue\n * @param value\n */\nexport function smpIsSmpCachedValue<T>(value: unknown): value is SmpCachedValue<T> {\n return (\n typeof value === \"object\" &&\n value !== null &&\n \"value\" in value &&\n \"expiry\" in value &&\n typeof (value as any).expiry === \"number\"\n );\n}\n"],"mappings":"4dAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,qBAAAE,IAAA,eAAAC,EAAAH,GCAA,IAAAI,EAAuB,oBCQhB,IAAeC,EAAf,KAAeA,CANtB,MAMsBA,CAAAA,EAAAA,iCAQtB,ECVO,SAASC,EAAuBC,EAAc,CACjD,OACI,OAAOA,GAAU,UACjBA,IAAU,MACV,UAAWA,GACX,WAAYA,GACZ,OAAQA,EAAcC,QAAW,QAEzC,CARgBF,EAAAA,EAAAA,uBFAT,IAAeG,EAAf,cAAmDC,CAAAA,CAN1D,MAM0DA,CAAAA,EAAAA,oCAUtDC,OAAc,CACV,KAAKC,UAAS,CAClB,CAEAC,KAAkBC,EAA4B,CAC1C,IAAMC,EAAc,KAAKC,SAASF,CAAAA,EAClC,GAAI,KAAKG,kBAAqBF,CAAAA,EAAc,CACxC,GAAIA,EAAYG,QAAUC,WAASC,IAAG,EAAGC,GACrC,OAAON,EAAYO,MAEvB,KAAKC,WAAWT,CAAAA,EAEhB,MACJ,CACA,OAAOC,CACX,CAEAS,OAAOV,EAAmB,CACtB,KAAKS,WAAWT,CAAAA,CACpB,CAGAW,MAAmBX,EAAaQ,EAAUI,EAAoB,CAC1D,GAAIC,MAAM,CAACD,CAAAA,GAAS,CAACA,GAAQ,EAAG,CAC5B,KAAKE,UAAUd,EAAKQ,EAAOI,CAAAA,EAC3B,MACJ,CACA,IAAMR,EAASC,WAASC,IAAG,EAAGC,GAAKK,EAAO,IACpCG,EAAkC,CACpCP,MAAOA,EACPJ,OAAQA,CACZ,EACA,KAAKU,UAAUd,EAAKe,EAAcH,CAAAA,CACtC,CAEUT,kBAAqBK,EAA4C,CACvE,OAAOQ,EAAoBR,CAAAA,CAC/B,CACJ,EDpDO,IAAMS,EAAN,cAA8BC,CAAAA,CAFrC,MAEqCA,CAAAA,EAAAA,yCAEjC,YAAsBC,EACAC,EAAiB,CACnC,MAAK,EAAA,KAFaD,SAAAA,EAAAA,KACAC,QAAAA,CAEtB,CAEUC,WAAkB,CACxB,IAAMC,EAAyB,CAAA,EAC3BC,EAAI,GACR,KAAO,EAAEA,EAAI,KAAKJ,SAASK,QAAQ,CAC/B,IAAMC,EAAM,KAAKN,SAASM,IAAIF,CAAAA,EAC1BE,GAAOA,EAAIC,WAAW,KAAKN,OAAO,GAClCE,EAAaK,KAAKF,CAAAA,CAE1B,CAEA,IADAF,EAAI,GACG,EAAEA,EAAID,EAAaE,QACtB,KAAKL,SAASS,WAAWN,EAAaC,CAAAA,CAAE,CAEhD,CAEUM,SAASJ,EAAkC,CACjD,IAAMK,EAAM,KAAKX,SAASY,QAAQ,KAAKX,QAAUK,CAAAA,EACjD,GAAI,CACA,OAAOK,EAAME,KAAKC,MAAMH,CAAAA,EAAOI,MACnC,MACM,CACFC,QAAQC,KAAK,GAAG,KAAK,YAAYC,IAAI,wCAAwC,KAAKjB,QAAUK,CAAAA,EAAK,EAEjG,MACJ,CACJ,CAEUa,WAAWb,EAAmB,CACpC,KAAKN,SAASS,WAAW,KAAKR,QAAUK,CAAAA,CAC5C,CAEUc,UAAUd,EAAae,EAAsB,CACnD,GAAI,CACA,KAAKrB,SAASsB,QAAQ,KAAKrB,QAAUK,EAAKO,KAAKU,UAAUF,CAAAA,CAAAA,CAC7D,OACOG,EAAG,CACNR,QAAQC,KAAK,GAAG,KAAK,YAAYC,IAAI,wCAAwC,KAAKjB,QAAUK,CAAAA,GAAOkB,CAAAA,CACvG,CACJ,CAEJ","names":["smp_browser_cache_class_exports","__export","SmpBrowserCache","__toCommonJS","import_ts_luxon","SmpAbstractCacheStrategy","smpIsSmpCachedValue","value","expiry","SmpAbstractTtlCacheStrategy","SmpAbstractCacheStrategy","flush","_flushRaw","read","key","storedValue","_readRaw","_isSmpCachedValue","expiry","DateTime","now","ts","value","_removeRaw","remove","write","ttl","isNaN","_writeRaw","wrappedValue","smpIsSmpCachedValue","SmpBrowserCache","SmpAbstractTtlCacheStrategy","_storage","_prefix","_flushRaw","keysToRemove","i","length","key","startsWith","push","removeItem","_readRaw","raw","getItem","JSON","parse","undefined","console","warn","name","_removeRaw","_writeRaw","value","setItem","stringify","e"]}
@@ -1,16 +0,0 @@
1
- import { SmpAbstractTtlCacheStrategy } from './smp-abstract-ttl-cache-strategy.class.cjs';
2
- import './smp-abstract-cache-strategy.class.cjs';
3
- import 'rxjs';
4
- import './smp-cached-value.interface.cjs';
5
-
6
- declare class SmpBrowserCache extends SmpAbstractTtlCacheStrategy {
7
- protected _storage: typeof localStorage | typeof sessionStorage;
8
- protected _prefix: string;
9
- constructor(_storage: typeof localStorage | typeof sessionStorage, _prefix: string);
10
- protected _flushRaw(): void;
11
- protected _readRaw(key: string): unknown | undefined;
12
- protected _removeRaw(key: string): void;
13
- protected _writeRaw(key: string, value: unknown): void;
14
- }
15
-
16
- export { SmpBrowserCache };
@@ -1,2 +0,0 @@
1
- "use strict";var t=Object.defineProperty;var a=Object.getOwnPropertyDescriptor;var b=Object.getOwnPropertyNames;var c=Object.prototype.hasOwnProperty;var d=(o,e,x,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let p of b(e))!c.call(o,p)&&p!==x&&t(o,p,{get:()=>e[p],enumerable:!(r=a(e,p))||r.enumerable});return o};var f=o=>d(t({},"__esModule",{value:!0}),o);var g={};module.exports=f(g);
2
- //# sourceMappingURL=smp-cached-value.interface.cjs.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../../../../src/shared/utils/cache/smp-cached-value.interface.ts"],"sourcesContent":["export interface SmpCachedValue<T = any> {\n value: T;\n expiry: number;\n}\n"],"mappings":"+WAAA,IAAAA,EAAA,kBAAAC,EAAAD","names":["smp_cached_value_interface_exports","__toCommonJS"]}
@@ -1,6 +0,0 @@
1
- interface SmpCachedValue<T = any> {
2
- value: T;
3
- expiry: number;
4
- }
5
-
6
- export type { SmpCachedValue };
@@ -1,2 +0,0 @@
1
- "use strict";var o=Object.defineProperty;var h=Object.getOwnPropertyDescriptor;var m=Object.getOwnPropertyNames;var w=Object.prototype.hasOwnProperty;var i=(t,e)=>o(t,"name",{value:e,configurable:!0});var l=(t,e)=>{for(var r in e)o(t,r,{get:e[r],enumerable:!0})},d=(t,e,r,s)=>{if(e&&typeof e=="object"||typeof e=="function")for(let a of m(e))!w.call(t,a)&&a!==r&&o(t,a,{get:()=>e[a],enumerable:!(s=h(e,a))||s.enumerable});return t};var x=t=>d(o({},"__esModule",{value:!0}),t);var R={};l(R,{SmpInMemoryCache:()=>c});module.exports=x(R);var _=require("ts-luxon");var p=class{static{i(this,"SmpAbstractCacheStrategy")}};function u(t){return typeof t=="object"&&t!==null&&"value"in t&&"expiry"in t&&typeof t.expiry=="number"}i(u,"smpIsSmpCachedValue");var n=class extends p{static{i(this,"SmpAbstractTtlCacheStrategy")}flush(){this._flushRaw()}read(e){let r=this._readRaw(e);if(this._isSmpCachedValue(r)){if(r.expiry>=_.DateTime.now().ts)return r.value;this._removeRaw(e);return}return r}remove(e){this._removeRaw(e)}write(e,r,s){if(isNaN(+s)||+s<=0){this._writeRaw(e,r,s);return}let a=_.DateTime.now().ts+s*1e3,f={value:r,expiry:a};this._writeRaw(e,f,s)}_isSmpCachedValue(e){return u(e)}};var c=class extends n{static{i(this,"SmpInMemoryCache")}static _storage=new Map;get _staticSelf(){return this.constructor}_flushRaw(){this._staticSelf._storage.clear()}_readRaw(e){return this._staticSelf._storage.get(e)}_removeRaw(e){this._staticSelf._storage.delete(e)}_writeRaw(e,r){this._staticSelf._storage.set(e,r)}};0&&(module.exports={SmpInMemoryCache});
2
- //# sourceMappingURL=smp-in-memory-cache.class.cjs.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../../../../src/shared/utils/cache/smp-in-memory-cache.class.ts","../../../../../src/shared/utils/cache/smp-abstract-ttl-cache-strategy.class.ts","../../../../../src/shared/utils/cache/smp-abstract-cache-strategy.class.ts","../../../../../src/shared/utils/cache/smp-is-smp-cached-value.function.ts"],"sourcesContent":["import {SmpAbstractTtlCacheStrategy} from \"./smp-abstract-ttl-cache-strategy.class.js\";\n\nexport class SmpInMemoryCache extends SmpAbstractTtlCacheStrategy {\n\n private static _storage = new Map<string, unknown>();\n\n protected get _staticSelf(): typeof SmpInMemoryCache {\n return (this.constructor as typeof SmpInMemoryCache);\n }\n\n protected _flushRaw(): void {\n this._staticSelf._storage.clear();\n }\n\n protected _readRaw(key: string): unknown | undefined {\n return this._staticSelf._storage.get(key);\n }\n\n protected _removeRaw(key: string): void {\n this._staticSelf._storage.delete(key);\n }\n\n protected _writeRaw(key: string, value: unknown): void {\n this._staticSelf._storage.set(key, value);\n }\n\n}\n","import {DateTime} from \"ts-luxon\";\n//\nimport {SmpAbstractCacheStrategy} from \"./smp-abstract-cache-strategy.class.js\";\nimport {SmpCachedValue} from \"./smp-cached-value.interface.js\";\nimport {smpIsSmpCachedValue} from \"./smp-is-smp-cached-value.function.js\";\n\nexport abstract class SmpAbstractTtlCacheStrategy extends SmpAbstractCacheStrategy {\n\n protected abstract _flushRaw(): void;\n\n protected abstract _readRaw(key: string): unknown | undefined;\n\n protected abstract _removeRaw(key: string): void;\n\n protected abstract _writeRaw(key: string, value: unknown, ttl?: number): void;\n\n flush(): void {\n this._flushRaw();\n }\n\n read<T = unknown>(key: string): T | undefined {\n const storedValue = this._readRaw(key);\n if (this._isSmpCachedValue<T>(storedValue)) {\n if (storedValue.expiry >= DateTime.now().ts) {\n return storedValue.value as T;\n }\n this._removeRaw(key);\n\n return void 0;\n }\n return storedValue as T | undefined;\n }\n\n remove(key: string): void {\n this._removeRaw(key);\n }\n\n\n write<T = unknown>(key: string, value: T, ttl?: number): void {\n if (isNaN(+ttl!) || +ttl! <= 0) {\n this._writeRaw(key, value, ttl);\n return;\n }\n const expiry = DateTime.now().ts + ttl! * 1000;\n const wrappedValue: SmpCachedValue<T> = {\n value: value,\n expiry: expiry\n };\n this._writeRaw(key, wrappedValue, ttl);\n }\n\n protected _isSmpCachedValue<T>(value: unknown): value is SmpCachedValue<T> {\n return smpIsSmpCachedValue(value);\n }\n}\n","import {Observable} from \"rxjs\";\n\n/**\n * Abstract class representing a caching strategy. This class is intended to be extended by concrete implementations\n * and provides an interface for performing common caching operations such as reading, writing, removing, and flushing cache entries.\n * You shouldn't need to implement this: you can go with SmpAbstractTtlCacheStrategy or SmpRxjsAbstractCacheStrategy, depending on what type of cache you want to implement.\n * For instance, for a local cache, you may stay sync, while for a Valkey cache, you should start with the rxjs.\n */\nexport abstract class SmpAbstractCacheStrategy {\n abstract read<T = unknown>(key: string): T | undefined | Observable<T | undefined>;\n\n abstract write<T = unknown>(key: string, value: T, ttl?: number): void | Observable<void>;\n\n abstract remove(key: string): void | Observable<void>;\n\n abstract flush(): void | Observable<void>;\n}\n","import {SmpCachedValue} from \"./smp-cached-value.interface.js\";\n\n/**\n * Tells you if a value is a SmpCachedValue\n * @param value\n */\nexport function smpIsSmpCachedValue<T>(value: unknown): value is SmpCachedValue<T> {\n return (\n typeof value === \"object\" &&\n value !== null &&\n \"value\" in value &&\n \"expiry\" in value &&\n typeof (value as any).expiry === \"number\"\n );\n}\n"],"mappings":"4dAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,sBAAAE,IAAA,eAAAC,EAAAH,GCAA,IAAAI,EAAuB,oBCQhB,IAAeC,EAAf,KAAeA,CANtB,MAMsBA,CAAAA,EAAAA,iCAQtB,ECVO,SAASC,EAAuBC,EAAc,CACjD,OACI,OAAOA,GAAU,UACjBA,IAAU,MACV,UAAWA,GACX,WAAYA,GACZ,OAAQA,EAAcC,QAAW,QAEzC,CARgBF,EAAAA,EAAAA,uBFAT,IAAeG,EAAf,cAAmDC,CAAAA,CAN1D,MAM0DA,CAAAA,EAAAA,oCAUtDC,OAAc,CACV,KAAKC,UAAS,CAClB,CAEAC,KAAkBC,EAA4B,CAC1C,IAAMC,EAAc,KAAKC,SAASF,CAAAA,EAClC,GAAI,KAAKG,kBAAqBF,CAAAA,EAAc,CACxC,GAAIA,EAAYG,QAAUC,WAASC,IAAG,EAAGC,GACrC,OAAON,EAAYO,MAEvB,KAAKC,WAAWT,CAAAA,EAEhB,MACJ,CACA,OAAOC,CACX,CAEAS,OAAOV,EAAmB,CACtB,KAAKS,WAAWT,CAAAA,CACpB,CAGAW,MAAmBX,EAAaQ,EAAUI,EAAoB,CAC1D,GAAIC,MAAM,CAACD,CAAAA,GAAS,CAACA,GAAQ,EAAG,CAC5B,KAAKE,UAAUd,EAAKQ,EAAOI,CAAAA,EAC3B,MACJ,CACA,IAAMR,EAASC,WAASC,IAAG,EAAGC,GAAKK,EAAO,IACpCG,EAAkC,CACpCP,MAAOA,EACPJ,OAAQA,CACZ,EACA,KAAKU,UAAUd,EAAKe,EAAcH,CAAAA,CACtC,CAEUT,kBAAqBK,EAA4C,CACvE,OAAOQ,EAAoBR,CAAAA,CAC/B,CACJ,EDpDO,IAAMS,EAAN,cAA+BC,CAAAA,CAFtC,MAEsCA,CAAAA,EAAAA,yBAElC,OAAeC,SAAW,IAAIC,IAE9B,IAAcC,aAAuC,CACjD,OAAQ,KAAK,WACjB,CAEUC,WAAkB,CACxB,KAAKD,YAAYF,SAASI,MAAK,CACnC,CAEUC,SAASC,EAAkC,CACjD,OAAO,KAAKJ,YAAYF,SAASO,IAAID,CAAAA,CACzC,CAEUE,WAAWF,EAAmB,CACpC,KAAKJ,YAAYF,SAASS,OAAOH,CAAAA,CACrC,CAEUI,UAAUJ,EAAaK,EAAsB,CACnD,KAAKT,YAAYF,SAASY,IAAIN,EAAKK,CAAAA,CACvC,CAEJ","names":["smp_in_memory_cache_class_exports","__export","SmpInMemoryCache","__toCommonJS","import_ts_luxon","SmpAbstractCacheStrategy","smpIsSmpCachedValue","value","expiry","SmpAbstractTtlCacheStrategy","SmpAbstractCacheStrategy","flush","_flushRaw","read","key","storedValue","_readRaw","_isSmpCachedValue","expiry","DateTime","now","ts","value","_removeRaw","remove","write","ttl","isNaN","_writeRaw","wrappedValue","smpIsSmpCachedValue","SmpInMemoryCache","SmpAbstractTtlCacheStrategy","_storage","Map","_staticSelf","_flushRaw","clear","_readRaw","key","get","_removeRaw","delete","_writeRaw","value","set"]}
@@ -1,15 +0,0 @@
1
- import { SmpAbstractTtlCacheStrategy } from './smp-abstract-ttl-cache-strategy.class.cjs';
2
- import './smp-abstract-cache-strategy.class.cjs';
3
- import 'rxjs';
4
- import './smp-cached-value.interface.cjs';
5
-
6
- declare class SmpInMemoryCache extends SmpAbstractTtlCacheStrategy {
7
- private static _storage;
8
- protected get _staticSelf(): typeof SmpInMemoryCache;
9
- protected _flushRaw(): void;
10
- protected _readRaw(key: string): unknown | undefined;
11
- protected _removeRaw(key: string): void;
12
- protected _writeRaw(key: string, value: unknown): void;
13
- }
14
-
15
- export { SmpInMemoryCache };
@@ -1,2 +0,0 @@
1
- "use strict";var t=Object.defineProperty;var y=Object.getOwnPropertyDescriptor;var c=Object.getOwnPropertyNames;var f=Object.prototype.hasOwnProperty;var o=(e,n)=>t(e,"name",{value:n,configurable:!0});var m=(e,n)=>{for(var r in n)t(e,r,{get:n[r],enumerable:!0})},x=(e,n,r,i)=>{if(n&&typeof n=="object"||typeof n=="function")for(let p of c(n))!f.call(e,p)&&p!==r&&t(e,p,{get:()=>n[p],enumerable:!(i=y(n,p))||i.enumerable});return e};var b=e=>x(t({},"__esModule",{value:!0}),e);var u={};m(u,{smpIsSmpCachedValue:()=>s});module.exports=b(u);function s(e){return typeof e=="object"&&e!==null&&"value"in e&&"expiry"in e&&typeof e.expiry=="number"}o(s,"smpIsSmpCachedValue");0&&(module.exports={smpIsSmpCachedValue});
2
- //# sourceMappingURL=smp-is-smp-cached-value.function.cjs.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../../../../src/shared/utils/cache/smp-is-smp-cached-value.function.ts"],"sourcesContent":["import {SmpCachedValue} from \"./smp-cached-value.interface.js\";\n\n/**\n * Tells you if a value is a SmpCachedValue\n * @param value\n */\nexport function smpIsSmpCachedValue<T>(value: unknown): value is SmpCachedValue<T> {\n return (\n typeof value === \"object\" &&\n value !== null &&\n \"value\" in value &&\n \"expiry\" in value &&\n typeof (value as any).expiry === \"number\"\n );\n}\n"],"mappings":"4dAEA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,yBAAAE,IAAA,eAAAC,EAAAH,GAIO,SAASI,EAAuBC,EAAc,CACjD,OACI,OAAOA,GAAU,UACjBA,IAAU,MACV,UAAWA,GACX,WAAYA,GACZ,OAAQA,EAAcC,QAAW,QAEzC,CARgBF,EAAAA,EAAAA","names":["smp_is_smp_cached_value_function_exports","__export","smpIsSmpCachedValue","__toCommonJS","smpIsSmpCachedValue","value","expiry"]}
@@ -1,9 +0,0 @@
1
- import { SmpCachedValue } from './smp-cached-value.interface.cjs';
2
-
3
- /**
4
- * Tells you if a value is a SmpCachedValue
5
- * @param value
6
- */
7
- declare function smpIsSmpCachedValue<T>(value: unknown): value is SmpCachedValue<T>;
8
-
9
- export { smpIsSmpCachedValue };