Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

sync feature/server-side-validation with latest main #3136

Merged
merged 5 commits into from
Jan 31, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
126 changes: 68 additions & 58 deletions codebuild_specs/e2e_workflow.yml

Large diffs are not rendered by default.

38 changes: 19 additions & 19 deletions packages/amplify-data-construct/.jsii
Original file line number Diff line number Diff line change
Expand Up @@ -9,23 +9,23 @@
"@aws-amplify/ai-constructs": "^1.0.0",
"@aws-amplify/backend-output-schemas": "^1.0.0",
"@aws-amplify/backend-output-storage": "^1.0.0",
"@aws-amplify/graphql-auth-transformer": "4.1.10",
"@aws-amplify/graphql-conversation-transformer": "1.1.5",
"@aws-amplify/graphql-default-value-transformer": "3.1.7",
"@aws-amplify/graphql-auth-transformer": "4.1.11",
"@aws-amplify/graphql-conversation-transformer": "1.1.6",
"@aws-amplify/graphql-default-value-transformer": "3.1.8",
"@aws-amplify/graphql-directives": "2.6.1",
"@aws-amplify/graphql-function-transformer": "3.1.9",
"@aws-amplify/graphql-generation-transformer": "1.1.3",
"@aws-amplify/graphql-http-transformer": "3.0.12",
"@aws-amplify/graphql-index-transformer": "3.0.12",
"@aws-amplify/graphql-maps-to-transformer": "4.0.12",
"@aws-amplify/graphql-model-transformer": "3.1.4",
"@aws-amplify/graphql-predictions-transformer": "3.0.12",
"@aws-amplify/graphql-relational-transformer": "3.1.4",
"@aws-amplify/graphql-searchable-transformer": "3.0.12",
"@aws-amplify/graphql-sql-transformer": "0.4.12",
"@aws-amplify/graphql-transformer": "2.2.5",
"@aws-amplify/graphql-transformer-core": "3.3.4",
"@aws-amplify/graphql-transformer-interfaces": "4.2.1",
"@aws-amplify/graphql-function-transformer": "3.1.10",
"@aws-amplify/graphql-generation-transformer": "1.1.4",
"@aws-amplify/graphql-http-transformer": "3.0.13",
"@aws-amplify/graphql-index-transformer": "3.0.13",
"@aws-amplify/graphql-maps-to-transformer": "4.0.13",
"@aws-amplify/graphql-model-transformer": "3.1.5",
"@aws-amplify/graphql-predictions-transformer": "3.0.13",
"@aws-amplify/graphql-relational-transformer": "3.1.5",
"@aws-amplify/graphql-searchable-transformer": "3.0.13",
"@aws-amplify/graphql-sql-transformer": "0.4.13",
"@aws-amplify/graphql-transformer": "2.2.6",
"@aws-amplify/graphql-transformer-core": "3.3.5",
"@aws-amplify/graphql-transformer-interfaces": "4.2.2",
"@aws-amplify/platform-core": "^1.0.0",
"@aws-amplify/plugin-types": "^1.0.0",
"@aws-crypto/crc32": "5.2.0",
Expand Down Expand Up @@ -130,7 +130,7 @@
"zod": "^3.22.2"
},
"dependencies": {
"@aws-amplify/graphql-api-construct": "1.18.6",
"@aws-amplify/graphql-api-construct": "1.18.7",
"aws-cdk-lib": "^2.168.0",
"constructs": "^10.3.0"
},
Expand Down Expand Up @@ -4065,6 +4065,6 @@
}
},
"types": {},
"version": "1.14.6",
"fingerprint": "C00m//Kh7rxY5kn+1X3sokNk3ZUI8wbWmb8/Wv1D2Hs="
"version": "1.14.7",
"fingerprint": "3KNic2f/LBzOhbkrlDygq77KpfW40uR+Tf7LghDN2W4="
}
4 changes: 4 additions & 0 deletions packages/amplify-data-construct/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.

## [1.14.7](https://github.com/aws-amplify/amplify-category-api/compare/@aws-amplify/[email protected]...@aws-amplify/[email protected]) (2025-01-30)

**Note:** Version bump only for package @aws-amplify/data-construct

## [1.14.6](https://github.com/aws-amplify/amplify-category-api/compare/@aws-amplify/[email protected]...@aws-amplify/[email protected]) (2025-01-16)

### Bug Fixes
Expand Down
36 changes: 18 additions & 18 deletions packages/amplify-data-construct/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@aws-amplify/data-construct",
"version": "1.14.6",
"version": "1.14.7",
"description": "AppSync GraphQL Api Construct using Amplify GraphQL Transformer - Aliased to use `Data` name scheme.",
"repository": {
"type": "git",
Expand Down Expand Up @@ -160,24 +160,24 @@
"@aws-amplify/ai-constructs": "^1.0.0",
"@aws-amplify/backend-output-schemas": "^1.0.0",
"@aws-amplify/backend-output-storage": "^1.0.0",
"@aws-amplify/graphql-api-construct": "1.18.6",
"@aws-amplify/graphql-auth-transformer": "4.1.10",
"@aws-amplify/graphql-conversation-transformer": "1.1.5",
"@aws-amplify/graphql-default-value-transformer": "3.1.7",
"@aws-amplify/graphql-api-construct": "1.18.7",
"@aws-amplify/graphql-auth-transformer": "4.1.11",
"@aws-amplify/graphql-conversation-transformer": "1.1.6",
"@aws-amplify/graphql-default-value-transformer": "3.1.8",
"@aws-amplify/graphql-directives": "2.6.1",
"@aws-amplify/graphql-function-transformer": "3.1.9",
"@aws-amplify/graphql-generation-transformer": "1.1.3",
"@aws-amplify/graphql-http-transformer": "3.0.12",
"@aws-amplify/graphql-index-transformer": "3.0.12",
"@aws-amplify/graphql-maps-to-transformer": "4.0.12",
"@aws-amplify/graphql-model-transformer": "3.1.4",
"@aws-amplify/graphql-predictions-transformer": "3.0.12",
"@aws-amplify/graphql-relational-transformer": "3.1.4",
"@aws-amplify/graphql-searchable-transformer": "3.0.12",
"@aws-amplify/graphql-sql-transformer": "0.4.12",
"@aws-amplify/graphql-transformer": "2.2.5",
"@aws-amplify/graphql-transformer-core": "3.3.4",
"@aws-amplify/graphql-transformer-interfaces": "4.2.1",
"@aws-amplify/graphql-function-transformer": "3.1.10",
"@aws-amplify/graphql-generation-transformer": "1.1.4",
"@aws-amplify/graphql-http-transformer": "3.0.13",
"@aws-amplify/graphql-index-transformer": "3.0.13",
"@aws-amplify/graphql-maps-to-transformer": "4.0.13",
"@aws-amplify/graphql-model-transformer": "3.1.5",
"@aws-amplify/graphql-predictions-transformer": "3.0.13",
"@aws-amplify/graphql-relational-transformer": "3.1.5",
"@aws-amplify/graphql-searchable-transformer": "3.0.13",
"@aws-amplify/graphql-sql-transformer": "0.4.13",
"@aws-amplify/graphql-transformer": "2.2.6",
"@aws-amplify/graphql-transformer-core": "3.3.5",
"@aws-amplify/graphql-transformer-interfaces": "4.2.2",
"@aws-amplify/platform-core": "^1.0.0",
"@aws-amplify/plugin-types": "^1.0.0",
"@aws-crypto/crc32": "5.2.0",
Expand Down
4 changes: 4 additions & 0 deletions packages/amplify-e2e-tests/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.

## [4.1.5](https://github.com/aws-amplify/amplify-category-api/compare/amplify-category-api-e2e-tests@[email protected]) (2025-01-30)

**Note:** Version bump only for package amplify-category-api-e2e-tests

## [4.1.4](https://github.com/aws-amplify/amplify-category-api/compare/amplify-category-api-e2e-tests@[email protected]) (2025-01-16)

**Note:** Version bump only for package amplify-category-api-e2e-tests
Expand Down
8 changes: 4 additions & 4 deletions packages/amplify-e2e-tests/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "amplify-category-api-e2e-tests",
"version": "4.1.4",
"version": "4.1.5",
"description": "E2e test suite",
"repository": {
"type": "git",
Expand All @@ -25,8 +25,8 @@
},
"dependencies": {
"@aws-amplify/amplify-app": "^5.0.35",
"@aws-amplify/graphql-schema-generator": "0.11.5",
"@aws-amplify/graphql-transformer-core": "3.3.4",
"@aws-amplify/graphql-schema-generator": "0.11.6",
"@aws-amplify/graphql-transformer-core": "3.3.5",
"amplify-category-api-e2e-core": "5.0.7",
"aws-amplify": "^4.2.8",
"aws-appsync": "^4.1.1",
Expand All @@ -52,7 +52,7 @@
"@aws-amplify/amplify-cli-core": "^4.3.9"
},
"devDependencies": {
"@aws-amplify/graphql-transformer-interfaces": "4.2.1",
"@aws-amplify/graphql-transformer-interfaces": "4.2.2",
"@types/lodash": "^4.14.149",
"@types/ws": "^7.4.4",
"ts-node": "^8.10.2"
Expand Down
6 changes: 6 additions & 0 deletions packages/amplify-graphql-api-construct-tests/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,12 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.

## [1.13.9](https://github.com/aws-amplify/amplify-category-api/compare/amplify-graphql-api-construct-tests@[email protected]) (2025-01-30)

### Bug Fixes

- **gen2:** transform directives on fields of supported extended types ([#3127](https://github.com/aws-amplify/amplify-category-api/issues/3127)) ([3aca7b8](https://github.com/aws-amplify/amplify-category-api/commit/3aca7b89f530c536c28a53b7290fdab877b2260b))

## [1.13.8](https://github.com/aws-amplify/amplify-category-api/compare/amplify-graphql-api-construct-tests@[email protected]) (2025-01-16)

### Bug Fixes
Expand Down
9 changes: 5 additions & 4 deletions packages/amplify-graphql-api-construct-tests/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "amplify-graphql-api-construct-tests",
"version": "1.13.8",
"version": "1.13.9",
"description": "E2e test suite",
"repository": {
"type": "git",
Expand All @@ -24,7 +24,7 @@
"dependencies": {
"@aws-amplify/auth-construct": "^1.0.0",
"@aws-amplify/core": "^2.1.0",
"@aws-amplify/graphql-api-construct": "1.18.6",
"@aws-amplify/graphql-api-construct": "1.18.7",
"@aws-cdk/aws-cognito-identitypool-alpha": "2.152.0-alpha.0",
"@aws-sdk/client-appsync": "3.624.0",
"@aws-sdk/client-cloudformation": "3.624.0",
Expand All @@ -41,15 +41,16 @@
"aws-appsync": "^4.1.1",
"fs-extra": "^8.1.0",
"generate-password": "~1.7.0",
"graphql": "^15.5.0",
"node-fetch": "^2.6.7",
"ws": "^8.18.0"
},
"peerDependencies": {
"@aws-amplify/amplify-cli-core": "^4.3.9"
},
"devDependencies": {
"@aws-amplify/graphql-transformer-core": "3.3.4",
"@aws-amplify/graphql-transformer-interfaces": "4.2.1",
"@aws-amplify/graphql-transformer-core": "3.3.5",
"@aws-amplify/graphql-transformer-interfaces": "4.2.2",
"@types/node": "^18.0.0",
"aws-cdk-lib": "2.168.0",
"constructs": "10.3.0",
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
#!/usr/bin/env node
// eslint-disable-next-line import/no-extraneous-dependencies
import 'source-map-support/register';
import * as path from 'path';
import { App, Stack, Duration } from 'aws-cdk-lib';
import { AmplifyGraphqlApi, AmplifyGraphqlDefinition } from '@aws-amplify/graphql-api-construct';
import { LambdaRestApi } from 'aws-cdk-lib/aws-apigateway';
import { NodejsFunction } from 'aws-cdk-lib/aws-lambda-nodejs';

// eslint-disable-next-line @typescript-eslint/no-var-requires
const packageJson = require('../package.json');

const app = new App();
const stack = new Stack(app, packageJson.name.replace(/_/g, '-'), {
env: { region: process.env.CLI_REGION || 'us-west-2' },
});

const helloFn = new NodejsFunction(stack, 'HelloApiGwFunction', { entry: path.join(__dirname, 'hello-apigw.ts') });

const restApi = new LambdaRestApi(stack, 'HelloApi', {
handler: helloFn,
proxy: false,
});

const restApiUrl = restApi.url;

const helloResource = restApi.root.addResource('hello');
helloResource.addMethod('GET');

new AmplifyGraphqlApi(stack, 'ExtensionTest', {
definition: AmplifyGraphqlDefinition.fromString(/* GraphQL */ `
type Query {
myFunctionQueryBase: String @function(name: "myFunctionQueryBase") @auth(rules: [{ allow: custom }])
myHttpQueryBase: String @http(url: "${restApiUrl}/hello") @auth(rules: [{ allow: custom }])
}

extend type Query {
myFunctionQueryExtended: String @function(name: "myFunctionQueryExtended") @auth(rules: [{ allow: custom }])
myHttpQueryExtended: String @http(url: "${restApiUrl}/hello") @auth(rules: [{ allow: custom }])
}

type Mutation {
myFunctionMutationBase: String @function(name: "myFunctionQueryBase") @auth(rules: [{ allow: custom }])
myHttpMutationBase: String @http(url: "${restApiUrl}/hello") @auth(rules: [{ allow: custom }])
}

extend type Mutation {
myFunctionMutationExtended: String @function(name: "myFunctionQueryExtended") @auth(rules: [{ allow: custom }])
myHttpMutationExtended: String @http(url: "${restApiUrl}/hello") @auth(rules: [{ allow: custom }])
}
`),

functionNameMap: {
myFunctionQueryBase: new NodejsFunction(stack, 'FunctionQueryBase', { entry: path.join(__dirname, 'hello-resolver.ts') }),
myFunctionQueryExtended: new NodejsFunction(stack, 'FunctionQueryExtended', { entry: path.join(__dirname, 'hello-resolver.ts') }),
},

authorizationModes: {
// Make sure we keep API Key as the default auth mode. The tests include specific assertions that we do not fall back to the API's
// default auth mode
defaultAuthorizationMode: 'API_KEY',
apiKeyConfig: { expires: Duration.days(2) },
lambdaConfig: {
function: new NodejsFunction(stack, 'Authorizer', { entry: path.join(__dirname, 'authorizer.ts') }),
ttl: Duration.minutes(0),
},
},
});
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
exports.handler = async (event) => {
const { authorizationToken } = event;
const response = {
isAuthorized: authorizationToken === 'custom-authorized',
ttlOverride: 0,
};
return response;
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
exports.handler = async () => {
return {
statusCode: 200,
headers: { 'Content-Type': 'text/plain' },
body: JSON.stringify({ message: 'Hello from API Gateway' }),
};
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
exports.handler = async () => {
return 'Hello from Lambda resolver';
};
Loading
Loading