Frodo Library - v5.0.0-47
    Preparing search index...

    Type Alias State

    type State = {
        getActiveCredentialSource(): CredentialType;
        getAdminClientId(): string;
        getAdminClientRedirectUri(): string;
        getAirGapped(): boolean;
        getAlias(): string;
        getAllowInsecureConnection(): boolean;
        getAmBearerTokenAcceptanceProbed(): boolean;
        getAmCredentialProvider(): AmCredentialProvider;
        getAmsterPrivateKey(): string;
        getAmVersion(): string;
        getAuthenticationHeaderOverrides(): Record<string, string>;
        getAuthenticationService(): string;
        getAuthMode(): "interactive" | "noninteractive";
        getAutoRefreshTimer(): Timeout;
        getAxiosRetryConfig(): IAxiosRetryConfig;
        getBearerToken(): string;
        getBearerTokenMeta(): AccessTokenMetaType;
        getBrowserLoginClientId(): string;
        getBrowserLoginScope(): string;
        getCallerTrustTier(): "full-trust" | "delegated";
        getCallerTrustTierResolver(): CallerTrustTierResolver;
        getColorTheme(): "dark" | "light";
        getConfigurationHeaderOverrides(): Record<string, string>;
        getConnectionProfilesPath(): string;
        getCookieName(): string;
        getCookieValue(): string;
        getCreateProgressHandler(): (
            type: ProgressIndicatorType,
            total?: number,
            message?: string,
        ) => string;
        getCurlirize(): boolean;
        getCurlirizeHandler(): (message: string) => void;
        getCurlirizeSecrets(): boolean;
        getDebug(): boolean;
        getDebugHandler(): (message: string | object) => void;
        getDefaultCredential(): "svcacct" | "user" | "amster";
        getDeploymentType(): string;
        getDirectory(): string;
        getEnv(key: string): string;
        getEnvs(): Record<string, string>;
        getErrorHandler(): (error: Error, message?: string) => void;
        getFeatures(): FeatureInterface[];
        getForceUpdate(): boolean;
        getFrodoVersion(): string;
        getHost(): string;
        getIdmHost(): string;
        getIdmVersion(): string;
        getIdToken(): string;
        getIsIGA(): boolean;
        getIsPingFed(): boolean;
        getLogApiKey(): string;
        getLogApiSecret(): string;
        getMasterKeyPath(): string;
        getNeedsReauthentication(): boolean;
        getOutputFile(): string;
        getPassword(): string;
        getPfBearerToken(): string;
        getPfBearerTokenMeta(): AccessTokenMetaType;
        getPreferredCredential(): CredentialType;
        getPreferredDeviceFlow(): boolean;
        getPrintHandler(): (
            message: string | object,
            type?: string,
            newline?: boolean,
        ) => void;
        getPrivilegeEscalationHandler(): () => Promise<boolean>;
        getRealm(): string;
        getRefreshToken(): string;
        getRejectedCredentialHandler(): RejectedCredentialHandler;
        getServiceAccountId(): string;
        getServiceAccountJwk(): JwkRsa;
        getServiceAccountScope(): string;
        getState(): StateInterface;
        getStopProgressHandler(): (
            id: string,
            message: string,
            status?: ProgressIndicatorStatusType,
        ) => void;
        getTemplateCatalogCachePath(): string;
        getTenant(): string;
        getTokenCachePath(): string;
        getTokenRefreshHandler(): TokenRefreshHandler;
        getUpdateProgressHandler(): (id: string, message: string) => void;
        getUseBearerTokenForAmApis(): boolean;
        getUseProcessEnvironmentForPlaceholders(): boolean;
        getUseRealmPrefixOnManagedObjects(): boolean;
        getUsername(): string;
        getUserSessionTokenMeta(): UserSessionMetaType;
        getUseTemplateCatalogCache(): boolean;
        getUseTokenCache(): boolean;
        getVerbose(): boolean;
        getVerboseHandler(): (message: string | object) => void;
        reset(): void;
        setActiveCredentialSource(source: CredentialType): void;
        setAdminClientId(type: string): void;
        setAdminClientRedirectUri(type: string): void;
        setAirGapped(airGapped: boolean): void;
        setAlias(alias: string): void;
        setAllowInsecureConnection(allowInsecureConnection: boolean): void;
        setAmBearerTokenAcceptanceProbed(probed: boolean): void;
        setAmCredentialProvider(provider: AmCredentialProvider): void;
        setAmsterPrivateKey(key: string): void;
        setAmVersion(version: string): void;
        setAuthenticationHeaderOverrides(overrides: Record<string, string>): void;
        setAuthenticationService(service: string): void;
        setAuthMode(authMode: "interactive" | "noninteractive"): void;
        setAutoRefreshTimer(timer: Timeout): void;
        setAxiosRetryConfig(axiosRetryConfig: IAxiosRetryConfig): void;
        setAxiosRetryStrategy(strategy: RetryStrategy): void;
        setBearerTokenMeta(token: AccessTokenMetaType): void;
        setBrowserLoginClientId(clientId: string): void;
        setBrowserLoginScope(scope: string): void;
        setCallerTrustTier(tier: "full-trust" | "delegated"): void;
        setCallerTrustTierResolver(resolver: CallerTrustTierResolver): void;
        setColorTheme(theme: "dark" | "light"): void;
        setConfigurationHeaderOverrides(overrides: Record<string, string>): void;
        setConnectionProfilesPath(path: string): void;
        setCookieName(name: string): void;
        setCreateProgressHandler(
            handler: (
                type: ProgressIndicatorType,
                total?: number,
                message?: string,
            ) => string,
        ): void;
        setCurlirize(curlirize: boolean): void;
        setCurlirizeHandler(handler: (message: string) => void): void;
        setCurlirizeSecrets(curlirizeSecrets: boolean): void;
        setDebug(debug: boolean): void;
        setDebugHandler(handler: (message: string | object) => void): void;
        setDefaultCredential(
            defaultCredential: "svcacct" | "user" | "amster",
        ): void;
        setDeploymentType(type: string): void;
        setDirectory(directory: string): void;
        setEnv(key: string, value: string): void;
        setEnvs(env: Record<string, string>, clear?: boolean): void;
        setErrorHandler(handler: (error: Error, message?: string) => void): void;
        setFeatures(features: FeatureInterface[]): void;
        setForceUpdate(forceUpdate: boolean): void;
        setFrodoVersion(version: string): void;
        setHost(host: string): void;
        setIdmHost(host: string): void;
        setIdmVersion(version: string): void;
        setIdToken(token: string): void;
        setIsIGA(isIGA: boolean): void;
        setIsPingFed(isPingFed: boolean): void;
        setLogApiKey(key: string): void;
        setLogApiSecret(secret: string): void;
        setMasterKeyPath(path: string): void;
        setNeedsReauthentication(needsReauthentication: boolean): void;
        setOutputFile(file: string): void;
        setPassword(password: string): void;
        setPfBearerTokenMeta(token: AccessTokenMetaType): void;
        setPreferredCredential(preferredCredential: CredentialType): void;
        setPreferredDeviceFlow(preferredDeviceFlow: boolean): void;
        setPrintHandler(
            handler: (
                message: string | object,
                type?: string,
                newline?: boolean,
            ) => void,
        ): void;
        setPrivilegeEscalationHandler(handler: () => Promise<boolean>): void;
        setRealm(realm: string): void;
        setRefreshToken(token: string): void;
        setRejectedCredentialHandler(handler: RejectedCredentialHandler): void;
        setServiceAccountId(uuid: string): void;
        setServiceAccountJwk(jwk: JwkRsa): void;
        setServiceAccountScope(scope: string): void;
        setStopProgressHandler(
            handler: (
                id: string,
                message: string,
                status?: ProgressIndicatorStatusType,
            ) => void,
        ): void;
        setTemplateCatalogCachePath(path: string): void;
        setTenant(tenant: string): void;
        setTokenCachePath(path: string): void;
        setTokenRefreshHandler(handler: TokenRefreshHandler): void;
        setUpdateProgressHandler(
            handler: (id: string, message: string) => void,
        ): void;
        setUseBearerTokenForAmApis(useBearerTokenForAmApis: boolean): void;
        setUseProcessEnvironmentForPlaceholders(use: boolean): void;
        setUseRealmPrefixOnManagedObjects(
            useRealmPrefixOnManagedObjects: boolean,
        ): void;
        setUsername(username: string): void;
        setUserSessionTokenMeta(value: UserSessionMetaType): void;
        setUseTemplateCatalogCache(useTemplateCatalogCache: boolean): void;
        setUseTokenCache(useTokenCache: boolean): void;
        setVerbose(verbose: boolean): void;
        setVerboseHandler(handler: (message: string | object) => void): void;
    }
    Index
    getActiveCredentialSource getAdminClientId getAdminClientRedirectUri getAirGapped getAlias getAllowInsecureConnection getAmBearerTokenAcceptanceProbed getAmCredentialProvider getAmsterPrivateKey getAmVersion getAuthenticationHeaderOverrides getAuthenticationService getAuthMode getAutoRefreshTimer getAxiosRetryConfig getBearerToken getBearerTokenMeta getBrowserLoginClientId getBrowserLoginScope getCallerTrustTier getCallerTrustTierResolver getColorTheme getConfigurationHeaderOverrides getConnectionProfilesPath getCookieName getCookieValue getCreateProgressHandler getCurlirize getCurlirizeHandler getCurlirizeSecrets getDebug getDebugHandler getDefaultCredential getDeploymentType getDirectory getEnv getEnvs getErrorHandler getFeatures getForceUpdate getFrodoVersion getHost getIdmHost getIdmVersion getIdToken getIsIGA getIsPingFed getLogApiKey getLogApiSecret getMasterKeyPath getNeedsReauthentication getOutputFile getPassword getPfBearerToken getPfBearerTokenMeta getPreferredCredential getPreferredDeviceFlow getPrintHandler getPrivilegeEscalationHandler getRealm getRefreshToken getRejectedCredentialHandler getServiceAccountId getServiceAccountJwk getServiceAccountScope getState getStopProgressHandler getTemplateCatalogCachePath getTenant getTokenCachePath getTokenRefreshHandler getUpdateProgressHandler getUseBearerTokenForAmApis getUseProcessEnvironmentForPlaceholders getUseRealmPrefixOnManagedObjects getUsername getUserSessionTokenMeta getUseTemplateCatalogCache getUseTokenCache getVerbose getVerboseHandler reset setActiveCredentialSource setAdminClientId setAdminClientRedirectUri setAirGapped setAlias setAllowInsecureConnection setAmBearerTokenAcceptanceProbed setAmCredentialProvider setAmsterPrivateKey setAmVersion setAuthenticationHeaderOverrides setAuthenticationService setAuthMode setAutoRefreshTimer setAxiosRetryConfig setAxiosRetryStrategy setBearerTokenMeta setBrowserLoginClientId setBrowserLoginScope setCallerTrustTier setCallerTrustTierResolver setColorTheme setConfigurationHeaderOverrides setConnectionProfilesPath setCookieName setCreateProgressHandler setCurlirize setCurlirizeHandler setCurlirizeSecrets setDebug setDebugHandler setDefaultCredential setDeploymentType setDirectory setEnv setEnvs setErrorHandler setFeatures setForceUpdate setFrodoVersion setHost setIdmHost setIdmVersion setIdToken setIsIGA setIsPingFed setLogApiKey setLogApiSecret setMasterKeyPath setNeedsReauthentication setOutputFile setPassword setPfBearerTokenMeta setPreferredCredential setPreferredDeviceFlow setPrintHandler setPrivilegeEscalationHandler setRealm setRefreshToken setRejectedCredentialHandler setServiceAccountId setServiceAccountJwk setServiceAccountScope setStopProgressHandler setTemplateCatalogCachePath setTenant setTokenCachePath setTokenRefreshHandler setUpdateProgressHandler setUseBearerTokenForAmApis setUseProcessEnvironmentForPlaceholders setUseRealmPrefixOnManagedObjects setUsername setUserSessionTokenMeta setUseTemplateCatalogCache setUseTokenCache setVerbose setVerboseHandler
    • Whether air-gapped mode is on (see setAirGapped).

      Returns boolean

      true if setAirGapped(true) was called

    • Returns Record<string, string>

    • Returns "interactive" | "noninteractive"

    • Returns IAxiosRetryConfig

    • Returns "full-trust" | "delegated"

    • Returns Record<string, string>

    • Whether the curl commands are printed.

      Returns boolean

      true if setCurlirize(true) was called

    • Returns (message: string) => void

    • Whether the curl commands show the real credentials.

      Returns boolean

      true if setCurlirizeSecrets(true) was called

    • Returns (message: string | object) => void

    • Returns "svcacct" | "user" | "amster"

      since v4.9.0 — use getPreferredCredential() instead.

    • Parameters

      • key: string

      Returns string

    • Returns Record<string, string>

    • Returns (error: Error, message?: string) => void

    • Get the AM host base URL

      Returns string

      the AM host base URL

    • Get the IDM host base URL

      Returns string

      the IDM host base URL

    • Returns (message: string | object, type?: string, newline?: boolean) => void

    • Returns () => Promise<boolean>

    • Get a clone of the full state as an object. The clone is plain data that JSON.stringify accepts: it has no auto-refresh timer (a live timer is circular; getAutoRefreshTimer() returns it) and no functions. It holds the credentials and tokens the state holds, as they are, so do not log it.

      Returns StateInterface

      a clone of the state

    • Get the directory that was set for the cache of the application template catalog.

      Returns string

      the directory that was set, or undefined if none was (the library then uses ~/.frodo/AppTemplates)

    • Returns string

      since v0.17.0 use getHost instead

    • Returns (id: string, message: string) => void

    • Whether the fallback of placeholders to the environment of the process is on (see setUseProcessEnvironmentForPlaceholders).

      Returns boolean

      true if setUseProcessEnvironmentForPlaceholders(true) was called

    • Whether the cache of the application template catalog is on.

      Returns boolean

      true if setUseTemplateCatalogCache(true) was called

    • Returns (message: string | object) => void

    • Reset the state to default values. The environment values (setEnv, setEnvs) are removed.

      Returns void

    • Which credential type is currently active for this session — set once, wherever getTokens()'s non-interactive branches (or a browser login) actually activate a credential. Used by ops/PrivilegeEscalationOps.ts to know where on the escalation ladder the current session sits.

      Parameters

      Returns void

    • Parameters

      • type: string

      Returns void

    • Parameters

      • type: string

      Returns void

    • Turn air-gapped mode on or off. While it is on, the library makes no request to a host that the caller did not name: the tenant the state is connected to is not affected, but a function that would download from a public host on its own (for example the default source of the application template catalog) fails with an error instead, and says that the data must be given explicitly. A caller that names a host itself (for example the URL of a mirror) is not blocked. Off by default and not persisted: the state does not read it from the environment, a connection profile or a file, so the caller (frodo-cli, the MCP server) decides every time.

      Parameters

      • airGapped: boolean

        true to turn air-gapped mode on

      Returns void

    • Parameters

      • alias: string

      Returns void

    • Parameters

      • allowInsecureConnection: boolean

      Returns void

    • Parameters

      • probed: boolean

      Returns void

    • Parameters

      • key: string

      Returns void

    • Parameters

      • version: string

      Returns void

    • Parameters

      • overrides: Record<string, string>

      Returns void

    • Parameters

      • service: string

      Returns void

    • Parameters

      • authMode: "interactive" | "noninteractive"

      Returns void

    • Parameters

      • timer: Timeout

      Returns void

    • Parameters

      • axiosRetryConfig: IAxiosRetryConfig

      Returns void

    • Parameters

      • clientId: string

      Returns void

    • Parameters

      • scope: string

      Returns void

    • Cached for the life of the session by determineCallerTrustTier() (ops/CallerTrustTierOps.ts).

      Parameters

      • tier: "full-trust" | "delegated"

      Returns void

    • Parameters

      • theme: "dark" | "light"

      Returns void

    • Parameters

      • overrides: Record<string, string>

      Returns void

    • Parameters

      • path: string

      Returns void

    • Parameters

      • name: string

      Returns void

    • Parameters

      Returns void

    • Print the curl command of every REST call the library makes (the handler set with setCurlirizeHandler receives it). Off by default.

      By default the command shows the name of every header that carries a credential and replaces its value with a placeholder (-H "Authorization:Bearer <redacted>", -H "Cookie:iPlanetDirectoryPro=<redacted>"), and does the same for the password, token and secret fields of a request body. The header overrides (setAuthenticationHeaderOverrides, setConfigurationHeaderOverrides) are all masked. To see the real values, call setCurlirizeSecrets(true).

      Parameters

      • curlirize: boolean

        true to print the curl commands

      Returns void

    • Parameters

      • handler: (message: string) => void

      Returns void

    • Show the real credentials in the curl commands (see setCurlirize), so that a command can be copied and run. Off by default and never persisted: the state does not read it from the environment, a connection profile or a file, so a caller has to ask for it every time. The first time a command with a credential is printed, the print handler also gets one warning (type warn) that the output contains valid credentials.

      Parameters

      • curlirizeSecrets: boolean

        true to print real credentials

      Returns void

    • Parameters

      • debug: boolean

      Returns void

    • Parameters

      • handler: (message: string | object) => void

      Returns void

    • Parameters

      • defaultCredential: "svcacct" | "user" | "amster"

      Returns void

      since v4.9.0 — use setPreferredCredential()/ getPreferredCredential() instead, which also support 'browser'. Kept working, unchanged, for external callers still typed against the 3-value union: getDefaultCredential() defensively filters out 'browser' (returning undefined instead) so it can never hand back a value outside its own declared type, even though it now shares storage with the wider preferredCredential.

    • Parameters

      • type: string

      Returns void

    • Parameters

      • directory: string

      Returns void

    • Parameters

      • key: string
      • value: string

      Returns void

    • Parameters

      • env: Record<string, string>
      • Optionalclear: boolean

      Returns void

    • Parameters

      • handler: (error: Error, message?: string) => void

      Returns void

    • Parameters

      • forceUpdate: boolean

      Returns void

    • Parameters

      • version: string

      Returns void

    • Set the AM host base URL

      Parameters

      • host: string

        Access Management base URL, e.g.: https://cdk.iam.example.com/am. To use a connection profile, just specify a unique substring or alias.

      Returns void

    • Parameters

      • version: string

      Returns void

    • Parameters

      • token: string

      Returns void

    • Parameters

      • isIGA: boolean

      Returns void

    • Parameters

      • isPingFed: boolean

      Returns void

    • Parameters

      • key: string

      Returns void

    • Parameters

      • secret: string

      Returns void

    • Parameters

      • path: string

      Returns void

    • Parameters

      • needsReauthentication: boolean

      Returns void

    • Parameters

      • file: string

      Returns void

    • Parameters

      • password: string

      Returns void

    • Explicit, persisted preference for which credential type later implicit commands against this profile should use — 'browser' included, unlike the deprecated defaultCredential accessors below. An undefined value means "no preference set," not "none of the above." Never mirrors ambient session state on save; only ever written when the caller explicitly requests it (e.g. via --preferred-credential), so an unrelated save never silently overwrites a previously-configured preference — and, when explicitly set, takes priority over a stale legacy authMode: 'interactive' a profile may already carry (the fix for there previously being no way to undo that once persisted). Backed by the same underlying storage defaultCredential uses below — the two are two typed views onto one value, not two separate fields. See AuthenticateOps.ts's tryBrowserLogin()/getTokens() for how this is consulted.

      Parameters

      Returns void

    • Only meaningful when preferredCredential === 'browser': whether this profile prefers the OAuth2 Device Authorization Grant over the default loopback-redirect flow for its interactive logins, without needing --device repeated on every invocation. undefined means no preference set (falls back to whatever --device/the env var says for that one invocation, exactly like today).

      Parameters

      • preferredDeviceFlow: boolean

      Returns void

    • Parameters

      • handler: (message: string | object, type?: string, newline?: boolean) => void

      Returns void

    • Extension point letting api/BaseApi.ts trigger a credential-privilege escalation without importing ops/AuthenticateOps.ts directly (would be circular — AuthenticateOps.ts already depends on BaseApi.ts transitively). Installed once by getTokens() after the initial credential activates; called by attachCredentialInterceptor() when a pre-flight scope check fails. Resolves true if a higher-tier credential was found and activated (the failed request should be retried), false if there is nothing left to escalate to.

      Parameters

      • handler: () => Promise<boolean>

      Returns void

    • Parameters

      • realm: string

      Returns void

    • Parameters

      • token: string

      Returns void

    • Parameters

      • uuid: string

      Returns void

    • Parameters

      • scope: string

      Returns void

    • Set the directory of the cache of the application template catalog. When it is not set, the library uses the folder AppTemplates in the Frodo home directory (~/.frodo/AppTemplates), the way the token cache finds its file.

      Parameters

      • path: string

        directory of the cache

      Returns void

    • Parameters

      • tenant: string

      Returns void

      since v0.17.0 use setHost(host: string) instead

    • Parameters

      • path: string

      Returns void

    • Parameters

      • handler: (id: string, message: string) => void

      Returns void

    • Parameters

      • useBearerTokenForAmApis: boolean

      Returns void

    • Let the placeholders ${NAME} of the files that the library reads (readJsonFile, and the readers built on it, with placeholders resolved) fall back to the environment variables of the process: a placeholder is filled from the value that this state holds for the name (setEnv, setEnvs) and, only when the state holds none, from the variable of that name in the environment of the process. A name that has no value in either still fails with the error that names the placeholder. An empty value counts as a value.

      Off by default and not persisted: the state does not read the switch from the environment, a connection profile or a file, so the caller decides every time. It is off because a file that names ${SOME_VARIABLE} would otherwise copy a variable of the process into whatever the file is written to, and the library is embedded in programs that run with environments of their own. It changes nothing for a caller that does not turn it on.

      The reverse direction never reads the process environment, switch or not: an export replaces the values that this state holds with their ${NAME} placeholder, and nothing else. The substitution of the configuration objects of IDM when they are imported (importConfigEntities) also uses the values of the state only, because those objects may legitimately contain ${...} in the source of a script.

      Parameters

      • use: boolean

        true to turn the fallback on

      Returns void

    • Parameters

      • useRealmPrefixOnManagedObjects: boolean

      Returns void

    • Parameters

      • username: string

      Returns void

    • Turn the cache of the application template catalog on or off. While it is on, app.template.readCatalog (and the functions that read the catalog) keep the catalog they download from the public source in a directory (setTemplateCatalogCachePath), do not ask the source again while the kept copy is fresh, ask it with the validators of the kept copy when it is not, and read the kept copy when air-gapped mode is on. A catalog the caller hands over and a URL the caller names are never kept. Off by default and not read from the environment, a profile or a file: the caller decides.

      Parameters

      • useTemplateCatalogCache: boolean

        true to turn the cache on

      Returns void

    • Parameters

      • useTokenCache: boolean

      Returns void

    • Parameters

      • verbose: boolean

      Returns void

    • Parameters

      • handler: (message: string | object) => void

      Returns void