fluid-framework 2.40.0-336023 → 2.41.0-337492

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,75 @@
1
1
  # fluid-framework
2
2
 
3
+ ## 2.40.0
4
+
5
+ ### Minor Changes
6
+
7
+ - SchemaFactoryAlpha.object has been renamed to SchemaFactoryAlpha.objectAlpha ([#24478](https://github.com/microsoft/FluidFramework/pull/24478)) [12e5ab3b33](https://github.com/microsoft/FluidFramework/commit/12e5ab3b335a8af263e1cc84f8951cf02db79b8b)
8
+
9
+ This rename was done so that changes can be made to the signature of the class.
10
+ This is a breaking change and uses of `SchemaFactoryAlpha.object` may need to be changed to `SchemaFactoryAlpha.objectAlpha`.
11
+
12
+ - AllowedTypes array handling has been updated ([#24484](https://github.com/microsoft/FluidFramework/pull/24484)) [f0a71ccce7](https://github.com/microsoft/FluidFramework/commit/f0a71ccce7a055e99ce9f4ba15e1cede529bbc9c)
13
+
14
+ As an optimization, how [AllowedTypes](https://fluidframework.com/docs/api/fluid-framework/allowedtypes-typealias) arrays are processed has changed.
15
+ Now much larger arrays can be provided without hitting:
16
+
17
+ > "Type instantiation is excessively deep and possibly infinite.ts"
18
+
19
+ Previously, arrays of around 43 schema would start having this issue, but now arrays of hundreds work correctly.
20
+
21
+ This optimization has resulted in a small change in behavior for how [input types](https://fluidframework.com/docs/api/fluid-framework/input-typealias) are computed.
22
+ When the `AllowedTypes` array has a type that is a union of two arrays, and the two arrays start with the same subsequence of types,
23
+ previously this would allow the types from the common prefix of the arrays.
24
+ For example `[typeof A] | [typeof A, typeof B]` would permit inserting content compatible with `A`.
25
+ Now all such unions produce `never` for their insertable node types (just like this example would if the order of the second array were reversed).
26
+ This case was not intentionally supported, and as documented in [input types](https://fluidframework.com/docs/api/fluid-framework/input-typealias), non-exact types, like these unions,
27
+ are not guaranteed to produce anything other than `never`.
28
+
29
+ If providing exact schema is impractical and the previous behavior is required, convert the union of arrays to an array of unions.
30
+ The above example can be turned into `[typeof A, typeof B | typeof A]`.
31
+
32
+ This is also fix for a case where
33
+ [AllowedTypes](https://fluidframework.com/docs/api/fluid-framework/allowedtypes-typealias)
34
+ was order dependent, which violates its documented order independence.
35
+
36
+ - A SharedTree document corruption bug has been fixed ([#24565](https://github.com/microsoft/FluidFramework/pull/24565)) [6b3e150395](https://github.com/microsoft/FluidFramework/commit/6b3e15039543a2bab4de5b2e969301f0e7f1f3db)
37
+
38
+ There was a bug where local changes were not correctly sent to peers.
39
+ This could lead to a permanent loss of consistency and ultimately document corruption.
40
+ See [PR24561](https://github.com/microsoft/FluidFramework/pull/24561) for details.
41
+
42
+ - IContainer.getContainerPackageInfo has been removed ([#24525](https://github.com/microsoft/FluidFramework/pull/24525)) [15a541265b](https://github.com/microsoft/FluidFramework/commit/15a541265ba6293bf24e95308a5e667d5f7e9794)
43
+
44
+ `IContainer.getContainerPackageInfo()` was set to be removed in release 2.40.0. To access the package name `getContainerPackageInfo()` provided, use `IFluidCodeDetails.package` returned by `IContainer.getLoadedCodeDetails()`.
45
+
46
+ See [issue #23898](https://github.com/microsoft/FluidFramework/issues/23898) for more information.
47
+
48
+ - The extractPersistedSchema (alpha) API has had its arguments adjusted ([#24562](https://github.com/microsoft/FluidFramework/pull/24562)) [2e6b0cfd74](https://github.com/microsoft/FluidFramework/commit/2e6b0cfd74f3c3db5ce3b6b3f8ff8decbfc24ab6)
49
+
50
+ The [extractPersistedSchema](https://fluidframework.com/docs/api/tree/#extractpersistedschema-function) function has been updated to take in [SimpleTreeSchema](https://fluidframework.com/docs/api/fluid-framework/simpletreeschema-interface).
51
+ This makes it possible to use with simple schema derived from stored schema, like those returned from [ITreeAlpha.exportSimpleSchema](https://fluidframework.com/docs/api/fluid-framework/itreealpha-interface#exportsimpleschema-methodsignature).
52
+ Like [TreeAlpha.exportCompressed](https://fluidframework.com/docs/api/tree#treealpha-variable), `extractPersistedSchema` now takes in [FluidClientVersion](https://fluidframework.com/docs/api/fluid-framework/fluidclientversion-enum) to make it possible to opt into newer formats when they become available.
53
+
54
+ Additionally, `persistedToSimpleSchema` has been added to fill in a gap in the API.
55
+ Without `persistedToSimpleSchema` it would be impossible to parse the persisted format without a valid compressed tree to provide to [independentInitializedView](https://fluidframework.com/docs/api/tree/#independentinitializedview-functionc).
56
+
57
+ - SchemaFactoryAlpha supports adding metadata to AllowedTypes ([#24478](https://github.com/microsoft/FluidFramework/pull/24478)) [12e5ab3b33](https://github.com/microsoft/FluidFramework/commit/12e5ab3b335a8af263e1cc84f8951cf02db79b8b)
58
+
59
+ This change allows metadata to be added to [`AllowedTypes`](https://fluidframework.com/docs/api/fluid-framework/allowedtypes-typealias) as well as individual types in a set of `AllowedTypes`.
60
+ Users can define custom metadata by putting their `AllowedTypes` in an object with `metadata` and `types` properties:
61
+
62
+ ```typescript
63
+ schemaFactoryAlpha.arrayAlpha({
64
+ metadata: {
65
+ custom: "these allowed types are annotated",
66
+ },
67
+ types: [SchemaFactory.string, SchemaFactory.number],
68
+ });
69
+ ```
70
+
71
+ This annotation system will also be used to implement future schema features.
72
+
3
73
  ## 2.33.0
4
74
 
5
75
  ### Minor Changes
@@ -196,7 +196,7 @@ export function evaluateLazySchema<T extends TreeNodeSchema>(value: LazyItem<T>)
196
196
  type ExtractItemType<Item extends LazyItem> = Item extends () => infer Result ? Result : Item;
197
197
 
198
198
  // @alpha
199
- export function extractPersistedSchema(schema: ImplicitFieldSchema): JsonCompatible;
199
+ export function extractPersistedSchema(schema: SimpleTreeSchema, oldestCompatibleClient: FluidClientVersion): JsonCompatible;
200
200
 
201
201
  // @alpha @system
202
202
  export type FactoryContent = IFluidHandle | string | number | boolean | null | Iterable<readonly [string, InsertableContent]> | readonly InsertableContent[] | FactoryContentObject;
@@ -969,6 +969,9 @@ export type Off = () => void;
969
969
  // @alpha
970
970
  export function onAssertionFailure(handler: (error: Error) => void): () => void;
971
971
 
972
+ // @alpha
973
+ export function persistedToSimpleSchema(persisted: JsonCompatible, options: ICodecOptions): SimpleTreeSchema;
974
+
972
975
  // @alpha @system
973
976
  export type PopUnion<Union, AsOverloadedFunction = UnionToIntersection<Union extends unknown ? (f: Union) => void : never>> = AsOverloadedFunction extends (a: infer First) => void ? First : never;
974
977
 
package/dist/alpha.d.ts CHANGED
@@ -263,6 +263,7 @@ export {
263
263
  independentView,
264
264
  noopValidator,
265
265
  onAssertionFailure,
266
+ persistedToSimpleSchema,
266
267
  replaceConciseTreeHandles,
267
268
  replaceHandles,
268
269
  replaceVerboseTreeHandles,
package/lib/alpha.d.ts CHANGED
@@ -263,6 +263,7 @@ export {
263
263
  independentView,
264
264
  noopValidator,
265
265
  onAssertionFailure,
266
+ persistedToSimpleSchema,
266
267
  replaceConciseTreeHandles,
267
268
  replaceHandles,
268
269
  replaceVerboseTreeHandles,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "fluid-framework",
3
- "version": "2.40.0-336023",
3
+ "version": "2.41.0-337492",
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.40.0-336023",
61
- "@fluidframework/container-loader": "2.40.0-336023",
62
- "@fluidframework/core-interfaces": "2.40.0-336023",
63
- "@fluidframework/core-utils": "2.40.0-336023",
64
- "@fluidframework/driver-definitions": "2.40.0-336023",
65
- "@fluidframework/fluid-static": "2.40.0-336023",
66
- "@fluidframework/map": "2.40.0-336023",
67
- "@fluidframework/runtime-utils": "2.40.0-336023",
68
- "@fluidframework/sequence": "2.40.0-336023",
69
- "@fluidframework/shared-object-base": "2.40.0-336023",
70
- "@fluidframework/tree": "2.40.0-336023"
60
+ "@fluidframework/container-definitions": "2.41.0-337492",
61
+ "@fluidframework/container-loader": "2.41.0-337492",
62
+ "@fluidframework/core-interfaces": "2.41.0-337492",
63
+ "@fluidframework/core-utils": "2.41.0-337492",
64
+ "@fluidframework/driver-definitions": "2.41.0-337492",
65
+ "@fluidframework/fluid-static": "2.41.0-337492",
66
+ "@fluidframework/map": "2.41.0-337492",
67
+ "@fluidframework/runtime-utils": "2.41.0-337492",
68
+ "@fluidframework/sequence": "2.41.0-337492",
69
+ "@fluidframework/shared-object-base": "2.41.0-337492",
70
+ "@fluidframework/tree": "2.41.0-337492"
71
71
  },
72
72
  "devDependencies": {
73
73
  "@arethetypeswrong/cli": "^0.17.1",