@fluidframework/tree 2.101.1 → 2.103.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +8 -0
- package/api-report/tree.alpha.api.md +19 -0
- package/dist/codec/codec.d.ts +22 -53
- package/dist/codec/codec.d.ts.map +1 -1
- package/dist/codec/codec.js +7 -44
- package/dist/codec/codec.js.map +1 -1
- package/dist/codec/index.d.ts +1 -1
- package/dist/codec/index.d.ts.map +1 -1
- package/dist/codec/index.js +2 -2
- package/dist/codec/index.js.map +1 -1
- package/dist/codec/versioned/codec.d.ts +56 -28
- package/dist/codec/versioned/codec.d.ts.map +1 -1
- package/dist/codec/versioned/codec.js +29 -12
- package/dist/codec/versioned/codec.js.map +1 -1
- package/dist/codec/versioned/format.d.ts +5 -4
- package/dist/codec/versioned/format.d.ts.map +1 -1
- package/dist/codec/versioned/format.js +26 -3
- package/dist/codec/versioned/format.js.map +1 -1
- package/dist/codec/versioned/index.d.ts +1 -1
- package/dist/codec/versioned/index.d.ts.map +1 -1
- package/dist/codec/versioned/index.js +2 -2
- package/dist/codec/versioned/index.js.map +1 -1
- package/dist/core/rebase/types.d.ts +4 -3
- package/dist/core/rebase/types.d.ts.map +1 -1
- package/dist/core/rebase/types.js +27 -4
- package/dist/core/rebase/types.js.map +1 -1
- package/dist/core/schema-stored/formatV1.d.ts +16 -15
- package/dist/core/schema-stored/formatV1.d.ts.map +1 -1
- package/dist/core/schema-stored/formatV1.js +31 -8
- package/dist/core/schema-stored/formatV1.js.map +1 -1
- package/dist/core/schema-stored/formatV2.d.ts +29 -28
- package/dist/core/schema-stored/formatV2.d.ts.map +1 -1
- package/dist/core/schema-stored/formatV2.js +33 -10
- package/dist/core/schema-stored/formatV2.js.map +1 -1
- package/dist/core/tree/deltaUtil.d.ts +2 -2
- package/dist/core/tree/deltaUtil.js +2 -2
- package/dist/core/tree/deltaUtil.js.map +1 -1
- package/dist/core/tree/detachedFieldIndexCodecV1.d.ts.map +1 -1
- package/dist/core/tree/detachedFieldIndexCodecV1.js +3 -2
- package/dist/core/tree/detachedFieldIndexCodecV1.js.map +1 -1
- package/dist/core/tree/detachedFieldIndexCodecV2.d.ts.map +1 -1
- package/dist/core/tree/detachedFieldIndexCodecV2.js +4 -2
- package/dist/core/tree/detachedFieldIndexCodecV2.js.map +1 -1
- package/dist/core/tree/detachedFieldIndexCodecs.d.ts +3 -3
- package/dist/core/tree/detachedFieldIndexCodecs.d.ts.map +1 -1
- package/dist/core/tree/detachedFieldIndexCodecs.js +1 -1
- package/dist/core/tree/detachedFieldIndexCodecs.js.map +1 -1
- package/dist/core/tree/detachedFieldIndexFormatCommon.d.ts +11 -10
- package/dist/core/tree/detachedFieldIndexFormatCommon.d.ts.map +1 -1
- package/dist/core/tree/detachedFieldIndexFormatCommon.js +33 -10
- package/dist/core/tree/detachedFieldIndexFormatCommon.js.map +1 -1
- package/dist/core/tree/detachedFieldIndexFormatV2.d.ts +7 -6
- package/dist/core/tree/detachedFieldIndexFormatV2.d.ts.map +1 -1
- package/dist/core/tree/detachedFieldIndexFormatV2.js +25 -2
- package/dist/core/tree/detachedFieldIndexFormatV2.js.map +1 -1
- package/dist/core/tree/persistedTreeTextFormat.d.ts +19 -18
- package/dist/core/tree/persistedTreeTextFormat.d.ts.map +1 -1
- package/dist/core/tree/persistedTreeTextFormat.js +33 -10
- package/dist/core/tree/persistedTreeTextFormat.js.map +1 -1
- package/dist/feature-libraries/chunked-forest/chunkTree.d.ts +38 -1
- package/dist/feature-libraries/chunked-forest/chunkTree.d.ts.map +1 -1
- package/dist/feature-libraries/chunked-forest/chunkTree.js +63 -5
- package/dist/feature-libraries/chunked-forest/chunkTree.js.map +1 -1
- package/dist/feature-libraries/chunked-forest/chunkedForest.d.ts.map +1 -1
- package/dist/feature-libraries/chunked-forest/chunkedForest.js +18 -4
- package/dist/feature-libraries/chunked-forest/chunkedForest.js.map +1 -1
- package/dist/feature-libraries/chunked-forest/codec/chunkDecoding.d.ts +34 -2
- package/dist/feature-libraries/chunked-forest/codec/chunkDecoding.d.ts.map +1 -1
- package/dist/feature-libraries/chunked-forest/codec/chunkDecoding.js +106 -3
- package/dist/feature-libraries/chunked-forest/codec/chunkDecoding.js.map +1 -1
- package/dist/feature-libraries/chunked-forest/codec/codecs.d.ts +5 -5
- 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/compressedEncode.d.ts +7 -7
- package/dist/feature-libraries/chunked-forest/codec/compressedEncode.d.ts.map +1 -1
- package/dist/feature-libraries/chunked-forest/codec/compressedEncode.js.map +1 -1
- package/dist/feature-libraries/chunked-forest/codec/format/formatGeneric.d.ts +13 -12
- package/dist/feature-libraries/chunked-forest/codec/format/formatGeneric.d.ts.map +1 -1
- package/dist/feature-libraries/chunked-forest/codec/format/formatGeneric.js +36 -13
- package/dist/feature-libraries/chunked-forest/codec/format/formatGeneric.js.map +1 -1
- package/dist/feature-libraries/chunked-forest/codec/format/formatV1.d.ts +36 -35
- package/dist/feature-libraries/chunked-forest/codec/format/formatV1.d.ts.map +1 -1
- package/dist/feature-libraries/chunked-forest/codec/format/formatV1.js +41 -18
- package/dist/feature-libraries/chunked-forest/codec/format/formatV1.js.map +1 -1
- package/dist/feature-libraries/chunked-forest/codec/format/formatV2.d.ts +35 -14
- package/dist/feature-libraries/chunked-forest/codec/format/formatV2.d.ts.map +1 -1
- package/dist/feature-libraries/chunked-forest/codec/format/formatV2.js +35 -6
- package/dist/feature-libraries/chunked-forest/codec/format/formatV2.js.map +1 -1
- package/dist/feature-libraries/chunked-forest/codec/format/formatVText.d.ts +106 -0
- package/dist/feature-libraries/chunked-forest/codec/format/formatVText.d.ts.map +1 -0
- package/dist/feature-libraries/chunked-forest/codec/format/formatVText.js +67 -0
- package/dist/feature-libraries/chunked-forest/codec/format/formatVText.js.map +1 -0
- package/dist/feature-libraries/chunked-forest/codec/format/index.d.ts +2 -1
- package/dist/feature-libraries/chunked-forest/codec/format/index.d.ts.map +1 -1
- package/dist/feature-libraries/chunked-forest/codec/format/index.js +5 -1
- package/dist/feature-libraries/chunked-forest/codec/format/index.js.map +1 -1
- package/dist/feature-libraries/chunked-forest/codec/format/versions.d.ts +38 -4
- package/dist/feature-libraries/chunked-forest/codec/format/versions.d.ts.map +1 -1
- package/dist/feature-libraries/chunked-forest/codec/format/versions.js +7 -1
- package/dist/feature-libraries/chunked-forest/codec/format/versions.js.map +1 -1
- package/dist/feature-libraries/chunked-forest/codec/nodeEncoder.d.ts +7 -7
- package/dist/feature-libraries/chunked-forest/codec/nodeEncoder.d.ts.map +1 -1
- package/dist/feature-libraries/chunked-forest/codec/nodeEncoder.js +1 -2
- package/dist/feature-libraries/chunked-forest/codec/nodeEncoder.js.map +1 -1
- package/dist/feature-libraries/chunked-forest/uniformChunk.d.ts +66 -14
- package/dist/feature-libraries/chunked-forest/uniformChunk.d.ts.map +1 -1
- package/dist/feature-libraries/chunked-forest/uniformChunk.js +101 -36
- package/dist/feature-libraries/chunked-forest/uniformChunk.js.map +1 -1
- package/dist/feature-libraries/default-schema/defaultEditBuilder.d.ts.map +1 -1
- package/dist/feature-libraries/default-schema/defaultEditBuilder.js +36 -14
- package/dist/feature-libraries/default-schema/defaultEditBuilder.js.map +1 -1
- package/dist/feature-libraries/forest-summary/codec.d.ts +5 -4
- package/dist/feature-libraries/forest-summary/codec.d.ts.map +1 -1
- package/dist/feature-libraries/forest-summary/codec.js +2 -2
- package/dist/feature-libraries/forest-summary/codec.js.map +1 -1
- package/dist/feature-libraries/forest-summary/formatCommon.d.ts +6 -5
- package/dist/feature-libraries/forest-summary/formatCommon.d.ts.map +1 -1
- package/dist/feature-libraries/forest-summary/formatCommon.js +26 -3
- package/dist/feature-libraries/forest-summary/formatCommon.js.map +1 -1
- package/dist/feature-libraries/modular-schema/genericFieldKindFormat.d.ts +4 -3
- package/dist/feature-libraries/modular-schema/genericFieldKindFormat.d.ts.map +1 -1
- package/dist/feature-libraries/modular-schema/genericFieldKindFormat.js +26 -3
- package/dist/feature-libraries/modular-schema/genericFieldKindFormat.js.map +1 -1
- package/dist/feature-libraries/modular-schema/modularChangeFormatV1.d.ts +45 -44
- package/dist/feature-libraries/modular-schema/modularChangeFormatV1.d.ts.map +1 -1
- package/dist/feature-libraries/modular-schema/modularChangeFormatV1.js +48 -25
- package/dist/feature-libraries/modular-schema/modularChangeFormatV1.js.map +1 -1
- package/dist/feature-libraries/modular-schema/modularChangeFormatV2.d.ts +23 -22
- package/dist/feature-libraries/modular-schema/modularChangeFormatV2.d.ts.map +1 -1
- package/dist/feature-libraries/modular-schema/modularChangeFormatV2.js +29 -6
- package/dist/feature-libraries/modular-schema/modularChangeFormatV2.js.map +1 -1
- package/dist/feature-libraries/modular-schema/modularChangeTypes.d.ts +1 -1
- package/dist/feature-libraries/modular-schema/modularChangeTypes.d.ts.map +1 -1
- package/dist/feature-libraries/modular-schema/modularChangeTypes.js.map +1 -1
- package/dist/feature-libraries/optional-field/optionalFieldChangeFormatV1.d.ts +9 -8
- package/dist/feature-libraries/optional-field/optionalFieldChangeFormatV1.d.ts.map +1 -1
- package/dist/feature-libraries/optional-field/optionalFieldChangeFormatV1.js +31 -8
- package/dist/feature-libraries/optional-field/optionalFieldChangeFormatV1.js.map +1 -1
- package/dist/feature-libraries/optional-field/optionalFieldChangeFormatV2.d.ts +14 -13
- package/dist/feature-libraries/optional-field/optionalFieldChangeFormatV2.d.ts.map +1 -1
- package/dist/feature-libraries/optional-field/optionalFieldChangeFormatV2.js +34 -11
- package/dist/feature-libraries/optional-field/optionalFieldChangeFormatV2.js.map +1 -1
- package/dist/feature-libraries/schema-edits/schemaChangeFormat.d.ts +5 -4
- package/dist/feature-libraries/schema-edits/schemaChangeFormat.d.ts.map +1 -1
- package/dist/feature-libraries/schema-edits/schemaChangeFormat.js +25 -2
- package/dist/feature-libraries/schema-edits/schemaChangeFormat.js.map +1 -1
- package/dist/feature-libraries/schema-index/codec.d.ts +2 -2
- package/dist/feature-libraries/schema-index/codec.d.ts.map +1 -1
- package/dist/feature-libraries/schema-index/codec.js +1 -1
- package/dist/feature-libraries/schema-index/codec.js.map +1 -1
- package/dist/feature-libraries/schema-index/formatV1.d.ts +15 -14
- package/dist/feature-libraries/schema-index/formatV1.d.ts.map +1 -1
- package/dist/feature-libraries/schema-index/formatV1.js +27 -4
- package/dist/feature-libraries/schema-index/formatV1.js.map +1 -1
- package/dist/feature-libraries/schema-index/formatV2.d.ts +20 -19
- package/dist/feature-libraries/schema-index/formatV2.d.ts.map +1 -1
- package/dist/feature-libraries/schema-index/formatV2.js +27 -4
- package/dist/feature-libraries/schema-index/formatV2.js.map +1 -1
- package/dist/feature-libraries/sequence-field/compose.d.ts.map +1 -1
- package/dist/feature-libraries/sequence-field/compose.js +1 -3
- package/dist/feature-libraries/sequence-field/compose.js.map +1 -1
- package/dist/feature-libraries/sequence-field/formatV1.d.ts +283 -282
- package/dist/feature-libraries/sequence-field/formatV1.d.ts.map +1 -1
- package/dist/feature-libraries/sequence-field/formatV1.js +63 -40
- package/dist/feature-libraries/sequence-field/formatV1.js.map +1 -1
- package/dist/feature-libraries/sequence-field/formatV2.d.ts +180 -179
- package/dist/feature-libraries/sequence-field/formatV2.d.ts.map +1 -1
- package/dist/feature-libraries/sequence-field/formatV2.js +55 -32
- package/dist/feature-libraries/sequence-field/formatV2.js.map +1 -1
- package/dist/feature-libraries/sequence-field/formatV3.d.ts +126 -125
- package/dist/feature-libraries/sequence-field/formatV3.d.ts.map +1 -1
- package/dist/feature-libraries/sequence-field/formatV3.js +27 -4
- package/dist/feature-libraries/sequence-field/formatV3.js.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -1
- package/dist/index.js.map +1 -1
- package/dist/packageVersion.d.ts +1 -1
- package/dist/packageVersion.js +1 -1
- package/dist/packageVersion.js.map +1 -1
- package/dist/shared-tree/isAuditableFromOutcome.d.ts +20 -0
- package/dist/shared-tree/isAuditableFromOutcome.d.ts.map +1 -0
- package/dist/shared-tree/isAuditableFromOutcome.js +36 -0
- package/dist/shared-tree/isAuditableFromOutcome.js.map +1 -0
- 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.map +1 -1
- package/dist/shared-tree/sharedTreeChangeFormat.d.ts +8 -7
- package/dist/shared-tree/sharedTreeChangeFormat.d.ts.map +1 -1
- package/dist/shared-tree/sharedTreeChangeFormat.js +28 -5
- package/dist/shared-tree/sharedTreeChangeFormat.js.map +1 -1
- package/dist/shared-tree/treeCheckout.d.ts +5 -3
- package/dist/shared-tree/treeCheckout.d.ts.map +1 -1
- package/dist/shared-tree/treeCheckout.js +37 -8
- package/dist/shared-tree/treeCheckout.js.map +1 -1
- package/dist/shared-tree-core/editManager.d.ts +2 -2
- package/dist/shared-tree-core/editManager.d.ts.map +1 -1
- package/dist/shared-tree-core/editManager.js.map +1 -1
- package/dist/shared-tree-core/editManagerCodecs.d.ts +3 -3
- package/dist/shared-tree-core/editManagerCodecs.d.ts.map +1 -1
- package/dist/shared-tree-core/editManagerCodecs.js +2 -2
- package/dist/shared-tree-core/editManagerCodecs.js.map +1 -1
- package/dist/shared-tree-core/editManagerFormatCommons.d.ts +35 -34
- package/dist/shared-tree-core/editManagerFormatCommons.d.ts.map +1 -1
- package/dist/shared-tree-core/editManagerFormatCommons.js +39 -16
- package/dist/shared-tree-core/editManagerFormatCommons.js.map +1 -1
- package/dist/shared-tree-core/editManagerFormatV1toV4.d.ts +15 -15
- package/dist/shared-tree-core/editManagerFormatV1toV4.d.ts.map +1 -1
- package/dist/shared-tree-core/editManagerFormatV1toV4.js +33 -10
- package/dist/shared-tree-core/editManagerFormatV1toV4.js.map +1 -1
- package/dist/shared-tree-core/editManagerFormatVSharedBranches.d.ts +40 -40
- package/dist/shared-tree-core/editManagerFormatVSharedBranches.d.ts.map +1 -1
- package/dist/shared-tree-core/editManagerFormatVSharedBranches.js +27 -4
- package/dist/shared-tree-core/editManagerFormatVSharedBranches.js.map +1 -1
- package/dist/shared-tree-core/messageCodecVSharedBranches.d.ts.map +1 -1
- package/dist/shared-tree-core/messageCodecVSharedBranches.js +25 -2
- package/dist/shared-tree-core/messageCodecVSharedBranches.js.map +1 -1
- package/dist/shared-tree-core/messageCodecs.d.ts +3 -3
- package/dist/shared-tree-core/messageCodecs.d.ts.map +1 -1
- package/dist/shared-tree-core/messageCodecs.js +2 -2
- package/dist/shared-tree-core/messageCodecs.js.map +1 -1
- package/dist/shared-tree-core/messageFormatV1ToV4.d.ts +5 -5
- package/dist/shared-tree-core/messageFormatV1ToV4.d.ts.map +1 -1
- package/dist/shared-tree-core/messageFormatV1ToV4.js +31 -8
- package/dist/shared-tree-core/messageFormatV1ToV4.js.map +1 -1
- package/dist/shared-tree-core/messageFormatVSharedBranches.d.ts +7 -7
- package/dist/shared-tree-core/messageFormatVSharedBranches.d.ts.map +1 -1
- package/dist/shared-tree-core/messageFormatVSharedBranches.js +29 -6
- package/dist/shared-tree-core/messageFormatVSharedBranches.js.map +1 -1
- package/dist/simple-tree/core/treeNodeKernel.d.ts +5 -0
- package/dist/simple-tree/core/treeNodeKernel.d.ts.map +1 -1
- package/dist/simple-tree/core/treeNodeKernel.js +62 -24
- package/dist/simple-tree/core/treeNodeKernel.js.map +1 -1
- package/dist/simple-tree/simpleSchemaFormatV1.d.ts +121 -120
- package/dist/simple-tree/simpleSchemaFormatV1.d.ts.map +1 -1
- package/dist/simple-tree/simpleSchemaFormatV1.js +54 -31
- package/dist/simple-tree/simpleSchemaFormatV1.js.map +1 -1
- package/dist/text/codePointUtils.d.ts +48 -0
- package/dist/text/codePointUtils.d.ts.map +1 -0
- package/dist/text/codePointUtils.js +80 -0
- package/dist/text/codePointUtils.js.map +1 -0
- package/dist/text/index.d.ts +1 -0
- package/dist/text/index.d.ts.map +1 -1
- package/dist/text/index.js +4 -1
- package/dist/text/index.js.map +1 -1
- package/dist/text/textDomain.d.ts +93 -1
- package/dist/text/textDomain.d.ts.map +1 -1
- package/dist/text/textDomain.js +65 -8
- package/dist/text/textDomain.js.map +1 -1
- package/dist/text/textDomainFormatted.d.ts +24 -6
- package/dist/text/textDomainFormatted.d.ts.map +1 -1
- package/dist/text/textDomainFormatted.js +29 -1
- package/dist/text/textDomainFormatted.js.map +1 -1
- package/dist/treeFactory.d.ts.map +1 -1
- package/dist/treeFactory.js +9 -7
- package/dist/treeFactory.js.map +1 -1
- package/dist/util/breakable.d.ts +7 -1
- package/dist/util/breakable.d.ts.map +1 -1
- package/dist/util/breakable.js +18 -4
- package/dist/util/breakable.js.map +1 -1
- package/dist/util/typeboxBrand.d.ts +1 -1
- package/dist/util/typeboxBrand.d.ts.map +1 -1
- package/dist/util/typeboxBrand.js +26 -3
- package/dist/util/typeboxBrand.js.map +1 -1
- package/dist/util/utils.d.ts +2 -2
- package/dist/util/utils.d.ts.map +1 -1
- package/dist/util/utils.js +25 -2
- package/dist/util/utils.js.map +1 -1
- package/eslint.config.mts +44 -0
- package/lib/codec/codec.d.ts +22 -53
- package/lib/codec/codec.d.ts.map +1 -1
- package/lib/codec/codec.js +7 -44
- package/lib/codec/codec.js.map +1 -1
- package/lib/codec/index.d.ts +1 -1
- package/lib/codec/index.d.ts.map +1 -1
- package/lib/codec/index.js +1 -1
- package/lib/codec/index.js.map +1 -1
- package/lib/codec/versioned/codec.d.ts +56 -28
- package/lib/codec/versioned/codec.d.ts.map +1 -1
- package/lib/codec/versioned/codec.js +27 -10
- package/lib/codec/versioned/codec.js.map +1 -1
- package/lib/codec/versioned/format.d.ts +5 -4
- package/lib/codec/versioned/format.d.ts.map +1 -1
- package/lib/codec/versioned/format.js +1 -1
- package/lib/codec/versioned/format.js.map +1 -1
- package/lib/codec/versioned/index.d.ts +1 -1
- package/lib/codec/versioned/index.d.ts.map +1 -1
- package/lib/codec/versioned/index.js +1 -1
- package/lib/codec/versioned/index.js.map +1 -1
- package/lib/core/rebase/types.d.ts +4 -3
- package/lib/core/rebase/types.d.ts.map +1 -1
- package/lib/core/rebase/types.js +1 -1
- package/lib/core/rebase/types.js.map +1 -1
- package/lib/core/schema-stored/formatV1.d.ts +16 -15
- package/lib/core/schema-stored/formatV1.d.ts.map +1 -1
- package/lib/core/schema-stored/formatV1.js +1 -1
- package/lib/core/schema-stored/formatV1.js.map +1 -1
- package/lib/core/schema-stored/formatV2.d.ts +29 -28
- package/lib/core/schema-stored/formatV2.d.ts.map +1 -1
- package/lib/core/schema-stored/formatV2.js +1 -1
- package/lib/core/schema-stored/formatV2.js.map +1 -1
- package/lib/core/tree/deltaUtil.d.ts +2 -2
- package/lib/core/tree/deltaUtil.js +2 -2
- package/lib/core/tree/deltaUtil.js.map +1 -1
- package/lib/core/tree/detachedFieldIndexCodecV1.d.ts.map +1 -1
- package/lib/core/tree/detachedFieldIndexCodecV1.js +3 -2
- package/lib/core/tree/detachedFieldIndexCodecV1.js.map +1 -1
- package/lib/core/tree/detachedFieldIndexCodecV2.d.ts.map +1 -1
- package/lib/core/tree/detachedFieldIndexCodecV2.js +5 -3
- package/lib/core/tree/detachedFieldIndexCodecV2.js.map +1 -1
- package/lib/core/tree/detachedFieldIndexCodecs.d.ts +3 -3
- package/lib/core/tree/detachedFieldIndexCodecs.d.ts.map +1 -1
- package/lib/core/tree/detachedFieldIndexCodecs.js +2 -2
- package/lib/core/tree/detachedFieldIndexCodecs.js.map +1 -1
- package/lib/core/tree/detachedFieldIndexFormatCommon.d.ts +11 -10
- package/lib/core/tree/detachedFieldIndexFormatCommon.d.ts.map +1 -1
- package/lib/core/tree/detachedFieldIndexFormatCommon.js +1 -1
- package/lib/core/tree/detachedFieldIndexFormatCommon.js.map +1 -1
- package/lib/core/tree/detachedFieldIndexFormatV2.d.ts +7 -6
- package/lib/core/tree/detachedFieldIndexFormatV2.d.ts.map +1 -1
- package/lib/core/tree/detachedFieldIndexFormatV2.js +1 -1
- package/lib/core/tree/detachedFieldIndexFormatV2.js.map +1 -1
- package/lib/core/tree/persistedTreeTextFormat.d.ts +19 -18
- package/lib/core/tree/persistedTreeTextFormat.d.ts.map +1 -1
- package/lib/core/tree/persistedTreeTextFormat.js +1 -1
- package/lib/core/tree/persistedTreeTextFormat.js.map +1 -1
- package/lib/feature-libraries/chunked-forest/chunkTree.d.ts +38 -1
- package/lib/feature-libraries/chunked-forest/chunkTree.d.ts.map +1 -1
- package/lib/feature-libraries/chunked-forest/chunkTree.js +62 -5
- package/lib/feature-libraries/chunked-forest/chunkTree.js.map +1 -1
- package/lib/feature-libraries/chunked-forest/chunkedForest.d.ts.map +1 -1
- package/lib/feature-libraries/chunked-forest/chunkedForest.js +20 -6
- package/lib/feature-libraries/chunked-forest/chunkedForest.js.map +1 -1
- package/lib/feature-libraries/chunked-forest/codec/chunkDecoding.d.ts +34 -2
- package/lib/feature-libraries/chunked-forest/codec/chunkDecoding.d.ts.map +1 -1
- package/lib/feature-libraries/chunked-forest/codec/chunkDecoding.js +102 -2
- package/lib/feature-libraries/chunked-forest/codec/chunkDecoding.js.map +1 -1
- package/lib/feature-libraries/chunked-forest/codec/codecs.d.ts +5 -5
- 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/compressedEncode.d.ts +7 -7
- package/lib/feature-libraries/chunked-forest/codec/compressedEncode.d.ts.map +1 -1
- package/lib/feature-libraries/chunked-forest/codec/compressedEncode.js.map +1 -1
- package/lib/feature-libraries/chunked-forest/codec/format/formatGeneric.d.ts +13 -12
- package/lib/feature-libraries/chunked-forest/codec/format/formatGeneric.d.ts.map +1 -1
- package/lib/feature-libraries/chunked-forest/codec/format/formatGeneric.js +1 -1
- package/lib/feature-libraries/chunked-forest/codec/format/formatGeneric.js.map +1 -1
- package/lib/feature-libraries/chunked-forest/codec/format/formatV1.d.ts +36 -35
- package/lib/feature-libraries/chunked-forest/codec/format/formatV1.d.ts.map +1 -1
- package/lib/feature-libraries/chunked-forest/codec/format/formatV1.js +1 -1
- package/lib/feature-libraries/chunked-forest/codec/format/formatV1.js.map +1 -1
- package/lib/feature-libraries/chunked-forest/codec/format/formatV2.d.ts +35 -14
- package/lib/feature-libraries/chunked-forest/codec/format/formatV2.d.ts.map +1 -1
- package/lib/feature-libraries/chunked-forest/codec/format/formatV2.js +9 -3
- package/lib/feature-libraries/chunked-forest/codec/format/formatV2.js.map +1 -1
- package/lib/feature-libraries/chunked-forest/codec/format/formatVText.d.ts +106 -0
- package/lib/feature-libraries/chunked-forest/codec/format/formatVText.d.ts.map +1 -0
- package/lib/feature-libraries/chunked-forest/codec/format/formatVText.js +41 -0
- package/lib/feature-libraries/chunked-forest/codec/format/formatVText.js.map +1 -0
- package/lib/feature-libraries/chunked-forest/codec/format/index.d.ts +2 -1
- package/lib/feature-libraries/chunked-forest/codec/format/index.d.ts.map +1 -1
- package/lib/feature-libraries/chunked-forest/codec/format/index.js +2 -1
- package/lib/feature-libraries/chunked-forest/codec/format/index.js.map +1 -1
- package/lib/feature-libraries/chunked-forest/codec/format/versions.d.ts +38 -4
- package/lib/feature-libraries/chunked-forest/codec/format/versions.d.ts.map +1 -1
- package/lib/feature-libraries/chunked-forest/codec/format/versions.js +6 -0
- package/lib/feature-libraries/chunked-forest/codec/format/versions.js.map +1 -1
- package/lib/feature-libraries/chunked-forest/codec/nodeEncoder.d.ts +7 -7
- package/lib/feature-libraries/chunked-forest/codec/nodeEncoder.d.ts.map +1 -1
- package/lib/feature-libraries/chunked-forest/codec/nodeEncoder.js +2 -3
- package/lib/feature-libraries/chunked-forest/codec/nodeEncoder.js.map +1 -1
- package/lib/feature-libraries/chunked-forest/uniformChunk.d.ts +66 -14
- package/lib/feature-libraries/chunked-forest/uniformChunk.d.ts.map +1 -1
- package/lib/feature-libraries/chunked-forest/uniformChunk.js +101 -36
- package/lib/feature-libraries/chunked-forest/uniformChunk.js.map +1 -1
- package/lib/feature-libraries/default-schema/defaultEditBuilder.d.ts.map +1 -1
- package/lib/feature-libraries/default-schema/defaultEditBuilder.js +36 -14
- package/lib/feature-libraries/default-schema/defaultEditBuilder.js.map +1 -1
- package/lib/feature-libraries/forest-summary/codec.d.ts +5 -4
- package/lib/feature-libraries/forest-summary/codec.d.ts.map +1 -1
- package/lib/feature-libraries/forest-summary/codec.js +3 -3
- package/lib/feature-libraries/forest-summary/codec.js.map +1 -1
- package/lib/feature-libraries/forest-summary/formatCommon.d.ts +6 -5
- package/lib/feature-libraries/forest-summary/formatCommon.d.ts.map +1 -1
- package/lib/feature-libraries/forest-summary/formatCommon.js +1 -1
- package/lib/feature-libraries/forest-summary/formatCommon.js.map +1 -1
- package/lib/feature-libraries/modular-schema/genericFieldKindFormat.d.ts +4 -3
- package/lib/feature-libraries/modular-schema/genericFieldKindFormat.d.ts.map +1 -1
- package/lib/feature-libraries/modular-schema/genericFieldKindFormat.js +1 -1
- package/lib/feature-libraries/modular-schema/genericFieldKindFormat.js.map +1 -1
- package/lib/feature-libraries/modular-schema/modularChangeFormatV1.d.ts +45 -44
- package/lib/feature-libraries/modular-schema/modularChangeFormatV1.d.ts.map +1 -1
- package/lib/feature-libraries/modular-schema/modularChangeFormatV1.js +1 -1
- package/lib/feature-libraries/modular-schema/modularChangeFormatV1.js.map +1 -1
- package/lib/feature-libraries/modular-schema/modularChangeFormatV2.d.ts +23 -22
- package/lib/feature-libraries/modular-schema/modularChangeFormatV2.d.ts.map +1 -1
- package/lib/feature-libraries/modular-schema/modularChangeFormatV2.js +1 -1
- package/lib/feature-libraries/modular-schema/modularChangeFormatV2.js.map +1 -1
- package/lib/feature-libraries/modular-schema/modularChangeTypes.d.ts +1 -1
- package/lib/feature-libraries/modular-schema/modularChangeTypes.d.ts.map +1 -1
- package/lib/feature-libraries/modular-schema/modularChangeTypes.js.map +1 -1
- package/lib/feature-libraries/optional-field/optionalFieldChangeFormatV1.d.ts +9 -8
- package/lib/feature-libraries/optional-field/optionalFieldChangeFormatV1.d.ts.map +1 -1
- package/lib/feature-libraries/optional-field/optionalFieldChangeFormatV1.js +1 -1
- package/lib/feature-libraries/optional-field/optionalFieldChangeFormatV1.js.map +1 -1
- package/lib/feature-libraries/optional-field/optionalFieldChangeFormatV2.d.ts +14 -13
- package/lib/feature-libraries/optional-field/optionalFieldChangeFormatV2.d.ts.map +1 -1
- package/lib/feature-libraries/optional-field/optionalFieldChangeFormatV2.js +1 -1
- package/lib/feature-libraries/optional-field/optionalFieldChangeFormatV2.js.map +1 -1
- package/lib/feature-libraries/schema-edits/schemaChangeFormat.d.ts +5 -4
- package/lib/feature-libraries/schema-edits/schemaChangeFormat.d.ts.map +1 -1
- package/lib/feature-libraries/schema-edits/schemaChangeFormat.js +1 -1
- package/lib/feature-libraries/schema-edits/schemaChangeFormat.js.map +1 -1
- package/lib/feature-libraries/schema-index/codec.d.ts +2 -2
- package/lib/feature-libraries/schema-index/codec.d.ts.map +1 -1
- package/lib/feature-libraries/schema-index/codec.js +2 -2
- package/lib/feature-libraries/schema-index/codec.js.map +1 -1
- package/lib/feature-libraries/schema-index/formatV1.d.ts +15 -14
- package/lib/feature-libraries/schema-index/formatV1.d.ts.map +1 -1
- package/lib/feature-libraries/schema-index/formatV1.js +1 -1
- package/lib/feature-libraries/schema-index/formatV1.js.map +1 -1
- package/lib/feature-libraries/schema-index/formatV2.d.ts +20 -19
- package/lib/feature-libraries/schema-index/formatV2.d.ts.map +1 -1
- package/lib/feature-libraries/schema-index/formatV2.js +1 -1
- package/lib/feature-libraries/schema-index/formatV2.js.map +1 -1
- package/lib/feature-libraries/sequence-field/compose.d.ts.map +1 -1
- package/lib/feature-libraries/sequence-field/compose.js +1 -3
- package/lib/feature-libraries/sequence-field/compose.js.map +1 -1
- package/lib/feature-libraries/sequence-field/formatV1.d.ts +283 -282
- package/lib/feature-libraries/sequence-field/formatV1.d.ts.map +1 -1
- package/lib/feature-libraries/sequence-field/formatV1.js +1 -1
- package/lib/feature-libraries/sequence-field/formatV1.js.map +1 -1
- package/lib/feature-libraries/sequence-field/formatV2.d.ts +180 -179
- package/lib/feature-libraries/sequence-field/formatV2.d.ts.map +1 -1
- package/lib/feature-libraries/sequence-field/formatV2.js +1 -1
- package/lib/feature-libraries/sequence-field/formatV2.js.map +1 -1
- package/lib/feature-libraries/sequence-field/formatV3.d.ts +126 -125
- package/lib/feature-libraries/sequence-field/formatV3.d.ts.map +1 -1
- package/lib/feature-libraries/sequence-field/formatV3.js +1 -1
- package/lib/feature-libraries/sequence-field/formatV3.js.map +1 -1
- package/lib/index.d.ts +1 -1
- 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.js +1 -1
- package/lib/packageVersion.js.map +1 -1
- package/lib/shared-tree/isAuditableFromOutcome.d.ts +20 -0
- package/lib/shared-tree/isAuditableFromOutcome.d.ts.map +1 -0
- package/lib/shared-tree/isAuditableFromOutcome.js +32 -0
- package/lib/shared-tree/isAuditableFromOutcome.js.map +1 -0
- 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 +1 -1
- package/lib/shared-tree/sharedTree.js.map +1 -1
- package/lib/shared-tree/sharedTreeChangeFormat.d.ts +8 -7
- package/lib/shared-tree/sharedTreeChangeFormat.d.ts.map +1 -1
- package/lib/shared-tree/sharedTreeChangeFormat.js +1 -1
- package/lib/shared-tree/sharedTreeChangeFormat.js.map +1 -1
- package/lib/shared-tree/treeCheckout.d.ts +5 -3
- package/lib/shared-tree/treeCheckout.d.ts.map +1 -1
- package/lib/shared-tree/treeCheckout.js +38 -9
- package/lib/shared-tree/treeCheckout.js.map +1 -1
- package/lib/shared-tree-core/editManager.d.ts +2 -2
- package/lib/shared-tree-core/editManager.d.ts.map +1 -1
- package/lib/shared-tree-core/editManager.js.map +1 -1
- package/lib/shared-tree-core/editManagerCodecs.d.ts +3 -3
- package/lib/shared-tree-core/editManagerCodecs.d.ts.map +1 -1
- package/lib/shared-tree-core/editManagerCodecs.js +3 -3
- package/lib/shared-tree-core/editManagerCodecs.js.map +1 -1
- package/lib/shared-tree-core/editManagerFormatCommons.d.ts +35 -34
- package/lib/shared-tree-core/editManagerFormatCommons.d.ts.map +1 -1
- package/lib/shared-tree-core/editManagerFormatCommons.js +1 -1
- package/lib/shared-tree-core/editManagerFormatCommons.js.map +1 -1
- package/lib/shared-tree-core/editManagerFormatV1toV4.d.ts +15 -15
- package/lib/shared-tree-core/editManagerFormatV1toV4.d.ts.map +1 -1
- package/lib/shared-tree-core/editManagerFormatV1toV4.js +1 -1
- package/lib/shared-tree-core/editManagerFormatV1toV4.js.map +1 -1
- package/lib/shared-tree-core/editManagerFormatVSharedBranches.d.ts +40 -40
- package/lib/shared-tree-core/editManagerFormatVSharedBranches.d.ts.map +1 -1
- package/lib/shared-tree-core/editManagerFormatVSharedBranches.js +1 -1
- package/lib/shared-tree-core/editManagerFormatVSharedBranches.js.map +1 -1
- package/lib/shared-tree-core/messageCodecVSharedBranches.d.ts.map +1 -1
- package/lib/shared-tree-core/messageCodecVSharedBranches.js +1 -1
- package/lib/shared-tree-core/messageCodecVSharedBranches.js.map +1 -1
- package/lib/shared-tree-core/messageCodecs.d.ts +3 -3
- package/lib/shared-tree-core/messageCodecs.d.ts.map +1 -1
- package/lib/shared-tree-core/messageCodecs.js +3 -3
- package/lib/shared-tree-core/messageCodecs.js.map +1 -1
- package/lib/shared-tree-core/messageFormatV1ToV4.d.ts +5 -5
- package/lib/shared-tree-core/messageFormatV1ToV4.d.ts.map +1 -1
- package/lib/shared-tree-core/messageFormatV1ToV4.js +1 -1
- package/lib/shared-tree-core/messageFormatV1ToV4.js.map +1 -1
- package/lib/shared-tree-core/messageFormatVSharedBranches.d.ts +7 -7
- package/lib/shared-tree-core/messageFormatVSharedBranches.d.ts.map +1 -1
- package/lib/shared-tree-core/messageFormatVSharedBranches.js +1 -1
- package/lib/shared-tree-core/messageFormatVSharedBranches.js.map +1 -1
- package/lib/simple-tree/core/treeNodeKernel.d.ts +5 -0
- package/lib/simple-tree/core/treeNodeKernel.d.ts.map +1 -1
- package/lib/simple-tree/core/treeNodeKernel.js +60 -23
- package/lib/simple-tree/core/treeNodeKernel.js.map +1 -1
- package/lib/simple-tree/simpleSchemaFormatV1.d.ts +121 -120
- package/lib/simple-tree/simpleSchemaFormatV1.d.ts.map +1 -1
- package/lib/simple-tree/simpleSchemaFormatV1.js +1 -1
- package/lib/simple-tree/simpleSchemaFormatV1.js.map +1 -1
- package/lib/text/codePointUtils.d.ts +48 -0
- package/lib/text/codePointUtils.d.ts.map +1 -0
- package/lib/text/codePointUtils.js +75 -0
- package/lib/text/codePointUtils.js.map +1 -0
- package/lib/text/index.d.ts +1 -0
- package/lib/text/index.d.ts.map +1 -1
- package/lib/text/index.js +1 -0
- package/lib/text/index.js.map +1 -1
- package/lib/text/textDomain.d.ts +93 -1
- package/lib/text/textDomain.d.ts.map +1 -1
- package/lib/text/textDomain.js +56 -0
- package/lib/text/textDomain.js.map +1 -1
- package/lib/text/textDomainFormatted.d.ts +24 -6
- package/lib/text/textDomainFormatted.d.ts.map +1 -1
- package/lib/text/textDomainFormatted.js +30 -2
- package/lib/text/textDomainFormatted.js.map +1 -1
- package/lib/treeFactory.d.ts.map +1 -1
- package/lib/treeFactory.js +2 -0
- package/lib/treeFactory.js.map +1 -1
- package/lib/util/breakable.d.ts +7 -1
- package/lib/util/breakable.d.ts.map +1 -1
- package/lib/util/breakable.js +18 -4
- package/lib/util/breakable.js.map +1 -1
- package/lib/util/typeboxBrand.d.ts +1 -1
- package/lib/util/typeboxBrand.d.ts.map +1 -1
- package/lib/util/typeboxBrand.js +1 -1
- package/lib/util/typeboxBrand.js.map +1 -1
- package/lib/util/utils.d.ts +2 -2
- package/lib/util/utils.d.ts.map +1 -1
- package/lib/util/utils.js +1 -1
- package/lib/util/utils.js.map +1 -1
- package/package.json +24 -24
- package/src/codec/codec.ts +82 -73
- package/src/codec/index.ts +2 -1
- package/src/codec/versioned/codec.ts +173 -73
- package/src/codec/versioned/format.ts +2 -1
- package/src/codec/versioned/index.ts +2 -1
- package/src/core/rebase/types.ts +1 -1
- package/src/core/schema-stored/formatV1.ts +2 -1
- package/src/core/schema-stored/formatV2.ts +2 -1
- package/src/core/tree/deltaUtil.ts +2 -2
- package/src/core/tree/detachedFieldIndexCodecV1.ts +3 -2
- package/src/core/tree/detachedFieldIndexCodecV2.ts +5 -3
- package/src/core/tree/detachedFieldIndexCodecs.ts +2 -2
- package/src/core/tree/detachedFieldIndexFormatCommon.ts +2 -1
- package/src/core/tree/detachedFieldIndexFormatV2.ts +2 -1
- package/src/core/tree/persistedTreeTextFormat.ts +2 -1
- package/src/feature-libraries/chunked-forest/chunkTree.ts +88 -3
- package/src/feature-libraries/chunked-forest/chunkedForest.ts +27 -7
- package/src/feature-libraries/chunked-forest/codec/chunkDecoding.ts +143 -7
- package/src/feature-libraries/chunked-forest/codec/codecs.ts +30 -28
- package/src/feature-libraries/chunked-forest/codec/compressedEncode.ts +7 -7
- package/src/feature-libraries/chunked-forest/codec/format/formatGeneric.ts +2 -1
- package/src/feature-libraries/chunked-forest/codec/format/formatV1.ts +2 -1
- package/src/feature-libraries/chunked-forest/codec/format/formatV2.ts +13 -8
- package/src/feature-libraries/chunked-forest/codec/format/formatVText.ts +84 -0
- package/src/feature-libraries/chunked-forest/codec/format/index.ts +6 -1
- package/src/feature-libraries/chunked-forest/codec/format/versions.ts +25 -4
- package/src/feature-libraries/chunked-forest/codec/nodeEncoder.ts +14 -18
- package/src/feature-libraries/chunked-forest/uniformChunk.ts +131 -44
- package/src/feature-libraries/default-schema/defaultEditBuilder.ts +36 -14
- package/src/feature-libraries/forest-summary/codec.ts +9 -4
- package/src/feature-libraries/forest-summary/formatCommon.ts +2 -1
- package/src/feature-libraries/modular-schema/genericFieldKindFormat.ts +2 -1
- package/src/feature-libraries/modular-schema/modularChangeFormatV1.ts +2 -1
- package/src/feature-libraries/modular-schema/modularChangeFormatV2.ts +2 -1
- package/src/feature-libraries/modular-schema/modularChangeTypes.ts +1 -1
- package/src/feature-libraries/optional-field/optionalFieldChangeFormatV1.ts +2 -1
- package/src/feature-libraries/optional-field/optionalFieldChangeFormatV2.ts +2 -1
- package/src/feature-libraries/schema-edits/schemaChangeFormat.ts +2 -1
- package/src/feature-libraries/schema-index/codec.ts +2 -5
- package/src/feature-libraries/schema-index/formatV1.ts +2 -1
- package/src/feature-libraries/schema-index/formatV2.ts +2 -1
- package/src/feature-libraries/sequence-field/compose.ts +1 -4
- package/src/feature-libraries/sequence-field/formatV1.ts +2 -1
- package/src/feature-libraries/sequence-field/formatV2.ts +2 -1
- package/src/feature-libraries/sequence-field/formatV3.ts +2 -1
- package/src/index.ts +6 -1
- package/src/packageVersion.ts +1 -1
- package/src/shared-tree/isAuditableFromOutcome.ts +34 -0
- package/src/shared-tree/sharedTree.ts +2 -5
- package/src/shared-tree/sharedTreeChangeFormat.ts +2 -1
- package/src/shared-tree/treeCheckout.ts +55 -15
- package/src/shared-tree-core/editManager.ts +2 -2
- package/src/shared-tree-core/editManagerCodecs.ts +4 -6
- package/src/shared-tree-core/editManagerFormatCommons.ts +2 -1
- package/src/shared-tree-core/editManagerFormatV1toV4.ts +2 -1
- package/src/shared-tree-core/editManagerFormatVSharedBranches.ts +2 -1
- package/src/shared-tree-core/messageCodecVSharedBranches.ts +2 -1
- package/src/shared-tree-core/messageCodecs.ts +4 -4
- package/src/shared-tree-core/messageFormatV1ToV4.ts +2 -1
- package/src/shared-tree-core/messageFormatVSharedBranches.ts +2 -1
- package/src/simple-tree/core/treeNodeKernel.ts +66 -28
- package/src/simple-tree/simpleSchemaFormatV1.ts +2 -1
- package/src/text/codePointUtils.ts +81 -0
- package/src/text/index.ts +1 -0
- package/src/text/textDomain.ts +155 -2
- package/src/text/textDomainFormatted.ts +73 -2
- package/src/treeFactory.ts +5 -0
- package/src/util/breakable.ts +27 -6
- package/src/util/typeboxBrand.ts +2 -1
- package/src/util/utils.ts +2 -1
|
@@ -2,32 +2,53 @@
|
|
|
2
2
|
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
3
3
|
* Licensed under the MIT License.
|
|
4
4
|
*/
|
|
5
|
-
import
|
|
5
|
+
import * as Type from "@sinclair/typebox";
|
|
6
|
+
import type { Static } from "@sinclair/typebox";
|
|
6
7
|
/**
|
|
7
8
|
* Encoded content is a {@link ChunkReferenceId}.
|
|
8
9
|
* This represents the shape of a chunk that is encoded separately and is referenced by its {@link ChunkReferenceId}.
|
|
9
10
|
*/
|
|
10
11
|
export type EncodedIncrementalChunkShape = Static<typeof EncodedIncrementalChunkShape>;
|
|
11
|
-
export declare const EncodedIncrementalChunkShape:
|
|
12
|
+
export declare const EncodedIncrementalChunkShape: Type.TLiteral<0>;
|
|
13
|
+
/**
|
|
14
|
+
* The chunk shapes supported by the V2 format.
|
|
15
|
+
* @remarks
|
|
16
|
+
* See {@link EncodedChunkShapeV2}.
|
|
17
|
+
*/
|
|
18
|
+
export declare const shapesV2: {
|
|
19
|
+
readonly e: Type.TOptional<Type.TLiteral<0>>;
|
|
20
|
+
readonly a: Type.TOptional<Type.TNumber>;
|
|
21
|
+
readonly b: Type.TOptional<Type.TObject<{
|
|
22
|
+
length: Type.TNumber;
|
|
23
|
+
shape: Type.TNumber;
|
|
24
|
+
}>>;
|
|
25
|
+
readonly c: Type.TOptional<Type.TObject<{
|
|
26
|
+
type: Type.TOptional<Type.TUnion<[Type.TString, Type.TNumber]>>;
|
|
27
|
+
value: Type.TOptional<Type.TUnion<[Type.TBoolean, Type.TArray<Type.TAny>, Type.TEnum<typeof import("./formatV1.js").SpecialField>]>>;
|
|
28
|
+
fields: Type.TOptional<Type.TArray<Type.TTuple<[Type.TUnion<[Type.TString, Type.TNumber]>, Type.TNumber]>>>;
|
|
29
|
+
extraFields: Type.TOptional<Type.TNumber>;
|
|
30
|
+
}>>;
|
|
31
|
+
readonly d: Type.TOptional<Type.TLiteral<0>>;
|
|
32
|
+
};
|
|
12
33
|
/**
|
|
13
34
|
* V2 extension of {@link EncodedChunkShapeV1}.
|
|
14
35
|
* @remarks
|
|
15
36
|
* See {@link DiscriminatedUnionDispatcher} for more information on this pattern.
|
|
16
37
|
*/
|
|
17
38
|
export type EncodedChunkShapeV2 = Static<typeof EncodedChunkShapeV2>;
|
|
18
|
-
export declare const EncodedChunkShapeV2:
|
|
19
|
-
e:
|
|
20
|
-
a:
|
|
21
|
-
b:
|
|
22
|
-
length:
|
|
23
|
-
shape:
|
|
39
|
+
export declare const EncodedChunkShapeV2: Type.TObject<{
|
|
40
|
+
readonly e: Type.TOptional<Type.TLiteral<0>>;
|
|
41
|
+
readonly a: Type.TOptional<Type.TNumber>;
|
|
42
|
+
readonly b: Type.TOptional<Type.TObject<{
|
|
43
|
+
length: Type.TNumber;
|
|
44
|
+
shape: Type.TNumber;
|
|
24
45
|
}>>;
|
|
25
|
-
c:
|
|
26
|
-
type:
|
|
27
|
-
value:
|
|
28
|
-
fields:
|
|
29
|
-
extraFields:
|
|
46
|
+
readonly c: Type.TOptional<Type.TObject<{
|
|
47
|
+
type: Type.TOptional<Type.TUnion<[Type.TString, Type.TNumber]>>;
|
|
48
|
+
value: Type.TOptional<Type.TUnion<[Type.TBoolean, Type.TArray<Type.TAny>, Type.TEnum<typeof import("./formatV1.js").SpecialField>]>>;
|
|
49
|
+
fields: Type.TOptional<Type.TArray<Type.TTuple<[Type.TUnion<[Type.TString, Type.TNumber]>, Type.TNumber]>>>;
|
|
50
|
+
extraFields: Type.TOptional<Type.TNumber>;
|
|
30
51
|
}>>;
|
|
31
|
-
d:
|
|
52
|
+
readonly d: Type.TOptional<Type.TLiteral<0>>;
|
|
32
53
|
}>;
|
|
33
54
|
//# sourceMappingURL=formatV2.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"formatV2.d.ts","sourceRoot":"","sources":["../../../../../src/feature-libraries/chunked-forest/codec/format/formatV2.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,
|
|
1
|
+
{"version":3,"file":"formatV2.d.ts","sourceRoot":"","sources":["../../../../../src/feature-libraries/chunked-forest/codec/format/formatV2.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,IAAI,MAAM,mBAAmB,CAAC;AAC1C,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAMhD;;;GAGG;AACH,MAAM,MAAM,4BAA4B,GAAG,MAAM,CAAC,OAAO,4BAA4B,CAAC,CAAC;AACvF,eAAO,MAAM,4BAA4B,kBAAkB,CAAC;AAE5D;;;;GAIG;AACH,eAAO,MAAM,QAAQ;;;;;;;;;;;;;;CAGX,CAAC;AAEX;;;;GAIG;AACH,MAAM,MAAM,mBAAmB,GAAG,MAAM,CAAC,OAAO,mBAAmB,CAAC,CAAC;AACrE,eAAO,MAAM,mBAAmB;;;;;;;;;;;;;;EAAsC,CAAC"}
|
|
@@ -2,12 +2,18 @@
|
|
|
2
2
|
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
3
3
|
* Licensed under the MIT License.
|
|
4
4
|
*/
|
|
5
|
-
import
|
|
5
|
+
import * as Type from "@sinclair/typebox";
|
|
6
6
|
import { unionOptions } from "../../../../codec/index.js";
|
|
7
7
|
import { shapesV1 } from "./formatV1.js";
|
|
8
8
|
export const EncodedIncrementalChunkShape = Type.Literal(0);
|
|
9
|
-
|
|
9
|
+
/**
|
|
10
|
+
* The chunk shapes supported by the V2 format.
|
|
11
|
+
* @remarks
|
|
12
|
+
* See {@link EncodedChunkShapeV2}.
|
|
13
|
+
*/
|
|
14
|
+
export const shapesV2 = {
|
|
10
15
|
...shapesV1,
|
|
11
16
|
e: Type.Optional(EncodedIncrementalChunkShape),
|
|
12
|
-
}
|
|
17
|
+
};
|
|
18
|
+
export const EncodedChunkShapeV2 = Type.Object(shapesV2, unionOptions);
|
|
13
19
|
//# sourceMappingURL=formatV2.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"formatV2.js","sourceRoot":"","sources":["../../../../../src/feature-libraries/chunked-forest/codec/format/formatV2.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,
|
|
1
|
+
{"version":3,"file":"formatV2.js","sourceRoot":"","sources":["../../../../../src/feature-libraries/chunked-forest/codec/format/formatV2.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,IAAI,MAAM,mBAAmB,CAAC;AAG1C,OAAO,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAE1D,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAOzC,MAAM,CAAC,MAAM,4BAA4B,GAAG,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC;AAE5D;;;;GAIG;AACH,MAAM,CAAC,MAAM,QAAQ,GAAG;IACvB,GAAG,QAAQ;IACX,CAAC,EAAE,IAAI,CAAC,QAAQ,CAAC,4BAA4B,CAAC;CACrC,CAAC;AAQX,MAAM,CAAC,MAAM,mBAAmB,GAAG,IAAI,CAAC,MAAM,CAAC,QAAQ,EAAE,YAAY,CAAC,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport * as Type from \"@sinclair/typebox\";\nimport type { Static } from \"@sinclair/typebox\";\n\nimport { unionOptions } from \"../../../../codec/index.js\";\n\nimport { shapesV1 } from \"./formatV1.js\";\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 type EncodedIncrementalChunkShape = Static<typeof EncodedIncrementalChunkShape>;\nexport const EncodedIncrementalChunkShape = Type.Literal(0);\n\n/**\n * The chunk shapes supported by the V2 format.\n * @remarks\n * See {@link EncodedChunkShapeV2}.\n */\nexport const shapesV2 = {\n\t...shapesV1,\n\te: Type.Optional(EncodedIncrementalChunkShape),\n} as const;\n\n/**\n * V2 extension of {@link EncodedChunkShapeV1}.\n * @remarks\n * See {@link DiscriminatedUnionDispatcher} for more information on this pattern.\n */\nexport type EncodedChunkShapeV2 = Static<typeof EncodedChunkShapeV2>;\nexport const EncodedChunkShapeV2 = Type.Object(shapesV2, unionOptions);\n"]}
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
3
|
+
* Licensed under the MIT License.
|
|
4
|
+
*/
|
|
5
|
+
import * as Type from "@sinclair/typebox";
|
|
6
|
+
import type { Static } from "@sinclair/typebox";
|
|
7
|
+
/**
|
|
8
|
+
* A node shape that derives from another node shape by overlaying property-level overrides.
|
|
9
|
+
*
|
|
10
|
+
* @remarks
|
|
11
|
+
* Compresses runs of node shapes that differ only in a few properties: a base node shape
|
|
12
|
+
* defines the structural skeleton, and the specialization narrows specific properties.
|
|
13
|
+
*
|
|
14
|
+
* For example, a base `FormatNode` with a variable-boolean `bold` field can be specialized
|
|
15
|
+
* to a shape that pins `bold` to a constant `true` — every node decoded with the
|
|
16
|
+
* specialization contributes zero stream tokens for `bold`.
|
|
17
|
+
*
|
|
18
|
+
* Specialization rules: `type` is always inherited from the resolved base. `fields` overrides
|
|
19
|
+
* apply per-key: entries whose key matches a base field replace that entry's shape index in
|
|
20
|
+
* place; entries with new keys are appended after all base fields. For `value` and
|
|
21
|
+
* `extraFields`: if the property is absent on the wire, the base's value is inherited; if
|
|
22
|
+
* `null`, the resulting shape has no value / no extraFields (explicit clear); any other value
|
|
23
|
+
* replaces the base's.
|
|
24
|
+
*
|
|
25
|
+
* The `null` sentinel exists because JSON does not preserve `undefined`-valued properties,
|
|
26
|
+
* so override-vs-inherit cannot be discriminated by property presence after persistence.
|
|
27
|
+
*
|
|
28
|
+
* Decoded by {@link applySpecialization}.
|
|
29
|
+
*/
|
|
30
|
+
export type EncodedSpecializedNodeShape = Static<typeof EncodedSpecializedNodeShape>;
|
|
31
|
+
export declare const EncodedSpecializedNodeShape: Type.TObject<{
|
|
32
|
+
/**
|
|
33
|
+
* Index into the enclosing batch's shapes array of the shape this specializes.
|
|
34
|
+
* Must resolve to either an {@link EncodedNodeShape} or another
|
|
35
|
+
* `EncodedSpecializedNodeShape`; chains are followed transitively until a node shape
|
|
36
|
+
* is reached. This restriction is enforced at runtime, not by the schema.
|
|
37
|
+
*/
|
|
38
|
+
base: Type.TNumber;
|
|
39
|
+
/**
|
|
40
|
+
* Field-level overrides applied to the resolved base's `fields`. Entries whose key
|
|
41
|
+
* matches a base field replace that field's shape index in place; entries with new
|
|
42
|
+
* keys are appended after all base fields, in the order given here. Base field order
|
|
43
|
+
* is preserved — this is the stream consumption order at decode time, so encoders
|
|
44
|
+
* must serialize per-field tokens in the resulting field order, not in this list's order.
|
|
45
|
+
*/
|
|
46
|
+
fields: Type.TOptional<Type.TArray<Type.TTuple<[Type.TUnion<[Type.TString, Type.TNumber]>, Type.TNumber]>>>;
|
|
47
|
+
/**
|
|
48
|
+
* If absent, inherits the resolved base's value shape. If `null`, the resulting shape
|
|
49
|
+
* has no value shape (explicit clear). Any other value replaces the base's.
|
|
50
|
+
*/
|
|
51
|
+
value: Type.TOptional<Type.TUnion<[Type.TUnion<[Type.TBoolean, Type.TArray<Type.TAny>, Type.TEnum<typeof import("./formatV1.js").SpecialField>]>, Type.TNull]>>;
|
|
52
|
+
/**
|
|
53
|
+
* If absent, inherits the resolved base's extraFields shape. If `null`, the resulting
|
|
54
|
+
* shape has no extraFields (explicit clear). Any other value replaces the base's.
|
|
55
|
+
*/
|
|
56
|
+
extraFields: Type.TOptional<Type.TUnion<[Type.TNumber, Type.TNull]>>;
|
|
57
|
+
}>;
|
|
58
|
+
/**
|
|
59
|
+
* Experimental extension of {@link EncodedChunkShapeV2}.
|
|
60
|
+
* @remarks
|
|
61
|
+
* See {@link DiscriminatedUnionDispatcher} for more information on this pattern.
|
|
62
|
+
*/
|
|
63
|
+
export type EncodedChunkShapeVTextExperimental = Static<typeof EncodedChunkShapeVTextExperimental>;
|
|
64
|
+
export declare const EncodedChunkShapeVTextExperimental: Type.TObject<{
|
|
65
|
+
f: Type.TOptional<Type.TObject<{
|
|
66
|
+
/**
|
|
67
|
+
* Index into the enclosing batch's shapes array of the shape this specializes.
|
|
68
|
+
* Must resolve to either an {@link EncodedNodeShape} or another
|
|
69
|
+
* `EncodedSpecializedNodeShape`; chains are followed transitively until a node shape
|
|
70
|
+
* is reached. This restriction is enforced at runtime, not by the schema.
|
|
71
|
+
*/
|
|
72
|
+
base: Type.TNumber;
|
|
73
|
+
/**
|
|
74
|
+
* Field-level overrides applied to the resolved base's `fields`. Entries whose key
|
|
75
|
+
* matches a base field replace that field's shape index in place; entries with new
|
|
76
|
+
* keys are appended after all base fields, in the order given here. Base field order
|
|
77
|
+
* is preserved — this is the stream consumption order at decode time, so encoders
|
|
78
|
+
* must serialize per-field tokens in the resulting field order, not in this list's order.
|
|
79
|
+
*/
|
|
80
|
+
fields: Type.TOptional<Type.TArray<Type.TTuple<[Type.TUnion<[Type.TString, Type.TNumber]>, Type.TNumber]>>>;
|
|
81
|
+
/**
|
|
82
|
+
* If absent, inherits the resolved base's value shape. If `null`, the resulting shape
|
|
83
|
+
* has no value shape (explicit clear). Any other value replaces the base's.
|
|
84
|
+
*/
|
|
85
|
+
value: Type.TOptional<Type.TUnion<[Type.TUnion<[Type.TBoolean, Type.TArray<Type.TAny>, Type.TEnum<typeof import("./formatV1.js").SpecialField>]>, Type.TNull]>>;
|
|
86
|
+
/**
|
|
87
|
+
* If absent, inherits the resolved base's extraFields shape. If `null`, the resulting
|
|
88
|
+
* shape has no extraFields (explicit clear). Any other value replaces the base's.
|
|
89
|
+
*/
|
|
90
|
+
extraFields: Type.TOptional<Type.TUnion<[Type.TNumber, Type.TNull]>>;
|
|
91
|
+
}>>;
|
|
92
|
+
e: Type.TOptional<Type.TLiteral<0>>;
|
|
93
|
+
a: Type.TOptional<Type.TNumber>;
|
|
94
|
+
b: Type.TOptional<Type.TObject<{
|
|
95
|
+
length: Type.TNumber;
|
|
96
|
+
shape: Type.TNumber;
|
|
97
|
+
}>>;
|
|
98
|
+
c: Type.TOptional<Type.TObject<{
|
|
99
|
+
type: Type.TOptional<Type.TUnion<[Type.TString, Type.TNumber]>>;
|
|
100
|
+
value: Type.TOptional<Type.TUnion<[Type.TBoolean, Type.TArray<Type.TAny>, Type.TEnum<typeof import("./formatV1.js").SpecialField>]>>;
|
|
101
|
+
fields: Type.TOptional<Type.TArray<Type.TTuple<[Type.TUnion<[Type.TString, Type.TNumber]>, Type.TNumber]>>>;
|
|
102
|
+
extraFields: Type.TOptional<Type.TNumber>;
|
|
103
|
+
}>>;
|
|
104
|
+
d: Type.TOptional<Type.TLiteral<0>>;
|
|
105
|
+
}>;
|
|
106
|
+
//# sourceMappingURL=formatVText.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"formatVText.d.ts","sourceRoot":"","sources":["../../../../../src/feature-libraries/chunked-forest/codec/format/formatVText.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,IAAI,MAAM,mBAAmB,CAAC;AAC1C,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAQhD;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,MAAM,MAAM,2BAA2B,GAAG,MAAM,CAAC,OAAO,2BAA2B,CAAC,CAAC;AACrF,eAAO,MAAM,2BAA2B;IAEtC;;;;;OAKG;;IAEH;;;;;;OAMG;;IAEH;;;OAGG;;IAEH;;;OAGG;;EAIJ,CAAC;AAEF;;;;GAIG;AACH,MAAM,MAAM,kCAAkC,GAAG,MAAM,CACtD,OAAO,kCAAkC,CACzC,CAAC;AACF,eAAO,MAAM,kCAAkC;;QArC7C;;;;;WAKG;;QAEH;;;;;;WAMG;;QAEH;;;WAGG;;QAEH;;;WAGG;;;;;;;;;;;;;;;;EAoBJ,CAAC"}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
3
|
+
* Licensed under the MIT License.
|
|
4
|
+
*/
|
|
5
|
+
import * as Type from "@sinclair/typebox";
|
|
6
|
+
import { unionOptions } from "../../../../codec/index.js";
|
|
7
|
+
import { ShapeIndex } from "./formatGeneric.js";
|
|
8
|
+
import { EncodedFieldShape, EncodedValueShape } from "./formatV1.js";
|
|
9
|
+
import { shapesV2 } from "./formatV2.js";
|
|
10
|
+
export const EncodedSpecializedNodeShape = Type.Object({
|
|
11
|
+
/**
|
|
12
|
+
* Index into the enclosing batch's shapes array of the shape this specializes.
|
|
13
|
+
* Must resolve to either an {@link EncodedNodeShape} or another
|
|
14
|
+
* `EncodedSpecializedNodeShape`; chains are followed transitively until a node shape
|
|
15
|
+
* is reached. This restriction is enforced at runtime, not by the schema.
|
|
16
|
+
*/
|
|
17
|
+
base: ShapeIndex,
|
|
18
|
+
/**
|
|
19
|
+
* Field-level overrides applied to the resolved base's `fields`. Entries whose key
|
|
20
|
+
* matches a base field replace that field's shape index in place; entries with new
|
|
21
|
+
* keys are appended after all base fields, in the order given here. Base field order
|
|
22
|
+
* is preserved — this is the stream consumption order at decode time, so encoders
|
|
23
|
+
* must serialize per-field tokens in the resulting field order, not in this list's order.
|
|
24
|
+
*/
|
|
25
|
+
fields: Type.Optional(Type.Array(EncodedFieldShape)),
|
|
26
|
+
/**
|
|
27
|
+
* If absent, inherits the resolved base's value shape. If `null`, the resulting shape
|
|
28
|
+
* has no value shape (explicit clear). Any other value replaces the base's.
|
|
29
|
+
*/
|
|
30
|
+
value: Type.Optional(Type.Union([EncodedValueShape, Type.Null()])),
|
|
31
|
+
/**
|
|
32
|
+
* If absent, inherits the resolved base's extraFields shape. If `null`, the resulting
|
|
33
|
+
* shape has no extraFields (explicit clear). Any other value replaces the base's.
|
|
34
|
+
*/
|
|
35
|
+
extraFields: Type.Optional(Type.Union([ShapeIndex, Type.Null()])),
|
|
36
|
+
}, { additionalProperties: false });
|
|
37
|
+
export const EncodedChunkShapeVTextExperimental = Type.Object({
|
|
38
|
+
...shapesV2,
|
|
39
|
+
f: Type.Optional(EncodedSpecializedNodeShape),
|
|
40
|
+
}, unionOptions);
|
|
41
|
+
//# sourceMappingURL=formatVText.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"formatVText.js","sourceRoot":"","sources":["../../../../../src/feature-libraries/chunked-forest/codec/format/formatVText.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,IAAI,MAAM,mBAAmB,CAAC;AAG1C,OAAO,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAE1D,OAAO,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAChD,OAAO,EAAE,iBAAiB,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAC;AACrE,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AA0BzC,MAAM,CAAC,MAAM,2BAA2B,GAAG,IAAI,CAAC,MAAM,CACrD;IACC;;;;;OAKG;IACH,IAAI,EAAE,UAAU;IAChB;;;;;;OAMG;IACH,MAAM,EAAE,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,KAAK,CAAC,iBAAiB,CAAC,CAAC;IACpD;;;OAGG;IACH,KAAK,EAAE,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,iBAAiB,EAAE,IAAI,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC;IAClE;;;OAGG;IACH,WAAW,EAAE,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,UAAU,EAAE,IAAI,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC;CACjE,EACD,EAAE,oBAAoB,EAAE,KAAK,EAAE,CAC/B,CAAC;AAUF,MAAM,CAAC,MAAM,kCAAkC,GAAG,IAAI,CAAC,MAAM,CAC5D;IACC,GAAG,QAAQ;IACX,CAAC,EAAE,IAAI,CAAC,QAAQ,CAAC,2BAA2B,CAAC;CAC7C,EACD,YAAY,CACZ,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport * as Type from \"@sinclair/typebox\";\nimport type { Static } from \"@sinclair/typebox\";\n\nimport { unionOptions } from \"../../../../codec/index.js\";\n\nimport { ShapeIndex } from \"./formatGeneric.js\";\nimport { EncodedFieldShape, EncodedValueShape } from \"./formatV1.js\";\nimport { shapesV2 } from \"./formatV2.js\";\n\n/**\n * A node shape that derives from another node shape by overlaying property-level overrides.\n *\n * @remarks\n * Compresses runs of node shapes that differ only in a few properties: a base node shape\n * defines the structural skeleton, and the specialization narrows specific properties.\n *\n * For example, a base `FormatNode` with a variable-boolean `bold` field can be specialized\n * to a shape that pins `bold` to a constant `true` — every node decoded with the\n * specialization contributes zero stream tokens for `bold`.\n *\n * Specialization rules: `type` is always inherited from the resolved base. `fields` overrides\n * apply per-key: entries whose key matches a base field replace that entry's shape index in\n * place; entries with new keys are appended after all base fields. For `value` and\n * `extraFields`: if the property is absent on the wire, the base's value is inherited; if\n * `null`, the resulting shape has no value / no extraFields (explicit clear); any other value\n * replaces the base's.\n *\n * The `null` sentinel exists because JSON does not preserve `undefined`-valued properties,\n * so override-vs-inherit cannot be discriminated by property presence after persistence.\n *\n * Decoded by {@link applySpecialization}.\n */\nexport type EncodedSpecializedNodeShape = Static<typeof EncodedSpecializedNodeShape>;\nexport const EncodedSpecializedNodeShape = Type.Object(\n\t{\n\t\t/**\n\t\t * Index into the enclosing batch's shapes array of the shape this specializes.\n\t\t * Must resolve to either an {@link EncodedNodeShape} or another\n\t\t * `EncodedSpecializedNodeShape`; chains are followed transitively until a node shape\n\t\t * is reached. This restriction is enforced at runtime, not by the schema.\n\t\t */\n\t\tbase: ShapeIndex,\n\t\t/**\n\t\t * Field-level overrides applied to the resolved base's `fields`. Entries whose key\n\t\t * matches a base field replace that field's shape index in place; entries with new\n\t\t * keys are appended after all base fields, in the order given here. Base field order\n\t\t * is preserved — this is the stream consumption order at decode time, so encoders\n\t\t * must serialize per-field tokens in the resulting field order, not in this list's order.\n\t\t */\n\t\tfields: Type.Optional(Type.Array(EncodedFieldShape)),\n\t\t/**\n\t\t * If absent, inherits the resolved base's value shape. If `null`, the resulting shape\n\t\t * has no value shape (explicit clear). Any other value replaces the base's.\n\t\t */\n\t\tvalue: Type.Optional(Type.Union([EncodedValueShape, Type.Null()])),\n\t\t/**\n\t\t * If absent, inherits the resolved base's extraFields shape. If `null`, the resulting\n\t\t * shape has no extraFields (explicit clear). Any other value replaces the base's.\n\t\t */\n\t\textraFields: Type.Optional(Type.Union([ShapeIndex, Type.Null()])),\n\t},\n\t{ additionalProperties: false },\n);\n\n/**\n * Experimental extension of {@link EncodedChunkShapeV2}.\n * @remarks\n * See {@link DiscriminatedUnionDispatcher} for more information on this pattern.\n */\nexport type EncodedChunkShapeVTextExperimental = Static<\n\ttypeof EncodedChunkShapeVTextExperimental\n>;\nexport const EncodedChunkShapeVTextExperimental = Type.Object(\n\t{\n\t\t...shapesV2,\n\t\tf: Type.Optional(EncodedSpecializedNodeShape),\n\t},\n\tunionOptions,\n);\n"]}
|
|
@@ -5,6 +5,7 @@
|
|
|
5
5
|
export type { EncodedChunkShapeV1, EncodedInlineArrayShape, EncodedNestedArrayShape, EncodedNodeShape, EncodedValueShape, EncodedFieldShape, } from "./formatV1.js";
|
|
6
6
|
export { EncodedAnyShape, SpecialField, } from "./formatV1.js";
|
|
7
7
|
export { EncodedIncrementalChunkShape, EncodedChunkShapeV2 } from "./formatV2.js";
|
|
8
|
-
export {
|
|
8
|
+
export { EncodedChunkShapeVTextExperimental, EncodedSpecializedNodeShape, } from "./formatVText.js";
|
|
9
|
+
export { FieldBatchFormatVersion, EncodedFieldBatchV1, EncodedFieldBatchV2, EncodedFieldBatchVTextExperimental, supportsIncrementalEncoding, type EncodedFieldBatchV1OrV2, type EncodedFieldBatchV1AndV2, type EncodedChunkShape, } from "./versions.js";
|
|
9
10
|
export type { ShapeIndex, IdentifierOrIndex, EncodedFieldBatchGeneric, } from "./formatGeneric.js";
|
|
10
11
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/feature-libraries/chunked-forest/codec/format/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,YAAY,EACX,mBAAmB,EACnB,uBAAuB,EACvB,uBAAuB,EACvB,gBAAgB,EAChB,iBAAiB,EACjB,iBAAiB,GACjB,MAAM,eAAe,CAAC;AACvB,OAAO,EACN,eAAe,EACf,YAAY,GACZ,MAAM,eAAe,CAAC;AACvB,OAAO,EAAE,4BAA4B,EAAE,mBAAmB,EAAE,MAAM,eAAe,CAAC;AAClF,OAAO,EACN,uBAAuB,EACvB,mBAAmB,EACnB,mBAAmB,EACnB,2BAA2B,EAC3B,KAAK,uBAAuB,EAC5B,KAAK,wBAAwB,EAC7B,KAAK,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/feature-libraries/chunked-forest/codec/format/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,YAAY,EACX,mBAAmB,EACnB,uBAAuB,EACvB,uBAAuB,EACvB,gBAAgB,EAChB,iBAAiB,EACjB,iBAAiB,GACjB,MAAM,eAAe,CAAC;AACvB,OAAO,EACN,eAAe,EACf,YAAY,GACZ,MAAM,eAAe,CAAC;AACvB,OAAO,EAAE,4BAA4B,EAAE,mBAAmB,EAAE,MAAM,eAAe,CAAC;AAClF,OAAO,EACN,kCAAkC,EAClC,2BAA2B,GAC3B,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EACN,uBAAuB,EACvB,mBAAmB,EACnB,mBAAmB,EACnB,kCAAkC,EAClC,2BAA2B,EAC3B,KAAK,uBAAuB,EAC5B,KAAK,wBAAwB,EAC7B,KAAK,iBAAiB,GACtB,MAAM,eAAe,CAAC;AACvB,YAAY,EACX,UAAU,EACV,iBAAiB,EACjB,wBAAwB,GACxB,MAAM,oBAAoB,CAAC"}
|
|
@@ -4,5 +4,6 @@
|
|
|
4
4
|
*/
|
|
5
5
|
export { EncodedAnyShape, SpecialField, } from "./formatV1.js";
|
|
6
6
|
export { EncodedIncrementalChunkShape, EncodedChunkShapeV2 } from "./formatV2.js";
|
|
7
|
-
export {
|
|
7
|
+
export { EncodedChunkShapeVTextExperimental, EncodedSpecializedNodeShape, } from "./formatVText.js";
|
|
8
|
+
export { FieldBatchFormatVersion, EncodedFieldBatchV1, EncodedFieldBatchV2, EncodedFieldBatchVTextExperimental, supportsIncrementalEncoding, } from "./versions.js";
|
|
8
9
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/feature-libraries/chunked-forest/codec/format/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAUH,OAAO,EACN,eAAe,EACf,YAAY,GACZ,MAAM,eAAe,CAAC;AACvB,OAAO,EAAE,4BAA4B,EAAE,mBAAmB,EAAE,MAAM,eAAe,CAAC;AAClF,OAAO,EACN,uBAAuB,EACvB,mBAAmB,EACnB,mBAAmB,EACnB,2BAA2B,GAI3B,MAAM,eAAe,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nexport type {\n\tEncodedChunkShapeV1,\n\tEncodedInlineArrayShape,\n\tEncodedNestedArrayShape,\n\tEncodedNodeShape,\n\tEncodedValueShape,\n\tEncodedFieldShape,\n} from \"./formatV1.js\";\nexport {\n\tEncodedAnyShape,\n\tSpecialField,\n} from \"./formatV1.js\";\nexport { EncodedIncrementalChunkShape, EncodedChunkShapeV2 } from \"./formatV2.js\";\nexport {\n\tFieldBatchFormatVersion,\n\tEncodedFieldBatchV1,\n\tEncodedFieldBatchV2,\n\tsupportsIncrementalEncoding,\n\ttype EncodedFieldBatchV1OrV2,\n\ttype EncodedFieldBatchV1AndV2,\n\ttype
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/feature-libraries/chunked-forest/codec/format/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAUH,OAAO,EACN,eAAe,EACf,YAAY,GACZ,MAAM,eAAe,CAAC;AACvB,OAAO,EAAE,4BAA4B,EAAE,mBAAmB,EAAE,MAAM,eAAe,CAAC;AAClF,OAAO,EACN,kCAAkC,EAClC,2BAA2B,GAC3B,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EACN,uBAAuB,EACvB,mBAAmB,EACnB,mBAAmB,EACnB,kCAAkC,EAClC,2BAA2B,GAI3B,MAAM,eAAe,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nexport type {\n\tEncodedChunkShapeV1,\n\tEncodedInlineArrayShape,\n\tEncodedNestedArrayShape,\n\tEncodedNodeShape,\n\tEncodedValueShape,\n\tEncodedFieldShape,\n} from \"./formatV1.js\";\nexport {\n\tEncodedAnyShape,\n\tSpecialField,\n} from \"./formatV1.js\";\nexport { EncodedIncrementalChunkShape, EncodedChunkShapeV2 } from \"./formatV2.js\";\nexport {\n\tEncodedChunkShapeVTextExperimental,\n\tEncodedSpecializedNodeShape,\n} from \"./formatVText.js\";\nexport {\n\tFieldBatchFormatVersion,\n\tEncodedFieldBatchV1,\n\tEncodedFieldBatchV2,\n\tEncodedFieldBatchVTextExperimental,\n\tsupportsIncrementalEncoding,\n\ttype EncodedFieldBatchV1OrV2,\n\ttype EncodedFieldBatchV1AndV2,\n\ttype EncodedChunkShape,\n} from \"./versions.js\";\nexport type {\n\tShapeIndex,\n\tIdentifierOrIndex,\n\tEncodedFieldBatchGeneric,\n} from \"./formatGeneric.js\";\n"]}
|
|
@@ -6,6 +6,7 @@ import type { Static } from "@sinclair/typebox";
|
|
|
6
6
|
import { type Values } from "../../../../util/index.js";
|
|
7
7
|
import { EncodedChunkShapeV1 } from "./formatV1.js";
|
|
8
8
|
import { EncodedChunkShapeV2 } from "./formatV2.js";
|
|
9
|
+
import { EncodedChunkShapeVTextExperimental } from "./formatVText.js";
|
|
9
10
|
/**
|
|
10
11
|
* The format version for the field batch.
|
|
11
12
|
*/
|
|
@@ -13,6 +14,7 @@ export type FieldBatchFormatVersion = Values<typeof FieldBatchFormatVersion>;
|
|
|
13
14
|
export declare const FieldBatchFormatVersion: {
|
|
14
15
|
readonly v1: import("../../../../util/brand.js").Brand<1, "FieldBatchFormatVersion">;
|
|
15
16
|
readonly v2: import("../../../../util/brand.js").Brand<2, "FieldBatchFormatVersion">;
|
|
17
|
+
readonly vTextExperimental: import("../../../../util/brand.js").Brand<"text", "FieldBatchFormatVersion">;
|
|
16
18
|
};
|
|
17
19
|
/**
|
|
18
20
|
* Whether the given format version supports incremental chunk encoding.
|
|
@@ -59,6 +61,36 @@ export declare const EncodedFieldBatchV2: import("@sinclair/typebox").TObject<{
|
|
|
59
61
|
identifiers: import("@sinclair/typebox").TArray<import("@sinclair/typebox").TString>;
|
|
60
62
|
version: import("@sinclair/typebox").TLiteral<FieldBatchFormatVersion>;
|
|
61
63
|
shapes: import("@sinclair/typebox").TArray<import("@sinclair/typebox").TObject<{
|
|
64
|
+
readonly e: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TLiteral<0>>;
|
|
65
|
+
readonly a: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TNumber>;
|
|
66
|
+
readonly b: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TObject<{
|
|
67
|
+
length: import("@sinclair/typebox").TNumber;
|
|
68
|
+
shape: import("@sinclair/typebox").TNumber;
|
|
69
|
+
}>>;
|
|
70
|
+
readonly c: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TObject<{
|
|
71
|
+
type: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TString, import("@sinclair/typebox").TNumber]>>;
|
|
72
|
+
value: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TBoolean, import("@sinclair/typebox").TArray<import("@sinclair/typebox").TAny>, import("@sinclair/typebox").TEnum<typeof import("./formatV1.js").SpecialField>]>>;
|
|
73
|
+
fields: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TArray<import("@sinclair/typebox").TTuple<[import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TString, import("@sinclair/typebox").TNumber]>, import("@sinclair/typebox").TNumber]>>>;
|
|
74
|
+
extraFields: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TNumber>;
|
|
75
|
+
}>>;
|
|
76
|
+
readonly d: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TLiteral<0>>;
|
|
77
|
+
}>>;
|
|
78
|
+
}>;
|
|
79
|
+
/**
|
|
80
|
+
* Encoded {@link FieldBatch} using the experimental text optimized format.
|
|
81
|
+
*/
|
|
82
|
+
export type EncodedFieldBatchVTextExperimental = Static<typeof EncodedFieldBatchVTextExperimental>;
|
|
83
|
+
export declare const EncodedFieldBatchVTextExperimental: import("@sinclair/typebox").TObject<{
|
|
84
|
+
data: import("@sinclair/typebox").TArray<import("@sinclair/typebox").TArray<import("@sinclair/typebox").TAny>>;
|
|
85
|
+
identifiers: import("@sinclair/typebox").TArray<import("@sinclair/typebox").TString>;
|
|
86
|
+
version: import("@sinclair/typebox").TLiteral<FieldBatchFormatVersion>;
|
|
87
|
+
shapes: import("@sinclair/typebox").TArray<import("@sinclair/typebox").TObject<{
|
|
88
|
+
f: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TObject<{
|
|
89
|
+
base: import("@sinclair/typebox").TNumber;
|
|
90
|
+
fields: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TArray<import("@sinclair/typebox").TTuple<[import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TString, import("@sinclair/typebox").TNumber]>, import("@sinclair/typebox").TNumber]>>>;
|
|
91
|
+
value: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TBoolean, import("@sinclair/typebox").TArray<import("@sinclair/typebox").TAny>, import("@sinclair/typebox").TEnum<typeof import("./formatV1.js").SpecialField>]>, import("@sinclair/typebox").TNull]>>;
|
|
92
|
+
extraFields: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TNumber, import("@sinclair/typebox").TNull]>>;
|
|
93
|
+
}>>;
|
|
62
94
|
e: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TLiteral<0>>;
|
|
63
95
|
a: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TNumber>;
|
|
64
96
|
b: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TObject<{
|
|
@@ -92,10 +124,12 @@ export type EncodedFieldBatchV1OrV2 = EncodedFieldBatchV1 | EncodedFieldBatchV2;
|
|
|
92
124
|
*/
|
|
93
125
|
export type EncodedFieldBatchV1AndV2 = EncodedFieldBatchV1 & EncodedFieldBatchV2;
|
|
94
126
|
/**
|
|
95
|
-
*
|
|
127
|
+
* An encoded chunk shape from any known {@link FieldBatchFormatVersion}.
|
|
128
|
+
*
|
|
96
129
|
* @remarks
|
|
97
|
-
*
|
|
98
|
-
*
|
|
130
|
+
* Use this when working with chunk shapes uniformly across versions — for example, in the
|
|
131
|
+
* shared decoder dispatcher and in encoder shape base classes. New format versions should
|
|
132
|
+
* add their chunk shape variant to this union.
|
|
99
133
|
*/
|
|
100
|
-
export type
|
|
134
|
+
export type EncodedChunkShape = EncodedChunkShapeV1 | EncodedChunkShapeV2 | EncodedChunkShapeVTextExperimental;
|
|
101
135
|
//# sourceMappingURL=versions.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"versions.d.ts","sourceRoot":"","sources":["../../../../../src/feature-libraries/chunked-forest/codec/format/versions.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAEhD,OAAO,EAAc,KAAK,MAAM,EAAE,MAAM,2BAA2B,CAAC;AAGpE,OAAO,EAAE,mBAAmB,EAAE,MAAM,eAAe,CAAC;AACpD,OAAO,EAAE,mBAAmB,EAAE,MAAM,eAAe,CAAC;
|
|
1
|
+
{"version":3,"file":"versions.d.ts","sourceRoot":"","sources":["../../../../../src/feature-libraries/chunked-forest/codec/format/versions.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAEhD,OAAO,EAAc,KAAK,MAAM,EAAE,MAAM,2BAA2B,CAAC;AAGpE,OAAO,EAAE,mBAAmB,EAAE,MAAM,eAAe,CAAC;AACpD,OAAO,EAAE,mBAAmB,EAAE,MAAM,eAAe,CAAC;AACpD,OAAO,EAAE,kCAAkC,EAAE,MAAM,kBAAkB,CAAC;AAEtE;;GAEG;AACH,MAAM,MAAM,uBAAuB,GAAG,MAAM,CAAC,OAAO,uBAAuB,CAAC,CAAC;AAC7E,eAAO,MAAM,uBAAuB;;;;CAkBlC,CAAC;AAEH;;;;;;GAMG;AACH,wBAAgB,2BAA2B,CAAC,OAAO,EAAE,uBAAuB,GAAG,OAAO,CAMrF;AAED;;;;GAIG;AACH,MAAM,MAAM,mBAAmB,GAAG,MAAM,CAAC,OAAO,mBAAmB,CAAC,CAAC;AACrE,eAAO,MAAM,mBAAmB;;;;;;;;;;;;;;;;;;;EAG/B,CAAC;AAEF;;;;GAIG;AACH,MAAM,MAAM,mBAAmB,GAAG,MAAM,CAAC,OAAO,mBAAmB,CAAC,CAAC;AACrE,eAAO,MAAM,mBAAmB;;;;;;;;;;;;;;;;;;;EAG/B,CAAC;AAEF;;GAEG;AACH,MAAM,MAAM,kCAAkC,GAAG,MAAM,CACtD,OAAO,kCAAkC,CACzC,CAAC;AACF,eAAO,MAAM,kCAAkC;;;;;;;;;;;;;;;;;;;;;;;;;EAG9C,CAAC;AAEF;;;;;GAKG;AACH,MAAM,MAAM,uBAAuB,GAAG,mBAAmB,GAAG,mBAAmB,CAAC;AAEhF;;;;;;;;GAQG;AACH,MAAM,MAAM,wBAAwB,GAAG,mBAAmB,GAAG,mBAAmB,CAAC;AAEjF;;;;;;;GAOG;AACH,MAAM,MAAM,iBAAiB,GAC1B,mBAAmB,GACnB,mBAAmB,GACnB,kCAAkC,CAAC"}
|
|
@@ -6,6 +6,7 @@ import { strictEnum } from "../../../../util/index.js";
|
|
|
6
6
|
import { EncodedFieldBatchGeneric } from "./formatGeneric.js";
|
|
7
7
|
import { EncodedChunkShapeV1 } from "./formatV1.js";
|
|
8
8
|
import { EncodedChunkShapeV2 } from "./formatV2.js";
|
|
9
|
+
import { EncodedChunkShapeVTextExperimental } from "./formatVText.js";
|
|
9
10
|
export const FieldBatchFormatVersion = strictEnum("FieldBatchFormatVersion", {
|
|
10
11
|
/**
|
|
11
12
|
* Initial version.
|
|
@@ -20,6 +21,10 @@ export const FieldBatchFormatVersion = strictEnum("FieldBatchFormatVersion", {
|
|
|
20
21
|
* {@link EncodedIncrementalChunkShape} was added in this version.
|
|
21
22
|
*/
|
|
22
23
|
v2: 2,
|
|
24
|
+
/**
|
|
25
|
+
* Experimental codec with optimizations for text.
|
|
26
|
+
*/
|
|
27
|
+
vTextExperimental: "text",
|
|
23
28
|
});
|
|
24
29
|
/**
|
|
25
30
|
* Whether the given format version supports incremental chunk encoding.
|
|
@@ -36,4 +41,5 @@ export function supportsIncrementalEncoding(version) {
|
|
|
36
41
|
}
|
|
37
42
|
export const EncodedFieldBatchV1 = EncodedFieldBatchGeneric(FieldBatchFormatVersion.v1, EncodedChunkShapeV1);
|
|
38
43
|
export const EncodedFieldBatchV2 = EncodedFieldBatchGeneric(FieldBatchFormatVersion.v2, EncodedChunkShapeV2);
|
|
44
|
+
export const EncodedFieldBatchVTextExperimental = EncodedFieldBatchGeneric(FieldBatchFormatVersion.vTextExperimental, EncodedChunkShapeVTextExperimental);
|
|
39
45
|
//# sourceMappingURL=versions.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"versions.js","sourceRoot":"","sources":["../../../../../src/feature-libraries/chunked-forest/codec/format/versions.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAIH,OAAO,EAAE,UAAU,EAAe,MAAM,2BAA2B,CAAC;AAEpE,OAAO,EAAE,wBAAwB,EAAE,MAAM,oBAAoB,CAAC;AAC9D,OAAO,EAAE,mBAAmB,EAAE,MAAM,eAAe,CAAC;AACpD,OAAO,EAAE,mBAAmB,EAAE,MAAM,eAAe,CAAC;
|
|
1
|
+
{"version":3,"file":"versions.js","sourceRoot":"","sources":["../../../../../src/feature-libraries/chunked-forest/codec/format/versions.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAIH,OAAO,EAAE,UAAU,EAAe,MAAM,2BAA2B,CAAC;AAEpE,OAAO,EAAE,wBAAwB,EAAE,MAAM,oBAAoB,CAAC;AAC9D,OAAO,EAAE,mBAAmB,EAAE,MAAM,eAAe,CAAC;AACpD,OAAO,EAAE,mBAAmB,EAAE,MAAM,eAAe,CAAC;AACpD,OAAO,EAAE,kCAAkC,EAAE,MAAM,kBAAkB,CAAC;AAMtE,MAAM,CAAC,MAAM,uBAAuB,GAAG,UAAU,CAAC,yBAAyB,EAAE;IAC5E;;;;;OAKG;IACH,EAAE,EAAE,CAAC;IACL;;;;OAIG;IACH,EAAE,EAAE,CAAC;IACL;;OAEG;IACH,iBAAiB,EAAE,MAAM;CACzB,CAAC,CAAC;AAEH;;;;;;GAMG;AACH,MAAM,UAAU,2BAA2B,CAAC,OAAgC;IAC3E,IAAI,OAAO,KAAK,uBAAuB,CAAC,EAAE,EAAE,CAAC;QAC5C,OAAO,KAAK,CAAC;IACd,CAAC;IAED,OAAO,IAAI,CAAC;AACb,CAAC;AAQD,MAAM,CAAC,MAAM,mBAAmB,GAAG,wBAAwB,CAC1D,uBAAuB,CAAC,EAAE,EAC1B,mBAAmB,CACnB,CAAC;AAQF,MAAM,CAAC,MAAM,mBAAmB,GAAG,wBAAwB,CAC1D,uBAAuB,CAAC,EAAE,EAC1B,mBAAmB,CACnB,CAAC;AAQF,MAAM,CAAC,MAAM,kCAAkC,GAAG,wBAAwB,CACzE,uBAAuB,CAAC,iBAAiB,EACzC,kCAAkC,CAClC,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport type { Static } from \"@sinclair/typebox\";\n\nimport { strictEnum, type Values } from \"../../../../util/index.js\";\n\nimport { EncodedFieldBatchGeneric } from \"./formatGeneric.js\";\nimport { EncodedChunkShapeV1 } from \"./formatV1.js\";\nimport { EncodedChunkShapeV2 } from \"./formatV2.js\";\nimport { EncodedChunkShapeVTextExperimental } from \"./formatVText.js\";\n\n/**\n * The format version for the field batch.\n */\nexport type FieldBatchFormatVersion = Values<typeof FieldBatchFormatVersion>;\nexport const FieldBatchFormatVersion = strictEnum(\"FieldBatchFormatVersion\", {\n\t/**\n\t * Initial version.\n\t * @remarks\n\t * For simplicity of implementation the format for this version allows the same chunk shapes as v2, but must not use {@link EncodedIncrementalChunkShape}\n\t * as older clients will not know how to handle that shape but think they can handle this format.\n\t */\n\tv1: 1,\n\t/**\n\t * Adds support for incremental encoding of chunks.\n\t * @remarks\n\t * {@link EncodedIncrementalChunkShape} was added in this version.\n\t */\n\tv2: 2,\n\t/**\n\t * Experimental codec with optimizations for text.\n\t */\n\tvTextExperimental: \"text\",\n});\n\n/**\n * Whether the given format version supports incremental chunk encoding.\n *\n * @remarks\n * This helper should be used for comparison since experimental versions\n * can be a string.\n */\nexport function supportsIncrementalEncoding(version: FieldBatchFormatVersion): boolean {\n\tif (version === FieldBatchFormatVersion.v1) {\n\t\treturn false;\n\t}\n\n\treturn true;\n}\n\n/**\n * Encoded {@link FieldBatch} using V1 format.\n * @remarks\n * Does not support {@link EncodedIncrementalChunkShape}.\n */\nexport type EncodedFieldBatchV1 = Static<typeof EncodedFieldBatchV1>;\nexport const EncodedFieldBatchV1 = EncodedFieldBatchGeneric(\n\tFieldBatchFormatVersion.v1,\n\tEncodedChunkShapeV1,\n);\n\n/**\n * Encoded {@link FieldBatch} using V2 format.\n * @remarks\n * Adds support for {@link EncodedIncrementalChunkShape}.\n */\nexport type EncodedFieldBatchV2 = Static<typeof EncodedFieldBatchV2>;\nexport const EncodedFieldBatchV2 = EncodedFieldBatchGeneric(\n\tFieldBatchFormatVersion.v2,\n\tEncodedChunkShapeV2,\n);\n\n/**\n * Encoded {@link FieldBatch} using the experimental text optimized format.\n */\nexport type EncodedFieldBatchVTextExperimental = Static<\n\ttypeof EncodedFieldBatchVTextExperimental\n>;\nexport const EncodedFieldBatchVTextExperimental = EncodedFieldBatchGeneric(\n\tFieldBatchFormatVersion.vTextExperimental,\n\tEncodedChunkShapeVTextExperimental,\n);\n\n/**\n * Encoded {@link FieldBatch}, which might use V2 features, but might also have been from a V1 encoder.\n * @remarks\n * Type wise, equivalent to V2, as that is a superset of V1.\n * Used instead of just V2 for clarity.\n */\nexport type EncodedFieldBatchV1OrV2 = EncodedFieldBatchV1 | EncodedFieldBatchV2;\n\n/**\n * Encoded data, compatible with both V1 and V2 formats.\n * @remarks\n * This is the intersection of the two versions, which is possible because V2 is a non-breaking extension of V1.\n * This type can be used when the code is compatible with both versions and does not need to distinguish between them.\n *\n * Type wise, equivalent to V1, as that is a subset of V2.\n * Used instead of just V1 for clarity.\n */\nexport type EncodedFieldBatchV1AndV2 = EncodedFieldBatchV1 & EncodedFieldBatchV2;\n\n/**\n * An encoded chunk shape from any known {@link FieldBatchFormatVersion}.\n *\n * @remarks\n * Use this when working with chunk shapes uniformly across versions — for example, in the\n * shared decoder dispatcher and in encoder shape base classes. New format versions should\n * add their chunk shape variant to this union.\n */\nexport type EncodedChunkShape =\n\t| EncodedChunkShapeV1\n\t| EncodedChunkShapeV2\n\t| EncodedChunkShapeVTextExperimental;\n"]}
|
|
@@ -6,14 +6,14 @@ import { type ITreeCursorSynchronous, type TreeNodeSchemaIdentifier } from "../.
|
|
|
6
6
|
import type { Counter, DeduplicationTable } from "./chunkCodecUtilities.js";
|
|
7
7
|
import { type BufferFormat, Shape } from "./chunkEncodingGeneric.js";
|
|
8
8
|
import { type EncoderContext, type FieldEncoder, type KeyedFieldEncoder, type NodeEncoder } from "./compressedEncode.js";
|
|
9
|
-
import type {
|
|
9
|
+
import type { EncodedChunkShape, EncodedFieldShape, EncodedValueShape } from "./format/index.js";
|
|
10
10
|
/**
|
|
11
11
|
* Encodes a node with the {@link EncodedNodeShape} shape.
|
|
12
12
|
* @remarks
|
|
13
13
|
* The fact this is also a Shape is an implementation detail of the encoder: that allows the shape it uses to be itself,
|
|
14
14
|
* which is an easy way to keep all the related code together without extra objects.
|
|
15
15
|
*/
|
|
16
|
-
export declare class NodeShapeBasedEncoder extends Shape<
|
|
16
|
+
export declare class NodeShapeBasedEncoder extends Shape<EncodedChunkShape> implements NodeEncoder {
|
|
17
17
|
readonly type: undefined | TreeNodeSchemaIdentifier;
|
|
18
18
|
readonly value: EncodedValueShape;
|
|
19
19
|
/**
|
|
@@ -57,10 +57,10 @@ export declare class NodeShapeBasedEncoder extends Shape<EncodedChunkShapeV1OrV2
|
|
|
57
57
|
*/
|
|
58
58
|
otherFieldsEncoder: undefined | FieldEncoder);
|
|
59
59
|
private getValueToEncode;
|
|
60
|
-
encodeNode(cursor: ITreeCursorSynchronous, context: EncoderContext, outputBuffer: BufferFormat<
|
|
61
|
-
encodeShape(identifiers: DeduplicationTable<string>, shapes: DeduplicationTable<Shape<
|
|
62
|
-
countReferencedShapesAndIdentifiers(identifiers: Counter<string>, shapeDiscovered: (shape: Shape<
|
|
63
|
-
get shape(): Shape<
|
|
60
|
+
encodeNode(cursor: ITreeCursorSynchronous, context: EncoderContext, outputBuffer: BufferFormat<EncodedChunkShape>): void;
|
|
61
|
+
encodeShape(identifiers: DeduplicationTable<string>, shapes: DeduplicationTable<Shape<EncodedChunkShape>>): EncodedChunkShape;
|
|
62
|
+
countReferencedShapesAndIdentifiers(identifiers: Counter<string>, shapeDiscovered: (shape: Shape<EncodedChunkShape>) => void): void;
|
|
63
|
+
get shape(): Shape<EncodedChunkShape>;
|
|
64
64
|
}
|
|
65
|
-
export declare function encodeFieldShapes(fieldEncoders: readonly KeyedFieldEncoder[], identifiers: DeduplicationTable<string>, shapes: DeduplicationTable<Shape<
|
|
65
|
+
export declare function encodeFieldShapes(fieldEncoders: readonly KeyedFieldEncoder[], identifiers: DeduplicationTable<string>, shapes: DeduplicationTable<Shape<EncodedChunkShape>>): EncodedFieldShape[] | undefined;
|
|
66
66
|
//# sourceMappingURL=nodeEncoder.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"nodeEncoder.d.ts","sourceRoot":"","sources":["../../../../src/feature-libraries/chunked-forest/codec/nodeEncoder.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAKH,OAAO,EAEN,KAAK,sBAAsB,EAC3B,KAAK,wBAAwB,EAG7B,MAAM,wBAAwB,CAAC;AAGhC,OAAO,KAAK,EAAE,OAAO,EAAE,kBAAkB,EAAE,MAAM,0BAA0B,CAAC;AAC5E,OAAO,EAAE,KAAK,YAAY,EAAmB,KAAK,EAAE,MAAM,2BAA2B,CAAC;AACtF,OAAO,EACN,KAAK,cAAc,EACnB,KAAK,YAAY,EACjB,KAAK,iBAAiB,EACtB,KAAK,WAAW,EAEhB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,KAAK,EACX,
|
|
1
|
+
{"version":3,"file":"nodeEncoder.d.ts","sourceRoot":"","sources":["../../../../src/feature-libraries/chunked-forest/codec/nodeEncoder.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAKH,OAAO,EAEN,KAAK,sBAAsB,EAC3B,KAA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,CAAC,EAC5B,eAAe,EAAE,CAAC,KAAK,EAAE,KAAK,CAAC,iBAAiB,CAAC,KAAK,IAAI,GACxD,IAAI;IAeP,IAAW,KAAK,IAAI,KAAK,CAAC,iBAAiB,CAAC,CAE3C;CACD;AAED,wBAAgB,iBAAiB,CAChC,aAAa,EAAE,SAAS,iBAAiB,EAAE,EAC3C,WAAW,EAAE,kBAAkB,CAAC,MAAM,CAAC,EACvC,MAAM,EAAE,kBAAkB,CAAC,KAAK,CAAC,iBAAiB,CAAC,CAAC,GAClD,iBAAiB,EAAE,GAAG,SAAS,CAUjC"}
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* Licensed under the MIT License.
|
|
4
4
|
*/
|
|
5
5
|
import { assert, fail } from "@fluidframework/core-utils/internal";
|
|
6
|
-
import { isStableId } from "@fluidframework/id-compressor/internal";
|
|
6
|
+
import { isFinalId, isStableId } from "@fluidframework/id-compressor/internal";
|
|
7
7
|
import { forEachField, } from "../../../core/index.js";
|
|
8
8
|
import { brand } from "../../../util/index.js";
|
|
9
9
|
import { IdentifierToken, Shape } from "./chunkEncodingGeneric.js";
|
|
@@ -51,8 +51,7 @@ export class NodeShapeBasedEncoder extends Shape {
|
|
|
51
51
|
// This is not the case for forest summaries at the time of writing, so non-finalized ids are instead written using
|
|
52
52
|
// their long form (by falling through to the original cursor value).
|
|
53
53
|
// A scenario where such ids can appear in the summary is in the attach summary of a tree being attached to an already-attached container.
|
|
54
|
-
|
|
55
|
-
if (!context.isSummary || opSpaceId >= 0) {
|
|
54
|
+
if (!context.isSummary || isFinalId(opSpaceId)) {
|
|
56
55
|
return opSpaceId;
|
|
57
56
|
}
|
|
58
57
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"nodeEncoder.js","sourceRoot":"","sources":["../../../../src/feature-libraries/chunked-forest/codec/nodeEncoder.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,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AC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { assert, fail } from \"@fluidframework/core-utils/internal\";\nimport { isStableId } from \"@fluidframework/id-compressor/internal\";\n\nimport {\n\ttype FieldKey,\n\ttype ITreeCursorSynchronous,\n\ttype TreeNodeSchemaIdentifier,\n\tforEachField,\n\ttype Value,\n} from \"../../../core/index.js\";\nimport { brand } from \"../../../util/index.js\";\n\nimport type { Counter, DeduplicationTable } from \"./chunkCodecUtilities.js\";\nimport { type BufferFormat, IdentifierToken, Shape } from \"./chunkEncodingGeneric.js\";\nimport {\n\ttype EncoderContext,\n\ttype FieldEncoder,\n\ttype KeyedFieldEncoder,\n\ttype NodeEncoder,\n\tencodeValue,\n} from \"./compressedEncode.js\";\nimport type {\n\tEncodedChunkShapeV1OrV2,\n\tEncodedFieldShape,\n\tEncodedValueShape,\n} from \"./format/index.js\";\n\n/**\n * Encodes a node with the {@link EncodedNodeShape} shape.\n * @remarks\n * The fact this is also a Shape is an implementation detail of the encoder: that allows the shape it uses to be itself,\n * which is an easy way to keep all the related code together without extra objects.\n */\nexport class NodeShapeBasedEncoder\n\textends Shape<EncodedChunkShapeV1OrV2>\n\timplements NodeEncoder\n{\n\t/**\n\t * Set of keys for fields that are encoded using {@link NodeShapeBasedEncoder.specializedFieldEncoders}.\n\t * TODO: Ensure uniform chunks, encoding and identifier generation sort fields the same.\n\t */\n\tprivate readonly specializedFieldKeys: Set<FieldKey>;\n\n\tpublic constructor(\n\t\tpublic readonly type: undefined | TreeNodeSchemaIdentifier,\n\t\tpublic readonly value: EncodedValueShape,\n\t\t/**\n\t\t * Encoders for a specific set of fields, by key, in the order they will be encoded.\n\t\t * These are fields for which specialized encoding is provided as an optimization.\n\t\t * Using these for a given field instead of falling back to {@link NodeShapeBasedEncoder.specializedFieldEncoders} is often more efficient:\n\t\t * this avoids the need to explicitly include the key and shape in the encoded data for each node instance.\n\t\t * Instead, this information is here, and thus is encoded only once as part of the node shape.\n\t\t * These encoders will be used, even if the field they apply to is empty (which can add overhead for fields which are usually empty).\n\t\t *\n\t\t * Any fields not included here will be encoded using {@link NodeShapeBasedEncoder.otherFieldsEncoder}.\n\t\t * If {@link NodeShapeBasedEncoder.otherFieldsEncoder} is undefined, then this must handle all non-empty fields.\n\t\t */\n\t\tpublic readonly specializedFieldEncoders: readonly KeyedFieldEncoder[],\n\t\t/**\n\t\t * Encoder for all other fields that are not in {@link NodeShapeBasedEncoder.specializedFieldEncoders}. These fields must\n\t\t * be encoded after the specialized fields.\n\t\t */\n\t\tpublic readonly otherFieldsEncoder: undefined | FieldEncoder,\n\t) {\n\t\tsuper();\n\t\tthis.specializedFieldKeys = new Set(this.specializedFieldEncoders.map((f) => f.key));\n\t}\n\n\tprivate getValueToEncode(cursor: ITreeCursorSynchronous, context: EncoderContext): Value {\n\t\tif (this.value === 0) {\n\t\t\tassert(typeof cursor.value === \"string\", 0x9aa /* identifier must be type string */);\n\t\t\tif (isStableId(cursor.value)) {\n\t\t\t\tconst sessionSpaceCompressedId = context.idCompressor.tryRecompress(cursor.value);\n\t\t\t\tif (sessionSpaceCompressedId !== undefined) {\n\t\t\t\t\tconst opSpaceId = context.idCompressor.normalizeToOpSpace(sessionSpaceCompressedId);\n\t\t\t\t\t// Summaries can only contain finalized op-space ids unless they also include the originator's session id somewhere.\n\t\t\t\t\t// This is not the case for forest summaries at the time of writing, so non-finalized ids are instead written using\n\t\t\t\t\t// their long form (by falling through to the original cursor value).\n\t\t\t\t\t// A scenario where such ids can appear in the summary is in the attach summary of a tree being attached to an already-attached container.\n\t\t\t\t\t// TODO: isFinalId should probably be exported from id-compressor and that could be used to do the narrowing here.\n\t\t\t\t\tif (!context.isSummary || opSpaceId >= 0) {\n\t\t\t\t\t\treturn opSpaceId;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\treturn cursor.value;\n\t}\n\n\tpublic encodeNode(\n\t\tcursor: ITreeCursorSynchronous,\n\t\tcontext: EncoderContext,\n\t\toutputBuffer: BufferFormat<EncodedChunkShapeV1OrV2>,\n\t): void {\n\t\tif (this.type === undefined) {\n\t\t\toutputBuffer.push(new IdentifierToken(cursor.type));\n\t\t} else {\n\t\t\tassert(cursor.type === this.type, 0x741 /* type must match shape */);\n\t\t}\n\t\tencodeValue(this.getValueToEncode(cursor, context), this.value, outputBuffer);\n\t\tfor (const fieldEncoder of this.specializedFieldEncoders) {\n\t\t\tcursor.enterField(brand(fieldEncoder.key));\n\t\t\tfieldEncoder.encoder.encodeField(cursor, context, outputBuffer);\n\t\t\tcursor.exitField();\n\t\t}\n\n\t\tconst otherFieldsBuffer: BufferFormat<EncodedChunkShapeV1OrV2> = [];\n\n\t\tforEachField(cursor, () => {\n\t\t\tconst key = cursor.getFieldKey();\n\t\t\tif (!this.specializedFieldKeys.has(key)) {\n\t\t\t\tassert(\n\t\t\t\t\tthis.otherFieldsEncoder !== undefined,\n\t\t\t\t\t0x742 /* had extra local fields when shape does not support them */,\n\t\t\t\t);\n\t\t\t\totherFieldsBuffer.push(new IdentifierToken(key));\n\t\t\t\tthis.otherFieldsEncoder.encodeField(cursor, context, otherFieldsBuffer);\n\t\t\t}\n\t\t});\n\n\t\tif (this.otherFieldsEncoder !== undefined) {\n\t\t\toutputBuffer.push(otherFieldsBuffer);\n\t\t}\n\t}\n\n\tpublic encodeShape(\n\t\tidentifiers: DeduplicationTable<string>,\n\t\tshapes: DeduplicationTable<Shape<EncodedChunkShapeV1OrV2>>,\n\t): EncodedChunkShapeV1OrV2 {\n\t\treturn {\n\t\t\tc: {\n\t\t\t\ttype: encodeOptionalIdentifier(this.type, identifiers),\n\t\t\t\tvalue: this.value,\n\t\t\t\tfields: encodeFieldShapes(this.specializedFieldEncoders, identifiers, shapes),\n\t\t\t\textraFields: encodeOptionalFieldShape(this.otherFieldsEncoder, shapes),\n\t\t\t},\n\t\t};\n\t}\n\n\tpublic countReferencedShapesAndIdentifiers(\n\t\tidentifiers: Counter<string>,\n\t\tshapeDiscovered: (shape: Shape<EncodedChunkShapeV1OrV2>) => void,\n\t): void {\n\t\tif (this.type !== undefined) {\n\t\t\tidentifiers.add(this.type);\n\t\t}\n\n\t\tfor (const fieldEncoder of this.specializedFieldEncoders) {\n\t\t\tidentifiers.add(fieldEncoder.key);\n\t\t\tshapeDiscovered(fieldEncoder.encoder.shape);\n\t\t}\n\n\t\tif (this.otherFieldsEncoder !== undefined) {\n\t\t\tshapeDiscovered(this.otherFieldsEncoder.shape);\n\t\t}\n\t}\n\n\tpublic get shape(): Shape<EncodedChunkShapeV1OrV2> {\n\t\treturn this;\n\t}\n}\n\nexport function encodeFieldShapes(\n\tfieldEncoders: readonly KeyedFieldEncoder[],\n\tidentifiers: DeduplicationTable<string>,\n\tshapes: DeduplicationTable<Shape<EncodedChunkShapeV1OrV2>>,\n): EncodedFieldShape[] | undefined {\n\tif (fieldEncoders.length === 0) {\n\t\treturn undefined;\n\t}\n\treturn fieldEncoders.map((fieldEncoder) => [\n\t\t// key\n\t\tencodeIdentifier(fieldEncoder.key, identifiers),\n\t\t// shape\n\t\tshapes.valueToIndex.get(fieldEncoder.encoder.shape) ?? fail(0xb50 /* missing shape */),\n\t]);\n}\n\nfunction encodeIdentifier(\n\tidentifier: string,\n\tidentifiers: DeduplicationTable<string>,\n): string | number {\n\treturn identifiers.valueToIndex.get(identifier) ?? identifier;\n}\n\nfunction encodeOptionalIdentifier(\n\tidentifier: string | undefined,\n\tidentifiers: DeduplicationTable<string>,\n): string | number | undefined {\n\treturn identifier === undefined ? undefined : encodeIdentifier(identifier, identifiers);\n}\n\nfunction encodeOptionalFieldShape(\n\tencoder: FieldEncoder | undefined,\n\tshapes: DeduplicationTable<Shape<EncodedChunkShapeV1OrV2>>,\n): number | undefined {\n\treturn encoder === undefined ? undefined : dedupShape(encoder.shape, shapes);\n}\n\nfunction dedupShape(\n\tshape: Shape<EncodedChunkShapeV1OrV2>,\n\tshapes: DeduplicationTable<Shape<EncodedChunkShapeV1OrV2>>,\n): number {\n\treturn shapes.valueToIndex.get(shape) ?? fail(0xb51 /* missing shape */);\n}\n"]}
|
|
1
|
+
{"version":3,"file":"nodeEncoder.js","sourceRoot":"","sources":["../../../../src/feature-libraries/chunked-forest/codec/nodeEncoder.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,qCAAqC,CAAC;AACnE,OAAO,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,wCAAwC,CAAC;AAE/E,OAAO,EAIN,YAAY,GAEZ,MAAM,wBAAwB,CAAC;AAChC,OAAO,EAAE,KAAK,EAAE,MAAM,wBAAwB,CAAC;AAG/C,OAAO,EAAqB,eAAe,EAAE,KAAK,EAAE,MAAM,2BAA2B,CAAC;AACtF,OAAO,EAKN,WAAW,GACX,MAAM,uBAAuB,CAAC;AAO/B;;;;;GAKG;AACH,MAAM,OAAO,qBAAsB,SAAQ,KAAwB;IAOlE,YACiB,IAA0C,EAC1C,KAAwB;IACxC;;;;;;;;;;OAUG;IACa,wBAAsD;IACtE;;;OAGG;IACa,kBAA4C;QAE5D,KAAK,EAAE,CAAC;QApBQ,SAAI,GAAJ,IAAI,CAAsC;QAC1C,UAAK,GAAL,KAAK,CAAmB;QAYxB,6BAAwB,GAAxB,wBAAwB,CAA8B;QAKtD,uBAAkB,GAAlB,kBAAkB,CAA0B;QAG5D,IAAI,CAAC,oBAAoB,GAAG,IAAI,GAAG,CAAC,IAAI,CAAC,wBAAwB,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC;IACtF,CAAC;IAEO,gBAAgB,CAAC,MAA8B,EAAE,OAAuB;QAC/E,IAAI,IAAI,CAAC,KAAK,KAAK,CAAC,EAAE,CAAC;YACtB,MAAM,CAAC,OAAO,MAAM,CAAC,KAAK,KAAK,QAAQ,EAAE,KAAK,CAAC,oCAAoC,CAAC,CAAC;YACrF,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,CAAC,CAAC,CAAC,UAAU,CAAC,OAAO,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC;AAC9E,CAAC;AAED,SAAS,UAAU,CAClB,KAA+B,EAC/B,MAAoD;IAEpD,OAAO,MAAM,CAAC,YAAY,CAAC,GAAG,CAAC,KAAK,CAAC,IAAI,IAAI,CAAC,KAAK,CAAC,mBAAmB,CAAC,CAAC;AAC1E,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { assert, fail } from \"@fluidframework/core-utils/internal\";\nimport { isFinalId, isStableId } from \"@fluidframework/id-compressor/internal\";\n\nimport {\n\ttype FieldKey,\n\ttype ITreeCursorSynchronous,\n\ttype TreeNodeSchemaIdentifier,\n\tforEachField,\n\ttype Value,\n} from \"../../../core/index.js\";\nimport { brand } from \"../../../util/index.js\";\n\nimport type { Counter, DeduplicationTable } from \"./chunkCodecUtilities.js\";\nimport { type BufferFormat, IdentifierToken, Shape } from \"./chunkEncodingGeneric.js\";\nimport {\n\ttype EncoderContext,\n\ttype FieldEncoder,\n\ttype KeyedFieldEncoder,\n\ttype NodeEncoder,\n\tencodeValue,\n} from \"./compressedEncode.js\";\nimport type {\n\tEncodedChunkShape,\n\tEncodedFieldShape,\n\tEncodedValueShape,\n} from \"./format/index.js\";\n\n/**\n * Encodes a node with the {@link EncodedNodeShape} shape.\n * @remarks\n * The fact this is also a Shape is an implementation detail of the encoder: that allows the shape it uses to be itself,\n * which is an easy way to keep all the related code together without extra objects.\n */\nexport class NodeShapeBasedEncoder extends Shape<EncodedChunkShape> implements NodeEncoder {\n\t/**\n\t * Set of keys for fields that are encoded using {@link NodeShapeBasedEncoder.specializedFieldEncoders}.\n\t * TODO: Ensure uniform chunks, encoding and identifier generation sort fields the same.\n\t */\n\tprivate readonly specializedFieldKeys: Set<FieldKey>;\n\n\tpublic constructor(\n\t\tpublic readonly type: undefined | TreeNodeSchemaIdentifier,\n\t\tpublic readonly value: EncodedValueShape,\n\t\t/**\n\t\t * Encoders for a specific set of fields, by key, in the order they will be encoded.\n\t\t * These are fields for which specialized encoding is provided as an optimization.\n\t\t * Using these for a given field instead of falling back to {@link NodeShapeBasedEncoder.specializedFieldEncoders} is often more efficient:\n\t\t * this avoids the need to explicitly include the key and shape in the encoded data for each node instance.\n\t\t * Instead, this information is here, and thus is encoded only once as part of the node shape.\n\t\t * These encoders will be used, even if the field they apply to is empty (which can add overhead for fields which are usually empty).\n\t\t *\n\t\t * Any fields not included here will be encoded using {@link NodeShapeBasedEncoder.otherFieldsEncoder}.\n\t\t * If {@link NodeShapeBasedEncoder.otherFieldsEncoder} is undefined, then this must handle all non-empty fields.\n\t\t */\n\t\tpublic readonly specializedFieldEncoders: readonly KeyedFieldEncoder[],\n\t\t/**\n\t\t * Encoder for all other fields that are not in {@link NodeShapeBasedEncoder.specializedFieldEncoders}. These fields must\n\t\t * be encoded after the specialized fields.\n\t\t */\n\t\tpublic readonly otherFieldsEncoder: undefined | FieldEncoder,\n\t) {\n\t\tsuper();\n\t\tthis.specializedFieldKeys = new Set(this.specializedFieldEncoders.map((f) => f.key));\n\t}\n\n\tprivate getValueToEncode(cursor: ITreeCursorSynchronous, context: EncoderContext): Value {\n\t\tif (this.value === 0) {\n\t\t\tassert(typeof cursor.value === \"string\", 0x9aa /* identifier must be type string */);\n\t\t\tif (isStableId(cursor.value)) {\n\t\t\t\tconst sessionSpaceCompressedId = context.idCompressor.tryRecompress(cursor.value);\n\t\t\t\tif (sessionSpaceCompressedId !== undefined) {\n\t\t\t\t\tconst opSpaceId = context.idCompressor.normalizeToOpSpace(sessionSpaceCompressedId);\n\t\t\t\t\t// Summaries can only contain finalized op-space ids unless they also include the originator's session id somewhere.\n\t\t\t\t\t// This is not the case for forest summaries at the time of writing, so non-finalized ids are instead written using\n\t\t\t\t\t// their long form (by falling through to the original cursor value).\n\t\t\t\t\t// A scenario where such ids can appear in the summary is in the attach summary of a tree being attached to an already-attached container.\n\t\t\t\t\tif (!context.isSummary || isFinalId(opSpaceId)) {\n\t\t\t\t\t\treturn opSpaceId;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\treturn cursor.value;\n\t}\n\n\tpublic encodeNode(\n\t\tcursor: ITreeCursorSynchronous,\n\t\tcontext: EncoderContext,\n\t\toutputBuffer: BufferFormat<EncodedChunkShape>,\n\t): void {\n\t\tif (this.type === undefined) {\n\t\t\toutputBuffer.push(new IdentifierToken(cursor.type));\n\t\t} else {\n\t\t\tassert(cursor.type === this.type, 0x741 /* type must match shape */);\n\t\t}\n\t\tencodeValue(this.getValueToEncode(cursor, context), this.value, outputBuffer);\n\t\tfor (const fieldEncoder of this.specializedFieldEncoders) {\n\t\t\tcursor.enterField(brand(fieldEncoder.key));\n\t\t\tfieldEncoder.encoder.encodeField(cursor, context, outputBuffer);\n\t\t\tcursor.exitField();\n\t\t}\n\n\t\tconst otherFieldsBuffer: BufferFormat<EncodedChunkShape> = [];\n\n\t\tforEachField(cursor, () => {\n\t\t\tconst key = cursor.getFieldKey();\n\t\t\tif (!this.specializedFieldKeys.has(key)) {\n\t\t\t\tassert(\n\t\t\t\t\tthis.otherFieldsEncoder !== undefined,\n\t\t\t\t\t0x742 /* had extra local fields when shape does not support them */,\n\t\t\t\t);\n\t\t\t\totherFieldsBuffer.push(new IdentifierToken(key));\n\t\t\t\tthis.otherFieldsEncoder.encodeField(cursor, context, otherFieldsBuffer);\n\t\t\t}\n\t\t});\n\n\t\tif (this.otherFieldsEncoder !== undefined) {\n\t\t\toutputBuffer.push(otherFieldsBuffer);\n\t\t}\n\t}\n\n\tpublic encodeShape(\n\t\tidentifiers: DeduplicationTable<string>,\n\t\tshapes: DeduplicationTable<Shape<EncodedChunkShape>>,\n\t): EncodedChunkShape {\n\t\treturn {\n\t\t\tc: {\n\t\t\t\ttype: encodeOptionalIdentifier(this.type, identifiers),\n\t\t\t\tvalue: this.value,\n\t\t\t\tfields: encodeFieldShapes(this.specializedFieldEncoders, identifiers, shapes),\n\t\t\t\textraFields: encodeOptionalFieldShape(this.otherFieldsEncoder, shapes),\n\t\t\t},\n\t\t};\n\t}\n\n\tpublic countReferencedShapesAndIdentifiers(\n\t\tidentifiers: Counter<string>,\n\t\tshapeDiscovered: (shape: Shape<EncodedChunkShape>) => void,\n\t): void {\n\t\tif (this.type !== undefined) {\n\t\t\tidentifiers.add(this.type);\n\t\t}\n\n\t\tfor (const fieldEncoder of this.specializedFieldEncoders) {\n\t\t\tidentifiers.add(fieldEncoder.key);\n\t\t\tshapeDiscovered(fieldEncoder.encoder.shape);\n\t\t}\n\n\t\tif (this.otherFieldsEncoder !== undefined) {\n\t\t\tshapeDiscovered(this.otherFieldsEncoder.shape);\n\t\t}\n\t}\n\n\tpublic get shape(): Shape<EncodedChunkShape> {\n\t\treturn this;\n\t}\n}\n\nexport function encodeFieldShapes(\n\tfieldEncoders: readonly KeyedFieldEncoder[],\n\tidentifiers: DeduplicationTable<string>,\n\tshapes: DeduplicationTable<Shape<EncodedChunkShape>>,\n): EncodedFieldShape[] | undefined {\n\tif (fieldEncoders.length === 0) {\n\t\treturn undefined;\n\t}\n\treturn fieldEncoders.map((fieldEncoder) => [\n\t\t// key\n\t\tencodeIdentifier(fieldEncoder.key, identifiers),\n\t\t// shape\n\t\tshapes.valueToIndex.get(fieldEncoder.encoder.shape) ?? fail(0xb50 /* missing shape */),\n\t]);\n}\n\nfunction encodeIdentifier(\n\tidentifier: string,\n\tidentifiers: DeduplicationTable<string>,\n): string | number {\n\treturn identifiers.valueToIndex.get(identifier) ?? identifier;\n}\n\nfunction encodeOptionalIdentifier(\n\tidentifier: string | undefined,\n\tidentifiers: DeduplicationTable<string>,\n): string | number | undefined {\n\treturn identifier === undefined ? undefined : encodeIdentifier(identifier, identifiers);\n}\n\nfunction encodeOptionalFieldShape(\n\tencoder: FieldEncoder | undefined,\n\tshapes: DeduplicationTable<Shape<EncodedChunkShape>>,\n): number | undefined {\n\treturn encoder === undefined ? undefined : dedupShape(encoder.shape, shapes);\n}\n\nfunction dedupShape(\n\tshape: Shape<EncodedChunkShape>,\n\tshapes: DeduplicationTable<Shape<EncodedChunkShape>>,\n): number {\n\treturn shapes.valueToIndex.get(shape) ?? fail(0xb51 /* missing shape */);\n}\n"]}
|