Skip to content

Commit

Permalink
Merge main next release (#7093)
Browse files Browse the repository at this point in the history
* Minor edits to Vite + React quickstart (#6926)

* Updates to Vite + React quickstart

* Update src/fragments/gen2/quickstart/build-a-backend.mdx

Co-authored-by: Kevin Old <kevold@amazon.com>

* Update build-a-backend.mdx

* Update build-a-backend.mdx

* Update build-a-backend.mdx

---------

Co-authored-by: Kevin Old <kevold@amazon.com>

* fix: Fix incorrect auth import path in migration guide. (#6934)

* fix: Update incorrect `updateMFAPreference` parameter in JS v6 migration guide. (#6935)

* Amplify Android Release 2.14.11 (#6933)

* chore: refactor .layout-header into separate component (#6826)

* platform typed as optional

* refactor init

* remove commented code

* remove angry useEffect

* fix typing

* added layoutcontext so mobile menu closes on navigation

* move import

---------

Co-authored-by: katiegoines <katiegoines@gmail.com>

* fix: Nesting of auth cli templates (#6932)

* fix: change config variable name (#6923)

* Guide to support Amplify v2 with AWS Android SDK (#6927)

* Update puppeteer (#6949)

* Update index.mdx (#6950)

* Update CODEOWNERS with correct PM alignment (#6951)

* fix(flutter, js): scope "connect existing cdk" guide to respective platform (#6947)

Co-authored-by: Tim Nguyen <54393192+timngyn@users.noreply.github.com>

* Revert "fix(flutter, js): scope "connect existing cdk" guide to respective pl…" (#6955)

This reverts commit 5998b22.

* chore: remove duplicated logic between Layout and LayoutHeader (#6954)

* chore: more layout refactoring

* remove unused prop, alphabetize props

* improve oauth docs (#6961)

* fixed gen 2 getting started guide (#6968)

* Update redirects for deleted hidden pages (#6944)

* Update manual installation to point to @beta tag (#6972)

* include usage for multi-page apps (#6964)

* include usage for multi-page apps

* improve multi-page app docs

* use Hub syntax

* update imports in examples

* chore: Clean up broken Amplify JS API reference links (#6976)

* chore: Clean up broken Amplify JS API reference links.

* Cleaned up language.

* Update build image instructions for Gen 2 (#6978)

* update build image settings for Gen 2

* remove callout and add fragment to vite guide

* chore: add unit test for YoutubeEmbed component (#6983)

* chore: add unit test for YoutubeEmbed component

* add code coverage stats

---------

Co-authored-by: katiegoines <katiegoines@gmail.com>

* chore: add unit tests for Accordion component (#6981)

* chore: add unit tests for Accordion component

* issue with window properties

* fixed tracking test

* working on animation issue

* accordion tests

* fix testing errors

* added test for closing accordion

* add code coverage stats

---------

Co-authored-by: katiegoines <katiegoines@gmail.com>

* Update index.mdx (#6986)

* Add env variables for algolia (#6957)

* Add algolia env vars to next.config

* Remove extra code string

* fix(data): update REST API docs to document correct error response type (#6989)

* fix(data): update React Native minimum iOS deployment target guidance; add build step to docs (#6970)

* fix(data): update React Native minimum iOS deployment target; add build step to docs

* address PR feedback

* remove deployment target guidance

* add React Native version deployment target callout

* fix unrecognized syntax

* replace callout with accordion

* move 'upgrading' callout

* Clarify behavior of forgetDevice() API regarding device tracking (#6985)

* Clarify behavior of forgetDevice() API regarding device tracking

This commit updates the documentation to clarify that using the forgetDevice() API results in the device being neither remembered nor tracked. Previously, the documentation suggested that forgotten devices might still be tracked, leading to confusion about the API's behavior. The revised wording aligns with the detailed description under the "Forgotten" section, ensuring consistency and eliminating ambiguity about how forgotten devices are handled.

* Clarify behavior of forgetDevice() API regarding device tracking

* Support for enum value listing (#6885)

* Support for enum value listing

* Update src/pages/gen2/build-a-backend/data/data-modeling/add-fields/index.mdx

* CDK updates v2 (#6990)

* Add padding to bottom of nav menu (#6991)

* Adding secondary index to Gen 2 (#6996)

* Adding secondary index docs

* fixed some formatting for custom query fields

* extend config to show addOuput (#6963)

* extend config

* modify wording

* modify example

* improve wording

* Update index.mdx (#6995)

* Update index.mdx

* add guest access support to docs

* chore: add unit tests for NextPrevious component (#7003)

Co-authored-by: katiegoines <katiegoines@gmail.com>

* chore: add unit tests for LinkCards and LinkCard components (#7006)

Co-authored-by: katiegoines <katiegoines@gmail.com>

* chore: add unit tests for GetStartedPopover component (#7005)

Co-authored-by: katiegoines <katiegoines@gmail.com>

* fix: [Storage] Configure Access (#6948)

Co-authored-by: Tim Nguyen <54393192+timngyn@users.noreply.github.com>

* fix(Swift): update data use policy info's tracking to false (#6938)

* fix(Swift): update data use policy info's tracking to false

* Update data-information.mdx

* chore: add callouts and troubleshooting guide for configuration (#6967)

* fix: resolve in-content broken links (#7011)

* re-platforming

* remove reference to mocking and testing for android & swift

* remove reference to mocking and testing for android & swift

* filtered out reference to optimistic ui for react native

---------

Co-authored-by: katiegoines <katiegoines@gmail.com>

* update gen2 storage and function docs (#7009)

* update gen2 storage and function docs

* add resource access links and example

* revisions, update code snippet titles

* Update CODEOWNERS (#7014)

* updated steps for extending components in code (#6827)

Co-authored-by: Aditya Shahani <theadi@amazon.com>

* Custom business logic support as of March @beta (#7019)

* Enhanced custom business logic DX

* addressed tim's comments

* Added custom subscription configuration worfklow

* removed in-development areas

* added titles

* added links for deep dive material

* Update src/pages/gen2/build-a-backend/data/custom-business-logic/index.mdx

Co-authored-by: josef <josef.aidt@gmail.com>

* Update src/pages/gen2/build-a-backend/data/custom-business-logic/index.mdx

Co-authored-by: josef <josef.aidt@gmail.com>

* Update src/pages/gen2/build-a-backend/data/custom-business-logic/index.mdx

Co-authored-by: Kethan sai <ykethan@amazon.com>

* Update src/pages/gen2/build-a-backend/data/custom-business-logic/index.mdx

Co-authored-by: Kethan sai <ykethan@amazon.com>

* Update src/pages/gen2/build-a-backend/data/custom-business-logic/index.mdx

Co-authored-by: josef <josef.aidt@gmail.com>

* Update src/pages/gen2/build-a-backend/data/custom-business-logic/index.mdx

* added client method for clarity.

* Update src/pages/gen2/build-a-backend/data/custom-business-logic/index.mdx

Co-authored-by: Kethan sai <ykethan@amazon.com>

* Apply suggestions from code review

Co-authored-by: josef <josef.aidt@gmail.com>

---------

Co-authored-by: josef <josef.aidt@gmail.com>
Co-authored-by: Kethan sai <ykethan@amazon.com>

* add storage trigger docs (#7020)

* storage trigger docs

* Apply suggestions from code review

Co-authored-by: josef <josef.aidt@gmail.com>

* add storage access actions

---------

Co-authored-by: josef <josef.aidt@gmail.com>

* update link checker to wait for each call to complete before making t… (#6993)

* update link checker to wait for each call to complete before making the next and remove # from urls being checked

* update logging to show how many links found on each page

* Update tasks/link-checker.js

---------

Co-authored-by: Jacob Logan <lognjc@amazon.com>
Co-authored-by: katiegoines <katiegoines@gmail.com>
Co-authored-by: Scott Rees <6165315+reesscot@users.noreply.github.com>

* custom examples (#6979)

* custom examples

* fix: broken link, missing / at start (#7026)

Co-authored-by: katiegoines <katiegoines@gmail.com>

* validate and fix code snippets in Data section (#6975)

* Update sandbox --dir-to-watch description (#7031)

* Update index.mdx (#7035)

* Fix link (#7028)

* add docs to auth resource access pattern (#7032)

* fix: type platform as optional in Breadcrumbs component & add unit tests (#6912)

* platform typed as optional

* chore: add unit tests for Breadcrumbs

* testing to include platform optional

* fix: type platform as optional

* add tests for override values

---------

Co-authored-by: katiegoines <katiegoines@gmail.com>

* fix: proper variable naming conventions for storage (#7033)

fix:  proper variable naming conventions for storage

* remove explicit file extension from gen2 imports (#6946)

Co-authored-by: Tim Nguyen <54393192+timngyn@users.noreply.github.com>

* fix: Update diff code blocks to TypeScript with code highlights (#6905)

* add docs on granting defineFunction access to defineData (#7029)

* standardize Gen 2 wording (#7036)

* Update index.mdx (#6906)

* Modify_Amplify_resources (#7018)

* fix code snippets on read data page

* code snippet updates

* updated the code snippets

* updated code snippets.

* custom business page rollback

* Update maplibre links (#7040)

* chore: add unit tests for PlatformNavigator (#6980)

* chore: add unit tests for PlatformNavigator

* add code coverage

* simplify

* simplify

---------

Co-authored-by: katiegoines <katiegoines@gmail.com>

* Update links to expo docs (#7044)

* Update links to expo docs

* Update src/pages/[platform]/prev/build-a-backend/auth/add-social-provider/index.mdx

Co-authored-by: josef <josef.aidt@gmail.com>

* Update src/pages/[platform]/prev/build-a-backend/auth/add-social-provider/index.mdx

Co-authored-by: josef <josef.aidt@gmail.com>

---------

Co-authored-by: josef <josef.aidt@gmail.com>

* chore: add unit tests for InternalLinkButton (#7000)

Co-authored-by: katiegoines <katiegoines@gmail.com>

* chore: add addtl unit test for Block component (#6982)

* chore: add addtl unit test for Block component

* add code coverage stats

* remove superfluous Block component

---------

Co-authored-by: katiegoines <katiegoines@gmail.com>

* chore: add unit tests for TOC (#6984)

* chore: add unit tests for TOC

* add code coverage

* hardcode expected hash

---------

Co-authored-by: katiegoines <katiegoines@gmail.com>

* chore: add unit tests for ExternalLink (#6915)

* chore: add unit tests for ExternalLink

* fixing tracking test

---------

Co-authored-by: katiegoines <katiegoines@gmail.com>

* chore: add unit tests for ExternalLinkButton (#6914)

* chore: add unit tests for ExternalLinkButton

* Update ExternalLinkButton.test.tsx

triggering checks

---------

Co-authored-by: katiegoines <katiegoines@gmail.com>

* chore: add unit tests for Footer component (#6999)

Co-authored-by: katiegoines <katiegoines@gmail.com>

* chore: add unit tests for MigrationAlert component (#7004)

* chore: add unit tests for MigrationAlert component

* chore: add unit tests for MigrationAlert component

---------

Co-authored-by: katiegoines <katiegoines@gmail.com>

* chore: add unit test for Overview component (#7002)

Co-authored-by: katiegoines <katiegoines@gmail.com>

* chore: upgrade docsearch/react to 3.6 (#7046)

* added utility type content (#7047)

* chore: add unit tests for PageLastUpdated (#7001)

Co-authored-by: katiegoines <katiegoines@gmail.com>

* chore: add unit tests for Commands and Columns (#6916)

* chore: add unit test for CLICommands

* chore: add unit test for Columns

* Update Command.test.tsx

triggering checks

---------

Co-authored-by: katiegoines <katiegoines@gmail.com>

* Update resolution for follow-redirects (#7055)

* Update relative urls (#7048)

* Update relative urls

* Update url

* Updating link checker (#7052)

* Updating link checker to account for duplicate urls from different pages and link text

* Update slack formatting

* Remove console.log

* Add comments to function

* Remove extra console.logs()

* chore: update redirects list (#6969)

* update redirects

* updated redirects

---------

Co-authored-by: katiegoines <katiegoines@gmail.com>

* Fix merge mistakes

* remove allowlist role names for appsync console access page (#7081)

* Add JavaScript resolver code sample to Gen 1 (#7087)

---------

Co-authored-by: Jim Eagan <84857865+hibler13@users.noreply.github.com>
Co-authored-by: Kevin Old <kevold@amazon.com>
Co-authored-by: Jim Blanchard <jim.l.blanchard@gmail.com>
Co-authored-by: Ankit Shah <22114629+ankpshah@users.noreply.github.com>
Co-authored-by: Katie Goines <30757403+katiegoines@users.noreply.github.com>
Co-authored-by: katiegoines <katiegoines@gmail.com>
Co-authored-by: Dan Kiuna <dankiuna@gmail.com>
Co-authored-by: Kihara, Takuya <gray@tacck.net>
Co-authored-by: Tyler Roach <tjroach@amazon.com>
Co-authored-by: Rene Brandel <4989523+renebrandel@users.noreply.github.com>
Co-authored-by: Elijah Quartey <Equartey@users.noreply.github.com>
Co-authored-by: Heather Buchel <hbuchel@gmail.com>
Co-authored-by: John Corser <johnpc@umich.edu>
Co-authored-by: Heather Pundt <119376175+heatheramz@users.noreply.github.com>
Co-authored-by: Nikhil Swaminathan <2429410+swaminator@users.noreply.github.com>
Co-authored-by: Jay Raval <jay.ambrish.raval@gmail.com>
Co-authored-by: David McAfee <mcafd@amazon.com>
Co-authored-by: Kethan sai <ykethan@amazon.com>
Co-authored-by: Michael Law <1365977+lawmicha@users.noreply.github.com>
Co-authored-by: erinleigh90 <106691284+erinleigh90@users.noreply.github.com>
Co-authored-by: Edward Foyle <foyleef@amazon.com>
Co-authored-by: Adi <34354177+the1adi@users.noreply.github.com>
Co-authored-by: Aditya Shahani <theadi@amazon.com>
Co-authored-by: josef <josef.aidt@gmail.com>
Co-authored-by: jacoblogan <jacob.maiola.logan@gmail.com>
Co-authored-by: Jacob Logan <lognjc@amazon.com>
Co-authored-by: Scott Rees <6165315+reesscot@users.noreply.github.com>
Co-authored-by: Chris Bonifacio <christopher.bonifacio@gmail.com>
Co-authored-by: Roshane Pascual <rtpascual@users.noreply.github.com>
Co-authored-by: Charles Shin <shin.charles11@gmail.com>
Co-authored-by: Ujjwol Shrestha <usewall05@gmail.com>
Co-authored-by: Gen Tamura <gen.tamura84@gmail.com>
Co-authored-by: dwittle <72715628+dwittle@users.noreply.github.com>
Co-authored-by: Anil Maktala <maktala.anil@gmail.com>
  • Loading branch information
1 parent 21a10a7 commit e76fcd3
Show file tree
Hide file tree
Showing 3 changed files with 87 additions and 66 deletions.
3 changes: 0 additions & 3 deletions src/directory/directory.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -155,9 +155,6 @@ export const directory = {
{
path: 'src/pages/[platform]/build-a-backend/data/customize-authz/configure-custom-identity-and-group-claim/index.mdx'
},
{
path: 'src/pages/[platform]/build-a-backend/data/customize-authz/use-iam-authz-within-appsync-console/index.mdx'
},
{
path: 'src/pages/[platform]/build-a-backend/data/customize-authz/grant-lambda-function-access-to-api/index.mdx'
}
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ export function getStaticProps(context) {
url={'/[platform]/tools/cli-legacy/function-directive/'}
/>

Define your custom business logic in a Lambda function resolver, HTTP resolver, or VTL resolver and expose them in a GraphQL query or mutation. Extend or override Amplify-generated GraphQL resolvers to optimize for your specific use cases.
Define your custom business logic in a Lambda function resolver, HTTP resolver, or an AppSync JavaScript or VTL resolver and expose them in a GraphQL query or mutation. Extend or override Amplify-generated GraphQL resolvers to optimize for your specific use cases.

## Create a custom query or mutation

Expand All @@ -71,7 +71,7 @@ type Query {

- [Lambda function resolver](#lambda-function-resolver): use a custom Lambda function to handle query or mutation
- [HTTP resolver](#http-resolver): call an HTTP endpoint upon a query or mutation
- [VTL resolver](#vtl-resolver) (most advanced): use VTL mapping templates to customize the query and mutation logic
- [AppSync JavaScript or VTL resolver](#appsync-javascript-or-vtl-resolver) (most advanced): use AppSync's JavaScript resolver or AppSync's VTL mapping templates to customize the query and mutation logic

3. Secure your custom query or mutation with [field-level authorization rules](/gen1/[platform]/build-a-backend/graphqlapi/customize-authorization-rules/)
- Note: Dynamic authorization rules are not supported on a custom query or mutation.
Expand Down Expand Up @@ -594,9 +594,9 @@ input HttpHeader {

The `@http` transformer will create one HTTP datasource for each identified base URL. For example, if multiple HTTP resolvers are created that interact with the "https://www.example.com" endpoint, only a single datasource is created. Each directive generates one resolver. Depending on the definition, the appropriate `body`, `params`, and `query` input types are created. Note that `@http` transformer does not support calling other AWS services where Signature Version 4 signing process is required.

## VTL resolver
## AppSync JavaScript or VTL resolver

You can use AWS Cloud Development Kit (CDK) to define custom VTL resolvers for your GraphQL API. `@auth` directives are not supported for custom queries or mutations that are connected to a VTL resolver. This is because you are replacing Amplify's auto-generated capabilities for that particular query or mutation with a custom-defined cloud resources.
You can use AWS Cloud Development Kit (CDK) to define custom AppSync resolvers for your GraphQL API. `@auth` directives are not supported for custom queries or mutations that are connected to a JavaScript or VTL resolver. This is because you are replacing Amplify's auto-generated capabilities for that particular query or mutation with a custom-defined cloud resources.

```bash
amplify add custom
Expand All @@ -618,10 +618,88 @@ npm i @aws-cdk/aws-appsync@~1.172.0

> **Note:** Installations using the '\~' character do not modify the package.json. To use '\~' for default npm configurations, make sure your package.json reflects the right dependency to avoid compatibility errors in CDK.
Finally, add your custom resolvers into the `cdk-stack.ts` file. You can either add the VTL inline into your `cdk-stack.ts` file or define them externally in another file. Review the [Resolver Mapping Template Programming Guide](https://docs.aws.amazon.com/appsync/latest/devguide/resolver-mapping-template-reference-programming-guide.html) to learn more about the VTL template.
Finally, add your custom resolvers into the `cdk-stack.ts` file. You can either add the JavaScript or VTL inline into your `cdk-stack.ts` file.

#### Unit Resolver

<BlockSwitcher>

<Block name="JavaScript resolver">

Review the [AppSync JavaScript resolver tutorial](https://docs.aws.amazon.com/appsync/latest/devguide/tutorials-js.html) for JavaScript resolver examples for different data sources.

```ts
import * as cdk from 'aws-cdk-lib';
import * as AmplifyHelpers from '@aws-amplify/cli-extensibility-helper';
import * as appsync from 'aws-cdk-lib/aws-appsync';
import { AmplifyDependentResourcesAttributes } from '../../types/amplify-dependent-resources-ref';
import { Construct } from 'constructs';

const jsResolverTemplate = `
export function request(ctx) {
return {
payload: null
}
}
export function response(ctx) {
return ctx.arguments.message
}
`

export class cdkStack extends cdk.Stack {
constructor(
scope: Construct,
id: string,
props?: cdk.StackProps,
amplifyResourceProps?: AmplifyHelpers.AmplifyResourceProps
) {
super(scope, id, props);
/* Do not remove - Amplify CLI automatically injects the current deployment environment in this input parameter */
new cdk.CfnParameter(this, 'env', {
type: 'String',
description: 'Current Amplify CLI env name'
});

// Access other Amplify Resources
const retVal: AmplifyDependentResourcesAttributes =
AmplifyHelpers.addResourceDependency(
this,
amplifyResourceProps.category,
amplifyResourceProps.resourceName,
[
{
category: 'api',
resourceName: '<YOUR-API-NAME>'
}
]
);

const resolver = new appsync.CfnResolver(this, 'CustomResolver', {
// apiId: retVal.api.new.GraphQLAPIIdOutput,
// https://github.com/aws-amplify/amplify-cli/issues/9391#event-5843293887
// If you use Amplify you can access the parameter via Ref since it's a CDK parameter passed from the root stack.
// Previously the ApiId is the variable Name which is wrong , it should be variable value as below
apiId: cdk.Fn.ref(retVal.api.replaceWithAPIName.GraphQLAPIIdOutput),
fieldName: 'echo',
typeName: 'Query', // Query | Mutation | Subscription
code: jsResolverTemplate,
dataSourceName: 'NONE_DS', // DataSource name
runtime: {
name: 'APPSYNC_JS',
runtimeVersion: '1.0.0'
}
});
}
}
```

</Block>

<Block name="VTL resolver">

Review the [Resolver Mapping Template Programming Guide](https://docs.aws.amazon.com/appsync/latest/devguide/resolver-mapping-template-reference-programming-guide.html) to learn more about the VTL template.

```ts
import * as cdk from 'aws-cdk-lib';
import * as AmplifyHelpers from '@aws-amplify/cli-extensibility-helper';
Expand Down Expand Up @@ -779,6 +857,10 @@ responseMappingTemplate: appsync.MappingTemplate.fromFile(path.join(__dirname, "

> **Note:** the `..` is added to the path because the path is always relative to the `build` folder of the custom resource.
</Block>

</BlockSwitcher>

## Add authorization rules to custom queries and mutations

Authorization rules can be applied with the `@auth` directive in the same way as field-level authorization rules. See [Field-level authorization rules](/gen1/[platform]/build-a-backend/graphqlapi/customize-authorization-rules/#field-level-authorization-rules) for details.
Expand Down

0 comments on commit e76fcd3

Please sign in to comment.