@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.
Files changed (72) hide show
  1. package/Command/dist/effect-platform-Command.esm.js +12 -200
  2. package/CommandExecutor/dist/effect-platform-CommandExecutor.esm.js +9 -71
  3. package/Effectify/dist/effect-platform-Effectify.esm.js +2 -23
  4. package/Error/dist/effect-platform-Error.esm.js +2 -54
  5. package/FileSystem/dist/effect-platform-FileSystem.esm.js +10 -177
  6. package/Http/Body/dist/effect-platform-Http-Body.esm.js +13 -151
  7. package/Http/Client/dist/effect-platform-Http-Client.esm.js +28 -164
  8. package/Http/ClientError/dist/effect-platform-Http-ClientError.esm.js +3 -48
  9. package/Http/ClientRequest/dist/effect-platform-Http-ClientRequest.esm.js +20 -241
  10. package/Http/ClientResponse/dist/effect-platform-Http-ClientResponse.esm.js +22 -35
  11. package/Http/Etag/dist/effect-platform-Http-Etag.esm.js +17 -1
  12. package/Http/FormData/dist/effect-platform-Http-FormData.esm.js +17 -155
  13. package/Http/Headers/dist/effect-platform-Http-Headers.esm.js +4 -74
  14. package/Http/IncomingMessage/dist/effect-platform-Http-IncomingMessage.esm.js +6 -1
  15. package/Http/Middleware/dist/effect-platform-Http-Middleware.esm.js +30 -52
  16. package/Http/Platform/dist/effect-platform-Http-Platform.esm.js +56 -1
  17. package/Http/Router/dist/effect-platform-Http-Router.esm.js +25 -224
  18. package/Http/Server/dist/effect-platform-Http-Server.esm.js +18 -1
  19. package/Http/ServerError/dist/effect-platform-Http-ServerError.esm.js +2 -70
  20. package/Http/ServerRequest/dist/effect-platform-Http-ServerRequest.esm.js +20 -65
  21. package/Http/ServerResponse/dist/effect-platform-Http-ServerResponse.esm.js +21 -126
  22. package/Http/UrlParams/dist/effect-platform-Http-UrlParams.esm.js +4 -101
  23. package/HttpClient/dist/effect-platform-HttpClient.esm.js +32 -18
  24. package/HttpServer/dist/effect-platform-HttpServer.esm.js +36 -24
  25. package/KeyValueStore/dist/effect-platform-KeyValueStore.esm.js +15 -78
  26. package/Path/dist/effect-platform-Path.esm.js +8 -33
  27. package/Runtime/dist/effect-platform-Runtime.esm.js +3 -26
  28. package/dist/App-687366d8.esm.js +5 -0
  29. package/dist/Body-ec1353f9.esm.js +170 -0
  30. package/dist/Client-52ebd74a.esm.js +346 -0
  31. package/dist/ClientError-98b5da8c.esm.js +55 -0
  32. package/dist/ClientRequest-fc429335.esm.js +281 -0
  33. package/dist/ClientResponse-9f276554.esm.js +46 -0
  34. package/dist/Command-d8ab0c8d.esm.js +403 -0
  35. package/dist/CommandExecutor-5807b66b.esm.js +80 -0
  36. package/dist/Effectify-e5a9d266.esm.js +43 -0
  37. package/dist/Error-3099667c.esm.js +75 -0
  38. package/dist/FileSystem-7e31dccd.esm.js +271 -0
  39. package/dist/FormData-f54de878.esm.js +270 -0
  40. package/dist/Headers-58b56a08.esm.js +85 -0
  41. package/dist/HttpClient-27710864.esm.js +24 -0
  42. package/dist/HttpServer-e1d88a1c.esm.js +30 -0
  43. package/{internal/keyValueStore.esm.js → dist/KeyValueStore-2f9a70bf.esm.js} +102 -15
  44. package/dist/Middleware-27760041.esm.js +105 -0
  45. package/{internal/path.esm.js → dist/Path-46f84ba7.esm.js} +40 -4
  46. package/dist/Router-bf32317a.esm.js +454 -0
  47. package/dist/Runtime-7265fb98.esm.js +31 -0
  48. package/dist/ServerError-04ad5b57.esm.js +99 -0
  49. package/dist/ServerRequest-03161edc.esm.js +125 -0
  50. package/dist/ServerResponse-675e9456.esm.js +249 -0
  51. package/dist/UrlParams-1286c728.esm.js +114 -0
  52. package/{internal/http/body.esm.js → dist/body-20d78ec1.esm.js} +2 -2
  53. package/{internal/http/clientError.esm.js → dist/clientError-c4e1466c.esm.js} +1 -1
  54. package/{internal/http/clientRequest.esm.js → dist/clientRequest-1e9e0b0d.esm.js} +4 -4
  55. package/{internal/http/clientResponse.esm.js → dist/clientResponse-ce25dbf3.esm.js} +5 -5
  56. package/{internal/commandExecutor.esm.js → dist/commandExecutor-d6457489.esm.js} +1 -1
  57. package/dist/effect-platform.esm.js +58 -20
  58. package/package.json +1 -2
  59. package/internal/command.esm.js +0 -185
  60. package/internal/effectify.esm.js +0 -18
  61. package/internal/error.esm.js +0 -17
  62. package/internal/fileSystem.esm.js +0 -82
  63. package/internal/http/client.esm.js +0 -157
  64. package/internal/http/etag.esm.js +0 -19
  65. package/internal/http/formData.esm.js +0 -95
  66. package/internal/http/middleware.esm.js +0 -46
  67. package/internal/http/platform.esm.js +0 -52
  68. package/internal/http/router.esm.js +0 -199
  69. package/internal/http/server.esm.js +0 -20
  70. package/internal/http/serverError.esm.js +0 -23
  71. package/internal/http/serverRequest.esm.js +0 -50
  72. package/internal/http/serverResponse.esm.js +0 -105
@@ -1,224 +1,25 @@
1
- import { TypeId as TypeId$1, RouteTypeId as RouteTypeId$1, RouteContextTypeId as RouteContextTypeId$1, RouteContext as RouteContext$1, params as params$1, searchParams as searchParams$1, schemaParams as schemaParams$1, empty as empty$1, fromIterable as fromIterable$1, makeRoute as makeRoute$1, prefixAll as prefixAll$1, concat as concat$1, mount as mount$1, mountApp as mountApp$1, route as route$1, all as all$1, get as get$1, post as post$1, patch as patch$1, put as put$1, del as del$1, head as head$1, options as options$1, use as use$1, catchAll as catchAll$1, catchAllCause as catchAllCause$1, catchTag as catchTag$1, catchTags as catchTags$1, provideService as provideService$1, provideServiceEffect as provideServiceEffect$1 } from '../../../../internal/http/router.esm.js';
2
-
3
- /**
4
- * @since 1.0.0
5
- */
6
- /**
7
- * @since 1.0.0
8
- * @category type ids
9
- */
10
- const TypeId = TypeId$1;
11
-
12
- /**
13
- * @since 1.0.0
14
- * @category type ids
15
- */
16
-
17
- /**
18
- * @since 1.0.0
19
- * @category models
20
- */
21
-
22
- /**
23
- * @since 1.0.0
24
- */
25
-
26
- /**
27
- * @since 1.0.0
28
- * @category type ids
29
- */
30
- const RouteTypeId = RouteTypeId$1;
31
-
32
- /**
33
- * @since 1.0.0
34
- * @category type ids
35
- */
36
-
37
- /**
38
- * @since 1.0.0
39
- * @category models
40
- */
41
-
42
- /**
43
- * @since 1.0.0
44
- */
45
-
46
- /**
47
- * @since 1.0.0
48
- * @category type ids
49
- */
50
- const RouteContextTypeId = RouteContextTypeId$1;
51
-
52
- /**
53
- * @since 1.0.0
54
- * @category type ids
55
- */
56
-
57
- /**
58
- * @since 1.0.0
59
- * @category models
60
- */
61
-
62
- /**
63
- * @since 1.0.0
64
- * @category route context
65
- */
66
- const RouteContext = RouteContext$1;
67
-
68
- /**
69
- * @since 1.0.0
70
- * @category route context
71
- */
72
- const params = params$1;
73
-
74
- /**
75
- * @since 1.0.0
76
- * @category route context
77
- */
78
- const searchParams = searchParams$1;
79
-
80
- /**
81
- * @since 1.0.0
82
- * @category route context
83
- */
84
- const schemaParams = schemaParams$1;
85
-
86
- /**
87
- * @since 1.0.0
88
- * @category constructors
89
- */
90
- const empty = empty$1;
91
-
92
- /**
93
- * @since 1.0.0
94
- * @category constructors
95
- */
96
- const fromIterable = fromIterable$1;
97
-
98
- /**
99
- * @since 1.0.0
100
- * @category constructors
101
- */
102
- const makeRoute = makeRoute$1;
103
-
104
- /**
105
- * @since 1.0.0
106
- * @category combinators
107
- */
108
- const prefixAll = prefixAll$1;
109
-
110
- /**
111
- * @since 1.0.0
112
- * @category combinators
113
- */
114
- const concat = concat$1;
115
-
116
- /**
117
- * @since 1.0.0
118
- * @category routing
119
- */
120
- const mount = mount$1;
121
-
122
- /**
123
- * @since 1.0.0
124
- * @category routing
125
- */
126
- const mountApp = mountApp$1;
127
-
128
- /**
129
- * @since 1.0.0
130
- * @category routing
131
- */
132
- const route = route$1;
133
-
134
- /**
135
- * @since 1.0.0
136
- * @category routing
137
- */
138
- const all = all$1;
139
-
140
- /**
141
- * @since 1.0.0
142
- * @category routing
143
- */
144
- const get = get$1;
145
-
146
- /**
147
- * @since 1.0.0
148
- * @category routing
149
- */
150
- const post = post$1;
151
-
152
- /**
153
- * @since 1.0.0
154
- * @category routing
155
- */
156
- const patch = patch$1;
157
-
158
- /**
159
- * @since 1.0.0
160
- * @category routing
161
- */
162
- const put = put$1;
163
-
164
- /**
165
- * @since 1.0.0
166
- * @category routing
167
- */
168
- const del = del$1;
169
-
170
- /**
171
- * @since 1.0.0
172
- * @category routing
173
- */
174
- const head = head$1;
175
-
176
- /**
177
- * @since 1.0.0
178
- * @category routing
179
- */
180
- const options = options$1;
181
-
182
- /**
183
- * @since 1.0.0
184
- * @category combinators
185
- */
186
- const use = use$1;
187
-
188
- /**
189
- * @since 1.0.0
190
- * @category combinators
191
- */
192
- const catchAll = catchAll$1;
193
-
194
- /**
195
- * @since 1.0.0
196
- * @category combinators
197
- */
198
- const catchAllCause = catchAllCause$1;
199
-
200
- /**
201
- * @since 1.0.0
202
- * @category combinators
203
- */
204
- const catchTag = catchTag$1;
205
-
206
- /**
207
- * @since 1.0.0
208
- * @category combinators
209
- */
210
- const catchTags = catchTags$1;
211
-
212
- /**
213
- * @since 1.0.0
214
- * @category combinators
215
- */
216
- const provideService = provideService$1;
217
-
218
- /**
219
- * @since 1.0.0
220
- * @category combinators
221
- */
222
- const provideServiceEffect = provideServiceEffect$1;
223
-
224
- export { RouteContext, RouteContextTypeId, RouteTypeId, TypeId, all, catchAll, catchAllCause, catchTag, catchTags, concat, del, empty, fromIterable, get, head, makeRoute, mount, mountApp, options, params, patch, post, prefixAll, provideService, provideServiceEffect, put, route, schemaParams, searchParams, use };
1
+ export { c as RouteContext, b as RouteContextTypeId, a as RouteTypeId, T as TypeId, k as all, x as catchAll, y as catchAllCause, z as catchTag, A as catchTags, h as concat, t as del, e as empty, f as fromIterable, l as get, u as head, m as makeRoute, i as mount, j as mountApp, v as options, p as params, o as patch, n as post, g as prefixAll, B as provideService, C as provideServiceEffect, q as put, r as route, d as schemaParams, s as searchParams, w as use } from '../../../dist/Router-bf32317a.esm.js';
2
+ import '@effect/schema/Schema';
3
+ import 'effect/Chunk';
4
+ import 'effect/Context';
5
+ import 'effect/Effect';
6
+ import 'effect/Effectable';
7
+ import 'effect/Function';
8
+ import 'effect/Inspectable';
9
+ import 'effect/Option';
10
+ import 'find-my-way';
11
+ import '../../../dist/ServerError-04ad5b57.esm.js';
12
+ import 'effect/Data';
13
+ import '../../../dist/ServerRequest-03161edc.esm.js';
14
+ import '../../../dist/FormData-f54de878.esm.js';
15
+ import 'effect/FiberRef';
16
+ import 'effect/GlobalValue';
17
+ import 'effect/Predicate';
18
+ import 'effect/ReadonlyArray';
19
+ import '../../../dist/FileSystem-7e31dccd.esm.js';
20
+ import 'effect/Brand';
21
+ import 'effect/Sink';
22
+ import 'effect/Stream';
23
+ import '../../../dist/Error-3099667c.esm.js';
24
+ import '../../IncomingMessage/dist/effect-platform-Http-IncomingMessage.esm.js';
25
+ import '@effect/schema/ParseResult';
@@ -1,4 +1,21 @@
1
- import { TypeId as TypeId$1, serverTag, make as make$1, serve as serve$1 } from '../../../../internal/http/server.esm.js';
1
+ import * as Context from 'effect/Context';
2
+ import * as Effect from 'effect/Effect';
3
+ import { dual } from 'effect/Function';
4
+
5
+ /** @internal */
6
+ const TypeId$1 = /*#__PURE__*/Symbol.for("@effect/platform/Http/Server");
7
+
8
+ /** @internal */
9
+ const serverTag = /*#__PURE__*/Context.Tag(TypeId$1);
10
+ const serverProto = {
11
+ [TypeId$1]: TypeId$1
12
+ };
13
+
14
+ /** @internal */
15
+ const make$1 = options => Object.assign(Object.create(serverProto), options);
16
+
17
+ /** @internal */
18
+ const serve$1 = /*#__PURE__*/dual(args => Effect.isEffect(args[0]), (httpApp, middleware) => Effect.flatMap(serverTag, server => server.serve(httpApp, middleware)));
2
19
 
3
20
  /**
4
21
  * @since 1.0.0
@@ -1,70 +1,2 @@
1
- import { TypeId as TypeId$1, requestError, routeNotFound, responseError, serveError } from '../../../../internal/http/serverError.esm.js';
2
-
3
- /**
4
- * @since 1.0.0
5
- */
6
- /**
7
- * @since 1.0.0
8
- * @category type id
9
- */
10
- const TypeId = TypeId$1;
11
-
12
- /**
13
- * @since 1.0.0
14
- * @category type id
15
- */
16
-
17
- /**
18
- * @since 1.0.0
19
- * @category error
20
- */
21
-
22
- /**
23
- * @since 1.0.0
24
- */
25
-
26
- /**
27
- * @since 1.0.0
28
- * @category error
29
- */
30
-
31
- /**
32
- * @since 1.0.0
33
- * @category error
34
- */
35
- const RequestError = requestError;
36
-
37
- /**
38
- * @since 1.0.0
39
- * @category error
40
- */
41
-
42
- /**
43
- * @since 1.0.0
44
- * @category error
45
- */
46
- const RouteNotFound = routeNotFound;
47
-
48
- /**
49
- * @since 1.0.0
50
- * @category error
51
- */
52
-
53
- /**
54
- * @since 1.0.0
55
- * @category error
56
- */
57
- const ResponseError = responseError;
58
-
59
- /**
60
- * @since 1.0.0
61
- * @category error
62
- */
63
-
64
- /**
65
- * @since 1.0.0
66
- * @category error
67
- */
68
- const ServeError = serveError;
69
-
70
- export { RequestError, ResponseError, RouteNotFound, ServeError, TypeId };
1
+ export { a as RequestError, b as ResponseError, R as RouteNotFound, c as ServeError, T as TypeId } from '../../../dist/ServerError-04ad5b57.esm.js';
2
+ import 'effect/Data';
@@ -1,66 +1,21 @@
1
- import { TypeId as TypeId$1, serverRequestTag, formDataRecord as formDataRecord$1, schemaHeaders as schemaHeaders$1, schemaBodyJson as schemaBodyJson$1, schemaBodyUrlParams as schemaBodyUrlParams$1, schemaFormData as schemaFormData$1, schemaFormDataJson as schemaFormDataJson$1 } from '../../../../internal/http/serverRequest.esm.js';
1
+ export { a as ServerRequest, T as TypeId, f as formDataRecord, b as schemaBodyJson, c as schemaBodyUrlParams, d as schemaFormData, e as schemaFormDataJson, s as schemaHeaders } from '../../../dist/ServerRequest-03161edc.esm.js';
2
2
  export { maxBodySize } from '../../IncomingMessage/dist/effect-platform-Http-IncomingMessage.esm.js';
3
-
4
- /**
5
- * @since 1.0.0
6
- */
7
-
8
- /**
9
- * @since 1.0.0
10
- * @category type ids
11
- */
12
- const TypeId = TypeId$1;
13
-
14
- /**
15
- * @since 1.0.0
16
- * @category type ids
17
- */
18
-
19
- /**
20
- * @since 1.0.0
21
- * @category models
22
- */
23
-
24
- /**
25
- * @since 1.0.0
26
- * @category context
27
- */
28
- const ServerRequest = serverRequestTag;
29
-
30
- /**
31
- * @since 1.0.0
32
- * @category accessors
33
- */
34
- const formDataRecord = formDataRecord$1;
35
-
36
- /**
37
- * @since 1.0.0
38
- * @category schema
39
- */
40
- const schemaHeaders = schemaHeaders$1;
41
-
42
- /**
43
- * @since 1.0.0
44
- * @category schema
45
- */
46
- const schemaBodyJson = schemaBodyJson$1;
47
-
48
- /**
49
- * @since 1.0.0
50
- * @category schema
51
- */
52
- const schemaBodyUrlParams = schemaBodyUrlParams$1;
53
-
54
- /**
55
- * @since 1.0.0
56
- * @category schema
57
- */
58
- const schemaFormData = schemaFormData$1;
59
-
60
- /**
61
- * @since 1.0.0
62
- * @category schema
63
- */
64
- const schemaFormDataJson = schemaFormDataJson$1;
65
-
66
- export { ServerRequest, TypeId, formDataRecord, schemaBodyJson, schemaBodyUrlParams, schemaFormData, schemaFormDataJson, schemaHeaders };
3
+ import 'effect/Context';
4
+ import 'effect/Effect';
5
+ import '../../../dist/FormData-f54de878.esm.js';
6
+ import '@effect/schema/Schema';
7
+ import 'effect/Chunk';
8
+ import 'effect/Data';
9
+ import 'effect/FiberRef';
10
+ import 'effect/Function';
11
+ import 'effect/GlobalValue';
12
+ import 'effect/Option';
13
+ import 'effect/Predicate';
14
+ import 'effect/ReadonlyArray';
15
+ import '../../../dist/FileSystem-7e31dccd.esm.js';
16
+ import 'effect/Brand';
17
+ import 'effect/Sink';
18
+ import 'effect/Stream';
19
+ import '../../../dist/Error-3099667c.esm.js';
20
+ import '../../../dist/ServerError-04ad5b57.esm.js';
21
+ import '@effect/schema/ParseResult';
@@ -1,126 +1,21 @@
1
- import { isServerResponse as isServerResponse$1, empty as empty$1, uint8Array as uint8Array$1, text as text$1, json as json$1, schemaJson as schemaJson$1, unsafeJson as unsafeJson$1, urlParams as urlParams$1, raw as raw$1, formData as formData$1, stream as stream$1, file as file$1, fileWeb as fileWeb$1, setHeader as setHeader$1, setHeaders as setHeaders$1, setBody as setBody$1 } from '../../../../internal/http/serverResponse.esm.js';
2
-
3
- /**
4
- * @since 1.0.0
5
- */
6
- /**
7
- * @since 1.0.0
8
- * @category type ids
9
- */
10
- const TypeId = /*#__PURE__*/Symbol.for("@effect/platform/Http/ServerResponse");
11
-
12
- /**
13
- * @since 1.0.0
14
- * @category type ids
15
- */
16
-
17
- /**
18
- * @since 1.0.0
19
- * @category models
20
- */
21
-
22
- /**
23
- * @since 1.0.0
24
- * @category models
25
- */
26
-
27
- /**
28
- * @since 1.0.0
29
- */
30
-
31
- /**
32
- * @since 1.0.0
33
- */
34
- const isServerResponse = isServerResponse$1;
35
-
36
- /**
37
- * @since 1.0.0
38
- * @category constructors
39
- */
40
- const empty = empty$1;
41
-
42
- /**
43
- * @since 1.0.0
44
- * @category constructors
45
- */
46
- const uint8Array = uint8Array$1;
47
-
48
- /**
49
- * @since 1.0.0
50
- * @category constructors
51
- */
52
- const text = text$1;
53
-
54
- /**
55
- * @since 1.0.0
56
- * @category constructors
57
- */
58
- const json = json$1;
59
-
60
- /**
61
- * @since 1.0.0
62
- * @category constructors
63
- */
64
- const schemaJson = schemaJson$1;
65
-
66
- /**
67
- * @since 1.0.0
68
- * @category constructors
69
- */
70
- const unsafeJson = unsafeJson$1;
71
-
72
- /**
73
- * @since 1.0.0
74
- * @category constructors
75
- */
76
- const urlParams = urlParams$1;
77
-
78
- /**
79
- * @since 1.0.0
80
- * @category constructors
81
- */
82
- const raw = raw$1;
83
-
84
- /**
85
- * @since 1.0.0
86
- * @category constructors
87
- */
88
- const formData = formData$1;
89
-
90
- /**
91
- * @since 1.0.0
92
- * @category constructors
93
- */
94
- const stream = stream$1;
95
-
96
- /**
97
- * @since 1.0.0
98
- * @category constructors
99
- */
100
- const file = file$1;
101
-
102
- /**
103
- * @since 1.0.0
104
- * @category constructors
105
- */
106
- const fileWeb = fileWeb$1;
107
-
108
- /**
109
- * @since 1.0.0
110
- * @category combinators
111
- */
112
- const setHeader = setHeader$1;
113
-
114
- /**
115
- * @since 1.0.0
116
- * @category combinators
117
- */
118
- const setHeaders = setHeaders$1;
119
-
120
- /**
121
- * @since 1.0.0
122
- * @category combinators
123
- */
124
- const setBody = setBody$1;
125
-
126
- export { TypeId, empty, file, fileWeb, formData, isServerResponse, json, raw, schemaJson, setBody, setHeader, setHeaders, stream, text, uint8Array, unsafeJson, urlParams };
1
+ export { T as TypeId, e as empty, g as file, h as fileWeb, f as formData, i as isServerResponse, j as json, r as raw, a as schemaJson, l as setBody, s as setHeader, k as setHeaders, d as stream, t as text, u as uint8Array, b as unsafeJson, c as urlParams } from '../../../dist/ServerResponse-675e9456.esm.js';
2
+ import 'effect/Effect';
3
+ import 'effect/Function';
4
+ import 'effect/Pipeable';
5
+ import '../../../dist/Headers-58b56a08.esm.js';
6
+ import 'effect/ReadonlyArray';
7
+ import 'effect/ReadonlyRecord';
8
+ import '../../Platform/dist/effect-platform-Http-Platform.esm.js';
9
+ import 'effect/Context';
10
+ import '../../../dist/FileSystem-7e31dccd.esm.js';
11
+ import 'effect/Brand';
12
+ import 'effect/Option';
13
+ import 'effect/Sink';
14
+ import 'effect/Stream';
15
+ import '../../../dist/Error-3099667c.esm.js';
16
+ import 'effect/Data';
17
+ import '../../Etag/dist/effect-platform-Http-Etag.esm.js';
18
+ import '../../../dist/UrlParams-1286c728.esm.js';
19
+ import 'effect/Chunk';
20
+ import '../../../dist/body-20d78ec1.esm.js';
21
+ import '@effect/schema/Schema';
@@ -1,101 +1,4 @@
1
- import * as Chunk from 'effect/Chunk';
2
- import * as Effect from 'effect/Effect';
3
- import { dual } from 'effect/Function';
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 fromInput = input => {
24
- if (Chunk.isChunk(input)) {
25
- return input;
26
- } else if (Symbol.iterator in input) {
27
- return Chunk.fromIterable(input);
28
- }
29
- return Chunk.fromIterable(Object.entries(input));
30
- };
31
-
32
- /**
33
- * @since 1.0.0
34
- * @category constructors
35
- */
36
- const empty = /*#__PURE__*/Chunk.empty();
37
-
38
- /**
39
- * @since 1.0.0
40
- * @category combinators
41
- */
42
- const set = /*#__PURE__*/dual(3, (self, key, value) => Chunk.append(Chunk.filter(self, ([k]) => k !== key), [key, value]));
43
-
44
- /**
45
- * @since 1.0.0
46
- * @category combinators
47
- */
48
- const setAll = /*#__PURE__*/dual(2, (self, input) => {
49
- const toSet = fromInput(input);
50
- const keys = Chunk.toReadonlyArray(toSet).map(([k]) => k);
51
- return Chunk.appendAll(Chunk.filter(self, ([k]) => keys.includes(k)), toSet);
52
- });
53
-
54
- /**
55
- * @since 1.0.0
56
- * @category combinators
57
- */
58
- const append = /*#__PURE__*/dual(3, (self, key, value) => Chunk.append(self, [key, value]));
59
-
60
- /**
61
- * @since 1.0.0
62
- * @category combinators
63
- */
64
- const appendAll = /*#__PURE__*/dual(2, (self, input) => Chunk.appendAll(self, fromInput(input)));
65
-
66
- /**
67
- * @since 1.0.0
68
- * @category combinators
69
- */
70
- const remove = /*#__PURE__*/dual(2, (self, key) => Chunk.filter(self, ([k]) => k !== key));
71
-
72
- /**
73
- * @since 1.0.0
74
- * @category combinators
75
- */
76
- const toString = self => new URLSearchParams(Chunk.toReadonlyArray(self)).toString();
77
-
78
- /**
79
- * @since 1.0.0
80
- * @category constructors
81
- */
82
- const makeUrl = (url, params, onError) => Effect.try({
83
- try: () => {
84
- const urlInstance = new URL(url, baseUrl());
85
- Chunk.forEach(params, ([key, value]) => {
86
- if (value !== undefined) {
87
- urlInstance.searchParams.append(key, value);
88
- }
89
- });
90
- return urlInstance;
91
- },
92
- catch: onError
93
- });
94
- const baseUrl = () => {
95
- if ("location" in globalThis) {
96
- return location.origin + location.pathname;
97
- }
98
- return undefined;
99
- };
100
-
101
- export { append, appendAll, empty, fromInput, makeUrl, remove, set, setAll, toString };
1
+ import 'effect/Chunk';
2
+ import 'effect/Effect';
3
+ import 'effect/Function';
4
+ export { a as append, b as appendAll, e as empty, f as fromInput, m as makeUrl, r as remove, s as set, c as setAll, t as toString } from '../../../dist/UrlParams-1286c728.esm.js';