@effect/platform-bun 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (126) hide show
  1. package/BunContext.d.ts +15 -0
  2. package/BunContext.d.ts.map +1 -0
  3. package/BunContext.js +23 -0
  4. package/BunContext.js.map +1 -0
  5. package/Command.d.ts +111 -0
  6. package/Command.d.ts.map +1 -0
  7. package/Command.js +103 -0
  8. package/Command.js.map +1 -0
  9. package/CommandExecutor.d.ts +41 -0
  10. package/CommandExecutor.d.ts.map +1 -0
  11. package/CommandExecutor.js +19 -0
  12. package/CommandExecutor.js.map +1 -0
  13. package/Effectify.d.ts +19 -0
  14. package/Effectify.d.ts.map +1 -0
  15. package/Effectify.js +13 -0
  16. package/Effectify.js.map +1 -0
  17. package/Error.d.ts +30 -0
  18. package/Error.d.ts.map +1 -0
  19. package/Error.js +25 -0
  20. package/Error.js.map +1 -0
  21. package/FileSystem.d.ts +71 -0
  22. package/FileSystem.d.ts.map +1 -0
  23. package/FileSystem.js +25 -0
  24. package/FileSystem.js.map +1 -0
  25. package/Http/Server.d.ts +34 -0
  26. package/Http/Server.d.ts.map +1 -0
  27. package/Http/Server.js +49 -0
  28. package/Http/Server.js.map +1 -0
  29. package/Http/ServerResponse.d.ts +23 -0
  30. package/Http/ServerResponse.d.ts.map +1 -0
  31. package/Http/ServerResponse.js +38 -0
  32. package/Http/ServerResponse.js.map +1 -0
  33. package/HttpClient.d.ts +61 -0
  34. package/HttpClient.d.ts.map +1 -0
  35. package/HttpClient.js +23 -0
  36. package/HttpClient.js.map +1 -0
  37. package/HttpServer.d.ts +101 -0
  38. package/HttpServer.d.ts.map +1 -0
  39. package/HttpServer.js +33 -0
  40. package/HttpServer.js.map +1 -0
  41. package/KeyValueStore.d.ts +13 -0
  42. package/KeyValueStore.d.ts.map +1 -0
  43. package/KeyValueStore.js +28 -0
  44. package/KeyValueStore.js.map +1 -0
  45. package/LICENSE +21 -0
  46. package/Path.d.ts +25 -0
  47. package/Path.d.ts.map +1 -0
  48. package/Path.js +31 -0
  49. package/Path.js.map +1 -0
  50. package/README.md +3 -0
  51. package/Runtime.d.ts +26 -0
  52. package/Runtime.d.ts.map +1 -0
  53. package/Runtime.js +19 -0
  54. package/Runtime.js.map +1 -0
  55. package/Sink.d.ts +16 -0
  56. package/Sink.d.ts.map +1 -0
  57. package/Sink.js +13 -0
  58. package/Sink.js.map +1 -0
  59. package/Stream.d.ts +26 -0
  60. package/Stream.d.ts.map +1 -0
  61. package/Stream.js +25 -0
  62. package/Stream.js.map +1 -0
  63. package/internal/http/server.d.ts +2 -0
  64. package/internal/http/server.d.ts.map +1 -0
  65. package/internal/http/server.js +203 -0
  66. package/internal/http/server.js.map +1 -0
  67. package/internal/http/serverResponse.d.ts +2 -0
  68. package/internal/http/serverResponse.d.ts.map +1 -0
  69. package/internal/http/serverResponse.js +52 -0
  70. package/internal/http/serverResponse.js.map +1 -0
  71. package/mjs/BunContext.mjs +14 -0
  72. package/mjs/BunContext.mjs.map +1 -0
  73. package/mjs/Command.mjs +85 -0
  74. package/mjs/Command.mjs.map +1 -0
  75. package/mjs/CommandExecutor.mjs +15 -0
  76. package/mjs/CommandExecutor.mjs.map +1 -0
  77. package/mjs/Effectify.mjs +10 -0
  78. package/mjs/Effectify.mjs.map +1 -0
  79. package/mjs/Error.mjs +20 -0
  80. package/mjs/Error.mjs.map +1 -0
  81. package/mjs/FileSystem.mjs +20 -0
  82. package/mjs/FileSystem.mjs.map +1 -0
  83. package/mjs/Http/Server.mjs +21 -0
  84. package/mjs/Http/Server.mjs.map +1 -0
  85. package/mjs/Http/ServerResponse.mjs +13 -0
  86. package/mjs/Http/ServerResponse.mjs.map +1 -0
  87. package/mjs/HttpClient.mjs +61 -0
  88. package/mjs/HttpClient.mjs.map +1 -0
  89. package/mjs/HttpServer.mjs +101 -0
  90. package/mjs/HttpServer.mjs.map +1 -0
  91. package/mjs/KeyValueStore.mjs +13 -0
  92. package/mjs/KeyValueStore.mjs.map +1 -0
  93. package/mjs/Path.mjs +25 -0
  94. package/mjs/Path.mjs.map +1 -0
  95. package/mjs/Runtime.mjs +15 -0
  96. package/mjs/Runtime.mjs.map +1 -0
  97. package/mjs/Sink.mjs +10 -0
  98. package/mjs/Sink.mjs.map +1 -0
  99. package/mjs/Stream.mjs +20 -0
  100. package/mjs/Stream.mjs.map +1 -0
  101. package/mjs/internal/http/server.mjs +192 -0
  102. package/mjs/internal/http/server.mjs.map +1 -0
  103. package/mjs/internal/http/serverResponse.mjs +42 -0
  104. package/mjs/internal/http/serverResponse.mjs.map +1 -0
  105. package/package.json +33 -0
  106. package/src/BunContext.ts +24 -0
  107. package/src/Command.ts +114 -0
  108. package/src/CommandExecutor.ts +44 -0
  109. package/src/Effectify.ts +22 -0
  110. package/src/Error.ts +31 -0
  111. package/src/FileSystem.ts +74 -0
  112. package/src/Http/Server.ts +43 -0
  113. package/src/Http/ServerResponse.ts +33 -0
  114. package/src/HttpClient.ts +62 -0
  115. package/src/HttpServer.ts +102 -0
  116. package/src/KeyValueStore.ts +15 -0
  117. package/src/Path.ts +26 -0
  118. package/src/Runtime.ts +29 -0
  119. package/src/Sink.ts +19 -0
  120. package/src/Stream.ts +29 -0
  121. package/src/internal/http/server.ts +263 -0
  122. package/src/internal/http/serverResponse.ts +52 -0
  123. package/tsconfig.build.json +12 -0
  124. package/tsconfig.examples.json +12 -0
  125. package/tsconfig.json +11 -0
  126. package/tsconfig.test.json +17 -0
@@ -0,0 +1,44 @@
1
+ /**
2
+ * @since 1.0.0
3
+ */
4
+
5
+ export type {
6
+ /**
7
+ * @since 1.0.0
8
+ * @category models
9
+ */
10
+ ExitCode,
11
+ /**
12
+ * @since 1.0.0
13
+ * @category models
14
+ */
15
+ Process,
16
+ /**
17
+ * @since 1.0.0
18
+ * @category models
19
+ */
20
+ ProcessId,
21
+ /**
22
+ * @since 1.0.0
23
+ * @category symbols
24
+ */
25
+ ProcessTypeId,
26
+ /**
27
+ * @since 1.0.0
28
+ * @category models
29
+ */
30
+ Signal
31
+ } from "@effect/platform/CommandExecutor"
32
+
33
+ export {
34
+ /**
35
+ * @since 1.0.0
36
+ * @category tag
37
+ */
38
+ CommandExecutor,
39
+ /**
40
+ * @since 1.0.0
41
+ * @category layer
42
+ */
43
+ layer
44
+ } from "@effect/platform-node/CommandExecutor"
@@ -0,0 +1,22 @@
1
+ /**
2
+ * @since 1.0.0
3
+ */
4
+
5
+ export type {
6
+ /**
7
+ * @since 1.0.0
8
+ */
9
+ Effectify,
10
+ /**
11
+ * @since 1.0.0
12
+ */
13
+ EffectifyError
14
+ } from "@effect/platform/Effectify"
15
+
16
+ export {
17
+ /**
18
+ * @since 1.0.0
19
+ * @category constructor
20
+ */
21
+ effectify
22
+ } from "@effect/platform/Effectify"
package/src/Error.ts ADDED
@@ -0,0 +1,31 @@
1
+ /**
2
+ * @since 1.0.0
3
+ */
4
+
5
+ export {
6
+ /**
7
+ * @since 1.0.0
8
+ * @category error
9
+ */
10
+ BadArgument,
11
+ /**
12
+ * @since 1.0.0
13
+ * @category error
14
+ */
15
+ PlatformError,
16
+ /**
17
+ * @since 1.0.0
18
+ * @category type id
19
+ */
20
+ PlatformErrorTypeId,
21
+ /**
22
+ * @since 1.0.0
23
+ * @category error
24
+ */
25
+ SystemError,
26
+ /**
27
+ * @since 1.0.0
28
+ * @category model
29
+ */
30
+ SystemErrorReason
31
+ } from "@effect/platform/Error"
@@ -0,0 +1,74 @@
1
+ /**
2
+ * @since 1.0.0
3
+ */
4
+
5
+ export type {
6
+ /**
7
+ * @since 1.0.0
8
+ * @category model
9
+ */
10
+ MakeDirectoryOptions,
11
+ /**
12
+ * @since 1.0.0
13
+ * @category model
14
+ */
15
+ MakeTempDirectoryOptions,
16
+ /**
17
+ * @since 1.0.0
18
+ * @category model
19
+ */
20
+ MakeTempFileOptions,
21
+ /**
22
+ * @since 1.0.0
23
+ * @category model
24
+ */
25
+ OpenFileOptions,
26
+ /**
27
+ * @since 1.0.0
28
+ * @category model
29
+ */
30
+ ReadDirectoryOptions,
31
+ /**
32
+ * @since 1.0.0
33
+ * @category model
34
+ */
35
+ RemoveOptions,
36
+ /**
37
+ * @since 1.0.0
38
+ * @category model
39
+ */
40
+ SeekMode,
41
+ /**
42
+ * @since 1.0.0
43
+ * @category model
44
+ */
45
+ SinkOptions,
46
+ /**
47
+ * @since 1.0.0
48
+ * @category model
49
+ */
50
+ StreamOptions,
51
+ /**
52
+ * @since 1.0.0
53
+ * @category model
54
+ */
55
+ WriteFileOptions
56
+ } from "@effect/platform/FileSystem"
57
+
58
+ export {
59
+ /**
60
+ * @since 1.0.0
61
+ * @category tag
62
+ */
63
+ FileSystem,
64
+ /**
65
+ * @since 1.0.0
66
+ * @category layer
67
+ */
68
+ layer,
69
+ /**
70
+ * @since 1.0.0
71
+ * @category constructor
72
+ */
73
+ Size
74
+ } from "@effect/platform-node/FileSystem"
@@ -0,0 +1,43 @@
1
+ /**
2
+ * @since 1.0.0
3
+ *
4
+ * Also includes exports from [`@effect/platform/Http/Server`](https://effect-ts.github.io/platform/platform/Http/Server.ts.html).
5
+ */
6
+ import type * as Config from "@effect/io/Config"
7
+ import type * as ConfigError from "@effect/io/Config/Error"
8
+ import type * as Effect from "@effect/io/Effect"
9
+ import type * as Layer from "@effect/io/Layer"
10
+ import type * as Scope from "@effect/io/Scope"
11
+ import * as internal from "@effect/platform-bun/internal/http/server"
12
+ import type * as Etag from "@effect/platform/Http/Etag"
13
+ import type * as Server from "@effect/platform/Http/Server"
14
+ import type { ServeOptions } from "bun"
15
+
16
+ /**
17
+ * @since 1.0.0
18
+ */
19
+ export * from "@effect/platform/Http/Server"
20
+
21
+ /**
22
+ * @since 1.0.0
23
+ * @category constructors
24
+ */
25
+ export const make: (
26
+ options: Omit<ServeOptions, "fetch" | "error">
27
+ ) => Effect.Effect<Scope.Scope, never, Server.Server> = internal.make
28
+
29
+ /**
30
+ * @since 1.0.0
31
+ * @category layers
32
+ */
33
+ export const layer: (
34
+ options: Omit<ServeOptions, "fetch" | "error">
35
+ ) => Layer.Layer<never, never, Server.Server | Etag.Generator> = internal.layer
36
+
37
+ /**
38
+ * @since 1.0.0
39
+ * @category layers
40
+ */
41
+ export const layerConfig: (
42
+ options: Config.Config.Wrap<Omit<ServeOptions, "fetch" | "error">>
43
+ ) => Layer.Layer<never, ConfigError.ConfigError, Server.Server | Etag.Generator> = internal.layerConfig
@@ -0,0 +1,33 @@
1
+ /**
2
+ * @since 1.0.0
3
+ *
4
+ * Also includes exports from [`@effect/platform/Http/ServerResponse`](https://effect-ts.github.io/platform/platform/Http/ServerResponse.ts.html).
5
+ */
6
+ import type * as Effect from "@effect/io/Effect"
7
+ import * as internal from "@effect/platform-bun/internal/http/serverResponse"
8
+ import type * as PlatformError from "@effect/platform/Error"
9
+ import type * as FileSystem from "@effect/platform/FileSystem"
10
+ import type * as Body from "@effect/platform/Http/Body"
11
+ import type * as Etag from "@effect/platform/Http/Etag"
12
+ import type * as ServerResponse from "@effect/platform/Http/ServerResponse"
13
+
14
+ export * from "@effect/platform/Http/ServerResponse"
15
+
16
+ /**
17
+ * @since 1.0.0
18
+ * @category constructors
19
+ */
20
+ export const file: (
21
+ path: string,
22
+ options?: ServerResponse.Options.WithContentType & FileSystem.StreamOptions
23
+ ) => Effect.Effect<FileSystem.FileSystem | Etag.Generator, PlatformError.PlatformError, ServerResponse.ServerResponse> =
24
+ internal.file
25
+
26
+ /**
27
+ * @since 1.0.0
28
+ * @category constructors
29
+ */
30
+ export const fileWeb: (
31
+ file: Body.Body.FileLike,
32
+ options?: ServerResponse.Options.WithContent
33
+ ) => Effect.Effect<Etag.Generator, never, ServerResponse.ServerResponse> = internal.fileWeb
@@ -0,0 +1,62 @@
1
+ /**
2
+ * @since 1.0.0
3
+ */
4
+ import * as body from "@effect/platform/Http/Body"
5
+ import * as client from "@effect/platform/Http/Client"
6
+ import * as error from "@effect/platform/Http/ClientError"
7
+ import * as request from "@effect/platform/Http/ClientRequest"
8
+ import * as response from "@effect/platform/Http/ClientResponse"
9
+ import * as headers from "@effect/platform/Http/Headers"
10
+ import * as urlParams from "@effect/platform/Http/UrlParams"
11
+
12
+ export {
13
+ /**
14
+ * @since 1.0.0
15
+ *
16
+ * - Docs: [Http/Body](https://effect-ts.github.io/platform/platform/Http/Body.ts.html)
17
+ * - Module: `@effect/platform/Http/Body`
18
+ */
19
+ body,
20
+ /**
21
+ * @since 1.0.0
22
+ *
23
+ * - Docs: [Http/Client](https://effect-ts.github.io/platform/platform/Http/Client.ts.html)
24
+ * - Module: `@effect/platform/Http/Client`
25
+ */
26
+ client,
27
+ /**
28
+ * @since 1.0.0
29
+ *
30
+ * - Docs: [Http/ClientError](https://effect-ts.github.io/platform/platform/Http/ClientError.ts.html)
31
+ * - Module: `@effect/platform/Http/ClientError`
32
+ */
33
+ error,
34
+ /**
35
+ * @since 1.0.0
36
+ *
37
+ * - Docs: [Http/Headers](https://effect-ts.github.io/platform/platform/Http/Headers.ts.html)
38
+ * - Module: `@effect/platform/Http/Headers`
39
+ */
40
+ headers,
41
+ /**
42
+ * @since 1.0.0
43
+ *
44
+ * - Docs: [Http/ClientRequest](https://effect-ts.github.io/platform/platform/Http/ClientRequest.ts.html)
45
+ * - Module: `@effect/platform/Http/ClientRequest`
46
+ */
47
+ request,
48
+ /**
49
+ * @since 1.0.0
50
+ *
51
+ * - Docs: [Http/ClientResponse](https://effect-ts.github.io/platform/platform/Http/ClientResponse.ts.html)
52
+ * - Module: `@effect/platform/Http/ClientResponse`
53
+ */
54
+ response,
55
+ /**
56
+ * @since 1.0.0
57
+ *
58
+ * - Docs: [Http/UrlParams](https://effect-ts.github.io/platform/platform/Http/UrlParams.ts.html)
59
+ * - Module: `@effect/platform/Http/UrlParams`
60
+ */
61
+ urlParams
62
+ }
@@ -0,0 +1,102 @@
1
+ /**
2
+ * @since 1.0.0
3
+ */
4
+ import * as server from "@effect/platform-bun/Http/Server"
5
+ import * as response from "@effect/platform-bun/Http/ServerResponse"
6
+ import * as etag from "@effect/platform-node/Http/Etag"
7
+ import * as formData from "@effect/platform-node/Http/FormData"
8
+ import * as app from "@effect/platform/Http/App"
9
+ import * as body from "@effect/platform/Http/Body"
10
+ import * as headers from "@effect/platform/Http/Headers"
11
+ import * as middleware from "@effect/platform/Http/Middleware"
12
+ import * as router from "@effect/platform/Http/Router"
13
+ import * as error from "@effect/platform/Http/ServerError"
14
+ import * as request from "@effect/platform/Http/ServerRequest"
15
+ import * as urlParams from "@effect/platform/Http/UrlParams"
16
+
17
+ export {
18
+ /**
19
+ * @since 1.0.0
20
+ *
21
+ * - Docs: [Http/App](https://effect-ts.github.io/platform/platform/Http/App.ts.html)
22
+ * - Module: `@effect/platform/Http/App`
23
+ */
24
+ app,
25
+ /**
26
+ * @since 1.0.0
27
+ *
28
+ * - Docs: [Http/Body](https://effect-ts.github.io/platform/platform/Http/Body.ts.html)
29
+ * - Module: `@effect/platform/Http/Body`
30
+ */
31
+ body,
32
+ /**
33
+ * @since 1.0.0
34
+ *
35
+ * - Docs: [Http/ServerError](https://effect-ts.github.io/platform/platform/Http/ServerError.ts.html)
36
+ * - Module: `@effect/platform/Http/ServerError`
37
+ */
38
+ error,
39
+ /**
40
+ * @since 1.0.0
41
+ *
42
+ * - Docs: [Http/Etag](https://effect-ts.github.io/platform/platform-node/Http/Etag.ts.html)
43
+ * - Module: `@effect/platform-node/Http/Etag`
44
+ */
45
+ etag,
46
+ /**
47
+ * @since 1.0.0
48
+ *
49
+ * - Docs: [Http/FormData](https://effect-ts.github.io/platform/platform-node/Http/FormData.ts.html)
50
+ * - Module: `@effect/platform-node/Http/FormData`
51
+ */
52
+ formData,
53
+ /**
54
+ * @since 1.0.0
55
+ *
56
+ * - Docs: [Http/Headers](https://effect-ts.github.io/platform/platform/Http/Headers.ts.html)
57
+ * - Module: `@effect/platform/Http/Headers`
58
+ */
59
+ headers,
60
+ /**
61
+ * @since 1.0.0
62
+ *
63
+ * - Docs: [Http/Middleware](https://effect-ts.github.io/platform/platform/Http/Middleware.ts.html)
64
+ * - Module: `@effect/platform/Http/Middleware`
65
+ */
66
+ middleware,
67
+ /**
68
+ * @since 1.0.0
69
+ *
70
+ * - Docs: [Http/ServerRequest](https://effect-ts.github.io/platform/platform/Http/ServerRequest.ts.html)
71
+ * - Module: `@effect/platform/Http/ServerRequest`
72
+ */
73
+ request,
74
+ /**
75
+ * @since 1.0.0
76
+ *
77
+ * - Docs: [Http/ServerResponse](https://effect-ts.github.io/platform/platform-bun/Http/ServerResponse.ts.html)
78
+ * - Module: `@effect/platform-bun/Http/ServerResponse`
79
+ */
80
+ response,
81
+ /**
82
+ * @since 1.0.0
83
+ *
84
+ * - Docs: [Http/Router](https://effect-ts.github.io/platform/platform/Http/Router.ts.html)
85
+ * - Module: `@effect/platform/Http/Router`
86
+ */
87
+ router,
88
+ /**
89
+ * @since 1.0.0
90
+ *
91
+ * - Docs: [Http/Router](https://effect-ts.github.io/platform/platform-bun/Http/Server.ts.html)
92
+ * - Module: `@effect/platform-bun/Http/Server`
93
+ */
94
+ server,
95
+ /**
96
+ * @since 1.0.0
97
+ *
98
+ * - Docs: [Http/UrlParams](https://effect-ts.github.io/platform/platform/Http/UrlParams.ts.html)
99
+ * - Module: `@effect/platform/Http/UrlParams`
100
+ */
101
+ urlParams
102
+ }
@@ -0,0 +1,15 @@
1
+ /**
2
+ * @since 1.0.0
3
+ *
4
+ * Also includes exports from [`@effect/platform/KeyValueStore`](https://effect-ts.github.io/platform/platform/KeyValueStore.ts.html).
5
+ */
6
+
7
+ export * from "@effect/platform/KeyValueStore"
8
+
9
+ export {
10
+ /**
11
+ * @since 1.0.0
12
+ * @category layers
13
+ */
14
+ layerFileSystem
15
+ } from "@effect/platform-node/KeyValueStore"
package/src/Path.ts ADDED
@@ -0,0 +1,26 @@
1
+ /**
2
+ * @since 1.0.0
3
+ */
4
+
5
+ export {
6
+ /**
7
+ * @since 1.0.0
8
+ * @category layer
9
+ */
10
+ layer,
11
+ /**
12
+ * @since 1.0.0
13
+ * @category layer
14
+ */
15
+ layerPosix,
16
+ /**
17
+ * @since 1.0.0
18
+ * @category layer
19
+ */
20
+ layerWin32,
21
+ /**
22
+ * @since 1.0.0
23
+ * @category tag
24
+ */
25
+ Path
26
+ } from "@effect/platform-node/Path"
package/src/Runtime.ts ADDED
@@ -0,0 +1,29 @@
1
+ /**
2
+ * @since 1.0.0
3
+ */
4
+
5
+ export type {
6
+ /**
7
+ * @category model
8
+ * @since 1.0.0
9
+ */
10
+ RunMain,
11
+ /**
12
+ * @category model
13
+ * @since 1.0.0
14
+ */
15
+ Teardown
16
+ } from "@effect/platform/Runtime"
17
+
18
+ export {
19
+ /**
20
+ * @category teardown
21
+ * @since 1.0.0
22
+ */
23
+ defaultTeardown,
24
+ /**
25
+ * @since 1.0.0
26
+ * @category runtime
27
+ */
28
+ runMain
29
+ } from "@effect/platform-node/Runtime"
package/src/Sink.ts ADDED
@@ -0,0 +1,19 @@
1
+ /**
2
+ * @since 1.0.0
3
+ */
4
+
5
+ export type {
6
+ /**
7
+ * @category model
8
+ * @since 1.0.0
9
+ */
10
+ FromWritableOptions
11
+ } from "@effect/platform-node/Sink"
12
+
13
+ export {
14
+ /**
15
+ * @category constructor
16
+ * @since 1.0.0
17
+ */
18
+ fromWritable
19
+ } from "@effect/platform-node/Sink"
package/src/Stream.ts ADDED
@@ -0,0 +1,29 @@
1
+ /**
2
+ * @since 1.0.0
3
+ */
4
+
5
+ export type {
6
+ /**
7
+ * @category models
8
+ * @since 1.0.0
9
+ */
10
+ FromReadableOptions
11
+ } from "@effect/platform-node/Stream"
12
+
13
+ export {
14
+ /**
15
+ * @category constructors
16
+ * @since 1.0.0
17
+ */
18
+ fromReadable,
19
+ /**
20
+ * @since 1.0.0
21
+ * @category conversions
22
+ */
23
+ toString,
24
+ /**
25
+ * @since 1.0.0
26
+ * @category conversions
27
+ */
28
+ toUint8Array
29
+ } from "@effect/platform-node/Stream"