@effect/platform 0.18.4 → 0.18.5
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/Command/dist/effect-platform-Command.esm.js +12 -200
- package/CommandExecutor/dist/effect-platform-CommandExecutor.esm.js +9 -71
- package/Effectify/dist/effect-platform-Effectify.esm.js +2 -23
- package/Error/dist/effect-platform-Error.esm.js +2 -54
- package/FileSystem/dist/effect-platform-FileSystem.esm.js +10 -177
- package/Http/Body/dist/effect-platform-Http-Body.esm.js +13 -151
- package/Http/Client/dist/effect-platform-Http-Client.esm.js +28 -164
- package/Http/ClientError/dist/effect-platform-Http-ClientError.esm.js +3 -48
- package/Http/ClientRequest/dist/effect-platform-Http-ClientRequest.esm.js +20 -241
- package/Http/ClientResponse/dist/effect-platform-Http-ClientResponse.esm.js +22 -35
- package/Http/Etag/dist/effect-platform-Http-Etag.esm.js +17 -1
- package/Http/FormData/dist/effect-platform-Http-FormData.esm.js +17 -155
- package/Http/Headers/dist/effect-platform-Http-Headers.esm.js +4 -74
- package/Http/IncomingMessage/dist/effect-platform-Http-IncomingMessage.esm.js +6 -1
- package/Http/Middleware/dist/effect-platform-Http-Middleware.esm.js +30 -52
- package/Http/Platform/dist/effect-platform-Http-Platform.esm.js +56 -1
- package/Http/Router/dist/effect-platform-Http-Router.esm.js +25 -224
- package/Http/Server/dist/effect-platform-Http-Server.esm.js +18 -1
- package/Http/ServerError/dist/effect-platform-Http-ServerError.esm.js +2 -70
- package/Http/ServerRequest/dist/effect-platform-Http-ServerRequest.esm.js +20 -65
- package/Http/ServerResponse/dist/effect-platform-Http-ServerResponse.esm.js +21 -126
- package/Http/UrlParams/dist/effect-platform-Http-UrlParams.esm.js +4 -101
- package/HttpClient/dist/effect-platform-HttpClient.esm.js +32 -18
- package/HttpServer/dist/effect-platform-HttpServer.esm.js +36 -24
- package/KeyValueStore/dist/effect-platform-KeyValueStore.esm.js +15 -78
- package/Path/dist/effect-platform-Path.esm.js +8 -33
- package/Runtime/dist/effect-platform-Runtime.esm.js +3 -26
- package/dist/App-687366d8.esm.js +5 -0
- package/dist/Body-ec1353f9.esm.js +170 -0
- package/dist/Client-52ebd74a.esm.js +346 -0
- package/dist/ClientError-98b5da8c.esm.js +55 -0
- package/dist/ClientRequest-fc429335.esm.js +281 -0
- package/dist/ClientResponse-9f276554.esm.js +46 -0
- package/dist/Command-d8ab0c8d.esm.js +403 -0
- package/dist/CommandExecutor-5807b66b.esm.js +80 -0
- package/dist/Effectify-e5a9d266.esm.js +43 -0
- package/dist/Error-3099667c.esm.js +75 -0
- package/dist/FileSystem-7e31dccd.esm.js +271 -0
- package/dist/FormData-f54de878.esm.js +270 -0
- package/dist/Headers-58b56a08.esm.js +85 -0
- package/dist/HttpClient-27710864.esm.js +24 -0
- package/dist/HttpServer-e1d88a1c.esm.js +30 -0
- package/{internal/keyValueStore.esm.js → dist/KeyValueStore-2f9a70bf.esm.js} +102 -15
- package/dist/Middleware-27760041.esm.js +105 -0
- package/{internal/path.esm.js → dist/Path-46f84ba7.esm.js} +40 -4
- package/dist/Router-bf32317a.esm.js +454 -0
- package/dist/Runtime-7265fb98.esm.js +31 -0
- package/dist/ServerError-04ad5b57.esm.js +99 -0
- package/dist/ServerRequest-03161edc.esm.js +125 -0
- package/dist/ServerResponse-675e9456.esm.js +249 -0
- package/dist/UrlParams-1286c728.esm.js +114 -0
- package/{internal/http/body.esm.js → dist/body-20d78ec1.esm.js} +2 -2
- package/{internal/http/clientError.esm.js → dist/clientError-c4e1466c.esm.js} +1 -1
- package/{internal/http/clientRequest.esm.js → dist/clientRequest-1e9e0b0d.esm.js} +4 -4
- package/{internal/http/clientResponse.esm.js → dist/clientResponse-ce25dbf3.esm.js} +5 -5
- package/{internal/commandExecutor.esm.js → dist/commandExecutor-d6457489.esm.js} +1 -1
- package/dist/effect-platform.esm.js +58 -20
- package/package.json +1 -2
- package/internal/command.esm.js +0 -185
- package/internal/effectify.esm.js +0 -18
- package/internal/error.esm.js +0 -17
- package/internal/fileSystem.esm.js +0 -82
- package/internal/http/client.esm.js +0 -157
- package/internal/http/etag.esm.js +0 -19
- package/internal/http/formData.esm.js +0 -95
- package/internal/http/middleware.esm.js +0 -46
- package/internal/http/platform.esm.js +0 -52
- package/internal/http/router.esm.js +0 -199
- package/internal/http/server.esm.js +0 -20
- package/internal/http/serverError.esm.js +0 -23
- package/internal/http/serverRequest.esm.js +0 -50
- package/internal/http/serverResponse.esm.js +0 -105
|
@@ -0,0 +1,271 @@
|
|
|
1
|
+
import * as Brand from 'effect/Brand';
|
|
2
|
+
import { Tag } from 'effect/Context';
|
|
3
|
+
import * as Effect from 'effect/Effect';
|
|
4
|
+
import { pipe, identity } from 'effect/Function';
|
|
5
|
+
import * as Option from 'effect/Option';
|
|
6
|
+
import * as Sink from 'effect/Sink';
|
|
7
|
+
import * as Stream from 'effect/Stream';
|
|
8
|
+
import { B as BadArgument } from './Error-3099667c.esm.js';
|
|
9
|
+
|
|
10
|
+
/** @internal */
|
|
11
|
+
const tag = /*#__PURE__*/Tag("@effect/platform/FileSystem");
|
|
12
|
+
|
|
13
|
+
/** @internal */
|
|
14
|
+
const Size$1 = bytes => typeof bytes === "bigint" ? bytes : BigInt(bytes);
|
|
15
|
+
|
|
16
|
+
/** @internal */
|
|
17
|
+
const KiB$1 = n => Size$1(n * 1024);
|
|
18
|
+
|
|
19
|
+
/** @internal */
|
|
20
|
+
const MiB$1 = n => Size$1(n * 1024 * 1024);
|
|
21
|
+
|
|
22
|
+
/** @internal */
|
|
23
|
+
const GiB$1 = n => Size$1(n * 1024 * 1024 * 1024);
|
|
24
|
+
|
|
25
|
+
/** @internal */
|
|
26
|
+
const TiB$1 = n => Size$1(n * 1024 * 1024 * 1024 * 1024);
|
|
27
|
+
const bigint1024 = /*#__PURE__*/BigInt(1024);
|
|
28
|
+
const bigintPiB = bigint1024 * bigint1024 * bigint1024 * bigint1024 * bigint1024;
|
|
29
|
+
|
|
30
|
+
/** @internal */
|
|
31
|
+
const PiB$1 = n => Size$1(BigInt(n) * bigintPiB);
|
|
32
|
+
|
|
33
|
+
/** @internal */
|
|
34
|
+
const make$1 = impl => {
|
|
35
|
+
return tag.of({
|
|
36
|
+
...impl,
|
|
37
|
+
exists: path => pipe(impl.access(path), Effect.as(true), Effect.catchTag("SystemError", e => e.reason === "NotFound" ? Effect.succeed(false) : Effect.fail(e))),
|
|
38
|
+
readFileString: (path, encoding) => Effect.tryMap(impl.readFile(path), {
|
|
39
|
+
try: _ => new TextDecoder(encoding).decode(_),
|
|
40
|
+
catch: () => BadArgument({
|
|
41
|
+
module: "FileSystem",
|
|
42
|
+
method: "readFileString",
|
|
43
|
+
message: "invalid encoding"
|
|
44
|
+
})
|
|
45
|
+
}),
|
|
46
|
+
stream: (path, options) => pipe(impl.open(path, {
|
|
47
|
+
flag: "r"
|
|
48
|
+
}), options?.offset ? Effect.tap(file => file.seek(options.offset, "start")) : identity, Effect.map(file => stream(file, options)), Stream.unwrapScoped),
|
|
49
|
+
sink: (path, options) => pipe(impl.open(path, {
|
|
50
|
+
flag: "w",
|
|
51
|
+
...options
|
|
52
|
+
}), Effect.map(file => Sink.forEach(_ => file.writeAll(_))), Sink.unwrapScoped),
|
|
53
|
+
writeFileString: (path, data, options) => Effect.flatMap(Effect.try({
|
|
54
|
+
try: () => new TextEncoder().encode(data),
|
|
55
|
+
catch: () => BadArgument({
|
|
56
|
+
module: "FileSystem",
|
|
57
|
+
method: "writeFileString",
|
|
58
|
+
message: "could not encode string"
|
|
59
|
+
})
|
|
60
|
+
}), _ => impl.writeFile(path, _, options))
|
|
61
|
+
});
|
|
62
|
+
};
|
|
63
|
+
|
|
64
|
+
/** @internal */
|
|
65
|
+
const stream = (file, {
|
|
66
|
+
bufferSize = 4,
|
|
67
|
+
bytesToRead: bytesToRead_,
|
|
68
|
+
chunkSize: chunkSize_ = Size$1(64 * 1024)
|
|
69
|
+
} = {}) => {
|
|
70
|
+
const bytesToRead = bytesToRead_ !== undefined ? Size$1(bytesToRead_) : undefined;
|
|
71
|
+
const chunkSize = Size$1(chunkSize_);
|
|
72
|
+
return Stream.bufferChunks(Stream.unfoldEffect(BigInt(0), totalBytesRead => {
|
|
73
|
+
if (bytesToRead !== undefined && bytesToRead <= totalBytesRead) {
|
|
74
|
+
return Effect.succeed(Option.none());
|
|
75
|
+
}
|
|
76
|
+
const toRead = bytesToRead !== undefined && bytesToRead - totalBytesRead < chunkSize ? bytesToRead - totalBytesRead : chunkSize;
|
|
77
|
+
return Effect.map(file.readAlloc(toRead), Option.map(buf => [buf, Size$1(totalBytesRead + BigInt(buf.length))]));
|
|
78
|
+
}), {
|
|
79
|
+
capacity: bufferSize
|
|
80
|
+
});
|
|
81
|
+
};
|
|
82
|
+
|
|
83
|
+
/**
|
|
84
|
+
* @since 1.0.0
|
|
85
|
+
*/
|
|
86
|
+
|
|
87
|
+
/**
|
|
88
|
+
* @since 1.0.0
|
|
89
|
+
* @category model
|
|
90
|
+
*/
|
|
91
|
+
|
|
92
|
+
/**
|
|
93
|
+
* Represents a size in bytes.
|
|
94
|
+
*
|
|
95
|
+
* @since 1.0.0
|
|
96
|
+
* @category sizes
|
|
97
|
+
*/
|
|
98
|
+
|
|
99
|
+
/**
|
|
100
|
+
* Represents a size in bytes.
|
|
101
|
+
*
|
|
102
|
+
* @since 1.0.0
|
|
103
|
+
* @category sizes
|
|
104
|
+
*/
|
|
105
|
+
|
|
106
|
+
/**
|
|
107
|
+
* @since 1.0.0
|
|
108
|
+
* @category sizes
|
|
109
|
+
*/
|
|
110
|
+
const Size = Size$1;
|
|
111
|
+
|
|
112
|
+
/**
|
|
113
|
+
* @since 1.0.0
|
|
114
|
+
* @category sizes
|
|
115
|
+
*/
|
|
116
|
+
const KiB = KiB$1;
|
|
117
|
+
|
|
118
|
+
/**
|
|
119
|
+
* @since 1.0.0
|
|
120
|
+
* @category sizes
|
|
121
|
+
*/
|
|
122
|
+
const MiB = MiB$1;
|
|
123
|
+
|
|
124
|
+
/**
|
|
125
|
+
* @since 1.0.0
|
|
126
|
+
* @category sizes
|
|
127
|
+
*/
|
|
128
|
+
const GiB = GiB$1;
|
|
129
|
+
|
|
130
|
+
/**
|
|
131
|
+
* @since 1.0.0
|
|
132
|
+
* @category sizes
|
|
133
|
+
*/
|
|
134
|
+
const TiB = TiB$1;
|
|
135
|
+
|
|
136
|
+
/**
|
|
137
|
+
* @since 1.0.0
|
|
138
|
+
* @category sizes
|
|
139
|
+
*/
|
|
140
|
+
const PiB = PiB$1;
|
|
141
|
+
|
|
142
|
+
/**
|
|
143
|
+
* @since 1.0.0
|
|
144
|
+
* @category model
|
|
145
|
+
*/
|
|
146
|
+
|
|
147
|
+
/**
|
|
148
|
+
* @since 1.0.0
|
|
149
|
+
* @category options
|
|
150
|
+
*/
|
|
151
|
+
|
|
152
|
+
/**
|
|
153
|
+
* @since 1.0.0
|
|
154
|
+
* @category options
|
|
155
|
+
*/
|
|
156
|
+
|
|
157
|
+
/**
|
|
158
|
+
* @since 1.0.0
|
|
159
|
+
* @category options
|
|
160
|
+
*/
|
|
161
|
+
|
|
162
|
+
/**
|
|
163
|
+
* @since 1.0.0
|
|
164
|
+
* @category options
|
|
165
|
+
*/
|
|
166
|
+
|
|
167
|
+
/**
|
|
168
|
+
* @since 1.0.0
|
|
169
|
+
* @category options
|
|
170
|
+
*/
|
|
171
|
+
|
|
172
|
+
/**
|
|
173
|
+
* @since 1.0.0
|
|
174
|
+
* @category options
|
|
175
|
+
*/
|
|
176
|
+
|
|
177
|
+
/**
|
|
178
|
+
* @since 1.0.0
|
|
179
|
+
* @category options
|
|
180
|
+
*/
|
|
181
|
+
|
|
182
|
+
/**
|
|
183
|
+
* @since 1.0.0
|
|
184
|
+
* @category options
|
|
185
|
+
*/
|
|
186
|
+
|
|
187
|
+
/**
|
|
188
|
+
* @since 1.0.0
|
|
189
|
+
* @category options
|
|
190
|
+
*/
|
|
191
|
+
|
|
192
|
+
/**
|
|
193
|
+
* @since 1.0.0
|
|
194
|
+
* @category options
|
|
195
|
+
*/
|
|
196
|
+
|
|
197
|
+
/**
|
|
198
|
+
* @since 1.0.0
|
|
199
|
+
* @category options
|
|
200
|
+
*/
|
|
201
|
+
|
|
202
|
+
/**
|
|
203
|
+
* @since 1.0.0
|
|
204
|
+
* @category options
|
|
205
|
+
*/
|
|
206
|
+
|
|
207
|
+
/**
|
|
208
|
+
* @since 1.0.0
|
|
209
|
+
* @category tag
|
|
210
|
+
*/
|
|
211
|
+
const FileSystem = tag;
|
|
212
|
+
|
|
213
|
+
/**
|
|
214
|
+
* @since 1.0.0
|
|
215
|
+
* @category constructor
|
|
216
|
+
*/
|
|
217
|
+
const make = make$1;
|
|
218
|
+
|
|
219
|
+
/**
|
|
220
|
+
* @since 1.0.0
|
|
221
|
+
* @category type id
|
|
222
|
+
*/
|
|
223
|
+
const FileTypeId = /*#__PURE__*/Symbol.for("@effect/platform/FileSystem/File");
|
|
224
|
+
|
|
225
|
+
/**
|
|
226
|
+
* @since 1.0.0
|
|
227
|
+
* @category type id
|
|
228
|
+
*/
|
|
229
|
+
|
|
230
|
+
/**
|
|
231
|
+
* @since 1.0.0
|
|
232
|
+
* @category guard
|
|
233
|
+
*/
|
|
234
|
+
const isFile = u => typeof u === "object" && u !== null && FileTypeId in u;
|
|
235
|
+
|
|
236
|
+
/**
|
|
237
|
+
* @since 1.0.0
|
|
238
|
+
* @category model
|
|
239
|
+
*/
|
|
240
|
+
|
|
241
|
+
/**
|
|
242
|
+
* @since 1.0.0
|
|
243
|
+
*/
|
|
244
|
+
|
|
245
|
+
/**
|
|
246
|
+
* @since 1.0.0
|
|
247
|
+
* @category constructor
|
|
248
|
+
*/
|
|
249
|
+
const FileDescriptor = /*#__PURE__*/Brand.nominal();
|
|
250
|
+
|
|
251
|
+
/**
|
|
252
|
+
* @since 1.0.0
|
|
253
|
+
* @category model
|
|
254
|
+
*/
|
|
255
|
+
|
|
256
|
+
var FileSystem$1 = /*#__PURE__*/Object.freeze({
|
|
257
|
+
__proto__: null,
|
|
258
|
+
Size: Size,
|
|
259
|
+
KiB: KiB,
|
|
260
|
+
MiB: MiB,
|
|
261
|
+
GiB: GiB,
|
|
262
|
+
TiB: TiB,
|
|
263
|
+
PiB: PiB,
|
|
264
|
+
FileSystem: FileSystem,
|
|
265
|
+
make: make,
|
|
266
|
+
FileTypeId: FileTypeId,
|
|
267
|
+
isFile: isFile,
|
|
268
|
+
FileDescriptor: FileDescriptor
|
|
269
|
+
});
|
|
270
|
+
|
|
271
|
+
export { FileSystem$1 as F, GiB as G, KiB as K, MiB as M, PiB as P, Size as S, TiB as T, FileSystem as a, FileTypeId as b, FileDescriptor as c, isFile as i, make as m };
|
|
@@ -0,0 +1,270 @@
|
|
|
1
|
+
import * as Schema from '@effect/schema/Schema';
|
|
2
|
+
import * as Chunk from 'effect/Chunk';
|
|
3
|
+
import * as Data from 'effect/Data';
|
|
4
|
+
import * as Effect from 'effect/Effect';
|
|
5
|
+
import * as FiberRef from 'effect/FiberRef';
|
|
6
|
+
import { dual, pipe } from 'effect/Function';
|
|
7
|
+
import { globalValue } from 'effect/GlobalValue';
|
|
8
|
+
import * as Option from 'effect/Option';
|
|
9
|
+
import * as Predicate from 'effect/Predicate';
|
|
10
|
+
import * as ReadonlyArray from 'effect/ReadonlyArray';
|
|
11
|
+
import { S as Size } from './FileSystem-7e31dccd.esm.js';
|
|
12
|
+
|
|
13
|
+
/** @internal */
|
|
14
|
+
const TypeId$1 = /*#__PURE__*/Symbol.for("@effect/platform/Http/FormData");
|
|
15
|
+
|
|
16
|
+
/** @internal */
|
|
17
|
+
const ErrorTypeId$1 = /*#__PURE__*/Symbol.for("@effect/platform/Http/FormData/FormDataError");
|
|
18
|
+
|
|
19
|
+
/** @internal */
|
|
20
|
+
const FormDataError$1 = (reason, error) => Data.struct({
|
|
21
|
+
[ErrorTypeId$1]: ErrorTypeId$1,
|
|
22
|
+
_tag: "FormDataError",
|
|
23
|
+
reason,
|
|
24
|
+
error
|
|
25
|
+
});
|
|
26
|
+
|
|
27
|
+
/** @internal */
|
|
28
|
+
const maxParts$1 = /*#__PURE__*/globalValue("@effect/platform/Http/FormData/maxParts", () => FiberRef.unsafeMake(Option.none()));
|
|
29
|
+
|
|
30
|
+
/** @internal */
|
|
31
|
+
const withMaxParts$1 = /*#__PURE__*/dual(2, (effect, count) => Effect.locally(effect, maxParts$1, count));
|
|
32
|
+
|
|
33
|
+
/** @internal */
|
|
34
|
+
const maxFieldSize$1 = /*#__PURE__*/globalValue("@effect/platform/Http/FormData/maxFieldSize", () => FiberRef.unsafeMake(Size(10 * 1024 * 1024)));
|
|
35
|
+
|
|
36
|
+
/** @internal */
|
|
37
|
+
const withMaxFieldSize$1 = /*#__PURE__*/dual(2, (effect, size) => Effect.locally(effect, maxFieldSize$1, Size(size)));
|
|
38
|
+
|
|
39
|
+
/** @internal */
|
|
40
|
+
const maxFields$1 = /*#__PURE__*/globalValue("@effect/platform/Http/FormData/maxFields", () => FiberRef.unsafeMake(Option.none()));
|
|
41
|
+
|
|
42
|
+
/** @internal */
|
|
43
|
+
const withMaxFields$1 = /*#__PURE__*/dual(2, (effect, count) => Effect.locally(effect, maxFields$1, count));
|
|
44
|
+
|
|
45
|
+
/** @internal */
|
|
46
|
+
const maxFiles$1 = /*#__PURE__*/globalValue("@effect/platform/Http/FormData/maxFiles", () => FiberRef.unsafeMake(Option.none()));
|
|
47
|
+
|
|
48
|
+
/** @internal */
|
|
49
|
+
const withMaxFiles$1 = /*#__PURE__*/dual(2, (effect, count) => Effect.locally(effect, maxFiles$1, count));
|
|
50
|
+
|
|
51
|
+
/** @internal */
|
|
52
|
+
const maxFileSize$1 = /*#__PURE__*/globalValue("@effect/platform/Http/FormData/maxFileSize", () => FiberRef.unsafeMake(Option.none()));
|
|
53
|
+
|
|
54
|
+
/** @internal */
|
|
55
|
+
const withMaxFileSize$1 = /*#__PURE__*/dual(2, (effect, size) => Effect.locally(effect, maxFileSize$1, Option.map(size, Size)));
|
|
56
|
+
|
|
57
|
+
/** @internal */
|
|
58
|
+
const fieldMimeTypes$1 = /*#__PURE__*/globalValue("@effect/platform/Http/FormData/fieldMimeTypes", () => FiberRef.unsafeMake(Chunk.make("application/json")));
|
|
59
|
+
|
|
60
|
+
/** @internal */
|
|
61
|
+
const withFieldMimeTypes$1 = /*#__PURE__*/dual(2, (effect, mimeTypes) => Effect.locally(effect, fieldMimeTypes$1, Chunk.fromIterable(mimeTypes)));
|
|
62
|
+
|
|
63
|
+
/** @internal */
|
|
64
|
+
const toRecord$1 = formData => ReadonlyArray.reduce(formData.entries(), {}, (acc, [key, value]) => {
|
|
65
|
+
if (Predicate.isString(value)) {
|
|
66
|
+
acc[key] = value;
|
|
67
|
+
} else {
|
|
68
|
+
const existing = acc[key];
|
|
69
|
+
if (Array.isArray(existing)) {
|
|
70
|
+
existing.push(value);
|
|
71
|
+
} else {
|
|
72
|
+
acc[key] = [value];
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
return acc;
|
|
76
|
+
});
|
|
77
|
+
/** @internal */
|
|
78
|
+
const filesSchema$1 = /*#__PURE__*/Schema.array( /*#__PURE__*/pipe( /*#__PURE__*/Schema.instanceOf(Blob), /*#__PURE__*/Schema.filter(blob => "name" in blob)));
|
|
79
|
+
|
|
80
|
+
/** @internal */
|
|
81
|
+
const schemaRecord$1 = schema => {
|
|
82
|
+
const parse = Schema.parse(schema);
|
|
83
|
+
return formData => parse(toRecord$1(formData));
|
|
84
|
+
};
|
|
85
|
+
|
|
86
|
+
/** @internal */
|
|
87
|
+
const schemaJson$1 = schema => {
|
|
88
|
+
const parse = Schema.parse(schema);
|
|
89
|
+
return dual(2, (formData, field) => pipe(Effect.succeed(formData.get(field)), Effect.filterOrFail(field => Predicate.isString(field), () => FormDataError$1("Parse", `schemaJson: field was not a string`)), Effect.tryMap({
|
|
90
|
+
try: field => JSON.parse(field),
|
|
91
|
+
catch: error => FormDataError$1("Parse", `schemaJson: field was not valid json: ${error}`)
|
|
92
|
+
}), Effect.flatMap(parse)));
|
|
93
|
+
};
|
|
94
|
+
|
|
95
|
+
/**
|
|
96
|
+
* @since 1.0.0
|
|
97
|
+
*/
|
|
98
|
+
|
|
99
|
+
/**
|
|
100
|
+
* @since 1.0.0
|
|
101
|
+
* @category type ids
|
|
102
|
+
*/
|
|
103
|
+
const TypeId = TypeId$1;
|
|
104
|
+
|
|
105
|
+
/**
|
|
106
|
+
* @since 1.0.0
|
|
107
|
+
* @category type ids
|
|
108
|
+
*/
|
|
109
|
+
|
|
110
|
+
/**
|
|
111
|
+
* @since 1.0.0
|
|
112
|
+
* @category models
|
|
113
|
+
*/
|
|
114
|
+
|
|
115
|
+
/**
|
|
116
|
+
* @since 1.0.0
|
|
117
|
+
*/
|
|
118
|
+
|
|
119
|
+
/**
|
|
120
|
+
* @since 1.0.0
|
|
121
|
+
* @category models
|
|
122
|
+
*/
|
|
123
|
+
|
|
124
|
+
/**
|
|
125
|
+
* @since 1.0.0
|
|
126
|
+
* @category models
|
|
127
|
+
*/
|
|
128
|
+
|
|
129
|
+
/**
|
|
130
|
+
* @since 1.0.0
|
|
131
|
+
* @category type ids
|
|
132
|
+
*/
|
|
133
|
+
const ErrorTypeId = ErrorTypeId$1;
|
|
134
|
+
|
|
135
|
+
/**
|
|
136
|
+
* @since 1.0.0
|
|
137
|
+
* @category type ids
|
|
138
|
+
*/
|
|
139
|
+
|
|
140
|
+
/**
|
|
141
|
+
* @since 1.0.0
|
|
142
|
+
* @category errors
|
|
143
|
+
*/
|
|
144
|
+
|
|
145
|
+
/**
|
|
146
|
+
* @since 1.0.0
|
|
147
|
+
* @category errors
|
|
148
|
+
*/
|
|
149
|
+
const FormDataError = FormDataError$1;
|
|
150
|
+
|
|
151
|
+
/**
|
|
152
|
+
* @since 1.0.0
|
|
153
|
+
* @category fiber refs
|
|
154
|
+
*/
|
|
155
|
+
const maxParts = maxParts$1;
|
|
156
|
+
|
|
157
|
+
/**
|
|
158
|
+
* @since 1.0.0
|
|
159
|
+
* @category fiber refs
|
|
160
|
+
*/
|
|
161
|
+
const withMaxParts = withMaxParts$1;
|
|
162
|
+
|
|
163
|
+
/**
|
|
164
|
+
* @since 1.0.0
|
|
165
|
+
* @category fiber refs
|
|
166
|
+
*/
|
|
167
|
+
const maxFields = maxFields$1;
|
|
168
|
+
|
|
169
|
+
/**
|
|
170
|
+
* @since 1.0.0
|
|
171
|
+
* @category fiber refs
|
|
172
|
+
*/
|
|
173
|
+
const withMaxFields = withMaxFields$1;
|
|
174
|
+
|
|
175
|
+
/**
|
|
176
|
+
* @since 1.0.0
|
|
177
|
+
* @category fiber refs
|
|
178
|
+
*/
|
|
179
|
+
const maxFieldSize = maxFieldSize$1;
|
|
180
|
+
|
|
181
|
+
/**
|
|
182
|
+
* @since 1.0.0
|
|
183
|
+
* @category fiber refs
|
|
184
|
+
*/
|
|
185
|
+
const withMaxFieldSize = withMaxFieldSize$1;
|
|
186
|
+
|
|
187
|
+
/**
|
|
188
|
+
* @since 1.0.0
|
|
189
|
+
* @category fiber refs
|
|
190
|
+
*/
|
|
191
|
+
const maxFiles = maxFiles$1;
|
|
192
|
+
|
|
193
|
+
/**
|
|
194
|
+
* @since 1.0.0
|
|
195
|
+
* @category fiber refs
|
|
196
|
+
*/
|
|
197
|
+
const withMaxFiles = withMaxFiles$1;
|
|
198
|
+
|
|
199
|
+
/**
|
|
200
|
+
* @since 1.0.0
|
|
201
|
+
* @category fiber refs
|
|
202
|
+
*/
|
|
203
|
+
const maxFileSize = maxFileSize$1;
|
|
204
|
+
|
|
205
|
+
/**
|
|
206
|
+
* @since 1.0.0
|
|
207
|
+
* @category fiber refs
|
|
208
|
+
*/
|
|
209
|
+
const withMaxFileSize = withMaxFileSize$1;
|
|
210
|
+
|
|
211
|
+
/**
|
|
212
|
+
* @since 1.0.0
|
|
213
|
+
* @category fiber refs
|
|
214
|
+
*/
|
|
215
|
+
const fieldMimeTypes = fieldMimeTypes$1;
|
|
216
|
+
|
|
217
|
+
/**
|
|
218
|
+
* @since 1.0.0
|
|
219
|
+
* @category fiber refs
|
|
220
|
+
*/
|
|
221
|
+
const withFieldMimeTypes = withFieldMimeTypes$1;
|
|
222
|
+
|
|
223
|
+
/**
|
|
224
|
+
* @since 1.0.0
|
|
225
|
+
* @category conversions
|
|
226
|
+
*/
|
|
227
|
+
const toRecord = toRecord$1;
|
|
228
|
+
|
|
229
|
+
/**
|
|
230
|
+
* @since 1.0.0
|
|
231
|
+
* @category schema
|
|
232
|
+
*/
|
|
233
|
+
const filesSchema = filesSchema$1;
|
|
234
|
+
|
|
235
|
+
/**
|
|
236
|
+
* @since 1.0.0
|
|
237
|
+
* @category schema
|
|
238
|
+
*/
|
|
239
|
+
const schemaJson = schemaJson$1;
|
|
240
|
+
|
|
241
|
+
/**
|
|
242
|
+
* @since 1.0.0
|
|
243
|
+
* @category schema
|
|
244
|
+
*/
|
|
245
|
+
const schemaRecord = schemaRecord$1;
|
|
246
|
+
|
|
247
|
+
var FormData = /*#__PURE__*/Object.freeze({
|
|
248
|
+
__proto__: null,
|
|
249
|
+
TypeId: TypeId,
|
|
250
|
+
ErrorTypeId: ErrorTypeId,
|
|
251
|
+
FormDataError: FormDataError,
|
|
252
|
+
maxParts: maxParts,
|
|
253
|
+
withMaxParts: withMaxParts,
|
|
254
|
+
maxFields: maxFields,
|
|
255
|
+
withMaxFields: withMaxFields,
|
|
256
|
+
maxFieldSize: maxFieldSize,
|
|
257
|
+
withMaxFieldSize: withMaxFieldSize,
|
|
258
|
+
maxFiles: maxFiles,
|
|
259
|
+
withMaxFiles: withMaxFiles,
|
|
260
|
+
maxFileSize: maxFileSize,
|
|
261
|
+
withMaxFileSize: withMaxFileSize,
|
|
262
|
+
fieldMimeTypes: fieldMimeTypes,
|
|
263
|
+
withFieldMimeTypes: withFieldMimeTypes,
|
|
264
|
+
toRecord: toRecord,
|
|
265
|
+
filesSchema: filesSchema,
|
|
266
|
+
schemaJson: schemaJson,
|
|
267
|
+
schemaRecord: schemaRecord
|
|
268
|
+
});
|
|
269
|
+
|
|
270
|
+
export { ErrorTypeId as E, FormData as F, TypeId as T, schemaJson as a, FormDataError as b, maxFields as c, withMaxFields as d, maxFieldSize as e, withMaxFieldSize as f, maxFiles as g, withMaxFiles as h, maxFileSize as i, withMaxFileSize as j, fieldMimeTypes as k, withFieldMimeTypes as l, maxParts as m, filesSchema as n, schemaRecord as s, toRecord as t, withMaxParts as w };
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
import { dual } from 'effect/Function';
|
|
2
|
+
import * as ReadonlyArray from 'effect/ReadonlyArray';
|
|
3
|
+
import * as ReadonlyRecord from 'effect/ReadonlyRecord';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* @since 1.0.0
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* @since 1.0.0
|
|
11
|
+
* @category models
|
|
12
|
+
*/
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* @since 1.0.0
|
|
16
|
+
* @category models
|
|
17
|
+
*/
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* @since 1.0.0
|
|
21
|
+
* @category constructors
|
|
22
|
+
*/
|
|
23
|
+
const empty = /*#__PURE__*/ReadonlyRecord.empty();
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* @since 1.0.0
|
|
27
|
+
* @category constructors
|
|
28
|
+
*/
|
|
29
|
+
const fromInput = input => {
|
|
30
|
+
if (input === undefined) {
|
|
31
|
+
return empty;
|
|
32
|
+
} else if (Symbol.iterator in input) {
|
|
33
|
+
return ReadonlyRecord.fromEntries(ReadonlyArray.map(ReadonlyArray.fromIterable(input), ([k, v]) => [k.toLowerCase(), v]));
|
|
34
|
+
}
|
|
35
|
+
return ReadonlyRecord.fromEntries(Object.entries(input).map(([k, v]) => [k.toLowerCase(), v]));
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* @since 1.0.0
|
|
40
|
+
* @category combinators
|
|
41
|
+
*/
|
|
42
|
+
const has = /*#__PURE__*/dual(2, (self, key) => ReadonlyRecord.has(self, key.toLowerCase()));
|
|
43
|
+
|
|
44
|
+
/**
|
|
45
|
+
* @since 1.0.0
|
|
46
|
+
* @category combinators
|
|
47
|
+
*/
|
|
48
|
+
const get = /*#__PURE__*/dual(2, (self, key) => ReadonlyRecord.get(self, key.toLowerCase()));
|
|
49
|
+
|
|
50
|
+
/**
|
|
51
|
+
* @since 1.0.0
|
|
52
|
+
* @category combinators
|
|
53
|
+
*/
|
|
54
|
+
const set = /*#__PURE__*/dual(3, (self, key, value) => ({
|
|
55
|
+
...self,
|
|
56
|
+
[key.toLowerCase()]: value
|
|
57
|
+
}));
|
|
58
|
+
|
|
59
|
+
/**
|
|
60
|
+
* @since 1.0.0
|
|
61
|
+
* @category combinators
|
|
62
|
+
*/
|
|
63
|
+
const setAll = /*#__PURE__*/dual(2, (self, headers) => ({
|
|
64
|
+
...self,
|
|
65
|
+
...fromInput(headers)
|
|
66
|
+
}));
|
|
67
|
+
|
|
68
|
+
/**
|
|
69
|
+
* @since 1.0.0
|
|
70
|
+
* @category combinators
|
|
71
|
+
*/
|
|
72
|
+
const remove = /*#__PURE__*/dual(2, (self, key) => ReadonlyRecord.remove(self, key.toLowerCase()));
|
|
73
|
+
|
|
74
|
+
var Headers = /*#__PURE__*/Object.freeze({
|
|
75
|
+
__proto__: null,
|
|
76
|
+
empty: empty,
|
|
77
|
+
fromInput: fromInput,
|
|
78
|
+
has: has,
|
|
79
|
+
get: get,
|
|
80
|
+
set: set,
|
|
81
|
+
setAll: setAll,
|
|
82
|
+
remove: remove
|
|
83
|
+
});
|
|
84
|
+
|
|
85
|
+
export { Headers as H, setAll as a, empty as e, fromInput as f, get as g, has as h, remove as r, set as s };
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { B as Body } from './Body-ec1353f9.esm.js';
|
|
2
|
+
import { C as Client } from './Client-52ebd74a.esm.js';
|
|
3
|
+
import { C as ClientError } from './ClientError-98b5da8c.esm.js';
|
|
4
|
+
import { C as ClientRequest } from './ClientRequest-fc429335.esm.js';
|
|
5
|
+
import { C as ClientResponse } from './ClientResponse-9f276554.esm.js';
|
|
6
|
+
import { H as Headers } from './Headers-58b56a08.esm.js';
|
|
7
|
+
import { U as UrlParams } from './UrlParams-1286c728.esm.js';
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* @since 1.0.0
|
|
11
|
+
*/
|
|
12
|
+
|
|
13
|
+
var HttpClient = /*#__PURE__*/Object.freeze({
|
|
14
|
+
__proto__: null,
|
|
15
|
+
body: Body,
|
|
16
|
+
client: Client,
|
|
17
|
+
error: ClientError,
|
|
18
|
+
headers: Headers,
|
|
19
|
+
request: ClientRequest,
|
|
20
|
+
response: ClientResponse,
|
|
21
|
+
urlParams: UrlParams
|
|
22
|
+
});
|
|
23
|
+
|
|
24
|
+
export { HttpClient as H };
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { A as App } from './App-687366d8.esm.js';
|
|
2
|
+
import { B as Body } from './Body-ec1353f9.esm.js';
|
|
3
|
+
import { F as FormData } from './FormData-f54de878.esm.js';
|
|
4
|
+
import { H as Headers } from './Headers-58b56a08.esm.js';
|
|
5
|
+
import { M as Middleware } from './Middleware-27760041.esm.js';
|
|
6
|
+
import { R as Router } from './Router-bf32317a.esm.js';
|
|
7
|
+
import { S as ServerError } from './ServerError-04ad5b57.esm.js';
|
|
8
|
+
import { S as ServerRequest } from './ServerRequest-03161edc.esm.js';
|
|
9
|
+
import { S as ServerResponse } from './ServerResponse-675e9456.esm.js';
|
|
10
|
+
import { U as UrlParams } from './UrlParams-1286c728.esm.js';
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* @since 1.0.0
|
|
14
|
+
*/
|
|
15
|
+
|
|
16
|
+
var HttpServer = /*#__PURE__*/Object.freeze({
|
|
17
|
+
__proto__: null,
|
|
18
|
+
app: App,
|
|
19
|
+
body: Body,
|
|
20
|
+
error: ServerError,
|
|
21
|
+
formData: FormData,
|
|
22
|
+
headers: Headers,
|
|
23
|
+
middleware: Middleware,
|
|
24
|
+
request: ServerRequest,
|
|
25
|
+
response: ServerResponse,
|
|
26
|
+
router: Router,
|
|
27
|
+
urlParams: UrlParams
|
|
28
|
+
});
|
|
29
|
+
|
|
30
|
+
export { HttpServer as H };
|