Skip to content

Commit bc259b2

Browse files
committed
Merge branch 'main' into test/remove-handle-bind-fn
2 parents c96571d + caae4ae commit bc259b2

File tree

200 files changed

+18133
-727
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

200 files changed

+18133
-727
lines changed

.changeset/green-poets-run.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
---
2+
"@fluidframework/presence": minor
3+
"__section": feature
4+
---
5+
6+
Presence: runtime schema validation
7+
8+
This is a placeholder changeset that will be updated in a future change.

.changeset/seven-toes-smell.md

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
---
2+
"@fluidframework/tree": minor
3+
"fluid-framework": minor
4+
"__section": tree
5+
---
6+
Add TreeAlpha.child and TreeAlpha.children APIs for generic tree traversal
7+
8+
#### TreeAlpha.child
9+
10+
Access a child node or value of a `TreeNode` by its property key.
11+
12+
```typescript
13+
class MyObject extends schemaFactory.object("MyObject", {
14+
foo: schemaFactory.string;
15+
bar: schemaFactory.optional(schemaFactory.string);
16+
}) {}
17+
18+
const myObject = new MyObject({
19+
foo: "Hello world!"
20+
});
21+
22+
const foo = TreeAlpha.child(myObject, "foo"); // "Hello world!"
23+
const bar = TreeAlpha.child(myObject, "bar"); // undefined
24+
const baz = TreeAlpha.child(myObject, "baz"); // undefined
25+
```
26+
27+
```typescript
28+
class MyArray extends schemaFactory.array("MyArray", schemaFactory.string) {}
29+
30+
const myArray = new MyArray("Hello", "World");
31+
32+
const child0 = TreeAlpha.child(myArray, 0); // "Hello"
33+
const child1 = TreeAlpha.child(myArray, 1); // "World
34+
const child2 = TreeAlpha.child(myArray, 2); // undefined
35+
```
36+
37+
#### TreeAlpha.children
38+
39+
Get all child nodes / values of a `TreeNode`, keyed by their property keys.
40+
41+
```typescript
42+
class MyObject extends schemaFactory.object("MyObject", {
43+
foo: schemaFactory.string;
44+
bar: schemaFactory.optional(schemaFactory.string);
45+
baz: schemaFactory.optional(schemaFactory.number);
46+
}) {}
47+
48+
const myObject = new MyObject({
49+
foo: "Hello world!",
50+
baz: 42,
51+
});
52+
53+
const children = TreeAlpha.children(myObject); // [["foo", "Hello world!"], ["baz", 42]]
54+
```
55+
56+
```typescript
57+
class MyArray extends schemaFactory.array("MyArray", schemaFactory.string) {}
58+
59+
const myArray = new MyArray("Hello", "World");
60+
61+
const children = TreeAlpha.children(myObject); // [[0, "Hello"], [1, "World"]]
62+
```

.changeset/spotty-bottles-rest.md

Lines changed: 109 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,109 @@
1+
---
2+
"fluid-framework": minor
3+
"@fluidframework/tree": minor
4+
"__section": feature
5+
---
6+
Persisted metadata for Shared Tree schemas (Alpha)
7+
8+
The persisted metadata feature for Shared Tree allows an application author to write document-persisted metadata along with the schema. This feature is supported for both node and field schemas.
9+
10+
#### Using the persisted metadata feature
11+
12+
As of now, persisted metadata support is available via the SchemaFactoryAlpha API:
13+
14+
```ts
15+
// Construct a schema factory with alpha APIs
16+
const schemaFactory = new SchemaFactoryAlpha("com.example");
17+
```
18+
19+
Persisted metadata can take the shape of any JSON-serializable object, e.g.:
20+
21+
```ts
22+
const persistedMetadata = { a: 2 };
23+
```
24+
25+
#### Feature flag
26+
27+
To enable persisted metadata, use `configuredSharedTree` to specify the format version. The tree that is returned can be substituted in place of the default `SharedTree` object exported by the Fluid Framework. For example:
28+
29+
```ts
30+
const tree = configuredSharedTree({
31+
formatVersion: SharedTreeFormatVersion.v5,
32+
}).create(runtime);
33+
34+
export const MyContainerSchema = {
35+
initialObjects: {
36+
appData: tree,
37+
},
38+
} satisfies ContainerSchema;
39+
```
40+
41+
#### Examples
42+
43+
##### Field schemas with persisted metadata
44+
45+
```ts
46+
// Construct a schema factory with alpha APIs
47+
const schemaFactory = new SchemaFactoryAlpha("com.example");
48+
49+
// Define metadata. This can take the shape of any JSON-serializable object.
50+
const persistedMetadata = { "a": 2 };
51+
52+
// Foo is an object type with metadata
53+
class Foo extends schemaFactory.objectAlpha("Foo", {
54+
// Metadata for a required number field
55+
bar: schemaFactory.required(schemaFactory.number, { persistedMetadata }),
56+
57+
// Metadata for an optional string field   
58+
baz: schemaFactory.optional(schemaFactory.string, { persistedMetadata }),
59+
// Metadata for the object type Foo       
60+
}, { persistedMetadata }) {}
61+
```
62+
63+
##### Recursive field schemas
64+
65+
```ts
66+
// Construct a schema factory with alpha APIs
67+
const schemaFactory = new SchemaFactoryAlpha("com.example");
68+
69+
// Define metadata. This can take the shape of any JSON-serializable object.
70+
const persistedMetadata = { "a": 2 };
71+
72+
// Recursive object schema with persisted metadata
73+
class RecursiveObject extends schemaFactory.objectRecursive("RecursiveObject", {
74+
x: [() => RecursiveObject, schemaFactory.number],
75+
}, { persistedMetadata }) {}
76+
77+
// Recursive field schema with metadata
78+
const recursiveField = schemaFactory.optionalRecursive(
79+
[() => RecursiveObject, schemaFactory.number],
80+
{ persistedMetadata });
81+
```
82+
83+
##### Recursive object schemas
84+
85+
```ts
86+
// Construct a schema factory with alpha APIs
87+
const schemaFactory = new SchemaFactoryAlpha("com.example");
88+
89+
// Define metadata. This can take the shape of any JSON-serializable object.
90+
const persistedMetadata = { "a": 2 };
91+
92+
// Recursive array schema
93+
class Foos extends schemaFactory.arrayRecursive(
94+
"FooList",
95+
[() => Foo],
96+
{ persistedMetadata }) {}
97+
98+
// Recursive object schema
99+
class Foo extends schemaFactory.objectRecursive(
100+
"Foo",
101+
{ fooList: Foos },
102+
{ persistedMetadata }) {}
103+
104+
// Recursive map schema
105+
class FooMap extends schemaFactory.mapRecursive(
106+
"FooMap",
107+
[() => Foo],
108+
{ persistedMetadata }) {}
109+
```

.changeset/weak-bottles-count.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
---
2+
"fluid-framework": minor
3+
"@fluidframework/tree": minor
4+
"__section": tree
5+
---
6+
Improved Schema Validation
7+
8+
When constructing a [`TreeViewConfiguration`](https://fluidframework.com/docs/api/fluid-framework/treeviewconfiguration-class), the same schema listed more than once in a given [`AllowedTypes`](https://fluidframework.com/docs/api/fluid-framework/allowedtypes-typealias) is now an error even when [`preventAmbiguity`](https://fluidframework.com/docs/api/fluid-framework/treeviewconfiguration-class#preventambiguity-property) is false.
9+
Previously a bug resulted in this only being rejected when `preventAmbiguity` was true.

.changeset/whole-days-argue.md

Lines changed: 0 additions & 11 deletions
This file was deleted.

.github/workflows/push-tag-create-release.yml

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,9 @@ jobs:
6363
run: echo "TAG_NAME=${GITHUB_REF}" >> $GITHUB_ENV
6464
- name: Set tag name from manual input
6565
if: github.event_name == 'workflow_dispatch'
66-
run: echo "TAG_NAME=refs/tags/${{ github.event.inputs.tag }}" >> $GITHUB_ENV
66+
env:
67+
TAG: ${{ github.event.inputs.tag }}
68+
run: echo "TAG_NAME=refs/tags/$TAG" >> $GITHUB_ENV
6769

6870
- name: Get release metadata JSON
6971
run: |
@@ -86,12 +88,20 @@ jobs:
8688
8789
- name: Check out tag from push
8890
if: github.event_name == 'push'
89-
run: |
90-
git checkout ${{ github.ref }}
91+
uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744 # ratchet:actions/checkout@v3
92+
with:
93+
ref: ${{ github.ref }}
94+
fetch-depth: 0 # all history
95+
persist-credentials: false
9196
- name: Check out tag from manual input
9297
if: github.event_name == 'workflow_dispatch'
93-
run: |
94-
git checkout refs/tags/${{ github.event.inputs.tag }}
98+
env:
99+
TAG: ${{ github.event.inputs.tag }}
100+
uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744 # ratchet:actions/checkout@v3
101+
with:
102+
ref: refs/tags/$TAG
103+
fetch-depth: 0 # all history
104+
persist-credentials: false
95105

96106
# Generate release reports
97107
- name: Create release reports (manifests)

.github/workflows/release-approval.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,9 +71,11 @@ jobs:
7171

7272
### These steps run on workflow_dispatch event only ###
7373
- name: "workflow_dispatch: Load PR number"
74+
env:
75+
PR: ${{ github.event.inputs.pr }}
7476
id: workflow_dispatch_load_pr
7577
if: github.event_name == 'workflow_dispatch'
76-
run: echo "pr_num=${{ github.event.inputs.pr }}" >> $GITHUB_OUTPUT
78+
run: echo "pr_num=$PR" >> $GITHUB_OUTPUT
7779

7880
- name: "workflow_dispatch: Load is_release_branch"
7981
id: workflow_dispatch_is_release_branch

packages/common/client-utils/src/layerCompat.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,13 @@ export interface ILayerCompatDetails extends Partial<IProvideLayerCompatDetails>
4747
/**
4848
* The generation of the layer. The other layer at the layer boundary uses this to check if this satisfies
4949
* the minimum generation it requires to be compatible.
50+
*
51+
* @remarks Generation is updated on a regular cadence, say, monthly. This will allow us to determine how
52+
* far apart two layers are in terms of time and whether they are compatible.
53+
* For example, say generation is updated every month and the compatibility window between layer1 and layer2 is
54+
* 6 months. Now, if layer1 is at generation 1 and layer2 is at generation 5, then they are 4 months apart and are
55+
* compatible. But if layer1 is at generation 1 and layer2 is at generation 8, then they are 7 months apart and
56+
* are not compatible.
5057
*/
5158
readonly generation: number;
5259
/**

packages/dds/legacy-dds/api-report/legacy-dds.legacy.alpha.api.md

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,6 @@
44
55
```ts
66

7-
// @alpha @legacy (undocumented)
8-
export type FullyReadonly<T> = {
9-
readonly [P in keyof T]: FullyReadonly<T[P]>;
10-
};
11-
127
// @alpha @legacy (undocumented)
138
export interface IDeleteOperation {
149
// (undocumented)
@@ -54,18 +49,24 @@ export interface ISharedArray<T extends SerializableTypeForSharedArray> extends
5449
// (undocumented)
5550
delete(index: number): void;
5651
// (undocumented)
57-
get(): FullyReadonly<T[]>;
52+
get(): readonly T[];
5853
// (undocumented)
5954
insert<TWrite>(index: number, value: Serializable<TWrite> & T): void;
6055
// (undocumented)
56+
insertBulkAfter<TWrite>(ref: T | undefined, values: (Serializable<TWrite> & T)[]): void;
57+
// (undocumented)
6158
move(oldIndex: number, newIndex: number): void;
59+
// (undocumented)
60+
toggle(entryId: string): void;
61+
// (undocumented)
62+
toggleMove(oldEntryId: string, newEntryId: string): void;
6263
}
6364

6465
// @alpha @legacy
6566
export interface ISharedArrayEvents extends ISharedObjectEvents {
66-
// (undocumented)
67+
// @eventProperty (undocumented)
6768
(event: "valueChanged", listener: (op: ISharedArrayOperation, isLocal: boolean, target: IEventThisPlaceHolder) => void): void;
68-
// (undocumented)
69+
// @eventProperty (undocumented)
6970
(event: "revertible", listener: (revertible: IRevertible) => void): void;
7071
}
7172

@@ -125,6 +126,12 @@ export type SerializableTypeForSharedArray = boolean | number | string | object
125126
// @alpha @legacy
126127
export type SerializableTypeForSharedSignal = boolean | number | string | IFluidHandle | object;
127128

129+
// @alpha @legacy
130+
export const SharedArray: ISharedObjectKind<ISharedArray<SerializableTypeForSharedArray>> & SharedObjectKind<ISharedArray<SerializableTypeForSharedArray>>;
131+
132+
// @alpha @legacy
133+
export const SharedArrayBuilder: <T extends SerializableTypeForSharedArray>() => ISharedObjectKind<ISharedArray<T>> & SharedObjectKind<ISharedArray<T>>;
134+
128135
// @alpha @legacy
129136
export const SharedSignal: ISharedObjectKind<ISharedSignal<any>> & SharedObjectKind<ISharedSignal<any>>;
130137

packages/dds/legacy-dds/src/array/index.ts

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,17 @@
33
* Licensed under the MIT License.
44
*/
55

6-
export { SharedArray } from "./sharedArray.js";
7-
export { SharedArrayFactory } from "./sharedArrayFactory.js";
6+
export {
7+
SharedArrayFactory,
8+
SharedArray,
9+
SharedArrayBuilder,
10+
} from "./sharedArrayFactory.js";
811
export { SharedArrayRevertible } from "./sharedArrayRevertible.js";
912
export type {
1013
SerializableTypeForSharedArray,
1114
ISharedArray,
1215
ISharedArrayEvents,
1316
ISharedArrayRevertible,
14-
FullyReadonly,
1517
IRevertible,
1618
} from "./interfaces.js";
1719
export type {
@@ -20,7 +22,7 @@ export type {
2022
IDeleteOperation,
2123
IMoveOperation,
2224
ISharedArrayRevertibleOperation,
23-
OperationType,
2425
IToggleMoveOperation,
2526
IToggleOperation,
2627
} from "./sharedArrayOperations.js";
28+
export { OperationType } from "./sharedArrayOperations.js";

0 commit comments

Comments
 (0)