@fluidframework/tree 2.73.0 → 2.74.0-365691

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.
Files changed (176) hide show
  1. package/api-report/tree.alpha.api.md +15 -1
  2. package/dist/alpha.d.ts +4 -0
  3. package/dist/feature-libraries/chunked-forest/codec/codecs.d.ts +2 -2
  4. package/dist/feature-libraries/chunked-forest/codec/codecs.d.ts.map +1 -1
  5. package/dist/feature-libraries/chunked-forest/codec/codecs.js +1 -1
  6. package/dist/feature-libraries/chunked-forest/codec/codecs.js.map +1 -1
  7. package/dist/feature-libraries/chunked-forest/codec/incrementalEncodingPolicy.d.ts +2 -2
  8. package/dist/feature-libraries/chunked-forest/codec/incrementalEncodingPolicy.d.ts.map +1 -1
  9. package/dist/feature-libraries/chunked-forest/codec/incrementalEncodingPolicy.js.map +1 -1
  10. package/dist/feature-libraries/forest-summary/forestSummarizer.js +1 -1
  11. package/dist/feature-libraries/forest-summary/forestSummarizer.js.map +1 -1
  12. package/dist/feature-libraries/index.d.ts +1 -1
  13. package/dist/feature-libraries/index.d.ts.map +1 -1
  14. package/dist/feature-libraries/index.js +1 -2
  15. package/dist/feature-libraries/index.js.map +1 -1
  16. package/dist/feature-libraries/modular-schema/modularChangeCodecs.d.ts +2 -2
  17. package/dist/feature-libraries/modular-schema/modularChangeCodecs.d.ts.map +1 -1
  18. package/dist/feature-libraries/modular-schema/modularChangeCodecs.js.map +1 -1
  19. package/dist/feature-libraries/sequence-field/formatV2.d.ts.map +1 -1
  20. package/dist/feature-libraries/sequence-field/formatV2.js +1 -0
  21. package/dist/feature-libraries/sequence-field/formatV2.js.map +1 -1
  22. package/dist/feature-libraries/treeCompressionUtils.d.ts +2 -12
  23. package/dist/feature-libraries/treeCompressionUtils.d.ts.map +1 -1
  24. package/dist/feature-libraries/treeCompressionUtils.js +4 -14
  25. package/dist/feature-libraries/treeCompressionUtils.js.map +1 -1
  26. package/dist/index.d.ts +3 -3
  27. package/dist/index.d.ts.map +1 -1
  28. package/dist/index.js +4 -1
  29. package/dist/index.js.map +1 -1
  30. package/dist/packageVersion.d.ts +1 -1
  31. package/dist/packageVersion.d.ts.map +1 -1
  32. package/dist/packageVersion.js +1 -1
  33. package/dist/packageVersion.js.map +1 -1
  34. package/dist/shared-tree/sharedTree.d.ts +7 -10
  35. package/dist/shared-tree/sharedTree.d.ts.map +1 -1
  36. package/dist/shared-tree/sharedTree.js +1 -0
  37. package/dist/shared-tree/sharedTree.js.map +1 -1
  38. package/dist/shared-tree/sharedTreeChangeFamily.d.ts +2 -2
  39. package/dist/shared-tree/sharedTreeChangeFamily.d.ts.map +1 -1
  40. package/dist/shared-tree/sharedTreeChangeFamily.js.map +1 -1
  41. package/dist/shared-tree/treeCheckout.d.ts +2 -2
  42. package/dist/shared-tree/treeCheckout.d.ts.map +1 -1
  43. package/dist/shared-tree/treeCheckout.js.map +1 -1
  44. package/dist/shared-tree-core/index.d.ts +1 -1
  45. package/dist/shared-tree-core/index.d.ts.map +1 -1
  46. package/dist/shared-tree-core/index.js.map +1 -1
  47. package/dist/simple-tree/api/incrementalAllowedTypes.d.ts +15 -12
  48. package/dist/simple-tree/api/incrementalAllowedTypes.d.ts.map +1 -1
  49. package/dist/simple-tree/api/incrementalAllowedTypes.js +17 -14
  50. package/dist/simple-tree/api/incrementalAllowedTypes.js.map +1 -1
  51. package/dist/simple-tree/api/index.d.ts +1 -1
  52. package/dist/simple-tree/api/index.d.ts.map +1 -1
  53. package/dist/simple-tree/api/index.js +2 -2
  54. package/dist/simple-tree/api/index.js.map +1 -1
  55. package/dist/simple-tree/api/tree.d.ts +1 -1
  56. package/dist/simple-tree/api/tree.js.map +1 -1
  57. package/dist/simple-tree/core/treeNodeKernel.d.ts.map +1 -1
  58. package/dist/simple-tree/core/treeNodeKernel.js +1 -0
  59. package/dist/simple-tree/core/treeNodeKernel.js.map +1 -1
  60. package/dist/simple-tree/index.d.ts +1 -1
  61. package/dist/simple-tree/index.d.ts.map +1 -1
  62. package/dist/simple-tree/index.js +2 -2
  63. package/dist/simple-tree/index.js.map +1 -1
  64. package/dist/simple-tree/node-kinds/array/arrayNode.d.ts.map +1 -1
  65. package/dist/simple-tree/node-kinds/array/arrayNode.js +1 -0
  66. package/dist/simple-tree/node-kinds/array/arrayNode.js.map +1 -1
  67. package/dist/simple-tree/node-kinds/object/objectNode.js +1 -0
  68. package/dist/simple-tree/node-kinds/object/objectNode.js.map +1 -1
  69. package/dist/treeFactory.d.ts +5 -0
  70. package/dist/treeFactory.d.ts.map +1 -1
  71. package/dist/treeFactory.js +12 -5
  72. package/dist/treeFactory.js.map +1 -1
  73. package/dist/util/breakable.js +3 -3
  74. package/dist/util/breakable.js.map +1 -1
  75. package/dist/util/typeCheckTests.d.ts.map +1 -1
  76. package/dist/util/typeCheckTests.js.map +1 -1
  77. package/lib/alpha.d.ts +4 -0
  78. package/lib/feature-libraries/chunked-forest/codec/codecs.d.ts +2 -2
  79. package/lib/feature-libraries/chunked-forest/codec/codecs.d.ts.map +1 -1
  80. package/lib/feature-libraries/chunked-forest/codec/codecs.js +2 -2
  81. package/lib/feature-libraries/chunked-forest/codec/codecs.js.map +1 -1
  82. package/lib/feature-libraries/chunked-forest/codec/incrementalEncodingPolicy.d.ts +2 -2
  83. package/lib/feature-libraries/chunked-forest/codec/incrementalEncodingPolicy.d.ts.map +1 -1
  84. package/lib/feature-libraries/chunked-forest/codec/incrementalEncodingPolicy.js.map +1 -1
  85. package/lib/feature-libraries/forest-summary/forestSummarizer.js +2 -2
  86. package/lib/feature-libraries/forest-summary/forestSummarizer.js.map +1 -1
  87. package/lib/feature-libraries/index.d.ts +1 -1
  88. package/lib/feature-libraries/index.d.ts.map +1 -1
  89. package/lib/feature-libraries/index.js +1 -1
  90. package/lib/feature-libraries/index.js.map +1 -1
  91. package/lib/feature-libraries/modular-schema/modularChangeCodecs.d.ts +2 -2
  92. package/lib/feature-libraries/modular-schema/modularChangeCodecs.d.ts.map +1 -1
  93. package/lib/feature-libraries/modular-schema/modularChangeCodecs.js +1 -1
  94. package/lib/feature-libraries/modular-schema/modularChangeCodecs.js.map +1 -1
  95. package/lib/feature-libraries/sequence-field/formatV2.d.ts.map +1 -1
  96. package/lib/feature-libraries/sequence-field/formatV2.js +1 -0
  97. package/lib/feature-libraries/sequence-field/formatV2.js.map +1 -1
  98. package/lib/feature-libraries/treeCompressionUtils.d.ts +2 -12
  99. package/lib/feature-libraries/treeCompressionUtils.d.ts.map +1 -1
  100. package/lib/feature-libraries/treeCompressionUtils.js +3 -13
  101. package/lib/feature-libraries/treeCompressionUtils.js.map +1 -1
  102. package/lib/index.d.ts +3 -3
  103. package/lib/index.d.ts.map +1 -1
  104. package/lib/index.js +2 -2
  105. package/lib/index.js.map +1 -1
  106. package/lib/packageVersion.d.ts +1 -1
  107. package/lib/packageVersion.d.ts.map +1 -1
  108. package/lib/packageVersion.js +1 -1
  109. package/lib/packageVersion.js.map +1 -1
  110. package/lib/shared-tree/sharedTree.d.ts +7 -10
  111. package/lib/shared-tree/sharedTree.d.ts.map +1 -1
  112. package/lib/shared-tree/sharedTree.js +1 -0
  113. package/lib/shared-tree/sharedTree.js.map +1 -1
  114. package/lib/shared-tree/sharedTreeChangeFamily.d.ts +2 -2
  115. package/lib/shared-tree/sharedTreeChangeFamily.d.ts.map +1 -1
  116. package/lib/shared-tree/sharedTreeChangeFamily.js.map +1 -1
  117. package/lib/shared-tree/treeCheckout.d.ts +2 -2
  118. package/lib/shared-tree/treeCheckout.d.ts.map +1 -1
  119. package/lib/shared-tree/treeCheckout.js.map +1 -1
  120. package/lib/shared-tree-core/index.d.ts +1 -1
  121. package/lib/shared-tree-core/index.d.ts.map +1 -1
  122. package/lib/shared-tree-core/index.js.map +1 -1
  123. package/lib/simple-tree/api/incrementalAllowedTypes.d.ts +15 -12
  124. package/lib/simple-tree/api/incrementalAllowedTypes.d.ts.map +1 -1
  125. package/lib/simple-tree/api/incrementalAllowedTypes.js +15 -12
  126. package/lib/simple-tree/api/incrementalAllowedTypes.js.map +1 -1
  127. package/lib/simple-tree/api/index.d.ts +1 -1
  128. package/lib/simple-tree/api/index.d.ts.map +1 -1
  129. package/lib/simple-tree/api/index.js +1 -1
  130. package/lib/simple-tree/api/index.js.map +1 -1
  131. package/lib/simple-tree/api/tree.d.ts +1 -1
  132. package/lib/simple-tree/api/tree.js.map +1 -1
  133. package/lib/simple-tree/core/treeNodeKernel.d.ts.map +1 -1
  134. package/lib/simple-tree/core/treeNodeKernel.js +1 -0
  135. package/lib/simple-tree/core/treeNodeKernel.js.map +1 -1
  136. package/lib/simple-tree/index.d.ts +1 -1
  137. package/lib/simple-tree/index.d.ts.map +1 -1
  138. package/lib/simple-tree/index.js +1 -1
  139. package/lib/simple-tree/index.js.map +1 -1
  140. package/lib/simple-tree/node-kinds/array/arrayNode.d.ts.map +1 -1
  141. package/lib/simple-tree/node-kinds/array/arrayNode.js +1 -0
  142. package/lib/simple-tree/node-kinds/array/arrayNode.js.map +1 -1
  143. package/lib/simple-tree/node-kinds/object/objectNode.js +1 -0
  144. package/lib/simple-tree/node-kinds/object/objectNode.js.map +1 -1
  145. package/lib/treeFactory.d.ts +5 -0
  146. package/lib/treeFactory.d.ts.map +1 -1
  147. package/lib/treeFactory.js +10 -4
  148. package/lib/treeFactory.js.map +1 -1
  149. package/lib/util/breakable.js +3 -3
  150. package/lib/util/breakable.js.map +1 -1
  151. package/lib/util/typeCheckTests.d.ts.map +1 -1
  152. package/lib/util/typeCheckTests.js.map +1 -1
  153. package/package.json +22 -22
  154. package/src/feature-libraries/chunked-forest/codec/codecs.ts +3 -7
  155. package/src/feature-libraries/chunked-forest/codec/incrementalEncodingPolicy.ts +5 -6
  156. package/src/feature-libraries/forest-summary/forestSummarizer.ts +2 -2
  157. package/src/feature-libraries/index.ts +1 -5
  158. package/src/feature-libraries/modular-schema/modularChangeCodecs.ts +3 -6
  159. package/src/feature-libraries/sequence-field/formatV2.ts +1 -0
  160. package/src/feature-libraries/treeCompressionUtils.ts +1 -15
  161. package/src/index.ts +4 -0
  162. package/src/packageVersion.ts +1 -1
  163. package/src/shared-tree/sharedTree.ts +12 -18
  164. package/src/shared-tree/sharedTreeChangeFamily.ts +2 -2
  165. package/src/shared-tree/treeCheckout.ts +2 -2
  166. package/src/shared-tree-core/index.ts +1 -1
  167. package/src/simple-tree/api/incrementalAllowedTypes.ts +20 -18
  168. package/src/simple-tree/api/index.ts +1 -1
  169. package/src/simple-tree/api/tree.ts +1 -1
  170. package/src/simple-tree/core/treeNodeKernel.ts +1 -0
  171. package/src/simple-tree/index.ts +1 -1
  172. package/src/simple-tree/node-kinds/array/arrayNode.ts +2 -0
  173. package/src/simple-tree/node-kinds/object/objectNode.ts +2 -1
  174. package/src/treeFactory.ts +13 -4
  175. package/src/util/breakable.ts +4 -4
  176. package/src/util/typeCheckTests.ts +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"treeFactory.d.ts","sourceRoot":"","sources":["../src/treeFactory.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,oCAAoC,CAAC;AAC3E,OAAO,EACN,KAAK,aAAa,EAClB,KAAK,iBAAiB,EAMtB,MAAM,6CAA6C,CAAC;AAGrD,OAAO,EAEN,KAAK,YAAY,EACjB,KAAK,iBAAiB,EACtB,KAAK,qBAAqB,EAC1B,KAAK,yBAAyB,EAE9B,MAAM,wBAAwB,CAAC;AAEhC,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,wBAAwB,CAAC;AAQpD;;;;GAIG;AACH,MAAM,WAAW,WAAY,SAAQ,aAAa,EAAE,YAAY;CAAG;AA8DnE;;;;GAIG;AACH,eAAO,MAAM,UAAU,oDAA2B,CAAC;AAEnD;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,wBAAgB,wBAAwB,CACvC,OAAO,EAAE,qBAAqB,GAC5B,gBAAgB,CAAC,KAAK,CAAC,CAEzB;AAED;;;;;GAKG;AACH,wBAAgB,8BAA8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AK,CAAC,CAEpD;AAED;;;GAGG;AACH,wBAAgB,yBAAyB,CACxC,OAAO,EAAE,iBAAiB,GACxB,gBAAgB,CAAC,KAAK,CAAC,CAEzB;AAED;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,wBAAgB,oBAAoB,CACnC,OAAO,EAAE,iBAAiB,GACxB,iBAAiB,CAAC,KAAK,CAAC,GAAG,gBAAgB,CAAC,KAAK,CAAC,CAGpD;AAED,wBAAgB,4BAA4B,CAC3C,OAAO,EAAE,yBAAyB,GAChC,iBAAiB,CAAC,KAAK,CAAC,GAAG,gBAAgB,CAAC,KAAK,CAAC,CASpD;AAED,wBAAgB,cAAc,CAAC,OAAO,EAAE,iBAAiB,GAAG,yBAAyB,CAQpF"}
@@ -4,7 +4,7 @@
4
4
  * Licensed under the MIT License.
5
5
  */
6
6
  Object.defineProperty(exports, "__esModule", { value: true });
7
- exports.resolveOptions = exports.configuredSharedTreeInternal = exports.configuredSharedTree = exports.configuredSharedTreeBetaLegacy = exports.configuredSharedTreeBeta = exports.SharedTree = void 0;
7
+ exports.resolveOptions = exports.configuredSharedTreeInternal = exports.configuredSharedTree = exports.configuredSharedTreeAlpha = exports.configuredSharedTreeBetaLegacy = exports.configuredSharedTreeBeta = exports.SharedTree = void 0;
8
8
  const internal_1 = require("@fluidframework/shared-object-base/internal");
9
9
  const internal_2 = require("@fluidframework/telemetry-utils/internal");
10
10
  const index_js_1 = require("./shared-tree/index.js");
@@ -93,6 +93,14 @@ function configuredSharedTreeBetaLegacy(options) {
93
93
  return configuredSharedTree(options);
94
94
  }
95
95
  exports.configuredSharedTreeBetaLegacy = configuredSharedTreeBetaLegacy;
96
+ /**
97
+ * {@link configuredSharedTreeBeta} but including the alpha {@link SharedTreeOptions}.
98
+ * @alpha
99
+ */
100
+ function configuredSharedTreeAlpha(options) {
101
+ return configuredSharedTree(options);
102
+ }
103
+ exports.configuredSharedTreeAlpha = configuredSharedTreeAlpha;
96
104
  /**
97
105
  * {@link configuredSharedTreeBetaLegacy} but including `@alpha` options.
98
106
  *
@@ -135,10 +143,9 @@ function resolveOptions(options) {
135
143
  const internal = {
136
144
  ...resolveSharedBranchesOptions(options.enableSharedBranches),
137
145
  };
138
- (0, index_js_2.copyProperty)(options, "forest", internal);
139
- (0, index_js_2.copyProperty)(options, "jsonValidator", internal);
140
- (0, index_js_2.copyProperty)(options, "minVersionForCollab", internal);
141
- (0, index_js_2.copyProperty)(options, "treeEncodeType", internal);
146
+ for (const optionName of Object.keys(options)) {
147
+ (0, index_js_2.copyProperty)(options, optionName, internal);
148
+ }
142
149
  return internal;
143
150
  }
144
151
  exports.resolveOptions = resolveOptions;
@@ -1 +1 @@
1
- {"version":3,"file":"treeFactory.js","sourceRoot":"","sources":["../src/treeFactory.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAIH,0EAQqD;AACrD,uEAAsE;AAEtE,qDAOgC;AAChC,uEAAwF;AAExF,8CAA0D;AAC1D,+CAAsD;AACtD,0DAGqC;AASrC;;;;;GAKG;AACH,SAAS,iBAAiB,CACzB,OAAkC;IAElC,SAAS,kBAAkB,CAAC,IAAgB;QAC3C,IAAI,IAAI,CAAC,YAAY,KAAK,SAAS,EAAE,CAAC;YACrC,MAAM,IAAI,qBAAU,CAAC,gDAAgD,CAAC,CAAC;QACxE,CAAC;QAED,MAAM,EAAE,mBAAmB,EAAE,GAAG,YAAY,EAAE,GAAG,OAAO,CAAC;QAEzD,MAAM,eAAe,GAAG;YACvB,GAAG,YAAY;YACf,SAAS;YACT,kGAAkG;YAClG,0BAA0B;YAC1B,oGAAoG;YACpG,sGAAsG;YACtG,oFAAoF;YACpF,gGAAgG;YAChG,wIAAwI;YACxI,mBAAmB,EAClB,mBAAmB,IAAI,IAAI,CAAC,mBAAmB,IAAI,6BAAkB,CAAC,IAAI;SAC3E,CAAC;QAEF,OAAO,IAAI,2BAAgB,CAC1B,IAAI,oBAAS,CAAC,YAAY,CAAC,EAC3B,IAAI,CAAC,YAAY,EACjB,IAAI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C,MAAM,mBAAmB,GAA+B;QACvD,IAAI,EAAE,+CAAqB;QAC3B,UAAU,EAAE,8CAAoB;QAChC,sBAAsB,EAAE,mBAAmB;QAC3C,OAAO,EAAE,iBAAiB,CAAC,OAAO,CAAC;KACnC,CAAC;IAEF,OAAO,IAAA,+BAAoB,EAAQ,mBAAmB,CAAC,CAAC;AACzD,CAAC;AAXD,oEAWC;AAED,SAAgB,cAAc,CAAC,OAA0B;IACxD,MAAM,QAAQ,GAA8B;QAC3C,GAAG,4BAA4B,CAAC,OAAO,CAAC,oBAAoB,CAAC;KAC7D,CAAC;IACF,IAAA,uBAAY,EAAC,OAAO,EAAE,QAAQ,EAAE,QAAQ,CAAC,CAAC;IAC1C,IAAA,uBAAY,EAAC,OAAO,EAAE,eAAe,EAAE,QAAQ,CAAC,CAAC;IACjD,IAAA,uBAAY,EAAC,OAAO,EAAE,qBAAqB,EAAE,QAAQ,CAAC,CAAC;IACvD,IAAA,uBAAY,EAAC,OAAO,EAAE,gBAAgB,EAAE,QAAQ,CAAC,CAAC;IAClD,OAAO,QAAQ,CAAC;AACjB,CAAC;AATD,wCASC;AAED,SAAS,4BAA4B,CACpC,oBAAyC;IAEzC,OAAO,oBAAoB,KAAK,IAAI,CAAC,CAAC,CAAC,qBAAqB,CAAC,CAAC,CAAC,EAAE,CAAC;AACnE,CAAC;AACD,MAAM,qBAAqB,GAA8B;IACxD,qBAAqB,EAAE,wDAA6C;IACpE,yBAAyB,EAAE,4DAAiD;CAC5E,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport type { IChannelStorageService } from \"@fluidframework/datastore-definitions/internal\";\nimport type { SharedObjectKind } from \"@fluidframework/shared-object-base\";\nimport {\n\ttype ISharedObject,\n\ttype ISharedObjectKind,\n\tmakeSharedObjectKind,\n\ttype KernelArgs,\n\ttype SharedKernelFactory,\n\ttype SharedObjectOptions,\n\ttype FactoryOut,\n} from \"@fluidframework/shared-object-base/internal\";\nimport { UsageError } from \"@fluidframework/telemetry-utils/internal\";\n\nimport {\n\tSharedTreeKernel,\n\ttype ITreePrivate,\n\ttype SharedTreeOptions,\n\ttype SharedTreeOptionsBeta,\n\ttype SharedTreeOptionsInternal,\n\ttype SharedTreeKernelView,\n} from \"./shared-tree/index.js\";\nimport { SharedTreeFactoryType, SharedTreeAttributes } from \"./sharedTreeAttributes.js\";\nimport type { ITree } from \"./simple-tree/index.js\";\nimport { Breakable, copyProperty } from \"./util/index.js\";\nimport { FluidClientVersion } from \"./codec/index.js\";\nimport {\n\teditManagerFormatVersionSelectorForSharedBranches,\n\tmessageFormatVersionSelectorForSharedBranches,\n} from \"./shared-tree-core/index.js\";\n\n/**\n * {@link ITreePrivate} extended with ISharedObject.\n * @remarks\n * This is used when integration testing this package with the Fluid runtime as it exposes the APIs the runtime consumes to manipulate the tree.\n */\nexport interface ISharedTree extends ISharedObject, ITreePrivate {}\n\n/**\n * Creates a factory for shared tree kernels with the given options.\n * @remarks\n * Exposes {@link ITreePrivate} to allow access to internals in tests without a cast.\n * Code exposing this beyond this package will need to update to a more public type.\n */\nfunction treeKernelFactory(\n\toptions: SharedTreeOptionsInternal,\n): SharedKernelFactory<SharedTreeKernelView> {\n\tfunction treeFromKernelArgs(args: KernelArgs): SharedTreeKernel {\n\t\tif (args.idCompressor === undefined) {\n\t\t\tthrow new UsageError(\"IdCompressor must be enabled to use SharedTree\");\n\t\t}\n\n\t\tconst { minVersionForCollab, ...otherOptions } = options;\n\n\t\tconst adjustedOptions = {\n\t\t\t...otherOptions,\n\t\t\t// Cases:\n\t\t\t// A. If options specifies minVersionForCollab, it takes precedence over args.minVersionForCollab.\n\t\t\t// This value is set when:\n\t\t\t// - A customer using the declarative SharedTree API specifies the setting at the Shared Tree level.\n\t\t\t// There is currently no way to set it via the declarative API, but it could be added in the future.\n\t\t\t// - treeKernelFactory is invoked in a fuzz test with a specific minVersionForCollab\n\t\t\t// B. Otherwise, we use args.minVersionForCollab, which is propagated from the ContainerRuntime.\n\t\t\t// C. If neither specifies it, we fall back to a default value default of 2.0 since that is the oldest version that supports SharedTree.\n\t\t\tminVersionForCollab:\n\t\t\t\tminVersionForCollab ?? args.minVersionForCollab ?? FluidClientVersion.v2_0,\n\t\t};\n\n\t\treturn new SharedTreeKernel(\n\t\t\tnew Breakable(\"SharedTree\"),\n\t\t\targs.sharedObject,\n\t\t\targs.serializer,\n\t\t\targs.submitLocalMessage,\n\t\t\targs.lastSequenceNumber,\n\t\t\targs.initialSequenceNumber,\n\t\t\targs.logger,\n\t\t\targs.idCompressor,\n\t\t\tadjustedOptions,\n\t\t);\n\t}\n\n\treturn {\n\t\tcreate: (args: KernelArgs): FactoryOut<SharedTreeKernelView> => {\n\t\t\tconst k = treeFromKernelArgs(args);\n\t\t\treturn { kernel: k, view: k.view };\n\t\t},\n\n\t\tasync loadCore(\n\t\t\targs: KernelArgs,\n\t\t\tstorage: IChannelStorageService,\n\t\t): Promise<FactoryOut<SharedTreeKernelView>> {\n\t\t\tconst k = treeFromKernelArgs(args);\n\t\t\tawait k.loadCore(storage);\n\t\t\treturn { kernel: k, view: k.view };\n\t\t},\n\t};\n}\n\n/**\n * SharedTree is a hierarchical data structure for collaboratively editing strongly typed JSON-like trees\n * of objects, arrays, and other data types.\n * @legacy @beta\n */\nexport const SharedTree = configuredSharedTree({});\n\n/**\n * {@link SharedTree} but allowing a non-default configuration.\n * @remarks\n * This is useful for debugging and testing.\n * For example it can be used to opt into extra validation or see if opting out of some optimizations fixes an issue.\n *\n * With great care, and knowledge of the support and stability of the options exposed here,\n * this can also be used to opt into some features early or for performance tuning.\n *\n * @example\n * ```typescript\n * import {\n * \tconfiguredSharedTreeBeta,\n * \tForestTypeReference,\n * } from \"fluid-framework/beta\";\n * const SharedTree = configuredSharedTree({\n * \tforest: ForestTypeReference,\n * });\n * ```\n * @privateRemarks\n * The Legacy `ISharedObjectKind<ITree>` type is omitted here for simplicity.\n * @beta\n */\nexport function configuredSharedTreeBeta(\n\toptions: SharedTreeOptionsBeta,\n): SharedObjectKind<ITree> {\n\treturn configuredSharedTree(options);\n}\n\n/**\n * {@link configuredSharedTreeBeta} including the legacy `ISharedObjectKind` type.\n * @privateRemarks\n * This is given a different export name (with legacy appended) to avoid the need to do the special reexport with different types from the fluid-framework package.\n * @legacy @beta\n */\nexport function configuredSharedTreeBetaLegacy(\n\toptions: SharedTreeOptionsBeta,\n): ISharedObjectKind<ITree> & SharedObjectKind<ITree> {\n\treturn configuredSharedTree(options);\n}\n\n/**\n * {@link configuredSharedTreeBetaLegacy} but including `@alpha` options.\n *\n * @example\n * ```typescript\n * import {\n * \tTreeCompressionStrategy,\n * \tconfiguredSharedTree,\n * \tFormatValidatorBasic,\n * \tForestTypeReference,\n * } from \"@fluidframework/tree/internal\";\n * const SharedTree = configuredSharedTree({\n * \tforest: ForestTypeReference,\n * \tjsonValidator: FormatValidatorBasic,\n * \ttreeEncodeType: TreeCompressionStrategy.Uncompressed,\n * });\n * ```\n * @privateRemarks\n * This should be legacy, but has to be internal due to no alpha+legacy being setup yet.\n *\n * This should be renamed to `configuredSharedTreeAlpha` to avoid colliding with the eventual public version which will have less options.\n * @internal\n */\nexport function configuredSharedTree(\n\toptions: SharedTreeOptions,\n): ISharedObjectKind<ITree> & SharedObjectKind<ITree> {\n\tconst internalOptions = resolveOptions(options);\n\treturn configuredSharedTreeInternal(internalOptions);\n}\n\nexport function configuredSharedTreeInternal(\n\toptions: SharedTreeOptionsInternal,\n): ISharedObjectKind<ITree> & SharedObjectKind<ITree> {\n\tconst sharedObjectOptions: SharedObjectOptions<ITree> = {\n\t\ttype: SharedTreeFactoryType,\n\t\tattributes: SharedTreeAttributes,\n\t\ttelemetryContextPrefix: \"fluid_sharedTree_\",\n\t\tfactory: treeKernelFactory(options),\n\t};\n\n\treturn makeSharedObjectKind<ITree>(sharedObjectOptions);\n}\n\nexport function resolveOptions(options: SharedTreeOptions): SharedTreeOptionsInternal {\n\tconst internal: SharedTreeOptionsInternal = {\n\t\t...resolveSharedBranchesOptions(options.enableSharedBranches),\n\t};\n\tcopyProperty(options, \"forest\", internal);\n\tcopyProperty(options, \"jsonValidator\", internal);\n\tcopyProperty(options, \"minVersionForCollab\", internal);\n\tcopyProperty(options, \"treeEncodeType\", internal);\n\treturn internal;\n}\n\nfunction resolveSharedBranchesOptions(\n\tenableSharedBranches: boolean | undefined,\n): SharedTreeOptionsInternal {\n\treturn enableSharedBranches === true ? sharedBranchesOptions : {};\n}\nconst sharedBranchesOptions: SharedTreeOptionsInternal = {\n\tmessageFormatSelector: messageFormatVersionSelectorForSharedBranches,\n\teditManagerFormatSelector: editManagerFormatVersionSelectorForSharedBranches,\n};\n"]}
1
+ {"version":3,"file":"treeFactory.js","sourceRoot":"","sources":["../src/treeFactory.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAIH,0EAQqD;AACrD,uEAAsE;AAEtE,qDAOgC;AAChC,uEAAwF;AAExF,8CAA0D;AAC1D,+CAAsD;AACtD,0DAGqC;AASrC;;;;;GAKG;AACH,SAAS,iBAAiB,CACzB,OAAkC;IAElC,SAAS,kBAAkB,CAAC,IAAgB;QAC3C,IAAI,IAAI,CAAC,YAAY,KAAK,SAAS,EAAE,CAAC;YACrC,MAAM,IAAI,qBAAU,CAAC,gDAAgD,CAAC,CAAC;QACxE,CAAC;QAED,MAAM,EAAE,mBAAmB,EAAE,GAAG,YAAY,EAAE,GAAG,OAAO,CAAC;QAEzD,MAAM,eAAe,GAAG;YACvB,GAAG,YAAY;YACf,SAAS;YACT,kGAAkG;YAClG,0BAA0B;YAC1B,oGAAoG;YACpG,sGAAsG;YACtG,oFAAoF;YACpF,gGAAgG;YAChG,wIAAwI;YACxI,mBAAmB,EAClB,mBAAmB,IAAI,IAAI,CAAC,mBAAmB,IAAI,6BAAkB,CAAC,IAAI;SAC3E,CAAC;QAEF,OAAO,IAAI,2BAAgB,CAC1B,IAAI,oBAAS,CAAC,YAAY,CAAC,EAC3B,IAAI,CAAC,YA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,CAAC,OAAO,CAAC,CAAC;IAChD,OAAO,4BAA4B,CAAC,eAAe,CAAC,CAAC;AACtD,CAAC;AALD,oDAKC;AAED,SAAgB,4BAA4B,CAC3C,OAAkC;IAElC,MAAM,mBAAmB,GAA+B;QACvD,IAAI,EAAE,+CAAqB;QAC3B,UAAU,EAAE,8CAAoB;QAChC,sBAAsB,EAAE,mBAAmB;QAC3C,OAAO,EAAE,iBAAiB,CAAC,OAAO,CAAC;KACnC,CAAC;IAEF,OAAO,IAAA,+BAAoB,EAAQ,mBAAmB,CAAC,CAAC;AACzD,CAAC;AAXD,oEAWC;AAED,SAAgB,cAAc,CAAC,OAA0B;IACxD,MAAM,QAAQ,GAA8B;QAC3C,GAAG,4BAA4B,CAAC,OAAO,CAAC,oBAAoB,CAAC;KAC7D,CAAC;IACF,KAAK,MAAM,UAAU,IAAI,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,EAAE,CAAC;QAC/C,IAAA,uBAAY,EAAC,OAAO,EAAE,UAAU,EAAE,QAAQ,CAAC,CAAC;IAC7C,CAAC;IACD,OAAO,QAAQ,CAAC;AACjB,CAAC;AARD,wCAQC;AAED,SAAS,4BAA4B,CACpC,oBAAyC;IAEzC,OAAO,oBAAoB,KAAK,IAAI,CAAC,CAAC,CAAC,qBAAqB,CAAC,CAAC,CAAC,EAAE,CAAC;AACnE,CAAC;AACD,MAAM,qBAAqB,GAA8B;IACxD,qBAAqB,EAAE,wDAA6C;IACpE,yBAAyB,EAAE,4DAAiD;CAC5E,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport type { IChannelStorageService } from \"@fluidframework/datastore-definitions/internal\";\nimport type { SharedObjectKind } from \"@fluidframework/shared-object-base\";\nimport {\n\ttype ISharedObject,\n\ttype ISharedObjectKind,\n\tmakeSharedObjectKind,\n\ttype KernelArgs,\n\ttype SharedKernelFactory,\n\ttype SharedObjectOptions,\n\ttype FactoryOut,\n} from \"@fluidframework/shared-object-base/internal\";\nimport { UsageError } from \"@fluidframework/telemetry-utils/internal\";\n\nimport {\n\tSharedTreeKernel,\n\ttype ITreePrivate,\n\ttype SharedTreeOptions,\n\ttype SharedTreeOptionsBeta,\n\ttype SharedTreeOptionsInternal,\n\ttype SharedTreeKernelView,\n} from \"./shared-tree/index.js\";\nimport { SharedTreeFactoryType, SharedTreeAttributes } from \"./sharedTreeAttributes.js\";\nimport type { ITree } from \"./simple-tree/index.js\";\nimport { Breakable, copyProperty } from \"./util/index.js\";\nimport { FluidClientVersion } from \"./codec/index.js\";\nimport {\n\teditManagerFormatVersionSelectorForSharedBranches,\n\tmessageFormatVersionSelectorForSharedBranches,\n} from \"./shared-tree-core/index.js\";\n\n/**\n * {@link ITreePrivate} extended with ISharedObject.\n * @remarks\n * This is used when integration testing this package with the Fluid runtime as it exposes the APIs the runtime consumes to manipulate the tree.\n */\nexport interface ISharedTree extends ISharedObject, ITreePrivate {}\n\n/**\n * Creates a factory for shared tree kernels with the given options.\n * @remarks\n * Exposes {@link ITreePrivate} to allow access to internals in tests without a cast.\n * Code exposing this beyond this package will need to update to a more public type.\n */\nfunction treeKernelFactory(\n\toptions: SharedTreeOptionsInternal,\n): SharedKernelFactory<SharedTreeKernelView> {\n\tfunction treeFromKernelArgs(args: KernelArgs): SharedTreeKernel {\n\t\tif (args.idCompressor === undefined) {\n\t\t\tthrow new UsageError(\"IdCompressor must be enabled to use SharedTree\");\n\t\t}\n\n\t\tconst { minVersionForCollab, ...otherOptions } = options;\n\n\t\tconst adjustedOptions = {\n\t\t\t...otherOptions,\n\t\t\t// Cases:\n\t\t\t// A. If options specifies minVersionForCollab, it takes precedence over args.minVersionForCollab.\n\t\t\t// This value is set when:\n\t\t\t// - A customer using the declarative SharedTree API specifies the setting at the Shared Tree level.\n\t\t\t// There is currently no way to set it via the declarative API, but it could be added in the future.\n\t\t\t// - treeKernelFactory is invoked in a fuzz test with a specific minVersionForCollab\n\t\t\t// B. Otherwise, we use args.minVersionForCollab, which is propagated from the ContainerRuntime.\n\t\t\t// C. If neither specifies it, we fall back to a default value default of 2.0 since that is the oldest version that supports SharedTree.\n\t\t\tminVersionForCollab:\n\t\t\t\tminVersionForCollab ?? args.minVersionForCollab ?? FluidClientVersion.v2_0,\n\t\t};\n\n\t\treturn new SharedTreeKernel(\n\t\t\tnew Breakable(\"SharedTree\"),\n\t\t\targs.sharedObject,\n\t\t\targs.serializer,\n\t\t\targs.submitLocalMessage,\n\t\t\targs.lastSequenceNumber,\n\t\t\targs.initialSequenceNumber,\n\t\t\targs.logger,\n\t\t\targs.idCompressor,\n\t\t\tadjustedOptions,\n\t\t);\n\t}\n\n\treturn {\n\t\tcreate: (args: KernelArgs): FactoryOut<SharedTreeKernelView> => {\n\t\t\tconst k = treeFromKernelArgs(args);\n\t\t\treturn { kernel: k, view: k.view };\n\t\t},\n\n\t\tasync loadCore(\n\t\t\targs: KernelArgs,\n\t\t\tstorage: IChannelStorageService,\n\t\t): Promise<FactoryOut<SharedTreeKernelView>> {\n\t\t\tconst k = treeFromKernelArgs(args);\n\t\t\tawait k.loadCore(storage);\n\t\t\treturn { kernel: k, view: k.view };\n\t\t},\n\t};\n}\n\n/**\n * SharedTree is a hierarchical data structure for collaboratively editing strongly typed JSON-like trees\n * of objects, arrays, and other data types.\n * @legacy @beta\n */\nexport const SharedTree = configuredSharedTree({});\n\n/**\n * {@link SharedTree} but allowing a non-default configuration.\n * @remarks\n * This is useful for debugging and testing.\n * For example it can be used to opt into extra validation or see if opting out of some optimizations fixes an issue.\n *\n * With great care, and knowledge of the support and stability of the options exposed here,\n * this can also be used to opt into some features early or for performance tuning.\n *\n * @example\n * ```typescript\n * import {\n * \tconfiguredSharedTreeBeta,\n * \tForestTypeReference,\n * } from \"fluid-framework/beta\";\n * const SharedTree = configuredSharedTree({\n * \tforest: ForestTypeReference,\n * });\n * ```\n * @privateRemarks\n * The Legacy `ISharedObjectKind<ITree>` type is omitted here for simplicity.\n * @beta\n */\nexport function configuredSharedTreeBeta(\n\toptions: SharedTreeOptionsBeta,\n): SharedObjectKind<ITree> {\n\treturn configuredSharedTree(options);\n}\n\n/**\n * {@link configuredSharedTreeBeta} including the legacy `ISharedObjectKind` type.\n * @privateRemarks\n * This is given a different export name (with legacy appended) to avoid the need to do the special reexport with different types from the fluid-framework package.\n * @legacy @beta\n */\nexport function configuredSharedTreeBetaLegacy(\n\toptions: SharedTreeOptionsBeta,\n): ISharedObjectKind<ITree> & SharedObjectKind<ITree> {\n\treturn configuredSharedTree(options);\n}\n\n/**\n * {@link configuredSharedTreeBeta} but including the alpha {@link SharedTreeOptions}.\n * @alpha\n */\nexport function configuredSharedTreeAlpha(\n\toptions: SharedTreeOptions,\n): SharedObjectKind<ITree> {\n\treturn configuredSharedTree(options);\n}\n\n/**\n * {@link configuredSharedTreeBetaLegacy} but including `@alpha` options.\n *\n * @example\n * ```typescript\n * import {\n * \tTreeCompressionStrategy,\n * \tconfiguredSharedTree,\n * \tFormatValidatorBasic,\n * \tForestTypeReference,\n * } from \"@fluidframework/tree/internal\";\n * const SharedTree = configuredSharedTree({\n * \tforest: ForestTypeReference,\n * \tjsonValidator: FormatValidatorBasic,\n * \ttreeEncodeType: TreeCompressionStrategy.Uncompressed,\n * });\n * ```\n * @privateRemarks\n * This should be legacy, but has to be internal due to no alpha+legacy being setup yet.\n *\n * This should be renamed to `configuredSharedTreeAlpha` to avoid colliding with the eventual public version which will have less options.\n * @internal\n */\nexport function configuredSharedTree(\n\toptions: SharedTreeOptions,\n): ISharedObjectKind<ITree> & SharedObjectKind<ITree> {\n\tconst internalOptions = resolveOptions(options);\n\treturn configuredSharedTreeInternal(internalOptions);\n}\n\nexport function configuredSharedTreeInternal(\n\toptions: SharedTreeOptionsInternal,\n): ISharedObjectKind<ITree> & SharedObjectKind<ITree> {\n\tconst sharedObjectOptions: SharedObjectOptions<ITree> = {\n\t\ttype: SharedTreeFactoryType,\n\t\tattributes: SharedTreeAttributes,\n\t\ttelemetryContextPrefix: \"fluid_sharedTree_\",\n\t\tfactory: treeKernelFactory(options),\n\t};\n\n\treturn makeSharedObjectKind<ITree>(sharedObjectOptions);\n}\n\nexport function resolveOptions(options: SharedTreeOptions): SharedTreeOptionsInternal {\n\tconst internal: SharedTreeOptionsInternal = {\n\t\t...resolveSharedBranchesOptions(options.enableSharedBranches),\n\t};\n\tfor (const optionName of Object.keys(options)) {\n\t\tcopyProperty(options, optionName, internal);\n\t}\n\treturn internal;\n}\n\nfunction resolveSharedBranchesOptions(\n\tenableSharedBranches: boolean | undefined,\n): SharedTreeOptionsInternal {\n\treturn enableSharedBranches === true ? sharedBranchesOptions : {};\n}\nconst sharedBranchesOptions: SharedTreeOptionsInternal = {\n\tmessageFormatSelector: messageFormatVersionSelectorForSharedBranches,\n\teditManagerFormatSelector: editManagerFormatVersionSelectorForSharedBranches,\n};\n"]}
@@ -137,19 +137,19 @@ function throwIfBroken(target, context) {
137
137
  return replacementMethod;
138
138
  }
139
139
  exports.throwIfBroken = throwIfBroken;
140
- // eslint-disable-next-line @typescript-eslint/no-unsafe-function-type, @typescript-eslint/ban-types
140
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-function-type
141
141
  function nameFunctionFrom(toName, nameFrom) {
142
142
  toName.displayName =
143
143
  nameFrom.displayName ?? nameFrom.name;
144
144
  }
145
145
  const isBreakerSymbol = Symbol("isBreaker");
146
146
  // Accepting any function like value is desired and safe here as this does not call the provided function.
147
- // eslint-disable-next-line @typescript-eslint/no-unsafe-function-type, @typescript-eslint/ban-types
147
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-function-type
148
148
  function markBreaker(f) {
149
149
  f[isBreakerSymbol] = true;
150
150
  }
151
151
  // Accepting any function like value is desired and safe here as this does not call the provided function.
152
- // eslint-disable-next-line @typescript-eslint/no-unsafe-function-type, @typescript-eslint/ban-types
152
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-function-type
153
153
  function isBreaker(f) {
154
154
  return isBreakerSymbol in f;
155
155
  }
@@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AAI,OAAO,UAAU,CAAC,KAAK,KAAK,UAAU,EAAE,CAAC;wBAC5C,IAAI,CAAC,SAAS,CAAC,UAAU,CAAC,KAAK,CAAC,EAAE,CAAC;4BAClC,gKAAgK;4BAChK,UAAU,CAAC,KAAK,GAAG,cAAc,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC;4BACpD,MAAM,CAAC,cAAc,CAAC,kBAAkB,CAAC,SAAS,EAAE,GAAG,EAAE,UAAU,CAAC,CAAC;wBACtE,CAAC;oBACF,CAAC;gBACF,CAAC;YACF,CAAC;QACF,CAAC;QACD,SAAS,GAAG,OAAO,CAAC,cAAc,CAAC,SAAS,CAAC,CAAC;IAC/C,CAAC;IAED,OAAO,kBAAkB,CAAC;AAC3B,CAAC;AAnCD,sCAmCC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { assert } from \"@fluidframework/core-utils/internal\";\nimport { UsageError } from \"@fluidframework/telemetry-utils/internal\";\n\n/**\n * An object which can enter a \"broken\" state where trying to use it is a UsageError.\n * @remarks\n * Use {@link WithBreakable} to apply this to another object.\n * @sealed\n */\nexport class Breakable {\n\tprivate brokenBy?: Error;\n\n\tpublic constructor(\n\t\t/**\n\t\t * A name for a given breakable scope.\n\t\t * @remarks\n\t\t * This is useful for documenting the semantics of a given Breakable and when inspecting things in the debugger, but is currently otherwise unused.\n\t\t */\n\t\tprivate readonly name: string,\n\t) {}\n\n\t/**\n\t * Throws if this object is in the broken state.\n\t * @remarks\n\t * Can use {@link throwIfBroken} to apply this to a method.\n\t */\n\tpublic use(): void {\n\t\tif (this.brokenBy !== undefined) {\n\t\t\tconst error = new UsageError(\n\t\t\t\t`Invalid use of ${this.name} after it was put into an invalid state by another error.\\nOriginal Error:\\n${this.brokenBy}`,\n\t\t\t);\n\n\t\t\t// This \"cause\" field is added in ES2022, but using if even without that built in support, it is still helpful.\n\t\t\t// See https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Error/cause\n\t\t\t// TODO: remove this cast when targeting ES2022 lib or later.\n\t\t\t(error as { cause?: unknown }).cause =\n\t\t\t\t(this.brokenBy as { cause?: unknown }).cause ?? this.brokenBy;\n\n\t\t\tthrow error;\n\t\t}\n\t}\n\n\t/**\n\t * Puts this object into the broken state, and throws an error.\n\t *\n\t * @throws If already broken by a different error, throws a UsageError, otherwise throws `brokenBy`.\n\t */\n\tpublic break(brokenBy: Error): never {\n\t\t// If already broken by this error, let it bubble up without rethrowing a modified version.\n\t\t// This prevents internal errors like asserts getting rethrown as different errors when wrapped with multiple call to `{@link Breakable.run}` or `{@link breakingMethod}`.\n\t\tif (this.brokenBy !== brokenBy) {\n\t\t\tthis.use();\n\t\t\tthis.brokenBy = brokenBy;\n\t\t}\n\t\tthrow brokenBy;\n\t}\n\n\t/**\n\t * {@link Breakable.break}, except tolerates `unknown` to be more easily used by catch blocks.\n\t * @privateRemarks\n\t * If there is a use-case, this should be made public.\n\t */\n\tprivate rethrowCaught(brokenBy: unknown): never {\n\t\tif (brokenBy instanceof Error) {\n\t\t\tthis.break(brokenBy);\n\t\t}\n\t\tthis.break(\n\t\t\tnew Error(`Non-error thrown breaking ${this.name}. Thrown value: \"${brokenBy}\"`),\n\t\t);\n\t}\n\n\t/**\n\t * Runs code which should break the object if it throws.\n\t * @remarks\n\t * Like {@link Breakable.use}, this also throws if already broken.\n\t * Any exceptions this catches are re-thrown.\n\t * Can use {@link breakingMethod} to apply this to a method.\n\t */\n\tpublic run<TResult>(breaker: () => TResult): TResult {\n\t\tthis.use();\n\t\ttry {\n\t\t\treturn breaker();\n\t\t} catch (error: unknown) {\n\t\t\tthis.rethrowCaught(error);\n\t\t}\n\t}\n\n\t/**\n\t * Clears the existing broken state.\n\t * @remarks\n\t * This is rarely safe to to: it is only ok when all objects using this breaker are known to not have been left in an invalid state.\n\t * This is pretty much only safe in tests which just were checking a specific error was thrown, and which know that error closepath is actually exception safe.\n\t */\n\tpublic clearError(): void {\n\t\tassert(this.brokenBy !== undefined, 0x9b6 /* No error to clear */);\n\t\tthis.brokenBy = undefined;\n\t}\n}\n\n/**\n * Marks an object as being able to be in a broken state (unknown/unspecified/broken state due to unhandled exception).\n * @remarks\n * See decorators {@link breakingMethod} and {@link throwIfBroken} for ease of use.\n */\nexport interface WithBreakable {\n\t/**\n\t * The breaker for this object.\n\t * @remarks\n\t * If this `breaker` is in the broken state, the `WithBreakable` should be considered in a broken state.\n\t */\n\treadonly breaker: Breakable;\n}\n\n/**\n * Decorator for methods which should break the object when they throw.\n * @remarks\n * This also throws if already broken like {@link throwIfBroken}.\n * See {@link Breakable.run} for details.\n *\n * This should be used on methods which modify data that could result in an unsupported/broken state if an exception is thrown while modifying.\n * It is ok for breakingMethods to call each-other.\n * @privateRemarks\n * Explicitly capturing the full `Target` type is necessary to make this work with generic methods with unknown numbers of type parameters.\n */\nexport function breakingMethod<\n\tTarget extends ((...args: any[]) => unknown) & ((this: This, ...args: Args) => Return),\n\tThis extends WithBreakable,\n\tArgs extends never[],\n\tReturn,\n>(target: Target, context?: ClassMethodDecoratorContext<This, Target>): Target {\n\tfunction replacementMethod(this: This, ...args: Args): Return {\n\t\tif (this.breaker === undefined) {\n\t\t\t// This case is necessary for when wrapping methods which are invoked inside the constructor of the base class before `breaker` is set.\n\t\t\t// Since the constructor throwing does not return an object, failing to put it into a broken state is not too bad.\n\t\t\t// However when more than just the constructed object should be broken, this can result in missing a break.\n\t\t\treturn target.call(this, ...args);\n\t\t}\n\t\treturn this.breaker.run(() => {\n\t\t\treturn target.call(this, ...args);\n\t\t});\n\t}\n\tmarkBreaker(replacementMethod);\n\tnameFunctionFrom(replacementMethod, target);\n\treturn replacementMethod as Target;\n}\n\n/**\n * Decorator for methods which should throw if the object is in a broken state.\n * @remarks\n * This should be used on methods which read data that could be invalid when the object is broken.\n * @privateRemarks\n * Explicitly capturing the full `Target` type is necessary to make this work with generic methods with unknown numbers of type parameters.\n */\nexport function throwIfBroken<\n\tTarget extends ((...args: any[]) => unknown) & ((this: This, ...args: Args) => Return),\n\tThis extends WithBreakable,\n\tArgs extends never[],\n\tReturn,\n>(target: Target, context: ClassMethodDecoratorContext<This, Target>): Target {\n\tfunction replacementMethod(this: This, ...args: Args): Return {\n\t\tthis.breaker.use();\n\t\treturn target.call(this, ...args);\n\t}\n\tmarkBreaker(replacementMethod);\n\tnameFunctionFrom(replacementMethod, target);\n\treturn replacementMethod as Target;\n}\n\n// eslint-disable-next-line @typescript-eslint/no-unsafe-function-type, @typescript-eslint/ban-types\ntype PossiblyNamedFunction = Function & { displayName?: undefined | string };\n\n// eslint-disable-next-line @typescript-eslint/no-unsafe-function-type, @typescript-eslint/ban-types\nfunction nameFunctionFrom(toName: Function, nameFrom: Function): void {\n\t(toName as PossiblyNamedFunction).displayName =\n\t\t(nameFrom as PossiblyNamedFunction).displayName ?? nameFrom.name;\n}\n\nconst isBreakerSymbol: unique symbol = Symbol(\"isBreaker\");\n\n// Accepting any function like value is desired and safe here as this does not call the provided function.\n// eslint-disable-next-line @typescript-eslint/no-unsafe-function-type, @typescript-eslint/ban-types\nfunction markBreaker(f: Function): void {\n\t(f as unknown as Record<typeof isBreakerSymbol, true>)[isBreakerSymbol] = true;\n}\n\n// Accepting any function like value is desired and safe here as this does not call the provided function.\n// eslint-disable-next-line @typescript-eslint/no-unsafe-function-type, @typescript-eslint/ban-types\nfunction isBreaker(f: Function): boolean {\n\treturn isBreakerSymbol in (f as unknown as Record<typeof isBreakerSymbol, true>);\n}\n\n/**\n * Decorator for classes which should break when their methods throw.\n * @remarks\n * Applies {@link breakingMethod} to all methods declared directly by class or its base classes.\n * Does not include those on derived classes.\n * Does not include getters or setters, or value properties.\n * Methods already marked as {@link breakingMethod} or {@link throwIfBroken} are unaffected.\n */\nexport function breakingClass<Target extends abstract new (...args: any[]) => WithBreakable>(\n\ttarget: Target,\n\tcontext: ClassDecoratorContext<Target>,\n): Target {\n\t// This could extend target, but doing so adds an extra step in the prototype chain and makes the instances just show up as \"DecoratedBreakable\" in the debugger.\n\tconst DecoratedBreakable = target;\n\n\t// Keep track of what keys we have seen (and already wrapped if needed).\n\t// Used to avoid rewrapping already wrapped properties.\n\t// Preloaded with \"constructor\" to avoid wrapping the constructor as there is no need to set the broken flag when the constructor throws and does not return an object.\n\t// Avoiding wrapping the constructor also avoids messing up the displayed name in the debugger.\n\tconst doNotWrap: Set<string | symbol> = new Set([\"constructor\"]);\n\n\tlet prototype: object | null = target.prototype;\n\twhile (prototype !== null) {\n\t\tfor (const key of Reflect.ownKeys(prototype)) {\n\t\t\tif (!doNotWrap.has(key)) {\n\t\t\t\tdoNotWrap.add(key);\n\t\t\t\tconst descriptor = Reflect.getOwnPropertyDescriptor(prototype, key);\n\t\t\t\tif (descriptor !== undefined) {\n\t\t\t\t\t// Method\n\t\t\t\t\tif (typeof descriptor.value === \"function\") {\n\t\t\t\t\t\tif (!isBreaker(descriptor.value)) {\n\t\t\t\t\t\t\t// This does not affect the original class, see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/getOwnPropertyDescriptor\n\t\t\t\t\t\t\tdescriptor.value = breakingMethod(descriptor.value);\n\t\t\t\t\t\t\tObject.defineProperty(DecoratedBreakable.prototype, key, descriptor);\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tprototype = Reflect.getPrototypeOf(prototype);\n\t}\n\n\treturn DecoratedBreakable;\n}\n"]}
1
+ {"version":3,"file":"breakable.js","sourceRoot":"","sources":["../../src/util/breakable.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,kEAA6D;AAC7D,uEAAsE;AAEtE;;;;;GAKG;AACH,MAAa,SAAS;IAGrB;IACC;;;;OAIG;IACc,IAAY;QAAZ,SAAI,GAAJ,IAAI,CAAQ;IAC3B,CAAC;IAEJ;;;;OAIG;IACI,GAAG;QACT,IAAI,IAAI,CAAC,QAAQ,KAAK,SAAS,EAAE,CAAC;YACjC,MAAM,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YACF,CAAC;QACF,CAAC;QACD,SAAS,GAAG,OAAO,CAAC,cAAc,CAAC,SAAS,CAAC,CAAC;IAC/C,CAAC;IAED,OAAO,kBAAkB,CAAC;AAC3B,CAAC;AAnCD,sCAmCC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { assert } from \"@fluidframework/core-utils/internal\";\nimport { UsageError } from \"@fluidframework/telemetry-utils/internal\";\n\n/**\n * An object which can enter a \"broken\" state where trying to use it is a UsageError.\n * @remarks\n * Use {@link WithBreakable} to apply this to another object.\n * @sealed\n */\nexport class Breakable {\n\tprivate brokenBy?: Error;\n\n\tpublic constructor(\n\t\t/**\n\t\t * A name for a given breakable scope.\n\t\t * @remarks\n\t\t * This is useful for documenting the semantics of a given Breakable and when inspecting things in the debugger, but is currently otherwise unused.\n\t\t */\n\t\tprivate readonly name: string,\n\t) {}\n\n\t/**\n\t * Throws if this object is in the broken state.\n\t * @remarks\n\t * Can use {@link throwIfBroken} to apply this to a method.\n\t */\n\tpublic use(): void {\n\t\tif (this.brokenBy !== undefined) {\n\t\t\tconst error = new UsageError(\n\t\t\t\t`Invalid use of ${this.name} after it was put into an invalid state by another error.\\nOriginal Error:\\n${this.brokenBy}`,\n\t\t\t);\n\n\t\t\t// This \"cause\" field is added in ES2022, but using if even without that built in support, it is still helpful.\n\t\t\t// See https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Error/cause\n\t\t\t// TODO: remove this cast when targeting ES2022 lib or later.\n\t\t\t(error as { cause?: unknown }).cause =\n\t\t\t\t(this.brokenBy as { cause?: unknown }).cause ?? this.brokenBy;\n\n\t\t\tthrow error;\n\t\t}\n\t}\n\n\t/**\n\t * Puts this object into the broken state, and throws an error.\n\t *\n\t * @throws If already broken by a different error, throws a UsageError, otherwise throws `brokenBy`.\n\t */\n\tpublic break(brokenBy: Error): never {\n\t\t// If already broken by this error, let it bubble up without rethrowing a modified version.\n\t\t// This prevents internal errors like asserts getting rethrown as different errors when wrapped with multiple call to `{@link Breakable.run}` or `{@link breakingMethod}`.\n\t\tif (this.brokenBy !== brokenBy) {\n\t\t\tthis.use();\n\t\t\tthis.brokenBy = brokenBy;\n\t\t}\n\t\tthrow brokenBy;\n\t}\n\n\t/**\n\t * {@link Breakable.break}, except tolerates `unknown` to be more easily used by catch blocks.\n\t * @privateRemarks\n\t * If there is a use-case, this should be made public.\n\t */\n\tprivate rethrowCaught(brokenBy: unknown): never {\n\t\tif (brokenBy instanceof Error) {\n\t\t\tthis.break(brokenBy);\n\t\t}\n\t\tthis.break(\n\t\t\tnew Error(`Non-error thrown breaking ${this.name}. Thrown value: \"${brokenBy}\"`),\n\t\t);\n\t}\n\n\t/**\n\t * Runs code which should break the object if it throws.\n\t * @remarks\n\t * Like {@link Breakable.use}, this also throws if already broken.\n\t * Any exceptions this catches are re-thrown.\n\t * Can use {@link breakingMethod} to apply this to a method.\n\t */\n\tpublic run<TResult>(breaker: () => TResult): TResult {\n\t\tthis.use();\n\t\ttry {\n\t\t\treturn breaker();\n\t\t} catch (error: unknown) {\n\t\t\tthis.rethrowCaught(error);\n\t\t}\n\t}\n\n\t/**\n\t * Clears the existing broken state.\n\t * @remarks\n\t * This is rarely safe to to: it is only ok when all objects using this breaker are known to not have been left in an invalid state.\n\t * This is pretty much only safe in tests which just were checking a specific error was thrown, and which know that error closepath is actually exception safe.\n\t */\n\tpublic clearError(): void {\n\t\tassert(this.brokenBy !== undefined, 0x9b6 /* No error to clear */);\n\t\tthis.brokenBy = undefined;\n\t}\n}\n\n/**\n * Marks an object as being able to be in a broken state (unknown/unspecified/broken state due to unhandled exception).\n * @remarks\n * See decorators {@link breakingMethod} and {@link throwIfBroken} for ease of use.\n */\nexport interface WithBreakable {\n\t/**\n\t * The breaker for this object.\n\t * @remarks\n\t * If this `breaker` is in the broken state, the `WithBreakable` should be considered in a broken state.\n\t */\n\treadonly breaker: Breakable;\n}\n\n/**\n * Decorator for methods which should break the object when they throw.\n * @remarks\n * This also throws if already broken like {@link throwIfBroken}.\n * See {@link Breakable.run} for details.\n *\n * This should be used on methods which modify data that could result in an unsupported/broken state if an exception is thrown while modifying.\n * It is ok for breakingMethods to call each-other.\n * @privateRemarks\n * Explicitly capturing the full `Target` type is necessary to make this work with generic methods with unknown numbers of type parameters.\n */\nexport function breakingMethod<\n\tTarget extends ((...args: any[]) => unknown) & ((this: This, ...args: Args) => Return),\n\tThis extends WithBreakable,\n\tArgs extends never[],\n\tReturn,\n>(target: Target, context?: ClassMethodDecoratorContext<This, Target>): Target {\n\tfunction replacementMethod(this: This, ...args: Args): Return {\n\t\tif (this.breaker === undefined) {\n\t\t\t// This case is necessary for when wrapping methods which are invoked inside the constructor of the base class before `breaker` is set.\n\t\t\t// Since the constructor throwing does not return an object, failing to put it into a broken state is not too bad.\n\t\t\t// However when more than just the constructed object should be broken, this can result in missing a break.\n\t\t\treturn target.call(this, ...args);\n\t\t}\n\t\treturn this.breaker.run(() => {\n\t\t\treturn target.call(this, ...args);\n\t\t});\n\t}\n\tmarkBreaker(replacementMethod);\n\tnameFunctionFrom(replacementMethod, target);\n\treturn replacementMethod as Target;\n}\n\n/**\n * Decorator for methods which should throw if the object is in a broken state.\n * @remarks\n * This should be used on methods which read data that could be invalid when the object is broken.\n * @privateRemarks\n * Explicitly capturing the full `Target` type is necessary to make this work with generic methods with unknown numbers of type parameters.\n */\nexport function throwIfBroken<\n\tTarget extends ((...args: any[]) => unknown) & ((this: This, ...args: Args) => Return),\n\tThis extends WithBreakable,\n\tArgs extends never[],\n\tReturn,\n>(target: Target, context: ClassMethodDecoratorContext<This, Target>): Target {\n\tfunction replacementMethod(this: This, ...args: Args): Return {\n\t\tthis.breaker.use();\n\t\treturn target.call(this, ...args);\n\t}\n\tmarkBreaker(replacementMethod);\n\tnameFunctionFrom(replacementMethod, target);\n\treturn replacementMethod as Target;\n}\n\n// eslint-disable-next-line @typescript-eslint/no-unsafe-function-type\ntype PossiblyNamedFunction = Function & { displayName?: undefined | string };\n\n// eslint-disable-next-line @typescript-eslint/no-unsafe-function-type\nfunction nameFunctionFrom(toName: Function, nameFrom: Function): void {\n\t(toName as PossiblyNamedFunction).displayName =\n\t\t(nameFrom as PossiblyNamedFunction).displayName ?? nameFrom.name;\n}\n\nconst isBreakerSymbol: unique symbol = Symbol(\"isBreaker\");\n\n// Accepting any function like value is desired and safe here as this does not call the provided function.\n// eslint-disable-next-line @typescript-eslint/no-unsafe-function-type\nfunction markBreaker(f: Function): void {\n\t(f as unknown as Record<typeof isBreakerSymbol, true>)[isBreakerSymbol] = true;\n}\n\n// Accepting any function like value is desired and safe here as this does not call the provided function.\n// eslint-disable-next-line @typescript-eslint/no-unsafe-function-type\nfunction isBreaker(f: Function): boolean {\n\treturn isBreakerSymbol in (f as unknown as Record<typeof isBreakerSymbol, true>);\n}\n\n/**\n * Decorator for classes which should break when their methods throw.\n * @remarks\n * Applies {@link breakingMethod} to all methods declared directly by class or its base classes.\n * Does not include those on derived classes.\n * Does not include getters or setters, or value properties.\n * Methods already marked as {@link breakingMethod} or {@link throwIfBroken} are unaffected.\n */\nexport function breakingClass<Target extends abstract new (...args: any[]) => WithBreakable>(\n\ttarget: Target,\n\tcontext: ClassDecoratorContext<Target>,\n): Target {\n\t// This could extend target, but doing so adds an extra step in the prototype chain and makes the instances just show up as \"DecoratedBreakable\" in the debugger.\n\tconst DecoratedBreakable = target;\n\n\t// Keep track of what keys we have seen (and already wrapped if needed).\n\t// Used to avoid rewrapping already wrapped properties.\n\t// Preloaded with \"constructor\" to avoid wrapping the constructor as there is no need to set the broken flag when the constructor throws and does not return an object.\n\t// Avoiding wrapping the constructor also avoids messing up the displayed name in the debugger.\n\tconst doNotWrap: Set<string | symbol> = new Set([\"constructor\"]);\n\n\tlet prototype: object | null = target.prototype;\n\twhile (prototype !== null) {\n\t\tfor (const key of Reflect.ownKeys(prototype)) {\n\t\t\tif (!doNotWrap.has(key)) {\n\t\t\t\tdoNotWrap.add(key);\n\t\t\t\tconst descriptor = Reflect.getOwnPropertyDescriptor(prototype, key);\n\t\t\t\tif (descriptor !== undefined) {\n\t\t\t\t\t// Method\n\t\t\t\t\tif (typeof descriptor.value === \"function\") {\n\t\t\t\t\t\tif (!isBreaker(descriptor.value)) {\n\t\t\t\t\t\t\t// This does not affect the original class, see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/getOwnPropertyDescriptor\n\t\t\t\t\t\t\tdescriptor.value = breakingMethod(descriptor.value);\n\t\t\t\t\t\t\tObject.defineProperty(DecoratedBreakable.prototype, key, descriptor);\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tprototype = Reflect.getPrototypeOf(prototype);\n\t}\n\n\treturn DecoratedBreakable;\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"typeCheckTests.d.ts","sourceRoot":"","sources":["../../src/util/typeCheckTests.ts"],"names":[],"mappings":"AAAA;;;GAGG;AASH,OAAO,KAAK,EACX,aAAa,EACb,SAAS,EACT,SAAS,EACT,WAAW,EACX,WAAW,EACX,mBAAmB,EACnB,WAAW,EACX,KAAK,EACL,cAAc,EACd,cAAc,EACd,YAAY,EACZ,WAAW,EACX,MAAM,gBAAgB,CAAC;AAExB;;;GAGG;AAEH,OAAO,OAAO,MAAM;CAAG;AACvB,OAAO,OAAO,MAAM;CAAG;AAEvB,OAAO,OAAO,QAAQ;IACrB,SAAS,CAAC,UAAU,EAAE,WAAW,CAAC;CAClC;AAED,OAAO,OAAO,QAAQ;IACrB,SAAS,CAAC,UAAU,EAAE,WAAW,CAAC;CAClC;AAED,OAAO,OAAO,QAAS,SAAQ,QAAQ;IACtC,SAAS,CAAC,UAAU,EAAE,WAAW,CAAC;CAClC;AAED,OAAO,OAAO,QAAS,SAAQ,QAAQ;IACtC,SAAS,CAAC,UAAU,EAAE,WAAW,CAAC;CAClC;AAED,OAAO,OAAO,OAAO,CAAC,EAAE;CAAI;AAE5B,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,CAAC,CAAC,EAAE,IAAI,CAAC,EAAE,CAAC,CAAC,EAAE,IAAI,CAAC,GAAG,CAAC,CAAC,GAAG,KAAK,CAAC,CAAC,CAAC,GAC/D,WAAW,CAAC,cAAc,CAAC,CAAC,EAAE,MAAM,CAAC,CAAC,GACtC,YAAY,CAAC,cAAc,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,GAClC,YAAY,CAAC,cAAc,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,GAClC,YAAY,CAAC,cAAc,CAAC,CAAC,CAAC,EAAE,IAAI,CAAC,EAAE,CAAC,CAAC,EAAE,IAAI,CAAC,CAAC,CAAC,GAClD,YAAY,CAAC,cAAc,CAAC,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC,CAAC,GAGtC,WAAW,CAAC,WAAW,CAAC;IAAE,CAAC,EAAE,MAAM,CAAC;IAAC,CAAC,EAAE,MAAM,CAAA;CAAE,EAAE,GAAG,GAAG,GAAG,CAAC,CAAC,GAC7D,WAAW,CAAC,WAAW,CAAC;IAAE,CAAC,CAAC,EAAE,MAAM,CAAC;IAAC,CAAC,EAAE,MAAM,CAAA;CAAE,EAAE,GAAG,GAAG,GAAG,CAAC,CAAC,GAC9D,YAAY,CAAC,WAAW,CAAC;IAAE,CAAC,CAAC,EAAE,MAAM,CAAC;IAAC,CAAC,EAAE,MAAM,CAAA;CAAE,EAAE,GAAG,CAAC,CAAC,GACzD,YAAY,CAAC,WAAW,CAAC;IAAE,CAAC,EAAE,MAAM,CAAC;IAAC,CAAC,EAAE,MAAM,CAAA;CAAE,EAAE,GAAG,CAAC,CAAC,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"typeCheckTests.js","sourceRoot":"","sources":["../../src/util/typeCheckTests.ts"],"names":[],"mappings":";AAAA;;;GAGG","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\n// These tests include making sure some banned types (like `{}`) work correctly,\n// and are authored with awareness of the issues with these types.\n\n/* eslint-disable @typescript-eslint/ban-types */\n/* eslint-disable @typescript-eslint/no-explicit-any */\n/* eslint-disable @typescript-eslint/no-extraneous-class */\n\nimport type {\n\tContravariant,\n\tCovariant,\n\tInvariant,\n\tMakeNominal,\n\tareOnlyKeys,\n\tareSafelyAssignable,\n\teitherIsAny,\n\tisAny,\n\tisAssignableTo,\n\tisStrictSubset,\n\trequireFalse,\n\trequireTrue,\n} from \"./typeCheck.js\";\n\n/**\n * Checks that typeCheck's constraints work as intended.\n * Since typescript does type erasure, these tests have to be compile time checks.\n */\n\ndeclare class Empty1 {}\ndeclare class Empty2 {}\n\ndeclare class Nominal1 {\n\tprotected _typeCheck: MakeNominal;\n}\n\ndeclare class Nominal2 {\n\tprotected _typeCheck: MakeNominal;\n}\n\ndeclare class Derived1 extends Nominal1 {\n\tprotected _typeCheck: MakeNominal;\n}\n\ndeclare class Derived2 extends Nominal1 {\n\tprotected _typeCheck: MakeNominal;\n}\n\ndeclare class Generic<_T> {}\n\ndeclare class GenericCovariant<out T> {\n\tprotected _typeCheck?: Covariant<T>;\n}\n\ndeclare class GenericContravariant<in T> {\n\tprotected _typeCheck?: Contravariant<T>;\n}\n\ndeclare class GenericInvariant<in out T> {\n\tprotected _typeCheck?: Invariant<T>;\n}\n\ndeclare class GenericMulti<in out T, out K> {\n\tprotected _typeCheck?: Invariant<T> & Covariant<K>;\n}\n\ninterface GenericCovariantInterface<out T> {\n\t_typeCheck?: Covariant<T>;\n}\n\ninterface GenericContravariantInterface<in T> {\n\t_typeCheck?: Contravariant<T>;\n}\n\ninterface GenericInvariantInterface<in out T> {\n\t_typeCheck?: Invariant<T>;\n}\n\n// Check that interface can be implemented without needing extra members\ndeclare class GenericInvariantImplementation<T> implements GenericInvariantInterface<T> {}\n\n/**\n * Import this into a context where you want to be sure the TypeCheck library is functioning properly.\n *\n * It's functionality depends on compiler settings (requires several of the strict options),\n * and could break with compiler version changes.\n * Thus for maximal confidence everything is working correctly, you need to import this.\n */\nexport type EnforceTypeCheckTests =\n\t// Add dummy use of type checking types above\n\t| requireTrue<\n\t\t\tisAssignableTo<GenericInvariantImplementation<number>, GenericInvariantInterface<number>>\n\t >\n\n\t// Positive tests\n\t| requireTrue<true>\n\t| requireFalse<false>\n\n\t// test isAssignableTo for normal types\n\t| requireTrue<isAssignableTo<Empty1, Empty1>>\n\t| requireTrue<isAssignableTo<Empty1, Empty2>>\n\t| requireTrue<isAssignableTo<Nominal1, Nominal1>>\n\t| requireFalse<isAssignableTo<Nominal1, Nominal2>>\n\t| requireTrue<isAssignableTo<Derived1, Nominal1>>\n\t| requireFalse<isAssignableTo<Derived1, Derived2>>\n\t| requireTrue<isAssignableTo<Generic<Nominal1>, Generic<Nominal2>>>\n\n\t// test isAssignableTo for any\n\t| requireTrue<isAssignableTo<any, Nominal1>>\n\t| requireTrue<isAssignableTo<Nominal1, any>>\n\n\t// test isAssignableTo for unknown: all types are assignable to unknown\n\t| requireFalse<isAssignableTo<unknown, Nominal1>>\n\t| requireTrue<isAssignableTo<Nominal1, unknown>>\n\n\t// test isAssignableTo for never: all types are assignable from never\n\t| requireTrue<isAssignableTo<never, Nominal1>>\n\t| requireFalse<isAssignableTo<Nominal1, never>>\n\n\t// test Covariant\n\t| requireFalse<isAssignableTo<GenericCovariant<Nominal1>, GenericCovariant<Nominal2>>>\n\t| requireTrue<isAssignableTo<GenericCovariant<Derived1>, GenericCovariant<Nominal1>>>\n\t| requireFalse<isAssignableTo<GenericCovariant<Nominal1>, GenericCovariant<Derived1>>>\n\n\t// test Contravariant\n\t| requireFalse<\n\t\t\tisAssignableTo<GenericContravariant<Nominal1>, GenericContravariant<Nominal2>>\n\t >\n\t| requireFalse<\n\t\t\tisAssignableTo<GenericContravariant<Derived1>, GenericContravariant<Nominal1>>\n\t >\n\t| requireTrue<isAssignableTo<GenericContravariant<Nominal1>, GenericContravariant<Derived1>>>\n\n\t// test Invariant\n\t| requireFalse<isAssignableTo<GenericInvariant<Nominal1>, GenericInvariant<Nominal2>>>\n\t| requireFalse<isAssignableTo<GenericInvariant<Derived1>, GenericInvariant<Nominal1>>>\n\t| requireFalse<isAssignableTo<GenericInvariant<Nominal1>, GenericInvariant<Derived1>>>\n\n\t// test Multiple parameters\n\t| requireFalse<\n\t\t\tisAssignableTo<GenericMulti<Nominal1, number>, GenericMulti<Derived1, number>>\n\t >\n\t| requireFalse<\n\t\t\tisAssignableTo<GenericMulti<number, Nominal1>, GenericMulti<number, Derived1>>\n\t >\n\t| requireTrue<isAssignableTo<GenericMulti<number, Derived1>, GenericMulti<number, Nominal1>>>\n\n\t// test Covariant Interface\n\t| requireFalse<\n\t\t\tisAssignableTo<GenericCovariantInterface<Nominal1>, GenericCovariantInterface<Nominal2>>\n\t >\n\t| requireTrue<\n\t\t\tisAssignableTo<GenericCovariantInterface<Derived1>, GenericCovariantInterface<Nominal1>>\n\t >\n\t| requireFalse<\n\t\t\tisAssignableTo<GenericCovariantInterface<Nominal1>, GenericCovariantInterface<Derived1>>\n\t >\n\n\t// test Contravariant Interface\n\t| requireFalse<\n\t\t\tisAssignableTo<\n\t\t\t\tGenericContravariantInterface<Nominal1>,\n\t\t\t\tGenericContravariantInterface<Nominal2>\n\t\t\t>\n\t >\n\t| requireFalse<\n\t\t\tisAssignableTo<\n\t\t\t\tGenericContravariantInterface<Derived1>,\n\t\t\t\tGenericContravariantInterface<Nominal1>\n\t\t\t>\n\t >\n\t| requireTrue<\n\t\t\tisAssignableTo<\n\t\t\t\tGenericContravariantInterface<Nominal1>,\n\t\t\t\tGenericContravariantInterface<Derived1>\n\t\t\t>\n\t >\n\n\t// test Invariant Interface\n\t| requireFalse<\n\t\t\tisAssignableTo<GenericInvariantInterface<Nominal1>, GenericInvariantInterface<Nominal2>>\n\t >\n\t| requireFalse<\n\t\t\tisAssignableTo<GenericInvariantInterface<Derived1>, GenericInvariantInterface<Nominal1>>\n\t >\n\t| requireFalse<\n\t\t\tisAssignableTo<GenericInvariantInterface<Nominal1>, GenericInvariantInterface<Derived1>>\n\t >\n\n\t// test eitherIsAny\n\t| requireTrue<eitherIsAny<any, Nominal1>>\n\t| requireTrue<eitherIsAny<Nominal1, any>>\n\t| requireTrue<eitherIsAny<any, any>>\n\t| requireFalse<eitherIsAny<Nominal1, Nominal1>>\n\n\t// areSafelyAssignable tests\n\t| requireTrue<areSafelyAssignable<Nominal1, Nominal1>>\n\t| requireFalse<areSafelyAssignable<unknown, Nominal1>>\n\t| requireFalse<areSafelyAssignable<any, any>>\n\t| requireTrue<areSafelyAssignable<unknown, unknown>>\n\t| requireFalse<areSafelyAssignable<any, Nominal1>>\n\t| requireFalse<areSafelyAssignable<Nominal1, any>>\n\t| requireFalse<areSafelyAssignable<unknown, any>>\n\n\t// test isAny\n\t| requireTrue<isAny<any>>\n\t| requireFalse<isAny<unknown>>\n\t| requireFalse<isAny<Nominal1>>\n\t| requireFalse<isAny<never>>\n\t| requireFalse<isAny<{}>>\n\t| requireFalse<isAny<boolean>>\n\t| requireFalse<isAny<number | undefined>>\n\t| requireFalse<isAny<1 & \"x\">>\n\t| requireFalse<isAny<(1 & 2) | {}>>\n\n\t// test isStrictSubset\n\t| requireTrue<isStrictSubset<1, 1 | 2>>\n\t| requireTrue<isStrictSubset<[1, true], [1 | 2, true]>>\n\t| requireTrue<isStrictSubset<[1, true], [1 | 2, true | false]>>\n\t| requireTrue<isStrictSubset<[1, true], [1, true | false]>>\n\t| requireTrue<isStrictSubset<[1, true], [1, true] | [1 | false]>>\n\t| requireTrue<isStrictSubset<1, number>>\n\t| requireFalse<isStrictSubset<1, 1>>\n\t| requireFalse<isStrictSubset<1, 2>>\n\t| requireFalse<isStrictSubset<[1, true], [1, true]>>\n\t| requireFalse<isStrictSubset<1 | 2, 1>>\n\n\t// areOnlyKeys\n\t| requireTrue<areOnlyKeys<{ a: number; b: number }, \"a\" | \"b\">>\n\t| requireTrue<areOnlyKeys<{ a?: number; b: number }, \"a\" | \"b\">>\n\t| requireFalse<areOnlyKeys<{ a?: number; b: number }, \"b\">>\n\t| requireFalse<areOnlyKeys<{ a: number; b: number }, \"a\">>;\n// This case is explicitly documented as unsupported.\n// | requireFalse<areOnlyKeys<Record<string, unknown>, \"a\">>;\n\n// negative tests (should not build)\n// @ts-expect-error negative test\ntype _falseIsTrue = requireTrue<false>;\n// @ts-expect-error negative test\ntype _trueIsFalse = requireFalse<true>;\n// @ts-expect-error negative test\ntype _booleanIsTrue = requireTrue<boolean>;\n// @ts-expect-error negative test\ntype _booleanIsFalse = requireFalse<boolean>;\n// @ts-expect-error negative test\ntype _emptyNotAssignable = requireFalse<isAssignableTo<Empty1, Empty2>>;\n// @ts-expect-error negative test\ntype _numberAssignableToString = requireTrue<isAssignableTo<number, string>>;\n// @ts-expect-error negative test\ntype _anyNotAny = requireFalse<isAny<any>>;\n"]}
1
+ {"version":3,"file":"typeCheckTests.js","sourceRoot":"","sources":["../../src/util/typeCheckTests.ts"],"names":[],"mappings":";AAAA;;;GAGG","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\n// These tests include making sure some banned types (like `{}`) work correctly,\n// and are authored with awareness of the issues with these types.\n\n/* eslint-disable @typescript-eslint/no-explicit-any */\n/* eslint-disable @typescript-eslint/no-extraneous-class */\n\nimport type {\n\tContravariant,\n\tCovariant,\n\tInvariant,\n\tMakeNominal,\n\tareOnlyKeys,\n\tareSafelyAssignable,\n\teitherIsAny,\n\tisAny,\n\tisAssignableTo,\n\tisStrictSubset,\n\trequireFalse,\n\trequireTrue,\n} from \"./typeCheck.js\";\n\n/**\n * Checks that typeCheck's constraints work as intended.\n * Since typescript does type erasure, these tests have to be compile time checks.\n */\n\ndeclare class Empty1 {}\ndeclare class Empty2 {}\n\ndeclare class Nominal1 {\n\tprotected _typeCheck: MakeNominal;\n}\n\ndeclare class Nominal2 {\n\tprotected _typeCheck: MakeNominal;\n}\n\ndeclare class Derived1 extends Nominal1 {\n\tprotected _typeCheck: MakeNominal;\n}\n\ndeclare class Derived2 extends Nominal1 {\n\tprotected _typeCheck: MakeNominal;\n}\n\ndeclare class Generic<_T> {}\n\ndeclare class GenericCovariant<out T> {\n\tprotected _typeCheck?: Covariant<T>;\n}\n\ndeclare class GenericContravariant<in T> {\n\tprotected _typeCheck?: Contravariant<T>;\n}\n\ndeclare class GenericInvariant<in out T> {\n\tprotected _typeCheck?: Invariant<T>;\n}\n\ndeclare class GenericMulti<in out T, out K> {\n\tprotected _typeCheck?: Invariant<T> & Covariant<K>;\n}\n\ninterface GenericCovariantInterface<out T> {\n\t_typeCheck?: Covariant<T>;\n}\n\ninterface GenericContravariantInterface<in T> {\n\t_typeCheck?: Contravariant<T>;\n}\n\ninterface GenericInvariantInterface<in out T> {\n\t_typeCheck?: Invariant<T>;\n}\n\n// Check that interface can be implemented without needing extra members\ndeclare class GenericInvariantImplementation<T> implements GenericInvariantInterface<T> {}\n\n/**\n * Import this into a context where you want to be sure the TypeCheck library is functioning properly.\n *\n * It's functionality depends on compiler settings (requires several of the strict options),\n * and could break with compiler version changes.\n * Thus for maximal confidence everything is working correctly, you need to import this.\n */\nexport type EnforceTypeCheckTests =\n\t// Add dummy use of type checking types above\n\t| requireTrue<\n\t\t\tisAssignableTo<GenericInvariantImplementation<number>, GenericInvariantInterface<number>>\n\t >\n\n\t// Positive tests\n\t| requireTrue<true>\n\t| requireFalse<false>\n\n\t// test isAssignableTo for normal types\n\t| requireTrue<isAssignableTo<Empty1, Empty1>>\n\t| requireTrue<isAssignableTo<Empty1, Empty2>>\n\t| requireTrue<isAssignableTo<Nominal1, Nominal1>>\n\t| requireFalse<isAssignableTo<Nominal1, Nominal2>>\n\t| requireTrue<isAssignableTo<Derived1, Nominal1>>\n\t| requireFalse<isAssignableTo<Derived1, Derived2>>\n\t| requireTrue<isAssignableTo<Generic<Nominal1>, Generic<Nominal2>>>\n\n\t// test isAssignableTo for any\n\t| requireTrue<isAssignableTo<any, Nominal1>>\n\t| requireTrue<isAssignableTo<Nominal1, any>>\n\n\t// test isAssignableTo for unknown: all types are assignable to unknown\n\t| requireFalse<isAssignableTo<unknown, Nominal1>>\n\t| requireTrue<isAssignableTo<Nominal1, unknown>>\n\n\t// test isAssignableTo for never: all types are assignable from never\n\t| requireTrue<isAssignableTo<never, Nominal1>>\n\t| requireFalse<isAssignableTo<Nominal1, never>>\n\n\t// test Covariant\n\t| requireFalse<isAssignableTo<GenericCovariant<Nominal1>, GenericCovariant<Nominal2>>>\n\t| requireTrue<isAssignableTo<GenericCovariant<Derived1>, GenericCovariant<Nominal1>>>\n\t| requireFalse<isAssignableTo<GenericCovariant<Nominal1>, GenericCovariant<Derived1>>>\n\n\t// test Contravariant\n\t| requireFalse<\n\t\t\tisAssignableTo<GenericContravariant<Nominal1>, GenericContravariant<Nominal2>>\n\t >\n\t| requireFalse<\n\t\t\tisAssignableTo<GenericContravariant<Derived1>, GenericContravariant<Nominal1>>\n\t >\n\t| requireTrue<isAssignableTo<GenericContravariant<Nominal1>, GenericContravariant<Derived1>>>\n\n\t// test Invariant\n\t| requireFalse<isAssignableTo<GenericInvariant<Nominal1>, GenericInvariant<Nominal2>>>\n\t| requireFalse<isAssignableTo<GenericInvariant<Derived1>, GenericInvariant<Nominal1>>>\n\t| requireFalse<isAssignableTo<GenericInvariant<Nominal1>, GenericInvariant<Derived1>>>\n\n\t// test Multiple parameters\n\t| requireFalse<\n\t\t\tisAssignableTo<GenericMulti<Nominal1, number>, GenericMulti<Derived1, number>>\n\t >\n\t| requireFalse<\n\t\t\tisAssignableTo<GenericMulti<number, Nominal1>, GenericMulti<number, Derived1>>\n\t >\n\t| requireTrue<isAssignableTo<GenericMulti<number, Derived1>, GenericMulti<number, Nominal1>>>\n\n\t// test Covariant Interface\n\t| requireFalse<\n\t\t\tisAssignableTo<GenericCovariantInterface<Nominal1>, GenericCovariantInterface<Nominal2>>\n\t >\n\t| requireTrue<\n\t\t\tisAssignableTo<GenericCovariantInterface<Derived1>, GenericCovariantInterface<Nominal1>>\n\t >\n\t| requireFalse<\n\t\t\tisAssignableTo<GenericCovariantInterface<Nominal1>, GenericCovariantInterface<Derived1>>\n\t >\n\n\t// test Contravariant Interface\n\t| requireFalse<\n\t\t\tisAssignableTo<\n\t\t\t\tGenericContravariantInterface<Nominal1>,\n\t\t\t\tGenericContravariantInterface<Nominal2>\n\t\t\t>\n\t >\n\t| requireFalse<\n\t\t\tisAssignableTo<\n\t\t\t\tGenericContravariantInterface<Derived1>,\n\t\t\t\tGenericContravariantInterface<Nominal1>\n\t\t\t>\n\t >\n\t| requireTrue<\n\t\t\tisAssignableTo<\n\t\t\t\tGenericContravariantInterface<Nominal1>,\n\t\t\t\tGenericContravariantInterface<Derived1>\n\t\t\t>\n\t >\n\n\t// test Invariant Interface\n\t| requireFalse<\n\t\t\tisAssignableTo<GenericInvariantInterface<Nominal1>, GenericInvariantInterface<Nominal2>>\n\t >\n\t| requireFalse<\n\t\t\tisAssignableTo<GenericInvariantInterface<Derived1>, GenericInvariantInterface<Nominal1>>\n\t >\n\t| requireFalse<\n\t\t\tisAssignableTo<GenericInvariantInterface<Nominal1>, GenericInvariantInterface<Derived1>>\n\t >\n\n\t// test eitherIsAny\n\t| requireTrue<eitherIsAny<any, Nominal1>>\n\t| requireTrue<eitherIsAny<Nominal1, any>>\n\t| requireTrue<eitherIsAny<any, any>>\n\t| requireFalse<eitherIsAny<Nominal1, Nominal1>>\n\n\t// areSafelyAssignable tests\n\t| requireTrue<areSafelyAssignable<Nominal1, Nominal1>>\n\t| requireFalse<areSafelyAssignable<unknown, Nominal1>>\n\t| requireFalse<areSafelyAssignable<any, any>>\n\t| requireTrue<areSafelyAssignable<unknown, unknown>>\n\t| requireFalse<areSafelyAssignable<any, Nominal1>>\n\t| requireFalse<areSafelyAssignable<Nominal1, any>>\n\t| requireFalse<areSafelyAssignable<unknown, any>>\n\n\t// test isAny\n\t| requireTrue<isAny<any>>\n\t| requireFalse<isAny<unknown>>\n\t| requireFalse<isAny<Nominal1>>\n\t| requireFalse<isAny<never>>\n\t| requireFalse<isAny<{}>>\n\t| requireFalse<isAny<boolean>>\n\t| requireFalse<isAny<number | undefined>>\n\t| requireFalse<isAny<1 & \"x\">>\n\t| requireFalse<isAny<(1 & 2) | {}>>\n\n\t// test isStrictSubset\n\t| requireTrue<isStrictSubset<1, 1 | 2>>\n\t| requireTrue<isStrictSubset<[1, true], [1 | 2, true]>>\n\t| requireTrue<isStrictSubset<[1, true], [1 | 2, true | false]>>\n\t| requireTrue<isStrictSubset<[1, true], [1, true | false]>>\n\t| requireTrue<isStrictSubset<[1, true], [1, true] | [1 | false]>>\n\t| requireTrue<isStrictSubset<1, number>>\n\t| requireFalse<isStrictSubset<1, 1>>\n\t| requireFalse<isStrictSubset<1, 2>>\n\t| requireFalse<isStrictSubset<[1, true], [1, true]>>\n\t| requireFalse<isStrictSubset<1 | 2, 1>>\n\n\t// areOnlyKeys\n\t| requireTrue<areOnlyKeys<{ a: number; b: number }, \"a\" | \"b\">>\n\t| requireTrue<areOnlyKeys<{ a?: number; b: number }, \"a\" | \"b\">>\n\t| requireFalse<areOnlyKeys<{ a?: number; b: number }, \"b\">>\n\t| requireFalse<areOnlyKeys<{ a: number; b: number }, \"a\">>;\n// This case is explicitly documented as unsupported.\n// | requireFalse<areOnlyKeys<Record<string, unknown>, \"a\">>;\n\n// negative tests (should not build)\n// @ts-expect-error negative test\ntype _falseIsTrue = requireTrue<false>;\n// @ts-expect-error negative test\ntype _trueIsFalse = requireFalse<true>;\n// @ts-expect-error negative test\ntype _booleanIsTrue = requireTrue<boolean>;\n// @ts-expect-error negative test\ntype _booleanIsFalse = requireFalse<boolean>;\n// @ts-expect-error negative test\ntype _emptyNotAssignable = requireFalse<isAssignableTo<Empty1, Empty2>>;\n// @ts-expect-error negative test\ntype _numberAssignableToString = requireTrue<isAssignableTo<number, string>>;\n// @ts-expect-error negative test\ntype _anyNotAny = requireFalse<isAny<any>>;\n"]}
package/lib/alpha.d.ts CHANGED
@@ -166,6 +166,7 @@ export {
166
166
  ICodecOptions,
167
167
  ITreeAlpha,
168
168
  IdentifierIndex,
169
+ IncrementalEncodingPolicy,
169
170
  Insertable,
170
171
  InsertableContent,
171
172
  InsertableField,
@@ -251,6 +252,7 @@ export {
251
252
  checkCompatibility,
252
253
  cloneWithReplacements,
253
254
  comparePersistedSchema,
255
+ configuredSharedTreeAlpha,
254
256
  contentSchemaSymbol,
255
257
  createIdentifierIndex,
256
258
  createIndependentTreeAlpha,
@@ -265,6 +267,8 @@ export {
265
267
  getJsonSchema,
266
268
  getSimpleSchema,
267
269
  importCompatibilitySchemaSnapshot,
270
+ incrementalEncodingPolicyForAllowedTypes,
271
+ incrementalSummaryHint,
268
272
  independentInitializedView,
269
273
  independentView,
270
274
  normalizeAllowedTypes,
@@ -6,7 +6,7 @@ import type { IIdCompressor, SessionId } from "@fluidframework/id-compressor";
6
6
  import { type CodecTree, type CodecWriteOptions, type IJsonCodec } from "../../../codec/index.js";
7
7
  import { type ITreeCursorSynchronous, type SchemaAndPolicy, type TreeChunk } from "../../../core/index.js";
8
8
  import { type Brand, type JsonCompatibleReadOnly } from "../../../util/index.js";
9
- import { type TreeCompressionStrategyPrivate } from "../../treeCompressionUtils.js";
9
+ import { TreeCompressionStrategy } from "../../treeCompressionUtils.js";
10
10
  import type { FieldBatch } from "./fieldBatch.js";
11
11
  import { type EncodedFieldBatch } from "./format.js";
12
12
  import type { MinimumVersionForCollab } from "@fluidframework/runtime-definitions/internal";
@@ -62,7 +62,7 @@ export interface IncrementalDecoder {
62
62
  export interface IncrementalEncoderDecoder extends IncrementalEncoder, IncrementalDecoder {
63
63
  }
64
64
  export interface FieldBatchEncodingContext {
65
- readonly encodeType: TreeCompressionStrategyPrivate;
65
+ readonly encodeType: TreeCompressionStrategy;
66
66
  readonly idCompressor: IIdCompressor;
67
67
  readonly originatorId: SessionId;
68
68
  readonly schema?: SchemaAndPolicy;
@@ -1 +1 @@
1
- {"version":3,"file":"codecs.d.ts","sourceRoot":"","sources":["../../../../src/feature-libraries/chunked-forest/codec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-utils/internal";
6
6
  import { getConfigForMinVersionForCollab, lowestMinVersionForCollab, } from "@fluidframework/runtime-utils/internal";
7
7
  import { FluidClientVersion, makeVersionedValidatedCodec, } from "../../../codec/index.js";
8
8
  import { brand, brandedNumberType, } from "../../../util/index.js";
9
- import { TreeCompressionStrategy, TreeCompressionStrategyExtended, } from "../../treeCompressionUtils.js";
9
+ import { TreeCompressionStrategy } from "../../treeCompressionUtils.js";
10
10
  import { decode } from "./chunkDecoding.js";
11
11
  import { validVersions, FieldBatchFormatVersion, EncodedFieldBatchV1, EncodedFieldBatchV2, } from "./format.js";
12
12
  import { uncompressedEncodeV1, uncompressedEncodeV2 } from "./uncompressedEncode.js";
@@ -57,7 +57,7 @@ export function makeFieldBatchCodec(options) {
57
57
  case TreeCompressionStrategy.Uncompressed:
58
58
  encoded = uncompressedEncodeFn(data);
59
59
  break;
60
- case TreeCompressionStrategyExtended.CompressedIncremental:
60
+ case TreeCompressionStrategy.CompressedIncremental:
61
61
  assert(writeVersion >= FieldBatchFormatVersion.v2, 0xca0 /* Unsupported FieldBatchFormatVersion for incremental encoding; must be v2 or higher */);
62
62
  // Incremental encoding is only supported for CompressedIncremental.
63
63
  incrementalEncoder = context.incrementalEncoderDecoder;
@@ -1 +1 @@
1
- {"version":3,"file":"codecs.js","sourceRoot":"","sources":["../../../../src/feature-libraries/chunked-forest/codec/codecs.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,MAAM,EAAE,eAAe,EAAE,MAAM,qCAAqC,CAAC;AAE9E,OAAO,EACN,+BAA+B,EAC/B,yBAAyB,GACzB,MAAM,wCAAwC,CAAC;AAEhD,OAAO,EAGN,kBAAkB,EAElB,2BAA2B,GAC3B,MAAM,yBAAyB,CAAC;AAOjC,OAAO,EACN,KAAK,EACL,iBAAiB,GAGjB,MAAM,wBAAwB,CAAC;AAChC,OAAO,EACN,uBAAuB,EACvB,+BAA+B,GAE/B,MAAM,+BAA+B,CAAC;AAEvC,OAAO,EA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AAoD;YACpD,OAAO,OAAO,CAAC;QAChB,CAAC;QACD,MAAM,EAAE,CAAC,IAAuB,EAAE,OAAkC,EAAc,EAAE;YACnF,6CAA6C;YAC7C,OAAO,MAAM,CACZ,IAAI,EACJ;gBACC,YAAY,EAAE,OAAO,CAAC,YAAY;gBAClC,YAAY,EAAE,OAAO,CAAC,YAAY;aAClC,EACD,OAAO,CAAC,yBAAyB,CACjC,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,MAAM,EAAE,CAAC,CAAC;QAClC,CAAC;KACD,CAAC,CAAC;AACJ,CAAC;AAED,MAAM,UAAU,+BAA+B,CAC9C,aAAsC;IAEtC,OAAO,EAAE,IAAI,EAAE,YAAY,EAAE,OAAO,EAAE,gCAAgC,CAAC,aAAa,CAAC,EAAE,CAAC;AACzF,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\";\nimport type { IIdCompressor, SessionId } from \"@fluidframework/id-compressor\";\nimport {\n\tgetConfigForMinVersionForCollab,\n\tlowestMinVersionForCollab,\n} from \"@fluidframework/runtime-utils/internal\";\n\nimport {\n\ttype CodecTree,\n\ttype CodecWriteOptions,\n\tFluidClientVersion,\n\ttype IJsonCodec,\n\tmakeVersionedValidatedCodec,\n} from \"../../../codec/index.js\";\nimport {\n\tCursorLocationType,\n\ttype ITreeCursorSynchronous,\n\ttype SchemaAndPolicy,\n\ttype TreeChunk,\n} from \"../../../core/index.js\";\nimport {\n\tbrand,\n\tbrandedNumberType,\n\ttype Brand,\n\ttype JsonCompatibleReadOnly,\n} from \"../../../util/index.js\";\nimport {\n\tTreeCompressionStrategy,\n\tTreeCompressionStrategyExtended,\n\ttype TreeCompressionStrategyPrivate,\n} from \"../../treeCompressionUtils.js\";\n\nimport { decode } from \"./chunkDecoding.js\";\nimport type { FieldBatch } from \"./fieldBatch.js\";\nimport {\n\ttype EncodedFieldBatch,\n\tvalidVersions,\n\tFieldBatchFormatVersion,\n\tEncodedFieldBatchV1,\n\tEncodedFieldBatchV2,\n} from \"./format.js\";\nimport type { MinimumVersionForCollab } from \"@fluidframework/runtime-definitions/internal\";\nimport type { IncrementalEncodingPolicy } from \"./incrementalEncodingPolicy.js\";\nimport { uncompressedEncodeV1, uncompressedEncodeV2 } from \"./uncompressedEncode.js\";\nimport { schemaCompressedEncodeV1, schemaCompressedEncodeV2 } from \"./schemaBasedEncode.js\";\n\n/**\n * Reference ID for a chunk that is incrementally encoded.\n */\nexport type ChunkReferenceId = Brand<number, \"forest.ChunkReferenceId\">;\nconst ChunkReferenceId = brandedNumberType<ChunkReferenceId>({ multipleOf: 1, minimum: 0 });\n\n/**\n * Properties for incremental encoding.\n * Fields that support incremental encoding will encode their chunks separately by calling `encodeIncrementalField`.\n * @remarks\n * This supports features like incremental summarization where the summary from these fields can be re-used if\n * unchanged between summaries.\n * Note that each of these chunks that are incrementally encoded is fully self-describing (contain its own shapes\n * list and identifier table) and does not rely on context from its parent.\n */\nexport interface IncrementalEncoder {\n\t/**\n\t * Returns whether a node / field should be incrementally encoded.\n\t * @remarks See {@link IncrementalEncodingPolicy}.\n\t */\n\tshouldEncodeIncrementally: IncrementalEncodingPolicy;\n\t/**\n\t * Called to encode an incremental field at the cursor.\n\t * The chunks for this field are encoded separately from the main buffer.\n\t * @param cursor - The cursor pointing to the field to encode.\n\t * @param chunkEncoder - A function that encodes the contents of the passed chunk in the field.\n\t * @returns The reference IDs of the encoded chunks in the field.\n\t * This is used to retrieve the encoded chunks later.\n\t */\n\tencodeIncrementalField(\n\t\tcursor: ITreeCursorSynchronous,\n\t\tchunkEncoder: (chunk: TreeChunk) => EncodedFieldBatch,\n\t): ChunkReferenceId[];\n}\n\n/**\n * Properties for incremental decoding.\n *\n * Fields that had their chunks incrementally encoded will retrieve them by calling `getEncodedIncrementalChunk`.\n * @remarks\n * See {@link IncrementalEncoder} for more details.\n */\nexport interface IncrementalDecoder {\n\t/**\n\t * Called to decode an incremental chunk with the given reference ID.\n\t * @param referenceId - The reference ID of the chunk to decode.\n\t * @param chunkDecoder - A function that decodes the chunk.\n\t * @returns The decoded chunk.\n\t */\n\tdecodeIncrementalChunk(\n\t\treferenceId: ChunkReferenceId,\n\t\tchunkDecoder: (encoded: EncodedFieldBatch) => TreeChunk,\n\t): TreeChunk;\n}\n/**\n * Combines the properties of {@link IncrementalEncoder} and {@link IncrementalDecoder}.\n */\nexport interface IncrementalEncoderDecoder extends IncrementalEncoder, IncrementalDecoder {}\n\nexport interface FieldBatchEncodingContext {\n\treadonly encodeType: TreeCompressionStrategyPrivate;\n\treadonly idCompressor: IIdCompressor;\n\treadonly originatorId: SessionId;\n\treadonly schema?: SchemaAndPolicy;\n\t/**\n\t * An encoder / decoder for encoding and decoding of incremental fields.\n\t * This will be defined if incremental encoding is supported and enabled.\n\t */\n\treadonly incrementalEncoderDecoder?: IncrementalEncoderDecoder;\n}\n/**\n * @remarks\n * Fields in this batch currently don't have field schema for the root, which limits optimizations.\n */\nexport type FieldBatchCodec = IJsonCodec<\n\tFieldBatch,\n\tEncodedFieldBatch,\n\tJsonCompatibleReadOnly,\n\tFieldBatchEncodingContext\n>;\n\n/**\n * Convert a MinimumVersionForCollab to write version for {@link FieldBatchCodec}.\n * @param clientVersion - The MinimumVersionForCollab to convert.\n */\nfunction clientVersionToFieldBatchVersion(\n\tclientVersion: MinimumVersionForCollab,\n): FieldBatchFormatVersion {\n\treturn brand(\n\t\tgetConfigForMinVersionForCollab(clientVersion, {\n\t\t\t[lowestMinVersionForCollab]: FieldBatchFormatVersion.v1,\n\t\t\t[FluidClientVersion.v2_73]: FieldBatchFormatVersion.v2,\n\t\t}),\n\t);\n}\n\nexport function makeFieldBatchCodec(options: CodecWriteOptions): FieldBatchCodec {\n\tconst writeVersion = clientVersionToFieldBatchVersion(options.minVersionForCollab);\n\t// Note: it's important that the decode function is schema-agnostic for this strategy/layering to work, since\n\t// the schema that an op was encoded in doesn't necessarily match the current schema for the document (e.g. if\n\t// decode is being run on a client that just submitted a schema change, but the op is from another client who has\n\t// yet to receive that change).\n\tassert(\n\t\tvalidVersions.has(writeVersion),\n\t\t0x935 /* Invalid write version for FieldBatch codec */,\n\t);\n\n\tlet uncompressedEncodeFn: typeof uncompressedEncodeV1 | typeof uncompressedEncodeV2;\n\tlet schemaCompressedEncodeFn:\n\t\t| typeof schemaCompressedEncodeV1\n\t\t| typeof schemaCompressedEncodeV2;\n\tlet encodedFieldBatchType: typeof EncodedFieldBatchV1 | typeof EncodedFieldBatchV2;\n\tswitch (writeVersion) {\n\t\tcase FieldBatchFormatVersion.v1:\n\t\t\tuncompressedEncodeFn = uncompressedEncodeV1;\n\t\t\tschemaCompressedEncodeFn = schemaCompressedEncodeV1;\n\t\t\tencodedFieldBatchType = EncodedFieldBatchV1;\n\t\t\tbreak;\n\t\tcase FieldBatchFormatVersion.v2:\n\t\t\tuncompressedEncodeFn = uncompressedEncodeV2;\n\t\t\tschemaCompressedEncodeFn = schemaCompressedEncodeV2;\n\t\t\tencodedFieldBatchType = EncodedFieldBatchV2;\n\t\t\tbreak;\n\t\tdefault:\n\t\t\tunreachableCase(writeVersion);\n\t}\n\n\treturn makeVersionedValidatedCodec(options, validVersions, encodedFieldBatchType, {\n\t\tencode: (data: FieldBatch, context: FieldBatchEncodingContext): EncodedFieldBatch => {\n\t\t\tfor (const cursor of data) {\n\t\t\t\tassert(\n\t\t\t\t\tcursor.mode === CursorLocationType.Fields,\n\t\t\t\t\t0x8a3 /* FieldBatch expects fields cursors */,\n\t\t\t\t);\n\t\t\t}\n\t\t\tlet encoded: EncodedFieldBatch;\n\t\t\tlet incrementalEncoder: IncrementalEncoder | undefined;\n\t\t\tswitch (context.encodeType) {\n\t\t\t\tcase TreeCompressionStrategy.Uncompressed:\n\t\t\t\t\tencoded = uncompressedEncodeFn(data);\n\t\t\t\t\tbreak;\n\t\t\t\tcase TreeCompressionStrategyExtended.CompressedIncremental:\n\t\t\t\t\tassert(\n\t\t\t\t\t\twriteVersion >= FieldBatchFormatVersion.v2,\n\t\t\t\t\t\t0xca0 /* Unsupported FieldBatchFormatVersion for incremental encoding; must be v2 or higher */,\n\t\t\t\t\t);\n\t\t\t\t\t// Incremental encoding is only supported for CompressedIncremental.\n\t\t\t\t\tincrementalEncoder = context.incrementalEncoderDecoder;\n\t\t\t\tcase TreeCompressionStrategy.Compressed:\n\t\t\t\t\t// eslint-disable-next-line unicorn/prefer-ternary\n\t\t\t\t\tif (context.schema !== undefined) {\n\t\t\t\t\t\tencoded = schemaCompressedEncodeFn(\n\t\t\t\t\t\t\tcontext.schema.schema,\n\t\t\t\t\t\t\tcontext.schema.policy,\n\t\t\t\t\t\t\tdata,\n\t\t\t\t\t\t\tcontext.idCompressor,\n\t\t\t\t\t\t\tincrementalEncoder,\n\t\t\t\t\t\t);\n\t\t\t\t\t} else {\n\t\t\t\t\t\t// TODO: consider enabling a somewhat compressed but not schema accelerated encode.\n\t\t\t\t\t\tencoded = uncompressedEncodeFn(data);\n\t\t\t\t\t}\n\n\t\t\t\t\tbreak;\n\t\t\t\tdefault:\n\t\t\t\t\tunreachableCase(context.encodeType);\n\t\t\t}\n\n\t\t\t// TODO: consider checking input data was in schema.\n\t\t\treturn encoded;\n\t\t},\n\t\tdecode: (data: EncodedFieldBatch, context: FieldBatchEncodingContext): FieldBatch => {\n\t\t\t// TODO: consider checking data is in schema.\n\t\t\treturn decode(\n\t\t\t\tdata,\n\t\t\t\t{\n\t\t\t\t\tidCompressor: context.idCompressor,\n\t\t\t\t\toriginatorId: context.originatorId,\n\t\t\t\t},\n\t\t\t\tcontext.incrementalEncoderDecoder,\n\t\t\t).map((chunk) => chunk.cursor());\n\t\t},\n\t});\n}\n\nexport function getCodecTreeForFieldBatchFormat(\n\tclientVersion: MinimumVersionForCollab,\n): CodecTree {\n\treturn { name: \"FieldBatch\", version: clientVersionToFieldBatchVersion(clientVersion) };\n}\n"]}
1
+ {"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,UAAU;oBACtC,kDAAkD;oBAClD,IAAI,OAAO,CAAC,MAAM,KAAK,SAAS,EAAE,CAAC;wBAClC,OAAO,GAAG,wBAAwB,CACjC,OAAO,CAAC,MAAM,CAAC,MAAM,EACrB,OAAO,CAAC,MAAM,CAAC,MAAM,EACrB,IAAI,EACJ,OAAO,CAAC,YAAY,EACpB,kBAAkB,CAClB,CAAC;oBACH,CAAC;yBAAM,CAAC;wBACP,mFAAmF;wBACnF,OAAO,GAAG,oBAAoB,CAAC,IAAI,CAAC,CAAC;oBACtC,CAAC;oBAED,MAAM;gBACP;oBACC,eAAe,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC;YACtC,CAAC;YAED,oDAAoD;YACpD,OAAO,OAAO,CAAC;QAChB,CAAC;QACD,MAAM,EAAE,CAAC,IAAuB,EAAE,OAAkC,EAAc,EAAE;YACnF,6CAA6C;YAC7C,OAAO,MAAM,CACZ,IAAI,EACJ;gBACC,YAAY,EAAE,OAAO,CAAC,YAAY;gBAClC,YAAY,EAAE,OAAO,CAAC,YAAY;aAClC,EACD,OAAO,CAAC,yBAAyB,CACjC,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,MAAM,EAAE,CAAC,CAAC;QAClC,CAAC;KACD,CAAC,CAAC;AACJ,CAAC;AAED,MAAM,UAAU,+BAA+B,CAC9C,aAAsC;IAEtC,OAAO,EAAE,IAAI,EAAE,YAAY,EAAE,OAAO,EAAE,gCAAgC,CAAC,aAAa,CAAC,EAAE,CAAC;AACzF,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\";\nimport type { IIdCompressor, SessionId } from \"@fluidframework/id-compressor\";\nimport {\n\tgetConfigForMinVersionForCollab,\n\tlowestMinVersionForCollab,\n} from \"@fluidframework/runtime-utils/internal\";\n\nimport {\n\ttype CodecTree,\n\ttype CodecWriteOptions,\n\tFluidClientVersion,\n\ttype IJsonCodec,\n\tmakeVersionedValidatedCodec,\n} from \"../../../codec/index.js\";\nimport {\n\tCursorLocationType,\n\ttype ITreeCursorSynchronous,\n\ttype SchemaAndPolicy,\n\ttype TreeChunk,\n} from \"../../../core/index.js\";\nimport {\n\tbrand,\n\tbrandedNumberType,\n\ttype Brand,\n\ttype JsonCompatibleReadOnly,\n} from \"../../../util/index.js\";\nimport { TreeCompressionStrategy } from \"../../treeCompressionUtils.js\";\n\nimport { decode } from \"./chunkDecoding.js\";\nimport type { FieldBatch } from \"./fieldBatch.js\";\nimport {\n\ttype EncodedFieldBatch,\n\tvalidVersions,\n\tFieldBatchFormatVersion,\n\tEncodedFieldBatchV1,\n\tEncodedFieldBatchV2,\n} from \"./format.js\";\nimport type { MinimumVersionForCollab } from \"@fluidframework/runtime-definitions/internal\";\nimport type { IncrementalEncodingPolicy } from \"./incrementalEncodingPolicy.js\";\nimport { uncompressedEncodeV1, uncompressedEncodeV2 } from \"./uncompressedEncode.js\";\nimport { schemaCompressedEncodeV1, schemaCompressedEncodeV2 } from \"./schemaBasedEncode.js\";\n\n/**\n * Reference ID for a chunk that is incrementally encoded.\n */\nexport type ChunkReferenceId = Brand<number, \"forest.ChunkReferenceId\">;\nconst ChunkReferenceId = brandedNumberType<ChunkReferenceId>({ multipleOf: 1, minimum: 0 });\n\n/**\n * Properties for incremental encoding.\n * Fields that support incremental encoding will encode their chunks separately by calling `encodeIncrementalField`.\n * @remarks\n * This supports features like incremental summarization where the summary from these fields can be re-used if\n * unchanged between summaries.\n * Note that each of these chunks that are incrementally encoded is fully self-describing (contain its own shapes\n * list and identifier table) and does not rely on context from its parent.\n */\nexport interface IncrementalEncoder {\n\t/**\n\t * Returns whether a node / field should be incrementally encoded.\n\t * @remarks See {@link IncrementalEncodingPolicy}.\n\t */\n\tshouldEncodeIncrementally: IncrementalEncodingPolicy;\n\t/**\n\t * Called to encode an incremental field at the cursor.\n\t * The chunks for this field are encoded separately from the main buffer.\n\t * @param cursor - The cursor pointing to the field to encode.\n\t * @param chunkEncoder - A function that encodes the contents of the passed chunk in the field.\n\t * @returns The reference IDs of the encoded chunks in the field.\n\t * This is used to retrieve the encoded chunks later.\n\t */\n\tencodeIncrementalField(\n\t\tcursor: ITreeCursorSynchronous,\n\t\tchunkEncoder: (chunk: TreeChunk) => EncodedFieldBatch,\n\t): ChunkReferenceId[];\n}\n\n/**\n * Properties for incremental decoding.\n *\n * Fields that had their chunks incrementally encoded will retrieve them by calling `getEncodedIncrementalChunk`.\n * @remarks\n * See {@link IncrementalEncoder} for more details.\n */\nexport interface IncrementalDecoder {\n\t/**\n\t * Called to decode an incremental chunk with the given reference ID.\n\t * @param referenceId - The reference ID of the chunk to decode.\n\t * @param chunkDecoder - A function that decodes the chunk.\n\t * @returns The decoded chunk.\n\t */\n\tdecodeIncrementalChunk(\n\t\treferenceId: ChunkReferenceId,\n\t\tchunkDecoder: (encoded: EncodedFieldBatch) => TreeChunk,\n\t): TreeChunk;\n}\n/**\n * Combines the properties of {@link IncrementalEncoder} and {@link IncrementalDecoder}.\n */\nexport interface IncrementalEncoderDecoder extends IncrementalEncoder, IncrementalDecoder {}\n\nexport interface FieldBatchEncodingContext {\n\treadonly encodeType: TreeCompressionStrategy;\n\treadonly idCompressor: IIdCompressor;\n\treadonly originatorId: SessionId;\n\treadonly schema?: SchemaAndPolicy;\n\t/**\n\t * An encoder / decoder for encoding and decoding of incremental fields.\n\t * This will be defined if incremental encoding is supported and enabled.\n\t */\n\treadonly incrementalEncoderDecoder?: IncrementalEncoderDecoder;\n}\n/**\n * @remarks\n * Fields in this batch currently don't have field schema for the root, which limits optimizations.\n */\nexport type FieldBatchCodec = IJsonCodec<\n\tFieldBatch,\n\tEncodedFieldBatch,\n\tJsonCompatibleReadOnly,\n\tFieldBatchEncodingContext\n>;\n\n/**\n * Convert a MinimumVersionForCollab to write version for {@link FieldBatchCodec}.\n * @param clientVersion - The MinimumVersionForCollab to convert.\n */\nfunction clientVersionToFieldBatchVersion(\n\tclientVersion: MinimumVersionForCollab,\n): FieldBatchFormatVersion {\n\treturn brand(\n\t\tgetConfigForMinVersionForCollab(clientVersion, {\n\t\t\t[lowestMinVersionForCollab]: FieldBatchFormatVersion.v1,\n\t\t\t[FluidClientVersion.v2_73]: FieldBatchFormatVersion.v2,\n\t\t}),\n\t);\n}\n\nexport function makeFieldBatchCodec(options: CodecWriteOptions): FieldBatchCodec {\n\tconst writeVersion = clientVersionToFieldBatchVersion(options.minVersionForCollab);\n\t// Note: it's important that the decode function is schema-agnostic for this strategy/layering to work, since\n\t// the schema that an op was encoded in doesn't necessarily match the current schema for the document (e.g. if\n\t// decode is being run on a client that just submitted a schema change, but the op is from another client who has\n\t// yet to receive that change).\n\tassert(\n\t\tvalidVersions.has(writeVersion),\n\t\t0x935 /* Invalid write version for FieldBatch codec */,\n\t);\n\n\tlet uncompressedEncodeFn: typeof uncompressedEncodeV1 | typeof uncompressedEncodeV2;\n\tlet schemaCompressedEncodeFn:\n\t\t| typeof schemaCompressedEncodeV1\n\t\t| typeof schemaCompressedEncodeV2;\n\tlet encodedFieldBatchType: typeof EncodedFieldBatchV1 | typeof EncodedFieldBatchV2;\n\tswitch (writeVersion) {\n\t\tcase FieldBatchFormatVersion.v1:\n\t\t\tuncompressedEncodeFn = uncompressedEncodeV1;\n\t\t\tschemaCompressedEncodeFn = schemaCompressedEncodeV1;\n\t\t\tencodedFieldBatchType = EncodedFieldBatchV1;\n\t\t\tbreak;\n\t\tcase FieldBatchFormatVersion.v2:\n\t\t\tuncompressedEncodeFn = uncompressedEncodeV2;\n\t\t\tschemaCompressedEncodeFn = schemaCompressedEncodeV2;\n\t\t\tencodedFieldBatchType = EncodedFieldBatchV2;\n\t\t\tbreak;\n\t\tdefault:\n\t\t\tunreachableCase(writeVersion);\n\t}\n\n\treturn makeVersionedValidatedCodec(options, validVersions, encodedFieldBatchType, {\n\t\tencode: (data: FieldBatch, context: FieldBatchEncodingContext): EncodedFieldBatch => {\n\t\t\tfor (const cursor of data) {\n\t\t\t\tassert(\n\t\t\t\t\tcursor.mode === CursorLocationType.Fields,\n\t\t\t\t\t0x8a3 /* FieldBatch expects fields cursors */,\n\t\t\t\t);\n\t\t\t}\n\t\t\tlet encoded: EncodedFieldBatch;\n\t\t\tlet incrementalEncoder: IncrementalEncoder | undefined;\n\t\t\tswitch (context.encodeType) {\n\t\t\t\tcase TreeCompressionStrategy.Uncompressed:\n\t\t\t\t\tencoded = uncompressedEncodeFn(data);\n\t\t\t\t\tbreak;\n\t\t\t\tcase TreeCompressionStrategy.CompressedIncremental:\n\t\t\t\t\tassert(\n\t\t\t\t\t\twriteVersion >= FieldBatchFormatVersion.v2,\n\t\t\t\t\t\t0xca0 /* Unsupported FieldBatchFormatVersion for incremental encoding; must be v2 or higher */,\n\t\t\t\t\t);\n\t\t\t\t\t// Incremental encoding is only supported for CompressedIncremental.\n\t\t\t\t\tincrementalEncoder = context.incrementalEncoderDecoder;\n\t\t\t\tcase TreeCompressionStrategy.Compressed:\n\t\t\t\t\t// eslint-disable-next-line unicorn/prefer-ternary\n\t\t\t\t\tif (context.schema !== undefined) {\n\t\t\t\t\t\tencoded = schemaCompressedEncodeFn(\n\t\t\t\t\t\t\tcontext.schema.schema,\n\t\t\t\t\t\t\tcontext.schema.policy,\n\t\t\t\t\t\t\tdata,\n\t\t\t\t\t\t\tcontext.idCompressor,\n\t\t\t\t\t\t\tincrementalEncoder,\n\t\t\t\t\t\t);\n\t\t\t\t\t} else {\n\t\t\t\t\t\t// TODO: consider enabling a somewhat compressed but not schema accelerated encode.\n\t\t\t\t\t\tencoded = uncompressedEncodeFn(data);\n\t\t\t\t\t}\n\n\t\t\t\t\tbreak;\n\t\t\t\tdefault:\n\t\t\t\t\tunreachableCase(context.encodeType);\n\t\t\t}\n\n\t\t\t// TODO: consider checking input data was in schema.\n\t\t\treturn encoded;\n\t\t},\n\t\tdecode: (data: EncodedFieldBatch, context: FieldBatchEncodingContext): FieldBatch => {\n\t\t\t// TODO: consider checking data is in schema.\n\t\t\treturn decode(\n\t\t\t\tdata,\n\t\t\t\t{\n\t\t\t\t\tidCompressor: context.idCompressor,\n\t\t\t\t\toriginatorId: context.originatorId,\n\t\t\t\t},\n\t\t\t\tcontext.incrementalEncoderDecoder,\n\t\t\t).map((chunk) => chunk.cursor());\n\t\t},\n\t});\n}\n\nexport function getCodecTreeForFieldBatchFormat(\n\tclientVersion: MinimumVersionForCollab,\n): CodecTree {\n\treturn { name: \"FieldBatch\", version: clientVersionToFieldBatchVersion(clientVersion) };\n}\n"]}
@@ -2,7 +2,6 @@
2
2
  * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
3
3
  * Licensed under the MIT License.
4
4
  */
5
- import type { FieldKey, TreeNodeSchemaIdentifier } from "../../../core/index.js";
6
5
  /**
7
6
  * Policy to determine whether a node / field should be incrementally encoded.
8
7
  * @param nodeIdentifier - The identifier of the node containing the field.
@@ -14,8 +13,9 @@ import type { FieldKey, TreeNodeSchemaIdentifier } from "../../../core/index.js"
14
13
  * but allows reuse of previously encoded unchanged subtrees.
15
14
  * Thus it should only be enabled for large subtrees which are modified infrequently.
16
15
  * TODO: AB#9068: Measure the actual overhead.
16
+ * @alpha
17
17
  */
18
- export type IncrementalEncodingPolicy = (nodeIdentifier: TreeNodeSchemaIdentifier | undefined, fieldKey: FieldKey) => boolean;
18
+ export type IncrementalEncodingPolicy = (nodeIdentifier: string | undefined, fieldKey: string) => boolean;
19
19
  /**
20
20
  * Default policy for incremental encoding is to not encode incrementally.
21
21
  */
@@ -1 +1 @@
1
- {"version":3,"file":"incrementalEncodingPolicy.d.ts","sourceRoot":"","sources":["../../../../src/feature-libraries/chunked-forest/codec/incrementalEncodingPolicy.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,QAAQ,EAAE,wBAAwB,EAAE,MAAM,wBAAwB,CAAC;AAEjF;;;;;;;;;;;GAWG;AACH,MAAM,MAAM,yBAAyB,GAAG,CACvC,cAAc,EAAE,wBAAwB,GAAG,SAAS,EACpD,QAAQ,EAAE,QAAQ,KACd,OAAO,CAAC;AAEb;;GAEG;AACH,eAAO,MAAM,gCAAgC,EAAE,yBAK9C,CAAC"}
1
+ {"version":3,"file":"incrementalEncodingPolicy.d.ts","sourceRoot":"","sources":["../../../../src/feature-libraries/chunked-forest/codec/incrementalEncodingPolicy.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;;;;;;;;;;;GAYG;AACH,MAAM,MAAM,yBAAyB,GAAG,CACvC,cAAc,EAAE,MAAM,GAAG,SAAS,EAClC,QAAQ,EAAE,MAAM,KACZ,OAAO,CAAC;AAEb;;GAEG;AACH,eAAO,MAAM,gCAAgC,EAAE,yBAK9C,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"incrementalEncodingPolicy.js","sourceRoot":"","sources":["../../../../src/feature-libraries/chunked-forest/codec/incrementalEncodingPolicy.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAqBH;;GAEG;AACH,MAAM,CAAC,MAAM,gCAAgC,GAA8B,CAC1E,cAAoD,EACpD,QAAkB,EACR,EAAE;IACZ,OAAO,KAAK,CAAC;AACd,CAAC,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport type { FieldKey, TreeNodeSchemaIdentifier } from \"../../../core/index.js\";\n\n/**\n * Policy to determine whether a node / field should be incrementally encoded.\n * @param nodeIdentifier - The identifier of the node containing the field.\n * If undefined, the field is a root field.\n * @param fieldKey - The key of the field to check.\n * @returns whether the node / field should be incrementally encoded.\n * @remarks\n * Incremental encoding has a significant size overhead,\n * but allows reuse of previously encoded unchanged subtrees.\n * Thus it should only be enabled for large subtrees which are modified infrequently.\n * TODO: AB#9068: Measure the actual overhead.\n */\nexport type IncrementalEncodingPolicy = (\n\tnodeIdentifier: TreeNodeSchemaIdentifier | undefined,\n\tfieldKey: FieldKey,\n) => boolean;\n\n/**\n * Default policy for incremental encoding is to not encode incrementally.\n */\nexport const defaultIncrementalEncodingPolicy: IncrementalEncodingPolicy = (\n\tnodeIdentifier: TreeNodeSchemaIdentifier | undefined,\n\tfieldKey: FieldKey,\n): boolean => {\n\treturn false;\n};\n"]}
1
+ {"version":3,"file":"incrementalEncodingPolicy.js","sourceRoot":"","sources":["../../../../src/feature-libraries/chunked-forest/codec/incrementalEncodingPolicy.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAoBH;;GAEG;AACH,MAAM,CAAC,MAAM,gCAAgC,GAA8B,CAC1E,cAAkC,EAClC,QAAgB,EACN,EAAE;IACZ,OAAO,KAAK,CAAC;AACd,CAAC,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\n/**\n * Policy to determine whether a node / field should be incrementally encoded.\n * @param nodeIdentifier - The identifier of the node containing the field.\n * If undefined, the field is a root field.\n * @param fieldKey - The key of the field to check.\n * @returns whether the node / field should be incrementally encoded.\n * @remarks\n * Incremental encoding has a significant size overhead,\n * but allows reuse of previously encoded unchanged subtrees.\n * Thus it should only be enabled for large subtrees which are modified infrequently.\n * TODO: AB#9068: Measure the actual overhead.\n * @alpha\n */\nexport type IncrementalEncodingPolicy = (\n\tnodeIdentifier: string | undefined,\n\tfieldKey: string,\n) => boolean;\n\n/**\n * Default policy for incremental encoding is to not encode incrementally.\n */\nexport const defaultIncrementalEncodingPolicy: IncrementalEncodingPolicy = (\n\tnodeIdentifier: string | undefined,\n\tfieldKey: string,\n): boolean => {\n\treturn false;\n};\n"]}
@@ -11,7 +11,7 @@ import { chunkFieldSingle, defaultChunkPolicy } from "../chunked-forest/chunkTre
11
11
  import { defaultIncrementalEncodingPolicy, } from "../chunked-forest/index.js";
12
12
  import { makeForestSummarizerCodec } from "./codec.js";
13
13
  import { ForestIncrementalSummaryBehavior, ForestIncrementalSummaryBuilder, forestSummaryContentKey, } from "./incrementalSummaryBuilder.js";
14
- import { TreeCompressionStrategyExtended } from "../treeCompressionUtils.js";
14
+ import { TreeCompressionStrategy } from "../treeCompressionUtils.js";
15
15
  /**
16
16
  * The key for the tree that contains the overall forest's summary tree.
17
17
  * This tree is added by the parent of the forest summarizer.
@@ -34,7 +34,7 @@ export class ForestSummarizer {
34
34
  // TODO: this should take in CodecWriteOptions, and use it to pick the write version.
35
35
  this.codec = makeForestSummarizerCodec(options, fieldBatchCodec);
36
36
  this.incrementalSummaryBuilder = new ForestIncrementalSummaryBuilder(encoderContext.encodeType ===
37
- TreeCompressionStrategyExtended.CompressedIncremental /* enableIncrementalSummary */, (cursor) => this.forest.chunkField(cursor), shouldEncodeIncrementally, initialSequenceNumber);
37
+ TreeCompressionStrategy.CompressedIncremental /* enableIncrementalSummary */, (cursor) => this.forest.chunkField(cursor), shouldEncodeIncrementally, initialSequenceNumber);
38
38
  }
39
39
  /**
40
40
  * Summarization of the forest's tree content.
@@ -1 +1 @@
1
- {"version":3,"file":"forestSummarizer.js","sourceRoot":"","sources":["../../../src/feature-libraries/forest-summary/forestSummarizer.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAC;AAC9D,OAAO,EAAE,MAAM,EAAE,MAAM,qCAAqC,CAAC;AAU7D,OAAO,EASN,UAAU,EACV,YAAY,EACZ,sBAAsB,GACtB,MAAM,qBAAqB,CAAC;AAM7B,OAAO,EAAE,oBAAoB,EAAuB,MAAM,qBAAqB,CAAC;AAChF,wDAAwD;AACxD,OAAO,EAAE,gBAAgB,EAAE,kBAAkB,EAAE,MAAM,gCAAgC,CAAC;AACtF,OAAO,EACN,gCAAgC,GAIhC,MAAM,4BAA4B,CAAC;AAEpC,OAAO,EAAoB,yBAAyB,EAAE,MAAM,YAAY,CAAC;AACzE,OAAO,EACN,gCAAgC,EAChC,+BAA+B,EAC/B,uBAAuB,GACvB,MAAM,gCAAgC,CAAC;AACxC,OAAO,EAAE,+BAA+B,EAAE,MAAM,4BAA4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,MAAM,CAAC,OAAO,EAAE,KAAK,CAAC,0BAA0B,CAAC,CAAC;QAC9D,UAAU,CACT,EAAE,KAAK,EAAE,MAAM,EAAE,IAAI,GAAG,CAAC,YAAY,CAAC,EAAE,EACxC,SAAS,EACT,IAAI,CAAC,MAAM,EACX,sBAAsB,CAAC,MAAM,EAAE,IAAI,CAAC,gBAAgB,EAAE,IAAI,CAAC,YAAY,CAAC,CACxE,CAAC;IACH,CAAC;CACD","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { bufferToString } from \"@fluid-internal/client-utils\";\nimport { assert } from \"@fluidframework/core-utils/internal\";\nimport type { IChannelStorageService } from \"@fluidframework/datastore-definitions/internal\";\nimport type { IIdCompressor } from \"@fluidframework/id-compressor\";\nimport type {\n\tIExperimentalIncrementalSummaryContext,\n\tISummaryTreeWithStats,\n\tITelemetryContext,\n} from \"@fluidframework/runtime-definitions/internal\";\n\nimport type { CodecWriteOptions } from \"../../codec/index.js\";\nimport {\n\ttype DeltaDetachedNodeBuild,\n\ttype DeltaFieldChanges,\n\ttype FieldKey,\n\ttype IEditableForest,\n\ttype ITreeCursorSynchronous,\n\ttype ITreeSubscriptionCursor,\n\ttype RevisionTagCodec,\n\tTreeNavigationResult,\n\tapplyDelta,\n\tforEachField,\n\tmakeDetachedFieldIndex,\n} from \"../../core/index.js\";\nimport type {\n\tSummarizable,\n\tSummaryElementParser,\n\tSummaryElementStringifier,\n} from \"../../shared-tree-core/index.js\";\nimport { idAllocatorFromMaxId, type JsonCompatible } from \"../../util/index.js\";\n// eslint-disable-next-line import-x/no-internal-modules\nimport { chunkFieldSingle, defaultChunkPolicy } from \"../chunked-forest/chunkTree.js\";\nimport {\n\tdefaultIncrementalEncodingPolicy,\n\ttype FieldBatchCodec,\n\ttype FieldBatchEncodingContext,\n\ttype IncrementalEncodingPolicy,\n} from \"../chunked-forest/index.js\";\n\nimport { type ForestCodec, makeForestSummarizerCodec } from \"./codec.js\";\nimport {\n\tForestIncrementalSummaryBehavior,\n\tForestIncrementalSummaryBuilder,\n\tforestSummaryContentKey,\n} from \"./incrementalSummaryBuilder.js\";\nimport { TreeCompressionStrategyExtended } from \"../treeCompressionUtils.js\";\nimport type { IFluidHandle } from \"@fluidframework/core-interfaces\";\n\n/**\n * The key for the tree that contains the overall forest's summary tree.\n * This tree is added by the parent of the forest summarizer.\n * See {@link ForestIncrementalSummaryBuilder} for details on the summary structure.\n */\nexport const forestSummaryKey = \"Forest\";\n\n/**\n * Provides methods for summarizing and loading a forest.\n */\nexport class ForestSummarizer implements Summarizable {\n\tpublic readonly key = forestSummaryKey;\n\n\tprivate readonly codec: ForestCodec;\n\n\tprivate readonly incrementalSummaryBuilder: ForestIncrementalSummaryBuilder;\n\n\t/**\n\t * @param encoderContext - The schema if provided here must be mutated by the caller to keep it up to date.\n\t */\n\tpublic constructor(\n\t\tprivate readonly forest: IEditableForest,\n\t\tprivate readonly revisionTagCodec: RevisionTagCodec,\n\t\tfieldBatchCodec: FieldBatchCodec,\n\t\tprivate readonly encoderContext: FieldBatchEncodingContext,\n\t\toptions: CodecWriteOptions,\n\t\tprivate readonly idCompressor: IIdCompressor,\n\t\tinitialSequenceNumber: number,\n\t\tshouldEncodeIncrementally: IncrementalEncodingPolicy = defaultIncrementalEncodingPolicy,\n\t) {\n\t\t// TODO: this should take in CodecWriteOptions, and use it to pick the write version.\n\t\tthis.codec = makeForestSummarizerCodec(options, fieldBatchCodec);\n\t\tthis.incrementalSummaryBuilder = new ForestIncrementalSummaryBuilder(\n\t\t\tencoderContext.encodeType ===\n\t\t\t\tTreeCompressionStrategyExtended.CompressedIncremental /* enableIncrementalSummary */,\n\t\t\t(cursor: ITreeCursorSynchronous) => this.forest.chunkField(cursor),\n\t\t\tshouldEncodeIncrementally,\n\t\t\tinitialSequenceNumber,\n\t\t);\n\t}\n\n\t/**\n\t * Summarization of the forest's tree content.\n\t * @returns a summary tree containing the forest's tree content.\n\t * @remarks\n\t * If incremental summary is disabled, all the content will be added to a single summary blob.\n\t * If incremental summary is enabled, the summary will be a tree.\n\t * See {@link ForestIncrementalSummaryBuilder} for details of what this tree looks like.\n\t *\n\t * TODO: when perf matters, this should be replaced with a chunked async version using a binary format.\n\t */\n\tpublic summarize(props: {\n\t\tstringify: SummaryElementStringifier;\n\t\tfullTree?: boolean;\n\t\ttrackState?: boolean;\n\t\ttelemetryContext?: ITelemetryContext;\n\t\tincrementalSummaryContext?: IExperimentalIncrementalSummaryContext;\n\t}): ISummaryTreeWithStats {\n\t\tconst { stringify, fullTree = false, incrementalSummaryContext } = props;\n\n\t\tconst rootCursor = this.forest.getCursorAboveDetachedFields();\n\t\tconst fieldMap: Map<FieldKey, ITreeCursorSynchronous & ITreeSubscriptionCursor> =\n\t\t\tnew Map();\n\t\t// TODO: Encode all detached fields in one operation for better performance and compression\n\t\tforEachField(rootCursor, (cursor) => {\n\t\t\tconst key = cursor.getFieldKey();\n\t\t\tconst innerCursor = this.forest.allocateCursor(\"getTreeString\");\n\t\t\tassert(\n\t\t\t\tthis.forest.tryMoveCursorToField({ fieldKey: key, parent: undefined }, innerCursor) ===\n\t\t\t\t\tTreeNavigationResult.Ok,\n\t\t\t\t0x892 /* failed to navigate to field */,\n\t\t\t);\n\t\t\tfieldMap.set(key, innerCursor as ITreeCursorSynchronous & ITreeSubscriptionCursor);\n\t\t});\n\n\t\t// Let the incremental summary builder know that we are starting a new summary.\n\t\t// It returns whether incremental encoding is enabled.\n\t\tconst incrementalSummaryBehavior = this.incrementalSummaryBuilder.startSummary({\n\t\t\tfullTree,\n\t\t\tincrementalSummaryContext,\n\t\t\tstringify,\n\t\t});\n\t\tconst encoderContext: FieldBatchEncodingContext = {\n\t\t\t...this.encoderContext,\n\t\t\tincrementalEncoderDecoder:\n\t\t\t\tincrementalSummaryBehavior === ForestIncrementalSummaryBehavior.Incremental\n\t\t\t\t\t? this.incrementalSummaryBuilder\n\t\t\t\t\t: undefined,\n\t\t};\n\t\tconst encoded = this.codec.encode(fieldMap, encoderContext);\n\t\tfieldMap.forEach((value) => value.free());\n\n\t\treturn this.incrementalSummaryBuilder.completeSummary({\n\t\t\tincrementalSummaryContext,\n\t\t\tforestSummaryContent: stringify(encoded),\n\t\t});\n\t}\n\n\tpublic async load(\n\t\tservices: IChannelStorageService,\n\t\tparse: SummaryElementParser,\n\t): Promise<void> {\n\t\t// The contents of the top-level forest must be present under a summary blob named `forestSummaryContentKey`.\n\t\t// If the summary was generated as `ForestIncrementalSummaryBehavior.SingleBlob`, this blob will contain all\n\t\t// of forest's contents.\n\t\t// If the summary was generated as `ForestIncrementalSummaryBehavior.Incremental`, this blob will contain only\n\t\t// the top-level forest node's contents.\n\t\t// The contents of the incremental chunks will be in separate tree nodes and will be read later during decoding.\n\t\tassert(\n\t\t\tawait services.contains(forestSummaryContentKey),\n\t\t\t0xc21 /* Forest summary content missing in snapshot */,\n\t\t);\n\n\t\tconst readAndParseBlob = async <T extends JsonCompatible<IFluidHandle>>(\n\t\t\tid: string,\n\t\t): Promise<T> => {\n\t\t\tconst treeBuffer = await services.readBlob(id);\n\t\t\tconst treeBufferString = bufferToString(treeBuffer, \"utf8\");\n\t\t\treturn parse(treeBufferString) as T;\n\t\t};\n\n\t\t// Load the incremental summary builder so that it can download any incremental chunks in the\n\t\t// snapshot.\n\t\tawait this.incrementalSummaryBuilder.load(services, readAndParseBlob);\n\n\t\t// TODO: this code is parsing data without an optional validator, this should be defined in a typebox schema as part of the\n\t\t// forest summary format.\n\t\tconst fields = this.codec.decode(await readAndParseBlob(forestSummaryContentKey), {\n\t\t\t...this.encoderContext,\n\t\t\tincrementalEncoderDecoder: this.incrementalSummaryBuilder,\n\t\t});\n\t\tconst allocator = idAllocatorFromMaxId();\n\t\tconst fieldChanges: [FieldKey, DeltaFieldChanges][] = [];\n\t\tconst build: DeltaDetachedNodeBuild[] = [];\n\t\tfor (const [fieldKey, field] of fields) {\n\t\t\tconst chunked = chunkFieldSingle(field, {\n\t\t\t\tpolicy: defaultChunkPolicy,\n\t\t\t\tidCompressor: this.idCompressor,\n\t\t\t});\n\t\t\tconst buildId = { minor: allocator.allocate(chunked.topLevelLength) };\n\t\t\tbuild.push({\n\t\t\t\tid: buildId,\n\t\t\t\ttrees: chunked,\n\t\t\t});\n\t\t\tfieldChanges.push([fieldKey, [{ count: chunked.topLevelLength, attach: buildId }]]);\n\t\t}\n\n\t\tassert(this.forest.isEmpty, 0x797 /* forest must be empty */);\n\t\tapplyDelta(\n\t\t\t{ build, fields: new Map(fieldChanges) },\n\t\t\tundefined,\n\t\t\tthis.forest,\n\t\t\tmakeDetachedFieldIndex(\"init\", this.revisionTagCodec, this.idCompressor),\n\t\t);\n\t}\n}\n"]}
1
+ {"version":3,"file":"forestSummarizer.js","sourceRoot":"","sources":["../../../src/feature-libraries/forest-summary/forestSummarizer.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAC;AAC9D,OAAO,EAAE,MAAM,EAAE,MAAM,qCAAqC,CAAC;AAU7D,OAAO,EASN,UAAU,EACV,YAAY,EACZ,sBAAsB,GACtB,MAAM,qBAAqB,CAAC;AAM7B,OAAO,EAAE,oBAAoB,EAAuB,MAAM,qBAAqB,CAAC;AAChF,wDAAwD;AACxD,OAAO,EAAE,gBAAgB,EAAE,kBAAkB,EAAE,MAAM,gCAAgC,CAAC;AACtF,OAAO,EACN,gCAAgC,GAIhC,MAAM,4BAA4B,CAAC;AAEpC,OAAO,EAAoB,yBAAyB,EAAE,MAAM,YAAY,CAAC;AACzE,OAAO,EACN,gCAAgC,EAChC,+BAA+B,EAC/B,uBAAuB,GACvB,MAAM,gCAAgC,CAAC;AACxC,OAAO,EAAE,uBAAuB,EAAE,MAAM,4BAA4B,CAAC;AAGrE;;;;GAIG;AACH,MAAM,CAAC,MAAM,gBAAgB,GAAG,QAAQ,CAAC;AAEzC;;GAEG;AACH,MAAM,OAAO,gBAAgB;IAO5B;;OA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AAY,CAAC,EAAE,EACxC,SAAS,EACT,IAAI,CAAC,MAAM,EACX,sBAAsB,CAAC,MAAM,EAAE,IAAI,CAAC,gBAAgB,EAAE,IAAI,CAAC,YAAY,CAAC,CACxE,CAAC;IACH,CAAC;CACD","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { bufferToString } from \"@fluid-internal/client-utils\";\nimport { assert } from \"@fluidframework/core-utils/internal\";\nimport type { IChannelStorageService } from \"@fluidframework/datastore-definitions/internal\";\nimport type { IIdCompressor } from \"@fluidframework/id-compressor\";\nimport type {\n\tIExperimentalIncrementalSummaryContext,\n\tISummaryTreeWithStats,\n\tITelemetryContext,\n} from \"@fluidframework/runtime-definitions/internal\";\n\nimport type { CodecWriteOptions } from \"../../codec/index.js\";\nimport {\n\ttype DeltaDetachedNodeBuild,\n\ttype DeltaFieldChanges,\n\ttype FieldKey,\n\ttype IEditableForest,\n\ttype ITreeCursorSynchronous,\n\ttype ITreeSubscriptionCursor,\n\ttype RevisionTagCodec,\n\tTreeNavigationResult,\n\tapplyDelta,\n\tforEachField,\n\tmakeDetachedFieldIndex,\n} from \"../../core/index.js\";\nimport type {\n\tSummarizable,\n\tSummaryElementParser,\n\tSummaryElementStringifier,\n} from \"../../shared-tree-core/index.js\";\nimport { idAllocatorFromMaxId, type JsonCompatible } from \"../../util/index.js\";\n// eslint-disable-next-line import-x/no-internal-modules\nimport { chunkFieldSingle, defaultChunkPolicy } from \"../chunked-forest/chunkTree.js\";\nimport {\n\tdefaultIncrementalEncodingPolicy,\n\ttype FieldBatchCodec,\n\ttype FieldBatchEncodingContext,\n\ttype IncrementalEncodingPolicy,\n} from \"../chunked-forest/index.js\";\n\nimport { type ForestCodec, makeForestSummarizerCodec } from \"./codec.js\";\nimport {\n\tForestIncrementalSummaryBehavior,\n\tForestIncrementalSummaryBuilder,\n\tforestSummaryContentKey,\n} from \"./incrementalSummaryBuilder.js\";\nimport { TreeCompressionStrategy } from \"../treeCompressionUtils.js\";\nimport type { IFluidHandle } from \"@fluidframework/core-interfaces\";\n\n/**\n * The key for the tree that contains the overall forest's summary tree.\n * This tree is added by the parent of the forest summarizer.\n * See {@link ForestIncrementalSummaryBuilder} for details on the summary structure.\n */\nexport const forestSummaryKey = \"Forest\";\n\n/**\n * Provides methods for summarizing and loading a forest.\n */\nexport class ForestSummarizer implements Summarizable {\n\tpublic readonly key = forestSummaryKey;\n\n\tprivate readonly codec: ForestCodec;\n\n\tprivate readonly incrementalSummaryBuilder: ForestIncrementalSummaryBuilder;\n\n\t/**\n\t * @param encoderContext - The schema if provided here must be mutated by the caller to keep it up to date.\n\t */\n\tpublic constructor(\n\t\tprivate readonly forest: IEditableForest,\n\t\tprivate readonly revisionTagCodec: RevisionTagCodec,\n\t\tfieldBatchCodec: FieldBatchCodec,\n\t\tprivate readonly encoderContext: FieldBatchEncodingContext,\n\t\toptions: CodecWriteOptions,\n\t\tprivate readonly idCompressor: IIdCompressor,\n\t\tinitialSequenceNumber: number,\n\t\tshouldEncodeIncrementally: IncrementalEncodingPolicy = defaultIncrementalEncodingPolicy,\n\t) {\n\t\t// TODO: this should take in CodecWriteOptions, and use it to pick the write version.\n\t\tthis.codec = makeForestSummarizerCodec(options, fieldBatchCodec);\n\t\tthis.incrementalSummaryBuilder = new ForestIncrementalSummaryBuilder(\n\t\t\tencoderContext.encodeType ===\n\t\t\t\tTreeCompressionStrategy.CompressedIncremental /* enableIncrementalSummary */,\n\t\t\t(cursor: ITreeCursorSynchronous) => this.forest.chunkField(cursor),\n\t\t\tshouldEncodeIncrementally,\n\t\t\tinitialSequenceNumber,\n\t\t);\n\t}\n\n\t/**\n\t * Summarization of the forest's tree content.\n\t * @returns a summary tree containing the forest's tree content.\n\t * @remarks\n\t * If incremental summary is disabled, all the content will be added to a single summary blob.\n\t * If incremental summary is enabled, the summary will be a tree.\n\t * See {@link ForestIncrementalSummaryBuilder} for details of what this tree looks like.\n\t *\n\t * TODO: when perf matters, this should be replaced with a chunked async version using a binary format.\n\t */\n\tpublic summarize(props: {\n\t\tstringify: SummaryElementStringifier;\n\t\tfullTree?: boolean;\n\t\ttrackState?: boolean;\n\t\ttelemetryContext?: ITelemetryContext;\n\t\tincrementalSummaryContext?: IExperimentalIncrementalSummaryContext;\n\t}): ISummaryTreeWithStats {\n\t\tconst { stringify, fullTree = false, incrementalSummaryContext } = props;\n\n\t\tconst rootCursor = this.forest.getCursorAboveDetachedFields();\n\t\tconst fieldMap: Map<FieldKey, ITreeCursorSynchronous & ITreeSubscriptionCursor> =\n\t\t\tnew Map();\n\t\t// TODO: Encode all detached fields in one operation for better performance and compression\n\t\tforEachField(rootCursor, (cursor) => {\n\t\t\tconst key = cursor.getFieldKey();\n\t\t\tconst innerCursor = this.forest.allocateCursor(\"getTreeString\");\n\t\t\tassert(\n\t\t\t\tthis.forest.tryMoveCursorToField({ fieldKey: key, parent: undefined }, innerCursor) ===\n\t\t\t\t\tTreeNavigationResult.Ok,\n\t\t\t\t0x892 /* failed to navigate to field */,\n\t\t\t);\n\t\t\tfieldMap.set(key, innerCursor as ITreeCursorSynchronous & ITreeSubscriptionCursor);\n\t\t});\n\n\t\t// Let the incremental summary builder know that we are starting a new summary.\n\t\t// It returns whether incremental encoding is enabled.\n\t\tconst incrementalSummaryBehavior = this.incrementalSummaryBuilder.startSummary({\n\t\t\tfullTree,\n\t\t\tincrementalSummaryContext,\n\t\t\tstringify,\n\t\t});\n\t\tconst encoderContext: FieldBatchEncodingContext = {\n\t\t\t...this.encoderContext,\n\t\t\tincrementalEncoderDecoder:\n\t\t\t\tincrementalSummaryBehavior === ForestIncrementalSummaryBehavior.Incremental\n\t\t\t\t\t? this.incrementalSummaryBuilder\n\t\t\t\t\t: undefined,\n\t\t};\n\t\tconst encoded = this.codec.encode(fieldMap, encoderContext);\n\t\tfieldMap.forEach((value) => value.free());\n\n\t\treturn this.incrementalSummaryBuilder.completeSummary({\n\t\t\tincrementalSummaryContext,\n\t\t\tforestSummaryContent: stringify(encoded),\n\t\t});\n\t}\n\n\tpublic async load(\n\t\tservices: IChannelStorageService,\n\t\tparse: SummaryElementParser,\n\t): Promise<void> {\n\t\t// The contents of the top-level forest must be present under a summary blob named `forestSummaryContentKey`.\n\t\t// If the summary was generated as `ForestIncrementalSummaryBehavior.SingleBlob`, this blob will contain all\n\t\t// of forest's contents.\n\t\t// If the summary was generated as `ForestIncrementalSummaryBehavior.Incremental`, this blob will contain only\n\t\t// the top-level forest node's contents.\n\t\t// The contents of the incremental chunks will be in separate tree nodes and will be read later during decoding.\n\t\tassert(\n\t\t\tawait services.contains(forestSummaryContentKey),\n\t\t\t0xc21 /* Forest summary content missing in snapshot */,\n\t\t);\n\n\t\tconst readAndParseBlob = async <T extends JsonCompatible<IFluidHandle>>(\n\t\t\tid: string,\n\t\t): Promise<T> => {\n\t\t\tconst treeBuffer = await services.readBlob(id);\n\t\t\tconst treeBufferString = bufferToString(treeBuffer, \"utf8\");\n\t\t\treturn parse(treeBufferString) as T;\n\t\t};\n\n\t\t// Load the incremental summary builder so that it can download any incremental chunks in the\n\t\t// snapshot.\n\t\tawait this.incrementalSummaryBuilder.load(services, readAndParseBlob);\n\n\t\t// TODO: this code is parsing data without an optional validator, this should be defined in a typebox schema as part of the\n\t\t// forest summary format.\n\t\tconst fields = this.codec.decode(await readAndParseBlob(forestSummaryContentKey), {\n\t\t\t...this.encoderContext,\n\t\t\tincrementalEncoderDecoder: this.incrementalSummaryBuilder,\n\t\t});\n\t\tconst allocator = idAllocatorFromMaxId();\n\t\tconst fieldChanges: [FieldKey, DeltaFieldChanges][] = [];\n\t\tconst build: DeltaDetachedNodeBuild[] = [];\n\t\tfor (const [fieldKey, field] of fields) {\n\t\t\tconst chunked = chunkFieldSingle(field, {\n\t\t\t\tpolicy: defaultChunkPolicy,\n\t\t\t\tidCompressor: this.idCompressor,\n\t\t\t});\n\t\t\tconst buildId = { minor: allocator.allocate(chunked.topLevelLength) };\n\t\t\tbuild.push({\n\t\t\t\tid: buildId,\n\t\t\t\ttrees: chunked,\n\t\t\t});\n\t\t\tfieldChanges.push([fieldKey, [{ count: chunked.topLevelLength, attach: buildId }]]);\n\t\t}\n\n\t\tassert(this.forest.isEmpty, 0x797 /* forest must be empty */);\n\t\tapplyDelta(\n\t\t\t{ build, fields: new Map(fieldChanges) },\n\t\t\tundefined,\n\t\t\tthis.forest,\n\t\t\tmakeDetachedFieldIndex(\"init\", this.revisionTagCodec, this.idCompressor),\n\t\t);\n\t}\n}\n"]}
@@ -19,7 +19,7 @@ export { compareLocalNodeIdentifiers, createNodeIdentifierManager, isStableNodeI
19
19
  export { FieldKinds, type Required, type Optional, type Sequence, type Identifier, type Forbidden, type DefaultChangeset, DefaultChangeFamily, DefaultEditBuilder, type IDefaultEditBuilder, type ValueFieldEditBuilder, type OptionalFieldEditBuilder, type SequenceFieldEditBuilder, defaultSchemaPolicy, fieldKinds, fieldKindConfigurations, intoDelta, relevantRemovedRoots, getCodecTreeForModularChangeFormat, type ModularChangeFormatVersion, } from "./default-schema/index.js";
20
20
  export { SchemaValidationError, isNodeInSchema, isFieldInSchema, throwOutOfSchema, } from "./schemaChecker.js";
21
21
  export { type FlexTreeOptionalField, type FlexTreeRequiredField, type FlexTreeSequenceField, type FlexTreeContext, type FlexTreeHydratedContext, type FlexTreeTypedField, type FlexTreeEntity, type FlexTreeField, type FlexTreeNode, TreeStatus, Context, type FlexTreeNodeEvents, type FlexTreeUnknownUnboxed, isFlexTreeNode, ContextSlot, flexTreeMarker, assertFlexTreeEntityNotFreed, flexTreeSlot, getSchemaAndPolicy, LazyEntity, treeStatusFromAnchorCache, indexForAt, FlexTreeEntityKind, type FlexibleNodeContent, type FlexibleFieldContent, type FlexTreeHydratedContextMinimal, type HydratedFlexTreeNode, getOrCreateHydratedFlexTreeNode, currentObserver, withObservation, type Observer, } from "./flex-tree/index.js";
22
- export { TreeCompressionStrategy, TreeCompressionStrategyExtended, type TreeCompressionStrategyPrivate, } from "./treeCompressionUtils.js";
22
+ export { TreeCompressionStrategy } from "./treeCompressionUtils.js";
23
23
  export { valueSchemaAllows } from "./valueUtilities.js";
24
24
  export { DetachedFieldIndexSummarizer } from "./detachedFieldIndexSummarizer.js";
25
25
  export { type SchemaChange, makeSchemaChangeCodecs, EncodedSchemaChange, getCodecTreeForSchemaChangeFormat, } from "./schema-edits/index.js";
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/feature-libraries/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EACN,KAAK,QAAQ,EACb,UAAU,GACV,MAAM,yBAAyB,CAAC;AACjC,OAAO,EAAE,WAAW,EAAE,kBAAkB,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAEnF,OAAO,EACN,gBAAgB,EAChB,2BAA2B,EAC3B,KAAK,mBAAmB,GACxB,MAAM,2BAA2B,CAAC;AACnC,OAAO,EACN,qBAAqB,EACrB,oBAAoB,EACpB,iBAAiB,EACjB,sBAAsB,EACtB,KAAK,sBAAsB,EAC3B,sBAAsB,EACtB,gBAAgB,EAChB,KAAK,uBAAuB,EAC5B,KAAK,sBAAsB,EAC3B,KAAK,eAAe,GACpB,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AACvD,OAAO,EACN,gBAAgB,EAChB,gBAAgB,EAChB,eAAe,EACf,gBAAgB,EAChB,2BAA2B,EAC3B,4BAA4B,GAC5B,MAAM,yBAAyB,CAAC;AACjC,OAAO,EACN,mBAAmB,EACnB,KAAK,aAAa,EAClB,UAAU,EACV,eAAe,EACf,KAAK,cAAc,EACnB,oBAAoB,GACpB,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EACN,yBAAyB,EACzB,0BAA0B,EAC1B,sBAAsB,EACtB,2BAA2B,EAC3B,sBAAsB,GACtB,MAAM,qBAAqB,CAAC;AAG7B,OAAO,KAAK,aAAa,MAAM,2BAA2B,CAAC;AAC3D,OAAO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nB,iCAAiC,GACjC,MAAM,yBAAyB,CAAC;AAEjC,OAAO,EAAE,yBAAyB,EAAE,MAAM,4BAA4B,CAAC;AAEvE,OAAO,EACN,KAAK,SAAS,EACd,eAAe,EACf,UAAU,EACV,KAAK,SAAS,EACd,KAAK,YAAY,EACjB,KAAK,cAAc,GACnB,MAAM,qBAAqB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/feature-libraries/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EACN,KAAK,QAAQ,EACb,UAAU,GACV,MAAM,yBAAyB,CAAC;AACjC,OAAO,EAAE,WAAW,EAAE,kBAAkB,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAEnF,OAAO,EACN,gBAAgB,EAChB,2BAA2B,EAC3B,KAAK,mBAAmB,GACxB,MAAM,2BAA2B,CAAC;AACnC,OAAO,EACN,qBAAqB,EACrB,oBAAoB,EACpB,iBAAiB,EACjB,sBAAsB,EACtB,KAAK,sBAAsB,EAC3B,sBAAsB,EACtB,gBAAgB,EAChB,KAAK,uBAAuB,EAC5B,KAAK,sBAAsB,EAC3B,KAAK,eAAe,GACpB,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AACvD,OAAO,EACN,gBAAgB,EAChB,gBAAgB,EAChB,eAAe,EACf,gBAAgB,EAChB,2BAA2B,EAC3B,4BAA4B,GAC5B,MAAM,yBAAyB,CAAC;AACjC,OAAO,EACN,mBAAmB,EACnB,KAAK,aAAa,EAClB,UAAU,EACV,eAAe,EACf,KAAK,cAAc,EACnB,oBAAoB,GACpB,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EACN,yBAAyB,EACzB,0BAA0B,EAC1B,sBAAsB,EACtB,2BAA2B,EAC3B,sBAAsB,GACtB,MAAM,qBAAqB,CAAC;AAG7B,OAAO,KAAK,aAAa,MAAM,2BAA2B,CAAC;AAC3D,OAAO,EAAE,aA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,OAAO,EAAE,yBAAyB,EAAE,MAAM,4BAA4B,CAAC;AAEvE,OAAO,EACN,KAAK,SAAS,EACd,eAAe,EACf,UAAU,EACV,KAAK,SAAS,EACd,KAAK,YAAY,EACjB,KAAK,cAAc,GACnB,MAAM,qBAAqB,CAAC"}
@@ -22,7 +22,7 @@ export { SchemaValidationError, isNodeInSchema, isFieldInSchema, throwOutOfSchem
22
22
  export { TreeStatus, Context, isFlexTreeNode, ContextSlot,
23
23
  // Internal
24
24
  flexTreeMarker, assertFlexTreeEntityNotFreed, flexTreeSlot, getSchemaAndPolicy, LazyEntity, treeStatusFromAnchorCache, indexForAt, FlexTreeEntityKind, getOrCreateHydratedFlexTreeNode, currentObserver, withObservation, } from "./flex-tree/index.js";
25
- export { TreeCompressionStrategy, TreeCompressionStrategyExtended, } from "./treeCompressionUtils.js";
25
+ export { TreeCompressionStrategy } from "./treeCompressionUtils.js";
26
26
  export { valueSchemaAllows } from "./valueUtilities.js";
27
27
  export { DetachedFieldIndexSummarizer } from "./detachedFieldIndexSummarizer.js";
28
28
  export { makeSchemaChangeCodecs, EncodedSchemaChange, getCodecTreeForSchemaChangeFormat, } from "./schema-edits/index.js";