@aws-amplify/core

  • Version 6.0.17
  • Published
  • 2.16 MB
  • 8 dependencies
  • Apache-2.0 license

Install

npm i @aws-amplify/core
yarn add @aws-amplify/core
pnpm add @aws-amplify/core

Overview

Core category of aws-amplify

Index

Variables

Functions

Classes

Interfaces

Type Aliases

Variables

variable Amplify

const Amplify: AmplifyClass;
  • The Amplify utility is used to configure the library.

    Remarks

    Amplify is responsible for orchestrating cross-category communication within the library.

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;

            Functions

            function clearCredentials

            clearCredentials: () => Promise<void>;

              function decodeJWT

              decodeJWT: (token: string) => JWT;

                function fetchAuthSession

                fetchAuthSession: (
                options?: FetchAuthSessionOptions
                ) => Promise<import('../Auth/types').AuthSession>;

                  Classes

                  class AmplifyClassV6

                  class AmplifyClass {}

                    constructor

                    constructor();

                      property libraryOptions

                      libraryOptions: LibraryOptions;

                        property resourcesConfig

                        resourcesConfig: ResourcesConfig;

                          method configure

                          configure: (
                          resourcesConfig: ResourcesConfig | LegacyConfig,
                          libraryOptions?: LibraryOptions
                          ) => void;
                          • Configures Amplify for use with your back-end resources.

                            Parameter resourceConfig

                            Back-end resource configuration. Typically provided via the aws-exports.js file.

                            Parameter libraryOptions

                            Additional options for customizing the behavior of the library.

                            Remarks

                            configure can 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 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 langurage

                                                                  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) => 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"

                                                                  Parameter

                                                                  {string} - (optional) Service worker file. Defaults to "/service-worker.js"

                                                                  Parameter

                                                                  {string} - (optional) The service worker scope. Defaults to "/" - API Doc: https://developer.mozilla.org/en-US/docs/Web/API/ServiceWorkerContainer/register

                                                                  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

                                                                  {object | string} - 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 AuthTokens

                                                                interface AuthTokens {}

                                                                  property accessToken

                                                                  accessToken: JWT;

                                                                    property idToken

                                                                    idToken?: JWT;

                                                                      interface AuthUserPoolAndIdentityPoolConfig

                                                                      interface AuthUserPoolAndIdentityPoolConfig {}

                                                                        property Cognito

                                                                        Cognito: CognitoUserPoolAndIdentityPoolConfig;

                                                                          interface AuthUserPoolConfig

                                                                          interface AuthUserPoolConfig {}

                                                                            property Cognito

                                                                            Cognito: CognitoUserPoolConfig & {
                                                                            identityPoolId?: 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 loginWith

                                                                                  loginWith?: {
                                                                                  oauth?: OAuthConfig;
                                                                                  username?: boolean;
                                                                                  email?: boolean;
                                                                                  phone?: boolean;
                                                                                  };

                                                                                    property mfa

                                                                                    mfa?: {
                                                                                    status?: 'on' | 'off' | 'optional';
                                                                                    totpEnabled?: boolean;
                                                                                    smsEnabled?: boolean;
                                                                                    };

                                                                                      property passwordFormat

                                                                                      passwordFormat?: {
                                                                                      minLength?: number;
                                                                                      requireLowercase?: boolean;
                                                                                      requireUppercase?: boolean;
                                                                                      requireNumbers?: boolean;
                                                                                      requireSpecialCharacters?: boolean;
                                                                                      };

                                                                                        property signUpVerificationMethod

                                                                                        signUpVerificationMethod?: 'code' | 'link';

                                                                                          property userAttributes

                                                                                          userAttributes?: AuthConfigUserAttributes;

                                                                                            property userPoolClientId

                                                                                            userPoolClientId: string;

                                                                                              property userPoolEndpoint

                                                                                              userPoolEndpoint?: string;

                                                                                                property userPoolId

                                                                                                userPoolId: string;

                                                                                                  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 forceRefresh

                                                                                                                forceRefresh?: boolean;

                                                                                                                  interface GetCredentialsForIdentityOutput

                                                                                                                  interface GetCredentialsForIdentityCommandOutput
                                                                                                                  extends GetCredentialsForIdentityResponse,
                                                                                                                  __MetadataBearer {}

                                                                                                                  interface HubCapsule

                                                                                                                  interface HubCapsule<Channel extends string, EventData extends EventDataMap> {}

                                                                                                                    property channel

                                                                                                                    channel: Channel;

                                                                                                                      property patternInfo

                                                                                                                      patternInfo?: string[];

                                                                                                                        property payload

                                                                                                                        payload: HubPayload<EventData>;

                                                                                                                          property source

                                                                                                                          source?: string;

                                                                                                                            interface Identity

                                                                                                                            interface Identity {}

                                                                                                                              property id

                                                                                                                              id: string;

                                                                                                                                property type

                                                                                                                                type: 'guest' | 'primary';

                                                                                                                                  interface JWT

                                                                                                                                  interface JWT {}

                                                                                                                                    property payload

                                                                                                                                    payload: JwtPayload;

                                                                                                                                      method toString

                                                                                                                                      toString: () => string;

                                                                                                                                        interface KeyValueStorageInterface

                                                                                                                                        interface KeyValueStorageInterface {}

                                                                                                                                          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 {}

                                                                                                                                                    property API

                                                                                                                                                    API?: LibraryAPIOptions;

                                                                                                                                                      property Auth

                                                                                                                                                      Auth?: LibraryAuthOptions;

                                                                                                                                                        property ssr

                                                                                                                                                        ssr?: boolean;

                                                                                                                                                          property Storage

                                                                                                                                                          Storage?: LibraryStorageOptions;

                                                                                                                                                            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 {}

                                                                                                                                                                            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 TokenProvider

                                                                                                                                                                                            interface TokenProvider {}

                                                                                                                                                                                              method getTokens

                                                                                                                                                                                              getTokens: ({
                                                                                                                                                                                              forceRefresh,
                                                                                                                                                                                              }?: {
                                                                                                                                                                                              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>;

                                                                                                                                                                                                                    type AuthConfig

                                                                                                                                                                                                                    type AuthConfig = AtLeastOne<CognitoProviderConfig>;

                                                                                                                                                                                                                      type GeoConfig

                                                                                                                                                                                                                      type GeoConfig = AtLeastOne<LocationServiceConfig>;

                                                                                                                                                                                                                        type GetCredentialsForIdentityInput

                                                                                                                                                                                                                        type GetCredentialsForIdentityCommandInput = GetCredentialsForIdentityInput;

                                                                                                                                                                                                                        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 StorageAccessLevel

                                                                                                                                                                                                                                type StorageAccessLevel = 'guest' | 'protected' | 'private';

                                                                                                                                                                                                                                  type StorageConfig

                                                                                                                                                                                                                                  type StorageConfig = AtLeastOne<S3ProviderConfig>;

                                                                                                                                                                                                                                    Package Files (24)

                                                                                                                                                                                                                                    Dependencies (8)

                                                                                                                                                                                                                                    Dev Dependencies (4)

                                                                                                                                                                                                                                    Peer Dependencies (0)

                                                                                                                                                                                                                                    No peer dependencies.

                                                                                                                                                                                                                                    Badge

                                                                                                                                                                                                                                    To add a badge like this onejsDocs.io badgeto 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
                                                                                                                                                                                                                                      [![jsDocs.io](https://img.shields.io/badge/jsDocs.io-reference-blue)](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>