effect 4.0.0-beta.100 → 4.0.0-beta.102

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 (502) hide show
  1. package/dist/Array.d.ts.map +1 -1
  2. package/dist/Array.js +81 -5
  3. package/dist/Array.js.map +1 -1
  4. package/dist/Channel.d.ts.map +1 -1
  5. package/dist/Channel.js +27 -9
  6. package/dist/Channel.js.map +1 -1
  7. package/dist/Config.d.ts +1 -1
  8. package/dist/Config.d.ts.map +1 -1
  9. package/dist/Config.js +6 -5
  10. package/dist/Config.js.map +1 -1
  11. package/dist/ConfigProvider.js +7 -7
  12. package/dist/ConfigProvider.js.map +1 -1
  13. package/dist/Data.d.ts.map +1 -1
  14. package/dist/Data.js +2 -1
  15. package/dist/Data.js.map +1 -1
  16. package/dist/Effect.d.ts +61 -100
  17. package/dist/Effect.d.ts.map +1 -1
  18. package/dist/Effect.js +66 -39
  19. package/dist/Effect.js.map +1 -1
  20. package/dist/FiberHandle.d.ts.map +1 -1
  21. package/dist/FiberHandle.js +3 -2
  22. package/dist/FiberHandle.js.map +1 -1
  23. package/dist/Iterable.d.ts.map +1 -1
  24. package/dist/Iterable.js +2 -1
  25. package/dist/Iterable.js.map +1 -1
  26. package/dist/JsonPatch.d.ts.map +1 -1
  27. package/dist/JsonPatch.js +4 -3
  28. package/dist/JsonPatch.js.map +1 -1
  29. package/dist/JsonSchema.d.ts.map +1 -1
  30. package/dist/JsonSchema.js +9 -11
  31. package/dist/JsonSchema.js.map +1 -1
  32. package/dist/Logger.d.ts.map +1 -1
  33. package/dist/Logger.js +3 -2
  34. package/dist/Logger.js.map +1 -1
  35. package/dist/ManagedRuntime.d.ts +9 -0
  36. package/dist/ManagedRuntime.d.ts.map +1 -1
  37. package/dist/ManagedRuntime.js +3 -0
  38. package/dist/ManagedRuntime.js.map +1 -1
  39. package/dist/Metric.d.ts.map +1 -1
  40. package/dist/Metric.js +4 -3
  41. package/dist/Metric.js.map +1 -1
  42. package/dist/MutableList.d.ts.map +1 -1
  43. package/dist/MutableList.js +4 -0
  44. package/dist/MutableList.js.map +1 -1
  45. package/dist/Optic.d.ts.map +1 -1
  46. package/dist/Optic.js +5 -4
  47. package/dist/Optic.js.map +1 -1
  48. package/dist/Option.d.ts.map +1 -1
  49. package/dist/Option.js +2 -1
  50. package/dist/Option.js.map +1 -1
  51. package/dist/PartitionedSemaphore.d.ts.map +1 -1
  52. package/dist/PartitionedSemaphore.js +1 -4
  53. package/dist/PartitionedSemaphore.js.map +1 -1
  54. package/dist/Record.d.ts +93 -1
  55. package/dist/Record.d.ts.map +1 -1
  56. package/dist/Record.js +57 -19
  57. package/dist/Record.js.map +1 -1
  58. package/dist/References.d.ts +0 -45
  59. package/dist/References.d.ts.map +1 -1
  60. package/dist/References.js +0 -45
  61. package/dist/References.js.map +1 -1
  62. package/dist/Request.d.ts.map +1 -1
  63. package/dist/Request.js +9 -6
  64. package/dist/Request.js.map +1 -1
  65. package/dist/Result.d.ts.map +1 -1
  66. package/dist/Result.js +2 -1
  67. package/dist/Result.js.map +1 -1
  68. package/dist/Schema.d.ts +1269 -496
  69. package/dist/Schema.d.ts.map +1 -1
  70. package/dist/Schema.js +2308 -614
  71. package/dist/Schema.js.map +1 -1
  72. package/dist/SchemaAST.d.ts +2 -2
  73. package/dist/SchemaAST.d.ts.map +1 -1
  74. package/dist/SchemaAST.js +189 -130
  75. package/dist/SchemaAST.js.map +1 -1
  76. package/dist/SchemaError.js +1 -1
  77. package/dist/SchemaError.js.map +1 -1
  78. package/dist/SchemaGetter.d.ts +13 -11
  79. package/dist/SchemaGetter.d.ts.map +1 -1
  80. package/dist/SchemaGetter.js +34 -24
  81. package/dist/SchemaGetter.js.map +1 -1
  82. package/dist/SchemaIssue.js +1 -1
  83. package/dist/SchemaIssue.js.map +1 -1
  84. package/dist/SchemaParser.d.ts.map +1 -1
  85. package/dist/SchemaParser.js +1 -12
  86. package/dist/SchemaParser.js.map +1 -1
  87. package/dist/SchemaRepresentation.d.ts +403 -1504
  88. package/dist/SchemaRepresentation.d.ts.map +1 -1
  89. package/dist/SchemaRepresentation.js +294 -2852
  90. package/dist/SchemaRepresentation.js.map +1 -1
  91. package/dist/SchemaTransformation.d.ts +2 -2
  92. package/dist/SchemaTransformation.js +3 -3
  93. package/dist/SchemaTransformation.js.map +1 -1
  94. package/dist/Semaphore.d.ts +5 -3
  95. package/dist/Semaphore.d.ts.map +1 -1
  96. package/dist/Semaphore.js.map +1 -1
  97. package/dist/Stream.d.ts +15 -9
  98. package/dist/Stream.d.ts.map +1 -1
  99. package/dist/Stream.js +46 -16
  100. package/dist/Stream.js.map +1 -1
  101. package/dist/Struct.d.ts.map +1 -1
  102. package/dist/Struct.js +5 -4
  103. package/dist/Struct.js.map +1 -1
  104. package/dist/Types.d.ts +1 -3
  105. package/dist/Types.d.ts.map +1 -1
  106. package/dist/index.d.ts +0 -4
  107. package/dist/index.d.ts.map +1 -1
  108. package/dist/index.js +0 -4
  109. package/dist/index.js.map +1 -1
  110. package/dist/internal/core.js +3 -2
  111. package/dist/internal/core.js.map +1 -1
  112. package/dist/internal/effect.js +119 -53
  113. package/dist/internal/effect.js.map +1 -1
  114. package/dist/internal/matcher.js +1 -1
  115. package/dist/internal/matcher.js.map +1 -1
  116. package/dist/internal/record.d.ts +0 -3
  117. package/dist/internal/record.d.ts.map +1 -1
  118. package/dist/internal/record.js +10 -5
  119. package/dist/internal/record.js.map +1 -1
  120. package/dist/internal/references.js +0 -4
  121. package/dist/internal/references.js.map +1 -1
  122. package/dist/internal/schema/annotations.js +12 -0
  123. package/dist/internal/schema/annotations.js.map +1 -1
  124. package/dist/internal/schema/fromJsonSchemaDocument.d.ts +2 -0
  125. package/dist/internal/schema/fromJsonSchemaDocument.d.ts.map +1 -0
  126. package/dist/internal/schema/fromJsonSchemaDocument.js +743 -0
  127. package/dist/internal/schema/fromJsonSchemaDocument.js.map +1 -0
  128. package/dist/internal/schema/fromRepresentation.d.ts +2 -0
  129. package/dist/internal/schema/fromRepresentation.d.ts.map +1 -0
  130. package/dist/internal/schema/fromRepresentation.js +252 -0
  131. package/dist/internal/schema/fromRepresentation.js.map +1 -0
  132. package/dist/internal/schema/schema.js +28 -40
  133. package/dist/internal/schema/schema.js.map +1 -1
  134. package/dist/internal/schema/{arbitrary.d.ts → toArbitrary.d.ts} +1 -1
  135. package/dist/internal/schema/toArbitrary.d.ts.map +1 -0
  136. package/dist/internal/schema/{arbitrary.js → toArbitrary.js} +8 -9
  137. package/dist/internal/schema/toArbitrary.js.map +1 -0
  138. package/dist/internal/schema/toCodeDocument.d.ts +2 -0
  139. package/dist/internal/schema/toCodeDocument.d.ts.map +1 -0
  140. package/dist/internal/schema/toCodeDocument.js +438 -0
  141. package/dist/internal/schema/toCodeDocument.js.map +1 -0
  142. package/dist/internal/schema/toEquivalence.d.ts +2 -0
  143. package/dist/internal/schema/toEquivalence.d.ts.map +1 -0
  144. package/dist/internal/schema/{equivalence.js → toEquivalence.js} +15 -13
  145. package/dist/internal/schema/toEquivalence.js.map +1 -0
  146. package/dist/internal/schema/toJsonSchemaDocument.d.ts +2 -0
  147. package/dist/internal/schema/toJsonSchemaDocument.d.ts.map +1 -0
  148. package/dist/internal/schema/toJsonSchemaDocument.js +466 -0
  149. package/dist/internal/schema/toJsonSchemaDocument.js.map +1 -0
  150. package/dist/internal/schema/toRepresentation.d.ts +2 -0
  151. package/dist/internal/schema/toRepresentation.d.ts.map +1 -0
  152. package/dist/internal/schema/toRepresentation.js +369 -0
  153. package/dist/internal/schema/toRepresentation.js.map +1 -0
  154. package/dist/internal/stackTraceLimit.js +3 -6
  155. package/dist/internal/stackTraceLimit.js.map +1 -1
  156. package/dist/testing/TestClock.js +4 -1
  157. package/dist/testing/TestClock.js.map +1 -1
  158. package/dist/unstable/ai/AiError.d.ts +26 -26
  159. package/dist/unstable/ai/AiError.d.ts.map +1 -1
  160. package/dist/unstable/ai/AiError.js +5 -4
  161. package/dist/unstable/ai/AiError.js.map +1 -1
  162. package/dist/unstable/ai/AnthropicStructuredOutput.d.ts +21 -6
  163. package/dist/unstable/ai/AnthropicStructuredOutput.d.ts.map +1 -1
  164. package/dist/unstable/ai/AnthropicStructuredOutput.js +86 -316
  165. package/dist/unstable/ai/AnthropicStructuredOutput.js.map +1 -1
  166. package/dist/unstable/ai/EmbeddingModel.d.ts +1 -1
  167. package/dist/unstable/ai/EmbeddingModel.js +1 -1
  168. package/dist/unstable/ai/EmbeddingModel.js.map +1 -1
  169. package/dist/unstable/ai/LanguageModel.d.ts +4 -1
  170. package/dist/unstable/ai/LanguageModel.d.ts.map +1 -1
  171. package/dist/unstable/ai/LanguageModel.js +19 -17
  172. package/dist/unstable/ai/LanguageModel.js.map +1 -1
  173. package/dist/unstable/ai/McpSchema.d.ts +197 -197
  174. package/dist/unstable/ai/McpSchema.d.ts.map +1 -1
  175. package/dist/unstable/ai/McpSchema.js +13 -13
  176. package/dist/unstable/ai/McpSchema.js.map +1 -1
  177. package/dist/unstable/ai/McpServer.d.ts +4 -4
  178. package/dist/unstable/ai/McpServer.d.ts.map +1 -1
  179. package/dist/unstable/ai/McpServer.js +116 -49
  180. package/dist/unstable/ai/McpServer.js.map +1 -1
  181. package/dist/unstable/ai/OpenAiStructuredOutput.d.ts +32 -10
  182. package/dist/unstable/ai/OpenAiStructuredOutput.d.ts.map +1 -1
  183. package/dist/unstable/ai/OpenAiStructuredOutput.js +193 -377
  184. package/dist/unstable/ai/OpenAiStructuredOutput.js.map +1 -1
  185. package/dist/unstable/ai/Response.d.ts +19 -19
  186. package/dist/unstable/ai/Response.d.ts.map +1 -1
  187. package/dist/unstable/ai/Response.js +14 -14
  188. package/dist/unstable/ai/Response.js.map +1 -1
  189. package/dist/unstable/ai/Tool.d.ts +4 -0
  190. package/dist/unstable/ai/Tool.d.ts.map +1 -1
  191. package/dist/unstable/ai/Tool.js +11 -3
  192. package/dist/unstable/ai/Tool.js.map +1 -1
  193. package/dist/unstable/ai/Toolkit.d.ts +9 -1
  194. package/dist/unstable/ai/Toolkit.d.ts.map +1 -1
  195. package/dist/unstable/ai/Toolkit.js +14 -10
  196. package/dist/unstable/ai/Toolkit.js.map +1 -1
  197. package/dist/unstable/ai/internal/codec-transformer.js +15 -12
  198. package/dist/unstable/ai/internal/codec-transformer.js.map +1 -1
  199. package/dist/unstable/ai/internal/structured-output.d.ts +2 -0
  200. package/dist/unstable/ai/internal/structured-output.d.ts.map +1 -0
  201. package/dist/unstable/ai/internal/structured-output.js +316 -0
  202. package/dist/unstable/ai/internal/structured-output.js.map +1 -0
  203. package/dist/unstable/cli/CliError.d.ts +40 -2
  204. package/dist/unstable/cli/CliError.d.ts.map +1 -1
  205. package/dist/unstable/cli/CliError.js +45 -6
  206. package/dist/unstable/cli/CliError.js.map +1 -1
  207. package/dist/unstable/cli/Command.js +14 -5
  208. package/dist/unstable/cli/Command.js.map +1 -1
  209. package/dist/unstable/cli/Param.js +3 -3
  210. package/dist/unstable/cli/Param.js.map +1 -1
  211. package/dist/unstable/cli/Primitive.js +1 -1
  212. package/dist/unstable/cli/Primitive.js.map +1 -1
  213. package/dist/unstable/cli/internal/command.d.ts +3 -1
  214. package/dist/unstable/cli/internal/command.d.ts.map +1 -1
  215. package/dist/unstable/cli/internal/command.js +11 -4
  216. package/dist/unstable/cli/internal/command.js.map +1 -1
  217. package/dist/unstable/cli/internal/config.d.ts +0 -48
  218. package/dist/unstable/cli/internal/config.d.ts.map +1 -1
  219. package/dist/unstable/cli/internal/config.js +8 -10
  220. package/dist/unstable/cli/internal/config.js.map +1 -1
  221. package/dist/unstable/cluster/ClusterWorkflowEngine.js +1 -1
  222. package/dist/unstable/cluster/ClusterWorkflowEngine.js.map +1 -1
  223. package/dist/unstable/cluster/Entity.js +1 -1
  224. package/dist/unstable/cluster/Entity.js.map +1 -1
  225. package/dist/unstable/cluster/Envelope.d.ts.map +1 -1
  226. package/dist/unstable/cluster/Envelope.js +2 -1
  227. package/dist/unstable/cluster/Envelope.js.map +1 -1
  228. package/dist/unstable/cluster/Reply.js +1 -1
  229. package/dist/unstable/cluster/Reply.js.map +1 -1
  230. package/dist/unstable/cluster/Runner.d.ts +1 -1
  231. package/dist/unstable/cluster/Runner.js +1 -1
  232. package/dist/unstable/cluster/Runner.js.map +1 -1
  233. package/dist/unstable/cluster/RunnerAddress.d.ts +1 -1
  234. package/dist/unstable/cluster/RunnerAddress.js +1 -1
  235. package/dist/unstable/cluster/RunnerAddress.js.map +1 -1
  236. package/dist/unstable/cluster/ShardId.js +1 -1
  237. package/dist/unstable/cluster/ShardId.js.map +1 -1
  238. package/dist/unstable/cluster/Sharding.d.ts.map +1 -1
  239. package/dist/unstable/cluster/Sharding.js +125 -24
  240. package/dist/unstable/cluster/Sharding.js.map +1 -1
  241. package/dist/unstable/cluster/ShardingConfig.d.ts +10 -2
  242. package/dist/unstable/cluster/ShardingConfig.d.ts.map +1 -1
  243. package/dist/unstable/cluster/ShardingConfig.js.map +1 -1
  244. package/dist/unstable/cluster/SingleRunner.d.ts +4 -2
  245. package/dist/unstable/cluster/SingleRunner.d.ts.map +1 -1
  246. package/dist/unstable/cluster/SingleRunner.js +2 -1
  247. package/dist/unstable/cluster/SingleRunner.js.map +1 -1
  248. package/dist/unstable/cluster/SqlMessageStorage.d.ts +7 -4
  249. package/dist/unstable/cluster/SqlMessageStorage.d.ts.map +1 -1
  250. package/dist/unstable/cluster/SqlMessageStorage.js +55 -24
  251. package/dist/unstable/cluster/SqlMessageStorage.js.map +1 -1
  252. package/dist/unstable/cluster/SqlRunnerStorage.d.ts.map +1 -1
  253. package/dist/unstable/cluster/SqlRunnerStorage.js +109 -62
  254. package/dist/unstable/cluster/SqlRunnerStorage.js.map +1 -1
  255. package/dist/unstable/cluster/internal/entityManager.js +19 -7
  256. package/dist/unstable/cluster/internal/entityManager.js.map +1 -1
  257. package/dist/unstable/cluster/internal/shardLock.d.ts +2 -0
  258. package/dist/unstable/cluster/internal/shardLock.d.ts.map +1 -0
  259. package/dist/unstable/cluster/internal/shardLock.js +4 -0
  260. package/dist/unstable/cluster/internal/shardLock.js.map +1 -0
  261. package/dist/unstable/devtools/DevToolsSchema.d.ts +20 -20
  262. package/dist/unstable/devtools/DevToolsSchema.d.ts.map +1 -1
  263. package/dist/unstable/devtools/DevToolsSchema.js +8 -5
  264. package/dist/unstable/devtools/DevToolsSchema.js.map +1 -1
  265. package/dist/unstable/eventlog/EventJournal.d.ts +1 -1
  266. package/dist/unstable/eventlog/EventJournal.js +1 -1
  267. package/dist/unstable/eventlog/EventJournal.js.map +1 -1
  268. package/dist/unstable/eventlog/EventLog.d.ts.map +1 -1
  269. package/dist/unstable/eventlog/EventLog.js +15 -11
  270. package/dist/unstable/eventlog/EventLog.js.map +1 -1
  271. package/dist/unstable/eventlog/EventLogEncryption.d.ts +1 -1
  272. package/dist/unstable/eventlog/EventLogEncryption.js +1 -1
  273. package/dist/unstable/eventlog/EventLogEncryption.js.map +1 -1
  274. package/dist/unstable/eventlog/EventLogMessage.d.ts +26 -26
  275. package/dist/unstable/eventlog/EventLogMessage.d.ts.map +1 -1
  276. package/dist/unstable/eventlog/EventLogMessage.js +8 -3
  277. package/dist/unstable/eventlog/EventLogMessage.js.map +1 -1
  278. package/dist/unstable/eventlog/EventLogRemote.d.ts +1 -1
  279. package/dist/unstable/eventlog/SqlEventJournal.js +2 -2
  280. package/dist/unstable/eventlog/SqlEventJournal.js.map +1 -1
  281. package/dist/unstable/eventlog/SqlEventLogServerEncrypted.js +1 -1
  282. package/dist/unstable/eventlog/SqlEventLogServerEncrypted.js.map +1 -1
  283. package/dist/unstable/eventlog/SqlEventLogServerUnencrypted.js +3 -3
  284. package/dist/unstable/eventlog/SqlEventLogServerUnencrypted.js.map +1 -1
  285. package/dist/unstable/http/Cookies.d.ts.map +1 -1
  286. package/dist/unstable/http/Cookies.js +24 -22
  287. package/dist/unstable/http/Cookies.js.map +1 -1
  288. package/dist/unstable/http/Headers.js +8 -8
  289. package/dist/unstable/http/Headers.js.map +1 -1
  290. package/dist/unstable/http/HttpClientRequest.d.ts +44 -0
  291. package/dist/unstable/http/HttpClientRequest.d.ts.map +1 -1
  292. package/dist/unstable/http/HttpClientRequest.js +14 -0
  293. package/dist/unstable/http/HttpClientRequest.js.map +1 -1
  294. package/dist/unstable/http/HttpRouter.d.ts +2 -2
  295. package/dist/unstable/http/HttpRouter.d.ts.map +1 -1
  296. package/dist/unstable/http/HttpRouter.js.map +1 -1
  297. package/dist/unstable/http/HttpServerRequest.d.ts.map +1 -1
  298. package/dist/unstable/http/HttpServerRequest.js +5 -4
  299. package/dist/unstable/http/HttpServerRequest.js.map +1 -1
  300. package/dist/unstable/http/Multipart.d.ts.map +1 -1
  301. package/dist/unstable/http/Multipart.js +17 -15
  302. package/dist/unstable/http/Multipart.js.map +1 -1
  303. package/dist/unstable/http/Template.js +1 -1
  304. package/dist/unstable/http/Template.js.map +1 -1
  305. package/dist/unstable/http/UrlParams.d.ts.map +1 -1
  306. package/dist/unstable/http/UrlParams.js +17 -14
  307. package/dist/unstable/http/UrlParams.js.map +1 -1
  308. package/dist/unstable/httpapi/HttpApi.js +3 -3
  309. package/dist/unstable/httpapi/HttpApi.js.map +1 -1
  310. package/dist/unstable/httpapi/HttpApiClient.js +5 -5
  311. package/dist/unstable/httpapi/HttpApiClient.js.map +1 -1
  312. package/dist/unstable/httpapi/HttpApiGroup.js +1 -1
  313. package/dist/unstable/httpapi/HttpApiGroup.js.map +1 -1
  314. package/dist/unstable/httpapi/OpenApi.d.ts.map +1 -1
  315. package/dist/unstable/httpapi/OpenApi.js +37 -24
  316. package/dist/unstable/httpapi/OpenApi.js.map +1 -1
  317. package/dist/unstable/observability/OtlpExporter.d.ts +72 -1
  318. package/dist/unstable/observability/OtlpExporter.d.ts.map +1 -1
  319. package/dist/unstable/observability/OtlpExporter.js +69 -4
  320. package/dist/unstable/observability/OtlpExporter.js.map +1 -1
  321. package/dist/unstable/observability/OtlpLogger.d.ts +4 -3
  322. package/dist/unstable/observability/OtlpLogger.d.ts.map +1 -1
  323. package/dist/unstable/observability/OtlpLogger.js +2 -2
  324. package/dist/unstable/observability/OtlpLogger.js.map +1 -1
  325. package/dist/unstable/observability/OtlpMetrics.d.ts +7 -3
  326. package/dist/unstable/observability/OtlpMetrics.d.ts.map +1 -1
  327. package/dist/unstable/observability/OtlpMetrics.js +5 -2
  328. package/dist/unstable/observability/OtlpMetrics.js.map +1 -1
  329. package/dist/unstable/observability/OtlpTracer.d.ts +4 -3
  330. package/dist/unstable/observability/OtlpTracer.d.ts.map +1 -1
  331. package/dist/unstable/observability/OtlpTracer.js +2 -2
  332. package/dist/unstable/observability/OtlpTracer.js.map +1 -1
  333. package/dist/unstable/persistence/Persistable.d.ts.map +1 -1
  334. package/dist/unstable/persistence/Persistable.js +2 -1
  335. package/dist/unstable/persistence/Persistable.js.map +1 -1
  336. package/dist/unstable/persistence/RateLimiter.d.ts +2 -2
  337. package/dist/unstable/persistence/RateLimiter.js +2 -2
  338. package/dist/unstable/persistence/RateLimiter.js.map +1 -1
  339. package/dist/unstable/persistence/Redis.d.ts.map +1 -1
  340. package/dist/unstable/persistence/Redis.js +2 -2
  341. package/dist/unstable/persistence/Redis.js.map +1 -1
  342. package/dist/unstable/process/ChildProcessSpawner.js +3 -1
  343. package/dist/unstable/process/ChildProcessSpawner.js.map +1 -1
  344. package/dist/unstable/reactivity/AsyncResult.d.ts.map +1 -1
  345. package/dist/unstable/reactivity/AsyncResult.js +4 -3
  346. package/dist/unstable/reactivity/AsyncResult.js.map +1 -1
  347. package/dist/unstable/reactivity/Atom.d.ts +83 -0
  348. package/dist/unstable/reactivity/Atom.d.ts.map +1 -1
  349. package/dist/unstable/reactivity/Atom.js +31 -0
  350. package/dist/unstable/reactivity/Atom.js.map +1 -1
  351. package/dist/unstable/reactivity/AtomRegistry.js +1 -1
  352. package/dist/unstable/reactivity/AtomRegistry.js.map +1 -1
  353. package/dist/unstable/rpc/RpcClient.d.ts.map +1 -1
  354. package/dist/unstable/rpc/RpcClient.js +2 -1
  355. package/dist/unstable/rpc/RpcClient.js.map +1 -1
  356. package/dist/unstable/schema/VariantSchema.d.ts +1 -2
  357. package/dist/unstable/schema/VariantSchema.d.ts.map +1 -1
  358. package/dist/unstable/schema/VariantSchema.js +13 -10
  359. package/dist/unstable/schema/VariantSchema.js.map +1 -1
  360. package/dist/unstable/socket/Socket.d.ts +1 -1
  361. package/dist/unstable/socket/Socket.js +1 -1
  362. package/dist/unstable/socket/Socket.js.map +1 -1
  363. package/dist/unstable/sql/SqlError.d.ts +2 -2
  364. package/dist/unstable/sql/SqlError.js +2 -2
  365. package/dist/unstable/sql/SqlError.js.map +1 -1
  366. package/dist/unstable/sql/Statement.d.ts.map +1 -1
  367. package/dist/unstable/sql/Statement.js +7 -6
  368. package/dist/unstable/sql/Statement.js.map +1 -1
  369. package/package.json +1 -1
  370. package/src/Array.ts +86 -25
  371. package/src/Channel.ts +32 -14
  372. package/src/Config.ts +6 -5
  373. package/src/ConfigProvider.ts +7 -7
  374. package/src/Data.ts +3 -2
  375. package/src/Effect.ts +70 -116
  376. package/src/FiberHandle.ts +3 -2
  377. package/src/Iterable.ts +2 -1
  378. package/src/JsonPatch.ts +4 -3
  379. package/src/JsonSchema.ts +9 -11
  380. package/src/Logger.ts +3 -2
  381. package/src/ManagedRuntime.ts +13 -0
  382. package/src/Metric.ts +4 -3
  383. package/src/MutableList.ts +4 -0
  384. package/src/Optic.ts +5 -4
  385. package/src/Option.ts +2 -1
  386. package/src/PartitionedSemaphore.ts +1 -4
  387. package/src/Record.ts +119 -22
  388. package/src/References.ts +0 -46
  389. package/src/Request.ts +5 -7
  390. package/src/Result.ts +2 -1
  391. package/src/Schema.ts +2538 -987
  392. package/src/SchemaAST.ts +228 -149
  393. package/src/SchemaError.ts +1 -1
  394. package/src/SchemaGetter.ts +36 -29
  395. package/src/SchemaIssue.ts +1 -1
  396. package/src/SchemaParser.ts +1 -25
  397. package/src/SchemaRepresentation.ts +697 -3398
  398. package/src/SchemaTransformation.ts +3 -3
  399. package/src/Semaphore.ts +5 -3
  400. package/src/Stream.ts +63 -19
  401. package/src/Struct.ts +5 -4
  402. package/src/Types.ts +1 -3
  403. package/src/index.ts +0 -5
  404. package/src/internal/core.ts +4 -3
  405. package/src/internal/effect.ts +132 -70
  406. package/src/internal/matcher.ts +1 -1
  407. package/src/internal/record.ts +11 -7
  408. package/src/internal/references.ts +0 -5
  409. package/src/internal/schema/annotations.ts +44 -0
  410. package/src/internal/schema/fromJsonSchemaDocument.ts +957 -0
  411. package/src/internal/schema/fromRepresentation.ts +345 -0
  412. package/src/internal/schema/schema.ts +45 -46
  413. package/src/internal/schema/{arbitrary.ts → toArbitrary.ts} +8 -10
  414. package/src/internal/schema/toCodeDocument.ts +572 -0
  415. package/src/internal/schema/{equivalence.ts → toEquivalence.ts} +12 -7
  416. package/src/internal/schema/toJsonSchemaDocument.ts +475 -0
  417. package/src/internal/schema/toRepresentation.ts +401 -0
  418. package/src/internal/stackTraceLimit.ts +3 -7
  419. package/src/testing/TestClock.ts +1 -1
  420. package/src/unstable/ai/AiError.ts +5 -4
  421. package/src/unstable/ai/AnthropicStructuredOutput.ts +102 -333
  422. package/src/unstable/ai/EmbeddingModel.ts +1 -1
  423. package/src/unstable/ai/LanguageModel.ts +30 -28
  424. package/src/unstable/ai/McpSchema.ts +15 -15
  425. package/src/unstable/ai/McpServer.ts +172 -56
  426. package/src/unstable/ai/OpenAiStructuredOutput.ts +230 -395
  427. package/src/unstable/ai/Response.ts +24 -24
  428. package/src/unstable/ai/Tool.ts +22 -4
  429. package/src/unstable/ai/Toolkit.ts +19 -7
  430. package/src/unstable/ai/internal/codec-transformer.ts +13 -7
  431. package/src/unstable/ai/internal/structured-output.ts +458 -0
  432. package/src/unstable/cli/CliError.ts +51 -5
  433. package/src/unstable/cli/Command.ts +4 -4
  434. package/src/unstable/cli/Param.ts +3 -3
  435. package/src/unstable/cli/Primitive.ts +1 -1
  436. package/src/unstable/cli/internal/command.ts +13 -5
  437. package/src/unstable/cli/internal/config.ts +8 -10
  438. package/src/unstable/cluster/ClusterWorkflowEngine.ts +3 -3
  439. package/src/unstable/cluster/Entity.ts +1 -1
  440. package/src/unstable/cluster/Envelope.ts +2 -1
  441. package/src/unstable/cluster/Reply.ts +1 -1
  442. package/src/unstable/cluster/Runner.ts +1 -1
  443. package/src/unstable/cluster/RunnerAddress.ts +1 -1
  444. package/src/unstable/cluster/ShardId.ts +1 -1
  445. package/src/unstable/cluster/Sharding.ts +161 -34
  446. package/src/unstable/cluster/ShardingConfig.ts +5 -1
  447. package/src/unstable/cluster/SingleRunner.ts +4 -2
  448. package/src/unstable/cluster/SqlMessageStorage.ts +83 -35
  449. package/src/unstable/cluster/SqlRunnerStorage.ts +186 -116
  450. package/src/unstable/cluster/internal/entityManager.ts +31 -10
  451. package/src/unstable/cluster/internal/shardLock.ts +9 -0
  452. package/src/unstable/devtools/DevToolsSchema.ts +10 -5
  453. package/src/unstable/eventlog/EventJournal.ts +1 -1
  454. package/src/unstable/eventlog/EventLog.ts +21 -11
  455. package/src/unstable/eventlog/EventLogEncryption.ts +1 -1
  456. package/src/unstable/eventlog/EventLogMessage.ts +10 -3
  457. package/src/unstable/eventlog/SqlEventJournal.ts +2 -2
  458. package/src/unstable/eventlog/SqlEventLogServerEncrypted.ts +1 -1
  459. package/src/unstable/eventlog/SqlEventLogServerUnencrypted.ts +6 -3
  460. package/src/unstable/http/Cookies.ts +29 -24
  461. package/src/unstable/http/Headers.ts +8 -8
  462. package/src/unstable/http/HttpClientRequest.ts +57 -0
  463. package/src/unstable/http/HttpRouter.ts +6 -3
  464. package/src/unstable/http/HttpServerRequest.ts +5 -4
  465. package/src/unstable/http/Multipart.ts +16 -13
  466. package/src/unstable/http/Template.ts +1 -1
  467. package/src/unstable/http/UrlParams.ts +17 -14
  468. package/src/unstable/httpapi/HttpApi.ts +3 -3
  469. package/src/unstable/httpapi/HttpApiClient.ts +5 -5
  470. package/src/unstable/httpapi/HttpApiGroup.ts +1 -1
  471. package/src/unstable/httpapi/OpenApi.ts +52 -28
  472. package/src/unstable/observability/OtlpExporter.ts +109 -5
  473. package/src/unstable/observability/OtlpLogger.ts +5 -5
  474. package/src/unstable/observability/OtlpMetrics.ts +8 -4
  475. package/src/unstable/observability/OtlpTracer.ts +8 -4
  476. package/src/unstable/persistence/Persistable.ts +3 -2
  477. package/src/unstable/persistence/RateLimiter.ts +2 -2
  478. package/src/unstable/persistence/Redis.ts +2 -2
  479. package/src/unstable/process/ChildProcessSpawner.ts +1 -1
  480. package/src/unstable/reactivity/AsyncResult.ts +4 -3
  481. package/src/unstable/reactivity/Atom.ts +92 -0
  482. package/src/unstable/reactivity/AtomRegistry.ts +1 -1
  483. package/src/unstable/rpc/RpcClient.ts +2 -1
  484. package/src/unstable/schema/VariantSchema.ts +14 -24
  485. package/src/unstable/socket/Socket.ts +1 -1
  486. package/src/unstable/sql/SqlError.ts +2 -2
  487. package/src/unstable/sql/Statement.ts +7 -6
  488. package/dist/SchemaUtils.d.ts +0 -28
  489. package/dist/SchemaUtils.d.ts.map +0 -1
  490. package/dist/SchemaUtils.js +0 -45
  491. package/dist/SchemaUtils.js.map +0 -1
  492. package/dist/internal/schema/arbitrary.d.ts.map +0 -1
  493. package/dist/internal/schema/arbitrary.js.map +0 -1
  494. package/dist/internal/schema/equivalence.d.ts +0 -2
  495. package/dist/internal/schema/equivalence.d.ts.map +0 -1
  496. package/dist/internal/schema/equivalence.js.map +0 -1
  497. package/dist/internal/schema/representation.d.ts +0 -2
  498. package/dist/internal/schema/representation.d.ts.map +0 -1
  499. package/dist/internal/schema/representation.js +0 -865
  500. package/dist/internal/schema/representation.js.map +0 -1
  501. package/src/SchemaUtils.ts +0 -51
  502. package/src/internal/schema/representation.ts +0 -795
package/src/Data.ts CHANGED
@@ -10,6 +10,7 @@
10
10
  */
11
11
  import type * as Cause from "./Cause.ts"
12
12
  import * as core from "./internal/core.ts"
13
+ import * as InternalRecord from "./internal/record.ts"
13
14
  import * as Pipeable from "./Pipeable.ts"
14
15
  import * as Predicate from "./Predicate.ts"
15
16
  import type * as Types from "./Types.ts"
@@ -51,10 +52,10 @@ import type { Unify } from "./Unify.ts"
51
52
  export const Class: new<A extends Record<string, any> = {}>(
52
53
  args: Types.VoidIfEmpty<{ readonly [P in keyof A]: A[P] }>
53
54
  ) => Readonly<A> & Pipeable.Pipeable = class extends Pipeable.Class {
54
- constructor(props: any) {
55
+ constructor(props: object | undefined) {
55
56
  super()
56
57
  if (props) {
57
- Object.assign(this, props)
58
+ InternalRecord.assignProperties(this, props)
58
59
  }
59
60
  }
60
61
  } as any
package/src/Effect.ts CHANGED
@@ -26,6 +26,7 @@ import * as core from "./internal/core.ts"
26
26
  import * as internal from "./internal/effect.ts"
27
27
  import * as internalExecutionPlan from "./internal/executionPlan.ts"
28
28
  import * as internalLayer from "./internal/layer.ts"
29
+ import * as InternalRecord from "./internal/record.ts"
29
30
  import * as internalRequest from "./internal/request.ts"
30
31
  import * as internalSchedule from "./internal/schedule.ts"
31
32
  import type * as Layer from "./Layer.ts"
@@ -12319,6 +12320,72 @@ export const updateService: {
12319
12320
  <XA, E, R, I, A>(self: Effect<XA, E, R>, service: Context.Key<I, A>, f: (value: A) => A): Effect<XA, E, R | I>
12320
12321
  } = internal.updateService
12321
12322
 
12323
+ /**
12324
+ * Updates a service for the lifetime of the current scope and restores its
12325
+ * previous value when the scope closes.
12326
+ *
12327
+ * **When to use**
12328
+ *
12329
+ * Use when you need a setup effect to change a service for subsequent effects
12330
+ * in the same scope.
12331
+ *
12332
+ * **Details**
12333
+ *
12334
+ * The updater receives the currently visible service value. A
12335
+ * `Context.Service` remains in the requirements, while a `Context.Reference`
12336
+ * uses its default when no override is present and adds no service requirement.
12337
+ * The returned effect always requires `Scope`. The optional `reset` function
12338
+ * receives the original, updated, and current values when the scope closes,
12339
+ * allowing changes to be merged during restoration. It defaults to returning
12340
+ * the original value.
12341
+ *
12342
+ * **Example** (Updating a reference within a scope)
12343
+ *
12344
+ * ```ts
12345
+ * import { Context, Effect } from "effect"
12346
+ *
12347
+ * const CurrentNumber = Context.Reference<number>("CurrentNumber", {
12348
+ * defaultValue: () => 1
12349
+ * })
12350
+ *
12351
+ * const program = Effect.gen(function*() {
12352
+ * const before = yield* CurrentNumber
12353
+ * const during = yield* Effect.scoped(
12354
+ * Effect.gen(function*() {
12355
+ * yield* Effect.updateServiceScoped(
12356
+ * CurrentNumber,
12357
+ * (value) => value + 1,
12358
+ * {
12359
+ * // Optional: when omitted, the original value is restored
12360
+ * reset: (original, updated, current) =>
12361
+ * Math.max(original, updated, current) + 1
12362
+ * }
12363
+ * )
12364
+ * return yield* CurrentNumber
12365
+ * })
12366
+ * )
12367
+ * const after = yield* CurrentNumber
12368
+ *
12369
+ * console.log([before, during, after])
12370
+ * // [1, 2, 3]
12371
+ * })
12372
+ *
12373
+ * Effect.runPromise(program)
12374
+ * ```
12375
+ *
12376
+ * @see {@link updateService} for updating a service only within a wrapped effect
12377
+ *
12378
+ * @category context
12379
+ * @since 4.0.0
12380
+ */
12381
+ export const updateServiceScoped: <I, A>(
12382
+ service: Context.Key<I, A>,
12383
+ f: (value: A) => A,
12384
+ options?: {
12385
+ readonly reset?: ((original: A, updated: A, current: A) => A) | undefined
12386
+ } | undefined
12387
+ ) => Effect<void, never, I | Scope> = internal.updateServiceScoped
12388
+
12322
12389
  /**
12323
12390
  * Provides one concrete service implementation to an effect.
12324
12391
  *
@@ -12805,119 +12872,6 @@ export const provideServiceEffect: {
12805
12872
  ): Effect<A, E | E2, Exclude<R, I> | R2>
12806
12873
  } = internal.provideServiceEffect
12807
12874
 
12808
- // -----------------------------------------------------------------------------
12809
- // References
12810
- // -----------------------------------------------------------------------------
12811
-
12812
- /**
12813
- * Sets the concurrency level for parallel operations within an effect.
12814
- *
12815
- * **Example** (Setting local concurrency)
12816
- *
12817
- * ```ts
12818
- * import { Console, Effect } from "effect"
12819
- *
12820
- * const task = (id: number) =>
12821
- * Effect.gen(function*() {
12822
- * yield* Console.log(`Task ${id} starting`)
12823
- * yield* Effect.sleep("100 millis")
12824
- * yield* Console.log(`Task ${id} completed`)
12825
- * return id
12826
- * })
12827
- *
12828
- * // Run tasks with limited concurrency (max 2 at a time)
12829
- * const program = Effect.gen(function*() {
12830
- * const tasks = [1, 2, 3, 4, 5].map(task)
12831
- * return yield* Effect.all(tasks, { concurrency: 2 })
12832
- * }).pipe(
12833
- * Effect.withConcurrency(2)
12834
- * )
12835
- *
12836
- * Effect.runPromise(program).then(console.log)
12837
- * // Tasks will run with max 2 concurrent operations
12838
- * // [1, 2, 3, 4, 5]
12839
- * ```
12840
- *
12841
- * @category references
12842
- * @since 2.0.0
12843
- */
12844
- export const withConcurrency: {
12845
- // -----------------------------------------------------------------------------
12846
- // References
12847
- // -----------------------------------------------------------------------------
12848
-
12849
- /**
12850
- * Sets the concurrency level for parallel operations within an effect.
12851
- *
12852
- * **Example** (Setting local concurrency)
12853
- *
12854
- * ```ts
12855
- * import { Console, Effect } from "effect"
12856
- *
12857
- * const task = (id: number) =>
12858
- * Effect.gen(function*() {
12859
- * yield* Console.log(`Task ${id} starting`)
12860
- * yield* Effect.sleep("100 millis")
12861
- * yield* Console.log(`Task ${id} completed`)
12862
- * return id
12863
- * })
12864
- *
12865
- * // Run tasks with limited concurrency (max 2 at a time)
12866
- * const program = Effect.gen(function*() {
12867
- * const tasks = [1, 2, 3, 4, 5].map(task)
12868
- * return yield* Effect.all(tasks, { concurrency: 2 })
12869
- * }).pipe(
12870
- * Effect.withConcurrency(2)
12871
- * )
12872
- *
12873
- * Effect.runPromise(program).then(console.log)
12874
- * // Tasks will run with max 2 concurrent operations
12875
- * // [1, 2, 3, 4, 5]
12876
- * ```
12877
- *
12878
- * @category references
12879
- * @since 2.0.0
12880
- */
12881
- (concurrency: number | "unbounded"): <A, E, R>(self: Effect<A, E, R>) => Effect<A, E, R>
12882
- // -----------------------------------------------------------------------------
12883
- // References
12884
- // -----------------------------------------------------------------------------
12885
-
12886
- /**
12887
- * Sets the concurrency level for parallel operations within an effect.
12888
- *
12889
- * **Example** (Setting local concurrency)
12890
- *
12891
- * ```ts
12892
- * import { Console, Effect } from "effect"
12893
- *
12894
- * const task = (id: number) =>
12895
- * Effect.gen(function*() {
12896
- * yield* Console.log(`Task ${id} starting`)
12897
- * yield* Effect.sleep("100 millis")
12898
- * yield* Console.log(`Task ${id} completed`)
12899
- * return id
12900
- * })
12901
- *
12902
- * // Run tasks with limited concurrency (max 2 at a time)
12903
- * const program = Effect.gen(function*() {
12904
- * const tasks = [1, 2, 3, 4, 5].map(task)
12905
- * return yield* Effect.all(tasks, { concurrency: 2 })
12906
- * }).pipe(
12907
- * Effect.withConcurrency(2)
12908
- * )
12909
- *
12910
- * Effect.runPromise(program).then(console.log)
12911
- * // Tasks will run with max 2 concurrent operations
12912
- * // [1, 2, 3, 4, 5]
12913
- * ```
12914
- *
12915
- * @category references
12916
- * @since 2.0.0
12917
- */
12918
- <A, E, R>(self: Effect<A, E, R>, concurrency: number | "unbounded"): Effect<A, E, R>
12919
- } = internal.withConcurrency
12920
-
12921
12875
  // -----------------------------------------------------------------------------
12922
12876
  // Resource management & finalization
12923
12877
  // -----------------------------------------------------------------------------
@@ -22911,11 +22865,11 @@ export const annotateLogs = dual<
22911
22865
  ...args: [Record<string, unknown>] | [key: string, value: unknown]
22912
22866
  ): Effect<A, E, R> =>
22913
22867
  internal.updateService(effect, CurrentLogAnnotations, (annotations) => {
22914
- const newAnnotations = { ...annotations }
22868
+ const newAnnotations = args.length === 1 ? { ...annotations, ...args[0] } : { ...annotations }
22915
22869
  if (args.length === 1) {
22916
- Object.assign(newAnnotations, args[0])
22870
+ return newAnnotations
22917
22871
  } else {
22918
- newAnnotations[args[0]] = args[1]
22872
+ InternalRecord.assignProperty(newAnnotations, args[0], args[1])
22919
22873
  }
22920
22874
  return newAnnotations
22921
22875
  })
@@ -621,10 +621,11 @@ export const clear = <A, E>(self: FiberHandle<A, E>): Effect.Effect<void> =>
621
621
  if (self.state._tag === "Closed" || self.state.fiber === undefined) {
622
622
  return Effect.void
623
623
  }
624
+ const fiber = self.state.fiber
624
625
  return Effect.andThen(
625
- restore(Fiber.interruptAs(self.state.fiber, internalFiberId)),
626
+ restore(Fiber.interruptAs(fiber, internalFiberId)),
626
627
  Effect.sync(() => {
627
- if (self.state._tag === "Open") {
628
+ if (self.state._tag === "Open" && self.state.fiber === fiber) {
628
629
  self.state.fiber = undefined
629
630
  }
630
631
  })
package/src/Iterable.ts CHANGED
@@ -12,6 +12,7 @@
12
12
  import type { NonEmptyArray } from "./Array.ts"
13
13
  import * as Equal from "./Equal.ts"
14
14
  import { dual } from "./Function.ts"
15
+ import * as InternalRecord from "./internal/record.ts"
15
16
  import type { Option } from "./Option.ts"
16
17
  import * as O from "./Option.ts"
17
18
  import { isBoolean } from "./Predicate.ts"
@@ -3023,7 +3024,7 @@ export const groupBy: {
3023
3024
  if (Object.hasOwn(out, k)) {
3024
3025
  out[k].push(a)
3025
3026
  } else {
3026
- out[k] = [a]
3027
+ InternalRecord.assignProperty(out, k, [a])
3027
3028
  }
3028
3029
  }
3029
3030
  return out
package/src/JsonPatch.ts CHANGED
@@ -8,6 +8,7 @@
8
8
  * @since 4.0.0
9
9
  */
10
10
  import { format } from "./Formatter.ts"
11
+ import * as InternalRecord from "./internal/record.ts"
11
12
  import { escapeToken, unescapeToken } from "./JsonPointer.ts"
12
13
  import * as Predicate from "./Predicate.ts"
13
14
  import type * as Schema from "./Schema.ts"
@@ -358,7 +359,7 @@ function addAt(doc: Schema.Json, pointer: string, val: Schema.Json): Schema.Json
358
359
 
359
360
  if (isJsonObject(parent)) {
360
361
  const updated = { ...parent }
361
- updated[lastToken] = val
362
+ InternalRecord.assignProperty(updated, lastToken, val)
362
363
  return rebuildFromStack(stack, updated)
363
364
  }
364
365
 
@@ -399,7 +400,7 @@ function setAt(
399
400
  }
400
401
  const updated = { ...parent }
401
402
  if (mode === "remove") delete updated[lastToken]
402
- else updated[lastToken] = val!
403
+ else InternalRecord.assignProperty(updated, lastToken, val!)
403
404
  return rebuildFromStack(stack, updated)
404
405
  }
405
406
 
@@ -460,7 +461,7 @@ function rebuildFromStack(stack: ReadonlyArray<StackEntry>, newParent: Schema.Js
460
461
  acc = copy
461
462
  } else {
462
463
  const copy = { ...(container as Schema.JsonObject) }
463
- copy[token as string] = acc
464
+ InternalRecord.assignProperty(copy, token as string, acc)
464
465
  acc = copy
465
466
  }
466
467
  }
package/src/JsonSchema.ts CHANGED
@@ -9,6 +9,7 @@
9
9
  * @since 4.0.0
10
10
  */
11
11
  import * as Arr from "./Array.ts"
12
+ import * as InternalRecord from "./internal/record.ts"
12
13
  import { unescapeToken } from "./JsonPointer.ts"
13
14
  import * as Predicate from "./Predicate.ts"
14
15
  import * as Rec from "./Record.ts"
@@ -745,11 +746,11 @@ function rewrite_refs(node: unknown, f: ($ref: string) => string): unknown {
745
746
  const v = node[k]
746
747
 
747
748
  if (k === "$ref") {
748
- out[k] = typeof v === "string" ? f(v) : v
749
+ InternalRecord.assignProperty(out, k, typeof v === "string" ? f(v) : v)
749
750
  } else if (Array.isArray(v) || Predicate.isObject(v)) {
750
- out[k] = rewrite_refs(v, f)
751
+ InternalRecord.assignProperty(out, k, rewrite_refs(v, f))
751
752
  } else {
752
- out[k] = v
753
+ InternalRecord.assignProperty(out, k, v)
753
754
  }
754
755
  }
755
756
 
@@ -762,7 +763,7 @@ function walk_object(
762
763
  ): Record<string, unknown> | undefined {
763
764
  if (!Predicate.isObject(value)) return undefined
764
765
  const out: Record<string, unknown> = {}
765
- for (const k of Object.keys(value)) out[k] = walk(value[k], false)
766
+ for (const k of Object.keys(value)) InternalRecord.assignProperty(out, k, walk(value[k], false))
766
767
  return out
767
768
  }
768
769
 
@@ -776,15 +777,15 @@ function normalize_OpenApi3_0_to_Draft07(node: unknown): unknown {
776
777
  for (const k of Object.keys(src)) {
777
778
  const v = src[k]
778
779
  if (k === "$ref" && typeof v === "string") {
779
- out[k] = v.replace(RE_COMPONENTS_SCHEMAS, "#/definitions")
780
+ InternalRecord.assignProperty(out, k, v.replace(RE_COMPONENTS_SCHEMAS, "#/definitions"))
780
781
  } else if (k === "example") {
781
782
  if (src.examples === undefined) {
782
783
  out.examples = [v]
783
784
  }
784
785
  } else if (Array.isArray(v) || Predicate.isObject(v)) {
785
- out[k] = normalize_OpenApi3_0_to_Draft07(v)
786
+ InternalRecord.assignProperty(out, k, normalize_OpenApi3_0_to_Draft07(v))
786
787
  } else {
787
- out[k] = v
788
+ InternalRecord.assignProperty(out, k, v)
788
789
  }
789
790
  }
790
791
 
@@ -895,10 +896,7 @@ export function resolve$ref($ref: string, definitions: Definitions): JsonSchema
895
896
  const tokens = $ref.split("/")
896
897
  if (tokens.length > 0) {
897
898
  const identifier = unescapeToken(tokens[tokens.length - 1])
898
- const definition = definitions[identifier]
899
- if (definition !== undefined) {
900
- return definition
901
- }
899
+ if (Object.hasOwn(definitions, identifier)) return definitions[identifier]
902
900
  }
903
901
  }
904
902
 
package/src/Logger.ts CHANGED
@@ -20,6 +20,7 @@ import * as Formatter from "./Formatter.ts"
20
20
  import { dual } from "./Function.ts"
21
21
  import { isEffect, withFiber } from "./internal/core.ts"
22
22
  import * as effect from "./internal/effect.ts"
23
+ import * as InternalRecord from "./internal/record.ts"
23
24
  import * as Layer from "./Layer.ts"
24
25
  import type * as LogLevel from "./LogLevel.ts"
25
26
  import type { Pipeable } from "./Pipeable.ts"
@@ -704,13 +705,13 @@ export const formatStructured: Logger<unknown, {
704
705
 
705
706
  const annotations = fiber.getRef(CurrentLogAnnotations)
706
707
  for (const [key, value] of Object.entries(annotations)) {
707
- annotationsObj[key] = effect.structuredMessage(value)
708
+ InternalRecord.assignProperty(annotationsObj, key, effect.structuredMessage(value))
708
709
  }
709
710
 
710
711
  const now = date.getTime()
711
712
  const spans = fiber.getRef(CurrentLogSpans)
712
713
  for (const [label, timestamp] of spans) {
713
- spansObj[label] = now - timestamp
714
+ InternalRecord.assignProperty(spansObj, label, now - timestamp)
714
715
  }
715
716
 
716
717
  const messageArr = Array.ensure(message)
@@ -207,6 +207,16 @@ export interface ManagedRuntime<in R, out ER> {
207
207
  */
208
208
  readonly dispose: () => Promise<void>
209
209
 
210
+ /**
211
+ * Dispose of the resources associated with the runtime.
212
+ *
213
+ * **When to use**
214
+ *
215
+ * Use with the `await using` syntax to automatically dispose the runtime
216
+ * when it goes out of scope.
217
+ */
218
+ readonly [Symbol.asyncDispose]: () => Promise<void>
219
+
210
220
  /**
211
221
  * Dispose of the resources associated with the runtime.
212
222
  *
@@ -324,6 +334,9 @@ export const make = <R, ER>(
324
334
  dispose(): Promise<void> {
325
335
  return Effect.runPromise(self.disposeEffect)
326
336
  },
337
+ [Symbol.asyncDispose](): Promise<void> {
338
+ return self.dispose()
339
+ },
327
340
  disposeEffect: Effect.suspend(() => {
328
341
  ;(self as Mutable<ManagedRuntime<R, ER>>).contextEffect = Effect.die("ManagedRuntime disposed")
329
342
  self.cachedContext = undefined
package/src/Metric.ts CHANGED
@@ -19,6 +19,7 @@ import type { Exit } from "./Exit.ts"
19
19
  import { constUndefined, dual } from "./Function.ts"
20
20
  import * as InternalEffect from "./internal/effect.ts"
21
21
  import * as InternalMetric from "./internal/metric.ts"
22
+ import * as InternalRecord from "./internal/record.ts"
22
23
  import * as Layer from "./Layer.ts"
23
24
  import * as Order from "./Order.ts"
24
25
  import type { Pipeable } from "./Pipeable.ts"
@@ -1912,7 +1913,7 @@ class HistogramMetric extends Metric$<number, HistogramState> {
1912
1913
  let count = 0
1913
1914
  let sum = 0
1914
1915
  let min = Number.MAX_VALUE
1915
- let max = Number.MIN_VALUE
1916
+ let max = -Number.MAX_VALUE
1916
1917
 
1917
1918
  Arr.map(Arr.sort(bounds, Order.Number), (n, i) => {
1918
1919
  boundaries[i] = n
@@ -1999,7 +2000,7 @@ class SummaryMetric extends Metric$<readonly [value: number, timestamp: number],
1999
2000
  let count = 0
2000
2001
  let sum = 0
2001
2002
  let min = Number.MAX_VALUE
2002
- let max = Number.MIN_VALUE
2003
+ let max = -Number.MAX_VALUE
2003
2004
 
2004
2005
  const snapshot = (now: number): ReadonlyArray<[number, number | undefined]> => {
2005
2006
  const builder: Array<number> = []
@@ -5195,7 +5196,7 @@ function mergeAttributes(
5195
5196
  function attributesToRecord(attributes?: Metric.Attributes): Metric.AttributeSet | undefined {
5196
5197
  if (Predicate.isNotUndefined(attributes) && Array.isArray(attributes)) {
5197
5198
  return attributes.reduce((acc, [key, value]) => {
5198
- acc[key] = value
5199
+ InternalRecord.assignProperty(acc, key, value)
5199
5200
  return acc
5200
5201
  }, {} as Metric.AttributeSet)
5201
5202
  }
@@ -899,6 +899,10 @@ export const filter = <A>(self: MutableList<A>, f: (value: A, i: number) => bool
899
899
  }
900
900
  chunk = chunk.next
901
901
  }
902
+ if (array.length === 0) {
903
+ clear(self)
904
+ return
905
+ }
902
906
  self.head = self.tail = {
903
907
  array,
904
908
  mutable: true,
package/src/Optic.ts CHANGED
@@ -14,6 +14,7 @@
14
14
 
15
15
  import { format } from "./Formatter.ts"
16
16
  import { identity, memoize } from "./Function.ts"
17
+ import * as InternalRecord from "./internal/record.ts"
17
18
  import * as Option from "./Option.ts"
18
19
  import * as Predicate from "./Predicate.ts"
19
20
  import * as Result from "./Result.ts"
@@ -1072,7 +1073,7 @@ class OptionalImpl<S, A> implements Optional<S, A> {
1072
1073
  delete copy[key]
1073
1074
  }
1074
1075
  } else {
1075
- copy[key] = a
1076
+ InternalRecord.assignProperty(copy, key, a)
1076
1077
  }
1077
1078
  return copy
1078
1079
  }
@@ -1110,7 +1111,7 @@ class OptionalImpl<S, A> implements Optional<S, A> {
1110
1111
  (a, s) => {
1111
1112
  if (Object.hasOwn(s, key)) {
1112
1113
  const copy = cloneShallow(s)
1113
- copy[key] = a
1114
+ InternalRecord.assignProperty(copy, key, a)
1114
1115
  return Result.succeed(copy)
1115
1116
  } else {
1116
1117
  return err
@@ -1283,12 +1284,12 @@ const recur = memoize((node: Node): Op => {
1283
1284
  let i = 0
1284
1285
  for (; i < path.length - 1; i++) {
1285
1286
  const key = path[i]
1286
- current[key] = cloneShallow(current[key])
1287
+ InternalRecord.assignProperty(current, key, cloneShallow(current[key]))
1287
1288
  current = current[key]
1288
1289
  }
1289
1290
 
1290
1291
  const finalKey = path[i]
1291
- current[finalKey] = a
1292
+ InternalRecord.assignProperty(current, finalKey, a)
1292
1293
 
1293
1294
  return out
1294
1295
  }
package/src/Option.ts CHANGED
@@ -20,6 +20,7 @@ import type { TypeLambda } from "./HKT.ts"
20
20
  import type { Inspectable } from "./Inspectable.ts"
21
21
  import * as doNotation from "./internal/doNotation.ts"
22
22
  import * as option from "./internal/option.ts"
23
+ import * as InternalRecord from "./internal/record.ts"
23
24
  import * as result from "./internal/result.ts"
24
25
  import type { Order } from "./Order.ts"
25
26
  import * as order from "./Order.ts"
@@ -3025,7 +3026,7 @@ export const all: <const I extends Iterable<Option<any>> | Record<string, Option
3025
3026
  if (isNone(o)) {
3026
3027
  return none()
3027
3028
  }
3028
- out[key] = o.value
3029
+ InternalRecord.assignProperty(out, key, o.value)
3029
3030
  }
3030
3031
  return some(out)
3031
3032
  }
@@ -193,7 +193,6 @@ export const makeUnsafe = <K = unknown>(options: {
193
193
  }
194
194
 
195
195
  const needed = permits - totalPermits
196
- const taken = permits - needed
197
196
  if (totalPermits > 0) {
198
197
  totalPermits = 0
199
198
  }
@@ -228,9 +227,7 @@ export const makeUnsafe = <K = unknown>(options: {
228
227
  return Effect.sync(() => {
229
228
  cleanup()
230
229
  waitingPermits -= entry.permits
231
- if (taken > 0) {
232
- releaseUnsafe(taken)
233
- }
230
+ releaseUnsafe(permits - entry.permits)
234
231
  })
235
232
  })
236
233
  }