@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
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,15 @@
|
|
|
1
1
|
# @fluidframework/fluid-static
|
|
2
2
|
|
|
3
|
+
## 2.102.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- createTreeContainerRuntimeFactory accepts a MinimumVersionForCollab SemVer and deprecates compatibilityMode with minVersionForCollabOverride ([#27212](https://github.com/microsoft/FluidFramework/pull/27212)) [3e951b4abf](https://github.com/microsoft/FluidFramework/commit/3e951b4abfc61ea78a3e3e4a891e34e374c76efb)
|
|
8
|
+
|
|
9
|
+
A `minVersionForCollaboration` property on `createTreeContainerRuntimeFactory` accepts a [`MinimumVersionForCollab`](https://fluidframework.com/docs/api/runtime-definitions/minimumversionforcollab-typealias) SemVer string and replaces `compatibilityMode` ([`CompatibilityMode`](https://fluidframework.com/docs/api/fluid-static/compatibilitymode-typealias) values `"1"` and `"2"`) with optional `minVersionForCollabOverride`.
|
|
10
|
+
|
|
11
|
+
See [issue #27356](https://github.com/microsoft/FluidFramework/issues/27356) for migration details and removal tracking.
|
|
12
|
+
|
|
3
13
|
## 2.101.0
|
|
4
14
|
|
|
5
15
|
Dependency updates only.
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
```ts
|
|
6
6
|
|
|
7
|
-
// @public
|
|
7
|
+
// @public @deprecated
|
|
8
8
|
export type CompatibilityMode = "1" | "2";
|
|
9
9
|
|
|
10
10
|
// @public
|
|
@@ -17,6 +17,14 @@ export interface ContainerSchema {
|
|
|
17
17
|
}
|
|
18
18
|
|
|
19
19
|
// @beta @legacy
|
|
20
|
+
export function createTreeContainerRuntimeFactory(props: {
|
|
21
|
+
readonly schema: TreeContainerSchema;
|
|
22
|
+
readonly minVersionForCollaboration: MinimumVersionForCollab;
|
|
23
|
+
readonly rootDataStoreRegistry?: IFluidDataStoreRegistry;
|
|
24
|
+
readonly runtimeOptionOverrides?: Partial<IContainerRuntimeOptions>;
|
|
25
|
+
}): IRuntimeFactory;
|
|
26
|
+
|
|
27
|
+
// @beta @deprecated @legacy
|
|
20
28
|
export function createTreeContainerRuntimeFactory(props: {
|
|
21
29
|
readonly schema: TreeContainerSchema;
|
|
22
30
|
readonly compatibilityMode: CompatibilityMode;
|
|
@@ -3,14 +3,15 @@
|
|
|
3
3
|
* Licensed under the MIT License.
|
|
4
4
|
*/
|
|
5
5
|
import type { IContainerRuntimeOptionsInternal } from "@fluidframework/container-runtime/internal";
|
|
6
|
-
import type {
|
|
6
|
+
import type { MinimumVersionForCollab } from "@fluidframework/runtime-definitions/internal";
|
|
7
7
|
/**
|
|
8
|
-
*
|
|
9
|
-
* full interop with true 1.x clients, while in "2" mode we only support interop with 2.x clients.
|
|
8
|
+
* Returns the fluid-static-specific runtime option overrides for the given `minVersionForCollab`.
|
|
10
9
|
*
|
|
11
|
-
* @
|
|
12
|
-
*
|
|
13
|
-
*
|
|
10
|
+
* @remarks
|
|
11
|
+
* The bulk of runtime defaults for a given `minVersionForCollab` are selected by container-runtime
|
|
12
|
+
* (via `getMinVersionForCollabDefaults`). This function only contributes the additional overrides
|
|
13
|
+
* that fluid-static needs to layer on top of those defaults.
|
|
14
|
+
* @internal
|
|
14
15
|
*/
|
|
15
|
-
export declare
|
|
16
|
+
export declare function defaultRuntimeOptionsForMinVersion(minVersionForCollab: MinimumVersionForCollab): IContainerRuntimeOptionsInternal;
|
|
16
17
|
//# sourceMappingURL=compatibilityConfiguration.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"compatibilityConfiguration.d.ts","sourceRoot":"","sources":["../src/compatibilityConfiguration.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,gCAAgC,EAAE,MAAM,4CAA4C,CAAC;
|
|
1
|
+
{"version":3,"file":"compatibilityConfiguration.d.ts","sourceRoot":"","sources":["../src/compatibilityConfiguration.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,gCAAgC,EAAE,MAAM,4CAA4C,CAAC;AACnG,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,8CAA8C,CAAC;AAyB5F;;;;;;;;GAQG;AACH,wBAAgB,kCAAkC,CACjD,mBAAmB,EAAE,uBAAuB,GAC1C,gCAAgC,CAIlC"}
|
|
@@ -4,16 +4,18 @@
|
|
|
4
4
|
* Licensed under the MIT License.
|
|
5
5
|
*/
|
|
6
6
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
-
exports.
|
|
7
|
+
exports.defaultRuntimeOptionsForMinVersion = void 0;
|
|
8
|
+
const semver_ts_1 = require("semver-ts");
|
|
8
9
|
/**
|
|
9
|
-
*
|
|
10
|
-
* full interop with true 1.x clients, while in "2" mode we only support interop with 2.x clients.
|
|
10
|
+
* Fluid-static-specific runtime option overrides keyed by `minVersionForCollab`.
|
|
11
11
|
*
|
|
12
|
-
* @
|
|
13
|
-
*
|
|
14
|
-
*
|
|
12
|
+
* @remarks
|
|
13
|
+
* These are layered on top of the runtime defaults that container-runtime selects from
|
|
14
|
+
* `minVersionForCollab` (via `getMinVersionForCollabDefaults`). Only options that
|
|
15
|
+
* fluid-static needs to set differently from those defaults belong here
|
|
16
|
+
* (e.g. enableRuntimeIdCompressor to support SharedTree).
|
|
15
17
|
*/
|
|
16
|
-
|
|
18
|
+
const minVersionForCollabToDefaultRuntimeOptions = {
|
|
17
19
|
"1": {},
|
|
18
20
|
"2": {
|
|
19
21
|
// The runtime ID compressor is a prerequisite to use SharedTree but is off by default and must be explicitly enabled.
|
|
@@ -22,4 +24,17 @@ exports.compatibilityModeRuntimeOptions = {
|
|
|
22
24
|
enableRuntimeIdCompressor: "on",
|
|
23
25
|
},
|
|
24
26
|
};
|
|
27
|
+
/**
|
|
28
|
+
* Returns the fluid-static-specific runtime option overrides for the given `minVersionForCollab`.
|
|
29
|
+
*
|
|
30
|
+
* @remarks
|
|
31
|
+
* The bulk of runtime defaults for a given `minVersionForCollab` are selected by container-runtime
|
|
32
|
+
* (via `getMinVersionForCollabDefaults`). This function only contributes the additional overrides
|
|
33
|
+
* that fluid-static needs to layer on top of those defaults.
|
|
34
|
+
* @internal
|
|
35
|
+
*/
|
|
36
|
+
function defaultRuntimeOptionsForMinVersion(minVersionForCollab) {
|
|
37
|
+
return minVersionForCollabToDefaultRuntimeOptions[(0, semver_ts_1.gte)(minVersionForCollab, "2.0.0") ? "2" : "1"];
|
|
38
|
+
}
|
|
39
|
+
exports.defaultRuntimeOptionsForMinVersion = defaultRuntimeOptionsForMinVersion;
|
|
25
40
|
//# sourceMappingURL=compatibilityConfiguration.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"compatibilityConfiguration.js","sourceRoot":"","sources":["../src/compatibilityConfiguration.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;
|
|
1
|
+
{"version":3,"file":"compatibilityConfiguration.js","sourceRoot":"","sources":["../src/compatibilityConfiguration.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAIH,yCAAgC;AAEhC;;;;;;;;GAQG;AACH,MAAM,0CAA0C,GAG5C;IACH,GAAG,EAAE,EAAE;IACP,GAAG,EAAE;QACJ,sHAAsH;QACtH,oHAAoH;QACpH,gGAAgG;QAChG,yBAAyB,EAAE,IAAI;KAC/B;CACD,CAAC;AAEF;;;;;;;;GAQG;AACH,SAAgB,kCAAkC,CACjD,mBAA4C;IAE5C,OAAO,0CAA0C,CAChD,IAAA,eAAG,EAAC,mBAAmB,EAAE,OAAO,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,CAC7C,CAAC;AACH,CAAC;AAND,gFAMC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport type { IContainerRuntimeOptionsInternal } from \"@fluidframework/container-runtime/internal\";\nimport type { MinimumVersionForCollab } from \"@fluidframework/runtime-definitions/internal\";\nimport { gte } from \"semver-ts\";\n\n/**\n * Fluid-static-specific runtime option overrides keyed by `minVersionForCollab`.\n *\n * @remarks\n * These are layered on top of the runtime defaults that container-runtime selects from\n * `minVersionForCollab` (via `getMinVersionForCollabDefaults`). Only options that\n * fluid-static needs to set differently from those defaults belong here\n * (e.g. enableRuntimeIdCompressor to support SharedTree).\n */\nconst minVersionForCollabToDefaultRuntimeOptions: Record<\n\t\"1\" | \"2\",\n\tIContainerRuntimeOptionsInternal\n> = {\n\t\"1\": {},\n\t\"2\": {\n\t\t// The runtime ID compressor is a prerequisite to use SharedTree but is off by default and must be explicitly enabled.\n\t\t// In general, we don't want to enable this by default since it increases the bundle size. However, since SharedTree\n\t\t// is bundled with the fluid-framework package, we need to enable it here to support SharedTree.\n\t\tenableRuntimeIdCompressor: \"on\",\n\t},\n};\n\n/**\n * Returns the fluid-static-specific runtime option overrides for the given `minVersionForCollab`.\n *\n * @remarks\n * The bulk of runtime defaults for a given `minVersionForCollab` are selected by container-runtime\n * (via `getMinVersionForCollabDefaults`). This function only contributes the additional overrides\n * that fluid-static needs to layer on top of those defaults.\n * @internal\n */\nexport function defaultRuntimeOptionsForMinVersion(\n\tminVersionForCollab: MinimumVersionForCollab,\n): IContainerRuntimeOptionsInternal {\n\treturn minVersionForCollabToDefaultRuntimeOptions[\n\t\tgte(minVersionForCollab, \"2.0.0\") ? \"2\" : \"1\"\n\t];\n}\n"]}
|
package/dist/index.d.ts
CHANGED
|
@@ -13,5 +13,5 @@ export { createDOProviderContainerRuntimeFactory } from "./rootDataObject.js";
|
|
|
13
13
|
export { createServiceAudience } from "./serviceAudience.js";
|
|
14
14
|
export { createTreeContainerRuntimeFactory } from "./treeRootDataObject.js";
|
|
15
15
|
export type { CompatibilityMode, ContainerSchema, ContainerAttachProps, IConnection, IMember, IServiceAudience, IServiceAudienceEvents, MemberChangedListener, Myself, TreeContainerSchema, } from "./types.js";
|
|
16
|
-
export { isTreeContainerSchema } from "./utils.js";
|
|
16
|
+
export { isTreeContainerSchema, resolveCompatibilityModeToMinVersionForCollab, } from "./utils.js";
|
|
17
17
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;;;GAIG;AAEH,OAAO,EACN,oBAAoB,EACpB,wBAAwB,EACxB,KAAK,eAAe,EACpB,KAAK,qBAAqB,EAC1B,KAAK,uBAAuB,EAC5B,KAAK,cAAc,GACnB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAE,WAAW,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AACjE,OAAO,EAAE,uCAAuC,EAAE,MAAM,qBAAqB,CAAC;AAC9E,OAAO,EAAE,qBAAqB,EAAE,MAAM,sBAAsB,CAAC;AAC7D,OAAO,EAAE,iCAAiC,EAAE,MAAM,yBAAyB,CAAC;AAC5E,YAAY,EACX,iBAAiB,EACjB,eAAe,EACf,oBAAoB,EACpB,WAAW,EACX,OAAO,EACP,gBAAgB,EAChB,sBAAsB,EACtB,qBAAqB,EACrB,MAAM,EACN,mBAAmB,GACnB,MAAM,YAAY,CAAC;AACpB,OAAO,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;;;GAIG;AAEH,OAAO,EACN,oBAAoB,EACpB,wBAAwB,EACxB,KAAK,eAAe,EACpB,KAAK,qBAAqB,EAC1B,KAAK,uBAAuB,EAC5B,KAAK,cAAc,GACnB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAE,WAAW,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AACjE,OAAO,EAAE,uCAAuC,EAAE,MAAM,qBAAqB,CAAC;AAC9E,OAAO,EAAE,qBAAqB,EAAE,MAAM,sBAAsB,CAAC;AAC7D,OAAO,EAAE,iCAAiC,EAAE,MAAM,yBAAyB,CAAC;AAC5E,YAAY,EACX,iBAAiB,EACjB,eAAe,EACf,oBAAoB,EACpB,WAAW,EACX,OAAO,EACP,gBAAgB,EAChB,sBAAsB,EACtB,qBAAqB,EACrB,MAAM,EACN,mBAAmB,GACnB,MAAM,YAAY,CAAC;AACpB,OAAO,EACN,qBAAqB,EACrB,6CAA6C,GAC7C,MAAM,YAAY,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* Licensed under the MIT License.
|
|
5
5
|
*/
|
|
6
6
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
-
exports.isTreeContainerSchema = exports.createTreeContainerRuntimeFactory = exports.createServiceAudience = exports.createDOProviderContainerRuntimeFactory = exports.getPresenceAlpha = exports.getPresence = exports.isInternalFluidContainer = exports.createFluidContainer = void 0;
|
|
7
|
+
exports.resolveCompatibilityModeToMinVersionForCollab = exports.isTreeContainerSchema = exports.createTreeContainerRuntimeFactory = exports.createServiceAudience = exports.createDOProviderContainerRuntimeFactory = exports.getPresenceAlpha = exports.getPresence = exports.isInternalFluidContainer = exports.createFluidContainer = void 0;
|
|
8
8
|
/**
|
|
9
9
|
* Provides a simple and powerful way to consume collaborative Fluid data.
|
|
10
10
|
*
|
|
@@ -24,4 +24,5 @@ var treeRootDataObject_js_1 = require("./treeRootDataObject.js");
|
|
|
24
24
|
Object.defineProperty(exports, "createTreeContainerRuntimeFactory", { enumerable: true, get: function () { return treeRootDataObject_js_1.createTreeContainerRuntimeFactory; } });
|
|
25
25
|
var utils_js_1 = require("./utils.js");
|
|
26
26
|
Object.defineProperty(exports, "isTreeContainerSchema", { enumerable: true, get: function () { return utils_js_1.isTreeContainerSchema; } });
|
|
27
|
+
Object.defineProperty(exports, "resolveCompatibilityModeToMinVersionForCollab", { enumerable: true, get: function () { return utils_js_1.resolveCompatibilityModeToMinVersionForCollab; } });
|
|
27
28
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH;;;;GAIG;AAEH,yDAO6B;AAN5B,yHAAA,oBAAoB,OAAA;AACpB,6HAAA,wBAAwB,OAAA;AAMzB,mDAAiE;AAAxD,6GAAA,WAAW,OAAA;AAAE,kHAAA,gBAAgB,OAAA;AACtC,yDAA8E;AAArE,4IAAA,uCAAuC,OAAA;AAChD,2DAA6D;AAApD,2HAAA,qBAAqB,OAAA;AAC9B,iEAA4E;AAAnE,0IAAA,iCAAiC,OAAA;AAa1C,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH;;;;GAIG;AAEH,yDAO6B;AAN5B,yHAAA,oBAAoB,OAAA;AACpB,6HAAA,wBAAwB,OAAA;AAMzB,mDAAiE;AAAxD,6GAAA,WAAW,OAAA;AAAE,kHAAA,gBAAgB,OAAA;AACtC,yDAA8E;AAArE,4IAAA,uCAAuC,OAAA;AAChD,2DAA6D;AAApD,2HAAA,qBAAqB,OAAA;AAC9B,iEAA4E;AAAnE,0IAAA,iCAAiC,OAAA;AAa1C,uCAGoB;AAFnB,iHAAA,qBAAqB,OAAA;AACrB,yIAAA,6CAA6C,OAAA","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\n/**\n * Provides a simple and powerful way to consume collaborative Fluid data.\n *\n * @packageDocumentation\n */\n\nexport {\n\tcreateFluidContainer,\n\tisInternalFluidContainer,\n\ttype IFluidContainer,\n\ttype IFluidContainerEvents,\n\ttype IFluidContainerInternal,\n\ttype InitialObjects,\n} from \"./fluidContainer.js\";\nexport { getPresence, getPresenceAlpha } from \"./getPresence.js\";\nexport { createDOProviderContainerRuntimeFactory } from \"./rootDataObject.js\";\nexport { createServiceAudience } from \"./serviceAudience.js\";\nexport { createTreeContainerRuntimeFactory } from \"./treeRootDataObject.js\";\nexport type {\n\tCompatibilityMode,\n\tContainerSchema,\n\tContainerAttachProps,\n\tIConnection,\n\tIMember,\n\tIServiceAudience,\n\tIServiceAudienceEvents,\n\tMemberChangedListener,\n\tMyself,\n\tTreeContainerSchema,\n} from \"./types.js\";\nexport {\n\tisTreeContainerSchema,\n\tresolveCompatibilityModeToMinVersionForCollab,\n} from \"./utils.js\";\n"]}
|
package/dist/rootDataObject.d.ts
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
import type { IRuntimeFactory } from "@fluidframework/container-definitions/internal";
|
|
6
6
|
import { type IContainerRuntimeOptions } from "@fluidframework/container-runtime/internal";
|
|
7
7
|
import type { IFluidDataStoreRegistry, MinimumVersionForCollab } from "@fluidframework/runtime-definitions/internal";
|
|
8
|
-
import type {
|
|
8
|
+
import type { ContainerSchema } from "./types.js";
|
|
9
9
|
/**
|
|
10
10
|
* Creates an {@link @fluidframework/aqueduct#IRuntimeFactory} which constructs containers
|
|
11
11
|
* with an entry point containing single directory-based root data object.
|
|
@@ -23,9 +23,10 @@ export declare function createDOProviderContainerRuntimeFactory(props: {
|
|
|
23
23
|
*/
|
|
24
24
|
schema: ContainerSchema;
|
|
25
25
|
/**
|
|
26
|
-
*
|
|
26
|
+
* Minimum Fluid Framework version required for collaboration as a
|
|
27
|
+
* {@link @fluidframework/runtime-definitions#MinimumVersionForCollab} SemVer string.
|
|
27
28
|
*/
|
|
28
|
-
|
|
29
|
+
minVersionForCollaboration: MinimumVersionForCollab;
|
|
29
30
|
/**
|
|
30
31
|
* Optional registry of data stores to pass to the DataObject factory.
|
|
31
32
|
* If not provided, one will be created based on the schema.
|
|
@@ -33,15 +34,8 @@ export declare function createDOProviderContainerRuntimeFactory(props: {
|
|
|
33
34
|
rootDataStoreRegistry?: IFluidDataStoreRegistry;
|
|
34
35
|
/**
|
|
35
36
|
* Optional overrides for the container runtime options.
|
|
36
|
-
* If not provided, only the default options for the given
|
|
37
|
+
* If not provided, only the default options for the given minVersionForCollaboration will be used.
|
|
37
38
|
*/
|
|
38
39
|
runtimeOptionOverrides?: Partial<IContainerRuntimeOptions>;
|
|
39
|
-
/**
|
|
40
|
-
* Optional override for minimum version for collab.
|
|
41
|
-
* If not provided, the default for the given compatibilityMode will be used.
|
|
42
|
-
* @remarks
|
|
43
|
-
* This is useful when runtime options are overridden and change the minimum version for collab.
|
|
44
|
-
*/
|
|
45
|
-
minVersionForCollabOverride?: MinimumVersionForCollab;
|
|
46
40
|
}): IRuntimeFactory;
|
|
47
41
|
//# sourceMappingURL=rootDataObject.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"rootDataObject.d.ts","sourceRoot":"","sources":["../src/rootDataObject.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAOH,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,gDAAgD,CAAC;AACtF,OAAO,EAEN,KAAK,wBAAwB,EAC7B,MAAM,4CAA4C,CAAC;AAapD,OAAO,KAAK,EACX,uBAAuB,EACvB,uBAAuB,EACvB,MAAM,8CAA8C,CAAC;AAItD,OAAO,KAAK,EACX,
|
|
1
|
+
{"version":3,"file":"rootDataObject.d.ts","sourceRoot":"","sources":["../src/rootDataObject.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAOH,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,gDAAgD,CAAC;AACtF,OAAO,EAEN,KAAK,wBAAwB,EAC7B,MAAM,4CAA4C,CAAC;AAapD,OAAO,KAAK,EACX,uBAAuB,EACvB,uBAAuB,EACvB,MAAM,8CAA8C,CAAC;AAItD,OAAO,KAAK,EACX,eAAe,EAMf,MAAM,YAAY,CAAC;AA0IpB;;;;;;;;;;GAUG;AACH,wBAAgB,uCAAuC,CAAC,KAAK,EAAE;IAC9D;;OAEG;IACH,MAAM,EAAE,eAAe,CAAC;IACxB;;;OAGG;IACH,0BAA0B,EAAE,uBAAuB,CAAC;IACpD;;;OAGG;IACH,qBAAqB,CAAC,EAAE,uBAAuB,CAAC;IAChD;;;OAGG;IACH,sBAAsB,CAAC,EAAE,OAAO,CAAC,wBAAwB,CAAC,CAAC;CAC3D,GAAG,eAAe,CAclB"}
|
package/dist/rootDataObject.js
CHANGED
|
@@ -115,12 +115,13 @@ async function provideEntryPoint(containerRuntime) {
|
|
|
115
115
|
* @internal
|
|
116
116
|
*/
|
|
117
117
|
function createDOProviderContainerRuntimeFactory(props) {
|
|
118
|
-
const {
|
|
118
|
+
const { rootDataStoreRegistry, runtimeOptionOverrides, schema } = props;
|
|
119
|
+
const minVersionForCollab = props.minVersionForCollaboration;
|
|
119
120
|
const [registryEntries, sharedObjects] = (0, utils_js_1.parseDataObjectsFromSharedObjects)(schema);
|
|
120
121
|
const registry = rootDataStoreRegistry ?? new internal_2.FluidDataStoreRegistry(registryEntries);
|
|
121
|
-
return new DOProviderContainerRuntimeFactory(schema,
|
|
122
|
+
return new DOProviderContainerRuntimeFactory(schema, new RootDataObjectFactory(sharedObjects, registry), {
|
|
122
123
|
runtimeOptions: runtimeOptionOverrides,
|
|
123
|
-
minVersionForCollab
|
|
124
|
+
minVersionForCollab,
|
|
124
125
|
});
|
|
125
126
|
}
|
|
126
127
|
exports.createDOProviderContainerRuntimeFactory = createDOProviderContainerRuntimeFactory;
|
|
@@ -140,19 +141,18 @@ class DOProviderContainerRuntimeFactory extends internal_1.BaseContainerRuntimeF
|
|
|
140
141
|
* since it can take care of constructing the root data object factory based on the schema.
|
|
141
142
|
*
|
|
142
143
|
* @param schema - The schema for the container
|
|
143
|
-
* @param compatibilityMode - Compatibility mode
|
|
144
144
|
* @param rootDataObjectFactory - A factory that can construct the root data object.
|
|
145
|
+
* @param config - Resolved minimum version for collaboration (required) and optional runtime option overrides.
|
|
145
146
|
*/
|
|
146
|
-
constructor(schema,
|
|
147
|
+
constructor(schema, rootDataObjectFactory, config) {
|
|
147
148
|
super({
|
|
148
149
|
registryEntries: [rootDataObjectFactory.registryEntry],
|
|
149
150
|
runtimeOptions: {
|
|
150
|
-
...compatibilityConfiguration_js_1.
|
|
151
|
-
...
|
|
151
|
+
...(0, compatibilityConfiguration_js_1.defaultRuntimeOptionsForMinVersion)(config.minVersionForCollab),
|
|
152
|
+
...config.runtimeOptions,
|
|
152
153
|
},
|
|
153
154
|
provideEntryPoint,
|
|
154
|
-
minVersionForCollab:
|
|
155
|
-
utils_js_1.compatibilityModeToMinVersionForCollab[compatibilityMode],
|
|
155
|
+
minVersionForCollab: config.minVersionForCollab,
|
|
156
156
|
});
|
|
157
157
|
this.rootDataObjectFactory = rootDataObjectFactory;
|
|
158
158
|
this.initialObjects = schema.initialObjects;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"rootDataObject.js","sourceRoot":"","sources":["../src/rootDataObject.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,gEAI2C;AAE3C,yEAGoD;AAUpD,kEAA6D;AAS7D,mFAAkF;AAUlF,yCAQoB;AAkBpB;;;GAGG;AACH,MAAM,cACL,SAAQ,qBAAiD;IAD1D;;QAIkB,yBAAoB,GAAG,qBAAqB,CAAC;QAC7C,oBAAe,GAAyB,EAAE,CAAC;IA+E7D,CAAC;IA7EA,IAAW,cAAc;QACxB,OAAO,IAAI,CAAC;IACb,CAAC;IAED,IAAY,iBAAiB;QAC5B,MAAM,GAAG,GAAG,IAAI,CAAC,IA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AsC,CAAC,iBAAiB,CAAC;SAC1D,CAAC,CAAC;QACH,IAAI,CAAC,qBAAqB,GAAG,qBAAqB,CAAC;QACnD,IAAI,CAAC,cAAc,GAAG,MAAM,CAAC,cAAc,CAAC;IAC7C,CAAC;IAES,KAAK,CAAC,8BAA8B,CAAC,OAA0B;QACxE,sEAAsE;QACtE,MAAM,IAAI,CAAC,qBAAqB,CAAC,kBAAkB,CAAC,eAAe,EAAE,OAAO,EAAE;YAC7E,cAAc,EAAE,IAAI,CAAC,cAAc;SACnC,CAAC,CAAC;IACJ,CAAC;CACD;AAED;;GAEG;AACH,MAAM,qBAAsB,SAAQ,4BAGnC;IACA,YACC,gBAA4C,EAAE,EAC7B,iBAA0C;QAE3D,2GAA2G;QAC3G,+GAA+G;QAC/G,KAAK,CAAC;YACL,IAAI,EAAE,kBAAkB;YACxB,IAAI,EAAE,cAAc;YACpB,aAAa;SACb,CAAC,CAAC;QARc,sBAAiB,GAAjB,iBAAiB,CAAyB;IAS5D,CAAC;IAED,IAAW,uBAAuB;QACjC,OAAO,IAAI,CAAC,iBAAiB,CAAC;IAC/B,CAAC;CACD","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport {\n\tBaseContainerRuntimeFactory,\n\tDataObject,\n\tDataObjectFactory,\n} 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 { IDirectory } from \"@fluidframework/map/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\tContainerSchema,\n\tIRootDataObject,\n\tIStaticEntryPoint,\n\tLoadableObjectKind,\n\tLoadableObjectKindRecord,\n\tLoadableObjectRecord,\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 * Input props for {@link RootDataObject.initializingFirstTime}.\n */\ninterface RootDataObjectProps {\n\t/**\n\t * Initial object structure with which the {@link RootDataObject} will be first-time initialized.\n\t *\n\t * @see {@link RootDataObject.initializingFirstTime}\n\t */\n\treadonly initialObjects: LoadableObjectKindRecord;\n}\n\ninterface IProvideRootDataObject {\n\treadonly RootDataObject: RootDataObject;\n}\n\n/**\n * The entry-point/root collaborative object of the {@link IFluidContainer | Fluid Container}.\n * Abstracts the dynamic code required to build a Fluid Container into a static representation for end customers.\n */\nclass RootDataObject\n\textends DataObject<{ InitialState: RootDataObjectProps }>\n\timplements IRootDataObject, IProvideRootDataObject\n{\n\tprivate readonly initialObjectsDirKey = \"initial-objects-key\";\n\tprivate readonly _initialObjects: LoadableObjectRecord = {};\n\n\tpublic get RootDataObject(): RootDataObject {\n\t\treturn this;\n\t}\n\n\tprivate get initialObjectsDir(): IDirectory {\n\t\tconst dir = this.root.getSubDirectory(this.initialObjectsDirKey);\n\t\tif (dir === undefined) {\n\t\t\tthrow new Error(\"InitialObjects sub-directory was not initialized\");\n\t\t}\n\t\treturn dir;\n\t}\n\n\t/**\n\t * The first time this object is initialized, creates each object identified in\n\t * {@link RootDataObjectProps.initialObjects} and stores them as unique values in the root directory.\n\t *\n\t * @see {@link @fluidframework/aqueduct#PureDataObject.initializingFirstTime}\n\t */\n\tprotected async initializingFirstTime(props: RootDataObjectProps): Promise<void> {\n\t\tthis.root.createSubDirectory(this.initialObjectsDirKey);\n\n\t\t// Create initial objects provided by the developer\n\t\tconst initialObjectsP: Promise<void>[] = [];\n\t\tfor (const [id, objectClass] of Object.entries(props.initialObjects)) {\n\t\t\tconst createObject = async (): Promise<void> => {\n\t\t\t\tconst obj = await this.create<IFluidLoadable>(\n\t\t\t\t\tobjectClass as SharedObjectKind<IFluidLoadable>,\n\t\t\t\t);\n\t\t\t\tthis.initialObjectsDir.set(id, obj.handle);\n\t\t\t};\n\t\t\tinitialObjectsP.push(createObject());\n\t\t}\n\n\t\tawait Promise.all(initialObjectsP);\n\t}\n\n\t/**\n\t * Every time an instance is initialized, loads all of the initial objects in the root directory so they can be\n\t * accessed immediately.\n\t *\n\t * @see {@link @fluidframework/aqueduct#PureDataObject.hasInitialized}\n\t */\n\tprotected async hasInitialized(): Promise<void> {\n\t\t// We will always load the initial objects so they are available to the developer\n\t\tconst loadInitialObjectsP: Promise<void>[] = [];\n\t\tfor (const [key, value] of this.initialObjectsDir.entries()) {\n\t\t\tconst loadDir = async (): Promise<void> => {\n\t\t\t\t// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access, @typescript-eslint/no-unsafe-call\n\t\t\t\tconst obj: unknown = await value.get();\n\t\t\t\tObject.assign(this._initialObjects, { [key]: obj });\n\t\t\t};\n\t\t\tloadInitialObjectsP.push(loadDir());\n\t\t}\n\n\t\tawait Promise.all(loadInitialObjectsP);\n\t}\n\n\tpublic get initialObjects(): LoadableObjectRecord {\n\t\tif (Object.keys(this._initialObjects).length === 0) {\n\t\t\tthrow new Error(\"Initial Objects were not correctly initialized\");\n\t\t}\n\t\treturn this._initialObjects;\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 rootDataStoreId = \"rootDOId\";\nconst rootDataObjectType = \"rootDO\";\n\nasync function provideEntryPoint(\n\tcontainerRuntime: IContainerRuntime,\n): Promise<IStaticEntryPoint> {\n\tconst entryPoint = await containerRuntime.getAliasedDataStoreEntryPoint(rootDataStoreId);\n\tif (entryPoint === undefined) {\n\t\tthrow new Error(`default dataStore [${rootDataStoreId}] must exist`);\n\t}\n\tconst rootDataObject = ((await entryPoint.get()) as FluidObject<RootDataObject>)\n\t\t.RootDataObject;\n\tassert(rootDataObject !== undefined, 0xb9f /* entryPoint must be of type RootDataObject */);\n\treturn makeFluidObject<IStaticEntryPoint>(\n\t\t{\n\t\t\trootDataObject,\n\t\t\textensionStore: containerRuntime as IContainerRuntimeInternal,\n\t\t},\n\t\t\"IStaticEntryPoint\",\n\t);\n}\n\n/**\n * Creates an {@link @fluidframework/aqueduct#IRuntimeFactory} which constructs containers\n * with an entry point containing single directory-based root data object.\n *\n * @remarks\n * The entry point is opaque to caller.\n * The root data object's registry and initial objects are configured based on the provided\n * schema (and optionally, data store registry).\n *\n * @internal\n */\nexport function createDOProviderContainerRuntimeFactory(props: {\n\t/**\n\t * The schema for the container.\n\t */\n\tschema: ContainerSchema;\n\t/**\n\t * See {@link CompatibilityMode} and compatibilityModeRuntimeOptions for more details.\n\t */\n\tcompatibilityMode: 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\trootDataStoreRegistry?: 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\truntimeOptionOverrides?: 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\tminVersionForCollabOverride?: MinimumVersionForCollab;\n}): IRuntimeFactory {\n\tconst {\n\t\tcompatibilityMode,\n\t\tminVersionForCollabOverride,\n\t\trootDataStoreRegistry,\n\t\truntimeOptionOverrides,\n\t\tschema,\n\t} = props;\n\tconst [registryEntries, sharedObjects] = parseDataObjectsFromSharedObjects(schema);\n\tconst registry = rootDataStoreRegistry ?? new FluidDataStoreRegistry(registryEntries);\n\n\treturn new DOProviderContainerRuntimeFactory(\n\t\tschema,\n\t\tcompatibilityMode,\n\t\tnew RootDataObjectFactory(sharedObjects, registry),\n\t\t{\n\t\t\truntimeOptions: runtimeOptionOverrides,\n\t\t\tminVersionForCollab: minVersionForCollabOverride,\n\t\t},\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 DOProviderContainerRuntimeFactory extends BaseContainerRuntimeFactory {\n\tprivate readonly rootDataObjectFactory: DataObjectFactory<\n\t\tRootDataObject,\n\t\t{\n\t\t\tInitialState: RootDataObjectProps;\n\t\t}\n\t>;\n\n\tprivate readonly initialObjects: LoadableObjectKindRecord;\n\n\t/**\n\t * Create a new instance of a container runtime factory.\n\t * @remarks\n\t * The caller is responsible for making sure that the provided root data object factory is configured\n\t * appropriately based on the schema of the container (e.g. its registry entries contain all the\n\t * DataStore/DDS types that the schema says can be constructed).\n\t *\n\t * Most scenarios probably want to use {@link createDOProviderContainerRuntimeFactory} instead,\n\t * since it can take care of constructing the root data object factory based on the schema.\n\t *\n\t * @param schema - The schema for the container\n\t * @param compatibilityMode - Compatibility mode\n\t * @param rootDataObjectFactory - A factory that can construct the root data object.\n\t */\n\tpublic constructor(\n\t\tschema: ContainerSchema,\n\t\tcompatibilityMode: CompatibilityMode,\n\t\trootDataObjectFactory: DataObjectFactory<\n\t\t\tRootDataObject,\n\t\t\t{ InitialState: RootDataObjectProps }\n\t\t>,\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: [rootDataObjectFactory.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.rootDataObjectFactory = rootDataObjectFactory;\n\t\tthis.initialObjects = schema.initialObjects;\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.rootDataObjectFactory.createRootInstance(rootDataStoreId, runtime, {\n\t\t\tinitialObjects: this.initialObjects,\n\t\t});\n\t}\n}\n\n/**\n * Factory that creates instances of a root data object.\n */\nclass RootDataObjectFactory extends DataObjectFactory<\n\tRootDataObject,\n\t{ InitialState: RootDataObjectProps }\n> {\n\tpublic constructor(\n\t\tsharedObjects: readonly IChannelFactory[] = [],\n\t\tprivate readonly dataStoreRegistry: IFluidDataStoreRegistry,\n\t) {\n\t\t// Note: we're passing `undefined` 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: rootDataObjectType,\n\t\t\tctor: RootDataObject,\n\t\t\tsharedObjects,\n\t\t});\n\t}\n\n\tpublic get IFluidDataStoreRegistry(): IFluidDataStoreRegistry {\n\t\treturn this.dataStoreRegistry;\n\t}\n}\n"]}
|
|
1
|
+
{"version":3,"file":"rootDataObject.js","sourceRoot":"","sources":["../src/rootDataObject.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,gEAI2C;AAE3C,yEAGoD;AAUpD,kEAA6D;AAS7D,mFAAqF;AASrF,yCAOoB;AAkBpB;;;GAGG;AACH,MAAM,cACL,SAAQ,qBAAiD;IAD1D;;QAIkB,yBAAoB,GAAG,qBAAqB,CAAC;QAC7C,oBAAe,GAAyB,EAAE,CAAC;IA+E7D,CAAC;IA7EA,IAAW,cAAc;QACxB,OAAO,IAAI,CAAC;IACb,CAAC;IAED,IAAY,iBAAiB;QAC5B,MAAM,GAAG,GAAG,IAAI,CAAC,IAAI,CAAC,eAAe,CAAC,IAAI,CAAC,oBAAoB,CAAC,CAAC;QACjE,IAAI,GAAG,KAAK,SAAS,EAAE,CAAC;YACvB,MAAM,IAAI,KAAK,CAAC,kDAAkD,CAAC,CAAC;QACrE,CAAC;QACD,OAAO,GAAG,CAAC;IACZ,CAAC;IAED;;;;;OAKG;IACO,KAAK,CAAC,qBAAqB,CAAC,KAA0B;QAC/D,IAAI,CAAC,IAAI,CAAC,kBAAkB,CAAC,IAAI,CAAC,oBAAoB,CAAC,CAAC;QAExD,mDAAmD;QACnD,MAAM,eAAe,GAAoB,EAAE,CAAC;QAC5C,KAAK,MAAM,CAAC,EAAE,EAAE,WAAW,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC,cAAc,CAAC,EAAE,CAAC;YACtE,MAAM,YAAY,GAAG,KAAK,IAAmB,EAAE;gBAC9C,MAAM,GAAG,GAAG,MAAM,IAAI,CAAC,MAAM,CAC5B,WAA+C,CAC/C,CAAC;gBACF,IAAI,CAAC,iBAAiB,CAAC,GAAG,CAAC,EAAE,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC;YAC5C,CAAC,CAAC;YACF,eAAe,CAAC,IAAI,CAAC,YAA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,aAAa,EAAE,QAAQ,CAAC,EAClD;QACC,cAAc,EAAE,sBAAsB;QACtC,mBAAmB;KACnB,CACD,CAAC;AACH,CAAC;AAlCD,0FAkCC;AAED;;;GAGG;AACH,MAAM,iCAAkC,SAAQ,sCAA2B;IAU1E;;;;;;;;;;;;;OAaG;IACH,YACC,MAAuB,EACvB,qBAGC,EACD,MAGC;QAED,KAAK,CAAC;YACL,eAAe,EAAE,CAAC,qBAAqB,CAAC,aAAa,CAAC;YACtD,cAAc,EAAE;gBACf,GAAG,IAAA,kEAAkC,EAAC,MAAM,CAAC,mBAAmB,CAAC;gBACjE,GAAG,MAAM,CAAC,cAAc;aACxB;YACD,iBAAiB;YACjB,mBAAmB,EAAE,MAAM,CAAC,mBAAmB;SAC/C,CAAC,CAAC;QACH,IAAI,CAAC,qBAAqB,GAAG,qBAAqB,CAAC;QACnD,IAAI,CAAC,cAAc,GAAG,MAAM,CAAC,cAAc,CAAC;IAC7C,CAAC;IAES,KAAK,CAAC,8BAA8B,CAAC,OAA0B;QACxE,sEAAsE;QACtE,MAAM,IAAI,CAAC,qBAAqB,CAAC,kBAAkB,CAAC,eAAe,EAAE,OAAO,EAAE;YAC7E,cAAc,EAAE,IAAI,CAAC,cAAc;SACnC,CAAC,CAAC;IACJ,CAAC;CACD;AAED;;GAEG;AACH,MAAM,qBAAsB,SAAQ,4BAGnC;IACA,YACC,gBAA4C,EAAE,EAC7B,iBAA0C;QAE3D,2GAA2G;QAC3G,+GAA+G;QAC/G,KAAK,CAAC;YACL,IAAI,EAAE,kBAAkB;YACxB,IAAI,EAAE,cAAc;YACpB,aAAa;SACb,CAAC,CAAC;QARc,sBAAiB,GAAjB,iBAAiB,CAAyB;IAS5D,CAAC;IAED,IAAW,uBAAuB;QACjC,OAAO,IAAI,CAAC,iBAAiB,CAAC;IAC/B,CAAC;CACD","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport {\n\tBaseContainerRuntimeFactory,\n\tDataObject,\n\tDataObjectFactory,\n} 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 { IDirectory } from \"@fluidframework/map/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\tContainerSchema,\n\tIRootDataObject,\n\tIStaticEntryPoint,\n\tLoadableObjectKind,\n\tLoadableObjectKindRecord,\n\tLoadableObjectRecord,\n} from \"./types.js\";\nimport {\n\tcreateDataObject,\n\tcreateSharedObject,\n\tisDataObjectKind,\n\tisSharedObjectKind,\n\tmakeFluidObject,\n\tparseDataObjectsFromSharedObjects,\n} from \"./utils.js\";\n\n/**\n * Input props for {@link RootDataObject.initializingFirstTime}.\n */\ninterface RootDataObjectProps {\n\t/**\n\t * Initial object structure with which the {@link RootDataObject} will be first-time initialized.\n\t *\n\t * @see {@link RootDataObject.initializingFirstTime}\n\t */\n\treadonly initialObjects: LoadableObjectKindRecord;\n}\n\ninterface IProvideRootDataObject {\n\treadonly RootDataObject: RootDataObject;\n}\n\n/**\n * The entry-point/root collaborative object of the {@link IFluidContainer | Fluid Container}.\n * Abstracts the dynamic code required to build a Fluid Container into a static representation for end customers.\n */\nclass RootDataObject\n\textends DataObject<{ InitialState: RootDataObjectProps }>\n\timplements IRootDataObject, IProvideRootDataObject\n{\n\tprivate readonly initialObjectsDirKey = \"initial-objects-key\";\n\tprivate readonly _initialObjects: LoadableObjectRecord = {};\n\n\tpublic get RootDataObject(): RootDataObject {\n\t\treturn this;\n\t}\n\n\tprivate get initialObjectsDir(): IDirectory {\n\t\tconst dir = this.root.getSubDirectory(this.initialObjectsDirKey);\n\t\tif (dir === undefined) {\n\t\t\tthrow new Error(\"InitialObjects sub-directory was not initialized\");\n\t\t}\n\t\treturn dir;\n\t}\n\n\t/**\n\t * The first time this object is initialized, creates each object identified in\n\t * {@link RootDataObjectProps.initialObjects} and stores them as unique values in the root directory.\n\t *\n\t * @see {@link @fluidframework/aqueduct#PureDataObject.initializingFirstTime}\n\t */\n\tprotected async initializingFirstTime(props: RootDataObjectProps): Promise<void> {\n\t\tthis.root.createSubDirectory(this.initialObjectsDirKey);\n\n\t\t// Create initial objects provided by the developer\n\t\tconst initialObjectsP: Promise<void>[] = [];\n\t\tfor (const [id, objectClass] of Object.entries(props.initialObjects)) {\n\t\t\tconst createObject = async (): Promise<void> => {\n\t\t\t\tconst obj = await this.create<IFluidLoadable>(\n\t\t\t\t\tobjectClass as SharedObjectKind<IFluidLoadable>,\n\t\t\t\t);\n\t\t\t\tthis.initialObjectsDir.set(id, obj.handle);\n\t\t\t};\n\t\t\tinitialObjectsP.push(createObject());\n\t\t}\n\n\t\tawait Promise.all(initialObjectsP);\n\t}\n\n\t/**\n\t * Every time an instance is initialized, loads all of the initial objects in the root directory so they can be\n\t * accessed immediately.\n\t *\n\t * @see {@link @fluidframework/aqueduct#PureDataObject.hasInitialized}\n\t */\n\tprotected async hasInitialized(): Promise<void> {\n\t\t// We will always load the initial objects so they are available to the developer\n\t\tconst loadInitialObjectsP: Promise<void>[] = [];\n\t\tfor (const [key, value] of this.initialObjectsDir.entries()) {\n\t\t\tconst loadDir = async (): Promise<void> => {\n\t\t\t\t// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access, @typescript-eslint/no-unsafe-call\n\t\t\t\tconst obj: unknown = await value.get();\n\t\t\t\tObject.assign(this._initialObjects, { [key]: obj });\n\t\t\t};\n\t\t\tloadInitialObjectsP.push(loadDir());\n\t\t}\n\n\t\tawait Promise.all(loadInitialObjectsP);\n\t}\n\n\tpublic get initialObjects(): LoadableObjectRecord {\n\t\tif (Object.keys(this._initialObjects).length === 0) {\n\t\t\tthrow new Error(\"Initial Objects were not correctly initialized\");\n\t\t}\n\t\treturn this._initialObjects;\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 rootDataStoreId = \"rootDOId\";\nconst rootDataObjectType = \"rootDO\";\n\nasync function provideEntryPoint(\n\tcontainerRuntime: IContainerRuntime,\n): Promise<IStaticEntryPoint> {\n\tconst entryPoint = await containerRuntime.getAliasedDataStoreEntryPoint(rootDataStoreId);\n\tif (entryPoint === undefined) {\n\t\tthrow new Error(`default dataStore [${rootDataStoreId}] must exist`);\n\t}\n\tconst rootDataObject = ((await entryPoint.get()) as FluidObject<RootDataObject>)\n\t\t.RootDataObject;\n\tassert(rootDataObject !== undefined, 0xb9f /* entryPoint must be of type RootDataObject */);\n\treturn makeFluidObject<IStaticEntryPoint>(\n\t\t{\n\t\t\trootDataObject,\n\t\t\textensionStore: containerRuntime as IContainerRuntimeInternal,\n\t\t},\n\t\t\"IStaticEntryPoint\",\n\t);\n}\n\n/**\n * Creates an {@link @fluidframework/aqueduct#IRuntimeFactory} which constructs containers\n * with an entry point containing single directory-based root data object.\n *\n * @remarks\n * The entry point is opaque to caller.\n * The root data object's registry and initial objects are configured based on the provided\n * schema (and optionally, data store registry).\n *\n * @internal\n */\nexport function createDOProviderContainerRuntimeFactory(props: {\n\t/**\n\t * The schema for the container.\n\t */\n\tschema: ContainerSchema;\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\tminVersionForCollaboration: 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\trootDataStoreRegistry?: 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\truntimeOptionOverrides?: Partial<IContainerRuntimeOptions>;\n}): IRuntimeFactory {\n\tconst { rootDataStoreRegistry, runtimeOptionOverrides, schema } = props;\n\tconst minVersionForCollab = props.minVersionForCollaboration;\n\tconst [registryEntries, sharedObjects] = parseDataObjectsFromSharedObjects(schema);\n\tconst registry = rootDataStoreRegistry ?? new FluidDataStoreRegistry(registryEntries);\n\n\treturn new DOProviderContainerRuntimeFactory(\n\t\tschema,\n\t\tnew RootDataObjectFactory(sharedObjects, registry),\n\t\t{\n\t\t\truntimeOptions: runtimeOptionOverrides,\n\t\t\tminVersionForCollab,\n\t\t},\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 DOProviderContainerRuntimeFactory extends BaseContainerRuntimeFactory {\n\tprivate readonly rootDataObjectFactory: DataObjectFactory<\n\t\tRootDataObject,\n\t\t{\n\t\t\tInitialState: RootDataObjectProps;\n\t\t}\n\t>;\n\n\tprivate readonly initialObjects: LoadableObjectKindRecord;\n\n\t/**\n\t * Create a new instance of a container runtime factory.\n\t * @remarks\n\t * The caller is responsible for making sure that the provided root data object factory is configured\n\t * appropriately based on the schema of the container (e.g. its registry entries contain all the\n\t * DataStore/DDS types that the schema says can be constructed).\n\t *\n\t * Most scenarios probably want to use {@link createDOProviderContainerRuntimeFactory} instead,\n\t * since it can take care of constructing the root data object factory based on the schema.\n\t *\n\t * @param schema - The schema for the container\n\t * @param rootDataObjectFactory - A factory that can construct the root data object.\n\t * @param config - Resolved minimum version for collaboration (required) and optional runtime option overrides.\n\t */\n\tpublic constructor(\n\t\tschema: ContainerSchema,\n\t\trootDataObjectFactory: DataObjectFactory<\n\t\t\tRootDataObject,\n\t\t\t{ InitialState: RootDataObjectProps }\n\t\t>,\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: [rootDataObjectFactory.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.rootDataObjectFactory = rootDataObjectFactory;\n\t\tthis.initialObjects = schema.initialObjects;\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.rootDataObjectFactory.createRootInstance(rootDataStoreId, runtime, {\n\t\t\tinitialObjects: this.initialObjects,\n\t\t});\n\t}\n}\n\n/**\n * Factory that creates instances of a root data object.\n */\nclass RootDataObjectFactory extends DataObjectFactory<\n\tRootDataObject,\n\t{ InitialState: RootDataObjectProps }\n> {\n\tpublic constructor(\n\t\tsharedObjects: readonly IChannelFactory[] = [],\n\t\tprivate readonly dataStoreRegistry: IFluidDataStoreRegistry,\n\t) {\n\t\t// Note: we're passing `undefined` 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: rootDataObjectType,\n\t\t\tctor: RootDataObject,\n\t\t\tsharedObjects,\n\t\t});\n\t}\n\n\tpublic get IFluidDataStoreRegistry(): IFluidDataStoreRegistry {\n\t\treturn this.dataStoreRegistry;\n\t}\n}\n"]}
|
|
@@ -23,7 +23,41 @@ export declare function createTreeContainerRuntimeFactory(props: {
|
|
|
23
23
|
*/
|
|
24
24
|
readonly schema: TreeContainerSchema;
|
|
25
25
|
/**
|
|
26
|
-
*
|
|
26
|
+
* Minimum Fluid Framework version required for collaboration as a
|
|
27
|
+
* {@link @fluidframework/runtime-definitions#MinimumVersionForCollab} SemVer string.
|
|
28
|
+
*/
|
|
29
|
+
readonly minVersionForCollaboration: MinimumVersionForCollab;
|
|
30
|
+
/**
|
|
31
|
+
* Optional registry of data stores to pass to the DataObject factory.
|
|
32
|
+
* If not provided, one will be created based on the schema.
|
|
33
|
+
*/
|
|
34
|
+
readonly rootDataStoreRegistry?: IFluidDataStoreRegistry;
|
|
35
|
+
/**
|
|
36
|
+
* Optional overrides for the container runtime options.
|
|
37
|
+
* If not provided, only the default options for the given minVersionForCollaboration will be used.
|
|
38
|
+
*/
|
|
39
|
+
readonly runtimeOptionOverrides?: Partial<IContainerRuntimeOptions>;
|
|
40
|
+
}): IRuntimeFactory;
|
|
41
|
+
/**
|
|
42
|
+
* Creates an {@link @fluidframework/aqueduct#IRuntimeFactory} which constructs containers
|
|
43
|
+
* with an entry point containing single tree-based root data object.
|
|
44
|
+
*
|
|
45
|
+
* @remarks
|
|
46
|
+
* The entry point is opaque to caller.
|
|
47
|
+
* The root data object's registry and shared objects are configured based on the provided
|
|
48
|
+
* SharedTree and optional data store registry.
|
|
49
|
+
*
|
|
50
|
+
* @deprecated Pass `minVersionForCollaboration` directly instead of using `compatibilityMode`.
|
|
51
|
+
*
|
|
52
|
+
* @legacy @beta
|
|
53
|
+
*/
|
|
54
|
+
export declare function createTreeContainerRuntimeFactory(props: {
|
|
55
|
+
/**
|
|
56
|
+
* The schema for the container.
|
|
57
|
+
*/
|
|
58
|
+
readonly schema: TreeContainerSchema;
|
|
59
|
+
/**
|
|
60
|
+
* Legacy compatibility mode for the container.
|
|
27
61
|
*/
|
|
28
62
|
readonly compatibilityMode: CompatibilityMode;
|
|
29
63
|
/**
|
|
@@ -37,10 +71,10 @@ export declare function createTreeContainerRuntimeFactory(props: {
|
|
|
37
71
|
*/
|
|
38
72
|
readonly runtimeOptionOverrides?: Partial<IContainerRuntimeOptions>;
|
|
39
73
|
/**
|
|
40
|
-
* Optional override for minimum version for
|
|
41
|
-
* If not provided, the default for the given compatibilityMode will be used.
|
|
74
|
+
* Optional override for minimum version for collaboration.
|
|
42
75
|
* @remarks
|
|
43
|
-
*
|
|
76
|
+
* If not provided, the default for the given compatibilityMode will be used.
|
|
77
|
+
* Rather than defining this, omit `compatibilityMode` and pass `minVersionForCollaboration` directly.
|
|
44
78
|
*/
|
|
45
79
|
readonly minVersionForCollabOverride?: MinimumVersionForCollab;
|
|
46
80
|
}): IRuntimeFactory;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"treeRootDataObject.d.ts","sourceRoot":"","sources":["../src/treeRootDataObject.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAQH,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,gDAAgD,CAAC;AACtF,OAAO,EAEN,KAAK,wBAAwB,EAC7B,MAAM,4CAA4C,CAAC;AAYpD,OAAO,KAAK,EACX,uBAAuB,EACvB,uBAAuB,EACvB,MAAM,8CAA8C,CAAC;AAItD,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"treeRootDataObject.d.ts","sourceRoot":"","sources":["../src/treeRootDataObject.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAQH,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,gDAAgD,CAAC;AACtF,OAAO,EAEN,KAAK,wBAAwB,EAC7B,MAAM,4CAA4C,CAAC;AAYpD,OAAO,KAAK,EACX,uBAAuB,EACvB,uBAAuB,EACvB,MAAM,8CAA8C,CAAC;AAItD,OAAO,KAAK,EAEX,iBAAiB,EAKjB,mBAAmB,EACnB,MAAM,YAAY,CAAC;AAuJpB;;;;;;;;;;GAUG;AACH,wBAAgB,iCAAiC,CAAC,KAAK,EAAE;IACxD;;OAEG;IACH,QAAQ,CAAC,MAAM,EAAE,mBAAmB,CAAC;IAErC;;;OAGG;IACH,QAAQ,CAAC,0BAA0B,EAAE,uBAAuB,CAAC;IAC7D;;;OAGG;IACH,QAAQ,CAAC,qBAAqB,CAAC,EAAE,uBAAuB,CAAC;IACzD;;;OAGG;IACH,QAAQ,CAAC,sBAAsB,CAAC,EAAE,OAAO,CAAC,wBAAwB,CAAC,CAAC;CACpE,GAAG,eAAe,CAAC;AAEpB;;;;;;;;;;;;GAYG;AACH,wBAAgB,iCAAiC,CAAC,KAAK,EAAE;IACxD;;OAEG;IACH,QAAQ,CAAC,MAAM,EAAE,mBAAmB,CAAC;IAErC;;OAEG;IAEH,QAAQ,CAAC,iBAAiB,EAAE,iBAAiB,CAAC;IAC9C;;;OAGG;IACH,QAAQ,CAAC,qBAAqB,CAAC,EAAE,uBAAuB,CAAC;IACzD;;;OAGG;IACH,QAAQ,CAAC,sBAAsB,CAAC,EAAE,OAAO,CAAC,wBAAwB,CAAC,CAAC;IACpE;;;;;OAKG;IACH,QAAQ,CAAC,2BAA2B,CAAC,EAAE,uBAAuB,CAAC;CAC/D,GAAG,eAAe,CAAC"}
|
|
@@ -87,16 +87,15 @@ async function provideEntryPoint(containerRuntime) {
|
|
|
87
87
|
* (containing single {@link IRootDataObject}) as their entry point.
|
|
88
88
|
*/
|
|
89
89
|
class TreeContainerRuntimeFactory extends internal_1.BaseContainerRuntimeFactory {
|
|
90
|
-
constructor(
|
|
90
|
+
constructor(treeRootDataObjectFactory, config) {
|
|
91
91
|
super({
|
|
92
92
|
registryEntries: [treeRootDataObjectFactory.registryEntry],
|
|
93
93
|
runtimeOptions: {
|
|
94
|
-
...compatibilityConfiguration_js_1.
|
|
95
|
-
...
|
|
94
|
+
...(0, compatibilityConfiguration_js_1.defaultRuntimeOptionsForMinVersion)(config.minVersionForCollab),
|
|
95
|
+
...config.runtimeOptions,
|
|
96
96
|
},
|
|
97
97
|
provideEntryPoint,
|
|
98
|
-
minVersionForCollab:
|
|
99
|
-
utils_js_1.compatibilityModeToMinVersionForCollab[compatibilityMode],
|
|
98
|
+
minVersionForCollab: config.minVersionForCollab,
|
|
100
99
|
});
|
|
101
100
|
// TODO: use for runtime factory.
|
|
102
101
|
_TreeContainerRuntimeFactory_treeRootDataObjectFactory.set(this, void 0);
|
|
@@ -133,24 +132,26 @@ class TreeRootDataObjectFactory extends internal_1.TreeDataObjectFactory {
|
|
|
133
132
|
return this.dataStoreRegistry;
|
|
134
133
|
}
|
|
135
134
|
}
|
|
136
|
-
|
|
137
|
-
* Creates an {@link @fluidframework/aqueduct#IRuntimeFactory} which constructs containers
|
|
138
|
-
* with an entry point containing single tree-based root data object.
|
|
139
|
-
*
|
|
140
|
-
* @remarks
|
|
141
|
-
* The entry point is opaque to caller.
|
|
142
|
-
* The root data object's registry and shared objects are configured based on the provided
|
|
143
|
-
* SharedTree and optionally data store registry.
|
|
144
|
-
*
|
|
145
|
-
* @legacy @beta
|
|
146
|
-
*/
|
|
135
|
+
// Implementation
|
|
147
136
|
function createTreeContainerRuntimeFactory(props) {
|
|
148
|
-
const { compatibilityMode, minVersionForCollabOverride, rootDataStoreRegistry, runtimeOptionOverrides, schema, } = props;
|
|
137
|
+
const { compatibilityMode, minVersionForCollaboration, minVersionForCollabOverride, rootDataStoreRegistry, runtimeOptionOverrides, schema, } = props;
|
|
138
|
+
let minVersionForCollab;
|
|
139
|
+
if (minVersionForCollaboration !== undefined) {
|
|
140
|
+
minVersionForCollab = minVersionForCollaboration;
|
|
141
|
+
}
|
|
142
|
+
else if (compatibilityMode === undefined) {
|
|
143
|
+
throw new Error("Either minVersionForCollaboration or compatibilityMode (deprecated) must be provided.");
|
|
144
|
+
}
|
|
145
|
+
else {
|
|
146
|
+
minVersionForCollab =
|
|
147
|
+
minVersionForCollabOverride ??
|
|
148
|
+
(0, utils_js_1.resolveCompatibilityModeToMinVersionForCollab)(compatibilityMode);
|
|
149
|
+
}
|
|
149
150
|
const [registryEntries, sharedObjects] = (0, utils_js_1.parseDataObjectsFromSharedObjects)(schema);
|
|
150
151
|
const registry = rootDataStoreRegistry ?? new internal_2.FluidDataStoreRegistry(registryEntries);
|
|
151
|
-
return new TreeContainerRuntimeFactory(
|
|
152
|
+
return new TreeContainerRuntimeFactory(new TreeRootDataObjectFactory(sharedObjects, registry), {
|
|
152
153
|
runtimeOptions: runtimeOptionOverrides,
|
|
153
|
-
minVersionForCollab
|
|
154
|
+
minVersionForCollab,
|
|
154
155
|
});
|
|
155
156
|
}
|
|
156
157
|
exports.createTreeContainerRuntimeFactory = createTreeContainerRuntimeFactory;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"treeRootDataObject.js","sourceRoot":"","sources":["../src/treeRootDataObject.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;;;;;;;;;;;;;AAEH,gEAI2C;AAG3C,yEAGoD;AAUpD,kEAA6D;AAQ7D,mFAAkF;AASlF,yCAQoB;AAEpB;;;;;;GAMG;AAEH;;;;;GAKG;AACH,MAAM,kBAAmB,SAAQ,yBAAc;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;QACxB,OAAO;YACN,IAAI,EAAE,IAAI,CAAC,IAAI;SACf,CAAC;IACH,CAAC;IAEM,KAAK,CAAC,MAAM,CAAI,WAAgC;QACtD,MAAM,QAAQ,GAAG,WAAgE,CAAC;QAClF,IAAI,IAAA,2BAAgB,EAAC,QAAQ,CA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I,IAAI,iCAAsB,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;AA/CD,8EA+CC","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,gEAI2C;AAG3C,yEAGoD;AAUpD,kEAA6D;AAQ7D,mFAAqF;AAUrF,yCAQoB;AAEpB;;;;;;GAMG;AAEH;;;;;GAKG;AACH,MAAM,kBAAmB,SAAQ,yBAAc;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;QACxB,OAAO;YACN,IAAI,EAAE,IAAI,CAAC,IAAI;SACf,CAAC;IACH,CAAC;IAEM,KAAK,CAAC,MAAM,CAAI,WAAgC;QACtD,MAAM,QAAQ,GAAG,WAAgE,CAAC;QAClF,IAAI,IAAA,2BAAgB,EAAC,QAAQ,CAAC,EAAE,CAAC;YAChC,OAAO,IAAA,2BAAgB,EAAC,QAAQ,EAAE,IAA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IACH,CAAC;SAAM,CAAC;QACP,mBAAmB;YAClB,2BAA2B;gBAC3B,IAAA,wDAA6C,EAAC,iBAAiB,CAAC,CAAC;IACnE,CAAC;IAED,MAAM,CAAC,eAAe,EAAE,aAAa,CAAC,GAAG,IAAA,4CAAiC,EAAC,MAAM,CAAC,CAAC;IACnF,MAAM,QAAQ,GAAG,qBAAqB,IAAI,IAAI,iCAAsB,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;AAzCD,8EAyCC","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/dist/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/dist/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,EAAE,MAAM,sBAAsB,CAAC;AAElD;;;;;;;;;;;;GAYG;AACH,MAAM,MAAM,iBAAiB,GAAG,GAAG,GAAG,GAAG,CAAC;AAE1C;;GAEG;AACH,MAAM,MAAM,oBAAoB,GAAG,MAAM,CAAC,MAAM,EAAE,cAAc,CAAC,CAAC;AAElE;;;GAGG;AACH,MAAM,MAAM,wBAAwB,GAAG,MAAM,CAAC,MAAM,EAAE,gBAAgB,CAAC,CAAC;AAExE;;;;;;;;;;;GAWG;AACH,MAAM,MAAM,kBAAkB,CAAC,CAAC,SAAS,cAA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