@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.
Files changed (108) hide show
  1. package/dist/BunChildProcessSpawner.d.ts +1 -1
  2. package/dist/BunChildProcessSpawner.js +1 -1
  3. package/dist/BunClusterHttp.d.ts +46 -7
  4. package/dist/BunClusterHttp.d.ts.map +1 -1
  5. package/dist/BunClusterHttp.js +17 -10
  6. package/dist/BunClusterHttp.js.map +1 -1
  7. package/dist/BunClusterSocket.d.ts +54 -9
  8. package/dist/BunClusterSocket.d.ts.map +1 -1
  9. package/dist/BunClusterSocket.js +54 -9
  10. package/dist/BunClusterSocket.js.map +1 -1
  11. package/dist/BunCrypto.d.ts +10 -0
  12. package/dist/BunCrypto.d.ts.map +1 -0
  13. package/dist/BunCrypto.js +14 -0
  14. package/dist/BunCrypto.js.map +1 -0
  15. package/dist/BunFileSystem.d.ts +4 -2
  16. package/dist/BunFileSystem.d.ts.map +1 -1
  17. package/dist/BunFileSystem.js +27 -3
  18. package/dist/BunFileSystem.js.map +1 -1
  19. package/dist/BunHttpClient.d.ts +2 -2
  20. package/dist/BunHttpClient.js +2 -2
  21. package/dist/BunHttpPlatform.d.ts +4 -2
  22. package/dist/BunHttpPlatform.d.ts.map +1 -1
  23. package/dist/BunHttpPlatform.js +5 -3
  24. package/dist/BunHttpPlatform.js.map +1 -1
  25. package/dist/BunHttpServer.d.ts +77 -19
  26. package/dist/BunHttpServer.d.ts.map +1 -1
  27. package/dist/BunHttpServer.js +63 -36
  28. package/dist/BunHttpServer.js.map +1 -1
  29. package/dist/BunHttpServerRequest.d.ts +26 -2
  30. package/dist/BunHttpServerRequest.d.ts.map +1 -1
  31. package/dist/BunHttpServerRequest.js +3 -1
  32. package/dist/BunHttpServerRequest.js.map +1 -1
  33. package/dist/BunMultipart.d.ts +28 -5
  34. package/dist/BunMultipart.d.ts.map +1 -1
  35. package/dist/BunMultipart.js +15 -5
  36. package/dist/BunMultipart.js.map +1 -1
  37. package/dist/BunPath.d.ts +12 -6
  38. package/dist/BunPath.d.ts.map +1 -1
  39. package/dist/BunPath.js +30 -7
  40. package/dist/BunPath.js.map +1 -1
  41. package/dist/BunRedis.d.ts +39 -9
  42. package/dist/BunRedis.d.ts.map +1 -1
  43. package/dist/BunRedis.js +42 -12
  44. package/dist/BunRedis.js.map +1 -1
  45. package/dist/BunRuntime.d.ts +24 -30
  46. package/dist/BunRuntime.d.ts.map +1 -1
  47. package/dist/BunRuntime.js +25 -11
  48. package/dist/BunRuntime.js.map +1 -1
  49. package/dist/BunServices.d.ts +32 -5
  50. package/dist/BunServices.d.ts.map +1 -1
  51. package/dist/BunServices.js +7 -3
  52. package/dist/BunServices.js.map +1 -1
  53. package/dist/BunSink.d.ts +2 -2
  54. package/dist/BunSink.js +2 -2
  55. package/dist/BunSocket.d.ts +30 -4
  56. package/dist/BunSocket.d.ts.map +1 -1
  57. package/dist/BunSocket.js +10 -3
  58. package/dist/BunSocket.js.map +1 -1
  59. package/dist/BunSocketServer.d.ts +2 -2
  60. package/dist/BunSocketServer.js +2 -2
  61. package/dist/BunStdio.d.ts +5 -2
  62. package/dist/BunStdio.d.ts.map +1 -1
  63. package/dist/BunStdio.js +24 -3
  64. package/dist/BunStdio.js.map +1 -1
  65. package/dist/BunStream.d.ts +3 -2
  66. package/dist/BunStream.d.ts.map +1 -1
  67. package/dist/BunStream.js +25 -3
  68. package/dist/BunStream.js.map +1 -1
  69. package/dist/BunTerminal.d.ts +8 -2
  70. package/dist/BunTerminal.d.ts.map +1 -1
  71. package/dist/BunTerminal.js +23 -3
  72. package/dist/BunTerminal.js.map +1 -1
  73. package/dist/BunWorker.d.ts +9 -2
  74. package/dist/BunWorker.d.ts.map +1 -1
  75. package/dist/BunWorker.js +29 -4
  76. package/dist/BunWorker.js.map +1 -1
  77. package/dist/BunWorkerRunner.d.ts +5 -1
  78. package/dist/BunWorkerRunner.d.ts.map +1 -1
  79. package/dist/BunWorkerRunner.js +27 -5
  80. package/dist/BunWorkerRunner.js.map +1 -1
  81. package/dist/index.d.ts +396 -21
  82. package/dist/index.d.ts.map +1 -1
  83. package/dist/index.js +396 -21
  84. package/dist/index.js.map +1 -1
  85. package/package.json +5 -5
  86. package/src/BunChildProcessSpawner.ts +1 -1
  87. package/src/BunClusterHttp.ts +51 -11
  88. package/src/BunClusterSocket.ts +54 -9
  89. package/src/BunCrypto.ts +16 -0
  90. package/src/BunFileSystem.ts +27 -3
  91. package/src/BunHttpClient.ts +2 -2
  92. package/src/BunHttpPlatform.ts +28 -4
  93. package/src/BunHttpServer.ts +128 -56
  94. package/src/BunHttpServerRequest.ts +26 -2
  95. package/src/BunMultipart.ts +36 -6
  96. package/src/BunPath.ts +30 -7
  97. package/src/BunRedis.ts +44 -14
  98. package/src/BunRuntime.ts +41 -31
  99. package/src/BunServices.ts +34 -5
  100. package/src/BunSink.ts +2 -2
  101. package/src/BunSocket.ts +30 -4
  102. package/src/BunSocketServer.ts +2 -2
  103. package/src/BunStdio.ts +24 -3
  104. package/src/BunStream.ts +25 -3
  105. package/src/BunTerminal.ts +23 -3
  106. package/src/BunWorker.ts +29 -4
  107. package/src/BunWorkerRunner.ts +27 -5
  108. package/src/index.ts +397 -21
package/dist/BunPath.d.ts CHANGED
@@ -1,18 +1,24 @@
1
1
  import type * as Layer from "effect/Layer";
2
2
  import type { Path } from "effect/Path";
3
3
  /**
4
- * @since 1.0.0
5
- * @category layer
4
+ * Layer that provides the default `Path` service for Bun using the shared Node path implementation.
5
+ *
6
+ * @category layers
7
+ * @since 4.0.0
6
8
  */
7
9
  export declare const layer: Layer.Layer<Path>;
8
10
  /**
9
- * @since 1.0.0
10
- * @category layer
11
+ * Layer that provides the POSIX `Path` service for Bun using the shared Node path implementation.
12
+ *
13
+ * @category layers
14
+ * @since 4.0.0
11
15
  */
12
16
  export declare const layerPosix: Layer.Layer<Path>;
13
17
  /**
14
- * @since 1.0.0
15
- * @category layer
18
+ * Layer that provides the Win32 `Path` service for Bun using the shared Node path implementation.
19
+ *
20
+ * @category layers
21
+ * @since 4.0.0
16
22
  */
17
23
  export declare const layerWin32: Layer.Layer<Path>;
18
24
  //# sourceMappingURL=BunPath.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"BunPath.d.ts","sourceRoot":"","sources":["../src/BunPath.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,KAAK,KAAK,MAAM,cAAc,CAAA;AAC1C,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,aAAa,CAAA;AAEvC;;;GAGG;AACH,eAAO,MAAM,KAAK,EAAE,KAAK,CAAC,KAAK,CAAC,IAAI,CAAkB,CAAA;AAEtD;;;GAGG;AACH,eAAO,MAAM,UAAU,EAAE,KAAK,CAAC,KAAK,CAAC,IAAI,CAAuB,CAAA;AAEhE;;;GAGG;AACH,eAAO,MAAM,UAAU,EAAE,KAAK,CAAC,KAAK,CAAC,IAAI,CAAuB,CAAA"}
1
+ {"version":3,"file":"BunPath.d.ts","sourceRoot":"","sources":["../src/BunPath.ts"],"names":[],"mappings":"AAqBA,OAAO,KAAK,KAAK,KAAK,MAAM,cAAc,CAAA;AAC1C,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,aAAa,CAAA;AAEvC;;;;;GAKG;AACH,eAAO,MAAM,KAAK,EAAE,KAAK,CAAC,KAAK,CAAC,IAAI,CAAkB,CAAA;AAEtD;;;;;GAKG;AACH,eAAO,MAAM,UAAU,EAAE,KAAK,CAAC,KAAK,CAAC,IAAI,CAAuB,CAAA;AAEhE;;;;;GAKG;AACH,eAAO,MAAM,UAAU,EAAE,KAAK,CAAC,KAAK,CAAC,IAAI,CAAuB,CAAA"}
package/dist/BunPath.js CHANGED
@@ -1,20 +1,43 @@
1
1
  /**
2
- * @since 1.0.0
2
+ * Bun layers for Effect's `Path` service.
3
+ *
4
+ * Use this module when an Effect program running on Bun needs path
5
+ * manipulation from the `Path` service, such as joining and normalizing local
6
+ * filesystem locations, resolving configuration or static asset paths, handling
7
+ * CLI path arguments, or converting between filesystem paths and `file:` URLs.
8
+ *
9
+ * Bun exposes Node-compatible path behavior, so these layers reuse the shared
10
+ * Node path implementation. The default `layer` follows the host operating
11
+ * system's path rules, including separators, absolute paths, drive letters, and
12
+ * UNC paths where applicable. Use `layerPosix` or `layerWin32` when code needs
13
+ * stable POSIX or Windows semantics regardless of where Bun is running. These
14
+ * layers only manipulate path strings; they do not read the filesystem, validate
15
+ * that paths exist, or turn request URLs into safe local paths. `BunServices`
16
+ * already includes the default Bun path layer, so provide this module directly
17
+ * when you need only `Path` or one of the platform-specific variants.
18
+ *
19
+ * @since 4.0.0
3
20
  */
4
21
  import * as NodePath from "@effect/platform-node-shared/NodePath";
5
22
  /**
6
- * @since 1.0.0
7
- * @category layer
23
+ * Layer that provides the default `Path` service for Bun using the shared Node path implementation.
24
+ *
25
+ * @category layers
26
+ * @since 4.0.0
8
27
  */
9
28
  export const layer = NodePath.layer;
10
29
  /**
11
- * @since 1.0.0
12
- * @category layer
30
+ * Layer that provides the POSIX `Path` service for Bun using the shared Node path implementation.
31
+ *
32
+ * @category layers
33
+ * @since 4.0.0
13
34
  */
14
35
  export const layerPosix = NodePath.layerPosix;
15
36
  /**
16
- * @since 1.0.0
17
- * @category layer
37
+ * Layer that provides the Win32 `Path` service for Bun using the shared Node path implementation.
38
+ *
39
+ * @category layers
40
+ * @since 4.0.0
18
41
  */
19
42
  export const layerWin32 = NodePath.layerWin32;
20
43
  //# sourceMappingURL=BunPath.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"BunPath.js","names":["NodePath","layer","layerPosix","layerWin32"],"sources":["../src/BunPath.ts"],"sourcesContent":[null],"mappings":"AAAA;;;AAGA,OAAO,KAAKA,QAAQ,MAAM,uCAAuC;AAIjE;;;;AAIA,OAAO,MAAMC,KAAK,GAAsBD,QAAQ,CAACC,KAAK;AAEtD;;;;AAIA,OAAO,MAAMC,UAAU,GAAsBF,QAAQ,CAACE,UAAU;AAEhE;;;;AAIA,OAAO,MAAMC,UAAU,GAAsBH,QAAQ,CAACG,UAAU","ignoreList":[]}
1
+ {"version":3,"file":"BunPath.js","names":["NodePath","layer","layerPosix","layerWin32"],"sources":["../src/BunPath.ts"],"sourcesContent":[null],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;AAoBA,OAAO,KAAKA,QAAQ,MAAM,uCAAuC;AAIjE;;;;;;AAMA,OAAO,MAAMC,KAAK,GAAsBD,QAAQ,CAACC,KAAK;AAEtD;;;;;;AAMA,OAAO,MAAMC,UAAU,GAAsBF,QAAQ,CAACE,UAAU;AAEhE;;;;;;AAMA,OAAO,MAAMC,UAAU,GAAsBH,QAAQ,CAACG,UAAU","ignoreList":[]}
@@ -1,32 +1,62 @@
1
1
  /**
2
- * @since 1.0.0
2
+ * Bun Redis integration backed by Bun's built-in `RedisClient`.
3
+ *
4
+ * This module provides scoped layers that create a Bun `RedisClient` and expose
5
+ * both the low-level `Redis` service used by Effect persistence modules and the
6
+ * `BunRedis` service for direct access to the underlying client. Use it in Bun
7
+ * applications that need Redis-backed persistence, persisted queues,
8
+ * distributed rate limiting, custom Redis commands, or Bun Redis features such
9
+ * as pub/sub through the raw client.
10
+ *
11
+ * The client is acquired when the layer is built and closed with `close` when
12
+ * the layer scope ends, so install the layer at the lifetime you want for the
13
+ * connection and pass a Redis URL, Bun `RedisOptions`, or `layerConfig` for
14
+ * connection settings. The portable `Redis` service sends ordinary commands
15
+ * through `RedisClient.send`; pub/sub is available through `BunRedis.client`
16
+ * or `BunRedis.use` and should normally use a separately scoped client so a
17
+ * subscription does not interfere with command traffic used by persistence or
18
+ * rate limiter stores.
19
+ *
20
+ * Persistence and rate limiter stores build keys and Lua scripts on top of this
21
+ * service. Choose stable prefixes and store ids to avoid collisions, account
22
+ * for persisted values that may fail to decode after schema changes, and avoid
23
+ * unbounded high-cardinality rate-limit keys unless you have a cleanup or
24
+ * bounding strategy.
25
+ *
26
+ * @since 4.0.0
3
27
  */
4
28
  import { RedisClient, type RedisOptions } from "bun";
5
29
  import * as Config from "effect/Config";
30
+ import * as Context from "effect/Context";
6
31
  import * as Effect from "effect/Effect";
7
32
  import * as Layer from "effect/Layer";
8
- import * as ServiceMap from "effect/ServiceMap";
9
33
  import * as Redis from "effect/unstable/persistence/Redis";
10
- declare const BunRedis_base: ServiceMap.ServiceClass<BunRedis, "@effect/platform-bun/BunRedis", {
34
+ declare const BunRedis_base: Context.ServiceClass<BunRedis, "@effect/platform-bun/BunRedis", {
11
35
  readonly client: RedisClient;
12
36
  readonly use: <A>(f: (client: RedisClient) => Promise<A>) => Effect.Effect<A, Redis.RedisError>;
13
37
  }>;
14
38
  /**
15
- * @since 1.0.0
16
- * @category Service
39
+ * Service tag for Bun Redis integration, exposing the raw `RedisClient` and a `use` helper that maps client promise failures to `RedisError`.
40
+ *
41
+ * @category services
42
+ * @since 4.0.0
17
43
  */
18
44
  export declare class BunRedis extends BunRedis_base {
19
45
  }
20
46
  /**
21
- * @since 1.0.0
22
- * @category Layers
47
+ * Creates scoped Bun Redis layers for `Redis.Redis` and `BunRedis`, closing the underlying client when the scope finalizes.
48
+ *
49
+ * @category layers
50
+ * @since 4.0.0
23
51
  */
24
52
  export declare const layer: (options?: ({
25
53
  readonly url?: string;
26
54
  } & RedisOptions) | undefined) => Layer.Layer<Redis.Redis | BunRedis>;
27
55
  /**
28
- * @since 1.0.0
29
- * @category Layers
56
+ * Creates scoped Bun Redis layers from configurable Redis options, closing the underlying client when the scope finalizes.
57
+ *
58
+ * @category layers
59
+ * @since 4.0.0
30
60
  */
31
61
  export declare const layerConfig: (options: Config.Wrap<{
32
62
  readonly url?: string;
@@ -1 +1 @@
1
- {"version":3,"file":"BunRedis.d.ts","sourceRoot":"","sources":["../src/BunRedis.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,EAAE,WAAW,EAAE,KAAK,YAAY,EAAE,MAAM,KAAK,CAAA;AACpD,OAAO,KAAK,MAAM,MAAM,eAAe,CAAA;AACvC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KAAK,KAAK,MAAM,mCAAmC,CAAA;;qBASvC,WAAW;kBACd,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,MAAM,EAAE,WAAW,KAAK,OAAO,CAAC,CAAC,CAAC,KAAK,MAAM,CAAC,MAAM,CAAC,CAAC,EAAE,KAAK,CAAC,UAAU,CAAC;;AARjG;;;;;GAKG;AACH,qBAAa,QAAS,SAAQ,aAGO;CAAG;AAmCxC;;;;;GAKG;AACH,eAAO,MAAM,KAAK,GAChB,UAAU,CAAC;IAAE,QAAQ,CAAC,GAAG,CAAC,EAAE,MAAM,CAAA;CAAE,GAAG,YAAY,CAAC,GAAG,SAAS,KAC/D,KAAK,CAAC,KAAK,CAAC,KAAK,CAAC,KAAK,GAAG,QAAQ,CAAuC,CAAA;AAE5E;;;;;GAKG;AACH,eAAO,MAAM,WAAW,GACtB,SAAS,MAAM,CAAC,IAAI,CAAC;IAAE,QAAQ,CAAC,GAAG,CAAC,EAAE,MAAM,CAAA;CAAE,GAAG,YAAY,CAAC,KAC7D,KAAK,CAAC,KAAK,CAAC,KAAK,CAAC,KAAK,GAAG,QAAQ,EAAE,MAAM,CAAC,WAAW,CAKtD,CAAA"}
package/dist/BunRedis.js CHANGED
@@ -1,19 +1,45 @@
1
1
  /**
2
- * @since 1.0.0
2
+ * Bun Redis integration backed by Bun's built-in `RedisClient`.
3
+ *
4
+ * This module provides scoped layers that create a Bun `RedisClient` and expose
5
+ * both the low-level `Redis` service used by Effect persistence modules and the
6
+ * `BunRedis` service for direct access to the underlying client. Use it in Bun
7
+ * applications that need Redis-backed persistence, persisted queues,
8
+ * distributed rate limiting, custom Redis commands, or Bun Redis features such
9
+ * as pub/sub through the raw client.
10
+ *
11
+ * The client is acquired when the layer is built and closed with `close` when
12
+ * the layer scope ends, so install the layer at the lifetime you want for the
13
+ * connection and pass a Redis URL, Bun `RedisOptions`, or `layerConfig` for
14
+ * connection settings. The portable `Redis` service sends ordinary commands
15
+ * through `RedisClient.send`; pub/sub is available through `BunRedis.client`
16
+ * or `BunRedis.use` and should normally use a separately scoped client so a
17
+ * subscription does not interfere with command traffic used by persistence or
18
+ * rate limiter stores.
19
+ *
20
+ * Persistence and rate limiter stores build keys and Lua scripts on top of this
21
+ * service. Choose stable prefixes and store ids to avoid collisions, account
22
+ * for persisted values that may fail to decode after schema changes, and avoid
23
+ * unbounded high-cardinality rate-limit keys unless you have a cleanup or
24
+ * bounding strategy.
25
+ *
26
+ * @since 4.0.0
3
27
  */
4
28
  import { RedisClient } from "bun";
5
29
  import * as Config from "effect/Config";
30
+ import * as Context from "effect/Context";
6
31
  import * as Effect from "effect/Effect";
7
32
  import * as Fn from "effect/Function";
8
33
  import * as Layer from "effect/Layer";
9
34
  import * as Scope from "effect/Scope";
10
- import * as ServiceMap from "effect/ServiceMap";
11
35
  import * as Redis from "effect/unstable/persistence/Redis";
12
36
  /**
13
- * @since 1.0.0
14
- * @category Service
37
+ * Service tag for Bun Redis integration, exposing the raw `RedisClient` and a `use` helper that maps client promise failures to `RedisError`.
38
+ *
39
+ * @category services
40
+ * @since 4.0.0
15
41
  */
16
- export class BunRedis extends /*#__PURE__*/ServiceMap.Service()("@effect/platform-bun/BunRedis") {}
42
+ export class BunRedis extends /*#__PURE__*/Context.Service()("@effect/platform-bun/BunRedis") {}
17
43
  const make = /*#__PURE__*/Effect.fnUntraced(function* (options) {
18
44
  const scope = yield* Effect.scope;
19
45
  yield* Scope.addFinalizer(scope, Effect.sync(() => client.close()));
@@ -36,16 +62,20 @@ const make = /*#__PURE__*/Effect.fnUntraced(function* (options) {
36
62
  client,
37
63
  use
38
64
  });
39
- return ServiceMap.make(BunRedis, bunRedis).pipe(ServiceMap.add(Redis.Redis, redis));
65
+ return Context.make(BunRedis, bunRedis).pipe(Context.add(Redis.Redis, redis));
40
66
  });
41
67
  /**
42
- * @since 1.0.0
43
- * @category Layers
68
+ * Creates scoped Bun Redis layers for `Redis.Redis` and `BunRedis`, closing the underlying client when the scope finalizes.
69
+ *
70
+ * @category layers
71
+ * @since 4.0.0
44
72
  */
45
- export const layer = options => Layer.effectServices(make(options));
73
+ export const layer = options => Layer.effectContext(make(options));
46
74
  /**
47
- * @since 1.0.0
48
- * @category Layers
75
+ * Creates scoped Bun Redis layers from configurable Redis options, closing the underlying client when the scope finalizes.
76
+ *
77
+ * @category layers
78
+ * @since 4.0.0
49
79
  */
50
- export const layerConfig = options => Layer.effectServices(Config.unwrap(options).asEffect().pipe(Effect.flatMap(make)));
80
+ export const layerConfig = options => Layer.effectContext(Config.unwrap(options).pipe(Effect.flatMap(make)));
51
81
  //# sourceMappingURL=BunRedis.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"BunRedis.js","names":["RedisClient","Config","Effect","Fn","Layer","Scope","ServiceMap","Redis","BunRedis","Service","make","fnUntraced","options","scope","addFinalizer","sync","client","close","url","use","f","tryPromise","try","catch","cause","RedisError","redis","send","command","args","bunRedis","identity","pipe","add","layer","effectServices","layerConfig","unwrap","asEffect","flatMap"],"sources":["../src/BunRedis.ts"],"sourcesContent":[null],"mappings":"AAAA;;;AAGA,SAASA,WAAW,QAA2B,KAAK;AACpD,OAAO,KAAKC,MAAM,MAAM,eAAe;AACvC,OAAO,KAAKC,MAAM,MAAM,eAAe;AACvC,OAAO,KAAKC,EAAE,MAAM,iBAAiB;AACrC,OAAO,KAAKC,KAAK,MAAM,cAAc;AACrC,OAAO,KAAKC,KAAK,MAAM,cAAc;AACrC,OAAO,KAAKC,UAAU,MAAM,mBAAmB;AAC/C,OAAO,KAAKC,KAAK,MAAM,mCAAmC;AAE1D;;;;AAIA,OAAM,MAAOC,QAAS,sBAAQF,UAAU,CAACG,OAAO,EAG5C,CAAC,+BAA+B,CAAC;AAErC,MAAMC,IAAI,gBAAGR,MAAM,CAACS,UAAU,CAAC,WAC7BC,OAEgB;EAEhB,MAAMC,KAAK,GAAG,OAAOX,MAAM,CAACW,KAAK;EACjC,OAAOR,KAAK,CAACS,YAAY,CAACD,KAAK,EAAEX,MAAM,CAACa,IAA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IAAI,CACpC9B,MAAM,CAACqC,OAAO,CAAC7B,IAAI,CAAC,CACrB,CACF","ignoreList":[]}
1
+ {"version":3,"file":"BunRedis.js","names":["RedisClient","Config","Context","Effect","Fn","Layer","Scope","Redis","BunRedis","Service","make","fnUntraced","options","scope","addFinalizer","sync","client","close","url","use","f","tryPromise","try","catch","cause","RedisError","redis","send","command","args","bunRedis","identity","pipe","add","layer","effectContext","layerConfig","unwrap","flatMap"],"sources":["../src/BunRedis.ts"],"sourcesContent":[null],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;AA2BA,SAASA,WAAW,QAA2B,KAAK;AACpD,OAAO,KAAKC,MAAM,MAAM,eAAe;AACvC,OAAO,KAAKC,OAAO,MAAM,gBAAgB;AACzC,OAAO,KAAKC,MAAM,MAAM,eAAe;AACvC,OAAO,KAAKC,EAAE,MAAM,iBAAiB;AACrC,OAAO,KAAKC,KAAK,MAAM,cAAc;AACrC,OAAO,KAAKC,KAAK,MAAM,cAAc;AACrC,OAAO,KAAKC,KAAK,MAAM,mCAAmC;AAE1D;;;;;;AAMA,OAAM,MAAOC,QAAS,sBAAQN,OAAO,CAACO,OAAO,EAGzC,CAAC,+BAA+B,CAAC;AAErC,MAAMC,IAAI,gBAAGP,MAAM,CAACQ,UAAU,CAAC,WAC7BC,OAEgB;EAEhB,MAAMC,KAAK,GAAG,OAAOV,MAAM,CAACU,KAAK;EACjC,OAAOP,KAAK,CAACQ,YAAY,CAACD,KAAK,EAAEV,MAAM,CAACY,IAAI,CAAC,MAAMC,MAAM,CAACC,KAAK,EAAE,CAAC,CAAC;EACnE,MAAMD,MAAM,GAAG,IAAIhB,WAAW,CAACY,OAAO,EAAEM,GAAG,EAAEN,OAAO,CAAC;EAErD,MAAMO,GAAG,GAAOC,CAAsC,IACpDjB,MAAM,CAACkB,UAAU,CAAC;IAChBC,GAAG,EAAEA,CAAA,KAAMF,CAAC,CAACJ,MAAM,CAAC;IACpBO,KAAK,EAAGC,KAAK,IAAK,IAAIjB,KAAK,CAACkB,UAAU,CAAC;MAAED;IAAK,CAAE;GACjD,CAAC;EAEJ,MAAME,KAAK,GAAG,OAAOnB,KAAK,CAACG,IAAI,CAAC;IAC9BiB,IAAI,EAAEA,CAAcC,OAAe,EAAE,GAAGC,IAA2B,KACjE1B,MAAM,CAACkB,UAAU,CAAC;MAChBC,GAAG,EAAEA,CAAA,KAAMN,MAAM,CAACW,IAAI,CAACC,OAAO,EAAEC,IAAqB,CAAe;MACpEN,KAAK,EAAGC,KAAK,IAAK,IAAIjB,KAAK,CAACkB,UAAU,CAAC;QAAED;MAAK,CAAE;KACjD;GACJ,CAAC;EAEF,MAAMM,QAAQ,GAAG1B,EAAE,CAAC2B,QAAQ,CAAsB;IAChDf,MAAM;IACNG;GACD,CAAC;EAEF,OAAOjB,OAAO,CAACQ,IAAI,CAACF,QAAQ,EAAEsB,QAAQ,CAAC,CAACE,IAAI,CAC1C9B,OAAO,CAAC+B,GAAG,CAAC1B,KAAK,CAACA,KAAK,EAAEmB,KAAK,CAAC,CAChC;AACH,CAAC,CAAC;AAEF;;;;;;AAMA,OAAO,MAAMQ,KAAK,GAChBtB,OAAgE,IACxBP,KAAK,CAAC8B,aAAa,CAACzB,IAAI,CAACE,OAAO,CAAC,CAAC;AAE5E;;;;;;AAMA,OAAO,MAAMwB,WAAW,GACtBxB,OAA8D,IAE9DP,KAAK,CAAC8B,aAAa,CACjBlC,MAAM,CAACoC,MAAM,CAACzB,OAAO,CAAC,CAACoB,IAAI,CACzB7B,MAAM,CAACmC,OAAO,CAAC5B,IAAI,CAAC,CACrB,CACF","ignoreList":[]}
@@ -3,6 +3,12 @@ import type { Teardown } from "effect/Runtime";
3
3
  /**
4
4
  * Helps you run a main effect with built-in error handling, logging, and signal management.
5
5
  *
6
+ * **When to use**
7
+ *
8
+ * Use this function to run an Effect as your application's main program,
9
+ * especially when you need structured error handling, log management,
10
+ * interrupt support, or advanced teardown capabilities.
11
+ *
6
12
  * **Details**
7
13
  *
8
14
  * This function launches an Effect as the main entry point, setting exit codes
@@ -11,26 +17,24 @@ import type { Teardown } from "effect/Runtime";
11
17
  * behaviors can be turned off. You can also provide custom teardown logic to
12
18
  * finalize resources or produce different exit codes.
13
19
  *
14
- * **Options**
15
- *
16
20
  * An optional object that can include:
17
21
  * - `disableErrorReporting`: Turn off automatic error logging.
18
22
  * - `disablePrettyLogger`: Avoid adding the pretty logger.
19
23
  * - `teardown`: Provide custom finalization logic.
20
24
  *
21
- * **When to Use**
22
- *
23
- * Use this function to run an Effect as your application’s main program, especially
24
- * when you need structured error handling, log management, interrupt support,
25
- * or advanced teardown capabilities.
26
- *
27
- * @since 1.0.0
28
- * @category Run main
25
+ * @category running
26
+ * @since 4.0.0
29
27
  */
30
28
  export declare const runMain: {
31
29
  /**
32
30
  * Helps you run a main effect with built-in error handling, logging, and signal management.
33
31
  *
32
+ * **When to use**
33
+ *
34
+ * Use this function to run an Effect as your application's main program,
35
+ * especially when you need structured error handling, log management,
36
+ * interrupt support, or advanced teardown capabilities.
37
+ *
34
38
  * **Details**
35
39
  *
36
40
  * This function launches an Effect as the main entry point, setting exit codes
@@ -39,21 +43,13 @@ export declare const runMain: {
39
43
  * behaviors can be turned off. You can also provide custom teardown logic to
40
44
  * finalize resources or produce different exit codes.
41
45
  *
42
- * **Options**
43
- *
44
46
  * An optional object that can include:
45
47
  * - `disableErrorReporting`: Turn off automatic error logging.
46
48
  * - `disablePrettyLogger`: Avoid adding the pretty logger.
47
49
  * - `teardown`: Provide custom finalization logic.
48
50
  *
49
- * **When to Use**
50
- *
51
- * Use this function to run an Effect as your application’s main program, especially
52
- * when you need structured error handling, log management, interrupt support,
53
- * or advanced teardown capabilities.
54
- *
55
- * @since 1.0.0
56
- * @category Run main
51
+ * @category running
52
+ * @since 4.0.0
57
53
  */
58
54
  (options?: {
59
55
  readonly disableErrorReporting?: boolean | undefined;
@@ -62,6 +58,12 @@ export declare const runMain: {
62
58
  /**
63
59
  * Helps you run a main effect with built-in error handling, logging, and signal management.
64
60
  *
61
+ * **When to use**
62
+ *
63
+ * Use this function to run an Effect as your application's main program,
64
+ * especially when you need structured error handling, log management,
65
+ * interrupt support, or advanced teardown capabilities.
66
+ *
65
67
  * **Details**
66
68
  *
67
69
  * This function launches an Effect as the main entry point, setting exit codes
@@ -70,21 +72,13 @@ export declare const runMain: {
70
72
  * behaviors can be turned off. You can also provide custom teardown logic to
71
73
  * finalize resources or produce different exit codes.
72
74
  *
73
- * **Options**
74
- *
75
75
  * An optional object that can include:
76
76
  * - `disableErrorReporting`: Turn off automatic error logging.
77
77
  * - `disablePrettyLogger`: Avoid adding the pretty logger.
78
78
  * - `teardown`: Provide custom finalization logic.
79
79
  *
80
- * **When to Use**
81
- *
82
- * Use this function to run an Effect as your application’s main program, especially
83
- * when you need structured error handling, log management, interrupt support,
84
- * or advanced teardown capabilities.
85
- *
86
- * @since 1.0.0
87
- * @category Run main
80
+ * @category running
81
+ * @since 4.0.0
88
82
  */
89
83
  <E, A>(effect: Effect<A, E>, options?: {
90
84
  readonly disableErrorReporting?: boolean | undefined;
@@ -1 +1 @@
1
- {"version":3,"file":"BunRuntime.d.ts","sourceRoot":"","sources":["../src/BunRuntime.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,eAAe,CAAA;AAC3C,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAA;AAE9C;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH,eAAO,MAAM,OAAO,EAAE;IACpB;;;;;;;;;;;;;;;;;;;;;;;;;;OA0BG;IACH,CACE,OAAO,CAAC,EAAE;QACR,QAAQ,CAAC,qBAAqB,CAAC,EAAE,OAAO,GAAG,SAAS,CAAA;QACpD,QAAQ,CAAC,QAAQ,CAAC,EAAE,QAAQ,GAAG,SAAS,CAAA;KACzC,GACA,CAAC,CAAC,EAAE,CAAC,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC,EAAE,CAAC,CAAC,KA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- * @since 1.0.0
2
+ * Bun entry-point helpers for running Effect programs.
3
+ *
4
+ * This module exposes `runMain`, the Bun runtime launcher used at the edge of
5
+ * CLIs, scripts, servers, and worker processes. It runs an already
6
+ * self-contained Effect as the process main program, using the shared
7
+ * Node-compatible runtime implementation for error reporting, teardown, and
8
+ * `process` signal handling available in Bun.
9
+ *
10
+ * `BunRuntime` does not provide application services by itself. Provide any
11
+ * required layers, such as `BunServices.layer` or narrower service-specific
12
+ * layers, before passing the effect to `runMain`. On `SIGINT` or `SIGTERM`,
13
+ * the main fiber is interrupted so scoped resources and finalizers can shut
14
+ * down; keep long-running servers, workers, and subscriptions attached to that
15
+ * scope and avoid finalizers that never complete, otherwise process shutdown
16
+ * can be delayed.
17
+ *
18
+ * @since 4.0.0
3
19
  */
4
20
  import * as NodeRuntime from "@effect/platform-node-shared/NodeRuntime";
5
21
  /**
6
22
  * Helps you run a main effect with built-in error handling, logging, and signal management.
7
23
  *
24
+ * **When to use**
25
+ *
26
+ * Use this function to run an Effect as your application's main program,
27
+ * especially when you need structured error handling, log management,
28
+ * interrupt support, or advanced teardown capabilities.
29
+ *
8
30
  * **Details**
9
31
  *
10
32
  * This function launches an Effect as the main entry point, setting exit codes
@@ -13,21 +35,13 @@ import * as NodeRuntime from "@effect/platform-node-shared/NodeRuntime";
13
35
  * behaviors can be turned off. You can also provide custom teardown logic to
14
36
  * finalize resources or produce different exit codes.
15
37
  *
16
- * **Options**
17
- *
18
38
  * An optional object that can include:
19
39
  * - `disableErrorReporting`: Turn off automatic error logging.
20
40
  * - `disablePrettyLogger`: Avoid adding the pretty logger.
21
41
  * - `teardown`: Provide custom finalization logic.
22
42
  *
23
- * **When to Use**
24
- *
25
- * Use this function to run an Effect as your application’s main program, especially
26
- * when you need structured error handling, log management, interrupt support,
27
- * or advanced teardown capabilities.
28
- *
29
- * @since 1.0.0
30
- * @category Run main
43
+ * @category running
44
+ * @since 4.0.0
31
45
  */
32
46
  export const runMain = NodeRuntime.runMain;
33
47
  //# sourceMappingURL=BunRuntime.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"BunRuntime.js","names":["NodeRuntime","runMain"],"sources":["../src/BunRuntime.ts"],"sourcesContent":[null],"mappings":"AAAA;;;AAGA,OAAO,KAAKA,WAAW,MAAM,0CAA0C;AAIvE;;;;;;;;;;;;;;;;;;;;;;;;;;;AA2BA,OAAO,MAAMC,OAAO,GAoEhBD,WAAW,CAACC,OAAO","ignoreList":[]}
1
+ {"version":3,"file":"BunRuntime.js","names":["NodeRuntime","runMain"],"sources":["../src/BunRuntime.ts"],"sourcesContent":[null],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;AAmBA,OAAO,KAAKA,WAAW,MAAM,0CAA0C;AAIvE;;;;;;;;;;;;;;;;;;;;;;;;;AAyBA,OAAO,MAAMC,OAAO,GAgEhBD,WAAW,CAACC,OAAO","ignoreList":[]}
@@ -1,6 +1,27 @@
1
1
  /**
2
- * @since 1.0.0
2
+ * Provides the aggregate Bun platform services layer for applications that run
3
+ * on the Bun runtime.
4
+ *
5
+ * This module is useful when an application needs the standard Bun-backed
6
+ * implementations of filesystem access, path operations, stdio, terminal
7
+ * interaction, and child process spawning from a single layer. Provide
8
+ * `BunServices.layer` near the edge of a program to satisfy effects that read
9
+ * or write files, resolve paths, interact with stdin/stdout/stderr or a
10
+ * terminal, or launch subprocesses.
11
+ *
12
+ * The layer only supplies the runtime services listed by `BunServices`; it does
13
+ * not provide unrelated platform services such as HTTP clients, HTTP servers,
14
+ * sockets, workers, or Redis. Several of these core Bun services are backed by
15
+ * the shared Node-compatible implementations used by the Bun adapters, so the
16
+ * default path, stdio, terminal, and subprocess behavior follows the current
17
+ * process and host platform. Libraries should continue to depend on the
18
+ * individual service tags they use, while Bun applications, CLIs, and tests can
19
+ * choose this layer or narrower service-specific layers depending on how much
20
+ * of the Bun runtime they want to expose.
21
+ *
22
+ * @since 4.0.0
3
23
  */
24
+ import type { Crypto } from "effect/Crypto";
4
25
  import type { FileSystem } from "effect/FileSystem";
5
26
  import * as Layer from "effect/Layer";
6
27
  import type { Path } from "effect/Path";
@@ -8,13 +29,19 @@ import type { Stdio } from "effect/Stdio";
8
29
  import type { Terminal } from "effect/Terminal";
9
30
  import type { ChildProcessSpawner } from "effect/unstable/process/ChildProcessSpawner";
10
31
  /**
11
- * @since 1.0.0
32
+ * The union of core services provided by the Bun platform layer, including child
33
+ * process spawning, filesystem, path, stdio, and terminal services.
34
+ *
12
35
  * @category models
36
+ * @since 4.0.0
13
37
  */
14
- export type BunServices = ChildProcessSpawner | FileSystem | Path | Terminal | Stdio;
38
+ export type BunServices = ChildProcessSpawner | Crypto | FileSystem | Path | Terminal | Stdio;
15
39
  /**
16
- * @since 1.0.0
17
- * @category layer
40
+ * Provides the default Bun implementations for child process spawning,
41
+ * filesystem, path, stdio, and terminal services.
42
+ *
43
+ * @category layers
44
+ * @since 4.0.0
18
45
  */
19
46
  export declare const layer: Layer.Layer<BunServices>;
20
47
  //# sourceMappingURL=BunServices.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"BunServices.d.ts","sourceRoot":"","sources":["../src/BunServices.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAA;AACnD,OAAO,KAAK,KAAK,MAAM,cAAc,CAAA;AACrC,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,aAAa,CAAA;AACvC,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,cAAc,CAAA;AACzC,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAA;AAC/C,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,6CAA6C,CAAA;AAOtF;;;GAGG;AACH,MAAM,MAAM,WAAW,GAAG,mBAAmB,GAAG,UAAU,GAAG,IAAI,GAAG,QAAQ,GAAG,KAAK,CAAA;AAEpF;;;GAGG;AACH,eAAO,MAAM,KAAK,EAAE,KAAK,CAAC,KAAK,CAAC,WAAW,CAO1C,CAAA"}
1
+ {"version":3,"file":"BunServices.d.ts","sourceRoot":"","sources":["../src/BunServices.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,eAAe,CAAA;AAC3C,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAA;AACnD,OAAO,KAAK,KAAK,MAAM,cAAc,CAAA;AACrC,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,aAAa,CAAA;AACvC,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,cAAc,CAAA;AACzC,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAA;AAC/C,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,6CAA6C,CAAA;AAQtF;;;;;;GAMG;AACH,MAAM,MAAM,WAAW,GAAG,mBAAmB,GAAG,MAAM,GAAG,UAAU,GAAG,IAAI,GAAG,QAAQ,GAAG,KAAK,CAAA;AAE7F;;;;;;GAMG;AACH,eAAO,MAAM,KAAK,EAAE,KAAK,CAAC,KAAK,CAAC,WAAW,CAQ1C,CAAA"}
@@ -1,12 +1,16 @@
1
1
  import * as Layer from "effect/Layer";
2
2
  import * as BunChildProcessSpawner from "./BunChildProcessSpawner.js";
3
+ import * as BunCrypto from "./BunCrypto.js";
3
4
  import * as BunFileSystem from "./BunFileSystem.js";
4
5
  import * as BunPath from "./BunPath.js";
5
6
  import * as BunStdio from "./BunStdio.js";
6
7
  import * as BunTerminal from "./BunTerminal.js";
7
8
  /**
8
- * @since 1.0.0
9
- * @category layer
9
+ * Provides the default Bun implementations for child process spawning,
10
+ * filesystem, path, stdio, and terminal services.
11
+ *
12
+ * @category layers
13
+ * @since 4.0.0
10
14
  */
11
- export const layer = /*#__PURE__*/BunChildProcessSpawner.layer.pipe(/*#__PURE__*/Layer.provideMerge(/*#__PURE__*/Layer.mergeAll(BunFileSystem.layer, BunPath.layer, BunStdio.layer, BunTerminal.layer)));
15
+ export const layer = /*#__PURE__*/BunChildProcessSpawner.layer.pipe(/*#__PURE__*/Layer.provideMerge(/*#__PURE__*/Layer.mergeAll(BunFileSystem.layer, BunCrypto.layer, BunPath.layer, BunStdio.layer, BunTerminal.layer)));
12
16
  //# sourceMappingURL=BunServices.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"BunServices.js","names":["Layer","BunChildProcessSpawner","BunFileSystem","BunPath","BunStdio","BunTerminal","layer","pipe","provideMerge","mergeAll"],"sources":["../src/BunServices.ts"],"sourcesContent":[null],"mappings":"AAIA,OAAO,KAAKA,KAAK,MAAM,cAAc;AAKrC,OAAO,KAAKC,sBAAsB,MAAM,6BAA6B;AACrE,OAAO,KAAKC,aAAa,MAAM,oBAAoB;AACnD,OAAO,KAAKC,OAAO,MAAM,cAAc;AACvC,OAAO,KAAKC,QAAQ,MAAM,eAAe;AACzC,OAAO,KAAKC,WAAW,MAAM,kBAAkB;AAQ/C;;;;AAIA,OAAO,MAAMC,KAAK,gBAA6BL,sBAAsB,CAACK,KAAK,CAACC,IAAI,cAC9EP,KAAK,CAACQ,YAAY,cAACR,KAAK,CAACS,QAAQ,CAC/BP,aAAa,CAACI,KAAK,EACnBH,OAAO,CAACG,KAAK,EACbF,QAAQ,CAACE,KAAK,EACdD,WAAW,CAACC,KAAK,CAClB,CAAC,CACH","ignoreList":[]}
1
+ {"version":3,"file":"BunServices.js","names":["Layer","BunChildProcessSpawner","BunCrypto","BunFileSystem","BunPath","BunStdio","BunTerminal","layer","pipe","provideMerge","mergeAll"],"sources":["../src/BunServices.ts"],"sourcesContent":[null],"mappings":"AAyBA,OAAO,KAAKA,KAAK,MAAM,cAAc;AAKrC,OAAO,KAAKC,sBAAsB,MAAM,6BAA6B;AACrE,OAAO,KAAKC,SAAS,MAAM,gBAAgB;AAC3C,OAAO,KAAKC,aAAa,MAAM,oBAAoB;AACnD,OAAO,KAAKC,OAAO,MAAM,cAAc;AACvC,OAAO,KAAKC,QAAQ,MAAM,eAAe;AACzC,OAAO,KAAKC,WAAW,MAAM,kBAAkB;AAW/C;;;;;;;AAOA,OAAO,MAAMC,KAAK,gBAA6BN,sBAAsB,CAACM,KAAK,CAACC,IAAI,cAC9ER,KAAK,CAACS,YAAY,cAACT,KAAK,CAACU,QAAQ,CAC/BP,aAAa,CAACI,KAAK,EACnBL,SAAS,CAACK,KAAK,EACfH,OAAO,CAACG,KAAK,EACbF,QAAQ,CAACE,KAAK,EACdD,WAAW,CAACC,KAAK,CAClB,CAAC,CACH","ignoreList":[]}
package/dist/BunSink.d.ts CHANGED
@@ -1,8 +1,8 @@
1
1
  /**
2
- * @since 1.0.0
2
+ * @since 4.0.0
3
3
  */
4
4
  /**
5
- * @since 1.0.0
5
+ * @since 4.0.0
6
6
  */
7
7
  export * from "@effect/platform-node-shared/NodeSink";
8
8
  //# sourceMappingURL=BunSink.d.ts.map
package/dist/BunSink.js CHANGED
@@ -1,8 +1,8 @@
1
1
  /**
2
- * @since 1.0.0
2
+ * @since 4.0.0
3
3
  */
4
4
  /**
5
- * @since 1.0.0
5
+ * @since 4.0.0
6
6
  */
7
7
  export * from "@effect/platform-node-shared/NodeSink";
8
8
  //# sourceMappingURL=BunSink.js.map
@@ -1,22 +1,48 @@
1
1
  /**
2
- * @since 1.0.0
2
+ * Bun platform socket entry point for Effect sockets backed by Bun-compatible
3
+ * Node streams and Bun's native WebSocket implementation.
4
+ *
5
+ * This module re-exports the shared Node socket constructors for TCP clients,
6
+ * Unix domain socket clients, and adapters from existing Node `Duplex` streams,
7
+ * then adds Bun-specific WebSocket layers using `globalThis.WebSocket`. Use it
8
+ * in Bun applications that connect to raw socket protocols, Unix sockets,
9
+ * realtime WebSocket services, or Effect RPC transports that need a
10
+ * `Socket.Socket` layer.
11
+ *
12
+ * TCP lifecycle behavior comes from the shared Node layer: sockets are scoped,
13
+ * finalizers close or destroy the underlying stream, open timeouts become
14
+ * socket open errors, and read, write, and close events are mapped to
15
+ * `SocketError` values. TLS concerns depend on the transport being used: `wss:`
16
+ * URLs are handled by Bun's WebSocket implementation, while TLS-wrapped
17
+ * `Duplex` streams can be adapted after they have been created elsewhere.
18
+ * When closing intentionally, send `Socket.CloseEvent` values so the close code
19
+ * and reason are preserved through the socket lifecycle.
20
+ *
21
+ * @since 4.0.0
3
22
  */
4
23
  import type * as Duration from "effect/Duration";
5
24
  import type { Effect } from "effect/Effect";
6
25
  import * as Layer from "effect/Layer";
7
26
  import * as Socket from "effect/unstable/socket/Socket";
8
27
  /**
9
- * @since 1.0.0
28
+ * @since 4.0.0
10
29
  */
11
30
  export * from "@effect/platform-node-shared/NodeSocket";
12
31
  /**
13
- * @since 1.0.0
32
+ * Provides a `Socket.WebSocketConstructor` backed by Bun's global
33
+ * `WebSocket` implementation.
34
+ *
14
35
  * @category layers
36
+ * @since 4.0.0
15
37
  */
16
38
  export declare const layerWebSocketConstructor: Layer.Layer<Socket.WebSocketConstructor>;
17
39
  /**
18
- * @since 1.0.0
40
+ * Creates a `Socket.Socket` layer for a WebSocket URL using Bun's global
41
+ * `WebSocket` constructor, honoring protocol, open-timeout, and close-code
42
+ * error options.
43
+ *
19
44
  * @category layers
45
+ * @since 4.0.0
20
46
  */
21
47
  export declare const layerWebSocket: (url: string | Effect<string>, options?: {
22
48
  readonly closeCodeIsError?: ((code: number) => boolean) | undefined;
@@ -1 +1 @@
1
- {"version":3,"file":"BunSocket.d.ts","sourceRoot":"","sources":["../src/BunSocket.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,KAAK,KAAK,QAAQ,MAAM,iBAAiB,CAAA;AAChD,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,eAAe,CAAA;AAE3C,OAAO,KAAK,KAAK,MAAM,cAAc,CAAA;AACrC,OAAO,KAAK,MAAM,MAAM,+BAA+B,CAAA;AAEvD;;GAEG;AACH,cAAc,yCAAyC,CAAA;AAEvD;;;GAGG;AACH,eAAO,MAAM,yBAAyB,EAAE,KAAK,CAAC,KAAK,CACjD,MAAM,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