@fluidframework/tree 2.70.0 → 2.71.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 (179) hide show
  1. package/CHANGELOG.md +58 -0
  2. package/api-report/tree.alpha.api.md +25 -4
  3. package/api-report/tree.beta.api.md +3 -0
  4. package/api-report/tree.legacy.beta.api.md +3 -0
  5. package/dist/alpha.d.ts +3 -0
  6. package/dist/beta.d.ts +1 -0
  7. package/dist/codec/discriminatedUnions.d.ts +1 -1
  8. package/dist/codec/discriminatedUnions.js +1 -1
  9. package/dist/codec/discriminatedUnions.js.map +1 -1
  10. package/dist/index.d.ts +2 -2
  11. package/dist/index.d.ts.map +1 -1
  12. package/dist/index.js +4 -2
  13. package/dist/index.js.map +1 -1
  14. package/dist/legacy.d.ts +1 -0
  15. package/dist/packageVersion.d.ts +1 -1
  16. package/dist/packageVersion.js +1 -1
  17. package/dist/packageVersion.js.map +1 -1
  18. package/dist/shared-tree/independentView.d.ts +74 -5
  19. package/dist/shared-tree/independentView.d.ts.map +1 -1
  20. package/dist/shared-tree/independentView.js +104 -38
  21. package/dist/shared-tree/independentView.js.map +1 -1
  22. package/dist/shared-tree/index.d.ts +2 -1
  23. package/dist/shared-tree/index.d.ts.map +1 -1
  24. package/dist/shared-tree/index.js +6 -1
  25. package/dist/shared-tree/index.js.map +1 -1
  26. package/dist/shared-tree/sharedTree.d.ts.map +1 -1
  27. package/dist/shared-tree/sharedTree.js +18 -3
  28. package/dist/shared-tree/sharedTree.js.map +1 -1
  29. package/dist/simple-tree/api/schemaFactory.d.ts +2 -2
  30. package/dist/simple-tree/api/schemaFactory.js +2 -2
  31. package/dist/simple-tree/api/schemaFactory.js.map +1 -1
  32. package/dist/simple-tree/api/schemaFactoryRecursive.d.ts.map +1 -1
  33. package/dist/simple-tree/api/schemaFactoryRecursive.js +1 -0
  34. package/dist/simple-tree/api/schemaFactoryRecursive.js.map +1 -1
  35. package/dist/simple-tree/api/schemaFromSimple.d.ts.map +1 -1
  36. package/dist/simple-tree/api/schemaFromSimple.js +9 -5
  37. package/dist/simple-tree/api/schemaFromSimple.js.map +1 -1
  38. package/dist/simple-tree/api/simpleSchemaToJsonSchema.d.ts.map +1 -1
  39. package/dist/simple-tree/api/simpleSchemaToJsonSchema.js +4 -2
  40. package/dist/simple-tree/api/simpleSchemaToJsonSchema.js.map +1 -1
  41. package/dist/simple-tree/api/viewSchemaToSimpleSchema.d.ts +2 -1
  42. package/dist/simple-tree/api/viewSchemaToSimpleSchema.d.ts.map +1 -1
  43. package/dist/simple-tree/api/viewSchemaToSimpleSchema.js +31 -10
  44. package/dist/simple-tree/api/viewSchemaToSimpleSchema.js.map +1 -1
  45. package/dist/simple-tree/core/allowedTypes.d.ts +9 -4
  46. package/dist/simple-tree/core/allowedTypes.d.ts.map +1 -1
  47. package/dist/simple-tree/core/allowedTypes.js +17 -4
  48. package/dist/simple-tree/core/allowedTypes.js.map +1 -1
  49. package/dist/simple-tree/fieldSchema.d.ts +2 -1
  50. package/dist/simple-tree/fieldSchema.d.ts.map +1 -1
  51. package/dist/simple-tree/fieldSchema.js +10 -0
  52. package/dist/simple-tree/fieldSchema.js.map +1 -1
  53. package/dist/simple-tree/index.d.ts +1 -1
  54. package/dist/simple-tree/index.d.ts.map +1 -1
  55. package/dist/simple-tree/index.js.map +1 -1
  56. package/dist/simple-tree/node-kinds/array/arrayNode.d.ts.map +1 -1
  57. package/dist/simple-tree/node-kinds/array/arrayNode.js +6 -0
  58. package/dist/simple-tree/node-kinds/array/arrayNode.js.map +1 -1
  59. package/dist/simple-tree/node-kinds/map/mapNode.d.ts.map +1 -1
  60. package/dist/simple-tree/node-kinds/map/mapNode.js +6 -0
  61. package/dist/simple-tree/node-kinds/map/mapNode.js.map +1 -1
  62. package/dist/simple-tree/node-kinds/object/objectNode.d.ts +17 -0
  63. package/dist/simple-tree/node-kinds/object/objectNode.d.ts.map +1 -1
  64. package/dist/simple-tree/node-kinds/object/objectNode.js +19 -6
  65. package/dist/simple-tree/node-kinds/object/objectNode.js.map +1 -1
  66. package/dist/simple-tree/node-kinds/record/recordNode.d.ts.map +1 -1
  67. package/dist/simple-tree/node-kinds/record/recordNode.js +6 -0
  68. package/dist/simple-tree/node-kinds/record/recordNode.js.map +1 -1
  69. package/dist/simple-tree/node-kinds/record/recordNodeTypes.d.ts +16 -0
  70. package/dist/simple-tree/node-kinds/record/recordNodeTypes.d.ts.map +1 -1
  71. package/dist/simple-tree/node-kinds/record/recordNodeTypes.js.map +1 -1
  72. package/dist/simple-tree/simpleSchema.d.ts +21 -5
  73. package/dist/simple-tree/simpleSchema.d.ts.map +1 -1
  74. package/dist/simple-tree/simpleSchema.js.map +1 -1
  75. package/dist/simple-tree/toStoredSchema.d.ts.map +1 -1
  76. package/dist/simple-tree/toStoredSchema.js +6 -3
  77. package/dist/simple-tree/toStoredSchema.js.map +1 -1
  78. package/dist/util/referenceCounting.d.ts.map +1 -1
  79. package/dist/util/referenceCounting.js +1 -0
  80. package/dist/util/referenceCounting.js.map +1 -1
  81. package/lib/alpha.d.ts +3 -0
  82. package/lib/beta.d.ts +1 -0
  83. package/lib/codec/discriminatedUnions.d.ts +1 -1
  84. package/lib/codec/discriminatedUnions.js +1 -1
  85. package/lib/codec/discriminatedUnions.js.map +1 -1
  86. package/lib/index.d.ts +2 -2
  87. package/lib/index.d.ts.map +1 -1
  88. package/lib/index.js +1 -1
  89. package/lib/index.js.map +1 -1
  90. package/lib/legacy.d.ts +1 -0
  91. package/lib/packageVersion.d.ts +1 -1
  92. package/lib/packageVersion.js +1 -1
  93. package/lib/packageVersion.js.map +1 -1
  94. package/lib/shared-tree/independentView.d.ts +74 -5
  95. package/lib/shared-tree/independentView.d.ts.map +1 -1
  96. package/lib/shared-tree/independentView.js +103 -38
  97. package/lib/shared-tree/independentView.js.map +1 -1
  98. package/lib/shared-tree/index.d.ts +2 -1
  99. package/lib/shared-tree/index.d.ts.map +1 -1
  100. package/lib/shared-tree/index.js +2 -1
  101. package/lib/shared-tree/index.js.map +1 -1
  102. package/lib/shared-tree/sharedTree.d.ts.map +1 -1
  103. package/lib/shared-tree/sharedTree.js +18 -3
  104. package/lib/shared-tree/sharedTree.js.map +1 -1
  105. package/lib/simple-tree/api/schemaFactory.d.ts +2 -2
  106. package/lib/simple-tree/api/schemaFactory.js +2 -2
  107. package/lib/simple-tree/api/schemaFactory.js.map +1 -1
  108. package/lib/simple-tree/api/schemaFactoryRecursive.d.ts.map +1 -1
  109. package/lib/simple-tree/api/schemaFactoryRecursive.js +1 -0
  110. package/lib/simple-tree/api/schemaFactoryRecursive.js.map +1 -1
  111. package/lib/simple-tree/api/schemaFromSimple.d.ts.map +1 -1
  112. package/lib/simple-tree/api/schemaFromSimple.js +9 -5
  113. package/lib/simple-tree/api/schemaFromSimple.js.map +1 -1
  114. package/lib/simple-tree/api/simpleSchemaToJsonSchema.d.ts.map +1 -1
  115. package/lib/simple-tree/api/simpleSchemaToJsonSchema.js +4 -2
  116. package/lib/simple-tree/api/simpleSchemaToJsonSchema.js.map +1 -1
  117. package/lib/simple-tree/api/viewSchemaToSimpleSchema.d.ts +2 -1
  118. package/lib/simple-tree/api/viewSchemaToSimpleSchema.d.ts.map +1 -1
  119. package/lib/simple-tree/api/viewSchemaToSimpleSchema.js +31 -10
  120. package/lib/simple-tree/api/viewSchemaToSimpleSchema.js.map +1 -1
  121. package/lib/simple-tree/core/allowedTypes.d.ts +9 -4
  122. package/lib/simple-tree/core/allowedTypes.d.ts.map +1 -1
  123. package/lib/simple-tree/core/allowedTypes.js +18 -5
  124. package/lib/simple-tree/core/allowedTypes.js.map +1 -1
  125. package/lib/simple-tree/fieldSchema.d.ts +2 -1
  126. package/lib/simple-tree/fieldSchema.d.ts.map +1 -1
  127. package/lib/simple-tree/fieldSchema.js +10 -0
  128. package/lib/simple-tree/fieldSchema.js.map +1 -1
  129. package/lib/simple-tree/index.d.ts +1 -1
  130. package/lib/simple-tree/index.d.ts.map +1 -1
  131. package/lib/simple-tree/index.js.map +1 -1
  132. package/lib/simple-tree/node-kinds/array/arrayNode.d.ts.map +1 -1
  133. package/lib/simple-tree/node-kinds/array/arrayNode.js +7 -1
  134. package/lib/simple-tree/node-kinds/array/arrayNode.js.map +1 -1
  135. package/lib/simple-tree/node-kinds/map/mapNode.d.ts.map +1 -1
  136. package/lib/simple-tree/node-kinds/map/mapNode.js +7 -1
  137. package/lib/simple-tree/node-kinds/map/mapNode.js.map +1 -1
  138. package/lib/simple-tree/node-kinds/object/objectNode.d.ts +17 -0
  139. package/lib/simple-tree/node-kinds/object/objectNode.d.ts.map +1 -1
  140. package/lib/simple-tree/node-kinds/object/objectNode.js +19 -6
  141. package/lib/simple-tree/node-kinds/object/objectNode.js.map +1 -1
  142. package/lib/simple-tree/node-kinds/record/recordNode.d.ts.map +1 -1
  143. package/lib/simple-tree/node-kinds/record/recordNode.js +7 -1
  144. package/lib/simple-tree/node-kinds/record/recordNode.js.map +1 -1
  145. package/lib/simple-tree/node-kinds/record/recordNodeTypes.d.ts +16 -0
  146. package/lib/simple-tree/node-kinds/record/recordNodeTypes.d.ts.map +1 -1
  147. package/lib/simple-tree/node-kinds/record/recordNodeTypes.js.map +1 -1
  148. package/lib/simple-tree/simpleSchema.d.ts +21 -5
  149. package/lib/simple-tree/simpleSchema.d.ts.map +1 -1
  150. package/lib/simple-tree/simpleSchema.js.map +1 -1
  151. package/lib/simple-tree/toStoredSchema.d.ts.map +1 -1
  152. package/lib/simple-tree/toStoredSchema.js +6 -3
  153. package/lib/simple-tree/toStoredSchema.js.map +1 -1
  154. package/lib/util/referenceCounting.d.ts.map +1 -1
  155. package/lib/util/referenceCounting.js +1 -0
  156. package/lib/util/referenceCounting.js.map +1 -1
  157. package/package.json +24 -24
  158. package/src/codec/discriminatedUnions.ts +1 -1
  159. package/src/index.ts +3 -0
  160. package/src/packageVersion.ts +1 -1
  161. package/src/shared-tree/independentView.ts +147 -72
  162. package/src/shared-tree/index.ts +4 -0
  163. package/src/shared-tree/sharedTree.ts +25 -3
  164. package/src/simple-tree/api/schemaFactory.ts +2 -2
  165. package/src/simple-tree/api/schemaFactoryRecursive.ts +2 -0
  166. package/src/simple-tree/api/schemaFromSimple.ts +17 -14
  167. package/src/simple-tree/api/simpleSchemaToJsonSchema.ts +8 -2
  168. package/src/simple-tree/api/viewSchemaToSimpleSchema.ts +44 -8
  169. package/src/simple-tree/core/allowedTypes.ts +26 -13
  170. package/src/simple-tree/fieldSchema.ts +14 -1
  171. package/src/simple-tree/index.ts +1 -0
  172. package/src/simple-tree/node-kinds/array/arrayNode.ts +9 -0
  173. package/src/simple-tree/node-kinds/map/mapNode.ts +9 -0
  174. package/src/simple-tree/node-kinds/object/objectNode.ts +54 -18
  175. package/src/simple-tree/node-kinds/record/recordNode.ts +9 -0
  176. package/src/simple-tree/node-kinds/record/recordNodeTypes.ts +16 -0
  177. package/src/simple-tree/simpleSchema.ts +22 -5
  178. package/src/simple-tree/toStoredSchema.ts +12 -3
  179. package/src/util/referenceCounting.ts +1 -0
@@ -1 +1 @@
1
- {"version":3,"file":"toStoredSchema.js","sourceRoot":"","sources":["../../src/simple-tree/toStoredSchema.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,kEAA4E;AAC5E,uEAAsE;AAEtE,+CAY0B;AAC1B,4DAA+E;AAC/E,+CAAyF;AAEzF,8CAQyB;AACzB,qDAK0B;AAE1B,6DAAuD;AAEvD,MAAM,iBAAiB,GAAG,IAAI,OAAO,EAGlC,CAAC;AAES,QAAA,wCAAwC,GAAkC;IACtF,aAAa,EAAE,GAAG,EAAE,CAAC,KAAK;CAC1B,CAAC;AAEW,QAAA,uCAAuC,GAAkC;IACrF,aAAa,EAAE,GAAG,EAAE,CAAC,IAAI;CACzB,CAAC;AAEF;;;;GAIG;AACH,SAAgB,eAAe,CAAC,IAAyB;IACxD,OAAO,cAAc,CAAC,IAAI,EAAE,gDAAwC,CAAC,CAAC;AACvE,CAAC;AAFD,0CAEC;AAED;;GAEG;AACH,SAAgB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ACL,iBAAiB;KACjB,CAAC;IACF,MAAM,MAAM,GAAG,IAAI,GAAG,CAAC,CAAC,CAAC,mBAAQ,EAAE,KAAK,CAAC,CAAC,CAAC,CAAC;IAC5C,OAAO,IAAI,iCAAsB,CAAC,MAAM,EAAE,iBAAiB,CAAC,CAAC;AAC9D,CAAC;AAXD,sDAWC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { unreachableCase, fail } from \"@fluidframework/core-utils/internal\";\nimport { UsageError } from \"@fluidframework/telemetry-utils/internal\";\n\nimport {\n\tEmptyKey,\n\tLeafNodeStoredSchema,\n\tMapNodeStoredSchema,\n\tObjectNodeStoredSchema,\n\ttype FieldKey,\n\ttype FieldKindIdentifier,\n\ttype TreeFieldStoredSchema,\n\ttype TreeNodeSchemaIdentifier,\n\ttype TreeNodeStoredSchema,\n\ttype TreeStoredSchema,\n\ttype TreeTypeSet,\n} from \"../core/index.js\";\nimport { FieldKinds, type FlexFieldKind } from \"../feature-libraries/index.js\";\nimport { brand, getOrCreate, type JsonCompatibleReadOnlyObject } from \"../util/index.js\";\n\nimport {\n\tallowedTypeFilter,\n\tconvertAllowedTypes,\n\tgetTreeNodeSchemaPrivateData,\n\tisClassBasedSchema,\n\tNodeKind,\n\ttype SimpleNodeSchemaBase,\n\ttype StoredSchemaGenerationOptions,\n} from \"./core/index.js\";\nimport {\n\tFieldKind,\n\tFieldSchemaAlpha,\n\tnormalizeFieldSchema,\n\ttype ImplicitFieldSchema,\n} from \"./fieldSchema.js\";\nimport type { SimpleFieldSchema, SimpleNodeSchema } from \"./simpleSchema.js\";\nimport { walkFieldSchema } from \"./walkFieldSchema.js\";\n\nconst viewToStoredCache = new WeakMap<\n\tStoredSchemaGenerationOptions,\n\tWeakMap<ImplicitFieldSchema, TreeStoredSchema>\n>();\n\nexport const restrictiveStoredSchemaGenerationOptions: StoredSchemaGenerationOptions = {\n\tincludeStaged: () => false,\n};\n\nexport const permissiveStoredSchemaGenerationOptions: StoredSchemaGenerationOptions = {\n\tincludeStaged: () => true,\n};\n\n/**\n * Converts a {@link ImplicitFieldSchema} into a {@link TreeStoredSchema} for use in schema upgrades.\n *\n * TODO: once upgrades are more flexible, this should take in more options, including the old schema and specific upgrades to enable.\n */\nexport function toUpgradeSchema(root: ImplicitFieldSchema): TreeStoredSchema {\n\treturn toStoredSchema(root, restrictiveStoredSchemaGenerationOptions);\n}\n\n/**\n * Converts a {@link ImplicitFieldSchema} into a {@link TreeStoredSchema} for use as initial document schema.\n */\nexport function toInitialSchema(root: ImplicitFieldSchema): TreeStoredSchema {\n\treturn toStoredSchema(root, restrictiveStoredSchemaGenerationOptions);\n}\n\n/**\n * Converts a {@link ImplicitFieldSchema} into a {@link TreeStoredSchema} to used for unhydrated nodes.\n * @remarks\n * This allows as much as possible, relying on further validation when inserting the content.\n *\n * TODO: this should get additional options to enable support for unknown optional fields.\n */\nexport const toUnhydratedSchema = permissiveStoredSchemaGenerationOptions;\n\n/**\n * Converts a {@link ImplicitFieldSchema} into a {@link TreeStoredSchema}.\n *\n * @privateRemarks\n * TODO:#38722 When runtime schema upgrades are implemented, this will need to be updated to check if\n * a staged allowed type has been upgraded and if so, include it in the conversion.\n *\n * @throws\n * Throws a `UsageError` if multiple schemas are encountered with the same identifier.\n */\nexport function toStoredSchema(\n\troot: ImplicitFieldSchema,\n\toptions: StoredSchemaGenerationOptions,\n): TreeStoredSchema {\n\tconst cache = getOrCreate(viewToStoredCache, options, () => new WeakMap());\n\treturn getOrCreate(cache, root, () => {\n\t\tconst normalized = normalizeFieldSchema(root);\n\t\tconst nodeSchema: Map<TreeNodeSchemaIdentifier, TreeNodeStoredSchema> = new Map();\n\t\twalkFieldSchema(normalized, {\n\t\t\tnode(schema) {\n\t\t\t\tif (nodeSchema.has(brand(schema.identifier))) {\n\t\t\t\t\t// Use JSON.stringify to quote and escape identifier string.\n\t\t\t\t\tthrow new UsageError(\n\t\t\t\t\t\t`Multiple schema encountered with the identifier ${JSON.stringify(\n\t\t\t\t\t\t\tschema.identifier,\n\t\t\t\t\t\t)}. Remove or rename them to avoid the collision.`,\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t\tnodeSchema.set(\n\t\t\t\t\tbrand(schema.identifier),\n\t\t\t\t\tgetStoredSchema(\n\t\t\t\t\t\tschema as SimpleNodeSchemaBase<NodeKind> as SimpleNodeSchema,\n\t\t\t\t\t\toptions,\n\t\t\t\t\t),\n\t\t\t\t);\n\t\t\t},\n\t\t\tallowedTypeFilter: (allowedType) => allowedTypeFilter(allowedType, options),\n\t\t});\n\n\t\tconst result: TreeStoredSchema = {\n\t\t\tnodeSchema,\n\t\t\trootFieldSchema: convertField(normalized, options),\n\t\t};\n\t\treturn result;\n\t});\n}\n\n/**\n * Normalizes an {@link ImplicitFieldSchema} into a {@link TreeFieldSchema}.\n */\nexport function convertField(\n\tschema: SimpleFieldSchema | FieldSchemaAlpha,\n\toptions: StoredSchemaGenerationOptions,\n): TreeFieldStoredSchema {\n\tconst kind: FieldKindIdentifier =\n\t\tconvertFieldKind.get(schema.kind)?.identifier ?? fail(0xae3 /* Invalid field kind */);\n\tlet types: TreeTypeSet;\n\t// eslint-disable-next-line unicorn/prefer-ternary\n\tif (schema instanceof FieldSchemaAlpha) {\n\t\ttypes = convertAllowedTypes(schema.allowedTypes, options);\n\t} else {\n\t\ttypes = schema.allowedTypesIdentifiers as TreeTypeSet;\n\t}\n\treturn { kind, types, persistedMetadata: schema.persistedMetadata };\n}\n\n/**\n * A map that converts {@link FieldKind} to {@link FlexFieldKind}.\n */\nexport const convertFieldKind: ReadonlyMap<FieldKind, FlexFieldKind> = new Map<\n\tFieldKind,\n\tFlexFieldKind\n>([\n\t[FieldKind.Optional, FieldKinds.optional],\n\t[FieldKind.Required, FieldKinds.required],\n\t[FieldKind.Identifier, FieldKinds.identifier],\n]);\n\n/**\n * Converts a {@link TreeNodeSchema} into a {@link TreeNodeStoredSchema}.\n * @privateRemarks\n * TODO: Persist node metadata once schema FormatV2 is supported.\n */\nexport function getStoredSchema(\n\tschema: SimpleNodeSchema,\n\toptions: StoredSchemaGenerationOptions,\n): TreeNodeStoredSchema {\n\tif (isClassBasedSchema(schema)) {\n\t\treturn getTreeNodeSchemaPrivateData(schema).toStored(options);\n\t}\n\tconst kind = schema.kind;\n\tswitch (kind) {\n\t\tcase NodeKind.Leaf: {\n\t\t\treturn new LeafNodeStoredSchema(schema.leafKind);\n\t\t}\n\t\tcase NodeKind.Map:\n\t\tcase NodeKind.Record: {\n\t\t\tconst types = schema.allowedTypesIdentifiers as TreeTypeSet;\n\t\t\treturn new MapNodeStoredSchema(\n\t\t\t\t{\n\t\t\t\t\tkind: FieldKinds.optional.identifier,\n\t\t\t\t\ttypes,\n\t\t\t\t\tpersistedMetadata: schema.persistedMetadata,\n\t\t\t\t},\n\t\t\t\t// TODO: Find a way to avoid injecting persistedMetadata twice in these constructor calls.\n\t\t\t\tschema.persistedMetadata,\n\t\t\t);\n\t\t}\n\t\tcase NodeKind.Array: {\n\t\t\tconst types = schema.allowedTypesIdentifiers as TreeTypeSet;\n\t\t\treturn arrayNodeStoredSchema(types, schema.persistedMetadata);\n\t\t}\n\t\tcase NodeKind.Object: {\n\t\t\tconst fields: Map<FieldKey, TreeFieldStoredSchema> = new Map();\n\t\t\tfor (const fieldSchema of schema.fields.values()) {\n\t\t\t\tfields.set(brand(fieldSchema.storedKey), convertField(fieldSchema, options));\n\t\t\t}\n\t\t\treturn new ObjectNodeStoredSchema(fields, schema.persistedMetadata);\n\t\t}\n\t\tdefault: {\n\t\t\tunreachableCase(kind);\n\t\t}\n\t}\n}\n\nexport function arrayNodeStoredSchema(\n\ttypes: TreeTypeSet,\n\tpersistedMetadata: JsonCompatibleReadOnlyObject | undefined,\n): ObjectNodeStoredSchema {\n\tconst field = {\n\t\tkind: FieldKinds.sequence.identifier,\n\t\ttypes,\n\t\tpersistedMetadata,\n\t};\n\tconst fields = new Map([[EmptyKey, field]]);\n\treturn new ObjectNodeStoredSchema(fields, persistedMetadata);\n}\n"]}
1
+ {"version":3,"file":"toStoredSchema.js","sourceRoot":"","sources":["../../src/simple-tree/toStoredSchema.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,kEAA4E;AAC5E,uEAAsE;AAEtE,+CAY0B;AAC1B,4DAA+E;AAC/E,+CAAyF;AAEzF,8CAQyB;AACzB,qDAK0B;AAE1B,6DAAuD;AAEvD,MAAM,iBAAiB,GAAG,IAAI,OAAO,EAGlC,CAAC;AAES,QAAA,wCAAwC,GAAkC;IACtF,aAAa,EAAE,GAAG,EAAE,CAAC,KAAK;CAC1B,CAAC;AAEW,QAAA,uCAAuC,GAAkC;IACrF,aAAa,EAAE,GAAG,EAAE,CAAC,IAAI;CACzB,CAAC;AAEF;;;;GAIG;AACH,SAAgB,eAAe,CAAC,IAAyB;IACxD,OAAO,cAAc,CAAC,IAAI,EAAE,gDAAwC,CAAC,CAAC;AACvE,CAAC;AAFD,0CAEC;AAED;;GAEG;AACH,SAAgB,eAAe,CAAC,IAAyB;IACxD,OAAO,cAAc,CAAC,IAAI,EAAE,gDAAwC,CAAC,CAAC;AACvE,CAAC;AAFD,0CAEC;AAED;;;;;;GAMG;AACU,QAAA,kBAAkB,GAAG,+CAAuC,CAAC;AAE1E;;;;;;;;;GASG;AACH,SAAgB,cAAc,CAC7B,IAAyB,EACzB,OAAsC;IAEtC,MAAM,KAAK,GAAG,IAAA,sBAAW,EAAC,iBAAiB,EAAE,OAAO,EAAE,GAAG,EAAE,CAAC,IAAI,OAAO,EAAE,CAAC,CAAC;IAC3E,OAAO,IAAA,sBAAW,EAAC,KAAK,EAAE,IAAI,EAAE,GAAG,EAAE;QACpC,MAAM,UAAU,GAAG,IAAA,qCAAoB,EAAC,IAAI,CAAC,CAAC;QAC9C,MAAM,UAAU,GAAwD,IAAI,GAAG,EAAE,CAAC;QAClF,IAAA,oCAAe,EAAC,UAAU,EAAE;YAC3B,IAAI,CAAC,MAAM;gBACV,IAA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C;YACrB,MAAM,uBAAuB,GAAwB,IAAI,GAAG,CAC3D,MAAM,CAAC,kBAAkB,CAAC,IAAI,EAAE,CAChC,CAAC;YACF,MAAM,KAAK,GAAG,uBAAsC,CAAC;YACrD,OAAO,qBAAqB,CAAC,KAAK,EAAE,MAAM,CAAC,iBAAiB,CAAC,CAAC;QAC/D,CAAC;QACD,KAAK,mBAAQ,CAAC,MAAM,CAAC,CAAC,CAAC;YACtB,MAAM,MAAM,GAAyC,IAAI,GAAG,EAAE,CAAC;YAC/D,KAAK,MAAM,WAAW,IAAI,MAAM,CAAC,MAAM,CAAC,MAAM,EAAE,EAAE,CAAC;gBAClD,MAAM,CAAC,GAAG,CAAC,IAAA,gBAAK,EAAC,WAAW,CAAC,SAAS,CAAC,EAAE,YAAY,CAAC,WAAW,EAAE,OAAO,CAAC,CAAC,CAAC;YAC9E,CAAC;YACD,OAAO,IAAI,iCAAsB,CAAC,MAAM,EAAE,MAAM,CAAC,iBAAiB,CAAC,CAAC;QACrE,CAAC;QACD,OAAO,CAAC,CAAC,CAAC;YACT,IAAA,0BAAe,EAAC,IAAI,CAAC,CAAC;QACvB,CAAC;IACF,CAAC;AACF,CAAC;AA9CD,0CA8CC;AAED,SAAgB,qBAAqB,CACpC,KAAkB,EAClB,iBAA2D;IAE3D,MAAM,KAAK,GAAG;QACb,IAAI,EAAE,qBAAU,CAAC,QAAQ,CAAC,UAAU;QACpC,KAAK;QACL,iBAAiB;KACjB,CAAC;IACF,MAAM,MAAM,GAAG,IAAI,GAAG,CAAC,CAAC,CAAC,mBAAQ,EAAE,KAAK,CAAC,CAAC,CAAC,CAAC;IAC5C,OAAO,IAAI,iCAAsB,CAAC,MAAM,EAAE,iBAAiB,CAAC,CAAC;AAC9D,CAAC;AAXD,sDAWC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { unreachableCase, fail } from \"@fluidframework/core-utils/internal\";\nimport { UsageError } from \"@fluidframework/telemetry-utils/internal\";\n\nimport {\n\tEmptyKey,\n\tLeafNodeStoredSchema,\n\tMapNodeStoredSchema,\n\tObjectNodeStoredSchema,\n\ttype FieldKey,\n\ttype FieldKindIdentifier,\n\ttype TreeFieldStoredSchema,\n\ttype TreeNodeSchemaIdentifier,\n\ttype TreeNodeStoredSchema,\n\ttype TreeStoredSchema,\n\ttype TreeTypeSet,\n} from \"../core/index.js\";\nimport { FieldKinds, type FlexFieldKind } from \"../feature-libraries/index.js\";\nimport { brand, getOrCreate, type JsonCompatibleReadOnlyObject } from \"../util/index.js\";\n\nimport {\n\tallowedTypeFilter,\n\tconvertAllowedTypes,\n\tgetTreeNodeSchemaPrivateData,\n\tisClassBasedSchema,\n\tNodeKind,\n\ttype SimpleNodeSchemaBase,\n\ttype StoredSchemaGenerationOptions,\n} from \"./core/index.js\";\nimport {\n\tFieldKind,\n\tFieldSchemaAlpha,\n\tnormalizeFieldSchema,\n\ttype ImplicitFieldSchema,\n} from \"./fieldSchema.js\";\nimport type { SimpleFieldSchema, SimpleNodeSchema } from \"./simpleSchema.js\";\nimport { walkFieldSchema } from \"./walkFieldSchema.js\";\n\nconst viewToStoredCache = new WeakMap<\n\tStoredSchemaGenerationOptions,\n\tWeakMap<ImplicitFieldSchema, TreeStoredSchema>\n>();\n\nexport const restrictiveStoredSchemaGenerationOptions: StoredSchemaGenerationOptions = {\n\tincludeStaged: () => false,\n};\n\nexport const permissiveStoredSchemaGenerationOptions: StoredSchemaGenerationOptions = {\n\tincludeStaged: () => true,\n};\n\n/**\n * Converts a {@link ImplicitFieldSchema} into a {@link TreeStoredSchema} for use in schema upgrades.\n *\n * TODO: once upgrades are more flexible, this should take in more options, including the old schema and specific upgrades to enable.\n */\nexport function toUpgradeSchema(root: ImplicitFieldSchema): TreeStoredSchema {\n\treturn toStoredSchema(root, restrictiveStoredSchemaGenerationOptions);\n}\n\n/**\n * Converts a {@link ImplicitFieldSchema} into a {@link TreeStoredSchema} for use as initial document schema.\n */\nexport function toInitialSchema(root: ImplicitFieldSchema): TreeStoredSchema {\n\treturn toStoredSchema(root, restrictiveStoredSchemaGenerationOptions);\n}\n\n/**\n * Converts a {@link ImplicitFieldSchema} into a {@link TreeStoredSchema} to used for unhydrated nodes.\n * @remarks\n * This allows as much as possible, relying on further validation when inserting the content.\n *\n * TODO: this should get additional options to enable support for unknown optional fields.\n */\nexport const toUnhydratedSchema = permissiveStoredSchemaGenerationOptions;\n\n/**\n * Converts a {@link ImplicitFieldSchema} into a {@link TreeStoredSchema}.\n *\n * @privateRemarks\n * TODO:#38722 When runtime schema upgrades are implemented, this will need to be updated to check if\n * a staged allowed type has been upgraded and if so, include it in the conversion.\n *\n * @throws\n * Throws a `UsageError` if multiple schemas are encountered with the same identifier.\n */\nexport function toStoredSchema(\n\troot: ImplicitFieldSchema,\n\toptions: StoredSchemaGenerationOptions,\n): TreeStoredSchema {\n\tconst cache = getOrCreate(viewToStoredCache, options, () => new WeakMap());\n\treturn getOrCreate(cache, root, () => {\n\t\tconst normalized = normalizeFieldSchema(root);\n\t\tconst nodeSchema: Map<TreeNodeSchemaIdentifier, TreeNodeStoredSchema> = new Map();\n\t\twalkFieldSchema(normalized, {\n\t\t\tnode(schema) {\n\t\t\t\tif (nodeSchema.has(brand(schema.identifier))) {\n\t\t\t\t\t// Use JSON.stringify to quote and escape identifier string.\n\t\t\t\t\tthrow new UsageError(\n\t\t\t\t\t\t`Multiple schema encountered with the identifier ${JSON.stringify(\n\t\t\t\t\t\t\tschema.identifier,\n\t\t\t\t\t\t)}. Remove or rename them to avoid the collision.`,\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t\tnodeSchema.set(\n\t\t\t\t\tbrand(schema.identifier),\n\t\t\t\t\tgetStoredSchema(\n\t\t\t\t\t\tschema as SimpleNodeSchemaBase<NodeKind> as SimpleNodeSchema,\n\t\t\t\t\t\toptions,\n\t\t\t\t\t),\n\t\t\t\t);\n\t\t\t},\n\t\t\tallowedTypeFilter: (allowedType) => allowedTypeFilter(allowedType, options),\n\t\t});\n\n\t\tconst result: TreeStoredSchema = {\n\t\t\tnodeSchema,\n\t\t\trootFieldSchema: convertField(normalized, options),\n\t\t};\n\t\treturn result;\n\t});\n}\n\n/**\n * Normalizes an {@link ImplicitFieldSchema} into a {@link TreeFieldSchema}.\n */\nexport function convertField(\n\tschema: SimpleFieldSchema | FieldSchemaAlpha,\n\toptions: StoredSchemaGenerationOptions,\n): TreeFieldStoredSchema {\n\tconst kind: FieldKindIdentifier =\n\t\tconvertFieldKind.get(schema.kind)?.identifier ?? fail(0xae3 /* Invalid field kind */);\n\tlet types: TreeTypeSet;\n\t// eslint-disable-next-line unicorn/prefer-ternary\n\tif (schema instanceof FieldSchemaAlpha) {\n\t\ttypes = convertAllowedTypes(schema.allowedTypes, options);\n\t} else {\n\t\tconst allowedTypesIdentifiers: ReadonlySet<string> = new Set(\n\t\t\tschema.simpleAllowedTypes.keys(),\n\t\t);\n\t\ttypes = allowedTypesIdentifiers as TreeTypeSet;\n\t}\n\treturn { kind, types, persistedMetadata: schema.persistedMetadata };\n}\n\n/**\n * A map that converts {@link FieldKind} to {@link FlexFieldKind}.\n */\nexport const convertFieldKind: ReadonlyMap<FieldKind, FlexFieldKind> = new Map<\n\tFieldKind,\n\tFlexFieldKind\n>([\n\t[FieldKind.Optional, FieldKinds.optional],\n\t[FieldKind.Required, FieldKinds.required],\n\t[FieldKind.Identifier, FieldKinds.identifier],\n]);\n\n/**\n * Converts a {@link TreeNodeSchema} into a {@link TreeNodeStoredSchema}.\n * @privateRemarks\n * TODO: Persist node metadata once schema FormatV2 is supported.\n */\nexport function getStoredSchema(\n\tschema: SimpleNodeSchema,\n\toptions: StoredSchemaGenerationOptions,\n): TreeNodeStoredSchema {\n\tif (isClassBasedSchema(schema)) {\n\t\treturn getTreeNodeSchemaPrivateData(schema).toStored(options);\n\t}\n\tconst kind = schema.kind;\n\tswitch (kind) {\n\t\tcase NodeKind.Leaf: {\n\t\t\treturn new LeafNodeStoredSchema(schema.leafKind);\n\t\t}\n\t\tcase NodeKind.Map:\n\t\tcase NodeKind.Record: {\n\t\t\tconst allowedTypesIdentifiers: ReadonlySet<string> = new Set(\n\t\t\t\tschema.simpleAllowedTypes.keys(),\n\t\t\t);\n\t\t\tconst types = allowedTypesIdentifiers as TreeTypeSet;\n\t\t\treturn new MapNodeStoredSchema(\n\t\t\t\t{\n\t\t\t\t\tkind: FieldKinds.optional.identifier,\n\t\t\t\t\ttypes,\n\t\t\t\t\tpersistedMetadata: schema.persistedMetadata,\n\t\t\t\t},\n\t\t\t\t// TODO: Find a way to avoid injecting persistedMetadata twice in these constructor calls.\n\t\t\t\tschema.persistedMetadata,\n\t\t\t);\n\t\t}\n\t\tcase NodeKind.Array: {\n\t\t\tconst allowedTypesIdentifiers: ReadonlySet<string> = new Set(\n\t\t\t\tschema.simpleAllowedTypes.keys(),\n\t\t\t);\n\t\t\tconst types = allowedTypesIdentifiers as TreeTypeSet;\n\t\t\treturn arrayNodeStoredSchema(types, schema.persistedMetadata);\n\t\t}\n\t\tcase NodeKind.Object: {\n\t\t\tconst fields: Map<FieldKey, TreeFieldStoredSchema> = new Map();\n\t\t\tfor (const fieldSchema of schema.fields.values()) {\n\t\t\t\tfields.set(brand(fieldSchema.storedKey), convertField(fieldSchema, options));\n\t\t\t}\n\t\t\treturn new ObjectNodeStoredSchema(fields, schema.persistedMetadata);\n\t\t}\n\t\tdefault: {\n\t\t\tunreachableCase(kind);\n\t\t}\n\t}\n}\n\nexport function arrayNodeStoredSchema(\n\ttypes: TreeTypeSet,\n\tpersistedMetadata: JsonCompatibleReadOnlyObject | undefined,\n): ObjectNodeStoredSchema {\n\tconst field = {\n\t\tkind: FieldKinds.sequence.identifier,\n\t\ttypes,\n\t\tpersistedMetadata,\n\t};\n\tconst fields = new Map([[EmptyKey, field]]);\n\treturn new ObjectNodeStoredSchema(fields, persistedMetadata);\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"referenceCounting.d.ts","sourceRoot":"","sources":["../../src/util/referenceCounting.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAIH;;;;;;GAMG;AACH,MAAM,WAAW,gBAAgB;IAChC;;;;;OAKG;IACH,cAAc,IAAI,IAAI,CAAC;IACvB;;;;OAIG;IACH,gBAAgB,IAAI,IAAI,CAAC;IAEzB;;;;OAIG;IACH,QAAQ,IAAI,OAAO,CAAC;CACpB;AAED;;GAEG;AACH,8BAAsB,oBAAqB,YAAW,gBAAgB;IAC/C,OAAO,CAAC,QAAQ;IAAtC,SAAS,aAAqB,QAAQ,GAAE,MAAU;IAE3C,cAAc,CAAC,KAAK,SAAI,GAAG,IAAI;IAI/B,gBAAgB,CAAC,KAAK,SAAI,GAAG,IAAI;IAQjC,QAAQ,IAAI,OAAO;IAInB,cAAc,IAAI,OAAO;IAIhC;;OAEG;IACH,SAAS,CAAC,QAAQ,CAAC,cAAc,IAAI,IAAI;CACzC"}
1
+ {"version":3,"file":"referenceCounting.d.ts","sourceRoot":"","sources":["../../src/util/referenceCounting.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAIH;;;;;;GAMG;AACH,MAAM,WAAW,gBAAgB;IAChC;;;;;OAKG;IACH,cAAc,IAAI,IAAI,CAAC;IACvB;;;;OAIG;IACH,gBAAgB,IAAI,IAAI,CAAC;IAEzB;;;;OAIG;IACH,QAAQ,IAAI,OAAO,CAAC;CACpB;AAED;;GAEG;AACH,8BAAsB,oBAAqB,YAAW,gBAAgB;IAE/C,OAAO,CAAC,QAAQ;IAAtC,SAAS,aAAqB,QAAQ,GAAE,MAAU;IAE3C,cAAc,CAAC,KAAK,SAAI,GAAG,IAAI;IAI/B,gBAAgB,CAAC,KAAK,SAAI,GAAG,IAAI;IAQjC,QAAQ,IAAI,OAAO;IAInB,cAAc,IAAI,OAAO;IAIhC;;OAEG;IACH,SAAS,CAAC,QAAQ,CAAC,cAAc,IAAI,IAAI;CACzC"}
@@ -10,6 +10,7 @@ const internal_1 = require("@fluidframework/core-utils/internal");
10
10
  * Base class to assist with implementing ReferenceCounted.
11
11
  */
12
12
  class ReferenceCountedBase {
13
+ // eslint-disable-next-line @typescript-eslint/prefer-readonly -- false positive; modified in multiple places
13
14
  constructor(refCount = 1) {
14
15
  this.refCount = refCount;
15
16
  }
@@ -1 +1 @@
1
- {"version":3,"file":"referenceCounting.js","sourceRoot":"","sources":["../../src/util/referenceCounting.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,kEAA6D;AAgC7D;;GAEG;AACH,MAAsB,oBAAoB;IACzC,YAA8B,WAAmB,CAAC;QAApB,aAAQ,GAAR,QAAQ,CAAY;IAAG,CAAC;IAE/C,cAAc,CAAC,KAAK,GAAG,CAAC;QAC9B,IAAI,CAAC,QAAQ,IAAI,KAAK,CAAC;IACxB,CAAC;IAEM,gBAAgB,CAAC,KAAK,GAAG,CAAC;QAChC,IAAI,CAAC,QAAQ,IAAI,KAAK,CAAC;QACvB,IAAA,iBAAM,EAAC,IAAI,CAAC,QAAQ,IAAI,CAAC,EAAE,KAAK,CAAC,wBAAwB,CAAC,CAAC;QAC3D,IAAI,IAAI,CAAC,QAAQ,KAAK,CAAC,EAAE,CAAC;YACzB,IAAI,CAAC,cAAc,EAAE,CAAC;QACvB,CAAC;IACF,CAAC;IAEM,QAAQ;QACd,OAAO,IAAI,CAAC,QAAQ,GAAG,CAAC,CAAC;IAC1B,CAAC;IAEM,cAAc;QACpB,OAAO,IAAI,CAAC,QAAQ,KAAK,CAAC,CAAC;IAC5B,CAAC;CAMD;AA3BD,oDA2BC","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\";\n\n/**\n * An object which counts the number of users / references to it.\n * @remarks\n * This implements the {@link https://en.wikipedia.org/wiki/Reference_counting | Reference counting} pattern.\n * Getting the reference count correct is difficult in TypeScript and great care must be used.\n * Because of this, this interface should not be used in the public API.\n */\nexport interface ReferenceCounted {\n\t/**\n\t * Called to increase the reference count tracked by this object.\n\t * @remarks\n\t * When a user of this object allows something else to use it,\n\t * this should be called.\n\t */\n\treferenceAdded(): void;\n\t/**\n\t * Called to decrease the reference count tracked by this object.\n\t * @remarks\n\t * When a user of this object will no longer use it, this should be called.\n\t */\n\treferenceRemoved(): void;\n\n\t/**\n\t * @returns true if mutating this object may impact other users of it.\n\t *\n\t * Implementations can return true if the refcount is 1 OR the content is logically immutable.\n\t */\n\tisShared(): boolean;\n}\n\n/**\n * Base class to assist with implementing ReferenceCounted.\n */\nexport abstract class ReferenceCountedBase implements ReferenceCounted {\n\tprotected constructor(private refCount: number = 1) {}\n\n\tpublic referenceAdded(count = 1): void {\n\t\tthis.refCount += count;\n\t}\n\n\tpublic referenceRemoved(count = 1): void {\n\t\tthis.refCount -= count;\n\t\tassert(this.refCount >= 0, 0x4c4 /* Negative ref count */);\n\t\tif (this.refCount === 0) {\n\t\t\tthis.onUnreferenced();\n\t\t}\n\t}\n\n\tpublic isShared(): boolean {\n\t\treturn this.refCount > 1;\n\t}\n\n\tpublic isUnreferenced(): boolean {\n\t\treturn this.refCount === 0;\n\t}\n\n\t/**\n\t * Called when refcount reaches 0.\n\t */\n\tprotected abstract onUnreferenced(): void;\n}\n"]}
1
+ {"version":3,"file":"referenceCounting.js","sourceRoot":"","sources":["../../src/util/referenceCounting.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,kEAA6D;AAgC7D;;GAEG;AACH,MAAsB,oBAAoB;IACzC,6GAA6G;IAC7G,YAA8B,WAAmB,CAAC;QAApB,aAAQ,GAAR,QAAQ,CAAY;IAAG,CAAC;IAE/C,cAAc,CAAC,KAAK,GAAG,CAAC;QAC9B,IAAI,CAAC,QAAQ,IAAI,KAAK,CAAC;IACxB,CAAC;IAEM,gBAAgB,CAAC,KAAK,GAAG,CAAC;QAChC,IAAI,CAAC,QAAQ,IAAI,KAAK,CAAC;QACvB,IAAA,iBAAM,EAAC,IAAI,CAAC,QAAQ,IAAI,CAAC,EAAE,KAAK,CAAC,wBAAwB,CAAC,CAAC;QAC3D,IAAI,IAAI,CAAC,QAAQ,KAAK,CAAC,EAAE,CAAC;YACzB,IAAI,CAAC,cAAc,EAAE,CAAC;QACvB,CAAC;IACF,CAAC;IAEM,QAAQ;QACd,OAAO,IAAI,CAAC,QAAQ,GAAG,CAAC,CAAC;IAC1B,CAAC;IAEM,cAAc;QACpB,OAAO,IAAI,CAAC,QAAQ,KAAK,CAAC,CAAC;IAC5B,CAAC;CAMD;AA5BD,oDA4BC","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\";\n\n/**\n * An object which counts the number of users / references to it.\n * @remarks\n * This implements the {@link https://en.wikipedia.org/wiki/Reference_counting | Reference counting} pattern.\n * Getting the reference count correct is difficult in TypeScript and great care must be used.\n * Because of this, this interface should not be used in the public API.\n */\nexport interface ReferenceCounted {\n\t/**\n\t * Called to increase the reference count tracked by this object.\n\t * @remarks\n\t * When a user of this object allows something else to use it,\n\t * this should be called.\n\t */\n\treferenceAdded(): void;\n\t/**\n\t * Called to decrease the reference count tracked by this object.\n\t * @remarks\n\t * When a user of this object will no longer use it, this should be called.\n\t */\n\treferenceRemoved(): void;\n\n\t/**\n\t * @returns true if mutating this object may impact other users of it.\n\t *\n\t * Implementations can return true if the refcount is 1 OR the content is logically immutable.\n\t */\n\tisShared(): boolean;\n}\n\n/**\n * Base class to assist with implementing ReferenceCounted.\n */\nexport abstract class ReferenceCountedBase implements ReferenceCounted {\n\t// eslint-disable-next-line @typescript-eslint/prefer-readonly -- false positive; modified in multiple places\n\tprotected constructor(private refCount: number = 1) {}\n\n\tpublic referenceAdded(count = 1): void {\n\t\tthis.refCount += count;\n\t}\n\n\tpublic referenceRemoved(count = 1): void {\n\t\tthis.refCount -= count;\n\t\tassert(this.refCount >= 0, 0x4c4 /* Negative ref count */);\n\t\tif (this.refCount === 0) {\n\t\t\tthis.onUnreferenced();\n\t\t}\n\t}\n\n\tpublic isShared(): boolean {\n\t\treturn this.refCount > 1;\n\t}\n\n\tpublic isUnreferenced(): boolean {\n\t\treturn this.refCount === 0;\n\t}\n\n\t/**\n\t * Called when refcount reaches 0.\n\t */\n\tprotected abstract onUnreferenced(): void;\n}\n"]}
package/lib/alpha.d.ts CHANGED
@@ -131,6 +131,7 @@ export {
131
131
  adaptEnum,
132
132
  asBeta,
133
133
  configuredSharedTreeBeta,
134
+ createIndependentTreeBeta,
134
135
  enumFromStrings,
135
136
  singletonSchema,
136
137
  // #endregion
@@ -204,6 +205,7 @@ export {
204
205
  SharedTreeFormatOptions,
205
206
  SharedTreeFormatVersion,
206
207
  SharedTreeOptions,
208
+ SimpleAllowedTypeAttributes,
207
209
  SimpleArrayNodeSchema,
208
210
  SimpleFieldSchema,
209
211
  SimpleLeafNodeSchema,
@@ -251,6 +253,7 @@ export {
251
253
  comparePersistedSchema,
252
254
  contentSchemaSymbol,
253
255
  createIdentifierIndex,
256
+ createIndependentTreeAlpha,
254
257
  createSimpleTreeIndex,
255
258
  evaluateLazySchema,
256
259
  extractPersistedSchema,
package/lib/beta.d.ts CHANGED
@@ -131,6 +131,7 @@ export {
131
131
  adaptEnum,
132
132
  asBeta,
133
133
  configuredSharedTreeBeta,
134
+ createIndependentTreeBeta,
134
135
  enumFromStrings,
135
136
  singletonSchema
136
137
  // #endregion
@@ -26,7 +26,7 @@ export type DiscriminatedUnionLibrary<TUnion extends object, TArgs extends any[]
26
26
  }
27
27
  ][_InlineTrick];
28
28
  /**
29
- * Applies a function to the content of a [discriminated union](https://en.wikipedia.org/wiki/Tagged_union)
29
+ * Applies a function to the content of a {@link https://en.wikipedia.org/wiki/Tagged_union | discriminated union}
30
30
  * where the function to apply depends on which value from the union it holds.
31
31
  *
32
32
  * This uses a rather non-standard encoding of the union where it is an object with many differently named optional fields,
@@ -20,7 +20,7 @@ export const unionOptions = {
20
20
  maxProperties: 1,
21
21
  };
22
22
  /**
23
- * Applies a function to the content of a [discriminated union](https://en.wikipedia.org/wiki/Tagged_union)
23
+ * Applies a function to the content of a {@link https://en.wikipedia.org/wiki/Tagged_union | discriminated union}
24
24
  * where the function to apply depends on which value from the union it holds.
25
25
  *
26
26
  * This uses a rather non-standard encoding of the union where it is an object with many differently named optional fields,
@@ -1 +1 @@
1
- {"version":3,"file":"discriminatedUnions.js","sourceRoot":"","sources":["../../src/codec/discriminatedUnions.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,qCAAqC,CAAC;AAGnE,OAAO,EAAqB,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAElE;;;;GAIG;AAEH;;;;GAIG;AACH,MAAM,CAAC,MAAM,YAAY,GAAkB;IAC1C,oBAAoB,EAAE,KAAK;IAC3B,aAAa,EAAE,CAAC;IAChB,aAAa,EAAE,CAAC;CAChB,CAAC;AAqBF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAsDG;AACH,MAAM,OAAO,4BAA4B;IAWxC,YAAmB,OAA0D;QAC5E,IAAI,CAAC,OAAO,GAAG,WAAW,CACzB,OAA4E,CAC5E,CAAC;IACH,CAAC;IAEM,QAAQ,CAAC,KAAa,EAAE,GAAG,IAAW;QAC5C,MAAM,IAAI,GAAG,OAAO,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;QACpC,MAAM,CACL,IAAI,CAAC,MAAM,KAAK,CAAC,EACjB,KAAK,CAAC,6DAA6D,CACnE,CAAC;QACF,MAAM,GAAG,GAAiB,IAAI,CAAC,CAAC,CAAiB,CAAC;QAClD,MAAM,KAAK,GAAG,KAAK,CAAC,GAAG,CAAC,CAAC;QACzB,MAAM,OAAO,GACZ,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,GAAG,CAAC,IAAI,IAAI,CAAC,KAAK,CAAC,uCAAuC,CAAC,CAAC;QAC9E,MAAM,MAAM,GAAG,OAAO,CAAC,KAAK,EAAE,GAAG,IAAI,CAAC,CAAC;QACvC,OAAO,MAAM,CAAC;IACf,CAAC;CACD","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { assert, fail } from \"@fluidframework/core-utils/internal\";\nimport type { ObjectOptions } from \"@sinclair/typebox\";\n\nimport { type _InlineTrick, objectToMap } from \"../util/index.js\";\n\n/**\n * This module contains utilities for an encoding of a discriminated union that is efficient to validate using\n * a JSON schema validator.\n * See {@link DiscriminatedUnionDispatcher} for more information on this pattern.\n */\n\n/**\n * Options to configure a TypeBox schema as a discriminated union that is simple to validate data against.\n *\n * See {@link DiscriminatedUnionDispatcher} for more information on this pattern.\n */\nexport const unionOptions: ObjectOptions = {\n\tadditionalProperties: false,\n\tminProperties: 1,\n\tmaxProperties: 1,\n};\n\n/**\n * An object containing functions for each member of the union.\n *\n * See {@link DiscriminatedUnionDispatcher}.\n */\nexport type DiscriminatedUnionLibrary<\n\tTUnion extends object,\n\t// eslint-disable-next-line @typescript-eslint/no-explicit-any\n\tTArgs extends any[],\n\tTResult,\n> = [\n\t{\n\t\treadonly [Property in keyof TUnion]-?: (\n\t\t\tvalue: Required<TUnion>[Property],\n\t\t\t...args: TArgs\n\t\t) => TResult;\n\t},\n][_InlineTrick];\n\n/**\n * Applies a function to the content of a [discriminated union](https://en.wikipedia.org/wiki/Tagged_union)\n * where the function to apply depends on which value from the union it holds.\n *\n * This uses a rather non-standard encoding of the union where it is an object with many differently named optional fields,\n * and which of the fields is populated determines the content type.\n * This union encoding has the advantage that schema validation (such as that implemented by TypeBox) can validate the data efficiently.\n * Other encodings--such as using an untagged union, then tagging the content types with a marker enum--require the schema validator to disambiguate the union members.\n * Most JSON validator implementations fail to recognize the marker enum determines which component of the discriminated union the data must be,\n * and end up checking against all candidate members of the union.\n *\n * @example\n *\n * The following union:\n * ```typescript\n * type Operation = Add | Subtract | Multiply | Divide;\n *\n * interface BinaryOperation {\n * readonly left: number;\n * readonly right: number;\n * }\n *\n * interface Add extends BinaryOperation {\n * readonly type: \"add\";\n * }\n *\n * interface Subtract extends BinaryOperation {\n * readonly type: \"subtract\";\n * }\n *\n * interface Multiply extends BinaryOperation {\n * readonly type: \"multiply\";\n * }\n *\n * interface Divide extends BinaryOperation {\n * readonly type: \"divide\";\n * }\n *\n * ```\n * Would be encoded using this strategy as:\n * ```typescript\n * interface EncodedBinaryOperation {\n * readonly left: number;\n * readonly right: number;\n * }\n *\n * interface EncodedOperation {\n * add?: EncodedBinaryOperation;\n * subtract?: EncodedBinaryOperation;\n * multiply?: EncodedBinaryOperation;\n * divide?: EncodedBinaryOperation;\n * }\n * ```\n * where only a single property of `EncodedOperation` is populated for a given encoded value.\n */\nexport class DiscriminatedUnionDispatcher<\n\tTUnion extends object,\n\t// eslint-disable-next-line @typescript-eslint/no-explicit-any\n\tTArgs extends any[],\n\tTResult,\n> {\n\tprivate readonly library: ReadonlyMap<\n\t\tkeyof TUnion,\n\t\t(value: unknown, ...args: TArgs) => TResult\n\t>;\n\n\tpublic constructor(library: DiscriminatedUnionLibrary<TUnion, TArgs, TResult>) {\n\t\tthis.library = objectToMap(\n\t\t\tlibrary as Record<keyof TUnion, (value: unknown, ...args: TArgs) => TResult>,\n\t\t);\n\t}\n\n\tpublic dispatch(union: TUnion, ...args: TArgs): TResult {\n\t\tconst keys = Reflect.ownKeys(union);\n\t\tassert(\n\t\t\tkeys.length === 1,\n\t\t\t0x733 /* discriminated union type should have exactly one member */,\n\t\t);\n\t\tconst key: keyof TUnion = keys[0] as keyof TUnion;\n\t\tconst value = union[key];\n\t\tconst factory =\n\t\t\tthis.library.get(key) ?? fail(0xac2 /* missing function for union member */);\n\t\tconst result = factory(value, ...args);\n\t\treturn result;\n\t}\n}\n"]}
1
+ {"version":3,"file":"discriminatedUnions.js","sourceRoot":"","sources":["../../src/codec/discriminatedUnions.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,qCAAqC,CAAC;AAGnE,OAAO,EAAqB,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAElE;;;;GAIG;AAEH;;;;GAIG;AACH,MAAM,CAAC,MAAM,YAAY,GAAkB;IAC1C,oBAAoB,EAAE,KAAK;IAC3B,aAAa,EAAE,CAAC;IAChB,aAAa,EAAE,CAAC;CAChB,CAAC;AAqBF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAsDG;AACH,MAAM,OAAO,4BAA4B;IAWxC,YAAmB,OAA0D;QAC5E,IAAI,CAAC,OAAO,GAAG,WAAW,CACzB,OAA4E,CAC5E,CAAC;IACH,CAAC;IAEM,QAAQ,CAAC,KAAa,EAAE,GAAG,IAAW;QAC5C,MAAM,IAAI,GAAG,OAAO,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;QACpC,MAAM,CACL,IAAI,CAAC,MAAM,KAAK,CAAC,EACjB,KAAK,CAAC,6DAA6D,CACnE,CAAC;QACF,MAAM,GAAG,GAAiB,IAAI,CAAC,CAAC,CAAiB,CAAC;QAClD,MAAM,KAAK,GAAG,KAAK,CAAC,GAAG,CAAC,CAAC;QACzB,MAAM,OAAO,GACZ,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,GAAG,CAAC,IAAI,IAAI,CAAC,KAAK,CAAC,uCAAuC,CAAC,CAAC;QAC9E,MAAM,MAAM,GAAG,OAAO,CAAC,KAAK,EAAE,GAAG,IAAI,CAAC,CAAC;QACvC,OAAO,MAAM,CAAC;IACf,CAAC;CACD","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { assert, fail } from \"@fluidframework/core-utils/internal\";\nimport type { ObjectOptions } from \"@sinclair/typebox\";\n\nimport { type _InlineTrick, objectToMap } from \"../util/index.js\";\n\n/**\n * This module contains utilities for an encoding of a discriminated union that is efficient to validate using\n * a JSON schema validator.\n * See {@link DiscriminatedUnionDispatcher} for more information on this pattern.\n */\n\n/**\n * Options to configure a TypeBox schema as a discriminated union that is simple to validate data against.\n *\n * See {@link DiscriminatedUnionDispatcher} for more information on this pattern.\n */\nexport const unionOptions: ObjectOptions = {\n\tadditionalProperties: false,\n\tminProperties: 1,\n\tmaxProperties: 1,\n};\n\n/**\n * An object containing functions for each member of the union.\n *\n * See {@link DiscriminatedUnionDispatcher}.\n */\nexport type DiscriminatedUnionLibrary<\n\tTUnion extends object,\n\t// eslint-disable-next-line @typescript-eslint/no-explicit-any\n\tTArgs extends any[],\n\tTResult,\n> = [\n\t{\n\t\treadonly [Property in keyof TUnion]-?: (\n\t\t\tvalue: Required<TUnion>[Property],\n\t\t\t...args: TArgs\n\t\t) => TResult;\n\t},\n][_InlineTrick];\n\n/**\n * Applies a function to the content of a {@link https://en.wikipedia.org/wiki/Tagged_union | discriminated union}\n * where the function to apply depends on which value from the union it holds.\n *\n * This uses a rather non-standard encoding of the union where it is an object with many differently named optional fields,\n * and which of the fields is populated determines the content type.\n * This union encoding has the advantage that schema validation (such as that implemented by TypeBox) can validate the data efficiently.\n * Other encodings--such as using an untagged union, then tagging the content types with a marker enum--require the schema validator to disambiguate the union members.\n * Most JSON validator implementations fail to recognize the marker enum determines which component of the discriminated union the data must be,\n * and end up checking against all candidate members of the union.\n *\n * @example\n *\n * The following union:\n * ```typescript\n * type Operation = Add | Subtract | Multiply | Divide;\n *\n * interface BinaryOperation {\n * readonly left: number;\n * readonly right: number;\n * }\n *\n * interface Add extends BinaryOperation {\n * readonly type: \"add\";\n * }\n *\n * interface Subtract extends BinaryOperation {\n * readonly type: \"subtract\";\n * }\n *\n * interface Multiply extends BinaryOperation {\n * readonly type: \"multiply\";\n * }\n *\n * interface Divide extends BinaryOperation {\n * readonly type: \"divide\";\n * }\n *\n * ```\n * Would be encoded using this strategy as:\n * ```typescript\n * interface EncodedBinaryOperation {\n * readonly left: number;\n * readonly right: number;\n * }\n *\n * interface EncodedOperation {\n * add?: EncodedBinaryOperation;\n * subtract?: EncodedBinaryOperation;\n * multiply?: EncodedBinaryOperation;\n * divide?: EncodedBinaryOperation;\n * }\n * ```\n * where only a single property of `EncodedOperation` is populated for a given encoded value.\n */\nexport class DiscriminatedUnionDispatcher<\n\tTUnion extends object,\n\t// eslint-disable-next-line @typescript-eslint/no-explicit-any\n\tTArgs extends any[],\n\tTResult,\n> {\n\tprivate readonly library: ReadonlyMap<\n\t\tkeyof TUnion,\n\t\t(value: unknown, ...args: TArgs) => TResult\n\t>;\n\n\tpublic constructor(library: DiscriminatedUnionLibrary<TUnion, TArgs, TResult>) {\n\t\tthis.library = objectToMap(\n\t\t\tlibrary as Record<keyof TUnion, (value: unknown, ...args: TArgs) => TResult>,\n\t\t);\n\t}\n\n\tpublic dispatch(union: TUnion, ...args: TArgs): TResult {\n\t\tconst keys = Reflect.ownKeys(union);\n\t\tassert(\n\t\t\tkeys.length === 1,\n\t\t\t0x733 /* discriminated union type should have exactly one member */,\n\t\t);\n\t\tconst key: keyof TUnion = keys[0] as keyof TUnion;\n\t\tconst value = union[key];\n\t\tconst factory =\n\t\t\tthis.library.get(key) ?? fail(0xac2 /* missing function for union member */);\n\t\tconst result = factory(value, ...args);\n\t\treturn result;\n\t}\n}\n"]}
package/lib/index.d.ts CHANGED
@@ -29,8 +29,8 @@ export type Listenable<T extends object> = EventListenable<T>;
29
29
  */
30
30
  export type Off = EventOff;
31
31
  export { TreeStatus, TreeCompressionStrategy, type TreeIndex, type TreeIndexKey, type TreeIndexNodes, } from "./feature-libraries/index.js";
32
- export { type ITreeInternal, type SharedTreeOptions, type SharedTreeOptionsBeta, type ForestType, type SharedTreeFormatOptions, SharedTreeFormatVersion, Tree, type RunTransaction, type ForestOptions, getBranch, type BranchableTree, type TreeBranchFork, independentInitializedView, type ViewContent, TreeAlpha, type ObservationResults, type TreeIdentifierUtils, independentView, ForestTypeOptimized, ForestTypeExpensiveDebug, ForestTypeReference, } from "./shared-tree/index.js";
33
- export { TreeArrayNode, type Unhydrated, IterableTreeArrayContent, TreeNode, type ViewableTree, type ITree, type TreeNodeSchema, TreeViewConfiguration, type ITreeViewConfiguration, type ITreeConfigurationOptions, type TreeView, type TreeViewEvents, SchemaFactory, SchemaFactoryBeta, SchemaFactoryAlpha, type ObjectSchemaOptionsAlpha, type ObjectSchemaOptions, type ImplicitFieldSchema, type TreeFieldFromImplicitField, type TreeChangeEvents, type NodeFromSchema, type TreeMapNode, type InsertableTreeNodeFromImplicitAllowedTypes, type TreeLeafValue, FieldKind, FieldSchema, type FieldSchemaAlpha, type FieldSchemaMetadata, type ImplicitAllowedTypes, type InsertableTreeFieldFromImplicitField, type InsertableTypedNode, NodeKind, type TreeObjectNode, ObjectNodeSchema, type TreeNodeFromImplicitAllowedTypes, type TreeNodeSchemaClass, type SchemaCompatibilityStatus, type FieldProps, type FieldPropsAlpha, normalizeFieldSchema, type InternalTreeNode, type WithType, type NodeChangedData, type SchemaUpgrade, contentSchemaSymbol, type TreeNodeApi, type TreeNodeSchemaCore, type AllowedTypes, type System_Unsafe, type FieldSchemaAlphaUnsafe, type ArrayNodeCustomizableSchemaUnsafe, type MapNodeCustomizableSchemaUnsafe, type TreeRecordNodeUnsafe, type UnannotateAllowedTypeUnsafe, type AnnotatedAllowedTypeUnsafe, type AnnotatedAllowedTypesUnsafe, type AllowedTypesFullUnsafe, type AllowedTypesFullFromMixedUnsafe, type UnannotateAllowedTypesListUnsafe, type AnnotateAllowedTypesListUnsafe, type typeSchemaSymbol, type TreeNodeSchemaNonClass, type ValidateRecursiveSchema, type FixRecursiveArraySchema, type SimpleTreeIndex, type IdentifierIndex, createSimpleTreeIndex, createIdentifierIndex, type DirtyTreeStatus, trackDirtyNodes, type DirtyTreeMap, adaptEnum, enumFromStrings, singletonSchema, type UnsafeUnknownSchema, type TreeViewAlpha, type TreeViewBeta, type InsertableField, type Insertable, type InsertableContent, type FactoryContent, type FactoryContentObject, type ReadableField, type ReadSchema, type AnnotatedAllowedType, type AnnotatedAllowedTypes, type AllowedTypesFullEvaluated, type AllowedTypeMetadata, type AllowedTypesMetadata, type UnannotateAllowedTypesList, type SchemaStaticsAlpha, type AnnotateAllowedTypesList, type AllowedTypesFull, type AllowedTypesFullFromMixed, TreeBeta, type TreeChangeEventsBeta, type VerboseTreeNode, type TreeEncodingOptions, type TreeSchemaEncodingOptions, type TreeSchema, TreeViewConfigurationAlpha, type VerboseTree, extractPersistedSchema, comparePersistedSchema, type ConciseTree, type JsonTreeSchema, type JsonSchemaId, type JsonNodeSchema, type JsonNodeSchemaBase, type JsonLeafNodeSchema, type JsonMapNodeSchema, type JsonArrayNodeSchema, type JsonObjectNodeSchema, type JsonFieldSchema, type JsonSchemaRef, type JsonRefPath, type JsonSchemaType, type JsonLeafSchemaType, type JsonRecordNodeSchema, type JsonStringKeyPatternProperties, getJsonSchema, type LazyItem, type Unenforced, type SimpleNodeSchemaBase, type SimpleNodeSchemaBaseAlpha, type SimpleTreeSchema, type SimpleNodeSchema, type SimpleFieldSchema, type SimpleLeafNodeSchema, type SimpleMapNodeSchema, type SimpleArrayNodeSchema, type SimpleObjectNodeSchema, type SimpleObjectFieldSchema, type SimpleRecordNodeSchema, normalizeAllowedTypes, walkFieldSchema, walkNodeSchema, walkAllowedTypes, type SchemaVisitor, getSimpleSchema, type ReadonlyArrayNode, type InsertableTreeNodeFromAllowedTypes, type Input, type TreeBranch, type TreeBranchAlpha, type TreeBranchEvents, asTreeViewAlpha, type NodeSchemaOptions, type NodeSchemaOptionsAlpha, type NodeSchemaMetadata, type SchemaStatics, type ITreeAlpha, type TransactionConstraint, type NodeInDocumentConstraint, type RunTransactionParams, type VoidTransactionCallbackStatus, type TransactionCallbackStatus, type TransactionResult, type TransactionResultExt, type TransactionResultSuccess, type TransactionResultFailed, rollback, generateSchemaFromSimpleSchema, evaluateLazySchema, replaceConciseTreeHandles, replaceHandles, replaceVerboseTreeHandles, type HandleConverter, allowUnused, type LeafSchema, type ArrayNodeCustomizableSchema, type ArrayNodePojoEmulationSchema, ArrayNodeSchema, type MapNodeCustomizableSchema, type MapNodePojoEmulationSchema, MapNodeSchema, type ObjectFromSchemaRecord, type ValidateRecursiveSchemaTemplate, type FixRecursiveRecursionLimit, RecordNodeSchema, type RecordNodeCustomizableSchema, type RecordNodeInsertableData, type RecordNodePojoEmulationSchema, type TreeRecordNode, KeyEncodingOptions, type TreeParsingOptions, type SchemaFactory_base, type NumberKeys, } from "./simple-tree/index.js";
32
+ export { type ITreeInternal, type SharedTreeOptions, type SharedTreeOptionsBeta, type ForestType, type SharedTreeFormatOptions, SharedTreeFormatVersion, Tree, type RunTransaction, type ForestOptions, getBranch, type BranchableTree, type TreeBranchFork, independentInitializedView, type ViewContent, TreeAlpha, type ObservationResults, type TreeIdentifierUtils, independentView, createIndependentTreeBeta, createIndependentTreeAlpha, ForestTypeOptimized, ForestTypeExpensiveDebug, ForestTypeReference, } from "./shared-tree/index.js";
33
+ export { TreeArrayNode, type Unhydrated, IterableTreeArrayContent, TreeNode, type ViewableTree, type ITree, type TreeNodeSchema, TreeViewConfiguration, type ITreeViewConfiguration, type ITreeConfigurationOptions, type TreeView, type TreeViewEvents, SchemaFactory, SchemaFactoryBeta, SchemaFactoryAlpha, type ObjectSchemaOptionsAlpha, type ObjectSchemaOptions, type ImplicitFieldSchema, type TreeFieldFromImplicitField, type TreeChangeEvents, type NodeFromSchema, type TreeMapNode, type InsertableTreeNodeFromImplicitAllowedTypes, type TreeLeafValue, FieldKind, FieldSchema, type FieldSchemaAlpha, type FieldSchemaMetadata, type ImplicitAllowedTypes, type InsertableTreeFieldFromImplicitField, type InsertableTypedNode, NodeKind, type TreeObjectNode, ObjectNodeSchema, type TreeNodeFromImplicitAllowedTypes, type TreeNodeSchemaClass, type SchemaCompatibilityStatus, type FieldProps, type FieldPropsAlpha, normalizeFieldSchema, type InternalTreeNode, type WithType, type NodeChangedData, type SchemaUpgrade, contentSchemaSymbol, type TreeNodeApi, type TreeNodeSchemaCore, type AllowedTypes, type System_Unsafe, type FieldSchemaAlphaUnsafe, type ArrayNodeCustomizableSchemaUnsafe, type MapNodeCustomizableSchemaUnsafe, type TreeRecordNodeUnsafe, type UnannotateAllowedTypeUnsafe, type AnnotatedAllowedTypeUnsafe, type AnnotatedAllowedTypesUnsafe, type AllowedTypesFullUnsafe, type AllowedTypesFullFromMixedUnsafe, type UnannotateAllowedTypesListUnsafe, type AnnotateAllowedTypesListUnsafe, type typeSchemaSymbol, type TreeNodeSchemaNonClass, type ValidateRecursiveSchema, type FixRecursiveArraySchema, type SimpleTreeIndex, type IdentifierIndex, createSimpleTreeIndex, createIdentifierIndex, type DirtyTreeStatus, trackDirtyNodes, type DirtyTreeMap, adaptEnum, enumFromStrings, singletonSchema, type UnsafeUnknownSchema, type TreeViewAlpha, type TreeViewBeta, type InsertableField, type Insertable, type InsertableContent, type FactoryContent, type FactoryContentObject, type ReadableField, type ReadSchema, type AnnotatedAllowedType, type AnnotatedAllowedTypes, type AllowedTypesFullEvaluated, type AllowedTypeMetadata, type AllowedTypesMetadata, type UnannotateAllowedTypesList, type SchemaStaticsAlpha, type AnnotateAllowedTypesList, type AllowedTypesFull, type AllowedTypesFullFromMixed, TreeBeta, type TreeChangeEventsBeta, type VerboseTreeNode, type TreeEncodingOptions, type TreeSchemaEncodingOptions, type TreeSchema, TreeViewConfigurationAlpha, type VerboseTree, extractPersistedSchema, comparePersistedSchema, type ConciseTree, type JsonTreeSchema, type JsonSchemaId, type JsonNodeSchema, type JsonNodeSchemaBase, type JsonLeafNodeSchema, type JsonMapNodeSchema, type JsonArrayNodeSchema, type JsonObjectNodeSchema, type JsonFieldSchema, type JsonSchemaRef, type JsonRefPath, type JsonSchemaType, type JsonLeafSchemaType, type JsonRecordNodeSchema, type JsonStringKeyPatternProperties, getJsonSchema, type LazyItem, type Unenforced, type SimpleNodeSchemaBase, type SimpleNodeSchemaBaseAlpha, type SimpleTreeSchema, type SimpleNodeSchema, type SimpleFieldSchema, type SimpleLeafNodeSchema, type SimpleMapNodeSchema, type SimpleArrayNodeSchema, type SimpleObjectNodeSchema, type SimpleObjectFieldSchema, type SimpleRecordNodeSchema, normalizeAllowedTypes, walkFieldSchema, walkNodeSchema, walkAllowedTypes, type SchemaVisitor, getSimpleSchema, type ReadonlyArrayNode, type InsertableTreeNodeFromAllowedTypes, type Input, type TreeBranch, type TreeBranchAlpha, type TreeBranchEvents, asTreeViewAlpha, type NodeSchemaOptions, type NodeSchemaOptionsAlpha, type NodeSchemaMetadata, type SchemaStatics, type ITreeAlpha, type TransactionConstraint, type NodeInDocumentConstraint, type RunTransactionParams, type VoidTransactionCallbackStatus, type TransactionCallbackStatus, type TransactionResult, type TransactionResultExt, type TransactionResultSuccess, type TransactionResultFailed, rollback, generateSchemaFromSimpleSchema, evaluateLazySchema, replaceConciseTreeHandles, replaceHandles, replaceVerboseTreeHandles, type HandleConverter, allowUnused, type LeafSchema, type ArrayNodeCustomizableSchema, type ArrayNodePojoEmulationSchema, ArrayNodeSchema, type MapNodeCustomizableSchema, type MapNodePojoEmulationSchema, MapNodeSchema, type ObjectFromSchemaRecord, type ValidateRecursiveSchemaTemplate, type FixRecursiveRecursionLimit, RecordNodeSchema, type RecordNodeCustomizableSchema, type RecordNodeInsertableData, type RecordNodePojoEmulationSchema, type TreeRecordNode, KeyEncodingOptions, type TreeParsingOptions, type SchemaFactory_base, type NumberKeys, type SimpleAllowedTypeAttributes, } from "./simple-tree/index.js";
34
34
  export { SharedTree, configuredSharedTree, configuredSharedTreeBeta, configuredSharedTreeBetaLegacy, } from "./treeFactory.js";
35
35
  export { SharedTreeAttributes, SharedTreeFactoryType } from "./sharedTreeAttributes.js";
36
36
  export { persistedToSimpleSchema } from "./shared-tree/index.js";
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EACN,WAAW,EACX,KAAK,UAAU,EACf,UAAU,EACV,gBAAgB,EAChB,KAAK,cAAc,E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AO,EAAE,qBAAqB,EAAE,MAAM,iBAAiB,CAAC;AAExD,OAAO,KAAK,aAAa,MAAM,oBAAoB,CAAC;AACpD,OAAO;AACN;;;GAGG;AACH,aAAa,GACb,CAAC;AAKF,YAAY,EAAE,qBAAqB,EAAE,MAAM,wBAAwB,CAAC;AAEpE,OAAO,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AACnD,OAAO,EAAE,uBAAuB,EAAE,MAAM,+BAA+B,CAAC;AACxE,OAAO,EAAE,WAAW,EAAE,KAAK,kBAAkB,EAAE,MAAM,kBAAkB,CAAC;AACxE,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC"}
package/lib/index.js CHANGED
@@ -4,7 +4,7 @@
4
4
  */
5
5
  export { ValueSchema, CommitKind, RevertibleStatus, } from "./core/index.js";
6
6
  export { TreeStatus, TreeCompressionStrategy, } from "./feature-libraries/index.js";
7
- export { SharedTreeFormatVersion, Tree, getBranch, independentInitializedView, TreeAlpha, independentView, ForestTypeOptimized, ForestTypeExpensiveDebug, ForestTypeReference, } from "./shared-tree/index.js";
7
+ export { SharedTreeFormatVersion, Tree, getBranch, independentInitializedView, TreeAlpha, independentView, createIndependentTreeBeta, createIndependentTreeAlpha, ForestTypeOptimized, ForestTypeExpensiveDebug, ForestTypeReference, } from "./shared-tree/index.js";
8
8
  export { TreeArrayNode, IterableTreeArrayContent, TreeNode, TreeViewConfiguration, SchemaFactory, SchemaFactoryBeta, SchemaFactoryAlpha, FieldKind, FieldSchema, NodeKind, ObjectNodeSchema, normalizeFieldSchema, contentSchemaSymbol, createSimpleTreeIndex, createIdentifierIndex, trackDirtyNodes,
9
9
  // experimental @alpha APIs:
10
10
  adaptEnum, enumFromStrings, singletonSchema,
package/lib/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EACN,WAAW,EAEX,UAAU,EAC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AO,EAAE,qBAAqB,EAAE,MAAM,iBAAiB,CAAC;AAExD,OAAO,KAAK,aAAa,MAAM,oBAAoB,CAAC;AACpD,OAAO;AACN;;;GAGG;AACH,aAAa,GACb,CAAC;AAOF,OAAO,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AACnD,OAAO,EAAE,uBAAuB,EAAE,MAAM,+BAA+B,CAAC;AACxE,OAAO,EAAE,WAAW,EAA2B,MAAM,kBAAkB,CAAC;AACxE,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nexport {\n\tValueSchema,\n\ttype Revertible,\n\tCommitKind,\n\tRevertibleStatus,\n\ttype CommitMetadata,\n\ttype RevertibleFactory,\n\ttype RevertibleAlphaFactory,\n\ttype RevertibleAlpha,\n} from \"./core/index.js\";\n\nimport type {\n\tListeners as EventListeners,\n\tIsListener as EventIsListener,\n\tListenable as EventListenable,\n\tOff as EventOff,\n} from \"@fluidframework/core-interfaces\";\n\n/**\n * {@inheritdoc @fluidframework/core-interfaces#Listeners}\n * @public\n * @deprecated Deprecated in `@fluidframework/tree`. Consider importing from `fluid-framework` or `@fluidframework/core-interfaces` instead.\n */\nexport type Listeners<T extends object> = EventListeners<T>;\n/**\n * {@inheritdoc @fluidframework/core-interfaces#IsListener}\n * @public\n * @deprecated Deprecated in `@fluidframework/tree`. Consider importing from `fluid-framework` or `@fluidframework/core-interfaces` instead.\n */\nexport type IsListener<T> = EventIsListener<T>;\n/**\n * {@inheritdoc @fluidframework/core-interfaces#Listenable}\n * @public\n * @deprecated Deprecated in `@fluidframework/tree`. Consider importing from `fluid-framework` or `@fluidframework/core-interfaces` instead.\n */\nexport type Listenable<T extends object> = EventListenable<T>;\n/**\n * {@inheritdoc @fluidframework/core-interfaces#Off}\n * @public\n * @deprecated Deprecated in `@fluidframework/tree`. Consider importing from `fluid-framework` or `@fluidframework/core-interfaces` instead.\n */\nexport type Off = EventOff;\n\nexport {\n\tTreeStatus,\n\tTreeCompressionStrategy,\n\ttype TreeIndex,\n\ttype TreeIndexKey,\n\ttype TreeIndexNodes,\n} from \"./feature-libraries/index.js\";\n\nexport {\n\ttype ITreeInternal,\n\ttype SharedTreeOptions,\n\ttype SharedTreeOptionsBeta,\n\ttype ForestType,\n\ttype SharedTreeFormatOptions,\n\tSharedTreeFormatVersion,\n\tTree,\n\ttype RunTransaction,\n\ttype ForestOptions,\n\tgetBranch,\n\ttype BranchableTree,\n\ttype TreeBranchFork,\n\tindependentInitializedView,\n\ttype ViewContent,\n\tTreeAlpha,\n\ttype ObservationResults,\n\ttype TreeIdentifierUtils,\n\tindependentView,\n\tForestTypeOptimized,\n\tForestTypeExpensiveDebug,\n\tForestTypeReference,\n} from \"./shared-tree/index.js\";\n\nexport {\n\tTreeArrayNode,\n\ttype Unhydrated,\n\tIterableTreeArrayContent,\n\tTreeNode,\n\ttype ViewableTree,\n\ttype ITree,\n\ttype TreeNodeSchema,\n\tTreeViewConfiguration,\n\ttype ITreeViewConfiguration,\n\ttype ITreeConfigurationOptions,\n\ttype TreeView,\n\ttype TreeViewEvents,\n\tSchemaFactory,\n\tSchemaFactoryBeta,\n\tSchemaFactoryAlpha,\n\ttype ObjectSchemaOptionsAlpha,\n\ttype ObjectSchemaOptions,\n\ttype ImplicitFieldSchema,\n\ttype TreeFieldFromImplicitField,\n\ttype TreeChangeEvents,\n\ttype NodeFromSchema,\n\ttype TreeMapNode,\n\ttype InsertableTreeNodeFromImplicitAllowedTypes,\n\ttype TreeLeafValue,\n\tFieldKind,\n\tFieldSchema,\n\ttype FieldSchemaAlpha,\n\ttype FieldSchemaMetadata,\n\ttype ImplicitAllowedTypes,\n\ttype InsertableTreeFieldFromImplicitField,\n\ttype InsertableTypedNode,\n\tNodeKind,\n\ttype TreeObjectNode,\n\tObjectNodeSchema,\n\ttype TreeNodeFromImplicitAllowedTypes,\n\ttype TreeNodeSchemaClass,\n\ttype SchemaCompatibilityStatus,\n\ttype FieldProps,\n\ttype FieldPropsAlpha,\n\tnormalizeFieldSchema,\n\ttype InternalTreeNode,\n\ttype WithType,\n\ttype NodeChangedData,\n\ttype SchemaUpgrade,\n\tcontentSchemaSymbol,\n\t// Types not really intended for public use, but used in links.\n\t// Can not be moved to internalTypes since doing so causes app code to throw errors like:\n\t// Error: src/simple-tree/objectNode.ts:72:1 - (ae-unresolved-link) The @link reference could not be resolved: The package \"@fluidframework/tree\" does not have an export \"TreeNodeApi\"\n\ttype TreeNodeApi,\n\ttype TreeNodeSchemaCore,\n\t// Types not really intended for public use, but used in inferred types exposed in the public API.\n\t// Can not be moved to internalTypes since doing so causes app code to throw errors like:\n\t// error TS2742: The inferred type of 'Inventory' cannot be named without a reference to '../node_modules/@fluidframework/tree/lib/internalTypes.js'. This is likely not portable. A type annotation is necessary.\n\ttype AllowedTypes,\n\ttype System_Unsafe,\n\ttype FieldSchemaAlphaUnsafe,\n\ttype ArrayNodeCustomizableSchemaUnsafe,\n\ttype MapNodeCustomizableSchemaUnsafe,\n\ttype TreeRecordNodeUnsafe,\n\ttype UnannotateAllowedTypeUnsafe,\n\ttype AnnotatedAllowedTypeUnsafe,\n\ttype AnnotatedAllowedTypesUnsafe,\n\ttype AllowedTypesFullUnsafe,\n\ttype AllowedTypesFullFromMixedUnsafe,\n\ttype UnannotateAllowedTypesListUnsafe,\n\ttype AnnotateAllowedTypesListUnsafe,\n\t// System types (not in Internal types for various reasons, like doc links or cannot be named errors).\n\ttype typeSchemaSymbol,\n\ttype TreeNodeSchemaNonClass,\n\t// Recursive Schema APIs\n\ttype ValidateRecursiveSchema,\n\ttype FixRecursiveArraySchema,\n\t// Index APIs\n\ttype SimpleTreeIndex,\n\ttype IdentifierIndex,\n\tcreateSimpleTreeIndex,\n\tcreateIdentifierIndex,\n\ttype DirtyTreeStatus,\n\ttrackDirtyNodes,\n\ttype DirtyTreeMap,\n\t// experimental @alpha APIs:\n\tadaptEnum,\n\tenumFromStrings,\n\tsingletonSchema,\n\ttype UnsafeUnknownSchema,\n\ttype TreeViewAlpha,\n\ttype TreeViewBeta,\n\ttype InsertableField,\n\ttype Insertable,\n\ttype InsertableContent,\n\ttype FactoryContent,\n\ttype FactoryContentObject,\n\ttype ReadableField,\n\ttype ReadSchema,\n\ttype AnnotatedAllowedType,\n\ttype AnnotatedAllowedTypes,\n\ttype AllowedTypesFullEvaluated,\n\ttype AllowedTypeMetadata,\n\ttype AllowedTypesMetadata,\n\ttype UnannotateAllowedTypesList,\n\ttype SchemaStaticsAlpha,\n\ttype AnnotateAllowedTypesList,\n\ttype AllowedTypesFull,\n\ttype AllowedTypesFullFromMixed,\n\t// Beta APIs\n\tTreeBeta,\n\ttype TreeChangeEventsBeta,\n\t// Other\n\ttype VerboseTreeNode,\n\ttype TreeEncodingOptions,\n\ttype TreeSchemaEncodingOptions,\n\ttype TreeSchema,\n\tTreeViewConfigurationAlpha,\n\ttype VerboseTree,\n\textractPersistedSchema,\n\tcomparePersistedSchema,\n\ttype ConciseTree,\n\t// Back to normal types\n\ttype JsonTreeSchema,\n\ttype JsonSchemaId,\n\ttype JsonNodeSchema,\n\ttype JsonNodeSchemaBase,\n\ttype JsonLeafNodeSchema,\n\ttype JsonMapNodeSchema,\n\ttype JsonArrayNodeSchema,\n\ttype JsonObjectNodeSchema,\n\ttype JsonFieldSchema,\n\ttype JsonSchemaRef,\n\ttype JsonRefPath,\n\ttype JsonSchemaType,\n\ttype JsonLeafSchemaType,\n\ttype JsonRecordNodeSchema,\n\ttype JsonStringKeyPatternProperties,\n\tgetJsonSchema,\n\ttype LazyItem,\n\ttype Unenforced,\n\ttype SimpleNodeSchemaBase,\n\ttype SimpleNodeSchemaBaseAlpha,\n\ttype SimpleTreeSchema,\n\ttype SimpleNodeSchema,\n\ttype SimpleFieldSchema,\n\ttype SimpleLeafNodeSchema,\n\ttype SimpleMapNodeSchema,\n\ttype SimpleArrayNodeSchema,\n\ttype SimpleObjectNodeSchema,\n\ttype SimpleObjectFieldSchema,\n\ttype SimpleRecordNodeSchema,\n\tnormalizeAllowedTypes,\n\twalkFieldSchema,\n\twalkNodeSchema,\n\twalkAllowedTypes,\n\ttype SchemaVisitor,\n\tgetSimpleSchema,\n\ttype ReadonlyArrayNode,\n\ttype InsertableTreeNodeFromAllowedTypes,\n\ttype Input,\n\ttype TreeBranch,\n\ttype TreeBranchAlpha,\n\ttype TreeBranchEvents,\n\tasTreeViewAlpha,\n\ttype NodeSchemaOptions,\n\ttype NodeSchemaOptionsAlpha,\n\ttype NodeSchemaMetadata,\n\ttype SchemaStatics,\n\ttype ITreeAlpha,\n\ttype TransactionConstraint,\n\ttype NodeInDocumentConstraint,\n\ttype RunTransactionParams,\n\ttype VoidTransactionCallbackStatus,\n\ttype TransactionCallbackStatus,\n\ttype TransactionResult,\n\ttype TransactionResultExt,\n\ttype TransactionResultSuccess,\n\ttype TransactionResultFailed,\n\trollback,\n\tgenerateSchemaFromSimpleSchema,\n\tevaluateLazySchema,\n\treplaceConciseTreeHandles,\n\treplaceHandles,\n\treplaceVerboseTreeHandles,\n\ttype HandleConverter,\n\tallowUnused,\n\ttype LeafSchema,\n\ttype ArrayNodeCustomizableSchema,\n\ttype ArrayNodePojoEmulationSchema,\n\tArrayNodeSchema,\n\ttype MapNodeCustomizableSchema,\n\ttype MapNodePojoEmulationSchema,\n\tMapNodeSchema,\n\ttype ObjectFromSchemaRecord,\n\ttype ValidateRecursiveSchemaTemplate,\n\ttype FixRecursiveRecursionLimit,\n\tRecordNodeSchema,\n\ttype RecordNodeCustomizableSchema,\n\ttype RecordNodeInsertableData,\n\ttype RecordNodePojoEmulationSchema,\n\ttype TreeRecordNode,\n\tKeyEncodingOptions,\n\ttype TreeParsingOptions,\n\ttype SchemaFactory_base,\n\ttype NumberKeys,\n} from \"./simple-tree/index.js\";\nexport {\n\tSharedTree,\n\tconfiguredSharedTree,\n\tconfiguredSharedTreeBeta,\n\tconfiguredSharedTreeBetaLegacy,\n} from \"./treeFactory.js\";\nexport { SharedTreeAttributes, SharedTreeFactoryType } from \"./sharedTreeAttributes.js\";\nexport { persistedToSimpleSchema } from \"./shared-tree/index.js\";\n\nexport {\n\ttype ICodecOptions,\n\ttype CodecWriteOptions,\n\tFluidClientVersion,\n\ttype FormatValidator,\n\tFormatValidatorNoOp,\n} from \"./codec/index.js\";\nexport { FormatValidatorBasic } from \"./external-utilities/index.js\";\n\nexport type {\n\t// Type Testing\n\trequireTrue,\n\trequireFalse,\n\trequireAssignableTo,\n\tareSafelyAssignable,\n\tisAssignableTo,\n\tisAny,\n\teitherIsAny,\n\t// Other\n\tRestrictiveReadonlyRecord,\n\tRestrictiveStringRecord,\n\tMakeNominal,\n\tIsUnion,\n\tUnionToIntersection,\n\tUnionToTuple,\n\tPopUnion,\n\tJsonCompatible,\n\tJsonCompatibleObject,\n\tJsonCompatibleReadOnly,\n\tJsonCompatibleReadOnlyObject,\n} from \"./util/index.js\";\nexport { cloneWithReplacements } from \"./util/index.js\";\n\nimport * as InternalTypes from \"./internalTypes.js\";\nexport {\n\t/**\n\t * Contains types used by the API, but which serve mechanical purposes and do not represent semantic concepts.\n\t * They are used internally to implement API aspects, but are not intended for use by external consumers.\n\t */\n\tInternalTypes,\n};\n\n// Internal/System types:\n// These would be put in `internalTypes` except doing so tents to cause errors like:\n// The inferred type of 'NodeMap' cannot be named without a reference to '../../node_modules/@fluidframework/tree/lib/internalTypes.js'. This is likely not portable. A type annotation is necessary.\nexport type { MapNodeInsertableData } from \"./simple-tree/index.js\";\n\nexport { JsonAsTree } from \"./jsonDomainSchema.js\";\nexport { FluidSerializableAsTree } from \"./serializableDomainSchema.js\";\nexport { TableSchema, type System_TableSchema } from \"./tableSchema.js\";\nexport { asAlpha, asBeta } from \"./api.js\";\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EACN,WAAW,EAEX,UAAU,EACV,gBAAgB,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B,CAAC;AAwBrE,OAAO,EAAE,qBAAqB,EAAE,MAAM,iBAAiB,CAAC;AAExD,OAAO,KAAK,aAAa,MAAM,oBAAoB,CAAC;AACpD,OAAO;AACN;;;GAGG;AACH,aAAa,GACb,CAAC;AAOF,OAAO,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AACnD,OAAO,EAAE,uBAAuB,EAAE,MAAM,+BAA+B,CAAC;AACxE,OAAO,EAAE,WAAW,EAA2B,MAAM,kBAAkB,CAAC;AACxE,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nexport {\n\tValueSchema,\n\ttype Revertible,\n\tCommitKind,\n\tRevertibleStatus,\n\ttype CommitMetadata,\n\ttype RevertibleFactory,\n\ttype RevertibleAlphaFactory,\n\ttype RevertibleAlpha,\n} from \"./core/index.js\";\n\nimport type {\n\tListeners as EventListeners,\n\tIsListener as EventIsListener,\n\tListenable as EventListenable,\n\tOff as EventOff,\n} from \"@fluidframework/core-interfaces\";\n\n/**\n * {@inheritdoc @fluidframework/core-interfaces#Listeners}\n * @public\n * @deprecated Deprecated in `@fluidframework/tree`. Consider importing from `fluid-framework` or `@fluidframework/core-interfaces` instead.\n */\nexport type Listeners<T extends object> = EventListeners<T>;\n/**\n * {@inheritdoc @fluidframework/core-interfaces#IsListener}\n * @public\n * @deprecated Deprecated in `@fluidframework/tree`. Consider importing from `fluid-framework` or `@fluidframework/core-interfaces` instead.\n */\nexport type IsListener<T> = EventIsListener<T>;\n/**\n * {@inheritdoc @fluidframework/core-interfaces#Listenable}\n * @public\n * @deprecated Deprecated in `@fluidframework/tree`. Consider importing from `fluid-framework` or `@fluidframework/core-interfaces` instead.\n */\nexport type Listenable<T extends object> = EventListenable<T>;\n/**\n * {@inheritdoc @fluidframework/core-interfaces#Off}\n * @public\n * @deprecated Deprecated in `@fluidframework/tree`. Consider importing from `fluid-framework` or `@fluidframework/core-interfaces` instead.\n */\nexport type Off = EventOff;\n\nexport {\n\tTreeStatus,\n\tTreeCompressionStrategy,\n\ttype TreeIndex,\n\ttype TreeIndexKey,\n\ttype TreeIndexNodes,\n} from \"./feature-libraries/index.js\";\n\nexport {\n\ttype ITreeInternal,\n\ttype SharedTreeOptions,\n\ttype SharedTreeOptionsBeta,\n\ttype ForestType,\n\ttype SharedTreeFormatOptions,\n\tSharedTreeFormatVersion,\n\tTree,\n\ttype RunTransaction,\n\ttype ForestOptions,\n\tgetBranch,\n\ttype BranchableTree,\n\ttype TreeBranchFork,\n\tindependentInitializedView,\n\ttype ViewContent,\n\tTreeAlpha,\n\ttype ObservationResults,\n\ttype TreeIdentifierUtils,\n\tindependentView,\n\tcreateIndependentTreeBeta,\n\tcreateIndependentTreeAlpha,\n\tForestTypeOptimized,\n\tForestTypeExpensiveDebug,\n\tForestTypeReference,\n} from \"./shared-tree/index.js\";\n\nexport {\n\tTreeArrayNode,\n\ttype Unhydrated,\n\tIterableTreeArrayContent,\n\tTreeNode,\n\ttype ViewableTree,\n\ttype ITree,\n\ttype TreeNodeSchema,\n\tTreeViewConfiguration,\n\ttype ITreeViewConfiguration,\n\ttype ITreeConfigurationOptions,\n\ttype TreeView,\n\ttype TreeViewEvents,\n\tSchemaFactory,\n\tSchemaFactoryBeta,\n\tSchemaFactoryAlpha,\n\ttype ObjectSchemaOptionsAlpha,\n\ttype ObjectSchemaOptions,\n\ttype ImplicitFieldSchema,\n\ttype TreeFieldFromImplicitField,\n\ttype TreeChangeEvents,\n\ttype NodeFromSchema,\n\ttype TreeMapNode,\n\ttype InsertableTreeNodeFromImplicitAllowedTypes,\n\ttype TreeLeafValue,\n\tFieldKind,\n\tFieldSchema,\n\ttype FieldSchemaAlpha,\n\ttype FieldSchemaMetadata,\n\ttype ImplicitAllowedTypes,\n\ttype InsertableTreeFieldFromImplicitField,\n\ttype InsertableTypedNode,\n\tNodeKind,\n\ttype TreeObjectNode,\n\tObjectNodeSchema,\n\ttype TreeNodeFromImplicitAllowedTypes,\n\ttype TreeNodeSchemaClass,\n\ttype SchemaCompatibilityStatus,\n\ttype FieldProps,\n\ttype FieldPropsAlpha,\n\tnormalizeFieldSchema,\n\ttype InternalTreeNode,\n\ttype WithType,\n\ttype NodeChangedData,\n\ttype SchemaUpgrade,\n\tcontentSchemaSymbol,\n\t// Types not really intended for public use, but used in links.\n\t// Can not be moved to internalTypes since doing so causes app code to throw errors like:\n\t// Error: src/simple-tree/objectNode.ts:72:1 - (ae-unresolved-link) The @link reference could not be resolved: The package \"@fluidframework/tree\" does not have an export \"TreeNodeApi\"\n\ttype TreeNodeApi,\n\ttype TreeNodeSchemaCore,\n\t// Types not really intended for public use, but used in inferred types exposed in the public API.\n\t// Can not be moved to internalTypes since doing so causes app code to throw errors like:\n\t// error TS2742: The inferred type of 'Inventory' cannot be named without a reference to '../node_modules/@fluidframework/tree/lib/internalTypes.js'. This is likely not portable. A type annotation is necessary.\n\ttype AllowedTypes,\n\ttype System_Unsafe,\n\ttype FieldSchemaAlphaUnsafe,\n\ttype ArrayNodeCustomizableSchemaUnsafe,\n\ttype MapNodeCustomizableSchemaUnsafe,\n\ttype TreeRecordNodeUnsafe,\n\ttype UnannotateAllowedTypeUnsafe,\n\ttype AnnotatedAllowedTypeUnsafe,\n\ttype AnnotatedAllowedTypesUnsafe,\n\ttype AllowedTypesFullUnsafe,\n\ttype AllowedTypesFullFromMixedUnsafe,\n\ttype UnannotateAllowedTypesListUnsafe,\n\ttype AnnotateAllowedTypesListUnsafe,\n\t// System types (not in Internal types for various reasons, like doc links or cannot be named errors).\n\ttype typeSchemaSymbol,\n\ttype TreeNodeSchemaNonClass,\n\t// Recursive Schema APIs\n\ttype ValidateRecursiveSchema,\n\ttype FixRecursiveArraySchema,\n\t// Index APIs\n\ttype SimpleTreeIndex,\n\ttype IdentifierIndex,\n\tcreateSimpleTreeIndex,\n\tcreateIdentifierIndex,\n\ttype DirtyTreeStatus,\n\ttrackDirtyNodes,\n\ttype DirtyTreeMap,\n\t// experimental @alpha APIs:\n\tadaptEnum,\n\tenumFromStrings,\n\tsingletonSchema,\n\ttype UnsafeUnknownSchema,\n\ttype TreeViewAlpha,\n\ttype TreeViewBeta,\n\ttype InsertableField,\n\ttype Insertable,\n\ttype InsertableContent,\n\ttype FactoryContent,\n\ttype FactoryContentObject,\n\ttype ReadableField,\n\ttype ReadSchema,\n\ttype AnnotatedAllowedType,\n\ttype AnnotatedAllowedTypes,\n\ttype AllowedTypesFullEvaluated,\n\ttype AllowedTypeMetadata,\n\ttype AllowedTypesMetadata,\n\ttype UnannotateAllowedTypesList,\n\ttype SchemaStaticsAlpha,\n\ttype AnnotateAllowedTypesList,\n\ttype AllowedTypesFull,\n\ttype AllowedTypesFullFromMixed,\n\t// Beta APIs\n\tTreeBeta,\n\ttype TreeChangeEventsBeta,\n\t// Other\n\ttype VerboseTreeNode,\n\ttype TreeEncodingOptions,\n\ttype TreeSchemaEncodingOptions,\n\ttype TreeSchema,\n\tTreeViewConfigurationAlpha,\n\ttype VerboseTree,\n\textractPersistedSchema,\n\tcomparePersistedSchema,\n\ttype ConciseTree,\n\t// Back to normal types\n\ttype JsonTreeSchema,\n\ttype JsonSchemaId,\n\ttype JsonNodeSchema,\n\ttype JsonNodeSchemaBase,\n\ttype JsonLeafNodeSchema,\n\ttype JsonMapNodeSchema,\n\ttype JsonArrayNodeSchema,\n\ttype JsonObjectNodeSchema,\n\ttype JsonFieldSchema,\n\ttype JsonSchemaRef,\n\ttype JsonRefPath,\n\ttype JsonSchemaType,\n\ttype JsonLeafSchemaType,\n\ttype JsonRecordNodeSchema,\n\ttype JsonStringKeyPatternProperties,\n\tgetJsonSchema,\n\ttype LazyItem,\n\ttype Unenforced,\n\ttype SimpleNodeSchemaBase,\n\ttype SimpleNodeSchemaBaseAlpha,\n\ttype SimpleTreeSchema,\n\ttype SimpleNodeSchema,\n\ttype SimpleFieldSchema,\n\ttype SimpleLeafNodeSchema,\n\ttype SimpleMapNodeSchema,\n\ttype SimpleArrayNodeSchema,\n\ttype SimpleObjectNodeSchema,\n\ttype SimpleObjectFieldSchema,\n\ttype SimpleRecordNodeSchema,\n\tnormalizeAllowedTypes,\n\twalkFieldSchema,\n\twalkNodeSchema,\n\twalkAllowedTypes,\n\ttype SchemaVisitor,\n\tgetSimpleSchema,\n\ttype ReadonlyArrayNode,\n\ttype InsertableTreeNodeFromAllowedTypes,\n\ttype Input,\n\ttype TreeBranch,\n\ttype TreeBranchAlpha,\n\ttype TreeBranchEvents,\n\tasTreeViewAlpha,\n\ttype NodeSchemaOptions,\n\ttype NodeSchemaOptionsAlpha,\n\ttype NodeSchemaMetadata,\n\ttype SchemaStatics,\n\ttype ITreeAlpha,\n\ttype TransactionConstraint,\n\ttype NodeInDocumentConstraint,\n\ttype RunTransactionParams,\n\ttype VoidTransactionCallbackStatus,\n\ttype TransactionCallbackStatus,\n\ttype TransactionResult,\n\ttype TransactionResultExt,\n\ttype TransactionResultSuccess,\n\ttype TransactionResultFailed,\n\trollback,\n\tgenerateSchemaFromSimpleSchema,\n\tevaluateLazySchema,\n\treplaceConciseTreeHandles,\n\treplaceHandles,\n\treplaceVerboseTreeHandles,\n\ttype HandleConverter,\n\tallowUnused,\n\ttype LeafSchema,\n\ttype ArrayNodeCustomizableSchema,\n\ttype ArrayNodePojoEmulationSchema,\n\tArrayNodeSchema,\n\ttype MapNodeCustomizableSchema,\n\ttype MapNodePojoEmulationSchema,\n\tMapNodeSchema,\n\ttype ObjectFromSchemaRecord,\n\ttype ValidateRecursiveSchemaTemplate,\n\ttype FixRecursiveRecursionLimit,\n\tRecordNodeSchema,\n\ttype RecordNodeCustomizableSchema,\n\ttype RecordNodeInsertableData,\n\ttype RecordNodePojoEmulationSchema,\n\ttype TreeRecordNode,\n\tKeyEncodingOptions,\n\ttype TreeParsingOptions,\n\ttype SchemaFactory_base,\n\ttype NumberKeys,\n\ttype SimpleAllowedTypeAttributes,\n} from \"./simple-tree/index.js\";\nexport {\n\tSharedTree,\n\tconfiguredSharedTree,\n\tconfiguredSharedTreeBeta,\n\tconfiguredSharedTreeBetaLegacy,\n} from \"./treeFactory.js\";\nexport { SharedTreeAttributes, SharedTreeFactoryType } from \"./sharedTreeAttributes.js\";\nexport { persistedToSimpleSchema } from \"./shared-tree/index.js\";\n\nexport {\n\ttype ICodecOptions,\n\ttype CodecWriteOptions,\n\tFluidClientVersion,\n\ttype FormatValidator,\n\tFormatValidatorNoOp,\n} from \"./codec/index.js\";\nexport { FormatValidatorBasic } from \"./external-utilities/index.js\";\n\nexport type {\n\t// Type Testing\n\trequireTrue,\n\trequireFalse,\n\trequireAssignableTo,\n\tareSafelyAssignable,\n\tisAssignableTo,\n\tisAny,\n\teitherIsAny,\n\t// Other\n\tRestrictiveReadonlyRecord,\n\tRestrictiveStringRecord,\n\tMakeNominal,\n\tIsUnion,\n\tUnionToIntersection,\n\tUnionToTuple,\n\tPopUnion,\n\tJsonCompatible,\n\tJsonCompatibleObject,\n\tJsonCompatibleReadOnly,\n\tJsonCompatibleReadOnlyObject,\n} from \"./util/index.js\";\nexport { cloneWithReplacements } from \"./util/index.js\";\n\nimport * as InternalTypes from \"./internalTypes.js\";\nexport {\n\t/**\n\t * Contains types used by the API, but which serve mechanical purposes and do not represent semantic concepts.\n\t * They are used internally to implement API aspects, but are not intended for use by external consumers.\n\t */\n\tInternalTypes,\n};\n\n// Internal/System types:\n// These would be put in `internalTypes` except doing so tents to cause errors like:\n// The inferred type of 'NodeMap' cannot be named without a reference to '../../node_modules/@fluidframework/tree/lib/internalTypes.js'. This is likely not portable. A type annotation is necessary.\nexport type { MapNodeInsertableData } from \"./simple-tree/index.js\";\n\nexport { JsonAsTree } from \"./jsonDomainSchema.js\";\nexport { FluidSerializableAsTree } from \"./serializableDomainSchema.js\";\nexport { TableSchema, type System_TableSchema } from \"./tableSchema.js\";\nexport { asAlpha, asBeta } from \"./api.js\";\n"]}
package/lib/legacy.d.ts CHANGED
@@ -131,6 +131,7 @@ export {
131
131
  adaptEnum,
132
132
  asBeta,
133
133
  configuredSharedTreeBeta,
134
+ createIndependentTreeBeta,
134
135
  enumFromStrings,
135
136
  singletonSchema,
136
137
  // #endregion
@@ -5,5 +5,5 @@
5
5
  * THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY
6
6
  */
7
7
  export declare const pkgName = "@fluidframework/tree";
8
- export declare const pkgVersion = "2.70.0";
8
+ export declare const pkgVersion = "2.71.0";
9
9
  //# sourceMappingURL=packageVersion.d.ts.map
@@ -5,5 +5,5 @@
5
5
  * THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY
6
6
  */
7
7
  export const pkgName = "@fluidframework/tree";
8
- export const pkgVersion = "2.70.0";
8
+ export const pkgVersion = "2.71.0";
9
9
  //# sourceMappingURL=packageVersion.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"packageVersion.js","sourceRoot":"","sources":["../src/packageVersion.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,MAAM,CAAC,MAAM,OAAO,GAAG,sBAAsB,CAAC;AAC9C,MAAM,CAAC,MAAM,UAAU,GAAG,QAAQ,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n *\n * THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY\n */\n\nexport const pkgName = \"@fluidframework/tree\";\nexport const pkgVersion = \"2.70.0\";\n"]}
1
+ {"version":3,"file":"packageVersion.js","sourceRoot":"","sources":["../src/packageVersion.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,MAAM,CAAC,MAAM,OAAO,GAAG,sBAAsB,CAAC;AAC9C,MAAM,CAAC,MAAM,UAAU,GAAG,QAAQ,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n *\n * THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY\n */\n\nexport const pkgName = \"@fluidframework/tree\";\nexport const pkgVersion = \"2.71.0\";\n"]}
@@ -5,11 +5,9 @@
5
5
  import type { IFluidHandle } from "@fluidframework/core-interfaces";
6
6
  import { type IIdCompressor } from "@fluidframework/id-compressor/internal";
7
7
  import type { ICodecOptions } from "../codec/index.js";
8
- import { type ITreeCursorSynchronous, type TreeStoredSchema } from "../core/index.js";
9
- import type { TreeViewConfiguration, ImplicitFieldSchema, TreeViewAlpha } from "../simple-tree/index.js";
8
+ import type { TreeViewConfiguration, ImplicitFieldSchema, TreeViewAlpha, ITreeAlpha, ViewableTree } from "../simple-tree/index.js";
10
9
  import { type JsonCompatible } from "../util/index.js";
11
10
  import { type ForestOptions } from "./sharedTree.js";
12
- import { SchematizingSimpleTreeView } from "./schematizingTreeView.js";
13
11
  /**
14
12
  * Create an uninitialized {@link TreeView} that is not tied to any {@link ITree} instance.
15
13
  *
@@ -35,9 +33,80 @@ export declare function independentView<const TSchema extends ImplicitFieldSchem
35
33
  */
36
34
  export declare function independentInitializedView<const TSchema extends ImplicitFieldSchema>(config: TreeViewConfiguration<TSchema>, options: ForestOptions & ICodecOptions, content: ViewContent): TreeViewAlpha<TSchema>;
37
35
  /**
38
- * {@link independentInitializedView} but using internal types instead of persisted data formats.
36
+ * Create a {@link ViewableTree} that is not tied to any Fluid runtimes or services.
37
+ *
38
+ * @remarks
39
+ * Such a tree can never experience collaboration or be persisted to to a Fluid Container.
40
+ *
41
+ * This can be useful for testing, as well as use-cases like working on local files instead of documents stored in some Fluid service.
42
+ *
43
+ * @example
44
+ * ```typescript
45
+ * const tree = createIndependentTreeBeta();
46
+ *
47
+ * const stagedConfig = new TreeViewConfiguration({
48
+ * schema: SchemaFactoryAlpha.types([
49
+ * SchemaFactory.number,
50
+ * SchemaFactoryAlpha.staged(SchemaFactory.string),
51
+ * ]),
52
+ * });
53
+ * const afterConfig = new TreeViewConfigurationAlpha({
54
+ * schema: [SchemaFactory.number, SchemaFactory.string],
55
+ * });
56
+ *
57
+ * // Initialize tree
58
+ * {
59
+ * const view = tree.viewWith(stagedConfig);
60
+ * view.initialize(1);
61
+ * view.dispose();
62
+ * }
63
+ *
64
+ * // Do schema upgrade
65
+ * {
66
+ * const view = tree.viewWith(afterConfig);
67
+ * view.upgradeSchema();
68
+ * view.root = "A";
69
+ * view.dispose();
70
+ * }
71
+ *
72
+ * // Can still view tree with staged schema
73
+ * {
74
+ * const view = tree.viewWith(stagedConfig);
75
+ * assert.equal(view.root, "A");
76
+ * view.dispose();
77
+ * }
78
+ * ```
79
+ * @privateRemarks
80
+ * Before stabilizing this as public, consider if we can instead just expose a better way to create regular Fluid service based SharedTrees for tests.
81
+ * Something like https://github.com/microsoft/FluidFramework/pull/25422 might be a better long term stable/public solution.
82
+ * @beta
39
83
  */
40
- export declare function independentInitializedViewInternal<const TSchema extends ImplicitFieldSchema>(config: TreeViewConfiguration<TSchema>, options: ForestOptions & ICodecOptions, schema: TreeStoredSchema, rootFieldCursor: ITreeCursorSynchronous, idCompressor: IIdCompressor): SchematizingSimpleTreeView<TSchema>;
84
+ export declare function createIndependentTreeBeta<const TSchema extends ImplicitFieldSchema>(options?: ForestOptions): ViewableTree;
85
+ /**
86
+ * Alpha extensions to {@link createIndependentTreeBeta}.
87
+ *
88
+ * @param options - Configuration options for the independent tree.
89
+ * This can be used to create an uninitialized tree, or `content` can be provided to create an initialized tree.
90
+ * If content is provided, the idCompressor is a required part of it: otherwise it is optional and provided at the top level.
91
+ *
92
+ * @privateRemarks
93
+ * TODO: Support more of {@link ITreeAlpha}, including branching APIs to allow for merges.
94
+ * TODO: Better unify this logic with SharedTreeKernel and SharedTreeCore.
95
+ *
96
+ * Before further stabilizing: consider better ways to handle initialized vs uninitialized trees.
97
+ * Perhaps it would be better to not allow initialize here at all, but expose the ability to load compressed tree content and stored schema via ITree or TreeView?
98
+ * If keeping the option here, maybe a separate function of overload would be better? Or maybe flatten ViewContent inline to deduplicate the idCompressor options?
99
+ * @alpha
100
+ */
101
+ export declare function createIndependentTreeAlpha<const TSchema extends ImplicitFieldSchema>(options?: ForestOptions & (({
102
+ idCompressor?: IIdCompressor | undefined;
103
+ } & {
104
+ content?: undefined;
105
+ }) | (ICodecOptions & {
106
+ content: ViewContent;
107
+ } & {
108
+ idCompressor?: undefined;
109
+ }))): ViewableTree & Pick<ITreeAlpha, "exportVerbose" | "exportSimpleSchema">;
41
110
  /**
42
111
  * The portion of SharedTree data typically persisted by the container.
43
112
  * Usable with {@link independentInitializedView} to create a {@link TreeView}
@@ -1 +1 @@
1
- {"version":3,"file":"independentView.d.ts","sourceRoot":"","sources":["../../src/shared-tree/independentView.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,iCAAiC,CAAC;AAEpE,OAAO,EACN,KAAK,aAAa,EAElB,MAAM,wCAAwC,CAAC;AAEhD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AACvD,OAAO,EACN,KAAK,sBAAsB,EAI3B,KAAK,gBAAgB,EAErB,MAAM,kBAAkB,CAAC;AAY1B,OAAO,KAAK,EACX,qBAAqB,EACrB,mBAAmB,EACnB,aAAa,EACb,MAAM,yBAAyB,CAAC;AACjC,OAAO,EAA+B,KAAK,cAAc,EAAa,MAAM,kBAAkB,CAAC;AAC/F,OAAO,EAGN,KAAK,aAAa,EAClB,MAAM,iBAAiB,CAAC;AAEzB,OAAO,EAAE,0BAA0B,EAAE,MAAM,2BAA2B,CAAC;AAIvE;;;;;;;;GAQG;AACH,wBAAgB,eAAe,CAAC,KAAK,CAAC,OAAO,SAAS,mBAAmB,EACxE,MAAM,EAAE,qBAAqB,CAAC,OAAO,CAAC,EACtC,OAAO,EAAE,aAAa,GAAG;IAAE,YAAY,CAAC,EAAE,aAAa,GAAG,SAAS,CAAA;CAAE,GACnE,aAAa,CAAC,OAAO,CAAC,CAwBxB;AACD;;;;;;;;;;GAUG;AACH,wBAAgB,0BAA0B,C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