@fluidframework/tree 2.81.0-374083 → 2.81.1
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 +57 -0
- package/api-report/tree.alpha.api.md +0 -1
- package/dist/codec/codec.d.ts +2 -2
- package/dist/codec/codec.d.ts.map +1 -1
- package/dist/codec/codec.js +8 -8
- package/dist/codec/codec.js.map +1 -1
- package/dist/codec/versioned/codec.d.ts +1 -1
- package/dist/codec/versioned/codec.d.ts.map +1 -1
- package/dist/codec/versioned/codec.js +12 -12
- package/dist/codec/versioned/codec.js.map +1 -1
- package/dist/core/change-family/changeFamily.d.ts +1 -4
- package/dist/core/change-family/changeFamily.d.ts.map +1 -1
- package/dist/core/change-family/changeFamily.js.map +1 -1
- package/dist/core/change-family/index.d.ts +1 -1
- package/dist/core/change-family/index.d.ts.map +1 -1
- package/dist/core/change-family/index.js.map +1 -1
- package/dist/core/index.d.ts +3 -3
- package/dist/core/index.d.ts.map +1 -1
- package/dist/core/index.js +4 -6
- package/dist/core/index.js.map +1 -1
- package/dist/core/rebase/changeRebaser.d.ts +1 -6
- package/dist/core/rebase/changeRebaser.d.ts.map +1 -1
- package/dist/core/rebase/changeRebaser.js.map +1 -1
- package/dist/core/rebase/index.d.ts +1 -1
- package/dist/core/rebase/index.d.ts.map +1 -1
- package/dist/core/rebase/index.js +1 -2
- package/dist/core/rebase/index.js.map +1 -1
- package/dist/core/rebase/types.d.ts +1 -2
- package/dist/core/rebase/types.d.ts.map +1 -1
- package/dist/core/rebase/types.js +1 -5
- package/dist/core/rebase/types.js.map +1 -1
- package/dist/core/rebase/utils.d.ts.map +1 -1
- package/dist/core/rebase/utils.js +7 -25
- package/dist/core/rebase/utils.js.map +1 -1
- package/dist/core/schema-stored/formatV2.d.ts.map +1 -1
- package/dist/core/schema-stored/formatV2.js +4 -4
- package/dist/core/schema-stored/formatV2.js.map +1 -1
- package/dist/core/tree/anchorSet.d.ts.map +1 -1
- package/dist/core/tree/anchorSet.js +1 -1
- package/dist/core/tree/anchorSet.js.map +1 -1
- package/dist/core/tree/detachedFieldIndex.d.ts +0 -6
- package/dist/core/tree/detachedFieldIndex.d.ts.map +1 -1
- package/dist/core/tree/detachedFieldIndex.js +0 -9
- package/dist/core/tree/detachedFieldIndex.js.map +1 -1
- package/dist/core/tree/detachedFieldIndexCodecCommon.d.ts +1 -1
- package/dist/core/tree/detachedFieldIndexCodecCommon.d.ts.map +1 -1
- package/dist/core/tree/detachedFieldIndexCodecCommon.js.map +1 -1
- package/dist/core/tree/detachedFieldIndexCodecV1.d.ts.map +1 -1
- package/dist/core/tree/detachedFieldIndexCodecV1.js +3 -3
- package/dist/core/tree/detachedFieldIndexCodecV1.js.map +1 -1
- package/dist/core/tree/detachedFieldIndexCodecV2.d.ts.map +1 -1
- package/dist/core/tree/detachedFieldIndexCodecV2.js +2 -2
- package/dist/core/tree/detachedFieldIndexCodecV2.js.map +1 -1
- package/dist/core/tree/detachedFieldIndexFormatV1.d.ts.map +1 -1
- package/dist/core/tree/detachedFieldIndexFormatV1.js +3 -3
- package/dist/core/tree/detachedFieldIndexFormatV1.js.map +1 -1
- package/dist/core/tree/detachedFieldIndexFormatV2.d.ts.map +1 -1
- package/dist/core/tree/detachedFieldIndexFormatV2.js +4 -4
- package/dist/core/tree/detachedFieldIndexFormatV2.js.map +1 -1
- package/dist/core/tree/index.d.ts +1 -1
- package/dist/core/tree/index.d.ts.map +1 -1
- package/dist/core/tree/index.js +3 -4
- package/dist/core/tree/index.js.map +1 -1
- package/dist/core/tree/pathTree.d.ts +3 -11
- package/dist/core/tree/pathTree.d.ts.map +1 -1
- package/dist/core/tree/pathTree.js +2 -14
- package/dist/core/tree/pathTree.js.map +1 -1
- package/dist/core/tree/visitDelta.d.ts +1 -1
- package/dist/core/tree/visitDelta.d.ts.map +1 -1
- package/dist/core/tree/visitDelta.js.map +1 -1
- package/dist/core/tree/visitorUtils.d.ts.map +1 -1
- package/dist/core/tree/visitorUtils.js +1 -1
- package/dist/core/tree/visitorUtils.js.map +1 -1
- package/dist/feature-libraries/changeAtomIdBTree.d.ts +3 -4
- package/dist/feature-libraries/changeAtomIdBTree.d.ts.map +1 -1
- package/dist/feature-libraries/changeAtomIdBTree.js +2 -16
- package/dist/feature-libraries/changeAtomIdBTree.js.map +1 -1
- package/dist/feature-libraries/chunked-forest/basicChunk.d.ts.map +1 -1
- package/dist/feature-libraries/chunked-forest/basicChunk.js +0 -7
- package/dist/feature-libraries/chunked-forest/basicChunk.js.map +1 -1
- package/dist/feature-libraries/chunked-forest/chunkTree.d.ts +1 -1
- package/dist/feature-libraries/chunked-forest/chunkTree.d.ts.map +1 -1
- package/dist/feature-libraries/chunked-forest/chunkTree.js +1 -4
- package/dist/feature-libraries/chunked-forest/chunkTree.js.map +1 -1
- package/dist/feature-libraries/chunked-forest/codec/chunkDecoding.d.ts +1 -1
- package/dist/feature-libraries/chunked-forest/codec/chunkDecoding.d.ts.map +1 -1
- package/dist/feature-libraries/chunked-forest/codec/chunkDecoding.js.map +1 -1
- package/dist/feature-libraries/chunked-forest/codec/chunkDecodingGeneric.d.ts +1 -1
- package/dist/feature-libraries/chunked-forest/codec/chunkDecodingGeneric.d.ts.map +1 -1
- package/dist/feature-libraries/chunked-forest/codec/chunkDecodingGeneric.js.map +1 -1
- package/dist/feature-libraries/chunked-forest/codec/chunkEncodingGeneric.d.ts +1 -1
- package/dist/feature-libraries/chunked-forest/codec/chunkEncodingGeneric.d.ts.map +1 -1
- package/dist/feature-libraries/chunked-forest/codec/chunkEncodingGeneric.js.map +1 -1
- package/dist/feature-libraries/chunked-forest/codec/codecs.d.ts +1 -1
- package/dist/feature-libraries/chunked-forest/codec/codecs.d.ts.map +1 -1
- package/dist/feature-libraries/chunked-forest/codec/codecs.js +1 -1
- package/dist/feature-libraries/chunked-forest/codec/codecs.js.map +1 -1
- package/dist/feature-libraries/chunked-forest/codec/compressedEncode.d.ts +1 -1
- 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.d.ts.map +1 -1
- package/dist/feature-libraries/chunked-forest/codec/format.js +1 -1
- package/dist/feature-libraries/chunked-forest/codec/format.js.map +1 -1
- package/dist/feature-libraries/chunked-forest/codec/formatGeneric.d.ts.map +1 -1
- package/dist/feature-libraries/chunked-forest/codec/formatGeneric.js.map +1 -1
- package/dist/feature-libraries/chunked-forest/codec/schemaBasedEncode.d.ts +1 -1
- package/dist/feature-libraries/chunked-forest/codec/schemaBasedEncode.d.ts.map +1 -1
- package/dist/feature-libraries/chunked-forest/codec/schemaBasedEncode.js +2 -2
- package/dist/feature-libraries/chunked-forest/codec/schemaBasedEncode.js.map +1 -1
- package/dist/feature-libraries/default-schema/defaultEditBuilder.d.ts +44 -93
- package/dist/feature-libraries/default-schema/defaultEditBuilder.d.ts.map +1 -1
- package/dist/feature-libraries/default-schema/defaultEditBuilder.js +78 -245
- package/dist/feature-libraries/default-schema/defaultEditBuilder.js.map +1 -1
- package/dist/feature-libraries/default-schema/defaultFieldKinds.d.ts +11 -53
- package/dist/feature-libraries/default-schema/defaultFieldKinds.d.ts.map +1 -1
- package/dist/feature-libraries/default-schema/defaultFieldKinds.js +25 -75
- package/dist/feature-libraries/default-schema/defaultFieldKinds.js.map +1 -1
- package/dist/feature-libraries/default-schema/index.d.ts +2 -3
- package/dist/feature-libraries/default-schema/index.d.ts.map +1 -1
- package/dist/feature-libraries/default-schema/index.js +2 -5
- package/dist/feature-libraries/default-schema/index.js.map +1 -1
- package/dist/feature-libraries/default-schema/mappedEditBuilder.d.ts +6 -7
- package/dist/feature-libraries/default-schema/mappedEditBuilder.d.ts.map +1 -1
- package/dist/feature-libraries/default-schema/mappedEditBuilder.js +0 -15
- package/dist/feature-libraries/default-schema/mappedEditBuilder.js.map +1 -1
- package/dist/feature-libraries/deltaUtils.d.ts +0 -1
- package/dist/feature-libraries/deltaUtils.d.ts.map +1 -1
- package/dist/feature-libraries/deltaUtils.js +1 -6
- package/dist/feature-libraries/deltaUtils.js.map +1 -1
- package/dist/feature-libraries/fieldKindIdentifiers.d.ts +9 -0
- package/dist/feature-libraries/fieldKindIdentifiers.d.ts.map +1 -0
- package/dist/feature-libraries/fieldKindIdentifiers.js +16 -0
- package/dist/feature-libraries/fieldKindIdentifiers.js.map +1 -0
- package/dist/feature-libraries/flex-tree/context.d.ts +0 -9
- package/dist/feature-libraries/flex-tree/context.d.ts.map +1 -1
- package/dist/feature-libraries/flex-tree/context.js +0 -6
- package/dist/feature-libraries/flex-tree/context.js.map +1 -1
- package/dist/feature-libraries/flex-tree/flexTreeTypes.d.ts +6 -6
- package/dist/feature-libraries/flex-tree/flexTreeTypes.d.ts.map +1 -1
- package/dist/feature-libraries/flex-tree/flexTreeTypes.js.map +1 -1
- package/dist/feature-libraries/flex-tree/lazyField.d.ts +7 -8
- package/dist/feature-libraries/flex-tree/lazyField.d.ts.map +1 -1
- package/dist/feature-libraries/flex-tree/lazyField.js +17 -48
- package/dist/feature-libraries/flex-tree/lazyField.js.map +1 -1
- package/dist/feature-libraries/flex-tree/observer.d.ts +1 -1
- package/dist/feature-libraries/flex-tree/observer.d.ts.map +1 -1
- package/dist/feature-libraries/flex-tree/observer.js.map +1 -1
- package/dist/feature-libraries/forest-summary/codec.d.ts.map +1 -1
- package/dist/feature-libraries/forest-summary/codec.js +1 -1
- package/dist/feature-libraries/forest-summary/codec.js.map +1 -1
- package/dist/feature-libraries/forest-summary/forestSummarizer.d.ts.map +1 -1
- package/dist/feature-libraries/forest-summary/forestSummarizer.js +3 -3
- package/dist/feature-libraries/forest-summary/forestSummarizer.js.map +1 -1
- package/dist/feature-libraries/forest-summary/formatV1.d.ts.map +1 -1
- package/dist/feature-libraries/forest-summary/formatV1.js.map +1 -1
- package/dist/feature-libraries/forest-summary/formatV2.d.ts.map +1 -1
- package/dist/feature-libraries/forest-summary/formatV2.js.map +1 -1
- package/dist/feature-libraries/forest-summary/incrementalSummaryBuilder.d.ts +4 -4
- package/dist/feature-libraries/forest-summary/incrementalSummaryBuilder.d.ts.map +1 -1
- package/dist/feature-libraries/forest-summary/incrementalSummaryBuilder.js +2 -2
- package/dist/feature-libraries/forest-summary/incrementalSummaryBuilder.js.map +1 -1
- package/dist/feature-libraries/forest-summary/summaryTypes.d.ts.map +1 -1
- package/dist/feature-libraries/forest-summary/summaryTypes.js.map +1 -1
- package/dist/feature-libraries/index.d.ts +3 -3
- package/dist/feature-libraries/index.d.ts.map +1 -1
- package/dist/feature-libraries/index.js +3 -8
- package/dist/feature-libraries/index.js.map +1 -1
- package/dist/feature-libraries/mapTreeCursor.d.ts.map +1 -1
- package/dist/feature-libraries/mapTreeCursor.js +0 -1
- package/dist/feature-libraries/mapTreeCursor.js.map +1 -1
- package/dist/feature-libraries/mitigatedChangeFamily.d.ts.map +1 -1
- package/dist/feature-libraries/mitigatedChangeFamily.js +2 -2
- package/dist/feature-libraries/mitigatedChangeFamily.js.map +1 -1
- package/dist/feature-libraries/modular-schema/crossFieldQueries.d.ts +21 -97
- package/dist/feature-libraries/modular-schema/crossFieldQueries.d.ts.map +1 -1
- package/dist/feature-libraries/modular-schema/crossFieldQueries.js +7 -4
- package/dist/feature-libraries/modular-schema/crossFieldQueries.js.map +1 -1
- package/dist/feature-libraries/modular-schema/fieldChangeHandler.d.ts +51 -20
- package/dist/feature-libraries/modular-schema/fieldChangeHandler.d.ts.map +1 -1
- package/dist/feature-libraries/modular-schema/fieldChangeHandler.js.map +1 -1
- package/dist/feature-libraries/modular-schema/fieldKindConfiguration.d.ts.map +1 -1
- package/dist/feature-libraries/modular-schema/fieldKindConfiguration.js.map +1 -1
- package/dist/feature-libraries/modular-schema/genericFieldKind.d.ts +1 -1
- package/dist/feature-libraries/modular-schema/genericFieldKind.d.ts.map +1 -1
- package/dist/feature-libraries/modular-schema/genericFieldKind.js +11 -5
- package/dist/feature-libraries/modular-schema/genericFieldKind.js.map +1 -1
- package/dist/feature-libraries/modular-schema/index.d.ts +4 -4
- package/dist/feature-libraries/modular-schema/index.d.ts.map +1 -1
- package/dist/feature-libraries/modular-schema/index.js +2 -2
- package/dist/feature-libraries/modular-schema/index.js.map +1 -1
- package/dist/feature-libraries/modular-schema/modularChangeCodecV1.d.ts +28 -11
- package/dist/feature-libraries/modular-schema/modularChangeCodecV1.d.ts.map +1 -1
- package/dist/feature-libraries/modular-schema/modularChangeCodecV1.js +162 -254
- package/dist/feature-libraries/modular-schema/modularChangeCodecV1.js.map +1 -1
- package/dist/feature-libraries/modular-schema/modularChangeCodecV2.d.ts.map +1 -1
- package/dist/feature-libraries/modular-schema/modularChangeCodecV2.js +1 -1
- package/dist/feature-libraries/modular-schema/modularChangeCodecV2.js.map +1 -1
- package/dist/feature-libraries/modular-schema/modularChangeCodecs.d.ts.map +1 -1
- package/dist/feature-libraries/modular-schema/modularChangeCodecs.js +1 -8
- package/dist/feature-libraries/modular-schema/modularChangeCodecs.js.map +1 -1
- package/dist/feature-libraries/modular-schema/modularChangeFamily.d.ts +21 -49
- package/dist/feature-libraries/modular-schema/modularChangeFamily.d.ts.map +1 -1
- package/dist/feature-libraries/modular-schema/modularChangeFamily.js +460 -1325
- package/dist/feature-libraries/modular-schema/modularChangeFamily.js.map +1 -1
- package/dist/feature-libraries/modular-schema/modularChangeFormatV1.d.ts.map +1 -1
- package/dist/feature-libraries/modular-schema/modularChangeFormatV1.js.map +1 -1
- package/dist/feature-libraries/modular-schema/modularChangeTypes.d.ts +8 -44
- package/dist/feature-libraries/modular-schema/modularChangeTypes.d.ts.map +1 -1
- package/dist/feature-libraries/modular-schema/modularChangeTypes.js +3 -3
- package/dist/feature-libraries/modular-schema/modularChangeTypes.js.map +1 -1
- package/dist/feature-libraries/object-forest/objectForest.d.ts.map +1 -1
- package/dist/feature-libraries/object-forest/objectForest.js +2 -2
- package/dist/feature-libraries/object-forest/objectForest.js.map +1 -1
- package/dist/feature-libraries/optional-field/index.d.ts +2 -2
- package/dist/feature-libraries/optional-field/index.d.ts.map +1 -1
- package/dist/feature-libraries/optional-field/index.js +4 -7
- package/dist/feature-libraries/optional-field/index.js.map +1 -1
- package/dist/feature-libraries/optional-field/optionalField.d.ts +34 -5
- package/dist/feature-libraries/optional-field/optionalField.d.ts.map +1 -1
- package/dist/feature-libraries/optional-field/optionalField.js +455 -221
- package/dist/feature-libraries/optional-field/optionalField.js.map +1 -1
- package/dist/feature-libraries/optional-field/optionalFieldChangeTypes.d.ts +33 -24
- package/dist/feature-libraries/optional-field/optionalFieldChangeTypes.d.ts.map +1 -1
- package/dist/feature-libraries/optional-field/optionalFieldChangeTypes.js.map +1 -1
- package/dist/feature-libraries/optional-field/optionalFieldCodecV2.d.ts +1 -1
- package/dist/feature-libraries/optional-field/optionalFieldCodecV2.d.ts.map +1 -1
- package/dist/feature-libraries/optional-field/optionalFieldCodecV2.js +28 -57
- package/dist/feature-libraries/optional-field/optionalFieldCodecV2.js.map +1 -1
- package/dist/feature-libraries/optional-field/optionalFieldCodecs.d.ts.map +1 -1
- package/dist/feature-libraries/optional-field/optionalFieldCodecs.js +1 -5
- package/dist/feature-libraries/optional-field/optionalFieldCodecs.js.map +1 -1
- package/dist/feature-libraries/optional-field/requiredField.d.ts +36 -0
- package/dist/feature-libraries/optional-field/requiredField.d.ts.map +1 -0
- package/dist/feature-libraries/optional-field/requiredField.js +27 -0
- package/dist/feature-libraries/optional-field/requiredField.js.map +1 -0
- package/dist/feature-libraries/schema-edits/schemaChangeCodecs.d.ts +1 -1
- package/dist/feature-libraries/schema-edits/schemaChangeCodecs.d.ts.map +1 -1
- package/dist/feature-libraries/schema-edits/schemaChangeCodecs.js +7 -7
- package/dist/feature-libraries/schema-edits/schemaChangeCodecs.js.map +1 -1
- package/dist/feature-libraries/schema-edits/schemaChangeFormat.d.ts.map +1 -1
- package/dist/feature-libraries/schema-edits/schemaChangeFormat.js.map +1 -1
- package/dist/feature-libraries/schemaChecker.d.ts.map +1 -1
- package/dist/feature-libraries/schemaChecker.js +1 -1
- package/dist/feature-libraries/schemaChecker.js.map +1 -1
- package/dist/feature-libraries/sequence-field/compose.d.ts +7 -6
- package/dist/feature-libraries/sequence-field/compose.d.ts.map +1 -1
- package/dist/feature-libraries/sequence-field/compose.js +259 -83
- package/dist/feature-libraries/sequence-field/compose.js.map +1 -1
- package/dist/feature-libraries/sequence-field/helperTypes.d.ts +10 -14
- package/dist/feature-libraries/sequence-field/helperTypes.d.ts.map +1 -1
- package/dist/feature-libraries/sequence-field/helperTypes.js.map +1 -1
- package/dist/feature-libraries/sequence-field/index.d.ts +2 -13
- package/dist/feature-libraries/sequence-field/index.d.ts.map +1 -1
- package/dist/feature-libraries/sequence-field/index.js +3 -28
- package/dist/feature-libraries/sequence-field/index.js.map +1 -1
- package/dist/feature-libraries/sequence-field/invert.d.ts +3 -3
- package/dist/feature-libraries/sequence-field/invert.d.ts.map +1 -1
- package/dist/feature-libraries/sequence-field/invert.js +167 -65
- package/dist/feature-libraries/sequence-field/invert.js.map +1 -1
- package/dist/feature-libraries/sequence-field/markQueue.d.ts +2 -2
- package/dist/feature-libraries/sequence-field/markQueue.d.ts.map +1 -1
- package/dist/feature-libraries/sequence-field/markQueue.js.map +1 -1
- package/dist/feature-libraries/sequence-field/moveEffectTable.d.ts +56 -4
- package/dist/feature-libraries/sequence-field/moveEffectTable.d.ts.map +1 -1
- package/dist/feature-libraries/sequence-field/moveEffectTable.js +90 -7
- package/dist/feature-libraries/sequence-field/moveEffectTable.js.map +1 -1
- package/dist/feature-libraries/sequence-field/rebase.d.ts +3 -3
- package/dist/feature-libraries/sequence-field/rebase.d.ts.map +1 -1
- package/dist/feature-libraries/sequence-field/rebase.js +114 -107
- package/dist/feature-libraries/sequence-field/rebase.js.map +1 -1
- package/dist/feature-libraries/sequence-field/relevantRemovedRoots.d.ts +9 -0
- package/dist/feature-libraries/sequence-field/relevantRemovedRoots.d.ts.map +1 -0
- package/dist/feature-libraries/sequence-field/relevantRemovedRoots.js +50 -0
- package/dist/feature-libraries/sequence-field/relevantRemovedRoots.js.map +1 -0
- package/dist/feature-libraries/sequence-field/replaceRevisions.d.ts.map +1 -1
- package/dist/feature-libraries/sequence-field/replaceRevisions.js +31 -18
- package/dist/feature-libraries/sequence-field/replaceRevisions.js.map +1 -1
- package/dist/feature-libraries/sequence-field/sequenceFieldChangeHandler.d.ts.map +1 -1
- package/dist/feature-libraries/sequence-field/sequenceFieldChangeHandler.js +2 -0
- package/dist/feature-libraries/sequence-field/sequenceFieldChangeHandler.js.map +1 -1
- package/dist/feature-libraries/sequence-field/sequenceFieldCodecV2.d.ts +4 -22
- package/dist/feature-libraries/sequence-field/sequenceFieldCodecV2.d.ts.map +1 -1
- package/dist/feature-libraries/sequence-field/sequenceFieldCodecV2.js +187 -365
- package/dist/feature-libraries/sequence-field/sequenceFieldCodecV2.js.map +1 -1
- package/dist/feature-libraries/sequence-field/sequenceFieldCodecV3.d.ts.map +1 -1
- package/dist/feature-libraries/sequence-field/sequenceFieldCodecV3.js +62 -20
- package/dist/feature-libraries/sequence-field/sequenceFieldCodecV3.js.map +1 -1
- package/dist/feature-libraries/sequence-field/sequenceFieldEditor.d.ts +2 -2
- package/dist/feature-libraries/sequence-field/sequenceFieldEditor.d.ts.map +1 -1
- package/dist/feature-libraries/sequence-field/sequenceFieldEditor.js +10 -10
- package/dist/feature-libraries/sequence-field/sequenceFieldEditor.js.map +1 -1
- package/dist/feature-libraries/sequence-field/sequenceFieldToDelta.d.ts +2 -3
- package/dist/feature-libraries/sequence-field/sequenceFieldToDelta.d.ts.map +1 -1
- package/dist/feature-libraries/sequence-field/sequenceFieldToDelta.js +109 -14
- package/dist/feature-libraries/sequence-field/sequenceFieldToDelta.js.map +1 -1
- package/dist/feature-libraries/sequence-field/sequenceKind.d.ts +16 -0
- package/dist/feature-libraries/sequence-field/sequenceKind.d.ts.map +1 -0
- package/dist/feature-libraries/sequence-field/sequenceKind.js +24 -0
- package/dist/feature-libraries/sequence-field/sequenceKind.js.map +1 -0
- package/dist/feature-libraries/sequence-field/types.d.ts +59 -30
- package/dist/feature-libraries/sequence-field/types.d.ts.map +1 -1
- package/dist/feature-libraries/sequence-field/types.js.map +1 -1
- package/dist/feature-libraries/sequence-field/utils.d.ts +24 -15
- package/dist/feature-libraries/sequence-field/utils.d.ts.map +1 -1
- package/dist/feature-libraries/sequence-field/utils.js +305 -116
- package/dist/feature-libraries/sequence-field/utils.js.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -1
- package/dist/index.js.map +1 -1
- package/dist/packageVersion.d.ts +1 -1
- package/dist/packageVersion.d.ts.map +1 -1
- package/dist/packageVersion.js +1 -1
- package/dist/packageVersion.js.map +1 -1
- package/dist/shared-tree/independentView.d.ts.map +1 -1
- package/dist/shared-tree/independentView.js +7 -7
- package/dist/shared-tree/independentView.js.map +1 -1
- package/dist/shared-tree/index.d.ts +1 -1
- package/dist/shared-tree/index.d.ts.map +1 -1
- package/dist/shared-tree/index.js.map +1 -1
- package/dist/shared-tree/schematizeTree.d.ts +4 -4
- package/dist/shared-tree/schematizeTree.d.ts.map +1 -1
- package/dist/shared-tree/schematizeTree.js +1 -2
- package/dist/shared-tree/schematizeTree.js.map +1 -1
- package/dist/shared-tree/schematizingTreeView.d.ts +5 -1
- package/dist/shared-tree/schematizingTreeView.d.ts.map +1 -1
- package/dist/shared-tree/schematizingTreeView.js +39 -40
- package/dist/shared-tree/schematizingTreeView.js.map +1 -1
- package/dist/shared-tree/sharedTree.d.ts +5 -11
- package/dist/shared-tree/sharedTree.d.ts.map +1 -1
- package/dist/shared-tree/sharedTree.js +5 -43
- package/dist/shared-tree/sharedTree.js.map +1 -1
- package/dist/shared-tree/sharedTreeChangeCodecs.d.ts +1 -1
- package/dist/shared-tree/sharedTreeChangeCodecs.d.ts.map +1 -1
- package/dist/shared-tree/sharedTreeChangeCodecs.js +0 -1
- package/dist/shared-tree/sharedTreeChangeCodecs.js.map +1 -1
- package/dist/shared-tree/sharedTreeChangeEnricher.d.ts +31 -24
- package/dist/shared-tree/sharedTreeChangeEnricher.d.ts.map +1 -1
- package/dist/shared-tree/sharedTreeChangeEnricher.js +75 -58
- package/dist/shared-tree/sharedTreeChangeEnricher.js.map +1 -1
- package/dist/shared-tree/sharedTreeChangeFamily.d.ts +5 -5
- package/dist/shared-tree/sharedTreeChangeFamily.d.ts.map +1 -1
- package/dist/shared-tree/sharedTreeChangeFamily.js +4 -10
- package/dist/shared-tree/sharedTreeChangeFamily.js.map +1 -1
- package/dist/shared-tree/sharedTreeEditBuilder.d.ts +6 -16
- package/dist/shared-tree/sharedTreeEditBuilder.d.ts.map +1 -1
- package/dist/shared-tree/sharedTreeEditBuilder.js +7 -14
- package/dist/shared-tree/sharedTreeEditBuilder.js.map +1 -1
- package/dist/shared-tree/tree.d.ts.map +1 -1
- package/dist/shared-tree/tree.js +14 -14
- package/dist/shared-tree/tree.js.map +1 -1
- package/dist/shared-tree/treeAlpha.d.ts +1 -1
- package/dist/shared-tree/treeAlpha.d.ts.map +1 -1
- package/dist/shared-tree/treeAlpha.js +77 -77
- package/dist/shared-tree/treeAlpha.js.map +1 -1
- package/dist/shared-tree/treeCheckout.d.ts +29 -13
- package/dist/shared-tree/treeCheckout.d.ts.map +1 -1
- package/dist/shared-tree/treeCheckout.js +80 -79
- package/dist/shared-tree/treeCheckout.js.map +1 -1
- package/dist/shared-tree-core/branch.d.ts +3 -4
- package/dist/shared-tree-core/branch.d.ts.map +1 -1
- package/dist/shared-tree-core/branch.js +3 -4
- package/dist/shared-tree-core/branch.js.map +1 -1
- package/dist/shared-tree-core/branchCommitEnricher.d.ts +18 -31
- package/dist/shared-tree-core/branchCommitEnricher.d.ts.map +1 -1
- package/dist/shared-tree-core/branchCommitEnricher.js +24 -76
- package/dist/shared-tree-core/branchCommitEnricher.js.map +1 -1
- package/dist/shared-tree-core/branchIdCodec.d.ts.map +1 -1
- package/dist/shared-tree-core/branchIdCodec.js.map +1 -1
- package/dist/shared-tree-core/changeEnricher.d.ts +8 -43
- package/dist/shared-tree-core/changeEnricher.d.ts.map +1 -1
- package/dist/shared-tree-core/changeEnricher.js +0 -13
- package/dist/shared-tree-core/changeEnricher.js.map +1 -1
- package/dist/shared-tree-core/defaultResubmitMachine.d.ts +4 -12
- package/dist/shared-tree-core/defaultResubmitMachine.d.ts.map +1 -1
- package/dist/shared-tree-core/defaultResubmitMachine.js +26 -36
- package/dist/shared-tree-core/defaultResubmitMachine.js.map +1 -1
- package/dist/shared-tree-core/editManager.d.ts +3 -3
- package/dist/shared-tree-core/editManager.d.ts.map +1 -1
- package/dist/shared-tree-core/editManager.js +11 -11
- package/dist/shared-tree-core/editManager.js.map +1 -1
- package/dist/shared-tree-core/editManagerCodecs.d.ts +1 -5
- package/dist/shared-tree-core/editManagerCodecs.d.ts.map +1 -1
- package/dist/shared-tree-core/editManagerCodecs.js +2 -10
- package/dist/shared-tree-core/editManagerCodecs.js.map +1 -1
- package/dist/shared-tree-core/editManagerCodecsCommons.d.ts +1 -1
- package/dist/shared-tree-core/editManagerCodecsCommons.d.ts.map +1 -1
- package/dist/shared-tree-core/editManagerCodecsCommons.js +1 -2
- package/dist/shared-tree-core/editManagerCodecsCommons.js.map +1 -1
- package/dist/shared-tree-core/editManagerCodecsV1toV4.d.ts.map +1 -1
- package/dist/shared-tree-core/editManagerCodecsV1toV4.js +1 -1
- package/dist/shared-tree-core/editManagerCodecsV1toV4.js.map +1 -1
- package/dist/shared-tree-core/editManagerCodecsVSharedBranches.d.ts.map +1 -1
- package/dist/shared-tree-core/editManagerCodecsVSharedBranches.js +1 -1
- package/dist/shared-tree-core/editManagerCodecsVSharedBranches.js.map +1 -1
- package/dist/shared-tree-core/editManagerFormatCommons.d.ts +0 -1
- package/dist/shared-tree-core/editManagerFormatCommons.d.ts.map +1 -1
- package/dist/shared-tree-core/editManagerFormatCommons.js +0 -6
- package/dist/shared-tree-core/editManagerFormatCommons.js.map +1 -1
- package/dist/shared-tree-core/editManagerFormatV1toV4.d.ts +2 -2
- package/dist/shared-tree-core/editManagerFormatV1toV4.d.ts.map +1 -1
- package/dist/shared-tree-core/editManagerFormatV1toV4.js +0 -1
- package/dist/shared-tree-core/editManagerFormatV1toV4.js.map +1 -1
- package/dist/shared-tree-core/editManagerFormatVSharedBranches.d.ts +1 -1
- package/dist/shared-tree-core/editManagerFormatVSharedBranches.d.ts.map +1 -1
- package/dist/shared-tree-core/editManagerFormatVSharedBranches.js +1 -1
- package/dist/shared-tree-core/editManagerFormatVSharedBranches.js.map +1 -1
- package/dist/shared-tree-core/index.d.ts +4 -4
- package/dist/shared-tree-core/index.d.ts.map +1 -1
- package/dist/shared-tree-core/index.js +1 -5
- package/dist/shared-tree-core/index.js.map +1 -1
- package/dist/shared-tree-core/messageCodecV1ToV4.d.ts +2 -2
- package/dist/shared-tree-core/messageCodecV1ToV4.d.ts.map +1 -1
- package/dist/shared-tree-core/messageCodecV1ToV4.js +1 -1
- package/dist/shared-tree-core/messageCodecV1ToV4.js.map +1 -1
- package/dist/shared-tree-core/messageCodecVSharedBranches.d.ts +1 -1
- package/dist/shared-tree-core/messageCodecVSharedBranches.d.ts.map +1 -1
- package/dist/shared-tree-core/messageCodecVSharedBranches.js +2 -2
- package/dist/shared-tree-core/messageCodecVSharedBranches.js.map +1 -1
- package/dist/shared-tree-core/messageCodecs.d.ts +2 -6
- package/dist/shared-tree-core/messageCodecs.d.ts.map +1 -1
- package/dist/shared-tree-core/messageCodecs.js +2 -10
- package/dist/shared-tree-core/messageCodecs.js.map +1 -1
- package/dist/shared-tree-core/messageFormat.d.ts +0 -1
- package/dist/shared-tree-core/messageFormat.d.ts.map +1 -1
- package/dist/shared-tree-core/messageFormat.js +0 -6
- package/dist/shared-tree-core/messageFormat.js.map +1 -1
- package/dist/shared-tree-core/messageFormatV1ToV4.d.ts +2 -2
- package/dist/shared-tree-core/messageFormatV1ToV4.d.ts.map +1 -1
- package/dist/shared-tree-core/messageFormatV1ToV4.js +0 -1
- package/dist/shared-tree-core/messageFormatV1ToV4.js.map +1 -1
- package/dist/shared-tree-core/messageFormatVSharedBranches.d.ts.map +1 -1
- package/dist/shared-tree-core/messageFormatVSharedBranches.js.map +1 -1
- package/dist/shared-tree-core/messageTypes.d.ts.map +1 -1
- package/dist/shared-tree-core/messageTypes.js.map +1 -1
- package/dist/shared-tree-core/sharedTreeCore.d.ts +8 -5
- package/dist/shared-tree-core/sharedTreeCore.d.ts.map +1 -1
- package/dist/shared-tree-core/sharedTreeCore.js +14 -14
- package/dist/shared-tree-core/sharedTreeCore.js.map +1 -1
- package/dist/shared-tree-core/versionedSummarizer.d.ts.map +1 -1
- package/dist/shared-tree-core/versionedSummarizer.js +1 -1
- package/dist/shared-tree-core/versionedSummarizer.js.map +1 -1
- package/dist/simple-tree/api/configuration.d.ts +2 -2
- package/dist/simple-tree/api/configuration.d.ts.map +1 -1
- package/dist/simple-tree/api/configuration.js +14 -14
- package/dist/simple-tree/api/configuration.js.map +1 -1
- package/dist/simple-tree/api/create.d.ts +1 -1
- package/dist/simple-tree/api/create.d.ts.map +1 -1
- package/dist/simple-tree/api/create.js +7 -7
- package/dist/simple-tree/api/create.js.map +1 -1
- package/dist/simple-tree/api/dirtyIndex.d.ts +1 -1
- package/dist/simple-tree/api/dirtyIndex.d.ts.map +1 -1
- package/dist/simple-tree/api/dirtyIndex.js.map +1 -1
- package/dist/simple-tree/api/discrepancies.d.ts.map +1 -1
- package/dist/simple-tree/api/discrepancies.js +23 -23
- package/dist/simple-tree/api/discrepancies.js.map +1 -1
- package/dist/simple-tree/api/getJsonSchema.d.ts +1 -1
- package/dist/simple-tree/api/getJsonSchema.d.ts.map +1 -1
- package/dist/simple-tree/api/getJsonSchema.js +1 -1
- package/dist/simple-tree/api/getJsonSchema.js.map +1 -1
- package/dist/simple-tree/api/identifierIndex.d.ts +2 -2
- package/dist/simple-tree/api/identifierIndex.d.ts.map +1 -1
- package/dist/simple-tree/api/identifierIndex.js.map +1 -1
- package/dist/simple-tree/api/incrementalAllowedTypes.d.ts +1 -1
- package/dist/simple-tree/api/incrementalAllowedTypes.d.ts.map +1 -1
- package/dist/simple-tree/api/incrementalAllowedTypes.js +6 -6
- package/dist/simple-tree/api/incrementalAllowedTypes.js.map +1 -1
- package/dist/simple-tree/api/schemaCompatibilityTester.d.ts +1 -1
- package/dist/simple-tree/api/schemaCompatibilityTester.d.ts.map +1 -1
- package/dist/simple-tree/api/schemaCompatibilityTester.js +1 -1
- package/dist/simple-tree/api/schemaCompatibilityTester.js.map +1 -1
- package/dist/simple-tree/api/schemaCreationUtilities.d.ts +2 -2
- package/dist/simple-tree/api/schemaCreationUtilities.d.ts.map +1 -1
- package/dist/simple-tree/api/schemaCreationUtilities.js +7 -7
- package/dist/simple-tree/api/schemaCreationUtilities.js.map +1 -1
- package/dist/simple-tree/api/schemaFactory.d.ts +2 -2
- package/dist/simple-tree/api/schemaFactory.d.ts.map +1 -1
- package/dist/simple-tree/api/schemaFactory.js +7 -7
- package/dist/simple-tree/api/schemaFactory.js.map +1 -1
- package/dist/simple-tree/api/schemaFactoryAlpha.d.ts +6 -6
- package/dist/simple-tree/api/schemaFactoryAlpha.d.ts.map +1 -1
- package/dist/simple-tree/api/schemaFactoryAlpha.js +1 -1
- package/dist/simple-tree/api/schemaFactoryAlpha.js.map +1 -1
- package/dist/simple-tree/api/schemaFactoryBeta.d.ts +2 -2
- package/dist/simple-tree/api/schemaFactoryBeta.d.ts.map +1 -1
- package/dist/simple-tree/api/schemaFactoryBeta.js +1 -0
- package/dist/simple-tree/api/schemaFactoryBeta.js.map +1 -1
- package/dist/simple-tree/api/schemaFactoryRecursive.d.ts +1 -1
- package/dist/simple-tree/api/schemaFactoryRecursive.d.ts.map +1 -1
- package/dist/simple-tree/api/schemaFactoryRecursive.js.map +1 -1
- package/dist/simple-tree/api/schemaFromSimple.d.ts.map +1 -1
- package/dist/simple-tree/api/schemaFromSimple.js.map +1 -1
- package/dist/simple-tree/api/schemaStatics.d.ts.map +1 -1
- package/dist/simple-tree/api/schemaStatics.js.map +1 -1
- package/dist/simple-tree/api/simpleSchemaCodec.d.ts +1 -1
- package/dist/simple-tree/api/simpleSchemaCodec.d.ts.map +1 -1
- package/dist/simple-tree/api/simpleSchemaCodec.js +17 -17
- package/dist/simple-tree/api/simpleSchemaCodec.js.map +1 -1
- package/dist/simple-tree/api/simpleSchemaToJsonSchema.d.ts +2 -2
- package/dist/simple-tree/api/simpleSchemaToJsonSchema.d.ts.map +1 -1
- package/dist/simple-tree/api/simpleSchemaToJsonSchema.js +2 -2
- package/dist/simple-tree/api/simpleSchemaToJsonSchema.js.map +1 -1
- package/dist/simple-tree/api/simpleTreeIndex.d.ts +1 -1
- package/dist/simple-tree/api/simpleTreeIndex.d.ts.map +1 -1
- package/dist/simple-tree/api/simpleTreeIndex.js +1 -1
- package/dist/simple-tree/api/simpleTreeIndex.js.map +1 -1
- package/dist/simple-tree/api/snapshotCompatibilityChecker.d.ts.map +1 -1
- package/dist/simple-tree/api/snapshotCompatibilityChecker.js +14 -14
- package/dist/simple-tree/api/snapshotCompatibilityChecker.js.map +1 -1
- package/dist/simple-tree/api/storedSchema.d.ts.map +1 -1
- package/dist/simple-tree/api/storedSchema.js.map +1 -1
- package/dist/simple-tree/api/tree.d.ts +2 -2
- package/dist/simple-tree/api/tree.d.ts.map +1 -1
- package/dist/simple-tree/api/tree.js.map +1 -1
- package/dist/simple-tree/api/treeBeta.d.ts +1 -1
- package/dist/simple-tree/api/treeBeta.d.ts.map +1 -1
- package/dist/simple-tree/api/treeBeta.js +2 -2
- package/dist/simple-tree/api/treeBeta.js.map +1 -1
- package/dist/simple-tree/api/treeNodeApi.d.ts.map +1 -1
- package/dist/simple-tree/api/treeNodeApi.js +4 -4
- package/dist/simple-tree/api/treeNodeApi.js.map +1 -1
- package/dist/simple-tree/api/typesUnsafe.d.ts +1 -1
- package/dist/simple-tree/api/typesUnsafe.d.ts.map +1 -1
- package/dist/simple-tree/api/typesUnsafe.js.map +1 -1
- package/dist/simple-tree/api/verboseTree.d.ts +1 -1
- package/dist/simple-tree/api/verboseTree.d.ts.map +1 -1
- package/dist/simple-tree/api/verboseTree.js +22 -22
- package/dist/simple-tree/api/verboseTree.js.map +1 -1
- package/dist/simple-tree/core/allowedTypes.d.ts +1 -1
- package/dist/simple-tree/core/allowedTypes.d.ts.map +1 -1
- package/dist/simple-tree/core/allowedTypes.js +7 -7
- package/dist/simple-tree/core/allowedTypes.js.map +1 -1
- package/dist/simple-tree/core/context.d.ts.map +1 -1
- package/dist/simple-tree/core/context.js.map +1 -1
- package/dist/simple-tree/core/treeNode.d.ts.map +1 -1
- package/dist/simple-tree/core/treeNode.js +1 -1
- package/dist/simple-tree/core/treeNode.js.map +1 -1
- package/dist/simple-tree/core/treeNodeKernel.d.ts.map +1 -1
- package/dist/simple-tree/core/treeNodeKernel.js +1 -3
- package/dist/simple-tree/core/treeNodeKernel.js.map +1 -1
- package/dist/simple-tree/core/treeNodeSchema.d.ts +5 -5
- package/dist/simple-tree/core/treeNodeSchema.d.ts.map +1 -1
- package/dist/simple-tree/core/treeNodeSchema.js.map +1 -1
- package/dist/simple-tree/core/treeNodeValid.d.ts +3 -3
- package/dist/simple-tree/core/treeNodeValid.d.ts.map +1 -1
- package/dist/simple-tree/core/treeNodeValid.js +2 -2
- package/dist/simple-tree/core/treeNodeValid.js.map +1 -1
- package/dist/simple-tree/core/unhydratedFlexTree.d.ts +16 -16
- package/dist/simple-tree/core/unhydratedFlexTree.d.ts.map +1 -1
- package/dist/simple-tree/core/unhydratedFlexTree.js +8 -59
- package/dist/simple-tree/core/unhydratedFlexTree.js.map +1 -1
- package/dist/simple-tree/core/withType.d.ts.map +1 -1
- package/dist/simple-tree/core/withType.js.map +1 -1
- package/dist/simple-tree/createContext.d.ts.map +1 -1
- package/dist/simple-tree/createContext.js.map +1 -1
- package/dist/simple-tree/fieldSchema.d.ts +5 -5
- package/dist/simple-tree/fieldSchema.d.ts.map +1 -1
- package/dist/simple-tree/fieldSchema.js.map +1 -1
- package/dist/simple-tree/index.d.ts +2 -2
- package/dist/simple-tree/index.d.ts.map +1 -1
- package/dist/simple-tree/index.js +1 -1
- package/dist/simple-tree/index.js.map +1 -1
- package/dist/simple-tree/leafNodeSchema.d.ts +1 -1
- package/dist/simple-tree/leafNodeSchema.d.ts.map +1 -1
- package/dist/simple-tree/leafNodeSchema.js +15 -15
- package/dist/simple-tree/leafNodeSchema.js.map +1 -1
- package/dist/simple-tree/node-kinds/array/arrayNode.d.ts +1 -1
- package/dist/simple-tree/node-kinds/array/arrayNode.d.ts.map +1 -1
- package/dist/simple-tree/node-kinds/array/arrayNode.js +47 -49
- package/dist/simple-tree/node-kinds/array/arrayNode.js.map +1 -1
- package/dist/simple-tree/node-kinds/array/arrayNodeTypes.d.ts +1 -1
- package/dist/simple-tree/node-kinds/array/arrayNodeTypes.d.ts.map +1 -1
- package/dist/simple-tree/node-kinds/array/arrayNodeTypes.js.map +1 -1
- package/dist/simple-tree/node-kinds/common.d.ts.map +1 -1
- package/dist/simple-tree/node-kinds/common.js +1 -1
- package/dist/simple-tree/node-kinds/common.js.map +1 -1
- package/dist/simple-tree/node-kinds/map/mapNode.d.ts +2 -2
- package/dist/simple-tree/node-kinds/map/mapNode.d.ts.map +1 -1
- package/dist/simple-tree/node-kinds/map/mapNode.js +26 -26
- package/dist/simple-tree/node-kinds/map/mapNode.js.map +1 -1
- package/dist/simple-tree/node-kinds/map/mapNodeTypes.d.ts +1 -1
- package/dist/simple-tree/node-kinds/map/mapNodeTypes.d.ts.map +1 -1
- package/dist/simple-tree/node-kinds/map/mapNodeTypes.js.map +1 -1
- package/dist/simple-tree/node-kinds/object/objectNode.d.ts +2 -2
- package/dist/simple-tree/node-kinds/object/objectNode.d.ts.map +1 -1
- package/dist/simple-tree/node-kinds/object/objectNode.js +28 -28
- package/dist/simple-tree/node-kinds/object/objectNode.js.map +1 -1
- package/dist/simple-tree/node-kinds/object/objectNodeTypes.d.ts +3 -3
- package/dist/simple-tree/node-kinds/object/objectNodeTypes.d.ts.map +1 -1
- package/dist/simple-tree/node-kinds/object/objectNodeTypes.js.map +1 -1
- package/dist/simple-tree/node-kinds/record/recordNode.d.ts +1 -1
- package/dist/simple-tree/node-kinds/record/recordNode.d.ts.map +1 -1
- package/dist/simple-tree/node-kinds/record/recordNode.js +36 -38
- package/dist/simple-tree/node-kinds/record/recordNode.js.map +1 -1
- package/dist/simple-tree/node-kinds/record/recordNodeTypes.d.ts +1 -1
- package/dist/simple-tree/node-kinds/record/recordNodeTypes.d.ts.map +1 -1
- package/dist/simple-tree/node-kinds/record/recordNodeTypes.js.map +1 -1
- package/dist/simple-tree/prepareForInsertion.d.ts +47 -54
- package/dist/simple-tree/prepareForInsertion.d.ts.map +1 -1
- package/dist/simple-tree/prepareForInsertion.js +128 -186
- package/dist/simple-tree/prepareForInsertion.js.map +1 -1
- package/dist/simple-tree/simpleSchema.d.ts.map +1 -1
- package/dist/simple-tree/simpleSchema.js.map +1 -1
- package/dist/simple-tree/treeSchema.d.ts.map +1 -1
- package/dist/simple-tree/treeSchema.js.map +1 -1
- package/dist/simple-tree/unhydratedFlexTreeFromInsertable.d.ts +4 -13
- package/dist/simple-tree/unhydratedFlexTreeFromInsertable.d.ts.map +1 -1
- package/dist/simple-tree/unhydratedFlexTreeFromInsertable.js +22 -40
- package/dist/simple-tree/unhydratedFlexTreeFromInsertable.js.map +1 -1
- package/dist/tableSchema.d.ts.map +1 -1
- package/dist/tableSchema.js +22 -21
- package/dist/tableSchema.js.map +1 -1
- package/dist/text/index.d.ts +1 -0
- package/dist/text/index.d.ts.map +1 -1
- package/dist/text/index.js +3 -1
- package/dist/text/index.js.map +1 -1
- package/dist/text/textDomain.d.ts +8 -0
- package/dist/text/textDomain.d.ts.map +1 -1
- package/dist/text/textDomain.js +2 -1
- package/dist/text/textDomain.js.map +1 -1
- package/dist/text/textDomainFormatted.d.ts +572 -0
- package/dist/text/textDomainFormatted.d.ts.map +1 -0
- package/dist/text/textDomainFormatted.js +183 -0
- package/dist/text/textDomainFormatted.js.map +1 -0
- package/dist/treeFactory.d.ts.map +1 -1
- package/dist/treeFactory.js +11 -21
- package/dist/treeFactory.js.map +1 -1
- package/dist/util/bTreeUtils.d.ts.map +1 -1
- package/dist/util/bTreeUtils.js +1 -1
- package/dist/util/bTreeUtils.js.map +1 -1
- package/dist/util/index.d.ts +1 -1
- package/dist/util/index.d.ts.map +1 -1
- package/dist/util/index.js +1 -2
- package/dist/util/index.js.map +1 -1
- package/dist/util/rangeMap.d.ts +12 -24
- package/dist/util/rangeMap.d.ts.map +1 -1
- package/dist/util/rangeMap.js +6 -46
- package/dist/util/rangeMap.js.map +1 -1
- package/dist/util/readSnapshotBlob.d.ts +1 -1
- package/dist/util/readSnapshotBlob.d.ts.map +1 -1
- package/dist/util/readSnapshotBlob.js.map +1 -1
- package/docs/main/sequence-field/move-composition.md +46 -0
- package/eslint.config.mts +4 -4
- package/lib/codec/codec.d.ts +2 -2
- package/lib/codec/codec.d.ts.map +1 -1
- package/lib/codec/codec.js +1 -1
- package/lib/codec/codec.js.map +1 -1
- package/lib/codec/versioned/codec.d.ts +1 -1
- package/lib/codec/versioned/codec.d.ts.map +1 -1
- package/lib/codec/versioned/codec.js +2 -2
- package/lib/codec/versioned/codec.js.map +1 -1
- package/lib/core/change-family/changeFamily.d.ts +1 -4
- package/lib/core/change-family/changeFamily.d.ts.map +1 -1
- package/lib/core/change-family/changeFamily.js.map +1 -1
- package/lib/core/change-family/index.d.ts +1 -1
- package/lib/core/change-family/index.d.ts.map +1 -1
- package/lib/core/change-family/index.js.map +1 -1
- package/lib/core/index.d.ts +3 -3
- package/lib/core/index.d.ts.map +1 -1
- package/lib/core/index.js +2 -2
- package/lib/core/index.js.map +1 -1
- package/lib/core/rebase/changeRebaser.d.ts +1 -6
- package/lib/core/rebase/changeRebaser.d.ts.map +1 -1
- package/lib/core/rebase/changeRebaser.js.map +1 -1
- package/lib/core/rebase/index.d.ts +1 -1
- package/lib/core/rebase/index.d.ts.map +1 -1
- package/lib/core/rebase/index.js +1 -1
- package/lib/core/rebase/index.js.map +1 -1
- package/lib/core/rebase/types.d.ts +1 -2
- package/lib/core/rebase/types.d.ts.map +1 -1
- package/lib/core/rebase/types.js +0 -3
- package/lib/core/rebase/types.js.map +1 -1
- package/lib/core/rebase/utils.d.ts.map +1 -1
- package/lib/core/rebase/utils.js +7 -25
- package/lib/core/rebase/utils.js.map +1 -1
- 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/anchorSet.d.ts.map +1 -1
- package/lib/core/tree/anchorSet.js +1 -1
- package/lib/core/tree/anchorSet.js.map +1 -1
- package/lib/core/tree/detachedFieldIndex.d.ts +0 -6
- package/lib/core/tree/detachedFieldIndex.d.ts.map +1 -1
- package/lib/core/tree/detachedFieldIndex.js +1 -10
- package/lib/core/tree/detachedFieldIndex.js.map +1 -1
- package/lib/core/tree/detachedFieldIndexCodecCommon.d.ts +1 -1
- package/lib/core/tree/detachedFieldIndexCodecCommon.d.ts.map +1 -1
- package/lib/core/tree/detachedFieldIndexCodecCommon.js.map +1 -1
- package/lib/core/tree/detachedFieldIndexCodecV1.d.ts.map +1 -1
- package/lib/core/tree/detachedFieldIndexCodecV1.js +1 -1
- package/lib/core/tree/detachedFieldIndexCodecV1.js.map +1 -1
- package/lib/core/tree/detachedFieldIndexCodecV2.d.ts.map +1 -1
- package/lib/core/tree/detachedFieldIndexCodecV2.js +2 -2
- package/lib/core/tree/detachedFieldIndexCodecV2.js.map +1 -1
- package/lib/core/tree/detachedFieldIndexFormatV1.d.ts.map +1 -1
- package/lib/core/tree/detachedFieldIndexFormatV1.js +2 -2
- package/lib/core/tree/detachedFieldIndexFormatV1.js.map +1 -1
- package/lib/core/tree/detachedFieldIndexFormatV2.d.ts.map +1 -1
- package/lib/core/tree/detachedFieldIndexFormatV2.js +2 -2
- package/lib/core/tree/detachedFieldIndexFormatV2.js.map +1 -1
- package/lib/core/tree/index.d.ts +1 -1
- package/lib/core/tree/index.d.ts.map +1 -1
- package/lib/core/tree/index.js +1 -1
- package/lib/core/tree/index.js.map +1 -1
- package/lib/core/tree/pathTree.d.ts +3 -11
- package/lib/core/tree/pathTree.d.ts.map +1 -1
- package/lib/core/tree/pathTree.js +1 -12
- package/lib/core/tree/pathTree.js.map +1 -1
- package/lib/core/tree/visitDelta.d.ts +1 -1
- package/lib/core/tree/visitDelta.d.ts.map +1 -1
- package/lib/core/tree/visitDelta.js.map +1 -1
- package/lib/core/tree/visitorUtils.d.ts.map +1 -1
- package/lib/core/tree/visitorUtils.js +1 -1
- package/lib/core/tree/visitorUtils.js.map +1 -1
- package/lib/feature-libraries/changeAtomIdBTree.d.ts +3 -4
- package/lib/feature-libraries/changeAtomIdBTree.d.ts.map +1 -1
- package/lib/feature-libraries/changeAtomIdBTree.js +1 -14
- package/lib/feature-libraries/changeAtomIdBTree.js.map +1 -1
- package/lib/feature-libraries/chunked-forest/basicChunk.d.ts.map +1 -1
- package/lib/feature-libraries/chunked-forest/basicChunk.js +1 -8
- package/lib/feature-libraries/chunked-forest/basicChunk.js.map +1 -1
- package/lib/feature-libraries/chunked-forest/chunkTree.d.ts +1 -1
- package/lib/feature-libraries/chunked-forest/chunkTree.d.ts.map +1 -1
- package/lib/feature-libraries/chunked-forest/chunkTree.js +1 -4
- package/lib/feature-libraries/chunked-forest/chunkTree.js.map +1 -1
- package/lib/feature-libraries/chunked-forest/codec/chunkDecoding.d.ts +1 -1
- package/lib/feature-libraries/chunked-forest/codec/chunkDecoding.d.ts.map +1 -1
- package/lib/feature-libraries/chunked-forest/codec/chunkDecoding.js.map +1 -1
- package/lib/feature-libraries/chunked-forest/codec/chunkDecodingGeneric.d.ts +1 -1
- package/lib/feature-libraries/chunked-forest/codec/chunkDecodingGeneric.d.ts.map +1 -1
- package/lib/feature-libraries/chunked-forest/codec/chunkDecodingGeneric.js.map +1 -1
- package/lib/feature-libraries/chunked-forest/codec/chunkEncodingGeneric.d.ts +1 -1
- package/lib/feature-libraries/chunked-forest/codec/chunkEncodingGeneric.d.ts.map +1 -1
- package/lib/feature-libraries/chunked-forest/codec/chunkEncodingGeneric.js.map +1 -1
- package/lib/feature-libraries/chunked-forest/codec/codecs.d.ts +1 -1
- package/lib/feature-libraries/chunked-forest/codec/codecs.d.ts.map +1 -1
- package/lib/feature-libraries/chunked-forest/codec/codecs.js +1 -1
- package/lib/feature-libraries/chunked-forest/codec/codecs.js.map +1 -1
- package/lib/feature-libraries/chunked-forest/codec/compressedEncode.d.ts +1 -1
- 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.d.ts.map +1 -1
- package/lib/feature-libraries/chunked-forest/codec/format.js +1 -1
- package/lib/feature-libraries/chunked-forest/codec/format.js.map +1 -1
- package/lib/feature-libraries/chunked-forest/codec/formatGeneric.d.ts.map +1 -1
- package/lib/feature-libraries/chunked-forest/codec/formatGeneric.js.map +1 -1
- package/lib/feature-libraries/chunked-forest/codec/schemaBasedEncode.d.ts +1 -1
- package/lib/feature-libraries/chunked-forest/codec/schemaBasedEncode.d.ts.map +1 -1
- package/lib/feature-libraries/chunked-forest/codec/schemaBasedEncode.js +2 -2
- package/lib/feature-libraries/chunked-forest/codec/schemaBasedEncode.js.map +1 -1
- package/lib/feature-libraries/default-schema/defaultEditBuilder.d.ts +44 -93
- package/lib/feature-libraries/default-schema/defaultEditBuilder.d.ts.map +1 -1
- package/lib/feature-libraries/default-schema/defaultEditBuilder.js +73 -237
- package/lib/feature-libraries/default-schema/defaultEditBuilder.js.map +1 -1
- package/lib/feature-libraries/default-schema/defaultFieldKinds.d.ts +11 -53
- package/lib/feature-libraries/default-schema/defaultFieldKinds.d.ts.map +1 -1
- package/lib/feature-libraries/default-schema/defaultFieldKinds.js +6 -56
- package/lib/feature-libraries/default-schema/defaultFieldKinds.js.map +1 -1
- package/lib/feature-libraries/default-schema/index.d.ts +2 -3
- package/lib/feature-libraries/default-schema/index.d.ts.map +1 -1
- package/lib/feature-libraries/default-schema/index.js +1 -2
- package/lib/feature-libraries/default-schema/index.js.map +1 -1
- package/lib/feature-libraries/default-schema/mappedEditBuilder.d.ts +6 -7
- package/lib/feature-libraries/default-schema/mappedEditBuilder.d.ts.map +1 -1
- package/lib/feature-libraries/default-schema/mappedEditBuilder.js +0 -15
- package/lib/feature-libraries/default-schema/mappedEditBuilder.js.map +1 -1
- package/lib/feature-libraries/deltaUtils.d.ts +0 -1
- package/lib/feature-libraries/deltaUtils.d.ts.map +1 -1
- package/lib/feature-libraries/deltaUtils.js +1 -5
- package/lib/feature-libraries/deltaUtils.js.map +1 -1
- package/lib/feature-libraries/fieldKindIdentifiers.d.ts +9 -0
- package/lib/feature-libraries/fieldKindIdentifiers.d.ts.map +1 -0
- package/lib/feature-libraries/fieldKindIdentifiers.js +13 -0
- package/lib/feature-libraries/fieldKindIdentifiers.js.map +1 -0
- package/lib/feature-libraries/flex-tree/context.d.ts +0 -9
- package/lib/feature-libraries/flex-tree/context.d.ts.map +1 -1
- package/lib/feature-libraries/flex-tree/context.js +0 -6
- package/lib/feature-libraries/flex-tree/context.js.map +1 -1
- package/lib/feature-libraries/flex-tree/flexTreeTypes.d.ts +6 -6
- package/lib/feature-libraries/flex-tree/flexTreeTypes.d.ts.map +1 -1
- package/lib/feature-libraries/flex-tree/flexTreeTypes.js.map +1 -1
- package/lib/feature-libraries/flex-tree/lazyField.d.ts +7 -8
- package/lib/feature-libraries/flex-tree/lazyField.d.ts.map +1 -1
- package/lib/feature-libraries/flex-tree/lazyField.js +11 -42
- package/lib/feature-libraries/flex-tree/lazyField.js.map +1 -1
- package/lib/feature-libraries/flex-tree/observer.d.ts +1 -1
- package/lib/feature-libraries/flex-tree/observer.d.ts.map +1 -1
- package/lib/feature-libraries/flex-tree/observer.js.map +1 -1
- package/lib/feature-libraries/forest-summary/codec.d.ts.map +1 -1
- package/lib/feature-libraries/forest-summary/codec.js +1 -1
- package/lib/feature-libraries/forest-summary/codec.js.map +1 -1
- package/lib/feature-libraries/forest-summary/forestSummarizer.d.ts.map +1 -1
- package/lib/feature-libraries/forest-summary/forestSummarizer.js +3 -3
- package/lib/feature-libraries/forest-summary/forestSummarizer.js.map +1 -1
- package/lib/feature-libraries/forest-summary/formatV1.d.ts.map +1 -1
- package/lib/feature-libraries/forest-summary/formatV1.js.map +1 -1
- package/lib/feature-libraries/forest-summary/formatV2.d.ts.map +1 -1
- package/lib/feature-libraries/forest-summary/formatV2.js.map +1 -1
- package/lib/feature-libraries/forest-summary/incrementalSummaryBuilder.d.ts +4 -4
- package/lib/feature-libraries/forest-summary/incrementalSummaryBuilder.d.ts.map +1 -1
- package/lib/feature-libraries/forest-summary/incrementalSummaryBuilder.js +2 -2
- package/lib/feature-libraries/forest-summary/incrementalSummaryBuilder.js.map +1 -1
- package/lib/feature-libraries/forest-summary/summaryTypes.d.ts.map +1 -1
- package/lib/feature-libraries/forest-summary/summaryTypes.js.map +1 -1
- package/lib/feature-libraries/index.d.ts +3 -3
- package/lib/feature-libraries/index.d.ts.map +1 -1
- package/lib/feature-libraries/index.js +2 -2
- package/lib/feature-libraries/index.js.map +1 -1
- package/lib/feature-libraries/mapTreeCursor.d.ts.map +1 -1
- package/lib/feature-libraries/mapTreeCursor.js +1 -2
- package/lib/feature-libraries/mapTreeCursor.js.map +1 -1
- package/lib/feature-libraries/mitigatedChangeFamily.d.ts.map +1 -1
- package/lib/feature-libraries/mitigatedChangeFamily.js +2 -2
- package/lib/feature-libraries/mitigatedChangeFamily.js.map +1 -1
- package/lib/feature-libraries/modular-schema/crossFieldQueries.d.ts +21 -97
- package/lib/feature-libraries/modular-schema/crossFieldQueries.d.ts.map +1 -1
- package/lib/feature-libraries/modular-schema/crossFieldQueries.js +5 -3
- package/lib/feature-libraries/modular-schema/crossFieldQueries.js.map +1 -1
- package/lib/feature-libraries/modular-schema/fieldChangeHandler.d.ts +51 -20
- package/lib/feature-libraries/modular-schema/fieldChangeHandler.d.ts.map +1 -1
- package/lib/feature-libraries/modular-schema/fieldChangeHandler.js.map +1 -1
- package/lib/feature-libraries/modular-schema/fieldKindConfiguration.d.ts.map +1 -1
- package/lib/feature-libraries/modular-schema/fieldKindConfiguration.js.map +1 -1
- package/lib/feature-libraries/modular-schema/genericFieldKind.d.ts +1 -1
- package/lib/feature-libraries/modular-schema/genericFieldKind.d.ts.map +1 -1
- package/lib/feature-libraries/modular-schema/genericFieldKind.js +11 -5
- package/lib/feature-libraries/modular-schema/genericFieldKind.js.map +1 -1
- package/lib/feature-libraries/modular-schema/index.d.ts +4 -4
- package/lib/feature-libraries/modular-schema/index.d.ts.map +1 -1
- package/lib/feature-libraries/modular-schema/index.js +2 -2
- package/lib/feature-libraries/modular-schema/index.js.map +1 -1
- package/lib/feature-libraries/modular-schema/modularChangeCodecV1.d.ts +28 -11
- package/lib/feature-libraries/modular-schema/modularChangeCodecV1.d.ts.map +1 -1
- package/lib/feature-libraries/modular-schema/modularChangeCodecV1.js +144 -246
- package/lib/feature-libraries/modular-schema/modularChangeCodecV1.js.map +1 -1
- package/lib/feature-libraries/modular-schema/modularChangeCodecV2.d.ts.map +1 -1
- package/lib/feature-libraries/modular-schema/modularChangeCodecV2.js +1 -1
- package/lib/feature-libraries/modular-schema/modularChangeCodecV2.js.map +1 -1
- package/lib/feature-libraries/modular-schema/modularChangeCodecs.d.ts.map +1 -1
- package/lib/feature-libraries/modular-schema/modularChangeCodecs.js +1 -8
- package/lib/feature-libraries/modular-schema/modularChangeCodecs.js.map +1 -1
- package/lib/feature-libraries/modular-schema/modularChangeFamily.d.ts +21 -49
- package/lib/feature-libraries/modular-schema/modularChangeFamily.d.ts.map +1 -1
- package/lib/feature-libraries/modular-schema/modularChangeFamily.js +463 -1319
- package/lib/feature-libraries/modular-schema/modularChangeFamily.js.map +1 -1
- package/lib/feature-libraries/modular-schema/modularChangeFormatV1.d.ts.map +1 -1
- package/lib/feature-libraries/modular-schema/modularChangeFormatV1.js.map +1 -1
- package/lib/feature-libraries/modular-schema/modularChangeTypes.d.ts +8 -44
- package/lib/feature-libraries/modular-schema/modularChangeTypes.d.ts.map +1 -1
- package/lib/feature-libraries/modular-schema/modularChangeTypes.js +1 -1
- package/lib/feature-libraries/modular-schema/modularChangeTypes.js.map +1 -1
- package/lib/feature-libraries/object-forest/objectForest.d.ts.map +1 -1
- package/lib/feature-libraries/object-forest/objectForest.js +2 -2
- package/lib/feature-libraries/object-forest/objectForest.js.map +1 -1
- package/lib/feature-libraries/optional-field/index.d.ts +2 -2
- package/lib/feature-libraries/optional-field/index.d.ts.map +1 -1
- package/lib/feature-libraries/optional-field/index.js +2 -2
- package/lib/feature-libraries/optional-field/index.js.map +1 -1
- package/lib/feature-libraries/optional-field/optionalField.d.ts +34 -5
- package/lib/feature-libraries/optional-field/optionalField.d.ts.map +1 -1
- package/lib/feature-libraries/optional-field/optionalField.js +453 -221
- package/lib/feature-libraries/optional-field/optionalField.js.map +1 -1
- package/lib/feature-libraries/optional-field/optionalFieldChangeTypes.d.ts +33 -24
- package/lib/feature-libraries/optional-field/optionalFieldChangeTypes.d.ts.map +1 -1
- package/lib/feature-libraries/optional-field/optionalFieldChangeTypes.js.map +1 -1
- package/lib/feature-libraries/optional-field/optionalFieldCodecV2.d.ts +1 -1
- package/lib/feature-libraries/optional-field/optionalFieldCodecV2.d.ts.map +1 -1
- package/lib/feature-libraries/optional-field/optionalFieldCodecV2.js +26 -55
- package/lib/feature-libraries/optional-field/optionalFieldCodecV2.js.map +1 -1
- package/lib/feature-libraries/optional-field/optionalFieldCodecs.d.ts.map +1 -1
- package/lib/feature-libraries/optional-field/optionalFieldCodecs.js +1 -5
- package/lib/feature-libraries/optional-field/optionalFieldCodecs.js.map +1 -1
- package/lib/feature-libraries/optional-field/requiredField.d.ts +36 -0
- package/lib/feature-libraries/optional-field/requiredField.d.ts.map +1 -0
- package/lib/feature-libraries/optional-field/requiredField.js +24 -0
- package/lib/feature-libraries/optional-field/requiredField.js.map +1 -0
- package/lib/feature-libraries/schema-edits/schemaChangeCodecs.d.ts +1 -1
- package/lib/feature-libraries/schema-edits/schemaChangeCodecs.d.ts.map +1 -1
- package/lib/feature-libraries/schema-edits/schemaChangeCodecs.js +1 -1
- package/lib/feature-libraries/schema-edits/schemaChangeCodecs.js.map +1 -1
- package/lib/feature-libraries/schema-edits/schemaChangeFormat.d.ts.map +1 -1
- package/lib/feature-libraries/schema-edits/schemaChangeFormat.js.map +1 -1
- package/lib/feature-libraries/schemaChecker.d.ts.map +1 -1
- package/lib/feature-libraries/schemaChecker.js +1 -1
- package/lib/feature-libraries/schemaChecker.js.map +1 -1
- package/lib/feature-libraries/sequence-field/compose.d.ts +7 -6
- package/lib/feature-libraries/sequence-field/compose.d.ts.map +1 -1
- package/lib/feature-libraries/sequence-field/compose.js +261 -85
- package/lib/feature-libraries/sequence-field/compose.js.map +1 -1
- package/lib/feature-libraries/sequence-field/helperTypes.d.ts +10 -14
- package/lib/feature-libraries/sequence-field/helperTypes.d.ts.map +1 -1
- package/lib/feature-libraries/sequence-field/helperTypes.js.map +1 -1
- package/lib/feature-libraries/sequence-field/index.d.ts +2 -13
- package/lib/feature-libraries/sequence-field/index.d.ts.map +1 -1
- package/lib/feature-libraries/sequence-field/index.js +1 -12
- package/lib/feature-libraries/sequence-field/index.js.map +1 -1
- package/lib/feature-libraries/sequence-field/invert.d.ts +3 -3
- package/lib/feature-libraries/sequence-field/invert.d.ts.map +1 -1
- package/lib/feature-libraries/sequence-field/invert.js +169 -67
- package/lib/feature-libraries/sequence-field/invert.js.map +1 -1
- package/lib/feature-libraries/sequence-field/markQueue.d.ts +2 -2
- package/lib/feature-libraries/sequence-field/markQueue.d.ts.map +1 -1
- package/lib/feature-libraries/sequence-field/markQueue.js.map +1 -1
- package/lib/feature-libraries/sequence-field/moveEffectTable.d.ts +56 -4
- package/lib/feature-libraries/sequence-field/moveEffectTable.d.ts.map +1 -1
- package/lib/feature-libraries/sequence-field/moveEffectTable.js +84 -6
- package/lib/feature-libraries/sequence-field/moveEffectTable.js.map +1 -1
- package/lib/feature-libraries/sequence-field/rebase.d.ts +3 -3
- package/lib/feature-libraries/sequence-field/rebase.d.ts.map +1 -1
- package/lib/feature-libraries/sequence-field/rebase.js +116 -109
- package/lib/feature-libraries/sequence-field/rebase.js.map +1 -1
- package/lib/feature-libraries/sequence-field/relevantRemovedRoots.d.ts +9 -0
- package/lib/feature-libraries/sequence-field/relevantRemovedRoots.d.ts.map +1 -0
- package/lib/feature-libraries/sequence-field/relevantRemovedRoots.js +46 -0
- package/lib/feature-libraries/sequence-field/relevantRemovedRoots.js.map +1 -0
- package/lib/feature-libraries/sequence-field/replaceRevisions.d.ts.map +1 -1
- package/lib/feature-libraries/sequence-field/replaceRevisions.js +31 -18
- package/lib/feature-libraries/sequence-field/replaceRevisions.js.map +1 -1
- package/lib/feature-libraries/sequence-field/sequenceFieldChangeHandler.d.ts.map +1 -1
- package/lib/feature-libraries/sequence-field/sequenceFieldChangeHandler.js +2 -0
- package/lib/feature-libraries/sequence-field/sequenceFieldChangeHandler.js.map +1 -1
- package/lib/feature-libraries/sequence-field/sequenceFieldCodecV2.d.ts +4 -22
- package/lib/feature-libraries/sequence-field/sequenceFieldCodecV2.d.ts.map +1 -1
- package/lib/feature-libraries/sequence-field/sequenceFieldCodecV2.js +182 -356
- package/lib/feature-libraries/sequence-field/sequenceFieldCodecV2.js.map +1 -1
- package/lib/feature-libraries/sequence-field/sequenceFieldCodecV3.d.ts.map +1 -1
- package/lib/feature-libraries/sequence-field/sequenceFieldCodecV3.js +63 -21
- package/lib/feature-libraries/sequence-field/sequenceFieldCodecV3.js.map +1 -1
- package/lib/feature-libraries/sequence-field/sequenceFieldEditor.d.ts +2 -2
- package/lib/feature-libraries/sequence-field/sequenceFieldEditor.d.ts.map +1 -1
- package/lib/feature-libraries/sequence-field/sequenceFieldEditor.js +10 -10
- package/lib/feature-libraries/sequence-field/sequenceFieldEditor.js.map +1 -1
- package/lib/feature-libraries/sequence-field/sequenceFieldToDelta.d.ts +2 -3
- package/lib/feature-libraries/sequence-field/sequenceFieldToDelta.d.ts.map +1 -1
- package/lib/feature-libraries/sequence-field/sequenceFieldToDelta.js +109 -14
- package/lib/feature-libraries/sequence-field/sequenceFieldToDelta.js.map +1 -1
- package/lib/feature-libraries/sequence-field/sequenceKind.d.ts +16 -0
- package/lib/feature-libraries/sequence-field/sequenceKind.d.ts.map +1 -0
- package/lib/feature-libraries/sequence-field/sequenceKind.js +21 -0
- package/lib/feature-libraries/sequence-field/sequenceKind.js.map +1 -0
- package/lib/feature-libraries/sequence-field/types.d.ts +59 -30
- package/lib/feature-libraries/sequence-field/types.d.ts.map +1 -1
- package/lib/feature-libraries/sequence-field/types.js.map +1 -1
- package/lib/feature-libraries/sequence-field/utils.d.ts +24 -15
- package/lib/feature-libraries/sequence-field/utils.d.ts.map +1 -1
- package/lib/feature-libraries/sequence-field/utils.js +298 -112
- package/lib/feature-libraries/sequence-field/utils.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.d.ts.map +1 -1
- package/lib/packageVersion.js +1 -1
- package/lib/packageVersion.js.map +1 -1
- package/lib/shared-tree/independentView.d.ts.map +1 -1
- package/lib/shared-tree/independentView.js +3 -3
- package/lib/shared-tree/independentView.js.map +1 -1
- package/lib/shared-tree/index.d.ts +1 -1
- package/lib/shared-tree/index.d.ts.map +1 -1
- package/lib/shared-tree/index.js.map +1 -1
- package/lib/shared-tree/schematizeTree.d.ts +4 -4
- package/lib/shared-tree/schematizeTree.d.ts.map +1 -1
- package/lib/shared-tree/schematizeTree.js +2 -3
- package/lib/shared-tree/schematizeTree.js.map +1 -1
- package/lib/shared-tree/schematizingTreeView.d.ts +5 -1
- package/lib/shared-tree/schematizingTreeView.d.ts.map +1 -1
- package/lib/shared-tree/schematizingTreeView.js +42 -43
- package/lib/shared-tree/schematizingTreeView.js.map +1 -1
- package/lib/shared-tree/sharedTree.d.ts +5 -11
- package/lib/shared-tree/sharedTree.d.ts.map +1 -1
- package/lib/shared-tree/sharedTree.js +5 -43
- package/lib/shared-tree/sharedTree.js.map +1 -1
- package/lib/shared-tree/sharedTreeChangeCodecs.d.ts +1 -1
- package/lib/shared-tree/sharedTreeChangeCodecs.d.ts.map +1 -1
- package/lib/shared-tree/sharedTreeChangeCodecs.js +0 -1
- package/lib/shared-tree/sharedTreeChangeCodecs.js.map +1 -1
- package/lib/shared-tree/sharedTreeChangeEnricher.d.ts +31 -24
- package/lib/shared-tree/sharedTreeChangeEnricher.d.ts.map +1 -1
- package/lib/shared-tree/sharedTreeChangeEnricher.js +74 -56
- package/lib/shared-tree/sharedTreeChangeEnricher.js.map +1 -1
- package/lib/shared-tree/sharedTreeChangeFamily.d.ts +5 -5
- package/lib/shared-tree/sharedTreeChangeFamily.d.ts.map +1 -1
- package/lib/shared-tree/sharedTreeChangeFamily.js +5 -11
- package/lib/shared-tree/sharedTreeChangeFamily.js.map +1 -1
- package/lib/shared-tree/sharedTreeEditBuilder.d.ts +6 -16
- package/lib/shared-tree/sharedTreeEditBuilder.d.ts.map +1 -1
- package/lib/shared-tree/sharedTreeEditBuilder.js +6 -12
- package/lib/shared-tree/sharedTreeEditBuilder.js.map +1 -1
- package/lib/shared-tree/tree.d.ts.map +1 -1
- package/lib/shared-tree/tree.js +7 -7
- package/lib/shared-tree/tree.js.map +1 -1
- package/lib/shared-tree/treeAlpha.d.ts +1 -1
- package/lib/shared-tree/treeAlpha.d.ts.map +1 -1
- package/lib/shared-tree/treeAlpha.js +3 -3
- package/lib/shared-tree/treeAlpha.js.map +1 -1
- package/lib/shared-tree/treeCheckout.d.ts +29 -13
- package/lib/shared-tree/treeCheckout.d.ts.map +1 -1
- package/lib/shared-tree/treeCheckout.js +55 -54
- package/lib/shared-tree/treeCheckout.js.map +1 -1
- package/lib/shared-tree-core/branch.d.ts +3 -4
- package/lib/shared-tree-core/branch.d.ts.map +1 -1
- package/lib/shared-tree-core/branch.js +3 -4
- package/lib/shared-tree-core/branch.js.map +1 -1
- package/lib/shared-tree-core/branchCommitEnricher.d.ts +18 -31
- package/lib/shared-tree-core/branchCommitEnricher.d.ts.map +1 -1
- package/lib/shared-tree-core/branchCommitEnricher.js +24 -76
- package/lib/shared-tree-core/branchCommitEnricher.js.map +1 -1
- package/lib/shared-tree-core/branchIdCodec.d.ts.map +1 -1
- package/lib/shared-tree-core/branchIdCodec.js.map +1 -1
- package/lib/shared-tree-core/changeEnricher.d.ts +8 -43
- package/lib/shared-tree-core/changeEnricher.d.ts.map +1 -1
- package/lib/shared-tree-core/changeEnricher.js +1 -11
- package/lib/shared-tree-core/changeEnricher.js.map +1 -1
- package/lib/shared-tree-core/defaultResubmitMachine.d.ts +4 -12
- package/lib/shared-tree-core/defaultResubmitMachine.d.ts.map +1 -1
- package/lib/shared-tree-core/defaultResubmitMachine.js +28 -38
- package/lib/shared-tree-core/defaultResubmitMachine.js.map +1 -1
- package/lib/shared-tree-core/editManager.d.ts +3 -3
- package/lib/shared-tree-core/editManager.d.ts.map +1 -1
- package/lib/shared-tree-core/editManager.js +11 -11
- package/lib/shared-tree-core/editManager.js.map +1 -1
- package/lib/shared-tree-core/editManagerCodecs.d.ts +1 -5
- package/lib/shared-tree-core/editManagerCodecs.d.ts.map +1 -1
- package/lib/shared-tree-core/editManagerCodecs.js +1 -8
- package/lib/shared-tree-core/editManagerCodecs.js.map +1 -1
- package/lib/shared-tree-core/editManagerCodecsCommons.d.ts +1 -1
- package/lib/shared-tree-core/editManagerCodecsCommons.d.ts.map +1 -1
- package/lib/shared-tree-core/editManagerCodecsCommons.js +1 -2
- package/lib/shared-tree-core/editManagerCodecsCommons.js.map +1 -1
- package/lib/shared-tree-core/editManagerCodecsV1toV4.d.ts.map +1 -1
- package/lib/shared-tree-core/editManagerCodecsV1toV4.js +1 -1
- package/lib/shared-tree-core/editManagerCodecsV1toV4.js.map +1 -1
- package/lib/shared-tree-core/editManagerCodecsVSharedBranches.d.ts.map +1 -1
- package/lib/shared-tree-core/editManagerCodecsVSharedBranches.js +1 -1
- package/lib/shared-tree-core/editManagerCodecsVSharedBranches.js.map +1 -1
- package/lib/shared-tree-core/editManagerFormatCommons.d.ts +0 -1
- package/lib/shared-tree-core/editManagerFormatCommons.d.ts.map +1 -1
- package/lib/shared-tree-core/editManagerFormatCommons.js +0 -6
- package/lib/shared-tree-core/editManagerFormatCommons.js.map +1 -1
- package/lib/shared-tree-core/editManagerFormatV1toV4.d.ts +2 -2
- package/lib/shared-tree-core/editManagerFormatV1toV4.d.ts.map +1 -1
- package/lib/shared-tree-core/editManagerFormatV1toV4.js +0 -1
- package/lib/shared-tree-core/editManagerFormatV1toV4.js.map +1 -1
- package/lib/shared-tree-core/editManagerFormatVSharedBranches.d.ts +1 -1
- 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/index.d.ts +4 -4
- package/lib/shared-tree-core/index.d.ts.map +1 -1
- package/lib/shared-tree-core/index.js +2 -3
- package/lib/shared-tree-core/index.js.map +1 -1
- package/lib/shared-tree-core/messageCodecV1ToV4.d.ts +2 -2
- package/lib/shared-tree-core/messageCodecV1ToV4.d.ts.map +1 -1
- package/lib/shared-tree-core/messageCodecV1ToV4.js +1 -1
- package/lib/shared-tree-core/messageCodecV1ToV4.js.map +1 -1
- package/lib/shared-tree-core/messageCodecVSharedBranches.d.ts +1 -1
- package/lib/shared-tree-core/messageCodecVSharedBranches.d.ts.map +1 -1
- package/lib/shared-tree-core/messageCodecVSharedBranches.js +2 -2
- package/lib/shared-tree-core/messageCodecVSharedBranches.js.map +1 -1
- package/lib/shared-tree-core/messageCodecs.d.ts +2 -6
- package/lib/shared-tree-core/messageCodecs.d.ts.map +1 -1
- package/lib/shared-tree-core/messageCodecs.js +1 -8
- package/lib/shared-tree-core/messageCodecs.js.map +1 -1
- package/lib/shared-tree-core/messageFormat.d.ts +0 -1
- package/lib/shared-tree-core/messageFormat.d.ts.map +1 -1
- package/lib/shared-tree-core/messageFormat.js +0 -6
- package/lib/shared-tree-core/messageFormat.js.map +1 -1
- package/lib/shared-tree-core/messageFormatV1ToV4.d.ts +2 -2
- package/lib/shared-tree-core/messageFormatV1ToV4.d.ts.map +1 -1
- package/lib/shared-tree-core/messageFormatV1ToV4.js +0 -1
- package/lib/shared-tree-core/messageFormatV1ToV4.js.map +1 -1
- package/lib/shared-tree-core/messageFormatVSharedBranches.d.ts.map +1 -1
- package/lib/shared-tree-core/messageFormatVSharedBranches.js.map +1 -1
- package/lib/shared-tree-core/messageTypes.d.ts.map +1 -1
- package/lib/shared-tree-core/messageTypes.js.map +1 -1
- package/lib/shared-tree-core/sharedTreeCore.d.ts +8 -5
- package/lib/shared-tree-core/sharedTreeCore.d.ts.map +1 -1
- package/lib/shared-tree-core/sharedTreeCore.js +15 -15
- package/lib/shared-tree-core/sharedTreeCore.js.map +1 -1
- package/lib/shared-tree-core/versionedSummarizer.d.ts.map +1 -1
- package/lib/shared-tree-core/versionedSummarizer.js +1 -1
- package/lib/shared-tree-core/versionedSummarizer.js.map +1 -1
- package/lib/simple-tree/api/configuration.d.ts +2 -2
- package/lib/simple-tree/api/configuration.d.ts.map +1 -1
- package/lib/simple-tree/api/configuration.js +4 -4
- package/lib/simple-tree/api/configuration.js.map +1 -1
- package/lib/simple-tree/api/create.d.ts +1 -1
- package/lib/simple-tree/api/create.d.ts.map +1 -1
- package/lib/simple-tree/api/create.js +1 -1
- package/lib/simple-tree/api/create.js.map +1 -1
- package/lib/simple-tree/api/dirtyIndex.d.ts +1 -1
- package/lib/simple-tree/api/dirtyIndex.d.ts.map +1 -1
- package/lib/simple-tree/api/dirtyIndex.js.map +1 -1
- package/lib/simple-tree/api/discrepancies.d.ts.map +1 -1
- package/lib/simple-tree/api/discrepancies.js +3 -3
- package/lib/simple-tree/api/discrepancies.js.map +1 -1
- package/lib/simple-tree/api/getJsonSchema.d.ts +1 -1
- package/lib/simple-tree/api/getJsonSchema.d.ts.map +1 -1
- package/lib/simple-tree/api/getJsonSchema.js +1 -1
- package/lib/simple-tree/api/getJsonSchema.js.map +1 -1
- package/lib/simple-tree/api/identifierIndex.d.ts +2 -2
- package/lib/simple-tree/api/identifierIndex.d.ts.map +1 -1
- package/lib/simple-tree/api/identifierIndex.js.map +1 -1
- package/lib/simple-tree/api/incrementalAllowedTypes.d.ts +1 -1
- package/lib/simple-tree/api/incrementalAllowedTypes.d.ts.map +1 -1
- package/lib/simple-tree/api/incrementalAllowedTypes.js +3 -3
- package/lib/simple-tree/api/incrementalAllowedTypes.js.map +1 -1
- package/lib/simple-tree/api/schemaCompatibilityTester.d.ts +1 -1
- package/lib/simple-tree/api/schemaCompatibilityTester.d.ts.map +1 -1
- package/lib/simple-tree/api/schemaCompatibilityTester.js +1 -1
- package/lib/simple-tree/api/schemaCompatibilityTester.js.map +1 -1
- package/lib/simple-tree/api/schemaCreationUtilities.d.ts +2 -2
- package/lib/simple-tree/api/schemaCreationUtilities.d.ts.map +1 -1
- package/lib/simple-tree/api/schemaCreationUtilities.js +1 -1
- package/lib/simple-tree/api/schemaCreationUtilities.js.map +1 -1
- package/lib/simple-tree/api/schemaFactory.d.ts +2 -2
- package/lib/simple-tree/api/schemaFactory.d.ts.map +1 -1
- package/lib/simple-tree/api/schemaFactory.js +2 -2
- package/lib/simple-tree/api/schemaFactory.js.map +1 -1
- package/lib/simple-tree/api/schemaFactoryAlpha.d.ts +6 -6
- package/lib/simple-tree/api/schemaFactoryAlpha.d.ts.map +1 -1
- package/lib/simple-tree/api/schemaFactoryAlpha.js +1 -1
- package/lib/simple-tree/api/schemaFactoryAlpha.js.map +1 -1
- package/lib/simple-tree/api/schemaFactoryBeta.d.ts +2 -2
- package/lib/simple-tree/api/schemaFactoryBeta.d.ts.map +1 -1
- package/lib/simple-tree/api/schemaFactoryBeta.js +1 -0
- package/lib/simple-tree/api/schemaFactoryBeta.js.map +1 -1
- package/lib/simple-tree/api/schemaFactoryRecursive.d.ts +1 -1
- package/lib/simple-tree/api/schemaFactoryRecursive.d.ts.map +1 -1
- package/lib/simple-tree/api/schemaFactoryRecursive.js.map +1 -1
- package/lib/simple-tree/api/schemaFromSimple.d.ts.map +1 -1
- package/lib/simple-tree/api/schemaFromSimple.js.map +1 -1
- package/lib/simple-tree/api/schemaStatics.d.ts.map +1 -1
- package/lib/simple-tree/api/schemaStatics.js.map +1 -1
- package/lib/simple-tree/api/simpleSchemaCodec.d.ts +1 -1
- package/lib/simple-tree/api/simpleSchemaCodec.d.ts.map +1 -1
- package/lib/simple-tree/api/simpleSchemaCodec.js +3 -3
- package/lib/simple-tree/api/simpleSchemaCodec.js.map +1 -1
- package/lib/simple-tree/api/simpleSchemaToJsonSchema.d.ts +2 -2
- package/lib/simple-tree/api/simpleSchemaToJsonSchema.d.ts.map +1 -1
- package/lib/simple-tree/api/simpleSchemaToJsonSchema.js +2 -2
- package/lib/simple-tree/api/simpleSchemaToJsonSchema.js.map +1 -1
- package/lib/simple-tree/api/simpleTreeIndex.d.ts +1 -1
- package/lib/simple-tree/api/simpleTreeIndex.d.ts.map +1 -1
- package/lib/simple-tree/api/simpleTreeIndex.js +1 -1
- package/lib/simple-tree/api/simpleTreeIndex.js.map +1 -1
- package/lib/simple-tree/api/snapshotCompatibilityChecker.d.ts.map +1 -1
- package/lib/simple-tree/api/snapshotCompatibilityChecker.js +5 -5
- package/lib/simple-tree/api/snapshotCompatibilityChecker.js.map +1 -1
- package/lib/simple-tree/api/storedSchema.d.ts.map +1 -1
- package/lib/simple-tree/api/storedSchema.js.map +1 -1
- package/lib/simple-tree/api/tree.d.ts +2 -2
- package/lib/simple-tree/api/tree.d.ts.map +1 -1
- package/lib/simple-tree/api/tree.js.map +1 -1
- package/lib/simple-tree/api/treeBeta.d.ts +1 -1
- package/lib/simple-tree/api/treeBeta.d.ts.map +1 -1
- package/lib/simple-tree/api/treeBeta.js +2 -2
- package/lib/simple-tree/api/treeBeta.js.map +1 -1
- package/lib/simple-tree/api/treeNodeApi.d.ts.map +1 -1
- package/lib/simple-tree/api/treeNodeApi.js +4 -4
- package/lib/simple-tree/api/treeNodeApi.js.map +1 -1
- package/lib/simple-tree/api/typesUnsafe.d.ts +1 -1
- package/lib/simple-tree/api/typesUnsafe.d.ts.map +1 -1
- package/lib/simple-tree/api/typesUnsafe.js.map +1 -1
- package/lib/simple-tree/api/verboseTree.d.ts +1 -1
- package/lib/simple-tree/api/verboseTree.d.ts.map +1 -1
- package/lib/simple-tree/api/verboseTree.js +3 -3
- package/lib/simple-tree/api/verboseTree.js.map +1 -1
- package/lib/simple-tree/core/allowedTypes.d.ts +1 -1
- package/lib/simple-tree/core/allowedTypes.d.ts.map +1 -1
- package/lib/simple-tree/core/allowedTypes.js +2 -2
- package/lib/simple-tree/core/allowedTypes.js.map +1 -1
- package/lib/simple-tree/core/context.d.ts.map +1 -1
- package/lib/simple-tree/core/context.js.map +1 -1
- package/lib/simple-tree/core/treeNode.d.ts.map +1 -1
- package/lib/simple-tree/core/treeNode.js +1 -1
- package/lib/simple-tree/core/treeNode.js.map +1 -1
- package/lib/simple-tree/core/treeNodeKernel.d.ts.map +1 -1
- package/lib/simple-tree/core/treeNodeKernel.js +1 -3
- package/lib/simple-tree/core/treeNodeKernel.js.map +1 -1
- package/lib/simple-tree/core/treeNodeSchema.d.ts +5 -5
- package/lib/simple-tree/core/treeNodeSchema.d.ts.map +1 -1
- package/lib/simple-tree/core/treeNodeSchema.js.map +1 -1
- package/lib/simple-tree/core/treeNodeValid.d.ts +3 -3
- package/lib/simple-tree/core/treeNodeValid.d.ts.map +1 -1
- package/lib/simple-tree/core/treeNodeValid.js +2 -2
- package/lib/simple-tree/core/treeNodeValid.js.map +1 -1
- package/lib/simple-tree/core/unhydratedFlexTree.d.ts +16 -16
- package/lib/simple-tree/core/unhydratedFlexTree.d.ts.map +1 -1
- package/lib/simple-tree/core/unhydratedFlexTree.js +8 -58
- package/lib/simple-tree/core/unhydratedFlexTree.js.map +1 -1
- package/lib/simple-tree/core/withType.d.ts.map +1 -1
- package/lib/simple-tree/core/withType.js.map +1 -1
- package/lib/simple-tree/createContext.d.ts.map +1 -1
- package/lib/simple-tree/createContext.js.map +1 -1
- package/lib/simple-tree/fieldSchema.d.ts +5 -5
- package/lib/simple-tree/fieldSchema.d.ts.map +1 -1
- package/lib/simple-tree/fieldSchema.js.map +1 -1
- package/lib/simple-tree/index.d.ts +2 -2
- package/lib/simple-tree/index.d.ts.map +1 -1
- package/lib/simple-tree/index.js +1 -1
- package/lib/simple-tree/index.js.map +1 -1
- package/lib/simple-tree/leafNodeSchema.d.ts +1 -1
- package/lib/simple-tree/leafNodeSchema.d.ts.map +1 -1
- package/lib/simple-tree/leafNodeSchema.js +2 -2
- package/lib/simple-tree/leafNodeSchema.js.map +1 -1
- package/lib/simple-tree/node-kinds/array/arrayNode.d.ts +1 -1
- package/lib/simple-tree/node-kinds/array/arrayNode.d.ts.map +1 -1
- package/lib/simple-tree/node-kinds/array/arrayNode.js +6 -8
- package/lib/simple-tree/node-kinds/array/arrayNode.js.map +1 -1
- package/lib/simple-tree/node-kinds/array/arrayNodeTypes.d.ts +1 -1
- package/lib/simple-tree/node-kinds/array/arrayNodeTypes.d.ts.map +1 -1
- package/lib/simple-tree/node-kinds/array/arrayNodeTypes.js.map +1 -1
- package/lib/simple-tree/node-kinds/common.d.ts.map +1 -1
- package/lib/simple-tree/node-kinds/common.js +2 -2
- package/lib/simple-tree/node-kinds/common.js.map +1 -1
- package/lib/simple-tree/node-kinds/map/mapNode.d.ts +2 -2
- package/lib/simple-tree/node-kinds/map/mapNode.d.ts.map +1 -1
- package/lib/simple-tree/node-kinds/map/mapNode.js +8 -8
- package/lib/simple-tree/node-kinds/map/mapNode.js.map +1 -1
- package/lib/simple-tree/node-kinds/map/mapNodeTypes.d.ts +1 -1
- package/lib/simple-tree/node-kinds/map/mapNodeTypes.d.ts.map +1 -1
- package/lib/simple-tree/node-kinds/map/mapNodeTypes.js.map +1 -1
- package/lib/simple-tree/node-kinds/object/objectNode.d.ts +2 -2
- package/lib/simple-tree/node-kinds/object/objectNode.d.ts.map +1 -1
- package/lib/simple-tree/node-kinds/object/objectNode.js +22 -22
- package/lib/simple-tree/node-kinds/object/objectNode.js.map +1 -1
- package/lib/simple-tree/node-kinds/object/objectNodeTypes.d.ts +3 -3
- package/lib/simple-tree/node-kinds/object/objectNodeTypes.d.ts.map +1 -1
- package/lib/simple-tree/node-kinds/object/objectNodeTypes.js.map +1 -1
- package/lib/simple-tree/node-kinds/record/recordNode.d.ts +1 -1
- package/lib/simple-tree/node-kinds/record/recordNode.d.ts.map +1 -1
- package/lib/simple-tree/node-kinds/record/recordNode.js +6 -8
- package/lib/simple-tree/node-kinds/record/recordNode.js.map +1 -1
- package/lib/simple-tree/node-kinds/record/recordNodeTypes.d.ts +1 -1
- package/lib/simple-tree/node-kinds/record/recordNodeTypes.d.ts.map +1 -1
- package/lib/simple-tree/node-kinds/record/recordNodeTypes.js.map +1 -1
- package/lib/simple-tree/prepareForInsertion.d.ts +47 -54
- package/lib/simple-tree/prepareForInsertion.d.ts.map +1 -1
- package/lib/simple-tree/prepareForInsertion.js +125 -184
- package/lib/simple-tree/prepareForInsertion.js.map +1 -1
- package/lib/simple-tree/simpleSchema.d.ts.map +1 -1
- package/lib/simple-tree/simpleSchema.js.map +1 -1
- package/lib/simple-tree/treeSchema.d.ts.map +1 -1
- package/lib/simple-tree/treeSchema.js.map +1 -1
- package/lib/simple-tree/unhydratedFlexTreeFromInsertable.d.ts +4 -13
- package/lib/simple-tree/unhydratedFlexTreeFromInsertable.d.ts.map +1 -1
- package/lib/simple-tree/unhydratedFlexTreeFromInsertable.js +13 -30
- package/lib/simple-tree/unhydratedFlexTreeFromInsertable.js.map +1 -1
- package/lib/tableSchema.d.ts.map +1 -1
- package/lib/tableSchema.js +2 -1
- package/lib/tableSchema.js.map +1 -1
- 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 +8 -0
- package/lib/text/textDomain.d.ts.map +1 -1
- package/lib/text/textDomain.js +1 -1
- package/lib/text/textDomain.js.map +1 -1
- package/lib/text/textDomainFormatted.d.ts +572 -0
- package/lib/text/textDomainFormatted.d.ts.map +1 -0
- package/lib/text/textDomainFormatted.js +180 -0
- package/lib/text/textDomainFormatted.js.map +1 -0
- package/lib/treeFactory.d.ts.map +1 -1
- package/lib/treeFactory.js +4 -14
- package/lib/treeFactory.js.map +1 -1
- package/lib/util/bTreeUtils.d.ts.map +1 -1
- package/lib/util/bTreeUtils.js +1 -1
- package/lib/util/bTreeUtils.js.map +1 -1
- package/lib/util/index.d.ts +1 -1
- package/lib/util/index.d.ts.map +1 -1
- package/lib/util/index.js +1 -1
- package/lib/util/index.js.map +1 -1
- package/lib/util/rangeMap.d.ts +12 -24
- package/lib/util/rangeMap.d.ts.map +1 -1
- package/lib/util/rangeMap.js +5 -44
- package/lib/util/rangeMap.js.map +1 -1
- package/lib/util/readSnapshotBlob.d.ts +1 -1
- package/lib/util/readSnapshotBlob.d.ts.map +1 -1
- package/lib/util/readSnapshotBlob.js.map +1 -1
- package/package.json +22 -22
- package/src/codec/codec.ts +10 -7
- package/src/codec/versioned/codec.ts +3 -3
- package/src/core/change-family/changeFamily.ts +0 -5
- package/src/core/change-family/index.ts +0 -1
- package/src/core/index.ts +1 -4
- package/src/core/rebase/changeRebaser.ts +1 -6
- package/src/core/rebase/index.ts +0 -1
- package/src/core/rebase/types.ts +1 -8
- package/src/core/rebase/utils.ts +7 -31
- package/src/core/schema-stored/formatV2.ts +2 -1
- package/src/core/tree/anchorSet.ts +1 -1
- package/src/core/tree/detachedFieldIndex.ts +2 -18
- package/src/core/tree/detachedFieldIndexCodecCommon.ts +2 -1
- package/src/core/tree/detachedFieldIndexCodecV1.ts +2 -2
- package/src/core/tree/detachedFieldIndexCodecV2.ts +3 -3
- package/src/core/tree/detachedFieldIndexFormatV1.ts +3 -2
- package/src/core/tree/detachedFieldIndexFormatV2.ts +3 -2
- package/src/core/tree/index.ts +1 -2
- package/src/core/tree/pathTree.ts +4 -16
- package/src/core/tree/visitDelta.ts +2 -3
- package/src/core/tree/visitorUtils.ts +2 -1
- package/src/feature-libraries/changeAtomIdBTree.ts +4 -28
- package/src/feature-libraries/chunked-forest/basicChunk.ts +1 -7
- package/src/feature-libraries/chunked-forest/chunkTree.ts +2 -7
- package/src/feature-libraries/chunked-forest/codec/chunkDecoding.ts +1 -1
- package/src/feature-libraries/chunked-forest/codec/chunkDecodingGeneric.ts +1 -1
- package/src/feature-libraries/chunked-forest/codec/chunkEncodingGeneric.ts +1 -1
- package/src/feature-libraries/chunked-forest/codec/codecs.ts +2 -2
- package/src/feature-libraries/chunked-forest/codec/compressedEncode.ts +1 -1
- package/src/feature-libraries/chunked-forest/codec/format.ts +1 -1
- package/src/feature-libraries/chunked-forest/codec/formatGeneric.ts +1 -0
- package/src/feature-libraries/chunked-forest/codec/schemaBasedEncode.ts +3 -3
- package/src/feature-libraries/default-schema/defaultEditBuilder.ts +128 -405
- package/src/feature-libraries/default-schema/defaultFieldKinds.ts +27 -123
- package/src/feature-libraries/default-schema/index.ts +5 -22
- package/src/feature-libraries/default-schema/mappedEditBuilder.ts +9 -35
- package/src/feature-libraries/deltaUtils.ts +1 -6
- package/src/feature-libraries/fieldKindIdentifiers.ts +16 -0
- package/src/feature-libraries/flex-tree/context.ts +0 -17
- package/src/feature-libraries/flex-tree/flexTreeTypes.ts +8 -7
- package/src/feature-libraries/flex-tree/lazyField.ts +26 -69
- package/src/feature-libraries/flex-tree/observer.ts +3 -1
- package/src/feature-libraries/forest-summary/codec.ts +1 -1
- package/src/feature-libraries/forest-summary/forestSummarizer.ts +6 -6
- package/src/feature-libraries/forest-summary/formatV1.ts +1 -0
- package/src/feature-libraries/forest-summary/formatV2.ts +1 -0
- package/src/feature-libraries/forest-summary/incrementalSummaryBuilder.ts +9 -7
- package/src/feature-libraries/forest-summary/summaryTypes.ts +1 -0
- package/src/feature-libraries/index.ts +8 -27
- package/src/feature-libraries/mapTreeCursor.ts +2 -3
- package/src/feature-libraries/mitigatedChangeFamily.ts +1 -3
- package/src/feature-libraries/modular-schema/crossFieldQueries.ts +44 -142
- package/src/feature-libraries/modular-schema/fieldChangeHandler.ts +58 -32
- package/src/feature-libraries/modular-schema/fieldKindConfiguration.ts +1 -0
- package/src/feature-libraries/modular-schema/genericFieldKind.ts +20 -8
- package/src/feature-libraries/modular-schema/index.ts +15 -16
- package/src/feature-libraries/modular-schema/modularChangeCodecV1.ts +336 -543
- package/src/feature-libraries/modular-schema/modularChangeCodecV2.ts +2 -2
- package/src/feature-libraries/modular-schema/modularChangeCodecs.ts +3 -15
- package/src/feature-libraries/modular-schema/modularChangeFamily.ts +753 -2582
- package/src/feature-libraries/modular-schema/modularChangeFormatV1.ts +0 -1
- package/src/feature-libraries/modular-schema/modularChangeTypes.ts +8 -55
- package/src/feature-libraries/object-forest/objectForest.ts +2 -2
- package/src/feature-libraries/optional-field/index.ts +5 -5
- package/src/feature-libraries/optional-field/optionalField.ts +592 -317
- package/src/feature-libraries/optional-field/optionalFieldChangeTypes.ts +38 -24
- package/src/feature-libraries/optional-field/optionalFieldCodecV2.ts +35 -89
- package/src/feature-libraries/optional-field/optionalFieldCodecs.ts +1 -5
- package/src/feature-libraries/optional-field/requiredField.ts +62 -0
- package/src/feature-libraries/schema-edits/schemaChangeCodecs.ts +1 -1
- package/src/feature-libraries/schema-edits/schemaChangeFormat.ts +1 -0
- package/src/feature-libraries/schemaChecker.ts +3 -2
- package/src/feature-libraries/sequence-field/compose.ts +522 -139
- package/src/feature-libraries/sequence-field/helperTypes.ts +19 -34
- package/src/feature-libraries/sequence-field/index.ts +2 -42
- package/src/feature-libraries/sequence-field/invert.ts +228 -103
- package/src/feature-libraries/sequence-field/markQueue.ts +2 -2
- package/src/feature-libraries/sequence-field/moveEffectTable.ts +195 -8
- package/src/feature-libraries/sequence-field/rebase.ts +205 -169
- package/src/feature-libraries/sequence-field/relevantRemovedRoots.ts +57 -0
- package/src/feature-libraries/sequence-field/replaceRevisions.ts +47 -25
- package/src/feature-libraries/sequence-field/sequenceFieldChangeHandler.ts +2 -0
- package/src/feature-libraries/sequence-field/sequenceFieldCodecV2.ts +228 -648
- package/src/feature-libraries/sequence-field/sequenceFieldCodecV3.ts +70 -56
- package/src/feature-libraries/sequence-field/sequenceFieldEditor.ts +27 -25
- package/src/feature-libraries/sequence-field/sequenceFieldToDelta.ts +129 -19
- package/src/feature-libraries/sequence-field/sequenceKind.ts +40 -0
- package/src/feature-libraries/sequence-field/types.ts +64 -34
- package/src/feature-libraries/sequence-field/utils.ts +353 -139
- package/src/index.ts +1 -1
- package/src/packageVersion.ts +1 -1
- package/src/shared-tree/independentView.ts +4 -3
- package/src/shared-tree/index.ts +2 -3
- package/src/shared-tree/schematizeTree.ts +8 -21
- package/src/shared-tree/schematizingTreeView.ts +79 -61
- package/src/shared-tree/sharedTree.ts +10 -64
- package/src/shared-tree/sharedTreeChangeCodecs.ts +2 -5
- package/src/shared-tree/sharedTreeChangeEnricher.ts +87 -68
- package/src/shared-tree/sharedTreeChangeFamily.ts +5 -15
- package/src/shared-tree/sharedTreeEditBuilder.ts +8 -39
- package/src/shared-tree/tree.ts +10 -10
- package/src/shared-tree/treeAlpha.ts +26 -25
- package/src/shared-tree/treeCheckout.ts +119 -94
- package/src/shared-tree-core/branch.ts +6 -12
- package/src/shared-tree-core/branchCommitEnricher.ts +25 -77
- package/src/shared-tree-core/branchIdCodec.ts +1 -0
- package/src/shared-tree-core/changeEnricher.ts +8 -52
- package/src/shared-tree-core/defaultResubmitMachine.ts +39 -51
- package/src/shared-tree-core/editManager.ts +8 -22
- package/src/shared-tree-core/editManagerCodecs.ts +3 -13
- package/src/shared-tree-core/editManagerCodecsCommons.ts +7 -6
- package/src/shared-tree-core/editManagerCodecsV1toV4.ts +1 -1
- package/src/shared-tree-core/editManagerCodecsVSharedBranches.ts +2 -2
- package/src/shared-tree-core/editManagerFormatCommons.ts +1 -6
- package/src/shared-tree-core/editManagerFormatV1toV4.ts +2 -3
- package/src/shared-tree-core/editManagerFormatVSharedBranches.ts +3 -2
- package/src/shared-tree-core/index.ts +2 -7
- package/src/shared-tree-core/messageCodecV1ToV4.ts +4 -5
- package/src/shared-tree-core/messageCodecVSharedBranches.ts +4 -4
- package/src/shared-tree-core/messageCodecs.ts +3 -13
- package/src/shared-tree-core/messageFormat.ts +0 -6
- package/src/shared-tree-core/messageFormatV1ToV4.ts +2 -3
- package/src/shared-tree-core/messageFormatVSharedBranches.ts +1 -0
- package/src/shared-tree-core/messageTypes.ts +1 -0
- package/src/shared-tree-core/sharedTreeCore.ts +27 -31
- package/src/shared-tree-core/versionedSummarizer.ts +3 -1
- package/src/simple-tree/api/configuration.ts +9 -9
- package/src/simple-tree/api/create.ts +7 -6
- package/src/simple-tree/api/dirtyIndex.ts +4 -2
- package/src/simple-tree/api/discrepancies.ts +9 -8
- package/src/simple-tree/api/getJsonSchema.ts +4 -3
- package/src/simple-tree/api/identifierIndex.ts +4 -2
- package/src/simple-tree/api/incrementalAllowedTypes.ts +6 -5
- package/src/simple-tree/api/schemaCompatibilityTester.ts +3 -3
- package/src/simple-tree/api/schemaCreationUtilities.ts +4 -3
- package/src/simple-tree/api/schemaFactory.ts +16 -17
- package/src/simple-tree/api/schemaFactoryAlpha.ts +21 -21
- package/src/simple-tree/api/schemaFactoryBeta.ts +17 -15
- package/src/simple-tree/api/schemaFactoryRecursive.ts +1 -1
- package/src/simple-tree/api/schemaFromSimple.ts +1 -1
- package/src/simple-tree/api/schemaStatics.ts +2 -0
- package/src/simple-tree/api/simpleSchemaCodec.ts +12 -11
- package/src/simple-tree/api/simpleSchemaToJsonSchema.ts +20 -18
- package/src/simple-tree/api/simpleTreeIndex.ts +6 -4
- package/src/simple-tree/api/snapshotCompatibilityChecker.ts +7 -5
- package/src/simple-tree/api/storedSchema.ts +2 -1
- package/src/simple-tree/api/tree.ts +2 -2
- package/src/simple-tree/api/treeBeta.ts +3 -3
- package/src/simple-tree/api/treeNodeApi.ts +14 -13
- package/src/simple-tree/api/typesUnsafe.ts +7 -8
- package/src/simple-tree/api/verboseTree.ts +6 -5
- package/src/simple-tree/core/allowedTypes.ts +4 -4
- package/src/simple-tree/core/context.ts +1 -1
- package/src/simple-tree/core/treeNode.ts +1 -1
- package/src/simple-tree/core/treeNodeKernel.ts +1 -3
- package/src/simple-tree/core/treeNodeSchema.ts +7 -6
- package/src/simple-tree/core/treeNodeValid.ts +9 -9
- package/src/simple-tree/core/unhydratedFlexTree.ts +37 -88
- package/src/simple-tree/core/withType.ts +3 -2
- package/src/simple-tree/createContext.ts +1 -0
- package/src/simple-tree/fieldSchema.ts +5 -8
- package/src/simple-tree/index.ts +1 -2
- package/src/simple-tree/leafNodeSchema.ts +3 -3
- package/src/simple-tree/node-kinds/array/arrayNode.ts +20 -21
- package/src/simple-tree/node-kinds/array/arrayNodeTypes.ts +2 -2
- package/src/simple-tree/node-kinds/common.ts +6 -3
- package/src/simple-tree/node-kinds/map/mapNode.ts +20 -19
- package/src/simple-tree/node-kinds/map/mapNodeTypes.ts +2 -2
- package/src/simple-tree/node-kinds/object/objectNode.ts +37 -37
- package/src/simple-tree/node-kinds/object/objectNodeTypes.ts +8 -7
- package/src/simple-tree/node-kinds/record/recordNode.ts +21 -22
- package/src/simple-tree/node-kinds/record/recordNodeTypes.ts +1 -2
- package/src/simple-tree/prepareForInsertion.ts +205 -345
- package/src/simple-tree/simpleSchema.ts +1 -0
- package/src/simple-tree/treeSchema.ts +1 -0
- package/src/simple-tree/unhydratedFlexTreeFromInsertable.ts +16 -44
- package/src/tableSchema.ts +3 -1
- package/src/text/index.ts +1 -0
- package/src/text/textDomain.ts +1 -1
- package/src/text/textDomainFormatted.ts +309 -0
- package/src/treeFactory.ts +8 -18
- package/src/util/bTreeUtils.ts +1 -1
- package/src/util/index.ts +0 -3
- package/src/util/rangeMap.ts +18 -72
- package/src/util/readSnapshotBlob.ts +4 -2
- package/dist/feature-libraries/default-schema/locationBasedEditBuilder.d.ts +0 -38
- package/dist/feature-libraries/default-schema/locationBasedEditBuilder.d.ts.map +0 -1
- package/dist/feature-libraries/default-schema/locationBasedEditBuilder.js +0 -132
- package/dist/feature-libraries/default-schema/locationBasedEditBuilder.js.map +0 -1
- package/dist/feature-libraries/modular-schema/modularChangeCodecV3.d.ts +0 -15
- package/dist/feature-libraries/modular-schema/modularChangeCodecV3.d.ts.map +0 -1
- package/dist/feature-libraries/modular-schema/modularChangeCodecV3.js +0 -393
- package/dist/feature-libraries/modular-schema/modularChangeCodecV3.js.map +0 -1
- package/dist/feature-libraries/modular-schema/modularChangeFormatV3.d.ts +0 -146
- package/dist/feature-libraries/modular-schema/modularChangeFormatV3.d.ts.map +0 -1
- package/dist/feature-libraries/modular-schema/modularChangeFormatV3.js +0 -32
- package/dist/feature-libraries/modular-schema/modularChangeFormatV3.js.map +0 -1
- package/dist/feature-libraries/optional-field/optionalFieldChangeFormatV3.d.ts +0 -23
- package/dist/feature-libraries/optional-field/optionalFieldChangeFormatV3.d.ts.map +0 -1
- package/dist/feature-libraries/optional-field/optionalFieldChangeFormatV3.js +0 -31
- package/dist/feature-libraries/optional-field/optionalFieldChangeFormatV3.js.map +0 -1
- package/dist/feature-libraries/optional-field/optionalFieldCodecV3.d.ts +0 -12
- package/dist/feature-libraries/optional-field/optionalFieldCodecV3.d.ts.map +0 -1
- package/dist/feature-libraries/optional-field/optionalFieldCodecV3.js +0 -57
- package/dist/feature-libraries/optional-field/optionalFieldCodecV3.js.map +0 -1
- package/dist/shared-tree-core/transactionEnricher.d.ts +0 -23
- package/dist/shared-tree-core/transactionEnricher.d.ts.map +0 -1
- package/dist/shared-tree-core/transactionEnricher.js +0 -74
- package/dist/shared-tree-core/transactionEnricher.js.map +0 -1
- package/lib/feature-libraries/default-schema/locationBasedEditBuilder.d.ts +0 -38
- package/lib/feature-libraries/default-schema/locationBasedEditBuilder.d.ts.map +0 -1
- package/lib/feature-libraries/default-schema/locationBasedEditBuilder.js +0 -128
- package/lib/feature-libraries/default-schema/locationBasedEditBuilder.js.map +0 -1
- package/lib/feature-libraries/modular-schema/modularChangeCodecV3.d.ts +0 -15
- package/lib/feature-libraries/modular-schema/modularChangeCodecV3.d.ts.map +0 -1
- package/lib/feature-libraries/modular-schema/modularChangeCodecV3.js +0 -389
- package/lib/feature-libraries/modular-schema/modularChangeCodecV3.js.map +0 -1
- package/lib/feature-libraries/modular-schema/modularChangeFormatV3.d.ts +0 -146
- package/lib/feature-libraries/modular-schema/modularChangeFormatV3.d.ts.map +0 -1
- package/lib/feature-libraries/modular-schema/modularChangeFormatV3.js +0 -29
- package/lib/feature-libraries/modular-schema/modularChangeFormatV3.js.map +0 -1
- package/lib/feature-libraries/optional-field/optionalFieldChangeFormatV3.d.ts +0 -23
- package/lib/feature-libraries/optional-field/optionalFieldChangeFormatV3.d.ts.map +0 -1
- package/lib/feature-libraries/optional-field/optionalFieldChangeFormatV3.js +0 -27
- package/lib/feature-libraries/optional-field/optionalFieldChangeFormatV3.js.map +0 -1
- package/lib/feature-libraries/optional-field/optionalFieldCodecV3.d.ts +0 -12
- package/lib/feature-libraries/optional-field/optionalFieldCodecV3.d.ts.map +0 -1
- package/lib/feature-libraries/optional-field/optionalFieldCodecV3.js +0 -53
- package/lib/feature-libraries/optional-field/optionalFieldCodecV3.js.map +0 -1
- package/lib/shared-tree-core/transactionEnricher.d.ts +0 -23
- package/lib/shared-tree-core/transactionEnricher.d.ts.map +0 -1
- package/lib/shared-tree-core/transactionEnricher.js +0 -70
- package/lib/shared-tree-core/transactionEnricher.js.map +0 -1
- package/src/feature-libraries/default-schema/locationBasedEditBuilder.ts +0 -188
- package/src/feature-libraries/modular-schema/modularChangeCodecV3.ts +0 -760
- package/src/feature-libraries/modular-schema/modularChangeFormatV3.ts +0 -62
- package/src/feature-libraries/optional-field/optionalFieldChangeFormatV3.ts +0 -45
- package/src/feature-libraries/optional-field/optionalFieldCodecV3.ts +0 -94
- package/src/shared-tree-core/transactionEnricher.ts +0 -74
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"simpleSchemaCodec.js","sourceRoot":"","sources":["../../../src/simple-tree/api/simpleSchemaCodec.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;;;;;;;;;;;;;;;;;;;;;;;;AAEH,kDAA+E;AAC/E,kEAA0F;AAa1F,+CAAgF;AAGhF,uEAAsE;AACtE,mEAAqD;AACrD,mDAK8B;AAE9B;;;;;;;;;;;;;;GAcG;AACH,SAAgB,iCAAiC,CAChD,YAA8B;IAE9B,sCAAsC;IACtC,MAAM,kBAAkB,GAAyC,EAAE,CAAC;IAEpE,KAAK,MAAM,CAAC,UAAU,EAAE,MAAM,CAAC,IAAI,YAAY,CAAC,WAAW,EAAE,CAAC;QAC7D,MAAM,iBAAiB,GAAG,gBAAgB,CAAC,MAAM,CAAC,CAAC;QACnD,kBAAkB,CAAC,UAAU,CAAC,GAAG,iBAAiB,CAAC;IACpD,CAAC;IAED,MAAM,aAAa,GAAkC;QACpD,OAAO,EAAE,MAAM,CAAC,yBAAyB,CAAC,EAAE;QAC5C,IAAI,EAAE,WAAW,CAAC,YAAY,CAAC,IAAI,CAAC;QACpC,WAAW,EAAE,kBAAkB;KAC/B,CAAC;IAEF,OAAO,aAAa,CAAC;AACtB,CAAC;AAlBD,8EAkBC;AAED;;;;;;;;;;;;;;GAcG;AACH,SAAgB,iCAAiC,CAChD,aAAqC,EACrC,SAA2B;IAE3B,MAAM,kBAAkB,GAAG,SAAS,IAAI,8BAAmB,CAAC;IAC5D,MAAM,iBAAiB,GAAG,IAAA,+BAAoB,EAAC,kBAAkB,CAAC,CAAC,OAAO,CACzE,MAAM,CAAC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C,KAAK,EAA+B,EAAE;QACtC,MAAM,QAAQ,GAAG,KAAK,CAAC,QAAQ,KAAK,IAAI,CAAC,CAAC,CAAC,IAAA,8BAAmB,GAAE,CAAC,CAAC,CAAC,KAAK,CAAC,QAAQ,CAAC;QAClF,OAAO,EAAE,QAAQ,EAAE,CAAC;IACrB,CAAC,CACD,CAAC;IAEF,OAAO,kBAAkB,CAAC;AAC3B,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { objectToMap, type JsonCompatibleReadOnly } from \"../../util/index.js\";\nimport { unreachableCase, transformMapValues } from \"@fluidframework/core-utils/internal\";\nimport type {\n\tSimpleAllowedTypeAttributes,\n\tSimpleArrayNodeSchema,\n\tSimpleFieldSchema,\n\tSimpleLeafNodeSchema,\n\tSimpleMapNodeSchema,\n\tSimpleNodeSchema,\n\tSimpleObjectFieldSchema,\n\tSimpleObjectNodeSchema,\n\tSimpleRecordNodeSchema,\n\tSimpleTreeSchema,\n} from \"../simpleSchema.js\";\nimport { createSchemaUpgrade, NodeKind, SchemaUpgrade } from \"../core/index.js\";\nimport type { FieldKind } from \"../fieldSchema.js\";\nimport type { ValueSchema } from \"../../core/index.js\";\nimport { UsageError } from \"@fluidframework/telemetry-utils/internal\";\nimport * as Format from \"../simpleSchemaFormatV1.js\";\nimport {\n\tDiscriminatedUnionDispatcher,\n\textractJsonValidator,\n\tFormatValidatorNoOp,\n\ttype FormatValidator,\n} from \"../../codec/index.js\";\n\n/**\n * Encodes the compatibility impacting subset of simple schema (view or stored) into a serializable format.\n *\n * @remarks The JSON-compatible schema returned from this method is only intended for use in snapshots/comparisons of schemas.\n * It is not possible to reconstruct a full schema (including metadata and persistedMetadata) from the encoded format.\n * @param treeSchema - The tree schema to convert.\n * @returns A serializable representation of the schema.\n *\n * @privateRemarks\n * Encodes to {@link Format.SimpleTreeSchemaFormat}.\n *\n * TODO: a simple high level API for snapshot based schema compatibility checking should replace the need to export this.\n *\n * @alpha\n */\nexport function encodeSchemaCompatibilitySnapshot(\n\tsimpleSchema: SimpleTreeSchema,\n): JsonCompatibleReadOnly {\n\t// Convert types to serializable forms\n\tconst encodedDefinitions: Format.SimpleSchemaDefinitionsFormat = {};\n\n\tfor (const [identifier, schema] of simpleSchema.definitions) {\n\t\tconst encodedDefinition = encodeNodeSchema(schema);\n\t\tencodedDefinitions[identifier] = encodedDefinition;\n\t}\n\n\tconst encodedSchema: Format.SimpleTreeSchemaFormat = {\n\t\tversion: Format.SimpleSchemaFormatVersion.v1,\n\t\troot: encodeField(simpleSchema.root),\n\t\tdefinitions: encodedDefinitions,\n\t};\n\n\treturn encodedSchema;\n}\n\n/**\n * Decodes a JSON-compatible schema into a simple schema.\n * @param encodedSchema - The encoded schema to decode.\n * @param validator - The format validator to use to validate the encoded schema.\n * @returns A decoded simple schema.\n * @throws Will throw a usage error if the encoded schema is not in the expected format.\n *\n * @privateRemarks\n * If a validator is not provided, this implicitly performs an unsafe type conversion:\n * this is something our user facing APIs generally avoid doing, and should be reconsidered before stabilizing.\n *\n * TODO: a simple high level API for snapshot based schema compatibility checking should replace the need to export this.\n *\n * @alpha\n */\nexport function decodeSchemaCompatibilitySnapshot(\n\tencodedSchema: JsonCompatibleReadOnly,\n\tvalidator?: FormatValidator,\n): SimpleTreeSchema {\n\tconst effectiveValidator = validator ?? FormatValidatorNoOp;\n\tconst compiledValidator = extractJsonValidator(effectiveValidator).compile(\n\t\tFormat.SimpleTreeSchemaFormat,\n\t);\n\tif (!compiledValidator.check(encodedSchema)) {\n\t\tthrow new UsageError(\n\t\t\t\"The provided simple schema is not valid according to the schema format.\",\n\t\t);\n\t}\n\n\treturn {\n\t\troot: decodeSimpleFieldSchema(encodedSchema.root),\n\t\tdefinitions: new Map(\n\t\t\ttransformMapValues(objectToMap(encodedSchema.definitions), (value, key) => {\n\t\t\t\treturn decodeNodeSchema(value);\n\t\t\t}),\n\t\t),\n\t};\n}\n\n/**\n * Encodes a node schema to a serializable object.\n * @param schema - The node schema to convert.\n * @returns A serializable representation of the node schema.\n */\nfunction encodeNodeSchema(schema: SimpleNodeSchema): Format.SimpleNodeSchemaUnionFormat {\n\tconst kind = schema.kind;\n\tswitch (kind) {\n\t\tcase NodeKind.Leaf: {\n\t\t\treturn { leaf: encodeLeafNode(schema) };\n\t\t}\n\t\tcase NodeKind.Array: {\n\t\t\treturn { array: encodeContainerNode(schema) };\n\t\t}\n\t\tcase NodeKind.Map: {\n\t\t\treturn { map: encodeContainerNode(schema) };\n\t\t}\n\t\tcase NodeKind.Record: {\n\t\t\treturn { record: encodeContainerNode(schema) };\n\t\t}\n\t\tcase NodeKind.Object: {\n\t\t\treturn { object: encodeObjectNode(schema) };\n\t\t}\n\t\tdefault: {\n\t\t\tunreachableCase(kind);\n\t\t}\n\t}\n}\n\n/**\n * Encodes a leaf node schema to a serializable object.\n * @param schema - The leaf node schema to convert.\n * @returns A serializable representation of the leaf node schema.\n */\nfunction encodeLeafNode(schema: SimpleLeafNodeSchema): Format.SimpleLeafNodeSchemaFormat {\n\treturn {\n\t\tkind: schema.kind,\n\t\tleafKind: schema.leafKind,\n\t};\n}\n\n/**\n * Encodes a container node schema (a simple schema that is a Map, Array, or Record) to a serializable object.\n * @param schema - The container node schema to convert.\n * @returns A serializable representation of the container node schema. Includes the `kind` for disambiguation between different\n * container kinds.\n */\nfunction encodeContainerNode(\n\tschema: SimpleArrayNodeSchema | SimpleMapNodeSchema | SimpleRecordNodeSchema,\n):\n\t| Format.SimpleArrayNodeSchemaFormat\n\t| Format.SimpleMapNodeSchemaFormat\n\t| Format.SimpleRecordNodeSchemaFormat {\n\treturn {\n\t\tkind: schema.kind,\n\t\tsimpleAllowedTypes: encodeSimpleAllowedTypes(schema.simpleAllowedTypes),\n\t};\n}\n\n/**\n * Encodes a simple allowed types map to a serializable object. Needed because JSON serialization does not support Maps.\n * @param simpleAllowedTypes - The simple allowed types map to convert.\n * @returns A serializable representation of the simple allowed types.\n */\nfunction encodeSimpleAllowedTypes(\n\tsimpleAllowedTypes: ReadonlyMap<string, SimpleAllowedTypeAttributes>,\n): Format.SimpleAllowedTypesFormat {\n\tconst encodedAllowedTypes: Format.SimpleAllowedTypesFormat = {};\n\tfor (const [identifier, attributes] of simpleAllowedTypes) {\n\t\tconst isStaged = attributes.isStaged instanceof SchemaUpgrade ? true : attributes.isStaged;\n\t\tencodedAllowedTypes[identifier] = { isStaged };\n\t}\n\treturn encodedAllowedTypes;\n}\n\n/**\n * Encodes an object node schema to a serializable object.\n * @param schema - The object node schema to convert.\n * @returns A serializable representation of the object node schema.\n */\nfunction encodeObjectNode(\n\tschema: SimpleObjectNodeSchema,\n): Format.SimpleObjectNodeSchemaFormat {\n\tconst encodedFields: Format.SimpleObjectFieldSchemasFormat = {};\n\tfor (const [fieldKey, fieldSchema] of schema.fields) {\n\t\tencodedFields[fieldKey] = encodeObjectField(fieldSchema);\n\t}\n\n\treturn {\n\t\tkind: schema.kind,\n\t\tfields: encodedFields,\n\t\tallowUnknownOptionalFields: schema.allowUnknownOptionalFields,\n\t};\n}\n\n/**\n * Encodes an object field schema to a serializable object.\n * @param fieldSchema - The object field schema to convert.\n * @returns A serializable representation of the object field schema.\n */\nfunction encodeObjectField(\n\tfieldSchema: SimpleObjectFieldSchema,\n): Format.SimpleObjectFieldSchemaFormat {\n\tconst encodedField = encodeField(fieldSchema);\n\treturn { ...encodedField, storedKey: fieldSchema.storedKey };\n}\n\n/**\n * Encodes a field schema to a serializable object.\n * @param fieldSchema - The field schema to convert.\n * @returns A serializable representation of the field schema.\n */\nfunction encodeField(fieldSchema: SimpleFieldSchema): Format.SimpleFieldSchemaFormat {\n\treturn {\n\t\tkind: fieldSchema.kind,\n\t\tsimpleAllowedTypes: encodeSimpleAllowedTypes(fieldSchema.simpleAllowedTypes),\n\t};\n}\n\nconst decodeNodeSchemaDispatcher: DiscriminatedUnionDispatcher<\n\tFormat.SimpleNodeSchemaUnionFormat,\n\t[],\n\t| SimpleLeafNodeSchema\n\t| SimpleArrayNodeSchema\n\t| SimpleMapNodeSchema\n\t| SimpleRecordNodeSchema\n\t| SimpleObjectNodeSchema\n> = new DiscriminatedUnionDispatcher({\n\tleaf: decodeLeafNode,\n\tarray: decodeContainerNode,\n\tmap: decodeContainerNode,\n\trecord: decodeContainerNode,\n\tobject: decodeObjectNode,\n});\n\n/**\n * Decodes a node schema from a JSON-compatible object.\n * @param encodedNodeSchema - The encoded node schema to decode.\n * @returns The decoded node schema.\n */\nfunction decodeNodeSchema(\n\tencodedNodeSchema: Format.SimpleNodeSchemaUnionFormat,\n):\n\t| SimpleLeafNodeSchema\n\t| SimpleArrayNodeSchema\n\t| SimpleMapNodeSchema\n\t| SimpleRecordNodeSchema\n\t| SimpleObjectNodeSchema {\n\treturn decodeNodeSchemaDispatcher.dispatch(encodedNodeSchema);\n}\n\n/**\n * Decodes a container node schema (array, map, record) from a JSON-compatible object.\n * @param encodedContainerSchema - The encoded schema to decode.\n * @returns The decoded container node schema.\n */\nfunction decodeContainerNode(\n\tencodedContainerSchema:\n\t\t| Format.SimpleArrayNodeSchemaFormat\n\t\t| Format.SimpleMapNodeSchemaFormat\n\t\t| Format.SimpleRecordNodeSchemaFormat,\n): SimpleArrayNodeSchema | SimpleMapNodeSchema | SimpleRecordNodeSchema {\n\treturn {\n\t\tkind: encodedContainerSchema.kind as NodeKind.Array | NodeKind.Map | NodeKind.Record,\n\t\tsimpleAllowedTypes: decodeSimpleAllowedTypes(encodedContainerSchema.simpleAllowedTypes),\n\t\t// We cannot encode persistedMetadata or metadata, so we explicitly set them to empty values.\n\t\tpersistedMetadata: undefined,\n\t\tmetadata: {},\n\t};\n}\n\n/**\n * Decodes a leaf node schema from a JSON-compatible object.\n * @param encodedLeafSchema - The encoded leaf node schema.\n * @returns The decoded leaf node schema.\n */\nfunction decodeLeafNode(\n\tencodedLeafSchema: Format.SimpleLeafNodeSchemaFormat,\n): SimpleLeafNodeSchema {\n\treturn {\n\t\tkind: NodeKind.Leaf,\n\t\tleafKind: encodedLeafSchema.leafKind as ValueSchema,\n\t\t// We cannot encode persistedMetadata or metadata, so we explicitly set them to empty values.\n\t\tpersistedMetadata: undefined,\n\t\tmetadata: {},\n\t};\n}\n\n/**\n * Decodes a object node schema from a JSON-compatible object.\n * @param encodedObjectSchema - The encoded object node schema.\n * @returns The decoded object node schema.\n */\nfunction decodeObjectNode(\n\tencodedObjectSchema: Format.SimpleObjectNodeSchemaFormat,\n): SimpleObjectNodeSchema {\n\treturn {\n\t\tkind: NodeKind.Object,\n\t\tfields: decodeObjectFields(encodedObjectSchema.fields),\n\t\t// It is possible for allowUnknownOptionalFields to be undefined. This happens when serializing a Simple Schema derived\n\t\t// from a stored schema.\n\t\tallowUnknownOptionalFields: encodedObjectSchema.allowUnknownOptionalFields,\n\t\t// We cannot encode persistedMetadata or metadata, so we explicitly set them to empty values when decoding.\n\t\tpersistedMetadata: undefined,\n\t\tmetadata: {},\n\t};\n}\n\n/**\n * Decodes a map of object fields from a JSON-compatible object.\n * @param encodedFields - The encoded fields.\n * @returns A map of the decoded object fields.\n */\nfunction decodeObjectFields(\n\tencodedFields: Format.SimpleObjectFieldSchemasFormat,\n): ReadonlyMap<string, SimpleObjectFieldSchema> {\n\tconst fields = new Map<string, SimpleObjectFieldSchema>();\n\tfor (const [fieldKey, fieldSchema] of Object.entries(encodedFields)) {\n\t\tfields.set(fieldKey, decodeObjectField(fieldSchema));\n\t}\n\treturn fields;\n}\n\n/**\n * Decodes a {@link SimpleObjectFieldSchema} from a JSON-compatible object.\n * @param encodedField - The encoded field schema.\n * @returns The decoded simple object field schema.\n */\nfunction decodeObjectField(\n\tencodedField: Format.SimpleObjectFieldSchemaFormat,\n): SimpleObjectFieldSchema {\n\tconst baseField = decodeSimpleFieldSchema(encodedField);\n\treturn {\n\t\t...baseField,\n\t\tstoredKey: encodedField.storedKey,\n\t};\n}\n\n/**\n * Decodes a {@link SimpleFieldSchema} from a JSON-compatible object.\n * @param encodedField - The encoded field schema.\n * @returns The decoded simple field schema.\n */\nfunction decodeSimpleFieldSchema(\n\tencodedField: Format.SimpleFieldSchemaFormat,\n): SimpleFieldSchema {\n\treturn {\n\t\tkind: encodedField.kind as FieldKind,\n\t\tsimpleAllowedTypes: decodeSimpleAllowedTypes(encodedField.simpleAllowedTypes),\n\t\t// We cannot encode persistedMetadata or metadata, so we explicitly set them to empty values when decoding.\n\t\tpersistedMetadata: undefined,\n\t\tmetadata: {},\n\t};\n}\n\n/**\n * Decodes a simple allowed types map from a JSON-compatible object.\n * @param encodedAllowedTypes - The encoded simple allowed types.\n * @returns A map of the decoded simple allowed types.\n */\nfunction decodeSimpleAllowedTypes(\n\tencodedAllowedTypes: Format.SimpleAllowedTypesFormat,\n): ReadonlyMap<string, SimpleAllowedTypeAttributes> {\n\tconst untypedMap = objectToMap(encodedAllowedTypes);\n\n\tconst simpleAllowedTypes = transformMapValues(\n\t\tuntypedMap,\n\t\t(value): SimpleAllowedTypeAttributes => {\n\t\t\tconst isStaged = value.isStaged === true ? createSchemaUpgrade() : value.isStaged;\n\t\t\treturn { isStaged };\n\t\t},\n\t);\n\n\treturn simpleAllowedTypes;\n}\n"]}
|
|
1
|
+
{"version":3,"file":"simpleSchemaCodec.js","sourceRoot":"","sources":["../../../src/simple-tree/api/simpleSchemaCodec.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;;;;;;;;;;;;;;;;;;;;;;;;AAEH,kEAA0F;AAC1F,uEAAsE;AAEtE,mDAK8B;AAE9B,kDAA+E;AAC/E,+CAAgF;AAchF,mEAAqD;AAErD;;;;;;;;;;;;;;GAcG;AACH,SAAgB,iCAAiC,CAChD,YAA8B;IAE9B,sCAAsC;IACtC,MAAM,kBAAkB,GAAyC,EAAE,CAAC;IAEpE,KAAK,MAAM,CAAC,UAAU,EAAE,MAAM,CAAC,IAAI,YAAY,CAAC,WAAW,EAAE,CAAC;QAC7D,MAAM,iBAAiB,GAAG,gBAAgB,CAAC,MAAM,CAAC,CAAC;QACnD,kBAAkB,CA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;QACZ,SAAS,EAAE,YAAY,CAAC,SAAS;KACjC,CAAC;AACH,CAAC;AAED;;;;GAIG;AACH,SAAS,uBAAuB,CAC/B,YAA4C;IAE5C,OAAO;QACN,IAAI,EAAE,YAAY,CAAC,IAAiB;QACpC,kBAAkB,EAAE,wBAAwB,CAAC,YAAY,CAAC,kBAAkB,CAAC;QAC7E,2GAA2G;QAC3G,iBAAiB,EAAE,SAAS;QAC5B,QAAQ,EAAE,EAAE;KACZ,CAAC;AACH,CAAC;AAED;;;;GAIG;AACH,SAAS,wBAAwB,CAChC,mBAAoD;IAEpD,MAAM,UAAU,GAAG,IAAA,sBAAW,EAAC,mBAAmB,CAAC,CAAC;IAEpD,MAAM,kBAAkB,GAAG,IAAA,6BAAkB,EAC5C,UAAU,EACV,CAAC,KAAK,EAA+B,EAAE;QACtC,MAAM,QAAQ,GAAG,KAAK,CAAC,QAAQ,KAAK,IAAI,CAAC,CAAC,CAAC,IAAA,8BAAmB,GAAE,CAAC,CAAC,CAAC,KAAK,CAAC,QAAQ,CAAC;QAClF,OAAO,EAAE,QAAQ,EAAE,CAAC;IACrB,CAAC,CACD,CAAC;IAEF,OAAO,kBAAkB,CAAC;AAC3B,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { unreachableCase, transformMapValues } from \"@fluidframework/core-utils/internal\";\nimport { UsageError } from \"@fluidframework/telemetry-utils/internal\";\n\nimport {\n\tDiscriminatedUnionDispatcher,\n\textractJsonValidator,\n\tFormatValidatorNoOp,\n\ttype FormatValidator,\n} from \"../../codec/index.js\";\nimport type { ValueSchema } from \"../../core/index.js\";\nimport { objectToMap, type JsonCompatibleReadOnly } from \"../../util/index.js\";\nimport { createSchemaUpgrade, NodeKind, SchemaUpgrade } from \"../core/index.js\";\nimport type { FieldKind } from \"../fieldSchema.js\";\nimport type {\n\tSimpleAllowedTypeAttributes,\n\tSimpleArrayNodeSchema,\n\tSimpleFieldSchema,\n\tSimpleLeafNodeSchema,\n\tSimpleMapNodeSchema,\n\tSimpleNodeSchema,\n\tSimpleObjectFieldSchema,\n\tSimpleObjectNodeSchema,\n\tSimpleRecordNodeSchema,\n\tSimpleTreeSchema,\n} from \"../simpleSchema.js\";\nimport * as Format from \"../simpleSchemaFormatV1.js\";\n\n/**\n * Encodes the compatibility impacting subset of simple schema (view or stored) into a serializable format.\n *\n * @remarks The JSON-compatible schema returned from this method is only intended for use in snapshots/comparisons of schemas.\n * It is not possible to reconstruct a full schema (including metadata and persistedMetadata) from the encoded format.\n * @param treeSchema - The tree schema to convert.\n * @returns A serializable representation of the schema.\n *\n * @privateRemarks\n * Encodes to {@link Format.SimpleTreeSchemaFormat}.\n *\n * TODO: a simple high level API for snapshot based schema compatibility checking should replace the need to export this.\n *\n * @alpha\n */\nexport function encodeSchemaCompatibilitySnapshot(\n\tsimpleSchema: SimpleTreeSchema,\n): JsonCompatibleReadOnly {\n\t// Convert types to serializable forms\n\tconst encodedDefinitions: Format.SimpleSchemaDefinitionsFormat = {};\n\n\tfor (const [identifier, schema] of simpleSchema.definitions) {\n\t\tconst encodedDefinition = encodeNodeSchema(schema);\n\t\tencodedDefinitions[identifier] = encodedDefinition;\n\t}\n\n\tconst encodedSchema: Format.SimpleTreeSchemaFormat = {\n\t\tversion: Format.SimpleSchemaFormatVersion.v1,\n\t\troot: encodeField(simpleSchema.root),\n\t\tdefinitions: encodedDefinitions,\n\t};\n\n\treturn encodedSchema;\n}\n\n/**\n * Decodes a JSON-compatible schema into a simple schema.\n * @param encodedSchema - The encoded schema to decode.\n * @param validator - The format validator to use to validate the encoded schema.\n * @returns A decoded simple schema.\n * @throws Will throw a usage error if the encoded schema is not in the expected format.\n *\n * @privateRemarks\n * If a validator is not provided, this implicitly performs an unsafe type conversion:\n * this is something our user facing APIs generally avoid doing, and should be reconsidered before stabilizing.\n *\n * TODO: a simple high level API for snapshot based schema compatibility checking should replace the need to export this.\n *\n * @alpha\n */\nexport function decodeSchemaCompatibilitySnapshot(\n\tencodedSchema: JsonCompatibleReadOnly,\n\tvalidator?: FormatValidator,\n): SimpleTreeSchema {\n\tconst effectiveValidator = validator ?? FormatValidatorNoOp;\n\tconst compiledValidator = extractJsonValidator(effectiveValidator).compile(\n\t\tFormat.SimpleTreeSchemaFormat,\n\t);\n\tif (!compiledValidator.check(encodedSchema)) {\n\t\tthrow new UsageError(\n\t\t\t\"The provided simple schema is not valid according to the schema format.\",\n\t\t);\n\t}\n\n\treturn {\n\t\troot: decodeSimpleFieldSchema(encodedSchema.root),\n\t\tdefinitions: new Map(\n\t\t\ttransformMapValues(objectToMap(encodedSchema.definitions), (value, key) => {\n\t\t\t\treturn decodeNodeSchema(value);\n\t\t\t}),\n\t\t),\n\t};\n}\n\n/**\n * Encodes a node schema to a serializable object.\n * @param schema - The node schema to convert.\n * @returns A serializable representation of the node schema.\n */\nfunction encodeNodeSchema(schema: SimpleNodeSchema): Format.SimpleNodeSchemaUnionFormat {\n\tconst kind = schema.kind;\n\tswitch (kind) {\n\t\tcase NodeKind.Leaf: {\n\t\t\treturn { leaf: encodeLeafNode(schema) };\n\t\t}\n\t\tcase NodeKind.Array: {\n\t\t\treturn { array: encodeContainerNode(schema) };\n\t\t}\n\t\tcase NodeKind.Map: {\n\t\t\treturn { map: encodeContainerNode(schema) };\n\t\t}\n\t\tcase NodeKind.Record: {\n\t\t\treturn { record: encodeContainerNode(schema) };\n\t\t}\n\t\tcase NodeKind.Object: {\n\t\t\treturn { object: encodeObjectNode(schema) };\n\t\t}\n\t\tdefault: {\n\t\t\tunreachableCase(kind);\n\t\t}\n\t}\n}\n\n/**\n * Encodes a leaf node schema to a serializable object.\n * @param schema - The leaf node schema to convert.\n * @returns A serializable representation of the leaf node schema.\n */\nfunction encodeLeafNode(schema: SimpleLeafNodeSchema): Format.SimpleLeafNodeSchemaFormat {\n\treturn {\n\t\tkind: schema.kind,\n\t\tleafKind: schema.leafKind,\n\t};\n}\n\n/**\n * Encodes a container node schema (a simple schema that is a Map, Array, or Record) to a serializable object.\n * @param schema - The container node schema to convert.\n * @returns A serializable representation of the container node schema. Includes the `kind` for disambiguation between different\n * container kinds.\n */\nfunction encodeContainerNode(\n\tschema: SimpleArrayNodeSchema | SimpleMapNodeSchema | SimpleRecordNodeSchema,\n):\n\t| Format.SimpleArrayNodeSchemaFormat\n\t| Format.SimpleMapNodeSchemaFormat\n\t| Format.SimpleRecordNodeSchemaFormat {\n\treturn {\n\t\tkind: schema.kind,\n\t\tsimpleAllowedTypes: encodeSimpleAllowedTypes(schema.simpleAllowedTypes),\n\t};\n}\n\n/**\n * Encodes a simple allowed types map to a serializable object. Needed because JSON serialization does not support Maps.\n * @param simpleAllowedTypes - The simple allowed types map to convert.\n * @returns A serializable representation of the simple allowed types.\n */\nfunction encodeSimpleAllowedTypes(\n\tsimpleAllowedTypes: ReadonlyMap<string, SimpleAllowedTypeAttributes>,\n): Format.SimpleAllowedTypesFormat {\n\tconst encodedAllowedTypes: Format.SimpleAllowedTypesFormat = {};\n\tfor (const [identifier, attributes] of simpleAllowedTypes) {\n\t\tconst isStaged = attributes.isStaged instanceof SchemaUpgrade ? true : attributes.isStaged;\n\t\tencodedAllowedTypes[identifier] = { isStaged };\n\t}\n\treturn encodedAllowedTypes;\n}\n\n/**\n * Encodes an object node schema to a serializable object.\n * @param schema - The object node schema to convert.\n * @returns A serializable representation of the object node schema.\n */\nfunction encodeObjectNode(\n\tschema: SimpleObjectNodeSchema,\n): Format.SimpleObjectNodeSchemaFormat {\n\tconst encodedFields: Format.SimpleObjectFieldSchemasFormat = {};\n\tfor (const [fieldKey, fieldSchema] of schema.fields) {\n\t\tencodedFields[fieldKey] = encodeObjectField(fieldSchema);\n\t}\n\n\treturn {\n\t\tkind: schema.kind,\n\t\tfields: encodedFields,\n\t\tallowUnknownOptionalFields: schema.allowUnknownOptionalFields,\n\t};\n}\n\n/**\n * Encodes an object field schema to a serializable object.\n * @param fieldSchema - The object field schema to convert.\n * @returns A serializable representation of the object field schema.\n */\nfunction encodeObjectField(\n\tfieldSchema: SimpleObjectFieldSchema,\n): Format.SimpleObjectFieldSchemaFormat {\n\tconst encodedField = encodeField(fieldSchema);\n\treturn { ...encodedField, storedKey: fieldSchema.storedKey };\n}\n\n/**\n * Encodes a field schema to a serializable object.\n * @param fieldSchema - The field schema to convert.\n * @returns A serializable representation of the field schema.\n */\nfunction encodeField(fieldSchema: SimpleFieldSchema): Format.SimpleFieldSchemaFormat {\n\treturn {\n\t\tkind: fieldSchema.kind,\n\t\tsimpleAllowedTypes: encodeSimpleAllowedTypes(fieldSchema.simpleAllowedTypes),\n\t};\n}\n\nconst decodeNodeSchemaDispatcher: DiscriminatedUnionDispatcher<\n\tFormat.SimpleNodeSchemaUnionFormat,\n\t[],\n\t| SimpleLeafNodeSchema\n\t| SimpleArrayNodeSchema\n\t| SimpleMapNodeSchema\n\t| SimpleRecordNodeSchema\n\t| SimpleObjectNodeSchema\n> = new DiscriminatedUnionDispatcher({\n\tleaf: decodeLeafNode,\n\tarray: decodeContainerNode,\n\tmap: decodeContainerNode,\n\trecord: decodeContainerNode,\n\tobject: decodeObjectNode,\n});\n\n/**\n * Decodes a node schema from a JSON-compatible object.\n * @param encodedNodeSchema - The encoded node schema to decode.\n * @returns The decoded node schema.\n */\nfunction decodeNodeSchema(\n\tencodedNodeSchema: Format.SimpleNodeSchemaUnionFormat,\n):\n\t| SimpleLeafNodeSchema\n\t| SimpleArrayNodeSchema\n\t| SimpleMapNodeSchema\n\t| SimpleRecordNodeSchema\n\t| SimpleObjectNodeSchema {\n\treturn decodeNodeSchemaDispatcher.dispatch(encodedNodeSchema);\n}\n\n/**\n * Decodes a container node schema (array, map, record) from a JSON-compatible object.\n * @param encodedContainerSchema - The encoded schema to decode.\n * @returns The decoded container node schema.\n */\nfunction decodeContainerNode(\n\tencodedContainerSchema:\n\t\t| Format.SimpleArrayNodeSchemaFormat\n\t\t| Format.SimpleMapNodeSchemaFormat\n\t\t| Format.SimpleRecordNodeSchemaFormat,\n): SimpleArrayNodeSchema | SimpleMapNodeSchema | SimpleRecordNodeSchema {\n\treturn {\n\t\tkind: encodedContainerSchema.kind as NodeKind.Array | NodeKind.Map | NodeKind.Record,\n\t\tsimpleAllowedTypes: decodeSimpleAllowedTypes(encodedContainerSchema.simpleAllowedTypes),\n\t\t// We cannot encode persistedMetadata or metadata, so we explicitly set them to empty values.\n\t\tpersistedMetadata: undefined,\n\t\tmetadata: {},\n\t};\n}\n\n/**\n * Decodes a leaf node schema from a JSON-compatible object.\n * @param encodedLeafSchema - The encoded leaf node schema.\n * @returns The decoded leaf node schema.\n */\nfunction decodeLeafNode(\n\tencodedLeafSchema: Format.SimpleLeafNodeSchemaFormat,\n): SimpleLeafNodeSchema {\n\treturn {\n\t\tkind: NodeKind.Leaf,\n\t\tleafKind: encodedLeafSchema.leafKind as ValueSchema,\n\t\t// We cannot encode persistedMetadata or metadata, so we explicitly set them to empty values.\n\t\tpersistedMetadata: undefined,\n\t\tmetadata: {},\n\t};\n}\n\n/**\n * Decodes a object node schema from a JSON-compatible object.\n * @param encodedObjectSchema - The encoded object node schema.\n * @returns The decoded object node schema.\n */\nfunction decodeObjectNode(\n\tencodedObjectSchema: Format.SimpleObjectNodeSchemaFormat,\n): SimpleObjectNodeSchema {\n\treturn {\n\t\tkind: NodeKind.Object,\n\t\tfields: decodeObjectFields(encodedObjectSchema.fields),\n\t\t// It is possible for allowUnknownOptionalFields to be undefined. This happens when serializing a Simple Schema derived\n\t\t// from a stored schema.\n\t\tallowUnknownOptionalFields: encodedObjectSchema.allowUnknownOptionalFields,\n\t\t// We cannot encode persistedMetadata or metadata, so we explicitly set them to empty values when decoding.\n\t\tpersistedMetadata: undefined,\n\t\tmetadata: {},\n\t};\n}\n\n/**\n * Decodes a map of object fields from a JSON-compatible object.\n * @param encodedFields - The encoded fields.\n * @returns A map of the decoded object fields.\n */\nfunction decodeObjectFields(\n\tencodedFields: Format.SimpleObjectFieldSchemasFormat,\n): ReadonlyMap<string, SimpleObjectFieldSchema> {\n\tconst fields = new Map<string, SimpleObjectFieldSchema>();\n\tfor (const [fieldKey, fieldSchema] of Object.entries(encodedFields)) {\n\t\tfields.set(fieldKey, decodeObjectField(fieldSchema));\n\t}\n\treturn fields;\n}\n\n/**\n * Decodes a {@link SimpleObjectFieldSchema} from a JSON-compatible object.\n * @param encodedField - The encoded field schema.\n * @returns The decoded simple object field schema.\n */\nfunction decodeObjectField(\n\tencodedField: Format.SimpleObjectFieldSchemaFormat,\n): SimpleObjectFieldSchema {\n\tconst baseField = decodeSimpleFieldSchema(encodedField);\n\treturn {\n\t\t...baseField,\n\t\tstoredKey: encodedField.storedKey,\n\t};\n}\n\n/**\n * Decodes a {@link SimpleFieldSchema} from a JSON-compatible object.\n * @param encodedField - The encoded field schema.\n * @returns The decoded simple field schema.\n */\nfunction decodeSimpleFieldSchema(\n\tencodedField: Format.SimpleFieldSchemaFormat,\n): SimpleFieldSchema {\n\treturn {\n\t\tkind: encodedField.kind as FieldKind,\n\t\tsimpleAllowedTypes: decodeSimpleAllowedTypes(encodedField.simpleAllowedTypes),\n\t\t// We cannot encode persistedMetadata or metadata, so we explicitly set them to empty values when decoding.\n\t\tpersistedMetadata: undefined,\n\t\tmetadata: {},\n\t};\n}\n\n/**\n * Decodes a simple allowed types map from a JSON-compatible object.\n * @param encodedAllowedTypes - The encoded simple allowed types.\n * @returns A map of the decoded simple allowed types.\n */\nfunction decodeSimpleAllowedTypes(\n\tencodedAllowedTypes: Format.SimpleAllowedTypesFormat,\n): ReadonlyMap<string, SimpleAllowedTypeAttributes> {\n\tconst untypedMap = objectToMap(encodedAllowedTypes);\n\n\tconst simpleAllowedTypes = transformMapValues(\n\t\tuntypedMap,\n\t\t(value): SimpleAllowedTypeAttributes => {\n\t\t\tconst isStaged = value.isStaged === true ? createSchemaUpgrade() : value.isStaged;\n\t\t\treturn { isStaged };\n\t\t},\n\t);\n\n\treturn simpleAllowedTypes;\n}\n"]}
|
|
@@ -2,10 +2,10 @@
|
|
|
2
2
|
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
3
3
|
* Licensed under the MIT License.
|
|
4
4
|
*/
|
|
5
|
-
import
|
|
5
|
+
import { ObjectNodeSchema } from "../node-kinds/index.js";
|
|
6
6
|
import type { TreeSchema } from "../treeSchema.js";
|
|
7
7
|
import type { TreeSchemaEncodingOptions } from "./getJsonSchema.js";
|
|
8
|
-
import {
|
|
8
|
+
import type { JsonObjectNodeSchema, JsonTreeSchema } from "./jsonSchema.js";
|
|
9
9
|
/**
|
|
10
10
|
* Generates a JSON Schema representation from a simple tree schema.
|
|
11
11
|
* @remarks
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"simpleSchemaToJsonSchema.d.ts","sourceRoot":"","sources":["../../../src/simple-tree/api/simpleSchemaToJsonSchema.ts"],"names":[],"mappings":"AAAA;;;GAGG;
|
|
1
|
+
{"version":3,"file":"simpleSchemaToJsonSchema.d.ts","sourceRoot":"","sources":["../../../src/simple-tree/api/simpleSchemaToJsonSchema.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAUH,OAAO,EAIN,gBAAgB,EAChB,MAAM,wBAAwB,CAAC;AAOhC,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAGnD,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,oBAAoB,CAAC;AACpE,OAAO,KAAK,EAQX,oBAAoB,EACpB,cAAc,EAGd,MAAM,iBAAiB,CAAC;AAEzB;;;;;;;GAOG;AACH,wBAAgB,YAAY,CAC3B,MAAM,EAAE,UAAU,EAClB,OAAO,EAAE,QAAQ,CAAC,yBAAyB,CAAC,GAC1C,cAAc,CAqBhB;AA2FD,wBAAgB,uBAAuB,CACtC,MAAM,EAAE,gBAAgB,EACxB,OAAO,EAAE,QAAQ,CAAC,yBAAyB,CAAC,GAC1C,oBAAoB,CA0CtB"}
|
|
@@ -9,10 +9,10 @@ const internal_1 = require("@fluidframework/core-utils/internal");
|
|
|
9
9
|
const internal_2 = require("@fluidframework/telemetry-utils/internal");
|
|
10
10
|
const index_js_1 = require("../../core/index.js");
|
|
11
11
|
const index_js_2 = require("../../util/index.js");
|
|
12
|
-
const fieldSchema_js_1 = require("../fieldSchema.js");
|
|
13
12
|
const index_js_3 = require("../core/index.js");
|
|
14
|
-
const
|
|
13
|
+
const fieldSchema_js_1 = require("../fieldSchema.js");
|
|
15
14
|
const leafNodeSchema_js_1 = require("../leafNodeSchema.js");
|
|
15
|
+
const index_js_4 = require("../node-kinds/index.js");
|
|
16
16
|
const customTree_js_1 = require("./customTree.js");
|
|
17
17
|
/**
|
|
18
18
|
* Generates a JSON Schema representation from a simple tree schema.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"simpleSchemaToJsonSchema.js","sourceRoot":"","sources":["../../../src/simple-tree/api/simpleSchemaToJsonSchema.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,kEAAsE;AACtE,uEAAsE;AACtE,kDAAkD;AAClD,kDAA4E;AAc5E,sDAA8C;AAO9C,+CAAiE;AAGjE,qDAKgC;AAChC,4DAAsD;AACtD,mDAAqD;AAErD;;;;;;;GAOG;AACH,SAAgB,YAAY,CAC3B,MAAkB,EAClB,OAA4C;IAE5C,MAAM,WAAW,GAAG,kBAAkB,CAAC,MAAM,CAAC,WAAW,EAAE,OAAO,CAAC,CAAC;IAEpE,MAAM,YAAY,GAAoB,EAAE,CAAC;IACzC,KAAK,MAAM,WAAW,IAAI,MAAM,CAAC,IAAI,CAAC,uBAAuB,EAAE,CAAC;QAC/D,YAAY,CAAC,IAAI,CAAC,eAAe,CAAC,WAAW,CAAC,CAAC,CAAC;IACjD,CAAC;IAED,gHAAgH;IAChH,qFAAqF;IACrF,iDAAiD;IACjD,mDAAmD;IACnD,OAAO,IAAA,oBAAS,EAAC,YAAY,CAAC;QAC7B,CAAC,CAAC;YACA,GAAG,YAAY,CAAC,CAAC,CAAC;YAClB,KAAK,EAAE,WAAW;SAClB;QACF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EF,IAAA,uBAAY,EAAC,MAAM,CAAC,QAAQ,EAAE,aAAa,EAAE,eAAe,CAAC,CAAC;IAE9D,OAAO,eAAe,CAAC;AACxB,CAAC;AA7CD,0DA6CC;AAED,SAAS,2BAA2B,CACnC,MAAoD;IAEpD,MAAM,YAAY,GAAoB,EAAE,CAAC;IACzC,MAAM,uBAAuB,GAAwB,IAAI,GAAG,CAC3D,MAAM,CAAC,kBAAkB,CAAC,IAAI,EAAE,CAChC,CAAC;IACF,KAAK,MAAM,IAAI,IAAI,uBAAuB,EAAE,CAAC;QAC5C,YAAY,CAAC,IAAI,CAAC,eAAe,CAAC,IAAI,CAAC,CAAC,CAAC;IAC1C,CAAC;IAED,MAAM,MAAM,GAAG;QACd,IAAI,EAAE,QAAQ;QACd,mBAAmB,EAAE,MAAM,CAAC,IAAI;QAChC,iBAAiB,EAAE;YAClB,MAAM,EAAE,IAAA,oBAAS,EAAC,YAAY,CAAC;gBAC9B,CAAC,CAAC,YAAY,CAAC,CAAC,CAAC;gBACjB,CAAC,CAAC;oBACA,KAAK,EAAE,YAAY;iBACnB;SACH;KACQ,CAAC;IAEX,IAAA,uBAAY,EAAC,MAAM,CAAC,QAAQ,EAAE,aAAa,EAAE,MAAM,CAAC,CAAC;IAErD,OAAO,MAAM,CAAC;AACf,CAAC;AAED,SAAS,eAAe,CAAC,QAAgB;IACxC,OAAO;QACN,MAAM,EAAE,aAAa,CAAC,QAAQ,CAAC;KAC/B,CAAC;AACH,CAAC;AAED,SAAS,aAAa,CAAC,QAAgB;IACtC,OAAO,WAAW,QAAQ,EAAE,CAAC;AAC9B,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { unreachableCase } from \"@fluidframework/core-utils/internal\";\nimport { UsageError } from \"@fluidframework/telemetry-utils/internal\";\nimport { ValueSchema } from \"../../core/index.js\";\nimport { copyProperty, hasSingle, type Mutable } from \"../../util/index.js\";\nimport type {\n\tJsonArrayNodeSchema,\n\tJsonFieldSchema,\n\tJsonSchemaRef,\n\tJsonRefPath,\n\tJsonLeafNodeSchema,\n\tJsonMapNodeSchema,\n\tJsonNodeSchema,\n\tJsonObjectNodeSchema,\n\tJsonTreeSchema,\n\tJsonLeafSchemaType,\n\tJsonRecordNodeSchema,\n} from \"./jsonSchema.js\";\nimport { FieldKind } from \"../fieldSchema.js\";\nimport type {\n\tSimpleArrayNodeSchema,\n\tSimpleLeafNodeSchema,\n\tSimpleMapNodeSchema,\n\tSimpleRecordNodeSchema,\n} from \"../simpleSchema.js\";\nimport { NodeKind, type TreeNodeSchema } from \"../core/index.js\";\nimport type { TreeSchema } from \"../treeSchema.js\";\nimport type { TreeSchemaEncodingOptions } from \"./getJsonSchema.js\";\nimport {\n\tArrayNodeSchema,\n\tisMapNodeSchema,\n\tisRecordNodeSchema,\n\tObjectNodeSchema,\n} from \"../node-kinds/index.js\";\nimport { LeafNodeSchema } from \"../leafNodeSchema.js\";\nimport { KeyEncodingOptions } from \"./customTree.js\";\n\n/**\n * Generates a JSON Schema representation from a simple tree schema.\n * @remarks\n * This expects the data to be in the {@link ConciseTree} format.\n *\n * This cannot handle the case where the root is undefined since undefined is not a concept in JSON.\n * This also cannot handle {@link SchemaStatics.handle} since they also are not supported in JSON.\n */\nexport function toJsonSchema(\n\tschema: TreeSchema,\n\toptions: Required<TreeSchemaEncodingOptions>,\n): JsonTreeSchema {\n\tconst definitions = convertDefinitions(schema.definitions, options);\n\n\tconst allowedTypes: JsonSchemaRef[] = [];\n\tfor (const allowedType of schema.root.allowedTypesIdentifiers) {\n\t\tallowedTypes.push(createSchemaRef(allowedType));\n\t}\n\n\t// TODO: deduplicate field handling logic from convertObjectNodeSchema: at least include metadata's description.\n\t// TODO: maybe account for consider schema.kind, or just take in ImplicitAllowedTypes\n\t// TODO: handle case where allowedTypes is empty.\n\t// TODO: handle staged types in a controllable way.\n\treturn hasSingle(allowedTypes)\n\t\t? {\n\t\t\t\t...allowedTypes[0],\n\t\t\t\t$defs: definitions,\n\t\t\t}\n\t\t: {\n\t\t\t\t$defs: definitions,\n\t\t\t\tanyOf: allowedTypes,\n\t\t\t};\n}\n\nfunction convertDefinitions(\n\tdefinitions: ReadonlyMap<string, TreeNodeSchema>,\n\toptions: Required<TreeSchemaEncodingOptions>,\n): Record<string, JsonNodeSchema> {\n\tconst result: Record<string, JsonNodeSchema> = {};\n\tfor (const [key, value] of definitions) {\n\t\tresult[key] = convertNodeSchema(value, options);\n\t}\n\treturn result;\n}\n\n/**\n * Converts an input {@link SimpleNodeSchema} to a {@link JsonNodeSchema}.\n *\n * @remarks Caches the result on the input schema for future calls.\n */\nfunction convertNodeSchema(\n\tschema: TreeNodeSchema,\n\toptions: Required<TreeSchemaEncodingOptions>,\n): JsonNodeSchema {\n\tif (schema instanceof ArrayNodeSchema) {\n\t\treturn convertArrayNodeSchema(schema);\n\t} else if (isMapNodeSchema(schema) || isRecordNodeSchema(schema)) {\n\t\treturn convertRecordLikeNodeSchema(schema);\n\t} else if (schema instanceof ObjectNodeSchema) {\n\t\treturn convertObjectNodeSchema(schema, options);\n\t} else if (schema instanceof LeafNodeSchema) {\n\t\treturn convertLeafNodeSchema(schema);\n\t}\n\tthrow new TypeError(`Unknown node schema kind: ${schema.kind}`);\n}\n\nfunction convertArrayNodeSchema(schema: SimpleArrayNodeSchema): JsonArrayNodeSchema {\n\tconst allowedTypes: JsonSchemaRef[] = [];\n\tconst allowedTypesIdentifiers: ReadonlySet<string> = new Set(\n\t\tschema.simpleAllowedTypes.keys(),\n\t);\n\tfor (const type of allowedTypesIdentifiers) {\n\t\tallowedTypes.push(createSchemaRef(type));\n\t}\n\n\tconst items: JsonFieldSchema = hasSingle(allowedTypes)\n\t\t? allowedTypes[0]\n\t\t: { anyOf: allowedTypes };\n\n\tconst output: Mutable<JsonArrayNodeSchema> = {\n\t\ttype: \"array\",\n\t\t_treeNodeSchemaKind: NodeKind.Array,\n\t\titems,\n\t};\n\n\tcopyProperty(schema.metadata, \"description\", output);\n\n\treturn output;\n}\n\nfunction convertLeafNodeSchema(schema: SimpleLeafNodeSchema): JsonLeafNodeSchema {\n\tlet type: JsonLeafSchemaType;\n\tswitch (schema.leafKind) {\n\t\tcase ValueSchema.String: {\n\t\t\ttype = \"string\";\n\t\t\tbreak;\n\t\t}\n\t\tcase ValueSchema.Number: {\n\t\t\ttype = \"number\";\n\t\t\tbreak;\n\t\t}\n\t\tcase ValueSchema.Boolean: {\n\t\t\ttype = \"boolean\";\n\t\t\tbreak;\n\t\t}\n\t\tcase ValueSchema.Null: {\n\t\t\ttype = \"null\";\n\t\t\tbreak;\n\t\t}\n\t\tcase ValueSchema.FluidHandle: {\n\t\t\tthrow new UsageError(\"Fluid handles are not supported via JSON Schema.\");\n\t\t}\n\t\tdefault: {\n\t\t\tunreachableCase(schema.leafKind);\n\t\t}\n\t}\n\n\treturn {\n\t\ttype,\n\t\t_treeNodeSchemaKind: NodeKind.Leaf,\n\t};\n}\n\nexport function convertObjectNodeSchema(\n\tschema: ObjectNodeSchema,\n\toptions: Required<TreeSchemaEncodingOptions>,\n): JsonObjectNodeSchema {\n\tconst properties: Record<string, JsonFieldSchema> = {};\n\tconst required: string[] = [];\n\tfor (const [propertyKey, fieldSchema] of schema.fields) {\n\t\tconst key =\n\t\t\toptions.keys === KeyEncodingOptions.usePropertyKeys\n\t\t\t\t? propertyKey\n\t\t\t\t: fieldSchema.storedKey;\n\t\tconst allowedTypes: JsonSchemaRef[] = [];\n\t\tfor (const allowedType of fieldSchema.allowedTypesIdentifiers) {\n\t\t\tallowedTypes.push(createSchemaRef(allowedType));\n\t\t}\n\n\t\tconst output: Mutable<JsonFieldSchema> = hasSingle(allowedTypes)\n\t\t\t? allowedTypes[0]\n\t\t\t: {\n\t\t\t\t\tanyOf: allowedTypes,\n\t\t\t\t};\n\n\t\tcopyProperty(fieldSchema.metadata, \"description\", output);\n\t\tproperties[key] = output;\n\n\t\tif (\n\t\t\tfieldSchema.kind !== FieldKind.Optional &&\n\t\t\t(options.requireFieldsWithDefaults || fieldSchema.props?.defaultProvider === undefined)\n\t\t) {\n\t\t\trequired.push(key);\n\t\t}\n\t}\n\n\tconst transformedNode: Mutable<JsonObjectNodeSchema> = {\n\t\ttype: \"object\",\n\t\t_treeNodeSchemaKind: NodeKind.Object,\n\t\tproperties,\n\t\trequired,\n\t\t// TODO: support unknown optional fields (only when using \"allStoredKeys\", and constrain the content to be in schema somehow)\n\t\tadditionalProperties: false,\n\t};\n\n\tcopyProperty(schema.metadata, \"description\", transformedNode);\n\n\treturn transformedNode;\n}\n\nfunction convertRecordLikeNodeSchema(\n\tschema: SimpleRecordNodeSchema | SimpleMapNodeSchema,\n): JsonMapNodeSchema | JsonRecordNodeSchema {\n\tconst allowedTypes: JsonSchemaRef[] = [];\n\tconst allowedTypesIdentifiers: ReadonlySet<string> = new Set(\n\t\tschema.simpleAllowedTypes.keys(),\n\t);\n\tfor (const type of allowedTypesIdentifiers) {\n\t\tallowedTypes.push(createSchemaRef(type));\n\t}\n\n\tconst output = {\n\t\ttype: \"object\",\n\t\t_treeNodeSchemaKind: schema.kind,\n\t\tpatternProperties: {\n\t\t\t\"^.*$\": hasSingle(allowedTypes)\n\t\t\t\t? allowedTypes[0]\n\t\t\t\t: {\n\t\t\t\t\t\tanyOf: allowedTypes,\n\t\t\t\t\t},\n\t\t},\n\t} as const;\n\n\tcopyProperty(schema.metadata, \"description\", output);\n\n\treturn output;\n}\n\nfunction createSchemaRef(schemaId: string): JsonSchemaRef {\n\treturn {\n\t\t\"$ref\": createRefPath(schemaId),\n\t};\n}\n\nfunction createRefPath(schemaId: string): JsonRefPath {\n\treturn `#/$defs/${schemaId}`;\n}\n"]}
|
|
1
|
+
{"version":3,"file":"simpleSchemaToJsonSchema.js","sourceRoot":"","sources":["../../../src/simple-tree/api/simpleSchemaToJsonSchema.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,kEAAsE;AACtE,uEAAsE;AAEtE,kDAAkD;AAClD,kDA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AAC;gBACjB,CAAC,CAAC;oBACA,KAAK,EAAE,YAAY;iBACnB;SACH;KACQ,CAAC;IAEX,IAAA,uBAAY,EAAC,MAAM,CAAC,QAAQ,EAAE,aAAa,EAAE,MAAM,CAAC,CAAC;IAErD,OAAO,MAAM,CAAC;AACf,CAAC;AAED,SAAS,eAAe,CAAC,QAAgB;IACxC,OAAO;QACN,MAAM,EAAE,aAAa,CAAC,QAAQ,CAAC;KAC/B,CAAC;AACH,CAAC;AAED,SAAS,aAAa,CAAC,QAAgB;IACtC,OAAO,WAAW,QAAQ,EAAE,CAAC;AAC9B,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { unreachableCase } from \"@fluidframework/core-utils/internal\";\nimport { UsageError } from \"@fluidframework/telemetry-utils/internal\";\n\nimport { ValueSchema } from \"../../core/index.js\";\nimport { copyProperty, hasSingle, type Mutable } from \"../../util/index.js\";\nimport { NodeKind, type TreeNodeSchema } from \"../core/index.js\";\nimport { FieldKind } from \"../fieldSchema.js\";\nimport { LeafNodeSchema } from \"../leafNodeSchema.js\";\nimport {\n\tArrayNodeSchema,\n\tisMapNodeSchema,\n\tisRecordNodeSchema,\n\tObjectNodeSchema,\n} from \"../node-kinds/index.js\";\nimport type {\n\tSimpleArrayNodeSchema,\n\tSimpleLeafNodeSchema,\n\tSimpleMapNodeSchema,\n\tSimpleRecordNodeSchema,\n} from \"../simpleSchema.js\";\nimport type { TreeSchema } from \"../treeSchema.js\";\n\nimport { KeyEncodingOptions } from \"./customTree.js\";\nimport type { TreeSchemaEncodingOptions } from \"./getJsonSchema.js\";\nimport type {\n\tJsonArrayNodeSchema,\n\tJsonFieldSchema,\n\tJsonSchemaRef,\n\tJsonRefPath,\n\tJsonLeafNodeSchema,\n\tJsonMapNodeSchema,\n\tJsonNodeSchema,\n\tJsonObjectNodeSchema,\n\tJsonTreeSchema,\n\tJsonLeafSchemaType,\n\tJsonRecordNodeSchema,\n} from \"./jsonSchema.js\";\n\n/**\n * Generates a JSON Schema representation from a simple tree schema.\n * @remarks\n * This expects the data to be in the {@link ConciseTree} format.\n *\n * This cannot handle the case where the root is undefined since undefined is not a concept in JSON.\n * This also cannot handle {@link SchemaStatics.handle} since they also are not supported in JSON.\n */\nexport function toJsonSchema(\n\tschema: TreeSchema,\n\toptions: Required<TreeSchemaEncodingOptions>,\n): JsonTreeSchema {\n\tconst definitions = convertDefinitions(schema.definitions, options);\n\n\tconst allowedTypes: JsonSchemaRef[] = [];\n\tfor (const allowedType of schema.root.allowedTypesIdentifiers) {\n\t\tallowedTypes.push(createSchemaRef(allowedType));\n\t}\n\n\t// TODO: deduplicate field handling logic from convertObjectNodeSchema: at least include metadata's description.\n\t// TODO: maybe account for consider schema.kind, or just take in ImplicitAllowedTypes\n\t// TODO: handle case where allowedTypes is empty.\n\t// TODO: handle staged types in a controllable way.\n\treturn hasSingle(allowedTypes)\n\t\t? {\n\t\t\t\t...allowedTypes[0],\n\t\t\t\t$defs: definitions,\n\t\t\t}\n\t\t: {\n\t\t\t\t$defs: definitions,\n\t\t\t\tanyOf: allowedTypes,\n\t\t\t};\n}\n\nfunction convertDefinitions(\n\tdefinitions: ReadonlyMap<string, TreeNodeSchema>,\n\toptions: Required<TreeSchemaEncodingOptions>,\n): Record<string, JsonNodeSchema> {\n\tconst result: Record<string, JsonNodeSchema> = {};\n\tfor (const [key, value] of definitions) {\n\t\tresult[key] = convertNodeSchema(value, options);\n\t}\n\treturn result;\n}\n\n/**\n * Converts an input {@link SimpleNodeSchema} to a {@link JsonNodeSchema}.\n *\n * @remarks Caches the result on the input schema for future calls.\n */\nfunction convertNodeSchema(\n\tschema: TreeNodeSchema,\n\toptions: Required<TreeSchemaEncodingOptions>,\n): JsonNodeSchema {\n\tif (schema instanceof ArrayNodeSchema) {\n\t\treturn convertArrayNodeSchema(schema);\n\t} else if (isMapNodeSchema(schema) || isRecordNodeSchema(schema)) {\n\t\treturn convertRecordLikeNodeSchema(schema);\n\t} else if (schema instanceof ObjectNodeSchema) {\n\t\treturn convertObjectNodeSchema(schema, options);\n\t} else if (schema instanceof LeafNodeSchema) {\n\t\treturn convertLeafNodeSchema(schema);\n\t}\n\tthrow new TypeError(`Unknown node schema kind: ${schema.kind}`);\n}\n\nfunction convertArrayNodeSchema(schema: SimpleArrayNodeSchema): JsonArrayNodeSchema {\n\tconst allowedTypes: JsonSchemaRef[] = [];\n\tconst allowedTypesIdentifiers: ReadonlySet<string> = new Set(\n\t\tschema.simpleAllowedTypes.keys(),\n\t);\n\tfor (const type of allowedTypesIdentifiers) {\n\t\tallowedTypes.push(createSchemaRef(type));\n\t}\n\n\tconst items: JsonFieldSchema = hasSingle(allowedTypes)\n\t\t? allowedTypes[0]\n\t\t: { anyOf: allowedTypes };\n\n\tconst output: Mutable<JsonArrayNodeSchema> = {\n\t\ttype: \"array\",\n\t\t_treeNodeSchemaKind: NodeKind.Array,\n\t\titems,\n\t};\n\n\tcopyProperty(schema.metadata, \"description\", output);\n\n\treturn output;\n}\n\nfunction convertLeafNodeSchema(schema: SimpleLeafNodeSchema): JsonLeafNodeSchema {\n\tlet type: JsonLeafSchemaType;\n\tswitch (schema.leafKind) {\n\t\tcase ValueSchema.String: {\n\t\t\ttype = \"string\";\n\t\t\tbreak;\n\t\t}\n\t\tcase ValueSchema.Number: {\n\t\t\ttype = \"number\";\n\t\t\tbreak;\n\t\t}\n\t\tcase ValueSchema.Boolean: {\n\t\t\ttype = \"boolean\";\n\t\t\tbreak;\n\t\t}\n\t\tcase ValueSchema.Null: {\n\t\t\ttype = \"null\";\n\t\t\tbreak;\n\t\t}\n\t\tcase ValueSchema.FluidHandle: {\n\t\t\tthrow new UsageError(\"Fluid handles are not supported via JSON Schema.\");\n\t\t}\n\t\tdefault: {\n\t\t\tunreachableCase(schema.leafKind);\n\t\t}\n\t}\n\n\treturn {\n\t\ttype,\n\t\t_treeNodeSchemaKind: NodeKind.Leaf,\n\t};\n}\n\nexport function convertObjectNodeSchema(\n\tschema: ObjectNodeSchema,\n\toptions: Required<TreeSchemaEncodingOptions>,\n): JsonObjectNodeSchema {\n\tconst properties: Record<string, JsonFieldSchema> = {};\n\tconst required: string[] = [];\n\tfor (const [propertyKey, fieldSchema] of schema.fields) {\n\t\tconst key =\n\t\t\toptions.keys === KeyEncodingOptions.usePropertyKeys\n\t\t\t\t? propertyKey\n\t\t\t\t: fieldSchema.storedKey;\n\t\tconst allowedTypes: JsonSchemaRef[] = [];\n\t\tfor (const allowedType of fieldSchema.allowedTypesIdentifiers) {\n\t\t\tallowedTypes.push(createSchemaRef(allowedType));\n\t\t}\n\n\t\tconst output: Mutable<JsonFieldSchema> = hasSingle(allowedTypes)\n\t\t\t? allowedTypes[0]\n\t\t\t: {\n\t\t\t\t\tanyOf: allowedTypes,\n\t\t\t\t};\n\n\t\tcopyProperty(fieldSchema.metadata, \"description\", output);\n\t\tproperties[key] = output;\n\n\t\tif (\n\t\t\tfieldSchema.kind !== FieldKind.Optional &&\n\t\t\t(options.requireFieldsWithDefaults || fieldSchema.props?.defaultProvider === undefined)\n\t\t) {\n\t\t\trequired.push(key);\n\t\t}\n\t}\n\n\tconst transformedNode: Mutable<JsonObjectNodeSchema> = {\n\t\ttype: \"object\",\n\t\t_treeNodeSchemaKind: NodeKind.Object,\n\t\tproperties,\n\t\trequired,\n\t\t// TODO: support unknown optional fields (only when using \"allStoredKeys\", and constrain the content to be in schema somehow)\n\t\tadditionalProperties: false,\n\t};\n\n\tcopyProperty(schema.metadata, \"description\", transformedNode);\n\n\treturn transformedNode;\n}\n\nfunction convertRecordLikeNodeSchema(\n\tschema: SimpleRecordNodeSchema | SimpleMapNodeSchema,\n): JsonMapNodeSchema | JsonRecordNodeSchema {\n\tconst allowedTypes: JsonSchemaRef[] = [];\n\tconst allowedTypesIdentifiers: ReadonlySet<string> = new Set(\n\t\tschema.simpleAllowedTypes.keys(),\n\t);\n\tfor (const type of allowedTypesIdentifiers) {\n\t\tallowedTypes.push(createSchemaRef(type));\n\t}\n\n\tconst output = {\n\t\ttype: \"object\",\n\t\t_treeNodeSchemaKind: schema.kind,\n\t\tpatternProperties: {\n\t\t\t\"^.*$\": hasSingle(allowedTypes)\n\t\t\t\t? allowedTypes[0]\n\t\t\t\t: {\n\t\t\t\t\t\tanyOf: allowedTypes,\n\t\t\t\t\t},\n\t\t},\n\t} as const;\n\n\tcopyProperty(schema.metadata, \"description\", output);\n\n\treturn output;\n}\n\nfunction createSchemaRef(schemaId: string): JsonSchemaRef {\n\treturn {\n\t\t\"$ref\": createRefPath(schemaId),\n\t};\n}\n\nfunction createRefPath(schemaId: string): JsonRefPath {\n\treturn `#/$defs/${schemaId}`;\n}\n"]}
|
|
@@ -3,8 +3,8 @@
|
|
|
3
3
|
* Licensed under the MIT License.
|
|
4
4
|
*/
|
|
5
5
|
import { type TreeIndexNodes, type TreeIndex, type TreeIndexKey } from "../../feature-libraries/index.js";
|
|
6
|
-
import type { ImplicitFieldSchema } from "../fieldSchema.js";
|
|
7
6
|
import { type TreeNode, type TreeNodeSchema, type NodeFromSchema } from "../core/index.js";
|
|
7
|
+
import type { ImplicitFieldSchema } from "../fieldSchema.js";
|
|
8
8
|
import type { TreeView } from "./tree.js";
|
|
9
9
|
/**
|
|
10
10
|
* A {@link TreeIndex} that returns tree nodes given their associated keys.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"simpleTreeIndex.d.ts","sourceRoot":"","sources":["../../../src/simple-tree/api/simpleTreeIndex.ts"],"names":[],"mappings":"AAAA;;;GAGG;
|
|
1
|
+
{"version":3,"file":"simpleTreeIndex.d.ts","sourceRoot":"","sources":["../../../src/simple-tree/api/simpleTreeIndex.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAUH,OAAO,EAGN,KAAK,cAAc,EAEnB,KAAK,SAAS,EACd,KAAK,YAAY,EAEjB,MAAM,kCAAkC,CAAC;AAG1C,OAAO,EAEN,KAAK,QAAQ,EACb,KAAK,cAAc,EACnB,KAAK,cAA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mB,EACxC,IAAI,SAAS,YAAY,EACzB,MAAM,EAEN,IAAI,EAAE,QAAQ,CAAC,YAAY,CAAC,EAC5B,OAAO,EAAE,GAAG,CAAC,cAAc,EAAE,MAAM,CAAC,EACpC,QAAQ,EAAE,CAAC,KAAK,EAAE,cAAc,CAAC,QAAQ,CAAC,KAAK,MAAM,EACrD,UAAU,EAAE,CAAC,GAAG,EAAE,YAAY,KAAK,GAAG,IAAI,IAAI,GAC5C,eAAe,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC;AACjC;;;;;;;;;;;GAWG;AACH,wBAAgB,qBAAqB,CACpC,YAAY,SAAS,mBAAmB,EACxC,IAAI,SAAS,YAAY,EACzB,MAAM,EACN,OAAO,SAAS,cAAc,EAE9B,IAAI,EAAE,QAAQ,CAAC,YAAY,CAAC,EAC5B,OAAO,EAAE,GAAG,CAAC,cAAc,EAAE,MAAM,CAAC,EACpC,QAAQ,EAAE,CAAC,KAAK,EAAE,cAAc,CAAC,cAAc,CAAC,OAAO,CAAC,CAAC,KAAK,MAAM,EACpE,UAAU,EAAE,CAAC,GAAG,EAAE,YAAY,KAAK,GAAG,IAAI,IAAI,EAC9C,eAAe,EAAE,SAAS,OAAO,EAAE,GACjC,eAAe,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC"}
|
|
@@ -9,8 +9,8 @@ const internal_1 = require("@fluidframework/core-utils/internal");
|
|
|
9
9
|
const index_js_1 = require("../../feature-libraries/index.js");
|
|
10
10
|
const index_js_2 = require("../../util/index.js");
|
|
11
11
|
const index_js_3 = require("../core/index.js");
|
|
12
|
-
const treeNodeApi_js_1 = require("./treeNodeApi.js");
|
|
13
12
|
const walkFieldSchema_js_1 = require("../walkFieldSchema.js");
|
|
13
|
+
const treeNodeApi_js_1 = require("./treeNodeApi.js");
|
|
14
14
|
/**
|
|
15
15
|
* Creates a {@link SimpleTreeIndex} with a specified indexer.
|
|
16
16
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"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sBAAW,EAAC,UAAU,CAAC,EAAE,CAAC;YAC9B,OAAO,4BAAW,CAAC,MAAM,CAAC,UAAU,CAAC,CAAC;QACvC,CAAC;IACF,CAAC;IACD,+FAA+F;IAC/F,IAAI,CACJ,CAAC;IAEF,sFAAsF;IACtF,2CAA2C;IAC3C,OAAO,KAAsC,CAAC;AAC/C,CAAC;AA/ED,sDA+EC;AAED,SAAS,oBAAoB,CAC5B,QAAkB,EAClB,UAA8C;IAE9C,OAAO,CAAC,MAA+B,EAAE,EAAE;QAC1C,MAAM,CAAC,UAAU,CAAC,QAAQ,CAAC,CAAC;QAC5B,MAAM,CAAC,SAAS,EAAE,CAAC;QACnB,MAAM,KAAK,GAAG,MAAM,CAAC,KAAK,CAAC;QAC3B,MAAM,CAAC,QAAQ,EAAE,CAAC;QAClB,MAAM,CAAC,SAAS,EAAE,CAAC;QAEnB,IAAI,KAAK,KAAK,SAAS,EAAE,CAAC;YACzB,IAAA,eAAI,EAAC,KAAK,CAAC,wCAAwC,CAAC,CAAC;QACtD,CAAC;QAED,IAAI,CAAC,UAAU,CAAC,KAAK,CAAC,EAAE,CAAC;YACxB,IAAA,eAAI,EAAC,KAAK,CAAC,mCAAmC,CAAC,CAAC;QACjD,CAAC;QAED,OAAO,KAAK,CAAC;IACd,CAAC,CAAC;AACH,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { fail } from \"@fluidframework/core-utils/internal\";\nimport type {\n\tAnchorNode,\n\tFieldKey,\n\tITreeSubscriptionCursor,\n\tTreeNodeSchemaIdentifier,\n} from \"../../core/index.js\";\nimport {\n\tAnchorTreeIndex,\n\tisTreeValue,\n\ttype TreeIndexNodes,\n\thasElement,\n\ttype TreeIndex,\n\ttype TreeIndexKey,\n\ttype KeyFinder,\n} from \"../../feature-libraries/index.js\";\nimport { brand } from \"../../util/index.js\";\nimport type { ImplicitFieldSchema } from \"../fieldSchema.js\";\nimport {\n\ttreeNodeFromAnchor,\n\ttype TreeNode,\n\ttype TreeNodeSchema,\n\ttype NodeFromSchema,\n} from \"../core/index.js\";\nimport { treeNodeApi } from \"./treeNodeApi.js\";\nimport type { TreeView } from \"./tree.js\";\nimport { walkFieldSchema } from \"../walkFieldSchema.js\";\nimport type { SchematizingSimpleTreeView } from \"../../shared-tree/index.js\";\n\n/**\n * A {@link TreeIndex} that returns tree nodes given their associated keys.\n *\n * @alpha\n */\nexport type SimpleTreeIndex<TKey extends TreeIndexKey, TValue> = TreeIndex<TKey, TValue>;\n\n/**\n * Creates a {@link SimpleTreeIndex} with a specified indexer.\n *\n * @param view - the view for the tree being indexed\n * @param indexer - a function that takes in a {@link TreeNodeSchema} and returns the field name that all nodes of the given schema\n * should be keyed on, must be pure and functional\n * @param getValue - given at least one {@link TreeNode}, returns an associated value\n * @param isKeyValid - function for verifying the validity of the key retrieved based on the information given by the indexer\n *\n * @alpha\n */\nexport function createSimpleTreeIndex<\n\tTFieldSchema extends ImplicitFieldSchema,\n\tTKey extends TreeIndexKey,\n\tTValue,\n>(\n\tview: TreeView<TFieldSchema>,\n\tindexer: (schema: TreeNodeSchema) => string | undefined,\n\tgetValue: (nodes: TreeIndexNodes<TreeNode>) => TValue,\n\tisKeyValid: (key: TreeIndexKey) => key is TKey,\n): SimpleTreeIndex<TKey, TValue>;\n/**\n * Creates a {@link SimpleTreeIndex} with a specified indexer.\n *\n * @param view - the view for the tree being indexed\n * @param indexer - a function that takes in a {@link TreeNodeSchema} and returns the field name that all nodes of the given schema\n * should be keyed on, must be pure and functional\n * @param getValue - given at least one {@link TreeNode}, returns an associated value\n * @param isKeyValid - function for verifying the validity of the key retrieved based on the information given by the indexer\n * @param indexableSchema - a list of all the schema types that can be indexed\n *\n * @alpha\n */\nexport function createSimpleTreeIndex<\n\tTFieldSchema extends ImplicitFieldSchema,\n\tTKey extends TreeIndexKey,\n\tTValue,\n\tTSchema extends TreeNodeSchema,\n>(\n\tview: TreeView<TFieldSchema>,\n\tindexer: (schema: TSchema) => string | undefined,\n\tgetValue: (nodes: TreeIndexNodes<NodeFromSchema<TSchema>>) => TValue,\n\tisKeyValid: (key: TreeIndexKey) => key is TKey,\n\tindexableSchema: readonly TSchema[],\n): SimpleTreeIndex<TKey, TValue>;\n/**\n * Creates a {@link SimpleTreeIndex} with a specified indexer.\n *\n * @param view - the view for the tree being indexed\n * @param indexer - a map from {@link TreeNodeSchema} to the field name that all nodes of the given schema\n * should be keyed on\n * @param getValue - given at least one {@link TreeNode}, returns an associated value\n * @param isKeyValid - function for verifying the validity of the key retrieved based on the information given by the indexer\n *\n * @alpha\n */\nexport function createSimpleTreeIndex<\n\tTFieldSchema extends ImplicitFieldSchema,\n\tTKey extends TreeIndexKey,\n\tTValue,\n>(\n\tview: TreeView<TFieldSchema>,\n\tindexer: Map<TreeNodeSchema, string>,\n\tgetValue: (nodes: TreeIndexNodes<TreeNode>) => TValue,\n\tisKeyValid: (key: TreeIndexKey) => key is TKey,\n): SimpleTreeIndex<TKey, TValue>;\n/**\n * Creates a {@link SimpleTreeIndex} with a specified indexer.\n *\n * @param view - the view for the tree being indexed\n * @param indexer - a map from {@link TreeNodeSchema} to the field name that all nodes of the given schema\n * should be keyed on\n * @param getValue - given at least one {@link TreeNode}, returns an associated value\n * @param isKeyValid - function for verifying the validity of the key retrieved based on the information given by the indexer\n * @param indexableSchema - a list of all the schema types that can be indexed\n *\n * @alpha\n */\nexport function createSimpleTreeIndex<\n\tTFieldSchema extends ImplicitFieldSchema,\n\tTKey extends TreeIndexKey,\n\tTValue,\n\tTSchema extends TreeNodeSchema,\n>(\n\tview: TreeView<TFieldSchema>,\n\tindexer: Map<TreeNodeSchema, string>,\n\tgetValue: (nodes: TreeIndexNodes<NodeFromSchema<TSchema>>) => TValue,\n\tisKeyValid: (key: TreeIndexKey) => key is TKey,\n\tindexableSchema: readonly TSchema[],\n): SimpleTreeIndex<TKey, TValue>;\n/**\n * Creates a {@link SimpleTreeIndex} with a specified indexer.\n *\n * @alpha\n */\nexport function createSimpleTreeIndex<\n\tTFieldSchema extends ImplicitFieldSchema,\n\tTKey extends TreeIndexKey,\n\tTValue,\n>(\n\tview: TreeView<TFieldSchema>,\n\tindexer: ((schema: TreeNodeSchema) => string | undefined) | Map<TreeNodeSchema, string>,\n\tgetValue:\n\t\t| ((nodes: TreeIndexNodes<TreeNode>) => TValue)\n\t\t| ((nodes: TreeIndexNodes<NodeFromSchema<TreeNodeSchema>>) => TValue),\n\tisKeyValid: (key: TreeIndexKey) => key is TKey,\n\tindexableSchema?: readonly TreeNodeSchema[],\n): SimpleTreeIndex<TKey, TValue> {\n\tconst indexableSchemaMap = new Map();\n\tif (indexableSchema === undefined) {\n\t\twalkFieldSchema(view.schema, {\n\t\t\tnode: (schemus) => indexableSchemaMap.set(schemus.identifier, schemus),\n\t\t});\n\t} else {\n\t\tfor (const schemus of indexableSchema) {\n\t\t\tindexableSchemaMap.set(schemus.identifier, schemus);\n\t\t}\n\t}\n\n\tconst schemaIndexer =\n\t\tindexableSchema === undefined\n\t\t\t? (schemaIdentifier: TreeNodeSchemaIdentifier) => {\n\t\t\t\t\t// if indexable schema isn't provided, we check if the node is in schema\n\t\t\t\t\tconst schemus = indexableSchemaMap.get(schemaIdentifier);\n\t\t\t\t\tif (schemus === undefined) {\n\t\t\t\t\t\tfail(0xb32 /* node is out of schema */);\n\t\t\t\t\t} else {\n\t\t\t\t\t\tconst keyLocation =\n\t\t\t\t\t\t\ttypeof indexer === \"function\" ? indexer(schemus) : indexer.get(schemus);\n\t\t\t\t\t\tif (keyLocation !== undefined) {\n\t\t\t\t\t\t\treturn makeGenericKeyFinder<TKey>(brand(keyLocation), isKeyValid);\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t: (schemaIdentifier: TreeNodeSchemaIdentifier) => {\n\t\t\t\t\tconst schemus = indexableSchemaMap.get(schemaIdentifier);\n\t\t\t\t\tif (schemus !== undefined) {\n\t\t\t\t\t\tconst keyLocation =\n\t\t\t\t\t\t\ttypeof indexer === \"function\" ? indexer(schemus) : indexer.get(schemus);\n\t\t\t\t\t\tif (keyLocation !== undefined) {\n\t\t\t\t\t\t\treturn makeGenericKeyFinder<TKey>(brand(keyLocation), isKeyValid);\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t};\n\n\tconst index = new AnchorTreeIndex<TKey, TValue>(\n\t\t(view as SchematizingSimpleTreeView<TFieldSchema>).checkout.forest,\n\t\tschemaIndexer,\n\t\t(anchorNodes) => {\n\t\t\tconst simpleTreeNodes: TreeNode[] = [];\n\t\t\tfor (const anchorNode of anchorNodes) {\n\t\t\t\tconst simpleTree = treeNodeFromAnchor(anchorNode);\n\t\t\t\tif (!isTreeValue(simpleTree)) {\n\t\t\t\t\tsimpleTreeNodes.push(simpleTree);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif (hasElement(simpleTreeNodes)) {\n\t\t\t\treturn getValue(simpleTreeNodes);\n\t\t\t}\n\t\t},\n\t\t(anchorNode: AnchorNode) => {\n\t\t\tconst simpleTree = treeNodeFromAnchor(anchorNode);\n\t\t\tif (!isTreeValue(simpleTree)) {\n\t\t\t\treturn treeNodeApi.status(simpleTree);\n\t\t\t}\n\t\t},\n\t\t// simple tree indexes are shallow indexes, indicating so allows for a performance optimization\n\t\ttrue,\n\t);\n\n\t// all the type checking guarantees that we put nodes of the correct type in the index\n\t// but it's not captured in the type system\n\treturn index as SimpleTreeIndex<TKey, TValue>;\n}\n\nfunction makeGenericKeyFinder<TKey extends TreeIndexKey>(\n\tkeyField: FieldKey,\n\tisKeyValid: (key: TreeIndexKey) => key is TKey,\n): KeyFinder<TKey> {\n\treturn (cursor: ITreeSubscriptionCursor) => {\n\t\tcursor.enterField(keyField);\n\t\tcursor.firstNode();\n\t\tconst value = cursor.value;\n\t\tcursor.exitNode();\n\t\tcursor.exitField();\n\n\t\tif (value === undefined) {\n\t\t\tfail(0xb33 /* a value for the key does not exist */);\n\t\t}\n\n\t\tif (!isKeyValid(value)) {\n\t\t\tfail(0xb34 /* the key is an unexpected type */);\n\t\t}\n\n\t\treturn value;\n\t};\n}\n"]}
|
|
1
|
+
{"version":3,"file":"simpleTreeIndex.js","sourceRoot":"","sources":["../../../src/simple-tree/api/simpleTreeIndex.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,kEAA2D;AAQ3D,+DAQ0C;AAE1C,kDAA4C;AAC5C,+CAK0B;AAE1B,8DAAwD;AAGxD,qDAA+C;AAmG/C;;;;GAIG;AACH,SAAgB,qBAAqB,CAKpC,IAA4B,EAC5B,OAAuF,EACvF,QAEsE,EACtE,UAA8C,EAC9C,eAA2C;IAE3C,MAAM,kBAAkB,GAAG,IAAI,GAAG,EAAE,CAAC;IACrC,IAAI,eAAe,KAAK,SAAS,EAAE,CAAC;QACnC,IAAA,oCAAe,EAAC,IAAI,CAAC,MAAM,EAAE;YAC5B,IAAI,EAAE,CAAC,OAAO,EAAE,EAAE,CAAC,kBAAkB,CAAC,GAAG,CAAC,OAAO,CAAC,UAAU,EAAE,OAAO,CAAC;SACtE,CAAC,CAAC;IACJ,CAAC;SAAM,CAAC;QACP,KAAK,MAAM,OAAO,IAAI,eAAe,EAAE,CAAC;YACvC,kBAAkB,CAAC,GAAG,CAAC,OAAO,CAAC,UAAU,EAAE,OAAO,CAAC,CAAC;QACrD,CAAC;IACF,CAAC;IAED,MAAM,aAAa,GAClB,eAAe,KAAK,SAAS;QAC5B,CAAC,CAAC,CAAC,gBAA0C,EAAE,EAAE;YAC/C,wEAAwE;YACxE,MAAM,OAAO,GAAG,kBAAkB,CAAC,GAAG,CAAC,gBAAgB,CAAC,CAAC;YACzD,IAAI,OAAO,KAAK,SAAS,EAAE,CAAC;gBAC3B,IAAA,eAAI,EAAC,KAAK,CAAC,2BAA2B,CAAC,CAAC;YACzC,CAAC;iBAAM,CAAC;gBACP,MAAM,WAAW,GAChB,OAAO,OAAO,KAAK,UAAU,CAAC,CAAC,CAAC,OAAO,CAAC,OAAO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CAAC,UAAsB,EAAE,EAAE;QAC1B,MAAM,UAAU,GAAG,IAAA,6BAAkB,EAAC,UAAU,CAAC,CAAC;QAClD,IAAI,CAAC,IAAA,sBAAW,EAAC,UAAU,CAAC,EAAE,CAAC;YAC9B,OAAO,4BAAW,CAAC,MAAM,CAAC,UAAU,CAAC,CAAC;QACvC,CAAC;IACF,CAAC;IACD,+FAA+F;IAC/F,IAAI,CACJ,CAAC;IAEF,sFAAsF;IACtF,2CAA2C;IAC3C,OAAO,KAAsC,CAAC;AAC/C,CAAC;AA/ED,sDA+EC;AAED,SAAS,oBAAoB,CAC5B,QAAkB,EAClB,UAA8C;IAE9C,OAAO,CAAC,MAA+B,EAAE,EAAE;QAC1C,MAAM,CAAC,UAAU,CAAC,QAAQ,CAAC,CAAC;QAC5B,MAAM,CAAC,SAAS,EAAE,CAAC;QACnB,MAAM,KAAK,GAAG,MAAM,CAAC,KAAK,CAAC;QAC3B,MAAM,CAAC,QAAQ,EAAE,CAAC;QAClB,MAAM,CAAC,SAAS,EAAE,CAAC;QAEnB,IAAI,KAAK,KAAK,SAAS,EAAE,CAAC;YACzB,IAAA,eAAI,EAAC,KAAK,CAAC,wCAAwC,CAAC,CAAC;QACtD,CAAC;QAED,IAAI,CAAC,UAAU,CAAC,KAAK,CAAC,EAAE,CAAC;YACxB,IAAA,eAAI,EAAC,KAAK,CAAC,mCAAmC,CAAC,CAAC;QACjD,CAAC;QAED,OAAO,KAAK,CAAC;IACd,CAAC,CAAC;AACH,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { fail } from \"@fluidframework/core-utils/internal\";\n\nimport type {\n\tAnchorNode,\n\tFieldKey,\n\tITreeSubscriptionCursor,\n\tTreeNodeSchemaIdentifier,\n} from \"../../core/index.js\";\nimport {\n\tAnchorTreeIndex,\n\tisTreeValue,\n\ttype TreeIndexNodes,\n\thasElement,\n\ttype TreeIndex,\n\ttype TreeIndexKey,\n\ttype KeyFinder,\n} from \"../../feature-libraries/index.js\";\nimport type { SchematizingSimpleTreeView } from \"../../shared-tree/index.js\";\nimport { brand } from \"../../util/index.js\";\nimport {\n\ttreeNodeFromAnchor,\n\ttype TreeNode,\n\ttype TreeNodeSchema,\n\ttype NodeFromSchema,\n} from \"../core/index.js\";\nimport type { ImplicitFieldSchema } from \"../fieldSchema.js\";\nimport { walkFieldSchema } from \"../walkFieldSchema.js\";\n\nimport type { TreeView } from \"./tree.js\";\nimport { treeNodeApi } from \"./treeNodeApi.js\";\n\n/**\n * A {@link TreeIndex} that returns tree nodes given their associated keys.\n *\n * @alpha\n */\nexport type SimpleTreeIndex<TKey extends TreeIndexKey, TValue> = TreeIndex<TKey, TValue>;\n\n/**\n * Creates a {@link SimpleTreeIndex} with a specified indexer.\n *\n * @param view - the view for the tree being indexed\n * @param indexer - a function that takes in a {@link TreeNodeSchema} and returns the field name that all nodes of the given schema\n * should be keyed on, must be pure and functional\n * @param getValue - given at least one {@link TreeNode}, returns an associated value\n * @param isKeyValid - function for verifying the validity of the key retrieved based on the information given by the indexer\n *\n * @alpha\n */\nexport function createSimpleTreeIndex<\n\tTFieldSchema extends ImplicitFieldSchema,\n\tTKey extends TreeIndexKey,\n\tTValue,\n>(\n\tview: TreeView<TFieldSchema>,\n\tindexer: (schema: TreeNodeSchema) => string | undefined,\n\tgetValue: (nodes: TreeIndexNodes<TreeNode>) => TValue,\n\tisKeyValid: (key: TreeIndexKey) => key is TKey,\n): SimpleTreeIndex<TKey, TValue>;\n/**\n * Creates a {@link SimpleTreeIndex} with a specified indexer.\n *\n * @param view - the view for the tree being indexed\n * @param indexer - a function that takes in a {@link TreeNodeSchema} and returns the field name that all nodes of the given schema\n * should be keyed on, must be pure and functional\n * @param getValue - given at least one {@link TreeNode}, returns an associated value\n * @param isKeyValid - function for verifying the validity of the key retrieved based on the information given by the indexer\n * @param indexableSchema - a list of all the schema types that can be indexed\n *\n * @alpha\n */\nexport function createSimpleTreeIndex<\n\tTFieldSchema extends ImplicitFieldSchema,\n\tTKey extends TreeIndexKey,\n\tTValue,\n\tTSchema extends TreeNodeSchema,\n>(\n\tview: TreeView<TFieldSchema>,\n\tindexer: (schema: TSchema) => string | undefined,\n\tgetValue: (nodes: TreeIndexNodes<NodeFromSchema<TSchema>>) => TValue,\n\tisKeyValid: (key: TreeIndexKey) => key is TKey,\n\tindexableSchema: readonly TSchema[],\n): SimpleTreeIndex<TKey, TValue>;\n/**\n * Creates a {@link SimpleTreeIndex} with a specified indexer.\n *\n * @param view - the view for the tree being indexed\n * @param indexer - a map from {@link TreeNodeSchema} to the field name that all nodes of the given schema\n * should be keyed on\n * @param getValue - given at least one {@link TreeNode}, returns an associated value\n * @param isKeyValid - function for verifying the validity of the key retrieved based on the information given by the indexer\n *\n * @alpha\n */\nexport function createSimpleTreeIndex<\n\tTFieldSchema extends ImplicitFieldSchema,\n\tTKey extends TreeIndexKey,\n\tTValue,\n>(\n\tview: TreeView<TFieldSchema>,\n\tindexer: Map<TreeNodeSchema, string>,\n\tgetValue: (nodes: TreeIndexNodes<TreeNode>) => TValue,\n\tisKeyValid: (key: TreeIndexKey) => key is TKey,\n): SimpleTreeIndex<TKey, TValue>;\n/**\n * Creates a {@link SimpleTreeIndex} with a specified indexer.\n *\n * @param view - the view for the tree being indexed\n * @param indexer - a map from {@link TreeNodeSchema} to the field name that all nodes of the given schema\n * should be keyed on\n * @param getValue - given at least one {@link TreeNode}, returns an associated value\n * @param isKeyValid - function for verifying the validity of the key retrieved based on the information given by the indexer\n * @param indexableSchema - a list of all the schema types that can be indexed\n *\n * @alpha\n */\nexport function createSimpleTreeIndex<\n\tTFieldSchema extends ImplicitFieldSchema,\n\tTKey extends TreeIndexKey,\n\tTValue,\n\tTSchema extends TreeNodeSchema,\n>(\n\tview: TreeView<TFieldSchema>,\n\tindexer: Map<TreeNodeSchema, string>,\n\tgetValue: (nodes: TreeIndexNodes<NodeFromSchema<TSchema>>) => TValue,\n\tisKeyValid: (key: TreeIndexKey) => key is TKey,\n\tindexableSchema: readonly TSchema[],\n): SimpleTreeIndex<TKey, TValue>;\n/**\n * Creates a {@link SimpleTreeIndex} with a specified indexer.\n *\n * @alpha\n */\nexport function createSimpleTreeIndex<\n\tTFieldSchema extends ImplicitFieldSchema,\n\tTKey extends TreeIndexKey,\n\tTValue,\n>(\n\tview: TreeView<TFieldSchema>,\n\tindexer: ((schema: TreeNodeSchema) => string | undefined) | Map<TreeNodeSchema, string>,\n\tgetValue:\n\t\t| ((nodes: TreeIndexNodes<TreeNode>) => TValue)\n\t\t| ((nodes: TreeIndexNodes<NodeFromSchema<TreeNodeSchema>>) => TValue),\n\tisKeyValid: (key: TreeIndexKey) => key is TKey,\n\tindexableSchema?: readonly TreeNodeSchema[],\n): SimpleTreeIndex<TKey, TValue> {\n\tconst indexableSchemaMap = new Map();\n\tif (indexableSchema === undefined) {\n\t\twalkFieldSchema(view.schema, {\n\t\t\tnode: (schemus) => indexableSchemaMap.set(schemus.identifier, schemus),\n\t\t});\n\t} else {\n\t\tfor (const schemus of indexableSchema) {\n\t\t\tindexableSchemaMap.set(schemus.identifier, schemus);\n\t\t}\n\t}\n\n\tconst schemaIndexer =\n\t\tindexableSchema === undefined\n\t\t\t? (schemaIdentifier: TreeNodeSchemaIdentifier) => {\n\t\t\t\t\t// if indexable schema isn't provided, we check if the node is in schema\n\t\t\t\t\tconst schemus = indexableSchemaMap.get(schemaIdentifier);\n\t\t\t\t\tif (schemus === undefined) {\n\t\t\t\t\t\tfail(0xb32 /* node is out of schema */);\n\t\t\t\t\t} else {\n\t\t\t\t\t\tconst keyLocation =\n\t\t\t\t\t\t\ttypeof indexer === \"function\" ? indexer(schemus) : indexer.get(schemus);\n\t\t\t\t\t\tif (keyLocation !== undefined) {\n\t\t\t\t\t\t\treturn makeGenericKeyFinder<TKey>(brand(keyLocation), isKeyValid);\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t: (schemaIdentifier: TreeNodeSchemaIdentifier) => {\n\t\t\t\t\tconst schemus = indexableSchemaMap.get(schemaIdentifier);\n\t\t\t\t\tif (schemus !== undefined) {\n\t\t\t\t\t\tconst keyLocation =\n\t\t\t\t\t\t\ttypeof indexer === \"function\" ? indexer(schemus) : indexer.get(schemus);\n\t\t\t\t\t\tif (keyLocation !== undefined) {\n\t\t\t\t\t\t\treturn makeGenericKeyFinder<TKey>(brand(keyLocation), isKeyValid);\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t};\n\n\tconst index = new AnchorTreeIndex<TKey, TValue>(\n\t\t(view as SchematizingSimpleTreeView<TFieldSchema>).checkout.forest,\n\t\tschemaIndexer,\n\t\t(anchorNodes) => {\n\t\t\tconst simpleTreeNodes: TreeNode[] = [];\n\t\t\tfor (const anchorNode of anchorNodes) {\n\t\t\t\tconst simpleTree = treeNodeFromAnchor(anchorNode);\n\t\t\t\tif (!isTreeValue(simpleTree)) {\n\t\t\t\t\tsimpleTreeNodes.push(simpleTree);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif (hasElement(simpleTreeNodes)) {\n\t\t\t\treturn getValue(simpleTreeNodes);\n\t\t\t}\n\t\t},\n\t\t(anchorNode: AnchorNode) => {\n\t\t\tconst simpleTree = treeNodeFromAnchor(anchorNode);\n\t\t\tif (!isTreeValue(simpleTree)) {\n\t\t\t\treturn treeNodeApi.status(simpleTree);\n\t\t\t}\n\t\t},\n\t\t// simple tree indexes are shallow indexes, indicating so allows for a performance optimization\n\t\ttrue,\n\t);\n\n\t// all the type checking guarantees that we put nodes of the correct type in the index\n\t// but it's not captured in the type system\n\treturn index as SimpleTreeIndex<TKey, TValue>;\n}\n\nfunction makeGenericKeyFinder<TKey extends TreeIndexKey>(\n\tkeyField: FieldKey,\n\tisKeyValid: (key: TreeIndexKey) => key is TKey,\n): KeyFinder<TKey> {\n\treturn (cursor: ITreeSubscriptionCursor) => {\n\t\tcursor.enterField(keyField);\n\t\tcursor.firstNode();\n\t\tconst value = cursor.value;\n\t\tcursor.exitNode();\n\t\tcursor.exitField();\n\n\t\tif (value === undefined) {\n\t\t\tfail(0xb33 /* a value for the key does not exist */);\n\t\t}\n\n\t\tif (!isKeyValid(value)) {\n\t\t\tfail(0xb34 /* the key is an unexpected type */);\n\t\t}\n\n\t\treturn value;\n\t};\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"snapshotCompatibilityChecker.d.ts","sourceRoot":"","sources":["../../../src/simple-tree/api/snapshotCompatibilityChecker.ts"],"names":[],"mappings":"AAAA;;;GAGG;
|
|
1
|
+
{"version":3,"file":"snapshotCompatibilityChecker.d.ts","sourceRoot":"","sources":["../../../src/simple-tree/api/snapshotCompatibilityChecker.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAOH,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,qBAAqB,CAAC;AAIlE,OAAO,EAA8B,qBAAqB,EAAE,MAAM,oBAAoB,CAAC;AAOvF,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,WAAW,CAAC;AAE3D;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkDG;AACH,wBAAgB,kBAAkB,CACjC,4BAA4B,EAAE,qBAAqB,EACnD,IAAI,EAAE,qBAAqB,GACzB,IAAI,CAAC,yBAAyB,EAAE,eAAe,CAAC,CAKlD;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,wBAAgB,iCAAiC,CAChD,MAAM,EAAE,IAAI,CAAC,qBAAqB,EAAE,QAAQ,CAAC,GAC3C,sBAAsB,CAGxB;AAED;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAgB,iCAAiC,CAChD,MAAM,EAAE,sBAAsB,GAC5B,qBAAqB,CAOvB;AAED;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,MAAM,WAAW,kBAAkB;IAClC;;;;;;OAMG;IACH,aAAa,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6DG;AACH,wBAAgB,iCAAiC,CAChD,OAAO,EAAE,mCAAmC,GAC1C,IAAI,CA2LN;AAED;;GAEG;AACH,qBAAa,4BAA4B;IAEvC;;OAEG;IACH,OAAO,CAAC,QAAQ,CAAC,iBAAiB;IAClC;;OAEG;IACH,OAAO,CAAC,QAAQ,CAAC,iBAAiB;;IAPlC;;OAEG;IACc,iBAAiB,EAAE,MAAM;IAC1C;;OAEG;IACc,iBAAiB,EAAE,kBAAkB;IAGhD,mBAAmB,CAAC,YAAY,EAAE,MAAM,EAAE,QAAQ,EAAE,sBAAsB,GAAG,IAAI;IAWjF,kBAAkB,CAAC,YAAY,EAAE,MAAM,GAAG,qBAAqB;IAK/D,qBAAqB,CAAC,YAAY,EAAE,MAAM,GAAG,sBAAsB;IAW1E;;OAEG;IACI,sBAAsB,IAAI,GAAG,CAAC,MAAM,EAAE,qBAAqB,CAAC;IAoB5D,6BAA6B,IAAI,IAAI;CAG5C;AAED;;;;;GAKG;AACH,wBAAgB,gBAAgB,CAC/B,iBAAiB,EAAE,qBAAqB,EACxC,kBAAkB,EAAE,qBAAqB,GACvC,iCAAiC,CAenC"}
|
|
@@ -28,13 +28,13 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
28
28
|
};
|
|
29
29
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
30
30
|
exports.getCompatibility = exports.SnapshotCompatibilityChecker = exports.checkSchemaCompatibilitySnapshots = exports.importCompatibilitySchemaSnapshot = exports.exportCompatibilitySchemaSnapshot = exports.checkCompatibility = void 0;
|
|
31
|
-
const semver = __importStar(require("semver-ts"));
|
|
32
31
|
const internal_1 = require("@fluidframework/core-utils/internal");
|
|
33
|
-
const internal_2 = require("@fluidframework/
|
|
34
|
-
const internal_3 = require("@fluidframework/
|
|
32
|
+
const internal_2 = require("@fluidframework/runtime-utils/internal");
|
|
33
|
+
const internal_3 = require("@fluidframework/telemetry-utils/internal");
|
|
34
|
+
const semver = __importStar(require("semver-ts"));
|
|
35
35
|
const toStoredSchema_js_1 = require("../toStoredSchema.js");
|
|
36
|
-
const configuration_js_1 = require("./configuration.js");
|
|
37
36
|
const treeSchema_js_1 = require("../treeSchema.js");
|
|
37
|
+
const configuration_js_1 = require("./configuration.js");
|
|
38
38
|
const schemaCompatibilityTester_js_1 = require("./schemaCompatibilityTester.js");
|
|
39
39
|
const schemaFromSimple_js_1 = require("./schemaFromSimple.js");
|
|
40
40
|
const simpleSchemaCodec_js_1 = require("./simpleSchemaCodec.js");
|
|
@@ -223,22 +223,22 @@ function checkSchemaCompatibilitySnapshots(options) {
|
|
|
223
223
|
const checker = new SnapshotCompatibilityChecker(options.snapshotDirectory, options.fileSystem);
|
|
224
224
|
const { version: currentVersion, schema: currentViewSchema, mode, minVersionForCollaboration, snapshotUnchangedVersions, } = options;
|
|
225
225
|
if (semver.valid(currentVersion) === null) {
|
|
226
|
-
throw new
|
|
226
|
+
throw new internal_3.UsageError(`Invalid version: ${JSON.stringify(currentVersion)}. Must be a valid semver version.`);
|
|
227
227
|
}
|
|
228
228
|
if (semver.valid(minVersionForCollaboration) === null) {
|
|
229
|
-
throw new
|
|
229
|
+
throw new internal_3.UsageError(`Invalid minVersionForCollaboration: ${JSON.stringify(minVersionForCollaboration)}. Must be a valid semver version.`);
|
|
230
230
|
}
|
|
231
231
|
if (!semver.lte(minVersionForCollaboration, currentVersion)) {
|
|
232
|
-
throw new
|
|
232
|
+
throw new internal_3.UsageError(`Invalid minVersionForCollaboration: ${JSON.stringify(minVersionForCollaboration)}. Must be less than or equal to current version ${JSON.stringify(currentVersion)}.`);
|
|
233
233
|
}
|
|
234
234
|
if (mode !== "test" && mode !== "update") {
|
|
235
|
-
throw new
|
|
235
|
+
throw new internal_3.UsageError(`Invalid mode: ${JSON.stringify(mode)}. Must be either "test" or "update".`);
|
|
236
236
|
}
|
|
237
237
|
const currentEncodedForSnapshotting = exportCompatibilitySchemaSnapshot(currentViewSchema);
|
|
238
238
|
const snapshots = checker.readAllSchemaSnapshots();
|
|
239
239
|
const compatibilityErrors = [];
|
|
240
240
|
function updatableError(message) {
|
|
241
|
-
(0, internal_1.assert)(mode === "test",
|
|
241
|
+
(0, internal_1.assert)(mode === "test", 0xcc6 /* updatableError should only be called in test mode */);
|
|
242
242
|
compatibilityErrors.push(`${message} If this is expected, checkSchemaCompatibilitySnapshots can be rerun in "update" mode to update the snapshot.`);
|
|
243
243
|
}
|
|
244
244
|
if (snapshotUnchangedVersions === true) {
|
|
@@ -286,7 +286,7 @@ function checkSchemaCompatibilitySnapshots(options) {
|
|
|
286
286
|
}
|
|
287
287
|
}
|
|
288
288
|
else {
|
|
289
|
-
throw new
|
|
289
|
+
throw new internal_3.UsageError(`Current version ${JSON.stringify(currentVersion)} is less than latest existing snapshot version ${JSON.stringify(latestSnapshot[0])}: version is expected to increase monotonically.`);
|
|
290
290
|
}
|
|
291
291
|
}
|
|
292
292
|
}
|
|
@@ -302,7 +302,7 @@ function checkSchemaCompatibilitySnapshots(options) {
|
|
|
302
302
|
}
|
|
303
303
|
}
|
|
304
304
|
else {
|
|
305
|
-
selectedMinVersionForCollaborationSnapshot = (0,
|
|
305
|
+
selectedMinVersionForCollaborationSnapshot = (0, internal_2.selectVersionRoundedDown)(minVersionForCollaboration, compatibilityMap);
|
|
306
306
|
if (selectedMinVersionForCollaborationSnapshot === undefined) {
|
|
307
307
|
compatibilityErrors.push(`No snapshot found with version less than or equal to minVersionForCollaboration ${JSON.stringify(minVersionForCollaboration)}.`);
|
|
308
308
|
}
|
|
@@ -314,7 +314,7 @@ function checkSchemaCompatibilitySnapshots(options) {
|
|
|
314
314
|
}
|
|
315
315
|
if (semver.eq(snapshotVersion, currentVersion)) {
|
|
316
316
|
if (currentVersion !== snapshotVersion) {
|
|
317
|
-
throw new
|
|
317
|
+
throw new internal_3.UsageError(`Snapshot version ${JSON.stringify(snapshotVersion)} is semantically equal but not string equal to current version ${JSON.stringify(currentVersion)}: this is not supported.`);
|
|
318
318
|
}
|
|
319
319
|
if (compatibility.currentViewOfSnapshotDocument.isEquivalent === false ||
|
|
320
320
|
compatibility.snapshotViewOfCurrentDocument.isEquivalent === false) {
|
|
@@ -323,7 +323,7 @@ function checkSchemaCompatibilitySnapshots(options) {
|
|
|
323
323
|
}
|
|
324
324
|
else if (semver.lt(snapshotVersion, currentVersion)) {
|
|
325
325
|
if (selectedMinVersionForCollaborationSnapshot === undefined) {
|
|
326
|
-
(0, internal_1.assert)(compatibilityErrors.length > 0,
|
|
326
|
+
(0, internal_1.assert)(compatibilityErrors.length > 0, 0xcc7 /* expected compatibility errors for missing min collab version snapshot */);
|
|
327
327
|
}
|
|
328
328
|
else {
|
|
329
329
|
// Collaboration with this version is expected to work.
|
|
@@ -343,7 +343,7 @@ function checkSchemaCompatibilitySnapshots(options) {
|
|
|
343
343
|
}
|
|
344
344
|
}
|
|
345
345
|
else {
|
|
346
|
-
throw new
|
|
346
|
+
throw new internal_3.UsageError(`Unexpected semver comparison result between snapshot version ${JSON.stringify(snapshotVersion)} and app version ${JSON.stringify(currentVersion)}.`);
|
|
347
347
|
}
|
|
348
348
|
}
|
|
349
349
|
if (compatibilityErrors.length > 0) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"snapshotCompatibilityChecker.js","sourceRoot":"","sources":["../../../src/simple-tree/api/snapshotCompatibilityChecker.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;;;;;;;;;;;;;;;;;;;;;;;;AAEH,kDAAoC;AACpC,kEAAiF;AACjF,uEAAsE;AACtE,qEAAkF;AAElF,4DAAuD;AACvD,yDAAuF;AACvF,oDAAoD;AACpD,iFAA2E;AAC3E,+DAAuE;AACvE,iEAGgC;AAGhC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkDG;AACH,SAAgB,kBAAkB,CACjC,4BAAmD,EACnD,IAA2B;IAE3B,MAAM,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AI,CAAC,QAAQ,CAAC,OAAO,CAAC,EAAE,CAAC;gBAC5B,MAAM,YAAY,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC,EAAE,OAAO,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC;gBACxD,QAAQ,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC;YAC7B,CAAC;QACF,CAAC;QACD,gGAAgG;QAChG,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC;QAE9C,MAAM,SAAS,GAAuC,IAAI,GAAG,EAAE,CAAC;QAChE,KAAK,MAAM,OAAO,IAAI,QAAQ,EAAE,CAAC;YAChC,SAAS,CAAC,GAAG,CAAC,OAAO,EAAE,IAAI,CAAC,kBAAkB,CAAC,OAAO,CAAC,CAAC,CAAC;QAC1D,CAAC;QACD,OAAO,SAAS,CAAC;IAClB,CAAC;IAEM,6BAA6B;QACnC,IAAI,CAAC,iBAAiB,CAAC,SAAS,CAAC,IAAI,CAAC,iBAAiB,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;IAC/E,CAAC;CACD;AAjED,oEAiEC;AAED;;;;;GAKG;AACH,SAAgB,gBAAgB,CAC/B,iBAAwC,EACxC,kBAAyC;IAEzC,MAAM,4BAA4B,GAAG,kBAAkB,CACtD,kBAAkB,EAClB,iBAAiB,CACjB,CAAC;IAEF,MAAM,2BAA2B,GAAG,kBAAkB,CACrD,iBAAiB,EACjB,kBAAkB,CAClB,CAAC;IAEF,OAAO;QACN,6BAA6B,EAAE,4BAA4B;QAC3D,6BAA6B,EAAE,2BAA2B;KAC1D,CAAC;AACH,CAAC;AAlBD,4CAkBC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport * as semver from \"semver-ts\";\nimport { assert, transformMapValues } from \"@fluidframework/core-utils/internal\";\nimport { UsageError } from \"@fluidframework/telemetry-utils/internal\";\nimport { selectVersionRoundedDown } from \"@fluidframework/runtime-utils/internal\";\nimport type { JsonCompatibleReadOnly } from \"../../util/index.js\";\nimport { toInitialSchema } from \"../toStoredSchema.js\";\nimport { TreeViewConfigurationAlpha, TreeViewConfiguration } from \"./configuration.js\";\nimport { createTreeSchema } from \"../treeSchema.js\";\nimport { SchemaCompatibilityTester } from \"./schemaCompatibilityTester.js\";\nimport { generateSchemaFromSimpleSchema } from \"./schemaFromSimple.js\";\nimport {\n\tdecodeSchemaCompatibilitySnapshot,\n\tencodeSchemaCompatibilitySnapshot,\n} from \"./simpleSchemaCodec.js\";\nimport type { SchemaCompatibilityStatus } from \"./tree.js\";\n\n/**\n * Compute the compatibility of using `view` to {@link ViewableTree.viewWith | view a tree} who's {@link ITreeAlpha.exportSimpleSchema | stored schema} could be derived from `viewWhichCreatedStoredSchema` via either {@link TreeView.initialize} or {@link TreeView.upgradeSchema}.\n *\n * @remarks See {@link SchemaCompatibilityStatus} for details on the compatibility results.\n *\n * @example This example demonstrates checking the compatibility of a historical schema against a current schema.\n * In this case, the historical schema is a Point2D object with x and y fields, while the current schema is a Point3D object\n * that adds an optional z field.\n *\n * ```ts\n * // This snapshot is assumed to be the same as Point3D, except missing `z`.\n * const encodedSchema = JSON.parse(fs.readFileSync(\"PointSchema.json\", \"utf8\"));\n * const oldViewSchema = importCompatibilitySchemaSnapshot(encodedSchema);\n *\n * // Build the current view schema\n * class Point3D extends factory.object(\"Point\", {\n * \tx: factory.number,\n * \ty: factory.number,\n *\n * \t// The current schema has a new optional field that was not present on Point2D\n * \tz: factory.optional(factory.number),\n * }) {}\n * const currentViewSchema = new TreeViewConfiguration({ schema: Point3D });\n *\n * // Check to see if the document created by the historical view schema can be opened with the current view schema\n * const backwardsCompatibilityStatus = checkCompatibility(oldViewSchema, currentViewSchema);\n *\n * // z is not present in Point2D, so the schema must be upgraded\n * assert.equal(backwardsCompatibilityStatus.canView, false);\n *\n * // The schema can be upgraded to add the new optional field\n * assert.equal(backwardsCompatibilityStatus.canUpgrade, true);\n *\n * // Test what the old version of the application would do with a tree using the new schema:\n * const forwardsCompatibilityStatus = checkCompatibility(currentViewSchema, oldViewSchema);\n *\n * // If the old schema set allowUnknownOptionalFields, this would be true, but since it did not,\n * // this assert will fail, detecting the forwards compatibility break:\n * // this means these two versions of the application cannot collaborate on content using these schema.\n * assert.equal(forwardsCompatibilityStatus.canView, true);\n * ```\n *\n * @param viewWhichCreatedStoredSchema - From which to derive the stored schema, as if it initialized or upgraded a tree via {@link TreeView}.\n * @param view - The view being tested to see if it could view tree created or initialized using `viewWhichCreatedStoredSchema`.\n * @returns The compatibility status.\n *\n * @privateRemarks\n * TODO: a simple high level API for snapshot based schema compatibility checking should replace the need to export this.\n *\n * @alpha\n */\nexport function checkCompatibility(\n\tviewWhichCreatedStoredSchema: TreeViewConfiguration,\n\tview: TreeViewConfiguration,\n): Omit<SchemaCompatibilityStatus, \"canInitialize\"> {\n\tconst viewAsAlpha = new TreeViewConfigurationAlpha({ schema: view.schema });\n\tconst stored = toInitialSchema(viewWhichCreatedStoredSchema.schema);\n\tconst tester = new SchemaCompatibilityTester(viewAsAlpha);\n\treturn tester.checkCompatibility(stored);\n}\n\n/**\n * Returns a JSON compatible representation of the tree schema for snapshot compatibility checking.\n *\n * Snapshots can be loaded by the same or newer package versions, but not necessarily older versions.\n *\n * @see {@link importCompatibilitySchemaSnapshot} which loads these snapshots.\n *\n * @param config - The schema to snapshot. Only the schema field of the `TreeViewConfiguration` is used.\n * @returns The JSON representation of the schema.\n *\n * @example This example creates and persists a snapshot of a Point2D schema.\n *\n * ```ts\n * const schemaFactory = new SchemaFactory(\"test\");\n * class Point2D extends schemaFactory.object(\"Point\", {\n * \tx: factory.number,\n * \ty: factory.number,\n * }) {}\n * const viewSchema = new TreeViewConfiguration({ schema: Point2D });\n * const encodedSchema = JSON.stringify(exportCompatibilitySchemaSnapshot(viewSchema));\n * fs.writeFileSync(\"PointSchema.json\", encodedSchema);\n * ```\n *\n * @privateRemarks\n * TODO: a simple high level API for snapshot based schema compatibility checking should replace the need to export this.\n *\n * @alpha\n */\nexport function exportCompatibilitySchemaSnapshot(\n\tconfig: Pick<TreeViewConfiguration, \"schema\">,\n): JsonCompatibleReadOnly {\n\tconst treeSchema = createTreeSchema(config.schema);\n\treturn encodeSchemaCompatibilitySnapshot(treeSchema);\n}\n\n/**\n * Parse the format exported by {@link exportCompatibilitySchemaSnapshot} into a schema.\n *\n * Can load snapshots created by the same or older package versions, but not necessarily newer versions.\n *\n * @see {@link exportCompatibilitySchemaSnapshot} which creates these snapshots.\n *\n * @param config - The JSON representation of the schema.\n * @returns The schema. Only the schema field of the {@link TreeViewConfiguration} is populated.\n * @throws Will throw a usage error if the encoded schema is not in the expected format.\n *\n * @example This example loads and parses a snapshot of a Point2D schema.\n *\n * ```ts;\n * const oldViewSchema = importCompatibilitySchemaSnapshot(fs.readFileSync(\"PointSchema.json\", \"utf8\"));\n * ```\n * @privateRemarks\n * TODO: a simple high level API for snapshot based schema compatibility checking should replace the need to export this.\n * @alpha\n */\nexport function importCompatibilitySchemaSnapshot(\n\tconfig: JsonCompatibleReadOnly,\n): TreeViewConfiguration {\n\tconst simpleSchema = decodeSchemaCompatibilitySnapshot(config);\n\tconst viewSchema = generateSchemaFromSimpleSchema(simpleSchema);\n\n\t// We construct a TreeViewConfiguration here with the default parameters. The default set of validation parameters are fine for\n\t// a schema produced by `generateSchemaFromSimpleSchema`.\n\treturn new TreeViewConfiguration({ schema: viewSchema.root });\n}\n\n/**\n * The file system methods required by {@link checkSchemaCompatibilitySnapshots}.\n * @remarks\n * Implemented by both Node.js `fs` and `path` modules, but other implementations can be provided as needed.\n *\n * @example\n * ```typescript\n * import path from \"node:path\";\n * import fs from \"node:fs\";\n *\n * const nodeFileSystem: SnapshotFileSystem = { ...fs, ...path };\n * ```\n *\n * @privateRemarks\n * This interface is designed to be compatible with Node.js `fs` and `path` modules.\n * It is needed to avoid direct dependencies on Node.js APIs in the core library code,\n * allowing for greater portability and easier testing.\n *\n * @input\n * @alpha\n */\nexport interface SnapshotFileSystem {\n\t/**\n\t * Writes a UTF-8 encoded file to disk, replacing the file if it already exists.\n\t *\n\t * @param file - Path to the file to write.\n\t * @param data - String data to be written.\n\t * @param options - Options specifying that the encoding is UTF-8.\n\t */\n\twriteFileSync(file: string, data: string, options: { encoding: \"utf8\" }): void;\n\n\t/**\n\t * Reads a UTF-8 encoded file from disk and returns its contents as a string.\n\t *\n\t * @param file - Path to the file to read.\n\t * @param encoding - The text encoding to use when reading the file. Must be `\"utf8\"`.\n\t * @returns The contents of the file as a string.\n\t */\n\t// We include the encoding here to match the function overload for readFileSync that returns a string.\n\treadFileSync(file: string, encoding: \"utf8\"): string;\n\n\t/**\n\t * How a {@link TreeView} using the snapshotted schema would report its compatibility with a document created with the current schema.\n\t *\n\t * @param dir - Path of the directory to create.\n\t * @param options - Options indicating that creation should be recursive.\n\t */\n\tmkdirSync(dir: string, options: { recursive: true }): void;\n\n\t/**\n\t * Reads the contents of a directory.\n\t *\n\t * @param dir - Path of the directory to read.\n\t * @returns An array of names of the directory entries.\n\t */\n\treaddirSync(dir: string): readonly string[];\n\n\t/**\n\t * Joins two path segments into a single path string.\n\t *\n\t * @param parentPath - The directory path.\n\t * @param childPath - Filename within `parentPath` directory.\n\t * @returns The combined path string.\n\t */\n\tjoin(parentPath: string, childPath: string): string;\n}\n\n/**\n * The combined compatibility status for both backwards and forwards compatibility checks.\n */\nexport interface CombinedSchemaCompatibilityStatus {\n\t/**\n\t * How a {@link TreeView} using the current schema would report its compatibility with the historical snapshot.\n\t */\n\treadonly currentViewOfSnapshotDocument: Omit<SchemaCompatibilityStatus, \"canInitialize\">;\n\t/**\n\t * How a {@link TreeView} using the snapshotted schema would report its compatibility with a document created with the current schema.\n\t */\n\treadonly snapshotViewOfCurrentDocument: Omit<SchemaCompatibilityStatus, \"canInitialize\">;\n}\n\n/**\n * The options for {@link checkSchemaCompatibilitySnapshots}.\n * @input\n * @alpha\n */\nexport interface SchemaCompatibilitySnapshotsOptions {\n\t/**\n\t * Directory where historical schema snapshots are stored.\n\t */\n\treadonly snapshotDirectory: string;\n\t/**\n\t * How the `snapshotDirectory` is accessed.\n\t */\n\treadonly fileSystem: SnapshotFileSystem;\n\t/**\n\t * The current application or library version.\n\t * @remarks\n\t * This uses the {@link https://semver.org/#spec-item-11|ordering defined by semver}.\n\t * It is only compared against the version from previous snapshots (taken from this version when they were created by setting `mode` to \"update\") and the `minVersionForCollaboration`.\n\t */\n\treadonly version: string;\n\t/**\n\t * The current view schema.\n\t */\n\treadonly schema: TreeViewConfiguration;\n\t/**\n\t * The minimum version that the current version is expected to be able to collaborate with.\n\t * @remarks\n\t * This defines a range of versions whose schema must be forwards compatible with trees using the current schema:\n\t * Any schema from snapshots with a version greater than or equal to this must be able to view documents created with the current schema.\n\t * This means that if the current `schema` is used to create a {@link TreeView}, then {@link TreeView.upgradeSchema} is used, the older clients,\n\t * all the way back to this `minVersionForCollaboration` will be able to view and edit the tree using their schema and thus collaborate.\n\t *\n\t * Typically applications will attempt to manage their deployment/update schedule such that all versions concurrently deployed can\n\t * collaborate to avoid users losing access to documents when other users upgrade the schema.\n\t * Such applications can set this to the oldest version currently deployed,\n\t * then rely on {@link checkSchemaCompatibilitySnapshots} to verify that no schema changes are made which would break collaboration with that (or newer) versions.\n\t *\n\t * This is the same approach used by {@link @fluidframework/runtime-definitions#MinimumVersionForCollab}\n\t * except that type is specifically for use with the version of the Fluid Framework client packages,\n\t * and this corresponds to the version of the application or library defining the schema.\n\t */\n\treadonly minVersionForCollaboration: string;\n\t/**\n\t * When true, every version must be snapshotted, and an increased version number will require a new snapshot.\n\t * @remarks\n\t * If this is true, it is assumed there is a snapshot for every release, and thus it is required that the `minVersionForCollaboration` refer to a version which has a snapshot.\n\t * When this is not true, versions without snapshots are assumed to have the same schema as the latest previous version which has a snapshot, and thus `minVersionForCollaboration`\n\t * can refer to versions between snapshots and will get its schema from the preceding version.\n\t */\n\treadonly snapshotUnchangedVersions?: true;\n\t/**\n\t * The mode of operation, either \"test\" or \"update\".\n\t * @remarks\n\t * In \"update\" mode, a new snapshot is created if the current schema differs from the latest existing snapshot.\n\t * Note: {@link SchemaCompatibilitySnapshotsOptions.snapshotUnchangedVersions} impacts this behavior.\n\t *\n\t * In \"test\" mode, an error is thrown if running in \"update\" mode would have made any changes.\n\t *\n\t * Both modes will throw errors if any compatibility issues are detected (but after updating snapshots in \"update\" mode so the diff can be used to help debug).\n\t *\n\t * It is recommended that \"test\" mode be used in automated tests to verify schema compatibility,\n\t * and \"update\" mode only be used manually to update snapshots when making schema changes (or version changes if `snapshotUnchangedVersions` is true).\n\t */\n\treadonly mode: \"test\" | \"update\";\n}\n\n/**\n * Check `currentViewSchema` for compatibility with a collection of historical schema snapshots stored in `snapshotDirectory`.\n *\n * @throws Throws errors if the input version strings (including those in snapshot file names) are not valid semver versions.\n * @throws Throws errors if the input version strings (including those in snapshot file names) are not ordered as expected (current being the highest, and `minVersionForCollaboration` corresponding to the current version or a lower snapshotted version).\n * @throws In `test` mode, throws an error if there is not an up to date snapshot for the current version.\n * @throws Throws an error if any snapshotted schema cannot be upgraded to the current schema.\n * @throws Throws an error if any snapshotted schema with a version greater than or equal to `minVersionForCollaboration` cannot view documents created with the current schema.\n * @remarks\n * This is intended for use in snapshot-based schema compatibility tests.\n * Every SharedTree-based component or application with a schema is recommended to use this to verify schema compatibility across versions.\n *\n * Schema snapshots should be added to `snapshotDirectory` using this function in \"update\" mode whenever the schema changes in a compatibility impacting way\n * (or when `snapshotUnchangedVersions` is true and a new version about to be released is getting prepared for release (and thus `version` changed)).\n *\n * This will throw an exception if any snapshotted schema would result in documents that cannot be viewed (after using {@link TreeView.upgradeSchema}), or if any schema with a version greater than or equal to `minVersionForCollaboration` cannot view documents created with the `currentViewSchema`.\n * See {@link TreeView.compatibility} for more information.\n *\n * Proper use of this utility should do a good job at detecting schema compatibility issues,\n * however it currently does not do a good job of explaining exactly what change to the schema is causing the compatibility issues.\n * This is a known limitation that will be improved in future releases.\n * These improvements, as well as other changes, may change the exact messages produced by this function in the error cases: no stability of these messages should be assumed.\n *\n * For now, locating what change broke compatibility is likely best discovered by making small schema changes one at a time and updating the snapshot and reviewing the diffs.\n * Details for what kinds of changes are breaking and in which ways can be found in the documentation for {@link TreeView.compatibility} and\n * {@link https://fluidframework.com/docs/data-structures/tree/schema-evolution/ | schema-evolution}.\n *\n * This utility does not enforce anything with respect to API compatibility, or special semantics for major, minor, or patch versions.\n * Libraries which export schema for use by others will need to take special care to ensure the stability contract they offer their users aligns which what is validated by this utility.\n *\n * This utility only tests compatibility of the historical snapshots against the current schema; it does not test them against each-other.\n * Generally any historical schema should have been tested against the ones before them at the time they were current.\n * If for some reason a version of a schema made it into production that was not compatible with a previous version,\n * that can still be represented here (but may require manually generating a snapshot for that version)\n * and this will still allow testing that all historical version can be upgraded to the current one.\n * If a sufficiently incompatible historical schema were used in production, it may be impossible to make a single schema which can accommodate all of them:\n * this utility can be used to confirm that is the case, as well as to avoid the problem in the first place by testing schema before each one is deployed.\n *\n * @example Mocha test which validates the current `config` can collaborate with all historical version back to 2.0.0, and load and update any versions older than that.\n * ```typescript\n * it(\"schema compatibility\", () => {\n * \tcheckSchemaCompatibilitySnapshots({\n * \t\tversion: pkgVersion,\n * \t\tschema: config,\n * \t\tfileSystem: { ...fs, ...path },\n * \t\tminVersionForCollaboration: \"2.0.0\",\n * \t\tmode: process.argv.includes(\"--snapshot\") ? \"update\" : \"test\",\n * \t\tsnapshotDirectory,\n * \t});\n * });\n * ```\n * @privateRemarks\n * Use of this function within this package (for schema libraries released as part of this package) should use {@link testSchemaCompatibilitySnapshots} instead.\n *\n * TODO: this uses the format defined in simpleSchemaCodec.ts.\n * Currently this does not include any versioning information in the snapshot format itself.\n * This would make it hard to do things like upgrade to a new format (perhaps for better diffs, or to support new features) in the future.\n * That code should probably be migrated to a proper versioned codec with a schema and validation.\n * This utility can directly depend on the typebox-validator and inject that as this code should not be bundle size sensitive.\n * This should be addressed before this reached beta stability.\n * @alpha\n */\nexport function checkSchemaCompatibilitySnapshots(\n\toptions: SchemaCompatibilitySnapshotsOptions,\n): void {\n\tconst checker = new SnapshotCompatibilityChecker(\n\t\toptions.snapshotDirectory,\n\t\toptions.fileSystem,\n\t);\n\tconst {\n\t\tversion: currentVersion,\n\t\tschema: currentViewSchema,\n\t\tmode,\n\t\tminVersionForCollaboration,\n\t\tsnapshotUnchangedVersions,\n\t} = options;\n\tif (semver.valid(currentVersion) === null) {\n\t\tthrow new UsageError(\n\t\t\t`Invalid version: ${JSON.stringify(currentVersion)}. Must be a valid semver version.`,\n\t\t);\n\t}\n\tif (semver.valid(minVersionForCollaboration) === null) {\n\t\tthrow new UsageError(\n\t\t\t`Invalid minVersionForCollaboration: ${JSON.stringify(minVersionForCollaboration)}. Must be a valid semver version.`,\n\t\t);\n\t}\n\tif (!semver.lte(minVersionForCollaboration, currentVersion)) {\n\t\tthrow new UsageError(\n\t\t\t`Invalid minVersionForCollaboration: ${JSON.stringify(minVersionForCollaboration)}. Must be less than or equal to current version ${JSON.stringify(currentVersion)}.`,\n\t\t);\n\t}\n\n\tif (mode !== \"test\" && mode !== \"update\") {\n\t\tthrow new UsageError(\n\t\t\t`Invalid mode: ${JSON.stringify(mode)}. Must be either \"test\" or \"update\".`,\n\t\t);\n\t}\n\n\tconst currentEncodedForSnapshotting = exportCompatibilitySchemaSnapshot(currentViewSchema);\n\tconst snapshots = checker.readAllSchemaSnapshots();\n\n\tconst compatibilityErrors: string[] = [];\n\n\tfunction updatableError(message: string): void {\n\t\tassert(mode === \"test\", \"updatableError should only be called in test mode\");\n\t\tcompatibilityErrors.push(\n\t\t\t`${message} If this is expected, checkSchemaCompatibilitySnapshots can be rerun in \"update\" mode to update the snapshot.`,\n\t\t);\n\t}\n\n\tif (snapshotUnchangedVersions === true) {\n\t\tif (mode === \"update\") {\n\t\t\tchecker.writeSchemaSnapshot(currentVersion, currentEncodedForSnapshotting);\n\t\t\tsnapshots.set(currentVersion, currentViewSchema);\n\t\t} else {\n\t\t\tconst currentRead = snapshots.get(currentVersion);\n\t\t\tif (currentRead === undefined) {\n\t\t\t\tupdatableError(\n\t\t\t\t\t`No snapshot found for version ${JSON.stringify(currentVersion)}: snapshotUnchangedVersions is true, so every version must be snapshotted.`,\n\t\t\t\t);\n\t\t\t} else if (\n\t\t\t\tJSON.stringify(exportCompatibilitySchemaSnapshot(currentRead)) !==\n\t\t\t\tJSON.stringify(currentEncodedForSnapshotting)\n\t\t\t) {\n\t\t\t\tupdatableError(\n\t\t\t\t\t`Snapshot for current version ${JSON.stringify(currentVersion)} is out of date.`,\n\t\t\t\t);\n\t\t\t}\n\t\t}\n\t} else {\n\t\tconst entries = [...snapshots];\n\t\tconst latestSnapshot = entries[entries.length - 1];\n\t\tif (latestSnapshot === undefined) {\n\t\t\tif (mode === \"update\") {\n\t\t\t\tchecker.writeSchemaSnapshot(currentVersion, currentEncodedForSnapshotting);\n\t\t\t\tsnapshots.set(currentVersion, currentViewSchema);\n\t\t\t} else {\n\t\t\t\tupdatableError(`No snapshots found.`);\n\t\t\t}\n\t\t} else {\n\t\t\tif (semver.lte(latestSnapshot[0], currentVersion)) {\n\t\t\t\t// Check to see if schema in snapshot is the same as the latest existing snapshot.\n\t\t\t\tconst oldString = JSON.stringify(exportCompatibilitySchemaSnapshot(latestSnapshot[1]));\n\t\t\t\tconst currentString = JSON.stringify(currentEncodedForSnapshotting);\n\t\t\t\tif (oldString !== currentString) {\n\t\t\t\t\t// Schema has changed: must create new snapshot.\n\t\t\t\t\tif (mode === \"update\") {\n\t\t\t\t\t\tchecker.writeSchemaSnapshot(currentVersion, currentEncodedForSnapshotting);\n\t\t\t\t\t\tsnapshots.set(currentVersion, currentViewSchema);\n\t\t\t\t\t} else {\n\t\t\t\t\t\tupdatableError(\n\t\t\t\t\t\t\t`Snapshot for current version ${JSON.stringify(currentVersion)} is out of date: schema has changed since latest existing snapshot version ${JSON.stringify(latestSnapshot[0])}.`,\n\t\t\t\t\t\t);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tthrow new UsageError(\n\t\t\t\t\t`Current version ${JSON.stringify(currentVersion)} is less than latest existing snapshot version ${JSON.stringify(latestSnapshot[0])}: version is expected to increase monotonically.`,\n\t\t\t\t);\n\t\t\t}\n\t\t}\n\t}\n\n\tconst compatibilityMap = transformMapValues(snapshots, (snapshot) =>\n\t\tgetCompatibility(currentViewSchema, snapshot),\n\t);\n\n\tlet selectedMinVersionForCollaborationSnapshot:\n\t\t| undefined\n\t\t| readonly [string, CombinedSchemaCompatibilityStatus];\n\n\tif (snapshotUnchangedVersions === true) {\n\t\tconst minSnapshot = compatibilityMap.get(minVersionForCollaboration);\n\t\tif (minSnapshot === undefined) {\n\t\t\tcompatibilityErrors.push(\n\t\t\t\t`Using snapshotUnchangedVersions: a snapshot of the exact minVersionForCollaboration ${JSON.stringify(minVersionForCollaboration)} is required. No snapshot found.`,\n\t\t\t);\n\t\t} else {\n\t\t\tselectedMinVersionForCollaborationSnapshot = [minVersionForCollaboration, minSnapshot];\n\t\t}\n\t} else {\n\t\tselectedMinVersionForCollaborationSnapshot = selectVersionRoundedDown(\n\t\t\tminVersionForCollaboration,\n\t\t\tcompatibilityMap,\n\t\t);\n\t\tif (selectedMinVersionForCollaborationSnapshot === undefined) {\n\t\t\tcompatibilityErrors.push(\n\t\t\t\t`No snapshot found with version less than or equal to minVersionForCollaboration ${JSON.stringify(minVersionForCollaboration)}.`,\n\t\t\t);\n\t\t}\n\t}\n\n\tfor (const [snapshotVersion, compatibility] of compatibilityMap) {\n\t\t// Current should be able to view all versions.\n\t\tif (!compatibility.currentViewOfSnapshotDocument.canUpgrade) {\n\t\t\tcompatibilityErrors.push(\n\t\t\t\t`Current version ${JSON.stringify(currentVersion)} cannot upgrade documents from ${JSON.stringify(snapshotVersion)}.`,\n\t\t\t);\n\t\t}\n\n\t\tif (semver.eq(snapshotVersion, currentVersion)) {\n\t\t\tif (currentVersion !== snapshotVersion) {\n\t\t\t\tthrow new UsageError(\n\t\t\t\t\t`Snapshot version ${JSON.stringify(snapshotVersion)} is semantically equal but not string equal to current version ${JSON.stringify(currentVersion)}: this is not supported.`,\n\t\t\t\t);\n\t\t\t}\n\t\t\tif (\n\t\t\t\tcompatibility.currentViewOfSnapshotDocument.isEquivalent === false ||\n\t\t\t\tcompatibility.snapshotViewOfCurrentDocument.isEquivalent === false\n\t\t\t) {\n\t\t\t\tcompatibilityErrors.push(\n\t\t\t\t\t`Current version ${JSON.stringify(snapshotVersion)} expected to be equivalent to its snapshot.`,\n\t\t\t\t);\n\t\t\t}\n\t\t} else if (semver.lt(snapshotVersion, currentVersion)) {\n\t\t\tif (selectedMinVersionForCollaborationSnapshot === undefined) {\n\t\t\t\tassert(\n\t\t\t\t\tcompatibilityErrors.length > 0,\n\t\t\t\t\t\"expected compatibility errors for missing min collab version snapshot\",\n\t\t\t\t);\n\t\t\t} else {\n\t\t\t\t// Collaboration with this version is expected to work.\n\t\t\t\tif (semver.gte(snapshotVersion, selectedMinVersionForCollaborationSnapshot[0])) {\n\t\t\t\t\t// Check that the historical version can view documents from the current version, since collaboration with this one is expected to work.\n\t\t\t\t\tif (!compatibility.snapshotViewOfCurrentDocument.canView) {\n\t\t\t\t\t\tconst message = `Historical version ${JSON.stringify(snapshotVersion)} cannot view documents from ${JSON.stringify(currentVersion)}: these versions are expected to be able to collaborate due to the selected minVersionForCollaboration snapshot version being ${JSON.stringify(selectedMinVersionForCollaborationSnapshot[0])}.`;\n\t\t\t\t\t\tcompatibilityErrors.push(\n\t\t\t\t\t\t\tselectedMinVersionForCollaborationSnapshot[0] === minVersionForCollaboration\n\t\t\t\t\t\t\t\t? message\n\t\t\t\t\t\t\t\t: `${message} The specified minVersionForCollaboration is ${JSON.stringify(minVersionForCollaboration)} which was rounded down to an existing snapshot.`,\n\t\t\t\t\t\t);\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\t// This is the case where the historical version is less than the minimum version for collaboration.\n\t\t\t\t\t// No additional validation is needed here currently, since forwards document compat from these versions is already tested above (since it applies to all snapshots).\n\t\t\t\t}\n\t\t\t}\n\t\t} else {\n\t\t\tthrow new UsageError(\n\t\t\t\t`Unexpected semver comparison result between snapshot version ${JSON.stringify(snapshotVersion)} and app version ${JSON.stringify(currentVersion)}.`,\n\t\t\t);\n\t\t}\n\t}\n\n\tif (compatibilityErrors.length > 0) {\n\t\tthrow new Error(\n\t\t\t`Schema compatibility check failed:\\n${compatibilityErrors\n\t\t\t\t.map((e) => ` - ${e}`)\n\t\t\t\t.join(\"\\n\")}`,\n\t\t);\n\t}\n}\n\n/**\n * The high-level API for checking snapshot compatibility and generating new snapshots.\n */\nexport class SnapshotCompatibilityChecker {\n\tpublic constructor(\n\t\t/**\n\t\t * Directory where historical schema snapshots are stored.\n\t\t */\n\t\tprivate readonly snapshotDirectory: string,\n\t\t/**\n\t\t * How the `snapshotDirectory` is accessed.\n\t\t */\n\t\tprivate readonly fileSystemMethods: SnapshotFileSystem,\n\t) {}\n\n\tpublic writeSchemaSnapshot(snapshotName: string, snapshot: JsonCompatibleReadOnly): void {\n\t\tconst fullPath = this.fileSystemMethods.join(\n\t\t\tthis.snapshotDirectory,\n\t\t\t`${snapshotName}.json`,\n\t\t);\n\t\tthis.ensureSnapshotDirectoryExists();\n\t\tthis.fileSystemMethods.writeFileSync(fullPath, JSON.stringify(snapshot, undefined, 2), {\n\t\t\tencoding: \"utf8\",\n\t\t});\n\t}\n\n\tpublic readSchemaSnapshot(snapshotName: string): TreeViewConfiguration {\n\t\tconst snapshot = this.readSchemaSnapshotRaw(snapshotName);\n\t\treturn importCompatibilitySchemaSnapshot(snapshot);\n\t}\n\n\tpublic readSchemaSnapshotRaw(snapshotName: string): JsonCompatibleReadOnly {\n\t\tconst fullPath = this.fileSystemMethods.join(\n\t\t\tthis.snapshotDirectory,\n\t\t\t`${snapshotName}.json`,\n\t\t);\n\t\tconst snapshot = JSON.parse(\n\t\t\tthis.fileSystemMethods.readFileSync(fullPath, \"utf8\"),\n\t\t) as JsonCompatibleReadOnly;\n\t\treturn snapshot;\n\t}\n\n\t/**\n\t * Returns all schema snapshots stored in the snapshot directory, sorted in order of increasing version.\n\t */\n\tpublic readAllSchemaSnapshots(): Map<string, TreeViewConfiguration> {\n\t\tthis.ensureSnapshotDirectoryExists();\n\t\tconst files = this.fileSystemMethods.readdirSync(this.snapshotDirectory);\n\t\tconst versions: string[] = [];\n\t\tfor (const file of files) {\n\t\t\tif (file.endsWith(\".json\")) {\n\t\t\t\tconst snapshotName = file.slice(0, \".json\".length * -1);\n\t\t\t\tversions.push(snapshotName);\n\t\t\t}\n\t\t}\n\t\t// Ensures that errors are in a consistent and friendly order, independent of file system order.\n\t\tversions.sort((a, b) => semver.compare(a, b));\n\n\t\tconst snapshots: Map<string, TreeViewConfiguration> = new Map();\n\t\tfor (const version of versions) {\n\t\t\tsnapshots.set(version, this.readSchemaSnapshot(version));\n\t\t}\n\t\treturn snapshots;\n\t}\n\n\tpublic ensureSnapshotDirectoryExists(): void {\n\t\tthis.fileSystemMethods.mkdirSync(this.snapshotDirectory, { recursive: true });\n\t}\n}\n\n/**\n * Gets the compatibility of the current view schema against a historical snapshot.\n * @param currentViewSchema - The current view schema.\n * @param previousViewSchema - The historical view schema.\n * @returns The combined compatibility status.\n */\nexport function getCompatibility(\n\tcurrentViewSchema: TreeViewConfiguration,\n\tpreviousViewSchema: TreeViewConfiguration,\n): CombinedSchemaCompatibilityStatus {\n\tconst backwardsCompatibilityStatus = checkCompatibility(\n\t\tpreviousViewSchema,\n\t\tcurrentViewSchema,\n\t);\n\n\tconst forwardsCompatibilityStatus = checkCompatibility(\n\t\tcurrentViewSchema,\n\t\tpreviousViewSchema,\n\t);\n\n\treturn {\n\t\tcurrentViewOfSnapshotDocument: backwardsCompatibilityStatus,\n\t\tsnapshotViewOfCurrentDocument: forwardsCompatibilityStatus,\n\t};\n}\n"]}
|
|
1
|
+
{"version":3,"file":"snapshotCompatibilityChecker.js","sourceRoot":"","sources":["../../../src/simple-tree/api/snapshotCompatibilityChecker.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;;;;;;;;;;;;;;;;;;;;;;;;AAEH,kEAAiF;AACjF,qEAAkF;AAClF,uEAAsE;AACtE,kDAAoC;AAGpC,4DAAuD;AACvD,oDAAoD;AAEpD,yDAAuF;AACvF,iFAA2E;AAC3E,+DAAuE;AACvE,iEAGgC;AAGhC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkDG;AACH,SAAgB,kBAAkB,CACjC,4BAAmD,EACnD,IAA2B;IAE3B,MAAM,WAAW,GAAG,IAAI,6CAA0B,CAAC,EAAE,MAAM,EAAE,IAAI,CAAC,MAAM,EAAE,CAAC,CAAC;IAC5E,MAAM,MAAM,GAAG,IAAA,mCAAe,EAAC,4BAA4B,CAAC,MAAM,CAAC,CAAC;IACpE,MAAM,MAAM,GAAG,IAAI,wDAAyB,CAAC,WAAW,CAAC,CAAC;IAC1D,OAAO,MAAM,CAAC,kBAAkB,CAAC,MAAM,CAAC,CAAC;AAC1C,CAAC;AARD,gDAQC;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,SAAgB,iCAAiC,CAChD,MAA6C;IAE7C,MAAM,UAAU,GAAG,IAAA,gCAAgB,EAAC,MAAM,CAAC,MAAM,CAAC,CAAC;IACnD,OAAO,IAAA,wDAAiC,EAAC,UAAU,CAAC,CAAC;AACtD,CAAC;AALD,8EAKC;AAED;;;;;;;;;;;;;;;;;;;GAmBG;AACH,SAAgB,iCAAiC,CAChD,MAA8B;IAE9B,MAAM,YAAY,GAAG,IAAA,wDAAiC,EAAC,MAAM,CAAC,CAAC;IAC/D,MAAM,UAAU,GAAG,IAAA,oDAA8B,EAAC,YAAY,CAAC,CAAC;IAEhE,+HAA+H;IAC/H,yDAAyD;IACzD,OAAO,IAAI,wCAAqB,CA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ED,oEAiEC;AAED;;;;;GAKG;AACH,SAAgB,gBAAgB,CAC/B,iBAAwC,EACxC,kBAAyC;IAEzC,MAAM,4BAA4B,GAAG,kBAAkB,CACtD,kBAAkB,EAClB,iBAAiB,CACjB,CAAC;IAEF,MAAM,2BAA2B,GAAG,kBAAkB,CACrD,iBAAiB,EACjB,kBAAkB,CAClB,CAAC;IAEF,OAAO;QACN,6BAA6B,EAAE,4BAA4B;QAC3D,6BAA6B,EAAE,2BAA2B;KAC1D,CAAC;AACH,CAAC;AAlBD,4CAkBC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { assert, transformMapValues } from \"@fluidframework/core-utils/internal\";\nimport { selectVersionRoundedDown } from \"@fluidframework/runtime-utils/internal\";\nimport { UsageError } from \"@fluidframework/telemetry-utils/internal\";\nimport * as semver from \"semver-ts\";\n\nimport type { JsonCompatibleReadOnly } from \"../../util/index.js\";\nimport { toInitialSchema } from \"../toStoredSchema.js\";\nimport { createTreeSchema } from \"../treeSchema.js\";\n\nimport { TreeViewConfigurationAlpha, TreeViewConfiguration } from \"./configuration.js\";\nimport { SchemaCompatibilityTester } from \"./schemaCompatibilityTester.js\";\nimport { generateSchemaFromSimpleSchema } from \"./schemaFromSimple.js\";\nimport {\n\tdecodeSchemaCompatibilitySnapshot,\n\tencodeSchemaCompatibilitySnapshot,\n} from \"./simpleSchemaCodec.js\";\nimport type { SchemaCompatibilityStatus } from \"./tree.js\";\n\n/**\n * Compute the compatibility of using `view` to {@link ViewableTree.viewWith | view a tree} who's {@link ITreeAlpha.exportSimpleSchema | stored schema} could be derived from `viewWhichCreatedStoredSchema` via either {@link TreeView.initialize} or {@link TreeView.upgradeSchema}.\n *\n * @remarks See {@link SchemaCompatibilityStatus} for details on the compatibility results.\n *\n * @example This example demonstrates checking the compatibility of a historical schema against a current schema.\n * In this case, the historical schema is a Point2D object with x and y fields, while the current schema is a Point3D object\n * that adds an optional z field.\n *\n * ```ts\n * // This snapshot is assumed to be the same as Point3D, except missing `z`.\n * const encodedSchema = JSON.parse(fs.readFileSync(\"PointSchema.json\", \"utf8\"));\n * const oldViewSchema = importCompatibilitySchemaSnapshot(encodedSchema);\n *\n * // Build the current view schema\n * class Point3D extends factory.object(\"Point\", {\n * \tx: factory.number,\n * \ty: factory.number,\n *\n * \t// The current schema has a new optional field that was not present on Point2D\n * \tz: factory.optional(factory.number),\n * }) {}\n * const currentViewSchema = new TreeViewConfiguration({ schema: Point3D });\n *\n * // Check to see if the document created by the historical view schema can be opened with the current view schema\n * const backwardsCompatibilityStatus = checkCompatibility(oldViewSchema, currentViewSchema);\n *\n * // z is not present in Point2D, so the schema must be upgraded\n * assert.equal(backwardsCompatibilityStatus.canView, false);\n *\n * // The schema can be upgraded to add the new optional field\n * assert.equal(backwardsCompatibilityStatus.canUpgrade, true);\n *\n * // Test what the old version of the application would do with a tree using the new schema:\n * const forwardsCompatibilityStatus = checkCompatibility(currentViewSchema, oldViewSchema);\n *\n * // If the old schema set allowUnknownOptionalFields, this would be true, but since it did not,\n * // this assert will fail, detecting the forwards compatibility break:\n * // this means these two versions of the application cannot collaborate on content using these schema.\n * assert.equal(forwardsCompatibilityStatus.canView, true);\n * ```\n *\n * @param viewWhichCreatedStoredSchema - From which to derive the stored schema, as if it initialized or upgraded a tree via {@link TreeView}.\n * @param view - The view being tested to see if it could view tree created or initialized using `viewWhichCreatedStoredSchema`.\n * @returns The compatibility status.\n *\n * @privateRemarks\n * TODO: a simple high level API for snapshot based schema compatibility checking should replace the need to export this.\n *\n * @alpha\n */\nexport function checkCompatibility(\n\tviewWhichCreatedStoredSchema: TreeViewConfiguration,\n\tview: TreeViewConfiguration,\n): Omit<SchemaCompatibilityStatus, \"canInitialize\"> {\n\tconst viewAsAlpha = new TreeViewConfigurationAlpha({ schema: view.schema });\n\tconst stored = toInitialSchema(viewWhichCreatedStoredSchema.schema);\n\tconst tester = new SchemaCompatibilityTester(viewAsAlpha);\n\treturn tester.checkCompatibility(stored);\n}\n\n/**\n * Returns a JSON compatible representation of the tree schema for snapshot compatibility checking.\n *\n * Snapshots can be loaded by the same or newer package versions, but not necessarily older versions.\n *\n * @see {@link importCompatibilitySchemaSnapshot} which loads these snapshots.\n *\n * @param config - The schema to snapshot. Only the schema field of the `TreeViewConfiguration` is used.\n * @returns The JSON representation of the schema.\n *\n * @example This example creates and persists a snapshot of a Point2D schema.\n *\n * ```ts\n * const schemaFactory = new SchemaFactory(\"test\");\n * class Point2D extends schemaFactory.object(\"Point\", {\n * \tx: factory.number,\n * \ty: factory.number,\n * }) {}\n * const viewSchema = new TreeViewConfiguration({ schema: Point2D });\n * const encodedSchema = JSON.stringify(exportCompatibilitySchemaSnapshot(viewSchema));\n * fs.writeFileSync(\"PointSchema.json\", encodedSchema);\n * ```\n *\n * @privateRemarks\n * TODO: a simple high level API for snapshot based schema compatibility checking should replace the need to export this.\n *\n * @alpha\n */\nexport function exportCompatibilitySchemaSnapshot(\n\tconfig: Pick<TreeViewConfiguration, \"schema\">,\n): JsonCompatibleReadOnly {\n\tconst treeSchema = createTreeSchema(config.schema);\n\treturn encodeSchemaCompatibilitySnapshot(treeSchema);\n}\n\n/**\n * Parse the format exported by {@link exportCompatibilitySchemaSnapshot} into a schema.\n *\n * Can load snapshots created by the same or older package versions, but not necessarily newer versions.\n *\n * @see {@link exportCompatibilitySchemaSnapshot} which creates these snapshots.\n *\n * @param config - The JSON representation of the schema.\n * @returns The schema. Only the schema field of the {@link TreeViewConfiguration} is populated.\n * @throws Will throw a usage error if the encoded schema is not in the expected format.\n *\n * @example This example loads and parses a snapshot of a Point2D schema.\n *\n * ```ts;\n * const oldViewSchema = importCompatibilitySchemaSnapshot(fs.readFileSync(\"PointSchema.json\", \"utf8\"));\n * ```\n * @privateRemarks\n * TODO: a simple high level API for snapshot based schema compatibility checking should replace the need to export this.\n * @alpha\n */\nexport function importCompatibilitySchemaSnapshot(\n\tconfig: JsonCompatibleReadOnly,\n): TreeViewConfiguration {\n\tconst simpleSchema = decodeSchemaCompatibilitySnapshot(config);\n\tconst viewSchema = generateSchemaFromSimpleSchema(simpleSchema);\n\n\t// We construct a TreeViewConfiguration here with the default parameters. The default set of validation parameters are fine for\n\t// a schema produced by `generateSchemaFromSimpleSchema`.\n\treturn new TreeViewConfiguration({ schema: viewSchema.root });\n}\n\n/**\n * The file system methods required by {@link checkSchemaCompatibilitySnapshots}.\n * @remarks\n * Implemented by both Node.js `fs` and `path` modules, but other implementations can be provided as needed.\n *\n * @example\n * ```typescript\n * import path from \"node:path\";\n * import fs from \"node:fs\";\n *\n * const nodeFileSystem: SnapshotFileSystem = { ...fs, ...path };\n * ```\n *\n * @privateRemarks\n * This interface is designed to be compatible with Node.js `fs` and `path` modules.\n * It is needed to avoid direct dependencies on Node.js APIs in the core library code,\n * allowing for greater portability and easier testing.\n *\n * @input\n * @alpha\n */\nexport interface SnapshotFileSystem {\n\t/**\n\t * Writes a UTF-8 encoded file to disk, replacing the file if it already exists.\n\t *\n\t * @param file - Path to the file to write.\n\t * @param data - String data to be written.\n\t * @param options - Options specifying that the encoding is UTF-8.\n\t */\n\twriteFileSync(file: string, data: string, options: { encoding: \"utf8\" }): void;\n\n\t/**\n\t * Reads a UTF-8 encoded file from disk and returns its contents as a string.\n\t *\n\t * @param file - Path to the file to read.\n\t * @param encoding - The text encoding to use when reading the file. Must be `\"utf8\"`.\n\t * @returns The contents of the file as a string.\n\t */\n\t// We include the encoding here to match the function overload for readFileSync that returns a string.\n\treadFileSync(file: string, encoding: \"utf8\"): string;\n\n\t/**\n\t * How a {@link TreeView} using the snapshotted schema would report its compatibility with a document created with the current schema.\n\t *\n\t * @param dir - Path of the directory to create.\n\t * @param options - Options indicating that creation should be recursive.\n\t */\n\tmkdirSync(dir: string, options: { recursive: true }): void;\n\n\t/**\n\t * Reads the contents of a directory.\n\t *\n\t * @param dir - Path of the directory to read.\n\t * @returns An array of names of the directory entries.\n\t */\n\treaddirSync(dir: string): readonly string[];\n\n\t/**\n\t * Joins two path segments into a single path string.\n\t *\n\t * @param parentPath - The directory path.\n\t * @param childPath - Filename within `parentPath` directory.\n\t * @returns The combined path string.\n\t */\n\tjoin(parentPath: string, childPath: string): string;\n}\n\n/**\n * The combined compatibility status for both backwards and forwards compatibility checks.\n */\nexport interface CombinedSchemaCompatibilityStatus {\n\t/**\n\t * How a {@link TreeView} using the current schema would report its compatibility with the historical snapshot.\n\t */\n\treadonly currentViewOfSnapshotDocument: Omit<SchemaCompatibilityStatus, \"canInitialize\">;\n\t/**\n\t * How a {@link TreeView} using the snapshotted schema would report its compatibility with a document created with the current schema.\n\t */\n\treadonly snapshotViewOfCurrentDocument: Omit<SchemaCompatibilityStatus, \"canInitialize\">;\n}\n\n/**\n * The options for {@link checkSchemaCompatibilitySnapshots}.\n * @input\n * @alpha\n */\nexport interface SchemaCompatibilitySnapshotsOptions {\n\t/**\n\t * Directory where historical schema snapshots are stored.\n\t */\n\treadonly snapshotDirectory: string;\n\t/**\n\t * How the `snapshotDirectory` is accessed.\n\t */\n\treadonly fileSystem: SnapshotFileSystem;\n\t/**\n\t * The current application or library version.\n\t * @remarks\n\t * This uses the {@link https://semver.org/#spec-item-11|ordering defined by semver}.\n\t * It is only compared against the version from previous snapshots (taken from this version when they were created by setting `mode` to \"update\") and the `minVersionForCollaboration`.\n\t */\n\treadonly version: string;\n\t/**\n\t * The current view schema.\n\t */\n\treadonly schema: TreeViewConfiguration;\n\t/**\n\t * The minimum version that the current version is expected to be able to collaborate with.\n\t * @remarks\n\t * This defines a range of versions whose schema must be forwards compatible with trees using the current schema:\n\t * Any schema from snapshots with a version greater than or equal to this must be able to view documents created with the current schema.\n\t * This means that if the current `schema` is used to create a {@link TreeView}, then {@link TreeView.upgradeSchema} is used, the older clients,\n\t * all the way back to this `minVersionForCollaboration` will be able to view and edit the tree using their schema and thus collaborate.\n\t *\n\t * Typically applications will attempt to manage their deployment/update schedule such that all versions concurrently deployed can\n\t * collaborate to avoid users losing access to documents when other users upgrade the schema.\n\t * Such applications can set this to the oldest version currently deployed,\n\t * then rely on {@link checkSchemaCompatibilitySnapshots} to verify that no schema changes are made which would break collaboration with that (or newer) versions.\n\t *\n\t * This is the same approach used by {@link @fluidframework/runtime-definitions#MinimumVersionForCollab}\n\t * except that type is specifically for use with the version of the Fluid Framework client packages,\n\t * and this corresponds to the version of the application or library defining the schema.\n\t */\n\treadonly minVersionForCollaboration: string;\n\t/**\n\t * When true, every version must be snapshotted, and an increased version number will require a new snapshot.\n\t * @remarks\n\t * If this is true, it is assumed there is a snapshot for every release, and thus it is required that the `minVersionForCollaboration` refer to a version which has a snapshot.\n\t * When this is not true, versions without snapshots are assumed to have the same schema as the latest previous version which has a snapshot, and thus `minVersionForCollaboration`\n\t * can refer to versions between snapshots and will get its schema from the preceding version.\n\t */\n\treadonly snapshotUnchangedVersions?: true;\n\t/**\n\t * The mode of operation, either \"test\" or \"update\".\n\t * @remarks\n\t * In \"update\" mode, a new snapshot is created if the current schema differs from the latest existing snapshot.\n\t * Note: {@link SchemaCompatibilitySnapshotsOptions.snapshotUnchangedVersions} impacts this behavior.\n\t *\n\t * In \"test\" mode, an error is thrown if running in \"update\" mode would have made any changes.\n\t *\n\t * Both modes will throw errors if any compatibility issues are detected (but after updating snapshots in \"update\" mode so the diff can be used to help debug).\n\t *\n\t * It is recommended that \"test\" mode be used in automated tests to verify schema compatibility,\n\t * and \"update\" mode only be used manually to update snapshots when making schema changes (or version changes if `snapshotUnchangedVersions` is true).\n\t */\n\treadonly mode: \"test\" | \"update\";\n}\n\n/**\n * Check `currentViewSchema` for compatibility with a collection of historical schema snapshots stored in `snapshotDirectory`.\n *\n * @throws Throws errors if the input version strings (including those in snapshot file names) are not valid semver versions.\n * @throws Throws errors if the input version strings (including those in snapshot file names) are not ordered as expected (current being the highest, and `minVersionForCollaboration` corresponding to the current version or a lower snapshotted version).\n * @throws In `test` mode, throws an error if there is not an up to date snapshot for the current version.\n * @throws Throws an error if any snapshotted schema cannot be upgraded to the current schema.\n * @throws Throws an error if any snapshotted schema with a version greater than or equal to `minVersionForCollaboration` cannot view documents created with the current schema.\n * @remarks\n * This is intended for use in snapshot-based schema compatibility tests.\n * Every SharedTree-based component or application with a schema is recommended to use this to verify schema compatibility across versions.\n *\n * Schema snapshots should be added to `snapshotDirectory` using this function in \"update\" mode whenever the schema changes in a compatibility impacting way\n * (or when `snapshotUnchangedVersions` is true and a new version about to be released is getting prepared for release (and thus `version` changed)).\n *\n * This will throw an exception if any snapshotted schema would result in documents that cannot be viewed (after using {@link TreeView.upgradeSchema}), or if any schema with a version greater than or equal to `minVersionForCollaboration` cannot view documents created with the `currentViewSchema`.\n * See {@link TreeView.compatibility} for more information.\n *\n * Proper use of this utility should do a good job at detecting schema compatibility issues,\n * however it currently does not do a good job of explaining exactly what change to the schema is causing the compatibility issues.\n * This is a known limitation that will be improved in future releases.\n * These improvements, as well as other changes, may change the exact messages produced by this function in the error cases: no stability of these messages should be assumed.\n *\n * For now, locating what change broke compatibility is likely best discovered by making small schema changes one at a time and updating the snapshot and reviewing the diffs.\n * Details for what kinds of changes are breaking and in which ways can be found in the documentation for {@link TreeView.compatibility} and\n * {@link https://fluidframework.com/docs/data-structures/tree/schema-evolution/ | schema-evolution}.\n *\n * This utility does not enforce anything with respect to API compatibility, or special semantics for major, minor, or patch versions.\n * Libraries which export schema for use by others will need to take special care to ensure the stability contract they offer their users aligns which what is validated by this utility.\n *\n * This utility only tests compatibility of the historical snapshots against the current schema; it does not test them against each-other.\n * Generally any historical schema should have been tested against the ones before them at the time they were current.\n * If for some reason a version of a schema made it into production that was not compatible with a previous version,\n * that can still be represented here (but may require manually generating a snapshot for that version)\n * and this will still allow testing that all historical version can be upgraded to the current one.\n * If a sufficiently incompatible historical schema were used in production, it may be impossible to make a single schema which can accommodate all of them:\n * this utility can be used to confirm that is the case, as well as to avoid the problem in the first place by testing schema before each one is deployed.\n *\n * @example Mocha test which validates the current `config` can collaborate with all historical version back to 2.0.0, and load and update any versions older than that.\n * ```typescript\n * it(\"schema compatibility\", () => {\n * \tcheckSchemaCompatibilitySnapshots({\n * \t\tversion: pkgVersion,\n * \t\tschema: config,\n * \t\tfileSystem: { ...fs, ...path },\n * \t\tminVersionForCollaboration: \"2.0.0\",\n * \t\tmode: process.argv.includes(\"--snapshot\") ? \"update\" : \"test\",\n * \t\tsnapshotDirectory,\n * \t});\n * });\n * ```\n * @privateRemarks\n * Use of this function within this package (for schema libraries released as part of this package) should use {@link testSchemaCompatibilitySnapshots} instead.\n *\n * TODO: this uses the format defined in simpleSchemaCodec.ts.\n * Currently this does not include any versioning information in the snapshot format itself.\n * This would make it hard to do things like upgrade to a new format (perhaps for better diffs, or to support new features) in the future.\n * That code should probably be migrated to a proper versioned codec with a schema and validation.\n * This utility can directly depend on the typebox-validator and inject that as this code should not be bundle size sensitive.\n * This should be addressed before this reached beta stability.\n * @alpha\n */\nexport function checkSchemaCompatibilitySnapshots(\n\toptions: SchemaCompatibilitySnapshotsOptions,\n): void {\n\tconst checker = new SnapshotCompatibilityChecker(\n\t\toptions.snapshotDirectory,\n\t\toptions.fileSystem,\n\t);\n\tconst {\n\t\tversion: currentVersion,\n\t\tschema: currentViewSchema,\n\t\tmode,\n\t\tminVersionForCollaboration,\n\t\tsnapshotUnchangedVersions,\n\t} = options;\n\tif (semver.valid(currentVersion) === null) {\n\t\tthrow new UsageError(\n\t\t\t`Invalid version: ${JSON.stringify(currentVersion)}. Must be a valid semver version.`,\n\t\t);\n\t}\n\tif (semver.valid(minVersionForCollaboration) === null) {\n\t\tthrow new UsageError(\n\t\t\t`Invalid minVersionForCollaboration: ${JSON.stringify(minVersionForCollaboration)}. Must be a valid semver version.`,\n\t\t);\n\t}\n\tif (!semver.lte(minVersionForCollaboration, currentVersion)) {\n\t\tthrow new UsageError(\n\t\t\t`Invalid minVersionForCollaboration: ${JSON.stringify(minVersionForCollaboration)}. Must be less than or equal to current version ${JSON.stringify(currentVersion)}.`,\n\t\t);\n\t}\n\n\tif (mode !== \"test\" && mode !== \"update\") {\n\t\tthrow new UsageError(\n\t\t\t`Invalid mode: ${JSON.stringify(mode)}. Must be either \"test\" or \"update\".`,\n\t\t);\n\t}\n\n\tconst currentEncodedForSnapshotting = exportCompatibilitySchemaSnapshot(currentViewSchema);\n\tconst snapshots = checker.readAllSchemaSnapshots();\n\n\tconst compatibilityErrors: string[] = [];\n\n\tfunction updatableError(message: string): void {\n\t\tassert(mode === \"test\", 0xcc6 /* updatableError should only be called in test mode */);\n\t\tcompatibilityErrors.push(\n\t\t\t`${message} If this is expected, checkSchemaCompatibilitySnapshots can be rerun in \"update\" mode to update the snapshot.`,\n\t\t);\n\t}\n\n\tif (snapshotUnchangedVersions === true) {\n\t\tif (mode === \"update\") {\n\t\t\tchecker.writeSchemaSnapshot(currentVersion, currentEncodedForSnapshotting);\n\t\t\tsnapshots.set(currentVersion, currentViewSchema);\n\t\t} else {\n\t\t\tconst currentRead = snapshots.get(currentVersion);\n\t\t\tif (currentRead === undefined) {\n\t\t\t\tupdatableError(\n\t\t\t\t\t`No snapshot found for version ${JSON.stringify(currentVersion)}: snapshotUnchangedVersions is true, so every version must be snapshotted.`,\n\t\t\t\t);\n\t\t\t} else if (\n\t\t\t\tJSON.stringify(exportCompatibilitySchemaSnapshot(currentRead)) !==\n\t\t\t\tJSON.stringify(currentEncodedForSnapshotting)\n\t\t\t) {\n\t\t\t\tupdatableError(\n\t\t\t\t\t`Snapshot for current version ${JSON.stringify(currentVersion)} is out of date.`,\n\t\t\t\t);\n\t\t\t}\n\t\t}\n\t} else {\n\t\tconst entries = [...snapshots];\n\t\tconst latestSnapshot = entries[entries.length - 1];\n\t\tif (latestSnapshot === undefined) {\n\t\t\tif (mode === \"update\") {\n\t\t\t\tchecker.writeSchemaSnapshot(currentVersion, currentEncodedForSnapshotting);\n\t\t\t\tsnapshots.set(currentVersion, currentViewSchema);\n\t\t\t} else {\n\t\t\t\tupdatableError(`No snapshots found.`);\n\t\t\t}\n\t\t} else {\n\t\t\tif (semver.lte(latestSnapshot[0], currentVersion)) {\n\t\t\t\t// Check to see if schema in snapshot is the same as the latest existing snapshot.\n\t\t\t\tconst oldString = JSON.stringify(exportCompatibilitySchemaSnapshot(latestSnapshot[1]));\n\t\t\t\tconst currentString = JSON.stringify(currentEncodedForSnapshotting);\n\t\t\t\tif (oldString !== currentString) {\n\t\t\t\t\t// Schema has changed: must create new snapshot.\n\t\t\t\t\tif (mode === \"update\") {\n\t\t\t\t\t\tchecker.writeSchemaSnapshot(currentVersion, currentEncodedForSnapshotting);\n\t\t\t\t\t\tsnapshots.set(currentVersion, currentViewSchema);\n\t\t\t\t\t} else {\n\t\t\t\t\t\tupdatableError(\n\t\t\t\t\t\t\t`Snapshot for current version ${JSON.stringify(currentVersion)} is out of date: schema has changed since latest existing snapshot version ${JSON.stringify(latestSnapshot[0])}.`,\n\t\t\t\t\t\t);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tthrow new UsageError(\n\t\t\t\t\t`Current version ${JSON.stringify(currentVersion)} is less than latest existing snapshot version ${JSON.stringify(latestSnapshot[0])}: version is expected to increase monotonically.`,\n\t\t\t\t);\n\t\t\t}\n\t\t}\n\t}\n\n\tconst compatibilityMap = transformMapValues(snapshots, (snapshot) =>\n\t\tgetCompatibility(currentViewSchema, snapshot),\n\t);\n\n\tlet selectedMinVersionForCollaborationSnapshot:\n\t\t| undefined\n\t\t| readonly [string, CombinedSchemaCompatibilityStatus];\n\n\tif (snapshotUnchangedVersions === true) {\n\t\tconst minSnapshot = compatibilityMap.get(minVersionForCollaboration);\n\t\tif (minSnapshot === undefined) {\n\t\t\tcompatibilityErrors.push(\n\t\t\t\t`Using snapshotUnchangedVersions: a snapshot of the exact minVersionForCollaboration ${JSON.stringify(minVersionForCollaboration)} is required. No snapshot found.`,\n\t\t\t);\n\t\t} else {\n\t\t\tselectedMinVersionForCollaborationSnapshot = [minVersionForCollaboration, minSnapshot];\n\t\t}\n\t} else {\n\t\tselectedMinVersionForCollaborationSnapshot = selectVersionRoundedDown(\n\t\t\tminVersionForCollaboration,\n\t\t\tcompatibilityMap,\n\t\t);\n\t\tif (selectedMinVersionForCollaborationSnapshot === undefined) {\n\t\t\tcompatibilityErrors.push(\n\t\t\t\t`No snapshot found with version less than or equal to minVersionForCollaboration ${JSON.stringify(minVersionForCollaboration)}.`,\n\t\t\t);\n\t\t}\n\t}\n\n\tfor (const [snapshotVersion, compatibility] of compatibilityMap) {\n\t\t// Current should be able to view all versions.\n\t\tif (!compatibility.currentViewOfSnapshotDocument.canUpgrade) {\n\t\t\tcompatibilityErrors.push(\n\t\t\t\t`Current version ${JSON.stringify(currentVersion)} cannot upgrade documents from ${JSON.stringify(snapshotVersion)}.`,\n\t\t\t);\n\t\t}\n\n\t\tif (semver.eq(snapshotVersion, currentVersion)) {\n\t\t\tif (currentVersion !== snapshotVersion) {\n\t\t\t\tthrow new UsageError(\n\t\t\t\t\t`Snapshot version ${JSON.stringify(snapshotVersion)} is semantically equal but not string equal to current version ${JSON.stringify(currentVersion)}: this is not supported.`,\n\t\t\t\t);\n\t\t\t}\n\t\t\tif (\n\t\t\t\tcompatibility.currentViewOfSnapshotDocument.isEquivalent === false ||\n\t\t\t\tcompatibility.snapshotViewOfCurrentDocument.isEquivalent === false\n\t\t\t) {\n\t\t\t\tcompatibilityErrors.push(\n\t\t\t\t\t`Current version ${JSON.stringify(snapshotVersion)} expected to be equivalent to its snapshot.`,\n\t\t\t\t);\n\t\t\t}\n\t\t} else if (semver.lt(snapshotVersion, currentVersion)) {\n\t\t\tif (selectedMinVersionForCollaborationSnapshot === undefined) {\n\t\t\t\tassert(\n\t\t\t\t\tcompatibilityErrors.length > 0,\n\t\t\t\t\t0xcc7 /* expected compatibility errors for missing min collab version snapshot */,\n\t\t\t\t);\n\t\t\t} else {\n\t\t\t\t// Collaboration with this version is expected to work.\n\t\t\t\tif (semver.gte(snapshotVersion, selectedMinVersionForCollaborationSnapshot[0])) {\n\t\t\t\t\t// Check that the historical version can view documents from the current version, since collaboration with this one is expected to work.\n\t\t\t\t\tif (!compatibility.snapshotViewOfCurrentDocument.canView) {\n\t\t\t\t\t\tconst message = `Historical version ${JSON.stringify(snapshotVersion)} cannot view documents from ${JSON.stringify(currentVersion)}: these versions are expected to be able to collaborate due to the selected minVersionForCollaboration snapshot version being ${JSON.stringify(selectedMinVersionForCollaborationSnapshot[0])}.`;\n\t\t\t\t\t\tcompatibilityErrors.push(\n\t\t\t\t\t\t\tselectedMinVersionForCollaborationSnapshot[0] === minVersionForCollaboration\n\t\t\t\t\t\t\t\t? message\n\t\t\t\t\t\t\t\t: `${message} The specified minVersionForCollaboration is ${JSON.stringify(minVersionForCollaboration)} which was rounded down to an existing snapshot.`,\n\t\t\t\t\t\t);\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\t// This is the case where the historical version is less than the minimum version for collaboration.\n\t\t\t\t\t// No additional validation is needed here currently, since forwards document compat from these versions is already tested above (since it applies to all snapshots).\n\t\t\t\t}\n\t\t\t}\n\t\t} else {\n\t\t\tthrow new UsageError(\n\t\t\t\t`Unexpected semver comparison result between snapshot version ${JSON.stringify(snapshotVersion)} and app version ${JSON.stringify(currentVersion)}.`,\n\t\t\t);\n\t\t}\n\t}\n\n\tif (compatibilityErrors.length > 0) {\n\t\tthrow new Error(\n\t\t\t`Schema compatibility check failed:\\n${compatibilityErrors\n\t\t\t\t.map((e) => ` - ${e}`)\n\t\t\t\t.join(\"\\n\")}`,\n\t\t);\n\t}\n}\n\n/**\n * The high-level API for checking snapshot compatibility and generating new snapshots.\n */\nexport class SnapshotCompatibilityChecker {\n\tpublic constructor(\n\t\t/**\n\t\t * Directory where historical schema snapshots are stored.\n\t\t */\n\t\tprivate readonly snapshotDirectory: string,\n\t\t/**\n\t\t * How the `snapshotDirectory` is accessed.\n\t\t */\n\t\tprivate readonly fileSystemMethods: SnapshotFileSystem,\n\t) {}\n\n\tpublic writeSchemaSnapshot(snapshotName: string, snapshot: JsonCompatibleReadOnly): void {\n\t\tconst fullPath = this.fileSystemMethods.join(\n\t\t\tthis.snapshotDirectory,\n\t\t\t`${snapshotName}.json`,\n\t\t);\n\t\tthis.ensureSnapshotDirectoryExists();\n\t\tthis.fileSystemMethods.writeFileSync(fullPath, JSON.stringify(snapshot, undefined, 2), {\n\t\t\tencoding: \"utf8\",\n\t\t});\n\t}\n\n\tpublic readSchemaSnapshot(snapshotName: string): TreeViewConfiguration {\n\t\tconst snapshot = this.readSchemaSnapshotRaw(snapshotName);\n\t\treturn importCompatibilitySchemaSnapshot(snapshot);\n\t}\n\n\tpublic readSchemaSnapshotRaw(snapshotName: string): JsonCompatibleReadOnly {\n\t\tconst fullPath = this.fileSystemMethods.join(\n\t\t\tthis.snapshotDirectory,\n\t\t\t`${snapshotName}.json`,\n\t\t);\n\t\tconst snapshot = JSON.parse(\n\t\t\tthis.fileSystemMethods.readFileSync(fullPath, \"utf8\"),\n\t\t) as JsonCompatibleReadOnly;\n\t\treturn snapshot;\n\t}\n\n\t/**\n\t * Returns all schema snapshots stored in the snapshot directory, sorted in order of increasing version.\n\t */\n\tpublic readAllSchemaSnapshots(): Map<string, TreeViewConfiguration> {\n\t\tthis.ensureSnapshotDirectoryExists();\n\t\tconst files = this.fileSystemMethods.readdirSync(this.snapshotDirectory);\n\t\tconst versions: string[] = [];\n\t\tfor (const file of files) {\n\t\t\tif (file.endsWith(\".json\")) {\n\t\t\t\tconst snapshotName = file.slice(0, \".json\".length * -1);\n\t\t\t\tversions.push(snapshotName);\n\t\t\t}\n\t\t}\n\t\t// Ensures that errors are in a consistent and friendly order, independent of file system order.\n\t\tversions.sort((a, b) => semver.compare(a, b));\n\n\t\tconst snapshots: Map<string, TreeViewConfiguration> = new Map();\n\t\tfor (const version of versions) {\n\t\t\tsnapshots.set(version, this.readSchemaSnapshot(version));\n\t\t}\n\t\treturn snapshots;\n\t}\n\n\tpublic ensureSnapshotDirectoryExists(): void {\n\t\tthis.fileSystemMethods.mkdirSync(this.snapshotDirectory, { recursive: true });\n\t}\n}\n\n/**\n * Gets the compatibility of the current view schema against a historical snapshot.\n * @param currentViewSchema - The current view schema.\n * @param previousViewSchema - The historical view schema.\n * @returns The combined compatibility status.\n */\nexport function getCompatibility(\n\tcurrentViewSchema: TreeViewConfiguration,\n\tpreviousViewSchema: TreeViewConfiguration,\n): CombinedSchemaCompatibilityStatus {\n\tconst backwardsCompatibilityStatus = checkCompatibility(\n\t\tpreviousViewSchema,\n\t\tcurrentViewSchema,\n\t);\n\n\tconst forwardsCompatibilityStatus = checkCompatibility(\n\t\tcurrentViewSchema,\n\t\tpreviousViewSchema,\n\t);\n\n\treturn {\n\t\tcurrentViewOfSnapshotDocument: backwardsCompatibilityStatus,\n\t\tsnapshotViewOfCurrentDocument: forwardsCompatibilityStatus,\n\t};\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"storedSchema.d.ts","sourceRoot":"","sources":["../../../src/simple-tree/api/storedSchema.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,8CAA8C,CAAC;
|
|
1
|
+
{"version":3,"file":"storedSchema.d.ts","sourceRoot":"","sources":["../../../src/simple-tree/api/storedSchema.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,8CAA8C,CAAC;AAE5F,OAAO,EAGN,KAAK,aAAa,EAClB,MAAM,sBAAsB,CAAC;AAO9B,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAC1D,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AACtD,OAAO,EAAwB,KAAK,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;AAKnF,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,WAAW,CAAC;AAE3D;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AACH,wBAAgB,sBAAsB,CACrC,MAAM,EAAE,mBAAmB,EAC3B,mBAAmB,EAAE,uBAAuB,EAC5C,aAAa,EAAE,CAAC,OAAO,EAAE,aAAa,KAAK,OAAO,GAChD,cAAc,CAIhB;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AACH,wBAAgB,sBAAsB,CACrC,SAAS,EAAE,cAAc,EACzB,IAAI,EAAE,mBAAmB,EACzB,OAAO,EAAE,aAAa,GACpB,IAAI,CAAC,yBAAyB,EAAE,eAAe,CAAC,CAalD"}
|