diff --git a/.changeset/stinky-shoes-melt.md b/.changeset/stinky-shoes-melt.md index 47e5a5238424..9b28f8091d97 100644 --- a/.changeset/stinky-shoes-melt.md +++ b/.changeset/stinky-shoes-melt.md @@ -3,16 +3,18 @@ --- --- "section": "tree" +"highlight": true --- -New alpha APIs for indexing +✨ New! Alpha APIs for indexing SharedTree now supports indexing via two new APIs, `createSimpleTreeIndex` and `createIdentifierIndex`. `createSimpleTreeIndex` is used to create a `SimpleTreeIndex` which indexes nodes based on their schema. Depending on the schema, the user specifies which field to key the node on. -example that indexes `IndexableParent`s and `IndexableChild`s and returns the first node of a particular key: +The following example indexes `IndexableParent`s and `IndexableChild`s and returns the first node of a particular key: + ```typescript function isStringKey(key: TreeIndexKey): key is string { return typeof key === "string"; @@ -29,7 +31,8 @@ const index = createSimpleTreeIndex( `createIdentifierIndex` is used to create an `IdentifierIndex` which provides an efficient way to retrieve nodes using the node identifier. -example: +Example: + ```typescript const identifierIndex = createIdentifierIndex(view); const node = identifierIndex.get("node12345"); diff --git a/RELEASE_NOTES/2.11.0.md b/RELEASE_NOTES/2.11.0.md index f45541743759..bfb6b11157bd 100644 --- a/RELEASE_NOTES/2.11.0.md +++ b/RELEASE_NOTES/2.11.0.md @@ -9,9 +9,9 @@ - [Presence-related events now support the `off` event deregistration pattern (#23196)](#presence-related-events-now-support-the-off-event-deregistration-pattern-23196) - [Presence updates are now grouped and throttled (#23075)](#presence-updates-are-now-grouped-and-throttled-23075) - [🌳 SharedTree DDS Changes](#-sharedtree-dds-changes) + - [✨ New! Alpha APIs for indexing (#22491)](#-new-alpha-apis-for-indexing-22491) - [Providing unused properties in object literals for building empty ObjectNodes no longer compiles (#23162)](#providing-unused-properties-in-object-literals-for-building-empty-objectnodes-no-longer-compiles-23162) - [Revertible objects can now be cloned using `RevertibleAlpha.clone()` (#23044)](#revertible-objects-can-now-be-cloned-using-revertiblealphaclone-23044) - - [New alpha APIs for indexing (#22491)](#new-alpha-apis-for-indexing-22491) - [Other Changes](#other-changes) - [API clarifications for devtools packages (#23165)](#api-clarifications-for-devtools-packages-23165) @@ -151,48 +151,13 @@ Affected packages: ## 🌳 SharedTree DDS Changes -### Providing unused properties in object literals for building empty ObjectNodes no longer compiles ([#23162](https://github.com/microsoft/FluidFramework/issues/23162)) - -ObjectNodes with no fields will now emit a compiler error if constructed from an object literal with fields. This matches the behavior of non-empty ObjectNodes which already gave errors when unexpected properties were provided. - -```typescript -class A extends schemaFactory.object("A", {}) {} -const a = new A({ thisDoesNotExist: 5 }); // This now errors. -``` - -#### Change details - -Commit: [`dc3c300`](https://github.com/microsoft/FluidFramework/commit/dc3c30019ef869b27b9468bff59f10434d3c5c68) - -Affected packages: - -- fluid-framework -- @fluidframework/tree - -[⬆️ Table of contents](#contents) - -### Revertible objects can now be cloned using `RevertibleAlpha.clone()` ([#23044](https://github.com/microsoft/FluidFramework/issues/23044)) - -The `DisposableRevertible` interface has been replaced with `RevertibleAlpha`. The new `RevertibleAlpha` interface extends `Revertible` and includes a `clone(branch: TreeBranch)` method to facilitate cloning a Revertible to a specified target branch. The source branch where the `RevertibleAlpha` was created must share revision logs with the target branch where the `RevertibleAlpha` is being cloned. If this condition is not met, the operation will throw an error. - -#### Change details - -Commit: [`5abfa01`](https://github.com/microsoft/FluidFramework/commit/5abfa015aff9d639d82830f3ad828324d5680bd7) - -Affected packages: - -- fluid-framework -- @fluidframework/tree - -[⬆️ Table of contents](#contents) - -### New alpha APIs for indexing ([#22491](https://github.com/microsoft/FluidFramework/issues/22491)) +### ✨ New! Alpha APIs for indexing ([#22491](https://github.com/microsoft/FluidFramework/issues/22491)) SharedTree now supports indexing via two new APIs, `createSimpleTreeIndex` and `createIdentifierIndex`. `createSimpleTreeIndex` is used to create a `SimpleTreeIndex` which indexes nodes based on their schema. Depending on the schema, the user specifies which field to key the node on. -example that indexes `IndexableParent`s and `IndexableChild`s and returns the first node of a particular key: +The following example indexes `IndexableParent`s and `IndexableChild`s and returns the first node of a particular key: ```typescript function isStringKey(key: TreeIndexKey): key is string { @@ -213,7 +178,7 @@ const index = createSimpleTreeIndex( `createIdentifierIndex` is used to create an `IdentifierIndex` which provides an efficient way to retrieve nodes using the node identifier. -example: +Example: ```typescript const identifierIndex = createIdentifierIndex(view); @@ -230,6 +195,41 @@ Affected packages: [⬆️ Table of contents](#contents) +### Providing unused properties in object literals for building empty ObjectNodes no longer compiles ([#23162](https://github.com/microsoft/FluidFramework/issues/23162)) + +ObjectNodes with no fields will now emit a compiler error if constructed from an object literal with fields. This matches the behavior of non-empty ObjectNodes which already gave errors when unexpected properties were provided. + +```typescript +class A extends schemaFactory.object("A", {}) {} +const a = new A({ thisDoesNotExist: 5 }); // This now errors. +``` + +#### Change details + +Commit: [`dc3c300`](https://github.com/microsoft/FluidFramework/commit/dc3c30019ef869b27b9468bff59f10434d3c5c68) + +Affected packages: + +- fluid-framework +- @fluidframework/tree + +[⬆️ Table of contents](#contents) + +### Revertible objects can now be cloned using `RevertibleAlpha.clone()` ([#23044](https://github.com/microsoft/FluidFramework/issues/23044)) + +The `DisposableRevertible` interface has been replaced with `RevertibleAlpha`. The new `RevertibleAlpha` interface extends `Revertible` and includes a `clone(branch: TreeBranch)` method to facilitate cloning a Revertible to a specified target branch. The source branch where the `RevertibleAlpha` was created must share revision logs with the target branch where the `RevertibleAlpha` is being cloned. If this condition is not met, the operation will throw an error. + +#### Change details + +Commit: [`5abfa01`](https://github.com/microsoft/FluidFramework/commit/5abfa015aff9d639d82830f3ad828324d5680bd7) + +Affected packages: + +- fluid-framework +- @fluidframework/tree + +[⬆️ Table of contents](#contents) + ## Other Changes ### API clarifications for devtools packages ([#23165](https://github.com/microsoft/FluidFramework/issues/23165))