Add /beta entry point to fluid-framework (#22469)

## Description

Add /beta entry point to fluid-framework with tree's beta items
This commit is contained in:
Craig Macomber (Microsoft) 2024-09-12 09:41:24 -07:00 коммит произвёл GitHub
Родитель 749e527092
Коммит c51f55c01a
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: B5690EEEBB952194
8 изменённых файлов: 57 добавлений и 9 удалений

Просмотреть файл

@ -0,0 +1,9 @@
---
"fluid-framework": minor
---
---
"section": "tree"
---
Export SharedTree beta APIs from fluid-framework/beta
`fluid-framework/beta` now contains the `@beta` APIs from `@fluidframework/tree/beta`.

Просмотреть файл

@ -37,6 +37,8 @@ For more information on the related support guarantees, see [API Support Levels]
To access the `public` ([SemVer](https://semver.org/)) APIs, import via `fluid-framework` like normal.
To access the `beta` APIs, import via `fluid-framework/beta`.
To access the `legacy` APIs, import via `fluid-framework/legacy`.
## API Documentation

Просмотреть файл

@ -0,0 +1,6 @@
{
"$schema": "https://developer.microsoft.com/json-schemas/api-extractor/v7/api-extractor.schema.json",
"extends": "<projectFolder>/../../../common/build/build-common/api-extractor-lint.entrypoint.json",
"mainEntryPointFilePath": "<projectFolder>/dist/beta.d.ts",
"bundledPackages": ["@fluidframework/*"]
}

Просмотреть файл

@ -0,0 +1,6 @@
{
"$schema": "https://developer.microsoft.com/json-schemas/api-extractor/v7/api-extractor.schema.json",
"extends": "<projectFolder>/../../../common/build/build-common/api-extractor-lint.entrypoint.json",
"mainEntryPointFilePath": "<projectFolder>/lib/beta.d.ts",
"bundledPackages": ["@fluidframework/*"]
}

Просмотреть файл

@ -1,6 +1,6 @@
{
"$schema": "https://developer.microsoft.com/json-schemas/api-extractor/v7/api-extractor.schema.json",
"extends": "<projectFolder>/../../../common/build/build-common/api-extractor-report.esm.current.json",
"mainEntryPointFilePath": "<projectFolder>/lib/public.d.ts",
"mainEntryPointFilePath": "<projectFolder>/lib/beta.d.ts",
"bundledPackages": ["@fluidframework/*"]
}

Просмотреть файл

@ -563,6 +563,11 @@ type NodeBuilderData<T extends TreeNodeSchema> = T extends TreeNodeSchema<string
// @public
type NodeBuilderDataUnsafe<T extends Unenforced<TreeNodeSchema>> = T extends TreeNodeSchema<string, NodeKind, unknown, infer TBuild> ? TBuild : never;
// @beta @sealed
export interface NodeChangedData<TNode extends TreeNode = TreeNode> {
readonly changedProperties?: ReadonlySet<TNode extends WithType<string, NodeKind.Object, infer TInfo> ? string & keyof TInfo : string>;
}
// @public
export type NodeFromSchema<T extends TreeNodeSchema> = T extends TreeNodeSchema<string, NodeKind, infer TNode> ? TNode : never;
@ -773,12 +778,22 @@ interface TreeArrayNodeBase<out T, in TNew, in TMoveFrom> extends ReadonlyArray<
export interface TreeArrayNodeUnsafe<TAllowedTypes extends Unenforced<ImplicitAllowedTypes>> extends TreeArrayNodeBase<TreeNodeFromImplicitAllowedTypesUnsafe<TAllowedTypes>, InsertableTreeNodeFromImplicitAllowedTypesUnsafe<TAllowedTypes>, TreeArrayNode> {
}
// @beta @sealed
export const TreeBeta: {
readonly on: <K extends keyof TreeChangeEventsBeta<TNode>, TNode extends TreeNode>(node: TNode, eventName: K, listener: NoInfer<TreeChangeEventsBeta<TNode>[K]>) => () => void;
};
// @public @sealed
export interface TreeChangeEvents {
nodeChanged(unstable?: unknown): void;
treeChanged(): void;
}
// @beta @sealed
export interface TreeChangeEventsBeta<TNode extends TreeNode = TreeNode> extends TreeChangeEvents {
nodeChanged: (data: NodeChangedData<TNode> & (TNode extends WithType<string, NodeKind.Map | NodeKind.Object> ? Required<Pick<NodeChangedData<TNode>, "changedProperties">> : unknown)) => void;
}
// @public
export type TreeFieldFromImplicitField<TSchema extends ImplicitFieldSchema = FieldSchema> = TSchema extends FieldSchema<infer Kind, infer Types> ? ApplyKind<TreeNodeFromImplicitAllowedTypes<Types>, Kind, false> : TSchema extends ImplicitAllowedTypes ? TreeNodeFromImplicitAllowedTypes<TSchema> : unknown;

Просмотреть файл

@ -23,6 +23,16 @@
"default": "./dist/index.js"
}
},
"./beta": {
"import": {
"types": "./lib/beta.d.ts",
"default": "./lib/index.js"
},
"require": {
"types": "./dist/beta.d.ts",
"default": "./dist/index.js"
}
},
"./legacy": {
"import": {
"types": "./lib/legacy.d.ts",
@ -52,8 +62,10 @@
"check:biome": "biome check .",
"check:exports": "concurrently \"npm:check:exports:*\"",
"check:exports:bundle-release-tags": "api-extractor run --config api-extractor/api-extractor-lint-bundle.json",
"check:exports:cjs:beta": "api-extractor run --config api-extractor/api-extractor-lint-beta.cjs.json",
"check:exports:cjs:legacy": "api-extractor run --config api-extractor/api-extractor-lint-legacy.cjs.json",
"check:exports:cjs:public": "api-extractor run --config api-extractor/api-extractor-lint-public.cjs.json",
"check:exports:esm:beta": "api-extractor run --config api-extractor/api-extractor-lint-beta.esm.json",
"check:exports:esm:legacy": "api-extractor run --config api-extractor/api-extractor-lint-legacy.esm.json",
"check:exports:esm:public": "api-extractor run --config api-extractor/api-extractor-lint-public.esm.json",
"check:format": "npm run check:biome",

Просмотреть файл

@ -11,7 +11,7 @@
*/
// ===============================================================
// #region Public exports
// #region Public (and Beta) exports
// #region Basic re-exports
export type {
@ -58,14 +58,12 @@ export type {
export type { isFluidHandle } from "@fluidframework/runtime-utils";
// Let the tree package manage its own API surface, we will simply reflect it here.
// Note: this only surfaces the `@public` API items from the tree package. If the `@beta` and `@alpha` items are
// desired, they can be added by re-exporting from one of the package's aliased export paths instead (e.g. `tree
// alpha` to surface everything `@alpha` and higher).
// eslint-disable-next-line no-restricted-syntax, import/export
export * from "@fluidframework/tree";
// Let the tree package manage its own API surface.
// Note: this only surfaces the `@public and @beta` API items from the tree package.
// eslint-disable-next-line no-restricted-syntax, import/no-internal-modules
export * from "@fluidframework/tree/beta";
// End of basic public exports - nothing above this line should
// End of basic public+beta exports - nothing above this line should
// depend on an /internal path.
// #endregion Basic re-exports
// ---------------------------------------------------------------