@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.
- package/BunContext.d.ts +15 -0
- package/BunContext.d.ts.map +1 -0
- package/BunContext.js +23 -0
- package/BunContext.js.map +1 -0
- package/Command.d.ts +111 -0
- package/Command.d.ts.map +1 -0
- package/Command.js +103 -0
- package/Command.js.map +1 -0
- package/CommandExecutor.d.ts +41 -0
- package/CommandExecutor.d.ts.map +1 -0
- package/CommandExecutor.js +19 -0
- package/CommandExecutor.js.map +1 -0
- package/Effectify.d.ts +19 -0
- package/Effectify.d.ts.map +1 -0
- package/Effectify.js +13 -0
- package/Effectify.js.map +1 -0
- package/Error.d.ts +30 -0
- package/Error.d.ts.map +1 -0
- package/Error.js +25 -0
- package/Error.js.map +1 -0
- package/FileSystem.d.ts +71 -0
- package/FileSystem.d.ts.map +1 -0
- package/FileSystem.js +25 -0
- package/FileSystem.js.map +1 -0
- package/Http/Server.d.ts +34 -0
- package/Http/Server.d.ts.map +1 -0
- package/Http/Server.js +49 -0
- package/Http/Server.js.map +1 -0
- package/Http/ServerResponse.d.ts +23 -0
- package/Http/ServerResponse.d.ts.map +1 -0
- package/Http/ServerResponse.js +38 -0
- package/Http/ServerResponse.js.map +1 -0
- package/HttpClient.d.ts +61 -0
- package/HttpClient.d.ts.map +1 -0
- package/HttpClient.js +23 -0
- package/HttpClient.js.map +1 -0
- package/HttpServer.d.ts +101 -0
- package/HttpServer.d.ts.map +1 -0
- package/HttpServer.js +33 -0
- package/HttpServer.js.map +1 -0
- package/KeyValueStore.d.ts +13 -0
- package/KeyValueStore.d.ts.map +1 -0
- package/KeyValueStore.js +28 -0
- package/KeyValueStore.js.map +1 -0
- package/LICENSE +21 -0
- package/Path.d.ts +25 -0
- package/Path.d.ts.map +1 -0
- package/Path.js +31 -0
- package/Path.js.map +1 -0
- package/README.md +3 -0
- package/Runtime.d.ts +26 -0
- package/Runtime.d.ts.map +1 -0
- package/Runtime.js +19 -0
- package/Runtime.js.map +1 -0
- package/Sink.d.ts +16 -0
- package/Sink.d.ts.map +1 -0
- package/Sink.js +13 -0
- package/Sink.js.map +1 -0
- package/Stream.d.ts +26 -0
- package/Stream.d.ts.map +1 -0
- package/Stream.js +25 -0
- package/Stream.js.map +1 -0
- package/internal/http/server.d.ts +2 -0
- package/internal/http/server.d.ts.map +1 -0
- package/internal/http/server.js +203 -0
- package/internal/http/server.js.map +1 -0
- package/internal/http/serverResponse.d.ts +2 -0
- package/internal/http/serverResponse.d.ts.map +1 -0
- package/internal/http/serverResponse.js +52 -0
- package/internal/http/serverResponse.js.map +1 -0
- package/mjs/BunContext.mjs +14 -0
- package/mjs/BunContext.mjs.map +1 -0
- package/mjs/Command.mjs +85 -0
- package/mjs/Command.mjs.map +1 -0
- package/mjs/CommandExecutor.mjs +15 -0
- package/mjs/CommandExecutor.mjs.map +1 -0
- package/mjs/Effectify.mjs +10 -0
- package/mjs/Effectify.mjs.map +1 -0
- package/mjs/Error.mjs +20 -0
- package/mjs/Error.mjs.map +1 -0
- package/mjs/FileSystem.mjs +20 -0
- package/mjs/FileSystem.mjs.map +1 -0
- package/mjs/Http/Server.mjs +21 -0
- package/mjs/Http/Server.mjs.map +1 -0
- package/mjs/Http/ServerResponse.mjs +13 -0
- package/mjs/Http/ServerResponse.mjs.map +1 -0
- package/mjs/HttpClient.mjs +61 -0
- package/mjs/HttpClient.mjs.map +1 -0
- package/mjs/HttpServer.mjs +101 -0
- package/mjs/HttpServer.mjs.map +1 -0
- package/mjs/KeyValueStore.mjs +13 -0
- package/mjs/KeyValueStore.mjs.map +1 -0
- package/mjs/Path.mjs +25 -0
- package/mjs/Path.mjs.map +1 -0
- package/mjs/Runtime.mjs +15 -0
- package/mjs/Runtime.mjs.map +1 -0
- package/mjs/Sink.mjs +10 -0
- package/mjs/Sink.mjs.map +1 -0
- package/mjs/Stream.mjs +20 -0
- package/mjs/Stream.mjs.map +1 -0
- package/mjs/internal/http/server.mjs +192 -0
- package/mjs/internal/http/server.mjs.map +1 -0
- package/mjs/internal/http/serverResponse.mjs +42 -0
- package/mjs/internal/http/serverResponse.mjs.map +1 -0
- package/package.json +33 -0
- package/src/BunContext.ts +24 -0
- package/src/Command.ts +114 -0
- package/src/CommandExecutor.ts +44 -0
- package/src/Effectify.ts +22 -0
- package/src/Error.ts +31 -0
- package/src/FileSystem.ts +74 -0
- package/src/Http/Server.ts +43 -0
- package/src/Http/ServerResponse.ts +33 -0
- package/src/HttpClient.ts +62 -0
- package/src/HttpServer.ts +102 -0
- package/src/KeyValueStore.ts +15 -0
- package/src/Path.ts +26 -0
- package/src/Runtime.ts +29 -0
- package/src/Sink.ts +19 -0
- package/src/Stream.ts +29 -0
- package/src/internal/http/server.ts +263 -0
- package/src/internal/http/serverResponse.ts +52 -0
- package/tsconfig.build.json +12 -0
- package/tsconfig.examples.json +12 -0
- package/tsconfig.json +11 -0
- package/tsconfig.test.json +17 -0
|
@@ -0,0 +1,203 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.make = exports.layerConfig = exports.layer = void 0;
|
|
7
|
+
var Config = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@effect/io/Config"));
|
|
8
|
+
var Effect = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@effect/io/Effect"));
|
|
9
|
+
var Layer = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@effect/io/Layer"));
|
|
10
|
+
var Runtime = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@effect/io/Runtime"));
|
|
11
|
+
var Etag = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@effect/platform-node/Http/Etag"));
|
|
12
|
+
var FormData = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@effect/platform-node/Http/FormData"));
|
|
13
|
+
var Headers = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@effect/platform/Http/Headers"));
|
|
14
|
+
var IncomingMessage = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@effect/platform/Http/IncomingMessage"));
|
|
15
|
+
var Server = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@effect/platform/Http/Server"));
|
|
16
|
+
var Error = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@effect/platform/Http/ServerError"));
|
|
17
|
+
var ServerRequest = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@effect/platform/Http/ServerRequest"));
|
|
18
|
+
var UrlParams = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@effect/platform/Http/UrlParams"));
|
|
19
|
+
var Stream = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@effect/stream/Stream"));
|
|
20
|
+
var _nodeStream = /*#__PURE__*/require("node:stream");
|
|
21
|
+
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
22
|
+
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
23
|
+
/** @internal */
|
|
24
|
+
const make = options => Effect.gen(function* (_) {
|
|
25
|
+
const handlerStack = [function (_request, _server) {
|
|
26
|
+
return new Response("not found", {
|
|
27
|
+
status: 404
|
|
28
|
+
});
|
|
29
|
+
}];
|
|
30
|
+
const server = Bun.serve({
|
|
31
|
+
...options,
|
|
32
|
+
fetch: handlerStack[0]
|
|
33
|
+
});
|
|
34
|
+
yield* _(Effect.addFinalizer(() => Effect.sync(() => {
|
|
35
|
+
server.stop();
|
|
36
|
+
})));
|
|
37
|
+
return Server.make({
|
|
38
|
+
address: {
|
|
39
|
+
_tag: "TcpAddress",
|
|
40
|
+
port: server.port,
|
|
41
|
+
hostname: server.hostname
|
|
42
|
+
},
|
|
43
|
+
serve(httpApp, middleware) {
|
|
44
|
+
const app = Effect.flatMap(middleware ? middleware(httpApp) : httpApp, respond);
|
|
45
|
+
return Effect.acquireRelease(() => Effect.sync(() => {
|
|
46
|
+
handlerStack.pop();
|
|
47
|
+
server.reload({
|
|
48
|
+
fetch: handlerStack[handlerStack.length - 1]
|
|
49
|
+
});
|
|
50
|
+
}))(Effect.flatMap(runtime => Effect.async(() => {
|
|
51
|
+
const runPromise = Runtime.runPromise(runtime);
|
|
52
|
+
function handler(request, _server) {
|
|
53
|
+
return runPromise(Effect.provideService(app, ServerRequest.ServerRequest, new ServerRequestImpl(request)));
|
|
54
|
+
}
|
|
55
|
+
handlerStack.push(handler);
|
|
56
|
+
server.reload({
|
|
57
|
+
fetch: handler
|
|
58
|
+
});
|
|
59
|
+
}))(Effect.runtime()));
|
|
60
|
+
}
|
|
61
|
+
});
|
|
62
|
+
});
|
|
63
|
+
exports.make = make;
|
|
64
|
+
const respond = response => Effect.sync(() => {
|
|
65
|
+
const body = response.body;
|
|
66
|
+
switch (body._tag) {
|
|
67
|
+
case "Empty":
|
|
68
|
+
{
|
|
69
|
+
return new Response(undefined, {
|
|
70
|
+
status: response.status,
|
|
71
|
+
statusText: response.statusText,
|
|
72
|
+
headers: response.headers
|
|
73
|
+
});
|
|
74
|
+
}
|
|
75
|
+
case "Uint8Array":
|
|
76
|
+
case "Raw":
|
|
77
|
+
{
|
|
78
|
+
return new Response(body.body, {
|
|
79
|
+
status: response.status,
|
|
80
|
+
statusText: response.statusText,
|
|
81
|
+
headers: response.headers
|
|
82
|
+
});
|
|
83
|
+
}
|
|
84
|
+
case "FormData":
|
|
85
|
+
{
|
|
86
|
+
return new Response(body.formData, {
|
|
87
|
+
status: response.status,
|
|
88
|
+
statusText: response.statusText,
|
|
89
|
+
headers: response.headers
|
|
90
|
+
});
|
|
91
|
+
}
|
|
92
|
+
case "Stream":
|
|
93
|
+
{
|
|
94
|
+
return new Response(Stream.toReadableStream(body.stream), {
|
|
95
|
+
status: response.status,
|
|
96
|
+
statusText: response.statusText,
|
|
97
|
+
headers: response.headers
|
|
98
|
+
});
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
});
|
|
102
|
+
/** @internal */
|
|
103
|
+
const layer = options => Layer.merge(Layer.scoped(Server.Server, make(options)), Etag.layer);
|
|
104
|
+
/** @internal */
|
|
105
|
+
exports.layer = layer;
|
|
106
|
+
const layerConfig = options => Layer.merge(Layer.scoped(Server.Server, Effect.flatMap(Effect.config(Config.unwrap(options)), make)), Etag.layer);
|
|
107
|
+
exports.layerConfig = layerConfig;
|
|
108
|
+
class ServerRequestImpl {
|
|
109
|
+
constructor(source, url = source.url, headersOverride) {
|
|
110
|
+
this.source = source;
|
|
111
|
+
this.url = url;
|
|
112
|
+
this.headersOverride = headersOverride;
|
|
113
|
+
this[ServerRequest.TypeId] = ServerRequest.TypeId;
|
|
114
|
+
this[IncomingMessage.TypeId] = IncomingMessage.TypeId;
|
|
115
|
+
}
|
|
116
|
+
get method() {
|
|
117
|
+
return this.source.method;
|
|
118
|
+
}
|
|
119
|
+
get originalUrl() {
|
|
120
|
+
return this.source.url;
|
|
121
|
+
}
|
|
122
|
+
get headers() {
|
|
123
|
+
this.headersOverride ??= Headers.fromInput(this.source.headers);
|
|
124
|
+
return this.headersOverride;
|
|
125
|
+
}
|
|
126
|
+
setUrl(url) {
|
|
127
|
+
return new ServerRequestImpl(this.source, url);
|
|
128
|
+
}
|
|
129
|
+
replaceHeaders(headers) {
|
|
130
|
+
return new ServerRequestImpl(this.source, this.url, headers);
|
|
131
|
+
}
|
|
132
|
+
get stream() {
|
|
133
|
+
return this.source.body ? Stream.fromReadableStream(() => this.source.body, _ => Error.RequestError({
|
|
134
|
+
request: this,
|
|
135
|
+
reason: "Decode",
|
|
136
|
+
error: _
|
|
137
|
+
})) : Stream.fail(Error.RequestError({
|
|
138
|
+
request: this,
|
|
139
|
+
reason: "Decode",
|
|
140
|
+
error: "can not create stream from empty body"
|
|
141
|
+
}));
|
|
142
|
+
}
|
|
143
|
+
get text() {
|
|
144
|
+
if (this.textEffect) {
|
|
145
|
+
return this.textEffect;
|
|
146
|
+
}
|
|
147
|
+
this.textEffect = Effect.runSync(Effect.cached(Effect.tryPromise({
|
|
148
|
+
try: () => this.source.text(),
|
|
149
|
+
catch: error => Error.RequestError({
|
|
150
|
+
request: this,
|
|
151
|
+
reason: "Decode",
|
|
152
|
+
error
|
|
153
|
+
})
|
|
154
|
+
})));
|
|
155
|
+
return this.textEffect;
|
|
156
|
+
}
|
|
157
|
+
get json() {
|
|
158
|
+
return Effect.tryMap(this.text, {
|
|
159
|
+
try: _ => JSON.parse(_),
|
|
160
|
+
catch: error => Error.RequestError({
|
|
161
|
+
request: this,
|
|
162
|
+
reason: "Decode",
|
|
163
|
+
error
|
|
164
|
+
})
|
|
165
|
+
});
|
|
166
|
+
}
|
|
167
|
+
get urlParamsBody() {
|
|
168
|
+
return Effect.flatMap(this.text, _ => Effect.try({
|
|
169
|
+
try: () => UrlParams.fromInput(new URLSearchParams(_)),
|
|
170
|
+
catch: error => Error.RequestError({
|
|
171
|
+
request: this,
|
|
172
|
+
reason: "Decode",
|
|
173
|
+
error
|
|
174
|
+
})
|
|
175
|
+
}));
|
|
176
|
+
}
|
|
177
|
+
get formData() {
|
|
178
|
+
if (this.formDataEffect) {
|
|
179
|
+
return this.formDataEffect;
|
|
180
|
+
}
|
|
181
|
+
this.formDataEffect = Effect.runSync(Effect.cached(FormData.formData(_nodeStream.Readable.fromWeb(this.source.body), this.headers)));
|
|
182
|
+
return this.formDataEffect;
|
|
183
|
+
}
|
|
184
|
+
get formDataStream() {
|
|
185
|
+
return FormData.stream(_nodeStream.Readable.fromWeb(this.source.body), this.headers);
|
|
186
|
+
}
|
|
187
|
+
get arrayBuffer() {
|
|
188
|
+
if (this.arrayBuffer) {
|
|
189
|
+
return this.arrayBuffer;
|
|
190
|
+
}
|
|
191
|
+
this.arrayBufferEffect = Effect.runSync(Effect.cached(Effect.tryPromise({
|
|
192
|
+
try: () => this.source.arrayBuffer(),
|
|
193
|
+
catch: error => Error.RequestError({
|
|
194
|
+
request: this,
|
|
195
|
+
reason: "Decode",
|
|
196
|
+
error
|
|
197
|
+
})
|
|
198
|
+
})));
|
|
199
|
+
return this.arrayBufferEffect;
|
|
200
|
+
}
|
|
201
|
+
}
|
|
202
|
+
ServerRequest.TypeId, IncomingMessage.TypeId;
|
|
203
|
+
//# sourceMappingURL=server.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"server.js","names":["Config","_interopRequireWildcard","require","Effect","Layer","Runtime","Etag","FormData","Headers","IncomingMessage","Server","Error","ServerRequest","UrlParams","Stream","_nodeStream","_getRequireWildcardCache","nodeInterop","WeakMap","cacheBabelInterop","cacheNodeInterop","obj","__esModule","default","cache","has","get","newObj","hasPropertyDescriptor","Object","defineProperty","getOwnPropertyDescriptor","key","prototype","hasOwnProperty","call","desc","set","make","options","gen","_","handlerStack","_request","_server","Response","status","server","Bun","serve","fetch","addFinalizer","sync","stop","address","_tag","port","hostname","httpApp","middleware","app","flatMap","respond","acquireRelease","pop","reload","length","runtime","async","runPromise","handler","request","provideService","ServerRequestImpl","push","exports","response","body","undefined","statusText","headers","formData","toReadableStream","stream","layer","merge","scoped","layerConfig","config","unwrap","constructor","source","url","headersOverride","TypeId","method","originalUrl","fromInput","setUrl","replaceHeaders","fromReadableStream","RequestError","reason","error","fail","text","textEffect","runSync","cached","tryPromise","try","catch","json","tryMap","JSON","parse","urlParamsBody","URLSearchParams","formDataEffect","Readable","fromWeb","formDataStream","arrayBuffer","arrayBufferEffect"],"sources":["../../src/internal/http/server.ts"],"sourcesContent":[null],"mappings":";;;;;;AACA,IAAAA,MAAA,gBAAAC,uBAAA,eAAAC,OAAA;AACA,IAAAC,MAAA,gBAAAF,uBAAA,eAAAC,OAAA;AACA,IAAAE,KAAA,gBAAAH,uBAAA,eAAAC,OAAA;AACA,IAAAG,OAAA,gBAAAJ,uBAAA,eAAAC,OAAA;AAEA,IAAAI,IAAA,gBAAAL,uBAAA,eAAAC,OAAA;AACA,IAAAK,QAAA,gBAAAN,uBAAA,eAAAC,OAAA;AAGA,IAAAM,OAAA,gBAAAP,uBAAA,eAAAC,OAAA;AACA,IAAAO,eAAA,gBAAAR,uBAAA,eAAAC,OAAA;AAEA,IAAAQ,MAAA,gBAAAT,uBAAA,eAAAC,OAAA;AACA,IAAAS,KAAA,gBAAAV,uBAAA,eAAAC,OAAA;AACA,IAAAU,aAAA,gBAAAX,uBAAA,eAAAC,OAAA;AAEA,IAAAW,SAAA,gBAAAZ,uBAAA,eAAAC,OAAA;AAEA,IAAAY,MAAA,gBAAAb,uBAAA,eAAAC,OAAA;AAEA,IAAAa,WAAA,gBAAAb,OAAA;AAAsC,SAAAc,yBAAAC,WAAA,eAAAC,OAAA,kCAAAC,iBAAA,OAAAD,OAAA,QAAAE,gBAAA,OAAAF,OAAA,YAAAF,wBAAA,YAAAA,CAAAC,WAAA,WAAAA,WAAA,GAAAG,gBAAA,GAAAD,iBAAA,KAAAF,WAAA;AAAA,SAAAhB,wBAAAoB,GAAA,EAAAJ,WAAA,SAAAA,WAAA,IAAAI,GAAA,IAAAA,GAAA,CAAAC,UAAA,WAAAD,GAAA,QAAAA,GAAA,oBAAAA,GAAA,wBAAAA,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AAE;MACpCX,KAAK,EAAGR,KAAK,IACX5F,KAAK,CAAC0F,YAAY,CAAC;QACjB9B,OAAO,EAAE,IAAI;QACb+B,MAAM,EAAE,QAAQ;QAChBC;OACD;KACJ,CAAC,CACH,CAAC;IACF,OAAO,IAAI,CAACoB,iBAAiB;EAC/B;;AAhIU/G,aAAa,CAACkF,MAAM,EACpBrF,eAAe,CAACqF,MAAM"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"serverResponse.d.ts","sourceRoot":"","sources":["../../src/internal/http/serverResponse.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.fileWeb = exports.file = void 0;
|
|
7
|
+
var Effect = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@effect/io/Effect"));
|
|
8
|
+
var FileSystem = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@effect/platform/FileSystem"));
|
|
9
|
+
var Etag = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@effect/platform/Http/Etag"));
|
|
10
|
+
var ServerResponse = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@effect/platform/Http/ServerResponse"));
|
|
11
|
+
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
12
|
+
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
13
|
+
/** @internal */
|
|
14
|
+
const file = (path, options) => Effect.map(({
|
|
15
|
+
etag,
|
|
16
|
+
info
|
|
17
|
+
}) => {
|
|
18
|
+
const headers = {
|
|
19
|
+
...(options?.headers ?? {}),
|
|
20
|
+
etag: Etag.toString(etag)
|
|
21
|
+
};
|
|
22
|
+
if (info.mtime._tag === "Some") {
|
|
23
|
+
headers["last-modified"] = info.mtime.value.toUTCString();
|
|
24
|
+
}
|
|
25
|
+
let file = Bun.file(path);
|
|
26
|
+
if (options?.bytesToRead !== undefined || options?.offset !== undefined) {
|
|
27
|
+
const start = Number(options?.offset ?? 0);
|
|
28
|
+
const end = options?.bytesToRead !== undefined ? start + Number(options.bytesToRead) : undefined;
|
|
29
|
+
file = file.slice(start, end);
|
|
30
|
+
}
|
|
31
|
+
return ServerResponse.raw(file, {
|
|
32
|
+
...options,
|
|
33
|
+
headers
|
|
34
|
+
});
|
|
35
|
+
})(Effect.bind("etag", ({
|
|
36
|
+
info
|
|
37
|
+
}) => Effect.flatMap(Etag.Generator, generator => generator.fromFileInfo(info)))(Effect.bindTo(Effect.flatMap(FileSystem.FileSystem, fs => fs.stat(path)), "info")));
|
|
38
|
+
/** @internal */
|
|
39
|
+
exports.file = file;
|
|
40
|
+
const fileWeb = (file, options) => Effect.flatMap(Etag.Generator, generator => Effect.map(generator.fromFileWeb(file), etag => {
|
|
41
|
+
const headers = {
|
|
42
|
+
...(options?.headers ?? {}),
|
|
43
|
+
etag: Etag.toString(etag),
|
|
44
|
+
"last-modified": new Date(file.lastModified).toUTCString()
|
|
45
|
+
};
|
|
46
|
+
return ServerResponse.raw(file, {
|
|
47
|
+
...options,
|
|
48
|
+
headers
|
|
49
|
+
});
|
|
50
|
+
}));
|
|
51
|
+
exports.fileWeb = fileWeb;
|
|
52
|
+
//# sourceMappingURL=serverResponse.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"serverResponse.js","names":["Effect","_interopRequireWildcard","require","FileSystem","Etag","ServerResponse","_getRequireWildcardCache","nodeInterop","WeakMap","cacheBabelInterop","cacheNodeInterop","obj","__esModule","default","cache","has","get","newObj","hasPropertyDescriptor","Object","defineProperty","getOwnPropertyDescriptor","key","prototype","hasOwnProperty","call","desc","set","file","path","options","map","etag","info","headers","toString","mtime","_tag","value","toUTCString","Bun","bytesToRead","undefined","offset","start","Number","end","slice","raw","bind","flatMap","Generator","generator","fromFileInfo","bindTo","fs","stat","exports","fileWeb","fromFileWeb","Date","lastModified"],"sources":["../../src/internal/http/serverResponse.ts"],"sourcesContent":[null],"mappings":";;;;;;AACA,IAAAA,MAAA,gBAAAC,uBAAA,eAAAC,OAAA;AAEA,IAAAC,UAAA,gBAAAF,uBAAA,eAAAC,OAAA;AAEA,IAAAE,IAAA,gBAAAH,uBAAA,eAAAC,OAAA;AACA,IAAAG,cAAA,gBAAAJ,uBAAA,eAAAC,OAAA;AAAsE,SAAAI,yBAAAC,WAAA,eAAAC,OAAA,kCAAAC,iBAAA,OAAAD,OAAA,QAAAE,gBAAA,OAAAF,OAAA,YAAAF,wBAAA,YAAAA,CAAAC,WAAA,WAAAA,WAAA,GAAAG,gBAAA,GAAAD,iBAAA,KAAAF,WAAA;AAAA,SAAAN,wBAAAU,GAAA,EAAAJ,WAAA,SAAAA,WAAA,IAAAI,GAAA,IAAAA,GAAA,CAAAC,UAAA,WAAAD,GAAA,QAAAA,GAAA,oBAAAA,GAAA,wBAAAA,GAAA,4BAAAE,OAAA,EAAAF,GAAA,UAAAG,KAAA,GAAAR,wBAAA,CAAAC,WAAA,OAAAO,KAAA,IAAAA,KAAA,CAAAC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CAACiC,YAAY,CAAC,CAACtB,WAAW;GACzD;EACD,OAAOlC,cAAc,CAAC2C,GAAG,CAACpB,IAAI,EAAE;IAAE,GAAGE,OAAO;IAAEI;EAAO,CAAE,CAAC;AAC1D,CAAC,CAAC,CAAC;AAAAuB,OAAA,CAAAC,OAAA,GAAAA,OAAA"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @since 1.0.0
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import * as Layer from "@effect/io/Layer";
|
|
6
|
+
import * as CommandExecutor from "@effect/platform-bun/CommandExecutor";
|
|
7
|
+
import * as FileSystem from "@effect/platform-bun/FileSystem";
|
|
8
|
+
import * as Path from "@effect/platform-bun/Path";
|
|
9
|
+
/**
|
|
10
|
+
* @since 1.0.0
|
|
11
|
+
* @category layer
|
|
12
|
+
*/
|
|
13
|
+
export const layer = /*#__PURE__*/Layer.merge(Layer.provideMerge(FileSystem.layer, CommandExecutor.layer))( /*#__PURE__*/Layer.merge(Path.layer)(FileSystem.layer));
|
|
14
|
+
//# sourceMappingURL=BunContext.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"BunContext.mjs","names":["Layer","CommandExecutor","FileSystem","Path","layer","merge","provideMerge"],"sources":["../src/BunContext.ts"],"sourcesContent":[null],"mappings":"AAAA;;;;AAIA,OAAO,KAAKA,KAAK,MAAM,kBAAkB;AACzC,OAAO,KAAKC,eAAe,MAAM,sCAAsC;AACvE,OAAO,KAAKC,UAAU,MAAM,iCAAiC;AAC7D,OAAO,KAAKC,IAAI,MAAM,2BAA2B;AAQjD;;;;AAIA,OAAO,MAAMC,KAAK,gBAGhBJ,KAAK,CAACK,KAAK,CAACL,KAAK,CAACM,YAAY,CAACJ,UAAU,CAACE,KAAK,EAAEH,eAAe,CAACG,KAAK,CAAC,CAAC,eADxEJ,KAAK,CAACK,KAAK,CAACF,IAAI,CAACC,KAAK,CAAC,CADvBF,UAAU,CAACE,KAAK,EAGjB"}
|
package/mjs/Command.mjs
ADDED
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @since 1.0.0
|
|
3
|
+
*/
|
|
4
|
+
export {
|
|
5
|
+
/**
|
|
6
|
+
* @since 1.0.0
|
|
7
|
+
* @category combinators
|
|
8
|
+
*/
|
|
9
|
+
env,
|
|
10
|
+
/**
|
|
11
|
+
* @since 1.0.0
|
|
12
|
+
* @category execution
|
|
13
|
+
*/
|
|
14
|
+
exitCode,
|
|
15
|
+
/**
|
|
16
|
+
* @since 1.0.0
|
|
17
|
+
* @category combinators
|
|
18
|
+
*/
|
|
19
|
+
feed,
|
|
20
|
+
/**
|
|
21
|
+
* @since 1.0.0
|
|
22
|
+
* @category combinators
|
|
23
|
+
*/
|
|
24
|
+
flatten,
|
|
25
|
+
/**
|
|
26
|
+
* @since 1.0.0
|
|
27
|
+
* @category refinements
|
|
28
|
+
*/
|
|
29
|
+
isCommand,
|
|
30
|
+
/**
|
|
31
|
+
* @since 1.0.0
|
|
32
|
+
* @category execution
|
|
33
|
+
*/
|
|
34
|
+
lines,
|
|
35
|
+
/**
|
|
36
|
+
* @since 1.0.0
|
|
37
|
+
* @category constructors
|
|
38
|
+
*/
|
|
39
|
+
make,
|
|
40
|
+
/**
|
|
41
|
+
* @since 1.0.0
|
|
42
|
+
* @category combinators
|
|
43
|
+
*/
|
|
44
|
+
pipeTo,
|
|
45
|
+
/**
|
|
46
|
+
* @since 1.0.0
|
|
47
|
+
* @category execution
|
|
48
|
+
*/
|
|
49
|
+
start,
|
|
50
|
+
/**
|
|
51
|
+
* @since 1.0.0
|
|
52
|
+
* @category combinators
|
|
53
|
+
*/
|
|
54
|
+
stderr,
|
|
55
|
+
/**
|
|
56
|
+
* @since 1.0.0
|
|
57
|
+
* @category combinators
|
|
58
|
+
*/
|
|
59
|
+
stdin,
|
|
60
|
+
/**
|
|
61
|
+
* @since 1.0.0
|
|
62
|
+
* @category combinators
|
|
63
|
+
*/
|
|
64
|
+
stdout,
|
|
65
|
+
/**
|
|
66
|
+
* @since 1.0.0
|
|
67
|
+
* @category execution
|
|
68
|
+
*/
|
|
69
|
+
stream,
|
|
70
|
+
/**
|
|
71
|
+
* @since 1.0.0
|
|
72
|
+
* @category execution
|
|
73
|
+
*/
|
|
74
|
+
streamLines,
|
|
75
|
+
/**
|
|
76
|
+
* @since 1.0.0
|
|
77
|
+
* @category execution
|
|
78
|
+
*/
|
|
79
|
+
string,
|
|
80
|
+
/**
|
|
81
|
+
* @since 1.0.0
|
|
82
|
+
* @category combinators
|
|
83
|
+
*/
|
|
84
|
+
workingDirectory } from "@effect/platform/Command";
|
|
85
|
+
//# sourceMappingURL=Command.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Command.mjs","names":["env","exitCode","feed","flatten","isCommand","lines","make","pipeTo","start","stderr","stdin","stdout","stream","streamLines","string","workingDirectory"],"sources":["../src/Command.ts"],"sourcesContent":[null],"mappings":"AAAA;;;AAgCA;AACE;;;;AAIAA,GAAG;AACH;;;;AAIAC,QAAQ;AACR;;;;AAIAC,IAAI;AACJ;;;;AAIAC,OAAO;AACP;;;;AAIAC,SAAS;AACT;;;;AAIAC,KAAK;AACL;;;;AAIAC,IAAI;AACJ;;;;AAIAC,MAAM;AACN;;;;AAIAC,KAAK;AACL;;;;AAIAC,MAAM;AACN;;;;AAIAC,KAAK;AACL;;;;AAIAC,MAAM;AACN;;;;AAIAC,MAAM;AACN;;;;AAIAC,WAAW;AACX;;;;AAIAC,MAAM;AACN;;;;AAIAC,gBAAgB,QACX,0BAA0B"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @since 1.0.0
|
|
3
|
+
*/
|
|
4
|
+
export {
|
|
5
|
+
/**
|
|
6
|
+
* @since 1.0.0
|
|
7
|
+
* @category tag
|
|
8
|
+
*/
|
|
9
|
+
CommandExecutor,
|
|
10
|
+
/**
|
|
11
|
+
* @since 1.0.0
|
|
12
|
+
* @category layer
|
|
13
|
+
*/
|
|
14
|
+
layer } from "@effect/platform-node/CommandExecutor";
|
|
15
|
+
//# sourceMappingURL=CommandExecutor.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CommandExecutor.mjs","names":["CommandExecutor","layer"],"sources":["../src/CommandExecutor.ts"],"sourcesContent":[null],"mappings":"AAAA;;;AAgCA;AACE;;;;AAIAA,eAAe;AACf;;;;AAIAC,KAAK,QACA,uCAAuC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Effectify.mjs","names":["effectify"],"sources":["../src/Effectify.ts"],"sourcesContent":[null],"mappings":"AAAA;;;AAeA;AACE;;;;AAIAA,SAAS,QACJ,4BAA4B"}
|
package/mjs/Error.mjs
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @since 1.0.0
|
|
3
|
+
*/
|
|
4
|
+
export {
|
|
5
|
+
/**
|
|
6
|
+
* @since 1.0.0
|
|
7
|
+
* @category error
|
|
8
|
+
*/
|
|
9
|
+
BadArgument,
|
|
10
|
+
/**
|
|
11
|
+
* @since 1.0.0
|
|
12
|
+
* @category type id
|
|
13
|
+
*/
|
|
14
|
+
PlatformErrorTypeId,
|
|
15
|
+
/**
|
|
16
|
+
* @since 1.0.0
|
|
17
|
+
* @category error
|
|
18
|
+
*/
|
|
19
|
+
SystemError } from "@effect/platform/Error";
|
|
20
|
+
//# sourceMappingURL=Error.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Error.mjs","names":["BadArgument","PlatformErrorTypeId","SystemError"],"sources":["../src/Error.ts"],"sourcesContent":[null],"mappings":"AAAA;;;AAIA;AACE;;;;AAIAA,WAAW;AAMX;;;;AAIAC,mBAAmB;AACnB;;;;AAIAC,WAAW,QAMN,wBAAwB"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @since 1.0.0
|
|
3
|
+
*/
|
|
4
|
+
export {
|
|
5
|
+
/**
|
|
6
|
+
* @since 1.0.0
|
|
7
|
+
* @category tag
|
|
8
|
+
*/
|
|
9
|
+
FileSystem,
|
|
10
|
+
/**
|
|
11
|
+
* @since 1.0.0
|
|
12
|
+
* @category layer
|
|
13
|
+
*/
|
|
14
|
+
layer,
|
|
15
|
+
/**
|
|
16
|
+
* @since 1.0.0
|
|
17
|
+
* @category constructor
|
|
18
|
+
*/
|
|
19
|
+
Size } from "@effect/platform-node/FileSystem";
|
|
20
|
+
//# sourceMappingURL=FileSystem.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FileSystem.mjs","names":["FileSystem","layer","Size"],"sources":["../src/FileSystem.ts"],"sourcesContent":[null],"mappings":"AAAA;;;AAyDA;AACE;;;;AAIAA,UAAU;AACV;;;;AAIAC,KAAK;AACL;;;;AAIAC,IAAI,QACC,kCAAkC"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import * as internal from "@effect/platform-bun/internal/http/server";
|
|
2
|
+
/**
|
|
3
|
+
* @since 1.0.0
|
|
4
|
+
*/
|
|
5
|
+
export * from "@effect/platform/Http/Server";
|
|
6
|
+
/**
|
|
7
|
+
* @since 1.0.0
|
|
8
|
+
* @category constructors
|
|
9
|
+
*/
|
|
10
|
+
export const make = internal.make;
|
|
11
|
+
/**
|
|
12
|
+
* @since 1.0.0
|
|
13
|
+
* @category layers
|
|
14
|
+
*/
|
|
15
|
+
export const layer = internal.layer;
|
|
16
|
+
/**
|
|
17
|
+
* @since 1.0.0
|
|
18
|
+
* @category layers
|
|
19
|
+
*/
|
|
20
|
+
export const layerConfig = internal.layerConfig;
|
|
21
|
+
//# sourceMappingURL=Server.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Server.mjs","names":["internal","make","layer","layerConfig"],"sources":["../../src/Http/Server.ts"],"sourcesContent":[null],"mappings":"AAUA,OAAO,KAAKA,QAAQ,MAAM,2CAA2C;AAKrE;;;AAGA,cAAc,8BAA8B;AAE5C;;;;AAIA,OAAO,MAAMC,IAAI,GAEuCD,QAAQ,CAACC,IAAI;AAErE;;;;AAIA,OAAO,MAAMC,KAAK,GAE+CF,QAAQ,CAACE,KAAK;AAE/E;;;;AAIA,OAAO,MAAMC,WAAW,GAE2DH,QAAQ,CAACG,WAAW"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import * as internal from "@effect/platform-bun/internal/http/serverResponse";
|
|
2
|
+
export * from "@effect/platform/Http/ServerResponse";
|
|
3
|
+
/**
|
|
4
|
+
* @since 1.0.0
|
|
5
|
+
* @category constructors
|
|
6
|
+
*/
|
|
7
|
+
export const file = internal.file;
|
|
8
|
+
/**
|
|
9
|
+
* @since 1.0.0
|
|
10
|
+
* @category constructors
|
|
11
|
+
*/
|
|
12
|
+
export const fileWeb = internal.fileWeb;
|
|
13
|
+
//# sourceMappingURL=ServerResponse.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ServerResponse.mjs","names":["internal","file","fileWeb"],"sources":["../../src/Http/ServerResponse.ts"],"sourcesContent":[null],"mappings":"AAMA,OAAO,KAAKA,QAAQ,MAAM,mDAAmD;AAO7E,cAAc,sCAAsC;AAEpD;;;;AAIA,OAAO,MAAMC,IAAI,GAIfD,QAAQ,CAACC,IAAI;AAEf;;;;AAIA,OAAO,MAAMC,OAAO,GAGuDF,QAAQ,CAACE,OAAO"}
|
|
@@ -0,0 +1,61 @@
|
|
|
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
|
+
export {
|
|
12
|
+
/**
|
|
13
|
+
* @since 1.0.0
|
|
14
|
+
*
|
|
15
|
+
* - Docs: [Http/Body](https://effect-ts.github.io/platform/platform/Http/Body.ts.html)
|
|
16
|
+
* - Module: `@effect/platform/Http/Body`
|
|
17
|
+
*/
|
|
18
|
+
body,
|
|
19
|
+
/**
|
|
20
|
+
* @since 1.0.0
|
|
21
|
+
*
|
|
22
|
+
* - Docs: [Http/Client](https://effect-ts.github.io/platform/platform/Http/Client.ts.html)
|
|
23
|
+
* - Module: `@effect/platform/Http/Client`
|
|
24
|
+
*/
|
|
25
|
+
client,
|
|
26
|
+
/**
|
|
27
|
+
* @since 1.0.0
|
|
28
|
+
*
|
|
29
|
+
* - Docs: [Http/ClientError](https://effect-ts.github.io/platform/platform/Http/ClientError.ts.html)
|
|
30
|
+
* - Module: `@effect/platform/Http/ClientError`
|
|
31
|
+
*/
|
|
32
|
+
error,
|
|
33
|
+
/**
|
|
34
|
+
* @since 1.0.0
|
|
35
|
+
*
|
|
36
|
+
* - Docs: [Http/Headers](https://effect-ts.github.io/platform/platform/Http/Headers.ts.html)
|
|
37
|
+
* - Module: `@effect/platform/Http/Headers`
|
|
38
|
+
*/
|
|
39
|
+
headers,
|
|
40
|
+
/**
|
|
41
|
+
* @since 1.0.0
|
|
42
|
+
*
|
|
43
|
+
* - Docs: [Http/ClientRequest](https://effect-ts.github.io/platform/platform/Http/ClientRequest.ts.html)
|
|
44
|
+
* - Module: `@effect/platform/Http/ClientRequest`
|
|
45
|
+
*/
|
|
46
|
+
request,
|
|
47
|
+
/**
|
|
48
|
+
* @since 1.0.0
|
|
49
|
+
*
|
|
50
|
+
* - Docs: [Http/ClientResponse](https://effect-ts.github.io/platform/platform/Http/ClientResponse.ts.html)
|
|
51
|
+
* - Module: `@effect/platform/Http/ClientResponse`
|
|
52
|
+
*/
|
|
53
|
+
response,
|
|
54
|
+
/**
|
|
55
|
+
* @since 1.0.0
|
|
56
|
+
*
|
|
57
|
+
* - Docs: [Http/UrlParams](https://effect-ts.github.io/platform/platform/Http/UrlParams.ts.html)
|
|
58
|
+
* - Module: `@effect/platform/Http/UrlParams`
|
|
59
|
+
*/
|
|
60
|
+
urlParams };
|
|
61
|
+
//# sourceMappingURL=HttpClient.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"HttpClient.mjs","names":["body","client","error","request","response","headers","urlParams"],"sources":["../src/HttpClient.ts"],"sourcesContent":[null],"mappings":"AAAA;;;AAGA,OAAO,KAAKA,IAAI,MAAM,4BAA4B;AAClD,OAAO,KAAKC,MAAM,MAAM,8BAA8B;AACtD,OAAO,KAAKC,KAAK,MAAM,mCAAmC;AAC1D,OAAO,KAAKC,OAAO,MAAM,qCAAqC;AAC9D,OAAO,KAAKC,QAAQ,MAAM,sCAAsC;AAChE,OAAO,KAAKC,OAAO,MAAM,+BAA+B;AACxD,OAAO,KAAKC,SAAS,MAAM,iCAAiC;AAE5D;AACE;;;;;;AAMAN,IAAI;AACJ;;;;;;AAMAC,MAAM;AACN;;;;;;AAMAC,KAAK;AACL;;;;;;AAMAG,OAAO;AACP;;;;;;AAMAF,OAAO;AACP;;;;;;AAMAC,QAAQ;AACR;;;;;;AAMAE,SAAS"}
|