@effect/platform-bun 4.0.0-beta.7 → 4.0.0-beta.70
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/dist/BunChildProcessSpawner.d.ts +1 -1
- package/dist/BunChildProcessSpawner.js +1 -1
- package/dist/BunClusterHttp.d.ts +46 -7
- package/dist/BunClusterHttp.d.ts.map +1 -1
- package/dist/BunClusterHttp.js +17 -10
- package/dist/BunClusterHttp.js.map +1 -1
- package/dist/BunClusterSocket.d.ts +54 -9
- package/dist/BunClusterSocket.d.ts.map +1 -1
- package/dist/BunClusterSocket.js +54 -9
- package/dist/BunClusterSocket.js.map +1 -1
- package/dist/BunCrypto.d.ts +10 -0
- package/dist/BunCrypto.d.ts.map +1 -0
- package/dist/BunCrypto.js +14 -0
- package/dist/BunCrypto.js.map +1 -0
- package/dist/BunFileSystem.d.ts +4 -2
- package/dist/BunFileSystem.d.ts.map +1 -1
- package/dist/BunFileSystem.js +27 -3
- package/dist/BunFileSystem.js.map +1 -1
- package/dist/BunHttpClient.d.ts +2 -2
- package/dist/BunHttpClient.js +2 -2
- package/dist/BunHttpPlatform.d.ts +4 -2
- package/dist/BunHttpPlatform.d.ts.map +1 -1
- package/dist/BunHttpPlatform.js +5 -3
- package/dist/BunHttpPlatform.js.map +1 -1
- package/dist/BunHttpServer.d.ts +77 -19
- package/dist/BunHttpServer.d.ts.map +1 -1
- package/dist/BunHttpServer.js +63 -36
- package/dist/BunHttpServer.js.map +1 -1
- package/dist/BunHttpServerRequest.d.ts +26 -2
- package/dist/BunHttpServerRequest.d.ts.map +1 -1
- package/dist/BunHttpServerRequest.js +3 -1
- package/dist/BunHttpServerRequest.js.map +1 -1
- package/dist/BunMultipart.d.ts +28 -5
- package/dist/BunMultipart.d.ts.map +1 -1
- package/dist/BunMultipart.js +15 -5
- package/dist/BunMultipart.js.map +1 -1
- package/dist/BunPath.d.ts +12 -6
- package/dist/BunPath.d.ts.map +1 -1
- package/dist/BunPath.js +30 -7
- package/dist/BunPath.js.map +1 -1
- package/dist/BunRedis.d.ts +39 -9
- package/dist/BunRedis.d.ts.map +1 -1
- package/dist/BunRedis.js +42 -12
- package/dist/BunRedis.js.map +1 -1
- package/dist/BunRuntime.d.ts +24 -30
- package/dist/BunRuntime.d.ts.map +1 -1
- package/dist/BunRuntime.js +25 -11
- package/dist/BunRuntime.js.map +1 -1
- package/dist/BunServices.d.ts +32 -5
- package/dist/BunServices.d.ts.map +1 -1
- package/dist/BunServices.js +7 -3
- package/dist/BunServices.js.map +1 -1
- package/dist/BunSink.d.ts +2 -2
- package/dist/BunSink.js +2 -2
- package/dist/BunSocket.d.ts +30 -4
- package/dist/BunSocket.d.ts.map +1 -1
- package/dist/BunSocket.js +10 -3
- package/dist/BunSocket.js.map +1 -1
- package/dist/BunSocketServer.d.ts +2 -2
- package/dist/BunSocketServer.js +2 -2
- package/dist/BunStdio.d.ts +5 -2
- package/dist/BunStdio.d.ts.map +1 -1
- package/dist/BunStdio.js +24 -3
- package/dist/BunStdio.js.map +1 -1
- package/dist/BunStream.d.ts +3 -2
- package/dist/BunStream.d.ts.map +1 -1
- package/dist/BunStream.js +25 -3
- package/dist/BunStream.js.map +1 -1
- package/dist/BunTerminal.d.ts +8 -2
- package/dist/BunTerminal.d.ts.map +1 -1
- package/dist/BunTerminal.js +23 -3
- package/dist/BunTerminal.js.map +1 -1
- package/dist/BunWorker.d.ts +9 -2
- package/dist/BunWorker.d.ts.map +1 -1
- package/dist/BunWorker.js +29 -4
- package/dist/BunWorker.js.map +1 -1
- package/dist/BunWorkerRunner.d.ts +5 -1
- package/dist/BunWorkerRunner.d.ts.map +1 -1
- package/dist/BunWorkerRunner.js +27 -5
- package/dist/BunWorkerRunner.js.map +1 -1
- package/dist/index.d.ts +396 -21
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +396 -21
- package/dist/index.js.map +1 -1
- package/package.json +5 -5
- package/src/BunChildProcessSpawner.ts +1 -1
- package/src/BunClusterHttp.ts +51 -11
- package/src/BunClusterSocket.ts +54 -9
- package/src/BunCrypto.ts +16 -0
- package/src/BunFileSystem.ts +27 -3
- package/src/BunHttpClient.ts +2 -2
- package/src/BunHttpPlatform.ts +28 -4
- package/src/BunHttpServer.ts +128 -56
- package/src/BunHttpServerRequest.ts +26 -2
- package/src/BunMultipart.ts +36 -6
- package/src/BunPath.ts +30 -7
- package/src/BunRedis.ts +44 -14
- package/src/BunRuntime.ts +41 -31
- package/src/BunServices.ts +34 -5
- package/src/BunSink.ts +2 -2
- package/src/BunSocket.ts +30 -4
- package/src/BunSocketServer.ts +2 -2
- package/src/BunStdio.ts +24 -3
- package/src/BunStream.ts +25 -3
- package/src/BunTerminal.ts +23 -3
- package/src/BunWorker.ts +29 -4
- package/src/BunWorkerRunner.ts +27 -5
- package/src/index.ts +397 -21
package/dist/BunClusterHttp.d.ts
CHANGED
|
@@ -1,5 +1,38 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
2
|
+
* The `BunClusterHttp` module provides the Bun HTTP and WebSocket transports
|
|
3
|
+
* for Effect Cluster runners. It wires `HttpRunner` to the Bun HTTP server,
|
|
4
|
+
* supplies Fetch and Bun WebSocket client protocols, and builds a complete
|
|
5
|
+
* sharding layer with serialization, runner health, runner storage, and message
|
|
6
|
+
* storage.
|
|
7
|
+
*
|
|
8
|
+
* **Common tasks**
|
|
9
|
+
*
|
|
10
|
+
* - Run a Bun process as a cluster runner over HTTP or WebSocket with
|
|
11
|
+
* {@link layer}
|
|
12
|
+
* - Connect a client-only process to an existing HTTP cluster without starting
|
|
13
|
+
* a runner server
|
|
14
|
+
* - Use SQL-backed storage for durable multi-process clusters, `local` storage
|
|
15
|
+
* for short-lived development, or `byo` storage when the deployment owns the
|
|
16
|
+
* persistence boundary
|
|
17
|
+
* - Check runner health with protocol pings or Kubernetes pod readiness through
|
|
18
|
+
* {@link layerK8sHttpClient}
|
|
19
|
+
*
|
|
20
|
+
* **Gotchas**
|
|
21
|
+
*
|
|
22
|
+
* - `runnerAddress` is the host and port advertised to other runners; set
|
|
23
|
+
* `runnerListenAddress` when the local bind address differs from the
|
|
24
|
+
* externally reachable address
|
|
25
|
+
* - The HTTP and WebSocket transports serve runner RPCs at the default
|
|
26
|
+
* `HttpRunner` route, so proxies and load balancers must preserve the path
|
|
27
|
+
* and allow WebSocket upgrades when `transport` is `"websocket"`
|
|
28
|
+
* - `clientOnly` does not start an HTTP server or receive shard assignments
|
|
29
|
+
* - SQL storage is the default; `local` storage is in-memory/noop and `byo`
|
|
30
|
+
* requires the surrounding application to provide both runner and message
|
|
31
|
+
* storage services
|
|
32
|
+
* - Ping health checks use the selected transport and serialization, so route,
|
|
33
|
+
* port, proxy, or codec mismatches can make a runner appear unhealthy
|
|
34
|
+
*
|
|
35
|
+
* @since 4.0.0
|
|
3
36
|
*/
|
|
4
37
|
import type * as Config from "effect/Config";
|
|
5
38
|
import * as Layer from "effect/Layer";
|
|
@@ -17,18 +50,24 @@ import { layerK8sHttpClient } from "./BunClusterSocket.ts";
|
|
|
17
50
|
import type { BunServices } from "./BunServices.ts";
|
|
18
51
|
export {
|
|
19
52
|
/**
|
|
20
|
-
*
|
|
21
|
-
*
|
|
53
|
+
* Kubernetes HTTP client layer used for runner health checks.
|
|
54
|
+
*
|
|
55
|
+
* @category re-exports
|
|
56
|
+
* @since 4.0.0
|
|
22
57
|
*/
|
|
23
58
|
layerK8sHttpClient };
|
|
24
59
|
/**
|
|
25
|
-
*
|
|
26
|
-
*
|
|
60
|
+
* Bun HTTP server layer for cluster runners, using `ShardingConfig.runnerListenAddress` or `runnerAddress` as the listen address.
|
|
61
|
+
*
|
|
62
|
+
* @category layers
|
|
63
|
+
* @since 4.0.0
|
|
27
64
|
*/
|
|
28
65
|
export declare const layerHttpServer: Layer.Layer<HttpPlatform | Etag.Generator | BunServices | HttpServer, ServeError, ShardingConfig.ShardingConfig>;
|
|
29
66
|
/**
|
|
30
|
-
*
|
|
31
|
-
*
|
|
67
|
+
* Creates Bun cluster layers for HTTP or WebSocket transport, configuring serialization, storage, runner health, and optional client-only mode.
|
|
68
|
+
*
|
|
69
|
+
* @category layers
|
|
70
|
+
* @since 4.0.0
|
|
32
71
|
*/
|
|
33
72
|
export declare const layer: <const ClientOnly extends boolean = false, const Storage extends "local" | "sql" | "byo" = never>(options: {
|
|
34
73
|
readonly transport: "http" | "websocket";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BunClusterHttp.d.ts","sourceRoot":"","sources":["../src/BunClusterHttp.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"BunClusterHttp.d.ts","sourceRoot":"","sources":["../src/BunClusterHttp.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmCG;AACH,OAAO,KAAK,KAAK,MAAM,MAAM,eAAe,CAAA;AAE5C,OAAO,KAAK,KAAK,MAAM,cAAc,CAAA;AAGrC,OAAO,KAAK,cAAc,MAAM,wCAAwC,CAAA;AAExE,OAAO,KAAK,OAAO,MAAM,iCAAiC,CAAA;AAC1D,OAAO,KAAK,aAAa,MAAM,uCAAuC,CAAA;AACtE,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,kCAAkC,CAAA;AAChE,OAAO,KAAK,cAAc,MAAM,wCAAwC,CAAA;AAGxE,OAAO,KAAK,KAAK,IAAI,MAAM,2BAA2B,CAAA;AAEtD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,mCAAmC,CAAA;AACrE,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iCAAiC,CAAA;AACjE,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,sCAAsC,CAAA;AAEtE,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,+BAA+B,CAAA;AAC9D,OAAO,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAA;AAG1D,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAA;AAGnD,OAAO;AACL;;;;;G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,OAAO,GAAG,CAAC,cAAc,CAAC,cAAc,GAAG,aAAa,CAAC,aAAa,CAAC,GACrF,SAAS,CACd,GACD,KAAK,CAAC,KAAK,CACT,QAAQ,GAAG,OAAO,CAAC,OAAO,GAAG,cAAc,CAAC,cAAc,EAC1D,UAAU,GAAG,MAAM,CAAC,WAAW,EAC/B,OAAO,SAAS,OAAO,GAAG,KAAK,GAC3B,KAAK,SAAS,OAAO,GAAG,CAAC,cAAc,CAAC,cAAc,GAAG,aAAa,CAAC,aAAa,CAAC,GACrF,SAAS,CAiDhB,CAAA"}
|
package/dist/BunClusterHttp.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import * as Effect from "effect/Effect";
|
|
2
2
|
import * as Layer from "effect/Layer";
|
|
3
|
+
import * as Option from "effect/Option";
|
|
3
4
|
import * as HttpRunner from "effect/unstable/cluster/HttpRunner";
|
|
4
5
|
import * as MessageStorage from "effect/unstable/cluster/MessageStorage";
|
|
5
6
|
import * as RunnerHealth from "effect/unstable/cluster/RunnerHealth";
|
|
@@ -16,25 +17,31 @@ import * as BunHttpServer from "./BunHttpServer.js";
|
|
|
16
17
|
import * as BunSocket from "./BunSocket.js";
|
|
17
18
|
export {
|
|
18
19
|
/**
|
|
19
|
-
*
|
|
20
|
-
*
|
|
20
|
+
* Kubernetes HTTP client layer used for runner health checks.
|
|
21
|
+
*
|
|
22
|
+
* @category re-exports
|
|
23
|
+
* @since 4.0.0
|
|
21
24
|
*/
|
|
22
25
|
layerK8sHttpClient };
|
|
23
26
|
/**
|
|
24
|
-
*
|
|
25
|
-
*
|
|
27
|
+
* Bun HTTP server layer for cluster runners, using `ShardingConfig.runnerListenAddress` or `runnerAddress` as the listen address.
|
|
28
|
+
*
|
|
29
|
+
* @category layers
|
|
30
|
+
* @since 4.0.0
|
|
26
31
|
*/
|
|
27
32
|
export const layerHttpServer = /*#__PURE__*/Effect.gen(function* () {
|
|
28
33
|
const config = yield* ShardingConfig.ShardingConfig;
|
|
29
|
-
const listenAddress = config.runnerListenAddress
|
|
30
|
-
if (listenAddress
|
|
31
|
-
return yield* Effect.die("BunClusterHttp.layerHttpServer: ShardingConfig.runnerAddress is
|
|
34
|
+
const listenAddress = Option.orElse(config.runnerListenAddress, () => config.runnerAddress);
|
|
35
|
+
if (Option.isNone(listenAddress)) {
|
|
36
|
+
return yield* Effect.die("BunClusterHttp.layerHttpServer: ShardingConfig.runnerAddress is None");
|
|
32
37
|
}
|
|
33
|
-
return BunHttpServer.layer(listenAddress);
|
|
38
|
+
return BunHttpServer.layer(listenAddress.value);
|
|
34
39
|
}).pipe(Layer.unwrap);
|
|
35
40
|
/**
|
|
36
|
-
*
|
|
37
|
-
*
|
|
41
|
+
* Creates Bun cluster layers for HTTP or WebSocket transport, configuring serialization, storage, runner health, and optional client-only mode.
|
|
42
|
+
*
|
|
43
|
+
* @category layers
|
|
44
|
+
* @since 4.0.0
|
|
38
45
|
*/
|
|
39
46
|
export const layer = options => {
|
|
40
47
|
const layer = options.clientOnly
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BunClusterHttp.js","names":["Effect","Layer","HttpRunner","MessageStorage","RunnerHealth","Runners","RunnerStorage","ShardingConfig","SqlMessageStorage","SqlRunnerStorage","FetchHttpClient","RpcSerialization","layerK8sHttpClient","BunFileSystem","BunHttpServer","BunSocket","layerHttpServer","gen","config","listenAddress","runnerListenAddress","runnerAddress","
|
|
1
|
+
{"version":3,"file":"BunClusterHttp.js","names":["Effect","Layer","Option","HttpRunner","MessageStorage","RunnerHealth","Runners","RunnerStorage","ShardingConfig","SqlMessageStorage","SqlRunnerStorage","FetchHttpClient","RpcSerialization","layerK8sHttpClient","BunFileSystem","BunHttpServer","BunSocket","layerHttpServer","gen","config","listenAddress","orElse","runnerListenAddress","runnerAddress","isNone","die","layer","value","pipe","unwrap","options","clientOnly","transport","provide","layerHttpClientOnly","layerWebsocketClientOnly","layerWebSocketConstructor","layerHttp","layerWebsocket","runnerHealth","empty","layerK8s","runnerHealthK8s","layerPing","layerRpc","layerClientProtocolHttpDefault","layerClientProtocolWebsocketDefault","provideMerge","storage","layerNoop","orDie","layerMemory","layerFromEnv","shardingConfig","serialization","layerNdjson","layerMsgPack"],"sources":["../src/BunClusterHttp.ts"],"sourcesContent":[null],"mappings":"AAqCA,OAAO,KAAKA,MAAM,MAAM,eAAe;AACvC,OAAO,KAAKC,KAAK,MAAM,cAAc;AACrC,OAAO,KAAKC,MAAM,MAAM,eAAe;AACvC,OAAO,KAAKC,UAAU,MAAM,oCAAoC;AAChE,OAAO,KAAKC,cAAc,MAAM,wCAAwC;AACxE,OAAO,KAAKC,YAAY,MAAM,sCAAsC;AACpE,OAAO,KAAKC,OAAO,MAAM,iCAAiC;AAC1D,OAAO,KAAKC,aAAa,MAAM,uCAAuC;AAEtE,OAAO,KAAKC,cAAc,MAAM,wCAAwC;AACxE,OAAO,KAAKC,iBAAiB,MAAM,2CAA2C;AAC9E,OAAO,KAAKC,gBAAgB,MAAM,0CAA0C;AAE5E,OAAO,KAAKC,eAAe,MAAM,sCAAsC;AAIvE,OAAO,KAAKC,gBAAgB,MAAM,sCAAsC;AAExE,SAASC,kBAAkB,QAAQ,uBAAuB;AAC1D,OAAO,KAAKC,aAAa,MAAM,oBAAoB;AACnD,OAAO,KAAKC,aAAa,MAAM,oBAAoB;AAEnD,OAAO,KAAKC,SAAS,MAAM,gBAAgB;AAE3C;AACE;;;;;;AAMAH,kBAAkB;AAGpB;;;;;;AAMA,OAAO,MAAMI,eAAe,gBAOxBjB,MAAM,CAACkB,GAAG,CAAC,aAAS;EACtB,MAAMC,MAAM,GAAG,OAAOX,cAAc,CAACA,cAAc;EACnD,MAAMY,aAAa,GAAGlB,MAAM,CAACmB,MAAM,CAACF,MAAM,CAACG,mBAAmB,EAAE,MAAMH,MAAM,CAACI,aAAa,CAAC;EAC3F,IAAIrB,MAAM,CAACsB,MAAM,CAACJ,aAAa,CAAC,EAAE;IAChC,OAAO,OAAOpB,MAAM,CAACy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8BAA8B,CAACjB,IAAI,CAAC3B,KAAK,CAACgC,OAAO,CAACtB,eAAe,CAACe,KAAK,CAAC,CAAC,GACpFvB,UAAU,CAAC2C,mCAAmC,CAAClB,IAAI,CAAC3B,KAAK,CAACgC,OAAO,CAACjB,SAAS,CAACoB,yBAAyB,CAAC,CAAC,CAC5G,CACF;EAEH,OAAOV,KAAK,CAACE,IAAI,CACf3B,KAAK,CAACgC,OAAO,CAACM,YAAY,CAAC,EAC3BtC,KAAK,CAAC8C,YAAY,CAChBjB,OAAO,EAAEkB,OAAO,KAAK,OAAO,GACxB5C,cAAc,CAAC6C,SAAS,GACxBnB,OAAO,EAAEkB,OAAO,KAAK,KAAK,GAC1B/C,KAAK,CAACuC,KAAK,GACXvC,KAAK,CAACiD,KAAK,CAACzC,iBAAiB,CAACiB,KAAK,CAAC,CACzC,EACDzB,KAAK,CAACgC,OAAO,CACXH,OAAO,EAAEkB,OAAO,KAAK,OAAO,GACxBzC,aAAa,CAAC4C,WAAW,GACzBrB,OAAO,EAAEkB,OAAO,KAAK,KAAK,GAC1B/C,KAAK,CAACuC,KAAK,GACXvC,KAAK,CAACiD,KAAK,CAACxC,gBAAgB,CAACgB,KAAK,CAAC,CACxC,EACDzB,KAAK,CAACgC,OAAO,CAACzB,cAAc,CAAC4C,YAAY,CAACtB,OAAO,EAAEuB,cAAc,CAAC,CAAC,EACnEpD,KAAK,CAACgC,OAAO,CACXH,OAAO,EAAEwB,aAAa,KAAK,QAAQ,GAAG1C,gBAAgB,CAAC2C,WAAW,GAAG3C,gBAAgB,CAAC4C,YAAY,CACnG,CACK;AACV,CAAC","ignoreList":[]}
|
|
@@ -1,5 +1,40 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
2
|
+
* The `BunClusterSocket` module provides the Bun socket transport for Effect
|
|
3
|
+
* Cluster runners. It wires `SocketRunner` to Bun-compatible TCP sockets,
|
|
4
|
+
* supplies RPC client and server protocol layers, and builds a complete
|
|
5
|
+
* sharding layer with serialization, runner health, runner storage, and message
|
|
6
|
+
* storage.
|
|
7
|
+
*
|
|
8
|
+
* **Common tasks**
|
|
9
|
+
*
|
|
10
|
+
* - Run a Bun process as a cluster runner over raw TCP sockets with
|
|
11
|
+
* {@link layer}
|
|
12
|
+
* - Connect a client-only process to an existing socket cluster without
|
|
13
|
+
* starting a runner server
|
|
14
|
+
* - Use SQL-backed storage for durable multi-process clusters, `local` storage
|
|
15
|
+
* for short-lived development, or `byo` storage when the deployment owns the
|
|
16
|
+
* persistence boundary
|
|
17
|
+
* - Check runner health with socket pings or Kubernetes pod readiness through
|
|
18
|
+
* {@link layerK8sHttpClient}
|
|
19
|
+
*
|
|
20
|
+
* **Gotchas**
|
|
21
|
+
*
|
|
22
|
+
* - `runnerAddress` is the host and port advertised to other runners; set
|
|
23
|
+
* `runnerListenAddress` when the local bind address differs from the
|
|
24
|
+
* externally reachable address
|
|
25
|
+
* - The socket transport is point-to-point RPC, not cluster gossip: runner
|
|
26
|
+
* membership, shard ownership, and persisted delivery are coordinated through
|
|
27
|
+
* `RunnerStorage`, `MessageStorage`, and `RunnerHealth`
|
|
28
|
+
* - `clientOnly` does not start a socket server or receive shard assignments
|
|
29
|
+
* - SQL storage is the default; `local` storage is in-memory/noop and `byo`
|
|
30
|
+
* requires the surrounding application to provide both runner and message
|
|
31
|
+
* storage services
|
|
32
|
+
* - Ping health checks use the same socket protocol, so unreachable ports,
|
|
33
|
+
* firewalls, or serialization mismatches can make a runner appear unhealthy
|
|
34
|
+
* - Kubernetes health checks use Bun's Fetch-backed HTTP client and the service
|
|
35
|
+
* account CA certificate when it is available
|
|
36
|
+
*
|
|
37
|
+
* @since 4.0.0
|
|
3
38
|
*/
|
|
4
39
|
import { layerClientProtocol, layerSocketServer } from "@effect/platform-node-shared/NodeClusterSocket";
|
|
5
40
|
import type * as Config from "effect/Config";
|
|
@@ -14,18 +49,26 @@ import type * as SocketServer from "effect/unstable/socket/SocketServer";
|
|
|
14
49
|
import type { SqlClient } from "effect/unstable/sql/SqlClient";
|
|
15
50
|
export {
|
|
16
51
|
/**
|
|
17
|
-
*
|
|
18
|
-
*
|
|
52
|
+
* Provides the cluster `RpcClientProtocol` using the shared socket client
|
|
53
|
+
* implementation.
|
|
54
|
+
*
|
|
55
|
+
* @category re-exports
|
|
56
|
+
* @since 4.0.0
|
|
19
57
|
*/
|
|
20
58
|
layerClientProtocol,
|
|
21
59
|
/**
|
|
22
|
-
*
|
|
23
|
-
*
|
|
60
|
+
* Provides the socket server used by Bun cluster runners through the shared
|
|
61
|
+
* socket server implementation.
|
|
62
|
+
*
|
|
63
|
+
* @category re-exports
|
|
64
|
+
* @since 4.0.0
|
|
24
65
|
*/
|
|
25
66
|
layerSocketServer };
|
|
26
67
|
/**
|
|
27
|
-
*
|
|
28
|
-
*
|
|
68
|
+
* Creates Bun socket cluster layers, configuring serialization, storage, runner health, and optional client-only mode.
|
|
69
|
+
*
|
|
70
|
+
* @category layers
|
|
71
|
+
* @since 4.0.0
|
|
29
72
|
*/
|
|
30
73
|
export declare const layer: <const ClientOnly extends boolean = false, const Storage extends "local" | "sql" | "byo" = never>(options?: {
|
|
31
74
|
readonly serialization?: "msgpack" | "ndjson" | undefined;
|
|
@@ -39,8 +82,10 @@ export declare const layer: <const ClientOnly extends boolean = false, const Sto
|
|
|
39
82
|
readonly shardingConfig?: Partial<ShardingConfig.ShardingConfig["Service"]> | undefined;
|
|
40
83
|
}) => ClientOnly extends true ? Layer.Layer<Sharding | Runners.Runners | ("byo" extends Storage ? never : MessageStorage.MessageStorage), Config.ConfigError, "local" extends Storage ? never : "byo" extends Storage ? (MessageStorage.MessageStorage | RunnerStorage.RunnerStorage) : SqlClient> : Layer.Layer<Sharding | Runners.Runners | ("byo" extends Storage ? never : MessageStorage.MessageStorage), SocketServer.SocketServerError | Config.ConfigError, "local" extends Storage ? never : "byo" extends Storage ? (MessageStorage.MessageStorage | RunnerStorage.RunnerStorage) : SqlClient>;
|
|
41
84
|
/**
|
|
42
|
-
*
|
|
43
|
-
*
|
|
85
|
+
* Layer that provides `K8sHttpClient`, using the Kubernetes service-account CA certificate when it is available.
|
|
86
|
+
*
|
|
87
|
+
* @category layers
|
|
88
|
+
* @since 4.0.0
|
|
44
89
|
*/
|
|
45
90
|
export declare const layerK8sHttpClient: Layer.Layer<K8sHttpClient.K8sHttpClient>;
|
|
46
91
|
//# sourceMappingURL=BunClusterSocket.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BunClusterSocket.d.ts","sourceRoot":"","sources":["../src/BunClusterSocket.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"BunClusterSocket.d.ts","sourceRoot":"","sources":["../src/BunClusterSocket.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqCG;AACH,OAAO,EAAE,mBAAmB,EAAE,iBAAiB,EAAE,MAAM,gDAAgD,CAAA;AACvG,OAAO,KAAK,KAAK,MAAM,MAAM,eAAe,CAAA;AAG5C,OAAO,KAAK,KAAK,MAAM,cAAc,CAAA;AACrC,OAAO,KAAK,aAAa,MAAM,uCAAuC,CAAA;AACtE,OAAO,KAAK,cAAc,MAAM,wCAAwC,CAAA;AAExE,OAAO,KAAK,OAAO,MAAM,iCAAiC,CAAA;AAC1D,OAAO,KAAK,aAAa,MAAM,uCAAuC,CAAA;AACtE,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,kCAAkC,CAAA;AAChE,OAAO,KAAK,cAAc,MAAM,wCAAwC,CAAA;AAMxE,OAAO,KAAK,KAAK,YAAY,MAAM,qCAAqC,CAAA;AACxE,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,+BAA+B,CAAA;AAG9D,OAAO;AACL;;;;;;GAMG;AACH,mBAAmB;AACnB;;;;;;GAMG;AACH,iBAAiB,EAClB,CAAA;AAED;;;;;GAKG;AACH,eAAO,MAAM,KAAK,GAChB,KAAK,CAAC,UAAU,SAAS,OAAO,GAAG,KAA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,cAAc,CAAC,cAAc,GAAG,aAAa,CAAC,aAAa,CAAC,GACrF,SAAS,CAyChB,CAAA;AAED;;;;;GAKG;AACH,eAAO,MAAM,kBAAkB,EAAE,KAAK,CAAC,KAAK,CAAC,aAAa,CAAC,aAAa,CAmBvE,CAAA"}
|
package/dist/BunClusterSocket.js
CHANGED
|
@@ -1,5 +1,40 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
2
|
+
* The `BunClusterSocket` module provides the Bun socket transport for Effect
|
|
3
|
+
* Cluster runners. It wires `SocketRunner` to Bun-compatible TCP sockets,
|
|
4
|
+
* supplies RPC client and server protocol layers, and builds a complete
|
|
5
|
+
* sharding layer with serialization, runner health, runner storage, and message
|
|
6
|
+
* storage.
|
|
7
|
+
*
|
|
8
|
+
* **Common tasks**
|
|
9
|
+
*
|
|
10
|
+
* - Run a Bun process as a cluster runner over raw TCP sockets with
|
|
11
|
+
* {@link layer}
|
|
12
|
+
* - Connect a client-only process to an existing socket cluster without
|
|
13
|
+
* starting a runner server
|
|
14
|
+
* - Use SQL-backed storage for durable multi-process clusters, `local` storage
|
|
15
|
+
* for short-lived development, or `byo` storage when the deployment owns the
|
|
16
|
+
* persistence boundary
|
|
17
|
+
* - Check runner health with socket pings or Kubernetes pod readiness through
|
|
18
|
+
* {@link layerK8sHttpClient}
|
|
19
|
+
*
|
|
20
|
+
* **Gotchas**
|
|
21
|
+
*
|
|
22
|
+
* - `runnerAddress` is the host and port advertised to other runners; set
|
|
23
|
+
* `runnerListenAddress` when the local bind address differs from the
|
|
24
|
+
* externally reachable address
|
|
25
|
+
* - The socket transport is point-to-point RPC, not cluster gossip: runner
|
|
26
|
+
* membership, shard ownership, and persisted delivery are coordinated through
|
|
27
|
+
* `RunnerStorage`, `MessageStorage`, and `RunnerHealth`
|
|
28
|
+
* - `clientOnly` does not start a socket server or receive shard assignments
|
|
29
|
+
* - SQL storage is the default; `local` storage is in-memory/noop and `byo`
|
|
30
|
+
* requires the surrounding application to provide both runner and message
|
|
31
|
+
* storage services
|
|
32
|
+
* - Ping health checks use the same socket protocol, so unreachable ports,
|
|
33
|
+
* firewalls, or serialization mismatches can make a runner appear unhealthy
|
|
34
|
+
* - Kubernetes health checks use Bun's Fetch-backed HTTP client and the service
|
|
35
|
+
* account CA certificate when it is available
|
|
36
|
+
*
|
|
37
|
+
* @since 4.0.0
|
|
3
38
|
*/
|
|
4
39
|
import { layerClientProtocol, layerSocketServer } from "@effect/platform-node-shared/NodeClusterSocket";
|
|
5
40
|
import * as Effect from "effect/Effect";
|
|
@@ -19,18 +54,26 @@ import * as RpcSerialization from "effect/unstable/rpc/RpcSerialization";
|
|
|
19
54
|
import * as BunFileSystem from "./BunFileSystem.js";
|
|
20
55
|
export {
|
|
21
56
|
/**
|
|
22
|
-
*
|
|
23
|
-
*
|
|
57
|
+
* Provides the cluster `RpcClientProtocol` using the shared socket client
|
|
58
|
+
* implementation.
|
|
59
|
+
*
|
|
60
|
+
* @category re-exports
|
|
61
|
+
* @since 4.0.0
|
|
24
62
|
*/
|
|
25
63
|
layerClientProtocol,
|
|
26
64
|
/**
|
|
27
|
-
*
|
|
28
|
-
*
|
|
65
|
+
* Provides the socket server used by Bun cluster runners through the shared
|
|
66
|
+
* socket server implementation.
|
|
67
|
+
*
|
|
68
|
+
* @category re-exports
|
|
69
|
+
* @since 4.0.0
|
|
29
70
|
*/
|
|
30
71
|
layerSocketServer };
|
|
31
72
|
/**
|
|
32
|
-
*
|
|
33
|
-
*
|
|
73
|
+
* Creates Bun socket cluster layers, configuring serialization, storage, runner health, and optional client-only mode.
|
|
74
|
+
*
|
|
75
|
+
* @category layers
|
|
76
|
+
* @since 4.0.0
|
|
34
77
|
*/
|
|
35
78
|
export const layer = options => {
|
|
36
79
|
const layer = options?.clientOnly
|
|
@@ -42,8 +85,10 @@ export const layer = options => {
|
|
|
42
85
|
return layer.pipe(Layer.provide(runnerHealth), Layer.provideMerge(options?.storage === "local" ? MessageStorage.layerNoop : options?.storage === "byo" ? Layer.empty : Layer.orDie(SqlMessageStorage.layer)), Layer.provide(options?.storage === "local" ? RunnerStorage.layerMemory : options?.storage === "byo" ? Layer.empty : Layer.orDie(SqlRunnerStorage.layer)), Layer.provide(ShardingConfig.layerFromEnv(options?.shardingConfig)), Layer.provide(options?.serialization === "ndjson" ? RpcSerialization.layerNdjson : RpcSerialization.layerMsgPack));
|
|
43
86
|
};
|
|
44
87
|
/**
|
|
45
|
-
*
|
|
46
|
-
*
|
|
88
|
+
* Layer that provides `K8sHttpClient`, using the Kubernetes service-account CA certificate when it is available.
|
|
89
|
+
*
|
|
90
|
+
* @category layers
|
|
91
|
+
* @since 4.0.0
|
|
47
92
|
*/
|
|
48
93
|
export const layerK8sHttpClient = /*#__PURE__*/K8sHttpClient.layer.pipe(/*#__PURE__*/Layer.provide(/*#__PURE__*/Layer.unwrap(/*#__PURE__*/Effect.gen(function* () {
|
|
49
94
|
const fs = yield* FileSystem.FileSystem;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BunClusterSocket.js","names":["layerClientProtocol","layerSocketServer","Effect","FileSystem","Layer","K8sHttpClient","MessageStorage","RunnerHealth","Runners","RunnerStorage","ShardingConfig","SocketRunner","SqlMessageStorage","SqlRunnerStorage","FetchHttpClient","RpcSerialization","BunFileSystem","layer","options","clientOnly","provide","layerClientOnly","runnerHealth","empty","layerK8s","runnerHealthK8s","pipe","layerK8sHttpClient","layerPing","layerRpc","provideMerge","storage","layerNoop","orDie","layerMemory","layerFromEnv","shardingConfig","serialization","layerNdjson","layerMsgPack","unwrap","gen","fs","caCertOption","readFile","option","_tag","fresh","succeed","RequestInit","tls","ca","value"],"sources":["../src/BunClusterSocket.ts"],"sourcesContent":[null],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"BunClusterSocket.js","names":["layerClientProtocol","layerSocketServer","Effect","FileSystem","Layer","K8sHttpClient","MessageStorage","RunnerHealth","Runners","RunnerStorage","ShardingConfig","SocketRunner","SqlMessageStorage","SqlRunnerStorage","FetchHttpClient","RpcSerialization","BunFileSystem","layer","options","clientOnly","provide","layerClientOnly","runnerHealth","empty","layerK8s","runnerHealthK8s","pipe","layerK8sHttpClient","layerPing","layerRpc","provideMerge","storage","layerNoop","orDie","layerMemory","layerFromEnv","shardingConfig","serialization","layerNdjson","layerMsgPack","unwrap","gen","fs","caCertOption","readFile","option","_tag","fresh","succeed","RequestInit","tls","ca","value"],"sources":["../src/BunClusterSocket.ts"],"sourcesContent":[null],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAsCA,SAASA,mBAAmB,EAAEC,iBAAiB,QAAQ,gDAAgD;AAEvG,OAAO,KAAKC,MAAM,MAAM,eAAe;AACvC,OAAO,KAAKC,UAAU,MAAM,mBAAmB;AAC/C,OAAO,KAAKC,KAAK,MAAM,cAAc;AACrC,OAAO,KAAKC,aAAa,MAAM,uCAAuC;AACtE,OAAO,KAAKC,cAAc,MAAM,wCAAwC;AACxE,OAAO,KAAKC,YAAY,MAAM,sCAAsC;AACpE,OAAO,KAAKC,OAAO,MAAM,iCAAiC;AAC1D,OAAO,KAAKC,aAAa,MAAM,uCAAuC;AAEtE,OAAO,KAAKC,cAAc,MAAM,wCAAwC;AACxE,OAAO,KAAKC,YAAY,MAAM,sCAAsC;AACpE,OAAO,KAAKC,iBAAiB,MAAM,2CAA2C;AAC9E,OAAO,KAAKC,gBAAgB,MAAM,0CAA0C;AAC5E,OAAO,KAAKC,eAAe,MAAM,sCAAsC;AACvE,OAAO,KAAKC,gBAAgB,MAAM,sCAAsC;AAGxE,OAAO,KAAKC,aAAa,MAAM,oBAAoB;AAEnD;AACE;;;;;;;AAOAhB,mBAAmB;AACnB;;;;;;;AAOAC,iBAAiB;AAGnB;;;;;;AAMA,OAAO,MAAMgB,KAAK,GAIhBC,OAUC,IAcG;EAEJ,MAAMD,KAAK,GAA+BC,OAAO,EAAEC;EACjD;EAAA,EACEf,KAAK,CAACgB,OAAO,CAACT,YAAY,CA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OAAO,EAAEmB,aAAa,KAAK,QAAQ,GAAGtB,gBAAgB,CAACuB,WAAW,GAAGvB,gBAAgB,CAACwB,YAAY,CACnG,CACK;AACV,CAAC;AAED;;;;;;AAMA,OAAO,MAAMZ,kBAAkB,gBAA6CtB,aAAa,CAACY,KAAK,CAACS,IAAI,cAClGtB,KAAK,CAACgB,OAAO,cAAChB,KAAK,CAACoC,MAAM,cAACtC,MAAM,CAACuC,GAAG,CAAC,aAAS;EAC7C,MAAMC,EAAE,GAAG,OAAOvC,UAAU,CAACA,UAAU;EACvC,MAAMwC,YAAY,GAAG,OAAOD,EAAE,CAACE,QAAQ,CAAC,sDAAsD,CAAC,CAAClB,IAAI,CAClGxB,MAAM,CAAC2C,MAAM,CACd;EACD,IAAIF,YAAY,CAACG,IAAI,KAAK,MAAM,EAAE;IAChC,OAAOhC,eAAe,CAACG,KAAK;EAC9B;EAEA,OAAOb,KAAK,CAAC2C,KAAK,CAACjC,eAAe,CAACG,KAAK,CAAC,CAACS,IAAI,CAC5CtB,KAAK,CAACgB,OAAO,CAAChB,KAAK,CAAC4C,OAAO,CAAClC,eAAe,CAACmC,WAAW,EAAE;IACvDC,GAAG,EAAE;MACHC,EAAE,EAAER,YAAY,CAACS;;GAEb,CAAC,CAAC,CACX;AACH,CAAC,CAAC,CAAC,CAAC,eACJhD,KAAK,CAACgB,OAAO,CAACJ,aAAa,CAACC,KAAK,CAAC,CACnC","ignoreList":[]}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type * as Crypto from "effect/Crypto";
|
|
2
|
+
import type * as Layer from "effect/Layer";
|
|
3
|
+
/**
|
|
4
|
+
* A layer that provides the Bun Crypto service implementation.
|
|
5
|
+
*
|
|
6
|
+
* @category layers
|
|
7
|
+
* @since 1.0.0
|
|
8
|
+
*/
|
|
9
|
+
export declare const layer: Layer.Layer<Crypto.Crypto>;
|
|
10
|
+
//# sourceMappingURL=BunCrypto.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"BunCrypto.d.ts","sourceRoot":"","sources":["../src/BunCrypto.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,KAAK,MAAM,MAAM,eAAe,CAAA;AAC5C,OAAO,KAAK,KAAK,KAAK,MAAM,cAAc,CAAA;AAE1C;;;;;GAKG;AACH,eAAO,MAAM,KAAK,EAAE,KAAK,CAAC,KAAK,CAAC,MAAM,CAAC,MAAM,CAAoB,CAAA"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Bun platform Crypto service layer.
|
|
3
|
+
*
|
|
4
|
+
* @since 1.0.0
|
|
5
|
+
*/
|
|
6
|
+
import * as NodeCrypto from "@effect/platform-node-shared/NodeCrypto";
|
|
7
|
+
/**
|
|
8
|
+
* A layer that provides the Bun Crypto service implementation.
|
|
9
|
+
*
|
|
10
|
+
* @category layers
|
|
11
|
+
* @since 1.0.0
|
|
12
|
+
*/
|
|
13
|
+
export const layer = NodeCrypto.layer;
|
|
14
|
+
//# sourceMappingURL=BunCrypto.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"BunCrypto.js","names":["NodeCrypto","layer"],"sources":["../src/BunCrypto.ts"],"sourcesContent":[null],"mappings":"AAAA;;;;;AAKA,OAAO,KAAKA,UAAU,MAAM,yCAAyC;AAIrE;;;;;;AAMA,OAAO,MAAMC,KAAK,GAA+BD,UAAU,CAACC,KAAK","ignoreList":[]}
|
package/dist/BunFileSystem.d.ts
CHANGED
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
import type { FileSystem } from "effect/FileSystem";
|
|
2
2
|
import type * as Layer from "effect/Layer";
|
|
3
3
|
/**
|
|
4
|
-
*
|
|
5
|
-
*
|
|
4
|
+
* Layer that provides the `FileSystem` service for Bun using the shared Node file-system implementation.
|
|
5
|
+
*
|
|
6
|
+
* @category layers
|
|
7
|
+
* @since 4.0.0
|
|
6
8
|
*/
|
|
7
9
|
export declare const layer: Layer.Layer<FileSystem, never, never>;
|
|
8
10
|
//# sourceMappingURL=BunFileSystem.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BunFileSystem.d.ts","sourceRoot":"","sources":["../src/BunFileSystem.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"BunFileSystem.d.ts","sourceRoot":"","sources":["../src/BunFileSystem.ts"],"names":[],"mappings":"AA0BA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAA;AACnD,OAAO,KAAK,KAAK,KAAK,MAAM,cAAc,CAAA;AAE1C;;;;;GAKG;AACH,eAAO,MAAM,KAAK,EAAE,KAAK,CAAC,KAAK,CAAC,UAAU,EAAE,KAAK,EAAE,KAAK,CAAwB,CAAA"}
|
package/dist/BunFileSystem.js
CHANGED
|
@@ -1,10 +1,34 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
2
|
+
* Bun layer for Effect's `FileSystem` service.
|
|
3
|
+
*
|
|
4
|
+
* Use this module at the edge of Bun applications, CLIs, scripts, and tests
|
|
5
|
+
* that need real local filesystem access through `effect/FileSystem`: reading
|
|
6
|
+
* and writing files, creating directories and temporary files, inspecting
|
|
7
|
+
* metadata, managing links, or watching paths for changes. It exposes only the
|
|
8
|
+
* Bun `FileSystem` layer; the operations themselves are accessed from the
|
|
9
|
+
* `FileSystem` service once the layer is provided, or from `BunServices.layer`
|
|
10
|
+
* when the program also needs the standard Bun path, stdio, terminal, and child
|
|
11
|
+
* process services.
|
|
12
|
+
*
|
|
13
|
+
* Bun supports Node-compatible filesystem APIs, so this layer reuses the shared
|
|
14
|
+
* Node filesystem implementation. Paths therefore follow the current process and
|
|
15
|
+
* host platform rules: relative paths are resolved from the current working
|
|
16
|
+
* directory, separators and drive/UNC behavior are platform-dependent, and
|
|
17
|
+
* request URLs should be decoded and validated before being mapped to local
|
|
18
|
+
* paths. The service works with bytes, scoped file handles, and Effect
|
|
19
|
+
* streams/sinks; use `FileSystem.stream` for large files instead of
|
|
20
|
+
* `readFile`, and remember that stream offsets and lengths are byte positions.
|
|
21
|
+
* Bun `File` and `Blob` values are not filesystem handles here; path-based HTTP
|
|
22
|
+
* file responses are handled by the Bun HTTP platform adapter with `Bun.file`.
|
|
23
|
+
*
|
|
24
|
+
* @since 4.0.0
|
|
3
25
|
*/
|
|
4
26
|
import * as NodeFileSystem from "@effect/platform-node-shared/NodeFileSystem";
|
|
5
27
|
/**
|
|
6
|
-
*
|
|
7
|
-
*
|
|
28
|
+
* Layer that provides the `FileSystem` service for Bun using the shared Node file-system implementation.
|
|
29
|
+
*
|
|
30
|
+
* @category layers
|
|
31
|
+
* @since 4.0.0
|
|
8
32
|
*/
|
|
9
33
|
export const layer = NodeFileSystem.layer;
|
|
10
34
|
//# sourceMappingURL=BunFileSystem.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BunFileSystem.js","names":["NodeFileSystem","layer"],"sources":["../src/BunFileSystem.ts"],"sourcesContent":[null],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"BunFileSystem.js","names":["NodeFileSystem","layer"],"sources":["../src/BunFileSystem.ts"],"sourcesContent":[null],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;AAyBA,OAAO,KAAKA,cAAc,MAAM,6CAA6C;AAI7E;;;;;;AAMA,OAAO,MAAMC,KAAK,GAA0CD,cAAc,CAACC,KAAK","ignoreList":[]}
|
package/dist/BunHttpClient.d.ts
CHANGED
package/dist/BunHttpClient.js
CHANGED
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
import * as Layer from "effect/Layer";
|
|
2
2
|
import * as Platform from "effect/unstable/http/HttpPlatform";
|
|
3
3
|
/**
|
|
4
|
-
*
|
|
5
|
-
*
|
|
4
|
+
* Layer that provides the Bun `HttpPlatform`, including file responses backed by `Bun.file`.
|
|
5
|
+
*
|
|
6
|
+
* @category layers
|
|
7
|
+
* @since 4.0.0
|
|
6
8
|
*/
|
|
7
9
|
export declare const layer: Layer.Layer<Platform.HttpPlatform, never, never>;
|
|
8
10
|
//# sourceMappingURL=BunHttpPlatform.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BunHttpPlatform.d.ts","sourceRoot":"","sources":["../src/BunHttpPlatform.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"BunHttpPlatform.d.ts","sourceRoot":"","sources":["../src/BunHttpPlatform.ts"],"names":[],"mappings":"AA2BA,OAAO,KAAK,KAAK,MAAM,cAAc,CAAA;AAErC,OAAO,KAAK,QAAQ,MAAM,mCAAmC,CAAA;AAyB7D;;;;;GAKG;AACH,eAAO,MAAM,KAAK,kDAGjB,CAAA"}
|
package/dist/BunHttpPlatform.js
CHANGED
|
@@ -4,8 +4,8 @@ import * as Platform from "effect/unstable/http/HttpPlatform";
|
|
|
4
4
|
import * as Response from "effect/unstable/http/HttpServerResponse";
|
|
5
5
|
import * as BunFileSystem from "./BunFileSystem.js";
|
|
6
6
|
/**
|
|
7
|
-
* @since 1.0.0
|
|
8
7
|
* @category constructors
|
|
8
|
+
* @since 4.0.0
|
|
9
9
|
*/
|
|
10
10
|
const make = /*#__PURE__*/Platform.make({
|
|
11
11
|
fileResponse(path, status, statusText, headers, start, end, _contentLength) {
|
|
@@ -28,8 +28,10 @@ const make = /*#__PURE__*/Platform.make({
|
|
|
28
28
|
}
|
|
29
29
|
});
|
|
30
30
|
/**
|
|
31
|
-
*
|
|
32
|
-
*
|
|
31
|
+
* Layer that provides the Bun `HttpPlatform`, including file responses backed by `Bun.file`.
|
|
32
|
+
*
|
|
33
|
+
* @category layers
|
|
34
|
+
* @since 4.0.0
|
|
33
35
|
*/
|
|
34
36
|
export const layer = /*#__PURE__*/Layer.effect(Platform.HttpPlatform)(make).pipe(/*#__PURE__*/Layer.provide(BunFileSystem.layer), /*#__PURE__*/Layer.provide(Etag.layer));
|
|
35
37
|
//# sourceMappingURL=BunHttpPlatform.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BunHttpPlatform.js","names":["Layer","Etag","Platform","Response","BunFileSystem","make","fileResponse","path","status","statusText","headers","start","end","_contentLength","file","Bun","undefined","slice","raw","fileWebResponse","_options","layer","effect","HttpPlatform","pipe","provide"],"sources":["../src/BunHttpPlatform.ts"],"sourcesContent":[null],"mappings":"
|
|
1
|
+
{"version":3,"file":"BunHttpPlatform.js","names":["Layer","Etag","Platform","Response","BunFileSystem","make","fileResponse","path","status","statusText","headers","start","end","_contentLength","file","Bun","undefined","slice","raw","fileWebResponse","_options","layer","effect","HttpPlatform","pipe","provide"],"sources":["../src/BunHttpPlatform.ts"],"sourcesContent":[null],"mappings":"AA2BA,OAAO,KAAKA,KAAK,MAAM,cAAc;AACrC,OAAO,KAAKC,IAAI,MAAM,2BAA2B;AACjD,OAAO,KAAKC,QAAQ,MAAM,mCAAmC;AAC7D,OAAO,KAAKC,QAAQ,MAAM,yCAAyC;AACnE,OAAO,KAAKC,aAAa,MAAM,oBAAoB;AAEnD;;;;AAIA,MAAMC,IAAI,gBAINH,QAAQ,CAACG,IAAI,CAAC;EAChBC,YAAYA,CAACC,IAAI,EAAEC,MAAM,EAAEC,UAAU,EAAEC,OAAO,EAAEC,KAAK,EAAEC,GAAG,EAAEC,cAAc;IACxE,IAAIC,IAAI,GAAGC,GAAG,CAACD,IAAI,CAACP,IAAI,CAAC;IACzB,IAAII,KAAK,GAAG,CAAC,IAAIC,GAAG,KAAKI,SAAS,EAAE;MAClCF,IAAI,GAAGA,IAAI,CAACG,KAAK,CAACN,KAAK,EAAEC,GAAG,CAAC;IAC/B;IACA,OAAOT,QAAQ,CAACe,GAAG,CAACJ,IAAI,EAAE;MAAEJ,OAAO;MAAEF,MAAM;MAAEC;IAAU,CAAE,CAAC;EAC5D,CAAC;EACDU,eAAeA,CAACL,IAAI,EAAEN,MAAM,EAAEC,UAAU,EAAEC,OAAO,EAAEU,QAAQ;IACzD,OAAOjB,QAAQ,CAACe,GAAG,CAACJ,IAAI,EAAE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