Skip to content

Commit 1983a03

Browse files
authored
release: Amplify JS release (aws-amplify#12563)
2 parents 91fd013 + a5eb335 commit 1983a03

File tree

79 files changed

+8369
-330
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

79 files changed

+8369
-330
lines changed

.github/workflows/callable-npm-publish-release.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,5 +51,5 @@ jobs:
5151
working-directory: ./amplify-js
5252
run: |
5353
git push origin release
54-
git push -f origin required-release
54+
if [ $(git tag -l "required-release") ]; then git push -f origin required-release; fi
5555
git push --force-with-lease origin release:main

.github/workflows/pr.yml

Lines changed: 25 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -45,9 +45,29 @@ jobs:
4545
- github-actions-test
4646
- tsc-compliance-test
4747
runs-on: ubuntu-latest
48-
# This is a bit of a hack - Branch protections depend upon selected
49-
# workflows that run on hardware, not parents of many callable workflows.
50-
# Adding this so that unit and bundle checks can be a single protection line.
48+
if: success() # only run when all checks have passed
49+
# store success output flag for ci job
50+
outputs:
51+
success: ${{ steps.setoutput.outputs.success }}
5152
steps:
52-
- name: All tests passed
53-
run: echo "All tests passed"
53+
- id: setoutput
54+
run: echo "::set-output name=success::true"
55+
ci:
56+
runs-on: ubuntu-latest
57+
if: always() # always run, so we never skip the check
58+
name: ci - Unit and Bundle tests have passed
59+
needs: all-unit-tests-pass
60+
env:
61+
PASSED: ${{ needs.all-unit-tests-pass.outputs.success }}
62+
steps:
63+
# this job passes only when output of all-unit-tests-pass job is set
64+
# in case at least one of the checks fails, all-unit-tests-pass is skipped
65+
# and the output will not be set, which will then cause the ci job to fail
66+
- run: |
67+
if [[ $PASSED == "true" ]]; then
68+
echo "All checks have passed"
69+
exit 0
70+
else
71+
echo "One or more checks have failed"
72+
exit 1
73+
fi

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
"unlink-all": "lerna exec --no-bail --parallel -- yarn unlink; exit 0",
3030
"publish:preid": "./scripts/preid-env-vars-exist.sh && lerna publish --canary --force-publish --dist-tag=${PREID_PREFIX} --preid=${PREID_PREFIX}${PREID_HASH_SUFFIX} --yes",
3131
"publish:main": "lerna publish --canary --force-publish --dist-tag=unstable --preid=unstable${PREID_HASH_SUFFIX} --yes",
32-
"publish:release": "lerna publish from-package --dist-tag=v6 --message 'chore(release): Publish [ci skip]' --yes",
32+
"publish:release": "lerna publish --conventional-commits --dist-tag=v6 --message 'chore(release): Publish [ci skip]' --yes",
3333
"publish:v5-stable": "lerna publish --conventional-commits --yes --dist-tag=stable-5 --message 'chore(release): Publish [ci skip]' --no-verify-access",
3434
"publish:verdaccio": "lerna publish --canary --force-publish --no-push --dist-tag=unstable --preid=unstable --yes",
3535
"ts-coverage": "lerna run ts-coverage",

packages/adapter-nextjs/__tests__/createServerRunner.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ jest.mock(
2828
);
2929

3030
describe('createServerRunner', () => {
31-
let createServerRunner;
31+
let createServerRunner: any;
3232

3333
const mockParseAWSExports = jest.fn();
3434
const mockCreateAWSCredentialsAndIdentityIdProvider = jest.fn();
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"name": "@aws-amplify/adapter-nextjs/data",
3+
"main": "../dist/cjs/api/index.js",
4+
"browser": "../dist/esm/api/index.mjs",
5+
"module": "../dist/esm/api/index.mjs",
6+
"typings": "../dist/esm/api/index.d.ts"
7+
}

packages/adapter-nextjs/package.json

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
"jest-fetch-mock": "3.0.3",
2121
"next": ">= 13.5.0 < 15.0.0",
2222
"rollup": "3.29.4",
23-
"typescript": "5.1.6"
23+
"typescript": "5.0.2"
2424
},
2525
"publishConfig": {
2626
"access": "public"
@@ -39,6 +39,11 @@
3939
"import": "./dist/esm/api/index.mjs",
4040
"require": "./dist/cjs/api/index.js"
4141
},
42+
"./data": {
43+
"types": "./dist/esm/api/index.d.ts",
44+
"import": "./dist/esm/api/index.mjs",
45+
"require": "./dist/cjs/api/index.js"
46+
},
4247
"./package.json": "./package.json"
4348
},
4449
"files": [

packages/adapter-nextjs/src/api/generateServerClient.ts

Lines changed: 26 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@ import {
88
AmplifyServer,
99
} from '@aws-amplify/core/internals/adapter-core';
1010
import {
11-
V6Client,
12-
V6ClientSSR,
11+
V6ClientSSRRequest,
12+
V6ClientSSRCookies,
1313
GraphQLMethod,
1414
GraphQLMethodSSR,
1515
__amplify,
@@ -18,6 +18,20 @@ import {
1818
import { NextServer } from '../types';
1919
import { createServerRunnerForAPI } from './createServerRunnerForAPI';
2020
import { getAmplifyConfig } from '../utils';
21+
import { GraphQLAuthMode } from '@aws-amplify/core/internals/utils';
22+
23+
type CookiesClientParams = {
24+
cookies: NextServer.ServerComponentContext['cookies'];
25+
config: NextServer.CreateServerRunnerInput['config'];
26+
authMode?: GraphQLAuthMode;
27+
authToken?: string;
28+
};
29+
30+
type ReqClientParams = {
31+
config: NextServer.CreateServerRunnerInput['config'];
32+
authMode?: GraphQLAuthMode;
33+
authToken?: string;
34+
};
2135

2236
/**
2337
* Generates an API client that can be used inside a Next.js Server Component with Dynamic Rendering
@@ -33,8 +47,9 @@ export function generateServerClientUsingCookies<
3347
>({
3448
config,
3549
cookies,
36-
}: NextServer.ServerComponentContext &
37-
NextServer.CreateServerRunnerInput): V6Client<T> {
50+
authMode,
51+
authToken,
52+
}: CookiesClientParams): V6ClientSSRCookies<T> {
3853
if (typeof cookies !== 'function') {
3954
throw new AmplifyServerContextError({
4055
message:
@@ -58,9 +73,11 @@ export function generateServerClientUsingCookies<
5873
fn(getAmplifyServerContext(contextSpec).amplify),
5974
});
6075

61-
return generateServerClient<T, V6Client<T>>({
76+
return generateServerClient<T, V6ClientSSRCookies<T>>({
6277
amplify: getAmplify,
6378
config: resourcesConfig,
79+
authMode,
80+
authToken,
6481
});
6582
}
6683

@@ -82,13 +99,15 @@ export function generateServerClientUsingCookies<
8299
*/
83100
export function generateServerClientUsingReqRes<
84101
T extends Record<any, any> = never
85-
>({ config }: NextServer.CreateServerRunnerInput): V6ClientSSR<T> {
102+
>({ config, authMode, authToken }: ReqClientParams): V6ClientSSRRequest<T> {
86103
const amplifyConfig = getAmplifyConfig(config);
87104
// passing `null` instance because each (future model) method must retrieve a valid instance
88105
// from server context
89-
const client = generateServerClient<T, V6ClientSSR<T>>({
106+
const client = generateServerClient<T, V6ClientSSRRequest<T>>({
90107
amplify: null,
91108
config: amplifyConfig,
109+
authMode,
110+
authToken,
92111
});
93112

94113
// TODO: improve this and the next type

packages/adapter-nextjs/tsconfig.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"compilerOptions": {
44
"allowSyntheticDefaultImports": true,
55
"target": "es2020",
6-
"noImplicitAny": false,
6+
"noImplicitAny": true,
77
"lib": ["dom", "es2019", "esnext.asynciterable"],
88
"module": "commonjs",
99
"moduleResolution": "node",

0 commit comments

Comments
 (0)