diff --git a/.changeset/slick-weeks-shave.md b/.changeset/slick-weeks-shave.md new file mode 100644 index 00000000000..8ffdab8cac8 --- /dev/null +++ b/.changeset/slick-weeks-shave.md @@ -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`. \ No newline at end of file diff --git a/packages/framework/fluid-framework/README.md b/packages/framework/fluid-framework/README.md index e40be8f2aa1..c735a182b83 100644 --- a/packages/framework/fluid-framework/README.md +++ b/packages/framework/fluid-framework/README.md @@ -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 diff --git a/packages/framework/fluid-framework/api-extractor/api-extractor-lint-beta.cjs.json b/packages/framework/fluid-framework/api-extractor/api-extractor-lint-beta.cjs.json new file mode 100644 index 00000000000..0b396c85673 --- /dev/null +++ b/packages/framework/fluid-framework/api-extractor/api-extractor-lint-beta.cjs.json @@ -0,0 +1,6 @@ +{ + "$schema": "https://developer.microsoft.com/json-schemas/api-extractor/v7/api-extractor.schema.json", + "extends": "/../../../common/build/build-common/api-extractor-lint.entrypoint.json", + "mainEntryPointFilePath": "/dist/beta.d.ts", + "bundledPackages": ["@fluidframework/*"] +} diff --git a/packages/framework/fluid-framework/api-extractor/api-extractor-lint-beta.esm.json b/packages/framework/fluid-framework/api-extractor/api-extractor-lint-beta.esm.json new file mode 100644 index 00000000000..2957481b9aa --- /dev/null +++ b/packages/framework/fluid-framework/api-extractor/api-extractor-lint-beta.esm.json @@ -0,0 +1,6 @@ +{ + "$schema": "https://developer.microsoft.com/json-schemas/api-extractor/v7/api-extractor.schema.json", + "extends": "/../../../common/build/build-common/api-extractor-lint.entrypoint.json", + "mainEntryPointFilePath": "/lib/beta.d.ts", + "bundledPackages": ["@fluidframework/*"] +} diff --git a/packages/framework/fluid-framework/api-extractor/api-extractor.current.json b/packages/framework/fluid-framework/api-extractor/api-extractor.current.json index c5436d30a6b..72e0a42beff 100644 --- a/packages/framework/fluid-framework/api-extractor/api-extractor.current.json +++ b/packages/framework/fluid-framework/api-extractor/api-extractor.current.json @@ -1,6 +1,6 @@ { "$schema": "https://developer.microsoft.com/json-schemas/api-extractor/v7/api-extractor.schema.json", "extends": "/../../../common/build/build-common/api-extractor-report.esm.current.json", - "mainEntryPointFilePath": "/lib/public.d.ts", + "mainEntryPointFilePath": "/lib/beta.d.ts", "bundledPackages": ["@fluidframework/*"] } diff --git a/packages/framework/fluid-framework/api-report/fluid-framework.beta.api.md b/packages/framework/fluid-framework/api-report/fluid-framework.beta.api.md index cd656f8d3c8..d9c83e251b7 100644 --- a/packages/framework/fluid-framework/api-report/fluid-framework.beta.api.md +++ b/packages/framework/fluid-framework/api-report/fluid-framework.beta.api.md @@ -563,6 +563,11 @@ type NodeBuilderData = T extends TreeNodeSchema> = T extends TreeNodeSchema ? TBuild : never; +// @beta @sealed +export interface NodeChangedData { + readonly changedProperties?: ReadonlySet ? string & keyof TInfo : string>; +} + // @public export type NodeFromSchema = T extends TreeNodeSchema ? TNode : never; @@ -773,12 +778,22 @@ interface TreeArrayNodeBase extends ReadonlyArray< export interface TreeArrayNodeUnsafe> extends TreeArrayNodeBase, InsertableTreeNodeFromImplicitAllowedTypesUnsafe, TreeArrayNode> { } +// @beta @sealed +export const TreeBeta: { + readonly on: , TNode extends TreeNode>(node: TNode, eventName: K, listener: NoInfer[K]>) => () => void; +}; + // @public @sealed export interface TreeChangeEvents { nodeChanged(unstable?: unknown): void; treeChanged(): void; } +// @beta @sealed +export interface TreeChangeEventsBeta extends TreeChangeEvents { + nodeChanged: (data: NodeChangedData & (TNode extends WithType ? Required, "changedProperties">> : unknown)) => void; +} + // @public export type TreeFieldFromImplicitField = TSchema extends FieldSchema ? ApplyKind, Kind, false> : TSchema extends ImplicitAllowedTypes ? TreeNodeFromImplicitAllowedTypes : unknown; diff --git a/packages/framework/fluid-framework/package.json b/packages/framework/fluid-framework/package.json index 5ec38d21e9b..885fa64b3bb 100644 --- a/packages/framework/fluid-framework/package.json +++ b/packages/framework/fluid-framework/package.json @@ -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", diff --git a/packages/framework/fluid-framework/src/index.ts b/packages/framework/fluid-framework/src/index.ts index dc1f162a993..35ee97c731e 100644 --- a/packages/framework/fluid-framework/src/index.ts +++ b/packages/framework/fluid-framework/src/index.ts @@ -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 // ---------------------------------------------------------------