@microsoft/teams.apps
Version:
<p> <a href="https://www.npmjs.com/package/@microsoft/teams.apps" target="_blank"> <img src="https://img.shields.io/npm/v/@microsoft/teams.apps/latest" /> </a> <a href="https://www.npmjs.com/package/@microsoft/teams.apps?activeTab=code
57 lines (56 loc) • 2.25 kB
TypeScript
import type { TokenStatus } from '@microsoft/teams.api';
import type { Client as HttpClient, EventEmitter } from '@microsoft/teams.common';
import type { IActivityContext } from '../contexts';
import type { Router } from '../router';
import type { AppEvents, IPlugin } from '../types';
import type { PluginAdditionalContext } from '../types/app-routing';
import { OAuthFlow } from '.';
type OAuthFlowRegistryOptions<TPlugin extends IPlugin> = {
readonly defaultConnectionName?: string;
readonly router: Router<PluginAdditionalContext<TPlugin>>;
readonly client: HttpClient;
readonly events: EventEmitter<AppEvents<TPlugin>>;
readonly graphBaseUrl?: string;
};
/**
* Owns either the legacy default OAuth flow or registered flows.
*/
export declare class OAuthFlowRegistry<TPlugin extends IPlugin = IPlugin> {
private readonly flows;
private usesRegisteredFlows;
/**
* Creates the registry and installs routes for all flows.
*
* Omitting `defaultConnectionName` starts the registry in registered-flow mode.
*/
constructor(options: OAuthFlowRegistryOptions<TPlugin>);
/**
* Adds a flow. The first registration removes the legacy
* implicit flow; subsequent additions of the same name are rejected.
*/
add(flow: OAuthFlow<TPlugin>): void;
/**
* Resolves a flow by connection name.
*/
get(connectionName: string): OAuthFlow<TPlugin>;
/** Returns every flow in the active legacy or registered-flow mode. */
getAll(): OAuthFlow<TPlugin>[];
/**
* Gets and corrects token-service status for every registered connection.
*
* Silent SSO can leave the status endpoint stale, so disconnected or omitted
* flows are checked directly for a cached token.
*/
getConnectionStatus(context: IActivityContext): Promise<TokenStatus[]>;
/**
* Validates a connection before a deprecated context OAuth helper runs.
*/
validate(connectionName: string, connectionNameProvided: boolean): void;
/**
* Records pending attribution for a flow.
*/
recordPending(context: IActivityContext, connectionName: string, supportsSso: boolean): void;
private registerRoutes;
private normalize;
}
export {};