effect 4.0.0-beta.103 → 4.0.0-beta.104

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 (523) hide show
  1. package/dist/Cache.js +1 -1
  2. package/dist/Cache.js.map +1 -1
  3. package/dist/Channel.d.ts +1 -1
  4. package/dist/Channel.d.ts.map +1 -1
  5. package/dist/Channel.js.map +1 -1
  6. package/dist/Config.d.ts.map +1 -1
  7. package/dist/Config.js +28 -7
  8. package/dist/Config.js.map +1 -1
  9. package/dist/ConfigProvider.d.ts.map +1 -1
  10. package/dist/ConfigProvider.js +2 -1
  11. package/dist/ConfigProvider.js.map +1 -1
  12. package/dist/Context.d.ts +2 -2
  13. package/dist/Context.d.ts.map +1 -1
  14. package/dist/Context.js.map +1 -1
  15. package/dist/Crypto.d.ts.map +1 -1
  16. package/dist/Crypto.js +13 -5
  17. package/dist/Crypto.js.map +1 -1
  18. package/dist/Duration.d.ts.map +1 -1
  19. package/dist/Duration.js +12 -1
  20. package/dist/Duration.js.map +1 -1
  21. package/dist/Effect.d.ts +132 -14
  22. package/dist/Effect.d.ts.map +1 -1
  23. package/dist/Effect.js +38 -0
  24. package/dist/Effect.js.map +1 -1
  25. package/dist/Equal.d.ts.map +1 -1
  26. package/dist/Equal.js +10 -2
  27. package/dist/Equal.js.map +1 -1
  28. package/dist/ExecutionPlan.d.ts +73 -0
  29. package/dist/ExecutionPlan.d.ts.map +1 -1
  30. package/dist/ExecutionPlan.js +1 -1
  31. package/dist/ExecutionPlan.js.map +1 -1
  32. package/dist/FiberSet.js +1 -1
  33. package/dist/FileSystem.d.ts +2 -2
  34. package/dist/Function.d.ts +4 -3
  35. package/dist/Function.d.ts.map +1 -1
  36. package/dist/Function.js +5 -5
  37. package/dist/Function.js.map +1 -1
  38. package/dist/Iterable.d.ts.map +1 -1
  39. package/dist/Iterable.js +11 -10
  40. package/dist/Iterable.js.map +1 -1
  41. package/dist/Layer.d.ts.map +1 -1
  42. package/dist/Layer.js +7 -5
  43. package/dist/Layer.js.map +1 -1
  44. package/dist/Schedule.d.ts +8 -8
  45. package/dist/Schedule.d.ts.map +1 -1
  46. package/dist/Schedule.js +4 -4
  47. package/dist/Schedule.js.map +1 -1
  48. package/dist/Schema.d.ts +32 -32
  49. package/dist/Schema.d.ts.map +1 -1
  50. package/dist/Schema.js +23 -18
  51. package/dist/Schema.js.map +1 -1
  52. package/dist/SchemaAST.d.ts +3 -3
  53. package/dist/SchemaAST.d.ts.map +1 -1
  54. package/dist/SchemaAST.js +47 -31
  55. package/dist/SchemaAST.js.map +1 -1
  56. package/dist/SchemaParser.d.ts.map +1 -1
  57. package/dist/SchemaParser.js +35 -53
  58. package/dist/SchemaParser.js.map +1 -1
  59. package/dist/ScopedCache.js +1 -1
  60. package/dist/ScopedCache.js.map +1 -1
  61. package/dist/Sink.d.ts +1 -1
  62. package/dist/Sink.d.ts.map +1 -1
  63. package/dist/Stream.d.ts +27 -4
  64. package/dist/Stream.d.ts.map +1 -1
  65. package/dist/Stream.js +27 -2
  66. package/dist/Stream.js.map +1 -1
  67. package/dist/SynchronizedRef.js +1 -1
  68. package/dist/SynchronizedRef.js.map +1 -1
  69. package/dist/Terminal.js +1 -1
  70. package/dist/Terminal.js.map +1 -1
  71. package/dist/Tuple.d.ts +6 -4
  72. package/dist/Tuple.d.ts.map +1 -1
  73. package/dist/Tuple.js.map +1 -1
  74. package/dist/TxReentrantLock.d.ts +0 -56
  75. package/dist/TxReentrantLock.d.ts.map +1 -1
  76. package/dist/TxReentrantLock.js +8 -8
  77. package/dist/TxReentrantLock.js.map +1 -1
  78. package/dist/internal/dateTime.js +1 -1
  79. package/dist/internal/dateTime.js.map +1 -1
  80. package/dist/internal/executionPlan.js +51 -3
  81. package/dist/internal/executionPlan.js.map +1 -1
  82. package/dist/internal/hashMap.js +12 -8
  83. package/dist/internal/hashMap.js.map +1 -1
  84. package/dist/internal/matcher.js +1 -1
  85. package/dist/internal/matcher.js.map +1 -1
  86. package/dist/internal/schedule.js.map +1 -1
  87. package/dist/internal/schema/annotations.js +2 -0
  88. package/dist/internal/schema/annotations.js.map +1 -1
  89. package/dist/internal/schema/toArbitrary.js +1 -1
  90. package/dist/internal/schema/toArbitrary.js.map +1 -1
  91. package/dist/internal/trie.js +13 -3
  92. package/dist/internal/trie.js.map +1 -1
  93. package/dist/testing/TestClock.d.ts.map +1 -1
  94. package/dist/testing/TestClock.js +11 -1
  95. package/dist/testing/TestClock.js.map +1 -1
  96. package/dist/testing/TestSchema.d.ts +1 -1
  97. package/dist/testing/TestSchema.d.ts.map +1 -1
  98. package/dist/unstable/ai/AiError.js +19 -19
  99. package/dist/unstable/ai/AiError.js.map +1 -1
  100. package/dist/unstable/ai/Chat.js +1 -1
  101. package/dist/unstable/ai/Chat.js.map +1 -1
  102. package/dist/unstable/ai/LanguageModel.js +4 -2
  103. package/dist/unstable/ai/LanguageModel.js.map +1 -1
  104. package/dist/unstable/ai/McpSchema.d.ts +132 -132
  105. package/dist/unstable/ai/McpSchema.d.ts.map +1 -1
  106. package/dist/unstable/ai/McpSchema.js +8 -8
  107. package/dist/unstable/ai/McpSchema.js.map +1 -1
  108. package/dist/unstable/ai/McpServer.js +1 -1
  109. package/dist/unstable/ai/McpServer.js.map +1 -1
  110. package/dist/unstable/ai/Prompt.d.ts +15 -3
  111. package/dist/unstable/ai/Prompt.d.ts.map +1 -1
  112. package/dist/unstable/ai/Prompt.js +6 -3
  113. package/dist/unstable/ai/Prompt.js.map +1 -1
  114. package/dist/unstable/cli/CliError.d.ts +3 -3
  115. package/dist/unstable/cli/CliError.js +11 -11
  116. package/dist/unstable/cli/CliError.js.map +1 -1
  117. package/dist/unstable/cli/Command.d.ts +9 -9
  118. package/dist/unstable/cli/Command.d.ts.map +1 -1
  119. package/dist/unstable/cli/Command.js +8 -6
  120. package/dist/unstable/cli/Command.js.map +1 -1
  121. package/dist/unstable/cli/Param.d.ts +7 -5
  122. package/dist/unstable/cli/Param.d.ts.map +1 -1
  123. package/dist/unstable/cli/Param.js +15 -11
  124. package/dist/unstable/cli/Param.js.map +1 -1
  125. package/dist/unstable/cli/Primitive.d.ts.map +1 -1
  126. package/dist/unstable/cli/Primitive.js +31 -24
  127. package/dist/unstable/cli/Primitive.js.map +1 -1
  128. package/dist/unstable/cli/Prompt.d.ts.map +1 -1
  129. package/dist/unstable/cli/Prompt.js +31 -17
  130. package/dist/unstable/cli/Prompt.js.map +1 -1
  131. package/dist/unstable/cli/internal/ansi.js +2 -2
  132. package/dist/unstable/cli/internal/ansi.js.map +1 -1
  133. package/dist/unstable/cli/internal/command.d.ts +2 -2
  134. package/dist/unstable/cli/internal/command.d.ts.map +1 -1
  135. package/dist/unstable/cli/internal/command.js +10 -9
  136. package/dist/unstable/cli/internal/command.js.map +1 -1
  137. package/dist/unstable/cli/internal/completions/bash.js +69 -9
  138. package/dist/unstable/cli/internal/completions/bash.js.map +1 -1
  139. package/dist/unstable/cli/internal/completions/descriptor.js +24 -18
  140. package/dist/unstable/cli/internal/completions/descriptor.js.map +1 -1
  141. package/dist/unstable/cli/internal/completions/fish.js +5 -5
  142. package/dist/unstable/cli/internal/completions/fish.js.map +1 -1
  143. package/dist/unstable/cli/internal/help.d.ts.map +1 -1
  144. package/dist/unstable/cli/internal/help.js +4 -2
  145. package/dist/unstable/cli/internal/help.js.map +1 -1
  146. package/dist/unstable/cli/internal/parser.js +3 -3
  147. package/dist/unstable/cli/internal/parser.js.map +1 -1
  148. package/dist/unstable/cli/internal/wizard.js +2 -2
  149. package/dist/unstable/cli/internal/wizard.js.map +1 -1
  150. package/dist/unstable/cluster/ClusterError.js +7 -7
  151. package/dist/unstable/cluster/ClusterError.js.map +1 -1
  152. package/dist/unstable/cluster/ClusterWorkflowEngine.d.ts.map +1 -1
  153. package/dist/unstable/cluster/ClusterWorkflowEngine.js +1 -1
  154. package/dist/unstable/cluster/ClusterWorkflowEngine.js.map +1 -1
  155. package/dist/unstable/cluster/MessageStorage.d.ts.map +1 -1
  156. package/dist/unstable/cluster/MessageStorage.js +8 -1
  157. package/dist/unstable/cluster/MessageStorage.js.map +1 -1
  158. package/dist/unstable/cluster/Reply.d.ts +8 -0
  159. package/dist/unstable/cluster/Reply.d.ts.map +1 -1
  160. package/dist/unstable/cluster/Reply.js +12 -0
  161. package/dist/unstable/cluster/Reply.js.map +1 -1
  162. package/dist/unstable/cluster/RunnerServer.d.ts.map +1 -1
  163. package/dist/unstable/cluster/RunnerServer.js +4 -2
  164. package/dist/unstable/cluster/RunnerServer.js.map +1 -1
  165. package/dist/unstable/cluster/RunnerStorage.d.ts +1 -2
  166. package/dist/unstable/cluster/RunnerStorage.d.ts.map +1 -1
  167. package/dist/unstable/cluster/RunnerStorage.js +7 -6
  168. package/dist/unstable/cluster/RunnerStorage.js.map +1 -1
  169. package/dist/unstable/cluster/Sharding.d.ts.map +1 -1
  170. package/dist/unstable/cluster/Sharding.js +22 -4
  171. package/dist/unstable/cluster/Sharding.js.map +1 -1
  172. package/dist/unstable/cluster/internal/entityManager.js +1 -1
  173. package/dist/unstable/cluster/internal/entityManager.js.map +1 -1
  174. package/dist/unstable/cluster/internal/resourceMap.js +2 -2
  175. package/dist/unstable/cluster/internal/resourceMap.js.map +1 -1
  176. package/dist/unstable/cluster/internal/resourceRef.js +17 -0
  177. package/dist/unstable/cluster/internal/resourceRef.js.map +1 -1
  178. package/dist/unstable/devtools/DevToolsClient.d.ts.map +1 -1
  179. package/dist/unstable/devtools/DevToolsClient.js +7 -2
  180. package/dist/unstable/devtools/DevToolsClient.js.map +1 -1
  181. package/dist/unstable/encoding/Ini.d.ts +20 -0
  182. package/dist/unstable/encoding/Ini.d.ts.map +1 -0
  183. package/dist/unstable/encoding/Ini.js +153 -0
  184. package/dist/unstable/encoding/Ini.js.map +1 -0
  185. package/dist/unstable/encoding/Msgpack.d.ts +2 -1
  186. package/dist/unstable/encoding/Msgpack.d.ts.map +1 -1
  187. package/dist/unstable/encoding/Msgpack.js +21 -7
  188. package/dist/unstable/encoding/Msgpack.js.map +1 -1
  189. package/dist/unstable/encoding/Ndjson.d.ts.map +1 -1
  190. package/dist/unstable/encoding/Ndjson.js +7 -1
  191. package/dist/unstable/encoding/Ndjson.js.map +1 -1
  192. package/dist/unstable/encoding/Sse.d.ts.map +1 -1
  193. package/dist/unstable/encoding/Sse.js +14 -23
  194. package/dist/unstable/encoding/Sse.js.map +1 -1
  195. package/dist/unstable/encoding/Toml.d.ts +19 -0
  196. package/dist/unstable/encoding/Toml.d.ts.map +1 -0
  197. package/dist/unstable/encoding/Toml.js +434 -0
  198. package/dist/unstable/encoding/Toml.js.map +1 -0
  199. package/dist/unstable/encoding/Yaml.d.ts +19 -0
  200. package/dist/unstable/encoding/Yaml.d.ts.map +1 -0
  201. package/dist/unstable/encoding/Yaml.js +461 -0
  202. package/dist/unstable/encoding/Yaml.js.map +1 -0
  203. package/dist/unstable/encoding/index.d.ts +12 -0
  204. package/dist/unstable/encoding/index.d.ts.map +1 -1
  205. package/dist/unstable/encoding/index.js +12 -0
  206. package/dist/unstable/encoding/index.js.map +1 -1
  207. package/dist/unstable/eventlog/EventJournal.d.ts +1 -1
  208. package/dist/unstable/eventlog/EventJournal.d.ts.map +1 -1
  209. package/dist/unstable/eventlog/EventJournal.js +13 -5
  210. package/dist/unstable/eventlog/EventJournal.js.map +1 -1
  211. package/dist/unstable/eventlog/EventLogMessage.js +1 -1
  212. package/dist/unstable/eventlog/EventLogMessage.js.map +1 -1
  213. package/dist/unstable/eventlog/EventLogServerUnencrypted.js +1 -1
  214. package/dist/unstable/eventlog/EventLogServerUnencrypted.js.map +1 -1
  215. package/dist/unstable/eventlog/SqlEventJournal.d.ts.map +1 -1
  216. package/dist/unstable/eventlog/SqlEventJournal.js +1 -4
  217. package/dist/unstable/eventlog/SqlEventJournal.js.map +1 -1
  218. package/dist/unstable/http/FindMyWay/internal/queryString.d.ts +11 -0
  219. package/dist/unstable/http/FindMyWay/internal/queryString.d.ts.map +1 -0
  220. package/dist/unstable/http/FindMyWay/internal/queryString.js +259 -0
  221. package/dist/unstable/http/FindMyWay/internal/queryString.js.map +1 -0
  222. package/dist/unstable/http/FindMyWay/internal/router.d.ts +2 -0
  223. package/dist/unstable/http/FindMyWay/internal/router.d.ts.map +1 -0
  224. package/dist/unstable/http/FindMyWay/internal/router.js +665 -0
  225. package/dist/unstable/http/FindMyWay/internal/router.js.map +1 -0
  226. package/dist/unstable/http/FindMyWay.d.ts +33 -8
  227. package/dist/unstable/http/FindMyWay.d.ts.map +1 -1
  228. package/dist/unstable/http/FindMyWay.js +4 -7
  229. package/dist/unstable/http/FindMyWay.js.map +1 -1
  230. package/dist/unstable/http/HttpClientError.js +1 -1
  231. package/dist/unstable/http/HttpClientError.js.map +1 -1
  232. package/dist/unstable/http/HttpClientRequest.d.ts.map +1 -1
  233. package/dist/unstable/http/HttpClientRequest.js +2 -14
  234. package/dist/unstable/http/HttpClientRequest.js.map +1 -1
  235. package/dist/unstable/http/HttpClientResponse.js +1 -16
  236. package/dist/unstable/http/HttpClientResponse.js.map +1 -1
  237. package/dist/unstable/http/HttpPlatform.d.ts.map +1 -1
  238. package/dist/unstable/http/HttpPlatform.js +21 -3
  239. package/dist/unstable/http/HttpPlatform.js.map +1 -1
  240. package/dist/unstable/http/HttpServerRequest.d.ts.map +1 -1
  241. package/dist/unstable/http/HttpServerRequest.js +7 -6
  242. package/dist/unstable/http/HttpServerRequest.js.map +1 -1
  243. package/dist/unstable/http/HttpServerResponse.d.ts.map +1 -1
  244. package/dist/unstable/http/HttpServerResponse.js +8 -6
  245. package/dist/unstable/http/HttpServerResponse.js.map +1 -1
  246. package/dist/unstable/http/Multipart.d.ts +1 -1
  247. package/dist/unstable/http/Multipart.d.ts.map +1 -1
  248. package/dist/unstable/http/Multipart.js +9 -2
  249. package/dist/unstable/http/Multipart.js.map +1 -1
  250. package/dist/unstable/http/MultipartParser/HeadersParser.d.ts +53 -0
  251. package/dist/unstable/http/MultipartParser/HeadersParser.d.ts.map +1 -0
  252. package/dist/unstable/http/MultipartParser/HeadersParser.js +14 -0
  253. package/dist/unstable/http/MultipartParser/HeadersParser.js.map +1 -0
  254. package/dist/unstable/http/MultipartParser/Search.d.ts +11 -0
  255. package/dist/unstable/http/MultipartParser/Search.d.ts.map +1 -0
  256. package/dist/unstable/http/MultipartParser/Search.js +14 -0
  257. package/dist/unstable/http/MultipartParser/Search.js.map +1 -0
  258. package/dist/unstable/http/MultipartParser/internal/contentType.d.ts +5 -0
  259. package/dist/unstable/http/MultipartParser/internal/contentType.d.ts.map +1 -0
  260. package/dist/unstable/http/MultipartParser/internal/contentType.js +82 -0
  261. package/dist/unstable/http/MultipartParser/internal/contentType.js.map +1 -0
  262. package/dist/unstable/http/MultipartParser/internal/headers.d.ts +3 -0
  263. package/dist/unstable/http/MultipartParser/internal/headers.d.ts.map +1 -0
  264. package/dist/unstable/http/MultipartParser/internal/headers.js +194 -0
  265. package/dist/unstable/http/MultipartParser/internal/headers.js.map +1 -0
  266. package/dist/unstable/http/MultipartParser/internal/multipart.d.ts +8 -0
  267. package/dist/unstable/http/MultipartParser/internal/multipart.d.ts.map +1 -0
  268. package/dist/unstable/http/MultipartParser/internal/multipart.js +226 -0
  269. package/dist/unstable/http/MultipartParser/internal/multipart.js.map +1 -0
  270. package/dist/unstable/http/MultipartParser/internal/search.d.ts +5 -0
  271. package/dist/unstable/http/MultipartParser/internal/search.d.ts.map +1 -0
  272. package/dist/unstable/http/MultipartParser/internal/search.js +120 -0
  273. package/dist/unstable/http/MultipartParser/internal/search.js.map +1 -0
  274. package/dist/unstable/http/MultipartParser.d.ts +98 -0
  275. package/dist/unstable/http/MultipartParser.d.ts.map +1 -0
  276. package/dist/unstable/http/MultipartParser.js +23 -0
  277. package/dist/unstable/http/MultipartParser.js.map +1 -0
  278. package/dist/unstable/http/Template.d.ts.map +1 -1
  279. package/dist/unstable/http/Template.js +2 -2
  280. package/dist/unstable/http/Template.js.map +1 -1
  281. package/dist/unstable/http/index.d.ts +1 -1
  282. package/dist/unstable/http/index.d.ts.map +1 -1
  283. package/dist/unstable/http/index.js +1 -1
  284. package/dist/unstable/http/index.js.map +1 -1
  285. package/dist/unstable/http/internal/httpBody.d.ts +2 -0
  286. package/dist/unstable/http/internal/httpBody.d.ts.map +1 -0
  287. package/dist/unstable/http/internal/httpBody.js +10 -0
  288. package/dist/unstable/http/internal/httpBody.js.map +1 -0
  289. package/dist/unstable/httpapi/HttpApi.d.ts.map +1 -1
  290. package/dist/unstable/httpapi/HttpApi.js +5 -5
  291. package/dist/unstable/httpapi/HttpApi.js.map +1 -1
  292. package/dist/unstable/httpapi/HttpApiBuilder.js +68 -15
  293. package/dist/unstable/httpapi/HttpApiBuilder.js.map +1 -1
  294. package/dist/unstable/httpapi/HttpApiClient.d.ts +1 -1
  295. package/dist/unstable/httpapi/HttpApiClient.d.ts.map +1 -1
  296. package/dist/unstable/httpapi/HttpApiClient.js +65 -25
  297. package/dist/unstable/httpapi/HttpApiClient.js.map +1 -1
  298. package/dist/unstable/httpapi/HttpApiEndpoint.d.ts +6 -4
  299. package/dist/unstable/httpapi/HttpApiEndpoint.d.ts.map +1 -1
  300. package/dist/unstable/httpapi/HttpApiEndpoint.js +73 -16
  301. package/dist/unstable/httpapi/HttpApiEndpoint.js.map +1 -1
  302. package/dist/unstable/httpapi/HttpApiError.d.ts +5 -5
  303. package/dist/unstable/httpapi/HttpApiError.d.ts.map +1 -1
  304. package/dist/unstable/httpapi/HttpApiError.js +17 -17
  305. package/dist/unstable/httpapi/HttpApiError.js.map +1 -1
  306. package/dist/unstable/httpapi/HttpApiMiddleware.d.ts +1 -1
  307. package/dist/unstable/httpapi/HttpApiMiddleware.js +1 -1
  308. package/dist/unstable/httpapi/HttpApiSchema.d.ts +219 -0
  309. package/dist/unstable/httpapi/HttpApiSchema.d.ts.map +1 -1
  310. package/dist/unstable/httpapi/HttpApiSchema.js +170 -0
  311. package/dist/unstable/httpapi/HttpApiSchema.js.map +1 -1
  312. package/dist/unstable/httpapi/OpenApi.d.ts +8 -0
  313. package/dist/unstable/httpapi/OpenApi.d.ts.map +1 -1
  314. package/dist/unstable/httpapi/OpenApi.js +45 -18
  315. package/dist/unstable/httpapi/OpenApi.js.map +1 -1
  316. package/dist/unstable/observability/OtlpExporter.d.ts +1 -1
  317. package/dist/unstable/observability/OtlpExporter.d.ts.map +1 -1
  318. package/dist/unstable/observability/OtlpExporter.js +2 -1
  319. package/dist/unstable/observability/OtlpExporter.js.map +1 -1
  320. package/dist/unstable/observability/OtlpLogger.d.ts.map +1 -1
  321. package/dist/unstable/observability/OtlpLogger.js +2 -2
  322. package/dist/unstable/observability/OtlpLogger.js.map +1 -1
  323. package/dist/unstable/observability/OtlpMetrics.d.ts +2 -2
  324. package/dist/unstable/observability/OtlpMetrics.d.ts.map +1 -1
  325. package/dist/unstable/observability/OtlpMetrics.js +28 -15
  326. package/dist/unstable/observability/OtlpMetrics.js.map +1 -1
  327. package/dist/unstable/observability/OtlpTracer.js +1 -1
  328. package/dist/unstable/observability/OtlpTracer.js.map +1 -1
  329. package/dist/unstable/persistence/PersistedQueue.d.ts.map +1 -1
  330. package/dist/unstable/persistence/PersistedQueue.js +9 -9
  331. package/dist/unstable/persistence/PersistedQueue.js.map +1 -1
  332. package/dist/unstable/persistence/Persistence.d.ts.map +1 -1
  333. package/dist/unstable/persistence/Persistence.js +17 -7
  334. package/dist/unstable/persistence/Persistence.js.map +1 -1
  335. package/dist/unstable/persistence/RateLimiter.d.ts +22 -12
  336. package/dist/unstable/persistence/RateLimiter.d.ts.map +1 -1
  337. package/dist/unstable/persistence/RateLimiter.js +15 -42
  338. package/dist/unstable/persistence/RateLimiter.js.map +1 -1
  339. package/dist/unstable/persistence/Redis.js +1 -1
  340. package/dist/unstable/persistence/Redis.js.map +1 -1
  341. package/dist/unstable/rpc/RpcClient.d.ts +14 -0
  342. package/dist/unstable/rpc/RpcClient.d.ts.map +1 -1
  343. package/dist/unstable/rpc/RpcClient.js +18 -9
  344. package/dist/unstable/rpc/RpcClient.js.map +1 -1
  345. package/dist/unstable/rpc/RpcClientError.js +2 -2
  346. package/dist/unstable/rpc/RpcClientError.js.map +1 -1
  347. package/dist/unstable/rpc/RpcSerialization.js +3 -1
  348. package/dist/unstable/rpc/RpcSerialization.js.map +1 -1
  349. package/dist/unstable/schema/Model.d.ts +1 -1
  350. package/dist/unstable/schema/Model.d.ts.map +1 -1
  351. package/dist/unstable/schema/VariantSchema.d.ts +5 -5
  352. package/dist/unstable/schema/VariantSchema.d.ts.map +1 -1
  353. package/dist/unstable/schema/VariantSchema.js +17 -9
  354. package/dist/unstable/schema/VariantSchema.js.map +1 -1
  355. package/dist/unstable/socket/Socket.d.ts.map +1 -1
  356. package/dist/unstable/socket/Socket.js +28 -12
  357. package/dist/unstable/socket/Socket.js.map +1 -1
  358. package/dist/unstable/sql/SqlClient.d.ts.map +1 -1
  359. package/dist/unstable/sql/SqlClient.js +7 -3
  360. package/dist/unstable/sql/SqlClient.js.map +1 -1
  361. package/dist/unstable/sql/SqlError.js +13 -13
  362. package/dist/unstable/sql/SqlError.js.map +1 -1
  363. package/dist/unstable/sql/SqlResolver.js +8 -6
  364. package/dist/unstable/sql/SqlResolver.js.map +1 -1
  365. package/dist/unstable/sql/Statement.d.ts.map +1 -1
  366. package/dist/unstable/sql/Statement.js +8 -6
  367. package/dist/unstable/sql/Statement.js.map +1 -1
  368. package/dist/unstable/workers/WorkerError.js +5 -5
  369. package/dist/unstable/workers/WorkerError.js.map +1 -1
  370. package/dist/unstable/workflow/WorkflowEngine.d.ts +1 -1
  371. package/dist/unstable/workflow/WorkflowEngine.d.ts.map +1 -1
  372. package/dist/unstable/workflow/WorkflowEngine.js +3 -3
  373. package/dist/unstable/workflow/WorkflowEngine.js.map +1 -1
  374. package/package.json +2 -8
  375. package/src/Cache.ts +1 -1
  376. package/src/Channel.ts +1 -1
  377. package/src/Config.ts +28 -7
  378. package/src/ConfigProvider.ts +4 -1
  379. package/src/Context.ts +5 -5
  380. package/src/Crypto.ts +17 -8
  381. package/src/Duration.ts +16 -2
  382. package/src/Effect.ts +141 -17
  383. package/src/Equal.ts +10 -2
  384. package/src/ExecutionPlan.ts +78 -1
  385. package/src/FiberSet.ts +1 -1
  386. package/src/FileSystem.ts +2 -2
  387. package/src/Function.ts +6 -6
  388. package/src/Iterable.ts +11 -10
  389. package/src/Layer.ts +7 -5
  390. package/src/Schedule.ts +13 -13
  391. package/src/Schema.ts +50 -41
  392. package/src/SchemaAST.ts +69 -37
  393. package/src/SchemaParser.ts +75 -69
  394. package/src/ScopedCache.ts +1 -1
  395. package/src/Sink.ts +1 -1
  396. package/src/Stream.ts +77 -10
  397. package/src/SynchronizedRef.ts +1 -1
  398. package/src/Terminal.ts +1 -1
  399. package/src/Tuple.ts +7 -4
  400. package/src/TxReentrantLock.ts +39 -35
  401. package/src/internal/dateTime.ts +1 -1
  402. package/src/internal/executionPlan.ts +105 -10
  403. package/src/internal/hashMap.ts +20 -14
  404. package/src/internal/matcher.ts +2 -2
  405. package/src/internal/schedule.ts +4 -4
  406. package/src/internal/schema/annotations.ts +3 -0
  407. package/src/internal/schema/toArbitrary.ts +3 -1
  408. package/src/internal/trie.ts +12 -2
  409. package/src/testing/TestClock.ts +13 -1
  410. package/src/testing/TestSchema.ts +1 -1
  411. package/src/unstable/ai/AiError.ts +19 -19
  412. package/src/unstable/ai/Chat.ts +1 -1
  413. package/src/unstable/ai/LanguageModel.ts +4 -2
  414. package/src/unstable/ai/McpSchema.ts +17 -16
  415. package/src/unstable/ai/McpServer.ts +1 -1
  416. package/src/unstable/ai/Prompt.ts +21 -6
  417. package/src/unstable/cli/CliError.ts +12 -12
  418. package/src/unstable/cli/Command.ts +12 -10
  419. package/src/unstable/cli/Param.ts +41 -19
  420. package/src/unstable/cli/Primitive.ts +11 -5
  421. package/src/unstable/cli/Prompt.ts +36 -20
  422. package/src/unstable/cli/internal/ansi.ts +2 -2
  423. package/src/unstable/cli/internal/command.ts +15 -10
  424. package/src/unstable/cli/internal/completions/bash.ts +59 -9
  425. package/src/unstable/cli/internal/completions/descriptor.ts +14 -20
  426. package/src/unstable/cli/internal/completions/fish.ts +5 -7
  427. package/src/unstable/cli/internal/help.ts +4 -2
  428. package/src/unstable/cli/internal/parser.ts +3 -3
  429. package/src/unstable/cli/internal/wizard.ts +2 -2
  430. package/src/unstable/cluster/ClusterError.ts +7 -7
  431. package/src/unstable/cluster/ClusterWorkflowEngine.ts +4 -1
  432. package/src/unstable/cluster/MessageStorage.ts +9 -5
  433. package/src/unstable/cluster/Reply.ts +21 -0
  434. package/src/unstable/cluster/RunnerServer.ts +4 -10
  435. package/src/unstable/cluster/RunnerStorage.ts +9 -7
  436. package/src/unstable/cluster/Sharding.ts +35 -7
  437. package/src/unstable/cluster/internal/entityManager.ts +1 -1
  438. package/src/unstable/cluster/internal/resourceMap.ts +5 -2
  439. package/src/unstable/cluster/internal/resourceRef.ts +27 -5
  440. package/src/unstable/devtools/DevToolsClient.ts +3 -2
  441. package/src/unstable/encoding/Ini.ts +174 -0
  442. package/src/unstable/encoding/Msgpack.ts +47 -28
  443. package/src/unstable/encoding/Ndjson.ts +9 -1
  444. package/src/unstable/encoding/Sse.ts +11 -21
  445. package/src/unstable/encoding/Toml.ts +504 -0
  446. package/src/unstable/encoding/Yaml.ts +541 -0
  447. package/src/unstable/encoding/index.ts +15 -0
  448. package/src/unstable/eventlog/EventJournal.ts +14 -6
  449. package/src/unstable/eventlog/EventLogMessage.ts +1 -1
  450. package/src/unstable/eventlog/EventLogServerUnencrypted.ts +1 -1
  451. package/src/unstable/eventlog/SqlEventJournal.ts +6 -4
  452. package/src/unstable/http/FindMyWay/internal/queryString.ts +420 -0
  453. package/src/unstable/http/FindMyWay/internal/router.ts +950 -0
  454. package/src/unstable/http/FindMyWay.ts +65 -6
  455. package/src/unstable/http/HttpClientError.ts +1 -1
  456. package/src/unstable/http/HttpClientRequest.ts +2 -14
  457. package/src/unstable/http/HttpClientResponse.ts +1 -17
  458. package/src/unstable/http/HttpPlatform.ts +34 -6
  459. package/src/unstable/http/HttpServerRequest.ts +14 -6
  460. package/src/unstable/http/HttpServerResponse.ts +9 -7
  461. package/src/unstable/http/Multipart.ts +9 -2
  462. package/src/unstable/http/MultipartParser/HeadersParser.ts +68 -0
  463. package/src/unstable/http/MultipartParser/Search.ts +17 -0
  464. package/src/unstable/http/MultipartParser/internal/contentType.ts +103 -0
  465. package/src/unstable/http/MultipartParser/internal/headers.ts +615 -0
  466. package/src/unstable/http/MultipartParser/internal/multipart.ts +262 -0
  467. package/src/unstable/http/MultipartParser/internal/search.ts +167 -0
  468. package/src/unstable/http/MultipartParser.ts +115 -0
  469. package/src/unstable/http/Template.ts +6 -5
  470. package/src/unstable/http/index.ts +1 -1
  471. package/src/unstable/http/internal/httpBody.ts +15 -0
  472. package/src/unstable/httpapi/HttpApi.ts +6 -7
  473. package/src/unstable/httpapi/HttpApiBuilder.ts +119 -21
  474. package/src/unstable/httpapi/HttpApiClient.ts +104 -41
  475. package/src/unstable/httpapi/HttpApiEndpoint.ts +117 -29
  476. package/src/unstable/httpapi/HttpApiError.ts +33 -39
  477. package/src/unstable/httpapi/HttpApiMiddleware.ts +1 -1
  478. package/src/unstable/httpapi/HttpApiSchema.ts +353 -0
  479. package/src/unstable/httpapi/OpenApi.ts +70 -20
  480. package/src/unstable/observability/OtlpExporter.ts +4 -2
  481. package/src/unstable/observability/OtlpLogger.ts +3 -1
  482. package/src/unstable/observability/OtlpMetrics.ts +32 -18
  483. package/src/unstable/observability/OtlpTracer.ts +1 -1
  484. package/src/unstable/persistence/PersistedQueue.ts +12 -9
  485. package/src/unstable/persistence/Persistence.ts +27 -7
  486. package/src/unstable/persistence/RateLimiter.ts +54 -31
  487. package/src/unstable/persistence/Redis.ts +1 -1
  488. package/src/unstable/rpc/RpcClient.ts +38 -12
  489. package/src/unstable/rpc/RpcClientError.ts +2 -2
  490. package/src/unstable/rpc/RpcSerialization.ts +1 -1
  491. package/src/unstable/schema/VariantSchema.ts +36 -18
  492. package/src/unstable/socket/Socket.ts +24 -14
  493. package/src/unstable/sql/SqlClient.ts +65 -56
  494. package/src/unstable/sql/SqlError.ts +13 -13
  495. package/src/unstable/sql/SqlResolver.ts +8 -6
  496. package/src/unstable/sql/Statement.ts +13 -8
  497. package/src/unstable/workers/WorkerError.ts +5 -5
  498. package/src/unstable/workflow/WorkflowEngine.ts +8 -3
  499. package/dist/unstable/http/Multipasta/HeadersParser.d.ts +0 -14
  500. package/dist/unstable/http/Multipasta/HeadersParser.d.ts.map +0 -1
  501. package/dist/unstable/http/Multipasta/HeadersParser.js +0 -14
  502. package/dist/unstable/http/Multipasta/HeadersParser.js.map +0 -1
  503. package/dist/unstable/http/Multipasta/Node.d.ts +0 -14
  504. package/dist/unstable/http/Multipasta/Node.d.ts.map +0 -1
  505. package/dist/unstable/http/Multipasta/Node.js +0 -14
  506. package/dist/unstable/http/Multipasta/Node.js.map +0 -1
  507. package/dist/unstable/http/Multipasta/Search.d.ts +0 -14
  508. package/dist/unstable/http/Multipasta/Search.d.ts.map +0 -1
  509. package/dist/unstable/http/Multipasta/Search.js +0 -14
  510. package/dist/unstable/http/Multipasta/Search.js.map +0 -1
  511. package/dist/unstable/http/Multipasta/Web.d.ts +0 -14
  512. package/dist/unstable/http/Multipasta/Web.d.ts.map +0 -1
  513. package/dist/unstable/http/Multipasta/Web.js +0 -14
  514. package/dist/unstable/http/Multipasta/Web.js.map +0 -1
  515. package/dist/unstable/http/Multipasta.d.ts +0 -15
  516. package/dist/unstable/http/Multipasta.d.ts.map +0 -1
  517. package/dist/unstable/http/Multipasta.js +0 -15
  518. package/dist/unstable/http/Multipasta.js.map +0 -1
  519. package/src/unstable/http/Multipasta/HeadersParser.ts +0 -14
  520. package/src/unstable/http/Multipasta/Node.ts +0 -14
  521. package/src/unstable/http/Multipasta/Search.ts +0 -14
  522. package/src/unstable/http/Multipasta/Web.ts +0 -14
  523. package/src/unstable/http/Multipasta.ts +0 -15
@@ -0,0 +1,541 @@
1
+ /**
2
+ * Parses YAML configuration files.
3
+ *
4
+ * This is a focused YAML 1.2 configuration parser. It supports block and flow
5
+ * collections, quoted and block scalars, anchors, and aliases.
6
+ *
7
+ * @since 4.0.0
8
+ */
9
+
10
+ /*
11
+ * The behavior is based on `yaml` 2.9.0.
12
+ *
13
+ * Copyright Eemeli Aro <eemeli@gmail.com>
14
+ *
15
+ * Permission to use, copy, modify, and/or distribute this software for any
16
+ * purpose with or without fee is hereby granted, provided that the above
17
+ * copyright notice and this permission notice appear in all copies.
18
+ *
19
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
20
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
21
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
22
+ * SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
23
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
24
+ * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
25
+ * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
26
+ */
27
+
28
+ type YamlRecord = Record<string, unknown>
29
+
30
+ type Line = {
31
+ readonly raw: string
32
+ readonly text: string
33
+ readonly indent: number
34
+ readonly number: number
35
+ }
36
+
37
+ const hasOwn = Object.prototype.hasOwnProperty
38
+
39
+ const setProperty = (record: YamlRecord, key: string, value: unknown): void => {
40
+ Object.defineProperty(record, key, {
41
+ configurable: true,
42
+ enumerable: true,
43
+ writable: true,
44
+ value
45
+ })
46
+ }
47
+
48
+ const stripComment = (input: string): string => {
49
+ let quote: "'" | "\"" | undefined
50
+ let escaped = false
51
+ for (let index = 0; index < input.length; index++) {
52
+ const character = input[index]
53
+ if (quote === "\"") {
54
+ if (escaped) {
55
+ escaped = false
56
+ } else if (character === "\\") {
57
+ escaped = true
58
+ } else if (character === quote) {
59
+ quote = undefined
60
+ }
61
+ } else if (quote === "'") {
62
+ if (character === quote && input[index + 1] === quote) {
63
+ index++
64
+ } else if (character === quote) {
65
+ quote = undefined
66
+ }
67
+ } else if (character === "'" || character === "\"") {
68
+ quote = character
69
+ } else if (character === "#" && (index === 0 || /\s/.test(input[index - 1]))) {
70
+ return input.slice(0, index).trimEnd()
71
+ }
72
+ }
73
+ return input.trimEnd()
74
+ }
75
+
76
+ const mappingSeparator = (input: string): number => {
77
+ let quote: "'" | "\"" | undefined
78
+ let escaped = false
79
+ let depth = 0
80
+ for (let index = 0; index < input.length; index++) {
81
+ const character = input[index]
82
+ if (quote === "\"") {
83
+ if (escaped) escaped = false
84
+ else if (character === "\\") escaped = true
85
+ else if (character === quote) quote = undefined
86
+ } else if (quote === "'") {
87
+ if (character === quote && input[index + 1] === quote) index++
88
+ else if (character === quote) quote = undefined
89
+ } else if (character === "'" || character === "\"") {
90
+ quote = character
91
+ } else if (character === "[" || character === "{") {
92
+ depth++
93
+ } else if (character === "]" || character === "}") {
94
+ depth--
95
+ } else if (character === ":" && depth === 0 && (input[index + 1] === undefined || /\s/.test(input[index + 1]))) {
96
+ return index
97
+ }
98
+ }
99
+ return -1
100
+ }
101
+
102
+ const parseDoubleQuoted = (input: string): string => {
103
+ if (!input.endsWith("\"") || input.length < 2) {
104
+ throw new SyntaxError("Unterminated double-quoted YAML string")
105
+ }
106
+ let output = ""
107
+ for (let index = 1; index < input.length - 1; index++) {
108
+ const character = input[index]
109
+ if (character !== "\\") {
110
+ output += character
111
+ continue
112
+ }
113
+ const escape = input[++index]
114
+ const escapes: Record<string, string> = {
115
+ "0": "\0",
116
+ a: "\x07",
117
+ b: "\b",
118
+ t: "\t",
119
+ n: "\n",
120
+ v: "\v",
121
+ f: "\f",
122
+ r: "\r",
123
+ e: "\x1b",
124
+ " ": " ",
125
+ "\"": "\"",
126
+ "/": "/",
127
+ "\\": "\\",
128
+ N: "\u0085",
129
+ _: "\u00a0",
130
+ L: "\u2028",
131
+ P: "\u2029"
132
+ }
133
+ if (hasOwn.call(escapes, escape)) {
134
+ output += escapes[escape]
135
+ continue
136
+ }
137
+ if (escape === "x" || escape === "u" || escape === "U") {
138
+ const length = escape === "x" ? 2 : escape === "u" ? 4 : 8
139
+ const hex = input.slice(index + 1, index + 1 + length)
140
+ if (!new RegExp(`^[0-9A-Fa-f]{${length}}$`).test(hex)) {
141
+ throw new SyntaxError("Invalid unicode escape in YAML string")
142
+ }
143
+ output += String.fromCodePoint(Number.parseInt(hex, 16))
144
+ index += length
145
+ continue
146
+ }
147
+ throw new SyntaxError(`Invalid YAML escape '\\${escape}'`)
148
+ }
149
+ return output
150
+ }
151
+
152
+ const parseScalar = (input: string): unknown => {
153
+ const value = input.trim()
154
+ if (value.length === 0) return null
155
+ if (value.startsWith("\"") && value.endsWith("\"")) {
156
+ return parseDoubleQuoted(value)
157
+ }
158
+ if (value.startsWith("'") && value.endsWith("'")) {
159
+ return value.slice(1, -1).replace(/''/g, "'");
160
+ }
161
+ if (/^(?:null|~)$/i.test(value)) return null
162
+ if (/^true$/i.test(value)) return true
163
+ if (/^false$/i.test(value)) return false
164
+ if (/^[+-]?\.inf$/i.test(value)) return value[0] === "-" ? Number.NEGATIVE_INFINITY : Number.POSITIVE_INFINITY
165
+ if (/^\.nan$/i.test(value)) return Number.NaN
166
+
167
+ const normalized = value.replace(/_/g, "")
168
+ if (/^[+-]?0x[0-9a-f]+$/i.test(normalized)) {
169
+ const sign = normalized[0] === "-" ? -1 : 1
170
+ return sign * Number.parseInt(normalized.replace(/^[+-]?0x/i, ""), 16);
171
+ }
172
+ if (/^[+-]?0o[0-7]+$/i.test(normalized)) {
173
+ const sign = normalized[0] === "-" ? -1 : 1
174
+ return sign * Number.parseInt(normalized.replace(/^[+-]?0o/i, ""), 8);
175
+ }
176
+ if (
177
+ /^[+-]?(?:0|[1-9]\d*)$/.test(normalized) ||
178
+ /^[+-]?(?:(?:0|[1-9]\d*)?\.\d+|(?:0|[1-9]\d*)\.?\d*[eE][+-]?\d+)$/.test(normalized)
179
+ ) {
180
+ return Number(normalized)
181
+ }
182
+ return value
183
+ }
184
+
185
+ const parseKey = (input: string): string => {
186
+ const value = parseScalar(input)
187
+ return value === null || value === undefined ? "" : String(value)
188
+ }
189
+
190
+ class FlowParser {
191
+ private readonly input: string
192
+ private readonly anchors: ReadonlyMap<string, unknown>
193
+ private index = 0
194
+
195
+ constructor(input: string, anchors: ReadonlyMap<string, unknown>) {
196
+ this.input = input
197
+ this.anchors = anchors
198
+ }
199
+
200
+ parse(): unknown {
201
+ const value = this.parseValue()
202
+ this.skipWhitespace()
203
+ if (this.index !== this.input.length) {
204
+ this.fail("Unexpected flow collection content")
205
+ }
206
+ return value
207
+ }
208
+
209
+ private parseValue(): unknown {
210
+ this.skipWhitespace()
211
+ const character = this.peek()
212
+ if (character === "[") return this.parseSequence()
213
+ if (character === "{") return this.parseMapping()
214
+ if (character === "\"" || character === "'") return parseScalar(this.readQuoted(character))
215
+ if (character === "*") {
216
+ this.index++
217
+ const name = this.readUntil(/[,\]}\s]/)
218
+ if (!this.anchors.has(name)) this.fail(`Unknown alias '*${name}'`)
219
+ return this.anchors.get(name)
220
+ }
221
+ return parseScalar(this.readUntil(/[,\]}]/).trim());
222
+ }
223
+
224
+ private parseSequence(): Array<unknown> {
225
+ this.expect("[")
226
+ const output: Array<unknown> = []
227
+ this.skipWhitespace()
228
+ if (this.peek() === "]") {
229
+ this.index++
230
+ return output
231
+ }
232
+ while (true) {
233
+ output.push(this.parseValue())
234
+ this.skipWhitespace()
235
+ if (this.peek() === "]") {
236
+ this.index++
237
+ return output
238
+ }
239
+ this.expect(",")
240
+ this.skipWhitespace()
241
+ if (this.peek() === "]") {
242
+ this.index++
243
+ return output
244
+ }
245
+ }
246
+ }
247
+
248
+ private parseMapping(): YamlRecord {
249
+ this.expect("{")
250
+ const output: YamlRecord = {}
251
+ this.skipWhitespace()
252
+ if (this.peek() === "}") {
253
+ this.index++
254
+ return output
255
+ }
256
+ while (true) {
257
+ const key = this.parseKey()
258
+ this.skipWhitespace()
259
+ this.expect(":")
260
+ if (hasOwn.call(output, key)) this.fail(`Duplicate key '${key}'`)
261
+ setProperty(output, key, this.parseValue())
262
+ this.skipWhitespace()
263
+ if (this.peek() === "}") {
264
+ this.index++
265
+ return output
266
+ }
267
+ this.expect(",")
268
+ this.skipWhitespace()
269
+ if (this.peek() === "}") {
270
+ this.index++
271
+ return output
272
+ }
273
+ }
274
+ }
275
+
276
+ private parseKey(): string {
277
+ this.skipWhitespace()
278
+ const character = this.peek()
279
+ if (character === "\"" || character === "'") {
280
+ return parseKey(this.readQuoted(character))
281
+ }
282
+ return this.readUntil(/:/).trim();
283
+ }
284
+
285
+ private readQuoted(quote: string): string {
286
+ const start = this.index++
287
+ let escaped = false
288
+ while (this.index < this.input.length) {
289
+ const character = this.input[this.index++]
290
+ if (quote === "\"" && escaped) escaped = false
291
+ else if (quote === "\"" && character === "\\") escaped = true
292
+ else if (quote === "'" && character === quote && this.input[this.index] === quote) this.index++
293
+ else if (character === quote) return this.input.slice(start, this.index)
294
+ }
295
+ this.fail("Unterminated quoted scalar")
296
+ }
297
+
298
+ private readUntil(stop: RegExp): string {
299
+ const start = this.index
300
+ while (this.index < this.input.length && !stop.test(this.peek())) this.index++
301
+ return this.input.slice(start, this.index)
302
+ }
303
+
304
+ private skipWhitespace(): void {
305
+ while (/\s/.test(this.peek())) this.index++
306
+ }
307
+
308
+ private expect(character: string): void {
309
+ if (this.peek() !== character) this.fail(`Expected '${character}'`)
310
+ this.index++
311
+ }
312
+
313
+ private peek(): string {
314
+ return this.input[this.index] ?? ""
315
+ }
316
+
317
+ private fail(message: string): never {
318
+ throw new SyntaxError(`${message} at flow offset ${this.index}`)
319
+ }
320
+ }
321
+
322
+ class YamlParser {
323
+ private readonly lines: ReadonlyArray<Line>
324
+ private index = 0
325
+ private readonly anchors = new Map<string, unknown>()
326
+
327
+ constructor(lines: ReadonlyArray<Line>) {
328
+ this.lines = lines
329
+ }
330
+
331
+ parse(): unknown {
332
+ this.skipIgnored()
333
+ if (this.index >= this.lines.length) return null
334
+ const value = this.parseNode(this.lines[this.index].indent)
335
+ this.skipIgnored()
336
+ if (this.index < this.lines.length) {
337
+ this.fail(this.lines[this.index], "Unexpected content")
338
+ }
339
+ return value
340
+ }
341
+
342
+ private parseNode(indent: number): unknown {
343
+ this.skipIgnored()
344
+ const line = this.lines[this.index]
345
+ if (line === undefined) return null
346
+ if (line.indent !== indent) this.fail(line, `Expected indentation of ${indent} spaces`)
347
+ if (line.text === "-" || line.text.startsWith("- ")) return this.parseSequence(indent)
348
+ if (mappingSeparator(line.text) !== -1) return this.parseMapping(indent)
349
+ this.index++
350
+ return this.parseInlineValue(line.text)
351
+ }
352
+
353
+ private parseMapping(indent: number): YamlRecord {
354
+ const output: YamlRecord = {}
355
+ while (true) {
356
+ this.skipIgnored()
357
+ const line = this.lines[this.index]
358
+ if (line === undefined || line.indent < indent) return output
359
+ if (line.indent > indent) this.fail(line, `Unexpected indentation of ${line.indent} spaces`)
360
+ const separator = mappingSeparator(line.text)
361
+ if (separator === -1) return output
362
+ this.index++
363
+ this.parseMappingEntry(output, line.text, separator, indent, line)
364
+ }
365
+ }
366
+
367
+ private parseMappingEntry(
368
+ output: YamlRecord,
369
+ text: string,
370
+ separator: number,
371
+ indent: number,
372
+ line: Line
373
+ ): void {
374
+ const key = parseKey(text.slice(0, separator).trim())
375
+ const rawValue = text.slice(separator + 1).trim()
376
+ const value = this.parseNodeValue(rawValue, indent)
377
+ if (hasOwn.call(output, key)) this.fail(line, `Duplicate key '${key}'`)
378
+ setProperty(output, key, value)
379
+ }
380
+
381
+ private parseSequence(indent: number): Array<unknown> {
382
+ const output: Array<unknown> = []
383
+ while (true) {
384
+ this.skipIgnored()
385
+ const line = this.lines[this.index]
386
+ if (line === undefined || line.indent < indent) return output
387
+ if (line.indent > indent) this.fail(line, `Unexpected indentation of ${line.indent} spaces`)
388
+ if (line.text !== "-" && !line.text.startsWith("- ")) return output
389
+ this.index++
390
+ const item = line.text.slice(1).trimStart()
391
+ const separator = mappingSeparator(item)
392
+ if (separator === -1) {
393
+ output.push(this.parseNodeValue(item, indent))
394
+ continue
395
+ }
396
+
397
+ const mapping: YamlRecord = {}
398
+ this.parseMappingEntry(mapping, item, separator, indent + 2, line)
399
+ while (true) {
400
+ this.skipIgnored()
401
+ const continuation = this.lines[this.index]
402
+ if (continuation === undefined || continuation.indent <= indent) break
403
+ if (continuation.indent !== indent + 2) {
404
+ this.fail(continuation, `Expected indentation of ${indent + 2} spaces`)
405
+ }
406
+ const nextSeparator = mappingSeparator(continuation.text)
407
+ if (nextSeparator === -1) this.fail(continuation, "Expected a mapping entry")
408
+ this.index++
409
+ this.parseMappingEntry(mapping, continuation.text, nextSeparator, indent + 2, continuation)
410
+ }
411
+ output.push(mapping)
412
+ }
413
+ }
414
+
415
+ private parseNodeValue(rawValue: string, parentIndent: number): unknown {
416
+ let value = rawValue
417
+ let anchor: string | undefined
418
+ const anchorMatch = /^&([^\s,[\]{}]+)(?:\s+(.*))?$/.exec(value)
419
+ if (anchorMatch !== null) {
420
+ anchor = anchorMatch[1]
421
+ value = anchorMatch[2] ?? ""
422
+ }
423
+
424
+ let parsed: unknown
425
+ if (value.length === 0) {
426
+ this.skipIgnored()
427
+ const next = this.lines[this.index]
428
+ parsed = next !== undefined && next.indent > parentIndent ? this.parseNode(next.indent) : null
429
+ } else if (/^[|>](?:[1-9]?[+-]?|[+-]?[1-9]?)$/.test(value)) {
430
+ parsed = this.parseBlockScalar(value, parentIndent)
431
+ } else {
432
+ parsed = this.parseInlineValue(value)
433
+ }
434
+ if (anchor !== undefined) this.anchors.set(anchor, parsed)
435
+ return parsed
436
+ }
437
+
438
+ private parseInlineValue(value: string): unknown {
439
+ if (value.startsWith("*")) {
440
+ const name = value.slice(1).trim()
441
+ if (!this.anchors.has(name)) throw new SyntaxError(`Unknown YAML alias '*${name}'`)
442
+ return this.anchors.get(name)
443
+ }
444
+ if (value.startsWith("[") || value.startsWith("{")) {
445
+ return new FlowParser(value, this.anchors).parse()
446
+ }
447
+ return parseScalar(value)
448
+ }
449
+
450
+ private parseBlockScalar(indicator: string, parentIndent: number): string {
451
+ const style = indicator[0]
452
+ const chomp = indicator.includes("-") ? "strip" : indicator.includes("+") ? "keep" : "clip"
453
+ const explicitIndent = Number.parseInt(indicator.replace(/[^1-9]/g, ""), 10)
454
+ const start = this.index
455
+ let end = start
456
+ let contentIndent = Number.isNaN(explicitIndent) ? Number.POSITIVE_INFINITY : parentIndent + explicitIndent
457
+
458
+ while (end < this.lines.length) {
459
+ const line = this.lines[end]
460
+ if (line.raw.trim().length !== 0 && line.indent <= parentIndent) break
461
+ if (line.raw.trim().length !== 0) contentIndent = Math.min(contentIndent, line.indent)
462
+ end++
463
+ }
464
+ if (contentIndent === Number.POSITIVE_INFINITY) contentIndent = parentIndent + 1
465
+
466
+ const content: Array<string> = []
467
+ for (let index = start; index < end; index++) {
468
+ const line = this.lines[index]
469
+ if (line.raw.trim().length === 0) {
470
+ content.push("")
471
+ } else if (line.indent < contentIndent) {
472
+ this.fail(line, `Expected block scalar indentation of ${contentIndent} spaces`)
473
+ } else {
474
+ content.push(line.raw.slice(contentIndent))
475
+ }
476
+ }
477
+ this.index = end
478
+
479
+ let output = ""
480
+ if (style === "|") {
481
+ output = content.join("\n")
482
+ } else {
483
+ for (let index = 0; index < content.length; index++) {
484
+ output += content[index]
485
+ if (index < content.length - 1) {
486
+ output += content[index].length === 0 || content[index + 1].length === 0 ? "\n" : " "
487
+ }
488
+ }
489
+ }
490
+ if (chomp === "keep") return `${output}\n`
491
+ output = output.replace(/\n+$/, "")
492
+ return chomp === "strip" ? output : `${output}\n`
493
+ }
494
+
495
+ private skipIgnored(): void {
496
+ while (this.index < this.lines.length) {
497
+ const line = this.lines[this.index]
498
+ if (line.text.length === 0 || line.text.startsWith("%") || line.text === "---") {
499
+ this.index++
500
+ } else if (line.text === "...") {
501
+ this.index++
502
+ while (this.index < this.lines.length && this.lines[this.index].text.length === 0) this.index++
503
+ if (this.index < this.lines.length) {
504
+ this.fail(this.lines[this.index], "Multiple YAML documents are not supported")
505
+ }
506
+ } else {
507
+ return
508
+ }
509
+ }
510
+ }
511
+
512
+ private fail(line: Line, message: string): never {
513
+ throw new SyntaxError(`${message} at line ${line.number}`)
514
+ }
515
+ }
516
+
517
+ /**
518
+ * Parses one YAML document into JavaScript values.
519
+ *
520
+ * The core YAML 1.2 scalar schema is used, so booleans, nulls, and numbers are
521
+ * decoded while date-like values remain strings.
522
+ *
523
+ * @category decoding
524
+ * @since 4.0.0
525
+ */
526
+ export const parse = (input: string): unknown => {
527
+ const source = input.replace(/^\uFEFF/, "").replace(/\r\n?/g, "\n")
528
+ const lines = source.split("\n").map((raw, index): Line => {
529
+ const indentation = /^( *)/.exec(raw)![1].length
530
+ if (raw.slice(0, indentation + 1).includes("\t")) {
531
+ throw new SyntaxError(`Tabs cannot be used for YAML indentation at line ${index + 1}`)
532
+ }
533
+ return {
534
+ raw,
535
+ text: stripComment(raw.slice(indentation)),
536
+ indent: indentation,
537
+ number: index + 1
538
+ }
539
+ })
540
+ return new YamlParser(lines).parse()
541
+ }
@@ -4,6 +4,11 @@
4
4
 
5
5
  // @barrel: Auto-generated exports. Do not edit manually.
6
6
 
7
+ /**
8
+ * @since 4.0.0
9
+ */
10
+ export * as Ini from "./Ini.ts"
11
+
7
12
  /**
8
13
  * @since 4.0.0
9
14
  */
@@ -18,3 +23,13 @@ export * as Ndjson from "./Ndjson.ts"
18
23
  * @since 4.0.0
19
24
  */
20
25
  export * as Sse from "./Sse.ts"
26
+
27
+ /**
28
+ * @since 4.0.0
29
+ */
30
+ export * as Toml from "./Toml.ts"
31
+
32
+ /**
33
+ * @since 4.0.0
34
+ */
35
+ export * as Yaml from "./Yaml.ts"
@@ -86,7 +86,7 @@ export class EventJournal extends Context.Service<EventJournal, {
86
86
  ) => Effect.Effect<A, EventJournalError | E, R>
87
87
 
88
88
  /**
89
- * Retrieve the last known sequence number for a remote source.
89
+ * Retrieve the first unused sequence number for a remote source.
90
90
  */
91
91
  readonly nextRemoteSequence: (remoteId: RemoteId) => Effect.Effect<number, EventJournalError>
92
92
 
@@ -417,8 +417,8 @@ export const makeMemory: Effect.Effect<EventJournal["Service"]> = Effect.gen(fun
417
417
  for (const remoteEntry of options.entries) {
418
418
  if (byId.has(remoteEntry.entry.idString)) {
419
419
  duplicateEntries.push(remoteEntry.entry)
420
- if (remoteEntry.remoteSequence > remote.sequence) {
421
- remote.sequence = remoteEntry.remoteSequence
420
+ if (remoteEntry.remoteSequence >= remote.sequence) {
421
+ remote.sequence = remoteEntry.remoteSequence + 1
422
422
  }
423
423
  continue
424
424
  }
@@ -438,7 +438,7 @@ export const makeMemory: Effect.Effect<EventJournal["Service"]> = Effect.gen(fun
438
438
  if (entry !== undefined && entry.createdAtMillis > entryMillis) {
439
439
  continue
440
440
  }
441
- for (let j = i + 2; j < journal.length; j++) {
441
+ for (let j = i + 1; j < journal.length; j++) {
442
442
  const scannedEntry = journal[j]!
443
443
  if (scannedEntry.event === originEntry.event && scannedEntry.primaryKey === originEntry.primaryKey) {
444
444
  conflicts.push(scannedEntry)
@@ -451,11 +451,19 @@ export const makeMemory: Effect.Effect<EventJournal["Service"]> = Effect.gen(fun
451
451
  for (const remoteEntry of uncommittedRemotes) {
452
452
  journal.push(remoteEntry.entry)
453
453
  byId.set(remoteEntry.entry.idString, remoteEntry.entry)
454
- if (remoteEntry.remoteSequence > remote.sequence) {
455
- remote.sequence = remoteEntry.remoteSequence
454
+ remotes.forEach((target) => {
455
+ if (target !== remote) {
456
+ target.missing.push(remoteEntry.entry)
457
+ }
458
+ })
459
+ if (remoteEntry.remoteSequence >= remote.sequence) {
460
+ remote.sequence = remoteEntry.remoteSequence + 1
456
461
  }
457
462
  }
458
463
  journal.sort((a, b) => a.createdAtMillis - b.createdAtMillis)
464
+ remotes.forEach((remote) => {
465
+ remote.missing.sort((a, b) => a.createdAtMillis - b.createdAtMillis)
466
+ })
459
467
  return {
460
468
  duplicateEntries
461
469
  }
@@ -63,7 +63,7 @@ export const StoreId = Schema.String.pipe(Schema.brand(StoreIdTypeId))
63
63
  * @category protocols
64
64
  * @since 4.0.0
65
65
  */
66
- export class EventLogProtocolError extends Schema.TaggedErrorClass<EventLogProtocolError>(
66
+ export class EventLogProtocolError extends Schema.TaggedError<EventLogProtocolError>(
67
67
  "effect/eventlog/EventLogRemote/ProtocolError"
68
68
  )("EventLogProtocolError", {
69
69
  requestTag: Schema.String,
@@ -411,7 +411,7 @@ const toConflicts = (
411
411
  const newHistory = history.slice(i)
412
412
  let conflicts: Array<Entry> = []
413
413
  for (let j = 0; j < newHistory.length; j++) {
414
- const scannedEntry = history[j]!
414
+ const scannedEntry = newHistory[j]!
415
415
  if (scannedEntry.event === originEntry.event && scannedEntry.primaryKey === originEntry.primaryKey) {
416
416
  conflicts.push(scannedEntry)
417
417
  }
@@ -220,10 +220,12 @@ export const make = (options?: {
220
220
  primaryKey,
221
221
  payload
222
222
  }, { disableChecks: true })
223
- yield* insertEntry(toEntryRow(entry))
224
- const value = yield* effect(entry)
225
- yield* PubSub.publish(pubsub, entry)
226
- return value
223
+ return yield* Effect.uninterruptibleMask((restore) =>
224
+ restore(effect(entry)).pipe(
225
+ Effect.tap(insertEntry(toEntryRow(entry))),
226
+ Effect.tap(PubSub.publish(pubsub, entry))
227
+ )
228
+ )
227
229
  },
228
230
  withTracerDisabled,
229
231
  Effect.mapError((cause) => new EventJournal.EventJournalError({ cause, method: "write" }))