Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 29 additions & 4 deletions experimental/dds/tree/src/ISharedTree.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,14 @@
* Licensed under the MIT License.
*/

import type { ITelemetryBaseProperties } from '@fluidframework/core-interfaces';
import type {
IErrorEvent,
IEventProvider,
IFluidLoadable,
ITelemetryBaseProperties,
} from '@fluidframework/core-interfaces';
import type { IFluidDataStoreRuntime } from '@fluidframework/datastore-definitions/internal';
import type { ISharedObject, IFluidSerializer } from '@fluidframework/shared-object-base/internal';
import type { IFluidSerializer } from '@fluidframework/shared-object-base/internal';
import type { ITelemetryLoggerExt } from '@fluidframework/telemetry-utils/internal';

import type { Change } from './ChangeTypes.js';
Expand All @@ -14,7 +19,10 @@ import type { AttributionId, EditId, NodeId, StableNodeId } from './Identifiers.
import type { LogViewer } from './LogViewer.js';
import type { NodeIdContext } from './NodeIdUtilities.js';
import type { RevisionView } from './RevisionView.js';
import type { ISharedTreeEvents } from './SharedTree.js';
import type {
EditCommittedHandler,
SequencedEditAppliedHandler,
} from './SharedTree.js';
import type {
ChangeInternal,
Edit,
Expand All @@ -23,11 +31,28 @@ import type {
WriteFormat,
} from './persisted-types/index.js';

/**
* Events which may be emitted by {@link ISharedTree}.
*
* @remarks This is the public-facing events interface for ISharedTree. It does not extend
* ISharedObjectEvents to avoid exposing internal DDS infrastructure types in the alpha API surface.
* @alpha
*/
export interface ISharedTreeEvents extends IErrorEvent {
(event: 'committedEdit', listener: EditCommittedHandler): void;
(event: 'sequencedEditApplied', listener: SequencedEditAppliedHandler): void;
}

/**
* A {@link https://github.com/microsoft/FluidFramework/blob/main/experimental/dds/tree/README.md | distributed tree}.
* @alpha
*/
export interface ISharedTree extends ISharedObject<ISharedTreeEvents>, NodeIdContext {
export interface ISharedTree extends IFluidLoadable, IEventProvider<ISharedTreeEvents>, NodeIdContext {
/**
* A readonly identifier for the shared tree.
*/
readonly id: string;

/**
* The UUID used for attribution of nodes created by this SharedTree.
*/
Expand Down
11 changes: 6 additions & 5 deletions experimental/dds/tree/src/SharedTree.ts
Original file line number Diff line number Diff line change
Expand Up @@ -346,12 +346,13 @@ export type EditApplicationOutcome =
};

/**
* Events which may be emitted by `SharedTree`. See {@link SharedTreeEvent} for documentation of event semantics.
* @alpha
* Internal events interface that extends ISharedObjectEvents for use by the SharedTree class.
* The public-facing events interface is {@link @fluid-experimental/tree#ISharedTreeEvents} in ISharedTree.ts.
* @internal
*/
export interface ISharedTreeEvents extends ISharedObjectEvents {
export interface ISharedTreeInternalEvents extends ISharedObjectEvents {
(event: 'committedEdit', listener: EditCommittedHandler);
(event: 'appliedSequencedEdit', listener: SequencedEditAppliedHandler);
(event: 'sequencedEditApplied', listener: SequencedEditAppliedHandler);
}

/**
Expand Down Expand Up @@ -388,7 +389,7 @@ const stashedSessionId = '8477b8d5-cf6c-4673-8345-8f076a8f9bc6' as SessionId;
* to reference tree instances instead. The class will be removed from the public API surface in a future release.
* @alpha
*/
export class SharedTree extends SharedObject<ISharedTreeEvents> implements NodeIdContext {
export class SharedTree extends SharedObject<ISharedTreeInternalEvents> implements NodeIdContext {
/**
* Create a new SharedTree. It will contain the default value (see initialTree).
*/
Expand Down
4 changes: 2 additions & 2 deletions experimental/dds/tree/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -141,10 +141,10 @@ export {
EditCommittedEventArguments,
SequencedEditAppliedEventArguments,
EditApplicationOutcome,
ISharedTreeEvents,
ISharedTreeInternalEvents,
StashedLocalOpMetadata,
} from './SharedTree.js';
export type { ISharedTree } from './ISharedTree.js';
export type { ISharedTree, ISharedTreeEvents } from './ISharedTree.js';
export { StringInterner } from './StringInterner.js';
export { SharedTreeAttributes, SharedTreeFactoryType } from './publicContracts.js';

Expand Down