@aws-amplify/adapter-nextjs 1.0.14-unstable.b814567.0 → 1.0.14
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/cjs/api/createServerRunnerForAPI.js.map +1 -1
- package/dist/cjs/api/generateServerClient.js.map +1 -1
- package/dist/cjs/api/index.js.map +1 -1
- package/dist/cjs/createServerRunner.js.map +1 -1
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/types/NextServer.js.map +1 -1
- package/dist/cjs/types/index.js.map +1 -1
- package/dist/cjs/utils/createCookieStorageAdapterFromNextServerContext.js.map +1 -1
- package/dist/cjs/utils/createRunWithAmplifyServerContext.js.map +1 -1
- package/dist/cjs/utils/getAmplifyConfig.js.map +1 -1
- package/dist/cjs/utils/index.js.map +1 -1
- package/dist/esm/api/createServerRunnerForAPI.mjs.map +1 -1
- package/dist/esm/api/generateServerClient.mjs.map +1 -1
- package/dist/esm/createServerRunner.mjs.map +1 -1
- package/dist/esm/types/NextServer.d.ts +11 -18
- package/dist/esm/utils/createCookieStorageAdapterFromNextServerContext.d.ts +1 -1
- package/dist/esm/utils/createCookieStorageAdapterFromNextServerContext.mjs.map +1 -1
- package/dist/esm/utils/createRunWithAmplifyServerContext.mjs.map +1 -1
- package/dist/esm/utils/getAmplifyConfig.mjs.map +1 -1
- package/package.json +71 -74
- package/src/createServerRunner.ts +1 -0
- package/src/types/NextServer.ts +18 -23
- package/src/utils/createCookieStorageAdapterFromNextServerContext.ts +21 -17
- package/src/utils/createRunWithAmplifyServerContext.ts +7 -6
- package/src/utils/getAmplifyConfig.ts +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createServerRunnerForAPI.js","sources":["
|
|
1
|
+
{"version":3,"file":"createServerRunnerForAPI.js","sources":["../../../../src/api/createServerRunnerForAPI.ts"],"sourcesContent":[null],"names":[],"mappings":";;AAAA;AACA;;;AAGA,MAA+E,OAAA,GAAA,OAAA,CAAA,UAAA,CAAA,CAAA;AAGxE,MAAM,wBAAwB,GAAG,CAAC,EACxC,MAAM,GAC8B,KAEjC;AACH,IAAA,MAAM,aAAa,GAAG,IAAA,wBAAgB,EAAC,MAAM,CAAC,CAAC;IAE/C,OAAO;QACN,2BAA2B,EAAE,IAAA,OAAA,CAAA,iCAAiC,EAAC;AAC9D,YAAA,MAAM,EAAE,aAAa;SACrB,CAAC;AACF,QAAA,eAAe,EAAE,aAAa;KAC9B,CAAC;AACH,CAAC,CAAC;AAbW,OAAA,CAAA,wBAAwB,GAanC,wBAAA;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"generateServerClient.js","sources":["
|
|
1
|
+
{"version":3,"file":"generateServerClient.js","sources":["../../../../src/api/generateServerClient.ts"],"sourcesContent":[null],"names":[],"mappings":";;AAAA;AACA;;;AAEA,MAA+E,WAAA,GAAA,OAAA,CAAA,4BAAA,CAAA,CAAA;AAC/E,MAAwD,QAAA,GAAA,OAAA,CAAA,wBAAA,CAAA,CAAA;AACxD,MAGkD,cAAA,GAAA,OAAA,CAAA,0CAAA,CAAA,CAAA;AAOlD,MAAsE,0BAAA,GAAA,OAAA,CAAA,4BAAA,CAAA,CAAA;AACtE,MAA4C,OAAA,GAAA,OAAA,CAAA,UAAA,CAAA,CAAA;AAgB5C;;;;;;;;AAQG;AACH,SAAgB,gCAAgC,CAE9C,EACD,MAAM,EACN,OAAO,EACP,QAAQ,EACR,SAAS,GACY,EAAA;AACrB,IAAA,IAAI,OAAO,OAAO,KAAK,UAAU,EAAE;QAClC,MAAM,IAAI,wCAAyB,CAAC;AACnC,YAAA,OAAO,EACN,yHAAyH;;AAE1H,YAAA,kBAAkB,EACjB,+FAA+F;AAChG,SAAA,CAAC,CAAC;AACH,KAAA;AAED,IAAA,MAAM,EAAE,2BAA2B,EAAE,eAAe,EAAE,GACrD,IAAA,0BAAA,CAAA,wBAAwB,EAAC,EAAE,MAAM,EAAE,CAAC,CAAC;;;;IAKtC,MAAM,UAAU,GAAG,CAAC,EAAkC,KACrD,2BAA2B,CAAC;QAC3B,iBAAiB,EAAE,EAAE,OAAO,EAAE;AAC9B,QAAA,SAAS,EAAE,WAAW,IACrB,EAAE,CAAC,IAAA,cAAA,CAAA,uBAAuB,EAAC,WAAW,CAAC,CAAC,OAAO,CAAC;AACjD,KAAA,CAAC,CAAC;IAEJ,OAAO,IAAA,6CAAiC,EAA2B;AAClE,QAAA,OAAO,EAAE,UAAU;AACnB,QAAA,MAAM,EAAE,eAAe;QACvB,QAAQ;QACR,SAAS;AACT,KAAA,CAAC,CAAC;AACJ,CAAC;AArCD,OAqCC,CAAA,gCAAA,GAAA,gCAAA,CAAA;AAED;;;;;;;;;;;;;;;AAeG;AACH,SAAgB,+BAA+B,CAE7C,EAAE,MAAM,EAAE,QAAQ,EAAE,SAAS,EAAmB,EAAA;AACjD,IAAA,MAAM,aAAa,GAAG,IAAA,wBAAgB,EAAC,MAAM,CAAC,CAAC;IAC/C,OAAO,IAAA,uBAAc,EAAI;AACxB,QAAA,MAAM,EAAE,aAAa;QACrB,QAAQ;QACR,SAAS;AACT,KAAA,CAAC,CAAC;AACJ,CAAC;AATD,OASC,CAAA,+BAAA,GAAA,+BAAA;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../../../src/api/index.ts"],"sourcesContent":[null],"names":[],"mappings":";;AAAA;AACA;;;AAEA,IAGgC,sBAAA,GAAA,OAAA,CAAA,wBAAA,CAAA,CAAA;AAF/B,MAAA,CAAA,cAAA,CAAA,OAAA,EAAA,iCAAA,EAAA,EAAA,UAAA,EAAA,IAAA,EAAA,GAAA,EAAA,YAAA,EAAA,OAAA,sBAAA,CAAA,+BAA+B,CAAA,EAAA,EAAA,CAAA,CAAA;AAC/B,MAAA,CAAA,cAAA,CAAA,OAAA,EAAA,kCAAA,EAAA,EAAA,UAAA,EAAA,IAAA,EAAA,GAAA,EAAA,YAAA,EAAA,OAAA,sBAAA,CAAA,gCAAgC,CAAA,EAAA,EAAA,CAAA;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createServerRunner.js","sources":["
|
|
1
|
+
{"version":3,"file":"createServerRunner.js","sources":["../../../src/createServerRunner.ts"],"sourcesContent":[null],"names":[],"mappings":";;AAAA;AACA;;;AAIA,MAA8E,OAAA,GAAA,OAAA,CAAA,SAAA,CAAA,CAAA;AAG9E;;;;;;;;;;;;;;;;;;AAkBG;AACI,MAAM,kBAAkB,GAAkC,CAAC,EACjE,MAAM,GACN,KAAI;AACJ,IAAA,MAAM,aAAa,GAAG,IAAA,wBAAgB,EAAC,MAAM,CAAC,CAAC;IAE/C,OAAO;QACN,2BAA2B,EAAE,IAAA,OAAA,CAAA,iCAAiC,EAAC;AAC9D,YAAA,MAAM,EAAE,aAAa;SACrB,CAAC;KACF,CAAC;AACH,CAAC,CAAC;AAVW,OAAA,CAAA,kBAAkB,GAU7B,kBAAA;;"}
|
package/dist/cjs/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../../src/index.ts"],"sourcesContent":[null],"names":[],"mappings":";;AAAA;AACA;;;AAEA,IAA0D,oBAAA,GAAA,OAAA,CAAA,sBAAA,CAAA,CAAA;AAAjD,MAAA,CAAA,cAAA,CAAA,OAAA,EAAA,oBAAA,EAAA,EAAA,UAAA,EAAA,IAAA,EAAA,GAAA,EAAA,YAAA,EAAA,OAAA,oBAAA,CAAA,kBAAkB,CAAA,EAAA,EAAA,CAAA;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"NextServer.js","sources":["
|
|
1
|
+
{"version":3,"file":"NextServer.js","sources":["../../../../src/types/NextServer.ts"],"sourcesContent":[null],"names":[],"mappings":";;AAAA;AACA;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../../../src/types/index.ts"],"sourcesContent":[null],"names":[],"mappings":";;AAAA;AACA;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createCookieStorageAdapterFromNextServerContext.js","sources":["../../../src/utils/createCookieStorageAdapterFromNextServerContext.ts"],"sourcesContent":["\"use strict\";\n// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.createCookieStorageAdapterFromNextServerContext = exports.DATE_IN_THE_PAST = void 0;\nconst server_js_1 = require(\"next/server.js\");\nconst adapter_core_1 = require(\"@aws-amplify/core/internals/adapter-core\");\nexports.DATE_IN_THE_PAST = new Date(0);\nconst createCookieStorageAdapterFromNextServerContext = (context) => {\n const { request: req, response: res } = context;\n // When the server context is from `getServerSideProps`, the `req` is an instance\n // of IncomingMessage, and the `res` is an instance of ServerResponse.\n // We cannot import these two classes here from `http` as it breaks in Next\n // Edge Runtime. Hence, we check the methods that we need to use for creating\n // cookie adapter.\n if (req &&\n res &&\n Object.prototype.toString.call(req.cookies) === '[object Object]' &&\n typeof res.setHeader === 'function') {\n return createCookieStorageAdapterFromGetServerSidePropsContext(req, res);\n }\n const { request, response } = context;\n // When the server context is from `middleware`, the `request` is an instance\n // of `NextRequest`.\n // When the server context is from a route handler, the `request` is an `Proxy`\n // wrapped `Request`.\n // The `NextRequest` and the `Proxy` are sharing the same interface by Next\n // implementation. So we don't need to detect the difference.\n if (request && response) {\n if (response instanceof server_js_1.NextResponse) {\n return createCookieStorageAdapterFromNextRequestAndNextResponse(request, response);\n }\n else {\n return createCookieStorageAdapterFromNextRequestAndHttpResponse(request, response);\n }\n }\n const { cookies } = context;\n if (typeof cookies === 'function') {\n return createCookieStorageAdapterFromNextCookies(cookies);\n }\n // This should not happen normally.\n throw new adapter_core_1.AmplifyServerContextError({\n message: 'Attempted to create cookie storage adapter from an unsupported Next.js server context.',\n });\n};\nexports.createCookieStorageAdapterFromNextServerContext = createCookieStorageAdapterFromNextServerContext;\nconst createCookieStorageAdapterFromNextRequestAndNextResponse = (request, response) => {\n const readonlyCookieStore = request.cookies;\n const mutableCookieStore = response.cookies;\n return {\n get(name) {\n return readonlyCookieStore.get(ensureEncodedForJSCookie(name));\n },\n getAll: readonlyCookieStore.getAll.bind(readonlyCookieStore),\n set(name, value, options) {\n mutableCookieStore.set(ensureEncodedForJSCookie(name), value, options);\n },\n delete(name) {\n mutableCookieStore.delete(ensureEncodedForJSCookie(name));\n },\n };\n};\nconst createCookieStorageAdapterFromNextRequestAndHttpResponse = (request, response) => {\n const readonlyCookieStore = request.cookies;\n const mutableCookieStore = createMutableCookieStoreFromHeaders(response.headers);\n return {\n get(name) {\n return readonlyCookieStore.get(ensureEncodedForJSCookie(name));\n },\n getAll: readonlyCookieStore.getAll.bind(readonlyCookieStore),\n ...mutableCookieStore,\n };\n};\nconst createCookieStorageAdapterFromNextCookies = (cookies) => {\n const cookieStore = cookies();\n // When Next cookies() is called in a server component, it returns a readonly\n // cookie store. Hence calling set and delete throws an error. However,\n // cookies() returns a mutable cookie store when called in a server action.\n // We have no way to detect which one is returned, so we try to call set and delete\n // and safely ignore the error if it is thrown.\n const setFunc = (name, value, options) => {\n try {\n cookieStore.set(ensureEncodedForJSCookie(name), value, options);\n }\n catch {\n // no-op\n }\n };\n const deleteFunc = name => {\n try {\n cookieStore.delete(ensureEncodedForJSCookie(name));\n }\n catch {\n // no-op\n }\n };\n return {\n get(name) {\n return cookieStore.get(ensureEncodedForJSCookie(name));\n },\n getAll: cookieStore.getAll.bind(cookieStore),\n set: setFunc,\n delete: deleteFunc,\n };\n};\nconst createCookieStorageAdapterFromGetServerSidePropsContext = (request, response) => {\n const cookiesMap = { ...request.cookies };\n const allCookies = Object.entries(cookiesMap).map(([name, value]) => ({\n name,\n value,\n }));\n return {\n get(name) {\n const value = cookiesMap[ensureEncodedForJSCookie(name)];\n return value\n ? {\n name,\n value,\n }\n : undefined;\n },\n getAll() {\n return allCookies;\n },\n set(name, value, options) {\n response.setHeader('Set-Cookie', `${ensureEncodedForJSCookie(name)}=${value};${options ? serializeSetCookieOptions(options) : ''}`);\n },\n delete(name) {\n response.setHeader('Set-Cookie', `${ensureEncodedForJSCookie(name)}=;Expires=${exports.DATE_IN_THE_PAST.toUTCString()}`);\n },\n };\n};\nconst createMutableCookieStoreFromHeaders = (headers) => {\n const setFunc = (name, value, options) => {\n headers.append('Set-Cookie', `${ensureEncodedForJSCookie(name)}=${value};${options ? serializeSetCookieOptions(options) : ''}`);\n };\n const deleteFunc = name => {\n headers.append('Set-Cookie', `${ensureEncodedForJSCookie(name)}=;Expires=${exports.DATE_IN_THE_PAST.toUTCString()}`);\n };\n return {\n set: setFunc,\n delete: deleteFunc,\n };\n};\nconst serializeSetCookieOptions = (options) => {\n const { expires, domain, httpOnly, sameSite, secure } = options;\n const serializedOptions = [];\n if (domain) {\n serializedOptions.push(`Domain=${domain}`);\n }\n if (expires) {\n serializedOptions.push(`Expires=${expires.toUTCString()}`);\n }\n if (httpOnly) {\n serializedOptions.push(`HttpOnly`);\n }\n if (sameSite) {\n serializedOptions.push(`SameSite=${sameSite}`);\n }\n if (secure) {\n serializedOptions.push(`Secure`);\n }\n return serializedOptions.join(';');\n};\n// Ensures the cookie names are encoded in order to look up the cookie store\n// that is manipulated by js-cookie on the client side.\n// Details of the js-cookie encoding behavior see:\n// https://github.com/js-cookie/js-cookie#encoding\n// The implementation is borrowed from js-cookie without escaping `[()]` as\n// we are not using those chars in the auth keys.\nconst ensureEncodedForJSCookie = (name) => encodeURIComponent(name).replace(/%(2[346B]|5E|60|7C)/g, decodeURIComponent);\n"],"names":[],"mappings":";;AACA;AACA;AACA,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,YAAY,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC;AAC9D,OAAO,CAAC,+CAA+C,GAAG,OAAO,CAA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zC,KAAK;AACL,IAAI,OAAO,iBAAiB,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AACvC,CAAC,CAAC;AACF;AACA;AACA;AACA;AACA;AACA;AACA,MAAM,wBAAwB,GAAG,CAAC,IAAI,KAAK,kBAAkB,CAAC,IAAI,CAAC,CAAC,OAAO,CAAC,sBAAsB,EAAE,kBAAkB,CAAC;;"}
|
|
1
|
+
{"version":3,"file":"createCookieStorageAdapterFromNextServerContext.js","sources":["../../../../src/utils/createCookieStorageAdapterFromNextServerContext.ts"],"sourcesContent":[null],"names":[],"mappings":";;AAAA;AACA;;;AAEA,MAA2D,WAAA,GAAA,OAAA,CAAA,gBAAA,CAAA,CAAA;AAC3D,MAGkD,cAAA,GAAA,OAAA,CAAA,0CAAA,CAAA,CAAA;AAIrC,OAAA,CAAA,gBAAgB,GAAG,IAAI,IAAI,CAAC,CAAC,CAAC,CAAC;AAErC,MAAM,+CAA+C,GAAG,CAC9D,OAA2B,KACD;IAC1B,MAAM,EAAE,OAAO,EAAE,GAAG,EAAE,QAAQ,EAAE,GAAG,EAAE,GACpC,OAAwD,CAAC;;;;;;AAO1D,IAAA,IACC,GAAG;QACH,GAAG;AACH,QAAA,MAAM,CAAC,SAAS,CAAC,QAAQ,CAAC,IAAI,CAAC,GAAG,CAAC,OAAO,CAAC,KAAK,iBAAiB;AACjE,QAAA,OAAO,GAAG,CAAC,SAAS,KAAK,UAAU,EAClC;AACD,QAAA,OAAO,uDAAuD,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC;AACzE,KAAA;AAED,IAAA,MAAM,EAAE,OAAO,EAAE,QAAQ,EAAE,GAAG,OAG7B,CAAC;;;;;;;IAQF,IAAI,OAAO,IAAI,QAAQ,EAAE;QACxB,IAAI,QAAQ,YAAY,WAAA,CAAA,YAAY,EAAE;AACrC,YAAA,OAAO,wDAAwD,CAC9D,OAAO,EACP,QAAQ,CACR,CAAC;AACF,SAAA;AAAM,aAAA;AACN,YAAA,OAAO,wDAAwD,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C7C,kBAAkB,CAAC,IAAI,CAAC,CAAC,OAAO,CAAC,sBAAsB,EAAE,kBAAkB,CAAC;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createRunWithAmplifyServerContext.js","sources":["
|
|
1
|
+
{"version":3,"file":"createRunWithAmplifyServerContext.js","sources":["../../../../src/utils/createRunWithAmplifyServerContext.ts"],"sourcesContent":[null],"names":[],"mappings":";;AAAA;AACA;;;AAEA,MAA2E,MAAA,GAAA,OAAA,CAAA,mBAAA,CAAA,CAAA;AAC3E,MAKkC,cAAA,GAAA,OAAA,CAAA,0BAAA,CAAA,CAAA;AAIlC,MAAoH,iDAAA,GAAA,OAAA,CAAA,mDAAA,CAAA,CAAA;AAE7G,MAAM,iCAAiC,GAAG,CAAC,EACjD,MAAM,EAAE,eAAe,GAGvB,KAAI;IACJ,MAAM,2BAA2B,GAChC,OAAO,EAAE,iBAAiB,EAAE,SAAS,EAAE,KAAI;;;QAG1C,IAAI,eAAe,CAAC,IAAI,EAAE;AACzB,YAAA,MAAM,eAAe;;;;;AAKpB,YAAA,iBAAiB,KAAK,IAAI;AACzB,kBAAE,MAAqB,CAAA,qBAAA;kBACrB,IAAA,cAAA,CAAA,6CAA6C,EAC7C,IAAA,iGAA+C,EAC9C,iBAAiB,CACjB,CACA,CAAC;YACN,MAAM,mBAAmB,GAAG,IAAA,cAAyC,CAAA,yCAAA,EACpE,eAAe,CAAC,IAAI,EACpB,eAAe,CACf,CAAC;YACF,MAAM,aAAa,GAAG,IAAA,cAA4B,CAAA,4BAAA,EACjD,eAAe,CAAC,IAAI,EACpB,eAAe,CACf,CAAC;AAEF,YAAA,OAAO,IAAA,cAAA,CAAA,2BAA+B,EACrC,eAAe,EACf;AACC,gBAAA,IAAI,EAAE,EAAE,mBAAmB,EAAE,aAAa,EAAE;aAC5C,EACD,SAAS,CACT,CAAC;AACF,SAAA;;;QAID,OAAO,IAAA,0CAA+B,EAAC,eAAe,EAAE,EAAE,EAAE,SAAS,CAAC,CAAC;AACxE,KAAC,CAAC;AAEH,IAAA,OAAO,2BAA2B,CAAC;AACpC,CAAC,CAAC;AA9CW,OAAA,CAAA,iCAAiC,GA8C5C,iCAAA;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getAmplifyConfig.js","sources":["
|
|
1
|
+
{"version":3,"file":"getAmplifyConfig.js","sources":["../../../../src/utils/getAmplifyConfig.ts"],"sourcesContent":[null],"names":[],"mappings":";;AAAA;AACA;;;AAIA,MAAoE,OAAA,GAAA,OAAA,CAAA,mCAAA,CAAA,CAAA;AAE7D,MAAM,gBAAgB,GAAG,CAC/B,MAAsC,KAEtC,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,IAAI,CAAC,GAAG,IAAI,GAAG,CAAC,UAAU,CAAC,MAAM,CAAC,CAAC;AACtD,MAAE,IAAA,OAAe,CAAA,eAAA,EAAC,MAAM,CAAC;MACtB,MAA0B,CAAC;AALnB,OAAA,CAAA,gBAAgB,GAKG,gBAAA;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../../../src/utils/index.ts"],"sourcesContent":[null],"names":[],"mappings":";;AAAA;AACA;;;AAEA,IAAsD,kBAAA,GAAA,OAAA,CAAA,oBAAA,CAAA,CAAA;AAA7C,MAAA,CAAA,cAAA,CAAA,OAAA,EAAA,kBAAA,EAAA,EAAA,UAAA,EAAA,IAAA,EAAA,GAAA,EAAA,YAAA,EAAA,OAAA,kBAAA,CAAA,gBAAgB,CAAA,EAAA,EAAA,CAAA,CAAA;AACzB,IAAwF,mCAAA,GAAA,OAAA,CAAA,qCAAA,CAAA,CAAA;AAA/E,MAAA,CAAA,cAAA,CAAA,OAAA,EAAA,mCAAA,EAAA,EAAA,UAAA,EAAA,IAAA,EAAA,GAAA,EAAA,YAAA,EAAA,OAAA,mCAAA,CAAA,iCAAiC,CAAA,EAAA,EAAA,CAAA;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createServerRunnerForAPI.mjs","sources":["
|
|
1
|
+
{"version":3,"file":"createServerRunnerForAPI.mjs","sources":["../../../../src/api/createServerRunnerForAPI.ts"],"sourcesContent":[null],"names":[],"mappings":";;;AAAA;AACA;MAMa,wBAAwB,GAAG,CAAC,EACxC,MAAM,GAC8B,KAEjC;AACH,IAAA,MAAM,aAAa,GAAG,gBAAgB,CAAC,MAAM,CAAC,CAAC;IAE/C,OAAO;QACN,2BAA2B,EAAE,iCAAiC,CAAC;AAC9D,YAAA,MAAM,EAAE,aAAa;SACrB,CAAC;AACF,QAAA,eAAe,EAAE,aAAa;KAC9B,CAAC;AACH;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"generateServerClient.mjs","sources":["
|
|
1
|
+
{"version":3,"file":"generateServerClient.mjs","sources":["../../../../src/api/generateServerClient.ts"],"sourcesContent":[null],"names":[],"mappings":";;;;;;;;;AAAA;AACA;AA+BA;;;;;;;;AAQG;AACG,SAAU,gCAAgC,CAE9C,EACD,MAAM,EACN,OAAO,EACP,QAAQ,EACR,SAAS,GACY,EAAA;AACrB,IAAA,IAAI,OAAO,OAAO,KAAK,UAAU,EAAE;QAClC,MAAM,IAAI,yBAAyB,CAAC;AACnC,YAAA,OAAO,EACN,yHAAyH;;AAE1H,YAAA,kBAAkB,EACjB,+FAA+F;AAChG,SAAA,CAAC,CAAC;AACH,KAAA;AAED,IAAA,MAAM,EAAE,2BAA2B,EAAE,eAAe,EAAE,GACrD,wBAAwB,CAAC,EAAE,MAAM,EAAE,CAAC,CAAC;;;;IAKtC,MAAM,UAAU,GAAG,CAAC,EAAkC,KACrD,2BAA2B,CAAC;QAC3B,iBAAiB,EAAE,EAAE,OAAO,EAAE;AAC9B,QAAA,SAAS,EAAE,WAAW,IACrB,EAAE,CAAC,uBAAuB,CAAC,WAAW,CAAC,CAAC,OAAO,CAAC;AACjD,KAAA,CAAC,CAAC;AAEJ,IAAA,OAAO,iCAAiC,CAA2B;AAClE,QAAA,OAAO,EAAE,UAAU;AACnB,QAAA,MAAM,EAAE,eAAe;QACvB,QAAQ;QACR,SAAS;AACT,KAAA,CAAC,CAAC;AACJ,CAAC;AAED;;;;;;;;;;;;;;;AAeG;AACG,SAAU,+BAA+B,CAE7C,EAAE,MAAM,EAAE,QAAQ,EAAE,SAAS,EAAmB,EAAA;AACjD,IAAA,MAAM,aAAa,GAAG,gBAAgB,CAAC,MAAM,CAAC,CAAC;AAC/C,IAAA,OAAO,cAAc,CAAI;AACxB,QAAA,MAAM,EAAE,aAAa;QACrB,QAAQ;QACR,SAAS;AACT,KAAA,CAAC,CAAC;AACJ;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createServerRunner.mjs","sources":["
|
|
1
|
+
{"version":3,"file":"createServerRunner.mjs","sources":["../../../src/createServerRunner.ts"],"sourcesContent":[null],"names":[],"mappings":";;;AAAA;AACA;AAOA;;;;;;;;;;;;;;;;;;AAkBG;MACU,kBAAkB,GAAkC,CAAC,EACjE,MAAM,GACN,KAAI;AACJ,IAAA,MAAM,aAAa,GAAG,gBAAgB,CAAC,MAAM,CAAC,CAAC;IAE/C,OAAO;QACN,2BAA2B,EAAE,iCAAiC,CAAC;AAC9D,YAAA,MAAM,EAAE,aAAa;SACrB,CAAC;KACF,CAAC;AACH;;;;"}
|
|
@@ -11,60 +11,53 @@ export declare namespace NextServer {
|
|
|
11
11
|
* - Next App Router [route handler](https://nextjs.org/docs/app/building-your-application/routing/route-handlers)
|
|
12
12
|
* when using `NextResponse` to create the response of the route handler
|
|
13
13
|
*/
|
|
14
|
-
|
|
14
|
+
interface NextRequestAndNextResponseContext {
|
|
15
15
|
request: NextRequest;
|
|
16
16
|
response: NextResponse;
|
|
17
|
-
}
|
|
17
|
+
}
|
|
18
18
|
/**
|
|
19
19
|
* This context is normally available in the following:
|
|
20
20
|
* - Next App Router [route handler](https://nextjs.org/docs/app/building-your-application/routing/route-handlers)
|
|
21
21
|
* when using the Web API [`Response`](https://developer.mozilla.org/en-US/docs/Web/API/Response)
|
|
22
22
|
* to create the response of the route handler
|
|
23
23
|
*/
|
|
24
|
-
|
|
24
|
+
interface NextRequestAndResponseContext {
|
|
25
25
|
request: NextRequest;
|
|
26
26
|
response: Response;
|
|
27
|
-
}
|
|
27
|
+
}
|
|
28
28
|
/**
|
|
29
29
|
* This context is normally available in the following:
|
|
30
30
|
* - Next [Server Component](https://nextjs.org/docs/getting-started/react-essentials#server-components)
|
|
31
31
|
* where the [`cookies`](https://nextjs.org/docs/app/api-reference/functions/cookies)
|
|
32
32
|
* function can be imported and called
|
|
33
33
|
*/
|
|
34
|
-
|
|
34
|
+
interface ServerComponentContext {
|
|
35
35
|
cookies: typeof cookies;
|
|
36
|
-
}
|
|
36
|
+
}
|
|
37
37
|
type ServerActionContext = ServerComponentContext;
|
|
38
38
|
/**
|
|
39
39
|
* This context is normally available in the
|
|
40
40
|
* [`getServerSideProps`](https://nextjs.org/docs/pages/building-your-application/data-fetching/get-server-side-props)
|
|
41
41
|
* function of the Next Pages Router.
|
|
42
42
|
*/
|
|
43
|
-
|
|
43
|
+
interface GetServerSidePropsContext {
|
|
44
44
|
request: NextGetServerSidePropsContext['req'];
|
|
45
45
|
response: NextGetServerSidePropsContext['res'];
|
|
46
|
-
}
|
|
46
|
+
}
|
|
47
47
|
/**
|
|
48
48
|
* The union of possible Next.js app server context types.
|
|
49
49
|
*/
|
|
50
50
|
type Context = NextRequestAndNextResponseContext | NextRequestAndResponseContext | ServerComponentContext | GetServerSidePropsContext;
|
|
51
|
-
/**
|
|
52
|
-
* The interface of the input of {@link RunOperationWithContext}.
|
|
53
|
-
*/
|
|
54
51
|
interface RunWithContextInput<OperationResult> {
|
|
55
52
|
nextServerContext: Context | null;
|
|
56
|
-
operation
|
|
57
|
-
}
|
|
58
|
-
interface RunOperationWithContext {
|
|
59
|
-
<OperationResult>(input: RunWithContextInput<OperationResult>): Promise<OperationResult>;
|
|
53
|
+
operation(contextSpec: AmplifyServer.ContextSpec): OperationResult | Promise<OperationResult>;
|
|
60
54
|
}
|
|
55
|
+
type RunOperationWithContext = <OperationResult>(input: RunWithContextInput<OperationResult>) => Promise<OperationResult>;
|
|
61
56
|
interface CreateServerRunnerInput {
|
|
62
57
|
config: ResourcesConfig | LegacyConfig;
|
|
63
58
|
}
|
|
64
59
|
interface CreateServerRunnerOutput {
|
|
65
60
|
runWithAmplifyServerContext: RunOperationWithContext;
|
|
66
61
|
}
|
|
67
|
-
|
|
68
|
-
(input: CreateServerRunnerInput): CreateServerRunnerOutput;
|
|
69
|
-
}
|
|
62
|
+
type CreateServerRunner = (input: CreateServerRunnerInput) => CreateServerRunnerOutput;
|
|
70
63
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { NextServer } from '../types';
|
|
2
1
|
import { CookieStorage } from '@aws-amplify/core/internals/adapter-core';
|
|
2
|
+
import { NextServer } from '../types';
|
|
3
3
|
export declare const DATE_IN_THE_PAST: Date;
|
|
4
4
|
export declare const createCookieStorageAdapterFromNextServerContext: (context: NextServer.Context) => CookieStorage.Adapter;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createCookieStorageAdapterFromNextServerContext.mjs","sources":["../../../src/utils/createCookieStorageAdapterFromNextServerContext.ts"],"sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport { NextResponse } from 'next/server.js';\nimport { AmplifyServerContextError, } from '@aws-amplify/core/internals/adapter-core';\nexport const DATE_IN_THE_PAST = new Date(0);\nexport const createCookieStorageAdapterFromNextServerContext = (context) => {\n const { request: req, response: res } = context;\n // When the server context is from `getServerSideProps`, the `req` is an instance\n // of IncomingMessage, and the `res` is an instance of ServerResponse.\n // We cannot import these two classes here from `http` as it breaks in Next\n // Edge Runtime. Hence, we check the methods that we need to use for creating\n // cookie adapter.\n if (req &&\n res &&\n Object.prototype.toString.call(req.cookies) === '[object Object]' &&\n typeof res.setHeader === 'function') {\n return createCookieStorageAdapterFromGetServerSidePropsContext(req, res);\n }\n const { request, response } = context;\n // When the server context is from `middleware`, the `request` is an instance\n // of `NextRequest`.\n // When the server context is from a route handler, the `request` is an `Proxy`\n // wrapped `Request`.\n // The `NextRequest` and the `Proxy` are sharing the same interface by Next\n // implementation. So we don't need to detect the difference.\n if (request && response) {\n if (response instanceof NextResponse) {\n return createCookieStorageAdapterFromNextRequestAndNextResponse(request, response);\n }\n else {\n return createCookieStorageAdapterFromNextRequestAndHttpResponse(request, response);\n }\n }\n const { cookies } = context;\n if (typeof cookies === 'function') {\n return createCookieStorageAdapterFromNextCookies(cookies);\n }\n // This should not happen normally.\n throw new AmplifyServerContextError({\n message: 'Attempted to create cookie storage adapter from an unsupported Next.js server context.',\n });\n};\nconst createCookieStorageAdapterFromNextRequestAndNextResponse = (request, response) => {\n const readonlyCookieStore = request.cookies;\n const mutableCookieStore = response.cookies;\n return {\n get(name) {\n return readonlyCookieStore.get(ensureEncodedForJSCookie(name));\n },\n getAll: readonlyCookieStore.getAll.bind(readonlyCookieStore),\n set(name, value, options) {\n mutableCookieStore.set(ensureEncodedForJSCookie(name), value, options);\n },\n delete(name) {\n mutableCookieStore.delete(ensureEncodedForJSCookie(name));\n },\n };\n};\nconst createCookieStorageAdapterFromNextRequestAndHttpResponse = (request, response) => {\n const readonlyCookieStore = request.cookies;\n const mutableCookieStore = createMutableCookieStoreFromHeaders(response.headers);\n return {\n get(name) {\n return readonlyCookieStore.get(ensureEncodedForJSCookie(name));\n },\n getAll: readonlyCookieStore.getAll.bind(readonlyCookieStore),\n ...mutableCookieStore,\n };\n};\nconst createCookieStorageAdapterFromNextCookies = (cookies) => {\n const cookieStore = cookies();\n // When Next cookies() is called in a server component, it returns a readonly\n // cookie store. Hence calling set and delete throws an error. However,\n // cookies() returns a mutable cookie store when called in a server action.\n // We have no way to detect which one is returned, so we try to call set and delete\n // and safely ignore the error if it is thrown.\n const setFunc = (name, value, options) => {\n try {\n cookieStore.set(ensureEncodedForJSCookie(name), value, options);\n }\n catch {\n // no-op\n }\n };\n const deleteFunc = name => {\n try {\n cookieStore.delete(ensureEncodedForJSCookie(name));\n }\n catch {\n // no-op\n }\n };\n return {\n get(name) {\n return cookieStore.get(ensureEncodedForJSCookie(name));\n },\n getAll: cookieStore.getAll.bind(cookieStore),\n set: setFunc,\n delete: deleteFunc,\n };\n};\nconst createCookieStorageAdapterFromGetServerSidePropsContext = (request, response) => {\n const cookiesMap = { ...request.cookies };\n const allCookies = Object.entries(cookiesMap).map(([name, value]) => ({\n name,\n value,\n }));\n return {\n get(name) {\n const value = cookiesMap[ensureEncodedForJSCookie(name)];\n return value\n ? {\n name,\n value,\n }\n : undefined;\n },\n getAll() {\n return allCookies;\n },\n set(name, value, options) {\n response.setHeader('Set-Cookie', `${ensureEncodedForJSCookie(name)}=${value};${options ? serializeSetCookieOptions(options) : ''}`);\n },\n delete(name) {\n response.setHeader('Set-Cookie', `${ensureEncodedForJSCookie(name)}=;Expires=${DATE_IN_THE_PAST.toUTCString()}`);\n },\n };\n};\nconst createMutableCookieStoreFromHeaders = (headers) => {\n const setFunc = (name, value, options) => {\n headers.append('Set-Cookie', `${ensureEncodedForJSCookie(name)}=${value};${options ? serializeSetCookieOptions(options) : ''}`);\n };\n const deleteFunc = name => {\n headers.append('Set-Cookie', `${ensureEncodedForJSCookie(name)}=;Expires=${DATE_IN_THE_PAST.toUTCString()}`);\n };\n return {\n set: setFunc,\n delete: deleteFunc,\n };\n};\nconst serializeSetCookieOptions = (options) => {\n const { expires, domain, httpOnly, sameSite, secure } = options;\n const serializedOptions = [];\n if (domain) {\n serializedOptions.push(`Domain=${domain}`);\n }\n if (expires) {\n serializedOptions.push(`Expires=${expires.toUTCString()}`);\n }\n if (httpOnly) {\n serializedOptions.push(`HttpOnly`);\n }\n if (sameSite) {\n serializedOptions.push(`SameSite=${sameSite}`);\n }\n if (secure) {\n serializedOptions.push(`Secure`);\n }\n return serializedOptions.join(';');\n};\n// Ensures the cookie names are encoded in order to look up the cookie store\n// that is manipulated by js-cookie on the client side.\n// Details of the js-cookie encoding behavior see:\n// https://github.com/js-cookie/js-cookie#encoding\n// The implementation is borrowed from js-cookie without escaping `[()]` as\n// we are not using those chars in the auth keys.\nconst ensureEncodedForJSCookie = (name) => encodeURIComponent(name).replace(/%(2[346B]|5E|60|7C)/g, decodeURIComponent);\n"],"names":[],"mappings":";;;AAAA;AACA;AAGY,MAAC,gBAAgB,GAAG,IAAI,IAAI,CAAC,CAAC,EAAE;AAChC,MAAC,+CAA+C,GAAG,CAAC,OAAO,KAAK;AAC5E,IAAI,MAAM,EAAE,OAAO,EAAE,GAAG,EAAE,QAAQ,EAAE,GAAG,EAAE,GAAG,OAAO,CAAC;AACpD;AACA;AACA;AACA;AACA;AACA,IAAI,IAAI,GAAG;AACX,QAAQ,GAAG;AACX,QAAQ,MAAM,CAAC,SAAS,CAAC,QAAQ,CAAC,IAAI,CAAC,GAAG,CAAC,OAAO,CAAC,KAAK,iBAAiB;AACzE,QAAQ,OAAO,GAAG,CAAC,SAAS,KAAK,UAAU,EAAE;AAC7C,QAAQ,OAAO,uDAAuD,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC;AACjF,KAAK;AACL,IAAI,MAAM,EAAE,OAAO,EAAE,QAAQ,EAAE,GAAG,OAAO,CAAC;AAC1C;AACA;AACA;AACA;AACA;AACA;AACA,IAAI,IAAI,OAAO,IAAI,QAAQ,EAAE;AAC7B,QAAQ,IAAI,QAAQ,YAAY,YAAY,EAAE;AAC9C,YAAY,OAAO,wDAAwD,CAAC,OAAO,EAAE,QAAQ,CAAC,CAAC;AAC/F,SAAS;AACT,aAAa;AACb,YAAY,OAAO,wDAAwD,CAAC,OAAO,EAAE,QAAQ,CAAC,CAAC;AAC/F,SAAS;AACT,KAAK;AACL,IAAI,MAAM,EAAE,OAAO,EAAE,GAAG,OAAO,CAAC;AAChC,IAAI,IAAI,O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AI,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC;AACzC,KAAK;AACL,IAAI,OAAO,iBAAiB,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AACvC,CAAC,CAAC;AACF;AACA;AACA;AACA;AACA;AACA;AACA,MAAM,wBAAwB,GAAG,CAAC,IAAI,KAAK,kBAAkB,CAAC,IAAI,CAAC,CAAC,OAAO,CAAC,sBAAsB,EAAE,kBAAkB,CAAC;;;;"}
|
|
1
|
+
{"version":3,"file":"createCookieStorageAdapterFromNextServerContext.mjs","sources":["../../../../src/utils/createCookieStorageAdapterFromNextServerContext.ts"],"sourcesContent":[null],"names":[],"mappings":";;;AAAA;AACA;MAUa,gBAAgB,GAAG,IAAI,IAAI,CAAC,CAAC,EAAE;AAE/B,MAAA,+CAA+C,GAAG,CAC9D,OAA2B,KACD;IAC1B,MAAM,EAAE,OAAO,EAAE,GAAG,EAAE,QAAQ,EAAE,GAAG,EAAE,GACpC,OAAwD,CAAC;;;;;;AAO1D,IAAA,IACC,GAAG;QACH,GAAG;AACH,QAAA,MAAM,CAAC,SAAS,CAAC,QAAQ,CAAC,IAAI,CAAC,GAAG,CAAC,OAAO,CAAC,KAAK,iBAAiB;AACjE,QAAA,OAAO,GAAG,CAAC,SAAS,KAAK,UAAU,EAClC;AACD,QAAA,OAAO,uDAAuD,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC;AACzE,KAAA;AAED,IAAA,MAAM,EAAE,OAAO,EAAE,QAAQ,EAAE,GAAG,OAG7B,CAAC;;;;;;;IAQF,IAAI,OAAO,IAAI,QAAQ,EAAE;QACxB,IAAI,QAAQ,YAAY,YAAY,EAAE;AACrC,YAAA,OAAO,wDAAwD,CAC9D,OAAO,EACP,QAAQ,CACR,CAAC;AACF,SAAA;AAAM,aAAA;AACN,YAAA,OAAO,wDAAwD,CAC9D,OAAO,EACP,QAAQ,CACR,CAAC;AACF,SAAA;AACD,KAAA;AAED,IAAA,MAAM,EAAE,OAAO,EAAE,GAAG,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,"file":"createRunWithAmplifyServerContext.mjs","sources":["../../../../src/utils/createRunWithAmplifyServerContext.ts"],"sourcesContent":[null],"names":["runWithAmplifyServerContext","runWithAmplifyServerContextCore"],"mappings":";;;;AAAA;AACA;AAca,MAAA,iCAAiC,GAAG,CAAC,EACjD,MAAM,EAAE,eAAe,GAGvB,KAAI;IACJ,MAAMA,6BAA2B,GAChC,OAAO,EAAE,iBAAiB,EAAE,SAAS,EAAE,KAAI;;;QAG1C,IAAI,eAAe,CAAC,IAAI,EAAE;AACzB,YAAA,MAAM,eAAe;;;;;AAKpB,YAAA,iBAAiB,KAAK,IAAI;AACzB,kBAAE,qBAAqB;kBACrB,6CAA6C,CAC7C,+CAA+C,CAC9C,iBAAiB,CACjB,CACA,CAAC;YACN,MAAM,mBAAmB,GAAG,yCAAyC,CACpE,eAAe,CAAC,IAAI,EACpB,eAAe,CACf,CAAC;YACF,MAAM,aAAa,GAAG,4BAA4B,CACjD,eAAe,CAAC,IAAI,EACpB,eAAe,CACf,CAAC;YAEF,OAAOC,2BAA+B,CACrC,eAAe,EACf;AACC,gBAAA,IAAI,EAAE,EAAE,mBAAmB,EAAE,aAAa,EAAE;aAC5C,EACD,SAAS,CACT,CAAC;AACF,SAAA;;;QAID,OAAOA,2BAA+B,CAAC,eAAe,EAAE,EAAE,EAAE,SAAS,CAAC,CAAC;AACxE,KAAC,CAAC;AAEH,IAAA,OAAOD,6BAA2B,CAAC;AACpC;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getAmplifyConfig.mjs","sources":["
|
|
1
|
+
{"version":3,"file":"getAmplifyConfig.mjs","sources":["../../../../src/utils/getAmplifyConfig.ts"],"sourcesContent":[null],"names":[],"mappings":";;AAAA;AACA;AAMO,MAAM,gBAAgB,GAAG,CAC/B,MAAsC,KAEtC,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,IAAI,CAAC,GAAG,IAAI,GAAG,CAAC,UAAU,CAAC,MAAM,CAAC,CAAC;AACtD,MAAE,eAAe,CAAC,MAAM,CAAC;MACtB;;;;"}
|
package/package.json
CHANGED
|
@@ -1,76 +1,73 @@
|
|
|
1
1
|
{
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
"ts-coverage": "typescript-coverage-report -p ./tsconfig.build.json -t 90.31"
|
|
74
|
-
},
|
|
75
|
-
"gitHead": "b814567adf4cc3cdaad38fe94580d90697ee521a"
|
|
2
|
+
"author": "Amazon Web Services",
|
|
3
|
+
"name": "@aws-amplify/adapter-nextjs",
|
|
4
|
+
"version": "1.0.14",
|
|
5
|
+
"description": "The adapter for the supporting of using Amplify APIs in Next.js.",
|
|
6
|
+
"peerDependencies": {
|
|
7
|
+
"aws-amplify": "^6.0.7",
|
|
8
|
+
"next": ">=13.5.0 <15.0.0"
|
|
9
|
+
},
|
|
10
|
+
"dependencies": {
|
|
11
|
+
"cookie": "0.5.0"
|
|
12
|
+
},
|
|
13
|
+
"devDependencies": {
|
|
14
|
+
"@types/cookie": "0.5.1",
|
|
15
|
+
"@types/node": "^20.3.1",
|
|
16
|
+
"@types/react": "^18.2.13",
|
|
17
|
+
"@types/react-dom": "^18.2.6",
|
|
18
|
+
"aws-amplify": "6.0.14",
|
|
19
|
+
"jest-fetch-mock": "3.0.3",
|
|
20
|
+
"next": ">= 13.5.0 < 15.0.0"
|
|
21
|
+
},
|
|
22
|
+
"publishConfig": {
|
|
23
|
+
"access": "public"
|
|
24
|
+
},
|
|
25
|
+
"bugs": {
|
|
26
|
+
"url": "https://github.com/aws/aws-amplify/issues"
|
|
27
|
+
},
|
|
28
|
+
"exports": {
|
|
29
|
+
".": {
|
|
30
|
+
"types": "./dist/esm/index.d.ts",
|
|
31
|
+
"import": "./dist/esm/index.mjs",
|
|
32
|
+
"require": "./dist/cjs/index.js"
|
|
33
|
+
},
|
|
34
|
+
"./api": {
|
|
35
|
+
"types": "./dist/esm/api/index.d.ts",
|
|
36
|
+
"import": "./dist/esm/api/index.mjs",
|
|
37
|
+
"require": "./dist/cjs/api/index.js"
|
|
38
|
+
},
|
|
39
|
+
"./data": {
|
|
40
|
+
"types": "./dist/esm/api/index.d.ts",
|
|
41
|
+
"import": "./dist/esm/api/index.mjs",
|
|
42
|
+
"require": "./dist/cjs/api/index.js"
|
|
43
|
+
},
|
|
44
|
+
"./package.json": "./package.json"
|
|
45
|
+
},
|
|
46
|
+
"files": [
|
|
47
|
+
"dist/cjs",
|
|
48
|
+
"dist/esm",
|
|
49
|
+
"src",
|
|
50
|
+
"api",
|
|
51
|
+
"data"
|
|
52
|
+
],
|
|
53
|
+
"homepage": "https://aws-amplify.github.io/",
|
|
54
|
+
"license": "Apache-2.0",
|
|
55
|
+
"main": "./dist/cjs/index.js",
|
|
56
|
+
"module": "./dist/esm/index.mjs",
|
|
57
|
+
"typings": "./dist/esm/index.d.ts",
|
|
58
|
+
"sideEffects": false,
|
|
59
|
+
"scripts": {
|
|
60
|
+
"build": "npm run clean && npm run build:esm-cjs",
|
|
61
|
+
"build-with-test": "npm test && npm run build",
|
|
62
|
+
"build:esm-cjs": "rollup -c rollup.config.mjs",
|
|
63
|
+
"build:watch": "npm run build:esm-cjs -- --watch",
|
|
64
|
+
"clean": "npm run clean:size && rimraf dist",
|
|
65
|
+
"clean:size": "rimraf dual-publish-tmp tmp*",
|
|
66
|
+
"format": "echo \"Not implemented\"",
|
|
67
|
+
"lint": "eslint '**/*.{ts,tsx}' && npm run ts-coverage",
|
|
68
|
+
"lint:fix": "eslint '**/*.{ts,tsx}' --fix",
|
|
69
|
+
"test": "npm run lint && jest -w 1 --coverage --logHeapUsage",
|
|
70
|
+
"ts-coverage": "typescript-coverage-report -p ./tsconfig.build.json -t 90.31"
|
|
71
|
+
},
|
|
72
|
+
"gitHead": "ac07014b8a5bbf12f6e9188a6eb2f3f29cc3880c"
|
|
76
73
|
}
|
package/src/types/NextServer.ts
CHANGED
|
@@ -8,17 +8,17 @@ import { LegacyConfig } from 'aws-amplify/adapter-core';
|
|
|
8
8
|
import { AmplifyServer } from '@aws-amplify/core/internals/adapter-core';
|
|
9
9
|
import { ResourcesConfig } from '@aws-amplify/core';
|
|
10
10
|
|
|
11
|
-
export namespace NextServer {
|
|
11
|
+
export declare namespace NextServer {
|
|
12
12
|
/**
|
|
13
13
|
* This context is normally available in the following:
|
|
14
14
|
* - Next App Router [middleware](https://nextjs.org/docs/app/building-your-application/routing/middleware)
|
|
15
15
|
* - Next App Router [route handler](https://nextjs.org/docs/app/building-your-application/routing/route-handlers)
|
|
16
16
|
* when using `NextResponse` to create the response of the route handler
|
|
17
17
|
*/
|
|
18
|
-
export
|
|
18
|
+
export interface NextRequestAndNextResponseContext {
|
|
19
19
|
request: NextRequest;
|
|
20
20
|
response: NextResponse;
|
|
21
|
-
}
|
|
21
|
+
}
|
|
22
22
|
|
|
23
23
|
/**
|
|
24
24
|
* This context is normally available in the following:
|
|
@@ -26,10 +26,10 @@ export namespace NextServer {
|
|
|
26
26
|
* when using the Web API [`Response`](https://developer.mozilla.org/en-US/docs/Web/API/Response)
|
|
27
27
|
* to create the response of the route handler
|
|
28
28
|
*/
|
|
29
|
-
export
|
|
29
|
+
export interface NextRequestAndResponseContext {
|
|
30
30
|
request: NextRequest;
|
|
31
31
|
response: Response;
|
|
32
|
-
}
|
|
32
|
+
}
|
|
33
33
|
|
|
34
34
|
/**
|
|
35
35
|
* This context is normally available in the following:
|
|
@@ -37,9 +37,9 @@ export namespace NextServer {
|
|
|
37
37
|
* where the [`cookies`](https://nextjs.org/docs/app/api-reference/functions/cookies)
|
|
38
38
|
* function can be imported and called
|
|
39
39
|
*/
|
|
40
|
-
export
|
|
40
|
+
export interface ServerComponentContext {
|
|
41
41
|
cookies: typeof cookies;
|
|
42
|
-
}
|
|
42
|
+
}
|
|
43
43
|
|
|
44
44
|
export type ServerActionContext = ServerComponentContext;
|
|
45
45
|
|
|
@@ -48,10 +48,10 @@ export namespace NextServer {
|
|
|
48
48
|
* [`getServerSideProps`](https://nextjs.org/docs/pages/building-your-application/data-fetching/get-server-side-props)
|
|
49
49
|
* function of the Next Pages Router.
|
|
50
50
|
*/
|
|
51
|
-
export
|
|
51
|
+
export interface GetServerSidePropsContext {
|
|
52
52
|
request: NextGetServerSidePropsContext['req'];
|
|
53
53
|
response: NextGetServerSidePropsContext['res'];
|
|
54
|
-
}
|
|
54
|
+
}
|
|
55
55
|
|
|
56
56
|
/**
|
|
57
57
|
* The union of possible Next.js app server context types.
|
|
@@ -62,21 +62,16 @@ export namespace NextServer {
|
|
|
62
62
|
| ServerComponentContext
|
|
63
63
|
| GetServerSidePropsContext;
|
|
64
64
|
|
|
65
|
-
/**
|
|
66
|
-
* The interface of the input of {@link RunOperationWithContext}.
|
|
67
|
-
*/
|
|
68
65
|
export interface RunWithContextInput<OperationResult> {
|
|
69
66
|
nextServerContext: Context | null;
|
|
70
|
-
operation
|
|
71
|
-
contextSpec: AmplifyServer.ContextSpec
|
|
72
|
-
)
|
|
67
|
+
operation(
|
|
68
|
+
contextSpec: AmplifyServer.ContextSpec,
|
|
69
|
+
): OperationResult | Promise<OperationResult>;
|
|
73
70
|
}
|
|
74
71
|
|
|
75
|
-
export
|
|
76
|
-
<OperationResult
|
|
77
|
-
|
|
78
|
-
): Promise<OperationResult>;
|
|
79
|
-
}
|
|
72
|
+
export type RunOperationWithContext = <OperationResult>(
|
|
73
|
+
input: RunWithContextInput<OperationResult>,
|
|
74
|
+
) => Promise<OperationResult>;
|
|
80
75
|
|
|
81
76
|
export interface CreateServerRunnerInput {
|
|
82
77
|
config: ResourcesConfig | LegacyConfig;
|
|
@@ -86,7 +81,7 @@ export namespace NextServer {
|
|
|
86
81
|
runWithAmplifyServerContext: RunOperationWithContext;
|
|
87
82
|
}
|
|
88
83
|
|
|
89
|
-
export
|
|
90
|
-
|
|
91
|
-
|
|
84
|
+
export type CreateServerRunner = (
|
|
85
|
+
input: CreateServerRunnerInput,
|
|
86
|
+
) => CreateServerRunnerOutput;
|
|
92
87
|
}
|
|
@@ -2,16 +2,17 @@
|
|
|
2
2
|
// SPDX-License-Identifier: Apache-2.0
|
|
3
3
|
|
|
4
4
|
import { NextRequest, NextResponse } from 'next/server.js';
|
|
5
|
-
import { NextServer } from '../types';
|
|
6
5
|
import {
|
|
7
6
|
AmplifyServerContextError,
|
|
8
7
|
CookieStorage,
|
|
9
8
|
} from '@aws-amplify/core/internals/adapter-core';
|
|
10
9
|
|
|
10
|
+
import { NextServer } from '../types';
|
|
11
|
+
|
|
11
12
|
export const DATE_IN_THE_PAST = new Date(0);
|
|
12
13
|
|
|
13
14
|
export const createCookieStorageAdapterFromNextServerContext = (
|
|
14
|
-
context: NextServer.Context
|
|
15
|
+
context: NextServer.Context,
|
|
15
16
|
): CookieStorage.Adapter => {
|
|
16
17
|
const { request: req, response: res } =
|
|
17
18
|
context as Partial<NextServer.GetServerSidePropsContext>;
|
|
@@ -45,12 +46,12 @@ export const createCookieStorageAdapterFromNextServerContext = (
|
|
|
45
46
|
if (response instanceof NextResponse) {
|
|
46
47
|
return createCookieStorageAdapterFromNextRequestAndNextResponse(
|
|
47
48
|
request,
|
|
48
|
-
response
|
|
49
|
+
response,
|
|
49
50
|
);
|
|
50
51
|
} else {
|
|
51
52
|
return createCookieStorageAdapterFromNextRequestAndHttpResponse(
|
|
52
53
|
request,
|
|
53
|
-
response
|
|
54
|
+
response,
|
|
54
55
|
);
|
|
55
56
|
}
|
|
56
57
|
}
|
|
@@ -72,7 +73,7 @@ export const createCookieStorageAdapterFromNextServerContext = (
|
|
|
72
73
|
|
|
73
74
|
const createCookieStorageAdapterFromNextRequestAndNextResponse = (
|
|
74
75
|
request: NextRequest,
|
|
75
|
-
response: NextResponse
|
|
76
|
+
response: NextResponse,
|
|
76
77
|
): CookieStorage.Adapter => {
|
|
77
78
|
const readonlyCookieStore = request.cookies;
|
|
78
79
|
const mutableCookieStore = response.cookies;
|
|
@@ -93,11 +94,11 @@ const createCookieStorageAdapterFromNextRequestAndNextResponse = (
|
|
|
93
94
|
|
|
94
95
|
const createCookieStorageAdapterFromNextRequestAndHttpResponse = (
|
|
95
96
|
request: NextRequest,
|
|
96
|
-
response: Response
|
|
97
|
+
response: Response,
|
|
97
98
|
): CookieStorage.Adapter => {
|
|
98
99
|
const readonlyCookieStore = request.cookies;
|
|
99
100
|
const mutableCookieStore = createMutableCookieStoreFromHeaders(
|
|
100
|
-
response.headers
|
|
101
|
+
response.headers,
|
|
101
102
|
);
|
|
102
103
|
|
|
103
104
|
return {
|
|
@@ -110,7 +111,7 @@ const createCookieStorageAdapterFromNextRequestAndHttpResponse = (
|
|
|
110
111
|
};
|
|
111
112
|
|
|
112
113
|
const createCookieStorageAdapterFromNextCookies = (
|
|
113
|
-
cookies: NextServer.ServerComponentContext['cookies']
|
|
114
|
+
cookies: NextServer.ServerComponentContext['cookies'],
|
|
114
115
|
): CookieStorage.Adapter => {
|
|
115
116
|
const cookieStore = cookies();
|
|
116
117
|
|
|
@@ -147,7 +148,7 @@ const createCookieStorageAdapterFromNextCookies = (
|
|
|
147
148
|
|
|
148
149
|
const createCookieStorageAdapterFromGetServerSidePropsContext = (
|
|
149
150
|
request: NextServer.GetServerSidePropsContext['request'],
|
|
150
|
-
response: NextServer.GetServerSidePropsContext['response']
|
|
151
|
+
response: NextServer.GetServerSidePropsContext['response'],
|
|
151
152
|
): CookieStorage.Adapter => {
|
|
152
153
|
const cookiesMap = { ...request.cookies };
|
|
153
154
|
const allCookies = Object.entries(cookiesMap).map(([name, value]) => ({
|
|
@@ -158,6 +159,7 @@ const createCookieStorageAdapterFromGetServerSidePropsContext = (
|
|
|
158
159
|
return {
|
|
159
160
|
get(name) {
|
|
160
161
|
const value = cookiesMap[ensureEncodedForJSCookie(name)];
|
|
162
|
+
|
|
161
163
|
return value
|
|
162
164
|
? {
|
|
163
165
|
name,
|
|
@@ -173,39 +175,40 @@ const createCookieStorageAdapterFromGetServerSidePropsContext = (
|
|
|
173
175
|
'Set-Cookie',
|
|
174
176
|
`${ensureEncodedForJSCookie(name)}=${value};${
|
|
175
177
|
options ? serializeSetCookieOptions(options) : ''
|
|
176
|
-
}
|
|
178
|
+
}`,
|
|
177
179
|
);
|
|
178
180
|
},
|
|
179
181
|
delete(name) {
|
|
180
182
|
response.setHeader(
|
|
181
183
|
'Set-Cookie',
|
|
182
184
|
`${ensureEncodedForJSCookie(
|
|
183
|
-
name
|
|
184
|
-
)}=;Expires=${DATE_IN_THE_PAST.toUTCString()}
|
|
185
|
+
name,
|
|
186
|
+
)}=;Expires=${DATE_IN_THE_PAST.toUTCString()}`,
|
|
185
187
|
);
|
|
186
188
|
},
|
|
187
189
|
};
|
|
188
190
|
};
|
|
189
191
|
|
|
190
192
|
const createMutableCookieStoreFromHeaders = (
|
|
191
|
-
headers: Headers
|
|
193
|
+
headers: Headers,
|
|
192
194
|
): Pick<CookieStorage.Adapter, 'set' | 'delete'> => {
|
|
193
195
|
const setFunc: CookieStorage.Adapter['set'] = (name, value, options) => {
|
|
194
196
|
headers.append(
|
|
195
197
|
'Set-Cookie',
|
|
196
198
|
`${ensureEncodedForJSCookie(name)}=${value};${
|
|
197
199
|
options ? serializeSetCookieOptions(options) : ''
|
|
198
|
-
}
|
|
200
|
+
}`,
|
|
199
201
|
);
|
|
200
202
|
};
|
|
201
203
|
const deleteFunc: CookieStorage.Adapter['delete'] = name => {
|
|
202
204
|
headers.append(
|
|
203
205
|
'Set-Cookie',
|
|
204
206
|
`${ensureEncodedForJSCookie(
|
|
205
|
-
name
|
|
206
|
-
)}=;Expires=${DATE_IN_THE_PAST.toUTCString()}
|
|
207
|
+
name,
|
|
208
|
+
)}=;Expires=${DATE_IN_THE_PAST.toUTCString()}`,
|
|
207
209
|
);
|
|
208
210
|
};
|
|
211
|
+
|
|
209
212
|
return {
|
|
210
213
|
set: setFunc,
|
|
211
214
|
delete: deleteFunc,
|
|
@@ -213,7 +216,7 @@ const createMutableCookieStoreFromHeaders = (
|
|
|
213
216
|
};
|
|
214
217
|
|
|
215
218
|
const serializeSetCookieOptions = (
|
|
216
|
-
options: CookieStorage.SetCookieOptions
|
|
219
|
+
options: CookieStorage.SetCookieOptions,
|
|
217
220
|
): string => {
|
|
218
221
|
const { expires, domain, httpOnly, sameSite, secure } = options;
|
|
219
222
|
const serializedOptions: string[] = [];
|
|
@@ -232,6 +235,7 @@ const serializeSetCookieOptions = (
|
|
|
232
235
|
if (secure) {
|
|
233
236
|
serializedOptions.push(`Secure`);
|
|
234
237
|
}
|
|
238
|
+
|
|
235
239
|
return serializedOptions.join(';');
|
|
236
240
|
};
|
|
237
241
|
|
|
@@ -9,9 +9,10 @@ import {
|
|
|
9
9
|
runWithAmplifyServerContext as runWithAmplifyServerContextCore,
|
|
10
10
|
} from 'aws-amplify/adapter-core';
|
|
11
11
|
|
|
12
|
-
import { createCookieStorageAdapterFromNextServerContext } from './createCookieStorageAdapterFromNextServerContext';
|
|
13
12
|
import { NextServer } from '../types';
|
|
14
13
|
|
|
14
|
+
import { createCookieStorageAdapterFromNextServerContext } from './createCookieStorageAdapterFromNextServerContext';
|
|
15
|
+
|
|
15
16
|
export const createRunWithAmplifyServerContext = ({
|
|
16
17
|
config: resourcesConfig,
|
|
17
18
|
}: {
|
|
@@ -31,16 +32,16 @@ export const createRunWithAmplifyServerContext = ({
|
|
|
31
32
|
? sharedInMemoryStorage
|
|
32
33
|
: createKeyValueStorageFromCookieStorageAdapter(
|
|
33
34
|
createCookieStorageAdapterFromNextServerContext(
|
|
34
|
-
nextServerContext
|
|
35
|
-
)
|
|
35
|
+
nextServerContext,
|
|
36
|
+
),
|
|
36
37
|
);
|
|
37
38
|
const credentialsProvider = createAWSCredentialsAndIdentityIdProvider(
|
|
38
39
|
resourcesConfig.Auth,
|
|
39
|
-
keyValueStorage
|
|
40
|
+
keyValueStorage,
|
|
40
41
|
);
|
|
41
42
|
const tokenProvider = createUserPoolsTokenProvider(
|
|
42
43
|
resourcesConfig.Auth,
|
|
43
|
-
keyValueStorage
|
|
44
|
+
keyValueStorage,
|
|
44
45
|
);
|
|
45
46
|
|
|
46
47
|
return runWithAmplifyServerContextCore(
|
|
@@ -48,7 +49,7 @@ export const createRunWithAmplifyServerContext = ({
|
|
|
48
49
|
{
|
|
49
50
|
Auth: { credentialsProvider, tokenProvider },
|
|
50
51
|
},
|
|
51
|
-
operation
|
|
52
|
+
operation,
|
|
52
53
|
);
|
|
53
54
|
}
|
|
54
55
|
|
|
@@ -6,7 +6,7 @@ import { LegacyConfig } from 'aws-amplify/adapter-core';
|
|
|
6
6
|
import { parseAWSExports } from '@aws-amplify/core/internals/utils';
|
|
7
7
|
|
|
8
8
|
export const getAmplifyConfig = (
|
|
9
|
-
config: ResourcesConfig | LegacyConfig
|
|
9
|
+
config: ResourcesConfig | LegacyConfig,
|
|
10
10
|
): ResourcesConfig =>
|
|
11
11
|
Object.keys(config).some(key => key.startsWith('aws_'))
|
|
12
12
|
? parseAWSExports(config)
|