Skip to content

Commit

Permalink
Merge branch 'main' into existing-lambda-reference-2
Browse files Browse the repository at this point in the history
  • Loading branch information
josefaidt authored Jan 30, 2025
2 parents fa83bf9 + a4b1198 commit 0a34fd2
Show file tree
Hide file tree
Showing 96 changed files with 5,511 additions and 861 deletions.
10 changes: 4 additions & 6 deletions .github/CODEOWNERS
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
* @aws-amplify/documentation-team

#Other
/src/pages/gen1/\[platform\]/build-a-backend/existing-resources/ @josefaidt @hdworld11 @dbanksdesign
/src/pages/gen1/\[platform\]/build-a-backend/functions/ @josefaidt
Expand Down Expand Up @@ -162,9 +160,9 @@
/src/pages/gen1/\[platform\]/prev/build-a-backend/utilities/ @josefaidt

#Deploy and Host
/src/pages/gen1/\[platform\]/deploy-and-host/ @mauerbac
/src/pages/gen1/\[platform\]/prev/deploy-and-host/ @mauerbac
/src/pages/\[platform\]/deploy-and-host/ @mauerbac
/src/pages/gen1/\[platform\]/deploy-and-host/ @mauerbac @josefaidt
/src/pages/gen1/\[platform\]/prev/deploy-and-host/ @mauerbac @josefaidt
/src/pages/\[platform\]/deploy-and-host/ @mauerbac @josefaidt

#Docs Engineering
/src/components @aws-amplify/documentation-team
Expand All @@ -186,4 +184,4 @@
.github @aws-amplify/documentation-team

#Protected Content
/src/protected @reesscot @srquinn21 @swaminator
/src/protected @srquinn21 @swaminator
4 changes: 2 additions & 2 deletions .github/workflows/accessibility_scan.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ env:
jobs:
accessibility:
name: Runs accessibility scan on changed pages
runs-on: ubuntu-latest
runs-on: ubuntu-22.04
steps:
- name: Checkout branch
uses: actions/checkout@0ad4b8fadaa221de15dcec353f45205ec38ea70b # v4.1.4
Expand All @@ -32,7 +32,7 @@ jobs:
const buildDir = process.env.BUILD_DIR;
return getChangedPages({github, context, buildDir});
- name: Run site
run: |
run: |
python -m http.server 3000 -d ${{ env.BUILD_DIR }} &
sleep 5
- name: Run accessibility tests on changed/new MDX pages
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/check_for_console_errors.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ permissions:
contents: read
jobs:
CheckConsoleErrors:
runs-on: ubuntu-latest
runs-on: ubuntu-22.04
steps:
- name: Checkout repository
uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4.1.6
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/check_pr_for_broken_links.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ env:
BUILD_DIR: 'client/www/next-build'
jobs:
CheckPRLinks:
runs-on: ubuntu-latest
runs-on: ubuntu-22.04
steps:
- name: Checkout repository
uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4.1.6
Expand Down
21 changes: 18 additions & 3 deletions cspell.json
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@
"amazonaws",
"amazonaws",
"amazoncognito",
"amazonlinux",
"AmazonPersonalizeProvider",
"AmazonS3Client",
"Amplif",
Expand Down Expand Up @@ -494,6 +495,7 @@
"dataaccess",
"dataacess",
"databinding",
"datalogconfig",
"dataset",
"datasource",
"DataSource",
Expand Down Expand Up @@ -1616,14 +1618,27 @@
"jamba",
"webauthn",
"knowledgebases",
"rehype"
"rehype",
"assetlinks",
"AMPLIFYRULES",
"manylinux",
"GOARCH",
"norpc"
],
"flagWords": [
"hte",
"full-stack",
"Full-stack",
"Full-Stack",
"sudo"
],
"flagWords": ["hte", "full-stack", "Full-stack", "Full-Stack", "sudo"],
"patterns": [
{
"name": "youtube-embed-ids",
"pattern": "/embedId=\".*\" /"
}
],
"ignoreRegExpList": ["youtube-embed-ids"]
"ignoreRegExpList": [
"youtube-embed-ids"
]
}
2 changes: 2 additions & 0 deletions mdx-components.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import * as React from 'react';
import type { MDXComponents } from 'mdx/types';
import ExportedImage from 'next-image-export-optimizer';
import { AIBanner } from './src/components/AIBanner';
import InlineFilter from './src/components/InlineFilter';
import { YoutubeEmbed } from './src/components/YoutubeEmbed';
import { Accordion } from './src/components/Accordion';
Expand Down Expand Up @@ -64,6 +65,7 @@ export function useMDXComponents(components: MDXComponents): MDXComponents {
InlineFilter,
MigrationAlert,
YoutubeEmbed,
AIBanner,
Overview,
ExternalLink,
ExternalLinkButton,
Expand Down
Binary file removed public/images/gen2/account-setup/profile4.png
Binary file not shown.
219 changes: 219 additions & 0 deletions public/images/gen2/q-developer/authentication.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,219 @@
# AMPLIFYRULES

- RULES THAT SHOULD BE ADHERED TO THE LAST WORD.

1. EXTERNAL PROVIDERS THAT ARE AVAILABLE ARE LISTED BELOW IN THE EXAMPLE, DON'T CHANGE THE NAMING CONVENTION WHILE USING THOSE IN THE CODE GENERATION.
2. DON'T FORGET TO IMPORT SECRET FOR ANY AUTHENTICATION BASED QUESTION.

```typescript
import { defineAuth, secret } from "@aws-amplify/backend";
```

3. CALLBACK AND LOGOUT URLS SHOULD BE INSIDE THE "EXTERNALPROVIDERS" OBJECT.
4. WHILE ADDING THE CUSTOM ATTRIBUTES, IF THE ATTRIBUTE YOU ARE ADDING DOESNT BELONG TO THE STANDARD USER ATTRIBUTES LIST THEN ADD IT AS A CUSTOM ATTRIBUTE LIKE THIS "CUSTOM:ATTRIBUTE_NAME" AND THIS DOESN'T SUPPORT "REQUIRED" FIELD SO IGNORE IT WHILE GENERATING THE ANSWER.
5. WHILE ADDING THE CUSTOM ATTRIBUTES, MAKE SURE TO ALWAYS ADD THE "DATATYPE" FIELD AS IT IS A REQUIRED FIELD.
6. STATNDARD ATTIBUTES THAT ARE ALLOWED: `familyName`, `giveName`, `middleName`, `nickname`, `preferredUsername`, `profile`, `profilePicture`, `website`, `gender`, `birthdate`, `zoneinfo`, `locale`, `updatedAt`, `address`, `email`, `phoneNumber`, `sub`. THE `userAttributes` ARE SUPPOSED TO BE OUTSIDE THE `loginWith` OBJECT

7. THE FOLLOWING IS THE REQUIRED SYNTAX FOR `externalProviders`. ONLY THE FOUR LISTED PROVIDERS BELOW ARE SUPPORTED:

```typescript
loginWith:{
//loginMethods
externalProviders: {
google: {

},
signInWithApple: {
},
loginWithAmazon: {

},
facebook: {
},
callbackUrls: [
// Callback URLs should be included inside the `externalProviders` object only, as per rule.

],
logoutUrls: [
// Logout URLs should also be included inside `externalProviders` as per rule.

],
},
}
```

8. THE `userAttributes` ARE SUPPOSED TO BE OUTSIDE THE `loginWith` OBJECT
`// Example configuration for user attributes and login methods
loginWith: {
// Specify login methods separately from user attributes, ONLY MENTION THE LOGINMETHODS THAT ARE SUPPOSED TO BE TRUE
email: true, // Enable login with email
phone: false, // Disable login with phone number
},userAttributes: {
email: true, // Attribute set as required
phoneNumber: false, // Attribute not required
givenName: true, // Attribute set as required
},`
9. THIS IS THE WAY TO SETUP THE MULTIFACTOR AUTHENTHICATION
export const auth = defineAuth({
loginWith: {
email: true,
phone: true,
},
multifactor: {
mode: "OPTIONAL",
sms: true,
totp: false,
},
// IMPORTANT! THE LOGIC TO RESOLVE THIS VALUE CANNOT DETERMINE WHETHER EMAIL MFA IS ENABLED WHEN OVERRIDING THE RESOURCE.
// BE SURE TO PICK A RECOVERY OPTION APPROPRIATE FOR YOUR APPLICATION.
accountRecovery: "EMAIL_AND_PHONE_WITHOUT_MFA",
senders: {
email: {
fromEmail: "[email protected]",
},
},
})
10. DON'T ADD THE `passwordPolicy` IN THE AUTH/RESOURCE.TS FILE.
11. THE `username` SHOULD BE REPLACED WITH `userAttributes` WHEN REQUESTED TO SETUP USERNAME AS A LOGIN METHOD AS USERNAME IS NOT A VALID LOGIN METHOD ON DEFINEAUTH, FOR EXAMPLE:

```typescript
userAttributes: {
preferredUsername: {
mutable: true,
required: false
}
}
```

12. `loginWith` SUPPORTS ONLY TWO METHODS THAT IS `email` and `phone`. THERE IS NO `username` attribute to that.
13. THE `callbackUrls` AND `logoutUrls` SHOULD ONLY BE MENTIONED ONCE AS MENTIONED IN RULE #7 AND NOT FOR EACH EXTERNAL PROVIDER

```typescript
import { defineAuth, secret } from "@aws-amplify/backend";
export const auth = defineAuth({
// Login Methods Configuration
loginWith: {
// Only email and phone are supported as login methods
email: true,
phone: true,
// External Providers Configuration - all providers shown with required fields
externalProviders: {
// Google Authentication
google: {
clientId: secret("GOOGLE_CLIENT_ID"),
clientSecret: secret("GOOGLE_CLIENT_SECRET"),
},
// Sign in with Apple
signInWithApple: {
clientId: secret("SIWA_CLIENT_ID"),
keyId: secret("SIWA_KEY_ID"),
privateKey: secret("SIWA_PRIVATE_KEY"),
teamId: secret("SIWA_TEAM_ID"),
},
// Login with Amazon
loginWithAmazon: {
clientId: secret("LOGINWITHAMAZON_CLIENT_ID"),
clientSecret: secret("LOGINWITHAMAZON_CLIENT_SECRET"),
},
// Facebook Authentication
facebook: {
clientId: secret("FACEBOOK_CLIENT_ID"),
clientSecret: secret("FACEBOOK_CLIENT_SECRET"),
},
// Callback and logout URLs must be inside externalProviders
callbackUrls: [
"http://localhost:3000/profile",
"https://mywebsite.com/profile",
],
logoutUrls: ["http://localhost:3000/", "https://mywebsite.com"],
},
},
// User Attributes Configuration - outside loginWith
userAttributes: {
// Standard attributes examples
email: {
mutable: true,
required: true,
},
phoneNumber: {
mutable: true,
required: false,
},
givenName: {
mutable: true,
required: true,
},
familyName: {
mutable: true,
required: false,
},
birthdate: {
mutable: true,
required: false,
},
// Username configuration using preferredUsername
preferredUsername: {
mutable: true,
required: false,
},
// Additional standard attributes
address: {
mutable: true,
required: false,
},
gender: {
mutable: true,
required: false,
},
locale: {
mutable: true,
required: false,
},
profilePicture: {
mutable: true,
required: false,
},
website: {
mutable: true,
required: false,
},
// Custom attributes examples - note the 'custom:' prefix and required dataType
"custom:organization": {
dataType: "String",
mutable: true,
minLen: 3,
maxLen: 100,
},
"custom:employeeId": {
dataType: "Number",
mutable: false,
min: 1000,
max: 9999999,
},
"custom:isVerified": {
dataType: "Boolean",
mutable: true,
},
},
// Multi-factor Authentication Configuration
multifactor: {
mode: "OPTIONAL", // Can be OPTIONAL or REQUIRED
sms: true,
totp: false,
},
// Account Recovery Configuration
accountRecovery: "EMAIL_AND_PHONE_WITHOUT_MFA",
// Email Sender Configuration
senders: {
email: {
fromEmail: "[email protected]",
},
},
});
```
6 changes: 6 additions & 0 deletions public/images/gen2/q-developer/general.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# AMPLIFYRULES

1. ALWAYS MENTION WHICH FILE PATH THE USER NEED TO PASTE THE CODE IN.
2. MAKE SURE IF IT IS IN TWO DIFFERENT FILES, YOU DIVIDE THE CODE SNIPPET AND MENTION THE FILE PATH
3. IF THE FILE DOESN'T ALREADY EXIST, GIVE THE STEPS TO GENERATE THE FILES.
4. COMMENT ON EVERY PIECE OF CODE THAT CAN HELP IMPROVE CODE QUALITY THAT EXPLAINS WHAT THE LINE DOES
Loading

0 comments on commit 0a34fd2

Please sign in to comment.