@fluidframework/tree 2.31.0 → 2.32.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (242) hide show
  1. package/.vscode/settings.json +1 -1
  2. package/CHANGELOG.md +44 -0
  3. package/api-extractor/api-extractor.current.json +5 -1
  4. package/api-report/tree.alpha.api.md +44 -20
  5. package/dist/alpha.d.ts +6 -2
  6. package/dist/feature-libraries/flex-tree/context.d.ts +1 -1
  7. package/dist/feature-libraries/flex-tree/context.d.ts.map +1 -1
  8. package/dist/feature-libraries/flex-tree/context.js +1 -2
  9. package/dist/feature-libraries/flex-tree/context.js.map +1 -1
  10. package/dist/feature-libraries/flex-tree/index.d.ts +1 -1
  11. package/dist/feature-libraries/flex-tree/index.d.ts.map +1 -1
  12. package/dist/feature-libraries/flex-tree/index.js +1 -2
  13. package/dist/feature-libraries/flex-tree/index.js.map +1 -1
  14. package/dist/feature-libraries/flex-tree/lazyEntity.d.ts +6 -15
  15. package/dist/feature-libraries/flex-tree/lazyEntity.d.ts.map +1 -1
  16. package/dist/feature-libraries/flex-tree/lazyEntity.js +9 -18
  17. package/dist/feature-libraries/flex-tree/lazyEntity.js.map +1 -1
  18. package/dist/feature-libraries/flex-tree/lazyField.d.ts +3 -3
  19. package/dist/feature-libraries/flex-tree/lazyField.d.ts.map +1 -1
  20. package/dist/feature-libraries/flex-tree/lazyField.js +14 -14
  21. package/dist/feature-libraries/flex-tree/lazyField.js.map +1 -1
  22. package/dist/feature-libraries/flex-tree/lazyNode.d.ts +4 -4
  23. package/dist/feature-libraries/flex-tree/lazyNode.d.ts.map +1 -1
  24. package/dist/feature-libraries/flex-tree/lazyNode.js +12 -12
  25. package/dist/feature-libraries/flex-tree/lazyNode.js.map +1 -1
  26. package/dist/feature-libraries/index.d.ts +1 -1
  27. package/dist/feature-libraries/index.d.ts.map +1 -1
  28. package/dist/feature-libraries/index.js +1 -2
  29. package/dist/feature-libraries/index.js.map +1 -1
  30. package/dist/index.d.ts +2 -1
  31. package/dist/index.d.ts.map +1 -1
  32. package/dist/index.js +5 -2
  33. package/dist/index.js.map +1 -1
  34. package/dist/packageVersion.d.ts +1 -1
  35. package/dist/packageVersion.js +1 -1
  36. package/dist/packageVersion.js.map +1 -1
  37. package/dist/shared-tree/sharedTree.js +2 -2
  38. package/dist/shared-tree/sharedTree.js.map +1 -1
  39. package/dist/shared-tree/treeApiAlpha.d.ts +6 -6
  40. package/dist/shared-tree/treeApiAlpha.d.ts.map +1 -1
  41. package/dist/shared-tree/treeApiAlpha.js.map +1 -1
  42. package/dist/shared-tree-core/sharedTreeCore.d.ts +0 -6
  43. package/dist/shared-tree-core/sharedTreeCore.d.ts.map +1 -1
  44. package/dist/shared-tree-core/sharedTreeCore.js +0 -17
  45. package/dist/shared-tree-core/sharedTreeCore.js.map +1 -1
  46. package/dist/simple-tree/api/conciseTree.d.ts +2 -2
  47. package/dist/simple-tree/api/conciseTree.d.ts.map +1 -1
  48. package/dist/simple-tree/api/conciseTree.js.map +1 -1
  49. package/dist/simple-tree/api/customTree.d.ts +14 -12
  50. package/dist/simple-tree/api/customTree.d.ts.map +1 -1
  51. package/dist/simple-tree/api/customTree.js.map +1 -1
  52. package/dist/simple-tree/api/getJsonSchema.d.ts +21 -7
  53. package/dist/simple-tree/api/getJsonSchema.d.ts.map +1 -1
  54. package/dist/simple-tree/api/getJsonSchema.js +8 -16
  55. package/dist/simple-tree/api/getJsonSchema.js.map +1 -1
  56. package/dist/simple-tree/api/getSimpleSchema.d.ts +3 -10
  57. package/dist/simple-tree/api/getSimpleSchema.d.ts.map +1 -1
  58. package/dist/simple-tree/api/getSimpleSchema.js +4 -16
  59. package/dist/simple-tree/api/getSimpleSchema.js.map +1 -1
  60. package/dist/simple-tree/api/index.d.ts +4 -3
  61. package/dist/simple-tree/api/index.d.ts.map +1 -1
  62. package/dist/simple-tree/api/index.js +2 -1
  63. package/dist/simple-tree/api/index.js.map +1 -1
  64. package/dist/simple-tree/api/schemaFactoryAlpha.d.ts +17 -1
  65. package/dist/simple-tree/api/schemaFactoryAlpha.d.ts.map +1 -1
  66. package/dist/simple-tree/api/schemaFactoryAlpha.js +4 -0
  67. package/dist/simple-tree/api/schemaFactoryAlpha.js.map +1 -1
  68. package/dist/simple-tree/api/schemaFromSimple.d.ts +5 -2
  69. package/dist/simple-tree/api/schemaFromSimple.d.ts.map +1 -1
  70. package/dist/simple-tree/api/schemaFromSimple.js +24 -8
  71. package/dist/simple-tree/api/schemaFromSimple.js.map +1 -1
  72. package/dist/simple-tree/api/simpleSchemaToJsonSchema.d.ts +11 -3
  73. package/dist/simple-tree/api/simpleSchemaToJsonSchema.d.ts.map +1 -1
  74. package/dist/simple-tree/api/simpleSchemaToJsonSchema.js +40 -28
  75. package/dist/simple-tree/api/simpleSchemaToJsonSchema.js.map +1 -1
  76. package/dist/simple-tree/api/tree.d.ts +32 -5
  77. package/dist/simple-tree/api/tree.d.ts.map +1 -1
  78. package/dist/simple-tree/api/tree.js +17 -1
  79. package/dist/simple-tree/api/tree.js.map +1 -1
  80. package/dist/simple-tree/api/verboseTree.d.ts +4 -28
  81. package/dist/simple-tree/api/verboseTree.d.ts.map +1 -1
  82. package/dist/simple-tree/api/verboseTree.js.map +1 -1
  83. package/dist/simple-tree/api/viewSchemaToSimpleSchema.d.ts.map +1 -1
  84. package/dist/simple-tree/api/viewSchemaToSimpleSchema.js +7 -3
  85. package/dist/simple-tree/api/viewSchemaToSimpleSchema.js.map +1 -1
  86. package/dist/simple-tree/core/treeNodeKernel.d.ts.map +1 -1
  87. package/dist/simple-tree/core/treeNodeKernel.js +7 -6
  88. package/dist/simple-tree/core/treeNodeKernel.js.map +1 -1
  89. package/dist/simple-tree/core/unhydratedFlexTree.d.ts.map +1 -1
  90. package/dist/simple-tree/core/unhydratedFlexTree.js +12 -1
  91. package/dist/simple-tree/core/unhydratedFlexTree.js.map +1 -1
  92. package/dist/simple-tree/index.d.ts +1 -1
  93. package/dist/simple-tree/index.d.ts.map +1 -1
  94. package/dist/simple-tree/index.js +3 -2
  95. package/dist/simple-tree/index.js.map +1 -1
  96. package/dist/simple-tree/simpleSchema.d.ts +4 -11
  97. package/dist/simple-tree/simpleSchema.d.ts.map +1 -1
  98. package/dist/simple-tree/simpleSchema.js.map +1 -1
  99. package/dist/tableSchema.d.ts +227 -0
  100. package/dist/tableSchema.d.ts.map +1 -0
  101. package/dist/tableSchema.js +234 -0
  102. package/dist/tableSchema.js.map +1 -0
  103. package/dist/treeFactory.d.ts +4 -4
  104. package/dist/treeFactory.d.ts.map +1 -1
  105. package/dist/treeFactory.js.map +1 -1
  106. package/dist/util/breakable.d.ts.map +1 -1
  107. package/dist/util/breakable.js +9 -7
  108. package/dist/util/breakable.js.map +1 -1
  109. package/lib/alpha.d.ts +6 -2
  110. package/lib/feature-libraries/flex-tree/context.d.ts +1 -1
  111. package/lib/feature-libraries/flex-tree/context.d.ts.map +1 -1
  112. package/lib/feature-libraries/flex-tree/context.js +1 -2
  113. package/lib/feature-libraries/flex-tree/context.js.map +1 -1
  114. package/lib/feature-libraries/flex-tree/index.d.ts +1 -1
  115. package/lib/feature-libraries/flex-tree/index.d.ts.map +1 -1
  116. package/lib/feature-libraries/flex-tree/index.js +1 -1
  117. package/lib/feature-libraries/flex-tree/index.js.map +1 -1
  118. package/lib/feature-libraries/flex-tree/lazyEntity.d.ts +6 -15
  119. package/lib/feature-libraries/flex-tree/lazyEntity.d.ts.map +1 -1
  120. package/lib/feature-libraries/flex-tree/lazyEntity.js +8 -17
  121. package/lib/feature-libraries/flex-tree/lazyEntity.js.map +1 -1
  122. package/lib/feature-libraries/flex-tree/lazyField.d.ts +3 -3
  123. package/lib/feature-libraries/flex-tree/lazyField.d.ts.map +1 -1
  124. package/lib/feature-libraries/flex-tree/lazyField.js +15 -15
  125. package/lib/feature-libraries/flex-tree/lazyField.js.map +1 -1
  126. package/lib/feature-libraries/flex-tree/lazyNode.d.ts +4 -4
  127. package/lib/feature-libraries/flex-tree/lazyNode.d.ts.map +1 -1
  128. package/lib/feature-libraries/flex-tree/lazyNode.js +13 -13
  129. package/lib/feature-libraries/flex-tree/lazyNode.js.map +1 -1
  130. package/lib/feature-libraries/index.d.ts +1 -1
  131. package/lib/feature-libraries/index.d.ts.map +1 -1
  132. package/lib/feature-libraries/index.js +1 -1
  133. package/lib/feature-libraries/index.js.map +1 -1
  134. package/lib/index.d.ts +2 -1
  135. package/lib/index.d.ts.map +1 -1
  136. package/lib/index.js +2 -1
  137. package/lib/index.js.map +1 -1
  138. package/lib/packageVersion.d.ts +1 -1
  139. package/lib/packageVersion.js +1 -1
  140. package/lib/packageVersion.js.map +1 -1
  141. package/lib/shared-tree/sharedTree.js +2 -2
  142. package/lib/shared-tree/sharedTree.js.map +1 -1
  143. package/lib/shared-tree/treeApiAlpha.d.ts +6 -6
  144. package/lib/shared-tree/treeApiAlpha.d.ts.map +1 -1
  145. package/lib/shared-tree/treeApiAlpha.js.map +1 -1
  146. package/lib/shared-tree-core/sharedTreeCore.d.ts +0 -6
  147. package/lib/shared-tree-core/sharedTreeCore.d.ts.map +1 -1
  148. package/lib/shared-tree-core/sharedTreeCore.js +0 -17
  149. package/lib/shared-tree-core/sharedTreeCore.js.map +1 -1
  150. package/lib/simple-tree/api/conciseTree.d.ts +2 -2
  151. package/lib/simple-tree/api/conciseTree.d.ts.map +1 -1
  152. package/lib/simple-tree/api/conciseTree.js.map +1 -1
  153. package/lib/simple-tree/api/customTree.d.ts +14 -12
  154. package/lib/simple-tree/api/customTree.d.ts.map +1 -1
  155. package/lib/simple-tree/api/customTree.js.map +1 -1
  156. package/lib/simple-tree/api/getJsonSchema.d.ts +21 -7
  157. package/lib/simple-tree/api/getJsonSchema.d.ts.map +1 -1
  158. package/lib/simple-tree/api/getJsonSchema.js +8 -16
  159. package/lib/simple-tree/api/getJsonSchema.js.map +1 -1
  160. package/lib/simple-tree/api/getSimpleSchema.d.ts +3 -10
  161. package/lib/simple-tree/api/getSimpleSchema.d.ts.map +1 -1
  162. package/lib/simple-tree/api/getSimpleSchema.js +4 -16
  163. package/lib/simple-tree/api/getSimpleSchema.js.map +1 -1
  164. package/lib/simple-tree/api/index.d.ts +4 -3
  165. package/lib/simple-tree/api/index.d.ts.map +1 -1
  166. package/lib/simple-tree/api/index.js +1 -1
  167. package/lib/simple-tree/api/index.js.map +1 -1
  168. package/lib/simple-tree/api/schemaFactoryAlpha.d.ts +17 -1
  169. package/lib/simple-tree/api/schemaFactoryAlpha.d.ts.map +1 -1
  170. package/lib/simple-tree/api/schemaFactoryAlpha.js +4 -0
  171. package/lib/simple-tree/api/schemaFactoryAlpha.js.map +1 -1
  172. package/lib/simple-tree/api/schemaFromSimple.d.ts +5 -2
  173. package/lib/simple-tree/api/schemaFromSimple.d.ts.map +1 -1
  174. package/lib/simple-tree/api/schemaFromSimple.js +24 -8
  175. package/lib/simple-tree/api/schemaFromSimple.js.map +1 -1
  176. package/lib/simple-tree/api/simpleSchemaToJsonSchema.d.ts +11 -3
  177. package/lib/simple-tree/api/simpleSchemaToJsonSchema.d.ts.map +1 -1
  178. package/lib/simple-tree/api/simpleSchemaToJsonSchema.js +41 -29
  179. package/lib/simple-tree/api/simpleSchemaToJsonSchema.js.map +1 -1
  180. package/lib/simple-tree/api/tree.d.ts +32 -5
  181. package/lib/simple-tree/api/tree.d.ts.map +1 -1
  182. package/lib/simple-tree/api/tree.js +16 -1
  183. package/lib/simple-tree/api/tree.js.map +1 -1
  184. package/lib/simple-tree/api/verboseTree.d.ts +4 -28
  185. package/lib/simple-tree/api/verboseTree.d.ts.map +1 -1
  186. package/lib/simple-tree/api/verboseTree.js.map +1 -1
  187. package/lib/simple-tree/api/viewSchemaToSimpleSchema.d.ts.map +1 -1
  188. package/lib/simple-tree/api/viewSchemaToSimpleSchema.js +7 -3
  189. package/lib/simple-tree/api/viewSchemaToSimpleSchema.js.map +1 -1
  190. package/lib/simple-tree/core/treeNodeKernel.d.ts.map +1 -1
  191. package/lib/simple-tree/core/treeNodeKernel.js +8 -7
  192. package/lib/simple-tree/core/treeNodeKernel.js.map +1 -1
  193. package/lib/simple-tree/core/unhydratedFlexTree.d.ts.map +1 -1
  194. package/lib/simple-tree/core/unhydratedFlexTree.js +12 -1
  195. package/lib/simple-tree/core/unhydratedFlexTree.js.map +1 -1
  196. package/lib/simple-tree/index.d.ts +1 -1
  197. package/lib/simple-tree/index.d.ts.map +1 -1
  198. package/lib/simple-tree/index.js +1 -1
  199. package/lib/simple-tree/index.js.map +1 -1
  200. package/lib/simple-tree/simpleSchema.d.ts +4 -11
  201. package/lib/simple-tree/simpleSchema.d.ts.map +1 -1
  202. package/lib/simple-tree/simpleSchema.js.map +1 -1
  203. package/lib/tableSchema.d.ts +227 -0
  204. package/lib/tableSchema.d.ts.map +1 -0
  205. package/lib/tableSchema.js +231 -0
  206. package/lib/tableSchema.js.map +1 -0
  207. package/lib/treeFactory.d.ts +4 -4
  208. package/lib/treeFactory.d.ts.map +1 -1
  209. package/lib/treeFactory.js.map +1 -1
  210. package/lib/util/breakable.d.ts.map +1 -1
  211. package/lib/util/breakable.js +9 -7
  212. package/lib/util/breakable.js.map +1 -1
  213. package/package.json +25 -37
  214. package/src/feature-libraries/flex-tree/context.ts +2 -2
  215. package/src/feature-libraries/flex-tree/index.ts +0 -1
  216. package/src/feature-libraries/flex-tree/lazyEntity.ts +11 -21
  217. package/src/feature-libraries/flex-tree/lazyField.ts +17 -26
  218. package/src/feature-libraries/flex-tree/lazyNode.ts +13 -19
  219. package/src/feature-libraries/index.ts +0 -1
  220. package/src/index.ts +6 -2
  221. package/src/packageVersion.ts +1 -1
  222. package/src/shared-tree/sharedTree.ts +2 -2
  223. package/src/shared-tree/treeApiAlpha.ts +17 -15
  224. package/src/shared-tree-core/sharedTreeCore.ts +0 -23
  225. package/src/simple-tree/api/conciseTree.ts +4 -4
  226. package/src/simple-tree/api/customTree.ts +16 -14
  227. package/src/simple-tree/api/getJsonSchema.ts +25 -16
  228. package/src/simple-tree/api/getSimpleSchema.ts +4 -18
  229. package/src/simple-tree/api/index.ts +4 -2
  230. package/src/simple-tree/api/schemaFactoryAlpha.ts +18 -1
  231. package/src/simple-tree/api/schemaFromSimple.ts +45 -16
  232. package/src/simple-tree/api/simpleSchemaToJsonSchema.ts +53 -34
  233. package/src/simple-tree/api/tree.ts +51 -4
  234. package/src/simple-tree/api/verboseTree.ts +7 -32
  235. package/src/simple-tree/api/viewSchemaToSimpleSchema.ts +8 -3
  236. package/src/simple-tree/core/treeNodeKernel.ts +11 -7
  237. package/src/simple-tree/core/unhydratedFlexTree.ts +17 -4
  238. package/src/simple-tree/index.ts +4 -2
  239. package/src/simple-tree/simpleSchema.ts +4 -12
  240. package/src/tableSchema.ts +609 -0
  241. package/src/treeFactory.ts +4 -3
  242. package/src/util/breakable.ts +9 -6
@@ -0,0 +1,227 @@
1
+ /*!
2
+ * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
3
+ * Licensed under the MIT License.
4
+ */
5
+ import { type ImplicitAllowedTypes, type InsertableTreeNodeFromImplicitAllowedTypes, type NodeKind, type SchemaFactoryAlpha, type ScopedSchemaName, TreeArrayNode, type TreeNode, type TreeNodeFromImplicitAllowedTypes, type TreeNodeSchemaClass, type WithType } from "./simple-tree/index.js";
6
+ /**
7
+ * Contains types and factories for creating schema to represent dynamic tabular data.
8
+ * @privateRemarks TODO: document in more detail and add `@example`s.
9
+ * @internal
10
+ */
11
+ export declare namespace TableSchema {
12
+ /**
13
+ * A column in a table.
14
+ * @remarks Implemented by the schema class returned from {@link TableSchema.createColumn}.
15
+ * @sealed @internal
16
+ */
17
+ interface IColumn {
18
+ /**
19
+ * The unique identifier of the column.
20
+ * @remarks Uniquely identifies the node within the entire tree, not just the table.
21
+ */
22
+ readonly id: string;
23
+ }
24
+ /**
25
+ * Factory for creating new table column schema.
26
+ * @internal
27
+ */
28
+ function createColumn<const TInputScope extends string | undefined>(inputSchemaFactory: SchemaFactoryAlpha<TInputScope>): TreeNodeSchemaClass<ScopedSchemaName<ScopedSchemaName<TInputScope, "table">, "Column">, NodeKind.Object, TreeNode & IColumn & WithType<ScopedSchemaName<ScopedSchemaName<TInputScope, "table">, "Column">, NodeKind, unknown>, object & {
29
+ readonly id?: string | undefined;
30
+ }, true, {
31
+ readonly id: import("./simple-tree/schemaTypes.js").FieldSchema<import("./simple-tree/schemaTypes.js").FieldKind.Identifier, import("./simple-tree/leafNodeSchema.js").LeafSchema<"string", string>, unknown>;
32
+ }>;
33
+ /**
34
+ * Base column schema type.
35
+ * @sealed @system @internal
36
+ */
37
+ type ColumnSchemaBase<TScope extends string | undefined> = ReturnType<typeof createColumn<TScope>>;
38
+ /**
39
+ * A row in a table.
40
+ * @remarks Implemented by the schema class returned from {@link TableSchema.createRow}.
41
+ * @sealed @internal
42
+ */
43
+ interface IRow<TCellSchema extends ImplicitAllowedTypes, TColumnSchema extends ImplicitAllowedTypes> {
44
+ /**
45
+ * The unique identifier of the row.
46
+ * @remarks Uniquely identifies the node within the entire tree, not just the table.
47
+ */
48
+ readonly id: string;
49
+ /**
50
+ * Gets the cell in the specified column
51
+ * @returns The cell if it exists, otherwise undefined.
52
+ * @privateRemarks TODO: add overload that takes column ID.
53
+ */
54
+ getCell(column: TreeNodeFromImplicitAllowedTypes<TColumnSchema>): TreeNodeFromImplicitAllowedTypes<TCellSchema> | undefined;
55
+ /**
56
+ * Sets the cell in the specified column.
57
+ * @remarks To delete a cell, call {@link TableSchema.IRow.deleteCell} instead.
58
+ * @privateRemarks TODO: add overload that takes column ID.
59
+ */
60
+ setCell(column: TreeNodeFromImplicitAllowedTypes<TColumnSchema>, value: InsertableTreeNodeFromImplicitAllowedTypes<TCellSchema>): void;
61
+ /**
62
+ * Deletes the cell in the specified column.
63
+ * @privateRemarks TODO: add overload that takes column ID.
64
+ */
65
+ deleteCell(column: TreeNodeFromImplicitAllowedTypes<TColumnSchema>): void;
66
+ }
67
+ /**
68
+ * Factory for creating new table row schema.
69
+ * @privateRemarks TODO: add overloads to make column schema optional.
70
+ * @sealed @internal
71
+ */
72
+ function createRow<const TInputScope extends string | undefined, const TCellSchema extends ImplicitAllowedTypes, const TColumnSchema extends ColumnSchemaBase<TInputScope> = ColumnSchemaBase<TInputScope>>(inputSchemaFactory: SchemaFactoryAlpha<TInputScope>, cellSchema: TCellSchema, _columnSchema: TColumnSchema): TreeNodeSchemaClass<ScopedSchemaName<ScopedSchemaName<TInputScope, "table">, "Row">, NodeKind.Object, TreeNode & IRow<TCellSchema, TColumnSchema> & WithType<ScopedSchemaName<ScopedSchemaName<TInputScope, "table">, "Row">, NodeKind, unknown>, object & {
73
+ readonly id?: string | undefined;
74
+ readonly cells: (import("./simple-tree/schemaTypes.js").InsertableTypedNode<import("./simple-tree/index.js").TreeNodeSchemaCore<ScopedSchemaName<ScopedSchemaName<TInputScope, "table">, "Row.cells">, NodeKind.Map, true, TCellSchema, import("./simple-tree/mapNode.js").MapNodeInsertableData<TCellSchema>, unknown> & (new (data?: import("./simple-tree/index.js").InternalTreeNode | import("./simple-tree/mapNode.js").MapNodeInsertableData<TCellSchema> | undefined) => import("./simple-tree/mapNode.js").TreeMapNode<TCellSchema> & WithType<ScopedSchemaName<ScopedSchemaName<TInputScope, "table">, "Row.cells">, NodeKind.Map, unknown>), import("./simple-tree/index.js").TreeNodeSchemaCore<ScopedSchemaName<ScopedSchemaName<TInputScope, "table">, "Row.cells">, NodeKind.Map, true, TCellSchema, import("./simple-tree/mapNode.js").MapNodeInsertableData<TCellSchema>, unknown> & (new (data?: import("./simple-tree/index.js").InternalTreeNode | import("./simple-tree/mapNode.js").MapNodeInsertableData<TCellSchema> | undefined) => import("./simple-tree/mapNode.js").TreeMapNode<TCellSchema> & WithType<ScopedSchemaName<ScopedSchemaName<TInputScope, "table">, "Row.cells">, NodeKind.Map, unknown>)> | undefined) & import("./simple-tree/schemaTypes.js").InsertableTypedNode<import("./simple-tree/index.js").TreeNodeSchemaCore<ScopedSchemaName<ScopedSchemaName<TInputScope, "table">, "Row.cells">, NodeKind.Map, true, TCellSchema, import("./simple-tree/mapNode.js").MapNodeInsertableData<TCellSchema>, unknown> & (new (data?: import("./simple-tree/index.js").InternalTreeNode | import("./simple-tree/mapNode.js").MapNodeInsertableData<TCellSchema> | undefined) => import("./simple-tree/mapNode.js").TreeMapNode<TCellSchema> & WithType<ScopedSchemaName<ScopedSchemaName<TInputScope, "table">, "Row.cells">, NodeKind.Map, unknown>), import("./simple-tree/index.js").TreeNodeSchemaCore<ScopedSchemaName<ScopedSchemaName<TInputScope, "table">, "Row.cells">, NodeKind.Map, true, TCellSchema, import("./simple-tree/mapNode.js").MapNodeInsertableData<TCellSchema>, unknown> & (new (data?: import("./simple-tree/index.js").InternalTreeNode | import("./simple-tree/mapNode.js").MapNodeInsertableData<TCellSchema> | undefined) => import("./simple-tree/mapNode.js").TreeMapNode<TCellSchema> & WithType<ScopedSchemaName<ScopedSchemaName<TInputScope, "table">, "Row.cells">, NodeKind.Map, unknown>)>;
75
+ }, true, {
76
+ readonly id: import("./simple-tree/schemaTypes.js").FieldSchema<import("./simple-tree/schemaTypes.js").FieldKind.Identifier, import("./simple-tree/leafNodeSchema.js").LeafSchema<"string", string>, unknown>;
77
+ readonly cells: TreeNodeSchemaClass<ScopedSchemaName<ScopedSchemaName<TInputScope, "table">, "Row.cells">, NodeKind.Map, import("./simple-tree/mapNode.js").TreeMapNode<TCellSchema> & WithType<ScopedSchemaName<ScopedSchemaName<TInputScope, "table">, "Row.cells">, NodeKind.Map, unknown>, import("./simple-tree/mapNode.js").MapNodeInsertableData<TCellSchema>, true, TCellSchema, undefined>;
78
+ }>;
79
+ /**
80
+ * Base row schema type.
81
+ * @sealed @system @internal
82
+ */
83
+ type RowSchemaBase<TScope extends string | undefined, TCellSchema extends ImplicitAllowedTypes, TColumnSchema extends ColumnSchemaBase<TScope> = ColumnSchemaBase<TScope>> = ReturnType<typeof createRow<TScope, TCellSchema, TColumnSchema>>;
84
+ /**
85
+ * A key to uniquely identify a cell in a table.
86
+ * @sealed @internal
87
+ */
88
+ interface CellKey {
89
+ /**
90
+ * {@link TableSchema.IColumn.id} of the containing {@link TableSchema.IColumn}.
91
+ */
92
+ readonly columnId: string;
93
+ /**
94
+ * {@link TableSchema.IRow.id} of the containing {@link TableSchema.IRow}.
95
+ */
96
+ readonly rowId: string;
97
+ }
98
+ /**
99
+ * {@link TableSchema.ITable.insertColumn} parameters.
100
+ * @sealed @internal
101
+ */
102
+ interface InsertColumnParameters<TInsertableColumn> {
103
+ /**
104
+ * The index at which to insert the new column.
105
+ * @remarks If not provided, the column will be appended to the end of the table.
106
+ */
107
+ readonly index?: number | undefined;
108
+ /**
109
+ * The column to insert.
110
+ */
111
+ readonly column: TInsertableColumn;
112
+ }
113
+ /**
114
+ * {@link TableSchema.ITable.insertRows} parameters.
115
+ * @sealed @internal
116
+ */
117
+ interface InsertRowsParameters<TInsertableRow> {
118
+ /**
119
+ * The index at which to insert the new rows.
120
+ * @remarks If not provided, the rows will be appended to the end of the table.
121
+ */
122
+ readonly index?: number | undefined;
123
+ /**
124
+ * The rows to insert.
125
+ */
126
+ readonly rows: TInsertableRow[];
127
+ }
128
+ /**
129
+ * {@link TableSchema.ITable.setCell} parameters.
130
+ * @sealed @internal
131
+ */
132
+ interface SetCellParameters<TInsertableCell> {
133
+ /**
134
+ * The key to uniquely identify a cell in a table.
135
+ */
136
+ readonly key: CellKey;
137
+ /**
138
+ * The cell to set.
139
+ */
140
+ readonly cell: TInsertableCell;
141
+ }
142
+ /**
143
+ * A table.
144
+ * @sealed @internal
145
+ */
146
+ interface ITable<TCellSchema extends ImplicitAllowedTypes, TColumnSchema extends ImplicitAllowedTypes, TRowSchema extends ImplicitAllowedTypes> {
147
+ /**
148
+ * The table's columns.
149
+ */
150
+ readonly columns: TreeArrayNode<TColumnSchema>;
151
+ /**
152
+ * The table's rows.
153
+ */
154
+ readonly rows: TreeArrayNode<TRowSchema>;
155
+ /**
156
+ * Gets a table column by its {@link TableSchema.IRow.id}.
157
+ */
158
+ getColumn(id: string): TreeNodeFromImplicitAllowedTypes<TColumnSchema> | undefined;
159
+ /**
160
+ * Gets a table row by its {@link TableSchema.IRow.id}.
161
+ */
162
+ getRow(id: string): TreeNodeFromImplicitAllowedTypes<TRowSchema> | undefined;
163
+ /**
164
+ * Gets a cell in the table by column and row IDs.
165
+ * @param key - A key that uniquely distinguishes a cell in the table, represented as a combination of the column ID and row ID.
166
+ * @privateRemarks TODO: add overload that takes row and column nodes.
167
+ */
168
+ getCell(key: CellKey): TreeNodeFromImplicitAllowedTypes<TCellSchema> | undefined;
169
+ /**
170
+ * Inserts a column into the table.
171
+ * @throws Throws an error if the column is already in the tree, or if the specified index is out of range.
172
+ */
173
+ insertColumn(params: InsertColumnParameters<InsertableTreeNodeFromImplicitAllowedTypes<TColumnSchema>>): TreeNodeFromImplicitAllowedTypes<TColumnSchema>;
174
+ /**
175
+ * Inserts 0 or more rows into the table.
176
+ * @throws Throws an error if any of the rows are already in the tree, or if the specified index is out of range.
177
+ */
178
+ insertRows(params: InsertRowsParameters<InsertableTreeNodeFromImplicitAllowedTypes<TRowSchema>>): TreeNodeFromImplicitAllowedTypes<TRowSchema>[];
179
+ /**
180
+ * Sets the cell at the specified location in the table.
181
+ * @remarks To delete a cell, call {@link TableSchema.ITable.deleteCell} instead.
182
+ * @privateRemarks TODO: add overload that takes column/row nodes?
183
+ */
184
+ setCell(params: SetCellParameters<InsertableTreeNodeFromImplicitAllowedTypes<TCellSchema>>): void;
185
+ /**
186
+ * Removes the specified column from the table.
187
+ * @remarks Note: this does not remove any cells from the table's rows.
188
+ * @privateRemarks
189
+ * TODO:
190
+ * - Policy for when the column is not in the table.
191
+ * - Actually remove corresponding cells from table rows.
192
+ */
193
+ removeColumn: (column: TreeNodeFromImplicitAllowedTypes<TColumnSchema>) => void;
194
+ /**
195
+ * Deletes 0 or more rows from the table.
196
+ * @privateRemarks TODO: policy for when 1 or more rows are not in the table.
197
+ */
198
+ deleteRows: (rows: readonly TreeNodeFromImplicitAllowedTypes<TRowSchema>[]) => void;
199
+ /**
200
+ * Deletes all rows from the table.
201
+ */
202
+ deleteAllRows: () => void;
203
+ /**
204
+ * Deletes the cell at the specified location in the table.
205
+ * @privateRemarks TODO: add overload that takes column/row nodes?
206
+ */
207
+ deleteCell: (key: CellKey) => void;
208
+ }
209
+ /**
210
+ * Factory for creating new table schema.
211
+ * @privateRemarks TODO: add overloads to make column/row schema optional.
212
+ * @internal
213
+ */
214
+ function createTable<const TInputScope extends string | undefined, const TCell extends ImplicitAllowedTypes, const TColumn extends ColumnSchemaBase<TInputScope> = ColumnSchemaBase<TInputScope>, const TRow extends RowSchemaBase<TInputScope, TCell, TColumn> = RowSchemaBase<TInputScope, TCell, TColumn>>(inputSchemaFactory: SchemaFactoryAlpha<TInputScope>, _cellSchema: TCell, columnSchema: TColumn, rowSchema: TRow): TreeNodeSchemaClass<ScopedSchemaName<ScopedSchemaName<TInputScope, "table">, "Table">, NodeKind.Object, TreeNode & ITable<TCell, TColumn, TRow> & WithType<ScopedSchemaName<ScopedSchemaName<TInputScope, "table">, "Table">, NodeKind, unknown>, object & {
215
+ readonly rows: (import("./simple-tree/schemaTypes.js").InsertableTypedNode<import("./simple-tree/index.js").TreeNodeSchemaCore<ScopedSchemaName<ScopedSchemaName<TInputScope, "table">, "Table.rows">, NodeKind.Array, true, TRow, Iterable<InsertableTreeNodeFromImplicitAllowedTypes<TRow>>, unknown> & (new (data?: import("./simple-tree/index.js").InternalTreeNode | Iterable<InsertableTreeNodeFromImplicitAllowedTypes<TRow>> | undefined) => TreeArrayNode<TRow, [TRow] extends [ImplicitAllowedTypes] ? TreeNodeFromImplicitAllowedTypes<TRow> : TreeNodeFromImplicitAllowedTypes<ImplicitAllowedTypes>, [TRow] extends [ImplicitAllowedTypes] ? InsertableTreeNodeFromImplicitAllowedTypes<TRow> : never, import("./simple-tree/arrayNode.js").ReadonlyArrayNode<TreeNode | import("./simple-tree/schemaTypes.js").TreeLeafValue>> & WithType<ScopedSchemaName<ScopedSchemaName<TInputScope, "table">, "Table.rows">, NodeKind.Array, unknown>), import("./simple-tree/index.js").TreeNodeSchemaCore<ScopedSchemaName<ScopedSchemaName<TInputScope, "table">, "Table.rows">, NodeKind.Array, true, TRow, Iterable<InsertableTreeNodeFromImplicitAllowedTypes<TRow>>, unknown> & (new (data?: import("./simple-tree/index.js").InternalTreeNode | Iterable<InsertableTreeNodeFromImplicitAllowedTypes<TRow>> | undefined) => TreeArrayNode<TRow, [TRow] extends [ImplicitAllowedTypes] ? TreeNodeFromImplicitAllowedTypes<TRow> : TreeNodeFromImplicitAllowedTypes<ImplicitAllowedTypes>, [TRow] extends [ImplicitAllowedTypes] ? InsertableTreeNodeFromImplicitAllowedTypes<TRow> : never, import("./simple-tree/arrayNode.js").ReadonlyArrayNode<TreeNode | import("./simple-tree/schemaTypes.js").TreeLeafValue>> & WithType<ScopedSchemaName<ScopedSchemaName<TInputScope, "table">, "Table.rows">, NodeKind.Array, unknown>)> | undefined) & import("./simple-tree/schemaTypes.js").InsertableTypedNode<import("./simple-tree/index.js").TreeNodeSchemaCore<ScopedSchemaName<ScopedSchemaName<TInputScope, "table">, "Table.rows">, NodeKind.Array, true, TRow, Iterable<InsertableTreeNodeFromImplicitAllowedTypes<TRow>>, unknown> & (new (data?: import("./simple-tree/index.js").InternalTreeNode | Iterable<InsertableTreeNodeFromImplicitAllowedTypes<TRow>> | undefined) => TreeArrayNode<TRow, [TRow] extends [ImplicitAllowedTypes] ? TreeNodeFromImplicitAllowedTypes<TRow> : TreeNodeFromImplicitAllowedTypes<ImplicitAllowedTypes>, [TRow] extends [ImplicitAllowedTypes] ? InsertableTreeNodeFromImplicitAllowedTypes<TRow> : never, import("./simple-tree/arrayNode.js").ReadonlyArrayNode<TreeNode | import("./simple-tree/schemaTypes.js").TreeLeafValue>> & WithType<ScopedSchemaName<ScopedSchemaName<TInputScope, "table">, "Table.rows">, NodeKind.Array, unknown>), import("./simple-tree/index.js").TreeNodeSchemaCore<ScopedSchemaName<ScopedSchemaName<TInputScope, "table">, "Table.rows">, NodeKind.Array, true, TRow, Iterable<InsertableTreeNodeFromImplicitAllowedTypes<TRow>>, unknown> & (new (data?: import("./simple-tree/index.js").InternalTreeNode | Iterable<InsertableTreeNodeFromImplicitAllowedTypes<TRow>> | undefined) => TreeArrayNode<TRow, [TRow] extends [ImplicitAllowedTypes] ? TreeNodeFromImplicitAllowedTypes<TRow> : TreeNodeFromImplicitAllowedTypes<ImplicitAllowedTypes>, [TRow] extends [ImplicitAllowedTypes] ? InsertableTreeNodeFromImplicitAllowedTypes<TRow> : never, import("./simple-tree/arrayNode.js").ReadonlyArrayNode<TreeNode | import("./simple-tree/schemaTypes.js").TreeLeafValue>> & WithType<ScopedSchemaName<ScopedSchemaName<TInputScope, "table">, "Table.rows">, NodeKind.Array, unknown>)>;
216
+ readonly columns: (import("./simple-tree/schemaTypes.js").InsertableTypedNode<import("./simple-tree/index.js").TreeNodeSchemaCore<ScopedSchemaName<ScopedSchemaName<TInputScope, "table">, "Table.columns">, NodeKind.Array, true, TColumn, Iterable<InsertableTreeNodeFromImplicitAllowedTypes<TColumn>>, unknown> & (new (data?: import("./simple-tree/index.js").InternalTreeNode | Iterable<InsertableTreeNodeFromImplicitAllowedTypes<TColumn>> | undefined) => TreeArrayNode<TColumn, [TColumn] extends [ImplicitAllowedTypes] ? TreeNodeFromImplicitAllowedTypes<TColumn> : TreeNodeFromImplicitAllowedTypes<ImplicitAllowedTypes>, [TColumn] extends [ImplicitAllowedTypes] ? InsertableTreeNodeFromImplicitAllowedTypes<TColumn> : never, import("./simple-tree/arrayNode.js").ReadonlyArrayNode<TreeNode | import("./simple-tree/schemaTypes.js").TreeLeafValue>> & WithType<ScopedSchemaName<ScopedSchemaName<TInputScope, "table">, "Table.columns">, NodeKind.Array, unknown>), import("./simple-tree/index.js").TreeNodeSchemaCore<ScopedSchemaName<ScopedSchemaName<TInputScope, "table">, "Table.columns">, NodeKind.Array, true, TColumn, Iterable<InsertableTreeNodeFromImplicitAllowedTypes<TColumn>>, unknown> & (new (data?: import("./simple-tree/index.js").InternalTreeNode | Iterable<InsertableTreeNodeFromImplicitAllowedTypes<TColumn>> | undefined) => TreeArrayNode<TColumn, [TColumn] extends [ImplicitAllowedTypes] ? TreeNodeFromImplicitAllowedTypes<TColumn> : TreeNodeFromImplicitAllowedTypes<ImplicitAllowedTypes>, [TColumn] extends [ImplicitAllowedTypes] ? InsertableTreeNodeFromImplicitAllowedTypes<TColumn> : never, import("./simple-tree/arrayNode.js").ReadonlyArrayNode<TreeNode | import("./simple-tree/schemaTypes.js").TreeLeafValue>> & WithType<ScopedSchemaName<ScopedSchemaName<TInputScope, "table">, "Table.columns">, NodeKind.Array, unknown>)> | undefined) & import("./simple-tree/schemaTypes.js").InsertableTypedNode<import("./simple-tree/index.js").TreeNodeSchemaCore<ScopedSchemaName<ScopedSchemaName<TInputScope, "table">, "Table.columns">, NodeKind.Array, true, TColumn, Iterable<InsertableTreeNodeFromImplicitAllowedTypes<TColumn>>, unknown> & (new (data?: import("./simple-tree/index.js").InternalTreeNode | Iterable<InsertableTreeNodeFromImplicitAllowedTypes<TColumn>> | undefined) => TreeArrayNode<TColumn, [TColumn] extends [ImplicitAllowedTypes] ? TreeNodeFromImplicitAllowedTypes<TColumn> : TreeNodeFromImplicitAllowedTypes<ImplicitAllowedTypes>, [TColumn] extends [ImplicitAllowedTypes] ? InsertableTreeNodeFromImplicitAllowedTypes<TColumn> : never, import("./simple-tree/arrayNode.js").ReadonlyArrayNode<TreeNode | import("./simple-tree/schemaTypes.js").TreeLeafValue>> & WithType<ScopedSchemaName<ScopedSchemaName<TInputScope, "table">, "Table.columns">, NodeKind.Array, unknown>), import("./simple-tree/index.js").TreeNodeSchemaCore<ScopedSchemaName<ScopedSchemaName<TInputScope, "table">, "Table.columns">, NodeKind.Array, true, TColumn, Iterable<InsertableTreeNodeFromImplicitAllowedTypes<TColumn>>, unknown> & (new (data?: import("./simple-tree/index.js").InternalTreeNode | Iterable<InsertableTreeNodeFromImplicitAllowedTypes<TColumn>> | undefined) => TreeArrayNode<TColumn, [TColumn] extends [ImplicitAllowedTypes] ? TreeNodeFromImplicitAllowedTypes<TColumn> : TreeNodeFromImplicitAllowedTypes<ImplicitAllowedTypes>, [TColumn] extends [ImplicitAllowedTypes] ? InsertableTreeNodeFromImplicitAllowedTypes<TColumn> : never, import("./simple-tree/arrayNode.js").ReadonlyArrayNode<TreeNode | import("./simple-tree/schemaTypes.js").TreeLeafValue>> & WithType<ScopedSchemaName<ScopedSchemaName<TInputScope, "table">, "Table.columns">, NodeKind.Array, unknown>)>;
217
+ }, true, {
218
+ readonly rows: TreeNodeSchemaClass<ScopedSchemaName<ScopedSchemaName<TInputScope, "table">, "Table.rows">, NodeKind.Array, TreeArrayNode<TRow, [TRow] extends [ImplicitAllowedTypes] ? TreeNodeFromImplicitAllowedTypes<TRow> : TreeNodeFromImplicitAllowedTypes<ImplicitAllowedTypes>, [TRow] extends [ImplicitAllowedTypes] ? InsertableTreeNodeFromImplicitAllowedTypes<TRow> : never, import("./simple-tree/arrayNode.js").ReadonlyArrayNode<TreeNode | import("./simple-tree/schemaTypes.js").TreeLeafValue>> & WithType<ScopedSchemaName<ScopedSchemaName<TInputScope, "table">, "Table.rows">, NodeKind.Array, unknown>, Iterable<InsertableTreeNodeFromImplicitAllowedTypes<TRow>>, true, TRow, undefined>;
219
+ readonly columns: TreeNodeSchemaClass<ScopedSchemaName<ScopedSchemaName<TInputScope, "table">, "Table.columns">, NodeKind.Array, TreeArrayNode<TColumn, [TColumn] extends [ImplicitAllowedTypes] ? TreeNodeFromImplicitAllowedTypes<TColumn> : TreeNodeFromImplicitAllowedTypes<ImplicitAllowedTypes>, [TColumn] extends [ImplicitAllowedTypes] ? InsertableTreeNodeFromImplicitAllowedTypes<TColumn> : never, import("./simple-tree/arrayNode.js").ReadonlyArrayNode<TreeNode | import("./simple-tree/schemaTypes.js").TreeLeafValue>> & WithType<ScopedSchemaName<ScopedSchemaName<TInputScope, "table">, "Table.columns">, NodeKind.Array, unknown>, Iterable<InsertableTreeNodeFromImplicitAllowedTypes<TColumn>>, true, TColumn, undefined>;
220
+ }>;
221
+ /**
222
+ * Base row schema type.
223
+ * @sealed @system @internal
224
+ */
225
+ type TableSchemaBase<TScope extends string | undefined, TCell extends ImplicitAllowedTypes, TColumn extends ColumnSchemaBase<TScope> = ColumnSchemaBase<TScope>, TRow extends RowSchemaBase<TScope, TCell, TColumn> = RowSchemaBase<TScope, TCell, TColumn>> = ReturnType<typeof createTable<TScope, TCell, TColumn, TRow>>;
226
+ }
227
+ //# sourceMappingURL=tableSchema.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tableSchema.d.ts","sourceRoot":"","sources":["../src/tableSchema.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAKH,OAAO,EACN,KAAK,oBAAoB,EAGzB,KAAK,0CAA0C,EAC/C,KAAK,QAAQ,EACb,KAAK,kBAAkB,EACvB,KAAK,gBAAgB,EACrB,aAAa,EACb,KAAK,QAAQ,EACb,KAAK,gCAAgC,EACrC,KAAK,mBAAmB,EACxB,KAAK,QAAQ,EACb,MAAM,wBAAwB,CAAC;AAQhC;;;;GAIG;AACH,yBAAiB,WAAW,CAAC;IAK5B;;;;OAIG;IACH,UAAiB,OAAO;QACvB;;;WAGG;QACH,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;KACpB;IAED;;;OAGG;IAEH,SAAgB,YAAY,CAAC,KAAK,CAAC,WAAW,SAAS,MAAM,GAAG,SAAS,EACxE,kBAAkB,EAAE,kBAAkB,CAAC,WAAW,CAAC;;;;OAqCnD;IAED;;;OAGG;IACH,KAAY,gBAAgB,CAAC,MAAM,SAAS,MAAM,GAAG,SAAS,IAAI,UAAU,CAC3E,OAAO,YAAY,CAAC,MAAM,CAAC,CAC3B,CAAC;IAMF;;;;OAIG;IACH,UAAiB,IAAI,CACpB,WAAW,SAAS,oBAAoB,EACxC,aAAa,SAAS,oBAAoB;QAE1C;;;WAGG;QACH,QAAQ,CAAC,EAAE,EAAE,MA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AC,MAAM,EAAE,KAAK,EAAE,OAAO,EAAE,IAAI,CAAC,CAAC,CAAC;CAGjE"}
@@ -0,0 +1,234 @@
1
+ "use strict";
2
+ /*!
3
+ * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
4
+ * Licensed under the MIT License.
5
+ */
6
+ Object.defineProperty(exports, "__esModule", { value: true });
7
+ exports.TableSchema = void 0;
8
+ const internal_1 = require("@fluidframework/core-utils/internal");
9
+ const index_js_1 = require("./shared-tree/index.js");
10
+ const index_js_2 = require("./simple-tree/index.js");
11
+ // Future improvement TODOs (ideally to be done before promoting these APIs to `@alpha`):
12
+ // - Custom fields on Table/Row/Column (props pattern from Nick's demo)
13
+ // - Overloads to make Column/Row schema optional when constructing Tables
14
+ // - Record-like type parameters / input parameters?
15
+ // - Move `@system` types into separate / sub scope?
16
+ /**
17
+ * Contains types and factories for creating schema to represent dynamic tabular data.
18
+ * @privateRemarks TODO: document in more detail and add `@example`s.
19
+ * @internal
20
+ */
21
+ var TableSchema;
22
+ (function (TableSchema) {
23
+ const tableSchemaFactorySubScope = "table";
24
+ /**
25
+ * Factory for creating new table column schema.
26
+ * @internal
27
+ */
28
+ // eslint-disable-next-line @typescript-eslint/explicit-function-return-type -- Return type is too complex to be reasonable to specify
29
+ function createColumn(inputSchemaFactory) {
30
+ const schemaFactory = inputSchemaFactory.scopedFactory(tableSchemaFactorySubScope);
31
+ /**
32
+ * {@link Column} fields.
33
+ * @remarks Extracted for re-use in returned type signature defined later in this function.
34
+ * The implicit typing is intentional.
35
+ */
36
+ const columnFields = {
37
+ id: schemaFactory.identifier,
38
+ };
39
+ /**
40
+ * A column in a table.
41
+ */
42
+ class Column extends schemaFactory.object("Column", columnFields) {
43
+ }
44
+ // Returning SingletonSchema without a type conversion results in TypeScript generating something like `readonly "__#124291@#brand": unknown;`
45
+ // for the private brand field of TreeNode.
46
+ // This numeric id doesn't seem to be stable over incremental builds, and thus causes diffs in the API extractor reports.
47
+ // This is avoided by doing this type conversion.
48
+ // The conversion is done via assignment instead of `as` to get stronger type safety.
49
+ const ColumnSchemaType = Column;
50
+ return ColumnSchemaType;
51
+ }
52
+ TableSchema.createColumn = createColumn;
53
+ /**
54
+ * Factory for creating new table row schema.
55
+ * @privateRemarks TODO: add overloads to make column schema optional.
56
+ * @sealed @internal
57
+ */
58
+ // eslint-disable-next-line @typescript-eslint/explicit-function-return-type -- Return type is too complex to be reasonable to specify
59
+ function createRow(inputSchemaFactory, cellSchema, _columnSchema) {
60
+ const schemaFactory = inputSchemaFactory.scopedFactory(tableSchemaFactorySubScope);
61
+ /**
62
+ * {@link Row} fields.
63
+ * @remarks Extracted for re-use in returned type signature defined later in this function.
64
+ * The implicit typing is intentional.
65
+ */
66
+ const rowFields = {
67
+ id: schemaFactory.identifier,
68
+ cells: schemaFactory.map("Row.cells", cellSchema),
69
+ };
70
+ /**
71
+ * The Row schema - this is a map of Cells where the key is the column id
72
+ */
73
+ class Row extends schemaFactory.object("Row", rowFields) {
74
+ getCell(column) {
75
+ return this.cells.get(column.id);
76
+ }
77
+ setCell(column, value) {
78
+ this.cells.set(column.id, value);
79
+ }
80
+ deleteCell(column) {
81
+ if (!this.cells.has(column.id))
82
+ return;
83
+ this.cells.delete(column.id);
84
+ }
85
+ }
86
+ // Returning SingletonSchema without a type conversion results in TypeScript generating something like `readonly "__#124291@#brand": unknown;`
87
+ // for the private brand field of TreeNode.
88
+ // This numeric id doesn't seem to be stable over incremental builds, and thus causes diffs in the API extractor reports.
89
+ // This is avoided by doing this type conversion.
90
+ // The conversion is done via assignment instead of `as` to get stronger type safety.
91
+ const RowSchemaType = Row;
92
+ return RowSchemaType;
93
+ }
94
+ TableSchema.createRow = createRow;
95
+ /**
96
+ * Factory for creating new table schema.
97
+ * @privateRemarks TODO: add overloads to make column/row schema optional.
98
+ * @internal
99
+ */
100
+ // eslint-disable-next-line @typescript-eslint/explicit-function-return-type -- Return type is too complex to be reasonable to specify
101
+ function createTable(inputSchemaFactory, _cellSchema, columnSchema, rowSchema) {
102
+ const schemaFactory = inputSchemaFactory.scopedFactory(tableSchemaFactorySubScope);
103
+ /**
104
+ * {@link Table} fields.
105
+ * @remarks Extracted for re-use in returned type signature defined later in this function.
106
+ * The implicit typing is intentional.
107
+ */
108
+ const tableFields = {
109
+ rows: schemaFactory.array("Table.rows", rowSchema),
110
+ columns: schemaFactory.array("Table.columns", columnSchema),
111
+ };
112
+ /**
113
+ * The Table schema
114
+ */
115
+ class Table extends schemaFactory.object("Table", tableFields) {
116
+ getColumn(id) {
117
+ // TypeScript is unable to narrow the types correctly here, hence the casts.
118
+ // See: https://github.com/microsoft/TypeScript/issues/52144
119
+ return this.columns.find((column) => column.id === id);
120
+ }
121
+ getRow(id) {
122
+ // TypeScript is unable to narrow the types correctly here, hence the casts.
123
+ // See: https://github.com/microsoft/TypeScript/issues/52144
124
+ return this.rows.find((_row) => _row.id === id);
125
+ }
126
+ getCell(key) {
127
+ const { columnId, rowId } = key;
128
+ const row = this.getRow(rowId);
129
+ if (row !== undefined) {
130
+ const column = this.getColumn(columnId);
131
+ if (column !== undefined) {
132
+ return row.getCell(column);
133
+ }
134
+ }
135
+ // If the cell does not exist return undefined
136
+ return undefined;
137
+ }
138
+ insertColumn({ column, index, }) {
139
+ if (index === undefined) {
140
+ // TypeScript is unable to narrow the types correctly here, hence the cast.
141
+ // See: https://github.com/microsoft/TypeScript/issues/52144
142
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
143
+ this.columns.insertAtEnd(column);
144
+ }
145
+ else {
146
+ // TypeScript is unable to narrow the types correctly here, hence the cast.
147
+ // See: https://github.com/microsoft/TypeScript/issues/52144
148
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
149
+ this.columns.insertAt(index, column);
150
+ }
151
+ // Inserting the input node into the tree hydrates it, making it usable as a node.
152
+ return column;
153
+ }
154
+ insertRows({ index, rows, }) {
155
+ if (index === undefined) {
156
+ // TypeScript is unable to narrow the types correctly here, hence the cast.
157
+ // See: https://github.com/microsoft/TypeScript/issues/52144
158
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
159
+ this.rows.insertAtEnd(index_js_2.TreeArrayNode.spread(rows));
160
+ }
161
+ else {
162
+ // TypeScript is unable to narrow the types correctly here, hence the cast.
163
+ // See: https://github.com/microsoft/TypeScript/issues/52144
164
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
165
+ this.rows.insertAt(index, index_js_2.TreeArrayNode.spread(rows));
166
+ }
167
+ // Inserting the input nodes into the tree hydrates them, making them usable as nodes.
168
+ return rows;
169
+ }
170
+ setCell({ key, cell }) {
171
+ const { columnId, rowId } = key;
172
+ const row = this.getRow(rowId);
173
+ if (row !== undefined) {
174
+ const column = this.getColumn(columnId);
175
+ if (column !== undefined) {
176
+ row.setCell(column, cell);
177
+ }
178
+ }
179
+ }
180
+ removeColumn(column) {
181
+ const index = this.columns.indexOf(column);
182
+ // If the column is not in the table, do nothing
183
+ if (index === -1)
184
+ return;
185
+ this.columns.removeAt(index);
186
+ }
187
+ deleteRows(rows) {
188
+ // If there are no rows to delete, do nothing
189
+ if (rows.length === 0) {
190
+ return;
191
+ }
192
+ // If there is only one row to delete, delete it
193
+ if (rows.length === 1) {
194
+ const index = this.rows.indexOf(rows[0] ?? (0, internal_1.oob)());
195
+ this.rows.removeAt(index);
196
+ return;
197
+ }
198
+ // If there are multiple rows to delete, delete them in a transaction
199
+ // This is to avoid the performance issues of deleting multiple rows at once
200
+ index_js_1.Tree.runTransaction(this, () => {
201
+ // Iterate over the rows and delete them
202
+ for (const row of rows) {
203
+ const index = this.rows.indexOf(row);
204
+ this.rows.removeAt(index);
205
+ }
206
+ });
207
+ }
208
+ deleteAllRows() {
209
+ this.rows.removeRange();
210
+ }
211
+ deleteCell(key) {
212
+ const { columnId, rowId } = key;
213
+ const row = this.getRow(rowId);
214
+ if (row !== undefined) {
215
+ const column = this.getColumn(columnId);
216
+ if (column !== undefined) {
217
+ row.deleteCell(column);
218
+ }
219
+ }
220
+ }
221
+ }
222
+ // Returning SingletonSchema without a type conversion results in TypeScript generating something like `readonly "__#124291@#brand": unknown;`
223
+ // for the private brand field of TreeNode.
224
+ // This numeric id doesn't seem to be stable over incremental builds, and thus causes diffs in the API extractor reports.
225
+ // This is avoided by doing this type conversion.
226
+ // The conversion is done via assignment instead of `as` to get stronger type safety.
227
+ const TableSchemaType = Table;
228
+ // Return the table schema
229
+ return TableSchemaType;
230
+ }
231
+ TableSchema.createTable = createTable;
232
+ // #endregion
233
+ })(TableSchema || (exports.TableSchema = TableSchema = {}));
234
+ //# sourceMappingURL=tableSchema.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tableSchema.js","sourceRoot":"","sources":["../src/tableSchema.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,kEAA0D;AAE1D,qDAA8C;AAC9C,qDAagC;AAEhC,yFAAyF;AACzF,uEAAuE;AACvE,0EAA0E;AAC1E,oDAAoD;AACpD,oDAAoD;AAEpD;;;;GAIG;AACH,IAAiB,WAAW,CA8jB3B;AA9jBD,WAAiB,WAAW;IAC3B,MAAM,0BAA0B,GAAG,OAAO,CAAC;IAiB3C;;;OAGG;IACH,sIAAsI;IACtI,SAAgB,YAAY,CAC3B,kBAAmD;QAEnD,MAAM,aAAa,GAAG,kBAAkB,CAAC,aAAa,CAAC,0BAA0B,CAAC,CAAC;QAGnF;;;;WAIG;QACH,MAAM,YAAY,GAAG;YACpB,EAAE,EAAE,aAAa,CAAC,UAAU;SAC2B,CAAC;QAEzD;;WAEG;QACH,MAAM,MAAO,SAAQ,aAAa,CAAC,MAAM,CAAC,QAAQ,EAAE,YAAY,CAAC;SAAsB;QAKvF,8IAA8I;QAC9I,2CAA2C;QAC3C,yHAAyH;QACzH,iDAAiD;QACjD,qFAAqF;QACrF,MAAM,gBAAgB,GAOlB,MAAM,CAAC;QAEX,OAAO,gBAAgB,CAAC;IACzB,CAAC;IAtCe,wBAAY,eAsC3B,CAAA;IAuDD;;;;OAIG;IACH,sIAAsI;IACtI,SAAgB,SA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SAAS,CAAC,QAAQ,CAAC,CAAC;oBACxC,IAAI,MAAM,KAAK,SAAS,EAAE,CAAC;wBAC1B,GAAG,CAAC,UAAU,CAAC,MAAM,CAAC,CAAC;oBACxB,CAAC;gBACF,CAAC;YACF,CAAC;SACD;QAOD,8IAA8I;QAC9I,2CAA2C;QAC3C,yHAAyH;QACzH,iDAAiD;QACjD,qFAAqF;QACrF,MAAM,eAAe,GAOjB,KAAK,CAAC;QAEV,0BAA0B;QAC1B,OAAO,eAAe,CAAC;IACxB,CAAC;IA/Le,uBAAW,cA+L1B,CAAA;IAaD,aAAa;AACd,CAAC,EA9jBgB,WAAW,2BAAX,WAAW,QA8jB3B","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { oob } from \"@fluidframework/core-utils/internal\";\n\nimport { Tree } from \"./shared-tree/index.js\";\nimport {\n\ttype ImplicitAllowedTypes,\n\ttype ImplicitFieldSchema,\n\ttype InsertableObjectFromSchemaRecord,\n\ttype InsertableTreeNodeFromImplicitAllowedTypes,\n\ttype NodeKind,\n\ttype SchemaFactoryAlpha,\n\ttype ScopedSchemaName,\n\tTreeArrayNode,\n\ttype TreeNode,\n\ttype TreeNodeFromImplicitAllowedTypes,\n\ttype TreeNodeSchemaClass,\n\ttype WithType,\n} from \"./simple-tree/index.js\";\n\n// Future improvement TODOs (ideally to be done before promoting these APIs to `@alpha`):\n// - Custom fields on Table/Row/Column (props pattern from Nick's demo)\n// - Overloads to make Column/Row schema optional when constructing Tables\n// - Record-like type parameters / input parameters?\n// - Move `@system` types into separate / sub scope?\n\n/**\n * Contains types and factories for creating schema to represent dynamic tabular data.\n * @privateRemarks TODO: document in more detail and add `@example`s.\n * @internal\n */\nexport namespace TableSchema {\n\tconst tableSchemaFactorySubScope = \"table\";\n\n\t// #region Column\n\n\t/**\n\t * A column in a table.\n\t * @remarks Implemented by the schema class returned from {@link TableSchema.createColumn}.\n\t * @sealed @internal\n\t */\n\texport interface IColumn {\n\t\t/**\n\t\t * The unique identifier of the column.\n\t\t * @remarks Uniquely identifies the node within the entire tree, not just the table.\n\t\t */\n\t\treadonly id: string;\n\t}\n\n\t/**\n\t * Factory for creating new table column schema.\n\t * @internal\n\t */\n\t// eslint-disable-next-line @typescript-eslint/explicit-function-return-type -- Return type is too complex to be reasonable to specify\n\texport function createColumn<const TInputScope extends string | undefined>(\n\t\tinputSchemaFactory: SchemaFactoryAlpha<TInputScope>,\n\t) {\n\t\tconst schemaFactory = inputSchemaFactory.scopedFactory(tableSchemaFactorySubScope);\n\t\ttype Scope = ScopedSchemaName<TInputScope, typeof tableSchemaFactorySubScope>;\n\n\t\t/**\n\t\t * {@link Column} fields.\n\t\t * @remarks Extracted for re-use in returned type signature defined later in this function.\n\t\t * The implicit typing is intentional.\n\t\t */\n\t\tconst columnFields = {\n\t\t\tid: schemaFactory.identifier,\n\t\t} as const satisfies Record<string, ImplicitFieldSchema>;\n\n\t\t/**\n\t\t * A column in a table.\n\t\t */\n\t\tclass Column extends schemaFactory.object(\"Column\", columnFields) implements IColumn {}\n\n\t\ttype ColumnValueType = TreeNode & IColumn & WithType<ScopedSchemaName<Scope, \"Column\">>;\n\t\ttype ColumnInsertableType = InsertableObjectFromSchemaRecord<typeof columnFields>;\n\n\t\t// Returning SingletonSchema without a type conversion results in TypeScript generating something like `readonly \"__#124291@#brand\": unknown;`\n\t\t// for the private brand field of TreeNode.\n\t\t// This numeric id doesn't seem to be stable over incremental builds, and thus causes diffs in the API extractor reports.\n\t\t// This is avoided by doing this type conversion.\n\t\t// The conversion is done via assignment instead of `as` to get stronger type safety.\n\t\tconst ColumnSchemaType: TreeNodeSchemaClass<\n\t\t\t/* Name */ ScopedSchemaName<Scope, \"Column\">,\n\t\t\t/* Kind */ NodeKind.Object,\n\t\t\t/* TNode */ ColumnValueType,\n\t\t\t/* TInsertable */ object & ColumnInsertableType,\n\t\t\t/* ImplicitlyConstructable */ true,\n\t\t\t/* Info */ typeof columnFields\n\t\t> = Column;\n\n\t\treturn ColumnSchemaType;\n\t}\n\n\t/**\n\t * Base column schema type.\n\t * @sealed @system @internal\n\t */\n\texport type ColumnSchemaBase<TScope extends string | undefined> = ReturnType<\n\t\ttypeof createColumn<TScope>\n\t>;\n\n\t// #endregion\n\n\t// #region Row\n\n\t/**\n\t * A row in a table.\n\t * @remarks Implemented by the schema class returned from {@link TableSchema.createRow}.\n\t * @sealed @internal\n\t */\n\texport interface IRow<\n\t\tTCellSchema extends ImplicitAllowedTypes,\n\t\tTColumnSchema extends ImplicitAllowedTypes,\n\t> {\n\t\t/**\n\t\t * The unique identifier of the row.\n\t\t * @remarks Uniquely identifies the node within the entire tree, not just the table.\n\t\t */\n\t\treadonly id: string;\n\n\t\t/**\n\t\t * Gets the cell in the specified column\n\t\t * @returns The cell if it exists, otherwise undefined.\n\t\t * @privateRemarks TODO: add overload that takes column ID.\n\t\t */\n\t\tgetCell(\n\t\t\tcolumn: TreeNodeFromImplicitAllowedTypes<TColumnSchema>,\n\t\t): TreeNodeFromImplicitAllowedTypes<TCellSchema> | undefined;\n\n\t\t/**\n\t\t * Sets the cell in the specified column.\n\t\t * @remarks To delete a cell, call {@link TableSchema.IRow.deleteCell} instead.\n\t\t * @privateRemarks TODO: add overload that takes column ID.\n\t\t */\n\t\tsetCell(\n\t\t\tcolumn: TreeNodeFromImplicitAllowedTypes<TColumnSchema>,\n\t\t\tvalue: InsertableTreeNodeFromImplicitAllowedTypes<TCellSchema>,\n\t\t): void;\n\n\t\t/**\n\t\t * Deletes the cell in the specified column.\n\t\t * @privateRemarks TODO: add overload that takes column ID.\n\t\t */\n\t\tdeleteCell(column: TreeNodeFromImplicitAllowedTypes<TColumnSchema>): void;\n\t}\n\n\t/**\n\t * Factory for creating new table row schema.\n\t * @privateRemarks TODO: add overloads to make column schema optional.\n\t * @sealed @internal\n\t */\n\t// eslint-disable-next-line @typescript-eslint/explicit-function-return-type -- Return type is too complex to be reasonable to specify\n\texport function createRow<\n\t\tconst TInputScope extends string | undefined,\n\t\tconst TCellSchema extends ImplicitAllowedTypes,\n\t\tconst TColumnSchema extends ColumnSchemaBase<TInputScope> = ColumnSchemaBase<TInputScope>,\n\t>(\n\t\tinputSchemaFactory: SchemaFactoryAlpha<TInputScope>,\n\t\tcellSchema: TCellSchema,\n\t\t_columnSchema: TColumnSchema,\n\t) {\n\t\tconst schemaFactory = inputSchemaFactory.scopedFactory(tableSchemaFactorySubScope);\n\t\ttype Scope = ScopedSchemaName<TInputScope, typeof tableSchemaFactorySubScope>;\n\n\t\ttype CellValueType = TreeNodeFromImplicitAllowedTypes<TCellSchema>;\n\t\ttype CellInsertableType = InsertableTreeNodeFromImplicitAllowedTypes<TCellSchema>;\n\n\t\ttype ColumnValueType = TreeNodeFromImplicitAllowedTypes<TColumnSchema>;\n\n\t\t/**\n\t\t * {@link Row} fields.\n\t\t * @remarks Extracted for re-use in returned type signature defined later in this function.\n\t\t * The implicit typing is intentional.\n\t\t */\n\t\tconst rowFields = {\n\t\t\tid: schemaFactory.identifier,\n\t\t\tcells: schemaFactory.map(\"Row.cells\", cellSchema),\n\t\t} as const satisfies Record<string, ImplicitFieldSchema>;\n\n\t\t/**\n\t\t * The Row schema - this is a map of Cells where the key is the column id\n\t\t */\n\t\tclass Row\n\t\t\textends schemaFactory.object(\"Row\", rowFields)\n\t\t\timplements IRow<TCellSchema, TColumnSchema>\n\t\t{\n\t\t\tpublic getCell(column: ColumnValueType): CellValueType | undefined {\n\t\t\t\treturn this.cells.get(column.id) as CellValueType | undefined;\n\t\t\t}\n\n\t\t\tpublic setCell(column: ColumnValueType, value: CellInsertableType | undefined): void {\n\t\t\t\tthis.cells.set(column.id, value);\n\t\t\t}\n\n\t\t\tpublic deleteCell(column: ColumnValueType): void {\n\t\t\t\tif (!this.cells.has(column.id)) return;\n\t\t\t\tthis.cells.delete(column.id);\n\t\t\t}\n\t\t}\n\n\t\ttype RowValueType = TreeNode &\n\t\t\tIRow<TCellSchema, TColumnSchema> &\n\t\t\tWithType<ScopedSchemaName<Scope, \"Row\">>;\n\t\ttype RowInsertableType = InsertableObjectFromSchemaRecord<typeof rowFields>;\n\n\t\t// Returning SingletonSchema without a type conversion results in TypeScript generating something like `readonly \"__#124291@#brand\": unknown;`\n\t\t// for the private brand field of TreeNode.\n\t\t// This numeric id doesn't seem to be stable over incremental builds, and thus causes diffs in the API extractor reports.\n\t\t// This is avoided by doing this type conversion.\n\t\t// The conversion is done via assignment instead of `as` to get stronger type safety.\n\t\tconst RowSchemaType: TreeNodeSchemaClass<\n\t\t\t/* Name */ ScopedSchemaName<Scope, \"Row\">,\n\t\t\t/* Kind */ NodeKind.Object,\n\t\t\t/* TNode */ RowValueType,\n\t\t\t/* TInsertable */ object & RowInsertableType,\n\t\t\t/* ImplicitlyConstructable */ true,\n\t\t\t/* Info */ typeof rowFields\n\t\t> = Row;\n\n\t\treturn RowSchemaType;\n\t}\n\n\t/**\n\t * Base row schema type.\n\t * @sealed @system @internal\n\t */\n\texport type RowSchemaBase<\n\t\tTScope extends string | undefined,\n\t\tTCellSchema extends ImplicitAllowedTypes,\n\t\tTColumnSchema extends ColumnSchemaBase<TScope> = ColumnSchemaBase<TScope>,\n\t> = ReturnType<typeof createRow<TScope, TCellSchema, TColumnSchema>>;\n\n\t// #endregion\n\n\t// #region Table\n\n\t/**\n\t * A key to uniquely identify a cell in a table.\n\t * @sealed @internal\n\t */\n\texport interface CellKey {\n\t\t/**\n\t\t * {@link TableSchema.IColumn.id} of the containing {@link TableSchema.IColumn}.\n\t\t */\n\t\treadonly columnId: string;\n\n\t\t/**\n\t\t * {@link TableSchema.IRow.id} of the containing {@link TableSchema.IRow}.\n\t\t */\n\t\treadonly rowId: string;\n\t}\n\n\t/**\n\t * {@link TableSchema.ITable.insertColumn} parameters.\n\t * @sealed @internal\n\t */\n\texport interface InsertColumnParameters<TInsertableColumn> {\n\t\t/**\n\t\t * The index at which to insert the new column.\n\t\t * @remarks If not provided, the column will be appended to the end of the table.\n\t\t */\n\t\treadonly index?: number | undefined;\n\n\t\t/**\n\t\t * The column to insert.\n\t\t */\n\t\treadonly column: TInsertableColumn;\n\t}\n\n\t/**\n\t * {@link TableSchema.ITable.insertRows} parameters.\n\t * @sealed @internal\n\t */\n\texport interface InsertRowsParameters<TInsertableRow> {\n\t\t/**\n\t\t * The index at which to insert the new rows.\n\t\t * @remarks If not provided, the rows will be appended to the end of the table.\n\t\t */\n\t\treadonly index?: number | undefined;\n\n\t\t/**\n\t\t * The rows to insert.\n\t\t */\n\t\treadonly rows: TInsertableRow[];\n\t}\n\n\t/**\n\t * {@link TableSchema.ITable.setCell} parameters.\n\t * @sealed @internal\n\t */\n\texport interface SetCellParameters<TInsertableCell> {\n\t\t/**\n\t\t * The key to uniquely identify a cell in a table.\n\t\t */\n\t\treadonly key: CellKey;\n\n\t\t/**\n\t\t * The cell to set.\n\t\t */\n\t\treadonly cell: TInsertableCell;\n\t}\n\n\t/**\n\t * A table.\n\t * @sealed @internal\n\t */\n\texport interface ITable<\n\t\tTCellSchema extends ImplicitAllowedTypes,\n\t\tTColumnSchema extends ImplicitAllowedTypes,\n\t\tTRowSchema extends ImplicitAllowedTypes,\n\t> {\n\t\t/**\n\t\t * The table's columns.\n\t\t */\n\t\treadonly columns: TreeArrayNode<TColumnSchema>;\n\n\t\t/**\n\t\t * The table's rows.\n\t\t */\n\t\treadonly rows: TreeArrayNode<TRowSchema>;\n\n\t\t/**\n\t\t * Gets a table column by its {@link TableSchema.IRow.id}.\n\t\t */\n\t\tgetColumn(id: string): TreeNodeFromImplicitAllowedTypes<TColumnSchema> | undefined;\n\n\t\t/**\n\t\t * Gets a table row by its {@link TableSchema.IRow.id}.\n\t\t */\n\t\tgetRow(id: string): TreeNodeFromImplicitAllowedTypes<TRowSchema> | undefined;\n\n\t\t/**\n\t\t * Gets a cell in the table by column and row IDs.\n\t\t * @param key - A key that uniquely distinguishes a cell in the table, represented as a combination of the column ID and row ID.\n\t\t * @privateRemarks TODO: add overload that takes row and column nodes.\n\t\t */\n\t\tgetCell(key: CellKey): TreeNodeFromImplicitAllowedTypes<TCellSchema> | undefined;\n\n\t\t/**\n\t\t * Inserts a column into the table.\n\t\t * @throws Throws an error if the column is already in the tree, or if the specified index is out of range.\n\t\t */\n\t\tinsertColumn(\n\t\t\tparams: InsertColumnParameters<\n\t\t\t\tInsertableTreeNodeFromImplicitAllowedTypes<TColumnSchema>\n\t\t\t>,\n\t\t): TreeNodeFromImplicitAllowedTypes<TColumnSchema>;\n\n\t\t/**\n\t\t * Inserts 0 or more rows into the table.\n\t\t * @throws Throws an error if any of the rows are already in the tree, or if the specified index is out of range.\n\t\t */\n\t\tinsertRows(\n\t\t\tparams: InsertRowsParameters<InsertableTreeNodeFromImplicitAllowedTypes<TRowSchema>>,\n\t\t): TreeNodeFromImplicitAllowedTypes<TRowSchema>[];\n\n\t\t/**\n\t\t * Sets the cell at the specified location in the table.\n\t\t * @remarks To delete a cell, call {@link TableSchema.ITable.deleteCell} instead.\n\t\t * @privateRemarks TODO: add overload that takes column/row nodes?\n\t\t */\n\t\tsetCell(\n\t\t\tparams: SetCellParameters<InsertableTreeNodeFromImplicitAllowedTypes<TCellSchema>>,\n\t\t): void;\n\n\t\t/**\n\t\t * Removes the specified column from the table.\n\t\t * @remarks Note: this does not remove any cells from the table's rows.\n\t\t * @privateRemarks\n\t\t * TODO:\n\t\t * - Policy for when the column is not in the table.\n\t\t * - Actually remove corresponding cells from table rows.\n\t\t */\n\t\tremoveColumn: (column: TreeNodeFromImplicitAllowedTypes<TColumnSchema>) => void;\n\n\t\t/**\n\t\t * Deletes 0 or more rows from the table.\n\t\t * @privateRemarks TODO: policy for when 1 or more rows are not in the table.\n\t\t */\n\t\tdeleteRows: (rows: readonly TreeNodeFromImplicitAllowedTypes<TRowSchema>[]) => void;\n\n\t\t/**\n\t\t * Deletes all rows from the table.\n\t\t */\n\t\tdeleteAllRows: () => void;\n\n\t\t/**\n\t\t * Deletes the cell at the specified location in the table.\n\t\t * @privateRemarks TODO: add overload that takes column/row nodes?\n\t\t */\n\t\tdeleteCell: (key: CellKey) => void;\n\t}\n\n\t/**\n\t * Factory for creating new table schema.\n\t * @privateRemarks TODO: add overloads to make column/row schema optional.\n\t * @internal\n\t */\n\t// eslint-disable-next-line @typescript-eslint/explicit-function-return-type -- Return type is too complex to be reasonable to specify\n\texport function createTable<\n\t\tconst TInputScope extends string | undefined,\n\t\tconst TCell extends ImplicitAllowedTypes,\n\t\tconst TColumn extends ColumnSchemaBase<TInputScope> = ColumnSchemaBase<TInputScope>,\n\t\tconst TRow extends RowSchemaBase<TInputScope, TCell, TColumn> = RowSchemaBase<\n\t\t\tTInputScope,\n\t\t\tTCell,\n\t\t\tTColumn\n\t\t>,\n\t>(\n\t\tinputSchemaFactory: SchemaFactoryAlpha<TInputScope>,\n\t\t_cellSchema: TCell,\n\t\tcolumnSchema: TColumn,\n\t\trowSchema: TRow,\n\t) {\n\t\tconst schemaFactory = inputSchemaFactory.scopedFactory(tableSchemaFactorySubScope);\n\t\ttype Scope = ScopedSchemaName<TInputScope, typeof tableSchemaFactorySubScope>;\n\n\t\ttype CellValueType = TreeNodeFromImplicitAllowedTypes<TCell>;\n\t\ttype CellInsertableType = InsertableTreeNodeFromImplicitAllowedTypes<TCell>;\n\n\t\ttype ColumnValueType = TreeNodeFromImplicitAllowedTypes<TColumn>;\n\t\ttype ColumnInsertableType = InsertableTreeNodeFromImplicitAllowedTypes<TColumn>;\n\n\t\ttype RowValueType = TreeNodeFromImplicitAllowedTypes<TRow>;\n\t\ttype RowInsertableType = InsertableTreeNodeFromImplicitAllowedTypes<TRow>;\n\n\t\t/**\n\t\t * {@link Table} fields.\n\t\t * @remarks Extracted for re-use in returned type signature defined later in this function.\n\t\t * The implicit typing is intentional.\n\t\t */\n\t\tconst tableFields = {\n\t\t\trows: schemaFactory.array(\"Table.rows\", rowSchema),\n\t\t\tcolumns: schemaFactory.array(\"Table.columns\", columnSchema),\n\t\t} as const satisfies Record<string, ImplicitFieldSchema>;\n\n\t\t/**\n\t\t * The Table schema\n\t\t */\n\t\tclass Table\n\t\t\textends schemaFactory.object(\"Table\", tableFields)\n\t\t\timplements ITable<TCell, TColumn, TRow>\n\t\t{\n\t\t\tpublic getColumn(id: string): ColumnValueType | undefined {\n\t\t\t\t// TypeScript is unable to narrow the types correctly here, hence the casts.\n\t\t\t\t// See: https://github.com/microsoft/TypeScript/issues/52144\n\t\t\t\treturn this.columns.find((column) => (column as ColumnValueType).id === id) as\n\t\t\t\t\t| ColumnValueType\n\t\t\t\t\t| undefined;\n\t\t\t}\n\n\t\t\tpublic getRow(id: string): RowValueType | undefined {\n\t\t\t\t// TypeScript is unable to narrow the types correctly here, hence the casts.\n\t\t\t\t// See: https://github.com/microsoft/TypeScript/issues/52144\n\t\t\t\treturn this.rows.find((_row) => (_row as RowValueType).id === id) as\n\t\t\t\t\t| RowValueType\n\t\t\t\t\t| undefined;\n\t\t\t}\n\n\t\t\tpublic getCell(key: CellKey): CellValueType | undefined {\n\t\t\t\tconst { columnId, rowId } = key;\n\t\t\t\tconst row = this.getRow(rowId);\n\t\t\t\tif (row !== undefined) {\n\t\t\t\t\tconst column = this.getColumn(columnId);\n\t\t\t\t\tif (column !== undefined) {\n\t\t\t\t\t\treturn row.getCell(column);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\t// If the cell does not exist return undefined\n\t\t\t\treturn undefined;\n\t\t\t}\n\n\t\t\tpublic insertColumn({\n\t\t\t\tcolumn,\n\t\t\t\tindex,\n\t\t\t}: InsertColumnParameters<ColumnInsertableType>): ColumnValueType {\n\t\t\t\tif (index === undefined) {\n\t\t\t\t\t// TypeScript is unable to narrow the types correctly here, hence the cast.\n\t\t\t\t\t// See: https://github.com/microsoft/TypeScript/issues/52144\n\t\t\t\t\t// eslint-disable-next-line @typescript-eslint/no-explicit-any\n\t\t\t\t\tthis.columns.insertAtEnd(column as any);\n\t\t\t\t} else {\n\t\t\t\t\t// TypeScript is unable to narrow the types correctly here, hence the cast.\n\t\t\t\t\t// See: https://github.com/microsoft/TypeScript/issues/52144\n\t\t\t\t\t// eslint-disable-next-line @typescript-eslint/no-explicit-any\n\t\t\t\t\tthis.columns.insertAt(index, column as any);\n\t\t\t\t}\n\n\t\t\t\t// Inserting the input node into the tree hydrates it, making it usable as a node.\n\t\t\t\treturn column as ColumnValueType;\n\t\t\t}\n\n\t\t\tpublic insertRows({\n\t\t\t\tindex,\n\t\t\t\trows,\n\t\t\t}: InsertRowsParameters<RowInsertableType>): RowValueType[] {\n\t\t\t\tif (index === undefined) {\n\t\t\t\t\t// TypeScript is unable to narrow the types correctly here, hence the cast.\n\t\t\t\t\t// See: https://github.com/microsoft/TypeScript/issues/52144\n\t\t\t\t\t// eslint-disable-next-line @typescript-eslint/no-explicit-any\n\t\t\t\t\tthis.rows.insertAtEnd(TreeArrayNode.spread(rows) as any);\n\t\t\t\t} else {\n\t\t\t\t\t// TypeScript is unable to narrow the types correctly here, hence the cast.\n\t\t\t\t\t// See: https://github.com/microsoft/TypeScript/issues/52144\n\t\t\t\t\t// eslint-disable-next-line @typescript-eslint/no-explicit-any\n\t\t\t\t\tthis.rows.insertAt(index, TreeArrayNode.spread(rows) as any);\n\t\t\t\t}\n\n\t\t\t\t// Inserting the input nodes into the tree hydrates them, making them usable as nodes.\n\t\t\t\treturn rows as unknown as RowValueType[];\n\t\t\t}\n\n\t\t\tpublic setCell({ key, cell }: SetCellParameters<CellInsertableType>): void {\n\t\t\t\tconst { columnId, rowId } = key;\n\t\t\t\tconst row = this.getRow(rowId);\n\t\t\t\tif (row !== undefined) {\n\t\t\t\t\tconst column = this.getColumn(columnId);\n\t\t\t\t\tif (column !== undefined) {\n\t\t\t\t\t\trow.setCell(column, cell);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tpublic removeColumn(column: ColumnValueType): void {\n\t\t\t\tconst index = this.columns.indexOf(column);\n\t\t\t\t// If the column is not in the table, do nothing\n\t\t\t\tif (index === -1) return;\n\t\t\t\tthis.columns.removeAt(index);\n\t\t\t}\n\n\t\t\tpublic deleteRows(rows: readonly RowValueType[]): void {\n\t\t\t\t// If there are no rows to delete, do nothing\n\t\t\t\tif (rows.length === 0) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\t// If there is only one row to delete, delete it\n\t\t\t\tif (rows.length === 1) {\n\t\t\t\t\tconst index = this.rows.indexOf(rows[0] ?? oob());\n\t\t\t\t\tthis.rows.removeAt(index);\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\t// If there are multiple rows to delete, delete them in a transaction\n\t\t\t\t// This is to avoid the performance issues of deleting multiple rows at once\n\t\t\t\tTree.runTransaction(this, () => {\n\t\t\t\t\t// Iterate over the rows and delete them\n\t\t\t\t\tfor (const row of rows) {\n\t\t\t\t\t\tconst index = this.rows.indexOf(row);\n\t\t\t\t\t\tthis.rows.removeAt(index);\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t}\n\n\t\t\tpublic deleteAllRows(): void {\n\t\t\t\tthis.rows.removeRange();\n\t\t\t}\n\n\t\t\tpublic deleteCell(key: CellKey): void {\n\t\t\t\tconst { columnId, rowId } = key;\n\t\t\t\tconst row = this.getRow(rowId);\n\t\t\t\tif (row !== undefined) {\n\t\t\t\t\tconst column = this.getColumn(columnId);\n\t\t\t\t\tif (column !== undefined) {\n\t\t\t\t\t\trow.deleteCell(column);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\ttype TableValueType = TreeNode &\n\t\t\tITable<TCell, TColumn, TRow> &\n\t\t\tWithType<ScopedSchemaName<Scope, \"Table\">>;\n\t\ttype TableInsertableType = InsertableObjectFromSchemaRecord<typeof tableFields>;\n\n\t\t// Returning SingletonSchema without a type conversion results in TypeScript generating something like `readonly \"__#124291@#brand\": unknown;`\n\t\t// for the private brand field of TreeNode.\n\t\t// This numeric id doesn't seem to be stable over incremental builds, and thus causes diffs in the API extractor reports.\n\t\t// This is avoided by doing this type conversion.\n\t\t// The conversion is done via assignment instead of `as` to get stronger type safety.\n\t\tconst TableSchemaType: TreeNodeSchemaClass<\n\t\t\t/* Name */ ScopedSchemaName<Scope, \"Table\">,\n\t\t\t/* Kind */ NodeKind.Object,\n\t\t\t/* TNode */ TableValueType,\n\t\t\t/* TInsertable */ object & TableInsertableType,\n\t\t\t/* ImplicitlyConstructable */ true,\n\t\t\t/* Info */ typeof tableFields\n\t\t> = Table;\n\n\t\t// Return the table schema\n\t\treturn TableSchemaType;\n\t}\n\n\t/**\n\t * Base row schema type.\n\t * @sealed @system @internal\n\t */\n\texport type TableSchemaBase<\n\t\tTScope extends string | undefined,\n\t\tTCell extends ImplicitAllowedTypes,\n\t\tTColumn extends ColumnSchemaBase<TScope> = ColumnSchemaBase<TScope>,\n\t\tTRow extends RowSchemaBase<TScope, TCell, TColumn> = RowSchemaBase<TScope, TCell, TColumn>,\n\t> = ReturnType<typeof createTable<TScope, TCell, TColumn, TRow>>;\n\n\t// #endregion\n}\n"]}
@@ -5,19 +5,19 @@
5
5
  import type { IChannelAttributes, IChannelFactory, IFluidDataStoreRuntime, IChannelServices } from "@fluidframework/datastore-definitions/internal";
6
6
  import type { SharedObjectKind } from "@fluidframework/shared-object-base";
7
7
  import { type ISharedObjectKind } from "@fluidframework/shared-object-base/internal";
8
- import { SharedTree as SharedTreeImpl, type SharedTreeOptions, type SharedTreeOptionsInternal } from "./shared-tree/index.js";
8
+ import { type ISharedTree, type SharedTreeOptions, type SharedTreeOptionsInternal } from "./shared-tree/index.js";
9
9
  import type { ITree } from "./simple-tree/index.js";
10
10
  /**
11
11
  * A channel factory that creates an {@link ITree}.
12
12
  */
13
- export declare class TreeFactory implements IChannelFactory<ITree> {
13
+ export declare class TreeFactory implements IChannelFactory<ISharedTree> {
14
14
  private readonly options;
15
15
  static Type: string;
16
16
  readonly type: string;
17
17
  readonly attributes: IChannelAttributes;
18
18
  constructor(options: SharedTreeOptionsInternal);
19
- load(runtime: IFluidDataStoreRuntime, id: string, services: IChannelServices, channelAttributes: Readonly<IChannelAttributes>): Promise<SharedTreeImpl>;
20
- create(runtime: IFluidDataStoreRuntime, id: string): SharedTreeImpl;
19
+ load(runtime: IFluidDataStoreRuntime, id: string, services: IChannelServices, channelAttributes: Readonly<IChannelAttributes>): Promise<ISharedTree>;
20
+ create(runtime: IFluidDataStoreRuntime, id: string): ISharedTree;
21
21
  }
22
22
  /**
23
23
  * SharedTree is a hierarchical data structure for collaboratively editing strongly typed JSON-like trees
@@ -1 +1 @@
1
- {"version":3,"file":"treeFactory.d.ts","sourceRoot":"","sources":["../src/treeFactory.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EACX,kBAAkB,EAClB,eAAe,EACf,sBAAsB,EACtB,gBAAgB,EAChB,MAAM,gDAAgD,CAAC;AACxD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,oCAAoC,CAAC;AAC3E,OAAO,EACN,KAAK,iBAAiB,EAEtB,MAAM,6CAA6C,CAAC;AAErD,OAAO,EACN,UAAU,IAAI,cAAc,EAC5B,KAAK,iBAAiB,EACtB,KAAK,yBAAyB,EAC9B,MAAM,wBAAwB,CAAC;AAChC,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,wBAAwB,CAAC;AAIpD;;GAEG;AACH,qBAAa,WAAY,YAAW,eAAe,CAAC,KAAK,CAAC;IAMtC,OAAO,CAAC,QAAQ,CAAC,OAAO;IAL3C,OAAc,IAAI,EAAE,MAAM,CAAyB;IACnD,SAAgB,IAAI,EAAE,MAAM,CAAyB;IAErD,SAAgB,UAAU,EAAE,kBAAkB,CAAwB;gBAElC,OAAO,EAAE,yBAAyB;IAEzD,IAAI,CAChB,OAAO,EAAE,sBAAsB,EAC/B,EAAE,EAAE,MAAM,EACV,QAAQ,EAAE,gBAAgB,EAC1B,iBAAiB,EAAE,QAAQ,CAAC,kBAAkB,CAAC,GAC7C,OAAO,CAAC,cAAc,CAAC;IAMnB,MAAM,CAAC,OAAO,EAAE,sBAAsB,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B,CACnC,OAA0B;IAE1B,MAAM,iBAAkB,SAAQ,WAAW;QAC1C;YACC,KAAK,CAAC,OAAO,CAAC,CAAC;QAChB,CAAC;KACD;IACD,OAAO,IAAA,iCAAsB,EAAQ,iBAAiB,CAAC,CAAC;AACzD,CAAC;AATD,oDASC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport type {\n\tIChannelAttributes,\n\tIChannelFactory,\n\tIFluidDataStoreRuntime,\n\tIChannelServices,\n} from \"@fluidframework/datastore-definitions/internal\";\nimport type { SharedObjectKind } from \"@fluidframework/shared-object-base\";\nimport {\n\ttype ISharedObjectKind,\n\tcreateSharedObjectKind,\n} from \"@fluidframework/shared-object-base/internal\";\n\nimport {\n\tSharedTree as SharedTreeImpl,\n\ttype SharedTreeOptions,\n\ttype SharedTreeOptionsInternal,\n} from \"./shared-tree/index.js\";\nimport type { ITree } from \"./simple-tree/index.js\";\n\nimport { SharedTreeFactoryType, SharedTreeAttributes } from \"./sharedTreeAttributes.js\";\n\n/**\n * A channel factory that creates an {@link ITree}.\n */\nexport class TreeFactory implements IChannelFactory<ITree> {\n\tpublic static Type: string = SharedTreeFactoryType;\n\tpublic readonly type: string = SharedTreeFactoryType;\n\n\tpublic readonly attributes: IChannelAttributes = SharedTreeAttributes;\n\n\tpublic constructor(private readonly options: SharedTreeOptionsInternal) {}\n\n\tpublic async load(\n\t\truntime: IFluidDataStoreRuntime,\n\t\tid: string,\n\t\tservices: IChannelServices,\n\t\tchannelAttributes: Readonly<IChannelAttributes>,\n\t): Promise<SharedTreeImpl> {\n\t\tconst tree = new SharedTreeImpl(id, runtime, channelAttributes, this.options);\n\t\tawait tree.load(services);\n\t\treturn tree;\n\t}\n\n\tpublic create(runtime: IFluidDataStoreRuntime, id: string): SharedTreeImpl {\n\t\tconst tree = new SharedTreeImpl(id, runtime, this.attributes, this.options);\n\t\ttree.initializeLocal();\n\t\treturn tree;\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\n * @alpha\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 to opt into extra validation or see if opting out of some optimizations fixes an issue.\n * @example\n * ```typescript\n * import {\n * \tForestType,\n * \tTreeCompressionStrategy,\n * \tconfiguredSharedTree,\n * \ttypeboxValidator,\n * \t// eslint-disable-next-line import/no-internal-modules\n * } from \"@fluidframework/tree/internal\";\n * const SharedTree = configuredSharedTree({\n * \tforest: ForestType.Reference,\n * \tjsonValidator: typeboxValidator,\n * \ttreeEncodeType: TreeCompressionStrategy.Uncompressed,\n * });\n * ```\n * @privateRemarks\n * This should be legacy, but has to be internal due to limitations of API tagging preventing it from being both alpha and alpha+legacy.\n * TODO:\n * Expose Ajv validator for better error message quality somehow.\n * Maybe as part of a test utils or dev-tool package?\n * @internal\n */\nexport function configuredSharedTree(\n\toptions: SharedTreeOptions,\n): ISharedObjectKind<ITree> & SharedObjectKind<ITree> {\n\tclass ConfiguredFactory extends TreeFactory {\n\t\tpublic constructor() {\n\t\t\tsuper(options);\n\t\t}\n\t}\n\treturn createSharedObjectKind<ITree>(ConfiguredFactory);\n}\n"]}
1
+ {"version":3,"file":"treeFactory.js","sourceRoot":"","sources":["../src/treeFactory.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AASH,0EAGqD;AAErD,qDAKgC;AAGhC,uEAAwF;AAExF;;GAEG;AACH,MAAa,WAAW;IAMvB,YAAoC,OAAkC;QAAlC,YAAO,GAAP,OAAO,CAA2B;QAJtD,SAAI,GAAW,+CAAqB,CAAC;QAErC,eAAU,GAAuB,8CAAoB,CAAC;IAEG,CAAC;IAEnE,KAAK,CAAC,IAAI,CAChB,OAA+B,EAC/B,EAAU,EACV,QAA0B,EAC1B,iBAA+C;QAE/C,MAAM,IAAI,GAAG,IAAI,qBAAc,CAAC,EAAE,EAAE,OAAO,EAAE,iBAAiB,EAAE,IAAI,CAAC,OAAO,CAAC,CAAC;QAC9E,MAAM,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;QAC1B,OAAO,IAAI,CAAC;IACb,CAAC;IAEM,MAAM,CAAC,OAA+B,EAAE,EAAU;QACxD,MAAM,IAAI,GAAG,IAAI,qBAAc,CAAC,EAAE,EAAE,OAAO,EAAE,IAAI,CAAC,UAAU,EAAE,IAAI,CAAC,OAAO,CAAC,CAAC;QAC5E,IAAI,CAAC,eAAe,EAAE,CAAC;QACvB,OAAO,IAAI,CAAC;IACb,CAAC;;AAvBF,kCAwBC;AAvBc,gBAAI,GAAW,+CAAqB,AAAhC,CAAiC;AAyBpD;;;;;GAKG;AACU,QAAA,UAAU,GAAG,oBAAoB,CAAC,EAAE,CAAC,CAAC;AAEnD;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,SAAgB,oBAAoB,CACnC,OAA0B;IAE1B,MAAM,iBAAkB,SAAQ,WAAW;QAC1C;YACC,KAAK,CAAC,OAAO,CAAC,CAAC;QAChB,CAAC;KACD;IACD,OAAO,IAAA,iCAAsB,EAAQ,iBAAiB,CAAC,CAAC;AACzD,CAAC;AATD,oDASC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport type {\n\tIChannelAttributes,\n\tIChannelFactory,\n\tIFluidDataStoreRuntime,\n\tIChannelServices,\n} from \"@fluidframework/datastore-definitions/internal\";\nimport type { SharedObjectKind } from \"@fluidframework/shared-object-base\";\nimport {\n\ttype ISharedObjectKind,\n\tcreateSharedObjectKind,\n} from \"@fluidframework/shared-object-base/internal\";\n\nimport {\n\tSharedTree as SharedTreeImpl,\n\ttype ISharedTree,\n\ttype SharedTreeOptions,\n\ttype SharedTreeOptionsInternal,\n} from \"./shared-tree/index.js\";\nimport type { ITree } from \"./simple-tree/index.js\";\n\nimport { SharedTreeFactoryType, SharedTreeAttributes } from \"./sharedTreeAttributes.js\";\n\n/**\n * A channel factory that creates an {@link ITree}.\n */\nexport class TreeFactory implements IChannelFactory<ISharedTree> {\n\tpublic static Type: string = SharedTreeFactoryType;\n\tpublic readonly type: string = SharedTreeFactoryType;\n\n\tpublic readonly attributes: IChannelAttributes = SharedTreeAttributes;\n\n\tpublic constructor(private readonly options: SharedTreeOptionsInternal) {}\n\n\tpublic async load(\n\t\truntime: IFluidDataStoreRuntime,\n\t\tid: string,\n\t\tservices: IChannelServices,\n\t\tchannelAttributes: Readonly<IChannelAttributes>,\n\t): Promise<ISharedTree> {\n\t\tconst tree = new SharedTreeImpl(id, runtime, channelAttributes, this.options);\n\t\tawait tree.load(services);\n\t\treturn tree;\n\t}\n\n\tpublic create(runtime: IFluidDataStoreRuntime, id: string): ISharedTree {\n\t\tconst tree = new SharedTreeImpl(id, runtime, this.attributes, this.options);\n\t\ttree.initializeLocal();\n\t\treturn tree;\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\n * @alpha\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 to opt into extra validation or see if opting out of some optimizations fixes an issue.\n * @example\n * ```typescript\n * import {\n * \tForestType,\n * \tTreeCompressionStrategy,\n * \tconfiguredSharedTree,\n * \ttypeboxValidator,\n * \t// eslint-disable-next-line import/no-internal-modules\n * } from \"@fluidframework/tree/internal\";\n * const SharedTree = configuredSharedTree({\n * \tforest: ForestType.Reference,\n * \tjsonValidator: typeboxValidator,\n * \ttreeEncodeType: TreeCompressionStrategy.Uncompressed,\n * });\n * ```\n * @privateRemarks\n * This should be legacy, but has to be internal due to limitations of API tagging preventing it from being both alpha and alpha+legacy.\n * TODO:\n * Expose Ajv validator for better error message quality somehow.\n * Maybe as part of a test utils or dev-tool package?\n * @internal\n */\nexport function configuredSharedTree(\n\toptions: SharedTreeOptions,\n): ISharedObjectKind<ITree> & SharedObjectKind<ITree> {\n\tclass ConfiguredFactory extends TreeFactory {\n\t\tpublic constructor() {\n\t\t\tsuper(options);\n\t\t}\n\t}\n\treturn createSharedObjectKind<ITree>(ConfiguredFactory);\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"breakable.d.ts","sourceRoot":"","sources":["../../src/util/breakable.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAKH;;GAEG;AACH,qBAAa,SAAS;IAGF,OAAO,CAAC,QAAQ,CAAC,IAAI;IAFxC,OAAO,CAAC,QAAQ,CAAC,CAAQ;gBAEW,IAAI,EAAE,MAAM;IAEhD;;;;OAIG;IACI,GAAG,IAAI,IAAI;IAQlB;;;;OAIG;IACI,KAAK,CAAC,QAAQ,EAAE,KAAK,GAAG,KAAK;IAUpC;;;;OAIG;IACI,aAAa,CAAC,QAAQ,EAAE,OAAO,GAAG,KAAK;IAS9C;;;;;;OAMG;IACI,GAAG,CAAC,OAAO,EAAE,OAAO,EAAE,MAAM,OAAO,GAAG,OAAO;IASpD;;;;;OAKG;IACI,UAAU,IAAI,IAAI;CAIzB;AAED;;;;GAIG;AACH,MAAM,WAAW,aAAa;IAC7B,QAAQ,CAAC,OAAO,EAAE,SAAS,CAAC;CAC5B;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,cAAc,CAC7B,MAAM,SAAS,CAAC,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,OAAO,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,IAAI,EAAE,GAAG,IAAI,EAAE,IAAI,KAAK,MAAM,CAAC,EACtF,IAAI,SAAS,aAAa,EAC1B,IAAI,SAAS,KAAK,EAAE,EACpB,MAAM,EACL,MAAM,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,2BAA2B,CAAC,IAAI,EAAE,MAAM,CAAC,GAAG,MAAM,CAe7E;AAED;;;;;;GAMG;AACH,wBAAgB,aAAa,CAC5B,MAAM,SAAS,C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