@fluidframework/tree 2.13.0 → 2.20.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +18 -0
- package/api-report/tree.alpha.api.md +22 -12
- package/api-report/tree.beta.api.md +9 -5
- package/api-report/tree.legacy.alpha.api.md +9 -5
- package/api-report/tree.legacy.public.api.md +9 -5
- package/api-report/tree.public.api.md +9 -5
- package/assertTagging.config.mjs +14 -0
- package/dist/alpha.d.ts +3 -0
- package/dist/core/index.d.ts +2 -2
- package/dist/core/index.d.ts.map +1 -1
- package/dist/core/index.js +6 -4
- package/dist/core/index.js.map +1 -1
- package/dist/core/rebase/index.d.ts +2 -2
- package/dist/core/rebase/index.d.ts.map +1 -1
- package/dist/core/rebase/index.js +5 -1
- package/dist/core/rebase/index.js.map +1 -1
- package/dist/core/rebase/types.d.ts +5 -4
- package/dist/core/rebase/types.d.ts.map +1 -1
- package/dist/core/rebase/types.js +29 -1
- package/dist/core/rebase/types.js.map +1 -1
- package/dist/core/rebase/utils.d.ts +10 -0
- package/dist/core/rebase/utils.d.ts.map +1 -1
- package/dist/core/rebase/utils.js +22 -1
- package/dist/core/rebase/utils.js.map +1 -1
- package/dist/core/tree/delta.d.ts +21 -26
- package/dist/core/tree/delta.d.ts.map +1 -1
- package/dist/core/tree/delta.js.map +1 -1
- package/dist/core/tree/deltaUtil.d.ts +1 -3
- package/dist/core/tree/deltaUtil.d.ts.map +1 -1
- package/dist/core/tree/deltaUtil.js +2 -14
- package/dist/core/tree/deltaUtil.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 +1 -3
- package/dist/core/tree/index.js.map +1 -1
- package/dist/core/tree/visitDelta.d.ts.map +1 -1
- package/dist/core/tree/visitDelta.js +82 -80
- package/dist/core/tree/visitDelta.js.map +1 -1
- package/dist/feature-libraries/default-schema/defaultFieldKinds.d.ts.map +1 -1
- package/dist/feature-libraries/default-schema/defaultFieldKinds.js.map +1 -1
- package/dist/feature-libraries/deltaUtils.d.ts.map +1 -1
- package/dist/feature-libraries/deltaUtils.js +13 -0
- package/dist/feature-libraries/deltaUtils.js.map +1 -1
- package/dist/feature-libraries/forest-summary/forestSummarizer.d.ts.map +1 -1
- package/dist/feature-libraries/forest-summary/forestSummarizer.js +1 -6
- package/dist/feature-libraries/forest-summary/forestSummarizer.js.map +1 -1
- package/dist/feature-libraries/modular-schema/crossFieldQueries.d.ts +5 -5
- package/dist/feature-libraries/modular-schema/crossFieldQueries.d.ts.map +1 -1
- package/dist/feature-libraries/modular-schema/crossFieldQueries.js +2 -9
- package/dist/feature-libraries/modular-schema/crossFieldQueries.js.map +1 -1
- package/dist/feature-libraries/modular-schema/fieldChangeHandler.d.ts +19 -2
- 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/genericFieldKind.d.ts.map +1 -1
- package/dist/feature-libraries/modular-schema/genericFieldKind.js.map +1 -1
- package/dist/feature-libraries/modular-schema/index.d.ts +2 -2
- package/dist/feature-libraries/modular-schema/index.d.ts.map +1 -1
- package/dist/feature-libraries/modular-schema/index.js.map +1 -1
- package/dist/feature-libraries/modular-schema/modularChangeCodecs.d.ts +1 -1
- package/dist/feature-libraries/modular-schema/modularChangeCodecs.d.ts.map +1 -1
- package/dist/feature-libraries/modular-schema/modularChangeCodecs.js +8 -8
- package/dist/feature-libraries/modular-schema/modularChangeCodecs.js.map +1 -1
- package/dist/feature-libraries/modular-schema/modularChangeFamily.d.ts +4 -4
- package/dist/feature-libraries/modular-schema/modularChangeFamily.d.ts.map +1 -1
- package/dist/feature-libraries/modular-schema/modularChangeFamily.js +105 -199
- package/dist/feature-libraries/modular-schema/modularChangeFamily.js.map +1 -1
- package/dist/feature-libraries/modular-schema/modularChangeTypes.d.ts +11 -20
- package/dist/feature-libraries/modular-schema/modularChangeTypes.d.ts.map +1 -1
- package/dist/feature-libraries/modular-schema/modularChangeTypes.js +20 -0
- package/dist/feature-libraries/modular-schema/modularChangeTypes.js.map +1 -1
- package/dist/feature-libraries/optional-field/optionalField.d.ts +3 -3
- package/dist/feature-libraries/optional-field/optionalField.d.ts.map +1 -1
- package/dist/feature-libraries/optional-field/optionalField.js.map +1 -1
- package/dist/feature-libraries/sequence-field/moveEffectTable.d.ts +1 -1
- package/dist/feature-libraries/sequence-field/moveEffectTable.d.ts.map +1 -1
- package/dist/feature-libraries/sequence-field/moveEffectTable.js.map +1 -1
- package/dist/feature-libraries/sequence-field/rebase.js +4 -4
- package/dist/feature-libraries/sequence-field/rebase.js.map +1 -1
- package/dist/feature-libraries/sequence-field/sequenceFieldCodecV1.js +1 -1
- package/dist/feature-libraries/sequence-field/sequenceFieldCodecV1.js.map +1 -1
- package/dist/feature-libraries/sequence-field/sequenceFieldCodecV2.js +1 -1
- package/dist/feature-libraries/sequence-field/sequenceFieldCodecV2.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.map +1 -1
- package/dist/feature-libraries/sequence-field/utils.js +36 -4
- package/dist/feature-libraries/sequence-field/utils.js.map +1 -1
- package/dist/feature-libraries/treeCursorUtils.d.ts.map +1 -1
- package/dist/feature-libraries/treeCursorUtils.js +4 -1
- package/dist/feature-libraries/treeCursorUtils.js.map +1 -1
- package/dist/index.d.ts +26 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +4 -2
- package/dist/index.js.map +1 -1
- package/dist/package.json +2 -1
- package/dist/packageVersion.d.ts +1 -1
- package/dist/packageVersion.js +1 -1
- package/dist/packageVersion.js.map +1 -1
- package/dist/shared-tree/index.d.ts +1 -1
- package/dist/shared-tree/index.d.ts.map +1 -1
- package/dist/shared-tree/index.js +4 -2
- package/dist/shared-tree/index.js.map +1 -1
- package/dist/shared-tree/sharedTree.d.ts +38 -18
- package/dist/shared-tree/sharedTree.d.ts.map +1 -1
- package/dist/shared-tree/sharedTree.js +38 -34
- package/dist/shared-tree/sharedTree.js.map +1 -1
- package/dist/shared-tree/treeCheckout.d.ts.map +1 -1
- package/dist/shared-tree/treeCheckout.js +12 -8
- package/dist/shared-tree/treeCheckout.js.map +1 -1
- package/dist/simple-tree/api/treeNodeApi.js +1 -1
- package/dist/simple-tree/api/treeNodeApi.js.map +1 -1
- package/dist/simple-tree/arrayNode.js +1 -1
- package/dist/simple-tree/arrayNode.js.map +1 -1
- package/dist/simple-tree/toMapTree.js +1 -1
- package/dist/simple-tree/toMapTree.js.map +1 -1
- package/dist/util/bTreeUtils.d.ts +10 -0
- package/dist/util/bTreeUtils.d.ts.map +1 -0
- package/dist/util/bTreeUtils.js +52 -0
- package/dist/util/bTreeUtils.js.map +1 -0
- package/dist/util/idAllocator.d.ts +0 -2
- package/dist/util/idAllocator.d.ts.map +1 -1
- package/dist/util/idAllocator.js +0 -2
- package/dist/util/idAllocator.js.map +1 -1
- package/dist/util/index.d.ts +2 -1
- package/dist/util/index.d.ts.map +1 -1
- package/dist/util/index.js +5 -1
- package/dist/util/index.js.map +1 -1
- package/dist/util/rangeMap.d.ts +52 -30
- package/dist/util/rangeMap.d.ts.map +1 -1
- package/dist/util/rangeMap.js +161 -117
- package/dist/util/rangeMap.js.map +1 -1
- package/dist/util/utils.d.ts +4 -1
- package/dist/util/utils.d.ts.map +1 -1
- package/dist/util/utils.js +7 -1
- package/dist/util/utils.js.map +1 -1
- package/lib/alpha.d.ts +3 -0
- package/lib/core/index.d.ts +2 -2
- 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/index.d.ts +2 -2
- package/lib/core/rebase/index.d.ts.map +1 -1
- package/lib/core/rebase/index.js +2 -2
- package/lib/core/rebase/index.js.map +1 -1
- package/lib/core/rebase/types.d.ts +5 -4
- package/lib/core/rebase/types.d.ts.map +1 -1
- package/lib/core/rebase/types.js +26 -1
- package/lib/core/rebase/types.js.map +1 -1
- package/lib/core/rebase/utils.d.ts +10 -0
- package/lib/core/rebase/utils.d.ts.map +1 -1
- package/lib/core/rebase/utils.js +20 -0
- package/lib/core/rebase/utils.js.map +1 -1
- package/lib/core/tree/delta.d.ts +21 -26
- package/lib/core/tree/delta.d.ts.map +1 -1
- package/lib/core/tree/delta.js.map +1 -1
- package/lib/core/tree/deltaUtil.d.ts +1 -3
- package/lib/core/tree/deltaUtil.d.ts.map +1 -1
- package/lib/core/tree/deltaUtil.js +1 -12
- package/lib/core/tree/deltaUtil.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/visitDelta.d.ts.map +1 -1
- package/lib/core/tree/visitDelta.js +82 -80
- package/lib/core/tree/visitDelta.js.map +1 -1
- package/lib/feature-libraries/default-schema/defaultFieldKinds.d.ts.map +1 -1
- package/lib/feature-libraries/default-schema/defaultFieldKinds.js.map +1 -1
- package/lib/feature-libraries/deltaUtils.d.ts.map +1 -1
- package/lib/feature-libraries/deltaUtils.js +13 -0
- package/lib/feature-libraries/deltaUtils.js.map +1 -1
- package/lib/feature-libraries/forest-summary/forestSummarizer.d.ts.map +1 -1
- package/lib/feature-libraries/forest-summary/forestSummarizer.js +1 -6
- package/lib/feature-libraries/forest-summary/forestSummarizer.js.map +1 -1
- package/lib/feature-libraries/modular-schema/crossFieldQueries.d.ts +5 -5
- package/lib/feature-libraries/modular-schema/crossFieldQueries.d.ts.map +1 -1
- package/lib/feature-libraries/modular-schema/crossFieldQueries.js +2 -9
- package/lib/feature-libraries/modular-schema/crossFieldQueries.js.map +1 -1
- package/lib/feature-libraries/modular-schema/fieldChangeHandler.d.ts +19 -2
- 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/genericFieldKind.d.ts.map +1 -1
- package/lib/feature-libraries/modular-schema/genericFieldKind.js.map +1 -1
- package/lib/feature-libraries/modular-schema/index.d.ts +2 -2
- package/lib/feature-libraries/modular-schema/index.d.ts.map +1 -1
- package/lib/feature-libraries/modular-schema/index.js.map +1 -1
- package/lib/feature-libraries/modular-schema/modularChangeCodecs.d.ts +1 -1
- package/lib/feature-libraries/modular-schema/modularChangeCodecs.d.ts.map +1 -1
- package/lib/feature-libraries/modular-schema/modularChangeCodecs.js +4 -4
- package/lib/feature-libraries/modular-schema/modularChangeCodecs.js.map +1 -1
- package/lib/feature-libraries/modular-schema/modularChangeFamily.d.ts +4 -4
- package/lib/feature-libraries/modular-schema/modularChangeFamily.d.ts.map +1 -1
- package/lib/feature-libraries/modular-schema/modularChangeFamily.js +74 -166
- package/lib/feature-libraries/modular-schema/modularChangeFamily.js.map +1 -1
- package/lib/feature-libraries/modular-schema/modularChangeTypes.d.ts +11 -20
- package/lib/feature-libraries/modular-schema/modularChangeTypes.d.ts.map +1 -1
- package/lib/feature-libraries/modular-schema/modularChangeTypes.js +18 -1
- package/lib/feature-libraries/modular-schema/modularChangeTypes.js.map +1 -1
- package/lib/feature-libraries/optional-field/optionalField.d.ts +3 -3
- package/lib/feature-libraries/optional-field/optionalField.d.ts.map +1 -1
- package/lib/feature-libraries/optional-field/optionalField.js.map +1 -1
- package/lib/feature-libraries/sequence-field/moveEffectTable.d.ts +1 -1
- package/lib/feature-libraries/sequence-field/moveEffectTable.d.ts.map +1 -1
- package/lib/feature-libraries/sequence-field/moveEffectTable.js.map +1 -1
- package/lib/feature-libraries/sequence-field/rebase.js +4 -4
- package/lib/feature-libraries/sequence-field/rebase.js.map +1 -1
- package/lib/feature-libraries/sequence-field/sequenceFieldCodecV1.js +1 -1
- package/lib/feature-libraries/sequence-field/sequenceFieldCodecV1.js.map +1 -1
- package/lib/feature-libraries/sequence-field/sequenceFieldCodecV2.js +1 -1
- package/lib/feature-libraries/sequence-field/sequenceFieldCodecV2.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.map +1 -1
- package/lib/feature-libraries/sequence-field/utils.js +36 -4
- package/lib/feature-libraries/sequence-field/utils.js.map +1 -1
- package/lib/feature-libraries/treeCursorUtils.d.ts.map +1 -1
- package/lib/feature-libraries/treeCursorUtils.js +4 -1
- package/lib/feature-libraries/treeCursorUtils.js.map +1 -1
- package/lib/index.d.ts +26 -2
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +1 -1
- package/lib/index.js.map +1 -1
- package/lib/packageVersion.d.ts +1 -1
- package/lib/packageVersion.js +1 -1
- package/lib/packageVersion.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 +1 -1
- package/lib/shared-tree/index.js.map +1 -1
- package/lib/shared-tree/sharedTree.d.ts +38 -18
- package/lib/shared-tree/sharedTree.d.ts.map +1 -1
- package/lib/shared-tree/sharedTree.js +37 -33
- package/lib/shared-tree/sharedTree.js.map +1 -1
- package/lib/shared-tree/treeCheckout.d.ts.map +1 -1
- package/lib/shared-tree/treeCheckout.js +13 -9
- package/lib/shared-tree/treeCheckout.js.map +1 -1
- package/lib/simple-tree/api/treeNodeApi.js +1 -1
- package/lib/simple-tree/api/treeNodeApi.js.map +1 -1
- package/lib/simple-tree/arrayNode.js +1 -1
- package/lib/simple-tree/arrayNode.js.map +1 -1
- package/lib/simple-tree/toMapTree.js +1 -1
- package/lib/simple-tree/toMapTree.js.map +1 -1
- package/lib/util/bTreeUtils.d.ts +10 -0
- package/lib/util/bTreeUtils.d.ts.map +1 -0
- package/lib/util/bTreeUtils.js +47 -0
- package/lib/util/bTreeUtils.js.map +1 -0
- package/lib/util/idAllocator.d.ts +0 -2
- package/lib/util/idAllocator.d.ts.map +1 -1
- package/lib/util/idAllocator.js +0 -2
- package/lib/util/idAllocator.js.map +1 -1
- package/lib/util/index.d.ts +2 -1
- package/lib/util/index.d.ts.map +1 -1
- package/lib/util/index.js +2 -1
- package/lib/util/index.js.map +1 -1
- package/lib/util/rangeMap.d.ts +52 -30
- package/lib/util/rangeMap.d.ts.map +1 -1
- package/lib/util/rangeMap.js +160 -117
- package/lib/util/rangeMap.js.map +1 -1
- package/lib/util/utils.d.ts +4 -1
- package/lib/util/utils.d.ts.map +1 -1
- package/lib/util/utils.js +7 -1
- package/lib/util/utils.js.map +1 -1
- package/package.json +23 -23
- package/src/core/index.ts +5 -2
- package/src/core/rebase/index.ts +5 -0
- package/src/core/rebase/types.ts +33 -5
- package/src/core/rebase/utils.ts +27 -0
- package/src/core/tree/delta.ts +21 -26
- package/src/core/tree/deltaUtil.ts +1 -16
- package/src/core/tree/index.ts +0 -2
- package/src/core/tree/visitDelta.ts +108 -97
- package/src/feature-libraries/default-schema/defaultFieldKinds.ts +2 -2
- package/src/feature-libraries/deltaUtils.ts +13 -0
- package/src/feature-libraries/forest-summary/forestSummarizer.ts +1 -6
- package/src/feature-libraries/modular-schema/crossFieldQueries.ts +12 -13
- package/src/feature-libraries/modular-schema/fieldChangeHandler.ts +21 -1
- package/src/feature-libraries/modular-schema/genericFieldKind.ts +2 -2
- package/src/feature-libraries/modular-schema/index.ts +2 -0
- package/src/feature-libraries/modular-schema/modularChangeCodecs.ts +12 -11
- package/src/feature-libraries/modular-schema/modularChangeFamily.ts +138 -225
- package/src/feature-libraries/modular-schema/modularChangeTypes.ts +40 -27
- package/src/feature-libraries/optional-field/optionalField.ts +3 -3
- package/src/feature-libraries/sequence-field/moveEffectTable.ts +1 -1
- package/src/feature-libraries/sequence-field/rebase.ts +9 -3
- package/src/feature-libraries/sequence-field/sequenceFieldCodecV1.ts +1 -1
- package/src/feature-libraries/sequence-field/sequenceFieldCodecV2.ts +1 -1
- package/src/feature-libraries/sequence-field/sequenceFieldToDelta.ts +3 -4
- package/src/feature-libraries/sequence-field/utils.ts +36 -4
- package/src/feature-libraries/treeCursorUtils.ts +6 -1
- package/src/index.ts +34 -6
- package/src/packageVersion.ts +1 -1
- package/src/shared-tree/index.ts +4 -1
- package/src/shared-tree/sharedTree.ts +60 -40
- package/src/shared-tree/treeCheckout.ts +19 -12
- package/src/simple-tree/api/treeNodeApi.ts +1 -1
- package/src/simple-tree/arrayNode.ts +1 -1
- package/src/simple-tree/toMapTree.ts +1 -1
- package/src/util/bTreeUtils.ts +60 -0
- package/src/util/idAllocator.ts +0 -2
- package/src/util/index.ts +3 -0
- package/src/util/rangeMap.ts +208 -143
- package/src/util/utils.ts +10 -3
- package/lib/package.json +0 -3
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../../src/feature-libraries/sequence-field/utils.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;;AAEH,kEAA8E;AAE9E,kDAQ6B;AAC7B,kDAAgE;AAChE,yDAKoC;AAQpC,yCAmBoB;AAEpB,SAAgB,OAAO,CAAC,MAAiB;IACxC,KAAK,MAAM,IAAI,IAAI,MAAM,EAAE,CAAC;QAC3B,IAAI,IAAI,CAAC,OAAO,KAAK,SAAS,IAAI,IAAI,CAAC,IAAI,KAAK,SAAS,EAAE,CAAC;YAC3D,OAAO,KAAK,CAAC;QACd,CAAC;IACF,CAAC;IACD,OAAO,IAAI,CAAC;AACb,CAAC;AAPD,0BAOC;AAED,SAAgB,WAAW;IAC1B,OAAO,EAAE,CAAC;AACX,CAAC;AAFD,kCAEC;AAED,SAAgB,gBAAgB,CAAC,MAAiB;IACjD,MAAM,MAAM,GAAyB,EAAE,CAAC;IACxC,IAAI,UAAU,GAAG,CAAC,CAAC;IACnB,IAAI,WAAW,GAAG,CAAC,CAAC;IACp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AAC,MAAiB;IAClD,MAAM,IAAI,GAAyB,EAAE,CAAC;IACtC,KAAK,MAAM,IAAI,IAAI,MAAM,EAAE,CAAC;QAC3B,IAAI,CAAC,IAAI,CAAC,GAAG,8BAA8B,CAAC,IAAI,EAAE,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC;IAChE,CAAC;IAED,OAAO,IAAI,CAAC;AACb,CAAC;AAPD,8CAOC;AAED,SAAS,8BAA8B,CACtC,MAAkB,EAClB,KAAa;IAEb,QAAQ,MAAM,CAAC,IAAI,EAAE,CAAC;QACrB,KAAK,QAAQ;YACZ,2FAA2F;YAC3F,mDAAmD;YACnD,OAAO;gBACN,CAAC,2BAAgB,CAAC,MAAM,EAAE,MAAM,CAAC,QAAQ,EAAE,MAAM,CAAC,EAAE,EAAE,KAAK,CAAC;gBAC5D,CAAC,2BAAgB,CAAC,WAAW,EAAE,MAAM,CAAC,QAAQ,EAAE,MAAM,CAAC,EAAE,EAAE,KAAK,CAAC;aACjE,CAAC;QACH,KAAK,SAAS;YACb,OAAO,CAAC,CAAC,2BAAgB,CAAC,MAAM,EAAE,MAAM,CAAC,QAAQ,EAAE,MAAM,CAAC,EAAE,EAAE,KAAK,CAAC,CAAC,CAAC;QACvE,KAAK,QAAQ;YACZ,OAAO,CAAC,CAAC,2BAAgB,CAAC,WAAW,EAAE,MAAM,CAAC,QAAQ,EAAE,MAAM,CAAC,EAAE,EAAE,KAAK,CAAC,CAAC,CAAC;QAC5E,KAAK,iBAAiB;YACrB,OAAO;gBACN,GAAG,8BAA8B,CAAC,MAAM,CAAC,MAAM,EAAE,KAAK,CAAC;gBACvD,GAAG,8BAA8B,CAAC,MAAM,CAAC,MAAM,EAAE,KAAK,CAAC;aACvD,CAAC;QACH;YACC,OAAO,EAAE,CAAC;IACZ,CAAC;AACF,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { assert, unreachableCase } from \"@fluidframework/core-utils/internal\";\n\nimport {\n\ttype ChangeAtomId,\n\ttype ChangesetLocalId,\n\ttype RevisionMetadataSource,\n\ttype RevisionTag,\n\tareEqualChangeAtomIdOpts,\n\tareEqualChangeAtomIds,\n\tmakeChangeAtomId,\n} from \"../../core/index.js\";\nimport { type Mutable, brand, fail } from \"../../util/index.js\";\nimport {\n\tCrossFieldTarget,\n\ttype NodeId,\n\ttype CrossFieldKeyRange,\n\ttype NestedChangesIndices,\n} from \"../modular-schema/index.js\";\n\nimport type {\n\tCellRename,\n\tDetachOfRemovedNodes,\n\tEmptyInputCellMark,\n\tMoveMarkEffect,\n} from \"./helperTypes.js\";\nimport {\n\ttype Attach,\n\ttype AttachAndDetach,\n\ttype CellId,\n\ttype CellMark,\n\ttype Changeset,\n\ttype Detach,\n\ttype DetachFields,\n\ttype HasRevisionTag,\n\ttype Insert,\n\ttype Mark,\n\ttype MarkEffect,\n\ttype MoveIn,\n\ttype MoveOut,\n\ttype NoopMark,\n\tNoopMarkType,\n\ttype Remove,\n\ttype CellCount,\n\ttype Rename,\n} from \"./types.js\";\n\nexport function isEmpty(change: Changeset): boolean {\n\tfor (const mark of change) {\n\t\tif (mark.changes !== undefined || mark.type !== undefined) {\n\t\t\treturn false;\n\t\t}\n\t}\n\treturn true;\n}\n\nexport function createEmpty(): Changeset {\n\treturn [];\n}\n\nexport function getNestedChanges(change: Changeset): NestedChangesIndices {\n\tconst output: NestedChangesIndices = [];\n\tlet inputIndex = 0;\n\tlet outputIndex = 0;\n\tfor (const mark of change) {\n\t\tconst { changes, count } = mark;\n\t\tif (changes !== undefined) {\n\t\t\toutput.push([\n\t\t\t\tchanges,\n\t\t\t\t!areInputCellsEmpty(mark) ? inputIndex : undefined /* inputIndex */,\n\t\t\t\t!areOutputCellsEmpty(mark) ? outputIndex : undefined /* outputIndex */,\n\t\t\t]);\n\t\t}\n\t\tif (!areInputCellsEmpty(mark)) {\n\t\t\tinputIndex += count;\n\t\t}\n\n\t\tif (!areOutputCellsEmpty(mark)) {\n\t\t\toutputIndex += count;\n\t\t}\n\t}\n\treturn output;\n}\n\nexport function isNewAttach(mark: Mark, revision?: RevisionTag): boolean {\n\treturn isNewAttachEffect(mark, mark.cellId, revision);\n}\n\nexport function isNewAttachEffect(\n\teffect: MarkEffect,\n\tcellId: CellId | undefined,\n\trevision?: RevisionTag,\n): boolean {\n\treturn (\n\t\t(isAttach(effect) &&\n\t\t\tcellId !== undefined &&\n\t\t\t(effect.revision ?? revision) === (cellId.revision ?? revision)) ||\n\t\t(isAttachAndDetachEffect(effect) && isNewAttachEffect(effect.attach, cellId, revision))\n\t);\n}\n\nexport function isRename(mark: MarkEffect): mark is Rename {\n\treturn mark.type === \"Rename\";\n}\n\nexport function isInsert(mark: MarkEffect): mark is Insert {\n\treturn mark.type === \"Insert\";\n}\n\nexport function isAttach(effect: MarkEffect): effect is Attach {\n\treturn effect.type === \"Insert\" || effect.type === \"MoveIn\";\n}\n\nexport function isReattach(mark: Mark): boolean {\n\treturn isReattachEffect(mark, mark.cellId);\n}\n\nexport function isReattachEffect(effect: MarkEffect, cellId: CellId | undefined): boolean {\n\treturn isAttach(effect) && !isNewAttachEffect(effect, cellId);\n}\n\nexport function isActiveReattach(\n\tmark: Mark,\n): mark is CellMark<Insert> & { conflictsWith?: undefined } {\n\treturn isAttach(mark) && isReattachEffect(mark, mark.cellId) && mark.cellId !== undefined;\n}\n\nexport function areEqualCellIds(a: CellId | undefined, b: CellId | undefined): boolean {\n\treturn areEqualChangeAtomIdOpts(a, b);\n}\n\nexport function getInputCellId(mark: Mark): CellId | undefined {\n\treturn mark.cellId;\n}\n\nexport function getOutputCellId(mark: Mark): CellId | undefined {\n\tif (isDetach(mark) || isRename(mark)) {\n\t\treturn getDetachOutputCellId(mark);\n\t} else if (markFillsCells(mark)) {\n\t\treturn undefined;\n\t} else if (isAttachAndDetachEffect(mark)) {\n\t\treturn getDetachOutputCellId(mark.detach);\n\t}\n\n\treturn getInputCellId(mark);\n}\n\nexport function cellSourcesFromMarks(\n\tmarks: readonly Mark[],\n\tcontextGetter: typeof getInputCellId | typeof getOutputCellId,\n): Set<RevisionTag | undefined> {\n\tconst set = new Set<RevisionTag | undefined>();\n\tfor (const mark of marks) {\n\t\tconst cell = contextGetter(mark);\n\t\tif (cell !== undefined) {\n\t\t\tset.add(cell.revision);\n\t\t}\n\t}\n\treturn set;\n}\n\nexport enum CellOrder {\n\tSameCell,\n\tOldThenNew,\n\tNewThenOld,\n}\n\n/**\n * Determines the order of two cells from two changesets.\n *\n * This function makes the following assumptions:\n * 1. The cells represent the same context.\n * 2. `oldMarkCell` is from a mark in a changeset that is older than the changeset that contains the mark that\n * `newMarkCell` is from.\n * 3. In terms of sequence index, all cells located before A are also located before B,\n * and all cells located before B are also located before A.\n * 4. If a changeset has a mark/tombstone that describes a cell named in some revision R,\n * then that changeset must contain marks/tombstones for all cells named in R as well as all cells named in later\n * revisions up to its own.\n * 5. If a changeset foo is rebased over a changeset bar, then the rebased version of foo must contain tombstones or\n * marks for all cells referenced or named in bar. It has yet to be determined whether this assumption is necessary\n * for the logic below.\n *\n * @param oldMarkCell - The cell referenced or named by a mark or tombstone from the older changeset.\n * @param newMarkCell - The cell referenced or named by a mark or tombstone from the newer changeset.\n * @param oldChangeKnowledge - The set of revisions that the older changeset has cell representations for.\n * @param newChangeKnowledge - The set of revisions that the newer changeset has cell representations for.\n * @param metadata - Revision metadata for the operation being carried out.\n * @returns a {@link CellOrder} which describes how the cells are ordered relative to one-another.\n */\nexport function compareCellPositionsUsingTombstones(\n\toldMarkCell: ChangeAtomId,\n\tnewMarkCell: ChangeAtomId,\n\toldChangeKnowledge: ReadonlySet<RevisionTag | undefined>,\n\tnewChangeKnowledge: ReadonlySet<RevisionTag | undefined>,\n\tmetadata: RevisionMetadataSource,\n): CellOrder {\n\tif (areEqualChangeAtomIds(oldMarkCell, newMarkCell)) {\n\t\treturn CellOrder.SameCell;\n\t}\n\tconst oldChangeKnowsOfNewMarkCellRevision = oldChangeKnowledge.has(newMarkCell.revision);\n\tconst newChangeKnowsOfOldMarkCellRevision = newChangeKnowledge.has(oldMarkCell.revision);\n\tif (oldChangeKnowsOfNewMarkCellRevision && newChangeKnowsOfOldMarkCellRevision) {\n\t\t// If both changesets know of both cells, but we've been asked to compare different cells,\n\t\t// Then either the changesets they originate from do not represent the same context,\n\t\t// or the ordering of their cells in inconsistent.\n\t\t// The only exception to this is when we're composing anonymous changesets in a transaction.\n\t\tassert(\n\t\t\toldMarkCell.revision === undefined && newMarkCell.revision === undefined,\n\t\t\t0x8a0 /* Inconsistent cell ordering */,\n\t\t);\n\t\t// We are composing anonymous changesets in a transaction. The new changeset is creating a cell in a gap\n\t\t// where the old changeset knows of some now empty cell. We order the new cell relative to the old cell in a\n\t\t// way that is consistent with its tie-breaking behavior should the old cell be concurrently re-filled.\n\t\t// Since only tie-break left is supported at the moment, the new cell comes first.\n\t\treturn CellOrder.NewThenOld;\n\t}\n\tif (newChangeKnowsOfOldMarkCellRevision) {\n\t\t// The changeset that contains `newMarkCell` has tombstones for the revision that created `oldMarkCell`,\n\t\t// so a tombstone/mark matching `oldMarkCell` must occur later in the newer changeset.\n\t\treturn CellOrder.NewThenOld;\n\t} else if (oldChangeKnowsOfNewMarkCellRevision) {\n\t\t// The changeset that contains `oldMarkCell` has tombstones for revision that created `newMarkCell`,\n\t\t// so a tombstone/mark matching `newMarkCell` must occur later in the older changeset.\n\t\treturn CellOrder.OldThenNew;\n\t} else {\n\t\t// These cells are only ordered through tie-breaking.\n\t\t// Since tie-breaking is hard-coded to \"merge left\", the younger cell comes first.\n\n\t\t// In the context of compose, an undefined revision means we are composing anonymous changesets into\n\t\t// a transaction, which means the cell from the newer changeset is younger.\n\t\tif (newMarkCell.revision === undefined) {\n\t\t\treturn CellOrder.NewThenOld;\n\t\t}\n\t\t// The only case where the old mark cell should have no revision is when composing anonymous changesets\n\t\t// into a transaction, in which case the new mark cell should also have no revision, which is handled above.\n\t\t// In all other cases, the old mark cell should have a revision.\n\t\tassert(\n\t\t\toldMarkCell.revision !== undefined,\n\t\t\t0x8a1 /* Old mark cell should have a revision */,\n\t\t);\n\n\t\t// Note that these indices are for ordering the revisions in which the cells were named, not the revisions\n\t\t// of the changesets in which the marks targeting these cells appear.\n\t\tconst oldCellRevisionIndex = metadata.getIndex(oldMarkCell.revision);\n\t\tconst newCellRevisionIndex = metadata.getIndex(newMarkCell.revision);\n\n\t\t// If the metadata defines an ordering for the revisions then the cell from the newer revision comes first.\n\t\tif (newCellRevisionIndex !== undefined && oldCellRevisionIndex !== undefined) {\n\t\t\treturn newCellRevisionIndex > oldCellRevisionIndex\n\t\t\t\t? CellOrder.NewThenOld\n\t\t\t\t: CellOrder.OldThenNew;\n\t\t}\n\n\t\tif (newCellRevisionIndex === undefined && oldCellRevisionIndex === undefined) {\n\t\t\t// While it is possible for both marks to refer to cells that were named in revisions that are outside\n\t\t\t// the scope of the metadata, such a scenario should be handled above due to the fact that one of the two\n\t\t\t// changesets should have tombstones or marks for both cells.\n\t\t\t//\n\t\t\t// To see this in the context of rebase, we must consider the lowest common ancestor (LCA) of each change's\n\t\t\t// original (i.e., unrebased) edit with the head of the branch they will both reside on after the rebase.\n\t\t\t// ...─(Ti)─...─(Tj)─...─(old')─(new') <- branch both change will reside on after rebase\n\t\t\t// | └─...─(new)\n\t\t\t// └─...─(old)\n\t\t\t// In the diagram above we can see that by the time `new` is being rebased over `old`, both changesets have\n\t\t\t// been rebased over, and therefore have cell information for, changes `Tj` onwards. This means that one of\n\t\t\t// The two changesets (the `old` one in the diagram above) will have tombstones or marks for any cells that\n\t\t\t// `new` refers to so long as those cells were not created on `new`'s branch.\n\t\t\t// Note that the change that contains the superset of cells (again, ignoring cells created on the other\n\t\t\t// change's branch) is not always the older change. Consider the following scenario:\n\t\t\t// ...─(Ti)─...─(Tj)─...─(old')─(new')\n\t\t\t// | └─...─(old)\n\t\t\t// └─...─(new)\n\t\t\t//\n\t\t\t// The same scenario can arise in the context of compose (just consider composing `old'` and `new'` from\n\t\t\t// the examples above) with the same resolution.\n\t\t\tassert(false, 0x8a2 /* Invalid cell ordering scenario */);\n\t\t}\n\n\t\t// The absence of metadata for a cell with a defined revision means that the cell is from a revision that\n\t\t// predates the edits that are within the scope of the metadata. Such a cell is therefore older than the one\n\t\t// for which we do have metadata.\n\t\treturn oldCellRevisionIndex === undefined ? CellOrder.NewThenOld : CellOrder.OldThenNew;\n\t}\n}\n\n/**\n * @returns the ID of the cell in the output context of the given detach `mark`.\n */\nexport function getDetachOutputCellId(mark: Detach | Rename): ChangeAtomId {\n\tif (isRename(mark)) {\n\t\treturn mark.idOverride;\n\t}\n\tif (mark.idOverride !== undefined) {\n\t\treturn mark.idOverride;\n\t}\n\treturn mark.revision === undefined\n\t\t? { localId: mark.id }\n\t\t: { revision: mark.revision, localId: mark.id };\n}\n\n/**\n * @returns the ID of the detached node in the output context of the given detach `mark`.\n */\nexport function getDetachedNodeId(mark: Detach | Rename): ChangeAtomId {\n\tswitch (mark.type) {\n\t\tcase \"Rename\":\n\t\tcase \"Remove\": {\n\t\t\treturn getDetachOutputCellId(mark);\n\t\t}\n\t\tcase \"MoveOut\": {\n\t\t\treturn makeChangeAtomId(mark.id, mark.revision);\n\t\t}\n\t\tdefault:\n\t\t\tunreachableCase(mark);\n\t}\n}\n\n/**\n * Preserves the semantics of the given `mark` but repackages it into a `DetachOfRemovedNodes` when possible.\n */\nexport function normalizeCellRename(\n\tcellId: CellId,\n\tcount: CellCount,\n\tattach: Attach,\n\tdetach: Detach,\n): CellMark<AttachAndDetach | DetachOfRemovedNodes | Rename | NoopMark> {\n\tif (attach.type === \"MoveIn\") {\n\t\tif (detach.type === \"MoveOut\") {\n\t\t\tconst outputId = getDetachOutputCellId(detach);\n\t\t\t// Note that the output ID may be the same as the cellId. In such a scenario,\n\t\t\t// we output an (impact-less) Rename mark anyway (as opposed to a Skip)\n\t\t\t// because the resulting Rename may be rebased over other changes that rename the input cell,\n\t\t\t// eventually leading to an impactful rename.\n\t\t\treturn {\n\t\t\t\ttype: \"Rename\",\n\t\t\t\tcount,\n\t\t\t\tcellId,\n\t\t\t\tidOverride: outputId,\n\t\t\t};\n\t\t}\n\t} else {\n\t\t// Normalization: when the attach is an insert/revive, we rely on the implicit reviving semantics of the\n\t\t// detach instead of using an explicit revive effect in an AttachAndDetach\n\t\treturn {\n\t\t\t...detach,\n\t\t\tcount,\n\t\t\tcellId,\n\t\t};\n\t}\n\treturn {\n\t\ttype: \"AttachAndDetach\",\n\t\tattach,\n\t\tdetach,\n\t\tcount,\n\t\tcellId,\n\t};\n}\n\n/**\n * Preserves the semantics of the given `mark` but repackages it into an `AttachAndDetach` mark if it is not already one.\n */\nexport function asAttachAndDetach(mark: CellMark<CellRename>): CellMark<AttachAndDetach> {\n\tif (mark.type === \"AttachAndDetach\") {\n\t\treturn mark;\n\t}\n\tconst { cellId, count, changes, revision, ...effect } = mark;\n\tconst attachAndDetach: CellMark<AttachAndDetach | Detach> = {\n\t\ttype: \"AttachAndDetach\",\n\t\tcount,\n\t\tcellId,\n\t\tattach: {\n\t\t\ttype: \"Insert\",\n\t\t\tid: mark.id,\n\t\t},\n\t\tdetach: effect,\n\t};\n\tif (changes !== undefined) {\n\t\tattachAndDetach.changes = changes;\n\t}\n\tif (revision !== undefined) {\n\t\tattachAndDetach.attach.revision = revision;\n\t\tattachAndDetach.detach.revision = revision;\n\t}\n\treturn attachAndDetach;\n}\n\nexport function cloneMark<TMark extends Mark>(mark: TMark): TMark {\n\tconst clone: TMark = { ...cloneMarkEffect(mark), count: mark.count };\n\n\tif (mark.cellId !== undefined) {\n\t\tclone.cellId = cloneCellId(mark.cellId);\n\t}\n\treturn clone;\n}\n\nexport function cloneMarkEffect<TEffect extends MarkEffect>(effect: TEffect): TEffect {\n\tconst clone = { ...effect };\n\tif (clone.type === \"AttachAndDetach\") {\n\t\tclone.attach = cloneMarkEffect(clone.attach);\n\t\tclone.detach = cloneMarkEffect(clone.detach);\n\t}\n\treturn clone;\n}\n\nexport function cloneCellId(id: CellId): CellId {\n\tconst cloned = { ...id };\n\treturn cloned;\n}\n\n/**\n * @param mark - The mark to get the length of.\n * @param ignorePairing - When true, the length of a paired mark (e.g. MoveIn/MoveOut) whose matching mark is not active\n * will be treated the same as if the matching mark were active.\n * @returns The number of nodes within the output context of the mark.\n */\nexport function getOutputLength(mark: Mark, ignorePairing: boolean = false): number {\n\treturn areOutputCellsEmpty(mark) ? 0 : mark.count;\n}\n\n/**\n * @param mark - The mark to get the length of.\n * @returns The number of nodes within the input context of the mark.\n */\nexport function getInputLength(mark: Mark): number {\n\treturn areInputCellsEmpty(mark) ? 0 : mark.count;\n}\n\nexport function markEmptiesCells(mark: Mark): boolean {\n\treturn !areInputCellsEmpty(mark) && areOutputCellsEmpty(mark);\n}\n\nexport function markFillsCells(mark: Mark): boolean {\n\treturn areInputCellsEmpty(mark) && !areOutputCellsEmpty(mark);\n}\n\nexport function markHasCellEffect(mark: Mark): boolean {\n\treturn areInputCellsEmpty(mark) !== areOutputCellsEmpty(mark);\n}\n\nexport function isAttachAndDetachEffect(effect: MarkEffect): effect is AttachAndDetach {\n\treturn effect.type === \"AttachAndDetach\";\n}\n\nexport function isDetachOfRemovedNodes(mark: Mark): mark is CellMark<DetachOfRemovedNodes> {\n\treturn isDetach(mark) && mark.cellId !== undefined;\n}\n\nexport function isImpactfulCellRename(mark: Mark): mark is CellMark<CellRename> {\n\treturn (isAttachAndDetachEffect(mark) || isDetachOfRemovedNodes(mark)) && isImpactful(mark);\n}\n\nexport function areInputCellsEmpty(mark: Mark): mark is EmptyInputCellMark {\n\treturn mark.cellId !== undefined;\n}\n\nexport function areOutputCellsEmpty(mark: Mark): boolean {\n\tconst type = mark.type;\n\tswitch (type) {\n\t\tcase NoopMarkType:\n\t\t\treturn mark.cellId !== undefined;\n\t\tcase \"Remove\":\n\t\tcase \"Rename\":\n\t\tcase \"MoveOut\":\n\t\tcase \"AttachAndDetach\":\n\t\t\treturn true;\n\t\tcase \"MoveIn\":\n\t\tcase \"Insert\":\n\t\t\treturn false;\n\t\tdefault:\n\t\t\tunreachableCase(type);\n\t}\n}\n\n/**\n * Creates a mark that is equivalent to the given `mark` but with effects removed if those have no impact in the input\n * context of that mark.\n *\n * @param mark - The mark to settle. Never mutated.\n * @returns either the original mark or a shallow clone of it with effects stripped out.\n */\nexport function settleMark(mark: Mark): Mark {\n\tif (isImpactful(mark)) {\n\t\treturn mark;\n\t}\n\treturn omitMarkEffect(mark);\n}\n\n/**\n * @returns true, iff the given `mark` would have impact on the field when applied.\n * Ignores the impact of nested changes.\n * CellRename effects are considered impactful if they actually change the ID of the cells.\n */\nexport function isImpactful(mark: Mark): boolean {\n\tconst type = mark.type;\n\tswitch (type) {\n\t\tcase NoopMarkType:\n\t\t\treturn false;\n\t\tcase \"Rename\":\n\t\t\treturn true;\n\t\tcase \"Remove\": {\n\t\t\tconst inputId = getInputCellId(mark);\n\t\t\tif (inputId === undefined) {\n\t\t\t\treturn true;\n\t\t\t}\n\t\t\tconst outputId = getOutputCellId(mark);\n\t\t\tassert(outputId !== undefined, 0x824 /* Remove marks must have an output cell ID */);\n\t\t\treturn !areEqualChangeAtomIds(inputId, outputId);\n\t\t}\n\t\tcase \"AttachAndDetach\":\n\t\tcase \"MoveOut\":\n\t\t\treturn true;\n\t\tcase \"MoveIn\":\n\t\t\t// MoveIn marks always target an empty cell.\n\t\t\tassert(mark.cellId !== undefined, 0x825 /* MoveIn marks should target empty cells */);\n\t\t\treturn true;\n\t\tcase \"Insert\":\n\t\t\t// A Revive has no impact if the nodes are already in the document.\n\t\t\treturn mark.cellId !== undefined;\n\t\tdefault:\n\t\t\tunreachableCase(type);\n\t}\n}\n\nexport function isTombstone(mark: Mark): mark is CellMark<NoopMark> & { cellId: CellId } {\n\treturn mark.type === NoopMarkType && mark.cellId !== undefined && mark.changes === undefined;\n}\n\nexport function isNoopMark(mark: Mark): mark is CellMark<NoopMark> {\n\treturn mark.type === NoopMarkType;\n}\n\nexport function areOverlappingIdRanges(\n\tid1: ChangesetLocalId,\n\tcount1: number,\n\tid2: ChangesetLocalId,\n\tcount2: number,\n): boolean {\n\tconst lastId1 = (id1 as number) + count1 - 1;\n\tconst lastId2 = (id2 as number) + count2 - 1;\n\treturn (id2 <= id1 && id1 <= lastId2) || (id1 <= id2 && id2 <= lastId1);\n}\n\nexport function compareCellsFromSameRevision(\n\tcell1: CellId,\n\tcount1: number,\n\tcell2: CellId,\n\tcount2: number,\n): number | undefined {\n\tassert(\n\t\tcell1.revision === cell2.revision,\n\t\t0x85b /* Expected cells to have the same revision */,\n\t);\n\tif (areOverlappingIdRanges(cell1.localId, count1, cell2.localId, count2)) {\n\t\treturn cell1.localId - cell2.localId;\n\t}\n\treturn undefined;\n}\n\nexport function isDetach(mark: MarkEffect | undefined): mark is Detach {\n\tconst type = mark?.type;\n\treturn type === \"Remove\" || type === \"MoveOut\";\n}\n\nexport function isRemoveMark(mark: Mark | undefined): mark is CellMark<Remove> {\n\treturn mark?.type === \"Remove\";\n}\n\nfunction areMergeableChangeAtoms(\n\tlhs: ChangeAtomId | undefined,\n\tlhsCount: number,\n\trhs: ChangeAtomId | undefined,\n): boolean {\n\tif (lhs === undefined || rhs === undefined) {\n\t\treturn lhs === undefined && rhs === undefined;\n\t}\n\n\treturn (\n\t\tlhs.revision === rhs.revision && areAdjacentIdRanges(lhs.localId, lhsCount, rhs.localId)\n\t);\n}\n\nfunction areAdjacentIdRanges(\n\tfirstStart: ChangesetLocalId,\n\tfirstLength: number,\n\tsecondStart: ChangesetLocalId,\n): boolean {\n\treturn (firstStart as number) + firstLength === secondStart;\n}\n\nfunction haveMergeableIdOverrides(\n\tlhs: DetachFields,\n\tlhsCount: number,\n\trhs: DetachFields,\n): boolean {\n\tif (lhs.idOverride !== undefined && rhs.idOverride !== undefined) {\n\t\treturn areMergeableCellIds(lhs.idOverride, lhsCount, rhs.idOverride);\n\t}\n\treturn (lhs.idOverride === undefined) === (rhs.idOverride === undefined);\n}\n\nfunction areMergeableCellIds(\n\tlhs: CellId | undefined,\n\tlhsCount: number,\n\trhs: CellId | undefined,\n): boolean {\n\treturn areMergeableChangeAtoms(lhs, lhsCount, rhs);\n}\n\n/**\n * Attempts to extend `lhs` to include the effects of `rhs`.\n * @param lhs - The mark to extend.\n * @param rhs - The effect so extend `rhs` with.\n * @returns `lhs` iff the function was able to mutate `lhs` to include the effects of `rhs`.\n * When `undefined` is returned, `lhs` is left untouched.\n */\nexport function tryMergeMarks(lhs: Mark, rhs: Readonly<Mark>): Mark | undefined {\n\tif (rhs.type !== lhs.type) {\n\t\treturn undefined;\n\t}\n\n\tif (!areMergeableCellIds(lhs.cellId, lhs.count, rhs.cellId)) {\n\t\treturn undefined;\n\t}\n\n\tif (rhs.changes !== undefined || lhs.changes !== undefined) {\n\t\treturn undefined;\n\t}\n\n\tconst mergedEffect = tryMergeEffects(lhs, rhs, lhs.count);\n\tif (mergedEffect === undefined) {\n\t\treturn undefined;\n\t}\n\n\treturn { ...lhs, ...mergedEffect, count: lhs.count + rhs.count };\n}\n\nfunction tryMergeEffects(\n\tlhs: MarkEffect,\n\trhs: MarkEffect,\n\tlhsCount: number,\n): MarkEffect | undefined {\n\tif (lhs.type !== rhs.type) {\n\t\treturn undefined;\n\t}\n\n\tif (rhs.type === NoopMarkType) {\n\t\treturn lhs;\n\t}\n\n\tif (rhs.type === \"AttachAndDetach\") {\n\t\tconst lhsAttachAndDetach = lhs as AttachAndDetach;\n\t\tconst attach = tryMergeEffects(lhsAttachAndDetach.attach, rhs.attach, lhsCount);\n\t\tconst detach = tryMergeEffects(lhsAttachAndDetach.detach, rhs.detach, lhsCount);\n\t\tif (attach === undefined || detach === undefined) {\n\t\t\treturn undefined;\n\t\t}\n\n\t\tassert(\n\t\t\tisAttach(attach) && isDetach(detach),\n\t\t\t0x826 /* Merged marks should be same type as input marks */,\n\t\t);\n\t\treturn { ...lhsAttachAndDetach, attach, detach };\n\t}\n\n\tif (\n\t\t(lhs as Partial<HasRevisionTag>).revision !== (rhs as Partial<HasRevisionTag>).revision\n\t) {\n\t\treturn undefined;\n\t}\n\n\tif (isDetach(lhs) && isDetach(rhs) && !haveMergeableIdOverrides(lhs, lhsCount, rhs)) {\n\t\treturn undefined;\n\t}\n\n\tconst type = rhs.type;\n\tswitch (type) {\n\t\tcase \"MoveIn\": {\n\t\t\tconst lhsMoveIn = lhs as MoveIn;\n\t\t\tif (\n\t\t\t\t(lhsMoveIn.id as number) + lhsCount === rhs.id &&\n\t\t\t\tareMergeableChangeAtoms(lhsMoveIn.finalEndpoint, lhsCount, rhs.finalEndpoint)\n\t\t\t) {\n\t\t\t\treturn lhsMoveIn;\n\t\t\t}\n\t\t\tbreak;\n\t\t}\n\t\tcase \"Remove\": {\n\t\t\tconst lhsDetach = lhs as Remove;\n\t\t\tif (\n\t\t\t\t(lhsDetach.id as number) + lhsCount === rhs.id &&\n\t\t\t\thaveMergeableIdOverrides(lhsDetach, lhsCount, rhs)\n\t\t\t) {\n\t\t\t\treturn lhsDetach;\n\t\t\t}\n\t\t\tbreak;\n\t\t}\n\t\tcase \"Rename\": {\n\t\t\tconst lhsDetach = lhs as Rename;\n\t\t\tif (haveMergeableIdOverrides(lhsDetach, lhsCount, rhs)) {\n\t\t\t\treturn lhsDetach;\n\t\t\t}\n\t\t\tbreak;\n\t\t}\n\t\tcase \"MoveOut\": {\n\t\t\tconst lhsMoveOut = lhs as MoveOut;\n\t\t\tif (\n\t\t\t\t(lhsMoveOut.id as number) + lhsCount === rhs.id &&\n\t\t\t\thaveMergeableIdOverrides(lhsMoveOut, lhsCount, rhs) &&\n\t\t\t\tareMergeableChangeAtoms(lhsMoveOut.finalEndpoint, lhsCount, rhs.finalEndpoint)\n\t\t\t) {\n\t\t\t\treturn lhsMoveOut;\n\t\t\t}\n\t\t\tbreak;\n\t\t}\n\t\tcase \"Insert\": {\n\t\t\tconst lhsInsert = lhs as Insert;\n\t\t\tif ((lhsInsert.id as number) + lhsCount === rhs.id) {\n\t\t\t\treturn lhsInsert;\n\t\t\t}\n\t\t\tbreak;\n\t\t}\n\t\tdefault:\n\t\t\tunreachableCase(type);\n\t}\n\n\treturn undefined;\n}\n\n/**\n * Splits the `mark` into two marks such that the first returned mark has length `length`.\n * @param mark - The mark to split.\n * @param revision - The revision of the changeset the mark is part of.\n * @param length - The desired length for the first of the two returned marks.\n * @param genId - An ID allocator\n * @param moveEffects - The table in which to record splitting of move marks\n * @param recordMoveEffect - Whether when splitting a move an entry should be added to `moveEffects` indicating that the mark should be split (in case we process this mark again).\n * An entry is always added to `moveEffects` indicating that the opposite end of the move should be split.\n * @returns A pair of marks equivalent to the original `mark`\n * such that the first returned mark has input length `length`.\n */\nexport function splitMark<TMark extends Mark>(mark: TMark, length: number): [TMark, TMark] {\n\tconst markLength = mark.count;\n\tconst remainder = markLength - length;\n\tif (length < 1 || remainder < 1) {\n\t\tfail(\"Unable to split mark due to lengths\");\n\t}\n\n\tconst [effect1, effect2] = splitMarkEffect(mark, length);\n\tconst mark1 = { ...mark, ...effect1, count: length };\n\tconst mark2 = { ...mark, ...effect2, count: remainder };\n\tif (mark2.cellId !== undefined) {\n\t\tmark2.cellId = splitDetachEvent(mark2.cellId, length);\n\t}\n\n\treturn [mark1, mark2];\n}\n\nexport function splitMarkEffect<TEffect extends MarkEffect>(\n\teffect: TEffect,\n\tlength: number,\n): [TEffect, TEffect] {\n\tconst type = effect.type;\n\tswitch (type) {\n\t\tcase NoopMarkType:\n\t\t\treturn [effect, effect];\n\t\tcase \"Insert\": {\n\t\t\tconst effect1: TEffect = {\n\t\t\t\t...effect,\n\t\t\t};\n\t\t\tconst effect2: TEffect = {\n\t\t\t\t...effect,\n\t\t\t\tid: (effect.id as number) + length,\n\t\t\t};\n\t\t\treturn [effect1, effect2];\n\t\t}\n\t\tcase \"MoveIn\": {\n\t\t\tconst effect2: TEffect = { ...effect, id: (effect.id as number) + length };\n\t\t\tconst move2 = effect2 as MoveIn;\n\t\t\tif (move2.finalEndpoint !== undefined) {\n\t\t\t\tmove2.finalEndpoint = splitDetachEvent(move2.finalEndpoint, length);\n\t\t\t}\n\t\t\treturn [effect, effect2];\n\t\t}\n\t\tcase \"Remove\": {\n\t\t\tconst effect1 = { ...effect };\n\t\t\tconst id2: ChangesetLocalId = brand((effect.id as number) + length);\n\t\t\tconst effect2 = { ...effect, id: id2 };\n\t\t\tconst effect2Remove = effect2 as Mutable<Remove>;\n\t\t\tif (effect2Remove.idOverride !== undefined) {\n\t\t\t\teffect2Remove.idOverride = splitDetachEvent(effect2Remove.idOverride, length);\n\t\t\t}\n\t\t\treturn [effect1, effect2];\n\t\t}\n\t\tcase \"Rename\": {\n\t\t\tconst effect1 = { ...effect };\n\t\t\tconst effect2 = { ...effect };\n\t\t\tconst effect2Rename = effect2 as Mutable<Rename>;\n\t\t\tif (effect2Rename.idOverride !== undefined) {\n\t\t\t\teffect2Rename.idOverride = splitDetachEvent(effect2Rename.idOverride, length);\n\t\t\t}\n\t\t\treturn [effect1, effect2];\n\t\t}\n\t\tcase \"MoveOut\": {\n\t\t\tconst effect2 = {\n\t\t\t\t...effect,\n\t\t\t\tid: (effect.id as number) + length,\n\t\t\t};\n\n\t\t\tconst return2 = effect2 as Mutable<MoveOut>;\n\n\t\t\tif (return2.idOverride !== undefined) {\n\t\t\t\treturn2.idOverride = splitDetachEvent(return2.idOverride, length);\n\t\t\t}\n\n\t\t\tif (return2.finalEndpoint !== undefined) {\n\t\t\t\treturn2.finalEndpoint = splitDetachEvent(return2.finalEndpoint, length);\n\t\t\t}\n\t\t\treturn [effect, effect2];\n\t\t}\n\t\tcase \"AttachAndDetach\": {\n\t\t\tconst [attach1, attach2] = splitMarkEffect(effect.attach, length);\n\t\t\tconst [detach1, detach2] = splitMarkEffect(effect.detach, length);\n\t\t\tconst effect1 = {\n\t\t\t\t...effect,\n\t\t\t\tattach: attach1,\n\t\t\t\tdetach: detach1,\n\t\t\t};\n\n\t\t\tconst effect2 = {\n\t\t\t\t...effect,\n\t\t\t\tattach: attach2,\n\t\t\t\tdetach: detach2,\n\t\t\t};\n\n\t\t\treturn [effect1, effect2];\n\t\t}\n\t\tdefault:\n\t\t\tunreachableCase(type);\n\t}\n}\n\nfunction splitDetachEvent(detachEvent: CellId, length: number): CellId {\n\treturn { ...detachEvent, localId: brand((detachEvent.localId as number) + length) };\n}\n\n// TODO: Refactor MarkEffect into a field of CellMark so this function isn't necessary.\nexport function extractMarkEffect<TEffect extends MarkEffect>(\n\tmark: CellMark<TEffect>,\n): TEffect {\n\tconst { cellId: _cellId, count: _count, changes: _changes, ...effect } = mark;\n\treturn effect as unknown as TEffect;\n}\n\n// TODO: Refactor MarkEffect into a field of CellMark so this function isn't necessary.\nexport function omitMarkEffect(mark: CellMark<unknown>): CellMark<NoopMark> {\n\tconst { cellId, count, changes } = mark;\n\tconst noopMark: CellMark<NoopMark> = { count };\n\tif (cellId !== undefined) {\n\t\tnoopMark.cellId = cellId;\n\t}\n\tif (changes !== undefined) {\n\t\tnoopMark.changes = changes;\n\t}\n\treturn noopMark;\n}\n\nexport function withNodeChange<TMark extends CellMark<TKind>, TKind extends MarkEffect>(\n\tmark: TMark,\n\tchanges: NodeId | undefined,\n): TMark {\n\tconst newMark = { ...mark };\n\tif (changes !== undefined) {\n\t\tnewMark.changes = changes;\n\t} else {\n\t\tdelete newMark.changes;\n\t}\n\treturn newMark;\n}\n\nexport function withRevision<TMark extends Mark>(\n\tmark: TMark,\n\trevision: RevisionTag | undefined,\n): TMark {\n\tif (revision === undefined) {\n\t\treturn mark;\n\t}\n\n\tconst cloned = cloneMark(mark);\n\taddRevision(cloned, revision);\n\tif (\n\t\tcloned.cellId !== undefined &&\n\t\tcloned.cellId.revision === undefined &&\n\t\trevision !== undefined\n\t) {\n\t\t(cloned.cellId as Mutable<CellId>).revision = revision;\n\t}\n\treturn cloned;\n}\n\nfunction addRevision(effect: MarkEffect, revision: RevisionTag): void {\n\tif (effect.type === NoopMarkType || isRename(effect)) {\n\t\treturn;\n\t}\n\n\tif (effect.type === \"AttachAndDetach\") {\n\t\taddRevision(effect.attach, revision);\n\t\taddRevision(effect.detach, revision);\n\t\treturn;\n\t}\n\n\tassert(\n\t\teffect.revision === undefined || effect.revision === revision,\n\t\t0x829 /* Should not overwrite mark revision */,\n\t);\n\teffect.revision = revision;\n}\n\nexport function getEndpoint(effect: MoveMarkEffect): ChangeAtomId {\n\treturn effect.finalEndpoint ?? { revision: effect.revision, localId: effect.id };\n}\n\nexport function getCrossFieldKeys(change: Changeset): CrossFieldKeyRange[] {\n\tconst keys: CrossFieldKeyRange[] = [];\n\tfor (const mark of change) {\n\t\tkeys.push(...getCrossFieldKeysForMarkEffect(mark, mark.count));\n\t}\n\n\treturn keys;\n}\n\nfunction getCrossFieldKeysForMarkEffect(\n\teffect: MarkEffect,\n\tcount: number,\n): CrossFieldKeyRange[] {\n\tswitch (effect.type) {\n\t\tcase \"Insert\":\n\t\t\t// An insert behaves like a move where the source and destination are at the same location.\n\t\t\t// An insert can become a move when after rebasing.\n\t\t\treturn [\n\t\t\t\t[CrossFieldTarget.Source, effect.revision, effect.id, count],\n\t\t\t\t[CrossFieldTarget.Destination, effect.revision, effect.id, count],\n\t\t\t];\n\t\tcase \"MoveOut\":\n\t\t\treturn [[CrossFieldTarget.Source, effect.revision, effect.id, count]];\n\t\tcase \"MoveIn\":\n\t\t\treturn [[CrossFieldTarget.Destination, effect.revision, effect.id, count]];\n\t\tcase \"AttachAndDetach\":\n\t\t\treturn [\n\t\t\t\t...getCrossFieldKeysForMarkEffect(effect.attach, count),\n\t\t\t\t...getCrossFieldKeysForMarkEffect(effect.detach, count),\n\t\t\t];\n\t\tdefault:\n\t\t\treturn [];\n\t}\n}\n"]}
|
|
1
|
+
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../../src/feature-libraries/sequence-field/utils.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;;AAEH,kEAA8E;AAE9E,kDAQ6B;AAC7B,kDAAgE;AAChE,yDAKoC;AAQpC,yCAmBoB;AAEpB,SAAgB,OAAO,CAAC,MAAiB;IACxC,KAAK,M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AE;wBACJ,MAAM,EAAE,2BAAgB,CAAC,MAAM;wBAC/B,QAAQ,EAAE,MAAM,CAAC,QAAQ;wBACzB,OAAO,EAAE,MAAM,CAAC,EAAE;qBAClB;oBACD,KAAK;iBACL;aACD,CAAC;QACH,KAAK,QAAQ;YACZ,OAAO;gBACN;oBACC,GAAG,EAAE;wBACJ,MAAM,EAAE,2BAAgB,CAAC,WAAW;wBACpC,QAAQ,EAAE,MAAM,CAAC,QAAQ;wBACzB,OAAO,EAAE,MAAM,CAAC,EAAE;qBAClB;oBACD,KAAK;iBACL;aACD,CAAC;QACH,KAAK,iBAAiB;YACrB,OAAO;gBACN,GAAG,8BAA8B,CAAC,MAAM,CAAC,MAAM,EAAE,KAAK,CAAC;gBACvD,GAAG,8BAA8B,CAAC,MAAM,CAAC,MAAM,EAAE,KAAK,CAAC;aACvD,CAAC;QACH;YACC,OAAO,EAAE,CAAC;IACZ,CAAC;AACF,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { assert, unreachableCase } from \"@fluidframework/core-utils/internal\";\n\nimport {\n\ttype ChangeAtomId,\n\ttype ChangesetLocalId,\n\ttype RevisionMetadataSource,\n\ttype RevisionTag,\n\tareEqualChangeAtomIdOpts,\n\tareEqualChangeAtomIds,\n\tmakeChangeAtomId,\n} from \"../../core/index.js\";\nimport { type Mutable, brand, fail } from \"../../util/index.js\";\nimport {\n\tCrossFieldTarget,\n\ttype NodeId,\n\ttype CrossFieldKeyRange,\n\ttype NestedChangesIndices,\n} from \"../modular-schema/index.js\";\n\nimport type {\n\tCellRename,\n\tDetachOfRemovedNodes,\n\tEmptyInputCellMark,\n\tMoveMarkEffect,\n} from \"./helperTypes.js\";\nimport {\n\ttype Attach,\n\ttype AttachAndDetach,\n\ttype CellId,\n\ttype CellMark,\n\ttype Changeset,\n\ttype Detach,\n\ttype DetachFields,\n\ttype HasRevisionTag,\n\ttype Insert,\n\ttype Mark,\n\ttype MarkEffect,\n\ttype MoveIn,\n\ttype MoveOut,\n\ttype NoopMark,\n\tNoopMarkType,\n\ttype Remove,\n\ttype CellCount,\n\ttype Rename,\n} from \"./types.js\";\n\nexport function isEmpty(change: Changeset): boolean {\n\tfor (const mark of change) {\n\t\tif (mark.changes !== undefined || mark.type !== undefined) {\n\t\t\treturn false;\n\t\t}\n\t}\n\treturn true;\n}\n\nexport function createEmpty(): Changeset {\n\treturn [];\n}\n\nexport function getNestedChanges(change: Changeset): NestedChangesIndices {\n\tconst output: NestedChangesIndices = [];\n\tlet inputIndex = 0;\n\tlet outputIndex = 0;\n\tfor (const mark of change) {\n\t\tconst { changes, count } = mark;\n\t\tif (changes !== undefined) {\n\t\t\toutput.push([\n\t\t\t\tchanges,\n\t\t\t\t!areInputCellsEmpty(mark) ? inputIndex : undefined /* inputIndex */,\n\t\t\t\t!areOutputCellsEmpty(mark) ? outputIndex : undefined /* outputIndex */,\n\t\t\t]);\n\t\t}\n\t\tif (!areInputCellsEmpty(mark)) {\n\t\t\tinputIndex += count;\n\t\t}\n\n\t\tif (!areOutputCellsEmpty(mark)) {\n\t\t\toutputIndex += count;\n\t\t}\n\t}\n\treturn output;\n}\n\nexport function isNewAttach(mark: Mark, revision?: RevisionTag): boolean {\n\treturn isNewAttachEffect(mark, mark.cellId, revision);\n}\n\nexport function isNewAttachEffect(\n\teffect: MarkEffect,\n\tcellId: CellId | undefined,\n\trevision?: RevisionTag,\n): boolean {\n\treturn (\n\t\t(isAttach(effect) &&\n\t\t\tcellId !== undefined &&\n\t\t\t(effect.revision ?? revision) === (cellId.revision ?? revision)) ||\n\t\t(isAttachAndDetachEffect(effect) && isNewAttachEffect(effect.attach, cellId, revision))\n\t);\n}\n\nexport function isRename(mark: MarkEffect): mark is Rename {\n\treturn mark.type === \"Rename\";\n}\n\nexport function isInsert(mark: MarkEffect): mark is Insert {\n\treturn mark.type === \"Insert\";\n}\n\nexport function isAttach(effect: MarkEffect): effect is Attach {\n\treturn effect.type === \"Insert\" || effect.type === \"MoveIn\";\n}\n\nexport function isReattach(mark: Mark): boolean {\n\treturn isReattachEffect(mark, mark.cellId);\n}\n\nexport function isReattachEffect(effect: MarkEffect, cellId: CellId | undefined): boolean {\n\treturn isAttach(effect) && !isNewAttachEffect(effect, cellId);\n}\n\nexport function isActiveReattach(\n\tmark: Mark,\n): mark is CellMark<Insert> & { conflictsWith?: undefined } {\n\treturn isAttach(mark) && isReattachEffect(mark, mark.cellId) && mark.cellId !== undefined;\n}\n\nexport function areEqualCellIds(a: CellId | undefined, b: CellId | undefined): boolean {\n\treturn areEqualChangeAtomIdOpts(a, b);\n}\n\nexport function getInputCellId(mark: Mark): CellId | undefined {\n\treturn mark.cellId;\n}\n\nexport function getOutputCellId(mark: Mark): CellId | undefined {\n\tif (isDetach(mark) || isRename(mark)) {\n\t\treturn getDetachOutputCellId(mark);\n\t} else if (markFillsCells(mark)) {\n\t\treturn undefined;\n\t} else if (isAttachAndDetachEffect(mark)) {\n\t\treturn getDetachOutputCellId(mark.detach);\n\t}\n\n\treturn getInputCellId(mark);\n}\n\nexport function cellSourcesFromMarks(\n\tmarks: readonly Mark[],\n\tcontextGetter: typeof getInputCellId | typeof getOutputCellId,\n): Set<RevisionTag | undefined> {\n\tconst set = new Set<RevisionTag | undefined>();\n\tfor (const mark of marks) {\n\t\tconst cell = contextGetter(mark);\n\t\tif (cell !== undefined) {\n\t\t\tset.add(cell.revision);\n\t\t}\n\t}\n\treturn set;\n}\n\nexport enum CellOrder {\n\tSameCell,\n\tOldThenNew,\n\tNewThenOld,\n}\n\n/**\n * Determines the order of two cells from two changesets.\n *\n * This function makes the following assumptions:\n * 1. The cells represent the same context.\n * 2. `oldMarkCell` is from a mark in a changeset that is older than the changeset that contains the mark that\n * `newMarkCell` is from.\n * 3. In terms of sequence index, all cells located before A are also located before B,\n * and all cells located before B are also located before A.\n * 4. If a changeset has a mark/tombstone that describes a cell named in some revision R,\n * then that changeset must contain marks/tombstones for all cells named in R as well as all cells named in later\n * revisions up to its own.\n * 5. If a changeset foo is rebased over a changeset bar, then the rebased version of foo must contain tombstones or\n * marks for all cells referenced or named in bar. It has yet to be determined whether this assumption is necessary\n * for the logic below.\n *\n * @param oldMarkCell - The cell referenced or named by a mark or tombstone from the older changeset.\n * @param newMarkCell - The cell referenced or named by a mark or tombstone from the newer changeset.\n * @param oldChangeKnowledge - The set of revisions that the older changeset has cell representations for.\n * @param newChangeKnowledge - The set of revisions that the newer changeset has cell representations for.\n * @param metadata - Revision metadata for the operation being carried out.\n * @returns a {@link CellOrder} which describes how the cells are ordered relative to one-another.\n */\nexport function compareCellPositionsUsingTombstones(\n\toldMarkCell: ChangeAtomId,\n\tnewMarkCell: ChangeAtomId,\n\toldChangeKnowledge: ReadonlySet<RevisionTag | undefined>,\n\tnewChangeKnowledge: ReadonlySet<RevisionTag | undefined>,\n\tmetadata: RevisionMetadataSource,\n): CellOrder {\n\tif (areEqualChangeAtomIds(oldMarkCell, newMarkCell)) {\n\t\treturn CellOrder.SameCell;\n\t}\n\tconst oldChangeKnowsOfNewMarkCellRevision = oldChangeKnowledge.has(newMarkCell.revision);\n\tconst newChangeKnowsOfOldMarkCellRevision = newChangeKnowledge.has(oldMarkCell.revision);\n\tif (oldChangeKnowsOfNewMarkCellRevision && newChangeKnowsOfOldMarkCellRevision) {\n\t\t// If both changesets know of both cells, but we've been asked to compare different cells,\n\t\t// Then either the changesets they originate from do not represent the same context,\n\t\t// or the ordering of their cells in inconsistent.\n\t\t// The only exception to this is when we're composing anonymous changesets in a transaction.\n\t\tassert(\n\t\t\toldMarkCell.revision === undefined && newMarkCell.revision === undefined,\n\t\t\t0x8a0 /* Inconsistent cell ordering */,\n\t\t);\n\t\t// We are composing anonymous changesets in a transaction. The new changeset is creating a cell in a gap\n\t\t// where the old changeset knows of some now empty cell. We order the new cell relative to the old cell in a\n\t\t// way that is consistent with its tie-breaking behavior should the old cell be concurrently re-filled.\n\t\t// Since only tie-break left is supported at the moment, the new cell comes first.\n\t\treturn CellOrder.NewThenOld;\n\t}\n\tif (newChangeKnowsOfOldMarkCellRevision) {\n\t\t// The changeset that contains `newMarkCell` has tombstones for the revision that created `oldMarkCell`,\n\t\t// so a tombstone/mark matching `oldMarkCell` must occur later in the newer changeset.\n\t\treturn CellOrder.NewThenOld;\n\t} else if (oldChangeKnowsOfNewMarkCellRevision) {\n\t\t// The changeset that contains `oldMarkCell` has tombstones for revision that created `newMarkCell`,\n\t\t// so a tombstone/mark matching `newMarkCell` must occur later in the older changeset.\n\t\treturn CellOrder.OldThenNew;\n\t} else {\n\t\t// These cells are only ordered through tie-breaking.\n\t\t// Since tie-breaking is hard-coded to \"merge left\", the younger cell comes first.\n\n\t\t// In the context of compose, an undefined revision means we are composing anonymous changesets into\n\t\t// a transaction, which means the cell from the newer changeset is younger.\n\t\tif (newMarkCell.revision === undefined) {\n\t\t\treturn CellOrder.NewThenOld;\n\t\t}\n\t\t// The only case where the old mark cell should have no revision is when composing anonymous changesets\n\t\t// into a transaction, in which case the new mark cell should also have no revision, which is handled above.\n\t\t// In all other cases, the old mark cell should have a revision.\n\t\tassert(\n\t\t\toldMarkCell.revision !== undefined,\n\t\t\t0x8a1 /* Old mark cell should have a revision */,\n\t\t);\n\n\t\t// Note that these indices are for ordering the revisions in which the cells were named, not the revisions\n\t\t// of the changesets in which the marks targeting these cells appear.\n\t\tconst oldCellRevisionIndex = metadata.getIndex(oldMarkCell.revision);\n\t\tconst newCellRevisionIndex = metadata.getIndex(newMarkCell.revision);\n\n\t\t// If the metadata defines an ordering for the revisions then the cell from the newer revision comes first.\n\t\tif (newCellRevisionIndex !== undefined && oldCellRevisionIndex !== undefined) {\n\t\t\treturn newCellRevisionIndex > oldCellRevisionIndex\n\t\t\t\t? CellOrder.NewThenOld\n\t\t\t\t: CellOrder.OldThenNew;\n\t\t}\n\n\t\tif (newCellRevisionIndex === undefined && oldCellRevisionIndex === undefined) {\n\t\t\t// While it is possible for both marks to refer to cells that were named in revisions that are outside\n\t\t\t// the scope of the metadata, such a scenario should be handled above due to the fact that one of the two\n\t\t\t// changesets should have tombstones or marks for both cells.\n\t\t\t//\n\t\t\t// To see this in the context of rebase, we must consider the lowest common ancestor (LCA) of each change's\n\t\t\t// original (i.e., unrebased) edit with the head of the branch they will both reside on after the rebase.\n\t\t\t// ...─(Ti)─...─(Tj)─...─(old')─(new') <- branch both change will reside on after rebase\n\t\t\t// | └─...─(new)\n\t\t\t// └─...─(old)\n\t\t\t// In the diagram above we can see that by the time `new` is being rebased over `old`, both changesets have\n\t\t\t// been rebased over, and therefore have cell information for, changes `Tj` onwards. This means that one of\n\t\t\t// The two changesets (the `old` one in the diagram above) will have tombstones or marks for any cells that\n\t\t\t// `new` refers to so long as those cells were not created on `new`'s branch.\n\t\t\t// Note that the change that contains the superset of cells (again, ignoring cells created on the other\n\t\t\t// change's branch) is not always the older change. Consider the following scenario:\n\t\t\t// ...─(Ti)─...─(Tj)─...─(old')─(new')\n\t\t\t// | └─...─(old)\n\t\t\t// └─...─(new)\n\t\t\t//\n\t\t\t// The same scenario can arise in the context of compose (just consider composing `old'` and `new'` from\n\t\t\t// the examples above) with the same resolution.\n\t\t\tassert(false, 0x8a2 /* Invalid cell ordering scenario */);\n\t\t}\n\n\t\t// The absence of metadata for a cell with a defined revision means that the cell is from a revision that\n\t\t// predates the edits that are within the scope of the metadata. Such a cell is therefore older than the one\n\t\t// for which we do have metadata.\n\t\treturn oldCellRevisionIndex === undefined ? CellOrder.NewThenOld : CellOrder.OldThenNew;\n\t}\n}\n\n/**\n * @returns the ID of the cell in the output context of the given detach `mark`.\n */\nexport function getDetachOutputCellId(mark: Detach | Rename): ChangeAtomId {\n\tif (isRename(mark)) {\n\t\treturn mark.idOverride;\n\t}\n\tif (mark.idOverride !== undefined) {\n\t\treturn mark.idOverride;\n\t}\n\treturn mark.revision === undefined\n\t\t? { localId: mark.id }\n\t\t: { revision: mark.revision, localId: mark.id };\n}\n\n/**\n * @returns the ID of the detached node in the output context of the given detach `mark`.\n */\nexport function getDetachedNodeId(mark: Detach | Rename): ChangeAtomId {\n\tswitch (mark.type) {\n\t\tcase \"Rename\":\n\t\tcase \"Remove\": {\n\t\t\treturn getDetachOutputCellId(mark);\n\t\t}\n\t\tcase \"MoveOut\": {\n\t\t\treturn makeChangeAtomId(mark.id, mark.revision);\n\t\t}\n\t\tdefault:\n\t\t\tunreachableCase(mark);\n\t}\n}\n\n/**\n * Preserves the semantics of the given `mark` but repackages it into a `DetachOfRemovedNodes` when possible.\n */\nexport function normalizeCellRename(\n\tcellId: CellId,\n\tcount: CellCount,\n\tattach: Attach,\n\tdetach: Detach,\n): CellMark<AttachAndDetach | DetachOfRemovedNodes | Rename | NoopMark> {\n\tif (attach.type === \"MoveIn\") {\n\t\tif (detach.type === \"MoveOut\") {\n\t\t\tconst outputId = getDetachOutputCellId(detach);\n\t\t\t// Note that the output ID may be the same as the cellId. In such a scenario,\n\t\t\t// we output an (impact-less) Rename mark anyway (as opposed to a Skip)\n\t\t\t// because the resulting Rename may be rebased over other changes that rename the input cell,\n\t\t\t// eventually leading to an impactful rename.\n\t\t\treturn {\n\t\t\t\ttype: \"Rename\",\n\t\t\t\tcount,\n\t\t\t\tcellId,\n\t\t\t\tidOverride: outputId,\n\t\t\t};\n\t\t}\n\t} else {\n\t\t// Normalization: when the attach is an insert/revive, we rely on the implicit reviving semantics of the\n\t\t// detach instead of using an explicit revive effect in an AttachAndDetach\n\t\treturn {\n\t\t\t...detach,\n\t\t\tcount,\n\t\t\tcellId,\n\t\t};\n\t}\n\treturn {\n\t\ttype: \"AttachAndDetach\",\n\t\tattach,\n\t\tdetach,\n\t\tcount,\n\t\tcellId,\n\t};\n}\n\n/**\n * Preserves the semantics of the given `mark` but repackages it into an `AttachAndDetach` mark if it is not already one.\n */\nexport function asAttachAndDetach(mark: CellMark<CellRename>): CellMark<AttachAndDetach> {\n\tif (mark.type === \"AttachAndDetach\") {\n\t\treturn mark;\n\t}\n\tconst { cellId, count, changes, revision, ...effect } = mark;\n\tconst attachAndDetach: CellMark<AttachAndDetach | Detach> = {\n\t\ttype: \"AttachAndDetach\",\n\t\tcount,\n\t\tcellId,\n\t\tattach: {\n\t\t\ttype: \"Insert\",\n\t\t\tid: mark.id,\n\t\t},\n\t\tdetach: effect,\n\t};\n\tif (changes !== undefined) {\n\t\tattachAndDetach.changes = changes;\n\t}\n\tif (revision !== undefined) {\n\t\tattachAndDetach.attach.revision = revision;\n\t\tattachAndDetach.detach.revision = revision;\n\t}\n\treturn attachAndDetach;\n}\n\nexport function cloneMark<TMark extends Mark>(mark: TMark): TMark {\n\tconst clone: TMark = { ...cloneMarkEffect(mark), count: mark.count };\n\n\tif (mark.cellId !== undefined) {\n\t\tclone.cellId = cloneCellId(mark.cellId);\n\t}\n\treturn clone;\n}\n\nexport function cloneMarkEffect<TEffect extends MarkEffect>(effect: TEffect): TEffect {\n\tconst clone = { ...effect };\n\tif (clone.type === \"AttachAndDetach\") {\n\t\tclone.attach = cloneMarkEffect(clone.attach);\n\t\tclone.detach = cloneMarkEffect(clone.detach);\n\t}\n\treturn clone;\n}\n\nexport function cloneCellId(id: CellId): CellId {\n\tconst cloned = { ...id };\n\treturn cloned;\n}\n\n/**\n * @param mark - The mark to get the length of.\n * @param ignorePairing - When true, the length of a paired mark (e.g. MoveIn/MoveOut) whose matching mark is not active\n * will be treated the same as if the matching mark were active.\n * @returns The number of nodes within the output context of the mark.\n */\nexport function getOutputLength(mark: Mark, ignorePairing: boolean = false): number {\n\treturn areOutputCellsEmpty(mark) ? 0 : mark.count;\n}\n\n/**\n * @param mark - The mark to get the length of.\n * @returns The number of nodes within the input context of the mark.\n */\nexport function getInputLength(mark: Mark): number {\n\treturn areInputCellsEmpty(mark) ? 0 : mark.count;\n}\n\nexport function markEmptiesCells(mark: Mark): boolean {\n\treturn !areInputCellsEmpty(mark) && areOutputCellsEmpty(mark);\n}\n\nexport function markFillsCells(mark: Mark): boolean {\n\treturn areInputCellsEmpty(mark) && !areOutputCellsEmpty(mark);\n}\n\nexport function markHasCellEffect(mark: Mark): boolean {\n\treturn areInputCellsEmpty(mark) !== areOutputCellsEmpty(mark);\n}\n\nexport function isAttachAndDetachEffect(effect: MarkEffect): effect is AttachAndDetach {\n\treturn effect.type === \"AttachAndDetach\";\n}\n\nexport function isDetachOfRemovedNodes(mark: Mark): mark is CellMark<DetachOfRemovedNodes> {\n\treturn isDetach(mark) && mark.cellId !== undefined;\n}\n\nexport function isImpactfulCellRename(mark: Mark): mark is CellMark<CellRename> {\n\treturn (isAttachAndDetachEffect(mark) || isDetachOfRemovedNodes(mark)) && isImpactful(mark);\n}\n\nexport function areInputCellsEmpty(mark: Mark): mark is EmptyInputCellMark {\n\treturn mark.cellId !== undefined;\n}\n\nexport function areOutputCellsEmpty(mark: Mark): boolean {\n\tconst type = mark.type;\n\tswitch (type) {\n\t\tcase NoopMarkType:\n\t\t\treturn mark.cellId !== undefined;\n\t\tcase \"Remove\":\n\t\tcase \"Rename\":\n\t\tcase \"MoveOut\":\n\t\tcase \"AttachAndDetach\":\n\t\t\treturn true;\n\t\tcase \"MoveIn\":\n\t\tcase \"Insert\":\n\t\t\treturn false;\n\t\tdefault:\n\t\t\tunreachableCase(type);\n\t}\n}\n\n/**\n * Creates a mark that is equivalent to the given `mark` but with effects removed if those have no impact in the input\n * context of that mark.\n *\n * @param mark - The mark to settle. Never mutated.\n * @returns either the original mark or a shallow clone of it with effects stripped out.\n */\nexport function settleMark(mark: Mark): Mark {\n\tif (isImpactful(mark)) {\n\t\treturn mark;\n\t}\n\treturn omitMarkEffect(mark);\n}\n\n/**\n * @returns true, iff the given `mark` would have impact on the field when applied.\n * Ignores the impact of nested changes.\n * CellRename effects are considered impactful if they actually change the ID of the cells.\n */\nexport function isImpactful(mark: Mark): boolean {\n\tconst type = mark.type;\n\tswitch (type) {\n\t\tcase NoopMarkType:\n\t\t\treturn false;\n\t\tcase \"Rename\":\n\t\t\treturn true;\n\t\tcase \"Remove\": {\n\t\t\tconst inputId = getInputCellId(mark);\n\t\t\tif (inputId === undefined) {\n\t\t\t\treturn true;\n\t\t\t}\n\t\t\tconst outputId = getOutputCellId(mark);\n\t\t\tassert(outputId !== undefined, 0x824 /* Remove marks must have an output cell ID */);\n\t\t\treturn !areEqualChangeAtomIds(inputId, outputId);\n\t\t}\n\t\tcase \"AttachAndDetach\":\n\t\tcase \"MoveOut\":\n\t\t\treturn true;\n\t\tcase \"MoveIn\":\n\t\t\t// MoveIn marks always target an empty cell.\n\t\t\tassert(mark.cellId !== undefined, 0x825 /* MoveIn marks should target empty cells */);\n\t\t\treturn true;\n\t\tcase \"Insert\":\n\t\t\t// A Revive has no impact if the nodes are already in the document.\n\t\t\treturn mark.cellId !== undefined;\n\t\tdefault:\n\t\t\tunreachableCase(type);\n\t}\n}\n\nexport function isTombstone(mark: Mark): mark is CellMark<NoopMark> & { cellId: CellId } {\n\treturn mark.type === NoopMarkType && mark.cellId !== undefined && mark.changes === undefined;\n}\n\nexport function isNoopMark(mark: Mark): mark is CellMark<NoopMark> {\n\treturn mark.type === NoopMarkType;\n}\n\nexport function areOverlappingIdRanges(\n\tid1: ChangesetLocalId,\n\tcount1: number,\n\tid2: ChangesetLocalId,\n\tcount2: number,\n): boolean {\n\tconst lastId1 = (id1 as number) + count1 - 1;\n\tconst lastId2 = (id2 as number) + count2 - 1;\n\treturn (id2 <= id1 && id1 <= lastId2) || (id1 <= id2 && id2 <= lastId1);\n}\n\nexport function compareCellsFromSameRevision(\n\tcell1: CellId,\n\tcount1: number,\n\tcell2: CellId,\n\tcount2: number,\n): number | undefined {\n\tassert(\n\t\tcell1.revision === cell2.revision,\n\t\t0x85b /* Expected cells to have the same revision */,\n\t);\n\tif (areOverlappingIdRanges(cell1.localId, count1, cell2.localId, count2)) {\n\t\treturn cell1.localId - cell2.localId;\n\t}\n\treturn undefined;\n}\n\nexport function isDetach(mark: MarkEffect | undefined): mark is Detach {\n\tconst type = mark?.type;\n\treturn type === \"Remove\" || type === \"MoveOut\";\n}\n\nexport function isRemoveMark(mark: Mark | undefined): mark is CellMark<Remove> {\n\treturn mark?.type === \"Remove\";\n}\n\nfunction areMergeableChangeAtoms(\n\tlhs: ChangeAtomId | undefined,\n\tlhsCount: number,\n\trhs: ChangeAtomId | undefined,\n): boolean {\n\tif (lhs === undefined || rhs === undefined) {\n\t\treturn lhs === undefined && rhs === undefined;\n\t}\n\n\treturn (\n\t\tlhs.revision === rhs.revision && areAdjacentIdRanges(lhs.localId, lhsCount, rhs.localId)\n\t);\n}\n\nfunction areAdjacentIdRanges(\n\tfirstStart: ChangesetLocalId,\n\tfirstLength: number,\n\tsecondStart: ChangesetLocalId,\n): boolean {\n\treturn (firstStart as number) + firstLength === secondStart;\n}\n\nfunction haveMergeableIdOverrides(\n\tlhs: DetachFields,\n\tlhsCount: number,\n\trhs: DetachFields,\n): boolean {\n\tif (lhs.idOverride !== undefined && rhs.idOverride !== undefined) {\n\t\treturn areMergeableCellIds(lhs.idOverride, lhsCount, rhs.idOverride);\n\t}\n\treturn (lhs.idOverride === undefined) === (rhs.idOverride === undefined);\n}\n\nfunction areMergeableCellIds(\n\tlhs: CellId | undefined,\n\tlhsCount: number,\n\trhs: CellId | undefined,\n): boolean {\n\treturn areMergeableChangeAtoms(lhs, lhsCount, rhs);\n}\n\n/**\n * Attempts to extend `lhs` to include the effects of `rhs`.\n * @param lhs - The mark to extend.\n * @param rhs - The effect so extend `rhs` with.\n * @returns `lhs` iff the function was able to mutate `lhs` to include the effects of `rhs`.\n * When `undefined` is returned, `lhs` is left untouched.\n */\nexport function tryMergeMarks(lhs: Mark, rhs: Readonly<Mark>): Mark | undefined {\n\tif (rhs.type !== lhs.type) {\n\t\treturn undefined;\n\t}\n\n\tif (!areMergeableCellIds(lhs.cellId, lhs.count, rhs.cellId)) {\n\t\treturn undefined;\n\t}\n\n\tif (rhs.changes !== undefined || lhs.changes !== undefined) {\n\t\treturn undefined;\n\t}\n\n\tconst mergedEffect = tryMergeEffects(lhs, rhs, lhs.count);\n\tif (mergedEffect === undefined) {\n\t\treturn undefined;\n\t}\n\n\treturn { ...lhs, ...mergedEffect, count: lhs.count + rhs.count };\n}\n\nfunction tryMergeEffects(\n\tlhs: MarkEffect,\n\trhs: MarkEffect,\n\tlhsCount: number,\n): MarkEffect | undefined {\n\tif (lhs.type !== rhs.type) {\n\t\treturn undefined;\n\t}\n\n\tif (rhs.type === NoopMarkType) {\n\t\treturn lhs;\n\t}\n\n\tif (rhs.type === \"AttachAndDetach\") {\n\t\tconst lhsAttachAndDetach = lhs as AttachAndDetach;\n\t\tconst attach = tryMergeEffects(lhsAttachAndDetach.attach, rhs.attach, lhsCount);\n\t\tconst detach = tryMergeEffects(lhsAttachAndDetach.detach, rhs.detach, lhsCount);\n\t\tif (attach === undefined || detach === undefined) {\n\t\t\treturn undefined;\n\t\t}\n\n\t\tassert(\n\t\t\tisAttach(attach) && isDetach(detach),\n\t\t\t0x826 /* Merged marks should be same type as input marks */,\n\t\t);\n\t\treturn { ...lhsAttachAndDetach, attach, detach };\n\t}\n\n\tif (\n\t\t(lhs as Partial<HasRevisionTag>).revision !== (rhs as Partial<HasRevisionTag>).revision\n\t) {\n\t\treturn undefined;\n\t}\n\n\tif (isDetach(lhs) && isDetach(rhs) && !haveMergeableIdOverrides(lhs, lhsCount, rhs)) {\n\t\treturn undefined;\n\t}\n\n\tconst type = rhs.type;\n\tswitch (type) {\n\t\tcase \"MoveIn\": {\n\t\t\tconst lhsMoveIn = lhs as MoveIn;\n\t\t\tif (\n\t\t\t\t(lhsMoveIn.id as number) + lhsCount === rhs.id &&\n\t\t\t\tareMergeableChangeAtoms(lhsMoveIn.finalEndpoint, lhsCount, rhs.finalEndpoint)\n\t\t\t) {\n\t\t\t\treturn lhsMoveIn;\n\t\t\t}\n\t\t\tbreak;\n\t\t}\n\t\tcase \"Remove\": {\n\t\t\tconst lhsDetach = lhs as Remove;\n\t\t\tif (\n\t\t\t\t(lhsDetach.id as number) + lhsCount === rhs.id &&\n\t\t\t\thaveMergeableIdOverrides(lhsDetach, lhsCount, rhs)\n\t\t\t) {\n\t\t\t\treturn lhsDetach;\n\t\t\t}\n\t\t\tbreak;\n\t\t}\n\t\tcase \"Rename\": {\n\t\t\tconst lhsDetach = lhs as Rename;\n\t\t\tif (haveMergeableIdOverrides(lhsDetach, lhsCount, rhs)) {\n\t\t\t\treturn lhsDetach;\n\t\t\t}\n\t\t\tbreak;\n\t\t}\n\t\tcase \"MoveOut\": {\n\t\t\tconst lhsMoveOut = lhs as MoveOut;\n\t\t\tif (\n\t\t\t\t(lhsMoveOut.id as number) + lhsCount === rhs.id &&\n\t\t\t\thaveMergeableIdOverrides(lhsMoveOut, lhsCount, rhs) &&\n\t\t\t\tareMergeableChangeAtoms(lhsMoveOut.finalEndpoint, lhsCount, rhs.finalEndpoint)\n\t\t\t) {\n\t\t\t\treturn lhsMoveOut;\n\t\t\t}\n\t\t\tbreak;\n\t\t}\n\t\tcase \"Insert\": {\n\t\t\tconst lhsInsert = lhs as Insert;\n\t\t\tif ((lhsInsert.id as number) + lhsCount === rhs.id) {\n\t\t\t\treturn lhsInsert;\n\t\t\t}\n\t\t\tbreak;\n\t\t}\n\t\tdefault:\n\t\t\tunreachableCase(type);\n\t}\n\n\treturn undefined;\n}\n\n/**\n * Splits the `mark` into two marks such that the first returned mark has length `length`.\n * @param mark - The mark to split.\n * @param revision - The revision of the changeset the mark is part of.\n * @param length - The desired length for the first of the two returned marks.\n * @param genId - An ID allocator\n * @param moveEffects - The table in which to record splitting of move marks\n * @param recordMoveEffect - Whether when splitting a move an entry should be added to `moveEffects` indicating that the mark should be split (in case we process this mark again).\n * An entry is always added to `moveEffects` indicating that the opposite end of the move should be split.\n * @returns A pair of marks equivalent to the original `mark`\n * such that the first returned mark has input length `length`.\n */\nexport function splitMark<TMark extends Mark>(mark: TMark, length: number): [TMark, TMark] {\n\tconst markLength = mark.count;\n\tconst remainder = markLength - length;\n\tif (length < 1 || remainder < 1) {\n\t\tfail(\"Unable to split mark due to lengths\");\n\t}\n\n\tconst [effect1, effect2] = splitMarkEffect(mark, length);\n\tconst mark1 = { ...mark, ...effect1, count: length };\n\tconst mark2 = { ...mark, ...effect2, count: remainder };\n\tif (mark2.cellId !== undefined) {\n\t\tmark2.cellId = splitDetachEvent(mark2.cellId, length);\n\t}\n\n\treturn [mark1, mark2];\n}\n\nexport function splitMarkEffect<TEffect extends MarkEffect>(\n\teffect: TEffect,\n\tlength: number,\n): [TEffect, TEffect] {\n\tconst type = effect.type;\n\tswitch (type) {\n\t\tcase NoopMarkType:\n\t\t\treturn [effect, effect];\n\t\tcase \"Insert\": {\n\t\t\tconst effect1: TEffect = {\n\t\t\t\t...effect,\n\t\t\t};\n\t\t\tconst effect2: TEffect = {\n\t\t\t\t...effect,\n\t\t\t\tid: (effect.id as number) + length,\n\t\t\t};\n\t\t\treturn [effect1, effect2];\n\t\t}\n\t\tcase \"MoveIn\": {\n\t\t\tconst effect2: TEffect = { ...effect, id: (effect.id as number) + length };\n\t\t\tconst move2 = effect2 as MoveIn;\n\t\t\tif (move2.finalEndpoint !== undefined) {\n\t\t\t\tmove2.finalEndpoint = splitDetachEvent(move2.finalEndpoint, length);\n\t\t\t}\n\t\t\treturn [effect, effect2];\n\t\t}\n\t\tcase \"Remove\": {\n\t\t\tconst effect1 = { ...effect };\n\t\t\tconst id2: ChangesetLocalId = brand((effect.id as number) + length);\n\t\t\tconst effect2 = { ...effect, id: id2 };\n\t\t\tconst effect2Remove = effect2 as Mutable<Remove>;\n\t\t\tif (effect2Remove.idOverride !== undefined) {\n\t\t\t\teffect2Remove.idOverride = splitDetachEvent(effect2Remove.idOverride, length);\n\t\t\t}\n\t\t\treturn [effect1, effect2];\n\t\t}\n\t\tcase \"Rename\": {\n\t\t\tconst effect1 = { ...effect };\n\t\t\tconst effect2 = { ...effect };\n\t\t\tconst effect2Rename = effect2 as Mutable<Rename>;\n\t\t\tif (effect2Rename.idOverride !== undefined) {\n\t\t\t\teffect2Rename.idOverride = splitDetachEvent(effect2Rename.idOverride, length);\n\t\t\t}\n\t\t\treturn [effect1, effect2];\n\t\t}\n\t\tcase \"MoveOut\": {\n\t\t\tconst effect2 = {\n\t\t\t\t...effect,\n\t\t\t\tid: (effect.id as number) + length,\n\t\t\t};\n\n\t\t\tconst return2 = effect2 as Mutable<MoveOut>;\n\n\t\t\tif (return2.idOverride !== undefined) {\n\t\t\t\treturn2.idOverride = splitDetachEvent(return2.idOverride, length);\n\t\t\t}\n\n\t\t\tif (return2.finalEndpoint !== undefined) {\n\t\t\t\treturn2.finalEndpoint = splitDetachEvent(return2.finalEndpoint, length);\n\t\t\t}\n\t\t\treturn [effect, effect2];\n\t\t}\n\t\tcase \"AttachAndDetach\": {\n\t\t\tconst [attach1, attach2] = splitMarkEffect(effect.attach, length);\n\t\t\tconst [detach1, detach2] = splitMarkEffect(effect.detach, length);\n\t\t\tconst effect1 = {\n\t\t\t\t...effect,\n\t\t\t\tattach: attach1,\n\t\t\t\tdetach: detach1,\n\t\t\t};\n\n\t\t\tconst effect2 = {\n\t\t\t\t...effect,\n\t\t\t\tattach: attach2,\n\t\t\t\tdetach: detach2,\n\t\t\t};\n\n\t\t\treturn [effect1, effect2];\n\t\t}\n\t\tdefault:\n\t\t\tunreachableCase(type);\n\t}\n}\n\nfunction splitDetachEvent(detachEvent: CellId, length: number): CellId {\n\treturn { ...detachEvent, localId: brand((detachEvent.localId as number) + length) };\n}\n\n// TODO: Refactor MarkEffect into a field of CellMark so this function isn't necessary.\nexport function extractMarkEffect<TEffect extends MarkEffect>(\n\tmark: CellMark<TEffect>,\n): TEffect {\n\tconst { cellId: _cellId, count: _count, changes: _changes, ...effect } = mark;\n\treturn effect as unknown as TEffect;\n}\n\n// TODO: Refactor MarkEffect into a field of CellMark so this function isn't necessary.\nexport function omitMarkEffect(mark: CellMark<unknown>): CellMark<NoopMark> {\n\tconst { cellId, count, changes } = mark;\n\tconst noopMark: CellMark<NoopMark> = { count };\n\tif (cellId !== undefined) {\n\t\tnoopMark.cellId = cellId;\n\t}\n\tif (changes !== undefined) {\n\t\tnoopMark.changes = changes;\n\t}\n\treturn noopMark;\n}\n\nexport function withNodeChange<TMark extends CellMark<TKind>, TKind extends MarkEffect>(\n\tmark: TMark,\n\tchanges: NodeId | undefined,\n): TMark {\n\tconst newMark = { ...mark };\n\tif (changes !== undefined) {\n\t\tnewMark.changes = changes;\n\t} else {\n\t\tdelete newMark.changes;\n\t}\n\treturn newMark;\n}\n\nexport function withRevision<TMark extends Mark>(\n\tmark: TMark,\n\trevision: RevisionTag | undefined,\n): TMark {\n\tif (revision === undefined) {\n\t\treturn mark;\n\t}\n\n\tconst cloned = cloneMark(mark);\n\taddRevision(cloned, revision);\n\tif (\n\t\tcloned.cellId !== undefined &&\n\t\tcloned.cellId.revision === undefined &&\n\t\trevision !== undefined\n\t) {\n\t\t(cloned.cellId as Mutable<CellId>).revision = revision;\n\t}\n\treturn cloned;\n}\n\nfunction addRevision(effect: MarkEffect, revision: RevisionTag): void {\n\tif (effect.type === NoopMarkType || isRename(effect)) {\n\t\treturn;\n\t}\n\n\tif (effect.type === \"AttachAndDetach\") {\n\t\taddRevision(effect.attach, revision);\n\t\taddRevision(effect.detach, revision);\n\t\treturn;\n\t}\n\n\tassert(\n\t\teffect.revision === undefined || effect.revision === revision,\n\t\t0x829 /* Should not overwrite mark revision */,\n\t);\n\teffect.revision = revision;\n}\n\nexport function getEndpoint(effect: MoveMarkEffect): ChangeAtomId {\n\treturn effect.finalEndpoint ?? { revision: effect.revision, localId: effect.id };\n}\n\nexport function getCrossFieldKeys(change: Changeset): CrossFieldKeyRange[] {\n\tconst keys: CrossFieldKeyRange[] = [];\n\tfor (const mark of change) {\n\t\tkeys.push(...getCrossFieldKeysForMarkEffect(mark, mark.count));\n\t}\n\n\treturn keys;\n}\n\nfunction getCrossFieldKeysForMarkEffect(\n\teffect: MarkEffect,\n\tcount: number,\n): CrossFieldKeyRange[] {\n\tswitch (effect.type) {\n\t\tcase \"Insert\":\n\t\t\t// An insert behaves like a move where the source and destination are at the same location.\n\t\t\t// An insert can become a move when after rebasing.\n\t\t\treturn [\n\t\t\t\t{\n\t\t\t\t\tkey: {\n\t\t\t\t\t\ttarget: CrossFieldTarget.Source,\n\t\t\t\t\t\trevision: effect.revision,\n\t\t\t\t\t\tlocalId: effect.id,\n\t\t\t\t\t},\n\t\t\t\t\tcount,\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tkey: {\n\t\t\t\t\t\ttarget: CrossFieldTarget.Destination,\n\t\t\t\t\t\trevision: effect.revision,\n\t\t\t\t\t\tlocalId: effect.id,\n\t\t\t\t\t},\n\t\t\t\t\tcount,\n\t\t\t\t},\n\t\t\t];\n\t\tcase \"MoveOut\":\n\t\t\treturn [\n\t\t\t\t{\n\t\t\t\t\tkey: {\n\t\t\t\t\t\ttarget: CrossFieldTarget.Source,\n\t\t\t\t\t\trevision: effect.revision,\n\t\t\t\t\t\tlocalId: effect.id,\n\t\t\t\t\t},\n\t\t\t\t\tcount,\n\t\t\t\t},\n\t\t\t];\n\t\tcase \"MoveIn\":\n\t\t\treturn [\n\t\t\t\t{\n\t\t\t\t\tkey: {\n\t\t\t\t\t\ttarget: CrossFieldTarget.Destination,\n\t\t\t\t\t\trevision: effect.revision,\n\t\t\t\t\t\tlocalId: effect.id,\n\t\t\t\t\t},\n\t\t\t\t\tcount,\n\t\t\t\t},\n\t\t\t];\n\t\tcase \"AttachAndDetach\":\n\t\t\treturn [\n\t\t\t\t...getCrossFieldKeysForMarkEffect(effect.attach, count),\n\t\t\t\t...getCrossFieldKeysForMarkEffect(effect.detach, count),\n\t\t\t];\n\t\tdefault:\n\t\t\treturn [];\n\t}\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"treeCursorUtils.d.ts","sourceRoot":"","sources":["../../src/feature-libraries/treeCursorUtils.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAIH,OAAO,EAEN,YAAY,EACZ,KAAK,aAAa,EAClB,KAAK,QAAQ,EACb,KAAK,WAAW,E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AAgB,CAAC,IAAI,EAAE,KAAK,EAAE,GAAG,EAAE,QAAQ,GAAG,SAAS,KAAK,EAAE,CAAC;CAC/D;AAID;;GAEG;AACH,8BAAsB,iBAAiB;IACtC,SAAgB,CAAC,YAAY,CAAC,QAAQ;IACtC,SAAgB,OAAO,SAAS;IAEzB,iBAAiB,IAAI,OAAO;CAGnC;AA+RD;;GAEG;AACH,wBAAgB,UAAU,CACzB,MAAM,EAAE,cAAc,GAAG,SAAS,EAClC,IAAI,EAAE,MAAM,GAAG,SAAS,GACtB,MAAM,GAAG,SAAS,CAYpB;AAED;;GAEG;AACH,wBAAgB,eAAe,CAC9B,MAAM,EAAE,cAAc,GAAG,SAAS,EAClC,IAAI,EAAE,WAAW,GACf,WAAW,CAeb;AAED;;;;;GAKG;AACH,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,cAAc,EAAE,KAAK,EAAE,cAAc,GAAG,cAAc,CAgB5F;AAgBD;;;;GAIG;AACH,qBAAa,YAAa,YAAW,MAAM;aAIzB,MAAM,EAAE,cAAc;aACtB,IAAI,EAAE,MAAM;IAJ7B,SAAgB,WAAW,EAAE,QAAQ,CAAC;IACtC,SAAgB,WAAW,EAAE,MAAM,CAAC;gBAEnB,MAAM,EAAE,cAAc,EACtB,IAAI,EAAE,MAAM;IAU7B,IAAW,MAAM,IAAI,MAAM,GAAG,SAAS,CAEtC;CACD"}
|
|
@@ -9,6 +9,7 @@ exports.PrefixedPath = exports.prefixPathPrefix = exports.prefixFieldPath = expo
|
|
|
9
9
|
const internal_1 = require("@fluidframework/core-utils/internal");
|
|
10
10
|
const index_js_1 = require("../core/index.js");
|
|
11
11
|
const index_js_2 = require("../util/index.js");
|
|
12
|
+
const internal_2 = require("@fluidframework/telemetry-utils/internal");
|
|
12
13
|
/**
|
|
13
14
|
* Create a cursor, in `nodes` mode at the root of the provided tree.
|
|
14
15
|
*
|
|
@@ -108,7 +109,9 @@ class StackCursor extends SynchronousCursor {
|
|
|
108
109
|
enterNode(index) {
|
|
109
110
|
// assert(this.mode === CursorLocationType.Fields, "must be in fields mode");
|
|
110
111
|
const siblings = this.getField();
|
|
111
|
-
|
|
112
|
+
if (!(index in siblings)) {
|
|
113
|
+
throw new internal_2.UsageError("A child does not exist at the specified index, check the status of a node using `Tree.status()`.");
|
|
114
|
+
}
|
|
112
115
|
this.siblingStack.push(this.siblings);
|
|
113
116
|
this.indexStack.push(this.index);
|
|
114
117
|
this.index = index;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"treeCursorUtils.js","sourceRoot":"","sources":["../../src/feature-libraries/treeCursorUtils.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;;AAEH,kEAAkE;AAElE,+CAa0B;AAC1B,+CAAwC;AAwBxC;;;;GAIG;AACH,SAAgB,mBAAmB,CAClC,OAA6B,EAC7B,IAAW;IAEX,OAAO,IAAI,WAAW,CAAC,OAAO,EAAE,EAAE,EAAE,EAAE,EAAE,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC,CAAC;AACpD,CAAC;AALD,kDAKC;AAED;;;;GAIG;AACH,SAAgB,oBAAoB,CACnC,OAA6B,EAC7B,IAAW,EACX,gBAA+B,oBAAS;IAExC,MAAM,MAAM,GAAG,mBAAmB,CAAC,OAAO,EAAE,IAAI,CAAC,CAAC;IAClD,+FAA+F;IAC/F,kGAAkG;IAClG,MAAM,CAAC,UAAU,CAAC,IAAA,6BAAkB,EAAC,aAAa,CAAC,CAAC,CAAC;IACrD,OAAO,MAAM,CAAC;AACf,CAAC;AAVD,oDAUC;AA0BD;;GAEG;AACH,MAAsB,iBAAiB;IAAvC;QACiB,QAAc,GAAG,IAAI,CAAC;QACtB,YAAO,GAAG,KAAK,CAAC;IAKjC,CAAC;IAHO,iBAAiB;QACvB,OAAO,IAAI,CAAC;IACb,CAAC;CACD;AAPD,8CAOC;KANiB,uBAAY;AAQ9B;;;;;;;;;;;;GAYG;AACH,MAAM,WAAmB,SAAQ,iBAAiB;IAEjD;;;;;;;;;;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AI,CAAC,WAAW,GAAG,MAAM,CAAC,iBAAiB,IAAI,IAAI,CAAC,WAAW,CAAC;YAChE,IAAI,CAAC,WAAW,GAAG,IAAI,CAAC,WAAW,GAAG,CAAC,MAAM,CAAC,WAAW,IAAI,CAAC,CAAC,CAAC;QACjE,CAAC;aAAM,CAAC;YACP,IAAI,CAAC,WAAW,GAAG,IAAI,CAAC,WAAW,CAAC;YACpC,IAAI,CAAC,WAAW,GAAG,IAAI,CAAC,WAAW,CAAC;QACrC,CAAC;IACF,CAAC;IACD,IAAW,MAAM;QAChB,OAAO,WAAW,CAAC,IAAI,CAAC,MAAM,EAAE,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;IACnD,CAAC;CACD;AAlBD,oCAkBC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { assert, oob } from \"@fluidframework/core-utils/internal\";\n\nimport {\n\tCursorLocationType,\n\tCursorMarker,\n\ttype DetachedField,\n\ttype FieldKey,\n\ttype FieldUpPath,\n\ttype ITreeCursorSynchronous,\n\ttype PathRootPrefix,\n\ttype TreeType,\n\ttype UpPath,\n\ttype Value,\n\tdetachedFieldAsKey,\n\trootField,\n} from \"../core/index.js\";\nimport { fail } from \"../util/index.js\";\n\n/**\n * {@link ITreeCursorSynchronous} that can return the underlying node objects.\n */\nexport interface CursorWithNode<TNode> extends ITreeCursorSynchronous {\n\t/**\n\t * Gets the underlying object for the current node.\n\t *\n\t * Only valid when `mode` is `Nodes`.\n\t */\n\tgetNode(): TNode;\n\n\t/**\n\t * Create a copy of this cursor which navigates independently,\n\t * and is initially located at the same place as this one.\n\t *\n\t * Depending on the cursor implementation this may be significantly faster\n\t * than other ways to copy the cursor\n\t * (such as creating a new one and walking the path from this one).\n\t */\n\tfork(): CursorWithNode<TNode>;\n}\n\n/**\n * Create a cursor, in `nodes` mode at the root of the provided tree.\n *\n * @returns an {@link ITreeCursorSynchronous} for a single root in `nodes` mode.\n */\nexport function stackTreeNodeCursor<TNode>(\n\tadapter: CursorAdapter<TNode>,\n\troot: TNode,\n): CursorWithNode<TNode> {\n\treturn new StackCursor(adapter, [], [], [root], 0);\n}\n\n/**\n * Create a cursor, in `fields` mode at the `detachedField` under the provided `root`.\n *\n * @returns an {@link ITreeCursorSynchronous} for `detachedField` of `root` in `fields` mode.\n */\nexport function stackTreeFieldCursor<TNode>(\n\tadapter: CursorAdapter<TNode>,\n\troot: TNode,\n\tdetachedField: DetachedField = rootField,\n): CursorWithNode<TNode> {\n\tconst cursor = stackTreeNodeCursor(adapter, root);\n\t// Because the root node in `stackTreeNodeCursor` is treated as the above detached fields node,\n\t// using it then just entering the correct field doesn't mess up the paths reported by the cursor.\n\tcursor.enterField(detachedFieldAsKey(detachedField));\n\treturn cursor;\n}\n\n/**\n * Provides functionality to allow a {@link stackTreeNodeCursor} and {@link stackTreeFieldCursor} to implement cursors.\n */\nexport interface CursorAdapter<TNode> {\n\t/**\n\t * @returns the value of the given node.\n\t */\n\tvalue(node: TNode): Value;\n\t/**\n\t * @returns the type of the given node.\n\t */\n\ttype(node: TNode): TreeType;\n\t/**\n\t * @returns the keys for non-empty fields on the given node.\n\t */\n\tkeysFromNode(node: TNode): readonly FieldKey[];\n\t/**\n\t * @returns the child nodes for the given node and key.\n\t */\n\tgetFieldFromNode(node: TNode, key: FieldKey): readonly TNode[];\n}\n\ntype SiblingsOrKey<TNode> = readonly TNode[] | readonly FieldKey[];\n\n/**\n * A class that satisfies part of the ITreeCursorSynchronous implementation.\n */\nexport abstract class SynchronousCursor {\n\tpublic readonly [CursorMarker] = true;\n\tpublic readonly pending = false;\n\n\tpublic skipPendingFields(): boolean {\n\t\treturn true;\n\t}\n}\n\n/**\n * A simple general purpose ITreeCursorSynchronous implementation.\n *\n * As this is a generic implementation, it's ability to optimize is limited.\n *\n * @privateRemarks\n * Note that TNode can be `null` (and we should support `undefined` as well),\n * so be careful using types like `TNode | undefined` and expressions like `TNode ??`.\n *\n * TODO:\n * 1. Unit tests for this.\n * 2. Support for cursors which are field cursors at the root.\n */\nclass StackCursor<TNode> extends SynchronousCursor implements CursorWithNode<TNode> {\n\tpublic readonly [CursorMarker] = true;\n\t/**\n\t * Might start at special root where fields are detached sequences.\n\t *\n\t * @param adapter - policy logic.\n\t * @param siblingStack - Stack of collections of siblings along the path through the tree:\n\t * does not include current level (which is stored in `siblings`).\n\t * Even levels in the stack (starting from 0) are sequences of nodes and odd levels\n\t * are for fields keys on a node.\n\t * @param indexStack - Stack of indices into the corresponding levels in `siblingStack`.\n\t * @param siblings - Siblings at the current level (not included in `siblingStack`).\n\t * @param index - Index into `siblings`.\n\t */\n\tpublic constructor(\n\t\tprivate readonly adapter: CursorAdapter<TNode>,\n\t\tprivate readonly siblingStack: SiblingsOrKey<TNode>[],\n\t\tprivate readonly indexStack: number[],\n\t\tprivate siblings: SiblingsOrKey<TNode>,\n\t\tprivate index: number,\n\t) {\n\t\tsuper();\n\t}\n\n\tpublic getFieldKey(): FieldKey {\n\t\t// assert(this.mode === CursorLocationType.Fields, \"must be in fields mode\");\n\t\treturn this.siblings[this.index] as FieldKey;\n\t}\n\n\tprivate getStackedFieldKey(height: number): FieldKey {\n\t\tassert(height % 2 === 1, 0x3b8 /* must field height */);\n\t\tconst siblingStack = this.siblingStack[height] ?? oob();\n\t\tconst indexStack = this.indexStack[height] ?? oob();\n\t\treturn siblingStack[indexStack] as FieldKey;\n\t}\n\n\tprivate getStackedNodeIndex(height: number): number {\n\t\t// assert(height % 2 === 0, \"must be node height\");\n\t\treturn this.indexStack[height] ?? oob();\n\t}\n\n\tprivate getStackedNode(height: number): TNode {\n\t\tconst index = this.getStackedNodeIndex(height);\n\t\t// Test is failing when using `?? oob()` here.\n\t\t// eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n\t\treturn (this.siblingStack[height] as readonly TNode[])[index]!;\n\t}\n\n\tpublic getFieldLength(): number {\n\t\t// assert(this.mode === CursorLocationType.Fields, \"must be in fields mode\");\n\t\treturn this.getField().length;\n\t}\n\n\tpublic enterNode(index: number): void {\n\t\t// assert(this.mode === CursorLocationType.Fields, \"must be in fields mode\");\n\t\tconst siblings = this.getField();\n\t\tassert(index in siblings, 0x405 /* child must exist at index */);\n\t\tthis.siblingStack.push(this.siblings);\n\t\tthis.indexStack.push(this.index);\n\t\tthis.index = index;\n\t\tthis.siblings = siblings;\n\t}\n\n\tpublic getPath(prefix?: PathRootPrefix): UpPath | undefined {\n\t\tassert(this.mode === CursorLocationType.Nodes, 0x3b9 /* must be in nodes mode */);\n\t\treturn this.getOffsetPath(0, prefix);\n\t}\n\n\tpublic getFieldPath(prefix?: PathRootPrefix): FieldUpPath {\n\t\tassert(this.mode === CursorLocationType.Fields, 0x449 /* must be in fields mode */);\n\t\treturn {\n\t\t\tfield:\n\t\t\t\tthis.indexStack.length === 1\n\t\t\t\t\t? (prefix?.rootFieldOverride ?? this.getFieldKey())\n\t\t\t\t\t: this.getFieldKey(),\n\t\t\tparent: this.getOffsetPath(1, prefix),\n\t\t};\n\t}\n\n\tprivate getOffsetPath(\n\t\toffset: number,\n\t\tprefix: PathRootPrefix | undefined,\n\t): UpPath | undefined {\n\t\t// It is more efficient to handle prefix directly in here rather than delegating to PrefixedPath.\n\n\t\tconst length = this.indexStack.length - offset;\n\t\tif (length === 0) {\n\t\t\treturn prefix?.parent; // At root\n\t\t}\n\n\t\tassert(length > 0, 0x44a /* invalid offset to above root */);\n\t\tassert(length % 2 === 0, 0x44b /* offset path must point to node not field */);\n\n\t\tconst getIndex = (height: number): number => {\n\t\t\tlet parentIndex: number =\n\t\t\t\theight === this.indexStack.length ? this.index : this.getStackedNodeIndex(height);\n\t\t\tif (prefix !== undefined && height === 2) {\n\t\t\t\tparentIndex += prefix.indexOffset ?? 0;\n\t\t\t}\n\t\t\treturn parentIndex;\n\t\t};\n\n\t\t// Perf Note:\n\t\t// This is O(depth) in tree.\n\t\t// If many different anchors are created, this could be optimized to amortize the costs.\n\t\t// For example, the cursor could cache UpPaths from the anchorSet when creating an anchor,\n\t\t// then reuse them as a starting point when making another.\n\t\t// Could cache this at one depth, and remember the depth.\n\t\t// When navigating up, adjust cached anchor if present.\n\n\t\tlet path: UpPath | undefined = prefix?.parent;\n\t\t// Skip top level, since root node in path is \"undefined\" and does not have a parent or index.\n\t\tfor (let height = 2; height <= length; height += 2) {\n\t\t\tconst fieldOverride = height === 2 ? prefix?.rootFieldOverride : undefined;\n\t\t\tpath = {\n\t\t\t\tparent: path,\n\t\t\t\tparentIndex: getIndex(height),\n\t\t\t\tparentField: fieldOverride ?? this.getStackedFieldKey(height - 1),\n\t\t\t};\n\t\t}\n\n\t\treturn path;\n\t}\n\n\tpublic fork(): StackCursor<TNode> {\n\t\t// Siblings arrays are not modified during navigation and do not need be be copied.\n\t\t// This allows this copy to be shallow, and `this.siblings` below to not be copied as all.\n\t\treturn new StackCursor<TNode>(\n\t\t\tthis.adapter,\n\t\t\t[...this.siblingStack],\n\t\t\t[...this.indexStack],\n\t\t\tthis.siblings,\n\t\t\tthis.index,\n\t\t);\n\t}\n\n\tpublic enterField(key: FieldKey): void {\n\t\t// assert(this.mode === CursorLocationType.Nodes, \"must be in nodes mode\");\n\t\tthis.siblingStack.push(this.siblings);\n\t\tthis.indexStack.push(this.index);\n\n\t\t// For fields, siblings are only used for key lookup and\n\t\t// nextField and which has arbitrary iteration order,\n\t\t// so making a array of just key here works.\n\t\t// This adds an allocation, so it's optimizing code simplicity and for the other use case (enumeration)\n\t\t// at the cost of an allocation here.\n\t\tthis.index = 0;\n\t\tthis.siblings = [key];\n\t}\n\n\tpublic get mode(): CursorLocationType {\n\t\treturn this.siblingStack.length % 2 === 0\n\t\t\t? CursorLocationType.Nodes\n\t\t\t: CursorLocationType.Fields;\n\t}\n\n\tpublic nextField(): boolean {\n\t\tthis.index += 1;\n\t\tif (this.index === (this.siblings as []).length) {\n\t\t\tthis.exitField();\n\t\t\treturn false;\n\t\t}\n\t\treturn true;\n\t}\n\n\tpublic firstField(): boolean {\n\t\t// assert(this.mode === CursorLocationType.Nodes, \"must be in nodes mode\");\n\t\tconst fields = this.adapter.keysFromNode(this.getNode());\n\t\tif (fields.length === 0) {\n\t\t\treturn false;\n\t\t}\n\n\t\tthis.siblingStack.push(this.siblings);\n\t\tthis.indexStack.push(this.index);\n\t\tthis.index = 0;\n\t\tthis.siblings = fields;\n\t\treturn true;\n\t}\n\n\tpublic seekNodes(offset: number): boolean {\n\t\t// assert(this.mode === CursorLocationType.Nodes, \"can only seekNodes when in Nodes\");\n\t\tthis.index += offset;\n\t\tif (this.index in this.siblings) {\n\t\t\treturn true;\n\t\t}\n\t\tthis.exitNode();\n\t\treturn false;\n\t}\n\n\tpublic firstNode(): boolean {\n\t\t// assert(this.mode === CursorLocationType.Fields, \"firstNode only allowed in fields mode\");\n\t\tconst nodes = this.getField();\n\t\tif (nodes.length === 0) {\n\t\t\treturn false;\n\t\t}\n\t\tthis.siblingStack.push(this.siblings);\n\t\tthis.indexStack.push(this.index);\n\t\tthis.index = 0;\n\t\tthis.siblings = nodes;\n\t\treturn true;\n\t}\n\n\tpublic nextNode(): boolean {\n\t\tassert(\n\t\t\tthis.mode === CursorLocationType.Nodes,\n\t\t\t0x406 /* can only nextNode when in Nodes */,\n\t\t);\n\t\tthis.index++;\n\t\tif (this.index < (this.siblings as []).length) {\n\t\t\treturn true;\n\t\t}\n\t\tthis.exitNode();\n\t\treturn false;\n\t}\n\n\tpublic exitField(): void {\n\t\t// assert(this.mode === CursorLocationType.Fields, \"can only navigate up from field when in field\");\n\t\tthis.siblings = this.siblingStack.pop() ?? fail(\"Unexpected siblingStack.length\");\n\t\tthis.index = this.indexStack.pop() ?? fail(\"Unexpected indexStack.length\");\n\t}\n\n\tpublic exitNode(): void {\n\t\t// assert(this.mode === CursorLocationType.Nodes, \"can only navigate up from node when in node\");\n\t\tthis.siblings = this.siblingStack.pop() ?? fail(\"Unexpected siblingStack.length\");\n\t\tthis.index = this.indexStack.pop() ?? fail(\"Unexpected indexStack.length\");\n\t}\n\n\tpublic getNode(): TNode {\n\t\t// assert(this.mode === CursorLocationType.Nodes, \"can only get node when in node\");\n\t\t// Test is failing when using `?? oob()` here.\n\t\t// eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n\t\treturn (this.siblings as TNode[])[this.index]!;\n\t}\n\n\tprivate getField(): readonly TNode[] {\n\t\t// assert(this.mode === CursorLocationType.Fields, \"can only get field when in fields\");\n\t\tconst parent = this.getStackedNode(this.indexStack.length - 1);\n\t\tconst key: FieldKey = this.getFieldKey();\n\t\tconst field = this.adapter.getFieldFromNode(parent, key);\n\t\treturn field;\n\t}\n\n\t/**\n\t * @returns the value of the current node\n\t */\n\tpublic get value(): Value {\n\t\treturn this.adapter.value(this.getNode());\n\t}\n\n\t/**\n\t * @returns the type of the current node\n\t */\n\tpublic get type(): TreeType {\n\t\treturn this.adapter.type(this.getNode());\n\t}\n\n\tpublic get fieldIndex(): number {\n\t\t// assert(this.mode === CursorLocationType.Nodes, \"can only node's index when in node\");\n\t\treturn this.index;\n\t}\n\n\tpublic get chunkStart(): number {\n\t\treturn this.fieldIndex;\n\t}\n\n\tpublic readonly chunkLength = 1;\n}\n\n/**\n * Apply `prefix` to `path`.\n */\nexport function prefixPath(\n\tprefix: PathRootPrefix | undefined,\n\tpath: UpPath | undefined,\n): UpPath | undefined {\n\tif (prefix === undefined) {\n\t\treturn path;\n\t}\n\tif (\n\t\tprefix.parent === undefined &&\n\t\tprefix.rootFieldOverride === undefined &&\n\t\t(prefix.indexOffset ?? 0) === 0\n\t) {\n\t\treturn path;\n\t}\n\treturn applyPrefix(prefix, path);\n}\n\n/**\n * Apply `prefix` to `path`.\n */\nexport function prefixFieldPath(\n\tprefix: PathRootPrefix | undefined,\n\tpath: FieldUpPath,\n): FieldUpPath {\n\tif (prefix === undefined) {\n\t\treturn path;\n\t}\n\tif (\n\t\tprefix.parent === undefined &&\n\t\tprefix.rootFieldOverride === undefined &&\n\t\t(prefix.indexOffset ?? 0) === 0\n\t) {\n\t\treturn path;\n\t}\n\treturn {\n\t\tfield: path.parent === undefined ? (prefix.rootFieldOverride ?? path.field) : path.field,\n\t\tparent: prefixPath(prefix, path.parent),\n\t};\n}\n\n/**\n * Compose two prefixes together.\n * `prefixFieldPath(root, prefixFieldPath(inner, path))` should be the same as `prefixFieldPath(prefixPathPrefix(root, inner), path))`\n *\n * TODO: tests for this.\n */\nexport function prefixPathPrefix(root: PathRootPrefix, inner: PathRootPrefix): PathRootPrefix {\n\tif (inner.parent !== undefined) {\n\t\tconst composedPrefix: PathRootPrefix = {\n\t\t\tparent: new PrefixedPath(root, inner.parent),\n\t\t\trootFieldOverride: inner.rootFieldOverride,\n\t\t\tindexOffset: inner.indexOffset,\n\t\t};\n\t\treturn composedPrefix;\n\t} else {\n\t\tconst composedPrefix: PathRootPrefix = {\n\t\t\tparent: root.parent,\n\t\t\trootFieldOverride: root.rootFieldOverride ?? inner.rootFieldOverride,\n\t\t\tindexOffset: (inner.indexOffset ?? 0) + (root.indexOffset ?? 0),\n\t\t};\n\t\treturn composedPrefix;\n\t}\n}\n\nfunction applyPrefix(prefix: PathRootPrefix, path: UpPath | undefined): UpPath | undefined {\n\tif (path === undefined) {\n\t\treturn prefix.parent;\n\t} else {\n\t\t// As an optimization, avoid double wrapping paths with multiple prefixes\n\t\tif (path instanceof PrefixedPath) {\n\t\t\tconst composedPrefix: PathRootPrefix = prefixPathPrefix(prefix, path.prefix);\n\t\t\treturn new PrefixedPath(composedPrefix, path.path);\n\t\t} else {\n\t\t\treturn new PrefixedPath(prefix, path);\n\t\t}\n\t}\n}\n\n/**\n * Wrapper around a path that adds a prefix to the root.\n *\n * Exported for testing: use `prefixPath` and `prefixFieldPath` to construct.\n */\nexport class PrefixedPath implements UpPath {\n\tpublic readonly parentField: FieldKey;\n\tpublic readonly parentIndex: number;\n\tpublic constructor(\n\t\tpublic readonly prefix: PathRootPrefix,\n\t\tpublic readonly path: UpPath,\n\t) {\n\t\tif (path.parent === undefined) {\n\t\t\tthis.parentField = prefix.rootFieldOverride ?? path.parentField;\n\t\t\tthis.parentIndex = path.parentIndex + (prefix.indexOffset ?? 0);\n\t\t} else {\n\t\t\tthis.parentField = path.parentField;\n\t\t\tthis.parentIndex = path.parentIndex;\n\t\t}\n\t}\n\tpublic get parent(): UpPath | undefined {\n\t\treturn applyPrefix(this.prefix, this.path.parent);\n\t}\n}\n"]}
|
|
1
|
+
{"version":3,"file":"treeCursorUtils.js","sourceRoot":"","sources":["../../src/feature-libraries/treeCursorUtils.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;;AAEH,kEAAkE;AAElE,+CAa0B;AAC1B,+CAAwC;AACxC,uEAAsE;AAwBtE;;;;GAIG;AACH,SAAgB,mBAAmB,CAClC,OAA6B,EAC7B,IAAW;IAEX,OAAO,IAAI,WAAW,CAAC,OAAO,EAAE,EAAE,EAAE,EAAE,EAAE,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC,CAAC;AACpD,CAAC;AALD,kDAKC;AAED;;;;GAIG;AACH,SAAgB,oBAAoB,CACnC,OAA6B,EAC7B,IAAW,EACX,gBAA+B,oBAAS;IAExC,MAAM,MAAM,GAAG,mBAAmB,CAAC,OAAO,EAAE,IAAI,CAAC,CAAC;IAClD,+FAA+F;IAC/F,kGAAkG;IAClG,MAAM,CAAC,UAAU,CAAC,IAAA,6BAAkB,EAAC,aAAa,CAAC,CAAC,CAAC;IACrD,OAAO,MAAM,CAAC;AACf,CAAC;AAVD,oDAUC;AA0BD;;GAEG;AACH,MAAsB,iBAAiB;IAAvC;QACiB,QAAc,GAAG,IAAI,CAAC;QACtB,YAAO,GAAG,KAAK,CAAC;IAKjC,CAAC;IAHO,iBAAiB;QACvB,OAAO,IAAI,CAAC;IACb,CAAC;CACD;AAPD,8CAOC;KANiB,uBAAY;AAQ9B;;;;;;;;;;;;GAYG;AACH,MAAM,WAAmB,SAAQ,iBAAiB;IAEjD;;;;;;;;;;;OAWG;IACH,YACkB,OAA6B,EAC7B,YAAoC,EACpC,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AAC,WAAW,GAAG,MAAM,CAAC,iBAAiB,IAAI,IAAI,CAAC,WAAW,CAAC;YAChE,IAAI,CAAC,WAAW,GAAG,IAAI,CAAC,WAAW,GAAG,CAAC,MAAM,CAAC,WAAW,IAAI,CAAC,CAAC,CAAC;QACjE,CAAC;aAAM,CAAC;YACP,IAAI,CAAC,WAAW,GAAG,IAAI,CAAC,WAAW,CAAC;YACpC,IAAI,CAAC,WAAW,GAAG,IAAI,CAAC,WAAW,CAAC;QACrC,CAAC;IACF,CAAC;IACD,IAAW,MAAM;QAChB,OAAO,WAAW,CAAC,IAAI,CAAC,MAAM,EAAE,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;IACnD,CAAC;CACD;AAlBD,oCAkBC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { assert, oob } from \"@fluidframework/core-utils/internal\";\n\nimport {\n\tCursorLocationType,\n\tCursorMarker,\n\ttype DetachedField,\n\ttype FieldKey,\n\ttype FieldUpPath,\n\ttype ITreeCursorSynchronous,\n\ttype PathRootPrefix,\n\ttype TreeType,\n\ttype UpPath,\n\ttype Value,\n\tdetachedFieldAsKey,\n\trootField,\n} from \"../core/index.js\";\nimport { fail } from \"../util/index.js\";\nimport { UsageError } from \"@fluidframework/telemetry-utils/internal\";\n\n/**\n * {@link ITreeCursorSynchronous} that can return the underlying node objects.\n */\nexport interface CursorWithNode<TNode> extends ITreeCursorSynchronous {\n\t/**\n\t * Gets the underlying object for the current node.\n\t *\n\t * Only valid when `mode` is `Nodes`.\n\t */\n\tgetNode(): TNode;\n\n\t/**\n\t * Create a copy of this cursor which navigates independently,\n\t * and is initially located at the same place as this one.\n\t *\n\t * Depending on the cursor implementation this may be significantly faster\n\t * than other ways to copy the cursor\n\t * (such as creating a new one and walking the path from this one).\n\t */\n\tfork(): CursorWithNode<TNode>;\n}\n\n/**\n * Create a cursor, in `nodes` mode at the root of the provided tree.\n *\n * @returns an {@link ITreeCursorSynchronous} for a single root in `nodes` mode.\n */\nexport function stackTreeNodeCursor<TNode>(\n\tadapter: CursorAdapter<TNode>,\n\troot: TNode,\n): CursorWithNode<TNode> {\n\treturn new StackCursor(adapter, [], [], [root], 0);\n}\n\n/**\n * Create a cursor, in `fields` mode at the `detachedField` under the provided `root`.\n *\n * @returns an {@link ITreeCursorSynchronous} for `detachedField` of `root` in `fields` mode.\n */\nexport function stackTreeFieldCursor<TNode>(\n\tadapter: CursorAdapter<TNode>,\n\troot: TNode,\n\tdetachedField: DetachedField = rootField,\n): CursorWithNode<TNode> {\n\tconst cursor = stackTreeNodeCursor(adapter, root);\n\t// Because the root node in `stackTreeNodeCursor` is treated as the above detached fields node,\n\t// using it then just entering the correct field doesn't mess up the paths reported by the cursor.\n\tcursor.enterField(detachedFieldAsKey(detachedField));\n\treturn cursor;\n}\n\n/**\n * Provides functionality to allow a {@link stackTreeNodeCursor} and {@link stackTreeFieldCursor} to implement cursors.\n */\nexport interface CursorAdapter<TNode> {\n\t/**\n\t * @returns the value of the given node.\n\t */\n\tvalue(node: TNode): Value;\n\t/**\n\t * @returns the type of the given node.\n\t */\n\ttype(node: TNode): TreeType;\n\t/**\n\t * @returns the keys for non-empty fields on the given node.\n\t */\n\tkeysFromNode(node: TNode): readonly FieldKey[];\n\t/**\n\t * @returns the child nodes for the given node and key.\n\t */\n\tgetFieldFromNode(node: TNode, key: FieldKey): readonly TNode[];\n}\n\ntype SiblingsOrKey<TNode> = readonly TNode[] | readonly FieldKey[];\n\n/**\n * A class that satisfies part of the ITreeCursorSynchronous implementation.\n */\nexport abstract class SynchronousCursor {\n\tpublic readonly [CursorMarker] = true;\n\tpublic readonly pending = false;\n\n\tpublic skipPendingFields(): boolean {\n\t\treturn true;\n\t}\n}\n\n/**\n * A simple general purpose ITreeCursorSynchronous implementation.\n *\n * As this is a generic implementation, it's ability to optimize is limited.\n *\n * @privateRemarks\n * Note that TNode can be `null` (and we should support `undefined` as well),\n * so be careful using types like `TNode | undefined` and expressions like `TNode ??`.\n *\n * TODO:\n * 1. Unit tests for this.\n * 2. Support for cursors which are field cursors at the root.\n */\nclass StackCursor<TNode> extends SynchronousCursor implements CursorWithNode<TNode> {\n\tpublic readonly [CursorMarker] = true;\n\t/**\n\t * Might start at special root where fields are detached sequences.\n\t *\n\t * @param adapter - policy logic.\n\t * @param siblingStack - Stack of collections of siblings along the path through the tree:\n\t * does not include current level (which is stored in `siblings`).\n\t * Even levels in the stack (starting from 0) are sequences of nodes and odd levels\n\t * are for fields keys on a node.\n\t * @param indexStack - Stack of indices into the corresponding levels in `siblingStack`.\n\t * @param siblings - Siblings at the current level (not included in `siblingStack`).\n\t * @param index - Index into `siblings`.\n\t */\n\tpublic constructor(\n\t\tprivate readonly adapter: CursorAdapter<TNode>,\n\t\tprivate readonly siblingStack: SiblingsOrKey<TNode>[],\n\t\tprivate readonly indexStack: number[],\n\t\tprivate siblings: SiblingsOrKey<TNode>,\n\t\tprivate index: number,\n\t) {\n\t\tsuper();\n\t}\n\n\tpublic getFieldKey(): FieldKey {\n\t\t// assert(this.mode === CursorLocationType.Fields, \"must be in fields mode\");\n\t\treturn this.siblings[this.index] as FieldKey;\n\t}\n\n\tprivate getStackedFieldKey(height: number): FieldKey {\n\t\tassert(height % 2 === 1, 0x3b8 /* must field height */);\n\t\tconst siblingStack = this.siblingStack[height] ?? oob();\n\t\tconst indexStack = this.indexStack[height] ?? oob();\n\t\treturn siblingStack[indexStack] as FieldKey;\n\t}\n\n\tprivate getStackedNodeIndex(height: number): number {\n\t\t// assert(height % 2 === 0, \"must be node height\");\n\t\treturn this.indexStack[height] ?? oob();\n\t}\n\n\tprivate getStackedNode(height: number): TNode {\n\t\tconst index = this.getStackedNodeIndex(height);\n\t\t// Test is failing when using `?? oob()` here.\n\t\t// eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n\t\treturn (this.siblingStack[height] as readonly TNode[])[index]!;\n\t}\n\n\tpublic getFieldLength(): number {\n\t\t// assert(this.mode === CursorLocationType.Fields, \"must be in fields mode\");\n\t\treturn this.getField().length;\n\t}\n\n\tpublic enterNode(index: number): void {\n\t\t// assert(this.mode === CursorLocationType.Fields, \"must be in fields mode\");\n\t\tconst siblings = this.getField();\n\t\tif (!(index in siblings)) {\n\t\t\tthrow new UsageError(\n\t\t\t\t\"A child does not exist at the specified index, check the status of a node using `Tree.status()`.\",\n\t\t\t);\n\t\t}\n\t\tthis.siblingStack.push(this.siblings);\n\t\tthis.indexStack.push(this.index);\n\t\tthis.index = index;\n\t\tthis.siblings = siblings;\n\t}\n\n\tpublic getPath(prefix?: PathRootPrefix): UpPath | undefined {\n\t\tassert(this.mode === CursorLocationType.Nodes, 0x3b9 /* must be in nodes mode */);\n\t\treturn this.getOffsetPath(0, prefix);\n\t}\n\n\tpublic getFieldPath(prefix?: PathRootPrefix): FieldUpPath {\n\t\tassert(this.mode === CursorLocationType.Fields, 0x449 /* must be in fields mode */);\n\t\treturn {\n\t\t\tfield:\n\t\t\t\tthis.indexStack.length === 1\n\t\t\t\t\t? (prefix?.rootFieldOverride ?? this.getFieldKey())\n\t\t\t\t\t: this.getFieldKey(),\n\t\t\tparent: this.getOffsetPath(1, prefix),\n\t\t};\n\t}\n\n\tprivate getOffsetPath(\n\t\toffset: number,\n\t\tprefix: PathRootPrefix | undefined,\n\t): UpPath | undefined {\n\t\t// It is more efficient to handle prefix directly in here rather than delegating to PrefixedPath.\n\n\t\tconst length = this.indexStack.length - offset;\n\t\tif (length === 0) {\n\t\t\treturn prefix?.parent; // At root\n\t\t}\n\n\t\tassert(length > 0, 0x44a /* invalid offset to above root */);\n\t\tassert(length % 2 === 0, 0x44b /* offset path must point to node not field */);\n\n\t\tconst getIndex = (height: number): number => {\n\t\t\tlet parentIndex: number =\n\t\t\t\theight === this.indexStack.length ? this.index : this.getStackedNodeIndex(height);\n\t\t\tif (prefix !== undefined && height === 2) {\n\t\t\t\tparentIndex += prefix.indexOffset ?? 0;\n\t\t\t}\n\t\t\treturn parentIndex;\n\t\t};\n\n\t\t// Perf Note:\n\t\t// This is O(depth) in tree.\n\t\t// If many different anchors are created, this could be optimized to amortize the costs.\n\t\t// For example, the cursor could cache UpPaths from the anchorSet when creating an anchor,\n\t\t// then reuse them as a starting point when making another.\n\t\t// Could cache this at one depth, and remember the depth.\n\t\t// When navigating up, adjust cached anchor if present.\n\n\t\tlet path: UpPath | undefined = prefix?.parent;\n\t\t// Skip top level, since root node in path is \"undefined\" and does not have a parent or index.\n\t\tfor (let height = 2; height <= length; height += 2) {\n\t\t\tconst fieldOverride = height === 2 ? prefix?.rootFieldOverride : undefined;\n\t\t\tpath = {\n\t\t\t\tparent: path,\n\t\t\t\tparentIndex: getIndex(height),\n\t\t\t\tparentField: fieldOverride ?? this.getStackedFieldKey(height - 1),\n\t\t\t};\n\t\t}\n\n\t\treturn path;\n\t}\n\n\tpublic fork(): StackCursor<TNode> {\n\t\t// Siblings arrays are not modified during navigation and do not need be be copied.\n\t\t// This allows this copy to be shallow, and `this.siblings` below to not be copied as all.\n\t\treturn new StackCursor<TNode>(\n\t\t\tthis.adapter,\n\t\t\t[...this.siblingStack],\n\t\t\t[...this.indexStack],\n\t\t\tthis.siblings,\n\t\t\tthis.index,\n\t\t);\n\t}\n\n\tpublic enterField(key: FieldKey): void {\n\t\t// assert(this.mode === CursorLocationType.Nodes, \"must be in nodes mode\");\n\t\tthis.siblingStack.push(this.siblings);\n\t\tthis.indexStack.push(this.index);\n\n\t\t// For fields, siblings are only used for key lookup and\n\t\t// nextField and which has arbitrary iteration order,\n\t\t// so making a array of just key here works.\n\t\t// This adds an allocation, so it's optimizing code simplicity and for the other use case (enumeration)\n\t\t// at the cost of an allocation here.\n\t\tthis.index = 0;\n\t\tthis.siblings = [key];\n\t}\n\n\tpublic get mode(): CursorLocationType {\n\t\treturn this.siblingStack.length % 2 === 0\n\t\t\t? CursorLocationType.Nodes\n\t\t\t: CursorLocationType.Fields;\n\t}\n\n\tpublic nextField(): boolean {\n\t\tthis.index += 1;\n\t\tif (this.index === (this.siblings as []).length) {\n\t\t\tthis.exitField();\n\t\t\treturn false;\n\t\t}\n\t\treturn true;\n\t}\n\n\tpublic firstField(): boolean {\n\t\t// assert(this.mode === CursorLocationType.Nodes, \"must be in nodes mode\");\n\t\tconst fields = this.adapter.keysFromNode(this.getNode());\n\t\tif (fields.length === 0) {\n\t\t\treturn false;\n\t\t}\n\n\t\tthis.siblingStack.push(this.siblings);\n\t\tthis.indexStack.push(this.index);\n\t\tthis.index = 0;\n\t\tthis.siblings = fields;\n\t\treturn true;\n\t}\n\n\tpublic seekNodes(offset: number): boolean {\n\t\t// assert(this.mode === CursorLocationType.Nodes, \"can only seekNodes when in Nodes\");\n\t\tthis.index += offset;\n\t\tif (this.index in this.siblings) {\n\t\t\treturn true;\n\t\t}\n\t\tthis.exitNode();\n\t\treturn false;\n\t}\n\n\tpublic firstNode(): boolean {\n\t\t// assert(this.mode === CursorLocationType.Fields, \"firstNode only allowed in fields mode\");\n\t\tconst nodes = this.getField();\n\t\tif (nodes.length === 0) {\n\t\t\treturn false;\n\t\t}\n\t\tthis.siblingStack.push(this.siblings);\n\t\tthis.indexStack.push(this.index);\n\t\tthis.index = 0;\n\t\tthis.siblings = nodes;\n\t\treturn true;\n\t}\n\n\tpublic nextNode(): boolean {\n\t\tassert(\n\t\t\tthis.mode === CursorLocationType.Nodes,\n\t\t\t0x406 /* can only nextNode when in Nodes */,\n\t\t);\n\t\tthis.index++;\n\t\tif (this.index < (this.siblings as []).length) {\n\t\t\treturn true;\n\t\t}\n\t\tthis.exitNode();\n\t\treturn false;\n\t}\n\n\tpublic exitField(): void {\n\t\t// assert(this.mode === CursorLocationType.Fields, \"can only navigate up from field when in field\");\n\t\tthis.siblings = this.siblingStack.pop() ?? fail(\"Unexpected siblingStack.length\");\n\t\tthis.index = this.indexStack.pop() ?? fail(\"Unexpected indexStack.length\");\n\t}\n\n\tpublic exitNode(): void {\n\t\t// assert(this.mode === CursorLocationType.Nodes, \"can only navigate up from node when in node\");\n\t\tthis.siblings = this.siblingStack.pop() ?? fail(\"Unexpected siblingStack.length\");\n\t\tthis.index = this.indexStack.pop() ?? fail(\"Unexpected indexStack.length\");\n\t}\n\n\tpublic getNode(): TNode {\n\t\t// assert(this.mode === CursorLocationType.Nodes, \"can only get node when in node\");\n\t\t// Test is failing when using `?? oob()` here.\n\t\t// eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n\t\treturn (this.siblings as TNode[])[this.index]!;\n\t}\n\n\tprivate getField(): readonly TNode[] {\n\t\t// assert(this.mode === CursorLocationType.Fields, \"can only get field when in fields\");\n\t\tconst parent = this.getStackedNode(this.indexStack.length - 1);\n\t\tconst key: FieldKey = this.getFieldKey();\n\t\tconst field = this.adapter.getFieldFromNode(parent, key);\n\t\treturn field;\n\t}\n\n\t/**\n\t * @returns the value of the current node\n\t */\n\tpublic get value(): Value {\n\t\treturn this.adapter.value(this.getNode());\n\t}\n\n\t/**\n\t * @returns the type of the current node\n\t */\n\tpublic get type(): TreeType {\n\t\treturn this.adapter.type(this.getNode());\n\t}\n\n\tpublic get fieldIndex(): number {\n\t\t// assert(this.mode === CursorLocationType.Nodes, \"can only node's index when in node\");\n\t\treturn this.index;\n\t}\n\n\tpublic get chunkStart(): number {\n\t\treturn this.fieldIndex;\n\t}\n\n\tpublic readonly chunkLength = 1;\n}\n\n/**\n * Apply `prefix` to `path`.\n */\nexport function prefixPath(\n\tprefix: PathRootPrefix | undefined,\n\tpath: UpPath | undefined,\n): UpPath | undefined {\n\tif (prefix === undefined) {\n\t\treturn path;\n\t}\n\tif (\n\t\tprefix.parent === undefined &&\n\t\tprefix.rootFieldOverride === undefined &&\n\t\t(prefix.indexOffset ?? 0) === 0\n\t) {\n\t\treturn path;\n\t}\n\treturn applyPrefix(prefix, path);\n}\n\n/**\n * Apply `prefix` to `path`.\n */\nexport function prefixFieldPath(\n\tprefix: PathRootPrefix | undefined,\n\tpath: FieldUpPath,\n): FieldUpPath {\n\tif (prefix === undefined) {\n\t\treturn path;\n\t}\n\tif (\n\t\tprefix.parent === undefined &&\n\t\tprefix.rootFieldOverride === undefined &&\n\t\t(prefix.indexOffset ?? 0) === 0\n\t) {\n\t\treturn path;\n\t}\n\treturn {\n\t\tfield: path.parent === undefined ? (prefix.rootFieldOverride ?? path.field) : path.field,\n\t\tparent: prefixPath(prefix, path.parent),\n\t};\n}\n\n/**\n * Compose two prefixes together.\n * `prefixFieldPath(root, prefixFieldPath(inner, path))` should be the same as `prefixFieldPath(prefixPathPrefix(root, inner), path))`\n *\n * TODO: tests for this.\n */\nexport function prefixPathPrefix(root: PathRootPrefix, inner: PathRootPrefix): PathRootPrefix {\n\tif (inner.parent !== undefined) {\n\t\tconst composedPrefix: PathRootPrefix = {\n\t\t\tparent: new PrefixedPath(root, inner.parent),\n\t\t\trootFieldOverride: inner.rootFieldOverride,\n\t\t\tindexOffset: inner.indexOffset,\n\t\t};\n\t\treturn composedPrefix;\n\t} else {\n\t\tconst composedPrefix: PathRootPrefix = {\n\t\t\tparent: root.parent,\n\t\t\trootFieldOverride: root.rootFieldOverride ?? inner.rootFieldOverride,\n\t\t\tindexOffset: (inner.indexOffset ?? 0) + (root.indexOffset ?? 0),\n\t\t};\n\t\treturn composedPrefix;\n\t}\n}\n\nfunction applyPrefix(prefix: PathRootPrefix, path: UpPath | undefined): UpPath | undefined {\n\tif (path === undefined) {\n\t\treturn prefix.parent;\n\t} else {\n\t\t// As an optimization, avoid double wrapping paths with multiple prefixes\n\t\tif (path instanceof PrefixedPath) {\n\t\t\tconst composedPrefix: PathRootPrefix = prefixPathPrefix(prefix, path.prefix);\n\t\t\treturn new PrefixedPath(composedPrefix, path.path);\n\t\t} else {\n\t\t\treturn new PrefixedPath(prefix, path);\n\t\t}\n\t}\n}\n\n/**\n * Wrapper around a path that adds a prefix to the root.\n *\n * Exported for testing: use `prefixPath` and `prefixFieldPath` to construct.\n */\nexport class PrefixedPath implements UpPath {\n\tpublic readonly parentField: FieldKey;\n\tpublic readonly parentIndex: number;\n\tpublic constructor(\n\t\tpublic readonly prefix: PathRootPrefix,\n\t\tpublic readonly path: UpPath,\n\t) {\n\t\tif (path.parent === undefined) {\n\t\t\tthis.parentField = prefix.rootFieldOverride ?? path.parentField;\n\t\t\tthis.parentIndex = path.parentIndex + (prefix.indexOffset ?? 0);\n\t\t} else {\n\t\t\tthis.parentField = path.parentField;\n\t\t\tthis.parentIndex = path.parentIndex;\n\t\t}\n\t}\n\tpublic get parent(): UpPath | undefined {\n\t\treturn applyPrefix(this.prefix, this.path.parent);\n\t}\n}\n"]}
|
package/dist/index.d.ts
CHANGED
|
@@ -3,9 +3,33 @@
|
|
|
3
3
|
* Licensed under the MIT License.
|
|
4
4
|
*/
|
|
5
5
|
export { ValueSchema, type Revertible, CommitKind, RevertibleStatus, type CommitMetadata, type RevertibleFactory, type RevertibleAlphaFactory, type RevertibleAlpha, } from "./core/index.js";
|
|
6
|
-
|
|
6
|
+
import type { Listeners as EventListeners, IsListener as EventIsListener, Listenable as EventListenable, Off as EventOff } from "@fluidframework/core-interfaces";
|
|
7
|
+
/**
|
|
8
|
+
* {@inheritdoc @fluidframework/core-interfaces#Listeners}
|
|
9
|
+
* @public
|
|
10
|
+
* @deprecated Deprecated in `@fluidframework/tree`. Consider importing from `fluid-framework` or `@fluidframework/core-interfaces` instead.
|
|
11
|
+
*/
|
|
12
|
+
export type Listeners<T extends object> = EventListeners<T>;
|
|
13
|
+
/**
|
|
14
|
+
* {@inheritdoc @fluidframework/core-interfaces#IsListener}
|
|
15
|
+
* @public
|
|
16
|
+
* @deprecated Deprecated in `@fluidframework/tree`. Consider importing from `fluid-framework` or `@fluidframework/core-interfaces` instead.
|
|
17
|
+
*/
|
|
18
|
+
export type IsListener<T> = EventIsListener<T>;
|
|
19
|
+
/**
|
|
20
|
+
* {@inheritdoc @fluidframework/core-interfaces#Listenable}
|
|
21
|
+
* @public
|
|
22
|
+
* @deprecated Deprecated in `@fluidframework/tree`. Consider importing from `fluid-framework` or `@fluidframework/core-interfaces` instead.
|
|
23
|
+
*/
|
|
24
|
+
export type Listenable<T extends object> = EventListenable<T>;
|
|
25
|
+
/**
|
|
26
|
+
* {@inheritdoc @fluidframework/core-interfaces#Off}
|
|
27
|
+
* @public
|
|
28
|
+
* @deprecated Deprecated in `@fluidframework/tree`. Consider importing from `fluid-framework` or `@fluidframework/core-interfaces` instead.
|
|
29
|
+
*/
|
|
30
|
+
export type Off = EventOff;
|
|
7
31
|
export { TreeStatus, TreeCompressionStrategy, type TreeIndex, type TreeIndexKey, type TreeIndexNodes, } from "./feature-libraries/index.js";
|
|
8
|
-
export { type ITreeInternal, type SharedTreeOptions, ForestType, type SharedTreeFormatOptions, SharedTreeFormatVersion, Tree, type TransactionConstraint, type NodeInDocumentConstraint, type RunTransaction, rollback, type ForestOptions, getBranch, type BranchableTree, type TreeBranchFork, independentInitializedView, type ViewContent, TreeAlpha, independentView, type RunTransactionParams, type VoidTransactionCallbackStatus, type TransactionCallbackStatus, type TransactionResult, type TransactionResultExt, type TransactionResultSuccess, type TransactionResultFailed, } from "./shared-tree/index.js";
|
|
32
|
+
export { type ITreeInternal, type SharedTreeOptions, type ForestType, type SharedTreeFormatOptions, SharedTreeFormatVersion, Tree, type TransactionConstraint, type NodeInDocumentConstraint, type RunTransaction, rollback, type ForestOptions, getBranch, type BranchableTree, type TreeBranchFork, independentInitializedView, type ViewContent, TreeAlpha, independentView, type RunTransactionParams, type VoidTransactionCallbackStatus, type TransactionCallbackStatus, type TransactionResult, type TransactionResultExt, type TransactionResultSuccess, type TransactionResultFailed, ForestTypeOptimized, ForestTypeExpensiveDebug, ForestTypeReference, } from "./shared-tree/index.js";
|
|
9
33
|
export { TreeArrayNode, type Unhydrated, IterableTreeArrayContent, TreeNode, type ViewableTree, type ITree, type TreeNodeSchema, TreeViewConfiguration, type ITreeViewConfiguration, type ITreeConfigurationOptions, type TreeView, type TreeViewEvents, SchemaFactory, SchemaFactoryAlpha, type SchemaFactoryObjectOptions, type ImplicitFieldSchema, type TreeFieldFromImplicitField, type TreeChangeEvents, type NodeFromSchema, type TreeMapNode, type InsertableTreeNodeFromImplicitAllowedTypes, type TreeLeafValue, FieldKind, FieldSchema, type FieldSchemaMetadata, type ImplicitAllowedTypes, type InsertableTreeFieldFromImplicitField, type InsertableTypedNode, NodeKind, type TreeObjectNode, type TreeNodeFromImplicitAllowedTypes, type TreeNodeSchemaClass, type SchemaCompatibilityStatus, type FieldProps, type InternalTreeNode, type WithType, type NodeChangedData, type TreeNodeApi, type TreeNodeSchemaCore, type AllowedTypes, type TreeObjectNodeUnsafe, type InsertableTreeNodeFromImplicitAllowedTypesUnsafe, type TreeArrayNodeUnsafe, type TreeMapNodeUnsafe, type InsertableObjectFromSchemaRecordUnsafe, type InsertableTreeFieldFromImplicitFieldUnsafe, type FieldSchemaUnsafe, type TreeNodeSchemaClassUnsafe, type InsertableTreeNodeFromAllowedTypesUnsafe, type typeSchemaSymbol, type TreeNodeSchemaNonClass, type ValidateRecursiveSchema, type FixRecursiveArraySchema, type SimpleTreeIndex, type IdentifierIndex, createSimpleTreeIndex, createIdentifierIndex, adaptEnum, enumFromStrings, singletonSchema, type UnsafeUnknownSchema, type TreeViewAlpha, type InsertableField, type Insertable, type InsertableContent, type FactoryContent, type FactoryContentObject, type ReadableField, type ReadSchema, test_RecursiveObject, test_RecursiveObject_base, test_RecursiveObjectPojoMode, TreeBeta, type TreeChangeEventsBeta, type VerboseTreeNode, type EncodeOptions, type ParseOptions, type VerboseTree, extractPersistedSchema, comparePersistedSchema, type ConciseTree, type JsonTreeSchema, type JsonSchemaId, type JsonNodeSchema, type JsonNodeSchemaBase, type JsonLeafNodeSchema, type JsonMapNodeSchema, type JsonArrayNodeSchema, type JsonObjectNodeSchema, type JsonFieldSchema, type JsonSchemaRef, type JsonRefPath, type JsonSchemaType, type JsonLeafSchemaType, getJsonSchema, type LazyItem, type Unenforced, type SimpleNodeSchemaBase, type SimpleTreeSchema, type SimpleNodeSchema, type SimpleFieldSchema, type SimpleLeafNodeSchema, type SimpleMapNodeSchema, type SimpleArrayNodeSchema, type SimpleObjectNodeSchema, normalizeAllowedTypes, getSimpleSchema, type ReadonlyArrayNode, type InsertableTreeNodeFromAllowedTypes, type Input, type TreeBranch, type TreeBranchEvents, asTreeViewAlpha, type NodeSchemaOptions, type NodeSchemaMetadata, } from "./simple-tree/index.js";
|
|
10
34
|
export { SharedTree, configuredSharedTree, } from "./treeFactory.js";
|
|
11
35
|
export { type ICodecOptions, type JsonValidator, type SchemaValidationFunction, FluidClientVersion, } from "./codec/index.js";
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EACN,WAAW,EACX,KAAK,UAAU,EACf,UAAU,EACV,gBAAgB,EAChB,KAAK,cAAc,EACnB,KAAK,iBAAiB,EACtB,KAAK,sBAAsB,EAC3B,KAAK,eAAe,GACpB,MAAM,iBAAiB,CAAC;AAEzB,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EACN,WAAW,EACX,KAAK,UAAU,EACf,UAAU,EACV,gBAAgB,EAChB,KAAK,cAAc,EACnB,KAAK,iBAAiB,EACtB,KAAK,sBAAsB,EAC3B,KAAK,eAAe,GACpB,MAAM,iBAAiB,CAAC;AAEzB,OAAO,KAAK,EACX,SAAS,IAAI,cAAc,EAC3B,UAAU,IAAI,eAAe,EAC7B,UAAU,IAAI,eAAe,EAC7B,GAAG,IAAI,QAAQ,EACf,MAAM,iCAAiC,CAAC;AAEzC;;;;GAIG;AACH,MAAM,MAAM,SAAS,CAAC,CAAC,SAAS,MAAM,IAAI,cAAc,CAAC,CAAC,CAAC,CAAC;AAC5D;;;;GAIG;AACH,MAAM,MAAM,UAAU,CAAC,CAAC,IAAI,eAAe,CAAC,CAAC,CAAC,CA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ClB,KAAK,WAAW,EAChB,KAAK,cAAc,EACnB,KAAK,kBAAkB,EACvB,aAAa,EACb,KAAK,QAAQ,EACb,KAAK,UAAU,EACf,KAAK,oBAAoB,EACzB,KAAK,gBAAgB,EACrB,KAAK,gBAAgB,EACrB,KAAK,iBAAiB,EACtB,KAAK,oBAAoB,EACzB,KAAK,mBAAmB,EACxB,KAAK,qBAAqB,EAC1B,KAAK,sBAAsB,EAC3B,qBAAqB,EACrB,eAAe,EACf,KAAK,iBAAiB,EACtB,KAAK,kCAAkC,EACvC,KAAK,KAAK,EACV,KAAK,UAAU,EACf,KAAK,gBAAgB,EACrB,eAAe,EACf,KAAK,iBAAiB,EACtB,KAAK,kBAAkB,GACvB,MAAM,wBAAwB,CAAC;AAChC,OAAO,EACN,UAAU,EACV,oBAAoB,GACpB,MAAM,kBAAkB,CAAC;AAE1B,OAAO,EACN,KAAK,aAAa,EAClB,KAAK,aAAa,EAClB,KAAK,wBAAwB,EAC7B,kBAAkB,GAClB,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AACjD,OAAO,EAAE,gBAAgB,EAAE,MAAM,+BAA+B,CAAC;AAEjE,OAAO,EACN,KAAK,yBAAyB,EAC9B,KAAK,uBAAuB,EAC5B,KAAK,WAAW,EAChB,KAAK,OAAO,EACZ,KAAK,mBAAmB,EACxB,KAAK,YAAY,EACjB,KAAK,QAAQ,GACb,MAAM,iBAAiB,CAAC;AAEzB,OAAO,KAAK,aAAa,MAAM,oBAAoB,CAAC;AACpD,OAAO;AACN;;;GAGG;AACH,aAAa,GACb,CAAC;AAKF,YAAY,EAAE,qBAAqB,EAAE,MAAM,wBAAwB,CAAC;AAEpE,YAAY,EAAE,cAAc,EAAE,oBAAoB,EAAE,MAAM,iBAAiB,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -27,7 +27,7 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
27
27
|
return result;
|
|
28
28
|
};
|
|
29
29
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
30
|
-
exports.InternalTypes = exports.typeboxValidator = exports.noopValidator = exports.FluidClientVersion = exports.configuredSharedTree = exports.SharedTree = exports.asTreeViewAlpha = exports.getSimpleSchema = exports.normalizeAllowedTypes = exports.getJsonSchema = exports.comparePersistedSchema = exports.extractPersistedSchema = exports.TreeBeta = exports.test_RecursiveObjectPojoMode = exports.test_RecursiveObject_base = exports.test_RecursiveObject = exports.singletonSchema = exports.enumFromStrings = exports.adaptEnum = exports.createIdentifierIndex = exports.createSimpleTreeIndex = exports.NodeKind = exports.FieldSchema = exports.FieldKind = exports.SchemaFactoryAlpha = exports.SchemaFactory = exports.TreeViewConfiguration = exports.IterableTreeArrayContent = exports.TreeArrayNode = exports.independentView = exports.TreeAlpha = exports.independentInitializedView = exports.getBranch = exports.rollback = exports.Tree = exports.SharedTreeFormatVersion = exports.
|
|
30
|
+
exports.InternalTypes = exports.typeboxValidator = exports.noopValidator = exports.FluidClientVersion = exports.configuredSharedTree = exports.SharedTree = exports.asTreeViewAlpha = exports.getSimpleSchema = exports.normalizeAllowedTypes = exports.getJsonSchema = exports.comparePersistedSchema = exports.extractPersistedSchema = exports.TreeBeta = exports.test_RecursiveObjectPojoMode = exports.test_RecursiveObject_base = exports.test_RecursiveObject = exports.singletonSchema = exports.enumFromStrings = exports.adaptEnum = exports.createIdentifierIndex = exports.createSimpleTreeIndex = exports.NodeKind = exports.FieldSchema = exports.FieldKind = exports.SchemaFactoryAlpha = exports.SchemaFactory = exports.TreeViewConfiguration = exports.IterableTreeArrayContent = exports.TreeArrayNode = exports.ForestTypeReference = exports.ForestTypeExpensiveDebug = exports.ForestTypeOptimized = exports.independentView = exports.TreeAlpha = exports.independentInitializedView = exports.getBranch = exports.rollback = exports.Tree = exports.SharedTreeFormatVersion = exports.TreeCompressionStrategy = exports.TreeStatus = exports.RevertibleStatus = exports.CommitKind = exports.ValueSchema = void 0;
|
|
31
31
|
var index_js_1 = require("./core/index.js");
|
|
32
32
|
Object.defineProperty(exports, "ValueSchema", { enumerable: true, get: function () { return index_js_1.ValueSchema; } });
|
|
33
33
|
Object.defineProperty(exports, "CommitKind", { enumerable: true, get: function () { return index_js_1.CommitKind; } });
|
|
@@ -36,7 +36,6 @@ var index_js_2 = require("./feature-libraries/index.js");
|
|
|
36
36
|
Object.defineProperty(exports, "TreeStatus", { enumerable: true, get: function () { return index_js_2.TreeStatus; } });
|
|
37
37
|
Object.defineProperty(exports, "TreeCompressionStrategy", { enumerable: true, get: function () { return index_js_2.TreeCompressionStrategy; } });
|
|
38
38
|
var index_js_3 = require("./shared-tree/index.js");
|
|
39
|
-
Object.defineProperty(exports, "ForestType", { enumerable: true, get: function () { return index_js_3.ForestType; } });
|
|
40
39
|
Object.defineProperty(exports, "SharedTreeFormatVersion", { enumerable: true, get: function () { return index_js_3.SharedTreeFormatVersion; } });
|
|
41
40
|
Object.defineProperty(exports, "Tree", { enumerable: true, get: function () { return index_js_3.Tree; } });
|
|
42
41
|
Object.defineProperty(exports, "rollback", { enumerable: true, get: function () { return index_js_3.rollback; } });
|
|
@@ -44,6 +43,9 @@ Object.defineProperty(exports, "getBranch", { enumerable: true, get: function ()
|
|
|
44
43
|
Object.defineProperty(exports, "independentInitializedView", { enumerable: true, get: function () { return index_js_3.independentInitializedView; } });
|
|
45
44
|
Object.defineProperty(exports, "TreeAlpha", { enumerable: true, get: function () { return index_js_3.TreeAlpha; } });
|
|
46
45
|
Object.defineProperty(exports, "independentView", { enumerable: true, get: function () { return index_js_3.independentView; } });
|
|
46
|
+
Object.defineProperty(exports, "ForestTypeOptimized", { enumerable: true, get: function () { return index_js_3.ForestTypeOptimized; } });
|
|
47
|
+
Object.defineProperty(exports, "ForestTypeExpensiveDebug", { enumerable: true, get: function () { return index_js_3.ForestTypeExpensiveDebug; } });
|
|
48
|
+
Object.defineProperty(exports, "ForestTypeReference", { enumerable: true, get: function () { return index_js_3.ForestTypeReference; } });
|
|
47
49
|
var index_js_4 = require("./simple-tree/index.js");
|
|
48
50
|
Object.defineProperty(exports, "TreeArrayNode", { enumerable: true, get: function () { return index_js_4.TreeArrayNode; } });
|
|
49
51
|
Object.defineProperty(exports, "IterableTreeArrayContent", { enumerable: true, get: function () { return index_js_4.IterableTreeArrayContent; } });
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;;;;;;;;;;;;;;;;;;;;;;;;AAEH,4CASyB;AARxB,uGAAA,WAAW,OAAA;AAEX,sGAAA,UAAU,OAAA;AACV,4GAAA,gBAAgB,OAAA;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;;;;;;;;;;;;;;;;;;;;;;;;AAEH,4CASyB;AARxB,uGAAA,WAAW,OAAA;AAEX,sGAAA,UAAU,OAAA;AACV,4GAAA,gBAAgB,OAAA;AAuCjB,yDAMsC;AALrC,sGAAA,UAAU,OAAA;AACV,mHAAA,uBAAuB,OAAA;AAMxB,mDA6BgC;AAxB/B,mHAAA,uBAAuB,OAAA;AACvB,gGAAA,IAAI,OAAA;AAIJ,oGAAA,QAAQ,OAAA;AAER,qGAAA,SAAS,OAAA;AAGT,sHAAA,0BAA0B,OAAA;AAE1B,qGAAA,SAAS,OAAA;AACT,2GAAA,eAAe,OAAA;AAQf,+GAAA,mBAAmB,OAAA;AACnB,oHAAA,wBAAwB,OAAA;AACxB,+GAAA,mBAAmB,OAAA;AAGpB,mDAiIgC;AAhI/B,yGAAA,aAAa,OAAA;AAEb,oHAAA,wBAAwB,OAAA;AAKxB,iHAAA,qBAAqB,OAAA;AAKrB,yGAAA,aAAa,OAAA;AACb,8GAAA,kBAAkB,OAAA;AASlB,qGAAA,SAAS,OAAA;AACT,uGAAA,WAAW,OAAA;AAKX,oGAAA,QAAQ,OAAA;AAoCR,iHAAA,qBAAqB,OAAA;AACrB,iHAAA,qBAAqB,OAAA;AACrB,4BAA4B;AAC5B,qGAAA,SAAS,OAAA;AACT,2GAAA,eAAe,OAAA;AACf,2GAAA,eAAe,OAAA;AAUf,8EAA8E;AAC9E,gHAAA,oBAAoB,OAAA;AACpB,qHAAA,yBAAyB,OAAA;AACzB,wHAAA,4BAA4B,OAAA;AAC5B,YAAY;AACZ,oGAAA,QAAQ,OAAA;AAMR,kHAAA,sBAAsB,OAAA;AACtB,kHAAA,sBAAsB,OAAA;AAgBtB,yGAAA,aAAa,OAAA;AAWb,iHAAA,qBAAqB,OAAA;AACrB,2GAAA,eAAe,OAAA;AAMf,2GAAA,eAAe,OAAA;AAIhB,mDAG0B;AAFzB,4GAAA,UAAU,OAAA;AACV,sHAAA,oBAAoB,OAAA;AAGrB,6CAK0B;AADzB,8GAAA,kBAAkB,OAAA;AAEnB,6CAAiD;AAAxC,yGAAA,aAAa,OAAA;AACtB,0DAAiE;AAAxD,4GAAA,gBAAgB,OAAA;AAYzB,kEAAoD;AAMnD,sCAAa","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nexport {\n\tValueSchema,\n\ttype Revertible,\n\tCommitKind,\n\tRevertibleStatus,\n\ttype CommitMetadata,\n\ttype RevertibleFactory,\n\ttype RevertibleAlphaFactory,\n\ttype RevertibleAlpha,\n} from \"./core/index.js\";\n\nimport type {\n\tListeners as EventListeners,\n\tIsListener as EventIsListener,\n\tListenable as EventListenable,\n\tOff as EventOff,\n} from \"@fluidframework/core-interfaces\";\n\n/**\n * {@inheritdoc @fluidframework/core-interfaces#Listeners}\n * @public\n * @deprecated Deprecated in `@fluidframework/tree`. Consider importing from `fluid-framework` or `@fluidframework/core-interfaces` instead.\n */\nexport type Listeners<T extends object> = EventListeners<T>;\n/**\n * {@inheritdoc @fluidframework/core-interfaces#IsListener}\n * @public\n * @deprecated Deprecated in `@fluidframework/tree`. Consider importing from `fluid-framework` or `@fluidframework/core-interfaces` instead.\n */\nexport type IsListener<T> = EventIsListener<T>;\n/**\n * {@inheritdoc @fluidframework/core-interfaces#Listenable}\n * @public\n * @deprecated Deprecated in `@fluidframework/tree`. Consider importing from `fluid-framework` or `@fluidframework/core-interfaces` instead.\n */\nexport type Listenable<T extends object> = EventListenable<T>;\n/**\n * {@inheritdoc @fluidframework/core-interfaces#Off}\n * @public\n * @deprecated Deprecated in `@fluidframework/tree`. Consider importing from `fluid-framework` or `@fluidframework/core-interfaces` instead.\n */\nexport type Off = EventOff;\n\nexport {\n\tTreeStatus,\n\tTreeCompressionStrategy,\n\ttype TreeIndex,\n\ttype TreeIndexKey,\n\ttype TreeIndexNodes,\n} from \"./feature-libraries/index.js\";\n\nexport {\n\ttype ITreeInternal,\n\ttype SharedTreeOptions,\n\ttype ForestType,\n\ttype SharedTreeFormatOptions,\n\tSharedTreeFormatVersion,\n\tTree,\n\ttype TransactionConstraint,\n\ttype NodeInDocumentConstraint,\n\ttype RunTransaction,\n\trollback,\n\ttype ForestOptions,\n\tgetBranch,\n\ttype BranchableTree,\n\ttype TreeBranchFork,\n\tindependentInitializedView,\n\ttype ViewContent,\n\tTreeAlpha,\n\tindependentView,\n\ttype RunTransactionParams,\n\ttype VoidTransactionCallbackStatus,\n\ttype TransactionCallbackStatus,\n\ttype TransactionResult,\n\ttype TransactionResultExt,\n\ttype TransactionResultSuccess,\n\ttype TransactionResultFailed,\n\tForestTypeOptimized,\n\tForestTypeExpensiveDebug,\n\tForestTypeReference,\n} from \"./shared-tree/index.js\";\n\nexport {\n\tTreeArrayNode,\n\ttype Unhydrated,\n\tIterableTreeArrayContent,\n\tTreeNode,\n\ttype ViewableTree,\n\ttype ITree,\n\ttype TreeNodeSchema,\n\tTreeViewConfiguration,\n\ttype ITreeViewConfiguration,\n\ttype ITreeConfigurationOptions,\n\ttype TreeView,\n\ttype TreeViewEvents,\n\tSchemaFactory,\n\tSchemaFactoryAlpha,\n\ttype SchemaFactoryObjectOptions,\n\ttype ImplicitFieldSchema,\n\ttype TreeFieldFromImplicitField,\n\ttype TreeChangeEvents,\n\ttype NodeFromSchema,\n\ttype TreeMapNode,\n\ttype InsertableTreeNodeFromImplicitAllowedTypes,\n\ttype TreeLeafValue,\n\tFieldKind,\n\tFieldSchema,\n\ttype FieldSchemaMetadata,\n\ttype ImplicitAllowedTypes,\n\ttype InsertableTreeFieldFromImplicitField,\n\ttype InsertableTypedNode,\n\tNodeKind,\n\ttype TreeObjectNode,\n\ttype TreeNodeFromImplicitAllowedTypes,\n\ttype TreeNodeSchemaClass,\n\ttype SchemaCompatibilityStatus,\n\ttype FieldProps,\n\ttype InternalTreeNode,\n\ttype WithType,\n\ttype NodeChangedData,\n\t// Types not really intended for public use, but used in links.\n\t// Can not be moved to internalTypes since doing so causes app code to throw errors like:\n\t// Error: src/simple-tree/objectNode.ts:72:1 - (ae-unresolved-link) The @link reference could not be resolved: The package \"@fluidframework/tree\" does not have an export \"TreeNodeApi\"\n\ttype TreeNodeApi,\n\ttype TreeNodeSchemaCore,\n\t// Types not really intended for public use, but used in inferred types exposed in the public API.\n\t// Can not be moved to internalTypes since doing so causes app code to throw errors like:\n\t// error TS2742: The inferred type of 'Inventory' cannot be named without a reference to '../node_modules/@fluidframework/tree/lib/internalTypes.js'. This is likely not portable. A type annotation is necessary.\n\ttype AllowedTypes,\n\ttype TreeObjectNodeUnsafe,\n\ttype InsertableTreeNodeFromImplicitAllowedTypesUnsafe,\n\ttype TreeArrayNodeUnsafe,\n\ttype TreeMapNodeUnsafe,\n\ttype InsertableObjectFromSchemaRecordUnsafe,\n\ttype InsertableTreeFieldFromImplicitFieldUnsafe,\n\ttype FieldSchemaUnsafe,\n\ttype TreeNodeSchemaClassUnsafe,\n\ttype InsertableTreeNodeFromAllowedTypesUnsafe,\n\t// System types (not in Internal types for various reasons, like doc links or cannot be named errors).\n\ttype typeSchemaSymbol,\n\ttype TreeNodeSchemaNonClass,\n\t// Recursive Schema APIs\n\ttype ValidateRecursiveSchema,\n\ttype FixRecursiveArraySchema,\n\t// Index APIs\n\ttype SimpleTreeIndex,\n\ttype IdentifierIndex,\n\tcreateSimpleTreeIndex,\n\tcreateIdentifierIndex,\n\t// experimental @alpha APIs:\n\tadaptEnum,\n\tenumFromStrings,\n\tsingletonSchema,\n\ttype UnsafeUnknownSchema,\n\ttype TreeViewAlpha,\n\ttype InsertableField,\n\ttype Insertable,\n\ttype InsertableContent,\n\ttype FactoryContent,\n\ttype FactoryContentObject,\n\ttype ReadableField,\n\ttype ReadSchema,\n\t// test recursive schema for checking that d.ts files handles schema correctly\n\ttest_RecursiveObject,\n\ttest_RecursiveObject_base,\n\ttest_RecursiveObjectPojoMode,\n\t// Beta APIs\n\tTreeBeta,\n\ttype TreeChangeEventsBeta,\n\ttype VerboseTreeNode,\n\ttype EncodeOptions,\n\ttype ParseOptions,\n\ttype VerboseTree,\n\textractPersistedSchema,\n\tcomparePersistedSchema,\n\ttype ConciseTree,\n\t// Back to normal types\n\ttype JsonTreeSchema,\n\ttype JsonSchemaId,\n\ttype JsonNodeSchema,\n\ttype JsonNodeSchemaBase,\n\ttype JsonLeafNodeSchema,\n\ttype JsonMapNodeSchema,\n\ttype JsonArrayNodeSchema,\n\ttype JsonObjectNodeSchema,\n\ttype JsonFieldSchema,\n\ttype JsonSchemaRef,\n\ttype JsonRefPath,\n\ttype JsonSchemaType,\n\ttype JsonLeafSchemaType,\n\tgetJsonSchema,\n\ttype LazyItem,\n\ttype Unenforced,\n\ttype SimpleNodeSchemaBase,\n\ttype SimpleTreeSchema,\n\ttype SimpleNodeSchema,\n\ttype SimpleFieldSchema,\n\ttype SimpleLeafNodeSchema,\n\ttype SimpleMapNodeSchema,\n\ttype SimpleArrayNodeSchema,\n\ttype SimpleObjectNodeSchema,\n\tnormalizeAllowedTypes,\n\tgetSimpleSchema,\n\ttype ReadonlyArrayNode,\n\ttype InsertableTreeNodeFromAllowedTypes,\n\ttype Input,\n\ttype TreeBranch,\n\ttype TreeBranchEvents,\n\tasTreeViewAlpha,\n\ttype NodeSchemaOptions,\n\ttype NodeSchemaMetadata,\n} from \"./simple-tree/index.js\";\nexport {\n\tSharedTree,\n\tconfiguredSharedTree,\n} from \"./treeFactory.js\";\n\nexport {\n\ttype ICodecOptions,\n\ttype JsonValidator,\n\ttype SchemaValidationFunction,\n\tFluidClientVersion,\n} from \"./codec/index.js\";\nexport { noopValidator } from \"./codec/index.js\";\nexport { typeboxValidator } from \"./external-utilities/index.js\";\n\nexport {\n\ttype RestrictiveReadonlyRecord,\n\ttype RestrictiveStringRecord,\n\ttype MakeNominal,\n\ttype IsUnion,\n\ttype UnionToIntersection,\n\ttype UnionToTuple,\n\ttype PopUnion,\n} from \"./util/index.js\";\n\nimport * as InternalTypes from \"./internalTypes.js\";\nexport {\n\t/**\n\t * Contains types used by the API, but which serve mechanical purposes and do not represent semantic concepts.\n\t * They are used internally to implement API aspects, but are not intended for use by external consumers.\n\t */\n\tInternalTypes,\n};\n\n// Internal/System types:\n// These would be put in `internalTypes` except doing so tents to cause errors like:\n// The inferred type of 'NodeMap' cannot be named without a reference to '../../node_modules/@fluidframework/tree/lib/internalTypes.js'. This is likely not portable. A type annotation is necessary.\nexport type { MapNodeInsertableData } from \"./simple-tree/index.js\";\n\nexport type { JsonCompatible, JsonCompatibleObject } from \"./util/index.js\";\n"]}
|
package/dist/package.json
CHANGED
package/dist/packageVersion.d.ts
CHANGED
package/dist/packageVersion.js
CHANGED
|
@@ -8,5 +8,5 @@
|
|
|
8
8
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
9
|
exports.pkgVersion = exports.pkgName = void 0;
|
|
10
10
|
exports.pkgName = "@fluidframework/tree";
|
|
11
|
-
exports.pkgVersion = "2.
|
|
11
|
+
exports.pkgVersion = "2.20.0";
|
|
12
12
|
//# sourceMappingURL=packageVersion.js.map
|