@effect/platform 0.18.4 → 0.18.6
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.cjs.dev.js +2 -2
- package/Http/Client/dist/effect-platform-Http-Client.cjs.prod.js +2 -2
- 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.cjs.dev.js +3 -2
- package/Http/ClientResponse/dist/effect-platform-Http-ClientResponse.cjs.mjs +2 -1
- package/Http/ClientResponse/dist/effect-platform-Http-ClientResponse.cjs.prod.js +3 -2
- 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.cjs.dev.js +3 -3
- package/Http/Middleware/dist/effect-platform-Http-Middleware.cjs.prod.js +3 -3
- 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.cjs.dev.js +2 -2
- package/Http/ServerResponse/dist/effect-platform-Http-ServerResponse.cjs.prod.js +2 -2
- 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.cjs.dev.js +3 -3
- package/HttpClient/dist/effect-platform-HttpClient.cjs.prod.js +3 -3
- package/HttpClient/dist/effect-platform-HttpClient.esm.js +32 -18
- package/HttpServer/dist/effect-platform-HttpServer.cjs.dev.js +2 -3
- package/HttpServer/dist/effect-platform-HttpServer.cjs.prod.js +2 -3
- package/HttpServer/dist/effect-platform-HttpServer.esm.js +35 -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-15671ed6.cjs.dev.js → Client-440a1019.cjs.dev.js} +1 -1
- package/dist/Client-4659bda7.esm.js +346 -0
- package/dist/{Client-6b3e3de8.cjs.prod.js → Client-7b851481.cjs.prod.js} +1 -1
- package/dist/ClientError-98b5da8c.esm.js +55 -0
- package/dist/ClientRequest-fc429335.esm.js +281 -0
- package/dist/{ClientResponse-a1d64ab8.cjs.dev.js → ClientResponse-1476704c.cjs.dev.js} +9 -1
- package/dist/ClientResponse-4524e99e.esm.js +53 -0
- package/dist/{ClientResponse-8f65511e.cjs.prod.js → ClientResponse-fe4e69c8.cjs.prod.js} +9 -1
- 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-cefc7da9.cjs.dev.js → HttpClient-4d23b1f5.cjs.dev.js} +2 -2
- package/dist/{HttpClient-d3c69877.cjs.prod.js → HttpClient-88775b8e.cjs.prod.js} +2 -2
- package/dist/HttpClient-9ca6050c.esm.js +24 -0
- package/dist/{HttpServer-5b9d992e.cjs.dev.js → HttpServer-16159c3a.cjs.dev.js} +2 -2
- package/dist/HttpServer-50f8df76.esm.js +30 -0
- package/dist/{HttpServer-60325fb0.cjs.prod.js → HttpServer-93c0fbb3.cjs.prod.js} +2 -2
- package/{internal/keyValueStore.esm.js → dist/KeyValueStore-2f9a70bf.esm.js} +102 -15
- package/dist/Middleware-240f91f6.esm.js +105 -0
- package/dist/{Middleware-8e7cd600.cjs.dev.js → Middleware-e2edf820.cjs.dev.js} +1 -1
- package/dist/{Middleware-d4f1a1cd.cjs.prod.js → Middleware-f9a073d7.cjs.prod.js} +1 -1
- 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-93038062.esm.js +259 -0
- package/dist/{ServerResponse-7d60c7d1.cjs.dev.js → ServerResponse-b63b7192.cjs.dev.js} +15 -4
- package/dist/{ServerResponse-830f1052.cjs.prod.js → ServerResponse-eae85b08.cjs.prod.js} +15 -4
- 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/dist/{clientResponse-c58a116c.cjs.dev.js → clientResponse-79c84a64.cjs.dev.js} +10 -0
- package/{internal/http/clientResponse.esm.js → dist/clientResponse-8c2ec6a3.esm.js} +14 -5
- package/dist/{clientResponse-2c6a83f1.cjs.prod.js → clientResponse-f9c57e83.cjs.prod.js} +10 -0
- package/{internal/commandExecutor.esm.js → dist/commandExecutor-d6457489.esm.js} +1 -1
- package/dist/declarations/src/Http/ClientResponse.d.ts +8 -0
- package/dist/declarations/src/Http/ClientResponse.d.ts.map +1 -1
- package/dist/declarations/src/Http/ServerResponse.d.ts +1 -2
- package/dist/declarations/src/Http/ServerResponse.d.ts.map +1 -1
- package/dist/effect-platform.cjs.dev.js +8 -8
- package/dist/effect-platform.cjs.prod.js +8 -8
- package/dist/effect-platform.esm.js +58 -20
- package/package.json +1 -2
- package/src/Http/ClientResponse.ts +10 -0
- package/src/Http/ServerResponse.ts +1 -2
- package/src/internal/http/clientResponse.ts +16 -0
- package/src/internal/http/serverResponse.ts +18 -4
- 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,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-240f91f6.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-93038062.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 };
|
|
@@ -4,11 +4,11 @@ var Http_App_dist_effectPlatformHttpApp = require('./App-0916639a.cjs.prod.js');
|
|
|
4
4
|
var Http_Body_dist_effectPlatformHttpBody = require('./Body-b77eac75.cjs.prod.js');
|
|
5
5
|
var Http_FormData_dist_effectPlatformHttpFormData = require('./FormData-902afd18.cjs.prod.js');
|
|
6
6
|
var Http_Headers_dist_effectPlatformHttpHeaders = require('./Headers-122cb877.cjs.prod.js');
|
|
7
|
-
var Http_Middleware_dist_effectPlatformHttpMiddleware = require('./Middleware-
|
|
7
|
+
var Http_Middleware_dist_effectPlatformHttpMiddleware = require('./Middleware-f9a073d7.cjs.prod.js');
|
|
8
8
|
var Http_Router_dist_effectPlatformHttpRouter = require('./Router-6c80a4c9.cjs.prod.js');
|
|
9
9
|
var Http_ServerError_dist_effectPlatformHttpServerError = require('./ServerError-605b2fa2.cjs.prod.js');
|
|
10
10
|
var Http_ServerRequest_dist_effectPlatformHttpServerRequest = require('./ServerRequest-938f3ed0.cjs.prod.js');
|
|
11
|
-
var Http_ServerResponse_dist_effectPlatformHttpServerResponse = require('./ServerResponse-
|
|
11
|
+
var Http_ServerResponse_dist_effectPlatformHttpServerResponse = require('./ServerResponse-eae85b08.cjs.prod.js');
|
|
12
12
|
var Http_UrlParams_dist_effectPlatformHttpUrlParams = require('./UrlParams-1228a686.cjs.prod.js');
|
|
13
13
|
|
|
14
14
|
/**
|
|
@@ -4,18 +4,18 @@ import * as Effect from 'effect/Effect';
|
|
|
4
4
|
import { dual, pipe } from 'effect/Function';
|
|
5
5
|
import * as Layer from 'effect/Layer';
|
|
6
6
|
import * as Option from 'effect/Option';
|
|
7
|
-
import { FileSystem } from '
|
|
8
|
-
import { Path } from '
|
|
7
|
+
import { a as FileSystem } from './FileSystem-7e31dccd.esm.js';
|
|
8
|
+
import { a as Path } from './Path-46f84ba7.esm.js';
|
|
9
9
|
|
|
10
10
|
/** @internal */
|
|
11
|
-
const TypeId = /*#__PURE__*/Symbol.for("@effect/platform/KeyValueStore");
|
|
11
|
+
const TypeId$1 = /*#__PURE__*/Symbol.for("@effect/platform/KeyValueStore");
|
|
12
12
|
|
|
13
13
|
/** @internal */
|
|
14
|
-
const keyValueStoreTag = /*#__PURE__*/Context.Tag(TypeId);
|
|
14
|
+
const keyValueStoreTag = /*#__PURE__*/Context.Tag(TypeId$1);
|
|
15
15
|
|
|
16
16
|
/** @internal */
|
|
17
|
-
const make = impl => keyValueStoreTag.of({
|
|
18
|
-
[TypeId]: TypeId,
|
|
17
|
+
const make$1 = impl => keyValueStoreTag.of({
|
|
18
|
+
[TypeId$1]: TypeId$1,
|
|
19
19
|
has: key => Effect.map(impl.get(key), Option.isSome),
|
|
20
20
|
isEmpty: Effect.map(impl.size, size => size === 0),
|
|
21
21
|
modify: (key, f) => Effect.flatMap(impl.get(key), o => {
|
|
@@ -32,7 +32,7 @@ const make = impl => keyValueStoreTag.of({
|
|
|
32
32
|
});
|
|
33
33
|
|
|
34
34
|
/** @internal */
|
|
35
|
-
const prefix = /*#__PURE__*/dual(2, (self, prefix) => ({
|
|
35
|
+
const prefix$1 = /*#__PURE__*/dual(2, (self, prefix) => ({
|
|
36
36
|
...self,
|
|
37
37
|
get: key => self.get(`${prefix}${key}`),
|
|
38
38
|
set: (key, value) => self.set(`${prefix}${key}`, value),
|
|
@@ -42,7 +42,7 @@ const prefix = /*#__PURE__*/dual(2, (self, prefix) => ({
|
|
|
42
42
|
}));
|
|
43
43
|
|
|
44
44
|
/** @internal */
|
|
45
|
-
const SchemaStoreTypeId = /*#__PURE__*/Symbol.for("@effect/platform/KeyValueStore/SchemaStore");
|
|
45
|
+
const SchemaStoreTypeId$1 = /*#__PURE__*/Symbol.for("@effect/platform/KeyValueStore/SchemaStore");
|
|
46
46
|
|
|
47
47
|
/** @internal */
|
|
48
48
|
const makeSchemaStore = (store, schema) => {
|
|
@@ -62,7 +62,7 @@ const makeSchemaStore = (store, schema) => {
|
|
|
62
62
|
return Effect.as(set(key, newValue), Option.some(newValue));
|
|
63
63
|
});
|
|
64
64
|
return {
|
|
65
|
-
[SchemaStoreTypeId]: SchemaStoreTypeId,
|
|
65
|
+
[SchemaStoreTypeId$1]: SchemaStoreTypeId$1,
|
|
66
66
|
get,
|
|
67
67
|
set,
|
|
68
68
|
modify,
|
|
@@ -75,9 +75,9 @@ const makeSchemaStore = (store, schema) => {
|
|
|
75
75
|
};
|
|
76
76
|
|
|
77
77
|
/** @internal */
|
|
78
|
-
const layerMemory = /*#__PURE__*/Layer.sync(keyValueStoreTag, () => {
|
|
78
|
+
const layerMemory$1 = /*#__PURE__*/Layer.sync(keyValueStoreTag, () => {
|
|
79
79
|
const store = new Map();
|
|
80
|
-
return make({
|
|
80
|
+
return make$1({
|
|
81
81
|
get: key => Effect.sync(() => Option.fromNullable(store.get(key))),
|
|
82
82
|
set: (key, value) => Effect.sync(() => store.set(key, value)),
|
|
83
83
|
remove: key => Effect.sync(() => store.delete(key)),
|
|
@@ -87,7 +87,7 @@ const layerMemory = /*#__PURE__*/Layer.sync(keyValueStoreTag, () => {
|
|
|
87
87
|
});
|
|
88
88
|
|
|
89
89
|
/** @internal */
|
|
90
|
-
const layerFileSystem = directory => Layer.effect(keyValueStoreTag, Effect.gen(function* (_) {
|
|
90
|
+
const layerFileSystem$1 = directory => Layer.effect(keyValueStoreTag, Effect.gen(function* (_) {
|
|
91
91
|
const fs = yield* _(FileSystem);
|
|
92
92
|
const path = yield* _(Path);
|
|
93
93
|
const keyPath = key => path.join(directory, encodeURIComponent(key));
|
|
@@ -96,7 +96,7 @@ const layerFileSystem = directory => Layer.effect(keyValueStoreTag, Effect.gen(f
|
|
|
96
96
|
recursive: true
|
|
97
97
|
}));
|
|
98
98
|
}
|
|
99
|
-
return make({
|
|
99
|
+
return make$1({
|
|
100
100
|
get: key => pipe(Effect.map(fs.readFileString(keyPath(key)), Option.some), Effect.catchTag("SystemError", sysError => sysError.reason === "NotFound" ? Effect.succeed(Option.none()) : Effect.fail(sysError))),
|
|
101
101
|
set: (key, value) => fs.writeFileString(keyPath(key), value),
|
|
102
102
|
remove: key => fs.remove(keyPath(key)),
|
|
@@ -111,7 +111,7 @@ const layerFileSystem = directory => Layer.effect(keyValueStoreTag, Effect.gen(f
|
|
|
111
111
|
}));
|
|
112
112
|
|
|
113
113
|
/** @internal */
|
|
114
|
-
const layerSchema = (schema, tagIdentifier) => {
|
|
114
|
+
const layerSchema$1 = (schema, tagIdentifier) => {
|
|
115
115
|
const tag = Context.Tag(tagIdentifier);
|
|
116
116
|
const layer = Layer.effect(tag, Effect.map(keyValueStoreTag, store => store.forSchema(schema)));
|
|
117
117
|
return {
|
|
@@ -120,4 +120,91 @@ const layerSchema = (schema, tagIdentifier) => {
|
|
|
120
120
|
};
|
|
121
121
|
};
|
|
122
122
|
|
|
123
|
-
|
|
123
|
+
/**
|
|
124
|
+
* @since 1.0.0
|
|
125
|
+
*/
|
|
126
|
+
/**
|
|
127
|
+
* @since 1.0.0
|
|
128
|
+
* @category type id
|
|
129
|
+
*/
|
|
130
|
+
const TypeId = TypeId$1;
|
|
131
|
+
|
|
132
|
+
/**
|
|
133
|
+
* @since 1.0.0
|
|
134
|
+
* @category type id
|
|
135
|
+
*/
|
|
136
|
+
|
|
137
|
+
/**
|
|
138
|
+
* @since 1.0.0
|
|
139
|
+
* @category models
|
|
140
|
+
*/
|
|
141
|
+
|
|
142
|
+
/**
|
|
143
|
+
* @since 1.0.0
|
|
144
|
+
*/
|
|
145
|
+
|
|
146
|
+
/**
|
|
147
|
+
* @since 1.0.0
|
|
148
|
+
* @category tags
|
|
149
|
+
*/
|
|
150
|
+
const KeyValueStore = keyValueStoreTag;
|
|
151
|
+
|
|
152
|
+
/**
|
|
153
|
+
* @since 1.0.0
|
|
154
|
+
* @category constructors
|
|
155
|
+
*/
|
|
156
|
+
const make = make$1;
|
|
157
|
+
|
|
158
|
+
/**
|
|
159
|
+
* @since 1.0.0
|
|
160
|
+
* @category combinators
|
|
161
|
+
*/
|
|
162
|
+
const prefix = prefix$1;
|
|
163
|
+
|
|
164
|
+
/**
|
|
165
|
+
* @since 1.0.0
|
|
166
|
+
* @category layers
|
|
167
|
+
*/
|
|
168
|
+
const layerMemory = layerMemory$1;
|
|
169
|
+
|
|
170
|
+
/**
|
|
171
|
+
* @since 1.0.0
|
|
172
|
+
* @category layers
|
|
173
|
+
*/
|
|
174
|
+
const layerFileSystem = layerFileSystem$1;
|
|
175
|
+
|
|
176
|
+
/**
|
|
177
|
+
* @since 1.0.0
|
|
178
|
+
* @category type id
|
|
179
|
+
*/
|
|
180
|
+
const SchemaStoreTypeId = SchemaStoreTypeId$1;
|
|
181
|
+
|
|
182
|
+
/**
|
|
183
|
+
* @since 1.0.0
|
|
184
|
+
* @category type id
|
|
185
|
+
*/
|
|
186
|
+
|
|
187
|
+
/**
|
|
188
|
+
* @since 1.0.0
|
|
189
|
+
* @category models
|
|
190
|
+
*/
|
|
191
|
+
|
|
192
|
+
/**
|
|
193
|
+
* @since 1.0.0
|
|
194
|
+
* @category layers
|
|
195
|
+
*/
|
|
196
|
+
const layerSchema = layerSchema$1;
|
|
197
|
+
|
|
198
|
+
var KeyValueStore$1 = /*#__PURE__*/Object.freeze({
|
|
199
|
+
__proto__: null,
|
|
200
|
+
TypeId: TypeId,
|
|
201
|
+
KeyValueStore: KeyValueStore,
|
|
202
|
+
make: make,
|
|
203
|
+
prefix: prefix,
|
|
204
|
+
layerMemory: layerMemory,
|
|
205
|
+
layerFileSystem: layerFileSystem,
|
|
206
|
+
SchemaStoreTypeId: SchemaStoreTypeId,
|
|
207
|
+
layerSchema: layerSchema
|
|
208
|
+
});
|
|
209
|
+
|
|
210
|
+
export { KeyValueStore$1 as K, SchemaStoreTypeId as S, TypeId as T, KeyValueStore as a, layerFileSystem as b, layerSchema as c, layerMemory as l, make as m, prefix as p };
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
import * as Effect from 'effect/Effect';
|
|
2
|
+
import { flow } from 'effect/Function';
|
|
3
|
+
import { s as set } from './Headers-58b56a08.esm.js';
|
|
4
|
+
import { schemaExternalSpan } from '../Http/IncomingMessage/dist/effect-platform-Http-IncomingMessage.esm.js';
|
|
5
|
+
import { a as ServerRequest } from './ServerRequest-03161edc.esm.js';
|
|
6
|
+
import { s as setHeader } from './ServerResponse-93038062.esm.js';
|
|
7
|
+
|
|
8
|
+
/** @internal */
|
|
9
|
+
const make$1 = middleware => middleware;
|
|
10
|
+
|
|
11
|
+
/** @internal */
|
|
12
|
+
const logger$1 = /*#__PURE__*/make$1(httpApp => {
|
|
13
|
+
let counter = 0;
|
|
14
|
+
return Effect.flatMap(ServerRequest, request => Effect.withLogSpan(Effect.onExit(httpApp, exit => exit._tag === "Failure" ? Effect.annotateLogs(Effect.log(exit.cause), {
|
|
15
|
+
"http.method": request.method,
|
|
16
|
+
"http.url": request.url,
|
|
17
|
+
"http.status": 500
|
|
18
|
+
}) : Effect.annotateLogs(Effect.log(""), {
|
|
19
|
+
"http.method": request.method,
|
|
20
|
+
"http.url": request.url,
|
|
21
|
+
"http.status": exit.value.status
|
|
22
|
+
})), `http.span.${++counter}`));
|
|
23
|
+
});
|
|
24
|
+
|
|
25
|
+
/** @internal */
|
|
26
|
+
const tracer$1 = /*#__PURE__*/make$1(httpApp => Effect.flatMap(ServerRequest, request => Effect.flatMap(Effect.orElseSucceed(schemaExternalSpan(request), () => undefined), parent => Effect.withSpan(Effect.tap(httpApp, response => Effect.annotateCurrentSpan("http.status", response.status)), `http ${request.method}`, {
|
|
27
|
+
attributes: {
|
|
28
|
+
"http.method": request.method,
|
|
29
|
+
"http.url": request.url
|
|
30
|
+
},
|
|
31
|
+
parent
|
|
32
|
+
}))));
|
|
33
|
+
|
|
34
|
+
/** @internal */
|
|
35
|
+
const b3Response$1 = /*#__PURE__*/make$1(httpApp => Effect.flatMap(Effect.currentSpan, span => span._tag === "Some" ? Effect.map(httpApp, res => setHeader(res, "b3", `${span.value.traceId}-${span.value.spanId}-1${span.value.parent._tag === "Some" ? `-${span.value.parent.value.spanId}` : ""}`)) : httpApp));
|
|
36
|
+
|
|
37
|
+
/** @internal */
|
|
38
|
+
const xForwardedHeaders$1 = /*#__PURE__*/make$1(httpApp => Effect.updateService(httpApp, ServerRequest, request => request.headers["x-forwarded-host"] ? request.modify({
|
|
39
|
+
headers: set(request.headers, "host", request.headers["x-forwarded-host"]),
|
|
40
|
+
remoteAddress: request.headers["x-forwarded-for"]?.split(",")[0].trim()
|
|
41
|
+
}) : request));
|
|
42
|
+
|
|
43
|
+
/** @internal */
|
|
44
|
+
const loggerTracer$1 = /*#__PURE__*/flow(tracer$1, logger$1);
|
|
45
|
+
|
|
46
|
+
/**
|
|
47
|
+
* @since 1.0.0
|
|
48
|
+
*/
|
|
49
|
+
|
|
50
|
+
/**
|
|
51
|
+
* @since 1.0.0
|
|
52
|
+
* @category models
|
|
53
|
+
*/
|
|
54
|
+
|
|
55
|
+
/**
|
|
56
|
+
* @since 1.0.0
|
|
57
|
+
*/
|
|
58
|
+
|
|
59
|
+
/**
|
|
60
|
+
* @since 1.0.0
|
|
61
|
+
* @category constructors
|
|
62
|
+
*/
|
|
63
|
+
const make = make$1;
|
|
64
|
+
|
|
65
|
+
/**
|
|
66
|
+
* @since 1.0.0
|
|
67
|
+
* @category constructors
|
|
68
|
+
*/
|
|
69
|
+
const b3Response = b3Response$1;
|
|
70
|
+
|
|
71
|
+
/**
|
|
72
|
+
* @since 1.0.0
|
|
73
|
+
* @category constructors
|
|
74
|
+
*/
|
|
75
|
+
const logger = logger$1;
|
|
76
|
+
|
|
77
|
+
/**
|
|
78
|
+
* @since 1.0.0
|
|
79
|
+
* @category constructors
|
|
80
|
+
*/
|
|
81
|
+
const tracer = tracer$1;
|
|
82
|
+
|
|
83
|
+
/**
|
|
84
|
+
* @since 1.0.0
|
|
85
|
+
* @category constructors
|
|
86
|
+
*/
|
|
87
|
+
const loggerTracer = loggerTracer$1;
|
|
88
|
+
|
|
89
|
+
/**
|
|
90
|
+
* @since 1.0.0
|
|
91
|
+
* @category constructors
|
|
92
|
+
*/
|
|
93
|
+
const xForwardedHeaders = xForwardedHeaders$1;
|
|
94
|
+
|
|
95
|
+
var Middleware = /*#__PURE__*/Object.freeze({
|
|
96
|
+
__proto__: null,
|
|
97
|
+
make: make,
|
|
98
|
+
b3Response: b3Response,
|
|
99
|
+
logger: logger,
|
|
100
|
+
tracer: tracer,
|
|
101
|
+
loggerTracer: loggerTracer,
|
|
102
|
+
xForwardedHeaders: xForwardedHeaders
|
|
103
|
+
});
|
|
104
|
+
|
|
105
|
+
export { Middleware as M, loggerTracer as a, b3Response as b, logger as l, make as m, tracer as t, xForwardedHeaders as x };
|
|
@@ -5,7 +5,7 @@ var Function = require('effect/Function');
|
|
|
5
5
|
var Http_Headers_dist_effectPlatformHttpHeaders = require('./Headers-f56bc667.cjs.dev.js');
|
|
6
6
|
var Http_IncomingMessage_dist_effectPlatformHttpIncomingMessage = require('../Http/IncomingMessage/dist/effect-platform-Http-IncomingMessage.cjs.dev.js');
|
|
7
7
|
var Http_ServerRequest_dist_effectPlatformHttpServerRequest = require('./ServerRequest-8d9c2c6b.cjs.dev.js');
|
|
8
|
-
var Http_ServerResponse_dist_effectPlatformHttpServerResponse = require('./ServerResponse-
|
|
8
|
+
var Http_ServerResponse_dist_effectPlatformHttpServerResponse = require('./ServerResponse-b63b7192.cjs.dev.js');
|
|
9
9
|
|
|
10
10
|
function _interopNamespace(e) {
|
|
11
11
|
if (e && e.__esModule) return e;
|
|
@@ -5,7 +5,7 @@ var Function = require('effect/Function');
|
|
|
5
5
|
var Http_Headers_dist_effectPlatformHttpHeaders = require('./Headers-122cb877.cjs.prod.js');
|
|
6
6
|
var Http_IncomingMessage_dist_effectPlatformHttpIncomingMessage = require('../Http/IncomingMessage/dist/effect-platform-Http-IncomingMessage.cjs.prod.js');
|
|
7
7
|
var Http_ServerRequest_dist_effectPlatformHttpServerRequest = require('./ServerRequest-938f3ed0.cjs.prod.js');
|
|
8
|
-
var Http_ServerResponse_dist_effectPlatformHttpServerResponse = require('./ServerResponse-
|
|
8
|
+
var Http_ServerResponse_dist_effectPlatformHttpServerResponse = require('./ServerResponse-eae85b08.cjs.prod.js');
|
|
9
9
|
|
|
10
10
|
function _interopNamespace(e) {
|
|
11
11
|
if (e && e.__esModule) return e;
|
|
@@ -3,13 +3,13 @@ import * as Effect from 'effect/Effect';
|
|
|
3
3
|
import { identity } from 'effect/Function';
|
|
4
4
|
import * as Layer from 'effect/Layer';
|
|
5
5
|
import * as PathB from 'path-browserify';
|
|
6
|
-
import { BadArgument } from '
|
|
6
|
+
import { B as BadArgument } from './Error-3099667c.esm.js';
|
|
7
7
|
|
|
8
8
|
/** @internal */
|
|
9
|
-
const Path = /*#__PURE__*/Tag("@effect/platform/Path");
|
|
9
|
+
const Path$2 = /*#__PURE__*/Tag("@effect/platform/Path");
|
|
10
10
|
|
|
11
11
|
/** @internal */
|
|
12
|
-
const layer = /*#__PURE__*/Layer.succeed(Path, /*#__PURE__*/Path.of({
|
|
12
|
+
const layer$1 = /*#__PURE__*/Layer.succeed(Path$2, /*#__PURE__*/Path$2.of({
|
|
13
13
|
...PathB,
|
|
14
14
|
fromFileUrl,
|
|
15
15
|
toFileUrl,
|
|
@@ -89,4 +89,40 @@ function encodePathChars(filepath) {
|
|
|
89
89
|
return filepath;
|
|
90
90
|
}
|
|
91
91
|
|
|
92
|
-
|
|
92
|
+
/**
|
|
93
|
+
* @since 1.0.0
|
|
94
|
+
*/
|
|
95
|
+
|
|
96
|
+
/**
|
|
97
|
+
* @since 1.0.0
|
|
98
|
+
* @category model
|
|
99
|
+
*/
|
|
100
|
+
|
|
101
|
+
/**
|
|
102
|
+
* @since 1.0.0
|
|
103
|
+
*/
|
|
104
|
+
|
|
105
|
+
/**
|
|
106
|
+
* @since 1.0.0
|
|
107
|
+
* @category tag
|
|
108
|
+
*/
|
|
109
|
+
const Path = Path$2;
|
|
110
|
+
|
|
111
|
+
/**
|
|
112
|
+
* An implementation of the Path interface that can be used in all environments
|
|
113
|
+
* (including browsers).
|
|
114
|
+
*
|
|
115
|
+
* It uses the POSIX standard for paths.
|
|
116
|
+
*
|
|
117
|
+
* @since 1.0.0
|
|
118
|
+
* @category layer
|
|
119
|
+
*/
|
|
120
|
+
const layer = layer$1;
|
|
121
|
+
|
|
122
|
+
var Path$1 = /*#__PURE__*/Object.freeze({
|
|
123
|
+
__proto__: null,
|
|
124
|
+
Path: Path,
|
|
125
|
+
layer: layer
|
|
126
|
+
});
|
|
127
|
+
|
|
128
|
+
export { Path$1 as P, Path as a, layer as l };
|