@fluidframework/fluid-static 2.0.0-rc.4.0.6 → 2.0.0-rc.5.0.1

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 (68) hide show
  1. package/CHANGELOG.md +46 -0
  2. package/api-extractor/api-extractor-lint-bundle.json +5 -0
  3. package/api-extractor/api-extractor-lint-public.cjs.json +5 -0
  4. package/api-extractor/api-extractor-lint-public.esm.json +5 -0
  5. package/api-extractor.json +1 -1
  6. package/api-report/{fluid-static.api.md → fluid-static.alpha.api.md} +15 -57
  7. package/api-report/fluid-static.beta.api.md +94 -0
  8. package/api-report/fluid-static.public.api.md +94 -0
  9. package/biome.jsonc +4 -0
  10. package/dist/compatibilityConfiguration.d.ts +12 -0
  11. package/dist/compatibilityConfiguration.d.ts.map +1 -0
  12. package/dist/compatibilityConfiguration.js +38 -0
  13. package/dist/compatibilityConfiguration.js.map +1 -0
  14. package/dist/fluidContainer.d.ts +22 -10
  15. package/dist/fluidContainer.d.ts.map +1 -1
  16. package/dist/fluidContainer.js.map +1 -1
  17. package/dist/index.d.ts +1 -1
  18. package/dist/index.d.ts.map +1 -1
  19. package/dist/index.js.map +1 -1
  20. package/dist/public.d.ts +1 -3
  21. package/dist/rootDataObject.d.ts +4 -3
  22. package/dist/rootDataObject.d.ts.map +1 -1
  23. package/dist/rootDataObject.js +11 -18
  24. package/dist/rootDataObject.js.map +1 -1
  25. package/dist/serviceAudience.d.ts +3 -3
  26. package/dist/serviceAudience.d.ts.map +1 -1
  27. package/dist/serviceAudience.js.map +1 -1
  28. package/dist/types.d.ts +19 -21
  29. package/dist/types.d.ts.map +1 -1
  30. package/dist/types.js.map +1 -1
  31. package/dist/utils.d.ts +7 -14
  32. package/dist/utils.d.ts.map +1 -1
  33. package/dist/utils.js.map +1 -1
  34. package/lib/compatibilityConfiguration.d.ts +12 -0
  35. package/lib/compatibilityConfiguration.d.ts.map +1 -0
  36. package/lib/compatibilityConfiguration.js +35 -0
  37. package/lib/compatibilityConfiguration.js.map +1 -0
  38. package/lib/fluidContainer.d.ts +22 -10
  39. package/lib/fluidContainer.d.ts.map +1 -1
  40. package/lib/fluidContainer.js.map +1 -1
  41. package/lib/index.d.ts +1 -1
  42. package/lib/index.d.ts.map +1 -1
  43. package/lib/index.js.map +1 -1
  44. package/lib/public.d.ts +1 -3
  45. package/lib/rootDataObject.d.ts +4 -3
  46. package/lib/rootDataObject.d.ts.map +1 -1
  47. package/lib/rootDataObject.js +9 -16
  48. package/lib/rootDataObject.js.map +1 -1
  49. package/lib/serviceAudience.d.ts +3 -3
  50. package/lib/serviceAudience.d.ts.map +1 -1
  51. package/lib/serviceAudience.js.map +1 -1
  52. package/lib/tsdoc-metadata.json +1 -1
  53. package/lib/types.d.ts +19 -21
  54. package/lib/types.d.ts.map +1 -1
  55. package/lib/types.js.map +1 -1
  56. package/lib/utils.d.ts +7 -14
  57. package/lib/utils.d.ts.map +1 -1
  58. package/lib/utils.js.map +1 -1
  59. package/package.json +49 -29
  60. package/src/compatibilityConfiguration.ts +44 -0
  61. package/src/fluidContainer.ts +24 -21
  62. package/src/index.ts +13 -15
  63. package/src/rootDataObject.ts +38 -41
  64. package/src/serviceAudience.ts +5 -10
  65. package/src/types.ts +20 -23
  66. package/src/utils.ts +10 -22
  67. package/tsconfig.json +1 -0
  68. package/tsdoc.json +4 -0
package/lib/utils.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"utils.js","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":"AAAA;;;GAGG;AASH,OAAO,EAAE,UAAU,EAAE,MAAM,0CAA0C,CAAC;AA2BtE;;GAEG;AACH,MAAM,UAAU,iBAAiB,CAChC,GAAwB;IAExB,MAAM,KAAK,GAAG,GAAmE,CAAC;IAClF,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;QACD,8KAA8K;QAC9K,+LAA+L;QAC/L,MAAM,IAAI,UAAU,CAAC,6BAA6B,CAAC,CAAC;KACpD;IAED,OAAO,YAAY,CAAC;AACrB,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,kBAAkB,CACjC,GAAwB;IAExB,OAAO,CAAC,iBAAiB,CAAC,GAAG,CAAC,CAAC;AAChC,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,GAAwB,EAAQ,EAAE;QACvD,IAAI,kBAAkB,CAAC,GAAG,CAAC,EAAE;YAC5B,aAAa,CAAC,GAAG,CAAC,GAAG,CAAC,UAAU,EAAE,CAAC,CAAC;SACpC;aAAM,IAAI,iBAAiB,CAAC,GAAG,CAAC,EAAE;YAClC,eAAe,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,IAAI,EAAE,OAAO,CAAC,OAAO,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC;SACtE;aAAM;YACN,MAAM,IAAI,KAAK,CAAC,iDAAiD,CAAC,CAAC;SACnE;IACF,CAAC,CAAC;IAEF,gDAAgD;IAChD,MAAM,cAAc,GAAG,IAAI,GAAG,CAAC;QAC9B,GAAG,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,cAAc,CAAC;QACvC,GAAG,CAAC,MAAM,CAAC,kBAAkB,IAAI,EAAE,CAAC;KACpC,CAAC,CAAC;IACH,KAAK,MAAM,GAAG,IAAI,cAAc,EAAE;QACjC,YAAY,CAAC,GAAG,CAAC,CAAC;KAClB;IAED,IAAI,eAAe,CAAC,IAAI,KAAK,CAAC,IAAI,aAAa,CAAC,IAAI,KAAK,CAAC,EAAE;QAC3D,MAAM,IAAI,KAAK,CAAC,uDAAuD,CAAC,CAAC;KACzE;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 IFluidLoadable } from \"@fluidframework/core-interfaces\";\nimport { type IChannelFactory } from \"@fluidframework/datastore-definitions\";\nimport {\n\ttype IFluidDataStoreFactory,\n\ttype NamedFluidDataStoreRegistryEntry,\n} from \"@fluidframework/runtime-definitions/internal\";\nimport type { ISharedObjectKind } from \"@fluidframework/shared-object-base\";\nimport { UsageError } from \"@fluidframework/telemetry-utils/internal\";\n\nimport { type ContainerSchema, type DataObjectClass, type LoadableObjectClass } from \"./types.js\";\n\n/**\n * An internal type used by the internal type guard isDataObjectClass to cast a\n * DataObjectClass to a type that is strongly coupled to IFluidDataStoreFactory.\n * Unlike the external and exported type DataObjectClass which is\n * weakly coupled to the IFluidDataStoreFactory to prevent leaking internals.\n */\nexport type InternalDataObjectClass<T extends IFluidLoadable> = DataObjectClass<T> &\n\tRecord<\"factory\", IFluidDataStoreFactory>;\n\n/**\n * Runtime check to determine if a class is a DataObject type.\n */\nexport function isDataObjectClass<T extends IFluidLoadable>(\n\tobj: LoadableObjectClass<T>,\n): obj is InternalDataObjectClass<T>;\n\n/**\n * Runtime check to determine if a class is a DataObject type.\n */\nexport function isDataObjectClass(\n\tobj: LoadableObjectClass,\n): obj is InternalDataObjectClass<IFluidLoadable>;\n\n/**\n * Runtime check to determine if a class is a DataObject type.\n */\nexport function isDataObjectClass(\n\tobj: LoadableObjectClass,\n): obj is InternalDataObjectClass<IFluidLoadable> {\n\tconst maybe = obj as Partial<InternalDataObjectClass<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: LoadableObjectClass,\n): obj is ISharedObjectKind<IFluidLoadable> {\n\treturn !isDataObjectClass(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: LoadableObjectClass): void => {\n\t\tif (isSharedObjectKind(obj)) {\n\t\t\tsharedObjects.add(obj.getFactory());\n\t\t} else if (isDataObjectClass(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);\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;AAMH,OAAO,EAAE,UAAU,EAAE,MAAM,0CAA0C,CAAC;AAkBtE;;GAEG;AACH,MAAM,UAAU,iBAAiB,CAChC,GAAwB;IAExB,MAAM,KAAK,GAAG,GAA2D,CAAC;IAC1E,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,GAAwB;IAExB,OAAO,CAAC,iBAAiB,CAAC,GAAG,CAAC,CAAC;AAChC,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,GAAwB,EAAQ,EAAE;QACvD,IAAI,kBAAkB,CAAC,GAAG,CAAC,EAAE,CAAC;YAC7B,aAAa,CAAC,GAAG,CAAC,GAAG,CAAC,UAAU,EAAE,CAAC,CAAC;QACrC,CAAC;aAAM,IAAI,iBAAiB,CAAC,GAAG,CAAC,EAAE,CAAC;YACnC,eAAe,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,IAAI,EAAE,OAAO,CAAC,OAAO,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC;QACvE,CAAC;aAAM,CAAC;YACP,MAAM,IAAI,KAAK,CAAC,iDAAiD,CAAC,CAAC;QACpE,CAAC;IACF,CAAC,CAAC;IAEF,gDAAgD;IAChD,MAAM,cAAc,GAAG,IAAI,GAAG,CAAC;QAC9B,GAAG,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,cAAc,CAAC;QACvC,GAAG,CAAC,MAAM,CAAC,kBAAkB,IAAI,EAAE,CAAC;KACpC,CAAC,CAAC;IACH,KAAK,MAAM,GAAG,IAAI,cAAc,EAAE,CAAC;QAClC,YAAY,CAAC,GAAqC,CAAC,CAAC;IACrD,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 { 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, DataObjectClass, LoadableObjectClass } from \"./types.js\";\n\n/**\n * Runtime check to determine if a class is a DataObject type.\n */\nexport function isDataObjectClass<T extends IFluidLoadable>(\n\tobj: LoadableObjectClass<T>,\n): obj is DataObjectClass<T>;\n\n/**\n * Runtime check to determine if a class is a DataObject type.\n */\nexport function isDataObjectClass(\n\tobj: LoadableObjectClass,\n): obj is DataObjectClass<IFluidLoadable>;\n\n/**\n * Runtime check to determine if a class is a DataObject type.\n */\nexport function isDataObjectClass(\n\tobj: LoadableObjectClass,\n): obj is DataObjectClass<IFluidLoadable> {\n\tconst maybe = obj as Partial<DataObjectClass<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: LoadableObjectClass,\n): obj is ISharedObjectKind<IFluidLoadable> {\n\treturn !isDataObjectClass(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: LoadableObjectClass): void => {\n\t\tif (isSharedObjectKind(obj)) {\n\t\t\tsharedObjects.add(obj.getFactory());\n\t\t} else if (isDataObjectClass(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 LoadableObjectClass);\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"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fluidframework/fluid-static",
3
- "version": "2.0.0-rc.4.0.6",
3
+ "version": "2.0.0-rc.5.0.1",
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": {
@@ -57,36 +57,37 @@
57
57
  "temp-directory": "nyc/.nyc_output"
58
58
  },
59
59
  "dependencies": {
60
- "@fluid-internal/client-utils": ">=2.0.0-rc.4.0.6 <2.0.0-rc.4.1.0",
61
- "@fluidframework/aqueduct": ">=2.0.0-rc.4.0.6 <2.0.0-rc.4.1.0",
62
- "@fluidframework/container-definitions": ">=2.0.0-rc.4.0.6 <2.0.0-rc.4.1.0",
63
- "@fluidframework/container-loader": ">=2.0.0-rc.4.0.6 <2.0.0-rc.4.1.0",
64
- "@fluidframework/container-runtime": ">=2.0.0-rc.4.0.6 <2.0.0-rc.4.1.0",
65
- "@fluidframework/container-runtime-definitions": ">=2.0.0-rc.4.0.6 <2.0.0-rc.4.1.0",
66
- "@fluidframework/core-interfaces": ">=2.0.0-rc.4.0.6 <2.0.0-rc.4.1.0",
67
- "@fluidframework/datastore-definitions": ">=2.0.0-rc.4.0.6 <2.0.0-rc.4.1.0",
68
- "@fluidframework/protocol-definitions": "^3.2.0",
69
- "@fluidframework/request-handler": ">=2.0.0-rc.4.0.6 <2.0.0-rc.4.1.0",
70
- "@fluidframework/runtime-definitions": ">=2.0.0-rc.4.0.6 <2.0.0-rc.4.1.0",
71
- "@fluidframework/runtime-utils": ">=2.0.0-rc.4.0.6 <2.0.0-rc.4.1.0",
72
- "@fluidframework/shared-object-base": ">=2.0.0-rc.4.0.6 <2.0.0-rc.4.1.0",
73
- "@fluidframework/telemetry-utils": ">=2.0.0-rc.4.0.6 <2.0.0-rc.4.1.0"
60
+ "@fluid-internal/client-utils": ">=2.0.0-rc.5.0.1 <2.0.0-rc.5.1.0",
61
+ "@fluidframework/aqueduct": ">=2.0.0-rc.5.0.1 <2.0.0-rc.5.1.0",
62
+ "@fluidframework/container-definitions": ">=2.0.0-rc.5.0.1 <2.0.0-rc.5.1.0",
63
+ "@fluidframework/container-loader": ">=2.0.0-rc.5.0.1 <2.0.0-rc.5.1.0",
64
+ "@fluidframework/container-runtime": ">=2.0.0-rc.5.0.1 <2.0.0-rc.5.1.0",
65
+ "@fluidframework/container-runtime-definitions": ">=2.0.0-rc.5.0.1 <2.0.0-rc.5.1.0",
66
+ "@fluidframework/core-interfaces": ">=2.0.0-rc.5.0.1 <2.0.0-rc.5.1.0",
67
+ "@fluidframework/datastore-definitions": ">=2.0.0-rc.5.0.1 <2.0.0-rc.5.1.0",
68
+ "@fluidframework/driver-definitions": ">=2.0.0-rc.5.0.1 <2.0.0-rc.5.1.0",
69
+ "@fluidframework/request-handler": ">=2.0.0-rc.5.0.1 <2.0.0-rc.5.1.0",
70
+ "@fluidframework/runtime-definitions": ">=2.0.0-rc.5.0.1 <2.0.0-rc.5.1.0",
71
+ "@fluidframework/runtime-utils": ">=2.0.0-rc.5.0.1 <2.0.0-rc.5.1.0",
72
+ "@fluidframework/shared-object-base": ">=2.0.0-rc.5.0.1 <2.0.0-rc.5.1.0",
73
+ "@fluidframework/telemetry-utils": ">=2.0.0-rc.5.0.1 <2.0.0-rc.5.1.0"
74
74
  },
75
75
  "devDependencies": {
76
76
  "@arethetypeswrong/cli": "^0.15.2",
77
- "@biomejs/biome": "^1.6.2",
78
- "@fluid-internal/mocha-test-setup": ">=2.0.0-rc.4.0.6 <2.0.0-rc.4.1.0",
79
- "@fluid-tools/build-cli": "^0.38.0",
77
+ "@biomejs/biome": "^1.7.3",
78
+ "@fluid-internal/mocha-test-setup": ">=2.0.0-rc.5.0.1 <2.0.0-rc.5.1.0",
79
+ "@fluid-tools/build-cli": "^0.39.0",
80
80
  "@fluidframework/build-common": "^2.0.3",
81
- "@fluidframework/build-tools": "^0.38.0",
82
- "@fluidframework/eslint-config-fluid": "^5.1.0",
83
- "@fluidframework/fluid-static-previous": "npm:@fluidframework/fluid-static@2.0.0-rc.3.0.0",
84
- "@fluidframework/map": ">=2.0.0-rc.4.0.6 <2.0.0-rc.4.1.0",
85
- "@fluidframework/sequence": ">=2.0.0-rc.4.0.6 <2.0.0-rc.4.1.0",
86
- "@microsoft/api-extractor": "^7.43.1",
81
+ "@fluidframework/build-tools": "^0.39.0",
82
+ "@fluidframework/eslint-config-fluid": "^5.3.0",
83
+ "@fluidframework/fluid-static-previous": "npm:@fluidframework/fluid-static@2.0.0-rc.4.0.0",
84
+ "@fluidframework/map": ">=2.0.0-rc.5.0.1 <2.0.0-rc.5.1.0",
85
+ "@fluidframework/sequence": ">=2.0.0-rc.5.0.1 <2.0.0-rc.5.1.0",
86
+ "@microsoft/api-extractor": "^7.45.1",
87
87
  "@types/mocha": "^9.1.1",
88
88
  "@types/node": "^18.19.0",
89
89
  "c8": "^8.0.1",
90
+ "concurrently": "^8.2.1",
90
91
  "copyfiles": "^2.4.1",
91
92
  "cross-env": "^7.0.3",
92
93
  "eslint": "~8.55.0",
@@ -96,17 +97,30 @@
96
97
  "moment": "^2.21.0",
97
98
  "prettier": "~3.0.3",
98
99
  "rimraf": "^4.4.0",
99
- "typescript": "~5.1.6"
100
+ "typescript": "~5.4.5"
100
101
  },
101
102
  "typeValidation": {
102
103
  "broken": {
103
- "InterfaceDeclaration_IMember": {
104
+ "RemovedTypeAliasDeclaration_DataObjectClass": {
104
105
  "forwardCompat": false,
105
106
  "backCompat": false
106
107
  },
107
- "TypeAliasDeclaration_Myself": {
108
+ "InterfaceDeclaration_IFluidContainer": {
109
+ "backCompat": false
110
+ },
111
+ "TypeAliasDeclaration_InitialObjects": {
112
+ "backCompat": false
113
+ },
114
+ "RemovedTypeAliasDeclaration_LoadableObjectClass": {
108
115
  "forwardCompat": false,
109
116
  "backCompat": false
117
+ },
118
+ "RemovedTypeAliasDeclaration_LoadableObjectClassRecord": {
119
+ "forwardCompat": false,
120
+ "backCompat": false
121
+ },
122
+ "InterfaceDeclaration_ContainerSchema": {
123
+ "backCompat": false
110
124
  }
111
125
  }
112
126
  },
@@ -123,13 +137,19 @@
123
137
  "build:test:cjs": "fluid-tsc commonjs --project ./src/test/tsconfig.cjs.json",
124
138
  "build:test:esm": "tsc --project ./src/test/tsconfig.json",
125
139
  "check:are-the-types-wrong": "attw --pack .",
140
+ "check:biome": "biome check . --formatter-enabled=true",
141
+ "check:exports": "concurrently \"npm:check:exports:*\"",
142
+ "check:exports:bundle-release-tags": "api-extractor run --config api-extractor/api-extractor-lint-bundle.json",
143
+ "check:exports:cjs:public": "api-extractor run --config api-extractor/api-extractor-lint-public.cjs.json",
144
+ "check:exports:esm:public": "api-extractor run --config api-extractor/api-extractor-lint-public.esm.json",
145
+ "check:format": "npm run check:biome",
126
146
  "check:prettier": "prettier --check . --cache --ignore-path ../../../.prettierignore",
127
- "check:release-tags": "api-extractor run --local --config ./api-extractor-lint.json",
128
147
  "ci:build:docs": "api-extractor run",
129
148
  "clean": "rimraf --glob dist lib \"*.d.ts\" \"**/*.tsbuildinfo\" \"**/*.build.log\" _api-extractor-temp nyc",
130
149
  "eslint": "eslint --format stylish src",
131
150
  "eslint:fix": "eslint --format stylish src --fix --fix-type problem,suggestion,layout",
132
- "format": "fluid-build --task format .",
151
+ "format": "npm run format:biome",
152
+ "format:biome": "biome check . --formatter-enabled=true --apply",
133
153
  "format:prettier": "prettier --write . --cache --ignore-path ../../../.prettierignore",
134
154
  "lint": "fluid-build . --task lint",
135
155
  "lint:fix": "fluid-build . --task eslint:fix --task format",
@@ -0,0 +1,44 @@
1
+ /*!
2
+ * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
3
+ * Licensed under the MIT License.
4
+ */
5
+
6
+ import {
7
+ CompressionAlgorithms,
8
+ type IContainerRuntimeOptions,
9
+ } from "@fluidframework/container-runtime/internal";
10
+ import { FlushMode } from "@fluidframework/runtime-definitions/internal";
11
+
12
+ import type { CompatibilityMode } from "./types.js";
13
+
14
+ /**
15
+ * The CompatibilityMode selected determines the set of runtime options to use. In "1" mode we support
16
+ * full interop with true 1.x clients, while in "2" mode we only support interop with 2.x clients.
17
+ */
18
+ export const compatibilityModeRuntimeOptions: Record<
19
+ CompatibilityMode,
20
+ IContainerRuntimeOptions
21
+ > = {
22
+ "1": {
23
+ // 1.x clients are compatible with TurnBased flushing, but here we elect to remain on Immediate flush mode
24
+ // as a work-around for inability to send batches larger than 1Mb. Immediate flushing keeps batches smaller as
25
+ // fewer messages will be included per flush.
26
+ flushMode: FlushMode.Immediate,
27
+ // Op compression is on by default but introduces a new type of op which is not compatible with 1.x clients.
28
+ compressionOptions: {
29
+ minimumBatchSizeInBytes: Number.POSITIVE_INFINITY, // disabled
30
+ compressionAlgorithm: CompressionAlgorithms.lz4,
31
+ },
32
+ // Grouped batching is on by default but introduces a new type of op which is not compatible with 1.x clients.
33
+ enableGroupedBatching: false,
34
+ // TODO: Include explicit disables for things that are currently off-by-default?
35
+ },
36
+ "2": {
37
+ // Explicit schema control explicitly makes the container incompatible with 1.x clients, to force their
38
+ // ejection from collaboration and prevent container corruption. It is off by default and must be explicitly enabled.
39
+ explicitSchemaControl: true,
40
+ // The runtime ID compressor is a prerequisite to use SharedTree but is off by default and must be explicitly enabled.
41
+ // It introduces a new type of op which is not compatible with 1.x clients.
42
+ enableRuntimeIdCompressor: "on",
43
+ },
44
+ };
@@ -9,19 +9,11 @@ import {
9
9
  type ConnectionState,
10
10
  type ICriticalContainerError,
11
11
  } from "@fluidframework/container-definitions";
12
- import { type IContainer } from "@fluidframework/container-definitions/internal";
13
- import {
14
- type IEvent,
15
- type IEventProvider,
16
- type IFluidLoadable,
17
- } from "@fluidframework/core-interfaces";
18
-
19
- import type {
20
- ContainerAttachProps,
21
- ContainerSchema,
22
- IRootDataObject,
23
- LoadableObjectClass,
24
- } from "./types.js";
12
+ import type { IContainer } from "@fluidframework/container-definitions/internal";
13
+ import type { IEvent, IEventProvider, IFluidLoadable } from "@fluidframework/core-interfaces";
14
+ import type { SharedObjectKind } from "@fluidframework/shared-object-base";
15
+
16
+ import type { ContainerAttachProps, ContainerSchema, IRootDataObject } from "./types.js";
25
17
 
26
18
  /**
27
19
  * Extract the type of 'initialObjects' from the given {@link ContainerSchema} type.
@@ -33,7 +25,7 @@ export type InitialObjects<T extends ContainerSchema> = {
33
25
  //
34
26
  // The '? TChannel : never' is required because infer can only be used in
35
27
  // a conditional 'extends' expression.
36
- [K in keyof T["initialObjects"]]: T["initialObjects"][K] extends LoadableObjectClass<
28
+ [K in keyof T["initialObjects"]]: T["initialObjects"][K] extends SharedObjectKind<
37
29
  infer TChannel
38
30
  >
39
31
  ? TChannel
@@ -209,17 +201,28 @@ export interface IFluidContainer<TContainerSchema extends ContainerSchema = Cont
209
201
  /**
210
202
  * Create a new data object or Distributed Data Store (DDS) of the specified type.
211
203
  *
204
+ * @param objectClass - The class of the `DataObject` or `SharedObject` to create.
205
+ *
206
+ * @typeParam T - The class of the `DataObject` or `SharedObject`.
207
+ *
212
208
  * @remarks
213
209
  *
214
- * In order to share the data object or DDS with other
215
- * collaborators and retrieve it later, store its handle in a collection like a SharedDirectory from your
216
- * initialObjects.
210
+ * In order to share the data object or DDS with other collaborators and retrieve it later,
211
+ * store its handle in a collection like a SharedDirectory from your initialObjects.
212
+ * It's typically a good idea to set any initial state on the object before doing so,
213
+ * as it is both more efficient and helpful to maintain domain model invariants
214
+ * (e.g. this approach easily allows state to only be set once).
217
215
  *
218
- * @param objectClass - The class of the `DataObject` or `SharedObject` to create.
216
+ * @example
219
217
  *
220
- * @typeParam T - The class of the `DataObject` or `SharedObject`.
218
+ * ```typescript
219
+ * const existingDirectory = container.initialObjects.myDirectory;
220
+ * const map = await container.create(SharedMap);
221
+ * map.set("initialState", "someValue");
222
+ * existingDirectory.set("myMap", map.handle);
223
+ * ```
221
224
  */
222
- create<T extends IFluidLoadable>(objectClass: LoadableObjectClass<T>): Promise<T>;
225
+ create<T extends IFluidLoadable>(objectClass: SharedObjectKind<T>): Promise<T>;
223
226
 
224
227
  /**
225
228
  * Dispose of the container instance, permanently disabling it.
@@ -347,7 +350,7 @@ class FluidContainer<TContainerSchema extends ContainerSchema = ContainerSchema>
347
350
  /**
348
351
  * {@inheritDoc IFluidContainer.create}
349
352
  */
350
- public async create<T extends IFluidLoadable>(objectClass: LoadableObjectClass<T>): Promise<T> {
353
+ public async create<T extends IFluidLoadable>(objectClass: SharedObjectKind<T>): Promise<T> {
351
354
  return this.rootDataObject.create(objectClass);
352
355
  }
353
356
 
package/src/index.ts CHANGED
@@ -17,19 +17,17 @@ export {
17
17
  } from "./fluidContainer.js";
18
18
  export { createDOProviderContainerRuntimeFactory } from "./rootDataObject.js";
19
19
  export { createServiceAudience } from "./serviceAudience.js";
20
- export {
21
- type ContainerSchema,
22
- type ContainerAttachProps,
23
- type DataObjectClass,
24
- type IConnection,
25
- type IMember,
26
- type IRootDataObject,
27
- type IServiceAudience,
28
- type IServiceAudienceEvents,
29
- type LoadableObjectClass,
30
- type LoadableObjectClassRecord,
31
- type LoadableObjectRecord,
32
- type MemberChangedListener,
33
- type Myself,
34
- type IProvideRootDataObject,
20
+ export type {
21
+ CompatibilityMode,
22
+ ContainerSchema,
23
+ ContainerAttachProps,
24
+ IConnection,
25
+ IMember,
26
+ IProvideRootDataObject,
27
+ IRootDataObject,
28
+ IServiceAudience,
29
+ IServiceAudienceEvents,
30
+ LoadableObjectRecord,
31
+ MemberChangedListener,
32
+ Myself,
35
33
  } from "./types.js";
@@ -8,29 +8,31 @@ import {
8
8
  DataObject,
9
9
  DataObjectFactory,
10
10
  } from "@fluidframework/aqueduct/internal";
11
- import { type IRuntimeFactory } from "@fluidframework/container-definitions/internal";
12
- import { type ContainerRuntime } from "@fluidframework/container-runtime/internal";
13
- import { type IContainerRuntime } from "@fluidframework/container-runtime-definitions/internal";
14
- import {
15
- type FluidObject,
16
- type IFluidLoadable,
17
- type IRequest,
18
- type IResponse,
11
+ import type { IRuntimeFactory } from "@fluidframework/container-definitions/internal";
12
+ import type { ContainerRuntime } from "@fluidframework/container-runtime/internal";
13
+ import type { IContainerRuntime } from "@fluidframework/container-runtime-definitions/internal";
14
+ import type {
15
+ FluidObject,
16
+ IFluidLoadable,
17
+ IRequest,
18
+ IResponse,
19
19
  } from "@fluidframework/core-interfaces";
20
- import { type IDirectory } from "@fluidframework/map/internal";
21
- import { FlushMode } from "@fluidframework/runtime-definitions/internal";
20
+ import type { IDirectory } from "@fluidframework/map/internal";
22
21
  import { RequestParser } from "@fluidframework/runtime-utils/internal";
23
- import type { ISharedObjectKind } from "@fluidframework/shared-object-base";
24
-
25
- import {
26
- type ContainerSchema,
27
- type IRootDataObject,
28
- type LoadableObjectClass,
29
- type LoadableObjectClassRecord,
30
- type LoadableObjectRecord,
22
+ import type { SharedObjectKind } from "@fluidframework/shared-object-base";
23
+ import type { ISharedObjectKind } from "@fluidframework/shared-object-base/internal";
24
+
25
+ import { compatibilityModeRuntimeOptions } from "./compatibilityConfiguration.js";
26
+ import type {
27
+ CompatibilityMode,
28
+ ContainerSchema,
29
+ DataObjectClass,
30
+ IRootDataObject,
31
+ LoadableObjectClass,
32
+ LoadableObjectClassRecord,
33
+ LoadableObjectRecord,
31
34
  } from "./types.js";
32
35
  import {
33
- type InternalDataObjectClass,
34
36
  isDataObjectClass,
35
37
  isSharedObjectKind,
36
38
  parseDataObjectsFromSharedObjects,
@@ -45,7 +47,7 @@ export interface RootDataObjectProps {
45
47
  *
46
48
  * @see {@link RootDataObject.initializingFirstTime}
47
49
  */
48
- initialObjects: LoadableObjectClassRecord;
50
+ readonly initialObjects: LoadableObjectClassRecord;
49
51
  }
50
52
 
51
53
  /**
@@ -84,7 +86,9 @@ class RootDataObject
84
86
  const initialObjectsP: Promise<void>[] = [];
85
87
  for (const [id, objectClass] of Object.entries(props.initialObjects)) {
86
88
  const createObject = async (): Promise<void> => {
87
- const obj = await this.create<IFluidLoadable>(objectClass);
89
+ const obj = await this.create<IFluidLoadable>(
90
+ objectClass as SharedObjectKind<IFluidLoadable>,
91
+ );
88
92
  this.initialObjectsDir.set(id, obj.handle);
89
93
  };
90
94
  initialObjectsP.push(createObject());
@@ -127,23 +131,24 @@ class RootDataObject
127
131
  /**
128
132
  * {@inheritDoc IRootDataObject.create}
129
133
  */
130
- public async create<T extends IFluidLoadable>(objectClass: LoadableObjectClass<T>): Promise<T> {
131
- if (isDataObjectClass(objectClass)) {
132
- return this.createDataObject(objectClass);
133
- } else if (isSharedObjectKind(objectClass)) {
134
- return this.createSharedObject(objectClass);
134
+ public async create<T>(objectClass: SharedObjectKind<T>): Promise<T> {
135
+ const internal = objectClass as unknown as LoadableObjectClass<T & IFluidLoadable>;
136
+ if (isDataObjectClass(internal)) {
137
+ return this.createDataObject(internal);
138
+ } else if (isSharedObjectKind(internal)) {
139
+ return this.createSharedObject(internal);
135
140
  }
136
141
  throw new Error("Could not create new Fluid object because an unknown object was passed");
137
142
  }
138
143
 
139
144
  private async createDataObject<T extends IFluidLoadable>(
140
- dataObjectClass: InternalDataObjectClass<T>,
145
+ dataObjectClass: DataObjectClass<T>,
141
146
  ): Promise<T> {
142
147
  const factory = dataObjectClass.factory;
143
148
  const packagePath = [...this.context.packagePath, factory.type];
144
149
  const dataStore = await this.context.containerRuntime.createDataStore(packagePath);
145
150
  const entryPoint = await dataStore.entryPoint.get();
146
- return entryPoint as unknown as T;
151
+ return entryPoint as T;
147
152
  }
148
153
 
149
154
  private createSharedObject<T extends IFluidLoadable>(
@@ -165,8 +170,9 @@ const rootDataStoreId = "rootDOId";
165
170
  */
166
171
  export function createDOProviderContainerRuntimeFactory(props: {
167
172
  schema: ContainerSchema;
173
+ compatibilityMode: CompatibilityMode;
168
174
  }): IRuntimeFactory {
169
- return new DOProviderContainerRuntimeFactory(props.schema);
175
+ return new DOProviderContainerRuntimeFactory(props.schema, props.compatibilityMode);
170
176
  }
171
177
 
172
178
  /**
@@ -189,7 +195,7 @@ class DOProviderContainerRuntimeFactory extends BaseContainerRuntimeFactory {
189
195
 
190
196
  private readonly initialObjects: LoadableObjectClassRecord;
191
197
 
192
- public constructor(schema: ContainerSchema) {
198
+ public constructor(schema: ContainerSchema, compatibilityMode: CompatibilityMode) {
193
199
  const [registryEntries, sharedObjects] = parseDataObjectsFromSharedObjects(schema);
194
200
  const rootDataObjectFactory = new DataObjectFactory(
195
201
  "rootDO",
@@ -202,8 +208,7 @@ class DOProviderContainerRuntimeFactory extends BaseContainerRuntimeFactory {
202
208
  containerRuntime: IContainerRuntime,
203
209
  // eslint-disable-next-line unicorn/consistent-function-scoping
204
210
  ): Promise<FluidObject> => {
205
- const entryPoint =
206
- await containerRuntime.getAliasedDataStoreEntryPoint(rootDataStoreId);
211
+ const entryPoint = await containerRuntime.getAliasedDataStoreEntryPoint(rootDataStoreId);
207
212
  if (entryPoint === undefined) {
208
213
  throw new Error(`default dataStore [${rootDataStoreId}] must exist`);
209
214
  }
@@ -227,15 +232,7 @@ class DOProviderContainerRuntimeFactory extends BaseContainerRuntimeFactory {
227
232
  super({
228
233
  registryEntries: [rootDataObjectFactory.registryEntry],
229
234
  requestHandlers: [getDefaultObject],
230
- // WARNING: These settigs are not compatible with FF 1.3 clients!
231
- runtimeOptions: {
232
- // temporary workaround to disable message batching until the message batch size issue is resolved
233
- // resolution progress is tracked by the Feature 465 work item in AzDO
234
- flushMode: FlushMode.Immediate,
235
- // The runtime compressor is required to be on to use @fluidframework/tree.
236
- enableRuntimeIdCompressor: "on",
237
- explicitSchemaControl: true,
238
- },
235
+ runtimeOptions: compatibilityModeRuntimeOptions[compatibilityMode],
239
236
  provideEntryPoint,
240
237
  });
241
238
  this.rootDataObjectFactory = rootDataObjectFactory;
@@ -4,16 +4,11 @@
4
4
  */
5
5
 
6
6
  import { TypedEventEmitter } from "@fluid-internal/client-utils";
7
- import { type IAudience } from "@fluidframework/container-definitions";
8
- import { type IContainer } from "@fluidframework/container-definitions/internal";
9
- import { type IClient } from "@fluidframework/protocol-definitions";
10
-
11
- import {
12
- type IMember,
13
- type IServiceAudience,
14
- type IServiceAudienceEvents,
15
- type Myself,
16
- } from "./types.js";
7
+ import type { IAudience } from "@fluidframework/container-definitions";
8
+ import type { IContainer } from "@fluidframework/container-definitions/internal";
9
+ import type { IClient } from "@fluidframework/driver-definitions";
10
+
11
+ import type { IMember, IServiceAudience, IServiceAudienceEvents, Myself } from "./types.js";
17
12
 
18
13
  /**
19
14
  * Creates a service audience for the provided container.
package/src/types.ts CHANGED
@@ -3,12 +3,16 @@
3
3
  * Licensed under the MIT License.
4
4
  */
5
5
 
6
- import {
7
- type IEvent,
8
- type IEventProvider,
9
- type IFluidLoadable,
10
- } from "@fluidframework/core-interfaces";
11
- import { type ISharedObjectKind } from "@fluidframework/shared-object-base";
6
+ import type { IEvent, IEventProvider, IFluidLoadable } from "@fluidframework/core-interfaces";
7
+ import type { IFluidDataStoreFactory } from "@fluidframework/runtime-definitions/internal";
8
+ import type { SharedObjectKind } from "@fluidframework/shared-object-base";
9
+ import type { ISharedObjectKind } from "@fluidframework/shared-object-base/internal";
10
+
11
+ /**
12
+ * Valid compatibility modes that may be specified when creating a DOProviderContainerRuntimeFactory.
13
+ * @public
14
+ */
15
+ export type CompatibilityMode = "1" | "2";
12
16
 
13
17
  /**
14
18
  * A mapping of string identifiers to instantiated `DataObject`s or `SharedObject`s.
@@ -19,15 +23,13 @@ export type LoadableObjectRecord = Record<string, IFluidLoadable>;
19
23
  /**
20
24
  * A mapping of string identifiers to classes that will later be used to instantiate a corresponding `DataObject`
21
25
  * or `SharedObject`.
22
- * @public
23
26
  */
24
- export type LoadableObjectClassRecord = Record<string, LoadableObjectClass>;
27
+ export type LoadableObjectClassRecord = Record<string, SharedObjectKind>;
25
28
 
26
29
  /**
27
30
  * A class object of `DataObject` or `SharedObject`.
28
31
  *
29
32
  * @typeParam T - The class of the `DataObject` or `SharedObject`.
30
- * @public
31
33
  *
32
34
  * @privateRemarks
33
35
  * There are some edge cases in TypeScript where the order of the members in a union matter.
@@ -46,19 +48,14 @@ export type LoadableObjectClass<T extends IFluidLoadable = IFluidLoadable> =
46
48
  *
47
49
  * @typeParam T - The class of the `DataObject`.
48
50
  * @privateRemarks
49
- * Having both `factory` and `LoadableObjectCtor` is redundant.
50
- * TODO: It appears the factory is what's used, so the constructor should be removed.
51
- * @public
51
+ * Having both `factory` and constructor is redundant.
52
+ * TODO: It appears the factory is what's used, so the constructor should be removed once factory provides strong typing.
52
53
  */
53
- export type DataObjectClass<T extends IFluidLoadable = IFluidLoadable> = {
54
- /**
55
- * @privateRemarks
56
- * This has to implement {@link @fluidframework/runtime-definitions#IFluidDataStoreFactory}.
57
- * TODO: Gain type safety for this without leaking IFluidDataStoreFactory as public using type erasure.
58
- */
59
- readonly factory: { readonly IFluidDataStoreFactory: DataObjectClass<T>["factory"] };
54
+ export interface DataObjectClass<T extends IFluidLoadable> {
55
+ readonly factory: IFluidDataStoreFactory;
60
56
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
61
- } & (new (...args: any[]) => T);
57
+ new (...args: any[]): T;
58
+ }
62
59
 
63
60
  /**
64
61
  * Represents properties that can be attached to a container.
@@ -94,7 +91,7 @@ export interface ContainerSchema {
94
91
  * }
95
92
  * ```
96
93
  */
97
- readonly initialObjects: LoadableObjectClassRecord;
94
+ readonly initialObjects: Record<string, SharedObjectKind>;
98
95
 
99
96
  /**
100
97
  * Loadable objects that can be created after the initial {@link IFluidContainer | Container} creation.
@@ -106,7 +103,7 @@ export interface ContainerSchema {
106
103
  * For best practice it's recommended to define all the dynamic types you create even if they are
107
104
  * included via initialObjects.
108
105
  */
109
- readonly dynamicObjectTypes?: readonly LoadableObjectClass[];
106
+ readonly dynamicObjectTypes?: readonly SharedObjectKind[];
110
107
  }
111
108
 
112
109
  /**
@@ -134,7 +131,7 @@ export interface IRootDataObject extends IProvideRootDataObject {
134
131
  *
135
132
  * @typeParam T - The class of the `DataObject` or `SharedObject`.
136
133
  */
137
- create<T extends IFluidLoadable>(objectClass: LoadableObjectClass<T>): Promise<T>;
134
+ create<T>(objectClass: SharedObjectKind<T>): Promise<T>;
138
135
  }
139
136
 
140
137
  /**
package/src/utils.ts CHANGED
@@ -3,47 +3,35 @@
3
3
  * Licensed under the MIT License.
4
4
  */
5
5
 
6
- import { type IFluidLoadable } from "@fluidframework/core-interfaces";
7
- import { type IChannelFactory } from "@fluidframework/datastore-definitions";
8
- import {
9
- type IFluidDataStoreFactory,
10
- type NamedFluidDataStoreRegistryEntry,
11
- } from "@fluidframework/runtime-definitions/internal";
12
- import type { ISharedObjectKind } from "@fluidframework/shared-object-base";
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";
9
+ import type { ISharedObjectKind } from "@fluidframework/shared-object-base/internal";
13
10
  import { UsageError } from "@fluidframework/telemetry-utils/internal";
14
11
 
15
- import { type ContainerSchema, type DataObjectClass, type LoadableObjectClass } from "./types.js";
16
-
17
- /**
18
- * An internal type used by the internal type guard isDataObjectClass to cast a
19
- * DataObjectClass to a type that is strongly coupled to IFluidDataStoreFactory.
20
- * Unlike the external and exported type DataObjectClass which is
21
- * weakly coupled to the IFluidDataStoreFactory to prevent leaking internals.
22
- */
23
- export type InternalDataObjectClass<T extends IFluidLoadable> = DataObjectClass<T> &
24
- Record<"factory", IFluidDataStoreFactory>;
12
+ import type { ContainerSchema, DataObjectClass, LoadableObjectClass } from "./types.js";
25
13
 
26
14
  /**
27
15
  * Runtime check to determine if a class is a DataObject type.
28
16
  */
29
17
  export function isDataObjectClass<T extends IFluidLoadable>(
30
18
  obj: LoadableObjectClass<T>,
31
- ): obj is InternalDataObjectClass<T>;
19
+ ): obj is DataObjectClass<T>;
32
20
 
33
21
  /**
34
22
  * Runtime check to determine if a class is a DataObject type.
35
23
  */
36
24
  export function isDataObjectClass(
37
25
  obj: LoadableObjectClass,
38
- ): obj is InternalDataObjectClass<IFluidLoadable>;
26
+ ): obj is DataObjectClass<IFluidLoadable>;
39
27
 
40
28
  /**
41
29
  * Runtime check to determine if a class is a DataObject type.
42
30
  */
43
31
  export function isDataObjectClass(
44
32
  obj: LoadableObjectClass,
45
- ): obj is InternalDataObjectClass<IFluidLoadable> {
46
- const maybe = obj as Partial<InternalDataObjectClass<IFluidLoadable>> | undefined;
33
+ ): obj is DataObjectClass<IFluidLoadable> {
34
+ const maybe = obj as Partial<DataObjectClass<IFluidLoadable>> | undefined;
47
35
  const isDataObject =
48
36
  maybe?.factory?.IFluidDataStoreFactory !== undefined &&
49
37
  maybe.factory.IFluidDataStoreFactory === maybe.factory;
@@ -96,7 +84,7 @@ export const parseDataObjectsFromSharedObjects = (
96
84
  ...(schema.dynamicObjectTypes ?? []),
97
85
  ]);
98
86
  for (const obj of dedupedObjects) {
99
- tryAddObject(obj);
87
+ tryAddObject(obj as unknown as LoadableObjectClass);
100
88
  }
101
89
 
102
90
  if (registryEntries.size === 0 && sharedObjects.size === 0) {