effect 4.0.0-beta.94 → 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 (410) 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.map +1 -1
  14. package/dist/Config.js.map +1 -1
  15. package/dist/ConfigProvider.d.ts +44 -6
  16. package/dist/ConfigProvider.d.ts.map +1 -1
  17. package/dist/ConfigProvider.js +63 -24
  18. package/dist/ConfigProvider.js.map +1 -1
  19. package/dist/Console.d.ts.map +1 -1
  20. package/dist/Context.d.ts.map +1 -1
  21. package/dist/Cron.d.ts +4 -1
  22. package/dist/Cron.d.ts.map +1 -1
  23. package/dist/Cron.js +98 -53
  24. package/dist/Cron.js.map +1 -1
  25. package/dist/Crypto.d.ts.map +1 -1
  26. package/dist/Data.d.ts.map +1 -1
  27. package/dist/DateTime.d.ts +12 -12
  28. package/dist/DateTime.d.ts.map +1 -1
  29. package/dist/Deferred.d.ts.map +1 -1
  30. package/dist/Duration.d.ts.map +1 -1
  31. package/dist/Effect.d.ts.map +1 -1
  32. package/dist/Effectable.d.ts.map +1 -1
  33. package/dist/Encoding.d.ts.map +1 -1
  34. package/dist/Equal.d.ts.map +1 -1
  35. package/dist/Equivalence.d.ts.map +1 -1
  36. package/dist/ErrorReporter.d.ts.map +1 -1
  37. package/dist/ExecutionPlan.d.ts +2 -2
  38. package/dist/ExecutionPlan.d.ts.map +1 -1
  39. package/dist/Fiber.d.ts.map +1 -1
  40. package/dist/FiberHandle.d.ts +8 -8
  41. package/dist/FiberHandle.d.ts.map +1 -1
  42. package/dist/FiberMap.d.ts +8 -8
  43. package/dist/FiberMap.d.ts.map +1 -1
  44. package/dist/FiberSet.d.ts +4 -4
  45. package/dist/FiberSet.d.ts.map +1 -1
  46. package/dist/FileSystem.d.ts.map +1 -1
  47. package/dist/Filter.d.ts.map +1 -1
  48. package/dist/Function.d.ts.map +1 -1
  49. package/dist/Graph.d.ts.map +1 -1
  50. package/dist/Graph.js.map +1 -1
  51. package/dist/Hash.d.ts.map +1 -1
  52. package/dist/HashMap.d.ts.map +1 -1
  53. package/dist/HashRing.d.ts.map +1 -1
  54. package/dist/Inspectable.d.ts.map +1 -1
  55. package/dist/Inspectable.js.map +1 -1
  56. package/dist/Iterable.d.ts.map +1 -1
  57. package/dist/Latch.d.ts.map +1 -1
  58. package/dist/Layer.d.ts.map +1 -1
  59. package/dist/LayerMap.d.ts.map +1 -1
  60. package/dist/LayerRef.d.ts +1 -1
  61. package/dist/LayerRef.d.ts.map +1 -1
  62. package/dist/LogLevel.d.ts.map +1 -1
  63. package/dist/Logger.d.ts.map +1 -1
  64. package/dist/ManagedRuntime.d.ts.map +1 -1
  65. package/dist/Metric.d.ts.map +1 -1
  66. package/dist/MutableHashMap.d.ts.map +1 -1
  67. package/dist/MutableHashSet.d.ts.map +1 -1
  68. package/dist/MutableList.d.ts.map +1 -1
  69. package/dist/MutableRef.d.ts.map +1 -1
  70. package/dist/NonEmptyIterable.d.ts.map +1 -1
  71. package/dist/Number.d.ts.map +1 -1
  72. package/dist/Optic.d.ts.map +1 -1
  73. package/dist/Option.d.ts.map +1 -1
  74. package/dist/Order.d.ts.map +1 -1
  75. package/dist/Ordering.d.ts.map +1 -1
  76. package/dist/PartitionedSemaphore.d.ts.map +1 -1
  77. package/dist/Pipeable.d.ts.map +1 -1
  78. package/dist/PlatformError.d.ts.map +1 -1
  79. package/dist/Pool.d.ts.map +1 -1
  80. package/dist/PrimaryKey.d.ts.map +1 -1
  81. package/dist/PubSub.d.ts.map +1 -1
  82. package/dist/Pull.d.ts.map +1 -1
  83. package/dist/Queue.d.ts.map +1 -1
  84. package/dist/Random.d.ts.map +1 -1
  85. package/dist/RcMap.d.ts.map +1 -1
  86. package/dist/Record.d.ts.map +1 -1
  87. package/dist/Redactable.d.ts.map +1 -1
  88. package/dist/Redacted.d.ts.map +1 -1
  89. package/dist/Ref.d.ts.map +1 -1
  90. package/dist/RegExp.d.ts.map +1 -1
  91. package/dist/Request.d.ts +1 -1
  92. package/dist/Request.d.ts.map +1 -1
  93. package/dist/RequestResolver.d.ts.map +1 -1
  94. package/dist/Resource.d.ts.map +1 -1
  95. package/dist/Result.d.ts.map +1 -1
  96. package/dist/Runtime.d.ts.map +1 -1
  97. package/dist/Schedule.d.ts +1206 -4013
  98. package/dist/Schedule.d.ts.map +1 -1
  99. package/dist/Schedule.js +244 -1348
  100. package/dist/Schedule.js.map +1 -1
  101. package/dist/Scheduler.d.ts.map +1 -1
  102. package/dist/Scheduler.js.map +1 -1
  103. package/dist/Schema.d.ts +49 -0
  104. package/dist/Schema.d.ts.map +1 -1
  105. package/dist/Schema.js +40 -0
  106. package/dist/Schema.js.map +1 -1
  107. package/dist/SchemaAST.d.ts.map +1 -1
  108. package/dist/SchemaAST.js.map +1 -1
  109. package/dist/SchemaGetter.d.ts.map +1 -1
  110. package/dist/SchemaIssue.d.ts.map +1 -1
  111. package/dist/SchemaIssue.js.map +1 -1
  112. package/dist/SchemaParser.d.ts.map +1 -1
  113. package/dist/SchemaRepresentation.d.ts +106 -106
  114. package/dist/SchemaTransformation.d.ts +38 -2
  115. package/dist/SchemaTransformation.d.ts.map +1 -1
  116. package/dist/SchemaTransformation.js +38 -2
  117. package/dist/SchemaTransformation.js.map +1 -1
  118. package/dist/ScopedCache.d.ts.map +1 -1
  119. package/dist/ScopedRef.d.ts.map +1 -1
  120. package/dist/Semaphore.d.ts.map +1 -1
  121. package/dist/Sink.d.ts.map +1 -1
  122. package/dist/Stdio.d.ts.map +1 -1
  123. package/dist/Stream.d.ts +2 -2
  124. package/dist/Stream.d.ts.map +1 -1
  125. package/dist/Stream.js +1 -1
  126. package/dist/String.d.ts.map +1 -1
  127. package/dist/String.js.map +1 -1
  128. package/dist/Struct.d.ts.map +1 -1
  129. package/dist/SubscriptionRef.d.ts.map +1 -1
  130. package/dist/SynchronizedRef.d.ts.map +1 -1
  131. package/dist/Take.d.ts.map +1 -1
  132. package/dist/Terminal.d.ts.map +1 -1
  133. package/dist/Tracer.d.ts.map +1 -1
  134. package/dist/Trie.d.ts.map +1 -1
  135. package/dist/Tuple.d.ts.map +1 -1
  136. package/dist/TxChunk.d.ts.map +1 -1
  137. package/dist/TxDeferred.d.ts.map +1 -1
  138. package/dist/TxHashMap.d.ts.map +1 -1
  139. package/dist/TxHashSet.d.ts.map +1 -1
  140. package/dist/TxPriorityQueue.d.ts.map +1 -1
  141. package/dist/TxPubSub.d.ts.map +1 -1
  142. package/dist/TxQueue.d.ts.map +1 -1
  143. package/dist/TxReentrantLock.d.ts.map +1 -1
  144. package/dist/TxRef.d.ts.map +1 -1
  145. package/dist/TxSemaphore.d.ts.map +1 -1
  146. package/dist/TxSubscriptionRef.d.ts.map +1 -1
  147. package/dist/Types.d.ts +1 -1
  148. package/dist/Types.d.ts.map +1 -1
  149. package/dist/UndefinedOr.d.ts.map +1 -1
  150. package/dist/Utils.d.ts.map +1 -1
  151. package/dist/internal/effect.js.map +1 -1
  152. package/dist/internal/schema/schema.d.ts.map +1 -1
  153. package/dist/testing/TestClock.d.ts.map +1 -1
  154. package/dist/testing/TestConsole.d.ts.map +1 -1
  155. package/dist/testing/TestSchema.d.ts.map +1 -1
  156. package/dist/unstable/ai/AiError.d.ts +1 -1
  157. package/dist/unstable/ai/AiError.d.ts.map +1 -1
  158. package/dist/unstable/ai/Chat.d.ts +1 -1
  159. package/dist/unstable/ai/Chat.d.ts.map +1 -1
  160. package/dist/unstable/ai/IdGenerator.d.ts.map +1 -1
  161. package/dist/unstable/ai/LanguageModel.d.ts.map +1 -1
  162. package/dist/unstable/ai/McpSchema.d.ts +221 -221
  163. package/dist/unstable/ai/McpSchema.d.ts.map +1 -1
  164. package/dist/unstable/ai/McpServer.d.ts.map +1 -1
  165. package/dist/unstable/ai/Model.d.ts.map +1 -1
  166. package/dist/unstable/ai/Prompt.d.ts.map +1 -1
  167. package/dist/unstable/ai/Response.d.ts.map +1 -1
  168. package/dist/unstable/ai/Telemetry.d.ts.map +1 -1
  169. package/dist/unstable/ai/Tokenizer.d.ts.map +1 -1
  170. package/dist/unstable/ai/Tool.d.ts.map +1 -1
  171. package/dist/unstable/ai/Toolkit.d.ts.map +1 -1
  172. package/dist/unstable/cli/Argument.d.ts.map +1 -1
  173. package/dist/unstable/cli/CliError.d.ts.map +1 -1
  174. package/dist/unstable/cli/CliOutput.d.ts.map +1 -1
  175. package/dist/unstable/cli/Command.d.ts.map +1 -1
  176. package/dist/unstable/cli/Completions.d.ts.map +1 -1
  177. package/dist/unstable/cli/Flag.d.ts.map +1 -1
  178. package/dist/unstable/cli/GlobalFlag.d.ts.map +1 -1
  179. package/dist/unstable/cli/Param.d.ts.map +1 -1
  180. package/dist/unstable/cli/Primitive.d.ts.map +1 -1
  181. package/dist/unstable/cli/Prompt.d.ts.map +1 -1
  182. package/dist/unstable/cli/Prompt.js.map +1 -1
  183. package/dist/unstable/cli/internal/ansi.d.ts.map +1 -1
  184. package/dist/unstable/cli/internal/ansi.js.map +1 -1
  185. package/dist/unstable/cli/internal/command.d.ts.map +1 -1
  186. package/dist/unstable/cli/internal/help.d.ts.map +1 -1
  187. package/dist/unstable/cli/internal/parser.js.map +1 -1
  188. package/dist/unstable/cluster/ClusterCron.d.ts.map +1 -1
  189. package/dist/unstable/cluster/ClusterCron.js +1 -1
  190. package/dist/unstable/cluster/ClusterCron.js.map +1 -1
  191. package/dist/unstable/cluster/ClusterError.d.ts.map +1 -1
  192. package/dist/unstable/cluster/ClusterSchema.d.ts +1 -1
  193. package/dist/unstable/cluster/ClusterSchema.d.ts.map +1 -1
  194. package/dist/unstable/cluster/ClusterWorkflowEngine.d.ts +1 -1
  195. package/dist/unstable/cluster/ClusterWorkflowEngine.d.ts.map +1 -1
  196. package/dist/unstable/cluster/ClusterWorkflowEngine.js +1 -1
  197. package/dist/unstable/cluster/ClusterWorkflowEngine.js.map +1 -1
  198. package/dist/unstable/cluster/DeliverAt.d.ts.map +1 -1
  199. package/dist/unstable/cluster/Entity.d.ts.map +1 -1
  200. package/dist/unstable/cluster/EntityAddress.d.ts.map +1 -1
  201. package/dist/unstable/cluster/EntityId.d.ts.map +1 -1
  202. package/dist/unstable/cluster/EntityProxy.d.ts.map +1 -1
  203. package/dist/unstable/cluster/EntityProxyServer.d.ts.map +1 -1
  204. package/dist/unstable/cluster/EntityType.d.ts.map +1 -1
  205. package/dist/unstable/cluster/Envelope.d.ts.map +1 -1
  206. package/dist/unstable/cluster/HttpRunner.d.ts.map +1 -1
  207. package/dist/unstable/cluster/MachineId.d.ts.map +1 -1
  208. package/dist/unstable/cluster/Message.d.ts.map +1 -1
  209. package/dist/unstable/cluster/MessageStorage.d.ts +25 -29
  210. package/dist/unstable/cluster/MessageStorage.d.ts.map +1 -1
  211. package/dist/unstable/cluster/Reply.d.ts.map +1 -1
  212. package/dist/unstable/cluster/Runner.d.ts.map +1 -1
  213. package/dist/unstable/cluster/RunnerAddress.d.ts.map +1 -1
  214. package/dist/unstable/cluster/RunnerHealth.d.ts.map +1 -1
  215. package/dist/unstable/cluster/RunnerServer.d.ts +1 -1
  216. package/dist/unstable/cluster/RunnerStorage.d.ts.map +1 -1
  217. package/dist/unstable/cluster/Runners.d.ts +8 -8
  218. package/dist/unstable/cluster/ShardId.d.ts.map +1 -1
  219. package/dist/unstable/cluster/Sharding.js +3 -4
  220. package/dist/unstable/cluster/Sharding.js.map +1 -1
  221. package/dist/unstable/cluster/ShardingConfig.d.ts.map +1 -1
  222. package/dist/unstable/cluster/ShardingRegistrationEvent.d.ts +6 -8
  223. package/dist/unstable/cluster/ShardingRegistrationEvent.d.ts.map +1 -1
  224. package/dist/unstable/cluster/SingleRunner.d.ts.map +1 -1
  225. package/dist/unstable/cluster/Singleton.d.ts.map +1 -1
  226. package/dist/unstable/cluster/SingletonAddress.d.ts.map +1 -1
  227. package/dist/unstable/cluster/Snowflake.d.ts +1 -1
  228. package/dist/unstable/cluster/Snowflake.d.ts.map +1 -1
  229. package/dist/unstable/cluster/Snowflake.js +1 -1
  230. package/dist/unstable/cluster/Snowflake.js.map +1 -1
  231. package/dist/unstable/cluster/SqlMessageStorage.d.ts.map +1 -1
  232. package/dist/unstable/cluster/SqlRunnerStorage.d.ts +1 -1
  233. package/dist/unstable/cluster/SqlRunnerStorage.d.ts.map +1 -1
  234. package/dist/unstable/cluster/internal/entityManager.js +11 -12
  235. package/dist/unstable/cluster/internal/entityManager.js.map +1 -1
  236. package/dist/unstable/devtools/DevTools.d.ts.map +1 -1
  237. package/dist/unstable/encoding/Msgpack.d.ts.map +1 -1
  238. package/dist/unstable/encoding/Ndjson.d.ts.map +1 -1
  239. package/dist/unstable/encoding/Sse.d.ts.map +1 -1
  240. package/dist/unstable/eventlog/Event.d.ts.map +1 -1
  241. package/dist/unstable/eventlog/EventGroup.d.ts.map +1 -1
  242. package/dist/unstable/eventlog/EventJournal.d.ts.map +1 -1
  243. package/dist/unstable/eventlog/EventJournal.js.map +1 -1
  244. package/dist/unstable/eventlog/EventLog.d.ts.map +1 -1
  245. package/dist/unstable/eventlog/EventLog.js +2 -2
  246. package/dist/unstable/eventlog/EventLog.js.map +1 -1
  247. package/dist/unstable/eventlog/EventLogEncryption.d.ts.map +1 -1
  248. package/dist/unstable/eventlog/EventLogMessage.d.ts.map +1 -1
  249. package/dist/unstable/eventlog/EventLogRemote.d.ts +21 -21
  250. package/dist/unstable/eventlog/EventLogServer.d.ts.map +1 -1
  251. package/dist/unstable/eventlog/EventLogServerEncrypted.d.ts +1 -1
  252. package/dist/unstable/eventlog/EventLogServerUnencrypted.d.ts +3 -4
  253. package/dist/unstable/eventlog/EventLogServerUnencrypted.d.ts.map +1 -1
  254. package/dist/unstable/eventlog/EventLogSessionAuth.d.ts.map +1 -1
  255. package/dist/unstable/eventlog/SqlEventJournal.d.ts.map +1 -1
  256. package/dist/unstable/eventlog/SqlEventLogServerEncrypted.d.ts.map +1 -1
  257. package/dist/unstable/eventlog/SqlEventLogServerUnencrypted.d.ts.map +1 -1
  258. package/dist/unstable/http/Cookies.d.ts +1 -1
  259. package/dist/unstable/http/Cookies.d.ts.map +1 -1
  260. package/dist/unstable/http/Etag.d.ts.map +1 -1
  261. package/dist/unstable/http/Headers.d.ts.map +1 -1
  262. package/dist/unstable/http/HttpBody.d.ts.map +1 -1
  263. package/dist/unstable/http/HttpClient.d.ts.map +1 -1
  264. package/dist/unstable/http/HttpClientError.d.ts +1 -1
  265. package/dist/unstable/http/HttpClientError.d.ts.map +1 -1
  266. package/dist/unstable/http/HttpClientRequest.d.ts.map +1 -1
  267. package/dist/unstable/http/HttpClientResponse.d.ts.map +1 -1
  268. package/dist/unstable/http/HttpEffect.d.ts.map +1 -1
  269. package/dist/unstable/http/HttpIncomingMessage.d.ts.map +1 -1
  270. package/dist/unstable/http/HttpMethod.d.ts.map +1 -1
  271. package/dist/unstable/http/HttpMiddleware.d.ts +1 -1
  272. package/dist/unstable/http/HttpMiddleware.d.ts.map +1 -1
  273. package/dist/unstable/http/HttpRouter.d.ts.map +1 -1
  274. package/dist/unstable/http/HttpServer.d.ts.map +1 -1
  275. package/dist/unstable/http/HttpServerError.d.ts +1 -1
  276. package/dist/unstable/http/HttpServerError.d.ts.map +1 -1
  277. package/dist/unstable/http/HttpServerRequest.d.ts +2 -2
  278. package/dist/unstable/http/HttpServerRequest.d.ts.map +1 -1
  279. package/dist/unstable/http/HttpServerRespondable.d.ts.map +1 -1
  280. package/dist/unstable/http/HttpServerResponse.d.ts.map +1 -1
  281. package/dist/unstable/http/HttpStaticServer.d.ts.map +1 -1
  282. package/dist/unstable/http/HttpTraceContext.d.ts.map +1 -1
  283. package/dist/unstable/http/Multipart.d.ts +2 -1
  284. package/dist/unstable/http/Multipart.d.ts.map +1 -1
  285. package/dist/unstable/http/Url.d.ts.map +1 -1
  286. package/dist/unstable/http/UrlParams.d.ts.map +1 -1
  287. package/dist/unstable/httpapi/HttpApi.d.ts.map +1 -1
  288. package/dist/unstable/httpapi/HttpApiBuilder.d.ts.map +1 -1
  289. package/dist/unstable/httpapi/HttpApiClient.d.ts.map +1 -1
  290. package/dist/unstable/httpapi/HttpApiEndpoint.d.ts +22 -22
  291. package/dist/unstable/httpapi/HttpApiEndpoint.d.ts.map +1 -1
  292. package/dist/unstable/httpapi/HttpApiError.d.ts +1 -1
  293. package/dist/unstable/httpapi/HttpApiError.d.ts.map +1 -1
  294. package/dist/unstable/httpapi/HttpApiGroup.d.ts.map +1 -1
  295. package/dist/unstable/httpapi/HttpApiMiddleware.d.ts.map +1 -1
  296. package/dist/unstable/httpapi/HttpApiScalar.d.ts.map +1 -1
  297. package/dist/unstable/httpapi/HttpApiSchema.d.ts.map +1 -1
  298. package/dist/unstable/httpapi/HttpApiSecurity.d.ts.map +1 -1
  299. package/dist/unstable/httpapi/HttpApiSwagger.d.ts.map +1 -1
  300. package/dist/unstable/httpapi/HttpApiTest.d.ts +1 -1
  301. package/dist/unstable/observability/Otlp.d.ts.map +1 -1
  302. package/dist/unstable/observability/OtlpExporter.js +3 -1
  303. package/dist/unstable/observability/OtlpExporter.js.map +1 -1
  304. package/dist/unstable/observability/OtlpLogger.d.ts.map +1 -1
  305. package/dist/unstable/observability/OtlpMetrics.d.ts.map +1 -1
  306. package/dist/unstable/observability/OtlpResource.d.ts.map +1 -1
  307. package/dist/unstable/observability/OtlpTracer.d.ts.map +1 -1
  308. package/dist/unstable/observability/PrometheusMetrics.d.ts.map +1 -1
  309. package/dist/unstable/observability/internal/otlpEnv.d.ts.map +1 -1
  310. package/dist/unstable/persistence/KeyValueStore.d.ts.map +1 -1
  311. package/dist/unstable/persistence/KeyValueStore.js.map +1 -1
  312. package/dist/unstable/persistence/Persistable.d.ts.map +1 -1
  313. package/dist/unstable/persistence/PersistedQueue.d.ts +1 -1
  314. package/dist/unstable/persistence/PersistedQueue.d.ts.map +1 -1
  315. package/dist/unstable/persistence/Persistence.d.ts.map +1 -1
  316. package/dist/unstable/persistence/RateLimiter.d.ts.map +1 -1
  317. package/dist/unstable/persistence/Redis.d.ts.map +1 -1
  318. package/dist/unstable/process/ChildProcess.d.ts.map +1 -1
  319. package/dist/unstable/process/ChildProcess.js.map +1 -1
  320. package/dist/unstable/process/ChildProcessSpawner.d.ts.map +1 -1
  321. package/dist/unstable/reactivity/AsyncResult.d.ts +2 -2
  322. package/dist/unstable/reactivity/AsyncResult.d.ts.map +1 -1
  323. package/dist/unstable/reactivity/Atom.d.ts.map +1 -1
  324. package/dist/unstable/reactivity/AtomHttpApi.d.ts.map +1 -1
  325. package/dist/unstable/reactivity/AtomRef.d.ts.map +1 -1
  326. package/dist/unstable/reactivity/AtomRegistry.d.ts +2 -2
  327. package/dist/unstable/reactivity/AtomRegistry.d.ts.map +1 -1
  328. package/dist/unstable/reactivity/AtomRegistry.js +28 -37
  329. package/dist/unstable/reactivity/AtomRegistry.js.map +1 -1
  330. package/dist/unstable/reactivity/AtomRpc.d.ts.map +1 -1
  331. package/dist/unstable/reactivity/Hydration.d.ts.map +1 -1
  332. package/dist/unstable/reactivity/Reactivity.d.ts.map +1 -1
  333. package/dist/unstable/rpc/Rpc.d.ts.map +1 -1
  334. package/dist/unstable/rpc/RpcClient.d.ts +2 -1
  335. package/dist/unstable/rpc/RpcClient.d.ts.map +1 -1
  336. package/dist/unstable/rpc/RpcClient.js +5 -5
  337. package/dist/unstable/rpc/RpcClient.js.map +1 -1
  338. package/dist/unstable/rpc/RpcGroup.d.ts.map +1 -1
  339. package/dist/unstable/rpc/RpcMessage.d.ts +7 -7
  340. package/dist/unstable/rpc/RpcMessage.d.ts.map +1 -1
  341. package/dist/unstable/rpc/RpcMessage.js +2 -2
  342. package/dist/unstable/rpc/RpcMessage.js.map +1 -1
  343. package/dist/unstable/rpc/RpcMiddleware.d.ts.map +1 -1
  344. package/dist/unstable/rpc/RpcSchema.d.ts +1 -1
  345. package/dist/unstable/rpc/RpcSerialization.d.ts.map +1 -1
  346. package/dist/unstable/rpc/RpcSerialization.js +8 -8
  347. package/dist/unstable/rpc/RpcSerialization.js.map +1 -1
  348. package/dist/unstable/rpc/RpcServer.d.ts +2 -2
  349. package/dist/unstable/rpc/RpcServer.d.ts.map +1 -1
  350. package/dist/unstable/rpc/RpcServer.js +5 -5
  351. package/dist/unstable/rpc/RpcServer.js.map +1 -1
  352. package/dist/unstable/rpc/RpcWorker.d.ts.map +1 -1
  353. package/dist/unstable/rpc/Utils.d.ts.map +1 -1
  354. package/dist/unstable/schema/Model.d.ts +24 -38
  355. package/dist/unstable/schema/Model.d.ts.map +1 -1
  356. package/dist/unstable/schema/VariantSchema.d.ts +1 -1
  357. package/dist/unstable/schema/VariantSchema.d.ts.map +1 -1
  358. package/dist/unstable/socket/Socket.d.ts +1 -1
  359. package/dist/unstable/socket/Socket.d.ts.map +1 -1
  360. package/dist/unstable/socket/SocketServer.d.ts.map +1 -1
  361. package/dist/unstable/sql/Migrator.d.ts.map +1 -1
  362. package/dist/unstable/sql/SqlClient.d.ts.map +1 -1
  363. package/dist/unstable/sql/SqlError.d.ts +2 -2
  364. package/dist/unstable/sql/SqlError.d.ts.map +1 -1
  365. package/dist/unstable/sql/SqlError.js.map +1 -1
  366. package/dist/unstable/sql/SqlModel.d.ts.map +1 -1
  367. package/dist/unstable/sql/SqlResolver.d.ts.map +1 -1
  368. package/dist/unstable/sql/SqlSchema.d.ts.map +1 -1
  369. package/dist/unstable/sql/SqlStream.d.ts.map +1 -1
  370. package/dist/unstable/sql/Statement.d.ts.map +1 -1
  371. package/dist/unstable/workers/Transferable.d.ts.map +1 -1
  372. package/dist/unstable/workers/Worker.d.ts.map +1 -1
  373. package/dist/unstable/workers/WorkerError.d.ts.map +1 -1
  374. package/dist/unstable/workflow/Activity.d.ts +1 -1
  375. package/dist/unstable/workflow/Activity.d.ts.map +1 -1
  376. package/dist/unstable/workflow/Activity.js +1 -1
  377. package/dist/unstable/workflow/Activity.js.map +1 -1
  378. package/dist/unstable/workflow/DurableClock.d.ts.map +1 -1
  379. package/dist/unstable/workflow/DurableDeferred.d.ts.map +1 -1
  380. package/dist/unstable/workflow/DurableQueue.d.ts.map +1 -1
  381. package/dist/unstable/workflow/DurableQueue.js +1 -1
  382. package/dist/unstable/workflow/DurableQueue.js.map +1 -1
  383. package/dist/unstable/workflow/Workflow.d.ts.map +1 -1
  384. package/dist/unstable/workflow/WorkflowEngine.d.ts.map +1 -1
  385. package/dist/unstable/workflow/WorkflowEngine.js +1 -1
  386. package/dist/unstable/workflow/WorkflowEngine.js.map +1 -1
  387. package/dist/unstable/workflow/WorkflowProxy.d.ts.map +1 -1
  388. package/dist/unstable/workflow/WorkflowProxyServer.d.ts.map +1 -1
  389. package/package.json +11 -12
  390. package/src/ConfigProvider.ts +79 -27
  391. package/src/Cron.ts +109 -57
  392. package/src/Schedule.ts +1437 -4445
  393. package/src/Schema.ts +53 -0
  394. package/src/SchemaTransformation.ts +42 -2
  395. package/src/Stream.ts +1 -1
  396. package/src/unstable/cluster/ClusterCron.ts +4 -3
  397. package/src/unstable/cluster/ClusterWorkflowEngine.ts +4 -3
  398. package/src/unstable/cluster/Sharding.ts +4 -4
  399. package/src/unstable/cluster/Snowflake.ts +2 -2
  400. package/src/unstable/cluster/internal/entityManager.ts +16 -16
  401. package/src/unstable/eventlog/EventLog.ts +4 -3
  402. package/src/unstable/observability/OtlpExporter.ts +1 -1
  403. package/src/unstable/reactivity/AtomRegistry.ts +35 -44
  404. package/src/unstable/rpc/RpcClient.ts +10 -9
  405. package/src/unstable/rpc/RpcMessage.ts +8 -9
  406. package/src/unstable/rpc/RpcSerialization.ts +16 -16
  407. package/src/unstable/rpc/RpcServer.ts +5 -5
  408. package/src/unstable/workflow/Activity.ts +6 -5
  409. package/src/unstable/workflow/DurableQueue.ts +4 -3
  410. package/src/unstable/workflow/WorkflowEngine.ts +4 -3
package/src/Schema.ts CHANGED
@@ -10451,6 +10451,8 @@ const DateString = String.annotate({ expected: "a string in ISO 8601 format that
10451
10451
  * ```
10452
10452
  *
10453
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
10454
10456
  *
10455
10457
  * @category Date
10456
10458
  * @since 4.0.0
@@ -10510,6 +10512,8 @@ export interface DateFromString extends decodeTo<Date, String> {
10510
10512
  *
10511
10513
  * Invalid date strings can decode to invalid `Date` instances.
10512
10514
  *
10515
+ * @see {@link DateFromMillis} for decoding epoch milliseconds into Date instances
10516
+ * @see {@link DateTimeUtcFromString} for decoding date-time strings into UTC values
10513
10517
  * @see {@link Date} for accepting Date instances directly
10514
10518
  * @see {@link DateValid} for rejecting invalid Date instances
10515
10519
  *
@@ -10518,6 +10522,47 @@ export interface DateFromString extends decodeTo<Date, String> {
10518
10522
  */
10519
10523
  export const DateFromString: DateFromString = DateString.pipe(decodeTo(Date, SchemaTransformation.dateFromString))
10520
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
+
10521
10566
  /**
10522
10567
  * Type-level representation of {@link DateValid}.
10523
10568
  *
@@ -12064,6 +12109,10 @@ export interface DateTimeUtcFromString extends decodeTo<DateTimeUtc, String> {
12064
12109
  *
12065
12110
  * - A `DateTime.Utc` is encoded as a UTC ISO 8601 string.
12066
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
+ *
12067
12116
  * @category DateTime
12068
12117
  * @since 4.0.0
12069
12118
  */
@@ -12097,6 +12146,10 @@ export interface DateTimeUtcFromMillis extends decodeTo<instanceOf<DateTime.Utc>
12097
12146
  * Encoding:
12098
12147
  * - A `DateTime.Utc` is encoded as a number of milliseconds since the Unix epoch.
12099
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
+ *
12100
12153
  * @category DateTime
12101
12154
  * @since 4.0.0
12102
12155
  */
@@ -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)
@@ -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
@@ -626,9 +626,10 @@ export const make = Effect.gen(function*() {
626
626
  return engine
627
627
  })
628
628
 
629
- const retryPolicy = Schedule.exponential(200, 1.5).pipe(
630
- Schedule.either(Schedule.spaced("1 minute"))
631
- )
629
+ const retryPolicy = Schedule.min([
630
+ Schedule.exponential(200, 1.5),
631
+ Schedule.spaced("1 minute")
632
+ ])
632
633
 
633
634
  const ensureSuccess = <A, E, R>(effect: Effect.Effect<A, E, R>) =>
634
635
  effect.pipe(
@@ -38,7 +38,7 @@ import * as Semaphore from "../../Semaphore.ts"
38
38
  import * as Stream from "../../Stream.ts"
39
39
  import type * as Rpc from "../rpc/Rpc.ts"
40
40
  import * as RpcClient from "../rpc/RpcClient.ts"
41
- import { type FromServer, RequestId } from "../rpc/RpcMessage.ts"
41
+ import type { FromServer } from "../rpc/RpcMessage.ts"
42
42
  import type { MailboxFull, PersistenceError } from "./ClusterError.ts"
43
43
  import { AlreadyProcessingMessage, EntityNotAssignedToRunner } from "./ClusterError.ts"
44
44
  import * as ClusterMetrics from "./ClusterMetrics.ts"
@@ -1040,7 +1040,7 @@ const make = Effect.gen(function*() {
1040
1040
  spanPrefix: `${entity.type}.client`,
1041
1041
  disableTracing: !Context.get(entity.protocol.annotations, ClusterSchema.ClientTracingEnabled),
1042
1042
  supportsAck: true,
1043
- generateRequestId: () => RequestId(snowflakeGen.nextUnsafe()),
1043
+ generateRequestId: () => snowflakeGen.nextUnsafe() as any,
1044
1044
  flatten: true,
1045
1045
  onFromClient(options): Effect.Effect<
1046
1046
  void,
@@ -1199,7 +1199,7 @@ const make = Effect.gen(function*() {
1199
1199
  return write({
1200
1200
  _tag: "Chunk",
1201
1201
  clientId: 0,
1202
- requestId: RequestId(reply.requestId),
1202
+ requestId: reply.requestId as any,
1203
1203
  values: reply.values
1204
1204
  })
1205
1205
  }
@@ -1208,7 +1208,7 @@ const make = Effect.gen(function*() {
1208
1208
  return write({
1209
1209
  _tag: "Exit",
1210
1210
  clientId: 0,
1211
- requestId: RequestId(reply.requestId),
1211
+ requestId: reply.requestId as any,
1212
1212
  exit: reply.exit
1213
1213
  })
1214
1214
  }
@@ -53,8 +53,8 @@ export type Snowflake = Brand.Branded<bigint, TypeId>
53
53
  * @category constructors
54
54
  * @since 4.0.0
55
55
  */
56
- export const Snowflake = (input: string | bigint): Snowflake =>
57
- typeof input === "string" ? BigInt(input) as Snowflake : input as Snowflake
56
+ export const Snowflake = (input: string | number | bigint): Snowflake =>
57
+ typeof input === "bigint" ? input as Snowflake : BigInt(input) as Snowflake
58
58
 
59
59
  /**
60
60
  * Namespace containing support types for snowflake parts and generators.
@@ -18,7 +18,6 @@ import * as Schema from "../../../Schema.ts"
18
18
  import * as SchemaIssue from "../../../SchemaIssue.ts"
19
19
  import * as Scope from "../../../Scope.ts"
20
20
  import type * as Rpc from "../../rpc/Rpc.ts"
21
- import { RequestId } from "../../rpc/RpcMessage.ts"
22
21
  import * as RpcServer from "../../rpc/RpcServer.ts"
23
22
  import { AlreadyProcessingMessage, EntityNotAssignedToRunner, MailboxFull, MalformedMessage } from "../ClusterError.ts"
24
23
  import * as ClusterMetrics from "../ClusterMetrics.ts"
@@ -67,7 +66,7 @@ export interface EntityManager {
67
66
  export type EntityState = {
68
67
  readonly address: EntityAddress
69
68
  readonly scope: Scope.Scope
70
- readonly activeRequests: Map<bigint, {
69
+ readonly activeRequests: Map<Snowflake.Snowflake, {
71
70
  readonly rpc: Rpc.AnyWithProps
72
71
  readonly message: Message.IncomingRequestLocal<any>
73
72
  sentReply: boolean
@@ -145,7 +144,7 @@ export const make = Effect.fnUntraced(function*<
145
144
  )
146
145
 
147
146
  const activeRequests: EntityState["activeRequests"] = new Map()
148
- let defectRequestIds = new Set<bigint>()
147
+ let defectRequestIds = new Set<Snowflake.Snowflake>()
149
148
  let isRestartingDueToDefect = false
150
149
 
151
150
  // the server is stored in a ref, so if there is a defect, we can
@@ -184,7 +183,7 @@ export const make = Effect.fnUntraced(function*<
184
183
  onFromServer(response): Effect.Effect<void> {
185
184
  switch (response._tag) {
186
185
  case "Exit": {
187
- const request = activeRequests.get(response.requestId)
186
+ const request = activeRequests.get(Snowflake.Snowflake(response.requestId))
188
187
  if (!request) return Effect.void
189
188
 
190
189
  request.sentReply = true
@@ -192,7 +191,7 @@ export const make = Effect.fnUntraced(function*<
192
191
  if (
193
192
  isShuttingDown &&
194
193
  Exit.hasInterrupts(response.exit) &&
195
- defectRequestIds.has(response.requestId)
194
+ defectRequestIds.has(Snowflake.Snowflake(response.requestId))
196
195
  ) {
197
196
  return Effect.void
198
197
  }
@@ -210,7 +209,7 @@ export const make = Effect.fnUntraced(function*<
210
209
  if (!isShuttingDown) {
211
210
  return server.write(0, {
212
211
  ...request.message.envelope,
213
- id: RequestId(request.message.envelope.requestId),
212
+ id: request.message.envelope.requestId as any,
214
213
  tag: request.message.envelope.tag as any,
215
214
  payload: new Request({
216
215
  ...request.message.envelope,
@@ -220,7 +219,7 @@ export const make = Effect.fnUntraced(function*<
220
219
  Effect.forkIn(scope)
221
220
  )
222
221
  }
223
- activeRequests.delete(response.requestId)
222
+ activeRequests.delete(Snowflake.Snowflake(response.requestId))
224
223
  return options.storage.unregisterReplyHandler(request.message.envelope.requestId)
225
224
  }
226
225
  return retryRespond(
@@ -237,7 +236,7 @@ export const make = Effect.fnUntraced(function*<
237
236
  ).pipe(
238
237
  Effect.flatMap(() => {
239
238
  processedRequestIds.add(request.message.envelope.requestId)
240
- activeRequests.delete(response.requestId)
239
+ activeRequests.delete(Snowflake.Snowflake(response.requestId))
241
240
 
242
241
  // ensure that the reaper does not remove the entity as we haven't
243
242
  // been "idle" yet
@@ -251,7 +250,7 @@ export const make = Effect.fnUntraced(function*<
251
250
  )
252
251
  }
253
252
  case "Chunk": {
254
- const request = activeRequests.get(response.requestId)
253
+ const request = activeRequests.get(Snowflake.Snowflake(response.requestId))
255
254
  if (!request) return Effect.void
256
255
  const sequence = request.sequence
257
256
  request.sequence++
@@ -299,7 +298,7 @@ export const make = Effect.fnUntraced(function*<
299
298
  const { lastSentChunk, message } = request
300
299
  yield* server.write(0, {
301
300
  ...message.envelope,
302
- id: RequestId(message.envelope.requestId),
301
+ id: message.envelope.requestId as any,
303
302
  tag: message.envelope.tag as any,
304
303
  payload: new Request({
305
304
  ...message.envelope,
@@ -475,7 +474,7 @@ export const make = Effect.fnUntraced(function*<
475
474
  server.activeRequests.set(message.envelope.requestId, entry)
476
475
  let write = server.write(0, {
477
476
  ...message.envelope,
478
- id: RequestId(message.envelope.requestId),
477
+ id: message.envelope.requestId as any,
479
478
  payload: new Request({
480
479
  ...message.envelope,
481
480
  lastSentChunk: Option.filter(
@@ -503,10 +502,10 @@ export const make = Effect.fnUntraced(function*<
503
502
  return server.write(
504
503
  0,
505
504
  message.envelope._tag === "AckChunk"
506
- ? { _tag: "Ack", requestId: RequestId(message.envelope.requestId) }
505
+ ? { _tag: "Ack", requestId: message.envelope.requestId as any }
507
506
  : {
508
507
  _tag: "Interrupt",
509
- requestId: RequestId(message.envelope.requestId),
508
+ requestId: message.envelope.requestId as any,
510
509
  interruptors: []
511
510
  }
512
511
  )
@@ -611,9 +610,10 @@ export const make = Effect.fnUntraced(function*<
611
610
  })
612
611
  })
613
612
 
614
- const defaultRetryPolicy = Schedule.exponential(500, 1.5).pipe(
615
- Schedule.either(Schedule.spaced("10 seconds"))
616
- )
613
+ const defaultRetryPolicy = Schedule.min([
614
+ Schedule.exponential(500, 1.5),
615
+ Schedule.spaced("10 seconds")
616
+ ])
617
617
 
618
618
  const makeMessageDecode = <Type extends string, Rpcs extends Rpc.Any>(
619
619
  entity: Entity<Type, Rpcs>,
@@ -854,9 +854,10 @@ const make = Effect.gen(function*() {
854
854
  Effect.scoped,
855
855
  Effect.catchCause(Effect.logError),
856
856
  Effect.repeat(
857
- Schedule.exponential(200, 1.5).pipe(
858
- Schedule.either(Schedule.spaced({ seconds: 10 }))
859
- )
857
+ Schedule.min([
858
+ Schedule.exponential(200, 1.5),
859
+ Schedule.spaced({ seconds: 10 })
860
+ ])
860
861
  ),
861
862
  Effect.annotateLogs({
862
863
  service: "EventLog",
@@ -25,7 +25,7 @@ import type { HttpBody } from "../http/HttpBody.ts"
25
25
 
26
26
  const policy = Schedule.forever.pipe(
27
27
  Schedule.passthrough,
28
- Schedule.addDelay((error) => {
28
+ Schedule.addDelay(({ output: error }) => {
29
29
  if (
30
30
  HttpClientError.isHttpClientError(error)
31
31
  && error.reason._tag === "StatusCodeError"
@@ -96,8 +96,8 @@ export interface AtomRegistry {
96
96
  export interface Node<A> {
97
97
  readonly atom: Atom.Atom<A>
98
98
  readonly value: () => A
99
- parents: Array<Node<any>>
100
- children: Array<Node<any>>
99
+ parents: Set<Node<any>>
100
+ children: Set<Node<any>>
101
101
  listeners: Set<() => void>
102
102
  currentState(): "uninitialized" | "stale" | "valid" | "removed"
103
103
  }
@@ -713,10 +713,10 @@ class NodeImpl<A> {
713
713
  writeContext: WriteContextImpl<A>
714
714
  preserveInitialValueOnBuild = false
715
715
 
716
- parents: Array<NodeImpl<any>> = []
717
- previousParents: Array<NodeImpl<any>> | undefined
718
- children: Array<NodeImpl<any>> = []
719
- listeners: Set<() => void> = new Set()
716
+ parents = new Set<NodeImpl<any>>()
717
+ previousParents: Set<NodeImpl<any>> | undefined
718
+ children = new Set<NodeImpl<any>>()
719
+ listeners = new Set<() => void>()
720
720
  skipInvalidation = false
721
721
 
722
722
  currentState() {
@@ -733,7 +733,7 @@ class NodeImpl<A> {
733
733
  }
734
734
 
735
735
  get canBeRemoved(): boolean {
736
- return !this.atom.keepAlive && this.listeners.size === 0 && this.children.length === 0 && this.state !== 0
736
+ return !this.atom.keepAlive && this.listeners.size === 0 && this.children.size === 0 && this.state !== 0
737
737
  }
738
738
 
739
739
  _value: A = undefined as any
@@ -753,10 +753,10 @@ class NodeImpl<A> {
753
753
  if (this.previousParents) {
754
754
  const parents = this.previousParents
755
755
  this.previousParents = undefined
756
- for (let i = 0; i < parents.length; i++) {
757
- parents[i].removeChild(this)
758
- if (parents[i].canBeRemoved) {
759
- this.registry.scheduleNodeRemoval(parents[i])
756
+ for (const parent of parents) {
757
+ parent.removeChild(this)
758
+ if (parent.canBeRemoved) {
759
+ this.registry.scheduleNodeRemoval(parent)
760
760
  }
761
761
  }
762
762
  }
@@ -826,19 +826,16 @@ class NodeImpl<A> {
826
826
  }
827
827
 
828
828
  addParent(parent: NodeImpl<any>): void {
829
- this.parents.push(parent)
829
+ this.parents.add(parent)
830
830
  if (this.previousParents !== undefined) {
831
- const index = this.previousParents.indexOf(parent)
832
- if (index !== -1) {
833
- this.previousParents[index] = this.previousParents[this.previousParents.length - 1]
834
- if (this.previousParents.pop() === undefined) {
835
- this.previousParents = undefined
836
- }
831
+ this.previousParents.delete(parent)
832
+ if (this.previousParents.size === 0) {
833
+ this.previousParents = undefined
837
834
  }
838
835
  }
839
836
 
840
- if (parent.children.indexOf(this) === -1) {
841
- parent.children.push(this)
837
+ if (!parent.children.has(this)) {
838
+ parent.children.add(this)
842
839
  if (parent.skipInvalidation) {
843
840
  parent.skipInvalidation = false
844
841
  }
@@ -846,11 +843,7 @@ class NodeImpl<A> {
846
843
  }
847
844
 
848
845
  removeChild(child: NodeImpl<any>): void {
849
- const index = this.children.indexOf(child)
850
- if (index !== -1) {
851
- this.children[index] = this.children[this.children.length - 1]
852
- this.children.pop()
853
- }
846
+ this.children.delete(child)
854
847
  }
855
848
 
856
849
  invalidate(): void {
@@ -870,14 +863,14 @@ class NodeImpl<A> {
870
863
  }
871
864
 
872
865
  invalidateChildren(): void {
873
- if (this.children.length === 0) {
866
+ if (this.children.size === 0) {
874
867
  return
875
868
  }
876
869
 
877
870
  const children = this.children
878
- this.children = []
879
- for (let i = 0; i < children.length; i++) {
880
- children[i].invalidate()
871
+ this.children = new Set()
872
+ for (const child of children) {
873
+ child.invalidate()
881
874
  }
882
875
  }
883
876
 
@@ -895,9 +888,9 @@ class NodeImpl<A> {
895
888
  this.lifetime = undefined
896
889
  }
897
890
 
898
- if (this.parents.length !== 0) {
891
+ if (this.parents.size !== 0) {
899
892
  this.previousParents = this.parents
900
- this.parents = []
893
+ this.parents = new Set()
901
894
  }
902
895
  }
903
896
 
@@ -917,10 +910,10 @@ class NodeImpl<A> {
917
910
 
918
911
  const parents = this.previousParents
919
912
  this.previousParents = undefined
920
- for (let i = 0; i < parents.length; i++) {
921
- parents[i].removeChild(this)
922
- if (parents[i].canBeRemoved) {
923
- this.registry.removeNode(parents[i])
913
+ for (const parent of parents) {
914
+ parent.removeChild(this)
915
+ if (parent.canBeRemoved) {
916
+ this.registry.removeNode(parent)
924
917
  }
925
918
  }
926
919
  }
@@ -931,19 +924,18 @@ class NodeImpl<A> {
931
924
  }
932
925
  }
933
926
 
934
- function childrenAreActive(children: Array<NodeImpl<any>>): boolean {
935
- if (children.length === 0) {
927
+ function childrenAreActive(children: Set<NodeImpl<any>>): boolean {
928
+ if (children.size === 0) {
936
929
  return false
937
930
  }
938
- let current: Array<NodeImpl<any>> | undefined = children
939
- let stack: Array<Array<NodeImpl<any>>> | undefined
931
+ let current: Set<NodeImpl<any>> | undefined = children
932
+ let stack: Array<Set<NodeImpl<any>>> | undefined
940
933
  let stackIndex = 0
941
934
  while (current !== undefined) {
942
- for (let i = 0, len = current.length; i < len; i++) {
943
- const child = current[i]
935
+ for (const child of current) {
944
936
  if (!child.atom.lazy || child.listeners.size > 0) {
945
937
  return true
946
- } else if (child.children.length > 0) {
938
+ } else if (child.children.size > 0) {
947
939
  if (stack === undefined) {
948
940
  stack = [child.children]
949
941
  } else {
@@ -1233,8 +1225,7 @@ function batchRebuildNode(node: NodeImpl<any>) {
1233
1225
  return
1234
1226
  }
1235
1227
 
1236
- for (let i = 0; i < node.parents.length; i++) {
1237
- const parent = node.parents[i]
1228
+ for (const parent of node.parents) {
1238
1229
  if (parent.state !== NodeState.valid) {
1239
1230
  batchRebuildNode(parent)
1240
1231
  }
@@ -204,7 +204,7 @@ export declare namespace RpcClient {
204
204
  */
205
205
  export type FromGroup<Group, E = never> = RpcClient<RpcGroup.Rpcs<Group>, E>
206
206
 
207
- let requestIdCounter = BigInt(0)
207
+ let requestIdCounter = 0
208
208
 
209
209
  /**
210
210
  * Creates an RPC client for an already-decoded message channel, returning the
@@ -681,7 +681,7 @@ export const make: <Rpcs extends Rpc.Any, const Flatten extends boolean = false>
681
681
  Effect.flatMap((payload) =>
682
682
  send(clientId, {
683
683
  ...message,
684
- id: String(message.id),
684
+ id: message.id,
685
685
  payload,
686
686
  headers: Object.entries(message.headers)
687
687
  }, collector && collector.readUnsafe())
@@ -693,7 +693,7 @@ export const make: <Rpcs extends Rpc.Any, const Flatten extends boolean = false>
693
693
  if (!entry) return Effect.void
694
694
  return send(clientId, {
695
695
  _tag: "Ack",
696
- requestId: String(message.requestId)
696
+ requestId: message.requestId
697
697
  }) as Effect.Effect<void, RpcClientError>
698
698
  }
699
699
  case "Interrupt": {
@@ -702,7 +702,7 @@ export const make: <Rpcs extends Rpc.Any, const Flatten extends boolean = false>
702
702
  entries.delete(message.requestId)
703
703
  return send(clientId, {
704
704
  _tag: "Interrupt",
705
- requestId: String(message.requestId)
705
+ requestId: message.requestId
706
706
  }) as Effect.Effect<void, RpcClientError>
707
707
  }
708
708
  case "Eof": {
@@ -1030,7 +1030,7 @@ export const makeProtocolSocket = (options?: {
1030
1030
  const socket = yield* Socket.Socket
1031
1031
  const serialization = yield* RpcSerialization.RpcSerialization
1032
1032
  const hooks = yield* Effect.serviceOption(ConnectionHooks)
1033
- const requestClientMap = new Map<string, number>()
1033
+ const requestClientMap = new Map<string | number, number>()
1034
1034
 
1035
1035
  const write = yield* socket.writer
1036
1036
 
@@ -1150,9 +1150,10 @@ export const makeProtocolSocket = (options?: {
1150
1150
  }
1151
1151
  }))
1152
1152
 
1153
- const defaultRetryPolicy = Schedule.exponential(500, 1.5).pipe(
1154
- Schedule.either(Schedule.spaced(5000))
1155
- )
1153
+ const defaultRetryPolicy = Schedule.min([
1154
+ Schedule.exponential(500, 1.5),
1155
+ Schedule.spaced(5000)
1156
+ ])
1156
1157
 
1157
1158
  const makePinger = Effect.fnUntraced(function*<A, E, R>(writePing: Effect.Effect<A, E, R>) {
1158
1159
  let recievedPong = true
@@ -1224,7 +1225,7 @@ export const makeProtocolWorker = (
1224
1225
  const initialMessage = yield* Effect.serviceOption(RpcWorker.InitialMessage)
1225
1226
  const hooks = yield* Effect.serviceOption(ConnectionHooks)
1226
1227
 
1227
- const entries = new Map<string, {
1228
+ const entries = new Map<string | number, {
1228
1229
  readonly clientId: number
1229
1230
  readonly worker: Worker.Worker<FromServerEncoded, FromClientEncoded | RpcWorker.InitialMessage.Encoded>
1230
1231
  readonly latch: Latch.Latch