@slicemachine/manager 0.22.3-alpha.repeatable-link.2 → 0.22.3-beta.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.
@@ -18,10 +18,13 @@ const serializeCookies = (cookies, args = {}) => {
|
|
18
18
|
};
|
19
19
|
const items = [];
|
20
20
|
for (const name in cookiesToSerialize) {
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
21
|
+
const cookieValue = cookiesToSerialize[name];
|
22
|
+
if (cookieValue) {
|
23
|
+
items.push(cookie.serialize(name, cookieValue, {
|
24
|
+
// Cookies need be stored raw (not encoded or escaped), so that consumers can format them the way they want them to be formatted.
|
25
|
+
encode: (cookie2) => cookie2
|
26
|
+
}));
|
27
|
+
}
|
25
28
|
}
|
26
29
|
return items.join(COOKIE_SEPARATOR);
|
27
30
|
};
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"serializeCookies.cjs","sources":["../../../src/lib/serializeCookies.ts"],"sourcesContent":["import cookie from \"cookie\";\n\nconst COOKIE_SEPARATOR = \"; \";\n\ntype Cookies = string | string[] | Record<string, string>;\n\nconst castParsedCookies = (
|
1
|
+
{"version":3,"file":"serializeCookies.cjs","sources":["../../../src/lib/serializeCookies.ts"],"sourcesContent":["import cookie from \"cookie\";\n\nconst COOKIE_SEPARATOR = \"; \";\n\ntype Cookies = string | string[] | Record<string, string>;\n\nconst castParsedCookies = (\n\tcookies: Cookies,\n): Record<string, string | undefined> => {\n\tif (Array.isArray(cookies)) {\n\t\treturn cookie.parse(cookies.join(COOKIE_SEPARATOR));\n\t} else if (typeof cookies === \"string\") {\n\t\treturn cookie.parse(cookies);\n\t} else {\n\t\treturn cookies;\n\t}\n};\n\ntype SerializeCookiesArgs = {\n\tcookieJar?: Cookies;\n};\n\n// TODO: If the `cookieJar` and multiple input types are not used anywhere,\n// simplify this function to only serialize a given object of cookies into a\n// string.\nexport const serializeCookies = (\n\tcookies: Cookies,\n\targs: SerializeCookiesArgs = {},\n): string => {\n\tconst cookiesToSerialize = {\n\t\t...castParsedCookies(args.cookieJar || {}),\n\t\t...castParsedCookies(cookies),\n\t};\n\n\tconst items: string[] = [];\n\n\tfor (const name in cookiesToSerialize) {\n\t\tconst cookieValue = cookiesToSerialize[name];\n\t\tif (cookieValue) {\n\t\t\titems.push(\n\t\t\t\tcookie.serialize(name, cookieValue, {\n\t\t\t\t\t// Cookies need be stored raw (not encoded or escaped), so that consumers can format them the way they want them to be formatted.\n\t\t\t\t\tencode: (cookie) => cookie,\n\t\t\t\t}),\n\t\t\t);\n\t\t}\n\t}\n\n\treturn items.join(COOKIE_SEPARATOR);\n};\n"],"names":["cookie"],"mappings":";;;AAEA,MAAM,mBAAmB;AAIzB,MAAM,oBAAoB,CACzB,YACuC;AACnC,MAAA,MAAM,QAAQ,OAAO,GAAG;AAC3B,WAAO,OAAO,MAAM,QAAQ,KAAK,gBAAgB,CAAC;AAAA,EAAA,WACxC,OAAO,YAAY,UAAU;AAChC,WAAA,OAAO,MAAM,OAAO;AAAA,EAAA,OACrB;AACC,WAAA;AAAA,EACR;AACD;AASO,MAAM,mBAAmB,CAC/B,SACA,OAA6B,OAClB;AACX,QAAM,qBAAqB;AAAA,IAC1B,GAAG,kBAAkB,KAAK,aAAa,EAAE;AAAA,IACzC,GAAG,kBAAkB,OAAO;AAAA,EAAA;AAG7B,QAAM,QAAkB,CAAA;AAExB,aAAW,QAAQ,oBAAoB;AAChC,UAAA,cAAc,mBAAmB,IAAI;AAC3C,QAAI,aAAa;AAChB,YAAM,KACL,OAAO,UAAU,MAAM,aAAa;AAAA;AAAA,QAEnC,QAAQ,CAACA,YAAWA;AAAAA,MACpB,CAAA,CAAC;AAAA,IAEJ;AAAA,EACD;AAEO,SAAA,MAAM,KAAK,gBAAgB;AACnC;;"}
|
@@ -16,10 +16,13 @@ const serializeCookies = (cookies, args = {}) => {
|
|
16
16
|
};
|
17
17
|
const items = [];
|
18
18
|
for (const name in cookiesToSerialize) {
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
19
|
+
const cookieValue = cookiesToSerialize[name];
|
20
|
+
if (cookieValue) {
|
21
|
+
items.push(cookie.serialize(name, cookieValue, {
|
22
|
+
// Cookies need be stored raw (not encoded or escaped), so that consumers can format them the way they want them to be formatted.
|
23
|
+
encode: (cookie2) => cookie2
|
24
|
+
}));
|
25
|
+
}
|
23
26
|
}
|
24
27
|
return items.join(COOKIE_SEPARATOR);
|
25
28
|
};
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"serializeCookies.js","sources":["../../../src/lib/serializeCookies.ts"],"sourcesContent":["import cookie from \"cookie\";\n\nconst COOKIE_SEPARATOR = \"; \";\n\ntype Cookies = string | string[] | Record<string, string>;\n\nconst castParsedCookies = (
|
1
|
+
{"version":3,"file":"serializeCookies.js","sources":["../../../src/lib/serializeCookies.ts"],"sourcesContent":["import cookie from \"cookie\";\n\nconst COOKIE_SEPARATOR = \"; \";\n\ntype Cookies = string | string[] | Record<string, string>;\n\nconst castParsedCookies = (\n\tcookies: Cookies,\n): Record<string, string | undefined> => {\n\tif (Array.isArray(cookies)) {\n\t\treturn cookie.parse(cookies.join(COOKIE_SEPARATOR));\n\t} else if (typeof cookies === \"string\") {\n\t\treturn cookie.parse(cookies);\n\t} else {\n\t\treturn cookies;\n\t}\n};\n\ntype SerializeCookiesArgs = {\n\tcookieJar?: Cookies;\n};\n\n// TODO: If the `cookieJar` and multiple input types are not used anywhere,\n// simplify this function to only serialize a given object of cookies into a\n// string.\nexport const serializeCookies = (\n\tcookies: Cookies,\n\targs: SerializeCookiesArgs = {},\n): string => {\n\tconst cookiesToSerialize = {\n\t\t...castParsedCookies(args.cookieJar || {}),\n\t\t...castParsedCookies(cookies),\n\t};\n\n\tconst items: string[] = [];\n\n\tfor (const name in cookiesToSerialize) {\n\t\tconst cookieValue = cookiesToSerialize[name];\n\t\tif (cookieValue) {\n\t\t\titems.push(\n\t\t\t\tcookie.serialize(name, cookieValue, {\n\t\t\t\t\t// Cookies need be stored raw (not encoded or escaped), so that consumers can format them the way they want them to be formatted.\n\t\t\t\t\tencode: (cookie) => cookie,\n\t\t\t\t}),\n\t\t\t);\n\t\t}\n\t}\n\n\treturn items.join(COOKIE_SEPARATOR);\n};\n"],"names":["cookie"],"mappings":";AAEA,MAAM,mBAAmB;AAIzB,MAAM,oBAAoB,CACzB,YACuC;AACnC,MAAA,MAAM,QAAQ,OAAO,GAAG;AAC3B,WAAO,OAAO,MAAM,QAAQ,KAAK,gBAAgB,CAAC;AAAA,EAAA,WACxC,OAAO,YAAY,UAAU;AAChC,WAAA,OAAO,MAAM,OAAO;AAAA,EAAA,OACrB;AACC,WAAA;AAAA,EACR;AACD;AASO,MAAM,mBAAmB,CAC/B,SACA,OAA6B,OAClB;AACX,QAAM,qBAAqB;AAAA,IAC1B,GAAG,kBAAkB,KAAK,aAAa,EAAE;AAAA,IACzC,GAAG,kBAAkB,OAAO;AAAA,EAAA;AAG7B,QAAM,QAAkB,CAAA;AAExB,aAAW,QAAQ,oBAAoB;AAChC,UAAA,cAAc,mBAAmB,IAAI;AAC3C,QAAI,aAAa;AAChB,YAAM,KACL,OAAO,UAAU,MAAM,aAAa;AAAA;AAAA,QAEnC,QAAQ,CAACA,YAAWA;AAAAA,MACpB,CAAA,CAAC;AAAA,IAEJ;AAAA,EACD;AAEO,SAAA,MAAM,KAAK,gBAAgB;AACnC;"}
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@slicemachine/manager",
|
3
|
-
"version": "0.22.3-
|
3
|
+
"version": "0.22.3-beta.1",
|
4
4
|
"description": "Manage all aspects of a Slice Machine project.",
|
5
5
|
"repository": {
|
6
6
|
"type": "git",
|
@@ -68,10 +68,10 @@
|
|
68
68
|
"@prismicio/client": "^7.11.0",
|
69
69
|
"@prismicio/custom-types-client": "2.1.0",
|
70
70
|
"@prismicio/mocks": "^2.4.0",
|
71
|
-
"@prismicio/types-internal": "2.
|
71
|
+
"@prismicio/types-internal": "^2.8.0",
|
72
72
|
"@segment/analytics-node": "^2.1.2",
|
73
|
-
"@slicemachine/plugin-kit": "0.4.57-
|
74
|
-
"cookie": "^0.
|
73
|
+
"@slicemachine/plugin-kit": "0.4.57-beta.1",
|
74
|
+
"cookie": "^1.0.1",
|
75
75
|
"cors": "^2.8.5",
|
76
76
|
"execa": "^7.1.1",
|
77
77
|
"file-type": "^18.2.1",
|
@@ -95,7 +95,6 @@
|
|
95
95
|
"@amplitude/experiment-node-server": "1.8.1",
|
96
96
|
"@prismicio/mock": "0.2.0",
|
97
97
|
"@size-limit/preset-small-lib": "8.2.4",
|
98
|
-
"@types/cookie": "0.5.1",
|
99
98
|
"@types/express": "4.17.17",
|
100
99
|
"@types/semver": "7.3.13",
|
101
100
|
"@typescript-eslint/eslint-plugin": "5.55.0",
|
@@ -4,7 +4,9 @@ const COOKIE_SEPARATOR = "; ";
|
|
4
4
|
|
5
5
|
type Cookies = string | string[] | Record<string, string>;
|
6
6
|
|
7
|
-
const castParsedCookies = (
|
7
|
+
const castParsedCookies = (
|
8
|
+
cookies: Cookies,
|
9
|
+
): Record<string, string | undefined> => {
|
8
10
|
if (Array.isArray(cookies)) {
|
9
11
|
return cookie.parse(cookies.join(COOKIE_SEPARATOR));
|
10
12
|
} else if (typeof cookies === "string") {
|
@@ -33,12 +35,15 @@ export const serializeCookies = (
|
|
33
35
|
const items: string[] = [];
|
34
36
|
|
35
37
|
for (const name in cookiesToSerialize) {
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
38
|
+
const cookieValue = cookiesToSerialize[name];
|
39
|
+
if (cookieValue) {
|
40
|
+
items.push(
|
41
|
+
cookie.serialize(name, cookieValue, {
|
42
|
+
// Cookies need be stored raw (not encoded or escaped), so that consumers can format them the way they want them to be formatted.
|
43
|
+
encode: (cookie) => cookie,
|
44
|
+
}),
|
45
|
+
);
|
46
|
+
}
|
42
47
|
}
|
43
48
|
|
44
49
|
return items.join(COOKIE_SEPARATOR);
|