@aws-amplify/adapter-nextjs 1.0.29 → 1.0.30-gen2-storage.e54bfa9.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/dist/cjs/api/createServerRunnerForAPI.js +4 -3
- package/dist/cjs/api/createServerRunnerForAPI.js.map +1 -1
- package/dist/cjs/api/generateServerClient.js +2 -2
- package/dist/cjs/api/generateServerClient.js.map +1 -1
- package/dist/cjs/createServerRunner.js +4 -3
- package/dist/cjs/createServerRunner.js.map +1 -1
- package/dist/cjs/utils/index.js +1 -3
- package/dist/cjs/utils/index.js.map +1 -1
- package/dist/esm/api/createServerRunnerForAPI.mjs +2 -2
- package/dist/esm/api/createServerRunnerForAPI.mjs.map +1 -1
- package/dist/esm/api/generateServerClient.mjs +2 -5
- package/dist/esm/api/generateServerClient.mjs.map +1 -1
- package/dist/esm/createServerRunner.mjs +2 -2
- package/dist/esm/createServerRunner.mjs.map +1 -1
- package/dist/esm/types/NextServer.d.ts +2 -2
- package/dist/esm/utils/index.d.ts +0 -1
- package/dist/esm/utils/index.mjs +0 -1
- package/dist/esm/utils/index.mjs.map +1 -1
- package/package.json +72 -72
- package/src/api/createServerRunnerForAPI.ts +3 -2
- package/src/api/generateServerClient.ts +5 -3
- package/src/createServerRunner.ts +3 -2
- package/src/types/NextServer.ts +2 -2
- package/src/utils/index.ts +0 -1
- package/dist/cjs/utils/getAmplifyConfig.js +0 -12
- package/dist/cjs/utils/getAmplifyConfig.js.map +0 -1
- package/dist/esm/utils/getAmplifyConfig.d.ts +0 -3
- package/dist/esm/utils/getAmplifyConfig.mjs +0 -10
- package/dist/esm/utils/getAmplifyConfig.mjs.map +0 -1
- package/src/utils/getAmplifyConfig.ts +0 -13
|
@@ -4,11 +4,12 @@
|
|
|
4
4
|
// SPDX-License-Identifier: Apache-2.0
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.createServerRunnerForAPI = void 0;
|
|
7
|
-
const utils_1 = require("
|
|
7
|
+
const utils_1 = require("@aws-amplify/core/internals/utils");
|
|
8
|
+
const utils_2 = require("../utils");
|
|
8
9
|
const createServerRunnerForAPI = ({ config, }) => {
|
|
9
|
-
const amplifyConfig = (0, utils_1.
|
|
10
|
+
const amplifyConfig = (0, utils_1.parseAmplifyConfig)(config);
|
|
10
11
|
return {
|
|
11
|
-
runWithAmplifyServerContext: (0,
|
|
12
|
+
runWithAmplifyServerContext: (0, utils_2.createRunWithAmplifyServerContext)({
|
|
12
13
|
config: amplifyConfig,
|
|
13
14
|
}),
|
|
14
15
|
resourcesConfig: amplifyConfig,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createServerRunnerForAPI.js","sources":["../../../src/api/createServerRunnerForAPI.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.createServerRunnerForAPI = void 0;\nconst utils_1 = require(\"../utils\");\nconst createServerRunnerForAPI = ({ config, }) => {\n const amplifyConfig = (0, utils_1.
|
|
1
|
+
{"version":3,"file":"createServerRunnerForAPI.js","sources":["../../../src/api/createServerRunnerForAPI.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.createServerRunnerForAPI = void 0;\nconst utils_1 = require(\"@aws-amplify/core/internals/utils\");\nconst utils_2 = require(\"../utils\");\nconst createServerRunnerForAPI = ({ config, }) => {\n const amplifyConfig = (0, utils_1.parseAmplifyConfig)(config);\n return {\n runWithAmplifyServerContext: (0, utils_2.createRunWithAmplifyServerContext)({\n config: amplifyConfig,\n }),\n resourcesConfig: amplifyConfig,\n };\n};\nexports.createServerRunnerForAPI = createServerRunnerForAPI;\n"],"names":[],"mappings":";;AACA;AACA;AACA,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,YAAY,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC;AAC9D,OAAO,CAAC,wBAAwB,GAAG,KAAK,CAAC,CAAC;AAC1C,MAAM,OAAO,GAAG,OAAO,CAAC,mCAAmC,CAAC,CAAC;AAC7D,MAAM,OAAO,GAAG,OAAO,CAAC,UAAU,CAAC,CAAC;AACpC,MAAM,wBAAwB,GAAG,CAAC,EAAE,MAAM,GAAG,KAAK;AAClD,IAAI,MAAM,aAAa,GAAG,IAAI,OAAO,CAAC,kBAAkB,EAAE,MAAM,CAAC,CAAC;AAClE,IAAI,OAAO;AACX,QAAQ,2BAA2B,EAAE,IAAI,OAAO,CAAC,iCAAiC,EAAE;AACpF,YAAY,MAAM,EAAE,aAAa;AACjC,SAAS,CAAC;AACV,QAAQ,eAAe,EAAE,aAAa;AACtC,KAAK,CAAC;AACN,CAAC,CAAC;AACF,OAAO,CAAC,wBAAwB,GAAG,wBAAwB;;"}
|
|
@@ -7,7 +7,7 @@ exports.generateServerClientUsingReqRes = exports.generateServerClientUsingCooki
|
|
|
7
7
|
const internals_1 = require("@aws-amplify/api/internals");
|
|
8
8
|
const server_1 = require("aws-amplify/api/server");
|
|
9
9
|
const adapter_core_1 = require("@aws-amplify/core/internals/adapter-core");
|
|
10
|
-
const utils_1 = require("
|
|
10
|
+
const utils_1 = require("@aws-amplify/core/internals/utils");
|
|
11
11
|
const createServerRunnerForAPI_1 = require("./createServerRunnerForAPI");
|
|
12
12
|
/**
|
|
13
13
|
* Generates an API client that can be used inside a Next.js Server Component with Dynamic Rendering
|
|
@@ -59,7 +59,7 @@ exports.generateServerClientUsingCookies = generateServerClientUsingCookies;
|
|
|
59
59
|
* });
|
|
60
60
|
*/
|
|
61
61
|
function generateServerClientUsingReqRes({ config, authMode, authToken }) {
|
|
62
|
-
const amplifyConfig = (0, utils_1.
|
|
62
|
+
const amplifyConfig = (0, utils_1.parseAmplifyConfig)(config);
|
|
63
63
|
return (0, server_1.generateClient)({
|
|
64
64
|
config: amplifyConfig,
|
|
65
65
|
authMode,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"generateServerClient.js","sources":["../../../src/api/generateServerClient.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.generateServerClientUsingReqRes = exports.generateServerClientUsingCookies = void 0;\nconst internals_1 = require(\"@aws-amplify/api/internals\");\nconst server_1 = require(\"aws-amplify/api/server\");\nconst adapter_core_1 = require(\"@aws-amplify/core/internals/adapter-core\");\nconst utils_1 = require(\"
|
|
1
|
+
{"version":3,"file":"generateServerClient.js","sources":["../../../src/api/generateServerClient.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.generateServerClientUsingReqRes = exports.generateServerClientUsingCookies = void 0;\nconst internals_1 = require(\"@aws-amplify/api/internals\");\nconst server_1 = require(\"aws-amplify/api/server\");\nconst adapter_core_1 = require(\"@aws-amplify/core/internals/adapter-core\");\nconst utils_1 = require(\"@aws-amplify/core/internals/utils\");\nconst createServerRunnerForAPI_1 = require(\"./createServerRunnerForAPI\");\n/**\n * Generates an API client that can be used inside a Next.js Server Component with Dynamic Rendering\n *\n * @example\n * import { cookies } from \"next/headers\"\n *\n * const client = generateServerClientUsingCookies({ cookies });\n * const result = await client.graphql({ query: listPosts });\n */\nfunction generateServerClientUsingCookies({ config, cookies, authMode, authToken, }) {\n if (typeof cookies !== 'function') {\n throw new adapter_core_1.AmplifyServerContextError({\n message: 'generateServerClientUsingCookies is only compatible with the `cookies` Dynamic Function available in Server Components.',\n // TODO: link to docs\n recoverySuggestion: 'use `generateServerClient` inside of `runWithAmplifyServerContext` with the `request` object.',\n });\n }\n const { runWithAmplifyServerContext, resourcesConfig } = (0, createServerRunnerForAPI_1.createServerRunnerForAPI)({ config });\n // This function reference gets passed down to InternalGraphQLAPI.ts.graphql\n // where this._graphql is passed in as the `fn` argument\n // causing it to always get invoked inside `runWithAmplifyServerContext`\n const getAmplify = (fn) => runWithAmplifyServerContext({\n nextServerContext: { cookies },\n operation: contextSpec => fn((0, adapter_core_1.getAmplifyServerContext)(contextSpec).amplify),\n });\n return (0, internals_1.generateClientWithAmplifyInstance)({\n amplify: getAmplify,\n config: resourcesConfig,\n authMode,\n authToken,\n });\n}\nexports.generateServerClientUsingCookies = generateServerClientUsingCookies;\n/**\n * Generates an API client that can be used with both Pages Router and App Router\n *\n * @example\n * import config from './amplifyconfiguration.json';\n * import { listPosts } from './graphql/queries';\n *\n * const client = generateServerClientUsingReqRes({ config });\n *\n * const result = await runWithAmplifyServerContext({\n * nextServerContext: { request, response },\n * operation: (contextSpec) => client.graphql(contextSpec, {\n * query: listPosts,\n * }),\n * });\n */\nfunction generateServerClientUsingReqRes({ config, authMode, authToken }) {\n const amplifyConfig = (0, utils_1.parseAmplifyConfig)(config);\n return (0, server_1.generateClient)({\n config: amplifyConfig,\n authMode,\n authToken,\n });\n}\nexports.generateServerClientUsingReqRes = generateServerClientUsingReqRes;\n"],"names":[],"mappings":";;AACA;AACA;AACA,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,YAAY,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC;AAC9D,OAAO,CAAC,+BAA+B,GAAG,OAAO,CAAC,gCAAgC,GAAG,KAAK,CAAC,CAAC;AAC5F,MAAM,WAAW,GAAG,OAAO,CAAC,4BAA4B,CAAC,CAAC;AAC1D,MAAM,QAAQ,GAAG,OAAO,CAAC,wBAAwB,CAAC,CAAC;AACnD,MAAM,cAAc,GAAG,OAAO,CAAC,0CAA0C,CAAC,CAAC;AAC3E,MAAM,OAAO,GAAG,OAAO,CAAC,mCAAmC,CAAC,CAAC;AAC7D,MAAM,0BAA0B,GAAG,OAAO,CAAC,4BAA4B,CAAC,CAAC;AACzE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS,gCAAgC,CAAC,EAAE,MAAM,EAAE,OAAO,EAAE,QAAQ,EAAE,SAAS,GAAG,EAAE;AACrF,IAAI,IAAI,OAAO,OAAO,KAAK,UAAU,EAAE;AACvC,QAAQ,MAAM,IAAI,cAAc,CAAC,yBAAyB,CAAC;AAC3D,YAAY,OAAO,EAAE,yHAAyH;AAC9I;AACA,YAAY,kBAAkB,EAAE,+FAA+F;AAC/H,SAAS,CAAC,CAAC;AACX,KAAK;AACL,IAAI,MAAM,EAAE,2BAA2B,EAAE,eAAe,EAAE,GAAG,IAAI,0BAA0B,CAAC,wBAAwB,EAAE,EAAE,MAAM,EAAE,CAAC,CAAC;AAClI;AACA;AACA;AACA,IAAI,MAAM,UAAU,GAAG,CAAC,EAAE,KAAK,2BAA2B,CAAC;AAC3D,QAAQ,iBAAiB,EAAE,EAAE,OAAO,EAAE;AACtC,QAAQ,SAAS,EAAE,WAAW,IAAI,EAAE,CAAC,IAAI,cAAc,CAAC,uBAAuB,EAAE,WAAW,CAAC,CAAC,OAAO,CAAC;AACtG,KAAK,CAAC,CAAC;AACP,IAAI,OAAO,IAAI,WAAW,CAAC,iCAAiC,EAAE;AAC9D,QAAQ,OAAO,EAAE,UAAU;AAC3B,QAAQ,MAAM,EAAE,eAAe;AAC/B,QAAQ,QAAQ;AAChB,QAAQ,SAAS;AACjB,KAAK,CAAC,CAAC;AACP,CAAC;AACD,OAAO,CAAC,gCAAgC,GAAG,gCAAgC,CAAC;AAC5E;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS,+BAA+B,CAAC,EAAE,MAAM,EAAE,QAAQ,EAAE,SAAS,EAAE,EAAE;AAC1E,IAAI,MAAM,aAAa,GAAG,IAAI,OAAO,CAAC,kBAAkB,EAAE,MAAM,CAAC,CAAC;AAClE,IAAI,OAAO,IAAI,QAAQ,CAAC,cAAc,EAAE;AACxC,QAAQ,MAAM,EAAE,aAAa;AAC7B,QAAQ,QAAQ;AAChB,QAAQ,SAAS;AACjB,KAAK,CAAC,CAAC;AACP,CAAC;AACD,OAAO,CAAC,+BAA+B,GAAG,+BAA+B;;"}
|
|
@@ -4,7 +4,8 @@
|
|
|
4
4
|
// SPDX-License-Identifier: Apache-2.0
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.createServerRunner = void 0;
|
|
7
|
-
const utils_1 = require("
|
|
7
|
+
const utils_1 = require("@aws-amplify/core/internals/utils");
|
|
8
|
+
const utils_2 = require("./utils");
|
|
8
9
|
/**
|
|
9
10
|
* Creates the `runWithAmplifyServerContext` function to run Amplify server side APIs in an isolated request context.
|
|
10
11
|
*
|
|
@@ -24,9 +25,9 @@ const utils_1 = require("./utils");
|
|
|
24
25
|
* export const { runWithAmplifyServerContext } = createServerRunner({ config })
|
|
25
26
|
*/
|
|
26
27
|
const createServerRunner = ({ config, }) => {
|
|
27
|
-
const amplifyConfig = (0, utils_1.
|
|
28
|
+
const amplifyConfig = (0, utils_1.parseAmplifyConfig)(config);
|
|
28
29
|
return {
|
|
29
|
-
runWithAmplifyServerContext: (0,
|
|
30
|
+
runWithAmplifyServerContext: (0, utils_2.createRunWithAmplifyServerContext)({
|
|
30
31
|
config: amplifyConfig,
|
|
31
32
|
}),
|
|
32
33
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createServerRunner.js","sources":["../../src/createServerRunner.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.createServerRunner = void 0;\nconst utils_1 = require(\"./utils\");\n/**\n * Creates the `runWithAmplifyServerContext` function to run Amplify server side APIs in an isolated request context.\n *\n * @remarks\n * This function should be called only once; you can use the returned `runWithAmplifyServerContext` across\n * your codebase.\n *\n * @param input The input used to create the `runWithAmplifyServerContext` function.\n * @param input.config The {@link ResourcesConfig} imported from the `amplifyconfiguration.json` file or manually\n * created.\n * @returns An object that contains the `runWithAmplifyServerContext` function.\n *\n * @example\n * import { createServerRunner } from '@aws-amplify/adapter-nextjs';\n * import config from './amplifyconfiguration.json';\n *\n * export const { runWithAmplifyServerContext } = createServerRunner({ config })\n */\nconst createServerRunner = ({ config, }) => {\n const amplifyConfig = (0, utils_1.
|
|
1
|
+
{"version":3,"file":"createServerRunner.js","sources":["../../src/createServerRunner.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.createServerRunner = void 0;\nconst utils_1 = require(\"@aws-amplify/core/internals/utils\");\nconst utils_2 = require(\"./utils\");\n/**\n * Creates the `runWithAmplifyServerContext` function to run Amplify server side APIs in an isolated request context.\n *\n * @remarks\n * This function should be called only once; you can use the returned `runWithAmplifyServerContext` across\n * your codebase.\n *\n * @param input The input used to create the `runWithAmplifyServerContext` function.\n * @param input.config The {@link ResourcesConfig} imported from the `amplifyconfiguration.json` file or manually\n * created.\n * @returns An object that contains the `runWithAmplifyServerContext` function.\n *\n * @example\n * import { createServerRunner } from '@aws-amplify/adapter-nextjs';\n * import config from './amplifyconfiguration.json';\n *\n * export const { runWithAmplifyServerContext } = createServerRunner({ config })\n */\nconst createServerRunner = ({ config, }) => {\n const amplifyConfig = (0, utils_1.parseAmplifyConfig)(config);\n return {\n runWithAmplifyServerContext: (0, utils_2.createRunWithAmplifyServerContext)({\n config: amplifyConfig,\n }),\n };\n};\nexports.createServerRunner = createServerRunner;\n"],"names":[],"mappings":";;AACA;AACA;AACA,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,YAAY,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC;AAC9D,OAAO,CAAC,kBAAkB,GAAG,KAAK,CAAC,CAAC;AACpC,MAAM,OAAO,GAAG,OAAO,CAAC,mCAAmC,CAAC,CAAC;AAC7D,MAAM,OAAO,GAAG,OAAO,CAAC,SAAS,CAAC,CAAC;AACnC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAM,kBAAkB,GAAG,CAAC,EAAE,MAAM,GAAG,KAAK;AAC5C,IAAI,MAAM,aAAa,GAAG,IAAI,OAAO,CAAC,kBAAkB,EAAE,MAAM,CAAC,CAAC;AAClE,IAAI,OAAO;AACX,QAAQ,2BAA2B,EAAE,IAAI,OAAO,CAAC,iCAAiC,EAAE;AACpF,YAAY,MAAM,EAAE,aAAa;AACjC,SAAS,CAAC;AACV,KAAK,CAAC;AACN,CAAC,CAAC;AACF,OAAO,CAAC,kBAAkB,GAAG,kBAAkB;;"}
|
package/dist/cjs/utils/index.js
CHANGED
|
@@ -3,9 +3,7 @@
|
|
|
3
3
|
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
4
4
|
// SPDX-License-Identifier: Apache-2.0
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.createRunWithAmplifyServerContext =
|
|
7
|
-
var getAmplifyConfig_1 = require("./getAmplifyConfig");
|
|
8
|
-
Object.defineProperty(exports, "getAmplifyConfig", { enumerable: true, get: function () { return getAmplifyConfig_1.getAmplifyConfig; } });
|
|
6
|
+
exports.createRunWithAmplifyServerContext = void 0;
|
|
9
7
|
var createRunWithAmplifyServerContext_1 = require("./createRunWithAmplifyServerContext");
|
|
10
8
|
Object.defineProperty(exports, "createRunWithAmplifyServerContext", { enumerable: true, get: function () { return createRunWithAmplifyServerContext_1.createRunWithAmplifyServerContext; } });
|
|
11
9
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../../../src/utils/index.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.createRunWithAmplifyServerContext =
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../../src/utils/index.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.createRunWithAmplifyServerContext = void 0;\nvar createRunWithAmplifyServerContext_1 = require(\"./createRunWithAmplifyServerContext\");\nObject.defineProperty(exports, \"createRunWithAmplifyServerContext\", { enumerable: true, get: function () { return createRunWithAmplifyServerContext_1.createRunWithAmplifyServerContext; } });\n"],"names":[],"mappings":";;AACA;AACA;AACA,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,YAAY,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC;AAC9D,OAAO,CAAC,iCAAiC,GAAG,KAAK,CAAC,CAAC;AACnD,IAAI,mCAAmC,GAAG,OAAO,CAAC,qCAAqC,CAAC,CAAC;AACzF,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,mCAAmC,EAAE,EAAE,UAAU,EAAE,IAAI,EAAE,GAAG,EAAE,YAAY,EAAE,OAAO,mCAAmC,CAAC,iCAAiC,CAAC,EAAE,EAAE,CAAC;;"}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { parseAmplifyConfig } from '@aws-amplify/core/internals/utils';
|
|
2
2
|
import { createRunWithAmplifyServerContext } from '../utils/createRunWithAmplifyServerContext.mjs';
|
|
3
3
|
|
|
4
4
|
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
5
5
|
// SPDX-License-Identifier: Apache-2.0
|
|
6
6
|
const createServerRunnerForAPI = ({ config, }) => {
|
|
7
|
-
const amplifyConfig =
|
|
7
|
+
const amplifyConfig = parseAmplifyConfig(config);
|
|
8
8
|
return {
|
|
9
9
|
runWithAmplifyServerContext: createRunWithAmplifyServerContext({
|
|
10
10
|
config: amplifyConfig,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createServerRunnerForAPI.mjs","sources":["../../../src/api/createServerRunnerForAPI.ts"],"sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport { createRunWithAmplifyServerContext
|
|
1
|
+
{"version":3,"file":"createServerRunnerForAPI.mjs","sources":["../../../src/api/createServerRunnerForAPI.ts"],"sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport { parseAmplifyConfig } from '@aws-amplify/core/internals/utils';\nimport { createRunWithAmplifyServerContext } from '../utils';\nexport const createServerRunnerForAPI = ({ config, }) => {\n const amplifyConfig = parseAmplifyConfig(config);\n return {\n runWithAmplifyServerContext: createRunWithAmplifyServerContext({\n config: amplifyConfig,\n }),\n resourcesConfig: amplifyConfig,\n };\n};\n"],"names":[],"mappings":";;;AAAA;AACA;AAGY,MAAC,wBAAwB,GAAG,CAAC,EAAE,MAAM,GAAG,KAAK;AACzD,IAAI,MAAM,aAAa,GAAG,kBAAkB,CAAC,MAAM,CAAC,CAAC;AACrD,IAAI,OAAO;AACX,QAAQ,2BAA2B,EAAE,iCAAiC,CAAC;AACvE,YAAY,MAAM,EAAE,aAAa;AACjC,SAAS,CAAC;AACV,QAAQ,eAAe,EAAE,aAAa;AACtC,KAAK,CAAC;AACN;;;;"}
|
|
@@ -1,10 +1,7 @@
|
|
|
1
1
|
import { generateClientWithAmplifyInstance } from '@aws-amplify/api/internals';
|
|
2
2
|
import { generateClient } from 'aws-amplify/api/server';
|
|
3
3
|
import { AmplifyServerContextError, getAmplifyServerContext } from '@aws-amplify/core/internals/adapter-core';
|
|
4
|
-
import {
|
|
5
|
-
import '@aws-amplify/core';
|
|
6
|
-
import 'aws-amplify/adapter-core';
|
|
7
|
-
import 'next/server.js';
|
|
4
|
+
import { parseAmplifyConfig } from '@aws-amplify/core/internals/utils';
|
|
8
5
|
import { createServerRunnerForAPI } from './createServerRunnerForAPI.mjs';
|
|
9
6
|
|
|
10
7
|
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
@@ -58,7 +55,7 @@ function generateServerClientUsingCookies({ config, cookies, authMode, authToken
|
|
|
58
55
|
* });
|
|
59
56
|
*/
|
|
60
57
|
function generateServerClientUsingReqRes({ config, authMode, authToken }) {
|
|
61
|
-
const amplifyConfig =
|
|
58
|
+
const amplifyConfig = parseAmplifyConfig(config);
|
|
62
59
|
return generateClient({
|
|
63
60
|
config: amplifyConfig,
|
|
64
61
|
authMode,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"generateServerClient.mjs","sources":["../../../src/api/generateServerClient.ts"],"sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport { generateClientWithAmplifyInstance } from '@aws-amplify/api/internals';\nimport { generateClient } from 'aws-amplify/api/server';\nimport { AmplifyServerContextError, getAmplifyServerContext, } from '@aws-amplify/core/internals/adapter-core';\nimport {
|
|
1
|
+
{"version":3,"file":"generateServerClient.mjs","sources":["../../../src/api/generateServerClient.ts"],"sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport { generateClientWithAmplifyInstance } from '@aws-amplify/api/internals';\nimport { generateClient } from 'aws-amplify/api/server';\nimport { AmplifyServerContextError, getAmplifyServerContext, } from '@aws-amplify/core/internals/adapter-core';\nimport { parseAmplifyConfig, } from '@aws-amplify/core/internals/utils';\nimport { createServerRunnerForAPI } from './createServerRunnerForAPI';\n/**\n * Generates an API client that can be used inside a Next.js Server Component with Dynamic Rendering\n *\n * @example\n * import { cookies } from \"next/headers\"\n *\n * const client = generateServerClientUsingCookies({ cookies });\n * const result = await client.graphql({ query: listPosts });\n */\nexport function generateServerClientUsingCookies({ config, cookies, authMode, authToken, }) {\n if (typeof cookies !== 'function') {\n throw new AmplifyServerContextError({\n message: 'generateServerClientUsingCookies is only compatible with the `cookies` Dynamic Function available in Server Components.',\n // TODO: link to docs\n recoverySuggestion: 'use `generateServerClient` inside of `runWithAmplifyServerContext` with the `request` object.',\n });\n }\n const { runWithAmplifyServerContext, resourcesConfig } = createServerRunnerForAPI({ config });\n // This function reference gets passed down to InternalGraphQLAPI.ts.graphql\n // where this._graphql is passed in as the `fn` argument\n // causing it to always get invoked inside `runWithAmplifyServerContext`\n const getAmplify = (fn) => runWithAmplifyServerContext({\n nextServerContext: { cookies },\n operation: contextSpec => fn(getAmplifyServerContext(contextSpec).amplify),\n });\n return generateClientWithAmplifyInstance({\n amplify: getAmplify,\n config: resourcesConfig,\n authMode,\n authToken,\n });\n}\n/**\n * Generates an API client that can be used with both Pages Router and App Router\n *\n * @example\n * import config from './amplifyconfiguration.json';\n * import { listPosts } from './graphql/queries';\n *\n * const client = generateServerClientUsingReqRes({ config });\n *\n * const result = await runWithAmplifyServerContext({\n * nextServerContext: { request, response },\n * operation: (contextSpec) => client.graphql(contextSpec, {\n * query: listPosts,\n * }),\n * });\n */\nexport function generateServerClientUsingReqRes({ config, authMode, authToken }) {\n const amplifyConfig = parseAmplifyConfig(config);\n return generateClient({\n config: amplifyConfig,\n authMode,\n authToken,\n });\n}\n"],"names":[],"mappings":";;;;;;AAAA;AACA;AAMA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAAS,gCAAgC,CAAC,EAAE,MAAM,EAAE,OAAO,EAAE,QAAQ,EAAE,SAAS,GAAG,EAAE;AAC5F,IAAI,IAAI,OAAO,OAAO,KAAK,UAAU,EAAE;AACvC,QAAQ,MAAM,IAAI,yBAAyB,CAAC;AAC5C,YAAY,OAAO,EAAE,yHAAyH;AAC9I;AACA,YAAY,kBAAkB,EAAE,+FAA+F;AAC/H,SAAS,CAAC,CAAC;AACX,KAAK;AACL,IAAI,MAAM,EAAE,2BAA2B,EAAE,eAAe,EAAE,GAAG,wBAAwB,CAAC,EAAE,MAAM,EAAE,CAAC,CAAC;AAClG;AACA;AACA;AACA,IAAI,MAAM,UAAU,GAAG,CAAC,EAAE,KAAK,2BAA2B,CAAC;AAC3D,QAAQ,iBAAiB,EAAE,EAAE,OAAO,EAAE;AACtC,QAAQ,SAAS,EAAE,WAAW,IAAI,EAAE,CAAC,uBAAuB,CAAC,WAAW,CAAC,CAAC,OAAO,CAAC;AAClF,KAAK,CAAC,CAAC;AACP,IAAI,OAAO,iCAAiC,CAAC;AAC7C,QAAQ,OAAO,EAAE,UAAU;AAC3B,QAAQ,MAAM,EAAE,eAAe;AAC/B,QAAQ,QAAQ;AAChB,QAAQ,SAAS;AACjB,KAAK,CAAC,CAAC;AACP,CAAC;AACD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAAS,+BAA+B,CAAC,EAAE,MAAM,EAAE,QAAQ,EAAE,SAAS,EAAE,EAAE;AACjF,IAAI,MAAM,aAAa,GAAG,kBAAkB,CAAC,MAAM,CAAC,CAAC;AACrD,IAAI,OAAO,cAAc,CAAC;AAC1B,QAAQ,MAAM,EAAE,aAAa;AAC7B,QAAQ,QAAQ;AAChB,QAAQ,SAAS;AACjB,KAAK,CAAC,CAAC;AACP;;;;"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { parseAmplifyConfig } from '@aws-amplify/core/internals/utils';
|
|
2
2
|
import { createRunWithAmplifyServerContext } from './utils/createRunWithAmplifyServerContext.mjs';
|
|
3
3
|
|
|
4
4
|
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
@@ -22,7 +22,7 @@ import { createRunWithAmplifyServerContext } from './utils/createRunWithAmplifyS
|
|
|
22
22
|
* export const { runWithAmplifyServerContext } = createServerRunner({ config })
|
|
23
23
|
*/
|
|
24
24
|
const createServerRunner = ({ config, }) => {
|
|
25
|
-
const amplifyConfig =
|
|
25
|
+
const amplifyConfig = parseAmplifyConfig(config);
|
|
26
26
|
return {
|
|
27
27
|
runWithAmplifyServerContext: createRunWithAmplifyServerContext({
|
|
28
28
|
config: amplifyConfig,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createServerRunner.mjs","sources":["../../src/createServerRunner.ts"],"sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport { createRunWithAmplifyServerContext
|
|
1
|
+
{"version":3,"file":"createServerRunner.mjs","sources":["../../src/createServerRunner.ts"],"sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport { parseAmplifyConfig } from '@aws-amplify/core/internals/utils';\nimport { createRunWithAmplifyServerContext } from './utils';\n/**\n * Creates the `runWithAmplifyServerContext` function to run Amplify server side APIs in an isolated request context.\n *\n * @remarks\n * This function should be called only once; you can use the returned `runWithAmplifyServerContext` across\n * your codebase.\n *\n * @param input The input used to create the `runWithAmplifyServerContext` function.\n * @param input.config The {@link ResourcesConfig} imported from the `amplifyconfiguration.json` file or manually\n * created.\n * @returns An object that contains the `runWithAmplifyServerContext` function.\n *\n * @example\n * import { createServerRunner } from '@aws-amplify/adapter-nextjs';\n * import config from './amplifyconfiguration.json';\n *\n * export const { runWithAmplifyServerContext } = createServerRunner({ config })\n */\nexport const createServerRunner = ({ config, }) => {\n const amplifyConfig = parseAmplifyConfig(config);\n return {\n runWithAmplifyServerContext: createRunWithAmplifyServerContext({\n config: amplifyConfig,\n }),\n };\n};\n"],"names":[],"mappings":";;;AAAA;AACA;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACY,MAAC,kBAAkB,GAAG,CAAC,EAAE,MAAM,GAAG,KAAK;AACnD,IAAI,MAAM,aAAa,GAAG,kBAAkB,CAAC,MAAM,CAAC,CAAC;AACrD,IAAI,OAAO;AACX,QAAQ,2BAA2B,EAAE,iCAAiC,CAAC;AACvE,YAAY,MAAM,EAAE,aAAa;AACjC,SAAS,CAAC;AACV,KAAK,CAAC;AACN;;;;"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { GetServerSidePropsContext as NextGetServerSidePropsContext } from 'next';
|
|
2
2
|
import { NextRequest, NextResponse } from 'next/server.js';
|
|
3
3
|
import { cookies } from 'next/headers.js';
|
|
4
|
-
import { LegacyConfig } from 'aws-amplify/adapter-core';
|
|
4
|
+
import { AmplifyOutputs, LegacyConfig } from 'aws-amplify/adapter-core';
|
|
5
5
|
import { AmplifyServer } from '@aws-amplify/core/internals/adapter-core';
|
|
6
6
|
import { ResourcesConfig } from '@aws-amplify/core';
|
|
7
7
|
export declare namespace NextServer {
|
|
@@ -54,7 +54,7 @@ export declare namespace NextServer {
|
|
|
54
54
|
}
|
|
55
55
|
type RunOperationWithContext = <OperationResult>(input: RunWithContextInput<OperationResult>) => Promise<OperationResult>;
|
|
56
56
|
interface CreateServerRunnerInput {
|
|
57
|
-
config: ResourcesConfig | LegacyConfig;
|
|
57
|
+
config: ResourcesConfig | LegacyConfig | AmplifyOutputs;
|
|
58
58
|
}
|
|
59
59
|
interface CreateServerRunnerOutput {
|
|
60
60
|
runWithAmplifyServerContext: RunOperationWithContext;
|
package/dist/esm/utils/index.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.mjs","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.mjs","sources":[],"sourcesContent":[],"names":[],"mappings":""}
|
package/package.json
CHANGED
|
@@ -1,74 +1,74 @@
|
|
|
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
|
-
|
|
2
|
+
"author": "Amazon Web Services",
|
|
3
|
+
"name": "@aws-amplify/adapter-nextjs",
|
|
4
|
+
"version": "1.0.30-gen2-storage.e54bfa9.0+e54bfa9",
|
|
5
|
+
"description": "The adapter for the supporting of using Amplify APIs in Next.js.",
|
|
6
|
+
"peerDependencies": {
|
|
7
|
+
"aws-amplify": "6.0.30-gen2-storage.e54bfa9.0+e54bfa9",
|
|
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.30-gen2-storage.e54bfa9.0+e54bfa9",
|
|
19
|
+
"jest-fetch-mock": "3.0.3",
|
|
20
|
+
"next": ">= 13.5.0 < 15.0.0",
|
|
21
|
+
"typescript": "5.0.2"
|
|
22
|
+
},
|
|
23
|
+
"publishConfig": {
|
|
24
|
+
"access": "public"
|
|
25
|
+
},
|
|
26
|
+
"bugs": {
|
|
27
|
+
"url": "https://github.com/aws/aws-amplify/issues"
|
|
28
|
+
},
|
|
29
|
+
"exports": {
|
|
30
|
+
".": {
|
|
31
|
+
"types": "./dist/esm/index.d.ts",
|
|
32
|
+
"import": "./dist/esm/index.mjs",
|
|
33
|
+
"require": "./dist/cjs/index.js"
|
|
34
|
+
},
|
|
35
|
+
"./api": {
|
|
36
|
+
"types": "./dist/esm/api/index.d.ts",
|
|
37
|
+
"import": "./dist/esm/api/index.mjs",
|
|
38
|
+
"require": "./dist/cjs/api/index.js"
|
|
39
|
+
},
|
|
40
|
+
"./data": {
|
|
41
|
+
"types": "./dist/esm/api/index.d.ts",
|
|
42
|
+
"import": "./dist/esm/api/index.mjs",
|
|
43
|
+
"require": "./dist/cjs/api/index.js"
|
|
44
|
+
},
|
|
45
|
+
"./package.json": "./package.json"
|
|
46
|
+
},
|
|
47
|
+
"files": [
|
|
48
|
+
"dist/cjs",
|
|
49
|
+
"dist/esm",
|
|
50
|
+
"src",
|
|
51
|
+
"api",
|
|
52
|
+
"data"
|
|
53
|
+
],
|
|
54
|
+
"homepage": "https://aws-amplify.github.io/",
|
|
55
|
+
"license": "Apache-2.0",
|
|
56
|
+
"main": "./dist/cjs/index.js",
|
|
57
|
+
"module": "./dist/esm/index.mjs",
|
|
58
|
+
"typings": "./dist/esm/index.d.ts",
|
|
59
|
+
"sideEffects": false,
|
|
60
|
+
"scripts": {
|
|
61
|
+
"build": "npm run clean && npm run build:esm-cjs",
|
|
62
|
+
"build-with-test": "npm test && npm run build",
|
|
63
|
+
"build:esm-cjs": "rollup -c rollup.config.mjs",
|
|
64
|
+
"build:watch": "npm run build:esm-cjs -- --watch",
|
|
65
|
+
"clean": "npm run clean:size && rimraf dist",
|
|
66
|
+
"clean:size": "rimraf dual-publish-tmp tmp*",
|
|
67
|
+
"format": "echo \"Not implemented\"",
|
|
68
|
+
"lint": "eslint '**/*.{ts,tsx}' && npm run ts-coverage",
|
|
69
|
+
"lint:fix": "eslint '**/*.{ts,tsx}' --fix",
|
|
70
|
+
"test": "npm run lint && jest -w 1 --coverage --logHeapUsage",
|
|
71
|
+
"ts-coverage": "typescript-coverage-report -p ./tsconfig.build.json -t 90.31"
|
|
72
|
+
},
|
|
73
|
+
"gitHead": "e54bfa991dbe75b7c7691bf0504a0b1616362837"
|
|
74
74
|
}
|
|
@@ -2,8 +2,9 @@
|
|
|
2
2
|
// SPDX-License-Identifier: Apache-2.0
|
|
3
3
|
|
|
4
4
|
import { ResourcesConfig } from '@aws-amplify/core';
|
|
5
|
+
import { parseAmplifyConfig } from '@aws-amplify/core/internals/utils';
|
|
5
6
|
|
|
6
|
-
import { createRunWithAmplifyServerContext
|
|
7
|
+
import { createRunWithAmplifyServerContext } from '../utils';
|
|
7
8
|
import { NextServer } from '../types';
|
|
8
9
|
|
|
9
10
|
export const createServerRunnerForAPI = ({
|
|
@@ -11,7 +12,7 @@ export const createServerRunnerForAPI = ({
|
|
|
11
12
|
}: NextServer.CreateServerRunnerInput): NextServer.CreateServerRunnerOutput & {
|
|
12
13
|
resourcesConfig: ResourcesConfig;
|
|
13
14
|
} => {
|
|
14
|
-
const amplifyConfig =
|
|
15
|
+
const amplifyConfig = parseAmplifyConfig(config);
|
|
15
16
|
|
|
16
17
|
return {
|
|
17
18
|
runWithAmplifyServerContext: createRunWithAmplifyServerContext({
|
|
@@ -11,10 +11,12 @@ import {
|
|
|
11
11
|
V6ClientSSRCookies,
|
|
12
12
|
V6ClientSSRRequest,
|
|
13
13
|
} from '@aws-amplify/api-graphql';
|
|
14
|
-
import {
|
|
14
|
+
import {
|
|
15
|
+
GraphQLAuthMode,
|
|
16
|
+
parseAmplifyConfig,
|
|
17
|
+
} from '@aws-amplify/core/internals/utils';
|
|
15
18
|
|
|
16
19
|
import { NextServer } from '../types';
|
|
17
|
-
import { getAmplifyConfig } from '../utils';
|
|
18
20
|
|
|
19
21
|
import { createServerRunnerForAPI } from './createServerRunnerForAPI';
|
|
20
22
|
|
|
@@ -98,7 +100,7 @@ export function generateServerClientUsingCookies<
|
|
|
98
100
|
export function generateServerClientUsingReqRes<
|
|
99
101
|
T extends Record<any, any> = never,
|
|
100
102
|
>({ config, authMode, authToken }: ReqClientParams): V6ClientSSRRequest<T> {
|
|
101
|
-
const amplifyConfig =
|
|
103
|
+
const amplifyConfig = parseAmplifyConfig(config);
|
|
102
104
|
|
|
103
105
|
return generateClient<T>({
|
|
104
106
|
config: amplifyConfig,
|
|
@@ -2,8 +2,9 @@
|
|
|
2
2
|
// SPDX-License-Identifier: Apache-2.0
|
|
3
3
|
|
|
4
4
|
import { ResourcesConfig } from 'aws-amplify';
|
|
5
|
+
import { parseAmplifyConfig } from '@aws-amplify/core/internals/utils';
|
|
5
6
|
|
|
6
|
-
import { createRunWithAmplifyServerContext
|
|
7
|
+
import { createRunWithAmplifyServerContext } from './utils';
|
|
7
8
|
import { NextServer } from './types';
|
|
8
9
|
|
|
9
10
|
/**
|
|
@@ -27,7 +28,7 @@ import { NextServer } from './types';
|
|
|
27
28
|
export const createServerRunner: NextServer.CreateServerRunner = ({
|
|
28
29
|
config,
|
|
29
30
|
}) => {
|
|
30
|
-
const amplifyConfig =
|
|
31
|
+
const amplifyConfig = parseAmplifyConfig(config);
|
|
31
32
|
|
|
32
33
|
return {
|
|
33
34
|
runWithAmplifyServerContext: createRunWithAmplifyServerContext({
|
package/src/types/NextServer.ts
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
import { GetServerSidePropsContext as NextGetServerSidePropsContext } from 'next';
|
|
5
5
|
import { NextRequest, NextResponse } from 'next/server.js';
|
|
6
6
|
import { cookies } from 'next/headers.js';
|
|
7
|
-
import { LegacyConfig } from 'aws-amplify/adapter-core';
|
|
7
|
+
import { AmplifyOutputs, 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
|
|
|
@@ -74,7 +74,7 @@ export declare namespace NextServer {
|
|
|
74
74
|
) => Promise<OperationResult>;
|
|
75
75
|
|
|
76
76
|
export interface CreateServerRunnerInput {
|
|
77
|
-
config: ResourcesConfig | LegacyConfig;
|
|
77
|
+
config: ResourcesConfig | LegacyConfig | AmplifyOutputs;
|
|
78
78
|
}
|
|
79
79
|
|
|
80
80
|
export interface CreateServerRunnerOutput {
|
package/src/utils/index.ts
CHANGED
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
4
|
-
// SPDX-License-Identifier: Apache-2.0
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.getAmplifyConfig = void 0;
|
|
7
|
-
const utils_1 = require("@aws-amplify/core/internals/utils");
|
|
8
|
-
const getAmplifyConfig = (config) => Object.keys(config).some(key => key.startsWith('aws_'))
|
|
9
|
-
? (0, utils_1.parseAWSExports)(config)
|
|
10
|
-
: config;
|
|
11
|
-
exports.getAmplifyConfig = getAmplifyConfig;
|
|
12
|
-
//# sourceMappingURL=getAmplifyConfig.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"getAmplifyConfig.js","sources":["../../../src/utils/getAmplifyConfig.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.getAmplifyConfig = void 0;\nconst utils_1 = require(\"@aws-amplify/core/internals/utils\");\nconst getAmplifyConfig = (config) => Object.keys(config).some(key => key.startsWith('aws_'))\n ? (0, utils_1.parseAWSExports)(config)\n : config;\nexports.getAmplifyConfig = getAmplifyConfig;\n"],"names":[],"mappings":";;AACA;AACA;AACA,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,YAAY,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC;AAC9D,OAAO,CAAC,gBAAgB,GAAG,KAAK,CAAC,CAAC;AAClC,MAAM,OAAO,GAAG,OAAO,CAAC,mCAAmC,CAAC,CAAC;AAC7D,MAAM,gBAAgB,GAAG,CAAC,MAAM,KAAK,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,IAAI,CAAC,GAAG,IAAI,GAAG,CAAC,UAAU,CAAC,MAAM,CAAC,CAAC;AAC5F,MAAM,IAAI,OAAO,CAAC,eAAe,EAAE,MAAM,CAAC;AAC1C,MAAM,MAAM,CAAC;AACb,OAAO,CAAC,gBAAgB,GAAG,gBAAgB;;"}
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { parseAWSExports } from '@aws-amplify/core/internals/utils';
|
|
2
|
-
|
|
3
|
-
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
4
|
-
// SPDX-License-Identifier: Apache-2.0
|
|
5
|
-
const getAmplifyConfig = (config) => Object.keys(config).some(key => key.startsWith('aws_'))
|
|
6
|
-
? parseAWSExports(config)
|
|
7
|
-
: config;
|
|
8
|
-
|
|
9
|
-
export { getAmplifyConfig };
|
|
10
|
-
//# sourceMappingURL=getAmplifyConfig.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"getAmplifyConfig.mjs","sources":["../../../src/utils/getAmplifyConfig.ts"],"sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport { parseAWSExports } from '@aws-amplify/core/internals/utils';\nexport const getAmplifyConfig = (config) => Object.keys(config).some(key => key.startsWith('aws_'))\n ? parseAWSExports(config)\n : config;\n"],"names":[],"mappings":";;AAAA;AACA;AAEY,MAAC,gBAAgB,GAAG,CAAC,MAAM,KAAK,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,IAAI,CAAC,GAAG,IAAI,GAAG,CAAC,UAAU,CAAC,MAAM,CAAC,CAAC;AACnG,MAAM,eAAe,CAAC,MAAM,CAAC;AAC7B,MAAM;;;;"}
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
2
|
-
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
-
|
|
4
|
-
import { ResourcesConfig } from 'aws-amplify';
|
|
5
|
-
import { LegacyConfig } from 'aws-amplify/adapter-core';
|
|
6
|
-
import { parseAWSExports } from '@aws-amplify/core/internals/utils';
|
|
7
|
-
|
|
8
|
-
export const getAmplifyConfig = (
|
|
9
|
-
config: ResourcesConfig | LegacyConfig,
|
|
10
|
-
): ResourcesConfig =>
|
|
11
|
-
Object.keys(config).some(key => key.startsWith('aws_'))
|
|
12
|
-
? parseAWSExports(config)
|
|
13
|
-
: (config as ResourcesConfig);
|