fluid-framework 2.53.0-350190 → 2.53.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 +125 -0
- package/api-report/fluid-framework.alpha.api.md +11 -13
- package/package.json +12 -12
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,130 @@
|
|
|
1
1
|
# fluid-framework
|
|
2
2
|
|
|
3
|
+
## 2.53.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- TableSchema's "removeColumn" API now removes corresponding cells (alpha) ([#25213](https://github.com/microsoft/FluidFramework/pull/25213)) [b665ba8320d](https://github.com/microsoft/FluidFramework/commit/b665ba8320d9ab6d1b87de81bdf54c2fde20e5c1)
|
|
8
|
+
|
|
9
|
+
Previously, the [removeColumn](https://fluidframework.com/docs/api/fluid-framework/tableschema-namespace/table-interface#removecolumn-methodsignature) API on Table nodes derived from [TableSchema](https://fluidframework.com/docs/api/fluid-framework/tableschema-namespace/) (alpha) only removed the `Column` node from the list of columns tracked by the table.
|
|
10
|
+
To also remove the corresponding cells from the table (which are stored on the `Row` nodes), the user was required to write a custom transaction that removed the column and cells.
|
|
11
|
+
|
|
12
|
+
The motivation for this design was due to performance concerns with transactions.
|
|
13
|
+
Those concerns are still relevant, but the data leak risk of dropping columns without removing corresponding cells seems a greater risk, and we have plans to address the performance issues with transactions.
|
|
14
|
+
|
|
15
|
+
- Adds staged allowed types to SchemaFactoryAlpha ([#25116](https://github.com/microsoft/FluidFramework/pull/25116)) [59baf03ac7f](https://github.com/microsoft/FluidFramework/commit/59baf03ac7f2f2779533c8c63e1de85c01a0d39a)
|
|
16
|
+
|
|
17
|
+
This adds the `staged` API to [`SchemaFactoryAlpha`](https://fluidframework.com/docs/api/fluid-framework/schemafactoryalpha-class).
|
|
18
|
+
Staged allowed types can be used for schema evolution to add members to an [`AllowedTypes`](https://fluidframework.com/docs/api/fluid-framework/allowedtypes-typealias) while supporting cross version collaboration.
|
|
19
|
+
|
|
20
|
+
Staged allowed types are [allowed types](https://fluidframework.com/docs/api/fluid-framework/allowedtypes-typealias) that can be upgraded by [schema upgrades](https://fluidframework.com/docs/api/fluid-framework/treeview-interface#upgradeschema-methodsignature).
|
|
21
|
+
Before being upgraded, any attempt to insert or move a node to a location which requires its type to be upgraded to be valid will throw an error.
|
|
22
|
+
|
|
23
|
+
To add a new member to an `AllowedTypes`, add the type wrapped by `staged`.
|
|
24
|
+
For example, migrating an array which previously supported only numbers to support both numbers and strings would start by deploying a version of the app using `staged`:
|
|
25
|
+
|
|
26
|
+
```typescript
|
|
27
|
+
class TestArray extends schemaFactoryAlpha.arrayAlpha("TestArray", [
|
|
28
|
+
SchemaFactoryAlpha.number,
|
|
29
|
+
SchemaFactoryAlpha.staged(SchemaFactoryAlpha.string),
|
|
30
|
+
]) {}
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
Once enough clients have this code update, it is safe to allow writing strings to the array.
|
|
34
|
+
To allow writing strings to the array, a code change must be made to remove the staged annotation:
|
|
35
|
+
|
|
36
|
+
```typescript
|
|
37
|
+
class TestArray extends schemaFactoryAlpha.arrayAlpha("TestArray", [
|
|
38
|
+
schemaFactoryAlpha.number,
|
|
39
|
+
schemaFactoryAlpha.string,
|
|
40
|
+
]) {}
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
Then when opening old documents [upgradeSchema](https://fluidframework.com/docs/api/fluid-framework/treeview-interface#upgradeschema-methodsignature) is used to upgrade the stored schema:
|
|
44
|
+
|
|
45
|
+
```typescript
|
|
46
|
+
view.upgradeSchema();
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
The `@alpha` API [extractPersistedSchema](https://fluidframework.com/docs/api/fluid-framework#extractpersistedschema-function) now takes the schema as an `ImplicitAnnotatedFieldSchema` and an additional parameter to filter which staged upgrades it includes.
|
|
50
|
+
|
|
51
|
+
Below is a full example of how the schema migration process works.
|
|
52
|
+
This can also be found in the [tests](https://github.com/microsoft/FluidFramework/blob/main/packages/dds/tree/src/test/simple-tree/api/stagedSchemaUpgrade.spec.ts).
|
|
53
|
+
|
|
54
|
+
```typescript
|
|
55
|
+
// Schema A: only number allowed
|
|
56
|
+
const schemaA = SchemaFactoryAlpha.optional([SchemaFactoryAlpha.number]);
|
|
57
|
+
|
|
58
|
+
// Schema B: number or string (string is staged)
|
|
59
|
+
const schemaB = SchemaFactoryAlpha.optional([
|
|
60
|
+
SchemaFactoryAlpha.number,
|
|
61
|
+
SchemaFactoryAlpha.staged(SchemaFactoryAlpha.string),
|
|
62
|
+
]);
|
|
63
|
+
|
|
64
|
+
// Schema C: number or string, both fully allowed
|
|
65
|
+
const schemaC = SchemaFactoryAlpha.optional([
|
|
66
|
+
SchemaFactoryAlpha.number,
|
|
67
|
+
SchemaFactoryAlpha.string,
|
|
68
|
+
]);
|
|
69
|
+
|
|
70
|
+
// Initialize with schema A.
|
|
71
|
+
const configA = new TreeViewConfiguration({
|
|
72
|
+
schema: schemaA,
|
|
73
|
+
});
|
|
74
|
+
const viewA = treeA.viewWith(configA);
|
|
75
|
+
viewA.initialize(5);
|
|
76
|
+
|
|
77
|
+
// Since we are running all the different versions of the app in the same process making changes synchronously,
|
|
78
|
+
// an explicit flush is needed to make them available to each other.
|
|
79
|
+
synchronizeTrees();
|
|
80
|
+
|
|
81
|
+
assert.deepEqual(viewA.root, 5);
|
|
82
|
+
|
|
83
|
+
// View the same document with a second tree using schema B.
|
|
84
|
+
const configB = new TreeViewConfiguration({
|
|
85
|
+
schema: schemaB,
|
|
86
|
+
});
|
|
87
|
+
const viewB = treeB.viewWith(configB);
|
|
88
|
+
// B cannot write strings to the root.
|
|
89
|
+
assert.throws(() => (viewB.root = "test"));
|
|
90
|
+
|
|
91
|
+
// View the same document with a third tree using schema C.
|
|
92
|
+
const configC = new TreeViewConfiguration({
|
|
93
|
+
schema: schemaC,
|
|
94
|
+
});
|
|
95
|
+
const viewC = treeC.viewWith(configC);
|
|
96
|
+
// Upgrade to schema C
|
|
97
|
+
viewC.upgradeSchema();
|
|
98
|
+
// Use the newly enabled schema.
|
|
99
|
+
viewC.root = "test";
|
|
100
|
+
|
|
101
|
+
synchronizeTrees();
|
|
102
|
+
|
|
103
|
+
// View A is now incompatible with the stored schema:
|
|
104
|
+
assert.equal(viewA.compatibility.canView, false);
|
|
105
|
+
|
|
106
|
+
// View B can still read the document, and now sees the string root which relies on the staged schema.
|
|
107
|
+
assert.deepEqual(viewB.root, "test");
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
- Allow edits in arrays to be concurrent to dependent edits of transactions with violated constraints ([#25191](https://github.com/microsoft/FluidFramework/pull/25191)) [ef64bae6ab2](https://github.com/microsoft/FluidFramework/commit/ef64bae6ab2848c67d778d14ad56ae021f54ac7a)
|
|
111
|
+
|
|
112
|
+
Before this release, making concurrent edits to an array could lead to assertion error `0x8a2` being thrown if the following conditions were met:
|
|
113
|
+
|
|
114
|
+
- Some edit `e1` was a transaction with a constraint that turned out to be violated by edits concurrent to (and sequenced before) `e1`
|
|
115
|
+
- Some edit `e2` was dependent on `e1` (from before the violation of its constraint)
|
|
116
|
+
- Some edit `e3` was concurrent to and sequenced after both `e1` and `e2`
|
|
117
|
+
- `e3` was either concurrent to or the revert of some other edit `e0` that predated `e1`, `e2`, and `e3`.
|
|
118
|
+
- `e0` and `e2` made edits to the same gap (that is, in the same space between nodes) in the sequence/array.
|
|
119
|
+
|
|
120
|
+
After this release, these scenarios will work as expected (that is, no assertion error thrown).
|
|
121
|
+
|
|
122
|
+
- Export TreeNode not only as a type ([#25226](https://github.com/microsoft/FluidFramework/pull/25226)) [eefb9522c01](https://github.com/microsoft/FluidFramework/commit/eefb9522c019ac68d8b4f40d7134116c78a1f2a5)
|
|
123
|
+
|
|
124
|
+
`TreeNode` can now be used as a runtime object.
|
|
125
|
+
This enables checking if an object is a `TreeNode` with `instanceof`.
|
|
126
|
+
`TreeNode` has customized `instanceof` support so it can detect `TreeNode` instances, even if they hide their prototype like [POJO mode nodes](https://fluidframework.com/docs/api/fluid-framework/schemafactory-class#schemafactory-remarks) do.
|
|
127
|
+
|
|
3
128
|
## 2.52.0
|
|
4
129
|
|
|
5
130
|
### Minor Changes
|
|
@@ -15,7 +15,7 @@ export function adaptEnum<TScope extends string, const TEnum extends Record<stri
|
|
|
15
15
|
}, Record<string, never>, true, Record<string, never>, undefined>; }[keyof TEnum]>;
|
|
16
16
|
};
|
|
17
17
|
|
|
18
|
-
// @alpha
|
|
18
|
+
// @alpha @input
|
|
19
19
|
export interface AllowedTypeMetadata {
|
|
20
20
|
readonly custom?: unknown;
|
|
21
21
|
readonly stagedSchemaUpgrade?: SchemaUpgrade;
|
|
@@ -24,7 +24,7 @@ export interface AllowedTypeMetadata {
|
|
|
24
24
|
// @public @system
|
|
25
25
|
export type AllowedTypes = readonly LazyItem<TreeNodeSchema>[];
|
|
26
26
|
|
|
27
|
-
// @alpha
|
|
27
|
+
// @alpha @input
|
|
28
28
|
export interface AllowedTypesMetadata {
|
|
29
29
|
readonly custom?: unknown;
|
|
30
30
|
}
|
|
@@ -32,16 +32,16 @@ export interface AllowedTypesMetadata {
|
|
|
32
32
|
// @alpha
|
|
33
33
|
export function allowUnused<T>(t?: T): void;
|
|
34
34
|
|
|
35
|
-
// @alpha
|
|
35
|
+
// @alpha @sealed
|
|
36
36
|
export interface AnnotatedAllowedType<T = LazyItem<TreeNodeSchema>> {
|
|
37
37
|
readonly metadata: AllowedTypeMetadata;
|
|
38
38
|
readonly type: T;
|
|
39
39
|
}
|
|
40
40
|
|
|
41
|
-
// @alpha
|
|
42
|
-
export interface AnnotatedAllowedTypes {
|
|
41
|
+
// @alpha @sealed
|
|
42
|
+
export interface AnnotatedAllowedTypes<T = LazyItem<TreeNodeSchema>> {
|
|
43
43
|
readonly metadata: AllowedTypesMetadata;
|
|
44
|
-
readonly types: readonly
|
|
44
|
+
readonly types: readonly AnnotatedAllowedType<T>[];
|
|
45
45
|
}
|
|
46
46
|
|
|
47
47
|
// @public @system
|
|
@@ -606,10 +606,10 @@ export interface IMember {
|
|
|
606
606
|
// @public
|
|
607
607
|
export type ImplicitAllowedTypes = AllowedTypes | TreeNodeSchema;
|
|
608
608
|
|
|
609
|
-
// @alpha
|
|
609
|
+
// @alpha @input
|
|
610
610
|
export type ImplicitAnnotatedAllowedTypes = TreeNodeSchema | AnnotatedAllowedType | AnnotatedAllowedTypes | readonly (AnnotatedAllowedType | LazyItem<TreeNodeSchema>)[];
|
|
611
611
|
|
|
612
|
-
// @alpha
|
|
612
|
+
// @alpha @input
|
|
613
613
|
export type ImplicitAnnotatedFieldSchema = FieldSchema | ImplicitAnnotatedAllowedTypes;
|
|
614
614
|
|
|
615
615
|
// @public
|
|
@@ -979,10 +979,8 @@ export interface NodeSchemaOptionsAlpha<out TCustomMetadata = unknown> extends N
|
|
|
979
979
|
// @alpha
|
|
980
980
|
export const noopValidator: JsonValidator;
|
|
981
981
|
|
|
982
|
-
// @alpha
|
|
983
|
-
export interface NormalizedAnnotatedAllowedTypes {
|
|
984
|
-
readonly metadata: AllowedTypesMetadata;
|
|
985
|
-
readonly types: readonly AnnotatedAllowedType<TreeNodeSchema>[];
|
|
982
|
+
// @alpha @sealed
|
|
983
|
+
export interface NormalizedAnnotatedAllowedTypes extends AnnotatedAllowedTypes<TreeNodeSchema> {
|
|
986
984
|
}
|
|
987
985
|
|
|
988
986
|
// @public @system
|
|
@@ -1956,7 +1954,7 @@ export type UnannotateAllowedTypesList<T extends readonly (AnnotatedAllowedType
|
|
|
1956
1954
|
};
|
|
1957
1955
|
|
|
1958
1956
|
// @alpha @system
|
|
1959
|
-
export type UnannotateImplicitAllowedTypes<T extends ImplicitAnnotatedAllowedTypes> = T extends AnnotatedAllowedTypes ? UnannotateAllowedTypes<T> : T extends AnnotatedAllowedType ? UnannotateAllowedTypesList<[T]> : T extends readonly (AnnotatedAllowedType | LazyItem<TreeNodeSchema>)[] ? UnannotateAllowedTypesList<T> : T extends TreeNodeSchema ? T :
|
|
1957
|
+
export type UnannotateImplicitAllowedTypes<T extends ImplicitAnnotatedAllowedTypes> = T extends AnnotatedAllowedTypes ? UnannotateAllowedTypes<T> : T extends AnnotatedAllowedType ? UnannotateAllowedTypesList<[T]> : T extends readonly (AnnotatedAllowedType | LazyItem<TreeNodeSchema>)[] ? UnannotateAllowedTypesList<T> : T extends TreeNodeSchema ? T : ImplicitAllowedTypes;
|
|
1960
1958
|
|
|
1961
1959
|
// @alpha @system
|
|
1962
1960
|
export type UnannotateImplicitFieldSchema<T extends ImplicitAnnotatedFieldSchema> = T extends ImplicitAnnotatedAllowedTypes ? UnannotateImplicitAllowedTypes<T> : T;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "fluid-framework",
|
|
3
|
-
"version": "2.53.0
|
|
3
|
+
"version": "2.53.0",
|
|
4
4
|
"description": "The main entry point into Fluid Framework public packages",
|
|
5
5
|
"homepage": "https://fluidframework.com",
|
|
6
6
|
"repository": {
|
|
@@ -57,17 +57,17 @@
|
|
|
57
57
|
"main": "lib/index.js",
|
|
58
58
|
"types": "lib/public.d.ts",
|
|
59
59
|
"dependencies": {
|
|
60
|
-
"@fluidframework/container-definitions": "2.53.0
|
|
61
|
-
"@fluidframework/container-loader": "2.53.0
|
|
62
|
-
"@fluidframework/core-interfaces": "2.53.0
|
|
63
|
-
"@fluidframework/core-utils": "2.53.0
|
|
64
|
-
"@fluidframework/driver-definitions": "2.53.0
|
|
65
|
-
"@fluidframework/fluid-static": "2.53.0
|
|
66
|
-
"@fluidframework/map": "2.53.0
|
|
67
|
-
"@fluidframework/runtime-utils": "2.53.0
|
|
68
|
-
"@fluidframework/sequence": "2.53.0
|
|
69
|
-
"@fluidframework/shared-object-base": "2.53.0
|
|
70
|
-
"@fluidframework/tree": "2.53.0
|
|
60
|
+
"@fluidframework/container-definitions": "~2.53.0",
|
|
61
|
+
"@fluidframework/container-loader": "~2.53.0",
|
|
62
|
+
"@fluidframework/core-interfaces": "~2.53.0",
|
|
63
|
+
"@fluidframework/core-utils": "~2.53.0",
|
|
64
|
+
"@fluidframework/driver-definitions": "~2.53.0",
|
|
65
|
+
"@fluidframework/fluid-static": "~2.53.0",
|
|
66
|
+
"@fluidframework/map": "~2.53.0",
|
|
67
|
+
"@fluidframework/runtime-utils": "~2.53.0",
|
|
68
|
+
"@fluidframework/sequence": "~2.53.0",
|
|
69
|
+
"@fluidframework/shared-object-base": "~2.53.0",
|
|
70
|
+
"@fluidframework/tree": "~2.53.0"
|
|
71
71
|
},
|
|
72
72
|
"devDependencies": {
|
|
73
73
|
"@arethetypeswrong/cli": "^0.17.1",
|