@fluidframework/tree 2.74.0-365691 → 2.74.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/.vscode/settings.json +4 -2
- package/CHANGELOG.md +11 -0
- package/api-report/tree.alpha.api.md +125 -87
- package/api-report/tree.beta.api.md +0 -1
- package/api-report/tree.legacy.beta.api.md +0 -1
- package/api-report/tree.legacy.public.api.md +0 -1
- package/api-report/tree.public.api.md +0 -1
- package/assertTagging.config.mjs +1 -1
- package/dist/alpha.d.ts +6 -2
- package/dist/codec/codec.d.ts +41 -13
- package/dist/codec/codec.d.ts.map +1 -1
- package/dist/codec/codec.js +46 -19
- package/dist/codec/codec.js.map +1 -1
- package/dist/codec/versioned/codec.d.ts +1 -1
- package/dist/codec/versioned/codec.d.ts.map +1 -1
- package/dist/codec/versioned/codec.js.map +1 -1
- package/dist/codec/versioned/format.d.ts +4 -1
- package/dist/codec/versioned/format.d.ts.map +1 -1
- package/dist/codec/versioned/format.js +4 -1
- package/dist/codec/versioned/format.js.map +1 -1
- package/dist/core/index.d.ts +2 -2
- package/dist/core/index.d.ts.map +1 -1
- package/dist/core/index.js +4 -3
- package/dist/core/index.js.map +1 -1
- package/dist/core/rebase/index.d.ts +1 -1
- package/dist/core/rebase/index.d.ts.map +1 -1
- package/dist/core/rebase/index.js.map +1 -1
- package/dist/core/rebase/types.d.ts +20 -1
- package/dist/core/rebase/types.d.ts.map +1 -1
- package/dist/core/rebase/types.js.map +1 -1
- package/dist/core/schema-stored/schema.d.ts +4 -7
- package/dist/core/schema-stored/schema.d.ts.map +1 -1
- package/dist/core/schema-stored/schema.js +2 -2
- package/dist/core/schema-stored/schema.js.map +1 -1
- package/dist/core/tree/detachedFieldIndex.d.ts +34 -13
- package/dist/core/tree/detachedFieldIndex.d.ts.map +1 -1
- package/dist/core/tree/detachedFieldIndex.js +12 -12
- package/dist/core/tree/detachedFieldIndex.js.map +1 -1
- package/dist/core/tree/detachedFieldIndexFormatCommon.d.ts +4 -4
- package/dist/core/tree/detachedFieldIndexFormatCommon.d.ts.map +1 -1
- package/dist/core/tree/detachedFieldIndexFormatCommon.js +2 -2
- package/dist/core/tree/detachedFieldIndexFormatCommon.js.map +1 -1
- package/dist/core/tree/index.d.ts +3 -2
- package/dist/core/tree/index.d.ts.map +1 -1
- package/dist/core/tree/index.js +3 -0
- package/dist/core/tree/index.js.map +1 -1
- package/dist/feature-libraries/chunked-forest/codec/codecs.d.ts.map +1 -1
- package/dist/feature-libraries/chunked-forest/codec/codecs.js +2 -2
- package/dist/feature-libraries/chunked-forest/codec/codecs.js.map +1 -1
- package/dist/feature-libraries/chunked-forest/codec/format.d.ts +5 -5
- package/dist/feature-libraries/chunked-forest/codec/format.d.ts.map +1 -1
- package/dist/feature-libraries/chunked-forest/codec/format.js +4 -4
- package/dist/feature-libraries/chunked-forest/codec/format.js.map +1 -1
- package/dist/feature-libraries/chunked-forest/codec/incrementalEncodingPolicy.d.ts +14 -6
- package/dist/feature-libraries/chunked-forest/codec/incrementalEncodingPolicy.d.ts.map +1 -1
- package/dist/feature-libraries/chunked-forest/codec/incrementalEncodingPolicy.js.map +1 -1
- package/dist/feature-libraries/chunked-forest/codec/schemaBasedEncode.js +7 -2
- package/dist/feature-libraries/chunked-forest/codec/schemaBasedEncode.js.map +1 -1
- package/dist/feature-libraries/default-schema/defaultFieldKinds.d.ts +3 -3
- package/dist/feature-libraries/default-schema/defaultFieldKinds.d.ts.map +1 -1
- package/dist/feature-libraries/default-schema/defaultFieldKinds.js +22 -26
- package/dist/feature-libraries/default-schema/defaultFieldKinds.js.map +1 -1
- package/dist/feature-libraries/detachedFieldIndexSummarizer.d.ts +30 -8
- package/dist/feature-libraries/detachedFieldIndexSummarizer.d.ts.map +1 -1
- package/dist/feature-libraries/detachedFieldIndexSummarizer.js +41 -11
- package/dist/feature-libraries/detachedFieldIndexSummarizer.js.map +1 -1
- package/dist/feature-libraries/forest-summary/codec.d.ts +7 -1
- package/dist/feature-libraries/forest-summary/codec.d.ts.map +1 -1
- package/dist/feature-libraries/forest-summary/codec.js +13 -11
- package/dist/feature-libraries/forest-summary/codec.js.map +1 -1
- package/dist/feature-libraries/forest-summary/forestSummarizer.d.ts +10 -13
- package/dist/feature-libraries/forest-summary/forestSummarizer.d.ts.map +1 -1
- package/dist/feature-libraries/forest-summary/forestSummarizer.js +35 -31
- package/dist/feature-libraries/forest-summary/forestSummarizer.js.map +1 -1
- package/dist/feature-libraries/forest-summary/formatCommon.d.ts +61 -0
- package/dist/feature-libraries/forest-summary/formatCommon.d.ts.map +1 -0
- package/dist/feature-libraries/forest-summary/formatCommon.js +27 -0
- package/dist/feature-libraries/forest-summary/formatCommon.js.map +1 -0
- package/dist/feature-libraries/forest-summary/formatV1.d.ts +51 -0
- package/dist/feature-libraries/forest-summary/formatV1.d.ts.map +1 -0
- package/dist/feature-libraries/forest-summary/formatV1.js +11 -0
- package/dist/feature-libraries/forest-summary/formatV1.js.map +1 -0
- package/dist/feature-libraries/forest-summary/formatV2.d.ts +51 -0
- package/dist/feature-libraries/forest-summary/formatV2.d.ts.map +1 -0
- package/dist/feature-libraries/forest-summary/formatV2.js +11 -0
- package/dist/feature-libraries/forest-summary/formatV2.js.map +1 -0
- package/dist/feature-libraries/forest-summary/incrementalSummaryBuilder.d.ts +18 -24
- package/dist/feature-libraries/forest-summary/incrementalSummaryBuilder.d.ts.map +1 -1
- package/dist/feature-libraries/forest-summary/incrementalSummaryBuilder.js +21 -43
- package/dist/feature-libraries/forest-summary/incrementalSummaryBuilder.js.map +1 -1
- package/dist/feature-libraries/forest-summary/index.d.ts +2 -2
- package/dist/feature-libraries/forest-summary/index.d.ts.map +1 -1
- package/dist/feature-libraries/forest-summary/index.js +3 -4
- package/dist/feature-libraries/forest-summary/index.js.map +1 -1
- package/dist/feature-libraries/forest-summary/summaryFormatCommon.d.ts +35 -0
- package/dist/feature-libraries/forest-summary/summaryFormatCommon.d.ts.map +1 -0
- package/dist/feature-libraries/forest-summary/summaryFormatCommon.js +43 -0
- package/dist/feature-libraries/forest-summary/summaryFormatCommon.js.map +1 -0
- package/dist/feature-libraries/forest-summary/summaryFormatV1ToV2.d.ts +11 -0
- package/dist/feature-libraries/forest-summary/summaryFormatV1ToV2.d.ts.map +1 -0
- package/dist/feature-libraries/forest-summary/summaryFormatV1ToV2.js +14 -0
- package/dist/feature-libraries/forest-summary/summaryFormatV1ToV2.js.map +1 -0
- package/dist/feature-libraries/forest-summary/summaryFormatV3.d.ts +18 -0
- package/dist/feature-libraries/forest-summary/summaryFormatV3.d.ts.map +1 -0
- package/dist/feature-libraries/forest-summary/summaryFormatV3.js +21 -0
- package/dist/feature-libraries/forest-summary/summaryFormatV3.js.map +1 -0
- package/dist/feature-libraries/forest-summary/summaryTypes.d.ts +17 -0
- package/dist/feature-libraries/forest-summary/summaryTypes.d.ts.map +1 -0
- package/dist/feature-libraries/forest-summary/summaryTypes.js +35 -0
- package/dist/feature-libraries/forest-summary/summaryTypes.js.map +1 -0
- package/dist/feature-libraries/index.d.ts +1 -1
- package/dist/feature-libraries/index.d.ts.map +1 -1
- package/dist/feature-libraries/index.js +3 -2
- package/dist/feature-libraries/index.js.map +1 -1
- package/dist/feature-libraries/modular-schema/comparison.d.ts +18 -2
- package/dist/feature-libraries/modular-schema/comparison.d.ts.map +1 -1
- package/dist/feature-libraries/modular-schema/comparison.js +54 -3
- package/dist/feature-libraries/modular-schema/comparison.js.map +1 -1
- package/dist/feature-libraries/modular-schema/fieldKind.d.ts +25 -13
- package/dist/feature-libraries/modular-schema/fieldKind.d.ts.map +1 -1
- package/dist/feature-libraries/modular-schema/fieldKind.js +0 -21
- package/dist/feature-libraries/modular-schema/fieldKind.js.map +1 -1
- package/dist/feature-libraries/modular-schema/genericFieldKind.d.ts.map +1 -1
- package/dist/feature-libraries/modular-schema/genericFieldKind.js +4 -1
- package/dist/feature-libraries/modular-schema/genericFieldKind.js.map +1 -1
- package/dist/feature-libraries/modular-schema/index.d.ts +1 -1
- package/dist/feature-libraries/modular-schema/index.d.ts.map +1 -1
- package/dist/feature-libraries/modular-schema/index.js +2 -1
- package/dist/feature-libraries/modular-schema/index.js.map +1 -1
- package/dist/feature-libraries/schema-edits/schemaChangeCodecs.d.ts.map +1 -1
- package/dist/feature-libraries/schema-edits/schemaChangeCodecs.js +2 -3
- package/dist/feature-libraries/schema-edits/schemaChangeCodecs.js.map +1 -1
- package/dist/feature-libraries/schema-index/codec.d.ts.map +1 -1
- package/dist/feature-libraries/schema-index/codec.js +4 -4
- package/dist/feature-libraries/schema-index/codec.js.map +1 -1
- package/dist/feature-libraries/schema-index/formatV1.d.ts +1 -1
- package/dist/feature-libraries/schema-index/formatV2.d.ts +1 -1
- package/dist/feature-libraries/schema-index/schemaSummarizer.d.ts +27 -8
- package/dist/feature-libraries/schema-index/schemaSummarizer.d.ts.map +1 -1
- package/dist/feature-libraries/schema-index/schemaSummarizer.js +42 -16
- package/dist/feature-libraries/schema-index/schemaSummarizer.js.map +1 -1
- package/dist/index.d.ts +2 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +5 -3
- package/dist/index.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 +1 -1
- package/dist/shared-tree/independentView.d.ts.map +1 -1
- package/dist/shared-tree/independentView.js +1 -1
- package/dist/shared-tree/independentView.js.map +1 -1
- package/dist/shared-tree/schematizingTreeView.d.ts +2 -1
- package/dist/shared-tree/schematizingTreeView.d.ts.map +1 -1
- package/dist/shared-tree/schematizingTreeView.js +3 -0
- package/dist/shared-tree/schematizingTreeView.js.map +1 -1
- package/dist/shared-tree/sharedTree.d.ts +2 -2
- package/dist/shared-tree/sharedTree.d.ts.map +1 -1
- package/dist/shared-tree/sharedTree.js +4 -4
- package/dist/shared-tree/sharedTree.js.map +1 -1
- package/dist/shared-tree/sharedTreeChangeCodecs.js +2 -2
- package/dist/shared-tree/sharedTreeChangeCodecs.js.map +1 -1
- package/dist/shared-tree/sharedTreeChangeEnricher.d.ts +20 -8
- package/dist/shared-tree/sharedTreeChangeEnricher.d.ts.map +1 -1
- package/dist/shared-tree/sharedTreeChangeEnricher.js +25 -11
- package/dist/shared-tree/sharedTreeChangeEnricher.js.map +1 -1
- package/dist/shared-tree/treeAlpha.d.ts.map +1 -1
- package/dist/shared-tree/treeAlpha.js +1 -1
- package/dist/shared-tree/treeAlpha.js.map +1 -1
- package/dist/shared-tree/treeCheckout.d.ts +10 -5
- package/dist/shared-tree/treeCheckout.d.ts.map +1 -1
- package/dist/shared-tree/treeCheckout.js +72 -17
- package/dist/shared-tree/treeCheckout.js.map +1 -1
- package/dist/shared-tree-core/editManagerCodecs.d.ts.map +1 -1
- package/dist/shared-tree-core/editManagerCodecs.js +10 -8
- package/dist/shared-tree-core/editManagerCodecs.js.map +1 -1
- package/{lib/shared-tree-core/editManagerCodecsV5.d.ts → dist/shared-tree-core/editManagerCodecsVSharedBranches.d.ts} +3 -3
- package/dist/shared-tree-core/editManagerCodecsVSharedBranches.d.ts.map +1 -0
- package/dist/shared-tree-core/{editManagerCodecsV5.js → editManagerCodecsVSharedBranches.js} +7 -7
- package/dist/shared-tree-core/editManagerCodecsVSharedBranches.js.map +1 -0
- package/dist/shared-tree-core/editManagerFormatCommons.d.ts +8 -30
- package/dist/shared-tree-core/editManagerFormatCommons.d.ts.map +1 -1
- package/dist/shared-tree-core/editManagerFormatCommons.js +18 -9
- package/dist/shared-tree-core/editManagerFormatCommons.js.map +1 -1
- package/dist/shared-tree-core/editManagerFormatV1toV4.d.ts +1 -1
- package/dist/shared-tree-core/{editManagerFormatV5.d.ts → editManagerFormatVSharedBranches.d.ts} +3 -3
- package/dist/shared-tree-core/editManagerFormatVSharedBranches.d.ts.map +1 -0
- package/dist/shared-tree-core/{editManagerFormatV5.js → editManagerFormatVSharedBranches.js} +2 -2
- package/dist/shared-tree-core/editManagerFormatVSharedBranches.js.map +1 -0
- package/dist/shared-tree-core/editManagerSummarizer.d.ts +29 -9
- package/dist/shared-tree-core/editManagerSummarizer.d.ts.map +1 -1
- package/dist/shared-tree-core/editManagerSummarizer.js +41 -13
- package/dist/shared-tree-core/editManagerSummarizer.js.map +1 -1
- package/dist/shared-tree-core/index.d.ts +5 -2
- package/dist/shared-tree-core/index.d.ts.map +1 -1
- package/dist/shared-tree-core/index.js +7 -1
- package/dist/shared-tree-core/index.js.map +1 -1
- package/{lib/shared-tree-core/messageCodecV5.d.ts → dist/shared-tree-core/messageCodecVSharedBranches.d.ts} +2 -2
- package/dist/shared-tree-core/messageCodecVSharedBranches.d.ts.map +1 -0
- package/dist/shared-tree-core/{messageCodecV5.js → messageCodecVSharedBranches.js} +6 -6
- package/dist/shared-tree-core/messageCodecVSharedBranches.js.map +1 -0
- package/dist/shared-tree-core/messageCodecs.d.ts.map +1 -1
- package/dist/shared-tree-core/messageCodecs.js +12 -10
- package/dist/shared-tree-core/messageCodecs.js.map +1 -1
- package/dist/shared-tree-core/messageFormat.d.ts +9 -36
- package/dist/shared-tree-core/messageFormat.d.ts.map +1 -1
- package/dist/shared-tree-core/messageFormat.js +19 -9
- package/dist/shared-tree-core/messageFormat.js.map +1 -1
- package/{lib/shared-tree-core/messageFormatV5.d.ts → dist/shared-tree-core/messageFormatVSharedBranches.d.ts} +5 -7
- package/dist/shared-tree-core/messageFormatVSharedBranches.d.ts.map +1 -0
- package/dist/shared-tree-core/{messageFormatV5.js → messageFormatVSharedBranches.js} +3 -2
- package/dist/shared-tree-core/messageFormatVSharedBranches.js.map +1 -0
- package/dist/shared-tree-core/sharedTreeCore.d.ts +13 -47
- package/dist/shared-tree-core/sharedTreeCore.d.ts.map +1 -1
- package/dist/shared-tree-core/sharedTreeCore.js +29 -17
- package/dist/shared-tree-core/sharedTreeCore.js.map +1 -1
- package/dist/shared-tree-core/summaryTypes.d.ts +94 -0
- package/dist/shared-tree-core/summaryTypes.d.ts.map +1 -0
- package/dist/shared-tree-core/summaryTypes.js +47 -0
- package/dist/shared-tree-core/summaryTypes.js.map +1 -0
- package/dist/shared-tree-core/versionedSummarizer.d.ts +72 -0
- package/dist/shared-tree-core/versionedSummarizer.d.ts.map +1 -0
- package/dist/shared-tree-core/versionedSummarizer.js +64 -0
- package/dist/shared-tree-core/versionedSummarizer.js.map +1 -0
- package/dist/simple-tree/api/configuration.d.ts +3 -26
- package/dist/simple-tree/api/configuration.d.ts.map +1 -1
- package/dist/simple-tree/api/configuration.js +10 -21
- package/dist/simple-tree/api/configuration.js.map +1 -1
- package/dist/simple-tree/api/dirtyIndex.d.ts +11 -0
- package/dist/simple-tree/api/dirtyIndex.d.ts.map +1 -1
- package/dist/simple-tree/api/dirtyIndex.js +7 -0
- package/dist/simple-tree/api/dirtyIndex.js.map +1 -1
- package/dist/simple-tree/api/discrepancies.d.ts +1 -1
- package/dist/simple-tree/api/discrepancies.d.ts.map +1 -1
- package/dist/simple-tree/api/discrepancies.js.map +1 -1
- package/dist/simple-tree/api/eraseSchemaDetails.d.ts +89 -0
- package/dist/simple-tree/api/eraseSchemaDetails.d.ts.map +1 -0
- package/dist/simple-tree/api/eraseSchemaDetails.js +97 -0
- package/dist/simple-tree/api/eraseSchemaDetails.js.map +1 -0
- package/dist/simple-tree/api/getSimpleSchema.d.ts +3 -3
- package/dist/simple-tree/api/getSimpleSchema.d.ts.map +1 -1
- package/dist/simple-tree/api/getSimpleSchema.js +9 -3
- package/dist/simple-tree/api/getSimpleSchema.js.map +1 -1
- package/dist/simple-tree/api/incrementalAllowedTypes.d.ts +1 -1
- package/dist/simple-tree/api/incrementalAllowedTypes.d.ts.map +1 -1
- package/dist/simple-tree/api/incrementalAllowedTypes.js +7 -0
- package/dist/simple-tree/api/incrementalAllowedTypes.js.map +1 -1
- package/dist/simple-tree/api/index.d.ts +4 -4
- package/dist/simple-tree/api/index.d.ts.map +1 -1
- package/dist/simple-tree/api/index.js +8 -5
- package/dist/simple-tree/api/index.js.map +1 -1
- package/dist/simple-tree/api/schemaCompatibilityTester.d.ts +1 -1
- package/dist/simple-tree/api/schemaCompatibilityTester.d.ts.map +1 -1
- package/dist/simple-tree/api/schemaCompatibilityTester.js.map +1 -1
- package/dist/simple-tree/api/schemaFactoryAlpha.d.ts +5 -5
- package/dist/simple-tree/api/schemaFactoryAlpha.d.ts.map +1 -1
- package/dist/simple-tree/api/schemaFactoryAlpha.js.map +1 -1
- package/dist/simple-tree/api/schemaFactoryRecursive.d.ts.map +1 -1
- package/dist/simple-tree/api/schemaFactoryRecursive.js +0 -1
- package/dist/simple-tree/api/schemaFactoryRecursive.js.map +1 -1
- package/dist/simple-tree/api/schemaFromSimple.d.ts +6 -1
- package/dist/simple-tree/api/schemaFromSimple.d.ts.map +1 -1
- package/dist/simple-tree/api/schemaFromSimple.js +5 -0
- package/dist/simple-tree/api/schemaFromSimple.js.map +1 -1
- package/dist/simple-tree/api/schemaStatics.d.ts +12 -12
- package/dist/simple-tree/api/simpleSchemaCodec.d.ts +15 -3
- package/dist/simple-tree/api/simpleSchemaCodec.d.ts.map +1 -1
- package/dist/simple-tree/api/simpleSchemaCodec.js +18 -6
- package/dist/simple-tree/api/simpleSchemaCodec.js.map +1 -1
- package/dist/simple-tree/api/simpleSchemaToJsonSchema.d.ts +1 -1
- package/dist/simple-tree/api/simpleSchemaToJsonSchema.d.ts.map +1 -1
- package/dist/simple-tree/api/simpleSchemaToJsonSchema.js.map +1 -1
- package/dist/simple-tree/api/snapshotCompatibilityChecker.d.ts +8 -1
- package/dist/simple-tree/api/snapshotCompatibilityChecker.d.ts.map +1 -1
- package/dist/simple-tree/api/snapshotCompatibilityChecker.js +13 -8
- package/dist/simple-tree/api/snapshotCompatibilityChecker.js.map +1 -1
- package/dist/simple-tree/api/storedSchema.d.ts +1 -1
- package/dist/simple-tree/api/storedSchema.d.ts.map +1 -1
- package/dist/simple-tree/api/storedSchema.js +1 -2
- package/dist/simple-tree/api/storedSchema.js.map +1 -1
- package/dist/simple-tree/api/tree.d.ts +15 -2
- package/dist/simple-tree/api/tree.d.ts.map +1 -1
- package/dist/simple-tree/api/tree.js.map +1 -1
- package/dist/simple-tree/api/typesUnsafe.d.ts +3 -3
- package/dist/simple-tree/api/typesUnsafe.d.ts.map +1 -1
- package/dist/simple-tree/api/typesUnsafe.js.map +1 -1
- package/dist/simple-tree/core/allowedTypes.d.ts +2 -2
- package/dist/simple-tree/core/allowedTypes.d.ts.map +1 -1
- package/dist/simple-tree/core/allowedTypes.js.map +1 -1
- package/dist/simple-tree/core/index.d.ts +1 -1
- package/dist/simple-tree/core/index.d.ts.map +1 -1
- package/dist/simple-tree/core/index.js +2 -3
- package/dist/simple-tree/core/index.js.map +1 -1
- package/dist/simple-tree/core/toStored.d.ts +17 -15
- package/dist/simple-tree/core/toStored.d.ts.map +1 -1
- package/dist/simple-tree/core/toStored.js +5 -40
- package/dist/simple-tree/core/toStored.js.map +1 -1
- package/dist/simple-tree/core/treeNode.d.ts.map +1 -1
- package/dist/simple-tree/core/treeNode.js +1 -0
- package/dist/simple-tree/core/treeNode.js.map +1 -1
- package/dist/simple-tree/core/walkSchema.d.ts.map +1 -1
- package/dist/simple-tree/core/walkSchema.js +4 -0
- package/dist/simple-tree/core/walkSchema.js.map +1 -1
- package/dist/simple-tree/createContext.d.ts.map +1 -1
- package/dist/simple-tree/createContext.js +20 -5
- package/dist/simple-tree/createContext.js.map +1 -1
- package/dist/simple-tree/fieldSchema.d.ts +3 -3
- package/dist/simple-tree/fieldSchema.d.ts.map +1 -1
- package/dist/simple-tree/fieldSchema.js.map +1 -1
- package/dist/simple-tree/index.d.ts +6 -5
- package/dist/simple-tree/index.d.ts.map +1 -1
- package/dist/simple-tree/index.js +16 -11
- package/dist/simple-tree/index.js.map +1 -1
- package/dist/simple-tree/leafNodeSchema.d.ts +5 -5
- package/dist/simple-tree/leafNodeSchema.d.ts.map +1 -1
- package/dist/simple-tree/node-kinds/array/arrayNode.d.ts.map +1 -1
- package/dist/simple-tree/node-kinds/array/arrayNode.js.map +1 -1
- package/dist/simple-tree/node-kinds/array/arrayNodeTypes.d.ts +3 -3
- package/dist/simple-tree/node-kinds/array/arrayNodeTypes.d.ts.map +1 -1
- package/dist/simple-tree/node-kinds/array/arrayNodeTypes.js.map +1 -1
- package/dist/simple-tree/node-kinds/map/mapNode.d.ts.map +1 -1
- package/dist/simple-tree/node-kinds/map/mapNode.js.map +1 -1
- package/dist/simple-tree/node-kinds/map/mapNodeTypes.d.ts +3 -3
- package/dist/simple-tree/node-kinds/map/mapNodeTypes.d.ts.map +1 -1
- package/dist/simple-tree/node-kinds/map/mapNodeTypes.js.map +1 -1
- package/dist/simple-tree/node-kinds/object/objectNodeTypes.d.ts +2 -2
- package/dist/simple-tree/node-kinds/object/objectNodeTypes.d.ts.map +1 -1
- package/dist/simple-tree/node-kinds/object/objectNodeTypes.js.map +1 -1
- package/dist/simple-tree/node-kinds/record/recordNode.d.ts.map +1 -1
- package/dist/simple-tree/node-kinds/record/recordNode.js.map +1 -1
- package/dist/simple-tree/node-kinds/record/recordNodeTypes.d.ts +3 -3
- package/dist/simple-tree/node-kinds/record/recordNodeTypes.d.ts.map +1 -1
- package/dist/simple-tree/node-kinds/record/recordNodeTypes.js.map +1 -1
- package/dist/simple-tree/simpleSchema.d.ts +55 -23
- package/dist/simple-tree/simpleSchema.d.ts.map +1 -1
- package/dist/simple-tree/simpleSchema.js +17 -0
- package/dist/simple-tree/simpleSchema.js.map +1 -1
- package/dist/simple-tree/simpleSchemaFormatV1.d.ts +1 -1
- package/dist/simple-tree/simpleSchemaFormatV1.d.ts.map +1 -1
- package/dist/simple-tree/simpleSchemaFormatV1.js +8 -1
- package/dist/simple-tree/simpleSchemaFormatV1.js.map +1 -1
- package/dist/simple-tree/toStoredSchema.d.ts +58 -11
- package/dist/simple-tree/toStoredSchema.d.ts.map +1 -1
- package/dist/simple-tree/toStoredSchema.js +205 -30
- package/dist/simple-tree/toStoredSchema.js.map +1 -1
- package/dist/simple-tree/treeSchema.d.ts +23 -0
- package/dist/simple-tree/treeSchema.d.ts.map +1 -0
- package/dist/simple-tree/treeSchema.js +25 -0
- package/dist/simple-tree/treeSchema.js.map +1 -0
- package/dist/tableSchema.d.ts +107 -64
- package/dist/tableSchema.d.ts.map +1 -1
- package/dist/tableSchema.js +161 -60
- package/dist/tableSchema.js.map +1 -1
- package/dist/util/brand.d.ts +49 -0
- package/dist/util/brand.d.ts.map +1 -1
- package/dist/util/brand.js +47 -1
- package/dist/util/brand.js.map +1 -1
- package/dist/util/index.d.ts +2 -1
- package/dist/util/index.d.ts.map +1 -1
- package/dist/util/index.js +6 -2
- package/dist/util/index.js.map +1 -1
- package/dist/util/readSnapshotBlob.d.ts +13 -0
- package/dist/util/readSnapshotBlob.d.ts.map +1 -0
- package/dist/util/readSnapshotBlob.js +18 -0
- package/dist/util/readSnapshotBlob.js.map +1 -0
- package/eslint.config.mts +98 -0
- package/lib/alpha.d.ts +6 -2
- package/lib/codec/codec.d.ts +41 -13
- package/lib/codec/codec.d.ts.map +1 -1
- package/lib/codec/codec.js +40 -13
- package/lib/codec/codec.js.map +1 -1
- package/lib/codec/versioned/codec.d.ts +1 -1
- package/lib/codec/versioned/codec.d.ts.map +1 -1
- package/lib/codec/versioned/codec.js.map +1 -1
- package/lib/codec/versioned/format.d.ts +4 -1
- package/lib/codec/versioned/format.d.ts.map +1 -1
- package/lib/codec/versioned/format.js +4 -1
- package/lib/codec/versioned/format.js.map +1 -1
- package/lib/core/index.d.ts +2 -2
- package/lib/core/index.d.ts.map +1 -1
- package/lib/core/index.js +1 -1
- package/lib/core/index.js.map +1 -1
- package/lib/core/rebase/index.d.ts +1 -1
- package/lib/core/rebase/index.d.ts.map +1 -1
- package/lib/core/rebase/index.js.map +1 -1
- package/lib/core/rebase/types.d.ts +20 -1
- package/lib/core/rebase/types.d.ts.map +1 -1
- package/lib/core/rebase/types.js.map +1 -1
- package/lib/core/schema-stored/schema.d.ts +4 -7
- package/lib/core/schema-stored/schema.d.ts.map +1 -1
- package/lib/core/schema-stored/schema.js +3 -3
- package/lib/core/schema-stored/schema.js.map +1 -1
- package/lib/core/tree/detachedFieldIndex.d.ts +34 -13
- package/lib/core/tree/detachedFieldIndex.d.ts.map +1 -1
- package/lib/core/tree/detachedFieldIndex.js +12 -12
- package/lib/core/tree/detachedFieldIndex.js.map +1 -1
- package/lib/core/tree/detachedFieldIndexFormatCommon.d.ts +4 -4
- package/lib/core/tree/detachedFieldIndexFormatCommon.d.ts.map +1 -1
- package/lib/core/tree/detachedFieldIndexFormatCommon.js +3 -3
- package/lib/core/tree/detachedFieldIndexFormatCommon.js.map +1 -1
- package/lib/core/tree/index.d.ts +3 -2
- package/lib/core/tree/index.d.ts.map +1 -1
- package/lib/core/tree/index.js +2 -1
- package/lib/core/tree/index.js.map +1 -1
- package/lib/feature-libraries/chunked-forest/codec/codecs.d.ts.map +1 -1
- package/lib/feature-libraries/chunked-forest/codec/codecs.js +3 -3
- package/lib/feature-libraries/chunked-forest/codec/codecs.js.map +1 -1
- package/lib/feature-libraries/chunked-forest/codec/format.d.ts +5 -5
- package/lib/feature-libraries/chunked-forest/codec/format.d.ts.map +1 -1
- package/lib/feature-libraries/chunked-forest/codec/format.js +5 -5
- package/lib/feature-libraries/chunked-forest/codec/format.js.map +1 -1
- package/lib/feature-libraries/chunked-forest/codec/incrementalEncodingPolicy.d.ts +14 -6
- package/lib/feature-libraries/chunked-forest/codec/incrementalEncodingPolicy.d.ts.map +1 -1
- package/lib/feature-libraries/chunked-forest/codec/incrementalEncodingPolicy.js.map +1 -1
- package/lib/feature-libraries/chunked-forest/codec/schemaBasedEncode.js +7 -2
- package/lib/feature-libraries/chunked-forest/codec/schemaBasedEncode.js.map +1 -1
- package/lib/feature-libraries/default-schema/defaultFieldKinds.d.ts +3 -3
- package/lib/feature-libraries/default-schema/defaultFieldKinds.d.ts.map +1 -1
- package/lib/feature-libraries/default-schema/defaultFieldKinds.js +23 -27
- package/lib/feature-libraries/default-schema/defaultFieldKinds.js.map +1 -1
- package/lib/feature-libraries/detachedFieldIndexSummarizer.d.ts +30 -8
- package/lib/feature-libraries/detachedFieldIndexSummarizer.d.ts.map +1 -1
- package/lib/feature-libraries/detachedFieldIndexSummarizer.js +38 -8
- package/lib/feature-libraries/detachedFieldIndexSummarizer.js.map +1 -1
- package/lib/feature-libraries/forest-summary/codec.d.ts +7 -1
- package/lib/feature-libraries/forest-summary/codec.d.ts.map +1 -1
- package/lib/feature-libraries/forest-summary/codec.js +12 -11
- package/lib/feature-libraries/forest-summary/codec.js.map +1 -1
- package/lib/feature-libraries/forest-summary/forestSummarizer.d.ts +10 -13
- package/lib/feature-libraries/forest-summary/forestSummarizer.d.ts.map +1 -1
- package/lib/feature-libraries/forest-summary/forestSummarizer.js +33 -29
- package/lib/feature-libraries/forest-summary/forestSummarizer.js.map +1 -1
- package/lib/feature-libraries/forest-summary/formatCommon.d.ts +61 -0
- package/lib/feature-libraries/forest-summary/formatCommon.d.ts.map +1 -0
- package/lib/feature-libraries/forest-summary/formatCommon.js +23 -0
- package/lib/feature-libraries/forest-summary/formatCommon.js.map +1 -0
- package/lib/feature-libraries/forest-summary/formatV1.d.ts +51 -0
- package/lib/feature-libraries/forest-summary/formatV1.d.ts.map +1 -0
- package/lib/feature-libraries/forest-summary/formatV1.js +8 -0
- package/lib/feature-libraries/forest-summary/formatV1.js.map +1 -0
- package/lib/feature-libraries/forest-summary/formatV2.d.ts +51 -0
- package/lib/feature-libraries/forest-summary/formatV2.d.ts.map +1 -0
- package/lib/feature-libraries/forest-summary/formatV2.js +8 -0
- package/lib/feature-libraries/forest-summary/formatV2.js.map +1 -0
- package/lib/feature-libraries/forest-summary/incrementalSummaryBuilder.d.ts +18 -24
- package/lib/feature-libraries/forest-summary/incrementalSummaryBuilder.d.ts.map +1 -1
- package/lib/feature-libraries/forest-summary/incrementalSummaryBuilder.js +20 -42
- package/lib/feature-libraries/forest-summary/incrementalSummaryBuilder.js.map +1 -1
- package/lib/feature-libraries/forest-summary/index.d.ts +2 -2
- package/lib/feature-libraries/forest-summary/index.d.ts.map +1 -1
- package/lib/feature-libraries/forest-summary/index.js +2 -2
- package/lib/feature-libraries/forest-summary/index.js.map +1 -1
- package/lib/feature-libraries/forest-summary/summaryFormatCommon.d.ts +35 -0
- package/lib/feature-libraries/forest-summary/summaryFormatCommon.d.ts.map +1 -0
- package/lib/feature-libraries/forest-summary/summaryFormatCommon.js +40 -0
- package/lib/feature-libraries/forest-summary/summaryFormatCommon.js.map +1 -0
- package/lib/feature-libraries/forest-summary/summaryFormatV1ToV2.d.ts +11 -0
- package/lib/feature-libraries/forest-summary/summaryFormatV1ToV2.d.ts.map +1 -0
- package/lib/feature-libraries/forest-summary/summaryFormatV1ToV2.js +11 -0
- package/lib/feature-libraries/forest-summary/summaryFormatV1ToV2.js.map +1 -0
- package/lib/feature-libraries/forest-summary/summaryFormatV3.d.ts +18 -0
- package/lib/feature-libraries/forest-summary/summaryFormatV3.d.ts.map +1 -0
- package/lib/feature-libraries/forest-summary/summaryFormatV3.js +18 -0
- package/lib/feature-libraries/forest-summary/summaryFormatV3.js.map +1 -0
- package/lib/feature-libraries/forest-summary/summaryTypes.d.ts +17 -0
- package/lib/feature-libraries/forest-summary/summaryTypes.d.ts.map +1 -0
- package/lib/feature-libraries/forest-summary/summaryTypes.js +30 -0
- package/lib/feature-libraries/forest-summary/summaryTypes.js.map +1 -0
- package/lib/feature-libraries/index.d.ts +1 -1
- package/lib/feature-libraries/index.d.ts.map +1 -1
- package/lib/feature-libraries/index.js +1 -1
- package/lib/feature-libraries/index.js.map +1 -1
- package/lib/feature-libraries/modular-schema/comparison.d.ts +18 -2
- package/lib/feature-libraries/modular-schema/comparison.d.ts.map +1 -1
- package/lib/feature-libraries/modular-schema/comparison.js +55 -5
- package/lib/feature-libraries/modular-schema/comparison.js.map +1 -1
- package/lib/feature-libraries/modular-schema/fieldKind.d.ts +25 -13
- package/lib/feature-libraries/modular-schema/fieldKind.d.ts.map +1 -1
- package/lib/feature-libraries/modular-schema/fieldKind.js +0 -21
- package/lib/feature-libraries/modular-schema/fieldKind.js.map +1 -1
- package/lib/feature-libraries/modular-schema/genericFieldKind.d.ts.map +1 -1
- package/lib/feature-libraries/modular-schema/genericFieldKind.js +4 -1
- package/lib/feature-libraries/modular-schema/genericFieldKind.js.map +1 -1
- package/lib/feature-libraries/modular-schema/index.d.ts +1 -1
- package/lib/feature-libraries/modular-schema/index.d.ts.map +1 -1
- package/lib/feature-libraries/modular-schema/index.js +1 -1
- package/lib/feature-libraries/modular-schema/index.js.map +1 -1
- package/lib/feature-libraries/schema-edits/schemaChangeCodecs.d.ts.map +1 -1
- package/lib/feature-libraries/schema-edits/schemaChangeCodecs.js +2 -3
- package/lib/feature-libraries/schema-edits/schemaChangeCodecs.js.map +1 -1
- package/lib/feature-libraries/schema-index/codec.d.ts.map +1 -1
- package/lib/feature-libraries/schema-index/codec.js +5 -5
- package/lib/feature-libraries/schema-index/codec.js.map +1 -1
- package/lib/feature-libraries/schema-index/formatV1.d.ts +1 -1
- package/lib/feature-libraries/schema-index/formatV2.d.ts +1 -1
- package/lib/feature-libraries/schema-index/schemaSummarizer.d.ts +27 -8
- package/lib/feature-libraries/schema-index/schemaSummarizer.d.ts.map +1 -1
- package/lib/feature-libraries/schema-index/schemaSummarizer.js +38 -12
- package/lib/feature-libraries/schema-index/schemaSummarizer.js.map +1 -1
- package/lib/index.d.ts +2 -2
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +1 -1
- package/lib/index.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 +1 -1
- package/lib/shared-tree/independentView.d.ts.map +1 -1
- package/lib/shared-tree/independentView.js +2 -2
- package/lib/shared-tree/independentView.js.map +1 -1
- package/lib/shared-tree/schematizingTreeView.d.ts +2 -1
- package/lib/shared-tree/schematizingTreeView.d.ts.map +1 -1
- package/lib/shared-tree/schematizingTreeView.js +3 -0
- package/lib/shared-tree/schematizingTreeView.js.map +1 -1
- package/lib/shared-tree/sharedTree.d.ts +2 -2
- package/lib/shared-tree/sharedTree.d.ts.map +1 -1
- package/lib/shared-tree/sharedTree.js +4 -4
- package/lib/shared-tree/sharedTree.js.map +1 -1
- package/lib/shared-tree/sharedTreeChangeCodecs.js +2 -2
- package/lib/shared-tree/sharedTreeChangeCodecs.js.map +1 -1
- package/lib/shared-tree/sharedTreeChangeEnricher.d.ts +20 -8
- package/lib/shared-tree/sharedTreeChangeEnricher.d.ts.map +1 -1
- package/lib/shared-tree/sharedTreeChangeEnricher.js +25 -11
- package/lib/shared-tree/sharedTreeChangeEnricher.js.map +1 -1
- package/lib/shared-tree/treeAlpha.d.ts.map +1 -1
- package/lib/shared-tree/treeAlpha.js +2 -2
- package/lib/shared-tree/treeAlpha.js.map +1 -1
- package/lib/shared-tree/treeCheckout.d.ts +10 -5
- package/lib/shared-tree/treeCheckout.d.ts.map +1 -1
- package/lib/shared-tree/treeCheckout.js +73 -18
- package/lib/shared-tree/treeCheckout.js.map +1 -1
- package/lib/shared-tree-core/editManagerCodecs.d.ts.map +1 -1
- package/lib/shared-tree-core/editManagerCodecs.js +11 -9
- package/lib/shared-tree-core/editManagerCodecs.js.map +1 -1
- package/{dist/shared-tree-core/editManagerCodecsV5.d.ts → lib/shared-tree-core/editManagerCodecsVSharedBranches.d.ts} +3 -3
- package/lib/shared-tree-core/editManagerCodecsVSharedBranches.d.ts.map +1 -0
- package/lib/shared-tree-core/{editManagerCodecsV5.js → editManagerCodecsVSharedBranches.js} +4 -4
- package/lib/shared-tree-core/editManagerCodecsVSharedBranches.js.map +1 -0
- package/lib/shared-tree-core/editManagerFormatCommons.d.ts +8 -30
- package/lib/shared-tree-core/editManagerFormatCommons.d.ts.map +1 -1
- package/lib/shared-tree-core/editManagerFormatCommons.js +19 -10
- package/lib/shared-tree-core/editManagerFormatCommons.js.map +1 -1
- package/lib/shared-tree-core/editManagerFormatV1toV4.d.ts +1 -1
- package/lib/shared-tree-core/{editManagerFormatV5.d.ts → editManagerFormatVSharedBranches.d.ts} +3 -3
- package/lib/shared-tree-core/editManagerFormatVSharedBranches.d.ts.map +1 -0
- package/lib/shared-tree-core/{editManagerFormatV5.js → editManagerFormatVSharedBranches.js} +2 -2
- package/lib/shared-tree-core/editManagerFormatVSharedBranches.js.map +1 -0
- package/lib/shared-tree-core/editManagerSummarizer.d.ts +29 -9
- package/lib/shared-tree-core/editManagerSummarizer.d.ts.map +1 -1
- package/lib/shared-tree-core/editManagerSummarizer.js +39 -11
- package/lib/shared-tree-core/editManagerSummarizer.js.map +1 -1
- package/lib/shared-tree-core/index.d.ts +5 -2
- package/lib/shared-tree-core/index.d.ts.map +1 -1
- package/lib/shared-tree-core/index.js +3 -1
- package/lib/shared-tree-core/index.js.map +1 -1
- package/{dist/shared-tree-core/messageCodecV5.d.ts → lib/shared-tree-core/messageCodecVSharedBranches.d.ts} +2 -2
- package/lib/shared-tree-core/messageCodecVSharedBranches.d.ts.map +1 -0
- package/lib/shared-tree-core/{messageCodecV5.js → messageCodecVSharedBranches.js} +3 -3
- package/lib/shared-tree-core/messageCodecVSharedBranches.js.map +1 -0
- package/lib/shared-tree-core/messageCodecs.d.ts.map +1 -1
- package/lib/shared-tree-core/messageCodecs.js +13 -11
- package/lib/shared-tree-core/messageCodecs.js.map +1 -1
- package/lib/shared-tree-core/messageFormat.d.ts +9 -36
- package/lib/shared-tree-core/messageFormat.d.ts.map +1 -1
- package/lib/shared-tree-core/messageFormat.js +19 -9
- package/lib/shared-tree-core/messageFormat.js.map +1 -1
- package/{dist/shared-tree-core/messageFormatV5.d.ts → lib/shared-tree-core/messageFormatVSharedBranches.d.ts} +5 -7
- package/lib/shared-tree-core/messageFormatVSharedBranches.d.ts.map +1 -0
- package/lib/shared-tree-core/{messageFormatV5.js → messageFormatVSharedBranches.js} +3 -2
- package/lib/shared-tree-core/messageFormatVSharedBranches.js.map +1 -0
- package/lib/shared-tree-core/sharedTreeCore.d.ts +13 -47
- package/lib/shared-tree-core/sharedTreeCore.d.ts.map +1 -1
- package/lib/shared-tree-core/sharedTreeCore.js +27 -15
- package/lib/shared-tree-core/sharedTreeCore.js.map +1 -1
- package/lib/shared-tree-core/summaryTypes.d.ts +94 -0
- package/lib/shared-tree-core/summaryTypes.d.ts.map +1 -0
- package/lib/shared-tree-core/summaryTypes.js +43 -0
- package/lib/shared-tree-core/summaryTypes.js.map +1 -0
- package/lib/shared-tree-core/versionedSummarizer.d.ts +72 -0
- package/lib/shared-tree-core/versionedSummarizer.d.ts.map +1 -0
- package/lib/shared-tree-core/versionedSummarizer.js +60 -0
- package/lib/shared-tree-core/versionedSummarizer.js.map +1 -0
- package/lib/simple-tree/api/configuration.d.ts +3 -26
- package/lib/simple-tree/api/configuration.d.ts.map +1 -1
- package/lib/simple-tree/api/configuration.js +14 -25
- package/lib/simple-tree/api/configuration.js.map +1 -1
- package/lib/simple-tree/api/dirtyIndex.d.ts +11 -0
- package/lib/simple-tree/api/dirtyIndex.d.ts.map +1 -1
- package/lib/simple-tree/api/dirtyIndex.js +7 -0
- package/lib/simple-tree/api/dirtyIndex.js.map +1 -1
- package/lib/simple-tree/api/discrepancies.d.ts +1 -1
- package/lib/simple-tree/api/discrepancies.d.ts.map +1 -1
- package/lib/simple-tree/api/discrepancies.js.map +1 -1
- package/lib/simple-tree/api/eraseSchemaDetails.d.ts +89 -0
- package/lib/simple-tree/api/eraseSchemaDetails.d.ts.map +1 -0
- package/lib/simple-tree/api/eraseSchemaDetails.js +92 -0
- package/lib/simple-tree/api/eraseSchemaDetails.js.map +1 -0
- package/lib/simple-tree/api/getSimpleSchema.d.ts +3 -3
- package/lib/simple-tree/api/getSimpleSchema.d.ts.map +1 -1
- package/lib/simple-tree/api/getSimpleSchema.js +9 -3
- package/lib/simple-tree/api/getSimpleSchema.js.map +1 -1
- package/lib/simple-tree/api/incrementalAllowedTypes.d.ts +1 -1
- package/lib/simple-tree/api/incrementalAllowedTypes.d.ts.map +1 -1
- package/lib/simple-tree/api/incrementalAllowedTypes.js +8 -1
- package/lib/simple-tree/api/incrementalAllowedTypes.js.map +1 -1
- package/lib/simple-tree/api/index.d.ts +4 -4
- package/lib/simple-tree/api/index.d.ts.map +1 -1
- package/lib/simple-tree/api/index.js +3 -3
- package/lib/simple-tree/api/index.js.map +1 -1
- package/lib/simple-tree/api/schemaCompatibilityTester.d.ts +1 -1
- package/lib/simple-tree/api/schemaCompatibilityTester.d.ts.map +1 -1
- package/lib/simple-tree/api/schemaCompatibilityTester.js.map +1 -1
- package/lib/simple-tree/api/schemaFactoryAlpha.d.ts +5 -5
- package/lib/simple-tree/api/schemaFactoryAlpha.d.ts.map +1 -1
- package/lib/simple-tree/api/schemaFactoryAlpha.js.map +1 -1
- package/lib/simple-tree/api/schemaFactoryRecursive.d.ts.map +1 -1
- package/lib/simple-tree/api/schemaFactoryRecursive.js +0 -1
- package/lib/simple-tree/api/schemaFactoryRecursive.js.map +1 -1
- package/lib/simple-tree/api/schemaFromSimple.d.ts +6 -1
- package/lib/simple-tree/api/schemaFromSimple.d.ts.map +1 -1
- package/lib/simple-tree/api/schemaFromSimple.js +5 -0
- package/lib/simple-tree/api/schemaFromSimple.js.map +1 -1
- package/lib/simple-tree/api/schemaStatics.d.ts +12 -12
- package/lib/simple-tree/api/simpleSchemaCodec.d.ts +15 -3
- package/lib/simple-tree/api/simpleSchemaCodec.d.ts.map +1 -1
- package/lib/simple-tree/api/simpleSchemaCodec.js +15 -3
- package/lib/simple-tree/api/simpleSchemaCodec.js.map +1 -1
- package/lib/simple-tree/api/simpleSchemaToJsonSchema.d.ts +1 -1
- package/lib/simple-tree/api/simpleSchemaToJsonSchema.d.ts.map +1 -1
- package/lib/simple-tree/api/simpleSchemaToJsonSchema.js.map +1 -1
- package/lib/simple-tree/api/snapshotCompatibilityChecker.d.ts +8 -1
- package/lib/simple-tree/api/snapshotCompatibilityChecker.d.ts.map +1 -1
- package/lib/simple-tree/api/snapshotCompatibilityChecker.js +15 -10
- package/lib/simple-tree/api/snapshotCompatibilityChecker.js.map +1 -1
- package/lib/simple-tree/api/storedSchema.d.ts +1 -1
- package/lib/simple-tree/api/storedSchema.d.ts.map +1 -1
- package/lib/simple-tree/api/storedSchema.js +1 -2
- package/lib/simple-tree/api/storedSchema.js.map +1 -1
- package/lib/simple-tree/api/tree.d.ts +15 -2
- package/lib/simple-tree/api/tree.d.ts.map +1 -1
- package/lib/simple-tree/api/tree.js.map +1 -1
- package/lib/simple-tree/api/typesUnsafe.d.ts +3 -3
- package/lib/simple-tree/api/typesUnsafe.d.ts.map +1 -1
- package/lib/simple-tree/api/typesUnsafe.js.map +1 -1
- package/lib/simple-tree/core/allowedTypes.d.ts +2 -2
- package/lib/simple-tree/core/allowedTypes.d.ts.map +1 -1
- package/lib/simple-tree/core/allowedTypes.js.map +1 -1
- package/lib/simple-tree/core/index.d.ts +1 -1
- package/lib/simple-tree/core/index.d.ts.map +1 -1
- package/lib/simple-tree/core/index.js +1 -1
- package/lib/simple-tree/core/index.js.map +1 -1
- package/lib/simple-tree/core/toStored.d.ts +17 -15
- package/lib/simple-tree/core/toStored.d.ts.map +1 -1
- package/lib/simple-tree/core/toStored.js +4 -37
- package/lib/simple-tree/core/toStored.js.map +1 -1
- package/lib/simple-tree/core/treeNode.d.ts.map +1 -1
- package/lib/simple-tree/core/treeNode.js +1 -0
- package/lib/simple-tree/core/treeNode.js.map +1 -1
- package/lib/simple-tree/core/walkSchema.d.ts.map +1 -1
- package/lib/simple-tree/core/walkSchema.js +5 -1
- package/lib/simple-tree/core/walkSchema.js.map +1 -1
- package/lib/simple-tree/createContext.d.ts.map +1 -1
- package/lib/simple-tree/createContext.js +20 -5
- package/lib/simple-tree/createContext.js.map +1 -1
- package/lib/simple-tree/fieldSchema.d.ts +3 -3
- package/lib/simple-tree/fieldSchema.d.ts.map +1 -1
- package/lib/simple-tree/fieldSchema.js.map +1 -1
- package/lib/simple-tree/index.d.ts +6 -5
- package/lib/simple-tree/index.d.ts.map +1 -1
- package/lib/simple-tree/index.js +5 -4
- package/lib/simple-tree/index.js.map +1 -1
- package/lib/simple-tree/leafNodeSchema.d.ts +5 -5
- package/lib/simple-tree/leafNodeSchema.d.ts.map +1 -1
- package/lib/simple-tree/node-kinds/array/arrayNode.d.ts.map +1 -1
- package/lib/simple-tree/node-kinds/array/arrayNode.js.map +1 -1
- package/lib/simple-tree/node-kinds/array/arrayNodeTypes.d.ts +3 -3
- package/lib/simple-tree/node-kinds/array/arrayNodeTypes.d.ts.map +1 -1
- package/lib/simple-tree/node-kinds/array/arrayNodeTypes.js.map +1 -1
- package/lib/simple-tree/node-kinds/map/mapNode.d.ts.map +1 -1
- package/lib/simple-tree/node-kinds/map/mapNode.js.map +1 -1
- package/lib/simple-tree/node-kinds/map/mapNodeTypes.d.ts +3 -3
- package/lib/simple-tree/node-kinds/map/mapNodeTypes.d.ts.map +1 -1
- package/lib/simple-tree/node-kinds/map/mapNodeTypes.js.map +1 -1
- package/lib/simple-tree/node-kinds/object/objectNodeTypes.d.ts +2 -2
- package/lib/simple-tree/node-kinds/object/objectNodeTypes.d.ts.map +1 -1
- package/lib/simple-tree/node-kinds/object/objectNodeTypes.js.map +1 -1
- package/lib/simple-tree/node-kinds/record/recordNode.d.ts.map +1 -1
- package/lib/simple-tree/node-kinds/record/recordNode.js.map +1 -1
- package/lib/simple-tree/node-kinds/record/recordNodeTypes.d.ts +3 -3
- package/lib/simple-tree/node-kinds/record/recordNodeTypes.d.ts.map +1 -1
- package/lib/simple-tree/node-kinds/record/recordNodeTypes.js.map +1 -1
- package/lib/simple-tree/simpleSchema.d.ts +55 -23
- package/lib/simple-tree/simpleSchema.d.ts.map +1 -1
- package/lib/simple-tree/simpleSchema.js +16 -1
- package/lib/simple-tree/simpleSchema.js.map +1 -1
- package/lib/simple-tree/simpleSchemaFormatV1.d.ts +1 -1
- package/lib/simple-tree/simpleSchemaFormatV1.d.ts.map +1 -1
- package/lib/simple-tree/simpleSchemaFormatV1.js +8 -1
- package/lib/simple-tree/simpleSchemaFormatV1.js.map +1 -1
- package/lib/simple-tree/toStoredSchema.d.ts +58 -11
- package/lib/simple-tree/toStoredSchema.d.ts.map +1 -1
- package/lib/simple-tree/toStoredSchema.js +204 -31
- package/lib/simple-tree/toStoredSchema.js.map +1 -1
- package/lib/simple-tree/treeSchema.d.ts +23 -0
- package/lib/simple-tree/treeSchema.d.ts.map +1 -0
- package/lib/simple-tree/treeSchema.js +21 -0
- package/lib/simple-tree/treeSchema.js.map +1 -0
- package/lib/tableSchema.d.ts +107 -64
- package/lib/tableSchema.d.ts.map +1 -1
- package/lib/tableSchema.js +162 -61
- package/lib/tableSchema.js.map +1 -1
- package/lib/util/brand.d.ts +49 -0
- package/lib/util/brand.d.ts.map +1 -1
- package/lib/util/brand.js +44 -0
- package/lib/util/brand.js.map +1 -1
- package/lib/util/index.d.ts +2 -1
- package/lib/util/index.d.ts.map +1 -1
- package/lib/util/index.js +2 -1
- package/lib/util/index.js.map +1 -1
- package/lib/util/readSnapshotBlob.d.ts +13 -0
- package/lib/util/readSnapshotBlob.d.ts.map +1 -0
- package/lib/util/readSnapshotBlob.js +14 -0
- package/lib/util/readSnapshotBlob.js.map +1 -0
- package/package.json +24 -23
- package/src/codec/codec.ts +44 -14
- package/src/codec/versioned/codec.ts +1 -1
- package/src/codec/versioned/format.ts +4 -1
- package/src/core/index.ts +4 -1
- package/src/core/rebase/index.ts +1 -0
- package/src/core/rebase/types.ts +25 -0
- package/src/core/schema-stored/schema.ts +5 -7
- package/src/core/tree/detachedFieldIndex.ts +54 -13
- package/src/core/tree/detachedFieldIndexFormatCommon.ts +4 -7
- package/src/core/tree/index.ts +7 -2
- package/src/feature-libraries/chunked-forest/codec/codecs.ts +3 -2
- package/src/feature-libraries/chunked-forest/codec/format.ts +6 -9
- package/src/feature-libraries/chunked-forest/codec/incrementalEncodingPolicy.ts +15 -7
- package/src/feature-libraries/chunked-forest/codec/schemaBasedEncode.ts +9 -9
- package/src/feature-libraries/default-schema/defaultFieldKinds.ts +22 -33
- package/src/feature-libraries/detachedFieldIndexSummarizer.ts +62 -15
- package/src/feature-libraries/forest-summary/codec.ts +22 -10
- package/src/feature-libraries/forest-summary/forestSummarizer.ts +77 -44
- package/src/feature-libraries/forest-summary/{format.ts → formatCommon.ts} +12 -13
- package/src/feature-libraries/forest-summary/formatV1.ts +12 -0
- package/src/feature-libraries/forest-summary/formatV2.ts +12 -0
- package/src/feature-libraries/forest-summary/incrementalSummaryBuilder.ts +37 -56
- package/src/feature-libraries/forest-summary/index.ts +2 -2
- package/src/feature-libraries/forest-summary/summaryFormatCommon.ts +41 -0
- package/src/feature-libraries/forest-summary/summaryFormatV1ToV2.ts +11 -0
- package/src/feature-libraries/forest-summary/summaryFormatV3.ts +18 -0
- package/src/feature-libraries/forest-summary/summaryTypes.ts +41 -0
- package/src/feature-libraries/index.ts +1 -1
- package/src/feature-libraries/modular-schema/comparison.ts +64 -5
- package/src/feature-libraries/modular-schema/fieldKind.ts +24 -40
- package/src/feature-libraries/modular-schema/genericFieldKind.ts +4 -1
- package/src/feature-libraries/modular-schema/index.ts +1 -0
- package/src/feature-libraries/schema-edits/schemaChangeCodecs.ts +2 -3
- package/src/feature-libraries/schema-index/codec.ts +7 -9
- package/src/feature-libraries/schema-index/schemaSummarizer.ts +59 -18
- package/src/index.ts +6 -2
- package/src/packageVersion.ts +1 -1
- package/src/shared-tree/independentView.ts +2 -3
- package/src/shared-tree/schematizingTreeView.ts +5 -0
- package/src/shared-tree/sharedTree.ts +20 -9
- package/src/shared-tree/sharedTreeChangeCodecs.ts +2 -2
- package/src/shared-tree/sharedTreeChangeEnricher.ts +31 -11
- package/src/shared-tree/treeAlpha.ts +2 -3
- package/src/shared-tree/treeCheckout.ts +103 -20
- package/src/shared-tree-core/editManagerCodecs.ts +11 -9
- package/src/shared-tree-core/{editManagerCodecsV5.ts → editManagerCodecsVSharedBranches.ts} +3 -3
- package/src/shared-tree-core/editManagerFormatCommons.ts +22 -16
- package/src/shared-tree-core/{editManagerFormatV5.ts → editManagerFormatVSharedBranches.ts} +2 -2
- package/src/shared-tree-core/editManagerSummarizer.ts +58 -16
- package/src/shared-tree-core/index.ts +12 -3
- package/src/shared-tree-core/{messageCodecV5.ts → messageCodecVSharedBranches.ts} +3 -3
- package/src/shared-tree-core/messageCodecs.ts +13 -11
- package/src/shared-tree-core/messageFormat.ts +23 -16
- package/src/shared-tree-core/{messageFormatV5.ts → messageFormatVSharedBranches.ts} +4 -6
- package/src/shared-tree-core/sharedTreeCore.ts +63 -75
- package/src/shared-tree-core/summaryTypes.ts +122 -0
- package/src/shared-tree-core/versionedSummarizer.ts +114 -0
- package/src/simple-tree/api/configuration.ts +21 -68
- package/src/simple-tree/api/dirtyIndex.ts +11 -0
- package/src/simple-tree/api/discrepancies.ts +1 -1
- package/src/simple-tree/api/eraseSchemaDetails.ts +123 -0
- package/src/simple-tree/api/getSimpleSchema.ts +13 -6
- package/src/simple-tree/api/incrementalAllowedTypes.ts +15 -3
- package/src/simple-tree/api/index.ts +7 -4
- package/src/simple-tree/api/schemaCompatibilityTester.ts +1 -1
- package/src/simple-tree/api/schemaFactoryAlpha.ts +2 -2
- package/src/simple-tree/api/schemaFactoryRecursive.ts +0 -2
- package/src/simple-tree/api/schemaFromSimple.ts +11 -5
- package/src/simple-tree/api/simpleSchemaCodec.ts +17 -3
- package/src/simple-tree/api/simpleSchemaToJsonSchema.ts +1 -1
- package/src/simple-tree/api/snapshotCompatibilityChecker.ts +18 -10
- package/src/simple-tree/api/storedSchema.ts +2 -2
- package/src/simple-tree/api/tree.ts +16 -1
- package/src/simple-tree/api/typesUnsafe.ts +7 -3
- package/src/simple-tree/core/allowedTypes.ts +3 -3
- package/src/simple-tree/core/index.ts +2 -2
- package/src/simple-tree/core/toStored.ts +22 -55
- package/src/simple-tree/core/treeNode.ts +1 -0
- package/src/simple-tree/core/walkSchema.ts +6 -0
- package/src/simple-tree/createContext.ts +29 -11
- package/src/simple-tree/fieldSchema.ts +10 -3
- package/src/simple-tree/index.ts +12 -10
- package/src/simple-tree/node-kinds/array/arrayNode.ts +5 -2
- package/src/simple-tree/node-kinds/array/arrayNodeTypes.ts +3 -3
- package/src/simple-tree/node-kinds/map/mapNode.ts +5 -2
- package/src/simple-tree/node-kinds/map/mapNodeTypes.ts +3 -3
- package/src/simple-tree/node-kinds/object/objectNodeTypes.ts +6 -2
- package/src/simple-tree/node-kinds/record/recordNode.ts +5 -2
- package/src/simple-tree/node-kinds/record/recordNodeTypes.ts +3 -3
- package/src/simple-tree/simpleSchema.ts +79 -32
- package/src/simple-tree/simpleSchemaFormatV1.ts +9 -1
- package/src/simple-tree/toStoredSchema.ts +319 -61
- package/src/simple-tree/treeSchema.ts +54 -0
- package/src/tableSchema.ts +487 -173
- package/src/util/brand.ts +61 -0
- package/src/util/index.ts +5 -0
- package/src/util/readSnapshotBlob.ts +23 -0
- package/dist/feature-libraries/forest-summary/format.d.ts +0 -23
- package/dist/feature-libraries/forest-summary/format.d.ts.map +0 -1
- package/dist/feature-libraries/forest-summary/format.js +0 -24
- package/dist/feature-libraries/forest-summary/format.js.map +0 -1
- package/dist/shared-tree-core/editManagerCodecsV5.d.ts.map +0 -1
- package/dist/shared-tree-core/editManagerCodecsV5.js.map +0 -1
- package/dist/shared-tree-core/editManagerFormatV5.d.ts.map +0 -1
- package/dist/shared-tree-core/editManagerFormatV5.js.map +0 -1
- package/dist/shared-tree-core/messageCodecV5.d.ts.map +0 -1
- package/dist/shared-tree-core/messageCodecV5.js.map +0 -1
- package/dist/shared-tree-core/messageFormatV5.d.ts.map +0 -1
- package/dist/shared-tree-core/messageFormatV5.js.map +0 -1
- package/dist/simple-tree/api/viewSchemaToSimpleSchema.d.ts +0 -40
- package/dist/simple-tree/api/viewSchemaToSimpleSchema.d.ts.map +0 -1
- package/dist/simple-tree/api/viewSchemaToSimpleSchema.js +0 -177
- package/dist/simple-tree/api/viewSchemaToSimpleSchema.js.map +0 -1
- package/lib/feature-libraries/forest-summary/format.d.ts +0 -23
- package/lib/feature-libraries/forest-summary/format.d.ts.map +0 -1
- package/lib/feature-libraries/forest-summary/format.js +0 -21
- package/lib/feature-libraries/forest-summary/format.js.map +0 -1
- package/lib/shared-tree-core/editManagerCodecsV5.d.ts.map +0 -1
- package/lib/shared-tree-core/editManagerCodecsV5.js.map +0 -1
- package/lib/shared-tree-core/editManagerFormatV5.d.ts.map +0 -1
- package/lib/shared-tree-core/editManagerFormatV5.js.map +0 -1
- package/lib/shared-tree-core/messageCodecV5.d.ts.map +0 -1
- package/lib/shared-tree-core/messageCodecV5.js.map +0 -1
- package/lib/shared-tree-core/messageFormatV5.d.ts.map +0 -1
- package/lib/shared-tree-core/messageFormatV5.js.map +0 -1
- package/lib/simple-tree/api/viewSchemaToSimpleSchema.d.ts +0 -40
- package/lib/simple-tree/api/viewSchemaToSimpleSchema.d.ts.map +0 -1
- package/lib/simple-tree/api/viewSchemaToSimpleSchema.js +0 -171
- package/lib/simple-tree/api/viewSchemaToSimpleSchema.js.map +0 -1
- package/src/simple-tree/api/viewSchemaToSimpleSchema.ts +0 -209
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"detachedFieldIndex.js","sourceRoot":"","sources":["../../../src/core/tree/detachedFieldIndex.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,kEAA6D;AAG7D,mDAK8B;AAC9B,kDAW6B;AAY7B,+EAA4E;AAE5E;;GAEG;AACH,MAAa,kBAAkB;IA+B9B;;;OAGG;IACH,YACkB,IAAY,EACrB,eAA0C,EACjC,gBAAkC,EAClC,YAA2B,EAC5C,OAA2B;QAJV,SAAI,GAAJ,IAAI,CAAQ;QACrB,oBAAe,GAAf,eAAe,CAA2B;QACjC,qBAAgB,GAAhB,gBAAgB,CAAkB;QAClC,iBAAY,GAAZ,YAAY,CAAe;QAtC7C;;WAEG;QACK,wBAAmB,GAA2C,IAAI,GAAG,EAAE,CAAC;QAChF;;;;;;WAMG;QACK,m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,GAA2C,IAAI,GAAG,EAAE,CAAC;QACjF,MAAM,OAAO,GAAG,IAAI,GAAG,EAAE,CAAC;QAC1B,IAAA,6BAAkB,EAAC,IAAI,CAAC,mBAAmB,EAAE,CAAC,EAAE,IAAI,EAAE,EAAE,KAAK,EAAE,KAAK,EAAE,EAAE;YACvE,IAAA,yBAAc,EAAC,sBAAsB,EAAE,KAAK,EAAE,KAAK,EAAE;gBACpD,IAAI;gBACJ,sBAAsB,EAAE,cAAc;aACtC,CAAC,CAAC;YACH,OAAO,CAAC,GAAG,CAAC,IAAI,EAAE,EAAE,KAAK,EAAE,KAAK,EAAE,CAAC,CAAC;QACrC,CAAC,CAAC,CAAC;QAEH,IAAI,CAAC,mBAAmB,GAAG,sBAAsB,CAAC;QAClD,IAAI,CAAC,8BAA8B,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC;QACtD,IAAI,CAAC,8BAA8B,CAAC,GAAG,CAAC,cAAc,EAAE,OAAO,CAAC,CAAC;QACjE,IAAI,CAAC,aAAa,GAAG,IAAI,CAAC;IAC3B,CAAC;CACD;AAtVD,gDAsVC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { assert } from \"@fluidframework/core-utils/internal\";\nimport type { IIdCompressor } from \"@fluidframework/id-compressor\";\n\nimport {\n\ttype CodecWriteOptions,\n\tFluidClientVersion,\n\tFormatValidatorNoOp,\n\ttype IJsonCodec,\n} from \"../../codec/index.js\";\nimport {\n\ttype IdAllocator,\n\ttype JsonCompatibleReadOnly,\n\ttype NestedMap,\n\tbrand,\n\tdeleteFromNestedMap,\n\tforEachInNestedMap,\n\tidAllocatorFromMaxId,\n\tpopulateNestedMap,\n\tsetInNestedMap,\n\ttryGetFromNestedMap,\n} from \"../../util/index.js\";\nimport type { RevisionTag, RevisionTagCodec } from \"../rebase/index.js\";\nimport type { FieldKey } from \"../schema-stored/index.js\";\n\nimport type * as Delta from \"./delta.js\";\nimport type {\n\tDetachedField,\n\tDetachedFieldSummaryData,\n\tForestRootId,\n\tMajor,\n\tMinor,\n} from \"./detachedFieldIndexTypes.js\";\nimport { makeDetachedFieldIndexCodec } from \"./detachedFieldIndexCodecs.js\";\n\n/**\n * The tree index records detached field IDs and associates them with a change atom ID.\n */\nexport class DetachedFieldIndex {\n\t/**\n\t * A mapping from detached node ids to detached fields.\n\t */\n\tprivate detachedNodeToField: NestedMap<Major, Minor, DetachedField> = new Map();\n\t/**\n\t * A map from revisions to all detached fields for which the revision is the latest relevant revision.\n\t * See {@link DetachedField.latestRelevantRevision}.\n\t *\n\t * @remarks\n\t * undefined revisions are tolerated but any roots not associated with a revision must be disposed manually\n\t */\n\tprivate latestRelevantRevisionToFields: NestedMap<\n\t\tRevisionTag | undefined,\n\t\tForestRootId,\n\t\tDelta.DetachedNodeId\n\t> = new Map();\n\n\tprivate readonly codec: IJsonCodec<DetachedFieldSummaryData>;\n\tprivate readonly options: CodecWriteOptions;\n\n\t/**\n\t * The process for loading `DetachedFieldIndex` data from a summary is split into two steps:\n\t * 1. Call {@link loadData}\n\t * 2. Call {@link setRevisionsForLoadedData}\n\t *\n\t * This flag is only set to `false` after calling `loadData` and is set back to `true` after calling `setRevisionsForLoadedData`.\n\t * This helps ensure that `setRevisionsForLoadedData` is only called after `loadData` and only called once.\n\t */\n\tprivate isFullyLoaded = true;\n\n\t/**\n\t * @param name - A name for the index, used as a prefix for the generated field keys.\n\t * @param rootIdAllocator - An ID allocator used to generate unique field keys.\n\t */\n\tpublic constructor(\n\t\tprivate readonly name: string,\n\t\tprivate rootIdAllocator: IdAllocator<ForestRootId>,\n\t\tprivate readonly revisionTagCodec: RevisionTagCodec,\n\t\tprivate readonly idCompressor: IIdCompressor,\n\t\toptions?: CodecWriteOptions,\n\t) {\n\t\tthis.options = options ?? {\n\t\t\tjsonValidator: FormatValidatorNoOp,\n\t\t\tminVersionForCollab: FluidClientVersion.v2_0,\n\t\t};\n\t\tthis.codec = makeDetachedFieldIndexCodec(revisionTagCodec, this.options, idCompressor);\n\t}\n\n\tpublic clone(): DetachedFieldIndex {\n\t\tconst clone = new DetachedFieldIndex(\n\t\t\tthis.name,\n\t\t\tidAllocatorFromMaxId(this.rootIdAllocator.getMaxId()) as IdAllocator<ForestRootId>,\n\t\t\tthis.revisionTagCodec,\n\t\t\tthis.idCompressor,\n\t\t\tthis.options,\n\t\t);\n\t\tpopulateNestedMap(this.detachedNodeToField, clone.detachedNodeToField, true);\n\t\tpopulateNestedMap(\n\t\t\tthis.latestRelevantRevisionToFields,\n\t\t\tclone.latestRelevantRevisionToFields,\n\t\t\ttrue,\n\t\t);\n\t\treturn clone;\n\t}\n\n\tpublic *entries(): Generator<{\n\t\troot: ForestRootId;\n\t\tlatestRelevantRevision?: RevisionTag;\n\t\tid: Delta.DetachedNodeId;\n\t}> {\n\t\tfor (const [major, innerMap] of this.detachedNodeToField) {\n\t\t\tif (major !== undefined) {\n\t\t\t\tfor (const [minor, { root, latestRelevantRevision }] of innerMap) {\n\t\t\t\t\tyield latestRelevantRevision !== undefined\n\t\t\t\t\t\t? { id: { major, minor }, root, latestRelevantRevision }\n\t\t\t\t\t\t: { id: { major, minor }, root };\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tfor (const [minor, { root, latestRelevantRevision }] of innerMap) {\n\t\t\t\t\tyield latestRelevantRevision !== undefined\n\t\t\t\t\t\t? { id: { minor }, root, latestRelevantRevision }\n\t\t\t\t\t\t: { id: { minor }, root };\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\t/**\n\t * Removes all entries from the index.\n\t */\n\tpublic purge(): void {\n\t\tthis.detachedNodeToField.clear();\n\t\tthis.latestRelevantRevisionToFields.clear();\n\t}\n\n\tpublic updateMajor(current: Major, updated: Major): void {\n\t\t// Update latestRelevantRevision information corresponding to `current`\n\t\t{\n\t\t\tconst inner = this.latestRelevantRevisionToFields.get(current);\n\t\t\tif (inner !== undefined) {\n\t\t\t\tfor (const nodeId of inner.values()) {\n\t\t\t\t\tconst entry = tryGetFromNestedMap(\n\t\t\t\t\t\tthis.detachedNodeToField,\n\t\t\t\t\t\tnodeId.major,\n\t\t\t\t\t\tnodeId.minor,\n\t\t\t\t\t);\n\t\t\t\t\tassert(\n\t\t\t\t\t\tentry !== undefined,\n\t\t\t\t\t\t0x9b8 /* Inconsistent data: missing detached node entry */,\n\t\t\t\t\t);\n\t\t\t\t\tsetInNestedMap(this.detachedNodeToField, nodeId.major, nodeId.minor, {\n\t\t\t\t\t\t...entry,\n\t\t\t\t\t\tlatestRelevantRevision: updated,\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t\tthis.latestRelevantRevisionToFields.delete(current);\n\n\t\t\t\tconst updatedInner = this.latestRelevantRevisionToFields.get(updated);\n\t\t\t\tif (updatedInner !== undefined) {\n\t\t\t\t\tfor (const [root, nodeId] of inner) {\n\t\t\t\t\t\tupdatedInner.set(root, nodeId);\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\tthis.latestRelevantRevisionToFields.set(updated, inner);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\t// Update the major keys corresponding to `current`\n\t\t{\n\t\t\tconst innerCurrent = this.detachedNodeToField.get(current);\n\t\t\tif (innerCurrent !== undefined) {\n\t\t\t\tthis.detachedNodeToField.delete(current);\n\t\t\t\tconst innerUpdated = this.detachedNodeToField.get(updated);\n\t\t\t\tif (innerUpdated === undefined) {\n\t\t\t\t\tthis.detachedNodeToField.set(updated, innerCurrent);\n\t\t\t\t} else {\n\t\t\t\t\tfor (const [minor, entry] of innerCurrent) {\n\t\t\t\t\t\tassert(\n\t\t\t\t\t\t\tinnerUpdated.get(minor) === undefined,\n\t\t\t\t\t\t\t0x7a9 /* Collision during index update */,\n\t\t\t\t\t\t);\n\t\t\t\t\t\tinnerUpdated.set(minor, entry);\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tfor (const [minor, entry] of innerCurrent) {\n\t\t\t\t\tconst entryInLatest = this.latestRelevantRevisionToFields.get(\n\t\t\t\t\t\tentry.latestRelevantRevision,\n\t\t\t\t\t);\n\t\t\t\t\tassert(\n\t\t\t\t\t\tentryInLatest !== undefined,\n\t\t\t\t\t\t0x9b9 /* Inconsistent data: missing node entry in latestRelevantRevision */,\n\t\t\t\t\t);\n\t\t\t\t\tentryInLatest.set(entry.root, { major: updated, minor });\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\t/**\n\t * Returns a field key for the given ID.\n\t * This does not save the field key on the index. To do so, call {@link createEntry}.\n\t */\n\tpublic toFieldKey(id: ForestRootId): FieldKey {\n\t\treturn brand(`${this.name}-${id}`);\n\t}\n\n\t/**\n\t * Returns the FieldKey associated with the given id.\n\t * Returns undefined if no such id is known to the index.\n\t */\n\tpublic tryGetEntry(id: Delta.DetachedNodeId): ForestRootId | undefined {\n\t\treturn tryGetFromNestedMap(this.detachedNodeToField, id.major, id.minor)?.root;\n\t}\n\n\t/**\n\t * Returns the FieldKey associated with the given id.\n\t * Fails if no such id is known to the index.\n\t */\n\tpublic getEntry(id: Delta.DetachedNodeId): ForestRootId {\n\t\tconst key = this.tryGetEntry(id);\n\t\tassert(key !== undefined, 0x7aa /* Unknown removed node ID */);\n\t\treturn key;\n\t}\n\n\t/**\n\t * Returns the detached root IDs for all the trees that were detached or last modified by the given revision.\n\t */\n\tpublic *getRootsLastTouchedByRevision(revision: RevisionTag): Iterable<ForestRootId> {\n\t\tconst roots = this.latestRelevantRevisionToFields.get(revision);\n\t\tif (roots !== undefined) {\n\t\t\tyield* roots.keys();\n\t\t}\n\t}\n\n\t/**\n\t * Removes the detached roots for all the trees that were detached or last modified by the given revision.\n\t */\n\tpublic deleteRootsLastTouchedByRevision(revision: RevisionTag): void {\n\t\tconst entries = this.latestRelevantRevisionToFields.get(revision);\n\t\tif (entries === undefined) {\n\t\t\treturn;\n\t\t}\n\n\t\tthis.latestRelevantRevisionToFields.delete(revision);\n\t\tfor (const detachedNodeId of entries.values()) {\n\t\t\tconst found = deleteFromNestedMap(\n\t\t\t\tthis.detachedNodeToField,\n\t\t\t\tdetachedNodeId.major,\n\t\t\t\tdetachedNodeId.minor,\n\t\t\t);\n\t\t\tassert(found, 0x9ba /* Unable to delete unknown entry */);\n\t\t}\n\t}\n\n\tpublic deleteEntry(nodeId: Delta.DetachedNodeId): void {\n\t\tconst entry = tryGetFromNestedMap(this.detachedNodeToField, nodeId.major, nodeId.minor);\n\t\tassert(entry !== undefined, 0x9bb /* Unable to delete unknown entry */);\n\t\tdeleteFromNestedMap(this.detachedNodeToField, nodeId.major, nodeId.minor);\n\t\tdeleteFromNestedMap(\n\t\t\tthis.latestRelevantRevisionToFields,\n\t\t\tentry.latestRelevantRevision,\n\t\t\tentry.root,\n\t\t);\n\t}\n\n\t/**\n\t * Associates the DetachedNodeId with a field key and creates an entry for it in the index.\n\t * @param nodeId - The ID of the detached node.\n\t * @param revision - The revision that last detached the root.\n\t * See {@link DetachedField.latestRelevantRevision} for details.\n\t * @param count - The number of entries to create. These entries will have consecutive minor IDs.\n\t * @returns The atomic ID that the `DetachedFieldIndex` uses to uniquely identify the first root.\n\t */\n\tpublic createEntry(\n\t\tnodeId?: Delta.DetachedNodeId,\n\t\trevision?: RevisionTag,\n\t\tcount: number = 1,\n\t): ForestRootId {\n\t\tconst root = this.rootIdAllocator.allocate(count);\n\t\tif (nodeId !== undefined) {\n\t\t\tfor (let i = 0; i < count; i++) {\n\t\t\t\tassert(\n\t\t\t\t\ttryGetFromNestedMap(this.detachedNodeToField, nodeId.major, nodeId.minor + i) ===\n\t\t\t\t\t\tundefined,\n\t\t\t\t\t0x7ce /* Detached node ID already exists in index */,\n\t\t\t\t);\n\t\t\t\tsetInNestedMap(this.detachedNodeToField, nodeId.major, nodeId.minor + i, {\n\t\t\t\t\troot: brand<ForestRootId>(root + i),\n\t\t\t\t\tlatestRelevantRevision: revision,\n\t\t\t\t});\n\t\t\t\tsetInNestedMap(this.latestRelevantRevisionToFields, revision, root + i, {\n\t\t\t\t\tmajor: nodeId.major,\n\t\t\t\t\tminor: nodeId.minor + i,\n\t\t\t\t});\n\t\t\t}\n\t\t}\n\t\treturn root;\n\t}\n\n\t/**\n\t * Updates the latest revision that is relevant to the provided root\n\t */\n\tpublic updateLatestRevision(\n\t\tid: Delta.DetachedNodeId,\n\t\trevision: RevisionTag | undefined,\n\t): void {\n\t\tconst fieldEntry = tryGetFromNestedMap(this.detachedNodeToField, id.major, id.minor);\n\t\tassert(\n\t\t\tfieldEntry !== undefined,\n\t\t\t0x9bc /* detached node id does not exist in the detached field index */,\n\t\t);\n\t\tconst { root, latestRelevantRevision: previousRevision } = fieldEntry;\n\n\t\t// remove this root from the set of roots for the previous latest revision\n\t\tdeleteFromNestedMap(this.latestRelevantRevisionToFields, previousRevision, root);\n\n\t\t// add this root to the set of roots for the new latest revision\n\t\tsetInNestedMap(this.latestRelevantRevisionToFields, revision, root, id);\n\t\tsetInNestedMap(this.detachedNodeToField, id.major, id.minor, {\n\t\t\troot,\n\t\t\tlatestRelevantRevision: revision,\n\t\t});\n\t}\n\n\tpublic encode(): JsonCompatibleReadOnly {\n\t\treturn this.codec.encode({\n\t\t\tdata: this.detachedNodeToField,\n\t\t\tmaxId: this.rootIdAllocator.getMaxId(),\n\t\t});\n\t}\n\n\t/**\n\t * Loads the tree index from the given string, this overrides any existing data.\n\t */\n\tpublic loadData(data: JsonCompatibleReadOnly): void {\n\t\tconst detachedFieldIndex: DetachedFieldSummaryData = this.codec.decode(data);\n\n\t\tthis.rootIdAllocator = idAllocatorFromMaxId(\n\t\t\tdetachedFieldIndex.maxId,\n\t\t) as IdAllocator<ForestRootId>;\n\n\t\tthis.detachedNodeToField = new Map();\n\t\tthis.latestRelevantRevisionToFields = new Map();\n\t\tthis.isFullyLoaded = false;\n\t\tconst rootMap = new Map<ForestRootId, Delta.DetachedNodeId>();\n\t\tforEachInNestedMap(detachedFieldIndex.data, ({ root }, major, minor) => {\n\t\t\tsetInNestedMap(this.detachedNodeToField, major, minor, { root });\n\t\t\trootMap.set(root, { major, minor });\n\t\t});\n\n\t\tthis.latestRelevantRevisionToFields.set(undefined, rootMap);\n\t}\n\n\t/**\n\t * Sets the latest relevant revision for any roots that have an undefined latest relevant revision.\n\t * This occurs when the detached field index is loaded from a summary and can only be called once after\n\t * the summary has been loaded.\n\t */\n\tpublic setRevisionsForLoadedData(latestRevision: RevisionTag): void {\n\t\tassert(\n\t\t\t!this.isFullyLoaded,\n\t\t\t0x9bd /* revisions should only be set once using this function after loading data from a summary */,\n\t\t);\n\n\t\tconst newDetachedNodeToField: NestedMap<Major, Minor, DetachedField> = new Map();\n\t\tconst rootMap = new Map();\n\t\tforEachInNestedMap(this.detachedNodeToField, ({ root }, major, minor) => {\n\t\t\tsetInNestedMap(newDetachedNodeToField, major, minor, {\n\t\t\t\troot,\n\t\t\t\tlatestRelevantRevision: latestRevision,\n\t\t\t});\n\t\t\trootMap.set(root, { major, minor });\n\t\t});\n\n\t\tthis.detachedNodeToField = newDetachedNodeToField;\n\t\tthis.latestRelevantRevisionToFields.delete(undefined);\n\t\tthis.latestRelevantRevisionToFields.set(latestRevision, rootMap);\n\t\tthis.isFullyLoaded = true;\n\t}\n}\n"]}
|
|
1
|
+
{"version":3,"file":"detachedFieldIndex.js","sourceRoot":"","sources":["../../../src/core/tree/detachedFieldIndex.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,kEAA6D;AAG7D,mDAK8B;AAC9B,kDAW6B;AAY7B,+EAA4E;AAoC5E;;GAEG;AACH,MAAa,kBAAkB;IA+B9B;;;OAGG;IACH,YACkB,IAAY,EACrB,eAA0C,EACjC,gBAAkC,EAClC,YAA2B,EAC5C,OAA2B;QAJV,SAAI,GAAJ,IAAI,CAAQ;QACrB,oBAAe,GAAf,eAAe,CAA2B;QACjC,qBAAgB,GAAhB,gBAAgB,CAAkB;QAClC,iBAAY,GAAZ,YAAY,CAAe;QAtC7C;;WAEG;QACK,wBAAmB,GAA2C,IAAI,GAAG,EAAE,CAAC;Q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ACtE,IAAA,yBAAc,EAAC,IAAI,CAAC,mBAAmB,EAAE,KAAK,EAAE,KAAK,EAAE,EAAE,IAAI,EAAE,CAAC,CAAC;YACjE,OAAO,CAAC,GAAG,CAAC,IAAI,EAAE,EAAE,KAAK,EAAE,KAAK,EAAE,CAAC,CAAC;QACrC,CAAC,CAAC,CAAC;QAEH,IAAI,CAAC,8BAA8B,CAAC,GAAG,CAAC,SAAS,EAAE,OAAO,CAAC,CAAC;IAC7D,CAAC;IAED;;;;OAIG;IACI,yBAAyB,CAAC,cAA2B;QAC3D,IAAA,iBAAM,EACL,CAAC,IAAI,CAAC,aAAa,EACnB,KAAK,CAAC,6FAA6F,CACnG,CAAC;QAEF,MAAM,sBAAsB,GAA2C,IAAI,GAAG,EAAE,CAAC;QACjF,MAAM,OAAO,GAAG,IAAI,GAAG,EAAE,CAAC;QAC1B,IAAA,6BAAkB,EAAC,IAAI,CAAC,mBAAmB,EAAE,CAAC,EAAE,IAAI,EAAE,EAAE,KAAK,EAAE,KAAK,EAAE,EAAE;YACvE,IAAA,yBAAc,EAAC,sBAAsB,EAAE,KAAK,EAAE,KAAK,EAAE;gBACpD,IAAI;gBACJ,sBAAsB,EAAE,cAAc;aACtC,CAAC,CAAC;YACH,OAAO,CAAC,GAAG,CAAC,IAAI,EAAE,EAAE,KAAK,EAAE,KAAK,EAAE,CAAC,CAAC;QACrC,CAAC,CAAC,CAAC;QAEH,IAAI,CAAC,mBAAmB,GAAG,sBAAsB,CAAC;QAClD,IAAI,CAAC,8BAA8B,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC;QACtD,IAAI,CAAC,8BAA8B,CAAC,GAAG,CAAC,cAAc,EAAE,OAAO,CAAC,CAAC;QACjE,IAAI,CAAC,aAAa,GAAG,IAAI,CAAC;IAC3B,CAAC;CACD;AA7VD,gDA6VC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { assert } from \"@fluidframework/core-utils/internal\";\nimport type { IIdCompressor } from \"@fluidframework/id-compressor\";\n\nimport {\n\ttype CodecWriteOptions,\n\tFluidClientVersion,\n\tFormatValidatorNoOp,\n\ttype IJsonCodec,\n} from \"../../codec/index.js\";\nimport {\n\ttype IdAllocator,\n\ttype JsonCompatibleReadOnly,\n\ttype NestedMap,\n\tbrand,\n\tdeleteFromNestedMap,\n\tforEachInNestedMap,\n\tidAllocatorFromMaxId,\n\tpopulateNestedMap,\n\tsetInNestedMap,\n\ttryGetFromNestedMap,\n} from \"../../util/index.js\";\nimport type { RevisionTag, RevisionTagCodec } from \"../rebase/index.js\";\nimport type { FieldKey } from \"../schema-stored/index.js\";\n\nimport type * as Delta from \"./delta.js\";\nimport type {\n\tDetachedField,\n\tDetachedFieldSummaryData,\n\tForestRootId,\n\tMajor,\n\tMinor,\n} from \"./detachedFieldIndexTypes.js\";\nimport { makeDetachedFieldIndexCodec } from \"./detachedFieldIndexCodecs.js\";\n\n/**\n * Readonly interface for {@link DetachedFieldIndex}.\n */\nexport interface ReadOnlyDetachedFieldIndex {\n\t/**\n\t * Creates a deep clone of this `DetachedFieldIndex`.\n\t */\n\tclone(): DetachedFieldIndex;\n\n\t/**\n\t * Returns a field key for the given ID.\n\t * This does not save the field key on the index. To do so, call {@link createEntry}.\n\t */\n\ttoFieldKey(id: ForestRootId): FieldKey;\n\n\t/**\n\t * Returns the `ForestRootId` associated with the given id.\n\t * Returns undefined if no such id is known to the index.\n\t */\n\ttryGetEntry(id: Delta.DetachedNodeId): ForestRootId | undefined;\n\n\t/**\n\t * Returns the `ForestRootId` associated with the given id.\n\t * Fails if no such id is known to the index.\n\t */\n\tgetEntry(id: Delta.DetachedNodeId): ForestRootId;\n}\n\n/**\n * Restores the originating DetachedFieldIndex to the state it was in when the checkpoint was created.\n * Can be invoked multiple times.\n */\nexport type DetachedFieldIndexCheckpoint = () => void;\n\n/**\n * The tree index records detached field IDs and associates them with a change atom ID.\n */\nexport class DetachedFieldIndex implements ReadOnlyDetachedFieldIndex {\n\t/**\n\t * A mapping from detached node ids to detached fields.\n\t */\n\tprivate detachedNodeToField: NestedMap<Major, Minor, DetachedField> = new Map();\n\t/**\n\t * A map from revisions to all detached fields for which the revision is the latest relevant revision.\n\t * See {@link DetachedField.latestRelevantRevision}.\n\t *\n\t * @remarks\n\t * undefined revisions are tolerated but any roots not associated with a revision must be disposed manually\n\t */\n\tprivate latestRelevantRevisionToFields: NestedMap<\n\t\tRevisionTag | undefined,\n\t\tForestRootId,\n\t\tDelta.DetachedNodeId\n\t> = new Map();\n\n\tprivate readonly codec: IJsonCodec<DetachedFieldSummaryData>;\n\tprivate readonly options: CodecWriteOptions;\n\n\t/**\n\t * The process for loading `DetachedFieldIndex` data from a summary is split into two steps:\n\t * 1. Call {@link loadData}\n\t * 2. Call {@link setRevisionsForLoadedData}\n\t *\n\t * This flag is only set to `false` after calling `loadData` and is set back to `true` after calling `setRevisionsForLoadedData`.\n\t * This helps ensure that `setRevisionsForLoadedData` is only called after `loadData` and only called once.\n\t */\n\tprivate isFullyLoaded = true;\n\n\t/**\n\t * @param name - A name for the index, used as a prefix for the generated field keys.\n\t * @param rootIdAllocator - An ID allocator used to generate unique field keys.\n\t */\n\tpublic constructor(\n\t\tprivate readonly name: string,\n\t\tprivate rootIdAllocator: IdAllocator<ForestRootId>,\n\t\tprivate readonly revisionTagCodec: RevisionTagCodec,\n\t\tprivate readonly idCompressor: IIdCompressor,\n\t\toptions?: CodecWriteOptions,\n\t) {\n\t\tthis.options = options ?? {\n\t\t\tjsonValidator: FormatValidatorNoOp,\n\t\t\tminVersionForCollab: FluidClientVersion.v2_0,\n\t\t};\n\t\tthis.codec = makeDetachedFieldIndexCodec(revisionTagCodec, this.options, idCompressor);\n\t}\n\n\tpublic clone(): DetachedFieldIndex {\n\t\tconst clone = new DetachedFieldIndex(\n\t\t\tthis.name,\n\t\t\tidAllocatorFromMaxId(this.rootIdAllocator.getMaxId()) as IdAllocator<ForestRootId>,\n\t\t\tthis.revisionTagCodec,\n\t\t\tthis.idCompressor,\n\t\t\tthis.options,\n\t\t);\n\t\tpopulateNestedMap(this.detachedNodeToField, clone.detachedNodeToField, true);\n\t\tpopulateNestedMap(\n\t\t\tthis.latestRelevantRevisionToFields,\n\t\t\tclone.latestRelevantRevisionToFields,\n\t\t\ttrue,\n\t\t);\n\t\treturn clone;\n\t}\n\n\t/**\n\t * Creates a restorable checkpoint of the current state of the DetachedFieldIndex.\n\t */\n\tpublic createCheckpoint(): DetachedFieldIndexCheckpoint {\n\t\tconst clone = this.clone();\n\t\treturn () => {\n\t\t\tthis.purge();\n\t\t\tpopulateNestedMap(clone.detachedNodeToField, this.detachedNodeToField, true);\n\t\t\tpopulateNestedMap(\n\t\t\t\tclone.latestRelevantRevisionToFields,\n\t\t\t\tthis.latestRelevantRevisionToFields,\n\t\t\t\ttrue,\n\t\t\t);\n\t\t\tthis.rootIdAllocator = idAllocatorFromMaxId(\n\t\t\t\tclone.rootIdAllocator.getMaxId(),\n\t\t\t) as IdAllocator<ForestRootId>;\n\t\t};\n\t}\n\n\tpublic *entries(): Generator<{\n\t\troot: ForestRootId;\n\t\tlatestRelevantRevision?: RevisionTag;\n\t\tid: Delta.DetachedNodeId;\n\t}> {\n\t\tfor (const [major, innerMap] of this.detachedNodeToField) {\n\t\t\tif (major !== undefined) {\n\t\t\t\tfor (const [minor, { root, latestRelevantRevision }] of innerMap) {\n\t\t\t\t\tyield latestRelevantRevision !== undefined\n\t\t\t\t\t\t? { id: { major, minor }, root, latestRelevantRevision }\n\t\t\t\t\t\t: { id: { major, minor }, root };\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tfor (const [minor, { root, latestRelevantRevision }] of innerMap) {\n\t\t\t\t\tyield latestRelevantRevision !== undefined\n\t\t\t\t\t\t? { id: { minor }, root, latestRelevantRevision }\n\t\t\t\t\t\t: { id: { minor }, root };\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\t/**\n\t * Removes all entries from the index.\n\t */\n\tpublic purge(): void {\n\t\tthis.detachedNodeToField.clear();\n\t\tthis.latestRelevantRevisionToFields.clear();\n\t}\n\n\tpublic updateMajor(current: Major, updated: Major): void {\n\t\t// Update latestRelevantRevision information corresponding to `current`\n\t\t{\n\t\t\tconst inner = this.latestRelevantRevisionToFields.get(current);\n\t\t\tif (inner !== undefined) {\n\t\t\t\tfor (const nodeId of inner.values()) {\n\t\t\t\t\tconst entry = tryGetFromNestedMap(\n\t\t\t\t\t\tthis.detachedNodeToField,\n\t\t\t\t\t\tnodeId.major,\n\t\t\t\t\t\tnodeId.minor,\n\t\t\t\t\t);\n\t\t\t\t\tassert(\n\t\t\t\t\t\tentry !== undefined,\n\t\t\t\t\t\t0x9b8 /* Inconsistent data: missing detached node entry */,\n\t\t\t\t\t);\n\t\t\t\t\tsetInNestedMap(this.detachedNodeToField, nodeId.major, nodeId.minor, {\n\t\t\t\t\t\t...entry,\n\t\t\t\t\t\tlatestRelevantRevision: updated,\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t\tthis.latestRelevantRevisionToFields.delete(current);\n\n\t\t\t\tconst updatedInner = this.latestRelevantRevisionToFields.get(updated);\n\t\t\t\tif (updatedInner !== undefined) {\n\t\t\t\t\tfor (const [root, nodeId] of inner) {\n\t\t\t\t\t\tupdatedInner.set(root, nodeId);\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\tthis.latestRelevantRevisionToFields.set(updated, inner);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\t// Update the major keys corresponding to `current`\n\t\t{\n\t\t\tconst innerCurrent = this.detachedNodeToField.get(current);\n\t\t\tif (innerCurrent !== undefined) {\n\t\t\t\tthis.detachedNodeToField.delete(current);\n\t\t\t\tconst innerUpdated = this.detachedNodeToField.get(updated);\n\t\t\t\tif (innerUpdated === undefined) {\n\t\t\t\t\tthis.detachedNodeToField.set(updated, innerCurrent);\n\t\t\t\t} else {\n\t\t\t\t\tfor (const [minor, entry] of innerCurrent) {\n\t\t\t\t\t\tassert(\n\t\t\t\t\t\t\tinnerUpdated.get(minor) === undefined,\n\t\t\t\t\t\t\t0x7a9 /* Collision during index update */,\n\t\t\t\t\t\t);\n\t\t\t\t\t\tinnerUpdated.set(minor, entry);\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tfor (const [minor, entry] of innerCurrent) {\n\t\t\t\t\tconst entryInLatest = this.latestRelevantRevisionToFields.get(\n\t\t\t\t\t\tentry.latestRelevantRevision,\n\t\t\t\t\t);\n\t\t\t\t\tassert(\n\t\t\t\t\t\tentryInLatest !== undefined,\n\t\t\t\t\t\t0x9b9 /* Inconsistent data: missing node entry in latestRelevantRevision */,\n\t\t\t\t\t);\n\t\t\t\t\tentryInLatest.set(entry.root, { major: updated, minor });\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\tpublic toFieldKey(id: ForestRootId): FieldKey {\n\t\treturn brand(`${this.name}-${id}`);\n\t}\n\n\tpublic tryGetEntry(id: Delta.DetachedNodeId): ForestRootId | undefined {\n\t\treturn tryGetFromNestedMap(this.detachedNodeToField, id.major, id.minor)?.root;\n\t}\n\n\tpublic getEntry(id: Delta.DetachedNodeId): ForestRootId {\n\t\tconst key = this.tryGetEntry(id);\n\t\tassert(key !== undefined, 0x7aa /* Unknown removed node ID */);\n\t\treturn key;\n\t}\n\n\t/**\n\t * Returns the detached root IDs for all the trees that were detached or last modified by the given revision.\n\t */\n\tpublic *getRootsLastTouchedByRevision(revision: RevisionTag): Iterable<ForestRootId> {\n\t\tconst roots = this.latestRelevantRevisionToFields.get(revision);\n\t\tif (roots !== undefined) {\n\t\t\tyield* roots.keys();\n\t\t}\n\t}\n\n\t/**\n\t * Removes the detached roots for all the trees that were detached or last modified by the given revision.\n\t */\n\tpublic deleteRootsLastTouchedByRevision(revision: RevisionTag): void {\n\t\tconst entries = this.latestRelevantRevisionToFields.get(revision);\n\t\tif (entries === undefined) {\n\t\t\treturn;\n\t\t}\n\n\t\tthis.latestRelevantRevisionToFields.delete(revision);\n\t\tfor (const detachedNodeId of entries.values()) {\n\t\t\tconst found = deleteFromNestedMap(\n\t\t\t\tthis.detachedNodeToField,\n\t\t\t\tdetachedNodeId.major,\n\t\t\t\tdetachedNodeId.minor,\n\t\t\t);\n\t\t\tassert(found, 0x9ba /* Unable to delete unknown entry */);\n\t\t}\n\t}\n\n\tpublic deleteEntry(nodeId: Delta.DetachedNodeId): void {\n\t\tconst entry = tryGetFromNestedMap(this.detachedNodeToField, nodeId.major, nodeId.minor);\n\t\tassert(entry !== undefined, 0x9bb /* Unable to delete unknown entry */);\n\t\tdeleteFromNestedMap(this.detachedNodeToField, nodeId.major, nodeId.minor);\n\t\tdeleteFromNestedMap(\n\t\t\tthis.latestRelevantRevisionToFields,\n\t\t\tentry.latestRelevantRevision,\n\t\t\tentry.root,\n\t\t);\n\t}\n\n\t/**\n\t * Associates the DetachedNodeId with a field key and creates an entry for it in the index.\n\t * @param nodeId - The ID of the detached node.\n\t * @param revision - The revision that last detached the root.\n\t * See {@link DetachedField.latestRelevantRevision} for details.\n\t * @param count - The number of entries to create. These entries will have consecutive minor IDs.\n\t * @returns The atomic ID that the `DetachedFieldIndex` uses to uniquely identify the first root.\n\t */\n\tpublic createEntry(\n\t\tnodeId?: Delta.DetachedNodeId,\n\t\trevision?: RevisionTag,\n\t\tcount: number = 1,\n\t): ForestRootId {\n\t\tconst root = this.rootIdAllocator.allocate(count);\n\t\tif (nodeId !== undefined) {\n\t\t\tfor (let i = 0; i < count; i++) {\n\t\t\t\tassert(\n\t\t\t\t\ttryGetFromNestedMap(this.detachedNodeToField, nodeId.major, nodeId.minor + i) ===\n\t\t\t\t\t\tundefined,\n\t\t\t\t\t0x7ce /* Detached node ID already exists in index */,\n\t\t\t\t);\n\t\t\t\tsetInNestedMap(this.detachedNodeToField, nodeId.major, nodeId.minor + i, {\n\t\t\t\t\troot: brand<ForestRootId>(root + i),\n\t\t\t\t\tlatestRelevantRevision: revision,\n\t\t\t\t});\n\t\t\t\tsetInNestedMap(this.latestRelevantRevisionToFields, revision, root + i, {\n\t\t\t\t\tmajor: nodeId.major,\n\t\t\t\t\tminor: nodeId.minor + i,\n\t\t\t\t});\n\t\t\t}\n\t\t}\n\t\treturn root;\n\t}\n\n\t/**\n\t * Updates the latest revision that is relevant to the provided root\n\t */\n\tpublic updateLatestRevision(\n\t\tid: Delta.DetachedNodeId,\n\t\trevision: RevisionTag | undefined,\n\t): void {\n\t\tconst fieldEntry = tryGetFromNestedMap(this.detachedNodeToField, id.major, id.minor);\n\t\tassert(\n\t\t\tfieldEntry !== undefined,\n\t\t\t0x9bc /* detached node id does not exist in the detached field index */,\n\t\t);\n\t\tconst { root, latestRelevantRevision: previousRevision } = fieldEntry;\n\n\t\t// remove this root from the set of roots for the previous latest revision\n\t\tdeleteFromNestedMap(this.latestRelevantRevisionToFields, previousRevision, root);\n\n\t\t// add this root to the set of roots for the new latest revision\n\t\tsetInNestedMap(this.latestRelevantRevisionToFields, revision, root, id);\n\t\tsetInNestedMap(this.detachedNodeToField, id.major, id.minor, {\n\t\t\troot,\n\t\t\tlatestRelevantRevision: revision,\n\t\t});\n\t}\n\n\tpublic encode(): JsonCompatibleReadOnly {\n\t\treturn this.codec.encode({\n\t\t\tdata: this.detachedNodeToField,\n\t\t\tmaxId: this.rootIdAllocator.getMaxId(),\n\t\t});\n\t}\n\n\t/**\n\t * Loads the tree index from the given string, this overrides any existing data.\n\t */\n\tpublic loadData(data: JsonCompatibleReadOnly): void {\n\t\tconst detachedFieldIndex: DetachedFieldSummaryData = this.codec.decode(data);\n\n\t\tthis.rootIdAllocator = idAllocatorFromMaxId(\n\t\t\tdetachedFieldIndex.maxId,\n\t\t) as IdAllocator<ForestRootId>;\n\n\t\tthis.detachedNodeToField = new Map();\n\t\tthis.latestRelevantRevisionToFields = new Map();\n\t\tthis.isFullyLoaded = false;\n\t\tconst rootMap = new Map<ForestRootId, Delta.DetachedNodeId>();\n\t\tforEachInNestedMap(detachedFieldIndex.data, ({ root }, major, minor) => {\n\t\t\tsetInNestedMap(this.detachedNodeToField, major, minor, { root });\n\t\t\trootMap.set(root, { major, minor });\n\t\t});\n\n\t\tthis.latestRelevantRevisionToFields.set(undefined, rootMap);\n\t}\n\n\t/**\n\t * Sets the latest relevant revision for any roots that have an undefined latest relevant revision.\n\t * This occurs when the detached field index is loaded from a summary and can only be called once after\n\t * the summary has been loaded.\n\t */\n\tpublic setRevisionsForLoadedData(latestRevision: RevisionTag): void {\n\t\tassert(\n\t\t\t!this.isFullyLoaded,\n\t\t\t0x9bd /* revisions should only be set once using this function after loading data from a summary */,\n\t\t);\n\n\t\tconst newDetachedNodeToField: NestedMap<Major, Minor, DetachedField> = new Map();\n\t\tconst rootMap = new Map();\n\t\tforEachInNestedMap(this.detachedNodeToField, ({ root }, major, minor) => {\n\t\t\tsetInNestedMap(newDetachedNodeToField, major, minor, {\n\t\t\t\troot,\n\t\t\t\tlatestRelevantRevision: latestRevision,\n\t\t\t});\n\t\t\trootMap.set(root, { major, minor });\n\t\t});\n\n\t\tthis.detachedNodeToField = newDetachedNodeToField;\n\t\tthis.latestRelevantRevisionToFields.delete(undefined);\n\t\tthis.latestRelevantRevisionToFields.set(latestRevision, rootMap);\n\t\tthis.isFullyLoaded = true;\n\t}\n}\n"]}
|
|
@@ -3,16 +3,16 @@
|
|
|
3
3
|
* Licensed under the MIT License.
|
|
4
4
|
*/
|
|
5
5
|
import { type Static, type TSchema } from "@sinclair/typebox";
|
|
6
|
-
import { type
|
|
6
|
+
import { type Values } from "../../util/index.js";
|
|
7
7
|
import type { ForestRootId } from "./detachedFieldIndexTypes.js";
|
|
8
8
|
/**
|
|
9
9
|
* The format version for the detached field index.
|
|
10
10
|
*/
|
|
11
11
|
export declare const DetachedFieldIndexFormatVersion: {
|
|
12
|
-
readonly v1: 1
|
|
13
|
-
readonly v2: 2
|
|
12
|
+
readonly v1: import("../../util/brand.js").Brand<1, "DetachedFieldIndexFormatVersion">;
|
|
13
|
+
readonly v2: import("../../util/brand.js").Brand<2, "DetachedFieldIndexFormatVersion">;
|
|
14
14
|
};
|
|
15
|
-
export type DetachedFieldIndexFormatVersion =
|
|
15
|
+
export type DetachedFieldIndexFormatVersion = Values<typeof DetachedFieldIndexFormatVersion>;
|
|
16
16
|
/**
|
|
17
17
|
* The ID of a detached node. Is not globally unique on.
|
|
18
18
|
* A `RevisionTag` + `DetachId` pair is globally unique and eventually consistent across clients.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"detachedFieldIndexFormatCommon.d.ts","sourceRoot":"","sources":["../../../src/core/tree/detachedFieldIndexFormatCommon.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,KAAK,MAAM,EAAE,KAAK,OAAO,EAAQ,MAAM,mBAAmB,CAAC;AAEpE,OAAO,
|
|
1
|
+
{"version":3,"file":"detachedFieldIndexFormatCommon.d.ts","sourceRoot":"","sources":["../../../src/core/tree/detachedFieldIndexFormatCommon.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,KAAK,MAAM,EAAE,KAAK,OAAO,EAAQ,MAAM,mBAAmB,CAAC;AAEpE,OAAO,EAAiC,KAAK,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAEjF,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,8BAA8B,CAAC;AAEjE;;GAEG;AACH,eAAO,MAAM,+BAA+B;;;CAG1C,CAAC;AACH,MAAM,MAAM,+BAA+B,GAAG,MAAM,CAAC,OAAO,+BAA+B,CAAC,CAAC;AAE7F;;;GAGG;AACH,eAAO,MAAM,QAAQ,qCAAiC,CAAC;AAEvD;;;GAGG;AACH,eAAO,MAAM,kBAAkB,mDAG7B,CAAC;AAEH;;;;GAIG;AACH,eAAO,MAAM,SAAS,8HAKpB,CAAC;AACH,MAAM,MAAM,SAAS,GAAG,MAAM,CAAC,OAAO,SAAS,CAAC,CAAC;AAEjD,eAAO,MAAM,UAAU,kKAAwB,CAAC;AAChD,MAAM,MAAM,UAAU,GAAG,MAAM,CAAC,OAAO,UAAU,CAAC,CAAC;AAEnD;;GAEG;AAGH,eAAO,MAAM,uBAAuB,yCAA0C,MAAM,+XAMjF,CAAC;AACJ,MAAM,MAAM,uBAAuB,GAAG,MAAM,CAAC,UAAU,CAAC,OAAO,uBAAuB,CAAC,CAAC,CAAC;AAEzF,eAAO,MAAM,MAAM,mGAIR,QAAQ,gBACJ,kBAAkB;;;;EAW/B,CAAC;AAEH,MAAM,MAAM,MAAM,GAAG,MAAM,CAAC,UAAU,CAAC,OAAO,MAAM,CAAC,CAAC,CAAC"}
|
|
@@ -10,10 +10,10 @@ const index_js_1 = require("../../util/index.js");
|
|
|
10
10
|
/**
|
|
11
11
|
* The format version for the detached field index.
|
|
12
12
|
*/
|
|
13
|
-
exports.DetachedFieldIndexFormatVersion = {
|
|
13
|
+
exports.DetachedFieldIndexFormatVersion = (0, index_js_1.strictEnum)("DetachedFieldIndexFormatVersion", {
|
|
14
14
|
v1: 1,
|
|
15
15
|
v2: 2,
|
|
16
|
-
};
|
|
16
|
+
});
|
|
17
17
|
/**
|
|
18
18
|
* The ID of a detached node. Is not globally unique on.
|
|
19
19
|
* A `RevisionTag` + `DetachId` pair is globally unique and eventually consistent across clients.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"detachedFieldIndexFormatCommon.js","sourceRoot":"","sources":["../../../src/core/tree/detachedFieldIndexFormatCommon.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,+CAAoE;AAEpE,
|
|
1
|
+
{"version":3,"file":"detachedFieldIndexFormatCommon.js","sourceRoot":"","sources":["../../../src/core/tree/detachedFieldIndexFormatCommon.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,+CAAoE;AAEpE,kDAAiF;AAIjF;;GAEG;AACU,QAAA,+BAA+B,GAAG,IAAA,qBAAU,EAAC,iCAAiC,EAAE;IAC5F,EAAE,EAAE,CAAC;IACL,EAAE,EAAE,CAAC;CACL,CAAC,CAAC;AAGH;;;GAGG;AACU,QAAA,QAAQ,GAAG,cAAI,CAAC,MAAM,CAAC,EAAE,UAAU,EAAE,CAAC,EAAE,CAAC,CAAC;AAEvD;;;GAGG;AACU,QAAA,kBAAkB,GAAG,IAAA,4BAAiB,EAAe;IACjE,OAAO,EAAE,CAAC,CAAC;IACX,UAAU,EAAE,CAAC;CACb,CAAC,CAAC;AAEH;;;;GAIG;AACU,QAAA,SAAS,GAAG,cAAI,CAAC,KAAK,CAAC;IACnC,iCAAiC;IACjC,gBAAQ;IACR,6BAA6B;IAC7B,0BAAkB;CAClB,CAAC,CAAC;AAGU,QAAA,UAAU,GAAG,cAAI,CAAC,KAAK,CAAC,iBAAS,CAAC,CAAC;AAGhD;;GAEG;AACH,wCAAwC;AACxC,4EAA4E;AACrE,MAAM,uBAAuB,GAAG,CAAyB,YAAoB,EAAE,EAAE,CACvF,cAAI,CAAC,KAAK,CAAC;IACV,yEAAyE;IACzE,cAAI,CAAC,KAAK,CAAC,CAAC,YAAY,EAAE,kBAAU,CAAC,CAAC;IACtC,mEAAmE;IACnE,cAAI,CAAC,KAAK,CAAC,CAAC,YAAY,EAAE,gBAAQ,EAAE,0BAAkB,CAAC,CAAC;CACxD,CAAC,CAAC;AANS,QAAA,uBAAuB,2BAMhC;AAGG,MAAM,MAAM,GAAG,CAIrB,QAAkB,EAClB,YAAgC,EAG/B,EAAE,CACH,cAAI,CAAC,MAAM,CACV;IACC,OAAO,EAAE,cAAI,CAAC,OAAO,CAAC,QAAQ,CAAC;IAC/B,IAAI,EAAE,cAAI,CAAC,KAAK,CAAC,IAAA,+BAAuB,EAAC,YAAY,CAAC,CAAC;IACvD,KAAK,EAAE,0BAAkB;CACzB,EACD,EAAE,oBAAoB,EAAE,KAAK,EAAE,CAC/B,CAAC;AAhBU,QAAA,MAAM,UAgBhB","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { type Static, type TSchema, Type } from \"@sinclair/typebox\";\n\nimport { brandedNumberType, strictEnum, type Values } from \"../../util/index.js\";\n\nimport type { ForestRootId } from \"./detachedFieldIndexTypes.js\";\n\n/**\n * The format version for the detached field index.\n */\nexport const DetachedFieldIndexFormatVersion = strictEnum(\"DetachedFieldIndexFormatVersion\", {\n\tv1: 1,\n\tv2: 2,\n});\nexport type DetachedFieldIndexFormatVersion = Values<typeof DetachedFieldIndexFormatVersion>;\n\n/**\n * The ID of a detached node. Is not globally unique on.\n * A `RevisionTag` + `DetachId` pair is globally unique and eventually consistent across clients.\n */\nexport const DetachId = Type.Number({ multipleOf: 1 });\n\n/**\n * The ID of a root node in the forest associated with the owning checkout. Is unique for that forest.\n * Is not consistent across clients.\n */\nexport const ForestRootIdSchema = brandedNumberType<ForestRootId>({\n\tminimum: -1,\n\tmultipleOf: 1,\n});\n\n/**\n * A mapping from a range of the detached node IDs the corresponding range root IDs.\n * The detached node IDs need to be qualified with a revision (stored in the containing `EncodedRootsForRevision`).\n * Note: the length of the range (currently always 1) can be looked up in the forest.\n */\nexport const RootRange = Type.Tuple([\n\t// ID for the first detached node\n\tDetachId,\n\t// ID for the first root node\n\tForestRootIdSchema,\n]);\nexport type RootRange = Static<typeof RootRange>;\n\nexport const RootRanges = Type.Array(RootRange);\nexport type RootRanges = Static<typeof RootRanges>;\n\n/**\n * For all the roots detached in a revision, represents a mapping from the detached node ID to corresponding root ID.\n */\n// Return type is intentionally derived.\n// eslint-disable-next-line @typescript-eslint/explicit-function-return-type\nexport const EncodedRootsForRevision = <Schema extends TSchema>(tRevisionTag: Schema) =>\n\tType.Union([\n\t\t// Used to represent a revision in which more than one node were detached\n\t\tType.Tuple([tRevisionTag, RootRanges]),\n\t\t// Used to represent a revision in which a single node was detached\n\t\tType.Tuple([tRevisionTag, DetachId, ForestRootIdSchema]),\n\t]);\nexport type EncodedRootsForRevision = Static<ReturnType<typeof EncodedRootsForRevision>>;\n\nexport const Format = <\n\tTVersion extends DetachedFieldIndexFormatVersion,\n\tTRevisionTagSchema extends TSchema,\n>(\n\ttVersion: TVersion,\n\ttRevisionTag: TRevisionTagSchema,\n\t// Return type is intentionally derived.\n\t// eslint-disable-next-line @typescript-eslint/explicit-function-return-type\n) =>\n\tType.Object(\n\t\t{\n\t\t\tversion: Type.Literal(tVersion),\n\t\t\tdata: Type.Array(EncodedRootsForRevision(tRevisionTag)),\n\t\t\tmaxId: ForestRootIdSchema,\n\t\t},\n\t\t{ additionalProperties: false },\n\t);\n\nexport type Format = Static<ReturnType<typeof Format>>;\n"]}
|
|
@@ -15,8 +15,9 @@ export { type AnnouncedVisitor, announceDelta, applyDelta, createAnnouncedVisito
|
|
|
15
15
|
export { SparseNode, getDescendant } from "./sparseTree.js";
|
|
16
16
|
export { deltaForRootInitialization, makeDetachedNodeId, offsetDetachId, emptyDelta, } from "./deltaUtil.js";
|
|
17
17
|
export { type TreeChunk, dummyRoot, cursorChunk, tryGetChunk, type ChunkedCursor, } from "./chunk.js";
|
|
18
|
-
export { DetachedFieldIndex } from "./detachedFieldIndex.js";
|
|
18
|
+
export { DetachedFieldIndex, type DetachedFieldIndexCheckpoint, type ReadOnlyDetachedFieldIndex, } from "./detachedFieldIndex.js";
|
|
19
19
|
export { getCodecTreeForDetachedFieldIndexFormat } from "./detachedFieldIndexCodecs.js";
|
|
20
|
-
export {
|
|
20
|
+
export { DetachedFieldIndexFormatVersion } from "./detachedFieldIndexFormatCommon.js";
|
|
21
|
+
export { type FormatV1 } from "./detachedFieldIndexFormatV1.js";
|
|
21
22
|
export { type ForestRootId } from "./detachedFieldIndexTypes.js";
|
|
22
23
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/core/tree/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EACN,KAAK,MAAM,EACX,KAAK,aAAa,EAClB,SAAS,EACT,KAAK,UAAU,EACf,KAAK,UAAU,EACf,UAAU,EACV,KAA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AC;AACnE,OAAO,EACN,QAAQ,EACR,KAAK,QAAQ,EACb,KAAK,aAAa,EAClB,KAAK,aAAa,EAClB,KAAK,eAAe,EACpB,KAAK,SAAS,EACd,KAAK,KAAK,EACV,KAAK,SAAS,EACd,kBAAkB,EAClB,kBAAkB,EAClB,YAAY,EACZ,KAAK,QAAQ,EACb,SAAS,EACT,oBAAoB,GACpB,MAAM,YAAY,CAAC;AACpB,OAAO,EAAE,KAAK,YAAY,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAChE,OAAO,EACN,KAAK,gBAAgB,EACrB,aAAa,EACb,UAAU,EACV,sBAAsB,EACtB,eAAe,EACf,sBAAsB,GACtB,MAAM,mBAAmB,CAAC;AAE3B,OAAO,EAAE,UAAU,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAE5D,OAAO,EACN,0BAA0B,EAC1B,kBAAkB,EAClB,cAAc,EACd,UAAU,GACV,MAAM,gBAAgB,CAAC;AAExB,OAAO,EACN,KAAK,SAAS,EACd,SAAS,EACT,WAAW,EACX,WAAW,EACX,KAAK,aAAa,GAClB,MAAM,YAAY,CAAC;AAEpB,OAAO,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/core/tree/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EACN,KAAK,MAAM,EACX,KAAK,aAAa,EAClB,SAAS,EACT,KAAK,UAAU,EACf,KAAK,UAAU,EACf,UAAU,EACV,KAAK,YAAY,EACjB,KAAK,mBAAmB,GACxB,MAAM,gBAAgB,CAAC;AACxB,OAAO,EACN,KAAK,WAAW,EAChB,kBAAkB,EAClB,uBAAuB,EACvB,cAAc,EACd,eAAe,EACf,WAAW,EACX,oBAAoB,EACpB,YAAY,EACZ,kBAAkB,EAClB,KAAK,sBAAsB,EAC3B,KAAK,cAAc,EACnB,aAAa,EACb,YAAY,EACZ,YAAY,EACZ,QAAQ,GACR,MAAM,aAAa,CAAC;AACrB,YAAY,E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,iBAAiB,CAAC;AAChE,OAAO,EACN,KAAK,gBAAgB,EACrB,aAAa,EACb,UAAU,EACV,sBAAsB,EACtB,eAAe,EACf,sBAAsB,GACtB,MAAM,mBAAmB,CAAC;AAE3B,OAAO,EAAE,UAAU,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAE5D,OAAO,EACN,0BAA0B,EAC1B,kBAAkB,EAClB,cAAc,EACd,UAAU,GACV,MAAM,gBAAgB,CAAC;AAExB,OAAO,EACN,KAAK,SAAS,EACd,SAAS,EACT,WAAW,EACX,WAAW,EACX,KAAK,aAAa,GAClB,MAAM,YAAY,CAAC;AAEpB,OAAO,EACN,kBAAkB,EAClB,KAAK,4BAA4B,EACjC,KAAK,0BAA0B,GAC/B,MAAM,yBAAyB,CAAC;AAEjC,OAAO,EAAE,uCAAuC,EAAE,MAAM,+BAA+B,CAAC;AACxF,OAAO,EAAE,+BAA+B,EAAE,MAAM,qCAAqC,CAAC;AACtF,OAAO,EAAE,KAAK,QAAQ,EAAE,MAAM,iCAAiC,CAAC;AAEhE,OAAO,EAAE,KAAK,YAAY,EAAE,MAAM,8BAA8B,CAAC"}
|
package/dist/core/tree/index.js
CHANGED
|
@@ -5,6 +5,7 @@
|
|
|
5
5
|
*/
|
|
6
6
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
7
|
exports.getCodecTreeForDetachedFieldIndexFormat = exports.DetachedFieldIndex = exports.tryGetChunk = exports.cursorChunk = exports.dummyRoot = exports.emptyDelta = exports.offsetDetachId = exports.makeDetachedNodeId = exports.deltaForRootInitialization = exports.getDescendant = exports.SparseNode = exports.makeDetachedFieldIndex = exports.combineVisitors = exports.createAnnouncedVisitor = exports.applyDelta = exports.announceDelta = exports.visitDelta = exports.aboveRootPlaceholder = exports.rootField = exports.rootFieldKey = exports.keyAsDetachedField = exports.detachedFieldAsKey = exports.EmptyKey = exports.EncodedJsonableTree = exports.setGenericTreeField = exports.getGenericTreeField = exports.genericTreeKeys = exports.genericTreeDeleteIfEmpty = exports.getDetachedFieldContainingPath = exports.isDetachedUpPath = exports.compareFieldUpPaths = exports.compareUpPaths = exports.getDepth = exports.topDownPath = exports.clonePath = exports.deepCopyMapTree = exports.isCursor = exports.CursorMarker = exports.inCursorNode = exports.inCursorField = exports.iterateCursorField = exports.forEachField = exports.forEachNodeInSubtree = exports.forEachNode = exports.mapCursorFields = exports.mapCursorField = exports.castCursorToSynchronous = exports.CursorLocationType = exports.anchorSlot = exports.AnchorSet = void 0;
|
|
8
|
+
exports.DetachedFieldIndexFormatVersion = void 0;
|
|
8
9
|
var anchorSet_js_1 = require("./anchorSet.js");
|
|
9
10
|
Object.defineProperty(exports, "AnchorSet", { enumerable: true, get: function () { return anchorSet_js_1.AnchorSet; } });
|
|
10
11
|
Object.defineProperty(exports, "anchorSlot", { enumerable: true, get: function () { return anchorSet_js_1.anchorSlot; } });
|
|
@@ -69,4 +70,6 @@ var detachedFieldIndex_js_1 = require("./detachedFieldIndex.js");
|
|
|
69
70
|
Object.defineProperty(exports, "DetachedFieldIndex", { enumerable: true, get: function () { return detachedFieldIndex_js_1.DetachedFieldIndex; } });
|
|
70
71
|
var detachedFieldIndexCodecs_js_1 = require("./detachedFieldIndexCodecs.js");
|
|
71
72
|
Object.defineProperty(exports, "getCodecTreeForDetachedFieldIndexFormat", { enumerable: true, get: function () { return detachedFieldIndexCodecs_js_1.getCodecTreeForDetachedFieldIndexFormat; } });
|
|
73
|
+
var detachedFieldIndexFormatCommon_js_1 = require("./detachedFieldIndexFormatCommon.js");
|
|
74
|
+
Object.defineProperty(exports, "DetachedFieldIndexFormatVersion", { enumerable: true, get: function () { return detachedFieldIndexFormatCommon_js_1.DetachedFieldIndexFormatVersion; } });
|
|
72
75
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/core/tree/index.ts"],"names":[],"mappings":";AAAA;;;GAGG
|
|
1
|
+
{"version":3,"file":"index.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;AAGvB,iDAA4D;AAAnD,2GAAA,UAAU,OAAA;AAAE,8GAAA,aAAa,OAAA;AAElC,+CAKwB;AAJvB,0HAAA,0BAA0B,OAAA;AAC1B,kHAAA,kBAAkB,OAAA;AAClB,8GAAA,cAAc,OAAA;AACd,0GAAA,UAAU,OAAA;AAGX,uCAMoB;AAJnB,qGAAA,SAAS,OAAA;AACT,uGAAA,WAAW,OAAA;AACX,uGAAA,WAAW,OAAA;AAIZ,iEAIiC;AAHhC,2HAAA,kBAAkB,OAAA;AAKnB,6EAAwF;AAA/E,sJAAA,uCAAuC,OAAA;AAChD,yFAAsF;AAA7E,oJAAA,+BAA+B,OAAA","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nexport {\n\ttype Anchor,\n\ttype AnchorLocator,\n\tAnchorSet,\n\ttype AnchorSlot,\n\ttype AnchorNode,\n\tanchorSlot,\n\ttype AnchorEvents,\n\ttype AnchorSetRootEvents,\n} from \"./anchorSet.js\";\nexport {\n\ttype ITreeCursor,\n\tCursorLocationType,\n\tcastCursorToSynchronous,\n\tmapCursorField,\n\tmapCursorFields,\n\tforEachNode,\n\tforEachNodeInSubtree,\n\tforEachField,\n\titerateCursorField,\n\ttype ITreeCursorSynchronous,\n\ttype PathRootPrefix,\n\tinCursorField,\n\tinCursorNode,\n\tCursorMarker,\n\tisCursor,\n} from \"./cursor.js\";\nexport type {\n\tProtoNodes,\n\tRoot as DeltaRoot,\n\tMark as DeltaMark,\n\tDetachedNodeId as DeltaDetachedNodeId,\n\tFieldMap as DeltaFieldMap,\n\tDetachedNodeChanges as DeltaDetachedNodeChanges,\n\tDetachedNodeBuild as DeltaDetachedNodeBuild,\n\tDetachedNodeDestruction as DeltaDetachedNodeDestruction,\n\tDetachedNodeRename as DeltaDetachedNodeRename,\n\tFieldChanges as DeltaFieldChanges,\n} from \"./delta.js\";\nexport { type MapTree, type ExclusiveMapTree, deepCopyMapTree } from \"./mapTree.js\";\nexport {\n\tclonePath,\n\ttopDownPath,\n\tgetDepth,\n\ttype UpPath,\n\ttype NormalizedUpPath,\n\ttype INormalizedUpPath,\n\ttype NormalizedFieldUpPath,\n\ttype FieldUpPath,\n\ttype Range,\n\ttype RangeUpPath,\n\ttype PlaceUpPath,\n\ttype PlaceIndex,\n\ttype NodeIndex,\n\tcompareUpPaths,\n\tcompareFieldUpPaths,\n\tisDetachedUpPathRoot as isDetachedUpPath,\n\tgetDetachedFieldContainingPath,\n\ttype UpPathDefault,\n} from \"./pathTree.js\";\nexport {\n\ttype FieldMapObject,\n\ttype GenericFieldsNode,\n\tgenericTreeDeleteIfEmpty,\n\tgenericTreeKeys,\n\ttype GenericTreeNode,\n\tgetGenericTreeField,\n\ttype JsonableTree,\n\tsetGenericTreeField,\n} from \"./treeTextFormat.js\";\nexport { EncodedJsonableTree } from \"./persistedTreeTextFormat.js\";\nexport {\n\tEmptyKey,\n\ttype TreeType,\n\ttype ChildLocation,\n\ttype DetachedField,\n\ttype ChildCollection,\n\ttype RootField,\n\ttype Value,\n\ttype TreeValue,\n\tdetachedFieldAsKey,\n\tkeyAsDetachedField,\n\trootFieldKey,\n\ttype NodeData,\n\trootField,\n\taboveRootPlaceholder,\n} from \"./types.js\";\nexport { type DeltaVisitor, visitDelta } from \"./visitDelta.js\";\nexport {\n\ttype AnnouncedVisitor,\n\tannounceDelta,\n\tapplyDelta,\n\tcreateAnnouncedVisitor,\n\tcombineVisitors,\n\tmakeDetachedFieldIndex,\n} from \"./visitorUtils.js\";\n\nexport { SparseNode, getDescendant } from \"./sparseTree.js\";\n\nexport {\n\tdeltaForRootInitialization,\n\tmakeDetachedNodeId,\n\toffsetDetachId,\n\temptyDelta,\n} from \"./deltaUtil.js\";\n\nexport {\n\ttype TreeChunk,\n\tdummyRoot,\n\tcursorChunk,\n\ttryGetChunk,\n\ttype ChunkedCursor,\n} from \"./chunk.js\";\n\nexport {\n\tDetachedFieldIndex,\n\ttype DetachedFieldIndexCheckpoint,\n\ttype ReadOnlyDetachedFieldIndex,\n} from \"./detachedFieldIndex.js\";\n\nexport { getCodecTreeForDetachedFieldIndexFormat } from \"./detachedFieldIndexCodecs.js\";\nexport { DetachedFieldIndexFormatVersion } from \"./detachedFieldIndexFormatCommon.js\";\nexport { type FormatV1 } from \"./detachedFieldIndexFormatV1.js\";\n\nexport { type ForestRootId } from \"./detachedFieldIndexTypes.js\";\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"codecs.d.ts","sourceRoot":"","sources":["../../../../src/feature-libraries/chunked-forest/codec/codecs.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,KAAK,EAAE,aAAa,EAAE,SAAS,EAAE,MAAM,+BAA+B,CAAC;AAM9E,OAAO,EACN,KAAK,SAAS,EACd,KAAK,iBAAiB,EAEtB,KAAK,UAAU,EAEf,MAAM,yBAAyB,CAAC;AACjC,OAAO,EAEN,KAAK,sBAAsB,EAC3B,KAAK,eAAe,EACpB,KAAK,SAAS,EACd,MAAM,wBAAwB,CAAC;AAChC,OAAO,EAGN,KAAK,KAAK,EACV,KAAK,sBAAsB,
|
|
1
|
+
{"version":3,"file":"codecs.d.ts","sourceRoot":"","sources":["../../../../src/feature-libraries/chunked-forest/codec/codecs.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,KAAK,EAAE,aAAa,EAAE,SAAS,EAAE,MAAM,+BAA+B,CAAC;AAM9E,OAAO,EACN,KAAK,SAAS,EACd,KAAK,iBAAiB,EAEtB,KAAK,UAAU,EAEf,MAAM,yBAAyB,CAAC;AACjC,OAAO,EAEN,KAAK,sBAAsB,EAC3B,KAAK,eAAe,EACpB,KAAK,SAAS,EACd,MAAM,wBAAwB,CAAC;AAChC,OAAO,EAGN,KAAK,KAAK,EACV,KAAK,sBAAsB,EAE3B,MAAM,wBAAwB,CAAC;AAChC,OAAO,EAAE,uBAAuB,EAAE,MAAM,+BAA+B,CAAC;AAGxE,OAAO,KAAK,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AAO,EAAE,iBAAiB,GAAG,eAAe,CAuF/E;AAED,wBAAgB,+BAA+B,CAC9C,aAAa,EAAE,uBAAuB,GACpC,SAAS,CAEX"}
|
|
@@ -36,12 +36,12 @@ function makeFieldBatchCodec(options) {
|
|
|
36
36
|
let schemaCompressedEncodeFn;
|
|
37
37
|
let encodedFieldBatchType;
|
|
38
38
|
switch (writeVersion) {
|
|
39
|
-
case format_js_1.FieldBatchFormatVersion.v1:
|
|
39
|
+
case (0, index_js_2.unbrand)(format_js_1.FieldBatchFormatVersion.v1):
|
|
40
40
|
uncompressedEncodeFn = uncompressedEncode_js_1.uncompressedEncodeV1;
|
|
41
41
|
schemaCompressedEncodeFn = schemaBasedEncode_js_1.schemaCompressedEncodeV1;
|
|
42
42
|
encodedFieldBatchType = format_js_1.EncodedFieldBatchV1;
|
|
43
43
|
break;
|
|
44
|
-
case format_js_1.FieldBatchFormatVersion.v2:
|
|
44
|
+
case (0, index_js_2.unbrand)(format_js_1.FieldBatchFormatVersion.v2):
|
|
45
45
|
uncompressedEncodeFn = uncompressedEncode_js_1.uncompressedEncodeV2;
|
|
46
46
|
schemaCompressedEncodeFn = schemaBasedEncode_js_1.schemaCompressedEncodeV2;
|
|
47
47
|
encodedFieldBatchType = format_js_1.EncodedFieldBatchV2;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"codecs.js","sourceRoot":"","sources":["../../../../src/feature-libraries/chunked-forest/codec/codecs.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,kEAA8E;AAE9E,qEAGgD;AAEhD,sDAMiC;AAOjC,qDAKgC;AAChC,2EAAwE;AAExE,yDAA4C;AAE5C,2CAMqB;AAGrB,mEAAqF;AACrF,iEAA4F;AAM5F,MAAM,gBAAgB,GAAG,IAAA,4BAAiB,EAAmB,EAAE,UAAU,EAAE,CAAC,EAAE,OAAO,EAAE,CAAC,EAAE,CAAC,CAAC;AA6E5F;;;GAGG;AACH,SAAS,gCAAgC,CACxC,aAAs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,CAAC,CAAC;AACJ,CAAC;AAvFD,kDAuFC;AAED,SAAgB,+BAA+B,CAC9C,aAAsC;IAEtC,OAAO,EAAE,IAAI,EAAE,YAAY,EAAE,OAAO,EAAE,gCAAgC,CAAC,aAAa,CAAC,EAAE,CAAC;AACzF,CAAC;AAJD,0EAIC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { assert, unreachableCase } from \"@fluidframework/core-utils/internal\";\nimport type { IIdCompressor, SessionId } from \"@fluidframework/id-compressor\";\nimport {\n\tgetConfigForMinVersionForCollab,\n\tlowestMinVersionForCollab,\n} from \"@fluidframework/runtime-utils/internal\";\n\nimport {\n\ttype CodecTree,\n\ttype CodecWriteOptions,\n\tFluidClientVersion,\n\ttype IJsonCodec,\n\tmakeVersionedValidatedCodec,\n} from \"../../../codec/index.js\";\nimport {\n\tCursorLocationType,\n\ttype ITreeCursorSynchronous,\n\ttype SchemaAndPolicy,\n\ttype TreeChunk,\n} from \"../../../core/index.js\";\nimport {\n\tbrand,\n\tbrandedNumberType,\n\ttype Brand,\n\ttype JsonCompatibleReadOnly,\n} from \"../../../util/index.js\";\nimport { TreeCompressionStrategy } from \"../../treeCompressionUtils.js\";\n\nimport { decode } from \"./chunkDecoding.js\";\nimport type { FieldBatch } from \"./fieldBatch.js\";\nimport {\n\ttype EncodedFieldBatch,\n\tvalidVersions,\n\tFieldBatchFormatVersion,\n\tEncodedFieldBatchV1,\n\tEncodedFieldBatchV2,\n} from \"./format.js\";\nimport type { MinimumVersionForCollab } from \"@fluidframework/runtime-definitions/internal\";\nimport type { IncrementalEncodingPolicy } from \"./incrementalEncodingPolicy.js\";\nimport { uncompressedEncodeV1, uncompressedEncodeV2 } from \"./uncompressedEncode.js\";\nimport { schemaCompressedEncodeV1, schemaCompressedEncodeV2 } from \"./schemaBasedEncode.js\";\n\n/**\n * Reference ID for a chunk that is incrementally encoded.\n */\nexport type ChunkReferenceId = Brand<number, \"forest.ChunkReferenceId\">;\nconst ChunkReferenceId = brandedNumberType<ChunkReferenceId>({ multipleOf: 1, minimum: 0 });\n\n/**\n * Properties for incremental encoding.\n * Fields that support incremental encoding will encode their chunks separately by calling `encodeIncrementalField`.\n * @remarks\n * This supports features like incremental summarization where the summary from these fields can be re-used if\n * unchanged between summaries.\n * Note that each of these chunks that are incrementally encoded is fully self-describing (contain its own shapes\n * list and identifier table) and does not rely on context from its parent.\n */\nexport interface IncrementalEncoder {\n\t/**\n\t * Returns whether a node / field should be incrementally encoded.\n\t * @remarks See {@link IncrementalEncodingPolicy}.\n\t */\n\tshouldEncodeIncrementally: IncrementalEncodingPolicy;\n\t/**\n\t * Called to encode an incremental field at the cursor.\n\t * The chunks for this field are encoded separately from the main buffer.\n\t * @param cursor - The cursor pointing to the field to encode.\n\t * @param chunkEncoder - A function that encodes the contents of the passed chunk in the field.\n\t * @returns The reference IDs of the encoded chunks in the field.\n\t * This is used to retrieve the encoded chunks later.\n\t */\n\tencodeIncrementalField(\n\t\tcursor: ITreeCursorSynchronous,\n\t\tchunkEncoder: (chunk: TreeChunk) => EncodedFieldBatch,\n\t): ChunkReferenceId[];\n}\n\n/**\n * Properties for incremental decoding.\n *\n * Fields that had their chunks incrementally encoded will retrieve them by calling `getEncodedIncrementalChunk`.\n * @remarks\n * See {@link IncrementalEncoder} for more details.\n */\nexport interface IncrementalDecoder {\n\t/**\n\t * Called to decode an incremental chunk with the given reference ID.\n\t * @param referenceId - The reference ID of the chunk to decode.\n\t * @param chunkDecoder - A function that decodes the chunk.\n\t * @returns The decoded chunk.\n\t */\n\tdecodeIncrementalChunk(\n\t\treferenceId: ChunkReferenceId,\n\t\tchunkDecoder: (encoded: EncodedFieldBatch) => TreeChunk,\n\t): TreeChunk;\n}\n/**\n * Combines the properties of {@link IncrementalEncoder} and {@link IncrementalDecoder}.\n */\nexport interface IncrementalEncoderDecoder extends IncrementalEncoder, IncrementalDecoder {}\n\nexport interface FieldBatchEncodingContext {\n\treadonly encodeType: TreeCompressionStrategy;\n\treadonly idCompressor: IIdCompressor;\n\treadonly originatorId: SessionId;\n\treadonly schema?: SchemaAndPolicy;\n\t/**\n\t * An encoder / decoder for encoding and decoding of incremental fields.\n\t * This will be defined if incremental encoding is supported and enabled.\n\t */\n\treadonly incrementalEncoderDecoder?: IncrementalEncoderDecoder;\n}\n/**\n * @remarks\n * Fields in this batch currently don't have field schema for the root, which limits optimizations.\n */\nexport type FieldBatchCodec = IJsonCodec<\n\tFieldBatch,\n\tEncodedFieldBatch,\n\tJsonCompatibleReadOnly,\n\tFieldBatchEncodingContext\n>;\n\n/**\n * Convert a MinimumVersionForCollab to write version for {@link FieldBatchCodec}.\n * @param clientVersion - The MinimumVersionForCollab to convert.\n */\nfunction clientVersionToFieldBatchVersion(\n\tclientVersion: MinimumVersionForCollab,\n): FieldBatchFormatVersion {\n\treturn brand(\n\t\tgetConfigForMinVersionForCollab(clientVersion, {\n\t\t\t[lowestMinVersionForCollab]: FieldBatchFormatVersion.v1,\n\t\t\t[FluidClientVersion.v2_73]: FieldBatchFormatVersion.v2,\n\t\t}),\n\t);\n}\n\nexport function makeFieldBatchCodec(options: CodecWriteOptions): FieldBatchCodec {\n\tconst writeVersion = clientVersionToFieldBatchVersion(options.minVersionForCollab);\n\t// Note: it's important that the decode function is schema-agnostic for this strategy/layering to work, since\n\t// the schema that an op was encoded in doesn't necessarily match the current schema for the document (e.g. if\n\t// decode is being run on a client that just submitted a schema change, but the op is from another client who has\n\t// yet to receive that change).\n\tassert(\n\t\tvalidVersions.has(writeVersion),\n\t\t0x935 /* Invalid write version for FieldBatch codec */,\n\t);\n\n\tlet uncompressedEncodeFn: typeof uncompressedEncodeV1 | typeof uncompressedEncodeV2;\n\tlet schemaCompressedEncodeFn:\n\t\t| typeof schemaCompressedEncodeV1\n\t\t| typeof schemaCompressedEncodeV2;\n\tlet encodedFieldBatchType: typeof EncodedFieldBatchV1 | typeof EncodedFieldBatchV2;\n\tswitch (writeVersion) {\n\t\tcase FieldBatchFormatVersion.v1:\n\t\t\tuncompressedEncodeFn = uncompressedEncodeV1;\n\t\t\tschemaCompressedEncodeFn = schemaCompressedEncodeV1;\n\t\t\tencodedFieldBatchType = EncodedFieldBatchV1;\n\t\t\tbreak;\n\t\tcase FieldBatchFormatVersion.v2:\n\t\t\tuncompressedEncodeFn = uncompressedEncodeV2;\n\t\t\tschemaCompressedEncodeFn = schemaCompressedEncodeV2;\n\t\t\tencodedFieldBatchType = EncodedFieldBatchV2;\n\t\t\tbreak;\n\t\tdefault:\n\t\t\tunreachableCase(writeVersion);\n\t}\n\n\treturn makeVersionedValidatedCodec(options, validVersions, encodedFieldBatchType, {\n\t\tencode: (data: FieldBatch, context: FieldBatchEncodingContext): EncodedFieldBatch => {\n\t\t\tfor (const cursor of data) {\n\t\t\t\tassert(\n\t\t\t\t\tcursor.mode === CursorLocationType.Fields,\n\t\t\t\t\t0x8a3 /* FieldBatch expects fields cursors */,\n\t\t\t\t);\n\t\t\t}\n\t\t\tlet encoded: EncodedFieldBatch;\n\t\t\tlet incrementalEncoder: IncrementalEncoder | undefined;\n\t\t\tswitch (context.encodeType) {\n\t\t\t\tcase TreeCompressionStrategy.Uncompressed:\n\t\t\t\t\tencoded = uncompressedEncodeFn(data);\n\t\t\t\t\tbreak;\n\t\t\t\tcase TreeCompressionStrategy.CompressedIncremental:\n\t\t\t\t\tassert(\n\t\t\t\t\t\twriteVersion >= FieldBatchFormatVersion.v2,\n\t\t\t\t\t\t0xca0 /* Unsupported FieldBatchFormatVersion for incremental encoding; must be v2 or higher */,\n\t\t\t\t\t);\n\t\t\t\t\t// Incremental encoding is only supported for CompressedIncremental.\n\t\t\t\t\tincrementalEncoder = context.incrementalEncoderDecoder;\n\t\t\t\tcase TreeCompressionStrategy.Compressed:\n\t\t\t\t\t// eslint-disable-next-line unicorn/prefer-ternary\n\t\t\t\t\tif (context.schema !== undefined) {\n\t\t\t\t\t\tencoded = schemaCompressedEncodeFn(\n\t\t\t\t\t\t\tcontext.schema.schema,\n\t\t\t\t\t\t\tcontext.schema.policy,\n\t\t\t\t\t\t\tdata,\n\t\t\t\t\t\t\tcontext.idCompressor,\n\t\t\t\t\t\t\tincrementalEncoder,\n\t\t\t\t\t\t);\n\t\t\t\t\t} else {\n\t\t\t\t\t\t// TODO: consider enabling a somewhat compressed but not schema accelerated encode.\n\t\t\t\t\t\tencoded = uncompressedEncodeFn(data);\n\t\t\t\t\t}\n\n\t\t\t\t\tbreak;\n\t\t\t\tdefault:\n\t\t\t\t\tunreachableCase(context.encodeType);\n\t\t\t}\n\n\t\t\t// TODO: consider checking input data was in schema.\n\t\t\treturn encoded;\n\t\t},\n\t\tdecode: (data: EncodedFieldBatch, context: FieldBatchEncodingContext): FieldBatch => {\n\t\t\t// TODO: consider checking data is in schema.\n\t\t\treturn decode(\n\t\t\t\tdata,\n\t\t\t\t{\n\t\t\t\t\tidCompressor: context.idCompressor,\n\t\t\t\t\toriginatorId: context.originatorId,\n\t\t\t\t},\n\t\t\t\tcontext.incrementalEncoderDecoder,\n\t\t\t).map((chunk) => chunk.cursor());\n\t\t},\n\t});\n}\n\nexport function getCodecTreeForFieldBatchFormat(\n\tclientVersion: MinimumVersionForCollab,\n): CodecTree {\n\treturn { name: \"FieldBatch\", version: clientVersionToFieldBatchVersion(clientVersion) };\n}\n"]}
|
|
1
|
+
{"version":3,"file":"codecs.js","sourceRoot":"","sources":["../../../../src/feature-libraries/chunked-forest/codec/codecs.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,kEAA8E;AAE9E,qEAGgD;AAEhD,sDAMiC;AAOjC,qDAMgC;AAChC,2EAAwE;AAExE,yDAA4C;AAE5C,2CAMqB;AAGrB,mEAAqF;AACrF,iEAA4F;AAM5F,MAAM,gBAAgB,GAAG,IAAA,4BAAiB,EAAmB,EAAE,UAAU,EAAE,CAAC,EAAE,OAAO,EAAE,CAAC,EAAE,CAAC,CAAC;AA6E5F;;;GAGG;AACH,SAAS,gCAAgC,CACxC,a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KAAK,CAAC,MAAM,EAAE,CAAC,CAAC;QAClC,CAAC;KACD,CAAC,CAAC;AACJ,CAAC;AAvFD,kDAuFC;AAED,SAAgB,+BAA+B,CAC9C,aAAsC;IAEtC,OAAO,EAAE,IAAI,EAAE,YAAY,EAAE,OAAO,EAAE,gCAAgC,CAAC,aAAa,CAAC,EAAE,CAAC;AACzF,CAAC;AAJD,0EAIC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { assert, unreachableCase } from \"@fluidframework/core-utils/internal\";\nimport type { IIdCompressor, SessionId } from \"@fluidframework/id-compressor\";\nimport {\n\tgetConfigForMinVersionForCollab,\n\tlowestMinVersionForCollab,\n} from \"@fluidframework/runtime-utils/internal\";\n\nimport {\n\ttype CodecTree,\n\ttype CodecWriteOptions,\n\tFluidClientVersion,\n\ttype IJsonCodec,\n\tmakeVersionedValidatedCodec,\n} from \"../../../codec/index.js\";\nimport {\n\tCursorLocationType,\n\ttype ITreeCursorSynchronous,\n\ttype SchemaAndPolicy,\n\ttype TreeChunk,\n} from \"../../../core/index.js\";\nimport {\n\tbrand,\n\tbrandedNumberType,\n\ttype Brand,\n\ttype JsonCompatibleReadOnly,\n\tunbrand,\n} from \"../../../util/index.js\";\nimport { TreeCompressionStrategy } from \"../../treeCompressionUtils.js\";\n\nimport { decode } from \"./chunkDecoding.js\";\nimport type { FieldBatch } from \"./fieldBatch.js\";\nimport {\n\ttype EncodedFieldBatch,\n\tvalidVersions,\n\tFieldBatchFormatVersion,\n\tEncodedFieldBatchV1,\n\tEncodedFieldBatchV2,\n} from \"./format.js\";\nimport type { MinimumVersionForCollab } from \"@fluidframework/runtime-definitions/internal\";\nimport type { IncrementalEncodingPolicy } from \"./incrementalEncodingPolicy.js\";\nimport { uncompressedEncodeV1, uncompressedEncodeV2 } from \"./uncompressedEncode.js\";\nimport { schemaCompressedEncodeV1, schemaCompressedEncodeV2 } from \"./schemaBasedEncode.js\";\n\n/**\n * Reference ID for a chunk that is incrementally encoded.\n */\nexport type ChunkReferenceId = Brand<number, \"forest.ChunkReferenceId\">;\nconst ChunkReferenceId = brandedNumberType<ChunkReferenceId>({ multipleOf: 1, minimum: 0 });\n\n/**\n * Properties for incremental encoding.\n * Fields that support incremental encoding will encode their chunks separately by calling `encodeIncrementalField`.\n * @remarks\n * This supports features like incremental summarization where the summary from these fields can be re-used if\n * unchanged between summaries.\n * Note that each of these chunks that are incrementally encoded is fully self-describing (contain its own shapes\n * list and identifier table) and does not rely on context from its parent.\n */\nexport interface IncrementalEncoder {\n\t/**\n\t * Returns whether a node / field should be incrementally encoded.\n\t * @remarks See {@link IncrementalEncodingPolicy}.\n\t */\n\tshouldEncodeIncrementally: IncrementalEncodingPolicy;\n\t/**\n\t * Called to encode an incremental field at the cursor.\n\t * The chunks for this field are encoded separately from the main buffer.\n\t * @param cursor - The cursor pointing to the field to encode.\n\t * @param chunkEncoder - A function that encodes the contents of the passed chunk in the field.\n\t * @returns The reference IDs of the encoded chunks in the field.\n\t * This is used to retrieve the encoded chunks later.\n\t */\n\tencodeIncrementalField(\n\t\tcursor: ITreeCursorSynchronous,\n\t\tchunkEncoder: (chunk: TreeChunk) => EncodedFieldBatch,\n\t): ChunkReferenceId[];\n}\n\n/**\n * Properties for incremental decoding.\n *\n * Fields that had their chunks incrementally encoded will retrieve them by calling `getEncodedIncrementalChunk`.\n * @remarks\n * See {@link IncrementalEncoder} for more details.\n */\nexport interface IncrementalDecoder {\n\t/**\n\t * Called to decode an incremental chunk with the given reference ID.\n\t * @param referenceId - The reference ID of the chunk to decode.\n\t * @param chunkDecoder - A function that decodes the chunk.\n\t * @returns The decoded chunk.\n\t */\n\tdecodeIncrementalChunk(\n\t\treferenceId: ChunkReferenceId,\n\t\tchunkDecoder: (encoded: EncodedFieldBatch) => TreeChunk,\n\t): TreeChunk;\n}\n/**\n * Combines the properties of {@link IncrementalEncoder} and {@link IncrementalDecoder}.\n */\nexport interface IncrementalEncoderDecoder extends IncrementalEncoder, IncrementalDecoder {}\n\nexport interface FieldBatchEncodingContext {\n\treadonly encodeType: TreeCompressionStrategy;\n\treadonly idCompressor: IIdCompressor;\n\treadonly originatorId: SessionId;\n\treadonly schema?: SchemaAndPolicy;\n\t/**\n\t * An encoder / decoder for encoding and decoding of incremental fields.\n\t * This will be defined if incremental encoding is supported and enabled.\n\t */\n\treadonly incrementalEncoderDecoder?: IncrementalEncoderDecoder;\n}\n/**\n * @remarks\n * Fields in this batch currently don't have field schema for the root, which limits optimizations.\n */\nexport type FieldBatchCodec = IJsonCodec<\n\tFieldBatch,\n\tEncodedFieldBatch,\n\tJsonCompatibleReadOnly,\n\tFieldBatchEncodingContext\n>;\n\n/**\n * Convert a MinimumVersionForCollab to write version for {@link FieldBatchCodec}.\n * @param clientVersion - The MinimumVersionForCollab to convert.\n */\nfunction clientVersionToFieldBatchVersion(\n\tclientVersion: MinimumVersionForCollab,\n): FieldBatchFormatVersion {\n\treturn brand(\n\t\tgetConfigForMinVersionForCollab(clientVersion, {\n\t\t\t[lowestMinVersionForCollab]: FieldBatchFormatVersion.v1,\n\t\t\t[FluidClientVersion.v2_73]: FieldBatchFormatVersion.v2,\n\t\t}),\n\t);\n}\n\nexport function makeFieldBatchCodec(options: CodecWriteOptions): FieldBatchCodec {\n\tconst writeVersion = clientVersionToFieldBatchVersion(options.minVersionForCollab);\n\t// Note: it's important that the decode function is schema-agnostic for this strategy/layering to work, since\n\t// the schema that an op was encoded in doesn't necessarily match the current schema for the document (e.g. if\n\t// decode is being run on a client that just submitted a schema change, but the op is from another client who has\n\t// yet to receive that change).\n\tassert(\n\t\tvalidVersions.has(writeVersion),\n\t\t0x935 /* Invalid write version for FieldBatch codec */,\n\t);\n\n\tlet uncompressedEncodeFn: typeof uncompressedEncodeV1 | typeof uncompressedEncodeV2;\n\tlet schemaCompressedEncodeFn:\n\t\t| typeof schemaCompressedEncodeV1\n\t\t| typeof schemaCompressedEncodeV2;\n\tlet encodedFieldBatchType: typeof EncodedFieldBatchV1 | typeof EncodedFieldBatchV2;\n\tswitch (writeVersion) {\n\t\tcase unbrand(FieldBatchFormatVersion.v1):\n\t\t\tuncompressedEncodeFn = uncompressedEncodeV1;\n\t\t\tschemaCompressedEncodeFn = schemaCompressedEncodeV1;\n\t\t\tencodedFieldBatchType = EncodedFieldBatchV1;\n\t\t\tbreak;\n\t\tcase unbrand(FieldBatchFormatVersion.v2):\n\t\t\tuncompressedEncodeFn = uncompressedEncodeV2;\n\t\t\tschemaCompressedEncodeFn = schemaCompressedEncodeV2;\n\t\t\tencodedFieldBatchType = EncodedFieldBatchV2;\n\t\t\tbreak;\n\t\tdefault:\n\t\t\tunreachableCase(writeVersion);\n\t}\n\n\treturn makeVersionedValidatedCodec(options, validVersions, encodedFieldBatchType, {\n\t\tencode: (data: FieldBatch, context: FieldBatchEncodingContext): EncodedFieldBatch => {\n\t\t\tfor (const cursor of data) {\n\t\t\t\tassert(\n\t\t\t\t\tcursor.mode === CursorLocationType.Fields,\n\t\t\t\t\t0x8a3 /* FieldBatch expects fields cursors */,\n\t\t\t\t);\n\t\t\t}\n\t\t\tlet encoded: EncodedFieldBatch;\n\t\t\tlet incrementalEncoder: IncrementalEncoder | undefined;\n\t\t\tswitch (context.encodeType) {\n\t\t\t\tcase TreeCompressionStrategy.Uncompressed:\n\t\t\t\t\tencoded = uncompressedEncodeFn(data);\n\t\t\t\t\tbreak;\n\t\t\t\tcase TreeCompressionStrategy.CompressedIncremental:\n\t\t\t\t\tassert(\n\t\t\t\t\t\twriteVersion >= FieldBatchFormatVersion.v2,\n\t\t\t\t\t\t0xca0 /* Unsupported FieldBatchFormatVersion for incremental encoding; must be v2 or higher */,\n\t\t\t\t\t);\n\t\t\t\t\t// Incremental encoding is only supported for CompressedIncremental.\n\t\t\t\t\tincrementalEncoder = context.incrementalEncoderDecoder;\n\t\t\t\tcase TreeCompressionStrategy.Compressed:\n\t\t\t\t\t// eslint-disable-next-line unicorn/prefer-ternary\n\t\t\t\t\tif (context.schema !== undefined) {\n\t\t\t\t\t\tencoded = schemaCompressedEncodeFn(\n\t\t\t\t\t\t\tcontext.schema.schema,\n\t\t\t\t\t\t\tcontext.schema.policy,\n\t\t\t\t\t\t\tdata,\n\t\t\t\t\t\t\tcontext.idCompressor,\n\t\t\t\t\t\t\tincrementalEncoder,\n\t\t\t\t\t\t);\n\t\t\t\t\t} else {\n\t\t\t\t\t\t// TODO: consider enabling a somewhat compressed but not schema accelerated encode.\n\t\t\t\t\t\tencoded = uncompressedEncodeFn(data);\n\t\t\t\t\t}\n\n\t\t\t\t\tbreak;\n\t\t\t\tdefault:\n\t\t\t\t\tunreachableCase(context.encodeType);\n\t\t\t}\n\n\t\t\t// TODO: consider checking input data was in schema.\n\t\t\treturn encoded;\n\t\t},\n\t\tdecode: (data: EncodedFieldBatch, context: FieldBatchEncodingContext): FieldBatch => {\n\t\t\t// TODO: consider checking data is in schema.\n\t\t\treturn decode(\n\t\t\t\tdata,\n\t\t\t\t{\n\t\t\t\t\tidCompressor: context.idCompressor,\n\t\t\t\t\toriginatorId: context.originatorId,\n\t\t\t\t},\n\t\t\t\tcontext.incrementalEncoderDecoder,\n\t\t\t).map((chunk) => chunk.cursor());\n\t\t},\n\t});\n}\n\nexport function getCodecTreeForFieldBatchFormat(\n\tclientVersion: MinimumVersionForCollab,\n): CodecTree {\n\treturn { name: \"FieldBatch\", version: clientVersionToFieldBatchVersion(clientVersion) };\n}\n"]}
|
|
@@ -3,16 +3,16 @@
|
|
|
3
3
|
* Licensed under the MIT License.
|
|
4
4
|
*/
|
|
5
5
|
import { type Static } from "@sinclair/typebox";
|
|
6
|
-
import { type
|
|
6
|
+
import { type Values } from "../../../util/index.js";
|
|
7
7
|
/**
|
|
8
8
|
* The format version for the field batch.
|
|
9
9
|
*/
|
|
10
10
|
export declare const FieldBatchFormatVersion: {
|
|
11
|
-
readonly v1: 1
|
|
12
|
-
readonly v2: 2
|
|
11
|
+
readonly v1: import("../../../util/brand.js").Brand<1, "FieldBatchFormatVersion">;
|
|
12
|
+
readonly v2: import("../../../util/brand.js").Brand<2, "FieldBatchFormatVersion">;
|
|
13
13
|
};
|
|
14
|
-
export type FieldBatchFormatVersion =
|
|
15
|
-
export declare const validVersions: Set<
|
|
14
|
+
export type FieldBatchFormatVersion = Values<typeof FieldBatchFormatVersion>;
|
|
15
|
+
export declare const validVersions: Set<import("../../../util/brand.js").Brand<1, "FieldBatchFormatVersion"> | import("../../../util/brand.js").Brand<2, "FieldBatchFormatVersion">>;
|
|
16
16
|
/**
|
|
17
17
|
* Top level length is implied from length of data array.
|
|
18
18
|
* All content are of this shape.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"format.d.ts","sourceRoot":"","sources":["../../../../src/feature-libraries/chunked-forest/codec/format.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,KAAK,MAAM,EAAQ,MAAM,mBAAmB,CAAC;AAUtD,OAAO,
|
|
1
|
+
{"version":3,"file":"format.d.ts","sourceRoot":"","sources":["../../../../src/feature-libraries/chunked-forest/codec/format.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,KAAK,MAAM,EAAQ,MAAM,mBAAmB,CAAC;AAUtD,OAAO,EAAc,KAAK,MAAM,EAAE,MAAM,wBAAwB,CAAC;AAEjE;;GAEG;AACH,eAAO,MAAM,uBAAuB;;;CAGlC,CAAC;AACH,MAAM,MAAM,uBAAuB,GAAG,MAAM,CAAC,OAAO,uBAAuB,CAAC,CAAC;AAI7E,eAAO,MAAM,aAAa,kJAAuD,CAAC;AAElF;;;GAGG;AACH,eAAO,MAAM,uBAAuB,qCAAa,CAAC;AAElD;;GAEG;AACH,eAAO,MAAM,uBAAuB;;IAGlC;;OAEG;;EAIJ,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,eAAe,yCAAkB,CAAC;AAE/C;;;GAGG;AACH,eAAO,MAAM,4BAA4B,yCAAkB,CAAC;AAE5D;;;GAGG;AACH,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M,mBAAmB;;;;;QAhC9B;;WAEG;;QAEH;;WAEG;;;YArJH;;eAEG;;;QAqJH;;WAEG;;YA3CH;;eAEG;;;YAGH;;;;eAIG;;YAEH;;;eAGG;;;QA+BH;;WAEG;;QAEH;;WAEG;;;EAiBJ,CAAC;AACF,MAAM,MAAM,mBAAmB,GAAG,MAAM,CAAC,OAAO,mBAAmB,CAAC,CAAC;AAErE,eAAO,MAAM,mBAAmB;;;;;QAtC9B;;WAEG;;QAEH;;WAEG;;;YArJH;;eAEG;;;QAqJH;;WAEG;;YA3CH;;eAEG;;;YAGH;;;;eAIG;;YAEH;;;eAGG;;;QA+BH;;WAEG;;QAEH;;WAEG;;;EAuBJ,CAAC;AACF,MAAM,MAAM,mBAAmB,GAAG,MAAM,CAAC,OAAO,mBAAmB,CAAC,CAAC;AAErE,eAAO,MAAM,iBAAiB;;;;;QA5C5B;;WAEG;;QAEH;;WAEG;;;YArJH;;eAEG;;;QAqJH;;WAEG;;YA3CH;;eAEG;;;YAGH;;;;eAIG;;YAEH;;;eAGG;;;QA+BH;;WAEG;;QAEH;;WAEG;;;;;;;;QAlBH;;WAEG;;QAEH;;WAEG;;;YArJH;;eAEG;;;QAqJH;;WAEG;;YA3CH;;eAEG;;;YAGH;;;;eAIG;;YAEH;;;eAGG;;;QA+BH;;WAEG;;QAEH;;WAEG;;;IA0BkF,CAAC;AACxF,MAAM,MAAM,iBAAiB,GAAG,MAAM,CAAC,OAAO,iBAAiB,CAAC,CAAC"}
|
|
@@ -12,10 +12,10 @@ const index_js_2 = require("../../../util/index.js");
|
|
|
12
12
|
/**
|
|
13
13
|
* The format version for the field batch.
|
|
14
14
|
*/
|
|
15
|
-
exports.FieldBatchFormatVersion = {
|
|
15
|
+
exports.FieldBatchFormatVersion = (0, index_js_2.strictEnum)("FieldBatchFormatVersion", {
|
|
16
16
|
v1: 1,
|
|
17
17
|
v2: 2,
|
|
18
|
-
};
|
|
18
|
+
});
|
|
19
19
|
// Compatible versions used for format/version validation.
|
|
20
20
|
// TODO: A proper version update policy will need to be documented.
|
|
21
21
|
exports.validVersions = new Set([...Object.values(exports.FieldBatchFormatVersion)]);
|
|
@@ -174,7 +174,7 @@ exports.EncodedChunkShape = typebox_1.Type.Object({
|
|
|
174
174
|
*/
|
|
175
175
|
e: typebox_1.Type.Optional(exports.EncodedIncrementalChunkShape),
|
|
176
176
|
}, index_js_1.unionOptions);
|
|
177
|
-
exports.EncodedFieldBatchV1 = (0, formatGeneric_js_1.EncodedFieldBatchGeneric)(
|
|
178
|
-
exports.EncodedFieldBatchV2 = (0, formatGeneric_js_1.EncodedFieldBatchGeneric)(
|
|
177
|
+
exports.EncodedFieldBatchV1 = (0, formatGeneric_js_1.EncodedFieldBatchGeneric)(exports.FieldBatchFormatVersion.v1, exports.EncodedChunkShape);
|
|
178
|
+
exports.EncodedFieldBatchV2 = (0, formatGeneric_js_1.EncodedFieldBatchGeneric)(exports.FieldBatchFormatVersion.v2, exports.EncodedChunkShape);
|
|
179
179
|
exports.EncodedFieldBatch = typebox_1.Type.Union([exports.EncodedFieldBatchV1, exports.EncodedFieldBatchV2]);
|
|
180
180
|
//# sourceMappingURL=format.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"format.js","sourceRoot":"","sources":["../../../../src/feature-libraries/chunked-forest/codec/format.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,+CAAsD;AAEtD,sDAAuD;AAEvD,yDAK4B;AAC5B,qDAA2D;AAE3D;;GAEG;AACU,QAAA,uBAAuB,GAAG;IACtC,EAAE,EAAE,CAAC;IACL,EAAE,EAAE,CAAC;CACI,CAAC;AAMX,0DAA0D;AAC1D,mEAAmE;AACtD,QAAA,aAAa,GAAG,IAAI,GAAG,CAAC,CAAC,GAAG,MAAM,CAAC,MAAM,CAAC,+BAAuB,CAAC,CAAC,CAAC,CAAC;AAElF;;;GAGG;AACU,QAAA,uBAAuB,GAAG,6BAAU,CAAC;AAElD;;GAEG;AACU,QAAA,uB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AC;AAGW,QAAA,mBAAmB,GAAG,IAAA,2CAAwB,EAC1D,IAAA,gBAAK,EAA0B,+BAAuB,CAAC,EAAE,CAAC,EAC1D,yBAAiB,CACjB,CAAC;AAGW,QAAA,iBAAiB,GAAG,cAAI,CAAC,KAAK,CAAC,CAAC,2BAAmB,EAAE,2BAAmB,CAAC,CAAC,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { type Static, Type } from \"@sinclair/typebox\";\n\nimport { unionOptions } from \"../../../codec/index.js\";\n\nimport {\n\tCount,\n\tEncodedFieldBatchGeneric,\n\tIdentifierOrIndex,\n\tShapeIndex,\n} from \"./formatGeneric.js\";\nimport { brand, type Brand } from \"../../../util/index.js\";\n\n/**\n * The format version for the field batch.\n */\nexport const FieldBatchFormatVersion = {\n\tv1: 1,\n\tv2: 2,\n} as const;\nexport type FieldBatchFormatVersion = Brand<\n\t(typeof FieldBatchFormatVersion)[keyof typeof FieldBatchFormatVersion],\n\t\"FieldBatchFormatVersion\"\n>;\n\n// Compatible versions used for format/version validation.\n// TODO: A proper version update policy will need to be documented.\nexport const validVersions = new Set([...Object.values(FieldBatchFormatVersion)]);\n\n/**\n * Top level length is implied from length of data array.\n * All content are of this shape.\n */\nexport const EncodedNestedArrayShape = ShapeIndex;\n\n/**\n * Inline array.\n */\nexport const EncodedInlineArrayShape = Type.Object(\n\t{\n\t\tlength: Count,\n\t\t/**\n\t\t * All entries are this shape.\n\t\t */\n\t\tshape: ShapeIndex,\n\t},\n\t{ additionalProperties: false },\n);\n\n/**\n * Encoded as `shape, ...[data for shape]`.\n *\n * Used for polymorphism.\n */\nexport const EncodedAnyShape = Type.Literal(0);\n\n/**\n * Encoded content is a {@link ChunkReferenceId}.\n * This represents the shape of a chunk that is encoded separately and is referenced by its {@link ChunkReferenceId}.\n */\nexport const EncodedIncrementalChunkShape = Type.Literal(0);\n\n/**\n * Content of the encoded field is specified by the Shape referenced by the ShapeIndex.\n * This is a tuple for conciseness.\n */\nexport const EncodedFieldShape = Type.Tuple([\n\t/**\n\t * Field key for this field.\n\t */\n\tIdentifierOrIndex,\n\t/**\n\t * Shape of data in this field.\n\t */\n\tShapeIndex,\n]);\n\nexport type EncodedFieldShape = Static<typeof EncodedFieldShape>;\n\nenum CounterRelativeTo {\n\t// Relative to previous node of same type in depth first pre-order traversal.\n\tPreviousNodeOfType_DepthFirstPreOrder,\n\t// TODO: add alternative relative mode relative to previous note at a path to allow delta encoded sequences (like points where x and y are delta encoded relative to previous points).\n}\n\nenum CounterMode {\n\tNumber,\n\t// TODO: document wrap modes and bit skipping. Note UUID subVersion here (ex: UUIDv4)\n\tUUID,\n}\n\n/**\n * Delta encoded value relative to a previous node's value.\n */\nexport const EncodedCounter = Type.Object(\n\t{\n\t\trelativeTo: Type.Enum(CounterRelativeTo),\n\t\t// If not provided, delta inline in data.\n\t\tdelta: Type.Optional(Type.Number()),\n\t\tmode: Type.Enum(CounterMode),\n\t},\n\t{ additionalProperties: false },\n);\n\n/**\n * Used in {@link EncodedValueShape} for special field kind handling.\n */\nexport enum SpecialField {\n\t/**\n\t * Special case for Identifier field kind.\n\t */\n\tIdentifier = 0,\n}\n\n/**\n * Shape of a value on a node.\n *\n * Due to limitations of TypeBox and differences between JavaScript objects, TypeScript types and JSON,\n * the case where no information about the value is captured in the shape is a bit confusing.\n * In TypeBox this is allowed by the user of this type putting it in an optional property.\n * In TypeScript it is modeled using `undefined`.\n * In JavaScript the property may be missing or explicitly `undefined`.\n * In JSON this will serialize as the property being omitted.\n * In this case, the value will be encoded as either:\n * - `false` (when there is no value) OR\n * - `true, value` when there is a value.\n *\n * For a more compact encoding, there are 4 options for the shape:\n * - `true`: there is a value, and it will simply be encoded by putting it in the output buffer (so `value`).\n * - `false`: there is never a value, and it takes up no space in the output buffer.\n * - `[value]`: there is a value, and its always the same.\n * - `SpecialField.Identifier`: special case for node identifier handling.\n * Takes up no space in the output buffer: the value comes from the shape arrays's content.\n * It is wrapped in an array to differentiate value shape types.\n *\n * In the future other value shape formats may be added, likely as objects.\n *\n * @remarks\n * See {@link EncodedNodeShape} for usage.\n */\nexport const EncodedValueShape = Type.Union([\n\tType.Boolean(),\n\tType.Array(Type.Any(), { minItems: 1, maxItems: 1 }),\n\tType.Enum(SpecialField),\n\t// TODO: support delta encoding and/or special node identifier handling\n\t// EncodedCounter,\n]);\nexport type EncodedValueShape = undefined | Static<typeof EncodedValueShape>;\n\nexport const EncodedNodeShape = Type.Object(\n\t{\n\t\t/**\n\t\t * If not provided, inlined in data.\n\t\t */\n\t\ttype: Type.Optional(IdentifierOrIndex),\n\t\tvalue: Type.Optional(EncodedValueShape),\n\t\t/**\n\t\t * Fields with fixed (per key) shapes.\n\t\t * They are encoded in the order they are specified here.\n\t\t * To ensure the order is preserved, this is an array instead of an object with keys.\n\t\t */\n\t\tfields: Type.Optional(Type.Array(EncodedFieldShape)),\n\t\t/**\n\t\t * If undefined, no data. Otherwise, nested array of `[key, ...data]*`\n\t\t * Covers any fields beyond those in `fields`.\n\t\t */\n\t\textraFields: Type.Optional(ShapeIndex),\n\t},\n\t{ additionalProperties: false },\n);\n\n/**\n * Discriminated union that represents the shapes of chunks in the encoded data.\n * \"Chunk\" here refers to a chunk of tree data, rooted at a range of nodes, that is encoded as a\n * single unit in a specific format represented by one of the shapes in this union.\n *\n * The concept of \"chunk\" is same for the tree data in memory and in the encoded wire format.\n * The physical representation of the chunk may differ, but the logical structure remains the same.\n * This is similar to other such concepts in the system.\n *\n * See {@link DiscriminatedUnionDispatcher} for more information on this pattern.\n */\nexport const EncodedChunkShape = Type.Object(\n\t{\n\t\t/**\n\t\t * {@link EncodedNestedArrayShape} union member.\n\t\t */\n\t\ta: Type.Optional(EncodedNestedArrayShape),\n\t\t/**\n\t\t * {@link EncodedInlineArrayShape} union member.\n\t\t */\n\t\tb: Type.Optional(EncodedInlineArrayShape),\n\t\t/**\n\t\t * {@link EncodedNodeShape} union member.\n\t\t */\n\t\tc: Type.Optional(EncodedNodeShape),\n\t\t/**\n\t\t * {@link EncodedAnyShape} union member.\n\t\t */\n\t\td: Type.Optional(EncodedAnyShape),\n\t\t/**\n\t\t * {@link EncodedIncrementalChunkShape} union member.\n\t\t */\n\t\te: Type.Optional(EncodedIncrementalChunkShape),\n\t},\n\tunionOptions,\n);\n\nexport type EncodedChunkShape = Static<typeof EncodedChunkShape>;\n\nexport type EncodedNestedArrayShape = Static<typeof EncodedNestedArrayShape>;\nexport type EncodedInlineArrayShape = Static<typeof EncodedInlineArrayShape>;\nexport type EncodedNodeShape = Static<typeof EncodedNodeShape>;\nexport type EncodedAnyShape = Static<typeof EncodedAnyShape>;\nexport type EncodedIncrementalChunkShape = Static<typeof EncodedIncrementalChunkShape>;\n\nexport const EncodedFieldBatchV1 = EncodedFieldBatchGeneric(\n\tbrand<FieldBatchFormatVersion>(FieldBatchFormatVersion.v1),\n\tEncodedChunkShape,\n);\nexport type EncodedFieldBatchV1 = Static<typeof EncodedFieldBatchV1>;\n\nexport const EncodedFieldBatchV2 = EncodedFieldBatchGeneric(\n\tbrand<FieldBatchFormatVersion>(FieldBatchFormatVersion.v2),\n\tEncodedChunkShape,\n);\nexport type EncodedFieldBatchV2 = Static<typeof EncodedFieldBatchV2>;\n\nexport const EncodedFieldBatch = Type.Union([EncodedFieldBatchV1, EncodedFieldBatchV2]);\nexport type EncodedFieldBatch = Static<typeof EncodedFieldBatch>;\n"]}
|
|
1
|
+
{"version":3,"file":"format.js","sourceRoot":"","sources":["../../../../src/feature-libraries/chunked-forest/codec/format.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,+CAAsD;AAEtD,sDAAuD;AAEvD,yDAK4B;AAC5B,qDAAiE;AAEjE;;GAEG;AACU,QAAA,uBAAuB,GAAG,IAAA,qBAAU,EAAC,yBAAyB,EAAE;IAC5E,EAAE,EAAE,CAAC;IACL,EAAE,EAAE,CAAC;CACL,CAAC,CAAC;AAGH,0DAA0D;AAC1D,mEAAmE;A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AAI,CAAC,QAAQ,CAAC,oCAA4B,CAAC;CAC9C,EACD,uBAAY,CACZ,CAAC;AAUW,QAAA,mBAAmB,GAAG,IAAA,2CAAwB,EAC1D,+BAAuB,CAAC,EAAE,EAC1B,yBAAiB,CACjB,CAAC;AAGW,QAAA,mBAAmB,GAAG,IAAA,2CAAwB,EAC1D,+BAAuB,CAAC,EAAE,EAC1B,yBAAiB,CACjB,CAAC;AAGW,QAAA,iBAAiB,GAAG,cAAI,CAAC,KAAK,CAAC,CAAC,2BAAmB,EAAE,2BAAmB,CAAC,CAAC,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { type Static, Type } from \"@sinclair/typebox\";\n\nimport { unionOptions } from \"../../../codec/index.js\";\n\nimport {\n\tCount,\n\tEncodedFieldBatchGeneric,\n\tIdentifierOrIndex,\n\tShapeIndex,\n} from \"./formatGeneric.js\";\nimport { strictEnum, type Values } from \"../../../util/index.js\";\n\n/**\n * The format version for the field batch.\n */\nexport const FieldBatchFormatVersion = strictEnum(\"FieldBatchFormatVersion\", {\n\tv1: 1,\n\tv2: 2,\n});\nexport type FieldBatchFormatVersion = Values<typeof FieldBatchFormatVersion>;\n\n// Compatible versions used for format/version validation.\n// TODO: A proper version update policy will need to be documented.\nexport const validVersions = new Set([...Object.values(FieldBatchFormatVersion)]);\n\n/**\n * Top level length is implied from length of data array.\n * All content are of this shape.\n */\nexport const EncodedNestedArrayShape = ShapeIndex;\n\n/**\n * Inline array.\n */\nexport const EncodedInlineArrayShape = Type.Object(\n\t{\n\t\tlength: Count,\n\t\t/**\n\t\t * All entries are this shape.\n\t\t */\n\t\tshape: ShapeIndex,\n\t},\n\t{ additionalProperties: false },\n);\n\n/**\n * Encoded as `shape, ...[data for shape]`.\n *\n * Used for polymorphism.\n */\nexport const EncodedAnyShape = Type.Literal(0);\n\n/**\n * Encoded content is a {@link ChunkReferenceId}.\n * This represents the shape of a chunk that is encoded separately and is referenced by its {@link ChunkReferenceId}.\n */\nexport const EncodedIncrementalChunkShape = Type.Literal(0);\n\n/**\n * Content of the encoded field is specified by the Shape referenced by the ShapeIndex.\n * This is a tuple for conciseness.\n */\nexport const EncodedFieldShape = Type.Tuple([\n\t/**\n\t * Field key for this field.\n\t */\n\tIdentifierOrIndex,\n\t/**\n\t * Shape of data in this field.\n\t */\n\tShapeIndex,\n]);\n\nexport type EncodedFieldShape = Static<typeof EncodedFieldShape>;\n\nenum CounterRelativeTo {\n\t// Relative to previous node of same type in depth first pre-order traversal.\n\tPreviousNodeOfType_DepthFirstPreOrder,\n\t// TODO: add alternative relative mode relative to previous note at a path to allow delta encoded sequences (like points where x and y are delta encoded relative to previous points).\n}\n\nenum CounterMode {\n\tNumber,\n\t// TODO: document wrap modes and bit skipping. Note UUID subVersion here (ex: UUIDv4)\n\tUUID,\n}\n\n/**\n * Delta encoded value relative to a previous node's value.\n */\nexport const EncodedCounter = Type.Object(\n\t{\n\t\trelativeTo: Type.Enum(CounterRelativeTo),\n\t\t// If not provided, delta inline in data.\n\t\tdelta: Type.Optional(Type.Number()),\n\t\tmode: Type.Enum(CounterMode),\n\t},\n\t{ additionalProperties: false },\n);\n\n/**\n * Used in {@link EncodedValueShape} for special field kind handling.\n */\nexport enum SpecialField {\n\t/**\n\t * Special case for Identifier field kind.\n\t */\n\tIdentifier = 0,\n}\n\n/**\n * Shape of a value on a node.\n *\n * Due to limitations of TypeBox and differences between JavaScript objects, TypeScript types and JSON,\n * the case where no information about the value is captured in the shape is a bit confusing.\n * In TypeBox this is allowed by the user of this type putting it in an optional property.\n * In TypeScript it is modeled using `undefined`.\n * In JavaScript the property may be missing or explicitly `undefined`.\n * In JSON this will serialize as the property being omitted.\n * In this case, the value will be encoded as either:\n * - `false` (when there is no value) OR\n * - `true, value` when there is a value.\n *\n * For a more compact encoding, there are 4 options for the shape:\n * - `true`: there is a value, and it will simply be encoded by putting it in the output buffer (so `value`).\n * - `false`: there is never a value, and it takes up no space in the output buffer.\n * - `[value]`: there is a value, and its always the same.\n * - `SpecialField.Identifier`: special case for node identifier handling.\n * Takes up no space in the output buffer: the value comes from the shape arrays's content.\n * It is wrapped in an array to differentiate value shape types.\n *\n * In the future other value shape formats may be added, likely as objects.\n *\n * @remarks\n * See {@link EncodedNodeShape} for usage.\n */\nexport const EncodedValueShape = Type.Union([\n\tType.Boolean(),\n\tType.Array(Type.Any(), { minItems: 1, maxItems: 1 }),\n\tType.Enum(SpecialField),\n\t// TODO: support delta encoding and/or special node identifier handling\n\t// EncodedCounter,\n]);\nexport type EncodedValueShape = undefined | Static<typeof EncodedValueShape>;\n\nexport const EncodedNodeShape = Type.Object(\n\t{\n\t\t/**\n\t\t * If not provided, inlined in data.\n\t\t */\n\t\ttype: Type.Optional(IdentifierOrIndex),\n\t\tvalue: Type.Optional(EncodedValueShape),\n\t\t/**\n\t\t * Fields with fixed (per key) shapes.\n\t\t * They are encoded in the order they are specified here.\n\t\t * To ensure the order is preserved, this is an array instead of an object with keys.\n\t\t */\n\t\tfields: Type.Optional(Type.Array(EncodedFieldShape)),\n\t\t/**\n\t\t * If undefined, no data. Otherwise, nested array of `[key, ...data]*`\n\t\t * Covers any fields beyond those in `fields`.\n\t\t */\n\t\textraFields: Type.Optional(ShapeIndex),\n\t},\n\t{ additionalProperties: false },\n);\n\n/**\n * Discriminated union that represents the shapes of chunks in the encoded data.\n * \"Chunk\" here refers to a chunk of tree data, rooted at a range of nodes, that is encoded as a\n * single unit in a specific format represented by one of the shapes in this union.\n *\n * The concept of \"chunk\" is same for the tree data in memory and in the encoded wire format.\n * The physical representation of the chunk may differ, but the logical structure remains the same.\n * This is similar to other such concepts in the system.\n *\n * See {@link DiscriminatedUnionDispatcher} for more information on this pattern.\n */\nexport const EncodedChunkShape = Type.Object(\n\t{\n\t\t/**\n\t\t * {@link EncodedNestedArrayShape} union member.\n\t\t */\n\t\ta: Type.Optional(EncodedNestedArrayShape),\n\t\t/**\n\t\t * {@link EncodedInlineArrayShape} union member.\n\t\t */\n\t\tb: Type.Optional(EncodedInlineArrayShape),\n\t\t/**\n\t\t * {@link EncodedNodeShape} union member.\n\t\t */\n\t\tc: Type.Optional(EncodedNodeShape),\n\t\t/**\n\t\t * {@link EncodedAnyShape} union member.\n\t\t */\n\t\td: Type.Optional(EncodedAnyShape),\n\t\t/**\n\t\t * {@link EncodedIncrementalChunkShape} union member.\n\t\t */\n\t\te: Type.Optional(EncodedIncrementalChunkShape),\n\t},\n\tunionOptions,\n);\n\nexport type EncodedChunkShape = Static<typeof EncodedChunkShape>;\n\nexport type EncodedNestedArrayShape = Static<typeof EncodedNestedArrayShape>;\nexport type EncodedInlineArrayShape = Static<typeof EncodedInlineArrayShape>;\nexport type EncodedNodeShape = Static<typeof EncodedNodeShape>;\nexport type EncodedAnyShape = Static<typeof EncodedAnyShape>;\nexport type EncodedIncrementalChunkShape = Static<typeof EncodedIncrementalChunkShape>;\n\nexport const EncodedFieldBatchV1 = EncodedFieldBatchGeneric(\n\tFieldBatchFormatVersion.v1,\n\tEncodedChunkShape,\n);\nexport type EncodedFieldBatchV1 = Static<typeof EncodedFieldBatchV1>;\n\nexport const EncodedFieldBatchV2 = EncodedFieldBatchGeneric(\n\tFieldBatchFormatVersion.v2,\n\tEncodedChunkShape,\n);\nexport type EncodedFieldBatchV2 = Static<typeof EncodedFieldBatchV2>;\n\nexport const EncodedFieldBatch = Type.Union([EncodedFieldBatchV1, EncodedFieldBatchV2]);\nexport type EncodedFieldBatch = Static<typeof EncodedFieldBatch>;\n"]}
|
|
@@ -3,19 +3,27 @@
|
|
|
3
3
|
* Licensed under the MIT License.
|
|
4
4
|
*/
|
|
5
5
|
/**
|
|
6
|
-
* Policy to determine whether a node
|
|
7
|
-
* @param nodeIdentifier - The identifier of the node
|
|
8
|
-
*
|
|
9
|
-
*
|
|
10
|
-
* @
|
|
6
|
+
* Policy type to determine whether one of more fields of a {@link NodeKind | node} in a schema should be incrementally encoded.
|
|
7
|
+
* @param nodeIdentifier - The identifier of the node. The node is one of the kinds defined in {@link NodeKind}.
|
|
8
|
+
* @param fieldKey - An optional key for fields in the node. It must be one of the following based on the kind of node.
|
|
9
|
+
* Policy implementations may throw an error if the provided key is invalid for the node kind:
|
|
10
|
+
* - {@link NodeKind.Object | object} - Must be defined and should be the key of one of its fields. If the object node does not
|
|
11
|
+
* have a field with the specified key, returns false.
|
|
12
|
+
* - {@link NodeKind.Array | array} - Must be defined and be the "" (empty string) which is special value for arrays.
|
|
13
|
+
* - {@link NodeKind.Map | map} and {@link NodeKind.Record | record} - Must be undefined.
|
|
14
|
+
* - {@link NodeKind.Leaf | leaf} - Must be undefined. Leaf nodes do not support incremental encoding. If called for leaf nodes,
|
|
15
|
+
* returns false.
|
|
16
|
+
*
|
|
11
17
|
* @remarks
|
|
18
|
+
* See {@link incrementalEncodingPolicyForAllowedTypes} for a reference policy implementation.
|
|
19
|
+
*
|
|
12
20
|
* Incremental encoding has a significant size overhead,
|
|
13
21
|
* but allows reuse of previously encoded unchanged subtrees.
|
|
14
22
|
* Thus it should only be enabled for large subtrees which are modified infrequently.
|
|
15
23
|
* TODO: AB#9068: Measure the actual overhead.
|
|
16
24
|
* @alpha
|
|
17
25
|
*/
|
|
18
|
-
export type IncrementalEncodingPolicy = (nodeIdentifier: string | undefined, fieldKey
|
|
26
|
+
export type IncrementalEncodingPolicy = (nodeIdentifier: string | undefined, fieldKey?: string) => boolean;
|
|
19
27
|
/**
|
|
20
28
|
* Default policy for incremental encoding is to not encode incrementally.
|
|
21
29
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"incrementalEncodingPolicy.d.ts","sourceRoot":"","sources":["../../../../src/feature-libraries/chunked-forest/codec/incrementalEncodingPolicy.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH
|
|
1
|
+
{"version":3,"file":"incrementalEncodingPolicy.d.ts","sourceRoot":"","sources":["../../../../src/feature-libraries/chunked-forest/codec/incrementalEncodingPolicy.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,MAAM,MAAM,yBAAyB,GAAG,CACvC,cAAc,EAAE,MAAM,GAAG,SAAS,EAClC,QAAQ,CAAC,EAAE,MAAM,KACb,OAAO,CAAC;AAEb;;GAEG;AACH,eAAO,MAAM,gCAAgC,EAAE,yBAK9C,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"incrementalEncodingPolicy.js","sourceRoot":"","sources":["../../../../src/feature-libraries/chunked-forest/codec/incrementalEncodingPolicy.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;
|
|
1
|
+
{"version":3,"file":"incrementalEncodingPolicy.js","sourceRoot":"","sources":["../../../../src/feature-libraries/chunked-forest/codec/incrementalEncodingPolicy.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AA4BH;;GAEG;AACI,MAAM,gCAAgC,GAA8B,CAC1E,cAAkC,EAClC,QAAiB,EACP,EAAE;IACZ,OAAO,KAAK,CAAC;AACd,CAAC,CAAC;AALW,QAAA,gCAAgC,oCAK3C","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\n/**\n * Policy type to determine whether one of more fields of a {@link NodeKind | node} in a schema should be incrementally encoded.\n * @param nodeIdentifier - The identifier of the node. The node is one of the kinds defined in {@link NodeKind}.\n * @param fieldKey - An optional key for fields in the node. It must be one of the following based on the kind of node.\n * Policy implementations may throw an error if the provided key is invalid for the node kind:\n * - {@link NodeKind.Object | object} - Must be defined and should be the key of one of its fields. If the object node does not\n * have a field with the specified key, returns false.\n * - {@link NodeKind.Array | array} - Must be defined and be the \"\" (empty string) which is special value for arrays.\n * - {@link NodeKind.Map | map} and {@link NodeKind.Record | record} - Must be undefined.\n * - {@link NodeKind.Leaf | leaf} - Must be undefined. Leaf nodes do not support incremental encoding. If called for leaf nodes,\n * returns false.\n *\n * @remarks\n * See {@link incrementalEncodingPolicyForAllowedTypes} for a reference policy implementation.\n *\n * Incremental encoding has a significant size overhead,\n * but allows reuse of previously encoded unchanged subtrees.\n * Thus it should only be enabled for large subtrees which are modified infrequently.\n * TODO: AB#9068: Measure the actual overhead.\n * @alpha\n */\nexport type IncrementalEncodingPolicy = (\n\tnodeIdentifier: string | undefined,\n\tfieldKey?: string,\n) => boolean;\n\n/**\n * Default policy for incremental encoding is to not encode incrementally.\n */\nexport const defaultIncrementalEncodingPolicy: IncrementalEncodingPolicy = (\n\tnodeIdentifier: string | undefined,\n\tfieldKey?: string,\n): boolean => {\n\treturn false;\n};\n"]}
|
|
@@ -76,12 +76,13 @@ exports.getFieldEncoder = getFieldEncoder;
|
|
|
76
76
|
* Selects an encoder to use to encode nodes.
|
|
77
77
|
*/
|
|
78
78
|
function getNodeEncoder(fieldBuilder, storedSchema, schemaName, incrementalEncoder) {
|
|
79
|
+
const shouldEncodeIncrementally = incrementalEncoder?.shouldEncodeIncrementally ?? incrementalEncodingPolicy_js_1.defaultIncrementalEncodingPolicy;
|
|
79
80
|
const schema = storedSchema.nodeSchema.get(schemaName) ?? (0, internal_1.fail)(0xb53 /* missing node schema */);
|
|
81
|
+
// This handles both object and array nodes.
|
|
80
82
|
if (schema instanceof index_js_1.ObjectNodeStoredSchema) {
|
|
81
83
|
// TODO:Performance:
|
|
82
84
|
// consider moving some optional and sequence fields to extra fields if they are commonly empty
|
|
83
85
|
// to reduce encoded size.
|
|
84
|
-
const shouldEncodeIncrementally = incrementalEncoder?.shouldEncodeIncrementally ?? incrementalEncodingPolicy_js_1.defaultIncrementalEncodingPolicy;
|
|
85
86
|
const objectNodeFields = [];
|
|
86
87
|
for (const [key, field] of schema.objectNodeFields ?? []) {
|
|
87
88
|
const fieldEncoder = shouldEncodeIncrementally(schemaName, key)
|
|
@@ -99,8 +100,12 @@ function getNodeEncoder(fieldBuilder, storedSchema, schemaName, incrementalEncod
|
|
|
99
100
|
const shape = new nodeEncoder_js_1.NodeShapeBasedEncoder(schemaName, valueShapeFromSchema(schema.leafValue), [], undefined);
|
|
100
101
|
return shape;
|
|
101
102
|
}
|
|
103
|
+
// This handles both maps and record nodes.
|
|
102
104
|
if (schema instanceof index_js_1.MapNodeStoredSchema) {
|
|
103
|
-
const
|
|
105
|
+
const fieldEncoder = shouldEncodeIncrementally(schemaName)
|
|
106
|
+
? compressedEncode_js_1.incrementalFieldEncoder
|
|
107
|
+
: fieldBuilder.fieldEncoderFromSchema(schema.mapFields);
|
|
108
|
+
const shape = new nodeEncoder_js_1.NodeShapeBasedEncoder(schemaName, false, [], fieldEncoder);
|
|
104
109
|
return shape;
|
|
105
110
|
}
|
|
106
111
|
(0, internal_1.fail)(0xb54 /* unsupported node kind */);
|