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/Array.d.ts CHANGED
@@ -1548,18 +1548,18 @@ export declare const last: <A>(self: ReadonlyArray<A>) => Option.Option<A>;
1548
1548
  */
1549
1549
  export declare const lastNonEmpty: <A>(self: NonEmptyReadonlyArray<A>) => A;
1550
1550
  /**
1551
- * Returns all elements except the first, or `undefined` if the array is empty.
1551
+ * Returns all elements except the first, wrapped in an `Option`.
1552
1552
  *
1553
1553
  * - Allocates a new array via `slice(1)`.
1554
- * - Returns `undefined` (not `Option`) for empty inputs.
1554
+ * - Returns `Option.none()` for empty inputs.
1555
1555
  *
1556
1556
  * **Example** (Getting the tail)
1557
1557
  *
1558
1558
  * ```ts
1559
1559
  * import { Array } from "effect"
1560
1560
  *
1561
- * console.log(Array.tail([1, 2, 3, 4])) // [2, 3, 4]
1562
- * console.log(Array.tail([])) // undefined
1561
+ * console.log(Array.tail([1, 2, 3, 4])) // Option.some([2, 3, 4])
1562
+ * console.log(Array.tail([])) // Option.none()
1563
1563
  * ```
1564
1564
  *
1565
1565
  * @see {@link tailNonEmpty} — when the array is known non-empty
@@ -1568,7 +1568,7 @@ export declare const lastNonEmpty: <A>(self: NonEmptyReadonlyArray<A>) => A;
1568
1568
  * @category getters
1569
1569
  * @since 2.0.0
1570
1570
  */
1571
- export declare function tail<A>(self: Iterable<A>): Array<A> | undefined;
1571
+ export declare function tail<A>(self: Iterable<A>): Option.Option<Array<A>>;
1572
1572
  /**
1573
1573
  * Returns all elements except the first of a `NonEmptyReadonlyArray`.
1574
1574
  *
@@ -1588,18 +1588,18 @@ export declare function tail<A>(self: Iterable<A>): Array<A> | undefined;
1588
1588
  */
1589
1589
  export declare const tailNonEmpty: <A>(self: NonEmptyReadonlyArray<A>) => Array<A>;
1590
1590
  /**
1591
- * Returns all elements except the last, or `undefined` if the array is empty.
1591
+ * Returns all elements except the last, wrapped in an `Option`.
1592
1592
  *
1593
1593
  * - Allocates a new array via `slice(0, -1)`.
1594
- * - Returns `undefined` (not `Option`) for empty inputs.
1594
+ * - Returns `Option.none()` for empty inputs.
1595
1595
  *
1596
1596
  * **Example** (Getting init)
1597
1597
  *
1598
1598
  * ```ts
1599
1599
  * import { Array } from "effect"
1600
1600
  *
1601
- * console.log(Array.init([1, 2, 3, 4])) // [1, 2, 3]
1602
- * console.log(Array.init([])) // undefined
1601
+ * console.log(Array.init([1, 2, 3, 4])) // Option.some([1, 2, 3])
1602
+ * console.log(Array.init([])) // Option.none()
1603
1603
  * ```
1604
1604
  *
1605
1605
  * @see {@link initNonEmpty} — when the array is known non-empty
@@ -1608,7 +1608,7 @@ export declare const tailNonEmpty: <A>(self: NonEmptyReadonlyArray<A>) => Array<
1608
1608
  * @category getters
1609
1609
  * @since 2.0.0
1610
1610
  */
1611
- export declare function init<A>(self: Iterable<A>): Array<A> | undefined;
1611
+ export declare function init<A>(self: Iterable<A>): Option.Option<Array<A>>;
1612
1612
  /**
1613
1613
  * Returns all elements except the last of a `NonEmptyReadonlyArray`.
1614
1614
  *
@@ -2247,15 +2247,15 @@ export declare const dropWhileFilter: {
2247
2247
  <A, B, X>(self: Iterable<A>, f: (input: A, i: number) => Result.Result<B, X>): Array<A>;
2248
2248
  };
2249
2249
  /**
2250
- * Returns the index of the first element matching the predicate, or `undefined`
2251
- * if none match.
2250
+ * Returns the index of the first element matching the predicate, wrapped in an
2251
+ * `Option`.
2252
2252
  *
2253
2253
  * **Example** (Finding an index)
2254
2254
  *
2255
2255
  * ```ts
2256
2256
  * import { Array } from "effect"
2257
2257
  *
2258
- * console.log(Array.findFirstIndex([5, 3, 8, 9], (x) => x > 5)) // 2
2258
+ * console.log(Array.findFirstIndex([5, 3, 8, 9], (x) => x > 5)) // Option.some(2)
2259
2259
  * ```
2260
2260
  *
2261
2261
  * @see {@link findLastIndex} — search from the end
@@ -2266,15 +2266,15 @@ export declare const dropWhileFilter: {
2266
2266
  */
2267
2267
  export declare const findFirstIndex: {
2268
2268
  /**
2269
- * Returns the index of the first element matching the predicate, or `undefined`
2270
- * if none match.
2269
+ * Returns the index of the first element matching the predicate, wrapped in an
2270
+ * `Option`.
2271
2271
  *
2272
2272
  * **Example** (Finding an index)
2273
2273
  *
2274
2274
  * ```ts
2275
2275
  * import { Array } from "effect"
2276
2276
  *
2277
- * console.log(Array.findFirstIndex([5, 3, 8, 9], (x) => x > 5)) // 2
2277
+ * console.log(Array.findFirstIndex([5, 3, 8, 9], (x) => x > 5)) // Option.some(2)
2278
2278
  * ```
2279
2279
  *
2280
2280
  * @see {@link findLastIndex} — search from the end
@@ -2283,17 +2283,17 @@ export declare const findFirstIndex: {
2283
2283
  * @category elements
2284
2284
  * @since 2.0.0
2285
2285
  */
2286
- <A>(predicate: (a: NoInfer<A>, i: number) => boolean): (self: Iterable<A>) => number | undefined;
2286
+ <A>(predicate: (a: NoInfer<A>, i: number) => boolean): (self: Iterable<A>) => Option.Option<number>;
2287
2287
  /**
2288
- * Returns the index of the first element matching the predicate, or `undefined`
2289
- * if none match.
2288
+ * Returns the index of the first element matching the predicate, wrapped in an
2289
+ * `Option`.
2290
2290
  *
2291
2291
  * **Example** (Finding an index)
2292
2292
  *
2293
2293
  * ```ts
2294
2294
  * import { Array } from "effect"
2295
2295
  *
2296
- * console.log(Array.findFirstIndex([5, 3, 8, 9], (x) => x > 5)) // 2
2296
+ * console.log(Array.findFirstIndex([5, 3, 8, 9], (x) => x > 5)) // Option.some(2)
2297
2297
  * ```
2298
2298
  *
2299
2299
  * @see {@link findLastIndex} — search from the end
@@ -2302,18 +2302,18 @@ export declare const findFirstIndex: {
2302
2302
  * @category elements
2303
2303
  * @since 2.0.0
2304
2304
  */
2305
- <A>(self: Iterable<A>, predicate: (a: A, i: number) => boolean): number | undefined;
2305
+ <A>(self: Iterable<A>, predicate: (a: A, i: number) => boolean): Option.Option<number>;
2306
2306
  };
2307
2307
  /**
2308
- * Returns the index of the last element matching the predicate, or `undefined`
2309
- * if none match.
2308
+ * Returns the index of the last element matching the predicate, wrapped in an
2309
+ * `Option`.
2310
2310
  *
2311
2311
  * **Example** (Finding the last matching index)
2312
2312
  *
2313
2313
  * ```ts
2314
2314
  * import { Array } from "effect"
2315
2315
  *
2316
- * console.log(Array.findLastIndex([1, 3, 8, 9], (x) => x < 5)) // 1
2316
+ * console.log(Array.findLastIndex([1, 3, 8, 9], (x) => x < 5)) // Option.some(1)
2317
2317
  * ```
2318
2318
  *
2319
2319
  * @see {@link findFirstIndex} — search from the start
@@ -2324,15 +2324,15 @@ export declare const findFirstIndex: {
2324
2324
  */
2325
2325
  export declare const findLastIndex: {
2326
2326
  /**
2327
- * Returns the index of the last element matching the predicate, or `undefined`
2328
- * if none match.
2327
+ * Returns the index of the last element matching the predicate, wrapped in an
2328
+ * `Option`.
2329
2329
  *
2330
2330
  * **Example** (Finding the last matching index)
2331
2331
  *
2332
2332
  * ```ts
2333
2333
  * import { Array } from "effect"
2334
2334
  *
2335
- * console.log(Array.findLastIndex([1, 3, 8, 9], (x) => x < 5)) // 1
2335
+ * console.log(Array.findLastIndex([1, 3, 8, 9], (x) => x < 5)) // Option.some(1)
2336
2336
  * ```
2337
2337
  *
2338
2338
  * @see {@link findFirstIndex} — search from the start
@@ -2341,17 +2341,17 @@ export declare const findLastIndex: {
2341
2341
  * @category elements
2342
2342
  * @since 2.0.0
2343
2343
  */
2344
- <A>(predicate: (a: NoInfer<A>, i: number) => boolean): (self: Iterable<A>) => number | undefined;
2344
+ <A>(predicate: (a: NoInfer<A>, i: number) => boolean): (self: Iterable<A>) => Option.Option<number>;
2345
2345
  /**
2346
- * Returns the index of the last element matching the predicate, or `undefined`
2347
- * if none match.
2346
+ * Returns the index of the last element matching the predicate, wrapped in an
2347
+ * `Option`.
2348
2348
  *
2349
2349
  * **Example** (Finding the last matching index)
2350
2350
  *
2351
2351
  * ```ts
2352
2352
  * import { Array } from "effect"
2353
2353
  *
2354
- * console.log(Array.findLastIndex([1, 3, 8, 9], (x) => x < 5)) // 1
2354
+ * console.log(Array.findLastIndex([1, 3, 8, 9], (x) => x < 5)) // Option.some(1)
2355
2355
  * ```
2356
2356
  *
2357
2357
  * @see {@link findFirstIndex} — search from the start
@@ -2360,7 +2360,7 @@ export declare const findLastIndex: {
2360
2360
  * @category elements
2361
2361
  * @since 2.0.0
2362
2362
  */
2363
- <A>(self: Iterable<A>, predicate: (a: A, i: number) => boolean): number | undefined;
2363
+ <A>(self: Iterable<A>, predicate: (a: A, i: number) => boolean): Option.Option<number>;
2364
2364
  };
2365
2365
  /**
2366
2366
  * Returns the first element matching a predicate, refinement, or mapping
@@ -2533,14 +2533,14 @@ export declare const findFirst: {
2533
2533
  };
2534
2534
  /**
2535
2535
  * Returns a tuple `[element, index]` of the first element matching a
2536
- * predicate, or `undefined` if none match.
2536
+ * predicate, wrapped in an `Option`.
2537
2537
  *
2538
2538
  * **Example** (Finding element with its index)
2539
2539
  *
2540
2540
  * ```ts
2541
2541
  * import { Array } from "effect"
2542
2542
  *
2543
- * console.log(Array.findFirstWithIndex([1, 2, 3, 4, 5], (x) => x > 3)) // [4, 3]
2543
+ * console.log(Array.findFirstWithIndex([1, 2, 3, 4, 5], (x) => x > 3)) // Option.some([4, 3])
2544
2544
  * ```
2545
2545
  *
2546
2546
  * @see {@link findFirst} — get only the element
@@ -2552,14 +2552,14 @@ export declare const findFirst: {
2552
2552
  export declare const findFirstWithIndex: {
2553
2553
  /**
2554
2554
  * Returns a tuple `[element, index]` of the first element matching a
2555
- * predicate, or `undefined` if none match.
2555
+ * predicate, wrapped in an `Option`.
2556
2556
  *
2557
2557
  * **Example** (Finding element with its index)
2558
2558
  *
2559
2559
  * ```ts
2560
2560
  * import { Array } from "effect"
2561
2561
  *
2562
- * console.log(Array.findFirstWithIndex([1, 2, 3, 4, 5], (x) => x > 3)) // [4, 3]
2562
+ * console.log(Array.findFirstWithIndex([1, 2, 3, 4, 5], (x) => x > 3)) // Option.some([4, 3])
2563
2563
  * ```
2564
2564
  *
2565
2565
  * @see {@link findFirst} — get only the element
@@ -2568,17 +2568,17 @@ export declare const findFirstWithIndex: {
2568
2568
  * @category elements
2569
2569
  * @since 3.17.0
2570
2570
  */
2571
- <A, B>(f: (a: NoInfer<A>, i: number) => Option.Option<B>): (self: Iterable<A>) => [B, number] | undefined;
2571
+ <A, B>(f: (a: NoInfer<A>, i: number) => Option.Option<B>): (self: Iterable<A>) => Option.Option<[B, number]>;
2572
2572
  /**
2573
2573
  * Returns a tuple `[element, index]` of the first element matching a
2574
- * predicate, or `undefined` if none match.
2574
+ * predicate, wrapped in an `Option`.
2575
2575
  *
2576
2576
  * **Example** (Finding element with its index)
2577
2577
  *
2578
2578
  * ```ts
2579
2579
  * import { Array } from "effect"
2580
2580
  *
2581
- * console.log(Array.findFirstWithIndex([1, 2, 3, 4, 5], (x) => x > 3)) // [4, 3]
2581
+ * console.log(Array.findFirstWithIndex([1, 2, 3, 4, 5], (x) => x > 3)) // Option.some([4, 3])
2582
2582
  * ```
2583
2583
  *
2584
2584
  * @see {@link findFirst} — get only the element
@@ -2587,17 +2587,17 @@ export declare const findFirstWithIndex: {
2587
2587
  * @category elements
2588
2588
  * @since 3.17.0
2589
2589
  */
2590
- <A, B extends A>(refinement: (a: NoInfer<A>, i: number) => a is B): (self: Iterable<A>) => [B, number] | undefined;
2590
+ <A, B extends A>(refinement: (a: NoInfer<A>, i: number) => a is B): (self: Iterable<A>) => Option.Option<[B, number]>;
2591
2591
  /**
2592
2592
  * Returns a tuple `[element, index]` of the first element matching a
2593
- * predicate, or `undefined` if none match.
2593
+ * predicate, wrapped in an `Option`.
2594
2594
  *
2595
2595
  * **Example** (Finding element with its index)
2596
2596
  *
2597
2597
  * ```ts
2598
2598
  * import { Array } from "effect"
2599
2599
  *
2600
- * console.log(Array.findFirstWithIndex([1, 2, 3, 4, 5], (x) => x > 3)) // [4, 3]
2600
+ * console.log(Array.findFirstWithIndex([1, 2, 3, 4, 5], (x) => x > 3)) // Option.some([4, 3])
2601
2601
  * ```
2602
2602
  *
2603
2603
  * @see {@link findFirst} — get only the element
@@ -2606,17 +2606,17 @@ export declare const findFirstWithIndex: {
2606
2606
  * @category elements
2607
2607
  * @since 3.17.0
2608
2608
  */
2609
- <A>(predicate: (a: NoInfer<A>, i: number) => boolean): (self: Iterable<A>) => [A, number] | undefined;
2609
+ <A>(predicate: (a: NoInfer<A>, i: number) => boolean): (self: Iterable<A>) => Option.Option<[A, number]>;
2610
2610
  /**
2611
2611
  * Returns a tuple `[element, index]` of the first element matching a
2612
- * predicate, or `undefined` if none match.
2612
+ * predicate, wrapped in an `Option`.
2613
2613
  *
2614
2614
  * **Example** (Finding element with its index)
2615
2615
  *
2616
2616
  * ```ts
2617
2617
  * import { Array } from "effect"
2618
2618
  *
2619
- * console.log(Array.findFirstWithIndex([1, 2, 3, 4, 5], (x) => x > 3)) // [4, 3]
2619
+ * console.log(Array.findFirstWithIndex([1, 2, 3, 4, 5], (x) => x > 3)) // Option.some([4, 3])
2620
2620
  * ```
2621
2621
  *
2622
2622
  * @see {@link findFirst} — get only the element
@@ -2625,17 +2625,17 @@ export declare const findFirstWithIndex: {
2625
2625
  * @category elements
2626
2626
  * @since 3.17.0
2627
2627
  */
2628
- <A, B>(self: Iterable<A>, f: (a: A, i: number) => Option.Option<B>): [B, number] | undefined;
2628
+ <A, B>(self: Iterable<A>, f: (a: A, i: number) => Option.Option<B>): Option.Option<[B, number]>;
2629
2629
  /**
2630
2630
  * Returns a tuple `[element, index]` of the first element matching a
2631
- * predicate, or `undefined` if none match.
2631
+ * predicate, wrapped in an `Option`.
2632
2632
  *
2633
2633
  * **Example** (Finding element with its index)
2634
2634
  *
2635
2635
  * ```ts
2636
2636
  * import { Array } from "effect"
2637
2637
  *
2638
- * console.log(Array.findFirstWithIndex([1, 2, 3, 4, 5], (x) => x > 3)) // [4, 3]
2638
+ * console.log(Array.findFirstWithIndex([1, 2, 3, 4, 5], (x) => x > 3)) // Option.some([4, 3])
2639
2639
  * ```
2640
2640
  *
2641
2641
  * @see {@link findFirst} — get only the element
@@ -2644,17 +2644,17 @@ export declare const findFirstWithIndex: {
2644
2644
  * @category elements
2645
2645
  * @since 3.17.0
2646
2646
  */
2647
- <A, B extends A>(self: Iterable<A>, refinement: (a: A, i: number) => a is B): [B, number] | undefined;
2647
+ <A, B extends A>(self: Iterable<A>, refinement: (a: A, i: number) => a is B): Option.Option<[B, number]>;
2648
2648
  /**
2649
2649
  * Returns a tuple `[element, index]` of the first element matching a
2650
- * predicate, or `undefined` if none match.
2650
+ * predicate, wrapped in an `Option`.
2651
2651
  *
2652
2652
  * **Example** (Finding element with its index)
2653
2653
  *
2654
2654
  * ```ts
2655
2655
  * import { Array } from "effect"
2656
2656
  *
2657
- * console.log(Array.findFirstWithIndex([1, 2, 3, 4, 5], (x) => x > 3)) // [4, 3]
2657
+ * console.log(Array.findFirstWithIndex([1, 2, 3, 4, 5], (x) => x > 3)) // Option.some([4, 3])
2658
2658
  * ```
2659
2659
  *
2660
2660
  * @see {@link findFirst} — get only the element
@@ -2663,7 +2663,7 @@ export declare const findFirstWithIndex: {
2663
2663
  * @category elements
2664
2664
  * @since 3.17.0
2665
2665
  */
2666
- <A>(self: Iterable<A>, predicate: (a: A, i: number) => boolean): [A, number] | undefined;
2666
+ <A>(self: Iterable<A>, predicate: (a: A, i: number) => boolean): Option.Option<[A, number]>;
2667
2667
  };
2668
2668
  /**
2669
2669
  * Returns the last element matching a predicate, refinement, or mapping
@@ -2821,8 +2821,8 @@ export declare const findLast: {
2821
2821
  <A>(self: Iterable<A>, predicate: (a: A, i: number) => boolean): Option.Option<A>;
2822
2822
  };
2823
2823
  /**
2824
- * Inserts an element at the specified index, returning a new `NonEmptyArray`,
2825
- * or `undefined` if the index is out of bounds.
2824
+ * Inserts an element at the specified index, returning a new `NonEmptyArray`
2825
+ * wrapped in an `Option`.
2826
2826
  *
2827
2827
  * - Valid indices: `0` to `length` (inclusive — inserting at `length` appends).
2828
2828
  * - Does not mutate the input.
@@ -2832,7 +2832,7 @@ export declare const findLast: {
2832
2832
  * ```ts
2833
2833
  * import { Array } from "effect"
2834
2834
  *
2835
- * console.log(Array.insertAt(["a", "b", "c", "e"], 3, "d")) // ["a", "b", "c", "d", "e"]
2835
+ * console.log(Array.insertAt(["a", "b", "c", "e"], 3, "d")) // Option.some(["a", "b", "c", "d", "e"])
2836
2836
  * ```
2837
2837
  *
2838
2838
  * @see {@link replace} — replace an existing element
@@ -2843,8 +2843,8 @@ export declare const findLast: {
2843
2843
  */
2844
2844
  export declare const insertAt: {
2845
2845
  /**
2846
- * Inserts an element at the specified index, returning a new `NonEmptyArray`,
2847
- * or `undefined` if the index is out of bounds.
2846
+ * Inserts an element at the specified index, returning a new `NonEmptyArray`
2847
+ * wrapped in an `Option`.
2848
2848
  *
2849
2849
  * - Valid indices: `0` to `length` (inclusive — inserting at `length` appends).
2850
2850
  * - Does not mutate the input.
@@ -2854,7 +2854,7 @@ export declare const insertAt: {
2854
2854
  * ```ts
2855
2855
  * import { Array } from "effect"
2856
2856
  *
2857
- * console.log(Array.insertAt(["a", "b", "c", "e"], 3, "d")) // ["a", "b", "c", "d", "e"]
2857
+ * console.log(Array.insertAt(["a", "b", "c", "e"], 3, "d")) // Option.some(["a", "b", "c", "d", "e"])
2858
2858
  * ```
2859
2859
  *
2860
2860
  * @see {@link replace} — replace an existing element
@@ -2863,10 +2863,10 @@ export declare const insertAt: {
2863
2863
  * @category elements
2864
2864
  * @since 2.0.0
2865
2865
  */
2866
- <B>(i: number, b: B): <A>(self: Iterable<A>) => NonEmptyArray<A | B> | undefined;
2866
+ <B>(i: number, b: B): <A>(self: Iterable<A>) => Option.Option<NonEmptyArray<A | B>>;
2867
2867
  /**
2868
- * Inserts an element at the specified index, returning a new `NonEmptyArray`,
2869
- * or `undefined` if the index is out of bounds.
2868
+ * Inserts an element at the specified index, returning a new `NonEmptyArray`
2869
+ * wrapped in an `Option`.
2870
2870
  *
2871
2871
  * - Valid indices: `0` to `length` (inclusive — inserting at `length` appends).
2872
2872
  * - Does not mutate the input.
@@ -2876,7 +2876,7 @@ export declare const insertAt: {
2876
2876
  * ```ts
2877
2877
  * import { Array } from "effect"
2878
2878
  *
2879
- * console.log(Array.insertAt(["a", "b", "c", "e"], 3, "d")) // ["a", "b", "c", "d", "e"]
2879
+ * console.log(Array.insertAt(["a", "b", "c", "e"], 3, "d")) // Option.some(["a", "b", "c", "d", "e"])
2880
2880
  * ```
2881
2881
  *
2882
2882
  * @see {@link replace} — replace an existing element
@@ -2885,11 +2885,11 @@ export declare const insertAt: {
2885
2885
  * @category elements
2886
2886
  * @since 2.0.0
2887
2887
  */
2888
- <A, B>(self: Iterable<A>, i: number, b: B): NonEmptyArray<A | B> | undefined;
2888
+ <A, B>(self: Iterable<A>, i: number, b: B): Option.Option<NonEmptyArray<A | B>>;
2889
2889
  };
2890
2890
  /**
2891
2891
  * Replaces the element at the specified index with a new value, returning a new
2892
- * array, or `undefined` if the index is out of bounds.
2892
+ * array, wrapped in an `Option`.
2893
2893
  *
2894
2894
  * - Does not mutate the input.
2895
2895
  *
@@ -2898,7 +2898,7 @@ export declare const insertAt: {
2898
2898
  * ```ts
2899
2899
  * import { Array } from "effect"
2900
2900
  *
2901
- * console.log(Array.replace([1, 2, 3], 1, 4)) // [1, 4, 3]
2901
+ * console.log(Array.replace([1, 2, 3], 1, 4)) // Option.some([1, 4, 3])
2902
2902
  * ```
2903
2903
  *
2904
2904
  * @see {@link modify} — transform an element with a function
@@ -2910,7 +2910,7 @@ export declare const insertAt: {
2910
2910
  export declare const replace: {
2911
2911
  /**
2912
2912
  * Replaces the element at the specified index with a new value, returning a new
2913
- * array, or `undefined` if the index is out of bounds.
2913
+ * array, wrapped in an `Option`.
2914
2914
  *
2915
2915
  * - Does not mutate the input.
2916
2916
  *
@@ -2919,7 +2919,7 @@ export declare const replace: {
2919
2919
  * ```ts
2920
2920
  * import { Array } from "effect"
2921
2921
  *
2922
- * console.log(Array.replace([1, 2, 3], 1, 4)) // [1, 4, 3]
2922
+ * console.log(Array.replace([1, 2, 3], 1, 4)) // Option.some([1, 4, 3])
2923
2923
  * ```
2924
2924
  *
2925
2925
  * @see {@link modify} — transform an element with a function
@@ -2928,10 +2928,10 @@ export declare const replace: {
2928
2928
  * @category elements
2929
2929
  * @since 2.0.0
2930
2930
  */
2931
- <B>(i: number, b: B): <A, S extends Iterable<A> = Iterable<A>>(self: S) => ReadonlyArray.With<S, ReadonlyArray.Infer<S> | B> | undefined;
2931
+ <B>(i: number, b: B): <A, S extends Iterable<A> = Iterable<A>>(self: S) => Option.Option<ReadonlyArray.With<S, ReadonlyArray.Infer<S> | B>>;
2932
2932
  /**
2933
2933
  * Replaces the element at the specified index with a new value, returning a new
2934
- * array, or `undefined` if the index is out of bounds.
2934
+ * array, wrapped in an `Option`.
2935
2935
  *
2936
2936
  * - Does not mutate the input.
2937
2937
  *
@@ -2940,7 +2940,7 @@ export declare const replace: {
2940
2940
  * ```ts
2941
2941
  * import { Array } from "effect"
2942
2942
  *
2943
- * console.log(Array.replace([1, 2, 3], 1, 4)) // [1, 4, 3]
2943
+ * console.log(Array.replace([1, 2, 3], 1, 4)) // Option.some([1, 4, 3])
2944
2944
  * ```
2945
2945
  *
2946
2946
  * @see {@link modify} — transform an element with a function
@@ -2949,11 +2949,11 @@ export declare const replace: {
2949
2949
  * @category elements
2950
2950
  * @since 2.0.0
2951
2951
  */
2952
- <A, B, S extends Iterable<A> = Iterable<A>>(self: S, i: number, b: B): ReadonlyArray.With<S, ReadonlyArray.Infer<S> | B> | undefined;
2952
+ <A, B, S extends Iterable<A> = Iterable<A>>(self: S, i: number, b: B): Option.Option<ReadonlyArray.With<S, ReadonlyArray.Infer<S> | B>>;
2953
2953
  };
2954
2954
  /**
2955
2955
  * Applies a function to the element at the specified index, returning a new
2956
- * array, or `undefined` if the index is out of bounds.
2956
+ * array, wrapped in an `Option`.
2957
2957
  *
2958
2958
  * - Does not mutate the input.
2959
2959
  *
@@ -2962,8 +2962,8 @@ export declare const replace: {
2962
2962
  * ```ts
2963
2963
  * import { Array } from "effect"
2964
2964
  *
2965
- * console.log(Array.modify([1, 2, 3, 4], 2, (n) => n * 2)) // [1, 2, 6, 4]
2966
- * console.log(Array.modify([1, 2, 3, 4], 5, (n) => n * 2)) // undefined
2965
+ * console.log(Array.modify([1, 2, 3, 4], 2, (n) => n * 2)) // Option.some([1, 2, 6, 4])
2966
+ * console.log(Array.modify([1, 2, 3, 4], 5, (n) => n * 2)) // Option.none()
2967
2967
  * ```
2968
2968
  *
2969
2969
  * @see {@link replace} — set a fixed value at an index
@@ -2976,7 +2976,7 @@ export declare const replace: {
2976
2976
  export declare const modify: {
2977
2977
  /**
2978
2978
  * Applies a function to the element at the specified index, returning a new
2979
- * array, or `undefined` if the index is out of bounds.
2979
+ * array, wrapped in an `Option`.
2980
2980
  *
2981
2981
  * - Does not mutate the input.
2982
2982
  *
@@ -2985,8 +2985,8 @@ export declare const modify: {
2985
2985
  * ```ts
2986
2986
  * import { Array } from "effect"
2987
2987
  *
2988
- * console.log(Array.modify([1, 2, 3, 4], 2, (n) => n * 2)) // [1, 2, 6, 4]
2989
- * console.log(Array.modify([1, 2, 3, 4], 5, (n) => n * 2)) // undefined
2988
+ * console.log(Array.modify([1, 2, 3, 4], 2, (n) => n * 2)) // Option.some([1, 2, 6, 4])
2989
+ * console.log(Array.modify([1, 2, 3, 4], 5, (n) => n * 2)) // Option.none()
2990
2990
  * ```
2991
2991
  *
2992
2992
  * @see {@link replace} — set a fixed value at an index
@@ -2996,10 +2996,10 @@ export declare const modify: {
2996
2996
  * @category elements
2997
2997
  * @since 2.0.0
2998
2998
  */
2999
- <A, B, S extends Iterable<A> = Iterable<A>>(i: number, f: (a: ReadonlyArray.Infer<S>) => B): (self: S) => ReadonlyArray.With<S, ReadonlyArray.Infer<S> | B> | undefined;
2999
+ <A, B, S extends Iterable<A> = Iterable<A>>(i: number, f: (a: ReadonlyArray.Infer<S>) => B): (self: S) => Option.Option<ReadonlyArray.With<S, ReadonlyArray.Infer<S> | B>>;
3000
3000
  /**
3001
3001
  * Applies a function to the element at the specified index, returning a new
3002
- * array, or `undefined` if the index is out of bounds.
3002
+ * array, wrapped in an `Option`.
3003
3003
  *
3004
3004
  * - Does not mutate the input.
3005
3005
  *
@@ -3008,8 +3008,8 @@ export declare const modify: {
3008
3008
  * ```ts
3009
3009
  * import { Array } from "effect"
3010
3010
  *
3011
- * console.log(Array.modify([1, 2, 3, 4], 2, (n) => n * 2)) // [1, 2, 6, 4]
3012
- * console.log(Array.modify([1, 2, 3, 4], 5, (n) => n * 2)) // undefined
3011
+ * console.log(Array.modify([1, 2, 3, 4], 2, (n) => n * 2)) // Option.some([1, 2, 6, 4])
3012
+ * console.log(Array.modify([1, 2, 3, 4], 5, (n) => n * 2)) // Option.none()
3013
3013
  * ```
3014
3014
  *
3015
3015
  * @see {@link replace} — set a fixed value at an index
@@ -3019,7 +3019,7 @@ export declare const modify: {
3019
3019
  * @category elements
3020
3020
  * @since 2.0.0
3021
3021
  */
3022
- <A, B, S extends Iterable<A> = Iterable<A>>(self: S, i: number, f: (a: ReadonlyArray.Infer<S>) => B): ReadonlyArray.With<S, ReadonlyArray.Infer<S> | B> | undefined;
3022
+ <A, B, S extends Iterable<A> = Iterable<A>>(self: S, i: number, f: (a: ReadonlyArray.Infer<S>) => B): Option.Option<ReadonlyArray.With<S, ReadonlyArray.Infer<S> | B>>;
3023
3023
  };
3024
3024
  /**
3025
3025
  * Removes the element at the specified index, returning a new array. If the
@@ -6461,14 +6461,15 @@ export declare const max: {
6461
6461
  };
6462
6462
  /**
6463
6463
  * Builds an array by repeatedly applying a function to a seed value. The
6464
- * function returns `[element, nextSeed]` to continue, or `undefined` to stop.
6464
+ * function returns `Option.some([element, nextSeed])` to continue, or
6465
+ * `Option.none()` to stop.
6465
6466
  *
6466
6467
  * **Example** (Generating a sequence)
6467
6468
  *
6468
6469
  * ```ts
6469
- * import { Array } from "effect"
6470
+ * import { Array, Option } from "effect"
6470
6471
  *
6471
- * console.log(Array.unfold(1, (n) => n <= 5 ? [n, n + 1] : undefined))
6472
+ * console.log(Array.unfold(1, (n) => n <= 5 ? Option.some([n, n + 1]) : Option.none()))
6472
6473
  * // [1, 2, 3, 4, 5]
6473
6474
  * ```
6474
6475
  *
@@ -6478,7 +6479,7 @@ export declare const max: {
6478
6479
  * @category constructors
6479
6480
  * @since 2.0.0
6480
6481
  */
6481
- export declare const unfold: <B, A>(b: B, f: (b: B) => readonly [A, B] | undefined) => Array<A>;
6482
+ export declare const unfold: <B, A>(b: B, f: (b: B) => Option.Option<readonly [A, B]>) => Array<A>;
6482
6483
  /**
6483
6484
  * Creates an `Order` for arrays based on an element `Order`. Arrays are
6484
6485
  * compared element-wise; if all compared elements are equal, shorter arrays