@aws-amplify/core 6.0.1-console-preview.2f5ba46.0 → 6.0.1-console-preview.1053355.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/Hub/types/AuthTypes.d.ts +13 -7
- package/lib/Platform/index.d.ts +2 -2
- package/lib/Platform/index.js +2 -5
- package/lib/Platform/types.d.ts +4 -55
- package/lib/Platform/types.js +36 -48
- package/lib/Platform/version.d.ts +1 -1
- package/lib/Platform/version.js +1 -1
- package/lib/clients/middleware/signing/signer/signatureV4/utils/dataHashHelpers.js +1 -1
- package/lib/index.d.ts +0 -7
- package/lib/index.js +2 -19
- package/lib/parseAWSExports.d.ts +5 -4
- package/lib/parseAWSExports.js +37 -43
- package/lib/singleton/Auth/types.d.ts +1 -1
- package/lib/tsconfig.tsbuildinfo +1 -1
- package/lib/types/core.d.ts +0 -8
- package/lib-esm/Hub/types/AuthTypes.d.ts +13 -7
- package/lib-esm/Platform/index.d.ts +2 -2
- package/lib-esm/Platform/index.js +2 -5
- package/lib-esm/Platform/types.d.ts +4 -55
- package/lib-esm/Platform/types.js +36 -48
- package/lib-esm/Platform/version.d.ts +1 -1
- package/lib-esm/Platform/version.js +1 -1
- package/lib-esm/clients/middleware/signing/signer/signatureV4/utils/dataHashHelpers.js +1 -1
- package/lib-esm/index.d.ts +0 -7
- package/lib-esm/index.js +1 -7
- package/lib-esm/parseAWSExports.d.ts +5 -4
- package/lib-esm/parseAWSExports.js +37 -43
- package/lib-esm/singleton/Auth/types.d.ts +1 -1
- package/lib-esm/tsconfig.tsbuildinfo +1 -1
- package/lib-esm/types/core.d.ts +0 -8
- package/package.json +15 -41
- package/src/Cache/CHANGELOG.md +12 -0
- package/src/Hub/types/AuthTypes.ts +8 -6
- package/src/Platform/index.ts +3 -8
- package/src/Platform/types.ts +34 -56
- package/src/Platform/version.ts +1 -1
- package/src/clients/middleware/signing/signer/signatureV4/utils/dataHashHelpers.ts +1 -1
- package/src/index.ts +1 -8
- package/src/parseAWSExports.ts +69 -63
- package/src/singleton/Auth/types.ts +1 -1
- package/src/types/core.ts +0 -10
- package/lib/Credentials.d.ts +0 -47
- package/lib/Credentials.js +0 -676
- package/lib/UniversalStorage/index.d.ts +0 -23
- package/lib/UniversalStorage/index.js +0 -112
- package/lib-esm/Credentials.d.ts +0 -47
- package/lib-esm/Credentials.js +0 -673
- package/lib-esm/UniversalStorage/index.d.ts +0 -23
- package/lib-esm/UniversalStorage/index.js +0 -106
- package/src/Credentials.ts +0 -630
- package/src/UniversalStorage/index.ts +0 -119
|
@@ -1,11 +1,17 @@
|
|
|
1
|
-
export type AuthHubEventData =
|
|
1
|
+
export type AuthHubEventData =
|
|
2
|
+
/** Dispatched when a user signs in with an oauth provider such as Google.*/
|
|
3
|
+
{
|
|
2
4
|
event: 'signInWithRedirect';
|
|
3
|
-
}
|
|
5
|
+
}
|
|
6
|
+
/** Dispatched when there is an error in the oauth flow process.*/
|
|
7
|
+
| {
|
|
8
|
+
event: 'signInWithRedirect_failure';
|
|
9
|
+
}
|
|
10
|
+
/** Dispatched when auth tokens are successfully refreshed.*/
|
|
11
|
+
| {
|
|
4
12
|
event: 'tokenRefresh';
|
|
5
|
-
}
|
|
13
|
+
}
|
|
14
|
+
/** Dispatched when there is an error in the refresh of tokens.*/
|
|
15
|
+
| {
|
|
6
16
|
event: 'tokenRefresh_failure';
|
|
7
|
-
} | {
|
|
8
|
-
event: 'customOAuthState';
|
|
9
|
-
} | {
|
|
10
|
-
event: 'customState_failure';
|
|
11
17
|
};
|
package/lib/Platform/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { CustomUserAgentDetails, Framework } from './types';
|
|
2
|
-
import
|
|
2
|
+
import { UserAgent as AWSUserAgent } from '@aws-sdk/types';
|
|
3
3
|
declare class PlatformBuilder {
|
|
4
4
|
userAgent: string;
|
|
5
5
|
get framework(): Framework;
|
|
@@ -7,6 +7,6 @@ declare class PlatformBuilder {
|
|
|
7
7
|
observeFrameworkChanges(fcn: () => void): void;
|
|
8
8
|
}
|
|
9
9
|
export declare const Platform: PlatformBuilder;
|
|
10
|
-
export declare const getAmplifyUserAgentObject: ({ category, action, framework,
|
|
10
|
+
export declare const getAmplifyUserAgentObject: ({ category, action, framework, }?: CustomUserAgentDetails) => AWSUserAgent;
|
|
11
11
|
export declare const getAmplifyUserAgent: (customUserAgentDetails?: CustomUserAgentDetails) => string;
|
|
12
12
|
export {};
|
package/lib/Platform/index.js
CHANGED
|
@@ -49,15 +49,12 @@ var PlatformBuilder = /** @class */ (function () {
|
|
|
49
49
|
}());
|
|
50
50
|
exports.Platform = new PlatformBuilder();
|
|
51
51
|
var getAmplifyUserAgentObject = function (_a) {
|
|
52
|
-
var _b = _a === void 0 ? {} : _a, category = _b.category, action = _b.action, framework = _b.framework
|
|
52
|
+
var _b = _a === void 0 ? {} : _a, category = _b.category, action = _b.action, framework = _b.framework;
|
|
53
53
|
var userAgent = [[BASE_USER_AGENT, version_1.version]];
|
|
54
54
|
if (category) {
|
|
55
55
|
userAgent.push([category, action]);
|
|
56
56
|
}
|
|
57
|
-
userAgent.push(['framework',
|
|
58
|
-
if (additionalInfo) {
|
|
59
|
-
userAgent = userAgent.concat(additionalInfo);
|
|
60
|
-
}
|
|
57
|
+
userAgent.push(['framework', (0, detectFramework_1.detectFramework)()]);
|
|
61
58
|
return userAgent;
|
|
62
59
|
};
|
|
63
60
|
exports.getAmplifyUserAgentObject = getAmplifyUserAgentObject;
|
package/lib/Platform/types.d.ts
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import type { UserAgent as AWSUserAgent } from '@aws-sdk/types';
|
|
2
1
|
export declare enum Framework {
|
|
3
2
|
WebUnknown = "0",
|
|
4
3
|
React = "1",
|
|
@@ -44,63 +43,17 @@ export declare enum ApiAction {
|
|
|
44
43
|
Head = "7"
|
|
45
44
|
}
|
|
46
45
|
export declare enum AuthAction {
|
|
47
|
-
|
|
48
|
-
ConfirmSignUp = "2",
|
|
49
|
-
ResendSignUp = "3",
|
|
50
|
-
SignIn = "4",
|
|
51
|
-
GetMFAOptions = "5",
|
|
52
|
-
GetPreferredMFA = "6",
|
|
53
|
-
SetPreferredMFA = "7",
|
|
54
|
-
DisableSMS = "8",
|
|
55
|
-
EnableSMS = "9",
|
|
56
|
-
SetupTOTP = "10",
|
|
57
|
-
VerifyTotpToken = "11",
|
|
58
|
-
ConfirmSignIn = "12",
|
|
59
|
-
CompleteNewPassword = "13",
|
|
60
|
-
SendCustomChallengeAnswer = "14",
|
|
61
|
-
DeleteUserAttributes = "15",
|
|
62
|
-
DeleteUser = "16",
|
|
63
|
-
UpdateUserAttributes = "17",
|
|
64
|
-
UserAttributes = "18",
|
|
65
|
-
CurrentUserPoolUser = "19",
|
|
66
|
-
CurrentAuthenticatedUser = "20",
|
|
67
|
-
CurrentSession = "21",
|
|
68
|
-
VerifyUserAttribute = "22",
|
|
69
|
-
VerifyUserAttributeSubmit = "23",
|
|
70
|
-
VerifyCurrentUserAttribute = "24",
|
|
71
|
-
VerifyCurrentUserAttributeSubmit = "25",
|
|
72
|
-
SignOut = "26",
|
|
73
|
-
ChangePassword = "27",
|
|
74
|
-
ForgotPassword = "28",
|
|
75
|
-
ForgotPasswordSubmit = "29",
|
|
76
|
-
FederatedSignIn = "30",
|
|
77
|
-
VerifiedContact = "31",
|
|
78
|
-
UserSession = "32",
|
|
79
|
-
CurrentUserCredentials = "33",
|
|
80
|
-
CurrentCredentials = "34",
|
|
81
|
-
CurrentUserInfo = "35",
|
|
82
|
-
RememberDevice = "36",
|
|
83
|
-
ForgetDevice = "37",
|
|
84
|
-
FetchDevices = "38"
|
|
46
|
+
FederatedSignIn = "30"
|
|
85
47
|
}
|
|
86
48
|
export declare enum DataStoreAction {
|
|
87
49
|
Subscribe = "1",
|
|
88
50
|
GraphQl = "2"
|
|
89
51
|
}
|
|
90
52
|
export declare enum GeoAction {
|
|
91
|
-
|
|
92
|
-
SearchForSuggestions = "2",
|
|
93
|
-
SearchByPlaceId = "3",
|
|
94
|
-
SearchByCoordinates = "4",
|
|
95
|
-
SaveGeofences = "5",
|
|
96
|
-
GetGeofence = "6",
|
|
97
|
-
ListGeofences = "7",
|
|
98
|
-
DeleteGeofences = "8"
|
|
53
|
+
None = "0"
|
|
99
54
|
}
|
|
100
55
|
export declare enum InAppMessagingAction {
|
|
101
|
-
None = "0"
|
|
102
|
-
SyncMessages = "1",
|
|
103
|
-
IdentifyUser = "2"
|
|
56
|
+
None = "0"
|
|
104
57
|
}
|
|
105
58
|
export declare enum InteractionsAction {
|
|
106
59
|
None = "0"
|
|
@@ -122,8 +75,7 @@ export declare enum StorageAction {
|
|
|
122
75
|
List = "3",
|
|
123
76
|
Copy = "4",
|
|
124
77
|
Remove = "5",
|
|
125
|
-
GetProperties = "6"
|
|
126
|
-
Cancel = "7"
|
|
78
|
+
GetProperties = "6"
|
|
127
79
|
}
|
|
128
80
|
type ActionMap = {
|
|
129
81
|
[Category.Auth]: AuthAction;
|
|
@@ -144,9 +96,6 @@ type UserAgentDetailsWithCategory<T extends Category> = CustomUserAgentDetailsBa
|
|
|
144
96
|
};
|
|
145
97
|
type CustomUserAgentDetailsBase = {
|
|
146
98
|
framework?: Framework;
|
|
147
|
-
/** Accepts an array of arrays with exactly 1 or 2 values and translates
|
|
148
|
-
those arrays to "item" or "item1/item2" strings on the custom user agent */
|
|
149
|
-
additionalInfo?: AWSUserAgent;
|
|
150
99
|
};
|
|
151
100
|
export type CustomUserAgentDetails = (CustomUserAgentDetailsBase & {
|
|
152
101
|
category?: never;
|
package/lib/Platform/types.js
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
3
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
2
4
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
5
|
exports.StorageAction = exports.PushNotificationAction = exports.PubSubAction = exports.PredictionsAction = exports.InteractionsAction = exports.InAppMessagingAction = exports.GeoAction = exports.DataStoreAction = exports.AuthAction = exports.ApiAction = exports.AnalyticsAction = exports.Category = exports.Framework = void 0;
|
|
4
6
|
var Framework;
|
|
@@ -54,44 +56,40 @@ var ApiAction;
|
|
|
54
56
|
})(ApiAction = exports.ApiAction || (exports.ApiAction = {}));
|
|
55
57
|
var AuthAction;
|
|
56
58
|
(function (AuthAction) {
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
59
|
+
// SignUp = '1',
|
|
60
|
+
// ConfirmSignUp = '2',
|
|
61
|
+
// ResendSignUp = '3',
|
|
62
|
+
// SignIn = '4',
|
|
63
|
+
// GetMFAOptions = '5',
|
|
64
|
+
// GetPreferredMFA = '6',
|
|
65
|
+
// SetPreferredMFA = '7',
|
|
66
|
+
// DisableSMS = '8',
|
|
67
|
+
// EnableSMS = '9',
|
|
68
|
+
// SetupTOTP = '10',
|
|
69
|
+
// VerifyTotpToken = '11',
|
|
70
|
+
// ConfirmSignIn = '12',
|
|
71
|
+
// CompleteNewPassword = '13',
|
|
72
|
+
// SendCustomChallengeAnswer = '14',
|
|
73
|
+
// DeleteUserAttributes = '15',
|
|
74
|
+
// DeleteUser = '16',
|
|
75
|
+
// UpdateUserAttributes = '17',
|
|
76
|
+
// UserAttributes = '18',
|
|
77
|
+
// CurrentUserPoolUser = '19',
|
|
78
|
+
// CurrentAuthenticatedUser = '20',
|
|
79
|
+
// CurrentSession = '21',
|
|
80
|
+
// VerifyUserAttribute = '22',
|
|
81
|
+
// VerifyUserAttributeSubmit = '23',
|
|
82
|
+
// VerifyCurrentUserAttribute = '24',
|
|
83
|
+
// VerifyCurrentUserAttributeSubmit = '25',
|
|
84
|
+
// SignOut = '26',
|
|
85
|
+
// ChangePassword = '27',
|
|
86
|
+
// ForgotPassword = '28',
|
|
87
|
+
// ForgotPasswordSubmit = '29',
|
|
86
88
|
AuthAction["FederatedSignIn"] = "30";
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
AuthAction["CurrentUserInfo"] = "35";
|
|
92
|
-
AuthAction["RememberDevice"] = "36";
|
|
93
|
-
AuthAction["ForgetDevice"] = "37";
|
|
94
|
-
AuthAction["FetchDevices"] = "38";
|
|
89
|
+
// CurrentUserInfo = '31',
|
|
90
|
+
// RememberDevice = '32',
|
|
91
|
+
// ForgetDevice = '33',
|
|
92
|
+
// FetchDevices = '34',
|
|
95
93
|
})(AuthAction = exports.AuthAction || (exports.AuthAction = {}));
|
|
96
94
|
var DataStoreAction;
|
|
97
95
|
(function (DataStoreAction) {
|
|
@@ -100,20 +98,11 @@ var DataStoreAction;
|
|
|
100
98
|
})(DataStoreAction = exports.DataStoreAction || (exports.DataStoreAction = {}));
|
|
101
99
|
var GeoAction;
|
|
102
100
|
(function (GeoAction) {
|
|
103
|
-
GeoAction["
|
|
104
|
-
GeoAction["SearchForSuggestions"] = "2";
|
|
105
|
-
GeoAction["SearchByPlaceId"] = "3";
|
|
106
|
-
GeoAction["SearchByCoordinates"] = "4";
|
|
107
|
-
GeoAction["SaveGeofences"] = "5";
|
|
108
|
-
GeoAction["GetGeofence"] = "6";
|
|
109
|
-
GeoAction["ListGeofences"] = "7";
|
|
110
|
-
GeoAction["DeleteGeofences"] = "8";
|
|
101
|
+
GeoAction["None"] = "0";
|
|
111
102
|
})(GeoAction = exports.GeoAction || (exports.GeoAction = {}));
|
|
112
103
|
var InAppMessagingAction;
|
|
113
104
|
(function (InAppMessagingAction) {
|
|
114
105
|
InAppMessagingAction["None"] = "0";
|
|
115
|
-
InAppMessagingAction["SyncMessages"] = "1";
|
|
116
|
-
InAppMessagingAction["IdentifyUser"] = "2";
|
|
117
106
|
})(InAppMessagingAction = exports.InAppMessagingAction || (exports.InAppMessagingAction = {}));
|
|
118
107
|
var InteractionsAction;
|
|
119
108
|
(function (InteractionsAction) {
|
|
@@ -141,5 +130,4 @@ var StorageAction;
|
|
|
141
130
|
StorageAction["Copy"] = "4";
|
|
142
131
|
StorageAction["Remove"] = "5";
|
|
143
132
|
StorageAction["GetProperties"] = "6";
|
|
144
|
-
StorageAction["Cancel"] = "7";
|
|
145
133
|
})(StorageAction = exports.StorageAction || (exports.StorageAction = {}));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const version = "6.0.1-console-preview.
|
|
1
|
+
export declare const version = "6.0.1-console-preview.1053355.0+1053355";
|
package/lib/Platform/version.js
CHANGED
|
@@ -5,7 +5,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
5
5
|
exports.getHashedDataAsHex = exports.getHashedData = void 0;
|
|
6
6
|
// TODO: V6 update to different crypto dependency?
|
|
7
7
|
var sha256_js_1 = require("@aws-crypto/sha256-js");
|
|
8
|
-
var util_hex_encoding_1 = require("@
|
|
8
|
+
var util_hex_encoding_1 = require("@smithy/util-hex-encoding");
|
|
9
9
|
/**
|
|
10
10
|
* Returns the hashed data a `Uint8Array`.
|
|
11
11
|
*
|
package/lib/index.d.ts
CHANGED
|
@@ -1,11 +1,5 @@
|
|
|
1
|
-
export { ClientDevice } from './ClientDevice';
|
|
2
|
-
export { ConsoleLogger, ConsoleLogger as Logger } from './Logger';
|
|
3
1
|
export { Hub } from './Hub';
|
|
4
2
|
export { HubCapsule, HubCallback, HubPayload } from './Hub/types';
|
|
5
|
-
export { FacebookOAuth, GoogleOAuth } from './OAuthHelper';
|
|
6
|
-
export { AppState, AsyncStorage, Linking } from './RNComponents';
|
|
7
|
-
export { Credentials, CredentialsClass } from './Credentials';
|
|
8
|
-
export { ICredentials } from './types';
|
|
9
3
|
export { TokenProvider, AuthTokens, FetchAuthSessionOptions, AWSCredentialsAndIdentityIdProvider, AWSCredentialsAndIdentityId, Identity, OAuthConfig, CognitoUserPoolConfig, } from './singleton/Auth/types';
|
|
10
4
|
export { AuthConfig, AuthUserPoolConfig, AuthUserPoolAndIdentityPoolConfig, StorageAccessLevel, StorageConfig, GetCredentialsOptions, ResourcesConfig, LibraryOptions, AnalyticsConfig, } from './singleton/types';
|
|
11
5
|
export { Amplify, fetchAuthSession, AmplifyClass as AmplifyClassV6, clearCredentials, } from './singleton';
|
|
@@ -13,7 +7,6 @@ export { getCredentialsForIdentity, getId, GetCredentialsForIdentityInput, GetCr
|
|
|
13
7
|
export { UserProfile } from './types';
|
|
14
8
|
export { StorageHelper, MemoryStorage, LocalStorage, CookieStorage, SessionStorage, MemoryKeyValueStorage, } from './StorageHelper';
|
|
15
9
|
export { KeyValueStorageInterface } from './types';
|
|
16
|
-
export { UniversalStorage } from './UniversalStorage';
|
|
17
10
|
import { BrowserStorageCache } from './Cache/BrowserStorageCache';
|
|
18
11
|
export { InMemoryCache } from './Cache/InMemoryCache';
|
|
19
12
|
export { BrowserStorageCache };
|
package/lib/index.js
CHANGED
|
@@ -2,28 +2,13 @@
|
|
|
2
2
|
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
3
3
|
// SPDX-License-Identifier: Apache-2.0
|
|
4
4
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5
|
-
exports.parseAWSExports = exports.I18n = exports.Cache = exports.BrowserStorageCache = exports.InMemoryCache = exports.
|
|
5
|
+
exports.parseAWSExports = exports.I18n = exports.Cache = exports.BrowserStorageCache = exports.InMemoryCache = exports.MemoryKeyValueStorage = exports.SessionStorage = exports.CookieStorage = exports.LocalStorage = exports.MemoryStorage = exports.StorageHelper = exports.getId = exports.getCredentialsForIdentity = exports.clearCredentials = exports.AmplifyClassV6 = exports.fetchAuthSession = exports.Amplify = exports.Hub = void 0;
|
|
6
6
|
/*
|
|
7
7
|
This file maps top-level exports from `@aws-amplify/core`. These are intended to be potentially customer-facing exports.
|
|
8
8
|
*/
|
|
9
|
-
//
|
|
10
|
-
var ClientDevice_1 = require("./ClientDevice");
|
|
11
|
-
Object.defineProperty(exports, "ClientDevice", { enumerable: true, get: function () { return ClientDevice_1.ClientDevice; } });
|
|
12
|
-
var Logger_1 = require("./Logger");
|
|
13
|
-
Object.defineProperty(exports, "ConsoleLogger", { enumerable: true, get: function () { return Logger_1.ConsoleLogger; } });
|
|
14
|
-
Object.defineProperty(exports, "Logger", { enumerable: true, get: function () { return Logger_1.ConsoleLogger; } });
|
|
9
|
+
// Hub exports
|
|
15
10
|
var Hub_1 = require("./Hub");
|
|
16
11
|
Object.defineProperty(exports, "Hub", { enumerable: true, get: function () { return Hub_1.Hub; } });
|
|
17
|
-
var OAuthHelper_1 = require("./OAuthHelper");
|
|
18
|
-
Object.defineProperty(exports, "FacebookOAuth", { enumerable: true, get: function () { return OAuthHelper_1.FacebookOAuth; } });
|
|
19
|
-
Object.defineProperty(exports, "GoogleOAuth", { enumerable: true, get: function () { return OAuthHelper_1.GoogleOAuth; } });
|
|
20
|
-
var RNComponents_1 = require("./RNComponents");
|
|
21
|
-
Object.defineProperty(exports, "AppState", { enumerable: true, get: function () { return RNComponents_1.AppState; } });
|
|
22
|
-
Object.defineProperty(exports, "AsyncStorage", { enumerable: true, get: function () { return RNComponents_1.AsyncStorage; } });
|
|
23
|
-
Object.defineProperty(exports, "Linking", { enumerable: true, get: function () { return RNComponents_1.Linking; } });
|
|
24
|
-
var Credentials_1 = require("./Credentials");
|
|
25
|
-
Object.defineProperty(exports, "Credentials", { enumerable: true, get: function () { return Credentials_1.Credentials; } });
|
|
26
|
-
Object.defineProperty(exports, "CredentialsClass", { enumerable: true, get: function () { return Credentials_1.CredentialsClass; } });
|
|
27
12
|
var singleton_1 = require("./singleton");
|
|
28
13
|
Object.defineProperty(exports, "Amplify", { enumerable: true, get: function () { return singleton_1.Amplify; } });
|
|
29
14
|
Object.defineProperty(exports, "fetchAuthSession", { enumerable: true, get: function () { return singleton_1.fetchAuthSession; } });
|
|
@@ -41,8 +26,6 @@ Object.defineProperty(exports, "LocalStorage", { enumerable: true, get: function
|
|
|
41
26
|
Object.defineProperty(exports, "CookieStorage", { enumerable: true, get: function () { return StorageHelper_1.CookieStorage; } });
|
|
42
27
|
Object.defineProperty(exports, "SessionStorage", { enumerable: true, get: function () { return StorageHelper_1.SessionStorage; } });
|
|
43
28
|
Object.defineProperty(exports, "MemoryKeyValueStorage", { enumerable: true, get: function () { return StorageHelper_1.MemoryKeyValueStorage; } });
|
|
44
|
-
var UniversalStorage_1 = require("./UniversalStorage");
|
|
45
|
-
Object.defineProperty(exports, "UniversalStorage", { enumerable: true, get: function () { return UniversalStorage_1.UniversalStorage; } });
|
|
46
29
|
// Cache exports
|
|
47
30
|
var BrowserStorageCache_1 = require("./Cache/BrowserStorageCache");
|
|
48
31
|
Object.defineProperty(exports, "BrowserStorageCache", { enumerable: true, get: function () { return BrowserStorageCache_1.BrowserStorageCache; } });
|
package/lib/parseAWSExports.d.ts
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ResourcesConfig } from './singleton/types';
|
|
2
2
|
/**
|
|
3
|
-
* This utility
|
|
3
|
+
* This utility converts the `aws-exports.js` file generated by the Amplify CLI into a {@link ResourcesConfig} object
|
|
4
|
+
* consumable by Amplify.
|
|
4
5
|
*
|
|
5
6
|
* @param config A configuration object from `aws-exports.js`.
|
|
6
7
|
*
|
|
7
|
-
* @returns
|
|
8
|
+
* @returns A {@link ResourcesConfig} object.
|
|
8
9
|
*/
|
|
9
|
-
export declare const parseAWSExports: (config
|
|
10
|
+
export declare const parseAWSExports: (config?: Record<string, any>) => ResourcesConfig;
|
package/lib/parseAWSExports.js
CHANGED
|
@@ -12,71 +12,65 @@ var __assign = (this && this.__assign) || function () {
|
|
|
12
12
|
};
|
|
13
13
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
14
14
|
exports.parseAWSExports = void 0;
|
|
15
|
-
var Logger_1 = require("./Logger");
|
|
16
|
-
var logger = new Logger_1.ConsoleLogger('Parser');
|
|
17
15
|
/**
|
|
18
|
-
* This utility
|
|
16
|
+
* This utility converts the `aws-exports.js` file generated by the Amplify CLI into a {@link ResourcesConfig} object
|
|
17
|
+
* consumable by Amplify.
|
|
19
18
|
*
|
|
20
19
|
* @param config A configuration object from `aws-exports.js`.
|
|
21
20
|
*
|
|
22
|
-
* @returns
|
|
21
|
+
* @returns A {@link ResourcesConfig} object.
|
|
23
22
|
*/
|
|
24
23
|
var parseAWSExports = function (config) {
|
|
24
|
+
if (config === void 0) { config = {}; }
|
|
25
|
+
var aws_cognito_identity_pool_id = config.aws_cognito_identity_pool_id, aws_cognito_sign_up_verification_method = config.aws_cognito_sign_up_verification_method, aws_mandatory_sign_in = config.aws_mandatory_sign_in, aws_mobile_analytics_app_id = config.aws_mobile_analytics_app_id, aws_mobile_analytics_app_region = config.aws_mobile_analytics_app_region, aws_user_files_s3_bucket = config.aws_user_files_s3_bucket, aws_user_files_s3_bucket_region = config.aws_user_files_s3_bucket_region, aws_user_files_s3_dangerously_connect_to_http_endpoint_for_testing = config.aws_user_files_s3_dangerously_connect_to_http_endpoint_for_testing, aws_user_pools_id = config.aws_user_pools_id, aws_user_pools_web_client_id = config.aws_user_pools_web_client_id, geo = config.geo, oauth = config.oauth;
|
|
25
26
|
var amplifyConfig = {};
|
|
26
27
|
// Analytics
|
|
27
|
-
if (
|
|
28
|
-
|
|
28
|
+
if (aws_mobile_analytics_app_id) {
|
|
29
|
+
amplifyConfig.Analytics = {
|
|
29
30
|
Pinpoint: {
|
|
30
|
-
appId:
|
|
31
|
-
region:
|
|
31
|
+
appId: aws_mobile_analytics_app_id,
|
|
32
|
+
region: aws_mobile_analytics_app_region,
|
|
32
33
|
},
|
|
33
34
|
};
|
|
34
|
-
amplifyConfig.Analytics = Analytics;
|
|
35
35
|
}
|
|
36
36
|
// Auth
|
|
37
|
-
if (
|
|
37
|
+
if (aws_cognito_identity_pool_id || aws_user_pools_id) {
|
|
38
38
|
amplifyConfig.Auth = {
|
|
39
|
-
|
|
40
|
-
userPoolWebClientId: config['aws_user_pools_web_client_id'],
|
|
41
|
-
region: config['aws_cognito_region'],
|
|
42
|
-
identityPoolId: config['aws_cognito_identity_pool_id'],
|
|
43
|
-
identityPoolRegion: config['aws_cognito_region'],
|
|
44
|
-
mandatorySignIn: config['aws_mandatory_sign_in'] === 'enable',
|
|
45
|
-
signUpVerificationMethod: config['aws_cognito_sign_up_verification_method'] || 'code',
|
|
39
|
+
Cognito: __assign({ identityPoolId: aws_cognito_identity_pool_id, allowGuestAccess: aws_mandatory_sign_in !== 'enable', signUpVerificationMethod: aws_cognito_sign_up_verification_method, userPoolClientId: aws_user_pools_web_client_id, userPoolId: aws_user_pools_id }, (oauth && { loginWith: getOAuthConfig(oauth) })),
|
|
46
40
|
};
|
|
47
41
|
}
|
|
48
42
|
// Storage
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
dangerouslyConnectToHttpEndpointForTesting: config['aws_user_files_s3_dangerously_connect_to_http_endpoint_for_testing'],
|
|
43
|
+
if (aws_user_files_s3_bucket) {
|
|
44
|
+
amplifyConfig.Storage = {
|
|
45
|
+
S3: {
|
|
46
|
+
bucket: aws_user_files_s3_bucket,
|
|
47
|
+
region: aws_user_files_s3_bucket_region,
|
|
48
|
+
dangerouslyConnectToHttpEndpointForTesting: aws_user_files_s3_dangerously_connect_to_http_endpoint_for_testing,
|
|
56
49
|
},
|
|
57
50
|
};
|
|
58
51
|
}
|
|
59
|
-
else {
|
|
60
|
-
storageConfig = config ? config.Storage || config : {};
|
|
61
|
-
}
|
|
62
|
-
// Logging
|
|
63
|
-
if (config['Logging']) {
|
|
64
|
-
amplifyConfig.Logging = __assign(__assign({}, config['Logging']), { region: config['aws_project_region'] });
|
|
65
|
-
}
|
|
66
52
|
// Geo
|
|
67
|
-
if (
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
};
|
|
73
|
-
}
|
|
53
|
+
if (geo) {
|
|
54
|
+
var amazon_location_service = geo.amazon_location_service;
|
|
55
|
+
amplifyConfig.Geo = amazon_location_service
|
|
56
|
+
? { AmazonLocationService: amazon_location_service }
|
|
57
|
+
: __assign({}, geo);
|
|
74
58
|
}
|
|
75
|
-
amplifyConfig.Analytics = Object.assign({}, amplifyConfig.Analytics, config.Analytics);
|
|
76
|
-
amplifyConfig.Auth = Object.assign({}, amplifyConfig.Auth, config.Auth);
|
|
77
|
-
amplifyConfig.Storage = Object.assign({}, storageConfig);
|
|
78
|
-
amplifyConfig.Logging = Object.assign({}, amplifyConfig.Logging, config.Logging);
|
|
79
|
-
logger.debug('parse config', config, 'to amplifyconfig', amplifyConfig);
|
|
80
59
|
return amplifyConfig;
|
|
81
60
|
};
|
|
82
61
|
exports.parseAWSExports = parseAWSExports;
|
|
62
|
+
var getRedirectUrl = function (redirectStr) {
|
|
63
|
+
return redirectStr.split(',');
|
|
64
|
+
};
|
|
65
|
+
var getOAuthConfig = function (_a) {
|
|
66
|
+
var domain = _a.domain, scope = _a.scope, redirectSignIn = _a.redirectSignIn, redirectSignOut = _a.redirectSignOut, responseType = _a.responseType;
|
|
67
|
+
return ({
|
|
68
|
+
oauth: {
|
|
69
|
+
domain: domain,
|
|
70
|
+
scopes: scope,
|
|
71
|
+
redirectSignIn: getRedirectUrl(redirectSignIn),
|
|
72
|
+
redirectSignOut: getRedirectUrl(redirectSignOut),
|
|
73
|
+
responseType: responseType,
|
|
74
|
+
},
|
|
75
|
+
});
|
|
76
|
+
};
|
|
@@ -35,7 +35,7 @@ export type Identity = {
|
|
|
35
35
|
type: 'guest' | 'primary';
|
|
36
36
|
};
|
|
37
37
|
export interface AWSCredentialsAndIdentityIdProvider {
|
|
38
|
-
getCredentialsAndIdentityId: (getCredentialsOptions: GetCredentialsOptions) => Promise<AWSCredentialsAndIdentityId>;
|
|
38
|
+
getCredentialsAndIdentityId: (getCredentialsOptions: GetCredentialsOptions) => Promise<AWSCredentialsAndIdentityId | undefined>;
|
|
39
39
|
clearCredentialsAndIdentityId: () => void;
|
|
40
40
|
}
|
|
41
41
|
export type TokenProvider = {
|