effect 4.0.0-beta.31 → 4.0.0-beta.32

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 (464) hide show
  1. package/dist/Array.d.ts +87 -86
  2. package/dist/Array.d.ts.map +1 -1
  3. package/dist/Array.js +47 -40
  4. package/dist/Array.js.map +1 -1
  5. package/dist/BigDecimal.d.ts +46 -45
  6. package/dist/BigDecimal.d.ts.map +1 -1
  7. package/dist/BigDecimal.js +35 -38
  8. package/dist/BigDecimal.js.map +1 -1
  9. package/dist/BigInt.d.ts +39 -32
  10. package/dist/BigInt.d.ts.map +1 -1
  11. package/dist/BigInt.js +32 -29
  12. package/dist/BigInt.js.map +1 -1
  13. package/dist/Chunk.d.ts +58 -57
  14. package/dist/Chunk.d.ts.map +1 -1
  15. package/dist/Chunk.js +20 -21
  16. package/dist/Chunk.js.map +1 -1
  17. package/dist/Config.d.ts.map +1 -1
  18. package/dist/Config.js +4 -1
  19. package/dist/Config.js.map +1 -1
  20. package/dist/Cron.d.ts +3 -6
  21. package/dist/Cron.d.ts.map +1 -1
  22. package/dist/Cron.js +8 -15
  23. package/dist/Cron.js.map +1 -1
  24. package/dist/DateTime.d.ts +16 -15
  25. package/dist/DateTime.d.ts.map +1 -1
  26. package/dist/DateTime.js +8 -8
  27. package/dist/DateTime.js.map +1 -1
  28. package/dist/Deferred.d.ts +7 -5
  29. package/dist/Deferred.d.ts.map +1 -1
  30. package/dist/Deferred.js +7 -5
  31. package/dist/Deferred.js.map +1 -1
  32. package/dist/Duration.d.ts +26 -24
  33. package/dist/Duration.d.ts.map +1 -1
  34. package/dist/Duration.js +23 -22
  35. package/dist/Duration.js.map +1 -1
  36. package/dist/Effect.d.ts.map +1 -1
  37. package/dist/Effect.js +3 -4
  38. package/dist/Effect.js.map +1 -1
  39. package/dist/Fiber.d.ts +2 -1
  40. package/dist/Fiber.d.ts.map +1 -1
  41. package/dist/Fiber.js.map +1 -1
  42. package/dist/FiberHandle.d.ts +9 -8
  43. package/dist/FiberHandle.d.ts.map +1 -1
  44. package/dist/FiberHandle.js +8 -7
  45. package/dist/FiberHandle.js.map +1 -1
  46. package/dist/FiberMap.d.ts +20 -19
  47. package/dist/FiberMap.d.ts.map +1 -1
  48. package/dist/FiberMap.js +6 -6
  49. package/dist/FiberMap.js.map +1 -1
  50. package/dist/FileSystem.d.ts +17 -16
  51. package/dist/FileSystem.d.ts.map +1 -1
  52. package/dist/FileSystem.js +10 -7
  53. package/dist/FileSystem.js.map +1 -1
  54. package/dist/Graph.d.ts +64 -64
  55. package/dist/Graph.d.ts.map +1 -1
  56. package/dist/Graph.js +53 -53
  57. package/dist/Graph.js.map +1 -1
  58. package/dist/HashMap.d.ts +11 -5
  59. package/dist/HashMap.d.ts.map +1 -1
  60. package/dist/HashMap.js +3 -1
  61. package/dist/HashMap.js.map +1 -1
  62. package/dist/Iterable.d.ts +11 -11
  63. package/dist/Iterable.d.ts.map +1 -1
  64. package/dist/Iterable.js +12 -12
  65. package/dist/Iterable.js.map +1 -1
  66. package/dist/Latch.d.ts +69 -3
  67. package/dist/Latch.d.ts.map +1 -1
  68. package/dist/Latch.js +58 -0
  69. package/dist/Latch.js.map +1 -1
  70. package/dist/Layer.d.ts +84 -0
  71. package/dist/Layer.d.ts.map +1 -1
  72. package/dist/Layer.js +27 -0
  73. package/dist/Layer.js.map +1 -1
  74. package/dist/Number.d.ts +74 -18
  75. package/dist/Number.d.ts.map +1 -1
  76. package/dist/Number.js +34 -15
  77. package/dist/Number.js.map +1 -1
  78. package/dist/Option.d.ts +2 -0
  79. package/dist/Option.d.ts.map +1 -1
  80. package/dist/Option.js.map +1 -1
  81. package/dist/PartitionedSemaphore.d.ts +183 -0
  82. package/dist/PartitionedSemaphore.d.ts.map +1 -0
  83. package/dist/PartitionedSemaphore.js +231 -0
  84. package/dist/PartitionedSemaphore.js.map +1 -0
  85. package/dist/PubSub.d.ts +5 -4
  86. package/dist/PubSub.d.ts.map +1 -1
  87. package/dist/PubSub.js +6 -5
  88. package/dist/PubSub.js.map +1 -1
  89. package/dist/Queue.d.ts +3 -3
  90. package/dist/Queue.d.ts.map +1 -1
  91. package/dist/Queue.js +2 -2
  92. package/dist/Queue.js.map +1 -1
  93. package/dist/Record.d.ts +40 -40
  94. package/dist/Record.d.ts.map +1 -1
  95. package/dist/Record.js +16 -15
  96. package/dist/Record.js.map +1 -1
  97. package/dist/Scheduler.d.ts +25 -123
  98. package/dist/Scheduler.d.ts.map +1 -1
  99. package/dist/Scheduler.js +20 -123
  100. package/dist/Scheduler.js.map +1 -1
  101. package/dist/Schema.d.ts +30 -0
  102. package/dist/Schema.d.ts.map +1 -1
  103. package/dist/Schema.js +28 -1
  104. package/dist/Schema.js.map +1 -1
  105. package/dist/SchemaGetter.js +6 -4
  106. package/dist/SchemaGetter.js.map +1 -1
  107. package/dist/SchemaTransformation.d.ts.map +1 -1
  108. package/dist/SchemaTransformation.js +32 -27
  109. package/dist/SchemaTransformation.js.map +1 -1
  110. package/dist/Semaphore.d.ts +149 -53
  111. package/dist/Semaphore.d.ts.map +1 -1
  112. package/dist/Semaphore.js +137 -117
  113. package/dist/Semaphore.js.map +1 -1
  114. package/dist/ServiceMap.d.ts +26 -0
  115. package/dist/ServiceMap.d.ts.map +1 -1
  116. package/dist/ServiceMap.js +36 -21
  117. package/dist/ServiceMap.js.map +1 -1
  118. package/dist/Stream.js +1 -1
  119. package/dist/Stream.js.map +1 -1
  120. package/dist/String.d.ts +114 -47
  121. package/dist/String.d.ts.map +1 -1
  122. package/dist/String.js +29 -47
  123. package/dist/String.js.map +1 -1
  124. package/dist/SubscriptionRef.d.ts +1 -2
  125. package/dist/SubscriptionRef.d.ts.map +1 -1
  126. package/dist/SubscriptionRef.js +81 -115
  127. package/dist/SubscriptionRef.js.map +1 -1
  128. package/dist/Terminal.d.ts +2 -1
  129. package/dist/Terminal.d.ts.map +1 -1
  130. package/dist/Terminal.js.map +1 -1
  131. package/dist/Tracer.d.ts +5 -4
  132. package/dist/Tracer.d.ts.map +1 -1
  133. package/dist/Tracer.js +2 -1
  134. package/dist/Tracer.js.map +1 -1
  135. package/dist/Trie.d.ts +26 -14
  136. package/dist/Trie.d.ts.map +1 -1
  137. package/dist/Trie.js +8 -4
  138. package/dist/Trie.js.map +1 -1
  139. package/dist/TxHashMap.d.ts +77 -59
  140. package/dist/TxHashMap.d.ts.map +1 -1
  141. package/dist/TxHashMap.js +25 -19
  142. package/dist/TxHashMap.js.map +1 -1
  143. package/dist/TxSemaphore.d.ts +162 -2
  144. package/dist/TxSemaphore.d.ts.map +1 -1
  145. package/dist/TxSemaphore.js +16 -2
  146. package/dist/TxSemaphore.js.map +1 -1
  147. package/dist/index.d.ts +88 -32
  148. package/dist/index.d.ts.map +1 -1
  149. package/dist/index.js +88 -32
  150. package/dist/index.js.map +1 -1
  151. package/dist/internal/dateTime.js +9 -9
  152. package/dist/internal/dateTime.js.map +1 -1
  153. package/dist/internal/effect.js +20 -89
  154. package/dist/internal/effect.js.map +1 -1
  155. package/dist/internal/hashMap.js +2 -1
  156. package/dist/internal/hashMap.js.map +1 -1
  157. package/dist/internal/option.js +6 -0
  158. package/dist/internal/option.js.map +1 -1
  159. package/dist/internal/trie.js +3 -3
  160. package/dist/internal/trie.js.map +1 -1
  161. package/dist/unstable/ai/AiError.js +1 -1
  162. package/dist/unstable/ai/AiError.js.map +1 -1
  163. package/dist/unstable/ai/AnthropicStructuredOutput.d.ts.map +1 -1
  164. package/dist/unstable/ai/AnthropicStructuredOutput.js +4 -0
  165. package/dist/unstable/ai/AnthropicStructuredOutput.js.map +1 -1
  166. package/dist/unstable/ai/Chat.d.ts.map +1 -1
  167. package/dist/unstable/ai/Chat.js +2 -2
  168. package/dist/unstable/ai/Chat.js.map +1 -1
  169. package/dist/unstable/ai/OpenAiStructuredOutput.d.ts.map +1 -1
  170. package/dist/unstable/ai/OpenAiStructuredOutput.js +4 -0
  171. package/dist/unstable/ai/OpenAiStructuredOutput.js.map +1 -1
  172. package/dist/unstable/ai/Tool.d.ts +14 -0
  173. package/dist/unstable/ai/Tool.d.ts.map +1 -1
  174. package/dist/unstable/ai/Tool.js +13 -0
  175. package/dist/unstable/ai/Tool.js.map +1 -1
  176. package/dist/unstable/cli/Argument.d.ts +2 -4
  177. package/dist/unstable/cli/Argument.d.ts.map +1 -1
  178. package/dist/unstable/cli/Argument.js +1 -3
  179. package/dist/unstable/cli/Argument.js.map +1 -1
  180. package/dist/unstable/cli/CliOutput.d.ts +3 -2
  181. package/dist/unstable/cli/CliOutput.d.ts.map +1 -1
  182. package/dist/unstable/cli/CliOutput.js +4 -3
  183. package/dist/unstable/cli/CliOutput.js.map +1 -1
  184. package/dist/unstable/cli/Command.d.ts +3 -2
  185. package/dist/unstable/cli/Command.d.ts.map +1 -1
  186. package/dist/unstable/cli/Command.js +3 -3
  187. package/dist/unstable/cli/Command.js.map +1 -1
  188. package/dist/unstable/cli/Flag.d.ts +2 -2
  189. package/dist/unstable/cli/Flag.d.ts.map +1 -1
  190. package/dist/unstable/cli/Flag.js +1 -1
  191. package/dist/unstable/cli/Flag.js.map +1 -1
  192. package/dist/unstable/cli/HelpDoc.d.ts +14 -12
  193. package/dist/unstable/cli/HelpDoc.d.ts.map +1 -1
  194. package/dist/unstable/cli/Param.d.ts +4 -4
  195. package/dist/unstable/cli/Param.d.ts.map +1 -1
  196. package/dist/unstable/cli/Param.js +7 -7
  197. package/dist/unstable/cli/Param.js.map +1 -1
  198. package/dist/unstable/cli/Primitive.d.ts +1 -1
  199. package/dist/unstable/cli/Primitive.d.ts.map +1 -1
  200. package/dist/unstable/cli/Primitive.js.map +1 -1
  201. package/dist/unstable/cli/Prompt.js +71 -67
  202. package/dist/unstable/cli/Prompt.js.map +1 -1
  203. package/dist/unstable/cli/internal/completions/CommandDescriptor.js +9 -2
  204. package/dist/unstable/cli/internal/completions/CommandDescriptor.js.map +1 -1
  205. package/dist/unstable/cli/internal/parser.js +8 -3
  206. package/dist/unstable/cli/internal/parser.js.map +1 -1
  207. package/dist/unstable/cluster/ClusterWorkflowEngine.d.ts +3 -2
  208. package/dist/unstable/cluster/ClusterWorkflowEngine.d.ts.map +1 -1
  209. package/dist/unstable/cluster/ClusterWorkflowEngine.js +25 -23
  210. package/dist/unstable/cluster/ClusterWorkflowEngine.js.map +1 -1
  211. package/dist/unstable/cluster/Entity.d.ts +3 -2
  212. package/dist/unstable/cluster/Entity.d.ts.map +1 -1
  213. package/dist/unstable/cluster/Entity.js +7 -7
  214. package/dist/unstable/cluster/Entity.js.map +1 -1
  215. package/dist/unstable/cluster/Message.d.ts +4 -3
  216. package/dist/unstable/cluster/Message.d.ts.map +1 -1
  217. package/dist/unstable/cluster/Message.js +3 -2
  218. package/dist/unstable/cluster/Message.js.map +1 -1
  219. package/dist/unstable/cluster/MessageStorage.d.ts +10 -10
  220. package/dist/unstable/cluster/MessageStorage.d.ts.map +1 -1
  221. package/dist/unstable/cluster/MessageStorage.js +12 -12
  222. package/dist/unstable/cluster/MessageStorage.js.map +1 -1
  223. package/dist/unstable/cluster/Reply.d.ts +2 -1
  224. package/dist/unstable/cluster/Reply.d.ts.map +1 -1
  225. package/dist/unstable/cluster/Reply.js +4 -3
  226. package/dist/unstable/cluster/Reply.js.map +1 -1
  227. package/dist/unstable/cluster/RunnerServer.d.ts.map +1 -1
  228. package/dist/unstable/cluster/RunnerServer.js +9 -8
  229. package/dist/unstable/cluster/RunnerServer.js.map +1 -1
  230. package/dist/unstable/cluster/Runners.d.ts +2 -1
  231. package/dist/unstable/cluster/Runners.d.ts.map +1 -1
  232. package/dist/unstable/cluster/Runners.js +7 -6
  233. package/dist/unstable/cluster/Runners.js.map +1 -1
  234. package/dist/unstable/cluster/Sharding.d.ts.map +1 -1
  235. package/dist/unstable/cluster/Sharding.js +19 -13
  236. package/dist/unstable/cluster/Sharding.js.map +1 -1
  237. package/dist/unstable/cluster/ShardingConfig.d.ts +5 -4
  238. package/dist/unstable/cluster/ShardingConfig.d.ts.map +1 -1
  239. package/dist/unstable/cluster/ShardingConfig.js +4 -4
  240. package/dist/unstable/cluster/ShardingConfig.js.map +1 -1
  241. package/dist/unstable/cluster/SqlMessageStorage.d.ts.map +1 -1
  242. package/dist/unstable/cluster/SqlMessageStorage.js +19 -18
  243. package/dist/unstable/cluster/SqlMessageStorage.js.map +1 -1
  244. package/dist/unstable/cluster/internal/entityManager.js +9 -10
  245. package/dist/unstable/cluster/internal/entityManager.js.map +1 -1
  246. package/dist/unstable/devtools/DevToolsSchema.d.ts +2 -1
  247. package/dist/unstable/devtools/DevToolsSchema.d.ts.map +1 -1
  248. package/dist/unstable/devtools/DevToolsSchema.js +1 -4
  249. package/dist/unstable/devtools/DevToolsSchema.js.map +1 -1
  250. package/dist/unstable/http/Cookies.d.ts +5 -4
  251. package/dist/unstable/http/Cookies.d.ts.map +1 -1
  252. package/dist/unstable/http/Cookies.js +3 -4
  253. package/dist/unstable/http/Cookies.js.map +1 -1
  254. package/dist/unstable/http/Etag.d.ts.map +1 -1
  255. package/dist/unstable/http/Etag.js +5 -1
  256. package/dist/unstable/http/Etag.js.map +1 -1
  257. package/dist/unstable/http/Headers.d.ts +3 -2
  258. package/dist/unstable/http/Headers.d.ts.map +1 -1
  259. package/dist/unstable/http/Headers.js +2 -1
  260. package/dist/unstable/http/Headers.js.map +1 -1
  261. package/dist/unstable/http/HttpClient.d.ts.map +1 -1
  262. package/dist/unstable/http/HttpClient.js +2 -1
  263. package/dist/unstable/http/HttpClient.js.map +1 -1
  264. package/dist/unstable/http/HttpClientRequest.d.ts +4 -3
  265. package/dist/unstable/http/HttpClientRequest.d.ts.map +1 -1
  266. package/dist/unstable/http/HttpClientRequest.js +8 -6
  267. package/dist/unstable/http/HttpClientRequest.js.map +1 -1
  268. package/dist/unstable/http/HttpClientResponse.d.ts.map +1 -1
  269. package/dist/unstable/http/HttpClientResponse.js +2 -1
  270. package/dist/unstable/http/HttpClientResponse.js.map +1 -1
  271. package/dist/unstable/http/HttpIncomingMessage.d.ts +2 -1
  272. package/dist/unstable/http/HttpIncomingMessage.d.ts.map +1 -1
  273. package/dist/unstable/http/HttpIncomingMessage.js.map +1 -1
  274. package/dist/unstable/http/HttpMiddleware.d.ts.map +1 -1
  275. package/dist/unstable/http/HttpMiddleware.js +16 -15
  276. package/dist/unstable/http/HttpMiddleware.js.map +1 -1
  277. package/dist/unstable/http/HttpPlatform.d.ts.map +1 -1
  278. package/dist/unstable/http/HttpPlatform.js +3 -2
  279. package/dist/unstable/http/HttpPlatform.js.map +1 -1
  280. package/dist/unstable/http/HttpRouter.d.ts +2 -1
  281. package/dist/unstable/http/HttpRouter.d.ts.map +1 -1
  282. package/dist/unstable/http/HttpRouter.js +7 -7
  283. package/dist/unstable/http/HttpRouter.js.map +1 -1
  284. package/dist/unstable/http/HttpServer.d.ts.map +1 -1
  285. package/dist/unstable/http/HttpServer.js +2 -2
  286. package/dist/unstable/http/HttpServer.js.map +1 -1
  287. package/dist/unstable/http/HttpServerError.d.ts +2 -1
  288. package/dist/unstable/http/HttpServerError.d.ts.map +1 -1
  289. package/dist/unstable/http/HttpServerError.js +2 -1
  290. package/dist/unstable/http/HttpServerError.js.map +1 -1
  291. package/dist/unstable/http/HttpServerRequest.d.ts +3 -2
  292. package/dist/unstable/http/HttpServerRequest.d.ts.map +1 -1
  293. package/dist/unstable/http/HttpServerRequest.js +14 -10
  294. package/dist/unstable/http/HttpServerRequest.js.map +1 -1
  295. package/dist/unstable/http/HttpServerResponse.d.ts.map +1 -1
  296. package/dist/unstable/http/HttpServerResponse.js +4 -3
  297. package/dist/unstable/http/HttpServerResponse.js.map +1 -1
  298. package/dist/unstable/http/HttpTraceContext.d.ts +3 -2
  299. package/dist/unstable/http/HttpTraceContext.d.ts.map +1 -1
  300. package/dist/unstable/http/HttpTraceContext.js +27 -15
  301. package/dist/unstable/http/HttpTraceContext.js.map +1 -1
  302. package/dist/unstable/http/UrlParams.d.ts +5 -4
  303. package/dist/unstable/http/UrlParams.d.ts.map +1 -1
  304. package/dist/unstable/http/UrlParams.js +5 -6
  305. package/dist/unstable/http/UrlParams.js.map +1 -1
  306. package/dist/unstable/httpapi/HttpApiBuilder.d.ts.map +1 -1
  307. package/dist/unstable/httpapi/HttpApiBuilder.js +4 -2
  308. package/dist/unstable/httpapi/HttpApiBuilder.js.map +1 -1
  309. package/dist/unstable/httpapi/HttpApiError.d.ts +15 -0
  310. package/dist/unstable/httpapi/HttpApiError.d.ts.map +1 -1
  311. package/dist/unstable/httpapi/HttpApiError.js +81 -3
  312. package/dist/unstable/httpapi/HttpApiError.js.map +1 -1
  313. package/dist/unstable/observability/OtlpExporter.d.ts.map +1 -1
  314. package/dist/unstable/observability/OtlpExporter.js +2 -2
  315. package/dist/unstable/observability/OtlpExporter.js.map +1 -1
  316. package/dist/unstable/observability/OtlpTracer.d.ts.map +1 -1
  317. package/dist/unstable/observability/OtlpTracer.js +7 -3
  318. package/dist/unstable/observability/OtlpTracer.js.map +1 -1
  319. package/dist/unstable/reactivity/Atom.d.ts.map +1 -1
  320. package/dist/unstable/reactivity/Atom.js +1 -5
  321. package/dist/unstable/reactivity/Atom.js.map +1 -1
  322. package/dist/unstable/reactivity/AtomRegistry.d.ts.map +1 -1
  323. package/dist/unstable/reactivity/AtomRegistry.js +4 -2
  324. package/dist/unstable/reactivity/AtomRegistry.js.map +1 -1
  325. package/dist/unstable/rpc/Rpc.d.ts.map +1 -1
  326. package/dist/unstable/rpc/Rpc.js +4 -3
  327. package/dist/unstable/rpc/Rpc.js.map +1 -1
  328. package/dist/unstable/rpc/RpcClient.d.ts.map +1 -1
  329. package/dist/unstable/rpc/RpcClient.js +4 -4
  330. package/dist/unstable/rpc/RpcClient.js.map +1 -1
  331. package/dist/unstable/rpc/RpcSchema.d.ts.map +1 -1
  332. package/dist/unstable/rpc/RpcSchema.js +3 -2
  333. package/dist/unstable/rpc/RpcSchema.js.map +1 -1
  334. package/dist/unstable/rpc/RpcSerialization.d.ts.map +1 -1
  335. package/dist/unstable/rpc/RpcSerialization.js +4 -1
  336. package/dist/unstable/rpc/RpcSerialization.js.map +1 -1
  337. package/dist/unstable/rpc/RpcServer.d.ts +1 -1
  338. package/dist/unstable/rpc/RpcServer.d.ts.map +1 -1
  339. package/dist/unstable/rpc/RpcServer.js +3 -2
  340. package/dist/unstable/rpc/RpcServer.js.map +1 -1
  341. package/dist/unstable/socket/Socket.d.ts.map +1 -1
  342. package/dist/unstable/socket/Socket.js +2 -1
  343. package/dist/unstable/socket/Socket.js.map +1 -1
  344. package/dist/unstable/sql/SqlClient.d.ts.map +1 -1
  345. package/dist/unstable/sql/SqlClient.js +1 -1
  346. package/dist/unstable/sql/SqlClient.js.map +1 -1
  347. package/dist/unstable/workflow/DurableDeferred.js +6 -6
  348. package/dist/unstable/workflow/DurableDeferred.js.map +1 -1
  349. package/dist/unstable/workflow/Workflow.d.ts +2 -1
  350. package/dist/unstable/workflow/Workflow.d.ts.map +1 -1
  351. package/dist/unstable/workflow/WorkflowEngine.d.ts +5 -4
  352. package/dist/unstable/workflow/WorkflowEngine.d.ts.map +1 -1
  353. package/dist/unstable/workflow/WorkflowEngine.js +19 -14
  354. package/dist/unstable/workflow/WorkflowEngine.js.map +1 -1
  355. package/package.json +1 -1
  356. package/src/Array.ts +112 -105
  357. package/src/BigDecimal.ts +63 -66
  358. package/src/BigInt.ts +49 -41
  359. package/src/Chunk.ts +68 -63
  360. package/src/Config.ts +4 -1
  361. package/src/Cron.ts +10 -15
  362. package/src/DateTime.ts +16 -15
  363. package/src/Deferred.ts +8 -6
  364. package/src/Duration.ts +34 -33
  365. package/src/Effect.ts +3 -4
  366. package/src/Fiber.ts +2 -1
  367. package/src/FiberHandle.ts +10 -9
  368. package/src/FiberMap.ts +22 -22
  369. package/src/FileSystem.ts +25 -22
  370. package/src/Graph.ts +105 -105
  371. package/src/HashMap.ts +11 -5
  372. package/src/Iterable.ts +13 -13
  373. package/src/Latch.ts +85 -3
  374. package/src/Layer.ts +121 -0
  375. package/src/Number.ts +85 -26
  376. package/src/Option.ts +2 -0
  377. package/src/PartitionedSemaphore.ts +414 -0
  378. package/src/PubSub.ts +7 -6
  379. package/src/Queue.ts +5 -5
  380. package/src/Record.ts +52 -47
  381. package/src/Scheduler.ts +37 -126
  382. package/src/Schema.ts +49 -1
  383. package/src/SchemaGetter.ts +4 -4
  384. package/src/SchemaTransformation.ts +27 -27
  385. package/src/Semaphore.ts +271 -183
  386. package/src/ServiceMap.ts +83 -31
  387. package/src/Stream.ts +1 -1
  388. package/src/String.ts +122 -69
  389. package/src/SubscriptionRef.ts +96 -117
  390. package/src/Terminal.ts +2 -1
  391. package/src/Tracer.ts +6 -5
  392. package/src/Trie.ts +26 -14
  393. package/src/TxHashMap.ts +78 -60
  394. package/src/TxSemaphore.ts +186 -11
  395. package/src/index.ts +89 -33
  396. package/src/internal/dateTime.ts +14 -14
  397. package/src/internal/effect.ts +29 -121
  398. package/src/internal/hashMap.ts +4 -3
  399. package/src/internal/option.ts +7 -0
  400. package/src/internal/trie.ts +6 -6
  401. package/src/unstable/ai/AiError.ts +1 -1
  402. package/src/unstable/ai/AnthropicStructuredOutput.ts +4 -0
  403. package/src/unstable/ai/Chat.ts +6 -2
  404. package/src/unstable/ai/OpenAiStructuredOutput.ts +4 -0
  405. package/src/unstable/ai/Tool.ts +20 -0
  406. package/src/unstable/cli/Argument.ts +2 -4
  407. package/src/unstable/cli/CliOutput.ts +7 -5
  408. package/src/unstable/cli/Command.ts +5 -5
  409. package/src/unstable/cli/Flag.ts +2 -2
  410. package/src/unstable/cli/HelpDoc.ts +14 -12
  411. package/src/unstable/cli/Param.ts +15 -11
  412. package/src/unstable/cli/Primitive.ts +1 -1
  413. package/src/unstable/cli/Prompt.ts +81 -83
  414. package/src/unstable/cli/internal/completions/CommandDescriptor.ts +3 -2
  415. package/src/unstable/cli/internal/parser.ts +7 -4
  416. package/src/unstable/cluster/ClusterWorkflowEngine.ts +35 -30
  417. package/src/unstable/cluster/Entity.ts +13 -12
  418. package/src/unstable/cluster/Message.ts +6 -5
  419. package/src/unstable/cluster/MessageStorage.ts +26 -25
  420. package/src/unstable/cluster/Reply.ts +7 -4
  421. package/src/unstable/cluster/RunnerServer.ts +10 -13
  422. package/src/unstable/cluster/Runners.ts +8 -7
  423. package/src/unstable/cluster/Sharding.ts +24 -17
  424. package/src/unstable/cluster/ShardingConfig.ts +6 -6
  425. package/src/unstable/cluster/SqlMessageStorage.ts +21 -18
  426. package/src/unstable/cluster/internal/entityManager.ts +27 -21
  427. package/src/unstable/devtools/DevToolsSchema.ts +3 -2
  428. package/src/unstable/http/Cookies.ts +7 -8
  429. package/src/unstable/http/Etag.ts +5 -3
  430. package/src/unstable/http/Headers.ts +6 -5
  431. package/src/unstable/http/HttpClient.ts +2 -1
  432. package/src/unstable/http/HttpClientRequest.ts +11 -9
  433. package/src/unstable/http/HttpClientResponse.ts +3 -2
  434. package/src/unstable/http/HttpIncomingMessage.ts +2 -1
  435. package/src/unstable/http/HttpMiddleware.ts +16 -15
  436. package/src/unstable/http/HttpPlatform.ts +3 -2
  437. package/src/unstable/http/HttpRouter.ts +9 -9
  438. package/src/unstable/http/HttpServer.ts +3 -9
  439. package/src/unstable/http/HttpServerError.ts +3 -2
  440. package/src/unstable/http/HttpServerRequest.ts +25 -21
  441. package/src/unstable/http/HttpServerResponse.ts +5 -4
  442. package/src/unstable/http/HttpTraceContext.ts +31 -17
  443. package/src/unstable/http/UrlParams.ts +11 -14
  444. package/src/unstable/httpapi/HttpApiBuilder.ts +9 -3
  445. package/src/unstable/httpapi/HttpApiError.ts +67 -12
  446. package/src/unstable/observability/OtlpExporter.ts +5 -2
  447. package/src/unstable/observability/OtlpTracer.ts +8 -4
  448. package/src/unstable/reactivity/Atom.ts +1 -4
  449. package/src/unstable/reactivity/AtomRegistry.ts +5 -3
  450. package/src/unstable/rpc/Rpc.ts +4 -3
  451. package/src/unstable/rpc/RpcClient.ts +10 -9
  452. package/src/unstable/rpc/RpcSchema.ts +6 -5
  453. package/src/unstable/rpc/RpcSerialization.ts +4 -1
  454. package/src/unstable/rpc/RpcServer.ts +3 -3
  455. package/src/unstable/socket/Socket.ts +2 -1
  456. package/src/unstable/sql/SqlClient.ts +5 -3
  457. package/src/unstable/workflow/DurableDeferred.ts +6 -6
  458. package/src/unstable/workflow/Workflow.ts +1 -1
  459. package/src/unstable/workflow/WorkflowEngine.ts +29 -20
  460. package/dist/NullOr.d.ts +0 -149
  461. package/dist/NullOr.d.ts.map +0 -1
  462. package/dist/NullOr.js +0 -152
  463. package/dist/NullOr.js.map +0 -1
  464. package/src/NullOr.ts +0 -204
package/dist/NullOr.d.ts DELETED
@@ -1,149 +0,0 @@
1
- /**
2
- * This module provides small, allocation-free utilities for working with values of type
3
- * `A | null`, where `null` means "no value".
4
- *
5
- * Why not `Option<A>`?
6
- * In TypeScript, `Option<A>` is often unnecessary. If `null` already models absence
7
- * in your domain, using `A | null` keeps types simple, avoids extra wrappers, and
8
- * reduces overhead. The key is that `A` itself must not include `null`; in this
9
- * module `null` is reserved to mean "no value".
10
- *
11
- * When to use `A | null`:
12
- * - Absence can be represented by `null` in your domain model.
13
- * - You do not need to distinguish between "no value" and "value is null".
14
- * - You want straightforward ergonomics and zero extra allocations.
15
- *
16
- * When to prefer `Option<A>`:
17
- * - You must distinguish `None` from `Some(null)` (that is, `null` is a valid
18
- * payload and carries meaning on its own).
19
- * - You need a tagged representation for serialization or pattern matching across
20
- * boundaries where `null` would be ambiguous.
21
- * - You want the richer `Option` API and are comfortable with the extra wrapper.
22
- *
23
- * Lawfulness note:
24
- * All helpers treat `null` as absence. Do not use these utilities with payloads
25
- * where `A` can itself be `null`, or you will lose information. If you need to
26
- * carry `null` as a valid payload, use `Option<A>` instead.
27
- *
28
- * @since 4.0.0
29
- */
30
- import * as Combiner from "./Combiner.ts";
31
- import type { LazyArg } from "./Function.ts";
32
- import * as Reducer from "./Reducer.ts";
33
- /**
34
- * @since 4.0.0
35
- */
36
- export declare const map: {
37
- /**
38
- * @since 4.0.0
39
- */
40
- <A, B>(f: (a: A) => B): (self: A | null) => B | null;
41
- /**
42
- * @since 4.0.0
43
- */
44
- <A, B>(self: A | null, f: (a: A) => B): B | null;
45
- };
46
- /**
47
- * @since 4.0.0
48
- */
49
- export declare const match: {
50
- /**
51
- * @since 4.0.0
52
- */
53
- <B, A, C = B>(options: {
54
- readonly onNull: LazyArg<B>;
55
- readonly onNotNull: (a: A) => C;
56
- }): (self: A | null) => B | C;
57
- /**
58
- * @since 4.0.0
59
- */
60
- <A, B, C = B>(self: A | null, options: {
61
- readonly onNull: LazyArg<B>;
62
- readonly onNotNull: (a: A) => C;
63
- }): B | C;
64
- };
65
- /**
66
- * @since 4.0.0
67
- */
68
- export declare const getOrThrowWith: {
69
- /**
70
- * @since 4.0.0
71
- */
72
- (onNull: () => unknown): <A>(self: A | null) => A;
73
- /**
74
- * @since 4.0.0
75
- */
76
- <A>(self: A | null, onNull: () => unknown): A;
77
- };
78
- /**
79
- * @since 4.0.0
80
- */
81
- export declare const getOrThrow: <A>(self: A | null) => A;
82
- /**
83
- * @since 4.0.0
84
- */
85
- export declare const liftThrowable: <A extends ReadonlyArray<unknown>, B>(f: (...a: A) => B) => (...a: A) => B | null;
86
- /**
87
- * Creates a `Reducer` for `NullOr<A>` that prioritizes the first non-`null`
88
- * value and combines values when both operands are present.
89
- *
90
- * This `Reducer` is useful for scenarios where you want to:
91
- * - Take the first available value (like a fallback chain)
92
- * - Combine values when both are present
93
- * - Maintain a `null` state only when all values are `null`
94
- *
95
- * The `initialValue` of the `Reducer` is `null`.
96
- *
97
- * **Behavior:**
98
- * - `null` + `null` = `null`
99
- * - `a` + `null` = `a` (first value wins)
100
- * - `null` + `b` = `b` (second value wins)
101
- * - `a` + `b` = `a + b` (values combined)
102
- *
103
- * @since 4.0.0
104
- */
105
- export declare function makeReducer<A>(combiner: Combiner.Combiner<A>): Reducer.Reducer<A | null>;
106
- /**
107
- * Creates a `Combiner` for `NullOr<A>` that only combines values when both
108
- * operands are not `null`, failing fast if either is `null`.
109
- *
110
- * This `Combiner` is useful for scenarios where you need both values to be
111
- * present to perform an operation, such as:
112
- * - Mathematical operations that require two operands
113
- * - Data validation that needs both fields
114
- * - Operations that can't proceed with partial data
115
- *
116
- * **Behavior:**
117
- * - `null` + `null` = `null`
118
- * - `a` + `null` = `null` (fails fast)
119
- * - `null` + `b` = `null` (fails fast)
120
- * - `a` + `b` = `a + b` (values combined)
121
- *
122
- * @see {@link makeReducerFailFast} if you have a `Reducer` and want to lift it
123
- * to `NullOr` values.
124
- *
125
- * @since 4.0.0
126
- */
127
- export declare function makeCombinerFailFast<A>(combiner: Combiner.Combiner<A>): Combiner.Combiner<A | null>;
128
- /**
129
- * Creates a `Reducer` for `NullOr<A>` by wrapping an existing `Reducer` with
130
- * fail-fast semantics for `NullOr` values.
131
- *
132
- * This function lifts a regular `Reducer` into the `NullOr` context, allowing
133
- * you to use existing `Reducer`s with `NullOr` values while maintaining the
134
- * fail-fast behavior where any `null` value causes the entire reduction to fail.
135
- *
136
- * The initial value is `some(reducer.initialValue)`, ensuring the `Reducer`
137
- * starts with a valid `NullOr` value.
138
- *
139
- * **Behavior:**
140
- * - Fails fast (returns `null`) if any operand is `null`
141
- * - Uses the underlying reducer's combine logic when both values are present
142
- *
143
- * @see {@link makeCombinerFailFast} if you only have a `Combiner` and want to
144
- * lift it to `NullOr` values.
145
- *
146
- * @since 4.0.0
147
- */
148
- export declare function makeReducerFailFast<A>(reducer: Reducer.Reducer<A>): Reducer.Reducer<A | null>;
149
- //# sourceMappingURL=NullOr.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"NullOr.d.ts","sourceRoot":"","sources":["../src/NullOr.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AACH,OAAO,KAAK,QAAQ,MAAM,eAAe,CAAA;AACzC,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,eAAe,CAAA;AAE5C,OAAO,KAAK,OAAO,MAAM,cAAc,CAAA;AAEvC;;GAEG;AACH,eAAO,MAAM,GAAG,EAAE;IAChB;;OAEG;IACH,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,EAAE,CAAC,KAAK,CAAC,GAAG,CAAC,IAAI,EAAE,CAAC,GAAG,IAAI,KAAK,CAAC,GAAG,IAAI,CAAA;IACpD;;OAEG;IACH,CAAC,CAAC,EAAE,CAAC,EAAE,IAAI,EAAE,CAAC,GAAG,IAAI,EAAE,CAAC,EAAE,CAAC,CAAC,EAAE,CAAC,KAAK,CAAC,GAAG,CAAC,GAAG,IAAI,CAAA;CACQ,CAAA;AAE1D;;GAEG;AACH,eAAO,MAAM,KAAK,EAAE;IAClB;;OAEG;IACH,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,GAAG,CAAC,EACV,OAAO,EAAE;QACP,QAAQ,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC,CAAA;QAC3B,QAAQ,CAAC,SAAS,EAAE,CAAC,CAAC,EAAE,CAAC,KAAK,CAAC,CAAA;KAChC,GACA,CAAC,IAAI,EAAE,CAAC,GAAG,IAAI,KAAK,CAAC,GAAG,CAAC,CAAA;IAC5B;;OAEG;IACH,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,GAAG,CAAC,EACV,IAAI,EAAE,CAAC,GAAG,IAAI,EACd,OAAO,EAAE;QACP,QAAQ,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC,CAAA;QAC3B,QAAQ,CAAC,SAAS,EAAE,CAAC,CAAC,EAAE,CAAC,KAAK,CAAC,CAAA;KAChC,GACA,CAAC,GAAG,CAAC,CAAA;CAOT,CAAA;AAED;;GAEG;AACH,eAAO,MAAM,cAAc,EAAE;IAC3B;;OAEG;IACH,CAAC,MAAM,EAAE,MAAM,OAAO,GAAG,CAAC,CAAC,EAAE,IAAI,EAAE,CAAC,GAAG,IAAI,KAAK,CAAC,CAAA;IACjD;;OAEG;IACH,CAAC,CAAC,EAAE,IAAI,EAAE,CAAC,GAAG,IAAI,EAAE,MAAM,EAAE,MAAM,OAAO,GAAG,CAAC,CAAA;CAM7C,CAAA;AAEF;;GAEG;AACH,eAAO,MAAM,UAAU,EAAE,CAAC,CAAC,EAAE,IAAI,EAAE,CAAC,GAAG,IAAI,KAAK,CAAkE,CAAA;AAElH;;GAEG;AACH,eAAO,MAAM,aAAa,GAAI,CAAC,SAAS,aAAa,CAAC,OAAO,CAAC,EAAE,CAAC,EAC/D,GAAG,CAAC,GAAG,CAAC,EAAE,CAAC,KAAK,CAAC,KAChB,CAAC,GAAG,CAAC,EAAE,CAAC,KAAK,CAAC,GAAG,IAOnB,CAAA;AAED;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAgB,WAAW,CAAC,CAAC,EAAE,QAAQ,EAAE,QAAQ,CAAC,QAAQ,CAAC,CAAC,CAAC,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC,GAAG,IAAI,CAAC,CAMxF;AAED;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,wBAAgB,oBAAoB,CAAC,CAAC,EAAE,QAAQ,EAAE,QAAQ,CAAC,QAAQ,CAAC,CAAC,CAAC,GAAG,QAAQ,CAAC,QAAQ,CAAC,CAAC,GAAG,IAAI,CAAC,CAKnG;AAED;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAgB,mBAAmB,CAAC,CAAC,EAAE,OAAO,EAAE,OAAO,CAAC,OAAO,CAAC,CAAC,CAAC,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC,GAAG,IAAI,CAAC,CAW7F"}
package/dist/NullOr.js DELETED
@@ -1,152 +0,0 @@
1
- /**
2
- * This module provides small, allocation-free utilities for working with values of type
3
- * `A | null`, where `null` means "no value".
4
- *
5
- * Why not `Option<A>`?
6
- * In TypeScript, `Option<A>` is often unnecessary. If `null` already models absence
7
- * in your domain, using `A | null` keeps types simple, avoids extra wrappers, and
8
- * reduces overhead. The key is that `A` itself must not include `null`; in this
9
- * module `null` is reserved to mean "no value".
10
- *
11
- * When to use `A | null`:
12
- * - Absence can be represented by `null` in your domain model.
13
- * - You do not need to distinguish between "no value" and "value is null".
14
- * - You want straightforward ergonomics and zero extra allocations.
15
- *
16
- * When to prefer `Option<A>`:
17
- * - You must distinguish `None` from `Some(null)` (that is, `null` is a valid
18
- * payload and carries meaning on its own).
19
- * - You need a tagged representation for serialization or pattern matching across
20
- * boundaries where `null` would be ambiguous.
21
- * - You want the richer `Option` API and are comfortable with the extra wrapper.
22
- *
23
- * Lawfulness note:
24
- * All helpers treat `null` as absence. Do not use these utilities with payloads
25
- * where `A` can itself be `null`, or you will lose information. If you need to
26
- * carry `null` as a valid payload, use `Option<A>` instead.
27
- *
28
- * @since 4.0.0
29
- */
30
- import * as Combiner from "./Combiner.js";
31
- import { dual } from "./Function.js";
32
- import * as Reducer from "./Reducer.js";
33
- /**
34
- * @since 4.0.0
35
- */
36
- export const map = /*#__PURE__*/dual(2, (self, f) => self === null ? null : f(self));
37
- /**
38
- * @since 4.0.0
39
- */
40
- export const match = /*#__PURE__*/dual(2, (self, {
41
- onNotNull,
42
- onNull
43
- }) => self === null ? onNull() : onNotNull(self));
44
- /**
45
- * @since 4.0.0
46
- */
47
- export const getOrThrowWith = /*#__PURE__*/dual(2, (self, onNull) => {
48
- if (self !== null) {
49
- return self;
50
- }
51
- throw onNull();
52
- });
53
- /**
54
- * @since 4.0.0
55
- */
56
- export const getOrThrow = /*#__PURE__*/getOrThrowWith(() => new Error("getOrThrow called on a null"));
57
- /**
58
- * @since 4.0.0
59
- */
60
- export const liftThrowable = f => (...a) => {
61
- try {
62
- return f(...a);
63
- } catch {
64
- return null;
65
- }
66
- };
67
- /**
68
- * Creates a `Reducer` for `NullOr<A>` that prioritizes the first non-`null`
69
- * value and combines values when both operands are present.
70
- *
71
- * This `Reducer` is useful for scenarios where you want to:
72
- * - Take the first available value (like a fallback chain)
73
- * - Combine values when both are present
74
- * - Maintain a `null` state only when all values are `null`
75
- *
76
- * The `initialValue` of the `Reducer` is `null`.
77
- *
78
- * **Behavior:**
79
- * - `null` + `null` = `null`
80
- * - `a` + `null` = `a` (first value wins)
81
- * - `null` + `b` = `b` (second value wins)
82
- * - `a` + `b` = `a + b` (values combined)
83
- *
84
- * @since 4.0.0
85
- */
86
- export function makeReducer(combiner) {
87
- return Reducer.make((self, that) => {
88
- if (self === null) return that;
89
- if (that === null) return self;
90
- return combiner.combine(self, that);
91
- }, null);
92
- }
93
- /**
94
- * Creates a `Combiner` for `NullOr<A>` that only combines values when both
95
- * operands are not `null`, failing fast if either is `null`.
96
- *
97
- * This `Combiner` is useful for scenarios where you need both values to be
98
- * present to perform an operation, such as:
99
- * - Mathematical operations that require two operands
100
- * - Data validation that needs both fields
101
- * - Operations that can't proceed with partial data
102
- *
103
- * **Behavior:**
104
- * - `null` + `null` = `null`
105
- * - `a` + `null` = `null` (fails fast)
106
- * - `null` + `b` = `null` (fails fast)
107
- * - `a` + `b` = `a + b` (values combined)
108
- *
109
- * @see {@link makeReducerFailFast} if you have a `Reducer` and want to lift it
110
- * to `NullOr` values.
111
- *
112
- * @since 4.0.0
113
- */
114
- export function makeCombinerFailFast(combiner) {
115
- return Combiner.make((self, that) => {
116
- if (self === null || that === null) return null;
117
- return combiner.combine(self, that);
118
- });
119
- }
120
- /**
121
- * Creates a `Reducer` for `NullOr<A>` by wrapping an existing `Reducer` with
122
- * fail-fast semantics for `NullOr` values.
123
- *
124
- * This function lifts a regular `Reducer` into the `NullOr` context, allowing
125
- * you to use existing `Reducer`s with `NullOr` values while maintaining the
126
- * fail-fast behavior where any `null` value causes the entire reduction to fail.
127
- *
128
- * The initial value is `some(reducer.initialValue)`, ensuring the `Reducer`
129
- * starts with a valid `NullOr` value.
130
- *
131
- * **Behavior:**
132
- * - Fails fast (returns `null`) if any operand is `null`
133
- * - Uses the underlying reducer's combine logic when both values are present
134
- *
135
- * @see {@link makeCombinerFailFast} if you only have a `Combiner` and want to
136
- * lift it to `NullOr` values.
137
- *
138
- * @since 4.0.0
139
- */
140
- export function makeReducerFailFast(reducer) {
141
- const combine = makeCombinerFailFast(reducer).combine;
142
- const initialValue = reducer.initialValue;
143
- return Reducer.make(combine, initialValue, collection => {
144
- let out = initialValue;
145
- for (const value of collection) {
146
- out = combine(out, value);
147
- if (out === null) return out;
148
- }
149
- return out;
150
- });
151
- }
152
- //# sourceMappingURL=NullOr.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"NullOr.js","names":["Combiner","dual","Reducer","map","self","f","match","onNotNull","onNull","getOrThrowWith","getOrThrow","Error","liftThrowable","a","makeReducer","combiner","make","that","combine","makeCombinerFailFast","makeReducerFailFast","reducer","initialValue","collection","out","value"],"sources":["../src/NullOr.ts"],"sourcesContent":[null],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA6BA,OAAO,KAAKA,QAAQ,MAAM,eAAe;AAEzC,SAASC,IAAI,QAAQ,eAAe;AACpC,OAAO,KAAKC,OAAO,MAAM,cAAc;AAEvC;;;AAGA,OAAO,MAAMC,GAAG,gBASZF,IAAI,CAAC,CAAC,EAAE,CAACG,IAAI,EAAEC,CAAC,KAAMD,IAAI,KAAK,IAAI,GAAG,IAAI,GAAGC,CAAC,CAACD,IAAI,CAAE,CAAC;AAE1D;;;AAGA,OAAO,MAAME,KAAK,gBAoBdL,IAAI,CACN,CAAC,EACD,CAAcG,IAAc,EAAE;EAAEG,SAAS;EAAEC;AAAM,CAGhD,KAAYJ,IAAI,KAAK,IAAI,GAAGI,MAAM,EAAE,GAAGD,SAAS,CAACH,IAAI,CAAC,CACxD;AAED;;;AAGA,OAAO,MAAMK,cAAc,gBASvBR,IAAI,CAAC,CAAC,EAAE,CAAIG,IAAc,EAAEI,MAAqB,KAAO;EAC1D,IAAIJ,IAAI,KAAK,IAAI,EAAE;IACjB,OAAOA,IAAI;EACb;EACA,MAAMI,MAAM,EAAE;AAChB,CAAC,CAAC;AAEF;;;AAGA,OAAO,MAAME,UAAU,gBAA6BD,cAAc,CAAC,MAAM,IAAIE,KAAK,CAAC,6BAA6B,CAAC,CAAC;AAElH;;;AAGA,OAAO,MAAMC,aAAa,GACxBP,CAAiB,IAEnB,CAAC,GAAGQ,CAAC,KAAI;EACP,IAAI;IACF,OAAOR,CAAC,CAAC,GAAGQ,CAAC,CAAC;EAChB,CAAC,CAAC,MAAM;IACN,OAAO,IAAI;EACb;AACF,CAAC;AAED;;;;;;;;;;;;;;;;;;;AAmBA,OAAM,SAAUC,WAAWA,CAAIC,QAA8B;EAC3D,OAAOb,OAAO,CAACc,IAAI,CAAC,CAACZ,IAAI,EAAEa,IAAI,KAAI;IACjC,IAAIb,IAAI,KAAK,IAAI,EAAE,OAAOa,IAAI;IAC9B,IAAIA,IAAI,KAAK,IAAI,EAAE,OAAOb,IAAI;IAC9B,OAAOW,QAAQ,CAACG,OAAO,CAACd,IAAI,EAAEa,IAAI,CAAC;EACrC,CAAC,EAAE,IAAgB,CAAC;AACtB;AAEA;;;;;;;;;;;;;;;;;;;;;AAqBA,OAAM,SAAUE,oBAAoBA,CAAIJ,QAA8B;EACpE,OAAOf,QAAQ,CAACgB,IAAI,CAAC,CAACZ,IAAI,EAAEa,IAAI,KAAI;IAClC,IAAIb,IAAI,KAAK,IAAI,IAAIa,IAAI,KAAK,IAAI,EAAE,OAAO,IAAI;IAC/C,OAAOF,QAAQ,CAACG,OAAO,CAACd,IAAI,EAAEa,IAAI,CAAC;EACrC,CAAC,CAAC;AACJ;AAEA;;;;;;;;;;;;;;;;;;;;AAoBA,OAAM,SAAUG,mBAAmBA,CAAIC,OAA2B;EAChE,MAAMH,OAAO,GAAGC,oBAAoB,CAACE,OAAO,CAAC,CAACH,OAAO;EACrD,MAAMI,YAAY,GAAGD,OAAO,CAACC,YAAwB;EACrD,OAAOpB,OAAO,CAACc,IAAI,CAACE,OAAO,EAAEI,YAAY,EAAGC,UAAU,IAAI;IACxD,IAAIC,GAAG,GAAGF,YAAY;IACtB,KAAK,MAAMG,KAAK,IAAIF,UAAU,EAAE;MAC9BC,GAAG,GAAGN,OAAO,CAACM,GAAG,EAAEC,KAAK,CAAC;MACzB,IAAID,GAAG,KAAK,IAAI,EAAE,OAAOA,GAAG;IAC9B;IACA,OAAOA,GAAG;EACZ,CAAC,CAAC;AACJ","ignoreList":[]}
package/src/NullOr.ts DELETED
@@ -1,204 +0,0 @@
1
- /**
2
- * This module provides small, allocation-free utilities for working with values of type
3
- * `A | null`, where `null` means "no value".
4
- *
5
- * Why not `Option<A>`?
6
- * In TypeScript, `Option<A>` is often unnecessary. If `null` already models absence
7
- * in your domain, using `A | null` keeps types simple, avoids extra wrappers, and
8
- * reduces overhead. The key is that `A` itself must not include `null`; in this
9
- * module `null` is reserved to mean "no value".
10
- *
11
- * When to use `A | null`:
12
- * - Absence can be represented by `null` in your domain model.
13
- * - You do not need to distinguish between "no value" and "value is null".
14
- * - You want straightforward ergonomics and zero extra allocations.
15
- *
16
- * When to prefer `Option<A>`:
17
- * - You must distinguish `None` from `Some(null)` (that is, `null` is a valid
18
- * payload and carries meaning on its own).
19
- * - You need a tagged representation for serialization or pattern matching across
20
- * boundaries where `null` would be ambiguous.
21
- * - You want the richer `Option` API and are comfortable with the extra wrapper.
22
- *
23
- * Lawfulness note:
24
- * All helpers treat `null` as absence. Do not use these utilities with payloads
25
- * where `A` can itself be `null`, or you will lose information. If you need to
26
- * carry `null` as a valid payload, use `Option<A>` instead.
27
- *
28
- * @since 4.0.0
29
- */
30
- import * as Combiner from "./Combiner.ts"
31
- import type { LazyArg } from "./Function.ts"
32
- import { dual } from "./Function.ts"
33
- import * as Reducer from "./Reducer.ts"
34
-
35
- /**
36
- * @since 4.0.0
37
- */
38
- export const map: {
39
- /**
40
- * @since 4.0.0
41
- */
42
- <A, B>(f: (a: A) => B): (self: A | null) => B | null
43
- /**
44
- * @since 4.0.0
45
- */
46
- <A, B>(self: A | null, f: (a: A) => B): B | null
47
- } = dual(2, (self, f) => (self === null ? null : f(self)))
48
-
49
- /**
50
- * @since 4.0.0
51
- */
52
- export const match: {
53
- /**
54
- * @since 4.0.0
55
- */
56
- <B, A, C = B>(
57
- options: {
58
- readonly onNull: LazyArg<B>
59
- readonly onNotNull: (a: A) => C
60
- }
61
- ): (self: A | null) => B | C
62
- /**
63
- * @since 4.0.0
64
- */
65
- <A, B, C = B>(
66
- self: A | null,
67
- options: {
68
- readonly onNull: LazyArg<B>
69
- readonly onNotNull: (a: A) => C
70
- }
71
- ): B | C
72
- } = dual(
73
- 2,
74
- <A, B, C = B>(self: A | null, { onNotNull, onNull }: {
75
- readonly onNull: LazyArg<B>
76
- readonly onNotNull: (a: A) => C
77
- }): B | C => self === null ? onNull() : onNotNull(self)
78
- )
79
-
80
- /**
81
- * @since 4.0.0
82
- */
83
- export const getOrThrowWith: {
84
- /**
85
- * @since 4.0.0
86
- */
87
- (onNull: () => unknown): <A>(self: A | null) => A
88
- /**
89
- * @since 4.0.0
90
- */
91
- <A>(self: A | null, onNull: () => unknown): A
92
- } = dual(2, <A>(self: A | null, onNull: () => unknown): A => {
93
- if (self !== null) {
94
- return self
95
- }
96
- throw onNull()
97
- })
98
-
99
- /**
100
- * @since 4.0.0
101
- */
102
- export const getOrThrow: <A>(self: A | null) => A = getOrThrowWith(() => new Error("getOrThrow called on a null"))
103
-
104
- /**
105
- * @since 4.0.0
106
- */
107
- export const liftThrowable = <A extends ReadonlyArray<unknown>, B>(
108
- f: (...a: A) => B
109
- ): (...a: A) => B | null =>
110
- (...a) => {
111
- try {
112
- return f(...a)
113
- } catch {
114
- return null
115
- }
116
- }
117
-
118
- /**
119
- * Creates a `Reducer` for `NullOr<A>` that prioritizes the first non-`null`
120
- * value and combines values when both operands are present.
121
- *
122
- * This `Reducer` is useful for scenarios where you want to:
123
- * - Take the first available value (like a fallback chain)
124
- * - Combine values when both are present
125
- * - Maintain a `null` state only when all values are `null`
126
- *
127
- * The `initialValue` of the `Reducer` is `null`.
128
- *
129
- * **Behavior:**
130
- * - `null` + `null` = `null`
131
- * - `a` + `null` = `a` (first value wins)
132
- * - `null` + `b` = `b` (second value wins)
133
- * - `a` + `b` = `a + b` (values combined)
134
- *
135
- * @since 4.0.0
136
- */
137
- export function makeReducer<A>(combiner: Combiner.Combiner<A>): Reducer.Reducer<A | null> {
138
- return Reducer.make((self, that) => {
139
- if (self === null) return that
140
- if (that === null) return self
141
- return combiner.combine(self, that)
142
- }, null as A | null)
143
- }
144
-
145
- /**
146
- * Creates a `Combiner` for `NullOr<A>` that only combines values when both
147
- * operands are not `null`, failing fast if either is `null`.
148
- *
149
- * This `Combiner` is useful for scenarios where you need both values to be
150
- * present to perform an operation, such as:
151
- * - Mathematical operations that require two operands
152
- * - Data validation that needs both fields
153
- * - Operations that can't proceed with partial data
154
- *
155
- * **Behavior:**
156
- * - `null` + `null` = `null`
157
- * - `a` + `null` = `null` (fails fast)
158
- * - `null` + `b` = `null` (fails fast)
159
- * - `a` + `b` = `a + b` (values combined)
160
- *
161
- * @see {@link makeReducerFailFast} if you have a `Reducer` and want to lift it
162
- * to `NullOr` values.
163
- *
164
- * @since 4.0.0
165
- */
166
- export function makeCombinerFailFast<A>(combiner: Combiner.Combiner<A>): Combiner.Combiner<A | null> {
167
- return Combiner.make((self, that) => {
168
- if (self === null || that === null) return null
169
- return combiner.combine(self, that)
170
- })
171
- }
172
-
173
- /**
174
- * Creates a `Reducer` for `NullOr<A>` by wrapping an existing `Reducer` with
175
- * fail-fast semantics for `NullOr` values.
176
- *
177
- * This function lifts a regular `Reducer` into the `NullOr` context, allowing
178
- * you to use existing `Reducer`s with `NullOr` values while maintaining the
179
- * fail-fast behavior where any `null` value causes the entire reduction to fail.
180
- *
181
- * The initial value is `some(reducer.initialValue)`, ensuring the `Reducer`
182
- * starts with a valid `NullOr` value.
183
- *
184
- * **Behavior:**
185
- * - Fails fast (returns `null`) if any operand is `null`
186
- * - Uses the underlying reducer's combine logic when both values are present
187
- *
188
- * @see {@link makeCombinerFailFast} if you only have a `Combiner` and want to
189
- * lift it to `NullOr` values.
190
- *
191
- * @since 4.0.0
192
- */
193
- export function makeReducerFailFast<A>(reducer: Reducer.Reducer<A>): Reducer.Reducer<A | null> {
194
- const combine = makeCombinerFailFast(reducer).combine
195
- const initialValue = reducer.initialValue as A | null
196
- return Reducer.make(combine, initialValue, (collection) => {
197
- let out = initialValue
198
- for (const value of collection) {
199
- out = combine(out, value)
200
- if (out === null) return out
201
- }
202
- return out
203
- })
204
- }