effect 4.0.0-beta.30 → 4.0.0-beta.32

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (514) hide show
  1. package/dist/Array.d.ts +87 -86
  2. package/dist/Array.d.ts.map +1 -1
  3. package/dist/Array.js +47 -40
  4. package/dist/Array.js.map +1 -1
  5. package/dist/BigDecimal.d.ts +46 -45
  6. package/dist/BigDecimal.d.ts.map +1 -1
  7. package/dist/BigDecimal.js +35 -38
  8. package/dist/BigDecimal.js.map +1 -1
  9. package/dist/BigInt.d.ts +39 -32
  10. package/dist/BigInt.d.ts.map +1 -1
  11. package/dist/BigInt.js +32 -29
  12. package/dist/BigInt.js.map +1 -1
  13. package/dist/Channel.d.ts +2 -2
  14. package/dist/Channel.d.ts.map +1 -1
  15. package/dist/Channel.js.map +1 -1
  16. package/dist/Chunk.d.ts +58 -57
  17. package/dist/Chunk.d.ts.map +1 -1
  18. package/dist/Chunk.js +20 -21
  19. package/dist/Chunk.js.map +1 -1
  20. package/dist/Config.d.ts.map +1 -1
  21. package/dist/Config.js +4 -1
  22. package/dist/Config.js.map +1 -1
  23. package/dist/Cron.d.ts +3 -6
  24. package/dist/Cron.d.ts.map +1 -1
  25. package/dist/Cron.js +11 -18
  26. package/dist/Cron.js.map +1 -1
  27. package/dist/DateTime.d.ts +49 -92
  28. package/dist/DateTime.d.ts.map +1 -1
  29. package/dist/DateTime.js +9 -9
  30. package/dist/DateTime.js.map +1 -1
  31. package/dist/Deferred.d.ts +7 -5
  32. package/dist/Deferred.d.ts.map +1 -1
  33. package/dist/Deferred.js +7 -5
  34. package/dist/Deferred.js.map +1 -1
  35. package/dist/Duration.d.ts +55 -25
  36. package/dist/Duration.d.ts.map +1 -1
  37. package/dist/Duration.js +100 -70
  38. package/dist/Duration.js.map +1 -1
  39. package/dist/Effect.d.ts.map +1 -1
  40. package/dist/Effect.js +3 -4
  41. package/dist/Effect.js.map +1 -1
  42. package/dist/Fiber.d.ts +2 -1
  43. package/dist/Fiber.d.ts.map +1 -1
  44. package/dist/Fiber.js.map +1 -1
  45. package/dist/FiberHandle.d.ts +9 -8
  46. package/dist/FiberHandle.d.ts.map +1 -1
  47. package/dist/FiberHandle.js +8 -7
  48. package/dist/FiberHandle.js.map +1 -1
  49. package/dist/FiberMap.d.ts +20 -19
  50. package/dist/FiberMap.d.ts.map +1 -1
  51. package/dist/FiberMap.js +6 -6
  52. package/dist/FiberMap.js.map +1 -1
  53. package/dist/FileSystem.d.ts +17 -16
  54. package/dist/FileSystem.d.ts.map +1 -1
  55. package/dist/FileSystem.js +10 -7
  56. package/dist/FileSystem.js.map +1 -1
  57. package/dist/Graph.d.ts +64 -64
  58. package/dist/Graph.d.ts.map +1 -1
  59. package/dist/Graph.js +53 -53
  60. package/dist/Graph.js.map +1 -1
  61. package/dist/HashMap.d.ts +11 -5
  62. package/dist/HashMap.d.ts.map +1 -1
  63. package/dist/HashMap.js +3 -1
  64. package/dist/HashMap.js.map +1 -1
  65. package/dist/Iterable.d.ts +11 -11
  66. package/dist/Iterable.d.ts.map +1 -1
  67. package/dist/Iterable.js +12 -12
  68. package/dist/Iterable.js.map +1 -1
  69. package/dist/Latch.d.ts +69 -3
  70. package/dist/Latch.d.ts.map +1 -1
  71. package/dist/Latch.js +58 -0
  72. package/dist/Latch.js.map +1 -1
  73. package/dist/Layer.d.ts +181 -2
  74. package/dist/Layer.d.ts.map +1 -1
  75. package/dist/Layer.js +35 -2
  76. package/dist/Layer.js.map +1 -1
  77. package/dist/Number.d.ts +74 -18
  78. package/dist/Number.d.ts.map +1 -1
  79. package/dist/Number.js +34 -15
  80. package/dist/Number.js.map +1 -1
  81. package/dist/Option.d.ts +2 -0
  82. package/dist/Option.d.ts.map +1 -1
  83. package/dist/Option.js.map +1 -1
  84. package/dist/PartitionedSemaphore.d.ts +183 -0
  85. package/dist/PartitionedSemaphore.d.ts.map +1 -0
  86. package/dist/PartitionedSemaphore.js +231 -0
  87. package/dist/PartitionedSemaphore.js.map +1 -0
  88. package/dist/PubSub.d.ts +5 -4
  89. package/dist/PubSub.d.ts.map +1 -1
  90. package/dist/PubSub.js +6 -5
  91. package/dist/PubSub.js.map +1 -1
  92. package/dist/Queue.d.ts +3 -3
  93. package/dist/Queue.d.ts.map +1 -1
  94. package/dist/Queue.js +2 -2
  95. package/dist/Queue.js.map +1 -1
  96. package/dist/Record.d.ts +40 -40
  97. package/dist/Record.d.ts.map +1 -1
  98. package/dist/Record.js +16 -15
  99. package/dist/Record.js.map +1 -1
  100. package/dist/Scheduler.d.ts +25 -123
  101. package/dist/Scheduler.d.ts.map +1 -1
  102. package/dist/Scheduler.js +20 -123
  103. package/dist/Scheduler.js.map +1 -1
  104. package/dist/Schema.d.ts +2346 -114
  105. package/dist/Schema.d.ts.map +1 -1
  106. package/dist/Schema.js +1359 -68
  107. package/dist/Schema.js.map +1 -1
  108. package/dist/SchemaAST.d.ts +2 -2
  109. package/dist/SchemaAST.js +2 -2
  110. package/dist/SchemaGetter.js +6 -4
  111. package/dist/SchemaGetter.js.map +1 -1
  112. package/dist/SchemaRepresentation.d.ts +2 -2
  113. package/dist/SchemaRepresentation.d.ts.map +1 -1
  114. package/dist/SchemaRepresentation.js.map +1 -1
  115. package/dist/SchemaTransformation.d.ts.map +1 -1
  116. package/dist/SchemaTransformation.js +32 -27
  117. package/dist/SchemaTransformation.js.map +1 -1
  118. package/dist/Semaphore.d.ts +149 -53
  119. package/dist/Semaphore.d.ts.map +1 -1
  120. package/dist/Semaphore.js +137 -117
  121. package/dist/Semaphore.js.map +1 -1
  122. package/dist/ServiceMap.d.ts +26 -0
  123. package/dist/ServiceMap.d.ts.map +1 -1
  124. package/dist/ServiceMap.js +36 -21
  125. package/dist/ServiceMap.js.map +1 -1
  126. package/dist/Stream.js +1 -1
  127. package/dist/Stream.js.map +1 -1
  128. package/dist/String.d.ts +114 -47
  129. package/dist/String.d.ts.map +1 -1
  130. package/dist/String.js +29 -47
  131. package/dist/String.js.map +1 -1
  132. package/dist/SubscriptionRef.d.ts +1 -2
  133. package/dist/SubscriptionRef.d.ts.map +1 -1
  134. package/dist/SubscriptionRef.js +81 -115
  135. package/dist/SubscriptionRef.js.map +1 -1
  136. package/dist/Terminal.d.ts +2 -1
  137. package/dist/Terminal.d.ts.map +1 -1
  138. package/dist/Terminal.js.map +1 -1
  139. package/dist/Tracer.d.ts +5 -4
  140. package/dist/Tracer.d.ts.map +1 -1
  141. package/dist/Tracer.js +2 -1
  142. package/dist/Tracer.js.map +1 -1
  143. package/dist/Trie.d.ts +26 -14
  144. package/dist/Trie.d.ts.map +1 -1
  145. package/dist/Trie.js +8 -4
  146. package/dist/Trie.js.map +1 -1
  147. package/dist/TxHashMap.d.ts +77 -59
  148. package/dist/TxHashMap.d.ts.map +1 -1
  149. package/dist/TxHashMap.js +25 -19
  150. package/dist/TxHashMap.js.map +1 -1
  151. package/dist/TxSemaphore.d.ts +162 -2
  152. package/dist/TxSemaphore.d.ts.map +1 -1
  153. package/dist/TxSemaphore.js +16 -2
  154. package/dist/TxSemaphore.js.map +1 -1
  155. package/dist/index.d.ts +88 -32
  156. package/dist/index.d.ts.map +1 -1
  157. package/dist/index.js +88 -32
  158. package/dist/index.js.map +1 -1
  159. package/dist/internal/dateTime.js +66 -59
  160. package/dist/internal/dateTime.js.map +1 -1
  161. package/dist/internal/effect.js +21 -90
  162. package/dist/internal/effect.js.map +1 -1
  163. package/dist/internal/hashMap.js +2 -1
  164. package/dist/internal/hashMap.js.map +1 -1
  165. package/dist/internal/option.js +6 -0
  166. package/dist/internal/option.js.map +1 -1
  167. package/dist/internal/trie.js +3 -3
  168. package/dist/internal/trie.js.map +1 -1
  169. package/dist/unstable/ai/AiError.js +1 -1
  170. package/dist/unstable/ai/AiError.js.map +1 -1
  171. package/dist/unstable/ai/AnthropicStructuredOutput.d.ts.map +1 -1
  172. package/dist/unstable/ai/AnthropicStructuredOutput.js +4 -0
  173. package/dist/unstable/ai/AnthropicStructuredOutput.js.map +1 -1
  174. package/dist/unstable/ai/Chat.d.ts +3 -4
  175. package/dist/unstable/ai/Chat.d.ts.map +1 -1
  176. package/dist/unstable/ai/Chat.js +2 -2
  177. package/dist/unstable/ai/Chat.js.map +1 -1
  178. package/dist/unstable/ai/LanguageModel.d.ts +30 -16
  179. package/dist/unstable/ai/LanguageModel.d.ts.map +1 -1
  180. package/dist/unstable/ai/LanguageModel.js +10 -87
  181. package/dist/unstable/ai/LanguageModel.js.map +1 -1
  182. package/dist/unstable/ai/OpenAiStructuredOutput.d.ts.map +1 -1
  183. package/dist/unstable/ai/OpenAiStructuredOutput.js +4 -0
  184. package/dist/unstable/ai/OpenAiStructuredOutput.js.map +1 -1
  185. package/dist/unstable/ai/Tool.d.ts +14 -0
  186. package/dist/unstable/ai/Tool.d.ts.map +1 -1
  187. package/dist/unstable/ai/Tool.js +13 -0
  188. package/dist/unstable/ai/Tool.js.map +1 -1
  189. package/dist/unstable/cli/Argument.d.ts +2 -4
  190. package/dist/unstable/cli/Argument.d.ts.map +1 -1
  191. package/dist/unstable/cli/Argument.js +1 -3
  192. package/dist/unstable/cli/Argument.js.map +1 -1
  193. package/dist/unstable/cli/CliOutput.d.ts +3 -2
  194. package/dist/unstable/cli/CliOutput.d.ts.map +1 -1
  195. package/dist/unstable/cli/CliOutput.js +4 -3
  196. package/dist/unstable/cli/CliOutput.js.map +1 -1
  197. package/dist/unstable/cli/Command.d.ts +3 -2
  198. package/dist/unstable/cli/Command.d.ts.map +1 -1
  199. package/dist/unstable/cli/Command.js +3 -3
  200. package/dist/unstable/cli/Command.js.map +1 -1
  201. package/dist/unstable/cli/Completions.d.ts +16 -0
  202. package/dist/unstable/cli/Completions.d.ts.map +1 -0
  203. package/dist/unstable/cli/Completions.js +23 -0
  204. package/dist/unstable/cli/Completions.js.map +1 -0
  205. package/dist/unstable/cli/Flag.d.ts +2 -2
  206. package/dist/unstable/cli/Flag.d.ts.map +1 -1
  207. package/dist/unstable/cli/Flag.js +1 -1
  208. package/dist/unstable/cli/Flag.js.map +1 -1
  209. package/dist/unstable/cli/GlobalFlag.d.ts.map +1 -1
  210. package/dist/unstable/cli/GlobalFlag.js +4 -4
  211. package/dist/unstable/cli/GlobalFlag.js.map +1 -1
  212. package/dist/unstable/cli/HelpDoc.d.ts +14 -12
  213. package/dist/unstable/cli/HelpDoc.d.ts.map +1 -1
  214. package/dist/unstable/cli/Param.d.ts +4 -4
  215. package/dist/unstable/cli/Param.d.ts.map +1 -1
  216. package/dist/unstable/cli/Param.js +7 -7
  217. package/dist/unstable/cli/Param.js.map +1 -1
  218. package/dist/unstable/cli/Primitive.d.ts +1 -1
  219. package/dist/unstable/cli/Primitive.d.ts.map +1 -1
  220. package/dist/unstable/cli/Primitive.js.map +1 -1
  221. package/dist/unstable/cli/Prompt.js +71 -67
  222. package/dist/unstable/cli/Prompt.js.map +1 -1
  223. package/dist/unstable/cli/index.d.ts +4 -0
  224. package/dist/unstable/cli/index.d.ts.map +1 -1
  225. package/dist/unstable/cli/index.js +4 -0
  226. package/dist/unstable/cli/index.js.map +1 -1
  227. package/dist/unstable/cli/internal/completions/CommandDescriptor.js +9 -2
  228. package/dist/unstable/cli/internal/completions/CommandDescriptor.js.map +1 -1
  229. package/dist/unstable/cli/internal/parser.js +8 -3
  230. package/dist/unstable/cli/internal/parser.js.map +1 -1
  231. package/dist/unstable/cluster/ClusterWorkflowEngine.d.ts +3 -2
  232. package/dist/unstable/cluster/ClusterWorkflowEngine.d.ts.map +1 -1
  233. package/dist/unstable/cluster/ClusterWorkflowEngine.js +25 -23
  234. package/dist/unstable/cluster/ClusterWorkflowEngine.js.map +1 -1
  235. package/dist/unstable/cluster/DeliverAt.js +1 -1
  236. package/dist/unstable/cluster/DeliverAt.js.map +1 -1
  237. package/dist/unstable/cluster/Entity.d.ts +3 -2
  238. package/dist/unstable/cluster/Entity.d.ts.map +1 -1
  239. package/dist/unstable/cluster/Entity.js +7 -7
  240. package/dist/unstable/cluster/Entity.js.map +1 -1
  241. package/dist/unstable/cluster/Message.d.ts +4 -3
  242. package/dist/unstable/cluster/Message.d.ts.map +1 -1
  243. package/dist/unstable/cluster/Message.js +3 -2
  244. package/dist/unstable/cluster/Message.js.map +1 -1
  245. package/dist/unstable/cluster/MessageStorage.d.ts +10 -10
  246. package/dist/unstable/cluster/MessageStorage.d.ts.map +1 -1
  247. package/dist/unstable/cluster/MessageStorage.js +12 -12
  248. package/dist/unstable/cluster/MessageStorage.js.map +1 -1
  249. package/dist/unstable/cluster/Reply.d.ts +2 -1
  250. package/dist/unstable/cluster/Reply.d.ts.map +1 -1
  251. package/dist/unstable/cluster/Reply.js +4 -3
  252. package/dist/unstable/cluster/Reply.js.map +1 -1
  253. package/dist/unstable/cluster/RunnerServer.d.ts.map +1 -1
  254. package/dist/unstable/cluster/RunnerServer.js +9 -8
  255. package/dist/unstable/cluster/RunnerServer.js.map +1 -1
  256. package/dist/unstable/cluster/Runners.d.ts +2 -1
  257. package/dist/unstable/cluster/Runners.d.ts.map +1 -1
  258. package/dist/unstable/cluster/Runners.js +7 -6
  259. package/dist/unstable/cluster/Runners.js.map +1 -1
  260. package/dist/unstable/cluster/Sharding.d.ts.map +1 -1
  261. package/dist/unstable/cluster/Sharding.js +19 -13
  262. package/dist/unstable/cluster/Sharding.js.map +1 -1
  263. package/dist/unstable/cluster/ShardingConfig.d.ts +5 -4
  264. package/dist/unstable/cluster/ShardingConfig.d.ts.map +1 -1
  265. package/dist/unstable/cluster/ShardingConfig.js +4 -4
  266. package/dist/unstable/cluster/ShardingConfig.js.map +1 -1
  267. package/dist/unstable/cluster/SqlMessageStorage.d.ts.map +1 -1
  268. package/dist/unstable/cluster/SqlMessageStorage.js +19 -18
  269. package/dist/unstable/cluster/SqlMessageStorage.js.map +1 -1
  270. package/dist/unstable/cluster/internal/entityManager.js +9 -10
  271. package/dist/unstable/cluster/internal/entityManager.js.map +1 -1
  272. package/dist/unstable/devtools/DevToolsSchema.d.ts +2 -1
  273. package/dist/unstable/devtools/DevToolsSchema.d.ts.map +1 -1
  274. package/dist/unstable/devtools/DevToolsSchema.js +1 -4
  275. package/dist/unstable/devtools/DevToolsSchema.js.map +1 -1
  276. package/dist/unstable/encoding/Ndjson.d.ts +8 -8
  277. package/dist/unstable/encoding/Ndjson.d.ts.map +1 -1
  278. package/dist/unstable/encoding/Ndjson.js.map +1 -1
  279. package/dist/unstable/http/Cookies.d.ts +5 -4
  280. package/dist/unstable/http/Cookies.d.ts.map +1 -1
  281. package/dist/unstable/http/Cookies.js +3 -4
  282. package/dist/unstable/http/Cookies.js.map +1 -1
  283. package/dist/unstable/http/Etag.d.ts.map +1 -1
  284. package/dist/unstable/http/Etag.js +5 -1
  285. package/dist/unstable/http/Etag.js.map +1 -1
  286. package/dist/unstable/http/Headers.d.ts +3 -2
  287. package/dist/unstable/http/Headers.d.ts.map +1 -1
  288. package/dist/unstable/http/Headers.js +2 -1
  289. package/dist/unstable/http/Headers.js.map +1 -1
  290. package/dist/unstable/http/HttpClient.d.ts.map +1 -1
  291. package/dist/unstable/http/HttpClient.js +2 -1
  292. package/dist/unstable/http/HttpClient.js.map +1 -1
  293. package/dist/unstable/http/HttpClientRequest.d.ts +4 -3
  294. package/dist/unstable/http/HttpClientRequest.d.ts.map +1 -1
  295. package/dist/unstable/http/HttpClientRequest.js +8 -6
  296. package/dist/unstable/http/HttpClientRequest.js.map +1 -1
  297. package/dist/unstable/http/HttpClientResponse.d.ts.map +1 -1
  298. package/dist/unstable/http/HttpClientResponse.js +2 -1
  299. package/dist/unstable/http/HttpClientResponse.js.map +1 -1
  300. package/dist/unstable/http/HttpIncomingMessage.d.ts +3 -2
  301. package/dist/unstable/http/HttpIncomingMessage.d.ts.map +1 -1
  302. package/dist/unstable/http/HttpIncomingMessage.js.map +1 -1
  303. package/dist/unstable/http/HttpMiddleware.d.ts.map +1 -1
  304. package/dist/unstable/http/HttpMiddleware.js +16 -15
  305. package/dist/unstable/http/HttpMiddleware.js.map +1 -1
  306. package/dist/unstable/http/HttpPlatform.d.ts.map +1 -1
  307. package/dist/unstable/http/HttpPlatform.js +3 -2
  308. package/dist/unstable/http/HttpPlatform.js.map +1 -1
  309. package/dist/unstable/http/HttpRouter.d.ts +2 -1
  310. package/dist/unstable/http/HttpRouter.d.ts.map +1 -1
  311. package/dist/unstable/http/HttpRouter.js +7 -7
  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/HttpServer.js +2 -2
  315. package/dist/unstable/http/HttpServer.js.map +1 -1
  316. package/dist/unstable/http/HttpServerError.d.ts +2 -1
  317. package/dist/unstable/http/HttpServerError.d.ts.map +1 -1
  318. package/dist/unstable/http/HttpServerError.js +2 -1
  319. package/dist/unstable/http/HttpServerError.js.map +1 -1
  320. package/dist/unstable/http/HttpServerRequest.d.ts +3 -2
  321. package/dist/unstable/http/HttpServerRequest.d.ts.map +1 -1
  322. package/dist/unstable/http/HttpServerRequest.js +14 -10
  323. package/dist/unstable/http/HttpServerRequest.js.map +1 -1
  324. package/dist/unstable/http/HttpServerResponse.d.ts.map +1 -1
  325. package/dist/unstable/http/HttpServerResponse.js +4 -3
  326. package/dist/unstable/http/HttpServerResponse.js.map +1 -1
  327. package/dist/unstable/http/HttpTraceContext.d.ts +3 -2
  328. package/dist/unstable/http/HttpTraceContext.d.ts.map +1 -1
  329. package/dist/unstable/http/HttpTraceContext.js +27 -15
  330. package/dist/unstable/http/HttpTraceContext.js.map +1 -1
  331. package/dist/unstable/http/UrlParams.d.ts +5 -4
  332. package/dist/unstable/http/UrlParams.d.ts.map +1 -1
  333. package/dist/unstable/http/UrlParams.js +5 -6
  334. package/dist/unstable/http/UrlParams.js.map +1 -1
  335. package/dist/unstable/httpapi/HttpApiBuilder.d.ts +2 -2
  336. package/dist/unstable/httpapi/HttpApiBuilder.d.ts.map +1 -1
  337. package/dist/unstable/httpapi/HttpApiBuilder.js +4 -2
  338. package/dist/unstable/httpapi/HttpApiBuilder.js.map +1 -1
  339. package/dist/unstable/httpapi/HttpApiError.d.ts +15 -0
  340. package/dist/unstable/httpapi/HttpApiError.d.ts.map +1 -1
  341. package/dist/unstable/httpapi/HttpApiError.js +81 -3
  342. package/dist/unstable/httpapi/HttpApiError.js.map +1 -1
  343. package/dist/unstable/observability/OtlpExporter.d.ts.map +1 -1
  344. package/dist/unstable/observability/OtlpExporter.js +2 -2
  345. package/dist/unstable/observability/OtlpExporter.js.map +1 -1
  346. package/dist/unstable/observability/OtlpTracer.d.ts.map +1 -1
  347. package/dist/unstable/observability/OtlpTracer.js +7 -3
  348. package/dist/unstable/observability/OtlpTracer.js.map +1 -1
  349. package/dist/unstable/persistence/Persistable.js +1 -1
  350. package/dist/unstable/persistence/Persistable.js.map +1 -1
  351. package/dist/unstable/reactivity/Atom.d.ts.map +1 -1
  352. package/dist/unstable/reactivity/Atom.js +1 -5
  353. package/dist/unstable/reactivity/Atom.js.map +1 -1
  354. package/dist/unstable/reactivity/AtomRegistry.d.ts.map +1 -1
  355. package/dist/unstable/reactivity/AtomRegistry.js +4 -2
  356. package/dist/unstable/reactivity/AtomRegistry.js.map +1 -1
  357. package/dist/unstable/rpc/Rpc.d.ts.map +1 -1
  358. package/dist/unstable/rpc/Rpc.js +4 -3
  359. package/dist/unstable/rpc/Rpc.js.map +1 -1
  360. package/dist/unstable/rpc/RpcClient.d.ts.map +1 -1
  361. package/dist/unstable/rpc/RpcClient.js +4 -4
  362. package/dist/unstable/rpc/RpcClient.js.map +1 -1
  363. package/dist/unstable/rpc/RpcGroup.d.ts +1 -3
  364. package/dist/unstable/rpc/RpcGroup.d.ts.map +1 -1
  365. package/dist/unstable/rpc/RpcSchema.d.ts.map +1 -1
  366. package/dist/unstable/rpc/RpcSchema.js +3 -2
  367. package/dist/unstable/rpc/RpcSchema.js.map +1 -1
  368. package/dist/unstable/rpc/RpcSerialization.d.ts.map +1 -1
  369. package/dist/unstable/rpc/RpcSerialization.js +4 -1
  370. package/dist/unstable/rpc/RpcSerialization.js.map +1 -1
  371. package/dist/unstable/rpc/RpcServer.d.ts +1 -1
  372. package/dist/unstable/rpc/RpcServer.d.ts.map +1 -1
  373. package/dist/unstable/rpc/RpcServer.js +3 -2
  374. package/dist/unstable/rpc/RpcServer.js.map +1 -1
  375. package/dist/unstable/socket/Socket.d.ts.map +1 -1
  376. package/dist/unstable/socket/Socket.js +2 -1
  377. package/dist/unstable/socket/Socket.js.map +1 -1
  378. package/dist/unstable/sql/SqlClient.d.ts.map +1 -1
  379. package/dist/unstable/sql/SqlClient.js +1 -1
  380. package/dist/unstable/sql/SqlClient.js.map +1 -1
  381. package/dist/unstable/workflow/DurableDeferred.js +6 -6
  382. package/dist/unstable/workflow/DurableDeferred.js.map +1 -1
  383. package/dist/unstable/workflow/Workflow.d.ts +2 -1
  384. package/dist/unstable/workflow/Workflow.d.ts.map +1 -1
  385. package/dist/unstable/workflow/WorkflowEngine.d.ts +5 -4
  386. package/dist/unstable/workflow/WorkflowEngine.d.ts.map +1 -1
  387. package/dist/unstable/workflow/WorkflowEngine.js +19 -14
  388. package/dist/unstable/workflow/WorkflowEngine.js.map +1 -1
  389. package/package.json +1 -1
  390. package/src/Array.ts +112 -105
  391. package/src/BigDecimal.ts +63 -66
  392. package/src/BigInt.ts +49 -41
  393. package/src/Channel.ts +3 -3
  394. package/src/Chunk.ts +68 -63
  395. package/src/Config.ts +4 -1
  396. package/src/Cron.ts +13 -18
  397. package/src/DateTime.ts +51 -92
  398. package/src/Deferred.ts +8 -6
  399. package/src/Duration.ts +112 -56
  400. package/src/Effect.ts +3 -4
  401. package/src/Fiber.ts +2 -1
  402. package/src/FiberHandle.ts +10 -9
  403. package/src/FiberMap.ts +22 -22
  404. package/src/FileSystem.ts +25 -22
  405. package/src/Graph.ts +105 -105
  406. package/src/HashMap.ts +11 -5
  407. package/src/Iterable.ts +13 -13
  408. package/src/Latch.ts +85 -3
  409. package/src/Layer.ts +244 -19
  410. package/src/Number.ts +85 -26
  411. package/src/Option.ts +2 -0
  412. package/src/PartitionedSemaphore.ts +414 -0
  413. package/src/PubSub.ts +7 -6
  414. package/src/Queue.ts +5 -5
  415. package/src/Record.ts +52 -47
  416. package/src/Scheduler.ts +37 -126
  417. package/src/Schema.ts +2366 -116
  418. package/src/SchemaAST.ts +2 -2
  419. package/src/SchemaGetter.ts +4 -4
  420. package/src/SchemaRepresentation.ts +2 -2
  421. package/src/SchemaTransformation.ts +27 -27
  422. package/src/Semaphore.ts +271 -183
  423. package/src/ServiceMap.ts +83 -31
  424. package/src/Stream.ts +1 -1
  425. package/src/String.ts +122 -69
  426. package/src/SubscriptionRef.ts +96 -117
  427. package/src/Terminal.ts +2 -1
  428. package/src/Tracer.ts +6 -5
  429. package/src/Trie.ts +26 -14
  430. package/src/TxHashMap.ts +78 -60
  431. package/src/TxSemaphore.ts +186 -11
  432. package/src/index.ts +89 -33
  433. package/src/internal/dateTime.ts +74 -65
  434. package/src/internal/effect.ts +30 -122
  435. package/src/internal/hashMap.ts +4 -3
  436. package/src/internal/option.ts +7 -0
  437. package/src/internal/trie.ts +6 -6
  438. package/src/unstable/ai/AiError.ts +1 -1
  439. package/src/unstable/ai/AnthropicStructuredOutput.ts +4 -0
  440. package/src/unstable/ai/Chat.ts +17 -15
  441. package/src/unstable/ai/LanguageModel.ts +148 -97
  442. package/src/unstable/ai/OpenAiStructuredOutput.ts +4 -0
  443. package/src/unstable/ai/Tool.ts +20 -0
  444. package/src/unstable/cli/Argument.ts +2 -4
  445. package/src/unstable/cli/CliOutput.ts +7 -5
  446. package/src/unstable/cli/Command.ts +5 -5
  447. package/src/unstable/cli/Completions.ts +36 -0
  448. package/src/unstable/cli/Flag.ts +2 -2
  449. package/src/unstable/cli/GlobalFlag.ts +4 -5
  450. package/src/unstable/cli/HelpDoc.ts +14 -12
  451. package/src/unstable/cli/Param.ts +15 -11
  452. package/src/unstable/cli/Primitive.ts +1 -1
  453. package/src/unstable/cli/Prompt.ts +81 -83
  454. package/src/unstable/cli/index.ts +5 -0
  455. package/src/unstable/cli/internal/completions/CommandDescriptor.ts +3 -2
  456. package/src/unstable/cli/internal/parser.ts +7 -4
  457. package/src/unstable/cluster/ClusterWorkflowEngine.ts +35 -30
  458. package/src/unstable/cluster/DeliverAt.ts +1 -1
  459. package/src/unstable/cluster/Entity.ts +13 -12
  460. package/src/unstable/cluster/Message.ts +6 -5
  461. package/src/unstable/cluster/MessageStorage.ts +26 -25
  462. package/src/unstable/cluster/Reply.ts +7 -4
  463. package/src/unstable/cluster/RunnerServer.ts +10 -13
  464. package/src/unstable/cluster/Runners.ts +8 -7
  465. package/src/unstable/cluster/Sharding.ts +24 -17
  466. package/src/unstable/cluster/ShardingConfig.ts +6 -6
  467. package/src/unstable/cluster/SqlMessageStorage.ts +21 -18
  468. package/src/unstable/cluster/internal/entityManager.ts +27 -21
  469. package/src/unstable/devtools/DevToolsSchema.ts +3 -2
  470. package/src/unstable/encoding/Ndjson.ts +17 -17
  471. package/src/unstable/http/Cookies.ts +7 -8
  472. package/src/unstable/http/Etag.ts +5 -3
  473. package/src/unstable/http/Headers.ts +6 -5
  474. package/src/unstable/http/HttpClient.ts +2 -1
  475. package/src/unstable/http/HttpClientRequest.ts +11 -9
  476. package/src/unstable/http/HttpClientResponse.ts +5 -4
  477. package/src/unstable/http/HttpIncomingMessage.ts +3 -2
  478. package/src/unstable/http/HttpMiddleware.ts +16 -15
  479. package/src/unstable/http/HttpPlatform.ts +3 -2
  480. package/src/unstable/http/HttpRouter.ts +9 -9
  481. package/src/unstable/http/HttpServer.ts +3 -9
  482. package/src/unstable/http/HttpServerError.ts +3 -2
  483. package/src/unstable/http/HttpServerRequest.ts +29 -25
  484. package/src/unstable/http/HttpServerResponse.ts +7 -6
  485. package/src/unstable/http/HttpTraceContext.ts +31 -17
  486. package/src/unstable/http/UrlParams.ts +11 -14
  487. package/src/unstable/httpapi/HttpApiBuilder.ts +13 -7
  488. package/src/unstable/httpapi/HttpApiError.ts +67 -12
  489. package/src/unstable/observability/OtlpExporter.ts +5 -2
  490. package/src/unstable/observability/OtlpTracer.ts +8 -4
  491. package/src/unstable/persistence/Persistable.ts +1 -1
  492. package/src/unstable/reactivity/Atom.ts +1 -4
  493. package/src/unstable/reactivity/AtomRegistry.ts +5 -3
  494. package/src/unstable/rpc/Rpc.ts +4 -3
  495. package/src/unstable/rpc/RpcClient.ts +10 -9
  496. package/src/unstable/rpc/RpcGroup.ts +3 -3
  497. package/src/unstable/rpc/RpcSchema.ts +6 -5
  498. package/src/unstable/rpc/RpcSerialization.ts +4 -1
  499. package/src/unstable/rpc/RpcServer.ts +3 -3
  500. package/src/unstable/socket/Socket.ts +2 -1
  501. package/src/unstable/sql/SqlClient.ts +5 -3
  502. package/src/unstable/workflow/DurableDeferred.ts +6 -6
  503. package/src/unstable/workflow/Workflow.ts +1 -1
  504. package/src/unstable/workflow/WorkflowEngine.ts +29 -20
  505. package/dist/NullOr.d.ts +0 -149
  506. package/dist/NullOr.d.ts.map +0 -1
  507. package/dist/NullOr.js +0 -152
  508. package/dist/NullOr.js.map +0 -1
  509. package/dist/unstable/cli/internal/completions/Completions.d.ts +0 -2
  510. package/dist/unstable/cli/internal/completions/Completions.d.ts.map +0 -1
  511. package/dist/unstable/cli/internal/completions/Completions.js +0 -23
  512. package/dist/unstable/cli/internal/completions/Completions.js.map +0 -1
  513. package/src/NullOr.ts +0 -204
  514. package/src/unstable/cli/internal/completions/Completions.ts +0 -31
@@ -18,8 +18,16 @@ import * as ServiceMap from "./ServiceMap.ts";
18
18
  */
19
19
  export interface Scheduler {
20
20
  readonly executionMode: "sync" | "async";
21
- readonly scheduleTask: (task: () => void, priority: number) => void;
22
- readonly shouldYield: (fiber: Fiber.Fiber<unknown, unknown>) => boolean;
21
+ shouldYield(fiber: Fiber.Fiber<unknown, unknown>): boolean;
22
+ makeDispatcher(): SchedulerDispatcher;
23
+ }
24
+ /**
25
+ * @since 4.0.0
26
+ * @category models
27
+ */
28
+ export interface SchedulerDispatcher {
29
+ scheduleTask(task: () => void, priority: number): void;
30
+ flush(): void;
23
31
  }
24
32
  /**
25
33
  * @since 4.0.0
@@ -37,59 +45,39 @@ export declare const Scheduler: ServiceMap.Reference<Scheduler>;
37
45
  * - Automatic yielding based on operation count
38
46
  * - Optimized for high-throughput scenarios
39
47
  *
40
- * @example
41
- * ```ts
42
- * import { MixedScheduler } from "effect/Scheduler"
43
- *
44
- * // Create a mixed scheduler with async execution (default)
45
- * const asyncScheduler = new MixedScheduler("async")
46
- *
47
- * // Create a mixed scheduler with sync execution
48
- * const syncScheduler = new MixedScheduler("sync")
49
- *
50
- * // Schedule tasks with different priorities
51
- * asyncScheduler.scheduleTask(() => console.log("High priority task"), 10)
52
- * asyncScheduler.scheduleTask(() => console.log("Normal priority task"), 0)
53
- * asyncScheduler.scheduleTask(() => console.log("Low priority task"), -1)
54
- *
55
- * // For sync scheduler, you can flush tasks immediately
56
- * syncScheduler.scheduleTask(() => console.log("Task 1"), 0)
57
- * syncScheduler.scheduleTask(() => console.log("Task 2"), 0)
58
- *
59
- * // Force flush all pending tasks in sync mode
60
- * syncScheduler.flush()
61
- * // Output: "Task 1", "Task 2"
62
- *
63
- * // Check execution mode
64
- * console.log(asyncScheduler.executionMode) // "async"
65
- * console.log(syncScheduler.executionMode) // "sync"
66
- * ```
67
- *
68
48
  * @since 2.0.0
69
49
  * @category schedulers
70
50
  */
71
51
  export declare class MixedScheduler implements Scheduler {
72
- private tasks;
73
- private running;
74
52
  readonly executionMode: "sync" | "async";
75
53
  readonly setImmediate: (f: () => void) => () => void;
76
54
  constructor(executionMode?: "sync" | "async", setImmediateFn?: (f: () => void) => () => void);
77
55
  /**
78
56
  * @since 2.0.0
79
57
  */
80
- scheduleTask(task: () => void, priority: number): void;
58
+ shouldYield(fiber: Fiber.Fiber<unknown, unknown>): boolean;
81
59
  /**
82
60
  * @since 2.0.0
83
61
  */
84
- afterScheduled: () => void;
62
+ makeDispatcher(): MixedSchedulerDispatcher;
63
+ }
64
+ declare class MixedSchedulerDispatcher implements SchedulerDispatcher {
65
+ private tasks;
66
+ private running;
67
+ readonly setImmediate: (f: () => void) => () => void;
68
+ constructor(setImmediateFn?: (f: () => void) => () => void);
85
69
  /**
86
70
  * @since 2.0.0
87
71
  */
88
- runTasks(): void;
72
+ scheduleTask(task: () => void, priority: number): void;
89
73
  /**
90
74
  * @since 2.0.0
91
75
  */
92
- shouldYield(fiber: Fiber.Fiber<unknown, unknown>): boolean;
76
+ afterScheduled: () => void;
77
+ /**
78
+ * @since 2.0.0
79
+ */
80
+ runTasks(): void;
93
81
  /**
94
82
  * @since 2.0.0
95
83
  */
@@ -103,93 +91,6 @@ export declare class MixedScheduler implements Scheduler {
103
91
  * The default value is 2048 operations, which provides a good balance between
104
92
  * performance and fairness in concurrent execution.
105
93
  *
106
- * @example
107
- * ```ts
108
- * import { Effect } from "effect"
109
- * import { MaxOpsBeforeYield } from "effect/Scheduler"
110
- *
111
- * // Configure a fiber to yield more frequently
112
- * const program = Effect.gen(function*() {
113
- * // Get current max ops setting (default is 2048)
114
- * const currentMax = yield* MaxOpsBeforeYield
115
- * yield* Effect.log(`Default max ops before yield: ${currentMax}`)
116
- *
117
- * // Run with reduced max ops for more frequent yielding
118
- * return yield* Effect.provideService(
119
- * Effect.gen(function*() {
120
- * const maxOps = yield* MaxOpsBeforeYield
121
- * yield* Effect.log(`Max ops before yield: ${maxOps}`)
122
- *
123
- * // Run a compute-intensive task that will yield frequently
124
- * let result = 0
125
- * for (let i = 0; i < 10000; i++) {
126
- * result += i
127
- * // This will cause yielding every 100 operations
128
- * yield* Effect.sync(() => result)
129
- * }
130
- * return result
131
- * }),
132
- * MaxOpsBeforeYield,
133
- * 100
134
- * )
135
- * })
136
- *
137
- * // Configure for high-performance scenarios
138
- * const highPerformanceProgram = Effect.gen(function*() {
139
- * // Run with increased max ops for better performance (less yielding)
140
- * return yield* Effect.provideService(
141
- * Effect.gen(function*() {
142
- * const maxOps = yield* MaxOpsBeforeYield
143
- * yield* Effect.log(`High-performance max ops: ${maxOps}`)
144
- *
145
- * // Run multiple concurrent tasks
146
- * const tasks = Array.from(
147
- * { length: 100 },
148
- * (_, i) =>
149
- * Effect.gen(function*() {
150
- * yield* Effect.sleep(`${i * 10} millis`)
151
- * return `Task ${i} completed`
152
- * })
153
- * )
154
- *
155
- * return yield* Effect.all(tasks, { concurrency: "unbounded" })
156
- * }),
157
- * MaxOpsBeforeYield,
158
- * 10000
159
- * )
160
- * })
161
- *
162
- * // Configure for fair scheduling
163
- * const fairSchedulingProgram = Effect.gen(function*() {
164
- * // Run with lower max ops for more frequent yielding
165
- * return yield* Effect.provideService(
166
- * Effect.gen(function*() {
167
- * const maxOps = yield* MaxOpsBeforeYield
168
- * yield* Effect.log(`Fair scheduling max ops: ${maxOps}`)
169
- *
170
- * const longRunningTask = Effect.gen(function*() {
171
- * for (let i = 0; i < 1000; i++) {
172
- * yield* Effect.sync(() => Math.random())
173
- * }
174
- * return "Long task completed"
175
- * })
176
- *
177
- * const quickTask = Effect.gen(function*() {
178
- * yield* Effect.sleep("10 millis")
179
- * return "Quick task completed"
180
- * })
181
- *
182
- * // Both tasks will execute fairly due to frequent yielding
183
- * return yield* Effect.all([longRunningTask, quickTask], {
184
- * concurrency: "unbounded"
185
- * })
186
- * }),
187
- * MaxOpsBeforeYield,
188
- * 50
189
- * )
190
- * })
191
- * ```
192
- *
193
94
  * @since 4.0.0
194
95
  * @category references
195
96
  */
@@ -203,4 +104,5 @@ export declare const MaxOpsBeforeYield: ServiceMap.Reference<number>;
203
104
  * @category references
204
105
  */
205
106
  export declare const PreventSchedulerYield: ServiceMap.Reference<boolean>;
107
+ export {};
206
108
  //# sourceMappingURL=Scheduler.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"Scheduler.d.ts","sourceRoot":"","sources":["../src/Scheduler.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,KAAK,KAAK,KAAK,MAAM,YAAY,CAAA;AACxC,OAAO,KAAK,UAAU,MAAM,iBAAiB,CAAA;AAE7C;;;;;;;;;;;;GAYG;A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AsC;IACrD,QAAQ,CAAC,YAAY,EAAE,CAAC,CAAC,EAAE,MAAM,IAAI,KAAK,MAAM,IAAI,CAAA;gBAGlD,cAAc,GAAE,CAAC,CAAC,EAAE,MAAM,IAAI,KAAK,MAAM,IAAmB;IAK9D;;OAEG;IACH,YAAY,CAAC,IAAI,EAAE,MAAM,IAAI,EAAE,QAAQ,EAAE,MAAM;IAO/C;;OAEG;IACH,cAAc,aAGb;IAED;;OAEG;IACH,QAAQ;IAUR;;OAEG;IACH,KAAK;CASN;AAED;;;;;;;;;;GAUG;AACH,eAAO,MAAM,iBAAiB,8BAE5B,CAAA;AAEF;;;;;;;GAOG;AACH,eAAO,MAAM,qBAAqB,+BAEhC,CAAA"}
package/dist/Scheduler.js CHANGED
@@ -51,46 +51,36 @@ class PriorityBuckets {
51
51
  * - Automatic yielding based on operation count
52
52
  * - Optimized for high-throughput scenarios
53
53
  *
54
- * @example
55
- * ```ts
56
- * import { MixedScheduler } from "effect/Scheduler"
57
- *
58
- * // Create a mixed scheduler with async execution (default)
59
- * const asyncScheduler = new MixedScheduler("async")
60
- *
61
- * // Create a mixed scheduler with sync execution
62
- * const syncScheduler = new MixedScheduler("sync")
63
- *
64
- * // Schedule tasks with different priorities
65
- * asyncScheduler.scheduleTask(() => console.log("High priority task"), 10)
66
- * asyncScheduler.scheduleTask(() => console.log("Normal priority task"), 0)
67
- * asyncScheduler.scheduleTask(() => console.log("Low priority task"), -1)
68
- *
69
- * // For sync scheduler, you can flush tasks immediately
70
- * syncScheduler.scheduleTask(() => console.log("Task 1"), 0)
71
- * syncScheduler.scheduleTask(() => console.log("Task 2"), 0)
72
- *
73
- * // Force flush all pending tasks in sync mode
74
- * syncScheduler.flush()
75
- * // Output: "Task 1", "Task 2"
76
- *
77
- * // Check execution mode
78
- * console.log(asyncScheduler.executionMode) // "async"
79
- * console.log(syncScheduler.executionMode) // "sync"
80
- * ```
81
- *
82
54
  * @since 2.0.0
83
55
  * @category schedulers
84
56
  */
85
57
  export class MixedScheduler {
86
- tasks = /*#__PURE__*/new PriorityBuckets();
87
- running = undefined;
88
58
  executionMode;
89
59
  setImmediate;
90
60
  constructor(executionMode = "async", setImmediateFn = setImmediate) {
91
61
  this.executionMode = executionMode;
92
62
  this.setImmediate = setImmediateFn;
93
63
  }
64
+ /**
65
+ * @since 2.0.0
66
+ */
67
+ shouldYield(fiber) {
68
+ return fiber.currentOpCount >= fiber.maxOpsBeforeYield;
69
+ }
70
+ /**
71
+ * @since 2.0.0
72
+ */
73
+ makeDispatcher() {
74
+ return new MixedSchedulerDispatcher(this.setImmediate);
75
+ }
76
+ }
77
+ class MixedSchedulerDispatcher {
78
+ tasks = /*#__PURE__*/new PriorityBuckets();
79
+ running = undefined;
80
+ setImmediate;
81
+ constructor(setImmediateFn = setImmediate) {
82
+ this.setImmediate = setImmediateFn;
83
+ }
94
84
  /**
95
85
  * @since 2.0.0
96
86
  */
@@ -119,12 +109,6 @@ export class MixedScheduler {
119
109
  }
120
110
  }
121
111
  }
122
- /**
123
- * @since 2.0.0
124
- */
125
- shouldYield(fiber) {
126
- return fiber.currentOpCount >= fiber.maxOpsBeforeYield;
127
- }
128
112
  /**
129
113
  * @since 2.0.0
130
114
  */
@@ -146,93 +130,6 @@ export class MixedScheduler {
146
130
  * The default value is 2048 operations, which provides a good balance between
147
131
  * performance and fairness in concurrent execution.
148
132
  *
149
- * @example
150
- * ```ts
151
- * import { Effect } from "effect"
152
- * import { MaxOpsBeforeYield } from "effect/Scheduler"
153
- *
154
- * // Configure a fiber to yield more frequently
155
- * const program = Effect.gen(function*() {
156
- * // Get current max ops setting (default is 2048)
157
- * const currentMax = yield* MaxOpsBeforeYield
158
- * yield* Effect.log(`Default max ops before yield: ${currentMax}`)
159
- *
160
- * // Run with reduced max ops for more frequent yielding
161
- * return yield* Effect.provideService(
162
- * Effect.gen(function*() {
163
- * const maxOps = yield* MaxOpsBeforeYield
164
- * yield* Effect.log(`Max ops before yield: ${maxOps}`)
165
- *
166
- * // Run a compute-intensive task that will yield frequently
167
- * let result = 0
168
- * for (let i = 0; i < 10000; i++) {
169
- * result += i
170
- * // This will cause yielding every 100 operations
171
- * yield* Effect.sync(() => result)
172
- * }
173
- * return result
174
- * }),
175
- * MaxOpsBeforeYield,
176
- * 100
177
- * )
178
- * })
179
- *
180
- * // Configure for high-performance scenarios
181
- * const highPerformanceProgram = Effect.gen(function*() {
182
- * // Run with increased max ops for better performance (less yielding)
183
- * return yield* Effect.provideService(
184
- * Effect.gen(function*() {
185
- * const maxOps = yield* MaxOpsBeforeYield
186
- * yield* Effect.log(`High-performance max ops: ${maxOps}`)
187
- *
188
- * // Run multiple concurrent tasks
189
- * const tasks = Array.from(
190
- * { length: 100 },
191
- * (_, i) =>
192
- * Effect.gen(function*() {
193
- * yield* Effect.sleep(`${i * 10} millis`)
194
- * return `Task ${i} completed`
195
- * })
196
- * )
197
- *
198
- * return yield* Effect.all(tasks, { concurrency: "unbounded" })
199
- * }),
200
- * MaxOpsBeforeYield,
201
- * 10000
202
- * )
203
- * })
204
- *
205
- * // Configure for fair scheduling
206
- * const fairSchedulingProgram = Effect.gen(function*() {
207
- * // Run with lower max ops for more frequent yielding
208
- * return yield* Effect.provideService(
209
- * Effect.gen(function*() {
210
- * const maxOps = yield* MaxOpsBeforeYield
211
- * yield* Effect.log(`Fair scheduling max ops: ${maxOps}`)
212
- *
213
- * const longRunningTask = Effect.gen(function*() {
214
- * for (let i = 0; i < 1000; i++) {
215
- * yield* Effect.sync(() => Math.random())
216
- * }
217
- * return "Long task completed"
218
- * })
219
- *
220
- * const quickTask = Effect.gen(function*() {
221
- * yield* Effect.sleep("10 millis")
222
- * return "Quick task completed"
223
- * })
224
- *
225
- * // Both tasks will execute fairly due to frequent yielding
226
- * return yield* Effect.all([longRunningTask, quickTask], {
227
- * concurrency: "unbounded"
228
- * })
229
- * }),
230
- * MaxOpsBeforeYield,
231
- * 50
232
- * )
233
- * })
234
- * ```
235
- *
236
133
  * @since 4.0.0
237
134
  * @category references
238
135
  */
@@ -1 +1 @@
1
- {"version":3,"file":"Scheduler.js","names":["ServiceMap","Scheduler","Reference","defaultValue","MixedScheduler","setImmediate","globalThis","f","timer","clearImmediate","setTimeout","clearTimeout","PriorityBuckets","buckets","scheduleTask","task","priority","len","length","bucket","index","push","splice","drain","tasks","running","undefined","executionMode","constructor","setImmediateFn","afterScheduled","runTasks","i","toRun","j","shouldYield","fiber","currentOpCount","maxOpsBeforeYield","flush","MaxOpsBeforeYield","PreventSchedulerYield"],"sources":["../src/Scheduler.ts"],"sourcesContent":[null],"mappings":"AAIA,OAAO,KAAKA,UAAU,MAAM,iBAAiB;AAqB7C;;;;AAIA,OAAO,MAAMC,SAAS,gBAAoCD,UAAU,CAACE,SAAS,CAAY,kBAAkB,EAAE;EAC5GC,YAAY,EAAEA,CAAA,KAAM,IAAIC,cAAc;CACvC,CAAC;AAEF,MAAMC,YAAY,GAAG,cAAc,IAAIC,UAAU,GAC5CC,CAAa,IAAI;EAClB;EACA,MAAMC,KAAK,GAAGF,UAAU,CAACD,YAAY,CAACE,CAAC,CAAC;EACxC;EACA,OAAO,MAAYD,UAAU,CAACG,cAAc,CAACD,KAAK,CAAC;AACrD,CAAC,GACED,CAAa,IAAI;EAClB,MAAMC,KAAK,GAAGE,UAAU,CAACH,CAAC,EAAE,CAAC,CAAC;EAC9B,OAAO,MAAYI,YAAY,CAACH,KAAK,CAAC;AACxC,CAAC;AAEH,MAAMI,eAAe;EACnBC,OAAO,GAAwD,EAAE;EAEjEC,YAAYA,CAACC,IAAgB,EAAEC,QAAgB;IAC7C,MAAMH,OAAO,GAAG,IAAI,CAACA,OAAO;IAC5B,MAAMI,GAAG,GAAGJ,OAAO,CAACK,MAAM;IAC1B,IAAIC,MAA+C;IACnD,IAAIC,KAAK,GAAG,CAAC;IACb,OAAOA,KAAK,GAAGH,GAAG,EAAEG,KAAK,EAAE,EAAE;MAC3B,IAAIP,OAAO,CAACO,KAAK,CAAC,CAAC,CAAC,CAAC,GAAGJ,QA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AC","ignoreList":[]}
1
+ {"version":3,"file":"Scheduler.js","names":["ServiceMap","Scheduler","Reference","defaultValue","MixedScheduler","setImmediate","globalThis","f","timer","clearImmediate","setTimeout","clearTimeout","PriorityBuckets","buckets","scheduleTask","task","priority","len","length","bucket","index","push","splice","drain","executionMode","constructor","setImmediateFn","shouldYield","fiber","currentOpCount","maxOpsBeforeYield","makeDispatcher","MixedSchedulerDispatcher","tasks","running","undefined","afterScheduled","runTasks","i","toRun","j","flush","MaxOpsBeforeYield","PreventSchedulerYield"],"sources":["../src/Scheduler.ts"],"sourcesContent":[null],"mappings":"AAIA,OAAO,KAAKA,UAAU,MAAM,iBAAiB;AA8B7C;;;;AAIA,OAAO,MAAMC,SAAS,gBAAoCD,UAAU,CAACE,SAAS,CAAY,kBAAkB,EAAE;EAC5GC,YAAY,EAAEA,CAAA,KAAM,IAAIC,cAAc;CACvC,CAAC;AAEF,MAAMC,YAAY,GAAG,cAAc,IAAIC,UAAU,GAC5CC,CAAa,IAAI;EAClB;EACA,MAAMC,KAAK,GAAGF,UAAU,CAACD,YAAY,CAACE,CAAC,CAAC;EACxC;EACA,OAAO,MAAYD,UAAU,CAACG,cAAc,CAACD,KAAK,CAAC;AACrD,CAAC,GACED,CAAa,IAAI;EAClB,MAAMC,KAAK,GAAGE,UAAU,CAACH,CAAC,EAAE,CAAC,CAAC;EAC9B,OAAO,MAAYI,YAAY,CAACH,KAAK,CAAC;AACxC,CAAC;AAEH,MAAMI,eAAe;EACnBC,OAAO,GAAwD,EAAE;EAEjEC,YAAYA,CAACC,IAAgB,EAAEC,QAAgB;IAC7C,MAAMH,OAAO,GAAG,IAAI,CAACA,OAAO;IAC5B,MAAMI,GAAG,GAAGJ,OAAO,CAACK,MAAM;IAC1B,IAAIC,MAA+C;IACnD,IAAIC,KAAK,GAAG,CAAC;IACb,OAAOA,KAAK,GAAGH,GAAG,EAAEG,KAAK,EAAE,EAAE;MAC3B,IAAIP,OAAO,CAACO,KAAK,CAAC,CAAC,C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