@effect/platform 0.65.5 → 0.66.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/README.md +28 -0
  2. package/package.json +2 -2
package/README.md CHANGED
@@ -837,6 +837,34 @@ Output:
837
837
  */
838
838
  ```
839
839
 
840
+ ### Persisting Cookies
841
+
842
+ You can manage cookies across requests using the `HttpClient.withCookiesRef` function, which associates a reference to a `Cookies` object with the client.
843
+
844
+ ```ts
845
+ import { Cookies, FetchHttpClient, HttpClient } from "@effect/platform"
846
+ import { Effect, Ref } from "effect"
847
+
848
+ const program = Effect.gen(function* () {
849
+ // Create a reference to store cookies
850
+ const ref = yield* Ref.make(Cookies.empty)
851
+
852
+ // Access the HttpClient and associate the cookies reference with it
853
+ const client = (yield* HttpClient.HttpClient).pipe(
854
+ HttpClient.withCookiesRef(ref)
855
+ )
856
+
857
+ // Make a GET request to the specified URL
858
+ yield* client.get("https://www.google.com/")
859
+
860
+ // Log the keys of the cookies stored in the reference
861
+ console.log(Object.keys((yield* ref).cookies))
862
+ }).pipe(Effect.scoped, Effect.provide(FetchHttpClient.layer))
863
+
864
+ Effect.runPromise(program)
865
+ // Output: [ 'SOCS', 'AEC', '__Secure-ENID' ]
866
+ ```
867
+
840
868
  ## RequestInit Options
841
869
 
842
870
  You can customize the `HttpClient` by passing `RequestInit` options to configure aspects of the HTTP requests, such as credentials, headers, and more.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@effect/platform",
3
- "version": "0.65.5",
3
+ "version": "0.66.0",
4
4
  "description": "Unified interfaces for common platform-specific services",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -14,7 +14,7 @@
14
14
  "multipasta": "^0.2.5"
15
15
  },
16
16
  "peerDependencies": {
17
- "@effect/schema": "^0.73.4",
17
+ "@effect/schema": "^0.74.0",
18
18
  "effect": "^3.8.3"
19
19
  },
20
20
  "publishConfig": {