@fluidframework/fluid-static 2.101.0 → 2.102.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 +10 -0
- package/api-report/fluid-static.alpha.api.md +1 -1
- package/api-report/fluid-static.beta.api.md +1 -1
- package/api-report/fluid-static.legacy.beta.api.md +9 -1
- package/api-report/fluid-static.legacy.public.api.md +1 -1
- package/api-report/fluid-static.public.api.md +1 -1
- package/dist/compatibilityConfiguration.d.ts +8 -7
- package/dist/compatibilityConfiguration.d.ts.map +1 -1
- package/dist/compatibilityConfiguration.js +22 -7
- package/dist/compatibilityConfiguration.js.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -1
- package/dist/index.js.map +1 -1
- package/dist/rootDataObject.d.ts +5 -11
- package/dist/rootDataObject.d.ts.map +1 -1
- package/dist/rootDataObject.js +9 -9
- package/dist/rootDataObject.js.map +1 -1
- package/dist/treeRootDataObject.d.ts +38 -4
- package/dist/treeRootDataObject.d.ts.map +1 -1
- package/dist/treeRootDataObject.js +20 -19
- package/dist/treeRootDataObject.js.map +1 -1
- package/dist/types.d.ts +6 -0
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js.map +1 -1
- package/dist/utils.d.ts +10 -7
- package/dist/utils.d.ts.map +1 -1
- package/dist/utils.js +18 -6
- package/dist/utils.js.map +1 -1
- package/lib/compatibilityConfiguration.d.ts +8 -7
- package/lib/compatibilityConfiguration.d.ts.map +1 -1
- package/lib/compatibilityConfiguration.js +20 -6
- package/lib/compatibilityConfiguration.js.map +1 -1
- package/lib/index.d.ts +1 -1
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +1 -1
- package/lib/index.js.map +1 -1
- package/lib/rootDataObject.d.ts +5 -11
- package/lib/rootDataObject.d.ts.map +1 -1
- package/lib/rootDataObject.js +11 -11
- package/lib/rootDataObject.js.map +1 -1
- package/lib/treeRootDataObject.d.ts +38 -4
- package/lib/treeRootDataObject.d.ts.map +1 -1
- package/lib/treeRootDataObject.js +22 -21
- package/lib/treeRootDataObject.js.map +1 -1
- package/lib/types.d.ts +6 -0
- package/lib/types.d.ts.map +1 -1
- package/lib/types.js.map +1 -1
- package/lib/utils.d.ts +10 -7
- package/lib/utils.d.ts.map +1 -1
- package/lib/utils.js +16 -5
- package/lib/utils.js.map +1 -1
- package/package.json +24 -23
- package/src/compatibilityConfiguration.ts +27 -9
- package/src/index.ts +4 -1
- package/src/rootDataObject.ts +15 -32
- package/src/treeRootDataObject.ts +76 -17
- package/src/types.ts +6 -0
- package/src/utils.ts +18 -5
|
@@ -17,8 +17,8 @@ var _TreeContainerRuntimeFactory_treeRootDataObjectFactory;
|
|
|
17
17
|
import { BaseContainerRuntimeFactory, TreeDataObject, TreeDataObjectFactory, } from "@fluidframework/aqueduct/internal";
|
|
18
18
|
import { FluidDataStoreRegistry, } from "@fluidframework/container-runtime/internal";
|
|
19
19
|
import { assert } from "@fluidframework/core-utils/internal";
|
|
20
|
-
import {
|
|
21
|
-
import {
|
|
20
|
+
import { defaultRuntimeOptionsForMinVersion } from "./compatibilityConfiguration.js";
|
|
21
|
+
import { createDataObject, createSharedObject, isDataObjectKind, isSharedObjectKind, makeFluidObject, parseDataObjectsFromSharedObjects, resolveCompatibilityModeToMinVersionForCollab, } from "./utils.js";
|
|
22
22
|
/**
|
|
23
23
|
* This module contains types and factories for creating tree-based root data objects.
|
|
24
24
|
* They exist as an alternative to the APIs in `rootDataObject.ts`.
|
|
@@ -84,16 +84,15 @@ async function provideEntryPoint(containerRuntime) {
|
|
|
84
84
|
* (containing single {@link IRootDataObject}) as their entry point.
|
|
85
85
|
*/
|
|
86
86
|
class TreeContainerRuntimeFactory extends BaseContainerRuntimeFactory {
|
|
87
|
-
constructor(
|
|
87
|
+
constructor(treeRootDataObjectFactory, config) {
|
|
88
88
|
super({
|
|
89
89
|
registryEntries: [treeRootDataObjectFactory.registryEntry],
|
|
90
90
|
runtimeOptions: {
|
|
91
|
-
...
|
|
92
|
-
...
|
|
91
|
+
...defaultRuntimeOptionsForMinVersion(config.minVersionForCollab),
|
|
92
|
+
...config.runtimeOptions,
|
|
93
93
|
},
|
|
94
94
|
provideEntryPoint,
|
|
95
|
-
minVersionForCollab:
|
|
96
|
-
compatibilityModeToMinVersionForCollab[compatibilityMode],
|
|
95
|
+
minVersionForCollab: config.minVersionForCollab,
|
|
97
96
|
});
|
|
98
97
|
// TODO: use for runtime factory.
|
|
99
98
|
_TreeContainerRuntimeFactory_treeRootDataObjectFactory.set(this, void 0);
|
|
@@ -130,24 +129,26 @@ class TreeRootDataObjectFactory extends TreeDataObjectFactory {
|
|
|
130
129
|
return this.dataStoreRegistry;
|
|
131
130
|
}
|
|
132
131
|
}
|
|
133
|
-
|
|
134
|
-
* Creates an {@link @fluidframework/aqueduct#IRuntimeFactory} which constructs containers
|
|
135
|
-
* with an entry point containing single tree-based root data object.
|
|
136
|
-
*
|
|
137
|
-
* @remarks
|
|
138
|
-
* The entry point is opaque to caller.
|
|
139
|
-
* The root data object's registry and shared objects are configured based on the provided
|
|
140
|
-
* SharedTree and optionally data store registry.
|
|
141
|
-
*
|
|
142
|
-
* @legacy @beta
|
|
143
|
-
*/
|
|
132
|
+
// Implementation
|
|
144
133
|
export function createTreeContainerRuntimeFactory(props) {
|
|
145
|
-
const { compatibilityMode, minVersionForCollabOverride, rootDataStoreRegistry, runtimeOptionOverrides, schema, } = props;
|
|
134
|
+
const { compatibilityMode, minVersionForCollaboration, minVersionForCollabOverride, rootDataStoreRegistry, runtimeOptionOverrides, schema, } = props;
|
|
135
|
+
let minVersionForCollab;
|
|
136
|
+
if (minVersionForCollaboration !== undefined) {
|
|
137
|
+
minVersionForCollab = minVersionForCollaboration;
|
|
138
|
+
}
|
|
139
|
+
else if (compatibilityMode === undefined) {
|
|
140
|
+
throw new Error("Either minVersionForCollaboration or compatibilityMode (deprecated) must be provided.");
|
|
141
|
+
}
|
|
142
|
+
else {
|
|
143
|
+
minVersionForCollab =
|
|
144
|
+
minVersionForCollabOverride ??
|
|
145
|
+
resolveCompatibilityModeToMinVersionForCollab(compatibilityMode);
|
|
146
|
+
}
|
|
146
147
|
const [registryEntries, sharedObjects] = parseDataObjectsFromSharedObjects(schema);
|
|
147
148
|
const registry = rootDataStoreRegistry ?? new FluidDataStoreRegistry(registryEntries);
|
|
148
|
-
return new TreeContainerRuntimeFactory(
|
|
149
|
+
return new TreeContainerRuntimeFactory(new TreeRootDataObjectFactory(sharedObjects, registry), {
|
|
149
150
|
runtimeOptions: runtimeOptionOverrides,
|
|
150
|
-
minVersionForCollab
|
|
151
|
+
minVersionForCollab,
|
|
151
152
|
});
|
|
152
153
|
}
|
|
153
154
|
//# sourceMappingURL=treeRootDataObject.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"treeRootDataObject.js","sourceRoot":"","sources":["../src/treeRootDataObject.ts"],"names":[],"mappings":"AAAA;;;GAGG;;;;;;;;;;;;;AAEH,OAAO,EACN,2BAA2B,EAC3B,cAAc,EACd,qBAAqB,GACrB,MAAM,mCAAmC,CAAC;AAG3C,OAAO,EACN,sBAAsB,GAEtB,MAAM,4CAA4C,CAAC;AAUpD,OAAO,EAAE,MAAM,EAAE,MAAM,qCAAqC,CAAC;AAQ7D,OAAO,EAAE,+BAA+B,EAAE,MAAM,iCAAiC,CAAC;AASlF,OAAO,EACN,sCAAsC,EACtC,gBAAgB,EAChB,kBAAkB,EAClB,gBAAgB,EAChB,kBAAkB,EAClB,eAAe,EACf,iCAAiC,GACjC,MAAM,YAAY,CAAC;AAEpB;;;;;;GAMG;AAEH;;;;;GAKG;AACH,MAAM,kBAAmB,SAAQ,cAAc;IAC9C,YAAmB,KAAuB;QACzC,KAAK,CAAC,KAAK,CAAC,CAAC;IACd,CAAC;IAED,IAAW,kBAAkB;QAC5B,OAAO,IAAI,CAAC;IACb,CAAC;IAED,sHAAsH;IACtH,yEAAyE;IACzE,IAAW,cAAc;QAC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AM,GACN,GAAG,KAAK,CAAC;IAEV,MAAM,CAAC,eAAe,EAAE,aAAa,CAAC,GAAG,iCAAiC,CAAC,MAAM,CAAC,CAAC;IACnF,MAAM,QAAQ,GAAG,qBAAqB,IAAI,IAAI,sBAAsB,CAAC,eAAe,CAAC,CAAC;IAEtF,OAAO,IAAI,2BAA2B,CACrC,iBAAiB,EACjB,IAAI,yBAAyB,CAAC,aAAa,EAAE,QAAQ,CAAC,EACtD;QACC,cAAc,EAAE,sBAAsB;QACtC,mBAAmB,EAAE,2BAA2B;KAChD,CACD,CAAC;AACH,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport {\n\tBaseContainerRuntimeFactory,\n\tTreeDataObject,\n\tTreeDataObjectFactory,\n} from \"@fluidframework/aqueduct/internal\";\nimport type { IDataObjectProps } from \"@fluidframework/aqueduct/internal\";\nimport type { IRuntimeFactory } from \"@fluidframework/container-definitions/internal\";\nimport {\n\tFluidDataStoreRegistry,\n\ttype IContainerRuntimeOptions,\n} from \"@fluidframework/container-runtime/internal\";\nimport type {\n\tIContainerRuntime,\n\tIContainerRuntimeInternal,\n} from \"@fluidframework/container-runtime-definitions/internal\";\nimport type {\n\tFluidObject,\n\tIFluidHandle,\n\tIFluidLoadable,\n} from \"@fluidframework/core-interfaces\";\nimport { assert } from \"@fluidframework/core-utils/internal\";\nimport type { IChannelFactory } from \"@fluidframework/datastore-definitions/internal\";\nimport type {\n\tIFluidDataStoreRegistry,\n\tMinimumVersionForCollab,\n} from \"@fluidframework/runtime-definitions/internal\";\nimport type { SharedObjectKind } from \"@fluidframework/shared-object-base/internal\";\n\nimport { compatibilityModeRuntimeOptions } from \"./compatibilityConfiguration.js\";\nimport type {\n\tCompatibilityMode,\n\tIRootDataObject,\n\tIStaticEntryPoint,\n\tLoadableObjectKind,\n\tLoadableObjectRecord,\n\tTreeContainerSchema,\n} from \"./types.js\";\nimport {\n\tcompatibilityModeToMinVersionForCollab,\n\tcreateDataObject,\n\tcreateSharedObject,\n\tisDataObjectKind,\n\tisSharedObjectKind,\n\tmakeFluidObject,\n\tparseDataObjectsFromSharedObjects,\n} from \"./utils.js\";\n\n/**\n * This module contains types and factories for creating tree-based root data objects.\n * They exist as an alternative to the APIs in `rootDataObject.ts`.\n *\n * These APIs are currently shaped to parallel `RootDataObject`, but this is not intended as the long-term design.\n * The current shape is a short-term solution to allow for easier migration from the old APIs.\n */\n\n/**\n * The entry-point/root collaborative object of the {@link IFluidContainer | Fluid Container}.\n *\n * @remarks\n * Abstracts the dynamic code required to build a Fluid Container into a static representation for end customers.\n */\nclass TreeRootDataObject extends TreeDataObject implements IRootDataObject {\n\tpublic constructor(props: IDataObjectProps) {\n\t\tsuper(props);\n\t}\n\n\tpublic get TreeRootDataObject(): TreeRootDataObject {\n\t\treturn this;\n\t}\n\n\t// TODO: longer term, it would be better to not have to fit into the `initialObjects` model for tree-based containers.\n\t// But in the short term, fitting into this model makes migration easier.\n\tpublic get initialObjects(): LoadableObjectRecord {\n\t\treturn {\n\t\t\ttree: this.tree,\n\t\t};\n\t}\n\n\tpublic async create<T>(objectClass: SharedObjectKind<T>): Promise<T> {\n\t\tconst internal = objectClass as unknown as LoadableObjectKind<T & IFluidLoadable>;\n\t\tif (isDataObjectKind(internal)) {\n\t\t\treturn createDataObject(internal, this.context);\n\t\t} else if (isSharedObjectKind(internal)) {\n\t\t\treturn createSharedObject(internal, this.runtime);\n\t\t}\n\t\tthrow new Error(\"Could not create new Fluid object because an unknown object was passed\");\n\t}\n\n\tpublic async uploadBlob(blob: ArrayBufferLike): Promise<IFluidHandle<ArrayBufferLike>> {\n\t\treturn this.runtime.uploadBlob(blob);\n\t}\n}\n\nconst treeRootDataStoreId = \"treeRootDOId\";\n\n/**\n * Type of the {@link TreeRootDataObject}.\n * @remarks Used in the PureDataObjectFactory to create the root data object.\n */\nconst treeRootDataObjectType = \"treeRootDO\";\n\nasync function provideEntryPoint(\n\tcontainerRuntime: IContainerRuntime,\n): Promise<IStaticEntryPoint> {\n\tconst entryPoint = await containerRuntime.getAliasedDataStoreEntryPoint(treeRootDataStoreId);\n\tif (entryPoint === undefined) {\n\t\tthrow new Error(`default dataStore [${treeRootDataStoreId}] must exist`);\n\t}\n\tconst treeRootDataObject = ((await entryPoint.get()) as FluidObject<TreeRootDataObject>)\n\t\t.TreeRootDataObject;\n\tassert(\n\t\ttreeRootDataObject !== undefined,\n\t\t0xbe7 /* entryPoint must be of type TreeRootDataObject */,\n\t);\n\treturn makeFluidObject<IStaticEntryPoint>(\n\t\t{\n\t\t\trootDataObject: treeRootDataObject,\n\t\t\textensionStore: containerRuntime as IContainerRuntimeInternal,\n\t\t},\n\t\t\"IStaticEntryPoint\",\n\t);\n}\n\n/**\n * Factory for Container Runtime instances that provide a {@link IStaticEntryPoint}\n * (containing single {@link IRootDataObject}) as their entry point.\n */\nclass TreeContainerRuntimeFactory extends BaseContainerRuntimeFactory {\n\t// TODO: use for runtime factory.\n\treadonly #treeRootDataObjectFactory: TreeDataObjectFactory<TreeRootDataObject>;\n\n\tpublic constructor(\n\t\tcompatibilityMode: CompatibilityMode,\n\t\ttreeRootDataObjectFactory: TreeDataObjectFactory<TreeRootDataObject>,\n\t\toverrides?: Partial<{\n\t\t\truntimeOptions: Partial<IContainerRuntimeOptions>;\n\t\t\tminVersionForCollab: MinimumVersionForCollab;\n\t\t}>,\n\t) {\n\t\tsuper({\n\t\t\tregistryEntries: [treeRootDataObjectFactory.registryEntry],\n\t\t\truntimeOptions: {\n\t\t\t\t...compatibilityModeRuntimeOptions[compatibilityMode],\n\t\t\t\t...overrides?.runtimeOptions,\n\t\t\t},\n\t\t\tprovideEntryPoint,\n\t\t\tminVersionForCollab:\n\t\t\t\toverrides?.minVersionForCollab ??\n\t\t\t\tcompatibilityModeToMinVersionForCollab[compatibilityMode],\n\t\t});\n\t\tthis.#treeRootDataObjectFactory = treeRootDataObjectFactory;\n\t}\n\n\tprotected async containerInitializingFirstTime(runtime: IContainerRuntime): Promise<void> {\n\t\t// The first time we create the container we create the RootDataObject\n\t\tawait this.#treeRootDataObjectFactory.createRootInstance(treeRootDataStoreId, runtime);\n\t}\n}\n\n/**\n * Factory that creates instances of a tree-based root data object.\n */\nclass TreeRootDataObjectFactory extends TreeDataObjectFactory<TreeRootDataObject> {\n\tpublic constructor(\n\t\tsharedObjects: readonly IChannelFactory[] = [],\n\t\tprivate readonly dataStoreRegistry: IFluidDataStoreRegistry,\n\t) {\n\t\ttype Ctor = new (props: IDataObjectProps) => TreeRootDataObject;\n\t\tconst ctor: Ctor = function (_props) {\n\t\t\t// eslint-disable-next-line @typescript-eslint/no-unsafe-argument\n\t\t\treturn new TreeRootDataObject({\n\t\t\t\t..._props,\n\t\t\t\t// Add any additional injected properties here\n\t\t\t});\n\t\t} as unknown as Ctor;\n\n\t\t// Note: we're not specifying registry entries to the base class, so it won't create a registry itself,\n\t\t// and instead we override the necessary methods in this class to use the registry received in the constructor.\n\t\tsuper({\n\t\t\ttype: treeRootDataObjectType,\n\t\t\tctor,\n\t\t\tsharedObjects,\n\t\t});\n\t}\n\n\tpublic get IFluidDataStoreRegistry(): IFluidDataStoreRegistry {\n\t\treturn this.dataStoreRegistry;\n\t}\n}\n\n/**\n * Creates an {@link @fluidframework/aqueduct#IRuntimeFactory} which constructs containers\n * with an entry point containing single tree-based root data object.\n *\n * @remarks\n * The entry point is opaque to caller.\n * The root data object's registry and shared objects are configured based on the provided\n * SharedTree and optionally data store registry.\n *\n * @legacy @beta\n */\nexport function createTreeContainerRuntimeFactory(props: {\n\t/**\n\t * The schema for the container.\n\t */\n\treadonly schema: TreeContainerSchema;\n\n\t/**\n\t * See {@link CompatibilityMode} and compatibilityModeRuntimeOptions for more details.\n\t */\n\treadonly compatibilityMode: CompatibilityMode;\n\t/**\n\t * Optional registry of data stores to pass to the DataObject factory.\n\t * If not provided, one will be created based on the schema.\n\t */\n\treadonly rootDataStoreRegistry?: IFluidDataStoreRegistry;\n\t/**\n\t * Optional overrides for the container runtime options.\n\t * If not provided, only the default options for the given compatibilityMode will be used.\n\t */\n\treadonly runtimeOptionOverrides?: Partial<IContainerRuntimeOptions>;\n\t/**\n\t * Optional override for minimum version for collab.\n\t * If not provided, the default for the given compatibilityMode will be used.\n\t * @remarks\n\t * This is useful when runtime options are overridden and change the minimum version for collab.\n\t */\n\treadonly minVersionForCollabOverride?: MinimumVersionForCollab;\n}): IRuntimeFactory {\n\tconst {\n\t\tcompatibilityMode,\n\t\tminVersionForCollabOverride,\n\t\trootDataStoreRegistry,\n\t\truntimeOptionOverrides,\n\t\tschema,\n\t} = props;\n\n\tconst [registryEntries, sharedObjects] = parseDataObjectsFromSharedObjects(schema);\n\tconst registry = rootDataStoreRegistry ?? new FluidDataStoreRegistry(registryEntries);\n\n\treturn new TreeContainerRuntimeFactory(\n\t\tcompatibilityMode,\n\t\tnew TreeRootDataObjectFactory(sharedObjects, registry),\n\t\t{\n\t\t\truntimeOptions: runtimeOptionOverrides,\n\t\t\tminVersionForCollab: minVersionForCollabOverride,\n\t\t},\n\t);\n}\n"]}
|
|
1
|
+
{"version":3,"file":"treeRootDataObject.js","sourceRoot":"","sources":["../src/treeRootDataObject.ts"],"names":[],"mappings":"AAAA;;;GAGG;;;;;;;;;;;;;AAEH,OAAO,EACN,2BAA2B,EAC3B,cAAc,EACd,qBAAqB,GACrB,MAAM,mCAAmC,CAAC;AAG3C,OAAO,EACN,sBAAsB,GAEtB,MAAM,4CAA4C,CAAC;AAUpD,OAAO,EAAE,MAAM,EAAE,MAAM,qCAAqC,CAAC;AAQ7D,OAAO,EAAE,kCAAkC,EAAE,MAAM,iCAAiC,CAAC;AAUrF,OAAO,EACN,gBAAgB,EAChB,kBAAkB,EAClB,gBAAgB,EAChB,kBAAkB,EAClB,eAAe,EACf,iCAAiC,EACjC,6CAA6C,GAC7C,MAAM,YAAY,CAAC;AAEpB;;;;;;GAMG;AAEH;;;;;GAKG;AACH,MAAM,kBAAmB,SAAQ,cAAc;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iBAAiB;AACjB,MAAM,UAAU,iCAAiC,CAAC,KAQjD;IACA,MAAM,EACL,iBAAiB,EACjB,0BAA0B,EAC1B,2BAA2B,EAC3B,qBAAqB,EACrB,sBAAsB,EACtB,MAAM,GACN,GAAG,KAAK,CAAC;IAEV,IAAI,mBAA4C,CAAC;IACjD,IAAI,0BAA0B,KAAK,SAAS,EAAE,CAAC;QAC9C,mBAAmB,GAAG,0BAA0B,CAAC;IAClD,CAAC;SAAM,IAAI,iBAAiB,KAAK,SAAS,EAAE,CAAC;QAC5C,MAAM,IAAI,KAAK,CACd,uFAAuF,CACvF,CAAC;IACH,CAAC;SAAM,CAAC;QACP,mBAAmB;YAClB,2BAA2B;gBAC3B,6CAA6C,CAAC,iBAAiB,CAAC,CAAC;IACnE,CAAC;IAED,MAAM,CAAC,eAAe,EAAE,aAAa,CAAC,GAAG,iCAAiC,CAAC,MAAM,CAAC,CAAC;IACnF,MAAM,QAAQ,GAAG,qBAAqB,IAAI,IAAI,sBAAsB,CAAC,eAAe,CAAC,CAAC;IAEtF,OAAO,IAAI,2BAA2B,CACrC,IAAI,yBAAyB,CAAC,aAAa,EAAE,QAAQ,CAAC,EACtD;QACC,cAAc,EAAE,sBAAsB;QACtC,mBAAmB;KACnB,CACD,CAAC;AACH,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport {\n\tBaseContainerRuntimeFactory,\n\tTreeDataObject,\n\tTreeDataObjectFactory,\n} from \"@fluidframework/aqueduct/internal\";\nimport type { IDataObjectProps } from \"@fluidframework/aqueduct/internal\";\nimport type { IRuntimeFactory } from \"@fluidframework/container-definitions/internal\";\nimport {\n\tFluidDataStoreRegistry,\n\ttype IContainerRuntimeOptions,\n} from \"@fluidframework/container-runtime/internal\";\nimport type {\n\tIContainerRuntime,\n\tIContainerRuntimeInternal,\n} from \"@fluidframework/container-runtime-definitions/internal\";\nimport type {\n\tFluidObject,\n\tIFluidHandle,\n\tIFluidLoadable,\n} from \"@fluidframework/core-interfaces\";\nimport { assert } from \"@fluidframework/core-utils/internal\";\nimport type { IChannelFactory } from \"@fluidframework/datastore-definitions/internal\";\nimport type {\n\tIFluidDataStoreRegistry,\n\tMinimumVersionForCollab,\n} from \"@fluidframework/runtime-definitions/internal\";\nimport type { SharedObjectKind } from \"@fluidframework/shared-object-base/internal\";\n\nimport { defaultRuntimeOptionsForMinVersion } from \"./compatibilityConfiguration.js\";\nimport type {\n\t// eslint-disable-next-line import-x/no-deprecated\n\tCompatibilityMode,\n\tIRootDataObject,\n\tIStaticEntryPoint,\n\tLoadableObjectKind,\n\tLoadableObjectRecord,\n\tTreeContainerSchema,\n} from \"./types.js\";\nimport {\n\tcreateDataObject,\n\tcreateSharedObject,\n\tisDataObjectKind,\n\tisSharedObjectKind,\n\tmakeFluidObject,\n\tparseDataObjectsFromSharedObjects,\n\tresolveCompatibilityModeToMinVersionForCollab,\n} from \"./utils.js\";\n\n/**\n * This module contains types and factories for creating tree-based root data objects.\n * They exist as an alternative to the APIs in `rootDataObject.ts`.\n *\n * These APIs are currently shaped to parallel `RootDataObject`, but this is not intended as the long-term design.\n * The current shape is a short-term solution to allow for easier migration from the old APIs.\n */\n\n/**\n * The entry-point/root collaborative object of the {@link IFluidContainer | Fluid Container}.\n *\n * @remarks\n * Abstracts the dynamic code required to build a Fluid Container into a static representation for end customers.\n */\nclass TreeRootDataObject extends TreeDataObject implements IRootDataObject {\n\tpublic constructor(props: IDataObjectProps) {\n\t\tsuper(props);\n\t}\n\n\tpublic get TreeRootDataObject(): TreeRootDataObject {\n\t\treturn this;\n\t}\n\n\t// TODO: longer term, it would be better to not have to fit into the `initialObjects` model for tree-based containers.\n\t// But in the short term, fitting into this model makes migration easier.\n\tpublic get initialObjects(): LoadableObjectRecord {\n\t\treturn {\n\t\t\ttree: this.tree,\n\t\t};\n\t}\n\n\tpublic async create<T>(objectClass: SharedObjectKind<T>): Promise<T> {\n\t\tconst internal = objectClass as unknown as LoadableObjectKind<T & IFluidLoadable>;\n\t\tif (isDataObjectKind(internal)) {\n\t\t\treturn createDataObject(internal, this.context);\n\t\t} else if (isSharedObjectKind(internal)) {\n\t\t\treturn createSharedObject(internal, this.runtime);\n\t\t}\n\t\tthrow new Error(\"Could not create new Fluid object because an unknown object was passed\");\n\t}\n\n\tpublic async uploadBlob(blob: ArrayBufferLike): Promise<IFluidHandle<ArrayBufferLike>> {\n\t\treturn this.runtime.uploadBlob(blob);\n\t}\n}\n\nconst treeRootDataStoreId = \"treeRootDOId\";\n\n/**\n * Type of the {@link TreeRootDataObject}.\n * @remarks Used in the PureDataObjectFactory to create the root data object.\n */\nconst treeRootDataObjectType = \"treeRootDO\";\n\nasync function provideEntryPoint(\n\tcontainerRuntime: IContainerRuntime,\n): Promise<IStaticEntryPoint> {\n\tconst entryPoint = await containerRuntime.getAliasedDataStoreEntryPoint(treeRootDataStoreId);\n\tif (entryPoint === undefined) {\n\t\tthrow new Error(`default dataStore [${treeRootDataStoreId}] must exist`);\n\t}\n\tconst treeRootDataObject = ((await entryPoint.get()) as FluidObject<TreeRootDataObject>)\n\t\t.TreeRootDataObject;\n\tassert(\n\t\ttreeRootDataObject !== undefined,\n\t\t0xbe7 /* entryPoint must be of type TreeRootDataObject */,\n\t);\n\treturn makeFluidObject<IStaticEntryPoint>(\n\t\t{\n\t\t\trootDataObject: treeRootDataObject,\n\t\t\textensionStore: containerRuntime as IContainerRuntimeInternal,\n\t\t},\n\t\t\"IStaticEntryPoint\",\n\t);\n}\n\n/**\n * Factory for Container Runtime instances that provide a {@link IStaticEntryPoint}\n * (containing single {@link IRootDataObject}) as their entry point.\n */\nclass TreeContainerRuntimeFactory extends BaseContainerRuntimeFactory {\n\t// TODO: use for runtime factory.\n\treadonly #treeRootDataObjectFactory: TreeDataObjectFactory<TreeRootDataObject>;\n\n\tpublic constructor(\n\t\ttreeRootDataObjectFactory: TreeDataObjectFactory<TreeRootDataObject>,\n\t\tconfig: {\n\t\t\tminVersionForCollab: MinimumVersionForCollab;\n\t\t\truntimeOptions?: Partial<IContainerRuntimeOptions>;\n\t\t},\n\t) {\n\t\tsuper({\n\t\t\tregistryEntries: [treeRootDataObjectFactory.registryEntry],\n\t\t\truntimeOptions: {\n\t\t\t\t...defaultRuntimeOptionsForMinVersion(config.minVersionForCollab),\n\t\t\t\t...config.runtimeOptions,\n\t\t\t},\n\t\t\tprovideEntryPoint,\n\t\t\tminVersionForCollab: config.minVersionForCollab,\n\t\t});\n\t\tthis.#treeRootDataObjectFactory = treeRootDataObjectFactory;\n\t}\n\n\tprotected async containerInitializingFirstTime(runtime: IContainerRuntime): Promise<void> {\n\t\t// The first time we create the container we create the RootDataObject\n\t\tawait this.#treeRootDataObjectFactory.createRootInstance(treeRootDataStoreId, runtime);\n\t}\n}\n\n/**\n * Factory that creates instances of a tree-based root data object.\n */\nclass TreeRootDataObjectFactory extends TreeDataObjectFactory<TreeRootDataObject> {\n\tpublic constructor(\n\t\tsharedObjects: readonly IChannelFactory[] = [],\n\t\tprivate readonly dataStoreRegistry: IFluidDataStoreRegistry,\n\t) {\n\t\ttype Ctor = new (props: IDataObjectProps) => TreeRootDataObject;\n\t\tconst ctor: Ctor = function (_props) {\n\t\t\t// eslint-disable-next-line @typescript-eslint/no-unsafe-argument\n\t\t\treturn new TreeRootDataObject({\n\t\t\t\t..._props,\n\t\t\t\t// Add any additional injected properties here\n\t\t\t});\n\t\t} as unknown as Ctor;\n\n\t\t// Note: we're not specifying registry entries to the base class, so it won't create a registry itself,\n\t\t// and instead we override the necessary methods in this class to use the registry received in the constructor.\n\t\tsuper({\n\t\t\ttype: treeRootDataObjectType,\n\t\t\tctor,\n\t\t\tsharedObjects,\n\t\t});\n\t}\n\n\tpublic get IFluidDataStoreRegistry(): IFluidDataStoreRegistry {\n\t\treturn this.dataStoreRegistry;\n\t}\n}\n\n/**\n * Creates an {@link @fluidframework/aqueduct#IRuntimeFactory} which constructs containers\n * with an entry point containing single tree-based root data object.\n *\n * @remarks\n * The entry point is opaque to caller.\n * The root data object's registry and shared objects are configured based on the provided\n * SharedTree and optionally data store registry.\n *\n * @legacy @beta\n */\nexport function createTreeContainerRuntimeFactory(props: {\n\t/**\n\t * The schema for the container.\n\t */\n\treadonly schema: TreeContainerSchema;\n\n\t/**\n\t * Minimum Fluid Framework version required for collaboration as a\n\t * {@link @fluidframework/runtime-definitions#MinimumVersionForCollab} SemVer string.\n\t */\n\treadonly minVersionForCollaboration: MinimumVersionForCollab;\n\t/**\n\t * Optional registry of data stores to pass to the DataObject factory.\n\t * If not provided, one will be created based on the schema.\n\t */\n\treadonly rootDataStoreRegistry?: IFluidDataStoreRegistry;\n\t/**\n\t * Optional overrides for the container runtime options.\n\t * If not provided, only the default options for the given minVersionForCollaboration will be used.\n\t */\n\treadonly runtimeOptionOverrides?: Partial<IContainerRuntimeOptions>;\n}): IRuntimeFactory;\n\n/**\n * Creates an {@link @fluidframework/aqueduct#IRuntimeFactory} which constructs containers\n * with an entry point containing single tree-based root data object.\n *\n * @remarks\n * The entry point is opaque to caller.\n * The root data object's registry and shared objects are configured based on the provided\n * SharedTree and optional data store registry.\n *\n * @deprecated Pass `minVersionForCollaboration` directly instead of using `compatibilityMode`.\n *\n * @legacy @beta\n */\nexport function createTreeContainerRuntimeFactory(props: {\n\t/**\n\t * The schema for the container.\n\t */\n\treadonly schema: TreeContainerSchema;\n\n\t/**\n\t * Legacy compatibility mode for the container.\n\t */\n\t// eslint-disable-next-line import-x/no-deprecated\n\treadonly compatibilityMode: CompatibilityMode;\n\t/**\n\t * Optional registry of data stores to pass to the DataObject factory.\n\t * If not provided, one will be created based on the schema.\n\t */\n\treadonly rootDataStoreRegistry?: IFluidDataStoreRegistry;\n\t/**\n\t * Optional overrides for the container runtime options.\n\t * If not provided, only the default options for the given compatibilityMode will be used.\n\t */\n\treadonly runtimeOptionOverrides?: Partial<IContainerRuntimeOptions>;\n\t/**\n\t * Optional override for minimum version for collaboration.\n\t * @remarks\n\t * If not provided, the default for the given compatibilityMode will be used.\n\t * Rather than defining this, omit `compatibilityMode` and pass `minVersionForCollaboration` directly.\n\t */\n\treadonly minVersionForCollabOverride?: MinimumVersionForCollab;\n}): IRuntimeFactory;\n\n// Implementation\nexport function createTreeContainerRuntimeFactory(props: {\n\treadonly schema: TreeContainerSchema;\n\t// eslint-disable-next-line import-x/no-deprecated\n\treadonly compatibilityMode?: CompatibilityMode;\n\treadonly minVersionForCollaboration?: MinimumVersionForCollab;\n\treadonly rootDataStoreRegistry?: IFluidDataStoreRegistry;\n\treadonly runtimeOptionOverrides?: Partial<IContainerRuntimeOptions>;\n\treadonly minVersionForCollabOverride?: MinimumVersionForCollab;\n}): IRuntimeFactory {\n\tconst {\n\t\tcompatibilityMode,\n\t\tminVersionForCollaboration,\n\t\tminVersionForCollabOverride,\n\t\trootDataStoreRegistry,\n\t\truntimeOptionOverrides,\n\t\tschema,\n\t} = props;\n\n\tlet minVersionForCollab: MinimumVersionForCollab;\n\tif (minVersionForCollaboration !== undefined) {\n\t\tminVersionForCollab = minVersionForCollaboration;\n\t} else if (compatibilityMode === undefined) {\n\t\tthrow new Error(\n\t\t\t\"Either minVersionForCollaboration or compatibilityMode (deprecated) must be provided.\",\n\t\t);\n\t} else {\n\t\tminVersionForCollab =\n\t\t\tminVersionForCollabOverride ??\n\t\t\tresolveCompatibilityModeToMinVersionForCollab(compatibilityMode);\n\t}\n\n\tconst [registryEntries, sharedObjects] = parseDataObjectsFromSharedObjects(schema);\n\tconst registry = rootDataStoreRegistry ?? new FluidDataStoreRegistry(registryEntries);\n\n\treturn new TreeContainerRuntimeFactory(\n\t\tnew TreeRootDataObjectFactory(sharedObjects, registry),\n\t\t{\n\t\t\truntimeOptions: runtimeOptionOverrides,\n\t\t\tminVersionForCollab,\n\t\t},\n\t);\n}\n"]}
|
package/lib/types.d.ts
CHANGED
|
@@ -12,6 +12,12 @@ import type { ITree } from "@fluidframework/tree";
|
|
|
12
12
|
* In "1" mode we support full interop between 2.x clients and 1.x clients,
|
|
13
13
|
* while in "2" mode we only support interop between 2.x clients.
|
|
14
14
|
*
|
|
15
|
+
* @deprecated Specify the minimum Fluid Framework version directly via the
|
|
16
|
+
* `minVersionForCollab` parameter, which accepts a
|
|
17
|
+
* {@link @fluidframework/runtime-definitions#MinimumVersionForCollab} SemVer string. The
|
|
18
|
+
* legacy mode "1" is equivalent to `minVersionForCollab: "1.0.0"`; mode "2" is
|
|
19
|
+
* equivalent to `"2.0.0"`.
|
|
20
|
+
*
|
|
15
21
|
* @public
|
|
16
22
|
*/
|
|
17
23
|
export type CompatibilityMode = "1" | "2";
|
package/lib/types.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,mCAAmC,CAAC;AACxE,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,wDAAwD,CAAC;AACtG,OAAO,KAAK,EACX,MAAM,EACN,cAAc,EACd,YAAY,EACZ,cAAc,EACd,MAAM,iCAAiC,CAAC;AACzC,OAAO,KAAK,EACX,iBAAiB,EACjB,gBAAgB,EAChB,MAAM,6CAA6C,CAAC;AACrD,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,sBAAsB,CAAC;AAElD
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,mCAAmC,CAAC;AACxE,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,wDAAwD,CAAC;AACtG,OAAO,KAAK,EACX,MAAM,EACN,cAAc,EACd,YAAY,EACZ,cAAc,EACd,MAAM,iCAAiC,CAAC;AACzC,OAAO,KAAK,EACX,iBAAiB,EACjB,gBAAgB,EAChB,MAAM,6CAA6C,CAAC;AACrD,OAAO,KAAK,EAAE,KAAK,EA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AE,OAAO,GAAG,MAAM,CAAC;CAChC;AAED;;;;;GAKG;AACH,MAAM,WAAW,OAAO;IACvB;;OAEG;IACH,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;IAEpB;;OAEG;IACH,QAAQ,CAAC,WAAW,EAAE,WAAW,EAAE,CAAC;CACpC;AAED;;;GAGG;AACH,MAAM,MAAM,MAAM,CAAC,CAAC,SAAS,OAAO,GAAG,OAAO,IAAI,CAAC,GAAG;IAAE,QAAQ,CAAC,iBAAiB,EAAE,MAAM,CAAA;CAAE,CAAC"}
|
package/lib/types.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;;GAGG","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport type { DataObjectKind } from \"@fluidframework/aqueduct/internal\";\nimport type { ContainerExtensionStore } from \"@fluidframework/container-runtime-definitions/internal\";\nimport type {\n\tIEvent,\n\tIEventProvider,\n\tIFluidHandle,\n\tIFluidLoadable,\n} from \"@fluidframework/core-interfaces\";\nimport type {\n\tISharedObjectKind,\n\tSharedObjectKind,\n} from \"@fluidframework/shared-object-base/internal\";\nimport type { ITree } from \"@fluidframework/tree\";\n\n/**\n * Determines the set of runtime options that Fluid Framework will use when running.\n * In \"1\" mode we support full interop between 2.x clients and 1.x clients,\n * while in \"2\" mode we only support interop between 2.x clients.\n *\n * @public\n */\nexport type CompatibilityMode = \"1\" | \"2\";\n\n/**\n * A mapping of string identifiers to instantiated `DataObject`s or `SharedObject`s.\n */\nexport type LoadableObjectRecord = Record<string, IFluidLoadable>;\n\n/**\n * A mapping of string identifiers to classes that will later be used to instantiate a corresponding `DataObject`\n * or `SharedObject`.\n */\nexport type LoadableObjectKindRecord = Record<string, SharedObjectKind>;\n\n/**\n * A kind of `DataObject` or `SharedObject`.\n *\n * @typeParam T - The kind of `DataObject` or `SharedObject`.\n *\n * @privateRemarks\n * There are some edge cases in TypeScript where the order of the members in a union matter.\n * Once such edge case is when multiple members of a generic union partially match, and the type parameter is being inferred.\n * In this case, its better to have the desired match and/or the simpler type first.\n * In this case placing ISharedObjectKind fixed one usage and didn't break anything, and generally seems more likely to work than the reverse, so this is the order being used.\n * This is likely (a bug in TypeScript)[https://github.com/microsoft/TypeScript/issues/45809].\n */\nexport type LoadableObjectKind<T extends IFluidLoadable = IFluidLoadable> =\n\t| ISharedObjectKind<T>\n\t| DataObjectKind<T>;\n\n/**\n * Represents properties that can be attached to a container.\n * @public\n */\nexport type ContainerAttachProps<T = unknown> = T;\n\n/**\n * Declares the Fluid objects that will be available in the {@link IFluidContainer | Container}.\n *\n * @remarks\n *\n * It includes both the instances of objects that are initially available upon `Container` creation, as well\n * as the types of objects that may be dynamically created throughout the lifetime of the `Container`.\n * @public\n */\nexport interface ContainerSchema {\n\t/**\n\t * Defines loadable objects that will be created when the {@link IFluidContainer | Container} is first created.\n\t *\n\t * @remarks It uses the key as the id and the value as the loadable object to create.\n\t *\n\t * @example\n\t *\n\t * In the example below two objects will be created when the `Container` is first\n\t * created. One with id \"map1\" that will return a `SharedMap` and the other with\n\t * id \"pair1\" that will return a `KeyValueDataObject`.\n\t *\n\t * ```typescript\n\t * {\n\t * map1: SharedMap,\n\t * pair1: KeyValueDataObject,\n\t * }\n\t * ```\n\t */\n\treadonly initialObjects: Record<string, SharedObjectKind>;\n\n\t/**\n\t * Loadable objects that can be created after the initial {@link IFluidContainer | Container} creation.\n\t *\n\t * @remarks\n\t *\n\t * Types defined in `initialObjects` will always be available and are not required to be provided here.\n\t *\n\t * For best practice it's recommended to define all the dynamic types you create even if they are\n\t * included via initialObjects.\n\t */\n\treadonly dynamicObjectTypes?: readonly SharedObjectKind[];\n}\n\n/**\n * Declares the Fluid objects that will be available in the {@link IFluidContainer | Container}.\n *\n * @remarks\n *\n * It includes both the kind of `SharedTree` that will be initially available upon `Container` creation, as well\n * as the types of objects that may be dynamically created throughout the lifetime of the `Container`.\n *\n * @legacy @beta\n */\nexport interface TreeContainerSchema extends ContainerSchema {\n\t// TODO: longer term, it would be better to not have to fit into the `initialObjects` model for tree-based containers.\n\t// But in the short term, fitting into this model makes migration easier.\n\treadonly initialObjects: {\n\t\treadonly tree: SharedObjectKind<ITree>;\n\t};\n}\n\n/**\n * Holds the collection of objects that the container was initially created with.\n * Additionally provides the ability to dynamically create further objects during usage.\n */\nexport interface IRootDataObject {\n\t/**\n\t * Dynamically creates a new detached collaborative object (DDS/DataObject).\n\t *\n\t * @param objectClass - Type of the collaborative object to be created.\n\t *\n\t * @typeParam T - The class of the `DataObject` or `SharedObject`.\n\t */\n\tcreate<T>(objectClass: SharedObjectKind<T>): Promise<T>;\n\n\t/**\n\t * Upload a blob of data.\n\t * Although it is marked as internal, there is external usage of this function for experimental purposes.\n\t * Please contact yunho-microsoft or vladsud if you need to change it.\n\t * @param blob - blob to be uploaded.\n\t *\n\t * @remarks This method is used to expose uploadBlob to the IFluidContainer level. UploadBlob will upload data to server side (as of now, ODSP only). There is no downloadBlob provided as it is not needed(blob lifetime managed by server).\n\t */\n\tuploadBlob(blob: ArrayBufferLike): Promise<IFluidHandle<ArrayBufferLike>>;\n\n\t/**\n\t * Provides a record of the initial objects defined on creation.\n\t */\n\treadonly initialObjects: LoadableObjectRecord;\n}\n\ninterface IProvideStaticEntryPoint {\n\treadonly IStaticEntryPoint: IStaticEntryPoint;\n}\n\n/**\n * This is the internal entry point fluid-static creates.\n */\nexport interface IStaticEntryPoint extends IProvideStaticEntryPoint {\n\treadonly rootDataObject: IRootDataObject;\n\treadonly extensionStore: ContainerExtensionStore;\n}\n\n/**\n * Signature for {@link IMember} change events.\n *\n * @param clientId - A unique identifier for the client.\n * @param member - The service-specific member object for the client.\n *\n * @see See {@link IServiceAudienceEvents} for usage details.\n * @public\n */\nexport type MemberChangedListener<M extends IMember> = (clientId: string, member: M) => void;\n\n/**\n * Events that trigger when the roster of members in the Fluid session change.\n *\n * @remarks\n *\n * Only changes that would be reflected in the returned map of {@link IServiceAudience}'s\n * {@link IServiceAudience.getMembers} method will emit events.\n *\n * @typeParam M - A service-specific {@link IMember} implementation.\n * @public\n */\nexport interface IServiceAudienceEvents<M extends IMember> extends IEvent {\n\t/**\n\t * Emitted when a {@link IMember | member}(s) are either added or removed.\n\t *\n\t * @eventProperty\n\t */\n\t(event: \"membersChanged\", listener: () => void): void;\n\n\t/**\n\t * Emitted when a {@link IMember | member} joins the audience.\n\t *\n\t * @eventProperty\n\t */\n\t(event: \"memberAdded\", listener: MemberChangedListener<M>): void;\n\n\t/**\n\t * Emitted when a {@link IMember | member} leaves the audience.\n\t *\n\t * @eventProperty\n\t */\n\t(event: \"memberRemoved\", listener: MemberChangedListener<M>): void;\n}\n\n/**\n * Base interface to be implemented to fetch each service's audience.\n *\n * @remarks\n *\n * The type parameter `M` allows consumers to further extend the client object with service-specific\n * details about the connecting client, such as device information, environment, or a username.\n *\n * @typeParam M - A service-specific {@link IMember} type.\n * @public\n */\nexport interface IServiceAudience<M extends IMember>\n\textends IEventProvider<IServiceAudienceEvents<M>> {\n\t/**\n\t * Returns an map of all users currently in the Fluid session where key is the userId and the value is the\n\t * member object. The implementation may choose to exclude certain connections from the returned map.\n\t * E.g. ServiceAudience excludes non-interactive connections to represent only the roster of live users.\n\t */\n\tgetMembers(): ReadonlyMap<string, M>;\n\n\t/**\n\t * Returns the current active user on this client once they are connected. Otherwise, returns undefined.\n\t */\n\tgetMyself(): Myself<M> | undefined;\n}\n\n/**\n * Base interface for information for each connection made to the Fluid session.\n *\n * @remarks This interface can be extended to provide additional information specific to each service.\n * @public\n */\nexport interface IConnection {\n\t/**\n\t * A unique ID for the connection. A single user may have multiple connections, each with a different ID.\n\t */\n\treadonly id: string;\n\n\t/**\n\t * Whether the connection is in read or read/write mode.\n\t */\n\treadonly mode: \"write\" | \"read\";\n}\n\n/**\n * Base interface to be implemented to fetch each service's member.\n *\n * @remarks This interface can be extended by each service to provide additional service-specific user metadata.\n * @public\n */\nexport interface IMember {\n\t/**\n\t * An ID for the user, unique among each individual user connecting to the session.\n\t */\n\treadonly id: string;\n\n\t/**\n\t * The set of connections the user has made, e.g. from multiple tabs or devices.\n\t */\n\treadonly connections: IConnection[];\n}\n\n/**\n * An extended member object that includes currentConnection\n * @public\n */\nexport type Myself<M extends IMember = IMember> = M & { readonly currentConnection: string };\n"]}
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;;GAGG","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport type { DataObjectKind } from \"@fluidframework/aqueduct/internal\";\nimport type { ContainerExtensionStore } from \"@fluidframework/container-runtime-definitions/internal\";\nimport type {\n\tIEvent,\n\tIEventProvider,\n\tIFluidHandle,\n\tIFluidLoadable,\n} from \"@fluidframework/core-interfaces\";\nimport type {\n\tISharedObjectKind,\n\tSharedObjectKind,\n} from \"@fluidframework/shared-object-base/internal\";\nimport type { ITree } from \"@fluidframework/tree\";\n\n/**\n * Determines the set of runtime options that Fluid Framework will use when running.\n * In \"1\" mode we support full interop between 2.x clients and 1.x clients,\n * while in \"2\" mode we only support interop between 2.x clients.\n *\n * @deprecated Specify the minimum Fluid Framework version directly via the\n * `minVersionForCollab` parameter, which accepts a\n * {@link @fluidframework/runtime-definitions#MinimumVersionForCollab} SemVer string. The\n * legacy mode \"1\" is equivalent to `minVersionForCollab: \"1.0.0\"`; mode \"2\" is\n * equivalent to `\"2.0.0\"`.\n *\n * @public\n */\nexport type CompatibilityMode = \"1\" | \"2\";\n\n/**\n * A mapping of string identifiers to instantiated `DataObject`s or `SharedObject`s.\n */\nexport type LoadableObjectRecord = Record<string, IFluidLoadable>;\n\n/**\n * A mapping of string identifiers to classes that will later be used to instantiate a corresponding `DataObject`\n * or `SharedObject`.\n */\nexport type LoadableObjectKindRecord = Record<string, SharedObjectKind>;\n\n/**\n * A kind of `DataObject` or `SharedObject`.\n *\n * @typeParam T - The kind of `DataObject` or `SharedObject`.\n *\n * @privateRemarks\n * There are some edge cases in TypeScript where the order of the members in a union matter.\n * Once such edge case is when multiple members of a generic union partially match, and the type parameter is being inferred.\n * In this case, its better to have the desired match and/or the simpler type first.\n * In this case placing ISharedObjectKind fixed one usage and didn't break anything, and generally seems more likely to work than the reverse, so this is the order being used.\n * This is likely (a bug in TypeScript)[https://github.com/microsoft/TypeScript/issues/45809].\n */\nexport type LoadableObjectKind<T extends IFluidLoadable = IFluidLoadable> =\n\t| ISharedObjectKind<T>\n\t| DataObjectKind<T>;\n\n/**\n * Represents properties that can be attached to a container.\n * @public\n */\nexport type ContainerAttachProps<T = unknown> = T;\n\n/**\n * Declares the Fluid objects that will be available in the {@link IFluidContainer | Container}.\n *\n * @remarks\n *\n * It includes both the instances of objects that are initially available upon `Container` creation, as well\n * as the types of objects that may be dynamically created throughout the lifetime of the `Container`.\n * @public\n */\nexport interface ContainerSchema {\n\t/**\n\t * Defines loadable objects that will be created when the {@link IFluidContainer | Container} is first created.\n\t *\n\t * @remarks It uses the key as the id and the value as the loadable object to create.\n\t *\n\t * @example\n\t *\n\t * In the example below two objects will be created when the `Container` is first\n\t * created. One with id \"map1\" that will return a `SharedMap` and the other with\n\t * id \"pair1\" that will return a `KeyValueDataObject`.\n\t *\n\t * ```typescript\n\t * {\n\t * map1: SharedMap,\n\t * pair1: KeyValueDataObject,\n\t * }\n\t * ```\n\t */\n\treadonly initialObjects: Record<string, SharedObjectKind>;\n\n\t/**\n\t * Loadable objects that can be created after the initial {@link IFluidContainer | Container} creation.\n\t *\n\t * @remarks\n\t *\n\t * Types defined in `initialObjects` will always be available and are not required to be provided here.\n\t *\n\t * For best practice it's recommended to define all the dynamic types you create even if they are\n\t * included via initialObjects.\n\t */\n\treadonly dynamicObjectTypes?: readonly SharedObjectKind[];\n}\n\n/**\n * Declares the Fluid objects that will be available in the {@link IFluidContainer | Container}.\n *\n * @remarks\n *\n * It includes both the kind of `SharedTree` that will be initially available upon `Container` creation, as well\n * as the types of objects that may be dynamically created throughout the lifetime of the `Container`.\n *\n * @legacy @beta\n */\nexport interface TreeContainerSchema extends ContainerSchema {\n\t// TODO: longer term, it would be better to not have to fit into the `initialObjects` model for tree-based containers.\n\t// But in the short term, fitting into this model makes migration easier.\n\treadonly initialObjects: {\n\t\treadonly tree: SharedObjectKind<ITree>;\n\t};\n}\n\n/**\n * Holds the collection of objects that the container was initially created with.\n * Additionally provides the ability to dynamically create further objects during usage.\n */\nexport interface IRootDataObject {\n\t/**\n\t * Dynamically creates a new detached collaborative object (DDS/DataObject).\n\t *\n\t * @param objectClass - Type of the collaborative object to be created.\n\t *\n\t * @typeParam T - The class of the `DataObject` or `SharedObject`.\n\t */\n\tcreate<T>(objectClass: SharedObjectKind<T>): Promise<T>;\n\n\t/**\n\t * Upload a blob of data.\n\t * Although it is marked as internal, there is external usage of this function for experimental purposes.\n\t * Please contact yunho-microsoft or vladsud if you need to change it.\n\t * @param blob - blob to be uploaded.\n\t *\n\t * @remarks This method is used to expose uploadBlob to the IFluidContainer level. UploadBlob will upload data to server side (as of now, ODSP only). There is no downloadBlob provided as it is not needed(blob lifetime managed by server).\n\t */\n\tuploadBlob(blob: ArrayBufferLike): Promise<IFluidHandle<ArrayBufferLike>>;\n\n\t/**\n\t * Provides a record of the initial objects defined on creation.\n\t */\n\treadonly initialObjects: LoadableObjectRecord;\n}\n\ninterface IProvideStaticEntryPoint {\n\treadonly IStaticEntryPoint: IStaticEntryPoint;\n}\n\n/**\n * This is the internal entry point fluid-static creates.\n */\nexport interface IStaticEntryPoint extends IProvideStaticEntryPoint {\n\treadonly rootDataObject: IRootDataObject;\n\treadonly extensionStore: ContainerExtensionStore;\n}\n\n/**\n * Signature for {@link IMember} change events.\n *\n * @param clientId - A unique identifier for the client.\n * @param member - The service-specific member object for the client.\n *\n * @see See {@link IServiceAudienceEvents} for usage details.\n * @public\n */\nexport type MemberChangedListener<M extends IMember> = (clientId: string, member: M) => void;\n\n/**\n * Events that trigger when the roster of members in the Fluid session change.\n *\n * @remarks\n *\n * Only changes that would be reflected in the returned map of {@link IServiceAudience}'s\n * {@link IServiceAudience.getMembers} method will emit events.\n *\n * @typeParam M - A service-specific {@link IMember} implementation.\n * @public\n */\nexport interface IServiceAudienceEvents<M extends IMember> extends IEvent {\n\t/**\n\t * Emitted when a {@link IMember | member}(s) are either added or removed.\n\t *\n\t * @eventProperty\n\t */\n\t(event: \"membersChanged\", listener: () => void): void;\n\n\t/**\n\t * Emitted when a {@link IMember | member} joins the audience.\n\t *\n\t * @eventProperty\n\t */\n\t(event: \"memberAdded\", listener: MemberChangedListener<M>): void;\n\n\t/**\n\t * Emitted when a {@link IMember | member} leaves the audience.\n\t *\n\t * @eventProperty\n\t */\n\t(event: \"memberRemoved\", listener: MemberChangedListener<M>): void;\n}\n\n/**\n * Base interface to be implemented to fetch each service's audience.\n *\n * @remarks\n *\n * The type parameter `M` allows consumers to further extend the client object with service-specific\n * details about the connecting client, such as device information, environment, or a username.\n *\n * @typeParam M - A service-specific {@link IMember} type.\n * @public\n */\nexport interface IServiceAudience<M extends IMember>\n\textends IEventProvider<IServiceAudienceEvents<M>> {\n\t/**\n\t * Returns an map of all users currently in the Fluid session where key is the userId and the value is the\n\t * member object. The implementation may choose to exclude certain connections from the returned map.\n\t * E.g. ServiceAudience excludes non-interactive connections to represent only the roster of live users.\n\t */\n\tgetMembers(): ReadonlyMap<string, M>;\n\n\t/**\n\t * Returns the current active user on this client once they are connected. Otherwise, returns undefined.\n\t */\n\tgetMyself(): Myself<M> | undefined;\n}\n\n/**\n * Base interface for information for each connection made to the Fluid session.\n *\n * @remarks This interface can be extended to provide additional information specific to each service.\n * @public\n */\nexport interface IConnection {\n\t/**\n\t * A unique ID for the connection. A single user may have multiple connections, each with a different ID.\n\t */\n\treadonly id: string;\n\n\t/**\n\t * Whether the connection is in read or read/write mode.\n\t */\n\treadonly mode: \"write\" | \"read\";\n}\n\n/**\n * Base interface to be implemented to fetch each service's member.\n *\n * @remarks This interface can be extended by each service to provide additional service-specific user metadata.\n * @public\n */\nexport interface IMember {\n\t/**\n\t * An ID for the user, unique among each individual user connecting to the session.\n\t */\n\treadonly id: string;\n\n\t/**\n\t * The set of connections the user has made, e.g. from multiple tabs or devices.\n\t */\n\treadonly connections: IConnection[];\n}\n\n/**\n * An extended member object that includes currentConnection\n * @public\n */\nexport type Myself<M extends IMember = IMember> = M & { readonly currentConnection: string };\n"]}
|
package/lib/utils.d.ts
CHANGED
|
@@ -5,9 +5,9 @@
|
|
|
5
5
|
import type { DataObjectKind } from "@fluidframework/aqueduct/internal";
|
|
6
6
|
import type { FluidObjectKeys, IFluidLoadable } from "@fluidframework/core-interfaces";
|
|
7
7
|
import type { IChannelFactory, IFluidDataStoreRuntime } from "@fluidframework/datastore-definitions/internal";
|
|
8
|
-
import type { IFluidDataStoreContext, NamedFluidDataStoreRegistryEntry } from "@fluidframework/runtime-definitions/internal";
|
|
8
|
+
import type { IFluidDataStoreContext, MinimumVersionForCollab, NamedFluidDataStoreRegistryEntry } from "@fluidframework/runtime-definitions/internal";
|
|
9
9
|
import type { ISharedObjectKind } from "@fluidframework/shared-object-base/internal";
|
|
10
|
-
import type { ContainerSchema, LoadableObjectKind, TreeContainerSchema } from "./types.js";
|
|
10
|
+
import type { CompatibilityMode, ContainerSchema, LoadableObjectKind, TreeContainerSchema } from "./types.js";
|
|
11
11
|
/**
|
|
12
12
|
* Runtime check to determine if an object is a {@link DataObjectKind}.
|
|
13
13
|
*/
|
|
@@ -40,12 +40,15 @@ export declare function createSharedObject<T extends IFluidLoadable>(sharedObjec
|
|
|
40
40
|
*/
|
|
41
41
|
export declare function makeFluidObject<T extends object, K extends FluidObjectKeys<T> = FluidObjectKeys<T>>(object: Omit<T, K>, providerKey: K): T;
|
|
42
42
|
/**
|
|
43
|
-
*
|
|
43
|
+
* Resolves the `compatibilityMode` input — either a `MinimumVersionForCollab`
|
|
44
|
+
* SemVer string or a legacy `CompatibilityMode` value — into a precise
|
|
45
|
+
* `MinimumVersionForCollab`.
|
|
46
|
+
*
|
|
47
|
+
* TODO: AB#73679: This can be removed when the deprecated CompatibilityMode is removed
|
|
48
|
+
*
|
|
49
|
+
* @internal
|
|
44
50
|
*/
|
|
45
|
-
export declare
|
|
46
|
-
readonly "1": "1.0.0";
|
|
47
|
-
readonly "2": "2.0.0";
|
|
48
|
-
};
|
|
51
|
+
export declare function resolveCompatibilityModeToMinVersionForCollab(compatibilityMode: MinimumVersionForCollab | CompatibilityMode): MinimumVersionForCollab;
|
|
49
52
|
/**
|
|
50
53
|
* Determines if the provided schema is a valid tree-based container schema.
|
|
51
54
|
* @internal
|
package/lib/utils.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,mCAAmC,CAAC;AACxE,OAAO,KAAK,EAAE,eAAe,EAAE,cAAc,EAAE,MAAM,iCAAiC,CAAC;AAEvF,OAAO,KAAK,EACX,eAAe,EACf,sBAAsB,EACtB,MAAM,gDAAgD,CAAC;AACxD,OAAO,KAAK,EACX,sBAAsB,
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,mCAAmC,CAAC;AACxE,OAAO,KAAK,EAAE,eAAe,EAAE,cAAc,EAAE,MAAM,iCAAiC,CAAC;AAEvF,OAAO,KAAK,EACX,eAAe,EACf,sBAAsB,EACtB,MAAM,gDAAgD,CAAC;AACxD,OAAO,KAAK,EACX,sBAAsB,EACtB,uBAAuB,EACvB,gCAAgC,EAChC,MAAM,8CAA8C,CAAC;AACtD,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,6CAA6C,CAAC;AAIrF,OA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;AAED;;;GAGG;AACH,wBAAgB,qBAAqB,CAAC,MAAM,EAAE,eAAe,GAAG,MAAM,IAAI,mBAAmB,CAqB5F"}
|
package/lib/utils.js
CHANGED
|
@@ -84,12 +84,23 @@ export function makeFluidObject(object, providerKey) {
|
|
|
84
84
|
return Object.defineProperty(object, providerKey, { value: object });
|
|
85
85
|
}
|
|
86
86
|
/**
|
|
87
|
-
*
|
|
87
|
+
* Resolves the `compatibilityMode` input — either a `MinimumVersionForCollab`
|
|
88
|
+
* SemVer string or a legacy `CompatibilityMode` value — into a precise
|
|
89
|
+
* `MinimumVersionForCollab`.
|
|
90
|
+
*
|
|
91
|
+
* TODO: AB#73679: This can be removed when the deprecated CompatibilityMode is removed
|
|
92
|
+
*
|
|
93
|
+
* @internal
|
|
88
94
|
*/
|
|
89
|
-
export
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
95
|
+
export function resolveCompatibilityModeToMinVersionForCollab(
|
|
96
|
+
// eslint-disable-next-line import-x/no-deprecated
|
|
97
|
+
compatibilityMode) {
|
|
98
|
+
return compatibilityMode === "1"
|
|
99
|
+
? "1.0.0"
|
|
100
|
+
: compatibilityMode === "2"
|
|
101
|
+
? "2.0.0"
|
|
102
|
+
: compatibilityMode;
|
|
103
|
+
}
|
|
93
104
|
/**
|
|
94
105
|
* Determines if the provided schema is a valid tree-based container schema.
|
|
95
106
|
* @internal
|
package/lib/utils.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAIH,OAAO,EAAE,GAAG,EAAE,MAAM,qCAAqC,CAAC;AAW1D,OAAO,EAAE,UAAU,EAAE,MAAM,0CAA0C,CAAC;AACtE,OAAO,EAAE,qBAAqB,EAAE,MAAM,+BAA+B,CAAC;
|
|
1
|
+
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":"AAAA;;;GAGG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Licensed under the MIT License.\n */\n\nimport type { DataObjectKind } from \"@fluidframework/aqueduct/internal\";\nimport type { FluidObjectKeys, IFluidLoadable } from \"@fluidframework/core-interfaces\";\nimport { oob } from \"@fluidframework/core-utils/internal\";\nimport type {\n\tIChannelFactory,\n\tIFluidDataStoreRuntime,\n} from \"@fluidframework/datastore-definitions/internal\";\nimport type {\n\tIFluidDataStoreContext,\n\tMinimumVersionForCollab,\n\tNamedFluidDataStoreRegistryEntry,\n} from \"@fluidframework/runtime-definitions/internal\";\nimport type { ISharedObjectKind } from \"@fluidframework/shared-object-base/internal\";\nimport { UsageError } from \"@fluidframework/telemetry-utils/internal\";\nimport { SharedTreeFactoryType } from \"@fluidframework/tree/internal\";\n\nimport type {\n\t// eslint-disable-next-line import-x/no-deprecated\n\tCompatibilityMode,\n\tContainerSchema,\n\tLoadableObjectKind,\n\tTreeContainerSchema,\n} from \"./types.js\";\n\n/**\n * Runtime check to determine if an object is a {@link DataObjectKind}.\n */\nexport function isDataObjectKind<T extends IFluidLoadable>(\n\tobj: LoadableObjectKind<T>,\n): obj is DataObjectKind<T>;\n\n/**\n * Runtime check to determine if an object is a {@link DataObjectKind}.\n */\nexport function isDataObjectKind(\n\tobj: LoadableObjectKind,\n): obj is DataObjectKind<IFluidLoadable>;\n\n/**\n * Runtime check to determine if an object is a {@link DataObjectKind}.\n */\nexport function isDataObjectKind(\n\tobj: LoadableObjectKind,\n): obj is DataObjectKind<IFluidLoadable> {\n\tconst maybe = obj as Partial<DataObjectKind<IFluidLoadable>> | undefined;\n\tconst isDataObject =\n\t\tmaybe?.factory?.IFluidDataStoreFactory !== undefined &&\n\t\tmaybe.factory.IFluidDataStoreFactory === maybe.factory;\n\n\tif (\n\t\tisDataObject ===\n\t\t((obj as Partial<ISharedObjectKind<IFluidLoadable>>).getFactory !== undefined)\n\t) {\n\t\t// TODO: Currently nothing in the types or docs requires an actual DataObjectClass to not have a member called \"getFactory\" so there is a risk of this being a false positive.\n\t\t// Refactoring the use of LoadableObjectClass such that explicit down casting is not required (for example by having a single factory API shared by both cases) could avoid problems like this.\n\t\tthrow new UsageError(\"Invalid LoadableObjectClass\");\n\t}\n\n\treturn isDataObject;\n}\n\n/**\n * Runtime check to determine if a class is a SharedObject type\n */\nexport function isSharedObjectKind(\n\tobj: LoadableObjectKind,\n): obj is ISharedObjectKind<IFluidLoadable> {\n\treturn !isDataObjectKind(obj);\n}\n\n/**\n * The ContainerSchema consists of initialObjects and dynamicObjectTypes. These types can be\n * of both SharedObject or DataObject. This function separates the two and returns a registry\n * of DataObject types and an array of SharedObjects.\n */\nexport const parseDataObjectsFromSharedObjects = (\n\tschema: ContainerSchema,\n): [NamedFluidDataStoreRegistryEntry[], IChannelFactory[]] => {\n\tconst registryEntries = new Set<NamedFluidDataStoreRegistryEntry>();\n\tconst sharedObjects = new Set<IChannelFactory>();\n\n\tconst tryAddObject = (obj: LoadableObjectKind): void => {\n\t\tif (isSharedObjectKind(obj)) {\n\t\t\tsharedObjects.add(obj.getFactory());\n\t\t} else if (isDataObjectKind(obj)) {\n\t\t\tregistryEntries.add([obj.factory.type, Promise.resolve(obj.factory)]);\n\t\t} else {\n\t\t\tthrow new Error(`Entry is neither a DataObject or a SharedObject`);\n\t\t}\n\t};\n\n\t// Add the object types that will be initialized\n\tconst dedupedObjects = new Set([\n\t\t...Object.values(schema.initialObjects),\n\t\t...(schema.dynamicObjectTypes ?? []),\n\t]);\n\tfor (const obj of dedupedObjects) {\n\t\ttryAddObject(obj as unknown as LoadableObjectKind);\n\t}\n\n\tif (registryEntries.size === 0 && sharedObjects.size === 0) {\n\t\tthrow new Error(\"Container cannot be initialized without any DataTypes\");\n\t}\n\n\treturn [[...registryEntries], [...sharedObjects]];\n};\n\n/**\n * Creates a new data object of the specified type.\n */\nexport async function createDataObject<T extends IFluidLoadable>(\n\tdataObjectClass: DataObjectKind<T>,\n\tcontext: IFluidDataStoreContext,\n): Promise<T> {\n\tconst factory = dataObjectClass.factory;\n\tconst packagePath = [...context.packagePath, factory.type];\n\tconst dataStore = await context.containerRuntime.createDataStore(packagePath);\n\tconst entryPoint = await dataStore.entryPoint.get();\n\treturn entryPoint as T;\n}\n\n/**\n * Creates a new shared object of the specified type.\n */\nexport function createSharedObject<T extends IFluidLoadable>(\n\tsharedObjectClass: ISharedObjectKind<T>,\n\truntime: IFluidDataStoreRuntime,\n): T {\n\tconst factory = sharedObjectClass.getFactory();\n\tconst obj = runtime.createChannel(undefined, factory.type);\n\treturn obj as unknown as T;\n}\n\n/**\n * Creates a Fluid object that has a property with the key `providerKey` that points to itself.\n * @remarks This is useful for creating objects that need to reference themselves, such as DataObjects.\n */\nexport function makeFluidObject<\n\tT extends object,\n\tK extends FluidObjectKeys<T> = FluidObjectKeys<T>,\n>(object: Omit<T, K>, providerKey: K): T {\n\treturn Object.defineProperty(object, providerKey, { value: object }) as T;\n}\n\n/**\n * Resolves the `compatibilityMode` input — either a `MinimumVersionForCollab`\n * SemVer string or a legacy `CompatibilityMode` value — into a precise\n * `MinimumVersionForCollab`.\n *\n * TODO: AB#73679: This can be removed when the deprecated CompatibilityMode is removed\n *\n * @internal\n */\nexport function resolveCompatibilityModeToMinVersionForCollab(\n\t// eslint-disable-next-line import-x/no-deprecated\n\tcompatibilityMode: MinimumVersionForCollab | CompatibilityMode,\n): MinimumVersionForCollab {\n\treturn compatibilityMode === \"1\"\n\t\t? \"1.0.0\"\n\t\t: compatibilityMode === \"2\"\n\t\t\t? \"2.0.0\"\n\t\t\t: compatibilityMode;\n}\n\n/**\n * Determines if the provided schema is a valid tree-based container schema.\n * @internal\n */\nexport function isTreeContainerSchema(schema: ContainerSchema): schema is TreeContainerSchema {\n\tconst schemaEntries = Object.entries(schema.initialObjects);\n\tif (schemaEntries.length !== 1) {\n\t\treturn false;\n\t}\n\n\tconst entry = schemaEntries[0] ?? oob();\n\tconst key = entry[0];\n\tif (key !== \"tree\") {\n\t\treturn false;\n\t}\n\n\tconst objectKind = entry[1] as unknown as LoadableObjectKind;\n\tif (\n\t\tisSharedObjectKind(objectKind) &&\n\t\tobjectKind.getFactory().type === SharedTreeFactoryType\n\t) {\n\t\treturn true;\n\t}\n\n\treturn false;\n}\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fluidframework/fluid-static",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.102.0",
|
|
4
4
|
"description": "A tool to enable consumption of Fluid Data Objects without requiring custom container code.",
|
|
5
5
|
"homepage": "https://fluidframework.com",
|
|
6
6
|
"repository": {
|
|
@@ -79,36 +79,37 @@
|
|
|
79
79
|
"temp-directory": "nyc/.nyc_output"
|
|
80
80
|
},
|
|
81
81
|
"dependencies": {
|
|
82
|
-
"@fluid-internal/client-utils": "~2.
|
|
83
|
-
"@fluid-internal/presence-definitions": "~2.
|
|
84
|
-
"@fluid-internal/presence-runtime": "~2.
|
|
85
|
-
"@fluidframework/aqueduct": "~2.
|
|
86
|
-
"@fluidframework/container-definitions": "~2.
|
|
87
|
-
"@fluidframework/container-loader": "~2.
|
|
88
|
-
"@fluidframework/container-runtime": "~2.
|
|
89
|
-
"@fluidframework/container-runtime-definitions": "~2.
|
|
90
|
-
"@fluidframework/core-interfaces": "~2.
|
|
91
|
-
"@fluidframework/core-utils": "~2.
|
|
92
|
-
"@fluidframework/datastore-definitions": "~2.
|
|
93
|
-
"@fluidframework/driver-definitions": "~2.
|
|
94
|
-
"@fluidframework/request-handler": "~2.
|
|
95
|
-
"@fluidframework/runtime-definitions": "~2.
|
|
96
|
-
"@fluidframework/runtime-utils": "~2.
|
|
97
|
-
"@fluidframework/shared-object-base": "~2.
|
|
98
|
-
"@fluidframework/telemetry-utils": "~2.
|
|
99
|
-
"@fluidframework/tree": "~2.
|
|
82
|
+
"@fluid-internal/client-utils": "~2.102.0",
|
|
83
|
+
"@fluid-internal/presence-definitions": "~2.102.0",
|
|
84
|
+
"@fluid-internal/presence-runtime": "~2.102.0",
|
|
85
|
+
"@fluidframework/aqueduct": "~2.102.0",
|
|
86
|
+
"@fluidframework/container-definitions": "~2.102.0",
|
|
87
|
+
"@fluidframework/container-loader": "~2.102.0",
|
|
88
|
+
"@fluidframework/container-runtime": "~2.102.0",
|
|
89
|
+
"@fluidframework/container-runtime-definitions": "~2.102.0",
|
|
90
|
+
"@fluidframework/core-interfaces": "~2.102.0",
|
|
91
|
+
"@fluidframework/core-utils": "~2.102.0",
|
|
92
|
+
"@fluidframework/datastore-definitions": "~2.102.0",
|
|
93
|
+
"@fluidframework/driver-definitions": "~2.102.0",
|
|
94
|
+
"@fluidframework/request-handler": "~2.102.0",
|
|
95
|
+
"@fluidframework/runtime-definitions": "~2.102.0",
|
|
96
|
+
"@fluidframework/runtime-utils": "~2.102.0",
|
|
97
|
+
"@fluidframework/shared-object-base": "~2.102.0",
|
|
98
|
+
"@fluidframework/telemetry-utils": "~2.102.0",
|
|
99
|
+
"@fluidframework/tree": "~2.102.0",
|
|
100
|
+
"semver-ts": "^1.0.3"
|
|
100
101
|
},
|
|
101
102
|
"devDependencies": {
|
|
102
103
|
"@arethetypeswrong/cli": "^0.18.2",
|
|
103
104
|
"@biomejs/biome": "~2.4.5",
|
|
104
|
-
"@fluid-internal/mocha-test-setup": "~2.
|
|
105
|
+
"@fluid-internal/mocha-test-setup": "~2.102.0",
|
|
105
106
|
"@fluid-tools/build-cli": "^0.65.0",
|
|
106
107
|
"@fluidframework/build-common": "^2.0.3",
|
|
107
108
|
"@fluidframework/build-tools": "^0.65.0",
|
|
108
109
|
"@fluidframework/eslint-config-fluid": "^9.0.0",
|
|
109
|
-
"@fluidframework/fluid-static-previous": "npm:@fluidframework/fluid-static@2.
|
|
110
|
-
"@fluidframework/map": "~2.
|
|
111
|
-
"@fluidframework/sequence": "~2.
|
|
110
|
+
"@fluidframework/fluid-static-previous": "npm:@fluidframework/fluid-static@2.101.0",
|
|
111
|
+
"@fluidframework/map": "~2.102.0",
|
|
112
|
+
"@fluidframework/sequence": "~2.102.0",
|
|
112
113
|
"@microsoft/api-extractor": "7.58.1",
|
|
113
114
|
"@types/mocha": "^10.0.10",
|
|
114
115
|
"@types/node": "~22.19.17",
|
|
@@ -4,19 +4,20 @@
|
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
6
|
import type { IContainerRuntimeOptionsInternal } from "@fluidframework/container-runtime/internal";
|
|
7
|
-
|
|
8
|
-
import
|
|
7
|
+
import type { MinimumVersionForCollab } from "@fluidframework/runtime-definitions/internal";
|
|
8
|
+
import { gte } from "semver-ts";
|
|
9
9
|
|
|
10
10
|
/**
|
|
11
|
-
*
|
|
12
|
-
* full interop with true 1.x clients, while in "2" mode we only support interop with 2.x clients.
|
|
11
|
+
* Fluid-static-specific runtime option overrides keyed by `minVersionForCollab`.
|
|
13
12
|
*
|
|
14
|
-
* @
|
|
15
|
-
*
|
|
16
|
-
*
|
|
13
|
+
* @remarks
|
|
14
|
+
* These are layered on top of the runtime defaults that container-runtime selects from
|
|
15
|
+
* `minVersionForCollab` (via `getMinVersionForCollabDefaults`). Only options that
|
|
16
|
+
* fluid-static needs to set differently from those defaults belong here
|
|
17
|
+
* (e.g. enableRuntimeIdCompressor to support SharedTree).
|
|
17
18
|
*/
|
|
18
|
-
|
|
19
|
-
|
|
19
|
+
const minVersionForCollabToDefaultRuntimeOptions: Record<
|
|
20
|
+
"1" | "2",
|
|
20
21
|
IContainerRuntimeOptionsInternal
|
|
21
22
|
> = {
|
|
22
23
|
"1": {},
|
|
@@ -27,3 +28,20 @@ export const compatibilityModeRuntimeOptions: Record<
|
|
|
27
28
|
enableRuntimeIdCompressor: "on",
|
|
28
29
|
},
|
|
29
30
|
};
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* Returns the fluid-static-specific runtime option overrides for the given `minVersionForCollab`.
|
|
34
|
+
*
|
|
35
|
+
* @remarks
|
|
36
|
+
* The bulk of runtime defaults for a given `minVersionForCollab` are selected by container-runtime
|
|
37
|
+
* (via `getMinVersionForCollabDefaults`). This function only contributes the additional overrides
|
|
38
|
+
* that fluid-static needs to layer on top of those defaults.
|
|
39
|
+
* @internal
|
|
40
|
+
*/
|
|
41
|
+
export function defaultRuntimeOptionsForMinVersion(
|
|
42
|
+
minVersionForCollab: MinimumVersionForCollab,
|
|
43
|
+
): IContainerRuntimeOptionsInternal {
|
|
44
|
+
return minVersionForCollabToDefaultRuntimeOptions[
|
|
45
|
+
gte(minVersionForCollab, "2.0.0") ? "2" : "1"
|
|
46
|
+
];
|
|
47
|
+
}
|
package/src/index.ts
CHANGED
package/src/rootDataObject.ts
CHANGED
|
@@ -31,9 +31,8 @@ import type {
|
|
|
31
31
|
} from "@fluidframework/runtime-definitions/internal";
|
|
32
32
|
import type { SharedObjectKind } from "@fluidframework/shared-object-base/internal";
|
|
33
33
|
|
|
34
|
-
import {
|
|
34
|
+
import { defaultRuntimeOptionsForMinVersion } from "./compatibilityConfiguration.js";
|
|
35
35
|
import type {
|
|
36
|
-
CompatibilityMode,
|
|
37
36
|
ContainerSchema,
|
|
38
37
|
IRootDataObject,
|
|
39
38
|
IStaticEntryPoint,
|
|
@@ -42,7 +41,6 @@ import type {
|
|
|
42
41
|
LoadableObjectRecord,
|
|
43
42
|
} from "./types.js";
|
|
44
43
|
import {
|
|
45
|
-
compatibilityModeToMinVersionForCollab,
|
|
46
44
|
createDataObject,
|
|
47
45
|
createSharedObject,
|
|
48
46
|
isDataObjectKind,
|
|
@@ -196,9 +194,10 @@ export function createDOProviderContainerRuntimeFactory(props: {
|
|
|
196
194
|
*/
|
|
197
195
|
schema: ContainerSchema;
|
|
198
196
|
/**
|
|
199
|
-
*
|
|
197
|
+
* Minimum Fluid Framework version required for collaboration as a
|
|
198
|
+
* {@link @fluidframework/runtime-definitions#MinimumVersionForCollab} SemVer string.
|
|
200
199
|
*/
|
|
201
|
-
|
|
200
|
+
minVersionForCollaboration: MinimumVersionForCollab;
|
|
202
201
|
/**
|
|
203
202
|
* Optional registry of data stores to pass to the DataObject factory.
|
|
204
203
|
* If not provided, one will be created based on the schema.
|
|
@@ -206,34 +205,21 @@ export function createDOProviderContainerRuntimeFactory(props: {
|
|
|
206
205
|
rootDataStoreRegistry?: IFluidDataStoreRegistry;
|
|
207
206
|
/**
|
|
208
207
|
* Optional overrides for the container runtime options.
|
|
209
|
-
* If not provided, only the default options for the given
|
|
208
|
+
* If not provided, only the default options for the given minVersionForCollaboration will be used.
|
|
210
209
|
*/
|
|
211
210
|
runtimeOptionOverrides?: Partial<IContainerRuntimeOptions>;
|
|
212
|
-
/**
|
|
213
|
-
* Optional override for minimum version for collab.
|
|
214
|
-
* If not provided, the default for the given compatibilityMode will be used.
|
|
215
|
-
* @remarks
|
|
216
|
-
* This is useful when runtime options are overridden and change the minimum version for collab.
|
|
217
|
-
*/
|
|
218
|
-
minVersionForCollabOverride?: MinimumVersionForCollab;
|
|
219
211
|
}): IRuntimeFactory {
|
|
220
|
-
const {
|
|
221
|
-
|
|
222
|
-
minVersionForCollabOverride,
|
|
223
|
-
rootDataStoreRegistry,
|
|
224
|
-
runtimeOptionOverrides,
|
|
225
|
-
schema,
|
|
226
|
-
} = props;
|
|
212
|
+
const { rootDataStoreRegistry, runtimeOptionOverrides, schema } = props;
|
|
213
|
+
const minVersionForCollab = props.minVersionForCollaboration;
|
|
227
214
|
const [registryEntries, sharedObjects] = parseDataObjectsFromSharedObjects(schema);
|
|
228
215
|
const registry = rootDataStoreRegistry ?? new FluidDataStoreRegistry(registryEntries);
|
|
229
216
|
|
|
230
217
|
return new DOProviderContainerRuntimeFactory(
|
|
231
218
|
schema,
|
|
232
|
-
compatibilityMode,
|
|
233
219
|
new RootDataObjectFactory(sharedObjects, registry),
|
|
234
220
|
{
|
|
235
221
|
runtimeOptions: runtimeOptionOverrides,
|
|
236
|
-
minVersionForCollab
|
|
222
|
+
minVersionForCollab,
|
|
237
223
|
},
|
|
238
224
|
);
|
|
239
225
|
}
|
|
@@ -263,31 +249,28 @@ class DOProviderContainerRuntimeFactory extends BaseContainerRuntimeFactory {
|
|
|
263
249
|
* since it can take care of constructing the root data object factory based on the schema.
|
|
264
250
|
*
|
|
265
251
|
* @param schema - The schema for the container
|
|
266
|
-
* @param compatibilityMode - Compatibility mode
|
|
267
252
|
* @param rootDataObjectFactory - A factory that can construct the root data object.
|
|
253
|
+
* @param config - Resolved minimum version for collaboration (required) and optional runtime option overrides.
|
|
268
254
|
*/
|
|
269
255
|
public constructor(
|
|
270
256
|
schema: ContainerSchema,
|
|
271
|
-
compatibilityMode: CompatibilityMode,
|
|
272
257
|
rootDataObjectFactory: DataObjectFactory<
|
|
273
258
|
RootDataObject,
|
|
274
259
|
{ InitialState: RootDataObjectProps }
|
|
275
260
|
>,
|
|
276
|
-
|
|
277
|
-
runtimeOptions: Partial<IContainerRuntimeOptions>;
|
|
261
|
+
config: {
|
|
278
262
|
minVersionForCollab: MinimumVersionForCollab;
|
|
279
|
-
|
|
263
|
+
runtimeOptions?: Partial<IContainerRuntimeOptions>;
|
|
264
|
+
},
|
|
280
265
|
) {
|
|
281
266
|
super({
|
|
282
267
|
registryEntries: [rootDataObjectFactory.registryEntry],
|
|
283
268
|
runtimeOptions: {
|
|
284
|
-
...
|
|
285
|
-
...
|
|
269
|
+
...defaultRuntimeOptionsForMinVersion(config.minVersionForCollab),
|
|
270
|
+
...config.runtimeOptions,
|
|
286
271
|
},
|
|
287
272
|
provideEntryPoint,
|
|
288
|
-
minVersionForCollab:
|
|
289
|
-
overrides?.minVersionForCollab ??
|
|
290
|
-
compatibilityModeToMinVersionForCollab[compatibilityMode],
|
|
273
|
+
minVersionForCollab: config.minVersionForCollab,
|
|
291
274
|
});
|
|
292
275
|
this.rootDataObjectFactory = rootDataObjectFactory;
|
|
293
276
|
this.initialObjects = schema.initialObjects;
|