@effect-app/infra 0.7.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 (438) hide show
  1. package/.eslintrc.cjs +11 -0
  2. package/.jest-cache/haste-map-369fa5ca2164cc35b19159bd76147276-e7a7ff05756c055cb63be97ba8537525-314902b6271c341511f7398a50469024 +0 -0
  3. package/.jest-cache/haste-map-369fa5ca2164cc35b19159bd76147276-e7a7ff05756c055cb63be97ba8537525-3f072cc7afa09b6adaead0527ab9df83 +0 -0
  4. package/.jest-cache/haste-map-369fa5ca2164cc35b19159bd76147276-e7a7ff05756c055cb63be97ba8537525-74c3c295c110fc861b6a4c673afc3e24 +0 -0
  5. package/.jest-cache/haste-map-369fa5ca2164cc35b19159bd76147276-e7a7ff05756c055cb63be97ba8537525-bf6dae8cb9ea9740ceb39aefaf12716c +0 -0
  6. package/.jest-cache/haste-map-369fa5ca2164cc35b19159bd76147276-e7a7ff05756c055cb63be97ba8537525-cf9d1486029526079a5f68f2041dea02 +0 -0
  7. package/.jest-cache/haste-map-4ca41cc04e60c616a19cbb483cbf487b-e2f1f4b6d87214e3c49442fed31f310c-b4710ed9fb3d0757c4bf23045c585670 +0 -0
  8. package/.jest-cache/haste-map-4ca41cc04e60c616a19cbb483cbf487b-e2f1f4b6d87214e3c49442fed31f310c-ee17e5395bb1b7b36a4e2e22a6ae1449 +0 -0
  9. package/.jest-cache/haste-map-7dc16d7fae8c072843ed1c69eae73100-a8a4225b317477b49bca31f54559afb3-c16136699bb7f463be85273162b447c3 +0 -0
  10. package/.jest-cache/haste-map-9aa1e395a82e108eb49698982c574272-e2f1f4b6d87214e3c49442fed31f310c-f7435f46fc41ac5a13d06a49cae9a650 +0 -0
  11. package/.jest-cache/haste-map-9d206b45d610536c9ec65eec263c6964-a8a4225b317477b49bca31f54559afb3-3510506a330b44f1ae629033aac8fbb3 +0 -0
  12. package/.jest-cache/haste-map-a00ab30d0d656f9d3990958a54b9ccfd-87603b0fc921b26b622a5859b4c92bed-17b550b450b18840c25861aa6e835f0c +0 -0
  13. package/.jest-cache/haste-map-a00ab30d0d656f9d3990958a54b9ccfd-87603b0fc921b26b622a5859b4c92bed-4dc31290b1efc98335eb4c89167d75c3 +0 -0
  14. package/.jest-cache/haste-map-ab843cb0ffbadfd0deea4adb182c7ecd-87603b0fc921b26b622a5859b4c92bed-997106edf4bbc31567a378146180e45e +0 -0
  15. package/.jest-cache/haste-map-ab843cb0ffbadfd0deea4adb182c7ecd-87603b0fc921b26b622a5859b4c92bed-f0cd25414f9ed16c446940ca3aa23c1b +0 -0
  16. package/.jest-cache/haste-map-cf17f2edf0e949eebfdfca561816457c-e7a7ff05756c055cb63be97ba8537525-2cac07d09e6384e2d37c49714edad0ba +0 -0
  17. package/.jest-cache/haste-map-cf17f2edf0e949eebfdfca561816457c-e7a7ff05756c055cb63be97ba8537525-d7967c2976c5feac7161c964f0aa442f +0 -0
  18. package/.jest-cache/haste-map-fb1a173276d25bbff02f815600059283-938122bdc1c8836874b6585d7acb2e99-f705929cca05ce95ceaa6d520b560ce8 +0 -0
  19. package/.prettierignore +6 -0
  20. package/_cjs/_global.cjs +6 -0
  21. package/_cjs/_global.cjs.map +1 -0
  22. package/_cjs/_global.ext.cjs +6 -0
  23. package/_cjs/_global.ext.cjs.map +1 -0
  24. package/_cjs/_global.schema.cjs +5 -0
  25. package/_cjs/_global.schema.cjs.map +1 -0
  26. package/_cjs/errors.cjs +82 -0
  27. package/_cjs/errors.cjs.map +1 -0
  28. package/_cjs/ext.cjs +4 -0
  29. package/_cjs/ext.cjs.map +1 -0
  30. package/_cjs/index.cjs +6 -0
  31. package/_cjs/index.cjs.map +1 -0
  32. package/_cjs/lib/RequestContext.cjs +70 -0
  33. package/_cjs/lib/RequestContext.cjs.map +1 -0
  34. package/_cjs/lib/api/authorization.jwt.cjs +44 -0
  35. package/_cjs/lib/api/authorization.jwt.cjs.map +1 -0
  36. package/_cjs/lib/api/defaultErrorHandler.cjs +45 -0
  37. package/_cjs/lib/api/defaultErrorHandler.cjs.map +1 -0
  38. package/_cjs/lib/api/reportError.cjs +64 -0
  39. package/_cjs/lib/api/reportError.cjs.map +1 -0
  40. package/_cjs/lib/api/routing.cjs +262 -0
  41. package/_cjs/lib/api/routing.cjs.map +1 -0
  42. package/_cjs/lib/api/setupRequest.cjs +35 -0
  43. package/_cjs/lib/api/setupRequest.cjs.map +1 -0
  44. package/_cjs/lib/api/util.cjs +17 -0
  45. package/_cjs/lib/api/util.cjs.map +1 -0
  46. package/_cjs/lib/api/writeDocs.cjs +31 -0
  47. package/_cjs/lib/api/writeDocs.cjs.map +1 -0
  48. package/_cjs/lib/errorReporter.cjs +72 -0
  49. package/_cjs/lib/errorReporter.cjs.map +1 -0
  50. package/_cjs/lib/ext/Array.cjs +30 -0
  51. package/_cjs/lib/ext/Array.cjs.map +1 -0
  52. package/_cjs/lib/fileUtil.cjs +36 -0
  53. package/_cjs/lib/fileUtil.cjs.map +1 -0
  54. package/_cjs/lib/filter/types/errors.cjs +6 -0
  55. package/_cjs/lib/filter/types/errors.cjs.map +1 -0
  56. package/_cjs/lib/filter/types/fields.cjs +6 -0
  57. package/_cjs/lib/filter/types/fields.cjs.map +1 -0
  58. package/_cjs/lib/filter/types/index.cjs +61 -0
  59. package/_cjs/lib/filter/types/index.cjs.map +1 -0
  60. package/_cjs/lib/filter/types/path/common.cjs +6 -0
  61. package/_cjs/lib/filter/types/path/common.cjs.map +1 -0
  62. package/_cjs/lib/filter/types/path/eager.cjs +6 -0
  63. package/_cjs/lib/filter/types/path/eager.cjs.map +1 -0
  64. package/_cjs/lib/filter/types/path/index.cjs +8 -0
  65. package/_cjs/lib/filter/types/path/index.cjs.map +1 -0
  66. package/_cjs/lib/filter/types/utils.cjs +6 -0
  67. package/_cjs/lib/filter/types/utils.cjs.map +1 -0
  68. package/_cjs/lib/filter/types/validator.cjs +6 -0
  69. package/_cjs/lib/filter/types/validator.cjs.map +1 -0
  70. package/_cjs/lib/filter.cjs +238 -0
  71. package/_cjs/lib/filter.cjs.map +1 -0
  72. package/_cjs/lib/instrument.cjs +20 -0
  73. package/_cjs/lib/instrument.cjs.map +1 -0
  74. package/_cjs/lib/rateLimit.cjs +88 -0
  75. package/_cjs/lib/rateLimit.cjs.map +1 -0
  76. package/_cjs/services/CUPS/service.cjs +15 -0
  77. package/_cjs/services/CUPS/service.cjs.map +1 -0
  78. package/_cjs/services/CUPS.cjs +113 -0
  79. package/_cjs/services/CUPS.cjs.map +1 -0
  80. package/_cjs/services/Cache.cjs +39 -0
  81. package/_cjs/services/Cache.cjs.map +1 -0
  82. package/_cjs/services/Emailer/Sendgrid.cjs +112 -0
  83. package/_cjs/services/Emailer/Sendgrid.cjs.map +1 -0
  84. package/_cjs/services/Emailer/fake.cjs +24 -0
  85. package/_cjs/services/Emailer/fake.cjs.map +1 -0
  86. package/_cjs/services/Emailer/service.cjs +12 -0
  87. package/_cjs/services/Emailer/service.cjs.map +1 -0
  88. package/_cjs/services/Emailer.cjs +17 -0
  89. package/_cjs/services/Emailer.cjs.map +1 -0
  90. package/_cjs/services/Repository.cjs +247 -0
  91. package/_cjs/services/Repository.cjs.map +1 -0
  92. package/_cjs/services/ServiceBus.cjs +69 -0
  93. package/_cjs/services/ServiceBus.cjs.map +1 -0
  94. package/_cjs/services/Store/Cosmos.cjs +324 -0
  95. package/_cjs/services/Store/Cosmos.cjs.map +1 -0
  96. package/_cjs/services/Store/Cosmos.test.cjs +59 -0
  97. package/_cjs/services/Store/Cosmos.test.cjs.map +1 -0
  98. package/_cjs/services/Store/Disk.cjs +62 -0
  99. package/_cjs/services/Store/Disk.cjs.map +1 -0
  100. package/_cjs/services/Store/Memory.cjs +70 -0
  101. package/_cjs/services/Store/Memory.cjs.map +1 -0
  102. package/_cjs/services/Store/Redis.cjs +72 -0
  103. package/_cjs/services/Store/Redis.cjs.map +1 -0
  104. package/_cjs/services/Store/codeFilter.test.cjs +61 -0
  105. package/_cjs/services/Store/codeFilter.test.cjs.map +1 -0
  106. package/_cjs/services/Store/index.cjs +72 -0
  107. package/_cjs/services/Store/index.cjs.map +1 -0
  108. package/_cjs/services/Store/service.cjs +72 -0
  109. package/_cjs/services/Store/service.cjs.map +1 -0
  110. package/_cjs/services/Store/utils.cjs +78 -0
  111. package/_cjs/services/Store/utils.cjs.map +1 -0
  112. package/_cjs/services/Store.cjs +17 -0
  113. package/_cjs/services/Store.cjs.map +1 -0
  114. package/_cjs/services/memQueue.cjs +32 -0
  115. package/_cjs/services/memQueue.cjs.map +1 -0
  116. package/_cjs/test.arbs.cjs +32 -0
  117. package/_cjs/test.arbs.cjs.map +1 -0
  118. package/_cjs/vendor/Cache/Cache/_internal/AtomicBoolean.cjs +14 -0
  119. package/_cjs/vendor/Cache/Cache/_internal/AtomicBoolean.cjs.map +1 -0
  120. package/_cjs/vendor/Cache/Cache/_internal/AtomicNumber.cjs +29 -0
  121. package/_cjs/vendor/Cache/Cache/_internal/AtomicNumber.cjs.map +1 -0
  122. package/_cjs/vendor/Cache/Cache/_internal/AtomicReference.cjs +32 -0
  123. package/_cjs/vendor/Cache/Cache/_internal/AtomicReference.cjs.map +1 -0
  124. package/_cjs/vendor/Cache/Cache/_internal/CacheInternal.cjs +266 -0
  125. package/_cjs/vendor/Cache/Cache/_internal/CacheInternal.cjs.map +1 -0
  126. package/_cjs/vendor/Cache/Cache/_internal/CacheState.cjs +31 -0
  127. package/_cjs/vendor/Cache/Cache/_internal/CacheState.cjs.map +1 -0
  128. package/_cjs/vendor/Cache/Cache/_internal/KeySet.cjs +67 -0
  129. package/_cjs/vendor/Cache/Cache/_internal/KeySet.cjs.map +1 -0
  130. package/_cjs/vendor/Cache/Cache/_internal/MapKey.cjs +44 -0
  131. package/_cjs/vendor/Cache/Cache/_internal/MapKey.cjs.map +1 -0
  132. package/_cjs/vendor/Cache/Cache/_internal/MapValue.cjs +33 -0
  133. package/_cjs/vendor/Cache/Cache/_internal/MapValue.cjs.map +1 -0
  134. package/_cjs/vendor/Cache/Cache/definition.cjs +13 -0
  135. package/_cjs/vendor/Cache/Cache/definition.cjs.map +1 -0
  136. package/_cjs/vendor/Cache/Cache/operations/make.cjs +20 -0
  137. package/_cjs/vendor/Cache/Cache/operations/make.cjs.map +1 -0
  138. package/_cjs/vendor/Cache/Cache/operations/makeWith.cjs +23 -0
  139. package/_cjs/vendor/Cache/Cache/operations/makeWith.cjs.map +1 -0
  140. package/_cjs/vendor/Cache/Cache/operations.cjs +28 -0
  141. package/_cjs/vendor/Cache/Cache/operations.cjs.map +1 -0
  142. package/_cjs/vendor/Cache/Cache.cjs +28 -0
  143. package/_cjs/vendor/Cache/Cache.cjs.map +1 -0
  144. package/_cjs/vendor/Cache/CacheStats/definition.cjs +13 -0
  145. package/_cjs/vendor/Cache/CacheStats/definition.cjs.map +1 -0
  146. package/_cjs/vendor/Cache/CacheStats.cjs +17 -0
  147. package/_cjs/vendor/Cache/CacheStats.cjs.map +1 -0
  148. package/_cjs/vendor/Cache/EntryStats/definition.cjs +11 -0
  149. package/_cjs/vendor/Cache/EntryStats/definition.cjs.map +1 -0
  150. package/_cjs/vendor/Cache/EntryStats.cjs +17 -0
  151. package/_cjs/vendor/Cache/EntryStats.cjs.map +1 -0
  152. package/_cjs/vendor/Cache/Lookup/definition.cjs +6 -0
  153. package/_cjs/vendor/Cache/Lookup/definition.cjs.map +1 -0
  154. package/_cjs/vendor/Cache/Lookup.cjs +17 -0
  155. package/_cjs/vendor/Cache/Lookup.cjs.map +1 -0
  156. package/_cjs/vendor/Cache/index.cjs +17 -0
  157. package/_cjs/vendor/Cache/index.cjs.map +1 -0
  158. package/_src/_global.ext.ts +34 -0
  159. package/_src/_global.schema.ts +10 -0
  160. package/_src/_global.ts +14 -0
  161. package/_src/errors.ts +50 -0
  162. package/_src/ext.ts +1 -0
  163. package/_src/index.ts +0 -0
  164. package/_src/lib/RequestContext.ts +132 -0
  165. package/_src/lib/api/authorization.jwt.ts +52 -0
  166. package/_src/lib/api/defaultErrorHandler.ts +92 -0
  167. package/_src/lib/api/reportError.ts +50 -0
  168. package/_src/lib/api/routing.ts +623 -0
  169. package/_src/lib/api/setupRequest.ts +22 -0
  170. package/_src/lib/api/util.ts +14 -0
  171. package/_src/lib/api/writeDocs.ts +26 -0
  172. package/_src/lib/errorReporter.ts +63 -0
  173. package/_src/lib/ext/Array.ts +32 -0
  174. package/_src/lib/fileUtil.ts +56 -0
  175. package/_src/lib/filter/types/errors.ts +47 -0
  176. package/_src/lib/filter/types/fields.ts +50 -0
  177. package/_src/lib/filter/types/index.ts +5 -0
  178. package/_src/lib/filter/types/path/common.ts +404 -0
  179. package/_src/lib/filter/types/path/eager.ts +146 -0
  180. package/_src/lib/filter/types/path/index.ts +14 -0
  181. package/_src/lib/filter/types/utils.ts +106 -0
  182. package/_src/lib/filter/types/validator.ts +46 -0
  183. package/_src/lib/filter.ts +323 -0
  184. package/_src/lib/instrument.ts +9 -0
  185. package/_src/lib/rateLimit.ts +126 -0
  186. package/_src/services/CUPS/service.ts +16 -0
  187. package/_src/services/CUPS.ts +105 -0
  188. package/_src/services/Cache.ts +45 -0
  189. package/_src/services/Emailer/Sendgrid.ts +123 -0
  190. package/_src/services/Emailer/fake.ts +14 -0
  191. package/_src/services/Emailer/service.ts +33 -0
  192. package/_src/services/Emailer.ts +1 -0
  193. package/_src/services/Repository.ts +513 -0
  194. package/_src/services/ServiceBus.ts +111 -0
  195. package/_src/services/Store/Cosmos.test.ts +91 -0
  196. package/_src/services/Store/Cosmos.ts +545 -0
  197. package/_src/services/Store/Disk.ts +81 -0
  198. package/_src/services/Store/Memory.ts +77 -0
  199. package/_src/services/Store/Redis.ts +92 -0
  200. package/_src/services/Store/codeFilter.test.ts +74 -0
  201. package/_src/services/Store/index.test.ts.bak +112 -0
  202. package/_src/services/Store/index.ts +62 -0
  203. package/_src/services/Store/service.ts +174 -0
  204. package/_src/services/Store/utils.ts +126 -0
  205. package/_src/services/Store.ts +1 -0
  206. package/_src/services/memQueue.ts +30 -0
  207. package/_src/test.arbs.ts +27 -0
  208. package/_src/vendor/Cache/Cache/_internal/AtomicBoolean.ts +7 -0
  209. package/_src/vendor/Cache/Cache/_internal/AtomicNumber.ts +28 -0
  210. package/_src/vendor/Cache/Cache/_internal/AtomicReference.ts +30 -0
  211. package/_src/vendor/Cache/Cache/_internal/CacheInternal.ts +293 -0
  212. package/_src/vendor/Cache/Cache/_internal/CacheState.ts +56 -0
  213. package/_src/vendor/Cache/Cache/_internal/KeySet.ts +58 -0
  214. package/_src/vendor/Cache/Cache/_internal/MapKey.ts +43 -0
  215. package/_src/vendor/Cache/Cache/_internal/MapValue.ts +39 -0
  216. package/_src/vendor/Cache/Cache/definition.ts +112 -0
  217. package/_src/vendor/Cache/Cache/operations/make.ts +17 -0
  218. package/_src/vendor/Cache/Cache/operations/makeWith.ts +32 -0
  219. package/_src/vendor/Cache/Cache/operations.ts +4 -0
  220. package/_src/vendor/Cache/Cache.ts +4 -0
  221. package/_src/vendor/Cache/CacheStats/definition.ts +23 -0
  222. package/_src/vendor/Cache/CacheStats.ts +3 -0
  223. package/_src/vendor/Cache/EntryStats/definition.ts +19 -0
  224. package/_src/vendor/Cache/EntryStats.ts +3 -0
  225. package/_src/vendor/Cache/Lookup/definition.ts +15 -0
  226. package/_src/vendor/Cache/Lookup.ts +3 -0
  227. package/_src/vendor/Cache/global.ts.bak +23 -0
  228. package/_src/vendor/Cache/index.ts +4 -0
  229. package/dist/_global.d.ts +10 -0
  230. package/dist/_global.d.ts.map +1 -0
  231. package/dist/_global.ext.d.ts +34 -0
  232. package/dist/_global.ext.d.ts.map +1 -0
  233. package/dist/_global.ext.js +2 -0
  234. package/dist/_global.js +12 -0
  235. package/dist/_global.schema.d.ts +6 -0
  236. package/dist/_global.schema.d.ts.map +1 -0
  237. package/dist/_global.schema.js +9 -0
  238. package/dist/errors.d.ts +41 -0
  239. package/dist/errors.d.ts.map +1 -0
  240. package/dist/errors.js +51 -0
  241. package/dist/ext.d.ts +2 -0
  242. package/dist/ext.d.ts.map +1 -0
  243. package/dist/ext.js +2 -0
  244. package/dist/index.d.ts +2 -0
  245. package/dist/index.d.ts.map +1 -0
  246. package/dist/index.js +2 -0
  247. package/dist/lib/RequestContext.d.ts +122 -0
  248. package/dist/lib/RequestContext.d.ts.map +1 -0
  249. package/dist/lib/RequestContext.js +52 -0
  250. package/dist/lib/api/authorization.jwt.d.ts +7 -0
  251. package/dist/lib/api/authorization.jwt.d.ts.map +1 -0
  252. package/dist/lib/api/authorization.jwt.js +32 -0
  253. package/dist/lib/api/defaultErrorHandler.d.ts +8 -0
  254. package/dist/lib/api/defaultErrorHandler.d.ts.map +1 -0
  255. package/dist/lib/api/defaultErrorHandler.js +37 -0
  256. package/dist/lib/api/reportError.d.ts +32 -0
  257. package/dist/lib/api/reportError.d.ts.map +1 -0
  258. package/dist/lib/api/reportError.js +44 -0
  259. package/dist/lib/api/routing.d.ts +100 -0
  260. package/dist/lib/api/routing.d.ts.map +1 -0
  261. package/dist/lib/api/routing.js +248 -0
  262. package/dist/lib/api/setupRequest.d.ts +13 -0
  263. package/dist/lib/api/setupRequest.d.ts.map +1 -0
  264. package/dist/lib/api/setupRequest.js +25 -0
  265. package/dist/lib/api/util.d.ts +3 -0
  266. package/dist/lib/api/util.d.ts.map +1 -0
  267. package/dist/lib/api/util.js +14 -0
  268. package/dist/lib/api/writeDocs.d.ts +3 -0
  269. package/dist/lib/api/writeDocs.d.ts.map +1 -0
  270. package/dist/lib/api/writeDocs.js +23 -0
  271. package/dist/lib/errorReporter.d.ts +8 -0
  272. package/dist/lib/errorReporter.d.ts.map +1 -0
  273. package/dist/lib/errorReporter.js +45 -0
  274. package/dist/lib/ext/Array.d.ts +19 -0
  275. package/dist/lib/ext/Array.d.ts.map +1 -0
  276. package/dist/lib/ext/Array.js +21 -0
  277. package/dist/lib/fileUtil.d.ts +22 -0
  278. package/dist/lib/fileUtil.d.ts.map +1 -0
  279. package/dist/lib/fileUtil.js +23 -0
  280. package/dist/lib/filter/types/errors.d.ts +30 -0
  281. package/dist/lib/filter/types/errors.d.ts.map +1 -0
  282. package/dist/lib/filter/types/errors.js +2 -0
  283. package/dist/lib/filter/types/fields.d.ts +29 -0
  284. package/dist/lib/filter/types/fields.d.ts.map +1 -0
  285. package/dist/lib/filter/types/fields.js +2 -0
  286. package/dist/lib/filter/types/index.d.ts +6 -0
  287. package/dist/lib/filter/types/index.d.ts.map +1 -0
  288. package/dist/lib/filter/types/index.js +6 -0
  289. package/dist/lib/filter/types/path/common.d.ts +316 -0
  290. package/dist/lib/filter/types/path/common.d.ts.map +1 -0
  291. package/dist/lib/filter/types/path/common.js +2 -0
  292. package/dist/lib/filter/types/path/eager.d.ts +95 -0
  293. package/dist/lib/filter/types/path/eager.d.ts.map +1 -0
  294. package/dist/lib/filter/types/path/eager.js +2 -0
  295. package/dist/lib/filter/types/path/index.d.ts +4 -0
  296. package/dist/lib/filter/types/path/index.d.ts.map +1 -0
  297. package/dist/lib/filter/types/path/index.js +4 -0
  298. package/dist/lib/filter/types/utils.d.ts +68 -0
  299. package/dist/lib/filter/types/utils.d.ts.map +1 -0
  300. package/dist/lib/filter/types/utils.js +2 -0
  301. package/dist/lib/filter/types/validator.d.ts +30 -0
  302. package/dist/lib/filter/types/validator.d.ts.map +1 -0
  303. package/dist/lib/filter/types/validator.js +2 -0
  304. package/dist/lib/filter.d.ts +133 -0
  305. package/dist/lib/filter.d.ts.map +1 -0
  306. package/dist/lib/filter.js +171 -0
  307. package/dist/lib/instrument.d.ts +7 -0
  308. package/dist/lib/instrument.d.ts.map +1 -0
  309. package/dist/lib/instrument.js +12 -0
  310. package/dist/lib/rateLimit.d.ts +43 -0
  311. package/dist/lib/rateLimit.d.ts.map +1 -0
  312. package/dist/lib/rateLimit.js +76 -0
  313. package/dist/services/CUPS/service.d.ts +19 -0
  314. package/dist/services/CUPS/service.d.ts.map +1 -0
  315. package/dist/services/CUPS/service.js +5 -0
  316. package/dist/services/CUPS.d.ts +10 -0
  317. package/dist/services/CUPS.d.ts.map +1 -0
  318. package/dist/services/CUPS.js +89 -0
  319. package/dist/services/Cache.d.ts +28 -0
  320. package/dist/services/Cache.d.ts.map +1 -0
  321. package/dist/services/Cache.js +28 -0
  322. package/dist/services/Emailer/Sendgrid.d.ts +180 -0
  323. package/dist/services/Emailer/Sendgrid.d.ts.map +1 -0
  324. package/dist/services/Emailer/Sendgrid.js +102 -0
  325. package/dist/services/Emailer/fake.d.ts +7 -0
  326. package/dist/services/Emailer/fake.d.ts.map +1 -0
  327. package/dist/services/Emailer/fake.js +15 -0
  328. package/dist/services/Emailer/service.d.ts +41 -0
  329. package/dist/services/Emailer/service.d.ts.map +1 -0
  330. package/dist/services/Emailer/service.js +3 -0
  331. package/dist/services/Emailer.d.ts +2 -0
  332. package/dist/services/Emailer.d.ts.map +1 -0
  333. package/dist/services/Emailer.js +2 -0
  334. package/dist/services/Repository.d.ts +300 -0
  335. package/dist/services/Repository.d.ts.map +1 -0
  336. package/dist/services/Repository.js +193 -0
  337. package/dist/services/ServiceBus.d.ts +26 -0
  338. package/dist/services/ServiceBus.d.ts.map +1 -0
  339. package/dist/services/ServiceBus.js +53 -0
  340. package/dist/services/Store/Cosmos.d.ts +56 -0
  341. package/dist/services/Store/Cosmos.d.ts.map +1 -0
  342. package/dist/services/Store/Cosmos.js +321 -0
  343. package/dist/services/Store/Cosmos.test.d.ts.map +1 -0
  344. package/dist/services/Store/Disk.d.ts +14 -0
  345. package/dist/services/Store/Disk.d.ts.map +1 -0
  346. package/dist/services/Store/Disk.js +52 -0
  347. package/dist/services/Store/Memory.d.ts +17 -0
  348. package/dist/services/Store/Memory.d.ts.map +1 -0
  349. package/dist/services/Store/Memory.js +60 -0
  350. package/dist/services/Store/Redis.d.ts +12 -0
  351. package/dist/services/Store/Redis.d.ts.map +1 -0
  352. package/dist/services/Store/Redis.js +59 -0
  353. package/dist/services/Store/codeFilter.test.d.ts.map +1 -0
  354. package/dist/services/Store/index.d.ts +10 -0
  355. package/dist/services/Store/index.d.ts.map +1 -0
  356. package/dist/services/Store/index.js +52 -0
  357. package/dist/services/Store/service.d.ts +113 -0
  358. package/dist/services/Store/service.d.ts.map +1 -0
  359. package/dist/services/Store/service.js +63 -0
  360. package/dist/services/Store/utils.d.ts +14 -0
  361. package/dist/services/Store/utils.d.ts.map +1 -0
  362. package/dist/services/Store/utils.js +103 -0
  363. package/dist/services/Store.d.ts +2 -0
  364. package/dist/services/Store.d.ts.map +1 -0
  365. package/dist/services/Store.js +2 -0
  366. package/dist/services/memQueue.d.ts +18 -0
  367. package/dist/services/memQueue.d.ts.map +1 -0
  368. package/dist/services/memQueue.js +24 -0
  369. package/dist/test.arbs.d.ts +13 -0
  370. package/dist/test.arbs.d.ts.map +1 -0
  371. package/dist/test.arbs.js +22 -0
  372. package/dist/vendor/Cache/Cache/_internal/AtomicBoolean.d.ts +5 -0
  373. package/dist/vendor/Cache/Cache/_internal/AtomicBoolean.d.ts.map +1 -0
  374. package/dist/vendor/Cache/Cache/_internal/AtomicBoolean.js +7 -0
  375. package/dist/vendor/Cache/Cache/_internal/AtomicNumber.d.ts +8 -0
  376. package/dist/vendor/Cache/Cache/_internal/AtomicNumber.d.ts.map +1 -0
  377. package/dist/vendor/Cache/Cache/_internal/AtomicNumber.js +22 -0
  378. package/dist/vendor/Cache/Cache/_internal/AtomicReference.d.ts +10 -0
  379. package/dist/vendor/Cache/Cache/_internal/AtomicReference.d.ts.map +1 -0
  380. package/dist/vendor/Cache/Cache/_internal/AtomicReference.js +25 -0
  381. package/dist/vendor/Cache/Cache/_internal/CacheInternal.d.ts +51 -0
  382. package/dist/vendor/Cache/Cache/_internal/CacheInternal.d.ts.map +1 -0
  383. package/dist/vendor/Cache/Cache/_internal/CacheInternal.js +253 -0
  384. package/dist/vendor/Cache/Cache/_internal/CacheState.d.ts +33 -0
  385. package/dist/vendor/Cache/Cache/_internal/CacheState.d.ts.map +1 -0
  386. package/dist/vendor/Cache/Cache/_internal/CacheState.js +21 -0
  387. package/dist/vendor/Cache/Cache/_internal/KeySet.d.ts +20 -0
  388. package/dist/vendor/Cache/Cache/_internal/KeySet.d.ts.map +1 -0
  389. package/dist/vendor/Cache/Cache/_internal/KeySet.js +61 -0
  390. package/dist/vendor/Cache/Cache/_internal/MapKey.d.ts +24 -0
  391. package/dist/vendor/Cache/Cache/_internal/MapKey.d.ts.map +1 -0
  392. package/dist/vendor/Cache/Cache/_internal/MapKey.js +37 -0
  393. package/dist/vendor/Cache/Cache/_internal/MapValue.d.ts +32 -0
  394. package/dist/vendor/Cache/Cache/_internal/MapValue.d.ts.map +1 -0
  395. package/dist/vendor/Cache/Cache/_internal/MapValue.js +24 -0
  396. package/dist/vendor/Cache/Cache/definition.d.ts +100 -0
  397. package/dist/vendor/Cache/Cache/definition.d.ts.map +1 -0
  398. package/dist/vendor/Cache/Cache/definition.js +5 -0
  399. package/dist/vendor/Cache/Cache/operations/make.d.ts +12 -0
  400. package/dist/vendor/Cache/Cache/operations/make.d.ts.map +1 -0
  401. package/dist/vendor/Cache/Cache/operations/make.js +12 -0
  402. package/dist/vendor/Cache/Cache/operations/makeWith.d.ts +14 -0
  403. package/dist/vendor/Cache/Cache/operations/makeWith.d.ts.map +1 -0
  404. package/dist/vendor/Cache/Cache/operations/makeWith.js +15 -0
  405. package/dist/vendor/Cache/Cache/operations.d.ts +3 -0
  406. package/dist/vendor/Cache/Cache/operations.d.ts.map +1 -0
  407. package/dist/vendor/Cache/Cache/operations.js +4 -0
  408. package/dist/vendor/Cache/Cache.d.ts +3 -0
  409. package/dist/vendor/Cache/Cache.d.ts.map +1 -0
  410. package/dist/vendor/Cache/Cache.js +4 -0
  411. package/dist/vendor/Cache/CacheStats/definition.d.ts +19 -0
  412. package/dist/vendor/Cache/CacheStats/definition.d.ts.map +1 -0
  413. package/dist/vendor/Cache/CacheStats/definition.js +6 -0
  414. package/dist/vendor/Cache/CacheStats.d.ts +2 -0
  415. package/dist/vendor/Cache/CacheStats.d.ts.map +1 -0
  416. package/dist/vendor/Cache/CacheStats.js +3 -0
  417. package/dist/vendor/Cache/EntryStats/definition.d.ts +17 -0
  418. package/dist/vendor/Cache/EntryStats/definition.d.ts.map +1 -0
  419. package/dist/vendor/Cache/EntryStats/definition.js +4 -0
  420. package/dist/vendor/Cache/EntryStats.d.ts +2 -0
  421. package/dist/vendor/Cache/EntryStats.d.ts.map +1 -0
  422. package/dist/vendor/Cache/EntryStats.js +3 -0
  423. package/dist/vendor/Cache/Lookup/definition.d.ts +17 -0
  424. package/dist/vendor/Cache/Lookup/definition.d.ts.map +1 -0
  425. package/dist/vendor/Cache/Lookup/definition.js +2 -0
  426. package/dist/vendor/Cache/Lookup.d.ts +2 -0
  427. package/dist/vendor/Cache/Lookup.d.ts.map +1 -0
  428. package/dist/vendor/Cache/Lookup.js +3 -0
  429. package/dist/vendor/Cache/index.d.ts +5 -0
  430. package/dist/vendor/Cache/index.d.ts.map +1 -0
  431. package/dist/vendor/Cache/index.js +5 -0
  432. package/package.json +756 -0
  433. package/tsconfig.json +107 -0
  434. package/tsconfig.json.bak +47 -0
  435. package/tsplus.config.json +6 -0
  436. package/types/modules.d.ts +1 -0
  437. package/vitest.config.ts +5 -0
  438. package/wallaby.cjs +1 -0
@@ -0,0 +1,146 @@
1
+ /* eslint-disable @typescript-eslint/ban-types */
2
+ import type { FieldValues } from "../fields.js"
3
+ import type { BrowserNativeObject, Primitive } from "../utils.js"
4
+
5
+ import type { ArrayKey, IsTuple, TupleKeys } from "./common.js"
6
+
7
+ /**
8
+ * Helper type for recursively constructing paths through a type.
9
+ * See {@link Path}
10
+ */
11
+ type PathImpl<K extends string | number, V> = V extends
12
+ | Primitive
13
+ | BrowserNativeObject ? `${K}`
14
+ : `${K}` | `${K}.${Path<V>}`
15
+
16
+ /**
17
+ * Type which eagerly collects all paths through a type
18
+ * @typeParam T - type which should be introspected
19
+ * @example
20
+ * ```
21
+ * Path<{foo: {bar: string}}> = 'foo' | 'foo.bar'
22
+ * ```
23
+ */
24
+ export type Path<T> = T extends ReadonlyArray<infer V> ? IsTuple<T> extends true ? {
25
+ [K in TupleKeys<T>]-?: PathImpl<K & string, T[K]>
26
+ }[TupleKeys<T>]
27
+ : PathImpl<ArrayKey, V>
28
+ : {
29
+ [K in keyof T]-?: PathImpl<K & string, T[K]>
30
+ }[keyof T]
31
+
32
+ /**
33
+ * See {@link Path}
34
+ */
35
+ export type FieldPath<TFieldValues extends FieldValues> = Path<TFieldValues>
36
+
37
+ /**
38
+ * Helper type for recursively constructing paths through a type.
39
+ * See {@link ArrayPath}
40
+ */
41
+ type ArrayPathImpl<K extends string | number, V> = V extends
42
+ | Primitive
43
+ | BrowserNativeObject ? never
44
+ : V extends ReadonlyArray<infer U> ? U extends Primitive | BrowserNativeObject ? never
45
+ : `${K}` | `${K}.${ArrayPath<V>}`
46
+ : `${K}.${ArrayPath<V>}`
47
+
48
+ /**
49
+ * Type which eagerly collects all paths through a type which point to an array
50
+ * type.
51
+ * @typeParam T - type which should be introspected
52
+ * @example
53
+ * ```
54
+ * Path<{foo: {bar: string[], baz: number[]}}> = 'foo.bar' | 'foo.baz'
55
+ * ```
56
+ */
57
+ export type ArrayPath<T> = T extends ReadonlyArray<infer V> ? IsTuple<T> extends true ? {
58
+ [K in TupleKeys<T>]-?: ArrayPathImpl<K & string, T[K]>
59
+ }[TupleKeys<T>]
60
+ : ArrayPathImpl<ArrayKey, V>
61
+ : {
62
+ [K in keyof T]-?: ArrayPathImpl<K & string, T[K]>
63
+ }[keyof T]
64
+
65
+ /**
66
+ * See {@link ArrayPath}
67
+ */
68
+ export type FieldArrayPath<TFieldValues extends FieldValues> = ArrayPath<TFieldValues>
69
+
70
+ /**
71
+ * Type to evaluate the type which the given path points to.
72
+ * @typeParam T - deeply nested type which is indexed by the path
73
+ * @typeParam P - path into the deeply nested type
74
+ * @example
75
+ * ```
76
+ * PathValue<{foo: {bar: string}}, 'foo.bar'> = string
77
+ * PathValue<[number, string], '1'> = string
78
+ * ```
79
+ */
80
+ export type PathValue<T, P extends Path<T> | ArrayPath<T>> = T extends any
81
+ ? P extends `${infer K}.${infer R}` ? K extends keyof T ? R extends Path<T[K]> ? PathValue<T[K], R>
82
+ : never
83
+ : K extends `${ArrayKey}` ? T extends ReadonlyArray<infer V> ? PathValue<V, R & Path<V>>
84
+ : never
85
+ : never
86
+ : P extends keyof T ? T[P]
87
+ : P extends `${ArrayKey}` ? T extends ReadonlyArray<infer V> ? V
88
+ : never
89
+ : never
90
+ : never
91
+
92
+ /**
93
+ * See {@link PathValue}
94
+ */
95
+ export type FieldPathValue<
96
+ TFieldValues extends FieldValues,
97
+ TFieldPath extends FieldPath<TFieldValues>
98
+ > = PathValue<TFieldValues, TFieldPath>
99
+
100
+ /**
101
+ * See {@link PathValue}
102
+ */
103
+ export type FieldArrayPathValue<
104
+ TFieldValues extends FieldValues,
105
+ TFieldArrayPath extends FieldArrayPath<TFieldValues>
106
+ > = PathValue<TFieldValues, TFieldArrayPath>
107
+
108
+ /**
109
+ * Type to evaluate the type which the given paths point to.
110
+ * @typeParam TFieldValues - field values which are indexed by the paths
111
+ * @typeParam TPath - paths into the deeply nested field values
112
+ * @example
113
+ * ```
114
+ * FieldPathValues<{foo: {bar: string}}, ['foo', 'foo.bar']>
115
+ * = [{bar: string}, string]
116
+ * ```
117
+ */
118
+ export type FieldPathValues<
119
+ TFieldValues extends FieldValues,
120
+ TPath extends FieldPath<TFieldValues>[] | readonly FieldPath<TFieldValues>[]
121
+ > =
122
+ & {}
123
+ & {
124
+ [K in keyof TPath]: FieldPathValue<
125
+ TFieldValues,
126
+ TPath[K] & FieldPath<TFieldValues>
127
+ >
128
+ }
129
+
130
+ /**
131
+ * Type which eagerly collects all paths through a fieldType that matches a give type
132
+ * @typeParam TFieldValues - field values which are indexed by the paths
133
+ * @typeParam TValue - the value you want to match into each type
134
+ * @example
135
+ * ```typescript
136
+ * FieldPathByValue<{foo: {bar: number}, baz: number, bar: string}, number>
137
+ * = 'foo.bar' | 'baz'
138
+ * ```
139
+ */
140
+ export type FieldPathByValue<TFieldValues extends FieldValues, TValue> = {
141
+ [Key in FieldPath<TFieldValues>]: FieldPathValue<
142
+ TFieldValues,
143
+ Key
144
+ > extends TValue ? Key
145
+ : never
146
+ }[FieldPath<TFieldValues>]
@@ -0,0 +1,14 @@
1
+ /** Re-export public API */
2
+
3
+ export { PathString } from "./common.js"
4
+ export {
5
+ ArrayPath,
6
+ FieldArrayPath,
7
+ FieldArrayPathValue,
8
+ FieldPath,
9
+ FieldPathByValue,
10
+ FieldPathValue,
11
+ FieldPathValues,
12
+ Path,
13
+ PathValue
14
+ } from "./eager.js"
@@ -0,0 +1,106 @@
1
+ declare const $NestedValue: unique symbol
2
+
3
+ /**
4
+ * @deprecated to be removed in the next major version
5
+ */
6
+ export type NestedValue<TValue extends object = object> = {
7
+ [$NestedValue]: never
8
+ } & TValue
9
+
10
+ /**
11
+ * @deprecated to be removed in the next major version
12
+ */
13
+ export type UnpackNestedValue<T> = T extends NestedValue<infer U> ? U
14
+ : T extends Date | FileList | File | Blob ? T
15
+ : T extends object ? { [K in keyof T]: UnpackNestedValue<T[K]> }
16
+ : T
17
+
18
+ /*
19
+ Projects that React Hook Form installed don't include the DOM library need these interfaces to compile.
20
+ React Native applications is no DOM available. The JavaScript runtime is ES6/ES2015 only.
21
+ These definitions allow such projects to compile with only --lib ES6.
22
+
23
+ Warning: all of these interfaces are empty.
24
+ If you want type definitions for various properties, you need to add `--lib DOM` (via command line or tsconfig.json).
25
+ */
26
+
27
+ export type Noop = () => void
28
+
29
+ interface File extends Blob {
30
+ readonly lastModified: number
31
+ readonly name: string
32
+ }
33
+
34
+ interface FileList {
35
+ readonly length: number
36
+ item(index: number): File | null
37
+ [index: number]: File
38
+ }
39
+
40
+ export type Primitive =
41
+ | null
42
+ | undefined
43
+ | string
44
+ | number
45
+ | boolean
46
+ | symbol
47
+ | bigint
48
+
49
+ export type BrowserNativeObject = Date | FileList | File
50
+
51
+ export type EmptyObject = { [K in string | number]: never }
52
+
53
+ export type NonUndefined<T> = T extends undefined ? never : T
54
+
55
+ export type LiteralUnion<T extends U, U extends Primitive> =
56
+ | T
57
+ | (U & { _?: never })
58
+
59
+ export type DeepPartial<T> = T extends BrowserNativeObject | NestedValue ? T
60
+ : { [K in keyof T]?: DeepPartial<T[K]> }
61
+
62
+ export type DeepPartialSkipArrayKey<T> = T extends
63
+ | BrowserNativeObject
64
+ | NestedValue ? T
65
+ : T extends ReadonlyArray<any> ? { [K in keyof T]: DeepPartialSkipArrayKey<T[K]> }
66
+ : { [K in keyof T]?: DeepPartialSkipArrayKey<T[K]> }
67
+
68
+ /**
69
+ * Checks whether the type is any
70
+ * See {@link https://stackoverflow.com/a/49928360/3406963}
71
+ * @typeParam T - type which may be any
72
+ * ```
73
+ * IsAny<any> = true
74
+ * IsAny<string> = false
75
+ * ```
76
+ */
77
+ export type IsAny<T> = 0 extends 1 & T ? true : false
78
+
79
+ /**
80
+ * Checks whether the type is never
81
+ * @typeParam T - type which may be never
82
+ * ```
83
+ * IsAny<never> = true
84
+ * IsAny<string> = false
85
+ * ```
86
+ */
87
+ export type IsNever<T> = [T] extends [never] ? true : false
88
+
89
+ export type DeepMap<T, TValue> = IsAny<T> extends true ? any
90
+ : T extends BrowserNativeObject | NestedValue ? TValue
91
+ : T extends object ? { [K in keyof T]: DeepMap<NonUndefined<T[K]>, TValue> }
92
+ : TValue
93
+
94
+ export type IsFlatObject<T extends object> = Extract<
95
+ Exclude<T[keyof T], NestedValue | Date | FileList>,
96
+ any[] | object
97
+ > extends never ? true
98
+ : false
99
+
100
+ export type Merge<A, B> = {
101
+ [K in keyof A | keyof B]?: K extends keyof A & keyof B ? [A[K], B[K]] extends [object, object] ? Merge<A[K], B[K]>
102
+ : A[K] | B[K]
103
+ : K extends keyof A ? A[K]
104
+ : K extends keyof B ? B[K]
105
+ : never
106
+ }
@@ -0,0 +1,46 @@
1
+ import type { Message } from "./errors.js"
2
+ import type { FieldValues, InternalFieldName } from "./fields.js"
3
+ import type { FieldPath, FieldPathValue } from "./path/index.js"
4
+
5
+ export type ValidationValue = boolean | number | string | RegExp
6
+
7
+ export type ValidationRule<
8
+ TValidationValue extends ValidationValue = ValidationValue
9
+ > = TValidationValue | ValidationValueMessage<TValidationValue>
10
+
11
+ export type ValidationValueMessage<
12
+ TValidationValue extends ValidationValue = ValidationValue
13
+ > = {
14
+ value: TValidationValue
15
+ message: Message
16
+ }
17
+
18
+ export type ValidateResult = Message | Message[] | boolean | undefined
19
+
20
+ export type Validate<TFieldValue> = (
21
+ value: TFieldValue
22
+ ) => ValidateResult | Promise<ValidateResult>
23
+
24
+ export type RegisterOptions<
25
+ TFieldValues extends FieldValues = FieldValues,
26
+ TFieldName extends FieldPath<TFieldValues> = FieldPath<TFieldValues>
27
+ > = Partial<{
28
+ required: Message | ValidationRule<boolean>
29
+ min: ValidationRule<number | string>
30
+ max: ValidationRule<number | string>
31
+ maxLength: ValidationRule<number>
32
+ minLength: ValidationRule<number>
33
+ pattern: ValidationRule<RegExp>
34
+ validate:
35
+ | Validate<FieldPathValue<TFieldValues, TFieldName>>
36
+ | Record<string, Validate<FieldPathValue<TFieldValues, TFieldName>>>
37
+ valueAsNumber: boolean
38
+ valueAsDate: boolean
39
+ value: FieldPathValue<TFieldValues, TFieldName>
40
+ setValueAs: (value: any) => any
41
+ shouldUnregister?: boolean
42
+ onChange?: (event: any) => void
43
+ onBlur?: (event: any) => void
44
+ disabled: boolean
45
+ deps: InternalFieldName | InternalFieldName[]
46
+ }>
@@ -0,0 +1,323 @@
1
+ import type { Where } from "../services/Store.js"
2
+ import type { FieldValues } from "./filter/types/fields.js"
3
+ import type { FieldPath, FieldPathValue } from "./filter/types/path/eager.js"
4
+
5
+ /**
6
+ * the function defaults to "eq", but has additional properties for notEq, in and notIn
7
+ */
8
+ export interface WhereFilter<TFieldValues extends FieldValues> extends ReturnType<typeof makeWhereFilter_<TFieldValues>> {}
9
+ export function makeWhereFilter<TFieldValues extends FieldValues>() {
10
+ const f = makeWhereFilter_<TFieldValues>()
11
+ return f as WhereFilter<TFieldValues>
12
+ }
13
+
14
+ function makeHelpers<TFieldValues extends FieldValues>() {
15
+ const helpers = makeHelpers_<TFieldValues>()
16
+ return helpers as WhereHelpers<TFieldValues>
17
+ }
18
+
19
+ export interface WhereHelpers<TFieldValues extends FieldValues> extends ReturnType<typeof makeHelpers_<TFieldValues>> {}
20
+
21
+ function makeHelpers_<TFieldValues extends FieldValues>() {
22
+ type Paths = FieldPath<TFieldValues>
23
+ type Value<TFieldName extends Paths> = FieldPathValue<TFieldValues, TFieldName>
24
+
25
+ return {
26
+ in<TFieldName extends Paths, V extends Value<TFieldName>>(
27
+ this: void,
28
+ path: TFieldName,
29
+ value: readonly V[]
30
+ ) {
31
+ return { key: path, value, t: "in" as const }
32
+ },
33
+ notIn<TFieldName extends Paths, V extends Value<TFieldName>>(
34
+ this: void,
35
+ path: TFieldName,
36
+ value: readonly V[]
37
+ ) {
38
+ return { key: path, value, t: "not-in" as const }
39
+ },
40
+ eq<TFieldName extends Paths, V extends Value<TFieldName>>(
41
+ this: void,
42
+ path: TFieldName,
43
+ value: V
44
+ ) {
45
+ return { key: path, value, t: "eq" as const }
46
+ },
47
+ notEq<TFieldName extends Paths, V extends Value<TFieldName>>(
48
+ this: void,
49
+ path: TFieldName,
50
+ value: V
51
+ ) {
52
+ return { key: path, value, t: "not-eq" as const }
53
+ }
54
+ } satisfies Record<string, (...args: any[]) => Where>
55
+ }
56
+
57
+ function makeWhereFilter_<TFieldValues extends FieldValues>() {
58
+ const helpers = makeHelpers<TFieldValues>()
59
+ const f = Object.assign(helpers.eq, helpers)
60
+ return f
61
+ }
62
+
63
+
64
+
65
+ export type WhereValue<
66
+ T extends "eq" | "not-eq" | "starts-with" | "ends-with" | "includes" | "contains" | "not-contains",
67
+ A, // extends SupportedValues,
68
+ V extends A = A
69
+ > = { t: T; v: V }
70
+ type SupportedValues = string | boolean | number | null
71
+
72
+ export type WhereIn<T extends "in" | "not-in", V, Values extends readonly V[] = readonly V[]> = {
73
+ t: T
74
+ v: Values
75
+ }
76
+
77
+ /**
78
+ * @tsplus fluent Iterable $contains
79
+ */
80
+ export function $contains<A extends SupportedValues, V extends A>(
81
+ _: readonly A[],
82
+ v: V
83
+ ): WhereValue<"contains", A, V> {
84
+ return $$contains(v)
85
+ }
86
+
87
+ /**
88
+ * @tsplus fluent Iterable $notContains
89
+ */
90
+ export function $notContains<A extends SupportedValues, V extends A>(
91
+ _: readonly A[],
92
+ v: V
93
+ ): WhereValue<"not-contains", A, V> {
94
+ return $$notContains(v)
95
+ }
96
+
97
+ /**
98
+ * @tsplus fluent string $in
99
+ * @tsplus fluent boolean $in
100
+ * @tsplus fluent number $in
101
+ */
102
+ export function $in<A extends SupportedValues, Values extends readonly A[]>(
103
+ _: A,
104
+ ...v: Values
105
+ ): WhereIn<"in", A, Values> {
106
+ return $$in(v)
107
+ }
108
+
109
+ /**
110
+ * @tsplus fluent string $notIn
111
+ * @tsplus fluent boolean $notIn
112
+ * @tsplus fluent number $notIn
113
+ */
114
+ export function $notIn<A extends SupportedValues, Values extends readonly A[]>(
115
+ _: A,
116
+ ...v: Values
117
+ ): WhereIn<"not-in", A, Values> {
118
+ return $$notIn(v)
119
+ }
120
+
121
+ /**
122
+ * @tsplus fluent string $is
123
+ * @tsplus fluent boolean $is
124
+ * @tsplus fluent number $is
125
+ * @tsplus fluent Object $is
126
+ */
127
+ export function $is<A, V extends A>(_: A, v: V): WhereValue<"eq", A, V> {
128
+ return $$is(v)
129
+ }
130
+ /**
131
+ * @tsplus fluent string $isnt
132
+ * @tsplus fluent boolean $isnt
133
+ * @tsplus fluent number $isnt
134
+ * @tsplus fluent Object $isnt
135
+ */
136
+ export function $isnt<A, V extends A>(_: A, v: V): WhereValue<"not-eq", A, V> {
137
+ return $$isnt(v)
138
+ }
139
+
140
+ function $is__<V extends A, A>(v: V) {
141
+ return (_: A) => $is(_, v)
142
+ }
143
+
144
+ function $isnt__<V extends A, A>(v: V) {
145
+ return (_: A) => $isnt(_, v)
146
+ }
147
+
148
+
149
+ function $in__<A extends SupportedValues, Values extends readonly A[]>(
150
+ ...v: Values
151
+ ) {
152
+ return (_: A) => $in(_, ...v)
153
+ }
154
+
155
+ function $notIn__<A extends SupportedValues, Values extends readonly A[]>(
156
+ ...v: Values
157
+ ) {
158
+ return (_: A) => $notIn(_, ...v)
159
+ }
160
+
161
+ // function $contains__<A extends SupportedValues, V extends A>(
162
+ // v: V
163
+ // ) {
164
+ // return (_: readonly A[]) => $contains(_, v)
165
+ // }
166
+
167
+ // function $notContains__<A extends SupportedValues, V extends A>(
168
+ // v: V
169
+ // ) {
170
+ // return (_: readonly A[]) => $notContains(_, v)
171
+ // }
172
+
173
+ export const Filters = {
174
+ $is: $is__,
175
+ $isnt: $isnt__,
176
+ $in: $in__,
177
+ $notIn: $notIn__,
178
+ // $contains: $contains__,
179
+ // $notContains: $notContains__,
180
+ }
181
+
182
+ /**
183
+ * @tsplus fluent string $startsWith
184
+ */
185
+ export function $startsWith<A extends string, V extends A>(_: A, v: V): WhereValue<"starts-with", A, V> {
186
+ return $$startsWith(v)
187
+ }
188
+
189
+ /**
190
+ * @tsplus fluent string $endsWith
191
+ */
192
+ export function $endsWith<A extends string, V extends A>(_: A, v: V): WhereValue<"ends-with", A, V> {
193
+ return $$endsWith(v)
194
+ }
195
+
196
+ /**
197
+ * @tsplus fluent string $includes
198
+ */
199
+ export function $includes<A extends string, V extends A>(_: A, v: V): WhereValue<"includes", A, V> {
200
+ return $$includes(v)
201
+ }
202
+
203
+ function $$in<L extends readonly any[]>(v: L) {
204
+ return { t: "in" as const, v }
205
+ }
206
+
207
+ function $$notIn<L extends readonly any[]>(v: L) {
208
+ return { t: "not-in" as const, v }
209
+ }
210
+ function $$is<A>(v: A) {
211
+ return { t: "eq" as const, v }
212
+ }
213
+ function $$isnt<A>(v: A) {
214
+ return { t: "not-eq" as const, v }
215
+ }
216
+
217
+ // containsAny, containsAll?
218
+ function $$contains<A>(v: A) {
219
+ return { t: "contains" as const, v }
220
+ }
221
+ function $$notContains<A>(v: A) {
222
+ return { t: "not-contains" as const, v }
223
+ }
224
+ function $$includes<A extends string>(v: A) {
225
+ return { t: "includes" as const, v }
226
+ }
227
+ function $$startsWith<A extends string>(v: A) {
228
+ return { t: "starts-with" as const, v }
229
+ }
230
+ function $$endsWith<A extends string>(v: A) {
231
+ return { t: "ends-with" as const, v }
232
+ }
233
+
234
+ type ValueType<V> = {
235
+ t: "in" | "not-in"
236
+ v: readonly V[]
237
+ } | { t: "eq" | "not-eq"; v: V }
238
+
239
+ type TType<T> = T extends ValueType<any> ? T["t"] : never
240
+ type VType<T> = T extends ValueType<any> ? T["v"] : never
241
+
242
+ function f(p: string, b: any) {
243
+ if (typeof b === "function") b = b(undefined)
244
+ const obj = typeof b === "object" && b !== null
245
+ return makeFilter(p, obj ? b.v : b, obj ? b.t ?? "eq" : "eq");
246
+ }
247
+
248
+ function makeFilter<T extends "in" | "not-in" | "eq" | "not-eq">(path: string, value: any, t: T) {
249
+ return { key: path, t, value }
250
+ }
251
+
252
+ type FIL<S, K extends string, T extends "in" | "not-in" | "eq" | "not-eq", V> = {
253
+ key: K
254
+ t: T
255
+ value: V
256
+ readonly S: S
257
+ }
258
+
259
+
260
+ export function makeFilters<T extends FieldValues>() {
261
+ type Paths = FieldPath<T>
262
+ type Value<TFieldName extends Paths> = FieldPathValue<T, TFieldName>
263
+
264
+ function test<
265
+ TFieldName extends Paths,
266
+ A extends Value<TFieldName>,
267
+ Val
268
+ >(
269
+ path: TFieldName,
270
+ value: (v: A) => Val
271
+ ): FIL<T, string, TType<Val>, VType<Val>>
272
+ function test<
273
+ TFieldName extends Paths,
274
+ A extends Value<TFieldName>
275
+ >(
276
+ path: TFieldName,
277
+ value: A
278
+ ): FIL<T, string, "eq", A>
279
+ function test(p: string, v: any) {
280
+ return f(p, v) as any
281
+ }
282
+ return test
283
+ }
284
+
285
+
286
+
287
+ // export function makeFilter<TFieldValues extends FieldValues>() {
288
+ // const f = makeFilter_<TFieldValues>()
289
+ // return f as WhereFilterHelper<TFieldValues>
290
+ // }
291
+
292
+ // export interface WhereFilterHelper<TFieldValues extends FieldValues> extends ReturnType<typeof makeFilter_<TFieldValues>> {}
293
+
294
+ // function makeFilter_<TFieldValues extends FieldValues>() {
295
+ // function eq<TFieldName extends FieldPath<TFieldValues>, V extends FieldPathValue<TFieldValues, TFieldName>>(
296
+ // path: TFieldName,
297
+ // value: V
298
+ // ) {
299
+ // return { key: path, value, t: "eq" as const }
300
+ // }
301
+ // const f = Object.assign(eq satisfies (...args: any[]) => Where, {
302
+ // in<TFieldName extends FieldPath<TFieldValues>, V extends FieldPathValue<TFieldValues, TFieldName>>(
303
+ // path: TFieldName,
304
+ // value: readonly V[]
305
+ // ) {
306
+ // return { key: path, value, t: "in" as const }
307
+ // },
308
+ // notIn<TFieldName extends FieldPath<TFieldValues>, V extends FieldPathValue<TFieldValues, TFieldName>>(
309
+ // path: TFieldName,
310
+ // value: readonly V[]
311
+ // ) {
312
+ // return { key: path, value, t: "not-in" as const }
313
+ // },
314
+ // eq,
315
+ // notEq<TFieldName extends FieldPath<TFieldValues>, V extends FieldPathValue<TFieldValues, TFieldName>>(
316
+ // path: TFieldName,
317
+ // value: V
318
+ // ) {
319
+ // return { key: path, value, t: "not-eq" as const }
320
+ // }
321
+ // } satisfies Record<string, (...args: any[]) => Where>)
322
+ // return f
323
+ // }
@@ -0,0 +1,9 @@
1
+ /**
2
+ * @tsplus fluent effect/io/Effect instrument
3
+ */
4
+ export function instr<R, E, A>(self: Effect<R, E, A>, name: string, properties?: Record<string, string>) {
5
+ return self
6
+ .tap(() => Effect.logDebug(`instrumented`).logAnnotate("properties", (properties || {}).$$.pretty))
7
+ .withSpan(name)
8
+ // trackMetric(name, time, properties))
9
+ }