fluid-framework 2.0.0-dev-rc.1.0.0.232845 → 2.0.0-dev-rc.2.0.0.246488

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,60 @@
1
1
  # fluid-framework
2
2
 
3
+ ## 2.0.0-rc.2.0.0
4
+
5
+ ### Minor Changes
6
+
7
+ - fluid-framework: EventEmitterWithErrorHandling is no longer publicly exported ([#19717](https://github.com/microsoft/FluidFramework/issues/19717)) [ae1d0be26d](https://github.com/microsoft/FluidFramework/commits/ae1d0be26d61453cff316b3f622a9f3647149167)
8
+
9
+ EventEmitterWithErrorHandling is intended for authoring DDSes, and thus is only intended for use within the Fluid Framework client packages.
10
+ It is no longer publicly exported: any users should fine their own solution or be upstreamed.
11
+ EventEmitterWithErrorHandling is available for now as `@alpha` to make this migration less disrupting for any existing users.
12
+
13
+ - fluid-framework: SharedObject classes are no longer exported as public ([#19717](https://github.com/microsoft/FluidFramework/issues/19717)) [ae1d0be26d](https://github.com/microsoft/FluidFramework/commits/ae1d0be26d61453cff316b3f622a9f3647149167)
14
+
15
+ `SharedObject` and `SharedObjectCore` are intended for authoring DDSes, and thus are only intended for use within the Fluid Framework client packages.
16
+ They is no longer publicly exported: any users should fine their own solution or be upstreamed.
17
+ `SharedObject` and `SharedObjectCore` are available for now as `@alpha` to make this migration less disrupting for any existing users.
18
+
19
+ - API tightening ([#20012](https://github.com/microsoft/FluidFramework/issues/20012)) [049de899dd](https://github.com/microsoft/FluidFramework/commits/049de899ddfd5c0155251cb0ea00ecbe3a7f7665)
20
+
21
+ The Fluid Framework API has been clarified with tags applied to package exports. As we are working toward a clear, safe,
22
+ and stable API surface, some build settings and imports may need to be adjusted.
23
+
24
+ **Now:** Most packages are specifying "exports" - import specifierss like` @fluidframework/foo/lib/internals` will
25
+ become build errors. The fix is to use only public APIs from @fluidframework/foo.
26
+
27
+ **Coming soon:** Build resolutions (`moduleResolution` in tsconfig compilerOptions) will need to be resolved with
28
+ Node16, NodeNext, or a bundler that supports resolution of named import/export paths. Internally, some FF packages will
29
+ use `@fluidframework/foo/internal` import paths that allow packages to talk to each other using non-public APIs.
30
+
31
+ **Final stage:** APIs that are not tagged @public will be removed from @fluidframework/foo imports.
32
+
33
+ - Deprecated error-related enums have been removed ([#19067](https://github.com/microsoft/FluidFramework/issues/19067)) [59793302e5](https://github.com/microsoft/FluidFramework/commits/59793302e56784cfb6ace0e6469345f3565b3312)
34
+
35
+ Error-related enums `ContainerErrorType`, `DriverErrorType`, `OdspErrorType` and `RouterliciousErrorType` were previously
36
+ deprecated and are now removed. There are replacement object-based enumerations of `ContainerErrorTypes`,
37
+ `DriverErrorTypes`, `OdspErrorTypes` and `RouterliciousErrorTypes`. Refer to the release notes of [Fluid Framework version
38
+ 2.0.0-internal.7.0.0](https://github.com/microsoft/FluidFramework/releases/tag/client_v2.0.0-internal.7.0.0) for details
39
+ on the replacements.
40
+
41
+ - map, tree: DDS classes are no longer publicly exported ([#19717](https://github.com/microsoft/FluidFramework/issues/19717)) [ae1d0be26d](https://github.com/microsoft/FluidFramework/commits/ae1d0be26d61453cff316b3f622a9f3647149167)
42
+
43
+ SharedMap and SharedTree now only export their factories and the interface types.
44
+ The actual concrete classes which leak implementation details are no longer exported.
45
+ Users of the `SharedMap` type should use `ISharedMap`.
46
+ Users of the `SharedTree` type should use `ISharedTree`.
47
+
48
+ - tree: Minor API fixes for "@fluidframework/tree" package. ([#19057](https://github.com/microsoft/FluidFramework/issues/19057)) [3e0f218832](https://github.com/microsoft/FluidFramework/commits/3e0f21883255317f8bb1f7c420543650502a5b66)
49
+
50
+ Rename `IterableTreeListContent` to `IterableTreeArrayContent`, inline `TreeMapNodeBase` into `TreeMapNode`, rename `TreeArrayNode.spread` to `TreeArrayNode.spread` and remove `create` which was not supposed to be public (use `TreeArrayNode.spread` instead).
51
+
52
+ - fluid-framework: ContainerSchema is now readonly ([#19717](https://github.com/microsoft/FluidFramework/issues/19717)) [ae1d0be26d](https://github.com/microsoft/FluidFramework/commits/ae1d0be26d61453cff316b3f622a9f3647149167)
53
+
54
+ The `ContainerSchema` type is intended for defining input to these packages. This should make the APIs more tolerant and
55
+ thus be non-breaking, however its possible for some users of `ContainerSchema` to use it in ways where this could be a
56
+ breaking change: any such users should remove their mutations and/or use a different type.
57
+
3
58
  ## 2.0.0-rc.1.0.0
4
59
 
5
60
  Dependency updates only.
@@ -1,4 +1,9 @@
1
1
  {
2
2
  "$schema": "https://developer.microsoft.com/json-schemas/api-extractor/v7/api-extractor.schema.json",
3
- "extends": "../../../common/build/build-common/api-extractor-base-esm.json"
3
+ "extends": "../../../common/build/build-common/api-extractor-base.cjs.primary.json",
4
+ "bundledPackages": ["@fluidframework/*"],
5
+ // CJS is actually secondary; so, no report.
6
+ "apiReport": {
7
+ "enabled": false
8
+ }
4
9
  }
@@ -1,4 +1,4 @@
1
1
  {
2
2
  "$schema": "https://developer.microsoft.com/json-schemas/api-extractor/v7/api-extractor.schema.json",
3
- "extends": "../../../common/build/build-common/api-extractor-lint.json"
3
+ "extends": "../../../common/build/build-common/api-extractor-lint.esm.primary.json"
4
4
  }
@@ -1,17 +1,10 @@
1
1
  {
2
2
  "$schema": "https://developer.microsoft.com/json-schemas/api-extractor/v7/api-extractor.schema.json",
3
- "extends": "../../../common/build/build-common/api-extractor-base.json",
4
- "bundledPackages": [
5
- "@fluidframework/container-definitions",
6
- "@fluidframework/container-loader",
7
- "@fluidframework/driver-definitions",
8
- "@fluidframework/fluid-static",
9
- "@fluidframework/map",
10
- "@fluidframework/tree"
11
- ],
3
+ "extends": "../../../common/build/build-common/api-extractor-base.esm.primary.json",
4
+ "bundledPackages": ["@fluidframework/*"],
12
5
  "messages": {
13
6
  "extractorMessageReporting": {
14
- // TODO: Add missing documentation and remove this rule override
7
+ // TODO: Fix violations and set logLevel to "error"
15
8
  "ae-undocumented": {
16
9
  "logLevel": "none"
17
10
  }
@@ -6,26 +6,16 @@
6
6
 
7
7
  import { FluidObject } from '@fluidframework/core-interfaces';
8
8
  import { IChannel } from '@fluidframework/datastore-definitions';
9
- import { IChannelAttributes } from '@fluidframework/datastore-definitions';
10
9
  import { IChannelFactory } from '@fluidframework/datastore-definitions';
11
- import { IChannelServices } from '@fluidframework/datastore-definitions';
12
- import { IChannelStorageService } from '@fluidframework/datastore-definitions';
13
- import { IErrorBase } from '@fluidframework/core-interfaces';
10
+ import type { IErrorBase } from '@fluidframework/core-interfaces';
14
11
  import { IEvent } from '@fluidframework/core-interfaces';
15
12
  import { IEventProvider } from '@fluidframework/core-interfaces';
16
13
  import { IEventThisPlaceHolder } from '@fluidframework/core-interfaces';
17
- import { IExperimentalIncrementalSummaryContext } from '@fluidframework/runtime-definitions';
18
- import { IFluidDataStoreRuntime } from '@fluidframework/datastore-definitions';
14
+ import type { IFluidDataStoreRuntime } from '@fluidframework/datastore-definitions';
19
15
  import { IFluidHandle } from '@fluidframework/core-interfaces';
20
16
  import { IFluidLoadable } from '@fluidframework/core-interfaces';
21
- import { IFluidSerializer } from '@fluidframework/shared-object-base';
22
- import { IGarbageCollectionData } from '@fluidframework/runtime-definitions';
23
- import { ISequencedDocumentMessage } from '@fluidframework/protocol-definitions';
24
17
  import { ISharedObject } from '@fluidframework/shared-object-base';
25
18
  import { ISharedObjectEvents } from '@fluidframework/shared-object-base';
26
- import { ISummaryTreeWithStats } from '@fluidframework/runtime-definitions';
27
- import { ITelemetryContext } from '@fluidframework/runtime-definitions';
28
- import { SharedObject } from '@fluidframework/shared-object-base';
29
19
 
30
20
  // @public
31
21
  export type AllowedTypes = readonly LazyItem<TreeNodeSchema>[];
@@ -34,7 +24,7 @@ export type AllowedTypes = readonly LazyItem<TreeNodeSchema>[];
34
24
  export type ApplyKind<T, Kind extends FieldKind> = Kind extends FieldKind.Required ? T : undefined | T;
35
25
 
36
26
  // @public
37
- export type ArrayToUnion<T extends readonly unknown[]> = T extends readonly (infer TValue)[] ? TValue : never;
27
+ export type ArrayToUnion<T extends readonly unknown[]> = T[number];
38
28
 
39
29
  // @public
40
30
  export enum AttachState {
@@ -43,7 +33,20 @@ export enum AttachState {
43
33
  Detached = "Detached"
44
34
  }
45
35
 
46
- // @public (undocumented)
36
+ // @public
37
+ export enum CommitKind {
38
+ Default = 0,
39
+ Redo = 2,
40
+ Undo = 1
41
+ }
42
+
43
+ // @public
44
+ export interface CommitMetadata {
45
+ isLocal: boolean;
46
+ kind: CommitKind;
47
+ }
48
+
49
+ // @public
47
50
  export enum ConnectionState {
48
51
  CatchingUp = 1,
49
52
  Connected = 2,
@@ -75,13 +78,13 @@ export const ContainerErrorTypes: {
75
78
  readonly usageError: "usageError";
76
79
  };
77
80
 
78
- // @alpha (undocumented)
81
+ // @alpha
79
82
  export type ContainerErrorTypes = (typeof ContainerErrorTypes)[keyof typeof ContainerErrorTypes];
80
83
 
81
84
  // @public
82
85
  export interface ContainerSchema {
83
- dynamicObjectTypes?: LoadableObjectClass<any>[];
84
- initialObjects: LoadableObjectClassRecord;
86
+ readonly dynamicObjectTypes?: readonly LoadableObjectClass[];
87
+ readonly initialObjects: LoadableObjectClassRecord;
85
88
  }
86
89
 
87
90
  // @public
@@ -116,7 +119,7 @@ export const DriverErrorTypes: {
116
119
  readonly usageError: "usageError";
117
120
  };
118
121
 
119
- // @public (undocumented)
122
+ // @public
120
123
  export type DriverErrorTypes = (typeof DriverErrorTypes)[keyof typeof DriverErrorTypes];
121
124
 
122
125
  // @public
@@ -275,10 +278,10 @@ export interface IValueChanged {
275
278
  export type LazyItem<Item = unknown> = Item | (() => Item);
276
279
 
277
280
  // @public
278
- export type LoadableObjectClass<T extends IFluidLoadable> = DataObjectClass<T> | SharedObjectClass<T>;
281
+ export type LoadableObjectClass<T extends IFluidLoadable = IFluidLoadable> = SharedObjectClass<T> | DataObjectClass<T>;
279
282
 
280
283
  // @public
281
- export type LoadableObjectClassRecord = Record<string, LoadableObjectClass<any>>;
284
+ export type LoadableObjectClassRecord = Record<string, LoadableObjectClass>;
282
285
 
283
286
  // @public
284
287
  export type LoadableObjectCtor<T extends IFluidLoadable> = new (...args: any[]) => T;
@@ -319,102 +322,75 @@ export type RestrictiveReadonlyRecord<K extends symbol | string, T> = {
319
322
  readonly [P in symbol | string]: P extends K ? T : never;
320
323
  };
321
324
 
325
+ // @public
326
+ export interface Revertible {
327
+ release(): void;
328
+ revert(): void;
329
+ readonly status: RevertibleStatus;
330
+ }
331
+
332
+ // @public
333
+ export enum RevertibleStatus {
334
+ Disposed = 1,
335
+ Valid = 0
336
+ }
337
+
322
338
  // @public @sealed
323
- export class SchemaFactory<TScope extends string = string, TName extends number | string = string> {
339
+ export class SchemaFactory<out TScope extends string | undefined = string | undefined, TName extends number | string = string> {
324
340
  constructor(scope: TScope);
325
- array<const T extends TreeNodeSchema | readonly TreeNodeSchema[]>(allowedTypes: T): TreeNodeSchema<`${TScope}.Array<${string}>`, NodeKind.Array, TreeArrayNode<T> & WithType<`${TScope}.Array<${string}>`>, Iterable<InsertableTreeNodeFromImplicitAllowedTypes<T>>, true>;
326
- array<const Name extends TName, const T extends ImplicitAllowedTypes>(name: Name, allowedTypes: T): TreeNodeSchemaClass<`${TScope}.${Name}`, NodeKind.Array, TreeArrayNode<T> & WithType<`${TScope}.${Name}`>, Iterable<InsertableTreeNodeFromImplicitAllowedTypes<T>>, true>;
341
+ array<const T extends TreeNodeSchema | readonly TreeNodeSchema[]>(allowedTypes: T): TreeNodeSchema<ScopedSchemaName<TScope, `Array<${string}>`>, NodeKind.Array, TreeArrayNode<T> & WithType<ScopedSchemaName<TScope, `Array<${string}>`>>, Iterable<InsertableTreeNodeFromImplicitAllowedTypes<T>>, true, T>;
342
+ array<const Name extends TName, const T extends ImplicitAllowedTypes>(name: Name, allowedTypes: T): TreeNodeSchemaClass<ScopedSchemaName<TScope, Name>, NodeKind.Array, TreeArrayNode<T> & WithType<ScopedSchemaName<TScope, Name>>, Iterable<InsertableTreeNodeFromImplicitAllowedTypes<T>>, true, T>;
327
343
  readonly boolean: TreeNodeSchema<"com.fluidframework.leaf.boolean", NodeKind.Leaf, boolean, boolean>;
344
+ // @deprecated
328
345
  fixRecursiveReference<T extends AllowedTypes>(...types: T): void;
329
346
  readonly handle: TreeNodeSchema<"com.fluidframework.leaf.handle", NodeKind.Leaf, IFluidHandle<FluidObject & IFluidLoadable>, IFluidHandle<FluidObject & IFluidLoadable>>;
330
- map<const T extends TreeNodeSchema | readonly TreeNodeSchema[]>(allowedTypes: T): TreeNodeSchema<`${TScope}.Map<${string}>`, NodeKind.Map, TreeMapNode<T> & WithType<`${TScope}.Map<${string}>`>, ReadonlyMap<string, TreeNodeFromImplicitAllowedTypes<T>>, true>;
331
- map<Name extends TName, const T extends ImplicitAllowedTypes>(name: Name, allowedTypes: T): TreeNodeSchemaClass<`${TScope}.${Name}`, NodeKind.Map, TreeMapNode<T> & WithType<`${TScope}.${Name}`>, ReadonlyMap<string, InsertableTreeNodeFromImplicitAllowedTypes<T>>, true>;
332
- namedArray_internal<Name extends TName | string, const T extends ImplicitAllowedTypes, const ImplicitlyConstructable extends boolean>(name: Name, allowedTypes: T, customizable: boolean, implicitlyConstructable: ImplicitlyConstructable): TreeNodeSchemaClass<`${TScope}.${Name}`, NodeKind.Array, TreeArrayNode<T> & WithType<`${TScope}.${string}`>, Iterable<InsertableTreeNodeFromImplicitAllowedTypes<T>>, ImplicitlyConstructable>;
333
- namedMap_internal<Name extends TName | string, const T extends ImplicitAllowedTypes, const ImplicitlyConstructable extends boolean>(name: Name, allowedTypes: T, customizable: boolean, implicitlyConstructable: ImplicitlyConstructable): TreeNodeSchemaClass<`${TScope}.${Name}`, NodeKind.Map, TreeMapNode<T> & WithType<`${TScope}.${Name}`>, ReadonlyMap<string, InsertableTreeNodeFromImplicitAllowedTypes<T>>, ImplicitlyConstructable>;
347
+ map<const T extends TreeNodeSchema | readonly TreeNodeSchema[]>(allowedTypes: T): TreeNodeSchema<ScopedSchemaName<TScope, `Map<${string}>`>, NodeKind.Map, TreeMapNode<T> & WithType<ScopedSchemaName<TScope, `Map<${string}>`>>, Iterable<[string, InsertableTreeNodeFromImplicitAllowedTypes<T>]>, true, T>;
348
+ map<Name extends TName, const T extends ImplicitAllowedTypes>(name: Name, allowedTypes: T): TreeNodeSchemaClass<ScopedSchemaName<TScope, Name>, NodeKind.Map, TreeMapNode<T> & WithType<ScopedSchemaName<TScope, Name>>, Iterable<[string, InsertableTreeNodeFromImplicitAllowedTypes<T>]>, true, T>;
349
+ namedArray_internal<Name extends TName | string, const T extends ImplicitAllowedTypes, const ImplicitlyConstructable extends boolean>(name: Name, allowedTypes: T, customizable: boolean, implicitlyConstructable: ImplicitlyConstructable): TreeNodeSchemaClass<ScopedSchemaName<TScope, Name>, NodeKind.Array, TreeArrayNode<T> & WithType<ScopedSchemaName<TScope, string>>, Iterable<InsertableTreeNodeFromImplicitAllowedTypes<T>>, ImplicitlyConstructable, T>;
350
+ namedMap_internal<Name extends TName | string, const T extends ImplicitAllowedTypes, const ImplicitlyConstructable extends boolean>(name: Name, allowedTypes: T, customizable: boolean, implicitlyConstructable: ImplicitlyConstructable): TreeNodeSchemaClass<ScopedSchemaName<TScope, Name>, NodeKind.Map, TreeMapNode<T> & WithType<ScopedSchemaName<TScope, Name>>, Iterable<[string, InsertableTreeNodeFromImplicitAllowedTypes<T>]>, ImplicitlyConstructable, T>;
334
351
  readonly null: TreeNodeSchema<"com.fluidframework.leaf.null", NodeKind.Leaf, null, null>;
335
352
  readonly number: TreeNodeSchema<"com.fluidframework.leaf.number", NodeKind.Leaf, number, number>;
336
- object<const Name extends TName, const T extends RestrictiveReadonlyRecord<string, ImplicitFieldSchema>>(name: Name, t: T): TreeNodeSchemaClass<`${TScope}.${Name}`, NodeKind.Object, object & TreeNode & ObjectFromSchemaRecord<T> & WithType<`${TScope}.${Name}`>, object & InsertableObjectFromSchemaRecord<T>, true>;
353
+ object<const Name extends TName, const T extends RestrictiveReadonlyRecord<string, ImplicitFieldSchema>>(name: Name, t: T): TreeNodeSchemaClass<ScopedSchemaName<TScope, Name>, NodeKind.Object, TreeNode & ObjectFromSchemaRecord<T> & WithType<ScopedSchemaName<TScope, Name>>, object & InsertableObjectFromSchemaRecord<T>, true, T>;
337
354
  optional<const T extends ImplicitAllowedTypes>(t: T): FieldSchema<FieldKind.Optional, T>;
338
355
  // (undocumented)
339
356
  readonly scope: TScope;
340
357
  readonly string: TreeNodeSchema<"com.fluidframework.leaf.string", NodeKind.Leaf, string, string>;
341
358
  }
342
359
 
343
- // @public @deprecated
344
- export class SharedMap extends SharedObject<ISharedMapEvents> implements ISharedMap {
345
- [Symbol.iterator](): IterableIterator<[string, any]>;
346
- readonly [Symbol.toStringTag]: string;
347
- constructor(id: string, runtime: IFluidDataStoreRuntime, attributes: IChannelAttributes);
348
- // (undocumented)
349
- protected applyStashedOp(content: unknown): unknown;
350
- clear(): void;
351
- static create(runtime: IFluidDataStoreRuntime, id?: string): SharedMap;
352
- delete(key: string): boolean;
353
- entries(): IterableIterator<[string, any]>;
354
- forEach(callbackFn: (value: any, key: string, map: Map<string, any>) => void): void;
355
- get<T = any>(key: string): T | undefined;
356
- static getFactory(): IChannelFactory;
357
- has(key: string): boolean;
358
- keys(): IterableIterator<string>;
359
- // (undocumented)
360
- protected loadCore(storage: IChannelStorageService): Promise<void>;
361
- // (undocumented)
362
- protected onDisconnect(): void;
363
- // (undocumented)
364
- protected processCore(message: ISequencedDocumentMessage, local: boolean, localOpMetadata: unknown): void;
365
- // (undocumented)
366
- protected reSubmitCore(content: unknown, localOpMetadata: unknown): void;
367
- // (undocumented)
368
- protected rollback(content: unknown, localOpMetadata: unknown): void;
369
- set(key: string, value: unknown): this;
370
- get size(): number;
371
- // (undocumented)
372
- protected summarizeCore(serializer: IFluidSerializer, telemetryContext?: ITelemetryContext): ISummaryTreeWithStats;
373
- values(): IterableIterator<any>;
360
+ // @public
361
+ export interface SchemaIncompatible {
362
+ readonly canUpgrade: boolean;
374
363
  }
375
364
 
376
365
  // @public
377
- export type SharedObjectClass<T extends IFluidLoadable> = {
378
- readonly getFactory: () => IChannelFactory;
379
- } & LoadableObjectCtor<T>;
366
+ export type ScopedSchemaName<TScope extends string | undefined, TName extends number | string> = TScope extends undefined ? `${TName}` : `${TScope}.${TName}`;
367
+
368
+ // @public @deprecated
369
+ export const SharedMap: {
370
+ getFactory(): IChannelFactory<ISharedMap>;
371
+ create(runtime: IFluidDataStoreRuntime, id?: string): ISharedMap;
372
+ };
373
+
374
+ // @public @deprecated
375
+ export type SharedMap = ISharedMap;
380
376
 
381
377
  // @public
382
- export class SharedTree implements ITree {
383
- // (undocumented)
384
- get attributes(): IChannelAttributes;
385
- // (undocumented)
386
- connect(services: IChannelServices): void;
387
- // (undocumented)
388
- getAttachSummary(fullTree?: boolean | undefined, trackState?: boolean | undefined, telemetryContext?: ITelemetryContext | undefined): ISummaryTreeWithStats;
389
- // (undocumented)
390
- static getFactory(): IChannelFactory;
391
- // (undocumented)
392
- getGCData(fullGC?: boolean | undefined): IGarbageCollectionData;
393
- // (undocumented)
394
- get handle(): IFluidHandle;
395
- // (undocumented)
396
- get id(): string;
397
- // (undocumented)
398
- get IFluidLoadable(): IFluidLoadable;
399
- // (undocumented)
400
- isAttached(): boolean;
401
- // (undocumented)
402
- schematize<TRoot extends ImplicitFieldSchema>(config: TreeConfiguration<TRoot>): TreeView<TreeFieldFromImplicitField<TRoot>>;
403
- // (undocumented)
404
- summarize(fullTree?: boolean | undefined, trackState?: boolean | undefined, telemetryContext?: ITelemetryContext | undefined, incrementalSummaryContext?: IExperimentalIncrementalSummaryContext | undefined): Promise<ISummaryTreeWithStats>;
378
+ export interface SharedObjectClass<T extends IFluidLoadable> {
379
+ readonly getFactory: () => IChannelFactory<T>;
405
380
  }
406
381
 
382
+ // @public
383
+ export const SharedTree: {
384
+ getFactory(): IChannelFactory<ITree>;
385
+ };
386
+
407
387
  // @public
408
388
  export const Tree: TreeApi;
409
389
 
410
390
  // @public
411
- export interface TreeApi {
412
- is<TSchema extends TreeNodeSchema>(value: unknown, schema: TSchema): value is NodeFromSchema<TSchema>;
413
- key(node: TreeNode): string | number;
414
- on<K extends keyof TreeNodeEvents>(node: TreeNode, eventName: K, listener: TreeNodeEvents[K]): () => void;
415
- parent(node: TreeNode): TreeNode | undefined;
416
- schema<T extends TreeNode | TreeLeafValue>(node: T): TreeNodeSchema<string, NodeKind, unknown, T>;
417
- readonly status: (node: TreeNode) => TreeStatus;
391
+ export interface TreeApi extends TreeNodeApi {
392
+ runTransaction<TNode extends TreeNode>(node: TNode, transaction: (node: TNode) => void | "rollback"): void;
393
+ runTransaction<TRoot>(tree: TreeView<TRoot>, transaction: (root: TRoot) => void | "rollback"): void;
418
394
  }
419
395
 
420
396
  // @public
@@ -473,6 +449,16 @@ export abstract class TreeNode implements WithType {
473
449
  abstract get [type](): string;
474
450
  }
475
451
 
452
+ // @public
453
+ export interface TreeNodeApi {
454
+ is<TSchema extends TreeNodeSchema>(value: unknown, schema: TSchema): value is NodeFromSchema<TSchema>;
455
+ key(node: TreeNode): string | number;
456
+ on<K extends keyof TreeNodeEvents>(node: TreeNode, eventName: K, listener: TreeNodeEvents[K]): () => void;
457
+ parent(node: TreeNode): TreeNode | undefined;
458
+ schema<T extends TreeNode | TreeLeafValue>(node: T): TreeNodeSchema<string, NodeKind, unknown, T>;
459
+ readonly status: (node: TreeNode) => TreeStatus;
460
+ }
461
+
476
462
  // @public
477
463
  export interface TreeNodeEvents {
478
464
  afterChange(): void;
@@ -482,27 +468,26 @@ export interface TreeNodeEvents {
482
468
  export type TreeNodeFromImplicitAllowedTypes<TSchema extends ImplicitAllowedTypes = TreeNodeSchema> = TSchema extends TreeNodeSchema ? NodeFromSchema<TSchema> : TSchema extends AllowedTypes ? NodeFromSchema<FlexListToUnion<TSchema>> : unknown;
483
469
 
484
470
  // @public
485
- export type TreeNodeSchema<Name extends string = string, Kind extends NodeKind = NodeKind, TNode = unknown, TBuild = never, ImplicitlyConstructable extends boolean = boolean> = TreeNodeSchemaClass<Name, Kind, TNode, TBuild, ImplicitlyConstructable> | TreeNodeSchemaNonClass<Name, Kind, TNode, TBuild, ImplicitlyConstructable>;
471
+ export type TreeNodeSchema<Name extends string = string, Kind extends NodeKind = NodeKind, TNode = unknown, TBuild = never, ImplicitlyConstructable extends boolean = boolean, Info = unknown> = TreeNodeSchemaClass<Name, Kind, TNode, TBuild, ImplicitlyConstructable, Info> | TreeNodeSchemaNonClass<Name, Kind, TNode, TBuild, ImplicitlyConstructable, Info>;
486
472
 
487
473
  // @public
488
- export interface TreeNodeSchemaClass<out Name extends string = string, out Kind extends NodeKind = NodeKind, out TNode = unknown, in TInsertable = never, out ImplicitlyConstructable extends boolean = boolean> extends TreeNodeSchemaCore<Name, Kind, ImplicitlyConstructable> {
474
+ export interface TreeNodeSchemaClass<out Name extends string = string, out Kind extends NodeKind = NodeKind, out TNode = unknown, in TInsertable = never, out ImplicitlyConstructable extends boolean = boolean, out Info = unknown> extends TreeNodeSchemaCore<Name, Kind, ImplicitlyConstructable, Info> {
489
475
  // @sealed
490
476
  new (data: TInsertable): Unhydrated<TNode>;
491
477
  }
492
478
 
493
479
  // @public
494
- export interface TreeNodeSchemaCore<out Name extends string, out Kind extends NodeKind, out ImplicitlyConstructable extends boolean> {
480
+ export interface TreeNodeSchemaCore<out Name extends string, out Kind extends NodeKind, out ImplicitlyConstructable extends boolean, out Info = unknown> {
495
481
  // (undocumented)
496
482
  readonly identifier: Name;
497
483
  readonly implicitlyConstructable: ImplicitlyConstructable;
498
- // (undocumented)
499
- readonly info: unknown;
484
+ readonly info: Info;
500
485
  // (undocumented)
501
486
  readonly kind: Kind;
502
487
  }
503
488
 
504
489
  // @public
505
- export interface TreeNodeSchemaNonClass<out Name extends string = string, out Kind extends NodeKind = NodeKind, out TNode = unknown, in TInsertable = never, out ImplicitlyConstructable extends boolean = boolean> extends TreeNodeSchemaCore<Name, Kind, ImplicitlyConstructable> {
490
+ export interface TreeNodeSchemaNonClass<out Name extends string = string, out Kind extends NodeKind = NodeKind, out TNode = unknown, in TInsertable = never, out ImplicitlyConstructable extends boolean = boolean, out Info = unknown> extends TreeNodeSchemaCore<Name, Kind, ImplicitlyConstructable, Info> {
506
491
  // (undocumented)
507
492
  create(data: TInsertable): TNode;
508
493
  }
@@ -516,13 +501,18 @@ export enum TreeStatus {
516
501
 
517
502
  // @public
518
503
  export interface TreeView<in out TRoot> extends IDisposable {
504
+ readonly error?: SchemaIncompatible;
519
505
  readonly events: ISubscribable<TreeViewEvents>;
520
506
  readonly root: TRoot;
507
+ upgradeSchema(): void;
521
508
  }
522
509
 
523
510
  // @public
524
511
  export interface TreeViewEvents {
525
512
  afterBatch(): void;
513
+ commitApplied(data: CommitMetadata, getRevertible?: () => Revertible): void;
514
+ revertibleDisposed(revertible: Revertible): void;
515
+ rootChanged(): void;
526
516
  }
527
517
 
528
518
  // @public