@swr-login/adapter-cookie 0.1.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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 swr-login contributors
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,36 @@
1
+ # @swr-login/adapter-cookie
2
+
3
+ > Cookie storage adapter for swr-login (works with BFF pattern for HttpOnly cookies).
4
+
5
+ [![npm](https://img.shields.io/npm/v/@swr-login/adapter-cookie?color=blue)](https://www.npmjs.com/package/@swr-login/adapter-cookie)
6
+ [![license](https://img.shields.io/github/license/swr-login/swr-login)](https://github.com/swr-login/swr-login/blob/main/LICENSE)
7
+
8
+ ## Install
9
+
10
+ ```bash
11
+ npm install @swr-login/adapter-cookie
12
+ ```
13
+
14
+ ## Usage
15
+
16
+ ```ts
17
+ import { CookieAdapter } from '@swr-login/adapter-cookie';
18
+
19
+ const adapter = CookieAdapter({
20
+ // Cookie options
21
+ sameSite: 'Lax',
22
+ secure: true,
23
+ });
24
+ ```
25
+
26
+ ## When to use
27
+
28
+ Use this adapter when your app follows the **BFF (Backend For Frontend)** pattern and tokens are stored as HttpOnly cookies managed by the server.
29
+
30
+ ## Part of swr-login
31
+
32
+ See the full project at [github.com/swr-login/swr-login](https://github.com/swr-login/swr-login).
33
+
34
+ ## License
35
+
36
+ [MIT](https://github.com/swr-login/swr-login/blob/main/LICENSE)
package/dist/index.cjs ADDED
@@ -0,0 +1,75 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+
20
+ // src/index.ts
21
+ var index_exports = {};
22
+ __export(index_exports, {
23
+ CookieAdapter: () => CookieAdapter
24
+ });
25
+ module.exports = __toCommonJS(index_exports);
26
+ function getCookie(name) {
27
+ if (typeof document === "undefined") return null;
28
+ const match = document.cookie.match(
29
+ new RegExp(`(?:^|; )${name.replace(/[.*+?^${}()|[\]\\]/g, "\\$&")}=([^;]*)`)
30
+ );
31
+ return match ? decodeURIComponent(match[1]) : null;
32
+ }
33
+ function setCookie(name, value, options) {
34
+ if (typeof document === "undefined") return;
35
+ const parts = [
36
+ `${name}=${encodeURIComponent(value)}`,
37
+ `path=${options.path ?? "/"}`,
38
+ `SameSite=${options.sameSite ?? "Strict"}`
39
+ ];
40
+ if (options.secure !== false) parts.push("Secure");
41
+ if (options.domain) parts.push(`domain=${options.domain}`);
42
+ if (options.maxAge) parts.push(`max-age=${options.maxAge}`);
43
+ document.cookie = parts.join("; ");
44
+ }
45
+ function deleteCookie(name, options) {
46
+ if (typeof document === "undefined") return;
47
+ const parts = [`${name}=`, "max-age=0", `path=${options.path ?? "/"}`];
48
+ if (options.domain) parts.push(`domain=${options.domain}`);
49
+ document.cookie = parts.join("; ");
50
+ }
51
+ function CookieAdapter(options = {}) {
52
+ const { prefix = "swr_login" } = options;
53
+ const makeKey = (key) => `${prefix}_${key}`;
54
+ return {
55
+ getAccessToken: () => getCookie(makeKey("access_token")),
56
+ setAccessToken: (token) => setCookie(makeKey("access_token"), token, options),
57
+ getRefreshToken: () => getCookie(makeKey("refresh_token")),
58
+ setRefreshToken: (token) => setCookie(makeKey("refresh_token"), token, options),
59
+ getExpiresAt: () => {
60
+ const val = getCookie(makeKey("expires_at"));
61
+ return val ? Number(val) : null;
62
+ },
63
+ setExpiresAt: (expiresAt) => setCookie(makeKey("expires_at"), String(expiresAt), options),
64
+ clear: () => {
65
+ deleteCookie(makeKey("access_token"), options);
66
+ deleteCookie(makeKey("refresh_token"), options);
67
+ deleteCookie(makeKey("expires_at"), options);
68
+ }
69
+ };
70
+ }
71
+ // Annotate the CommonJS export names for ESM import in node:
72
+ 0 && (module.exports = {
73
+ CookieAdapter
74
+ });
75
+ //# sourceMappingURL=index.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/index.ts"],"sourcesContent":["import type { TokenAdapter } from '@swr-login/core';\n\nexport interface CookieAdapterOptions {\n /** Cookie name prefix (default: 'swr_login') */\n prefix?: string;\n /** Cookie path (default: '/') */\n path?: string;\n /** SameSite attribute (default: 'Strict') */\n sameSite?: 'Strict' | 'Lax' | 'None';\n /** Secure flag - only send over HTTPS (default: true) */\n secure?: boolean;\n /** Cookie domain (default: current domain) */\n domain?: string;\n /** Max age in seconds (default: 7 days) */\n maxAge?: number;\n}\n\nfunction getCookie(name: string): string | null {\n if (typeof document === 'undefined') return null;\n const match = document.cookie.match(\n new RegExp(`(?:^|; )${name.replace(/[.*+?^${}()|[\\]\\\\]/g, '\\\\$&')}=([^;]*)`),\n );\n return match ? decodeURIComponent(match[1]) : null;\n}\n\nfunction setCookie(name: string, value: string, options: CookieAdapterOptions): void {\n if (typeof document === 'undefined') return;\n\n const parts = [\n `${name}=${encodeURIComponent(value)}`,\n `path=${options.path ?? '/'}`,\n `SameSite=${options.sameSite ?? 'Strict'}`,\n ];\n\n if (options.secure !== false) parts.push('Secure');\n if (options.domain) parts.push(`domain=${options.domain}`);\n if (options.maxAge) parts.push(`max-age=${options.maxAge}`);\n\n document.cookie = parts.join('; ');\n}\n\nfunction deleteCookie(name: string, options: CookieAdapterOptions): void {\n if (typeof document === 'undefined') return;\n const parts = [`${name}=`, 'max-age=0', `path=${options.path ?? '/'}`];\n if (options.domain) parts.push(`domain=${options.domain}`);\n document.cookie = parts.join('; ');\n}\n\n/**\n * Cookie storage adapter.\n *\n * Best used with the BFF (Backend-for-Frontend) pattern where the server\n * sets HttpOnly cookies. This adapter handles non-HttpOnly cookies for\n * client-side token management.\n *\n * For maximum security, use HttpOnly cookies set by your BFF server\n * and use this adapter only for the expiration timestamp.\n *\n * @example\n * ```ts\n * import { CookieAdapter } from '@swr-login/adapter-cookie';\n *\n * const adapter = CookieAdapter({\n * secure: true,\n * sameSite: 'Strict',\n * maxAge: 7 * 24 * 60 * 60, // 7 days\n * });\n * ```\n */\nexport function CookieAdapter(options: CookieAdapterOptions = {}): TokenAdapter {\n const { prefix = 'swr_login' } = options;\n\n const makeKey = (key: string) => `${prefix}_${key}`;\n\n return {\n getAccessToken: () => getCookie(makeKey('access_token')),\n setAccessToken: (token) => setCookie(makeKey('access_token'), token, options),\n getRefreshToken: () => getCookie(makeKey('refresh_token')),\n setRefreshToken: (token) => setCookie(makeKey('refresh_token'), token, options),\n getExpiresAt: () => {\n const val = getCookie(makeKey('expires_at'));\n return val ? Number(val) : null;\n },\n setExpiresAt: (expiresAt) => setCookie(makeKey('expires_at'), String(expiresAt), options),\n clear: () => {\n deleteCookie(makeKey('access_token'), options);\n deleteCookie(makeKey('refresh_token'), options);\n deleteCookie(makeKey('expires_at'), options);\n },\n };\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAiBA,SAAS,UAAU,MAA6B;AAC9C,MAAI,OAAO,aAAa,YAAa,QAAO;AAC5C,QAAM,QAAQ,SAAS,OAAO;AAAA,IAC5B,IAAI,OAAO,WAAW,KAAK,QAAQ,uBAAuB,MAAM,CAAC,UAAU;AAAA,EAC7E;AACA,SAAO,QAAQ,mBAAmB,MAAM,CAAC,CAAC,IAAI;AAChD;AAEA,SAAS,UAAU,MAAc,OAAe,SAAqC;AACnF,MAAI,OAAO,aAAa,YAAa;AAErC,QAAM,QAAQ;AAAA,IACZ,GAAG,IAAI,IAAI,mBAAmB,KAAK,CAAC;AAAA,IACpC,QAAQ,QAAQ,QAAQ,GAAG;AAAA,IAC3B,YAAY,QAAQ,YAAY,QAAQ;AAAA,EAC1C;AAEA,MAAI,QAAQ,WAAW,MAAO,OAAM,KAAK,QAAQ;AACjD,MAAI,QAAQ,OAAQ,OAAM,KAAK,UAAU,QAAQ,MAAM,EAAE;AACzD,MAAI,QAAQ,OAAQ,OAAM,KAAK,WAAW,QAAQ,MAAM,EAAE;AAE1D,WAAS,SAAS,MAAM,KAAK,IAAI;AACnC;AAEA,SAAS,aAAa,MAAc,SAAqC;AACvE,MAAI,OAAO,aAAa,YAAa;AACrC,QAAM,QAAQ,CAAC,GAAG,IAAI,KAAK,aAAa,QAAQ,QAAQ,QAAQ,GAAG,EAAE;AACrE,MAAI,QAAQ,OAAQ,OAAM,KAAK,UAAU,QAAQ,MAAM,EAAE;AACzD,WAAS,SAAS,MAAM,KAAK,IAAI;AACnC;AAuBO,SAAS,cAAc,UAAgC,CAAC,GAAiB;AAC9E,QAAM,EAAE,SAAS,YAAY,IAAI;AAEjC,QAAM,UAAU,CAAC,QAAgB,GAAG,MAAM,IAAI,GAAG;AAEjD,SAAO;AAAA,IACL,gBAAgB,MAAM,UAAU,QAAQ,cAAc,CAAC;AAAA,IACvD,gBAAgB,CAAC,UAAU,UAAU,QAAQ,cAAc,GAAG,OAAO,OAAO;AAAA,IAC5E,iBAAiB,MAAM,UAAU,QAAQ,eAAe,CAAC;AAAA,IACzD,iBAAiB,CAAC,UAAU,UAAU,QAAQ,eAAe,GAAG,OAAO,OAAO;AAAA,IAC9E,cAAc,MAAM;AAClB,YAAM,MAAM,UAAU,QAAQ,YAAY,CAAC;AAC3C,aAAO,MAAM,OAAO,GAAG,IAAI;AAAA,IAC7B;AAAA,IACA,cAAc,CAAC,cAAc,UAAU,QAAQ,YAAY,GAAG,OAAO,SAAS,GAAG,OAAO;AAAA,IACxF,OAAO,MAAM;AACX,mBAAa,QAAQ,cAAc,GAAG,OAAO;AAC7C,mBAAa,QAAQ,eAAe,GAAG,OAAO;AAC9C,mBAAa,QAAQ,YAAY,GAAG,OAAO;AAAA,IAC7C;AAAA,EACF;AACF;","names":[]}
@@ -0,0 +1,40 @@
1
+ import { TokenAdapter } from '@swr-login/core';
2
+
3
+ interface CookieAdapterOptions {
4
+ /** Cookie name prefix (default: 'swr_login') */
5
+ prefix?: string;
6
+ /** Cookie path (default: '/') */
7
+ path?: string;
8
+ /** SameSite attribute (default: 'Strict') */
9
+ sameSite?: 'Strict' | 'Lax' | 'None';
10
+ /** Secure flag - only send over HTTPS (default: true) */
11
+ secure?: boolean;
12
+ /** Cookie domain (default: current domain) */
13
+ domain?: string;
14
+ /** Max age in seconds (default: 7 days) */
15
+ maxAge?: number;
16
+ }
17
+ /**
18
+ * Cookie storage adapter.
19
+ *
20
+ * Best used with the BFF (Backend-for-Frontend) pattern where the server
21
+ * sets HttpOnly cookies. This adapter handles non-HttpOnly cookies for
22
+ * client-side token management.
23
+ *
24
+ * For maximum security, use HttpOnly cookies set by your BFF server
25
+ * and use this adapter only for the expiration timestamp.
26
+ *
27
+ * @example
28
+ * ```ts
29
+ * import { CookieAdapter } from '@swr-login/adapter-cookie';
30
+ *
31
+ * const adapter = CookieAdapter({
32
+ * secure: true,
33
+ * sameSite: 'Strict',
34
+ * maxAge: 7 * 24 * 60 * 60, // 7 days
35
+ * });
36
+ * ```
37
+ */
38
+ declare function CookieAdapter(options?: CookieAdapterOptions): TokenAdapter;
39
+
40
+ export { CookieAdapter, type CookieAdapterOptions };
@@ -0,0 +1,40 @@
1
+ import { TokenAdapter } from '@swr-login/core';
2
+
3
+ interface CookieAdapterOptions {
4
+ /** Cookie name prefix (default: 'swr_login') */
5
+ prefix?: string;
6
+ /** Cookie path (default: '/') */
7
+ path?: string;
8
+ /** SameSite attribute (default: 'Strict') */
9
+ sameSite?: 'Strict' | 'Lax' | 'None';
10
+ /** Secure flag - only send over HTTPS (default: true) */
11
+ secure?: boolean;
12
+ /** Cookie domain (default: current domain) */
13
+ domain?: string;
14
+ /** Max age in seconds (default: 7 days) */
15
+ maxAge?: number;
16
+ }
17
+ /**
18
+ * Cookie storage adapter.
19
+ *
20
+ * Best used with the BFF (Backend-for-Frontend) pattern where the server
21
+ * sets HttpOnly cookies. This adapter handles non-HttpOnly cookies for
22
+ * client-side token management.
23
+ *
24
+ * For maximum security, use HttpOnly cookies set by your BFF server
25
+ * and use this adapter only for the expiration timestamp.
26
+ *
27
+ * @example
28
+ * ```ts
29
+ * import { CookieAdapter } from '@swr-login/adapter-cookie';
30
+ *
31
+ * const adapter = CookieAdapter({
32
+ * secure: true,
33
+ * sameSite: 'Strict',
34
+ * maxAge: 7 * 24 * 60 * 60, // 7 days
35
+ * });
36
+ * ```
37
+ */
38
+ declare function CookieAdapter(options?: CookieAdapterOptions): TokenAdapter;
39
+
40
+ export { CookieAdapter, type CookieAdapterOptions };
package/dist/index.js ADDED
@@ -0,0 +1,50 @@
1
+ // src/index.ts
2
+ function getCookie(name) {
3
+ if (typeof document === "undefined") return null;
4
+ const match = document.cookie.match(
5
+ new RegExp(`(?:^|; )${name.replace(/[.*+?^${}()|[\]\\]/g, "\\$&")}=([^;]*)`)
6
+ );
7
+ return match ? decodeURIComponent(match[1]) : null;
8
+ }
9
+ function setCookie(name, value, options) {
10
+ if (typeof document === "undefined") return;
11
+ const parts = [
12
+ `${name}=${encodeURIComponent(value)}`,
13
+ `path=${options.path ?? "/"}`,
14
+ `SameSite=${options.sameSite ?? "Strict"}`
15
+ ];
16
+ if (options.secure !== false) parts.push("Secure");
17
+ if (options.domain) parts.push(`domain=${options.domain}`);
18
+ if (options.maxAge) parts.push(`max-age=${options.maxAge}`);
19
+ document.cookie = parts.join("; ");
20
+ }
21
+ function deleteCookie(name, options) {
22
+ if (typeof document === "undefined") return;
23
+ const parts = [`${name}=`, "max-age=0", `path=${options.path ?? "/"}`];
24
+ if (options.domain) parts.push(`domain=${options.domain}`);
25
+ document.cookie = parts.join("; ");
26
+ }
27
+ function CookieAdapter(options = {}) {
28
+ const { prefix = "swr_login" } = options;
29
+ const makeKey = (key) => `${prefix}_${key}`;
30
+ return {
31
+ getAccessToken: () => getCookie(makeKey("access_token")),
32
+ setAccessToken: (token) => setCookie(makeKey("access_token"), token, options),
33
+ getRefreshToken: () => getCookie(makeKey("refresh_token")),
34
+ setRefreshToken: (token) => setCookie(makeKey("refresh_token"), token, options),
35
+ getExpiresAt: () => {
36
+ const val = getCookie(makeKey("expires_at"));
37
+ return val ? Number(val) : null;
38
+ },
39
+ setExpiresAt: (expiresAt) => setCookie(makeKey("expires_at"), String(expiresAt), options),
40
+ clear: () => {
41
+ deleteCookie(makeKey("access_token"), options);
42
+ deleteCookie(makeKey("refresh_token"), options);
43
+ deleteCookie(makeKey("expires_at"), options);
44
+ }
45
+ };
46
+ }
47
+ export {
48
+ CookieAdapter
49
+ };
50
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/index.ts"],"sourcesContent":["import type { TokenAdapter } from '@swr-login/core';\n\nexport interface CookieAdapterOptions {\n /** Cookie name prefix (default: 'swr_login') */\n prefix?: string;\n /** Cookie path (default: '/') */\n path?: string;\n /** SameSite attribute (default: 'Strict') */\n sameSite?: 'Strict' | 'Lax' | 'None';\n /** Secure flag - only send over HTTPS (default: true) */\n secure?: boolean;\n /** Cookie domain (default: current domain) */\n domain?: string;\n /** Max age in seconds (default: 7 days) */\n maxAge?: number;\n}\n\nfunction getCookie(name: string): string | null {\n if (typeof document === 'undefined') return null;\n const match = document.cookie.match(\n new RegExp(`(?:^|; )${name.replace(/[.*+?^${}()|[\\]\\\\]/g, '\\\\$&')}=([^;]*)`),\n );\n return match ? decodeURIComponent(match[1]) : null;\n}\n\nfunction setCookie(name: string, value: string, options: CookieAdapterOptions): void {\n if (typeof document === 'undefined') return;\n\n const parts = [\n `${name}=${encodeURIComponent(value)}`,\n `path=${options.path ?? '/'}`,\n `SameSite=${options.sameSite ?? 'Strict'}`,\n ];\n\n if (options.secure !== false) parts.push('Secure');\n if (options.domain) parts.push(`domain=${options.domain}`);\n if (options.maxAge) parts.push(`max-age=${options.maxAge}`);\n\n document.cookie = parts.join('; ');\n}\n\nfunction deleteCookie(name: string, options: CookieAdapterOptions): void {\n if (typeof document === 'undefined') return;\n const parts = [`${name}=`, 'max-age=0', `path=${options.path ?? '/'}`];\n if (options.domain) parts.push(`domain=${options.domain}`);\n document.cookie = parts.join('; ');\n}\n\n/**\n * Cookie storage adapter.\n *\n * Best used with the BFF (Backend-for-Frontend) pattern where the server\n * sets HttpOnly cookies. This adapter handles non-HttpOnly cookies for\n * client-side token management.\n *\n * For maximum security, use HttpOnly cookies set by your BFF server\n * and use this adapter only for the expiration timestamp.\n *\n * @example\n * ```ts\n * import { CookieAdapter } from '@swr-login/adapter-cookie';\n *\n * const adapter = CookieAdapter({\n * secure: true,\n * sameSite: 'Strict',\n * maxAge: 7 * 24 * 60 * 60, // 7 days\n * });\n * ```\n */\nexport function CookieAdapter(options: CookieAdapterOptions = {}): TokenAdapter {\n const { prefix = 'swr_login' } = options;\n\n const makeKey = (key: string) => `${prefix}_${key}`;\n\n return {\n getAccessToken: () => getCookie(makeKey('access_token')),\n setAccessToken: (token) => setCookie(makeKey('access_token'), token, options),\n getRefreshToken: () => getCookie(makeKey('refresh_token')),\n setRefreshToken: (token) => setCookie(makeKey('refresh_token'), token, options),\n getExpiresAt: () => {\n const val = getCookie(makeKey('expires_at'));\n return val ? Number(val) : null;\n },\n setExpiresAt: (expiresAt) => setCookie(makeKey('expires_at'), String(expiresAt), options),\n clear: () => {\n deleteCookie(makeKey('access_token'), options);\n deleteCookie(makeKey('refresh_token'), options);\n deleteCookie(makeKey('expires_at'), options);\n },\n };\n}\n"],"mappings":";AAiBA,SAAS,UAAU,MAA6B;AAC9C,MAAI,OAAO,aAAa,YAAa,QAAO;AAC5C,QAAM,QAAQ,SAAS,OAAO;AAAA,IAC5B,IAAI,OAAO,WAAW,KAAK,QAAQ,uBAAuB,MAAM,CAAC,UAAU;AAAA,EAC7E;AACA,SAAO,QAAQ,mBAAmB,MAAM,CAAC,CAAC,IAAI;AAChD;AAEA,SAAS,UAAU,MAAc,OAAe,SAAqC;AACnF,MAAI,OAAO,aAAa,YAAa;AAErC,QAAM,QAAQ;AAAA,IACZ,GAAG,IAAI,IAAI,mBAAmB,KAAK,CAAC;AAAA,IACpC,QAAQ,QAAQ,QAAQ,GAAG;AAAA,IAC3B,YAAY,QAAQ,YAAY,QAAQ;AAAA,EAC1C;AAEA,MAAI,QAAQ,WAAW,MAAO,OAAM,KAAK,QAAQ;AACjD,MAAI,QAAQ,OAAQ,OAAM,KAAK,UAAU,QAAQ,MAAM,EAAE;AACzD,MAAI,QAAQ,OAAQ,OAAM,KAAK,WAAW,QAAQ,MAAM,EAAE;AAE1D,WAAS,SAAS,MAAM,KAAK,IAAI;AACnC;AAEA,SAAS,aAAa,MAAc,SAAqC;AACvE,MAAI,OAAO,aAAa,YAAa;AACrC,QAAM,QAAQ,CAAC,GAAG,IAAI,KAAK,aAAa,QAAQ,QAAQ,QAAQ,GAAG,EAAE;AACrE,MAAI,QAAQ,OAAQ,OAAM,KAAK,UAAU,QAAQ,MAAM,EAAE;AACzD,WAAS,SAAS,MAAM,KAAK,IAAI;AACnC;AAuBO,SAAS,cAAc,UAAgC,CAAC,GAAiB;AAC9E,QAAM,EAAE,SAAS,YAAY,IAAI;AAEjC,QAAM,UAAU,CAAC,QAAgB,GAAG,MAAM,IAAI,GAAG;AAEjD,SAAO;AAAA,IACL,gBAAgB,MAAM,UAAU,QAAQ,cAAc,CAAC;AAAA,IACvD,gBAAgB,CAAC,UAAU,UAAU,QAAQ,cAAc,GAAG,OAAO,OAAO;AAAA,IAC5E,iBAAiB,MAAM,UAAU,QAAQ,eAAe,CAAC;AAAA,IACzD,iBAAiB,CAAC,UAAU,UAAU,QAAQ,eAAe,GAAG,OAAO,OAAO;AAAA,IAC9E,cAAc,MAAM;AAClB,YAAM,MAAM,UAAU,QAAQ,YAAY,CAAC;AAC3C,aAAO,MAAM,OAAO,GAAG,IAAI;AAAA,IAC7B;AAAA,IACA,cAAc,CAAC,cAAc,UAAU,QAAQ,YAAY,GAAG,OAAO,SAAS,GAAG,OAAO;AAAA,IACxF,OAAO,MAAM;AACX,mBAAa,QAAQ,cAAc,GAAG,OAAO;AAC7C,mBAAa,QAAQ,eAAe,GAAG,OAAO;AAC9C,mBAAa,QAAQ,YAAY,GAAG,OAAO;AAAA,IAC7C;AAAA,EACF;AACF;","names":[]}
package/package.json ADDED
@@ -0,0 +1,51 @@
1
+ {
2
+ "name": "@swr-login/adapter-cookie",
3
+ "version": "0.1.0",
4
+ "description": "Cookie storage adapter for swr-login (works with BFF pattern for HttpOnly cookies)",
5
+ "type": "module",
6
+ "main": "./dist/index.cjs",
7
+ "module": "./dist/index.js",
8
+ "types": "./dist/index.d.ts",
9
+ "exports": {
10
+ ".": {
11
+ "import": {
12
+ "types": "./dist/index.d.ts",
13
+ "default": "./dist/index.js"
14
+ },
15
+ "require": {
16
+ "types": "./dist/index.d.cts",
17
+ "default": "./dist/index.cjs"
18
+ }
19
+ }
20
+ },
21
+ "files": [
22
+ "dist"
23
+ ],
24
+ "sideEffects": false,
25
+ "dependencies": {
26
+ "@swr-login/core": "0.1.0"
27
+ },
28
+ "keywords": [
29
+ "swr-login",
30
+ "cookie",
31
+ "adapter",
32
+ "httponly",
33
+ "bff"
34
+ ],
35
+ "license": "MIT",
36
+ "repository": {
37
+ "type": "git",
38
+ "url": "https://github.com/swr-login/swr-login",
39
+ "directory": "packages/adapter-cookie"
40
+ },
41
+ "homepage": "https://github.com/swr-login/swr-login#readme",
42
+ "bugs": "https://github.com/swr-login/swr-login/issues",
43
+ "publishConfig": {
44
+ "access": "public"
45
+ },
46
+ "scripts": {
47
+ "build": "tsup",
48
+ "dev": "tsup --watch",
49
+ "clean": "rm -rf dist"
50
+ }
51
+ }