/*! * Copyright (c) Microsoft Corporation and contributors. All rights reserved. * Licensed under the MIT License. */ import type { OpaqueJsonDeserialized } from "@fluidframework/core-interfaces/internal/exposedUtilityTypes"; /** * Collection of value types that are not intended to be used/imported * directly outside of this package. * * @public * @system */ export declare namespace InternalTypes { /** * Metadata for a value state. * * @system */ interface ValueStateMetadata { rev: number; timestamp: number; } /** * Represents a state that may have a value. * And it includes standard metadata. * * @see {@link InternalPresenceTypes.ValueRequiredState}. * * @system */ interface ValueOptionalState extends ValueStateMetadata { value?: OpaqueJsonDeserialized; } /** * Represents a state that must have a value. * And it includes standard metadata. * * @remarks * The value is wrapped in `OpaqueJsonDeserialized` as uses are expected * to involve generic or unknown types that will be filtered. It is here * mostly as a convenience to the many such uses that would otherwise * need to specify some wrapper themselves. * * For known cases, construct a custom interface that extends * {@link InternalPresenceTypes.ValueStateMetadata}. * * @system */ interface ValueRequiredState extends ValueStateMetadata { value: OpaqueJsonDeserialized; } /** * A directory of values, where each value may be an optional state or another directory. * * @system */ interface ValueDirectory { rev: number; items: { [name: string | number]: ValueOptionalState | ValueDirectory; }; } /** * Convenience type for a required state or a directory of values. * * @system */ type ValueDirectoryOrState = ValueRequiredState | ValueDirectory; /** * Collection of optional values in a "map" structure. * * @system */ interface MapValueState { rev: number; items: { [name in Keys]: ValueOptionalState; }; } /** * Opaque type representing internal state datastore. * * @system */ class StateDatastoreHandle> { private readonly StateDatastoreHandle; } /** * Brand to ensure state values internal type safety without revealing * internals that are subject to change. * * @system */ class StateValueBrand { private readonly StateValue; } /** * This type provides no additional functionality over the type it wraps. * It is used to ensure type safety within package. * Users may find it convenient to just use the type it wraps directly. * * @privateRemarks * Checkout filtering omitting unknown from T (`Omit &`). * * @system */ type StateValue = T & StateValueBrand; /** * Package internal function declaration for state and notification instantiation. * * @remarks * Direct use of this type is discouraged. If in need, try to use the type * returned by the factory functions instead, as those are more specific and * stable. * * @system */ type ManagerFactory, TManager> = { instanceBase: new (...args: any[]) => unknown; } & ((key: TKey, datastoreHandle: StateDatastoreHandle) => { initialData?: { value: TValue; allowableUpdateLatencyMs: number | undefined; }; manager: StateValue; }); /** * Structure of a generic notification "value". * * @system */ interface NotificationType { name: string; args: unknown[]; } } //# sourceMappingURL=exposedInternalTypes.d.ts.map