effect-start 0.18.0 → 0.20.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/README.md +3 -3
- package/dist/Development.d.ts +8 -3
- package/dist/Development.js +14 -7
- package/dist/Effectify.d.ts +212 -0
- package/dist/Effectify.js +19 -0
- package/dist/FilePathPattern.d.ts +29 -0
- package/dist/FilePathPattern.js +86 -0
- package/dist/FileRouter.d.ts +39 -41
- package/dist/FileRouter.js +104 -158
- package/dist/FileRouterCodegen.d.ts +7 -8
- package/dist/FileRouterCodegen.js +97 -66
- package/dist/PlatformError.d.ts +46 -0
- package/dist/PlatformError.js +43 -0
- package/dist/PlatformRuntime.d.ts +27 -0
- package/dist/PlatformRuntime.js +51 -0
- package/dist/Route.d.ts +6 -2
- package/dist/Route.js +22 -0
- package/dist/RouteBody.d.ts +1 -1
- package/dist/RouteHttp.d.ts +1 -1
- package/dist/RouteHttp.js +12 -19
- package/dist/RouteMount.d.ts +2 -1
- package/dist/Start.d.ts +33 -6
- package/dist/Start.js +31 -13
- package/dist/Unique.d.ts +50 -0
- package/dist/Unique.js +187 -0
- package/dist/bun/BunHttpServer.js +5 -6
- package/dist/bun/BunPlatformHttpServer.d.ts +10 -0
- package/dist/bun/BunPlatformHttpServer.js +53 -0
- package/dist/bun/BunRoute.d.ts +4 -6
- package/dist/bun/BunRoute.js +10 -18
- package/dist/bun/BunRuntime.d.ts +2 -1
- package/dist/bun/BunRuntime.js +10 -5
- package/dist/bun/BunServer.d.ts +33 -0
- package/dist/bun/BunServer.js +133 -0
- package/dist/bun/BunServerRequest.d.ts +60 -0
- package/dist/bun/BunServerRequest.js +252 -0
- package/dist/bun/index.d.ts +1 -1
- package/dist/bun/index.js +1 -1
- package/dist/datastar/actions/fetch.d.ts +30 -0
- package/dist/datastar/actions/fetch.js +411 -0
- package/dist/datastar/actions/peek.d.ts +1 -0
- package/dist/datastar/actions/peek.js +14 -0
- package/dist/datastar/actions/setAll.d.ts +1 -0
- package/dist/datastar/actions/setAll.js +13 -0
- package/dist/datastar/actions/toggleAll.d.ts +1 -0
- package/dist/datastar/actions/toggleAll.js +13 -0
- package/dist/datastar/attributes/attr.d.ts +1 -0
- package/dist/datastar/attributes/attr.js +49 -0
- package/dist/datastar/attributes/bind.d.ts +1 -0
- package/dist/datastar/attributes/bind.js +183 -0
- package/dist/datastar/attributes/class.d.ts +1 -0
- package/dist/datastar/attributes/class.js +50 -0
- package/dist/datastar/attributes/computed.d.ts +1 -0
- package/dist/datastar/attributes/computed.js +27 -0
- package/dist/datastar/attributes/effect.d.ts +1 -0
- package/dist/datastar/attributes/effect.js +10 -0
- package/dist/datastar/attributes/indicator.d.ts +1 -0
- package/dist/datastar/attributes/indicator.js +32 -0
- package/dist/datastar/attributes/init.d.ts +1 -0
- package/dist/datastar/attributes/init.js +27 -0
- package/dist/datastar/attributes/jsonSignals.d.ts +1 -0
- package/dist/datastar/attributes/jsonSignals.js +31 -0
- package/dist/datastar/attributes/on.d.ts +1 -0
- package/dist/datastar/attributes/on.js +59 -0
- package/dist/datastar/attributes/onIntersect.d.ts +1 -0
- package/dist/datastar/attributes/onIntersect.js +54 -0
- package/dist/datastar/attributes/onInterval.d.ts +1 -0
- package/dist/datastar/attributes/onInterval.js +31 -0
- package/dist/datastar/attributes/onSignalPatch.d.ts +1 -0
- package/dist/datastar/attributes/onSignalPatch.js +44 -0
- package/dist/datastar/attributes/ref.d.ts +1 -0
- package/dist/datastar/attributes/ref.js +11 -0
- package/dist/datastar/attributes/show.d.ts +1 -0
- package/dist/datastar/attributes/show.js +32 -0
- package/dist/datastar/attributes/signals.d.ts +1 -0
- package/dist/datastar/attributes/signals.js +18 -0
- package/dist/datastar/attributes/style.d.ts +1 -0
- package/dist/datastar/attributes/style.js +56 -0
- package/dist/datastar/attributes/text.d.ts +1 -0
- package/dist/datastar/attributes/text.js +27 -0
- package/dist/datastar/engine.d.ts +156 -0
- package/dist/datastar/engine.js +971 -0
- package/dist/datastar/index.d.ts +24 -0
- package/dist/datastar/index.js +24 -0
- package/dist/datastar/load.d.ts +24 -0
- package/dist/datastar/load.js +24 -0
- package/dist/datastar/utils.d.ts +51 -0
- package/dist/datastar/utils.js +205 -0
- package/dist/datastar/watchers/patchElements.d.ts +1 -0
- package/dist/datastar/watchers/patchElements.js +420 -0
- package/dist/datastar/watchers/patchSignals.d.ts +1 -0
- package/dist/datastar/watchers/patchSignals.js +15 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/dist/node/Effectify.d.ts +209 -0
- package/dist/node/Effectify.js +19 -0
- package/dist/node/FileSystem.d.ts +3 -5
- package/dist/node/FileSystem.js +42 -62
- package/dist/node/NodeFileSystem.d.ts +7 -0
- package/dist/node/NodeFileSystem.js +420 -0
- package/dist/node/NodeUtils.d.ts +2 -0
- package/dist/node/NodeUtils.js +20 -0
- package/dist/node/PlatformError.d.ts +46 -0
- package/dist/node/PlatformError.js +43 -0
- package/dist/testing/TestLogger.js +1 -1
- package/dist/x/tailwind/plugin.js +1 -1
- package/package.json +18 -7
- package/src/Development.ts +36 -40
- package/src/Effectify.ts +269 -0
- package/src/FilePathPattern.ts +115 -0
- package/src/FileRouter.ts +178 -255
- package/src/FileRouterCodegen.ts +135 -92
- package/src/PlatformError.ts +117 -0
- package/src/PlatformRuntime.ts +108 -0
- package/src/Route.ts +31 -2
- package/src/RouteBody.ts +1 -1
- package/src/RouteHttp.ts +15 -29
- package/src/RouteMount.ts +1 -1
- package/src/Start.ts +61 -27
- package/src/Unique.ts +232 -0
- package/src/bun/BunPlatformHttpServer.ts +88 -0
- package/src/bun/BunRoute.ts +14 -24
- package/src/bun/BunRuntime.ts +21 -5
- package/src/bun/BunServer.ts +228 -0
- package/src/bun/index.ts +1 -1
- package/src/datastar/README.md +18 -0
- package/src/datastar/actions/fetch.ts +609 -0
- package/src/datastar/actions/peek.ts +17 -0
- package/src/datastar/actions/setAll.ts +20 -0
- package/src/datastar/actions/toggleAll.ts +20 -0
- package/src/datastar/attributes/attr.ts +50 -0
- package/src/datastar/attributes/bind.ts +220 -0
- package/src/datastar/attributes/class.ts +57 -0
- package/src/datastar/attributes/computed.ts +33 -0
- package/src/datastar/attributes/effect.ts +11 -0
- package/src/datastar/attributes/indicator.ts +39 -0
- package/src/datastar/attributes/init.ts +35 -0
- package/src/datastar/attributes/jsonSignals.ts +38 -0
- package/src/datastar/attributes/on.ts +71 -0
- package/src/datastar/attributes/onIntersect.ts +65 -0
- package/src/datastar/attributes/onInterval.ts +39 -0
- package/src/datastar/attributes/onSignalPatch.ts +63 -0
- package/src/datastar/attributes/ref.ts +12 -0
- package/src/datastar/attributes/show.ts +33 -0
- package/src/datastar/attributes/signals.ts +22 -0
- package/src/datastar/attributes/style.ts +63 -0
- package/src/datastar/attributes/text.ts +30 -0
- package/src/datastar/engine.ts +1341 -0
- package/src/datastar/index.ts +25 -0
- package/src/datastar/utils.ts +286 -0
- package/src/datastar/watchers/patchElements.ts +554 -0
- package/src/datastar/watchers/patchSignals.ts +15 -0
- package/src/index.ts +1 -0
- package/src/node/{FileSystem.ts → NodeFileSystem.ts} +59 -97
- package/src/node/{Utils.ts → NodeUtils.ts} +2 -0
- package/src/testing/TestLogger.ts +1 -1
- package/src/x/tailwind/plugin.ts +1 -1
- package/dist/Random.d.ts +0 -5
- package/dist/Random.js +0 -49
- package/src/Commander.test.ts +0 -1639
- package/src/ContentNegotiation.test.ts +0 -603
- package/src/Development.test.ts +0 -119
- package/src/Entity.test.ts +0 -592
- package/src/FileRouterCodegen.todo.ts +0 -1133
- package/src/FileRouterPattern.test.ts +0 -147
- package/src/FileRouterPattern.ts +0 -59
- package/src/FileRouter_files.test.ts +0 -64
- package/src/FileRouter_path.test.ts +0 -145
- package/src/FileRouter_tree.test.ts +0 -132
- package/src/Http.test.ts +0 -319
- package/src/HttpAppExtra.test.ts +0 -103
- package/src/HttpUtils.test.ts +0 -85
- package/src/PathPattern.test.ts +0 -648
- package/src/Random.ts +0 -59
- package/src/RouteBody.test.ts +0 -232
- package/src/RouteHook.test.ts +0 -40
- package/src/RouteHttp.test.ts +0 -2909
- package/src/RouteMount.test.ts +0 -481
- package/src/RouteSchema.test.ts +0 -427
- package/src/RouteSse.test.ts +0 -249
- package/src/RouteTree.test.ts +0 -494
- package/src/RouteTrie.test.ts +0 -322
- package/src/RouterPattern.test.ts +0 -676
- package/src/RouterPattern.ts +0 -416
- package/src/StartApp.ts +0 -47
- package/src/Values.test.ts +0 -263
- package/src/bun/BunBundle.test.ts +0 -268
- package/src/bun/BunBundle_imports.test.ts +0 -48
- package/src/bun/BunHttpServer.test.ts +0 -251
- package/src/bun/BunHttpServer.ts +0 -306
- package/src/bun/BunImportTrackerPlugin.test.ts +0 -77
- package/src/bun/BunRoute.test.ts +0 -162
- package/src/bundler/BundleHttp.test.ts +0 -132
- package/src/effect/HttpRouter.test.ts +0 -548
- package/src/experimental/EncryptedCookies.test.ts +0 -488
- package/src/hyper/HyperHtml.test.ts +0 -209
- package/src/hyper/HyperRoute.test.tsx +0 -197
- package/src/middlewares/BasicAuthMiddleware.test.ts +0 -84
- package/src/testing/TestHttpClient.test.ts +0 -83
- package/src/testing/TestLogger.test.ts +0 -51
- package/src/x/datastar/Datastar.test.ts +0 -266
- package/src/x/tailwind/TailwindPlugin.test.ts +0 -333
- /package/src/bun/{BunHttpServer_web.ts → BunServerRequest.ts} +0 -0
|
@@ -0,0 +1,252 @@
|
|
|
1
|
+
import * as Cookies from "@effect/platform/Cookies";
|
|
2
|
+
import * as Headers from "@effect/platform/Headers";
|
|
3
|
+
import * as HttpApp from "@effect/platform/HttpApp";
|
|
4
|
+
import * as HttpIncomingMessage from "@effect/platform/HttpIncomingMessage";
|
|
5
|
+
import * as HttpServerError from "@effect/platform/HttpServerError";
|
|
6
|
+
import * as HttpServerRequest from "@effect/platform/HttpServerRequest";
|
|
7
|
+
import * as Socket from "@effect/platform/Socket";
|
|
8
|
+
import * as UrlParams from "@effect/platform/UrlParams";
|
|
9
|
+
import * as Deferred from "effect/Deferred";
|
|
10
|
+
import * as Effect from "effect/Effect";
|
|
11
|
+
import * as FiberSet from "effect/FiberSet";
|
|
12
|
+
import * as Inspectable from "effect/Inspectable";
|
|
13
|
+
import * as Option from "effect/Option";
|
|
14
|
+
import * as Stream from "effect/Stream";
|
|
15
|
+
export class ServerRequestImpl extends Inspectable.Class {
|
|
16
|
+
[HttpServerRequest.TypeId];
|
|
17
|
+
[HttpIncomingMessage.TypeId];
|
|
18
|
+
source;
|
|
19
|
+
resolve;
|
|
20
|
+
url;
|
|
21
|
+
bunServer;
|
|
22
|
+
headersOverride;
|
|
23
|
+
remoteAddressOverride;
|
|
24
|
+
constructor(source, resolve, url, bunServer, headersOverride, remoteAddressOverride) {
|
|
25
|
+
super();
|
|
26
|
+
this[HttpServerRequest.TypeId] = HttpServerRequest.TypeId;
|
|
27
|
+
this[HttpIncomingMessage.TypeId] = HttpIncomingMessage.TypeId;
|
|
28
|
+
this.source = source;
|
|
29
|
+
this.resolve = resolve;
|
|
30
|
+
this.url = url;
|
|
31
|
+
this.bunServer = bunServer;
|
|
32
|
+
this.headersOverride = headersOverride;
|
|
33
|
+
this.remoteAddressOverride = remoteAddressOverride;
|
|
34
|
+
}
|
|
35
|
+
toJSON() {
|
|
36
|
+
return HttpIncomingMessage.inspect(this, {
|
|
37
|
+
_id: "@effect/platform/HttpServerRequest",
|
|
38
|
+
method: this.method,
|
|
39
|
+
url: this.originalUrl,
|
|
40
|
+
});
|
|
41
|
+
}
|
|
42
|
+
modify(options) {
|
|
43
|
+
return new ServerRequestImpl(this.source, this.resolve, options.url ?? this.url, this.bunServer, options.headers ?? this.headersOverride, options.remoteAddress ?? this.remoteAddressOverride);
|
|
44
|
+
}
|
|
45
|
+
get method() {
|
|
46
|
+
return this.source.method.toUpperCase();
|
|
47
|
+
}
|
|
48
|
+
get originalUrl() {
|
|
49
|
+
return this.source.url;
|
|
50
|
+
}
|
|
51
|
+
get remoteAddress() {
|
|
52
|
+
return this.remoteAddressOverride
|
|
53
|
+
? Option.some(this.remoteAddressOverride)
|
|
54
|
+
: Option.fromNullable(this.bunServer.requestIP(this.source)?.address);
|
|
55
|
+
}
|
|
56
|
+
get headers() {
|
|
57
|
+
this.headersOverride ??= Headers.fromInput(this.source.headers);
|
|
58
|
+
return this.headersOverride;
|
|
59
|
+
}
|
|
60
|
+
cachedCookies;
|
|
61
|
+
get cookies() {
|
|
62
|
+
if (this.cachedCookies) {
|
|
63
|
+
return this.cachedCookies;
|
|
64
|
+
}
|
|
65
|
+
return this.cachedCookies = Cookies.parseHeader(this.headers.cookie ?? "");
|
|
66
|
+
}
|
|
67
|
+
get stream() {
|
|
68
|
+
return this.source.body
|
|
69
|
+
? Stream.fromReadableStream(() => this.source.body, (cause) => new HttpServerError.RequestError({
|
|
70
|
+
request: this,
|
|
71
|
+
reason: "Decode",
|
|
72
|
+
cause,
|
|
73
|
+
}))
|
|
74
|
+
: Stream.fail(new HttpServerError.RequestError({
|
|
75
|
+
request: this,
|
|
76
|
+
reason: "Decode",
|
|
77
|
+
description: "can not create stream from empty body",
|
|
78
|
+
}));
|
|
79
|
+
}
|
|
80
|
+
textEffect;
|
|
81
|
+
get text() {
|
|
82
|
+
if (this.textEffect) {
|
|
83
|
+
return this.textEffect;
|
|
84
|
+
}
|
|
85
|
+
this.textEffect = Effect.runSync(Effect.cached(Effect.tryPromise({
|
|
86
|
+
try: () => this.source.text(),
|
|
87
|
+
catch: (cause) => new HttpServerError.RequestError({
|
|
88
|
+
request: this,
|
|
89
|
+
reason: "Decode",
|
|
90
|
+
cause,
|
|
91
|
+
}),
|
|
92
|
+
})));
|
|
93
|
+
return this.textEffect;
|
|
94
|
+
}
|
|
95
|
+
get json() {
|
|
96
|
+
return Effect.tryMap(this.text, {
|
|
97
|
+
try: (_) => JSON.parse(_),
|
|
98
|
+
catch: (cause) => new HttpServerError.RequestError({
|
|
99
|
+
request: this,
|
|
100
|
+
reason: "Decode",
|
|
101
|
+
cause,
|
|
102
|
+
}),
|
|
103
|
+
});
|
|
104
|
+
}
|
|
105
|
+
get urlParamsBody() {
|
|
106
|
+
return Effect.flatMap(this.text, (_) => Effect.try({
|
|
107
|
+
try: () => UrlParams.fromInput(new URLSearchParams(_)),
|
|
108
|
+
catch: (cause) => new HttpServerError.RequestError({
|
|
109
|
+
request: this,
|
|
110
|
+
reason: "Decode",
|
|
111
|
+
cause,
|
|
112
|
+
}),
|
|
113
|
+
}));
|
|
114
|
+
}
|
|
115
|
+
multipartEffect;
|
|
116
|
+
get multipart() {
|
|
117
|
+
if (this.multipartEffect) {
|
|
118
|
+
return this.multipartEffect;
|
|
119
|
+
}
|
|
120
|
+
this.multipartEffect = Effect.runSync(Effect.cached(Effect.die("Multipart not implemented")));
|
|
121
|
+
return this.multipartEffect;
|
|
122
|
+
}
|
|
123
|
+
get multipartStream() {
|
|
124
|
+
return Stream.die("Multipart stream not implemented");
|
|
125
|
+
}
|
|
126
|
+
arrayBufferEffect;
|
|
127
|
+
get arrayBuffer() {
|
|
128
|
+
if (this.arrayBufferEffect) {
|
|
129
|
+
return this.arrayBufferEffect;
|
|
130
|
+
}
|
|
131
|
+
this.arrayBufferEffect = Effect.runSync(Effect.cached(Effect.tryPromise({
|
|
132
|
+
try: () => this.source.arrayBuffer(),
|
|
133
|
+
catch: (cause) => new HttpServerError.RequestError({
|
|
134
|
+
request: this,
|
|
135
|
+
reason: "Decode",
|
|
136
|
+
cause,
|
|
137
|
+
}),
|
|
138
|
+
})));
|
|
139
|
+
return this.arrayBufferEffect;
|
|
140
|
+
}
|
|
141
|
+
get upgrade() {
|
|
142
|
+
return Effect.flatMap(Effect.all([
|
|
143
|
+
Deferred.make(),
|
|
144
|
+
Deferred.make(),
|
|
145
|
+
Effect.makeSemaphore(1),
|
|
146
|
+
]), ([deferred, closeDeferred, semaphore]) => Effect.async((resume) => {
|
|
147
|
+
const success = this.bunServer.upgrade(this.source, {
|
|
148
|
+
data: {
|
|
149
|
+
deferred,
|
|
150
|
+
closeDeferred,
|
|
151
|
+
buffer: [],
|
|
152
|
+
run: wsDefaultRun,
|
|
153
|
+
},
|
|
154
|
+
});
|
|
155
|
+
if (!success) {
|
|
156
|
+
resume(Effect.fail(new HttpServerError.RequestError({
|
|
157
|
+
request: this,
|
|
158
|
+
reason: "Decode",
|
|
159
|
+
description: "Not an upgradeable ServerRequest",
|
|
160
|
+
})));
|
|
161
|
+
return;
|
|
162
|
+
}
|
|
163
|
+
resume(Effect.map(Deferred.await(deferred), (ws) => {
|
|
164
|
+
const write = (chunk) => Effect.sync(() => {
|
|
165
|
+
if (typeof chunk === "string") {
|
|
166
|
+
ws.sendText(chunk);
|
|
167
|
+
}
|
|
168
|
+
else if (Socket.isCloseEvent(chunk)) {
|
|
169
|
+
ws.close(chunk.code, chunk.reason);
|
|
170
|
+
}
|
|
171
|
+
else {
|
|
172
|
+
ws.sendBinary(chunk);
|
|
173
|
+
}
|
|
174
|
+
return true;
|
|
175
|
+
});
|
|
176
|
+
const writer = Effect.succeed(write);
|
|
177
|
+
const runRaw = Effect.fnUntraced(function* (handler, opts) {
|
|
178
|
+
const set = yield* FiberSet.make();
|
|
179
|
+
const run = yield* FiberSet.runtime(set)();
|
|
180
|
+
function runRawInner(data) {
|
|
181
|
+
const result = handler(data);
|
|
182
|
+
if (Effect.isEffect(result)) {
|
|
183
|
+
run(result);
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
ws.data.run = runRawInner;
|
|
187
|
+
ws.data.buffer.forEach(runRawInner);
|
|
188
|
+
ws.data.buffer.length = 0;
|
|
189
|
+
if (opts?.onOpen)
|
|
190
|
+
yield* opts.onOpen;
|
|
191
|
+
return yield* FiberSet.join(set);
|
|
192
|
+
}, Effect.scoped, Effect.onExit((exit) => {
|
|
193
|
+
ws.close(exit._tag === "Success" ? 1000 : 1011);
|
|
194
|
+
return Effect.void;
|
|
195
|
+
}), Effect.raceFirst(Deferred.await(closeDeferred)), semaphore.withPermits(1));
|
|
196
|
+
const encoder = new TextEncoder();
|
|
197
|
+
const run = (handler, opts) => runRaw((data) => typeof data === "string"
|
|
198
|
+
? handler(encoder.encode(data))
|
|
199
|
+
: handler(data), opts);
|
|
200
|
+
return Socket.Socket.of({
|
|
201
|
+
[Socket.TypeId]: Socket.TypeId,
|
|
202
|
+
run,
|
|
203
|
+
runRaw,
|
|
204
|
+
writer,
|
|
205
|
+
});
|
|
206
|
+
}));
|
|
207
|
+
}));
|
|
208
|
+
}
|
|
209
|
+
}
|
|
210
|
+
function wsDefaultRun(_) {
|
|
211
|
+
this.buffer.push(_);
|
|
212
|
+
}
|
|
213
|
+
export function makeResponse(request, response, runtime) {
|
|
214
|
+
const fields = {
|
|
215
|
+
headers: new globalThis.Headers(response.headers),
|
|
216
|
+
status: response.status,
|
|
217
|
+
};
|
|
218
|
+
if (!Cookies.isEmpty(response.cookies)) {
|
|
219
|
+
for (const header of Cookies.toSetCookieHeaders(response.cookies)) {
|
|
220
|
+
fields.headers.append("set-cookie", header);
|
|
221
|
+
}
|
|
222
|
+
}
|
|
223
|
+
if (response.statusText !== undefined) {
|
|
224
|
+
fields.statusText = response.statusText;
|
|
225
|
+
}
|
|
226
|
+
if (request.method === "HEAD") {
|
|
227
|
+
return new Response(undefined, fields);
|
|
228
|
+
}
|
|
229
|
+
const ejectedResponse = HttpApp.unsafeEjectStreamScope(response);
|
|
230
|
+
const body = ejectedResponse.body;
|
|
231
|
+
switch (body._tag) {
|
|
232
|
+
case "Empty": {
|
|
233
|
+
return new Response(undefined, fields);
|
|
234
|
+
}
|
|
235
|
+
case "Uint8Array":
|
|
236
|
+
case "Raw": {
|
|
237
|
+
if (body.body instanceof Response) {
|
|
238
|
+
for (const [key, value] of fields.headers.entries()) {
|
|
239
|
+
body.body.headers.set(key, value);
|
|
240
|
+
}
|
|
241
|
+
return body.body;
|
|
242
|
+
}
|
|
243
|
+
return new Response(body.body, fields);
|
|
244
|
+
}
|
|
245
|
+
case "FormData": {
|
|
246
|
+
return new Response(body.formData, fields);
|
|
247
|
+
}
|
|
248
|
+
case "Stream": {
|
|
249
|
+
return new Response(Stream.toReadableStreamRuntime(body.stream, runtime), fields);
|
|
250
|
+
}
|
|
251
|
+
}
|
|
252
|
+
}
|
package/dist/bun/index.d.ts
CHANGED
package/dist/bun/index.js
CHANGED
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import type { SignalFilterOptions } from "../engine.ts";
|
|
2
|
+
export declare const STARTED = "started";
|
|
3
|
+
export declare const FINISHED = "finished";
|
|
4
|
+
export declare const ERROR = "error";
|
|
5
|
+
export declare const RETRYING = "retrying";
|
|
6
|
+
export declare const RETRIES_FAILED = "retries-failed";
|
|
7
|
+
type ResponseOverrides = {
|
|
8
|
+
selector?: string;
|
|
9
|
+
mode?: string;
|
|
10
|
+
namespace?: string;
|
|
11
|
+
useViewTransition?: boolean;
|
|
12
|
+
} | {
|
|
13
|
+
onlyIfMissing?: boolean;
|
|
14
|
+
};
|
|
15
|
+
export type FetchArgs = {
|
|
16
|
+
selector?: string;
|
|
17
|
+
headers?: Record<string, string>;
|
|
18
|
+
contentType?: "json" | "form";
|
|
19
|
+
filterSignals?: SignalFilterOptions;
|
|
20
|
+
openWhenHidden?: boolean;
|
|
21
|
+
payload?: any;
|
|
22
|
+
requestCancellation?: "auto" | "disabled" | AbortController;
|
|
23
|
+
responseOverrides?: ResponseOverrides;
|
|
24
|
+
retry?: "auto" | "error" | "always" | "never";
|
|
25
|
+
retryInterval?: number;
|
|
26
|
+
retryScaler?: number;
|
|
27
|
+
retryMaxWaitMs?: number;
|
|
28
|
+
retryMaxCount?: number;
|
|
29
|
+
};
|
|
30
|
+
export {};
|