@aws-amplify/core
- Version 6.19.3
- Published
- 2.76 MB
- 8 dependencies
- Apache-2.0 license
Install
npm i @aws-amplify/coreyarn add @aws-amplify/corepnpm add @aws-amplify/coreOverview
Core category of aws-amplify
Index
Variables
Functions
Classes
Interfaces
Type Aliases
Variables
variable Amplify
const Amplify: AmplifyClass;The
Amplifyutility is used to configure the library.Remarks
Amplifyorchestrates cross-category communication within the library.
variable AMPLIFY_CONTEXT_BRAND
const AMPLIFY_CONTEXT_BRAND: Symbol;Symbol brand used to identify AmplifyContext objects at runtime. Uses
Symbol.for()so the brand is shared across module instances (e.g. when@aws-amplify/coreis accidentally duplicated in the bundle).
variable Cache
const Cache: StorageCache;variable defaultStorage
const defaultStorage: DefaultStorage;variable Hub
const Hub: HubClass;variable sessionStorage
const sessionStorage: SessionStorage;variable sharedInMemoryStorage
const sharedInMemoryStorage: KeyValueStorage;variable syncSessionStorage
const syncSessionStorage: SyncSessionStorage;Functions
function clearCredentials
clearCredentials: { (ctx: AmplifyContext): Promise<void>; (): Promise<void> };Clears the cached auth credentials of the given AmplifyContext instead of the global one.
Parameter ctx
The explicit AmplifyContext whose credentials are cleared.
Clears the cached auth credentials of the global AmplifyContext. Before
Amplify.configure()has run this resolves harmlessly, matching the pre-context behavior.
function cognitoIdentityPoolEndpointResolver
cognitoIdentityPoolEndpointResolver: ({ region }: EndpointResolverOptions) => { url: URL;};function createAmplifyContext
createAmplifyContext: ( resourceConfig: ResourcesConfig | LegacyConfig | AmplifyOutputsUnknown, libraryOptions?: LibraryOptions, internalOptions?: { skipConfigParse?: boolean }) => AmplifyContext;Creates a local, branded AmplifyContext from the given resource configuration.
Unlike
Amplify.configure(), the returned context is **not** set as the global context and no Hub events are dispatched. Category APIs that receive this context (as their first positional argument) will use it instead of the global one, enabling per-request context injection in server-side / multi-tenant scenarios.The factory follows the "factory-provider" style: it instantiates a **fresh, per-context** AuthClass (never the process-wide singleton) whose
fetchAuthSession/clearCredentials/getTokensclosures back the returned context's methods. The context is branded via AMPLIFY_CONTEXT_BRAND and frozen so it can be recognized at runtime byisAmplifyContext()and cannot be mutated after creation.Parameter resourceConfig
Back-end resource configuration (typed config, legacy
aws-exports, oramplify_outputs).Parameter libraryOptions
Optional library options (e.g. Auth token/credentials providers,
ssr).Parameter internalOptions
Internal-only options.
skipConfigParselets a trusted caller (theaws-amplifywrapper) that has *already* normalized the config viaparseAmplifyConfigopt out of a redundant re-parse. SinceparseAmplifyConfigis a no-op on an already-parsedResourcesConfig, this only removes duplicate work (which otherwise runs on every context creation, and twice per SSR request through adapter-nextjs) — behavior is identical.Returns
A branded, frozen AmplifyContext.
Remarks
@aws-amplify/coresits at the bottom of the dependency graph and therefore cannot import the Cognito token/credentials provider factories (those live in theaws-amplifyumbrella package and depend on@aws-amplify/auth). As a result this core-level factory does **not** inject default providers: callers that need auth must supplylibraryOptions.Auth.{tokenProvider,credentialsProvider}. Theaws-amplifypackage wraps this factory (Phase C2) to resolve and inject the default Cognito providers (SSR cookie storage vs. localStorage) before delegating here.Example 1
import { createAmplifyContext } from '@aws-amplify/core';const ctx = createAmplifyContext(resourcesConfig, {Auth: { tokenProvider, credentialsProvider },});// Pass ctx explicitly to category APIs:await signIn(ctx, { username, password });
function createAmplifyContextToken
createAmplifyContextToken: () => AmplifyContextToken;Creates the per-context identity handle attached to every branded AmplifyContext by the context producers (
createAmplifyContext,bridgeAmplifyClass, the singletonconfigure()path, and the testing mock factory).Each call returns a **frozen**
{ value }object carrying a **unique**Symbol()— a plain (non-registry) symbol, so no two contexts ever share a token. See AmplifyContextToken for why the token exists (structural compatibility with@aws-amplify/data-schema'sContextSpecduck-check); runtime context identification stays on theAMPLIFY_CONTEXT_BRANDsymbol and must not involve the token.
function createConfigurationBuilder
createConfigurationBuilder: ( options?: CreateConfigurationBuilderOptions) => ConfigurationBuilder;Creates a configuration builder for constructing
ResourcesConfigobjects programmatically.Example 1
import outputs from './amplify_outputs.json';const config = createConfiguration({ from: outputs }).add('Storage', { S3: { bucket: 'my-bucket', region: 'us-east-1' } }).build();Amplify.configure(config);
function createGetCredentialsForIdentityClient
createGetCredentialsForIdentityClient: ( config: ServiceClientFactoryInput) => ( config: { userAgentValue?: string | undefined; endpointResolver?: (( options: import('../../../../clients').EndpointResolverOptions, input?: any ) => import('../../../../clients').Endpoint) & ((options: import('../../../../clients').EndpointResolverOptions) => { url: URL; }); service?: string | undefined; retryDecider?: (( response?: HttpResponse | undefined, error?: unknown, middlewareContext?: import('../../../../clients').MiddlewareContext ) => Promise<import('../../../../clients').RetryDeciderOutput>) & (( response?: HttpResponse, error?: unknown ) => Promise<import('../../../../clients').RetryDeciderOutput>); computeDelay?: (attempt: number) => number; cache?: | 'default' | 'force-cache' | 'no-cache' | 'no-store' | 'only-if-cached' | 'reload' | undefined; } & { [x: string]: unknown }, input: GetCredentialsForIdentityInput) => Promise<GetCredentialsForIdentityCommandOutput>;function createGetIdClient
createGetIdClient: ( config: ServiceClientFactoryInput) => ( config: { userAgentValue?: string | undefined; endpointResolver?: (( options: import('../../../../clients').EndpointResolverOptions, input?: any ) => import('../../../../clients').Endpoint) & ((options: import('../../../../clients').EndpointResolverOptions) => { url: URL; }); service?: string | undefined; retryDecider?: (( response?: HttpResponse | undefined, error?: unknown, middlewareContext?: import('../../../../clients').MiddlewareContext ) => Promise<import('../../../../clients').RetryDeciderOutput>) & (( response?: HttpResponse, error?: unknown ) => Promise<import('../../../../clients').RetryDeciderOutput>); computeDelay?: (attempt: number) => number; cache?: | 'default' | 'force-cache' | 'no-cache' | 'no-store' | 'only-if-cached' | 'reload' | undefined; } & { [x: string]: unknown }, input: import('./types').GetIdInput) => Promise<GetIdCommandOutput>;function decodeJWT
decodeJWT: (token: string) => JWT;Decodes payload of JWT token
Parameter token
A string representing a token to be decoded
Throws
Error - Throws error when token is invalid or payload malformed.
function fetchAuthSession
fetchAuthSession: { (ctx: AmplifyContext, options?: FetchAuthSessionOptions): Promise<AuthSession>; (options?: FetchAuthSessionOptions): Promise<AuthSession>;};Fetch the auth session of the given AmplifyContext — e.g. the per-request context handed to an SSR
runWithAmplifyServerContextoperation — instead of the global context. This restores the pre-context v6 SSR calling patternfetchAuthSession(contextSpec)(the deprecatedContextSpectype is an alias ofAmplifyContext, so existing SSR code compiles unchanged).Parameter ctx
The explicit AmplifyContext whose auth providers are used.
Parameter options
Options configuring the fetch behavior.
Returns
Promise
Throws
AuthError - Throws error when session information cannot be refreshed.
Fetch the auth session including the tokens and credentials if they are available. By default it will automatically refresh expired auth tokens if a valid refresh token is present. You can force a refresh of non-expired tokens with
{ forceRefresh: true }input.Parameter options
Options configuring the fetch behavior.
Returns
Promise — before
Amplify.configure()has run this resolves with an empty session (all fieldsundefined), matching the pre-context behavior.Throws
AuthError - Throws error when session information cannot be refreshed.
function getGlobalContext
getGlobalContext: () => AmplifyContext;Returns the global AmplifyContext set by
Amplify.configure().Throws
NoAmplifyContextError If
Amplify.configure()has not been called yet and no context is available.
function hasGlobalContext
hasGlobalContext: () => boolean;Returns
trueif a global AmplifyContext has been set.
function isAmplifyContext
isAmplifyContext: (value: unknown) => value is AmplifyContext;Returns
trueif the given value is a branded AmplifyContext.
Classes
class AmplifyClassV6
class AmplifyClass {}constructor
constructor();property libraryOptions
libraryOptions: LibraryOptions;property resourcesConfig
resourcesConfig: ResourcesConfig;method configure
configure: ( resourcesConfig: ResourcesConfig | LegacyConfig | AmplifyOutputsUnknown, libraryOptions?: LibraryOptions) => void;Configures Amplify for use with your back-end resources.
Parameter resourceConfig
Back-end resource configuration. Typically provided via the
aws-exports.jsfile.Parameter libraryOptions
Additional options for customizing the behavior of the library.
Remarks
configurecan be used to specify additional library options where available for supported categories.
method getConfig
getConfig: () => Readonly<ResourcesConfig>;Provides access to the current back-end resource configuration for the Library.
Returns
Returns the immutable back-end resource configuration.
class ConsoleLogger
class ConsoleLogger implements Logger {}Write logs Logger
constructor
constructor(name: string, level?: string);Parameter name
Name of the logger
property BIND_ALL_LOG_LEVELS
static BIND_ALL_LOG_LEVELS: boolean;property level
level: string;property LOG_LEVEL
static LOG_LEVEL: string;property name
name: string;method addPluggable
addPluggable: (pluggable: LoggingProvider) => void;method configure
configure: (config?: object) => object | undefined;method debug
debug: (...msg: any) => void;Write DEBUG log Logger
Parameter msg
Logging message or object
method error
error: (...msg: any) => void;Write ERROR log Logger
Parameter msg
Logging message or object
method info
info: (...msg: any) => void;Write INFO log Logger
Parameter msg
Logging message or object
method listPluggables
listPluggables: () => LoggingProvider[];method log
log: (...msg: any) => void;Write General log. Default to INFO Logger
Parameter msg
Logging message or object
method verbose
verbose: (...msg: any) => void;Write VERBOSE log Logger
Parameter msg
Logging message or object
method warn
warn: (...msg: any) => void;Write WARN log Logger
Parameter msg
Logging message or object
class CookieStorage
class CookieStorage implements KeyValueStorageInterface {}constructor
constructor(data?: CookieStorageData);property domain
domain?: string;property expires
expires?: number;property path
path: string;property sameSite
sameSite?: SameSite;property secure
secure?: boolean;method clear
clear: () => Promise<void>;method getItem
getItem: (key: string) => Promise<string | null>;method removeItem
removeItem: (key: string) => Promise<void>;method setItem
setItem: (key: string, value: string) => Promise<void>;class I18n
class I18n {}Export I18n APIs
method checkConfig
static checkConfig: () => boolean;method configure
static configure: (config: Record<string, any>) => I18nConfig;Configure I18n part
Parameter config
Configuration of the I18n
method createInstance
static createInstance: () => void;Create an instance of I18n for the library
method get
static get: (key: string, defVal?: string) => any;Get value
Parameter key
Parameter defVal
Default value
method getModuleName
static getModuleName: () => string;method putVocabularies
static putVocabularies: ( vocabularies: Record<string, Record<string, string>>) => void;Add vocabularies for one language
Parameter vocabularies
Object that has language as key, vocabularies of each language as value
method putVocabulariesForLanguage
static putVocabulariesForLanguage: ( language: string, vocabularies: Record<string, string>) => void;Add vocabularies for one language
Parameter language
Language of the dictionary
Parameter vocabularies
Object that has key-value as dictionary entry
method setLanguage
static setLanguage: (lang: string) => void;Explicitly setting language
Parameter lang
class ServiceWorker
class ServiceWorkerClass {}Provides a means to registering a service worker in the browser and communicating with it via postMessage events. https://developer.mozilla.org/en-US/docs/Web/API/Service_Worker_API/
postMessage events are currently not supported in all browsers. See: https://developer.mozilla.org/en-US/docs/Web/API/Service_Worker_API
At the minmum this class will register the service worker and listen and attempt to dispatch messages on state change and record analytics events based on the service worker lifecycle.
property serviceWorker
readonly serviceWorker: ServiceWorker;Get the currently active service worker
method enablePush
enablePush: (publicKey: string) => Promise<unknown>;Enable web push notifications. If not subscribed, a new subscription will be created and registered. Test Push Server: https://web-push-codelab.glitch.me/ Push Server Libraries: https://github.com/web-push-libs/ API Doc: https://developers.google.com/web/fundamentals/codelabs/push-notifications/
Parameter publicKey
Returns
{Promise} - resolve(PushSubscription) - reject(Error)
method register
register: ( filePath?: string, scope?: string, options?: ServiceWorkerOptions) => Promise<unknown>;Register the service-worker.js file in the browser Make sure the service-worker.js is part of the build for example with Angular, modify the angular-cli.json file and add to "assets" array "service-worker.js"
Note: when
options.onStateChangeis omitted, this method implicitly records service worker lifecycle (statechange) events to Amazon Pinpoint. That built-in auto-recording is deprecated and will be removed in a future major version — only the implicit Pinpoint recording is deprecated, notregister()itself. Provideoptions.onStateChangeto observe lifecycle state changes and emit vendor-neutral telemetry instead.Parameter filePath
Service worker file. Defaults to "/service-worker.js"
Parameter scope
The service worker scope. Defaults to "/" - API Doc: https://developer.mozilla.org/en-US/docs/Web/API/ServiceWorkerContainer/register
Parameter options
Optional registration options. When
onStateChangeis provided it is invoked on every service worker state change and replaces the built-in Pinpoint auto-recording. It is also invoked once with the worker's current state at registration time, so an already-active worker (which dispatches nostatechangeevent) is still observed. This initial emit applies only toonStateChange; the built-in Pinpoint path is unaffected.Returns
{Promise} - resolve(ServiceWorkerRegistration) - reject(Error)
method send
send: (message: object | string) => void;Send a message to the service worker. The service worker needs to implement `self.addEventListener('message') to handle the message. This ***currently*** does not work in Safari or IE.
Parameter message
An arbitrary JSON object or string message to send to the service worker - see: https://developer.mozilla.org/en-US/docs/Web/API/Transferable
Returns
{Promise}
Interfaces
interface AmplifyContext
interface AmplifyContext {}The context object returned by
createAmplifyContext(). Pass this as the first argument to every Amplify category API to provide configuration and auth credentials without relying on global singleton state.
property libraryOptions
readonly libraryOptions: Readonly<LibraryOptions>;property resourcesConfig
readonly resourcesConfig: Readonly<ResourcesConfig>;property token
readonly token: AmplifyContextToken;Per-context identity handle; see AmplifyContextToken. All legitimate producers are the Amplify context factories, which attach a fresh, frozen token per context.
method clearCredentials
clearCredentials: () => Promise<void>;method fetchAuthSession
fetchAuthSession: (options?: FetchAuthSessionOptions) => Promise<AuthSession>;method getTokens
getTokens: (options: FetchAuthSessionOptions) => Promise<AuthTokens | undefined>;interface AmplifyContextToken
interface AmplifyContextToken {}The per-context identity handle carried by every branded AmplifyContext (
token.valueis a uniqueSymbol()per context).Runtime identification of a context remains the responsibility of the
AMPLIFY_CONTEXT_BRANDsymbol (seeisAmplifyContext()); the token exists primarily for compatibility with consumers that structurally duck-type the legacy serverContextSpecshape — notably@aws-amplify/data-schema, whose generated-client operations both *type* their first parameter as{ token: { value: symbol } }and *runtime-check* it viatypeof arg?.token?.value === 'symbol'.
property value
readonly value: symbol;interface AuthSession
interface AuthSession {}property credentials
credentials?: AWSCredentials;property identityId
identityId?: string;property tokens
tokens?: AuthTokens;property userSub
userSub?: string;interface AuthTokens
interface AuthTokens {}property accessToken
accessToken: JWT;property idToken
idToken?: JWT;property signInDetails
signInDetails?: AWSAuthSignInDetails;Deprecated
Use getCurrentUser to access signInDetails
interface AuthUserPoolAndIdentityPoolConfig
interface AuthUserPoolAndIdentityPoolConfig {}property Cognito
Cognito: CognitoUserPoolAndIdentityPoolConfig;interface AuthUserPoolConfig
interface AuthUserPoolConfig {}property Cognito
Cognito: CognitoUserPoolConfig & { identityPoolId?: never; identityPoolEndpoint?: never; allowGuestAccess?: never;};interface CacheConfig
interface CacheConfig {}Cache instance options
property capacityInBytes
capacityInBytes: number;Cache capacity, in bytes
property defaultPriority
defaultPriority: number;default priority number put on cached items
property defaultTTL
defaultTTL: number;Time to live, in milliseconds
property itemMaxSize
itemMaxSize: number;Max size of one item
property keyPrefix
keyPrefix: string;Prepend to key to avoid conflicts
property storage
storage?: Storage;property warningThreshold
warningThreshold: number;Warn when over threshold percentage of capacity, maximum 1
interface CognitoUserPoolConfig
interface CognitoUserPoolConfig {}property groups
groups?: Record<UserGroupName, UserGroupPrecedence>[];property loginWith
loginWith?: { oauth?: OAuthConfig; username?: boolean; email?: boolean; phone?: boolean;};property mfa
mfa?: { status?: CognitoUserPoolConfigMfaStatus; totpEnabled?: boolean; smsEnabled?: boolean;};property passwordFormat
passwordFormat?: { minLength?: number; requireLowercase?: boolean; requireUppercase?: boolean; requireNumbers?: boolean; requireSpecialCharacters?: boolean;};property passwordless
passwordless?: { emailOtpEnabled?: boolean; smsOtpEnabled?: boolean; webAuthn?: { relyingPartyId?: string; userVerification?: string; }; preferredChallenge?: PreferredChallenge;};property signUpVerificationMethod
signUpVerificationMethod?: 'code' | 'link';property userAttributes
userAttributes?: AuthConfigUserAttributes;property userPoolClientId
userPoolClientId: string;property userPoolEndpoint
userPoolEndpoint?: string;Use this field to specify a custom endpoint for the Amazon Cognito user pool. Ensure this endpoint is correct and valid.
property userPoolId
userPoolId: string;interface ConfigurationBuilder
interface ConfigurationBuilder {}method add
add: <K extends keyof ResourcesConfig>( category: K, value: CategoryConfig<K>) => ConfigurationBuilder;Add or replace a category configuration.
Example 1
config.add('Auth', { Cognito: { userPoolId: '...', userPoolClientId: '...' } });config.add('Storage', { S3: { bucket: '...', region: '...' } });
method analytics
analytics: (config: CategoryConfig<'Analytics'>) => ConfigurationBuilder;Shorthand for
.add('Analytics', config)
method api
api: (config: CategoryConfig<'API'>) => ConfigurationBuilder;Shorthand for
.add('API', config)
method auth
auth: (config: CategoryConfig<'Auth'>) => ConfigurationBuilder;Shorthand for
.add('Auth', config)
method build
build: () => ResourcesConfig;Produces a frozen
ResourcesConfigready forAmplify.configure().
method from
from: (existing: ConfigurationSeed) => ConfigurationBuilder;Merge an existing config into this builder. Accepts any format that
Amplify.configure()accepts, or anotherConfigurationBuilder.Example 1
const config = createConfiguration().from(amplifyOutputs).add('Storage', { S3: { bucket: 'my-bucket', region: 'us-east-1' } }).build();
method geo
geo: (config: CategoryConfig<'Geo'>) => ConfigurationBuilder;Shorthand for
.add('Geo', config)
method interactions
interactions: (config: CategoryConfig<'Interactions'>) => ConfigurationBuilder;Shorthand for
.add('Interactions', config)
method notifications
notifications: (config: CategoryConfig<'Notifications'>) => ConfigurationBuilder;Shorthand for
.add('Notifications', config)
method patch
patch: <K extends keyof ResourcesConfig>( category: K, value: DeepPartial<CategoryConfig<K>>) => ConfigurationBuilder;Deep-merge a partial config into an existing category. Use this to override specific nested values without replacing the entire category.
Example 1
// Base config from outputs, override just the user pool for devconst dev = createConfiguration({ from: outputs }).patch('Auth', { Cognito: { userPoolId: 'us-east-1_DEV' } }).build();
method predictions
predictions: (config: CategoryConfig<'Predictions'>) => ConfigurationBuilder;Shorthand for
.add('Predictions', config)
method storage
storage: (config: CategoryConfig<'Storage'>) => ConfigurationBuilder;Shorthand for
.add('Storage', config)
interface CreateConfigurationBuilderOptions
interface CreateConfigurationBuilderOptions {}property from
from?: ConfigurationSeed;interface CredentialsAndIdentityId
interface CredentialsAndIdentityId {}property credentials
credentials: AWSCredentials;property identityId
identityId?: string;interface CredentialsAndIdentityIdProvider
interface CredentialsAndIdentityIdProvider {}method clearCredentialsAndIdentityId
clearCredentialsAndIdentityId: () => void;method getCredentialsAndIdentityId
getCredentialsAndIdentityId: ( getCredentialsOptions: GetCredentialsOptions) => Promise<CredentialsAndIdentityId | undefined>;interface FetchAuthSessionOptions
interface FetchAuthSessionOptions {}property clientMetadata
clientMetadata?: ClientMetadata;property forceRefresh
forceRefresh?: boolean;interface GetCredentialsForIdentityInput
interface GetCredentialsForIdentityInput {}Input to the GetCredentialsForIdentity action.
Modifiers
@public
property CustomRoleArn
CustomRoleArn?: string;The Amazon Resource Name (ARN) of the role to be assumed when multiple roles were received in the token from the identity provider. For example, a SAML-based identity provider. This parameter is optional for identity providers that do not support role customization.
property IdentityId
IdentityId: string | undefined;A unique identifier in the format REGION:GUID.
property Logins
Logins?: Record<string, string>;A set of optional name-value pairs that map provider names to provider tokens. The name-value pair will follow the syntax "provider_name": "provider_user_identifier". Logins should not be specified when trying to get credentials for an unauthenticated identity. The Logins parameter is required when using identities associated with external identity providers such as Facebook. For examples of Logins maps, see the code examples in the External Identity Providers section of the Amazon Cognito Developer Guide.
interface GetCredentialsForIdentityOutput
interface GetCredentialsForIdentityCommandOutput extends GetCredentialsForIdentityResponse, __MetadataBearer {}The output of GetCredentialsForIdentityCommand.
Modifiers
@public
interface HubCapsule
interface HubCapsule<Channel extends string, EventData extends EventDataMap> {}property channel
channel: Channel;property crossTab
crossTab?: boolean;property patternInfo
patternInfo?: string[];property payload
payload: HubPayload<EventData>;property source
source?: string;interface Identity
interface Identity {}interface JWT
interface JWT {}interface KeyValueStorageEvent
interface KeyValueStorageEvent {}interface KeyValueStorageInterface
interface KeyValueStorageInterface {}method addListener
addListener: ( listener: (ev: KeyValueStorageEvent) => Promise<void>) => () => void;Subscribe to cross-tab storage changes.
Parameter listener
invoked when the underlying storage changes in another tab.
Returns
an unsubscribe function that removes the listener. Optional: storages that do not support cross-tab notifications (e.g. cookie storage) may omit it.
method clear
clear: () => Promise<void>;method getItem
getItem: (key: string) => Promise<string | null>;method removeItem
removeItem: (key: string) => Promise<void>;method setItem
setItem: (key: string, value: string) => Promise<void>;interface LibraryOptions
interface LibraryOptions {}Amplify library options type. Used to customize library behavior.
interface OAuthConfig
interface OAuthConfig {}property domain
domain: string;property providers
providers?: (OAuthProvider | CustomProvider)[];property redirectSignIn
redirectSignIn: string[];property redirectSignOut
redirectSignOut: string[];property responseType
responseType: 'code' | 'token';property scopes
scopes: OAuthScope[];interface ResourcesConfig
interface ResourcesConfig {}Amplify library configuration type. Used to specify back-end resource configuration across the library.
property Analytics
Analytics?: AnalyticsConfig;property API
API?: APIConfig;property Auth
Auth?: AuthConfig;property Geo
Geo?: GeoConfig;property Interactions
Interactions?: InteractionsConfig;property Notifications
Notifications?: NotificationsConfig;property Predictions
Predictions?: PredictionsConfig;property Storage
Storage?: StorageConfig;interface ServiceWorkerOptions
interface ServiceWorkerOptions {}Options for ServiceWorker.register.
property onStateChange
onStateChange?: ServiceWorkerStateChangeHandler;Optional handler invoked on every service worker
statechangeevent.When provided, this handler replaces the built-in Pinpoint auto-recording: the built-in analytics event is only recorded when no handler is supplied, which prevents duplicate telemetry for the same state change.
interface TokenProvider
interface TokenProvider {}method getTokens
getTokens: (options?: { forceRefresh?: boolean }) => Promise<AuthTokens | null>;interface UserProfile
interface UserProfile {}property customProperties
customProperties?: Record<string, string[]>;property demographic
demographic?: { appVersion?: string; locale?: string; make?: string; model?: string; modelVersion?: string; platform?: string; platformVersion?: string; timezone?: string;};property email
email?: string;property location
location?: { city?: string; country?: string; latitude?: number; longitude?: number; postalCode?: string; region?: string;};property metrics
metrics?: Record<string, number>;property name
name?: string;property plan
plan?: string;Type Aliases
type AnalyticsConfig
type AnalyticsConfig = AtLeastOne< PinpointProviderConfig & KinesisProviderConfig & KinesisFirehoseProviderConfig & PersonalizeProviderConfig>;type APIConfig
type APIConfig = AtLeastOne< RESTProviderConfig & GraphQLProviderConfig & EventsProviderConfig>;type AuthConfig
type AuthConfig = AtLeastOne<CognitoProviderConfig>;type ClientMetadata
type ClientMetadata = Record<string, string>;Arbitrary key/value pairs that may be passed as part of certain Cognito requests
type ClientMetadataProvider
type ClientMetadataProvider = () => Promise<ClientMetadata>;Function type for providing client metadata for Cognito operations
type GeoConfig
type GeoConfig = AtLeastOne<LocationServiceConfig>;type GetCredentialsOptions
type GetCredentialsOptions = | GetCredentialsAuthenticatedUser | GetCredentialsUnauthenticatedUser;type HubCallback
type HubCallback< Channel extends string = string, EventData extends EventDataMap = EventDataMap> = (capsule: HubCapsule<Channel, EventData>) => void;type HubPayload
type HubPayload<EventData extends EventDataMap = EventDataMap> = EventData & { message?: string;};type PredictionsConfig
type PredictionsConfig = AtLeastOne< PredictionsConvertConfig & PredictionsIdentifyConfig & PredictionsInterpretConfig>;type ServiceWorkerStateChangeHandler
type ServiceWorkerStateChangeHandler = (state: ServiceWorkerState) => void;Handler invoked on every service worker
statechangeevent, receiving the worker's current lifecycle state.
type StorageAccessLevel
type StorageAccessLevel = 'guest' | 'protected' | 'private';Deprecated
This may be removed in the next major version.
type StorageConfig
type StorageConfig = AtLeastOne<S3ProviderConfig>;Package Files (33)
- dist/esm/Cache/index.d.ts
- dist/esm/Hub/index.d.ts
- dist/esm/Hub/types/HubTypes.d.ts
- dist/esm/I18n/index.d.ts
- dist/esm/Logger/ConsoleLogger.d.ts
- dist/esm/ServiceWorker/ServiceWorker.d.ts
- dist/esm/configurationBuilder/configurationBuilder.d.ts
- dist/esm/context/AmplifyContext.d.ts
- dist/esm/context/contextBrand.d.ts
- dist/esm/context/contextToken.d.ts
- dist/esm/context/createAmplifyContext.d.ts
- dist/esm/context/globalContext.d.ts
- dist/esm/foundation/factories/serviceClients/cognitoIdentity/cognitoIdentityPoolEndpointResolver.d.ts
- dist/esm/foundation/factories/serviceClients/cognitoIdentity/createGetCredentialsForIdentityClient.d.ts
- dist/esm/foundation/factories/serviceClients/cognitoIdentity/createGetIdClient.d.ts
- dist/esm/foundation/factories/serviceClients/cognitoIdentity/types/sdk.d.ts
- dist/esm/index.d.ts
- dist/esm/singleton/API/types.d.ts
- dist/esm/singleton/Amplify.d.ts
- dist/esm/singleton/Analytics/types.d.ts
- dist/esm/singleton/Auth/types.d.ts
- dist/esm/singleton/Auth/utils/index.d.ts
- dist/esm/singleton/Cache/types.d.ts
- dist/esm/singleton/Geo/types.d.ts
- dist/esm/singleton/Predictions/types.d.ts
- dist/esm/singleton/Storage/types.d.ts
- dist/esm/singleton/apis/clearCredentials.d.ts
- dist/esm/singleton/apis/fetchAuthSession.d.ts
- dist/esm/singleton/types.d.ts
- dist/esm/storage/CookieStorage.d.ts
- dist/esm/storage/index.d.ts
- dist/esm/types/core.d.ts
- dist/esm/types/storage.d.ts
Dependencies (8)
Dev Dependencies (3)
Peer Dependencies (0)
No peer dependencies.
Badge
To add a badge like this oneto your package's README, use the codes available below.
You may also use Shields.io to create a custom badge linking to https://www.jsdocs.io/package/@aws-amplify/core.
- Markdown[](https://www.jsdocs.io/package/@aws-amplify/core)
- HTML<a href="https://www.jsdocs.io/package/@aws-amplify/core"><img src="https://img.shields.io/badge/jsDocs.io-reference-blue" alt="jsDocs.io"></a>
- Updated .
Package analyzed in 7262 ms. - Missing or incorrect documentation? Open an issue for this package.
