@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
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* Licensed under the MIT License.
|
|
5
5
|
*/
|
|
6
6
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
-
exports.
|
|
7
|
+
exports.createIndependentTreeAlpha = exports.createIndependentTreeBeta = exports.independentInitializedView = exports.independentView = void 0;
|
|
8
8
|
const internal_1 = require("@fluidframework/core-utils/internal");
|
|
9
9
|
const internal_2 = require("@fluidframework/id-compressor/internal");
|
|
10
10
|
const index_js_1 = require("../core/index.js");
|
|
@@ -25,19 +25,7 @@ const index_js_4 = require("../feature-libraries/index.js");
|
|
|
25
25
|
* @alpha
|
|
26
26
|
*/
|
|
27
27
|
function independentView(config, options) {
|
|
28
|
-
|
|
29
|
-
const idCompressor = options.idCompressor ?? (0, internal_2.createIdCompressor)();
|
|
30
|
-
const mintRevisionTag = () => idCompressor.generateCompressedId();
|
|
31
|
-
const revisionTagCodec = new index_js_1.RevisionTagCodec(idCompressor);
|
|
32
|
-
const schema = new index_js_1.TreeStoredSchemaRepository();
|
|
33
|
-
const forest = (0, sharedTree_js_1.buildConfiguredForest)(breaker, options.forest ?? sharedTree_js_1.defaultSharedTreeOptions.forest, schema, idCompressor, index_js_2.defaultIncrementalEncodingPolicy);
|
|
34
|
-
const checkout = (0, treeCheckout_js_1.createTreeCheckout)(idCompressor, mintRevisionTag, revisionTagCodec, {
|
|
35
|
-
forest,
|
|
36
|
-
schema,
|
|
37
|
-
breaker,
|
|
38
|
-
});
|
|
39
|
-
const out = new schematizingTreeView_js_1.SchematizingSimpleTreeView(checkout, config, (0, index_js_2.createNodeIdentifierManager)(idCompressor));
|
|
40
|
-
return out;
|
|
28
|
+
return createIndependentTreeAlpha(options).viewWith(config);
|
|
41
29
|
}
|
|
42
30
|
exports.independentView = independentView;
|
|
43
31
|
/**
|
|
@@ -52,41 +40,119 @@ exports.independentView = independentView;
|
|
|
52
40
|
* @alpha
|
|
53
41
|
*/
|
|
54
42
|
function independentInitializedView(config, options, content) {
|
|
55
|
-
|
|
56
|
-
const fieldBatchCodec = (0, index_js_2.makeFieldBatchCodec)(options, 1);
|
|
57
|
-
const schemaCodec = (0, index_js_2.makeSchemaCodec)(options, index_js_1.SchemaVersion.v1);
|
|
58
|
-
const schema = schemaCodec.decode(content.schema);
|
|
59
|
-
const context = {
|
|
60
|
-
encodeType: index_js_2.TreeCompressionStrategy.Compressed,
|
|
61
|
-
idCompressor,
|
|
62
|
-
originatorId: idCompressor.localSessionId, // Is this right? If so, why is is needed?
|
|
63
|
-
schema: { schema, policy: index_js_2.defaultSchemaPolicy },
|
|
64
|
-
};
|
|
65
|
-
const fieldCursors = fieldBatchCodec.decode(content.tree, context);
|
|
66
|
-
(0, internal_1.assert)(fieldCursors.length === 1, 0xa5b /* must have exactly 1 field in batch */);
|
|
67
|
-
return independentInitializedViewInternal(config, options, schema,
|
|
68
|
-
// Checked above.
|
|
69
|
-
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
70
|
-
fieldCursors[0], idCompressor);
|
|
43
|
+
return createIndependentTreeAlpha({ ...options, content }).viewWith(config);
|
|
71
44
|
}
|
|
72
45
|
exports.independentInitializedView = independentInitializedView;
|
|
73
46
|
/**
|
|
74
|
-
* {@link
|
|
47
|
+
* Create a {@link ViewableTree} that is not tied to any Fluid runtimes or services.
|
|
48
|
+
*
|
|
49
|
+
* @remarks
|
|
50
|
+
* Such a tree can never experience collaboration or be persisted to to a Fluid Container.
|
|
51
|
+
*
|
|
52
|
+
* This can be useful for testing, as well as use-cases like working on local files instead of documents stored in some Fluid service.
|
|
53
|
+
*
|
|
54
|
+
* @example
|
|
55
|
+
* ```typescript
|
|
56
|
+
* const tree = createIndependentTreeBeta();
|
|
57
|
+
*
|
|
58
|
+
* const stagedConfig = new TreeViewConfiguration({
|
|
59
|
+
* schema: SchemaFactoryAlpha.types([
|
|
60
|
+
* SchemaFactory.number,
|
|
61
|
+
* SchemaFactoryAlpha.staged(SchemaFactory.string),
|
|
62
|
+
* ]),
|
|
63
|
+
* });
|
|
64
|
+
* const afterConfig = new TreeViewConfigurationAlpha({
|
|
65
|
+
* schema: [SchemaFactory.number, SchemaFactory.string],
|
|
66
|
+
* });
|
|
67
|
+
*
|
|
68
|
+
* // Initialize tree
|
|
69
|
+
* {
|
|
70
|
+
* const view = tree.viewWith(stagedConfig);
|
|
71
|
+
* view.initialize(1);
|
|
72
|
+
* view.dispose();
|
|
73
|
+
* }
|
|
74
|
+
*
|
|
75
|
+
* // Do schema upgrade
|
|
76
|
+
* {
|
|
77
|
+
* const view = tree.viewWith(afterConfig);
|
|
78
|
+
* view.upgradeSchema();
|
|
79
|
+
* view.root = "A";
|
|
80
|
+
* view.dispose();
|
|
81
|
+
* }
|
|
82
|
+
*
|
|
83
|
+
* // Can still view tree with staged schema
|
|
84
|
+
* {
|
|
85
|
+
* const view = tree.viewWith(stagedConfig);
|
|
86
|
+
* assert.equal(view.root, "A");
|
|
87
|
+
* view.dispose();
|
|
88
|
+
* }
|
|
89
|
+
* ```
|
|
90
|
+
* @privateRemarks
|
|
91
|
+
* Before stabilizing this as public, consider if we can instead just expose a better way to create regular Fluid service based SharedTrees for tests.
|
|
92
|
+
* Something like https://github.com/microsoft/FluidFramework/pull/25422 might be a better long term stable/public solution.
|
|
93
|
+
* @beta
|
|
94
|
+
*/
|
|
95
|
+
function createIndependentTreeBeta(options) {
|
|
96
|
+
return createIndependentTreeAlpha(options);
|
|
97
|
+
}
|
|
98
|
+
exports.createIndependentTreeBeta = createIndependentTreeBeta;
|
|
99
|
+
/**
|
|
100
|
+
* Alpha extensions to {@link createIndependentTreeBeta}.
|
|
101
|
+
*
|
|
102
|
+
* @param options - Configuration options for the independent tree.
|
|
103
|
+
* This can be used to create an uninitialized tree, or `content` can be provided to create an initialized tree.
|
|
104
|
+
* If content is provided, the idCompressor is a required part of it: otherwise it is optional and provided at the top level.
|
|
105
|
+
*
|
|
106
|
+
* @privateRemarks
|
|
107
|
+
* TODO: Support more of {@link ITreeAlpha}, including branching APIs to allow for merges.
|
|
108
|
+
* TODO: Better unify this logic with SharedTreeKernel and SharedTreeCore.
|
|
109
|
+
*
|
|
110
|
+
* Before further stabilizing: consider better ways to handle initialized vs uninitialized trees.
|
|
111
|
+
* 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?
|
|
112
|
+
* If keeping the option here, maybe a separate function of overload would be better? Or maybe flatten ViewContent inline to deduplicate the idCompressor options?
|
|
113
|
+
* @alpha
|
|
75
114
|
*/
|
|
76
|
-
function
|
|
77
|
-
const breaker = new index_js_3.Breakable("
|
|
78
|
-
const
|
|
115
|
+
function createIndependentTreeAlpha(options) {
|
|
116
|
+
const breaker = new index_js_3.Breakable("independentView");
|
|
117
|
+
const idCompressor = options?.idCompressor ?? options?.content?.idCompressor ?? (0, internal_2.createIdCompressor)();
|
|
79
118
|
const mintRevisionTag = () => idCompressor.generateCompressedId();
|
|
119
|
+
const revisionTagCodec = new index_js_1.RevisionTagCodec(idCompressor);
|
|
80
120
|
// To ensure the forest is in schema when constructed, start it with an empty schema and set the schema repository content later.
|
|
81
121
|
const schemaRepository = new index_js_1.TreeStoredSchemaRepository();
|
|
82
|
-
const forest = (0, sharedTree_js_1.buildConfiguredForest)(breaker, options
|
|
122
|
+
const forest = (0, sharedTree_js_1.buildConfiguredForest)(breaker, options?.forest ?? sharedTree_js_1.defaultSharedTreeOptions.forest, schemaRepository, idCompressor, index_js_2.defaultIncrementalEncodingPolicy);
|
|
83
123
|
const checkout = (0, treeCheckout_js_1.createTreeCheckout)(idCompressor, mintRevisionTag, revisionTagCodec, {
|
|
84
124
|
forest,
|
|
85
125
|
schema: schemaRepository,
|
|
86
126
|
breaker,
|
|
87
127
|
});
|
|
88
|
-
|
|
89
|
-
|
|
128
|
+
if (options?.content !== undefined) {
|
|
129
|
+
const schemaCodec = (0, index_js_2.makeSchemaCodec)(options, index_js_1.SchemaVersion.v1);
|
|
130
|
+
const fieldBatchCodec = (0, index_js_2.makeFieldBatchCodec)(options, 1);
|
|
131
|
+
const newSchema = schemaCodec.decode(options.content.schema);
|
|
132
|
+
const context = {
|
|
133
|
+
encodeType: index_js_2.TreeCompressionStrategy.Compressed,
|
|
134
|
+
idCompressor,
|
|
135
|
+
originatorId: idCompressor.localSessionId, // Is this right? If so, why is is needed?
|
|
136
|
+
schema: { schema: newSchema, policy: index_js_2.defaultSchemaPolicy },
|
|
137
|
+
};
|
|
138
|
+
const fieldCursors = fieldBatchCodec.decode(options.content.tree, context);
|
|
139
|
+
(0, internal_1.assert)(fieldCursors.length === 1, 0xa5b /* must have exactly 1 field in batch */);
|
|
140
|
+
const fieldCursor = (0, index_js_3.oneFromIterable)(fieldCursors);
|
|
141
|
+
(0, internal_1.assert)(fieldCursor !== undefined, 0xc94 /* expected exactly one field in batch */);
|
|
142
|
+
(0, schematizeTree_js_1.initialize)(checkout, newSchema, (0, schematizeTree_js_1.initializerFromChunk)(checkout, () => (0, index_js_4.combineChunks)(checkout.forest.chunkField(fieldCursor))));
|
|
143
|
+
}
|
|
144
|
+
return {
|
|
145
|
+
viewWith(config) {
|
|
146
|
+
const out = new schematizingTreeView_js_1.SchematizingSimpleTreeView(checkout, config, (0, index_js_2.createNodeIdentifierManager)(idCompressor));
|
|
147
|
+
return out;
|
|
148
|
+
},
|
|
149
|
+
exportVerbose() {
|
|
150
|
+
return checkout.exportVerbose();
|
|
151
|
+
},
|
|
152
|
+
exportSimpleSchema() {
|
|
153
|
+
return (0, sharedTree_js_1.exportSimpleSchema)(checkout.storedSchema);
|
|
154
|
+
},
|
|
155
|
+
};
|
|
90
156
|
}
|
|
91
|
-
exports.
|
|
157
|
+
exports.createIndependentTreeAlpha = createIndependentTreeAlpha;
|
|
92
158
|
//# sourceMappingURL=independentView.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"independentView.js","sourceRoot":"","sources":["../../src/shared-tree/independentView.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAGH,kEAA6D;AAC7D,qEAGgD;AAGhD,+CAO0B;AAC1B,4DAQuC;AAQvC,+CAA+F;AAC/F,mDAIyB;AACzB,uDAAuD;AACvD,uEAAuE;AACvE,2DAAuE;AACvE,4DAA8D;AAE9D;;;;;;;;GAQG;AACH,SAAgB,eAAe,CAC9B,MAAsC,EACtC,OAAqE;IAErE,MAAM,OAAO,GAAG,IAAI,oBAAS,CAAC,iBAAiB,CAAC,CAAC;IACjD,MAAM,YAAY,GAAkB,OAAO,CAAC,YAAY,IAAI,IAAA,6BAAkB,GAAE,CAAC;IACjF,MAAM,eAAe,GAAG,GAAgB,EAAE,CAAC,YAAY,CAAC,oBAAoB,EAAE,CAAC;IAC/E,MAAM,gBAAgB,GAAG,IAAI,2BAAgB,CAAC,YAAY,CAAC,CAAC;IAC5D,MAAM,MAAM,GAAG,IAAI,qCAA0B,EAAE,CAAC;IAChD,MAAM,MAAM,GAAG,IAAA,qCAAqB,EACnC,OAAO,EACP,OAAO,CAAC,MAAM,IAAI,wCAAwB,CAAC,MAAM,EACjD,MAAM,EACN,YAAY,EACZ,2CAAgC,CAChC,CAAC;IACF,MAAM,QAAQ,GAAG,IAAA,oCAAkB,EAAC,YAAY,EAAE,eAAe,EAAE,gBAAgB,EAAE;QACpF,MAAM;QACN,MAAM;QACN,OAAO;KACP,CAAC,CAAC;IACH,MAAM,GAAG,GAA2B,IAAI,oDAA0B,CACjE,QAAQ,EACR,MAAM,EACN,IAAA,sCAA2B,EAAC,YAAY,CAAC,CACzC,CAAC;IACF,OAAO,GAAG,CAAC;AACZ,CAAC;AA3BD,0CA2BC;AACD;;;;;;;;;;GAUG;AACH,SAAgB,0BAA0B,CACzC,MAAsC,EACtC,OAAsC,EACtC,OAAoB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AAM,MAAM,GAAG,IAAA,qCAAqB,EACnC,OAAO,EACP,OAAO,CAAC,MAAM,IAAI,wCAAwB,CAAC,MAAM,EACjD,gBAAgB,EAChB,YAAY,EACZ,2CAAgC,CAChC,CAAC;IAEF,MAAM,QAAQ,GAAG,IAAA,oCAAkB,EAAC,YAAY,EAAE,eAAe,EAAE,gBAAgB,EAAE;QACpF,MAAM;QACN,MAAM,EAAE,gBAAgB;QACxB,OAAO;KACP,CAAC,CAAC;IAEH,IAAA,8BAAU,EACT,QAAQ,EACR,MAAM,EACN,IAAA,wCAAoB,EAAC,QAAQ,EAAE,GAAG,EAAE,CACnC,IAAA,wBAAa,EAAC,QAAQ,CAAC,MAAM,CAAC,UAAU,CAAC,eAAe,CAAC,CAAC,CAC1D,CACD,CAAC;IACF,OAAO,IAAI,oDAA0B,CACpC,QAAQ,EACR,MAAM,EACN,IAAA,sCAA2B,EAAC,YAAY,CAAC,CACzC,CAAC;AACH,CAAC;AAxCD,gFAwCC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport type { IFluidHandle } from \"@fluidframework/core-interfaces\";\nimport { assert } from \"@fluidframework/core-utils/internal\";\nimport {\n\ttype IIdCompressor,\n\tcreateIdCompressor,\n} from \"@fluidframework/id-compressor/internal\";\n\nimport type { ICodecOptions } from \"../codec/index.js\";\nimport {\n\ttype ITreeCursorSynchronous,\n\ttype RevisionTag,\n\tRevisionTagCodec,\n\tSchemaVersion,\n\ttype TreeStoredSchema,\n\tTreeStoredSchemaRepository,\n} from \"../core/index.js\";\nimport {\n\tcreateNodeIdentifierManager,\n\tmakeFieldBatchCodec,\n\tmakeSchemaCodec,\n\ttype FieldBatchEncodingContext,\n\tdefaultSchemaPolicy,\n\tTreeCompressionStrategy,\n\tdefaultIncrementalEncodingPolicy,\n} from \"../feature-libraries/index.js\";\n// eslint-disable-next-line import/no-internal-modules\nimport type { Format } from \"../feature-libraries/schema-index/formatV1.js\";\nimport type {\n\tTreeViewConfiguration,\n\tImplicitFieldSchema,\n\tTreeViewAlpha,\n} from \"../simple-tree/index.js\";\nimport { type JsonCompatibleReadOnly, type JsonCompatible, Breakable } from \"../util/index.js\";\nimport {\n\tbuildConfiguredForest,\n\tdefaultSharedTreeOptions,\n\ttype ForestOptions,\n} from \"./sharedTree.js\";\nimport { createTreeCheckout } from \"./treeCheckout.js\";\nimport { SchematizingSimpleTreeView } from \"./schematizingTreeView.js\";\nimport { initialize, initializerFromChunk } from \"./schematizeTree.js\";\nimport { combineChunks } from \"../feature-libraries/index.js\";\n\n/**\n * Create an uninitialized {@link TreeView} that is not tied to any {@link ITree} instance.\n *\n * @remarks\n * Such a view can never experience collaboration or be persisted to to a Fluid Container.\n *\n * This can be useful for testing, as well as use-cases like working on local files instead of documents stored in some Fluid service.\n * @alpha\n */\nexport function independentView<const TSchema extends ImplicitFieldSchema>(\n\tconfig: TreeViewConfiguration<TSchema>,\n\toptions: ForestOptions & { idCompressor?: IIdCompressor | undefined },\n): TreeViewAlpha<TSchema> {\n\tconst breaker = new Breakable(\"independentView\");\n\tconst idCompressor: IIdCompressor = options.idCompressor ?? createIdCompressor();\n\tconst mintRevisionTag = (): RevisionTag => idCompressor.generateCompressedId();\n\tconst revisionTagCodec = new RevisionTagCodec(idCompressor);\n\tconst schema = new TreeStoredSchemaRepository();\n\tconst forest = buildConfiguredForest(\n\t\tbreaker,\n\t\toptions.forest ?? defaultSharedTreeOptions.forest,\n\t\tschema,\n\t\tidCompressor,\n\t\tdefaultIncrementalEncodingPolicy,\n\t);\n\tconst checkout = createTreeCheckout(idCompressor, mintRevisionTag, revisionTagCodec, {\n\t\tforest,\n\t\tschema,\n\t\tbreaker,\n\t});\n\tconst out: TreeViewAlpha<TSchema> = new SchematizingSimpleTreeView<TSchema>(\n\t\tcheckout,\n\t\tconfig,\n\t\tcreateNodeIdentifierManager(idCompressor),\n\t);\n\treturn out;\n}\n/**\n * Create an initialized {@link TreeView} that is not tied to any {@link ITree} instance.\n *\n * @remarks\n * Such a view can never experience collaboration or be persisted to to a Fluid Container.\n *\n * This can be useful for testing, as well as use-cases like working on local files instead of documents stored in some Fluid service.\n * @privateRemarks\n * TODO: Providing an API which generates a {@link ViewableTree} extended with export options from {@link ITreeAlpha} and maybe even branching APIs would likely be better that just exposing a {@link TreeViewAlpha}.\n * @alpha\n */\nexport function independentInitializedView<const TSchema extends ImplicitFieldSchema>(\n\tconfig: TreeViewConfiguration<TSchema>,\n\toptions: ForestOptions & ICodecOptions,\n\tcontent: ViewContent,\n): TreeViewAlpha<TSchema> {\n\tconst idCompressor: IIdCompressor = content.idCompressor;\n\tconst fieldBatchCodec = makeFieldBatchCodec(options, 1);\n\tconst schemaCodec = makeSchemaCodec(options, SchemaVersion.v1);\n\n\tconst schema = schemaCodec.decode(content.schema as Format);\n\tconst context: FieldBatchEncodingContext = {\n\t\tencodeType: TreeCompressionStrategy.Compressed,\n\t\tidCompressor,\n\t\toriginatorId: idCompressor.localSessionId, // Is this right? If so, why is is needed?\n\t\tschema: { schema, policy: defaultSchemaPolicy },\n\t};\n\n\tconst fieldCursors = fieldBatchCodec.decode(content.tree as JsonCompatibleReadOnly, context);\n\tassert(fieldCursors.length === 1, 0xa5b /* must have exactly 1 field in batch */);\n\n\treturn independentInitializedViewInternal(\n\t\tconfig,\n\t\toptions,\n\t\tschema,\n\t\t// Checked above.\n\t\t// eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n\t\tfieldCursors[0]!,\n\t\tidCompressor,\n\t);\n}\n\n/**\n * {@link independentInitializedView} but using internal types instead of persisted data formats.\n */\nexport function independentInitializedViewInternal<const TSchema extends ImplicitFieldSchema>(\n\tconfig: TreeViewConfiguration<TSchema>,\n\toptions: ForestOptions & ICodecOptions,\n\tschema: TreeStoredSchema,\n\trootFieldCursor: ITreeCursorSynchronous,\n\tidCompressor: IIdCompressor,\n): SchematizingSimpleTreeView<TSchema> {\n\tconst breaker = new Breakable(\"independentInitializedView\");\n\tconst revisionTagCodec = new RevisionTagCodec(idCompressor);\n\tconst mintRevisionTag = (): RevisionTag => idCompressor.generateCompressedId();\n\n\t// To ensure the forest is in schema when constructed, start it with an empty schema and set the schema repository content later.\n\tconst schemaRepository = new TreeStoredSchemaRepository();\n\n\tconst forest = buildConfiguredForest(\n\t\tbreaker,\n\t\toptions.forest ?? defaultSharedTreeOptions.forest,\n\t\tschemaRepository,\n\t\tidCompressor,\n\t\tdefaultIncrementalEncodingPolicy,\n\t);\n\n\tconst checkout = createTreeCheckout(idCompressor, mintRevisionTag, revisionTagCodec, {\n\t\tforest,\n\t\tschema: schemaRepository,\n\t\tbreaker,\n\t});\n\n\tinitialize(\n\t\tcheckout,\n\t\tschema,\n\t\tinitializerFromChunk(checkout, () =>\n\t\t\tcombineChunks(checkout.forest.chunkField(rootFieldCursor)),\n\t\t),\n\t);\n\treturn new SchematizingSimpleTreeView<TSchema>(\n\t\tcheckout,\n\t\tconfig,\n\t\tcreateNodeIdentifierManager(idCompressor),\n\t);\n}\n\n/**\n * The portion of SharedTree data typically persisted by the container.\n * Usable with {@link independentInitializedView} to create a {@link TreeView}\n * without loading a container.\n * @alpha\n */\nexport interface ViewContent {\n\t/**\n\t * Compressed tree from {@link (TreeAlpha:interface).exportCompressed}.\n\t * @remarks\n\t * This is an owning reference:\n\t * consumers of this content might modify this data in place (for example when applying edits) to avoid copying.\n\t */\n\treadonly tree: JsonCompatible<IFluidHandle>;\n\t/**\n\t * Persisted schema from {@link extractPersistedSchema}.\n\t */\n\treadonly schema: JsonCompatible;\n\t/**\n\t * IIdCompressor which will be used to decompress any compressed identifiers in `tree`\n\t * as well as for any other identifiers added to the view.\n\t */\n\treadonly idCompressor: IIdCompressor;\n}\n"]}
|
|
1
|
+
{"version":3,"file":"independentView.js","sourceRoot":"","sources":["../../src/shared-tree/independentView.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAGH,kEAA6D;AAC7D,qEAGgD;AAGhD,+CAK0B;AAC1B,4DAQuC;AAc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AAO;QACN,QAAQ,CACP,MAAoC;YAEpC,MAAM,GAAG,GAA2B,IAAI,oDAA0B,CACjE,QAAQ,EACR,MAA6E,EAC7E,IAAA,sCAA2B,EAAC,YAAY,CAAC,CACzC,CAAC;YACF,OAAO,GAAiC,CAAC;QAC1C,CAAC;QAED,aAAa;YACZ,OAAO,QAAQ,CAAC,aAAa,EAAE,CAAC;QACjC,CAAC;QAED,kBAAkB;YACjB,OAAO,IAAA,kCAAkB,EAAC,QAAQ,CAAC,YAAY,CAAC,CAAC;QAClD,CAAC;KACD,CAAC;AACH,CAAC;AA/ED,gEA+EC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport type { IFluidHandle } from \"@fluidframework/core-interfaces\";\nimport { assert } from \"@fluidframework/core-utils/internal\";\nimport {\n\ttype IIdCompressor,\n\tcreateIdCompressor,\n} from \"@fluidframework/id-compressor/internal\";\n\nimport type { ICodecOptions } from \"../codec/index.js\";\nimport {\n\ttype RevisionTag,\n\tRevisionTagCodec,\n\tSchemaVersion,\n\tTreeStoredSchemaRepository,\n} from \"../core/index.js\";\nimport {\n\tcreateNodeIdentifierManager,\n\tmakeFieldBatchCodec,\n\tmakeSchemaCodec,\n\ttype FieldBatchEncodingContext,\n\tdefaultSchemaPolicy,\n\tTreeCompressionStrategy,\n\tdefaultIncrementalEncodingPolicy,\n} from \"../feature-libraries/index.js\";\n// eslint-disable-next-line import/no-internal-modules\nimport type { Format } from \"../feature-libraries/schema-index/formatV1.js\";\nimport type {\n\tTreeViewConfiguration,\n\tImplicitFieldSchema,\n\tTreeViewAlpha,\n\tITreeAlpha,\n\tViewableTree,\n\tTreeView,\n\tReadSchema,\n\tVerboseTree,\n\tSimpleTreeSchema,\n} from \"../simple-tree/index.js\";\nimport {\n\ttype JsonCompatibleReadOnly,\n\ttype JsonCompatible,\n\tBreakable,\n\toneFromIterable,\n} from \"../util/index.js\";\nimport {\n\tbuildConfiguredForest,\n\tdefaultSharedTreeOptions,\n\texportSimpleSchema,\n\ttype ForestOptions,\n} from \"./sharedTree.js\";\nimport { createTreeCheckout } from \"./treeCheckout.js\";\nimport { SchematizingSimpleTreeView } from \"./schematizingTreeView.js\";\nimport { initialize, initializerFromChunk } from \"./schematizeTree.js\";\nimport { combineChunks } from \"../feature-libraries/index.js\";\n\n/**\n * Create an uninitialized {@link TreeView} that is not tied to any {@link ITree} instance.\n *\n * @remarks\n * Such a view can never experience collaboration or be persisted to to a Fluid Container.\n *\n * This can be useful for testing, as well as use-cases like working on local files instead of documents stored in some Fluid service.\n * @alpha\n */\nexport function independentView<const TSchema extends ImplicitFieldSchema>(\n\tconfig: TreeViewConfiguration<TSchema>,\n\toptions: ForestOptions & { idCompressor?: IIdCompressor | undefined },\n): TreeViewAlpha<TSchema> {\n\treturn createIndependentTreeAlpha(options).viewWith(config) as TreeViewAlpha<TSchema>;\n}\n\n/**\n * Create an initialized {@link TreeView} that is not tied to any {@link ITree} instance.\n *\n * @remarks\n * Such a view can never experience collaboration or be persisted to to a Fluid Container.\n *\n * This can be useful for testing, as well as use-cases like working on local files instead of documents stored in some Fluid service.\n * @privateRemarks\n * TODO: Providing an API which generates a {@link ViewableTree} extended with export options from {@link ITreeAlpha} and maybe even branching APIs would likely be better that just exposing a {@link TreeViewAlpha}.\n * @alpha\n */\nexport function independentInitializedView<const TSchema extends ImplicitFieldSchema>(\n\tconfig: TreeViewConfiguration<TSchema>,\n\toptions: ForestOptions & ICodecOptions,\n\tcontent: ViewContent,\n): TreeViewAlpha<TSchema> {\n\treturn createIndependentTreeAlpha({ ...options, content }).viewWith(\n\t\tconfig,\n\t) as TreeViewAlpha<TSchema>;\n}\n\n/**\n * Create a {@link ViewableTree} that is not tied to any Fluid runtimes or services.\n *\n * @remarks\n * Such a tree can never experience collaboration or be persisted to to a Fluid Container.\n *\n * This can be useful for testing, as well as use-cases like working on local files instead of documents stored in some Fluid service.\n *\n * @example\n * ```typescript\n * const tree = createIndependentTreeBeta();\n *\n * const stagedConfig = new TreeViewConfiguration({\n * \tschema: SchemaFactoryAlpha.types([\n * \t\tSchemaFactory.number,\n * \t\tSchemaFactoryAlpha.staged(SchemaFactory.string),\n * \t]),\n * });\n * const afterConfig = new TreeViewConfigurationAlpha({\n * \tschema: [SchemaFactory.number, SchemaFactory.string],\n * });\n *\n * // Initialize tree\n * {\n * \tconst view = tree.viewWith(stagedConfig);\n * \tview.initialize(1);\n * \tview.dispose();\n * }\n *\n * // Do schema upgrade\n * {\n * \tconst view = tree.viewWith(afterConfig);\n * \tview.upgradeSchema();\n * \tview.root = \"A\";\n * \tview.dispose();\n * }\n *\n * // Can still view tree with staged schema\n * {\n * \tconst view = tree.viewWith(stagedConfig);\n * \tassert.equal(view.root, \"A\");\n * \tview.dispose();\n * }\n * ```\n * @privateRemarks\n * Before stabilizing this as public, consider if we can instead just expose a better way to create regular Fluid service based SharedTrees for tests.\n * Something like https://github.com/microsoft/FluidFramework/pull/25422 might be a better long term stable/public solution.\n * @beta\n */\nexport function createIndependentTreeBeta<const TSchema extends ImplicitFieldSchema>(\n\toptions?: ForestOptions,\n): ViewableTree {\n\treturn createIndependentTreeAlpha<TSchema>(options);\n}\n\n/**\n * Alpha extensions to {@link createIndependentTreeBeta}.\n *\n * @param options - Configuration options for the independent tree.\n * This can be used to create an uninitialized tree, or `content` can be provided to create an initialized tree.\n * If content is provided, the idCompressor is a required part of it: otherwise it is optional and provided at the top level.\n *\n * @privateRemarks\n * TODO: Support more of {@link ITreeAlpha}, including branching APIs to allow for merges.\n * TODO: Better unify this logic with SharedTreeKernel and SharedTreeCore.\n *\n * Before further stabilizing: consider better ways to handle initialized vs uninitialized trees.\n * 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?\n * If keeping the option here, maybe a separate function of overload would be better? Or maybe flatten ViewContent inline to deduplicate the idCompressor options?\n * @alpha\n */\nexport function createIndependentTreeAlpha<const TSchema extends ImplicitFieldSchema>(\n\toptions?: ForestOptions &\n\t\t(\n\t\t\t| ({ idCompressor?: IIdCompressor | undefined } & { content?: undefined })\n\t\t\t| (ICodecOptions & { content: ViewContent } & { idCompressor?: undefined })\n\t\t),\n): ViewableTree & Pick<ITreeAlpha, \"exportVerbose\" | \"exportSimpleSchema\"> {\n\tconst breaker = new Breakable(\"independentView\");\n\tconst idCompressor: IIdCompressor =\n\t\toptions?.idCompressor ?? options?.content?.idCompressor ?? createIdCompressor();\n\tconst mintRevisionTag = (): RevisionTag => idCompressor.generateCompressedId();\n\tconst revisionTagCodec = new RevisionTagCodec(idCompressor);\n\n\t// To ensure the forest is in schema when constructed, start it with an empty schema and set the schema repository content later.\n\tconst schemaRepository = new TreeStoredSchemaRepository();\n\n\tconst forest = buildConfiguredForest(\n\t\tbreaker,\n\t\toptions?.forest ?? defaultSharedTreeOptions.forest,\n\t\tschemaRepository,\n\t\tidCompressor,\n\t\tdefaultIncrementalEncodingPolicy,\n\t);\n\n\tconst checkout = createTreeCheckout(idCompressor, mintRevisionTag, revisionTagCodec, {\n\t\tforest,\n\t\tschema: schemaRepository,\n\t\tbreaker,\n\t});\n\n\tif (options?.content !== undefined) {\n\t\tconst schemaCodec = makeSchemaCodec(options, SchemaVersion.v1);\n\t\tconst fieldBatchCodec = makeFieldBatchCodec(options, 1);\n\t\tconst newSchema = schemaCodec.decode(options.content.schema as Format);\n\n\t\tconst context: FieldBatchEncodingContext = {\n\t\t\tencodeType: TreeCompressionStrategy.Compressed,\n\t\t\tidCompressor,\n\t\t\toriginatorId: idCompressor.localSessionId, // Is this right? If so, why is is needed?\n\t\t\tschema: { schema: newSchema, policy: defaultSchemaPolicy },\n\t\t};\n\t\tconst fieldCursors = fieldBatchCodec.decode(\n\t\t\toptions.content.tree as JsonCompatibleReadOnly,\n\t\t\tcontext,\n\t\t);\n\t\tassert(fieldCursors.length === 1, 0xa5b /* must have exactly 1 field in batch */);\n\n\t\tconst fieldCursor = oneFromIterable(fieldCursors);\n\t\tassert(fieldCursor !== undefined, 0xc94 /* expected exactly one field in batch */);\n\n\t\tinitialize(\n\t\t\tcheckout,\n\t\t\tnewSchema,\n\t\t\tinitializerFromChunk(checkout, () =>\n\t\t\t\tcombineChunks(checkout.forest.chunkField(fieldCursor)),\n\t\t\t),\n\t\t);\n\t}\n\n\treturn {\n\t\tviewWith<TRoot extends ImplicitFieldSchema>(\n\t\t\tconfig: TreeViewConfiguration<TRoot>,\n\t\t): TreeView<TRoot> {\n\t\t\tconst out: TreeViewAlpha<TSchema> = new SchematizingSimpleTreeView<TSchema>(\n\t\t\t\tcheckout,\n\t\t\t\tconfig as TreeViewConfiguration as TreeViewConfiguration<ReadSchema<TSchema>>,\n\t\t\t\tcreateNodeIdentifierManager(idCompressor),\n\t\t\t);\n\t\t\treturn out as unknown as TreeView<TRoot>;\n\t\t},\n\n\t\texportVerbose(): VerboseTree | undefined {\n\t\t\treturn checkout.exportVerbose();\n\t\t},\n\n\t\texportSimpleSchema(): SimpleTreeSchema {\n\t\t\treturn exportSimpleSchema(checkout.storedSchema);\n\t\t},\n\t};\n}\n\n/**\n * The portion of SharedTree data typically persisted by the container.\n * Usable with {@link independentInitializedView} to create a {@link TreeView}\n * without loading a container.\n * @alpha\n */\nexport interface ViewContent {\n\t/**\n\t * Compressed tree from {@link (TreeAlpha:interface).exportCompressed}.\n\t * @remarks\n\t * This is an owning reference:\n\t * consumers of this content might modify this data in place (for example when applying edits) to avoid copying.\n\t */\n\treadonly tree: JsonCompatible<IFluidHandle>;\n\t/**\n\t * Persisted schema from {@link extractPersistedSchema}.\n\t */\n\treadonly schema: JsonCompatible;\n\t/**\n\t * IIdCompressor which will be used to decompress any compressed identifiers in `tree`\n\t * as well as for any other identifiers added to the view.\n\t */\n\treadonly idCompressor: IIdCompressor;\n}\n"]}
|
|
@@ -5,11 +5,12 @@
|
|
|
5
5
|
export { type ITreePrivate, type SharedTreeOptionsInternal, type SharedTreeOptions, type SharedTreeOptionsBeta, SharedTreeKernel, getBranch, type ForestType, type SharedTreeContentSnapshot, type SharedTreeFormatOptions, SharedTreeFormatVersion, buildConfiguredForest, defaultSharedTreeOptions, type ForestOptions, type ITreeInternal, ForestTypeOptimized, ForestTypeExpensiveDebug, ForestTypeReference, exportSimpleSchema, type SharedTreeKernelView, persistedToSimpleSchema, getCodecTreeForSharedTreeFormat, } from "./sharedTree.js";
|
|
6
6
|
export { createTreeCheckout, TreeCheckout, type ITreeCheckout, type CheckoutEvents, type ITreeCheckoutFork, type BranchableTree, type TreeBranchFork, } from "./treeCheckout.js";
|
|
7
7
|
export { SchematizingSimpleTreeView } from "./schematizingTreeView.js";
|
|
8
|
+
export { initialize, initializerFromChunk } from "./schematizeTree.js";
|
|
8
9
|
export type { ISharedTreeEditor, ISchemaEditor, SharedTreeEditBuilder, } from "./sharedTreeEditBuilder.js";
|
|
9
10
|
export { Tree } from "./tree.js";
|
|
10
11
|
export type { RunTransaction } from "./tree.js";
|
|
11
12
|
export { TreeAlpha, type TreeIdentifierUtils, type ObservationResults, } from "./treeAlpha.js";
|
|
12
|
-
export { independentInitializedView, type ViewContent, independentView, } from "./independentView.js";
|
|
13
|
+
export { independentInitializedView, type ViewContent, independentView, createIndependentTreeBeta, createIndependentTreeAlpha, } from "./independentView.js";
|
|
13
14
|
export type { SharedTreeChange } from "./sharedTreeChangeTypes.js";
|
|
14
15
|
export { getCodecTreeForChangeFormat, type SharedTreeChangeFormatVersion, } from "./sharedTreeChangeCodecs.js";
|
|
15
16
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/shared-tree/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EACN,KAAK,YAAY,EACjB,KAAK,yBAAyB,EAC9B,KAAK,iBAAiB,EACtB,KAAK,qBAAqB,EAC1B,gBAAgB,EAChB,SAAS,EACT,KAAK,UAAU,EACf,KAAK,yBAAyB,EAC9B,KAAK,uBAAuB,EAC5B,uBAAuB,EACvB,qBAAqB,EACrB,wBAAwB,EACxB,KAAK,aAAa,EAClB,KAAK,aAAa,EAClB,mBAAmB,EACnB,wBAAwB,EACxB,mBAAmB,EACnB,kBAAkB,EAClB,KAAK,oBAAoB,EACzB,uBAAuB,EACvB,+BAA+B,GAC/B,MAAM,iBAAiB,CAAC;AAEzB,OAAO,EACN,kBAAkB,EAClB,YAAY,EACZ,KAAK,aAAa,EAClB,KAAK,cAAc,EACnB,KAAK,iBAAiB,EACtB,KAAK,cAAc,EACnB,KAAK,cAAc,GACnB,MAAM,mBAAmB,CAAC;AAE3B,OAAO,EAAE,0BAA0B,EAAE,MAAM,2BAA2B,CAAC;AAEvE,YAAY,EACX,iBAAiB,EACjB,aAAa,EACb,qBAAqB,GACrB,MAAM,4BAA4B,CAAC;AAEpC,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,YAAY,EAAE,cAAc,EAAE,MAAM,WAAW,CAAC;AAEhD,OAAO,EACN,SAAS,EACT,KAAK,mBAAmB,EACxB,KAAK,kBAAkB,GACvB,MAAM,gBAAgB,CAAC;AAExB,OAAO,EACN,0BAA0B,EAC1B,KAAK,WAAW,EAChB,eAAe,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/shared-tree/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EACN,KAAK,YAAY,EACjB,KAAK,yBAAyB,EAC9B,KAAK,iBAAiB,EACtB,KAAK,qBAAqB,EAC1B,gBAAgB,EAChB,SAAS,EACT,KAAK,UAAU,EACf,KAAK,yBAAyB,EAC9B,KAAK,uBAAuB,EAC5B,uBAAuB,EACvB,qBAAqB,EACrB,wBAAwB,EACxB,KAAK,aAAa,EAClB,KAAK,aAAa,EAClB,mBAAmB,EACnB,wBAAwB,EACxB,mBAAmB,EACnB,kBAAkB,EAClB,KAAK,oBAAoB,EACzB,uBAAuB,EACvB,+BAA+B,GAC/B,MAAM,iBAAiB,CAAC;AAEzB,OAAO,EACN,kBAAkB,EAClB,YAAY,EACZ,KAAK,aAAa,EAClB,KAAK,cAAc,EACnB,KAAK,iBAAiB,EACtB,KAAK,cAAc,EACnB,KAAK,cAAc,GACnB,MAAM,mBAAmB,CAAC;AAE3B,OAAO,EAAE,0BAA0B,EAAE,MAAM,2BAA2B,CAAC;AAEvE,OAAO,EAAE,UAAU,EAAE,oBAAoB,EAAE,MAAM,qBAAqB,CAAC;AAEvE,YAAY,EACX,iBAAiB,EACjB,aAAa,EACb,qBAAqB,GACrB,MAAM,4BAA4B,CAAC;AAEpC,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,YAAY,EAAE,cAAc,EAAE,MAAM,WAAW,CAAC;AAEhD,OAAO,EACN,SAAS,EACT,KAAK,mBAAmB,EACxB,KAAK,kBAAkB,GACvB,MAAM,gBAAgB,CAAC;AAExB,OAAO,EACN,0BAA0B,EAC1B,KAAK,WAAW,EAChB,eAAe,EACf,yBAAyB,EACzB,0BAA0B,GAC1B,MAAM,sBAAsB,CAAC;AAE9B,YAAY,EAAE,gBAAgB,EAAE,MAAM,4BAA4B,CAAC;AAEnE,OAAO,EACN,2BAA2B,EAC3B,KAAK,6BAA6B,GAClC,MAAM,6BAA6B,CAAC"}
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* Licensed under the MIT License.
|
|
5
5
|
*/
|
|
6
6
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
-
exports.getCodecTreeForChangeFormat = exports.independentView = exports.independentInitializedView = exports.TreeAlpha = exports.Tree = exports.SchematizingSimpleTreeView = exports.TreeCheckout = exports.createTreeCheckout = exports.getCodecTreeForSharedTreeFormat = exports.persistedToSimpleSchema = exports.exportSimpleSchema = exports.ForestTypeReference = exports.ForestTypeExpensiveDebug = exports.ForestTypeOptimized = exports.defaultSharedTreeOptions = exports.buildConfiguredForest = exports.SharedTreeFormatVersion = exports.getBranch = exports.SharedTreeKernel = void 0;
|
|
7
|
+
exports.getCodecTreeForChangeFormat = exports.createIndependentTreeAlpha = exports.createIndependentTreeBeta = exports.independentView = exports.independentInitializedView = exports.TreeAlpha = exports.Tree = exports.initializerFromChunk = exports.initialize = exports.SchematizingSimpleTreeView = exports.TreeCheckout = exports.createTreeCheckout = exports.getCodecTreeForSharedTreeFormat = exports.persistedToSimpleSchema = exports.exportSimpleSchema = exports.ForestTypeReference = exports.ForestTypeExpensiveDebug = exports.ForestTypeOptimized = exports.defaultSharedTreeOptions = exports.buildConfiguredForest = exports.SharedTreeFormatVersion = exports.getBranch = exports.SharedTreeKernel = void 0;
|
|
8
8
|
var sharedTree_js_1 = require("./sharedTree.js");
|
|
9
9
|
Object.defineProperty(exports, "SharedTreeKernel", { enumerable: true, get: function () { return sharedTree_js_1.SharedTreeKernel; } });
|
|
10
10
|
Object.defineProperty(exports, "getBranch", { enumerable: true, get: function () { return sharedTree_js_1.getBranch; } });
|
|
@@ -22,6 +22,9 @@ Object.defineProperty(exports, "createTreeCheckout", { enumerable: true, get: fu
|
|
|
22
22
|
Object.defineProperty(exports, "TreeCheckout", { enumerable: true, get: function () { return treeCheckout_js_1.TreeCheckout; } });
|
|
23
23
|
var schematizingTreeView_js_1 = require("./schematizingTreeView.js");
|
|
24
24
|
Object.defineProperty(exports, "SchematizingSimpleTreeView", { enumerable: true, get: function () { return schematizingTreeView_js_1.SchematizingSimpleTreeView; } });
|
|
25
|
+
var schematizeTree_js_1 = require("./schematizeTree.js");
|
|
26
|
+
Object.defineProperty(exports, "initialize", { enumerable: true, get: function () { return schematizeTree_js_1.initialize; } });
|
|
27
|
+
Object.defineProperty(exports, "initializerFromChunk", { enumerable: true, get: function () { return schematizeTree_js_1.initializerFromChunk; } });
|
|
25
28
|
var tree_js_1 = require("./tree.js");
|
|
26
29
|
Object.defineProperty(exports, "Tree", { enumerable: true, get: function () { return tree_js_1.Tree; } });
|
|
27
30
|
var treeAlpha_js_1 = require("./treeAlpha.js");
|
|
@@ -29,6 +32,8 @@ Object.defineProperty(exports, "TreeAlpha", { enumerable: true, get: function ()
|
|
|
29
32
|
var independentView_js_1 = require("./independentView.js");
|
|
30
33
|
Object.defineProperty(exports, "independentInitializedView", { enumerable: true, get: function () { return independentView_js_1.independentInitializedView; } });
|
|
31
34
|
Object.defineProperty(exports, "independentView", { enumerable: true, get: function () { return independentView_js_1.independentView; } });
|
|
35
|
+
Object.defineProperty(exports, "createIndependentTreeBeta", { enumerable: true, get: function () { return independentView_js_1.createIndependentTreeBeta; } });
|
|
36
|
+
Object.defineProperty(exports, "createIndependentTreeAlpha", { enumerable: true, get: function () { return independentView_js_1.createIndependentTreeAlpha; } });
|
|
32
37
|
var sharedTreeChangeCodecs_js_1 = require("./sharedTreeChangeCodecs.js");
|
|
33
38
|
Object.defineProperty(exports, "getCodecTreeForChangeFormat", { enumerable: true, get: function () { return sharedTreeChangeCodecs_js_1.getCodecTreeForChangeFormat; } });
|
|
34
39
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/shared-tree/index.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,iDAsByB;AAjBxB,iHAAA,gBAAgB,OAAA;AAChB,0GAAA,SAAS,OAAA;AAIT,wHAAA,uBAAuB,OAAA;AACvB,sHAAA,qBAAqB,OAAA;AACrB,yHAAA,wBAAwB,OAAA;AAGxB,oHAAA,mBAAmB,OAAA;AACnB,yHAAA,wBAAwB,OAAA;AACxB,oHAAA,mBAAmB,OAAA;AACnB,mHAAA,kBAAkB,OAAA;AAElB,wHAAA,uBAAuB,OAAA;AACvB,gIAAA,+BAA+B,OAAA;AAGhC,qDAQ2B;AAP1B,qHAAA,kBAAkB,OAAA;AAClB,+GAAA,YAAY,OAAA;AAQb,qEAAuE;AAA9D,qIAAA,0BAA0B,OAAA;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/shared-tree/index.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,iDAsByB;AAjBxB,iHAAA,gBAAgB,OAAA;AAChB,0GAAA,SAAS,OAAA;AAIT,wHAAA,uBAAuB,OAAA;AACvB,sHAAA,qBAAqB,OAAA;AACrB,yHAAA,wBAAwB,OAAA;AAGxB,oHAAA,mBAAmB,OAAA;AACnB,yHAAA,wBAAwB,OAAA;AACxB,oHAAA,mBAAmB,OAAA;AACnB,mHAAA,kBAAkB,OAAA;AAElB,wHAAA,uBAAuB,OAAA;AACvB,gIAAA,+BAA+B,OAAA;AAGhC,qDAQ2B;AAP1B,qHAAA,kBAAkB,OAAA;AAClB,+GAAA,YAAY,OAAA;AAQb,qEAAuE;AAA9D,qIAAA,0BAA0B,OAAA;AAEnC,yDAAuE;AAA9D,+GAAA,UAAU,OAAA;AAAE,yHAAA,oBAAoB,OAAA;AAQzC,qCAAiC;AAAxB,+FAAA,IAAI,OAAA;AAGb,+CAIwB;AAHvB,yGAAA,SAAS,OAAA;AAKV,2DAM8B;AAL7B,gIAAA,0BAA0B,OAAA;AAE1B,qHAAA,eAAe,OAAA;AACf,+HAAA,yBAAyB,OAAA;AACzB,gIAAA,0BAA0B,OAAA;AAK3B,yEAGqC;AAFpC,wIAAA,2BAA2B,OAAA","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nexport {\n\ttype ITreePrivate,\n\ttype SharedTreeOptionsInternal,\n\ttype SharedTreeOptions,\n\ttype SharedTreeOptionsBeta,\n\tSharedTreeKernel,\n\tgetBranch,\n\ttype ForestType,\n\ttype SharedTreeContentSnapshot,\n\ttype SharedTreeFormatOptions,\n\tSharedTreeFormatVersion,\n\tbuildConfiguredForest,\n\tdefaultSharedTreeOptions,\n\ttype ForestOptions,\n\ttype ITreeInternal,\n\tForestTypeOptimized,\n\tForestTypeExpensiveDebug,\n\tForestTypeReference,\n\texportSimpleSchema,\n\ttype SharedTreeKernelView,\n\tpersistedToSimpleSchema,\n\tgetCodecTreeForSharedTreeFormat,\n} from \"./sharedTree.js\";\n\nexport {\n\tcreateTreeCheckout,\n\tTreeCheckout,\n\ttype ITreeCheckout,\n\ttype CheckoutEvents,\n\ttype ITreeCheckoutFork,\n\ttype BranchableTree,\n\ttype TreeBranchFork,\n} from \"./treeCheckout.js\";\n\nexport { SchematizingSimpleTreeView } from \"./schematizingTreeView.js\";\n\nexport { initialize, initializerFromChunk } from \"./schematizeTree.js\";\n\nexport type {\n\tISharedTreeEditor,\n\tISchemaEditor,\n\tSharedTreeEditBuilder,\n} from \"./sharedTreeEditBuilder.js\";\n\nexport { Tree } from \"./tree.js\";\nexport type { RunTransaction } from \"./tree.js\";\n\nexport {\n\tTreeAlpha,\n\ttype TreeIdentifierUtils,\n\ttype ObservationResults,\n} from \"./treeAlpha.js\";\n\nexport {\n\tindependentInitializedView,\n\ttype ViewContent,\n\tindependentView,\n\tcreateIndependentTreeBeta,\n\tcreateIndependentTreeAlpha,\n} from \"./independentView.js\";\n\nexport type { SharedTreeChange } from \"./sharedTreeChangeTypes.js\";\n\nexport {\n\tgetCodecTreeForChangeFormat,\n\ttype SharedTreeChangeFormatVersion,\n} from \"./sharedTreeChangeCodecs.js\";\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sharedTree.d.ts","sourceRoot":"","sources":["../../src/shared-tree/sharedTree.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,UAAU,EAAE,cAAc,EAAE,MAAM,0CAA0C,CAAC;AAE3F,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,gDAAgD,CAAC;AAC7F,OAAO,KAAK,EAAE,aAAa,EAAY,MAAM,+BAA+B,CAAC;AAC7E,OAAO,KAAK,EACX,YAAY,EACZ,gBAAgB,EAChB,YAAY,EACZ,MAAM,6CAA6C,CAAC;AACrD,OAAO,EAEN,KAAK,mBAAmB,EACxB,MAAM,0CAA0C,CAAC;AAElD,OAAO,EACN,KAAK,SAAS,EACd,KAA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AyB,CAQxE,CAAC"}
|
|
@@ -519,6 +519,21 @@ exports.defaultSharedTreeOptions = {
|
|
|
519
519
|
disposeForksAfterTransaction: true,
|
|
520
520
|
shouldEncodeIncrementally: index_js_3.defaultIncrementalEncodingPolicy,
|
|
521
521
|
};
|
|
522
|
+
/**
|
|
523
|
+
* Build the allowed types for a Stored Schema.
|
|
524
|
+
*
|
|
525
|
+
* @remarks Staged upgrades do not apply to stored schemas, so we omit the {@link SimpleAllowedTypeAttributes.isStaged | staging flag } when building {@link SimpleAllowedTypeAttributes}.
|
|
526
|
+
* @param types - The types to create allowed types for.
|
|
527
|
+
* @returns The allowed types.
|
|
528
|
+
*/
|
|
529
|
+
function buildSimpleAllowedTypeAttributesForStoredSchema(types) {
|
|
530
|
+
const allowedTypesInfo = new Map();
|
|
531
|
+
for (const type of types) {
|
|
532
|
+
// Stored schemas do not have staged upgrades
|
|
533
|
+
allowedTypesInfo.set(type, { isStaged: undefined });
|
|
534
|
+
}
|
|
535
|
+
return allowedTypesInfo;
|
|
536
|
+
}
|
|
522
537
|
function exportSimpleFieldSchemaStored(schema) {
|
|
523
538
|
let kind;
|
|
524
539
|
switch (schema.kind) {
|
|
@@ -540,7 +555,7 @@ function exportSimpleFieldSchemaStored(schema) {
|
|
|
540
555
|
}
|
|
541
556
|
return {
|
|
542
557
|
kind,
|
|
543
|
-
|
|
558
|
+
simpleAllowedTypes: buildSimpleAllowedTypeAttributesForStoredSchema(schema.types),
|
|
544
559
|
metadata: {},
|
|
545
560
|
persistedMetadata: schema.persistedMetadata,
|
|
546
561
|
};
|
|
@@ -555,7 +570,7 @@ function exportSimpleNodeSchemaStored(schema) {
|
|
|
555
570
|
if (arrayTypes !== undefined) {
|
|
556
571
|
return {
|
|
557
572
|
kind: index_js_5.NodeKind.Array,
|
|
558
|
-
|
|
573
|
+
simpleAllowedTypes: buildSimpleAllowedTypeAttributesForStoredSchema(arrayTypes),
|
|
559
574
|
metadata: {},
|
|
560
575
|
persistedMetadata: schema.metadata,
|
|
561
576
|
};
|
|
@@ -571,7 +586,7 @@ function exportSimpleNodeSchemaStored(schema) {
|
|
|
571
586
|
(0, internal_1.assert)(schema.mapFields.kind === index_js_3.FieldKinds.optional.identifier, 0xa95 /* Invalid map schema */);
|
|
572
587
|
return {
|
|
573
588
|
kind: index_js_5.NodeKind.Map,
|
|
574
|
-
|
|
589
|
+
simpleAllowedTypes: buildSimpleAllowedTypeAttributesForStoredSchema(schema.mapFields.types),
|
|
575
590
|
metadata: {},
|
|
576
591
|
persistedMetadata: schema.metadata,
|
|
577
592
|
};
|