@aws-amplify/core 6.0.1-console-preview.096eee3.0 → 6.0.1-console-preview.2f5ba46.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.
Files changed (45) hide show
  1. package/lib/Cache/StorageCache.js +2 -2
  2. package/lib/I18n/I18n.js +4 -5
  3. package/lib/Platform/version.d.ts +1 -1
  4. package/lib/Platform/version.js +1 -1
  5. package/lib/index.d.ts +2 -3
  6. package/lib/libraryUtils.d.ts +1 -1
  7. package/lib/parseAWSExports.d.ts +7 -0
  8. package/lib/parseAWSExports.js +8 -1
  9. package/lib/providers/pinpoint/types/pinpoint.d.ts +1 -1
  10. package/lib/singleton/Auth/index.js +2 -2
  11. package/lib/singleton/Auth/types.d.ts +44 -38
  12. package/lib/singleton/Auth/utils/index.d.ts +4 -5
  13. package/lib/singleton/Auth/utils/index.js +20 -15
  14. package/lib/singleton/Storage/types.d.ts +6 -4
  15. package/lib/singleton/types.d.ts +2 -11
  16. package/lib/tsconfig.tsbuildinfo +1 -1
  17. package/lib-esm/Cache/StorageCache.js +2 -2
  18. package/lib-esm/I18n/I18n.js +4 -5
  19. package/lib-esm/Platform/version.d.ts +1 -1
  20. package/lib-esm/Platform/version.js +1 -1
  21. package/lib-esm/index.d.ts +2 -3
  22. package/lib-esm/libraryUtils.d.ts +1 -1
  23. package/lib-esm/parseAWSExports.d.ts +7 -0
  24. package/lib-esm/parseAWSExports.js +8 -1
  25. package/lib-esm/providers/pinpoint/types/pinpoint.d.ts +1 -1
  26. package/lib-esm/singleton/Auth/index.js +2 -2
  27. package/lib-esm/singleton/Auth/types.d.ts +44 -38
  28. package/lib-esm/singleton/Auth/utils/index.d.ts +4 -5
  29. package/lib-esm/singleton/Auth/utils/index.js +20 -14
  30. package/lib-esm/singleton/Storage/types.d.ts +6 -4
  31. package/lib-esm/singleton/types.d.ts +2 -11
  32. package/lib-esm/tsconfig.tsbuildinfo +1 -1
  33. package/package.json +2 -2
  34. package/src/Cache/StorageCache.ts +2 -1
  35. package/src/I18n/I18n.ts +2 -2
  36. package/src/Platform/version.ts +1 -1
  37. package/src/index.ts +4 -3
  38. package/src/libraryUtils.ts +5 -1
  39. package/src/parseAWSExports.ts +8 -1
  40. package/src/providers/pinpoint/types/pinpoint.ts +1 -1
  41. package/src/singleton/Auth/index.ts +2 -2
  42. package/src/singleton/Auth/types.ts +53 -40
  43. package/src/singleton/Auth/utils/index.ts +41 -29
  44. package/src/singleton/Storage/types.ts +6 -4
  45. package/src/singleton/types.ts +16 -15
@@ -4,7 +4,6 @@
4
4
  Object.defineProperty(exports, "__esModule", { value: true });
5
5
  exports.StorageCache = void 0;
6
6
  var Utils_1 = require("./Utils");
7
- var singleton_1 = require("../singleton");
8
7
  var Logger_1 = require("../Logger");
9
8
  var logger = new Logger_1.ConsoleLogger('StorageCache');
10
9
  /**
@@ -105,7 +104,8 @@ var StorageCache = /** @class */ (function () {
105
104
  * @internal
106
105
  */
107
106
  get: function () {
108
- var globalCacheConfig = singleton_1.Amplify.getConfig().Cache || {};
107
+ // const globalCacheConfig = Amplify.getConfig().Cache || {};
108
+ var globalCacheConfig = {};
109
109
  if (this.instanceConfig) {
110
110
  return Object.assign({}, Utils_1.defaultConfig, globalCacheConfig, this.instanceConfig);
111
111
  }
package/lib/I18n/I18n.js CHANGED
@@ -15,7 +15,6 @@ var __assign = (this && this.__assign) || function () {
15
15
  Object.defineProperty(exports, "__esModule", { value: true });
16
16
  exports.I18n = void 0;
17
17
  var Logger_1 = require("../Logger");
18
- var singleton_1 = require("../singleton");
19
18
  var logger = new Logger_1.ConsoleLogger('I18n');
20
19
  /**
21
20
  * Language translation utility.
@@ -50,10 +49,10 @@ var I18n = /** @class */ (function () {
50
49
  * @deprecated The I18n utility is on a deprecation path and will be removed in a future version of Amplify.
51
50
  */
52
51
  I18n.prototype.setDefaultLanguage = function () {
53
- if (!this._lang) {
54
- var i18nConfig = singleton_1.Amplify.getConfig().I18n;
55
- this._lang = i18nConfig === null || i18nConfig === void 0 ? void 0 : i18nConfig.language;
56
- }
52
+ /*if (!this._lang) {
53
+ const i18nConfig = Amplify.getConfig().I18n;
54
+ this._lang = i18nConfig?.language;
55
+ }*/
57
56
  // Default to window language if not set in config
58
57
  if (!this._lang &&
59
58
  typeof window !== 'undefined' &&
@@ -1 +1 @@
1
- export declare const version = "6.0.1-console-preview.096eee3.0+096eee3";
1
+ export declare const version = "6.0.1-console-preview.2f5ba46.0+2f5ba46";
@@ -2,4 +2,4 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.version = void 0;
4
4
  // generated by genversion
5
- exports.version = '6.0.1-console-preview.096eee3.0+096eee3';
5
+ exports.version = '6.0.1-console-preview.2f5ba46.0+2f5ba46';
package/lib/index.d.ts CHANGED
@@ -6,8 +6,8 @@ export { FacebookOAuth, GoogleOAuth } from './OAuthHelper';
6
6
  export { AppState, AsyncStorage, Linking } from './RNComponents';
7
7
  export { Credentials, CredentialsClass } from './Credentials';
8
8
  export { ICredentials } from './types';
9
- export { TokenProvider, AuthTokens, FetchAuthSessionOptions, AWSCredentialsAndIdentityIdProvider, AWSCredentialsAndIdentityId, Identity, OAuthConfig, } from './singleton/Auth/types';
10
- export { AuthConfig, UserPoolConfig, UserPoolConfigAndIdentityPoolConfig, StorageAccessLevel, StorageConfig, GetCredentialsOptions, ResourcesConfig, LibraryOptions, } from './singleton/types';
9
+ export { TokenProvider, AuthTokens, FetchAuthSessionOptions, AWSCredentialsAndIdentityIdProvider, AWSCredentialsAndIdentityId, Identity, OAuthConfig, CognitoUserPoolConfig, } from './singleton/Auth/types';
10
+ export { AuthConfig, AuthUserPoolConfig, AuthUserPoolAndIdentityPoolConfig, StorageAccessLevel, StorageConfig, GetCredentialsOptions, ResourcesConfig, LibraryOptions, AnalyticsConfig, } from './singleton/types';
11
11
  export { Amplify, fetchAuthSession, AmplifyClass as AmplifyClassV6, clearCredentials, } from './singleton';
12
12
  export { getCredentialsForIdentity, getId, GetCredentialsForIdentityInput, GetCredentialsForIdentityOutput, } from './AwsClients/CognitoIdentity';
13
13
  export { UserProfile } from './types';
@@ -16,7 +16,6 @@ export { KeyValueStorageInterface } from './types';
16
16
  export { UniversalStorage } from './UniversalStorage';
17
17
  import { BrowserStorageCache } from './Cache/BrowserStorageCache';
18
18
  export { InMemoryCache } from './Cache/InMemoryCache';
19
- export { CacheConfig } from './Cache/types';
20
19
  export { BrowserStorageCache };
21
20
  export { BrowserStorageCache as Cache };
22
21
  export { I18n } from './I18n';
@@ -1,5 +1,5 @@
1
1
  export { browserOrNode, filenameToContentType, generateRandomString, isEmpty, isStrictObject, isTextFile, isWebWorker, makeQuerablePromise, objectLessAttributes, sortByField, transferKeyToLowerCase, transferKeyToUpperCase, } from './Util/JS';
2
- export { JWT } from './singleton/Auth/types';
2
+ export { JWT, StrictUnion, CognitoIdentityPoolConfig, } from './singleton/Auth/types';
3
3
  export { decodeJWT, assertTokenProviderConfig, assertIdentityPooIdConfig, assertOAuthConfig, } from './singleton/Auth/utils';
4
4
  export { isTokenExpired } from './singleton/Auth';
5
5
  export { Signer } from './Signer';
@@ -1,2 +1,9 @@
1
1
  import { AmplifyConfig } from './types';
2
+ /**
3
+ * This utility generates an `AmplifyConfig` object from an `aws-exports.js` file generated by the Amplify CLI.
4
+ *
5
+ * @param config A configuration object from `aws-exports.js`.
6
+ *
7
+ * @returns An AmplifyConfig object.
8
+ */
2
9
  export declare const parseAWSExports: (config: Record<string, any>) => AmplifyConfig;
@@ -14,12 +14,19 @@ Object.defineProperty(exports, "__esModule", { value: true });
14
14
  exports.parseAWSExports = void 0;
15
15
  var Logger_1 = require("./Logger");
16
16
  var logger = new Logger_1.ConsoleLogger('Parser');
17
+ /**
18
+ * This utility generates an `AmplifyConfig` object from an `aws-exports.js` file generated by the Amplify CLI.
19
+ *
20
+ * @param config A configuration object from `aws-exports.js`.
21
+ *
22
+ * @returns An AmplifyConfig object.
23
+ */
17
24
  var parseAWSExports = function (config) {
18
25
  var amplifyConfig = {};
19
26
  // Analytics
20
27
  if (config['aws_mobile_analytics_app_id']) {
21
28
  var Analytics = {
22
- AWSPinpoint: {
29
+ Pinpoint: {
23
30
  appId: config['aws_mobile_analytics_app_id'],
24
31
  region: config['aws_mobile_analytics_app_region'],
25
32
  },
@@ -3,7 +3,7 @@ import { UserProfile } from '../../../types';
3
3
  export type SupportedCategory = 'Analytics' | 'InAppMessaging' | 'PushNotification';
4
4
  export type SupportedChannelType = 'APNS' | 'APNS_SANDBOX' | 'GCM' | 'IN_APP';
5
5
  export type PinpointProviderConfig = {
6
- AWSPinpoint: {
6
+ Pinpoint: {
7
7
  appId: string;
8
8
  region: string;
9
9
  };
@@ -94,7 +94,7 @@ var AuthClass = /** @class */ (function () {
94
94
  _k.sent();
95
95
  return [3 /*break*/, 5];
96
96
  case 3:
97
- if (!!this.authConfig.isMandatorySignInEnabled) return [3 /*break*/, 5];
97
+ if (!this.authConfig.Cognito.allowGuestAccess) return [3 /*break*/, 5];
98
98
  return [4 /*yield*/, ((_j = (_h = this.authOptions) === null || _h === void 0 ? void 0 : _h.credentialsProvider) === null || _j === void 0 ? void 0 : _j.getCredentialsAndIdentityId({
99
99
  authConfig: this.authConfig,
100
100
  authenticated: false,
@@ -122,7 +122,7 @@ var AuthClass = /** @class */ (function () {
122
122
  switch (_b.label) {
123
123
  case 0:
124
124
  if (!((_a = this.authOptions) === null || _a === void 0 ? void 0 : _a.credentialsProvider)) return [3 /*break*/, 2];
125
- return [4 /*yield*/, this.authOptions.credentialsProvider.clearCredentials()];
125
+ return [4 /*yield*/, this.authOptions.credentialsProvider.clearCredentialsAndIdentityId()];
126
126
  case 1: return [2 /*return*/, _b.sent()];
127
127
  case 2: return [2 /*return*/];
128
128
  }
@@ -36,7 +36,7 @@ export type Identity = {
36
36
  };
37
37
  export interface AWSCredentialsAndIdentityIdProvider {
38
38
  getCredentialsAndIdentityId: (getCredentialsOptions: GetCredentialsOptions) => Promise<AWSCredentialsAndIdentityId>;
39
- clearCredentials: () => void;
39
+ clearCredentialsAndIdentityId: () => void;
40
40
  }
41
41
  export type TokenProvider = {
42
42
  getTokens: ({ forceRefresh, }?: {
@@ -50,52 +50,58 @@ export type AuthTokens = {
50
50
  idToken?: JWT;
51
51
  accessToken: JWT;
52
52
  };
53
- export type AuthConfig = StrictUnion<IdentityPoolConfig | UserPoolConfig | UserPoolConfigWithOAuth | UserPoolConfigAndIdentityPoolConfig | UserPoolConfigAndIdentityPoolConfigWithOAuth>;
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 IdentityPoolConfig = {
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
- userPoolWebClientId?: never;
60
- userPoolId?: never;
61
- clientMetadata?: never;
62
- isMandatorySignInEnabled?: never;
66
+ allowGuestAccess?: boolean;
63
67
  };
64
- export type UserPoolConfig = {
65
- userPoolWebClientId: string;
66
- userPoolId: string;
67
- identityPoolId?: never;
68
- clientMetadata?: Record<string, string>;
68
+ export type AuthUserPoolConfig = {
69
+ Cognito: CognitoUserPoolConfig & {
70
+ identityPoolId?: never;
71
+ allowGuestAccess?: never;
72
+ };
69
73
  };
70
- export type UserPoolConfigWithOAuth = {
71
- userPoolWebClientId: string;
74
+ export type CognitoUserPoolConfig = {
75
+ userPoolClientId: string;
72
76
  userPoolId: string;
73
- identityPoolId?: never;
74
- clientMetadata?: Record<string, string>;
75
- oauth: OAuthConfig;
77
+ signUpVerificationMethod?: 'code' | 'link';
78
+ loginWith?: {
79
+ oauth?: OAuthConfig;
80
+ };
76
81
  };
77
82
  export type OAuthConfig = {
78
83
  domain: string;
79
- scopes: Array<string>;
80
- redirectSignIn: string;
81
- redirectSignOut: string;
82
- responseType: string;
83
- };
84
- export type UserPoolConfigAndIdentityPoolConfig = {
85
- userPoolWebClientId: string;
86
- userPoolId: string;
87
- identityPoolId: string;
88
- clientMetadata?: Record<string, string>;
89
- isMandatorySignInEnabled?: boolean;
90
- };
91
- export type UserPoolConfigAndIdentityPoolConfigWithOAuth = {
92
- userPoolWebClientId: string;
93
- userPoolId: string;
94
- identityPoolId: string;
95
- clientMetadata?: Record<string, string>;
96
- isMandatorySignInEnabled?: boolean;
97
- oauth: OAuthConfig;
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 { AuthConfig, IdentityPoolConfig, JWT, UserPoolConfig, UserPoolConfigAndIdentityPoolConfig, UserPoolConfigAndIdentityPoolConfigWithOAuth, UserPoolConfigWithOAuth } from '../types';
2
- export declare function assertTokenProviderConfig(authConfig?: AuthConfig): asserts authConfig is UserPoolConfigAndIdentityPoolConfigWithOAuth | UserPoolConfigWithOAuth | UserPoolConfigAndIdentityPoolConfig | UserPoolConfig;
3
- export declare function assertOAuthConfig(authConfig?: AuthConfig): asserts authConfig is UserPoolConfigAndIdentityPoolConfigWithOAuth | UserPoolConfigWithOAuth;
4
- export declare function assertIdentityPooIdConfig(authConfig: AuthConfig): asserts authConfig is IdentityPoolConfig;
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,25 +1,31 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.decodeJWT = exports.assertUserPoolAndIdentityPooConfig = exports.assertIdentityPooIdConfig = exports.assertOAuthConfig = exports.assertTokenProviderConfig = void 0;
3
+ exports.decodeJWT = exports.assertIdentityPooIdConfig = exports.assertOAuthConfig = exports.assertTokenProviderConfig = void 0;
4
4
  // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
5
5
  // SPDX-License-Identifier: Apache-2.0
6
6
  var AssertError_1 = require("../../../Util/errors/AssertError");
7
- function assertTokenProviderConfig(authConfig) {
8
- var validConfig = !!(authConfig === null || authConfig === void 0 ? void 0 : authConfig.userPoolId) && !!(authConfig === null || authConfig === void 0 ? void 0 : authConfig.userPoolWebClientId);
9
- return (0, AssertError_1.asserts)(validConfig, {
7
+ function assertTokenProviderConfig(cognitoConfig) {
8
+ var assertionValid = true; // assume valid until otherwise proveed
9
+ if (!cognitoConfig) {
10
+ assertionValid = false;
11
+ }
12
+ else {
13
+ assertionValid =
14
+ !!cognitoConfig.userPoolClientId && !!cognitoConfig.userPoolClientId;
15
+ }
16
+ return (0, AssertError_1.asserts)(assertionValid, {
10
17
  name: 'AuthTokenConfigException',
11
18
  message: 'Auth Token Provider not configured',
12
19
  recoverySuggestion: 'Make sure to call Amplify.configure in your app',
13
20
  });
14
21
  }
15
22
  exports.assertTokenProviderConfig = assertTokenProviderConfig;
16
- function assertOAuthConfig(authConfig) {
17
- var _a, _b, _c, _d;
18
- assertTokenProviderConfig(authConfig);
19
- var validOAuthConfig = !!((_a = authConfig.oauth) === null || _a === void 0 ? void 0 : _a.domain) &&
20
- !!((_b = authConfig.oauth) === null || _b === void 0 ? void 0 : _b.redirectSignOut) &&
21
- !!((_c = authConfig.oauth) === null || _c === void 0 ? void 0 : _c.redirectSignIn) &&
22
- !!((_d = authConfig.oauth) === null || _d === void 0 ? void 0 : _d.responseType);
23
+ function assertOAuthConfig(cognitoConfig) {
24
+ var _a, _b, _c, _d, _e, _f, _g, _h;
25
+ 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) &&
26
+ !!((_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) &&
27
+ !!((_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) &&
28
+ !!((_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);
23
29
  return (0, AssertError_1.asserts)(validOAuthConfig, {
24
30
  name: 'OAuthNotConfigureException',
25
31
  message: 'oauth param not configured',
@@ -27,8 +33,8 @@ function assertOAuthConfig(authConfig) {
27
33
  });
28
34
  }
29
35
  exports.assertOAuthConfig = assertOAuthConfig;
30
- function assertIdentityPooIdConfig(authConfig) {
31
- var validConfig = !!(authConfig === null || authConfig === void 0 ? void 0 : authConfig.identityPoolId);
36
+ function assertIdentityPooIdConfig(cognitoConfig) {
37
+ var validConfig = !!(cognitoConfig === null || cognitoConfig === void 0 ? void 0 : cognitoConfig.identityPoolId);
32
38
  return (0, AssertError_1.asserts)(validConfig, {
33
39
  name: 'AuthIdentityPoolIdException',
34
40
  message: 'Auth IdentityPoolId not configured',
@@ -37,14 +43,13 @@ function assertIdentityPooIdConfig(authConfig) {
37
43
  }
38
44
  exports.assertIdentityPooIdConfig = assertIdentityPooIdConfig;
39
45
  function assertUserPoolAndIdentityPooConfig(authConfig) {
40
- var validConfig = !!(authConfig === null || authConfig === void 0 ? void 0 : authConfig.identityPoolId) && !!(authConfig === null || authConfig === void 0 ? void 0 : authConfig.userPoolId);
46
+ var validConfig = !!(authConfig === null || authConfig === void 0 ? void 0 : authConfig.Cognito.identityPoolId) && !!(authConfig === null || authConfig === void 0 ? void 0 : authConfig.Cognito.userPoolId);
41
47
  return (0, AssertError_1.asserts)(validConfig, {
42
48
  name: 'AuthUserPoolAndIdentityPoolException',
43
49
  message: 'Auth UserPool and IdentityPool not configured',
44
50
  recoverySuggestion: 'Make sure to call Amplify.configure in your app with UserPoolId and IdentityPoolId',
45
51
  });
46
52
  }
47
- exports.assertUserPoolAndIdentityPooConfig = assertUserPoolAndIdentityPooConfig;
48
53
  function decodeJWT(token) {
49
54
  var tokenSplitted = token.split('.');
50
55
  if (tokenSplitted.length !== 3) {
@@ -1,15 +1,17 @@
1
1
  export type StorageAccessLevel = 'guest' | 'protected' | 'private';
2
2
  export interface StorageConfig {
3
- bucket?: string;
4
- region?: string;
5
- dangerouslyConnectToHttpEndpointForTesting?: string;
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
- AWSS3: {
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, UserPoolConfig, IdentityPoolConfig, UserPoolConfigAndIdentityPoolConfig, GetCredentialsOptions } from './Auth/types';
2
+ import { AuthConfig, LibraryAuthOptions, AuthUserPoolConfig, AuthIdentityPoolConfig, AuthUserPoolAndIdentityPoolConfig, GetCredentialsOptions, CognitoIdentityPoolConfig } 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, AuthIdentityPoolConfig, AuthUserPoolAndIdentityPoolConfig, GetCredentialsOptions, StorageAccessLevel, StorageConfig, AnalyticsConfig, CognitoIdentityPoolConfig, };