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/src/Chunk.ts CHANGED
@@ -88,7 +88,6 @@ import { hasProperty, type Predicate, type Refinement } from "./Predicate.ts"
88
88
  import * as R from "./Result.ts"
89
89
  import type { Result } from "./Result.ts"
90
90
  import type { Covariant, NoInfer } from "./Types.ts"
91
- import * as UndefinedOr from "./UndefinedOr.ts"
92
91
 
93
92
  const TypeId = "~effect/collections/Chunk"
94
93
 
@@ -3467,7 +3466,7 @@ export const splitWhere: {
3467
3466
  * @since 2.0.0
3468
3467
  * @category elements
3469
3468
  */
3470
- export const tail = <A>(self: Chunk<A>): Chunk<A> | undefined => self.length > 0 ? drop(self, 1) : undefined
3469
+ export const tail = <A>(self: Chunk<A>): O.Option<Chunk<A>> => self.length > 0 ? O.some(drop(self, 1)) : O.none()
3471
3470
 
3472
3471
  /**
3473
3472
  * Returns every elements after the first.
@@ -4096,15 +4095,15 @@ export const remove: {
4096
4095
  *
4097
4096
  * const chunk = Chunk.make(1, 2, 3, 4)
4098
4097
  * const result = Chunk.modify(chunk, 1, (n) => n * 10)
4099
- * console.log(result) // { _id: 'Chunk', values: [ 1, 20, 3, 4 ] }
4098
+ * console.log(result) // Option.some(Chunk.make(1, 20, 3, 4))
4100
4099
  *
4101
4100
  * // Index out of bounds returns None
4102
- * const outOfBounds = chunk?.pipe(Chunk.modify(10, (n) => n * 10))
4103
- * console.log(outOfBounds === undefined) // true
4101
+ * const outOfBounds = chunk.pipe(Chunk.modify(10, (n) => n * 10))
4102
+ * console.log(outOfBounds) // Option.none()
4104
4103
  *
4105
4104
  * // Negative index returns None
4106
- * const negative = chunk?.pipe(Chunk.modify(-1, (n) => n * 10))
4107
- * console.log(negative === undefined) // true
4105
+ * const negative = chunk.pipe(Chunk.modify(-1, (n) => n * 10))
4106
+ * console.log(negative) // Option.none()
4108
4107
  * ```
4109
4108
  *
4110
4109
  * @category elements
@@ -4121,21 +4120,21 @@ export const modify: {
4121
4120
  *
4122
4121
  * const chunk = Chunk.make(1, 2, 3, 4)
4123
4122
  * const result = Chunk.modify(chunk, 1, (n) => n * 10)
4124
- * console.log(result) // { _id: 'Chunk', values: [ 1, 20, 3, 4 ] }
4123
+ * console.log(result) // Option.some(Chunk.make(1, 20, 3, 4))
4125
4124
  *
4126
4125
  * // Index out of bounds returns None
4127
- * const outOfBounds = chunk?.pipe(Chunk.modify(10, (n) => n * 10))
4128
- * console.log(outOfBounds === undefined) // true
4126
+ * const outOfBounds = chunk.pipe(Chunk.modify(10, (n) => n * 10))
4127
+ * console.log(outOfBounds) // Option.none()
4129
4128
  *
4130
4129
  * // Negative index returns None
4131
- * const negative = chunk?.pipe(Chunk.modify(-1, (n) => n * 10))
4132
- * console.log(negative === undefined) // true
4130
+ * const negative = chunk.pipe(Chunk.modify(-1, (n) => n * 10))
4131
+ * console.log(negative) // Option.none()
4133
4132
  * ```
4134
4133
  *
4135
4134
  * @category elements
4136
4135
  * @since 2.0.0
4137
4136
  */
4138
- <A, B>(i: number, f: (a: A) => B): (self: Chunk<A>) => Chunk<A | B> | undefined
4137
+ <A, B>(i: number, f: (a: A) => B): (self: Chunk<A>) => O.Option<Chunk<A | B>>
4139
4138
  /**
4140
4139
  * Applies a function to the element at the specified index, creating a new `Chunk`,
4141
4140
  * or returns `None` if the index is out of bounds.
@@ -4146,25 +4145,25 @@ export const modify: {
4146
4145
  *
4147
4146
  * const chunk = Chunk.make(1, 2, 3, 4)
4148
4147
  * const result = Chunk.modify(chunk, 1, (n) => n * 10)
4149
- * console.log(result) // { _id: 'Chunk', values: [ 1, 20, 3, 4 ] }
4148
+ * console.log(result) // Option.some(Chunk.make(1, 20, 3, 4))
4150
4149
  *
4151
4150
  * // Index out of bounds returns None
4152
- * const outOfBounds = chunk?.pipe(Chunk.modify(10, (n) => n * 10))
4153
- * console.log(outOfBounds === undefined) // true
4151
+ * const outOfBounds = chunk.pipe(Chunk.modify(10, (n) => n * 10))
4152
+ * console.log(outOfBounds) // Option.none()
4154
4153
  *
4155
4154
  * // Negative index returns None
4156
- * const negative = chunk?.pipe(Chunk.modify(-1, (n) => n * 10))
4157
- * console.log(negative === undefined) // true
4155
+ * const negative = chunk.pipe(Chunk.modify(-1, (n) => n * 10))
4156
+ * console.log(negative) // Option.none()
4158
4157
  * ```
4159
4158
  *
4160
4159
  * @category elements
4161
4160
  * @since 2.0.0
4162
4161
  */
4163
- <A, B>(self: Chunk<A>, i: number, f: (a: A) => B): Chunk<A | B> | undefined
4162
+ <A, B>(self: Chunk<A>, i: number, f: (a: A) => B): O.Option<Chunk<A | B>>
4164
4163
  } = dual(
4165
4164
  3,
4166
- <A, B>(self: Chunk<A>, i: number, f: (a: A) => B): Chunk<A | B> | undefined =>
4167
- UndefinedOr.map(RA.modify(toReadonlyArray(self), i, f), fromArrayUnsafe)
4165
+ <A, B>(self: Chunk<A>, i: number, f: (a: A) => B): O.Option<Chunk<A | B>> =>
4166
+ pipe(RA.modify(toReadonlyArray(self), i, f), O.map(fromArrayUnsafe))
4168
4167
  )
4169
4168
 
4170
4169
  /**
@@ -4177,15 +4176,15 @@ export const modify: {
4177
4176
  *
4178
4177
  * const chunk = Chunk.make("a", "b", "c", "d")
4179
4178
  * const result = Chunk.replace(chunk, 1, "X")
4180
- * console.log(result) // { _id: 'Chunk', values: [ 'a', 'X', 'c', 'd' ] }
4179
+ * console.log(result) // Option.some(Chunk.make("a", "X", "c", "d"))
4181
4180
  *
4182
4181
  * // Index out of bounds returns None
4183
- * const outOfBounds = chunk?.pipe(Chunk.replace(10, "Y"))
4184
- * console.log(outOfBounds === undefined) // true
4182
+ * const outOfBounds = chunk.pipe(Chunk.replace(10, "Y"))
4183
+ * console.log(outOfBounds) // Option.none()
4185
4184
  *
4186
4185
  * // Negative index returns None
4187
- * const negative = chunk?.pipe(Chunk.replace(-1, "Z"))
4188
- * console.log(negative === undefined) // true
4186
+ * const negative = chunk.pipe(Chunk.replace(-1, "Z"))
4187
+ * console.log(negative) // Option.none()
4189
4188
  * ```
4190
4189
  *
4191
4190
  * @category elements
@@ -4202,21 +4201,21 @@ export const replace: {
4202
4201
  *
4203
4202
  * const chunk = Chunk.make("a", "b", "c", "d")
4204
4203
  * const result = Chunk.replace(chunk, 1, "X")
4205
- * console.log(result) // { _id: 'Chunk', values: [ 'a', 'X', 'c', 'd' ] }
4204
+ * console.log(result) // Option.some(Chunk.make("a", "X", "c", "d"))
4206
4205
  *
4207
4206
  * // Index out of bounds returns None
4208
- * const outOfBounds = chunk?.pipe(Chunk.replace(10, "Y"))
4209
- * console.log(outOfBounds === undefined) // true
4207
+ * const outOfBounds = chunk.pipe(Chunk.replace(10, "Y"))
4208
+ * console.log(outOfBounds) // Option.none()
4210
4209
  *
4211
4210
  * // Negative index returns None
4212
- * const negative = chunk?.pipe(Chunk.replace(-1, "Z"))
4213
- * console.log(negative === undefined) // true
4211
+ * const negative = chunk.pipe(Chunk.replace(-1, "Z"))
4212
+ * console.log(negative) // Option.none()
4214
4213
  * ```
4215
4214
  *
4216
4215
  * @category elements
4217
4216
  * @since 2.0.0
4218
4217
  */
4219
- <B>(i: number, b: B): <A>(self: Chunk<A>) => Chunk<B | A> | undefined
4218
+ <B>(i: number, b: B): <A>(self: Chunk<A>) => O.Option<Chunk<B | A>>
4220
4219
  /**
4221
4220
  * Change the element at the specified index, creating a new `Chunk`,
4222
4221
  * or returns `None` if the index is out of bounds.
@@ -4227,22 +4226,22 @@ export const replace: {
4227
4226
  *
4228
4227
  * const chunk = Chunk.make("a", "b", "c", "d")
4229
4228
  * const result = Chunk.replace(chunk, 1, "X")
4230
- * console.log(result) // { _id: 'Chunk', values: [ 'a', 'X', 'c', 'd' ] }
4229
+ * console.log(result) // Option.some(Chunk.make("a", "X", "c", "d"))
4231
4230
  *
4232
4231
  * // Index out of bounds returns None
4233
- * const outOfBounds = chunk?.pipe(Chunk.replace(10, "Y"))
4234
- * console.log(outOfBounds === undefined) // true
4232
+ * const outOfBounds = chunk.pipe(Chunk.replace(10, "Y"))
4233
+ * console.log(outOfBounds) // Option.none()
4235
4234
  *
4236
4235
  * // Negative index returns None
4237
- * const negative = chunk?.pipe(Chunk.replace(-1, "Z"))
4238
- * console.log(negative === undefined) // true
4236
+ * const negative = chunk.pipe(Chunk.replace(-1, "Z"))
4237
+ * console.log(negative) // Option.none()
4239
4238
  * ```
4240
4239
  *
4241
4240
  * @category elements
4242
4241
  * @since 2.0.0
4243
4242
  */
4244
- <A, B>(self: Chunk<A>, i: number, b: B): Chunk<B | A> | undefined
4245
- } = dual(3, <A, B>(self: Chunk<A>, i: number, b: B): Chunk<B | A> | undefined => modify(self, i, () => b))
4243
+ <A, B>(self: Chunk<A>, i: number, b: B): O.Option<Chunk<B | A>>
4244
+ } = dual(3, <A, B>(self: Chunk<A>, i: number, b: B): O.Option<Chunk<B | A>> => modify(self, i, () => b))
4246
4245
 
4247
4246
  /**
4248
4247
  * Return a Chunk of length n with element i initialized with f(i).
@@ -4603,15 +4602,15 @@ export const findFirst: {
4603
4602
  *
4604
4603
  * const chunk = Chunk.make(1, 2, 3, 4, 5)
4605
4604
  * const result = Chunk.findFirstIndex(chunk, (n) => n > 3)
4606
- * console.log(result) // 3
4605
+ * console.log(result) // Option.some(3)
4607
4606
  *
4608
4607
  * // No match found
4609
4608
  * const notFound = Chunk.findFirstIndex(chunk, (n) => n > 10)
4610
- * console.log(notFound) // undefined
4609
+ * console.log(notFound) // Option.none()
4611
4610
  *
4612
4611
  * // Find first even number
4613
4612
  * const firstEven = Chunk.findFirstIndex(chunk, (n) => n % 2 === 0)
4614
- * console.log(firstEven) // 1
4613
+ * console.log(firstEven) // Option.some(1)
4615
4614
  * ```
4616
4615
  *
4617
4616
  * @category elements
@@ -4627,21 +4626,21 @@ export const findFirstIndex: {
4627
4626
  *
4628
4627
  * const chunk = Chunk.make(1, 2, 3, 4, 5)
4629
4628
  * const result = Chunk.findFirstIndex(chunk, (n) => n > 3)
4630
- * console.log(result) // 3
4629
+ * console.log(result) // Option.some(3)
4631
4630
  *
4632
4631
  * // No match found
4633
4632
  * const notFound = Chunk.findFirstIndex(chunk, (n) => n > 10)
4634
- * console.log(notFound) // undefined
4633
+ * console.log(notFound) // Option.none()
4635
4634
  *
4636
4635
  * // Find first even number
4637
4636
  * const firstEven = Chunk.findFirstIndex(chunk, (n) => n % 2 === 0)
4638
- * console.log(firstEven) // 1
4637
+ * console.log(firstEven) // Option.some(1)
4639
4638
  * ```
4640
4639
  *
4641
4640
  * @category elements
4642
4641
  * @since 2.0.0
4643
4642
  */
4644
- <A>(predicate: Predicate<A>): (self: Chunk<A>) => number | undefined
4643
+ <A>(predicate: Predicate<A>): (self: Chunk<A>) => O.Option<number>
4645
4644
  /**
4646
4645
  * Return the first index for which a predicate holds.
4647
4646
  *
@@ -4651,22 +4650,25 @@ export const findFirstIndex: {
4651
4650
  *
4652
4651
  * const chunk = Chunk.make(1, 2, 3, 4, 5)
4653
4652
  * const result = Chunk.findFirstIndex(chunk, (n) => n > 3)
4654
- * console.log(result) // 3
4653
+ * console.log(result) // Option.some(3)
4655
4654
  *
4656
4655
  * // No match found
4657
4656
  * const notFound = Chunk.findFirstIndex(chunk, (n) => n > 10)
4658
- * console.log(notFound) // undefined
4657
+ * console.log(notFound) // Option.none()
4659
4658
  *
4660
4659
  * // Find first even number
4661
4660
  * const firstEven = Chunk.findFirstIndex(chunk, (n) => n % 2 === 0)
4662
- * console.log(firstEven) // 1
4661
+ * console.log(firstEven) // Option.some(1)
4663
4662
  * ```
4664
4663
  *
4665
4664
  * @category elements
4666
4665
  * @since 2.0.0
4667
4666
  */
4668
- <A>(self: Chunk<A>, predicate: Predicate<A>): number | undefined
4669
- } = RA.findFirstIndex
4667
+ <A>(self: Chunk<A>, predicate: Predicate<A>): O.Option<number>
4668
+ } = dual(
4669
+ 2,
4670
+ <A>(self: Chunk<A>, predicate: Predicate<A>): O.Option<number> => RA.findFirstIndex(self, predicate)
4671
+ )
4670
4672
 
4671
4673
  /**
4672
4674
  * Find the last element for which a predicate holds.
@@ -4809,15 +4811,15 @@ export const findLast: {
4809
4811
  *
4810
4812
  * const chunk = Chunk.make(1, 2, 3, 4, 5)
4811
4813
  * const result = Chunk.findLastIndex(chunk, (n) => n < 4)
4812
- * console.log(result) // 2
4814
+ * console.log(result) // Option.some(2)
4813
4815
  *
4814
4816
  * // No match found
4815
4817
  * const notFound = Chunk.findLastIndex(chunk, (n) => n > 10)
4816
- * console.log(notFound) // undefined
4818
+ * console.log(notFound) // Option.none()
4817
4819
  *
4818
4820
  * // Find last even number index
4819
4821
  * const lastEven = Chunk.findLastIndex(chunk, (n) => n % 2 === 0)
4820
- * console.log(lastEven) // 3
4822
+ * console.log(lastEven) // Option.some(3)
4821
4823
  * ```
4822
4824
  *
4823
4825
  * @category elements
@@ -4833,21 +4835,21 @@ export const findLastIndex: {
4833
4835
  *
4834
4836
  * const chunk = Chunk.make(1, 2, 3, 4, 5)
4835
4837
  * const result = Chunk.findLastIndex(chunk, (n) => n < 4)
4836
- * console.log(result) // 2
4838
+ * console.log(result) // Option.some(2)
4837
4839
  *
4838
4840
  * // No match found
4839
4841
  * const notFound = Chunk.findLastIndex(chunk, (n) => n > 10)
4840
- * console.log(notFound) // undefined
4842
+ * console.log(notFound) // Option.none()
4841
4843
  *
4842
4844
  * // Find last even number index
4843
4845
  * const lastEven = Chunk.findLastIndex(chunk, (n) => n % 2 === 0)
4844
- * console.log(lastEven) // 3
4846
+ * console.log(lastEven) // Option.some(3)
4845
4847
  * ```
4846
4848
  *
4847
4849
  * @category elements
4848
4850
  * @since 2.0.0
4849
4851
  */
4850
- <A>(predicate: Predicate<A>): (self: Chunk<A>) => number | undefined
4852
+ <A>(predicate: Predicate<A>): (self: Chunk<A>) => O.Option<number>
4851
4853
  /**
4852
4854
  * Return the last index for which a predicate holds.
4853
4855
  *
@@ -4857,22 +4859,25 @@ export const findLastIndex: {
4857
4859
  *
4858
4860
  * const chunk = Chunk.make(1, 2, 3, 4, 5)
4859
4861
  * const result = Chunk.findLastIndex(chunk, (n) => n < 4)
4860
- * console.log(result) // 2
4862
+ * console.log(result) // Option.some(2)
4861
4863
  *
4862
4864
  * // No match found
4863
4865
  * const notFound = Chunk.findLastIndex(chunk, (n) => n > 10)
4864
- * console.log(notFound) // undefined
4866
+ * console.log(notFound) // Option.none()
4865
4867
  *
4866
4868
  * // Find last even number index
4867
4869
  * const lastEven = Chunk.findLastIndex(chunk, (n) => n % 2 === 0)
4868
- * console.log(lastEven) // 3
4870
+ * console.log(lastEven) // Option.some(3)
4869
4871
  * ```
4870
4872
  *
4871
4873
  * @category elements
4872
4874
  * @since 2.0.0
4873
4875
  */
4874
- <A>(self: Chunk<A>, predicate: Predicate<A>): number | undefined
4875
- } = RA.findLastIndex
4876
+ <A>(self: Chunk<A>, predicate: Predicate<A>): O.Option<number>
4877
+ } = dual(
4878
+ 2,
4879
+ <A>(self: Chunk<A>, predicate: Predicate<A>): O.Option<number> => RA.findLastIndex(self, predicate)
4880
+ )
4876
4881
 
4877
4882
  /**
4878
4883
  * Check if a predicate holds true for every `Chunk` element.
package/src/Config.ts CHANGED
@@ -950,7 +950,10 @@ export const Boolean = Schema.Literals([...TrueValues.literals, ...FalseValues.l
950
950
  export const Duration = Schema.String.pipe(Schema.decodeTo(Schema.Duration, {
951
951
  decode: Getter.transformOrFail((s) => {
952
952
  const d = Duration_.fromInput(s as any)
953
- return d ? Effect.succeed(d) : Effect.fail(new Issue.InvalidValue(Option.some(s)))
953
+ return Option.match(d, {
954
+ onNone: () => Effect.fail(new Issue.InvalidValue(Option.some(s))),
955
+ onSome: Effect.succeed
956
+ })
954
957
  }),
955
958
  encode: Getter.forbidden(() => "Encoding Duration is not supported")
956
959
  }))
package/src/Cron.ts CHANGED
@@ -12,12 +12,12 @@ import * as Hash from "./Hash.ts"
12
12
  import { type Inspectable, NodeInspectSymbol } from "./Inspectable.ts"
13
13
  import * as dateTime from "./internal/dateTime.ts"
14
14
  import * as N from "./Number.ts"
15
+ import * as Option from "./Option.ts"
15
16
  import { type Pipeable, pipeArguments } from "./Pipeable.ts"
16
17
  import { hasProperty } from "./Predicate.ts"
17
18
  import * as Result from "./Result.ts"
18
19
  import * as String from "./String.ts"
19
20
  import type { Mutable } from "./Types.ts"
20
- import * as UndefinedOr from "./UndefinedOr.ts"
21
21
 
22
22
  const TypeId = "~effect/time/Cron"
23
23
 
@@ -83,7 +83,7 @@ const TypeId = "~effect/time/Cron"
83
83
  */
84
84
  export interface Cron extends Pipeable, Equal.Equal, Inspectable {
85
85
  readonly [TypeId]: typeof TypeId
86
- readonly tz: DateTime.TimeZone | undefined
86
+ readonly tz: Option.Option<DateTime.TimeZone>
87
87
  readonly seconds: ReadonlySet<number>
88
88
  readonly minutes: ReadonlySet<number>
89
89
  readonly hours: ReadonlySet<number>
@@ -307,7 +307,7 @@ export const make = (values: {
307
307
  o.days = new Set(Arr.sort(values.days, N.Order))
308
308
  o.months = new Set(Arr.sort(values.months, N.Order))
309
309
  o.weekdays = new Set(Arr.sort(values.weekdays, N.Order))
310
- o.tz = values.tz
310
+ o.tz = Option.fromUndefinedOr(values.tz)
311
311
 
312
312
  const seconds = Array.from(o.seconds)
313
313
  const minutes = Array.from(o.minutes)
@@ -379,15 +379,11 @@ const CronParseErrorTypeId = "~effect/time/Cron/CronParseError"
379
379
  * @since 4.0.0
380
380
  * @category models
381
381
  */
382
- /**
383
- * @category Models
384
- * @since 4.0.0
385
- */
386
382
  export class CronParseError extends Data.TaggedError("CronParseError")<{
387
383
  readonly message: string
388
384
  readonly input?: string
389
385
  }> {
390
- readonly [CronParseErrorTypeId] = CronParseErrorTypeId
386
+ readonly [CronParseErrorTypeId]: typeof CronParseErrorTypeId = CronParseErrorTypeId
391
387
  }
392
388
 
393
389
  /**
@@ -456,11 +452,10 @@ export const parse = (cron: string, tz?: DateTime.TimeZone | string): Result.Res
456
452
  const [seconds, minutes, hours, days, months, weekdays] = segments
457
453
  const zone = tz === undefined || dateTime.isTimeZone(tz) ?
458
454
  Result.succeed(tz) :
459
- UndefinedOr.match(dateTime.zoneFromString(tz), {
460
- onUndefined: () =>
461
- Result.fail(new CronParseError({ message: `Invalid time zone in cron expression`, input: tz })),
462
- onDefined: (zone) => Result.succeed(zone)
463
- })
455
+ Result.fromOption(
456
+ dateTime.zoneFromString(tz),
457
+ () => new CronParseError({ message: `Invalid time zone in cron expression`, input: tz })
458
+ )
464
459
 
465
460
  return Result.all({
466
461
  tz: zone,
@@ -528,7 +523,7 @@ export const parseUnsafe = (cron: string, tz?: DateTime.TimeZone | string): Cron
528
523
  */
529
524
  export const match = (cron: Cron, date: DateTime.DateTime.Input): boolean => {
530
525
  const parts = dateTime.makeZonedUnsafe(date, {
531
- timeZone: cron.tz
526
+ timeZone: Option.getOrUndefined(cron.tz)
532
527
  }).pipe(dateTime.toParts)
533
528
 
534
529
  if (cron.seconds.size !== 0 && !cron.seconds.has(parts.second)) {
@@ -592,7 +587,7 @@ const daysInMonth = (date: Date): number =>
592
587
  * @category utils
593
588
  */
594
589
  export const next = (cron: Cron, now?: DateTime.DateTime.Input): Date => {
595
- const tz = cron.tz
590
+ const tz = Option.getOrUndefined(cron.tz)
596
591
  const zoned = dateTime.makeZonedUnsafe(now ?? new Date(), {
597
592
  timeZone: tz
598
593
  })
package/src/DateTime.ts CHANGED
@@ -10,6 +10,7 @@ import type { Inspectable } from "./Inspectable.ts"
10
10
  import * as Internal from "./internal/dateTime.ts"
11
11
  import { provideService } from "./internal/effect.ts"
12
12
  import * as Layer from "./Layer.ts"
13
+ import type * as Option from "./Option.ts"
13
14
  import type * as order from "./Order.ts"
14
15
  import type { Pipeable } from "./Pipeable.ts"
15
16
  import * as ServiceMap from "./ServiceMap.ts"
@@ -557,7 +558,7 @@ export const makeZoned: (
557
558
  readonly adjustForTimeZone?: boolean | undefined
558
559
  readonly disambiguation?: Disambiguation | undefined
559
560
  }
560
- ) => Zoned | undefined = Internal.makeZoned
561
+ ) => Option.Option<Zoned> = Internal.makeZoned
561
562
 
562
563
  /**
563
564
  * Create a `DateTime` from one of the following:
@@ -586,7 +587,7 @@ export const makeZoned: (
586
587
  * DateTime.make("2024-01-01")
587
588
  * ```
588
589
  */
589
- export const make: <A extends DateTime.Input>(input: A) => DateTime.PreserveZone<A> | undefined = Internal.make
590
+ export const make: <A extends DateTime.Input>(input: A) => Option.Option<DateTime.PreserveZone<A>> = Internal.make
590
591
 
591
592
  /**
592
593
  * Create a `DateTime.Zoned` from a string.
@@ -600,19 +601,19 @@ export const make: <A extends DateTime.Input>(input: A) => DateTime.PreserveZone
600
601
  * const result1 = DateTime.makeZonedFromString(
601
602
  * "2024-01-01T12:00:00+02:00[Europe/Berlin]"
602
603
  * )
603
- * console.log(result1 !== undefined) // true
604
+ * console.log(result1._tag === "Some") // true
604
605
  *
605
606
  * const result2 = DateTime.makeZonedFromString("2024-01-01T12:00:00Z")
606
- * console.log(result2 !== undefined) // true
607
+ * console.log(result2._tag === "Some") // true
607
608
  *
608
609
  * const invalid = DateTime.makeZonedFromString("invalid")
609
- * console.log(invalid === undefined) // true
610
+ * console.log(invalid._tag === "None") // true
610
611
  * ```
611
612
  *
612
613
  * @since 3.6.0
613
614
  * @category constructors
614
615
  */
615
- export const makeZonedFromString: (input: string) => Zoned | undefined = Internal.makeZonedFromString
616
+ export const makeZonedFromString: (input: string) => Option.Option<Zoned> = Internal.makeZonedFromString
616
617
 
617
618
  /**
618
619
  * Get the current time using the `Clock` service and convert it to a `DateTime`.
@@ -892,16 +893,16 @@ export const zoneMakeOffset: (offset: number) => TimeZone.Offset = Internal.zone
892
893
  * import { DateTime } from "effect"
893
894
  *
894
895
  * const validZone = DateTime.zoneMakeNamed("Europe/London")
895
- * console.log(validZone !== undefined) // true
896
+ * console.log(validZone._tag === "Some") // true
896
897
  *
897
898
  * const invalidZone = DateTime.zoneMakeNamed("Invalid/Zone")
898
- * console.log(invalidZone === undefined) // true
899
+ * console.log(invalidZone._tag === "None") // true
899
900
  * ```
900
901
  *
901
902
  * @category time zones
902
903
  * @since 3.6.0
903
904
  */
904
- export const zoneMakeNamed: (zoneId: string) => TimeZone.Named | undefined = Internal.zoneMakeNamed
905
+ export const zoneMakeNamed: (zoneId: string) => Option.Option<TimeZone.Named> = Internal.zoneMakeNamed
905
906
 
906
907
  /**
907
908
  * Create a named time zone from a IANA time zone identifier.
@@ -960,15 +961,15 @@ export const zoneMakeLocal: () => TimeZone.Named = Internal.zoneMakeLocal
960
961
  * const offsetZone = DateTime.zoneFromString("+03:00")
961
962
  * const invalid = DateTime.zoneFromString("invalid")
962
963
  *
963
- * console.log(namedZone !== undefined) // true
964
- * console.log(offsetZone !== undefined) // true
965
- * console.log(invalid === undefined) // true
964
+ * console.log(namedZone._tag === "Some") // true
965
+ * console.log(offsetZone._tag === "Some") // true
966
+ * console.log(invalid._tag === "None") // true
966
967
  * ```
967
968
  *
968
969
  * @category time zones
969
970
  * @since 3.6.0
970
971
  */
971
- export const zoneFromString: (zone: string) => TimeZone | undefined = Internal.zoneFromString
972
+ export const zoneFromString: (zone: string) => Option.Option<TimeZone> = Internal.zoneFromString
972
973
 
973
974
  /**
974
975
  * Format a `TimeZone` as a string.
@@ -1029,7 +1030,7 @@ export const setZoneNamed: {
1029
1030
  readonly adjustForTimeZone?: boolean | undefined
1030
1031
  readonly disambiguation?: Disambiguation | undefined
1031
1032
  }
1032
- ): (self: DateTime) => Zoned | undefined
1033
+ ): (self: DateTime) => Option.Option<Zoned>
1033
1034
  /**
1034
1035
  * Set the time zone of a `DateTime` from an IANA time zone identifier. If the
1035
1036
  * time zone is invalid, `None` will be returned.
@@ -1054,7 +1055,7 @@ export const setZoneNamed: {
1054
1055
  readonly adjustForTimeZone?: boolean | undefined
1055
1056
  readonly disambiguation?: Disambiguation | undefined
1056
1057
  }
1057
- ): Zoned | undefined
1058
+ ): Option.Option<Zoned>
1058
1059
  } = Internal.setZoneNamed
1059
1060
 
1060
1061
  /**
package/src/Deferred.ts CHANGED
@@ -72,6 +72,7 @@ import type * as Exit from "./Exit.ts"
72
72
  import { dual, identity, type LazyArg } from "./Function.ts"
73
73
  import * as core from "./internal/core.ts"
74
74
  import * as internalEffect from "./internal/effect.ts"
75
+ import * as Option from "./Option.ts"
75
76
  import type { Pipeable } from "./Pipeable.ts"
76
77
  import { pipeArguments } from "./Pipeable.ts"
77
78
  import type * as Types from "./Types.ts"
@@ -973,8 +974,9 @@ export const isDone = <A, E>(self: Deferred<A, E>): Effect<boolean> => internalE
973
974
  export const isDoneUnsafe = <A, E>(self: Deferred<A, E>): boolean => self.effect !== undefined
974
975
 
975
976
  /**
976
- * Returns a `Effect<A, E, R>` from the `Deferred` if this `Deferred` has
977
- * already been completed, `undefined` otherwise.
977
+ * Returns the current completion effect as an `Option`. This returns
978
+ * `Option.some(effect)` when the `Deferred` is completed, `Option.none()`
979
+ * otherwise.
978
980
  *
979
981
  * @example
980
982
  * ```ts
@@ -983,19 +985,19 @@ export const isDoneUnsafe = <A, E>(self: Deferred<A, E>): boolean => self.effect
983
985
  * const program = Effect.gen(function*() {
984
986
  * const deferred = yield* Deferred.make<number>()
985
987
  * const beforeCompletion = yield* Deferred.poll(deferred)
986
- * console.log(beforeCompletion === undefined) // true
988
+ * console.log(beforeCompletion._tag === "None") // true
987
989
  *
988
990
  * yield* Deferred.succeed(deferred, 42)
989
991
  * const afterCompletion = yield* Deferred.poll(deferred)
990
- * console.log(afterCompletion !== undefined) // true
992
+ * console.log(afterCompletion._tag === "Some") // true
991
993
  * })
992
994
  * ```
993
995
  *
994
996
  * @since 2.0.0
995
997
  * @category getters
996
998
  */
997
- export function poll<A, E>(self: Deferred<A, E>): Effect<Effect<A, E> | undefined> {
998
- return internalEffect.sync(() => self.effect)
999
+ export function poll<A, E>(self: Deferred<A, E>): Effect<Option.Option<Effect<A, E>>> {
1000
+ return internalEffect.sync(() => Option.fromUndefinedOr(self.effect))
999
1001
  }
1000
1002
 
1001
1003
  /**