fluid-framework 2.41.0 → 2.42.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,38 @@
1
1
  # fluid-framework
2
2
 
3
+ ## 2.42.0
4
+
5
+ ### Minor Changes
6
+
7
+ - Fix Tree.key and Tree.parent for Unhydrated nodes after edits ([#24708](https://github.com/microsoft/FluidFramework/pull/24708)) [8aa5c233e2](https://github.com/microsoft/FluidFramework/commit/8aa5c233e2d59f440fd9c923bca14687bb958d66)
8
+
9
+ In some cases, editing [Unhydrated](https://fluidframework.com/docs/api/fluid-framework/unhydrated-typealias) nodes could result in incorrect results being returned from [Tree.key](https://fluidframework.com/docs/data-structures/tree/nodes#treekey) and [Tree.parent](https://fluidframework.com/docs/data-structures/tree/nodes#treeparent).
10
+ This has been fixed.
11
+
12
+ - Defaulted identifier fields on unhydrated nodes are now enumerable ([#24739](https://github.com/microsoft/FluidFramework/pull/24739)) [3a5d0acfb6](https://github.com/microsoft/FluidFramework/commit/3a5d0acfb65f93a927405241e6047c8a04c8da58)
13
+
14
+ Previously, there was a special case for defaulted [identifier](https://fluidframework.com/docs/api/fluid-framework/schemafactory-class#identifier-property) fields on unhydrated nodes where they were not enumerable.
15
+ This special case has been removed: they are now enumerable independent of hydration status and defaulting.
16
+
17
+ - Name collisions from structurally named schema now error ([#24707](https://github.com/microsoft/FluidFramework/pull/24707)) [a343f0498f](https://github.com/microsoft/FluidFramework/commit/a343f0498f2039e68aa11e8ede98f32391ce727d)
18
+
19
+ It is legal to have multiple [TreeNodeSchema](https://fluidframework.com/docs/api/fluid-framework/treenodeschema-typealias) with the same name so long as they are not used together in the same tree.
20
+ Using different schema with the same name when building otherwise identical [structurally named](https://fluidframework.com/docs/api/fluid-framework/schemafactory-class#schemafactory-remarks) in the same [SchemaFactory](https://fluidframework.com/docs/api/fluid-framework/schemafactory-class) is not valid, however.
21
+ Previously doing this would not error, and instead return the first structurally named schema with that name.
22
+ Now this case throws an informative error:
23
+
24
+ ```typescript
25
+ const factory = new SchemaFactory(undefined);
26
+ class Child1 extends factory.object("Child", {}) {}
27
+ class Child2 extends factory.object("Child", {}) {}
28
+
29
+ const a = factory.map(Child1);
30
+
31
+ // Throws a UsageError with the message:
32
+ // "Structurally named schema collision: two schema named "Array<["Child"]>" were defined with different input schema."
33
+ const b = factory.array(Child2);
34
+ ```
35
+
3
36
  ## 2.41.0
4
37
 
5
38
  ### Minor Changes
@@ -101,6 +101,11 @@ export function cloneWithReplacements(root: unknown, rootKey: string, replacer:
101
101
  value: unknown;
102
102
  }): unknown;
103
103
 
104
+ // @alpha @input
105
+ export interface CodecWriteOptions extends ICodecOptions {
106
+ readonly oldestCompatibleClient: FluidClientVersion;
107
+ }
108
+
104
109
  // @public
105
110
  export enum CommitKind {
106
111
  Default = 0,
@@ -326,7 +331,7 @@ export function getSimpleSchema(schema: ImplicitFieldSchema): SimpleTreeSchema;
326
331
  // @alpha
327
332
  export type HandleConverter<TCustom> = (data: IFluidHandle) => TCustom;
328
333
 
329
- // @alpha
334
+ // @alpha @input
330
335
  export interface ICodecOptions {
331
336
  readonly jsonValidator: JsonValidator;
332
337
  }
@@ -840,7 +845,7 @@ export type JsonTreeSchema = JsonFieldSchema & {
840
845
  readonly $defs: Record<JsonSchemaId, JsonNodeSchema>;
841
846
  };
842
847
 
843
- // @alpha
848
+ // @alpha @input
844
849
  export interface JsonValidator {
845
850
  compile<Schema extends TSchema>(schema: Schema): SchemaValidationFunction<Schema>;
846
851
  }
@@ -1163,7 +1168,7 @@ export interface SchemaStatics {
1163
1168
  readonly string: LeafSchema<"string", string>;
1164
1169
  }
1165
1170
 
1166
- // @alpha
1171
+ // @alpha @input
1167
1172
  export interface SchemaValidationFunction<Schema extends TSchema> {
1168
1173
  check(data: unknown): data is Static<Schema>;
1169
1174
  }
@@ -1195,8 +1200,8 @@ export const SharedTreeFormatVersion: {
1195
1200
  // @alpha
1196
1201
  export type SharedTreeFormatVersion = typeof SharedTreeFormatVersion;
1197
1202
 
1198
- // @alpha
1199
- export type SharedTreeOptions = Partial<ICodecOptions> & Partial<SharedTreeFormatOptions> & ForestOptions;
1203
+ // @alpha @input
1204
+ export type SharedTreeOptions = Partial<CodecWriteOptions> & Partial<SharedTreeFormatOptions> & ForestOptions;
1200
1205
 
1201
1206
  // @alpha @sealed
1202
1207
  export interface SimpleArrayNodeSchema<out TCustomMetadata = unknown> extends SimpleNodeSchemaBase<NodeKind.Array, TCustomMetadata> {
@@ -1557,9 +1562,8 @@ export interface TreeAlpha {
1557
1562
  branch(node: TreeNode): TreeBranch | undefined;
1558
1563
  create<const TSchema extends ImplicitFieldSchema | UnsafeUnknownSchema>(schema: UnsafeUnknownSchema extends TSchema ? ImplicitFieldSchema : TSchema & ImplicitFieldSchema, data: InsertableField<TSchema>): Unhydrated<TSchema extends ImplicitFieldSchema ? TreeFieldFromImplicitField<TSchema> : TreeNode | TreeLeafValue | undefined>;
1559
1564
  exportCompressed(tree: TreeNode | TreeLeafValue, options: {
1560
- oldestCompatibleClient: FluidClientVersion;
1561
1565
  idCompressor?: IIdCompressor;
1562
- }): JsonCompatible<IFluidHandle>;
1566
+ } & Pick<CodecWriteOptions, "oldestCompatibleClient">): JsonCompatible<IFluidHandle>;
1563
1567
  exportConcise(node: TreeNode | TreeLeafValue, options?: TreeEncodingOptions): ConciseTree;
1564
1568
  exportConcise(node: TreeNode | TreeLeafValue | undefined, options?: TreeEncodingOptions): ConciseTree | undefined;
1565
1569
  exportVerbose(node: TreeNode | TreeLeafValue, options?: TreeEncodingOptions): VerboseTree;
package/dist/alpha.d.ts CHANGED
@@ -147,6 +147,7 @@ export {
147
147
  ArrayNodePojoEmulationSchema,
148
148
  ArrayNodeSchema,
149
149
  BranchableTree,
150
+ CodecWriteOptions,
150
151
  ConciseTree,
151
152
  FactoryContent,
152
153
  FactoryContentObject,
package/lib/alpha.d.ts CHANGED
@@ -147,6 +147,7 @@ export {
147
147
  ArrayNodePojoEmulationSchema,
148
148
  ArrayNodeSchema,
149
149
  BranchableTree,
150
+ CodecWriteOptions,
150
151
  ConciseTree,
151
152
  FactoryContent,
152
153
  FactoryContentObject,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "fluid-framework",
3
- "version": "2.41.0",
3
+ "version": "2.42.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.41.0",
61
- "@fluidframework/container-loader": "~2.41.0",
62
- "@fluidframework/core-interfaces": "~2.41.0",
63
- "@fluidframework/core-utils": "~2.41.0",
64
- "@fluidframework/driver-definitions": "~2.41.0",
65
- "@fluidframework/fluid-static": "~2.41.0",
66
- "@fluidframework/map": "~2.41.0",
67
- "@fluidframework/runtime-utils": "~2.41.0",
68
- "@fluidframework/sequence": "~2.41.0",
69
- "@fluidframework/shared-object-base": "~2.41.0",
70
- "@fluidframework/tree": "~2.41.0"
60
+ "@fluidframework/container-definitions": "~2.42.0",
61
+ "@fluidframework/container-loader": "~2.42.0",
62
+ "@fluidframework/core-interfaces": "~2.42.0",
63
+ "@fluidframework/core-utils": "~2.42.0",
64
+ "@fluidframework/driver-definitions": "~2.42.0",
65
+ "@fluidframework/fluid-static": "~2.42.0",
66
+ "@fluidframework/map": "~2.42.0",
67
+ "@fluidframework/runtime-utils": "~2.42.0",
68
+ "@fluidframework/sequence": "~2.42.0",
69
+ "@fluidframework/shared-object-base": "~2.42.0",
70
+ "@fluidframework/tree": "~2.42.0"
71
71
  },
72
72
  "devDependencies": {
73
73
  "@arethetypeswrong/cli": "^0.17.1",