Skip to content

Latest commit

 

History

History
561 lines (499 loc) · 18.3 KB

container-definitions.api.md

File metadata and controls

561 lines (499 loc) · 18.3 KB

API Report File for "@fluidframework/container-definitions"

Do not edit this file. It is a report generated by API Extractor.

import { ConnectionMode } from '@fluidframework/protocol-definitions';
import { EventEmitter } from 'events';
import { FluidObject } from '@fluidframework/core-interfaces';
import { IClient } from '@fluidframework/protocol-definitions';
import { IClientConfiguration } from '@fluidframework/protocol-definitions';
import { IClientDetails } from '@fluidframework/protocol-definitions';
import { IDisposable } from '@fluidframework/common-definitions';
import { IDocumentMessage } from '@fluidframework/protocol-definitions';
import { IDocumentStorageService } from '@fluidframework/driver-definitions';
import { IErrorEvent } from '@fluidframework/common-definitions';
import { IEvent } from '@fluidframework/common-definitions';
import { IEventProvider } from '@fluidframework/common-definitions';
import { IFluidRouter } from '@fluidframework/core-interfaces';
import { IQuorumClients } from '@fluidframework/protocol-definitions';
import { IRequest } from '@fluidframework/core-interfaces';
import { IResolvedUrl } from '@fluidframework/driver-definitions';
import { IResponse } from '@fluidframework/core-interfaces';
import { ISequencedDocumentMessage } from '@fluidframework/protocol-definitions';
import { ISequencedProposal } from '@fluidframework/protocol-definitions';
import { ISignalClient } from '@fluidframework/protocol-definitions';
import { ISignalMessage } from '@fluidframework/protocol-definitions';
import { ISnapshotTree } from '@fluidframework/protocol-definitions';
import { ISummaryContent } from '@fluidframework/protocol-definitions';
import { ISummaryTree } from '@fluidframework/protocol-definitions';
import { ITelemetryBaseLogger } from '@fluidframework/common-definitions';
import { ITelemetryProperties } from '@fluidframework/common-definitions';
import { ITokenClaims } from '@fluidframework/protocol-definitions';
import { IVersion } from '@fluidframework/protocol-definitions';
import { MessageType } from '@fluidframework/protocol-definitions';

// @public
export enum AttachState {
    Attached = "Attached",
    Attaching = "Attaching",
    Detached = "Detached"
}

// @public
export namespace ConnectionState {
    export type CatchingUp = 1;
    export type Connected = 2;
    export type Disconnected = 0;
    export type EstablishingConnection = 3;
}

// @public
export type ConnectionState = ConnectionState.Disconnected | ConnectionState.EstablishingConnection | ConnectionState.CatchingUp | ConnectionState.Connected;

// @public
export enum ContainerErrorType {
    clientSessionExpiredError = "clientSessionExpiredError",
    dataCorruptionError = "dataCorruptionError",
    dataProcessingError = "dataProcessingError",
    genericError = "genericError",
    throttlingError = "throttlingError",
    usageError = "usageError"
}

// @public
export interface ContainerWarning extends IErrorBase {
    logged?: boolean;
}

// @public
export interface IAudience extends EventEmitter {
    getMember(clientId: string): IClient | undefined;
    getMembers(): Map<string, IClient>;
    on(event: "addMember" | "removeMember", listener: (clientId: string, client: IClient) => void): this;
}

// @public
export interface IAudienceOwner extends IAudience {
    addMember(clientId: string, details: IClient): void;
    removeMember(clientId: string): boolean;
}

// @public
export interface IBatchMessage {
    // (undocumented)
    compression?: string;
    // (undocumented)
    contents?: string;
    // (undocumented)
    metadata: Record<string, unknown> | undefined;
    // (undocumented)
    referenceSequenceNumber?: number;
}

// @public @deprecated
export interface ICodeAllowList {
    // @deprecated (undocumented)
    testSource(source: IResolvedFluidCodeDetails): Promise<boolean>;
}

// @public
export interface ICodeDetailsLoader extends Partial<IProvideFluidCodeDetailsComparer> {
    load(source: IFluidCodeDetails): Promise<IFluidModuleWithDetails>;
}

// @public
export interface IConnectionDetails {
    checkpointSequenceNumber: number | undefined;
    // (undocumented)
    claims: ITokenClaims;
    // (undocumented)
    clientId: string;
    // @deprecated (undocumented)
    existing: boolean;
    // @deprecated (undocumented)
    initialClients: ISignalClient[];
    // @deprecated (undocumented)
    mode: ConnectionMode;
    // (undocumented)
    serviceConfiguration: IClientConfiguration;
    // @deprecated (undocumented)
    version: string;
}

// @public
export interface IContainer extends IEventProvider<IContainerEvents>, IFluidRouter {
    attach(request: IRequest): Promise<void>;
    readonly attachState: AttachState;
    readonly audience: IAudience;
    readonly clientId?: string | undefined;
    close(error?: ICriticalContainerError): void;
    closeAndGetPendingLocalState(): string;
    readonly closed: boolean;
    connect(): void;
    readonly connectionState: ConnectionState;
    deltaManager: IDeltaManager<ISequencedDocumentMessage, IDocumentMessage>;
    disconnect(): void;
    dispose?(error?: ICriticalContainerError): void;
    // @alpha
    forceReadonly?(readonly: boolean): any;
    getAbsoluteUrl(relativeUrl: string): Promise<string | undefined>;
    getLoadedCodeDetails(): IFluidCodeDetails | undefined;
    getQuorum(): IQuorumClients;
    getSpecifiedCodeDetails(): IFluidCodeDetails | undefined;
    readonly isDirty: boolean;
    proposeCodeDetails(codeDetails: IFluidCodeDetails): Promise<boolean>;
    readonly readOnlyInfo: ReadOnlyInfo;
    request(request: IRequest): Promise<IResponse>;
    resolvedUrl: IResolvedUrl | undefined;
    serialize(): string;
}

// @public
export interface IContainerContext extends IDisposable {
    readonly attachState: AttachState;
    // (undocumented)
    readonly audience: IAudience | undefined;
    // (undocumented)
    readonly baseSnapshot: ISnapshotTree | undefined;
    // (undocumented)
    readonly clientDetails: IClientDetails;
    // (undocumented)
    readonly clientId: string | undefined;
    // (undocumented)
    readonly closeFn: (error?: ICriticalContainerError) => void;
    // (undocumented)
    readonly connected: boolean;
    // (undocumented)
    readonly deltaManager: IDeltaManager<ISequencedDocumentMessage, IDocumentMessage>;
    // (undocumented)
    readonly disposeFn?: (error?: ICriticalContainerError) => void;
    // @deprecated (undocumented)
    readonly existing: boolean | undefined;
    getAbsoluteUrl?(relativeUrl: string): Promise<string | undefined>;
    // (undocumented)
    getLoadedFromVersion(): IVersion | undefined;
    // @deprecated (undocumented)
    getSpecifiedCodeDetails?(): IFluidCodeDetails | undefined;
    readonly id: string;
    // (undocumented)
    readonly loader: ILoader;
    // (undocumented)
    readonly options: ILoaderOptions;
    // (undocumented)
    pendingLocalState?: unknown;
    // (undocumented)
    readonly quorum: IQuorumClients;
    readonly scope: FluidObject;
    // (undocumented)
    readonly serviceConfiguration: IClientConfiguration | undefined;
    // (undocumented)
    readonly storage: IDocumentStorageService;
    // (undocumented)
    readonly submitBatchFn: (batch: IBatchMessage[], referenceSequenceNumber?: number) => number;
    // @deprecated (undocumented)
    readonly submitFn: (type: MessageType, contents: any, batch: boolean, appData?: any) => number;
    // (undocumented)
    readonly submitSignalFn: (contents: any) => void;
    // (undocumented)
    readonly submitSummaryFn: (summaryOp: ISummaryContent, referenceSequenceNumber?: number) => number;
    // (undocumented)
    readonly taggedLogger: ITelemetryBaseLogger;
    // (undocumented)
    updateDirtyContainerState(dirty: boolean): void;
}

// @public
export interface IContainerEvents extends IEvent {
    (event: "readonly", listener: (readonly: boolean) => void): void;
    (event: "connected", listener: (clientId: string) => void): any;
    (event: "codeDetailsProposed", listener: (codeDetails: IFluidCodeDetails, proposal: ISequencedProposal) => void): any;
    // @deprecated (undocumented)
    (event: "contextChanged", listener: (codeDetails: IFluidCodeDetails) => void): any;
    (event: "disconnected", listener: () => void): any;
    (event: "attached", listener: () => void): any;
    (event: "closed", listener: (error?: ICriticalContainerError) => void): any;
    (event: "disposed", listener: (error?: ICriticalContainerError) => void): any;
    (event: "warning", listener: (error: ContainerWarning) => void): any;
    (event: "op", listener: (message: ISequencedDocumentMessage) => void): any;
    (event: "dirty", listener: (dirty: boolean) => void): any;
    (event: "saved", listener: (dirty: boolean) => void): any;
}

// @public (undocumented)
export interface IContainerLoadMode {
    // (undocumented)
    deltaConnection?: "none" | "delayed" | undefined;
    // (undocumented)
    opsBeforeReturn?: undefined | "cached" | "all";
}

// @public
export type ICriticalContainerError = IErrorBase;

// @public
export interface IDeltaHandlerStrategy {
    process: (message: ISequencedDocumentMessage) => void;
    processSignal: (message: ISignalMessage) => void;
}

// @public
export interface IDeltaManager<T, U> extends IEventProvider<IDeltaManagerEvents>, IDeltaSender, IDisposable {
    readonly active: boolean;
    readonly clientDetails: IClientDetails;
    readonly hasCheckpointSequenceNumber: boolean;
    readonly inbound: IDeltaQueue<T>;
    readonly inboundSignal: IDeltaQueue<ISignalMessage>;
    readonly initialSequenceNumber: number;
    readonly lastKnownSeqNumber: number;
    readonly lastMessage: ISequencedDocumentMessage | undefined;
    readonly lastSequenceNumber: number;
    readonly maxMessageSize: number;
    readonly minimumSequenceNumber: number;
    readonly outbound: IDeltaQueue<U[]>;
    // (undocumented)
    readonly readOnlyInfo: ReadOnlyInfo;
    readonly serviceConfiguration: IClientConfiguration | undefined;
    submitSignal(content: any): void;
    readonly version: string;
}

// @public
export interface IDeltaManagerEvents extends IEvent {
    // @deprecated (undocumented)
    (event: "prepareSend", listener: (messageBuffer: any[]) => void): any;
    // @deprecated (undocumented)
    (event: "submitOp", listener: (message: IDocumentMessage) => void): any;
    (event: "op", listener: (message: ISequencedDocumentMessage, processingTime: number) => void): any;
    // @deprecated (undocumented)
    (event: "allSentOpsAckd", listener: () => void): any;
    // @deprecated (undocumented)
    (event: "pong", listener: (latency: number) => void): any;
    // @deprecated (undocumented)
    (event: "processTime", listener: (latency: number) => void): any;
    (event: "connect", listener: (details: IConnectionDetails, opsBehind?: number) => void): any;
    (event: "disconnect", listener: (reason: string) => void): any;
    (event: "readonly", listener: (readonly: boolean) => void): any;
}

// @public
export interface IDeltaQueue<T> extends IEventProvider<IDeltaQueueEvents<T>>, IDisposable {
    idle: boolean;
    length: number;
    pause(): Promise<void>;
    paused: boolean;
    peek(): T | undefined;
    resume(): void;
    toArray(): T[];
    waitTillProcessingDone(): Promise<{
        count: number;
        duration: number;
    }>;
}

// @public
export interface IDeltaQueueEvents<T> extends IErrorEvent {
    (event: "push", listener: (task: T) => void): any;
    (event: "op", listener: (task: T) => void): any;
    (event: "idle", listener: (count: number, duration: number) => void): any;
}

// @public
export interface IDeltaSender {
    flush(): void;
}

// @public
export interface IErrorBase extends Partial<Error> {
    readonly errorType: string;
    getTelemetryProperties?(): ITelemetryProperties;
    readonly message: string;
    readonly name?: string;
    readonly stack?: string;
}

// @public
export interface IFluidBrowserPackage extends IFluidPackage {
    // (undocumented)
    fluid: {
        browser: IFluidBrowserPackageEnvironment;
        [environment: string]: IFluidPackageEnvironment;
    };
}

// @public
export interface IFluidBrowserPackageEnvironment extends IFluidPackageEnvironment {
    umd: {
        files: string[];
        library: string;
    };
}

// @public
export interface IFluidCodeDetails {
    readonly config?: IFluidCodeDetailsConfig;
    readonly package: string | Readonly<IFluidPackage>;
}

// @public (undocumented)
export const IFluidCodeDetailsComparer: keyof IProvideFluidCodeDetailsComparer;

// @public
export interface IFluidCodeDetailsComparer extends IProvideFluidCodeDetailsComparer {
    compare(a: IFluidCodeDetails, b: IFluidCodeDetails): Promise<number | undefined>;
    satisfies(candidate: IFluidCodeDetails, constraint: IFluidCodeDetails): Promise<boolean>;
}

// @public
export interface IFluidCodeDetailsConfig {
    // (undocumented)
    readonly [key: string]: string;
}

// @public
export interface IFluidCodeResolver {
    resolveCodeDetails(details: IFluidCodeDetails): Promise<IResolvedFluidCodeDetails>;
}

// @public (undocumented)
export interface IFluidModule {
    // (undocumented)
    fluidExport: FluidObject<IRuntimeFactory & IProvideFluidCodeDetailsComparer>;
}

// @public
export interface IFluidModuleWithDetails {
    details: IFluidCodeDetails;
    module: IFluidModule;
}

// @public
export interface IFluidPackage {
    [key: string]: unknown;
    fluid: {
        [environment: string]: undefined | IFluidPackageEnvironment;
    };
    name: string;
}

// @public
export interface IFluidPackageEnvironment {
    [target: string]: undefined | {
        files: string[];
        [key: string]: unknown;
    };
}

// @public @deprecated (undocumented)
export const IFluidTokenProvider: keyof IProvideFluidTokenProvider;

// @public @deprecated (undocumented)
export interface IFluidTokenProvider extends IProvideFluidTokenProvider {
    // (undocumented)
    intelligence: {
        [service: string]: any;
    };
}

// @public
export interface IGenericError extends IErrorBase {
    // (undocumented)
    error?: any;
    // (undocumented)
    readonly errorType: ContainerErrorType.genericError;
}

// @public
export interface IHostLoader extends ILoader {
    createDetachedContainer(codeDetails: IFluidCodeDetails): Promise<IContainer>;
    rehydrateDetachedContainerFromSnapshot(snapshot: string): Promise<IContainer>;
}

// @public
export interface ILoader extends IFluidRouter, Partial<IProvideLoader> {
    resolve(request: IRequest, pendingLocalState?: string): Promise<IContainer>;
}

// @public
export interface ILoaderHeader {
    // (undocumented)
    [LoaderHeader.cache]: boolean;
    // (undocumented)
    [LoaderHeader.clientDetails]: IClientDetails;
    // (undocumented)
    [LoaderHeader.reconnect]: boolean;
    // (undocumented)
    [LoaderHeader.sequenceNumber]: number;
    // (undocumented)
    [LoaderHeader.loadMode]: IContainerLoadMode;
    // (undocumented)
    [LoaderHeader.version]: string | undefined;
}

// @public (undocumented)
export type ILoaderOptions = {
    [key in string | number]: any;
} & {
    cache?: boolean;
    provideScopeLoader?: boolean;
    maxClientLeaveWaitTime?: number;
};

// @public @deprecated (undocumented)
export interface IPendingLocalState {
    // (undocumented)
    pendingRuntimeState: unknown;
    // (undocumented)
    url: string;
}

// @public (undocumented)
export interface IProvideFluidCodeDetailsComparer {
    // (undocumented)
    readonly IFluidCodeDetailsComparer: IFluidCodeDetailsComparer;
}

// @public @deprecated (undocumented)
export interface IProvideFluidTokenProvider {
    // (undocumented)
    readonly IFluidTokenProvider: IFluidTokenProvider;
}

// @public (undocumented)
export interface IProvideLoader {
    // (undocumented)
    readonly ILoader: ILoader;
}

// @public (undocumented)
export interface IProvideRuntimeFactory {
    // (undocumented)
    readonly IRuntimeFactory: IRuntimeFactory;
}

// @public
export interface IResolvedFluidCodeDetails extends IFluidCodeDetails {
    readonly resolvedPackage: Readonly<IFluidPackage>;
    readonly resolvedPackageCacheId: string | undefined;
}

// @public
export interface IRuntime extends IDisposable {
    createSummary(blobRedirectTable?: Map<string, string>): ISummaryTree;
    getPendingLocalState(): unknown;
    // @deprecated
    notifyAttaching(snapshot: ISnapshotTreeWithBlobContents): void;
    notifyOpReplay?(message: ISequencedDocumentMessage): Promise<void>;
    process(message: ISequencedDocumentMessage, local: boolean): any;
    processSignal(message: any, local: boolean): any;
    request(request: IRequest): Promise<IResponse>;
    setAttachState(attachState: AttachState.Attaching | AttachState.Attached): void;
    setConnectionState(connected: boolean, clientId?: string): any;
}

// @public (undocumented)
export const IRuntimeFactory: keyof IProvideRuntimeFactory;

// @public
export interface IRuntimeFactory extends IProvideRuntimeFactory {
    instantiateRuntime(context: IContainerContext, existing: boolean): Promise<IRuntime>;
}

// @public
export const isFluidBrowserPackage: (maybePkg: any) => maybePkg is Readonly<IFluidBrowserPackage>;

// @public (undocumented)
export const isFluidCodeDetails: (details: unknown) => details is Readonly<IFluidCodeDetails>;

// @public
export const isFluidPackage: (pkg: any) => pkg is Readonly<IFluidPackage>;

// @public
export interface ISnapshotTreeWithBlobContents extends ISnapshotTree {
    // (undocumented)
    blobsContents: {
        [path: string]: ArrayBufferLike;
    };
    // (undocumented)
    trees: {
        [path: string]: ISnapshotTreeWithBlobContents;
    };
}

// @public
export interface IThrottlingWarning extends IErrorBase {
    // (undocumented)
    readonly errorType: ContainerErrorType.throttlingError;
    // (undocumented)
    readonly retryAfterSeconds: number;
}

// @public
export interface IUsageError extends IErrorBase {
    // (undocumented)
    readonly errorType: ContainerErrorType.usageError;
}

// @public
export enum LoaderHeader {
    cache = "fluid-cache",
    // (undocumented)
    clientDetails = "fluid-client-details",
    loadMode = "loadMode",
    // (undocumented)
    reconnect = "fluid-reconnect",
    // (undocumented)
    sequenceNumber = "fluid-sequence-number",
    version = "version"
}

// @public (undocumented)
export type ReadOnlyInfo = {
    readonly readonly: false | undefined;
} | {
    readonly readonly: true;
    readonly forced: boolean;
    readonly permissions: boolean | undefined;
    readonly storageOnly: boolean;
};