@fluidframework/tree 2.93.0 → 2.101.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 +74 -0
- package/INCREMENTAL_SUMMARY.md +89 -0
- package/README.md +6 -0
- package/api-report/tree.alpha.api.md +6 -1
- package/api-report/tree.beta.api.md +3 -1
- package/api-report/tree.legacy.beta.api.md +3 -1
- package/dist/core/change-family/changeFamily.d.ts +23 -0
- package/dist/core/change-family/changeFamily.d.ts.map +1 -1
- package/dist/core/change-family/changeFamily.js.map +1 -1
- package/dist/core/tree/detachedFieldIndexCodecV1.d.ts.map +1 -1
- package/dist/core/tree/detachedFieldIndexCodecV1.js +2 -0
- package/dist/core/tree/detachedFieldIndexCodecV1.js.map +1 -1
- package/dist/core/tree/detachedFieldIndexCodecV2.d.ts.map +1 -1
- package/dist/core/tree/detachedFieldIndexCodecV2.js +2 -0
- package/dist/core/tree/detachedFieldIndexCodecV2.js.map +1 -1
- package/dist/feature-libraries/chunked-forest/basicChunk.d.ts +25 -1
- package/dist/feature-libraries/chunked-forest/basicChunk.d.ts.map +1 -1
- package/dist/feature-libraries/chunked-forest/basicChunk.js +71 -18
- package/dist/feature-libraries/chunked-forest/basicChunk.js.map +1 -1
- package/dist/feature-libraries/chunked-forest/codec/chunkDecoding.d.ts +13 -4
- package/dist/feature-libraries/chunked-forest/codec/chunkDecoding.d.ts.map +1 -1
- package/dist/feature-libraries/chunked-forest/codec/chunkDecoding.js +31 -4
- package/dist/feature-libraries/chunked-forest/codec/chunkDecoding.js.map +1 -1
- package/dist/feature-libraries/chunked-forest/codec/codecs.d.ts +27 -0
- package/dist/feature-libraries/chunked-forest/codec/codecs.d.ts.map +1 -1
- package/dist/feature-libraries/chunked-forest/codec/codecs.js +5 -2
- package/dist/feature-libraries/chunked-forest/codec/codecs.js.map +1 -1
- package/dist/feature-libraries/chunked-forest/codec/compressedEncode.d.ts +10 -2
- package/dist/feature-libraries/chunked-forest/codec/compressedEncode.d.ts.map +1 -1
- package/dist/feature-libraries/chunked-forest/codec/compressedEncode.js +7 -2
- package/dist/feature-libraries/chunked-forest/codec/compressedEncode.js.map +1 -1
- package/dist/feature-libraries/chunked-forest/codec/format/formatGeneric.d.ts +1 -2
- package/dist/feature-libraries/chunked-forest/codec/format/formatGeneric.d.ts.map +1 -1
- package/dist/feature-libraries/chunked-forest/codec/format/formatGeneric.js +0 -1
- package/dist/feature-libraries/chunked-forest/codec/format/formatGeneric.js.map +1 -1
- package/dist/feature-libraries/chunked-forest/codec/format/index.d.ts +1 -1
- package/dist/feature-libraries/chunked-forest/codec/format/index.d.ts.map +1 -1
- package/dist/feature-libraries/chunked-forest/codec/format/index.js +2 -1
- package/dist/feature-libraries/chunked-forest/codec/format/index.js.map +1 -1
- package/dist/feature-libraries/chunked-forest/codec/format/versions.d.ts +10 -2
- package/dist/feature-libraries/chunked-forest/codec/format/versions.d.ts.map +1 -1
- package/dist/feature-libraries/chunked-forest/codec/format/versions.js +15 -1
- package/dist/feature-libraries/chunked-forest/codec/format/versions.js.map +1 -1
- package/dist/feature-libraries/chunked-forest/codec/nodeEncoder.d.ts.map +1 -1
- package/dist/feature-libraries/chunked-forest/codec/nodeEncoder.js +9 -1
- package/dist/feature-libraries/chunked-forest/codec/nodeEncoder.js.map +1 -1
- package/dist/feature-libraries/chunked-forest/codec/schemaBasedEncode.d.ts +3 -3
- package/dist/feature-libraries/chunked-forest/codec/schemaBasedEncode.d.ts.map +1 -1
- package/dist/feature-libraries/chunked-forest/codec/schemaBasedEncode.js +8 -8
- package/dist/feature-libraries/chunked-forest/codec/schemaBasedEncode.js.map +1 -1
- package/dist/feature-libraries/chunked-forest/uniformChunk.d.ts +6 -1
- package/dist/feature-libraries/chunked-forest/uniformChunk.d.ts.map +1 -1
- package/dist/feature-libraries/chunked-forest/uniformChunk.js +25 -1
- package/dist/feature-libraries/chunked-forest/uniformChunk.js.map +1 -1
- package/dist/feature-libraries/forest-summary/incrementalSummaryBuilder.d.ts +19 -0
- package/dist/feature-libraries/forest-summary/incrementalSummaryBuilder.d.ts.map +1 -1
- package/dist/feature-libraries/forest-summary/incrementalSummaryBuilder.js +76 -22
- package/dist/feature-libraries/forest-summary/incrementalSummaryBuilder.js.map +1 -1
- package/dist/feature-libraries/modular-schema/genericFieldKindFormat.d.ts +2 -14
- package/dist/feature-libraries/modular-schema/genericFieldKindFormat.d.ts.map +1 -1
- package/dist/feature-libraries/modular-schema/genericFieldKindFormat.js +1 -17
- package/dist/feature-libraries/modular-schema/genericFieldKindFormat.js.map +1 -1
- package/dist/feature-libraries/modular-schema/modularChangeCodecV1.d.ts.map +1 -1
- package/dist/feature-libraries/modular-schema/modularChangeCodecV1.js +4 -0
- package/dist/feature-libraries/modular-schema/modularChangeCodecV1.js.map +1 -1
- package/dist/packageVersion.d.ts +1 -1
- package/dist/packageVersion.d.ts.map +1 -1
- package/dist/packageVersion.js +1 -1
- package/dist/packageVersion.js.map +1 -1
- package/dist/shared-tree/independentView.d.ts.map +1 -1
- package/dist/shared-tree/independentView.js +2 -0
- package/dist/shared-tree/independentView.js.map +1 -1
- package/dist/shared-tree/sharedTree.d.ts +35 -1
- package/dist/shared-tree/sharedTree.d.ts.map +1 -1
- package/dist/shared-tree/sharedTree.js +6 -0
- package/dist/shared-tree/sharedTree.js.map +1 -1
- package/dist/shared-tree/sharedTreeChangeCodecs.js +1 -0
- package/dist/shared-tree/sharedTreeChangeCodecs.js.map +1 -1
- package/dist/shared-tree/treeAlpha.d.ts.map +1 -1
- package/dist/shared-tree/treeAlpha.js +2 -0
- package/dist/shared-tree/treeAlpha.js.map +1 -1
- package/dist/shared-tree/treeCheckout.d.ts +1 -1
- package/dist/shared-tree/treeCheckout.d.ts.map +1 -1
- package/dist/shared-tree/treeCheckout.js +2 -0
- package/dist/shared-tree/treeCheckout.js.map +1 -1
- package/dist/shared-tree-core/editManagerCodecs.d.ts +3 -0
- package/dist/shared-tree-core/editManagerCodecs.d.ts.map +1 -1
- package/dist/shared-tree-core/editManagerCodecs.js.map +1 -1
- package/dist/shared-tree-core/editManagerCodecsCommons.d.ts +14 -0
- package/dist/shared-tree-core/editManagerCodecsCommons.d.ts.map +1 -1
- package/dist/shared-tree-core/editManagerCodecsCommons.js +14 -0
- package/dist/shared-tree-core/editManagerCodecsCommons.js.map +1 -1
- package/dist/shared-tree-core/editManagerCodecsV1toV4.d.ts +3 -0
- package/dist/shared-tree-core/editManagerCodecsV1toV4.d.ts.map +1 -1
- package/dist/shared-tree-core/editManagerCodecsV1toV4.js.map +1 -1
- package/dist/shared-tree-core/editManagerCodecsVSharedBranches.d.ts +3 -0
- package/dist/shared-tree-core/editManagerCodecsVSharedBranches.d.ts.map +1 -1
- package/dist/shared-tree-core/editManagerCodecsVSharedBranches.js.map +1 -1
- package/dist/shared-tree-core/editManagerSummarizer.d.ts +9 -1
- package/dist/shared-tree-core/editManagerSummarizer.d.ts.map +1 -1
- package/dist/shared-tree-core/editManagerSummarizer.js +20 -5
- package/dist/shared-tree-core/editManagerSummarizer.js.map +1 -1
- package/dist/shared-tree-core/messageCodecV1ToV4.d.ts.map +1 -1
- package/dist/shared-tree-core/messageCodecV1ToV4.js +4 -0
- package/dist/shared-tree-core/messageCodecV1ToV4.js.map +1 -1
- package/dist/shared-tree-core/messageCodecVSharedBranches.d.ts.map +1 -1
- package/dist/shared-tree-core/messageCodecVSharedBranches.js +4 -0
- package/dist/shared-tree-core/messageCodecVSharedBranches.js.map +1 -1
- package/dist/shared-tree-core/sharedTreeCore.d.ts +4 -0
- package/dist/shared-tree-core/sharedTreeCore.d.ts.map +1 -1
- package/dist/shared-tree-core/sharedTreeCore.js +1 -1
- package/dist/shared-tree-core/sharedTreeCore.js.map +1 -1
- package/dist/simple-tree/api/schemaFactory.d.ts +3 -3
- package/dist/simple-tree/api/schemaFactory.js +3 -3
- package/dist/simple-tree/api/schemaFactory.js.map +1 -1
- package/dist/simple-tree/api/schemaFactoryAlpha.d.ts +17 -1
- package/dist/simple-tree/api/schemaFactoryAlpha.d.ts.map +1 -1
- package/dist/simple-tree/api/schemaFactoryAlpha.js +9 -0
- package/dist/simple-tree/api/schemaFactoryAlpha.js.map +1 -1
- package/dist/tableSchema.d.ts.map +1 -1
- package/dist/tableSchema.js +102 -20
- package/dist/tableSchema.js.map +1 -1
- package/docs/user-facing/isolated-declarations.md +147 -0
- package/lib/core/change-family/changeFamily.d.ts +23 -0
- package/lib/core/change-family/changeFamily.d.ts.map +1 -1
- package/lib/core/change-family/changeFamily.js.map +1 -1
- package/lib/core/tree/detachedFieldIndexCodecV1.d.ts.map +1 -1
- package/lib/core/tree/detachedFieldIndexCodecV1.js +2 -0
- package/lib/core/tree/detachedFieldIndexCodecV1.js.map +1 -1
- package/lib/core/tree/detachedFieldIndexCodecV2.d.ts.map +1 -1
- package/lib/core/tree/detachedFieldIndexCodecV2.js +2 -0
- package/lib/core/tree/detachedFieldIndexCodecV2.js.map +1 -1
- package/lib/feature-libraries/chunked-forest/basicChunk.d.ts +25 -1
- package/lib/feature-libraries/chunked-forest/basicChunk.d.ts.map +1 -1
- package/lib/feature-libraries/chunked-forest/basicChunk.js +72 -19
- package/lib/feature-libraries/chunked-forest/basicChunk.js.map +1 -1
- package/lib/feature-libraries/chunked-forest/codec/chunkDecoding.d.ts +13 -4
- package/lib/feature-libraries/chunked-forest/codec/chunkDecoding.d.ts.map +1 -1
- package/lib/feature-libraries/chunked-forest/codec/chunkDecoding.js +32 -5
- package/lib/feature-libraries/chunked-forest/codec/chunkDecoding.js.map +1 -1
- package/lib/feature-libraries/chunked-forest/codec/codecs.d.ts +27 -0
- package/lib/feature-libraries/chunked-forest/codec/codecs.d.ts.map +1 -1
- package/lib/feature-libraries/chunked-forest/codec/codecs.js +6 -3
- package/lib/feature-libraries/chunked-forest/codec/codecs.js.map +1 -1
- package/lib/feature-libraries/chunked-forest/codec/compressedEncode.d.ts +10 -2
- package/lib/feature-libraries/chunked-forest/codec/compressedEncode.d.ts.map +1 -1
- package/lib/feature-libraries/chunked-forest/codec/compressedEncode.js +8 -3
- package/lib/feature-libraries/chunked-forest/codec/compressedEncode.js.map +1 -1
- package/lib/feature-libraries/chunked-forest/codec/format/formatGeneric.d.ts +1 -2
- package/lib/feature-libraries/chunked-forest/codec/format/formatGeneric.d.ts.map +1 -1
- package/lib/feature-libraries/chunked-forest/codec/format/formatGeneric.js +0 -1
- package/lib/feature-libraries/chunked-forest/codec/format/formatGeneric.js.map +1 -1
- package/lib/feature-libraries/chunked-forest/codec/format/index.d.ts +1 -1
- package/lib/feature-libraries/chunked-forest/codec/format/index.d.ts.map +1 -1
- package/lib/feature-libraries/chunked-forest/codec/format/index.js +1 -1
- package/lib/feature-libraries/chunked-forest/codec/format/index.js.map +1 -1
- package/lib/feature-libraries/chunked-forest/codec/format/versions.d.ts +10 -2
- package/lib/feature-libraries/chunked-forest/codec/format/versions.d.ts.map +1 -1
- package/lib/feature-libraries/chunked-forest/codec/format/versions.js +13 -0
- package/lib/feature-libraries/chunked-forest/codec/format/versions.js.map +1 -1
- package/lib/feature-libraries/chunked-forest/codec/nodeEncoder.d.ts.map +1 -1
- package/lib/feature-libraries/chunked-forest/codec/nodeEncoder.js +9 -1
- package/lib/feature-libraries/chunked-forest/codec/nodeEncoder.js.map +1 -1
- package/lib/feature-libraries/chunked-forest/codec/schemaBasedEncode.d.ts +3 -3
- package/lib/feature-libraries/chunked-forest/codec/schemaBasedEncode.d.ts.map +1 -1
- package/lib/feature-libraries/chunked-forest/codec/schemaBasedEncode.js +8 -8
- package/lib/feature-libraries/chunked-forest/codec/schemaBasedEncode.js.map +1 -1
- package/lib/feature-libraries/chunked-forest/uniformChunk.d.ts +6 -1
- package/lib/feature-libraries/chunked-forest/uniformChunk.d.ts.map +1 -1
- package/lib/feature-libraries/chunked-forest/uniformChunk.js +26 -2
- package/lib/feature-libraries/chunked-forest/uniformChunk.js.map +1 -1
- package/lib/feature-libraries/forest-summary/incrementalSummaryBuilder.d.ts +19 -0
- package/lib/feature-libraries/forest-summary/incrementalSummaryBuilder.d.ts.map +1 -1
- package/lib/feature-libraries/forest-summary/incrementalSummaryBuilder.js +76 -22
- package/lib/feature-libraries/forest-summary/incrementalSummaryBuilder.js.map +1 -1
- package/lib/feature-libraries/modular-schema/genericFieldKindFormat.d.ts +2 -14
- package/lib/feature-libraries/modular-schema/genericFieldKindFormat.d.ts.map +1 -1
- package/lib/feature-libraries/modular-schema/genericFieldKindFormat.js +1 -17
- package/lib/feature-libraries/modular-schema/genericFieldKindFormat.js.map +1 -1
- package/lib/feature-libraries/modular-schema/modularChangeCodecV1.d.ts.map +1 -1
- package/lib/feature-libraries/modular-schema/modularChangeCodecV1.js +4 -0
- package/lib/feature-libraries/modular-schema/modularChangeCodecV1.js.map +1 -1
- package/lib/packageVersion.d.ts +1 -1
- package/lib/packageVersion.d.ts.map +1 -1
- package/lib/packageVersion.js +1 -1
- package/lib/packageVersion.js.map +1 -1
- package/lib/shared-tree/independentView.d.ts.map +1 -1
- package/lib/shared-tree/independentView.js +2 -0
- package/lib/shared-tree/independentView.js.map +1 -1
- package/lib/shared-tree/sharedTree.d.ts +35 -1
- package/lib/shared-tree/sharedTree.d.ts.map +1 -1
- package/lib/shared-tree/sharedTree.js +6 -0
- package/lib/shared-tree/sharedTree.js.map +1 -1
- package/lib/shared-tree/sharedTreeChangeCodecs.js +1 -0
- package/lib/shared-tree/sharedTreeChangeCodecs.js.map +1 -1
- package/lib/shared-tree/treeAlpha.d.ts.map +1 -1
- package/lib/shared-tree/treeAlpha.js +2 -0
- package/lib/shared-tree/treeAlpha.js.map +1 -1
- package/lib/shared-tree/treeCheckout.d.ts +1 -1
- package/lib/shared-tree/treeCheckout.d.ts.map +1 -1
- package/lib/shared-tree/treeCheckout.js +2 -0
- package/lib/shared-tree/treeCheckout.js.map +1 -1
- package/lib/shared-tree-core/editManagerCodecs.d.ts +3 -0
- package/lib/shared-tree-core/editManagerCodecs.d.ts.map +1 -1
- package/lib/shared-tree-core/editManagerCodecs.js.map +1 -1
- package/lib/shared-tree-core/editManagerCodecsCommons.d.ts +14 -0
- package/lib/shared-tree-core/editManagerCodecsCommons.d.ts.map +1 -1
- package/lib/shared-tree-core/editManagerCodecsCommons.js +14 -0
- package/lib/shared-tree-core/editManagerCodecsCommons.js.map +1 -1
- package/lib/shared-tree-core/editManagerCodecsV1toV4.d.ts +3 -0
- package/lib/shared-tree-core/editManagerCodecsV1toV4.d.ts.map +1 -1
- package/lib/shared-tree-core/editManagerCodecsV1toV4.js.map +1 -1
- package/lib/shared-tree-core/editManagerCodecsVSharedBranches.d.ts +3 -0
- package/lib/shared-tree-core/editManagerCodecsVSharedBranches.d.ts.map +1 -1
- package/lib/shared-tree-core/editManagerCodecsVSharedBranches.js.map +1 -1
- package/lib/shared-tree-core/editManagerSummarizer.d.ts +9 -1
- package/lib/shared-tree-core/editManagerSummarizer.d.ts.map +1 -1
- package/lib/shared-tree-core/editManagerSummarizer.js +20 -5
- package/lib/shared-tree-core/editManagerSummarizer.js.map +1 -1
- package/lib/shared-tree-core/messageCodecV1ToV4.d.ts.map +1 -1
- package/lib/shared-tree-core/messageCodecV1ToV4.js +4 -0
- package/lib/shared-tree-core/messageCodecV1ToV4.js.map +1 -1
- package/lib/shared-tree-core/messageCodecVSharedBranches.d.ts.map +1 -1
- package/lib/shared-tree-core/messageCodecVSharedBranches.js +4 -0
- package/lib/shared-tree-core/messageCodecVSharedBranches.js.map +1 -1
- package/lib/shared-tree-core/sharedTreeCore.d.ts +4 -0
- package/lib/shared-tree-core/sharedTreeCore.d.ts.map +1 -1
- package/lib/shared-tree-core/sharedTreeCore.js +1 -1
- package/lib/shared-tree-core/sharedTreeCore.js.map +1 -1
- package/lib/simple-tree/api/schemaFactory.d.ts +3 -3
- package/lib/simple-tree/api/schemaFactory.js +3 -3
- package/lib/simple-tree/api/schemaFactory.js.map +1 -1
- package/lib/simple-tree/api/schemaFactoryAlpha.d.ts +17 -1
- package/lib/simple-tree/api/schemaFactoryAlpha.d.ts.map +1 -1
- package/lib/simple-tree/api/schemaFactoryAlpha.js +9 -0
- package/lib/simple-tree/api/schemaFactoryAlpha.js.map +1 -1
- package/lib/tableSchema.d.ts.map +1 -1
- package/lib/tableSchema.js +103 -21
- package/lib/tableSchema.js.map +1 -1
- package/package.json +24 -24
- package/src/core/change-family/changeFamily.ts +25 -0
- package/src/core/tree/detachedFieldIndexCodecV1.ts +2 -0
- package/src/core/tree/detachedFieldIndexCodecV2.ts +2 -0
- package/src/feature-libraries/chunked-forest/basicChunk.ts +76 -20
- package/src/feature-libraries/chunked-forest/codec/chunkDecoding.ts +61 -12
- package/src/feature-libraries/chunked-forest/codec/codecs.ts +34 -1
- package/src/feature-libraries/chunked-forest/codec/compressedEncode.ts +9 -3
- package/src/feature-libraries/chunked-forest/codec/format/formatGeneric.ts +0 -1
- package/src/feature-libraries/chunked-forest/codec/format/index.ts +1 -0
- package/src/feature-libraries/chunked-forest/codec/format/versions.ts +15 -0
- package/src/feature-libraries/chunked-forest/codec/nodeEncoder.ts +9 -1
- package/src/feature-libraries/chunked-forest/codec/schemaBasedEncode.ts +9 -1
- package/src/feature-libraries/chunked-forest/uniformChunk.ts +32 -2
- package/src/feature-libraries/forest-summary/incrementalSummaryBuilder.ts +116 -31
- package/src/feature-libraries/modular-schema/genericFieldKindFormat.ts +3 -21
- package/src/feature-libraries/modular-schema/modularChangeCodecV1.ts +4 -0
- package/src/packageVersion.ts +1 -1
- package/src/shared-tree/independentView.ts +2 -0
- package/src/shared-tree/sharedTree.ts +41 -1
- package/src/shared-tree/sharedTreeChangeCodecs.ts +1 -0
- package/src/shared-tree/treeAlpha.ts +2 -0
- package/src/shared-tree/treeCheckout.ts +2 -0
- package/src/shared-tree-core/editManagerCodecs.ts +3 -0
- package/src/shared-tree-core/editManagerCodecsCommons.ts +29 -0
- package/src/shared-tree-core/editManagerCodecsV1toV4.ts +3 -0
- package/src/shared-tree-core/editManagerCodecsVSharedBranches.ts +3 -0
- package/src/shared-tree-core/editManagerSummarizer.ts +17 -5
- package/src/shared-tree-core/messageCodecV1ToV4.ts +4 -0
- package/src/shared-tree-core/messageCodecVSharedBranches.ts +5 -1
- package/src/shared-tree-core/sharedTreeCore.ts +8 -1
- package/src/simple-tree/api/schemaFactory.ts +3 -3
- package/src/simple-tree/api/schemaFactoryAlpha.ts +34 -3
- package/src/tableSchema.ts +134 -35
|
@@ -47,6 +47,7 @@ export function makeSharedBranchesCodecWithVersion<TChangeset>(
|
|
|
47
47
|
schema: context.schema,
|
|
48
48
|
idCompressor: context.idCompressor,
|
|
49
49
|
revision: message.commit.revision,
|
|
50
|
+
isSummary: false,
|
|
50
51
|
};
|
|
51
52
|
|
|
52
53
|
return {
|
|
@@ -54,6 +55,7 @@ export function makeSharedBranchesCodecWithVersion<TChangeset>(
|
|
|
54
55
|
originatorId: message.sessionId,
|
|
55
56
|
idCompressor: context.idCompressor,
|
|
56
57
|
revision: undefined,
|
|
58
|
+
isSummary: false,
|
|
57
59
|
}),
|
|
58
60
|
originatorId: message.sessionId,
|
|
59
61
|
changeset: changeCodec.encode(message.commit.change, changeContext),
|
|
@@ -84,10 +86,11 @@ export function makeSharedBranchesCodecWithVersion<TChangeset>(
|
|
|
84
86
|
branchId: encodedBranchId,
|
|
85
87
|
} = encoded;
|
|
86
88
|
|
|
87
|
-
const changeContext = {
|
|
89
|
+
const changeContext: ChangeEncodingContext = {
|
|
88
90
|
originatorId,
|
|
89
91
|
revision: undefined,
|
|
90
92
|
idCompressor: context.idCompressor,
|
|
93
|
+
isSummary: false,
|
|
91
94
|
};
|
|
92
95
|
|
|
93
96
|
const branchId = decodeBranchId(context.idCompressor, encodedBranchId, changeContext);
|
|
@@ -107,6 +110,7 @@ export function makeSharedBranchesCodecWithVersion<TChangeset>(
|
|
|
107
110
|
originatorId,
|
|
108
111
|
revision,
|
|
109
112
|
idCompressor: context.idCompressor,
|
|
113
|
+
isSummary: false,
|
|
110
114
|
}),
|
|
111
115
|
},
|
|
112
116
|
branchId,
|
|
@@ -73,7 +73,12 @@ export interface ClonableSchemaAndPolicy extends SchemaAndPolicy {
|
|
|
73
73
|
schema: TreeStoredSchemaRepository;
|
|
74
74
|
}
|
|
75
75
|
|
|
76
|
-
export interface SharedTreeCoreOptionsInternal extends CodecWriteOptions {
|
|
76
|
+
export interface SharedTreeCoreOptionsInternal extends CodecWriteOptions {
|
|
77
|
+
/**
|
|
78
|
+
* See {@link SharedTreeOptionsBeta.healUnresolvableIdentifiersOnDecode}.
|
|
79
|
+
*/
|
|
80
|
+
readonly healUnresolvableIdentifiersOnDecode?: boolean;
|
|
81
|
+
}
|
|
77
82
|
|
|
78
83
|
export interface EnrichmentConfig<TChange> {
|
|
79
84
|
readonly enricher: ChangeEnricher<TChange>;
|
|
@@ -192,6 +197,8 @@ export class SharedTreeCore<TEditor extends ChangeFamilyEditor, TChange>
|
|
|
192
197
|
this.idCompressor,
|
|
193
198
|
options.minVersionForCollab,
|
|
194
199
|
this.schemaAndPolicy,
|
|
200
|
+
options.healUnresolvableIdentifiersOnDecode,
|
|
201
|
+
sharedObject.id,
|
|
195
202
|
),
|
|
196
203
|
...summarizables,
|
|
197
204
|
];
|
|
@@ -261,7 +261,7 @@ export const SchemaFactory_base = classWithStatics(schemaStaticsPublic);
|
|
|
261
261
|
*
|
|
262
262
|
* 1. Declaration: `class X extends schemaFactory.object("x", {}) {}`
|
|
263
263
|
*
|
|
264
|
-
* 2. Allows adding "local" (non-persisted) members:
|
|
264
|
+
* 2. Allows adding "local" (non-persisted) members: additional members (including methods) can be added to the class.
|
|
265
265
|
*
|
|
266
266
|
* 3. Prototype: The user-defined class.
|
|
267
267
|
*
|
|
@@ -281,7 +281,7 @@ export const SchemaFactory_base = classWithStatics(schemaStaticsPublic);
|
|
|
281
281
|
*
|
|
282
282
|
* 1. Declaration: `const X = schemaFactory.object("x", {}); type X = NodeFromSchema<typeof X>;`
|
|
283
283
|
*
|
|
284
|
-
* 2.
|
|
284
|
+
* 2. Does not allow adding "local" (non-persisted) members: attempting to set non-field members will result in an error.
|
|
285
285
|
*
|
|
286
286
|
* 3. Prototype: `Object.prototype`, `Map.prototype`, or `Array.prototype` depending on node kind.
|
|
287
287
|
*
|
|
@@ -320,7 +320,7 @@ export const SchemaFactory_base = classWithStatics(schemaStaticsPublic);
|
|
|
320
320
|
* Note: the comparison between the customizable and POJO modes is not done in a table because TSDoc does not currently have support for embedded markdown.
|
|
321
321
|
*
|
|
322
322
|
* @see {@link SchemaFactoryAlpha}
|
|
323
|
-
*
|
|
323
|
+
* @see {@link SchemaFactoryBeta}
|
|
324
324
|
* @sealed @public
|
|
325
325
|
*/
|
|
326
326
|
export class SchemaFactory<
|
|
@@ -153,7 +153,7 @@ export interface SchemaStaticsAlpha {
|
|
|
153
153
|
* The migration path is:
|
|
154
154
|
*
|
|
155
155
|
* 1. Start with `sf.required(T)` — all clients require the field.
|
|
156
|
-
* 2. Deploy `sf.stagedOptional(T)` — new clients can read documents where the field is present or absent, but the stored schema stays Required (so old clients are unaffected).
|
|
156
|
+
* 2. Deploy `sf.stagedOptional(T)` — new clients can read documents where the field is present or absent, but the stored schema stays Required (so old clients are unaffected). Setting the field to `undefined` is rejected because the stored schema still declares the field as required.
|
|
157
157
|
* 3. Deploy `sf.optional(T)` once all clients support the staged optional field — the stored schema becomes Optional and the field can be cleared.
|
|
158
158
|
*
|
|
159
159
|
* Analogous to {@link SchemaStaticsBeta.staged} for allowed types, but for field optionality.
|
|
@@ -179,6 +179,28 @@ export interface SchemaStaticsAlpha {
|
|
|
179
179
|
TCustomMetadata,
|
|
180
180
|
FieldPropsAlpha<TCustomMetadata>
|
|
181
181
|
>;
|
|
182
|
+
/**
|
|
183
|
+
* {@link SchemaStaticsAlpha.stagedOptional} except tweaked to work better for recursive types.
|
|
184
|
+
* Use with {@link ValidateRecursiveSchema} for improved type safety.
|
|
185
|
+
* @remarks
|
|
186
|
+
* This version of {@link SchemaStaticsAlpha.stagedOptional} has fewer type constraints to work around TypeScript limitations, see {@link Unenforced}.
|
|
187
|
+
* See {@link ValidateRecursiveSchema} for additional information about using recursive schema.
|
|
188
|
+
*/
|
|
189
|
+
readonly stagedOptionalRecursive: <
|
|
190
|
+
const T extends System_Unsafe.ImplicitAllowedTypesUnsafe,
|
|
191
|
+
const TCustomMetadata = unknown,
|
|
192
|
+
>(
|
|
193
|
+
t: T,
|
|
194
|
+
props?: Omit<
|
|
195
|
+
FieldPropsAlpha<TCustomMetadata>,
|
|
196
|
+
"defaultProvider" | "stagedOptionalUpgrade"
|
|
197
|
+
>,
|
|
198
|
+
) => FieldSchemaAlphaUnsafe<
|
|
199
|
+
FieldKind.Optional,
|
|
200
|
+
T,
|
|
201
|
+
TCustomMetadata,
|
|
202
|
+
FieldPropsAlpha<TCustomMetadata>
|
|
203
|
+
>;
|
|
182
204
|
|
|
183
205
|
/**
|
|
184
206
|
* {@link SchemaStaticsAlpha.withDefault} except tweaked to work better for recursive types.
|
|
@@ -280,10 +302,9 @@ const stagedOptional = <const T extends ImplicitAllowedTypes, const TCustomMetad
|
|
|
280
302
|
|
|
281
303
|
const schemaStaticsAlpha: SchemaStaticsAlpha = {
|
|
282
304
|
withDefault,
|
|
283
|
-
|
|
284
305
|
withDefaultRecursive: withDefault as SchemaStaticsAlpha["withDefaultRecursive"],
|
|
285
|
-
|
|
286
306
|
stagedOptional,
|
|
307
|
+
stagedOptionalRecursive: stagedOptional as SchemaStaticsAlpha["stagedOptionalRecursive"],
|
|
287
308
|
};
|
|
288
309
|
|
|
289
310
|
/**
|
|
@@ -512,6 +533,16 @@ export class SchemaFactoryAlpha<
|
|
|
512
533
|
*/
|
|
513
534
|
public static readonly stagedOptional = schemaStaticsAlpha.stagedOptional;
|
|
514
535
|
|
|
536
|
+
/**
|
|
537
|
+
* {@inheritdoc SchemaStaticsAlpha.stagedOptionalRecursive}
|
|
538
|
+
*/
|
|
539
|
+
public readonly stagedOptionalRecursive = schemaStaticsAlpha.stagedOptionalRecursive;
|
|
540
|
+
|
|
541
|
+
/**
|
|
542
|
+
* {@inheritdoc SchemaStaticsAlpha.stagedOptionalRecursive}
|
|
543
|
+
*/
|
|
544
|
+
public static readonly stagedOptionalRecursive = schemaStaticsAlpha.stagedOptionalRecursive;
|
|
545
|
+
|
|
515
546
|
/**
|
|
516
547
|
* Define a {@link TreeNodeSchema} for a {@link TreeMapNodeAlpha}.
|
|
517
548
|
*
|
package/src/tableSchema.ts
CHANGED
|
@@ -7,7 +7,7 @@ import { fail } from "@fluidframework/core-utils/internal";
|
|
|
7
7
|
import { UsageError } from "@fluidframework/telemetry-utils/internal";
|
|
8
8
|
|
|
9
9
|
import { EmptyKey } from "./core/index.js";
|
|
10
|
-
import { TreeAlpha } from "./shared-tree/index.js";
|
|
10
|
+
import { Tree, TreeAlpha } from "./shared-tree/index.js";
|
|
11
11
|
import {
|
|
12
12
|
type FieldHasDefault,
|
|
13
13
|
type ImplicitAllowedTypes,
|
|
@@ -951,6 +951,58 @@ export namespace System_TableSchema {
|
|
|
951
951
|
return cell;
|
|
952
952
|
}
|
|
953
953
|
|
|
954
|
+
// #region ID lookup caches
|
|
955
|
+
|
|
956
|
+
// Looking up rows/columns by string ID is a hot path (every getCell / setCell / etc. call goes
|
|
957
|
+
// through #tryGetRow or #tryGetColumn). Rather than scanning the arrays linearly on every call,
|
|
958
|
+
// we maintain lazily-built Maps from ID → node.
|
|
959
|
+
//
|
|
960
|
+
// Cache invalidation:
|
|
961
|
+
// Each cache is marked stale (reset to `undefined`) by a `nodeChanged` listener registered on
|
|
962
|
+
// the corresponding array node (this.table.rows / this.table.columns). `nodeChanged` fires on
|
|
963
|
+
// an array node whenever an element is inserted, removed, or moved — exactly the set of
|
|
964
|
+
// operations that could change which ID maps to which node. The event fires after the full
|
|
965
|
+
// batch of edits has been applied (including remote edits received from collaborators), so the
|
|
966
|
+
// cache is always rebuilt from a consistent, in-schema state.
|
|
967
|
+
// TODO: Consider if we should do more fine-grained invalidation here. E.g. look at the specific deltas
|
|
968
|
+
// returned by the `nodeChanged` event and only invalidate entries as needed.
|
|
969
|
+
//
|
|
970
|
+
// Listener lifetime:
|
|
971
|
+
// The listener is registered exactly once per cache (guarded by the non-undefined check on the
|
|
972
|
+
// stored unsubscribe callback). Subsequent cache rebuilds after invalidation reuse the same
|
|
973
|
+
// listener — no additional subscriptions accumulate. The unsubscribe callback is stored so
|
|
974
|
+
// that explicit cleanup is possible in the future if needed.
|
|
975
|
+
|
|
976
|
+
/**
|
|
977
|
+
* Cache from row ID → row node for O(1) lookups in {@link Table.#tryGetRow}.
|
|
978
|
+
* `undefined` means the cache is stale and must be rebuilt before use.
|
|
979
|
+
*/
|
|
980
|
+
#rowCache: Map<string, RowValueType> | undefined = undefined;
|
|
981
|
+
|
|
982
|
+
/**
|
|
983
|
+
* Unsubscribe function for the `nodeChanged` listener on `this.table.rows`.
|
|
984
|
+
* `undefined` means the listener has not yet been registered (first cache build is pending).
|
|
985
|
+
* After the first build, this is always defined and the listener remains active for the
|
|
986
|
+
* lifetime of the Table node.
|
|
987
|
+
*/
|
|
988
|
+
#rowCacheUnsubscribe: (() => void) | undefined = undefined;
|
|
989
|
+
|
|
990
|
+
/**
|
|
991
|
+
* Cache from column ID → column node for O(1) lookups in {@link Table.#tryGetColumn}.
|
|
992
|
+
* `undefined` means the cache is stale and must be rebuilt before use.
|
|
993
|
+
*/
|
|
994
|
+
#columnCache: Map<string, ColumnValueType> | undefined = undefined;
|
|
995
|
+
|
|
996
|
+
/**
|
|
997
|
+
* Unsubscribe function for the `nodeChanged` listener on `this.table.columns`.
|
|
998
|
+
* `undefined` means the listener has not yet been registered (first cache build is pending).
|
|
999
|
+
* After the first build, this is always defined and the listener remains active for the
|
|
1000
|
+
* lifetime of the Table node.
|
|
1001
|
+
*/
|
|
1002
|
+
#columnCacheUnsubscribe: (() => void) | undefined = undefined;
|
|
1003
|
+
|
|
1004
|
+
// #endregion
|
|
1005
|
+
|
|
954
1006
|
/**
|
|
955
1007
|
* Applies the provided edits in a "batch".
|
|
956
1008
|
*
|
|
@@ -994,6 +1046,40 @@ export namespace System_TableSchema {
|
|
|
994
1046
|
});
|
|
995
1047
|
}
|
|
996
1048
|
|
|
1049
|
+
/**
|
|
1050
|
+
* Returns the column ID → column node cache, building and caching it first if stale.
|
|
1051
|
+
*
|
|
1052
|
+
* @remarks
|
|
1053
|
+
* The first time this is called, it builds the map from the current contents of
|
|
1054
|
+
* `this.table.columns` and registers a `nodeChanged` listener on that array.
|
|
1055
|
+
* The listener invalidates the cache (sets `#columnCache` to `undefined`) whenever
|
|
1056
|
+
* the column array is structurally modified (insert / remove / move), so every
|
|
1057
|
+
* subsequent call that follows a structural change automatically triggers a rebuild.
|
|
1058
|
+
* The listener is registered only once — it is not re-registered on cache rebuilds.
|
|
1059
|
+
*/
|
|
1060
|
+
#getColumnCache(): Map<string, ColumnValueType> {
|
|
1061
|
+
let cache = this.#columnCache;
|
|
1062
|
+
if (cache === undefined) {
|
|
1063
|
+
cache = new Map<string, ColumnValueType>();
|
|
1064
|
+
for (const column of this.table.columns) {
|
|
1065
|
+
// TypeScript is unable to narrow array element types correctly here.
|
|
1066
|
+
// See: https://github.com/microsoft/TypeScript/issues/52144
|
|
1067
|
+
cache.set((column as ColumnValueType).id, column as ColumnValueType);
|
|
1068
|
+
}
|
|
1069
|
+
this.#columnCache = cache;
|
|
1070
|
+
|
|
1071
|
+
// Register the invalidation listener once. The `nodeChanged` event fires on the
|
|
1072
|
+
// array node itself after any structural change (insert / remove / move), which is
|
|
1073
|
+
// exactly the set of changes that can alter the ID → node mapping.
|
|
1074
|
+
if (this.#columnCacheUnsubscribe === undefined) {
|
|
1075
|
+
this.#columnCacheUnsubscribe = Tree.on(this.columns, "nodeChanged", () => {
|
|
1076
|
+
this.#columnCache = undefined;
|
|
1077
|
+
});
|
|
1078
|
+
}
|
|
1079
|
+
}
|
|
1080
|
+
return cache;
|
|
1081
|
+
}
|
|
1082
|
+
|
|
997
1083
|
/**
|
|
998
1084
|
* Attempts to resolve the provided Column node or ID to a Column node in the table.
|
|
999
1085
|
* Returns `undefined` if there is no match.
|
|
@@ -1011,21 +1097,14 @@ export namespace System_TableSchema {
|
|
|
1011
1097
|
return this.table.columns[columnOrIdOrIndex] as ColumnValueType;
|
|
1012
1098
|
}
|
|
1013
1099
|
|
|
1100
|
+
const columnCache = this.#getColumnCache();
|
|
1014
1101
|
if (typeof columnOrIdOrIndex === "string") {
|
|
1015
|
-
|
|
1016
|
-
// TypeScript is unable to narrow the types correctly here, hence the casts.
|
|
1017
|
-
// See: https://github.com/microsoft/TypeScript/issues/52144
|
|
1018
|
-
return this.table.columns.find((col) => (col as ColumnValueType).id === columnId) as
|
|
1019
|
-
| ColumnValueType
|
|
1020
|
-
| undefined;
|
|
1102
|
+
return columnCache.get(columnOrIdOrIndex);
|
|
1021
1103
|
}
|
|
1022
1104
|
|
|
1023
1105
|
// If the user provided a node, ensure it actually exists in this table.
|
|
1024
|
-
|
|
1025
|
-
|
|
1026
|
-
}
|
|
1027
|
-
|
|
1028
|
-
return columnOrIdOrIndex;
|
|
1106
|
+
const cached = columnCache.get(columnOrIdOrIndex.id);
|
|
1107
|
+
return cached === columnOrIdOrIndex ? columnOrIdOrIndex : undefined;
|
|
1029
1108
|
}
|
|
1030
1109
|
|
|
1031
1110
|
/**
|
|
@@ -1062,6 +1141,40 @@ export namespace System_TableSchema {
|
|
|
1062
1141
|
);
|
|
1063
1142
|
}
|
|
1064
1143
|
|
|
1144
|
+
/**
|
|
1145
|
+
* Returns the row ID → row node cache, building and caching it first if stale.
|
|
1146
|
+
*
|
|
1147
|
+
* @remarks
|
|
1148
|
+
* The first time this is called, it builds the map from the current contents of
|
|
1149
|
+
* `this.table.rows` and registers a `nodeChanged` listener on that array.
|
|
1150
|
+
* The listener invalidates the cache (sets `#rowCache` to `undefined`) whenever
|
|
1151
|
+
* the row array is structurally modified (insert / remove / move), so every
|
|
1152
|
+
* subsequent call that follows a structural change automatically triggers a rebuild.
|
|
1153
|
+
* The listener is registered only once — it is not re-registered on cache rebuilds.
|
|
1154
|
+
*/
|
|
1155
|
+
#getRowCache(): Map<string, RowValueType> {
|
|
1156
|
+
let cache = this.#rowCache;
|
|
1157
|
+
if (cache === undefined) {
|
|
1158
|
+
cache = new Map<string, RowValueType>();
|
|
1159
|
+
for (const row of this.table.rows) {
|
|
1160
|
+
// TypeScript is unable to narrow array element types correctly here.
|
|
1161
|
+
// See: https://github.com/microsoft/TypeScript/issues/52144
|
|
1162
|
+
cache.set((row as RowValueType).id, row as RowValueType);
|
|
1163
|
+
}
|
|
1164
|
+
this.#rowCache = cache;
|
|
1165
|
+
|
|
1166
|
+
// Register the invalidation listener once. The `nodeChanged` event fires on the
|
|
1167
|
+
// array node itself after any structural change (insert / remove / move), which is
|
|
1168
|
+
// exactly the set of changes that can alter the ID → node mapping.
|
|
1169
|
+
if (this.#rowCacheUnsubscribe === undefined) {
|
|
1170
|
+
this.#rowCacheUnsubscribe = Tree.on(this.rows, "nodeChanged", () => {
|
|
1171
|
+
this.#rowCache = undefined;
|
|
1172
|
+
});
|
|
1173
|
+
}
|
|
1174
|
+
}
|
|
1175
|
+
return cache;
|
|
1176
|
+
}
|
|
1177
|
+
|
|
1065
1178
|
/**
|
|
1066
1179
|
* Attempts to resolve the provided Row node or ID to a Row node in the table.
|
|
1067
1180
|
* Returns `undefined` if there is no match.
|
|
@@ -1077,21 +1190,14 @@ export namespace System_TableSchema {
|
|
|
1077
1190
|
return this.table.rows[rowOrIdOrIndex] as RowValueType;
|
|
1078
1191
|
}
|
|
1079
1192
|
|
|
1193
|
+
const rowCache = this.#getRowCache();
|
|
1080
1194
|
if (typeof rowOrIdOrIndex === "string") {
|
|
1081
|
-
|
|
1082
|
-
// TypeScript is unable to narrow the types correctly here, hence the casts.
|
|
1083
|
-
// See: https://github.com/microsoft/TypeScript/issues/52144
|
|
1084
|
-
return this.table.rows.find((row) => (row as RowValueType).id === rowId) as
|
|
1085
|
-
| RowValueType
|
|
1086
|
-
| undefined;
|
|
1195
|
+
return rowCache.get(rowOrIdOrIndex);
|
|
1087
1196
|
}
|
|
1088
1197
|
|
|
1089
1198
|
// If the user provided a node, ensure it actually exists in this table.
|
|
1090
|
-
|
|
1091
|
-
|
|
1092
|
-
}
|
|
1093
|
-
|
|
1094
|
-
return rowOrIdOrIndex;
|
|
1199
|
+
const cached = rowCache.get(rowOrIdOrIndex.id);
|
|
1200
|
+
return cached === rowOrIdOrIndex ? rowOrIdOrIndex : undefined;
|
|
1095
1201
|
}
|
|
1096
1202
|
|
|
1097
1203
|
/**
|
|
@@ -1113,10 +1219,7 @@ export namespace System_TableSchema {
|
|
|
1113
1219
|
* - A column with a duplicate ID is being inserted.
|
|
1114
1220
|
*/
|
|
1115
1221
|
#validateNewColumns(newColumns: readonly ColumnInsertableType[]): void {
|
|
1116
|
-
return Table._validateNewColumns(
|
|
1117
|
-
newColumns,
|
|
1118
|
-
new Set(this.table.columns.map((column) => (column as ColumnValueType).id)),
|
|
1119
|
-
);
|
|
1222
|
+
return Table._validateNewColumns(newColumns, this.#getColumnCache());
|
|
1120
1223
|
}
|
|
1121
1224
|
|
|
1122
1225
|
/**
|
|
@@ -1126,11 +1229,7 @@ export namespace System_TableSchema {
|
|
|
1126
1229
|
* - A row is being inserted that contains cells for columns that do not exist in the table.
|
|
1127
1230
|
*/
|
|
1128
1231
|
#validateNewRows(newRows: readonly RowInsertableType[]): void {
|
|
1129
|
-
return Table._validateNewRows(
|
|
1130
|
-
newRows,
|
|
1131
|
-
new Set(this.table.rows.map((row) => (row as RowValueType).id)),
|
|
1132
|
-
new Set(this.table.columns.map((column) => (column as ColumnValueType).id)),
|
|
1133
|
-
);
|
|
1232
|
+
return Table._validateNewRows(newRows, this.#getRowCache(), this.#getColumnCache());
|
|
1134
1233
|
}
|
|
1135
1234
|
|
|
1136
1235
|
/**
|
|
@@ -1140,7 +1239,7 @@ export namespace System_TableSchema {
|
|
|
1140
1239
|
*/
|
|
1141
1240
|
private static _validateNewColumns(
|
|
1142
1241
|
newColumns: Iterable<ColumnInsertableType>,
|
|
1143
|
-
existingColumnIds:
|
|
1242
|
+
existingColumnIds: { readonly has: (id: string) => boolean },
|
|
1144
1243
|
): void {
|
|
1145
1244
|
const newColumnIds = new Set<string>();
|
|
1146
1245
|
for (const newColumn of newColumns) {
|
|
@@ -1168,8 +1267,8 @@ export namespace System_TableSchema {
|
|
|
1168
1267
|
*/
|
|
1169
1268
|
private static _validateNewRows(
|
|
1170
1269
|
newRows: Iterable<RowInsertableType>,
|
|
1171
|
-
existingRowIds:
|
|
1172
|
-
columnIds:
|
|
1270
|
+
existingRowIds: { readonly has: (id: string) => boolean },
|
|
1271
|
+
columnIds: { readonly has: (id: string) => boolean },
|
|
1173
1272
|
): void {
|
|
1174
1273
|
const newRowIds = new Set<string>();
|
|
1175
1274
|
for (const newRow of newRows) {
|