effect 4.0.0-beta.42 → 4.0.0-beta.44

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 (851) hide show
  1. package/dist/Cache.d.ts +12 -43
  2. package/dist/Cache.d.ts.map +1 -1
  3. package/dist/Cache.js +15 -42
  4. package/dist/Cache.js.map +1 -1
  5. package/dist/Cause.d.ts +21 -21
  6. package/dist/Cause.d.ts.map +1 -1
  7. package/dist/Cause.js +89 -10
  8. package/dist/Cause.js.map +1 -1
  9. package/dist/Channel.d.ts +42 -19
  10. package/dist/Channel.d.ts.map +1 -1
  11. package/dist/Channel.js +86 -46
  12. package/dist/Channel.js.map +1 -1
  13. package/dist/Clock.d.ts +2 -2
  14. package/dist/Clock.d.ts.map +1 -1
  15. package/dist/Clock.js.map +1 -1
  16. package/dist/Config.d.ts +2 -2
  17. package/dist/ConfigProvider.d.ts +5 -5
  18. package/dist/ConfigProvider.d.ts.map +1 -1
  19. package/dist/ConfigProvider.js +5 -5
  20. package/dist/ConfigProvider.js.map +1 -1
  21. package/dist/Console.d.ts +2 -2
  22. package/dist/Console.d.ts.map +1 -1
  23. package/dist/Console.js.map +1 -1
  24. package/dist/Context.d.ts +1150 -0
  25. package/dist/Context.d.ts.map +1 -0
  26. package/dist/{ServiceMap.js → Context.js} +139 -139
  27. package/dist/Context.js.map +1 -0
  28. package/dist/DateTime.d.ts +2 -2
  29. package/dist/DateTime.d.ts.map +1 -1
  30. package/dist/DateTime.js +2 -2
  31. package/dist/DateTime.js.map +1 -1
  32. package/dist/Effect.d.ts +177 -177
  33. package/dist/Effect.d.ts.map +1 -1
  34. package/dist/Effect.js +81 -81
  35. package/dist/Effect.js.map +1 -1
  36. package/dist/ErrorReporter.d.ts +3 -3
  37. package/dist/ErrorReporter.d.ts.map +1 -1
  38. package/dist/ErrorReporter.js +1 -1
  39. package/dist/ErrorReporter.js.map +1 -1
  40. package/dist/ExecutionPlan.d.ts +6 -6
  41. package/dist/ExecutionPlan.d.ts.map +1 -1
  42. package/dist/ExecutionPlan.js +4 -4
  43. package/dist/ExecutionPlan.js.map +1 -1
  44. package/dist/Fiber.d.ts +7 -7
  45. package/dist/Fiber.d.ts.map +1 -1
  46. package/dist/Fiber.js.map +1 -1
  47. package/dist/FiberHandle.d.ts +2 -2
  48. package/dist/FiberHandle.d.ts.map +1 -1
  49. package/dist/FiberHandle.js +4 -4
  50. package/dist/FiberHandle.js.map +1 -1
  51. package/dist/FiberMap.d.ts +2 -2
  52. package/dist/FiberMap.d.ts.map +1 -1
  53. package/dist/FiberMap.js +4 -4
  54. package/dist/FiberMap.js.map +1 -1
  55. package/dist/FiberSet.d.ts +2 -2
  56. package/dist/FiberSet.d.ts.map +1 -1
  57. package/dist/FiberSet.js +4 -4
  58. package/dist/FiberSet.js.map +1 -1
  59. package/dist/FileSystem.d.ts +3 -3
  60. package/dist/FileSystem.d.ts.map +1 -1
  61. package/dist/FileSystem.js +3 -3
  62. package/dist/FileSystem.js.map +1 -1
  63. package/dist/Layer.d.ts +309 -266
  64. package/dist/Layer.d.ts.map +1 -1
  65. package/dist/Layer.js +156 -132
  66. package/dist/Layer.js.map +1 -1
  67. package/dist/LayerMap.d.ts +18 -18
  68. package/dist/LayerMap.d.ts.map +1 -1
  69. package/dist/LayerMap.js +18 -15
  70. package/dist/LayerMap.js.map +1 -1
  71. package/dist/Logger.d.ts +3 -3
  72. package/dist/Logger.d.ts.map +1 -1
  73. package/dist/Logger.js.map +1 -1
  74. package/dist/ManagedRuntime.d.ts +6 -6
  75. package/dist/ManagedRuntime.d.ts.map +1 -1
  76. package/dist/ManagedRuntime.js +18 -21
  77. package/dist/ManagedRuntime.js.map +1 -1
  78. package/dist/Metric.d.ts +19 -19
  79. package/dist/Metric.d.ts.map +1 -1
  80. package/dist/Metric.js +21 -21
  81. package/dist/Metric.js.map +1 -1
  82. package/dist/Path.d.ts +2 -2
  83. package/dist/Path.d.ts.map +1 -1
  84. package/dist/Path.js +2 -2
  85. package/dist/Path.js.map +1 -1
  86. package/dist/Pool.d.ts.map +1 -1
  87. package/dist/Pool.js +4 -4
  88. package/dist/Pool.js.map +1 -1
  89. package/dist/PubSub.d.ts.map +1 -1
  90. package/dist/PubSub.js +3 -3
  91. package/dist/PubSub.js.map +1 -1
  92. package/dist/Random.d.ts +2 -2
  93. package/dist/Random.d.ts.map +1 -1
  94. package/dist/Random.js +0 -23
  95. package/dist/Random.js.map +1 -1
  96. package/dist/RcMap.d.ts +2 -2
  97. package/dist/RcMap.d.ts.map +1 -1
  98. package/dist/RcMap.js +12 -12
  99. package/dist/RcMap.js.map +1 -1
  100. package/dist/Redactable.d.ts +139 -62
  101. package/dist/Redactable.d.ts.map +1 -1
  102. package/dist/Redactable.js +59 -55
  103. package/dist/Redactable.js.map +1 -1
  104. package/dist/References.d.ts +26 -14
  105. package/dist/References.d.ts.map +1 -1
  106. package/dist/References.js +0 -12
  107. package/dist/References.js.map +1 -1
  108. package/dist/Request.d.ts +5 -5
  109. package/dist/Request.d.ts.map +1 -1
  110. package/dist/Request.js.map +1 -1
  111. package/dist/RequestResolver.d.ts.map +1 -1
  112. package/dist/RequestResolver.js +6 -7
  113. package/dist/RequestResolver.js.map +1 -1
  114. package/dist/Resource.d.ts +0 -3
  115. package/dist/Resource.d.ts.map +1 -1
  116. package/dist/Resource.js +3 -3
  117. package/dist/Resource.js.map +1 -1
  118. package/dist/Schedule.d.ts +2 -2
  119. package/dist/Schedule.d.ts.map +1 -1
  120. package/dist/Schedule.js +2 -2
  121. package/dist/Schedule.js.map +1 -1
  122. package/dist/Scheduler.d.ts +4 -4
  123. package/dist/Scheduler.d.ts.map +1 -1
  124. package/dist/Scheduler.js +7 -4
  125. package/dist/Scheduler.js.map +1 -1
  126. package/dist/Schema.d.ts +531 -214
  127. package/dist/Schema.d.ts.map +1 -1
  128. package/dist/Schema.js +304 -103
  129. package/dist/Schema.js.map +1 -1
  130. package/dist/SchemaAST.d.ts.map +1 -1
  131. package/dist/SchemaAST.js +5 -15
  132. package/dist/SchemaAST.js.map +1 -1
  133. package/dist/SchemaGetter.d.ts +49 -5
  134. package/dist/SchemaGetter.d.ts.map +1 -1
  135. package/dist/SchemaGetter.js +64 -5
  136. package/dist/SchemaGetter.js.map +1 -1
  137. package/dist/SchemaTransformation.d.ts +145 -0
  138. package/dist/SchemaTransformation.d.ts.map +1 -1
  139. package/dist/SchemaTransformation.js +146 -0
  140. package/dist/SchemaTransformation.js.map +1 -1
  141. package/dist/Scope.d.ts +2 -2
  142. package/dist/Scope.d.ts.map +1 -1
  143. package/dist/Scope.js.map +1 -1
  144. package/dist/ScopedCache.d.ts.map +1 -1
  145. package/dist/ScopedCache.js +4 -4
  146. package/dist/ScopedCache.js.map +1 -1
  147. package/dist/Sink.d.ts +6 -6
  148. package/dist/Sink.d.ts.map +1 -1
  149. package/dist/Sink.js +1 -1
  150. package/dist/Sink.js.map +1 -1
  151. package/dist/Stdio.d.ts +2 -2
  152. package/dist/Stdio.d.ts.map +1 -1
  153. package/dist/Stdio.js +2 -2
  154. package/dist/Stdio.js.map +1 -1
  155. package/dist/Stream.d.ts +187 -117
  156. package/dist/Stream.d.ts.map +1 -1
  157. package/dist/Stream.js +133 -57
  158. package/dist/Stream.js.map +1 -1
  159. package/dist/Terminal.d.ts +3 -3
  160. package/dist/Terminal.d.ts.map +1 -1
  161. package/dist/Terminal.js +2 -2
  162. package/dist/Terminal.js.map +1 -1
  163. package/dist/Tracer.d.ts +16 -16
  164. package/dist/Tracer.d.ts.map +1 -1
  165. package/dist/Tracer.js +11 -8
  166. package/dist/Tracer.js.map +1 -1
  167. package/dist/Unify.d.ts +8 -2
  168. package/dist/Unify.d.ts.map +1 -1
  169. package/dist/Unify.js.map +1 -1
  170. package/dist/index.d.ts +81 -15
  171. package/dist/index.d.ts.map +1 -1
  172. package/dist/index.js +81 -15
  173. package/dist/index.js.map +1 -1
  174. package/dist/internal/core.js.map +1 -1
  175. package/dist/internal/effect.js +74 -74
  176. package/dist/internal/effect.js.map +1 -1
  177. package/dist/internal/layer.js +3 -3
  178. package/dist/internal/layer.js.map +1 -1
  179. package/dist/internal/random.js +2 -2
  180. package/dist/internal/random.js.map +1 -1
  181. package/dist/internal/rcRef.js +9 -9
  182. package/dist/internal/rcRef.js.map +1 -1
  183. package/dist/internal/references.js +13 -13
  184. package/dist/internal/references.js.map +1 -1
  185. package/dist/internal/request.js +6 -6
  186. package/dist/internal/request.js.map +1 -1
  187. package/dist/internal/schedule.js +1 -1
  188. package/dist/internal/schedule.js.map +1 -1
  189. package/dist/internal/schema/representation.js +11 -1
  190. package/dist/internal/schema/representation.js.map +1 -1
  191. package/dist/internal/schema/schema.d.ts +10 -1
  192. package/dist/internal/schema/schema.d.ts.map +1 -1
  193. package/dist/internal/schema/schema.js +21 -1
  194. package/dist/internal/schema/schema.js.map +1 -1
  195. package/dist/testing/TestSchema.d.ts +3 -3
  196. package/dist/testing/TestSchema.d.ts.map +1 -1
  197. package/dist/testing/TestSchema.js.map +1 -1
  198. package/dist/unstable/ai/AiError.d.ts +19 -19
  199. package/dist/unstable/ai/AiError.d.ts.map +1 -1
  200. package/dist/unstable/ai/AiError.js +2 -1
  201. package/dist/unstable/ai/AiError.js.map +1 -1
  202. package/dist/unstable/ai/AnthropicStructuredOutput.d.ts +1 -1
  203. package/dist/unstable/ai/AnthropicStructuredOutput.d.ts.map +1 -1
  204. package/dist/unstable/ai/AnthropicStructuredOutput.js +5 -2
  205. package/dist/unstable/ai/AnthropicStructuredOutput.js.map +1 -1
  206. package/dist/unstable/ai/Chat.d.ts +4 -4
  207. package/dist/unstable/ai/Chat.d.ts.map +1 -1
  208. package/dist/unstable/ai/Chat.js +3 -3
  209. package/dist/unstable/ai/Chat.js.map +1 -1
  210. package/dist/unstable/ai/EmbeddingModel.d.ts +6 -6
  211. package/dist/unstable/ai/EmbeddingModel.d.ts.map +1 -1
  212. package/dist/unstable/ai/EmbeddingModel.js +3 -3
  213. package/dist/unstable/ai/EmbeddingModel.js.map +1 -1
  214. package/dist/unstable/ai/IdGenerator.d.ts +2 -2
  215. package/dist/unstable/ai/IdGenerator.d.ts.map +1 -1
  216. package/dist/unstable/ai/IdGenerator.js +2 -2
  217. package/dist/unstable/ai/IdGenerator.js.map +1 -1
  218. package/dist/unstable/ai/LanguageModel.d.ts +2 -2
  219. package/dist/unstable/ai/LanguageModel.d.ts.map +1 -1
  220. package/dist/unstable/ai/LanguageModel.js +2 -2
  221. package/dist/unstable/ai/LanguageModel.js.map +1 -1
  222. package/dist/unstable/ai/McpSchema.d.ts +54 -54
  223. package/dist/unstable/ai/McpSchema.d.ts.map +1 -1
  224. package/dist/unstable/ai/McpSchema.js +15 -8
  225. package/dist/unstable/ai/McpSchema.js.map +1 -1
  226. package/dist/unstable/ai/McpServer.d.ts +22 -22
  227. package/dist/unstable/ai/McpServer.d.ts.map +1 -1
  228. package/dist/unstable/ai/McpServer.js +25 -25
  229. package/dist/unstable/ai/McpServer.js.map +1 -1
  230. package/dist/unstable/ai/Model.d.ts +3 -3
  231. package/dist/unstable/ai/Model.d.ts.map +1 -1
  232. package/dist/unstable/ai/Model.js +5 -5
  233. package/dist/unstable/ai/Model.js.map +1 -1
  234. package/dist/unstable/ai/OpenAiStructuredOutput.d.ts +1 -1
  235. package/dist/unstable/ai/OpenAiStructuredOutput.d.ts.map +1 -1
  236. package/dist/unstable/ai/OpenAiStructuredOutput.js +2 -1
  237. package/dist/unstable/ai/OpenAiStructuredOutput.js.map +1 -1
  238. package/dist/unstable/ai/Prompt.d.ts.map +1 -1
  239. package/dist/unstable/ai/Prompt.js +6 -9
  240. package/dist/unstable/ai/Prompt.js.map +1 -1
  241. package/dist/unstable/ai/Response.d.ts +1 -1
  242. package/dist/unstable/ai/Response.d.ts.map +1 -1
  243. package/dist/unstable/ai/Response.js +6 -7
  244. package/dist/unstable/ai/Response.js.map +1 -1
  245. package/dist/unstable/ai/ResponseIdTracker.d.ts +2 -2
  246. package/dist/unstable/ai/ResponseIdTracker.d.ts.map +1 -1
  247. package/dist/unstable/ai/ResponseIdTracker.js +2 -2
  248. package/dist/unstable/ai/ResponseIdTracker.js.map +1 -1
  249. package/dist/unstable/ai/Telemetry.d.ts +35 -2
  250. package/dist/unstable/ai/Telemetry.d.ts.map +1 -1
  251. package/dist/unstable/ai/Telemetry.js +2 -2
  252. package/dist/unstable/ai/Telemetry.js.map +1 -1
  253. package/dist/unstable/ai/Tokenizer.d.ts +2 -2
  254. package/dist/unstable/ai/Tokenizer.d.ts.map +1 -1
  255. package/dist/unstable/ai/Tokenizer.js +2 -2
  256. package/dist/unstable/ai/Tokenizer.js.map +1 -1
  257. package/dist/unstable/ai/Tool.d.ts +16 -16
  258. package/dist/unstable/ai/Tool.d.ts.map +1 -1
  259. package/dist/unstable/ai/Tool.js +41 -13
  260. package/dist/unstable/ai/Tool.js.map +1 -1
  261. package/dist/unstable/ai/Toolkit.d.ts +3 -3
  262. package/dist/unstable/ai/Toolkit.d.ts.map +1 -1
  263. package/dist/unstable/ai/Toolkit.js +10 -10
  264. package/dist/unstable/ai/Toolkit.js.map +1 -1
  265. package/dist/unstable/ai/internal/codec-transformer.js +5 -2
  266. package/dist/unstable/ai/internal/codec-transformer.js.map +1 -1
  267. package/dist/unstable/cli/Argument.d.ts +2 -3
  268. package/dist/unstable/cli/Argument.d.ts.map +1 -1
  269. package/dist/unstable/cli/Argument.js.map +1 -1
  270. package/dist/unstable/cli/CliError.d.ts +29 -8
  271. package/dist/unstable/cli/CliError.d.ts.map +1 -1
  272. package/dist/unstable/cli/CliError.js +8 -1
  273. package/dist/unstable/cli/CliError.js.map +1 -1
  274. package/dist/unstable/cli/CliOutput.d.ts +2 -2
  275. package/dist/unstable/cli/CliOutput.d.ts.map +1 -1
  276. package/dist/unstable/cli/CliOutput.js +2 -2
  277. package/dist/unstable/cli/CliOutput.js.map +1 -1
  278. package/dist/unstable/cli/Command.d.ts +14 -14
  279. package/dist/unstable/cli/Command.d.ts.map +1 -1
  280. package/dist/unstable/cli/Command.js +11 -10
  281. package/dist/unstable/cli/Command.js.map +1 -1
  282. package/dist/unstable/cli/Flag.d.ts +2 -3
  283. package/dist/unstable/cli/Flag.d.ts.map +1 -1
  284. package/dist/unstable/cli/Flag.js.map +1 -1
  285. package/dist/unstable/cli/GlobalFlag.d.ts +2 -2
  286. package/dist/unstable/cli/GlobalFlag.d.ts.map +1 -1
  287. package/dist/unstable/cli/GlobalFlag.js +2 -2
  288. package/dist/unstable/cli/GlobalFlag.js.map +1 -1
  289. package/dist/unstable/cli/HelpDoc.d.ts +8 -8
  290. package/dist/unstable/cli/HelpDoc.d.ts.map +1 -1
  291. package/dist/unstable/cli/Param.d.ts +30 -2
  292. package/dist/unstable/cli/Param.d.ts.map +1 -1
  293. package/dist/unstable/cli/Param.js +17 -7
  294. package/dist/unstable/cli/Param.js.map +1 -1
  295. package/dist/unstable/cli/Prompt.js +8 -2
  296. package/dist/unstable/cli/Prompt.js.map +1 -1
  297. package/dist/unstable/cli/internal/command.d.ts +5 -5
  298. package/dist/unstable/cli/internal/command.d.ts.map +1 -1
  299. package/dist/unstable/cli/internal/command.js +3 -3
  300. package/dist/unstable/cli/internal/command.js.map +1 -1
  301. package/dist/unstable/cli/internal/parser.js +94 -15
  302. package/dist/unstable/cli/internal/parser.js.map +1 -1
  303. package/dist/unstable/cluster/ClusterError.d.ts +7 -7
  304. package/dist/unstable/cluster/ClusterSchema.d.ts +12 -9
  305. package/dist/unstable/cluster/ClusterSchema.d.ts.map +1 -1
  306. package/dist/unstable/cluster/ClusterSchema.js +9 -9
  307. package/dist/unstable/cluster/ClusterSchema.js.map +1 -1
  308. package/dist/unstable/cluster/ClusterWorkflowEngine.d.ts +1 -0
  309. package/dist/unstable/cluster/ClusterWorkflowEngine.d.ts.map +1 -1
  310. package/dist/unstable/cluster/ClusterWorkflowEngine.js +68 -40
  311. package/dist/unstable/cluster/ClusterWorkflowEngine.js.map +1 -1
  312. package/dist/unstable/cluster/Entity.d.ts +10 -10
  313. package/dist/unstable/cluster/Entity.d.ts.map +1 -1
  314. package/dist/unstable/cluster/Entity.js +25 -20
  315. package/dist/unstable/cluster/Entity.js.map +1 -1
  316. package/dist/unstable/cluster/EntityAddress.d.ts +2 -2
  317. package/dist/unstable/cluster/EntityProxy.js +3 -3
  318. package/dist/unstable/cluster/EntityProxy.js.map +1 -1
  319. package/dist/unstable/cluster/EntityProxyServer.d.ts.map +1 -1
  320. package/dist/unstable/cluster/EntityProxyServer.js +4 -4
  321. package/dist/unstable/cluster/EntityProxyServer.js.map +1 -1
  322. package/dist/unstable/cluster/EntityResource.d.ts +2 -2
  323. package/dist/unstable/cluster/EntityResource.d.ts.map +1 -1
  324. package/dist/unstable/cluster/EntityResource.js +2 -2
  325. package/dist/unstable/cluster/EntityResource.js.map +1 -1
  326. package/dist/unstable/cluster/Envelope.d.ts +3 -3
  327. package/dist/unstable/cluster/HttpRunner.js +2 -2
  328. package/dist/unstable/cluster/HttpRunner.js.map +1 -1
  329. package/dist/unstable/cluster/K8sHttpClient.d.ts +4 -4
  330. package/dist/unstable/cluster/K8sHttpClient.d.ts.map +1 -1
  331. package/dist/unstable/cluster/K8sHttpClient.js +2 -2
  332. package/dist/unstable/cluster/K8sHttpClient.js.map +1 -1
  333. package/dist/unstable/cluster/Message.d.ts +7 -4
  334. package/dist/unstable/cluster/Message.d.ts.map +1 -1
  335. package/dist/unstable/cluster/Message.js +5 -5
  336. package/dist/unstable/cluster/Message.js.map +1 -1
  337. package/dist/unstable/cluster/MessageStorage.d.ts +14 -14
  338. package/dist/unstable/cluster/MessageStorage.d.ts.map +1 -1
  339. package/dist/unstable/cluster/MessageStorage.js +8 -8
  340. package/dist/unstable/cluster/MessageStorage.js.map +1 -1
  341. package/dist/unstable/cluster/Reply.d.ts +2 -2
  342. package/dist/unstable/cluster/Reply.d.ts.map +1 -1
  343. package/dist/unstable/cluster/Reply.js +5 -5
  344. package/dist/unstable/cluster/Reply.js.map +1 -1
  345. package/dist/unstable/cluster/Runner.d.ts +1 -1
  346. package/dist/unstable/cluster/RunnerAddress.d.ts +1 -1
  347. package/dist/unstable/cluster/RunnerHealth.d.ts +2 -2
  348. package/dist/unstable/cluster/RunnerHealth.d.ts.map +1 -1
  349. package/dist/unstable/cluster/RunnerHealth.js +2 -2
  350. package/dist/unstable/cluster/RunnerHealth.js.map +1 -1
  351. package/dist/unstable/cluster/RunnerServer.js +1 -1
  352. package/dist/unstable/cluster/RunnerServer.js.map +1 -1
  353. package/dist/unstable/cluster/RunnerStorage.d.ts +12 -12
  354. package/dist/unstable/cluster/RunnerStorage.d.ts.map +1 -1
  355. package/dist/unstable/cluster/RunnerStorage.js +3 -3
  356. package/dist/unstable/cluster/RunnerStorage.js.map +1 -1
  357. package/dist/unstable/cluster/Runners.d.ts +3 -3
  358. package/dist/unstable/cluster/Runners.d.ts.map +1 -1
  359. package/dist/unstable/cluster/Runners.js +7 -7
  360. package/dist/unstable/cluster/Runners.js.map +1 -1
  361. package/dist/unstable/cluster/ShardId.d.ts +35 -49
  362. package/dist/unstable/cluster/ShardId.d.ts.map +1 -1
  363. package/dist/unstable/cluster/ShardId.js +65 -67
  364. package/dist/unstable/cluster/ShardId.js.map +1 -1
  365. package/dist/unstable/cluster/Sharding.d.ts +2 -2
  366. package/dist/unstable/cluster/Sharding.d.ts.map +1 -1
  367. package/dist/unstable/cluster/Sharding.js +21 -21
  368. package/dist/unstable/cluster/Sharding.js.map +1 -1
  369. package/dist/unstable/cluster/ShardingConfig.d.ts +2 -2
  370. package/dist/unstable/cluster/ShardingConfig.d.ts.map +1 -1
  371. package/dist/unstable/cluster/ShardingConfig.js +5 -5
  372. package/dist/unstable/cluster/ShardingConfig.js.map +1 -1
  373. package/dist/unstable/cluster/SingletonAddress.d.ts +2 -2
  374. package/dist/unstable/cluster/Snowflake.d.ts +2 -2
  375. package/dist/unstable/cluster/Snowflake.d.ts.map +1 -1
  376. package/dist/unstable/cluster/Snowflake.js +2 -2
  377. package/dist/unstable/cluster/Snowflake.js.map +1 -1
  378. package/dist/unstable/cluster/SqlMessageStorage.js +1 -1
  379. package/dist/unstable/cluster/SqlMessageStorage.js.map +1 -1
  380. package/dist/unstable/cluster/internal/entityManager.js +15 -14
  381. package/dist/unstable/cluster/internal/entityManager.js.map +1 -1
  382. package/dist/unstable/cluster/internal/entityReaper.js +2 -2
  383. package/dist/unstable/cluster/internal/entityReaper.js.map +1 -1
  384. package/dist/unstable/cluster/internal/resourceMap.js +3 -3
  385. package/dist/unstable/cluster/internal/resourceMap.js.map +1 -1
  386. package/dist/unstable/devtools/DevToolsClient.d.ts +2 -2
  387. package/dist/unstable/devtools/DevToolsClient.d.ts.map +1 -1
  388. package/dist/unstable/devtools/DevToolsClient.js +5 -5
  389. package/dist/unstable/devtools/DevToolsClient.js.map +1 -1
  390. package/dist/unstable/eventlog/EventJournal.d.ts +4 -4
  391. package/dist/unstable/eventlog/EventJournal.d.ts.map +1 -1
  392. package/dist/unstable/eventlog/EventJournal.js +2 -2
  393. package/dist/unstable/eventlog/EventJournal.js.map +1 -1
  394. package/dist/unstable/eventlog/EventLog.d.ts +5 -5
  395. package/dist/unstable/eventlog/EventLog.d.ts.map +1 -1
  396. package/dist/unstable/eventlog/EventLog.js +18 -18
  397. package/dist/unstable/eventlog/EventLog.js.map +1 -1
  398. package/dist/unstable/eventlog/EventLogEncryption.d.ts +2 -2
  399. package/dist/unstable/eventlog/EventLogEncryption.d.ts.map +1 -1
  400. package/dist/unstable/eventlog/EventLogEncryption.js +2 -2
  401. package/dist/unstable/eventlog/EventLogEncryption.js.map +1 -1
  402. package/dist/unstable/eventlog/EventLogRemote.d.ts +15 -12
  403. package/dist/unstable/eventlog/EventLogRemote.d.ts.map +1 -1
  404. package/dist/unstable/eventlog/EventLogRemote.js +2 -2
  405. package/dist/unstable/eventlog/EventLogRemote.js.map +1 -1
  406. package/dist/unstable/eventlog/EventLogServer.d.ts +3 -3
  407. package/dist/unstable/eventlog/EventLogServer.d.ts.map +1 -1
  408. package/dist/unstable/eventlog/EventLogServer.js +2 -2
  409. package/dist/unstable/eventlog/EventLogServer.js.map +1 -1
  410. package/dist/unstable/http/Etag.d.ts +2 -2
  411. package/dist/unstable/http/Etag.d.ts.map +1 -1
  412. package/dist/unstable/http/Etag.js +2 -2
  413. package/dist/unstable/http/Etag.js.map +1 -1
  414. package/dist/unstable/http/FetchHttpClient.d.ts +6 -3
  415. package/dist/unstable/http/FetchHttpClient.d.ts.map +1 -1
  416. package/dist/unstable/http/FetchHttpClient.js +5 -5
  417. package/dist/unstable/http/FetchHttpClient.js.map +1 -1
  418. package/dist/unstable/http/Headers.d.ts +5 -2
  419. package/dist/unstable/http/Headers.d.ts.map +1 -1
  420. package/dist/unstable/http/Headers.js +3 -3
  421. package/dist/unstable/http/Headers.js.map +1 -1
  422. package/dist/unstable/http/HttpClient.d.ts +8 -6
  423. package/dist/unstable/http/HttpClient.d.ts.map +1 -1
  424. package/dist/unstable/http/HttpClient.js +6 -6
  425. package/dist/unstable/http/HttpClient.js.map +1 -1
  426. package/dist/unstable/http/HttpClientError.d.ts +1 -1
  427. package/dist/unstable/http/HttpClientRequest.d.ts +2 -2
  428. package/dist/unstable/http/HttpClientRequest.d.ts.map +1 -1
  429. package/dist/unstable/http/HttpClientRequest.js +4 -4
  430. package/dist/unstable/http/HttpClientRequest.js.map +1 -1
  431. package/dist/unstable/http/HttpEffect.d.ts +6 -6
  432. package/dist/unstable/http/HttpEffect.d.ts.map +1 -1
  433. package/dist/unstable/http/HttpEffect.js +24 -24
  434. package/dist/unstable/http/HttpEffect.js.map +1 -1
  435. package/dist/unstable/http/HttpIncomingMessage.d.ts +2 -2
  436. package/dist/unstable/http/HttpIncomingMessage.d.ts.map +1 -1
  437. package/dist/unstable/http/HttpIncomingMessage.js +2 -2
  438. package/dist/unstable/http/HttpIncomingMessage.js.map +1 -1
  439. package/dist/unstable/http/HttpMiddleware.d.ts +3 -3
  440. package/dist/unstable/http/HttpMiddleware.d.ts.map +1 -1
  441. package/dist/unstable/http/HttpMiddleware.js +26 -14
  442. package/dist/unstable/http/HttpMiddleware.js.map +1 -1
  443. package/dist/unstable/http/HttpPlatform.d.ts +2 -2
  444. package/dist/unstable/http/HttpPlatform.d.ts.map +1 -1
  445. package/dist/unstable/http/HttpPlatform.js +2 -2
  446. package/dist/unstable/http/HttpPlatform.js.map +1 -1
  447. package/dist/unstable/http/HttpRouter.d.ts +7 -7
  448. package/dist/unstable/http/HttpRouter.d.ts.map +1 -1
  449. package/dist/unstable/http/HttpRouter.js +29 -29
  450. package/dist/unstable/http/HttpRouter.js.map +1 -1
  451. package/dist/unstable/http/HttpServer.d.ts +2 -2
  452. package/dist/unstable/http/HttpServer.d.ts.map +1 -1
  453. package/dist/unstable/http/HttpServer.js +2 -2
  454. package/dist/unstable/http/HttpServer.js.map +1 -1
  455. package/dist/unstable/http/HttpServerError.d.ts +3 -3
  456. package/dist/unstable/http/HttpServerError.d.ts.map +1 -1
  457. package/dist/unstable/http/HttpServerError.js +3 -3
  458. package/dist/unstable/http/HttpServerError.js.map +1 -1
  459. package/dist/unstable/http/HttpServerRequest.d.ts +4 -4
  460. package/dist/unstable/http/HttpServerRequest.d.ts.map +1 -1
  461. package/dist/unstable/http/HttpServerRequest.js +6 -6
  462. package/dist/unstable/http/HttpServerRequest.js.map +1 -1
  463. package/dist/unstable/http/HttpServerResponse.d.ts +2 -2
  464. package/dist/unstable/http/HttpServerResponse.d.ts.map +1 -1
  465. package/dist/unstable/http/HttpServerResponse.js +6 -6
  466. package/dist/unstable/http/HttpServerResponse.js.map +1 -1
  467. package/dist/unstable/http/Multipart.d.ts +6 -6
  468. package/dist/unstable/http/Multipart.d.ts.map +1 -1
  469. package/dist/unstable/http/Multipart.js +7 -7
  470. package/dist/unstable/http/Multipart.js.map +1 -1
  471. package/dist/unstable/httpapi/HttpApi.d.ts +9 -9
  472. package/dist/unstable/httpapi/HttpApi.d.ts.map +1 -1
  473. package/dist/unstable/httpapi/HttpApi.js +8 -8
  474. package/dist/unstable/httpapi/HttpApi.js.map +1 -1
  475. package/dist/unstable/httpapi/HttpApiBuilder.d.ts +0 -3
  476. package/dist/unstable/httpapi/HttpApiBuilder.d.ts.map +1 -1
  477. package/dist/unstable/httpapi/HttpApiBuilder.js +20 -20
  478. package/dist/unstable/httpapi/HttpApiBuilder.js.map +1 -1
  479. package/dist/unstable/httpapi/HttpApiClient.d.ts.map +1 -1
  480. package/dist/unstable/httpapi/HttpApiClient.js +1 -1
  481. package/dist/unstable/httpapi/HttpApiClient.js.map +1 -1
  482. package/dist/unstable/httpapi/HttpApiEndpoint.d.ts +7 -7
  483. package/dist/unstable/httpapi/HttpApiEndpoint.d.ts.map +1 -1
  484. package/dist/unstable/httpapi/HttpApiEndpoint.js +4 -4
  485. package/dist/unstable/httpapi/HttpApiEndpoint.js.map +1 -1
  486. package/dist/unstable/httpapi/HttpApiError.d.ts +13 -13
  487. package/dist/unstable/httpapi/HttpApiError.d.ts.map +1 -1
  488. package/dist/unstable/httpapi/HttpApiGroup.d.ts +8 -8
  489. package/dist/unstable/httpapi/HttpApiGroup.d.ts.map +1 -1
  490. package/dist/unstable/httpapi/HttpApiGroup.js +4 -4
  491. package/dist/unstable/httpapi/HttpApiGroup.js.map +1 -1
  492. package/dist/unstable/httpapi/HttpApiMiddleware.d.ts +6 -6
  493. package/dist/unstable/httpapi/HttpApiMiddleware.d.ts.map +1 -1
  494. package/dist/unstable/httpapi/HttpApiMiddleware.js +5 -5
  495. package/dist/unstable/httpapi/HttpApiMiddleware.js.map +1 -1
  496. package/dist/unstable/httpapi/HttpApiSecurity.d.ts +9 -6
  497. package/dist/unstable/httpapi/HttpApiSecurity.d.ts.map +1 -1
  498. package/dist/unstable/httpapi/HttpApiSecurity.js +6 -6
  499. package/dist/unstable/httpapi/HttpApiSecurity.js.map +1 -1
  500. package/dist/unstable/httpapi/OpenApi.d.ts +15 -15
  501. package/dist/unstable/httpapi/OpenApi.d.ts.map +1 -1
  502. package/dist/unstable/httpapi/OpenApi.js +23 -23
  503. package/dist/unstable/httpapi/OpenApi.js.map +1 -1
  504. package/dist/unstable/observability/OtlpExporter.d.ts.map +1 -1
  505. package/dist/unstable/observability/OtlpExporter.js +5 -5
  506. package/dist/unstable/observability/OtlpExporter.js.map +1 -1
  507. package/dist/unstable/observability/OtlpMetrics.js +1 -1
  508. package/dist/unstable/observability/OtlpMetrics.js.map +1 -1
  509. package/dist/unstable/observability/OtlpSerialization.d.ts +2 -2
  510. package/dist/unstable/observability/OtlpSerialization.d.ts.map +1 -1
  511. package/dist/unstable/observability/OtlpSerialization.js +2 -2
  512. package/dist/unstable/observability/OtlpSerialization.js.map +1 -1
  513. package/dist/unstable/observability/OtlpTracer.d.ts.map +1 -1
  514. package/dist/unstable/observability/OtlpTracer.js.map +1 -1
  515. package/dist/unstable/observability/PrometheusMetrics.d.ts +3 -3
  516. package/dist/unstable/observability/PrometheusMetrics.d.ts.map +1 -1
  517. package/dist/unstable/observability/PrometheusMetrics.js +4 -33
  518. package/dist/unstable/observability/PrometheusMetrics.js.map +1 -1
  519. package/dist/unstable/persistence/KeyValueStore.d.ts +23 -2
  520. package/dist/unstable/persistence/KeyValueStore.d.ts.map +1 -1
  521. package/dist/unstable/persistence/KeyValueStore.js +144 -2
  522. package/dist/unstable/persistence/KeyValueStore.js.map +1 -1
  523. package/dist/unstable/persistence/PersistedCache.d.ts +1 -2
  524. package/dist/unstable/persistence/PersistedCache.d.ts.map +1 -1
  525. package/dist/unstable/persistence/PersistedCache.js +10 -11
  526. package/dist/unstable/persistence/PersistedCache.js.map +1 -1
  527. package/dist/unstable/persistence/PersistedQueue.d.ts +4 -4
  528. package/dist/unstable/persistence/PersistedQueue.d.ts.map +1 -1
  529. package/dist/unstable/persistence/PersistedQueue.js +3 -3
  530. package/dist/unstable/persistence/PersistedQueue.js.map +1 -1
  531. package/dist/unstable/persistence/Persistence.d.ts +4 -4
  532. package/dist/unstable/persistence/Persistence.d.ts.map +1 -1
  533. package/dist/unstable/persistence/Persistence.js +3 -3
  534. package/dist/unstable/persistence/Persistence.js.map +1 -1
  535. package/dist/unstable/persistence/RateLimiter.d.ts +6 -6
  536. package/dist/unstable/persistence/RateLimiter.d.ts.map +1 -1
  537. package/dist/unstable/persistence/RateLimiter.js +3 -3
  538. package/dist/unstable/persistence/RateLimiter.js.map +1 -1
  539. package/dist/unstable/persistence/Redis.d.ts +3 -3
  540. package/dist/unstable/persistence/Redis.d.ts.map +1 -1
  541. package/dist/unstable/persistence/Redis.js +2 -2
  542. package/dist/unstable/persistence/Redis.js.map +1 -1
  543. package/dist/unstable/process/ChildProcessSpawner.d.ts +45 -2
  544. package/dist/unstable/process/ChildProcessSpawner.d.ts.map +1 -1
  545. package/dist/unstable/process/ChildProcessSpawner.js +2 -2
  546. package/dist/unstable/process/ChildProcessSpawner.js.map +1 -1
  547. package/dist/unstable/reactivity/Atom.d.ts +36 -36
  548. package/dist/unstable/reactivity/Atom.d.ts.map +1 -1
  549. package/dist/unstable/reactivity/Atom.js +9 -9
  550. package/dist/unstable/reactivity/Atom.js.map +1 -1
  551. package/dist/unstable/reactivity/AtomHttpApi.d.ts +3 -3
  552. package/dist/unstable/reactivity/AtomHttpApi.d.ts.map +1 -1
  553. package/dist/unstable/reactivity/AtomHttpApi.js +2 -2
  554. package/dist/unstable/reactivity/AtomHttpApi.js.map +1 -1
  555. package/dist/unstable/reactivity/AtomRegistry.d.ts +2 -2
  556. package/dist/unstable/reactivity/AtomRegistry.d.ts.map +1 -1
  557. package/dist/unstable/reactivity/AtomRegistry.js +3 -3
  558. package/dist/unstable/reactivity/AtomRegistry.js.map +1 -1
  559. package/dist/unstable/reactivity/AtomRpc.d.ts +3 -3
  560. package/dist/unstable/reactivity/AtomRpc.d.ts.map +1 -1
  561. package/dist/unstable/reactivity/AtomRpc.js +2 -2
  562. package/dist/unstable/reactivity/AtomRpc.js.map +1 -1
  563. package/dist/unstable/reactivity/Reactivity.d.ts +2 -2
  564. package/dist/unstable/reactivity/Reactivity.d.ts.map +1 -1
  565. package/dist/unstable/reactivity/Reactivity.js +6 -6
  566. package/dist/unstable/reactivity/Reactivity.js.map +1 -1
  567. package/dist/unstable/rpc/Rpc.d.ts +11 -11
  568. package/dist/unstable/rpc/Rpc.d.ts.map +1 -1
  569. package/dist/unstable/rpc/Rpc.js +4 -4
  570. package/dist/unstable/rpc/Rpc.js.map +1 -1
  571. package/dist/unstable/rpc/RpcClient.d.ts +18 -8
  572. package/dist/unstable/rpc/RpcClient.d.ts.map +1 -1
  573. package/dist/unstable/rpc/RpcClient.js +27 -18
  574. package/dist/unstable/rpc/RpcClient.js.map +1 -1
  575. package/dist/unstable/rpc/RpcClientError.d.ts +2 -2
  576. package/dist/unstable/rpc/RpcGroup.d.ts +7 -7
  577. package/dist/unstable/rpc/RpcGroup.d.ts.map +1 -1
  578. package/dist/unstable/rpc/RpcGroup.js +20 -20
  579. package/dist/unstable/rpc/RpcGroup.js.map +1 -1
  580. package/dist/unstable/rpc/RpcMiddleware.d.ts +6 -6
  581. package/dist/unstable/rpc/RpcMiddleware.d.ts.map +1 -1
  582. package/dist/unstable/rpc/RpcMiddleware.js +5 -5
  583. package/dist/unstable/rpc/RpcMiddleware.js.map +1 -1
  584. package/dist/unstable/rpc/RpcSchema.d.ts +3 -3
  585. package/dist/unstable/rpc/RpcSchema.d.ts.map +1 -1
  586. package/dist/unstable/rpc/RpcSchema.js +3 -3
  587. package/dist/unstable/rpc/RpcSchema.js.map +1 -1
  588. package/dist/unstable/rpc/RpcSerialization.d.ts +2 -2
  589. package/dist/unstable/rpc/RpcSerialization.d.ts.map +1 -1
  590. package/dist/unstable/rpc/RpcSerialization.js +7 -7
  591. package/dist/unstable/rpc/RpcSerialization.js.map +1 -1
  592. package/dist/unstable/rpc/RpcServer.d.ts +2 -2
  593. package/dist/unstable/rpc/RpcServer.d.ts.map +1 -1
  594. package/dist/unstable/rpc/RpcServer.js +18 -18
  595. package/dist/unstable/rpc/RpcServer.js.map +1 -1
  596. package/dist/unstable/rpc/RpcWorker.d.ts +2 -2
  597. package/dist/unstable/rpc/RpcWorker.d.ts.map +1 -1
  598. package/dist/unstable/rpc/RpcWorker.js +4 -4
  599. package/dist/unstable/rpc/RpcWorker.js.map +1 -1
  600. package/dist/unstable/rpc/Utils.d.ts +0 -3
  601. package/dist/unstable/rpc/Utils.d.ts.map +1 -1
  602. package/dist/unstable/rpc/Utils.js +2 -5
  603. package/dist/unstable/rpc/Utils.js.map +1 -1
  604. package/dist/unstable/socket/Socket.d.ts +10 -10
  605. package/dist/unstable/socket/Socket.d.ts.map +1 -1
  606. package/dist/unstable/socket/Socket.js +9 -9
  607. package/dist/unstable/socket/Socket.js.map +1 -1
  608. package/dist/unstable/socket/SocketServer.d.ts +5 -2
  609. package/dist/unstable/socket/SocketServer.d.ts.map +1 -1
  610. package/dist/unstable/socket/SocketServer.js +2 -2
  611. package/dist/unstable/socket/SocketServer.js.map +1 -1
  612. package/dist/unstable/sql/SqlClient.d.ts +5 -5
  613. package/dist/unstable/sql/SqlClient.d.ts.map +1 -1
  614. package/dist/unstable/sql/SqlClient.js +7 -7
  615. package/dist/unstable/sql/SqlClient.js.map +1 -1
  616. package/dist/unstable/sql/SqlConnection.d.ts +2 -2
  617. package/dist/unstable/sql/SqlConnection.d.ts.map +1 -1
  618. package/dist/unstable/sql/SqlConnection.js +5 -2
  619. package/dist/unstable/sql/SqlConnection.js.map +1 -1
  620. package/dist/unstable/sql/SqlError.d.ts +12 -12
  621. package/dist/unstable/sql/SqlModel.d.ts +8 -9
  622. package/dist/unstable/sql/SqlModel.d.ts.map +1 -1
  623. package/dist/unstable/sql/SqlModel.js +9 -35
  624. package/dist/unstable/sql/SqlModel.js.map +1 -1
  625. package/dist/unstable/sql/SqlResolver.js +11 -11
  626. package/dist/unstable/sql/SqlResolver.js.map +1 -1
  627. package/dist/unstable/sql/Statement.d.ts +2 -2
  628. package/dist/unstable/sql/Statement.d.ts.map +1 -1
  629. package/dist/unstable/sql/Statement.js +2 -2
  630. package/dist/unstable/sql/Statement.js.map +1 -1
  631. package/dist/unstable/workers/Transferable.d.ts +2 -2
  632. package/dist/unstable/workers/Transferable.d.ts.map +1 -1
  633. package/dist/unstable/workers/Transferable.js +6 -6
  634. package/dist/unstable/workers/Transferable.js.map +1 -1
  635. package/dist/unstable/workers/Worker.d.ts +3 -3
  636. package/dist/unstable/workers/Worker.d.ts.map +1 -1
  637. package/dist/unstable/workers/Worker.js +6 -3
  638. package/dist/unstable/workers/Worker.js.map +1 -1
  639. package/dist/unstable/workers/WorkerError.d.ts +5 -5
  640. package/dist/unstable/workers/WorkerRunner.d.ts +2 -2
  641. package/dist/unstable/workers/WorkerRunner.d.ts.map +1 -1
  642. package/dist/unstable/workers/WorkerRunner.js +5 -2
  643. package/dist/unstable/workers/WorkerRunner.js.map +1 -1
  644. package/dist/unstable/workflow/Activity.d.ts +7 -7
  645. package/dist/unstable/workflow/Activity.d.ts.map +1 -1
  646. package/dist/unstable/workflow/Activity.js +7 -7
  647. package/dist/unstable/workflow/Activity.js.map +1 -1
  648. package/dist/unstable/workflow/DurableClock.d.ts +0 -3
  649. package/dist/unstable/workflow/DurableClock.d.ts.map +1 -1
  650. package/dist/unstable/workflow/DurableClock.js +3 -3
  651. package/dist/unstable/workflow/DurableClock.js.map +1 -1
  652. package/dist/unstable/workflow/DurableDeferred.d.ts +1 -1
  653. package/dist/unstable/workflow/DurableDeferred.d.ts.map +1 -1
  654. package/dist/unstable/workflow/DurableDeferred.js +7 -7
  655. package/dist/unstable/workflow/DurableDeferred.js.map +1 -1
  656. package/dist/unstable/workflow/Workflow.d.ts +9 -9
  657. package/dist/unstable/workflow/Workflow.d.ts.map +1 -1
  658. package/dist/unstable/workflow/Workflow.js +18 -18
  659. package/dist/unstable/workflow/Workflow.js.map +1 -1
  660. package/dist/unstable/workflow/WorkflowEngine.d.ts +9 -3
  661. package/dist/unstable/workflow/WorkflowEngine.d.ts.map +1 -1
  662. package/dist/unstable/workflow/WorkflowEngine.js +14 -5
  663. package/dist/unstable/workflow/WorkflowEngine.js.map +1 -1
  664. package/dist/unstable/workflow/WorkflowProxyServer.d.ts.map +1 -1
  665. package/dist/unstable/workflow/WorkflowProxyServer.js +4 -4
  666. package/dist/unstable/workflow/WorkflowProxyServer.js.map +1 -1
  667. package/package.json +1 -1
  668. package/src/Cache.ts +18 -46
  669. package/src/Cause.ts +21 -21
  670. package/src/Channel.ts +120 -79
  671. package/src/Clock.ts +2 -2
  672. package/src/Config.ts +2 -2
  673. package/src/ConfigProvider.ts +5 -5
  674. package/src/Console.ts +2 -2
  675. package/src/{ServiceMap.ts → Context.ts} +337 -340
  676. package/src/DateTime.ts +2 -2
  677. package/src/Effect.ts +182 -184
  678. package/src/ErrorReporter.ts +3 -3
  679. package/src/ExecutionPlan.ts +8 -9
  680. package/src/Fiber.ts +7 -7
  681. package/src/FiberHandle.ts +5 -5
  682. package/src/FiberMap.ts +5 -5
  683. package/src/FiberSet.ts +5 -5
  684. package/src/FileSystem.ts +3 -3
  685. package/src/Layer.ts +358 -305
  686. package/src/LayerMap.ts +27 -26
  687. package/src/Logger.ts +3 -3
  688. package/src/ManagedRuntime.ts +32 -32
  689. package/src/Metric.ts +58 -58
  690. package/src/Path.ts +2 -2
  691. package/src/Pool.ts +5 -5
  692. package/src/PubSub.ts +3 -3
  693. package/src/Random.ts +2 -2
  694. package/src/RcMap.ts +14 -14
  695. package/src/Redactable.ts +146 -72
  696. package/src/References.ts +14 -14
  697. package/src/Request.ts +5 -5
  698. package/src/RequestResolver.ts +6 -7
  699. package/src/Resource.ts +4 -4
  700. package/src/Schedule.ts +2 -2
  701. package/src/Scheduler.ts +4 -4
  702. package/src/Schema.ts +837 -397
  703. package/src/SchemaAST.ts +5 -14
  704. package/src/SchemaGetter.ts +69 -11
  705. package/src/SchemaTransformation.ts +166 -0
  706. package/src/Scope.ts +2 -2
  707. package/src/ScopedCache.ts +5 -5
  708. package/src/Sink.ts +9 -9
  709. package/src/Stdio.ts +2 -2
  710. package/src/Stream.ts +234 -158
  711. package/src/Terminal.ts +3 -3
  712. package/src/Tracer.ts +17 -17
  713. package/src/Unify.ts +26 -2
  714. package/src/index.ts +82 -16
  715. package/src/internal/core.ts +7 -7
  716. package/src/internal/effect.ts +106 -106
  717. package/src/internal/layer.ts +7 -7
  718. package/src/internal/random.ts +2 -2
  719. package/src/internal/rcRef.ts +10 -10
  720. package/src/internal/references.ts +13 -13
  721. package/src/internal/request.ts +8 -8
  722. package/src/internal/schedule.ts +3 -1
  723. package/src/internal/schema/representation.ts +8 -1
  724. package/src/internal/schema/schema.ts +24 -1
  725. package/src/testing/TestSchema.ts +3 -3
  726. package/src/unstable/ai/AiError.ts +3 -2
  727. package/src/unstable/ai/AnthropicStructuredOutput.ts +3 -3
  728. package/src/unstable/ai/Chat.ts +3 -3
  729. package/src/unstable/ai/EmbeddingModel.ts +3 -3
  730. package/src/unstable/ai/IdGenerator.ts +2 -2
  731. package/src/unstable/ai/LanguageModel.ts +2 -2
  732. package/src/unstable/ai/McpSchema.ts +11 -9
  733. package/src/unstable/ai/McpServer.ts +44 -44
  734. package/src/unstable/ai/Model.ts +8 -8
  735. package/src/unstable/ai/OpenAiStructuredOutput.ts +2 -2
  736. package/src/unstable/ai/Prompt.ts +6 -12
  737. package/src/unstable/ai/Response.ts +6 -8
  738. package/src/unstable/ai/ResponseIdTracker.ts +2 -4
  739. package/src/unstable/ai/Telemetry.ts +2 -2
  740. package/src/unstable/ai/Tokenizer.ts +2 -2
  741. package/src/unstable/ai/Tool.ts +25 -25
  742. package/src/unstable/ai/Toolkit.ts +12 -12
  743. package/src/unstable/ai/internal/codec-transformer.ts +3 -2
  744. package/src/unstable/cli/Argument.ts +3 -4
  745. package/src/unstable/cli/CliError.ts +22 -9
  746. package/src/unstable/cli/CliOutput.ts +2 -2
  747. package/src/unstable/cli/Command.ts +36 -30
  748. package/src/unstable/cli/Flag.ts +3 -4
  749. package/src/unstable/cli/GlobalFlag.ts +3 -3
  750. package/src/unstable/cli/HelpDoc.ts +8 -8
  751. package/src/unstable/cli/Param.ts +39 -16
  752. package/src/unstable/cli/Prompt.ts +13 -6
  753. package/src/unstable/cli/internal/command.ts +7 -7
  754. package/src/unstable/cli/internal/parser.ts +130 -21
  755. package/src/unstable/cluster/ClusterSchema.ts +12 -12
  756. package/src/unstable/cluster/ClusterWorkflowEngine.ts +91 -53
  757. package/src/unstable/cluster/Entity.ts +43 -32
  758. package/src/unstable/cluster/EntityProxy.ts +3 -3
  759. package/src/unstable/cluster/EntityProxyServer.ts +4 -4
  760. package/src/unstable/cluster/EntityResource.ts +2 -2
  761. package/src/unstable/cluster/HttpRunner.ts +2 -2
  762. package/src/unstable/cluster/K8sHttpClient.ts +2 -2
  763. package/src/unstable/cluster/Message.ts +8 -8
  764. package/src/unstable/cluster/MessageStorage.ts +11 -11
  765. package/src/unstable/cluster/Reply.ts +7 -7
  766. package/src/unstable/cluster/RunnerHealth.ts +2 -2
  767. package/src/unstable/cluster/RunnerServer.ts +1 -1
  768. package/src/unstable/cluster/RunnerStorage.ts +9 -9
  769. package/src/unstable/cluster/Runners.ts +7 -7
  770. package/src/unstable/cluster/ShardId.ts +84 -74
  771. package/src/unstable/cluster/Sharding.ts +26 -26
  772. package/src/unstable/cluster/ShardingConfig.ts +5 -5
  773. package/src/unstable/cluster/Snowflake.ts +2 -2
  774. package/src/unstable/cluster/SqlMessageStorage.ts +1 -1
  775. package/src/unstable/cluster/internal/entityManager.ts +27 -23
  776. package/src/unstable/cluster/internal/entityReaper.ts +2 -2
  777. package/src/unstable/cluster/internal/resourceMap.ts +3 -3
  778. package/src/unstable/devtools/DevToolsClient.ts +5 -5
  779. package/src/unstable/eventlog/EventJournal.ts +2 -2
  780. package/src/unstable/eventlog/EventLog.ts +21 -21
  781. package/src/unstable/eventlog/EventLogEncryption.ts +2 -2
  782. package/src/unstable/eventlog/EventLogRemote.ts +2 -2
  783. package/src/unstable/eventlog/EventLogServer.ts +2 -2
  784. package/src/unstable/http/Etag.ts +2 -2
  785. package/src/unstable/http/FetchHttpClient.ts +5 -5
  786. package/src/unstable/http/Headers.ts +4 -4
  787. package/src/unstable/http/HttpClient.ts +9 -8
  788. package/src/unstable/http/HttpClientRequest.ts +5 -5
  789. package/src/unstable/http/HttpEffect.ts +35 -35
  790. package/src/unstable/http/HttpIncomingMessage.ts +2 -2
  791. package/src/unstable/http/HttpMiddleware.ts +28 -14
  792. package/src/unstable/http/HttpPlatform.ts +2 -2
  793. package/src/unstable/http/HttpRouter.ts +37 -37
  794. package/src/unstable/http/HttpServer.ts +2 -2
  795. package/src/unstable/http/HttpServerError.ts +4 -4
  796. package/src/unstable/http/HttpServerRequest.ts +7 -7
  797. package/src/unstable/http/HttpServerResponse.ts +8 -8
  798. package/src/unstable/http/Multipart.ts +8 -8
  799. package/src/unstable/httpapi/HttpApi.ts +18 -18
  800. package/src/unstable/httpapi/HttpApiBuilder.ts +20 -20
  801. package/src/unstable/httpapi/HttpApiClient.ts +4 -4
  802. package/src/unstable/httpapi/HttpApiEndpoint.ts +14 -14
  803. package/src/unstable/httpapi/HttpApiGroup.ts +16 -16
  804. package/src/unstable/httpapi/HttpApiMiddleware.ts +14 -14
  805. package/src/unstable/httpapi/HttpApiSecurity.ts +13 -13
  806. package/src/unstable/httpapi/OpenApi.ts +29 -31
  807. package/src/unstable/observability/OtlpExporter.ts +5 -5
  808. package/src/unstable/observability/OtlpMetrics.ts +1 -1
  809. package/src/unstable/observability/OtlpSerialization.ts +2 -2
  810. package/src/unstable/observability/OtlpTracer.ts +2 -2
  811. package/src/unstable/observability/PrometheusMetrics.ts +5 -5
  812. package/src/unstable/persistence/KeyValueStore.ts +226 -3
  813. package/src/unstable/persistence/PersistedCache.ts +20 -17
  814. package/src/unstable/persistence/PersistedQueue.ts +3 -3
  815. package/src/unstable/persistence/Persistence.ts +4 -4
  816. package/src/unstable/persistence/RateLimiter.ts +3 -3
  817. package/src/unstable/persistence/Redis.ts +2 -2
  818. package/src/unstable/process/ChildProcessSpawner.ts +46 -2
  819. package/src/unstable/reactivity/Atom.ts +79 -79
  820. package/src/unstable/reactivity/AtomHttpApi.ts +4 -4
  821. package/src/unstable/reactivity/AtomRegistry.ts +4 -4
  822. package/src/unstable/reactivity/AtomRpc.ts +4 -4
  823. package/src/unstable/reactivity/Reactivity.ts +6 -6
  824. package/src/unstable/rpc/Rpc.ts +17 -17
  825. package/src/unstable/rpc/RpcClient.ts +44 -30
  826. package/src/unstable/rpc/RpcGroup.ts +30 -30
  827. package/src/unstable/rpc/RpcMiddleware.ts +14 -14
  828. package/src/unstable/rpc/RpcSchema.ts +4 -4
  829. package/src/unstable/rpc/RpcSerialization.ts +7 -7
  830. package/src/unstable/rpc/RpcServer.ts +19 -19
  831. package/src/unstable/rpc/RpcWorker.ts +5 -5
  832. package/src/unstable/rpc/Utils.ts +4 -4
  833. package/src/unstable/socket/Socket.ts +9 -9
  834. package/src/unstable/socket/SocketServer.ts +2 -2
  835. package/src/unstable/sql/SqlClient.ts +11 -11
  836. package/src/unstable/sql/SqlConnection.ts +2 -2
  837. package/src/unstable/sql/SqlModel.ts +54 -82
  838. package/src/unstable/sql/SqlResolver.ts +11 -11
  839. package/src/unstable/sql/Statement.ts +2 -2
  840. package/src/unstable/workers/Transferable.ts +6 -6
  841. package/src/unstable/workers/Worker.ts +4 -4
  842. package/src/unstable/workers/WorkerRunner.ts +2 -2
  843. package/src/unstable/workflow/Activity.ts +14 -14
  844. package/src/unstable/workflow/DurableClock.ts +3 -3
  845. package/src/unstable/workflow/DurableDeferred.ts +8 -8
  846. package/src/unstable/workflow/Workflow.ts +23 -23
  847. package/src/unstable/workflow/WorkflowEngine.ts +28 -6
  848. package/src/unstable/workflow/WorkflowProxyServer.ts +4 -4
  849. package/dist/ServiceMap.d.ts +0 -1150
  850. package/dist/ServiceMap.d.ts.map +0 -1
  851. package/dist/ServiceMap.js.map +0 -1
@@ -1,12 +1,12 @@
1
1
  /**
2
- * This module provides a data structure called `ServiceMap` that can be used
2
+ * This module provides a data structure called `Context` that can be used
3
3
  * for dependency injection in effectful programs. It is essentially a table
4
4
  * mapping `Service`s identifiers to their implementations, and can be used to
5
- * manage dependencies in a type-safe way. The `ServiceMap` data structure is
5
+ * manage dependencies in a type-safe way. The `Context` data structure is
6
6
  * essentially a way of providing access to a set of related services that can
7
7
  * be passed around as a single unit. This module provides functions to create,
8
- * modify, and query the contents of a `ServiceMap`, as well as a number of
9
- * utility types for working with a `ServiceMap`.
8
+ * modify, and query the contents of a `Context`, as well as a number of
9
+ * utility types for working with a `Context`.
10
10
  *
11
11
  * @since 4.0.0
12
12
  */
@@ -26,16 +26,16 @@ import type * as Types from "./Types.ts"
26
26
  * @since 4.0.0
27
27
  * @category Type Identifiers
28
28
  */
29
- export type ServiceTypeId = "~effect/ServiceMap/Service"
29
+ export type ServiceTypeId = "~effect/Context/Service"
30
30
 
31
31
  /**
32
32
  * @since 4.0.0
33
33
  * @category Type Identifiers
34
34
  */
35
- export const ServiceTypeId: ServiceTypeId = "~effect/ServiceMap/Service"
35
+ export const ServiceTypeId: ServiceTypeId = "~effect/Context/Service"
36
36
 
37
37
  /**
38
- * The base type used for all ServiceMap keys.
38
+ * The base type used for all Context keys.
39
39
  *
40
40
  * @since 4.0.0
41
41
  * @category Models
@@ -52,15 +52,15 @@ export interface Key<out Identifier, out Shape> extends Pipeable, Inspectable {
52
52
  /**
53
53
  * @example
54
54
  * ```ts
55
- * import { ServiceMap } from "effect"
55
+ * import { Context } from "effect"
56
56
  *
57
57
  * // Define an identifier for a database service
58
- * const Database = ServiceMap.Service<{ query: (sql: string) => string }>(
58
+ * const Database = Context.Service<{ query: (sql: string) => string }>(
59
59
  * "Database"
60
60
  * )
61
61
  *
62
62
  * // The key can be used to store and retrieve services
63
- * const services = ServiceMap.make(Database, { query: (sql) => `Result: ${sql}` })
63
+ * const context = Context.make(Database, { query: (sql) => `Result: ${sql}` })
64
64
  * ```
65
65
  *
66
66
  * @since 4.0.0
@@ -70,7 +70,7 @@ export interface Service<in out Identifier, in out Shape>
70
70
  extends Key<Identifier, Shape>, Yieldable<Service<Identifier, Shape>, Shape, never, Identifier>
71
71
  {
72
72
  of(this: void, self: Shape): Shape
73
- serviceMap(self: Shape): ServiceMap<Identifier>
73
+ context(self: Shape): Context<Identifier>
74
74
  use<A, E, R>(f: (service: Shape) => Effect<A, E, R>): Effect<A, E, R | Identifier>
75
75
  useSync<A>(f: (service: Shape) => A): Effect<A, never, Identifier>
76
76
  }
@@ -105,23 +105,23 @@ export declare namespace ServiceClass {
105
105
  /**
106
106
  * @example
107
107
  * ```ts
108
- * import { ServiceMap } from "effect"
108
+ * import { Context } from "effect"
109
109
  *
110
110
  * // Create a simple service
111
- * const Database = ServiceMap.Service<{
111
+ * const Database = Context.Service<{
112
112
  * query: (sql: string) => string
113
113
  * }>("Database")
114
114
  *
115
115
  * // Create a service class
116
- * class Config extends ServiceMap.Service<Config, {
116
+ * class Config extends Context.Service<Config, {
117
117
  * port: number
118
118
  * }>()("Config") {}
119
119
  *
120
- * // Use the services to create service maps
121
- * const db = ServiceMap.make(Database, {
120
+ * // Use the services to create contexts
121
+ * const db = Context.make(Database, {
122
122
  * query: (sql) => `Result: ${sql}`
123
123
  * })
124
- * const config = ServiceMap.make(Config, { port: 8080 })
124
+ * const config = Context.make(Config, { port: 8080 })
125
125
  * ```
126
126
  *
127
127
  * @since 4.0.0
@@ -131,23 +131,23 @@ export const Service: {
131
131
  /**
132
132
  * @example
133
133
  * ```ts
134
- * import { ServiceMap } from "effect"
134
+ * import { Context } from "effect"
135
135
  *
136
136
  * // Create a simple service
137
- * const Database = ServiceMap.Service<{
137
+ * const Database = Context.Service<{
138
138
  * query: (sql: string) => string
139
139
  * }>("Database")
140
140
  *
141
141
  * // Create a service class
142
- * class Config extends ServiceMap.Service<Config, {
142
+ * class Config extends Context.Service<Config, {
143
143
  * port: number
144
144
  * }>()("Config") {}
145
145
  *
146
- * // Use the services to create service maps
147
- * const db = ServiceMap.make(Database, {
146
+ * // Use the services to create contexts
147
+ * const db = Context.make(Database, {
148
148
  * query: (sql) => `Result: ${sql}`
149
149
  * })
150
- * const config = ServiceMap.make(Config, { port: 8080 })
150
+ * const config = Context.make(Config, { port: 8080 })
151
151
  * ```
152
152
  *
153
153
  * @since 4.0.0
@@ -157,23 +157,23 @@ export const Service: {
157
157
  /**
158
158
  * @example
159
159
  * ```ts
160
- * import { ServiceMap } from "effect"
160
+ * import { Context } from "effect"
161
161
  *
162
162
  * // Create a simple service
163
- * const Database = ServiceMap.Service<{
163
+ * const Database = Context.Service<{
164
164
  * query: (sql: string) => string
165
165
  * }>("Database")
166
166
  *
167
167
  * // Create a service class
168
- * class Config extends ServiceMap.Service<Config, {
168
+ * class Config extends Context.Service<Config, {
169
169
  * port: number
170
170
  * }>()("Config") {}
171
171
  *
172
- * // Use the services to create service maps
173
- * const db = ServiceMap.make(Database, {
172
+ * // Use the services to create contexts
173
+ * const db = Context.make(Database, {
174
174
  * query: (sql) => `Result: ${sql}`
175
175
  * })
176
- * const config = ServiceMap.make(Config, { port: 8080 })
176
+ * const config = Context.make(Config, { port: 8080 })
177
177
  * ```
178
178
  *
179
179
  * @since 4.0.0
@@ -196,23 +196,23 @@ export const Service: {
196
196
  /**
197
197
  * @example
198
198
  * ```ts
199
- * import { ServiceMap } from "effect"
199
+ * import { Context } from "effect"
200
200
  *
201
201
  * // Create a simple service
202
- * const Database = ServiceMap.Service<{
202
+ * const Database = Context.Service<{
203
203
  * query: (sql: string) => string
204
204
  * }>("Database")
205
205
  *
206
206
  * // Create a service class
207
- * class Config extends ServiceMap.Service<Config, {
207
+ * class Config extends Context.Service<Config, {
208
208
  * port: number
209
209
  * }>()("Config") {}
210
210
  *
211
- * // Use the services to create service maps
212
- * const db = ServiceMap.make(Database, {
211
+ * // Use the services to create contexts
212
+ * const db = Context.make(Database, {
213
213
  * query: (sql) => `Result: ${sql}`
214
214
  * })
215
- * const config = ServiceMap.make(Config, { port: 8080 })
215
+ * const config = Context.make(Config, { port: 8080 })
216
216
  * ```
217
217
  *
218
218
  * @since 4.0.0
@@ -280,42 +280,42 @@ const ServiceProto: any = {
280
280
  }
281
281
  },
282
282
  asEffect(this: any) {
283
- const fn = this.asEffect = constant(withFiber((fiber) => exitSucceed(get(fiber.services, this))))
283
+ const fn = this.asEffect = constant(withFiber((fiber) => exitSucceed(get(fiber.context, this))))
284
284
  return fn()
285
285
  },
286
286
  of<Service>(this: void, self: Service): Service {
287
287
  return self
288
288
  },
289
- serviceMap<Identifier, Shape>(
289
+ context<Identifier, Shape>(
290
290
  this: Service<Identifier, Shape>,
291
291
  self: Shape
292
- ): ServiceMap<Identifier> {
292
+ ): Context<Identifier> {
293
293
  return make(this, self)
294
294
  },
295
295
  use<A, E, R>(this: Service<never, any>, f: (service: any) => Effect<A, E, R>): Effect<A, E, R> {
296
- return withFiber((fiber) => f(get(fiber.services, this)))
296
+ return withFiber((fiber) => f(get(fiber.context, this)))
297
297
  },
298
298
  useSync<A>(this: Service<never, any>, f: (service: any) => A): Effect<A, never, never> {
299
- return withFiber((fiber) => exitSucceed(f(get(fiber.services, this))))
299
+ return withFiber((fiber) => exitSucceed(f(get(fiber.context, this))))
300
300
  }
301
301
  }
302
302
 
303
- const ReferenceTypeId = "~effect/ServiceMap/Reference" as const
303
+ const ReferenceTypeId = "~effect/Context/Reference" as const
304
304
 
305
305
  /**
306
306
  * @example
307
307
  * ```ts
308
- * import { ServiceMap } from "effect"
308
+ * import { Context } from "effect"
309
309
  *
310
310
  * // Define a reference with a default value
311
- * const LoggerRef: ServiceMap.Reference<{ log: (msg: string) => void }> =
312
- * ServiceMap.Reference("Logger", {
311
+ * const LoggerRef: Context.Reference<{ log: (msg: string) => void }> =
312
+ * Context.Reference("Logger", {
313
313
  * defaultValue: () => ({ log: (msg: string) => console.log(msg) })
314
314
  * })
315
315
  *
316
316
  * // The reference can be used without explicit provision
317
- * const serviceMap = ServiceMap.empty()
318
- * const logger = ServiceMap.get(serviceMap, LoggerRef) // Uses default value
317
+ * const context = Context.empty()
318
+ * const logger = Context.get(context, LoggerRef) // Uses default value
319
319
  * ```
320
320
  *
321
321
  * @since 4.0.0
@@ -331,17 +331,17 @@ export interface Reference<in out Shape> extends Service<never, Shape> {
331
331
  /**
332
332
  * @example
333
333
  * ```ts
334
- * import { ServiceMap } from "effect"
334
+ * import { Context } from "effect"
335
335
  *
336
- * const Database = ServiceMap.Service<{
336
+ * const Database = Context.Service<{
337
337
  * query: (sql: string) => string
338
338
  * }>("Database")
339
339
  *
340
340
  * // Extract service type from a key
341
- * type DatabaseService = ServiceMap.Service.Shape<typeof Database>
341
+ * type DatabaseService = Context.Service.Shape<typeof Database>
342
342
  *
343
343
  * // Extract identifier type from a key
344
- * type DatabaseId = ServiceMap.Service.Identifier<typeof Database>
344
+ * type DatabaseId = Context.Service.Identifier<typeof Database>
345
345
  * ```
346
346
  *
347
347
  * @since 4.0.0
@@ -351,12 +351,12 @@ export declare namespace Service {
351
351
  /**
352
352
  * @example
353
353
  * ```ts
354
- * import { ServiceMap } from "effect"
354
+ * import { Context } from "effect"
355
355
  *
356
356
  * // Any represents any possible service type
357
- * const services: Array<ServiceMap.Service.Any> = [
358
- * ServiceMap.Service<{ log: (msg: string) => void }>("Logger"),
359
- * ServiceMap.Service<{ query: (sql: string) => string }>("Database")
357
+ * const services: Array<Context.Service.Any> = [
358
+ * Context.Service<{ log: (msg: string) => void }>("Logger"),
359
+ * Context.Service<{ query: (sql: string) => string }>("Database")
360
360
  * ]
361
361
  * ```
362
362
  *
@@ -368,14 +368,14 @@ export declare namespace Service {
368
368
  /**
369
369
  * @example
370
370
  * ```ts
371
- * import { ServiceMap } from "effect"
371
+ * import { Context } from "effect"
372
372
  *
373
- * const Database = ServiceMap.Service<{ query: (sql: string) => string }>(
373
+ * const Database = Context.Service<{ query: (sql: string) => string }>(
374
374
  * "Database"
375
375
  * )
376
376
  *
377
377
  * // Extract the service shape from the service
378
- * type DatabaseService = ServiceMap.Service.Shape<typeof Database>
378
+ * type DatabaseService = Context.Service.Shape<typeof Database>
379
379
  * // DatabaseService is { query: (sql: string) => string }
380
380
  * ```
381
381
  *
@@ -387,14 +387,14 @@ export declare namespace Service {
387
387
  /**
388
388
  * @example
389
389
  * ```ts
390
- * import { ServiceMap } from "effect"
390
+ * import { Context } from "effect"
391
391
  *
392
- * const Database = ServiceMap.Service<{ query: (sql: string) => string }>(
392
+ * const Database = Context.Service<{ query: (sql: string) => string }>(
393
393
  * "Database"
394
394
  * )
395
395
  *
396
396
  * // Extract the identifier type from a key
397
- * type DatabaseId = ServiceMap.Service.Identifier<typeof Database>
397
+ * type DatabaseId = Context.Service.Identifier<typeof Database>
398
398
  * // DatabaseId is the identifier type
399
399
  * ```
400
400
  *
@@ -404,29 +404,29 @@ export declare namespace Service {
404
404
  export type Identifier<T> = T extends Key<infer I, infer _S> ? I : never
405
405
  }
406
406
 
407
- const TypeId = "~effect/ServiceMap" as const
407
+ const TypeId = "~effect/Context" as const
408
408
 
409
409
  /**
410
410
  * @example
411
411
  * ```ts
412
- * import { ServiceMap } from "effect"
412
+ * import { Context } from "effect"
413
413
  *
414
- * // Create a service map with multiple services
415
- * const Logger = ServiceMap.Service<{ log: (msg: string) => void }>("Logger")
416
- * const Database = ServiceMap.Service<{ query: (sql: string) => string }>(
414
+ * // Create a context with multiple services
415
+ * const Logger = Context.Service<{ log: (msg: string) => void }>("Logger")
416
+ * const Database = Context.Service<{ query: (sql: string) => string }>(
417
417
  * "Database"
418
418
  * )
419
419
  *
420
- * const services = ServiceMap.make(Logger, {
420
+ * const context = Context.make(Logger, {
421
421
  * log: (msg: string) => console.log(msg)
422
422
  * })
423
- * .pipe(ServiceMap.add(Database, { query: (sql) => `Result: ${sql}` }))
423
+ * .pipe(Context.add(Database, { query: (sql) => `Result: ${sql}` }))
424
424
  * ```
425
425
  *
426
426
  * @since 4.0.0
427
427
  * @category Models
428
428
  */
429
- export interface ServiceMap<in Services> extends Equal.Equal, Pipeable, Inspectable {
429
+ export interface Context<in Services> extends Equal.Equal, Pipeable, Inspectable {
430
430
  readonly [TypeId]: {
431
431
  readonly _Services: Types.Contravariant<Services>
432
432
  }
@@ -437,40 +437,40 @@ export interface ServiceMap<in Services> extends Equal.Equal, Pipeable, Inspecta
437
437
  /**
438
438
  * @example
439
439
  * ```ts
440
- * import { ServiceMap } from "effect"
440
+ * import { Context } from "effect"
441
441
  *
442
- * // Create a service map from a Map (unsafe)
442
+ * // Create a context from a Map (unsafe)
443
443
  * const map = new Map([
444
444
  * ["Logger", { log: (msg: string) => console.log(msg) }]
445
445
  * ])
446
446
  *
447
- * const services = ServiceMap.makeUnsafe(map)
447
+ * const context = Context.makeUnsafe(map)
448
448
  * ```
449
449
  *
450
450
  * @since 4.0.0
451
451
  * @category Constructors
452
452
  */
453
- export const makeUnsafe = <Services = never>(mapUnsafe: ReadonlyMap<string, any>): ServiceMap<Services> => {
453
+ export const makeUnsafe = <Services = never>(mapUnsafe: ReadonlyMap<string, any>): Context<Services> => {
454
454
  const self = Object.create(Proto)
455
455
  self.mapUnsafe = mapUnsafe
456
456
  self.mutable = false
457
457
  return self
458
458
  }
459
459
 
460
- const Proto: Omit<ServiceMap<never>, "mapUnsafe" | "mutable"> = {
460
+ const Proto: Omit<Context<never>, "mapUnsafe" | "mutable"> = {
461
461
  ...PipeInspectableProto,
462
462
  [TypeId]: {
463
463
  _Services: (_: never) => _
464
464
  },
465
- toJSON(this: ServiceMap<never>) {
465
+ toJSON(this: Context<never>) {
466
466
  return {
467
- _id: "ServiceMap",
467
+ _id: "Context",
468
468
  services: Array.from(this.mapUnsafe).map(([key, value]) => ({ key, value }))
469
469
  }
470
470
  },
471
- [Equal.symbol]<A>(this: ServiceMap<A>, that: unknown): boolean {
471
+ [Equal.symbol]<A>(this: Context<A>, that: unknown): boolean {
472
472
  if (
473
- !isServiceMap(that)
473
+ !isContext(that)
474
474
  || this.mapUnsafe.size !== that.mapUnsafe.size
475
475
  ) return false
476
476
  for (const k of this.mapUnsafe.keys()) {
@@ -483,36 +483,36 @@ const Proto: Omit<ServiceMap<never>, "mapUnsafe" | "mutable"> = {
483
483
  }
484
484
  return true
485
485
  },
486
- [Hash.symbol]<A>(this: ServiceMap<A>): number {
486
+ [Hash.symbol]<A>(this: Context<A>): number {
487
487
  return Hash.number(this.mapUnsafe.size)
488
488
  }
489
489
  }
490
490
 
491
491
  /**
492
- * Checks if the provided argument is a `ServiceMap`.
492
+ * Checks if the provided argument is a `Context`.
493
493
  *
494
494
  * @example
495
495
  * ```ts
496
- * import { ServiceMap } from "effect"
496
+ * import { Context } from "effect"
497
497
  * import * as assert from "node:assert"
498
498
  *
499
- * assert.strictEqual(ServiceMap.isServiceMap(ServiceMap.empty()), true)
499
+ * assert.strictEqual(Context.isContext(Context.empty()), true)
500
500
  * ```
501
501
  *
502
502
  * @since 4.0.0
503
503
  * @category Guards
504
504
  */
505
- export const isServiceMap = (u: unknown): u is ServiceMap<never> => hasProperty(u, TypeId)
505
+ export const isContext = (u: unknown): u is Context<never> => hasProperty(u, TypeId)
506
506
 
507
507
  /**
508
508
  * Checks if the provided argument is a `Key`.
509
509
  *
510
510
  * @example
511
511
  * ```ts
512
- * import { ServiceMap } from "effect"
512
+ * import { Context } from "effect"
513
513
  * import * as assert from "node:assert"
514
514
  *
515
- * assert.strictEqual(ServiceMap.isKey(ServiceMap.Service("Service")), true)
515
+ * assert.strictEqual(Context.isKey(Context.Service("Service")), true)
516
516
  * ```
517
517
  *
518
518
  * @since 4.0.0
@@ -525,15 +525,15 @@ export const isKey = (u: unknown): u is Key<any, any> => hasProperty(u, ServiceT
525
525
  *
526
526
  * @example
527
527
  * ```ts
528
- * import { ServiceMap } from "effect"
528
+ * import { Context } from "effect"
529
529
  * import * as assert from "node:assert"
530
530
  *
531
- * const LoggerRef = ServiceMap.Reference("Logger", {
531
+ * const LoggerRef = Context.Reference("Logger", {
532
532
  * defaultValue: () => ({ log: (msg: string) => console.log(msg) })
533
533
  * })
534
534
  *
535
- * assert.strictEqual(ServiceMap.isReference(LoggerRef), true)
536
- * assert.strictEqual(ServiceMap.isReference(ServiceMap.Service("Key")), false)
535
+ * assert.strictEqual(Context.isReference(LoggerRef), true)
536
+ * assert.strictEqual(Context.isReference(Context.Service("Key")), false)
537
537
  * ```
538
538
  *
539
539
  * @since 4.0.0
@@ -542,35 +542,35 @@ export const isKey = (u: unknown): u is Key<any, any> => hasProperty(u, ServiceT
542
542
  export const isReference = (u: unknown): u is Reference<any> => hasProperty(u, ReferenceTypeId)
543
543
 
544
544
  /**
545
- * Returns an empty `ServiceMap`.
545
+ * Returns an empty `Context`.
546
546
  *
547
547
  * @example
548
548
  * ```ts
549
- * import { ServiceMap } from "effect"
549
+ * import { Context } from "effect"
550
550
  * import * as assert from "node:assert"
551
551
  *
552
- * assert.strictEqual(ServiceMap.isServiceMap(ServiceMap.empty()), true)
552
+ * assert.strictEqual(Context.isContext(Context.empty()), true)
553
553
  * ```
554
554
  *
555
555
  * @since 4.0.0
556
556
  * @category Constructors
557
557
  */
558
- export const empty = (): ServiceMap<never> => emptyServiceMap
559
- const emptyServiceMap = makeUnsafe(new Map())
558
+ export const empty = (): Context<never> => emptyContext
559
+ const emptyContext = makeUnsafe(new Map())
560
560
 
561
561
  /**
562
- * Creates a new `ServiceMap` with a single service associated to the key.
562
+ * Creates a new `Context` with a single service associated to the key.
563
563
  *
564
564
  * @example
565
565
  * ```ts
566
- * import { ServiceMap } from "effect"
566
+ * import { Context } from "effect"
567
567
  * import * as assert from "node:assert"
568
568
  *
569
- * const Port = ServiceMap.Service<{ PORT: number }>("Port")
569
+ * const Port = Context.Service<{ PORT: number }>("Port")
570
570
  *
571
- * const Services = ServiceMap.make(Port, { PORT: 8080 })
571
+ * const context = Context.make(Port, { PORT: 8080 })
572
572
  *
573
- * assert.deepStrictEqual(ServiceMap.get(Services, Port), { PORT: 8080 })
573
+ * assert.deepStrictEqual(Context.get(context, Port), { PORT: 8080 })
574
574
  * ```
575
575
  *
576
576
  * @since 4.0.0
@@ -579,28 +579,28 @@ const emptyServiceMap = makeUnsafe(new Map())
579
579
  export const make = <I, S>(
580
580
  key: Key<I, S>,
581
581
  service: Types.NoInfer<S>
582
- ): ServiceMap<I> => makeUnsafe(new Map([[key.key, service]]))
582
+ ): Context<I> => makeUnsafe(new Map([[key.key, service]]))
583
583
 
584
584
  /**
585
- * Adds a service to a given `ServiceMap`.
585
+ * Adds a service to a given `Context`.
586
586
  *
587
587
  * @example
588
588
  * ```ts
589
- * import { pipe, ServiceMap } from "effect"
589
+ * import { pipe, Context } from "effect"
590
590
  * import * as assert from "node:assert"
591
591
  *
592
- * const Port = ServiceMap.Service<{ PORT: number }>("Port")
593
- * const Timeout = ServiceMap.Service<{ TIMEOUT: number }>("Timeout")
592
+ * const Port = Context.Service<{ PORT: number }>("Port")
593
+ * const Timeout = Context.Service<{ TIMEOUT: number }>("Timeout")
594
594
  *
595
- * const someServiceMap = ServiceMap.make(Port, { PORT: 8080 })
595
+ * const someContext = Context.make(Port, { PORT: 8080 })
596
596
  *
597
- * const Services = pipe(
598
- * someServiceMap,
599
- * ServiceMap.add(Timeout, { TIMEOUT: 5000 })
597
+ * const context = pipe(
598
+ * someContext,
599
+ * Context.add(Timeout, { TIMEOUT: 5000 })
600
600
  * )
601
601
  *
602
- * assert.deepStrictEqual(ServiceMap.get(Services, Port), { PORT: 8080 })
603
- * assert.deepStrictEqual(ServiceMap.get(Services, Timeout), { TIMEOUT: 5000 })
602
+ * assert.deepStrictEqual(Context.get(context, Port), { PORT: 8080 })
603
+ * assert.deepStrictEqual(Context.get(context, Timeout), { TIMEOUT: 5000 })
604
604
  * ```
605
605
  *
606
606
  * @since 4.0.0
@@ -608,62 +608,62 @@ export const make = <I, S>(
608
608
  */
609
609
  export const add: {
610
610
  /**
611
- * Adds a service to a given `ServiceMap`.
611
+ * Adds a service to a given `Context`.
612
612
  *
613
613
  * @example
614
614
  * ```ts
615
- * import { pipe, ServiceMap } from "effect"
615
+ * import { pipe, Context } from "effect"
616
616
  * import * as assert from "node:assert"
617
617
  *
618
- * const Port = ServiceMap.Service<{ PORT: number }>("Port")
619
- * const Timeout = ServiceMap.Service<{ TIMEOUT: number }>("Timeout")
618
+ * const Port = Context.Service<{ PORT: number }>("Port")
619
+ * const Timeout = Context.Service<{ TIMEOUT: number }>("Timeout")
620
620
  *
621
- * const someServiceMap = ServiceMap.make(Port, { PORT: 8080 })
621
+ * const someContext = Context.make(Port, { PORT: 8080 })
622
622
  *
623
- * const Services = pipe(
624
- * someServiceMap,
625
- * ServiceMap.add(Timeout, { TIMEOUT: 5000 })
623
+ * const context = pipe(
624
+ * someContext,
625
+ * Context.add(Timeout, { TIMEOUT: 5000 })
626
626
  * )
627
627
  *
628
- * assert.deepStrictEqual(ServiceMap.get(Services, Port), { PORT: 8080 })
629
- * assert.deepStrictEqual(ServiceMap.get(Services, Timeout), { TIMEOUT: 5000 })
628
+ * assert.deepStrictEqual(Context.get(context, Port), { PORT: 8080 })
629
+ * assert.deepStrictEqual(Context.get(context, Timeout), { TIMEOUT: 5000 })
630
630
  * ```
631
631
  *
632
632
  * @since 4.0.0
633
633
  * @category Adders
634
634
  */
635
- <I, S>(key: Key<I, S>, service: Types.NoInfer<S>): <Services>(self: ServiceMap<Services>) => ServiceMap<Services | I>
635
+ <I, S>(key: Key<I, S>, service: Types.NoInfer<S>): <Services>(self: Context<Services>) => Context<Services | I>
636
636
  /**
637
- * Adds a service to a given `ServiceMap`.
637
+ * Adds a service to a given `Context`.
638
638
  *
639
639
  * @example
640
640
  * ```ts
641
- * import { pipe, ServiceMap } from "effect"
641
+ * import { pipe, Context } from "effect"
642
642
  * import * as assert from "node:assert"
643
643
  *
644
- * const Port = ServiceMap.Service<{ PORT: number }>("Port")
645
- * const Timeout = ServiceMap.Service<{ TIMEOUT: number }>("Timeout")
644
+ * const Port = Context.Service<{ PORT: number }>("Port")
645
+ * const Timeout = Context.Service<{ TIMEOUT: number }>("Timeout")
646
646
  *
647
- * const someServiceMap = ServiceMap.make(Port, { PORT: 8080 })
647
+ * const someContext = Context.make(Port, { PORT: 8080 })
648
648
  *
649
- * const Services = pipe(
650
- * someServiceMap,
651
- * ServiceMap.add(Timeout, { TIMEOUT: 5000 })
649
+ * const context = pipe(
650
+ * someContext,
651
+ * Context.add(Timeout, { TIMEOUT: 5000 })
652
652
  * )
653
653
  *
654
- * assert.deepStrictEqual(ServiceMap.get(Services, Port), { PORT: 8080 })
655
- * assert.deepStrictEqual(ServiceMap.get(Services, Timeout), { TIMEOUT: 5000 })
654
+ * assert.deepStrictEqual(Context.get(context, Port), { PORT: 8080 })
655
+ * assert.deepStrictEqual(Context.get(context, Timeout), { TIMEOUT: 5000 })
656
656
  * ```
657
657
  *
658
658
  * @since 4.0.0
659
659
  * @category Adders
660
660
  */
661
- <Services, I, S>(self: ServiceMap<Services>, key: Key<I, S>, service: Types.NoInfer<S>): ServiceMap<Services | I>
661
+ <Services, I, S>(self: Context<Services>, key: Key<I, S>, service: Types.NoInfer<S>): Context<Services | I>
662
662
  } = dual(3, <Services, I, S>(
663
- self: ServiceMap<Services>,
663
+ self: Context<Services>,
664
664
  key: Key<I, S>,
665
665
  service: Types.NoInfer<S>
666
- ): ServiceMap<Services | I> =>
666
+ ): Context<Services | I> =>
667
667
  withMapUnsafe(self, (map) => {
668
668
  map.set(key.key, service)
669
669
  }))
@@ -677,21 +677,21 @@ export const addOrOmit: {
677
677
  * @since 4.0.0
678
678
  * @category Adders
679
679
  */
680
- <I, S>(key: Key<I, S>, service: Option.Option<Types.NoInfer<S>>): <Services>(self: ServiceMap<Services>) => ServiceMap<Services | I>
680
+ <I, S>(key: Key<I, S>, service: Option.Option<Types.NoInfer<S>>): <Services>(self: Context<Services>) => Context<Services | I>
681
681
  /**
682
682
  * @since 4.0.0
683
683
  * @category Adders
684
684
  */
685
685
  <Services, I, S>(
686
- self: ServiceMap<Services>,
686
+ self: Context<Services>,
687
687
  key: Key<I, S>,
688
688
  service: Option.Option<Types.NoInfer<S>>
689
- ): ServiceMap<Services | I>
689
+ ): Context<Services | I>
690
690
  } = dual(3, <Services, I, S>(
691
- self: ServiceMap<Services>,
691
+ self: Context<Services>,
692
692
  key: Key<I, S>,
693
693
  service: Option.Option<Types.NoInfer<S>>
694
- ): ServiceMap<Services | I> =>
694
+ ): Context<Services | I> =>
695
695
  withMapUnsafe(self, (map) => {
696
696
  if (service._tag === "None") {
697
697
  map.delete(key.key)
@@ -706,21 +706,21 @@ export const addOrOmit: {
706
706
  *
707
707
  * @example
708
708
  * ```ts
709
- * import { ServiceMap } from "effect"
709
+ * import { Context } from "effect"
710
710
  * import * as assert from "node:assert"
711
711
  *
712
- * const Logger = ServiceMap.Service<{ log: (msg: string) => void }>("Logger")
713
- * const Database = ServiceMap.Service<{ query: (sql: string) => string }>(
712
+ * const Logger = Context.Service<{ log: (msg: string) => void }>("Logger")
713
+ * const Database = Context.Service<{ query: (sql: string) => string }>(
714
714
  * "Database"
715
715
  * )
716
716
  *
717
- * const services = ServiceMap.make(Logger, {
717
+ * const context = Context.make(Logger, {
718
718
  * log: (msg: string) => console.log(msg)
719
719
  * })
720
720
  *
721
- * const logger = ServiceMap.getOrElse(services, Logger, () => ({ log: () => {} }))
722
- * const database = ServiceMap.getOrElse(
723
- * services,
721
+ * const logger = Context.getOrElse(context, Logger, () => ({ log: () => {} }))
722
+ * const database = Context.getOrElse(
723
+ * context,
724
724
  * Database,
725
725
  * () => ({ query: () => "fallback" })
726
726
  * )
@@ -739,21 +739,21 @@ export const getOrElse: {
739
739
  *
740
740
  * @example
741
741
  * ```ts
742
- * import { ServiceMap } from "effect"
742
+ * import { Context } from "effect"
743
743
  * import * as assert from "node:assert"
744
744
  *
745
- * const Logger = ServiceMap.Service<{ log: (msg: string) => void }>("Logger")
746
- * const Database = ServiceMap.Service<{ query: (sql: string) => string }>(
745
+ * const Logger = Context.Service<{ log: (msg: string) => void }>("Logger")
746
+ * const Database = Context.Service<{ query: (sql: string) => string }>(
747
747
  * "Database"
748
748
  * )
749
749
  *
750
- * const services = ServiceMap.make(Logger, {
750
+ * const context = Context.make(Logger, {
751
751
  * log: (msg: string) => console.log(msg)
752
752
  * })
753
753
  *
754
- * const logger = ServiceMap.getOrElse(services, Logger, () => ({ log: () => {} }))
755
- * const database = ServiceMap.getOrElse(
756
- * services,
754
+ * const logger = Context.getOrElse(context, Logger, () => ({ log: () => {} }))
755
+ * const database = Context.getOrElse(
756
+ * context,
757
757
  * Database,
758
758
  * () => ({ query: () => "fallback" })
759
759
  * )
@@ -765,28 +765,28 @@ export const getOrElse: {
765
765
  * @since 4.0.0
766
766
  * @category Getters
767
767
  */
768
- <S, I, B>(key: Key<I, S>, orElse: LazyArg<B>): <Services>(self: ServiceMap<Services>) => S | B
768
+ <S, I, B>(key: Key<I, S>, orElse: LazyArg<B>): <Services>(self: Context<Services>) => S | B
769
769
  /**
770
770
  * Get a service from the context that corresponds to the given key, or
771
771
  * use the fallback value.
772
772
  *
773
773
  * @example
774
774
  * ```ts
775
- * import { ServiceMap } from "effect"
775
+ * import { Context } from "effect"
776
776
  * import * as assert from "node:assert"
777
777
  *
778
- * const Logger = ServiceMap.Service<{ log: (msg: string) => void }>("Logger")
779
- * const Database = ServiceMap.Service<{ query: (sql: string) => string }>(
778
+ * const Logger = Context.Service<{ log: (msg: string) => void }>("Logger")
779
+ * const Database = Context.Service<{ query: (sql: string) => string }>(
780
780
  * "Database"
781
781
  * )
782
782
  *
783
- * const services = ServiceMap.make(Logger, {
783
+ * const context = Context.make(Logger, {
784
784
  * log: (msg: string) => console.log(msg)
785
785
  * })
786
786
  *
787
- * const logger = ServiceMap.getOrElse(services, Logger, () => ({ log: () => {} }))
788
- * const database = ServiceMap.getOrElse(
789
- * services,
787
+ * const logger = Context.getOrElse(context, Logger, () => ({ log: () => {} }))
788
+ * const database = Context.getOrElse(
789
+ * context,
790
790
  * Database,
791
791
  * () => ({ query: () => "fallback" })
792
792
  * )
@@ -798,8 +798,8 @@ export const getOrElse: {
798
798
  * @since 4.0.0
799
799
  * @category Getters
800
800
  */
801
- <Services, S, I, B>(self: ServiceMap<Services>, key: Key<I, S>, orElse: LazyArg<B>): S | B
802
- } = dual(3, <Services, S, I, B>(self: ServiceMap<Services>, key: Key<I, S>, orElse: LazyArg<B>): S | B => {
801
+ <Services, S, I, B>(self: Context<Services>, key: Key<I, S>, orElse: LazyArg<B>): S | B
802
+ } = dual(3, <Services, S, I, B>(self: Context<Services>, key: Key<I, S>, orElse: LazyArg<B>): S | B => {
803
803
  if (self.mapUnsafe.has(key.key)) {
804
804
  return self.mapUnsafe.get(key.key)! as any
805
805
  }
@@ -815,15 +815,15 @@ export const getOrUndefined: {
815
815
  * @since 4.0.0
816
816
  * @category Getters
817
817
  */
818
- <S, I>(key: Key<I, S>): <Services>(self: ServiceMap<Services>) => S | undefined
818
+ <S, I>(key: Key<I, S>): <Services>(self: Context<Services>) => S | undefined
819
819
  /**
820
820
  * @since 4.0.0
821
821
  * @category Getters
822
822
  */
823
- <Services, S, I>(self: ServiceMap<Services>, key: Key<I, S>): S | undefined
823
+ <Services, S, I>(self: Context<Services>, key: Key<I, S>): S | undefined
824
824
  } = dual(
825
825
  2,
826
- <Services, S, I>(self: ServiceMap<Services>, key: Key<I, S>): S | undefined => self.mapUnsafe.get(key.key)
826
+ <Services, S, I>(self: Context<Services>, key: Key<I, S>): S | undefined => self.mapUnsafe.get(key.key)
827
827
  )
828
828
 
829
829
  /**
@@ -834,21 +834,21 @@ export const getOrUndefined: {
834
834
  *
835
835
  * For a safer version see {@link getOption}.
836
836
  *
837
- * @param self - The `ServiceMap` to search for the service.
837
+ * @param self - The `Context` to search for the service.
838
838
  * @param service - The `Service` of the service to retrieve.
839
839
  *
840
840
  * @example
841
841
  * ```ts
842
- * import { ServiceMap } from "effect"
842
+ * import { Context } from "effect"
843
843
  * import * as assert from "node:assert"
844
844
  *
845
- * const Port = ServiceMap.Service<{ PORT: number }>("Port")
846
- * const Timeout = ServiceMap.Service<{ TIMEOUT: number }>("Timeout")
845
+ * const Port = Context.Service<{ PORT: number }>("Port")
846
+ * const Timeout = Context.Service<{ TIMEOUT: number }>("Timeout")
847
847
  *
848
- * const Services = ServiceMap.make(Port, { PORT: 8080 })
848
+ * const context = Context.make(Port, { PORT: 8080 })
849
849
  *
850
- * assert.deepStrictEqual(ServiceMap.getUnsafe(Services, Port), { PORT: 8080 })
851
- * assert.throws(() => ServiceMap.getUnsafe(Services, Timeout))
850
+ * assert.deepStrictEqual(Context.getUnsafe(context, Port), { PORT: 8080 })
851
+ * assert.throws(() => Context.getUnsafe(context, Timeout))
852
852
  * ```
853
853
  *
854
854
  * @since 4.0.0
@@ -863,27 +863,27 @@ export const getUnsafe: {
863
863
  *
864
864
  * For a safer version see {@link getOption}.
865
865
  *
866
- * @param self - The `ServiceMap` to search for the service.
866
+ * @param self - The `Context` to search for the service.
867
867
  * @param service - The `Service` of the service to retrieve.
868
868
  *
869
869
  * @example
870
870
  * ```ts
871
- * import { ServiceMap } from "effect"
871
+ * import { Context } from "effect"
872
872
  * import * as assert from "node:assert"
873
873
  *
874
- * const Port = ServiceMap.Service<{ PORT: number }>("Port")
875
- * const Timeout = ServiceMap.Service<{ TIMEOUT: number }>("Timeout")
874
+ * const Port = Context.Service<{ PORT: number }>("Port")
875
+ * const Timeout = Context.Service<{ TIMEOUT: number }>("Timeout")
876
876
  *
877
- * const Services = ServiceMap.make(Port, { PORT: 8080 })
877
+ * const context = Context.make(Port, { PORT: 8080 })
878
878
  *
879
- * assert.deepStrictEqual(ServiceMap.getUnsafe(Services, Port), { PORT: 8080 })
880
- * assert.throws(() => ServiceMap.getUnsafe(Services, Timeout))
879
+ * assert.deepStrictEqual(Context.getUnsafe(context, Port), { PORT: 8080 })
880
+ * assert.throws(() => Context.getUnsafe(context, Timeout))
881
881
  * ```
882
882
  *
883
883
  * @since 4.0.0
884
884
  * @category unsafe
885
885
  */
886
- <S, I>(service: Key<I, S>): <Services>(self: ServiceMap<Services>) => S
886
+ <S, I>(service: Key<I, S>): <Services>(self: Context<Services>) => S
887
887
  /**
888
888
  * Get a service from the context that corresponds to the given key.
889
889
  *
@@ -892,30 +892,30 @@ export const getUnsafe: {
892
892
  *
893
893
  * For a safer version see {@link getOption}.
894
894
  *
895
- * @param self - The `ServiceMap` to search for the service.
895
+ * @param self - The `Context` to search for the service.
896
896
  * @param service - The `Service` of the service to retrieve.
897
897
  *
898
898
  * @example
899
899
  * ```ts
900
- * import { ServiceMap } from "effect"
900
+ * import { Context } from "effect"
901
901
  * import * as assert from "node:assert"
902
902
  *
903
- * const Port = ServiceMap.Service<{ PORT: number }>("Port")
904
- * const Timeout = ServiceMap.Service<{ TIMEOUT: number }>("Timeout")
903
+ * const Port = Context.Service<{ PORT: number }>("Port")
904
+ * const Timeout = Context.Service<{ TIMEOUT: number }>("Timeout")
905
905
  *
906
- * const Services = ServiceMap.make(Port, { PORT: 8080 })
906
+ * const context = Context.make(Port, { PORT: 8080 })
907
907
  *
908
- * assert.deepStrictEqual(ServiceMap.getUnsafe(Services, Port), { PORT: 8080 })
909
- * assert.throws(() => ServiceMap.getUnsafe(Services, Timeout))
908
+ * assert.deepStrictEqual(Context.getUnsafe(context, Port), { PORT: 8080 })
909
+ * assert.throws(() => Context.getUnsafe(context, Timeout))
910
910
  * ```
911
911
  *
912
912
  * @since 4.0.0
913
913
  * @category unsafe
914
914
  */
915
- <Services, S, I>(self: ServiceMap<Services>, services: Key<I, S>): S
915
+ <Services, S, I>(self: Context<Services>, services: Key<I, S>): S
916
916
  } = dual(
917
917
  2,
918
- <Services, I extends Services, S>(self: ServiceMap<Services>, service: Key<I, S>): S => {
918
+ <Services, I extends Services, S>(self: Context<Services>, service: Key<I, S>): S => {
919
919
  if (!self.mapUnsafe.has(service.key)) {
920
920
  if (ReferenceTypeId in service) return getDefaultValue(service as any)
921
921
  throw serviceNotFoundError(service)
@@ -927,23 +927,23 @@ export const getUnsafe: {
927
927
  /**
928
928
  * Get a service from the context that corresponds to the given key.
929
929
  *
930
- * @param self - The `ServiceMap` to search for the service.
930
+ * @param self - The `Context` to search for the service.
931
931
  * @param service - The `Service` of the service to retrieve.
932
932
  *
933
933
  * @example
934
934
  * ```ts
935
- * import { pipe, ServiceMap } from "effect"
935
+ * import { pipe, Context } from "effect"
936
936
  * import * as assert from "node:assert"
937
937
  *
938
- * const Port = ServiceMap.Service<{ PORT: number }>("Port")
939
- * const Timeout = ServiceMap.Service<{ TIMEOUT: number }>("Timeout")
938
+ * const Port = Context.Service<{ PORT: number }>("Port")
939
+ * const Timeout = Context.Service<{ TIMEOUT: number }>("Timeout")
940
940
  *
941
- * const Services = pipe(
942
- * ServiceMap.make(Port, { PORT: 8080 }),
943
- * ServiceMap.add(Timeout, { TIMEOUT: 5000 })
941
+ * const context = pipe(
942
+ * Context.make(Port, { PORT: 8080 }),
943
+ * Context.add(Timeout, { TIMEOUT: 5000 })
944
944
  * )
945
945
  *
946
- * assert.deepStrictEqual(ServiceMap.get(Services, Timeout), { TIMEOUT: 5000 })
946
+ * assert.deepStrictEqual(Context.get(context, Timeout), { TIMEOUT: 5000 })
947
947
  * ```
948
948
  *
949
949
  * @since 4.0.0
@@ -953,69 +953,69 @@ export const get: {
953
953
  /**
954
954
  * Get a service from the context that corresponds to the given key.
955
955
  *
956
- * @param self - The `ServiceMap` to search for the service.
956
+ * @param self - The `Context` to search for the service.
957
957
  * @param service - The `Service` of the service to retrieve.
958
958
  *
959
959
  * @example
960
960
  * ```ts
961
- * import { pipe, ServiceMap } from "effect"
961
+ * import { pipe, Context } from "effect"
962
962
  * import * as assert from "node:assert"
963
963
  *
964
- * const Port = ServiceMap.Service<{ PORT: number }>("Port")
965
- * const Timeout = ServiceMap.Service<{ TIMEOUT: number }>("Timeout")
964
+ * const Port = Context.Service<{ PORT: number }>("Port")
965
+ * const Timeout = Context.Service<{ TIMEOUT: number }>("Timeout")
966
966
  *
967
- * const Services = pipe(
968
- * ServiceMap.make(Port, { PORT: 8080 }),
969
- * ServiceMap.add(Timeout, { TIMEOUT: 5000 })
967
+ * const context = pipe(
968
+ * Context.make(Port, { PORT: 8080 }),
969
+ * Context.add(Timeout, { TIMEOUT: 5000 })
970
970
  * )
971
971
  *
972
- * assert.deepStrictEqual(ServiceMap.get(Services, Timeout), { TIMEOUT: 5000 })
972
+ * assert.deepStrictEqual(Context.get(context, Timeout), { TIMEOUT: 5000 })
973
973
  * ```
974
974
  *
975
975
  * @since 4.0.0
976
976
  * @category Getters
977
977
  */
978
- <Services, I extends Services, S>(service: Key<I, S>): (self: ServiceMap<Services>) => S
978
+ <Services, I extends Services, S>(service: Key<I, S>): (self: Context<Services>) => S
979
979
  /**
980
980
  * Get a service from the context that corresponds to the given key.
981
981
  *
982
- * @param self - The `ServiceMap` to search for the service.
982
+ * @param self - The `Context` to search for the service.
983
983
  * @param service - The `Service` of the service to retrieve.
984
984
  *
985
985
  * @example
986
986
  * ```ts
987
- * import { pipe, ServiceMap } from "effect"
987
+ * import { pipe, Context } from "effect"
988
988
  * import * as assert from "node:assert"
989
989
  *
990
- * const Port = ServiceMap.Service<{ PORT: number }>("Port")
991
- * const Timeout = ServiceMap.Service<{ TIMEOUT: number }>("Timeout")
990
+ * const Port = Context.Service<{ PORT: number }>("Port")
991
+ * const Timeout = Context.Service<{ TIMEOUT: number }>("Timeout")
992
992
  *
993
- * const Services = pipe(
994
- * ServiceMap.make(Port, { PORT: 8080 }),
995
- * ServiceMap.add(Timeout, { TIMEOUT: 5000 })
993
+ * const context = pipe(
994
+ * Context.make(Port, { PORT: 8080 }),
995
+ * Context.add(Timeout, { TIMEOUT: 5000 })
996
996
  * )
997
997
  *
998
- * assert.deepStrictEqual(ServiceMap.get(Services, Timeout), { TIMEOUT: 5000 })
998
+ * assert.deepStrictEqual(Context.get(context, Timeout), { TIMEOUT: 5000 })
999
999
  * ```
1000
1000
  *
1001
1001
  * @since 4.0.0
1002
1002
  * @category Getters
1003
1003
  */
1004
- <Services, I extends Services, S>(self: ServiceMap<Services>, service: Key<I, S>): S
1004
+ <Services, I extends Services, S>(self: Context<Services>, service: Key<I, S>): S
1005
1005
  } = getUnsafe
1006
1006
 
1007
1007
  /**
1008
1008
  * @example
1009
1009
  * ```ts
1010
- * import { ServiceMap } from "effect"
1010
+ * import { Context } from "effect"
1011
1011
  * import * as assert from "node:assert"
1012
1012
  *
1013
- * const LoggerRef = ServiceMap.Reference("Logger", {
1013
+ * const LoggerRef = Context.Reference("Logger", {
1014
1014
  * defaultValue: () => ({ log: (msg: string) => console.log(msg) })
1015
1015
  * })
1016
1016
  *
1017
- * const services = ServiceMap.empty()
1018
- * const logger = ServiceMap.getReferenceUnsafe(services, LoggerRef)
1017
+ * const context = Context.empty()
1018
+ * const logger = Context.getReferenceUnsafe(context, LoggerRef)
1019
1019
  *
1020
1020
  * assert.deepStrictEqual(logger, { log: (msg: string) => console.log(msg) })
1021
1021
  * ```
@@ -1023,14 +1023,14 @@ export const get: {
1023
1023
  * @since 4.0.0
1024
1024
  * @category unsafe
1025
1025
  */
1026
- export const getReferenceUnsafe = <Services, S>(self: ServiceMap<Services>, service: Reference<S>): S => {
1026
+ export const getReferenceUnsafe = <Services, S>(self: Context<Services>, service: Reference<S>): S => {
1027
1027
  if (!self.mapUnsafe.has(service.key)) {
1028
1028
  return getDefaultValue(service as any)
1029
1029
  }
1030
1030
  return self.mapUnsafe.get(service.key)! as any
1031
1031
  }
1032
1032
 
1033
- const defaultValueCacheKey = "~effect/ServiceMap/defaultValue" as const
1033
+ const defaultValueCacheKey = "~effect/Context/defaultValue" as const
1034
1034
 
1035
1035
  const getDefaultValue = (ref: Reference<any>) => {
1036
1036
  if (defaultValueCacheKey in ref) {
@@ -1065,24 +1065,24 @@ const serviceNotFoundError = (service: Key<any, any>) => {
1065
1065
  * an `Option` object. If the key is not found, the `Option` object will be
1066
1066
  * `None`.
1067
1067
  *
1068
- * @param self - The `ServiceMap` to search for the service.
1068
+ * @param self - The `Context` to search for the service.
1069
1069
  * @param service - The `Service` of the service to retrieve.
1070
1070
  *
1071
1071
  * @example
1072
1072
  * ```ts
1073
- * import { Option, ServiceMap } from "effect"
1073
+ * import { Option, Context } from "effect"
1074
1074
  * import * as assert from "node:assert"
1075
1075
  *
1076
- * const Port = ServiceMap.Service<{ PORT: number }>("Port")
1077
- * const Timeout = ServiceMap.Service<{ TIMEOUT: number }>("Timeout")
1076
+ * const Port = Context.Service<{ PORT: number }>("Port")
1077
+ * const Timeout = Context.Service<{ TIMEOUT: number }>("Timeout")
1078
1078
  *
1079
- * const Services = ServiceMap.make(Port, { PORT: 8080 })
1079
+ * const context = Context.make(Port, { PORT: 8080 })
1080
1080
  *
1081
1081
  * assert.deepStrictEqual(
1082
- * ServiceMap.getOption(Services, Port),
1082
+ * Context.getOption(context, Port),
1083
1083
  * Option.some({ PORT: 8080 })
1084
1084
  * )
1085
- * assert.deepStrictEqual(ServiceMap.getOption(Services, Timeout), Option.none())
1085
+ * assert.deepStrictEqual(Context.getOption(context, Timeout), Option.none())
1086
1086
  * ```
1087
1087
  *
1088
1088
  * @since 4.0.0
@@ -1094,60 +1094,60 @@ export const getOption: {
1094
1094
  * an `Option` object. If the key is not found, the `Option` object will be
1095
1095
  * `None`.
1096
1096
  *
1097
- * @param self - The `ServiceMap` to search for the service.
1097
+ * @param self - The `Context` to search for the service.
1098
1098
  * @param service - The `Service` of the service to retrieve.
1099
1099
  *
1100
1100
  * @example
1101
1101
  * ```ts
1102
- * import { Option, ServiceMap } from "effect"
1102
+ * import { Option, Context } from "effect"
1103
1103
  * import * as assert from "node:assert"
1104
1104
  *
1105
- * const Port = ServiceMap.Service<{ PORT: number }>("Port")
1106
- * const Timeout = ServiceMap.Service<{ TIMEOUT: number }>("Timeout")
1105
+ * const Port = Context.Service<{ PORT: number }>("Port")
1106
+ * const Timeout = Context.Service<{ TIMEOUT: number }>("Timeout")
1107
1107
  *
1108
- * const Services = ServiceMap.make(Port, { PORT: 8080 })
1108
+ * const context = Context.make(Port, { PORT: 8080 })
1109
1109
  *
1110
1110
  * assert.deepStrictEqual(
1111
- * ServiceMap.getOption(Services, Port),
1111
+ * Context.getOption(context, Port),
1112
1112
  * Option.some({ PORT: 8080 })
1113
1113
  * )
1114
- * assert.deepStrictEqual(ServiceMap.getOption(Services, Timeout), Option.none())
1114
+ * assert.deepStrictEqual(Context.getOption(context, Timeout), Option.none())
1115
1115
  * ```
1116
1116
  *
1117
1117
  * @since 4.0.0
1118
1118
  * @category Getters
1119
1119
  */
1120
- <S, I>(service: Key<I, S>): <Services>(self: ServiceMap<Services>) => Option.Option<S>
1120
+ <S, I>(service: Key<I, S>): <Services>(self: Context<Services>) => Option.Option<S>
1121
1121
  /**
1122
1122
  * Get the value associated with the specified key from the context wrapped in
1123
1123
  * an `Option` object. If the key is not found, the `Option` object will be
1124
1124
  * `None`.
1125
1125
  *
1126
- * @param self - The `ServiceMap` to search for the service.
1126
+ * @param self - The `Context` to search for the service.
1127
1127
  * @param service - The `Service` of the service to retrieve.
1128
1128
  *
1129
1129
  * @example
1130
1130
  * ```ts
1131
- * import { Option, ServiceMap } from "effect"
1131
+ * import { Option, Context } from "effect"
1132
1132
  * import * as assert from "node:assert"
1133
1133
  *
1134
- * const Port = ServiceMap.Service<{ PORT: number }>("Port")
1135
- * const Timeout = ServiceMap.Service<{ TIMEOUT: number }>("Timeout")
1134
+ * const Port = Context.Service<{ PORT: number }>("Port")
1135
+ * const Timeout = Context.Service<{ TIMEOUT: number }>("Timeout")
1136
1136
  *
1137
- * const Services = ServiceMap.make(Port, { PORT: 8080 })
1137
+ * const context = Context.make(Port, { PORT: 8080 })
1138
1138
  *
1139
1139
  * assert.deepStrictEqual(
1140
- * ServiceMap.getOption(Services, Port),
1140
+ * Context.getOption(context, Port),
1141
1141
  * Option.some({ PORT: 8080 })
1142
1142
  * )
1143
- * assert.deepStrictEqual(ServiceMap.getOption(Services, Timeout), Option.none())
1143
+ * assert.deepStrictEqual(Context.getOption(context, Timeout), Option.none())
1144
1144
  * ```
1145
1145
  *
1146
1146
  * @since 4.0.0
1147
1147
  * @category Getters
1148
1148
  */
1149
- <Services, S, I>(self: ServiceMap<Services>, service: Key<I, S>): Option.Option<S>
1150
- } = dual(2, <Services, I extends Services, S>(self: ServiceMap<Services>, service: Key<I, S>): Option.Option<S> => {
1149
+ <Services, S, I>(self: Context<Services>, service: Key<I, S>): Option.Option<S>
1150
+ } = dual(2, <Services, I extends Services, S>(self: Context<Services>, service: Key<I, S>): Option.Option<S> => {
1151
1151
  if (self.mapUnsafe.has(service.key)) {
1152
1152
  return Option.some(self.mapUnsafe.get(service.key)! as any)
1153
1153
  }
@@ -1155,26 +1155,26 @@ export const getOption: {
1155
1155
  })
1156
1156
 
1157
1157
  /**
1158
- * Merges two `ServiceMap`s, returning a new `ServiceMap` containing the services of both.
1158
+ * Merges two `Context`s, returning a new `Context` containing the services of both.
1159
1159
  *
1160
- * @param self - The first `ServiceMap` to merge.
1161
- * @param that - The second `ServiceMap` to merge.
1160
+ * @param self - The first `Context` to merge.
1161
+ * @param that - The second `Context` to merge.
1162
1162
  *
1163
1163
  * @example
1164
1164
  * ```ts
1165
- * import { ServiceMap } from "effect"
1165
+ * import { Context } from "effect"
1166
1166
  * import * as assert from "node:assert"
1167
1167
  *
1168
- * const Port = ServiceMap.Service<{ PORT: number }>("Port")
1169
- * const Timeout = ServiceMap.Service<{ TIMEOUT: number }>("Timeout")
1168
+ * const Port = Context.Service<{ PORT: number }>("Port")
1169
+ * const Timeout = Context.Service<{ TIMEOUT: number }>("Timeout")
1170
1170
  *
1171
- * const firstServiceMap = ServiceMap.make(Port, { PORT: 8080 })
1172
- * const secondServiceMap = ServiceMap.make(Timeout, { TIMEOUT: 5000 })
1171
+ * const firstContext = Context.make(Port, { PORT: 8080 })
1172
+ * const secondContext = Context.make(Timeout, { TIMEOUT: 5000 })
1173
1173
  *
1174
- * const Services = ServiceMap.merge(firstServiceMap, secondServiceMap)
1174
+ * const context = Context.merge(firstContext, secondContext)
1175
1175
  *
1176
- * assert.deepStrictEqual(ServiceMap.get(Services, Port), { PORT: 8080 })
1177
- * assert.deepStrictEqual(ServiceMap.get(Services, Timeout), { TIMEOUT: 5000 })
1176
+ * assert.deepStrictEqual(Context.get(context, Port), { PORT: 8080 })
1177
+ * assert.deepStrictEqual(Context.get(context, Timeout), { TIMEOUT: 5000 })
1178
1178
  * ```
1179
1179
  *
1180
1180
  * @since 4.0.0
@@ -1182,60 +1182,60 @@ export const getOption: {
1182
1182
  */
1183
1183
  export const merge: {
1184
1184
  /**
1185
- * Merges two `ServiceMap`s, returning a new `ServiceMap` containing the services of both.
1185
+ * Merges two `Context`s, returning a new `Context` containing the services of both.
1186
1186
  *
1187
- * @param self - The first `ServiceMap` to merge.
1188
- * @param that - The second `ServiceMap` to merge.
1187
+ * @param self - The first `Context` to merge.
1188
+ * @param that - The second `Context` to merge.
1189
1189
  *
1190
1190
  * @example
1191
1191
  * ```ts
1192
- * import { ServiceMap } from "effect"
1192
+ * import { Context } from "effect"
1193
1193
  * import * as assert from "node:assert"
1194
1194
  *
1195
- * const Port = ServiceMap.Service<{ PORT: number }>("Port")
1196
- * const Timeout = ServiceMap.Service<{ TIMEOUT: number }>("Timeout")
1195
+ * const Port = Context.Service<{ PORT: number }>("Port")
1196
+ * const Timeout = Context.Service<{ TIMEOUT: number }>("Timeout")
1197
1197
  *
1198
- * const firstServiceMap = ServiceMap.make(Port, { PORT: 8080 })
1199
- * const secondServiceMap = ServiceMap.make(Timeout, { TIMEOUT: 5000 })
1198
+ * const firstContext = Context.make(Port, { PORT: 8080 })
1199
+ * const secondContext = Context.make(Timeout, { TIMEOUT: 5000 })
1200
1200
  *
1201
- * const Services = ServiceMap.merge(firstServiceMap, secondServiceMap)
1201
+ * const context = Context.merge(firstContext, secondContext)
1202
1202
  *
1203
- * assert.deepStrictEqual(ServiceMap.get(Services, Port), { PORT: 8080 })
1204
- * assert.deepStrictEqual(ServiceMap.get(Services, Timeout), { TIMEOUT: 5000 })
1203
+ * assert.deepStrictEqual(Context.get(context, Port), { PORT: 8080 })
1204
+ * assert.deepStrictEqual(Context.get(context, Timeout), { TIMEOUT: 5000 })
1205
1205
  * ```
1206
1206
  *
1207
1207
  * @since 4.0.0
1208
1208
  * @category Utils
1209
1209
  */
1210
- <R1>(that: ServiceMap<R1>): <Services>(self: ServiceMap<Services>) => ServiceMap<R1 | Services>
1210
+ <R1>(that: Context<R1>): <Services>(self: Context<Services>) => Context<R1 | Services>
1211
1211
  /**
1212
- * Merges two `ServiceMap`s, returning a new `ServiceMap` containing the services of both.
1212
+ * Merges two `Context`s, returning a new `Context` containing the services of both.
1213
1213
  *
1214
- * @param self - The first `ServiceMap` to merge.
1215
- * @param that - The second `ServiceMap` to merge.
1214
+ * @param self - The first `Context` to merge.
1215
+ * @param that - The second `Context` to merge.
1216
1216
  *
1217
1217
  * @example
1218
1218
  * ```ts
1219
- * import { ServiceMap } from "effect"
1219
+ * import { Context } from "effect"
1220
1220
  * import * as assert from "node:assert"
1221
1221
  *
1222
- * const Port = ServiceMap.Service<{ PORT: number }>("Port")
1223
- * const Timeout = ServiceMap.Service<{ TIMEOUT: number }>("Timeout")
1222
+ * const Port = Context.Service<{ PORT: number }>("Port")
1223
+ * const Timeout = Context.Service<{ TIMEOUT: number }>("Timeout")
1224
1224
  *
1225
- * const firstServiceMap = ServiceMap.make(Port, { PORT: 8080 })
1226
- * const secondServiceMap = ServiceMap.make(Timeout, { TIMEOUT: 5000 })
1225
+ * const firstContext = Context.make(Port, { PORT: 8080 })
1226
+ * const secondContext = Context.make(Timeout, { TIMEOUT: 5000 })
1227
1227
  *
1228
- * const Services = ServiceMap.merge(firstServiceMap, secondServiceMap)
1228
+ * const context = Context.merge(firstContext, secondContext)
1229
1229
  *
1230
- * assert.deepStrictEqual(ServiceMap.get(Services, Port), { PORT: 8080 })
1231
- * assert.deepStrictEqual(ServiceMap.get(Services, Timeout), { TIMEOUT: 5000 })
1230
+ * assert.deepStrictEqual(Context.get(context, Port), { PORT: 8080 })
1231
+ * assert.deepStrictEqual(Context.get(context, Timeout), { TIMEOUT: 5000 })
1232
1232
  * ```
1233
1233
  *
1234
1234
  * @since 4.0.0
1235
1235
  * @category Utils
1236
1236
  */
1237
- <Services, R1>(self: ServiceMap<Services>, that: ServiceMap<R1>): ServiceMap<Services | R1>
1238
- } = dual(2, <Services, R1>(self: ServiceMap<Services>, that: ServiceMap<R1>): ServiceMap<Services | R1> => {
1237
+ <Services, R1>(self: Context<Services>, that: Context<R1>): Context<Services | R1>
1238
+ } = dual(2, <Services, R1>(self: Context<Services>, that: Context<R1>): Context<Services | R1> => {
1239
1239
  if (self.mapUnsafe.size === 0) return that as any
1240
1240
  if (that.mapUnsafe.size === 0) return self as any
1241
1241
  return withMapUnsafe(self, (map) => {
@@ -1244,37 +1244,37 @@ export const merge: {
1244
1244
  })
1245
1245
 
1246
1246
  /**
1247
- * Merges any number of `ServiceMap`s, returning a new `ServiceMap` containing the services of all.
1247
+ * Merges any number of `Context`s, returning a new `Context` containing the services of all.
1248
1248
  *
1249
1249
  * @example
1250
1250
  * ```ts
1251
- * import { ServiceMap } from "effect"
1251
+ * import { Context } from "effect"
1252
1252
  * import * as assert from "node:assert"
1253
1253
  *
1254
- * const Port = ServiceMap.Service<{ PORT: number }>("Port")
1255
- * const Timeout = ServiceMap.Service<{ TIMEOUT: number }>("Timeout")
1256
- * const Host = ServiceMap.Service<{ HOST: string }>("Host")
1254
+ * const Port = Context.Service<{ PORT: number }>("Port")
1255
+ * const Timeout = Context.Service<{ TIMEOUT: number }>("Timeout")
1256
+ * const Host = Context.Service<{ HOST: string }>("Host")
1257
1257
  *
1258
- * const firstServiceMap = ServiceMap.make(Port, { PORT: 8080 })
1259
- * const secondServiceMap = ServiceMap.make(Timeout, { TIMEOUT: 5000 })
1260
- * const thirdServiceMap = ServiceMap.make(Host, { HOST: "localhost" })
1258
+ * const firstContext = Context.make(Port, { PORT: 8080 })
1259
+ * const secondContext = Context.make(Timeout, { TIMEOUT: 5000 })
1260
+ * const thirdContext = Context.make(Host, { HOST: "localhost" })
1261
1261
  *
1262
- * const Services = ServiceMap.mergeAll(
1263
- * firstServiceMap,
1264
- * secondServiceMap,
1265
- * thirdServiceMap
1262
+ * const context = Context.mergeAll(
1263
+ * firstContext,
1264
+ * secondContext,
1265
+ * thirdContext
1266
1266
  * )
1267
1267
  *
1268
- * assert.deepStrictEqual(ServiceMap.get(Services, Port), { PORT: 8080 })
1269
- * assert.deepStrictEqual(ServiceMap.get(Services, Timeout), { TIMEOUT: 5000 })
1270
- * assert.deepStrictEqual(ServiceMap.get(Services, Host), { HOST: "localhost" })
1268
+ * assert.deepStrictEqual(Context.get(context, Port), { PORT: 8080 })
1269
+ * assert.deepStrictEqual(Context.get(context, Timeout), { TIMEOUT: 5000 })
1270
+ * assert.deepStrictEqual(Context.get(context, Host), { HOST: "localhost" })
1271
1271
  * ```
1272
1272
  *
1273
1273
  * @since 3.12.0
1274
1274
  */
1275
1275
  export const mergeAll = <T extends Array<unknown>>(
1276
- ...ctxs: [...{ [K in keyof T]: ServiceMap<T[K]> }]
1277
- ): ServiceMap<T[number]> => {
1276
+ ...ctxs: [...{ [K in keyof T]: Context<T[K]> }]
1277
+ ): Context<T[number]> => {
1278
1278
  const map = new Map()
1279
1279
  for (let i = 0; i < ctxs.length; i++) {
1280
1280
  ctxs[i].mapUnsafe.forEach((value, key) => {
@@ -1285,31 +1285,31 @@ export const mergeAll = <T extends Array<unknown>>(
1285
1285
  }
1286
1286
 
1287
1287
  /**
1288
- * Returns a new `ServiceMap` that contains only the specified services.
1288
+ * Returns a new `Context` that contains only the specified services.
1289
1289
  *
1290
- * @param self - The `ServiceMap` to prune services from.
1291
- * @param services - The list of `Service`s to be included in the new `ServiceMap`.
1290
+ * @param self - The `Context` to prune services from.
1291
+ * @param services - The list of `Service`s to be included in the new `Context`.
1292
1292
  *
1293
1293
  * @example
1294
1294
  * ```ts
1295
- * import { Option, pipe, ServiceMap } from "effect"
1295
+ * import { Option, pipe, Context } from "effect"
1296
1296
  * import * as assert from "node:assert"
1297
1297
  *
1298
- * const Port = ServiceMap.Service<{ PORT: number }>("Port")
1299
- * const Timeout = ServiceMap.Service<{ TIMEOUT: number }>("Timeout")
1298
+ * const Port = Context.Service<{ PORT: number }>("Port")
1299
+ * const Timeout = Context.Service<{ TIMEOUT: number }>("Timeout")
1300
1300
  *
1301
- * const someServiceMap = pipe(
1302
- * ServiceMap.make(Port, { PORT: 8080 }),
1303
- * ServiceMap.add(Timeout, { TIMEOUT: 5000 })
1301
+ * const someContext = pipe(
1302
+ * Context.make(Port, { PORT: 8080 }),
1303
+ * Context.add(Timeout, { TIMEOUT: 5000 })
1304
1304
  * )
1305
1305
  *
1306
- * const Services = pipe(someServiceMap, ServiceMap.pick(Port))
1306
+ * const context = pipe(someContext, Context.pick(Port))
1307
1307
  *
1308
1308
  * assert.deepStrictEqual(
1309
- * ServiceMap.getOption(Services, Port),
1309
+ * Context.getOption(context, Port),
1310
1310
  * Option.some({ PORT: 8080 })
1311
1311
  * )
1312
- * assert.deepStrictEqual(ServiceMap.getOption(Services, Timeout), Option.none())
1312
+ * assert.deepStrictEqual(Context.getOption(context, Timeout), Option.none())
1313
1313
  * ```
1314
1314
  *
1315
1315
  * @since 4.0.0
@@ -1318,7 +1318,7 @@ export const mergeAll = <T extends Array<unknown>>(
1318
1318
  export const pick = <S extends ReadonlyArray<Key<any, any>>>(
1319
1319
  ...services: S
1320
1320
  ) =>
1321
- <Services>(self: ServiceMap<Services>): ServiceMap<Services & Service.Identifier<S[number]>> =>
1321
+ <Services>(self: Context<Services>): Context<Services & Service.Identifier<S[number]>> =>
1322
1322
  withMapUnsafe(self, (map) => {
1323
1323
  const keySet = new Set(services.map((key) => key.key))
1324
1324
  map.forEach((_, key) => {
@@ -1330,24 +1330,24 @@ export const pick = <S extends ReadonlyArray<Key<any, any>>>(
1330
1330
  /**
1331
1331
  * @example
1332
1332
  * ```ts
1333
- * import { Option, pipe, ServiceMap } from "effect"
1333
+ * import { Option, pipe, Context } from "effect"
1334
1334
  * import * as assert from "node:assert"
1335
1335
  *
1336
- * const Port = ServiceMap.Service<{ PORT: number }>("Port")
1337
- * const Timeout = ServiceMap.Service<{ TIMEOUT: number }>("Timeout")
1336
+ * const Port = Context.Service<{ PORT: number }>("Port")
1337
+ * const Timeout = Context.Service<{ TIMEOUT: number }>("Timeout")
1338
1338
  *
1339
- * const someServiceMap = pipe(
1340
- * ServiceMap.make(Port, { PORT: 8080 }),
1341
- * ServiceMap.add(Timeout, { TIMEOUT: 5000 })
1339
+ * const someContext = pipe(
1340
+ * Context.make(Port, { PORT: 8080 }),
1341
+ * Context.add(Timeout, { TIMEOUT: 5000 })
1342
1342
  * )
1343
1343
  *
1344
- * const Services = pipe(someServiceMap, ServiceMap.omit(Timeout))
1344
+ * const context = pipe(someContext, Context.omit(Timeout))
1345
1345
  *
1346
1346
  * assert.deepStrictEqual(
1347
- * ServiceMap.getOption(Services, Port),
1347
+ * Context.getOption(context, Port),
1348
1348
  * Option.some({ PORT: 8080 })
1349
1349
  * )
1350
- * assert.deepStrictEqual(ServiceMap.getOption(Services, Timeout), Option.none())
1350
+ * assert.deepStrictEqual(Context.getOption(context, Timeout), Option.none())
1351
1351
  * ```
1352
1352
  *
1353
1353
  * @since 4.0.0
@@ -1356,7 +1356,7 @@ export const pick = <S extends ReadonlyArray<Key<any, any>>>(
1356
1356
  export const omit = <S extends ReadonlyArray<Key<any, any>>>(
1357
1357
  ...keys: S
1358
1358
  ) =>
1359
- <Services>(self: ServiceMap<Services>): ServiceMap<Exclude<Services, Service.Identifier<S[number]>>> =>
1359
+ <Services>(self: Context<Services>): Context<Exclude<Services, Service.Identifier<S[number]>>> =>
1360
1360
  withMapUnsafe(self, (map) => {
1361
1361
  for (let i = 0; i < keys.length; i++) {
1362
1362
  map.delete(keys[i].key)
@@ -1364,7 +1364,7 @@ export const omit = <S extends ReadonlyArray<Key<any, any>>>(
1364
1364
  })
1365
1365
 
1366
1366
  /**
1367
- * Perform a series of mutations on a `ServiceMap`. Prevents unnecessary copying
1367
+ * Perform a series of mutations on a `Context`. Prevents unnecessary copying
1368
1368
  * of the underlying map when multiple mutations are needed.
1369
1369
  *
1370
1370
  * @since 4.0.0
@@ -1372,29 +1372,26 @@ export const omit = <S extends ReadonlyArray<Key<any, any>>>(
1372
1372
  */
1373
1373
  export const mutate: {
1374
1374
  /**
1375
- * Perform a series of mutations on a `ServiceMap`. Prevents unnecessary copying
1375
+ * Perform a series of mutations on a `Context`. Prevents unnecessary copying
1376
1376
  * of the underlying map when multiple mutations are needed.
1377
1377
  *
1378
1378
  * @since 4.0.0
1379
1379
  * @category Utils
1380
1380
  */
1381
- <Services, B>(f: (serviceMap: ServiceMap<Services>) => ServiceMap<B>): <Services>(self: ServiceMap<Services>) => ServiceMap<B>
1381
+ <Services, B>(f: (context: Context<Services>) => Context<B>): <Services>(self: Context<Services>) => Context<B>
1382
1382
  /**
1383
- * Perform a series of mutations on a `ServiceMap`. Prevents unnecessary copying
1383
+ * Perform a series of mutations on a `Context`. Prevents unnecessary copying
1384
1384
  * of the underlying map when multiple mutations are needed.
1385
1385
  *
1386
1386
  * @since 4.0.0
1387
1387
  * @category Utils
1388
1388
  */
1389
- <Services, B>(
1390
- self: ServiceMap<Services>,
1391
- f: (serviceMap: ServiceMap<Services>) => ServiceMap<B>
1392
- ): ServiceMap<B>
1389
+ <Services, B>(self: Context<Services>, f: (context: Context<Services>) => Context<B>): Context<B>
1393
1390
  } = dual(
1394
1391
  2,
1395
- <Services, B>(self: ServiceMap<Services>, f: (serviceMap: ServiceMap<Services>) => ServiceMap<B>): ServiceMap<B> => {
1392
+ <Services, B>(self: Context<Services>, f: (context: Context<Services>) => Context<B>): Context<B> => {
1396
1393
  const next = makeUnsafe</**
1397
- * Perform a series of mutations on a `ServiceMap`. Prevents unnecessary copying
1394
+ * Perform a series of mutations on a `Context`. Prevents unnecessary copying
1398
1395
  * of the underlying map when multiple mutations are needed.
1399
1396
  *
1400
1397
  * @since 4.0.0
@@ -1408,7 +1405,7 @@ export const mutate: {
1408
1405
  }
1409
1406
  )
1410
1407
 
1411
- const withMapUnsafe = <Services, B>(self: ServiceMap<Services>, f: (map: Map<string, any>) => void): ServiceMap<B> => {
1408
+ const withMapUnsafe = <Services, B>(self: Context<Services>, f: (map: Map<string, any>) => void): Context<B> => {
1412
1409
  if (self.mutable) {
1413
1410
  f(self.mapUnsafe as any)
1414
1411
  return self as any
@@ -1419,33 +1416,33 @@ const withMapUnsafe = <Services, B>(self: ServiceMap<Services>, f: (map: Map<str
1419
1416
  }
1420
1417
 
1421
1418
  /**
1422
- * Creates a service map key with a default value.
1419
+ * Creates a context key with a default value.
1423
1420
  *
1424
1421
  * **Details**
1425
1422
  *
1426
- * `ServiceMap.Reference` allows you to create a key that can hold a value. You
1423
+ * `Context.Reference` allows you to create a key that can hold a value. You
1427
1424
  * can provide a default value for the service, which will automatically be used
1428
1425
  * when the context is accessed, or override it with a custom implementation
1429
1426
  * when needed.
1430
1427
  *
1431
1428
  * @example
1432
1429
  * ```ts
1433
- * import { ServiceMap } from "effect"
1430
+ * import { Context } from "effect"
1434
1431
  *
1435
1432
  * // Create a reference with a default value
1436
- * const LoggerRef = ServiceMap.Reference("Logger", {
1433
+ * const LoggerRef = Context.Reference("Logger", {
1437
1434
  * defaultValue: () => ({ log: (msg: string) => console.log(msg) })
1438
1435
  * })
1439
1436
  *
1440
1437
  * // The reference provides the default value when accessed from an empty context
1441
- * const services = ServiceMap.empty()
1442
- * const logger = ServiceMap.get(services, LoggerRef)
1438
+ * const context = Context.empty()
1439
+ * const logger = Context.get(context, LoggerRef)
1443
1440
  *
1444
1441
  * // You can also override the default value
1445
- * const customServices = ServiceMap.make(LoggerRef, {
1442
+ * const customContext = Context.make(LoggerRef, {
1446
1443
  * log: (msg: string) => `Custom: ${msg}`
1447
1444
  * })
1448
- * const customLogger = ServiceMap.get(customServices, LoggerRef)
1445
+ * const customLogger = Context.get(customContext, LoggerRef)
1449
1446
  * ```
1450
1447
  *
1451
1448
  * @since 4.0.0