fluid-framework 3.2.0 → 3.3.0

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,56 @@
1
1
  # fluid-framework
2
2
 
3
+ ## 3.3.0
4
+
5
+ ### Minor Changes
6
+
7
+ - Bug fix: revert preconditions no longer cause document corruption and other errors ([#28317](https://github.com/microsoft/FluidFramework/pull/28317)) [b4384d78657](https://github.com/microsoft/FluidFramework/commit/b4384d786575a2588b43df420d935ab749008a95)
8
+
9
+ Before this release, when a SharedTree client specified a [constraint](https://fluidframework.com/docs/data-structures/tree/transactions#constraints) as a [precondition for a revert](https://fluidframework.com/docs/api/fluid-framework/transactioncallbackstatusalpha-typealias) and (whether or not a revert was performed) such a constraint was violated,
10
+ that client could later error during the rebasing of its shared branches (when processing peer changes) or local branches
11
+ and was liable to generate invalid edits that would cause document corruption in the meantime.
12
+
13
+ - Preserve custom commit metadata when applying serialized changes ([#28330](https://github.com/microsoft/FluidFramework/pull/28330)) [89dc7355be6](https://github.com/microsoft/FluidFramework/commit/89dc7355be6e83d18d1a02a061e9aa0987844b7a)
14
+
15
+ Changes returned by `LocalChangeMetadata.getChange()` now include the commit's custom metadata, including metadata from nested transactions.
16
+ Applying these changes to another view preserves that metadata in its branch history.
17
+
18
+ - Reject reverts across schema changes ([#28320](https://github.com/microsoft/FluidFramework/pull/28320)) [ca6f67c1218](https://github.com/microsoft/FluidFramework/commit/ca6f67c12187c5ee423cbc2387b18e142869f015)
19
+
20
+ [`UntypedTreeViewAlpha.revertTo()`](https://fluidframework.com/docs/api/tree/untypedtreeviewalpha-interface#revertto-methodsignature) now throws a usage error if any commit being reverted contains a schema change.
21
+ The operation leaves the document unchanged, preserving transaction atomicity for commits that contain both schema and data changes.
22
+ You can still revert data changes made after a schema upgrade by targeting the revision of that upgrade or a later revision.
23
+
24
+ - createIndependentTreeAlpha no longer has the unused TSchema type parameter ([#28349](https://github.com/microsoft/FluidFramework/pull/28349)) [071fa2a9008](https://github.com/microsoft/FluidFramework/commit/071fa2a90080b9e8996a6dbe86c183dea6815aeb)
25
+
26
+ The unused `TSchema` type parameter has been removed from `createIndependentTreeAlpha`.
27
+ Calls that explicitly supply a type argument to `createIndependentTreeAlpha` must remove it.
28
+
29
+ `createIndependentTreeBeta` keeps its deprecated type parameter temporarily for compatibility, but the type parameter continues to have no effect.
30
+ Callers should omit it.
31
+
32
+ - Record node property read types now include undefined ([#28163](https://github.com/microsoft/FluidFramework/pull/28163)) [2de794b4a74](https://github.com/microsoft/FluidFramework/commit/2de794b4a74774f3686c65e64b8fee7d7e14e481)
33
+
34
+ Reading a property from a record node is now typed as `T | undefined` instead of `T`, matching the existing runtime behavior when the key is absent.
35
+ Consumers must narrow the result before using it as `T`.
36
+
37
+ ```typescript
38
+ const value = record.foo;
39
+ if (value !== undefined) {
40
+ // Use value as T.
41
+ }
42
+ ```
43
+
44
+ This is a bug fix to the `@beta` record node APIs: the previous typing incorrectly claimed that reading any key would produce a value, which could result in unexpected `undefined` values at runtime.
45
+
46
+ Note that this does not change what a record node can store; entries are still always defined.
47
+ Assigning `undefined` to a key continues to remove that entry, as before.
48
+
49
+ - Optimize memory use of arrays when using ForestTypeOptimized ([#27386](https://github.com/microsoft/FluidFramework/pull/27386)) [0735ff53d5c](https://github.com/microsoft/FluidFramework/commit/0735ff53d5cf384ce61aef039ab3c9414871fd73)
50
+
51
+ [`ForestTypeOptimized`](https://fluidframework.com/docs/api/fluid-framework#foresttypeoptimized-variable) now more efficiently deduplicates structural information for adjacent children in [array nodes](https://fluidframework.com/docs/api/tree/treearraynode-interface) after edits.
52
+ For arrays of small, uniformly shaped subtrees, such as [`PlainText`](https://fluidframework.com/docs/api/fluid-framework/plaintext-namespace), this reduces fragmentation and can reduce memory use by approximately 60%.
53
+
3
54
  ## 3.2.0
4
55
 
5
56
  ### Minor Changes
@@ -186,7 +186,7 @@ export enum AttachState {
186
186
  export type ChangeMetadata = LocalChangeMetadata | RemoteChangeMetadata;
187
187
 
188
188
  // @alpha
189
- export function checkCompatibility(viewWhichCreatedStoredSchema: TreeViewConfiguration, view: TreeViewConfiguration): Omit<SchemaCompatibilityStatus, "canInitialize">;
189
+ export function checkCompatibility(documentViewConfiguration: TreeViewConfiguration, clientViewConfiguration: TreeViewConfiguration): Omit<SchemaCompatibilityStatus, "canInitialize">;
190
190
 
191
191
  // @alpha
192
192
  export function cloneWithReplacements(root: unknown, rootKey: string, replacer: (key: string, value: unknown) => {
@@ -321,7 +321,7 @@ export function createBasicRegistryKey<T>(type: string): RegistryKey<T, T>;
321
321
  export function createIdentifierIndex<TSchema extends ImplicitFieldSchema>(view: TreeView<TSchema>): IdentifierIndex;
322
322
 
323
323
  // @alpha
324
- export function createIndependentTreeAlpha<const TSchema extends ImplicitFieldSchema>(options?: CreateIndependentTreeAlphaOptions): ViewableTree & Pick<ITreeAlpha, "exportVerbose" | "exportSimpleSchema">;
324
+ export function createIndependentTreeAlpha(options?: CreateIndependentTreeAlphaOptions): ViewableTree & Pick<ITreeAlpha, "exportVerbose" | "exportSimpleSchema">;
325
325
 
326
326
  // @alpha
327
327
  export type CreateIndependentTreeAlphaOptions = ForestOptions & IndependentViewTelemetryOptions & ((IndependentViewOptions & {
@@ -332,7 +332,7 @@ export type CreateIndependentTreeAlphaOptions = ForestOptions & IndependentViewT
332
332
  }));
333
333
 
334
334
  // @beta
335
- export function createIndependentTreeBeta<const TSchema extends ImplicitFieldSchema>(options?: ForestOptions): ViewableTree;
335
+ export function createIndependentTreeBeta<const Unused = unknown>(options?: ForestOptions): ViewableTree;
336
336
 
337
337
  // @beta
338
338
  export function createIndependentTreeView<const TSchema extends ImplicitFieldSchema>(config: TreeViewConfiguration<TSchema>, options?: ForestOptions): TreeViewBeta<TSchema>;
@@ -2743,7 +2743,7 @@ export type TreeObjectNode<T extends RestrictiveStringRecord<ImplicitFieldSchema
2743
2743
  export type TreeParsingOptions = TreeEncodingOptions<KeyEncodingOptions.usePropertyKeys | KeyEncodingOptions.knownStoredKeys>;
2744
2744
 
2745
2745
  // @beta
2746
- export interface TreeRecordNode<TAllowedTypes extends ImplicitAllowedTypes = ImplicitAllowedTypes> extends TreeNode, Record<string, TreeNodeFromImplicitAllowedTypes<TAllowedTypes>> {
2746
+ export interface TreeRecordNode<TAllowedTypes extends ImplicitAllowedTypes = ImplicitAllowedTypes> extends TreeNode, Record<string, TreeNodeFromImplicitAllowedTypes<TAllowedTypes> | undefined> {
2747
2747
  [Symbol.iterator](): FluidIterableIterator<[
2748
2748
  string,
2749
2749
  TreeNodeFromImplicitAllowedTypes<TAllowedTypes>
@@ -2751,7 +2751,7 @@ export interface TreeRecordNode<TAllowedTypes extends ImplicitAllowedTypes = Imp
2751
2751
  }
2752
2752
 
2753
2753
  // @beta @sealed @system
2754
- export interface TreeRecordNodeUnsafe<TAllowedTypes extends System_Unsafe.ImplicitAllowedTypesUnsafe> extends Record<string, System_Unsafe.TreeNodeFromImplicitAllowedTypesUnsafe<TAllowedTypes>>, TreeNode {
2754
+ export interface TreeRecordNodeUnsafe<TAllowedTypes extends System_Unsafe.ImplicitAllowedTypesUnsafe> extends Record<string, System_Unsafe.TreeNodeFromImplicitAllowedTypesUnsafe<TAllowedTypes> | undefined>, TreeNode {
2755
2755
  // (undocumented)
2756
2756
  [Symbol.iterator](): FluidIterableIterator<[
2757
2757
  string,
@@ -191,7 +191,7 @@ export interface ContainerSchema {
191
191
  export function createIdentifierIndex<TSchema extends ImplicitFieldSchema>(view: TreeView<TSchema>): IdentifierIndex;
192
192
 
193
193
  // @beta
194
- export function createIndependentTreeBeta<const TSchema extends ImplicitFieldSchema>(options?: ForestOptions): ViewableTree;
194
+ export function createIndependentTreeBeta<const Unused = unknown>(options?: ForestOptions): ViewableTree;
195
195
 
196
196
  // @beta
197
197
  export function createIndependentTreeView<const TSchema extends ImplicitFieldSchema>(config: TreeViewConfiguration<TSchema>, options?: ForestOptions): TreeViewBeta<TSchema>;
@@ -1632,7 +1632,7 @@ export type TreeNodeSchemaNonClass<Name extends string = string, Kind extends No
1632
1632
  export type TreeObjectNode<T extends RestrictiveStringRecord<ImplicitFieldSchema>, TypeName extends string = string> = TreeNode & ObjectFromSchemaRecord<T> & WithType<TypeName, NodeKind.Object, T>;
1633
1633
 
1634
1634
  // @beta
1635
- export interface TreeRecordNode<TAllowedTypes extends ImplicitAllowedTypes = ImplicitAllowedTypes> extends TreeNode, Record<string, TreeNodeFromImplicitAllowedTypes<TAllowedTypes>> {
1635
+ export interface TreeRecordNode<TAllowedTypes extends ImplicitAllowedTypes = ImplicitAllowedTypes> extends TreeNode, Record<string, TreeNodeFromImplicitAllowedTypes<TAllowedTypes> | undefined> {
1636
1636
  [Symbol.iterator](): FluidIterableIterator<[
1637
1637
  string,
1638
1638
  TreeNodeFromImplicitAllowedTypes<TAllowedTypes>
@@ -1640,7 +1640,7 @@ export interface TreeRecordNode<TAllowedTypes extends ImplicitAllowedTypes = Imp
1640
1640
  }
1641
1641
 
1642
1642
  // @beta @sealed @system
1643
- export interface TreeRecordNodeUnsafe<TAllowedTypes extends System_Unsafe.ImplicitAllowedTypesUnsafe> extends Record<string, System_Unsafe.TreeNodeFromImplicitAllowedTypesUnsafe<TAllowedTypes>>, TreeNode {
1643
+ export interface TreeRecordNodeUnsafe<TAllowedTypes extends System_Unsafe.ImplicitAllowedTypesUnsafe> extends Record<string, System_Unsafe.TreeNodeFromImplicitAllowedTypesUnsafe<TAllowedTypes> | undefined>, TreeNode {
1644
1644
  // (undocumented)
1645
1645
  [Symbol.iterator](): FluidIterableIterator<[
1646
1646
  string,
@@ -191,7 +191,7 @@ export interface ContainerSchema {
191
191
  export function createIdentifierIndex<TSchema extends ImplicitFieldSchema>(view: TreeView<TSchema>): IdentifierIndex;
192
192
 
193
193
  // @beta
194
- export function createIndependentTreeBeta<const TSchema extends ImplicitFieldSchema>(options?: ForestOptions): ViewableTree;
194
+ export function createIndependentTreeBeta<const Unused = unknown>(options?: ForestOptions): ViewableTree;
195
195
 
196
196
  // @beta
197
197
  export function createIndependentTreeView<const TSchema extends ImplicitFieldSchema>(config: TreeViewConfiguration<TSchema>, options?: ForestOptions): TreeViewBeta<TSchema>;
@@ -2002,7 +2002,7 @@ export type TreeNodeSchemaNonClass<Name extends string = string, Kind extends No
2002
2002
  export type TreeObjectNode<T extends RestrictiveStringRecord<ImplicitFieldSchema>, TypeName extends string = string> = TreeNode & ObjectFromSchemaRecord<T> & WithType<TypeName, NodeKind.Object, T>;
2003
2003
 
2004
2004
  // @beta
2005
- export interface TreeRecordNode<TAllowedTypes extends ImplicitAllowedTypes = ImplicitAllowedTypes> extends TreeNode, Record<string, TreeNodeFromImplicitAllowedTypes<TAllowedTypes>> {
2005
+ export interface TreeRecordNode<TAllowedTypes extends ImplicitAllowedTypes = ImplicitAllowedTypes> extends TreeNode, Record<string, TreeNodeFromImplicitAllowedTypes<TAllowedTypes> | undefined> {
2006
2006
  [Symbol.iterator](): FluidIterableIterator<[
2007
2007
  string,
2008
2008
  TreeNodeFromImplicitAllowedTypes<TAllowedTypes>
@@ -2010,7 +2010,7 @@ export interface TreeRecordNode<TAllowedTypes extends ImplicitAllowedTypes = Imp
2010
2010
  }
2011
2011
 
2012
2012
  // @beta @sealed @system
2013
- export interface TreeRecordNodeUnsafe<TAllowedTypes extends System_Unsafe.ImplicitAllowedTypesUnsafe> extends Record<string, System_Unsafe.TreeNodeFromImplicitAllowedTypesUnsafe<TAllowedTypes>>, TreeNode {
2013
+ export interface TreeRecordNodeUnsafe<TAllowedTypes extends System_Unsafe.ImplicitAllowedTypesUnsafe> extends Record<string, System_Unsafe.TreeNodeFromImplicitAllowedTypesUnsafe<TAllowedTypes> | undefined>, TreeNode {
2014
2014
  // (undocumented)
2015
2015
  [Symbol.iterator](): FluidIterableIterator<[
2016
2016
  string,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "fluid-framework",
3
- "version": "3.2.0",
3
+ "version": "3.3.0",
4
4
  "description": "The main entry point into Fluid Framework public packages",
5
5
  "homepage": "https://fluidframework.com",
6
6
  "repository": {
@@ -43,17 +43,17 @@
43
43
  }
44
44
  },
45
45
  "dependencies": {
46
- "@fluidframework/container-definitions": "~3.2.0",
47
- "@fluidframework/container-loader": "~3.2.0",
48
- "@fluidframework/core-interfaces": "~3.2.0",
49
- "@fluidframework/core-utils": "~3.2.0",
50
- "@fluidframework/driver-definitions": "~3.2.0",
51
- "@fluidframework/fluid-static": "~3.2.0",
52
- "@fluidframework/map": "~3.2.0",
53
- "@fluidframework/runtime-utils": "~3.2.0",
54
- "@fluidframework/sequence": "~3.2.0",
55
- "@fluidframework/shared-object-base": "~3.2.0",
56
- "@fluidframework/tree": "~3.2.0"
46
+ "@fluidframework/container-definitions": "~3.3.0",
47
+ "@fluidframework/container-loader": "~3.3.0",
48
+ "@fluidframework/core-interfaces": "~3.3.0",
49
+ "@fluidframework/core-utils": "~3.3.0",
50
+ "@fluidframework/driver-definitions": "~3.3.0",
51
+ "@fluidframework/fluid-static": "~3.3.0",
52
+ "@fluidframework/map": "~3.3.0",
53
+ "@fluidframework/runtime-utils": "~3.3.0",
54
+ "@fluidframework/sequence": "~3.3.0",
55
+ "@fluidframework/shared-object-base": "~3.3.0",
56
+ "@fluidframework/tree": "~3.3.0"
57
57
  },
58
58
  "devDependencies": {
59
59
  "@arethetypeswrong/cli": "^0.18.5",
@@ -67,7 +67,7 @@
67
67
  "concurrently": "^10.0.3",
68
68
  "copyfiles": "^2.4.1",
69
69
  "eslint": "~9.39.1",
70
- "fluid-framework-previous": "npm:fluid-framework@3.1.0",
70
+ "fluid-framework-previous": "npm:fluid-framework@3.2.0",
71
71
  "jiti": "^2.6.1",
72
72
  "rimraf": "^6.1.3",
73
73
  "typescript": "~6.0.3"