diff --git a/.changeset/whole-days-argue.md b/.changeset/whole-days-argue.md new file mode 100644 index 000000000000..d09931fee214 --- /dev/null +++ b/.changeset/whole-days-argue.md @@ -0,0 +1,11 @@ +--- +"fluid-framework": minor +"@fluidframework/tree": minor +"__section": tree +--- +Add overrides for more instance properties in SchemaFactoryAlpha + +[SchemaFactoryAlpha](https://fluidframework.com/docs/api/fluid-framework/schemafactoryalpha-class) provides proposed updates to several SchemaFactory APIs. +It now exposes these not only for the static members but also the redundant instance properties for `leaves`, `optional`, `required` and `optionalRecursive`. + +Additionally an alpha override for `requiredRecursive` was added to both the statics and instance properties. diff --git a/packages/dds/tree/api-report/tree.alpha.api.md b/packages/dds/tree/api-report/tree.alpha.api.md index 6e606c6a45c6..50e9fce05e80 100644 --- a/packages/dds/tree/api-report/tree.alpha.api.md +++ b/packages/dds/tree/api-report/tree.alpha.api.md @@ -765,6 +765,7 @@ export class SchemaFactoryAlpha(name: Name, allowedTypes: T, options?: NodeSchemaOptions): ArrayNodeCustomizableSchemaUnsafe, T, TCustomMetadata>; static readonly identifier: (props?: Omit, "defaultProvider"> | undefined) => FieldSchemaAlpha_2 & SimpleLeafNodeSchema_2, TCustomMetadata>; static readonly leaves: readonly [LeafSchema_2<"string", string> & SimpleLeafNodeSchema_2, LeafSchema_2<"number", number> & SimpleLeafNodeSchema_2, LeafSchema_2<"boolean", boolean> & SimpleLeafNodeSchema_2, LeafSchema_2<"null", null> & SimpleLeafNodeSchema_2, LeafSchema_2<"handle", IFluidHandle> & SimpleLeafNodeSchema_2]; + readonly leaves: readonly [LeafSchema_2<"string", string> & SimpleLeafNodeSchema_2, LeafSchema_2<"number", number> & SimpleLeafNodeSchema_2, LeafSchema_2<"boolean", boolean> & SimpleLeafNodeSchema_2, LeafSchema_2<"null", null> & SimpleLeafNodeSchema_2, LeafSchema_2<"handle", IFluidHandle> & SimpleLeafNodeSchema_2]; mapAlpha(name: Name, allowedTypes: T, options?: NodeSchemaOptions): MapNodeCustomizableSchema, T, true, TCustomMetadata>; mapRecursive(name: Name, allowedTypes: T, options?: NodeSchemaOptions): MapNodeCustomizableSchemaUnsafe, T, TCustomMetadata>; objectAlpha, const TCustomMetadata = unknown>(name: Name, fields: T, options?: SchemaFactoryObjectOptions): ObjectNodeSchema, T, true, TCustomMetadata> & { @@ -775,11 +776,22 @@ export class SchemaFactoryAlpha(t: T, props?: Omit, "defaultProvider"> | undefined): FieldSchemaAlpha_2; (t: T_1, props?: Omit, "defaultProvider"> | undefined): FieldSchemaAlpha_2, TCustomMetadata_1>; }; + readonly optional: { + (t: T, props?: Omit, "defaultProvider"> | undefined): FieldSchemaAlpha_2; + (t: T_1, props?: Omit, "defaultProvider"> | undefined): FieldSchemaAlpha_2, TCustomMetadata_1>; + }; static readonly optionalRecursive: (t: T, props?: Omit, "defaultProvider"> | undefined) => FieldSchemaAlphaUnsafe_2; + readonly optionalRecursive: (t: T, props?: Omit, "defaultProvider"> | undefined) => FieldSchemaAlphaUnsafe_2; static readonly required: { (t: T, props?: Omit, "defaultProvider"> | undefined): FieldSchemaAlpha_2; (t: T_1, props?: Omit, "defaultProvider"> | undefined): FieldSchemaAlpha_2, TCustomMetadata_1>; }; + readonly required: { + (t: T, props?: Omit, "defaultProvider"> | undefined): FieldSchemaAlpha_2; + (t: T_1, props?: Omit, "defaultProvider"> | undefined): FieldSchemaAlpha_2, TCustomMetadata_1>; + }; + static readonly requiredRecursive: (t: T, props?: Omit, "defaultProvider"> | undefined) => FieldSchemaAlphaUnsafe_2; + readonly requiredRecursive: (t: T, props?: Omit, "defaultProvider"> | undefined) => FieldSchemaAlphaUnsafe_2; scopedFactory(name: T): SchemaFactoryAlpha, TNameInner>; } @@ -920,7 +932,7 @@ export namespace System_TableSchema { }), true, { readonly props: TPropsSchema; readonly id: FieldSchema_2, unknown>; - readonly cells: FieldSchema_2, "Row.cells">, NodeKind.Map, TreeMapNode_2 & WithType, "Row.cells">, NodeKind.Map, unknown>, MapNodeInsertableData_2, true, TCellSchema, undefined>, unknown>; + readonly cells: FieldSchemaAlpha_3, "Row.cells">, NodeKind.Map, TreeMapNode_2 & WithType, "Row.cells">, NodeKind.Map, unknown>, MapNodeInsertableData_2, true, TCellSchema, undefined>, unknown>; }>; // @system export function createTableSchema, const TRowSchema extends RowSchemaBase>(inputSchemaFactory: SchemaFactoryAlpha, _cellSchema: TCellSchema, columnSchema: TColumnSchema, rowSchema: TRowSchema): TreeNodeSchemaCore_2, "Table">, NodeKind.Object, true, { diff --git a/packages/dds/tree/src/simple-tree/api/schemaFactoryAlpha.ts b/packages/dds/tree/src/simple-tree/api/schemaFactoryAlpha.ts index d89c53cc7620..96f56e7c48f8 100644 --- a/packages/dds/tree/src/simple-tree/api/schemaFactoryAlpha.ts +++ b/packages/dds/tree/src/simple-tree/api/schemaFactoryAlpha.ts @@ -148,7 +148,7 @@ export class SchemaFactoryAlpha< } /** - * {@inheritDoc SchemaStatics.optional} + * {@inheritDoc SchemaStatics.leaves} */ public static override readonly leaves = schemaStatics.leaves; @@ -167,11 +167,41 @@ export class SchemaFactoryAlpha< */ public static override readonly optionalRecursive = schemaStatics.optionalRecursive; + /** + * {@inheritDoc SchemaStatics.requiredRecursive} + */ + public static override readonly requiredRecursive = schemaStatics.requiredRecursive; + /** * Like {@link SchemaFactory.identifier} but static and a factory function that can be provided {@link FieldProps}. */ public static readonly identifier = schemaStatics.identifier; + /** + * {@inheritDoc SchemaStatics.leaves} + */ + public override readonly leaves = schemaStatics.leaves; + + /** + * {@inheritDoc SchemaStatics.optional} + */ + public override readonly optional = schemaStatics.optional; + + /** + * {@inheritDoc SchemaStatics.required} + */ + public override readonly required = schemaStatics.required; + + /** + * {@inheritDoc SchemaStatics.optionalRecursive} + */ + public override readonly optionalRecursive = schemaStatics.optionalRecursive; + + /** + * {@inheritDoc SchemaStatics.requiredRecursive} + */ + public override readonly requiredRecursive = schemaStatics.requiredRecursive; + /** * Define a {@link TreeNodeSchema} for a {@link TreeMapNode}. * diff --git a/packages/framework/fluid-framework/api-report/fluid-framework.alpha.api.md b/packages/framework/fluid-framework/api-report/fluid-framework.alpha.api.md index 982ef8cd3375..29e0e67378a4 100644 --- a/packages/framework/fluid-framework/api-report/fluid-framework.alpha.api.md +++ b/packages/framework/fluid-framework/api-report/fluid-framework.alpha.api.md @@ -1125,6 +1125,7 @@ export class SchemaFactoryAlpha(name: Name, allowedTypes: T, options?: NodeSchemaOptions): ArrayNodeCustomizableSchemaUnsafe, T, TCustomMetadata>; static readonly identifier: (props?: Omit, "defaultProvider"> | undefined) => FieldSchemaAlpha_2 & SimpleLeafNodeSchema_2, TCustomMetadata>; static readonly leaves: readonly [LeafSchema_2<"string", string> & SimpleLeafNodeSchema_2, LeafSchema_2<"number", number> & SimpleLeafNodeSchema_2, LeafSchema_2<"boolean", boolean> & SimpleLeafNodeSchema_2, LeafSchema_2<"null", null> & SimpleLeafNodeSchema_2, LeafSchema_2<"handle", IFluidHandle_2> & SimpleLeafNodeSchema_2]; + readonly leaves: readonly [LeafSchema_2<"string", string> & SimpleLeafNodeSchema_2, LeafSchema_2<"number", number> & SimpleLeafNodeSchema_2, LeafSchema_2<"boolean", boolean> & SimpleLeafNodeSchema_2, LeafSchema_2<"null", null> & SimpleLeafNodeSchema_2, LeafSchema_2<"handle", IFluidHandle_2> & SimpleLeafNodeSchema_2]; mapAlpha(name: Name, allowedTypes: T, options?: NodeSchemaOptions): MapNodeCustomizableSchema, T, true, TCustomMetadata>; mapRecursive(name: Name, allowedTypes: T, options?: NodeSchemaOptions): MapNodeCustomizableSchemaUnsafe, T, TCustomMetadata>; objectAlpha, const TCustomMetadata = unknown>(name: Name, fields: T, options?: SchemaFactoryObjectOptions): ObjectNodeSchema, T, true, TCustomMetadata> & { @@ -1135,11 +1136,22 @@ export class SchemaFactoryAlpha(t: T, props?: Omit, "defaultProvider"> | undefined): FieldSchemaAlpha_2; (t: T_1, props?: Omit, "defaultProvider"> | undefined): FieldSchemaAlpha_2, TCustomMetadata_1>; }; + readonly optional: { + (t: T, props?: Omit, "defaultProvider"> | undefined): FieldSchemaAlpha_2; + (t: T_1, props?: Omit, "defaultProvider"> | undefined): FieldSchemaAlpha_2, TCustomMetadata_1>; + }; static readonly optionalRecursive: (t: T, props?: Omit, "defaultProvider"> | undefined) => FieldSchemaAlphaUnsafe_2; + readonly optionalRecursive: (t: T, props?: Omit, "defaultProvider"> | undefined) => FieldSchemaAlphaUnsafe_2; static readonly required: { (t: T, props?: Omit, "defaultProvider"> | undefined): FieldSchemaAlpha_2; (t: T_1, props?: Omit, "defaultProvider"> | undefined): FieldSchemaAlpha_2, TCustomMetadata_1>; }; + readonly required: { + (t: T, props?: Omit, "defaultProvider"> | undefined): FieldSchemaAlpha_2; + (t: T_1, props?: Omit, "defaultProvider"> | undefined): FieldSchemaAlpha_2, TCustomMetadata_1>; + }; + static readonly requiredRecursive: (t: T, props?: Omit, "defaultProvider"> | undefined) => FieldSchemaAlphaUnsafe_2; + readonly requiredRecursive: (t: T, props?: Omit, "defaultProvider"> | undefined) => FieldSchemaAlphaUnsafe_2; scopedFactory(name: T): SchemaFactoryAlpha, TNameInner>; } @@ -1288,7 +1300,7 @@ export namespace System_TableSchema { }), true, { readonly props: TPropsSchema; readonly id: FieldSchema_2, unknown>; - readonly cells: FieldSchema_2, "Row.cells">, NodeKind.Map, TreeMapNode_2 & WithType, "Row.cells">, NodeKind.Map, unknown>, MapNodeInsertableData_2, true, TCellSchema, undefined>, unknown>; + readonly cells: FieldSchemaAlpha_3, "Row.cells">, NodeKind.Map, TreeMapNode_2 & WithType, "Row.cells">, NodeKind.Map, unknown>, MapNodeInsertableData_2, true, TCellSchema, undefined>, unknown>; }>; // @system export function createTableSchema, const TRowSchema extends RowSchemaBase>(inputSchemaFactory: SchemaFactoryAlpha, _cellSchema: TCellSchema, columnSchema: TColumnSchema, rowSchema: TRowSchema): TreeNodeSchemaCore_2, "Table">, NodeKind.Object, true, {