@effect/platform-deno 4.0.0-beta.104
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/LICENSE +21 -0
- package/README.md +13 -0
- package/dist/DenoChildProcessSpawner.d.ts +39 -0
- package/dist/DenoChildProcessSpawner.d.ts.map +1 -0
- package/dist/DenoChildProcessSpawner.js +311 -0
- package/dist/DenoChildProcessSpawner.js.map +1 -0
- package/dist/DenoClusterHttp.d.ts +60 -0
- package/dist/DenoClusterHttp.d.ts.map +1 -0
- package/dist/DenoClusterHttp.js +78 -0
- package/dist/DenoClusterHttp.js.map +1 -0
- package/dist/DenoClusterSocket.d.ts +65 -0
- package/dist/DenoClusterSocket.d.ts.map +1 -0
- package/dist/DenoClusterSocket.js +101 -0
- package/dist/DenoClusterSocket.js.map +1 -0
- package/dist/DenoCrypto.d.ts +25 -0
- package/dist/DenoCrypto.d.ts.map +1 -0
- package/dist/DenoCrypto.js +52 -0
- package/dist/DenoCrypto.js.map +1 -0
- package/dist/DenoFileSystem.d.ts +10 -0
- package/dist/DenoFileSystem.d.ts.map +1 -0
- package/dist/DenoFileSystem.js +331 -0
- package/dist/DenoFileSystem.js.map +1 -0
- package/dist/DenoHttpClient.d.ts +9 -0
- package/dist/DenoHttpClient.d.ts.map +1 -0
- package/dist/DenoHttpClient.js +9 -0
- package/dist/DenoHttpClient.js.map +1 -0
- package/dist/DenoHttpPlatform.d.ts +34 -0
- package/dist/DenoHttpPlatform.d.ts.map +1 -0
- package/dist/DenoHttpPlatform.js +88 -0
- package/dist/DenoHttpPlatform.js.map +1 -0
- package/dist/DenoHttpServer.d.ts +99 -0
- package/dist/DenoHttpServer.d.ts.map +1 -0
- package/dist/DenoHttpServer.js +353 -0
- package/dist/DenoHttpServer.js.map +1 -0
- package/dist/DenoHttpServerRequest.d.ts +18 -0
- package/dist/DenoHttpServerRequest.d.ts.map +1 -0
- package/dist/DenoHttpServerRequest.js +8 -0
- package/dist/DenoHttpServerRequest.js.map +1 -0
- package/dist/DenoKeyValueStore.d.ts +22 -0
- package/dist/DenoKeyValueStore.d.ts.map +1 -0
- package/dist/DenoKeyValueStore.js +21 -0
- package/dist/DenoKeyValueStore.js.map +1 -0
- package/dist/DenoMultipart.d.ts +32 -0
- package/dist/DenoMultipart.d.ts.map +1 -0
- package/dist/DenoMultipart.js +25 -0
- package/dist/DenoMultipart.js.map +1 -0
- package/dist/DenoPath.d.ts +43 -0
- package/dist/DenoPath.d.ts.map +1 -0
- package/dist/DenoPath.js +81 -0
- package/dist/DenoPath.js.map +1 -0
- package/dist/DenoRedis.d.ts +60 -0
- package/dist/DenoRedis.d.ts.map +1 -0
- package/dist/DenoRedis.js +76 -0
- package/dist/DenoRedis.js.map +1 -0
- package/dist/DenoRuntime.d.ts +36 -0
- package/dist/DenoRuntime.d.ts.map +1 -0
- package/dist/DenoRuntime.js +35 -0
- package/dist/DenoRuntime.js.map +1 -0
- package/dist/DenoServices.d.ts +34 -0
- package/dist/DenoServices.d.ts.map +1 -0
- package/dist/DenoServices.js +16 -0
- package/dist/DenoServices.js.map +1 -0
- package/dist/DenoSocket.d.ts +99 -0
- package/dist/DenoSocket.d.ts.map +1 -0
- package/dist/DenoSocket.js +192 -0
- package/dist/DenoSocket.js.map +1 -0
- package/dist/DenoSocketServer.d.ts +70 -0
- package/dist/DenoSocketServer.d.ts.map +1 -0
- package/dist/DenoSocketServer.js +68 -0
- package/dist/DenoSocketServer.js.map +1 -0
- package/dist/DenoStdio.d.ts +11 -0
- package/dist/DenoStdio.d.ts.map +1 -0
- package/dist/DenoStdio.js +39 -0
- package/dist/DenoStdio.js.map +1 -0
- package/dist/DenoTerminal.d.ts +21 -0
- package/dist/DenoTerminal.d.ts.map +1 -0
- package/dist/DenoTerminal.js +27 -0
- package/dist/DenoTerminal.js.map +1 -0
- package/dist/DenoWorker.d.ts +17 -0
- package/dist/DenoWorker.d.ts.map +1 -0
- package/dist/DenoWorker.js +54 -0
- package/dist/DenoWorker.js.map +1 -0
- package/dist/DenoWorkerRunner.d.ts +24 -0
- package/dist/DenoWorkerRunner.d.ts.map +1 -0
- package/dist/DenoWorkerRunner.js +150 -0
- package/dist/DenoWorkerRunner.js.map +1 -0
- package/dist/index.d.ts +88 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +89 -0
- package/dist/index.js.map +1 -0
- package/dist/internal/denoSocketServer.d.ts +7 -0
- package/dist/internal/denoSocketServer.d.ts.map +1 -0
- package/dist/internal/denoSocketServer.js +55 -0
- package/dist/internal/denoSocketServer.js.map +1 -0
- package/dist/internal/error.d.ts +4 -0
- package/dist/internal/error.d.ts.map +1 -0
- package/dist/internal/error.js +46 -0
- package/dist/internal/error.js.map +1 -0
- package/package.json +72 -0
- package/src/DenoChildProcessSpawner.ts +439 -0
- package/src/DenoClusterHttp.ts +156 -0
- package/src/DenoClusterSocket.ts +197 -0
- package/src/DenoCrypto.ts +63 -0
- package/src/DenoFileSystem.ts +497 -0
- package/src/DenoHttpClient.ts +9 -0
- package/src/DenoHttpPlatform.ts +93 -0
- package/src/DenoHttpServer.ts +535 -0
- package/src/DenoHttpServerRequest.ts +18 -0
- package/src/DenoKeyValueStore.ts +28 -0
- package/src/DenoMultipart.ts +53 -0
- package/src/DenoPath.ts +102 -0
- package/src/DenoRedis.ts +113 -0
- package/src/DenoRuntime.ts +73 -0
- package/src/DenoServices.ts +49 -0
- package/src/DenoSocket.ts +318 -0
- package/src/DenoSocketServer.ts +120 -0
- package/src/DenoStdio.ts +51 -0
- package/src/DenoTerminal.ts +32 -0
- package/src/DenoWorker.ts +75 -0
- package/src/DenoWorkerRunner.ts +175 -0
- package/src/index.ts +110 -0
- package/src/internal/denoSocketServer.ts +89 -0
- package/src/internal/error.ts +63 -0
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Deno-backed `KeyValueStore` layers using Web Storage APIs.
|
|
3
|
+
*
|
|
4
|
+
* @since 4.0.0
|
|
5
|
+
*/
|
|
6
|
+
import * as KeyValueStore from "effect/unstable/persistence/KeyValueStore";
|
|
7
|
+
/**
|
|
8
|
+
* Creates a `KeyValueStore` layer backed by `localStorage`, with values stored between sessions.
|
|
9
|
+
*
|
|
10
|
+
* @category layers
|
|
11
|
+
* @since 4.0.0
|
|
12
|
+
*/
|
|
13
|
+
export const layerLocalStorage = KeyValueStore.layerStorage(() => localStorage);
|
|
14
|
+
/**
|
|
15
|
+
* Creates a `KeyValueStore` layer backed by `sessionStorage`, with values stored only for the current session.
|
|
16
|
+
*
|
|
17
|
+
* @category layers
|
|
18
|
+
* @since 4.0.0
|
|
19
|
+
*/
|
|
20
|
+
export const layerSessionStorage = KeyValueStore.layerStorage(() => sessionStorage);
|
|
21
|
+
//# sourceMappingURL=DenoKeyValueStore.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DenoKeyValueStore.js","sourceRoot":"","sources":["../src/DenoKeyValueStore.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAGH,OAAO,KAAK,aAAa,MAAM,2CAA2C,CAAA;AAE1E;;;;;GAKG;AACH,MAAM,CAAC,MAAM,iBAAiB,GAA6C,aAAa,CAAC,YAAY,CAAC,GAAG,EAAE,CACzG,YAAY,CACb,CAAA;AAED;;;;;GAKG;AACH,MAAM,CAAC,MAAM,mBAAmB,GAA6C,aAAa,CAAC,YAAY,CAAC,GAAG,EAAE,CAC3G,cAAc,CACf,CAAA"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Web-standard helpers for parsing HTTP `multipart/form-data` request bodies.
|
|
3
|
+
*
|
|
4
|
+
* This module mirrors `BunMultipart`, adapting a web `Request` body and headers
|
|
5
|
+
* into the shared `Multipart` model. `stream` returns multipart parts as a
|
|
6
|
+
* `Stream`, while `persisted` collects the form and writes file parts to scoped
|
|
7
|
+
* temporary files through the current `FileSystem`, `Path`, and `Scope`
|
|
8
|
+
* services.
|
|
9
|
+
*
|
|
10
|
+
* @since 4.0.0
|
|
11
|
+
*/
|
|
12
|
+
import type * as Effect from "effect/Effect";
|
|
13
|
+
import type { FileSystem } from "effect/FileSystem";
|
|
14
|
+
import type { Path } from "effect/Path";
|
|
15
|
+
import type * as Scope from "effect/Scope";
|
|
16
|
+
import * as Stream from "effect/Stream";
|
|
17
|
+
import * as Multipart from "effect/unstable/http/Multipart";
|
|
18
|
+
/**
|
|
19
|
+
* Parses a web `Request` body as multipart data and returns a stream of multipart parts.
|
|
20
|
+
*
|
|
21
|
+
* @category constructors
|
|
22
|
+
* @since 4.0.0
|
|
23
|
+
*/
|
|
24
|
+
export declare const stream: (source: Request) => Stream.Stream<Multipart.Part, Multipart.MultipartError>;
|
|
25
|
+
/**
|
|
26
|
+
* Parses and persists multipart data from a web `Request`, requiring file-system, path, and scope services.
|
|
27
|
+
*
|
|
28
|
+
* @category constructors
|
|
29
|
+
* @since 4.0.0
|
|
30
|
+
*/
|
|
31
|
+
export declare const persisted: (source: Request) => Effect.Effect<Multipart.Persisted, Multipart.MultipartError, FileSystem | Path | Scope.Scope>;
|
|
32
|
+
//# sourceMappingURL=DenoMultipart.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DenoMultipart.d.ts","sourceRoot":"","sources":["../src/DenoMultipart.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AACH,OAAO,KAAK,KAAK,MAAM,MAAM,eAAe,CAAA;AAC5C,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAA;AACnD,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,aAAa,CAAA;AACvC,OAAO,KAAK,KAAK,KAAK,MAAM,cAAc,CAAA;AAC1C,OAAO,KAAK,MAAM,MAAM,eAAe,CAAA;AACvC,OAAO,KAAK,SAAS,MAAM,gCAAgC,CAAA;AAE3D;;;;;GAKG;AACH,eAAO,MAAM,MAAM,WAAY,OAAO,KAAG,MAAM,CAAC,MAAM,CAAC,SAAS,CAAC,IAAI,EAAE,SAAS,CAAC,cAAc,CAY5F,CAAA;AAEH;;;;;GAKG;AACH,eAAO,MAAM,SAAS,WACZ,OAAO,KACd,MAAM,CAAC,MAAM,CACd,SAAS,CAAC,SAAS,EACnB,SAAS,CAAC,cAAc,EACtB,UAAU,GACV,IAAI,GACJ,KAAK,CAAC,KAAK,CAC2B,CAAA"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import * as Stream from "effect/Stream";
|
|
2
|
+
import * as Multipart from "effect/unstable/http/Multipart";
|
|
3
|
+
/**
|
|
4
|
+
* Parses a web `Request` body as multipart data and returns a stream of multipart parts.
|
|
5
|
+
*
|
|
6
|
+
* @category constructors
|
|
7
|
+
* @since 4.0.0
|
|
8
|
+
*/
|
|
9
|
+
export const stream = (source) => Stream.fromReadableStream({
|
|
10
|
+
evaluate: () => source.body ?? new ReadableStream({
|
|
11
|
+
start(controller) {
|
|
12
|
+
controller.enqueue(new Uint8Array());
|
|
13
|
+
controller.close();
|
|
14
|
+
}
|
|
15
|
+
}),
|
|
16
|
+
onError: (cause) => Multipart.MultipartError.fromReason("InternalError", cause)
|
|
17
|
+
}).pipe(Stream.pipeThroughChannel(Multipart.makeChannel(Object.fromEntries(source.headers))));
|
|
18
|
+
/**
|
|
19
|
+
* Parses and persists multipart data from a web `Request`, requiring file-system, path, and scope services.
|
|
20
|
+
*
|
|
21
|
+
* @category constructors
|
|
22
|
+
* @since 4.0.0
|
|
23
|
+
*/
|
|
24
|
+
export const persisted = (source) => Multipart.toPersisted(stream(source));
|
|
25
|
+
//# sourceMappingURL=DenoMultipart.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DenoMultipart.js","sourceRoot":"","sources":["../src/DenoMultipart.ts"],"names":[],"mappings":"AAeA,OAAO,KAAK,MAAM,MAAM,eAAe,CAAA;AACvC,OAAO,KAAK,SAAS,MAAM,gCAAgC,CAAA;AAE3D;;;;;GAKG;AACH,MAAM,CAAC,MAAM,MAAM,GAAG,CAAC,MAAe,EAA2D,EAAE,CACjG,MAAM,CAAC,kBAAkB,CAAC;IACxB,QAAQ,EAAE,GAAG,EAAE,CACb,MAAM,CAAC,IAAI,IAAI,IAAI,cAAc,CAAC;QAChC,KAAK,CAAC,UAAU;YACd,UAAU,CAAC,OAAO,CAAC,IAAI,UAAU,EAAE,CAAC,CAAA;YACpC,UAAU,CAAC,KAAK,EAAE,CAAA;QACpB,CAAC;KACF,CAAC;IACJ,OAAO,EAAE,CAAC,KAAK,EAAE,EAAE,CAAC,SAAS,CAAC,cAAc,CAAC,UAAU,CAAC,eAAe,EAAE,KAAK,CAAC;CAChF,CAAC,CAAC,IAAI,CACL,MAAM,CAAC,kBAAkB,CAAC,SAAS,CAAC,WAAW,CAAC,MAAM,CAAC,WAAW,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC,CACrF,CAAA;AAEH;;;;;GAKG;AACH,MAAM,CAAC,MAAM,SAAS,GAAG,CACvB,MAAe,EAOf,EAAE,CAAC,SAAS,CAAC,WAAW,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,CAAA"}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Path service layers backed by the Deno Standard Library.
|
|
3
|
+
*
|
|
4
|
+
* **Example** (Using Deno path operations)
|
|
5
|
+
*
|
|
6
|
+
* ```ts import.meta.vitest
|
|
7
|
+
* import { Effect, Path } from "effect"
|
|
8
|
+
* import { DenoPath } from "@effect/platform-deno"
|
|
9
|
+
*
|
|
10
|
+
* const program = Effect.gen(function*() {
|
|
11
|
+
* const path = yield* Path.Path
|
|
12
|
+
* return path.extname("file.txt")
|
|
13
|
+
* }).pipe(Effect.provide(DenoPath.layer))
|
|
14
|
+
*
|
|
15
|
+
* Effect.runSync(program) // => ".txt"
|
|
16
|
+
* ```
|
|
17
|
+
*
|
|
18
|
+
* @since 4.0.0
|
|
19
|
+
*/
|
|
20
|
+
import * as Layer from "effect/Layer";
|
|
21
|
+
import * as Path from "effect/Path";
|
|
22
|
+
/**
|
|
23
|
+
* A {@linkplain Layer.Layer | layer} that provides POSIX path operations.
|
|
24
|
+
*
|
|
25
|
+
* @category layers
|
|
26
|
+
* @since 4.0.0
|
|
27
|
+
*/
|
|
28
|
+
export declare const layerPosix: Layer.Layer<Path.Path>;
|
|
29
|
+
/**
|
|
30
|
+
* A {@linkplain Layer.Layer | layer} that provides Windows path operations.
|
|
31
|
+
*
|
|
32
|
+
* @category layers
|
|
33
|
+
* @since 4.0.0
|
|
34
|
+
*/
|
|
35
|
+
export declare const layerWin32: Layer.Layer<Path.Path>;
|
|
36
|
+
/**
|
|
37
|
+
* A {@linkplain Layer.Layer | layer} that provides OS-agnostic path operations.
|
|
38
|
+
*
|
|
39
|
+
* @category layers
|
|
40
|
+
* @since 4.0.0
|
|
41
|
+
*/
|
|
42
|
+
export declare const layer: Layer.Layer<Path.Path>;
|
|
43
|
+
//# sourceMappingURL=DenoPath.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DenoPath.d.ts","sourceRoot":"","sources":["../src/DenoPath.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAMH,OAAO,KAAK,KAAK,MAAM,cAAc,CAAA;AACrC,OAAO,KAAK,IAAI,MAAM,aAAa,CAAA;AA6BnC;;;;;GAKG;AACH,eAAO,MAAM,UAAU,EAAE,KAAK,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI,CAO7C,CAAA;AAED;;;;;GAKG;AACH,eAAO,MAAM,UAAU,EAAE,KAAK,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI,CAS7C,CAAA;AAED;;;;;GAKG;AACH,eAAO,MAAM,KAAK,EAAE,KAAK,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI,CASxC,CAAA"}
|
package/dist/DenoPath.js
ADDED
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Path service layers backed by the Deno Standard Library.
|
|
3
|
+
*
|
|
4
|
+
* **Example** (Using Deno path operations)
|
|
5
|
+
*
|
|
6
|
+
* ```ts import.meta.vitest
|
|
7
|
+
* import { Effect, Path } from "effect"
|
|
8
|
+
* import { DenoPath } from "@effect/platform-deno"
|
|
9
|
+
*
|
|
10
|
+
* const program = Effect.gen(function*() {
|
|
11
|
+
* const path = yield* Path.Path
|
|
12
|
+
* return path.extname("file.txt")
|
|
13
|
+
* }).pipe(Effect.provide(DenoPath.layer))
|
|
14
|
+
*
|
|
15
|
+
* Effect.runSync(program) // => ".txt"
|
|
16
|
+
* ```
|
|
17
|
+
*
|
|
18
|
+
* @since 4.0.0
|
|
19
|
+
*/
|
|
20
|
+
import * as DenoPath from "@std/path";
|
|
21
|
+
import * as DenoPathPosix from "@std/path/posix";
|
|
22
|
+
import * as DenoPathWin from "@std/path/windows";
|
|
23
|
+
import * as Effect from "effect/Effect";
|
|
24
|
+
import * as Layer from "effect/Layer";
|
|
25
|
+
import * as Path from "effect/Path";
|
|
26
|
+
import * as PlatformError from "effect/PlatformError";
|
|
27
|
+
const fileUrlOps = (impl) => ({
|
|
28
|
+
fromFileUrl: (url) => Effect.try({
|
|
29
|
+
try: () => impl.fromFileUrl(url),
|
|
30
|
+
catch: (cause) => new PlatformError.BadArgument({
|
|
31
|
+
module: "Path",
|
|
32
|
+
method: "fromFileUrl",
|
|
33
|
+
cause
|
|
34
|
+
})
|
|
35
|
+
}),
|
|
36
|
+
toFileUrl: (path) => Effect.try({
|
|
37
|
+
try: () => impl.toFileUrl(path),
|
|
38
|
+
catch: (cause) => new PlatformError.BadArgument({
|
|
39
|
+
module: "Path",
|
|
40
|
+
method: "toFileUrl",
|
|
41
|
+
cause
|
|
42
|
+
})
|
|
43
|
+
})
|
|
44
|
+
});
|
|
45
|
+
/**
|
|
46
|
+
* A {@linkplain Layer.Layer | layer} that provides POSIX path operations.
|
|
47
|
+
*
|
|
48
|
+
* @category layers
|
|
49
|
+
* @since 4.0.0
|
|
50
|
+
*/
|
|
51
|
+
export const layerPosix = Layer.succeed(Path.Path)(Path.Path.of({
|
|
52
|
+
[Path.TypeId]: Path.TypeId,
|
|
53
|
+
...DenoPathPosix,
|
|
54
|
+
sep: DenoPathPosix.SEPARATOR,
|
|
55
|
+
...fileUrlOps(DenoPathPosix)
|
|
56
|
+
}));
|
|
57
|
+
/**
|
|
58
|
+
* A {@linkplain Layer.Layer | layer} that provides Windows path operations.
|
|
59
|
+
*
|
|
60
|
+
* @category layers
|
|
61
|
+
* @since 4.0.0
|
|
62
|
+
*/
|
|
63
|
+
export const layerWin32 = Layer.succeed(Path.Path)(Path.Path.of({
|
|
64
|
+
[Path.TypeId]: Path.TypeId,
|
|
65
|
+
...DenoPathWin,
|
|
66
|
+
sep: DenoPathWin.SEPARATOR,
|
|
67
|
+
...fileUrlOps(DenoPathWin)
|
|
68
|
+
}));
|
|
69
|
+
/**
|
|
70
|
+
* A {@linkplain Layer.Layer | layer} that provides OS-agnostic path operations.
|
|
71
|
+
*
|
|
72
|
+
* @category layers
|
|
73
|
+
* @since 4.0.0
|
|
74
|
+
*/
|
|
75
|
+
export const layer = Layer.succeed(Path.Path)(Path.Path.of({
|
|
76
|
+
[Path.TypeId]: Path.TypeId,
|
|
77
|
+
...DenoPath,
|
|
78
|
+
sep: DenoPath.SEPARATOR,
|
|
79
|
+
...fileUrlOps(DenoPath)
|
|
80
|
+
}));
|
|
81
|
+
//# sourceMappingURL=DenoPath.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DenoPath.js","sourceRoot":"","sources":["../src/DenoPath.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAEH,OAAO,KAAK,QAAQ,MAAM,WAAW,CAAA;AACrC,OAAO,KAAK,aAAa,MAAM,iBAAiB,CAAA;AAChD,OAAO,KAAK,WAAW,MAAM,mBAAmB,CAAA;AAChD,OAAO,KAAK,MAAM,MAAM,eAAe,CAAA;AACvC,OAAO,KAAK,KAAK,MAAM,cAA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,EAAE,CAAC;IACX,CAAC,IAAI,CAAC,MAAM,CAAC,EAAE,IAAI,CAAC,MAAM;IAC1B,GAAG,WAAW;IACd,GAAG,EAAE,WAAW,CAAC,SAAS;IAC1B,GAAG,UAAU,CAAC,WAAW,CAAC;CAC3B,CAAC,CACH,CAAA;AAED;;;;;GAKG;AACH,MAAM,CAAC,MAAM,KAAK,GAA2B,KAAK,CAAC,OAAO,CACxD,IAAI,CAAC,IAAI,CACV,CACC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC;IACX,CAAC,IAAI,CAAC,MAAM,CAAC,EAAE,IAAI,CAAC,MAAM;IAC1B,GAAG,QAAQ;IACX,GAAG,EAAE,QAAQ,CAAC,SAAS;IACvB,GAAG,UAAU,CAAC,QAAQ,CAAC;CACxB,CAAC,CACH,CAAA"}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Deno Redis integration backed by `@db/redis`.
|
|
3
|
+
*
|
|
4
|
+
* This module creates a scoped, native Deno Redis client and exposes it as
|
|
5
|
+
* both the portable `Redis` service and the Deno-specific {@link DenoRedis}
|
|
6
|
+
* service for direct access to the raw client. Unlike Bun's built-in client,
|
|
7
|
+
* `@db/redis` connects eagerly using RESP2, so layer construction can fail
|
|
8
|
+
* with a `RedisError`.
|
|
9
|
+
*
|
|
10
|
+
* @since 4.0.0
|
|
11
|
+
*/
|
|
12
|
+
import { type Redis as RedisClient, type RedisConnectOptions } from "@db/redis";
|
|
13
|
+
import * as Config from "effect/Config";
|
|
14
|
+
import * as Context from "effect/Context";
|
|
15
|
+
import * as Effect from "effect/Effect";
|
|
16
|
+
import * as Layer from "effect/Layer";
|
|
17
|
+
import * as Redis from "effect/unstable/persistence/Redis";
|
|
18
|
+
/**
|
|
19
|
+
* Options for connecting to Redis, including a Redis URL or individual
|
|
20
|
+
* connection settings. Explicit settings override values from the URL.
|
|
21
|
+
*
|
|
22
|
+
* @category models
|
|
23
|
+
* @since 4.0.0
|
|
24
|
+
*/
|
|
25
|
+
export type RedisOptions = Omit<RedisConnectOptions, "hostname"> & {
|
|
26
|
+
readonly hostname?: string;
|
|
27
|
+
readonly url?: string;
|
|
28
|
+
};
|
|
29
|
+
declare const DenoRedis_base: Context.ServiceClass<DenoRedis, "@effect/platform-deno/DenoRedis", {
|
|
30
|
+
readonly client: RedisClient;
|
|
31
|
+
readonly use: <A>(f: (client: RedisClient) => Promise<A>) => Effect.Effect<A, Redis.RedisError>;
|
|
32
|
+
}>;
|
|
33
|
+
/**
|
|
34
|
+
* Service tag for Deno Redis integration, exposing the raw `@db/redis` client
|
|
35
|
+
* and a `use` helper that maps client promise failures to `RedisError`.
|
|
36
|
+
*
|
|
37
|
+
* @category services
|
|
38
|
+
* @since 4.0.0
|
|
39
|
+
*/
|
|
40
|
+
export declare class DenoRedis extends DenoRedis_base {
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* Provides `Redis` and `DenoRedis` services backed by an `@db/redis` client,
|
|
44
|
+
* closing the client when the layer scope ends. URL-derived options can be
|
|
45
|
+
* overridden by other supplied options.
|
|
46
|
+
*
|
|
47
|
+
* @category layers
|
|
48
|
+
* @since 4.0.0
|
|
49
|
+
*/
|
|
50
|
+
export declare const layer: (options?: RedisOptions | undefined) => Layer.Layer<Redis.Redis | DenoRedis, Redis.RedisError>;
|
|
51
|
+
/**
|
|
52
|
+
* Provides `Redis` and `DenoRedis` services from `Config`-backed options,
|
|
53
|
+
* closing the client when the layer scope ends.
|
|
54
|
+
*
|
|
55
|
+
* @category layers
|
|
56
|
+
* @since 4.0.0
|
|
57
|
+
*/
|
|
58
|
+
export declare const layerConfig: (options: Config.Wrap<RedisOptions>) => Layer.Layer<Redis.Redis | DenoRedis, Redis.RedisError | Config.ConfigError>;
|
|
59
|
+
export {};
|
|
60
|
+
//# sourceMappingURL=DenoRedis.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DenoRedis.d.ts","sourceRoot":"","sources":["../src/Den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redis`.
|
|
3
|
+
*
|
|
4
|
+
* This module creates a scoped, native Deno Redis client and exposes it as
|
|
5
|
+
* both the portable `Redis` service and the Deno-specific {@link DenoRedis}
|
|
6
|
+
* service for direct access to the raw client. Unlike Bun's built-in client,
|
|
7
|
+
* `@db/redis` connects eagerly using RESP2, so layer construction can fail
|
|
8
|
+
* with a `RedisError`.
|
|
9
|
+
*
|
|
10
|
+
* @since 4.0.0
|
|
11
|
+
*/
|
|
12
|
+
import { connect, parseURL } from "@db/redis";
|
|
13
|
+
import * as Config from "effect/Config";
|
|
14
|
+
import * as Context from "effect/Context";
|
|
15
|
+
import * as Effect from "effect/Effect";
|
|
16
|
+
import * as Fn from "effect/Function";
|
|
17
|
+
import * as Layer from "effect/Layer";
|
|
18
|
+
import * as Predicate from "effect/Predicate";
|
|
19
|
+
import * as Record from "effect/Record";
|
|
20
|
+
import * as Redis from "effect/unstable/persistence/Redis";
|
|
21
|
+
/**
|
|
22
|
+
* Service tag for Deno Redis integration, exposing the raw `@db/redis` client
|
|
23
|
+
* and a `use` helper that maps client promise failures to `RedisError`.
|
|
24
|
+
*
|
|
25
|
+
* @category services
|
|
26
|
+
* @since 4.0.0
|
|
27
|
+
*/
|
|
28
|
+
export class DenoRedis extends Context.Service()("@effect/platform-deno/DenoRedis") {
|
|
29
|
+
}
|
|
30
|
+
const make = Effect.fnUntraced(function* (options = {}) {
|
|
31
|
+
const client = yield* Effect.acquireRelease(Effect.tryPromise({
|
|
32
|
+
try: () => {
|
|
33
|
+
const { url, ...connectOptions } = options;
|
|
34
|
+
const { name, ...parsed } = url === undefined ? { hostname: "localhost" } : parseURL(url);
|
|
35
|
+
return connect({
|
|
36
|
+
...parsed,
|
|
37
|
+
...(name === undefined ? {} : { username: name }),
|
|
38
|
+
...Record.filter(connectOptions, Predicate.isNotUndefined)
|
|
39
|
+
});
|
|
40
|
+
},
|
|
41
|
+
catch: (cause) => new Redis.RedisError({ cause })
|
|
42
|
+
}), (client) => Effect.sync(() => client.close()));
|
|
43
|
+
const use = (f) => Effect.tryPromise({
|
|
44
|
+
try: () => f(client),
|
|
45
|
+
catch: (cause) => new Redis.RedisError({ cause })
|
|
46
|
+
});
|
|
47
|
+
const redis = yield* Redis.make({
|
|
48
|
+
send: (command, ...args) => Effect.tryPromise({
|
|
49
|
+
try: () => client.sendCommand(command, args),
|
|
50
|
+
catch: (cause) => new Redis.RedisError({ cause })
|
|
51
|
+
})
|
|
52
|
+
});
|
|
53
|
+
const denoRedis = Fn.identity({
|
|
54
|
+
client,
|
|
55
|
+
use
|
|
56
|
+
});
|
|
57
|
+
return Context.make(DenoRedis, denoRedis).pipe(Context.add(Redis.Redis, redis));
|
|
58
|
+
});
|
|
59
|
+
/**
|
|
60
|
+
* Provides `Redis` and `DenoRedis` services backed by an `@db/redis` client,
|
|
61
|
+
* closing the client when the layer scope ends. URL-derived options can be
|
|
62
|
+
* overridden by other supplied options.
|
|
63
|
+
*
|
|
64
|
+
* @category layers
|
|
65
|
+
* @since 4.0.0
|
|
66
|
+
*/
|
|
67
|
+
export const layer = (options) => Layer.effectContext(make(options));
|
|
68
|
+
/**
|
|
69
|
+
* Provides `Redis` and `DenoRedis` services from `Config`-backed options,
|
|
70
|
+
* closing the client when the layer scope ends.
|
|
71
|
+
*
|
|
72
|
+
* @category layers
|
|
73
|
+
* @since 4.0.0
|
|
74
|
+
*/
|
|
75
|
+
export const layerConfig = (options) => Layer.effectContext(Config.unwrap(options).pipe(Effect.flatMap(make)));
|
|
76
|
+
//# sourceMappingURL=DenoRedis.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DenoRedis.js","sourceRoot":"","sources":["../src/DenoRedis.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AACH,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAuD,MAAM,WAAW,CAAA;AAClG,OAAO,KAAK,MAAM,MAAM,eAAe,CAAA;AACvC,OAAO,KAAK,OAAO,MAAM,gBAAgB,CAAA;AACzC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CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,IAAI,CACzB,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,CACrB,CACF,CAAA"}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Deno helper for running a root Effect program.
|
|
3
|
+
*
|
|
4
|
+
* @since 4.0.0
|
|
5
|
+
*/
|
|
6
|
+
import type { Effect } from "effect/Effect";
|
|
7
|
+
import * as Runtime from "effect/Runtime";
|
|
8
|
+
/**
|
|
9
|
+
* Run an Effect as the entrypoint to a Deno application.
|
|
10
|
+
*
|
|
11
|
+
* @category running
|
|
12
|
+
* @since 4.0.0
|
|
13
|
+
*/
|
|
14
|
+
export declare const runMain: {
|
|
15
|
+
/**
|
|
16
|
+
* Run an Effect as the entrypoint to a Deno application.
|
|
17
|
+
*
|
|
18
|
+
* @category running
|
|
19
|
+
* @since 4.0.0
|
|
20
|
+
*/
|
|
21
|
+
(options?: {
|
|
22
|
+
readonly disableErrorReporting?: boolean | undefined;
|
|
23
|
+
readonly teardown?: Runtime.Teardown | undefined;
|
|
24
|
+
}): <E, A>(effect: Effect<A, E>) => void;
|
|
25
|
+
/**
|
|
26
|
+
* Run an Effect as the entrypoint to a Deno application.
|
|
27
|
+
*
|
|
28
|
+
* @category running
|
|
29
|
+
* @since 4.0.0
|
|
30
|
+
*/
|
|
31
|
+
<E, A>(effect: Effect<A, E>, options?: {
|
|
32
|
+
readonly disableErrorReporting?: boolean | undefined;
|
|
33
|
+
readonly teardown?: Runtime.Teardown | undefined;
|
|
34
|
+
}): void;
|
|
35
|
+
};
|
|
36
|
+
//# sourceMappingURL=DenoRuntime.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DenoRuntime.d.ts","sourceRoot":"","sources":["../src/DenoRuntime.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,eAAe,CAAA;AAC3C,OAAO,KAAK,OAAO,MAAM,gBAAgB,CAAA;AAEzC;;;;;GAKG;AAEH,eAAO,MAAM,OAAO,EAAE;IACpB;;;;;OAKG;IAEH,CACE,OAAO,CAAC,EAAE;QACR,QAAQ,CAAC,qBAAqB,CAAC,EAAE,OAAO,GAAG,SAAS,CAAA;QACpD,QAAQ,CAAC,QAAQ,CAAC,EAAE,OAAO,CAAC,QAAQ,GAAG,SAAS,CAAA;KACjD,GACA,CAAC,CAAC,EAAE,CAAC,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC,EAAE,CAAC,CAAC,KAAK,IAAI,CAAA;IACvC;;;;;OAKG;IAEH,CAAC,CAAC,EAAE,CAAC,EACH,MAAM,EAAE,MAAM,CAAC,CAAC,EAAE,CAAC,CAAC,EACpB,OAAO,CAAC,EAAE;QACR,QAAQ,CAAC,qBAAqB,CAAC,EAAE,OAAO,GAAG,SAAS,CAAA;QACpD,QAAQ,CAAC,QAAQ,CAAC,EAAE,OAAO,CAAC,QAAQ,GAAG,SAAS,CAAA;KACjD,GACA,IAAI,CAAA;CA6BP,CAAA"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Deno helper for running a root Effect program.
|
|
3
|
+
*
|
|
4
|
+
* @since 4.0.0
|
|
5
|
+
*/
|
|
6
|
+
import * as Runtime from "effect/Runtime";
|
|
7
|
+
/**
|
|
8
|
+
* Run an Effect as the entrypoint to a Deno application.
|
|
9
|
+
*
|
|
10
|
+
* @category running
|
|
11
|
+
* @since 4.0.0
|
|
12
|
+
*/
|
|
13
|
+
export const runMain = Runtime.makeRunMain(({ fiber, teardown }) => {
|
|
14
|
+
let receivedSignal = false;
|
|
15
|
+
fiber.addObserver((exit) => {
|
|
16
|
+
if (!receivedSignal) {
|
|
17
|
+
Deno.removeSignalListener("SIGINT", onSigint);
|
|
18
|
+
Deno.removeSignalListener("SIGTERM", onSigint);
|
|
19
|
+
}
|
|
20
|
+
teardown(exit, (code) => {
|
|
21
|
+
if (receivedSignal || code !== 0) {
|
|
22
|
+
Deno.exit(code);
|
|
23
|
+
}
|
|
24
|
+
});
|
|
25
|
+
});
|
|
26
|
+
function onSigint() {
|
|
27
|
+
receivedSignal = true;
|
|
28
|
+
Deno.removeSignalListener("SIGINT", onSigint);
|
|
29
|
+
Deno.removeSignalListener("SIGTERM", onSigint);
|
|
30
|
+
fiber.interruptUnsafe(fiber.id);
|
|
31
|
+
}
|
|
32
|
+
Deno.addSignalListener("SIGINT", onSigint);
|
|
33
|
+
Deno.addSignalListener("SIGTERM", onSigint);
|
|
34
|
+
});
|
|
35
|
+
//# sourceMappingURL=DenoRuntime.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DenoRuntime.js","sourceRoot":"","sources":["../src/DenoRuntime.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAGH,OAAO,KAAK,OAAO,MAAM,gBAAgB,CAAA;AAEzC;;;;;GAKG;AAEH,MAAM,CAAC,MAAM,OAAO,GA4BhB,OAAO,CAAC,WAAW,CAAC,CAAC,EACvB,KAAK,EACL,QAAQ,EACT,EAAE,EAAE;IACH,IAAI,cAAc,GAAG,KAAK,CAAA;IAE1B,KAAK,CAAC,WAAW,CAAC,CAAC,IAAI,EAAE,EAAE;QACzB,IAAI,CAAC,cAAc,EAAE,CAAC;YACpB,IAAI,CAAC,oBAAoB,CAAC,QAAQ,EAAE,QAAQ,CAAC,CAAA;YAC7C,IAAI,CAAC,oBAAoB,CAAC,SAAS,EAAE,QAAQ,CAAC,CAAA;QAChD,CAAC;QAED,QAAQ,CAAC,IAAI,EAAE,CAAC,IAAI,EAAE,EAAE;YACtB,IAAI,cAAc,IAAI,IAAI,KAAK,CAAC,EAAE,CAAC;gBACjC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA;YACjB,CAAC;QACH,CAAC,CAAC,CAAA;IACJ,CAAC,CAAC,CAAA;IAEF,SAAS,QAAQ;QACf,cAAc,GAAG,IAAI,CAAA;QACrB,IAAI,CAAC,oBAAoB,CAAC,QAAQ,EAAE,QAAQ,CAAC,CAAA;QAC7C,IAAI,CAAC,oBAAoB,CAAC,SAAS,EAAE,QAAQ,CAAC,CAAA;QAC9C,KAAK,CAAC,eAAe,CAAC,KAAK,CAAC,EAAE,CAAC,CAAA;IACjC,CAAC;IAED,IAAI,CAAC,iBAAiB,CAAC,QAAQ,EAAE,QAAQ,CAAC,CAAA;IAC1C,IAAI,CAAC,iBAAiB,CAAC,SAAS,EAAE,QAAQ,CAAC,CAAA;AAC7C,CAAC,CAAC,CAAA"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Aggregate Deno platform services layer.
|
|
3
|
+
*
|
|
4
|
+
* This module defines the `DenoServices` union and a single `layer` that
|
|
5
|
+
* provides Deno-backed child process spawning, crypto, filesystem, path, stdio,
|
|
6
|
+
* and terminal services. Use the layer when a Deno program wants the standard
|
|
7
|
+
* platform services from one place.
|
|
8
|
+
*
|
|
9
|
+
* @since 4.0.0
|
|
10
|
+
*/
|
|
11
|
+
import type { Crypto } from "effect/Crypto";
|
|
12
|
+
import type { FileSystem } from "effect/FileSystem";
|
|
13
|
+
import * as Layer from "effect/Layer";
|
|
14
|
+
import type { Path } from "effect/Path";
|
|
15
|
+
import type { Stdio } from "effect/Stdio";
|
|
16
|
+
import type { Terminal } from "effect/Terminal";
|
|
17
|
+
import type { ChildProcessSpawner } from "effect/unstable/process/ChildProcessSpawner";
|
|
18
|
+
/**
|
|
19
|
+
* The union of core services provided by the Deno platform layer, including
|
|
20
|
+
* child process spawning, crypto, filesystem, path, stdio, and terminal services.
|
|
21
|
+
*
|
|
22
|
+
* @category models
|
|
23
|
+
* @since 4.0.0
|
|
24
|
+
*/
|
|
25
|
+
export type DenoServices = ChildProcessSpawner | Crypto | FileSystem | Path | Terminal | Stdio;
|
|
26
|
+
/**
|
|
27
|
+
* Provides the default Deno implementations for child process spawning,
|
|
28
|
+
* crypto, filesystem, path, stdio, and terminal services.
|
|
29
|
+
*
|
|
30
|
+
* @category layers
|
|
31
|
+
* @since 4.0.0
|
|
32
|
+
*/
|
|
33
|
+
export declare const layer: Layer.Layer<DenoServices>;
|
|
34
|
+
//# sourceMappingURL=DenoServices.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DenoServices.d.ts","sourceRoot":"","sources":["../src/DenoServices.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;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,YAAY,GAAG,mBAAmB,GAAG,MAAM,GAAG,UAAU,GAAG,IAAI,GAAG,QAAQ,GAAG,KAAK,CAAA;AAE9F;;;;;;GAMG;AACH,eAAO,MAAM,KAAK,EAAE,KAAK,CAAC,KAAK,CAAC,YAAY,CAQ3C,CAAA"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import * as Layer from "effect/Layer";
|
|
2
|
+
import * as DenoChildProcessSpawner from "./DenoChildProcessSpawner.js";
|
|
3
|
+
import * as DenoCrypto from "./DenoCrypto.js";
|
|
4
|
+
import * as DenoFileSystem from "./DenoFileSystem.js";
|
|
5
|
+
import * as DenoPath from "./DenoPath.js";
|
|
6
|
+
import * as DenoStdio from "./DenoStdio.js";
|
|
7
|
+
import * as DenoTerminal from "./DenoTerminal.js";
|
|
8
|
+
/**
|
|
9
|
+
* Provides the default Deno implementations for child process spawning,
|
|
10
|
+
* crypto, filesystem, path, stdio, and terminal services.
|
|
11
|
+
*
|
|
12
|
+
* @category layers
|
|
13
|
+
* @since 4.0.0
|
|
14
|
+
*/
|
|
15
|
+
export const layer = DenoChildProcessSpawner.layer.pipe(Layer.provideMerge(Layer.mergeAll(DenoFileSystem.layer, DenoCrypto.layer, DenoPath.layer, DenoStdio.layer, DenoTerminal.layer)));
|
|
16
|
+
//# sourceMappingURL=DenoServices.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DenoServices.js","sourceRoot":"","sources":["../src/DenoServices.ts"],"names":[],"mappings":"AAYA,OAAO,KAAK,KAAK,MAAM,cAAc,CAAA;AAKrC,OAAO,KAAK,uBAAuB,MAAM,8BAA8B,CAAA;AACvE,OAAO,KAAK,UAAU,MAAM,iBAAiB,CAAA;AAC7C,OAAO,KAAK,cAAc,MAAM,qBAAqB,CAAA;AACrD,OAAO,KAAK,QAAQ,MAAM,eAAe,CAAA;AACzC,OAAO,KAAK,SAAS,MAAM,gBAAgB,CAAA;AAC3C,OAAO,KAAK,YAAY,MAAM,mBAAmB,CAAA;AAWjD;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,KAAK,GAA8B,uBAAuB,CAAC,KAAK,CAAC,IAAI,CAChF,KAAK,CAAC,YAAY,CAAC,KAAK,CAAC,QAAQ,CAC/B,cAAc,CAAC,KAAK,EACpB,UAAU,CAAC,KAAK,EAChB,QAAQ,CAAC,KAAK,EACd,SAAS,CAAC,KAAK,EACf,YAAY,CAAC,KAAK,CACnB,CAAC,CACH,CAAA"}
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Native Deno socket adapters for Effect sockets.
|
|
3
|
+
*
|
|
4
|
+
* This module uses Deno-specific names: `makeTcp`, `makeTcpChannel`,
|
|
5
|
+
* `layerTcp`, and `fromConn` correspond to the Node platform's net and duplex
|
|
6
|
+
* APIs. Deno does not support `keepAliveInitialDelay`, and the `noDelay` and
|
|
7
|
+
* `keepAlive` options have no effect on Unix connections. A `CloseEvent` always
|
|
8
|
+
* closes gracefully because Deno has no equivalent of Node's reset-on-close.
|
|
9
|
+
*
|
|
10
|
+
* @since 4.0.0
|
|
11
|
+
*/
|
|
12
|
+
import type { Array } from "effect";
|
|
13
|
+
import * as Channel from "effect/Channel";
|
|
14
|
+
import * as Context from "effect/Context";
|
|
15
|
+
import type * as Duration from "effect/Duration";
|
|
16
|
+
import * as Effect from "effect/Effect";
|
|
17
|
+
import * as Layer from "effect/Layer";
|
|
18
|
+
import * as Scope from "effect/Scope";
|
|
19
|
+
import * as Socket from "effect/unstable/socket/Socket";
|
|
20
|
+
/**
|
|
21
|
+
* Options for opening a TCP or Unix connection.
|
|
22
|
+
*
|
|
23
|
+
* @category options
|
|
24
|
+
* @since 4.0.0
|
|
25
|
+
*/
|
|
26
|
+
export type ConnectOptions = (Deno.ConnectOptions | Deno.UnixConnectOptions) & {
|
|
27
|
+
readonly noDelay?: boolean | undefined;
|
|
28
|
+
readonly keepAlive?: boolean | undefined;
|
|
29
|
+
};
|
|
30
|
+
/**
|
|
31
|
+
* Options for opening a TCP or Unix connection.
|
|
32
|
+
*
|
|
33
|
+
* @category options
|
|
34
|
+
* @since 4.0.0
|
|
35
|
+
*/
|
|
36
|
+
export type TcpOptions = ConnectOptions & {
|
|
37
|
+
readonly openTimeout?: Duration.Input | undefined;
|
|
38
|
+
};
|
|
39
|
+
declare const Conn_base: Context.ServiceClass<Conn, "@effect/platform-deno/DenoSocket/Conn", Deno.Conn<Deno.Addr>>;
|
|
40
|
+
/**
|
|
41
|
+
* Service tag for the underlying Deno connection.
|
|
42
|
+
*
|
|
43
|
+
* @category services
|
|
44
|
+
* @since 4.0.0
|
|
45
|
+
*/
|
|
46
|
+
export declare class Conn extends Conn_base {
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* Adapts a Deno connection into an Effect socket.
|
|
50
|
+
*
|
|
51
|
+
* @category constructors
|
|
52
|
+
* @since 4.0.0
|
|
53
|
+
*/
|
|
54
|
+
export declare const fromConn: <RO>(open: Effect.Effect<Deno.Conn, Socket.SocketError, RO>) => Effect.Effect<Socket.Socket, never, Exclude<RO, Scope.Scope>>;
|
|
55
|
+
/**
|
|
56
|
+
* Opens a native Deno TCP or Unix connection as an Effect socket.
|
|
57
|
+
*
|
|
58
|
+
* **Details**
|
|
59
|
+
*
|
|
60
|
+
* An `openTimeout` interrupts acquisition but cannot cancel the in-flight
|
|
61
|
+
* `Deno.connect` promise. The scope finalizer closes a connection that arrives
|
|
62
|
+
* after the timeout.
|
|
63
|
+
*
|
|
64
|
+
* @category constructors
|
|
65
|
+
* @since 4.0.0
|
|
66
|
+
*/
|
|
67
|
+
export declare const makeTcp: (options: TcpOptions) => Effect.Effect<Socket.Socket>;
|
|
68
|
+
/**
|
|
69
|
+
* Creates a channel over a native Deno TCP or Unix connection.
|
|
70
|
+
*
|
|
71
|
+
* @category constructors
|
|
72
|
+
* @since 4.0.0
|
|
73
|
+
*/
|
|
74
|
+
export declare const makeTcpChannel: <IE = never>(options: ConnectOptions) => Channel.Channel<Array.NonEmptyReadonlyArray<Uint8Array>, Socket.SocketError | IE, void, Array.NonEmptyReadonlyArray<Uint8Array | string | Socket.CloseEvent>, IE>;
|
|
75
|
+
/**
|
|
76
|
+
* Provides a socket by opening a native Deno TCP or Unix connection.
|
|
77
|
+
*
|
|
78
|
+
* @category layers
|
|
79
|
+
* @since 4.0.0
|
|
80
|
+
*/
|
|
81
|
+
export declare const layerTcp: (options: ConnectOptions) => Layer.Layer<Socket.Socket, Socket.SocketError>;
|
|
82
|
+
/**
|
|
83
|
+
* Creates a socket layer connected to a URL with Deno's global WebSocket.
|
|
84
|
+
*
|
|
85
|
+
* @category layers
|
|
86
|
+
* @since 4.0.0
|
|
87
|
+
*/
|
|
88
|
+
export declare const layerWebSocket: (url: string, options?: {
|
|
89
|
+
readonly closeCodeIsError?: (code: number) => boolean;
|
|
90
|
+
}) => Layer.Layer<Socket.Socket>;
|
|
91
|
+
/**
|
|
92
|
+
* Provides the WebSocket constructor backed by `globalThis.WebSocket`.
|
|
93
|
+
*
|
|
94
|
+
* @category layers
|
|
95
|
+
* @since 4.0.0
|
|
96
|
+
*/
|
|
97
|
+
export declare const layerWebSocketConstructor: Layer.Layer<Socket.WebSocketConstructor>;
|
|
98
|
+
export {};
|
|
99
|
+
//# sourceMappingURL=DenoSocket.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DenoSocket.d.ts","sourceRoot":"","sources":["../src/DenoSocket.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AACH,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,QAAQ,CAAA;AACnC,OAAO,KAAK,OAAO,MAAM,gBAAgB,CAAA;AACzC,OAAO,KAAK,OAAO,MAAM,gBAAgB,CAAA;AAEzC,OAAO,KAAK,KAAK,QAAQ,MAAM,iBAAiB,CAAA;AAChD,OAAO,KAAK,MAAM,MAAM,eAAe,CAAA;AAIvC,OAAO,KAAK,KAAK,MAAM,cAAc,CAAA;AACrC,OAAO,KAAK,KAAK,MAAM,cAAc,CAAA;AACrC,OAAO,KAAK,MAAM,MAAM,+BAA+B,CAAA;AAEvD;;;;;GAKG;AACH,MAAM,MAAM,cAAc,GAAG,CAAC,IAAI,CAAC,cAAc,GAAG,IAAI,CAAC,kBAAkB,CAAC,GAAG;IAC7E,QAAQ,CAAC,OAAO,CAAC,EAAE,OAAO,GAAG,SAAS,CAAA;IACtC,QAAQ,CAAC,SAAS,CAAC,EAAE,OAAO,GAAG,SAAS,CAAA;CACzC,CAAA;AAED;;;;;GAKG;AACH,MAAM,MAAM,UAAU,GAAG,cAAc,GAAG;IACxC,QAAQ,CAAC,WAAW,CAAC,EAAE,QAAQ,CAAC,KAAK,GAAG,SAAS,CAAA;CAClD,CAAA;;AAED;;;;;GAKG;AACH,qBAAa,IAAK,SAAQ,SAEzB;CAAG;AAEJ;;;;;GAKG;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