effect 4.0.0-beta.65 → 4.0.0-beta.66

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 (243) hide show
  1. package/dist/Cause.d.ts +4 -4
  2. package/dist/Cause.d.ts.map +1 -1
  3. package/dist/Config.d.ts +1 -2
  4. package/dist/Config.d.ts.map +1 -1
  5. package/dist/Config.js +7 -6
  6. package/dist/Config.js.map +1 -1
  7. package/dist/Context.d.ts +3 -4
  8. package/dist/Context.d.ts.map +1 -1
  9. package/dist/Context.js +10 -8
  10. package/dist/Context.js.map +1 -1
  11. package/dist/DateTime.d.ts +1 -1
  12. package/dist/DateTime.d.ts.map +1 -1
  13. package/dist/DateTime.js +2 -2
  14. package/dist/DateTime.js.map +1 -1
  15. package/dist/Effect.d.ts +337 -412
  16. package/dist/Effect.d.ts.map +1 -1
  17. package/dist/Effect.js +5 -32
  18. package/dist/Effect.js.map +1 -1
  19. package/dist/Effectable.d.ts +1 -1
  20. package/dist/Effectable.d.ts.map +1 -1
  21. package/dist/Effectable.js +1 -1
  22. package/dist/Effectable.js.map +1 -1
  23. package/dist/ExecutionPlan.d.ts +2 -3
  24. package/dist/ExecutionPlan.d.ts.map +1 -1
  25. package/dist/ExecutionPlan.js +1 -1
  26. package/dist/ExecutionPlan.js.map +1 -1
  27. package/dist/FiberHandle.d.ts +2 -2
  28. package/dist/FiberHandle.js +2 -2
  29. package/dist/FiberMap.d.ts +2 -2
  30. package/dist/FiberMap.js +2 -2
  31. package/dist/FiberSet.d.ts +1 -1
  32. package/dist/FiberSet.js +1 -1
  33. package/dist/Layer.js +1 -1
  34. package/dist/Layer.js.map +1 -1
  35. package/dist/LayerMap.d.ts.map +1 -1
  36. package/dist/LayerMap.js +3 -3
  37. package/dist/LayerMap.js.map +1 -1
  38. package/dist/ManagedRuntime.d.ts +1 -1
  39. package/dist/ManagedRuntime.js +1 -1
  40. package/dist/Option.d.ts +11 -7
  41. package/dist/Option.d.ts.map +1 -1
  42. package/dist/Option.js +74 -0
  43. package/dist/Option.js.map +1 -1
  44. package/dist/Result.d.ts +11 -3
  45. package/dist/Result.d.ts.map +1 -1
  46. package/dist/Result.js.map +1 -1
  47. package/dist/Schedule.js +1 -1
  48. package/dist/Schedule.js.map +1 -1
  49. package/dist/Schema.d.ts +12 -12
  50. package/dist/Schema.d.ts.map +1 -1
  51. package/dist/Schema.js +6 -4
  52. package/dist/Schema.js.map +1 -1
  53. package/dist/SchemaGetter.js +2 -2
  54. package/dist/SchemaGetter.js.map +1 -1
  55. package/dist/SchemaRepresentation.d.ts +2 -2
  56. package/dist/Stream.d.ts +3 -3
  57. package/dist/Stream.js +1 -1
  58. package/dist/TxRef.js +1 -1
  59. package/dist/TxRef.js.map +1 -1
  60. package/dist/internal/concurrency.js +2 -2
  61. package/dist/internal/concurrency.js.map +1 -1
  62. package/dist/internal/core.js +8 -20
  63. package/dist/internal/core.js.map +1 -1
  64. package/dist/internal/effect.js +20 -19
  65. package/dist/internal/effect.js.map +1 -1
  66. package/dist/internal/executionPlan.js +2 -2
  67. package/dist/internal/executionPlan.js.map +1 -1
  68. package/dist/internal/option.js +5 -8
  69. package/dist/internal/option.js.map +1 -1
  70. package/dist/internal/result.js +5 -8
  71. package/dist/internal/result.js.map +1 -1
  72. package/dist/unstable/ai/LanguageModel.d.ts +5 -5
  73. package/dist/unstable/ai/LanguageModel.d.ts.map +1 -1
  74. package/dist/unstable/ai/LanguageModel.js +1 -1
  75. package/dist/unstable/ai/LanguageModel.js.map +1 -1
  76. package/dist/unstable/ai/McpServer.js +2 -2
  77. package/dist/unstable/ai/McpServer.js.map +1 -1
  78. package/dist/unstable/ai/Model.d.ts +5 -1
  79. package/dist/unstable/ai/Model.d.ts.map +1 -1
  80. package/dist/unstable/ai/Model.js +4 -4
  81. package/dist/unstable/ai/Model.js.map +1 -1
  82. package/dist/unstable/ai/Toolkit.d.ts +1 -3
  83. package/dist/unstable/ai/Toolkit.d.ts.map +1 -1
  84. package/dist/unstable/ai/Toolkit.js +28 -31
  85. package/dist/unstable/ai/Toolkit.js.map +1 -1
  86. package/dist/unstable/cli/Command.d.ts +25 -5
  87. package/dist/unstable/cli/Command.d.ts.map +1 -1
  88. package/dist/unstable/cli/Command.js.map +1 -1
  89. package/dist/unstable/cli/GlobalFlag.d.ts +1 -1
  90. package/dist/unstable/cli/GlobalFlag.d.ts.map +1 -1
  91. package/dist/unstable/cli/Param.js +1 -1
  92. package/dist/unstable/cli/Param.js.map +1 -1
  93. package/dist/unstable/cli/Prompt.d.ts +1 -2
  94. package/dist/unstable/cli/Prompt.d.ts.map +1 -1
  95. package/dist/unstable/cli/Prompt.js +8 -10
  96. package/dist/unstable/cli/Prompt.js.map +1 -1
  97. package/dist/unstable/cli/internal/command.d.ts +2 -6
  98. package/dist/unstable/cli/internal/command.d.ts.map +1 -1
  99. package/dist/unstable/cli/internal/command.js +7 -9
  100. package/dist/unstable/cli/internal/command.js.map +1 -1
  101. package/dist/unstable/cluster/ClusterWorkflowEngine.js +1 -1
  102. package/dist/unstable/cluster/ClusterWorkflowEngine.js.map +1 -1
  103. package/dist/unstable/cluster/Entity.js +3 -3
  104. package/dist/unstable/cluster/Entity.js.map +1 -1
  105. package/dist/unstable/cluster/MessageStorage.js +1 -1
  106. package/dist/unstable/cluster/MessageStorage.js.map +1 -1
  107. package/dist/unstable/cluster/ShardingConfig.js +1 -1
  108. package/dist/unstable/cluster/ShardingConfig.js.map +1 -1
  109. package/dist/unstable/eventlog/EventLogMessage.d.ts +4 -4
  110. package/dist/unstable/http/HttpBody.js +2 -2
  111. package/dist/unstable/http/HttpBody.js.map +1 -1
  112. package/dist/unstable/http/HttpClient.js +1 -1
  113. package/dist/unstable/http/HttpClient.js.map +1 -1
  114. package/dist/unstable/http/HttpClientRequest.js +2 -2
  115. package/dist/unstable/http/HttpClientRequest.js.map +1 -1
  116. package/dist/unstable/http/HttpMiddleware.d.ts.map +1 -1
  117. package/dist/unstable/http/HttpMiddleware.js +18 -21
  118. package/dist/unstable/http/HttpMiddleware.js.map +1 -1
  119. package/dist/unstable/http/HttpPlatform.js +1 -1
  120. package/dist/unstable/http/HttpPlatform.js.map +1 -1
  121. package/dist/unstable/http/HttpRouter.d.ts.map +1 -1
  122. package/dist/unstable/http/HttpRouter.js +4 -4
  123. package/dist/unstable/http/HttpRouter.js.map +1 -1
  124. package/dist/unstable/http/HttpServer.js +1 -1
  125. package/dist/unstable/http/HttpServer.js.map +1 -1
  126. package/dist/unstable/http/HttpServerRequest.js +11 -11
  127. package/dist/unstable/http/HttpServerRequest.js.map +1 -1
  128. package/dist/unstable/http/HttpServerResponse.d.ts.map +1 -1
  129. package/dist/unstable/http/HttpServerResponse.js +5 -5
  130. package/dist/unstable/http/HttpServerResponse.js.map +1 -1
  131. package/dist/unstable/http/Multipart.js +1 -1
  132. package/dist/unstable/http/Multipart.js.map +1 -1
  133. package/dist/unstable/httpapi/HttpApiBuilder.js +3 -3
  134. package/dist/unstable/httpapi/HttpApiBuilder.js.map +1 -1
  135. package/dist/unstable/httpapi/HttpApiClient.js +1 -1
  136. package/dist/unstable/httpapi/HttpApiClient.js.map +1 -1
  137. package/dist/unstable/httpapi/HttpApiMiddleware.d.ts +2 -0
  138. package/dist/unstable/httpapi/HttpApiMiddleware.d.ts.map +1 -1
  139. package/dist/unstable/httpapi/HttpApiMiddleware.js +2 -1
  140. package/dist/unstable/httpapi/HttpApiMiddleware.js.map +1 -1
  141. package/dist/unstable/httpapi/HttpApiTest.d.ts +3 -1
  142. package/dist/unstable/httpapi/HttpApiTest.d.ts.map +1 -1
  143. package/dist/unstable/httpapi/HttpApiTest.js +2 -2
  144. package/dist/unstable/httpapi/HttpApiTest.js.map +1 -1
  145. package/dist/unstable/persistence/RateLimiter.js +1 -1
  146. package/dist/unstable/persistence/RateLimiter.js.map +1 -1
  147. package/dist/unstable/process/ChildProcess.d.ts +2 -45
  148. package/dist/unstable/process/ChildProcess.d.ts.map +1 -1
  149. package/dist/unstable/process/ChildProcess.js +51 -7
  150. package/dist/unstable/process/ChildProcess.js.map +1 -1
  151. package/dist/unstable/reactivity/Atom.d.ts.map +1 -1
  152. package/dist/unstable/reactivity/Atom.js +4 -4
  153. package/dist/unstable/reactivity/Atom.js.map +1 -1
  154. package/dist/unstable/rpc/RpcClient.js +1 -1
  155. package/dist/unstable/rpc/RpcClient.js.map +1 -1
  156. package/dist/unstable/rpc/RpcServer.d.ts.map +1 -1
  157. package/dist/unstable/rpc/RpcServer.js +1 -1
  158. package/dist/unstable/rpc/RpcServer.js.map +1 -1
  159. package/dist/unstable/rpc/RpcWorker.js +1 -1
  160. package/dist/unstable/rpc/RpcWorker.js.map +1 -1
  161. package/dist/unstable/socket/Socket.d.ts.map +1 -1
  162. package/dist/unstable/socket/Socket.js +1 -1
  163. package/dist/unstable/socket/Socket.js.map +1 -1
  164. package/dist/unstable/sql/Migrator.js +1 -1
  165. package/dist/unstable/sql/Migrator.js.map +1 -1
  166. package/dist/unstable/workflow/Activity.js +1 -1
  167. package/dist/unstable/workflow/Activity.js.map +1 -1
  168. package/dist/unstable/workflow/DurableQueue.d.ts +122 -0
  169. package/dist/unstable/workflow/DurableQueue.d.ts.map +1 -0
  170. package/dist/unstable/workflow/DurableQueue.js +182 -0
  171. package/dist/unstable/workflow/DurableQueue.js.map +1 -0
  172. package/dist/unstable/workflow/Workflow.js +1 -1
  173. package/dist/unstable/workflow/Workflow.js.map +1 -1
  174. package/dist/unstable/workflow/index.d.ts +4 -0
  175. package/dist/unstable/workflow/index.d.ts.map +1 -1
  176. package/dist/unstable/workflow/index.js +4 -0
  177. package/dist/unstable/workflow/index.js.map +1 -1
  178. package/package.json +1 -1
  179. package/src/Cause.ts +4 -4
  180. package/src/Config.ts +8 -8
  181. package/src/Context.ts +13 -14
  182. package/src/DateTime.ts +2 -2
  183. package/src/Effect.ts +340 -431
  184. package/src/Effectable.ts +2 -2
  185. package/src/ExecutionPlan.ts +3 -4
  186. package/src/FiberHandle.ts +2 -2
  187. package/src/FiberMap.ts +2 -2
  188. package/src/FiberSet.ts +1 -1
  189. package/src/Layer.ts +1 -1
  190. package/src/LayerMap.ts +3 -4
  191. package/src/ManagedRuntime.ts +1 -1
  192. package/src/Option.ts +14 -7
  193. package/src/Result.ts +14 -3
  194. package/src/Schedule.ts +1 -1
  195. package/src/Schema.ts +26 -24
  196. package/src/SchemaGetter.ts +3 -3
  197. package/src/Stream.ts +4 -4
  198. package/src/TxRef.ts +1 -1
  199. package/src/internal/concurrency.ts +2 -2
  200. package/src/internal/core.ts +12 -23
  201. package/src/internal/effect.ts +25 -29
  202. package/src/internal/executionPlan.ts +2 -2
  203. package/src/internal/option.ts +5 -8
  204. package/src/internal/result.ts +5 -8
  205. package/src/unstable/ai/LanguageModel.ts +12 -19
  206. package/src/unstable/ai/McpServer.ts +2 -2
  207. package/src/unstable/ai/Model.ts +15 -12
  208. package/src/unstable/ai/Toolkit.ts +30 -38
  209. package/src/unstable/cli/Command.ts +32 -13
  210. package/src/unstable/cli/GlobalFlag.ts +1 -1
  211. package/src/unstable/cli/Param.ts +1 -1
  212. package/src/unstable/cli/Prompt.ts +9 -13
  213. package/src/unstable/cli/internal/command.ts +12 -14
  214. package/src/unstable/cluster/ClusterWorkflowEngine.ts +1 -1
  215. package/src/unstable/cluster/Entity.ts +3 -3
  216. package/src/unstable/cluster/MessageStorage.ts +1 -1
  217. package/src/unstable/cluster/ShardingConfig.ts +1 -1
  218. package/src/unstable/http/HttpBody.ts +2 -2
  219. package/src/unstable/http/HttpClient.ts +1 -1
  220. package/src/unstable/http/HttpClientRequest.ts +2 -2
  221. package/src/unstable/http/HttpMiddleware.ts +4 -5
  222. package/src/unstable/http/HttpPlatform.ts +1 -1
  223. package/src/unstable/http/HttpRouter.ts +4 -5
  224. package/src/unstable/http/HttpServer.ts +1 -1
  225. package/src/unstable/http/HttpServerRequest.ts +11 -11
  226. package/src/unstable/http/HttpServerResponse.ts +5 -5
  227. package/src/unstable/http/Multipart.ts +1 -1
  228. package/src/unstable/httpapi/HttpApiBuilder.ts +4 -4
  229. package/src/unstable/httpapi/HttpApiClient.ts +1 -1
  230. package/src/unstable/httpapi/HttpApiMiddleware.ts +2 -1
  231. package/src/unstable/httpapi/HttpApiTest.ts +5 -2
  232. package/src/unstable/persistence/RateLimiter.ts +1 -1
  233. package/src/unstable/process/ChildProcess.ts +11 -14
  234. package/src/unstable/reactivity/Atom.ts +4 -4
  235. package/src/unstable/rpc/RpcClient.ts +1 -1
  236. package/src/unstable/rpc/RpcServer.ts +1 -2
  237. package/src/unstable/rpc/RpcWorker.ts +2 -2
  238. package/src/unstable/socket/Socket.ts +1 -1
  239. package/src/unstable/sql/Migrator.ts +1 -1
  240. package/src/unstable/workflow/Activity.ts +1 -1
  241. package/src/unstable/workflow/DurableQueue.ts +343 -0
  242. package/src/unstable/workflow/Workflow.ts +1 -1
  243. package/src/unstable/workflow/index.ts +5 -0
@@ -119,7 +119,7 @@ export const HttpClient: Context.Service<HttpClient, HttpClient> = Context.Servi
119
119
 
120
120
  const accessor = (method: keyof HttpClient) => (...args: Array<any>): Effect.Effect<any, any, any> =>
121
121
  Effect.flatMap(
122
- HttpClient.asEffect(),
122
+ HttpClient,
123
123
  (client) => (client as any)[method](...args)
124
124
  )
125
125
 
@@ -1051,8 +1051,8 @@ export const toWeb = (self: HttpClientRequest, options?: {
1051
1051
  readonly signal?: AbortSignal | undefined
1052
1052
  }): Effect.Effect<Request, UrlParams.UrlParamsError> =>
1053
1053
  Effect.contextWith((context) =>
1054
- toWebResult(self, {
1054
+ Effect.fromResult(toWebResult(self, {
1055
1055
  context: context,
1056
1056
  signal: options?.signal
1057
- }).asEffect()
1057
+ }))
1058
1058
  )
@@ -105,9 +105,8 @@ export const SpanNameGenerator = Context.Reference<(request: HttpServerRequest)
105
105
  */
106
106
  export const logger: <E, R>(
107
107
  httpApp: Effect.Effect<HttpServerResponse, E, HttpServerRequest | R>
108
- ) => Effect.Effect<HttpServerResponse, E, HttpServerRequest | R> = make((httpApp) => {
109
- let counter = 0
110
- return Effect.withFiber((fiber) => {
108
+ ) => Effect.Effect<HttpServerResponse, E, HttpServerRequest | R> = make((httpApp) =>
109
+ Effect.withFiber((fiber) => {
111
110
  const request = Context.getUnsafe(fiber.context, HttpServerRequest)
112
111
  const path = stripSearchAndHash(request.url)
113
112
  return Effect.withLogSpan(
@@ -134,10 +133,10 @@ export const logger: <E, R>(
134
133
  exit
135
134
  )
136
135
  }),
137
- `http.span.${++counter}`
136
+ "http.span"
138
137
  )
139
138
  })
140
- })
139
+ )
141
140
 
142
141
  /**
143
142
  * @since 4.0.0
@@ -121,7 +121,7 @@ export const make: (impl: {
121
121
  * @category layers
122
122
  */
123
123
  export const layer = Layer.effect(HttpPlatform)(
124
- Effect.flatMap(FileSystem.FileSystem.asEffect(), (fs) =>
124
+ Effect.flatMap(FileSystem.FileSystem, (fs) =>
125
125
  make({
126
126
  fileResponse(path, status, statusText, headers, start, end, contentLength) {
127
127
  return Response.stream(
@@ -148,7 +148,7 @@ export const make = Effect.gen(function*() {
148
148
  Effect.succeed(handler) :
149
149
  Effect.isEffect(handler)
150
150
  ? handler
151
- : Effect.flatMap(HttpServerRequest.HttpServerRequest.asEffect(), handler),
151
+ : Effect.flatMap(HttpServerRequest.HttpServerRequest, handler),
152
152
  uninterruptible: options?.uninterruptible ?? false,
153
153
  prefix
154
154
  })
@@ -240,7 +240,7 @@ export const params: Effect.Effect<
240
240
  ReadonlyRecord<string, string | undefined>,
241
241
  never,
242
242
  RouteContext
243
- > = Effect.map(RouteContext.asEffect(), (_) => _.params)
243
+ > = Effect.map(RouteContext, (_) => _.params)
244
244
 
245
245
  /**
246
246
  * @since 4.0.0
@@ -385,8 +385,7 @@ export const schemaPathParams = <A, I extends Readonly<Record<string, string | u
385
385
  */
386
386
  export const use = <A, E, R>(
387
387
  f: (router: HttpRouter) => Effect.Effect<A, E, R>
388
- ): Layer.Layer<never, E, HttpRouter | Exclude<R, Scope.Scope>> =>
389
- Layer.effectDiscard(Effect.flatMap(HttpRouter.asEffect(), f))
388
+ ): Layer.Layer<never, E, HttpRouter | Exclude<R, Scope.Scope>> => Layer.effectDiscard(Effect.flatMap(HttpRouter, f))
390
389
 
391
390
  /**
392
391
  * Create a layer that adds a single route to the HTTP router.
@@ -559,7 +558,7 @@ export const route = <E = never, R = never>(
559
558
  Effect.succeed(handler) :
560
559
  Effect.isEffect(handler)
561
560
  ? handler
562
- : Effect.flatMap(HttpServerRequest.HttpServerRequest.asEffect(), handler),
561
+ : Effect.flatMap(HttpServerRequest.HttpServerRequest, handler),
563
562
  uninterruptible: options?.uninterruptible ?? false
564
563
  })
565
564
 
@@ -201,7 +201,7 @@ export const addressFormattedWith = <A, E, R>(
201
201
  f: (address: string) => Effect.Effect<A, E, R>
202
202
  ): Effect.Effect<A, E, HttpServer | R> =>
203
203
  Effect.flatMap(
204
- HttpServer.asEffect(),
204
+ HttpServer,
205
205
  (server) => f(formatAddress(server.address))
206
206
  )
207
207
 
@@ -121,7 +121,7 @@ export const upgradeChannel = <IE = never>(): Channel.Channel<
121
121
  unknown,
122
122
  HttpServerRequest
123
123
  > =>
124
- HttpServerRequest.asEffect().pipe(
124
+ HttpServerRequest.pipe(
125
125
  Effect.flatMap((_) => _.upgrade),
126
126
  Effect.map(Socket.toChannelWith<IE>()),
127
127
  Channel.unwrap
@@ -136,7 +136,7 @@ export const schemaCookies = <A, I extends Readonly<Record<string, string | unde
136
136
  options?: ParseOptions | undefined
137
137
  ): Effect.Effect<A, Schema.SchemaError, RD | HttpServerRequest> => {
138
138
  const parse = Schema.decodeUnknownEffect(schema)
139
- return Effect.flatMap(HttpServerRequest.asEffect(), (req) => parse(req.cookies, options))
139
+ return Effect.flatMap(HttpServerRequest, (req) => parse(req.cookies, options))
140
140
  }
141
141
 
142
142
  /**
@@ -148,7 +148,7 @@ export const schemaHeaders = <A, I extends Readonly<Record<string, string | unde
148
148
  options?: ParseOptions | undefined
149
149
  ): Effect.Effect<A, Schema.SchemaError, HttpServerRequest | RD> => {
150
150
  const parse = Schema.decodeUnknownEffect(schema)
151
- return Effect.flatMap(HttpServerRequest.asEffect(), (req) => parse(req.headers, options))
151
+ return Effect.flatMap(HttpServerRequest, (req) => parse(req.headers, options))
152
152
  }
153
153
 
154
154
  /**
@@ -165,7 +165,7 @@ export const schemaSearchParams = <
165
165
  options?: ParseOptions | undefined
166
166
  ): Effect.Effect<A, Schema.SchemaError, ParsedSearchParams | RD> => {
167
167
  const parse = Schema.decodeUnknownEffect(schema)
168
- return Effect.flatMap(ParsedSearchParams.asEffect(), (params) => parse(params, options))
168
+ return Effect.flatMap(ParsedSearchParams, (params) => parse(params, options))
169
169
  }
170
170
  /**
171
171
  * @since 4.0.0
@@ -176,7 +176,7 @@ export const schemaBodyJson = <A, I, RD, RE>(
176
176
  options?: ParseOptions | undefined
177
177
  ): Effect.Effect<A, HttpServerError | Schema.SchemaError, HttpServerRequest | RD> => {
178
178
  const parse = HttpIncomingMessage.schemaBodyJson(schema, options)
179
- return Effect.flatMap(HttpServerRequest.asEffect(), parse)
179
+ return Effect.flatMap(HttpServerRequest, parse)
180
180
  }
181
181
 
182
182
  const isMultipart = (request: HttpServerRequest) =>
@@ -193,7 +193,7 @@ export const schemaBodyForm = <A, I extends Partial<Multipart.Persisted>, RD, RE
193
193
  ) => {
194
194
  const parseMultipart = Multipart.schemaPersisted(schema)
195
195
  const parseUrlParams = HttpIncomingMessage.schemaBodyUrlParams(schema as Schema.Codec<A, any, RD, RE>, options)
196
- return Effect.flatMap(HttpServerRequest.asEffect(), (request): Effect.Effect<
196
+ return Effect.flatMap(HttpServerRequest, (request): Effect.Effect<
197
197
  A,
198
198
  Multipart.MultipartError | Schema.SchemaError | HttpServerError,
199
199
  RD | HttpServerRequest | Scope.Scope | FileSystem.FileSystem | Path.Path
@@ -219,7 +219,7 @@ export const schemaBodyUrlParams = <
219
219
  options?: ParseOptions | undefined
220
220
  ): Effect.Effect<A, HttpServerError | Schema.SchemaError, HttpServerRequest | RD> => {
221
221
  const parse = HttpIncomingMessage.schemaBodyUrlParams(schema, options)
222
- return Effect.flatMap(HttpServerRequest.asEffect(), parse)
222
+ return Effect.flatMap(HttpServerRequest, parse)
223
223
  }
224
224
 
225
225
  /**
@@ -235,7 +235,7 @@ export const schemaBodyMultipart = <A, I extends Partial<Multipart.Persisted>, R
235
235
  HttpServerRequest | Scope.Scope | FileSystem.FileSystem | Path.Path | RD
236
236
  > => {
237
237
  const parse = Multipart.schemaPersisted(schema)
238
- return HttpServerRequest.asEffect().pipe(
238
+ return HttpServerRequest.pipe(
239
239
  Effect.flatMap((_) => _.multipart),
240
240
  Effect.flatMap((_) => parse(_, options))
241
241
  )
@@ -256,7 +256,7 @@ export const schemaBodyFormJson = <A, I, RD, RE>(
256
256
  Schema.decodeEffect
257
257
  )
258
258
  return Effect.flatMap(
259
- HttpServerRequest.asEffect(),
259
+ HttpServerRequest,
260
260
  (request): Effect.Effect<
261
261
  A,
262
262
  Schema.SchemaError | HttpServerError,
@@ -933,8 +933,8 @@ export const toWeb = (self: HttpServerRequest, options?: {
933
933
  readonly signal?: AbortSignal | undefined
934
934
  }): Effect.Effect<Request, RequestError> =>
935
935
  Effect.contextWith((context) =>
936
- toWebResult(self, {
936
+ Effect.fromResult(toWebResult(self, {
937
937
  context,
938
938
  signal: options?.signal
939
- }).asEffect()
939
+ }))
940
940
  )
@@ -379,7 +379,7 @@ export const file = (
379
379
  })
380
380
  | undefined
381
381
  ): Effect.Effect<HttpServerResponse, PlatformError, HttpPlatform> =>
382
- Effect.flatMap(HttpPlatformKey.asEffect(), (platform) => platform.fileResponse(path, options))
382
+ Effect.flatMap(HttpPlatformKey, (platform) => platform.fileResponse(path, options))
383
383
 
384
384
  /**
385
385
  * @since 4.0.0
@@ -395,7 +395,7 @@ export const fileWeb = (
395
395
  })
396
396
  | undefined
397
397
  ): Effect.Effect<HttpServerResponse, never, HttpPlatform> =>
398
- Effect.flatMap(HttpPlatformKey.asEffect(), (platform) => platform.fileWebResponse(file, options))
398
+ Effect.flatMap(HttpPlatformKey, (platform) => platform.fileWebResponse(file, options))
399
399
 
400
400
  /**
401
401
  * @since 4.0.0
@@ -520,7 +520,7 @@ export const setCookie: {
520
520
  options?: Cookies.Cookie["options"]
521
521
  ): Effect.Effect<HttpServerResponse, Cookies.CookiesError> =>
522
522
  Effect.map(
523
- Cookies.set(self.cookies, name, value, options).asEffect(),
523
+ Effect.fromResult(Cookies.set(self.cookies, name, value, options)),
524
524
  (cookies) =>
525
525
  makeResponse({
526
526
  ...self,
@@ -561,7 +561,7 @@ export const expireCookie: {
561
561
  options?: Omit<NonNullable<Cookies.Cookie["options"]>, "expires" | "maxAge">
562
562
  ): Effect.Effect<HttpServerResponse, Cookies.CookiesError> =>
563
563
  Effect.map(
564
- Cookies.expireCookie(self.cookies, name, options).asEffect(),
564
+ Effect.fromResult(Cookies.expireCookie(self.cookies, name, options)),
565
565
  (cookies) =>
566
566
  makeResponse({
567
567
  ...self,
@@ -733,7 +733,7 @@ export const setCookies: {
733
733
  ]
734
734
  >
735
735
  ): Effect.Effect<HttpServerResponse, Cookies.CookiesError> =>
736
- Effect.map(Cookies.setAll(self.cookies, cookies).asEffect(), (cookies) =>
736
+ Effect.map(Effect.fromResult(Cookies.setAll(self.cookies, cookies)), (cookies) =>
737
737
  makeResponse({
738
738
  ...self,
739
739
  cookies
@@ -455,7 +455,7 @@ class FileImpl extends PartBase implements File {
455
455
 
456
456
  const defaultWriteFile = (path: string, file: File) =>
457
457
  Effect.flatMap(
458
- FileSystem.FileSystem.asEffect(),
458
+ FileSystem.FileSystem,
459
459
  (fs) =>
460
460
  Effect.mapError(
461
461
  Stream.run(file.content, fs.sink(path)),
@@ -364,7 +364,7 @@ export const securityDecode = <Security extends HttpApiSecurity.HttpApiSecurity>
364
364
  switch (self._tag) {
365
365
  case "Bearer": {
366
366
  return Effect.map(
367
- HttpServerRequest.asEffect(),
367
+ HttpServerRequest,
368
368
  (request) => Redacted.make((request.headers.authorization ?? "").slice(bearerLen)) as any
369
369
  )
370
370
  }
@@ -392,9 +392,9 @@ export const securityDecode = <Security extends HttpApiSecurity.HttpApiSecurity>
392
392
  username: "",
393
393
  password: Redacted.make("")
394
394
  } as any
395
- return HttpServerRequest.asEffect().pipe(
395
+ return HttpServerRequest.pipe(
396
396
  Effect.flatMap((request) =>
397
- Encoding.decodeBase64String((request.headers.authorization ?? "").slice(basicLen)).asEffect()
397
+ Effect.fromResult(Encoding.decodeBase64String((request.headers.authorization ?? "").slice(basicLen)))
398
398
  ),
399
399
  Effect.match({
400
400
  onFailure: () => empty,
@@ -722,7 +722,7 @@ const makeSecurityMiddleware = (
722
722
  }
723
723
  return result.success
724
724
  }
725
- return yield* lastResult!.asEffect()
725
+ return yield* Effect.fromResult(lastResult!)
726
726
  })
727
727
 
728
728
  securityMiddlewareCache.set(service, middleware)
@@ -386,7 +386,7 @@ export const make = <ApiId extends string, Groups extends HttpApiGroup.Any>(
386
386
  never,
387
387
  HttpClient.HttpClient | HttpApiGroup.MiddlewareClient<Groups>
388
388
  > =>
389
- Effect.flatMap(HttpClient.HttpClient.asEffect(), (httpClient) =>
389
+ Effect.flatMap(HttpClient.HttpClient, (httpClient) =>
390
390
  makeWith(api, {
391
391
  ...options,
392
392
  httpClient: options?.transformClient ? options.transformClient(httpClient) : httpClient
@@ -1,6 +1,8 @@
1
1
  /**
2
2
  * @since 4.0.0
3
3
  */
4
+ /** @effect-diagnostics floatingEffect:skip-file */
5
+ /** @effect-diagnostics classSelfMismatch:off */
4
6
  import * as Context from "../../Context.ts"
5
7
  import * as Effect from "../../Effect.ts"
6
8
  import * as Layer from "../../Layer.ts"
@@ -280,7 +282,6 @@ export const Service = <
280
282
  const creationError = new Err()
281
283
  Err.stackTraceLimit = limit
282
284
 
283
- /** @effect-diagnostics-next-line classSelfMismatch:off */
284
285
  class Service extends Context.Service<Self, any>()(id) {}
285
286
  const self = Service as any
286
287
  Object.defineProperty(Service, "stack", {
@@ -31,7 +31,10 @@ export const groups = Effect.fnUntraced(function*<
31
31
  SelectedGroups = HttpApiGroup.WithName<Groups, Names[number]>
32
32
  >(
33
33
  api: HttpApi.HttpApi<ApiId, Groups>,
34
- groupNames: Names
34
+ groupNames: Names,
35
+ options?: {
36
+ readonly baseUrl?: string | URL | undefined
37
+ }
35
38
  ): Effect.fn.Return<
36
39
  HttpApiClient.Client<Groups>,
37
40
  never,
@@ -90,6 +93,6 @@ export const groups = Effect.fnUntraced(function*<
90
93
 
91
94
  return yield* HttpApiClient.makeWith(api, {
92
95
  httpClient,
93
- baseUrl: "http://localhost:3000"
96
+ baseUrl: options?.baseUrl ?? "http://localhost:3000"
94
97
  })
95
98
  })
@@ -666,5 +666,5 @@ export const layerStoreRedisConfig = (
666
666
  ): Layer.Layer<RateLimiterStore, Config.ConfigError, Redis.Redis> =>
667
667
  Layer.effect(
668
668
  RateLimiterStore,
669
- Effect.flatMap(Config.unwrap(options).asEffect(), makeStoreRedis)
669
+ Effect.flatMap(Config.unwrap(options), makeStoreRedis)
670
670
  )
@@ -40,11 +40,11 @@
40
40
  *
41
41
  * @since 4.0.0
42
42
  */
43
+ import * as Context from "../../Context.ts"
43
44
  import type * as Duration from "../../Duration.ts"
44
45
  import type * as Effect from "../../Effect.ts"
46
+ import * as Effectable from "../../Effectable.ts"
45
47
  import { dual } from "../../Function.ts"
46
- import { PipeInspectableProto, YieldableProto } from "../../internal/core.ts"
47
- import type { Pipeable } from "../../Pipeable.ts"
48
48
  import type * as PlatformError from "../../PlatformError.ts"
49
49
  import * as Predicate from "../../Predicate.ts"
50
50
  import type * as Scope from "../../Scope.ts"
@@ -74,9 +74,7 @@ export type Command =
74
74
  * @category Models
75
75
  */
76
76
  export interface StandardCommand extends
77
- Pipeable,
78
- Effect.Yieldable<
79
- StandardCommand,
77
+ Effect.Effect<
80
78
  ChildProcessHandle,
81
79
  PlatformError.PlatformError,
82
80
  ChildProcessSpawner | Scope.Scope
@@ -96,9 +94,7 @@ export interface StandardCommand extends
96
94
  * @category Models
97
95
  */
98
96
  export interface PipedCommand extends
99
- Pipeable,
100
- Effect.Yieldable<
101
- PipedCommand,
97
+ Effect.Effect<
102
98
  ChildProcessHandle,
103
99
  PlatformError.PlatformError,
104
100
  ChildProcessSpawner | Scope.Scope
@@ -510,12 +506,13 @@ export type TemplateExpression = TemplateExpressionItem | ReadonlyArray<Template
510
506
  // =============================================================================
511
507
 
512
508
  const Proto = {
513
- ...PipeInspectableProto,
514
- ...YieldableProto,
515
- [TypeId]: TypeId,
516
- asEffect(this: Command) {
517
- return ChildProcessSpawner.use((_) => _.spawn(this))
518
- }
509
+ ...Effectable.Prototype<Command>({
510
+ label: "Command",
511
+ evaluate(fiber) {
512
+ return Context.getUnsafe(fiber.context, ChildProcessSpawner).spawn(this)
513
+ }
514
+ }),
515
+ [TypeId]: TypeId
519
516
  }
520
517
 
521
518
  /**
@@ -2316,7 +2316,7 @@ export const modify: {
2316
2316
  } = dual(
2317
2317
  2,
2318
2318
  <R, W, A>(self: Writable<R, W>, f: (_: R) => [returnValue: A, nextValue: W]): Effect.Effect<A, never, AtomRegistry> =>
2319
- Effect.map(AtomRegistry.asEffect(), (_) => _.modify(self, f))
2319
+ Effect.map(AtomRegistry, (_) => _.modify(self, f))
2320
2320
  )
2321
2321
 
2322
2322
  /**
@@ -2337,7 +2337,7 @@ export const set: {
2337
2337
  } = dual(
2338
2338
  2,
2339
2339
  <R, W>(self: Writable<R, W>, value: W): Effect.Effect<void, never, AtomRegistry> =>
2340
- Effect.map(AtomRegistry.asEffect(), (_) => _.set(self, value))
2340
+ Effect.map(AtomRegistry, (_) => _.set(self, value))
2341
2341
  )
2342
2342
 
2343
2343
  /**
@@ -2358,7 +2358,7 @@ export const update: {
2358
2358
  } = dual(
2359
2359
  2,
2360
2360
  <R, W>(self: Writable<R, W>, f: (_: R) => W): Effect.Effect<void, never, AtomRegistry> =>
2361
- Effect.map(AtomRegistry.asEffect(), (_) => _.update(self, f))
2361
+ Effect.map(AtomRegistry, (_) => _.update(self, f))
2362
2362
  )
2363
2363
 
2364
2364
  /**
@@ -2375,7 +2375,7 @@ export const getResult = <A, E>(
2375
2375
  * @category Conversions
2376
2376
  */
2377
2377
  export const refresh = <A>(self: Atom<A>): Effect.Effect<void, never, AtomRegistry> =>
2378
- Effect.map(AtomRegistry.asEffect(), (_) => _.refresh(self))
2378
+ Effect.map(AtomRegistry, (_) => _.refresh(self))
2379
2379
 
2380
2380
  /**
2381
2381
  * @since 4.0.0
@@ -916,7 +916,7 @@ export const layerProtocolHttp = (options: {
916
916
  }): Layer.Layer<Protocol, never, RpcSerialization.RpcSerialization | HttpClient.HttpClient> =>
917
917
  Layer.effect(Protocol)(
918
918
  Effect.flatMap(
919
- HttpClient.HttpClient.asEffect(),
919
+ HttpClient.HttpClient,
920
920
  (client) => {
921
921
  client = HttpClient.mapRequest(client, HttpClientRequest.prependUrl(options.url))
922
922
  return makeProtocolHttp(options.transformClient ? options.transformClient(client) : client)
@@ -961,6 +961,7 @@ export const makeProtocolWithHttpEffect: Effect.Effect<
961
961
  const id = clientId++
962
962
  const queue = yield* Queue.make<Uint8Array | FromServerEncoded, Cause.Done>()
963
963
  const parser = serialization.makeUnsafe()
964
+ const requestIds: Array<RequestId> = []
964
965
 
965
966
  const offer = (data: Uint8Array | string) =>
966
967
  typeof data === "string" ? Queue.offer(queue, encoder.encode(data)) : Queue.offer(queue, data)
@@ -993,8 +994,6 @@ export const makeProtocolWithHttpEffect: Effect.Effect<
993
994
  clients.set(id, client)
994
995
  clientIds.add(id)
995
996
 
996
- const requestIds: Array<RequestId> = []
997
-
998
997
  // @effect-diagnostics-next-line tryCatchInEffectGen:off
999
998
  try {
1000
999
  const decoded = parser.decode(data) as ReadonlyArray<FromClientEncoded>
@@ -85,8 +85,8 @@ export const layerInitialMessage = <S extends Schema.Top, R2>(
85
85
  export const initialMessage = <S extends Schema.Top>(
86
86
  schema: S
87
87
  ): Effect.Effect<S["Type"], NoSuchElementError | Schema.SchemaError, Protocol | S["DecodingServices"]> =>
88
- ProtocolTag.asEffect().pipe(
88
+ ProtocolTag.pipe(
89
89
  Effect.flatMap((protocol) => protocol.initialMessage),
90
- Effect.flatMap((o) => o.asEffect()),
90
+ Effect.flatMap(Effect.fromOption),
91
91
  Effect.flatMap(Schema.decodeUnknownEffect(Schema.toCodecJson(schema)))
92
92
  )
@@ -448,7 +448,7 @@ export const makeChannel = <IE = never>(): Channel.Channel<
448
448
  IE,
449
449
  unknown,
450
450
  Socket
451
- > => Channel.unwrap(Effect.map(Socket.asEffect(), toChannelWith<IE>()))
451
+ > => Channel.unwrap(Effect.map(Socket, toChannelWith<IE>()))
452
452
 
453
453
  /**
454
454
  * @since 4.0.0
@@ -114,7 +114,7 @@ export const make = <RD = never>({
114
114
  migration_id integer primary key,
115
115
  created_at timestamp with time zone not null default now(),
116
116
  name text not null
117
- )`.asEffect()
117
+ )`
118
118
  ),
119
119
  orElse: () =>
120
120
  sql`CREATE TABLE IF NOT EXISTS ${sql(table)} (
@@ -256,7 +256,7 @@ export const raceAll = <const Activities extends NonEmptyReadonlyArray<Any>>(
256
256
  error: Schema.Union(
257
257
  activities.map((activity) => (activity as any).errorSchema)
258
258
  ),
259
- effects: activities.map((activity) => (activity as any).asEffect()) as any
259
+ effects: activities.map((activity) => (activity as any)) as any
260
260
  }) as any
261
261
 
262
262
  // -----------------------------------------------------------------------------