react-native-nitro-cookies 1.0.4 → 1.2.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.
- package/android/src/main/cpp/cpp-adapter.cpp +4 -1
- package/android/src/main/java/com/margelo/nitro/nitrocookies/NitroCookies.kt +69 -0
- package/ios/NitroCookies.swift +101 -0
- package/lib/module/index.js +96 -0
- package/lib/module/index.js.map +1 -1
- package/lib/typescript/src/NitroCookies.nitro.d.ts +48 -0
- package/lib/typescript/src/NitroCookies.nitro.d.ts.map +1 -1
- package/lib/typescript/src/index.d.ts +88 -0
- package/lib/typescript/src/index.d.ts.map +1 -1
- package/nitrogen/generated/android/c++/JCookie.hpp +1 -1
- package/nitrogen/generated/android/c++/JHybridNitroCookiesSpec.cpp +107 -53
- package/nitrogen/generated/android/c++/JHybridNitroCookiesSpec.hpp +23 -22
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitrocookies/Cookie.kt +27 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitrocookies/HybridNitroCookiesSpec.kt +31 -18
- package/nitrogen/generated/android/nitrocookiesOnLoad.cpp +26 -16
- package/nitrogen/generated/android/nitrocookiesOnLoad.hpp +13 -4
- package/nitrogen/generated/ios/NitroCookies+autolinking.rb +2 -0
- package/nitrogen/generated/ios/NitroCookies-Swift-Cxx-Bridge.cpp +8 -0
- package/nitrogen/generated/ios/NitroCookies-Swift-Cxx-Bridge.hpp +52 -0
- package/nitrogen/generated/ios/c++/HybridNitroCookiesSpecSwift.hpp +32 -0
- package/nitrogen/generated/ios/swift/Func_void_std__string.swift +46 -0
- package/nitrogen/generated/ios/swift/HybridNitroCookiesSpec.swift +4 -0
- package/nitrogen/generated/ios/swift/HybridNitroCookiesSpec_cxx.swift +76 -0
- package/nitrogen/generated/shared/c++/HybridNitroCookiesSpec.cpp +4 -0
- package/nitrogen/generated/shared/c++/HybridNitroCookiesSpec.hpp +4 -0
- package/package.json +9 -8
- package/src/NitroCookies.nitro.ts +56 -0
- package/src/index.tsx +104 -0
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
#include <jni.h>
|
|
2
|
+
#include <fbjni/fbjni.h>
|
|
2
3
|
#include "nitrocookiesOnLoad.hpp"
|
|
3
4
|
|
|
4
5
|
JNIEXPORT jint JNICALL JNI_OnLoad(JavaVM* vm, void*) {
|
|
5
|
-
return
|
|
6
|
+
return facebook::jni::initialize(vm, [=] {
|
|
7
|
+
margelo::nitro::nitrocookies::registerAllNatives();
|
|
8
|
+
});
|
|
6
9
|
}
|
|
@@ -268,6 +268,39 @@ class NitroCookies : HybridNitroCookiesSpec() {
|
|
|
268
268
|
return false
|
|
269
269
|
}
|
|
270
270
|
|
|
271
|
+
/**
|
|
272
|
+
* Get the Cookie request-header string synchronously for a URL.
|
|
273
|
+
*
|
|
274
|
+
* CookieManager.getCookie() already returns the value in the format of the
|
|
275
|
+
* 'Cookie' HTTP request header ("name1=value1; name2=value2"), so this is a
|
|
276
|
+
* near pass-through.
|
|
277
|
+
*/
|
|
278
|
+
override fun getCookieHeaderSync(url: String): String {
|
|
279
|
+
validateURL(url)
|
|
280
|
+
return CookieManager.getInstance().getCookie(url) ?: ""
|
|
281
|
+
}
|
|
282
|
+
|
|
283
|
+
/** Set multiple cookies synchronously */
|
|
284
|
+
override fun setManySync(url: String, cookies: Array<Cookie>): Boolean {
|
|
285
|
+
val urlObj = validateURL(url)
|
|
286
|
+
|
|
287
|
+
// Validate every cookie up front so a bad cookie doesn't leave a partial write
|
|
288
|
+
for (cookie in cookies) {
|
|
289
|
+
validateDomain(cookie, urlObj)
|
|
290
|
+
}
|
|
291
|
+
|
|
292
|
+
val cookieManager = CookieManager.getInstance()
|
|
293
|
+
cookieManager.setAcceptCookie(true)
|
|
294
|
+
|
|
295
|
+
for (cookie in cookies) {
|
|
296
|
+
val cookieWithDefaults =
|
|
297
|
+
cookie.copy(path = cookie.path ?: "/", domain = cookie.domain ?: urlObj.host)
|
|
298
|
+
cookieManager.setCookie(url, toRFC6265String(cookieWithDefaults))
|
|
299
|
+
}
|
|
300
|
+
|
|
301
|
+
return true
|
|
302
|
+
}
|
|
303
|
+
|
|
271
304
|
// MARK: - Asynchronous Cookie Operations
|
|
272
305
|
|
|
273
306
|
/** Set a single cookie */
|
|
@@ -290,6 +323,42 @@ class NitroCookies : HybridNitroCookiesSpec() {
|
|
|
290
323
|
}
|
|
291
324
|
}
|
|
292
325
|
|
|
326
|
+
/** Set multiple cookies for a URL */
|
|
327
|
+
override fun setMany(url: String, cookies: Array<Cookie>, useWebKit: Boolean?): Promise<Boolean> {
|
|
328
|
+
return Promise.async {
|
|
329
|
+
val urlObj = validateURL(url)
|
|
330
|
+
|
|
331
|
+
// Validate every cookie up front so a bad cookie doesn't leave a partial write
|
|
332
|
+
for (cookie in cookies) {
|
|
333
|
+
validateDomain(cookie, urlObj)
|
|
334
|
+
}
|
|
335
|
+
|
|
336
|
+
val cookieManager = CookieManager.getInstance()
|
|
337
|
+
cookieManager.setAcceptCookie(true)
|
|
338
|
+
|
|
339
|
+
for (cookie in cookies) {
|
|
340
|
+
val cookieWithDefaults =
|
|
341
|
+
cookie.copy(path = cookie.path ?: "/", domain = cookie.domain ?: urlObj.host)
|
|
342
|
+
cookieManager.setCookie(url, toRFC6265String(cookieWithDefaults))
|
|
343
|
+
}
|
|
344
|
+
|
|
345
|
+
true
|
|
346
|
+
}
|
|
347
|
+
}
|
|
348
|
+
|
|
349
|
+
/**
|
|
350
|
+
* Get the Cookie request-header string for a URL.
|
|
351
|
+
*
|
|
352
|
+
* CookieManager.getCookie() already returns the value in the format of the
|
|
353
|
+
* 'Cookie' HTTP request header, so this is a near pass-through.
|
|
354
|
+
*/
|
|
355
|
+
override fun getCookieHeader(url: String, useWebKit: Boolean?): Promise<String> {
|
|
356
|
+
return Promise.async {
|
|
357
|
+
validateURL(url)
|
|
358
|
+
CookieManager.getInstance().getCookie(url) ?: ""
|
|
359
|
+
}
|
|
360
|
+
}
|
|
361
|
+
|
|
293
362
|
/** Get all cookies for a URL */
|
|
294
363
|
override fun get(url: String, useWebKit: Boolean?): Promise<Array<Cookie>> {
|
|
295
364
|
return Promise.async {
|
package/ios/NitroCookies.swift
CHANGED
|
@@ -291,6 +291,40 @@ public class HybridNitroCookies: HybridNitroCookiesSpec {
|
|
|
291
291
|
}
|
|
292
292
|
}
|
|
293
293
|
|
|
294
|
+
/**
|
|
295
|
+
* Get the Cookie request-header string synchronously for a URL
|
|
296
|
+
* Uses NSHTTPCookieStorage only (WebKit not supported for sync operations)
|
|
297
|
+
*/
|
|
298
|
+
public func getCookieHeaderSync(url urlString: String) throws -> String {
|
|
299
|
+
let url = try validateURL(urlString)
|
|
300
|
+
let allCookies = HTTPCookieStorage.shared.cookies ?? []
|
|
301
|
+
let matched = allCookies.filter { cookie in
|
|
302
|
+
self.isMatchingDomain(cookieDomain: cookie.domain,
|
|
303
|
+
urlHost: url.host ?? "")
|
|
304
|
+
}
|
|
305
|
+
return HTTPCookie.requestHeaderFields(with: matched)["Cookie"] ?? ""
|
|
306
|
+
}
|
|
307
|
+
|
|
308
|
+
/**
|
|
309
|
+
* Set multiple cookies synchronously
|
|
310
|
+
* Uses NSHTTPCookieStorage only (WebKit not supported for sync operations)
|
|
311
|
+
*/
|
|
312
|
+
public func setManySync(url urlString: String, cookies: [Cookie]) throws -> Bool {
|
|
313
|
+
let url = try validateURL(urlString)
|
|
314
|
+
|
|
315
|
+
// Validate every cookie up front so a bad cookie doesn't leave a partial write
|
|
316
|
+
for cookie in cookies {
|
|
317
|
+
try validateDomain(cookie: cookie, url: url)
|
|
318
|
+
}
|
|
319
|
+
|
|
320
|
+
let storage = HTTPCookieStorage.shared
|
|
321
|
+
for cookie in cookies {
|
|
322
|
+
let httpCookie = try makeHTTPCookie(from: cookie, url: url)
|
|
323
|
+
storage.setCookie(httpCookie)
|
|
324
|
+
}
|
|
325
|
+
return true
|
|
326
|
+
}
|
|
327
|
+
|
|
294
328
|
// MARK: - Asynchronous Cookie Operations
|
|
295
329
|
|
|
296
330
|
/**
|
|
@@ -323,6 +357,73 @@ public class HybridNitroCookies: HybridNitroCookiesSpec {
|
|
|
323
357
|
}
|
|
324
358
|
}
|
|
325
359
|
|
|
360
|
+
/**
|
|
361
|
+
* Set multiple cookies for a URL
|
|
362
|
+
*/
|
|
363
|
+
public func setMany(url urlString: String, cookies: [Cookie], useWebKit: Bool?) throws -> Promise<Bool> {
|
|
364
|
+
return Promise.async {
|
|
365
|
+
let url = try self.validateURL(urlString)
|
|
366
|
+
|
|
367
|
+
// Validate every cookie up front so a bad cookie doesn't leave a partial write
|
|
368
|
+
for cookie in cookies {
|
|
369
|
+
try self.validateDomain(cookie: cookie, url: url)
|
|
370
|
+
}
|
|
371
|
+
|
|
372
|
+
let httpCookies = try cookies.map { try self.makeHTTPCookie(from: $0, url: url) }
|
|
373
|
+
|
|
374
|
+
if useWebKit == true {
|
|
375
|
+
if #available(iOS 11.0, *) {
|
|
376
|
+
for httpCookie in httpCookies {
|
|
377
|
+
await self.withWebKitStoreVoid { store, done in
|
|
378
|
+
store.setCookie(httpCookie) { done() }
|
|
379
|
+
}
|
|
380
|
+
}
|
|
381
|
+
return true
|
|
382
|
+
} else {
|
|
383
|
+
throw NSError(domain: "WEBKIT_UNAVAILABLE", code: 3,
|
|
384
|
+
userInfo: [NSLocalizedDescriptionKey:
|
|
385
|
+
"WebKit requires iOS 11 or higher"])
|
|
386
|
+
}
|
|
387
|
+
} else {
|
|
388
|
+
let storage = HTTPCookieStorage.shared
|
|
389
|
+
for httpCookie in httpCookies {
|
|
390
|
+
storage.setCookie(httpCookie)
|
|
391
|
+
}
|
|
392
|
+
return true
|
|
393
|
+
}
|
|
394
|
+
}
|
|
395
|
+
}
|
|
396
|
+
|
|
397
|
+
/**
|
|
398
|
+
* Get the Cookie request-header string for a URL
|
|
399
|
+
*/
|
|
400
|
+
public func getCookieHeader(url urlString: String, useWebKit: Bool?) throws -> Promise<String> {
|
|
401
|
+
return Promise.async {
|
|
402
|
+
let url = try self.validateURL(urlString)
|
|
403
|
+
|
|
404
|
+
let httpCookies: [HTTPCookie]
|
|
405
|
+
if useWebKit == true {
|
|
406
|
+
if #available(iOS 11.0, *) {
|
|
407
|
+
httpCookies = await self.withWebKitStore { store, done in
|
|
408
|
+
store.getAllCookies { cookies in done(cookies) }
|
|
409
|
+
}
|
|
410
|
+
} else {
|
|
411
|
+
throw NSError(domain: "WEBKIT_UNAVAILABLE", code: 3,
|
|
412
|
+
userInfo: [NSLocalizedDescriptionKey:
|
|
413
|
+
"WebKit requires iOS 11 or higher"])
|
|
414
|
+
}
|
|
415
|
+
} else {
|
|
416
|
+
httpCookies = HTTPCookieStorage.shared.cookies ?? []
|
|
417
|
+
}
|
|
418
|
+
|
|
419
|
+
let matched = httpCookies.filter { cookie in
|
|
420
|
+
self.isMatchingDomain(cookieDomain: cookie.domain,
|
|
421
|
+
urlHost: url.host ?? "")
|
|
422
|
+
}
|
|
423
|
+
return HTTPCookie.requestHeaderFields(with: matched)["Cookie"] ?? ""
|
|
424
|
+
}
|
|
425
|
+
}
|
|
426
|
+
|
|
326
427
|
/**
|
|
327
428
|
* Get all cookies for a URL
|
|
328
429
|
*/
|
package/lib/module/index.js
CHANGED
|
@@ -116,6 +116,51 @@ export const NitroCookies = {
|
|
|
116
116
|
clearByNameSync(url, name) {
|
|
117
117
|
return NitroCookiesHybridObject.clearByNameSync(url, name);
|
|
118
118
|
},
|
|
119
|
+
/**
|
|
120
|
+
* Get the `Cookie` request-header string for a URL synchronously.
|
|
121
|
+
*
|
|
122
|
+
* Returns the value you would put in an HTTP `Cookie` request header
|
|
123
|
+
* (e.g. `"name1=value1; name2=value2"`), built from every cookie that
|
|
124
|
+
* matches the URL. Handy for attaching cookies to a manual `fetch` or
|
|
125
|
+
* `XMLHttpRequest`. Returns an empty string when no cookies match.
|
|
126
|
+
*
|
|
127
|
+
* @param url - The URL to match cookies against (must include protocol)
|
|
128
|
+
* @returns The Cookie header string, or "" when no cookies match
|
|
129
|
+
* @throws {Error} INVALID_URL - URL is malformed or missing protocol
|
|
130
|
+
*
|
|
131
|
+
* @example
|
|
132
|
+
* ```typescript
|
|
133
|
+
* const header = NitroCookies.getCookieHeaderSync('https://example.com');
|
|
134
|
+
* await fetch('https://example.com/api', { headers: { Cookie: header } });
|
|
135
|
+
* ```
|
|
136
|
+
*/
|
|
137
|
+
getCookieHeaderSync(url) {
|
|
138
|
+
return NitroCookiesHybridObject.getCookieHeaderSync(url);
|
|
139
|
+
},
|
|
140
|
+
/**
|
|
141
|
+
* Set multiple cookies for a URL synchronously.
|
|
142
|
+
*
|
|
143
|
+
* Applies the same domain validation as `setSync` to every cookie. If any
|
|
144
|
+
* cookie's domain doesn't match the URL host, the whole call throws and no
|
|
145
|
+
* cookies are written.
|
|
146
|
+
*
|
|
147
|
+
* @param url - The URL for which to set the cookies (must include protocol)
|
|
148
|
+
* @param cookies - The cookie objects to store
|
|
149
|
+
* @returns true on success
|
|
150
|
+
* @throws {Error} INVALID_URL - URL is malformed or missing protocol
|
|
151
|
+
* @throws {Error} DOMAIN_MISMATCH - A cookie's domain doesn't match URL host
|
|
152
|
+
*
|
|
153
|
+
* @example
|
|
154
|
+
* ```typescript
|
|
155
|
+
* NitroCookies.setManySync('https://example.com', [
|
|
156
|
+
* { name: 'session', value: 'abc123' },
|
|
157
|
+
* { name: 'theme', value: 'dark' },
|
|
158
|
+
* ]);
|
|
159
|
+
* ```
|
|
160
|
+
*/
|
|
161
|
+
setManySync(url, cookies) {
|
|
162
|
+
return NitroCookiesHybridObject.setManySync(url, cookies);
|
|
163
|
+
},
|
|
119
164
|
// ========================================
|
|
120
165
|
// ASYNCHRONOUS METHODS
|
|
121
166
|
// ========================================
|
|
@@ -156,6 +201,57 @@ export const NitroCookies = {
|
|
|
156
201
|
async set(url, cookie, useWebKit) {
|
|
157
202
|
return NitroCookiesHybridObject.set(url, cookie, useWebKit ?? false);
|
|
158
203
|
},
|
|
204
|
+
/**
|
|
205
|
+
* Set multiple cookies for a URL.
|
|
206
|
+
*
|
|
207
|
+
* Applies the same domain validation as `set` to every cookie. If any
|
|
208
|
+
* cookie's domain doesn't match the URL host, the whole call rejects and no
|
|
209
|
+
* cookies are written.
|
|
210
|
+
*
|
|
211
|
+
* @param url - The URL for which to set the cookies. Must include protocol.
|
|
212
|
+
* @param cookies - The cookie objects to store
|
|
213
|
+
* @param useWebKit - (iOS only) If true, use WKHTTPCookieStore instead of NSHTTPCookieStorage. Requires iOS 11+.
|
|
214
|
+
*
|
|
215
|
+
* @returns Promise that resolves to true on success
|
|
216
|
+
*
|
|
217
|
+
* @throws {Error} INVALID_URL - URL is malformed or missing protocol
|
|
218
|
+
* @throws {Error} DOMAIN_MISMATCH - A cookie's domain doesn't match URL host
|
|
219
|
+
* @throws {Error} WEBKIT_UNAVAILABLE - useWebKit=true on iOS < 11
|
|
220
|
+
*
|
|
221
|
+
* @example
|
|
222
|
+
* ```typescript
|
|
223
|
+
* await NitroCookies.setMany('https://example.com', [
|
|
224
|
+
* { name: 'session', value: 'abc123', secure: true },
|
|
225
|
+
* { name: 'theme', value: 'dark' },
|
|
226
|
+
* ]);
|
|
227
|
+
* ```
|
|
228
|
+
*/
|
|
229
|
+
async setMany(url, cookies, useWebKit) {
|
|
230
|
+
return NitroCookiesHybridObject.setMany(url, cookies, useWebKit ?? false);
|
|
231
|
+
},
|
|
232
|
+
/**
|
|
233
|
+
* Get the `Cookie` request-header string for a URL.
|
|
234
|
+
*
|
|
235
|
+
* Returns the value you would put in an HTTP `Cookie` request header
|
|
236
|
+
* (e.g. `"name1=value1; name2=value2"`), built from every cookie that
|
|
237
|
+
* matches the URL. Returns an empty string when no cookies match.
|
|
238
|
+
*
|
|
239
|
+
* @param url - The URL to match cookies against. Must include protocol.
|
|
240
|
+
* @param useWebKit - (iOS only) If true, read from WKHTTPCookieStore instead of NSHTTPCookieStorage
|
|
241
|
+
*
|
|
242
|
+
* @returns Promise that resolves to the Cookie header string, or "" when no cookies match
|
|
243
|
+
*
|
|
244
|
+
* @throws {Error} INVALID_URL - URL is malformed or missing protocol
|
|
245
|
+
*
|
|
246
|
+
* @example
|
|
247
|
+
* ```typescript
|
|
248
|
+
* const header = await NitroCookies.getCookieHeader('https://example.com');
|
|
249
|
+
* await fetch('https://example.com/api', { headers: { Cookie: header } });
|
|
250
|
+
* ```
|
|
251
|
+
*/
|
|
252
|
+
async getCookieHeader(url, useWebKit) {
|
|
253
|
+
return NitroCookiesHybridObject.getCookieHeader(url, useWebKit ?? false);
|
|
254
|
+
},
|
|
159
255
|
/**
|
|
160
256
|
* Get all cookies matching a specific URL's domain.
|
|
161
257
|
*
|
package/lib/module/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["NitroModules","NitroCookiesHybridObject","createHybridObject","cookiesToDictionary","cookies","result","cookie","name","NitroCookies","getSync","url","setSync","setFromResponseSync","value","clearByNameSync","set","useWebKit","get","clearAll","setFromResponse","getFromResponse","getAll","clearByName","flush","removeSessionCookies"],"sourceRoot":"../../src","sources":["index.tsx"],"mappings":";;AAAA,SAASA,YAAY,QAAQ,4BAA4B;AAIzD,MAAMC,wBAAwB,GAC5BD,YAAY,CAACE,kBAAkB,CAAmB,cAAc,CAAC;AAEnE,SAASC,mBAAmBA,CAACC,OAAiB,EAAW;EACvD,MAAMC,MAAe,GAAG,CAAC,CAAC;EAC1B,KAAK,MAAMC,MAAM,IAAIF,OAAO,EAAE;IAC5BC,MAAM,CAACC,MAAM,CAACC,IAAI,CAAC,GAAGD,MAAM;EAC9B;EACA,OAAOD,MAAM;AACf;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMG,YAAY,GAAG;EAC1B;EACA;EACA;;EAEA;AACF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;EACEC,OAAOA,CAACC,GAAW,EAAW;IAC5B,OAAOP,mBAAmB,CAACF,wBAAwB,CAACQ,OAAO,CAACC,GAAG,CAAC,CAAC;EACnE,CAAC;EAED;AACF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;EACEC,OAAOA,CAACD,GAAW,EAAEJ,MAAc,EAAW;IAC5C,OAAOL,wBAAwB,CAACU,OAAO,CAACD,GAAG,EAAEJ,MAAM,CAAC;EACtD,CAAC;EAED;AACF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;EACEM,mBAAmBA,CAACF,GAAW,EAAEG,KAAa,EAAW;IACvD,OAAOZ,wBAAwB,CAACW,mBAAmB,CAACF,GAAG,EAAEG,KAAK,CAAC;EACjE,CAAC;EAED;AACF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;EACEC,eAAeA,CAACJ,GAAW,EAAEH,IAAY,EAAW;IAClD,OAAON,wBAAwB,CAACa,eAAe,CAACJ,GAAG,EAAEH,IAAI,CAAC;EAC5D,CAAC;EAED;EACA;EACA;EACA;AACF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;EACE,
|
|
1
|
+
{"version":3,"names":["NitroModules","NitroCookiesHybridObject","createHybridObject","cookiesToDictionary","cookies","result","cookie","name","NitroCookies","getSync","url","setSync","setFromResponseSync","value","clearByNameSync","getCookieHeaderSync","setManySync","set","useWebKit","setMany","getCookieHeader","get","clearAll","setFromResponse","getFromResponse","getAll","clearByName","flush","removeSessionCookies"],"sourceRoot":"../../src","sources":["index.tsx"],"mappings":";;AAAA,SAASA,YAAY,QAAQ,4BAA4B;AAIzD,MAAMC,wBAAwB,GAC5BD,YAAY,CAACE,kBAAkB,CAAmB,cAAc,CAAC;AAEnE,SAASC,mBAAmBA,CAACC,OAAiB,EAAW;EACvD,MAAMC,MAAe,GAAG,CAAC,CAAC;EAC1B,KAAK,MAAMC,MAAM,IAAIF,OAAO,EAAE;IAC5BC,MAAM,CAACC,MAAM,CAACC,IAAI,CAAC,GAAGD,MAAM;EAC9B;EACA,OAAOD,MAAM;AACf;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMG,YAAY,GAAG;EAC1B;EACA;EACA;;EAEA;AACF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;EACEC,OAAOA,CAACC,GAAW,EAAW;IAC5B,OAAOP,mBAAmB,CAACF,wBAAwB,CAACQ,OAAO,CAACC,GAAG,CAAC,CAAC;EACnE,CAAC;EAED;AACF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;EACEC,OAAOA,CAACD,GAAW,EAAEJ,MAAc,EAAW;IAC5C,OAAOL,wBAAwB,CAACU,OAAO,CAACD,GAAG,EAAEJ,MAAM,CAAC;EACtD,CAAC;EAED;AACF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;EACEM,mBAAmBA,CAACF,GAAW,EAAEG,KAAa,EAAW;IACvD,OAAOZ,wBAAwB,CAACW,mBAAmB,CAACF,GAAG,EAAEG,KAAK,CAAC;EACjE,CAAC;EAED;AACF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;EACEC,eAAeA,CAACJ,GAAW,EAAEH,IAAY,EAAW;IAClD,OAAON,wBAAwB,CAACa,eAAe,CAACJ,GAAG,EAAEH,IAAI,CAAC;EAC5D,CAAC;EAED;AACF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;EACEQ,mBAAmBA,CAACL,GAAW,EAAU;IACvC,OAAOT,wBAAwB,CAACc,mBAAmB,CAACL,GAAG,CAAC;EAC1D,CAAC;EAED;AACF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;EACEM,WAAWA,CAACN,GAAW,EAAEN,OAAiB,EAAW;IACnD,OAAOH,wBAAwB,CAACe,WAAW,CAACN,GAAG,EAAEN,OAAO,CAAC;EAC3D,CAAC;EAED;EACA;EACA;EACA;AACF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;EACE,MAAMa,GAAGA,CACPP,GAAW,EACXJ,MAAc,EACdY,SAAmB,EACD;IAClB,OAAOjB,wBAAwB,CAACgB,GAAG,CAACP,GAAG,EAAEJ,MAAM,EAAEY,SAAS,IAAI,KAAK,CAAC;EACtE,CAAC;EAED;AACF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;EACE,MAAMC,OAAOA,CACXT,GAAW,EACXN,OAAiB,EACjBc,SAAmB,EACD;IAClB,OAAOjB,wBAAwB,CAACkB,OAAO,CAACT,GAAG,EAAEN,OAAO,EAAEc,SAAS,IAAI,KAAK,CAAC;EAC3E,CAAC;EAED;AACF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;EACE,MAAME,eAAeA,CAACV,GAAW,EAAEQ,SAAmB,EAAmB;IACvE,OAAOjB,wBAAwB,CAACmB,eAAe,CAACV,GAAG,EAAEQ,SAAS,IAAI,KAAK,CAAC;EAC1E,CAAC;EAED;AACF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;EACE,MAAMG,GAAGA,CAACX,GAAW,EAAEQ,SAAmB,EAAoB;IAC5D,MAAMd,OAAO,GAAG,MAAMH,wBAAwB,CAACoB,GAAG,CAACX,GAAG,EAAEQ,SAAS,IAAI,KAAK,CAAC;IAC3E,OAAOf,mBAAmB,CAACC,OAAO,CAAC;EACrC,CAAC;EAED;AACF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;EACE,MAAMkB,QAAQA,CAACJ,SAAmB,EAAoB;IACpD,OAAOjB,wBAAwB,CAACqB,QAAQ,CAACJ,SAAS,IAAI,KAAK,CAAC;EAC9D,CAAC;EAED;AACF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;EACE,MAAMK,eAAeA,CAACb,GAAW,EAAEG,KAAa,EAAoB;IAClE,OAAOZ,wBAAwB,CAACsB,eAAe,CAACb,GAAG,EAAEG,KAAK,CAAC;EAC7D,CAAC;EAED;AACF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;EACE,MAAMW,eAAeA,CAACd,GAAW,EAAoB;IACnD,MAAMN,OAAO,GAAG,MAAMH,wBAAwB,CAACuB,eAAe,CAACd,GAAG,CAAC;IACnE,OAAOP,mBAAmB,CAACC,OAAO,CAAC;EACrC,CAAC;EAED;AACF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;EACE,MAAMqB,MAAMA,CAACP,SAAmB,EAAoB;IAClD,MAAMd,OAAO,GAAG,MAAMH,wBAAwB,CAACwB,MAAM,CAACP,SAAS,IAAI,KAAK,CAAC;IACzE,OAAOf,mBAAmB,CAACC,OAAO,CAAC;EACrC,CAAC;EAED;AACF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;EACE,MAAMsB,WAAWA,CACfhB,GAAW,EACXH,IAAY,EACZW,SAAmB,EACD;IAClB,OAAOjB,wBAAwB,CAACyB,WAAW,CAAChB,GAAG,EAAEH,IAAI,EAAEW,SAAS,IAAI,KAAK,CAAC;EAC5E,CAAC;EAED;AACF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;EACE,MAAMS,KAAKA,CAAA,EAAkB;IAC3B,OAAO1B,wBAAwB,CAAC0B,KAAK,CAAC,CAAC;EACzC,CAAC;EAED;AACF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;EACE,MAAMC,oBAAoBA,CAAA,EAAqB;IAC7C,OAAO3B,wBAAwB,CAAC2B,oBAAoB,CAAC,CAAC;EACxD;AACF,CAAC;;AAED;;AAGA;AACA,eAAepB,YAAY","ignoreList":[]}
|
|
@@ -62,6 +62,31 @@ export interface NitroCookies extends HybridObject<{
|
|
|
62
62
|
* @throws Error if URL is invalid
|
|
63
63
|
*/
|
|
64
64
|
clearByNameSync(url: string, name: string): boolean;
|
|
65
|
+
/**
|
|
66
|
+
* Get the `Cookie` request-header string for a URL synchronously
|
|
67
|
+
*
|
|
68
|
+
* Returns the value you would put in an HTTP `Cookie` request header
|
|
69
|
+
* (e.g. "name1=value1; name2=value2"), built from every cookie that
|
|
70
|
+
* matches the URL. Use this to attach cookies to a manual `fetch`/
|
|
71
|
+
* `XMLHttpRequest`. Uses NSHTTPCookieStorage (iOS) or CookieManager (Android).
|
|
72
|
+
*
|
|
73
|
+
* @param url - The URL to match cookies against (must include protocol)
|
|
74
|
+
* @returns The Cookie header string, or "" when no cookies match
|
|
75
|
+
* @throws Error if URL is invalid
|
|
76
|
+
*/
|
|
77
|
+
getCookieHeaderSync(url: string): string;
|
|
78
|
+
/**
|
|
79
|
+
* Set multiple cookies for a URL synchronously
|
|
80
|
+
*
|
|
81
|
+
* Applies the same domain validation as `setSync` to every cookie.
|
|
82
|
+
* Uses NSHTTPCookieStorage (iOS) or CookieManager (Android).
|
|
83
|
+
*
|
|
84
|
+
* @param url - The URL for which to set the cookies (must include protocol)
|
|
85
|
+
* @param cookies - The cookie objects to store
|
|
86
|
+
* @returns true on success
|
|
87
|
+
* @throws Error if URL is invalid or any cookie's domain mismatches
|
|
88
|
+
*/
|
|
89
|
+
setManySync(url: string, cookies: Cookie[]): boolean;
|
|
65
90
|
/**
|
|
66
91
|
* Set a single cookie for a specific URL
|
|
67
92
|
*
|
|
@@ -71,6 +96,29 @@ export interface NitroCookies extends HybridObject<{
|
|
|
71
96
|
* @returns Promise that resolves to true on success
|
|
72
97
|
*/
|
|
73
98
|
set(url: string, cookie: Cookie, useWebKit?: boolean): Promise<boolean>;
|
|
99
|
+
/**
|
|
100
|
+
* Set multiple cookies for a URL
|
|
101
|
+
*
|
|
102
|
+
* Applies the same domain validation as `set` to every cookie.
|
|
103
|
+
*
|
|
104
|
+
* @param url - The URL for which to set the cookies (must include protocol)
|
|
105
|
+
* @param cookies - The cookie objects to store
|
|
106
|
+
* @param useWebKit - (iOS only) If true, use WKHTTPCookieStore instead of NSHTTPCookieStorage (requires iOS 11+)
|
|
107
|
+
* @returns Promise that resolves to true on success
|
|
108
|
+
*/
|
|
109
|
+
setMany(url: string, cookies: Cookie[], useWebKit?: boolean): Promise<boolean>;
|
|
110
|
+
/**
|
|
111
|
+
* Get the `Cookie` request-header string for a URL
|
|
112
|
+
*
|
|
113
|
+
* Returns the value you would put in an HTTP `Cookie` request header
|
|
114
|
+
* (e.g. "name1=value1; name2=value2"), built from every cookie that
|
|
115
|
+
* matches the URL.
|
|
116
|
+
*
|
|
117
|
+
* @param url - The URL to match cookies against (must include protocol)
|
|
118
|
+
* @param useWebKit - (iOS only) If true, read from WKHTTPCookieStore instead of NSHTTPCookieStorage
|
|
119
|
+
* @returns Promise that resolves to the Cookie header string, or "" when no cookies match
|
|
120
|
+
*/
|
|
121
|
+
getCookieHeader(url: string, useWebKit?: boolean): Promise<string>;
|
|
74
122
|
/**
|
|
75
123
|
* Get all cookies matching a specific URL's domain
|
|
76
124
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"NitroCookies.nitro.d.ts","sourceRoot":"","sources":["../../../src/NitroCookies.nitro.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAC/D,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC;AAKtC;;;;;;;;;;GAUG;AACH,MAAM,WAAW,YAAa,SAAQ,YAAY,CAAC;IACjD,GAAG,EAAE,OAAO,CAAC;IACb,OAAO,EAAE,QAAQ,CAAC;CACnB,CAAC;IAKA;;;;;;;;;OASG;IACH,OAAO,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC;IAE/B;;;;;;;;;;OAUG;IACH,OAAO,CAAC,GAAG,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC;IAE9C;;;;;;;OAOG;IACH,mBAAmB,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC;IAEzD;;;;;;;OAOG;IACH,eAAe,CAAC,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"NitroCookies.nitro.d.ts","sourceRoot":"","sources":["../../../src/NitroCookies.nitro.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAC/D,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC;AAKtC;;;;;;;;;;GAUG;AACH,MAAM,WAAW,YAAa,SAAQ,YAAY,CAAC;IACjD,GAAG,EAAE,OAAO,CAAC;IACb,OAAO,EAAE,QAAQ,CAAC;CACnB,CAAC;IAKA;;;;;;;;;OASG;IACH,OAAO,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC;IAE/B;;;;;;;;;;OAUG;IACH,OAAO,CAAC,GAAG,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC;IAE9C;;;;;;;OAOG;IACH,mBAAmB,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC;IAEzD;;;;;;;OAOG;IACH,eAAe,CAAC,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC;IAEpD;;;;;;;;;;;OAWG;IACH,mBAAmB,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAAC;IAEzC;;;;;;;;;;OAUG;IACH,WAAW,CAAC,GAAG,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC;IAMrD;;;;;;;OAOG;IACH,GAAG,CAAC,GAAG,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,SAAS,CAAC,EAAE,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;IAExE;;;;;;;;;OASG;IACH,OAAO,CACL,GAAG,EAAE,MAAM,EACX,OAAO,EAAE,MAAM,EAAE,EACjB,SAAS,CAAC,EAAE,OAAO,GAClB,OAAO,CAAC,OAAO,CAAC,CAAC;IAEpB;;;;;;;;;;OAUG;IACH,eAAe,CAAC,GAAG,EAAE,MAAM,EAAE,SAAS,CAAC,EAAE,OAAO,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;IAEnE;;;;;;OAMG;IACH,GAAG,CAAC,GAAG,EAAE,MAAM,EAAE,SAAS,CAAC,EAAE,OAAO,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC,CAAC;IAEzD;;;;;OAKG;IACH,QAAQ,CAAC,SAAS,CAAC,EAAE,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;IAEhD;;;;;;OAMG;IACH,eAAe,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;IAE9D;;;;;OAKG;IACH,eAAe,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC,CAAC;IAEhD;;;;;OAKG;IACH,MAAM,CAAC,SAAS,CAAC,EAAE,OAAO,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC,CAAC;IAE/C;;;;;;;OAOG;IACH,WAAW,CAAC,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,SAAS,CAAC,EAAE,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;IAE9E;;;;OAIG;IACH,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;IAEvB;;;;OAIG;IACH,oBAAoB,IAAI,OAAO,CAAC,OAAO,CAAC,CAAC;CAC1C"}
|
|
@@ -93,6 +93,47 @@ export declare const NitroCookies: {
|
|
|
93
93
|
* ```
|
|
94
94
|
*/
|
|
95
95
|
clearByNameSync(url: string, name: string): boolean;
|
|
96
|
+
/**
|
|
97
|
+
* Get the `Cookie` request-header string for a URL synchronously.
|
|
98
|
+
*
|
|
99
|
+
* Returns the value you would put in an HTTP `Cookie` request header
|
|
100
|
+
* (e.g. `"name1=value1; name2=value2"`), built from every cookie that
|
|
101
|
+
* matches the URL. Handy for attaching cookies to a manual `fetch` or
|
|
102
|
+
* `XMLHttpRequest`. Returns an empty string when no cookies match.
|
|
103
|
+
*
|
|
104
|
+
* @param url - The URL to match cookies against (must include protocol)
|
|
105
|
+
* @returns The Cookie header string, or "" when no cookies match
|
|
106
|
+
* @throws {Error} INVALID_URL - URL is malformed or missing protocol
|
|
107
|
+
*
|
|
108
|
+
* @example
|
|
109
|
+
* ```typescript
|
|
110
|
+
* const header = NitroCookies.getCookieHeaderSync('https://example.com');
|
|
111
|
+
* await fetch('https://example.com/api', { headers: { Cookie: header } });
|
|
112
|
+
* ```
|
|
113
|
+
*/
|
|
114
|
+
getCookieHeaderSync(url: string): string;
|
|
115
|
+
/**
|
|
116
|
+
* Set multiple cookies for a URL synchronously.
|
|
117
|
+
*
|
|
118
|
+
* Applies the same domain validation as `setSync` to every cookie. If any
|
|
119
|
+
* cookie's domain doesn't match the URL host, the whole call throws and no
|
|
120
|
+
* cookies are written.
|
|
121
|
+
*
|
|
122
|
+
* @param url - The URL for which to set the cookies (must include protocol)
|
|
123
|
+
* @param cookies - The cookie objects to store
|
|
124
|
+
* @returns true on success
|
|
125
|
+
* @throws {Error} INVALID_URL - URL is malformed or missing protocol
|
|
126
|
+
* @throws {Error} DOMAIN_MISMATCH - A cookie's domain doesn't match URL host
|
|
127
|
+
*
|
|
128
|
+
* @example
|
|
129
|
+
* ```typescript
|
|
130
|
+
* NitroCookies.setManySync('https://example.com', [
|
|
131
|
+
* { name: 'session', value: 'abc123' },
|
|
132
|
+
* { name: 'theme', value: 'dark' },
|
|
133
|
+
* ]);
|
|
134
|
+
* ```
|
|
135
|
+
*/
|
|
136
|
+
setManySync(url: string, cookies: Cookie[]): boolean;
|
|
96
137
|
/**
|
|
97
138
|
* Set a single cookie for a specific URL.
|
|
98
139
|
*
|
|
@@ -128,6 +169,53 @@ export declare const NitroCookies: {
|
|
|
128
169
|
* ```
|
|
129
170
|
*/
|
|
130
171
|
set(url: string, cookie: Cookie, useWebKit?: boolean): Promise<boolean>;
|
|
172
|
+
/**
|
|
173
|
+
* Set multiple cookies for a URL.
|
|
174
|
+
*
|
|
175
|
+
* Applies the same domain validation as `set` to every cookie. If any
|
|
176
|
+
* cookie's domain doesn't match the URL host, the whole call rejects and no
|
|
177
|
+
* cookies are written.
|
|
178
|
+
*
|
|
179
|
+
* @param url - The URL for which to set the cookies. Must include protocol.
|
|
180
|
+
* @param cookies - The cookie objects to store
|
|
181
|
+
* @param useWebKit - (iOS only) If true, use WKHTTPCookieStore instead of NSHTTPCookieStorage. Requires iOS 11+.
|
|
182
|
+
*
|
|
183
|
+
* @returns Promise that resolves to true on success
|
|
184
|
+
*
|
|
185
|
+
* @throws {Error} INVALID_URL - URL is malformed or missing protocol
|
|
186
|
+
* @throws {Error} DOMAIN_MISMATCH - A cookie's domain doesn't match URL host
|
|
187
|
+
* @throws {Error} WEBKIT_UNAVAILABLE - useWebKit=true on iOS < 11
|
|
188
|
+
*
|
|
189
|
+
* @example
|
|
190
|
+
* ```typescript
|
|
191
|
+
* await NitroCookies.setMany('https://example.com', [
|
|
192
|
+
* { name: 'session', value: 'abc123', secure: true },
|
|
193
|
+
* { name: 'theme', value: 'dark' },
|
|
194
|
+
* ]);
|
|
195
|
+
* ```
|
|
196
|
+
*/
|
|
197
|
+
setMany(url: string, cookies: Cookie[], useWebKit?: boolean): Promise<boolean>;
|
|
198
|
+
/**
|
|
199
|
+
* Get the `Cookie` request-header string for a URL.
|
|
200
|
+
*
|
|
201
|
+
* Returns the value you would put in an HTTP `Cookie` request header
|
|
202
|
+
* (e.g. `"name1=value1; name2=value2"`), built from every cookie that
|
|
203
|
+
* matches the URL. Returns an empty string when no cookies match.
|
|
204
|
+
*
|
|
205
|
+
* @param url - The URL to match cookies against. Must include protocol.
|
|
206
|
+
* @param useWebKit - (iOS only) If true, read from WKHTTPCookieStore instead of NSHTTPCookieStorage
|
|
207
|
+
*
|
|
208
|
+
* @returns Promise that resolves to the Cookie header string, or "" when no cookies match
|
|
209
|
+
*
|
|
210
|
+
* @throws {Error} INVALID_URL - URL is malformed or missing protocol
|
|
211
|
+
*
|
|
212
|
+
* @example
|
|
213
|
+
* ```typescript
|
|
214
|
+
* const header = await NitroCookies.getCookieHeader('https://example.com');
|
|
215
|
+
* await fetch('https://example.com/api', { headers: { Cookie: header } });
|
|
216
|
+
* ```
|
|
217
|
+
*/
|
|
218
|
+
getCookieHeader(url: string, useWebKit?: boolean): Promise<string>;
|
|
131
219
|
/**
|
|
132
220
|
* Get all cookies matching a specific URL's domain.
|
|
133
221
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/index.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,eAAe,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAa7E;;;;;;;;;;;;;;;;;;GAkBG;AACH,eAAO,MAAM,YAAY;IAKvB;;;;;;;;;;;;;;;;OAgBG;iBACU,MAAM,GAAG,OAAO;IAI7B;;;;;;;;;;;;;;;;;;;;;;OAsBG;iBACU,MAAM,UAAU,MAAM,GAAG,OAAO;IAI7C;;;;;;;;;;;;;;;OAeG;6BACsB,MAAM,SAAS,MAAM,GAAG,OAAO;IAIxD;;;;;;;;;;;;;OAaG;yBACkB,MAAM,QAAQ,MAAM,GAAG,OAAO;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/index.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,eAAe,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAa7E;;;;;;;;;;;;;;;;;;GAkBG;AACH,eAAO,MAAM,YAAY;IAKvB;;;;;;;;;;;;;;;;OAgBG;iBACU,MAAM,GAAG,OAAO;IAI7B;;;;;;;;;;;;;;;;;;;;;;OAsBG;iBACU,MAAM,UAAU,MAAM,GAAG,OAAO;IAI7C;;;;;;;;;;;;;;;OAeG;6BACsB,MAAM,SAAS,MAAM,GAAG,OAAO;IAIxD;;;;;;;;;;;;;OAaG;yBACkB,MAAM,QAAQ,MAAM,GAAG,OAAO;IAInD;;;;;;;;;;;;;;;;;OAiBG;6BACsB,MAAM,GAAG,MAAM;IAIxC;;;;;;;;;;;;;;;;;;;;OAoBG;qBACc,MAAM,WAAW,MAAM,EAAE,GAAG,OAAO;IAOpD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAiCG;aAEI,MAAM,UACH,MAAM,cACF,OAAO,GAClB,OAAO,CAAC,OAAO,CAAC;IAInB;;;;;;;;;;;;;;;;;;;;;;;;OAwBG;iBAEI,MAAM,WACF,MAAM,EAAE,cACL,OAAO,GAClB,OAAO,CAAC,OAAO,CAAC;IAInB;;;;;;;;;;;;;;;;;;;OAmBG;yBACwB,MAAM,cAAc,OAAO,GAAG,OAAO,CAAC,MAAM,CAAC;IAIxE;;;;;;;;;;;;;;;;;;;OAmBG;aACY,MAAM,cAAc,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC;IAK7D;;;;;;;;;;;;OAYG;yBACwB,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC;IAIrD;;;;;;;;;;;;;;;;;;;;;OAqBG;yBACwB,MAAM,SAAS,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC;IAInE;;;;;;;;;;;;;;;;;;OAkBG;yBACwB,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC;IAKpD;;;;;;;;;;;;;;;;;;;;;;OAsBG;uBACsB,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC;IAKnD;;;;;;;;;;;;;;;;;;;;;OAqBG;qBAEI,MAAM,QACL,MAAM,cACA,OAAO,GAClB,OAAO,CAAC,OAAO,CAAC;IAInB;;;;;;;;;;;;;;;;;;;;OAoBG;aACY,OAAO,CAAC,IAAI,CAAC;IAI5B;;;;;;;;;;;;;;;;;;;;;OAqBG;4BAC2B,OAAO,CAAC,OAAO,CAAC;CAG/C,CAAC;AAGF,YAAY,EAAE,MAAM,EAAE,OAAO,EAAE,eAAe,EAAE,WAAW,EAAE,CAAC;AAG9D,eAAe,YAAY,CAAC"}
|
|
@@ -22,7 +22,7 @@ namespace margelo::nitro::nitrocookies {
|
|
|
22
22
|
*/
|
|
23
23
|
struct JCookie final: public jni::JavaClass<JCookie> {
|
|
24
24
|
public:
|
|
25
|
-
static auto
|
|
25
|
+
static constexpr auto kJavaDescriptor = "Lcom/margelo/nitro/nitrocookies/Cookie;";
|
|
26
26
|
|
|
27
27
|
public:
|
|
28
28
|
/**
|