UNPKG

@vertigis/viewer-spec

Version:

VertiGIS Viewer Specification

152 lines (151 loc) 5.02 kB
/// <reference types="esri-runtime-sdk" /> import type PortalUser from "@arcgis/core/portal/PortalUser"; import type Credential from "esri-runtime-sdk/Credential"; import type CredentialRequestInfo from "esri-runtime-sdk/CredentialRequestInfo"; import type { Command } from "../Command.js"; import { CommandRegistry } from "../CommandRegistry.js"; import type { Event } from "../Event.js"; import { EventRegistry } from "../EventRegistry.js"; import type { Operation } from "../Operation.js"; import { OperationRegistry } from "../OperationRegistry.js"; import type { ArcGISPortalIdentity } from "../mobile.js"; /** * A type of authentication. */ export type AuthenticationType = "Unknown" | "OAuth2" | "Network" | "Token"; /** * A user properties interface that contains a portal user. */ export interface Principal { /** * The ArcGIS JavaScript API PortalUser object containing information about * the user. */ portalUser: PortalUser; } /** * Arguments for the auth.sign-in events. Only available in VertiGIS Studio * Mobile. */ export interface SignInEventArgs { /** * The authentication method used for the sign in process. Not available in * VertiGIS Studio Web. */ authenticationType: AuthenticationType; /** * Information about the resource that is required to sign in. Not available * in VertiGIS Studio Web. Will be an instance of * esri.security.CredentialRequestInfo for VertiGIS Studio Mobile. */ requestInfo: unknown; /** * The type of Portal: AGOL or Enterprise. */ portalType: PortalType; } /** * The type of Portal. */ export type PortalType = "ArcGISEnterprise" | "AGOL"; /** * Arguments for the auth.sign-in-completed and auth.portal-sign-in-completed * events. Only available in VertiGIS Studio Mobile. */ export interface SignInCompletedEventArgs { /** * The identity that was obtained from the sign in. */ identity: ArcGISPortalIdentity; } /** * Arguments for the auth.sign-in-failed event. Only available in the VertiGIS * Studio Mobile Viewer. */ export interface SignInFailedEventArgs extends SignInEventArgs { /** * The exception that occurred during the sign in. Not available in VertiGIS * Studio Web. */ exception: unknown; } export declare class AuthCommands extends CommandRegistry { protected readonly _prefix = "auth"; /** * Initiates user sign-in if they aren't already signed in. The argument * indicates whether or not the map should be reloaded when the sign-in is * complete. This argument is optional and only supported by VertiGIS Studio * Mobile. */ get signIn(): Command<boolean | void>; /** * Signs the user out. The argument indicates whether or not the map should * be reloaded when the sign-out is complete. This argument is optional and * only supported by VertiGIS Studio Mobile. */ get signOut(): Command<boolean | void>; } export declare class AuthOperations extends OperationRegistry { protected readonly _prefix = "auth"; /** * Gets the user that is currently signed into the application. */ get getCurrentUser(): Operation<void, Principal>; /** * Looks for an existing Esri credential. Does not prompt the user to sign * in if credential cannot be found. Mobile only. * * @mobileOnly */ get getExistingCredential(): Operation<CredentialRequestInfo, Credential>; /** * Check if sign-in is currently supported by the authentication manager. * Web only. * * @webOnly */ get isSignInAvailable(): Operation<void, boolean>; } export declare class AuthEvents extends EventRegistry { protected readonly _prefix = "auth"; /** * Raised when the user cancels a sign-in challenge. Mobile only. * * @mobileOnly */ get signInCancelled(): Event<SignInEventArgs>; /** * Raised when successfully signed in. Principal event type used in Web, * SignInCompletedEventArgs used in Mobile. */ get signInCompleted(): Event<Principal | SignInCompletedEventArgs>; /** * Raised when the user has signed into a Portal (AGOL or Portal for * ArcGIS). Mobile only. * * @mobileOnly */ get portalSignInCompleted(): Event<SignInCompletedEventArgs>; /** * Raised when a sign-in attempt fails. */ get signInFailed(): Event<SignInFailedEventArgs | void>; /** * Raised when the user requests a sign-in. */ get signInRequested(): Event<SignInEventArgs | void>; /** * Raised when the user is signed out. */ get signOutCompleted(): Event; /** * Raised when the user requests a sign-out. */ get signOutRequested(): Event; /** * Raised when the user's token is refreshed. Will be the new token in the * VertiGIS Studio Web, and a TokenCredential object in VertiGIS Studio * Mobile. */ get tokenRefreshed(): Event<string>; }