@aws-amplify/adapter-nextjs 0.0.2-ui-preview.1aa6ecb.0 → 1.0.1-ssr-api.df60e41.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/internals/package.json +7 -0
- package/lib/generateServerClient.d.ts +15 -0
- package/lib/generateServerClient.js +65 -0
- package/lib/generateServerClient.js.map +1 -0
- package/lib/internals/index.d.ts +2 -0
- package/lib/internals/index.js +8 -0
- package/lib/internals/index.js.map +1 -0
- package/lib/runWithAmplifyServerContext.d.ts +43 -0
- package/lib/runWithAmplifyServerContext.js +73 -66
- package/lib/runWithAmplifyServerContext.js.map +1 -1
- package/lib/types/NextServer.d.ts +6 -0
- package/lib/utils/createCookieStorageAdapterFromNextServerContext.js +92 -72
- package/lib/utils/createCookieStorageAdapterFromNextServerContext.js.map +1 -1
- package/lib/utils/getAmplifyConfig.d.ts +1 -1
- package/lib/utils/getAmplifyConfig.js +20 -5
- package/lib/utils/getAmplifyConfig.js.map +1 -1
- package/lib/withAmplify.d.ts +6 -3
- package/lib/withAmplify.js +13 -16
- package/lib/withAmplify.js.map +1 -1
- package/lib-esm/generateServerClient.d.ts +15 -0
- package/lib-esm/generateServerClient.js +60 -0
- package/lib-esm/generateServerClient.js.map +1 -0
- package/lib-esm/internals/index.d.ts +2 -0
- package/lib-esm/internals/index.js +4 -0
- package/lib-esm/internals/index.js.map +1 -0
- package/lib-esm/runWithAmplifyServerContext.d.ts +43 -0
- package/lib-esm/runWithAmplifyServerContext.js +72 -65
- package/lib-esm/runWithAmplifyServerContext.js.map +1 -1
- package/lib-esm/types/NextServer.d.ts +6 -0
- package/lib-esm/utils/createCookieStorageAdapterFromNextServerContext.js +92 -72
- package/lib-esm/utils/createCookieStorageAdapterFromNextServerContext.js.map +1 -1
- package/lib-esm/utils/getAmplifyConfig.d.ts +1 -1
- package/lib-esm/utils/getAmplifyConfig.js +16 -4
- package/lib-esm/utils/getAmplifyConfig.js.map +1 -1
- package/lib-esm/withAmplify.d.ts +6 -3
- package/lib-esm/withAmplify.js +13 -16
- package/lib-esm/withAmplify.js.map +1 -1
- package/package.json +121 -109
- package/src/generateServerClient.ts +94 -0
- package/src/internals/index.ts +5 -0
- package/src/runWithAmplifyServerContext.ts +50 -7
- package/src/types/NextServer.ts +6 -0
- package/src/utils/createCookieStorageAdapterFromNextServerContext.ts +71 -28
- package/src/utils/getAmplifyConfig.ts +16 -3
- package/src/withAmplify.ts +13 -5
- package/with-amplify/package.json +7 -0
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { V6Client, V6ClientSSR } from '@aws-amplify/api-graphql';
|
|
2
|
+
import { NextServer } from './types';
|
|
3
|
+
/**
|
|
4
|
+
* Generates an API client that can be used inside a Next.js Server Component
|
|
5
|
+
*
|
|
6
|
+
* @example
|
|
7
|
+
* ```ts
|
|
8
|
+
* import { cookies } from "next/headers";
|
|
9
|
+
*
|
|
10
|
+
* const client = generateServerClientUsingCookies({ cookies })
|
|
11
|
+
* client.graphql()
|
|
12
|
+
* ```
|
|
13
|
+
*/
|
|
14
|
+
export declare function generateServerClientUsingCookies<T extends Record<any, any> = never>(nextServerContext: NextServer.ServerComponentContext): V6Client<T>;
|
|
15
|
+
export declare function generateServerClient<T extends Record<any, any> = never>(): V6ClientSSR<T>;
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
3
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
4
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5
|
+
exports.generateServerClient = exports.generateServerClientUsingCookies = void 0;
|
|
6
|
+
const server_1 = require("@aws-amplify/api/server");
|
|
7
|
+
const adapter_core_1 = require("@aws-amplify/core/internals/adapter-core");
|
|
8
|
+
const api_graphql_1 = require("@aws-amplify/api-graphql");
|
|
9
|
+
const runWithAmplifyServerContext_1 = require("./runWithAmplifyServerContext");
|
|
10
|
+
const getAmplifyConfig_1 = require("./utils/getAmplifyConfig");
|
|
11
|
+
/**
|
|
12
|
+
* Generates an API client that can be used inside a Next.js Server Component
|
|
13
|
+
*
|
|
14
|
+
* @example
|
|
15
|
+
* ```ts
|
|
16
|
+
* import { cookies } from "next/headers";
|
|
17
|
+
*
|
|
18
|
+
* const client = generateServerClientUsingCookies({ cookies })
|
|
19
|
+
* client.graphql()
|
|
20
|
+
* ```
|
|
21
|
+
*/
|
|
22
|
+
function generateServerClientUsingCookies(nextServerContext) {
|
|
23
|
+
if (!nextServerContext.cookies ||
|
|
24
|
+
nextServerContext.request !== undefined) {
|
|
25
|
+
throw new adapter_core_1.AmplifyServerContextError({
|
|
26
|
+
message: 'generateServerClientUsingCookies is only compatible with the `cookies` Dynamic Function available in Server Components',
|
|
27
|
+
// TODO: link to docs
|
|
28
|
+
recoverySuggestion: 'use generateServerClient inside of runWithAmplifyServerContext with the `request` object',
|
|
29
|
+
});
|
|
30
|
+
}
|
|
31
|
+
// This function reference gets passed down to InternalGraphQLAPI.ts.graphql
|
|
32
|
+
// where this._graphql is passed through as the `fn` argument
|
|
33
|
+
// causing it to always get invoked inside `runWithAmplifyServerContext`
|
|
34
|
+
const getAmplify = (fn) => (0, runWithAmplifyServerContext_1.runWithAmplifyServerContext)({
|
|
35
|
+
nextServerContext,
|
|
36
|
+
operation: contextSpec => fn((0, adapter_core_1.getAmplifyServerContext)(contextSpec).amplify),
|
|
37
|
+
});
|
|
38
|
+
// retrieve general SSR config. This is used only to retrieve the
|
|
39
|
+
// modelIntroSchema for future model-based use cases
|
|
40
|
+
const config = (0, getAmplifyConfig_1.getAmplifyConfig)();
|
|
41
|
+
return (0, server_1.generateClient)({
|
|
42
|
+
amplify: getAmplify,
|
|
43
|
+
config,
|
|
44
|
+
});
|
|
45
|
+
}
|
|
46
|
+
exports.generateServerClientUsingCookies = generateServerClientUsingCookies;
|
|
47
|
+
function generateServerClient() {
|
|
48
|
+
const config = (0, getAmplifyConfig_1.getAmplifyConfig)();
|
|
49
|
+
// passing `null` instance because each (future model) method must retrieve a valid instance
|
|
50
|
+
// from server context
|
|
51
|
+
const client = (0, server_1.generateClient)({
|
|
52
|
+
amplify: null,
|
|
53
|
+
config,
|
|
54
|
+
});
|
|
55
|
+
// TODO: improve this and the next type
|
|
56
|
+
const prevGraphql = client.graphql;
|
|
57
|
+
const wrappedGraphql = (contextSpec, options, additionalHeaders) => {
|
|
58
|
+
const amplifyInstance = (0, adapter_core_1.getAmplifyServerContext)(contextSpec).amplify;
|
|
59
|
+
return prevGraphql.call({ [api_graphql_1.__amplify]: amplifyInstance }, options, additionalHeaders);
|
|
60
|
+
};
|
|
61
|
+
client.graphql = wrappedGraphql;
|
|
62
|
+
return client;
|
|
63
|
+
}
|
|
64
|
+
exports.generateServerClient = generateServerClient;
|
|
65
|
+
//# sourceMappingURL=generateServerClient.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"generateServerClient.js","sourceRoot":"","sources":["../src/generateServerClient.ts"],"names":[],"mappings":";AAAA,qEAAqE;AACrE,sCAAsC;;;AAEtC,oDAAmF;AACnF,2EAGkD;AAClD,0DAMkC;AAElC,+EAA4E;AAC5E,+DAA4D;AAG5D;;;;;;;;;;GAUG;AACH,SAAgB,gCAAgC,CAE9C,iBAAoD;IACrD,IACC,CAAC,iBAAiB,CAAC,OAAO;QACzB,iBAAyB,CAAC,OAAO,KAAK,SAAS,EAC/C;QACD,MAAM,IAAI,wCAAyB,CAAC;YACnC,OAAO,EACN,wHAAwH;YACzH,qBAAqB;YACrB,kBAAkB,EACjB,0FAA0F;SAC3F,CAAC,CAAC;KACH;IAED,4EAA4E;IAC5E,6DAA6D;IAC7D,wEAAwE;IACxE,MAAM,UAAU,GAAG,CAAC,EAAkC,EAAE,EAAE,CACzD,IAAA,yDAA2B,EAAC;QAC3B,iBAAiB;QACjB,SAAS,EAAE,WAAW,CAAC,EAAE,CACxB,EAAE,CAAC,IAAA,sCAAuB,EAAC,WAAW,CAAC,CAAC,OAAO,CAAC;KACjD,CAAC,CAAC;IAEJ,iEAAiE;IACjE,oDAAoD;IACpD,MAAM,MAAM,GAAG,IAAA,mCAAgB,GAAE,CAAC;IAElC,OAAO,IAAA,uBAAsB,EAAiB;QAC7C,OAAO,EAAE,UAAU;QACnB,MAAM;KACN,CAAC,CAAC;AACJ,CAAC;AAlCD,4EAkCC;AAED,SAAgB,oBAAoB;IAGnC,MAAM,MAAM,GAAG,IAAA,mCAAgB,GAAE,CAAC;IAElC,4FAA4F;IAC5F,sBAAsB;IACtB,MAAM,MAAM,GAAG,IAAA,uBAAsB,EAAoB;QACxD,OAAO,EAAE,IAAI;QACb,MAAM;KACN,CAAC,CAAC;IAEH,uCAAuC;IACvC,MAAM,WAAW,GAAG,MAAM,CAAC,OAAmC,CAAC;IAE/D,MAAM,cAAc,GAAG,CAAC,WAAW,EAAE,OAAO,EAAE,iBAAkB,EAAE,EAAE;QACnE,MAAM,eAAe,GAAG,IAAA,sCAAuB,EAAC,WAAW,CAAC,CAAC,OAAO,CAAC;QACrE,OAAO,WAAW,CAAC,IAAI,CACtB,EAAE,CAAC,uBAAS,CAAC,EAAE,eAAe,EAAE,EAChC,OAAO,EACP,iBAAwB,CACxB,CAAC;IACH,CAAC,CAAC;IAEF,MAAM,CAAC,OAAO,GAAG,cAA6C,CAAC;IAC/D,OAAO,MAAM,CAAC;AACf,CAAC;AA1BD,oDA0BC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
3
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
4
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5
|
+
exports.getAmplifyConfig = void 0;
|
|
6
|
+
var utils_1 = require("../utils");
|
|
7
|
+
Object.defineProperty(exports, "getAmplifyConfig", { enumerable: true, get: function () { return utils_1.getAmplifyConfig; } });
|
|
8
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/internals/index.ts"],"names":[],"mappings":";AAAA,qEAAqE;AACrE,sCAAsC;;;AAEtC,kCAA4C;AAAnC,yGAAA,gBAAgB,OAAA"}
|
|
@@ -1,2 +1,45 @@
|
|
|
1
1
|
import { NextServer } from './types';
|
|
2
|
+
/**
|
|
3
|
+
* Runs the {@link operation} with the the context created from the {@link nextServerContext}.
|
|
4
|
+
*
|
|
5
|
+
* @param input The input to call the {@link runWithAmplifyServerContext}.
|
|
6
|
+
* @param input.nextServerContext The Next.js server context. It varies depends
|
|
7
|
+
* where the {@link runWithAmplifyServerContext} is being called.
|
|
8
|
+
* - In the [middleware](https://nextjs.org/docs/app/building-your-application/routing/middleware):
|
|
9
|
+
* the context consists of an instance of the `NextRequest` and an instance
|
|
10
|
+
* of the `NextResponse`.
|
|
11
|
+
* - In a [Page server component](https://nextjs.org/docs/app/building-your-application/routing/pages-and-layouts#pages):
|
|
12
|
+
* the context is the [`cookies`](https://nextjs.org/docs/app/api-reference/functions/cookies)
|
|
13
|
+
* function provided by Next.js.
|
|
14
|
+
* - In a [Route Handler](https://nextjs.org/docs/app/building-your-application/routing/route-handlers):
|
|
15
|
+
* the context can be the [`cookies`](https://nextjs.org/docs/app/api-reference/functions/cookies)
|
|
16
|
+
* function or a combination of an instance of the `NextRequest` and an instance
|
|
17
|
+
* of the `NextResponse`.
|
|
18
|
+
* - In a [Server Action](https://nextjs.org/docs/app/building-your-application/data-fetching/forms-and-mutations#how-server-actions-work):
|
|
19
|
+
* the context is the [`cookies`](https://nextjs.org/docs/app/api-reference/functions/cookies)
|
|
20
|
+
* function provided by Next.js.
|
|
21
|
+
* @param input.operation The function that contains the business logic calling
|
|
22
|
+
* Amplify APIs. It expects a `contextSpec` parameter.
|
|
23
|
+
* @returns The result returned by the {@link operation}.
|
|
24
|
+
* @example
|
|
25
|
+
* // Use the `fetchAuthSession` API in the Next.js `middleware`.
|
|
26
|
+
* import { NextRequest, NextResponse } from "next/server";
|
|
27
|
+
* import { fetchAuthSession } from "aws-amplify/auth/server";
|
|
28
|
+
* import { runWithAmplifyServerContext } from "@aws-amplify/adapter-nextjs";
|
|
29
|
+
|
|
30
|
+
* export async function middleware(request: NextRequest) {
|
|
31
|
+
* const response = NextResponse.next();
|
|
32
|
+
* const authenticated = await runWithAmplifyServerContext({
|
|
33
|
+
* nextServerContext: { request, response },
|
|
34
|
+
* operation: async (contextSpec) => {
|
|
35
|
+
* const session = await fetchAuthSession(contextSpec);
|
|
36
|
+
* return session.tokens !== undefined;
|
|
37
|
+
* }
|
|
38
|
+
* });
|
|
39
|
+
* if (authenticated) {
|
|
40
|
+
* return response;
|
|
41
|
+
* }
|
|
42
|
+
* return NextResponse.redirect(new URL('/sign-in', request.url));
|
|
43
|
+
* }
|
|
44
|
+
*/
|
|
2
45
|
export declare const runWithAmplifyServerContext: NextServer.RunOperationWithContext;
|
|
@@ -1,74 +1,81 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
3
3
|
// SPDX-License-Identifier: Apache-2.0
|
|
4
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
5
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
6
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
7
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
8
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
9
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
10
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
11
|
-
});
|
|
12
|
-
};
|
|
13
|
-
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
14
|
-
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
15
|
-
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
16
|
-
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
17
|
-
function step(op) {
|
|
18
|
-
if (f) throw new TypeError("Generator is already executing.");
|
|
19
|
-
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
20
|
-
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
21
|
-
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
22
|
-
switch (op[0]) {
|
|
23
|
-
case 0: case 1: t = op; break;
|
|
24
|
-
case 4: _.label++; return { value: op[1], done: false };
|
|
25
|
-
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
26
|
-
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
27
|
-
default:
|
|
28
|
-
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
29
|
-
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
30
|
-
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
31
|
-
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
32
|
-
if (t[2]) _.ops.pop();
|
|
33
|
-
_.trys.pop(); continue;
|
|
34
|
-
}
|
|
35
|
-
op = body.call(thisArg, _);
|
|
36
|
-
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
37
|
-
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
38
|
-
}
|
|
39
|
-
};
|
|
40
4
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
41
5
|
exports.runWithAmplifyServerContext = void 0;
|
|
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
|
-
|
|
6
|
+
const utils_1 = require("./utils");
|
|
7
|
+
const core_1 = require("@aws-amplify/core");
|
|
8
|
+
const adapter_core_1 = require("aws-amplify/adapter-core");
|
|
9
|
+
/**
|
|
10
|
+
* Runs the {@link operation} with the the context created from the {@link nextServerContext}.
|
|
11
|
+
*
|
|
12
|
+
* @param input The input to call the {@link runWithAmplifyServerContext}.
|
|
13
|
+
* @param input.nextServerContext The Next.js server context. It varies depends
|
|
14
|
+
* where the {@link runWithAmplifyServerContext} is being called.
|
|
15
|
+
* - In the [middleware](https://nextjs.org/docs/app/building-your-application/routing/middleware):
|
|
16
|
+
* the context consists of an instance of the `NextRequest` and an instance
|
|
17
|
+
* of the `NextResponse`.
|
|
18
|
+
* - In a [Page server component](https://nextjs.org/docs/app/building-your-application/routing/pages-and-layouts#pages):
|
|
19
|
+
* the context is the [`cookies`](https://nextjs.org/docs/app/api-reference/functions/cookies)
|
|
20
|
+
* function provided by Next.js.
|
|
21
|
+
* - In a [Route Handler](https://nextjs.org/docs/app/building-your-application/routing/route-handlers):
|
|
22
|
+
* the context can be the [`cookies`](https://nextjs.org/docs/app/api-reference/functions/cookies)
|
|
23
|
+
* function or a combination of an instance of the `NextRequest` and an instance
|
|
24
|
+
* of the `NextResponse`.
|
|
25
|
+
* - In a [Server Action](https://nextjs.org/docs/app/building-your-application/data-fetching/forms-and-mutations#how-server-actions-work):
|
|
26
|
+
* the context is the [`cookies`](https://nextjs.org/docs/app/api-reference/functions/cookies)
|
|
27
|
+
* function provided by Next.js.
|
|
28
|
+
* @param input.operation The function that contains the business logic calling
|
|
29
|
+
* Amplify APIs. It expects a `contextSpec` parameter.
|
|
30
|
+
* @returns The result returned by the {@link operation}.
|
|
31
|
+
* @example
|
|
32
|
+
* // Use the `fetchAuthSession` API in the Next.js `middleware`.
|
|
33
|
+
* import { NextRequest, NextResponse } from "next/server";
|
|
34
|
+
* import { fetchAuthSession } from "aws-amplify/auth/server";
|
|
35
|
+
* import { runWithAmplifyServerContext } from "@aws-amplify/adapter-nextjs";
|
|
36
|
+
|
|
37
|
+
* export async function middleware(request: NextRequest) {
|
|
38
|
+
* const response = NextResponse.next();
|
|
39
|
+
* const authenticated = await runWithAmplifyServerContext({
|
|
40
|
+
* nextServerContext: { request, response },
|
|
41
|
+
* operation: async (contextSpec) => {
|
|
42
|
+
* const session = await fetchAuthSession(contextSpec);
|
|
43
|
+
* return session.tokens !== undefined;
|
|
44
|
+
* }
|
|
45
|
+
* });
|
|
46
|
+
* if (authenticated) {
|
|
47
|
+
* return response;
|
|
48
|
+
* }
|
|
49
|
+
* return NextResponse.redirect(new URL('/sign-in', request.url));
|
|
50
|
+
* }
|
|
51
|
+
*/
|
|
52
|
+
const runWithAmplifyServerContext = async ({ nextServerContext, operation }) => {
|
|
53
|
+
// 1. get amplify config from env vars
|
|
54
|
+
// 2. create key-value storage from nextServerContext
|
|
55
|
+
// 3. create credentials provider
|
|
56
|
+
// 4. create token provider
|
|
57
|
+
// 5. call low level runWithAmplifyServerContext
|
|
58
|
+
const amplifyConfig = (0, utils_1.getAmplifyConfig)();
|
|
59
|
+
// When the Auth config is presented, attempt to create a Amplify server
|
|
60
|
+
// context with token and credentials provider.
|
|
61
|
+
if (amplifyConfig.Auth) {
|
|
62
|
+
const keyValueStorage =
|
|
63
|
+
// When `null` is passed as the value of `nextServerContext`, opt-in
|
|
64
|
+
// unauthenticated role (primarily for static rendering). It's
|
|
65
|
+
// safe to use the singleton `MemoryKeyValueStorage` here, as the
|
|
66
|
+
// static rendering uses the same unauthenticated role cross-sever.
|
|
67
|
+
nextServerContext === null
|
|
68
|
+
? core_1.sharedInMemoryStorage
|
|
69
|
+
: (0, adapter_core_1.createKeyValueStorageFromCookieStorageAdapter)((0, utils_1.createCookieStorageAdapterFromNextServerContext)(nextServerContext));
|
|
70
|
+
const credentialsProvider = (0, adapter_core_1.createAWSCredentialsAndIdentityIdProvider)(amplifyConfig.Auth, keyValueStorage);
|
|
71
|
+
const tokenProvider = (0, adapter_core_1.createUserPoolsTokenProvider)(amplifyConfig.Auth, keyValueStorage);
|
|
72
|
+
return (0, adapter_core_1.runWithAmplifyServerContext)(amplifyConfig, {
|
|
73
|
+
Auth: { credentialsProvider, tokenProvider },
|
|
74
|
+
}, operation);
|
|
75
|
+
}
|
|
76
|
+
// Otherwise it may be the case that auth is not used, e.g. API key.
|
|
77
|
+
// Omitting the `Auth` in the second parameter.
|
|
78
|
+
return (0, adapter_core_1.runWithAmplifyServerContext)(amplifyConfig, {}, operation);
|
|
72
79
|
};
|
|
73
80
|
exports.runWithAmplifyServerContext = runWithAmplifyServerContext;
|
|
74
81
|
//# sourceMappingURL=runWithAmplifyServerContext.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"runWithAmplifyServerContext.js","sourceRoot":"","sources":["../src/runWithAmplifyServerContext.ts"],"names":[],"mappings":";AAAA,qEAAqE;AACrE,sCAAsC
|
|
1
|
+
{"version":3,"file":"runWithAmplifyServerContext.js","sourceRoot":"","sources":["../src/runWithAmplifyServerContext.ts"],"names":[],"mappings":";AAAA,qEAAqE;AACrE,sCAAsC;;;AAGtC,mCAGiB;AACjB,4CAA0D;AAC1D,2DAKkC;AAElC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA0CG;AACI,MAAM,2BAA2B,GACvC,KAAK,EAAE,EAAE,iBAAiB,EAAE,SAAS,EAAE,EAAE,EAAE;IAC1C,sCAAsC;IACtC,qDAAqD;IACrD,iCAAiC;IACjC,2BAA2B;IAC3B,gDAAgD;IAChD,MAAM,aAAa,GAAG,IAAA,wBAAgB,GAAE,CAAC;IAEzC,wEAAwE;IACxE,+CAA+C;IAC/C,IAAI,aAAa,CAAC,IAAI,EAAE;QACvB,MAAM,eAAe;QACpB,oEAAoE;QACpE,8DAA8D;QAC9D,iEAAiE;QACjE,mEAAmE;QACnE,iBAAiB,KAAK,IAAI;YACzB,CAAC,CAAC,4BAAqB;YACvB,CAAC,CAAC,IAAA,4DAA6C,EAC7C,IAAA,uDAA+C,EAAC,iBAAiB,CAAC,CACjE,CAAC;QACN,MAAM,mBAAmB,GAAG,IAAA,wDAAyC,EACpE,aAAa,CAAC,IAAI,EAClB,eAAe,CACf,CAAC;QACF,MAAM,aAAa,GAAG,IAAA,2CAA4B,EACjD,aAAa,CAAC,IAAI,EAClB,eAAe,CACf,CAAC;QAEF,OAAO,IAAA,0CAA+B,EACrC,aAAa,EACb;YACC,IAAI,EAAE,EAAE,mBAAmB,EAAE,aAAa,EAAE;SAC5C,EACD,SAAS,CACT,CAAC;KACF;IAED,oEAAoE;IACpE,+CAA+C;IAC/C,OAAO,IAAA,0CAA+B,EAAC,aAAa,EAAE,EAAE,EAAE,SAAS,CAAC,CAAC;AACtE,CAAC,CAAC;AA3CU,QAAA,2BAA2B,+BA2CrC"}
|
|
@@ -42,7 +42,13 @@ export declare namespace NextServer {
|
|
|
42
42
|
request: NextGetServerSidePropsContext['req'];
|
|
43
43
|
response: NextGetServerSidePropsContext['res'];
|
|
44
44
|
};
|
|
45
|
+
/**
|
|
46
|
+
* The union of possible Next.js app server context types.
|
|
47
|
+
*/
|
|
45
48
|
type Context = NextRequestAndNextResponseContext | NextRequestAndResponseContext | ServerComponentContext | GetServerSidePropsContext;
|
|
49
|
+
/**
|
|
50
|
+
* The interface of the input of {@link RunOperationWithContext}.
|
|
51
|
+
*/
|
|
46
52
|
interface RunWithContextInput<OperationResult> {
|
|
47
53
|
nextServerContext: Context | null;
|
|
48
54
|
operation: (contextSpec: AmplifyServer.ContextSpec) => OperationResult | Promise<OperationResult>;
|
|
@@ -1,26 +1,32 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
3
3
|
// SPDX-License-Identifier: Apache-2.0
|
|
4
|
-
var __assign = (this && this.__assign) || function () {
|
|
5
|
-
__assign = Object.assign || function(t) {
|
|
6
|
-
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
7
|
-
s = arguments[i];
|
|
8
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
9
|
-
t[p] = s[p];
|
|
10
|
-
}
|
|
11
|
-
return t;
|
|
12
|
-
};
|
|
13
|
-
return __assign.apply(this, arguments);
|
|
14
|
-
};
|
|
15
4
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
16
5
|
exports.createCookieStorageAdapterFromNextServerContext = exports.DATE_IN_THE_PAST = void 0;
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
var http_1 = require("http");
|
|
6
|
+
const server_1 = require("next/server");
|
|
7
|
+
const adapter_core_1 = require("@aws-amplify/core/internals/adapter-core");
|
|
20
8
|
exports.DATE_IN_THE_PAST = new Date(0);
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
9
|
+
const createCookieStorageAdapterFromNextServerContext = (context) => {
|
|
10
|
+
const { request: req, response: res } = context;
|
|
11
|
+
// When the server context is from `getServerSideProps`, the `req` is an instance
|
|
12
|
+
// of IncomingMessage, and the `res` is an instance of ServerResponse.
|
|
13
|
+
// We cannot import these two classes here from `http` as it breaks in Next
|
|
14
|
+
// Edge Runtime. Hence, we check the methods that we need to use for creating
|
|
15
|
+
// cookie adapter.
|
|
16
|
+
if (req &&
|
|
17
|
+
res &&
|
|
18
|
+
Object.prototype.toString.call(req.cookies) === '[object Object]' &&
|
|
19
|
+
typeof res.setHeader === 'function') {
|
|
20
|
+
return createCookieStorageAdapterFromGetServerSidePropsContext(req, res);
|
|
21
|
+
}
|
|
22
|
+
const { request, response } = context;
|
|
23
|
+
// When the server context is from `middleware`, the `request` is an instance
|
|
24
|
+
// of `NextRequest`.
|
|
25
|
+
// When the server context is from a route handler, the `request` is an `Proxy`
|
|
26
|
+
// wrapped `Request`.
|
|
27
|
+
// The `NextRequest` and the `Proxy` are sharing the same interface by Next
|
|
28
|
+
// implementation. So we don't need to detect the difference.
|
|
29
|
+
if (request && response) {
|
|
24
30
|
if (response instanceof server_1.NextResponse) {
|
|
25
31
|
return createCookieStorageAdapterFromNextRequestAndNextResponse(request, response);
|
|
26
32
|
}
|
|
@@ -28,125 +34,139 @@ var createCookieStorageAdapterFromNextServerContext = function (context) {
|
|
|
28
34
|
return createCookieStorageAdapterFromNextRequestAndHttpResponse(request, response);
|
|
29
35
|
}
|
|
30
36
|
}
|
|
31
|
-
|
|
37
|
+
const { cookies } = context;
|
|
32
38
|
if (typeof cookies === 'function') {
|
|
33
39
|
return createCookieStorageAdapterFromNextCookies(cookies);
|
|
34
40
|
}
|
|
35
|
-
var _b = context, req = _b.request, res = _b.response;
|
|
36
|
-
if (req instanceof http_1.IncomingMessage && res instanceof http_1.ServerResponse) {
|
|
37
|
-
return createCookieStorageAdapterFromGetServerSidePropsContext(req, res);
|
|
38
|
-
}
|
|
39
41
|
// This should not happen normally.
|
|
40
42
|
throw new adapter_core_1.AmplifyServerContextError({
|
|
41
43
|
message: 'Attempted to create cookie storage adapter from an unsupported Next.js server context.',
|
|
42
44
|
});
|
|
43
45
|
};
|
|
44
46
|
exports.createCookieStorageAdapterFromNextServerContext = createCookieStorageAdapterFromNextServerContext;
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
47
|
+
const createCookieStorageAdapterFromNextRequestAndNextResponse = (request, response) => {
|
|
48
|
+
const readonlyCookieStore = request.cookies;
|
|
49
|
+
const mutableCookieStore = response.cookies;
|
|
48
50
|
return {
|
|
49
|
-
get
|
|
51
|
+
get(name) {
|
|
52
|
+
return readonlyCookieStore.get(ensureEncodedForJSCookie(name));
|
|
53
|
+
},
|
|
50
54
|
getAll: readonlyCookieStore.getAll.bind(readonlyCookieStore),
|
|
51
|
-
set
|
|
52
|
-
|
|
55
|
+
set(name, value, options) {
|
|
56
|
+
mutableCookieStore.set(ensureEncodedForJSCookie(name), value, options);
|
|
57
|
+
},
|
|
58
|
+
delete(name) {
|
|
59
|
+
mutableCookieStore.delete(ensureEncodedForJSCookie(name));
|
|
60
|
+
},
|
|
53
61
|
};
|
|
54
62
|
};
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
return
|
|
63
|
+
const createCookieStorageAdapterFromNextRequestAndHttpResponse = (request, response) => {
|
|
64
|
+
const readonlyCookieStore = request.cookies;
|
|
65
|
+
const mutableCookieStore = createMutableCookieStoreFromHeaders(response.headers);
|
|
66
|
+
return {
|
|
67
|
+
get(name) {
|
|
68
|
+
return readonlyCookieStore.get(ensureEncodedForJSCookie(name));
|
|
69
|
+
},
|
|
70
|
+
getAll: readonlyCookieStore.getAll.bind(readonlyCookieStore),
|
|
71
|
+
...mutableCookieStore,
|
|
72
|
+
};
|
|
59
73
|
};
|
|
60
|
-
|
|
61
|
-
|
|
74
|
+
const createCookieStorageAdapterFromNextCookies = (cookies) => {
|
|
75
|
+
const cookieStore = cookies();
|
|
62
76
|
// When Next cookies() is called in a server component, it returns a readonly
|
|
63
77
|
// cookie store. Hence calling set and delete throws an error. However,
|
|
64
78
|
// cookies() returns a mutable cookie store when called in a server action.
|
|
65
79
|
// We have no way to detect which one is returned, so we try to call set and delete
|
|
66
80
|
// and safely ignore the error if it is thrown.
|
|
67
|
-
|
|
81
|
+
const setFunc = (name, value, options) => {
|
|
68
82
|
try {
|
|
69
|
-
cookieStore.set(name, value, options);
|
|
83
|
+
cookieStore.set(ensureEncodedForJSCookie(name), value, options);
|
|
70
84
|
}
|
|
71
|
-
catch
|
|
85
|
+
catch {
|
|
72
86
|
// no-op
|
|
73
87
|
}
|
|
74
88
|
};
|
|
75
|
-
|
|
89
|
+
const deleteFunc = name => {
|
|
76
90
|
try {
|
|
77
|
-
cookieStore.delete(name);
|
|
91
|
+
cookieStore.delete(ensureEncodedForJSCookie(name));
|
|
78
92
|
}
|
|
79
|
-
catch
|
|
93
|
+
catch {
|
|
80
94
|
// no-op
|
|
81
95
|
}
|
|
82
96
|
};
|
|
83
97
|
return {
|
|
84
|
-
get
|
|
98
|
+
get(name) {
|
|
99
|
+
return cookieStore.get(ensureEncodedForJSCookie(name));
|
|
100
|
+
},
|
|
85
101
|
getAll: cookieStore.getAll.bind(cookieStore),
|
|
86
102
|
set: setFunc,
|
|
87
103
|
delete: deleteFunc,
|
|
88
104
|
};
|
|
89
105
|
};
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
value: value,
|
|
97
|
-
});
|
|
98
|
-
});
|
|
106
|
+
const createCookieStorageAdapterFromGetServerSidePropsContext = (request, response) => {
|
|
107
|
+
const cookiesMap = { ...request.cookies };
|
|
108
|
+
const allCookies = Object.entries(cookiesMap).map(([name, value]) => ({
|
|
109
|
+
name,
|
|
110
|
+
value,
|
|
111
|
+
}));
|
|
99
112
|
return {
|
|
100
|
-
get
|
|
101
|
-
|
|
113
|
+
get(name) {
|
|
114
|
+
const value = cookiesMap[ensureEncodedForJSCookie(name)];
|
|
102
115
|
return value
|
|
103
116
|
? {
|
|
104
|
-
name
|
|
105
|
-
value
|
|
117
|
+
name,
|
|
118
|
+
value,
|
|
106
119
|
}
|
|
107
120
|
: undefined;
|
|
108
121
|
},
|
|
109
|
-
getAll
|
|
122
|
+
getAll() {
|
|
110
123
|
return allCookies;
|
|
111
124
|
},
|
|
112
|
-
set
|
|
113
|
-
response.setHeader('Set-Cookie',
|
|
125
|
+
set(name, value, options) {
|
|
126
|
+
response.setHeader('Set-Cookie', `${ensureEncodedForJSCookie(name)}=${value};${options ? serializeSetCookieOptions(options) : ''}`);
|
|
114
127
|
},
|
|
115
|
-
delete
|
|
116
|
-
response.setHeader('Set-Cookie',
|
|
128
|
+
delete(name) {
|
|
129
|
+
response.setHeader('Set-Cookie', `${ensureEncodedForJSCookie(name)}=;Expires=${exports.DATE_IN_THE_PAST.toUTCString()}`);
|
|
117
130
|
},
|
|
118
131
|
};
|
|
119
132
|
};
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
headers.append('Set-Cookie',
|
|
133
|
+
const createMutableCookieStoreFromHeaders = (headers) => {
|
|
134
|
+
const setFunc = (name, value, options) => {
|
|
135
|
+
headers.append('Set-Cookie', `${ensureEncodedForJSCookie(name)}=${value};${options ? serializeSetCookieOptions(options) : ''}`);
|
|
123
136
|
};
|
|
124
|
-
|
|
125
|
-
headers.append('Set-Cookie',
|
|
137
|
+
const deleteFunc = name => {
|
|
138
|
+
headers.append('Set-Cookie', `${ensureEncodedForJSCookie(name)}=;Expires=${exports.DATE_IN_THE_PAST.toUTCString()}`);
|
|
126
139
|
};
|
|
127
140
|
return {
|
|
128
141
|
set: setFunc,
|
|
129
142
|
delete: deleteFunc,
|
|
130
143
|
};
|
|
131
144
|
};
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
145
|
+
const serializeSetCookieOptions = (options) => {
|
|
146
|
+
const { expires, domain, httpOnly, sameSite, secure } = options;
|
|
147
|
+
const serializedOptions = [];
|
|
135
148
|
if (domain) {
|
|
136
|
-
serializedOptions.push(
|
|
149
|
+
serializedOptions.push(`Domain=${domain}`);
|
|
137
150
|
}
|
|
138
151
|
if (expires) {
|
|
139
|
-
serializedOptions.push(
|
|
152
|
+
serializedOptions.push(`Expires=${expires.toUTCString()}`);
|
|
140
153
|
}
|
|
141
154
|
if (httpOnly) {
|
|
142
|
-
serializedOptions.push(
|
|
155
|
+
serializedOptions.push(`HttpOnly`);
|
|
143
156
|
}
|
|
144
157
|
if (sameSite) {
|
|
145
|
-
serializedOptions.push(
|
|
158
|
+
serializedOptions.push(`SameSite=${sameSite}`);
|
|
146
159
|
}
|
|
147
160
|
if (secure) {
|
|
148
|
-
serializedOptions.push(
|
|
161
|
+
serializedOptions.push(`Secure`);
|
|
149
162
|
}
|
|
150
163
|
return serializedOptions.join(';');
|
|
151
164
|
};
|
|
165
|
+
// Ensures the cookie names are encoded in order to look up the cookie store
|
|
166
|
+
// that is manipulated by js-cookie on the client side.
|
|
167
|
+
// Details of the js-cookie encoding behavior see:
|
|
168
|
+
// https://github.com/js-cookie/js-cookie#encoding
|
|
169
|
+
// The implementation is borrowed from js-cookie without escaping `[()]` as
|
|
170
|
+
// we are not using those chars in the auth keys.
|
|
171
|
+
const ensureEncodedForJSCookie = (name) => encodeURIComponent(name).replace(/%(2[346B]|5E|60|7C)/g, decodeURIComponent);
|
|
152
172
|
//# sourceMappingURL=createCookieStorageAdapterFromNextServerContext.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createCookieStorageAdapterFromNextServerContext.js","sourceRoot":"","sources":["../../src/utils/createCookieStorageAdapterFromNextServerContext.ts"],"names":[],"mappings":";AAAA,qEAAqE;AACrE,sCAAsC
|
|
1
|
+
{"version":3,"file":"createCookieStorageAdapterFromNextServerContext.js","sourceRoot":"","sources":["../../src/utils/createCookieStorageAdapterFromNextServerContext.ts"],"names":[],"mappings":";AAAA,qEAAqE;AACrE,sCAAsC;;;AAEtC,wCAAwD;AAExD,2EAGkD;AAErC,QAAA,gBAAgB,GAAG,IAAI,IAAI,CAAC,CAAC,CAAC,CAAC;AAErC,MAAM,+CAA+C,GAAG,CAC9D,OAA2B,EACH,EAAE;IAC1B,MAAM,EAAE,OAAO,EAAE,GAAG,EAAE,QAAQ,EAAE,GAAG,EAAE,GACpC,OAAwD,CAAC;IAE1D,iFAAiF;IACjF,sEAAsE;IACtE,2EAA2E;IAC3E,6EAA6E;IAC7E,kBAAkB;IAClB,IACC,GAAG;QACH,GAAG;QACH,MAAM,CAAC,SAAS,CAAC,QAAQ,C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