@webiny/stdlib 0.0.1

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 (302) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +60 -0
  3. package/dist/LICENSE +21 -0
  4. package/dist/README.md +60 -0
  5. package/dist/browser/features/LocalStorageCache/LocalStorageCache.d.ts +26 -0
  6. package/dist/browser/features/LocalStorageCache/LocalStorageCache.d.ts.map +1 -0
  7. package/dist/browser/features/LocalStorageCache/LocalStorageCache.js +159 -0
  8. package/dist/browser/features/LocalStorageCache/LocalStorageCache.js.map +1 -0
  9. package/dist/browser/features/LocalStorageCache/errors.d.ts +26 -0
  10. package/dist/browser/features/LocalStorageCache/errors.d.ts.map +1 -0
  11. package/dist/browser/features/LocalStorageCache/errors.js +23 -0
  12. package/dist/browser/features/LocalStorageCache/errors.js.map +1 -0
  13. package/dist/browser/features/LocalStorageCache/feature.d.ts +6 -0
  14. package/dist/browser/features/LocalStorageCache/feature.d.ts.map +1 -0
  15. package/dist/browser/features/LocalStorageCache/feature.js +10 -0
  16. package/dist/browser/features/LocalStorageCache/feature.js.map +1 -0
  17. package/dist/browser/features/LocalStorageCache/index.d.ts +4 -0
  18. package/dist/browser/features/LocalStorageCache/index.d.ts.map +1 -0
  19. package/dist/browser/features/LocalStorageCache/index.js +4 -0
  20. package/dist/browser/features/LocalStorageCache/index.js.map +1 -0
  21. package/dist/browser/index.d.ts +2 -0
  22. package/dist/browser/index.d.ts.map +1 -0
  23. package/dist/browser/index.js +2 -0
  24. package/dist/browser/index.js.map +1 -0
  25. package/dist/common/core/BaseError.d.ts +13 -0
  26. package/dist/common/core/BaseError.d.ts.map +1 -0
  27. package/dist/common/core/BaseError.js +8 -0
  28. package/dist/common/core/BaseError.js.map +1 -0
  29. package/dist/common/core/Result.d.ts +103 -0
  30. package/dist/common/core/Result.d.ts.map +1 -0
  31. package/dist/common/core/Result.js +127 -0
  32. package/dist/common/core/Result.js.map +1 -0
  33. package/dist/common/core/ResultAsync.d.ts +17 -0
  34. package/dist/common/core/ResultAsync.d.ts.map +1 -0
  35. package/dist/common/core/ResultAsync.js +62 -0
  36. package/dist/common/core/ResultAsync.js.map +1 -0
  37. package/dist/common/core/createAbstraction.d.ts +4 -0
  38. package/dist/common/core/createAbstraction.d.ts.map +1 -0
  39. package/dist/common/core/createAbstraction.js +5 -0
  40. package/dist/common/core/createAbstraction.js.map +1 -0
  41. package/dist/common/core/createFeature.d.ts +10 -0
  42. package/dist/common/core/createFeature.d.ts.map +1 -0
  43. package/dist/common/core/createFeature.js +9 -0
  44. package/dist/common/core/createFeature.js.map +1 -0
  45. package/dist/common/core/index.d.ts +7 -0
  46. package/dist/common/core/index.d.ts.map +1 -0
  47. package/dist/common/core/index.js +6 -0
  48. package/dist/common/core/index.js.map +1 -0
  49. package/dist/common/features/Cache/AsyncMemoryCache.d.ts +23 -0
  50. package/dist/common/features/Cache/AsyncMemoryCache.d.ts.map +1 -0
  51. package/dist/common/features/Cache/AsyncMemoryCache.js +90 -0
  52. package/dist/common/features/Cache/AsyncMemoryCache.js.map +1 -0
  53. package/dist/common/features/Cache/AsyncMemoryCacheFeature.d.ts +6 -0
  54. package/dist/common/features/Cache/AsyncMemoryCacheFeature.d.ts.map +1 -0
  55. package/dist/common/features/Cache/AsyncMemoryCacheFeature.js +10 -0
  56. package/dist/common/features/Cache/AsyncMemoryCacheFeature.js.map +1 -0
  57. package/dist/common/features/Cache/MemoryCache.d.ts +23 -0
  58. package/dist/common/features/Cache/MemoryCache.d.ts.map +1 -0
  59. package/dist/common/features/Cache/MemoryCache.js +75 -0
  60. package/dist/common/features/Cache/MemoryCache.js.map +1 -0
  61. package/dist/common/features/Cache/MemoryCacheFeature.d.ts +6 -0
  62. package/dist/common/features/Cache/MemoryCacheFeature.d.ts.map +1 -0
  63. package/dist/common/features/Cache/MemoryCacheFeature.js +10 -0
  64. package/dist/common/features/Cache/MemoryCacheFeature.js.map +1 -0
  65. package/dist/common/features/Cache/abstractions/AsyncCache.d.ts +39 -0
  66. package/dist/common/features/Cache/abstractions/AsyncCache.d.ts.map +1 -0
  67. package/dist/common/features/Cache/abstractions/AsyncCache.js +3 -0
  68. package/dist/common/features/Cache/abstractions/AsyncCache.js.map +1 -0
  69. package/dist/common/features/Cache/abstractions/Cache.d.ts +39 -0
  70. package/dist/common/features/Cache/abstractions/Cache.d.ts.map +1 -0
  71. package/dist/common/features/Cache/abstractions/Cache.js +3 -0
  72. package/dist/common/features/Cache/abstractions/Cache.js.map +1 -0
  73. package/dist/common/features/Cache/abstractions/CacheError.d.ts +5 -0
  74. package/dist/common/features/Cache/abstractions/CacheError.d.ts.map +1 -0
  75. package/dist/common/features/Cache/abstractions/CacheError.js +5 -0
  76. package/dist/common/features/Cache/abstractions/CacheError.js.map +1 -0
  77. package/dist/common/features/Cache/abstractions/index.d.ts +4 -0
  78. package/dist/common/features/Cache/abstractions/index.d.ts.map +1 -0
  79. package/dist/common/features/Cache/abstractions/index.js +4 -0
  80. package/dist/common/features/Cache/abstractions/index.js.map +1 -0
  81. package/dist/common/features/Cache/index.d.ts +8 -0
  82. package/dist/common/features/Cache/index.d.ts.map +1 -0
  83. package/dist/common/features/Cache/index.js +6 -0
  84. package/dist/common/features/Cache/index.js.map +1 -0
  85. package/dist/common/features/Logger/ConsoleLogger.d.ts +28 -0
  86. package/dist/common/features/Logger/ConsoleLogger.d.ts.map +1 -0
  87. package/dist/common/features/Logger/ConsoleLogger.js +84 -0
  88. package/dist/common/features/Logger/ConsoleLogger.js.map +1 -0
  89. package/dist/common/features/Logger/abstractions/ConsoleLoggerConfig.d.ts +27 -0
  90. package/dist/common/features/Logger/abstractions/ConsoleLoggerConfig.d.ts.map +1 -0
  91. package/dist/common/features/Logger/abstractions/ConsoleLoggerConfig.js +3 -0
  92. package/dist/common/features/Logger/abstractions/ConsoleLoggerConfig.js.map +1 -0
  93. package/dist/common/features/Logger/abstractions/Logger.d.ts +20 -0
  94. package/dist/common/features/Logger/abstractions/Logger.d.ts.map +1 -0
  95. package/dist/common/features/Logger/abstractions/Logger.js +3 -0
  96. package/dist/common/features/Logger/abstractions/Logger.js.map +1 -0
  97. package/dist/common/features/Logger/abstractions/index.d.ts +3 -0
  98. package/dist/common/features/Logger/abstractions/index.d.ts.map +1 -0
  99. package/dist/common/features/Logger/abstractions/index.js +3 -0
  100. package/dist/common/features/Logger/abstractions/index.js.map +1 -0
  101. package/dist/common/features/Logger/feature.d.ts +9 -0
  102. package/dist/common/features/Logger/feature.d.ts.map +1 -0
  103. package/dist/common/features/Logger/feature.js +13 -0
  104. package/dist/common/features/Logger/feature.js.map +1 -0
  105. package/dist/common/features/Logger/index.d.ts +5 -0
  106. package/dist/common/features/Logger/index.d.ts.map +1 -0
  107. package/dist/common/features/Logger/index.js +5 -0
  108. package/dist/common/features/Logger/index.js.map +1 -0
  109. package/dist/common/index.d.ts +11 -0
  110. package/dist/common/index.d.ts.map +1 -0
  111. package/dist/common/index.js +9 -0
  112. package/dist/common/index.js.map +1 -0
  113. package/dist/common/utils/boolean.d.ts +7 -0
  114. package/dist/common/utils/boolean.d.ts.map +1 -0
  115. package/dist/common/utils/boolean.js +22 -0
  116. package/dist/common/utils/boolean.js.map +1 -0
  117. package/dist/common/utils/dotProp.d.ts +23 -0
  118. package/dist/common/utils/dotProp.d.ts.map +1 -0
  119. package/dist/common/utils/dotProp.js +45 -0
  120. package/dist/common/utils/dotProp.js.map +1 -0
  121. package/dist/index.d.ts +2 -0
  122. package/dist/index.d.ts.map +1 -0
  123. package/dist/index.js +2 -0
  124. package/dist/index.js.map +1 -0
  125. package/dist/node/features/DirectoryTool/DirectoryTool.d.ts +24 -0
  126. package/dist/node/features/DirectoryTool/DirectoryTool.d.ts.map +1 -0
  127. package/dist/node/features/DirectoryTool/DirectoryTool.js +83 -0
  128. package/dist/node/features/DirectoryTool/DirectoryTool.js.map +1 -0
  129. package/dist/node/features/DirectoryTool/abstractions/DirectoryTool.d.ts +32 -0
  130. package/dist/node/features/DirectoryTool/abstractions/DirectoryTool.d.ts.map +1 -0
  131. package/dist/node/features/DirectoryTool/abstractions/DirectoryTool.js +3 -0
  132. package/dist/node/features/DirectoryTool/abstractions/DirectoryTool.js.map +1 -0
  133. package/dist/node/features/DirectoryTool/abstractions/index.d.ts +2 -0
  134. package/dist/node/features/DirectoryTool/abstractions/index.d.ts.map +1 -0
  135. package/dist/node/features/DirectoryTool/abstractions/index.js +2 -0
  136. package/dist/node/features/DirectoryTool/abstractions/index.js.map +1 -0
  137. package/dist/node/features/DirectoryTool/feature.d.ts +5 -0
  138. package/dist/node/features/DirectoryTool/feature.d.ts.map +1 -0
  139. package/dist/node/features/DirectoryTool/feature.js +9 -0
  140. package/dist/node/features/DirectoryTool/feature.js.map +1 -0
  141. package/dist/node/features/DirectoryTool/index.d.ts +4 -0
  142. package/dist/node/features/DirectoryTool/index.d.ts.map +1 -0
  143. package/dist/node/features/DirectoryTool/index.js +4 -0
  144. package/dist/node/features/DirectoryTool/index.js.map +1 -0
  145. package/dist/node/features/FileTool/FileTool.d.ts +26 -0
  146. package/dist/node/features/FileTool/FileTool.d.ts.map +1 -0
  147. package/dist/node/features/FileTool/FileTool.js +71 -0
  148. package/dist/node/features/FileTool/FileTool.js.map +1 -0
  149. package/dist/node/features/FileTool/abstractions/FileTool.d.ts +15 -0
  150. package/dist/node/features/FileTool/abstractions/FileTool.d.ts.map +1 -0
  151. package/dist/node/features/FileTool/abstractions/FileTool.js +3 -0
  152. package/dist/node/features/FileTool/abstractions/FileTool.js.map +1 -0
  153. package/dist/node/features/FileTool/abstractions/index.d.ts +2 -0
  154. package/dist/node/features/FileTool/abstractions/index.d.ts.map +1 -0
  155. package/dist/node/features/FileTool/abstractions/index.js +2 -0
  156. package/dist/node/features/FileTool/abstractions/index.js.map +1 -0
  157. package/dist/node/features/FileTool/feature.d.ts +5 -0
  158. package/dist/node/features/FileTool/feature.d.ts.map +1 -0
  159. package/dist/node/features/FileTool/feature.js +9 -0
  160. package/dist/node/features/FileTool/feature.js.map +1 -0
  161. package/dist/node/features/FileTool/index.d.ts +4 -0
  162. package/dist/node/features/FileTool/index.d.ts.map +1 -0
  163. package/dist/node/features/FileTool/index.js +4 -0
  164. package/dist/node/features/FileTool/index.js.map +1 -0
  165. package/dist/node/features/JsonFileTool/JsonFileTool.d.ts +19 -0
  166. package/dist/node/features/JsonFileTool/JsonFileTool.d.ts.map +1 -0
  167. package/dist/node/features/JsonFileTool/JsonFileTool.js +43 -0
  168. package/dist/node/features/JsonFileTool/JsonFileTool.js.map +1 -0
  169. package/dist/node/features/JsonFileTool/abstractions/JsonFileTool.d.ts +17 -0
  170. package/dist/node/features/JsonFileTool/abstractions/JsonFileTool.d.ts.map +1 -0
  171. package/dist/node/features/JsonFileTool/abstractions/JsonFileTool.js +3 -0
  172. package/dist/node/features/JsonFileTool/abstractions/JsonFileTool.js.map +1 -0
  173. package/dist/node/features/JsonFileTool/abstractions/index.d.ts +2 -0
  174. package/dist/node/features/JsonFileTool/abstractions/index.d.ts.map +1 -0
  175. package/dist/node/features/JsonFileTool/abstractions/index.js +2 -0
  176. package/dist/node/features/JsonFileTool/abstractions/index.js.map +1 -0
  177. package/dist/node/features/JsonFileTool/feature.d.ts +5 -0
  178. package/dist/node/features/JsonFileTool/feature.d.ts.map +1 -0
  179. package/dist/node/features/JsonFileTool/feature.js +9 -0
  180. package/dist/node/features/JsonFileTool/feature.js.map +1 -0
  181. package/dist/node/features/JsonFileTool/index.d.ts +4 -0
  182. package/dist/node/features/JsonFileTool/index.d.ts.map +1 -0
  183. package/dist/node/features/JsonFileTool/index.js +4 -0
  184. package/dist/node/features/JsonFileTool/index.js.map +1 -0
  185. package/dist/node/features/NdJsonReaderTool/LineAccumulator.d.ts +13 -0
  186. package/dist/node/features/NdJsonReaderTool/LineAccumulator.d.ts.map +1 -0
  187. package/dist/node/features/NdJsonReaderTool/LineAccumulator.js +68 -0
  188. package/dist/node/features/NdJsonReaderTool/LineAccumulator.js.map +1 -0
  189. package/dist/node/features/NdJsonReaderTool/NdJsonReaderTool.d.ts +22 -0
  190. package/dist/node/features/NdJsonReaderTool/NdJsonReaderTool.d.ts.map +1 -0
  191. package/dist/node/features/NdJsonReaderTool/NdJsonReaderTool.js +73 -0
  192. package/dist/node/features/NdJsonReaderTool/NdJsonReaderTool.js.map +1 -0
  193. package/dist/node/features/NdJsonReaderTool/abstractions/NdJsonReaderTool.d.ts +41 -0
  194. package/dist/node/features/NdJsonReaderTool/abstractions/NdJsonReaderTool.d.ts.map +1 -0
  195. package/dist/node/features/NdJsonReaderTool/abstractions/NdJsonReaderTool.js +3 -0
  196. package/dist/node/features/NdJsonReaderTool/abstractions/NdJsonReaderTool.js.map +1 -0
  197. package/dist/node/features/NdJsonReaderTool/abstractions/index.d.ts +2 -0
  198. package/dist/node/features/NdJsonReaderTool/abstractions/index.d.ts.map +1 -0
  199. package/dist/node/features/NdJsonReaderTool/abstractions/index.js +2 -0
  200. package/dist/node/features/NdJsonReaderTool/abstractions/index.js.map +1 -0
  201. package/dist/node/features/NdJsonReaderTool/feature.d.ts +5 -0
  202. package/dist/node/features/NdJsonReaderTool/feature.d.ts.map +1 -0
  203. package/dist/node/features/NdJsonReaderTool/feature.js +9 -0
  204. package/dist/node/features/NdJsonReaderTool/feature.js.map +1 -0
  205. package/dist/node/features/NdJsonReaderTool/index.d.ts +4 -0
  206. package/dist/node/features/NdJsonReaderTool/index.d.ts.map +1 -0
  207. package/dist/node/features/NdJsonReaderTool/index.js +4 -0
  208. package/dist/node/features/NdJsonReaderTool/index.js.map +1 -0
  209. package/dist/node/features/PackageJsonFileTool/PackageJsonFile.d.ts +67 -0
  210. package/dist/node/features/PackageJsonFileTool/PackageJsonFile.d.ts.map +1 -0
  211. package/dist/node/features/PackageJsonFileTool/PackageJsonFile.js +91 -0
  212. package/dist/node/features/PackageJsonFileTool/PackageJsonFile.js.map +1 -0
  213. package/dist/node/features/PackageJsonFileTool/PackageJsonFileTool.d.ts +23 -0
  214. package/dist/node/features/PackageJsonFileTool/PackageJsonFileTool.d.ts.map +1 -0
  215. package/dist/node/features/PackageJsonFileTool/PackageJsonFileTool.js +75 -0
  216. package/dist/node/features/PackageJsonFileTool/PackageJsonFileTool.js.map +1 -0
  217. package/dist/node/features/PackageJsonFileTool/abstractions/PackageJsonFileTool.d.ts +40 -0
  218. package/dist/node/features/PackageJsonFileTool/abstractions/PackageJsonFileTool.d.ts.map +1 -0
  219. package/dist/node/features/PackageJsonFileTool/abstractions/PackageJsonFileTool.js +3 -0
  220. package/dist/node/features/PackageJsonFileTool/abstractions/PackageJsonFileTool.js.map +1 -0
  221. package/dist/node/features/PackageJsonFileTool/abstractions/index.d.ts +2 -0
  222. package/dist/node/features/PackageJsonFileTool/abstractions/index.d.ts.map +1 -0
  223. package/dist/node/features/PackageJsonFileTool/abstractions/index.js +2 -0
  224. package/dist/node/features/PackageJsonFileTool/abstractions/index.js.map +1 -0
  225. package/dist/node/features/PackageJsonFileTool/feature.d.ts +5 -0
  226. package/dist/node/features/PackageJsonFileTool/feature.d.ts.map +1 -0
  227. package/dist/node/features/PackageJsonFileTool/feature.js +9 -0
  228. package/dist/node/features/PackageJsonFileTool/feature.js.map +1 -0
  229. package/dist/node/features/PackageJsonFileTool/index.d.ts +5 -0
  230. package/dist/node/features/PackageJsonFileTool/index.d.ts.map +1 -0
  231. package/dist/node/features/PackageJsonFileTool/index.js +5 -0
  232. package/dist/node/features/PackageJsonFileTool/index.js.map +1 -0
  233. package/dist/node/features/PathTool/PathTool.d.ts +14 -0
  234. package/dist/node/features/PathTool/PathTool.d.ts.map +1 -0
  235. package/dist/node/features/PathTool/PathTool.js +38 -0
  236. package/dist/node/features/PathTool/PathTool.js.map +1 -0
  237. package/dist/node/features/PathTool/abstractions/PathTool.d.ts +23 -0
  238. package/dist/node/features/PathTool/abstractions/PathTool.d.ts.map +1 -0
  239. package/dist/node/features/PathTool/abstractions/PathTool.js +3 -0
  240. package/dist/node/features/PathTool/abstractions/PathTool.js.map +1 -0
  241. package/dist/node/features/PathTool/abstractions/index.d.ts +2 -0
  242. package/dist/node/features/PathTool/abstractions/index.d.ts.map +1 -0
  243. package/dist/node/features/PathTool/abstractions/index.js +2 -0
  244. package/dist/node/features/PathTool/abstractions/index.js.map +1 -0
  245. package/dist/node/features/PathTool/errors.d.ts +12 -0
  246. package/dist/node/features/PathTool/errors.d.ts.map +1 -0
  247. package/dist/node/features/PathTool/errors.js +9 -0
  248. package/dist/node/features/PathTool/errors.js.map +1 -0
  249. package/dist/node/features/PathTool/feature.d.ts +5 -0
  250. package/dist/node/features/PathTool/feature.d.ts.map +1 -0
  251. package/dist/node/features/PathTool/feature.js +9 -0
  252. package/dist/node/features/PathTool/feature.js.map +1 -0
  253. package/dist/node/features/PathTool/index.d.ts +5 -0
  254. package/dist/node/features/PathTool/index.d.ts.map +1 -0
  255. package/dist/node/features/PathTool/index.js +5 -0
  256. package/dist/node/features/PathTool/index.js.map +1 -0
  257. package/dist/node/features/PinoLogger/PinoLogger.d.ts +27 -0
  258. package/dist/node/features/PinoLogger/PinoLogger.d.ts.map +1 -0
  259. package/dist/node/features/PinoLogger/PinoLogger.js +152 -0
  260. package/dist/node/features/PinoLogger/PinoLogger.js.map +1 -0
  261. package/dist/node/features/PinoLogger/abstractions/PinoLoggerConfig.d.ts +24 -0
  262. package/dist/node/features/PinoLogger/abstractions/PinoLoggerConfig.d.ts.map +1 -0
  263. package/dist/node/features/PinoLogger/abstractions/PinoLoggerConfig.js +3 -0
  264. package/dist/node/features/PinoLogger/abstractions/PinoLoggerConfig.js.map +1 -0
  265. package/dist/node/features/PinoLogger/abstractions/index.d.ts +2 -0
  266. package/dist/node/features/PinoLogger/abstractions/index.d.ts.map +1 -0
  267. package/dist/node/features/PinoLogger/abstractions/index.js +2 -0
  268. package/dist/node/features/PinoLogger/abstractions/index.js.map +1 -0
  269. package/dist/node/features/PinoLogger/feature.d.ts +9 -0
  270. package/dist/node/features/PinoLogger/feature.d.ts.map +1 -0
  271. package/dist/node/features/PinoLogger/feature.js +13 -0
  272. package/dist/node/features/PinoLogger/feature.js.map +1 -0
  273. package/dist/node/features/PinoLogger/index.d.ts +4 -0
  274. package/dist/node/features/PinoLogger/index.d.ts.map +1 -0
  275. package/dist/node/features/PinoLogger/index.js +4 -0
  276. package/dist/node/features/PinoLogger/index.js.map +1 -0
  277. package/dist/node/features/ReadStreamFactory/ReadStreamFactory.d.ts +11 -0
  278. package/dist/node/features/ReadStreamFactory/ReadStreamFactory.d.ts.map +1 -0
  279. package/dist/node/features/ReadStreamFactory/ReadStreamFactory.js +27 -0
  280. package/dist/node/features/ReadStreamFactory/ReadStreamFactory.js.map +1 -0
  281. package/dist/node/features/ReadStreamFactory/abstractions/ReadStreamFactory.d.ts +21 -0
  282. package/dist/node/features/ReadStreamFactory/abstractions/ReadStreamFactory.d.ts.map +1 -0
  283. package/dist/node/features/ReadStreamFactory/abstractions/ReadStreamFactory.js +3 -0
  284. package/dist/node/features/ReadStreamFactory/abstractions/ReadStreamFactory.js.map +1 -0
  285. package/dist/node/features/ReadStreamFactory/abstractions/index.d.ts +2 -0
  286. package/dist/node/features/ReadStreamFactory/abstractions/index.d.ts.map +1 -0
  287. package/dist/node/features/ReadStreamFactory/abstractions/index.js +2 -0
  288. package/dist/node/features/ReadStreamFactory/abstractions/index.js.map +1 -0
  289. package/dist/node/features/ReadStreamFactory/feature.d.ts +5 -0
  290. package/dist/node/features/ReadStreamFactory/feature.d.ts.map +1 -0
  291. package/dist/node/features/ReadStreamFactory/feature.js +9 -0
  292. package/dist/node/features/ReadStreamFactory/feature.js.map +1 -0
  293. package/dist/node/features/ReadStreamFactory/index.d.ts +4 -0
  294. package/dist/node/features/ReadStreamFactory/index.d.ts.map +1 -0
  295. package/dist/node/features/ReadStreamFactory/index.js +4 -0
  296. package/dist/node/features/ReadStreamFactory/index.js.map +1 -0
  297. package/dist/node/index.d.ts +9 -0
  298. package/dist/node/index.d.ts.map +1 -0
  299. package/dist/node/index.js +9 -0
  300. package/dist/node/index.js.map +1 -0
  301. package/dist/package.json +58 -0
  302. package/package.json +61 -0
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Webiny
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,60 @@
1
+ # @webiny/stdlib
2
+
3
+ Opinionated standard library for [Webiny](https://www.webiny.com). This is an internal package — we make breaking changes freely and do not follow semver for external consumers.
4
+
5
+ ## Design
6
+
7
+ Services are built on a lightweight dependency injection system. Each feature follows the same three-layer pattern: an **abstraction** (DI token + interface), an **implementation** (concrete class), and a **feature** (registers the implementation in the DI container). This keeps code testable and lets different environments (Node.js, browser) swap implementations behind the same interface.
8
+
9
+ ## Subpath exports
10
+
11
+ The package is ESM-only and ships three subpath exports. Because each is a separate entry point, Node.js-specific code is never bundled into a browser build and vice versa — unless you explicitly import the wrong subpath.
12
+
13
+ | Import | Environment | Description |
14
+ | ------------------------ | ----------- | --------------------------- |
15
+ | `@webiny/stdlib` | Any | Platform-agnostic utilities |
16
+ | `@webiny/stdlib/node` | Node.js | Node.js-specific tools |
17
+ | `@webiny/stdlib/browser` | Browser | Browser-specific tools |
18
+
19
+ ---
20
+
21
+ ## `@webiny/stdlib` — Common
22
+
23
+ | Feature | Description |
24
+ | ------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------- |
25
+ | `Result` / `ResultAsync` | Typed success/failure values — synchronous and async |
26
+ | `BaseError` | Abstract base class for typed domain errors |
27
+ | `Logger` / `ConsoleLogger` / `ConsoleLoggerFeature` | Logging abstraction + console implementation — [docs](src/common/features/Logger/README.md) |
28
+ | `Cache` / `MemoryCacheFeature` | Synchronous key-value cache — [docs](src/common/features/Cache/README.md) |
29
+ | `AsyncCache` / `AsyncMemoryCacheFeature` | Async key-value cache — [docs](src/common/features/Cache/README.md) |
30
+ | `immutableGet` / `immutableSet` / `immutableDelete` / `mutableSet` / `mutableDelete` | Dot-notation get/set/delete on nested objects — [docs](src/common/utils/README.md#dotprop) |
31
+ | `toBoolean` / `isTruthy` / `isFalsy` | Semantic boolean coercion — [docs](src/common/utils/README.md#boolean) |
32
+
33
+ ---
34
+
35
+ ## `@webiny/stdlib/node` — Node.js
36
+
37
+ | Feature | Description |
38
+ | ---------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------- |
39
+ | `FileTool` / `FileToolFeature` | Read, write, copy, remove files — [docs](src/node/features/FileTool/README.md) |
40
+ | `DirectoryTool` / `DirectoryToolFeature` | Create, read, remove, copy, glob directories — [docs](src/node/features/DirectoryTool/README.md) |
41
+ | `JsonFileTool` / `JsonFileToolFeature` | Read and write JSON files with optional schema validation — [docs](src/node/features/JsonFileTool/README.md) |
42
+ | `PathTool` / `PathToolFeature` | `node:path` wrapper + `resolvePackageFile` for package-relative paths — [docs](src/node/features/PathTool/README.md) |
43
+ | `PinoLogger` / `PinoLoggerFeature` | pino-based `Logger` implementation — [docs](src/node/features/PinoLogger/README.md) |
44
+ | `NdJsonReaderTool` / `NdJsonReaderToolFeature` | Parse NDJSON from files, streams, or in-memory lines with checkpoint support — [docs](src/node/features/NdJsonReaderTool/README.md) |
45
+ | `ReadStreamFactory` / `ReadStreamFactoryFeature` | Disposable `node:fs` read streams via `AsyncDisposable` — [docs](src/node/features/ReadStreamFactory/README.md) |
46
+ | `PackageJsonFileTool` / `PackageJsonFileToolFeature` | Read, validate, mutate, and write `package.json` files — [docs](src/node/features/PackageJsonFileTool/README.md) |
47
+
48
+ ---
49
+
50
+ ## `@webiny/stdlib/browser` — Browser
51
+
52
+ | Feature | Description |
53
+ | -------------------------- | ----------------------------------------------------------------------------------------------------------------- |
54
+ | `LocalStorageCacheFeature` | `Cache` implementation backed by `window.localStorage` — [docs](src/browser/features/LocalStorageCache/README.md) |
55
+
56
+ ---
57
+
58
+ ## Versioning
59
+
60
+ The package version in `package.json` is always `0.0.0`. The real version is injected at publish time by the release pipeline using conventional commits: `feat` bumps the minor, everything else (`fix`, `chore`, `refactor`, …) bumps the patch. There are no major version bumps — breaking changes may land on minor releases.
package/dist/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Webiny
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/dist/README.md ADDED
@@ -0,0 +1,60 @@
1
+ # @webiny/stdlib
2
+
3
+ Opinionated standard library for [Webiny](https://www.webiny.com). This is an internal package — we make breaking changes freely and do not follow semver for external consumers.
4
+
5
+ ## Design
6
+
7
+ Services are built on a lightweight dependency injection system. Each feature follows the same three-layer pattern: an **abstraction** (DI token + interface), an **implementation** (concrete class), and a **feature** (registers the implementation in the DI container). This keeps code testable and lets different environments (Node.js, browser) swap implementations behind the same interface.
8
+
9
+ ## Subpath exports
10
+
11
+ The package is ESM-only and ships three subpath exports. Because each is a separate entry point, Node.js-specific code is never bundled into a browser build and vice versa — unless you explicitly import the wrong subpath.
12
+
13
+ | Import | Environment | Description |
14
+ | ------------------------ | ----------- | --------------------------- |
15
+ | `@webiny/stdlib` | Any | Platform-agnostic utilities |
16
+ | `@webiny/stdlib/node` | Node.js | Node.js-specific tools |
17
+ | `@webiny/stdlib/browser` | Browser | Browser-specific tools |
18
+
19
+ ---
20
+
21
+ ## `@webiny/stdlib` — Common
22
+
23
+ | Feature | Description |
24
+ | ------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------- |
25
+ | `Result` / `ResultAsync` | Typed success/failure values — synchronous and async |
26
+ | `BaseError` | Abstract base class for typed domain errors |
27
+ | `Logger` / `ConsoleLogger` / `ConsoleLoggerFeature` | Logging abstraction + console implementation — [docs](src/common/features/Logger/README.md) |
28
+ | `Cache` / `MemoryCacheFeature` | Synchronous key-value cache — [docs](src/common/features/Cache/README.md) |
29
+ | `AsyncCache` / `AsyncMemoryCacheFeature` | Async key-value cache — [docs](src/common/features/Cache/README.md) |
30
+ | `immutableGet` / `immutableSet` / `immutableDelete` / `mutableSet` / `mutableDelete` | Dot-notation get/set/delete on nested objects — [docs](src/common/utils/README.md#dotprop) |
31
+ | `toBoolean` / `isTruthy` / `isFalsy` | Semantic boolean coercion — [docs](src/common/utils/README.md#boolean) |
32
+
33
+ ---
34
+
35
+ ## `@webiny/stdlib/node` — Node.js
36
+
37
+ | Feature | Description |
38
+ | ---------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------- |
39
+ | `FileTool` / `FileToolFeature` | Read, write, copy, remove files — [docs](src/node/features/FileTool/README.md) |
40
+ | `DirectoryTool` / `DirectoryToolFeature` | Create, read, remove, copy, glob directories — [docs](src/node/features/DirectoryTool/README.md) |
41
+ | `JsonFileTool` / `JsonFileToolFeature` | Read and write JSON files with optional schema validation — [docs](src/node/features/JsonFileTool/README.md) |
42
+ | `PathTool` / `PathToolFeature` | `node:path` wrapper + `resolvePackageFile` for package-relative paths — [docs](src/node/features/PathTool/README.md) |
43
+ | `PinoLogger` / `PinoLoggerFeature` | pino-based `Logger` implementation — [docs](src/node/features/PinoLogger/README.md) |
44
+ | `NdJsonReaderTool` / `NdJsonReaderToolFeature` | Parse NDJSON from files, streams, or in-memory lines with checkpoint support — [docs](src/node/features/NdJsonReaderTool/README.md) |
45
+ | `ReadStreamFactory` / `ReadStreamFactoryFeature` | Disposable `node:fs` read streams via `AsyncDisposable` — [docs](src/node/features/ReadStreamFactory/README.md) |
46
+ | `PackageJsonFileTool` / `PackageJsonFileToolFeature` | Read, validate, mutate, and write `package.json` files — [docs](src/node/features/PackageJsonFileTool/README.md) |
47
+
48
+ ---
49
+
50
+ ## `@webiny/stdlib/browser` — Browser
51
+
52
+ | Feature | Description |
53
+ | -------------------------- | ----------------------------------------------------------------------------------------------------------------- |
54
+ | `LocalStorageCacheFeature` | `Cache` implementation backed by `window.localStorage` — [docs](src/browser/features/LocalStorageCache/README.md) |
55
+
56
+ ---
57
+
58
+ ## Versioning
59
+
60
+ The package version in `package.json` is always `0.0.0`. The real version is injected at publish time by the release pipeline using conventional commits: `feat` bumps the minor, everything else (`fix`, `chore`, `refactor`, …) bumps the patch. There are no major version bumps — breaking changes may land on minor releases.
@@ -0,0 +1,26 @@
1
+ import { Result } from "../../../common/index.js";
2
+ import { Cache as CacheAbstraction } from "../../../common/index.js";
3
+ import { LocalStorageParseError, LocalStorageQuotaExceededError, LocalStorageUnavailableError } from "./errors.js";
4
+ type LocalStorageCacheError = LocalStorageParseError | LocalStorageQuotaExceededError | LocalStorageUnavailableError;
5
+ declare class LocalStorageCacheImpl implements CacheAbstraction.Interface {
6
+ private prefix;
7
+ private readonly localStorage;
8
+ constructor();
9
+ private static fromPrefix;
10
+ private prefixedKey;
11
+ private unavailable;
12
+ get<T>(key: string): Result<T | null, LocalStorageCacheError>;
13
+ set<T>(key: string, value: T): Result<void, LocalStorageCacheError>;
14
+ remove(key: string): Result<void, LocalStorageCacheError>;
15
+ has(key: string): Result<boolean, LocalStorageCacheError>;
16
+ clear(): Result<void, LocalStorageCacheError>;
17
+ keys(): Result<string[], LocalStorageCacheError>;
18
+ getOrSet<T>(key: string, factory: () => T): Result<T, LocalStorageCacheError>;
19
+ byPrefix(prefix: string): CacheAbstraction.Interface;
20
+ }
21
+ export declare const LocalStorageCache: typeof LocalStorageCacheImpl & {
22
+ __abstraction: import("@webiny/di").Abstraction<import("../../../common/index.js").ICache>;
23
+ };
24
+ export declare function createLocalStorageCache(): CacheAbstraction.Interface;
25
+ export {};
26
+ //# sourceMappingURL=LocalStorageCache.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"LocalStorageCache.d.ts","sourceRoot":"","sources":["../../../../src/browser/features/LocalStorageCache/LocalStorageCache.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAC3C,OAAO,EAAE,KAAK,IAAI,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AAC9D,OAAO,EACH,sBAAsB,EACtB,8BAA8B,EAC9B,4BAA4B,EAC/B,MAAM,aAAa,CAAC;AAErB,KAAK,sBAA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ParseError, LocalStorageQuotaExceededError, LocalStorageUnavailableError } from "./errors.js";
4
+ class LocalStorageCacheImpl {
5
+ prefix = "";
6
+ localStorage;
7
+ constructor() {
8
+ this.localStorage =
9
+ typeof window !== "undefined" && window?.localStorage ? window.localStorage : null;
10
+ }
11
+ static fromPrefix(prefix) {
12
+ const instance = new LocalStorageCacheImpl();
13
+ instance.prefix = prefix;
14
+ return instance;
15
+ }
16
+ prefixedKey(key) {
17
+ return this.prefix ? `${this.prefix}.${key}` : key;
18
+ }
19
+ unavailable() {
20
+ return Result.fail(new LocalStorageUnavailableError({
21
+ message: "localStorage is not available"
22
+ }));
23
+ }
24
+ get(key) {
25
+ if (!this.localStorage) {
26
+ return this.unavailable();
27
+ }
28
+ const raw = this.localStorage.getItem(this.prefixedKey(key));
29
+ if (raw === null) {
30
+ return Result.ok(null);
31
+ }
32
+ try {
33
+ return Result.ok(JSON.parse(raw));
34
+ }
35
+ catch {
36
+ return Result.fail(new LocalStorageParseError({
37
+ message: `Failed to parse cache entry for key "${key}"`,
38
+ data: { key }
39
+ }));
40
+ }
41
+ }
42
+ set(key, value) {
43
+ if (!this.localStorage) {
44
+ return this.unavailable();
45
+ }
46
+ const serialised = JSON.stringify(value);
47
+ try {
48
+ this.localStorage.setItem(this.prefixedKey(key), serialised);
49
+ return Result.ok();
50
+ }
51
+ catch {
52
+ return Result.fail(new LocalStorageQuotaExceededError({
53
+ message: `Storage quota exceeded for key "${key}"`,
54
+ data: { key, valueSize: serialised.length }
55
+ }));
56
+ }
57
+ }
58
+ remove(key) {
59
+ if (!this.localStorage) {
60
+ return this.unavailable();
61
+ }
62
+ this.localStorage.removeItem(this.prefixedKey(key));
63
+ return Result.ok();
64
+ }
65
+ has(key) {
66
+ if (!this.localStorage) {
67
+ return this.unavailable();
68
+ }
69
+ return Result.ok(this.localStorage.getItem(this.prefixedKey(key)) !== null);
70
+ }
71
+ clear() {
72
+ if (!this.localStorage) {
73
+ return this.unavailable();
74
+ }
75
+ if (this.prefix) {
76
+ const scopePrefix = `${this.prefix}.`;
77
+ const keysToRemove = [];
78
+ for (let i = 0; i < this.localStorage.length; i++) {
79
+ const k = this.localStorage.key(i);
80
+ if (k !== null && k.startsWith(scopePrefix)) {
81
+ keysToRemove.push(k);
82
+ }
83
+ }
84
+ for (const k of keysToRemove) {
85
+ this.localStorage.removeItem(k);
86
+ }
87
+ }
88
+ else {
89
+ this.localStorage.clear();
90
+ }
91
+ return Result.ok();
92
+ }
93
+ keys() {
94
+ if (!this.localStorage) {
95
+ return this.unavailable();
96
+ }
97
+ if (this.prefix) {
98
+ const scopePrefix = `${this.prefix}.`;
99
+ const result = [];
100
+ for (let i = 0; i < this.localStorage.length; i++) {
101
+ const k = this.localStorage.key(i);
102
+ if (k !== null && k.startsWith(scopePrefix)) {
103
+ result.push(k.slice(scopePrefix.length));
104
+ }
105
+ }
106
+ return Result.ok(result);
107
+ }
108
+ const result = [];
109
+ for (let i = 0; i < this.localStorage.length; i++) {
110
+ const k = this.localStorage.key(i);
111
+ if (k !== null) {
112
+ result.push(k);
113
+ }
114
+ }
115
+ return Result.ok(result);
116
+ }
117
+ getOrSet(key, factory) {
118
+ if (!this.localStorage) {
119
+ return this.unavailable();
120
+ }
121
+ const prefixed = this.prefixedKey(key);
122
+ const existing = this.localStorage.getItem(prefixed);
123
+ if (existing !== null) {
124
+ try {
125
+ return Result.ok(JSON.parse(existing));
126
+ }
127
+ catch {
128
+ return Result.fail(new LocalStorageParseError({
129
+ message: `Failed to parse cache entry for key "${key}"`,
130
+ data: { key }
131
+ }));
132
+ }
133
+ }
134
+ const value = factory();
135
+ const serialised = JSON.stringify(value);
136
+ try {
137
+ this.localStorage.setItem(prefixed, serialised);
138
+ }
139
+ catch {
140
+ return Result.fail(new LocalStorageQuotaExceededError({
141
+ message: `Storage quota exceeded for key "${key}"`,
142
+ data: { key, valueSize: serialised.length }
143
+ }));
144
+ }
145
+ return Result.ok(value);
146
+ }
147
+ byPrefix(prefix) {
148
+ const combined = this.prefix ? `${this.prefix}.${prefix}` : prefix;
149
+ return LocalStorageCacheImpl.fromPrefix(combined);
150
+ }
151
+ }
152
+ export const LocalStorageCache = CacheAbstraction.createImplementation({
153
+ implementation: LocalStorageCacheImpl,
154
+ dependencies: []
155
+ });
156
+ export function createLocalStorageCache() {
157
+ return new LocalStorageCacheImpl();
158
+ }
159
+ //# sourceMappingURL=LocalStorageCache.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"LocalStorageCache.js","sourceRoot":"","sources":["../../../../src/browser/features/LocalStorageCache/LocalStorageCache.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAC3C,OAAO,EAAE,KAAK,IAAI,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AAC9D,OAAO,EACH,sBAAsB,EACtB,8BAA8B,EAC9B,4BAA4B,EAC/B,MAAM,aAAa,CAAC;AAOrB,MAAM,qBAAqB;IACf,MAAM,GAAW,EAAE,CAAC;IAEX,YAAY,CAAiB;IAE9C;QACI,IAAI,CAAC,YAAY;YACb,OAAO,MAAM,KAAK,WAAW,IAAI,MAAM,EAAE,YAAY,CAAC,CAAC,CAAC,MAAM,CAAC,YAAY,CAAC,CAAC,CAAC,IAAI,CAAC;IAC3F,CAAC;IAEO,MAAM,CAAC,UAAU,CAAC,MAAc;QACpC,MAAM,QAAQ,GAAG,IAAI,qBAAqB,EAAE,CAAC;QAC7C,QAAQ,CAAC,MAAM,GAAG,MAAM,CAAC;QACzB,OAAO,QAAQ,CAAC;IACpB,CAAC;IAEO,WAAW,CAAC,GAAW;QAC3B,OAAO,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,GAAG,IAAI,CAAC,MAAM,IAAI,GAAG,EAAE,CAAC,CAAC,CAAC,GAAG,CAAC;IACvD,CAAC;IAEO,WAAW;QACf,OAAO,MAAM,CAAC,IAAI,CACd,IAAI,4BAA4B,CAAC;YAC7B,OAAO,EAAE,+BAA+B;SAC3C,CAAC,CAC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AAK,CAAC,CAAC;IAC5B,CAAC;IAEM,QAAQ,CAAC,MAAc;QAC1B,MAAM,QAAQ,GAAG,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,GAAG,IAAI,CAAC,MAAM,IAAI,MAAM,EAAE,CAAC,CAAC,CAAC,MAAM,CAAC;QACnE,OAAO,qBAAqB,CAAC,UAAU,CAAC,QAAQ,CAAC,CAAC;IACtD,CAAC;CACJ;AAED,MAAM,CAAC,MAAM,iBAAiB,GAAG,gBAAgB,CAAC,oBAAoB,CAAC;IACnE,cAAc,EAAE,qBAAqB;IACrC,YAAY,EAAE,EAAE;CACnB,CAAC,CAAC;AAEH,MAAM,UAAU,uBAAuB;IACnC,OAAO,IAAI,qBAAqB,EAAE,CAAC;AACvC,CAAC"}
@@ -0,0 +1,26 @@
1
+ import { CacheError } from "../../../common/index.js";
2
+ import type { ErrorInput } from "../../../common/index.js";
3
+ interface ParseErrorData {
4
+ key: string;
5
+ }
6
+ interface QuotaExceededData {
7
+ key: string;
8
+ valueSize: number;
9
+ }
10
+ /** Thrown when JSON.parse fails on a stored cache entry. */
11
+ export declare class LocalStorageParseError extends CacheError<ParseErrorData> {
12
+ readonly code: "PARSE_ERROR";
13
+ constructor(input: ErrorInput<ParseErrorData>);
14
+ }
15
+ /** Thrown when localStorage.setItem throws a QuotaExceededError. */
16
+ export declare class LocalStorageQuotaExceededError extends CacheError<QuotaExceededData> {
17
+ readonly code: "QUOTA_EXCEEDED";
18
+ constructor(input: ErrorInput<QuotaExceededData>);
19
+ }
20
+ /** Thrown when window.localStorage is not available (e.g. SSR, security restrictions). */
21
+ export declare class LocalStorageUnavailableError extends CacheError {
22
+ readonly code: "STORAGE_UNAVAILABLE";
23
+ constructor(input: ErrorInput);
24
+ }
25
+ export {};
26
+ //# sourceMappingURL=errors.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../../../../src/browser/features/LocalStorageCache/errors.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAC/C,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAEpD,UAAU,cAAc;IACpB,GAAG,EAAE,MAAM,CAAC;CACf;AAED,UAAU,iBAAiB;IACvB,GAAG,EAAE,MAAM,CAAC;IACZ,SAAS,EAAE,MAAM,CAAC;CACrB;AAED,4DAA4D;AAC5D,qBAAa,sBAAuB,SAAQ,UAAU,CAAC,cAAc,CAAC;IAClE,SAAgB,IAAI,EAAG,aAAa,CAAU;IAC9C,YAAmB,KAAK,EAAE,UAAU,CAAC,cAAc,CAAC,EAEnD;CACJ;AAED,oEAAoE;AACpE,qBAAa,8BAA+B,SAAQ,UAAU,CAAC,iBAAiB,CAAC;IAC7E,SAAgB,IAAI,EAAG,gBAAgB,CAAU;IACjD,YAAmB,KAAK,EAAE,UAAU,CAAC,iBAAiB,CAAC,EAEtD;CACJ;AAED,0FAA0F;AAC1F,qBAAa,4BAA6B,SAAQ,UAAU;IACxD,SAAgB,IAAI,EAAG,qBAAqB,CAAU;IACtD,YAAmB,KAAK,EAAE,UAAU,EAEnC;CACJ"}
@@ -0,0 +1,23 @@
1
+ import { CacheError } from "../../../common/index.js";
2
+ /** Thrown when JSON.parse fails on a stored cache entry. */
3
+ export class LocalStorageParseError extends CacheError {
4
+ code = "PARSE_ERROR";
5
+ constructor(input) {
6
+ super(input);
7
+ }
8
+ }
9
+ /** Thrown when localStorage.setItem throws a QuotaExceededError. */
10
+ export class LocalStorageQuotaExceededError extends CacheError {
11
+ code = "QUOTA_EXCEEDED";
12
+ constructor(input) {
13
+ super(input);
14
+ }
15
+ }
16
+ /** Thrown when window.localStorage is not available (e.g. SSR, security restrictions). */
17
+ export class LocalStorageUnavailableError extends CacheError {
18
+ code = "STORAGE_UNAVAILABLE";
19
+ constructor(input) {
20
+ super(input);
21
+ }
22
+ }
23
+ //# sourceMappingURL=errors.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"errors.js","sourceRoot":"","sources":["../../../../src/browser/features/LocalStorageCache/errors.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAY/C,4DAA4D;AAC5D,MAAM,OAAO,sBAAuB,SAAQ,UAA0B;IAClD,IAAI,GAAG,aAAsB,CAAC;IAC9C,YAAmB,KAAiC;QAChD,KAAK,CAAC,KAAK,CAAC,CAAC;IACjB,CAAC;CACJ;AAED,oEAAoE;AACpE,MAAM,OAAO,8BAA+B,SAAQ,UAA6B;IAC7D,IAAI,GAAG,gBAAyB,CAAC;IACjD,YAAmB,KAAoC;QACnD,KAAK,CAAC,KAAK,CAAC,CAAC;IACjB,CAAC;CACJ;AAED,0FAA0F;AAC1F,MAAM,OAAO,4BAA6B,SAAQ,UAAU;IACxC,IAAI,GAAG,qBAA8B,CAAC;IACtD,YAAmB,KAAiB;QAChC,KAAK,CAAC,KAAK,CAAC,CAAC;IACjB,CAAC;CACJ"}
@@ -0,0 +1,6 @@
1
+ /** Registers LocalStorageCache as the Cache implementation. */
2
+ export declare const LocalStorageCacheFeature: {
3
+ name: string;
4
+ register(container: import("@webiny/di").Container): void;
5
+ };
6
+ //# sourceMappingURL=feature.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"feature.d.ts","sourceRoot":"","sources":["../../../../src/browser/features/LocalStorageCache/feature.ts"],"names":[],"mappings":"AAGA,+DAA+D;AAC/D,eAAO,MAAM,wBAAwB;;;CAKnC,CAAC"}
@@ -0,0 +1,10 @@
1
+ import { createFeature } from "../../../common/index.js";
2
+ import { LocalStorageCache } from "./LocalStorageCache.js";
3
+ /** Registers LocalStorageCache as the Cache implementation. */
4
+ export const LocalStorageCacheFeature = createFeature({
5
+ name: "Browser/LocalStorageCacheFeature",
6
+ register(container) {
7
+ container.register(LocalStorageCache).inSingletonScope();
8
+ }
9
+ });
10
+ //# sourceMappingURL=feature.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"feature.js","sourceRoot":"","sources":["../../../../src/browser/features/LocalStorageCache/feature.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAClD,OAAO,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAE3D,+DAA+D;AAC/D,MAAM,CAAC,MAAM,wBAAwB,GAAG,aAAa,CAAC;IAClD,IAAI,EAAE,kCAAkC;IACxC,QAAQ,CAAC,SAAS;QACd,SAAS,CAAC,QAAQ,CAAC,iBAAiB,CAAC,CAAC,gBAAgB,EAAE,CAAC;IAC7D,CAAC;CACJ,CAAC,CAAC"}
@@ -0,0 +1,4 @@
1
+ export { LocalStorageCacheFeature } from "./feature.js";
2
+ export { createLocalStorageCache } from "./LocalStorageCache.js";
3
+ export { LocalStorageParseError, LocalStorageQuotaExceededError, LocalStorageUnavailableError } from "./errors.js";
4
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/browser/features/LocalStorageCache/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,wBAAwB,EAAE,MAAM,cAAc,CAAC;AACxD,OAAO,EAAE,uBAAuB,EAAE,MAAM,wBAAwB,CAAC;AACjE,OAAO,EACH,sBAAsB,EACtB,8BAA8B,EAC9B,4BAA4B,EAC/B,MAAM,aAAa,CAAC"}
@@ -0,0 +1,4 @@
1
+ export { LocalStorageCacheFeature } from "./feature.js";
2
+ export { createLocalStorageCache } from "./LocalStorageCache.js";
3
+ export { LocalStorageParseError, LocalStorageQuotaExceededError, LocalStorageUnavailableError } from "./errors.js";
4
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/browser/features/LocalStorageCache/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,wBAAwB,EAAE,MAAM,cAAc,CAAC;AACxD,OAAO,EAAE,uBAAuB,EAAE,MAAM,wBAAwB,CAAC;AACjE,OAAO,EACH,sBAAsB,EACtB,8BAA8B,EAC9B,4BAA4B,EAC/B,MAAM,aAAa,CAAC"}
@@ -0,0 +1,2 @@
1
+ export { LocalStorageCacheFeature, createLocalStorageCache, LocalStorageParseError, LocalStorageQuotaExceededError, LocalStorageUnavailableError } from "./features/LocalStorageCache/index.js";
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/browser/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACH,wBAAwB,EACxB,uBAAuB,EACvB,sBAAsB,EACtB,8BAA8B,EAC9B,4BAA4B,EAC/B,MAAM,uCAAuC,CAAC"}
@@ -0,0 +1,2 @@
1
+ export { LocalStorageCacheFeature, createLocalStorageCache, LocalStorageParseError, LocalStorageQuotaExceededError, LocalStorageUnavailableError } from "./features/LocalStorageCache/index.js";
2
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/browser/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACH,wBAAwB,EACxB,uBAAuB,EACvB,sBAAsB,EACtB,8BAA8B,EAC9B,4BAA4B,EAC/B,MAAM,uCAAuC,CAAC"}
@@ -0,0 +1,13 @@
1
+ export type ErrorInput<TData = void> = TData extends void ? {
2
+ message: string;
3
+ data?: never;
4
+ } : {
5
+ message: string;
6
+ data: TData;
7
+ };
8
+ export declare abstract class BaseError<TData = void> extends Error {
9
+ abstract readonly code: string;
10
+ readonly data: TData extends void ? undefined : TData;
11
+ protected constructor(input: ErrorInput<TData>);
12
+ }
13
+ //# sourceMappingURL=BaseError.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"BaseError.d.ts","sourceRoot":"","sources":["../../../src/common/core/BaseError.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,UAAU,CAAC,KAAK,GAAG,IAAI,IAAI,KAAK,SAAS,IAAI,GACnD;IAAE,OAAO,EAAE,MAAM,CAAC;IAAC,IAAI,CAAC,EAAE,KAAK,CAAA;CAAE,GACjC;IAAE,OAAO,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,KAAK,CAAA;CAAE,CAAC;AAEvC,8BAAsB,SAAS,CAAC,KAAK,GAAG,IAAI,CAAE,SAAQ,KAAK;IACvD,kBAAyB,IAAI,EAAE,MAAM,CAAC;IACtC,SAAgB,IAAI,EAAE,KAAK,SAAS,IAAI,GAAG,SAAS,GAAG,KAAK,CAAC;IAE7D,SAAS,aAAa,KAAK,EAAE,UAAU,CAAC,KAAK,CAAC,EAG7C;CACJ"}
@@ -0,0 +1,8 @@
1
+ export class BaseError extends Error {
2
+ data;
3
+ constructor(input) {
4
+ super(input.message);
5
+ this.data = input.data;
6
+ }
7
+ }
8
+ //# sourceMappingURL=BaseError.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"BaseError.js","sourceRoot":"","sources":["../../../src/common/core/BaseError.ts"],"names":[],"mappings":"AAIA,MAAM,OAAgB,SAAwB,SAAQ,KAAK;IAEvC,IAAI,CAAyC;IAE7D,YAAsB,KAAwB;QAC1C,KAAK,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;QACrB,IAAI,CAAC,IAAI,GAAG,KAAK,CAAC,IAAW,CAAC;IAClC,CAAC;CACJ"}
@@ -0,0 +1,103 @@
1
+ /**
2
+ * A container type that represents either a successful result (`ok`) or a failure (`fail`).
3
+ * Inspired by functional programming constructs like `Either` or `Result` in other languages.
4
+ *
5
+ * @template TValue - The type of the success value.
6
+ * @template TError - The type of the error value.
7
+ */
8
+ export declare class Result<TValue, TError = never> {
9
+ protected readonly _isOk: boolean;
10
+ protected readonly _value?: TValue;
11
+ protected readonly _error?: TError;
12
+ private constructor();
13
+ /**
14
+ * Creates a successful `Result` containing the provided value.
15
+ * If no value is provided, returns Result<void, never>.
16
+ *
17
+ * @param value - The value to wrap in a successful result (optional).
18
+ * @returns A `Result` instance with the value.
19
+ */
20
+ static ok<T>(value: T): Result<T, never>;
21
+ static ok(): Result<void, never>;
22
+ /**
23
+ * Creates a failed `Result` containing the provided error.
24
+ *
25
+ * @param error - The error to wrap in a failed result.
26
+ * @returns A `Result` instance with the error.
27
+ */
28
+ static fail<E>(error: E): Result<never, E>;
29
+ /**
30
+ * Checks whether the result is successful.
31
+ *
32
+ * @returns `true` if the result is `ok`, otherwise `false`.
33
+ * Acts as a type guard to narrow the type to a successful result.
34
+ */
35
+ isOk(): this is {
36
+ _value: TValue;
37
+ } & Result<TValue, TError>;
38
+ /**
39
+ * Checks whether the result is a failure.
40
+ *
41
+ * @returns `true` if the result is `fail`, otherwise `false`.
42
+ * Acts as a type guard to narrow the type to a failed result.
43
+ */
44
+ isFail(): this is {
45
+ _error: TError;
46
+ } & Result<TValue, TError>;
47
+ /**
48
+ * Gets the value inside a successful result.
49
+ *
50
+ * @throws If the result is a failure.
51
+ * @returns The success value.
52
+ */
53
+ get value(): TValue;
54
+ /**
55
+ * Gets the error inside a failed result.
56
+ *
57
+ * @throws If the result is successful.
58
+ * @returns The error value.
59
+ */
60
+ get error(): TError;
61
+ /**
62
+ * Transforms the success value using the provided mapping function.
63
+ *
64
+ * @template U - The type of the new success value.
65
+ * @param fn - Function to apply to the value if the result is successful.
66
+ * @returns A new `Result` containing the mapped value, or the original error if failed.
67
+ */
68
+ map<U>(fn: (value: TValue) => U): Result<U, TError>;
69
+ /**
70
+ * Transforms the error value using the provided mapping function.
71
+ *
72
+ * @template F - The type of the new error.
73
+ * @param fn - Function to apply to the error if the result is a failure.
74
+ * @returns A new `Result` containing the original value or the mapped error.
75
+ */
76
+ mapError<F>(fn: (error: TError) => F): Result<TValue, F>;
77
+ /**
78
+ * Chains another `Result`-producing function onto this result.
79
+ * If this result is successful, the function is applied to the value.
80
+ * If this result is a failure, the original error is returned.
81
+ *
82
+ * @template U - The type of the next success value.
83
+ * @param fn - A function that takes the current value and returns another `Result`.
84
+ * @returns A new `Result` from applying the function or the original failure.
85
+ */
86
+ flatMap<U>(fn: (value: TValue) => Result<U, TError>): Result<U, TError>;
87
+ /**
88
+ * Pattern-matches the result to handle both success and failure cases.
89
+ *
90
+ * @template U - The return type of both match functions.
91
+ * @param handlers - An object containing `ok` and `fail` handlers.
92
+ * @returns The return value from the corresponding handler.
93
+ */
94
+ match<U>(handlers: {
95
+ ok: (value: TValue) => U;
96
+ fail: (error: TError) => U;
97
+ }): U;
98
+ }
99
+ export declare namespace Result {
100
+ type UnwrapResult<T> = Awaited<T> extends Result<infer Ok, any> ? Ok : never;
101
+ type UnwrapError<T> = Awaited<T> extends Result<any, infer Err> ? Err : never;
102
+ }
103
+ //# sourceMappingURL=Result.d.ts.map