@aws-amplify/core 6.0.1-console-preview.f63250a.0 → 6.0.1-console-preview.e8aa063.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/internals/adapter-core/package.json +8 -0
- package/internals/providers/pinpoint/package.json +8 -0
- package/internals/utils/package.json +7 -0
- package/lib/AwsClients/CognitoIdentity/getCredentialsForIdentity.d.ts +1 -1
- package/lib/AwsClients/CognitoIdentity/getId.d.ts +1 -1
- package/lib/AwsClients/Pinpoint/getInAppMessages.d.ts +1 -1
- package/lib/AwsClients/Pinpoint/index.d.ts +1 -1
- package/lib/AwsClients/Pinpoint/putEvents.d.ts +1 -1
- package/lib/AwsClients/Pinpoint/putEvents.js +2 -2
- package/lib/AwsClients/Pinpoint/updateEndpoint.d.ts +1 -1
- package/lib/Cache/AsyncStorageCache.js +3 -3
- package/lib/Cache/BrowserStorageCache.js +5 -5
- package/lib/Cache/InMemoryCache.js +3 -3
- package/lib/Cache/StorageCache.js +1 -1
- package/lib/Cache/Utils/CacheList.js +5 -5
- package/lib/Credentials.js +2 -5
- package/lib/{Hub.d.ts → Hub/index.d.ts} +5 -21
- package/lib/Hub/index.js +151 -0
- package/lib/Hub/types/AuthTypes.d.ts +11 -0
- package/lib/Hub/types/HubTypes.d.ts +28 -0
- package/lib/Hub/types/HubTypes.js +4 -0
- package/lib/Hub/types/index.d.ts +2 -0
- package/lib/Hub/types/index.js +20 -0
- package/lib/I18n/I18n.js +1 -1
- package/lib/I18n/index.js +5 -5
- package/lib/OAuthHelper/FacebookOAuth.js +1 -1
- package/lib/OAuthHelper/GoogleOAuth.js +1 -1
- package/lib/Platform/version.d.ts +1 -1
- package/lib/Platform/version.js +1 -1
- package/lib/RNComponents/index.d.ts +1 -0
- package/lib/RNComponents/index.js +2 -1
- package/lib/RNComponents/isAppInForeground.d.ts +1 -0
- package/lib/RNComponents/isAppInForeground.js +10 -0
- package/lib/ServiceWorker/ServiceWorker.js +9 -9
- package/lib/StorageHelper/localStorage.js +1 -1
- package/lib/StorageHelper/sessionStorage.js +1 -1
- package/lib/UniversalStorage/index.js +1 -1
- package/lib/Util/Constants.d.ts +12 -8
- package/lib/Util/Constants.js +21 -15
- package/lib/{Errors.d.ts → Util/Errors.d.ts} +1 -1
- package/lib/Util/Reachability.js +1 -1
- package/lib/Util/errors/AssertError.js +1 -1
- package/lib/Util/index.d.ts +1 -1
- package/lib/Util/index.js +1 -5
- package/lib/adapterCore/error/AmplifyServerContextError.d.ts +8 -0
- package/lib/adapterCore/error/AmplifyServerContextError.js +35 -0
- package/lib/adapterCore/error/index.d.ts +1 -0
- package/lib/adapterCore/error/index.js +7 -0
- package/lib/adapterCore/index.d.ts +2 -0
- package/lib/adapterCore/index.js +11 -0
- package/lib/adapterCore/serverContext/index.d.ts +2 -0
- package/lib/adapterCore/serverContext/index.js +9 -0
- package/lib/adapterCore/serverContext/serverContext.d.ts +20 -0
- package/lib/adapterCore/serverContext/serverContext.js +42 -0
- package/lib/adapterCore/serverContext/serverContextRegistry.d.ts +6 -0
- package/lib/adapterCore/serverContext/serverContextRegistry.js +24 -0
- package/lib/adapterCore/serverContext/types/amplifyServer.d.ts +16 -0
- package/lib/adapterCore/serverContext/types/amplifyServer.js +4 -0
- package/lib/adapterCore/serverContext/types/cookieStorage.d.ts +31 -0
- package/lib/adapterCore/serverContext/types/cookieStorage.js +4 -0
- package/lib/adapterCore/serverContext/types/index.d.ts +4 -0
- package/lib/adapterCore/serverContext/types/index.js +4 -0
- package/lib/clients/handlers/fetch.js +1 -0
- package/lib/clients/internal/composeServiceApi.d.ts +5 -2
- package/lib/index.d.ts +11 -32
- package/lib/index.js +19 -100
- package/lib/libraryUtils.d.ts +21 -0
- package/lib/libraryUtils.js +105 -0
- package/lib/providers/pinpoint/apis/index.d.ts +2 -0
- package/lib/providers/pinpoint/apis/index.js +9 -0
- package/lib/providers/pinpoint/apis/record.d.ts +5 -0
- package/lib/providers/pinpoint/apis/record.js +120 -0
- package/lib/providers/pinpoint/apis/updateEndpoint.d.ts +5 -0
- package/lib/providers/pinpoint/apis/updateEndpoint.js +120 -0
- package/lib/providers/pinpoint/index.d.ts +2 -0
- package/lib/providers/pinpoint/index.js +19 -0
- package/lib/providers/pinpoint/types/buffer.d.ts +25 -0
- package/lib/providers/pinpoint/types/buffer.js +4 -0
- package/lib/providers/pinpoint/types/index.d.ts +1 -0
- package/lib/providers/pinpoint/types/index.js +19 -0
- package/lib/providers/pinpoint/types/pinpoint.d.ts +40 -0
- package/lib/providers/pinpoint/types/pinpoint.js +4 -0
- package/lib/providers/pinpoint/utils/PinpointEventBuffer.d.ts +23 -0
- package/lib/providers/pinpoint/utils/PinpointEventBuffer.js +278 -0
- package/lib/providers/pinpoint/utils/cacheEndpointId.d.ts +7 -0
- package/lib/providers/pinpoint/utils/cacheEndpointId.js +61 -0
- package/lib/providers/pinpoint/utils/constants.d.ts +4 -0
- package/lib/providers/pinpoint/utils/constants.js +10 -0
- package/lib/providers/pinpoint/utils/getCacheKey.d.ts +7 -0
- package/lib/providers/pinpoint/utils/getCacheKey.js +13 -0
- package/lib/providers/pinpoint/utils/getEndpointId.d.ts +7 -0
- package/lib/providers/pinpoint/utils/getEndpointId.js +62 -0
- package/lib/providers/pinpoint/utils/getEventBuffer.d.ts +8 -0
- package/lib/providers/pinpoint/utils/getEventBuffer.js +48 -0
- package/lib/providers/pinpoint/utils/index.d.ts +3 -0
- package/lib/providers/pinpoint/utils/index.js +11 -0
- package/lib/server.d.ts +1 -0
- package/lib/server.js +7 -0
- package/lib/singleton/Amplify.d.ts +36 -0
- package/lib/singleton/Amplify.js +138 -0
- package/lib/singleton/Analytics/types.d.ts +2 -0
- package/lib/singleton/Analytics/types.js +4 -0
- package/lib/singleton/Auth/index.js +15 -12
- package/lib/singleton/Auth/types.d.ts +28 -3
- package/lib/singleton/Auth/utils/index.d.ts +3 -2
- package/lib/singleton/Auth/utils/index.js +15 -1
- package/lib/singleton/Storage/types.d.ts +6 -2
- package/lib/singleton/apis/fetchAuthSession.d.ts +2 -0
- package/lib/singleton/apis/fetchAuthSession.js +11 -0
- package/lib/singleton/apis/internal/fetchAuthSession.d.ts +3 -0
- package/lib/singleton/apis/internal/fetchAuthSession.js +9 -0
- package/lib/singleton/apis/server/fetchAuthSession.d.ts +3 -0
- package/lib/singleton/apis/server/fetchAuthSession.js +11 -0
- package/lib/singleton/index.d.ts +2 -46
- package/lib/singleton/index.js +7 -144
- package/lib/singleton/types.d.ts +3 -1
- package/lib/tsconfig.tsbuildinfo +1 -1
- package/lib/types/core.d.ts +47 -0
- package/lib/types/core.js +4 -0
- package/lib/types/errors.d.ts +16 -0
- package/lib/types/errors.js +4 -0
- package/lib/types/index.d.ts +4 -1
- package/lib/types/index.js +6 -3
- package/lib/types/logging.d.ts +13 -0
- package/lib/types/logging.js +4 -0
- package/lib/types/storage.d.ts +14 -0
- package/lib/types/storage.js +4 -0
- package/lib-esm/AwsClients/CognitoIdentity/getCredentialsForIdentity.d.ts +1 -1
- package/lib-esm/AwsClients/CognitoIdentity/getId.d.ts +1 -1
- package/lib-esm/AwsClients/Pinpoint/getInAppMessages.d.ts +1 -1
- package/lib-esm/AwsClients/Pinpoint/index.d.ts +1 -1
- package/lib-esm/AwsClients/Pinpoint/putEvents.d.ts +1 -1
- package/lib-esm/AwsClients/Pinpoint/putEvents.js +1 -1
- package/lib-esm/AwsClients/Pinpoint/updateEndpoint.d.ts +1 -1
- package/lib-esm/Cache/AsyncStorageCache.js +1 -1
- package/lib-esm/Cache/BrowserStorageCache.js +1 -1
- package/lib-esm/Cache/InMemoryCache.js +1 -1
- package/lib-esm/Cache/StorageCache.js +2 -2
- package/lib-esm/Cache/Utils/CacheList.js +1 -1
- package/lib-esm/Credentials.js +2 -5
- package/lib-esm/{Hub.d.ts → Hub/index.d.ts} +5 -21
- package/lib-esm/Hub/index.js +148 -0
- package/lib-esm/Hub/types/AuthTypes.d.ts +11 -0
- package/lib-esm/Hub/types/HubTypes.d.ts +28 -0
- package/lib-esm/Hub/types/HubTypes.js +3 -0
- package/lib-esm/Hub/types/index.d.ts +2 -0
- package/lib-esm/Hub/types/index.js +4 -0
- package/lib-esm/I18n/I18n.js +2 -2
- package/lib-esm/I18n/index.js +1 -1
- package/lib-esm/OAuthHelper/FacebookOAuth.js +1 -1
- package/lib-esm/OAuthHelper/GoogleOAuth.js +1 -1
- package/lib-esm/Platform/version.d.ts +1 -1
- package/lib-esm/Platform/version.js +1 -1
- package/lib-esm/RNComponents/index.d.ts +1 -0
- package/lib-esm/RNComponents/index.js +2 -1
- package/lib-esm/RNComponents/isAppInForeground.d.ts +1 -0
- package/lib-esm/RNComponents/isAppInForeground.js +6 -0
- package/lib-esm/ServiceWorker/ServiceWorker.js +3 -3
- package/lib-esm/StorageHelper/localStorage.js +1 -1
- package/lib-esm/StorageHelper/sessionStorage.js +1 -1
- package/lib-esm/UniversalStorage/index.js +1 -1
- package/lib-esm/Util/Constants.d.ts +12 -8
- package/lib-esm/Util/Constants.js +20 -8
- package/lib-esm/{Errors.d.ts → Util/Errors.d.ts} +1 -1
- package/lib-esm/Util/Reachability.js +1 -1
- package/lib-esm/Util/errors/AssertError.js +1 -1
- package/lib-esm/Util/index.d.ts +1 -1
- package/lib-esm/Util/index.js +1 -1
- package/lib-esm/adapterCore/error/AmplifyServerContextError.d.ts +8 -0
- package/lib-esm/adapterCore/error/AmplifyServerContextError.js +32 -0
- package/lib-esm/adapterCore/error/index.d.ts +1 -0
- package/lib-esm/adapterCore/error/index.js +3 -0
- package/lib-esm/adapterCore/index.d.ts +2 -0
- package/lib-esm/adapterCore/index.js +4 -0
- package/lib-esm/adapterCore/serverContext/index.d.ts +2 -0
- package/lib-esm/adapterCore/serverContext/index.js +3 -0
- package/lib-esm/adapterCore/serverContext/serverContext.d.ts +20 -0
- package/lib-esm/adapterCore/serverContext/serverContext.js +36 -0
- package/lib-esm/adapterCore/serverContext/serverContextRegistry.d.ts +6 -0
- package/lib-esm/adapterCore/serverContext/serverContextRegistry.js +21 -0
- package/lib-esm/adapterCore/serverContext/types/amplifyServer.d.ts +16 -0
- package/lib-esm/adapterCore/serverContext/types/amplifyServer.js +3 -0
- package/lib-esm/adapterCore/serverContext/types/cookieStorage.d.ts +31 -0
- package/lib-esm/adapterCore/serverContext/types/cookieStorage.js +3 -0
- package/lib-esm/adapterCore/serverContext/types/index.d.ts +4 -0
- package/lib-esm/adapterCore/serverContext/types/index.js +3 -0
- package/lib-esm/clients/handlers/fetch.js +1 -0
- package/lib-esm/clients/internal/composeServiceApi.d.ts +5 -2
- package/lib-esm/index.d.ts +11 -32
- package/lib-esm/index.js +11 -29
- package/lib-esm/libraryUtils.d.ts +21 -0
- package/lib-esm/libraryUtils.js +33 -0
- package/lib-esm/providers/pinpoint/apis/index.d.ts +2 -0
- package/lib-esm/providers/pinpoint/apis/index.js +4 -0
- package/lib-esm/providers/pinpoint/apis/record.d.ts +5 -0
- package/lib-esm/providers/pinpoint/apis/record.js +116 -0
- package/lib-esm/providers/pinpoint/apis/updateEndpoint.d.ts +5 -0
- package/lib-esm/providers/pinpoint/apis/updateEndpoint.js +116 -0
- package/lib-esm/providers/pinpoint/index.d.ts +2 -0
- package/lib-esm/providers/pinpoint/index.js +3 -0
- package/lib-esm/providers/pinpoint/types/buffer.d.ts +25 -0
- package/lib-esm/providers/pinpoint/types/buffer.js +3 -0
- package/lib-esm/providers/pinpoint/types/index.d.ts +1 -0
- package/lib-esm/providers/pinpoint/types/index.js +3 -0
- package/lib-esm/providers/pinpoint/types/pinpoint.d.ts +40 -0
- package/lib-esm/providers/pinpoint/types/pinpoint.js +3 -0
- package/lib-esm/providers/pinpoint/utils/PinpointEventBuffer.d.ts +23 -0
- package/lib-esm/providers/pinpoint/utils/PinpointEventBuffer.js +275 -0
- package/lib-esm/providers/pinpoint/utils/cacheEndpointId.d.ts +7 -0
- package/lib-esm/providers/pinpoint/utils/cacheEndpointId.js +57 -0
- package/lib-esm/providers/pinpoint/utils/constants.d.ts +4 -0
- package/lib-esm/providers/pinpoint/utils/constants.js +7 -0
- package/lib-esm/providers/pinpoint/utils/getCacheKey.d.ts +7 -0
- package/lib-esm/providers/pinpoint/utils/getCacheKey.js +9 -0
- package/lib-esm/providers/pinpoint/utils/getEndpointId.d.ts +7 -0
- package/lib-esm/providers/pinpoint/utils/getEndpointId.js +58 -0
- package/lib-esm/providers/pinpoint/utils/getEventBuffer.d.ts +8 -0
- package/lib-esm/providers/pinpoint/utils/getEventBuffer.js +44 -0
- package/lib-esm/providers/pinpoint/utils/index.d.ts +3 -0
- package/lib-esm/providers/pinpoint/utils/index.js +5 -0
- package/lib-esm/server.d.ts +1 -0
- package/lib-esm/server.js +3 -0
- package/lib-esm/singleton/Amplify.d.ts +36 -0
- package/lib-esm/singleton/Amplify.js +135 -0
- package/lib-esm/singleton/Analytics/types.d.ts +2 -0
- package/lib-esm/singleton/Analytics/types.js +3 -0
- package/lib-esm/singleton/Auth/index.js +14 -11
- package/lib-esm/singleton/Auth/types.d.ts +28 -3
- package/lib-esm/singleton/Auth/utils/index.d.ts +3 -2
- package/lib-esm/singleton/Auth/utils/index.js +13 -0
- package/lib-esm/singleton/Storage/types.d.ts +6 -2
- package/lib-esm/singleton/apis/fetchAuthSession.d.ts +2 -0
- package/lib-esm/singleton/apis/fetchAuthSession.js +7 -0
- package/lib-esm/singleton/apis/internal/fetchAuthSession.d.ts +3 -0
- package/lib-esm/singleton/apis/internal/fetchAuthSession.js +5 -0
- package/lib-esm/singleton/apis/server/fetchAuthSession.d.ts +3 -0
- package/lib-esm/singleton/apis/server/fetchAuthSession.js +7 -0
- package/lib-esm/singleton/index.d.ts +2 -46
- package/lib-esm/singleton/index.js +2 -141
- package/lib-esm/singleton/types.d.ts +3 -1
- package/lib-esm/tsconfig.tsbuildinfo +1 -1
- package/lib-esm/types/core.d.ts +47 -0
- package/lib-esm/types/core.js +3 -0
- package/lib-esm/types/errors.d.ts +16 -0
- package/lib-esm/types/errors.js +3 -0
- package/lib-esm/types/index.d.ts +4 -1
- package/lib-esm/types/index.js +4 -1
- package/lib-esm/types/logging.d.ts +13 -0
- package/lib-esm/types/logging.js +3 -0
- package/lib-esm/types/storage.d.ts +14 -0
- package/lib-esm/types/storage.js +3 -0
- package/package.json +15 -12
- package/server/package.json +8 -0
- package/src/AwsClients/Pinpoint/index.ts +1 -1
- package/src/AwsClients/Pinpoint/putEvents.ts +1 -1
- package/src/Cache/AsyncStorageCache.ts +1 -1
- package/src/Cache/BrowserStorageCache.ts +1 -1
- package/src/Cache/InMemoryCache.ts +1 -1
- package/src/Cache/StorageCache.ts +2 -2
- package/src/Cache/Utils/CacheList.ts +1 -1
- package/src/Credentials.ts +2 -8
- package/src/Hub/index.ts +204 -0
- package/src/Hub/types/AuthTypes.ts +10 -0
- package/src/Hub/types/HubTypes.ts +46 -0
- package/src/{Providers → Hub/types}/index.ts +3 -1
- package/src/I18n/I18n.ts +2 -2
- package/src/I18n/index.ts +1 -1
- package/src/Logger/ConsoleLogger.ts +1 -2
- package/src/OAuthHelper/FacebookOAuth.ts +1 -1
- package/src/OAuthHelper/GoogleOAuth.ts +1 -1
- package/src/Platform/version.ts +1 -1
- package/src/RNComponents/index.ts +2 -1
- package/src/RNComponents/isAppInForeground.ts +8 -0
- package/src/ServiceWorker/ServiceWorker.ts +3 -3
- package/src/StorageHelper/localStorage.ts +1 -1
- package/src/StorageHelper/sessionStorage.ts +1 -1
- package/src/UniversalStorage/index.ts +1 -1
- package/src/Util/Constants.ts +25 -16
- package/src/{Errors.ts → Util/Errors.ts} +1 -1
- package/src/Util/Reachability.ts +1 -1
- package/src/Util/errors/AssertError.ts +1 -1
- package/src/Util/index.ts +0 -4
- package/src/adapterCore/error/AmplifyServerContextError.ts +23 -0
- package/src/adapterCore/error/index.ts +4 -0
- package/src/adapterCore/index.ts +11 -0
- package/src/adapterCore/serverContext/index.ts +10 -0
- package/src/adapterCore/serverContext/serverContext.ts +54 -0
- package/src/adapterCore/serverContext/serverContextRegistry.ts +31 -0
- package/src/adapterCore/serverContext/types/amplifyServer.ts +29 -0
- package/src/adapterCore/serverContext/types/cookieStorage.ts +43 -0
- package/src/adapterCore/serverContext/types/index.ts +9 -0
- package/src/clients/handlers/fetch.ts +1 -0
- package/src/clients/internal/composeServiceApi.ts +13 -4
- package/src/index.ts +40 -120
- package/src/libraryUtils.ts +102 -0
- package/src/providers/pinpoint/apis/index.ts +5 -0
- package/src/providers/pinpoint/apis/record.ts +90 -0
- package/src/providers/pinpoint/apis/updateEndpoint.ts +82 -0
- package/src/providers/pinpoint/index.ts +5 -0
- package/src/providers/pinpoint/types/buffer.ts +32 -0
- package/{lib-esm/Providers/index.js → src/providers/pinpoint/types/index.ts} +2 -1
- package/src/providers/pinpoint/types/pinpoint.ts +55 -0
- package/src/providers/pinpoint/utils/PinpointEventBuffer.ts +248 -0
- package/src/providers/pinpoint/utils/cacheEndpointId.ts +27 -0
- package/src/providers/pinpoint/utils/constants.ts +8 -0
- package/src/providers/pinpoint/utils/getCacheKey.ts +16 -0
- package/src/providers/pinpoint/utils/getEndpointId.ts +20 -0
- package/src/providers/pinpoint/utils/getEventBuffer.ts +60 -0
- package/src/providers/pinpoint/utils/index.ts +6 -0
- package/src/server.ts +4 -0
- package/src/singleton/Amplify.ts +121 -0
- package/src/singleton/Analytics/types.ts +6 -0
- package/src/singleton/Auth/index.ts +7 -5
- package/src/singleton/Auth/types.ts +38 -6
- package/src/singleton/Auth/utils/index.ts +27 -1
- package/src/singleton/Storage/types.ts +6 -3
- package/src/singleton/apis/fetchAuthSession.ts +12 -0
- package/src/singleton/apis/internal/fetchAuthSession.ts +12 -0
- package/src/singleton/apis/server/fetchAuthSession.ts +16 -0
- package/src/singleton/index.ts +2 -128
- package/src/singleton/types.ts +4 -4
- package/src/types/core.ts +58 -0
- package/src/types/errors.ts +21 -0
- package/src/types/index.ts +5 -1
- package/src/types/logging.ts +24 -0
- package/src/types/storage.ts +19 -0
- package/lib/Hub.js +0 -220
- package/lib/Providers/AWSCloudWatchProvider.d.ts +0 -34
- package/lib/Providers/AWSCloudWatchProvider.js +0 -619
- package/lib/Providers/index.d.ts +0 -1
- package/lib/Providers/index.js +0 -7
- package/lib/constants.d.ts +0 -9
- package/lib/constants.js +0 -22
- package/lib/types/types.d.ts +0 -76
- package/lib-esm/Hub.js +0 -217
- package/lib-esm/Providers/AWSCloudWatchProvider.d.ts +0 -34
- package/lib-esm/Providers/AWSCloudWatchProvider.js +0 -616
- package/lib-esm/Providers/index.d.ts +0 -1
- package/lib-esm/constants.d.ts +0 -9
- package/lib-esm/constants.js +0 -19
- package/lib-esm/types/types.d.ts +0 -76
- package/src/Hub.ts +0 -236
- package/src/Providers/AWSCloudWatchProvider.ts +0 -540
- package/src/constants.ts +0 -31
- package/src/types/types.ts +0 -104
- /package/lib/{types/types.js → Hub/types/AuthTypes.js} +0 -0
- /package/lib/{Errors.js → Util/Errors.js} +0 -0
- /package/lib/{JS.d.ts → Util/JS.d.ts} +0 -0
- /package/lib/{JS.js → Util/JS.js} +0 -0
- /package/lib-esm/{types/types.js → Hub/types/AuthTypes.js} +0 -0
- /package/lib-esm/{Errors.js → Util/Errors.js} +0 -0
- /package/lib-esm/{JS.d.ts → Util/JS.d.ts} +0 -0
- /package/lib-esm/{JS.js → Util/JS.js} +0 -0
- /package/src/{JS.ts → Util/JS.ts} +0 -0
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { AuthClass } from './Auth';
|
|
2
|
+
import { LibraryOptions, ResourcesConfig } from './types';
|
|
3
|
+
export declare class AmplifyClass {
|
|
4
|
+
resourcesConfig: ResourcesConfig;
|
|
5
|
+
libraryOptions: LibraryOptions;
|
|
6
|
+
/**
|
|
7
|
+
* Cross-category Auth utilities.
|
|
8
|
+
*
|
|
9
|
+
* @internal
|
|
10
|
+
*/
|
|
11
|
+
readonly Auth: AuthClass;
|
|
12
|
+
constructor();
|
|
13
|
+
/**
|
|
14
|
+
* Configures Amplify for use with your back-end resources.
|
|
15
|
+
*
|
|
16
|
+
* @remarks
|
|
17
|
+
* `configure` can be used to specify additional library options where available for supported categories.
|
|
18
|
+
*
|
|
19
|
+
* @param resourceConfig - Back-end resource configuration. Typically provided via the `aws-exports.js` file.
|
|
20
|
+
* @param libraryOptions - Additional options for customizing the behavior of the library.
|
|
21
|
+
*/
|
|
22
|
+
configure(resourcesConfig: ResourcesConfig, libraryOptions?: LibraryOptions): void;
|
|
23
|
+
/**
|
|
24
|
+
* Provides access to the current back-end resource configuration for the Library.
|
|
25
|
+
*
|
|
26
|
+
* @returns Returns the current back-end resource configuration.
|
|
27
|
+
*/
|
|
28
|
+
getConfig(): ResourcesConfig;
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* The `Amplify` utility is used to configure the library.
|
|
32
|
+
*
|
|
33
|
+
* @remarks
|
|
34
|
+
* `Amplify` is responsible for orchestrating cross-category communication within the library.
|
|
35
|
+
*/
|
|
36
|
+
export declare const Amplify: AmplifyClass;
|
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __assign = (this && this.__assign) || function () {
|
|
3
|
+
__assign = Object.assign || function(t) {
|
|
4
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
5
|
+
s = arguments[i];
|
|
6
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
7
|
+
t[p] = s[p];
|
|
8
|
+
}
|
|
9
|
+
return t;
|
|
10
|
+
};
|
|
11
|
+
return __assign.apply(this, arguments);
|
|
12
|
+
};
|
|
13
|
+
var __values = (this && this.__values) || function(o) {
|
|
14
|
+
var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
|
|
15
|
+
if (m) return m.call(o);
|
|
16
|
+
if (o && typeof o.length === "number") return {
|
|
17
|
+
next: function () {
|
|
18
|
+
if (o && i >= o.length) o = void 0;
|
|
19
|
+
return { value: o && o[i++], done: !o };
|
|
20
|
+
}
|
|
21
|
+
};
|
|
22
|
+
throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
|
|
23
|
+
};
|
|
24
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
25
|
+
exports.Amplify = exports.AmplifyClass = void 0;
|
|
26
|
+
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
27
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
28
|
+
var Auth_1 = require("./Auth");
|
|
29
|
+
var Hub_1 = require("../Hub");
|
|
30
|
+
// TODO(v6): add default AuthTokenStore for each platform
|
|
31
|
+
var AmplifyClass = /** @class */ (function () {
|
|
32
|
+
function AmplifyClass() {
|
|
33
|
+
this.resourcesConfig = {};
|
|
34
|
+
this.Auth = new Auth_1.AuthClass();
|
|
35
|
+
// TODO(v6): add default providers for getting started
|
|
36
|
+
this.libraryOptions = {};
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* Configures Amplify for use with your back-end resources.
|
|
40
|
+
*
|
|
41
|
+
* @remarks
|
|
42
|
+
* `configure` can be used to specify additional library options where available for supported categories.
|
|
43
|
+
*
|
|
44
|
+
* @param resourceConfig - Back-end resource configuration. Typically provided via the `aws-exports.js` file.
|
|
45
|
+
* @param libraryOptions - Additional options for customizing the behavior of the library.
|
|
46
|
+
*/
|
|
47
|
+
AmplifyClass.prototype.configure = function (resourcesConfig, libraryOptions) {
|
|
48
|
+
if (libraryOptions === void 0) { libraryOptions = {}; }
|
|
49
|
+
this.resourcesConfig = mergeResourceConfig(this.resourcesConfig, resourcesConfig);
|
|
50
|
+
this.libraryOptions = mergeLibraryOptions(this.libraryOptions, libraryOptions);
|
|
51
|
+
this.Auth.configure(this.resourcesConfig.Auth, this.libraryOptions.Auth);
|
|
52
|
+
Hub_1.Hub.dispatch('core', {
|
|
53
|
+
event: 'configure',
|
|
54
|
+
data: resourcesConfig,
|
|
55
|
+
}, 'Configure', Hub_1.AMPLIFY_SYMBOL);
|
|
56
|
+
};
|
|
57
|
+
/**
|
|
58
|
+
* Provides access to the current back-end resource configuration for the Library.
|
|
59
|
+
*
|
|
60
|
+
* @returns Returns the current back-end resource configuration.
|
|
61
|
+
*/
|
|
62
|
+
AmplifyClass.prototype.getConfig = function () {
|
|
63
|
+
return JSON.parse(JSON.stringify(this.resourcesConfig));
|
|
64
|
+
};
|
|
65
|
+
return AmplifyClass;
|
|
66
|
+
}());
|
|
67
|
+
exports.AmplifyClass = AmplifyClass;
|
|
68
|
+
/**
|
|
69
|
+
* The `Amplify` utility is used to configure the library.
|
|
70
|
+
*
|
|
71
|
+
* @remarks
|
|
72
|
+
* `Amplify` is responsible for orchestrating cross-category communication within the library.
|
|
73
|
+
*/
|
|
74
|
+
exports.Amplify = new AmplifyClass();
|
|
75
|
+
// TODO(v6): validate until which level this will nested, during Amplify.configure API review.
|
|
76
|
+
function mergeResourceConfig(existingConfig, newConfig) {
|
|
77
|
+
var e_1, _a, e_2, _b;
|
|
78
|
+
var resultConfig = {};
|
|
79
|
+
try {
|
|
80
|
+
for (var _c = __values(Object.keys(existingConfig)), _d = _c.next(); !_d.done; _d = _c.next()) {
|
|
81
|
+
var category = _d.value;
|
|
82
|
+
resultConfig[category] = existingConfig[category];
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
86
|
+
finally {
|
|
87
|
+
try {
|
|
88
|
+
if (_d && !_d.done && (_a = _c.return)) _a.call(_c);
|
|
89
|
+
}
|
|
90
|
+
finally { if (e_1) throw e_1.error; }
|
|
91
|
+
}
|
|
92
|
+
try {
|
|
93
|
+
for (var _e = __values(Object.keys(newConfig).filter(function (key) { return key !== 'ssr'; })), _f = _e.next(); !_f.done; _f = _e.next()) {
|
|
94
|
+
var key = _f.value;
|
|
95
|
+
resultConfig[key] = __assign(__assign({}, resultConfig[key]), newConfig[key]);
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
catch (e_2_1) { e_2 = { error: e_2_1 }; }
|
|
99
|
+
finally {
|
|
100
|
+
try {
|
|
101
|
+
if (_f && !_f.done && (_b = _e.return)) _b.call(_e);
|
|
102
|
+
}
|
|
103
|
+
finally { if (e_2) throw e_2.error; }
|
|
104
|
+
}
|
|
105
|
+
resultConfig.ssr = newConfig.ssr;
|
|
106
|
+
return resultConfig;
|
|
107
|
+
}
|
|
108
|
+
function mergeLibraryOptions(existingConfig, newConfig) {
|
|
109
|
+
var e_3, _a, e_4, _b;
|
|
110
|
+
var resultConfig = {};
|
|
111
|
+
try {
|
|
112
|
+
for (var _c = __values(Object.keys(existingConfig)), _d = _c.next(); !_d.done; _d = _c.next()) {
|
|
113
|
+
var category = _d.value;
|
|
114
|
+
resultConfig[category] = existingConfig[category];
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
catch (e_3_1) { e_3 = { error: e_3_1 }; }
|
|
118
|
+
finally {
|
|
119
|
+
try {
|
|
120
|
+
if (_d && !_d.done && (_a = _c.return)) _a.call(_c);
|
|
121
|
+
}
|
|
122
|
+
finally { if (e_3) throw e_3.error; }
|
|
123
|
+
}
|
|
124
|
+
try {
|
|
125
|
+
for (var _e = __values(Object.keys(newConfig)), _f = _e.next(); !_f.done; _f = _e.next()) {
|
|
126
|
+
var category = _f.value;
|
|
127
|
+
resultConfig[category] = __assign(__assign({}, resultConfig[category]), newConfig[category]);
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
catch (e_4_1) { e_4 = { error: e_4_1 }; }
|
|
131
|
+
finally {
|
|
132
|
+
try {
|
|
133
|
+
if (_f && !_f.done && (_b = _e.return)) _b.call(_e);
|
|
134
|
+
}
|
|
135
|
+
finally { if (e_4) throw e_4.error; }
|
|
136
|
+
}
|
|
137
|
+
return resultConfig;
|
|
138
|
+
}
|
|
@@ -41,7 +41,7 @@ exports.AuthClass = exports.isTokenExpired = void 0;
|
|
|
41
41
|
// SPDX-License-Identifier: Apache-2.0
|
|
42
42
|
var rxjs_1 = require("rxjs");
|
|
43
43
|
var AssertError_1 = require("../../Util/errors/AssertError");
|
|
44
|
-
var
|
|
44
|
+
var Constants_1 = require("../../Util/Constants");
|
|
45
45
|
function isTokenExpired(_a) {
|
|
46
46
|
var expiresAt = _a.expiresAt, clockDrift = _a.clockDrift;
|
|
47
47
|
var currentTime = Date.now();
|
|
@@ -73,16 +73,17 @@ var AuthClass = /** @class */ (function () {
|
|
|
73
73
|
var tokens, credentialsAndIdentityId;
|
|
74
74
|
return __generator(this, function (_h) {
|
|
75
75
|
switch (_h.label) {
|
|
76
|
-
case 0:
|
|
77
|
-
case 1:
|
|
78
|
-
// Get tokens will throw if session cannot be refreshed (network or service error) or return null if not available
|
|
79
|
-
tokens =
|
|
80
|
-
(_c = (_h.sent())) !== null && _c !== void 0 ? _c : undefined;
|
|
76
|
+
case 0:
|
|
81
77
|
(0, AssertError_1.asserts)(!!this.authConfig, {
|
|
82
|
-
name:
|
|
78
|
+
name: Constants_1.AUTH_CONFING_EXCEPTION,
|
|
83
79
|
message: 'AuthConfig is required',
|
|
84
80
|
recoverySuggestion: 'call Amplify.configure in your app with a valid AuthConfig',
|
|
85
81
|
});
|
|
82
|
+
return [4 /*yield*/, ((_b = (_a = this.authOptions) === null || _a === void 0 ? void 0 : _a.tokenProvider) === null || _b === void 0 ? void 0 : _b.getTokens(options))];
|
|
83
|
+
case 1:
|
|
84
|
+
// Get tokens will throw if session cannot be refreshed (network or service error) or return null if not available
|
|
85
|
+
tokens =
|
|
86
|
+
(_c = (_h.sent())) !== null && _c !== void 0 ? _c : undefined;
|
|
86
87
|
if (!tokens) return [3 /*break*/, 3];
|
|
87
88
|
return [4 /*yield*/, ((_e = (_d = this.authOptions) === null || _d === void 0 ? void 0 : _d.credentialsProvider) === null || _e === void 0 ? void 0 : _e.getCredentialsAndIdentityId({
|
|
88
89
|
authConfig: this.authConfig,
|
|
@@ -95,11 +96,13 @@ var AuthClass = /** @class */ (function () {
|
|
|
95
96
|
credentialsAndIdentityId =
|
|
96
97
|
_h.sent();
|
|
97
98
|
return [3 /*break*/, 5];
|
|
98
|
-
case 3:
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
99
|
+
case 3:
|
|
100
|
+
if (!!this.authConfig.isMandatorySignInEnabled) return [3 /*break*/, 5];
|
|
101
|
+
return [4 /*yield*/, ((_g = (_f = this.authOptions) === null || _f === void 0 ? void 0 : _f.credentialsProvider) === null || _g === void 0 ? void 0 : _g.getCredentialsAndIdentityId({
|
|
102
|
+
authConfig: this.authConfig,
|
|
103
|
+
authenticated: false,
|
|
104
|
+
forceRefresh: options.forceRefresh,
|
|
105
|
+
}))];
|
|
103
106
|
case 4:
|
|
104
107
|
// getCredentialsAndIdentityId will throw if cannot get credentials (network or service error)
|
|
105
108
|
credentialsAndIdentityId =
|
|
@@ -37,7 +37,7 @@ export interface AWSCredentialsAndIdentityIdProvider {
|
|
|
37
37
|
clearCredentials: () => void;
|
|
38
38
|
}
|
|
39
39
|
export type TokenProvider = {
|
|
40
|
-
getTokens: ({ forceRefresh, }
|
|
40
|
+
getTokens: ({ forceRefresh, }?: {
|
|
41
41
|
forceRefresh?: boolean;
|
|
42
42
|
}) => Promise<AuthTokens | null>;
|
|
43
43
|
};
|
|
@@ -48,7 +48,10 @@ export type AuthTokens = {
|
|
|
48
48
|
idToken?: JWT;
|
|
49
49
|
accessToken: JWT;
|
|
50
50
|
};
|
|
51
|
-
export type AuthConfig = IdentityPoolConfig | UserPoolConfig | UserPoolConfigAndIdentityPoolConfig
|
|
51
|
+
export type AuthConfig = StrictUnion<IdentityPoolConfig | UserPoolConfig | UserPoolConfigWithOAuth | UserPoolConfigAndIdentityPoolConfig | UserPoolConfigAndIdentityPoolConfigWithOAuth>;
|
|
52
|
+
type UnionKeys<T> = T extends T ? keyof T : never;
|
|
53
|
+
type StrictUnionHelper<T, TAll> = T extends any ? T & Partial<Record<Exclude<UnionKeys<TAll>, keyof T>, never>> : never;
|
|
54
|
+
type StrictUnion<T> = StrictUnionHelper<T, T>;
|
|
52
55
|
export type IdentityPoolConfig = {
|
|
53
56
|
identityPoolId: string;
|
|
54
57
|
userPoolWebClientId?: never;
|
|
@@ -62,6 +65,20 @@ export type UserPoolConfig = {
|
|
|
62
65
|
identityPoolId?: never;
|
|
63
66
|
clientMetadata?: Record<string, string>;
|
|
64
67
|
};
|
|
68
|
+
export type UserPoolConfigWithOAuth = {
|
|
69
|
+
userPoolWebClientId: string;
|
|
70
|
+
userPoolId: string;
|
|
71
|
+
identityPoolId?: never;
|
|
72
|
+
clientMetadata?: Record<string, string>;
|
|
73
|
+
oauth: OAuthConfig;
|
|
74
|
+
};
|
|
75
|
+
export type OAuthConfig = {
|
|
76
|
+
domain: string;
|
|
77
|
+
scopes: Array<string>;
|
|
78
|
+
redirectSignIn: string;
|
|
79
|
+
redirectSignOut: string;
|
|
80
|
+
responseType: string;
|
|
81
|
+
};
|
|
65
82
|
export type UserPoolConfigAndIdentityPoolConfig = {
|
|
66
83
|
userPoolWebClientId: string;
|
|
67
84
|
userPoolId: string;
|
|
@@ -69,12 +86,20 @@ export type UserPoolConfigAndIdentityPoolConfig = {
|
|
|
69
86
|
clientMetadata?: Record<string, string>;
|
|
70
87
|
isMandatorySignInEnabled?: boolean;
|
|
71
88
|
};
|
|
89
|
+
export type UserPoolConfigAndIdentityPoolConfigWithOAuth = {
|
|
90
|
+
userPoolWebClientId: string;
|
|
91
|
+
userPoolId: string;
|
|
92
|
+
identityPoolId: string;
|
|
93
|
+
clientMetadata?: Record<string, string>;
|
|
94
|
+
isMandatorySignInEnabled?: boolean;
|
|
95
|
+
oauth: OAuthConfig;
|
|
96
|
+
};
|
|
72
97
|
export type GetCredentialsOptions = GetCredentialsAuthenticatedUser | GetCredentialsUnauthenticatedUser;
|
|
73
98
|
type GetCredentialsAuthenticatedUser = {
|
|
74
99
|
authenticated: true;
|
|
75
100
|
forceRefresh?: boolean;
|
|
76
101
|
authConfig: AuthConfig;
|
|
77
|
-
tokens
|
|
102
|
+
tokens: AuthTokens;
|
|
78
103
|
};
|
|
79
104
|
type GetCredentialsUnauthenticatedUser = {
|
|
80
105
|
authenticated: false;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import { AuthConfig, IdentityPoolConfig, JWT, UserPoolConfig, UserPoolConfigAndIdentityPoolConfig } from '../types';
|
|
2
|
-
export declare function assertTokenProviderConfig(authConfig?: AuthConfig): asserts authConfig is UserPoolConfig;
|
|
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;
|
|
3
4
|
export declare function assertIdentityPooIdConfig(authConfig: AuthConfig): asserts authConfig is IdentityPoolConfig;
|
|
4
5
|
export declare function assertUserPoolAndIdentityPooConfig(authConfig: AuthConfig): asserts authConfig is UserPoolConfigAndIdentityPoolConfig;
|
|
5
6
|
export declare function decodeJWT(token: string): JWT;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.decodeJWT = exports.assertUserPoolAndIdentityPooConfig = exports.assertIdentityPooIdConfig = exports.assertTokenProviderConfig = void 0;
|
|
3
|
+
exports.decodeJWT = exports.assertUserPoolAndIdentityPooConfig = 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 buffer_1 = require("buffer");
|
|
@@ -14,6 +14,20 @@ function assertTokenProviderConfig(authConfig) {
|
|
|
14
14
|
});
|
|
15
15
|
}
|
|
16
16
|
exports.assertTokenProviderConfig = assertTokenProviderConfig;
|
|
17
|
+
function assertOAuthConfig(authConfig) {
|
|
18
|
+
var _a, _b, _c, _d;
|
|
19
|
+
assertTokenProviderConfig(authConfig);
|
|
20
|
+
var validOAuthConfig = !!((_a = authConfig.oauth) === null || _a === void 0 ? void 0 : _a.domain) &&
|
|
21
|
+
!!((_b = authConfig.oauth) === null || _b === void 0 ? void 0 : _b.redirectSignOut) &&
|
|
22
|
+
!!((_c = authConfig.oauth) === null || _c === void 0 ? void 0 : _c.redirectSignIn) &&
|
|
23
|
+
!!((_d = authConfig.oauth) === null || _d === void 0 ? void 0 : _d.responseType);
|
|
24
|
+
return (0, AssertError_1.asserts)(validOAuthConfig, {
|
|
25
|
+
name: 'OAuthNotConfigureException',
|
|
26
|
+
message: 'oauth param not configured',
|
|
27
|
+
recoverySuggestion: 'Make sure to call Amplify.configure with oauth parameter in your app',
|
|
28
|
+
});
|
|
29
|
+
}
|
|
30
|
+
exports.assertOAuthConfig = assertOAuthConfig;
|
|
17
31
|
function assertIdentityPooIdConfig(authConfig) {
|
|
18
32
|
var validConfig = !!(authConfig === null || authConfig === void 0 ? void 0 : authConfig.identityPoolId);
|
|
19
33
|
return (0, AssertError_1.asserts)(validConfig, {
|
|
@@ -2,13 +2,17 @@ export type StorageAccessLevel = 'guest' | 'protected' | 'private';
|
|
|
2
2
|
export interface StorageConfig {
|
|
3
3
|
bucket?: string;
|
|
4
4
|
region?: string;
|
|
5
|
+
dangerouslyConnectToHttpEndpointForTesting?: string;
|
|
5
6
|
}
|
|
6
7
|
type StoragePrefixResolver = (params: {
|
|
7
8
|
accessLevel: StorageAccessLevel;
|
|
8
9
|
targetIdentityId?: string;
|
|
9
10
|
}) => Promise<string>;
|
|
10
11
|
export interface LibraryStorageOptions {
|
|
11
|
-
|
|
12
|
-
|
|
12
|
+
AWSS3: {
|
|
13
|
+
prefixResolver?: StoragePrefixResolver;
|
|
14
|
+
defaultAccessLevel?: StorageAccessLevel;
|
|
15
|
+
isObjectLockEnabled?: boolean;
|
|
16
|
+
};
|
|
13
17
|
}
|
|
14
18
|
export {};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
3
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
4
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5
|
+
exports.fetchAuthSession = void 0;
|
|
6
|
+
var fetchAuthSession_1 = require("./internal/fetchAuthSession");
|
|
7
|
+
var Amplify_1 = require("../Amplify");
|
|
8
|
+
var fetchAuthSession = function (options) {
|
|
9
|
+
return (0, fetchAuthSession_1.fetchAuthSession)(Amplify_1.Amplify, options);
|
|
10
|
+
};
|
|
11
|
+
exports.fetchAuthSession = fetchAuthSession;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
3
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
4
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5
|
+
exports.fetchAuthSession = void 0;
|
|
6
|
+
var fetchAuthSession = function (amplify, options) {
|
|
7
|
+
return amplify.Auth.fetchAuthSession(options);
|
|
8
|
+
};
|
|
9
|
+
exports.fetchAuthSession = fetchAuthSession;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
3
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
4
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5
|
+
exports.fetchAuthSession = void 0;
|
|
6
|
+
var adapterCore_1 = require("../../../adapterCore");
|
|
7
|
+
var fetchAuthSession_1 = require("../internal/fetchAuthSession");
|
|
8
|
+
var fetchAuthSession = function (contextSpec, options) {
|
|
9
|
+
return (0, fetchAuthSession_1.fetchAuthSession)((0, adapterCore_1.getAmplifyServerContext)(contextSpec).amplify, options);
|
|
10
|
+
};
|
|
11
|
+
exports.fetchAuthSession = fetchAuthSession;
|
package/lib/singleton/index.d.ts
CHANGED
|
@@ -1,46 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
import { FetchAuthSessionOptions } from './Auth/types';
|
|
4
|
-
declare class AmplifyClass {
|
|
5
|
-
resourcesConfig: ResourcesConfig;
|
|
6
|
-
libraryOptions: LibraryOptions;
|
|
7
|
-
/**
|
|
8
|
-
* Cross-category Auth utilities.
|
|
9
|
-
*
|
|
10
|
-
* @internal
|
|
11
|
-
*/
|
|
12
|
-
readonly Auth: AuthClass;
|
|
13
|
-
constructor();
|
|
14
|
-
/**
|
|
15
|
-
* Configures Amplify for use with your back-end resources.
|
|
16
|
-
*
|
|
17
|
-
* @remarks
|
|
18
|
-
* `configure` can be used to specify additional library options where available for supported categories.
|
|
19
|
-
*
|
|
20
|
-
* @param resourceConfig - Back-end resource configuration. Typically provided via the `aws-exports.js` file.
|
|
21
|
-
* @param libraryOptions - Additional options for customizing the behavior of the library.
|
|
22
|
-
*/
|
|
23
|
-
configure(resourcesConfig: ResourcesConfig, libraryOptions?: LibraryOptions): void;
|
|
24
|
-
/**
|
|
25
|
-
* Provides access to the current back-end resource configuration for the Library.
|
|
26
|
-
*
|
|
27
|
-
* @returns Returns the current back-end resource configuration.
|
|
28
|
-
*/
|
|
29
|
-
getConfig(): ResourcesConfig;
|
|
30
|
-
}
|
|
31
|
-
/**
|
|
32
|
-
* The `Amplify` utility is used to configure the library.
|
|
33
|
-
*
|
|
34
|
-
* @remarks
|
|
35
|
-
* `Amplify` is responsible for orchestrating cross-category communication within the library.
|
|
36
|
-
*/
|
|
37
|
-
export declare const AmplifyV6: AmplifyClass;
|
|
38
|
-
/**
|
|
39
|
-
* Returns current session tokens and credentials
|
|
40
|
-
*
|
|
41
|
-
* @param options{FetchAuthSessionOptions} - Options for fetching session.
|
|
42
|
-
*
|
|
43
|
-
* @returns Returns a promise that will resolve with fresh authentication tokens.
|
|
44
|
-
*/
|
|
45
|
-
export declare const fetchAuthSession: (options: FetchAuthSessionOptions) => Promise<import("./Auth/types").AuthSession>;
|
|
46
|
-
export {};
|
|
1
|
+
export { AmplifyClass, Amplify } from './Amplify';
|
|
2
|
+
export { fetchAuthSession } from './apis/fetchAuthSession';
|
package/lib/singleton/index.js
CHANGED
|
@@ -1,147 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __assign = (this && this.__assign) || function () {
|
|
3
|
-
__assign = Object.assign || function(t) {
|
|
4
|
-
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
5
|
-
s = arguments[i];
|
|
6
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
7
|
-
t[p] = s[p];
|
|
8
|
-
}
|
|
9
|
-
return t;
|
|
10
|
-
};
|
|
11
|
-
return __assign.apply(this, arguments);
|
|
12
|
-
};
|
|
13
|
-
var __values = (this && this.__values) || function(o) {
|
|
14
|
-
var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
|
|
15
|
-
if (m) return m.call(o);
|
|
16
|
-
if (o && typeof o.length === "number") return {
|
|
17
|
-
next: function () {
|
|
18
|
-
if (o && i >= o.length) o = void 0;
|
|
19
|
-
return { value: o && o[i++], done: !o };
|
|
20
|
-
}
|
|
21
|
-
};
|
|
22
|
-
throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
|
|
23
|
-
};
|
|
24
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
25
|
-
exports.fetchAuthSession = exports.AmplifyV6 = void 0;
|
|
26
2
|
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
27
3
|
// SPDX-License-Identifier: Apache-2.0
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
// TODO(v6): add default providers for getting started
|
|
36
|
-
this.libraryOptions = {};
|
|
37
|
-
}
|
|
38
|
-
/**
|
|
39
|
-
* Configures Amplify for use with your back-end resources.
|
|
40
|
-
*
|
|
41
|
-
* @remarks
|
|
42
|
-
* `configure` can be used to specify additional library options where available for supported categories.
|
|
43
|
-
*
|
|
44
|
-
* @param resourceConfig - Back-end resource configuration. Typically provided via the `aws-exports.js` file.
|
|
45
|
-
* @param libraryOptions - Additional options for customizing the behavior of the library.
|
|
46
|
-
*/
|
|
47
|
-
AmplifyClass.prototype.configure = function (resourcesConfig, libraryOptions) {
|
|
48
|
-
if (libraryOptions === void 0) { libraryOptions = {}; }
|
|
49
|
-
this.resourcesConfig = mergeResourceConfig(this.resourcesConfig, resourcesConfig);
|
|
50
|
-
this.libraryOptions = mergeLibraryOptions(this.libraryOptions, libraryOptions);
|
|
51
|
-
this.Auth.configure(this.resourcesConfig.Auth, this.libraryOptions.Auth);
|
|
52
|
-
Hub_1.Hub.dispatch('core', {
|
|
53
|
-
event: 'configure',
|
|
54
|
-
data: resourcesConfig,
|
|
55
|
-
}, 'Configure');
|
|
56
|
-
};
|
|
57
|
-
/**
|
|
58
|
-
* Provides access to the current back-end resource configuration for the Library.
|
|
59
|
-
*
|
|
60
|
-
* @returns Returns the current back-end resource configuration.
|
|
61
|
-
*/
|
|
62
|
-
AmplifyClass.prototype.getConfig = function () {
|
|
63
|
-
return JSON.parse(JSON.stringify(this.resourcesConfig));
|
|
64
|
-
};
|
|
65
|
-
return AmplifyClass;
|
|
66
|
-
}());
|
|
67
|
-
/**
|
|
68
|
-
* The `Amplify` utility is used to configure the library.
|
|
69
|
-
*
|
|
70
|
-
* @remarks
|
|
71
|
-
* `Amplify` is responsible for orchestrating cross-category communication within the library.
|
|
72
|
-
*/
|
|
73
|
-
exports.AmplifyV6 = new AmplifyClass();
|
|
74
|
-
/**
|
|
75
|
-
* Returns current session tokens and credentials
|
|
76
|
-
*
|
|
77
|
-
* @param options{FetchAuthSessionOptions} - Options for fetching session.
|
|
78
|
-
*
|
|
79
|
-
* @returns Returns a promise that will resolve with fresh authentication tokens.
|
|
80
|
-
*/
|
|
81
|
-
var fetchAuthSession = function (options) {
|
|
82
|
-
return exports.AmplifyV6.Auth.fetchAuthSession(options);
|
|
83
|
-
};
|
|
84
|
-
exports.fetchAuthSession = fetchAuthSession;
|
|
85
|
-
// TODO(v6): validate until which level this will nested, during Amplify.configure API review.
|
|
86
|
-
function mergeResourceConfig(existingConfig, newConfig) {
|
|
87
|
-
var e_1, _a, e_2, _b;
|
|
88
|
-
var resultConfig = {};
|
|
89
|
-
try {
|
|
90
|
-
for (var _c = __values(Object.keys(existingConfig)), _d = _c.next(); !_d.done; _d = _c.next()) {
|
|
91
|
-
var category = _d.value;
|
|
92
|
-
resultConfig[category] = existingConfig[category];
|
|
93
|
-
}
|
|
94
|
-
}
|
|
95
|
-
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
96
|
-
finally {
|
|
97
|
-
try {
|
|
98
|
-
if (_d && !_d.done && (_a = _c.return)) _a.call(_c);
|
|
99
|
-
}
|
|
100
|
-
finally { if (e_1) throw e_1.error; }
|
|
101
|
-
}
|
|
102
|
-
try {
|
|
103
|
-
for (var _e = __values(Object.keys(newConfig)), _f = _e.next(); !_f.done; _f = _e.next()) {
|
|
104
|
-
var category = _f.value;
|
|
105
|
-
resultConfig[category] = __assign(__assign({}, resultConfig[category]), newConfig[category]);
|
|
106
|
-
}
|
|
107
|
-
}
|
|
108
|
-
catch (e_2_1) { e_2 = { error: e_2_1 }; }
|
|
109
|
-
finally {
|
|
110
|
-
try {
|
|
111
|
-
if (_f && !_f.done && (_b = _e.return)) _b.call(_e);
|
|
112
|
-
}
|
|
113
|
-
finally { if (e_2) throw e_2.error; }
|
|
114
|
-
}
|
|
115
|
-
return resultConfig;
|
|
116
|
-
}
|
|
117
|
-
function mergeLibraryOptions(existingConfig, newConfig) {
|
|
118
|
-
var e_3, _a, e_4, _b;
|
|
119
|
-
var resultConfig = {};
|
|
120
|
-
try {
|
|
121
|
-
for (var _c = __values(Object.keys(existingConfig)), _d = _c.next(); !_d.done; _d = _c.next()) {
|
|
122
|
-
var category = _d.value;
|
|
123
|
-
resultConfig[category] = existingConfig[category];
|
|
124
|
-
}
|
|
125
|
-
}
|
|
126
|
-
catch (e_3_1) { e_3 = { error: e_3_1 }; }
|
|
127
|
-
finally {
|
|
128
|
-
try {
|
|
129
|
-
if (_d && !_d.done && (_a = _c.return)) _a.call(_c);
|
|
130
|
-
}
|
|
131
|
-
finally { if (e_3) throw e_3.error; }
|
|
132
|
-
}
|
|
133
|
-
try {
|
|
134
|
-
for (var _e = __values(Object.keys(newConfig)), _f = _e.next(); !_f.done; _f = _e.next()) {
|
|
135
|
-
var category = _f.value;
|
|
136
|
-
resultConfig[category] = __assign(__assign({}, resultConfig[category]), newConfig[category]);
|
|
137
|
-
}
|
|
138
|
-
}
|
|
139
|
-
catch (e_4_1) { e_4 = { error: e_4_1 }; }
|
|
140
|
-
finally {
|
|
141
|
-
try {
|
|
142
|
-
if (_f && !_f.done && (_b = _e.return)) _b.call(_e);
|
|
143
|
-
}
|
|
144
|
-
finally { if (e_4) throw e_4.error; }
|
|
145
|
-
}
|
|
146
|
-
return resultConfig;
|
|
147
|
-
}
|
|
4
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5
|
+
exports.fetchAuthSession = exports.Amplify = exports.AmplifyClass = void 0;
|
|
6
|
+
var Amplify_1 = require("./Amplify");
|
|
7
|
+
Object.defineProperty(exports, "AmplifyClass", { enumerable: true, get: function () { return Amplify_1.AmplifyClass; } });
|
|
8
|
+
Object.defineProperty(exports, "Amplify", { enumerable: true, get: function () { return Amplify_1.Amplify; } });
|
|
9
|
+
var fetchAuthSession_1 = require("./apis/fetchAuthSession");
|
|
10
|
+
Object.defineProperty(exports, "fetchAuthSession", { enumerable: true, get: function () { return fetchAuthSession_1.fetchAuthSession; } });
|
package/lib/singleton/types.d.ts
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
|
+
import { AnalyticsConfig } from './Analytics/types';
|
|
1
2
|
import { AuthConfig, LibraryAuthOptions, UserPoolConfig, IdentityPoolConfig, UserPoolConfigAndIdentityPoolConfig, GetCredentialsOptions } from './Auth/types';
|
|
2
3
|
import { LibraryStorageOptions, StorageAccessLevel, StorageConfig } from './Storage/types';
|
|
3
4
|
import { CacheConfig } from '../Cache/types';
|
|
4
5
|
import { I18nOptions } from '../I18n/types';
|
|
5
6
|
export type ResourcesConfig = {
|
|
6
7
|
API?: {};
|
|
7
|
-
Analytics?:
|
|
8
|
+
Analytics?: AnalyticsConfig;
|
|
8
9
|
Auth?: AuthConfig;
|
|
9
10
|
Cache?: CacheConfig;
|
|
10
11
|
DataStore?: {};
|
|
@@ -13,6 +14,7 @@ export type ResourcesConfig = {
|
|
|
13
14
|
Notifications?: {};
|
|
14
15
|
Predictions?: {};
|
|
15
16
|
Storage?: StorageConfig;
|
|
17
|
+
ssr?: boolean;
|
|
16
18
|
};
|
|
17
19
|
export type LibraryOptions = {
|
|
18
20
|
Auth?: LibraryAuthOptions;
|