@fluidframework/tree 2.21.0 → 2.22.1
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 +10 -0
- package/README.md +1 -0
- package/api-report/tree.alpha.api.md +29 -4
- package/api-report/tree.beta.api.md +29 -4
- package/api-report/tree.legacy.alpha.api.md +29 -4
- package/api-report/tree.legacy.public.api.md +29 -4
- package/api-report/tree.public.api.md +29 -4
- package/dist/alpha.d.ts +1 -0
- package/dist/beta.d.ts +1 -0
- package/dist/core/forest/editableForest.js +1 -1
- package/dist/core/forest/editableForest.js.map +1 -1
- package/dist/core/index.d.ts +1 -1
- package/dist/core/index.d.ts.map +1 -1
- package/dist/core/index.js.map +1 -1
- package/dist/core/tree/anchorSet.d.ts +2 -5
- package/dist/core/tree/anchorSet.d.ts.map +1 -1
- package/dist/core/tree/anchorSet.js +1 -151
- package/dist/core/tree/anchorSet.js.map +1 -1
- package/dist/core/tree/index.d.ts +1 -2
- package/dist/core/tree/index.d.ts.map +1 -1
- package/dist/core/tree/index.js.map +1 -1
- package/dist/core/tree/pathTree.d.ts +0 -11
- package/dist/core/tree/pathTree.d.ts.map +1 -1
- package/dist/core/tree/pathTree.js.map +1 -1
- package/dist/feature-libraries/chunked-forest/codec/compressedEncode.js +1 -1
- package/dist/feature-libraries/chunked-forest/codec/compressedEncode.js.map +1 -1
- package/dist/feature-libraries/default-schema/defaultFieldKinds.js +1 -1
- package/dist/feature-libraries/default-schema/defaultFieldKinds.js.map +1 -1
- package/dist/feature-libraries/detachedFieldIndexSummarizer.d.ts +1 -2
- package/dist/feature-libraries/detachedFieldIndexSummarizer.d.ts.map +1 -1
- package/dist/feature-libraries/detachedFieldIndexSummarizer.js +0 -9
- package/dist/feature-libraries/detachedFieldIndexSummarizer.js.map +1 -1
- package/dist/feature-libraries/flex-tree/treeEvents.d.ts +2 -4
- package/dist/feature-libraries/flex-tree/treeEvents.d.ts.map +1 -1
- package/dist/feature-libraries/flex-tree/treeEvents.js.map +1 -1
- package/dist/feature-libraries/forest-summary/forestSummarizer.d.ts +1 -2
- package/dist/feature-libraries/forest-summary/forestSummarizer.d.ts.map +1 -1
- package/dist/feature-libraries/forest-summary/forestSummarizer.js +0 -9
- package/dist/feature-libraries/forest-summary/forestSummarizer.js.map +1 -1
- package/dist/feature-libraries/modular-schema/fieldChangeHandler.d.ts +6 -2
- package/dist/feature-libraries/modular-schema/fieldChangeHandler.d.ts.map +1 -1
- package/dist/feature-libraries/modular-schema/fieldChangeHandler.js.map +1 -1
- package/dist/feature-libraries/modular-schema/genericFieldKind.d.ts +2 -4
- package/dist/feature-libraries/modular-schema/genericFieldKind.d.ts.map +1 -1
- package/dist/feature-libraries/modular-schema/genericFieldKind.js +4 -19
- package/dist/feature-libraries/modular-schema/genericFieldKind.js.map +1 -1
- package/dist/feature-libraries/modular-schema/modularChangeFamily.d.ts.map +1 -1
- package/dist/feature-libraries/modular-schema/modularChangeFamily.js +11 -12
- package/dist/feature-libraries/modular-schema/modularChangeFamily.js.map +1 -1
- package/dist/feature-libraries/node-key/mockNodeKeyManager.js +1 -1
- package/dist/feature-libraries/node-key/mockNodeKeyManager.js.map +1 -1
- package/dist/feature-libraries/optional-field/optionalField.d.ts.map +1 -1
- package/dist/feature-libraries/optional-field/optionalField.js +7 -3
- package/dist/feature-libraries/optional-field/optionalField.js.map +1 -1
- package/dist/feature-libraries/schema-index/schemaSummarizer.d.ts +3 -5
- package/dist/feature-libraries/schema-index/schemaSummarizer.d.ts.map +1 -1
- package/dist/feature-libraries/schema-index/schemaSummarizer.js +1 -11
- package/dist/feature-libraries/schema-index/schemaSummarizer.js.map +1 -1
- package/dist/feature-libraries/sequence-field/sequenceFieldEditor.d.ts +1 -1
- package/dist/feature-libraries/sequence-field/sequenceFieldEditor.d.ts.map +1 -1
- package/dist/feature-libraries/sequence-field/sequenceFieldEditor.js +13 -1
- package/dist/feature-libraries/sequence-field/sequenceFieldEditor.js.map +1 -1
- package/dist/index.d.ts +3 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +4 -4
- 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/public.d.ts +1 -0
- package/dist/shared-tree/index.d.ts +1 -3
- package/dist/shared-tree/index.d.ts.map +1 -1
- package/dist/shared-tree/index.js +1 -7
- package/dist/shared-tree/index.js.map +1 -1
- package/dist/shared-tree/schematizingTreeView.d.ts +4 -5
- package/dist/shared-tree/schematizingTreeView.d.ts.map +1 -1
- package/dist/shared-tree/schematizingTreeView.js +9 -10
- package/dist/shared-tree/schematizingTreeView.js.map +1 -1
- package/dist/shared-tree/sharedTree.d.ts +39 -39
- package/dist/shared-tree/sharedTree.d.ts.map +1 -1
- package/dist/shared-tree/sharedTree.js +81 -52
- package/dist/shared-tree/sharedTree.js.map +1 -1
- package/dist/shared-tree/treeApi.d.ts +2 -2
- package/dist/shared-tree/treeApi.d.ts.map +1 -1
- package/dist/shared-tree/treeApi.js +9 -3
- package/dist/shared-tree/treeApi.js.map +1 -1
- package/dist/shared-tree/treeCheckout.d.ts +3 -3
- package/dist/shared-tree/treeCheckout.d.ts.map +1 -1
- package/dist/shared-tree/treeCheckout.js +3 -2
- package/dist/shared-tree/treeCheckout.js.map +1 -1
- package/dist/shared-tree-core/editManager.js +1 -1
- package/dist/shared-tree-core/editManager.js.map +1 -1
- package/dist/shared-tree-core/editManagerSummarizer.d.ts +1 -2
- package/dist/shared-tree-core/editManagerSummarizer.d.ts.map +1 -1
- package/dist/shared-tree-core/editManagerSummarizer.js +0 -9
- package/dist/shared-tree-core/editManagerSummarizer.js.map +1 -1
- package/dist/shared-tree-core/sequenceIdUtils.d.ts +12 -1
- package/dist/shared-tree-core/sequenceIdUtils.d.ts.map +1 -1
- package/dist/shared-tree-core/sequenceIdUtils.js +25 -7
- package/dist/shared-tree-core/sequenceIdUtils.js.map +1 -1
- package/dist/shared-tree-core/sharedTreeCore.d.ts +25 -30
- package/dist/shared-tree-core/sharedTreeCore.d.ts.map +1 -1
- package/dist/shared-tree-core/sharedTreeCore.js +20 -49
- package/dist/shared-tree-core/sharedTreeCore.js.map +1 -1
- package/dist/simple-tree/api/index.d.ts +3 -2
- package/dist/simple-tree/api/index.d.ts.map +1 -1
- package/dist/simple-tree/api/index.js +3 -1
- package/dist/simple-tree/api/index.js.map +1 -1
- package/dist/simple-tree/api/schemaFactory.d.ts +156 -63
- package/dist/simple-tree/api/schemaFactory.d.ts.map +1 -1
- package/dist/simple-tree/api/schemaFactory.js +179 -86
- package/dist/simple-tree/api/schemaFactory.js.map +1 -1
- package/dist/{shared-tree → simple-tree/api}/transactionTypes.d.ts +1 -1
- package/dist/simple-tree/api/transactionTypes.d.ts.map +1 -0
- package/dist/{shared-tree → simple-tree/api}/transactionTypes.js.map +1 -1
- package/dist/simple-tree/api/tree.d.ts +23 -2
- package/dist/simple-tree/api/tree.d.ts.map +1 -1
- package/dist/simple-tree/api/tree.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 +3 -2
- package/dist/simple-tree/index.js.map +1 -1
- package/dist/simple-tree/schemaTypes.d.ts +2 -2
- package/dist/simple-tree/schemaTypes.js +1 -1
- package/dist/simple-tree/schemaTypes.js.map +1 -1
- package/dist/simple-tree/treeNodeValid.js +1 -2
- package/dist/simple-tree/treeNodeValid.js.map +1 -1
- package/dist/treeFactory.d.ts +16 -5
- package/dist/treeFactory.d.ts.map +1 -1
- package/dist/treeFactory.js +21 -12
- package/dist/treeFactory.js.map +1 -1
- package/dist/util/breakable.d.ts +1 -1
- package/dist/util/breakable.d.ts.map +1 -1
- package/dist/util/breakable.js.map +1 -1
- package/dist/util/rangeMap.d.ts +1 -1
- package/dist/util/rangeMap.js +1 -1
- package/dist/util/rangeMap.js.map +1 -1
- package/lib/alpha.d.ts +1 -0
- package/lib/beta.d.ts +1 -0
- package/lib/core/forest/editableForest.js +1 -1
- package/lib/core/forest/editableForest.js.map +1 -1
- package/lib/core/index.d.ts +1 -1
- package/lib/core/index.d.ts.map +1 -1
- package/lib/core/index.js.map +1 -1
- package/lib/core/tree/anchorSet.d.ts +2 -5
- package/lib/core/tree/anchorSet.d.ts.map +1 -1
- package/lib/core/tree/anchorSet.js +1 -151
- package/lib/core/tree/anchorSet.js.map +1 -1
- package/lib/core/tree/index.d.ts +1 -2
- package/lib/core/tree/index.d.ts.map +1 -1
- package/lib/core/tree/index.js.map +1 -1
- package/lib/core/tree/pathTree.d.ts +0 -11
- package/lib/core/tree/pathTree.d.ts.map +1 -1
- package/lib/core/tree/pathTree.js.map +1 -1
- package/lib/feature-libraries/chunked-forest/codec/compressedEncode.js +1 -1
- package/lib/feature-libraries/chunked-forest/codec/compressedEncode.js.map +1 -1
- package/lib/feature-libraries/default-schema/defaultFieldKinds.js +1 -1
- package/lib/feature-libraries/default-schema/defaultFieldKinds.js.map +1 -1
- package/lib/feature-libraries/detachedFieldIndexSummarizer.d.ts +1 -2
- package/lib/feature-libraries/detachedFieldIndexSummarizer.d.ts.map +1 -1
- package/lib/feature-libraries/detachedFieldIndexSummarizer.js +0 -9
- package/lib/feature-libraries/detachedFieldIndexSummarizer.js.map +1 -1
- package/lib/feature-libraries/flex-tree/treeEvents.d.ts +2 -4
- package/lib/feature-libraries/flex-tree/treeEvents.d.ts.map +1 -1
- package/lib/feature-libraries/flex-tree/treeEvents.js.map +1 -1
- package/lib/feature-libraries/forest-summary/forestSummarizer.d.ts +1 -2
- package/lib/feature-libraries/forest-summary/forestSummarizer.d.ts.map +1 -1
- package/lib/feature-libraries/forest-summary/forestSummarizer.js +0 -9
- package/lib/feature-libraries/forest-summary/forestSummarizer.js.map +1 -1
- package/lib/feature-libraries/modular-schema/fieldChangeHandler.d.ts +6 -2
- package/lib/feature-libraries/modular-schema/fieldChangeHandler.d.ts.map +1 -1
- package/lib/feature-libraries/modular-schema/fieldChangeHandler.js.map +1 -1
- package/lib/feature-libraries/modular-schema/genericFieldKind.d.ts +2 -4
- package/lib/feature-libraries/modular-schema/genericFieldKind.d.ts.map +1 -1
- package/lib/feature-libraries/modular-schema/genericFieldKind.js +4 -19
- package/lib/feature-libraries/modular-schema/genericFieldKind.js.map +1 -1
- package/lib/feature-libraries/modular-schema/modularChangeFamily.d.ts.map +1 -1
- package/lib/feature-libraries/modular-schema/modularChangeFamily.js +11 -12
- package/lib/feature-libraries/modular-schema/modularChangeFamily.js.map +1 -1
- package/lib/feature-libraries/node-key/mockNodeKeyManager.js +1 -1
- package/lib/feature-libraries/node-key/mockNodeKeyManager.js.map +1 -1
- package/lib/feature-libraries/optional-field/optionalField.d.ts.map +1 -1
- package/lib/feature-libraries/optional-field/optionalField.js +7 -3
- package/lib/feature-libraries/optional-field/optionalField.js.map +1 -1
- package/lib/feature-libraries/schema-index/schemaSummarizer.d.ts +3 -5
- package/lib/feature-libraries/schema-index/schemaSummarizer.d.ts.map +1 -1
- package/lib/feature-libraries/schema-index/schemaSummarizer.js +1 -11
- package/lib/feature-libraries/schema-index/schemaSummarizer.js.map +1 -1
- package/lib/feature-libraries/sequence-field/sequenceFieldEditor.d.ts +1 -1
- package/lib/feature-libraries/sequence-field/sequenceFieldEditor.d.ts.map +1 -1
- package/lib/feature-libraries/sequence-field/sequenceFieldEditor.js +13 -1
- package/lib/feature-libraries/sequence-field/sequenceFieldEditor.js.map +1 -1
- package/lib/index.d.ts +3 -3
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +3 -3
- 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/public.d.ts +1 -0
- package/lib/shared-tree/index.d.ts +1 -3
- package/lib/shared-tree/index.d.ts.map +1 -1
- package/lib/shared-tree/index.js +1 -3
- package/lib/shared-tree/index.js.map +1 -1
- package/lib/shared-tree/schematizingTreeView.d.ts +4 -5
- package/lib/shared-tree/schematizingTreeView.d.ts.map +1 -1
- package/lib/shared-tree/schematizingTreeView.js +4 -5
- package/lib/shared-tree/schematizingTreeView.js.map +1 -1
- package/lib/shared-tree/sharedTree.d.ts +39 -39
- package/lib/shared-tree/sharedTree.d.ts.map +1 -1
- package/lib/shared-tree/sharedTree.js +79 -50
- package/lib/shared-tree/sharedTree.js.map +1 -1
- package/lib/shared-tree/treeApi.d.ts +2 -2
- package/lib/shared-tree/treeApi.d.ts.map +1 -1
- package/lib/shared-tree/treeApi.js +8 -2
- package/lib/shared-tree/treeApi.js.map +1 -1
- package/lib/shared-tree/treeCheckout.d.ts +3 -3
- package/lib/shared-tree/treeCheckout.d.ts.map +1 -1
- package/lib/shared-tree/treeCheckout.js +4 -3
- package/lib/shared-tree/treeCheckout.js.map +1 -1
- package/lib/shared-tree-core/editManager.js +2 -2
- package/lib/shared-tree-core/editManager.js.map +1 -1
- package/lib/shared-tree-core/editManagerSummarizer.d.ts +1 -2
- package/lib/shared-tree-core/editManagerSummarizer.d.ts.map +1 -1
- package/lib/shared-tree-core/editManagerSummarizer.js +0 -9
- package/lib/shared-tree-core/editManagerSummarizer.js.map +1 -1
- package/lib/shared-tree-core/sequenceIdUtils.d.ts +12 -1
- package/lib/shared-tree-core/sequenceIdUtils.d.ts.map +1 -1
- package/lib/shared-tree-core/sequenceIdUtils.js +23 -5
- package/lib/shared-tree-core/sequenceIdUtils.js.map +1 -1
- package/lib/shared-tree-core/sharedTreeCore.d.ts +25 -30
- package/lib/shared-tree-core/sharedTreeCore.d.ts.map +1 -1
- package/lib/shared-tree-core/sharedTreeCore.js +19 -48
- package/lib/shared-tree-core/sharedTreeCore.js.map +1 -1
- package/lib/simple-tree/api/index.d.ts +3 -2
- package/lib/simple-tree/api/index.d.ts.map +1 -1
- package/lib/simple-tree/api/index.js +1 -0
- package/lib/simple-tree/api/index.js.map +1 -1
- package/lib/simple-tree/api/schemaFactory.d.ts +156 -63
- package/lib/simple-tree/api/schemaFactory.d.ts.map +1 -1
- package/lib/simple-tree/api/schemaFactory.js +178 -85
- package/lib/simple-tree/api/schemaFactory.js.map +1 -1
- package/lib/{shared-tree → simple-tree/api}/transactionTypes.d.ts +1 -1
- package/lib/simple-tree/api/transactionTypes.d.ts.map +1 -0
- package/lib/{shared-tree → simple-tree/api}/transactionTypes.js.map +1 -1
- package/lib/simple-tree/api/tree.d.ts +23 -2
- package/lib/simple-tree/api/tree.d.ts.map +1 -1
- package/lib/simple-tree/api/tree.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 +1 -1
- package/lib/simple-tree/index.js.map +1 -1
- package/lib/simple-tree/schemaTypes.d.ts +2 -2
- package/lib/simple-tree/schemaTypes.js +1 -1
- package/lib/simple-tree/schemaTypes.js.map +1 -1
- package/lib/simple-tree/treeNodeValid.js +1 -2
- package/lib/simple-tree/treeNodeValid.js.map +1 -1
- package/lib/treeFactory.d.ts +16 -5
- package/lib/treeFactory.d.ts.map +1 -1
- package/lib/treeFactory.js +20 -11
- package/lib/treeFactory.js.map +1 -1
- package/lib/util/breakable.d.ts +1 -1
- package/lib/util/breakable.d.ts.map +1 -1
- package/lib/util/breakable.js.map +1 -1
- package/lib/util/rangeMap.d.ts +1 -1
- package/lib/util/rangeMap.js +1 -1
- package/lib/util/rangeMap.js.map +1 -1
- package/package.json +21 -21
- package/src/core/forest/editableForest.ts +1 -1
- package/src/core/index.ts +0 -3
- package/src/core/tree/anchorSet.ts +4 -197
- package/src/core/tree/index.ts +0 -3
- package/src/core/tree/pathTree.ts +0 -13
- package/src/feature-libraries/default-schema/defaultFieldKinds.ts +1 -1
- package/src/feature-libraries/detachedFieldIndexSummarizer.ts +0 -11
- package/src/feature-libraries/flex-tree/treeEvents.ts +2 -4
- package/src/feature-libraries/forest-summary/forestSummarizer.ts +0 -11
- package/src/feature-libraries/modular-schema/fieldChangeHandler.ts +6 -2
- package/src/feature-libraries/modular-schema/genericFieldKind.ts +3 -35
- package/src/feature-libraries/modular-schema/modularChangeFamily.ts +9 -42
- package/src/feature-libraries/optional-field/optionalField.ts +10 -3
- package/src/feature-libraries/schema-index/schemaSummarizer.ts +1 -16
- package/src/feature-libraries/sequence-field/sequenceFieldEditor.ts +13 -2
- package/src/index.ts +15 -12
- package/src/packageVersion.ts +1 -1
- package/src/shared-tree/index.ts +3 -19
- package/src/shared-tree/schematizingTreeView.ts +18 -16
- package/src/shared-tree/sharedTree.ts +203 -100
- package/src/shared-tree/treeApi.ts +10 -1
- package/src/shared-tree/treeCheckout.ts +11 -8
- package/src/shared-tree-core/editManager.ts +2 -2
- package/src/shared-tree-core/editManagerSummarizer.ts +0 -11
- package/src/shared-tree-core/sequenceIdUtils.ts +26 -5
- package/src/shared-tree-core/sharedTreeCore.ts +30 -87
- package/src/simple-tree/api/index.ts +15 -0
- package/src/simple-tree/api/schemaFactory.ts +203 -89
- package/src/{shared-tree → simple-tree/api}/transactionTypes.ts +1 -1
- package/src/simple-tree/api/tree.ts +31 -6
- package/src/simple-tree/index.ts +12 -0
- package/src/simple-tree/schemaTypes.ts +2 -2
- package/src/treeFactory.ts +29 -11
- package/src/util/breakable.ts +1 -1
- package/src/util/rangeMap.ts +1 -1
- package/dist/core/tree/visitPath.d.ts +0 -101
- package/dist/core/tree/visitPath.d.ts.map +0 -1
- package/dist/core/tree/visitPath.js +0 -7
- package/dist/core/tree/visitPath.js.map +0 -1
- package/dist/shared-tree/publicContracts.d.ts +0 -18
- package/dist/shared-tree/publicContracts.d.ts.map +0 -1
- package/dist/shared-tree/publicContracts.js +0 -24
- package/dist/shared-tree/publicContracts.js.map +0 -1
- package/dist/shared-tree/transactionTypes.d.ts.map +0 -1
- package/lib/core/tree/visitPath.d.ts +0 -101
- package/lib/core/tree/visitPath.d.ts.map +0 -1
- package/lib/core/tree/visitPath.js +0 -6
- package/lib/core/tree/visitPath.js.map +0 -1
- package/lib/shared-tree/publicContracts.d.ts +0 -18
- package/lib/shared-tree/publicContracts.d.ts.map +0 -1
- package/lib/shared-tree/publicContracts.js +0 -21
- package/lib/shared-tree/publicContracts.js.map +0 -1
- package/lib/shared-tree/transactionTypes.d.ts.map +0 -1
- package/src/core/tree/visitPath.ts +0 -124
- package/src/shared-tree/publicContracts.ts +0 -24
- /package/dist/{shared-tree → simple-tree/api}/transactionTypes.js +0 -0
- /package/lib/{shared-tree → simple-tree/api}/transactionTypes.js +0 -0
|
@@ -72,6 +72,105 @@ export declare const defaultSchemaFactoryObjectOptions: Required<Omit<SchemaFact
|
|
|
72
72
|
* @system @public
|
|
73
73
|
*/
|
|
74
74
|
export type ScopedSchemaName<TScope extends string | undefined, TName extends number | string> = TScope extends undefined ? `${TName}` : `${TScope}.${TName}`;
|
|
75
|
+
/**
|
|
76
|
+
* Stateless APIs exposed via {@link SchemaFactory} as both instance properties and as statics.
|
|
77
|
+
* @privateRemarks
|
|
78
|
+
* We have no way to make linkable members which exist both as statics and instance properties since API-Extractor does not support this.
|
|
79
|
+
* As a workaround, we have this type as a third place which can be linked.
|
|
80
|
+
* @system @sealed @public
|
|
81
|
+
*/
|
|
82
|
+
export declare const schemaStatics: {
|
|
83
|
+
/**
|
|
84
|
+
* {@link TreeNodeSchema} for holding a JavaScript `string`.
|
|
85
|
+
*
|
|
86
|
+
* @remarks
|
|
87
|
+
* Strings containing unpaired UTF-16 surrogate pair code units may not be handled correctly.
|
|
88
|
+
*
|
|
89
|
+
* These limitations come from the use of UTF-8 encoding of the strings, which requires them to be valid unicode.
|
|
90
|
+
* JavaScript does not make this requirement for its strings so not all possible JavaScript strings are supported.
|
|
91
|
+
* @privateRemarks
|
|
92
|
+
* TODO:
|
|
93
|
+
* We should be much more clear about what happens if you use problematic values.
|
|
94
|
+
* We should validate and/or normalize them when inserting content.
|
|
95
|
+
*/
|
|
96
|
+
readonly string: TreeNodeSchemaNonClass<"com.fluidframework.leaf.string", NodeKind.Leaf, string, string, true, unknown, never, unknown>;
|
|
97
|
+
/**
|
|
98
|
+
* {@link TreeNodeSchema} for holding a JavaScript `number`.
|
|
99
|
+
*
|
|
100
|
+
* @remarks
|
|
101
|
+
* The number is a {@link https://en.wikipedia.org/wiki/Double-precision_floating-point_format | double-precision 64-bit binary format IEEE 754} value, however there are some exceptions:
|
|
102
|
+
* - `NaN`, and the infinities are converted to `null` (and may therefore only be used where `null` is allowed by the schema).
|
|
103
|
+
* - `-0` may be converted to `0` in some cases.
|
|
104
|
+
*
|
|
105
|
+
* These limitations match the limitations of JSON.
|
|
106
|
+
* @privateRemarks
|
|
107
|
+
* TODO:
|
|
108
|
+
* We should be much more clear about what happens if you use problematic values.
|
|
109
|
+
* We should validate and/or normalize them when inserting content.
|
|
110
|
+
*/
|
|
111
|
+
readonly number: TreeNodeSchemaNonClass<"com.fluidframework.leaf.number", NodeKind.Leaf, number, number, true, unknown, never, unknown>;
|
|
112
|
+
/**
|
|
113
|
+
* {@link TreeNodeSchema} for holding a boolean.
|
|
114
|
+
*/
|
|
115
|
+
readonly boolean: TreeNodeSchemaNonClass<"com.fluidframework.leaf.boolean", NodeKind.Leaf, boolean, boolean, true, unknown, never, unknown>;
|
|
116
|
+
/**
|
|
117
|
+
* {@link TreeNodeSchema} for JavaScript `null`.
|
|
118
|
+
*
|
|
119
|
+
* @remarks
|
|
120
|
+
* There are good {@link https://www.npmjs.com/package/%40rushstack/eslint-plugin#rushstackno-new-null | reasons to avoid using null} in JavaScript, however sometimes it is desired.
|
|
121
|
+
* This {@link TreeNodeSchema} node provides the option to include nulls in trees when desired.
|
|
122
|
+
* Unless directly inter-operating with existing data using null, consider other approaches, like wrapping the value in an optional field, or using a more specifically named empty object node.
|
|
123
|
+
*/
|
|
124
|
+
readonly null: TreeNodeSchemaNonClass<"com.fluidframework.leaf.null", NodeKind.Leaf, null, null, true, unknown, never, unknown>;
|
|
125
|
+
/**
|
|
126
|
+
* {@link TreeNodeSchema} for holding an {@link @fluidframework/core-interfaces#(IFluidHandle:interface)}.
|
|
127
|
+
*/
|
|
128
|
+
readonly handle: TreeNodeSchemaNonClass<"com.fluidframework.leaf.handle", NodeKind.Leaf, _dummyImport<unknown>, _dummyImport<unknown>, true, unknown, never, unknown>;
|
|
129
|
+
/**
|
|
130
|
+
* {@link AllowedTypes} for holding any of the leaf types.
|
|
131
|
+
*/
|
|
132
|
+
readonly leaves: readonly [TreeNodeSchemaNonClass<"com.fluidframework.leaf.string", NodeKind.Leaf, string, string, true, unknown, never, unknown>, TreeNodeSchemaNonClass<"com.fluidframework.leaf.number", NodeKind.Leaf, number, number, true, unknown, never, unknown>, TreeNodeSchemaNonClass<"com.fluidframework.leaf.boolean", NodeKind.Leaf, boolean, boolean, true, unknown, never, unknown>, TreeNodeSchemaNonClass<"com.fluidframework.leaf.null", NodeKind.Leaf, null, null, true, unknown, never, unknown>, TreeNodeSchemaNonClass<"com.fluidframework.leaf.handle", NodeKind.Leaf, _dummyImport<unknown>, _dummyImport<unknown>, true, unknown, never, unknown>];
|
|
133
|
+
/**
|
|
134
|
+
* Make a field optional instead of the default, which is required.
|
|
135
|
+
*
|
|
136
|
+
* @param t - The types allowed under the field.
|
|
137
|
+
* @param props - Optional properties to associate with the field.
|
|
138
|
+
*
|
|
139
|
+
* @typeParam TCustomMetadata - Custom metadata properties to associate with the field.
|
|
140
|
+
* See {@link FieldSchemaMetadata.custom}.
|
|
141
|
+
*/
|
|
142
|
+
readonly optional: <const T extends ImplicitAllowedTypes, const TCustomMetadata = unknown>(t: T, props?: Omit<FieldProps<TCustomMetadata>, "defaultProvider">) => FieldSchema<FieldKind.Optional, T, TCustomMetadata>;
|
|
143
|
+
/**
|
|
144
|
+
* Make a field explicitly required.
|
|
145
|
+
*
|
|
146
|
+
* @param t - The types allowed under the field.
|
|
147
|
+
* @param props - Optional properties to associate with the field.
|
|
148
|
+
*
|
|
149
|
+
* @remarks
|
|
150
|
+
* Fields are required by default, but this API can be used to make the required nature explicit in the schema,
|
|
151
|
+
* and allows associating custom {@link FieldProps | properties} with the field.
|
|
152
|
+
*
|
|
153
|
+
* @typeParam TCustomMetadata - Custom metadata properties to associate with the field.
|
|
154
|
+
* See {@link FieldSchemaMetadata.custom}.
|
|
155
|
+
*/
|
|
156
|
+
readonly required: <const T_1 extends ImplicitAllowedTypes, const TCustomMetadata_1 = unknown>(t: T_1, props?: Omit<FieldProps<TCustomMetadata_1>, "defaultProvider"> | undefined) => FieldSchema<FieldKind.Required, T_1, TCustomMetadata_1>;
|
|
157
|
+
/**
|
|
158
|
+
* {@link schemaStatics.optional} except tweaked to work better for recursive types.
|
|
159
|
+
* Use with {@link ValidateRecursiveSchema} for improved type safety.
|
|
160
|
+
* @remarks
|
|
161
|
+
* This version of {@link schemaStatics.optional} has fewer type constraints to work around TypeScript limitations, see {@link Unenforced}.
|
|
162
|
+
* See {@link ValidateRecursiveSchema} for additional information about using recursive schema.
|
|
163
|
+
*/
|
|
164
|
+
readonly optionalRecursive: <const T_2 extends unknown>(t: T_2, props?: Omit<FieldProps, "defaultProvider">) => FieldSchemaUnsafe<FieldKind.Optional, T_2>;
|
|
165
|
+
/**
|
|
166
|
+
* {@link schemaStatics.required} except tweaked to work better for recursive types.
|
|
167
|
+
* Use with {@link ValidateRecursiveSchema} for improved type safety.
|
|
168
|
+
* @remarks
|
|
169
|
+
* This version of {@link schemaStatics.required} has fewer type constraints to work around TypeScript limitations, see {@link Unenforced}.
|
|
170
|
+
* See {@link ValidateRecursiveSchema} for additional information about using recursive schema.
|
|
171
|
+
*/
|
|
172
|
+
readonly requiredRecursive: <const T_3 extends unknown>(t: T_3, props?: Omit<FieldProps, "defaultProvider">) => FieldSchemaUnsafe<FieldKind.Required, T_3>;
|
|
173
|
+
};
|
|
75
174
|
/**
|
|
76
175
|
* Creates various types of {@link TreeNodeSchema|schema} for {@link TreeNode}s.
|
|
77
176
|
*
|
|
@@ -246,51 +345,53 @@ export declare class SchemaFactory<out TScope extends string | undefined = strin
|
|
|
246
345
|
scope: TScope);
|
|
247
346
|
private scoped;
|
|
248
347
|
/**
|
|
249
|
-
* {@
|
|
250
|
-
*
|
|
251
|
-
* @remarks
|
|
252
|
-
* Strings containing unpaired UTF-16 surrogate pair code units may not be handled correctly.
|
|
253
|
-
*
|
|
254
|
-
* These limitations come from the use of UTF-8 encoding of the strings, which requires them to be valid unicode.
|
|
255
|
-
* JavaScript does not make this requirement for its strings so not all possible JavaScript strings are supported.
|
|
256
|
-
* @privateRemarks
|
|
257
|
-
* TODO:
|
|
258
|
-
* We should be much more clear about what happens if you use problematic values.
|
|
259
|
-
* We should validate and/or normalize them when inserting content.
|
|
348
|
+
* {@inheritDoc schemaStatics.string}
|
|
260
349
|
*/
|
|
261
350
|
readonly string: TreeNodeSchemaNonClass<"com.fluidframework.leaf.string", NodeKind.Leaf, string, string, true, unknown, never, unknown>;
|
|
262
351
|
/**
|
|
263
|
-
* {@
|
|
264
|
-
*
|
|
265
|
-
* @remarks
|
|
266
|
-
* The number is a [double-precision 64-bit binary format IEEE 754](https://en.wikipedia.org/wiki/Double-precision_floating-point_format) value, however there are some exceptions:
|
|
267
|
-
* - `NaN`, and the infinities are converted to `null` (and may therefore only be used where `null` is allowed by the schema).
|
|
268
|
-
* - `-0` may be converted to `0` in some cases.
|
|
269
|
-
*
|
|
270
|
-
* These limitations match the limitations of JSON.
|
|
271
|
-
* @privateRemarks
|
|
272
|
-
* TODO:
|
|
273
|
-
* We should be much more clear about what happens if you use problematic values.
|
|
274
|
-
* We should validate and/or normalize them when inserting content.
|
|
352
|
+
* {@inheritDoc schemaStatics.number}
|
|
275
353
|
*/
|
|
276
354
|
readonly number: TreeNodeSchemaNonClass<"com.fluidframework.leaf.number", NodeKind.Leaf, number, number, true, unknown, never, unknown>;
|
|
277
355
|
/**
|
|
278
|
-
* {@
|
|
356
|
+
* {@inheritDoc schemaStatics.boolean}
|
|
279
357
|
*/
|
|
280
358
|
readonly boolean: TreeNodeSchemaNonClass<"com.fluidframework.leaf.boolean", NodeKind.Leaf, boolean, boolean, true, unknown, never, unknown>;
|
|
281
359
|
/**
|
|
282
|
-
* {@
|
|
283
|
-
*
|
|
284
|
-
* @remarks
|
|
285
|
-
* There are good [reasons to avoid using null](https://www.npmjs.com/package/%40rushstack/eslint-plugin#rushstackno-new-null) in JavaScript, however sometimes it is desired.
|
|
286
|
-
* This {@link TreeNodeSchema} node provides the option to include nulls in trees when desired.
|
|
287
|
-
* Unless directly inter-operating with existing data using null, consider other approaches, like wrapping the value in an optional field, or using a more specifically named empty object node.
|
|
360
|
+
* {@inheritDoc schemaStatics.null}
|
|
288
361
|
*/
|
|
289
362
|
readonly null: TreeNodeSchemaNonClass<"com.fluidframework.leaf.null", NodeKind.Leaf, null, null, true, unknown, never, unknown>;
|
|
290
363
|
/**
|
|
291
|
-
* {@
|
|
364
|
+
* {@inheritDoc schemaStatics.handle}
|
|
292
365
|
*/
|
|
293
366
|
readonly handle: TreeNodeSchemaNonClass<"com.fluidframework.leaf.handle", NodeKind.Leaf, _dummyImport<unknown>, _dummyImport<unknown>, true, unknown, never, unknown>;
|
|
367
|
+
/**
|
|
368
|
+
* {@inheritDoc schemaStatics.leaves}
|
|
369
|
+
*/
|
|
370
|
+
readonly leaves: readonly [TreeNodeSchemaNonClass<"com.fluidframework.leaf.string", NodeKind.Leaf, string, string, true, unknown, never, unknown>, TreeNodeSchemaNonClass<"com.fluidframework.leaf.number", NodeKind.Leaf, number, number, true, unknown, never, unknown>, TreeNodeSchemaNonClass<"com.fluidframework.leaf.boolean", NodeKind.Leaf, boolean, boolean, true, unknown, never, unknown>, TreeNodeSchemaNonClass<"com.fluidframework.leaf.null", NodeKind.Leaf, null, null, true, unknown, never, unknown>, TreeNodeSchemaNonClass<"com.fluidframework.leaf.handle", NodeKind.Leaf, _dummyImport<unknown>, _dummyImport<unknown>, true, unknown, never, unknown>];
|
|
371
|
+
/**
|
|
372
|
+
* {@inheritDoc schemaStatics.string}
|
|
373
|
+
*/
|
|
374
|
+
static readonly string: TreeNodeSchemaNonClass<"com.fluidframework.leaf.string", NodeKind.Leaf, string, string, true, unknown, never, unknown>;
|
|
375
|
+
/**
|
|
376
|
+
* {@inheritDoc schemaStatics.number}
|
|
377
|
+
*/
|
|
378
|
+
static readonly number: TreeNodeSchemaNonClass<"com.fluidframework.leaf.number", NodeKind.Leaf, number, number, true, unknown, never, unknown>;
|
|
379
|
+
/**
|
|
380
|
+
* {@inheritDoc schemaStatics.boolean}
|
|
381
|
+
*/
|
|
382
|
+
static readonly boolean: TreeNodeSchemaNonClass<"com.fluidframework.leaf.boolean", NodeKind.Leaf, boolean, boolean, true, unknown, never, unknown>;
|
|
383
|
+
/**
|
|
384
|
+
* {@inheritDoc schemaStatics.null}
|
|
385
|
+
*/
|
|
386
|
+
static readonly null: TreeNodeSchemaNonClass<"com.fluidframework.leaf.null", NodeKind.Leaf, null, null, true, unknown, never, unknown>;
|
|
387
|
+
/**
|
|
388
|
+
* {@inheritDoc schemaStatics.handle}
|
|
389
|
+
*/
|
|
390
|
+
static readonly handle: TreeNodeSchemaNonClass<"com.fluidframework.leaf.handle", NodeKind.Leaf, _dummyImport<unknown>, _dummyImport<unknown>, true, unknown, never, unknown>;
|
|
391
|
+
/**
|
|
392
|
+
* {@inheritDoc schemaStatics.leaves}
|
|
393
|
+
*/
|
|
394
|
+
static readonly leaves: readonly [TreeNodeSchemaNonClass<"com.fluidframework.leaf.string", NodeKind.Leaf, string, string, true, unknown, never, unknown>, TreeNodeSchemaNonClass<"com.fluidframework.leaf.number", NodeKind.Leaf, number, number, true, unknown, never, unknown>, TreeNodeSchemaNonClass<"com.fluidframework.leaf.boolean", NodeKind.Leaf, boolean, boolean, true, unknown, never, unknown>, TreeNodeSchemaNonClass<"com.fluidframework.leaf.null", NodeKind.Leaf, null, null, true, unknown, never, unknown>, TreeNodeSchemaNonClass<"com.fluidframework.leaf.handle", NodeKind.Leaf, _dummyImport<unknown>, _dummyImport<unknown>, true, unknown, never, unknown>];
|
|
294
395
|
/**
|
|
295
396
|
* Define a {@link TreeNodeSchemaClass} for a {@link TreeObjectNode}.
|
|
296
397
|
*
|
|
@@ -403,45 +504,37 @@ export declare class SchemaFactory<out TScope extends string | undefined = strin
|
|
|
403
504
|
*/
|
|
404
505
|
private namedArray;
|
|
405
506
|
/**
|
|
406
|
-
*
|
|
407
|
-
*
|
|
408
|
-
* @param t - The types allowed under the field.
|
|
409
|
-
* @param props - Optional properties to associate with the field.
|
|
410
|
-
*
|
|
411
|
-
* @typeParam TCustomMetadata - Custom metadata properties to associate with the field.
|
|
412
|
-
* See {@link FieldSchemaMetadata.custom}.
|
|
507
|
+
* {@inheritDoc schemaStatics.optional}
|
|
413
508
|
*/
|
|
414
|
-
optional<const T extends ImplicitAllowedTypes, const TCustomMetadata = unknown>(t: T, props?: Omit<FieldProps<TCustomMetadata>, "defaultProvider">)
|
|
509
|
+
readonly optional: <const T extends ImplicitAllowedTypes, const TCustomMetadata = unknown>(t: T, props?: Omit<FieldProps<TCustomMetadata>, "defaultProvider"> | undefined) => FieldSchema<FieldKind.Optional, T, TCustomMetadata>;
|
|
415
510
|
/**
|
|
416
|
-
*
|
|
417
|
-
*
|
|
418
|
-
* @param t - The types allowed under the field.
|
|
419
|
-
* @param props - Optional properties to associate with the field.
|
|
420
|
-
*
|
|
421
|
-
* @remarks
|
|
422
|
-
* Fields are required by default, but this API can be used to make the required nature explicit in the schema,
|
|
423
|
-
* and allows associating custom {@link FieldProps | properties} with the field.
|
|
424
|
-
*
|
|
425
|
-
* @typeParam TCustomMetadata - Custom metadata properties to associate with the field.
|
|
426
|
-
* See {@link FieldSchemaMetadata.custom}.
|
|
511
|
+
* {@inheritDoc schemaStatics.required}
|
|
427
512
|
*/
|
|
428
|
-
required<const T extends ImplicitAllowedTypes, const TCustomMetadata = unknown>(t: T, props?: Omit<FieldProps<TCustomMetadata>, "defaultProvider">)
|
|
513
|
+
readonly required: <const T extends ImplicitAllowedTypes, const TCustomMetadata = unknown>(t: T, props?: Omit<FieldProps<TCustomMetadata>, "defaultProvider"> | undefined) => FieldSchema<FieldKind.Required, T, TCustomMetadata>;
|
|
429
514
|
/**
|
|
430
|
-
* {@
|
|
431
|
-
* Use with {@link ValidateRecursiveSchema} for improved type safety.
|
|
432
|
-
* @remarks
|
|
433
|
-
* This version of {@link SchemaFactory.optional} has fewer type constraints to work around TypeScript limitations, see {@link Unenforced}.
|
|
434
|
-
* See {@link ValidateRecursiveSchema} for additional information about using recursive schema.
|
|
515
|
+
* {@inheritDoc schemaStatics.optionalRecursive}
|
|
435
516
|
*/
|
|
436
|
-
optionalRecursive<const T extends
|
|
517
|
+
readonly optionalRecursive: <const T extends unknown>(t: T, props?: Omit<FieldProps<unknown>, "defaultProvider"> | undefined) => FieldSchemaUnsafe<FieldKind.Optional, T>;
|
|
437
518
|
/**
|
|
438
|
-
* {@
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
*
|
|
519
|
+
* {@inheritDoc schemaStatics.requiredRecursive}
|
|
520
|
+
*/
|
|
521
|
+
readonly requiredRecursive: <const T extends unknown>(t: T, props?: Omit<FieldProps<unknown>, "defaultProvider"> | undefined) => FieldSchemaUnsafe<FieldKind.Required, T>;
|
|
522
|
+
/**
|
|
523
|
+
* {@inheritDoc schemaStatics.optional}
|
|
524
|
+
*/
|
|
525
|
+
static readonly optional: <const T extends ImplicitAllowedTypes, const TCustomMetadata = unknown>(t: T, props?: Omit<FieldProps<TCustomMetadata>, "defaultProvider"> | undefined) => FieldSchema<FieldKind.Optional, T, TCustomMetadata>;
|
|
526
|
+
/**
|
|
527
|
+
* {@inheritDoc schemaStatics.required}
|
|
528
|
+
*/
|
|
529
|
+
static readonly required: <const T extends ImplicitAllowedTypes, const TCustomMetadata = unknown>(t: T, props?: Omit<FieldProps<TCustomMetadata>, "defaultProvider"> | undefined) => FieldSchema<FieldKind.Required, T, TCustomMetadata>;
|
|
530
|
+
/**
|
|
531
|
+
* {@inheritDoc schemaStatics.optionalRecursive}
|
|
532
|
+
*/
|
|
533
|
+
static readonly optionalRecursive: <const T extends unknown>(t: T, props?: Omit<FieldProps<unknown>, "defaultProvider"> | undefined) => FieldSchemaUnsafe<FieldKind.Optional, T>;
|
|
534
|
+
/**
|
|
535
|
+
* {@inheritDoc schemaStatics.requiredRecursive}
|
|
443
536
|
*/
|
|
444
|
-
requiredRecursive<const T extends
|
|
537
|
+
static readonly requiredRecursive: <const T extends unknown>(t: T, props?: Omit<FieldProps<unknown>, "defaultProvider"> | undefined) => FieldSchemaUnsafe<FieldKind.Required, T>;
|
|
445
538
|
/**
|
|
446
539
|
* A special field which holds a unique identifier for an object node.
|
|
447
540
|
* @remarks
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"schemaFactory.d.ts","sourceRoot":"","sources":["../../../src/simple-tree/api/schemaFactory.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAMH,OAAO,KAAK,EAAE,YAAY,IAAI,YAAY,EAAE,MAAM,iCAAiC,CAAC;AAIpF,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAErD,OAAO,EACN,KAAK,uBAAuB,EAG5B,MAAM,qBAAqB,CAAC;AAa7B,OAAO,EACN,SAAS,EACT,KAAK,WAAW,EAChB,KAAK,oBAAoB,EACzB,KAAK,mBAAmB,EACxB,KAAK,0CAA0C,EAC/C,KAAK,UAAU,EAIf,KAAK,iBAAiB,EACtB,MAAM,mBAAmB,CAAC;AAE3B,OAAO,KAAK,EACX,QAAQ,EACR,QAAQ,EACR,cAAc,EACd,mBAAmB,EACnB,sBAAsB,EAEtB,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAAE,KAAK,aAAa,EAAe,MAAM,iBAAiB,CAAC;AAClE,OAAO,EACN,KAAK,gCAAgC,EACrC,KAAK,cAAc,EAEnB,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAAE,KAAK,qBAAqB,EAAE,KAAK,WAAW,EAAa,MAAM,eAAe,CAAC;AACxF,OAAO,KAAK,EACX,iBAAiB,EASjB,sCA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Ac,EAAE,CAAC,EACjB,YAAY,EAAE,cAAc,GAAG,SAAS,cAAc,EAAE,GACtD,GAAG,CAAC,IAAI,MAAM,GAAG,CAmBnB;AAED;;;;;;GAMG;AACH,wBAAgB,qBAAqB,CAAC,MAAM,EAAE,cAAc,GAAG,IAAI,CAelE"}
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* Licensed under the MIT License.
|
|
5
5
|
*/
|
|
6
6
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
-
exports.markSchemaMostDerived = exports.structuralName = exports.SchemaFactory = exports.defaultSchemaFactoryObjectOptions = exports.schemaFromValue = void 0;
|
|
7
|
+
exports.markSchemaMostDerived = exports.structuralName = exports.SchemaFactory = exports.schemaStatics = exports.defaultSchemaFactoryObjectOptions = exports.schemaFromValue = void 0;
|
|
8
8
|
const internal_1 = require("@fluidframework/core-utils/internal");
|
|
9
9
|
const internal_2 = require("@fluidframework/telemetry-utils/internal");
|
|
10
10
|
const internal_3 = require("@fluidframework/runtime-utils/internal");
|
|
@@ -45,6 +45,119 @@ exports.defaultSchemaFactoryObjectOptions = {
|
|
|
45
45
|
allowUnknownOptionalFields: false,
|
|
46
46
|
};
|
|
47
47
|
// > = `${TScope extends undefined ? "" : `${TScope}.`}${TName}`;
|
|
48
|
+
/**
|
|
49
|
+
* Stateless APIs exposed via {@link SchemaFactory} as both instance properties and as statics.
|
|
50
|
+
* @privateRemarks
|
|
51
|
+
* We have no way to make linkable members which exist both as statics and instance properties since API-Extractor does not support this.
|
|
52
|
+
* As a workaround, we have this type as a third place which can be linked.
|
|
53
|
+
* @system @sealed @public
|
|
54
|
+
*/
|
|
55
|
+
exports.schemaStatics = {
|
|
56
|
+
/**
|
|
57
|
+
* {@link TreeNodeSchema} for holding a JavaScript `string`.
|
|
58
|
+
*
|
|
59
|
+
* @remarks
|
|
60
|
+
* Strings containing unpaired UTF-16 surrogate pair code units may not be handled correctly.
|
|
61
|
+
*
|
|
62
|
+
* These limitations come from the use of UTF-8 encoding of the strings, which requires them to be valid unicode.
|
|
63
|
+
* JavaScript does not make this requirement for its strings so not all possible JavaScript strings are supported.
|
|
64
|
+
* @privateRemarks
|
|
65
|
+
* TODO:
|
|
66
|
+
* We should be much more clear about what happens if you use problematic values.
|
|
67
|
+
* We should validate and/or normalize them when inserting content.
|
|
68
|
+
*/
|
|
69
|
+
string: leafNodeSchema_js_1.stringSchema,
|
|
70
|
+
/**
|
|
71
|
+
* {@link TreeNodeSchema} for holding a JavaScript `number`.
|
|
72
|
+
*
|
|
73
|
+
* @remarks
|
|
74
|
+
* The number is a {@link https://en.wikipedia.org/wiki/Double-precision_floating-point_format | double-precision 64-bit binary format IEEE 754} value, however there are some exceptions:
|
|
75
|
+
* - `NaN`, and the infinities are converted to `null` (and may therefore only be used where `null` is allowed by the schema).
|
|
76
|
+
* - `-0` may be converted to `0` in some cases.
|
|
77
|
+
*
|
|
78
|
+
* These limitations match the limitations of JSON.
|
|
79
|
+
* @privateRemarks
|
|
80
|
+
* TODO:
|
|
81
|
+
* We should be much more clear about what happens if you use problematic values.
|
|
82
|
+
* We should validate and/or normalize them when inserting content.
|
|
83
|
+
*/
|
|
84
|
+
number: leafNodeSchema_js_1.numberSchema,
|
|
85
|
+
/**
|
|
86
|
+
* {@link TreeNodeSchema} for holding a boolean.
|
|
87
|
+
*/
|
|
88
|
+
boolean: leafNodeSchema_js_1.booleanSchema,
|
|
89
|
+
/**
|
|
90
|
+
* {@link TreeNodeSchema} for JavaScript `null`.
|
|
91
|
+
*
|
|
92
|
+
* @remarks
|
|
93
|
+
* There are good {@link https://www.npmjs.com/package/%40rushstack/eslint-plugin#rushstackno-new-null | reasons to avoid using null} in JavaScript, however sometimes it is desired.
|
|
94
|
+
* This {@link TreeNodeSchema} node provides the option to include nulls in trees when desired.
|
|
95
|
+
* Unless directly inter-operating with existing data using null, consider other approaches, like wrapping the value in an optional field, or using a more specifically named empty object node.
|
|
96
|
+
*/
|
|
97
|
+
null: leafNodeSchema_js_1.nullSchema,
|
|
98
|
+
/**
|
|
99
|
+
* {@link TreeNodeSchema} for holding an {@link @fluidframework/core-interfaces#(IFluidHandle:interface)}.
|
|
100
|
+
*/
|
|
101
|
+
handle: leafNodeSchema_js_1.handleSchema,
|
|
102
|
+
/**
|
|
103
|
+
* {@link AllowedTypes} for holding any of the leaf types.
|
|
104
|
+
*/
|
|
105
|
+
leaves: [leafNodeSchema_js_1.stringSchema, leafNodeSchema_js_1.numberSchema, leafNodeSchema_js_1.booleanSchema, leafNodeSchema_js_1.nullSchema, leafNodeSchema_js_1.handleSchema],
|
|
106
|
+
/**
|
|
107
|
+
* Make a field optional instead of the default, which is required.
|
|
108
|
+
*
|
|
109
|
+
* @param t - The types allowed under the field.
|
|
110
|
+
* @param props - Optional properties to associate with the field.
|
|
111
|
+
*
|
|
112
|
+
* @typeParam TCustomMetadata - Custom metadata properties to associate with the field.
|
|
113
|
+
* See {@link FieldSchemaMetadata.custom}.
|
|
114
|
+
*/
|
|
115
|
+
optional: (t, props) => {
|
|
116
|
+
const defaultOptionalProvider = (0, schemaTypes_js_1.getDefaultProvider)(() => {
|
|
117
|
+
return undefined;
|
|
118
|
+
});
|
|
119
|
+
return (0, schemaTypes_js_1.createFieldSchema)(schemaTypes_js_1.FieldKind.Optional, t, {
|
|
120
|
+
defaultProvider: defaultOptionalProvider,
|
|
121
|
+
...props,
|
|
122
|
+
});
|
|
123
|
+
},
|
|
124
|
+
/**
|
|
125
|
+
* Make a field explicitly required.
|
|
126
|
+
*
|
|
127
|
+
* @param t - The types allowed under the field.
|
|
128
|
+
* @param props - Optional properties to associate with the field.
|
|
129
|
+
*
|
|
130
|
+
* @remarks
|
|
131
|
+
* Fields are required by default, but this API can be used to make the required nature explicit in the schema,
|
|
132
|
+
* and allows associating custom {@link FieldProps | properties} with the field.
|
|
133
|
+
*
|
|
134
|
+
* @typeParam TCustomMetadata - Custom metadata properties to associate with the field.
|
|
135
|
+
* See {@link FieldSchemaMetadata.custom}.
|
|
136
|
+
*/
|
|
137
|
+
required: (t, props) => {
|
|
138
|
+
return (0, schemaTypes_js_1.createFieldSchema)(schemaTypes_js_1.FieldKind.Required, t, props);
|
|
139
|
+
},
|
|
140
|
+
/**
|
|
141
|
+
* {@link schemaStatics.optional} except tweaked to work better for recursive types.
|
|
142
|
+
* Use with {@link ValidateRecursiveSchema} for improved type safety.
|
|
143
|
+
* @remarks
|
|
144
|
+
* This version of {@link schemaStatics.optional} has fewer type constraints to work around TypeScript limitations, see {@link Unenforced}.
|
|
145
|
+
* See {@link ValidateRecursiveSchema} for additional information about using recursive schema.
|
|
146
|
+
*/
|
|
147
|
+
optionalRecursive: (t, props) => {
|
|
148
|
+
return (0, schemaFactoryRecursive_js_1.createFieldSchemaUnsafe)(schemaTypes_js_1.FieldKind.Optional, t, props);
|
|
149
|
+
},
|
|
150
|
+
/**
|
|
151
|
+
* {@link schemaStatics.required} except tweaked to work better for recursive types.
|
|
152
|
+
* Use with {@link ValidateRecursiveSchema} for improved type safety.
|
|
153
|
+
* @remarks
|
|
154
|
+
* This version of {@link schemaStatics.required} has fewer type constraints to work around TypeScript limitations, see {@link Unenforced}.
|
|
155
|
+
* See {@link ValidateRecursiveSchema} for additional information about using recursive schema.
|
|
156
|
+
*/
|
|
157
|
+
requiredRecursive: (t, props) => {
|
|
158
|
+
return (0, schemaFactoryRecursive_js_1.createFieldSchemaUnsafe)(schemaTypes_js_1.FieldKind.Required, t, props);
|
|
159
|
+
},
|
|
160
|
+
};
|
|
48
161
|
// TODO:
|
|
49
162
|
// SchemaFactory.array references should link to the correct overloads, however the syntax for this does not seems to work currently for methods unless the they are not qualified with the class.
|
|
50
163
|
// API-Extractor requires such links to be qualified with the class, so it can't work.
|
|
@@ -191,51 +304,45 @@ class SchemaFactory {
|
|
|
191
304
|
*/
|
|
192
305
|
this.structuralTypes = new Map();
|
|
193
306
|
/**
|
|
194
|
-
* {@
|
|
195
|
-
*
|
|
196
|
-
* @remarks
|
|
197
|
-
* Strings containing unpaired UTF-16 surrogate pair code units may not be handled correctly.
|
|
198
|
-
*
|
|
199
|
-
* These limitations come from the use of UTF-8 encoding of the strings, which requires them to be valid unicode.
|
|
200
|
-
* JavaScript does not make this requirement for its strings so not all possible JavaScript strings are supported.
|
|
201
|
-
* @privateRemarks
|
|
202
|
-
* TODO:
|
|
203
|
-
* We should be much more clear about what happens if you use problematic values.
|
|
204
|
-
* We should validate and/or normalize them when inserting content.
|
|
307
|
+
* {@inheritDoc schemaStatics.string}
|
|
205
308
|
*/
|
|
206
309
|
this.string = leafNodeSchema_js_1.stringSchema;
|
|
207
310
|
/**
|
|
208
|
-
* {@
|
|
209
|
-
*
|
|
210
|
-
* @remarks
|
|
211
|
-
* The number is a [double-precision 64-bit binary format IEEE 754](https://en.wikipedia.org/wiki/Double-precision_floating-point_format) value, however there are some exceptions:
|
|
212
|
-
* - `NaN`, and the infinities are converted to `null` (and may therefore only be used where `null` is allowed by the schema).
|
|
213
|
-
* - `-0` may be converted to `0` in some cases.
|
|
214
|
-
*
|
|
215
|
-
* These limitations match the limitations of JSON.
|
|
216
|
-
* @privateRemarks
|
|
217
|
-
* TODO:
|
|
218
|
-
* We should be much more clear about what happens if you use problematic values.
|
|
219
|
-
* We should validate and/or normalize them when inserting content.
|
|
311
|
+
* {@inheritDoc schemaStatics.number}
|
|
220
312
|
*/
|
|
221
313
|
this.number = leafNodeSchema_js_1.numberSchema;
|
|
222
314
|
/**
|
|
223
|
-
* {@
|
|
315
|
+
* {@inheritDoc schemaStatics.boolean}
|
|
224
316
|
*/
|
|
225
317
|
this.boolean = leafNodeSchema_js_1.booleanSchema;
|
|
226
318
|
/**
|
|
227
|
-
* {@
|
|
228
|
-
*
|
|
229
|
-
* @remarks
|
|
230
|
-
* There are good [reasons to avoid using null](https://www.npmjs.com/package/%40rushstack/eslint-plugin#rushstackno-new-null) in JavaScript, however sometimes it is desired.
|
|
231
|
-
* This {@link TreeNodeSchema} node provides the option to include nulls in trees when desired.
|
|
232
|
-
* Unless directly inter-operating with existing data using null, consider other approaches, like wrapping the value in an optional field, or using a more specifically named empty object node.
|
|
319
|
+
* {@inheritDoc schemaStatics.null}
|
|
233
320
|
*/
|
|
234
321
|
this.null = leafNodeSchema_js_1.nullSchema;
|
|
235
322
|
/**
|
|
236
|
-
* {@
|
|
323
|
+
* {@inheritDoc schemaStatics.handle}
|
|
237
324
|
*/
|
|
238
325
|
this.handle = leafNodeSchema_js_1.handleSchema;
|
|
326
|
+
/**
|
|
327
|
+
* {@inheritDoc schemaStatics.leaves}
|
|
328
|
+
*/
|
|
329
|
+
this.leaves = exports.schemaStatics.leaves;
|
|
330
|
+
/**
|
|
331
|
+
* {@inheritDoc schemaStatics.optional}
|
|
332
|
+
*/
|
|
333
|
+
this.optional = exports.schemaStatics.optional;
|
|
334
|
+
/**
|
|
335
|
+
* {@inheritDoc schemaStatics.required}
|
|
336
|
+
*/
|
|
337
|
+
this.required = exports.schemaStatics.required;
|
|
338
|
+
/**
|
|
339
|
+
* {@inheritDoc schemaStatics.optionalRecursive}
|
|
340
|
+
*/
|
|
341
|
+
this.optionalRecursive = exports.schemaStatics.optionalRecursive;
|
|
342
|
+
/**
|
|
343
|
+
* {@inheritDoc schemaStatics.requiredRecursive}
|
|
344
|
+
*/
|
|
345
|
+
this.requiredRecursive = exports.schemaStatics.requiredRecursive;
|
|
239
346
|
}
|
|
240
347
|
scoped(name) {
|
|
241
348
|
return (this.scope === undefined ? `${name}` : `${this.scope}.${name}`);
|
|
@@ -304,60 +411,6 @@ class SchemaFactory {
|
|
|
304
411
|
namedArray(name, allowedTypes, customizable, implicitlyConstructable) {
|
|
305
412
|
return (0, arrayNode_js_1.arraySchema)(this.scoped(name), allowedTypes, implicitlyConstructable, customizable);
|
|
306
413
|
}
|
|
307
|
-
/**
|
|
308
|
-
* Make a field optional instead of the default, which is required.
|
|
309
|
-
*
|
|
310
|
-
* @param t - The types allowed under the field.
|
|
311
|
-
* @param props - Optional properties to associate with the field.
|
|
312
|
-
*
|
|
313
|
-
* @typeParam TCustomMetadata - Custom metadata properties to associate with the field.
|
|
314
|
-
* See {@link FieldSchemaMetadata.custom}.
|
|
315
|
-
*/
|
|
316
|
-
optional(t, props) {
|
|
317
|
-
const defaultOptionalProvider = (0, schemaTypes_js_1.getDefaultProvider)(() => {
|
|
318
|
-
return undefined;
|
|
319
|
-
});
|
|
320
|
-
return (0, schemaTypes_js_1.createFieldSchema)(schemaTypes_js_1.FieldKind.Optional, t, {
|
|
321
|
-
defaultProvider: defaultOptionalProvider,
|
|
322
|
-
...props,
|
|
323
|
-
});
|
|
324
|
-
}
|
|
325
|
-
/**
|
|
326
|
-
* Make a field explicitly required.
|
|
327
|
-
*
|
|
328
|
-
* @param t - The types allowed under the field.
|
|
329
|
-
* @param props - Optional properties to associate with the field.
|
|
330
|
-
*
|
|
331
|
-
* @remarks
|
|
332
|
-
* Fields are required by default, but this API can be used to make the required nature explicit in the schema,
|
|
333
|
-
* and allows associating custom {@link FieldProps | properties} with the field.
|
|
334
|
-
*
|
|
335
|
-
* @typeParam TCustomMetadata - Custom metadata properties to associate with the field.
|
|
336
|
-
* See {@link FieldSchemaMetadata.custom}.
|
|
337
|
-
*/
|
|
338
|
-
required(t, props) {
|
|
339
|
-
return (0, schemaTypes_js_1.createFieldSchema)(schemaTypes_js_1.FieldKind.Required, t, props);
|
|
340
|
-
}
|
|
341
|
-
/**
|
|
342
|
-
* {@link SchemaFactory.optional} except tweaked to work better for recursive types.
|
|
343
|
-
* Use with {@link ValidateRecursiveSchema} for improved type safety.
|
|
344
|
-
* @remarks
|
|
345
|
-
* This version of {@link SchemaFactory.optional} has fewer type constraints to work around TypeScript limitations, see {@link Unenforced}.
|
|
346
|
-
* See {@link ValidateRecursiveSchema} for additional information about using recursive schema.
|
|
347
|
-
*/
|
|
348
|
-
optionalRecursive(t, props) {
|
|
349
|
-
return (0, schemaFactoryRecursive_js_1.createFieldSchemaUnsafe)(schemaTypes_js_1.FieldKind.Optional, t, props);
|
|
350
|
-
}
|
|
351
|
-
/**
|
|
352
|
-
* {@link SchemaFactory.required} except tweaked to work better for recursive types.
|
|
353
|
-
* Use with {@link ValidateRecursiveSchema} for improved type safety.
|
|
354
|
-
* @remarks
|
|
355
|
-
* This version of {@link SchemaFactory.required} has fewer type constraints to work around TypeScript limitations, see {@link Unenforced}.
|
|
356
|
-
* See {@link ValidateRecursiveSchema} for additional information about using recursive schema.
|
|
357
|
-
*/
|
|
358
|
-
requiredRecursive(t, props) {
|
|
359
|
-
return (0, schemaFactoryRecursive_js_1.createFieldSchemaUnsafe)(schemaTypes_js_1.FieldKind.Required, t, props);
|
|
360
|
-
}
|
|
361
414
|
/**
|
|
362
415
|
* A special field which holds a unique identifier for an object node.
|
|
363
416
|
* @remarks
|
|
@@ -429,6 +482,46 @@ class SchemaFactory {
|
|
|
429
482
|
}
|
|
430
483
|
}
|
|
431
484
|
exports.SchemaFactory = SchemaFactory;
|
|
485
|
+
/**
|
|
486
|
+
* {@inheritDoc schemaStatics.string}
|
|
487
|
+
*/
|
|
488
|
+
SchemaFactory.string = leafNodeSchema_js_1.stringSchema;
|
|
489
|
+
/**
|
|
490
|
+
* {@inheritDoc schemaStatics.number}
|
|
491
|
+
*/
|
|
492
|
+
SchemaFactory.number = leafNodeSchema_js_1.numberSchema;
|
|
493
|
+
/**
|
|
494
|
+
* {@inheritDoc schemaStatics.boolean}
|
|
495
|
+
*/
|
|
496
|
+
SchemaFactory.boolean = leafNodeSchema_js_1.booleanSchema;
|
|
497
|
+
/**
|
|
498
|
+
* {@inheritDoc schemaStatics.null}
|
|
499
|
+
*/
|
|
500
|
+
SchemaFactory.null = leafNodeSchema_js_1.nullSchema;
|
|
501
|
+
/**
|
|
502
|
+
* {@inheritDoc schemaStatics.handle}
|
|
503
|
+
*/
|
|
504
|
+
SchemaFactory.handle = leafNodeSchema_js_1.handleSchema;
|
|
505
|
+
/**
|
|
506
|
+
* {@inheritDoc schemaStatics.leaves}
|
|
507
|
+
*/
|
|
508
|
+
SchemaFactory.leaves = exports.schemaStatics.leaves;
|
|
509
|
+
/**
|
|
510
|
+
* {@inheritDoc schemaStatics.optional}
|
|
511
|
+
*/
|
|
512
|
+
SchemaFactory.optional = exports.schemaStatics.optional;
|
|
513
|
+
/**
|
|
514
|
+
* {@inheritDoc schemaStatics.required}
|
|
515
|
+
*/
|
|
516
|
+
SchemaFactory.required = exports.schemaStatics.required;
|
|
517
|
+
/**
|
|
518
|
+
* {@inheritDoc schemaStatics.optionalRecursive}
|
|
519
|
+
*/
|
|
520
|
+
SchemaFactory.optionalRecursive = exports.schemaStatics.optionalRecursive;
|
|
521
|
+
/**
|
|
522
|
+
* {@inheritDoc schemaStatics.requiredRecursive}
|
|
523
|
+
*/
|
|
524
|
+
SchemaFactory.requiredRecursive = exports.schemaStatics.requiredRecursive;
|
|
432
525
|
function structuralName(collectionName, allowedTypes) {
|
|
433
526
|
let inner;
|
|
434
527
|
if (!(0, index_js_1.isReadonlyArray)(allowedTypes)) {
|