iron-session 6.1.3 → 6.2.0-beta.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/README.md +4 -6
- package/dist/index.d.ts +25 -8
- package/dist/index.js +136 -115
- package/dist/index.js.map +1 -7
- package/dist/index.mjs +120 -103
- package/dist/index.mjs.map +1 -7
- package/edge/dist/index.d.ts +81 -0
- package/edge/dist/index.js +213 -0
- package/edge/dist/index.js.map +1 -0
- package/edge/dist/index.mjs +179 -0
- package/edge/dist/index.mjs.map +1 -0
- package/edge/index.d.ts +81 -0
- package/edge/index.js +213 -0
- package/edge/index.js.map +1 -0
- package/edge/index.mjs +179 -0
- package/edge/index.mjs.map +1 -0
- package/edge/index.ts +27 -0
- package/edge/tsconfig.json +8 -0
- package/express/dist/index.js +12 -16
- package/express/dist/index.js.map +1 -7
- package/express/dist/index.mjs +1 -1
- package/express/dist/index.mjs.map +1 -7
- package/express/index.js +12 -16
- package/express/index.js.map +1 -7
- package/express/index.mjs +1 -1
- package/express/index.mjs.map +1 -7
- package/next/dist/index.js +12 -16
- package/next/dist/index.js.map +1 -7
- package/next/dist/index.mjs +1 -1
- package/next/dist/index.mjs.map +1 -7
- package/next/index.js +12 -16
- package/next/index.js.map +1 -7
- package/next/index.mjs +1 -1
- package/next/index.mjs.map +1 -7
- package/package.json +31 -22
package/next/index.js.map
CHANGED
|
@@ -1,7 +1 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../index.ts", "../../src/getPropertyDescriptorForReqSession.ts"],
|
|
4
|
-
"sourcesContent": ["import type {\n NextApiHandler,\n GetServerSidePropsContext,\n GetServerSidePropsResult,\n NextApiRequest,\n NextApiResponse,\n} from \"next\";\nimport type { IronSessionOptions } from \"iron-session\";\nimport { getIronSession } from \"iron-session\";\nimport getPropertyDescriptorForReqSession from \"../src/getPropertyDescriptorForReqSession\";\nimport { IncomingMessage, ServerResponse } from \"http\";\n\n// Argument types based on getIronSession function\ntype GetIronSessionApiOptions = (\n request: NextApiRequest,\n response: NextApiResponse,\n) => Promise<IronSessionOptions> | IronSessionOptions;\n\nexport function withIronSessionApiRoute(\n handler: NextApiHandler,\n options: IronSessionOptions | GetIronSessionApiOptions,\n): NextApiHandler {\n return async function nextApiHandlerWrappedWithIronSession(req, res) {\n let sessionOptions: IronSessionOptions;\n\n // If options is a function, call it and assign the results back.\n if (options instanceof Function) {\n sessionOptions = await options(req, res);\n } else {\n sessionOptions = options;\n }\n\n const session = await getIronSession(req, res, sessionOptions);\n\n // we define req.session as being enumerable (so console.log(req) shows it)\n // and we also want to allow people to do:\n // req.session = { admin: true }; or req.session = {...req.session, admin: true};\n // req.session.save();\n Object.defineProperty(\n req,\n \"session\",\n getPropertyDescriptorForReqSession(session),\n );\n return handler(req, res);\n };\n}\n\n// Argument type based on the SSR context\ntype GetIronSessionSSROptions = (\n request: IncomingMessage,\n response: ServerResponse,\n) => Promise<IronSessionOptions> | IronSessionOptions;\n\nexport function withIronSessionSsr<\n P extends { [key: string]: unknown } = { [key: string]: unknown },\n>(\n handler: (\n context: GetServerSidePropsContext,\n ) => GetServerSidePropsResult<P> | Promise<GetServerSidePropsResult<P>>,\n options: IronSessionOptions | GetIronSessionSSROptions,\n) {\n return async function nextGetServerSidePropsHandlerWrappedWithIronSession(\n context: GetServerSidePropsContext,\n ) {\n let sessionOptions: IronSessionOptions;\n\n // If options is a function, call it and assign the results back.\n if (options instanceof Function) {\n sessionOptions = await options(context.req, context.res);\n } else {\n sessionOptions = options;\n }\n\n const session = await getIronSession(\n context.req,\n context.res,\n sessionOptions,\n );\n\n Object.defineProperty(\n context.req,\n \"session\",\n getPropertyDescriptorForReqSession(session),\n );\n return handler(context);\n };\n}\n", "import type { IronSession } from \".\";\n\nexport default function getPropertyDescriptorForReqSession(\n session: IronSession,\n): PropertyDescriptor {\n return {\n enumerable: true,\n get() {\n return session;\n },\n set(value) {\n const keys = Object.keys(value);\n const currentKeys = Object.keys(session);\n\n currentKeys.forEach((key) => {\n if (!keys.includes(key)) {\n // @ts-ignore See comment in IronSessionData interface\n delete session[key];\n }\n });\n\n keys.forEach((key) => {\n // @ts-ignore See comment in IronSessionData interface\n session[key] = value[key];\n });\n },\n };\n}\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAQA,0BAA+B;;;ACNhB,4CACb,SACoB;AACpB,SAAO;AAAA,IACL,YAAY;AAAA,IACZ,MAAM;AACJ,aAAO;AAAA;AAAA,IAET,IAAI,OAAO;AACT,YAAM,OAAO,OAAO,KAAK;AACzB,YAAM,cAAc,OAAO,KAAK;AAEhC,kBAAY,QAAQ,CAAC,QAAQ;AAC3B,YAAI,CAAC,KAAK,SAAS,MAAM;AAEvB,iBAAO,QAAQ;AAAA;AAAA;AAInB,WAAK,QAAQ,CAAC,QAAQ;AAEpB,gBAAQ,OAAO,MAAM;AAAA;AAAA;AAAA;AAAA;;;ADLtB,iCACL,SACA,SACgB;AAChB,SAAO,oDAAoD,KAAK,KAAK;AACnE,QAAI;AAGJ,QAAI,mBAAmB,UAAU;AAC/B,uBAAiB,MAAM,QAAQ,KAAK;AAAA,WAC/B;AACL,uBAAiB;AAAA;AAGnB,UAAM,UAAU,MAAM,wCAAe,KAAK,KAAK;AAM/C,WAAO,eACL,KACA,WACA,mCAAmC;AAErC,WAAO,QAAQ,KAAK;AAAA;AAAA;AAUjB,4BAGL,SAGA,SACA;AACA,SAAO,mEACL,SACA;AACA,QAAI;AAGJ,QAAI,mBAAmB,UAAU;AAC/B,uBAAiB,MAAM,QAAQ,QAAQ,KAAK,QAAQ;AAAA,WAC/C;AACL,uBAAiB;AAAA;AAGnB,UAAM,UAAU,MAAM,wCACpB,QAAQ,KACR,QAAQ,KACR;AAGF,WAAO,eACL,QAAQ,KACR,WACA,mCAAmC;AAErC,WAAO,QAAQ;AAAA;AAAA;",
|
|
6
|
-
"names": []
|
|
7
|
-
}
|
|
1
|
+
{"version":3,"sources":["../index.ts","../../src/getPropertyDescriptorForReqSession.ts"],"sourcesContent":["import type {\n NextApiHandler,\n GetServerSidePropsContext,\n GetServerSidePropsResult,\n NextApiRequest,\n NextApiResponse,\n} from \"next\";\nimport type { IronSessionOptions } from \"iron-session\";\nimport { getIronSession } from \"iron-session\";\nimport getPropertyDescriptorForReqSession from \"../src/getPropertyDescriptorForReqSession\";\nimport { IncomingMessage, ServerResponse } from \"http\";\n\n// Argument types based on getIronSession function\ntype GetIronSessionApiOptions = (\n request: NextApiRequest,\n response: NextApiResponse,\n) => Promise<IronSessionOptions> | IronSessionOptions;\n\nexport function withIronSessionApiRoute(\n handler: NextApiHandler,\n options: IronSessionOptions | GetIronSessionApiOptions,\n): NextApiHandler {\n return async function nextApiHandlerWrappedWithIronSession(req, res) {\n let sessionOptions: IronSessionOptions;\n\n // If options is a function, call it and assign the results back.\n if (options instanceof Function) {\n sessionOptions = await options(req, res);\n } else {\n sessionOptions = options;\n }\n\n const session = await getIronSession(req, res, sessionOptions);\n\n // we define req.session as being enumerable (so console.log(req) shows it)\n // and we also want to allow people to do:\n // req.session = { admin: true }; or req.session = {...req.session, admin: true};\n // req.session.save();\n Object.defineProperty(\n req,\n \"session\",\n getPropertyDescriptorForReqSession(session),\n );\n return handler(req, res);\n };\n}\n\n// Argument type based on the SSR context\ntype GetIronSessionSSROptions = (\n request: IncomingMessage,\n response: ServerResponse,\n) => Promise<IronSessionOptions> | IronSessionOptions;\n\nexport function withIronSessionSsr<\n P extends { [key: string]: unknown } = { [key: string]: unknown },\n>(\n handler: (\n context: GetServerSidePropsContext,\n ) => GetServerSidePropsResult<P> | Promise<GetServerSidePropsResult<P>>,\n options: IronSessionOptions | GetIronSessionSSROptions,\n) {\n return async function nextGetServerSidePropsHandlerWrappedWithIronSession(\n context: GetServerSidePropsContext,\n ) {\n let sessionOptions: IronSessionOptions;\n\n // If options is a function, call it and assign the results back.\n if (options instanceof Function) {\n sessionOptions = await options(context.req, context.res);\n } else {\n sessionOptions = options;\n }\n\n const session = await getIronSession(\n context.req,\n context.res,\n sessionOptions,\n );\n\n Object.defineProperty(\n context.req,\n \"session\",\n getPropertyDescriptorForReqSession(session),\n );\n return handler(context);\n };\n}\n","import type { IronSession } from \".\";\n\nexport default function getPropertyDescriptorForReqSession(\n session: IronSession,\n): PropertyDescriptor {\n return {\n enumerable: true,\n get() {\n return session;\n },\n set(value) {\n const keys = Object.keys(value);\n const currentKeys = Object.keys(session);\n\n currentKeys.forEach((key) => {\n if (!keys.includes(key)) {\n // @ts-ignore See comment in IronSessionData interface\n delete session[key];\n }\n });\n\n keys.forEach((key) => {\n // @ts-ignore See comment in IronSessionData interface\n session[key] = value[key];\n });\n },\n };\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAQA,0BAA+B;;;ACNhB,4CACb,SACoB;AACpB,SAAO;AAAA,IACL,YAAY;AAAA,IACZ,MAAM;AACJ,aAAO;AAAA,IACT;AAAA,IACA,IAAI,OAAO;AACT,YAAM,OAAO,OAAO,KAAK,KAAK;AAC9B,YAAM,cAAc,OAAO,KAAK,OAAO;AAEvC,kBAAY,QAAQ,CAAC,QAAQ;AAC3B,YAAI,CAAC,KAAK,SAAS,GAAG,GAAG;AAEvB,iBAAO,QAAQ;AAAA,QACjB;AAAA,MACF,CAAC;AAED,WAAK,QAAQ,CAAC,QAAQ;AAEpB,gBAAQ,OAAO,MAAM;AAAA,MACvB,CAAC;AAAA,IACH;AAAA,EACF;AACF;;;ADTO,iCACL,SACA,SACgB;AAChB,SAAO,oDAAoD,KAAK,KAAK;AACnE,QAAI;AAGJ,QAAI,mBAAmB,UAAU;AAC/B,uBAAiB,MAAM,QAAQ,KAAK,GAAG;AAAA,IACzC,OAAO;AACL,uBAAiB;AAAA,IACnB;AAEA,UAAM,UAAU,MAAM,wCAAe,KAAK,KAAK,cAAc;AAM7D,WAAO,eACL,KACA,WACA,mCAAmC,OAAO,CAC5C;AACA,WAAO,QAAQ,KAAK,GAAG;AAAA,EACzB;AACF;AAQO,4BAGL,SAGA,SACA;AACA,SAAO,mEACL,SACA;AACA,QAAI;AAGJ,QAAI,mBAAmB,UAAU;AAC/B,uBAAiB,MAAM,QAAQ,QAAQ,KAAK,QAAQ,GAAG;AAAA,IACzD,OAAO;AACL,uBAAiB;AAAA,IACnB;AAEA,UAAM,UAAU,MAAM,wCACpB,QAAQ,KACR,QAAQ,KACR,cACF;AAEA,WAAO,eACL,QAAQ,KACR,WACA,mCAAmC,OAAO,CAC5C;AACA,WAAO,QAAQ,OAAO;AAAA,EACxB;AACF;","names":[]}
|
package/next/index.mjs
CHANGED
package/next/index.mjs.map
CHANGED
|
@@ -1,7 +1 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../index.ts", "../../src/getPropertyDescriptorForReqSession.ts"],
|
|
4
|
-
"sourcesContent": ["import type {\n NextApiHandler,\n GetServerSidePropsContext,\n GetServerSidePropsResult,\n NextApiRequest,\n NextApiResponse,\n} from \"next\";\nimport type { IronSessionOptions } from \"iron-session\";\nimport { getIronSession } from \"iron-session\";\nimport getPropertyDescriptorForReqSession from \"../src/getPropertyDescriptorForReqSession\";\nimport { IncomingMessage, ServerResponse } from \"http\";\n\n// Argument types based on getIronSession function\ntype GetIronSessionApiOptions = (\n request: NextApiRequest,\n response: NextApiResponse,\n) => Promise<IronSessionOptions> | IronSessionOptions;\n\nexport function withIronSessionApiRoute(\n handler: NextApiHandler,\n options: IronSessionOptions | GetIronSessionApiOptions,\n): NextApiHandler {\n return async function nextApiHandlerWrappedWithIronSession(req, res) {\n let sessionOptions: IronSessionOptions;\n\n // If options is a function, call it and assign the results back.\n if (options instanceof Function) {\n sessionOptions = await options(req, res);\n } else {\n sessionOptions = options;\n }\n\n const session = await getIronSession(req, res, sessionOptions);\n\n // we define req.session as being enumerable (so console.log(req) shows it)\n // and we also want to allow people to do:\n // req.session = { admin: true }; or req.session = {...req.session, admin: true};\n // req.session.save();\n Object.defineProperty(\n req,\n \"session\",\n getPropertyDescriptorForReqSession(session),\n );\n return handler(req, res);\n };\n}\n\n// Argument type based on the SSR context\ntype GetIronSessionSSROptions = (\n request: IncomingMessage,\n response: ServerResponse,\n) => Promise<IronSessionOptions> | IronSessionOptions;\n\nexport function withIronSessionSsr<\n P extends { [key: string]: unknown } = { [key: string]: unknown },\n>(\n handler: (\n context: GetServerSidePropsContext,\n ) => GetServerSidePropsResult<P> | Promise<GetServerSidePropsResult<P>>,\n options: IronSessionOptions | GetIronSessionSSROptions,\n) {\n return async function nextGetServerSidePropsHandlerWrappedWithIronSession(\n context: GetServerSidePropsContext,\n ) {\n let sessionOptions: IronSessionOptions;\n\n // If options is a function, call it and assign the results back.\n if (options instanceof Function) {\n sessionOptions = await options(context.req, context.res);\n } else {\n sessionOptions = options;\n }\n\n const session = await getIronSession(\n context.req,\n context.res,\n sessionOptions,\n );\n\n Object.defineProperty(\n context.req,\n \"session\",\n getPropertyDescriptorForReqSession(session),\n );\n return handler(context);\n };\n}\n", "import type { IronSession } from \".\";\n\nexport default function getPropertyDescriptorForReqSession(\n session: IronSession,\n): PropertyDescriptor {\n return {\n enumerable: true,\n get() {\n return session;\n },\n set(value) {\n const keys = Object.keys(value);\n const currentKeys = Object.keys(session);\n\n currentKeys.forEach((key) => {\n if (!keys.includes(key)) {\n // @ts-ignore See comment in IronSessionData interface\n delete session[key];\n }\n });\n\n keys.forEach((key) => {\n // @ts-ignore See comment in IronSessionData interface\n session[key] = value[key];\n });\n },\n };\n}\n"],
|
|
5
|
-
"mappings": ";AAQA;;;ACNe,4CACb,SACoB;AACpB,SAAO;AAAA,IACL,YAAY;AAAA,IACZ,MAAM;AACJ,aAAO;AAAA;AAAA,IAET,IAAI,OAAO;AACT,YAAM,OAAO,OAAO,KAAK;AACzB,YAAM,cAAc,OAAO,KAAK;AAEhC,kBAAY,QAAQ,CAAC,QAAQ;AAC3B,YAAI,CAAC,KAAK,SAAS,MAAM;AAEvB,iBAAO,QAAQ;AAAA;AAAA;AAInB,WAAK,QAAQ,CAAC,QAAQ;AAEpB,gBAAQ,OAAO,MAAM;AAAA;AAAA;AAAA;AAAA;;;ADLtB,iCACL,SACA,SACgB;AAChB,SAAO,oDAAoD,KAAK,KAAK;AACnE,QAAI;AAGJ,QAAI,mBAAmB,UAAU;AAC/B,uBAAiB,MAAM,QAAQ,KAAK;AAAA,WAC/B;AACL,uBAAiB;AAAA;AAGnB,UAAM,UAAU,MAAM,eAAe,KAAK,KAAK;AAM/C,WAAO,eACL,KACA,WACA,mCAAmC;AAErC,WAAO,QAAQ,KAAK;AAAA;AAAA;AAUjB,4BAGL,SAGA,SACA;AACA,SAAO,mEACL,SACA;AACA,QAAI;AAGJ,QAAI,mBAAmB,UAAU;AAC/B,uBAAiB,MAAM,QAAQ,QAAQ,KAAK,QAAQ;AAAA,WAC/C;AACL,uBAAiB;AAAA;AAGnB,UAAM,UAAU,MAAM,eACpB,QAAQ,KACR,QAAQ,KACR;AAGF,WAAO,eACL,QAAQ,KACR,WACA,mCAAmC;AAErC,WAAO,QAAQ;AAAA;AAAA;",
|
|
6
|
-
"names": []
|
|
7
|
-
}
|
|
1
|
+
{"version":3,"sources":["../index.ts","../../src/getPropertyDescriptorForReqSession.ts"],"sourcesContent":["import type {\n NextApiHandler,\n GetServerSidePropsContext,\n GetServerSidePropsResult,\n NextApiRequest,\n NextApiResponse,\n} from \"next\";\nimport type { IronSessionOptions } from \"iron-session\";\nimport { getIronSession } from \"iron-session\";\nimport getPropertyDescriptorForReqSession from \"../src/getPropertyDescriptorForReqSession\";\nimport { IncomingMessage, ServerResponse } from \"http\";\n\n// Argument types based on getIronSession function\ntype GetIronSessionApiOptions = (\n request: NextApiRequest,\n response: NextApiResponse,\n) => Promise<IronSessionOptions> | IronSessionOptions;\n\nexport function withIronSessionApiRoute(\n handler: NextApiHandler,\n options: IronSessionOptions | GetIronSessionApiOptions,\n): NextApiHandler {\n return async function nextApiHandlerWrappedWithIronSession(req, res) {\n let sessionOptions: IronSessionOptions;\n\n // If options is a function, call it and assign the results back.\n if (options instanceof Function) {\n sessionOptions = await options(req, res);\n } else {\n sessionOptions = options;\n }\n\n const session = await getIronSession(req, res, sessionOptions);\n\n // we define req.session as being enumerable (so console.log(req) shows it)\n // and we also want to allow people to do:\n // req.session = { admin: true }; or req.session = {...req.session, admin: true};\n // req.session.save();\n Object.defineProperty(\n req,\n \"session\",\n getPropertyDescriptorForReqSession(session),\n );\n return handler(req, res);\n };\n}\n\n// Argument type based on the SSR context\ntype GetIronSessionSSROptions = (\n request: IncomingMessage,\n response: ServerResponse,\n) => Promise<IronSessionOptions> | IronSessionOptions;\n\nexport function withIronSessionSsr<\n P extends { [key: string]: unknown } = { [key: string]: unknown },\n>(\n handler: (\n context: GetServerSidePropsContext,\n ) => GetServerSidePropsResult<P> | Promise<GetServerSidePropsResult<P>>,\n options: IronSessionOptions | GetIronSessionSSROptions,\n) {\n return async function nextGetServerSidePropsHandlerWrappedWithIronSession(\n context: GetServerSidePropsContext,\n ) {\n let sessionOptions: IronSessionOptions;\n\n // If options is a function, call it and assign the results back.\n if (options instanceof Function) {\n sessionOptions = await options(context.req, context.res);\n } else {\n sessionOptions = options;\n }\n\n const session = await getIronSession(\n context.req,\n context.res,\n sessionOptions,\n );\n\n Object.defineProperty(\n context.req,\n \"session\",\n getPropertyDescriptorForReqSession(session),\n );\n return handler(context);\n };\n}\n","import type { IronSession } from \".\";\n\nexport default function getPropertyDescriptorForReqSession(\n session: IronSession,\n): PropertyDescriptor {\n return {\n enumerable: true,\n get() {\n return session;\n },\n set(value) {\n const keys = Object.keys(value);\n const currentKeys = Object.keys(session);\n\n currentKeys.forEach((key) => {\n if (!keys.includes(key)) {\n // @ts-ignore See comment in IronSessionData interface\n delete session[key];\n }\n });\n\n keys.forEach((key) => {\n // @ts-ignore See comment in IronSessionData interface\n session[key] = value[key];\n });\n },\n };\n}\n"],"mappings":";AAQA;;;ACNe,4CACb,SACoB;AACpB,SAAO;AAAA,IACL,YAAY;AAAA,IACZ,MAAM;AACJ,aAAO;AAAA,IACT;AAAA,IACA,IAAI,OAAO;AACT,YAAM,OAAO,OAAO,KAAK,KAAK;AAC9B,YAAM,cAAc,OAAO,KAAK,OAAO;AAEvC,kBAAY,QAAQ,CAAC,QAAQ;AAC3B,YAAI,CAAC,KAAK,SAAS,GAAG,GAAG;AAEvB,iBAAO,QAAQ;AAAA,QACjB;AAAA,MACF,CAAC;AAED,WAAK,QAAQ,CAAC,QAAQ;AAEpB,gBAAQ,OAAO,MAAM;AAAA,MACvB,CAAC;AAAA,IACH;AAAA,EACF;AACF;;;ADTO,iCACL,SACA,SACgB;AAChB,SAAO,oDAAoD,KAAK,KAAK;AACnE,QAAI;AAGJ,QAAI,mBAAmB,UAAU;AAC/B,uBAAiB,MAAM,QAAQ,KAAK,GAAG;AAAA,IACzC,OAAO;AACL,uBAAiB;AAAA,IACnB;AAEA,UAAM,UAAU,MAAM,eAAe,KAAK,KAAK,cAAc;AAM7D,WAAO,eACL,KACA,WACA,mCAAmC,OAAO,CAC5C;AACA,WAAO,QAAQ,KAAK,GAAG;AAAA,EACzB;AACF;AAQO,4BAGL,SAGA,SACA;AACA,SAAO,mEACL,SACA;AACA,QAAI;AAGJ,QAAI,mBAAmB,UAAU;AAC/B,uBAAiB,MAAM,QAAQ,QAAQ,KAAK,QAAQ,GAAG;AAAA,IACzD,OAAO;AACL,uBAAiB;AAAA,IACnB;AAEA,UAAM,UAAU,MAAM,eACpB,QAAQ,KACR,QAAQ,KACR,cACF;AAEA,WAAO,eACL,QAAQ,KACR,WACA,mCAAmC,OAAO,CAC5C;AACA,WAAO,QAAQ,OAAO;AAAA,EACxB;AACF;","names":[]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "iron-session",
|
|
3
|
-
"version": "6.
|
|
3
|
+
"version": "6.2.0-beta.0",
|
|
4
4
|
"description": "Node.js stateless session utility using signed and encrypted cookies to store data. Works with Next.js, Express, NestJs, Fastify, and any Node.js HTTP framework.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"Next.js",
|
|
@@ -32,6 +32,11 @@
|
|
|
32
32
|
"import": "./express/dist/index.mjs",
|
|
33
33
|
"require": "./express/dist/index.js",
|
|
34
34
|
"types": "./express/dist/index.d.ts"
|
|
35
|
+
},
|
|
36
|
+
"./edge": {
|
|
37
|
+
"import": "./edge/dist/index.mjs",
|
|
38
|
+
"require": "./edge/dist/index.js",
|
|
39
|
+
"types": "./edge/dist/index.d.ts"
|
|
35
40
|
}
|
|
36
41
|
},
|
|
37
42
|
"main": "./dist/index.js",
|
|
@@ -40,20 +45,23 @@
|
|
|
40
45
|
"files": [
|
|
41
46
|
"dist/",
|
|
42
47
|
"next/",
|
|
43
|
-
"express/"
|
|
48
|
+
"express/",
|
|
49
|
+
"edge/"
|
|
44
50
|
],
|
|
45
51
|
"scripts": {
|
|
46
|
-
"build": "npm run build:clean && npm run build:src && npm run build:next && npm run build:express",
|
|
47
|
-
"build:clean": "rimraf dist/ next/dist express/dist",
|
|
52
|
+
"build": "npm run build:clean && npm run build:src && npm run build:next && npm run build:express && npm run build:edge",
|
|
53
|
+
"build:clean": "rimraf dist/ next/dist express/dist edge/dist",
|
|
54
|
+
"build:edge": "tsup edge/index.ts -d edge/dist",
|
|
48
55
|
"build:express": "tsup express/index.ts -d express/dist",
|
|
49
56
|
"build:next": "tsup next/index.ts -d next/dist",
|
|
50
57
|
"build:src": "tsup src/index.ts",
|
|
51
58
|
"installExamples": "(cd examples/express && npm ci) && (cd examples/next.js && npm ci) && (cd examples/next.js-typescript && npm ci)",
|
|
52
|
-
"lint": "eslint --ext ts,js,jsx,tsx src/ next/ express/ examples/",
|
|
53
|
-
"prepublishOnly": "npm run build && cp next/dist/* next/ && cp express/dist/* express/",
|
|
54
|
-
"postpublish": "rm next/*.d.ts next/*.js next/*.map next/*.mjs && rm express/*.d.ts express/*.js express/*.map express/*.mjs",
|
|
59
|
+
"lint": "eslint --ext ts,js,jsx,tsx src/ next/ express/ edge/ examples/",
|
|
60
|
+
"prepublishOnly": "npm run build && cp next/dist/* next/ && cp express/dist/* express/ && cp edge/dist/* edge/",
|
|
61
|
+
"postpublish": "rm next/*.d.ts next/*.js next/*.map next/*.mjs && rm express/*.d.ts express/*.js express/*.map express/*.mjs && rm edge/*.d.ts edge/*.js edge/*.map edge/*.mjs",
|
|
55
62
|
"test": "jest --coverage --ci && npm run installExamples && npm run lint && tsc --noEmit && npm run build && npm run build:clean",
|
|
56
63
|
"watch": "npm run build:clean && concurrently \"npm:watch:*\"",
|
|
64
|
+
"watch:edge": "tsup edge/index.ts -d edge/dist --watch edge/index.ts",
|
|
57
65
|
"watch:express": "tsup express/index.ts -d express/dist --watch express/index.ts",
|
|
58
66
|
"watch:next": "tsup next/index.ts -d next/dist --watch next/index.ts",
|
|
59
67
|
"watch:src": "tsup src/index.ts --watch src/index.ts"
|
|
@@ -121,27 +129,28 @@
|
|
|
121
129
|
}
|
|
122
130
|
},
|
|
123
131
|
"dependencies": {
|
|
124
|
-
"@
|
|
132
|
+
"@peculiar/webcrypto": "^1.4.0",
|
|
125
133
|
"@types/cookie": "^0.5.1",
|
|
126
134
|
"@types/express": "^4.17.13",
|
|
127
|
-
"@types/node": "^
|
|
128
|
-
"cookie": "^0.5.0"
|
|
135
|
+
"@types/node": "^17.0.41",
|
|
136
|
+
"cookie": "^0.5.0",
|
|
137
|
+
"iron-webcrypto": "^0.1.0"
|
|
129
138
|
},
|
|
130
139
|
"devDependencies": {
|
|
131
|
-
"@swc/core": "
|
|
132
|
-
"@swc/jest": "
|
|
140
|
+
"@swc/core": "1.2.197",
|
|
141
|
+
"@swc/jest": "0.2.21",
|
|
133
142
|
"@tsconfig/node12": "1.0.9",
|
|
134
|
-
"@types/jest": "
|
|
135
|
-
"@typescript-eslint/eslint-plugin": "
|
|
136
|
-
"@typescript-eslint/parser": "
|
|
137
|
-
"concurrently": "
|
|
138
|
-
"eslint": "
|
|
139
|
-
"jest": "
|
|
140
|
-
"prettier": "
|
|
141
|
-
"prettier-plugin-packagejson": "
|
|
143
|
+
"@types/jest": "28.1.1",
|
|
144
|
+
"@typescript-eslint/eslint-plugin": "5.27.1",
|
|
145
|
+
"@typescript-eslint/parser": "5.27.1",
|
|
146
|
+
"concurrently": "7.2.1",
|
|
147
|
+
"eslint": "8.17.0",
|
|
148
|
+
"jest": "28.1.1",
|
|
149
|
+
"prettier": "2.6.2",
|
|
150
|
+
"prettier-plugin-packagejson": "2.2.18",
|
|
142
151
|
"rimraf": "3.0.2",
|
|
143
|
-
"tsup": "
|
|
144
|
-
"typescript": "
|
|
152
|
+
"tsup": "6.1.0",
|
|
153
|
+
"typescript": "4.7.3"
|
|
145
154
|
},
|
|
146
155
|
"peerDependencies": {
|
|
147
156
|
"express": ">=4",
|