Abstraction that holds a UserSession, along with getters to streamline access to various platform urls, and common constructs like IRequestOptions, IUserRequestOptions etc.

Instances are intended to be immutable, but this is not directly enforced.

In most circumstances, this class should be created by the ArcGISContextManager class.



Constructor Parameters

Parameter Type Default Notes
opts Required IArcGISContextOptions


Property Type Notes
id number

Unique id from the ArcGISContextManager that created this instance. Primarily useful for debugging possible race-conditions that can result in multiple ArcGISContextManager instances being created.


Accessor Type Notes
communityOrgHostname string

Returns the Hub Community Org Hostname, if defined

communityOrgId string

Return the Hub Community Org Id, if defined

communityOrgUrl string

Returns the Hub Community Org url

currentUser IUser

Returns the current user as IUser

discussionsServiceUrl string

Returns the discussions API URL

domainServiceUrl string

Returns Hub Domain Service URL

eventsConfig any

Returns the Events configuration object from portal/self

helperServices any

Returns the hash of helper services from portal self

hubEnabled boolean

Returns boolean indicating if the current user belongs to an organization that has licensed ArcGIS Hub

hubHomeUrl string

Returns the current user's hub-home url. If not authenticated, returns the Hub Url. If portal, returns undefined

hubLicense HubLicense

Returns the current user's Hub License

hubRequestOptions IHubRequestOptions

Return a IHubRequestOptions object

hubSearchServiceUrl string

Returns the Hub Search API URL

hubUrl string

Returns the Hub url, based on the portalUrl

isAlphaOrg boolean

Is the users org in the alpha orgs list? Alpha orgs are passed in via properties.alphaOrgs

isAuthenticated boolean

Return boolean indicating if authenticatio is present

isPortal boolean

Returns boolean indicating if the backing system is ArcGIS Enterprise (formerly ArcGIS Portal) or not

portal IPortal

Returns the portal object as IPortal

portalUrl string

Return the portal url i.e.

properties Record<stringany>

Return the properties hash that was passed in. Useful for app-specific context such as the active Site for ArcGIS Hub

requestOptions IRequestOptions

Return IRequestOptions, which is used by REST-JS functions which may use authentication information if provided.

session UserSession

Return the UserSession if authenticated

sharingApiUrl string

Returns the url to the sharing api composed from portalUrl i.e.

systemStatus HubSystemStatus

Returns the current hub system status information

userRequestOptions IUserRequestOptions

Return IUserRequestOptions, which is used for REST-JS functions which require authentication information.

Class defined in common/src/ArcGISContext.ts:235