@aws-amplify/core 6.0.1-console-preview.b278dcb.0 → 6.0.1-console-preview.be08038.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/Platform/version.d.ts +1 -1
- package/lib/Platform/version.js +1 -1
- package/lib/parseAWSExports.js +20 -6
- package/lib/singleton/Auth/types.d.ts +2 -2
- package/lib/tsconfig.tsbuildinfo +1 -1
- package/lib-esm/Platform/version.d.ts +1 -1
- package/lib-esm/Platform/version.js +1 -1
- package/lib-esm/parseAWSExports.js +20 -6
- package/lib-esm/singleton/Auth/types.d.ts +2 -2
- package/lib-esm/tsconfig.tsbuildinfo +1 -1
- package/package.json +3 -3
- package/src/Platform/version.ts +1 -1
- package/src/parseAWSExports.ts +25 -7
- package/src/singleton/Auth/types.ts +2 -2
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aws-amplify/core",
|
|
3
|
-
"version": "6.0.1-console-preview.
|
|
3
|
+
"version": "6.0.1-console-preview.be08038.0+be08038",
|
|
4
4
|
"description": "Core category of aws-amplify",
|
|
5
5
|
"main": "./lib/index.js",
|
|
6
6
|
"module": "./lib-esm/index.js",
|
|
@@ -64,7 +64,7 @@
|
|
|
64
64
|
"uuid": "^9.0.0"
|
|
65
65
|
},
|
|
66
66
|
"devDependencies": {
|
|
67
|
-
"@aws-amplify/react-native": "1.0.1-console-preview.
|
|
67
|
+
"@aws-amplify/react-native": "1.0.1-console-preview.be08038.0+be08038",
|
|
68
68
|
"@types/js-cookie": "3.0.2",
|
|
69
69
|
"@types/uuid": "^9.0.0",
|
|
70
70
|
"find": "^0.2.7",
|
|
@@ -169,5 +169,5 @@
|
|
|
169
169
|
"lib-esm"
|
|
170
170
|
]
|
|
171
171
|
},
|
|
172
|
-
"gitHead": "
|
|
172
|
+
"gitHead": "be08038c5b37a510243f077c6d3209e5383f8866"
|
|
173
173
|
}
|
package/src/Platform/version.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// generated by genversion
|
|
2
|
-
export const version = '6.0.1-console-preview.
|
|
2
|
+
export const version = '6.0.1-console-preview.be08038.0+be08038';
|
package/src/parseAWSExports.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
2
2
|
// SPDX-License-Identifier: Apache-2.0
|
|
3
3
|
import { ConsoleLogger as Logger } from './Logger';
|
|
4
|
-
import { OAuthConfig, AuthConfigUserAttributes } from './singleton/Auth/types';
|
|
4
|
+
import { OAuthConfig, AuthConfigUserAttributes, OAuthProvider } from './singleton/Auth/types';
|
|
5
5
|
import { ResourcesConfig } from './singleton/types';
|
|
6
6
|
|
|
7
7
|
const logger = new Logger('parseAWSExports');
|
|
@@ -41,6 +41,7 @@ export const parseAWSExports = (
|
|
|
41
41
|
aws_cognito_password_protection_settings,
|
|
42
42
|
aws_cognito_verification_mechanisms,
|
|
43
43
|
aws_cognito_signup_attributes,
|
|
44
|
+
aws_cognito_social_providers,
|
|
44
45
|
aws_cognito_username_attributes,
|
|
45
46
|
aws_mandatory_sign_in,
|
|
46
47
|
aws_mobile_analytics_app_id,
|
|
@@ -178,16 +179,26 @@ export const parseAWSExports = (
|
|
|
178
179
|
username:
|
|
179
180
|
loginWithEmailEnabled || loginWithPhoneEnabled ? false : true,
|
|
180
181
|
email: loginWithEmailEnabled,
|
|
181
|
-
phone: loginWithPhoneEnabled
|
|
182
|
-
...(oauth &&
|
|
183
|
-
Object.keys(oauth).length > 0 && {
|
|
184
|
-
oauth: getOAuthConfig(oauth),
|
|
185
|
-
}),
|
|
182
|
+
phone: loginWithPhoneEnabled
|
|
186
183
|
},
|
|
187
184
|
},
|
|
188
185
|
};
|
|
189
186
|
}
|
|
190
187
|
|
|
188
|
+
const hasOAuthConfig = oauth ? Object.keys(oauth).length > 0 : false;
|
|
189
|
+
const hasSocialProviderConfig = aws_cognito_social_providers ? aws_cognito_social_providers.length > 0 : false;
|
|
190
|
+
if (amplifyConfig.Auth && hasOAuthConfig) {
|
|
191
|
+
amplifyConfig.Auth.Cognito.loginWith = {
|
|
192
|
+
...amplifyConfig.Auth.Cognito.loginWith,
|
|
193
|
+
oauth: {
|
|
194
|
+
...(getOAuthConfig(oauth)),
|
|
195
|
+
...(hasSocialProviderConfig && {
|
|
196
|
+
providers: parseSocialProviders(aws_cognito_social_providers)
|
|
197
|
+
})
|
|
198
|
+
},
|
|
199
|
+
};
|
|
200
|
+
}
|
|
201
|
+
|
|
191
202
|
// Storage
|
|
192
203
|
if (aws_user_files_s3_bucket) {
|
|
193
204
|
amplifyConfig.Storage = {
|
|
@@ -252,5 +263,12 @@ const getOAuthConfig = ({
|
|
|
252
263
|
scopes: scope,
|
|
253
264
|
redirectSignIn: getRedirectUrl(redirectSignIn),
|
|
254
265
|
redirectSignOut: getRedirectUrl(redirectSignOut),
|
|
255
|
-
responseType
|
|
266
|
+
responseType
|
|
256
267
|
});
|
|
268
|
+
|
|
269
|
+
const parseSocialProviders = (aws_cognito_social_providers: string[]) => {
|
|
270
|
+
return aws_cognito_social_providers.map((provider: string) => {
|
|
271
|
+
const updatedProvider = provider.toLowerCase();
|
|
272
|
+
return updatedProvider.charAt(0).toUpperCase() + updatedProvider.slice(1);
|
|
273
|
+
}) as OAuthProvider[];
|
|
274
|
+
};
|
|
@@ -166,10 +166,10 @@ export type OAuthConfig = {
|
|
|
166
166
|
redirectSignIn: Array<string>;
|
|
167
167
|
redirectSignOut: Array<string>;
|
|
168
168
|
responseType: 'code' | 'token';
|
|
169
|
-
providers?: Array<
|
|
169
|
+
providers?: Array<OAuthProvider | CustomProvider>;
|
|
170
170
|
};
|
|
171
171
|
|
|
172
|
-
type
|
|
172
|
+
export type OAuthProvider = 'Google' | 'Facebook' | 'Amazon' | 'Apple';
|
|
173
173
|
type CustomProvider = { custom: string };
|
|
174
174
|
|
|
175
175
|
type CustomScope = string & {};
|