fluid-framework 2.0.0-rc.1.0.6 → 2.0.0-rc.2.0.1

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.
package/README.md CHANGED
@@ -8,7 +8,7 @@ The `fluid-framework` package consists primarily of two portions: the `IFluidCon
8
8
 
9
9
  ### IFluidContainer
10
10
 
11
- The **[IFluidContainer][]** interface is the one of the types returned by calls to `createContainer()` and `getContainer()` on the service clients such as `AzureClient`.
11
+ The **[IFluidContainer][]** interface is one of the types returned by calls to `createContainer()` and `getContainer()` on the service clients such as `AzureClient`.
12
12
  It includes functionality to retrieve the Fluid data contained within, as well as to inspect the state of the collaboration session connection.
13
13
 
14
14
  ### DDS packages
@@ -22,7 +22,7 @@ The `fluid-framework` package offers the following data structures:
22
22
 
23
23
  ## Tutorial
24
24
 
25
- Check out the Hello World tutorial using the `fluid-framework` package [here](https://fluidframework.com/docs/start/tutorial/).
25
+ Check out the [Hello World tutorial](https://fluidframework.com/docs/start/tutorial/) using `fluid-framework`.
26
26
 
27
27
  <!-- AUTO-GENERATED-CONTENT:START (LIBRARY_PACKAGE_README:scripts=FALSE) -->
28
28
 
@@ -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,10 +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": ["@fluidframework/map", "@fluidframework/tree"],
3
+ "extends": "../../../common/build/build-common/api-extractor-base.esm.primary.json",
4
+ "bundledPackages": ["@fluidframework/*"],
5
5
  "messages": {
6
6
  "extractorMessageReporting": {
7
- // TODO: Add missing documentation and remove this rule override
7
+ // TODO: Fix violations and set logLevel to "error"
8
8
  "ae-undocumented": {
9
9
  "logLevel": "none"
10
10
  }
@@ -4,43 +4,18 @@
4
4
 
5
5
  ```ts
6
6
 
7
- import { AttachState } from '@fluidframework/container-definitions';
8
- import { ConnectionState } from '@fluidframework/container-loader';
9
- import { ContainerErrorType } from '@fluidframework/container-definitions';
10
- import { ContainerSchema } from '@fluidframework/fluid-static';
11
- import { DataObjectClass } from '@fluidframework/fluid-static';
12
- import { DriverErrorType } from '@fluidframework/driver-definitions';
13
7
  import { FluidObject } from '@fluidframework/core-interfaces';
14
8
  import { IChannel } from '@fluidframework/datastore-definitions';
15
- import { IChannelAttributes } from '@fluidframework/datastore-definitions';
16
9
  import { IChannelFactory } from '@fluidframework/datastore-definitions';
17
- import { IChannelServices } from '@fluidframework/datastore-definitions';
18
- import { IChannelStorageService } from '@fluidframework/datastore-definitions';
19
- import { IConnection } from '@fluidframework/fluid-static';
20
- import { ICriticalContainerError } from '@fluidframework/container-definitions';
10
+ import type { IErrorBase } from '@fluidframework/core-interfaces';
11
+ import { IEvent } from '@fluidframework/core-interfaces';
12
+ import { IEventProvider } from '@fluidframework/core-interfaces';
21
13
  import { IEventThisPlaceHolder } from '@fluidframework/core-interfaces';
22
- import { IExperimentalIncrementalSummaryContext } from '@fluidframework/runtime-definitions';
23
- import { IFluidContainer } from '@fluidframework/fluid-static';
24
- import { IFluidContainerEvents } from '@fluidframework/fluid-static';
25
- import { IFluidDataStoreRuntime } from '@fluidframework/datastore-definitions';
14
+ import type { IFluidDataStoreRuntime } from '@fluidframework/datastore-definitions';
26
15
  import { IFluidHandle } from '@fluidframework/core-interfaces';
27
16
  import { IFluidLoadable } from '@fluidframework/core-interfaces';
28
- import { IFluidSerializer } from '@fluidframework/shared-object-base';
29
- import { IGarbageCollectionData } from '@fluidframework/runtime-definitions';
30
- import { IMember } from '@fluidframework/fluid-static';
31
- import { ISequencedDocumentMessage } from '@fluidframework/protocol-definitions';
32
- import { IServiceAudience } from '@fluidframework/fluid-static';
33
- import { IServiceAudienceEvents } from '@fluidframework/fluid-static';
34
17
  import { ISharedObject } from '@fluidframework/shared-object-base';
35
18
  import { ISharedObjectEvents } from '@fluidframework/shared-object-base';
36
- import { ISummaryTreeWithStats } from '@fluidframework/runtime-definitions';
37
- import { ITelemetryContext } from '@fluidframework/runtime-definitions';
38
- import { LoadableObjectClass } from '@fluidframework/fluid-static';
39
- import { LoadableObjectClassRecord } from '@fluidframework/fluid-static';
40
- import { LoadableObjectCtor } from '@fluidframework/fluid-static';
41
- import { MemberChangedListener } from '@fluidframework/fluid-static';
42
- import { SharedObject } from '@fluidframework/shared-object-base';
43
- import { SharedObjectClass } from '@fluidframework/fluid-static';
44
19
 
45
20
  // @public
46
21
  export type AllowedTypes = readonly LazyItem<TreeNodeSchema>[];
@@ -49,25 +24,90 @@ export type AllowedTypes = readonly LazyItem<TreeNodeSchema>[];
49
24
  export type ApplyKind<T, Kind extends FieldKind> = Kind extends FieldKind.Required ? T : undefined | T;
50
25
 
51
26
  // @public
52
- export type ArrayToUnion<T extends readonly unknown[]> = T extends readonly (infer TValue)[] ? TValue : never;
27
+ export type ArrayToUnion<T extends readonly unknown[]> = T[number];
53
28
 
54
- export { AttachState }
29
+ // @public
30
+ export enum AttachState {
31
+ Attached = "Attached",
32
+ Attaching = "Attaching",
33
+ Detached = "Detached"
34
+ }
55
35
 
56
- export { ConnectionState }
36
+ // @public
37
+ export enum ConnectionState {
38
+ CatchingUp = 1,
39
+ Connected = 2,
40
+ Disconnected = 0,
41
+ EstablishingConnection = 3
42
+ }
57
43
 
58
- export { ContainerErrorType }
44
+ // @public
45
+ export namespace ConnectionStateType {
46
+ export type CatchingUp = 1;
47
+ export type Connected = 2;
48
+ export type Disconnected = 0;
49
+ export type EstablishingConnection = 3;
50
+ }
59
51
 
60
- export { ContainerSchema }
52
+ // @public
53
+ export type ConnectionStateType = ConnectionStateType.Disconnected | ConnectionStateType.EstablishingConnection | ConnectionStateType.CatchingUp | ConnectionStateType.Connected;
61
54
 
62
55
  // @public
63
- export const create: unique symbol;
56
+ export type ContainerAttachProps<T = unknown> = T;
57
+
58
+ // @alpha
59
+ export const ContainerErrorTypes: {
60
+ readonly clientSessionExpiredError: "clientSessionExpiredError";
61
+ readonly genericError: "genericError";
62
+ readonly throttlingError: "throttlingError";
63
+ readonly dataCorruptionError: "dataCorruptionError";
64
+ readonly dataProcessingError: "dataProcessingError";
65
+ readonly usageError: "usageError";
66
+ };
64
67
 
65
- export { DataObjectClass }
68
+ // @alpha
69
+ export type ContainerErrorTypes = (typeof ContainerErrorTypes)[keyof typeof ContainerErrorTypes];
70
+
71
+ // @public
72
+ export interface ContainerSchema {
73
+ readonly dynamicObjectTypes?: readonly LoadableObjectClass[];
74
+ readonly initialObjects: LoadableObjectClassRecord;
75
+ }
76
+
77
+ // @public
78
+ export type DataObjectClass<T extends IFluidLoadable> = {
79
+ readonly factory: {
80
+ IFluidDataStoreFactory: DataObjectClass<T>["factory"];
81
+ };
82
+ } & LoadableObjectCtor<T>;
66
83
 
67
84
  // @public
68
85
  export const disposeSymbol: unique symbol;
69
86
 
70
- export { DriverErrorType }
87
+ // @public
88
+ export const DriverErrorTypes: {
89
+ readonly genericNetworkError: "genericNetworkError";
90
+ readonly authorizationError: "authorizationError";
91
+ readonly fileNotFoundOrAccessDeniedError: "fileNotFoundOrAccessDeniedError";
92
+ readonly offlineError: "offlineError";
93
+ readonly unsupportedClientProtocolVersion: "unsupportedClientProtocolVersion";
94
+ readonly writeError: "writeError";
95
+ readonly fetchFailure: "fetchFailure";
96
+ readonly fetchTokenError: "fetchTokenError";
97
+ readonly incorrectServerResponse: "incorrectServerResponse";
98
+ readonly fileOverwrittenInStorage: "fileOverwrittenInStorage";
99
+ readonly deltaStreamConnectionForbidden: "deltaStreamConnectionForbidden";
100
+ readonly locationRedirection: "locationRedirection";
101
+ readonly fluidInvalidSchema: "fluidInvalidSchema";
102
+ readonly fileIsLocked: "fileIsLocked";
103
+ readonly outOfStorageError: "outOfStorageError";
104
+ readonly genericError: "genericError";
105
+ readonly throttlingError: "throttlingError";
106
+ readonly usageError: "usageError";
107
+ };
108
+
109
+ // @public
110
+ export type DriverErrorTypes = (typeof DriverErrorTypes)[keyof typeof DriverErrorTypes];
71
111
 
72
112
  // @public
73
113
  export type Events<E> = {
@@ -99,20 +139,48 @@ export type FlexList<Item = unknown> = readonly LazyItem<Item>[];
99
139
  // @public
100
140
  export type FlexListToUnion<TList extends FlexList> = ExtractItemType<ArrayToUnion<TList>>;
101
141
 
102
- export { IConnection }
142
+ // @public
143
+ export interface IConnection {
144
+ id: string;
145
+ mode: "write" | "read";
146
+ }
103
147
 
104
- export { ICriticalContainerError }
148
+ // @public
149
+ export type ICriticalContainerError = IErrorBase;
105
150
 
106
151
  // @public
107
152
  export interface IDisposable {
108
153
  [disposeSymbol](): void;
109
154
  }
110
155
 
111
- export { IFluidContainer }
156
+ // @public @sealed
157
+ export interface IFluidContainer<TContainerSchema extends ContainerSchema = ContainerSchema> extends IEventProvider<IFluidContainerEvents> {
158
+ attach(props?: ContainerAttachProps): Promise<string>;
159
+ readonly attachState: AttachState;
160
+ connect(): void;
161
+ readonly connectionState: ConnectionStateType;
162
+ create<T extends IFluidLoadable>(objectClass: LoadableObjectClass<T>): Promise<T>;
163
+ disconnect(): void;
164
+ dispose(): void;
165
+ readonly disposed: boolean;
166
+ readonly initialObjects: InitialObjects<TContainerSchema>;
167
+ readonly isDirty: boolean;
168
+ }
112
169
 
113
- export { IFluidContainerEvents }
170
+ // @public @sealed
171
+ export interface IFluidContainerEvents extends IEvent {
172
+ (event: "connected", listener: () => void): void;
173
+ (event: "disconnected", listener: () => void): void;
174
+ (event: "saved", listener: () => void): void;
175
+ (event: "dirty", listener: () => void): void;
176
+ (event: "disposed", listener: (error?: ICriticalContainerError) => void): any;
177
+ }
114
178
 
115
- export { IMember }
179
+ // @public
180
+ export interface IMember {
181
+ connections: IConnection[];
182
+ userId: string;
183
+ }
116
184
 
117
185
  // @public
118
186
  export type ImplicitAllowedTypes = AllowedTypes | TreeNodeSchema;
@@ -120,6 +188,11 @@ export type ImplicitAllowedTypes = AllowedTypes | TreeNodeSchema;
120
188
  // @public
121
189
  export type ImplicitFieldSchema = FieldSchema | ImplicitAllowedTypes;
122
190
 
191
+ // @public
192
+ export type InitialObjects<T extends ContainerSchema> = {
193
+ [K in keyof T["initialObjects"]]: T["initialObjects"][K] extends LoadableObjectClass<infer TChannel> ? TChannel : never;
194
+ };
195
+
123
196
  // @public
124
197
  export type InsertableObjectFromSchemaRecord<T extends RestrictiveReadonlyRecord<string, ImplicitFieldSchema>> = {
125
198
  readonly [Property in keyof T]: InsertableTreeFieldFromImplicitField<T[Property]>;
@@ -136,9 +209,21 @@ export type InsertableTypedNode<T extends TreeNodeSchema> = (T extends {
136
209
  implicitlyConstructable: true;
137
210
  } ? NodeBuilderData<T> : never) | Unhydrated<NodeFromSchema<T>>;
138
211
 
139
- export { IServiceAudience }
212
+ // @public
213
+ export interface IServiceAudience<M extends IMember> extends IEventProvider<IServiceAudienceEvents<M>> {
214
+ getMembers(): Map<string, M>;
215
+ getMyself(): Myself<M> | undefined;
216
+ }
140
217
 
141
- export { IServiceAudienceEvents }
218
+ // @public
219
+ export interface IServiceAudienceEvents<M extends IMember> extends IEvent {
220
+ // @eventProperty
221
+ (event: "membersChanged", listener: () => void): void;
222
+ // @eventProperty
223
+ (event: "memberAdded", listener: MemberChangedListener<M>): void;
224
+ // @eventProperty
225
+ (event: "memberRemoved", listener: MemberChangedListener<M>): void;
226
+ }
142
227
 
143
228
  // @public
144
229
  export type IsEvent<Event> = Event extends (...args: any[]) => any ? true : false;
@@ -161,8 +246,7 @@ export interface ISubscribable<E extends Events<E>> {
161
246
  }
162
247
 
163
248
  // @public
164
- export class IterableTreeListContent<T> implements Iterable<T> {
165
- static [create]<T>(content: Iterable<T>): IterableTreeListContent<T>;
249
+ export class IterableTreeArrayContent<T> implements Iterable<T> {
166
250
  [Symbol.iterator](): Iterator<T>;
167
251
  }
168
252
 
@@ -180,17 +264,26 @@ export interface IValueChanged {
180
264
  // @public
181
265
  export type LazyItem<Item = unknown> = Item | (() => Item);
182
266
 
183
- export { LoadableObjectClass }
267
+ // @public
268
+ export type LoadableObjectClass<T extends IFluidLoadable = IFluidLoadable> = SharedObjectClass<T> | DataObjectClass<T>;
184
269
 
185
- export { LoadableObjectClassRecord }
270
+ // @public
271
+ export type LoadableObjectClassRecord = Record<string, LoadableObjectClass>;
186
272
 
187
- export { LoadableObjectCtor }
273
+ // @public
274
+ export type LoadableObjectCtor<T extends IFluidLoadable> = new (...args: any[]) => T;
188
275
 
189
276
  // @public
190
277
  export interface MakeNominal {
191
278
  }
192
279
 
193
- export { MemberChangedListener }
280
+ // @public
281
+ export type MemberChangedListener<M extends IMember> = (clientId: string, member: M) => void;
282
+
283
+ // @public
284
+ export type Myself<M extends IMember = IMember> = M & {
285
+ currentConnection: string;
286
+ };
194
287
 
195
288
  // @public
196
289
  export type NodeBuilderData<T extends TreeNodeSchema> = T extends TreeNodeSchema<string, NodeKind, unknown, infer TBuild> ? TBuild : never;
@@ -217,114 +310,77 @@ export type RestrictiveReadonlyRecord<K extends symbol | string, T> = {
217
310
  };
218
311
 
219
312
  // @public @sealed
220
- export class SchemaFactory<TScope extends string = string, TName extends number | string = string> {
313
+ export class SchemaFactory<out TScope extends string | undefined = string | undefined, TName extends number | string = string> {
221
314
  constructor(scope: TScope);
222
- 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>;
223
- 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>;
315
+ 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>;
316
+ 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>;
224
317
  readonly boolean: TreeNodeSchema<"com.fluidframework.leaf.boolean", NodeKind.Leaf, boolean, boolean>;
318
+ // @deprecated
225
319
  fixRecursiveReference<T extends AllowedTypes>(...types: T): void;
226
320
  readonly handle: TreeNodeSchema<"com.fluidframework.leaf.handle", NodeKind.Leaf, IFluidHandle<FluidObject & IFluidLoadable>, IFluidHandle<FluidObject & IFluidLoadable>>;
227
- 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>;
228
- 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>;
229
- 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>;
230
- 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>;
321
+ 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>;
322
+ 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>;
323
+ 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>;
324
+ 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>;
231
325
  readonly null: TreeNodeSchema<"com.fluidframework.leaf.null", NodeKind.Leaf, null, null>;
232
326
  readonly number: TreeNodeSchema<"com.fluidframework.leaf.number", NodeKind.Leaf, number, number>;
233
- 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>;
327
+ 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>;
234
328
  optional<const T extends ImplicitAllowedTypes>(t: T): FieldSchema<FieldKind.Optional, T>;
235
329
  // (undocumented)
236
330
  readonly scope: TScope;
237
331
  readonly string: TreeNodeSchema<"com.fluidframework.leaf.string", NodeKind.Leaf, string, string>;
238
332
  }
239
333
 
240
- // @public @deprecated
241
- export class SharedMap extends SharedObject<ISharedMapEvents> implements ISharedMap {
242
- [Symbol.iterator](): IterableIterator<[string, any]>;
243
- readonly [Symbol.toStringTag]: string;
244
- constructor(id: string, runtime: IFluidDataStoreRuntime, attributes: IChannelAttributes);
245
- // (undocumented)
246
- protected applyStashedOp(content: unknown): unknown;
247
- clear(): void;
248
- static create(runtime: IFluidDataStoreRuntime, id?: string): SharedMap;
249
- delete(key: string): boolean;
250
- entries(): IterableIterator<[string, any]>;
251
- forEach(callbackFn: (value: any, key: string, map: Map<string, any>) => void): void;
252
- get<T = any>(key: string): T | undefined;
253
- static getFactory(): IChannelFactory;
254
- has(key: string): boolean;
255
- keys(): IterableIterator<string>;
256
- // (undocumented)
257
- protected loadCore(storage: IChannelStorageService): Promise<void>;
258
- // (undocumented)
259
- protected onDisconnect(): void;
260
- // (undocumented)
261
- protected processCore(message: ISequencedDocumentMessage, local: boolean, localOpMetadata: unknown): void;
262
- // (undocumented)
263
- protected reSubmitCore(content: unknown, localOpMetadata: unknown): void;
264
- // (undocumented)
265
- protected rollback(content: unknown, localOpMetadata: unknown): void;
266
- set(key: string, value: unknown): this;
267
- get size(): number;
268
- // (undocumented)
269
- protected summarizeCore(serializer: IFluidSerializer, telemetryContext?: ITelemetryContext): ISummaryTreeWithStats;
270
- values(): IterableIterator<any>;
334
+ // @public
335
+ export interface SchemaIncompatible {
336
+ readonly canUpgrade: boolean;
271
337
  }
272
338
 
273
- export { SharedObjectClass }
339
+ // @public
340
+ export type ScopedSchemaName<TScope extends string | undefined, TName extends number | string> = TScope extends undefined ? `${TName}` : `${TScope}.${TName}`;
341
+
342
+ // @public @deprecated
343
+ export const SharedMap: {
344
+ getFactory(): IChannelFactory<ISharedMap>;
345
+ create(runtime: IFluidDataStoreRuntime, id?: string): ISharedMap;
346
+ };
347
+
348
+ // @public @deprecated
349
+ export type SharedMap = ISharedMap;
274
350
 
275
351
  // @public
276
- export class SharedTree implements ITree {
277
- // (undocumented)
278
- get attributes(): IChannelAttributes;
279
- // (undocumented)
280
- connect(services: IChannelServices): void;
281
- // (undocumented)
282
- getAttachSummary(fullTree?: boolean | undefined, trackState?: boolean | undefined, telemetryContext?: ITelemetryContext | undefined): ISummaryTreeWithStats;
283
- // (undocumented)
284
- static getFactory(): IChannelFactory;
285
- // (undocumented)
286
- getGCData(fullGC?: boolean | undefined): IGarbageCollectionData;
287
- // (undocumented)
288
- get handle(): IFluidHandle;
289
- // (undocumented)
290
- get id(): string;
291
- // (undocumented)
292
- get IFluidLoadable(): IFluidLoadable;
293
- // (undocumented)
294
- isAttached(): boolean;
295
- // (undocumented)
296
- schematize<TRoot extends ImplicitFieldSchema>(config: TreeConfiguration<TRoot>): TreeView<TreeFieldFromImplicitField<TRoot>>;
297
- // (undocumented)
298
- summarize(fullTree?: boolean | undefined, trackState?: boolean | undefined, telemetryContext?: ITelemetryContext | undefined, incrementalSummaryContext?: IExperimentalIncrementalSummaryContext | undefined): Promise<ISummaryTreeWithStats>;
352
+ export interface SharedObjectClass<T extends IFluidLoadable> {
353
+ readonly getFactory: () => IChannelFactory<T>;
299
354
  }
300
355
 
356
+ // @public
357
+ export const SharedTree: {
358
+ getFactory(): IChannelFactory<ITree>;
359
+ };
360
+
301
361
  // @public
302
362
  export const Tree: TreeApi;
303
363
 
304
364
  // @public
305
- export interface TreeApi {
306
- is<TSchema extends TreeNodeSchema>(value: unknown, schema: TSchema): value is NodeFromSchema<TSchema>;
307
- key(node: TreeNode): string | number;
308
- on<K extends keyof TreeNodeEvents>(node: TreeNode, eventName: K, listener: TreeNodeEvents[K]): () => void;
309
- parent(node: TreeNode): TreeNode | undefined;
310
- schema<T extends TreeNode | TreeLeafValue>(node: T): TreeNodeSchema<string, NodeKind, unknown, T>;
311
- readonly status: (node: TreeNode) => TreeStatus;
365
+ export interface TreeApi extends TreeNodeApi {
366
+ runTransaction<TNode extends TreeNode>(node: TNode, transaction: (node: TNode) => void | "rollback"): void;
367
+ runTransaction<TRoot>(tree: TreeView<TRoot>, transaction: (root: TRoot) => void | "rollback"): void;
312
368
  }
313
369
 
314
370
  // @public
315
- export interface TreeArrayNode<T extends ImplicitAllowedTypes = ImplicitAllowedTypes> extends TreeNode, TreeArrayNodeBase<TreeNodeFromImplicitAllowedTypes<T>, InsertableTreeNodeFromImplicitAllowedTypes<T>, TreeArrayNode> {
371
+ export interface TreeArrayNode<TAllowedTypes extends ImplicitAllowedTypes = ImplicitAllowedTypes> extends TreeNode, TreeArrayNodeBase<TreeNodeFromImplicitAllowedTypes<TAllowedTypes>, InsertableTreeNodeFromImplicitAllowedTypes<TAllowedTypes>, TreeArrayNode> {
316
372
  }
317
373
 
318
374
  // @public
319
375
  export const TreeArrayNode: {
320
- inline: <T>(content: Iterable<T>) => IterableTreeListContent<T>;
376
+ spread: <T>(content: Iterable<T>) => IterableTreeArrayContent<T>;
321
377
  };
322
378
 
323
379
  // @public
324
380
  export interface TreeArrayNodeBase<out T, in TNew, in TMoveFrom> extends ReadonlyArray<T>, TreeNode {
325
- insertAt(index: number, ...value: (TNew | IterableTreeListContent<TNew>)[]): void;
326
- insertAtEnd(...value: (TNew | IterableTreeListContent<TNew>)[]): void;
327
- insertAtStart(...value: (TNew | IterableTreeListContent<TNew>)[]): void;
381
+ insertAt(index: number, ...value: (TNew | IterableTreeArrayContent<TNew>)[]): void;
382
+ insertAtEnd(...value: (TNew | IterableTreeArrayContent<TNew>)[]): void;
383
+ insertAtStart(...value: (TNew | IterableTreeArrayContent<TNew>)[]): void;
328
384
  moveRangeToEnd(sourceStart: number, sourceEnd: number): void;
329
385
  moveRangeToEnd(sourceStart: number, sourceEnd: number, source: TMoveFrom): void;
330
386
  moveRangeToIndex(index: number, sourceStart: number, sourceEnd: number): void;
@@ -357,13 +413,9 @@ export type TreeFieldFromImplicitField<TSchema extends ImplicitFieldSchema = Fie
357
413
  export type TreeLeafValue = number | string | boolean | IFluidHandle | null;
358
414
 
359
415
  // @public
360
- export interface TreeMapNode<T extends ImplicitAllowedTypes = ImplicitAllowedTypes> extends TreeMapNodeBase<TreeNodeFromImplicitAllowedTypes<T>, InsertableTreeNodeFromImplicitAllowedTypes<T>> {
361
- }
362
-
363
- // @public
364
- export interface TreeMapNodeBase<TOut, TIn = TOut> extends ReadonlyMap<string, TOut>, TreeNode {
416
+ export interface TreeMapNode<T extends ImplicitAllowedTypes = ImplicitAllowedTypes> extends ReadonlyMap<string, TreeNodeFromImplicitAllowedTypes<T>>, TreeNode {
365
417
  delete(key: string): void;
366
- set(key: string, value: TIn | undefined): void;
418
+ set(key: string, value: InsertableTreeNodeFromImplicitAllowedTypes<T> | undefined): void;
367
419
  }
368
420
 
369
421
  // @public
@@ -371,6 +423,16 @@ export abstract class TreeNode implements WithType {
371
423
  abstract get [type](): string;
372
424
  }
373
425
 
426
+ // @public
427
+ export interface TreeNodeApi {
428
+ is<TSchema extends TreeNodeSchema>(value: unknown, schema: TSchema): value is NodeFromSchema<TSchema>;
429
+ key(node: TreeNode): string | number;
430
+ on<K extends keyof TreeNodeEvents>(node: TreeNode, eventName: K, listener: TreeNodeEvents[K]): () => void;
431
+ parent(node: TreeNode): TreeNode | undefined;
432
+ schema<T extends TreeNode | TreeLeafValue>(node: T): TreeNodeSchema<string, NodeKind, unknown, T>;
433
+ readonly status: (node: TreeNode) => TreeStatus;
434
+ }
435
+
374
436
  // @public
375
437
  export interface TreeNodeEvents {
376
438
  afterChange(): void;
@@ -380,27 +442,26 @@ export interface TreeNodeEvents {
380
442
  export type TreeNodeFromImplicitAllowedTypes<TSchema extends ImplicitAllowedTypes = TreeNodeSchema> = TSchema extends TreeNodeSchema ? NodeFromSchema<TSchema> : TSchema extends AllowedTypes ? NodeFromSchema<FlexListToUnion<TSchema>> : unknown;
381
443
 
382
444
  // @public
383
- 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>;
445
+ 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>;
384
446
 
385
447
  // @public
386
- 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> {
448
+ 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> {
387
449
  // @sealed
388
450
  new (data: TInsertable): Unhydrated<TNode>;
389
451
  }
390
452
 
391
453
  // @public
392
- export interface TreeNodeSchemaCore<out Name extends string, out Kind extends NodeKind, out ImplicitlyConstructable extends boolean> {
454
+ export interface TreeNodeSchemaCore<out Name extends string, out Kind extends NodeKind, out ImplicitlyConstructable extends boolean, out Info = unknown> {
393
455
  // (undocumented)
394
456
  readonly identifier: Name;
395
457
  readonly implicitlyConstructable: ImplicitlyConstructable;
396
- // (undocumented)
397
- readonly info: unknown;
458
+ readonly info: Info;
398
459
  // (undocumented)
399
460
  readonly kind: Kind;
400
461
  }
401
462
 
402
463
  // @public
403
- 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> {
464
+ 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> {
404
465
  // (undocumented)
405
466
  create(data: TInsertable): TNode;
406
467
  }
@@ -414,13 +475,16 @@ export enum TreeStatus {
414
475
 
415
476
  // @public
416
477
  export interface TreeView<in out TRoot> extends IDisposable {
478
+ readonly error?: SchemaIncompatible;
417
479
  readonly events: ISubscribable<TreeViewEvents>;
418
480
  readonly root: TRoot;
481
+ upgradeSchema(): void;
419
482
  }
420
483
 
421
484
  // @public
422
485
  export interface TreeViewEvents {
423
486
  afterBatch(): void;
487
+ rootChanged(): void;
424
488
  }
425
489
 
426
490
  // @public