@aws-amplify/core 6.0.1-console-preview.096eee3.0 → 6.0.1-console-preview.3b09ef9.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/Cache/StorageCache.js +2 -2
- package/lib/I18n/I18n.js +4 -5
- package/lib/Platform/version.d.ts +1 -1
- package/lib/Platform/version.js +1 -1
- package/lib/index.d.ts +2 -3
- package/lib/libraryUtils.d.ts +1 -1
- package/lib/parseAWSExports.d.ts +7 -0
- package/lib/parseAWSExports.js +8 -1
- package/lib/providers/pinpoint/types/pinpoint.d.ts +1 -1
- package/lib/singleton/Auth/index.js +1 -1
- package/lib/singleton/Auth/types.d.ts +43 -37
- package/lib/singleton/Auth/utils/index.d.ts +4 -5
- package/lib/singleton/Auth/utils/index.js +20 -15
- package/lib/singleton/Storage/types.d.ts +6 -4
- package/lib/singleton/types.d.ts +2 -11
- package/lib/tsconfig.tsbuildinfo +1 -1
- package/lib-esm/Cache/StorageCache.js +2 -2
- package/lib-esm/I18n/I18n.js +4 -5
- package/lib-esm/Platform/version.d.ts +1 -1
- package/lib-esm/Platform/version.js +1 -1
- package/lib-esm/index.d.ts +2 -3
- package/lib-esm/libraryUtils.d.ts +1 -1
- package/lib-esm/parseAWSExports.d.ts +7 -0
- package/lib-esm/parseAWSExports.js +8 -1
- package/lib-esm/providers/pinpoint/types/pinpoint.d.ts +1 -1
- package/lib-esm/singleton/Auth/index.js +1 -1
- package/lib-esm/singleton/Auth/types.d.ts +43 -37
- package/lib-esm/singleton/Auth/utils/index.d.ts +4 -5
- package/lib-esm/singleton/Auth/utils/index.js +20 -14
- package/lib-esm/singleton/Storage/types.d.ts +6 -4
- package/lib-esm/singleton/types.d.ts +2 -11
- package/lib-esm/tsconfig.tsbuildinfo +1 -1
- package/package.json +2 -2
- package/src/Cache/StorageCache.ts +2 -1
- package/src/I18n/I18n.ts +2 -2
- package/src/Platform/version.ts +1 -1
- package/src/index.ts +2 -1
- package/src/libraryUtils.ts +1 -1
- package/src/parseAWSExports.ts +8 -1
- package/src/providers/pinpoint/types/pinpoint.ts +1 -1
- package/src/singleton/Auth/index.ts +1 -1
- package/src/singleton/Auth/types.ts +52 -39
- package/src/singleton/Auth/utils/index.ts +41 -29
- package/src/singleton/Storage/types.ts +6 -4
- package/src/singleton/types.ts +14 -14
|
@@ -50,52 +50,58 @@ export type AuthTokens = {
|
|
|
50
50
|
idToken?: JWT;
|
|
51
51
|
accessToken: JWT;
|
|
52
52
|
};
|
|
53
|
-
export type AuthConfig = StrictUnion<
|
|
53
|
+
export type AuthConfig = StrictUnion<AuthIdentityPoolConfig | AuthUserPoolConfig | AuthUserPoolAndIdentityPoolConfig>;
|
|
54
54
|
type UnionKeys<T> = T extends T ? keyof T : never;
|
|
55
55
|
type StrictUnionHelper<T, TAll> = T extends any ? T & Partial<Record<Exclude<UnionKeys<TAll>, keyof T>, never>> : never;
|
|
56
|
-
type StrictUnion<T> = StrictUnionHelper<T, T>;
|
|
57
|
-
export type
|
|
56
|
+
export type StrictUnion<T> = StrictUnionHelper<T, T>;
|
|
57
|
+
export type AuthIdentityPoolConfig = {
|
|
58
|
+
Cognito: CognitoIdentityPoolConfig & {
|
|
59
|
+
userPoolClientId?: never;
|
|
60
|
+
userPoolId?: never;
|
|
61
|
+
loginWith?: never;
|
|
62
|
+
};
|
|
63
|
+
};
|
|
64
|
+
export type CognitoIdentityPoolConfig = {
|
|
58
65
|
identityPoolId: string;
|
|
59
|
-
|
|
60
|
-
userPoolId?: never;
|
|
61
|
-
clientMetadata?: never;
|
|
62
|
-
isMandatorySignInEnabled?: never;
|
|
66
|
+
allowGuestAccess?: boolean;
|
|
63
67
|
};
|
|
64
|
-
export type
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
68
|
+
export type AuthUserPoolConfig = {
|
|
69
|
+
Cognito: CognitoUserPoolConfig & {
|
|
70
|
+
identityPoolId?: never;
|
|
71
|
+
allowGuestAccess?: never;
|
|
72
|
+
};
|
|
69
73
|
};
|
|
70
|
-
export type
|
|
71
|
-
|
|
74
|
+
export type CognitoUserPoolConfig = {
|
|
75
|
+
userPoolClientId: string;
|
|
72
76
|
userPoolId: string;
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
77
|
+
signUpVerificationMethod?: 'code' | 'link';
|
|
78
|
+
loginWith?: {
|
|
79
|
+
oauth?: OAuthConfig;
|
|
80
|
+
};
|
|
76
81
|
};
|
|
77
82
|
export type OAuthConfig = {
|
|
78
83
|
domain: string;
|
|
79
|
-
scopes: Array<
|
|
80
|
-
redirectSignIn: string
|
|
81
|
-
redirectSignOut: string
|
|
82
|
-
responseType:
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
export type
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
};
|
|
84
|
+
scopes: Array<OAuthScope>;
|
|
85
|
+
redirectSignIn: Array<string>;
|
|
86
|
+
redirectSignOut: Array<string>;
|
|
87
|
+
responseType: 'code' | 'token';
|
|
88
|
+
providers?: Array<OAuthProviders | CustomProvider>;
|
|
89
|
+
};
|
|
90
|
+
type OAuthProviders = 'Google' | 'Facebook' | 'Amazon' | 'Apple';
|
|
91
|
+
type CustomProvider = {
|
|
92
|
+
custom: string;
|
|
93
|
+
};
|
|
94
|
+
type CustomScope = string & {};
|
|
95
|
+
type OAuthScope = 'email' | 'openid' | 'phone' | 'email' | 'profile' | 'aws.cognito.signin.user.admin' | CustomScope;
|
|
96
|
+
export type CognitoUserPoolWithOAuthConfig = CognitoUserPoolConfig & {
|
|
97
|
+
loginWith: {
|
|
98
|
+
oauth: OAuthConfig;
|
|
99
|
+
};
|
|
100
|
+
};
|
|
101
|
+
export type AuthUserPoolAndIdentityPoolConfig = {
|
|
102
|
+
Cognito: CognitoUserPoolAndIdentityPoolConfig;
|
|
103
|
+
};
|
|
104
|
+
export type CognitoUserPoolAndIdentityPoolConfig = CognitoUserPoolConfig & CognitoIdentityPoolConfig;
|
|
99
105
|
export type GetCredentialsOptions = GetCredentialsAuthenticatedUser | GetCredentialsUnauthenticatedUser;
|
|
100
106
|
type GetCredentialsAuthenticatedUser = {
|
|
101
107
|
authenticated: true;
|
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export declare function assertTokenProviderConfig(
|
|
3
|
-
export declare function assertOAuthConfig(
|
|
4
|
-
export declare function assertIdentityPooIdConfig(
|
|
5
|
-
export declare function assertUserPoolAndIdentityPooConfig(authConfig: AuthConfig): asserts authConfig is UserPoolConfigAndIdentityPoolConfig;
|
|
1
|
+
import { JWT, CognitoUserPoolWithOAuthConfig, CognitoUserPoolConfig, CognitoUserPoolAndIdentityPoolConfig, CognitoIdentityPoolConfig, StrictUnion } from '../types';
|
|
2
|
+
export declare function assertTokenProviderConfig(cognitoConfig?: StrictUnion<CognitoUserPoolConfig | CognitoUserPoolAndIdentityPoolConfig | CognitoIdentityPoolConfig>): asserts cognitoConfig is CognitoUserPoolAndIdentityPoolConfig | CognitoUserPoolConfig;
|
|
3
|
+
export declare function assertOAuthConfig(cognitoConfig?: CognitoUserPoolConfig | CognitoUserPoolAndIdentityPoolConfig): asserts cognitoConfig is CognitoUserPoolWithOAuthConfig;
|
|
4
|
+
export declare function assertIdentityPooIdConfig(cognitoConfig?: StrictUnion<CognitoUserPoolConfig | CognitoUserPoolAndIdentityPoolConfig | CognitoIdentityPoolConfig>): asserts cognitoConfig is CognitoIdentityPoolConfig;
|
|
6
5
|
export declare function decodeJWT(token: string): JWT;
|
|
@@ -1,37 +1,43 @@
|
|
|
1
1
|
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
2
2
|
// SPDX-License-Identifier: Apache-2.0
|
|
3
3
|
import { asserts } from '../../../Util/errors/AssertError';
|
|
4
|
-
export function assertTokenProviderConfig(
|
|
5
|
-
var
|
|
6
|
-
|
|
4
|
+
export function assertTokenProviderConfig(cognitoConfig) {
|
|
5
|
+
var assertionValid = true; // assume valid until otherwise proveed
|
|
6
|
+
if (!cognitoConfig) {
|
|
7
|
+
assertionValid = false;
|
|
8
|
+
}
|
|
9
|
+
else {
|
|
10
|
+
assertionValid =
|
|
11
|
+
!!cognitoConfig.userPoolClientId && !!cognitoConfig.userPoolClientId;
|
|
12
|
+
}
|
|
13
|
+
return asserts(assertionValid, {
|
|
7
14
|
name: 'AuthTokenConfigException',
|
|
8
15
|
message: 'Auth Token Provider not configured',
|
|
9
16
|
recoverySuggestion: 'Make sure to call Amplify.configure in your app',
|
|
10
17
|
});
|
|
11
18
|
}
|
|
12
|
-
export function assertOAuthConfig(
|
|
13
|
-
var _a, _b, _c, _d;
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
!!((
|
|
17
|
-
!!((
|
|
18
|
-
!!((_d = authConfig.oauth) === null || _d === void 0 ? void 0 : _d.responseType);
|
|
19
|
+
export function assertOAuthConfig(cognitoConfig) {
|
|
20
|
+
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
21
|
+
var validOAuthConfig = !!((_b = (_a = cognitoConfig === null || cognitoConfig === void 0 ? void 0 : cognitoConfig.loginWith) === null || _a === void 0 ? void 0 : _a.oauth) === null || _b === void 0 ? void 0 : _b.domain) &&
|
|
22
|
+
!!((_d = (_c = cognitoConfig === null || cognitoConfig === void 0 ? void 0 : cognitoConfig.loginWith) === null || _c === void 0 ? void 0 : _c.oauth) === null || _d === void 0 ? void 0 : _d.redirectSignOut) &&
|
|
23
|
+
!!((_f = (_e = cognitoConfig === null || cognitoConfig === void 0 ? void 0 : cognitoConfig.loginWith) === null || _e === void 0 ? void 0 : _e.oauth) === null || _f === void 0 ? void 0 : _f.redirectSignIn) &&
|
|
24
|
+
!!((_h = (_g = cognitoConfig === null || cognitoConfig === void 0 ? void 0 : cognitoConfig.loginWith) === null || _g === void 0 ? void 0 : _g.oauth) === null || _h === void 0 ? void 0 : _h.responseType);
|
|
19
25
|
return asserts(validOAuthConfig, {
|
|
20
26
|
name: 'OAuthNotConfigureException',
|
|
21
27
|
message: 'oauth param not configured',
|
|
22
28
|
recoverySuggestion: 'Make sure to call Amplify.configure with oauth parameter in your app',
|
|
23
29
|
});
|
|
24
30
|
}
|
|
25
|
-
export function assertIdentityPooIdConfig(
|
|
26
|
-
var validConfig = !!(
|
|
31
|
+
export function assertIdentityPooIdConfig(cognitoConfig) {
|
|
32
|
+
var validConfig = !!(cognitoConfig === null || cognitoConfig === void 0 ? void 0 : cognitoConfig.identityPoolId);
|
|
27
33
|
return asserts(validConfig, {
|
|
28
34
|
name: 'AuthIdentityPoolIdException',
|
|
29
35
|
message: 'Auth IdentityPoolId not configured',
|
|
30
36
|
recoverySuggestion: 'Make sure to call Amplify.configure in your app with a valid IdentityPoolId',
|
|
31
37
|
});
|
|
32
38
|
}
|
|
33
|
-
|
|
34
|
-
var validConfig = !!(authConfig === null || authConfig === void 0 ? void 0 : authConfig.identityPoolId) && !!(authConfig === null || authConfig === void 0 ? void 0 : authConfig.userPoolId);
|
|
39
|
+
function assertUserPoolAndIdentityPooConfig(authConfig) {
|
|
40
|
+
var validConfig = !!(authConfig === null || authConfig === void 0 ? void 0 : authConfig.Cognito.identityPoolId) && !!(authConfig === null || authConfig === void 0 ? void 0 : authConfig.Cognito.userPoolId);
|
|
35
41
|
return asserts(validConfig, {
|
|
36
42
|
name: 'AuthUserPoolAndIdentityPoolException',
|
|
37
43
|
message: 'Auth UserPool and IdentityPool not configured',
|
|
@@ -1,15 +1,17 @@
|
|
|
1
1
|
export type StorageAccessLevel = 'guest' | 'protected' | 'private';
|
|
2
2
|
export interface StorageConfig {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
3
|
+
S3: {
|
|
4
|
+
bucket?: string;
|
|
5
|
+
region?: string;
|
|
6
|
+
dangerouslyConnectToHttpEndpointForTesting?: string;
|
|
7
|
+
};
|
|
6
8
|
}
|
|
7
9
|
type StoragePrefixResolver = (params: {
|
|
8
10
|
accessLevel: StorageAccessLevel;
|
|
9
11
|
targetIdentityId?: string;
|
|
10
12
|
}) => Promise<string>;
|
|
11
13
|
export interface LibraryStorageOptions {
|
|
12
|
-
|
|
14
|
+
S3: {
|
|
13
15
|
prefixResolver?: StoragePrefixResolver;
|
|
14
16
|
defaultAccessLevel?: StorageAccessLevel;
|
|
15
17
|
isObjectLockEnabled?: boolean;
|
|
@@ -1,18 +1,9 @@
|
|
|
1
1
|
import { AnalyticsConfig } from './Analytics/types';
|
|
2
|
-
import { AuthConfig, LibraryAuthOptions,
|
|
2
|
+
import { AuthConfig, LibraryAuthOptions, AuthUserPoolConfig, AuthIdentityPoolConfig, AuthUserPoolAndIdentityPoolConfig, GetCredentialsOptions } from './Auth/types';
|
|
3
3
|
import { LibraryStorageOptions, StorageAccessLevel, StorageConfig } from './Storage/types';
|
|
4
|
-
import { CacheConfig } from '../Cache/types';
|
|
5
|
-
import { I18nOptions } from '../I18n/types';
|
|
6
4
|
export type ResourcesConfig = {
|
|
7
|
-
API?: {};
|
|
8
5
|
Analytics?: AnalyticsConfig;
|
|
9
6
|
Auth?: AuthConfig;
|
|
10
|
-
Cache?: CacheConfig;
|
|
11
|
-
DataStore?: {};
|
|
12
|
-
I18n?: I18nOptions;
|
|
13
|
-
Interactions?: {};
|
|
14
|
-
Notifications?: {};
|
|
15
|
-
Predictions?: {};
|
|
16
7
|
Storage?: StorageConfig;
|
|
17
8
|
ssr?: boolean;
|
|
18
9
|
};
|
|
@@ -20,4 +11,4 @@ export type LibraryOptions = {
|
|
|
20
11
|
Auth?: LibraryAuthOptions;
|
|
21
12
|
Storage?: LibraryStorageOptions;
|
|
22
13
|
};
|
|
23
|
-
export { AuthConfig, UserPoolConfig, IdentityPoolConfig, UserPoolConfigAndIdentityPoolConfig, GetCredentialsOptions, StorageAccessLevel, StorageConfig, };
|
|
14
|
+
export { AuthConfig, AuthUserPoolConfig as UserPoolConfig, AuthIdentityPoolConfig as IdentityPoolConfig, AuthUserPoolAndIdentityPoolConfig as UserPoolConfigAndIdentityPoolConfig, GetCredentialsOptions, StorageAccessLevel, StorageConfig, AnalyticsConfig, };
|