FluidFramework/api-report/test-runtime-utils.api.md

20 KiB

API Report File for "@fluidframework/test-runtime-utils"

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


/// <reference types="node" />

import { AttachState } from '@fluidframework/container-definitions';
import { CreateChildSummarizerNodeFn } from '@fluidframework/runtime-definitions';
import { CreateChildSummarizerNodeParam } from '@fluidframework/runtime-definitions';
import { EventEmitter } from 'events';
import { FluidObject } from '@fluidframework/core-interfaces';
import { IAudience } from '@fluidframework/container-definitions';
import { IChannel } from '@fluidframework/datastore-definitions';
import { IChannelServices } from '@fluidframework/datastore-definitions';
import { IChannelStorageService } from '@fluidframework/datastore-definitions';
import { IClientConfiguration } from '@fluidframework/protocol-definitions';
import { IClientDetails } from '@fluidframework/protocol-definitions';
import { IContainerRuntimeBase } from '@fluidframework/runtime-definitions';
import { IDeltaConnection } from '@fluidframework/datastore-definitions';
import { IDeltaHandler } from '@fluidframework/datastore-definitions';
import { IDeltaManager } from '@fluidframework/container-definitions';
import { IDeltaManagerEvents } from '@fluidframework/container-definitions';
import { IDeltaQueue } from '@fluidframework/container-definitions';
import { IDocumentMessage } from '@fluidframework/protocol-definitions';
import { IDocumentStorageService } from '@fluidframework/driver-definitions';
import { IFluidDataStoreChannel } from '@fluidframework/runtime-definitions';
import { IFluidDataStoreContext } from '@fluidframework/runtime-definitions';
import { IFluidDataStoreRegistry } from '@fluidframework/runtime-definitions';
import { IFluidDataStoreRuntime } from '@fluidframework/datastore-definitions';
import { IFluidHandle } from '@fluidframework/core-interfaces';
import { IFluidHandleContext } from '@fluidframework/core-interfaces';
import { IGarbageCollectionData } from '@fluidframework/runtime-definitions';
import { IGarbageCollectionDetailsBase } from '@fluidframework/runtime-definitions';
import { ILoader } from '@fluidframework/container-definitions';
import { ILoaderOptions } from '@fluidframework/container-definitions';
import { IQuorumClients } from '@fluidframework/protocol-definitions';
import { IRequest } from '@fluidframework/core-interfaces';
import { IResponse } from '@fluidframework/core-interfaces';
import { ISequencedClient } from '@fluidframework/protocol-definitions';
import { ISequencedDocumentMessage } from '@fluidframework/protocol-definitions';
import { ISignalMessage } from '@fluidframework/protocol-definitions';
import { ISnapshotTree } from '@fluidframework/protocol-definitions';
import { ISummaryTree } from '@fluidframework/protocol-definitions';
import { ISummaryTreeWithStats } from '@fluidframework/runtime-definitions';
import { ITelemetryLogger } from '@fluidframework/common-definitions';
import { ITokenProvider } from '@fluidframework/routerlicious-driver';
import { ITokenResponse } from '@fluidframework/routerlicious-driver';
import { ITree } from '@fluidframework/protocol-definitions';
import { ITreeEntry } from '@fluidframework/protocol-definitions';
import { IUser } from '@fluidframework/protocol-definitions';
import { MessageType } from '@fluidframework/protocol-definitions';
import { ReadOnlyInfo } from '@fluidframework/container-definitions';
import { ScopeType } from '@fluidframework/protocol-definitions';
import { TypedEventEmitter } from '@fluidframework/common-utils';

// @public
export interface IInsecureUser extends IUser {
    name: string;
}

// @public (undocumented)
export interface IMockContainerRuntimePendingMessage {
    // (undocumented)
    clientSequenceNumber: number;
    // (undocumented)
    content: any;
    // (undocumented)
    localOpMetadata: unknown;
}

// @public
export class InsecureTokenProvider implements ITokenProvider {
    constructor(
    tenantKey: string,
    user: IInsecureUser,
    scopes?: ScopeType[] | undefined);
    // (undocumented)
    fetchOrdererToken(tenantId: string, documentId?: string): Promise<ITokenResponse>;
    // (undocumented)
    fetchStorageToken(tenantId: string, documentId: string): Promise<ITokenResponse>;
}

// @public
export class MockContainerRuntime {
    constructor(dataStoreRuntime: MockFluidDataStoreRuntime, factory: MockContainerRuntimeFactory);
    // (undocumented)
    protected addPendingMessage(content: any, localOpMetadata: unknown, clientSequenceNumber: number): void;
    // (undocumented)
    clientId: string;
    // (undocumented)
    protected clientSequenceNumber: number;
    // (undocumented)
    createDeltaConnection(): MockDeltaConnection;
    // (undocumented)
    protected readonly dataStoreRuntime: MockFluidDataStoreRuntime;
    // (undocumented)
    protected readonly deltaConnections: MockDeltaConnection[];
    // (undocumented)
    dirty(): void;
    // (undocumented)
    protected readonly factory: MockContainerRuntimeFactory;
    // (undocumented)
    protected readonly pendingMessages: IMockContainerRuntimePendingMessage[];
    // (undocumented)
    process(message: ISequencedDocumentMessage): void;
    // (undocumented)
    submit(messageContent: any, localOpMetadata: unknown): number;
}

// @public
export class MockContainerRuntimeFactory {
    // (undocumented)
    createContainerRuntime(dataStoreRuntime: MockFluidDataStoreRuntime): MockContainerRuntime;
    // (undocumented)
    getMinSeq(): number;
    protected messages: ISequencedDocumentMessage[];
    // (undocumented)
    minSeq: Map<string, number>;
    // (undocumented)
    get outstandingMessageCount(): number;
    processAllMessages(): void;
    processOneMessage(): void;
    processSomeMessages(count: number): void;
    // (undocumented)
    pushMessage(msg: Partial<ISequencedDocumentMessage>): void;
    // (undocumented)
    readonly quorum: MockQuorumClients;
    // (undocumented)
    protected readonly runtimes: MockContainerRuntime[];
    // (undocumented)
    sequenceNumber: number;
}

// @public
export class MockContainerRuntimeFactoryForReconnection extends MockContainerRuntimeFactory {
    // (undocumented)
    clearOutstandingClientMessages(clientId: string): void;
    // (undocumented)
    createContainerRuntime(dataStoreRuntime: MockFluidDataStoreRuntime): MockContainerRuntimeForReconnection;
}

// @public
export class MockContainerRuntimeForReconnection extends MockContainerRuntime {
    constructor(dataStoreRuntime: MockFluidDataStoreRuntime, factory: MockContainerRuntimeFactoryForReconnection);
    // (undocumented)
    get connected(): boolean;
    set connected(connected: boolean);
    // (undocumented)
    process(message: ISequencedDocumentMessage): void;
    // (undocumented)
    submit(messageContent: any, localOpMetadata: unknown): number;
}

// @public
export class MockDeltaConnection implements IDeltaConnection {
    constructor(submitFn: (messageContent: any, localOpMetadata: unknown) => number, dirtyFn: () => void);
    // (undocumented)
    attach(handler: IDeltaHandler): void;
    // (undocumented)
    get connected(): boolean;
    // (undocumented)
    dirty(): void;
    // (undocumented)
    handler: IDeltaHandler | undefined;
    // (undocumented)
    process(message: ISequencedDocumentMessage, local: boolean, localOpMetadata: unknown): void;
    // (undocumented)
    reSubmit(content: any, localOpMetadata: unknown): void;
    // (undocumented)
    setConnectionState(connected: boolean): void;
    // (undocumented)
    submit(messageContent: any, localOpMetadata: unknown): number;
}

// @public
export class MockDeltaManager extends TypedEventEmitter<IDeltaManagerEvents> implements IDeltaManager<ISequencedDocumentMessage, IDocumentMessage> {
    constructor();
    // (undocumented)
    get active(): boolean;
    // (undocumented)
    readonly clientDetails: IClientDetails;
    // (undocumented)
    readonly clientType: string;
    // (undocumented)
    close(): void;
    // (undocumented)
    dispose(): void;
    // (undocumented)
    get disposed(): any;
    // (undocumented)
    flush(): void;
    // (undocumented)
    hasCheckpointSequenceNumber: boolean;
    // (undocumented)
    get IDeltaSender(): this;
    // (undocumented)
    get inbound(): MockDeltaQueue<ISequencedDocumentMessage>;
    // (undocumented)
    get inboundSignal(): MockDeltaQueue<ISignalMessage>;
    // (undocumented)
    initialSequenceNumber: number;
    // (undocumented)
    readonly lastKnownSeqNumber = 0;
    // (undocumented)
    lastMessage: ISequencedDocumentMessage | undefined;
    // (undocumented)
    lastSequenceNumber: number;
    // (undocumented)
    get maxMessageSize(): number;
    // (undocumented)
    minimumSequenceNumber: number;
    // (undocumented)
    get outbound(): MockDeltaQueue<IDocumentMessage[]>;
    // (undocumented)
    readOnlyInfo: ReadOnlyInfo;
    // (undocumented)
    get serviceConfiguration(): IClientConfiguration;
    // (undocumented)
    submit(type: MessageType, contents: any, batch: boolean | undefined, localOpMetadata: any): number;
    // (undocumented)
    submitSignal(content: any): void;
    // (undocumented)
    get version(): string;
}

// @public
export class MockDeltaQueue<T> extends EventEmitter implements IDeltaQueue<T> {
    constructor();
    // (undocumented)
    dispose(): void;
    // (undocumented)
    get disposed(): any;
    // (undocumented)
    get idle(): boolean;
    // (undocumented)
    get length(): number;
    // (undocumented)
    pause(): Promise<void>;
    // (undocumented)
    protected pauseCount: number;
    // (undocumented)
    get paused(): boolean;
    // (undocumented)
    peek(): T | undefined;
    // (undocumented)
    pop(): T | undefined;
    // (undocumented)
    protected process(): void;
    // (undocumented)
    processCallback: (el: T) => void;
    // (undocumented)
    push(el: T): void;
    // (undocumented)
    protected readonly queue: T[];
    // (undocumented)
    resume(): void;
    // (undocumented)
    toArray(): T[];
    // (undocumented)
    waitTillProcessingDone(): Promise<{
        count: number;
        duration: number;
    }>;
}

// @public
export class MockEmptyDeltaConnection implements IDeltaConnection {
    // (undocumented)
    attach(handler: any): void;
    // (undocumented)
    connected: boolean;
    // (undocumented)
    dirty(): void;
    // (undocumented)
    submit(messageContent: any): number;
}

// @public (undocumented)
export class MockFluidDataStoreContext implements IFluidDataStoreContext {
    constructor(id?: string, existing?: boolean, logger?: ITelemetryLogger);
    attachState: AttachState;
    // (undocumented)
    baseSnapshot: ISnapshotTree | undefined;
    // (undocumented)
    bindToContext(): void;
    // (undocumented)
    clientDetails: IClientDetails;
    // (undocumented)
    clientId: string | undefined;
    // (undocumented)
    connected: boolean;
    // (undocumented)
    containerRuntime: IContainerRuntimeBase;
    // @deprecated (undocumented)
    createProps?: any;
    // (undocumented)
    deltaManager: IDeltaManager<ISequencedDocumentMessage, IDocumentMessage>;
    // (undocumented)
    ensureNoDataModelChanges<T>(callback: () => T): T;
    // (undocumented)
    readonly existing: boolean;
    // (undocumented)
    getAbsoluteUrl(relativeUrl: string): Promise<string | undefined>;
    // (undocumented)
    getAudience(): IAudience;
    // (undocumented)
    getBaseGCDetails(): Promise<IGarbageCollectionDetailsBase>;
    // (undocumented)
    getCreateChildSummarizerNodeFn(id: string, createParam: CreateChildSummarizerNodeParam): CreateChildSummarizerNodeFn;
    // (undocumented)
    getQuorum(): IQuorumClients;
    // (undocumented)
    readonly id: string;
    // (undocumented)
    IFluidDataStoreRegistry: IFluidDataStoreRegistry;
    // (undocumented)
    IFluidHandleContext: IFluidHandleContext;
    // (undocumented)
    isLocalDataStore: boolean;
    // (undocumented)
    readonly logger: ITelemetryLogger;
    // (undocumented)
    makeLocallyVisible(): void;
    // (undocumented)
    off(event: string | symbol, listener: (...args: any[]) => void): this;
    // (undocumented)
    on(event: string | symbol, listener: (...args: any[]) => void): this;
    // (undocumented)
    once(event: string | symbol, listener: (...args: any[]) => void): this;
    // (undocumented)
    options: ILoaderOptions;
    // (undocumented)
    packagePath: readonly string[];
    // (undocumented)
    scope: FluidObject;
    // (undocumented)
    setChannelDirty(address: string): void;
    // (undocumented)
    storage: IDocumentStorageService;
    // (undocumented)
    submitMessage(type: string, content: any, localOpMetadata: unknown): void;
    // (undocumented)
    submitSignal(type: string, content: any): void;
    // (undocumented)
    uploadBlob(blob: ArrayBufferLike): Promise<IFluidHandle<ArrayBufferLike>>;
}

// @public
export class MockFluidDataStoreRuntime extends EventEmitter implements IFluidDataStoreRuntime, IFluidDataStoreChannel, IFluidHandleContext {
    constructor(overrides?: {
        clientId?: string;
        entryPoint?: IFluidHandle<FluidObject>;
    });
    // (undocumented)
    get absolutePath(): string;
    // (undocumented)
    addedGCOutboundReference(srcHandle: IFluidHandle, outboundHandle: IFluidHandle): void;
    // (undocumented)
    applyStashedOp(content: any): Promise<void>;
    // (undocumented)
    attachGraph(): void;
    // (undocumented)
    get attachState(): AttachState;
    // (undocumented)
    bind(handle: IFluidHandle): void;
    // (undocumented)
    bindChannel(channel: IChannel): void;
    // (undocumented)
    get channelsRoutingContext(): IFluidHandleContext;
    // (undocumented)
    clientId: string;
    // (undocumented)
    close(): Promise<void>;
    // (undocumented)
    readonly connected = true;
    // (undocumented)
    createChannel(id: string, type: string): IChannel;
    // (undocumented)
    deltaManager: MockDeltaManager;
    // (undocumented)
    dispose(): void;
    // (undocumented)
    get disposed(): boolean;
    // (undocumented)
    readonly documentId: string;
    // (undocumented)
    ensureNoDataModelChanges<T>(callback: () => T): T;
    // (undocumented)
    readonly entryPoint?: IFluidHandle<FluidObject>;
    // (undocumented)
    readonly existing: boolean;
    // (undocumented)
    getAttachSnapshot(): ITreeEntry[];
    // (undocumented)
    getAttachSummary(): ISummaryTreeWithStats;
    // (undocumented)
    getAudience(): IAudience;
    // (undocumented)
    getBlob(blobId: string): Promise<any>;
    // (undocumented)
    getChannel(id: string): Promise<IChannel>;
    // (undocumented)
    getGCData(): Promise<IGarbageCollectionData>;
    // (undocumented)
    getQuorum(): IQuorumClients;
    // (undocumented)
    readonly id: string;
    // (undocumented)
    get IFluidHandleContext(): IFluidHandleContext;
    // (undocumented)
    get IFluidRouter(): this;
    // (undocumented)
    get isAttached(): boolean;
    // (undocumented)
    readonly loader: ILoader;
    // (undocumented)
    get local(): boolean;
    set local(local: boolean);
    // (undocumented)
    readonly logger: ITelemetryLogger;
    // (undocumented)
    makeVisibleAndAttachGraph(): void;
    // (undocumented)
    get objectsRoutingContext(): IFluidHandleContext;
    // (undocumented)
    options: ILoaderOptions;
    // (undocumented)
    readonly path = "";
    // (undocumented)
    process(message: ISequencedDocumentMessage, local: boolean): void;
    // (undocumented)
    processSignal(message: any, local: boolean): void;
    // (undocumented)
    quorum: MockQuorumClients;
    // (undocumented)
    request(request: IRequest): Promise<IResponse>;
    // (undocumented)
    requestDataStore(request: IRequest): Promise<IResponse>;
    // (undocumented)
    resolveHandle(request: IRequest): Promise<IResponse>;
    // (undocumented)
    reSubmit(content: any, localOpMetadata: unknown): void;
    // (undocumented)
    rollback?(message: any, localOpMetadata: unknown): void;
    // (undocumented)
    get rootRoutingContext(): IFluidHandleContext;
    // (undocumented)
    save(message: string): void;
    // (undocumented)
    setAttachState(attachState: AttachState.Attaching | AttachState.Attached): void;
    // (undocumented)
    setConnectionState(connected: boolean, clientId?: string): void;
    // (undocumented)
    submitMessage(type: MessageType, content: any): null;
    // (undocumented)
    submitSignal(type: string, content: any): null;
    // (undocumented)
    summarize(fullTree?: boolean, trackState?: boolean): Promise<ISummaryTreeWithStats>;
    // (undocumented)
    updateMinSequenceNumber(value: number): void;
    // (undocumented)
    updateUsedRoutes(usedRoutes: string[]): void;
    // (undocumented)
    uploadBlob(blob: ArrayBufferLike): Promise<IFluidHandle<ArrayBufferLike>>;
    // (undocumented)
    waitAttached(): Promise<void>;
}

// @public
export class MockHandle<T> implements IFluidHandle {
    constructor(value: T, path?: string, absolutePath?: string);
    // (undocumented)
    readonly absolutePath: string;
    // (undocumented)
    attachGraph(): void;
    // (undocumented)
    bind(): void;
    // (undocumented)
    get(): Promise<any>;
    // (undocumented)
    get IFluidHandle(): IFluidHandle;
    // (undocumented)
    get isAttached(): boolean;
    // (undocumented)
    readonly path: string;
    // (undocumented)
    protected readonly value: T;
}

// @public
export class MockObjectStorageService implements IChannelStorageService {
    constructor(contents: {
        [key: string]: string;
    });
    // (undocumented)
    contains(path: string): Promise<boolean>;
    // (undocumented)
    list(path: string): Promise<string[]>;
    // (undocumented)
    readBlob(path: string): Promise<ArrayBufferLike>;
}

// @public (undocumented)
export class MockQuorumClients implements IQuorumClients, EventEmitter {
    constructor(...members: [string, Partial<ISequencedClient>][]);
    // (undocumented)
    addListener(event: string | symbol, listener: (...args: any[]) => void): this;
    // (undocumented)
    addMember(id: string, client: Partial<ISequencedClient>): void;
    // (undocumented)
    dispose(): void;
    // (undocumented)
    disposed: boolean;
    // (undocumented)
    emit(event: string | symbol, ...args: any[]): boolean;
    // (undocumented)
    eventNames(): (string | symbol)[];
    // (undocumented)
    getMaxListeners(): number;
    // (undocumented)
    getMember(clientId: string): ISequencedClient | undefined;
    // (undocumented)
    getMembers(): Map<string, ISequencedClient>;
    // (undocumented)
    listenerCount(type: string | symbol): number;
    // (undocumented)
    listeners(event: string | symbol): Function[];
    // (undocumented)
    off(event: string | symbol, listener: (...args: any[]) => void): this;
    // (undocumented)
    on(event: string | symbol, listener: (...args: any[]) => void): this;
    // (undocumented)
    once(event: string | symbol, listener: (...args: any[]) => void): this;
    // (undocumented)
    prependListener(event: string | symbol, listener: (...args: any[]) => void): this;
    // (undocumented)
    prependOnceListener(event: string | symbol, listener: (...args: any[]) => void): this;
    // (undocumented)
    rawListeners(event: string | symbol): Function[];
    // (undocumented)
    removeAllListeners(event?: string | symbol | undefined): this;
    // (undocumented)
    removeListener(event: string | symbol, listener: (...args: any[]) => void): this;
    // (undocumented)
    removeMember(id: string): void;
    // (undocumented)
    setMaxListeners(n: number): this;
}

// @public
export class MockSharedObjectServices implements IChannelServices {
    constructor(contents: {
        [key: string]: string;
    });
    // (undocumented)
    static createFromSummary(summaryTree: ISummaryTree): MockSharedObjectServices;
    // (undocumented)
    deltaConnection: IDeltaConnection;
    // (undocumented)
    objectStorage: MockObjectStorageService;
}

// @public
export class MockStorage implements IChannelStorageService {
    constructor(tree?: ITree | undefined);
    // (undocumented)
    contains(path: string): Promise<boolean>;
    // (undocumented)
    static createFromSummary(summaryTree: ISummaryTree): MockStorage;
    // (undocumented)
    list(path: string): Promise<string[]>;
    // (undocumented)
    readBlob(path: string): Promise<ArrayBufferLike>;
    // (undocumented)
    protected tree?: ITree | undefined;
}

// @public
export function validateAssertionError(error: Error, expectedErrorMsg: string): boolean;

// (No @packageDocumentation comment for this package)