@cedarjs/cookie-jar 1.1.1-next.18 → 2.0.0-rc.24
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/dist/CookieJar.d.ts +3 -3
- package/dist/CookieJar.d.ts.map +1 -1
- package/dist/CookieJar.js +15 -14
- package/package.json +4 -4
package/dist/CookieJar.d.ts
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import
|
|
1
|
+
import type { SerializeOptions } from 'cookie';
|
|
2
2
|
export type CookieParams = {
|
|
3
3
|
value: string;
|
|
4
|
-
options?:
|
|
4
|
+
options?: SerializeOptions;
|
|
5
5
|
};
|
|
6
6
|
/** Specialized cookie map, that lets you set cookies with options */
|
|
7
7
|
export declare class CookieJar {
|
|
8
8
|
private map;
|
|
9
9
|
constructor(cookieString?: string | null);
|
|
10
|
-
set(name: string, value: string, options?:
|
|
10
|
+
set(name: string, value: string, options?: SerializeOptions): this;
|
|
11
11
|
get(name: string): string | undefined;
|
|
12
12
|
getWithOptions(name: string): CookieParams | undefined;
|
|
13
13
|
has(name: string): boolean;
|
package/dist/CookieJar.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CookieJar.d.ts","sourceRoot":"","sources":["../src/CookieJar.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"CookieJar.d.ts","sourceRoot":"","sources":["../src/CookieJar.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,QAAQ,CAAA;AAE9C,MAAM,MAAM,YAAY,GAAG;IACzB,KAAK,EAAE,MAAM,CAAA;IACb,OAAO,CAAC,EAAE,gBAAgB,CAAA;CAC3B,CAAA;AAED,qEAAqE;AACrE,qBAAa,SAAS;IACpB,OAAO,CAAC,GAAG,CAAkC;gBAIjC,YAAY,CAAC,EAAE,MAAM,GAAG,IAAI;IAuBjC,GAAG,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,gBAAgB;IAM3D,GAAG,CAAC,IAAI,EAAE,MAAM;IAIhB,cAAc,CAAC,IAAI,EAAE,MAAM;IAI3B,GAAG,CAAC,IAAI,EAAE,MAAM;IAIvB;;;OAGG;IACI,KAAK,CAAC,IAAI,EAAE,MAAM;IASzB,kEAAkE;IAC3D,KAAK,CAAC,IAAI,CAAC,EAAE,MAAM;IAQnB,OAAO;IAIP,CAAC,MAAM,CAAC,QAAQ,CAAC;IAIxB,IAAW,IAAI,WAEd;CACF"}
|
package/dist/CookieJar.js
CHANGED
|
@@ -31,26 +31,27 @@ __export(CookieJar_exports, {
|
|
|
31
31
|
CookieJar: () => CookieJar
|
|
32
32
|
});
|
|
33
33
|
module.exports = __toCommonJS(CookieJar_exports);
|
|
34
|
-
var
|
|
34
|
+
var cookie = __toESM(require("cookie"));
|
|
35
35
|
class CookieJar {
|
|
36
36
|
map = /* @__PURE__ */ new Map();
|
|
37
|
-
// This allows CookieJar to be used in
|
|
38
|
-
// note that options are not available when constructed this way
|
|
37
|
+
// This allows CookieJar to be used in MiddlewareRequest.cookie
|
|
38
|
+
// Also note that options are not available when constructed this way
|
|
39
39
|
constructor(cookieString) {
|
|
40
|
-
if (cookieString) {
|
|
41
|
-
|
|
42
|
-
this.map = new Map(
|
|
43
|
-
Object.entries(parsedCookies).map(([key, value]) => {
|
|
44
|
-
return [key, { value }];
|
|
45
|
-
})
|
|
46
|
-
);
|
|
40
|
+
if (cookieString === null || typeof cookieString === "undefined") {
|
|
41
|
+
return;
|
|
47
42
|
}
|
|
43
|
+
const parsedCookies = cookie.parse(cookieString);
|
|
44
|
+
this.map = new Map(
|
|
45
|
+
Object.entries(parsedCookies).map(([key, value]) => {
|
|
46
|
+
if (typeof value === "undefined") {
|
|
47
|
+
throw new Error("Cookie value is undefined");
|
|
48
|
+
}
|
|
49
|
+
return [key, { value }];
|
|
50
|
+
})
|
|
51
|
+
);
|
|
48
52
|
}
|
|
49
53
|
set(name, value, options) {
|
|
50
|
-
this.map.set(name, {
|
|
51
|
-
value,
|
|
52
|
-
options
|
|
53
|
-
});
|
|
54
|
+
this.map.set(name, { value, options });
|
|
54
55
|
return this;
|
|
55
56
|
}
|
|
56
57
|
get(name) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cedarjs/cookie-jar",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "2.0.0-rc.24",
|
|
4
4
|
"repository": {
|
|
5
5
|
"type": "git",
|
|
6
6
|
"url": "git+https://github.com/cedarjs/cedar.git",
|
|
@@ -23,13 +23,13 @@
|
|
|
23
23
|
"test": "vitest run"
|
|
24
24
|
},
|
|
25
25
|
"dependencies": {
|
|
26
|
-
"cookie": "0.
|
|
26
|
+
"cookie": "1.0.2",
|
|
27
27
|
"esbuild": "0.25.9",
|
|
28
28
|
"fast-glob": "3.3.3",
|
|
29
29
|
"fs-extra": "11.2.0"
|
|
30
30
|
},
|
|
31
31
|
"devDependencies": {
|
|
32
|
-
"@cedarjs/framework-tools": "
|
|
32
|
+
"@cedarjs/framework-tools": "2.0.0-rc.24",
|
|
33
33
|
"@types/fs-extra": "11.0.4",
|
|
34
34
|
"tsx": "4.20.5",
|
|
35
35
|
"typescript": "5.9.2",
|
|
@@ -38,5 +38,5 @@
|
|
|
38
38
|
"publishConfig": {
|
|
39
39
|
"access": "public"
|
|
40
40
|
},
|
|
41
|
-
"gitHead": "
|
|
41
|
+
"gitHead": "ce96a12c39646361695a287b05eee7ec92aab200"
|
|
42
42
|
}
|