github microsoft/FluidFramework client_v2.50.0
Fluid Framework v2.50.0 (minor)

latest releases: build-tools_v0.61.0, eslint-plugin-fluid_v0.4.1, api-markdown-documenter_v0.23.2...
5 months ago

Contents

  • 🚨 Breaking Changes
    • IFluidHandleInternal.bind (deprecated) has been removed (#24974)
  • 🌳 SharedTree DDS Changes
    • Record node kind was added (alpha) (#24908)
  • Other Changes
    • StateFactory.latest now accepts a validator parameter (#24432)

🚨 Breaking Changes

IFluidHandleInternal.bind (deprecated) has been removed (#24974)

IFluidHandleInternal.bind was deprecated in 2.40 and has now been removed. See release notes entry for more details.

Change details

Commit: 07e1837

Affected packages:

  • @fluidframework/core-interfaces
  • @fluidframework/datastore
  • @fluidframework/runtime-utils
  • @fluidframework/test-runtime-utils

⬆️ Table of contents

🌳 SharedTree DDS Changes

Record node kind was added (alpha) (#24908)

Adds a new kind of node to SharedTree that models a TypeScript record. As is the case with map nodes, record nodes only support string keys.

class MyRecord extends schemaFactory.record("my-record", [
  schemaFactory.number,
  schemaFactory.string,
]) {}
const myRecord = new MyRecord({
  foo: 42,
  bar: "Hello world!",
});

const foo = myRecord.foo; // 42

delete myRecord.foo;

myRecord.baz = 37;

const keys = Object.keys(myRecord); // ["bar", "baz"]
const values = Object.values(myRecord); // ["Hello world!", 37]
const entries = Object.entries(myRecord); // [["bar", "Hello world!"], ["baz", 37]]

NodeKind enum update

This change includes the addition of a new flag to the NodeKind enum. This API notes in its documentation that users should not treat its flags as an exhaustive set.

This change may break code that treats it that way. We recommend updating your code to be more tolerant of unknown node kinds going forward.

Also see alternative options for schema-agnostic tree traversal if needed:

Additional features

In addition to the operations afforded by TypeScript records, SharedTree record nodes can be iterated (equivalent to Object.entries).

class MyRecord extends schemaFactory.record("my-record", [schemaFactory.number, schemaFactory.string]) {}
const myRecord = new MyRecord({
	foo: 42,
	bar: "Hello world!"
});

for (const [key, value] of myRecord) {
	...
}

const a = { ...myRecord }; // { foo: 42, bar: "Hello world!" }
const b = [...myRecord]; // [["foo", 42], ["bar, "Hello world!"]]

Recursive records

Recursive record schema can be defined using recordRecursive on SchemaFactoryAlpha.

class MyRecord extends schemaFactory.recordRecursive("my-record", [
  schemaFactory.string,
  () => MyRecord,
]) {}
const myRecord = new MyRecord({
  foo: "Hello world!",
  bar: new MyRecord({
    x: "foo",
    y: new MyRecord({}),
  }),
});

TableSchema update (alpha)

The TableSchema APIs have been updated to use record nodes in the schema they generate. Specifically, the Row representation now uses a record to store its column-cell pairs, rather than a map.

The node types derived from these APIs model their data in a row-major format. That is, each row in the table contains the set of cells that belong to that row, where each cell is indexed by its corresponding column.

Previously, this was modeled using a MapNode. This format proved cumbersome to interop with popular table rendering libraries like tanstack, which expect a record-like format.

The persisted format of documents containing trees derived from these APIs is the same, so this change is forward and backward compatible.

JsonDomainSchema update (alpha)

JsonObject has been updated to a record rather than a map.

The persisted format of documents containing trees derived from these APIs is the same, so this change is forward and backward compatible.

Change details

Commit: b25667b

Affected packages:

  • @fluidframework/tree
  • fluid-framework

⬆️ Table of contents

Other Changes

StateFactory.latest now accepts a validator parameter (#24432)

The StateFactory.latest API now accepts a validator argument. The validator is a function that will be called at runtime to verify that the data is valid. This is especially useful when changing the schema of presence data.

See the presence documentation for more details.

Change details

Commit: ffe5d0b

Affected packages:

  • @fluidframework/presence

⬆️ Table of contents

🛠️ Start Building Today!

Please continue to engage with us on GitHub Discussion and Issue pages as you adopt Fluid Framework!

Don't miss a new FluidFramework release

NewReleases is sending notifications on new releases.