@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.
- package/CHANGELOG.md +58 -0
- package/api-report/tree.alpha.api.md +25 -4
- package/api-report/tree.beta.api.md +3 -0
- package/api-report/tree.legacy.beta.api.md +3 -0
- package/dist/alpha.d.ts +3 -0
- package/dist/beta.d.ts +1 -0
- package/dist/codec/discriminatedUnions.d.ts +1 -1
- package/dist/codec/discriminatedUnions.js +1 -1
- package/dist/codec/discriminatedUnions.js.map +1 -1
- package/dist/index.d.ts +2 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +4 -2
- package/dist/index.js.map +1 -1
- package/dist/legacy.d.ts +1 -0
- package/dist/packageVersion.d.ts +1 -1
- package/dist/packageVersion.js +1 -1
- package/dist/packageVersion.js.map +1 -1
- package/dist/shared-tree/independentView.d.ts +74 -5
- package/dist/shared-tree/independentView.d.ts.map +1 -1
- package/dist/shared-tree/independentView.js +104 -38
- package/dist/shared-tree/independentView.js.map +1 -1
- package/dist/shared-tree/index.d.ts +2 -1
- package/dist/shared-tree/index.d.ts.map +1 -1
- package/dist/shared-tree/index.js +6 -1
- package/dist/shared-tree/index.js.map +1 -1
- package/dist/shared-tree/sharedTree.d.ts.map +1 -1
- package/dist/shared-tree/sharedTree.js +18 -3
- package/dist/shared-tree/sharedTree.js.map +1 -1
- package/dist/simple-tree/api/schemaFactory.d.ts +2 -2
- package/dist/simple-tree/api/schemaFactory.js +2 -2
- package/dist/simple-tree/api/schemaFactory.js.map +1 -1
- package/dist/simple-tree/api/schemaFactoryRecursive.d.ts.map +1 -1
- package/dist/simple-tree/api/schemaFactoryRecursive.js +1 -0
- package/dist/simple-tree/api/schemaFactoryRecursive.js.map +1 -1
- package/dist/simple-tree/api/schemaFromSimple.d.ts.map +1 -1
- package/dist/simple-tree/api/schemaFromSimple.js +9 -5
- package/dist/simple-tree/api/schemaFromSimple.js.map +1 -1
- package/dist/simple-tree/api/simpleSchemaToJsonSchema.d.ts.map +1 -1
- package/dist/simple-tree/api/simpleSchemaToJsonSchema.js +4 -2
- package/dist/simple-tree/api/simpleSchemaToJsonSchema.js.map +1 -1
- package/dist/simple-tree/api/viewSchemaToSimpleSchema.d.ts +2 -1
- package/dist/simple-tree/api/viewSchemaToSimpleSchema.d.ts.map +1 -1
- package/dist/simple-tree/api/viewSchemaToSimpleSchema.js +31 -10
- package/dist/simple-tree/api/viewSchemaToSimpleSchema.js.map +1 -1
- package/dist/simple-tree/core/allowedTypes.d.ts +9 -4
- package/dist/simple-tree/core/allowedTypes.d.ts.map +1 -1
- package/dist/simple-tree/core/allowedTypes.js +17 -4
- package/dist/simple-tree/core/allowedTypes.js.map +1 -1
- package/dist/simple-tree/fieldSchema.d.ts +2 -1
- package/dist/simple-tree/fieldSchema.d.ts.map +1 -1
- package/dist/simple-tree/fieldSchema.js +10 -0
- package/dist/simple-tree/fieldSchema.js.map +1 -1
- package/dist/simple-tree/index.d.ts +1 -1
- package/dist/simple-tree/index.d.ts.map +1 -1
- package/dist/simple-tree/index.js.map +1 -1
- package/dist/simple-tree/node-kinds/array/arrayNode.d.ts.map +1 -1
- package/dist/simple-tree/node-kinds/array/arrayNode.js +6 -0
- package/dist/simple-tree/node-kinds/array/arrayNode.js.map +1 -1
- package/dist/simple-tree/node-kinds/map/mapNode.d.ts.map +1 -1
- package/dist/simple-tree/node-kinds/map/mapNode.js +6 -0
- package/dist/simple-tree/node-kinds/map/mapNode.js.map +1 -1
- package/dist/simple-tree/node-kinds/object/objectNode.d.ts +17 -0
- package/dist/simple-tree/node-kinds/object/objectNode.d.ts.map +1 -1
- package/dist/simple-tree/node-kinds/object/objectNode.js +19 -6
- package/dist/simple-tree/node-kinds/object/objectNode.js.map +1 -1
- package/dist/simple-tree/node-kinds/record/recordNode.d.ts.map +1 -1
- package/dist/simple-tree/node-kinds/record/recordNode.js +6 -0
- package/dist/simple-tree/node-kinds/record/recordNode.js.map +1 -1
- package/dist/simple-tree/node-kinds/record/recordNodeTypes.d.ts +16 -0
- package/dist/simple-tree/node-kinds/record/recordNodeTypes.d.ts.map +1 -1
- package/dist/simple-tree/node-kinds/record/recordNodeTypes.js.map +1 -1
- package/dist/simple-tree/simpleSchema.d.ts +21 -5
- package/dist/simple-tree/simpleSchema.d.ts.map +1 -1
- package/dist/simple-tree/simpleSchema.js.map +1 -1
- package/dist/simple-tree/toStoredSchema.d.ts.map +1 -1
- package/dist/simple-tree/toStoredSchema.js +6 -3
- package/dist/simple-tree/toStoredSchema.js.map +1 -1
- package/dist/util/referenceCounting.d.ts.map +1 -1
- package/dist/util/referenceCounting.js +1 -0
- package/dist/util/referenceCounting.js.map +1 -1
- package/lib/alpha.d.ts +3 -0
- package/lib/beta.d.ts +1 -0
- package/lib/codec/discriminatedUnions.d.ts +1 -1
- package/lib/codec/discriminatedUnions.js +1 -1
- package/lib/codec/discriminatedUnions.js.map +1 -1
- package/lib/index.d.ts +2 -2
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +1 -1
- package/lib/index.js.map +1 -1
- package/lib/legacy.d.ts +1 -0
- package/lib/packageVersion.d.ts +1 -1
- package/lib/packageVersion.js +1 -1
- package/lib/packageVersion.js.map +1 -1
- package/lib/shared-tree/independentView.d.ts +74 -5
- package/lib/shared-tree/independentView.d.ts.map +1 -1
- package/lib/shared-tree/independentView.js +103 -38
- package/lib/shared-tree/independentView.js.map +1 -1
- package/lib/shared-tree/index.d.ts +2 -1
- package/lib/shared-tree/index.d.ts.map +1 -1
- package/lib/shared-tree/index.js +2 -1
- package/lib/shared-tree/index.js.map +1 -1
- package/lib/shared-tree/sharedTree.d.ts.map +1 -1
- package/lib/shared-tree/sharedTree.js +18 -3
- package/lib/shared-tree/sharedTree.js.map +1 -1
- package/lib/simple-tree/api/schemaFactory.d.ts +2 -2
- package/lib/simple-tree/api/schemaFactory.js +2 -2
- package/lib/simple-tree/api/schemaFactory.js.map +1 -1
- package/lib/simple-tree/api/schemaFactoryRecursive.d.ts.map +1 -1
- package/lib/simple-tree/api/schemaFactoryRecursive.js +1 -0
- package/lib/simple-tree/api/schemaFactoryRecursive.js.map +1 -1
- package/lib/simple-tree/api/schemaFromSimple.d.ts.map +1 -1
- package/lib/simple-tree/api/schemaFromSimple.js +9 -5
- package/lib/simple-tree/api/schemaFromSimple.js.map +1 -1
- package/lib/simple-tree/api/simpleSchemaToJsonSchema.d.ts.map +1 -1
- package/lib/simple-tree/api/simpleSchemaToJsonSchema.js +4 -2
- package/lib/simple-tree/api/simpleSchemaToJsonSchema.js.map +1 -1
- package/lib/simple-tree/api/viewSchemaToSimpleSchema.d.ts +2 -1
- package/lib/simple-tree/api/viewSchemaToSimpleSchema.d.ts.map +1 -1
- package/lib/simple-tree/api/viewSchemaToSimpleSchema.js +31 -10
- package/lib/simple-tree/api/viewSchemaToSimpleSchema.js.map +1 -1
- package/lib/simple-tree/core/allowedTypes.d.ts +9 -4
- package/lib/simple-tree/core/allowedTypes.d.ts.map +1 -1
- package/lib/simple-tree/core/allowedTypes.js +18 -5
- package/lib/simple-tree/core/allowedTypes.js.map +1 -1
- package/lib/simple-tree/fieldSchema.d.ts +2 -1
- package/lib/simple-tree/fieldSchema.d.ts.map +1 -1
- package/lib/simple-tree/fieldSchema.js +10 -0
- package/lib/simple-tree/fieldSchema.js.map +1 -1
- package/lib/simple-tree/index.d.ts +1 -1
- package/lib/simple-tree/index.d.ts.map +1 -1
- package/lib/simple-tree/index.js.map +1 -1
- package/lib/simple-tree/node-kinds/array/arrayNode.d.ts.map +1 -1
- package/lib/simple-tree/node-kinds/array/arrayNode.js +7 -1
- package/lib/simple-tree/node-kinds/array/arrayNode.js.map +1 -1
- package/lib/simple-tree/node-kinds/map/mapNode.d.ts.map +1 -1
- package/lib/simple-tree/node-kinds/map/mapNode.js +7 -1
- package/lib/simple-tree/node-kinds/map/mapNode.js.map +1 -1
- package/lib/simple-tree/node-kinds/object/objectNode.d.ts +17 -0
- package/lib/simple-tree/node-kinds/object/objectNode.d.ts.map +1 -1
- package/lib/simple-tree/node-kinds/object/objectNode.js +19 -6
- package/lib/simple-tree/node-kinds/object/objectNode.js.map +1 -1
- package/lib/simple-tree/node-kinds/record/recordNode.d.ts.map +1 -1
- package/lib/simple-tree/node-kinds/record/recordNode.js +7 -1
- package/lib/simple-tree/node-kinds/record/recordNode.js.map +1 -1
- package/lib/simple-tree/node-kinds/record/recordNodeTypes.d.ts +16 -0
- package/lib/simple-tree/node-kinds/record/recordNodeTypes.d.ts.map +1 -1
- package/lib/simple-tree/node-kinds/record/recordNodeTypes.js.map +1 -1
- package/lib/simple-tree/simpleSchema.d.ts +21 -5
- package/lib/simple-tree/simpleSchema.d.ts.map +1 -1
- package/lib/simple-tree/simpleSchema.js.map +1 -1
- package/lib/simple-tree/toStoredSchema.d.ts.map +1 -1
- package/lib/simple-tree/toStoredSchema.js +6 -3
- package/lib/simple-tree/toStoredSchema.js.map +1 -1
- package/lib/util/referenceCounting.d.ts.map +1 -1
- package/lib/util/referenceCounting.js +1 -0
- package/lib/util/referenceCounting.js.map +1 -1
- package/package.json +24 -24
- package/src/codec/discriminatedUnions.ts +1 -1
- package/src/index.ts +3 -0
- package/src/packageVersion.ts +1 -1
- package/src/shared-tree/independentView.ts +147 -72
- package/src/shared-tree/index.ts +4 -0
- package/src/shared-tree/sharedTree.ts +25 -3
- package/src/simple-tree/api/schemaFactory.ts +2 -2
- package/src/simple-tree/api/schemaFactoryRecursive.ts +2 -0
- package/src/simple-tree/api/schemaFromSimple.ts +17 -14
- package/src/simple-tree/api/simpleSchemaToJsonSchema.ts +8 -2
- package/src/simple-tree/api/viewSchemaToSimpleSchema.ts +44 -8
- package/src/simple-tree/core/allowedTypes.ts +26 -13
- package/src/simple-tree/fieldSchema.ts +14 -1
- package/src/simple-tree/index.ts +1 -0
- package/src/simple-tree/node-kinds/array/arrayNode.ts +9 -0
- package/src/simple-tree/node-kinds/map/mapNode.ts +9 -0
- package/src/simple-tree/node-kinds/object/objectNode.ts +54 -18
- package/src/simple-tree/node-kinds/record/recordNode.ts +9 -0
- package/src/simple-tree/node-kinds/record/recordNodeTypes.ts +16 -0
- package/src/simple-tree/simpleSchema.ts +22 -5
- package/src/simple-tree/toStoredSchema.ts +12 -3
- package/src/util/referenceCounting.ts +1 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"toStoredSchema.d.ts","sourceRoot":"","sources":["../../src/simple-tree/toStoredSchema.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAKH,OAAO,EAIN,sBAAsB,EAGtB,KAAK,qBAAqB,EAE1B,KAAK,oBAAoB,EACzB,KAAK,gBAAgB,EACrB,KAAK,WAAW,EAChB,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAAc,KAAK,aAAa,EAAE,MAAM,+BAA+B,CAAC;AAC/E,OAAO,EAAsB,KAAK,4BAA4B,EAAE,MAAM,kBAAkB,CAAC;AAEzF,OAAO,EAON,KAAK,6BAA6B,EAClC,MAAM,iBAAiB,CAAC;AACzB,OAAO,EACN,SAAS,EACT,gBAAgB,EAEhB,KAAK,mBAAmB,EACxB,MAAM,kBAAkB,CAAC;AAC1B,OAAO,KAAK,EAAE,iBAAiB,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AAQ7E,eAAO,MAAM,wCAAwC,EAAE,6BAEtD,CAAC;AAEF,eAAO,MAAM,uCAAuC,EAAE,6BAErD,CAAC;AAEF;;;;GAIG;AACH,wBAAgB,eAAe,CAAC,IAAI,EAAE,mBAAmB,GAAG,gBAAgB,CAE3E;AAED;;GAEG;AACH,wBAAgB,eAAe,CAAC,IAAI,EAAE,mBAAmB,GAAG,gBAAgB,CAE3E;AAED;;;;;;GAMG;AACH,eAAO,MAAM,kBAAkB,+BAA0C,CAAC;AAE1E;;;;;;;;;GASG;AACH,wBAAgB,cAAc,CAC7B,IAAI,EAAE,mBAAmB,EACzB,OAAO,EAAE,6BAA6B,GACpC,gBAAgB,CAgClB;AAED;;GAEG;AACH,w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;AAED;;GAEG;AACH,eAAO,MAAM,gBAAgB,EAAE,WAAW,CAAC,SAAS,EAAE,aAAa,CAOjE,CAAC;AAEH;;;;GAIG;AACH,wBAAgB,eAAe,CAC9B,MAAM,EAAE,gBAAgB,EACxB,OAAO,EAAE,6BAA6B,GACpC,oBAAoB,CA2CtB;AAED,wBAAgB,qBAAqB,CACpC,KAAK,EAAE,WAAW,EAClB,iBAAiB,EAAE,4BAA4B,GAAG,SAAS,GACzD,sBAAsB,CAQxB"}
|
|
@@ -82,7 +82,8 @@ export function convertField(schema, options) {
|
|
|
82
82
|
types = convertAllowedTypes(schema.allowedTypes, options);
|
|
83
83
|
}
|
|
84
84
|
else {
|
|
85
|
-
|
|
85
|
+
const allowedTypesIdentifiers = new Set(schema.simpleAllowedTypes.keys());
|
|
86
|
+
types = allowedTypesIdentifiers;
|
|
86
87
|
}
|
|
87
88
|
return { kind, types, persistedMetadata: schema.persistedMetadata };
|
|
88
89
|
}
|
|
@@ -110,7 +111,8 @@ export function getStoredSchema(schema, options) {
|
|
|
110
111
|
}
|
|
111
112
|
case NodeKind.Map:
|
|
112
113
|
case NodeKind.Record: {
|
|
113
|
-
const
|
|
114
|
+
const allowedTypesIdentifiers = new Set(schema.simpleAllowedTypes.keys());
|
|
115
|
+
const types = allowedTypesIdentifiers;
|
|
114
116
|
return new MapNodeStoredSchema({
|
|
115
117
|
kind: FieldKinds.optional.identifier,
|
|
116
118
|
types,
|
|
@@ -120,7 +122,8 @@ export function getStoredSchema(schema, options) {
|
|
|
120
122
|
schema.persistedMetadata);
|
|
121
123
|
}
|
|
122
124
|
case NodeKind.Array: {
|
|
123
|
-
const
|
|
125
|
+
const allowedTypesIdentifiers = new Set(schema.simpleAllowedTypes.keys());
|
|
126
|
+
const types = allowedTypesIdentifiers;
|
|
124
127
|
return arrayNodeStoredSchema(types, schema.persistedMetadata);
|
|
125
128
|
}
|
|
126
129
|
case NodeKind.Object: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version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BACL,iBAAiB,EAAE,MAAM,CAAC,iBAAiB;aAC3C;YACD,0FAA0F;YAC1F,MAAM,CAAC,iBAAiB,CACxB,CAAC;QACH,CAAC;QACD,KAAK,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC;YACrB,MAAM,KAAK,GAAG,MAAM,CAAC,uBAAsC,CAAC;YAC5D,OAAO,qBAAqB,CAAC,KAAK,EAAE,MAAM,CAAC,iBAAiB,CAAC,CAAC;QAC/D,CAAC;QACD,KAAK,QAAQ,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,KAAK,CAAC,WAAW,CAAC,SAAS,CAAC,EAAE,YAAY,CAAC,WAAW,EAAE,OAAO,CAAC,CAAC,CAAC;YAC9E,CAAC;YACD,OAAO,IAAI,sBAAsB,CAAC,MAAM,EAAE,MAAM,CAAC,iBAAiB,CAAC,CAAC;QACrE,CAAC;QACD,OAAO,CAAC,CAAC,CAAC;YACT,eAAe,CAAC,IAAI,CAAC,CAAC;QACvB,CAAC;IACF,CAAC;AACF,CAAC;AAED,MAAM,UAAU,qBAAqB,CACpC,KAAkB,EAClB,iBAA2D;IAE3D,MAAM,KAAK,GAAG;QACb,IAAI,EAAE,UAAU,CAAC,QAAQ,CAAC,UAAU;QACpC,KAAK;QACL,iBAAiB;KACjB,CAAC;IACF,MAAM,MAAM,GAAG,IAAI,GAAG,CAAC,CAAC,CAAC,QAAQ,EAAE,KAAK,CAAC,CAAC,CAAC,CAAC;IAC5C,OAAO,IAAI,sBAAsB,CAAC,MAAM,EAAE,iBAAiB,CAAC,CAAC;AAC9D,CAAC","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,OAAO,EAAE,eAAe,EAAE,IAAI,EAAE,MAAM,qCAAqC,CAAC;AAC5E,OAAO,EAAE,UAAU,EAAE,MAAM,0CAA0C,CAAC;AAEtE,OAAO,EACN,QAAQ,EACR,oBAAoB,EACpB,mBAAmB,E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B,CAAC;QACH,CAAC;QACD,KAAK,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC;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,QAAQ,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,KAAK,CAAC,WAAW,CAAC,SAAS,CAAC,EAAE,YAAY,CAAC,WAAW,EAAE,OAAO,CAAC,CAAC,CAAC;YAC9E,CAAC;YACD,OAAO,IAAI,sBAAsB,CAAC,MAAM,EAAE,MAAM,CAAC,iBAAiB,CAAC,CAAC;QACrE,CAAC;QACD,OAAO,CAAC,CAAC,CAAC;YACT,eAAe,CAAC,IAAI,CAAC,CAAC;QACvB,CAAC;IACF,CAAC;AACF,CAAC;AAED,MAAM,UAAU,qBAAqB,CACpC,KAAkB,EAClB,iBAA2D;IAE3D,MAAM,KAAK,GAAG;QACb,IAAI,EAAE,UAAU,CAAC,QAAQ,CAAC,UAAU;QACpC,KAAK;QACL,iBAAiB;KACjB,CAAC;IACF,MAAM,MAAM,GAAG,IAAI,GAAG,CAAC,CAAC,CAAC,QAAQ,EAAE,KAAK,CAAC,CAAC,CAAC,CAAC;IAC5C,OAAO,IAAI,sBAAsB,CAAC,MAAM,EAAE,iBAAiB,CAAC,CAAC;AAC9D,CAAC","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;
|
|
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"}
|
|
@@ -7,6 +7,7 @@ import { assert } from "@fluidframework/core-utils/internal";
|
|
|
7
7
|
* Base class to assist with implementing ReferenceCounted.
|
|
8
8
|
*/
|
|
9
9
|
export class ReferenceCountedBase {
|
|
10
|
+
// eslint-disable-next-line @typescript-eslint/prefer-readonly -- false positive; modified in multiple places
|
|
10
11
|
constructor(refCount = 1) {
|
|
11
12
|
this.refCount = refCount;
|
|
12
13
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"referenceCounting.js","sourceRoot":"","sources":["../../src/util/referenceCounting.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,MAAM,EAAE,MAAM,qCAAqC,CAAC;AAgC7D;;GAEG;AACH,MAAM,OAAgB,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,MAAM,CAAC,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","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,OAAO,EAAE,MAAM,EAAE,MAAM,qCAAqC,CAAC;AAgC7D;;GAEG;AACH,MAAM,OAAgB,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,MAAM,CAAC,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","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/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fluidframework/tree",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.71.0",
|
|
4
4
|
"description": "Distributed tree",
|
|
5
5
|
"homepage": "https://fluidframework.com",
|
|
6
6
|
"repository": {
|
|
@@ -101,17 +101,17 @@
|
|
|
101
101
|
"temp-directory": "nyc/.nyc_output"
|
|
102
102
|
},
|
|
103
103
|
"dependencies": {
|
|
104
|
-
"@fluid-internal/client-utils": "~2.
|
|
105
|
-
"@fluidframework/container-runtime": "~2.
|
|
106
|
-
"@fluidframework/core-interfaces": "~2.
|
|
107
|
-
"@fluidframework/core-utils": "~2.
|
|
108
|
-
"@fluidframework/datastore-definitions": "~2.
|
|
109
|
-
"@fluidframework/driver-definitions": "~2.
|
|
110
|
-
"@fluidframework/id-compressor": "~2.
|
|
111
|
-
"@fluidframework/runtime-definitions": "~2.
|
|
112
|
-
"@fluidframework/runtime-utils": "~2.
|
|
113
|
-
"@fluidframework/shared-object-base": "~2.
|
|
114
|
-
"@fluidframework/telemetry-utils": "~2.
|
|
104
|
+
"@fluid-internal/client-utils": "~2.71.0",
|
|
105
|
+
"@fluidframework/container-runtime": "~2.71.0",
|
|
106
|
+
"@fluidframework/core-interfaces": "~2.71.0",
|
|
107
|
+
"@fluidframework/core-utils": "~2.71.0",
|
|
108
|
+
"@fluidframework/datastore-definitions": "~2.71.0",
|
|
109
|
+
"@fluidframework/driver-definitions": "~2.71.0",
|
|
110
|
+
"@fluidframework/id-compressor": "~2.71.0",
|
|
111
|
+
"@fluidframework/runtime-definitions": "~2.71.0",
|
|
112
|
+
"@fluidframework/runtime-utils": "~2.71.0",
|
|
113
|
+
"@fluidframework/shared-object-base": "~2.71.0",
|
|
114
|
+
"@fluidframework/telemetry-utils": "~2.71.0",
|
|
115
115
|
"@sinclair/typebox": "^0.34.13",
|
|
116
116
|
"@tylerbu/sorted-btree-es6": "^1.8.0",
|
|
117
117
|
"@types/ungap__structured-clone": "^1.2.0",
|
|
@@ -122,20 +122,20 @@
|
|
|
122
122
|
"devDependencies": {
|
|
123
123
|
"@arethetypeswrong/cli": "^0.17.1",
|
|
124
124
|
"@biomejs/biome": "~1.9.3",
|
|
125
|
-
"@fluid-internal/mocha-test-setup": "~2.
|
|
126
|
-
"@fluid-private/stochastic-test-utils": "~2.
|
|
127
|
-
"@fluid-private/test-dds-utils": "~2.
|
|
128
|
-
"@fluid-private/test-drivers": "~2.
|
|
125
|
+
"@fluid-internal/mocha-test-setup": "~2.71.0",
|
|
126
|
+
"@fluid-private/stochastic-test-utils": "~2.71.0",
|
|
127
|
+
"@fluid-private/test-dds-utils": "~2.71.0",
|
|
128
|
+
"@fluid-private/test-drivers": "~2.71.0",
|
|
129
129
|
"@fluid-tools/benchmark": "^0.51.0",
|
|
130
130
|
"@fluid-tools/build-cli": "^0.58.3",
|
|
131
131
|
"@fluidframework/build-common": "^2.0.3",
|
|
132
132
|
"@fluidframework/build-tools": "^0.58.3",
|
|
133
|
-
"@fluidframework/container-definitions": "~2.
|
|
134
|
-
"@fluidframework/container-loader": "~2.
|
|
135
|
-
"@fluidframework/eslint-config-fluid": "^
|
|
136
|
-
"@fluidframework/test-runtime-utils": "~2.
|
|
137
|
-
"@fluidframework/test-utils": "~2.
|
|
138
|
-
"@fluidframework/tree-previous": "npm:@fluidframework/tree@2.
|
|
133
|
+
"@fluidframework/container-definitions": "~2.71.0",
|
|
134
|
+
"@fluidframework/container-loader": "~2.71.0",
|
|
135
|
+
"@fluidframework/eslint-config-fluid": "^7.0.0",
|
|
136
|
+
"@fluidframework/test-runtime-utils": "~2.71.0",
|
|
137
|
+
"@fluidframework/test-utils": "~2.71.0",
|
|
138
|
+
"@fluidframework/tree-previous": "npm:@fluidframework/tree@2.70.0",
|
|
139
139
|
"@microsoft/api-extractor": "7.52.11",
|
|
140
140
|
"@types/diff": "^3.5.1",
|
|
141
141
|
"@types/easy-table": "^0.0.32",
|
|
@@ -214,8 +214,8 @@
|
|
|
214
214
|
"clean": "rimraf --glob dist lib {alpha,beta,internal,legacy}.d.ts \"**/*.tsbuildinfo\" \"**/*.build.log\" _api-extractor-temp nyc",
|
|
215
215
|
"depcruise": "depcruise src/ --ignore-known",
|
|
216
216
|
"depcruise:regen-known-issues": "depcruise-baseline src",
|
|
217
|
-
"eslint": "eslint --format stylish src",
|
|
218
|
-
"eslint:fix": "eslint --format stylish src --fix --fix-type problem,suggestion,layout",
|
|
217
|
+
"eslint": "eslint --quiet --format stylish src",
|
|
218
|
+
"eslint:fix": "eslint --quiet --format stylish src --fix --fix-type problem,suggestion,layout",
|
|
219
219
|
"format": "npm run format:biome",
|
|
220
220
|
"format:biome": "biome check . --write",
|
|
221
221
|
"lint": "fluid-build . --task lint",
|
|
@@ -45,7 +45,7 @@ export type DiscriminatedUnionLibrary<
|
|
|
45
45
|
][_InlineTrick];
|
|
46
46
|
|
|
47
47
|
/**
|
|
48
|
-
* Applies a function to the content of a
|
|
48
|
+
* Applies a function to the content of a {@link https://en.wikipedia.org/wiki/Tagged_union | discriminated union}
|
|
49
49
|
* where the function to apply depends on which value from the union it holds.
|
|
50
50
|
*
|
|
51
51
|
* This uses a rather non-standard encoding of the union where it is an object with many differently named optional fields,
|
package/src/index.ts
CHANGED
|
@@ -73,6 +73,8 @@ export {
|
|
|
73
73
|
type ObservationResults,
|
|
74
74
|
type TreeIdentifierUtils,
|
|
75
75
|
independentView,
|
|
76
|
+
createIndependentTreeBeta,
|
|
77
|
+
createIndependentTreeAlpha,
|
|
76
78
|
ForestTypeOptimized,
|
|
77
79
|
ForestTypeExpensiveDebug,
|
|
78
80
|
ForestTypeReference,
|
|
@@ -280,6 +282,7 @@ export {
|
|
|
280
282
|
type TreeParsingOptions,
|
|
281
283
|
type SchemaFactory_base,
|
|
282
284
|
type NumberKeys,
|
|
285
|
+
type SimpleAllowedTypeAttributes,
|
|
283
286
|
} from "./simple-tree/index.js";
|
|
284
287
|
export {
|
|
285
288
|
SharedTree,
|
package/src/packageVersion.ts
CHANGED
|
@@ -12,11 +12,9 @@ import {
|
|
|
12
12
|
|
|
13
13
|
import type { ICodecOptions } from "../codec/index.js";
|
|
14
14
|
import {
|
|
15
|
-
type ITreeCursorSynchronous,
|
|
16
15
|
type RevisionTag,
|
|
17
16
|
RevisionTagCodec,
|
|
18
17
|
SchemaVersion,
|
|
19
|
-
type TreeStoredSchema,
|
|
20
18
|
TreeStoredSchemaRepository,
|
|
21
19
|
} from "../core/index.js";
|
|
22
20
|
import {
|
|
@@ -34,11 +32,23 @@ import type {
|
|
|
34
32
|
TreeViewConfiguration,
|
|
35
33
|
ImplicitFieldSchema,
|
|
36
34
|
TreeViewAlpha,
|
|
35
|
+
ITreeAlpha,
|
|
36
|
+
ViewableTree,
|
|
37
|
+
TreeView,
|
|
38
|
+
ReadSchema,
|
|
39
|
+
VerboseTree,
|
|
40
|
+
SimpleTreeSchema,
|
|
37
41
|
} from "../simple-tree/index.js";
|
|
38
|
-
import {
|
|
42
|
+
import {
|
|
43
|
+
type JsonCompatibleReadOnly,
|
|
44
|
+
type JsonCompatible,
|
|
45
|
+
Breakable,
|
|
46
|
+
oneFromIterable,
|
|
47
|
+
} from "../util/index.js";
|
|
39
48
|
import {
|
|
40
49
|
buildConfiguredForest,
|
|
41
50
|
defaultSharedTreeOptions,
|
|
51
|
+
exportSimpleSchema,
|
|
42
52
|
type ForestOptions,
|
|
43
53
|
} from "./sharedTree.js";
|
|
44
54
|
import { createTreeCheckout } from "./treeCheckout.js";
|
|
@@ -59,30 +69,9 @@ export function independentView<const TSchema extends ImplicitFieldSchema>(
|
|
|
59
69
|
config: TreeViewConfiguration<TSchema>,
|
|
60
70
|
options: ForestOptions & { idCompressor?: IIdCompressor | undefined },
|
|
61
71
|
): TreeViewAlpha<TSchema> {
|
|
62
|
-
|
|
63
|
-
const idCompressor: IIdCompressor = options.idCompressor ?? createIdCompressor();
|
|
64
|
-
const mintRevisionTag = (): RevisionTag => idCompressor.generateCompressedId();
|
|
65
|
-
const revisionTagCodec = new RevisionTagCodec(idCompressor);
|
|
66
|
-
const schema = new TreeStoredSchemaRepository();
|
|
67
|
-
const forest = buildConfiguredForest(
|
|
68
|
-
breaker,
|
|
69
|
-
options.forest ?? defaultSharedTreeOptions.forest,
|
|
70
|
-
schema,
|
|
71
|
-
idCompressor,
|
|
72
|
-
defaultIncrementalEncodingPolicy,
|
|
73
|
-
);
|
|
74
|
-
const checkout = createTreeCheckout(idCompressor, mintRevisionTag, revisionTagCodec, {
|
|
75
|
-
forest,
|
|
76
|
-
schema,
|
|
77
|
-
breaker,
|
|
78
|
-
});
|
|
79
|
-
const out: TreeViewAlpha<TSchema> = new SchematizingSimpleTreeView<TSchema>(
|
|
80
|
-
checkout,
|
|
81
|
-
config,
|
|
82
|
-
createNodeIdentifierManager(idCompressor),
|
|
83
|
-
);
|
|
84
|
-
return out;
|
|
72
|
+
return createIndependentTreeAlpha(options).viewWith(config) as TreeViewAlpha<TSchema>;
|
|
85
73
|
}
|
|
74
|
+
|
|
86
75
|
/**
|
|
87
76
|
* Create an initialized {@link TreeView} that is not tied to any {@link ITree} instance.
|
|
88
77
|
*
|
|
@@ -99,52 +88,101 @@ export function independentInitializedView<const TSchema extends ImplicitFieldSc
|
|
|
99
88
|
options: ForestOptions & ICodecOptions,
|
|
100
89
|
content: ViewContent,
|
|
101
90
|
): TreeViewAlpha<TSchema> {
|
|
102
|
-
|
|
103
|
-
const fieldBatchCodec = makeFieldBatchCodec(options, 1);
|
|
104
|
-
const schemaCodec = makeSchemaCodec(options, SchemaVersion.v1);
|
|
105
|
-
|
|
106
|
-
const schema = schemaCodec.decode(content.schema as Format);
|
|
107
|
-
const context: FieldBatchEncodingContext = {
|
|
108
|
-
encodeType: TreeCompressionStrategy.Compressed,
|
|
109
|
-
idCompressor,
|
|
110
|
-
originatorId: idCompressor.localSessionId, // Is this right? If so, why is is needed?
|
|
111
|
-
schema: { schema, policy: defaultSchemaPolicy },
|
|
112
|
-
};
|
|
113
|
-
|
|
114
|
-
const fieldCursors = fieldBatchCodec.decode(content.tree as JsonCompatibleReadOnly, context);
|
|
115
|
-
assert(fieldCursors.length === 1, 0xa5b /* must have exactly 1 field in batch */);
|
|
116
|
-
|
|
117
|
-
return independentInitializedViewInternal(
|
|
91
|
+
return createIndependentTreeAlpha({ ...options, content }).viewWith(
|
|
118
92
|
config,
|
|
119
|
-
|
|
120
|
-
schema,
|
|
121
|
-
// Checked above.
|
|
122
|
-
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
123
|
-
fieldCursors[0]!,
|
|
124
|
-
idCompressor,
|
|
125
|
-
);
|
|
93
|
+
) as TreeViewAlpha<TSchema>;
|
|
126
94
|
}
|
|
127
95
|
|
|
128
96
|
/**
|
|
129
|
-
* {@link
|
|
97
|
+
* Create a {@link ViewableTree} that is not tied to any Fluid runtimes or services.
|
|
98
|
+
*
|
|
99
|
+
* @remarks
|
|
100
|
+
* Such a tree can never experience collaboration or be persisted to to a Fluid Container.
|
|
101
|
+
*
|
|
102
|
+
* This can be useful for testing, as well as use-cases like working on local files instead of documents stored in some Fluid service.
|
|
103
|
+
*
|
|
104
|
+
* @example
|
|
105
|
+
* ```typescript
|
|
106
|
+
* const tree = createIndependentTreeBeta();
|
|
107
|
+
*
|
|
108
|
+
* const stagedConfig = new TreeViewConfiguration({
|
|
109
|
+
* schema: SchemaFactoryAlpha.types([
|
|
110
|
+
* SchemaFactory.number,
|
|
111
|
+
* SchemaFactoryAlpha.staged(SchemaFactory.string),
|
|
112
|
+
* ]),
|
|
113
|
+
* });
|
|
114
|
+
* const afterConfig = new TreeViewConfigurationAlpha({
|
|
115
|
+
* schema: [SchemaFactory.number, SchemaFactory.string],
|
|
116
|
+
* });
|
|
117
|
+
*
|
|
118
|
+
* // Initialize tree
|
|
119
|
+
* {
|
|
120
|
+
* const view = tree.viewWith(stagedConfig);
|
|
121
|
+
* view.initialize(1);
|
|
122
|
+
* view.dispose();
|
|
123
|
+
* }
|
|
124
|
+
*
|
|
125
|
+
* // Do schema upgrade
|
|
126
|
+
* {
|
|
127
|
+
* const view = tree.viewWith(afterConfig);
|
|
128
|
+
* view.upgradeSchema();
|
|
129
|
+
* view.root = "A";
|
|
130
|
+
* view.dispose();
|
|
131
|
+
* }
|
|
132
|
+
*
|
|
133
|
+
* // Can still view tree with staged schema
|
|
134
|
+
* {
|
|
135
|
+
* const view = tree.viewWith(stagedConfig);
|
|
136
|
+
* assert.equal(view.root, "A");
|
|
137
|
+
* view.dispose();
|
|
138
|
+
* }
|
|
139
|
+
* ```
|
|
140
|
+
* @privateRemarks
|
|
141
|
+
* Before stabilizing this as public, consider if we can instead just expose a better way to create regular Fluid service based SharedTrees for tests.
|
|
142
|
+
* Something like https://github.com/microsoft/FluidFramework/pull/25422 might be a better long term stable/public solution.
|
|
143
|
+
* @beta
|
|
130
144
|
*/
|
|
131
|
-
export function
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
145
|
+
export function createIndependentTreeBeta<const TSchema extends ImplicitFieldSchema>(
|
|
146
|
+
options?: ForestOptions,
|
|
147
|
+
): ViewableTree {
|
|
148
|
+
return createIndependentTreeAlpha<TSchema>(options);
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
/**
|
|
152
|
+
* Alpha extensions to {@link createIndependentTreeBeta}.
|
|
153
|
+
*
|
|
154
|
+
* @param options - Configuration options for the independent tree.
|
|
155
|
+
* This can be used to create an uninitialized tree, or `content` can be provided to create an initialized tree.
|
|
156
|
+
* If content is provided, the idCompressor is a required part of it: otherwise it is optional and provided at the top level.
|
|
157
|
+
*
|
|
158
|
+
* @privateRemarks
|
|
159
|
+
* TODO: Support more of {@link ITreeAlpha}, including branching APIs to allow for merges.
|
|
160
|
+
* TODO: Better unify this logic with SharedTreeKernel and SharedTreeCore.
|
|
161
|
+
*
|
|
162
|
+
* Before further stabilizing: consider better ways to handle initialized vs uninitialized trees.
|
|
163
|
+
* 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?
|
|
164
|
+
* If keeping the option here, maybe a separate function of overload would be better? Or maybe flatten ViewContent inline to deduplicate the idCompressor options?
|
|
165
|
+
* @alpha
|
|
166
|
+
*/
|
|
167
|
+
export function createIndependentTreeAlpha<const TSchema extends ImplicitFieldSchema>(
|
|
168
|
+
options?: ForestOptions &
|
|
169
|
+
(
|
|
170
|
+
| ({ idCompressor?: IIdCompressor | undefined } & { content?: undefined })
|
|
171
|
+
| (ICodecOptions & { content: ViewContent } & { idCompressor?: undefined })
|
|
172
|
+
),
|
|
173
|
+
): ViewableTree & Pick<ITreeAlpha, "exportVerbose" | "exportSimpleSchema"> {
|
|
174
|
+
const breaker = new Breakable("independentView");
|
|
175
|
+
const idCompressor: IIdCompressor =
|
|
176
|
+
options?.idCompressor ?? options?.content?.idCompressor ?? createIdCompressor();
|
|
140
177
|
const mintRevisionTag = (): RevisionTag => idCompressor.generateCompressedId();
|
|
178
|
+
const revisionTagCodec = new RevisionTagCodec(idCompressor);
|
|
141
179
|
|
|
142
180
|
// To ensure the forest is in schema when constructed, start it with an empty schema and set the schema repository content later.
|
|
143
181
|
const schemaRepository = new TreeStoredSchemaRepository();
|
|
144
182
|
|
|
145
183
|
const forest = buildConfiguredForest(
|
|
146
184
|
breaker,
|
|
147
|
-
options
|
|
185
|
+
options?.forest ?? defaultSharedTreeOptions.forest,
|
|
148
186
|
schemaRepository,
|
|
149
187
|
idCompressor,
|
|
150
188
|
defaultIncrementalEncodingPolicy,
|
|
@@ -156,18 +194,55 @@ export function independentInitializedViewInternal<const TSchema extends Implici
|
|
|
156
194
|
breaker,
|
|
157
195
|
});
|
|
158
196
|
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
197
|
+
if (options?.content !== undefined) {
|
|
198
|
+
const schemaCodec = makeSchemaCodec(options, SchemaVersion.v1);
|
|
199
|
+
const fieldBatchCodec = makeFieldBatchCodec(options, 1);
|
|
200
|
+
const newSchema = schemaCodec.decode(options.content.schema as Format);
|
|
201
|
+
|
|
202
|
+
const context: FieldBatchEncodingContext = {
|
|
203
|
+
encodeType: TreeCompressionStrategy.Compressed,
|
|
204
|
+
idCompressor,
|
|
205
|
+
originatorId: idCompressor.localSessionId, // Is this right? If so, why is is needed?
|
|
206
|
+
schema: { schema: newSchema, policy: defaultSchemaPolicy },
|
|
207
|
+
};
|
|
208
|
+
const fieldCursors = fieldBatchCodec.decode(
|
|
209
|
+
options.content.tree as JsonCompatibleReadOnly,
|
|
210
|
+
context,
|
|
211
|
+
);
|
|
212
|
+
assert(fieldCursors.length === 1, 0xa5b /* must have exactly 1 field in batch */);
|
|
213
|
+
|
|
214
|
+
const fieldCursor = oneFromIterable(fieldCursors);
|
|
215
|
+
assert(fieldCursor !== undefined, 0xc94 /* expected exactly one field in batch */);
|
|
216
|
+
|
|
217
|
+
initialize(
|
|
218
|
+
checkout,
|
|
219
|
+
newSchema,
|
|
220
|
+
initializerFromChunk(checkout, () =>
|
|
221
|
+
combineChunks(checkout.forest.chunkField(fieldCursor)),
|
|
222
|
+
),
|
|
223
|
+
);
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
return {
|
|
227
|
+
viewWith<TRoot extends ImplicitFieldSchema>(
|
|
228
|
+
config: TreeViewConfiguration<TRoot>,
|
|
229
|
+
): TreeView<TRoot> {
|
|
230
|
+
const out: TreeViewAlpha<TSchema> = new SchematizingSimpleTreeView<TSchema>(
|
|
231
|
+
checkout,
|
|
232
|
+
config as TreeViewConfiguration as TreeViewConfiguration<ReadSchema<TSchema>>,
|
|
233
|
+
createNodeIdentifierManager(idCompressor),
|
|
234
|
+
);
|
|
235
|
+
return out as unknown as TreeView<TRoot>;
|
|
236
|
+
},
|
|
237
|
+
|
|
238
|
+
exportVerbose(): VerboseTree | undefined {
|
|
239
|
+
return checkout.exportVerbose();
|
|
240
|
+
},
|
|
241
|
+
|
|
242
|
+
exportSimpleSchema(): SimpleTreeSchema {
|
|
243
|
+
return exportSimpleSchema(checkout.storedSchema);
|
|
244
|
+
},
|
|
245
|
+
};
|
|
171
246
|
}
|
|
172
247
|
|
|
173
248
|
/**
|
package/src/shared-tree/index.ts
CHANGED
|
@@ -39,6 +39,8 @@ export {
|
|
|
39
39
|
|
|
40
40
|
export { SchematizingSimpleTreeView } from "./schematizingTreeView.js";
|
|
41
41
|
|
|
42
|
+
export { initialize, initializerFromChunk } from "./schematizeTree.js";
|
|
43
|
+
|
|
42
44
|
export type {
|
|
43
45
|
ISharedTreeEditor,
|
|
44
46
|
ISchemaEditor,
|
|
@@ -58,6 +60,8 @@ export {
|
|
|
58
60
|
independentInitializedView,
|
|
59
61
|
type ViewContent,
|
|
60
62
|
independentView,
|
|
63
|
+
createIndependentTreeBeta,
|
|
64
|
+
createIndependentTreeAlpha,
|
|
61
65
|
} from "./independentView.js";
|
|
62
66
|
|
|
63
67
|
export type { SharedTreeChange } from "./sharedTreeChangeTypes.js";
|
|
@@ -42,6 +42,7 @@ import {
|
|
|
42
42
|
type TreeStoredSchema,
|
|
43
43
|
TreeStoredSchemaRepository,
|
|
44
44
|
type TreeStoredSchemaSubscription,
|
|
45
|
+
type TreeTypeSet,
|
|
45
46
|
getCodecTreeForDetachedFieldIndexFormat,
|
|
46
47
|
makeDetachedFieldIndex,
|
|
47
48
|
moveToDetachedField,
|
|
@@ -98,6 +99,7 @@ import {
|
|
|
98
99
|
FieldKind,
|
|
99
100
|
type ITreeAlpha,
|
|
100
101
|
type SimpleObjectFieldSchema,
|
|
102
|
+
type SimpleAllowedTypeAttributes,
|
|
101
103
|
} from "../simple-tree/index.js";
|
|
102
104
|
|
|
103
105
|
import { SchematizingSimpleTreeView } from "./schematizingTreeView.js";
|
|
@@ -952,6 +954,24 @@ export const defaultSharedTreeOptions: Required<SharedTreeOptionsInternal> = {
|
|
|
952
954
|
shouldEncodeIncrementally: defaultIncrementalEncodingPolicy,
|
|
953
955
|
};
|
|
954
956
|
|
|
957
|
+
/**
|
|
958
|
+
* Build the allowed types for a Stored Schema.
|
|
959
|
+
*
|
|
960
|
+
* @remarks Staged upgrades do not apply to stored schemas, so we omit the {@link SimpleAllowedTypeAttributes.isStaged | staging flag } when building {@link SimpleAllowedTypeAttributes}.
|
|
961
|
+
* @param types - The types to create allowed types for.
|
|
962
|
+
* @returns The allowed types.
|
|
963
|
+
*/
|
|
964
|
+
function buildSimpleAllowedTypeAttributesForStoredSchema(
|
|
965
|
+
types: TreeTypeSet,
|
|
966
|
+
): ReadonlyMap<string, SimpleAllowedTypeAttributes> {
|
|
967
|
+
const allowedTypesInfo = new Map<string, SimpleAllowedTypeAttributes>();
|
|
968
|
+
for (const type of types) {
|
|
969
|
+
// Stored schemas do not have staged upgrades
|
|
970
|
+
allowedTypesInfo.set(type, { isStaged: undefined });
|
|
971
|
+
}
|
|
972
|
+
return allowedTypesInfo;
|
|
973
|
+
}
|
|
974
|
+
|
|
955
975
|
function exportSimpleFieldSchemaStored(schema: TreeFieldStoredSchema): SimpleFieldSchema {
|
|
956
976
|
let kind: FieldKind;
|
|
957
977
|
switch (schema.kind) {
|
|
@@ -973,7 +993,7 @@ function exportSimpleFieldSchemaStored(schema: TreeFieldStoredSchema): SimpleFie
|
|
|
973
993
|
}
|
|
974
994
|
return {
|
|
975
995
|
kind,
|
|
976
|
-
|
|
996
|
+
simpleAllowedTypes: buildSimpleAllowedTypeAttributesForStoredSchema(schema.types),
|
|
977
997
|
metadata: {},
|
|
978
998
|
persistedMetadata: schema.persistedMetadata,
|
|
979
999
|
};
|
|
@@ -989,7 +1009,7 @@ function exportSimpleNodeSchemaStored(schema: TreeNodeStoredSchema): SimpleNodeS
|
|
|
989
1009
|
if (arrayTypes !== undefined) {
|
|
990
1010
|
return {
|
|
991
1011
|
kind: NodeKind.Array,
|
|
992
|
-
|
|
1012
|
+
simpleAllowedTypes: buildSimpleAllowedTypeAttributesForStoredSchema(arrayTypes),
|
|
993
1013
|
metadata: {},
|
|
994
1014
|
persistedMetadata: schema.metadata,
|
|
995
1015
|
};
|
|
@@ -1008,7 +1028,9 @@ function exportSimpleNodeSchemaStored(schema: TreeNodeStoredSchema): SimpleNodeS
|
|
|
1008
1028
|
);
|
|
1009
1029
|
return {
|
|
1010
1030
|
kind: NodeKind.Map,
|
|
1011
|
-
|
|
1031
|
+
simpleAllowedTypes: buildSimpleAllowedTypeAttributesForStoredSchema(
|
|
1032
|
+
schema.mapFields.types,
|
|
1033
|
+
),
|
|
1012
1034
|
metadata: {},
|
|
1013
1035
|
persistedMetadata: schema.metadata,
|
|
1014
1036
|
};
|
|
@@ -245,7 +245,7 @@ export const SchemaFactory_base = classWithStatics(schemaStaticsPublic);
|
|
|
245
245
|
*
|
|
246
246
|
* 4. Additional static members added to schema should pick relatively unique keys to reduce the risk of colliding with implementation details what are not exposed in the API.
|
|
247
247
|
*
|
|
248
|
-
* 5. If exporting the schema from a package which uses API-Extractor, export the base class and derived class separately to work around
|
|
248
|
+
* 5. If exporting the schema from a package which uses API-Extractor, export the base class and derived class separately to work around {@link https://github.com/microsoft/rushstack/issues/4429 | a known limitation}.
|
|
249
249
|
*
|
|
250
250
|
* Note:
|
|
251
251
|
* POJO stands for Plain Old JavaScript Object.
|
|
@@ -293,7 +293,7 @@ export const SchemaFactory_base = classWithStatics(schemaStaticsPublic);
|
|
|
293
293
|
*
|
|
294
294
|
* 8. IntelliSense: Shows internal type generation logic: `object & TreeNode & ObjectFromSchemaRecord<{}> & WithType<"test.x">`.
|
|
295
295
|
*
|
|
296
|
-
* 9. Recursion: Unsupported:
|
|
296
|
+
* 9. Recursion: Unsupported: {@link https://github.com/microsoft/TypeScript/issues/55832 | Generated `.d.ts` files replace recursive references with `any`},
|
|
297
297
|
* breaking the use of recursive schema across compilation boundaries.
|
|
298
298
|
*
|
|
299
299
|
* Note that while "POJO Emulation" nodes act a lot like POJO objects, they are not true POJO objects:
|
|
@@ -182,6 +182,7 @@ export type ValidateRecursiveSchemaTemplate<T extends TreeNodeSchemaClass> =
|
|
|
182
182
|
}[T["kind"]]
|
|
183
183
|
>;
|
|
184
184
|
|
|
185
|
+
/* eslint-disable @fluid-internal/fluid/no-hyphen-after-jsdoc-tag -- false positive AB#50920 */
|
|
185
186
|
/**
|
|
186
187
|
* Workaround for "Type instantiation is excessively deep and possibly infinite.ts" errors.
|
|
187
188
|
* @remarks
|
|
@@ -239,6 +240,7 @@ export type ValidateRecursiveSchemaTemplate<T extends TreeNodeSchemaClass> =
|
|
|
239
240
|
*/
|
|
240
241
|
export type FixRecursiveRecursionLimit<T extends TreeNodeSchemaClass> =
|
|
241
242
|
T extends ValidateRecursiveSchemaTemplate<T> ? undefined : undefined;
|
|
243
|
+
/* eslint-enable @fluid-internal/fluid/no-hyphen-after-jsdoc-tag */
|
|
242
244
|
|
|
243
245
|
/**
|
|
244
246
|
* Does nothing with the provided value, but appears to use it to make unused locals warnings and errors go away.
|