effect 4.0.0-beta.32 → 4.0.0-beta.34

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 (111) hide show
  1. package/dist/Effect.d.ts +12 -6
  2. package/dist/Effect.d.ts.map +1 -1
  3. package/dist/Effect.js +4 -4
  4. package/dist/Effect.js.map +1 -1
  5. package/dist/FileSystem.d.ts.map +1 -1
  6. package/dist/FileSystem.js +2 -1
  7. package/dist/FileSystem.js.map +1 -1
  8. package/dist/Graph.d.ts.map +1 -1
  9. package/dist/Graph.js +2 -1
  10. package/dist/Graph.js.map +1 -1
  11. package/dist/MutableHashMap.d.ts +7 -0
  12. package/dist/MutableHashMap.d.ts.map +1 -1
  13. package/dist/MutableHashMap.js +8 -0
  14. package/dist/MutableHashMap.js.map +1 -1
  15. package/dist/MutableHashSet.d.ts +7 -0
  16. package/dist/MutableHashSet.d.ts.map +1 -1
  17. package/dist/MutableHashSet.js +8 -0
  18. package/dist/MutableHashSet.js.map +1 -1
  19. package/dist/Queue.d.ts +1 -1
  20. package/dist/Queue.d.ts.map +1 -1
  21. package/dist/Queue.js.map +1 -1
  22. package/dist/Resource.d.ts.map +1 -1
  23. package/dist/Resource.js +2 -1
  24. package/dist/Resource.js.map +1 -1
  25. package/dist/SubscriptionRef.d.ts.map +1 -1
  26. package/dist/SubscriptionRef.js +2 -1
  27. package/dist/SubscriptionRef.js.map +1 -1
  28. package/dist/TxDeferred.d.ts.map +1 -1
  29. package/dist/TxDeferred.js +2 -1
  30. package/dist/TxDeferred.js.map +1 -1
  31. package/dist/TxHashMap.d.ts.map +1 -1
  32. package/dist/TxHashMap.js +2 -1
  33. package/dist/TxHashMap.js.map +1 -1
  34. package/dist/TxHashSet.d.ts +1 -1
  35. package/dist/TxHashSet.d.ts.map +1 -1
  36. package/dist/TxHashSet.js +2 -1
  37. package/dist/TxHashSet.js.map +1 -1
  38. package/dist/TxPriorityQueue.d.ts +1 -1
  39. package/dist/TxPriorityQueue.d.ts.map +1 -1
  40. package/dist/TxPriorityQueue.js +2 -1
  41. package/dist/TxPriorityQueue.js.map +1 -1
  42. package/dist/TxSemaphore.d.ts.map +1 -1
  43. package/dist/TxSemaphore.js +2 -1
  44. package/dist/TxSemaphore.js.map +1 -1
  45. package/dist/internal/effect.js +1 -1
  46. package/dist/internal/effect.js.map +1 -1
  47. package/dist/unstable/ai/AiError.d.ts +1 -3
  48. package/dist/unstable/ai/AiError.d.ts.map +1 -1
  49. package/dist/unstable/ai/AiError.js +1 -3
  50. package/dist/unstable/ai/AiError.js.map +1 -1
  51. package/dist/unstable/ai/EmbeddingModel.d.ts +130 -0
  52. package/dist/unstable/ai/EmbeddingModel.d.ts.map +1 -0
  53. package/dist/unstable/ai/EmbeddingModel.js +127 -0
  54. package/dist/unstable/ai/EmbeddingModel.js.map +1 -0
  55. package/dist/unstable/ai/LanguageModel.d.ts +8 -0
  56. package/dist/unstable/ai/LanguageModel.d.ts.map +1 -1
  57. package/dist/unstable/ai/LanguageModel.js +127 -16
  58. package/dist/unstable/ai/LanguageModel.js.map +1 -1
  59. package/dist/unstable/ai/ResponseIdTracker.d.ts +38 -0
  60. package/dist/unstable/ai/ResponseIdTracker.d.ts.map +1 -0
  61. package/dist/unstable/ai/ResponseIdTracker.js +68 -0
  62. package/dist/unstable/ai/ResponseIdTracker.js.map +1 -0
  63. package/dist/unstable/ai/Tool.d.ts +1 -1
  64. package/dist/unstable/ai/Tool.d.ts.map +1 -1
  65. package/dist/unstable/ai/Tool.js +1 -1
  66. package/dist/unstable/ai/Tool.js.map +1 -1
  67. package/dist/unstable/ai/index.d.ts +21 -0
  68. package/dist/unstable/ai/index.d.ts.map +1 -1
  69. package/dist/unstable/ai/index.js +21 -0
  70. package/dist/unstable/ai/index.js.map +1 -1
  71. package/dist/unstable/http/Url.d.ts +604 -0
  72. package/dist/unstable/http/Url.d.ts.map +1 -0
  73. package/dist/unstable/http/Url.js +256 -0
  74. package/dist/unstable/http/Url.js.map +1 -0
  75. package/dist/unstable/http/index.d.ts +4 -0
  76. package/dist/unstable/http/index.d.ts.map +1 -1
  77. package/dist/unstable/http/index.js +4 -0
  78. package/dist/unstable/http/index.js.map +1 -1
  79. package/dist/unstable/httpapi/HttpApiMiddleware.d.ts +30 -1
  80. package/dist/unstable/httpapi/HttpApiMiddleware.d.ts.map +1 -1
  81. package/dist/unstable/httpapi/HttpApiMiddleware.js +27 -0
  82. package/dist/unstable/httpapi/HttpApiMiddleware.js.map +1 -1
  83. package/dist/unstable/socket/Socket.d.ts +2 -1
  84. package/dist/unstable/socket/Socket.d.ts.map +1 -1
  85. package/dist/unstable/socket/Socket.js +3 -2
  86. package/dist/unstable/socket/Socket.js.map +1 -1
  87. package/package.json +1 -1
  88. package/src/Effect.ts +16 -25
  89. package/src/FileSystem.ts +2 -1
  90. package/src/Graph.ts +2 -1
  91. package/src/MutableHashMap.ts +9 -0
  92. package/src/MutableHashSet.ts +9 -0
  93. package/src/Queue.ts +1 -1
  94. package/src/Resource.ts +2 -1
  95. package/src/SubscriptionRef.ts +2 -1
  96. package/src/TxDeferred.ts +2 -2
  97. package/src/TxHashMap.ts +2 -1
  98. package/src/TxHashSet.ts +2 -2
  99. package/src/TxPriorityQueue.ts +2 -3
  100. package/src/TxSemaphore.ts +2 -1
  101. package/src/internal/effect.ts +11 -4
  102. package/src/unstable/ai/AiError.ts +1 -3
  103. package/src/unstable/ai/EmbeddingModel.ts +209 -0
  104. package/src/unstable/ai/LanguageModel.ts +228 -69
  105. package/src/unstable/ai/ResponseIdTracker.ts +97 -0
  106. package/src/unstable/ai/Tool.ts +2 -2
  107. package/src/unstable/ai/index.ts +23 -0
  108. package/src/unstable/http/Url.ts +650 -0
  109. package/src/unstable/http/index.ts +5 -0
  110. package/src/unstable/httpapi/HttpApiMiddleware.ts +46 -1
  111. package/src/unstable/socket/Socket.ts +12 -8
@@ -0,0 +1,604 @@
1
+ /**
2
+ * @since 4.0.0
3
+ */
4
+ import * as Cause from "../../Cause.ts";
5
+ import * as Redacted from "../../Redacted.ts";
6
+ import * as Result from "../../Result.ts";
7
+ import * as UrlParams from "./UrlParams.ts";
8
+ /**
9
+ * Parses a URL string into a `URL` object, returning an `Result` type for safe
10
+ * error handling.
11
+ *
12
+ * **Details**
13
+ *
14
+ * This function converts a string into a `URL` object, enabling safe URL
15
+ * parsing with built-in error handling. If the string is invalid or fails to
16
+ * parse, this function does not throw an error; instead, it wraps the error in
17
+ * a `IllegalArgumentError` and returns it as the `Failure` value of an
18
+ * `Result`. The `Success` value contains the successfully parsed `URL`.
19
+ *
20
+ * An optional `base` parameter can be provided to resolve relative URLs. If
21
+ * specified, the function interprets the input `url` as relative to this
22
+ * `base`. This is especially useful when dealing with URLs that might not be
23
+ * fully qualified.
24
+ *
25
+ * **Example**
26
+ *
27
+ * ```ts
28
+ * import { Url } from "effect/unstable/http"
29
+ * import { Result } from "effect"
30
+ *
31
+ * // Parse an absolute URL
32
+ * //
33
+ * // ┌─── Result<URL, IllegalArgumentError>
34
+ * // ▼
35
+ * const parsed = Url.fromString("https://example.com/path")
36
+ *
37
+ * if (Result.isSuccess(parsed)) {
38
+ * console.log("Parsed URL:", parsed.success.toString())
39
+ * } else {
40
+ * console.log("Error:", parsed.failure.message)
41
+ * }
42
+ * // Output: Parsed URL: https://example.com/path
43
+ *
44
+ * // Parse a relative URL with a base
45
+ * const relativeParsed = Url.fromString("/relative-path", "https://example.com")
46
+ *
47
+ * if (Result.isSuccess(relativeParsed)) {
48
+ * console.log("Parsed relative URL:", relativeParsed.success.toString())
49
+ * } else {
50
+ * console.log("Error:", relativeParsed.failure.message)
51
+ * }
52
+ * // Output: Parsed relative URL: https://example.com/relative-path
53
+ * ```
54
+ *
55
+ * @since 4.0.0
56
+ * @category Constructors
57
+ */
58
+ export declare const fromString: {
59
+ /**
60
+ * Parses a URL string into a `URL` object, returning an `Result` type for safe
61
+ * error handling.
62
+ *
63
+ * **Details**
64
+ *
65
+ * This function converts a string into a `URL` object, enabling safe URL
66
+ * parsing with built-in error handling. If the string is invalid or fails to
67
+ * parse, this function does not throw an error; instead, it wraps the error in
68
+ * a `IllegalArgumentError` and returns it as the `Failure` value of an
69
+ * `Result`. The `Success` value contains the successfully parsed `URL`.
70
+ *
71
+ * An optional `base` parameter can be provided to resolve relative URLs. If
72
+ * specified, the function interprets the input `url` as relative to this
73
+ * `base`. This is especially useful when dealing with URLs that might not be
74
+ * fully qualified.
75
+ *
76
+ * **Example**
77
+ *
78
+ * ```ts
79
+ * import { Url } from "effect/unstable/http"
80
+ * import { Result } from "effect"
81
+ *
82
+ * // Parse an absolute URL
83
+ * //
84
+ * // ┌─── Result<URL, IllegalArgumentError>
85
+ * // ▼
86
+ * const parsed = Url.fromString("https://example.com/path")
87
+ *
88
+ * if (Result.isSuccess(parsed)) {
89
+ * console.log("Parsed URL:", parsed.success.toString())
90
+ * } else {
91
+ * console.log("Error:", parsed.failure.message)
92
+ * }
93
+ * // Output: Parsed URL: https://example.com/path
94
+ *
95
+ * // Parse a relative URL with a base
96
+ * const relativeParsed = Url.fromString("/relative-path", "https://example.com")
97
+ *
98
+ * if (Result.isSuccess(relativeParsed)) {
99
+ * console.log("Parsed relative URL:", relativeParsed.success.toString())
100
+ * } else {
101
+ * console.log("Error:", relativeParsed.failure.message)
102
+ * }
103
+ * // Output: Parsed relative URL: https://example.com/relative-path
104
+ * ```
105
+ *
106
+ * @since 4.0.0
107
+ * @category Constructors
108
+ */
109
+ (url: string, base?: string | URL | undefined): Result.Result<URL, Cause.IllegalArgumentError>;
110
+ };
111
+ /**
112
+ * This function clones the original `URL` object and applies a callback to the
113
+ * clone, allowing multiple updates at once.
114
+ *
115
+ * **Example**
116
+ *
117
+ * ```ts
118
+ * import { Url } from "effect/unstable/http"
119
+ *
120
+ * const myUrl = new URL("https://example.com")
121
+ *
122
+ * const mutatedUrl = Url.mutate(myUrl, (url) => {
123
+ * url.username = "user"
124
+ * url.password = "pass"
125
+ * })
126
+ *
127
+ * console.log("Mutated:", mutatedUrl.toString())
128
+ * // Output: Mutated: https://user:pass@example.com/
129
+ * ```
130
+ *
131
+ * @since 4.0.0
132
+ * @category Modifiers
133
+ */
134
+ export declare const mutate: {
135
+ /**
136
+ * This function clones the original `URL` object and applies a callback to the
137
+ * clone, allowing multiple updates at once.
138
+ *
139
+ * **Example**
140
+ *
141
+ * ```ts
142
+ * import { Url } from "effect/unstable/http"
143
+ *
144
+ * const myUrl = new URL("https://example.com")
145
+ *
146
+ * const mutatedUrl = Url.mutate(myUrl, (url) => {
147
+ * url.username = "user"
148
+ * url.password = "pass"
149
+ * })
150
+ *
151
+ * console.log("Mutated:", mutatedUrl.toString())
152
+ * // Output: Mutated: https://user:pass@example.com/
153
+ * ```
154
+ *
155
+ * @since 4.0.0
156
+ * @category Modifiers
157
+ */
158
+ (f: (url: URL) => void): (self: URL) => URL;
159
+ /**
160
+ * This function clones the original `URL` object and applies a callback to the
161
+ * clone, allowing multiple updates at once.
162
+ *
163
+ * **Example**
164
+ *
165
+ * ```ts
166
+ * import { Url } from "effect/unstable/http"
167
+ *
168
+ * const myUrl = new URL("https://example.com")
169
+ *
170
+ * const mutatedUrl = Url.mutate(myUrl, (url) => {
171
+ * url.username = "user"
172
+ * url.password = "pass"
173
+ * })
174
+ *
175
+ * console.log("Mutated:", mutatedUrl.toString())
176
+ * // Output: Mutated: https://user:pass@example.com/
177
+ * ```
178
+ *
179
+ * @since 4.0.0
180
+ * @category Modifiers
181
+ */
182
+ (self: URL, f: (url: URL) => void): URL;
183
+ };
184
+ /**
185
+ * Updates the hash fragment of the URL.
186
+ *
187
+ * @since 4.0.0
188
+ * @category Setters
189
+ */
190
+ export declare const setHash: {
191
+ /**
192
+ * Updates the hash fragment of the URL.
193
+ *
194
+ * @since 4.0.0
195
+ * @category Setters
196
+ */
197
+ (hash: string): (url: URL) => URL;
198
+ /**
199
+ * Updates the hash fragment of the URL.
200
+ *
201
+ * @since 4.0.0
202
+ * @category Setters
203
+ */
204
+ (url: URL, hash: string): URL;
205
+ };
206
+ /**
207
+ * Updates the host (domain and port) of the URL.
208
+ *
209
+ * @since 4.0.0
210
+ * @category Setters
211
+ */
212
+ export declare const setHost: {
213
+ /**
214
+ * Updates the host (domain and port) of the URL.
215
+ *
216
+ * @since 4.0.0
217
+ * @category Setters
218
+ */
219
+ (host: string): (url: URL) => URL;
220
+ /**
221
+ * Updates the host (domain and port) of the URL.
222
+ *
223
+ * @since 4.0.0
224
+ * @category Setters
225
+ */
226
+ (url: URL, host: string): URL;
227
+ };
228
+ /**
229
+ * Updates the domain of the URL without modifying the port.
230
+ *
231
+ * @since 4.0.0
232
+ * @category Setters
233
+ */
234
+ export declare const setHostname: {
235
+ /**
236
+ * Updates the domain of the URL without modifying the port.
237
+ *
238
+ * @since 4.0.0
239
+ * @category Setters
240
+ */
241
+ (hostname: string): (url: URL) => URL;
242
+ /**
243
+ * Updates the domain of the URL without modifying the port.
244
+ *
245
+ * @since 4.0.0
246
+ * @category Setters
247
+ */
248
+ (url: URL, hostname: string): URL;
249
+ };
250
+ /**
251
+ * Replaces the entire URL string.
252
+ *
253
+ * @since 4.0.0
254
+ * @category Setters
255
+ */
256
+ export declare const setHref: {
257
+ /**
258
+ * Replaces the entire URL string.
259
+ *
260
+ * @since 4.0.0
261
+ * @category Setters
262
+ */
263
+ (href: string): (url: URL) => URL;
264
+ /**
265
+ * Replaces the entire URL string.
266
+ *
267
+ * @since 4.0.0
268
+ * @category Setters
269
+ */
270
+ (url: URL, href: string): URL;
271
+ };
272
+ /**
273
+ * Updates the password used for authentication.
274
+ *
275
+ * @since 4.0.0
276
+ * @category Setters
277
+ */
278
+ export declare const setPassword: {
279
+ /**
280
+ * Updates the password used for authentication.
281
+ *
282
+ * @since 4.0.0
283
+ * @category Setters
284
+ */
285
+ (password: string | Redacted.Redacted): (url: URL) => URL;
286
+ /**
287
+ * Updates the password used for authentication.
288
+ *
289
+ * @since 4.0.0
290
+ * @category Setters
291
+ */
292
+ (url: URL, password: string | Redacted.Redacted): URL;
293
+ };
294
+ /**
295
+ * Updates the path of the URL.
296
+ *
297
+ * @since 4.0.0
298
+ * @category Setters
299
+ */
300
+ export declare const setPathname: {
301
+ /**
302
+ * Updates the path of the URL.
303
+ *
304
+ * @since 4.0.0
305
+ * @category Setters
306
+ */
307
+ (pathname: string): (url: URL) => URL;
308
+ /**
309
+ * Updates the path of the URL.
310
+ *
311
+ * @since 4.0.0
312
+ * @category Setters
313
+ */
314
+ (url: URL, pathname: string): URL;
315
+ };
316
+ /**
317
+ * Updates the port of the URL.
318
+ *
319
+ * @since 4.0.0
320
+ * @category Setters
321
+ */
322
+ export declare const setPort: {
323
+ /**
324
+ * Updates the port of the URL.
325
+ *
326
+ * @since 4.0.0
327
+ * @category Setters
328
+ */
329
+ (port: string | number): (url: URL) => URL;
330
+ /**
331
+ * Updates the port of the URL.
332
+ *
333
+ * @since 4.0.0
334
+ * @category Setters
335
+ */
336
+ (url: URL, port: string | number): URL;
337
+ };
338
+ /**
339
+ * Updates the protocol (e.g., `http`, `https`).
340
+ *
341
+ * @since 4.0.0
342
+ * @category Setters
343
+ */
344
+ export declare const setProtocol: {
345
+ /**
346
+ * Updates the protocol (e.g., `http`, `https`).
347
+ *
348
+ * @since 4.0.0
349
+ * @category Setters
350
+ */
351
+ (protocol: string): (url: URL) => URL;
352
+ /**
353
+ * Updates the protocol (e.g., `http`, `https`).
354
+ *
355
+ * @since 4.0.0
356
+ * @category Setters
357
+ */
358
+ (url: URL, protocol: string): URL;
359
+ };
360
+ /**
361
+ * Updates the query string of the URL.
362
+ *
363
+ * @since 4.0.0
364
+ * @category Setters
365
+ */
366
+ export declare const setSearch: {
367
+ /**
368
+ * Updates the query string of the URL.
369
+ *
370
+ * @since 4.0.0
371
+ * @category Setters
372
+ */
373
+ (search: string): (url: URL) => URL;
374
+ /**
375
+ * Updates the query string of the URL.
376
+ *
377
+ * @since 4.0.0
378
+ * @category Setters
379
+ */
380
+ (url: URL, search: string): URL;
381
+ };
382
+ /**
383
+ * Updates the username used for authentication.
384
+ *
385
+ * @since 4.0.0
386
+ * @category Setters
387
+ */
388
+ export declare const setUsername: {
389
+ /**
390
+ * Updates the username used for authentication.
391
+ *
392
+ * @since 4.0.0
393
+ * @category Setters
394
+ */
395
+ (username: string): (url: URL) => URL;
396
+ /**
397
+ * Updates the username used for authentication.
398
+ *
399
+ * @since 4.0.0
400
+ * @category Setters
401
+ */
402
+ (url: URL, username: string): URL;
403
+ };
404
+ /**
405
+ * Updates the query parameters of a URL.
406
+ *
407
+ * **Details**
408
+ *
409
+ * This function allows you to set or replace the query parameters of a `URL`
410
+ * object using the provided `UrlParams`. It creates a new `URL` object with the
411
+ * updated parameters, leaving the original object unchanged.
412
+ *
413
+ * **Example**
414
+ *
415
+ * ```ts
416
+ * import { Url, UrlParams } from "effect/unstable/http"
417
+ *
418
+ * const myUrl = new URL("https://example.com?foo=bar")
419
+ *
420
+ * // Write parameters
421
+ * const updatedUrl = Url.setUrlParams(
422
+ * myUrl,
423
+ * UrlParams.fromInput([["key", "value"]])
424
+ * )
425
+ *
426
+ * console.log(updatedUrl.toString())
427
+ * // Output: https://example.com/?key=value
428
+ * ```
429
+ *
430
+ * @since 4.0.0
431
+ * @category Setters
432
+ */
433
+ export declare const setUrlParams: {
434
+ /**
435
+ * Updates the query parameters of a URL.
436
+ *
437
+ * **Details**
438
+ *
439
+ * This function allows you to set or replace the query parameters of a `URL`
440
+ * object using the provided `UrlParams`. It creates a new `URL` object with the
441
+ * updated parameters, leaving the original object unchanged.
442
+ *
443
+ * **Example**
444
+ *
445
+ * ```ts
446
+ * import { Url, UrlParams } from "effect/unstable/http"
447
+ *
448
+ * const myUrl = new URL("https://example.com?foo=bar")
449
+ *
450
+ * // Write parameters
451
+ * const updatedUrl = Url.setUrlParams(
452
+ * myUrl,
453
+ * UrlParams.fromInput([["key", "value"]])
454
+ * )
455
+ *
456
+ * console.log(updatedUrl.toString())
457
+ * // Output: https://example.com/?key=value
458
+ * ```
459
+ *
460
+ * @since 4.0.0
461
+ * @category Setters
462
+ */
463
+ (urlParams: UrlParams.UrlParams): (url: URL) => URL;
464
+ /**
465
+ * Updates the query parameters of a URL.
466
+ *
467
+ * **Details**
468
+ *
469
+ * This function allows you to set or replace the query parameters of a `URL`
470
+ * object using the provided `UrlParams`. It creates a new `URL` object with the
471
+ * updated parameters, leaving the original object unchanged.
472
+ *
473
+ * **Example**
474
+ *
475
+ * ```ts
476
+ * import { Url, UrlParams } from "effect/unstable/http"
477
+ *
478
+ * const myUrl = new URL("https://example.com?foo=bar")
479
+ *
480
+ * // Write parameters
481
+ * const updatedUrl = Url.setUrlParams(
482
+ * myUrl,
483
+ * UrlParams.fromInput([["key", "value"]])
484
+ * )
485
+ *
486
+ * console.log(updatedUrl.toString())
487
+ * // Output: https://example.com/?key=value
488
+ * ```
489
+ *
490
+ * @since 4.0.0
491
+ * @category Setters
492
+ */
493
+ (url: URL, urlParams: UrlParams.UrlParams): URL;
494
+ };
495
+ /**
496
+ * Retrieves the query parameters from a URL.
497
+ *
498
+ * **Details**
499
+ *
500
+ * This function extracts the query parameters from a `URL` object and returns
501
+ * them as `UrlParams`. The resulting structure can be easily manipulated or
502
+ * inspected.
503
+ *
504
+ * **Example**
505
+ *
506
+ * ```ts
507
+ * import { Url } from "effect/unstable/http"
508
+ *
509
+ * const myUrl = new URL("https://example.com?foo=bar")
510
+ *
511
+ * // Read parameters
512
+ * const params = Url.urlParams(myUrl)
513
+ *
514
+ * console.log(params)
515
+ * // Output: [ [ 'foo', 'bar' ] ]
516
+ * ```
517
+ *
518
+ * @since 4.0.0
519
+ * @category Getters
520
+ */
521
+ export declare const urlParams: (url: URL) => UrlParams.UrlParams;
522
+ /**
523
+ * Reads, modifies, and updates the query parameters of a URL.
524
+ *
525
+ * **Details**
526
+ *
527
+ * This function provides a functional way to interact with query parameters by
528
+ * reading the current parameters, applying a transformation function, and then
529
+ * writing the updated parameters back to the URL. It returns a new `URL` object
530
+ * with the modified parameters, ensuring immutability.
531
+ *
532
+ * **Example**
533
+ *
534
+ * ```ts
535
+ * import { Url, UrlParams } from "effect/unstable/http"
536
+ *
537
+ * const myUrl = new URL("https://example.com?foo=bar")
538
+ *
539
+ * const changedUrl = Url.modifyUrlParams(myUrl, UrlParams.append("key", "value"))
540
+ *
541
+ * console.log(changedUrl.toString())
542
+ * // Output: https://example.com/?foo=bar&key=value
543
+ * ```
544
+ *
545
+ * @since 4.0.0
546
+ * @category Modifiers
547
+ */
548
+ export declare const modifyUrlParams: {
549
+ /**
550
+ * Reads, modifies, and updates the query parameters of a URL.
551
+ *
552
+ * **Details**
553
+ *
554
+ * This function provides a functional way to interact with query parameters by
555
+ * reading the current parameters, applying a transformation function, and then
556
+ * writing the updated parameters back to the URL. It returns a new `URL` object
557
+ * with the modified parameters, ensuring immutability.
558
+ *
559
+ * **Example**
560
+ *
561
+ * ```ts
562
+ * import { Url, UrlParams } from "effect/unstable/http"
563
+ *
564
+ * const myUrl = new URL("https://example.com?foo=bar")
565
+ *
566
+ * const changedUrl = Url.modifyUrlParams(myUrl, UrlParams.append("key", "value"))
567
+ *
568
+ * console.log(changedUrl.toString())
569
+ * // Output: https://example.com/?foo=bar&key=value
570
+ * ```
571
+ *
572
+ * @since 4.0.0
573
+ * @category Modifiers
574
+ */
575
+ (f: (urlParams: UrlParams.UrlParams) => UrlParams.UrlParams): (url: URL) => URL;
576
+ /**
577
+ * Reads, modifies, and updates the query parameters of a URL.
578
+ *
579
+ * **Details**
580
+ *
581
+ * This function provides a functional way to interact with query parameters by
582
+ * reading the current parameters, applying a transformation function, and then
583
+ * writing the updated parameters back to the URL. It returns a new `URL` object
584
+ * with the modified parameters, ensuring immutability.
585
+ *
586
+ * **Example**
587
+ *
588
+ * ```ts
589
+ * import { Url, UrlParams } from "effect/unstable/http"
590
+ *
591
+ * const myUrl = new URL("https://example.com?foo=bar")
592
+ *
593
+ * const changedUrl = Url.modifyUrlParams(myUrl, UrlParams.append("key", "value"))
594
+ *
595
+ * console.log(changedUrl.toString())
596
+ * // Output: https://example.com/?foo=bar&key=value
597
+ * ```
598
+ *
599
+ * @since 4.0.0
600
+ * @category Modifiers
601
+ */
602
+ (url: URL, f: (urlParams: UrlParams.UrlParams) => UrlParams.UrlParams): URL;
603
+ };
604
+ //# sourceMappingURL=Url.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Url.d.ts","sourceRoot":"","sources":["../../../src/unstable/http/Url.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,KAAK,KAAK,MAAM,gBAAgB,CAAA;AAEvC,OAAO,KAAK,QAAQ,MAAM,mBAAmB,CAAA;AAC7C,OAAO,KAAK,MAAM,MAAM,iBAAiB,CAAA;AACzC,OAAO,KAAK,SAAS,MAAM,gBAAgB,CAAA;AAE3C;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiDG;AACH,eAAO,MAAM,UAAU,EAAE;IACvB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAiDG;IACH,CAAC,GAAG,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,MAAM,GAAG,GAAG,GAAG,SAAS,GAAG,MAAM,CAAC,MAAM,CAAC,GAAG,EAAE,KAAK,CAAC,oBAAoB,CAAC,CAAA;CAM5F,CAAA;AAEJ;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,eAAO,MAAM,MAAM,EAAE;IACnB;;;;;;;;;;;;;;;;;;;;;;OAsBG;IACH,CAAC,CAAC,EAAE,CAAC,GAAG,EAAE,GAAG,KAAK,IAAI,GAAG,CAAC,IAAI,EAAE,GAAG,KAAK,GAAG,CAAA;IAC3C;;;;;;;;;;;;;;;;;;;;;;OAsBG;IACH,CAAC,IAAI,EAAE,GAAG,EAAE,CAAC,EAAE,CAAC,GAAG,EAAE,GAAG,KAAK,IAAI,GAAG,GAAG,CAAA;CAKvC,CAAA;AAYF;;;;;GAKG;AACH,eAAO,MAAM,OAAO,EAAE;IACpB;;;;;OAKG;IACH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