@fluidframework/tree 2.92.0 → 2.93.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 +40 -0
- package/README.md +1 -1
- package/api-report/tree.alpha.api.md +57 -29
- package/api-report/tree.beta.api.md +41 -12
- package/api-report/tree.legacy.beta.api.md +41 -12
- package/dist/api.d.ts +6 -1
- package/dist/api.d.ts.map +1 -1
- package/dist/api.js.map +1 -1
- package/dist/core/tree/anchorSet.d.ts.map +1 -1
- package/dist/core/tree/anchorSet.js +21 -0
- package/dist/core/tree/anchorSet.js.map +1 -1
- package/dist/entrypoints/alpha.d.ts +1 -1
- package/dist/entrypoints/alpha.d.ts.map +1 -1
- package/dist/entrypoints/alpha.js +4 -4
- package/dist/entrypoints/alpha.js.map +1 -1
- package/dist/entrypoints/beta.d.ts +1 -1
- package/dist/entrypoints/beta.d.ts.map +1 -1
- package/dist/entrypoints/beta.js +3 -1
- package/dist/entrypoints/beta.js.map +1 -1
- package/dist/entrypoints/legacy.d.ts +1 -1
- package/dist/entrypoints/legacy.d.ts.map +1 -1
- package/dist/entrypoints/legacy.js +3 -1
- package/dist/entrypoints/legacy.js.map +1 -1
- package/dist/feature-libraries/chunked-forest/chunkTree.d.ts +2 -2
- package/dist/feature-libraries/chunked-forest/chunkTree.d.ts.map +1 -1
- package/dist/feature-libraries/chunked-forest/chunkTree.js +2 -1
- package/dist/feature-libraries/chunked-forest/chunkTree.js.map +1 -1
- package/dist/feature-libraries/chunked-forest/uniformChunk.d.ts +13 -5
- package/dist/feature-libraries/chunked-forest/uniformChunk.d.ts.map +1 -1
- package/dist/feature-libraries/chunked-forest/uniformChunk.js +22 -18
- package/dist/feature-libraries/chunked-forest/uniformChunk.js.map +1 -1
- package/dist/feature-libraries/indexing/anchorTreeIndex.d.ts +1 -0
- package/dist/feature-libraries/indexing/anchorTreeIndex.d.ts.map +1 -1
- package/dist/feature-libraries/indexing/anchorTreeIndex.js +3 -1
- package/dist/feature-libraries/indexing/anchorTreeIndex.js.map +1 -1
- package/dist/feature-libraries/indexing/types.d.ts +4 -3
- package/dist/feature-libraries/indexing/types.d.ts.map +1 -1
- package/dist/feature-libraries/indexing/types.js.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js.map +1 -1
- package/dist/packageVersion.d.ts +1 -1
- package/dist/packageVersion.js +1 -1
- package/dist/packageVersion.js.map +1 -1
- package/dist/serializableDomainSchema.d.ts +5 -5
- package/dist/serializableDomainSchema.d.ts.map +1 -1
- package/dist/serializableDomainSchema.js.map +1 -1
- package/dist/shared-tree/treeAlpha.d.ts +6 -2
- package/dist/shared-tree/treeAlpha.d.ts.map +1 -1
- package/dist/shared-tree/treeAlpha.js.map +1 -1
- package/dist/simple-tree/api/discrepancies.js +4 -1
- package/dist/simple-tree/api/discrepancies.js.map +1 -1
- package/dist/simple-tree/api/identifierIndex.d.ts +2 -2
- package/dist/simple-tree/api/identifierIndex.js +1 -1
- package/dist/simple-tree/api/identifierIndex.js.map +1 -1
- package/dist/simple-tree/api/index.d.ts +2 -2
- package/dist/simple-tree/api/index.d.ts.map +1 -1
- package/dist/simple-tree/api/index.js +3 -2
- package/dist/simple-tree/api/index.js.map +1 -1
- package/dist/simple-tree/api/schemaFactoryAlpha.d.ts +31 -2
- package/dist/simple-tree/api/schemaFactoryAlpha.d.ts.map +1 -1
- package/dist/simple-tree/api/schemaFactoryAlpha.js +17 -1
- package/dist/simple-tree/api/schemaFactoryAlpha.js.map +1 -1
- package/dist/simple-tree/api/simpleTreeIndex.d.ts +5 -5
- package/dist/simple-tree/api/simpleTreeIndex.js +1 -1
- package/dist/simple-tree/api/simpleTreeIndex.js.map +1 -1
- package/dist/simple-tree/api/storedSchema.d.ts.map +1 -1
- package/dist/simple-tree/api/storedSchema.js +4 -1
- package/dist/simple-tree/api/storedSchema.js.map +1 -1
- package/dist/simple-tree/api/treeAlpha.d.ts +70 -13
- package/dist/simple-tree/api/treeAlpha.d.ts.map +1 -1
- package/dist/simple-tree/api/treeAlpha.js.map +1 -1
- package/dist/simple-tree/api/treeChangeEvents.d.ts +1 -1
- package/dist/simple-tree/api/treeChangeEvents.js.map +1 -1
- package/dist/simple-tree/api/treeNodeApi.d.ts +60 -1
- package/dist/simple-tree/api/treeNodeApi.d.ts.map +1 -1
- package/dist/simple-tree/api/treeNodeApi.js +68 -6
- package/dist/simple-tree/api/treeNodeApi.js.map +1 -1
- package/dist/simple-tree/core/toStored.d.ts +7 -0
- package/dist/simple-tree/core/toStored.d.ts.map +1 -1
- package/dist/simple-tree/core/toStored.js.map +1 -1
- package/dist/simple-tree/core/unhydratedFlexTree.d.ts +17 -3
- package/dist/simple-tree/core/unhydratedFlexTree.d.ts.map +1 -1
- package/dist/simple-tree/core/unhydratedFlexTree.js +114 -12
- package/dist/simple-tree/core/unhydratedFlexTree.js.map +1 -1
- package/dist/simple-tree/fieldSchema.d.ts +6 -1
- package/dist/simple-tree/fieldSchema.d.ts.map +1 -1
- package/dist/simple-tree/fieldSchema.js +3 -0
- package/dist/simple-tree/fieldSchema.js.map +1 -1
- package/dist/simple-tree/index.d.ts +2 -2
- package/dist/simple-tree/index.d.ts.map +1 -1
- package/dist/simple-tree/index.js +4 -3
- package/dist/simple-tree/index.js.map +1 -1
- package/dist/simple-tree/node-kinds/index.d.ts +1 -1
- package/dist/simple-tree/node-kinds/index.d.ts.map +1 -1
- package/dist/simple-tree/node-kinds/index.js.map +1 -1
- package/dist/simple-tree/node-kinds/map/index.d.ts +1 -1
- package/dist/simple-tree/node-kinds/map/index.d.ts.map +1 -1
- package/dist/simple-tree/node-kinds/map/index.js.map +1 -1
- package/dist/simple-tree/node-kinds/map/mapNode.d.ts +13 -0
- package/dist/simple-tree/node-kinds/map/mapNode.d.ts.map +1 -1
- package/dist/simple-tree/node-kinds/map/mapNode.js +6 -1
- package/dist/simple-tree/node-kinds/map/mapNode.js.map +1 -1
- package/dist/simple-tree/node-kinds/map/mapNodeTypes.d.ts +6 -6
- package/dist/simple-tree/node-kinds/map/mapNodeTypes.d.ts.map +1 -1
- package/dist/simple-tree/node-kinds/map/mapNodeTypes.js.map +1 -1
- package/dist/simple-tree/simpleSchema.d.ts +17 -0
- 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 +23 -1
- package/dist/simple-tree/toStoredSchema.js.map +1 -1
- package/dist/tableSchema.d.ts +4 -5
- package/dist/tableSchema.d.ts.map +1 -1
- package/dist/tableSchema.js +12 -23
- package/dist/tableSchema.js.map +1 -1
- package/dist/text/textDomain.d.ts.map +1 -1
- package/dist/text/textDomain.js +27 -0
- package/dist/text/textDomain.js.map +1 -1
- package/dist/text/textDomainFormatted.d.ts +4 -4
- package/dist/util/index.d.ts +1 -1
- package/dist/util/index.d.ts.map +1 -1
- package/dist/util/index.js +2 -3
- package/dist/util/index.js.map +1 -1
- package/dist/util/utils.d.ts +0 -1
- package/dist/util/utils.d.ts.map +1 -1
- package/dist/util/utils.js +1 -6
- package/dist/util/utils.js.map +1 -1
- package/eslint.config.mts +1 -1
- package/lib/api.d.ts +6 -1
- package/lib/api.d.ts.map +1 -1
- package/lib/api.js.map +1 -1
- package/lib/core/tree/anchorSet.d.ts.map +1 -1
- package/lib/core/tree/anchorSet.js +21 -0
- package/lib/core/tree/anchorSet.js.map +1 -1
- package/lib/entrypoints/alpha.d.ts +1 -1
- package/lib/entrypoints/alpha.d.ts.map +1 -1
- package/lib/entrypoints/alpha.js +1 -1
- package/lib/entrypoints/alpha.js.map +1 -1
- package/lib/entrypoints/beta.d.ts +1 -1
- package/lib/entrypoints/beta.d.ts.map +1 -1
- package/lib/entrypoints/beta.js +1 -1
- package/lib/entrypoints/beta.js.map +1 -1
- package/lib/entrypoints/legacy.d.ts +1 -1
- package/lib/entrypoints/legacy.d.ts.map +1 -1
- package/lib/entrypoints/legacy.js +1 -1
- package/lib/entrypoints/legacy.js.map +1 -1
- package/lib/feature-libraries/chunked-forest/chunkTree.d.ts +2 -2
- package/lib/feature-libraries/chunked-forest/chunkTree.d.ts.map +1 -1
- package/lib/feature-libraries/chunked-forest/chunkTree.js +2 -1
- package/lib/feature-libraries/chunked-forest/chunkTree.js.map +1 -1
- package/lib/feature-libraries/chunked-forest/uniformChunk.d.ts +13 -5
- package/lib/feature-libraries/chunked-forest/uniformChunk.d.ts.map +1 -1
- package/lib/feature-libraries/chunked-forest/uniformChunk.js +22 -18
- package/lib/feature-libraries/chunked-forest/uniformChunk.js.map +1 -1
- package/lib/feature-libraries/indexing/anchorTreeIndex.d.ts +1 -0
- package/lib/feature-libraries/indexing/anchorTreeIndex.d.ts.map +1 -1
- package/lib/feature-libraries/indexing/anchorTreeIndex.js +3 -1
- package/lib/feature-libraries/indexing/anchorTreeIndex.js.map +1 -1
- package/lib/feature-libraries/indexing/types.d.ts +4 -3
- package/lib/feature-libraries/indexing/types.d.ts.map +1 -1
- package/lib/feature-libraries/indexing/types.js.map +1 -1
- package/lib/index.d.ts +1 -1
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js.map +1 -1
- package/lib/packageVersion.d.ts +1 -1
- package/lib/packageVersion.js +1 -1
- package/lib/packageVersion.js.map +1 -1
- package/lib/serializableDomainSchema.d.ts +5 -5
- package/lib/serializableDomainSchema.d.ts.map +1 -1
- package/lib/serializableDomainSchema.js +4 -1
- package/lib/serializableDomainSchema.js.map +1 -1
- package/lib/shared-tree/treeAlpha.d.ts +6 -2
- package/lib/shared-tree/treeAlpha.d.ts.map +1 -1
- package/lib/shared-tree/treeAlpha.js.map +1 -1
- package/lib/simple-tree/api/discrepancies.js +4 -1
- package/lib/simple-tree/api/discrepancies.js.map +1 -1
- package/lib/simple-tree/api/identifierIndex.d.ts +2 -2
- package/lib/simple-tree/api/identifierIndex.js +1 -1
- package/lib/simple-tree/api/identifierIndex.js.map +1 -1
- package/lib/simple-tree/api/index.d.ts +2 -2
- package/lib/simple-tree/api/index.d.ts.map +1 -1
- package/lib/simple-tree/api/index.js +1 -1
- package/lib/simple-tree/api/index.js.map +1 -1
- package/lib/simple-tree/api/schemaFactoryAlpha.d.ts +31 -2
- package/lib/simple-tree/api/schemaFactoryAlpha.d.ts.map +1 -1
- package/lib/simple-tree/api/schemaFactoryAlpha.js +19 -3
- package/lib/simple-tree/api/schemaFactoryAlpha.js.map +1 -1
- package/lib/simple-tree/api/simpleTreeIndex.d.ts +5 -5
- package/lib/simple-tree/api/simpleTreeIndex.js +1 -1
- package/lib/simple-tree/api/simpleTreeIndex.js.map +1 -1
- package/lib/simple-tree/api/storedSchema.d.ts.map +1 -1
- package/lib/simple-tree/api/storedSchema.js +4 -1
- package/lib/simple-tree/api/storedSchema.js.map +1 -1
- package/lib/simple-tree/api/treeAlpha.d.ts +70 -13
- package/lib/simple-tree/api/treeAlpha.d.ts.map +1 -1
- package/lib/simple-tree/api/treeAlpha.js.map +1 -1
- package/lib/simple-tree/api/treeChangeEvents.d.ts +1 -1
- package/lib/simple-tree/api/treeChangeEvents.js.map +1 -1
- package/lib/simple-tree/api/treeNodeApi.d.ts +60 -1
- package/lib/simple-tree/api/treeNodeApi.d.ts.map +1 -1
- package/lib/simple-tree/api/treeNodeApi.js +66 -6
- package/lib/simple-tree/api/treeNodeApi.js.map +1 -1
- package/lib/simple-tree/core/toStored.d.ts +7 -0
- package/lib/simple-tree/core/toStored.d.ts.map +1 -1
- package/lib/simple-tree/core/toStored.js.map +1 -1
- package/lib/simple-tree/core/unhydratedFlexTree.d.ts +17 -3
- package/lib/simple-tree/core/unhydratedFlexTree.d.ts.map +1 -1
- package/lib/simple-tree/core/unhydratedFlexTree.js +115 -13
- package/lib/simple-tree/core/unhydratedFlexTree.js.map +1 -1
- package/lib/simple-tree/fieldSchema.d.ts +6 -1
- package/lib/simple-tree/fieldSchema.d.ts.map +1 -1
- package/lib/simple-tree/fieldSchema.js +3 -0
- package/lib/simple-tree/fieldSchema.js.map +1 -1
- package/lib/simple-tree/index.d.ts +2 -2
- package/lib/simple-tree/index.d.ts.map +1 -1
- package/lib/simple-tree/index.js +1 -1
- package/lib/simple-tree/index.js.map +1 -1
- package/lib/simple-tree/node-kinds/index.d.ts +1 -1
- package/lib/simple-tree/node-kinds/index.d.ts.map +1 -1
- package/lib/simple-tree/node-kinds/index.js.map +1 -1
- package/lib/simple-tree/node-kinds/map/index.d.ts +1 -1
- package/lib/simple-tree/node-kinds/map/index.d.ts.map +1 -1
- package/lib/simple-tree/node-kinds/map/index.js.map +1 -1
- package/lib/simple-tree/node-kinds/map/mapNode.d.ts +13 -0
- package/lib/simple-tree/node-kinds/map/mapNode.d.ts.map +1 -1
- package/lib/simple-tree/node-kinds/map/mapNode.js +6 -1
- package/lib/simple-tree/node-kinds/map/mapNode.js.map +1 -1
- package/lib/simple-tree/node-kinds/map/mapNodeTypes.d.ts +6 -6
- package/lib/simple-tree/node-kinds/map/mapNodeTypes.d.ts.map +1 -1
- package/lib/simple-tree/node-kinds/map/mapNodeTypes.js.map +1 -1
- package/lib/simple-tree/simpleSchema.d.ts +17 -0
- 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 +24 -2
- package/lib/simple-tree/toStoredSchema.js.map +1 -1
- package/lib/tableSchema.d.ts +4 -5
- package/lib/tableSchema.d.ts.map +1 -1
- package/lib/tableSchema.js +12 -23
- package/lib/tableSchema.js.map +1 -1
- package/lib/text/textDomain.d.ts.map +1 -1
- package/lib/text/textDomain.js +29 -0
- package/lib/text/textDomain.js.map +1 -1
- package/lib/text/textDomainFormatted.d.ts +4 -4
- package/lib/tsdoc-metadata.json +1 -1
- package/lib/util/index.d.ts +1 -1
- package/lib/util/index.d.ts.map +1 -1
- package/lib/util/index.js +1 -1
- package/lib/util/index.js.map +1 -1
- package/lib/util/utils.d.ts +0 -1
- package/lib/util/utils.d.ts.map +1 -1
- package/lib/util/utils.js +0 -1
- package/lib/util/utils.js.map +1 -1
- package/package.json +30 -35
- package/src/api.ts +10 -0
- package/src/core/tree/anchorSet.ts +25 -0
- package/src/entrypoints/alpha.ts +20 -16
- package/src/entrypoints/beta.ts +7 -1
- package/src/entrypoints/legacy.ts +8 -10
- package/src/feature-libraries/chunked-forest/chunkTree.ts +3 -2
- package/src/feature-libraries/chunked-forest/uniformChunk.ts +42 -20
- package/src/feature-libraries/indexing/anchorTreeIndex.ts +1 -0
- package/src/feature-libraries/indexing/types.ts +5 -3
- package/src/index.ts +4 -0
- package/src/packageVersion.ts +1 -1
- package/src/serializableDomainSchema.ts +6 -0
- package/src/shared-tree/treeAlpha.ts +6 -2
- package/src/simple-tree/api/discrepancies.ts +6 -1
- package/src/simple-tree/api/identifierIndex.ts +2 -2
- package/src/simple-tree/api/index.ts +4 -0
- package/src/simple-tree/api/schemaFactoryAlpha.ts +67 -2
- package/src/simple-tree/api/simpleTreeIndex.ts +6 -6
- package/src/simple-tree/api/storedSchema.ts +4 -1
- package/src/simple-tree/api/treeAlpha.ts +75 -12
- package/src/simple-tree/api/treeChangeEvents.ts +1 -1
- package/src/simple-tree/api/treeNodeApi.ts +101 -7
- package/src/simple-tree/core/toStored.ts +8 -0
- package/src/simple-tree/core/unhydratedFlexTree.ts +134 -10
- package/src/simple-tree/fieldSchema.ts +10 -0
- package/src/simple-tree/index.ts +5 -0
- package/src/simple-tree/node-kinds/index.ts +1 -0
- package/src/simple-tree/node-kinds/map/index.ts +1 -0
- package/src/simple-tree/node-kinds/map/mapNode.ts +20 -3
- package/src/simple-tree/node-kinds/map/mapNodeTypes.ts +6 -6
- package/src/simple-tree/simpleSchema.ts +20 -0
- package/src/simple-tree/toStoredSchema.ts +28 -1
- package/src/tableSchema.ts +16 -28
- package/src/text/textDomain.ts +68 -1
- package/src/util/index.ts +0 -1
- package/src/util/utils.ts +0 -2
- package/.mocharc.customBenchmarks.cjs +0 -25
package/src/entrypoints/alpha.ts
CHANGED
|
@@ -102,10 +102,6 @@ export {
|
|
|
102
102
|
AnnotatedAllowedTypeUnsafe,
|
|
103
103
|
AnnotatedAllowedTypes,
|
|
104
104
|
AnnotatedAllowedTypesUnsafe,
|
|
105
|
-
ArrayNodeDeltaOp,
|
|
106
|
-
ArrayNodeInsertOp,
|
|
107
|
-
ArrayNodeRemoveOp,
|
|
108
|
-
ArrayNodeRetainOp,
|
|
109
105
|
CodecWriteOptionsBeta,
|
|
110
106
|
ConciseTree,
|
|
111
107
|
ExtensibleUnionNode,
|
|
@@ -116,13 +112,11 @@ export {
|
|
|
116
112
|
ForestTypeExpensiveDebug,
|
|
117
113
|
ForestTypeOptimized,
|
|
118
114
|
ForestTypeReference,
|
|
115
|
+
IdentifierIndex,
|
|
119
116
|
JsonCompatible,
|
|
120
117
|
JsonCompatibleObject,
|
|
121
118
|
KeyEncodingOptions,
|
|
122
|
-
NodeChangedData,
|
|
123
|
-
NodeChangedDataAlpha,
|
|
124
|
-
NodeChangedDataDelta,
|
|
125
|
-
NodeChangedDataProperties,
|
|
119
|
+
NodeChangedData,
|
|
126
120
|
ObjectSchemaOptions,
|
|
127
121
|
PopUnion,
|
|
128
122
|
RecordNodeInsertableData,
|
|
@@ -136,9 +130,11 @@ export {
|
|
|
136
130
|
TableSchema,
|
|
137
131
|
TreeBeta,
|
|
138
132
|
TreeBranch,
|
|
139
|
-
TreeChangeEventsBeta,
|
|
140
|
-
TreeChangeEventsAlpha,
|
|
133
|
+
TreeChangeEventsBeta,
|
|
141
134
|
TreeEncodingOptions,
|
|
135
|
+
TreeIndex,
|
|
136
|
+
TreeIndexKey,
|
|
137
|
+
TreeIndexNodes,
|
|
142
138
|
TreeRecordNode,
|
|
143
139
|
TreeRecordNodeUnsafe,
|
|
144
140
|
TreeViewBeta,
|
|
@@ -149,7 +145,9 @@ export {
|
|
|
149
145
|
adaptEnum,
|
|
150
146
|
asBeta,
|
|
151
147
|
configuredSharedTreeBeta,
|
|
148
|
+
createIdentifierIndex,
|
|
152
149
|
createIndependentTreeBeta,
|
|
150
|
+
createTreeIndex,
|
|
153
151
|
enumFromStrings,
|
|
154
152
|
singletonSchema,
|
|
155
153
|
snapshotSchemaCompatibility,
|
|
@@ -160,8 +158,14 @@ export {
|
|
|
160
158
|
ArrayNodeCustomizableSchema,
|
|
161
159
|
ArrayNodeCustomizableSchemaAlpha,
|
|
162
160
|
ArrayNodeCustomizableSchemaUnsafe,
|
|
161
|
+
ArrayNodeDeltaOp,
|
|
162
|
+
ArrayNodeInsertOp,
|
|
163
163
|
ArrayNodePojoEmulationSchema,
|
|
164
|
+
ArrayNodeRemoveOp,
|
|
165
|
+
ArrayNodeRetainOp,
|
|
164
166
|
ArrayNodeSchema,
|
|
167
|
+
ArrayNodeTreeChangedDeltaOp,
|
|
168
|
+
ArrayNodeTreeChangedRetainOp,
|
|
165
169
|
ArrayPlaceAnchor,
|
|
166
170
|
ChangeMetadata,
|
|
167
171
|
CodecName,
|
|
@@ -187,7 +191,6 @@ export {
|
|
|
187
191
|
HandleConverter,
|
|
188
192
|
ICodecOptions,
|
|
189
193
|
ITreeAlpha,
|
|
190
|
-
IdentifierIndex,
|
|
191
194
|
IncrementalEncodingPolicy,
|
|
192
195
|
IndependentViewOptions,
|
|
193
196
|
Insertable,
|
|
@@ -220,6 +223,10 @@ export {
|
|
|
220
223
|
MapNodePojoEmulationSchema,
|
|
221
224
|
MapNodeSchema,
|
|
222
225
|
NoChangeConstraint,
|
|
226
|
+
NodeChangedDataAlpha,
|
|
227
|
+
NodeChangedDataDelta,
|
|
228
|
+
NodeChangedDataProperties,
|
|
229
|
+
NodeChangedDataTreeDelta,
|
|
223
230
|
NodeProvider,
|
|
224
231
|
NodeSchemaOptionsAlpha,
|
|
225
232
|
ObjectNodeSchema,
|
|
@@ -263,12 +270,11 @@ export {
|
|
|
263
270
|
TreeArrayNodeAlpha,
|
|
264
271
|
TreeBranchAlpha,
|
|
265
272
|
TreeBranchEvents,
|
|
273
|
+
TreeChangeEventsAlpha,
|
|
266
274
|
TreeCompressionStrategy,
|
|
267
275
|
TreeContextAlpha,
|
|
268
276
|
TreeIdentifierUtils,
|
|
269
|
-
|
|
270
|
-
TreeIndexKey,
|
|
271
|
-
TreeIndexNodes,
|
|
277
|
+
TreeMapNodeAlpha,
|
|
272
278
|
TreeParsingOptions,
|
|
273
279
|
TreeSchema,
|
|
274
280
|
TreeSchemaEncodingOptions,
|
|
@@ -290,9 +296,7 @@ export {
|
|
|
290
296
|
configuredSharedTreeAlpha,
|
|
291
297
|
contentSchemaSymbol,
|
|
292
298
|
createArrayInsertionAnchor,
|
|
293
|
-
createIdentifierIndex,
|
|
294
299
|
createIndependentTreeAlpha,
|
|
295
|
-
createTreeIndex,
|
|
296
300
|
decodeSchemaCompatibilitySnapshot,
|
|
297
301
|
encodeSchemaCompatibilitySnapshot,
|
|
298
302
|
eraseSchemaDetails,
|
package/src/entrypoints/beta.ts
CHANGED
|
@@ -112,10 +112,11 @@ export {
|
|
|
112
112
|
ForestTypeExpensiveDebug,
|
|
113
113
|
ForestTypeOptimized,
|
|
114
114
|
ForestTypeReference,
|
|
115
|
+
IdentifierIndex,
|
|
115
116
|
JsonCompatible,
|
|
116
117
|
JsonCompatibleObject,
|
|
117
118
|
KeyEncodingOptions,
|
|
118
|
-
NodeChangedData,
|
|
119
|
+
NodeChangedData,
|
|
119
120
|
ObjectSchemaOptions,
|
|
120
121
|
PopUnion,
|
|
121
122
|
RecordNodeInsertableData,
|
|
@@ -131,6 +132,9 @@ export {
|
|
|
131
132
|
TreeBranch,
|
|
132
133
|
TreeChangeEventsBeta,
|
|
133
134
|
TreeEncodingOptions,
|
|
135
|
+
TreeIndex,
|
|
136
|
+
TreeIndexKey,
|
|
137
|
+
TreeIndexNodes,
|
|
134
138
|
TreeRecordNode,
|
|
135
139
|
TreeRecordNodeUnsafe,
|
|
136
140
|
TreeViewBeta,
|
|
@@ -141,7 +145,9 @@ export {
|
|
|
141
145
|
adaptEnum,
|
|
142
146
|
asBeta,
|
|
143
147
|
configuredSharedTreeBeta,
|
|
148
|
+
createIdentifierIndex,
|
|
144
149
|
createIndependentTreeBeta,
|
|
150
|
+
createTreeIndex,
|
|
145
151
|
enumFromStrings,
|
|
146
152
|
singletonSchema,
|
|
147
153
|
snapshotSchemaCompatibility
|
|
@@ -102,10 +102,6 @@ export {
|
|
|
102
102
|
AnnotatedAllowedTypeUnsafe,
|
|
103
103
|
AnnotatedAllowedTypes,
|
|
104
104
|
AnnotatedAllowedTypesUnsafe,
|
|
105
|
-
ArrayNodeDeltaOp,
|
|
106
|
-
ArrayNodeInsertOp,
|
|
107
|
-
ArrayNodeRemoveOp,
|
|
108
|
-
ArrayNodeRetainOp,
|
|
109
105
|
CodecWriteOptionsBeta,
|
|
110
106
|
ConciseTree,
|
|
111
107
|
ExtensibleUnionNode,
|
|
@@ -116,13 +112,11 @@ export {
|
|
|
116
112
|
ForestTypeExpensiveDebug,
|
|
117
113
|
ForestTypeOptimized,
|
|
118
114
|
ForestTypeReference,
|
|
115
|
+
IdentifierIndex,
|
|
119
116
|
JsonCompatible,
|
|
120
117
|
JsonCompatibleObject,
|
|
121
118
|
KeyEncodingOptions,
|
|
122
|
-
NodeChangedData,
|
|
123
|
-
NodeChangedDataAlpha,
|
|
124
|
-
NodeChangedDataDelta,
|
|
125
|
-
NodeChangedDataProperties,
|
|
119
|
+
NodeChangedData,
|
|
126
120
|
ObjectSchemaOptions,
|
|
127
121
|
PopUnion,
|
|
128
122
|
RecordNodeInsertableData,
|
|
@@ -136,9 +130,11 @@ export {
|
|
|
136
130
|
TableSchema,
|
|
137
131
|
TreeBeta,
|
|
138
132
|
TreeBranch,
|
|
139
|
-
TreeChangeEventsBeta,
|
|
140
|
-
TreeChangeEventsAlpha,
|
|
133
|
+
TreeChangeEventsBeta,
|
|
141
134
|
TreeEncodingOptions,
|
|
135
|
+
TreeIndex,
|
|
136
|
+
TreeIndexKey,
|
|
137
|
+
TreeIndexNodes,
|
|
142
138
|
TreeRecordNode,
|
|
143
139
|
TreeRecordNodeUnsafe,
|
|
144
140
|
TreeViewBeta,
|
|
@@ -149,7 +145,9 @@ export {
|
|
|
149
145
|
adaptEnum,
|
|
150
146
|
asBeta,
|
|
151
147
|
configuredSharedTreeBeta,
|
|
148
|
+
createIdentifierIndex,
|
|
152
149
|
createIndependentTreeBeta,
|
|
150
|
+
createTreeIndex,
|
|
153
151
|
enumFromStrings,
|
|
154
152
|
singletonSchema,
|
|
155
153
|
snapshotSchemaCompatibility,
|
|
@@ -424,8 +424,8 @@ export interface ChunkCompressor {
|
|
|
424
424
|
/**
|
|
425
425
|
* If the idCompressor is provided, {@link UniformChunk}s with identifiers will be encoded for its in-memory representation.
|
|
426
426
|
* @remarks
|
|
427
|
-
* This compression applies to {@link UniformChunk}s when {@link TreeShape.
|
|
428
|
-
* If the `policy` does not use UniformChunks or does not set `
|
|
427
|
+
* This compression applies to {@link UniformChunk}s when {@link TreeShape.mayContainCompressedIds} is set.
|
|
428
|
+
* If the `policy` does not use UniformChunks or does not set `mayContainCompressedIds`, then no compression will be applied even when providing `idCompressor`.
|
|
429
429
|
*/
|
|
430
430
|
readonly idCompressor: IIdCompressor | undefined;
|
|
431
431
|
}
|
|
@@ -583,6 +583,7 @@ export function insertValues(
|
|
|
583
583
|
// Slow path: walk shape and cursor together, inserting values.
|
|
584
584
|
if (shape.hasValue) {
|
|
585
585
|
if (
|
|
586
|
+
shape.mayContainCompressedIds &&
|
|
586
587
|
typeof cursor.value === "string" &&
|
|
587
588
|
idCompressor !== undefined &&
|
|
588
589
|
isStableNodeIdentifier(cursor.value)
|
|
@@ -5,7 +5,6 @@
|
|
|
5
5
|
|
|
6
6
|
import { assert, compareArrays, oob, fail } from "@fluidframework/core-utils/internal";
|
|
7
7
|
import type { SessionSpaceCompressedId, IIdCompressor } from "@fluidframework/id-compressor";
|
|
8
|
-
import { UsageError } from "@fluidframework/telemetry-utils/internal";
|
|
9
8
|
|
|
10
9
|
import {
|
|
11
10
|
CursorLocationType,
|
|
@@ -54,7 +53,7 @@ export class UniformChunk extends ReferenceCountedBase implements TreeChunk {
|
|
|
54
53
|
idCompressor?: IIdCompressor,
|
|
55
54
|
) {
|
|
56
55
|
super();
|
|
57
|
-
this.idCompressor = idCompressor;
|
|
56
|
+
this.idCompressor = shape.treeShape.mayContainCompressedIds ? idCompressor : undefined;
|
|
58
57
|
assert(
|
|
59
58
|
shape.treeShape.valuesPerTopLevelNode * shape.topLevelLength === values.length,
|
|
60
59
|
0x4c3 /* invalid number of values for shape */,
|
|
@@ -100,30 +99,45 @@ export class TreeShape {
|
|
|
100
99
|
// TODO: this is only needed at chunk roots. Optimize it base on that.
|
|
101
100
|
public readonly positions: readonly NodePositionInfo[];
|
|
102
101
|
|
|
102
|
+
/**
|
|
103
|
+
* Whether chunks using this shape (including any descendant leaf within it) may contain values compressed by the {@link UniformChunk.idCompressor}.
|
|
104
|
+
*
|
|
105
|
+
* @remarks
|
|
106
|
+
* For string leaf nodes, this can be explicitly set to `true` to indicate that the value may be a compressed id
|
|
107
|
+
* stored as a number that needs to be decompressed back to a string.
|
|
108
|
+
* For non-leaf nodes, this is automatically derived from whether any child shapes have it set.
|
|
109
|
+
*/
|
|
110
|
+
public readonly mayContainCompressedIds: boolean;
|
|
111
|
+
|
|
103
112
|
/**
|
|
104
113
|
*
|
|
105
114
|
* @param type - {@link TreeNodeSchemaIdentifier} used to compare shapes.
|
|
106
115
|
* @param hasValue - whether or not the TreeShape has a value.
|
|
107
116
|
* @param fieldsArray - an array of {@link FieldShape} values, which contains a TreeShape for each FieldKey.
|
|
108
117
|
*
|
|
109
|
-
* @param
|
|
110
|
-
*
|
|
111
|
-
*
|
|
118
|
+
* @param maybeCompressedIdLeaf - whether the value may have been compressed by the {@link UniformChunk.idCompressor}.
|
|
119
|
+
* Can only be explicitly set to `true` on string leaf nodes; otherwise this constructor asserts.
|
|
120
|
+
* For non-leaf nodes, {@link TreeShape.mayContainCompressedIds} is automatically derived from child shapes.
|
|
112
121
|
*/
|
|
113
122
|
public constructor(
|
|
114
123
|
public readonly type: TreeNodeSchemaIdentifier,
|
|
115
124
|
public readonly hasValue: boolean,
|
|
116
125
|
public readonly fieldsArray: readonly FieldShape[],
|
|
117
|
-
|
|
126
|
+
maybeCompressedIdLeaf: boolean = false,
|
|
118
127
|
) {
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
)
|
|
123
|
-
|
|
124
|
-
|
|
128
|
+
assert(
|
|
129
|
+
hasValue === false || fieldsArray.length === 0,
|
|
130
|
+
0xcef /* only non-leaf can have fields */,
|
|
131
|
+
);
|
|
132
|
+
if (maybeCompressedIdLeaf) {
|
|
133
|
+
assert(
|
|
134
|
+
hasValue && type === "com.fluidframework.leaf.string",
|
|
135
|
+
0xcf0 /* only strings can opt into maybeCompressedIdLeaf */,
|
|
125
136
|
);
|
|
126
137
|
}
|
|
138
|
+
// For non-leaf nodes, derive from whether any child shapes contain compressed ids.
|
|
139
|
+
this.mayContainCompressedIds =
|
|
140
|
+
maybeCompressedIdLeaf || fieldsArray.some(([, shape]) => shape.mayContainCompressedIds);
|
|
127
141
|
const fields: Map<FieldKey, OffsetShape> = new Map();
|
|
128
142
|
let numberOfValues = hasValue ? 1 : 0;
|
|
129
143
|
const infos: NodePositionInfo[] = [
|
|
@@ -146,7 +160,7 @@ export class TreeShape {
|
|
|
146
160
|
}
|
|
147
161
|
|
|
148
162
|
public equals(other: TreeShape): boolean {
|
|
149
|
-
// TODO: either
|
|
163
|
+
// TODO: either dedupe instances and/or store a collision resistant hash for fast compare.
|
|
150
164
|
|
|
151
165
|
if (
|
|
152
166
|
!compareArrays(
|
|
@@ -157,7 +171,11 @@ export class TreeShape {
|
|
|
157
171
|
) {
|
|
158
172
|
return false;
|
|
159
173
|
}
|
|
160
|
-
return
|
|
174
|
+
return (
|
|
175
|
+
this.type === other.type &&
|
|
176
|
+
this.hasValue === other.hasValue &&
|
|
177
|
+
this.mayContainCompressedIds === other.mayContainCompressedIds
|
|
178
|
+
);
|
|
161
179
|
}
|
|
162
180
|
|
|
163
181
|
public withTopLevelLength(topLevelLength: number): ChunkShape {
|
|
@@ -548,16 +566,20 @@ class Cursor extends SynchronousCursor implements ChunkedCursor {
|
|
|
548
566
|
}
|
|
549
567
|
|
|
550
568
|
public get value(): Value {
|
|
551
|
-
const idCompressor = this.chunk.idCompressor;
|
|
552
569
|
const info = this.nodeInfo(CursorLocationType.Nodes);
|
|
553
|
-
|
|
554
|
-
// This flag can only ever be set on string leaf nodes, so if the value is a number, we can assume it is a compressible, known stable id.
|
|
555
|
-
if (info.shape.hasValue && info.shape.maybeDecompressedStringAsNumber) {
|
|
570
|
+
if (info.shape.hasValue) {
|
|
556
571
|
const value = this.chunk.values[info.valueOffset];
|
|
557
|
-
if
|
|
572
|
+
// If mayContainCompressedIds is set, check if the value is a number (i.e. a compressed ID that needs decompression).
|
|
573
|
+
if (info.shape.mayContainCompressedIds && typeof value === "number") {
|
|
574
|
+
const idCompressor = this.chunk.idCompressor;
|
|
575
|
+
assert(
|
|
576
|
+
idCompressor !== undefined,
|
|
577
|
+
0xcf1 /* chunk required idCompressor but did not provide it */,
|
|
578
|
+
);
|
|
558
579
|
return idCompressor.decompress(value as SessionSpaceCompressedId);
|
|
559
580
|
}
|
|
581
|
+
return value;
|
|
560
582
|
}
|
|
561
|
-
return
|
|
583
|
+
return undefined;
|
|
562
584
|
}
|
|
563
585
|
}
|
|
@@ -51,6 +51,7 @@ export type KeyFinder<TKey> = (tree: ITreeSubscriptionCursor) => TKey;
|
|
|
51
51
|
* calling {@link keys} will not include any keys that are stored in the index but only map to detached nodes.
|
|
52
52
|
*/
|
|
53
53
|
export class AnchorTreeIndex<TKey, TValue> implements TreeIndex<TKey, TValue> {
|
|
54
|
+
public readonly [Symbol.toStringTag] = "AnchorTreeIndex";
|
|
54
55
|
public disposed = false;
|
|
55
56
|
/**
|
|
56
57
|
* Caches {@link KeyFinder}s for each schema definition. If a schema maps to null, it does not
|
|
@@ -3,10 +3,12 @@
|
|
|
3
3
|
* Licensed under the MIT License.
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
|
+
import type { FluidReadonlyMap } from "@fluidframework/core-interfaces/internal";
|
|
7
|
+
|
|
6
8
|
/**
|
|
7
9
|
* an array of nodes that is guaranteed to have at least one element
|
|
8
10
|
*
|
|
9
|
-
* @
|
|
11
|
+
* @beta
|
|
10
12
|
*/
|
|
11
13
|
export type TreeIndexNodes<TNode> = readonly [first: TNode, ...rest: TNode[]];
|
|
12
14
|
|
|
@@ -23,9 +25,9 @@ export type TreeIndexNodes<TNode> = readonly [first: TNode, ...rest: TNode[]];
|
|
|
23
25
|
* Since currently partially loading a tree is not supported, there is no need for this.
|
|
24
26
|
* At some point the low level shared tree index type for persisted indexes could be leveraged to provide user facing extensible sets of persisted indexes.
|
|
25
27
|
* @sealed
|
|
26
|
-
* @
|
|
28
|
+
* @beta
|
|
27
29
|
*/
|
|
28
|
-
export interface TreeIndex<TKey, TValue> extends
|
|
30
|
+
export interface TreeIndex<TKey, TValue> extends FluidReadonlyMap<TKey, TValue> {
|
|
29
31
|
/**
|
|
30
32
|
* Disposes the index such that it can no longer be used and receives no updates for changes in the tree.
|
|
31
33
|
* @remarks
|
package/src/index.ts
CHANGED
|
@@ -111,6 +111,7 @@ export {
|
|
|
111
111
|
type TreeChangeEvents,
|
|
112
112
|
type NodeFromSchema,
|
|
113
113
|
type TreeMapNode,
|
|
114
|
+
type TreeMapNodeAlpha,
|
|
114
115
|
type InsertableTreeNodeFromImplicitAllowedTypes,
|
|
115
116
|
type TreeLeafValue,
|
|
116
117
|
FieldKind,
|
|
@@ -136,10 +137,13 @@ export {
|
|
|
136
137
|
type ArrayNodeInsertOp,
|
|
137
138
|
type ArrayNodeRemoveOp,
|
|
138
139
|
type ArrayNodeRetainOp,
|
|
140
|
+
type ArrayNodeTreeChangedDeltaOp,
|
|
141
|
+
type ArrayNodeTreeChangedRetainOp,
|
|
139
142
|
type NodeChangedData,
|
|
140
143
|
type NodeChangedDataAlpha,
|
|
141
144
|
type NodeChangedDataDelta,
|
|
142
145
|
type NodeChangedDataProperties,
|
|
146
|
+
type NodeChangedDataTreeDelta,
|
|
143
147
|
type SchemaUpgrade,
|
|
144
148
|
contentSchemaSymbol,
|
|
145
149
|
// Types not really intended for public use, but used in links.
|
package/src/packageVersion.ts
CHANGED
|
@@ -6,6 +6,12 @@
|
|
|
6
6
|
import type { IFluidHandle } from "@fluidframework/core-interfaces";
|
|
7
7
|
|
|
8
8
|
import {
|
|
9
|
+
// #region Unused imports to make d.ts cleaner
|
|
10
|
+
/* eslint-disable unused-imports/no-unused-imports, @typescript-eslint/no-unused-vars */
|
|
11
|
+
NodeKind,
|
|
12
|
+
System_Unsafe,
|
|
13
|
+
/* eslint-enable unused-imports/no-unused-imports, @typescript-eslint/no-unused-vars */
|
|
14
|
+
// #endregion
|
|
9
15
|
SchemaFactory,
|
|
10
16
|
SchemaFactoryBeta,
|
|
11
17
|
type FixRecursiveArraySchema,
|
|
@@ -240,8 +240,12 @@ export interface TreeAlpha {
|
|
|
240
240
|
* @returns A callback function which will deregister the event.
|
|
241
241
|
* This callback should be called only once.
|
|
242
242
|
* @remarks
|
|
243
|
-
* Provides
|
|
244
|
-
*
|
|
243
|
+
* Provides richer events than {@link (TreeBeta:interface).on} for array nodes:
|
|
244
|
+
* - `nodeChanged` includes a {@link NodeChangedDataDelta.delta | delta} payload for direct
|
|
245
|
+
* changes (insert, remove, move).
|
|
246
|
+
* - `treeChanged` also includes a {@link NodeChangedDataDelta.delta | delta} payload and fires
|
|
247
|
+
* for both shallow changes and deep changes (e.g. a property of an element changed without
|
|
248
|
+
* any direct array change).
|
|
245
249
|
*/
|
|
246
250
|
on<K extends keyof TreeChangeEventsAlpha<TNode>, TNode extends TreeNode>(
|
|
247
251
|
node: TNode,
|
|
@@ -363,7 +363,12 @@ function* getFieldDiscrepancies(
|
|
|
363
363
|
fail(0xbef /* A conversion from a FieldKind to a FlexFieldKind should exist */);
|
|
364
364
|
|
|
365
365
|
// This checks if the field kind in the view schema is not compatible with the stored schema.
|
|
366
|
-
|
|
366
|
+
// A staged optional field (optional in the view) is compatible with a required stored field
|
|
367
|
+
// during the rollout period — suppress the kind discrepancy in that case.
|
|
368
|
+
if (
|
|
369
|
+
viewKind.identifier !== stored.kind &&
|
|
370
|
+
!(view.isStagedOptional !== false && stored.kind === FieldKinds.required.identifier)
|
|
371
|
+
) {
|
|
367
372
|
yield {
|
|
368
373
|
identifier,
|
|
369
374
|
fieldKey,
|
|
@@ -17,7 +17,7 @@ import type { TreeView } from "./tree.js";
|
|
|
17
17
|
/**
|
|
18
18
|
* An index that returns tree nodes given their associated identifiers.
|
|
19
19
|
*
|
|
20
|
-
* @
|
|
20
|
+
* @beta
|
|
21
21
|
*/
|
|
22
22
|
export type IdentifierIndex = TreeIndex<string, TreeNode>;
|
|
23
23
|
|
|
@@ -28,7 +28,7 @@ function isStringKey(key: TreeIndexKey): key is string {
|
|
|
28
28
|
/**
|
|
29
29
|
* Creates an {@link IdentifierIndex} for a given {@link TreeView}.
|
|
30
30
|
*
|
|
31
|
-
* @
|
|
31
|
+
* @beta
|
|
32
32
|
*/
|
|
33
33
|
export function createIdentifierIndex<TSchema extends ImplicitFieldSchema>(
|
|
34
34
|
view: TreeView<TSchema>,
|
|
@@ -66,6 +66,7 @@ export {
|
|
|
66
66
|
createCustomizedFluidFrameworkScopedFactory,
|
|
67
67
|
} from "./schemaCreationUtilities.js";
|
|
68
68
|
export {
|
|
69
|
+
deltaMarksToArrayOps,
|
|
69
70
|
getIdentifierFromNode,
|
|
70
71
|
getPropertyKeyFromStoredKey,
|
|
71
72
|
getStoredKey,
|
|
@@ -158,9 +159,12 @@ export {
|
|
|
158
159
|
type ArrayNodeInsertOp,
|
|
159
160
|
type ArrayNodeRemoveOp,
|
|
160
161
|
type ArrayNodeRetainOp,
|
|
162
|
+
type ArrayNodeTreeChangedDeltaOp,
|
|
163
|
+
type ArrayNodeTreeChangedRetainOp,
|
|
161
164
|
type NodeChangedDataAlpha,
|
|
162
165
|
type NodeChangedDataDelta,
|
|
163
166
|
type NodeChangedDataProperties,
|
|
167
|
+
type NodeChangedDataTreeDelta,
|
|
164
168
|
type TreeChangeEventsAlpha,
|
|
165
169
|
} from "./treeAlpha.js";
|
|
166
170
|
export { createTreeIndex, type TreeIndexKey } from "./simpleTreeIndex.js";
|
|
@@ -11,6 +11,7 @@ import {
|
|
|
11
11
|
type WithType,
|
|
12
12
|
normalizeAllowedTypes,
|
|
13
13
|
isTreeNode,
|
|
14
|
+
createSchemaUpgrade,
|
|
14
15
|
} from "../core/index.js";
|
|
15
16
|
// These imports prevent a large number of type references in the API reports from showing up as *_2.
|
|
16
17
|
/* eslint-disable unused-imports/no-unused-imports, @typescript-eslint/no-unused-vars, import-x/no-duplicates */
|
|
@@ -18,7 +19,7 @@ import {
|
|
|
18
19
|
type FieldProps,
|
|
19
20
|
type FieldSchemaAlpha,
|
|
20
21
|
type FieldPropsAlpha,
|
|
21
|
-
|
|
22
|
+
FieldKind,
|
|
22
23
|
type ImplicitFieldSchema,
|
|
23
24
|
type InsertableTreeFieldFromImplicitField,
|
|
24
25
|
type FieldSchema,
|
|
@@ -143,6 +144,42 @@ export interface SchemaStaticsAlpha {
|
|
|
143
144
|
TCustomMetadata,
|
|
144
145
|
FieldPropsAlpha<TCustomMetadata> & { defaultProvider: DefaultProvider }
|
|
145
146
|
>;
|
|
147
|
+
/**
|
|
148
|
+
* Creates a field schema that is Optional in the view but behaves as Required in the stored schema
|
|
149
|
+
* during the rollout period of an optional-field migration.
|
|
150
|
+
*
|
|
151
|
+
* @remarks
|
|
152
|
+
* Use this to incrementally migrate a required field to optional without a coordinated deployment.
|
|
153
|
+
* The migration path is:
|
|
154
|
+
*
|
|
155
|
+
* 1. Start with `sf.required(T)` — all clients require the field.
|
|
156
|
+
* 2. Deploy `sf.stagedOptional(T)` — new clients can read documents where the field is present or absent, but the stored schema stays Required (so old clients are unaffected). Writing `undefined` is blocked at runtime.
|
|
157
|
+
* 3. Deploy `sf.optional(T)` once all clients support the staged optional field — the stored schema becomes Optional and the field can be cleared.
|
|
158
|
+
*
|
|
159
|
+
* Analogous to {@link SchemaStaticsBeta.staged} for allowed types, but for field optionality.
|
|
160
|
+
*
|
|
161
|
+
* @param t - The types allowed under the field.
|
|
162
|
+
* @param props - Optional properties to associate with the field.
|
|
163
|
+
*
|
|
164
|
+
* @typeParam TCustomMetadata - Custom metadata properties to associate with the field.
|
|
165
|
+
* See {@link FieldSchemaMetadata.custom}.
|
|
166
|
+
*/
|
|
167
|
+
readonly stagedOptional: <
|
|
168
|
+
const T extends ImplicitAllowedTypes,
|
|
169
|
+
const TCustomMetadata = unknown,
|
|
170
|
+
>(
|
|
171
|
+
t: T,
|
|
172
|
+
props?: Omit<
|
|
173
|
+
FieldPropsAlpha<TCustomMetadata>,
|
|
174
|
+
"defaultProvider" | "stagedOptionalUpgrade"
|
|
175
|
+
>,
|
|
176
|
+
) => FieldSchemaAlpha<
|
|
177
|
+
FieldKind.Optional,
|
|
178
|
+
T,
|
|
179
|
+
TCustomMetadata,
|
|
180
|
+
FieldPropsAlpha<TCustomMetadata>
|
|
181
|
+
>;
|
|
182
|
+
|
|
146
183
|
/**
|
|
147
184
|
* {@link SchemaStaticsAlpha.withDefault} except tweaked to work better for recursive types.
|
|
148
185
|
* Use with {@link ValidateRecursiveSchema} for improved type safety.
|
|
@@ -225,10 +262,28 @@ const withDefault = <
|
|
|
225
262
|
);
|
|
226
263
|
};
|
|
227
264
|
|
|
265
|
+
const stagedOptional = <const T extends ImplicitAllowedTypes, const TCustomMetadata = unknown>(
|
|
266
|
+
t: T,
|
|
267
|
+
props?: Omit<FieldPropsAlpha<TCustomMetadata>, "defaultProvider" | "stagedOptionalUpgrade">,
|
|
268
|
+
): FieldSchemaAlpha<
|
|
269
|
+
FieldKind.Optional,
|
|
270
|
+
T,
|
|
271
|
+
TCustomMetadata,
|
|
272
|
+
FieldPropsAlpha<TCustomMetadata>
|
|
273
|
+
> => {
|
|
274
|
+
return createFieldSchema(FieldKind.Optional, t, {
|
|
275
|
+
defaultProvider: getDefaultProvider(() => []),
|
|
276
|
+
...props,
|
|
277
|
+
stagedOptionalUpgrade: createSchemaUpgrade(),
|
|
278
|
+
});
|
|
279
|
+
};
|
|
280
|
+
|
|
228
281
|
const schemaStaticsAlpha: SchemaStaticsAlpha = {
|
|
229
282
|
withDefault,
|
|
230
283
|
|
|
231
284
|
withDefaultRecursive: withDefault as SchemaStaticsAlpha["withDefaultRecursive"],
|
|
285
|
+
|
|
286
|
+
stagedOptional,
|
|
232
287
|
};
|
|
233
288
|
|
|
234
289
|
/**
|
|
@@ -448,7 +503,17 @@ export class SchemaFactoryAlpha<
|
|
|
448
503
|
public static readonly withDefaultRecursive = schemaStaticsAlpha.withDefaultRecursive;
|
|
449
504
|
|
|
450
505
|
/**
|
|
451
|
-
*
|
|
506
|
+
* {@inheritdoc SchemaStaticsAlpha.stagedOptional}
|
|
507
|
+
*/
|
|
508
|
+
public readonly stagedOptional = schemaStaticsAlpha.stagedOptional;
|
|
509
|
+
|
|
510
|
+
/**
|
|
511
|
+
* {@inheritdoc SchemaStaticsAlpha.stagedOptional}
|
|
512
|
+
*/
|
|
513
|
+
public static readonly stagedOptional = schemaStaticsAlpha.stagedOptional;
|
|
514
|
+
|
|
515
|
+
/**
|
|
516
|
+
* Define a {@link TreeNodeSchema} for a {@link TreeMapNodeAlpha}.
|
|
452
517
|
*
|
|
453
518
|
* @param name - Unique identifier for this schema within this factory's scope.
|
|
454
519
|
* @param allowedTypes - The types that may appear as values in the map.
|
|
@@ -39,7 +39,7 @@ import { treeNodeApi } from "./treeNodeApi.js";
|
|
|
39
39
|
* @remarks
|
|
40
40
|
* This supports values which have value semantics and are compared by value, just like {@link TreeLeafValue}.
|
|
41
41
|
* This allows using any tree value as a key (for example in an index tracking where those values occur in the tree).
|
|
42
|
-
* @
|
|
42
|
+
* @beta
|
|
43
43
|
*/
|
|
44
44
|
export type TreeIndexKey = TreeLeafValue;
|
|
45
45
|
|
|
@@ -52,7 +52,7 @@ export type TreeIndexKey = TreeLeafValue;
|
|
|
52
52
|
* @param getValue - given at least one {@link TreeNode}, returns an associated value
|
|
53
53
|
* @param isKeyValid - function for verifying the validity of the key retrieved based on the information given by the indexer
|
|
54
54
|
*
|
|
55
|
-
* @
|
|
55
|
+
* @beta
|
|
56
56
|
*/
|
|
57
57
|
export function createTreeIndex<
|
|
58
58
|
TFieldSchema extends ImplicitFieldSchema,
|
|
@@ -75,7 +75,7 @@ export function createTreeIndex<
|
|
|
75
75
|
* @param isKeyValid - function for verifying the validity of the key retrieved based on the information given by the indexer
|
|
76
76
|
* @param indexableSchema - a list of all the schema types that can be indexed
|
|
77
77
|
*
|
|
78
|
-
* @
|
|
78
|
+
* @beta
|
|
79
79
|
*/
|
|
80
80
|
export function createTreeIndex<
|
|
81
81
|
TFieldSchema extends ImplicitFieldSchema,
|
|
@@ -99,7 +99,7 @@ export function createTreeIndex<
|
|
|
99
99
|
* @param getValue - given at least one {@link TreeNode}, returns an associated value
|
|
100
100
|
* @param isKeyValid - function for verifying the validity of the key retrieved based on the information given by the indexer
|
|
101
101
|
*
|
|
102
|
-
* @
|
|
102
|
+
* @beta
|
|
103
103
|
*/
|
|
104
104
|
export function createTreeIndex<
|
|
105
105
|
TFieldSchema extends ImplicitFieldSchema,
|
|
@@ -122,7 +122,7 @@ export function createTreeIndex<
|
|
|
122
122
|
* @param isKeyValid - function for verifying the validity of the key retrieved based on the information given by the indexer
|
|
123
123
|
* @param indexableSchema - a list of all the schema types that can be indexed
|
|
124
124
|
*
|
|
125
|
-
* @
|
|
125
|
+
* @beta
|
|
126
126
|
*/
|
|
127
127
|
export function createTreeIndex<
|
|
128
128
|
TFieldSchema extends ImplicitFieldSchema,
|
|
@@ -140,7 +140,7 @@ export function createTreeIndex<
|
|
|
140
140
|
/**
|
|
141
141
|
* Creates a {@link TreeIndex} with a specified indexer.
|
|
142
142
|
*
|
|
143
|
-
* @
|
|
143
|
+
* @beta
|
|
144
144
|
*/
|
|
145
145
|
export function createTreeIndex<
|
|
146
146
|
TFieldSchema extends ImplicitFieldSchema,
|
|
@@ -53,7 +53,10 @@ export function extractPersistedSchema(
|
|
|
53
53
|
minVersionForCollab: MinimumVersionForCollab,
|
|
54
54
|
includeStaged: (upgrade: SchemaUpgrade) => boolean,
|
|
55
55
|
): JsonCompatible {
|
|
56
|
-
const stored = toStoredSchema(schema, {
|
|
56
|
+
const stored = toStoredSchema(schema, {
|
|
57
|
+
includeStaged,
|
|
58
|
+
includeStagedOptional: includeStaged,
|
|
59
|
+
});
|
|
57
60
|
const codec = schemaCodecBuilder.build({
|
|
58
61
|
minVersionForCollab,
|
|
59
62
|
jsonValidator: FormatValidatorNoOp,
|