diff --git a/packages/analytics/src/apis/disable.ts b/packages/analytics/src/apis/disable.ts index 4a23cfce970..2d6a15189d8 100644 --- a/packages/analytics/src/apis/disable.ts +++ b/packages/analytics/src/apis/disable.ts @@ -9,5 +9,6 @@ import { disableAnalytics } from '../utils'; * @note * When Analytics is disabled events will not be buffered or transmitted to your selected service. Any auto-tracking * behavior that you have configured via `configureAutoTrack` will not have any effect while Analytics is disabled. + * @note Does not throw an exception. */ export const disable = disableAnalytics; diff --git a/packages/analytics/src/apis/enable.ts b/packages/analytics/src/apis/enable.ts index a2f4c72e6f1..bbaac89cea3 100644 --- a/packages/analytics/src/apis/enable.ts +++ b/packages/analytics/src/apis/enable.ts @@ -8,5 +8,6 @@ import { enableAnalytics } from '../utils'; * * @note * Analytics is enabled by default. You do not need to call this API unless you have disabled Analytics. + * @note Does not throw an exception. */ export const enable = enableAnalytics; diff --git a/packages/analytics/src/providers/pinpoint/apis/flushEvents.ts b/packages/analytics/src/providers/pinpoint/apis/flushEvents.ts index ff2739eaba9..9f96912640c 100644 --- a/packages/analytics/src/providers/pinpoint/apis/flushEvents.ts +++ b/packages/analytics/src/providers/pinpoint/apis/flushEvents.ts @@ -16,6 +16,7 @@ const logger = new ConsoleLogger('Analytics'); * @note * This API will make a best-effort attempt to flush events from the buffer. Events recorded immediately after invoking * this API may not be included in the flush. + * @note Does not throw an exception on failure. */ export const flushEvents = () => { const { appId, region, bufferSize, flushSize, flushInterval, resendLimit } = diff --git a/packages/api-rest/src/errors/CanceledError.ts b/packages/api-rest/src/errors/CanceledError.ts index ce4082212e0..15af348e9a5 100644 --- a/packages/api-rest/src/errors/CanceledError.ts +++ b/packages/api-rest/src/errors/CanceledError.ts @@ -29,6 +29,10 @@ export class CanceledError extends RestApiError { * * @note This function works **ONLY** for errors thrown by REST API. For GraphQL APIs, use `client.isCancelError(error)` * instead. `client` is generated from `generateClient()` API from `aws-amplify/api`. + * + * @note Does not throw an exception. + * @param {unknown} error The unknown exception to be checked. + * @returns - A boolean indicating if the error was from an upload cancellation */ export const isCancelError = (error: unknown): error is CanceledError => !!error && error instanceof CanceledError; diff --git a/packages/api/src/API.ts b/packages/api/src/API.ts index db0559e4477..8aee0fc3334 100644 --- a/packages/api/src/API.ts +++ b/packages/api/src/API.ts @@ -6,6 +6,9 @@ import { Amplify } from '@aws-amplify/core'; /** * Generates an API client that can work with models or raw GraphQL + * + * @returns {@link V6Client} + * @throws {@link Error} - Throws error when client cannot be generated due to configuration issues. */ export function generateClient = never>( options: CommonPublicClientOptions = {}, diff --git a/packages/core/src/singleton/Auth/utils/index.ts b/packages/core/src/singleton/Auth/utils/index.ts index c710e64a1ee..496d28db68d 100644 --- a/packages/core/src/singleton/Auth/utils/index.ts +++ b/packages/core/src/singleton/Auth/utils/index.ts @@ -66,6 +66,12 @@ export function assertIdentityPoolIdConfig( ); } +/** + * Decodes payload of JWT token + * + * @param {String} token A string representing a token to be decoded + * @throws {@link Error} - Throws error when token is invalid or payload malformed. + */ export function decodeJWT(token: string): JWT { const tokenParts = token.split('.'); diff --git a/packages/core/src/singleton/apis/fetchAuthSession.ts b/packages/core/src/singleton/apis/fetchAuthSession.ts index f7e1248ae54..c4285d0670e 100644 --- a/packages/core/src/singleton/apis/fetchAuthSession.ts +++ b/packages/core/src/singleton/apis/fetchAuthSession.ts @@ -6,6 +6,15 @@ import { AuthSession, FetchAuthSessionOptions } from '../Auth/types'; import { fetchAuthSession as fetchAuthSessionInternal } from './internal/fetchAuthSession'; +/** + * Fetch the auth tokens, and the temporary AWS credentials and identity if they are configured. By default it + * does not refresh the auth tokens or credentials if they are loaded in storage already. You can force a refresh + * with `{ forceRefresh: true }` input. + * + * @param options - Options configuring the fetch behavior. + * @throws {@link AuthError} - Throws error when session information cannot be refreshed. + * @returns Promise + */ export const fetchAuthSession = ( options?: FetchAuthSessionOptions, ): Promise => { diff --git a/packages/notifications/src/inAppMessaging/providers/pinpoint/apis/initializeInAppMessaging.ts b/packages/notifications/src/inAppMessaging/providers/pinpoint/apis/initializeInAppMessaging.ts index de4f2ebe27d..ceabad4811b 100644 --- a/packages/notifications/src/inAppMessaging/providers/pinpoint/apis/initializeInAppMessaging.ts +++ b/packages/notifications/src/inAppMessaging/providers/pinpoint/apis/initializeInAppMessaging.ts @@ -18,6 +18,7 @@ import { dispatchEvent } from './dispatchEvent'; * * @remarks * Make sure to call this early in your app at the root entry point after configuring Amplify. + * @note Does not throw an exception. * @example * ```ts * Amplify.configure(config); diff --git a/packages/storage/src/errors/CanceledError.ts b/packages/storage/src/errors/CanceledError.ts index 9388653432a..237f9a00752 100644 --- a/packages/storage/src/errors/CanceledError.ts +++ b/packages/storage/src/errors/CanceledError.ts @@ -28,6 +28,9 @@ export class CanceledError extends StorageError { /** * Check if an error is caused by user calling `cancel()` on a upload/download task. If an overwriting error is * supplied to `task.cancel(errorOverwrite)`, this function will return `false`. + * @note Does not throw an exception. + * @param {unknown} error The unknown exception to be checked. + * @returns - A boolean indicating if the error was from an upload cancellation */ export const isCancelError = (error: unknown): error is CanceledError => !!error && error instanceof CanceledError;