@fluidframework/fluid-static 2.50.0-345060 → 2.51.0-347100

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.
Files changed (53) hide show
  1. package/CHANGELOG.md +4 -0
  2. package/api-report/fluid-static.alpha.api.md +17 -0
  3. package/dist/fluidContainer.d.ts +1 -1
  4. package/dist/fluidContainer.d.ts.map +1 -1
  5. package/dist/fluidContainer.js.map +1 -1
  6. package/dist/index.d.ts +3 -1
  7. package/dist/index.d.ts.map +1 -1
  8. package/dist/index.js +5 -1
  9. package/dist/index.js.map +1 -1
  10. package/dist/rootDataObject.d.ts +6 -3
  11. package/dist/rootDataObject.d.ts.map +1 -1
  12. package/dist/rootDataObject.js +27 -44
  13. package/dist/rootDataObject.js.map +1 -1
  14. package/dist/treeRootDataObject.d.ts +47 -0
  15. package/dist/treeRootDataObject.d.ts.map +1 -0
  16. package/dist/treeRootDataObject.js +157 -0
  17. package/dist/treeRootDataObject.js.map +1 -0
  18. package/dist/types.d.ts +23 -8
  19. package/dist/types.d.ts.map +1 -1
  20. package/dist/types.js.map +1 -1
  21. package/dist/utils.d.ts +29 -4
  22. package/dist/utils.d.ts.map +1 -1
  23. package/dist/utils.js +62 -3
  24. package/dist/utils.js.map +1 -1
  25. package/lib/fluidContainer.d.ts +1 -1
  26. package/lib/fluidContainer.d.ts.map +1 -1
  27. package/lib/fluidContainer.js.map +1 -1
  28. package/lib/index.d.ts +3 -1
  29. package/lib/index.d.ts.map +1 -1
  30. package/lib/index.js +2 -0
  31. package/lib/index.js.map +1 -1
  32. package/lib/rootDataObject.d.ts +6 -3
  33. package/lib/rootDataObject.d.ts.map +1 -1
  34. package/lib/rootDataObject.js +25 -42
  35. package/lib/rootDataObject.js.map +1 -1
  36. package/lib/treeRootDataObject.d.ts +47 -0
  37. package/lib/treeRootDataObject.d.ts.map +1 -0
  38. package/lib/treeRootDataObject.js +153 -0
  39. package/lib/treeRootDataObject.js.map +1 -0
  40. package/lib/types.d.ts +23 -8
  41. package/lib/types.d.ts.map +1 -1
  42. package/lib/types.js.map +1 -1
  43. package/lib/utils.d.ts +29 -4
  44. package/lib/utils.d.ts.map +1 -1
  45. package/lib/utils.js +55 -0
  46. package/lib/utils.js.map +1 -1
  47. package/package.json +21 -20
  48. package/src/fluidContainer.ts +1 -1
  49. package/src/index.ts +3 -0
  50. package/src/rootDataObject.ts +46 -69
  51. package/src/treeRootDataObject.ts +249 -0
  52. package/src/types.ts +30 -9
  53. package/src/utils.ts +90 -4
package/lib/utils.d.ts CHANGED
@@ -3,11 +3,11 @@
3
3
  * Licensed under the MIT License.
4
4
  */
5
5
  import type { DataObjectKind } from "@fluidframework/aqueduct/internal";
6
- import type { IFluidLoadable } from "@fluidframework/core-interfaces";
7
- import type { IChannelFactory } from "@fluidframework/datastore-definitions/internal";
8
- import type { NamedFluidDataStoreRegistryEntry } from "@fluidframework/runtime-definitions/internal";
6
+ import type { FluidObjectKeys, IFluidLoadable } from "@fluidframework/core-interfaces";
7
+ import type { IChannelFactory, IFluidDataStoreRuntime } from "@fluidframework/datastore-definitions/internal";
8
+ import type { IFluidDataStoreContext, NamedFluidDataStoreRegistryEntry } from "@fluidframework/runtime-definitions/internal";
9
9
  import type { ISharedObjectKind } from "@fluidframework/shared-object-base/internal";
10
- import type { ContainerSchema, LoadableObjectKind } from "./types.js";
10
+ import type { ContainerSchema, LoadableObjectKind, TreeContainerSchema } from "./types.js";
11
11
  /**
12
12
  * Runtime check to determine if an object is a {@link DataObjectKind}.
13
13
  */
@@ -26,4 +26,29 @@ export declare function isSharedObjectKind(obj: LoadableObjectKind): obj is ISha
26
26
  * of DataObject types and an array of SharedObjects.
27
27
  */
28
28
  export declare const parseDataObjectsFromSharedObjects: (schema: ContainerSchema) => [NamedFluidDataStoreRegistryEntry[], IChannelFactory[]];
29
+ /**
30
+ * Creates a new data object of the specified type.
31
+ */
32
+ export declare function createDataObject<T extends IFluidLoadable>(dataObjectClass: DataObjectKind<T>, context: IFluidDataStoreContext): Promise<T>;
33
+ /**
34
+ * Creates a new shared object of the specified type.
35
+ */
36
+ export declare function createSharedObject<T extends IFluidLoadable>(sharedObjectClass: ISharedObjectKind<T>, runtime: IFluidDataStoreRuntime): T;
37
+ /**
38
+ * Creates a Fluid object that has a property with the key `providerKey` that points to itself.
39
+ * @remarks This is useful for creating objects that need to reference themselves, such as DataObjects.
40
+ */
41
+ export declare function makeFluidObject<T extends object, K extends FluidObjectKeys<T> = FluidObjectKeys<T>>(object: Omit<T, K>, providerKey: K): T;
42
+ /**
43
+ * Maps CompatibilityMode to a semver valid string that can be passed to the container runtime.
44
+ */
45
+ export declare const compatibilityModeToMinVersionForCollab: {
46
+ readonly "1": "1.0.0";
47
+ readonly "2": "2.0.0";
48
+ };
49
+ /**
50
+ * Determines if the provided schema is a valid tree-based container schema.
51
+ * @internal
52
+ */
53
+ export declare function isTreeContainerSchema(schema: ContainerSchema): schema is TreeContainerSchema;
29
54
  //# sourceMappingURL=utils.d.ts.map
@@ -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,cAAc,EAAE,MAAM,iCAAiC,CAAC;AACtE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,gDAAgD,CAAC;AACtF,OAAO,KAAK,EAAE,gCAAgC,EAAE,MAAM,8CAA8C,CAAC;AACrG,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,6CAA6C,CAAC;AAGrF,OAAO,KAAK,EAAE,eAAe,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAC;AAEtE;;GAEG;AACH,wBAAgB,gBAAgB,CAAC,CAAC,SAAS,cAAc,EACxD,GAAG,EAAE,kBAAkB,CAAC,CAAC,CAAC,GACxB,GAAG,IAAI,cAAc,CAAC,CAAC,CAAC,CAAC;AAE5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MAAM,iCAAiC,WACrC,eAAe,KACrB,CAAC,gCAAgC,EAAE,EAAE,eAAe,EAAE,CA4BxD,CAAC;AAEF;;GAEG;AACH,wBAAsB,gBAAgB,CAAC,CAAC,SAAS,cAAc,EAC9D,eAAe,EAAE,cAAc,CAAC,CAAC,CAAC,EAClC,OAAO,EAAE,sBAAsB,GAC7B,OAAO,CAAC,CAAC,CAAC,CAMZ;AAED;;GAEG;AACH,wBAAgB,kBAAkB,CAAC,CAAC,SAAS,cAAc,EAC1D,iBAAiB,EAAE,iBAAiB,CAAC,CAAC,CAAC,EACvC,OAAO,EAAE,sBAAsB,GAC7B,CAAC,CAIH;AAED;;;GAGG;AACH,wBAAgB,eAAe,CAC9B,CAAC,SAAS,MAAM,EAChB,CAAC,SAAS,eAAe,CAAC,CAAC,CAAC,GAAG,eAAe,CAAC,CAAC,CAAC,EAChD,MAAM,EAAE,IAAI,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,WAAW,EAAE,CAAC,GAAG,CAAC,CAEvC;AAED;;GAEG;AACH,eAAO,MAAM,sCAAsC;;;CAGoB,CAAC;AAExE;;;GAGG;AACH,wBAAgB,qBAAqB,CAAC,MAAM,EAAE,eAAe,GAAG,MAAM,IAAI,mBAAmB,CAqB5F"}
package/lib/utils.js CHANGED
@@ -2,7 +2,9 @@
2
2
  * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
3
3
  * Licensed under the MIT License.
4
4
  */
5
+ import { oob } from "@fluidframework/core-utils/internal";
5
6
  import { UsageError } from "@fluidframework/telemetry-utils/internal";
7
+ import { SharedTreeFactoryType } from "@fluidframework/tree/internal";
6
8
  /**
7
9
  * Runtime check to determine if an object is a {@link DataObjectKind}.
8
10
  */
@@ -56,4 +58,57 @@ export const parseDataObjectsFromSharedObjects = (schema) => {
56
58
  }
57
59
  return [[...registryEntries], [...sharedObjects]];
58
60
  };
61
+ /**
62
+ * Creates a new data object of the specified type.
63
+ */
64
+ export async function createDataObject(dataObjectClass, context) {
65
+ const factory = dataObjectClass.factory;
66
+ const packagePath = [...context.packagePath, factory.type];
67
+ const dataStore = await context.containerRuntime.createDataStore(packagePath);
68
+ const entryPoint = await dataStore.entryPoint.get();
69
+ return entryPoint;
70
+ }
71
+ /**
72
+ * Creates a new shared object of the specified type.
73
+ */
74
+ export function createSharedObject(sharedObjectClass, runtime) {
75
+ const factory = sharedObjectClass.getFactory();
76
+ const obj = runtime.createChannel(undefined, factory.type);
77
+ return obj;
78
+ }
79
+ /**
80
+ * Creates a Fluid object that has a property with the key `providerKey` that points to itself.
81
+ * @remarks This is useful for creating objects that need to reference themselves, such as DataObjects.
82
+ */
83
+ export function makeFluidObject(object, providerKey) {
84
+ return Object.defineProperty(object, providerKey, { value: object });
85
+ }
86
+ /**
87
+ * Maps CompatibilityMode to a semver valid string that can be passed to the container runtime.
88
+ */
89
+ export const compatibilityModeToMinVersionForCollab = {
90
+ "1": "1.0.0",
91
+ "2": "2.0.0",
92
+ };
93
+ /**
94
+ * Determines if the provided schema is a valid tree-based container schema.
95
+ * @internal
96
+ */
97
+ export function isTreeContainerSchema(schema) {
98
+ const schemaEntries = Object.entries(schema.initialObjects);
99
+ if (schemaEntries.length !== 1) {
100
+ return false;
101
+ }
102
+ const entry = schemaEntries[0] ?? oob();
103
+ const key = entry[0];
104
+ if (key !== "tree") {
105
+ return false;
106
+ }
107
+ const objectKind = entry[1];
108
+ if (isSharedObjectKind(objectKind) &&
109
+ objectKind.getFactory().type === SharedTreeFactoryType) {
110
+ return true;
111
+ }
112
+ return false;
113
+ }
59
114
  //# sourceMappingURL=utils.js.map
package/lib/utils.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"utils.js","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAOH,OAAO,EAAE,UAAU,EAAE,MAAM,0CAA0C,CAAC;AAkBtE;;GAEG;AACH,MAAM,UAAU,gBAAgB,CAC/B,GAAuB;IAEvB,MAAM,KAAK,GAAG,GAA0D,C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QACvC,GAAG,CAAC,MAAM,CAAC,kBAAkB,IAAI,EAAE,CAAC;KACpC,CAAC,CAAC;IACH,KAAK,MAAM,GAAG,IAAI,cAAc,EAAE,CAAC;QAClC,YAAY,CAAC,GAAoC,CAAC,CAAC;IACpD,CAAC;IAED,IAAI,eAAe,CAAC,IAAI,KAAK,CAAC,IAAI,aAAa,CAAC,IAAI,KAAK,CAAC,EAAE,CAAC;QAC5D,MAAM,IAAI,KAAK,CAAC,uDAAuD,CAAC,CAAC;IAC1E,CAAC;IAED,OAAO,CAAC,CAAC,GAAG,eAAe,CAAC,EAAE,CAAC,GAAG,aAAa,CAAC,CAAC,CAAC;AACnD,CAAC,CAAC","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 { IFluidLoadable } from \"@fluidframework/core-interfaces\";\nimport type { IChannelFactory } from \"@fluidframework/datastore-definitions/internal\";\nimport type { NamedFluidDataStoreRegistryEntry } from \"@fluidframework/runtime-definitions/internal\";\nimport type { ISharedObjectKind } from \"@fluidframework/shared-object-base/internal\";\nimport { UsageError } from \"@fluidframework/telemetry-utils/internal\";\n\nimport type { ContainerSchema, LoadableObjectKind } 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"]}
1
+ {"version":3,"file":"utils.js","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAKH,OAAO,EAAE,GAAG,EAAE,MAAM,qCAAqC,CAAC;AAU1D,OAAO,EAAE,UAAU,EAAE,MAAM,0CAA0C,CAAC;AACtE,OAAO,EAAE,qBAAqB,EAAE,MAAM,+BAA+B,CAAC;AAuBtE;;GAEG;AACH,MAAM,UAAU,gBAAgB,CAC/B,GAAuB;IAEvB,MAAM,KAAK,GAAG,GAA0D,CAAC;IACzE,MAAM,YAAY,GACjB,KAAK,EAAE,OAAO,EAAE,sBAAsB,KAAK,SAAS;QACpD,KAAK,CAAC,OAAO,CAAC,sBAAsB,KAAK,KAAK,CAAC,OAAO,CAAC;IAExD,IACC,YAAY;QACZ,CAAE,GAAkD,CAAC,UAAU,KAAK,SAAS,CAAC,EAC7E,CAAC;QACF,8KAA8K;QAC9K,+LAA+L;QAC/L,MAAM,IAAI,UAAU,CAAC,6BAA6B,CAAC,CAAC;IACrD,CAAC;IAED,OAAO,YAAY,CAAC;AACrB,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,kBAAkB,CACjC,GAAuB;IAEvB,OAAO,CAAC,gBAAgB,CAAC,GAAG,CAAC,CAAC;AAC/B,CAAC;AAED;;;;GAIG;AACH,MAAM,CAAC,MAAM,iCAAiC,GAAG,CAChD,MAAuB,EACmC,EAAE;IAC5D,MAAM,eAAe,GAAG,IAAI,GAAG,EAAoC,CAAC;IACpE,MAAM,aAAa,GAAG,IAAI,GAAG,EAAmB,CAAC;IAEjD,MAAM,YAAY,GAAG,CAAC,GAAuB,EAAQ,EAAE;QACtD,IAAI,kBAAkB,CAAC,GAAG,CAAC,EAAE,CAAC;YAC7B,aAAa,CAAC,GAAG,CAAC,GAAG,CAAC,UAAU,EAAE,CAAC,CAAC;QACrC,CAAC;aAA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(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 { MinimumVersionForCollab } from \"@fluidframework/container-runtime/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\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\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 * Maps CompatibilityMode to a semver valid string that can be passed to the container runtime.\n */\nexport const compatibilityModeToMinVersionForCollab = {\n\t\"1\": \"1.0.0\",\n\t\"2\": \"2.0.0\",\n} as const satisfies Record<CompatibilityMode, MinimumVersionForCollab>;\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.50.0-345060",
3
+ "version": "2.51.0-347100",
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": {
@@ -59,33 +59,34 @@
59
59
  "temp-directory": "nyc/.nyc_output"
60
60
  },
61
61
  "dependencies": {
62
- "@fluid-internal/client-utils": "2.50.0-345060",
63
- "@fluidframework/aqueduct": "2.50.0-345060",
64
- "@fluidframework/container-definitions": "2.50.0-345060",
65
- "@fluidframework/container-loader": "2.50.0-345060",
66
- "@fluidframework/container-runtime": "2.50.0-345060",
67
- "@fluidframework/container-runtime-definitions": "2.50.0-345060",
68
- "@fluidframework/core-interfaces": "2.50.0-345060",
69
- "@fluidframework/core-utils": "2.50.0-345060",
70
- "@fluidframework/datastore-definitions": "2.50.0-345060",
71
- "@fluidframework/driver-definitions": "2.50.0-345060",
72
- "@fluidframework/request-handler": "2.50.0-345060",
73
- "@fluidframework/runtime-definitions": "2.50.0-345060",
74
- "@fluidframework/runtime-utils": "2.50.0-345060",
75
- "@fluidframework/shared-object-base": "2.50.0-345060",
76
- "@fluidframework/telemetry-utils": "2.50.0-345060"
62
+ "@fluid-internal/client-utils": "2.51.0-347100",
63
+ "@fluidframework/aqueduct": "2.51.0-347100",
64
+ "@fluidframework/container-definitions": "2.51.0-347100",
65
+ "@fluidframework/container-loader": "2.51.0-347100",
66
+ "@fluidframework/container-runtime": "2.51.0-347100",
67
+ "@fluidframework/container-runtime-definitions": "2.51.0-347100",
68
+ "@fluidframework/core-interfaces": "2.51.0-347100",
69
+ "@fluidframework/core-utils": "2.51.0-347100",
70
+ "@fluidframework/datastore-definitions": "2.51.0-347100",
71
+ "@fluidframework/driver-definitions": "2.51.0-347100",
72
+ "@fluidframework/request-handler": "2.51.0-347100",
73
+ "@fluidframework/runtime-definitions": "2.51.0-347100",
74
+ "@fluidframework/runtime-utils": "2.51.0-347100",
75
+ "@fluidframework/shared-object-base": "2.51.0-347100",
76
+ "@fluidframework/telemetry-utils": "2.51.0-347100",
77
+ "@fluidframework/tree": "2.51.0-347100"
77
78
  },
78
79
  "devDependencies": {
79
80
  "@arethetypeswrong/cli": "^0.17.1",
80
81
  "@biomejs/biome": "~1.9.3",
81
- "@fluid-internal/mocha-test-setup": "2.50.0-345060",
82
+ "@fluid-internal/mocha-test-setup": "2.51.0-347100",
82
83
  "@fluid-tools/build-cli": "^0.56.0",
83
84
  "@fluidframework/build-common": "^2.0.3",
84
85
  "@fluidframework/build-tools": "^0.56.0",
85
86
  "@fluidframework/eslint-config-fluid": "^5.7.4",
86
- "@fluidframework/fluid-static-previous": "npm:@fluidframework/fluid-static@2.43.0",
87
- "@fluidframework/map": "2.50.0-345060",
88
- "@fluidframework/sequence": "2.50.0-345060",
87
+ "@fluidframework/fluid-static-previous": "npm:@fluidframework/fluid-static@2.50.0",
88
+ "@fluidframework/map": "2.51.0-347100",
89
+ "@fluidframework/sequence": "2.51.0-347100",
89
90
  "@microsoft/api-extractor": "7.52.8",
90
91
  "@types/mocha": "^10.0.10",
91
92
  "@types/node": "^18.19.0",
@@ -19,7 +19,7 @@ import type {
19
19
  IFluidLoadable,
20
20
  } from "@fluidframework/core-interfaces";
21
21
  import { assert } from "@fluidframework/core-utils/internal";
22
- import type { SharedObjectKind } from "@fluidframework/shared-object-base";
22
+ import type { SharedObjectKind } from "@fluidframework/shared-object-base/internal";
23
23
 
24
24
  import type {
25
25
  ContainerAttachProps,
package/src/index.ts CHANGED
@@ -19,6 +19,7 @@ export {
19
19
  } from "./fluidContainer.js";
20
20
  export { createDOProviderContainerRuntimeFactory } from "./rootDataObject.js";
21
21
  export { createServiceAudience } from "./serviceAudience.js";
22
+ export { createTreeContainerRuntimeFactory } from "./treeRootDataObject.js";
22
23
  export type {
23
24
  CompatibilityMode,
24
25
  ContainerSchema,
@@ -29,4 +30,6 @@ export type {
29
30
  IServiceAudienceEvents,
30
31
  MemberChangedListener,
31
32
  Myself,
33
+ TreeContainerSchema,
32
34
  } from "./types.js";
35
+ export { isTreeContainerSchema } from "./utils.js";
@@ -6,7 +6,6 @@
6
6
  import {
7
7
  BaseContainerRuntimeFactory,
8
8
  DataObject,
9
- type DataObjectKind,
10
9
  DataObjectFactory,
11
10
  } from "@fluidframework/aqueduct/internal";
12
11
  import type { IRuntimeFactory } from "@fluidframework/container-definitions/internal";
@@ -21,7 +20,6 @@ import type {
21
20
  } from "@fluidframework/container-runtime-definitions/internal";
22
21
  import type {
23
22
  FluidObject,
24
- FluidObjectKeys,
25
23
  IFluidHandle,
26
24
  IFluidLoadable,
27
25
  } from "@fluidframework/core-interfaces";
@@ -29,10 +27,7 @@ import { assert } from "@fluidframework/core-utils/internal";
29
27
  import type { IChannelFactory } from "@fluidframework/datastore-definitions/internal";
30
28
  import type { IDirectory } from "@fluidframework/map/internal";
31
29
  import type { IFluidDataStoreRegistry } from "@fluidframework/runtime-definitions/internal";
32
- import type {
33
- ISharedObjectKind,
34
- SharedObjectKind,
35
- } from "@fluidframework/shared-object-base/internal";
30
+ import type { SharedObjectKind } from "@fluidframework/shared-object-base/internal";
36
31
 
37
32
  import { compatibilityModeRuntimeOptions } from "./compatibilityConfiguration.js";
38
33
  import type {
@@ -45,19 +40,15 @@ import type {
45
40
  LoadableObjectRecord,
46
41
  } from "./types.js";
47
42
  import {
43
+ compatibilityModeToMinVersionForCollab,
44
+ createDataObject,
45
+ createSharedObject,
48
46
  isDataObjectKind,
49
47
  isSharedObjectKind,
48
+ makeFluidObject,
50
49
  parseDataObjectsFromSharedObjects,
51
50
  } from "./utils.js";
52
51
 
53
- /**
54
- * Maps CompatibilityMode to a semver valid string that can be passed to the container runtime.
55
- */
56
- const compatibilityModeToMinVersionForCollab = {
57
- "1": "1.0.0",
58
- "2": "2.0.0",
59
- } as const satisfies Record<CompatibilityMode, MinimumVersionForCollab>;
60
-
61
52
  /**
62
53
  * Input props for {@link RootDataObject.initializingFirstTime}.
63
54
  */
@@ -152,9 +143,9 @@ class RootDataObject
152
143
  public async create<T>(objectClass: SharedObjectKind<T>): Promise<T> {
153
144
  const internal = objectClass as unknown as LoadableObjectKind<T & IFluidLoadable>;
154
145
  if (isDataObjectKind(internal)) {
155
- return this.createDataObject(internal);
146
+ return createDataObject(internal, this.context);
156
147
  } else if (isSharedObjectKind(internal)) {
157
- return this.createSharedObject(internal);
148
+ return createSharedObject(internal, this.runtime);
158
149
  }
159
150
  throw new Error("Could not create new Fluid object because an unknown object was passed");
160
151
  }
@@ -162,32 +153,37 @@ class RootDataObject
162
153
  public async uploadBlob(blob: ArrayBufferLike): Promise<IFluidHandle<ArrayBufferLike>> {
163
154
  return this.runtime.uploadBlob(blob);
164
155
  }
156
+ }
165
157
 
166
- private async createDataObject<T extends IFluidLoadable>(
167
- dataObjectClass: DataObjectKind<T>,
168
- ): Promise<T> {
169
- const factory = dataObjectClass.factory;
170
- const packagePath = [...this.context.packagePath, factory.type];
171
- const dataStore = await this.context.containerRuntime.createDataStore(packagePath);
172
- const entryPoint = await dataStore.entryPoint.get();
173
- return entryPoint as T;
174
- }
158
+ const rootDataStoreId = "rootDOId";
159
+ const rootDataObjectType = "rootDO";
175
160
 
176
- private createSharedObject<T extends IFluidLoadable>(
177
- sharedObjectClass: ISharedObjectKind<T>,
178
- ): T {
179
- const factory = sharedObjectClass.getFactory();
180
- const obj = this.runtime.createChannel(undefined, factory.type);
181
- return obj as unknown as T;
161
+ async function provideEntryPoint(
162
+ containerRuntime: IContainerRuntime,
163
+ ): Promise<IStaticEntryPoint> {
164
+ const entryPoint = await containerRuntime.getAliasedDataStoreEntryPoint(rootDataStoreId);
165
+ if (entryPoint === undefined) {
166
+ throw new Error(`default dataStore [${rootDataStoreId}] must exist`);
182
167
  }
168
+ const rootDataObject = ((await entryPoint.get()) as FluidObject<RootDataObject>)
169
+ .RootDataObject;
170
+ assert(rootDataObject !== undefined, 0xb9f /* entryPoint must be of type RootDataObject */);
171
+ return makeFluidObject<IStaticEntryPoint>(
172
+ {
173
+ rootDataObject,
174
+ extensionStore: containerRuntime as IContainerRuntimeInternal,
175
+ },
176
+ "IStaticEntryPoint",
177
+ );
183
178
  }
184
179
 
185
- const rootDataStoreId = "rootDOId";
186
-
187
180
  /**
188
- * Creates an {@link @fluidframework/aqueduct#BaseContainerRuntimeFactory} which constructs containers
189
- * with an entry point containing single IRootDataObject (entry point is opaque to caller),
190
- * where the root data object's registry and initial objects are configured based on the provided
181
+ * Creates an {@link @fluidframework/aqueduct#IRuntimeFactory} which constructs containers
182
+ * with an entry point containing single directory-based root data object.
183
+ *
184
+ * @remarks
185
+ * The entry point is opaque to caller.
186
+ * The root data object's registry and initial objects are configured based on the provided
191
187
  * schema (and optionally, data store registry).
192
188
  *
193
189
  * @internal
@@ -219,46 +215,27 @@ export function createDOProviderContainerRuntimeFactory(props: {
219
215
  */
220
216
  minVersionForCollabOverride?: MinimumVersionForCollab;
221
217
  }): IRuntimeFactory {
222
- const [registryEntries, sharedObjects] = parseDataObjectsFromSharedObjects(props.schema);
223
- const registry = props.rootDataStoreRegistry ?? new FluidDataStoreRegistry(registryEntries);
218
+ const {
219
+ compatibilityMode,
220
+ minVersionForCollabOverride,
221
+ rootDataStoreRegistry,
222
+ runtimeOptionOverrides,
223
+ schema,
224
+ } = props;
225
+ const [registryEntries, sharedObjects] = parseDataObjectsFromSharedObjects(schema);
226
+ const registry = rootDataStoreRegistry ?? new FluidDataStoreRegistry(registryEntries);
224
227
 
225
228
  return new DOProviderContainerRuntimeFactory(
226
- props.schema,
227
- props.compatibilityMode,
229
+ schema,
230
+ compatibilityMode,
228
231
  new RootDataObjectFactory(sharedObjects, registry),
229
232
  {
230
- runtimeOptions: props.runtimeOptionOverrides,
231
- minVersionForCollab: props.minVersionForCollabOverride,
233
+ runtimeOptions: runtimeOptionOverrides,
234
+ minVersionForCollab: minVersionForCollabOverride,
232
235
  },
233
236
  );
234
237
  }
235
238
 
236
- function makeFluidObject<T extends object, K extends FluidObjectKeys<T> = FluidObjectKeys<T>>(
237
- object: Omit<T, K>,
238
- providerKey: K,
239
- ): T {
240
- return Object.defineProperty(object, providerKey, { value: object }) as T;
241
- }
242
-
243
- async function provideEntryPoint(
244
- containerRuntime: IContainerRuntime,
245
- ): Promise<IStaticEntryPoint> {
246
- const entryPoint = await containerRuntime.getAliasedDataStoreEntryPoint(rootDataStoreId);
247
- if (entryPoint === undefined) {
248
- throw new Error(`default dataStore [${rootDataStoreId}] must exist`);
249
- }
250
- const rootDataObject = ((await entryPoint.get()) as FluidObject<RootDataObject>)
251
- .RootDataObject;
252
- assert(rootDataObject !== undefined, 0xb9f /* entryPoint must be of type RootDataObject */);
253
- return makeFluidObject<IStaticEntryPoint>(
254
- {
255
- rootDataObject,
256
- extensionStore: containerRuntime as IContainerRuntimeInternal,
257
- },
258
- "IStaticEntryPoint",
259
- );
260
- }
261
-
262
239
  /**
263
240
  * Factory for Container Runtime instances that provide a {@link IStaticEntryPoint}
264
241
  * (containing single {@link IRootDataObject}) as their entry point.
@@ -336,7 +313,7 @@ class RootDataObjectFactory extends DataObjectFactory<
336
313
  // Note: we're passing `undefined` registry entries to the base class so it won't create a registry itself,
337
314
  // and instead we override the necessary methods in this class to use the registry received in the constructor.
338
315
  super({
339
- type: "rootDO",
316
+ type: rootDataObjectType,
340
317
  ctor: RootDataObject,
341
318
  sharedObjects,
342
319
  });