effect 4.0.0-beta.93 → 4.0.0-beta.97

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 (488) hide show
  1. package/dist/Array.d.ts.map +1 -1
  2. package/dist/BigDecimal.d.ts.map +1 -1
  3. package/dist/BigDecimal.js.map +1 -1
  4. package/dist/BigInt.d.ts.map +1 -1
  5. package/dist/Boolean.d.ts.map +1 -1
  6. package/dist/Brand.d.ts.map +1 -1
  7. package/dist/Cache.d.ts.map +1 -1
  8. package/dist/Cause.d.ts.map +1 -1
  9. package/dist/Channel.d.ts.map +1 -1
  10. package/dist/ChannelSchema.d.ts.map +1 -1
  11. package/dist/Chunk.d.ts.map +1 -1
  12. package/dist/Combiner.d.ts.map +1 -1
  13. package/dist/Config.d.ts +1 -1
  14. package/dist/Config.d.ts.map +1 -1
  15. package/dist/Config.js.map +1 -1
  16. package/dist/ConfigProvider.d.ts +44 -6
  17. package/dist/ConfigProvider.d.ts.map +1 -1
  18. package/dist/ConfigProvider.js +63 -24
  19. package/dist/ConfigProvider.js.map +1 -1
  20. package/dist/Console.d.ts.map +1 -1
  21. package/dist/Context.d.ts.map +1 -1
  22. package/dist/Cron.d.ts +4 -1
  23. package/dist/Cron.d.ts.map +1 -1
  24. package/dist/Cron.js +98 -53
  25. package/dist/Cron.js.map +1 -1
  26. package/dist/Crypto.d.ts.map +1 -1
  27. package/dist/Data.d.ts.map +1 -1
  28. package/dist/DateTime.d.ts +12 -12
  29. package/dist/DateTime.d.ts.map +1 -1
  30. package/dist/Deferred.d.ts.map +1 -1
  31. package/dist/Duration.d.ts.map +1 -1
  32. package/dist/Effect.d.ts +130 -0
  33. package/dist/Effect.d.ts.map +1 -1
  34. package/dist/Effect.js +43 -0
  35. package/dist/Effect.js.map +1 -1
  36. package/dist/Effectable.d.ts.map +1 -1
  37. package/dist/Encoding.d.ts.map +1 -1
  38. package/dist/Equal.d.ts.map +1 -1
  39. package/dist/Equivalence.d.ts.map +1 -1
  40. package/dist/ErrorReporter.d.ts.map +1 -1
  41. package/dist/ExecutionPlan.d.ts +2 -2
  42. package/dist/ExecutionPlan.d.ts.map +1 -1
  43. package/dist/Fiber.d.ts.map +1 -1
  44. package/dist/FiberHandle.d.ts +8 -8
  45. package/dist/FiberHandle.d.ts.map +1 -1
  46. package/dist/FiberMap.d.ts +8 -8
  47. package/dist/FiberMap.d.ts.map +1 -1
  48. package/dist/FiberSet.d.ts +4 -4
  49. package/dist/FiberSet.d.ts.map +1 -1
  50. package/dist/FileSystem.d.ts +7 -0
  51. package/dist/FileSystem.d.ts.map +1 -1
  52. package/dist/FileSystem.js +3 -0
  53. package/dist/FileSystem.js.map +1 -1
  54. package/dist/Filter.d.ts.map +1 -1
  55. package/dist/Function.d.ts.map +1 -1
  56. package/dist/Graph.d.ts.map +1 -1
  57. package/dist/Graph.js.map +1 -1
  58. package/dist/Hash.d.ts.map +1 -1
  59. package/dist/HashMap.d.ts.map +1 -1
  60. package/dist/HashRing.d.ts.map +1 -1
  61. package/dist/Inspectable.d.ts.map +1 -1
  62. package/dist/Inspectable.js.map +1 -1
  63. package/dist/Iterable.d.ts.map +1 -1
  64. package/dist/Latch.d.ts.map +1 -1
  65. package/dist/Layer.d.ts +1 -1
  66. package/dist/Layer.d.ts.map +1 -1
  67. package/dist/Layer.js +6 -3
  68. package/dist/Layer.js.map +1 -1
  69. package/dist/LayerMap.d.ts.map +1 -1
  70. package/dist/LayerMap.js +1 -1
  71. package/dist/LayerMap.js.map +1 -1
  72. package/dist/LayerRef.d.ts +252 -0
  73. package/dist/LayerRef.d.ts.map +1 -0
  74. package/dist/LayerRef.js +171 -0
  75. package/dist/LayerRef.js.map +1 -0
  76. package/dist/LogLevel.d.ts.map +1 -1
  77. package/dist/Logger.d.ts.map +1 -1
  78. package/dist/ManagedRuntime.d.ts.map +1 -1
  79. package/dist/Metric.d.ts.map +1 -1
  80. package/dist/MutableHashMap.d.ts.map +1 -1
  81. package/dist/MutableHashSet.d.ts.map +1 -1
  82. package/dist/MutableList.d.ts.map +1 -1
  83. package/dist/MutableRef.d.ts.map +1 -1
  84. package/dist/NonEmptyIterable.d.ts.map +1 -1
  85. package/dist/Number.d.ts.map +1 -1
  86. package/dist/Optic.d.ts.map +1 -1
  87. package/dist/Option.d.ts.map +1 -1
  88. package/dist/Order.d.ts.map +1 -1
  89. package/dist/Ordering.d.ts.map +1 -1
  90. package/dist/PartitionedSemaphore.d.ts.map +1 -1
  91. package/dist/Pipeable.d.ts.map +1 -1
  92. package/dist/PlatformError.d.ts.map +1 -1
  93. package/dist/Pool.d.ts.map +1 -1
  94. package/dist/PrimaryKey.d.ts.map +1 -1
  95. package/dist/PubSub.d.ts.map +1 -1
  96. package/dist/Pull.d.ts.map +1 -1
  97. package/dist/Queue.d.ts.map +1 -1
  98. package/dist/Random.d.ts.map +1 -1
  99. package/dist/RcMap.d.ts.map +1 -1
  100. package/dist/Record.d.ts.map +1 -1
  101. package/dist/Redactable.d.ts.map +1 -1
  102. package/dist/Redacted.d.ts.map +1 -1
  103. package/dist/Ref.d.ts.map +1 -1
  104. package/dist/RegExp.d.ts.map +1 -1
  105. package/dist/Request.d.ts +1 -1
  106. package/dist/Request.d.ts.map +1 -1
  107. package/dist/RequestResolver.d.ts.map +1 -1
  108. package/dist/Resource.d.ts.map +1 -1
  109. package/dist/Result.d.ts.map +1 -1
  110. package/dist/Runtime.d.ts.map +1 -1
  111. package/dist/Schedule.d.ts +1206 -4013
  112. package/dist/Schedule.d.ts.map +1 -1
  113. package/dist/Schedule.js +244 -1348
  114. package/dist/Schedule.js.map +1 -1
  115. package/dist/Scheduler.d.ts.map +1 -1
  116. package/dist/Scheduler.js.map +1 -1
  117. package/dist/Schema.d.ts +123 -30
  118. package/dist/Schema.d.ts.map +1 -1
  119. package/dist/Schema.js +40 -0
  120. package/dist/Schema.js.map +1 -1
  121. package/dist/SchemaAST.d.ts.map +1 -1
  122. package/dist/SchemaAST.js.map +1 -1
  123. package/dist/SchemaGetter.d.ts.map +1 -1
  124. package/dist/SchemaIssue.d.ts.map +1 -1
  125. package/dist/SchemaIssue.js.map +1 -1
  126. package/dist/SchemaParser.d.ts +1 -1
  127. package/dist/SchemaParser.d.ts.map +1 -1
  128. package/dist/SchemaParser.js.map +1 -1
  129. package/dist/SchemaRepresentation.d.ts +106 -106
  130. package/dist/SchemaTransformation.d.ts +38 -2
  131. package/dist/SchemaTransformation.d.ts.map +1 -1
  132. package/dist/SchemaTransformation.js +38 -2
  133. package/dist/SchemaTransformation.js.map +1 -1
  134. package/dist/ScopedCache.d.ts.map +1 -1
  135. package/dist/ScopedRef.d.ts.map +1 -1
  136. package/dist/Semaphore.d.ts.map +1 -1
  137. package/dist/Sink.d.ts.map +1 -1
  138. package/dist/Stdio.d.ts.map +1 -1
  139. package/dist/Stream.d.ts +2 -2
  140. package/dist/Stream.d.ts.map +1 -1
  141. package/dist/Stream.js +1 -1
  142. package/dist/String.d.ts.map +1 -1
  143. package/dist/String.js.map +1 -1
  144. package/dist/Struct.d.ts.map +1 -1
  145. package/dist/SubscriptionRef.d.ts.map +1 -1
  146. package/dist/SynchronizedRef.d.ts.map +1 -1
  147. package/dist/Take.d.ts.map +1 -1
  148. package/dist/Terminal.d.ts.map +1 -1
  149. package/dist/Tracer.d.ts.map +1 -1
  150. package/dist/Trie.d.ts.map +1 -1
  151. package/dist/Tuple.d.ts.map +1 -1
  152. package/dist/TxChunk.d.ts.map +1 -1
  153. package/dist/TxDeferred.d.ts.map +1 -1
  154. package/dist/TxHashMap.d.ts.map +1 -1
  155. package/dist/TxHashSet.d.ts.map +1 -1
  156. package/dist/TxPriorityQueue.d.ts.map +1 -1
  157. package/dist/TxPubSub.d.ts.map +1 -1
  158. package/dist/TxQueue.d.ts.map +1 -1
  159. package/dist/TxReentrantLock.d.ts.map +1 -1
  160. package/dist/TxRef.d.ts.map +1 -1
  161. package/dist/TxSemaphore.d.ts.map +1 -1
  162. package/dist/TxSubscriptionRef.d.ts.map +1 -1
  163. package/dist/Types.d.ts +1 -1
  164. package/dist/Types.d.ts.map +1 -1
  165. package/dist/UndefinedOr.d.ts.map +1 -1
  166. package/dist/Utils.d.ts.map +1 -1
  167. package/dist/internal/effect.js +2 -0
  168. package/dist/internal/effect.js.map +1 -1
  169. package/dist/internal/schema/schema.d.ts.map +1 -1
  170. package/dist/testing/TestClock.d.ts.map +1 -1
  171. package/dist/testing/TestConsole.d.ts.map +1 -1
  172. package/dist/testing/TestSchema.d.ts +2 -2
  173. package/dist/testing/TestSchema.d.ts.map +1 -1
  174. package/dist/testing/TestSchema.js.map +1 -1
  175. package/dist/unstable/ai/AiError.d.ts +1 -1
  176. package/dist/unstable/ai/AiError.d.ts.map +1 -1
  177. package/dist/unstable/ai/Chat.d.ts +2 -2
  178. package/dist/unstable/ai/Chat.d.ts.map +1 -1
  179. package/dist/unstable/ai/IdGenerator.d.ts.map +1 -1
  180. package/dist/unstable/ai/LanguageModel.d.ts +2 -2
  181. package/dist/unstable/ai/LanguageModel.d.ts.map +1 -1
  182. package/dist/unstable/ai/McpSchema.d.ts +221 -221
  183. package/dist/unstable/ai/McpSchema.d.ts.map +1 -1
  184. package/dist/unstable/ai/McpServer.d.ts.map +1 -1
  185. package/dist/unstable/ai/Model.d.ts.map +1 -1
  186. package/dist/unstable/ai/Prompt.d.ts.map +1 -1
  187. package/dist/unstable/ai/Response.d.ts.map +1 -1
  188. package/dist/unstable/ai/Telemetry.d.ts.map +1 -1
  189. package/dist/unstable/ai/Tokenizer.d.ts.map +1 -1
  190. package/dist/unstable/ai/Tool.d.ts.map +1 -1
  191. package/dist/unstable/ai/Toolkit.d.ts.map +1 -1
  192. package/dist/unstable/cli/Argument.d.ts +2 -2
  193. package/dist/unstable/cli/Argument.d.ts.map +1 -1
  194. package/dist/unstable/cli/Argument.js.map +1 -1
  195. package/dist/unstable/cli/CliError.d.ts.map +1 -1
  196. package/dist/unstable/cli/CliOutput.d.ts.map +1 -1
  197. package/dist/unstable/cli/Command.d.ts.map +1 -1
  198. package/dist/unstable/cli/Completions.d.ts.map +1 -1
  199. package/dist/unstable/cli/Flag.d.ts +2 -2
  200. package/dist/unstable/cli/Flag.d.ts.map +1 -1
  201. package/dist/unstable/cli/Flag.js.map +1 -1
  202. package/dist/unstable/cli/GlobalFlag.d.ts.map +1 -1
  203. package/dist/unstable/cli/Param.d.ts +2 -2
  204. package/dist/unstable/cli/Param.d.ts.map +1 -1
  205. package/dist/unstable/cli/Param.js.map +1 -1
  206. package/dist/unstable/cli/Primitive.d.ts.map +1 -1
  207. package/dist/unstable/cli/Primitive.js.map +1 -1
  208. package/dist/unstable/cli/Prompt.d.ts.map +1 -1
  209. package/dist/unstable/cli/Prompt.js.map +1 -1
  210. package/dist/unstable/cli/internal/ansi.d.ts.map +1 -1
  211. package/dist/unstable/cli/internal/ansi.js.map +1 -1
  212. package/dist/unstable/cli/internal/command.d.ts.map +1 -1
  213. package/dist/unstable/cli/internal/help.d.ts.map +1 -1
  214. package/dist/unstable/cli/internal/parser.js.map +1 -1
  215. package/dist/unstable/cluster/ClusterCron.d.ts.map +1 -1
  216. package/dist/unstable/cluster/ClusterCron.js +1 -1
  217. package/dist/unstable/cluster/ClusterCron.js.map +1 -1
  218. package/dist/unstable/cluster/ClusterError.d.ts.map +1 -1
  219. package/dist/unstable/cluster/ClusterSchema.d.ts +1 -1
  220. package/dist/unstable/cluster/ClusterSchema.d.ts.map +1 -1
  221. package/dist/unstable/cluster/ClusterWorkflowEngine.d.ts +1 -1
  222. package/dist/unstable/cluster/ClusterWorkflowEngine.d.ts.map +1 -1
  223. package/dist/unstable/cluster/ClusterWorkflowEngine.js +2 -1
  224. package/dist/unstable/cluster/ClusterWorkflowEngine.js.map +1 -1
  225. package/dist/unstable/cluster/DeliverAt.d.ts.map +1 -1
  226. package/dist/unstable/cluster/Entity.d.ts.map +1 -1
  227. package/dist/unstable/cluster/Entity.js +5 -3
  228. package/dist/unstable/cluster/Entity.js.map +1 -1
  229. package/dist/unstable/cluster/EntityAddress.d.ts.map +1 -1
  230. package/dist/unstable/cluster/EntityId.d.ts.map +1 -1
  231. package/dist/unstable/cluster/EntityProxy.d.ts.map +1 -1
  232. package/dist/unstable/cluster/EntityProxyServer.d.ts.map +1 -1
  233. package/dist/unstable/cluster/EntityType.d.ts.map +1 -1
  234. package/dist/unstable/cluster/Envelope.d.ts.map +1 -1
  235. package/dist/unstable/cluster/HttpRunner.d.ts.map +1 -1
  236. package/dist/unstable/cluster/MachineId.d.ts.map +1 -1
  237. package/dist/unstable/cluster/Message.d.ts.map +1 -1
  238. package/dist/unstable/cluster/MessageStorage.d.ts +25 -29
  239. package/dist/unstable/cluster/MessageStorage.d.ts.map +1 -1
  240. package/dist/unstable/cluster/Reply.d.ts.map +1 -1
  241. package/dist/unstable/cluster/Runner.d.ts.map +1 -1
  242. package/dist/unstable/cluster/RunnerAddress.d.ts.map +1 -1
  243. package/dist/unstable/cluster/RunnerHealth.d.ts.map +1 -1
  244. package/dist/unstable/cluster/RunnerServer.d.ts +1 -1
  245. package/dist/unstable/cluster/RunnerStorage.d.ts.map +1 -1
  246. package/dist/unstable/cluster/Runners.d.ts +8 -8
  247. package/dist/unstable/cluster/ShardId.d.ts.map +1 -1
  248. package/dist/unstable/cluster/Sharding.d.ts.map +1 -1
  249. package/dist/unstable/cluster/Sharding.js +6 -5
  250. package/dist/unstable/cluster/Sharding.js.map +1 -1
  251. package/dist/unstable/cluster/ShardingConfig.d.ts.map +1 -1
  252. package/dist/unstable/cluster/ShardingRegistrationEvent.d.ts +6 -8
  253. package/dist/unstable/cluster/ShardingRegistrationEvent.d.ts.map +1 -1
  254. package/dist/unstable/cluster/SingleRunner.d.ts.map +1 -1
  255. package/dist/unstable/cluster/Singleton.d.ts.map +1 -1
  256. package/dist/unstable/cluster/SingletonAddress.d.ts.map +1 -1
  257. package/dist/unstable/cluster/Snowflake.d.ts +1 -1
  258. package/dist/unstable/cluster/Snowflake.d.ts.map +1 -1
  259. package/dist/unstable/cluster/Snowflake.js +1 -1
  260. package/dist/unstable/cluster/Snowflake.js.map +1 -1
  261. package/dist/unstable/cluster/SqlMessageStorage.d.ts.map +1 -1
  262. package/dist/unstable/cluster/SqlRunnerStorage.d.ts +1 -1
  263. package/dist/unstable/cluster/SqlRunnerStorage.d.ts.map +1 -1
  264. package/dist/unstable/cluster/internal/entityManager.js +14 -14
  265. package/dist/unstable/cluster/internal/entityManager.js.map +1 -1
  266. package/dist/unstable/cluster/internal/resourceMap.js +39 -14
  267. package/dist/unstable/cluster/internal/resourceMap.js.map +1 -1
  268. package/dist/unstable/devtools/DevTools.d.ts.map +1 -1
  269. package/dist/unstable/encoding/Msgpack.d.ts.map +1 -1
  270. package/dist/unstable/encoding/Ndjson.d.ts.map +1 -1
  271. package/dist/unstable/encoding/Sse.d.ts +2 -2
  272. package/dist/unstable/encoding/Sse.d.ts.map +1 -1
  273. package/dist/unstable/eventlog/Event.d.ts.map +1 -1
  274. package/dist/unstable/eventlog/EventGroup.d.ts.map +1 -1
  275. package/dist/unstable/eventlog/EventJournal.d.ts.map +1 -1
  276. package/dist/unstable/eventlog/EventJournal.js.map +1 -1
  277. package/dist/unstable/eventlog/EventLog.d.ts.map +1 -1
  278. package/dist/unstable/eventlog/EventLog.js +2 -2
  279. package/dist/unstable/eventlog/EventLog.js.map +1 -1
  280. package/dist/unstable/eventlog/EventLogEncryption.d.ts.map +1 -1
  281. package/dist/unstable/eventlog/EventLogMessage.d.ts.map +1 -1
  282. package/dist/unstable/eventlog/EventLogRemote.d.ts +21 -21
  283. package/dist/unstable/eventlog/EventLogServer.d.ts.map +1 -1
  284. package/dist/unstable/eventlog/EventLogServerEncrypted.d.ts +1 -1
  285. package/dist/unstable/eventlog/EventLogServerUnencrypted.d.ts +3 -4
  286. package/dist/unstable/eventlog/EventLogServerUnencrypted.d.ts.map +1 -1
  287. package/dist/unstable/eventlog/EventLogSessionAuth.d.ts.map +1 -1
  288. package/dist/unstable/eventlog/SqlEventJournal.d.ts.map +1 -1
  289. package/dist/unstable/eventlog/SqlEventLogServerEncrypted.d.ts.map +1 -1
  290. package/dist/unstable/eventlog/SqlEventLogServerUnencrypted.d.ts.map +1 -1
  291. package/dist/unstable/http/Cookies.d.ts +1 -1
  292. package/dist/unstable/http/Cookies.d.ts.map +1 -1
  293. package/dist/unstable/http/Etag.d.ts.map +1 -1
  294. package/dist/unstable/http/Headers.d.ts.map +1 -1
  295. package/dist/unstable/http/HttpBody.d.ts.map +1 -1
  296. package/dist/unstable/http/HttpClient.d.ts.map +1 -1
  297. package/dist/unstable/http/HttpClientError.d.ts +1 -1
  298. package/dist/unstable/http/HttpClientError.d.ts.map +1 -1
  299. package/dist/unstable/http/HttpClientRequest.d.ts.map +1 -1
  300. package/dist/unstable/http/HttpClientResponse.d.ts +1 -1
  301. package/dist/unstable/http/HttpClientResponse.d.ts.map +1 -1
  302. package/dist/unstable/http/HttpClientResponse.js.map +1 -1
  303. package/dist/unstable/http/HttpEffect.d.ts.map +1 -1
  304. package/dist/unstable/http/HttpIncomingMessage.d.ts +2 -2
  305. package/dist/unstable/http/HttpIncomingMessage.d.ts.map +1 -1
  306. package/dist/unstable/http/HttpIncomingMessage.js.map +1 -1
  307. package/dist/unstable/http/HttpMethod.d.ts.map +1 -1
  308. package/dist/unstable/http/HttpMiddleware.d.ts +1 -1
  309. package/dist/unstable/http/HttpMiddleware.d.ts.map +1 -1
  310. package/dist/unstable/http/HttpRouter.d.ts +4 -4
  311. package/dist/unstable/http/HttpRouter.d.ts.map +1 -1
  312. package/dist/unstable/http/HttpRouter.js.map +1 -1
  313. package/dist/unstable/http/HttpServer.d.ts.map +1 -1
  314. package/dist/unstable/http/HttpServerError.d.ts +1 -1
  315. package/dist/unstable/http/HttpServerError.d.ts.map +1 -1
  316. package/dist/unstable/http/HttpServerRequest.d.ts +8 -8
  317. package/dist/unstable/http/HttpServerRequest.d.ts.map +1 -1
  318. package/dist/unstable/http/HttpServerRequest.js.map +1 -1
  319. package/dist/unstable/http/HttpServerRespondable.d.ts.map +1 -1
  320. package/dist/unstable/http/HttpServerResponse.d.ts +1 -1
  321. package/dist/unstable/http/HttpServerResponse.d.ts.map +1 -1
  322. package/dist/unstable/http/HttpServerResponse.js.map +1 -1
  323. package/dist/unstable/http/HttpStaticServer.d.ts.map +1 -1
  324. package/dist/unstable/http/HttpTraceContext.d.ts.map +1 -1
  325. package/dist/unstable/http/Multipart.d.ts +4 -3
  326. package/dist/unstable/http/Multipart.d.ts.map +1 -1
  327. package/dist/unstable/http/Multipart.js.map +1 -1
  328. package/dist/unstable/http/Url.d.ts.map +1 -1
  329. package/dist/unstable/http/UrlParams.d.ts.map +1 -1
  330. package/dist/unstable/httpapi/HttpApi.d.ts.map +1 -1
  331. package/dist/unstable/httpapi/HttpApi.js +2 -4
  332. package/dist/unstable/httpapi/HttpApi.js.map +1 -1
  333. package/dist/unstable/httpapi/HttpApiBuilder.d.ts.map +1 -1
  334. package/dist/unstable/httpapi/HttpApiClient.d.ts.map +1 -1
  335. package/dist/unstable/httpapi/HttpApiClient.js.map +1 -1
  336. package/dist/unstable/httpapi/HttpApiEndpoint.d.ts +26 -26
  337. package/dist/unstable/httpapi/HttpApiEndpoint.d.ts.map +1 -1
  338. package/dist/unstable/httpapi/HttpApiError.d.ts +1 -1
  339. package/dist/unstable/httpapi/HttpApiError.d.ts.map +1 -1
  340. package/dist/unstable/httpapi/HttpApiGroup.d.ts.map +1 -1
  341. package/dist/unstable/httpapi/HttpApiMiddleware.d.ts.map +1 -1
  342. package/dist/unstable/httpapi/HttpApiScalar.d.ts.map +1 -1
  343. package/dist/unstable/httpapi/HttpApiSchema.d.ts +1 -1
  344. package/dist/unstable/httpapi/HttpApiSchema.d.ts.map +1 -1
  345. package/dist/unstable/httpapi/HttpApiSecurity.d.ts.map +1 -1
  346. package/dist/unstable/httpapi/HttpApiSwagger.d.ts.map +1 -1
  347. package/dist/unstable/httpapi/HttpApiTest.d.ts +1 -1
  348. package/dist/unstable/observability/Otlp.d.ts.map +1 -1
  349. package/dist/unstable/observability/OtlpExporter.js +3 -1
  350. package/dist/unstable/observability/OtlpExporter.js.map +1 -1
  351. package/dist/unstable/observability/OtlpLogger.d.ts.map +1 -1
  352. package/dist/unstable/observability/OtlpMetrics.d.ts.map +1 -1
  353. package/dist/unstable/observability/OtlpResource.d.ts.map +1 -1
  354. package/dist/unstable/observability/OtlpTracer.d.ts.map +1 -1
  355. package/dist/unstable/observability/PrometheusMetrics.d.ts.map +1 -1
  356. package/dist/unstable/observability/internal/otlpEnv.d.ts.map +1 -1
  357. package/dist/unstable/persistence/KeyValueStore.d.ts.map +1 -1
  358. package/dist/unstable/persistence/KeyValueStore.js.map +1 -1
  359. package/dist/unstable/persistence/Persistable.d.ts.map +1 -1
  360. package/dist/unstable/persistence/PersistedQueue.d.ts +1 -1
  361. package/dist/unstable/persistence/PersistedQueue.d.ts.map +1 -1
  362. package/dist/unstable/persistence/Persistence.d.ts.map +1 -1
  363. package/dist/unstable/persistence/RateLimiter.d.ts.map +1 -1
  364. package/dist/unstable/persistence/Redis.d.ts.map +1 -1
  365. package/dist/unstable/process/ChildProcess.d.ts.map +1 -1
  366. package/dist/unstable/process/ChildProcess.js.map +1 -1
  367. package/dist/unstable/process/ChildProcessSpawner.d.ts.map +1 -1
  368. package/dist/unstable/reactivity/AsyncResult.d.ts +2 -2
  369. package/dist/unstable/reactivity/AsyncResult.d.ts.map +1 -1
  370. package/dist/unstable/reactivity/Atom.d.ts +4 -4
  371. package/dist/unstable/reactivity/Atom.d.ts.map +1 -1
  372. package/dist/unstable/reactivity/Atom.js.map +1 -1
  373. package/dist/unstable/reactivity/AtomHttpApi.d.ts.map +1 -1
  374. package/dist/unstable/reactivity/AtomRef.d.ts.map +1 -1
  375. package/dist/unstable/reactivity/AtomRegistry.d.ts +2 -2
  376. package/dist/unstable/reactivity/AtomRegistry.d.ts.map +1 -1
  377. package/dist/unstable/reactivity/AtomRegistry.js +28 -37
  378. package/dist/unstable/reactivity/AtomRegistry.js.map +1 -1
  379. package/dist/unstable/reactivity/AtomRpc.d.ts.map +1 -1
  380. package/dist/unstable/reactivity/Hydration.d.ts.map +1 -1
  381. package/dist/unstable/reactivity/Reactivity.d.ts.map +1 -1
  382. package/dist/unstable/rpc/Rpc.d.ts.map +1 -1
  383. package/dist/unstable/rpc/RpcClient.d.ts +2 -1
  384. package/dist/unstable/rpc/RpcClient.d.ts.map +1 -1
  385. package/dist/unstable/rpc/RpcClient.js +5 -5
  386. package/dist/unstable/rpc/RpcClient.js.map +1 -1
  387. package/dist/unstable/rpc/RpcGroup.d.ts.map +1 -1
  388. package/dist/unstable/rpc/RpcMessage.d.ts +7 -7
  389. package/dist/unstable/rpc/RpcMessage.d.ts.map +1 -1
  390. package/dist/unstable/rpc/RpcMessage.js +2 -2
  391. package/dist/unstable/rpc/RpcMessage.js.map +1 -1
  392. package/dist/unstable/rpc/RpcMiddleware.d.ts.map +1 -1
  393. package/dist/unstable/rpc/RpcSchema.d.ts +1 -1
  394. package/dist/unstable/rpc/RpcSerialization.d.ts.map +1 -1
  395. package/dist/unstable/rpc/RpcSerialization.js +8 -8
  396. package/dist/unstable/rpc/RpcSerialization.js.map +1 -1
  397. package/dist/unstable/rpc/RpcServer.d.ts +2 -2
  398. package/dist/unstable/rpc/RpcServer.d.ts.map +1 -1
  399. package/dist/unstable/rpc/RpcServer.js +5 -5
  400. package/dist/unstable/rpc/RpcServer.js.map +1 -1
  401. package/dist/unstable/rpc/RpcWorker.d.ts.map +1 -1
  402. package/dist/unstable/rpc/Utils.d.ts.map +1 -1
  403. package/dist/unstable/schema/Model.d.ts +24 -38
  404. package/dist/unstable/schema/Model.d.ts.map +1 -1
  405. package/dist/unstable/schema/VariantSchema.d.ts +1 -1
  406. package/dist/unstable/schema/VariantSchema.d.ts.map +1 -1
  407. package/dist/unstable/socket/Socket.d.ts +1 -1
  408. package/dist/unstable/socket/Socket.d.ts.map +1 -1
  409. package/dist/unstable/socket/SocketServer.d.ts.map +1 -1
  410. package/dist/unstable/sql/Migrator.d.ts.map +1 -1
  411. package/dist/unstable/sql/SqlClient.d.ts.map +1 -1
  412. package/dist/unstable/sql/SqlError.d.ts +2 -2
  413. package/dist/unstable/sql/SqlError.d.ts.map +1 -1
  414. package/dist/unstable/sql/SqlError.js.map +1 -1
  415. package/dist/unstable/sql/SqlModel.d.ts.map +1 -1
  416. package/dist/unstable/sql/SqlResolver.d.ts.map +1 -1
  417. package/dist/unstable/sql/SqlSchema.d.ts.map +1 -1
  418. package/dist/unstable/sql/SqlStream.d.ts.map +1 -1
  419. package/dist/unstable/sql/Statement.d.ts.map +1 -1
  420. package/dist/unstable/workers/Transferable.d.ts.map +1 -1
  421. package/dist/unstable/workers/Worker.d.ts.map +1 -1
  422. package/dist/unstable/workers/WorkerError.d.ts.map +1 -1
  423. package/dist/unstable/workflow/Activity.d.ts +1 -1
  424. package/dist/unstable/workflow/Activity.d.ts.map +1 -1
  425. package/dist/unstable/workflow/Activity.js +1 -1
  426. package/dist/unstable/workflow/Activity.js.map +1 -1
  427. package/dist/unstable/workflow/DurableClock.d.ts.map +1 -1
  428. package/dist/unstable/workflow/DurableDeferred.d.ts.map +1 -1
  429. package/dist/unstable/workflow/DurableQueue.d.ts.map +1 -1
  430. package/dist/unstable/workflow/DurableQueue.js +1 -1
  431. package/dist/unstable/workflow/DurableQueue.js.map +1 -1
  432. package/dist/unstable/workflow/Workflow.d.ts.map +1 -1
  433. package/dist/unstable/workflow/WorkflowEngine.d.ts.map +1 -1
  434. package/dist/unstable/workflow/WorkflowEngine.js +1 -1
  435. package/dist/unstable/workflow/WorkflowEngine.js.map +1 -1
  436. package/dist/unstable/workflow/WorkflowProxy.d.ts.map +1 -1
  437. package/dist/unstable/workflow/WorkflowProxyServer.d.ts.map +1 -1
  438. package/package.json +11 -12
  439. package/src/Config.ts +1 -1
  440. package/src/ConfigProvider.ts +79 -27
  441. package/src/Cron.ts +109 -57
  442. package/src/Effect.ts +131 -0
  443. package/src/FileSystem.ts +13 -0
  444. package/src/Layer.ts +6 -6
  445. package/src/LayerMap.ts +1 -1
  446. package/src/LayerRef.ts +379 -0
  447. package/src/Schedule.ts +1437 -4445
  448. package/src/Schema.ts +133 -33
  449. package/src/SchemaParser.ts +2 -2
  450. package/src/SchemaTransformation.ts +42 -2
  451. package/src/Stream.ts +1 -1
  452. package/src/internal/effect.ts +19 -0
  453. package/src/testing/TestSchema.ts +2 -2
  454. package/src/unstable/ai/Chat.ts +1 -1
  455. package/src/unstable/ai/LanguageModel.ts +3 -3
  456. package/src/unstable/cli/Argument.ts +14 -7
  457. package/src/unstable/cli/Flag.ts +6 -3
  458. package/src/unstable/cli/Param.ts +6 -3
  459. package/src/unstable/cli/Primitive.ts +2 -2
  460. package/src/unstable/cluster/ClusterCron.ts +4 -3
  461. package/src/unstable/cluster/ClusterWorkflowEngine.ts +5 -3
  462. package/src/unstable/cluster/Entity.ts +13 -14
  463. package/src/unstable/cluster/Sharding.ts +137 -134
  464. package/src/unstable/cluster/Snowflake.ts +2 -2
  465. package/src/unstable/cluster/internal/entityManager.ts +27 -25
  466. package/src/unstable/cluster/internal/resourceMap.ts +59 -25
  467. package/src/unstable/encoding/Sse.ts +3 -3
  468. package/src/unstable/eventlog/EventLog.ts +4 -3
  469. package/src/unstable/http/HttpClientResponse.ts +2 -3
  470. package/src/unstable/http/HttpIncomingMessage.ts +4 -5
  471. package/src/unstable/http/HttpRouter.ts +8 -10
  472. package/src/unstable/http/HttpServerRequest.ts +20 -19
  473. package/src/unstable/http/HttpServerResponse.ts +2 -2
  474. package/src/unstable/http/Multipart.ts +3 -3
  475. package/src/unstable/httpapi/HttpApi.ts +2 -4
  476. package/src/unstable/httpapi/HttpApiClient.ts +2 -2
  477. package/src/unstable/httpapi/HttpApiEndpoint.ts +7 -7
  478. package/src/unstable/httpapi/HttpApiSchema.ts +1 -1
  479. package/src/unstable/observability/OtlpExporter.ts +1 -1
  480. package/src/unstable/reactivity/Atom.ts +10 -7
  481. package/src/unstable/reactivity/AtomRegistry.ts +35 -44
  482. package/src/unstable/rpc/RpcClient.ts +10 -9
  483. package/src/unstable/rpc/RpcMessage.ts +8 -9
  484. package/src/unstable/rpc/RpcSerialization.ts +16 -16
  485. package/src/unstable/rpc/RpcServer.ts +5 -5
  486. package/src/unstable/workflow/Activity.ts +6 -5
  487. package/src/unstable/workflow/DurableQueue.ts +4 -3
  488. package/src/unstable/workflow/WorkflowEngine.ts +4 -3
package/src/Schema.ts CHANGED
@@ -888,31 +888,6 @@ export declare namespace Codec {
888
888
  export type EncodingServices<S> = S extends { readonly "EncodingServices": infer R } ? R : never
889
889
  }
890
890
 
891
- /**
892
- * A schema that additionally supports optic (lens/prism) operations.
893
- *
894
- * **Details**
895
- *
896
- * `Optic<T, Iso>` extends {@link Schema}`<T>` with an `Iso` type that
897
- * describes the isomorphic counterpart used by the optic layer. Crucially,
898
- * decoding and encoding require *no* Effect services (`DecodingServices` and
899
- * `EncodingServices` are both `never`), which means the optic can operate
900
- * purely without an Effect runtime.
901
- *
902
- * Most primitive schemas (e.g. `Schema.String`, `Schema.Number`) implement
903
- * `Optic` automatically. You normally interact with this interface through
904
- * {@link Optic_} utilities rather than constructing it directly.
905
- *
906
- * @category models
907
- * @since 4.0.0
908
- */
909
- export interface Optic<out T, out Iso> extends Schema<T> {
910
- readonly "Iso": Iso
911
- readonly "DecodingServices": never
912
- readonly "EncodingServices": never
913
- readonly "Rebuild": Optic<T, Iso>
914
- }
915
-
916
891
  /**
917
892
  * A schema that tracks the decoded type `T`, the encoded type `E`, and the
918
893
  * Effect services required during decoding (`RD`) and encoding (`RE`).
@@ -924,8 +899,8 @@ export interface Optic<out T, out Iso> extends Schema<T> {
924
899
  * Most concrete schemas produced by this module implement `Codec`.
925
900
  *
926
901
  * For APIs that only need one direction, prefer the narrower views:
927
- * - {@link ConstraintDecoder}`<T, RD>` — decode-only
928
- * - {@link ConstraintEncoder}`<E, RE>` — encode-only
902
+ * - {@link Decoder}`<T, RD>` — decode-only
903
+ * - {@link Encoder}`<E, RE>` — encode-only
929
904
  * - {@link Schema}`<T>` — type-only (no encoded representation)
930
905
  *
931
906
  * **Example** (Accepting a codec that decodes to `number` from `string`)
@@ -953,6 +928,52 @@ export interface Codec<out T, out E = T, out RD = never, out RE = never> extends
953
928
  readonly "Rebuild": Codec<T, E, RD, RE>
954
929
  }
955
930
 
931
+ /**
932
+ * A schema that tracks the decoded type `T` and the Effect services required
933
+ * during decoding (`RD`).
934
+ *
935
+ * **When to use**
936
+ *
937
+ * Use when you need to preserve a schema's decoded type and decoding service
938
+ * requirements, but do not need to constrain its encoded representation or
939
+ * encoding services.
940
+ *
941
+ * @see {@link Codec} for preserving both decoded and encoded type information.
942
+ * @see {@link Encoder} for the encode-only view.
943
+ *
944
+ * @category models
945
+ * @since 4.0.0
946
+ */
947
+ export interface Decoder<out T, out RD = never> extends Schema<T> {
948
+ readonly "Encoded": unknown
949
+ readonly "DecodingServices": RD
950
+ readonly "EncodingServices": unknown
951
+ readonly "Rebuild": Decoder<T, RD>
952
+ }
953
+
954
+ /**
955
+ * A schema that tracks the encoded type `E` and the Effect services required
956
+ * during encoding (`RE`).
957
+ *
958
+ * **When to use**
959
+ *
960
+ * Use when you need to preserve a schema's encoded type and encoding service
961
+ * requirements, but do not need to constrain its decoded representation or
962
+ * decoding services.
963
+ *
964
+ * @see {@link Codec} for preserving both decoded and encoded type information.
965
+ * @see {@link Decoder} for the decode-only view.
966
+ *
967
+ * @category models
968
+ * @since 4.0.0
969
+ */
970
+ export interface Encoder<out E, out RE = never> extends Schema<unknown> {
971
+ readonly "Encoded": E
972
+ readonly "DecodingServices": unknown
973
+ readonly "EncodingServices": RE
974
+ readonly "Rebuild": Encoder<E, RE>
975
+ }
976
+
956
977
  /**
957
978
  * Returns a codec widened to the full {@link Codec} interface, prompting
958
979
  * TypeScript to infer all four type parameters (`T`, `E`, `RD`, `RE`).
@@ -982,6 +1003,31 @@ export function revealCodec<T, E, RD, RE>(codec: Codec<T, E, RD, RE>) {
982
1003
  return codec
983
1004
  }
984
1005
 
1006
+ /**
1007
+ * A schema that additionally supports optic (lens/prism) operations.
1008
+ *
1009
+ * **Details**
1010
+ *
1011
+ * `Optic<T, Iso>` extends {@link Schema}`<T>` with an `Iso` type that
1012
+ * describes the isomorphic counterpart used by the optic layer. Crucially,
1013
+ * decoding and encoding require *no* Effect services (`DecodingServices` and
1014
+ * `EncodingServices` are both `never`), which means the optic can operate
1015
+ * purely without an Effect runtime.
1016
+ *
1017
+ * Most primitive schemas (e.g. `Schema.String`, `Schema.Number`) implement
1018
+ * `Optic` automatically. You normally interact with this interface through
1019
+ * {@link Optic_} utilities rather than constructing it directly.
1020
+ *
1021
+ * @category models
1022
+ * @since 4.0.0
1023
+ */
1024
+ export interface Optic<out T, out Iso> extends Schema<T> {
1025
+ readonly "Iso": Iso
1026
+ readonly "DecodingServices": never
1027
+ readonly "EncodingServices": never
1028
+ readonly "Rebuild": Optic<T, Iso>
1029
+ }
1030
+
985
1031
  export {
986
1032
  /**
987
1033
  * Error thrown (or returned as the error channel value) when schema decoding
@@ -2757,7 +2803,7 @@ export declare namespace TemplateLiteralParser {
2757
2803
  */
2758
2804
  export type Type<Parts> = Parts extends readonly [infer Head, ...infer Tail] ? readonly [
2759
2805
  Head extends TemplateLiteral.LiteralPart ? Head :
2760
- Head extends Codec<infer T, unknown, unknown, unknown> ? T
2806
+ Head extends ConstraintDecoder<infer T, unknown> ? T
2761
2807
  : never,
2762
2808
  ...Type<Tail>
2763
2809
  ]
@@ -10405,6 +10451,8 @@ const DateString = String.annotate({ expected: "a string in ISO 8601 format that
10405
10451
  * ```
10406
10452
  *
10407
10453
  * @see {@link DateValid} for accepting only valid Date instances
10454
+ * @see {@link DateFromString} for decoding strings into Date instances
10455
+ * @see {@link DateFromMillis} for decoding epoch milliseconds into Date instances
10408
10456
  *
10409
10457
  * @category Date
10410
10458
  * @since 4.0.0
@@ -10464,6 +10512,8 @@ export interface DateFromString extends decodeTo<Date, String> {
10464
10512
  *
10465
10513
  * Invalid date strings can decode to invalid `Date` instances.
10466
10514
  *
10515
+ * @see {@link DateFromMillis} for decoding epoch milliseconds into Date instances
10516
+ * @see {@link DateTimeUtcFromString} for decoding date-time strings into UTC values
10467
10517
  * @see {@link Date} for accepting Date instances directly
10468
10518
  * @see {@link DateValid} for rejecting invalid Date instances
10469
10519
  *
@@ -10472,6 +10522,47 @@ export interface DateFromString extends decodeTo<Date, String> {
10472
10522
  */
10473
10523
  export const DateFromString: DateFromString = DateString.pipe(decodeTo(Date, SchemaTransformation.dateFromString))
10474
10524
 
10525
+ /**
10526
+ * Type-level representation of {@link DateFromMillis}.
10527
+ *
10528
+ * @category Date
10529
+ * @since 4.0.0
10530
+ */
10531
+ export interface DateFromMillis extends decodeTo<Date, Number> {
10532
+ readonly "Rebuild": DateFromMillis
10533
+ }
10534
+
10535
+ /**
10536
+ * Schema that decodes epoch milliseconds into a JavaScript `Date`.
10537
+ *
10538
+ * **When to use**
10539
+ *
10540
+ * Use to model numeric millisecond timestamps that decode to JavaScript `Date`
10541
+ * objects and encode back to numbers.
10542
+ *
10543
+ * **Details**
10544
+ *
10545
+ * Decoding:
10546
+ * A number of milliseconds since the Unix epoch is decoded as a `Date`.
10547
+ *
10548
+ * Encoding:
10549
+ * A `Date` is encoded as its millisecond timestamp.
10550
+ *
10551
+ * **Gotchas**
10552
+ *
10553
+ * This schema accepts any number, including `NaN`, `Infinity`, and `-Infinity`.
10554
+ * Those values decode to invalid `Date` instances.
10555
+ *
10556
+ * @see {@link DateFromString} for decoding string-encoded dates
10557
+ * @see {@link DateTimeUtcFromMillis} for decoding epoch milliseconds into UTC values
10558
+ *
10559
+ * @category Date
10560
+ * @since 4.0.0
10561
+ */
10562
+ export const DateFromMillis: DateFromMillis = Number.pipe(
10563
+ decodeTo(Date, SchemaTransformation.dateFromMillis)
10564
+ )
10565
+
10475
10566
  /**
10476
10567
  * Type-level representation of {@link DateValid}.
10477
10568
  *
@@ -12018,6 +12109,10 @@ export interface DateTimeUtcFromString extends decodeTo<DateTimeUtc, String> {
12018
12109
  *
12019
12110
  * - A `DateTime.Utc` is encoded as a UTC ISO 8601 string.
12020
12111
  *
12112
+ * @see {@link DateTimeUtcFromDate} for decoding JavaScript Date values into UTC values
12113
+ * @see {@link DateTimeUtcFromMillis} for decoding epoch milliseconds into UTC values
12114
+ * @see {@link DateFromString} for decoding strings into JavaScript Date instances
12115
+ *
12021
12116
  * @category DateTime
12022
12117
  * @since 4.0.0
12023
12118
  */
@@ -12051,6 +12146,10 @@ export interface DateTimeUtcFromMillis extends decodeTo<instanceOf<DateTime.Utc>
12051
12146
  * Encoding:
12052
12147
  * - A `DateTime.Utc` is encoded as a number of milliseconds since the Unix epoch.
12053
12148
  *
12149
+ * @see {@link DateTimeUtcFromDate} for decoding JavaScript Date values into UTC values
12150
+ * @see {@link DateTimeUtcFromString} for decoding date-time strings into UTC values
12151
+ * @see {@link DateFromMillis} for decoding epoch milliseconds into JavaScript Date instances
12152
+ *
12054
12153
  * @category DateTime
12055
12154
  * @since 4.0.0
12056
12155
  */
@@ -12612,7 +12711,8 @@ function getClassSchemaFactory<S extends Constraint>(
12612
12711
  {
12613
12712
  identifier,
12614
12713
  [SchemaAST.ClassTypeId]: ([from]: readonly [SchemaAST.AST]) => new SchemaAST.Link(from, transformation),
12615
- toCodec: ([from]: readonly [Codec<S["Encoded"]>]) => new SchemaAST.Link(from.ast, transformation),
12714
+ toCodec: ([from]: readonly [ConstraintCodec<S["Encoded"], S["Encoded"]>]) =>
12715
+ new SchemaAST.Link(from.ast, transformation),
12616
12716
  toArbitrary: ([from]: readonly [Annotations.ToArbitrary.TypeParameter<S["Type"]>]) => () => ({
12617
12717
  arbitrary: from.arbitrary.map((args: S["Type"]) => new self(args)),
12618
12718
  terminal: from.terminal?.map((args: S["Type"]) => new self(args))
@@ -14002,8 +14102,8 @@ type XmlEncoderOptions = {
14002
14102
  * @category Canonical Codecs
14003
14103
  * @since 4.0.0
14004
14104
  */
14005
- export function toEncoderXml<T, E, RD, RE>(
14006
- codec: Codec<T, E, RD, RE>,
14105
+ export function toEncoderXml<T, RE>(
14106
+ codec: ConstraintCodec<T, unknown, unknown, RE>,
14007
14107
  options?: XmlEncoderOptions
14008
14108
  ) {
14009
14109
  const rootName = InternalAnnotations.resolveIdentifier(codec.ast) ?? InternalAnnotations.resolveTitle(codec.ast)
@@ -14338,7 +14438,7 @@ export interface overrideToCodecIso<S extends Constraint, Iso> extends
14338
14438
  * @since 4.0.0
14339
14439
  */
14340
14440
  export function overrideToCodecIso<S extends Constraint, Iso>(
14341
- to: Codec<Iso>,
14441
+ to: ConstraintCodec<Iso>,
14342
14442
  transformation: {
14343
14443
  readonly decode: SchemaGetter.Getter<S["Type"], Iso>
14344
14444
  readonly encode: SchemaGetter.Getter<Iso, S["Type"]>
@@ -14366,7 +14466,7 @@ export function overrideToCodecIso<S extends Constraint, Iso>(
14366
14466
  * @category converting
14367
14467
  * @since 4.0.0
14368
14468
  */
14369
- export function toDifferJsonPatch<T, E>(schema: Codec<T, E>): Differ<T, JsonPatch.JsonPatch> {
14469
+ export function toDifferJsonPatch<T>(schema: ConstraintCodec<T, unknown>): Differ<T, JsonPatch.JsonPatch> {
14370
14470
  const serializer = toCodecJson(schema)
14371
14471
  const get = SchemaParser.encodeSync(serializer)
14372
14472
  const set = SchemaParser.decodeSync(serializer)
@@ -170,8 +170,8 @@ export function make<S extends Schema.Constraint>(schema: S) {
170
170
  * @category Asserting
171
171
  * @since 3.10.0
172
172
  */
173
- export function is<T>(schema: Schema.Schema<T>): <I>(input: I) => input is I & T {
174
- return _is<T>(schema.ast)
173
+ export function is<S extends Schema.Constraint>(schema: S): <I>(input: I) => input is I & S["Type"] {
174
+ return _is<S["Type"]>(schema.ast)
175
175
  }
176
176
 
177
177
  /** @internal */
@@ -871,7 +871,7 @@ export const bigintFromString = new Transformation(
871
871
  * )
872
872
  * ```
873
873
  *
874
- * @see {@link numberFromString}
874
+ * @see {@link dateFromMillis}
875
875
  * @see {@link dateTimeUtcFromString}
876
876
  *
877
877
  * @category Coercions
@@ -882,6 +882,46 @@ export const dateFromString: Transformation<globalThis.Date, string> = new Trans
882
882
  SchemaGetter.transform(formatDate)
883
883
  )
884
884
 
885
+ /**
886
+ * Decodes epoch milliseconds into a `Date` and encodes a `Date` back to epoch
887
+ * milliseconds.
888
+ *
889
+ * **When to use**
890
+ *
891
+ * Use when you need a schema transformation for numeric timestamps represented
892
+ * as milliseconds since the Unix epoch.
893
+ *
894
+ * **Details**
895
+ *
896
+ * Decoding creates a `Date` from the number like `new Date(ms)`. Encoding
897
+ * returns the `Date` timestamp like `date.getTime()`.
898
+ *
899
+ * **Gotchas**
900
+ *
901
+ * This transformation does not validate date validity. `NaN`, `Infinity`, and
902
+ * `-Infinity` decode to invalid `Date` instances.
903
+ *
904
+ * **Example** (Converting milliseconds to a Date)
905
+ *
906
+ * ```ts
907
+ * import { Schema, SchemaTransformation } from "effect"
908
+ *
909
+ * const schema = Schema.Number.pipe(
910
+ * Schema.decodeTo(Schema.Date, SchemaTransformation.dateFromMillis)
911
+ * )
912
+ * ```
913
+ *
914
+ * @see {@link dateFromString}
915
+ * @see {@link SchemaGetter.dateTimeUtcFromInput}
916
+ *
917
+ * @category Coercions
918
+ * @since 4.0.0
919
+ */
920
+ export const dateFromMillis: Transformation<globalThis.Date, number> = new Transformation(
921
+ SchemaGetter.Date(),
922
+ SchemaGetter.transform((date) => date.getTime())
923
+ )
924
+
885
925
  /**
886
926
  * Decodes a `string` into a `Duration` and encodes a `Duration` back to a
887
927
  * parseable `string`.
@@ -1762,8 +1802,8 @@ export const timeZoneFromString: Transformation<DateTime.TimeZone, string> = tra
1762
1802
  * UTC, and fails with `InvalidValue` when parsing fails. Encode uses
1763
1803
  * `DateTime.formatIso`.
1764
1804
  *
1765
- * @see {@link dateTimeZonedFromString} for ISO strings that should preserve zoned date-time information
1766
1805
  * @see {@link dateFromString} for decoding into JavaScript `Date`
1806
+ * @see {@link dateTimeZonedFromString} for ISO strings that should preserve zoned date-time information
1767
1807
  *
1768
1808
  * @category transforming
1769
1809
  * @since 4.0.0
package/src/Stream.ts CHANGED
@@ -1471,7 +1471,7 @@ export const fromAsyncIterable = <A, E>(
1471
1471
  *
1472
1472
  * const program = Effect.gen(function*() {
1473
1473
  * const schedule = Schedule.spaced("50 millis").pipe(
1474
- * Schedule.both(Schedule.recurs(2))
1474
+ * Schedule.upTo({ times: 3 })
1475
1475
  * )
1476
1476
  * const stream = Stream.fromSchedule(schedule)
1477
1477
  * const values = yield* Stream.runCollect(stream)
@@ -2081,6 +2081,25 @@ export const contextWith = <R, A, E, R2>(
2081
2081
  f: (context: Context.Context<R>) => Effect.Effect<A, E, R2>
2082
2082
  ): Effect.Effect<A, E, R | R2> => withFiber((fiber) => f(fiber.context as Context.Context<R>))
2083
2083
 
2084
+ /** @internal */
2085
+ export const setContext: {
2086
+ <R>(
2087
+ context: Context.Context<R>
2088
+ ): <A, E>(
2089
+ self: Effect.Effect<A, E, R>
2090
+ ) => Effect.Effect<A, E>
2091
+ <A, E, R>(
2092
+ self: Effect.Effect<A, E, R>,
2093
+ context: Context.Context<R>
2094
+ ): Effect.Effect<A, E>
2095
+ } = dual(
2096
+ 2,
2097
+ <A, E, R>(
2098
+ self: Effect.Effect<A, E, R>,
2099
+ context: Context.Context<R>
2100
+ ): Effect.Effect<A, E> => updateContext(self, constant(context))
2101
+ )
2102
+
2084
2103
  /** @internal */
2085
2104
  export const provideContext: {
2086
2105
  <XR>(
@@ -167,7 +167,7 @@ export class Asserts<S extends Schema.Constraint> {
167
167
  *
168
168
  * @see {@link arbitrary} for checking that generated values satisfy the schema
169
169
  */
170
- verifyLosslessTransformation<S extends Schema.Codec<unknown, unknown>>(this: Asserts<S>, options?: {
170
+ verifyLosslessTransformation<S extends Schema.ConstraintCodec<unknown, unknown>>(this: Asserts<S>, options?: {
171
171
  readonly params?: FastCheck.Parameters<[S["Type"]]>
172
172
  }) {
173
173
  const decodeUnknownEffect = SchemaParser.decodeUnknownEffect(this.schema)
@@ -272,7 +272,7 @@ export class Asserts<S extends Schema.Constraint> {
272
272
  *
273
273
  * @see {@link verifyLosslessTransformation} for property-based round-trip checks
274
274
  */
275
- arbitrary<S extends Schema.Codec<unknown, unknown, never, unknown>>(this: Asserts<S>) {
275
+ arbitrary<S extends Schema.ConstraintCodec<unknown, unknown>>(this: Asserts<S>) {
276
276
  const schema = this.schema
277
277
  return {
278
278
  verifyGeneration(options?: {
@@ -336,7 +336,7 @@ export interface Service {
336
336
  */
337
337
  readonly generateObject: <
338
338
  ObjectEncoded extends Record<string, any>,
339
- ObjectSchema extends Schema.Codec<unknown, ObjectEncoded, unknown, unknown>,
339
+ ObjectSchema extends Schema.Encoder<ObjectEncoded, unknown>,
340
340
  Options extends NoExcessProperties<LanguageModel.GenerateObjectOptions<any, ObjectSchema>, Options>
341
341
  >(
342
342
  options: Options & LanguageModel.GenerateObjectOptions<LanguageModel.ExtractTools<Options>, ObjectSchema>
@@ -124,7 +124,7 @@ export interface Service {
124
124
  */
125
125
  readonly generateObject: <
126
126
  ObjectEncoded extends Record<string, any>,
127
- StructuredOutputSchema extends Schema.Codec<unknown, ObjectEncoded, unknown, unknown>,
127
+ StructuredOutputSchema extends Schema.Encoder<ObjectEncoded, unknown>,
128
128
  Options extends NoExcessProperties<
129
129
  GenerateObjectOptions<any, StructuredOutputSchema>,
130
130
  Options
@@ -835,7 +835,7 @@ export const make: (params: {
835
835
 
836
836
  const generateObject = <
837
837
  ObjectEncoded extends Record<string, any>,
838
- StructuredOutputSchema extends Schema.Codec<unknown, ObjectEncoded, unknown, unknown>,
838
+ StructuredOutputSchema extends Schema.Encoder<ObjectEncoded, unknown>,
839
839
  Options extends NoExcessProperties<
840
840
  GenerateObjectOptions<any, StructuredOutputSchema>,
841
841
  Options
@@ -1691,7 +1691,7 @@ export const generateText: {
1691
1691
  */
1692
1692
  export const generateObject = <
1693
1693
  ObjectEncoded extends Record<string, any>,
1694
- StructuredOutputSchema extends Schema.Codec<unknown, ObjectEncoded, unknown, unknown>,
1694
+ StructuredOutputSchema extends Schema.Encoder<ObjectEncoded, unknown>,
1695
1695
  Options extends NoExcessProperties<
1696
1696
  GenerateObjectOptions<any, StructuredOutputSchema>,
1697
1697
  Options
@@ -401,8 +401,8 @@ export const withDefault: {
401
401
  * @since 4.0.0
402
402
  */
403
403
  <A, const B>(
404
- self: Argument<A>,
405
- defaultValue: B | Effect.Effect<B, CliError.CliError, Environment>
404
+ self: Argument<A>,
405
+ defaultValue: B | Effect.Effect<B, CliError.CliError, Environment>
406
406
  ): Argument<A | B>
407
407
  } = Param.withDefault
408
408
 
@@ -729,8 +729,8 @@ export const mapEffect: {
729
729
  * @since 4.0.0
730
730
  */
731
731
  <A, B>(
732
- self: Argument<A>,
733
- f: (a: A) => Effect.Effect<B, CliError.CliError, Environment>
732
+ self: Argument<A>,
733
+ f: (a: A) => Effect.Effect<B, CliError.CliError, Environment>
734
734
  ): Argument<B>
735
735
  } = dual(2, <A, B>(
736
736
  self: Argument<A>,
@@ -982,7 +982,7 @@ export const withSchema: {
982
982
  * @category combinators
983
983
  * @since 4.0.0
984
984
  */
985
- <A, B>(schema: Schema.Codec<B, A, Environment, Environment>): (self: Argument<A>) => Argument<B>
985
+ <A, B>(schema: Schema.ConstraintCodec<B, A, Environment, unknown>): (self: Argument<A>) => Argument<B>
986
986
  /**
987
987
  * Validates parsed values against a Schema.
988
988
  *
@@ -1000,8 +1000,15 @@ export const withSchema: {
1000
1000
  * @category combinators
1001
1001
  * @since 4.0.0
1002
1002
  */
1003
- <A, B>(self: Argument<A>, schema: Schema.Codec<B, A, Environment, Environment>): Argument<B>
1004
- } = dual(2, <A, B>(self: Argument<A>, schema: Schema.Codec<B, A>) => Param.withSchema(self, schema))
1003
+ <A, B>(
1004
+ self: Argument<A>,
1005
+ schema: Schema.ConstraintCodec<B, A, Environment, unknown>
1006
+ ): Argument<B>
1007
+ } = dual(
1008
+ 2,
1009
+ <A, B>(self: Argument<A>, schema: Schema.ConstraintCodec<B, A, Environment, unknown>): Argument<B> =>
1010
+ Param.withSchema(self, schema)
1011
+ )
1005
1012
 
1006
1013
  /**
1007
1014
  * Creates a positional choice argument with custom value mapping.
@@ -1782,7 +1782,7 @@ export const withSchema: {
1782
1782
  * @category schemas
1783
1783
  * @since 4.0.0
1784
1784
  */
1785
- <A, B>(schema: Schema.Codec<B, A, Environment, Environment>): (self: Flag<A>) => Flag<B>
1785
+ <A, B>(schema: Schema.ConstraintCodec<B, A, Environment, unknown>): (self: Flag<A>) => Flag<B>
1786
1786
  /**
1787
1787
  * Validates and transforms a flag value using a Schema codec.
1788
1788
  *
@@ -1820,5 +1820,8 @@ export const withSchema: {
1820
1820
  * @category schemas
1821
1821
  * @since 4.0.0
1822
1822
  */
1823
- <A, B>(self: Flag<A>, schema: Schema.Codec<B, A, Environment, Environment>): Flag<B>
1824
- } = dual(2, <A, B>(self: Flag<A>, schema: Schema.Codec<B, A>) => Param.withSchema(self, schema))
1823
+ <A, B>(self: Flag<A>, schema: Schema.ConstraintCodec<B, A, Environment, unknown>): Flag<B>
1824
+ } = dual(
1825
+ 2,
1826
+ <A, B>(self: Flag<A>, schema: Schema.ConstraintCodec<B, A, Environment, unknown>) => Param.withSchema(self, schema)
1827
+ )
@@ -2430,7 +2430,7 @@ export const withSchema: {
2430
2430
  * @category combinators
2431
2431
  * @since 4.0.0
2432
2432
  */
2433
- <A, B>(schema: Schema.Codec<B, A, Environment, Environment>): <Kind extends ParamKind>(
2433
+ <A, B>(schema: Schema.ConstraintCodec<B, A, Environment, unknown>): <Kind extends ParamKind>(
2434
2434
  self: Param<Kind, A>
2435
2435
  ) => Param<Kind, B>
2436
2436
  /**
@@ -2455,10 +2455,13 @@ export const withSchema: {
2455
2455
  * @category combinators
2456
2456
  * @since 4.0.0
2457
2457
  */
2458
- <Kind extends ParamKind, A, B>(self: Param<Kind, A>, schema: Schema.Codec<B, A, Environment, Environment>): Param<Kind, B>
2458
+ <Kind extends ParamKind, A, B>(
2459
+ self: Param<Kind, A>,
2460
+ schema: Schema.ConstraintCodec<B, A, Environment, unknown>
2461
+ ): Param<Kind, B>
2459
2462
  } = dual(2, <Kind extends ParamKind, A, B>(
2460
2463
  self: Param<Kind, A>,
2461
- schema: Schema.Codec<B, A>
2464
+ schema: Schema.ConstraintCodec<B, A, Environment, unknown>
2462
2465
  ) => {
2463
2466
  const decodeParam = Schema.decodeUnknownEffect(schema)
2464
2467
  return mapEffect(self, (value) =>
@@ -105,9 +105,9 @@ const makePrimitive = <A>(
105
105
  parse
106
106
  })
107
107
 
108
- const makeSchemaPrimitive = <T, E>(
108
+ const makeSchemaPrimitive = <T>(
109
109
  tag: string,
110
- schema: Schema.Codec<T, E, Environment, Environment>
110
+ schema: Schema.ConstraintDecoder<T, Environment>
111
111
  ): Primitive<T> => {
112
112
  const toCodecStringTree = Schema.toCodecStringTree(schema)
113
113
  const decode = Schema.decodeUnknownEffect(toCodecStringTree)
@@ -147,9 +147,10 @@ export const make = <E, R>(options: {
147
147
  return Layer.merge(InitialRun, EntityLayer)
148
148
  }
149
149
 
150
- const retryPolicy = Schedule.exponential(200, 1.5).pipe(
151
- Schedule.either(Schedule.spaced("1 minute"))
152
- )
150
+ const retryPolicy = Schedule.min([
151
+ Schedule.exponential(200, 1.5),
152
+ Schedule.spaced("1 minute")
153
+ ])
153
154
 
154
155
  class CronPayload extends Schema.Class<CronPayload>("effect/cluster/ClusterCron/CronPayload")({
155
156
  dateTime: Schema.DateTimeUtc
@@ -133,6 +133,7 @@ export const make = Effect.gen(function*() {
133
133
  if (!entity) {
134
134
  return yield* Effect.die(`Workflow ${workflowName} not registered`)
135
135
  }
136
+ yield* RcMap.invalidate(clientsPartial, workflowName)
136
137
  return yield* entity.client
137
138
  }),
138
139
  idleTimeToLive: "5 minutes"
@@ -625,9 +626,10 @@ export const make = Effect.gen(function*() {
625
626
  return engine
626
627
  })
627
628
 
628
- const retryPolicy = Schedule.exponential(200, 1.5).pipe(
629
- Schedule.either(Schedule.spaced("1 minute"))
630
- )
629
+ const retryPolicy = Schedule.min([
630
+ Schedule.exponential(200, 1.5),
631
+ Schedule.spaced("1 minute")
632
+ ])
631
633
 
632
634
  const ensureSuccess = <A, E, R>(effect: Effect.Effect<A, E, R>) =>
633
635
  effect.pipe(
@@ -618,11 +618,7 @@ export const makeTestClient: <Type extends string, Rpcs extends Rpc.Any, LA, LE,
618
618
  Rpc.ServicesClient<Rpcs> | Rpc.ServicesServer<Rpcs> | Rpc.Middleware<Rpcs> | LR
619
619
  >
620
620
  readonly concurrency: number | "unbounded"
621
- readonly build: Effect.Effect<
622
- Context.Context<Rpc.ToHandler<Rpcs>>,
623
- never,
624
- Scope | CurrentAddress
625
- >
621
+ readonly build: Effect.Effect<Context.Context<Rpc.ToHandler<Rpcs>>>
626
622
  }>()
627
623
  const sharding = shardingTag.of({
628
624
  ...({} as Sharding["Service"]),
@@ -631,13 +627,7 @@ export const makeTestClient: <Type extends string, Rpcs extends Rpc.Any, LA, LE,
631
627
  entityMap.set(entity.type, {
632
628
  context: context as any,
633
629
  concurrency: options?.concurrency ?? 1,
634
- build: entity.protocol.toHandlers(handlers as any).pipe(
635
- Effect.provideContext(Context.mutate(context, (context) =>
636
- context.pipe(
637
- Context.add(CurrentRunnerAddress, runnerAddress),
638
- Context.omit(Scope)
639
- )))
640
- ) as any
630
+ build: entity.protocol.toHandlers(handlers as any) as any
641
631
  })
642
632
  return Effect.void
643
633
  })
@@ -654,8 +644,15 @@ export const makeTestClient: <Type extends string, Rpcs extends Rpc.Any, LA, LE,
654
644
  entityId: entityId as EntityId,
655
645
  shardId: makeShardId(entityId)
656
646
  })
647
+ const scope = yield* Effect.scope
648
+ const handlerContext = Context.mutate(entityEntry.context, (context) =>
649
+ context.pipe(
650
+ Context.add(CurrentRunnerAddress, runnerAddress),
651
+ Context.add(CurrentAddress, address),
652
+ Context.add(Scope, scope)
653
+ ))
657
654
  const handlers = yield* entityEntry.build.pipe(
658
- Effect.provideService(CurrentAddress, address)
655
+ Effect.setContext(handlerContext as Context.Context<any>)
659
656
  )
660
657
 
661
658
  // oxlint-disable-next-line prefer-const
@@ -665,7 +662,9 @@ export const makeTestClient: <Type extends string, Rpcs extends Rpc.Any, LA, LE,
665
662
  onFromServer(response) {
666
663
  return client.write(response)
667
664
  }
668
- }).pipe(Effect.provide(handlers))
665
+ }).pipe(
666
+ Effect.setContext(Context.merge(handlerContext, handlers))
667
+ )
669
668
 
670
669
  client = yield* RpcClient.makeNoSerialization(entity.protocol, {
671
670
  supportsAck: true,