effect 4.0.0-beta.103 → 4.0.0-beta.105

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 (667) hide show
  1. package/AGENTS.md +381 -0
  2. package/CLAUDE.md +381 -0
  3. package/ai-docs/README.md +44 -0
  4. package/ai-docs/package.json +36 -0
  5. package/ai-docs/src/01_effect/01_basics/01_effect-gen.ts +30 -0
  6. package/ai-docs/src/01_effect/01_basics/02_effect-fn.ts +39 -0
  7. package/ai-docs/src/01_effect/01_basics/10_creating-effects.ts +74 -0
  8. package/ai-docs/src/01_effect/01_basics/index.md +5 -0
  9. package/ai-docs/src/01_effect/02_schema/10_schema-basics.ts +43 -0
  10. package/ai-docs/src/01_effect/02_schema/index.md +7 -0
  11. package/ai-docs/src/01_effect/03_services/01_service.ts +45 -0
  12. package/ai-docs/src/01_effect/03_services/10_reference.ts +10 -0
  13. package/ai-docs/src/01_effect/03_services/20_layer-composition.ts +70 -0
  14. package/ai-docs/src/01_effect/03_services/20_layer-unwrap.ts +66 -0
  15. package/ai-docs/src/01_effect/03_services/index.md +5 -0
  16. package/ai-docs/src/01_effect/04_errors/01_error-handling.ts +30 -0
  17. package/ai-docs/src/01_effect/04_errors/10_catch-tags.ts +24 -0
  18. package/ai-docs/src/01_effect/04_errors/20_reason-errors.ts +64 -0
  19. package/ai-docs/src/01_effect/04_errors/index.md +1 -0
  20. package/ai-docs/src/01_effect/05_resources/10_acquire-release.ts +105 -0
  21. package/ai-docs/src/01_effect/05_resources/20_layer-side-effects.ts +31 -0
  22. package/ai-docs/src/01_effect/05_resources/30_layer-map.ts +86 -0
  23. package/ai-docs/src/01_effect/05_resources/index.md +3 -0
  24. package/ai-docs/src/01_effect/06_running/10_run-main.ts +30 -0
  25. package/ai-docs/src/01_effect/06_running/20_layer-launch.ts +27 -0
  26. package/ai-docs/src/01_effect/06_running/index.md +1 -0
  27. package/ai-docs/src/01_effect/07_pubsub/10_pubsub.ts +56 -0
  28. package/ai-docs/src/01_effect/07_pubsub/index.md +3 -0
  29. package/ai-docs/src/03_stream/10_creating-streams.ts +103 -0
  30. package/ai-docs/src/03_stream/20_consuming-streams.ts +137 -0
  31. package/ai-docs/src/03_stream/30_encoding.ts +165 -0
  32. package/ai-docs/src/03_stream/index.md +4 -0
  33. package/ai-docs/src/04_integration/10_managed-runtime.ts +129 -0
  34. package/ai-docs/src/04_integration/index.md +5 -0
  35. package/ai-docs/src/05_batching/10_request-resolver.ts +89 -0
  36. package/ai-docs/src/05_batching/index.md +3 -0
  37. package/ai-docs/src/06_schedule/10_schedules.ts +110 -0
  38. package/ai-docs/src/06_schedule/index.md +3 -0
  39. package/ai-docs/src/07_datetime/10_creating-and-formatting.ts +30 -0
  40. package/ai-docs/src/07_datetime/20_time-zones.ts +44 -0
  41. package/ai-docs/src/07_datetime/index.md +5 -0
  42. package/ai-docs/src/08_observability/10_logging.ts +66 -0
  43. package/ai-docs/src/08_observability/20_otlp-tracing.ts +95 -0
  44. package/ai-docs/src/08_observability/index.md +7 -0
  45. package/ai-docs/src/09_testing/10_effect-tests.ts +55 -0
  46. package/ai-docs/src/09_testing/20_layer-tests.ts +138 -0
  47. package/ai-docs/src/09_testing/index.md +1 -0
  48. package/ai-docs/src/10_predicate/01_basics.ts +14 -0
  49. package/ai-docs/src/10_predicate/index.md +9 -0
  50. package/ai-docs/src/50_http-client/10_basics.ts +102 -0
  51. package/ai-docs/src/50_http-client/index.md +3 -0
  52. package/ai-docs/src/51_http-server/10_basics.ts +116 -0
  53. package/ai-docs/src/51_http-server/fixtures/api/Api.ts +14 -0
  54. package/ai-docs/src/51_http-server/fixtures/api/Authorization.ts +36 -0
  55. package/ai-docs/src/51_http-server/fixtures/api/System.ts +10 -0
  56. package/ai-docs/src/51_http-server/fixtures/api/Users.ts +91 -0
  57. package/ai-docs/src/51_http-server/fixtures/domain/User.ts +12 -0
  58. package/ai-docs/src/51_http-server/fixtures/domain/UserErrors.ts +22 -0
  59. package/ai-docs/src/51_http-server/fixtures/server/Authorization.ts +36 -0
  60. package/ai-docs/src/51_http-server/fixtures/server/Users/http.ts +71 -0
  61. package/ai-docs/src/51_http-server/fixtures/server/Users.ts +62 -0
  62. package/ai-docs/src/51_http-server/index.md +3 -0
  63. package/ai-docs/src/60_child-process/10_working-with-child-processes.ts +117 -0
  64. package/ai-docs/src/60_child-process/index.md +3 -0
  65. package/ai-docs/src/70_cli/10_basics.ts +136 -0
  66. package/ai-docs/src/70_cli/index.md +5 -0
  67. package/ai-docs/src/71_ai/10_language-model.ts +156 -0
  68. package/ai-docs/src/71_ai/20_tools.ts +226 -0
  69. package/ai-docs/src/71_ai/30_chat.ts +158 -0
  70. package/ai-docs/src/71_ai/fixtures/domain/LaunchPlan.ts +9 -0
  71. package/ai-docs/src/71_ai/index.md +5 -0
  72. package/ai-docs/src/80_cluster/10_entities.ts +97 -0
  73. package/ai-docs/src/80_cluster/index.md +4 -0
  74. package/ai-docs/src/index.md +10 -0
  75. package/ai-docs/tsconfig.json +24 -0
  76. package/dist/Brand.d.ts +3 -3
  77. package/dist/Brand.d.ts.map +1 -1
  78. package/dist/Brand.js +4 -3
  79. package/dist/Brand.js.map +1 -1
  80. package/dist/Cache.js +1 -1
  81. package/dist/Cache.js.map +1 -1
  82. package/dist/Channel.d.ts +1 -1
  83. package/dist/Channel.d.ts.map +1 -1
  84. package/dist/Channel.js.map +1 -1
  85. package/dist/Config.d.ts.map +1 -1
  86. package/dist/Config.js +30 -8
  87. package/dist/Config.js.map +1 -1
  88. package/dist/ConfigProvider.d.ts.map +1 -1
  89. package/dist/ConfigProvider.js +2 -1
  90. package/dist/ConfigProvider.js.map +1 -1
  91. package/dist/Context.d.ts +2 -3
  92. package/dist/Context.d.ts.map +1 -1
  93. package/dist/Context.js +1 -22
  94. package/dist/Context.js.map +1 -1
  95. package/dist/Cron.d.ts +31 -0
  96. package/dist/Cron.d.ts.map +1 -1
  97. package/dist/Cron.js +58 -2
  98. package/dist/Cron.js.map +1 -1
  99. package/dist/Crypto.d.ts.map +1 -1
  100. package/dist/Crypto.js +13 -5
  101. package/dist/Crypto.js.map +1 -1
  102. package/dist/Duration.d.ts.map +1 -1
  103. package/dist/Duration.js +12 -1
  104. package/dist/Duration.js.map +1 -1
  105. package/dist/Effect.d.ts +132 -14
  106. package/dist/Effect.d.ts.map +1 -1
  107. package/dist/Effect.js +38 -0
  108. package/dist/Effect.js.map +1 -1
  109. package/dist/Equal.d.ts.map +1 -1
  110. package/dist/Equal.js +10 -2
  111. package/dist/Equal.js.map +1 -1
  112. package/dist/ExecutionPlan.d.ts +73 -0
  113. package/dist/ExecutionPlan.d.ts.map +1 -1
  114. package/dist/ExecutionPlan.js +1 -1
  115. package/dist/ExecutionPlan.js.map +1 -1
  116. package/dist/FiberSet.js +1 -1
  117. package/dist/FileSystem.d.ts +2 -2
  118. package/dist/Function.d.ts +4 -3
  119. package/dist/Function.d.ts.map +1 -1
  120. package/dist/Function.js +5 -5
  121. package/dist/Function.js.map +1 -1
  122. package/dist/Iterable.d.ts.map +1 -1
  123. package/dist/Iterable.js +11 -10
  124. package/dist/Iterable.js.map +1 -1
  125. package/dist/Layer.d.ts.map +1 -1
  126. package/dist/Layer.js +7 -5
  127. package/dist/Layer.js.map +1 -1
  128. package/dist/Optic.d.ts +35 -21
  129. package/dist/Optic.d.ts.map +1 -1
  130. package/dist/Optic.js +33 -34
  131. package/dist/Optic.js.map +1 -1
  132. package/dist/Schedule.d.ts +8 -8
  133. package/dist/Schedule.d.ts.map +1 -1
  134. package/dist/Schedule.js +4 -4
  135. package/dist/Schedule.js.map +1 -1
  136. package/dist/Schema.d.ts +105 -57
  137. package/dist/Schema.d.ts.map +1 -1
  138. package/dist/Schema.js +105 -67
  139. package/dist/Schema.js.map +1 -1
  140. package/dist/SchemaAST.d.ts +33 -3
  141. package/dist/SchemaAST.d.ts.map +1 -1
  142. package/dist/SchemaAST.js +87 -63
  143. package/dist/SchemaAST.js.map +1 -1
  144. package/dist/SchemaError.d.ts +8 -8
  145. package/dist/SchemaError.d.ts.map +1 -1
  146. package/dist/SchemaError.js +7 -6
  147. package/dist/SchemaError.js.map +1 -1
  148. package/dist/SchemaGetter.d.ts +8 -5
  149. package/dist/SchemaGetter.d.ts.map +1 -1
  150. package/dist/SchemaGetter.js +41 -37
  151. package/dist/SchemaGetter.js.map +1 -1
  152. package/dist/SchemaIssue.d.ts +195 -38
  153. package/dist/SchemaIssue.d.ts.map +1 -1
  154. package/dist/SchemaIssue.js +243 -68
  155. package/dist/SchemaIssue.js.map +1 -1
  156. package/dist/SchemaParser.d.ts +30 -0
  157. package/dist/SchemaParser.d.ts.map +1 -1
  158. package/dist/SchemaParser.js +74 -62
  159. package/dist/SchemaParser.js.map +1 -1
  160. package/dist/SchemaTransformation.d.ts +2 -2
  161. package/dist/SchemaTransformation.d.ts.map +1 -1
  162. package/dist/SchemaTransformation.js +26 -26
  163. package/dist/SchemaTransformation.js.map +1 -1
  164. package/dist/ScopedCache.js +1 -1
  165. package/dist/ScopedCache.js.map +1 -1
  166. package/dist/Sink.d.ts +1 -1
  167. package/dist/Sink.d.ts.map +1 -1
  168. package/dist/Stdio.d.ts +17 -4
  169. package/dist/Stdio.d.ts.map +1 -1
  170. package/dist/Stdio.js +6 -3
  171. package/dist/Stdio.js.map +1 -1
  172. package/dist/Stream.d.ts +27 -4
  173. package/dist/Stream.d.ts.map +1 -1
  174. package/dist/Stream.js +27 -2
  175. package/dist/Stream.js.map +1 -1
  176. package/dist/SynchronizedRef.js +1 -1
  177. package/dist/SynchronizedRef.js.map +1 -1
  178. package/dist/Terminal.js +1 -1
  179. package/dist/Terminal.js.map +1 -1
  180. package/dist/Tuple.d.ts +6 -4
  181. package/dist/Tuple.d.ts.map +1 -1
  182. package/dist/Tuple.js.map +1 -1
  183. package/dist/TxReentrantLock.d.ts +0 -56
  184. package/dist/TxReentrantLock.d.ts.map +1 -1
  185. package/dist/TxReentrantLock.js +8 -8
  186. package/dist/TxReentrantLock.js.map +1 -1
  187. package/dist/internal/dateTime.js +1 -1
  188. package/dist/internal/dateTime.js.map +1 -1
  189. package/dist/internal/executionPlan.js +51 -3
  190. package/dist/internal/executionPlan.js.map +1 -1
  191. package/dist/internal/hashMap.js +12 -8
  192. package/dist/internal/hashMap.js.map +1 -1
  193. package/dist/internal/matcher.js +1 -1
  194. package/dist/internal/matcher.js.map +1 -1
  195. package/dist/internal/schedule.js.map +1 -1
  196. package/dist/internal/schema/annotations.js +2 -0
  197. package/dist/internal/schema/annotations.js.map +1 -1
  198. package/dist/internal/schema/schema.js +1 -9
  199. package/dist/internal/schema/schema.js.map +1 -1
  200. package/dist/internal/schema/toArbitrary.js +1 -1
  201. package/dist/internal/schema/toArbitrary.js.map +1 -1
  202. package/dist/internal/trie.js +13 -3
  203. package/dist/internal/trie.js.map +1 -1
  204. package/dist/testing/TestClock.d.ts.map +1 -1
  205. package/dist/testing/TestClock.js +11 -1
  206. package/dist/testing/TestClock.js.map +1 -1
  207. package/dist/testing/TestSchema.d.ts +2 -2
  208. package/dist/testing/TestSchema.d.ts.map +1 -1
  209. package/dist/testing/TestSchema.js +8 -7
  210. package/dist/testing/TestSchema.js.map +1 -1
  211. package/dist/unstable/ai/AiError.js +19 -19
  212. package/dist/unstable/ai/AiError.js.map +1 -1
  213. package/dist/unstable/ai/Chat.js +1 -1
  214. package/dist/unstable/ai/Chat.js.map +1 -1
  215. package/dist/unstable/ai/LanguageModel.js +4 -2
  216. package/dist/unstable/ai/LanguageModel.js.map +1 -1
  217. package/dist/unstable/ai/McpSchema.d.ts +132 -132
  218. package/dist/unstable/ai/McpSchema.d.ts.map +1 -1
  219. package/dist/unstable/ai/McpSchema.js +8 -8
  220. package/dist/unstable/ai/McpSchema.js.map +1 -1
  221. package/dist/unstable/ai/McpServer.js +1 -1
  222. package/dist/unstable/ai/McpServer.js.map +1 -1
  223. package/dist/unstable/ai/Prompt.d.ts +15 -3
  224. package/dist/unstable/ai/Prompt.d.ts.map +1 -1
  225. package/dist/unstable/ai/Prompt.js +10 -7
  226. package/dist/unstable/ai/Prompt.js.map +1 -1
  227. package/dist/unstable/cli/CliError.d.ts +3 -3
  228. package/dist/unstable/cli/CliError.js +11 -11
  229. package/dist/unstable/cli/CliError.js.map +1 -1
  230. package/dist/unstable/cli/Command.d.ts +9 -9
  231. package/dist/unstable/cli/Command.d.ts.map +1 -1
  232. package/dist/unstable/cli/Command.js +8 -6
  233. package/dist/unstable/cli/Command.js.map +1 -1
  234. package/dist/unstable/cli/Param.d.ts +7 -5
  235. package/dist/unstable/cli/Param.d.ts.map +1 -1
  236. package/dist/unstable/cli/Param.js +15 -11
  237. package/dist/unstable/cli/Param.js.map +1 -1
  238. package/dist/unstable/cli/Primitive.d.ts.map +1 -1
  239. package/dist/unstable/cli/Primitive.js +31 -24
  240. package/dist/unstable/cli/Primitive.js.map +1 -1
  241. package/dist/unstable/cli/Prompt.d.ts.map +1 -1
  242. package/dist/unstable/cli/Prompt.js +31 -17
  243. package/dist/unstable/cli/Prompt.js.map +1 -1
  244. package/dist/unstable/cli/internal/ansi.js +2 -2
  245. package/dist/unstable/cli/internal/ansi.js.map +1 -1
  246. package/dist/unstable/cli/internal/command.d.ts +2 -2
  247. package/dist/unstable/cli/internal/command.d.ts.map +1 -1
  248. package/dist/unstable/cli/internal/command.js +10 -9
  249. package/dist/unstable/cli/internal/command.js.map +1 -1
  250. package/dist/unstable/cli/internal/completions/bash.js +69 -9
  251. package/dist/unstable/cli/internal/completions/bash.js.map +1 -1
  252. package/dist/unstable/cli/internal/completions/descriptor.js +24 -18
  253. package/dist/unstable/cli/internal/completions/descriptor.js.map +1 -1
  254. package/dist/unstable/cli/internal/completions/fish.js +5 -5
  255. package/dist/unstable/cli/internal/completions/fish.js.map +1 -1
  256. package/dist/unstable/cli/internal/help.d.ts.map +1 -1
  257. package/dist/unstable/cli/internal/help.js +4 -2
  258. package/dist/unstable/cli/internal/help.js.map +1 -1
  259. package/dist/unstable/cli/internal/parser.js +3 -3
  260. package/dist/unstable/cli/internal/parser.js.map +1 -1
  261. package/dist/unstable/cli/internal/wizard.js +2 -2
  262. package/dist/unstable/cli/internal/wizard.js.map +1 -1
  263. package/dist/unstable/cluster/ClusterError.js +7 -7
  264. package/dist/unstable/cluster/ClusterError.js.map +1 -1
  265. package/dist/unstable/cluster/ClusterWorkflowEngine.d.ts.map +1 -1
  266. package/dist/unstable/cluster/ClusterWorkflowEngine.js +1 -1
  267. package/dist/unstable/cluster/ClusterWorkflowEngine.js.map +1 -1
  268. package/dist/unstable/cluster/MessageStorage.d.ts.map +1 -1
  269. package/dist/unstable/cluster/MessageStorage.js +8 -1
  270. package/dist/unstable/cluster/MessageStorage.js.map +1 -1
  271. package/dist/unstable/cluster/Reply.d.ts +8 -0
  272. package/dist/unstable/cluster/Reply.d.ts.map +1 -1
  273. package/dist/unstable/cluster/Reply.js +16 -4
  274. package/dist/unstable/cluster/Reply.js.map +1 -1
  275. package/dist/unstable/cluster/RunnerServer.d.ts.map +1 -1
  276. package/dist/unstable/cluster/RunnerServer.js +4 -2
  277. package/dist/unstable/cluster/RunnerServer.js.map +1 -1
  278. package/dist/unstable/cluster/RunnerStorage.d.ts +1 -2
  279. package/dist/unstable/cluster/RunnerStorage.d.ts.map +1 -1
  280. package/dist/unstable/cluster/RunnerStorage.js +7 -6
  281. package/dist/unstable/cluster/RunnerStorage.js.map +1 -1
  282. package/dist/unstable/cluster/Sharding.d.ts.map +1 -1
  283. package/dist/unstable/cluster/Sharding.js +22 -4
  284. package/dist/unstable/cluster/Sharding.js.map +1 -1
  285. package/dist/unstable/cluster/internal/entityManager.js +1 -1
  286. package/dist/unstable/cluster/internal/entityManager.js.map +1 -1
  287. package/dist/unstable/cluster/internal/resourceMap.js +2 -2
  288. package/dist/unstable/cluster/internal/resourceMap.js.map +1 -1
  289. package/dist/unstable/cluster/internal/resourceRef.js +17 -0
  290. package/dist/unstable/cluster/internal/resourceRef.js.map +1 -1
  291. package/dist/unstable/devtools/DevToolsClient.d.ts.map +1 -1
  292. package/dist/unstable/devtools/DevToolsClient.js +7 -2
  293. package/dist/unstable/devtools/DevToolsClient.js.map +1 -1
  294. package/dist/unstable/encoding/Ini.d.ts +20 -0
  295. package/dist/unstable/encoding/Ini.d.ts.map +1 -0
  296. package/dist/unstable/encoding/Ini.js +153 -0
  297. package/dist/unstable/encoding/Ini.js.map +1 -0
  298. package/dist/unstable/encoding/Msgpack.d.ts +2 -1
  299. package/dist/unstable/encoding/Msgpack.d.ts.map +1 -1
  300. package/dist/unstable/encoding/Msgpack.js +27 -13
  301. package/dist/unstable/encoding/Msgpack.js.map +1 -1
  302. package/dist/unstable/encoding/Ndjson.d.ts.map +1 -1
  303. package/dist/unstable/encoding/Ndjson.js +7 -1
  304. package/dist/unstable/encoding/Ndjson.js.map +1 -1
  305. package/dist/unstable/encoding/Sse.d.ts.map +1 -1
  306. package/dist/unstable/encoding/Sse.js +14 -23
  307. package/dist/unstable/encoding/Sse.js.map +1 -1
  308. package/dist/unstable/encoding/Toml.d.ts +19 -0
  309. package/dist/unstable/encoding/Toml.d.ts.map +1 -0
  310. package/dist/unstable/encoding/Toml.js +434 -0
  311. package/dist/unstable/encoding/Toml.js.map +1 -0
  312. package/dist/unstable/encoding/Yaml.d.ts +19 -0
  313. package/dist/unstable/encoding/Yaml.d.ts.map +1 -0
  314. package/dist/unstable/encoding/Yaml.js +461 -0
  315. package/dist/unstable/encoding/Yaml.js.map +1 -0
  316. package/dist/unstable/encoding/index.d.ts +12 -0
  317. package/dist/unstable/encoding/index.d.ts.map +1 -1
  318. package/dist/unstable/encoding/index.js +12 -0
  319. package/dist/unstable/encoding/index.js.map +1 -1
  320. package/dist/unstable/eventlog/EventJournal.d.ts +1 -1
  321. package/dist/unstable/eventlog/EventJournal.d.ts.map +1 -1
  322. package/dist/unstable/eventlog/EventJournal.js +13 -5
  323. package/dist/unstable/eventlog/EventJournal.js.map +1 -1
  324. package/dist/unstable/eventlog/EventLogMessage.js +1 -1
  325. package/dist/unstable/eventlog/EventLogMessage.js.map +1 -1
  326. package/dist/unstable/eventlog/EventLogServerUnencrypted.js +1 -1
  327. package/dist/unstable/eventlog/EventLogServerUnencrypted.js.map +1 -1
  328. package/dist/unstable/eventlog/SqlEventJournal.d.ts.map +1 -1
  329. package/dist/unstable/eventlog/SqlEventJournal.js +1 -4
  330. package/dist/unstable/eventlog/SqlEventJournal.js.map +1 -1
  331. package/dist/unstable/http/FindMyWay/internal/queryString.d.ts +11 -0
  332. package/dist/unstable/http/FindMyWay/internal/queryString.d.ts.map +1 -0
  333. package/dist/unstable/http/FindMyWay/internal/queryString.js +259 -0
  334. package/dist/unstable/http/FindMyWay/internal/queryString.js.map +1 -0
  335. package/dist/unstable/http/FindMyWay/internal/router.d.ts +2 -0
  336. package/dist/unstable/http/FindMyWay/internal/router.d.ts.map +1 -0
  337. package/dist/unstable/http/FindMyWay/internal/router.js +665 -0
  338. package/dist/unstable/http/FindMyWay/internal/router.js.map +1 -0
  339. package/dist/unstable/http/FindMyWay.d.ts +33 -8
  340. package/dist/unstable/http/FindMyWay.d.ts.map +1 -1
  341. package/dist/unstable/http/FindMyWay.js +4 -7
  342. package/dist/unstable/http/FindMyWay.js.map +1 -1
  343. package/dist/unstable/http/HttpClient.d.ts +59 -3
  344. package/dist/unstable/http/HttpClient.d.ts.map +1 -1
  345. package/dist/unstable/http/HttpClient.js +33 -19
  346. package/dist/unstable/http/HttpClient.js.map +1 -1
  347. package/dist/unstable/http/HttpClientError.js +1 -1
  348. package/dist/unstable/http/HttpClientError.js.map +1 -1
  349. package/dist/unstable/http/HttpClientRequest.d.ts.map +1 -1
  350. package/dist/unstable/http/HttpClientRequest.js +2 -14
  351. package/dist/unstable/http/HttpClientRequest.js.map +1 -1
  352. package/dist/unstable/http/HttpClientResponse.js +1 -16
  353. package/dist/unstable/http/HttpClientResponse.js.map +1 -1
  354. package/dist/unstable/http/HttpPlatform.d.ts.map +1 -1
  355. package/dist/unstable/http/HttpPlatform.js +21 -3
  356. package/dist/unstable/http/HttpPlatform.js.map +1 -1
  357. package/dist/unstable/http/HttpServerRequest.d.ts.map +1 -1
  358. package/dist/unstable/http/HttpServerRequest.js +7 -6
  359. package/dist/unstable/http/HttpServerRequest.js.map +1 -1
  360. package/dist/unstable/http/HttpServerResponse.d.ts.map +1 -1
  361. package/dist/unstable/http/HttpServerResponse.js +8 -6
  362. package/dist/unstable/http/HttpServerResponse.js.map +1 -1
  363. package/dist/unstable/http/Multipart.d.ts +1 -1
  364. package/dist/unstable/http/Multipart.d.ts.map +1 -1
  365. package/dist/unstable/http/Multipart.js +9 -2
  366. package/dist/unstable/http/Multipart.js.map +1 -1
  367. package/dist/unstable/http/MultipartParser/HeadersParser.d.ts +53 -0
  368. package/dist/unstable/http/MultipartParser/HeadersParser.d.ts.map +1 -0
  369. package/dist/unstable/http/MultipartParser/HeadersParser.js +14 -0
  370. package/dist/unstable/http/MultipartParser/HeadersParser.js.map +1 -0
  371. package/dist/unstable/http/MultipartParser/Search.d.ts +11 -0
  372. package/dist/unstable/http/MultipartParser/Search.d.ts.map +1 -0
  373. package/dist/unstable/http/MultipartParser/Search.js +14 -0
  374. package/dist/unstable/http/MultipartParser/Search.js.map +1 -0
  375. package/dist/unstable/http/MultipartParser/internal/contentType.d.ts +5 -0
  376. package/dist/unstable/http/MultipartParser/internal/contentType.d.ts.map +1 -0
  377. package/dist/unstable/http/MultipartParser/internal/contentType.js +82 -0
  378. package/dist/unstable/http/MultipartParser/internal/contentType.js.map +1 -0
  379. package/dist/unstable/http/MultipartParser/internal/headers.d.ts +3 -0
  380. package/dist/unstable/http/MultipartParser/internal/headers.d.ts.map +1 -0
  381. package/dist/unstable/http/MultipartParser/internal/headers.js +194 -0
  382. package/dist/unstable/http/MultipartParser/internal/headers.js.map +1 -0
  383. package/dist/unstable/http/MultipartParser/internal/multipart.d.ts +8 -0
  384. package/dist/unstable/http/MultipartParser/internal/multipart.d.ts.map +1 -0
  385. package/dist/unstable/http/MultipartParser/internal/multipart.js +226 -0
  386. package/dist/unstable/http/MultipartParser/internal/multipart.js.map +1 -0
  387. package/dist/unstable/http/MultipartParser/internal/search.d.ts +5 -0
  388. package/dist/unstable/http/MultipartParser/internal/search.d.ts.map +1 -0
  389. package/dist/unstable/http/MultipartParser/internal/search.js +120 -0
  390. package/dist/unstable/http/MultipartParser/internal/search.js.map +1 -0
  391. package/dist/unstable/http/MultipartParser.d.ts +98 -0
  392. package/dist/unstable/http/MultipartParser.d.ts.map +1 -0
  393. package/dist/unstable/http/MultipartParser.js +23 -0
  394. package/dist/unstable/http/MultipartParser.js.map +1 -0
  395. package/dist/unstable/http/Template.d.ts.map +1 -1
  396. package/dist/unstable/http/Template.js +2 -2
  397. package/dist/unstable/http/Template.js.map +1 -1
  398. package/dist/unstable/http/index.d.ts +1 -1
  399. package/dist/unstable/http/index.d.ts.map +1 -1
  400. package/dist/unstable/http/index.js +1 -1
  401. package/dist/unstable/http/index.js.map +1 -1
  402. package/dist/unstable/http/internal/httpBody.d.ts +2 -0
  403. package/dist/unstable/http/internal/httpBody.d.ts.map +1 -0
  404. package/dist/unstable/http/internal/httpBody.js +10 -0
  405. package/dist/unstable/http/internal/httpBody.js.map +1 -0
  406. package/dist/unstable/httpapi/HttpApi.d.ts.map +1 -1
  407. package/dist/unstable/httpapi/HttpApi.js +5 -5
  408. package/dist/unstable/httpapi/HttpApi.js.map +1 -1
  409. package/dist/unstable/httpapi/HttpApiBuilder.js +73 -20
  410. package/dist/unstable/httpapi/HttpApiBuilder.js.map +1 -1
  411. package/dist/unstable/httpapi/HttpApiClient.d.ts +1 -1
  412. package/dist/unstable/httpapi/HttpApiClient.d.ts.map +1 -1
  413. package/dist/unstable/httpapi/HttpApiClient.js +74 -34
  414. package/dist/unstable/httpapi/HttpApiClient.js.map +1 -1
  415. package/dist/unstable/httpapi/HttpApiEndpoint.d.ts +6 -4
  416. package/dist/unstable/httpapi/HttpApiEndpoint.d.ts.map +1 -1
  417. package/dist/unstable/httpapi/HttpApiEndpoint.js +73 -16
  418. package/dist/unstable/httpapi/HttpApiEndpoint.js.map +1 -1
  419. package/dist/unstable/httpapi/HttpApiError.d.ts +5 -5
  420. package/dist/unstable/httpapi/HttpApiError.d.ts.map +1 -1
  421. package/dist/unstable/httpapi/HttpApiError.js +17 -17
  422. package/dist/unstable/httpapi/HttpApiError.js.map +1 -1
  423. package/dist/unstable/httpapi/HttpApiMiddleware.d.ts +1 -1
  424. package/dist/unstable/httpapi/HttpApiMiddleware.js +1 -1
  425. package/dist/unstable/httpapi/HttpApiSchema.d.ts +219 -0
  426. package/dist/unstable/httpapi/HttpApiSchema.d.ts.map +1 -1
  427. package/dist/unstable/httpapi/HttpApiSchema.js +170 -0
  428. package/dist/unstable/httpapi/HttpApiSchema.js.map +1 -1
  429. package/dist/unstable/httpapi/OpenApi.d.ts +8 -0
  430. package/dist/unstable/httpapi/OpenApi.d.ts.map +1 -1
  431. package/dist/unstable/httpapi/OpenApi.js +45 -18
  432. package/dist/unstable/httpapi/OpenApi.js.map +1 -1
  433. package/dist/unstable/observability/OtlpExporter.d.ts +1 -1
  434. package/dist/unstable/observability/OtlpExporter.d.ts.map +1 -1
  435. package/dist/unstable/observability/OtlpExporter.js +2 -1
  436. package/dist/unstable/observability/OtlpExporter.js.map +1 -1
  437. package/dist/unstable/observability/OtlpLogger.d.ts.map +1 -1
  438. package/dist/unstable/observability/OtlpLogger.js +2 -2
  439. package/dist/unstable/observability/OtlpLogger.js.map +1 -1
  440. package/dist/unstable/observability/OtlpMetrics.d.ts +2 -2
  441. package/dist/unstable/observability/OtlpMetrics.d.ts.map +1 -1
  442. package/dist/unstable/observability/OtlpMetrics.js +28 -15
  443. package/dist/unstable/observability/OtlpMetrics.js.map +1 -1
  444. package/dist/unstable/observability/OtlpTracer.js +1 -1
  445. package/dist/unstable/observability/OtlpTracer.js.map +1 -1
  446. package/dist/unstable/persistence/PersistedQueue.d.ts.map +1 -1
  447. package/dist/unstable/persistence/PersistedQueue.js +9 -9
  448. package/dist/unstable/persistence/PersistedQueue.js.map +1 -1
  449. package/dist/unstable/persistence/Persistence.d.ts.map +1 -1
  450. package/dist/unstable/persistence/Persistence.js +17 -7
  451. package/dist/unstable/persistence/Persistence.js.map +1 -1
  452. package/dist/unstable/persistence/RateLimiter.d.ts +22 -12
  453. package/dist/unstable/persistence/RateLimiter.d.ts.map +1 -1
  454. package/dist/unstable/persistence/RateLimiter.js +15 -42
  455. package/dist/unstable/persistence/RateLimiter.js.map +1 -1
  456. package/dist/unstable/persistence/Redis.js +1 -1
  457. package/dist/unstable/persistence/Redis.js.map +1 -1
  458. package/dist/unstable/reactivity/AsyncResult.d.ts.map +1 -1
  459. package/dist/unstable/reactivity/AsyncResult.js +4 -4
  460. package/dist/unstable/reactivity/AsyncResult.js.map +1 -1
  461. package/dist/unstable/reactivity/Atom.d.ts +26 -11
  462. package/dist/unstable/reactivity/Atom.d.ts.map +1 -1
  463. package/dist/unstable/reactivity/Atom.js +9 -22
  464. package/dist/unstable/reactivity/Atom.js.map +1 -1
  465. package/dist/unstable/rpc/RpcClient.d.ts +14 -0
  466. package/dist/unstable/rpc/RpcClient.d.ts.map +1 -1
  467. package/dist/unstable/rpc/RpcClient.js +21 -10
  468. package/dist/unstable/rpc/RpcClient.js.map +1 -1
  469. package/dist/unstable/rpc/RpcClientError.js +2 -2
  470. package/dist/unstable/rpc/RpcClientError.js.map +1 -1
  471. package/dist/unstable/rpc/RpcSerialization.js +3 -1
  472. package/dist/unstable/rpc/RpcSerialization.js.map +1 -1
  473. package/dist/unstable/rpc/RpcServer.d.ts.map +1 -1
  474. package/dist/unstable/rpc/RpcServer.js +3 -2
  475. package/dist/unstable/rpc/RpcServer.js.map +1 -1
  476. package/dist/unstable/schema/Model.d.ts +1 -1
  477. package/dist/unstable/schema/Model.d.ts.map +1 -1
  478. package/dist/unstable/schema/VariantSchema.d.ts +5 -5
  479. package/dist/unstable/schema/VariantSchema.d.ts.map +1 -1
  480. package/dist/unstable/schema/VariantSchema.js +17 -9
  481. package/dist/unstable/schema/VariantSchema.js.map +1 -1
  482. package/dist/unstable/socket/Socket.d.ts.map +1 -1
  483. package/dist/unstable/socket/Socket.js +28 -12
  484. package/dist/unstable/socket/Socket.js.map +1 -1
  485. package/dist/unstable/sql/SqlClient.d.ts.map +1 -1
  486. package/dist/unstable/sql/SqlClient.js +7 -3
  487. package/dist/unstable/sql/SqlClient.js.map +1 -1
  488. package/dist/unstable/sql/SqlError.js +13 -13
  489. package/dist/unstable/sql/SqlError.js.map +1 -1
  490. package/dist/unstable/sql/SqlResolver.js +8 -6
  491. package/dist/unstable/sql/SqlResolver.js.map +1 -1
  492. package/dist/unstable/sql/Statement.d.ts.map +1 -1
  493. package/dist/unstable/sql/Statement.js +8 -6
  494. package/dist/unstable/sql/Statement.js.map +1 -1
  495. package/dist/unstable/workers/WorkerError.js +5 -5
  496. package/dist/unstable/workers/WorkerError.js.map +1 -1
  497. package/dist/unstable/workflow/Workflow.d.ts.map +1 -1
  498. package/dist/unstable/workflow/Workflow.js +2 -2
  499. package/dist/unstable/workflow/Workflow.js.map +1 -1
  500. package/dist/unstable/workflow/WorkflowEngine.d.ts +1 -1
  501. package/dist/unstable/workflow/WorkflowEngine.d.ts.map +1 -1
  502. package/dist/unstable/workflow/WorkflowEngine.js +3 -3
  503. package/dist/unstable/workflow/WorkflowEngine.js.map +1 -1
  504. package/package.json +6 -9
  505. package/src/Brand.ts +4 -4
  506. package/src/Cache.ts +1 -1
  507. package/src/Channel.ts +1 -1
  508. package/src/Config.ts +31 -8
  509. package/src/ConfigProvider.ts +4 -1
  510. package/src/Context.ts +6 -28
  511. package/src/Cron.ts +65 -2
  512. package/src/Crypto.ts +17 -8
  513. package/src/Duration.ts +16 -2
  514. package/src/Effect.ts +141 -17
  515. package/src/Equal.ts +10 -2
  516. package/src/ExecutionPlan.ts +78 -1
  517. package/src/FiberSet.ts +1 -1
  518. package/src/FileSystem.ts +2 -2
  519. package/src/Function.ts +6 -6
  520. package/src/Iterable.ts +11 -10
  521. package/src/Layer.ts +7 -5
  522. package/src/Optic.ts +59 -58
  523. package/src/Schedule.ts +13 -13
  524. package/src/Schema.ts +195 -112
  525. package/src/SchemaAST.ts +154 -85
  526. package/src/SchemaError.ts +9 -9
  527. package/src/SchemaGetter.ts +89 -30
  528. package/src/SchemaIssue.ts +285 -80
  529. package/src/SchemaParser.ts +126 -86
  530. package/src/SchemaTransformation.ts +66 -18
  531. package/src/ScopedCache.ts +1 -1
  532. package/src/Sink.ts +1 -1
  533. package/src/Stdio.ts +23 -4
  534. package/src/Stream.ts +77 -10
  535. package/src/SynchronizedRef.ts +1 -1
  536. package/src/Terminal.ts +1 -1
  537. package/src/Tuple.ts +7 -4
  538. package/src/TxReentrantLock.ts +39 -35
  539. package/src/internal/dateTime.ts +1 -1
  540. package/src/internal/executionPlan.ts +105 -10
  541. package/src/internal/hashMap.ts +20 -14
  542. package/src/internal/matcher.ts +2 -2
  543. package/src/internal/schedule.ts +4 -4
  544. package/src/internal/schema/annotations.ts +3 -0
  545. package/src/internal/schema/schema.ts +1 -17
  546. package/src/internal/schema/toArbitrary.ts +3 -1
  547. package/src/internal/trie.ts +12 -2
  548. package/src/testing/TestClock.ts +13 -1
  549. package/src/testing/TestSchema.ts +9 -9
  550. package/src/unstable/ai/AiError.ts +19 -19
  551. package/src/unstable/ai/Chat.ts +1 -1
  552. package/src/unstable/ai/LanguageModel.ts +4 -2
  553. package/src/unstable/ai/McpSchema.ts +17 -16
  554. package/src/unstable/ai/McpServer.ts +1 -1
  555. package/src/unstable/ai/Prompt.ts +35 -10
  556. package/src/unstable/cli/CliError.ts +12 -12
  557. package/src/unstable/cli/Command.ts +12 -10
  558. package/src/unstable/cli/Param.ts +41 -19
  559. package/src/unstable/cli/Primitive.ts +11 -5
  560. package/src/unstable/cli/Prompt.ts +36 -20
  561. package/src/unstable/cli/internal/ansi.ts +2 -2
  562. package/src/unstable/cli/internal/command.ts +15 -10
  563. package/src/unstable/cli/internal/completions/bash.ts +59 -9
  564. package/src/unstable/cli/internal/completions/descriptor.ts +14 -20
  565. package/src/unstable/cli/internal/completions/fish.ts +5 -7
  566. package/src/unstable/cli/internal/help.ts +4 -2
  567. package/src/unstable/cli/internal/parser.ts +3 -3
  568. package/src/unstable/cli/internal/wizard.ts +2 -2
  569. package/src/unstable/cluster/ClusterError.ts +7 -7
  570. package/src/unstable/cluster/ClusterWorkflowEngine.ts +4 -1
  571. package/src/unstable/cluster/MessageStorage.ts +9 -5
  572. package/src/unstable/cluster/Reply.ts +25 -4
  573. package/src/unstable/cluster/RunnerServer.ts +4 -10
  574. package/src/unstable/cluster/RunnerStorage.ts +9 -7
  575. package/src/unstable/cluster/Sharding.ts +35 -7
  576. package/src/unstable/cluster/internal/entityManager.ts +1 -1
  577. package/src/unstable/cluster/internal/resourceMap.ts +5 -2
  578. package/src/unstable/cluster/internal/resourceRef.ts +27 -5
  579. package/src/unstable/devtools/DevToolsClient.ts +3 -2
  580. package/src/unstable/encoding/Ini.ts +174 -0
  581. package/src/unstable/encoding/Msgpack.ts +59 -36
  582. package/src/unstable/encoding/Ndjson.ts +9 -1
  583. package/src/unstable/encoding/Sse.ts +11 -21
  584. package/src/unstable/encoding/Toml.ts +504 -0
  585. package/src/unstable/encoding/Yaml.ts +541 -0
  586. package/src/unstable/encoding/index.ts +15 -0
  587. package/src/unstable/eventlog/EventJournal.ts +14 -6
  588. package/src/unstable/eventlog/EventLogMessage.ts +1 -1
  589. package/src/unstable/eventlog/EventLogServerUnencrypted.ts +1 -1
  590. package/src/unstable/eventlog/SqlEventJournal.ts +6 -4
  591. package/src/unstable/http/FindMyWay/internal/queryString.ts +420 -0
  592. package/src/unstable/http/FindMyWay/internal/router.ts +950 -0
  593. package/src/unstable/http/FindMyWay.ts +65 -6
  594. package/src/unstable/http/HttpClient.ts +132 -23
  595. package/src/unstable/http/HttpClientError.ts +1 -1
  596. package/src/unstable/http/HttpClientRequest.ts +2 -14
  597. package/src/unstable/http/HttpClientResponse.ts +1 -17
  598. package/src/unstable/http/HttpPlatform.ts +34 -6
  599. package/src/unstable/http/HttpServerRequest.ts +14 -6
  600. package/src/unstable/http/HttpServerResponse.ts +9 -7
  601. package/src/unstable/http/Multipart.ts +9 -2
  602. package/src/unstable/http/MultipartParser/HeadersParser.ts +68 -0
  603. package/src/unstable/http/MultipartParser/Search.ts +17 -0
  604. package/src/unstable/http/MultipartParser/internal/contentType.ts +103 -0
  605. package/src/unstable/http/MultipartParser/internal/headers.ts +615 -0
  606. package/src/unstable/http/MultipartParser/internal/multipart.ts +262 -0
  607. package/src/unstable/http/MultipartParser/internal/search.ts +167 -0
  608. package/src/unstable/http/MultipartParser.ts +115 -0
  609. package/src/unstable/http/Template.ts +6 -5
  610. package/src/unstable/http/index.ts +1 -1
  611. package/src/unstable/http/internal/httpBody.ts +15 -0
  612. package/src/unstable/httpapi/HttpApi.ts +6 -7
  613. package/src/unstable/httpapi/HttpApiBuilder.ts +142 -25
  614. package/src/unstable/httpapi/HttpApiClient.ts +130 -49
  615. package/src/unstable/httpapi/HttpApiEndpoint.ts +117 -29
  616. package/src/unstable/httpapi/HttpApiError.ts +33 -39
  617. package/src/unstable/httpapi/HttpApiMiddleware.ts +1 -1
  618. package/src/unstable/httpapi/HttpApiSchema.ts +353 -0
  619. package/src/unstable/httpapi/OpenApi.ts +70 -20
  620. package/src/unstable/observability/OtlpExporter.ts +4 -2
  621. package/src/unstable/observability/OtlpLogger.ts +3 -1
  622. package/src/unstable/observability/OtlpMetrics.ts +32 -18
  623. package/src/unstable/observability/OtlpTracer.ts +1 -1
  624. package/src/unstable/persistence/PersistedQueue.ts +12 -9
  625. package/src/unstable/persistence/Persistence.ts +27 -7
  626. package/src/unstable/persistence/RateLimiter.ts +54 -31
  627. package/src/unstable/persistence/Redis.ts +1 -1
  628. package/src/unstable/reactivity/AsyncResult.ts +11 -6
  629. package/src/unstable/reactivity/Atom.ts +44 -25
  630. package/src/unstable/rpc/RpcClient.ts +42 -13
  631. package/src/unstable/rpc/RpcClientError.ts +2 -2
  632. package/src/unstable/rpc/RpcSerialization.ts +1 -1
  633. package/src/unstable/rpc/RpcServer.ts +4 -2
  634. package/src/unstable/schema/VariantSchema.ts +36 -18
  635. package/src/unstable/socket/Socket.ts +24 -14
  636. package/src/unstable/sql/SqlClient.ts +65 -56
  637. package/src/unstable/sql/SqlError.ts +13 -13
  638. package/src/unstable/sql/SqlResolver.ts +8 -6
  639. package/src/unstable/sql/Statement.ts +13 -8
  640. package/src/unstable/workers/WorkerError.ts +5 -5
  641. package/src/unstable/workflow/Workflow.ts +2 -5
  642. package/src/unstable/workflow/WorkflowEngine.ts +8 -3
  643. package/dist/unstable/http/Multipasta/HeadersParser.d.ts +0 -14
  644. package/dist/unstable/http/Multipasta/HeadersParser.d.ts.map +0 -1
  645. package/dist/unstable/http/Multipasta/HeadersParser.js +0 -14
  646. package/dist/unstable/http/Multipasta/HeadersParser.js.map +0 -1
  647. package/dist/unstable/http/Multipasta/Node.d.ts +0 -14
  648. package/dist/unstable/http/Multipasta/Node.d.ts.map +0 -1
  649. package/dist/unstable/http/Multipasta/Node.js +0 -14
  650. package/dist/unstable/http/Multipasta/Node.js.map +0 -1
  651. package/dist/unstable/http/Multipasta/Search.d.ts +0 -14
  652. package/dist/unstable/http/Multipasta/Search.d.ts.map +0 -1
  653. package/dist/unstable/http/Multipasta/Search.js +0 -14
  654. package/dist/unstable/http/Multipasta/Search.js.map +0 -1
  655. package/dist/unstable/http/Multipasta/Web.d.ts +0 -14
  656. package/dist/unstable/http/Multipasta/Web.d.ts.map +0 -1
  657. package/dist/unstable/http/Multipasta/Web.js +0 -14
  658. package/dist/unstable/http/Multipasta/Web.js.map +0 -1
  659. package/dist/unstable/http/Multipasta.d.ts +0 -15
  660. package/dist/unstable/http/Multipasta.d.ts.map +0 -1
  661. package/dist/unstable/http/Multipasta.js +0 -15
  662. package/dist/unstable/http/Multipasta.js.map +0 -1
  663. package/src/unstable/http/Multipasta/HeadersParser.ts +0 -14
  664. package/src/unstable/http/Multipasta/Node.ts +0 -14
  665. package/src/unstable/http/Multipasta/Search.ts +0 -14
  666. package/src/unstable/http/Multipasta/Web.ts +0 -14
  667. package/src/unstable/http/Multipasta.ts +0 -15
package/src/Effect.ts CHANGED
@@ -15,7 +15,7 @@ import type * as Cause from "./Cause.ts"
15
15
  import type { Clock } from "./Clock.ts"
16
16
  import * as Context from "./Context.ts"
17
17
  import * as Duration from "./Duration.ts"
18
- import type { ExecutionPlan } from "./ExecutionPlan.ts"
18
+ import type * as ExecutionPlan from "./ExecutionPlan.ts"
19
19
  import * as Exit from "./Exit.ts"
20
20
  import type { Fiber } from "./Fiber.ts"
21
21
  import type * as Filter from "./Filter.ts"
@@ -7790,6 +7790,14 @@ export const ignoreCause: <
7790
7790
  * and retry timing is derived per step (the first attempt uses the remaining
7791
7791
  * attempts schedule; later retries apply the step schedule at least once).
7792
7792
  *
7793
+ * Attempts can be observed from outside the effect by passing
7794
+ * `options.onEvent`, which receives an `ExecutionPlan.Event` before each
7795
+ * attempt and after it settles. The handler is awaited inline before and after
7796
+ * every attempt, so events are strictly ordered; keep it cheap. It cannot
7797
+ * fail, which keeps observation from changing the plan's outcome, and its
7798
+ * requirements are added to the resulting effect. Terminal events run like
7799
+ * finalizers, so they are emitted even when the attempt is interrupted.
7800
+ *
7793
7801
  * **Example** (Retrying with an execution plan)
7794
7802
  *
7795
7803
  * ```ts import.meta.vitest
@@ -7814,6 +7822,36 @@ export const ignoreCause: <
7814
7822
  * Effect.runSync(program) // => "good"
7815
7823
  * ```
7816
7824
  *
7825
+ * **Example** (Observing execution-plan attempts)
7826
+ *
7827
+ * ```ts import.meta.vitest
7828
+ * import { Context, Effect, ExecutionPlan, Layer } from "effect"
7829
+ *
7830
+ * const Endpoint = Context.Service<{ url: string }>("Endpoint")
7831
+ *
7832
+ * const fetchUrl = Effect.gen(function*() {
7833
+ * const endpoint = yield* Effect.service(Endpoint)
7834
+ * if (endpoint.url === "bad") {
7835
+ * return yield* Effect.fail("Unavailable")
7836
+ * }
7837
+ * return endpoint.url
7838
+ * })
7839
+ *
7840
+ * const plan = ExecutionPlan.make(
7841
+ * { provide: Layer.succeed(Endpoint, { url: "bad" }) },
7842
+ * { provide: Layer.succeed(Endpoint, { url: "good" }) }
7843
+ * )
7844
+ *
7845
+ * const events: Array<string> = []
7846
+ * const program = Effect.withExecutionPlan(fetchUrl, plan, {
7847
+ * onEvent: (event) => Effect.sync(() => events.push(`${event._tag}:${event.stepIndex}`))
7848
+ * })
7849
+ *
7850
+ * await Effect.runPromise(program) // => "good"
7851
+ *
7852
+ * events // => ["AttemptStart:0", "AttemptFailure:0", "AttemptStart:1", "AttemptSuccess:1"]
7853
+ * ```
7854
+ *
7817
7855
  * @category error handling
7818
7856
  * @since 3.16.0
7819
7857
  */
@@ -7828,6 +7866,14 @@ export const withExecutionPlan: {
7828
7866
  * and retry timing is derived per step (the first attempt uses the remaining
7829
7867
  * attempts schedule; later retries apply the step schedule at least once).
7830
7868
  *
7869
+ * Attempts can be observed from outside the effect by passing
7870
+ * `options.onEvent`, which receives an `ExecutionPlan.Event` before each
7871
+ * attempt and after it settles. The handler is awaited inline before and after
7872
+ * every attempt, so events are strictly ordered; keep it cheap. It cannot
7873
+ * fail, which keeps observation from changing the plan's outcome, and its
7874
+ * requirements are added to the resulting effect. Terminal events run like
7875
+ * finalizers, so they are emitted even when the attempt is interrupted.
7876
+ *
7831
7877
  * **Example** (Retrying with an execution plan)
7832
7878
  *
7833
7879
  * ```ts import.meta.vitest
@@ -7852,14 +7898,47 @@ export const withExecutionPlan: {
7852
7898
  * Effect.runSync(program) // => "good"
7853
7899
  * ```
7854
7900
  *
7901
+ * **Example** (Observing execution-plan attempts)
7902
+ *
7903
+ * ```ts import.meta.vitest
7904
+ * import { Context, Effect, ExecutionPlan, Layer } from "effect"
7905
+ *
7906
+ * const Endpoint = Context.Service<{ url: string }>("Endpoint")
7907
+ *
7908
+ * const fetchUrl = Effect.gen(function*() {
7909
+ * const endpoint = yield* Effect.service(Endpoint)
7910
+ * if (endpoint.url === "bad") {
7911
+ * return yield* Effect.fail("Unavailable")
7912
+ * }
7913
+ * return endpoint.url
7914
+ * })
7915
+ *
7916
+ * const plan = ExecutionPlan.make(
7917
+ * { provide: Layer.succeed(Endpoint, { url: "bad" }) },
7918
+ * { provide: Layer.succeed(Endpoint, { url: "good" }) }
7919
+ * )
7920
+ *
7921
+ * const events: Array<string> = []
7922
+ * const program = Effect.withExecutionPlan(fetchUrl, plan, {
7923
+ * onEvent: (event) => Effect.sync(() => events.push(`${event._tag}:${event.stepIndex}`))
7924
+ * })
7925
+ *
7926
+ * await Effect.runPromise(program) // => "good"
7927
+ *
7928
+ * events // => ["AttemptStart:0", "AttemptFailure:0", "AttemptStart:1", "AttemptSuccess:1"]
7929
+ * ```
7930
+ *
7855
7931
  * @category error handling
7856
7932
  * @since 3.16.0
7857
7933
  */
7858
- <Input, Provides, PlanE, PlanR>(
7859
- plan: ExecutionPlan<{ provides: Provides; input: Input; error: PlanE; requirements: PlanR }>
7934
+ <Input, Provides, PlanE, PlanR, RX = never>(
7935
+ plan: ExecutionPlan.ExecutionPlan<{ provides: Provides; input: Input; error: PlanE; requirements: PlanR }>,
7936
+ options?: {
7937
+ readonly onEvent?: ((event: ExecutionPlan.Event<Input | PlanE>) => Effect<void, never, RX>) | undefined
7938
+ }
7860
7939
  ): <A, E extends Input, R>(
7861
7940
  effect: Effect<A, E, R>
7862
- ) => Effect<A, E | PlanE, Exclude<R, Provides> | PlanR>
7941
+ ) => Effect<A, E | PlanE, Exclude<R, Provides> | PlanR | RX>
7863
7942
  /**
7864
7943
  * Applies an `ExecutionPlan` to an effect, retrying with step-provided resources
7865
7944
  * until it succeeds or the plan is exhausted.
@@ -7870,6 +7949,14 @@ export const withExecutionPlan: {
7870
7949
  * and retry timing is derived per step (the first attempt uses the remaining
7871
7950
  * attempts schedule; later retries apply the step schedule at least once).
7872
7951
  *
7952
+ * Attempts can be observed from outside the effect by passing
7953
+ * `options.onEvent`, which receives an `ExecutionPlan.Event` before each
7954
+ * attempt and after it settles. The handler is awaited inline before and after
7955
+ * every attempt, so events are strictly ordered; keep it cheap. It cannot
7956
+ * fail, which keeps observation from changing the plan's outcome, and its
7957
+ * requirements are added to the resulting effect. Terminal events run like
7958
+ * finalizers, so they are emitted even when the attempt is interrupted.
7959
+ *
7873
7960
  * **Example** (Retrying with an execution plan)
7874
7961
  *
7875
7962
  * ```ts import.meta.vitest
@@ -7894,13 +7981,46 @@ export const withExecutionPlan: {
7894
7981
  * Effect.runSync(program) // => "good"
7895
7982
  * ```
7896
7983
  *
7984
+ * **Example** (Observing execution-plan attempts)
7985
+ *
7986
+ * ```ts import.meta.vitest
7987
+ * import { Context, Effect, ExecutionPlan, Layer } from "effect"
7988
+ *
7989
+ * const Endpoint = Context.Service<{ url: string }>("Endpoint")
7990
+ *
7991
+ * const fetchUrl = Effect.gen(function*() {
7992
+ * const endpoint = yield* Effect.service(Endpoint)
7993
+ * if (endpoint.url === "bad") {
7994
+ * return yield* Effect.fail("Unavailable")
7995
+ * }
7996
+ * return endpoint.url
7997
+ * })
7998
+ *
7999
+ * const plan = ExecutionPlan.make(
8000
+ * { provide: Layer.succeed(Endpoint, { url: "bad" }) },
8001
+ * { provide: Layer.succeed(Endpoint, { url: "good" }) }
8002
+ * )
8003
+ *
8004
+ * const events: Array<string> = []
8005
+ * const program = Effect.withExecutionPlan(fetchUrl, plan, {
8006
+ * onEvent: (event) => Effect.sync(() => events.push(`${event._tag}:${event.stepIndex}`))
8007
+ * })
8008
+ *
8009
+ * await Effect.runPromise(program) // => "good"
8010
+ *
8011
+ * events // => ["AttemptStart:0", "AttemptFailure:0", "AttemptStart:1", "AttemptSuccess:1"]
8012
+ * ```
8013
+ *
7897
8014
  * @category error handling
7898
8015
  * @since 3.16.0
7899
8016
  */
7900
- <A, E extends Input, R, Provides, Input, PlanE, PlanR>(
8017
+ <A, E extends Input, R, Provides, Input, PlanE, PlanR, RX = never>(
7901
8018
  effect: Effect<A, E, R>,
7902
- plan: ExecutionPlan<{ provides: Provides; input: Input; error: PlanE; requirements: PlanR }>
7903
- ): Effect<A, E | PlanE, Exclude<R, Provides> | PlanR>
8019
+ plan: ExecutionPlan.ExecutionPlan<{ provides: Provides; input: Input; error: PlanE; requirements: PlanR }>,
8020
+ options?: {
8021
+ readonly onEvent?: ((event: ExecutionPlan.Event<E | PlanE>) => Effect<void, never, RX>) | undefined
8022
+ }
8023
+ ): Effect<A, E | PlanE, Exclude<R, Provides> | PlanR | RX>
7904
8024
  } = internalExecutionPlan.withExecutionPlan
7905
8025
 
7906
8026
  /**
@@ -12005,7 +12125,7 @@ export const updateService: {
12005
12125
  * @category providing services
12006
12126
  * @since 2.0.0
12007
12127
  */
12008
- <I, A>(service: Context.Key<I, A>, f: (value: A) => A): <XA, E, R>(self: Effect<XA, E, R>) => Effect<XA, E, R | I>
12128
+ <I, A>(service: Context.Key<I, A>, f: (value: A) => NoInfer<A>): <XA, E, R>(self: Effect<XA, E, R>) => Effect<XA, E, R | I>
12009
12129
  /**
12010
12130
  * Runs an effect with a service implementation transformed by the provided
12011
12131
  * function.
@@ -12041,7 +12161,11 @@ export const updateService: {
12041
12161
  * @category providing services
12042
12162
  * @since 2.0.0
12043
12163
  */
12044
- <XA, E, R, I, A>(self: Effect<XA, E, R>, service: Context.Key<I, A>, f: (value: A) => A): Effect<XA, E, R | I>
12164
+ <XA, E, R, I, A>(
12165
+ self: Effect<XA, E, R>,
12166
+ service: Context.Key<I, A>,
12167
+ f: (value: A) => NoInfer<A>
12168
+ ): Effect<XA, E, R | I>
12045
12169
  } = internal.updateService
12046
12170
 
12047
12171
  /**
@@ -12105,7 +12229,7 @@ export const updateService: {
12105
12229
  */
12106
12230
  export const updateServiceScoped: <I, A>(
12107
12231
  service: Context.Key<I, A>,
12108
- f: (value: A) => A,
12232
+ f: (value: A) => NoInfer<A>,
12109
12233
  options?: {
12110
12234
  readonly reset?: ((original: A, updated: A, current: A) => A) | undefined
12111
12235
  } | undefined
@@ -12513,7 +12637,7 @@ export const provideServiceEffect: {
12513
12637
  * @category providing services
12514
12638
  * @since 2.0.0
12515
12639
  */
12516
- <I, S, E2, R2>(service: Context.Key<I, S>, acquire: Effect<S, E2, R2>): <A, E, R>(self: Effect<A, E, R>) => Effect<A, E | E2, Exclude<R, I> | R2>
12640
+ <I, S, E2, R2>(service: Context.Key<I, S>, acquire: Effect<NoInfer<S>, E2, R2>): <A, E, R>(self: Effect<A, E, R>) => Effect<A, E | E2, Exclude<R, I> | R2>
12517
12641
  /**
12518
12642
  * Provides one service to an effect using an effectful acquisition.
12519
12643
  *
@@ -12572,7 +12696,7 @@ export const provideServiceEffect: {
12572
12696
  <A, E, R, I, S, E2, R2>(
12573
12697
  self: Effect<A, E, R>,
12574
12698
  service: Context.Key<I, S>,
12575
- acquire: Effect<S, E2, R2>
12699
+ acquire: Effect<NoInfer<S>, E2, R2>
12576
12700
  ): Effect<A, E | E2, Exclude<R, I> | R2>
12577
12701
  } = internal.provideServiceEffect
12578
12702
 
@@ -15378,7 +15502,7 @@ export const schedule: {
15378
15502
  * @category repetition
15379
15503
  * @since 2.0.0
15380
15504
  */
15381
- <Output, Error, Env>(schedule: Schedule<Output, unknown, Error, Env>): <A, E, R>(self: Effect<A, E, R>) => Effect<Output, E, R | Env>
15505
+ <Output, Error, Env>(schedule: Schedule<Output, unknown, Error, Env>): <A, E, R>(self: Effect<A, E, R>) => Effect<Output, E | Error, R | Env>
15382
15506
  /**
15383
15507
  * Runs an effect repeatedly according to a schedule and returns the schedule's
15384
15508
  * final output.
@@ -15419,11 +15543,11 @@ export const schedule: {
15419
15543
  * @category repetition
15420
15544
  * @since 2.0.0
15421
15545
  */
15422
- <A, E, R, Output, Error, Env>(self: Effect<A, E, R>, schedule: Schedule<Output, unknown, Error, Env>): Effect<Output, E, R | Env>
15546
+ <A, E, R, Output, Error, Env>(self: Effect<A, E, R>, schedule: Schedule<Output, unknown, Error, Env>): Effect<Output, E | Error, R | Env>
15423
15547
  } = dual(2, <A, E, R, Output, Error, Env>(
15424
15548
  self: Effect<A, E, R>,
15425
15549
  schedule: Schedule<Output, unknown, Error, Env>
15426
- ): Effect<Output, E, R | Env> => scheduleFrom(self, undefined, schedule))
15550
+ ): Effect<Output, E | Error, R | Env> => scheduleFrom(self, undefined, schedule))
15427
15551
 
15428
15552
  /**
15429
15553
  * Runs an effect repeatedly according to a schedule that is initialized with a
@@ -15502,7 +15626,7 @@ export const scheduleFrom: {
15502
15626
  * @category repetition
15503
15627
  * @since 2.0.0
15504
15628
  */
15505
- <Input, Output, Error, Env>(initial: Input, schedule: Schedule<Output, Input, Error, Env>): <E, R>(self: Effect<Input, E, R>) => Effect<Output, E, R | Env>
15629
+ <Input, Output, Error, Env>(initial: Input, schedule: Schedule<Output, Input, Error, Env>): <E, R>(self: Effect<Input, E, R>) => Effect<Output, E | Error, R | Env>
15506
15630
  /**
15507
15631
  * Runs an effect repeatedly according to a schedule that is initialized with a
15508
15632
  * specific schedule input.
@@ -15545,7 +15669,7 @@ export const scheduleFrom: {
15545
15669
  self: Effect<Input, E, R>,
15546
15670
  initial: Input,
15547
15671
  schedule: Schedule<Output, Input, Error, Env>
15548
- ): Effect<Output, E, R | Env>
15672
+ ): Effect<Output, E | Error, R | Env>
15549
15673
  } = internalSchedule.scheduleFrom
15550
15674
 
15551
15675
  // -----------------------------------------------------------------------------
package/src/Equal.ts CHANGED
@@ -360,10 +360,14 @@ function compareRecords(
360
360
  /** @internal */
361
361
  export function makeCompareMap<K, V>(keyEquivalence: Equivalence<K>, valueEquivalence: Equivalence<V>) {
362
362
  return function compareMaps(self: Iterable<[K, V]>, that: Iterable<[K, V]>): boolean {
363
+ const thatEntries = Array.from(that)
363
364
  for (const [selfKey, selfValue] of self) {
364
365
  let found = false
365
- for (const [thatKey, thatValue] of that) {
366
+ for (let i = 0; i < thatEntries.length; i++) {
367
+ const [thatKey, thatValue] = thatEntries[i]
366
368
  if (keyEquivalence(selfKey, thatKey) && valueEquivalence(selfValue, thatValue)) {
369
+ thatEntries[i] = thatEntries[thatEntries.length - 1]
370
+ thatEntries.pop()
367
371
  found = true
368
372
  break
369
373
  }
@@ -382,10 +386,14 @@ const compareMaps = makeCompareMap(compareBoth, compareBoth)
382
386
  /** @internal */
383
387
  export function makeCompareSet<A>(equivalence: Equivalence<A>) {
384
388
  return function compareSets(self: Iterable<A>, that: Iterable<A>): boolean {
389
+ const thatValues = Array.from(that)
385
390
  for (const selfValue of self) {
386
391
  let found = false
387
- for (const thatValue of that) {
392
+ for (let i = 0; i < thatValues.length; i++) {
393
+ const thatValue = thatValues[i]
388
394
  if (equivalence(selfValue, thatValue)) {
395
+ thatValues[i] = thatValues[thatValues.length - 1]
396
+ thatValues.pop()
389
397
  found = true
390
398
  break
391
399
  }
@@ -10,7 +10,9 @@
10
10
  * @since 3.16.0
11
11
  */
12
12
  import type { NonEmptyReadonlyArray } from "./Array.ts"
13
+ import type * as Cause from "./Cause.ts"
13
14
  import * as Context from "./Context.ts"
15
+ import type * as Duration from "./Duration.ts"
14
16
  import type * as Effect from "./Effect.ts"
15
17
  import { constant } from "./Function.ts"
16
18
  import * as effect from "./internal/effect.ts"
@@ -179,7 +181,7 @@ export const make = <const Steps extends NonEmptyReadonlyArray<make.Step>>(
179
181
  | (Steps[number]["schedule"] extends Schedule.Schedule<infer _O, infer _I, infer R> ? R : never)
180
182
  }> =>
181
183
  makeProto(steps.map((options, i) => {
182
- if (options.attempts && options.attempts < 1) {
184
+ if (options.attempts !== undefined && options.attempts < 1) {
183
185
  throw new Error(`ExecutionPlan.make: step[${i}].attempts must be greater than 0`)
184
186
  }
185
187
  return {
@@ -372,3 +374,78 @@ export const CurrentMetadata = Context.Reference<Metadata>("effect/ExecutionPlan
372
374
  stepIndex: 0
373
375
  })
374
376
  })
377
+
378
+ /**
379
+ * Lifecycle event emitted before an execution-plan attempt runs.
380
+ *
381
+ * **Details**
382
+ *
383
+ * `attempt` is the cumulative 1-based attempt number across all steps and
384
+ * matches `CurrentMetadata.attempt` for the same attempt. `stepAttempt` is the
385
+ * 1-based attempt number within the current step, and `stepIndex` is the
386
+ * 0-based index of the step being attempted.
387
+ *
388
+ * @category models
389
+ * @since 4.0.0
390
+ */
391
+ export interface AttemptStart {
392
+ readonly _tag: "AttemptStart"
393
+ readonly attempt: number
394
+ readonly stepAttempt: number
395
+ readonly stepIndex: number
396
+ }
397
+
398
+ /**
399
+ * Lifecycle event emitted when an execution-plan attempt succeeds.
400
+ *
401
+ * **Details**
402
+ *
403
+ * A successful attempt completes the plan, so this is always the final event.
404
+ * `duration` is the elapsed time of the attempt.
405
+ *
406
+ * @category models
407
+ * @since 4.0.0
408
+ */
409
+ export interface AttemptSuccess {
410
+ readonly _tag: "AttemptSuccess"
411
+ readonly attempt: number
412
+ readonly stepAttempt: number
413
+ readonly stepIndex: number
414
+ readonly duration: Duration.Duration
415
+ }
416
+
417
+ /**
418
+ * Lifecycle event emitted when an execution-plan attempt fails.
419
+ *
420
+ * **Details**
421
+ *
422
+ * `cause` holds the full failure cause, so defects and interruption are
423
+ * reported as well as expected errors. Whether the plan retries or fails over
424
+ * afterwards is decided by the step's `attempts`, `while`, and `schedule`; a
425
+ * following `AttemptStart` indicates another attempt was made.
426
+ *
427
+ * @category models
428
+ * @since 4.0.0
429
+ */
430
+ export interface AttemptFailure<E> {
431
+ readonly _tag: "AttemptFailure"
432
+ readonly attempt: number
433
+ readonly stepAttempt: number
434
+ readonly stepIndex: number
435
+ readonly duration: Duration.Duration
436
+ readonly cause: Cause.Cause<E>
437
+ }
438
+
439
+ /**
440
+ * Union of the lifecycle events emitted while an execution plan runs.
441
+ *
442
+ * **Details**
443
+ *
444
+ * Every `AttemptStart` is followed by exactly one terminal event, either
445
+ * `AttemptSuccess` or `AttemptFailure`. An interrupted attempt emits
446
+ * `AttemptFailure` with the interruption cause.
447
+ *
448
+ * @category models
449
+ * @since 4.0.0
450
+ */
451
+ export type Event<E> = AttemptStart | AttemptSuccess | AttemptFailure<E>
package/src/FiberSet.ts CHANGED
@@ -100,7 +100,7 @@ const Proto = {
100
100
  ...PipeInspectableProto,
101
101
  toJSON(this: FiberSet<unknown, unknown>) {
102
102
  return {
103
- _id: "FiberMap",
103
+ _id: "FiberSet",
104
104
  state: this.state
105
105
  }
106
106
  }
package/src/FileSystem.ts CHANGED
@@ -1010,7 +1010,7 @@ export const isFile = (u: unknown): u is File => hasProperty(u, FileTypeId)
1010
1010
  * const file: FileSystem.File = {
1011
1011
  * [FileSystem.FileTypeId]: FileSystem.FileTypeId,
1012
1012
  * stat: Effect.succeed({ size: FileSystem.Size(5) } as FileSystem.File.Info),
1013
- * seek: () => Effect.void,
1013
+ * seek: () => Effect.succeed(FileSystem.Size(0)),
1014
1014
  * sync: Effect.void,
1015
1015
  * read: (buffer) => Effect.sync(() => {
1016
1016
  * buffer.set([1, 2, 3, 4, 5])
@@ -1040,7 +1040,7 @@ export const isFile = (u: unknown): u is File => hasProperty(u, FileTypeId)
1040
1040
  export interface File {
1041
1041
  readonly [FileTypeId]: typeof FileTypeId
1042
1042
  readonly stat: Effect.Effect<File.Info, PlatformError>
1043
- readonly seek: (offset: SizeInput, from: SeekMode) => Effect.Effect<void>
1043
+ readonly seek: (offset: SizeInput, from: SeekMode) => Effect.Effect<Size>
1044
1044
  readonly sync: Effect.Effect<void, PlatformError>
1045
1045
  readonly read: (buffer: Uint8Array) => Effect.Effect<Size, PlatformError>
1046
1046
  readonly readAlloc: (size: SizeInput) => Effect.Effect<Option.Option<Uint8Array>, PlatformError>
package/src/Function.ts CHANGED
@@ -1493,11 +1493,12 @@ export const SK = <A, B>(_: A, b: B): B => b
1493
1493
  * **Details**
1494
1494
  *
1495
1495
  * Each memoized wrapper owns a private `WeakMap` keyed by object identity.
1496
- * Cached `undefined` results are still returned because the cache is checked
1497
- * with `WeakMap.has`.
1498
1496
  *
1499
1497
  * **Gotchas**
1500
1498
  *
1499
+ * `undefined` is reserved to represent a cache miss and is therefore not
1500
+ * supported as a return value.
1501
+ *
1501
1502
  * Structurally equal objects do not share cache entries. If the same object is
1502
1503
  * mutated after its first call, later calls still return the cached result for
1503
1504
  * that reference.
@@ -1505,12 +1506,11 @@ export const SK = <A, B>(_: A, b: B): B => b
1505
1506
  * @category caching
1506
1507
  * @since 4.0.0
1507
1508
  */
1508
- export function memoize<A extends object, O>(f: (a: A) => O): (ast: A) => O {
1509
+ export function memoize<A extends object, O extends {} | null>(f: (a: A) => O): (ast: A) => O {
1509
1510
  const cache = new WeakMap<object, O>()
1510
1511
  return (a) => {
1511
- if (cache.has(a)) {
1512
- return cache.get(a)!
1513
- }
1512
+ const cached = cache.get(a)
1513
+ if (cached !== undefined) return cached
1514
1514
  const result = f(a)
1515
1515
  cache.set(a, result)
1516
1516
  return result
package/src/Iterable.ts CHANGED
@@ -3276,19 +3276,20 @@ export const flatten = <A>(self: Iterable<Iterable<A>>): Iterable<A> => ({
3276
3276
  const outerIterator = self[Symbol.iterator]()
3277
3277
  let innerIterator: Iterator<A> | undefined
3278
3278
  function next() {
3279
- if (innerIterator === undefined) {
3280
- const next = outerIterator.next()
3281
- if (next.done) {
3282
- return next
3279
+ while (true) {
3280
+ if (innerIterator === undefined) {
3281
+ const next = outerIterator.next()
3282
+ if (next.done) {
3283
+ return next
3284
+ }
3285
+ innerIterator = next.value[Symbol.iterator]()
3286
+ }
3287
+ const result = innerIterator.next()
3288
+ if (!result.done) {
3289
+ return result
3283
3290
  }
3284
- innerIterator = next.value[Symbol.iterator]()
3285
- }
3286
- const result = innerIterator.next()
3287
- if (result.done) {
3288
3291
  innerIterator = undefined
3289
- return next()
3290
3292
  }
3291
- return result
3292
3293
  }
3293
3294
  return { next }
3294
3295
  }
package/src/Layer.ts CHANGED
@@ -447,11 +447,13 @@ class MemoMapImpl implements MemoMap {
447
447
  scope: Scope.Scope,
448
448
  build: (memoMap: MemoMap, scope: Scope.Scope) => Effect<Context.Context<ROut>, E, RIn>
449
449
  ): Effect<Context.Context<ROut>, E, RIn> {
450
- const existing = this.get(layer, scope)
451
- if (existing) {
452
- return existing
453
- }
454
- return memoMapBuild(this, layer, scope, build)
450
+ return internalEffect.suspend(() => {
451
+ const existing = this.get(layer, scope)
452
+ if (existing) {
453
+ return existing
454
+ }
455
+ return memoMapBuild(this, layer, scope, build)
456
+ })
455
457
  }
456
458
  }
457
459