@effect/platform-bun 0.81.1 → 0.82.0
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.
- package/BunClusterHttp/package.json +6 -0
- package/BunClusterSocket/package.json +6 -0
- package/dist/cjs/{BunClusterRunnerHttp.js → BunClusterHttp.js} +16 -7
- package/dist/cjs/BunClusterHttp.js.map +1 -0
- package/dist/cjs/BunClusterSocket.js +55 -0
- package/dist/cjs/BunClusterSocket.js.map +1 -0
- package/dist/cjs/index.js +5 -9
- package/dist/dts/{BunClusterRunnerHttp.d.ts → BunClusterHttp.d.ts} +5 -5
- package/dist/dts/BunClusterHttp.d.ts.map +1 -0
- package/dist/dts/BunClusterSocket.d.ts +35 -0
- package/dist/dts/BunClusterSocket.d.ts.map +1 -0
- package/dist/dts/index.d.ts +2 -10
- package/dist/dts/index.d.ts.map +1 -1
- package/dist/esm/BunClusterHttp.js +50 -0
- package/dist/esm/BunClusterHttp.js.map +1 -0
- package/dist/esm/BunClusterSocket.js +45 -0
- package/dist/esm/BunClusterSocket.js.map +1 -0
- package/dist/esm/index.js +2 -10
- package/dist/esm/index.js.map +1 -1
- package/package.json +19 -35
- package/src/{BunClusterRunnerHttp.ts → BunClusterHttp.ts} +44 -21
- package/src/BunClusterSocket.ts +101 -0
- package/src/index.ts +2 -12
- package/BunClusterRunnerHttp/package.json +0 -6
- package/BunClusterRunnerSocket/package.json +0 -6
- package/BunClusterShardManagerHttp/package.json +0 -6
- package/BunClusterShardManagerSocket/package.json +0 -6
- package/dist/cjs/BunClusterRunnerHttp.js.map +0 -1
- package/dist/cjs/BunClusterRunnerSocket.js +0 -17
- package/dist/cjs/BunClusterRunnerSocket.js.map +0 -1
- package/dist/cjs/BunClusterShardManagerHttp.js +0 -40
- package/dist/cjs/BunClusterShardManagerHttp.js.map +0 -1
- package/dist/cjs/BunClusterShardManagerSocket.js +0 -17
- package/dist/cjs/BunClusterShardManagerSocket.js.map +0 -1
- package/dist/dts/BunClusterRunnerHttp.d.ts.map +0 -1
- package/dist/dts/BunClusterRunnerSocket.d.ts +0 -9
- package/dist/dts/BunClusterRunnerSocket.d.ts.map +0 -1
- package/dist/dts/BunClusterShardManagerHttp.d.ts +0 -28
- package/dist/dts/BunClusterShardManagerHttp.d.ts.map +0 -1
- package/dist/dts/BunClusterShardManagerSocket.d.ts +0 -9
- package/dist/dts/BunClusterShardManagerSocket.d.ts.map +0 -1
- package/dist/esm/BunClusterRunnerHttp.js +0 -41
- package/dist/esm/BunClusterRunnerHttp.js.map +0 -1
- package/dist/esm/BunClusterRunnerSocket.js +0 -9
- package/dist/esm/BunClusterRunnerSocket.js.map +0 -1
- package/dist/esm/BunClusterShardManagerHttp.js +0 -31
- package/dist/esm/BunClusterShardManagerHttp.js.map +0 -1
- package/dist/esm/BunClusterShardManagerSocket.js +0 -9
- package/dist/esm/BunClusterShardManagerSocket.js.map +0 -1
- package/src/BunClusterRunnerSocket.ts +0 -9
- package/src/BunClusterShardManagerHttp.ts +0 -72
- package/src/BunClusterShardManagerSocket.ts +0 -9
|
@@ -1,72 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @since 1.0.0
|
|
3
|
-
*/
|
|
4
|
-
import * as HttpShardManager from "@effect/cluster/HttpShardManager"
|
|
5
|
-
import * as ShardingConfig from "@effect/cluster/ShardingConfig"
|
|
6
|
-
import * as ShardManager from "@effect/cluster/ShardManager"
|
|
7
|
-
import * as ShardStorage from "@effect/cluster/ShardStorage"
|
|
8
|
-
import * as SqlShardStorage from "@effect/cluster/SqlShardStorage"
|
|
9
|
-
import type * as Etag from "@effect/platform/Etag"
|
|
10
|
-
import * as FetchHttpClient from "@effect/platform/FetchHttpClient"
|
|
11
|
-
import type { HttpPlatform } from "@effect/platform/HttpPlatform"
|
|
12
|
-
import type { HttpServer } from "@effect/platform/HttpServer"
|
|
13
|
-
import type { ServeError } from "@effect/platform/HttpServerError"
|
|
14
|
-
import * as RpcSerialization from "@effect/rpc/RpcSerialization"
|
|
15
|
-
import type { SqlClient } from "@effect/sql/SqlClient"
|
|
16
|
-
import type { SqlError } from "@effect/sql/SqlError"
|
|
17
|
-
import type { ConfigError } from "effect/ConfigError"
|
|
18
|
-
import * as Effect from "effect/Effect"
|
|
19
|
-
import * as Layer from "effect/Layer"
|
|
20
|
-
import type { BunContext } from "./BunContext.js"
|
|
21
|
-
import * as BunHttpServer from "./BunHttpServer.js"
|
|
22
|
-
import * as BunSocket from "./BunSocket.js"
|
|
23
|
-
|
|
24
|
-
/**
|
|
25
|
-
* @since 1.0.0
|
|
26
|
-
* @category Layers
|
|
27
|
-
*/
|
|
28
|
-
export const layerHttpServer: Layer.Layer<
|
|
29
|
-
| HttpPlatform
|
|
30
|
-
| Etag.Generator
|
|
31
|
-
| BunContext
|
|
32
|
-
| HttpServer,
|
|
33
|
-
ServeError,
|
|
34
|
-
ShardingConfig.ShardingConfig
|
|
35
|
-
> = Effect.gen(function*() {
|
|
36
|
-
const config = yield* ShardingConfig.ShardingConfig
|
|
37
|
-
return BunHttpServer.layer(config.shardManagerAddress)
|
|
38
|
-
}).pipe(Layer.unwrapEffect)
|
|
39
|
-
|
|
40
|
-
/**
|
|
41
|
-
* @since 1.0.0
|
|
42
|
-
* @category Layers
|
|
43
|
-
*/
|
|
44
|
-
export const layer = <const Storage extends "sql" | "noop" = never>(options: {
|
|
45
|
-
readonly transport: "http" | "websocket"
|
|
46
|
-
readonly serialization?: "msgpack" | "ndjson" | undefined
|
|
47
|
-
readonly shardingConfig?: Partial<ShardingConfig.ShardingConfig["Type"]> | undefined
|
|
48
|
-
readonly storage?: Storage | undefined
|
|
49
|
-
readonly config?: Partial<ShardManager.Config["Type"]> | undefined
|
|
50
|
-
}): Layer.Layer<
|
|
51
|
-
ShardManager.ShardManager,
|
|
52
|
-
ServeError | ConfigError | ("sql" extends Storage ? SqlError : never),
|
|
53
|
-
"sql" extends Storage ? SqlClient : never
|
|
54
|
-
> => {
|
|
55
|
-
const layer: Layer.Layer<any, any, any> = options.transport === "http" ?
|
|
56
|
-
HttpShardManager.layerHttp.pipe(
|
|
57
|
-
Layer.provide([HttpShardManager.layerRunnerHealthHttp, layerHttpServer]),
|
|
58
|
-
Layer.provide(FetchHttpClient.layer)
|
|
59
|
-
) :
|
|
60
|
-
HttpShardManager.layerWebsocket.pipe(
|
|
61
|
-
Layer.provide([HttpShardManager.layerRunnerHealthWebsocket, layerHttpServer]),
|
|
62
|
-
Layer.provide(BunSocket.layerWebSocketConstructor)
|
|
63
|
-
)
|
|
64
|
-
return layer.pipe(
|
|
65
|
-
Layer.provide(options?.storage === "sql" ? SqlShardStorage.layer : ShardStorage.layerNoop),
|
|
66
|
-
Layer.provide([
|
|
67
|
-
ShardingConfig.layerFromEnv(options.shardingConfig),
|
|
68
|
-
ShardManager.layerConfigFromEnv(options?.config),
|
|
69
|
-
options?.serialization === "ndjson" ? RpcSerialization.layerNdjson : RpcSerialization.layerMsgPack
|
|
70
|
-
])
|
|
71
|
-
)
|
|
72
|
-
}
|