@aws-amplify/adapter-nextjs 1.0.17-unstable.5c56101.0 → 1.0.17

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.
@@ -7,8 +7,8 @@ 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 createServerRunnerForAPI_1 = require("./createServerRunnerForAPI");
11
10
  const utils_1 = require("../utils");
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
14
14
  *
@@ -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 createServerRunnerForAPI_1 = require(\"./createServerRunnerForAPI\");\nconst utils_1 = require(\"../utils\");\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.getAmplifyConfig)(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,0BAA0B,GAAG,OAAO,CAAC,4BAA4B,CAA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EAAE,MAAM,CAAC,CAAC;AAChE,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;;"}
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(\"../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.getAmplifyConfig)(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,UAAU,CAAC,CAAC;AACpC,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,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equest, V6ClientSSRCookies } from '@aws-amplify/api-graphql';
2
- import { NextServer } from '../types';
1
+ import { V6ClientSSRCookies, V6ClientSSRRequest } from '@aws-amplify/api-graphql';
3
2
  import { GraphQLAuthMode } from '@aws-amplify/core/internals/utils';
4
- type CookiesClientParams = {
3
+ import { NextServer } from '../types';
4
+ interface CookiesClientParams {
5
5
  cookies: NextServer.ServerComponentContext['cookies'];
6
6
  config: NextServer.CreateServerRunnerInput['config'];
7
7
  authMode?: GraphQLAuthMode;
8
8
  authToken?: string;
9
- };
10
- type ReqClientParams = {
9
+ }
10
+ interface ReqClientParams {
11
11
  config: NextServer.CreateServerRunnerInput['config'];
12
12
  authMode?: GraphQLAuthMode;
13
13
  authToken?: string;
14
- };
14
+ }
15
15
  /**
16
16
  * Generates an API client that can be used inside a Next.js Server Component with Dynamic Rendering
17
17
  *
@@ -1,11 +1,11 @@
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 { createServerRunnerForAPI } from './createServerRunnerForAPI.mjs';
5
4
  import { getAmplifyConfig } from '../utils/getAmplifyConfig.mjs';
6
5
  import '@aws-amplify/core';
7
6
  import 'aws-amplify/adapter-core';
8
7
  import 'next/server.js';
8
+ import { createServerRunnerForAPI } from './createServerRunnerForAPI.mjs';
9
9
 
10
10
  // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
11
11
  // SPDX-License-Identifier: Apache-2.0
@@ -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 { getAmplifyServerContext, AmplifyServerContextError, } from '@aws-amplify/core/internals/adapter-core';\nimport { createServerRunnerForAPI } from './createServerRunnerForAPI';\nimport { getAmplifyConfig } from '../utils';\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 = getAmplifyConfig(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,gBAAgB,CAAC,MAAM,CAAC,CAAC;AACnD,IAAI,OAAO,cAAc,CAAC;AAC1B,QAAQ,MAAM,EAAE,aAAa;AAC7B,QAAQ,QAAQ;AAChB,QAAQ,SAAS;AACjB,KAAK,CAAC,CAAC;AACP;;;;"}
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 { getAmplifyConfig } from '../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 = getAmplifyConfig(config);\n return generateClient({\n config: amplifyConfig,\n authMode,\n authToken,\n });\n}\n"],"names":[],"mappings":";;;;;;;;;AAAA;AACA;AAMA;AACA;AACA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ientUsingCookies, } from './generateServerClient';
2
1
  import { V6ClientSSRCookies, V6ClientSSRRequest } from '@aws-amplify/api-graphql';
2
+ export { generateServerClientUsingReqRes, generateServerClientUsingCookies, } from './generateServerClient';
3
3
  type ClientUsingSSRCookies<T extends Record<any, any> = never> = V6ClientSSRCookies<T>;
4
4
  type ClientUsingSSRReq<T extends Record<any, any> = never> = V6ClientSSRRequest<T>;
5
5
  export { ClientUsingSSRCookies, ClientUsingSSRReq };
package/package.json CHANGED
@@ -1,74 +1,74 @@
1
1
  {
2
- "author": "Amazon Web Services",
3
- "name": "@aws-amplify/adapter-nextjs",
4
- "version": "1.0.17-unstable.5c56101.0+5c56101",
5
- "description": "The adapter for the supporting of using Amplify APIs in Next.js.",
6
- "peerDependencies": {
7
- "aws-amplify": "6.0.17-unstable.5c56101.0+5c56101",
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.17-unstable.5c56101.0+5c56101",
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": "5c561018aedcff314e68b3dd385fe9bd9ff93150"
2
+ "author": "Amazon Web Services",
3
+ "name": "@aws-amplify/adapter-nextjs",
4
+ "version": "1.0.17",
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.17",
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": "c54a19c8a654a47d559cb0fd41c74bd2c3eb79ca"
74
74
  }
@@ -2,6 +2,7 @@
2
2
  // SPDX-License-Identifier: Apache-2.0
3
3
 
4
4
  import { ResourcesConfig } from '@aws-amplify/core';
5
+
5
6
  import { createRunWithAmplifyServerContext, getAmplifyConfig } from '../utils';
6
7
  import { NextServer } from '../types';
7
8
 
@@ -4,31 +4,32 @@
4
4
  import { generateClientWithAmplifyInstance } from '@aws-amplify/api/internals';
5
5
  import { generateClient } from 'aws-amplify/api/server';
6
6
  import {
7
- getAmplifyServerContext,
8
7
  AmplifyServerContextError,
8
+ getAmplifyServerContext,
9
9
  } from '@aws-amplify/core/internals/adapter-core';
10
10
  import {
11
- V6ClientSSRRequest,
12
11
  V6ClientSSRCookies,
13
- __amplify,
12
+ V6ClientSSRRequest,
14
13
  } from '@aws-amplify/api-graphql';
14
+ import { GraphQLAuthMode } from '@aws-amplify/core/internals/utils';
15
+
15
16
  import { NextServer } from '../types';
16
- import { createServerRunnerForAPI } from './createServerRunnerForAPI';
17
17
  import { getAmplifyConfig } from '../utils';
18
- import { GraphQLAuthMode } from '@aws-amplify/core/internals/utils';
19
18
 
20
- type CookiesClientParams = {
19
+ import { createServerRunnerForAPI } from './createServerRunnerForAPI';
20
+
21
+ interface CookiesClientParams {
21
22
  cookies: NextServer.ServerComponentContext['cookies'];
22
23
  config: NextServer.CreateServerRunnerInput['config'];
23
24
  authMode?: GraphQLAuthMode;
24
25
  authToken?: string;
25
- };
26
+ }
26
27
 
27
- type ReqClientParams = {
28
+ interface ReqClientParams {
28
29
  config: NextServer.CreateServerRunnerInput['config'];
29
30
  authMode?: GraphQLAuthMode;
30
31
  authToken?: string;
31
- };
32
+ }
32
33
 
33
34
  /**
34
35
  * Generates an API client that can be used inside a Next.js Server Component with Dynamic Rendering
@@ -98,6 +99,7 @@ export function generateServerClientUsingReqRes<
98
99
  T extends Record<any, any> = never,
99
100
  >({ config, authMode, authToken }: ReqClientParams): V6ClientSSRRequest<T> {
100
101
  const amplifyConfig = getAmplifyConfig(config);
102
+
101
103
  return generateClient<T>({
102
104
  config: amplifyConfig,
103
105
  authMode,
package/src/api/index.ts CHANGED
@@ -1,16 +1,16 @@
1
1
  // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
2
2
  // SPDX-License-Identifier: Apache-2.0
3
3
 
4
- export {
5
- generateServerClientUsingReqRes,
6
- generateServerClientUsingCookies,
7
- } from './generateServerClient';
8
-
9
4
  import {
10
5
  V6ClientSSRCookies,
11
6
  V6ClientSSRRequest,
12
7
  } from '@aws-amplify/api-graphql';
13
8
 
9
+ export {
10
+ generateServerClientUsingReqRes,
11
+ generateServerClientUsingCookies,
12
+ } from './generateServerClient';
13
+
14
14
  // explicitly defaulting to `never` here resolves
15
15
  // TS2589: Type instantiation is excessively deep and possibly infinite.
16
16
  // When this type is used without a generic type arg, i.e. `let client: Client`
@@ -164,7 +164,7 @@ const createCookieStorageAdapterFromGetServerSidePropsContext = (
164
164
  ? {
165
165
  name,
166
166
  value,
167
- }
167
+ }
168
168
  : undefined;
169
169
  },
170
170
  getAll() {
@@ -34,7 +34,7 @@ export const createRunWithAmplifyServerContext = ({
34
34
  createCookieStorageAdapterFromNextServerContext(
35
35
  nextServerContext,
36
36
  ),
37
- );
37
+ );
38
38
  const credentialsProvider = createAWSCredentialsAndIdentityIdProvider(
39
39
  resourcesConfig.Auth,
40
40
  keyValueStorage,