react-native-nitro-cookies 1.0.0 → 1.0.1

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 (34) hide show
  1. package/android/AGENTS.md +62 -0
  2. package/android/src/main/java/com/margelo/nitro/nitrocookies/NitroCookies.kt +16 -11
  3. package/ios/AGENTS.md +49 -0
  4. package/lib/module/AGENTS.md +50 -0
  5. package/nitrogen/generated/android/c++/JCookie.hpp +1 -1
  6. package/nitrogen/generated/android/c++/JHybridNitroCookiesSpec.cpp +1 -1
  7. package/nitrogen/generated/android/c++/JHybridNitroCookiesSpec.hpp +1 -1
  8. package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitrocookies/Cookie.kt +1 -1
  9. package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitrocookies/HybridNitroCookiesSpec.kt +1 -1
  10. package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitrocookies/nitrocookiesOnLoad.kt +1 -1
  11. package/nitrogen/generated/android/nitrocookies+autolinking.cmake +1 -1
  12. package/nitrogen/generated/android/nitrocookies+autolinking.gradle +1 -1
  13. package/nitrogen/generated/android/nitrocookiesOnLoad.cpp +1 -1
  14. package/nitrogen/generated/android/nitrocookiesOnLoad.hpp +1 -1
  15. package/nitrogen/generated/ios/NitroCookies+autolinking.rb +1 -1
  16. package/nitrogen/generated/ios/NitroCookies-Swift-Cxx-Bridge.cpp +1 -1
  17. package/nitrogen/generated/ios/NitroCookies-Swift-Cxx-Bridge.hpp +1 -1
  18. package/nitrogen/generated/ios/NitroCookies-Swift-Cxx-Umbrella.hpp +1 -1
  19. package/nitrogen/generated/ios/NitroCookiesAutolinking.mm +1 -1
  20. package/nitrogen/generated/ios/NitroCookiesAutolinking.swift +1 -1
  21. package/nitrogen/generated/ios/c++/HybridNitroCookiesSpecSwift.cpp +1 -1
  22. package/nitrogen/generated/ios/c++/HybridNitroCookiesSpecSwift.hpp +1 -1
  23. package/nitrogen/generated/ios/swift/Cookie.swift +1 -1
  24. package/nitrogen/generated/ios/swift/Func_void.swift +1 -1
  25. package/nitrogen/generated/ios/swift/Func_void_bool.swift +1 -1
  26. package/nitrogen/generated/ios/swift/Func_void_std__exception_ptr.swift +1 -1
  27. package/nitrogen/generated/ios/swift/Func_void_std__vector_Cookie_.swift +1 -1
  28. package/nitrogen/generated/ios/swift/HybridNitroCookiesSpec.swift +1 -1
  29. package/nitrogen/generated/ios/swift/HybridNitroCookiesSpec_cxx.swift +1 -1
  30. package/nitrogen/generated/shared/c++/Cookie.hpp +1 -1
  31. package/nitrogen/generated/shared/c++/HybridNitroCookiesSpec.cpp +1 -1
  32. package/nitrogen/generated/shared/c++/HybridNitroCookiesSpec.hpp +1 -1
  33. package/package.json +1 -1
  34. package/src/AGENTS.md +50 -0
@@ -0,0 +1,62 @@
1
+ <!-- Parent: ../AGENTS.md -->
2
+ <!-- Generated: 2026-02-13 | Updated: 2026-02-13 -->
3
+
4
+ # android
5
+
6
+ ## Purpose
7
+ Android native implementation of the NitroCookies HybridObject in Kotlin, plus JNI/C++ adapter for Nitro Modules initialization. Uses Android's `CookieManager` (WebView-based) for all cookie operations. Includes Gradle build configuration and CMake native build.
8
+
9
+ ## Key Files
10
+
11
+ | File | Description |
12
+ |------|-------------|
13
+ | `build.gradle` | Android Gradle build config (Kotlin, CMake, dependencies) |
14
+ | `CMakeLists.txt` | CMake config for building the C++ JNI adapter |
15
+
16
+ ## Subdirectories
17
+
18
+ | Directory | Purpose |
19
+ |-----------|---------|
20
+ | `src/main/java/com/margelo/nitro/nitrocookies/` | Kotlin source files |
21
+ | `src/main/cpp/` | C++ JNI adapter for Nitro module loading |
22
+ | `.gradle/` | Gradle cache (gitignored, auto-generated) |
23
+ | `.cxx/` | CMake build output (gitignored, auto-generated) |
24
+
25
+ ## For AI Agents
26
+
27
+ ### Working In This Directory
28
+ - `NitroCookies.kt` is the main implementation file -- extends `HybridNitroCookiesSpec()` generated by Nitrogen
29
+ - `NitroCookiesPackage.kt` is the React Native package registration (loads `libnitrocookies` native library)
30
+ - `cpp-adapter.cpp` is the JNI entry point that calls `margelo::nitro::nitrocookies::initialize(vm)`
31
+ - Android uses `android.webkit.CookieManager` for all cookie operations (single storage backend, no WebKit/non-WebKit distinction)
32
+ - `useWebKit` parameter is accepted but ignored on Android (API compatibility with iOS)
33
+ - Cookie deletion works by setting an expired cookie (Android `CookieManager` limitation)
34
+ - `getAll()` throws `PLATFORM_UNSUPPORTED` on Android (iOS-only feature)
35
+ - Date formatting: converts between ISO 8601 and RFC 1123 for cookie headers
36
+ - Some async operations (`clearAll`, `removeSessionCookies`) require `Dispatchers.Main` because `CookieManager` callbacks run on the main thread
37
+
38
+ ### Testing Requirements
39
+ - No unit tests in this directory -- test via the `example/` Android app
40
+ - Test on various Android API levels (min API 21+)
41
+ - Verify cookie persistence across app restarts (test `flush()`)
42
+
43
+ ### Common Patterns
44
+ - `Promise.async { ... }` for async operations
45
+ - `suspendCancellableCoroutine` to bridge callback-based `CookieManager` APIs to coroutines
46
+ - `toRFC6265String()` serializes Cookie struct to Set-Cookie header format
47
+ - `createCookieData()` parses Set-Cookie header string back to Cookie struct
48
+ - `validateURL()` / `validateDomain()` for input validation
49
+
50
+ ## Dependencies
51
+
52
+ ### Internal
53
+ - `nitrogen/generated/android/` -- `HybridNitroCookiesSpec`, `Cookie` data class, JNI bridges
54
+ - `nitrogen/generated/shared/c++/` -- C++ spec and Cookie struct
55
+
56
+ ### External
57
+ - `android.webkit.CookieManager` -- Cookie storage (WebView-based)
58
+ - `java.net.HttpURLConnection` -- HTTP requests for `getFromResponse()`
59
+ - `com.margelo.nitro.core.Promise` -- Nitro async return type
60
+ - `kotlinx.coroutines` -- Coroutine support for async callbacks
61
+
62
+ <!-- MANUAL: Any manually added notes below this line are preserved on regeneration -->
@@ -1,5 +1,7 @@
1
1
  package com.margelo.nitro.nitrocookies
2
2
 
3
+ import android.os.Handler
4
+ import android.os.Looper
3
5
  import android.webkit.CookieManager
4
6
  import com.facebook.proguard.annotations.DoNotStrip
5
7
  import com.margelo.nitro.core.Promise
@@ -8,8 +10,6 @@ import java.net.URL
8
10
  import java.text.SimpleDateFormat
9
11
  import java.util.Locale
10
12
  import java.util.TimeZone
11
- import kotlin.coroutines.resume
12
- import kotlin.coroutines.suspendCoroutine
13
13
 
14
14
  /** HybridNitroCookies - Android implementation of cookie management */
15
15
  @DoNotStrip
@@ -31,7 +31,12 @@ class NitroCookies : HybridNitroCookiesSpec() {
31
31
  // Expires attribute (convert ISO 8601 to RFC 1123)
32
32
  cookie.expires?.let { expiresISO ->
33
33
  try {
34
- val date = iso8601Formatter.parse(expiresISO)
34
+ val normalizedISO = if (expiresISO.endsWith("Z")) {
35
+ expiresISO.dropLast(1) + "+00:00"
36
+ } else {
37
+ expiresISO
38
+ }
39
+ val date = iso8601Formatter.parse(normalizedISO)
35
40
  date?.let {
36
41
  val expiresRFC = rfc1123Formatter.format(it)
37
42
  parts.add("Expires=$expiresRFC")
@@ -324,12 +329,12 @@ class NitroCookies : HybridNitroCookiesSpec() {
324
329
 
325
330
  /** Clear all cookies */
326
331
  override fun clearAll(useWebKit: Boolean?): Promise<Boolean> {
327
- return Promise.async {
332
+ val promise = Promise<Boolean>()
333
+ Handler(Looper.getMainLooper()).post {
328
334
  val cookieManager = CookieManager.getInstance()
329
- suspendCoroutine { continuation ->
330
- cookieManager.removeAllCookies { success -> continuation.resume(success) }
331
- }
335
+ cookieManager.removeAllCookies { _ -> promise.resolve(true) }
332
336
  }
337
+ return promise
333
338
  }
334
339
 
335
340
  /** Parse and set cookies from Set-Cookie header */
@@ -418,12 +423,12 @@ class NitroCookies : HybridNitroCookiesSpec() {
418
423
 
419
424
  /** Remove session cookies (Android only) */
420
425
  override fun removeSessionCookies(): Promise<Boolean> {
421
- return Promise.async {
426
+ val promise = Promise<Boolean>()
427
+ Handler(Looper.getMainLooper()).post {
422
428
  val cookieManager = CookieManager.getInstance()
423
- suspendCoroutine { continuation ->
424
- cookieManager.removeSessionCookies { success -> continuation.resume(success) }
425
- }
429
+ cookieManager.removeSessionCookies { _ -> promise.resolve(true) }
426
430
  }
431
+ return promise
427
432
  }
428
433
 
429
434
  companion object {
package/ios/AGENTS.md ADDED
@@ -0,0 +1,49 @@
1
+ <!-- Parent: ../AGENTS.md -->
2
+ <!-- Generated: 2026-02-13 | Updated: 2026-02-13 -->
3
+
4
+ # ios
5
+
6
+ ## Purpose
7
+ iOS native implementation of the NitroCookies HybridObject in Swift. Provides cookie management using `NSHTTPCookieStorage` (synchronous/default) and `WKHTTPCookieStore` (async WebKit operations). Conforms to the Nitrogen-generated `HybridNitroCookiesSpec`.
8
+
9
+ ## Key Files
10
+
11
+ | File | Description |
12
+ |------|-------------|
13
+ | `NitroCookies.swift` | Full iOS implementation: `HybridNitroCookies` class extending `HybridNitroCookiesSpec` with sync + async cookie CRUD, URL validation, domain matching, WebKit support |
14
+
15
+ ## For AI Agents
16
+
17
+ ### Working In This Directory
18
+ - The class `HybridNitroCookies` extends the generated `HybridNitroCookiesSpec` (from `nitrogen/generated/ios/`)
19
+ - Two cookie storage backends:
20
+ - **NSHTTPCookieStorage** (shared): used for all sync methods and async methods when `useWebKit == false`
21
+ - **WKHTTPCookieStore**: used for async methods when `useWebKit == true` (iOS 11+ required)
22
+ - WebKit operations require `MainActor.run` to access `WKWebsiteDataStore.default().httpCookieStore` safely across iOS versions
23
+ - Date conversion uses `ISO8601DateFormatter` with fractional seconds for cookie `expires` fields
24
+ - Platform-only methods (`flush`, `removeSessionCookies`) throw `PLATFORM_UNSUPPORTED` errors on iOS
25
+ - Domain matching logic: exact match, wildcard (`.example.com`), and subdomain matching
26
+
27
+ ### Testing Requirements
28
+ - No unit tests in this directory -- test via the `example/` iOS app
29
+ - Test both NSHTTPCookieStorage and WKHTTPCookieStore paths
30
+ - Verify iOS 11+ availability checks for WebKit operations
31
+
32
+ ### Common Patterns
33
+ - `Promise.async { ... }` wraps async work into Nitro Promises
34
+ - `withCheckedContinuation` bridges callback-based WebKit APIs to Swift concurrency
35
+ - `validateURL()` and `validateDomain()` are called at the start of every operation
36
+ - Cookie struct conversion: `makeHTTPCookie(from:url:)` and `createCookieData(from:)`
37
+
38
+ ## Dependencies
39
+
40
+ ### Internal
41
+ - `nitrogen/generated/ios/` -- `HybridNitroCookiesSpec`, `Cookie` type bridges
42
+ - `nitrogen/generated/shared/c++/` -- C++ spec and Cookie struct
43
+
44
+ ### External
45
+ - `Foundation` -- `HTTPCookieStorage`, `HTTPCookie`, `URLSession`
46
+ - `WebKit` -- `WKWebsiteDataStore`, `WKHTTPCookieStore`
47
+ - `NitroModules` -- `HybridObject` base, `Promise`
48
+
49
+ <!-- MANUAL: Any manually added notes below this line are preserved on regeneration -->
@@ -0,0 +1,50 @@
1
+ <!-- Parent: ../AGENTS.md -->
2
+ <!-- Generated: 2026-02-13 | Updated: 2026-02-13 -->
3
+
4
+ # src
5
+
6
+ ## Purpose
7
+ TypeScript source code for the `react-native-nitro-cookies` npm package. Contains the public API, Nitro HybridObject interface contract, type definitions, and tests. This is the entry point consumers import from.
8
+
9
+ ## Key Files
10
+
11
+ | File | Description |
12
+ |------|-------------|
13
+ | `index.tsx` | Public API -- exports `NitroCookies` object wrapping the HybridObject with sync/async methods; converts Cookie arrays to Record dictionaries |
14
+ | `NitroCookies.nitro.ts` | Nitro HybridObject interface -- the **contract** that drives Nitrogen code generation for C++/Swift/Kotlin bridges |
15
+ | `types.ts` | Type definitions: `Cookie` interface (RFC 6265), `Cookies` type alias, `CookieErrorCode` enum, `CookieError` interface |
16
+
17
+ ## Subdirectories
18
+
19
+ | Directory | Purpose |
20
+ |-----------|---------|
21
+ | `__tests__/` | Jest test suite (currently placeholder) |
22
+
23
+ ## For AI Agents
24
+
25
+ ### Working In This Directory
26
+ - `NitroCookies.nitro.ts` is the **single source of truth** for the native interface. Changing it requires running `yarn nitrogen` to regenerate all C++/Swift/Kotlin bridge code
27
+ - `index.tsx` is the **public API layer** that wraps the raw HybridObject. It converts `Cookie[]` arrays from native into `Cookies` (Record) dictionaries for backward compatibility with `@react-native-cookies/cookies`
28
+ - `types.ts` defines types used both by the public API and the Nitro interface
29
+ - The `useWebKit` parameter defaults to `false` in the public API (via `?? false`); the Nitro interface uses `optional<bool>`
30
+
31
+ ### Testing Requirements
32
+ - Run `yarn test` to execute Jest tests
33
+ - The test suite is currently a placeholder -- add real unit tests when modifying the TypeScript API
34
+ - Platform-specific behavior must be tested in the `example/` app on real devices/simulators
35
+
36
+ ### Common Patterns
37
+ - Sync methods: direct JSI calls returning values immediately (no Promise)
38
+ - Async methods: return `Promise` from the HybridObject, public API wraps with `async`
39
+ - Cookie conversion: `cookiesToDictionary()` helper converts `Cookie[]` to `Record<string, Cookie>`
40
+ - Default exports: both named (`NitroCookies`) and default export for consumer flexibility
41
+
42
+ ## Dependencies
43
+
44
+ ### Internal
45
+ - `react-native-nitro-modules` -- `NitroModules.createHybridObject`, `HybridObject` types
46
+
47
+ ### External
48
+ - `react-native-nitro-modules` ^0.31.4
49
+
50
+ <!-- MANUAL: Any manually added notes below this line are preserved on regeneration -->
@@ -2,7 +2,7 @@
2
2
  /// JCookie.hpp
3
3
  /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
4
4
  /// https://github.com/mrousavy/nitro
5
- /// Copyright © 2025 Marc Rousavy @ Margelo
5
+ /// Copyright © 2026 Marc Rousavy @ Margelo
6
6
  ///
7
7
 
8
8
  #pragma once
@@ -2,7 +2,7 @@
2
2
  /// JHybridNitroCookiesSpec.cpp
3
3
  /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
4
4
  /// https://github.com/mrousavy/nitro
5
- /// Copyright © 2025 Marc Rousavy @ Margelo
5
+ /// Copyright © 2026 Marc Rousavy @ Margelo
6
6
  ///
7
7
 
8
8
  #include "JHybridNitroCookiesSpec.hpp"
@@ -2,7 +2,7 @@
2
2
  /// HybridNitroCookiesSpec.hpp
3
3
  /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
4
4
  /// https://github.com/mrousavy/nitro
5
- /// Copyright © 2025 Marc Rousavy @ Margelo
5
+ /// Copyright © 2026 Marc Rousavy @ Margelo
6
6
  ///
7
7
 
8
8
  #pragma once
@@ -2,7 +2,7 @@
2
2
  /// Cookie.kt
3
3
  /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
4
4
  /// https://github.com/mrousavy/nitro
5
- /// Copyright © 2025 Marc Rousavy @ Margelo
5
+ /// Copyright © 2026 Marc Rousavy @ Margelo
6
6
  ///
7
7
 
8
8
  package com.margelo.nitro.nitrocookies
@@ -2,7 +2,7 @@
2
2
  /// HybridNitroCookiesSpec.kt
3
3
  /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
4
4
  /// https://github.com/mrousavy/nitro
5
- /// Copyright © 2025 Marc Rousavy @ Margelo
5
+ /// Copyright © 2026 Marc Rousavy @ Margelo
6
6
  ///
7
7
 
8
8
  package com.margelo.nitro.nitrocookies
@@ -2,7 +2,7 @@
2
2
  /// nitrocookiesOnLoad.kt
3
3
  /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
4
4
  /// https://github.com/mrousavy/nitro
5
- /// Copyright © 2025 Marc Rousavy @ Margelo
5
+ /// Copyright © 2026 Marc Rousavy @ Margelo
6
6
  ///
7
7
 
8
8
  package com.margelo.nitro.nitrocookies
@@ -2,7 +2,7 @@
2
2
  # nitrocookies+autolinking.cmake
3
3
  # This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
4
4
  # https://github.com/mrousavy/nitro
5
- # Copyright © 2025 Marc Rousavy @ Margelo
5
+ # Copyright © 2026 Marc Rousavy @ Margelo
6
6
  #
7
7
 
8
8
  # This is a CMake file that adds all files generated by Nitrogen
@@ -2,7 +2,7 @@
2
2
  /// nitrocookies+autolinking.gradle
3
3
  /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
4
4
  /// https://github.com/mrousavy/nitro
5
- /// Copyright © 2025 Marc Rousavy @ Margelo
5
+ /// Copyright © 2026 Marc Rousavy @ Margelo
6
6
  ///
7
7
 
8
8
  /// This is a Gradle file that adds all files generated by Nitrogen
@@ -2,7 +2,7 @@
2
2
  /// nitrocookiesOnLoad.cpp
3
3
  /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
4
4
  /// https://github.com/mrousavy/nitro
5
- /// Copyright © 2025 Marc Rousavy @ Margelo
5
+ /// Copyright © 2026 Marc Rousavy @ Margelo
6
6
  ///
7
7
 
8
8
  #ifndef BUILDING_NITROCOOKIES_WITH_GENERATED_CMAKE_PROJECT
@@ -2,7 +2,7 @@
2
2
  /// nitrocookiesOnLoad.hpp
3
3
  /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
4
4
  /// https://github.com/mrousavy/nitro
5
- /// Copyright © 2025 Marc Rousavy @ Margelo
5
+ /// Copyright © 2026 Marc Rousavy @ Margelo
6
6
  ///
7
7
 
8
8
  #include <jni.h>
@@ -2,7 +2,7 @@
2
2
  # NitroCookies+autolinking.rb
3
3
  # This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
4
4
  # https://github.com/mrousavy/nitro
5
- # Copyright © 2025 Marc Rousavy @ Margelo
5
+ # Copyright © 2026 Marc Rousavy @ Margelo
6
6
  #
7
7
 
8
8
  # This is a Ruby script that adds all files generated by Nitrogen
@@ -2,7 +2,7 @@
2
2
  /// NitroCookies-Swift-Cxx-Bridge.cpp
3
3
  /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
4
4
  /// https://github.com/mrousavy/nitro
5
- /// Copyright © 2025 Marc Rousavy @ Margelo
5
+ /// Copyright © 2026 Marc Rousavy @ Margelo
6
6
  ///
7
7
 
8
8
  #include "NitroCookies-Swift-Cxx-Bridge.hpp"
@@ -2,7 +2,7 @@
2
2
  /// NitroCookies-Swift-Cxx-Bridge.hpp
3
3
  /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
4
4
  /// https://github.com/mrousavy/nitro
5
- /// Copyright © 2025 Marc Rousavy @ Margelo
5
+ /// Copyright © 2026 Marc Rousavy @ Margelo
6
6
  ///
7
7
 
8
8
  #pragma once
@@ -2,7 +2,7 @@
2
2
  /// NitroCookies-Swift-Cxx-Umbrella.hpp
3
3
  /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
4
4
  /// https://github.com/mrousavy/nitro
5
- /// Copyright © 2025 Marc Rousavy @ Margelo
5
+ /// Copyright © 2026 Marc Rousavy @ Margelo
6
6
  ///
7
7
 
8
8
  #pragma once
@@ -2,7 +2,7 @@
2
2
  /// NitroCookiesAutolinking.mm
3
3
  /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
4
4
  /// https://github.com/mrousavy/nitro
5
- /// Copyright © 2025 Marc Rousavy @ Margelo
5
+ /// Copyright © 2026 Marc Rousavy @ Margelo
6
6
  ///
7
7
 
8
8
  #import <Foundation/Foundation.h>
@@ -2,7 +2,7 @@
2
2
  /// NitroCookiesAutolinking.swift
3
3
  /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
4
4
  /// https://github.com/mrousavy/nitro
5
- /// Copyright © 2025 Marc Rousavy @ Margelo
5
+ /// Copyright © 2026 Marc Rousavy @ Margelo
6
6
  ///
7
7
 
8
8
  public final class NitroCookiesAutolinking {
@@ -2,7 +2,7 @@
2
2
  /// HybridNitroCookiesSpecSwift.cpp
3
3
  /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
4
4
  /// https://github.com/mrousavy/nitro
5
- /// Copyright © 2025 Marc Rousavy @ Margelo
5
+ /// Copyright © 2026 Marc Rousavy @ Margelo
6
6
  ///
7
7
 
8
8
  #include "HybridNitroCookiesSpecSwift.hpp"
@@ -2,7 +2,7 @@
2
2
  /// HybridNitroCookiesSpecSwift.hpp
3
3
  /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
4
4
  /// https://github.com/mrousavy/nitro
5
- /// Copyright © 2025 Marc Rousavy @ Margelo
5
+ /// Copyright © 2026 Marc Rousavy @ Margelo
6
6
  ///
7
7
 
8
8
  #pragma once
@@ -2,7 +2,7 @@
2
2
  /// Cookie.swift
3
3
  /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
4
4
  /// https://github.com/mrousavy/nitro
5
- /// Copyright © 2025 Marc Rousavy @ Margelo
5
+ /// Copyright © 2026 Marc Rousavy @ Margelo
6
6
  ///
7
7
 
8
8
  import NitroModules
@@ -2,7 +2,7 @@
2
2
  /// Func_void.swift
3
3
  /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
4
4
  /// https://github.com/mrousavy/nitro
5
- /// Copyright © 2025 Marc Rousavy @ Margelo
5
+ /// Copyright © 2026 Marc Rousavy @ Margelo
6
6
  ///
7
7
 
8
8
  import NitroModules
@@ -2,7 +2,7 @@
2
2
  /// Func_void_bool.swift
3
3
  /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
4
4
  /// https://github.com/mrousavy/nitro
5
- /// Copyright © 2025 Marc Rousavy @ Margelo
5
+ /// Copyright © 2026 Marc Rousavy @ Margelo
6
6
  ///
7
7
 
8
8
  import NitroModules
@@ -2,7 +2,7 @@
2
2
  /// Func_void_std__exception_ptr.swift
3
3
  /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
4
4
  /// https://github.com/mrousavy/nitro
5
- /// Copyright © 2025 Marc Rousavy @ Margelo
5
+ /// Copyright © 2026 Marc Rousavy @ Margelo
6
6
  ///
7
7
 
8
8
  import NitroModules
@@ -2,7 +2,7 @@
2
2
  /// Func_void_std__vector_Cookie_.swift
3
3
  /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
4
4
  /// https://github.com/mrousavy/nitro
5
- /// Copyright © 2025 Marc Rousavy @ Margelo
5
+ /// Copyright © 2026 Marc Rousavy @ Margelo
6
6
  ///
7
7
 
8
8
  import NitroModules
@@ -2,7 +2,7 @@
2
2
  /// HybridNitroCookiesSpec.swift
3
3
  /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
4
4
  /// https://github.com/mrousavy/nitro
5
- /// Copyright © 2025 Marc Rousavy @ Margelo
5
+ /// Copyright © 2026 Marc Rousavy @ Margelo
6
6
  ///
7
7
 
8
8
  import Foundation
@@ -2,7 +2,7 @@
2
2
  /// HybridNitroCookiesSpec_cxx.swift
3
3
  /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
4
4
  /// https://github.com/mrousavy/nitro
5
- /// Copyright © 2025 Marc Rousavy @ Margelo
5
+ /// Copyright © 2026 Marc Rousavy @ Margelo
6
6
  ///
7
7
 
8
8
  import Foundation
@@ -2,7 +2,7 @@
2
2
  /// Cookie.hpp
3
3
  /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
4
4
  /// https://github.com/mrousavy/nitro
5
- /// Copyright © 2025 Marc Rousavy @ Margelo
5
+ /// Copyright © 2026 Marc Rousavy @ Margelo
6
6
  ///
7
7
 
8
8
  #pragma once
@@ -2,7 +2,7 @@
2
2
  /// HybridNitroCookiesSpec.cpp
3
3
  /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
4
4
  /// https://github.com/mrousavy/nitro
5
- /// Copyright © 2025 Marc Rousavy @ Margelo
5
+ /// Copyright © 2026 Marc Rousavy @ Margelo
6
6
  ///
7
7
 
8
8
  #include "HybridNitroCookiesSpec.hpp"
@@ -2,7 +2,7 @@
2
2
  /// HybridNitroCookiesSpec.hpp
3
3
  /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
4
4
  /// https://github.com/mrousavy/nitro
5
- /// Copyright © 2025 Marc Rousavy @ Margelo
5
+ /// Copyright © 2026 Marc Rousavy @ Margelo
6
6
  ///
7
7
 
8
8
  #pragma once
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-native-nitro-cookies",
3
- "version": "1.0.0",
3
+ "version": "1.0.1",
4
4
  "description": "Fetch, Get Cookies 🍪 at the Speed of Nitro",
5
5
  "main": "./lib/module/index.js",
6
6
  "types": "./lib/typescript/src/index.d.ts",
package/src/AGENTS.md ADDED
@@ -0,0 +1,50 @@
1
+ <!-- Parent: ../AGENTS.md -->
2
+ <!-- Generated: 2026-02-13 | Updated: 2026-02-13 -->
3
+
4
+ # src
5
+
6
+ ## Purpose
7
+ TypeScript source code for the `react-native-nitro-cookies` npm package. Contains the public API, Nitro HybridObject interface contract, type definitions, and tests. This is the entry point consumers import from.
8
+
9
+ ## Key Files
10
+
11
+ | File | Description |
12
+ |------|-------------|
13
+ | `index.tsx` | Public API -- exports `NitroCookies` object wrapping the HybridObject with sync/async methods; converts Cookie arrays to Record dictionaries |
14
+ | `NitroCookies.nitro.ts` | Nitro HybridObject interface -- the **contract** that drives Nitrogen code generation for C++/Swift/Kotlin bridges |
15
+ | `types.ts` | Type definitions: `Cookie` interface (RFC 6265), `Cookies` type alias, `CookieErrorCode` enum, `CookieError` interface |
16
+
17
+ ## Subdirectories
18
+
19
+ | Directory | Purpose |
20
+ |-----------|---------|
21
+ | `__tests__/` | Jest test suite (currently placeholder) |
22
+
23
+ ## For AI Agents
24
+
25
+ ### Working In This Directory
26
+ - `NitroCookies.nitro.ts` is the **single source of truth** for the native interface. Changing it requires running `yarn nitrogen` to regenerate all C++/Swift/Kotlin bridge code
27
+ - `index.tsx` is the **public API layer** that wraps the raw HybridObject. It converts `Cookie[]` arrays from native into `Cookies` (Record) dictionaries for backward compatibility with `@react-native-cookies/cookies`
28
+ - `types.ts` defines types used both by the public API and the Nitro interface
29
+ - The `useWebKit` parameter defaults to `false` in the public API (via `?? false`); the Nitro interface uses `optional<bool>`
30
+
31
+ ### Testing Requirements
32
+ - Run `yarn test` to execute Jest tests
33
+ - The test suite is currently a placeholder -- add real unit tests when modifying the TypeScript API
34
+ - Platform-specific behavior must be tested in the `example/` app on real devices/simulators
35
+
36
+ ### Common Patterns
37
+ - Sync methods: direct JSI calls returning values immediately (no Promise)
38
+ - Async methods: return `Promise` from the HybridObject, public API wraps with `async`
39
+ - Cookie conversion: `cookiesToDictionary()` helper converts `Cookie[]` to `Record<string, Cookie>`
40
+ - Default exports: both named (`NitroCookies`) and default export for consumer flexibility
41
+
42
+ ## Dependencies
43
+
44
+ ### Internal
45
+ - `react-native-nitro-modules` -- `NitroModules.createHybridObject`, `HybridObject` types
46
+
47
+ ### External
48
+ - `react-native-nitro-modules` ^0.31.4
49
+
50
+ <!-- MANUAL: Any manually added notes below this line are preserved on regeneration -->