Skip to content

Commit 08f542d

Browse files
committed
Merge branch 'main' into add-ephemeral-storage-size
2 parents 724314b + 3a0073f commit 08f542d

File tree

49 files changed

+3363
-588
lines changed

Some content is hidden

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

49 files changed

+3363
-588
lines changed

cspell.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1616,7 +1616,9 @@
16161616
"jamba",
16171617
"webauthn",
16181618
"knowledgebases",
1619-
"rehype"
1619+
"rehype",
1620+
"assetlinks",
1621+
"AMPLIFYRULES"
16201622
],
16211623
"flagWords": ["hte", "full-stack", "Full-stack", "Full-Stack", "sudo"],
16221624
"patterns": [

mdx-components.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import * as React from 'react';
22
import type { MDXComponents } from 'mdx/types';
33
import ExportedImage from 'next-image-export-optimizer';
4+
import { AIBanner } from './src/components/AIBanner';
45
import InlineFilter from './src/components/InlineFilter';
56
import { YoutubeEmbed } from './src/components/YoutubeEmbed';
67
import { Accordion } from './src/components/Accordion';
@@ -64,6 +65,7 @@ export function useMDXComponents(components: MDXComponents): MDXComponents {
6465
InlineFilter,
6566
MigrationAlert,
6667
YoutubeEmbed,
68+
AIBanner,
6769
Overview,
6870
ExternalLink,
6971
ExternalLinkButton,
Lines changed: 219 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,219 @@
1+
# AMPLIFYRULES
2+
3+
- RULES THAT SHOULD BE ADHERED TO THE LAST WORD.
4+
5+
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.
6+
2. DON'T FORGET TO IMPORT SECRET FOR ANY AUTHENTICATION BASED QUESTION.
7+
8+
```typescript
9+
import { defineAuth, secret } from "@aws-amplify/backend";
10+
```
11+
12+
3. CALLBACK AND LOGOUT URLS SHOULD BE INSIDE THE "EXTERNALPROVIDERS" OBJECT.
13+
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.
14+
5. WHILE ADDING THE CUSTOM ATTRIBUTES, MAKE SURE TO ALWAYS ADD THE "DATATYPE" FIELD AS IT IS A REQUIRED FIELD.
15+
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
16+
17+
7. THE FOLLOWING IS THE REQUIRED SYNTAX FOR `externalProviders`. ONLY THE FOUR LISTED PROVIDERS BELOW ARE SUPPORTED:
18+
19+
```typescript
20+
loginWith:{
21+
//loginMethods
22+
externalProviders: {
23+
google: {
24+
25+
},
26+
signInWithApple: {
27+
},
28+
loginWithAmazon: {
29+
30+
},
31+
facebook: {
32+
},
33+
callbackUrls: [
34+
// Callback URLs should be included inside the `externalProviders` object only, as per rule.
35+
36+
],
37+
logoutUrls: [
38+
// Logout URLs should also be included inside `externalProviders` as per rule.
39+
40+
],
41+
},
42+
}
43+
```
44+
45+
8. THE `userAttributes` ARE SUPPOSED TO BE OUTSIDE THE `loginWith` OBJECT
46+
`// Example configuration for user attributes and login methods
47+
loginWith: {
48+
// Specify login methods separately from user attributes, ONLY MENTION THE LOGINMETHODS THAT ARE SUPPOSED TO BE TRUE
49+
email: true, // Enable login with email
50+
phone: false, // Disable login with phone number
51+
},userAttributes: {
52+
email: true, // Attribute set as required
53+
phoneNumber: false, // Attribute not required
54+
givenName: true, // Attribute set as required
55+
},`
56+
9. THIS IS THE WAY TO SETUP THE MULTIFACTOR AUTHENTHICATION
57+
export const auth = defineAuth({
58+
loginWith: {
59+
email: true,
60+
phone: true,
61+
},
62+
multifactor: {
63+
mode: "OPTIONAL",
64+
sms: true,
65+
totp: false,
66+
},
67+
// IMPORTANT! THE LOGIC TO RESOLVE THIS VALUE CANNOT DETERMINE WHETHER EMAIL MFA IS ENABLED WHEN OVERRIDING THE RESOURCE.
68+
// BE SURE TO PICK A RECOVERY OPTION APPROPRIATE FOR YOUR APPLICATION.
69+
accountRecovery: "EMAIL_AND_PHONE_WITHOUT_MFA",
70+
senders: {
71+
email: {
72+
fromEmail: "[email protected]",
73+
},
74+
},
75+
})
76+
10. DON'T ADD THE `passwordPolicy` IN THE AUTH/RESOURCE.TS FILE.
77+
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:
78+
79+
```typescript
80+
userAttributes: {
81+
preferredUsername: {
82+
mutable: true,
83+
required: false
84+
}
85+
}
86+
```
87+
88+
12. `loginWith` SUPPORTS ONLY TWO METHODS THAT IS `email` and `phone`. THERE IS NO `username` attribute to that.
89+
13. THE `callbackUrls` AND `logoutUrls` SHOULD ONLY BE MENTIONED ONCE AS MENTIONED IN RULE #7 AND NOT FOR EACH EXTERNAL PROVIDER
90+
91+
```typescript
92+
import { defineAuth, secret } from "@aws-amplify/backend";
93+
94+
export const auth = defineAuth({
95+
// Login Methods Configuration
96+
loginWith: {
97+
// Only email and phone are supported as login methods
98+
email: true,
99+
phone: true,
100+
101+
// External Providers Configuration - all providers shown with required fields
102+
externalProviders: {
103+
// Google Authentication
104+
google: {
105+
clientId: secret("GOOGLE_CLIENT_ID"),
106+
clientSecret: secret("GOOGLE_CLIENT_SECRET"),
107+
},
108+
// Sign in with Apple
109+
signInWithApple: {
110+
clientId: secret("SIWA_CLIENT_ID"),
111+
keyId: secret("SIWA_KEY_ID"),
112+
privateKey: secret("SIWA_PRIVATE_KEY"),
113+
teamId: secret("SIWA_TEAM_ID"),
114+
},
115+
// Login with Amazon
116+
loginWithAmazon: {
117+
clientId: secret("LOGINWITHAMAZON_CLIENT_ID"),
118+
clientSecret: secret("LOGINWITHAMAZON_CLIENT_SECRET"),
119+
},
120+
// Facebook Authentication
121+
facebook: {
122+
clientId: secret("FACEBOOK_CLIENT_ID"),
123+
clientSecret: secret("FACEBOOK_CLIENT_SECRET"),
124+
},
125+
// Callback and logout URLs must be inside externalProviders
126+
callbackUrls: [
127+
"http://localhost:3000/profile",
128+
"https://mywebsite.com/profile",
129+
],
130+
logoutUrls: ["http://localhost:3000/", "https://mywebsite.com"],
131+
},
132+
},
133+
134+
// User Attributes Configuration - outside loginWith
135+
userAttributes: {
136+
// Standard attributes examples
137+
email: {
138+
mutable: true,
139+
required: true,
140+
},
141+
phoneNumber: {
142+
mutable: true,
143+
required: false,
144+
},
145+
givenName: {
146+
mutable: true,
147+
required: true,
148+
},
149+
familyName: {
150+
mutable: true,
151+
required: false,
152+
},
153+
birthdate: {
154+
mutable: true,
155+
required: false,
156+
},
157+
// Username configuration using preferredUsername
158+
preferredUsername: {
159+
mutable: true,
160+
required: false,
161+
},
162+
// Additional standard attributes
163+
address: {
164+
mutable: true,
165+
required: false,
166+
},
167+
gender: {
168+
mutable: true,
169+
required: false,
170+
},
171+
locale: {
172+
mutable: true,
173+
required: false,
174+
},
175+
profilePicture: {
176+
mutable: true,
177+
required: false,
178+
},
179+
website: {
180+
mutable: true,
181+
required: false,
182+
},
183+
// Custom attributes examples - note the 'custom:' prefix and required dataType
184+
"custom:organization": {
185+
dataType: "String",
186+
mutable: true,
187+
minLen: 3,
188+
maxLen: 100,
189+
},
190+
"custom:employeeId": {
191+
dataType: "Number",
192+
mutable: false,
193+
min: 1000,
194+
max: 9999999,
195+
},
196+
"custom:isVerified": {
197+
dataType: "Boolean",
198+
mutable: true,
199+
},
200+
},
201+
202+
// Multi-factor Authentication Configuration
203+
multifactor: {
204+
mode: "OPTIONAL", // Can be OPTIONAL or REQUIRED
205+
sms: true,
206+
totp: false,
207+
},
208+
209+
// Account Recovery Configuration
210+
accountRecovery: "EMAIL_AND_PHONE_WITHOUT_MFA",
211+
212+
// Email Sender Configuration
213+
senders: {
214+
email: {
215+
fromEmail: "[email protected]",
216+
},
217+
},
218+
});
219+
```
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
# AMPLIFYRULES
2+
3+
1. ALWAYS MENTION WHICH FILE PATH THE USER NEED TO PASTE THE CODE IN.
4+
2. MAKE SURE IF IT IS IN TWO DIFFERENT FILES, YOU DIVIDE THE CODE SNIPPET AND MENTION THE FILE PATH
5+
3. IF THE FILE DOESN'T ALREADY EXIST, GIVE THE STEPS TO GENERATE THE FILES.
6+
4. COMMENT ON EVERY PIECE OF CODE THAT CAN HELP IMPROVE CODE QUALITY THAT EXPLAINS WHAT THE LINE DOES

0 commit comments

Comments
 (0)