@fluidframework/aqueduct 2.22.1 → 2.23.0-325054

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 (43) hide show
  1. package/CHANGELOG.md +4 -0
  2. package/dist/data-object-factories/dataObjectFactory.d.ts.map +1 -1
  3. package/dist/data-object-factories/dataObjectFactory.js.map +1 -1
  4. package/dist/data-object-factories/pureDataObjectFactory.d.ts +1 -1
  5. package/dist/data-object-factories/pureDataObjectFactory.js +1 -1
  6. package/dist/data-object-factories/pureDataObjectFactory.js.map +1 -1
  7. package/dist/data-objects/dataObject.d.ts +2 -2
  8. package/dist/data-objects/dataObject.d.ts.map +1 -1
  9. package/dist/data-objects/dataObject.js.map +1 -1
  10. package/dist/data-objects/index.d.ts +1 -1
  11. package/dist/data-objects/index.d.ts.map +1 -1
  12. package/dist/data-objects/index.js.map +1 -1
  13. package/dist/data-objects/types.d.ts +18 -1
  14. package/dist/data-objects/types.d.ts.map +1 -1
  15. package/dist/data-objects/types.js.map +1 -1
  16. package/dist/index.d.ts +1 -1
  17. package/dist/index.d.ts.map +1 -1
  18. package/dist/index.js.map +1 -1
  19. package/lib/data-object-factories/dataObjectFactory.d.ts.map +1 -1
  20. package/lib/data-object-factories/dataObjectFactory.js +1 -3
  21. package/lib/data-object-factories/dataObjectFactory.js.map +1 -1
  22. package/lib/data-object-factories/pureDataObjectFactory.d.ts +1 -1
  23. package/lib/data-object-factories/pureDataObjectFactory.js +1 -1
  24. package/lib/data-object-factories/pureDataObjectFactory.js.map +1 -1
  25. package/lib/data-objects/dataObject.d.ts +2 -2
  26. package/lib/data-objects/dataObject.d.ts.map +1 -1
  27. package/lib/data-objects/dataObject.js.map +1 -1
  28. package/lib/data-objects/index.d.ts +1 -1
  29. package/lib/data-objects/index.d.ts.map +1 -1
  30. package/lib/data-objects/index.js.map +1 -1
  31. package/lib/data-objects/types.d.ts +18 -1
  32. package/lib/data-objects/types.d.ts.map +1 -1
  33. package/lib/data-objects/types.js.map +1 -1
  34. package/lib/index.d.ts +1 -1
  35. package/lib/index.d.ts.map +1 -1
  36. package/lib/index.js.map +1 -1
  37. package/package.json +18 -18
  38. package/src/data-object-factories/dataObjectFactory.ts +0 -1
  39. package/src/data-object-factories/pureDataObjectFactory.ts +1 -1
  40. package/src/data-objects/dataObject.ts +4 -4
  41. package/src/data-objects/index.ts +1 -1
  42. package/src/data-objects/types.ts +26 -1
  43. package/src/index.ts +1 -0
package/CHANGELOG.md CHANGED
@@ -1,5 +1,9 @@
1
1
  # @fluidframework/aqueduct
2
2
 
3
+ ## 2.23.0
4
+
5
+ Dependency updates only.
6
+
3
7
  ## 2.22.0
4
8
 
5
9
  Dependency updates only.
@@ -1 +1 @@
1
- {"version":3,"file":"dataObjectFactory.d.ts","sourceRoot":"","sources":["../../src/data-object-factories/dataObjectFactory.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,qBAAqB,EAAE,MAAM,oCAAoC,CAAC;AAC3E,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,gDAAgD,CAAC;AAQtF,OAAO,KAAK,EAAE,kCAAkC,EAAE,MAAM,8CAA8C,CAAC;AACvG,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,qCAAqC,CAAC;AAErF,OAAO,KAAK,EAAE,UAAU,EAAE,eAAe,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAC;AAE9F,OAAO,EAAE,qBAAqB,EAAE,MAAM,4BAA4B,CAAC;AAEnE;;;;;;;;;GASG;AACH,qBAAa,iBAAiB,CAC7B,IAAI,SAAS,UAAU,CAAC,CAAC,CAAC,EAC1B,CAAC,SAAS,eAAe,GAAG,eAAe,CAC1C,SAAQ,qBAAqB,CAAC,IAAI,EAAE,CAAC,CAAC;gBAEtC,IAAI,EAAE,MAAM,EACZ,IAAI,EAAE,KAAK,KAAK,EAAE,gBAAgB,CAAC,CAAC,CAAC,KAAK,IAAI,EAC9C,aAAa,iDAAiC,EAC9C,iBAAiB,EAAE,yBAAyB,CAAC,CAAC,CAAC,mBAAmB,CAAC,CAAC,EACpE,eAAe,CAAC,EAAE,kCAAkC,EACpD,cAAc,GAAE,OAAO,qBAA6C;CAkBrE"}
1
+ {"version":3,"file":"dataObjectFactory.d.ts","sourceRoot":"","sources":["../../src/data-object-factories/dataObjectFactory.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,qBAAqB,EAAE,MAAM,oCAAoC,CAAC;AAC3E,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,gDAAgD,CAAC;AAOtF,OAAO,KAAK,EAAE,kCAAkC,EAAE,MAAM,8CAA8C,CAAC;AACvG,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,qCAAqC,CAAC;AAErF,OAAO,KAAK,EAAE,UAAU,EAAE,eAAe,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAC;AAE9F,OAAO,EAAE,qBAAqB,EAAE,MAAM,4BAA4B,CAAC;AAEnE;;;;;;;;;GASG;AACH,qBAAa,iBAAiB,CAC7B,IAAI,SAAS,UAAU,CAAC,CAAC,CAAC,EAC1B,CAAC,SAAS,eAAe,GAAG,eAAe,CAC1C,SAAQ,qBAAqB,CAAC,IAAI,EAAE,CAAC,CAAC;gBAEtC,IAAI,EAAE,MAAM,EACZ,IAAI,EAAE,KAAK,KAAK,EAAE,gBAAgB,CAAC,CAAC,CAAC,KAAK,IAAI,EAC9C,aAAa,iDAAiC,EAC9C,iBAAiB,EAAE,yBAAyB,CAAC,CAAC,CAAC,mBAAmB,CAAC,CAAC,EACpE,eAAe,CAAC,EAAE,kCAAkC,EACpD,cAAc,GAAE,OAAO,qBAA6C;CAkBrE"}
@@ -1 +1 @@
1
- {"version":3,"file":"dataObjectFactory.js","sourceRoot":"","sources":["../../src/data-object-factories/dataObjectFactory.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,iEAA2E;AAE3E,2DAMsC;AAMtC,yEAAmE;AAEnE;;;;;;;;;GASG;AACH,MAAa,iBAGX,SAAQ,gDAA8B;IACvC,YACC,IAAY,EACZ,IAA8C,EAC9C,gBAA4C,EAAE,EAC9C,iBAAoE,EACpE,eAAoD,EACpD,iBAA+C,gCAAqB;QAEpE,MAAM,aAAa,GAAG,CAAC,GAAG,aAAa,CAAC,CAAC;QAEzC,IAAI,CAAC,aAAa,CAAC,IAAI,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,OAAO,CAAC,IAAI,KAAK,2BAAgB,CAAC,IAAI,CAAC,EAAE,CAAC;YAC9E,sCAAsC;YACtC,gDAAgD;YAChD,aAAa,CAAC,IAAI,CAAC,0BAAe,CAAC,UAAU,EAAE,CAAC,CAAC;QAClD,CAAC;QAED,0GAA0G;QAC1G,IAAI,CAAC,aAAa,CAAC,IAAI,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,OAAO,CAAC,IAAI,KAAK,qBAAU,CAAC,IAAI,CAAC,EAAE,CAAC;YACxE,gCAAgC;YAChC,aAAa,CAAC,IAAI,CAAC,oBAAS,CAAC,UAAU,EAAE,CAAC,CAAC;QAC5C,CAAC;QAED,KAAK,CAAC,IAAI,EAAE,IAAI,EAAE,aAAa,EAAE,iBAAiB,EAAE,eAAe,EAAE,cAAc,CAAC,CAAC;IACtF,CAAC;CACD;AA5BD,8CA4BC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { FluidDataStoreRuntime } from \"@fluidframework/datastore/internal\";\nimport type { IChannelFactory } from \"@fluidframework/datastore-definitions/internal\";\nimport {\n\tSharedMap,\n\tDirectoryFactory,\n\tMapFactory,\n\t// eslint-disable-next-line import/no-deprecated\n\tSharedDirectory,\n} from \"@fluidframework/map/internal\";\nimport type { NamedFluidDataStoreRegistryEntries } from \"@fluidframework/runtime-definitions/internal\";\nimport type { FluidObjectSymbolProvider } from \"@fluidframework/synthesize/internal\";\n\nimport type { DataObject, DataObjectTypes, IDataObjectProps } from \"../data-objects/index.js\";\n\nimport { PureDataObjectFactory } from \"./pureDataObjectFactory.js\";\n\n/**\n * DataObjectFactory is the IFluidDataStoreFactory for use with DataObjects.\n * It facilitates DataObject's features (such as its shared directory) by\n * ensuring relevant shared objects etc are available to the factory.\n *\n * @typeParam TObj - DataObject (concrete type)\n * @typeParam I - The input types for the DataObject\n * @legacy\n * @alpha\n */\nexport class DataObjectFactory<\n\tTObj extends DataObject<I>,\n\tI extends DataObjectTypes = DataObjectTypes,\n> extends PureDataObjectFactory<TObj, I> {\n\tpublic constructor(\n\t\ttype: string,\n\t\tctor: new (props: IDataObjectProps<I>) => TObj,\n\t\tsharedObjects: readonly IChannelFactory[] = [],\n\t\toptionalProviders: FluidObjectSymbolProvider<I[\"OptionalProviders\"]>,\n\t\tregistryEntries?: NamedFluidDataStoreRegistryEntries,\n\t\truntimeFactory: typeof FluidDataStoreRuntime = FluidDataStoreRuntime,\n\t) {\n\t\tconst mergedObjects = [...sharedObjects];\n\n\t\tif (!sharedObjects.some((factory) => factory.type === DirectoryFactory.Type)) {\n\t\t\t// User did not register for directory\n\t\t\t// eslint-disable-next-line import/no-deprecated\n\t\t\tmergedObjects.push(SharedDirectory.getFactory());\n\t\t}\n\n\t\t// TODO: Remove SharedMap factory when compatibility with SharedMap DataObject is no longer needed in 0.10\n\t\tif (!sharedObjects.some((factory) => factory.type === MapFactory.Type)) {\n\t\t\t// User did not register for map\n\t\t\tmergedObjects.push(SharedMap.getFactory());\n\t\t}\n\n\t\tsuper(type, ctor, mergedObjects, optionalProviders, registryEntries, runtimeFactory);\n\t}\n}\n"]}
1
+ {"version":3,"file":"dataObjectFactory.js","sourceRoot":"","sources":["../../src/data-object-factories/dataObjectFactory.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,iEAA2E;AAE3E,2DAKsC;AAMtC,yEAAmE;AAEnE;;;;;;;;;GASG;AACH,MAAa,iBAGX,SAAQ,gDAA8B;IACvC,YACC,IAAY,EACZ,IAA8C,EAC9C,gBAA4C,EAAE,EAC9C,iBAAoE,EACpE,eAAoD,EACpD,iBAA+C,gCAAqB;QAEpE,MAAM,aAAa,GAAG,CAAC,GAAG,aAAa,CAAC,CAAC;QAEzC,IAAI,CAAC,aAAa,CAAC,IAAI,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,OAAO,CAAC,IAAI,KAAK,2BAAgB,CAAC,IAAI,CAAC,EAAE,CAAC;YAC9E,sCAAsC;YACtC,gDAAgD;YAChD,aAAa,CAAC,IAAI,CAAC,0BAAe,CAAC,UAAU,EAAE,CAAC,CAAC;QAClD,CAAC;QAED,0GAA0G;QAC1G,IAAI,CAAC,aAAa,CAAC,IAAI,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,OAAO,CAAC,IAAI,KAAK,qBAAU,CAAC,IAAI,CAAC,EAAE,CAAC;YACxE,gCAAgC;YAChC,aAAa,CAAC,IAAI,CAAC,oBAAS,CAAC,UAAU,EAAE,CAAC,CAAC;QAC5C,CAAC;QAED,KAAK,CAAC,IAAI,EAAE,IAAI,EAAE,aAAa,EAAE,iBAAiB,EAAE,eAAe,EAAE,cAAc,CAAC,CAAC;IACtF,CAAC;CACD;AA5BD,8CA4BC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { FluidDataStoreRuntime } from \"@fluidframework/datastore/internal\";\nimport type { IChannelFactory } from \"@fluidframework/datastore-definitions/internal\";\nimport {\n\tSharedMap,\n\tDirectoryFactory,\n\tMapFactory,\n\tSharedDirectory,\n} from \"@fluidframework/map/internal\";\nimport type { NamedFluidDataStoreRegistryEntries } from \"@fluidframework/runtime-definitions/internal\";\nimport type { FluidObjectSymbolProvider } from \"@fluidframework/synthesize/internal\";\n\nimport type { DataObject, DataObjectTypes, IDataObjectProps } from \"../data-objects/index.js\";\n\nimport { PureDataObjectFactory } from \"./pureDataObjectFactory.js\";\n\n/**\n * DataObjectFactory is the IFluidDataStoreFactory for use with DataObjects.\n * It facilitates DataObject's features (such as its shared directory) by\n * ensuring relevant shared objects etc are available to the factory.\n *\n * @typeParam TObj - DataObject (concrete type)\n * @typeParam I - The input types for the DataObject\n * @legacy\n * @alpha\n */\nexport class DataObjectFactory<\n\tTObj extends DataObject<I>,\n\tI extends DataObjectTypes = DataObjectTypes,\n> extends PureDataObjectFactory<TObj, I> {\n\tpublic constructor(\n\t\ttype: string,\n\t\tctor: new (props: IDataObjectProps<I>) => TObj,\n\t\tsharedObjects: readonly IChannelFactory[] = [],\n\t\toptionalProviders: FluidObjectSymbolProvider<I[\"OptionalProviders\"]>,\n\t\tregistryEntries?: NamedFluidDataStoreRegistryEntries,\n\t\truntimeFactory: typeof FluidDataStoreRuntime = FluidDataStoreRuntime,\n\t) {\n\t\tconst mergedObjects = [...sharedObjects];\n\n\t\tif (!sharedObjects.some((factory) => factory.type === DirectoryFactory.Type)) {\n\t\t\t// User did not register for directory\n\t\t\t// eslint-disable-next-line import/no-deprecated\n\t\t\tmergedObjects.push(SharedDirectory.getFactory());\n\t\t}\n\n\t\t// TODO: Remove SharedMap factory when compatibility with SharedMap DataObject is no longer needed in 0.10\n\t\tif (!sharedObjects.some((factory) => factory.type === MapFactory.Type)) {\n\t\t\t// User did not register for map\n\t\t\tmergedObjects.push(SharedMap.getFactory());\n\t\t}\n\n\t\tsuper(type, ctor, mergedObjects, optionalProviders, registryEntries, runtimeFactory);\n\t}\n}\n"]}
@@ -9,7 +9,7 @@ import type { IContainerRuntimeBase, IDataStore, IFluidDataStoreChannel, IFluidD
9
9
  import type { FluidObjectSymbolProvider } from "@fluidframework/synthesize/internal";
10
10
  import type { DataObjectTypes, IDataObjectProps, PureDataObject } from "../data-objects/index.js";
11
11
  /**
12
- * PureDataObjectFactory is a barebones IFluidDataStoreFactory for use with PureDataObject.
12
+ * PureDataObjectFactory is a bare-bones IFluidDataStoreFactory for use with PureDataObject.
13
13
  * Consumers should typically use DataObjectFactory instead unless creating
14
14
  * another base data store factory.
15
15
  *
@@ -60,7 +60,7 @@ async function createDataObject(ctor, context, sharedObjectRegistry, optionalPro
60
60
  return { instance, runtime };
61
61
  }
62
62
  /**
63
- * PureDataObjectFactory is a barebones IFluidDataStoreFactory for use with PureDataObject.
63
+ * PureDataObjectFactory is a bare-bones IFluidDataStoreFactory for use with PureDataObject.
64
64
  * Consumers should typically use DataObjectFactory instead unless creating
65
65
  * another base data store factory.
66
66
  *
@@ -1 +1 @@
1
- {"version":3,"file":"pureDataObjectFactory.js","sourceRoot":"","sources":["../../src/data-object-factories/pureDataObjectFactory.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,yEAAoF;AAGpF,kEAA6D;AAC7D,iEAI4C;AA6B5C;;;GAGG;AACH,KAAK,UAAU,gBAAgB,CAI9B,IAA8C,EAC9C,OAA+B,EAC/B,oBAA2C,EAC3C,iBAAoE,EACpE,eAA6C,EAC7C,QAAiB,EACjB,SAA6B;IAK7B,OAAO;IACP,IAAI,YAAY,GAAG,eAAe,CAAC;IAEnC,mBAAmB;IACnB,YAAY,GAAG,IAAA,8BAAmB,EACjC,KAAK,EAAE,OAAiB,EAAE,UAAiC,EAAE,EAAE;QAC9D,iFAAiF;QACjF,MAAM,UAAU,GAAG,CAAC,MAAM,UAAU,CAAC,UAAU,CAAC,GAAG,EAAE,CAAS,CAAC;QAC/D,IAAA,iBAAM,EACL,UAAU,CAAC,OAAO,KAAK,SAAS,EAChC,KAAK,CAAC,yDAAyD,CAC/D,CAAC;QACF,OAAO,UAAU,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC;IACpC,CAAC,EACD,YAAY,CACZ,CAAC;IAEF,gFAAgF;IAChF,+DAA+D;IAC/D,6EAA6E;IAC7E,MAAM,OAAO,GAA0B,IAAI,YAAY;IACtD,uCAAuC;IACvC,OAAO,EACP,oBAAoB,EACpB,QAAQ,EACR,KAAK,EAAE,EAA0B,EAAE,EAAE;QACpC,IAAA,iBAAM,EAAC,QAAQ,KAAK,SAAS,EAAE,KAAK,CAA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D;AAjPD,sDAiPC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { FluidDataStoreRegistry } from \"@fluidframework/container-runtime/internal\";\nimport type { IContainerRuntime } from \"@fluidframework/container-runtime-definitions/internal\";\nimport type { FluidObject, IRequest } from \"@fluidframework/core-interfaces\";\nimport { assert } from \"@fluidframework/core-utils/internal\";\nimport {\n\tFluidDataStoreRuntime,\n\ttype ISharedObjectRegistry,\n\tmixinRequestHandler,\n} from \"@fluidframework/datastore/internal\";\nimport type {\n\tIChannelFactory,\n\tIFluidDataStoreRuntime,\n} from \"@fluidframework/datastore-definitions/internal\";\nimport type {\n\tIContainerRuntimeBase,\n\tIDataStore,\n\tIFluidDataStoreChannel,\n\tIFluidDataStoreContext,\n\tIFluidDataStoreContextDetached,\n\tIFluidDataStoreFactory,\n\tIFluidDataStoreRegistry,\n\tIProvideFluidDataStoreRegistry,\n\tNamedFluidDataStoreRegistryEntries,\n\tNamedFluidDataStoreRegistryEntry,\n} from \"@fluidframework/runtime-definitions/internal\";\nimport type {\n\tAsyncFluidObjectProvider,\n\tFluidObjectSymbolProvider,\n\tIFluidDependencySynthesizer,\n} from \"@fluidframework/synthesize/internal\";\n\nimport type {\n\tDataObjectTypes,\n\tIDataObjectProps,\n\tPureDataObject,\n} from \"../data-objects/index.js\";\n\n/**\n * Proxy over PureDataObject\n * Does delayed creation & initialization of PureDataObject\n */\nasync function createDataObject<\n\tTObj extends PureDataObject,\n\tI extends DataObjectTypes = DataObjectTypes,\n>(\n\tctor: new (props: IDataObjectProps<I>) => TObj,\n\tcontext: IFluidDataStoreContext,\n\tsharedObjectRegistry: ISharedObjectRegistry,\n\toptionalProviders: FluidObjectSymbolProvider<I[\"OptionalProviders\"]>,\n\truntimeClassArg: typeof FluidDataStoreRuntime,\n\texisting: boolean,\n\tinitProps?: I[\"InitialState\"],\n): Promise<{\n\tinstance: TObj;\n\truntime: FluidDataStoreRuntime;\n}> {\n\t// base\n\tlet runtimeClass = runtimeClassArg;\n\n\t// request mixin in\n\truntimeClass = mixinRequestHandler(\n\t\tasync (request: IRequest, runtimeArg: FluidDataStoreRuntime) => {\n\t\t\t// The provideEntryPoint callback below always returns TObj, so this cast is safe\n\t\t\tconst dataObject = (await runtimeArg.entryPoint.get()) as TObj;\n\t\t\tassert(\n\t\t\t\tdataObject.request !== undefined,\n\t\t\t\t0x795 /* Data store runtime entryPoint does not have request */,\n\t\t\t);\n\t\t\treturn dataObject.request(request);\n\t\t},\n\t\truntimeClass,\n\t);\n\n\t// Create a new runtime for our data store, as if via new FluidDataStoreRuntime,\n\t// but using the runtimeClass that's been augmented with mixins\n\t// The runtime is what Fluid uses to create DDS' and route to your data store\n\tconst runtime: FluidDataStoreRuntime = new runtimeClass(\n\t\t// calls new FluidDataStoreRuntime(...)\n\t\tcontext,\n\t\tsharedObjectRegistry,\n\t\texisting,\n\t\tasync (rt: IFluidDataStoreRuntime) => {\n\t\t\tassert(instance !== undefined, 0x46a /* entryPoint is undefined */);\n\t\t\t// Calling finishInitialization here like PureDataObject.getDataObject did, to keep the same behavior,\n\t\t\t// since accessing the runtime's entryPoint is how we want the data object to be retrieved going forward.\n\t\t\t// Without this I ran into issues with the load-existing flow not working correctly.\n\t\t\tawait instance.finishInitialization(true);\n\t\t\treturn instance;\n\t\t} /* provideEntryPoint */,\n\t);\n\n\t// Create object right away.\n\t// This allows object to register various callbacks with runtime before runtime\n\t// becomes globally available. But it's not full initialization - constructor can't\n\t// access DDSes or other services of runtime as objects are not fully initialized.\n\t// In order to use object, we need to go through full initialization by calling finishInitialization().\n\tconst scope: FluidObject<IFluidDependencySynthesizer> = context.scope;\n\tconst providers =\n\t\tscope.IFluidDependencySynthesizer?.synthesize<I[\"OptionalProviders\"]>(\n\t\t\toptionalProviders,\n\t\t\t{},\n\t\t) ??\n\t\t// eslint-disable-next-line @typescript-eslint/consistent-type-assertions\n\t\t({} as AsyncFluidObjectProvider<never>);\n\n\tconst instance = new ctor({ runtime, context, providers, initProps });\n\n\t// if it's a newly created object, we need to wait for it to finish initialization\n\t// as that results in creation of DDSes, before it gets attached, providing atomic\n\t// guarantee of creation.\n\t// WARNING: we can't do the same (yet) for already existing PureDataObject!\n\t// This will result in deadlock, as it tries to resolve internal handles, but any\n\t// handle resolution goes through root (container runtime), which can't route it back\n\t// to this data store, as it's still not initialized and not known to container runtime yet.\n\t// In the future, we should address it by using relative paths for handles and be able to resolve\n\t// local DDSes while data store is not fully initialized.\n\tif (!existing) {\n\t\tawait instance.finishInitialization(existing);\n\t}\n\n\treturn { instance, runtime };\n}\n\n/**\n * PureDataObjectFactory is a barebones IFluidDataStoreFactory for use with PureDataObject.\n * Consumers should typically use DataObjectFactory instead unless creating\n * another base data store factory.\n *\n * @typeParam TObj - DataObject (concrete type)\n * @typeParam I - The input types for the DataObject\n * @legacy\n * @alpha\n */\nexport class PureDataObjectFactory<\n\tTObj extends PureDataObject<I>,\n\tI extends DataObjectTypes = DataObjectTypes,\n> implements IFluidDataStoreFactory, Partial<IProvideFluidDataStoreRegistry>\n{\n\tprivate readonly sharedObjectRegistry: ISharedObjectRegistry;\n\tprivate readonly registry: IFluidDataStoreRegistry | undefined;\n\n\tpublic constructor(\n\t\t/**\n\t\t * {@inheritDoc @fluidframework/runtime-definitions#IFluidDataStoreFactory.\"type\"}\n\t\t */\n\t\tpublic readonly type: string,\n\t\tprivate readonly ctor: new (props: IDataObjectProps<I>) => TObj,\n\t\tsharedObjects: readonly IChannelFactory[],\n\t\tprivate readonly optionalProviders: FluidObjectSymbolProvider<I[\"OptionalProviders\"]>,\n\t\tregistryEntries?: NamedFluidDataStoreRegistryEntries,\n\t\tprivate readonly runtimeClass: typeof FluidDataStoreRuntime = FluidDataStoreRuntime,\n\t) {\n\t\tif (this.type === \"\") {\n\t\t\tthrow new Error(\"undefined type member\");\n\t\t}\n\t\tif (registryEntries !== undefined) {\n\t\t\tthis.registry = new FluidDataStoreRegistry(registryEntries);\n\t\t}\n\t\tthis.sharedObjectRegistry = new Map(sharedObjects.map((ext) => [ext.type, ext]));\n\t}\n\n\t/**\n\t * {@inheritDoc @fluidframework/runtime-definitions#IProvideFluidDataStoreFactory.IFluidDataStoreFactory}\n\t */\n\tpublic get IFluidDataStoreFactory(): this {\n\t\treturn this;\n\t}\n\n\t/**\n\t * {@inheritDoc @fluidframework/runtime-definitions#IProvideFluidDataStoreRegistry.IFluidDataStoreRegistry}\n\t */\n\tpublic get IFluidDataStoreRegistry(): IFluidDataStoreRegistry | undefined {\n\t\treturn this.registry;\n\t}\n\n\t/**\n\t * Convenience helper to get the data store's/factory's data store registry entry.\n\t * The return type hides the factory's generics, easing grouping of registry\n\t * entries that differ only in this way into the same array.\n\t * @returns The NamedFluidDataStoreRegistryEntry\n\t */\n\tpublic get registryEntry(): NamedFluidDataStoreRegistryEntry {\n\t\treturn [this.type, Promise.resolve(this)];\n\t}\n\n\t/**\n\t * {@inheritDoc @fluidframework/runtime-definitions#IFluidDataStoreFactory.instantiateDataStore}\n\t */\n\tpublic async instantiateDataStore(\n\t\tcontext: IFluidDataStoreContext,\n\t\texisting: boolean,\n\t): Promise<IFluidDataStoreChannel> {\n\t\tconst { runtime } = await createDataObject(\n\t\t\tthis.ctor,\n\t\t\tcontext,\n\t\t\tthis.sharedObjectRegistry,\n\t\t\tthis.optionalProviders,\n\t\t\tthis.runtimeClass,\n\t\t\texisting,\n\t\t);\n\n\t\treturn runtime;\n\t}\n\n\t/**\n\t * Creates a new instance of the object. Uses parent context's registry to build package path to this factory.\n\t * In other words, registry of context passed in has to contain this factory, with the name that matches\n\t * this factory's type.\n\t * It is intended to be used by data store objects that create sub-objects.\n\t * @param context - The context being used to create the runtime\n\t * (the created object will have its own new context created as well)\n\t * @param initialState - The initial state to provide to the created data store.\n\t * @param loadingGroupId - NOT production ready, EXPERIMENTAL, please read {@link https://github.com/microsoft/FluidFramework/blob/main/packages/runtime/container-runtime/README.md | README}. The service needs to support this feature, does not work for most services\n\t * @returns an object created by this factory. Data store and objects created are not attached to container.\n\t * They get attached only when a handle to one of them is attached to already attached objects.\n\t */\n\tpublic async createChildInstance(\n\t\tparentContext: IFluidDataStoreContext,\n\t\tinitialState?: I[\"InitialState\"],\n\t\tloadingGroupId?: string,\n\t): Promise<TObj> {\n\t\treturn this.createNonRootInstanceCore(\n\t\t\tparentContext.containerRuntime,\n\t\t\t[...parentContext.packagePath, this.type],\n\t\t\tinitialState,\n\t\t\tloadingGroupId,\n\t\t);\n\t}\n\n\t/**\n\t * Creates a new instance of the object. Uses peer context's registry and its package path to identify this factory.\n\t * In other words, registry of context passed in has to have this factory.\n\t * Intended to be used by data store objects that need to create peers (similar) instances of existing objects.\n\t * @param context - The component context being used to create the object\n\t * (the created object will have its own new context created as well)\n\t * @param initialState - The initial state to provide to the created component.\n\t * @param loadingGroupId - NOT production ready, EXPERIMENTAL, please read {@link https://github.com/microsoft/FluidFramework/blob/main/packages/runtime/container-runtime/README.md | README}. The service needs to support this feature, does not work for most services\n\t * @returns an object created by this factory. Data store and objects created are not attached to container.\n\t * They get attached only when a handle to one of them is attached to already attached objects.\n\t */\n\tpublic async createPeerInstance(\n\t\tpeerContext: IFluidDataStoreContext,\n\t\tinitialState?: I[\"InitialState\"],\n\t\tloadingGroupId?: string, // DO NOT USE, this is an experimental feature\n\t): Promise<TObj> {\n\t\treturn this.createNonRootInstanceCore(\n\t\t\tpeerContext.containerRuntime,\n\t\t\tpeerContext.packagePath,\n\t\t\tinitialState,\n\t\t\tloadingGroupId,\n\t\t);\n\t}\n\n\t/**\n\t * Creates a new instance of the object. Uses container's registry to find this factory.\n\t * It's expected that only container owners would use this functionality, as only such developers\n\t * have knowledge of entries in container registry.\n\t * The name in this registry for such record should match type of this factory.\n\t * @param runtime - container runtime. It's registry is used to create an object.\n\t * @param initialState - The initial state to provide to the created component.\n\t * @param loadingGroupId - NOT production ready, EXPERIMENTAL, please read {@link https://github.com/microsoft/FluidFramework/blob/main/packages/runtime/container-runtime/README.md | README}. The service needs to support this feature, does not work for most services\n\t * @returns an object created by this factory. Data store and objects created are not attached to container.\n\t * They get attached only when a handle to one of them is attached to already attached objects.\n\t */\n\tpublic async createInstance(\n\t\truntime: IContainerRuntimeBase,\n\t\tinitialState?: I[\"InitialState\"],\n\t\tloadingGroupId?: string,\n\t): Promise<TObj> {\n\t\treturn this.createNonRootInstanceCore(runtime, [this.type], initialState, loadingGroupId);\n\t}\n\n\t/**\n\t * Creates a new instance of the object with a datastore which exposes the aliasing api.\n\t * @param runtime - container runtime. It is the runtime that will be used to create the object. It will produce\n\t * the underlying infrastructure to get the data object to operate.\n\t * @param initialState - The initial state to provide to the created component.\n\t * @param packagePath - The path to the data store factory to use to create the data object.\n\t * @param loadingGroupId - NOT production ready, EXPERIMENTAL, please read {@link https://github.com/microsoft/FluidFramework/blob/main/packages/runtime/container-runtime/README.md | README}. The service needs to support this feature, does not work for most services\n\t * @returns an array containing the object created by this factory and an IDataStore object that enables users to\n\t * alias the data object.\n\t * The data object is attached only when it is attached to the handle graph that connects to an aliased object or\n\t * when the data object is aliased.\n\t */\n\tpublic async createInstanceWithDataStore(\n\t\tcontainerRuntime: IContainerRuntimeBase,\n\t\tinitialState?: I[\"InitialState\"],\n\t\tpackagePath?: Readonly<string[]>,\n\t\tloadingGroupId?: string,\n\t): Promise<[TObj, IDataStore]> {\n\t\tconst context = containerRuntime.createDetachedDataStore(\n\t\t\tpackagePath ?? [this.type],\n\t\t\tloadingGroupId,\n\t\t);\n\t\tconst { instance, runtime } = await createDataObject(\n\t\t\tthis.ctor,\n\t\t\tcontext,\n\t\t\tthis.sharedObjectRegistry,\n\t\t\tthis.optionalProviders,\n\t\t\tthis.runtimeClass,\n\t\t\tfalse, // existing\n\t\t\tinitialState,\n\t\t);\n\t\tconst dataStore = await context.attachRuntime(this, runtime);\n\n\t\treturn [instance, dataStore];\n\t}\n\n\t/**\n\t * Creates a new root instance of the object. Uses container's registry to find this factory.\n\t * It's expected that only container owners would use this functionality, as only such developers\n\t * have knowledge of entries in container registry.\n\t * The name in this registry for such record should match type of this factory.\n\t * @param runtime - container runtime. It's registry is used to create an object.\n\t * @param initialState - The initial state to provide to the created component.\n\t * @returns an object created by this factory. Data store and objects created are not attached to container.\n\t * They get attached only when a handle to one of them is attached to already attached objects.\n\t *\n\t * @deprecated - the issue is that it does not allow the customer to decide the conflict resolution policy when an\n\t * aliasing conflict occurs. Use {@link PureDataObjectFactory.createInstanceWithDataStore} instead.\n\t */\n\tpublic async createRootInstance(\n\t\trootDataStoreId: string,\n\t\truntime: IContainerRuntime,\n\t\tinitialState?: I[\"InitialState\"],\n\t): Promise<TObj> {\n\t\tconst context = runtime.createDetachedDataStore([this.type]);\n\t\tconst { instance, runtime: dataStoreRuntime } = await createDataObject(\n\t\t\tthis.ctor,\n\t\t\tcontext,\n\t\t\tthis.sharedObjectRegistry,\n\t\t\tthis.optionalProviders,\n\t\t\tthis.runtimeClass,\n\t\t\tfalse, // existing\n\t\t\tinitialState,\n\t\t);\n\t\tconst dataStore = await context.attachRuntime(this, dataStoreRuntime);\n\t\tconst result = await dataStore.trySetAlias(rootDataStoreId);\n\t\tif (result !== \"Success\") {\n\t\t\tconst handle = await runtime.getAliasedDataStoreEntryPoint(rootDataStoreId);\n\t\t\tassert(handle !== undefined, 0x8e1 /* Should have retrieved aliased handle */);\n\t\t\treturn (await handle.get()) as TObj;\n\t\t}\n\t\treturn instance;\n\t}\n\n\tprotected async createNonRootInstanceCore(\n\t\tcontainerRuntime: IContainerRuntimeBase,\n\t\tpackagePath: Readonly<string[]>,\n\t\tinitialState?: I[\"InitialState\"],\n\t\tloadingGroupId?: string,\n\t): Promise<TObj> {\n\t\tconst context = containerRuntime.createDetachedDataStore(packagePath, loadingGroupId);\n\t\treturn this.createInstanceCore(context, initialState);\n\t}\n\n\tprotected async createInstanceCore(\n\t\tcontext: IFluidDataStoreContextDetached,\n\t\tinitialState?: I[\"InitialState\"],\n\t): Promise<TObj> {\n\t\tconst { instance, runtime } = await createDataObject(\n\t\t\tthis.ctor,\n\t\t\tcontext,\n\t\t\tthis.sharedObjectRegistry,\n\t\t\tthis.optionalProviders,\n\t\t\tthis.runtimeClass,\n\t\t\tfalse, // existing\n\t\t\tinitialState,\n\t\t);\n\n\t\tawait context.attachRuntime(this, runtime);\n\n\t\treturn instance;\n\t}\n}\n"]}
1
+ {"version":3,"file":"pureDataObjectFactory.js","sourceRoot":"","sources":["../../src/data-object-factories/pureDataObjectFactory.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,yEAAoF;AAGpF,kEAA6D;AAC7D,iEAI4C;AA6B5C;;;GAGG;AACH,KAAK,UAAU,gBAAgB,CAI9B,IAA8C,EAC9C,OAA+B,EAC/B,oBAA2C,EAC3C,iBAAoE,EACpE,eAA6C,EAC7C,QAAiB,EACjB,SAA6B;IAK7B,OAAO;IACP,IAAI,YAAY,GAAG,eAAe,CAAC;IAEnC,mBAAmB;IACnB,YAAY,GAAG,IAAA,8BAAmB,EACjC,KAAK,EAAE,OAAiB,EAAE,UAAiC,EAAE,EAAE;QAC9D,iFAAiF;QACjF,MAAM,UAAU,GAAG,CAAC,MAAM,UAAU,CAAC,UAAU,CAAC,GAAG,EAAE,CAAS,CAAC;QAC/D,IAAA,iBAAM,EACL,UAAU,CAAC,OAAO,KAAK,SAAS,EAChC,KAAK,CAAC,yDAAyD,CAC/D,CAAC;QACF,OAAO,UAAU,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC;IACpC,CAAC,EACD,YAAY,CACZ,CAAC;IAEF,gFAAgF;IAChF,+DAA+D;IAC/D,6EAA6E;IAC7E,MAAM,OAAO,GAA0B,IAAI,YAAY;IACtD,uCAAuC;IACvC,OAAO,EACP,oBAAoB,EACpB,QAAQ,EACR,KAAK,EAAE,EAA0B,EAAE,EAAE;QACpC,IAAA,iBAAM,EAAC,QAAQ,KAAK,SAAS,EAAE,KAAK,CAAC,6BAA6B,CAAC,CAAC;QACpE,sGAAsG;QACtG,yGAAyG;QACzG,oFAAoF;QACpF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* Licensed under the MIT License.\n */\n\nimport { FluidDataStoreRegistry } from \"@fluidframework/container-runtime/internal\";\nimport type { IContainerRuntime } from \"@fluidframework/container-runtime-definitions/internal\";\nimport type { FluidObject, IRequest } from \"@fluidframework/core-interfaces\";\nimport { assert } from \"@fluidframework/core-utils/internal\";\nimport {\n\tFluidDataStoreRuntime,\n\ttype ISharedObjectRegistry,\n\tmixinRequestHandler,\n} from \"@fluidframework/datastore/internal\";\nimport type {\n\tIChannelFactory,\n\tIFluidDataStoreRuntime,\n} from \"@fluidframework/datastore-definitions/internal\";\nimport type {\n\tIContainerRuntimeBase,\n\tIDataStore,\n\tIFluidDataStoreChannel,\n\tIFluidDataStoreContext,\n\tIFluidDataStoreContextDetached,\n\tIFluidDataStoreFactory,\n\tIFluidDataStoreRegistry,\n\tIProvideFluidDataStoreRegistry,\n\tNamedFluidDataStoreRegistryEntries,\n\tNamedFluidDataStoreRegistryEntry,\n} from \"@fluidframework/runtime-definitions/internal\";\nimport type {\n\tAsyncFluidObjectProvider,\n\tFluidObjectSymbolProvider,\n\tIFluidDependencySynthesizer,\n} from \"@fluidframework/synthesize/internal\";\n\nimport type {\n\tDataObjectTypes,\n\tIDataObjectProps,\n\tPureDataObject,\n} from \"../data-objects/index.js\";\n\n/**\n * Proxy over PureDataObject\n * Does delayed creation & initialization of PureDataObject\n */\nasync function createDataObject<\n\tTObj extends PureDataObject,\n\tI extends DataObjectTypes = DataObjectTypes,\n>(\n\tctor: new (props: IDataObjectProps<I>) => TObj,\n\tcontext: IFluidDataStoreContext,\n\tsharedObjectRegistry: ISharedObjectRegistry,\n\toptionalProviders: FluidObjectSymbolProvider<I[\"OptionalProviders\"]>,\n\truntimeClassArg: typeof FluidDataStoreRuntime,\n\texisting: boolean,\n\tinitProps?: I[\"InitialState\"],\n): Promise<{\n\tinstance: TObj;\n\truntime: FluidDataStoreRuntime;\n}> {\n\t// base\n\tlet runtimeClass = runtimeClassArg;\n\n\t// request mixin in\n\truntimeClass = mixinRequestHandler(\n\t\tasync (request: IRequest, runtimeArg: FluidDataStoreRuntime) => {\n\t\t\t// The provideEntryPoint callback below always returns TObj, so this cast is safe\n\t\t\tconst dataObject = (await runtimeArg.entryPoint.get()) as TObj;\n\t\t\tassert(\n\t\t\t\tdataObject.request !== undefined,\n\t\t\t\t0x795 /* Data store runtime entryPoint does not have request */,\n\t\t\t);\n\t\t\treturn dataObject.request(request);\n\t\t},\n\t\truntimeClass,\n\t);\n\n\t// Create a new runtime for our data store, as if via new FluidDataStoreRuntime,\n\t// but using the runtimeClass that's been augmented with mixins\n\t// The runtime is what Fluid uses to create DDS' and route to your data store\n\tconst runtime: FluidDataStoreRuntime = new runtimeClass(\n\t\t// calls new FluidDataStoreRuntime(...)\n\t\tcontext,\n\t\tsharedObjectRegistry,\n\t\texisting,\n\t\tasync (rt: IFluidDataStoreRuntime) => {\n\t\t\tassert(instance !== undefined, 0x46a /* entryPoint is undefined */);\n\t\t\t// Calling finishInitialization here like PureDataObject.getDataObject did, to keep the same behavior,\n\t\t\t// since accessing the runtime's entryPoint is how we want the data object to be retrieved going forward.\n\t\t\t// Without this I ran into issues with the load-existing flow not working correctly.\n\t\t\tawait instance.finishInitialization(true);\n\t\t\treturn instance;\n\t\t} /* provideEntryPoint */,\n\t);\n\n\t// Create object right away.\n\t// This allows object to register various callbacks with runtime before runtime\n\t// becomes globally available. But it's not full initialization - constructor can't\n\t// access DDSes or other services of runtime as objects are not fully initialized.\n\t// In order to use object, we need to go through full initialization by calling finishInitialization().\n\tconst scope: FluidObject<IFluidDependencySynthesizer> = context.scope;\n\tconst providers =\n\t\tscope.IFluidDependencySynthesizer?.synthesize<I[\"OptionalProviders\"]>(\n\t\t\toptionalProviders,\n\t\t\t{},\n\t\t) ??\n\t\t// eslint-disable-next-line @typescript-eslint/consistent-type-assertions\n\t\t({} as AsyncFluidObjectProvider<never>);\n\n\tconst instance = new ctor({ runtime, context, providers, initProps });\n\n\t// if it's a newly created object, we need to wait for it to finish initialization\n\t// as that results in creation of DDSes, before it gets attached, providing atomic\n\t// guarantee of creation.\n\t// WARNING: we can't do the same (yet) for already existing PureDataObject!\n\t// This will result in deadlock, as it tries to resolve internal handles, but any\n\t// handle resolution goes through root (container runtime), which can't route it back\n\t// to this data store, as it's still not initialized and not known to container runtime yet.\n\t// In the future, we should address it by using relative paths for handles and be able to resolve\n\t// local DDSes while data store is not fully initialized.\n\tif (!existing) {\n\t\tawait instance.finishInitialization(existing);\n\t}\n\n\treturn { instance, runtime };\n}\n\n/**\n * PureDataObjectFactory is a bare-bones IFluidDataStoreFactory for use with PureDataObject.\n * Consumers should typically use DataObjectFactory instead unless creating\n * another base data store factory.\n *\n * @typeParam TObj - DataObject (concrete type)\n * @typeParam I - The input types for the DataObject\n * @legacy\n * @alpha\n */\nexport class PureDataObjectFactory<\n\tTObj extends PureDataObject<I>,\n\tI extends DataObjectTypes = DataObjectTypes,\n> implements IFluidDataStoreFactory, Partial<IProvideFluidDataStoreRegistry>\n{\n\tprivate readonly sharedObjectRegistry: ISharedObjectRegistry;\n\tprivate readonly registry: IFluidDataStoreRegistry | undefined;\n\n\tpublic constructor(\n\t\t/**\n\t\t * {@inheritDoc @fluidframework/runtime-definitions#IFluidDataStoreFactory.\"type\"}\n\t\t */\n\t\tpublic readonly type: string,\n\t\tprivate readonly ctor: new (props: IDataObjectProps<I>) => TObj,\n\t\tsharedObjects: readonly IChannelFactory[],\n\t\tprivate readonly optionalProviders: FluidObjectSymbolProvider<I[\"OptionalProviders\"]>,\n\t\tregistryEntries?: NamedFluidDataStoreRegistryEntries,\n\t\tprivate readonly runtimeClass: typeof FluidDataStoreRuntime = FluidDataStoreRuntime,\n\t) {\n\t\tif (this.type === \"\") {\n\t\t\tthrow new Error(\"undefined type member\");\n\t\t}\n\t\tif (registryEntries !== undefined) {\n\t\t\tthis.registry = new FluidDataStoreRegistry(registryEntries);\n\t\t}\n\t\tthis.sharedObjectRegistry = new Map(sharedObjects.map((ext) => [ext.type, ext]));\n\t}\n\n\t/**\n\t * {@inheritDoc @fluidframework/runtime-definitions#IProvideFluidDataStoreFactory.IFluidDataStoreFactory}\n\t */\n\tpublic get IFluidDataStoreFactory(): this {\n\t\treturn this;\n\t}\n\n\t/**\n\t * {@inheritDoc @fluidframework/runtime-definitions#IProvideFluidDataStoreRegistry.IFluidDataStoreRegistry}\n\t */\n\tpublic get IFluidDataStoreRegistry(): IFluidDataStoreRegistry | undefined {\n\t\treturn this.registry;\n\t}\n\n\t/**\n\t * Convenience helper to get the data store's/factory's data store registry entry.\n\t * The return type hides the factory's generics, easing grouping of registry\n\t * entries that differ only in this way into the same array.\n\t * @returns The NamedFluidDataStoreRegistryEntry\n\t */\n\tpublic get registryEntry(): NamedFluidDataStoreRegistryEntry {\n\t\treturn [this.type, Promise.resolve(this)];\n\t}\n\n\t/**\n\t * {@inheritDoc @fluidframework/runtime-definitions#IFluidDataStoreFactory.instantiateDataStore}\n\t */\n\tpublic async instantiateDataStore(\n\t\tcontext: IFluidDataStoreContext,\n\t\texisting: boolean,\n\t): Promise<IFluidDataStoreChannel> {\n\t\tconst { runtime } = await createDataObject(\n\t\t\tthis.ctor,\n\t\t\tcontext,\n\t\t\tthis.sharedObjectRegistry,\n\t\t\tthis.optionalProviders,\n\t\t\tthis.runtimeClass,\n\t\t\texisting,\n\t\t);\n\n\t\treturn runtime;\n\t}\n\n\t/**\n\t * Creates a new instance of the object. Uses parent context's registry to build package path to this factory.\n\t * In other words, registry of context passed in has to contain this factory, with the name that matches\n\t * this factory's type.\n\t * It is intended to be used by data store objects that create sub-objects.\n\t * @param context - The context being used to create the runtime\n\t * (the created object will have its own new context created as well)\n\t * @param initialState - The initial state to provide to the created data store.\n\t * @param loadingGroupId - NOT production ready, EXPERIMENTAL, please read {@link https://github.com/microsoft/FluidFramework/blob/main/packages/runtime/container-runtime/README.md | README}. The service needs to support this feature, does not work for most services\n\t * @returns an object created by this factory. Data store and objects created are not attached to container.\n\t * They get attached only when a handle to one of them is attached to already attached objects.\n\t */\n\tpublic async createChildInstance(\n\t\tparentContext: IFluidDataStoreContext,\n\t\tinitialState?: I[\"InitialState\"],\n\t\tloadingGroupId?: string,\n\t): Promise<TObj> {\n\t\treturn this.createNonRootInstanceCore(\n\t\t\tparentContext.containerRuntime,\n\t\t\t[...parentContext.packagePath, this.type],\n\t\t\tinitialState,\n\t\t\tloadingGroupId,\n\t\t);\n\t}\n\n\t/**\n\t * Creates a new instance of the object. Uses peer context's registry and its package path to identify this factory.\n\t * In other words, registry of context passed in has to have this factory.\n\t * Intended to be used by data store objects that need to create peers (similar) instances of existing objects.\n\t * @param context - The component context being used to create the object\n\t * (the created object will have its own new context created as well)\n\t * @param initialState - The initial state to provide to the created component.\n\t * @param loadingGroupId - NOT production ready, EXPERIMENTAL, please read {@link https://github.com/microsoft/FluidFramework/blob/main/packages/runtime/container-runtime/README.md | README}. The service needs to support this feature, does not work for most services\n\t * @returns an object created by this factory. Data store and objects created are not attached to container.\n\t * They get attached only when a handle to one of them is attached to already attached objects.\n\t */\n\tpublic async createPeerInstance(\n\t\tpeerContext: IFluidDataStoreContext,\n\t\tinitialState?: I[\"InitialState\"],\n\t\tloadingGroupId?: string, // DO NOT USE, this is an experimental feature\n\t): Promise<TObj> {\n\t\treturn this.createNonRootInstanceCore(\n\t\t\tpeerContext.containerRuntime,\n\t\t\tpeerContext.packagePath,\n\t\t\tinitialState,\n\t\t\tloadingGroupId,\n\t\t);\n\t}\n\n\t/**\n\t * Creates a new instance of the object. Uses container's registry to find this factory.\n\t * It's expected that only container owners would use this functionality, as only such developers\n\t * have knowledge of entries in container registry.\n\t * The name in this registry for such record should match type of this factory.\n\t * @param runtime - container runtime. It's registry is used to create an object.\n\t * @param initialState - The initial state to provide to the created component.\n\t * @param loadingGroupId - NOT production ready, EXPERIMENTAL, please read {@link https://github.com/microsoft/FluidFramework/blob/main/packages/runtime/container-runtime/README.md | README}. The service needs to support this feature, does not work for most services\n\t * @returns an object created by this factory. Data store and objects created are not attached to container.\n\t * They get attached only when a handle to one of them is attached to already attached objects.\n\t */\n\tpublic async createInstance(\n\t\truntime: IContainerRuntimeBase,\n\t\tinitialState?: I[\"InitialState\"],\n\t\tloadingGroupId?: string,\n\t): Promise<TObj> {\n\t\treturn this.createNonRootInstanceCore(runtime, [this.type], initialState, loadingGroupId);\n\t}\n\n\t/**\n\t * Creates a new instance of the object with a datastore which exposes the aliasing api.\n\t * @param runtime - container runtime. It is the runtime that will be used to create the object. It will produce\n\t * the underlying infrastructure to get the data object to operate.\n\t * @param initialState - The initial state to provide to the created component.\n\t * @param packagePath - The path to the data store factory to use to create the data object.\n\t * @param loadingGroupId - NOT production ready, EXPERIMENTAL, please read {@link https://github.com/microsoft/FluidFramework/blob/main/packages/runtime/container-runtime/README.md | README}. The service needs to support this feature, does not work for most services\n\t * @returns an array containing the object created by this factory and an IDataStore object that enables users to\n\t * alias the data object.\n\t * The data object is attached only when it is attached to the handle graph that connects to an aliased object or\n\t * when the data object is aliased.\n\t */\n\tpublic async createInstanceWithDataStore(\n\t\tcontainerRuntime: IContainerRuntimeBase,\n\t\tinitialState?: I[\"InitialState\"],\n\t\tpackagePath?: Readonly<string[]>,\n\t\tloadingGroupId?: string,\n\t): Promise<[TObj, IDataStore]> {\n\t\tconst context = containerRuntime.createDetachedDataStore(\n\t\t\tpackagePath ?? [this.type],\n\t\t\tloadingGroupId,\n\t\t);\n\t\tconst { instance, runtime } = await createDataObject(\n\t\t\tthis.ctor,\n\t\t\tcontext,\n\t\t\tthis.sharedObjectRegistry,\n\t\t\tthis.optionalProviders,\n\t\t\tthis.runtimeClass,\n\t\t\tfalse, // existing\n\t\t\tinitialState,\n\t\t);\n\t\tconst dataStore = await context.attachRuntime(this, runtime);\n\n\t\treturn [instance, dataStore];\n\t}\n\n\t/**\n\t * Creates a new root instance of the object. Uses container's registry to find this factory.\n\t * It's expected that only container owners would use this functionality, as only such developers\n\t * have knowledge of entries in container registry.\n\t * The name in this registry for such record should match type of this factory.\n\t * @param runtime - container runtime. It's registry is used to create an object.\n\t * @param initialState - The initial state to provide to the created component.\n\t * @returns an object created by this factory. Data store and objects created are not attached to container.\n\t * They get attached only when a handle to one of them is attached to already attached objects.\n\t *\n\t * @deprecated - the issue is that it does not allow the customer to decide the conflict resolution policy when an\n\t * aliasing conflict occurs. Use {@link PureDataObjectFactory.createInstanceWithDataStore} instead.\n\t */\n\tpublic async createRootInstance(\n\t\trootDataStoreId: string,\n\t\truntime: IContainerRuntime,\n\t\tinitialState?: I[\"InitialState\"],\n\t): Promise<TObj> {\n\t\tconst context = runtime.createDetachedDataStore([this.type]);\n\t\tconst { instance, runtime: dataStoreRuntime } = await createDataObject(\n\t\t\tthis.ctor,\n\t\t\tcontext,\n\t\t\tthis.sharedObjectRegistry,\n\t\t\tthis.optionalProviders,\n\t\t\tthis.runtimeClass,\n\t\t\tfalse, // existing\n\t\t\tinitialState,\n\t\t);\n\t\tconst dataStore = await context.attachRuntime(this, dataStoreRuntime);\n\t\tconst result = await dataStore.trySetAlias(rootDataStoreId);\n\t\tif (result !== \"Success\") {\n\t\t\tconst handle = await runtime.getAliasedDataStoreEntryPoint(rootDataStoreId);\n\t\t\tassert(handle !== undefined, 0x8e1 /* Should have retrieved aliased handle */);\n\t\t\treturn (await handle.get()) as TObj;\n\t\t}\n\t\treturn instance;\n\t}\n\n\tprotected async createNonRootInstanceCore(\n\t\tcontainerRuntime: IContainerRuntimeBase,\n\t\tpackagePath: Readonly<string[]>,\n\t\tinitialState?: I[\"InitialState\"],\n\t\tloadingGroupId?: string,\n\t): Promise<TObj> {\n\t\tconst context = containerRuntime.createDetachedDataStore(packagePath, loadingGroupId);\n\t\treturn this.createInstanceCore(context, initialState);\n\t}\n\n\tprotected async createInstanceCore(\n\t\tcontext: IFluidDataStoreContextDetached,\n\t\tinitialState?: I[\"InitialState\"],\n\t): Promise<TObj> {\n\t\tconst { instance, runtime } = await createDataObject(\n\t\t\tthis.ctor,\n\t\t\tcontext,\n\t\t\tthis.sharedObjectRegistry,\n\t\t\tthis.optionalProviders,\n\t\t\tthis.runtimeClass,\n\t\t\tfalse, // existing\n\t\t\tinitialState,\n\t\t);\n\n\t\tawait context.attachRuntime(this, runtime);\n\n\t\treturn instance;\n\t}\n}\n"]}
@@ -5,7 +5,7 @@
5
5
  import { type ISharedDirectory } from "@fluidframework/map/internal";
6
6
  import type { SharedObjectKind } from "@fluidframework/shared-object-base";
7
7
  import { PureDataObject } from "./pureDataObject.js";
8
- import type { DataObjectTypes } from "./types.js";
8
+ import type { DataObjectKind, DataObjectTypes } from "./types.js";
9
9
  /**
10
10
  * DataObject is a base data store that is primed with a root directory. It
11
11
  * ensures that it is created and ready before you can access it.
@@ -42,5 +42,5 @@ export declare abstract class DataObject<I extends DataObjectTypes = DataObjectT
42
42
  * @typeParam T - The kind of data object.
43
43
  * @internal
44
44
  */
45
- export declare function createDataObjectKind<T extends new (...any: any[]) => DataObject>(factory: T): T & SharedObjectKind<InstanceType<T>>;
45
+ export declare function createDataObjectKind<T extends DataObjectKind>(factory: T): T & SharedObjectKind<T extends DataObjectKind<infer I> ? I : unknown>;
46
46
  //# sourceMappingURL=dataObject.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"dataObject.d.ts","sourceRoot":"","sources":["../../src/data-objects/dataObject.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EACN,KAAK,gBAAgB,EAGrB,MAAM,8BAA8B,CAAC;AACtC,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,oCAAoC,CAAC;AAE3E,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AACrD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAElD;;;;;;;;;;;GAWG;AACH,8BAAsB,UAAU,CAC/B,CAAC,SAAS,eAAe,GAAG,eAAe,CAC1C,SAAQ,cAAc,CAAC,CAAC,CAAC;IAC1B,OAAO,CAAC,YAAY,CAA+B;IACnD,OAAO,CAAC,QAAQ,CAAC,eAAe,CAAU;IAE1C;;;OA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I,CAAC,eAAe,CAAC,CAAC;YAC/E,IAAI,CAAC,YAAY,CAAC,aAAa,EAAE,CAAC;QACnC,CAAC;QAED,MAAM,KAAK,CAAC,kBAAkB,CAAC,QAAQ,CAAC,CAAC;IAC1C,CAAC;IAED;;;OAGG;IACO,2BAA2B,CAAC,IAAY;QACjD,OAAO,GAAG,IAAI,6CAA6C,CAAC;IAC7D,CAAC;CACD;AAxDD,gCAwDC;AAED;;;;GAIG;AACH,SAAgB,oBAAoB,CACnC,OAAU;IAEV,OAAO,OAAgD,CAAC;AACzD,CAAC;AAJD,oDAIC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport {\n\ttype ISharedDirectory,\n\tMapFactory,\n\tSharedDirectory,\n} from \"@fluidframework/map/internal\";\nimport type { SharedObjectKind } from \"@fluidframework/shared-object-base\";\n\nimport { PureDataObject } from \"./pureDataObject.js\";\nimport type { DataObjectTypes } from \"./types.js\";\n\n/**\n * DataObject is a base data store that is primed with a root directory. It\n * ensures that it is created and ready before you can access it.\n *\n * Having a single root directory allows for easier development. Instead of creating\n * and registering channels with the runtime any new DDS that is set on the root\n * will automatically be registered.\n *\n * @typeParam I - The optional input types used to strongly type the data object\n * @legacy\n * @alpha\n */\nexport abstract class DataObject<\n\tI extends DataObjectTypes = DataObjectTypes,\n> extends PureDataObject<I> {\n\tprivate internalRoot: ISharedDirectory | undefined;\n\tprivate readonly rootDirectoryId = \"root\";\n\n\t/**\n\t * The root directory will either be ready or will return an error. If an error is thrown\n\t * the root has not been correctly created/set.\n\t */\n\tprotected get root(): ISharedDirectory {\n\t\tif (!this.internalRoot) {\n\t\t\tthrow new Error(this.getUninitializedErrorString(`root`));\n\t\t}\n\n\t\treturn this.internalRoot;\n\t}\n\n\t/**\n\t * Initializes internal objects and calls initialization overrides.\n\t * Caller is responsible for ensuring this is only invoked once.\n\t */\n\tpublic override async initializeInternal(existing: boolean): Promise<void> {\n\t\tif (existing) {\n\t\t\t// data store has a root directory so we just need to set it before calling initializingFromExisting\n\t\t\tthis.internalRoot = (await this.runtime.getChannel(\n\t\t\t\tthis.rootDirectoryId,\n\t\t\t)) as ISharedDirectory;\n\n\t\t\t// This will actually be an ISharedMap if the channel was previously created by the older version of\n\t\t\t// DataObject which used a SharedMap. Since SharedMap and SharedDirectory are compatible unless\n\t\t\t// SharedDirectory-only commands are used on SharedMap, this will mostly just work for compatibility.\n\t\t\tif (this.internalRoot.attributes.type === MapFactory.Type) {\n\t\t\t\tthis.runtime.logger.send({\n\t\t\t\t\tcategory: \"generic\",\n\t\t\t\t\teventName: \"MapDataObject\",\n\t\t\t\t\tmessage:\n\t\t\t\t\t\t\"Legacy document, SharedMap is masquerading as SharedDirectory in DataObject\",\n\t\t\t\t});\n\t\t\t}\n\t\t} else {\n\t\t\t// Create a root directory and register it before calling initializingFirstTime\n\t\t\tthis.internalRoot = SharedDirectory.create(this.runtime, this.rootDirectoryId);\n\t\t\tthis.internalRoot.bindToContext();\n\t\t}\n\n\t\tawait super.initializeInternal(existing);\n\t}\n\n\t/**\n\t * Generates an error string indicating an item is uninitialized.\n\t * @param item - The name of the item that was uninitialized.\n\t */\n\tprotected getUninitializedErrorString(item: string): string {\n\t\treturn `${item} must be initialized before being accessed.`;\n\t}\n}\n\n/**\n * Utility for creating SharedObjectKind instances for data objects.\n * @typeParam T - The kind of data object.\n * @internal\n */\nexport function createDataObjectKind<T extends new (...any) => DataObject>(\n\tfactory: T,\n): T & SharedObjectKind<InstanceType<T>> {\n\treturn factory as T & SharedObjectKind<InstanceType<T>>;\n}\n"]}
1
+ {"version":3,"file":"dataObject.js","sourceRoot":"","sources":["../../src/data-objects/dataObject.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,2DAIsC;AAGtC,2DAAqD;AAGrD;;;;;;;;;;;GAWG;AACH,MAAsB,UAEpB,SAAQ,kCAAiB;IAF3B;;QAIkB,oBAAe,GAAG,MAAM,CAAC;IAoD3C,CAA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Content":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport {\n\ttype ISharedDirectory,\n\tMapFactory,\n\tSharedDirectory,\n} from \"@fluidframework/map/internal\";\nimport type { SharedObjectKind } from \"@fluidframework/shared-object-base\";\n\nimport { PureDataObject } from \"./pureDataObject.js\";\nimport type { DataObjectKind, DataObjectTypes } from \"./types.js\";\n\n/**\n * DataObject is a base data store that is primed with a root directory. It\n * ensures that it is created and ready before you can access it.\n *\n * Having a single root directory allows for easier development. Instead of creating\n * and registering channels with the runtime any new DDS that is set on the root\n * will automatically be registered.\n *\n * @typeParam I - The optional input types used to strongly type the data object\n * @legacy\n * @alpha\n */\nexport abstract class DataObject<\n\tI extends DataObjectTypes = DataObjectTypes,\n> extends PureDataObject<I> {\n\tprivate internalRoot: ISharedDirectory | undefined;\n\tprivate readonly rootDirectoryId = \"root\";\n\n\t/**\n\t * The root directory will either be ready or will return an error. If an error is thrown\n\t * the root has not been correctly created/set.\n\t */\n\tprotected get root(): ISharedDirectory {\n\t\tif (!this.internalRoot) {\n\t\t\tthrow new Error(this.getUninitializedErrorString(`root`));\n\t\t}\n\n\t\treturn this.internalRoot;\n\t}\n\n\t/**\n\t * Initializes internal objects and calls initialization overrides.\n\t * Caller is responsible for ensuring this is only invoked once.\n\t */\n\tpublic override async initializeInternal(existing: boolean): Promise<void> {\n\t\tif (existing) {\n\t\t\t// data store has a root directory so we just need to set it before calling initializingFromExisting\n\t\t\tthis.internalRoot = (await this.runtime.getChannel(\n\t\t\t\tthis.rootDirectoryId,\n\t\t\t)) as ISharedDirectory;\n\n\t\t\t// This will actually be an ISharedMap if the channel was previously created by the older version of\n\t\t\t// DataObject which used a SharedMap. Since SharedMap and SharedDirectory are compatible unless\n\t\t\t// SharedDirectory-only commands are used on SharedMap, this will mostly just work for compatibility.\n\t\t\tif (this.internalRoot.attributes.type === MapFactory.Type) {\n\t\t\t\tthis.runtime.logger.send({\n\t\t\t\t\tcategory: \"generic\",\n\t\t\t\t\teventName: \"MapDataObject\",\n\t\t\t\t\tmessage:\n\t\t\t\t\t\t\"Legacy document, SharedMap is masquerading as SharedDirectory in DataObject\",\n\t\t\t\t});\n\t\t\t}\n\t\t} else {\n\t\t\t// Create a root directory and register it before calling initializingFirstTime\n\t\t\tthis.internalRoot = SharedDirectory.create(this.runtime, this.rootDirectoryId);\n\t\t\tthis.internalRoot.bindToContext();\n\t\t}\n\n\t\tawait super.initializeInternal(existing);\n\t}\n\n\t/**\n\t * Generates an error string indicating an item is uninitialized.\n\t * @param item - The name of the item that was uninitialized.\n\t */\n\tprotected getUninitializedErrorString(item: string): string {\n\t\treturn `${item} must be initialized before being accessed.`;\n\t}\n}\n\n/**\n * Utility for creating SharedObjectKind instances for data objects.\n * @typeParam T - The kind of data object.\n * @internal\n */\nexport function createDataObjectKind<T extends DataObjectKind>(\n\tfactory: T,\n): T & SharedObjectKind<T extends DataObjectKind<infer I> ? I : unknown> {\n\treturn factory as T & SharedObjectKind<T extends DataObjectKind<infer I> ? I : unknown>;\n}\n"]}
@@ -4,5 +4,5 @@
4
4
  */
5
5
  export { DataObject, createDataObjectKind } from "./dataObject.js";
6
6
  export { PureDataObject } from "./pureDataObject.js";
7
- export type { DataObjectTypes, IDataObjectProps } from "./types.js";
7
+ export type { DataObjectKind, DataObjectTypes, IDataObjectProps } from "./types.js";
8
8
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/data-objects/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,UAAU,EAAE,oBAAoB,EAAE,MAAM,iBAAiB,CAAC;AACnE,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AACrD,YAAY,EAAE,eAAe,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/data-objects/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,UAAU,EAAE,oBAAoB,EAAE,MAAM,iBAAiB,CAAC;AACnE,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AACrD,YAAY,EAAE,cAAc,EAAE,eAAe,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/data-objects/index.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,iDAAmE;AAA1D,2GAAA,UAAU,OAAA;AAAE,qHAAA,oBAAoB,OAAA;AACzC,yDAAqD;AAA5C,mHAAA,cAAc,OAAA","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nexport { DataObject, createDataObjectKind } from \"./dataObject.js\";\nexport { PureDataObject } from \"./pureDataObject.js\";\nexport type { DataObjectTypes, IDataObjectProps } from \"./types.js\";\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/data-objects/index.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,iDAAmE;AAA1D,2GAAA,UAAU,OAAA;AAAE,qHAAA,oBAAoB,OAAA;AACzC,yDAAqD;AAA5C,mHAAA,cAAc,OAAA","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nexport { DataObject, createDataObjectKind } from \"./dataObject.js\";\nexport { PureDataObject } from \"./pureDataObject.js\";\nexport type { DataObjectKind, DataObjectTypes, IDataObjectProps } from \"./types.js\";\n"]}
@@ -4,7 +4,7 @@
4
4
  */
5
5
  import type { FluidObject, IEvent } from "@fluidframework/core-interfaces";
6
6
  import type { IFluidDataStoreRuntime } from "@fluidframework/datastore-definitions/internal";
7
- import type { IFluidDataStoreContext } from "@fluidframework/runtime-definitions/internal";
7
+ import type { IFluidDataStoreContext, IFluidDataStoreFactory } from "@fluidframework/runtime-definitions/internal";
8
8
  import type { AsyncFluidObjectProvider } from "@fluidframework/synthesize/internal";
9
9
  /**
10
10
  * This type is used as the base generic input to DataObject and PureDataObject.
@@ -35,4 +35,21 @@ export interface IDataObjectProps<I extends DataObjectTypes = DataObjectTypes> {
35
35
  readonly providers: AsyncFluidObjectProvider<I["OptionalProviders"]>;
36
36
  readonly initProps?: I["InitialState"];
37
37
  }
38
+ /**
39
+ * An object that has a factory that can create a data object.
40
+ * @typeParam T - The type of the data object.
41
+ * @internal
42
+ */
43
+ export type DataObjectKind<T = unknown> = {
44
+ readonly factory: IFluidDataStoreFactory;
45
+ } & ({
46
+ /**
47
+ * Not actually used, but required for strong typing.
48
+ */
49
+ readonly makeCovariant?: T | undefined;
50
+ }
51
+ /**
52
+ * Not actually used, but helps with strong typing.
53
+ */
54
+ | (new (...args: never[]) => T));
38
55
  //# sourceMappingURL=types.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/data-objects/types.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,EAAE,MAAM,iCAAiC,CAAC;AAC3E,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,gDAAgD,CAAC;AAC7F,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,8CAA8C,CAAC;AAC3F,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,qCAAqC,CAAC;AAEpF;;;;GAIG;AACH,MAAM,WAAW,eAAe;IAC/B;;OAEG;IACH,iBAAiB,CAAC,EAAE,WAAW,CAAC;IAChC;;OAEG;IAGH,YAAY,CAAC,EAAE,GAAG,CAAC;IACnB;;OAEG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;CAChB;AAED;;;GAGG;AACH,MAAM,WAAW,gBAAgB,CAAC,CAAC,SAAS,eAAe,GAAG,eAAe;IAC5E,QAAQ,CAAC,OAAO,EAAE,sBAAsB,CAAC;IACzC,QAAQ,CAAC,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CAAC,GAAG,SAAS,CAAC;CACtC;AACH;;GAEG;GACD,CAAC,KACD,GAAG,IAAI,EAAE,KAAK,EAAE,KACX,CAAC,CAAC,CACT,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/data-objects/types.ts"],"names":[],"mappings":";AAAA;;;GAGG","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport type { FluidObject, IEvent } from \"@fluidframework/core-interfaces\";\nimport type { IFluidDataStoreRuntime } from \"@fluidframework/datastore-definitions/internal\";\nimport type { IFluidDataStoreContext } from \"@fluidframework/runtime-definitions/internal\";\nimport type { AsyncFluidObjectProvider } from \"@fluidframework/synthesize/internal\";\n\n/**\n * This type is used as the base generic input to DataObject and PureDataObject.\n * @legacy\n * @alpha\n */\nexport interface DataObjectTypes {\n\t/**\n\t * Represents a type that will define optional providers that will be injected.\n\t */\n\tOptionalProviders?: FluidObject;\n\t/**\n\t * The initial state type that the produced data object may take during creation.\n\t */\n\t// TODO: Use a real type here.\n\t// eslint-disable-next-line @typescript-eslint/no-explicit-any\n\tInitialState?: any;\n\t/**\n\t * Represents events that will be available in the EventForwarder.\n\t */\n\tEvents?: IEvent;\n}\n\n/**\n * @legacy\n * @alpha\n */\nexport interface IDataObjectProps<I extends DataObjectTypes = DataObjectTypes> {\n\treadonly runtime: IFluidDataStoreRuntime;\n\treadonly context: IFluidDataStoreContext;\n\treadonly providers: AsyncFluidObjectProvider<I[\"OptionalProviders\"]>;\n\treadonly initProps?: I[\"InitialState\"];\n}\n"]}
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/data-objects/types.ts"],"names":[],"mappings":";AAAA;;;GAGG","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport type { FluidObject, IEvent } from \"@fluidframework/core-interfaces\";\nimport type { IFluidDataStoreRuntime } from \"@fluidframework/datastore-definitions/internal\";\nimport type {\n\tIFluidDataStoreContext,\n\tIFluidDataStoreFactory,\n} from \"@fluidframework/runtime-definitions/internal\";\nimport type { AsyncFluidObjectProvider } from \"@fluidframework/synthesize/internal\";\n\n/**\n * This type is used as the base generic input to DataObject and PureDataObject.\n * @legacy\n * @alpha\n */\nexport interface DataObjectTypes {\n\t/**\n\t * Represents a type that will define optional providers that will be injected.\n\t */\n\tOptionalProviders?: FluidObject;\n\t/**\n\t * The initial state type that the produced data object may take during creation.\n\t */\n\t// TODO: Use a real type here.\n\t// eslint-disable-next-line @typescript-eslint/no-explicit-any\n\tInitialState?: any;\n\t/**\n\t * Represents events that will be available in the EventForwarder.\n\t */\n\tEvents?: IEvent;\n}\n\n/**\n * @legacy\n * @alpha\n */\nexport interface IDataObjectProps<I extends DataObjectTypes = DataObjectTypes> {\n\treadonly runtime: IFluidDataStoreRuntime;\n\treadonly context: IFluidDataStoreContext;\n\treadonly providers: AsyncFluidObjectProvider<I[\"OptionalProviders\"]>;\n\treadonly initProps?: I[\"InitialState\"];\n}\n\n/**\n * An object that has a factory that can create a data object.\n * @typeParam T - The type of the data object.\n * @internal\n */\nexport type DataObjectKind<T = unknown> = {\n\treadonly factory: IFluidDataStoreFactory;\n} & (\n\t| {\n\t\t\t/**\n\t\t\t * Not actually used, but required for strong typing.\n\t\t\t */\n\t\t\treadonly makeCovariant?: T | undefined;\n\t }\n\t/**\n\t * Not actually used, but helps with strong typing.\n\t */\n\t| (new (\n\t\t\t...args: never[]\n\t ) => T)\n);\n"]}
package/dist/index.d.ts CHANGED
@@ -17,6 +17,6 @@
17
17
  * @packageDocumentation
18
18
  */
19
19
  export { DataObjectFactory, PureDataObjectFactory } from "./data-object-factories/index.js";
20
- export { DataObject, type DataObjectTypes, type IDataObjectProps, PureDataObject, createDataObjectKind, } from "./data-objects/index.js";
20
+ export { DataObject, type DataObjectKind, type DataObjectTypes, type IDataObjectProps, PureDataObject, createDataObjectKind, } from "./data-objects/index.js";
21
21
  export { BaseContainerRuntimeFactory, type BaseContainerRuntimeFactoryProps, ContainerRuntimeFactoryWithDefaultDataStore, type ContainerRuntimeFactoryWithDefaultDataStoreProps, } from "./container-runtime-factories/index.js";
22
22
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;;;;;;;;;;;;GAaG;AAEH,OAAO,EAAE,iBAAiB,EAAE,qBAAqB,EAAE,MAAM,kCAAkC,CAAC;AAC5F,OAAO,EACN,UAAU,EACV,KAAK,eAAe,EACpB,KAAK,gBAAgB,EACrB,cAAc,EACd,oBAAoB,GACpB,MAAM,yBAAyB,CAAC;AACjC,OAAO,EACN,2BAA2B,EAC3B,KAAK,gCAAgC,EACrC,2CAA2C,EAC3C,KAAK,gDAAgD,GACrD,MAAM,wCAAwC,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;;;;;;;;;;;;GAaG;AAEH,OAAO,EAAE,iBAAiB,EAAE,qBAAqB,EAAE,MAAM,kCAAkC,CAAC;AAC5F,OAAO,EACN,UAAU,EACV,KAAK,cAAc,EACnB,KAAK,eAAe,EACpB,KAAK,gBAAgB,EACrB,cAAc,EACd,oBAAoB,GACpB,MAAM,yBAAyB,CAAC;AACjC,OAAO,EACN,2BAA2B,EAC3B,KAAK,gCAAgC,EACrC,2CAA2C,EAC3C,KAAK,gDAAgD,GACrD,MAAM,wCAAwC,CAAC"}
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH;;;;;;;;;;;;;GAaG;AAEH,6DAA4F;AAAnF,6GAAA,iBAAiB,OAAA;AAAE,iHAAA,qBAAqB,OAAA;AACjD,oDAMiC;AALhC,sGAAA,UAAU,OAAA;AAGV,0GAAA,cAAc,OAAA;AACd,gHAAA,oBAAoB,OAAA;AAErB,mEAKgD;AAJ/C,uHAAA,2BAA2B,OAAA;AAE3B,uIAAA,2CAA2C,OAAA","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\n/**\n * The `aqueduct` package is a library for building Fluid objects and Fluid\n * containers within the Fluid Framework. Its goal is to provide a thin base\n * layer over the existing Fluid Framework interfaces that allows developers to\n * get started quickly.\n *\n * @remarks\n * About the library name: An \"aqueduct\" is a way to transport water from a source\n * to another location. The library name was chosen because its purpose is to\n * facilitate using lower level constructs and therefore handle 'fluid' items\n * same as an aqueduct.\n *\n * @packageDocumentation\n */\n\nexport { DataObjectFactory, PureDataObjectFactory } from \"./data-object-factories/index.js\";\nexport {\n\tDataObject,\n\ttype DataObjectTypes,\n\ttype IDataObjectProps,\n\tPureDataObject,\n\tcreateDataObjectKind,\n} from \"./data-objects/index.js\";\nexport {\n\tBaseContainerRuntimeFactory,\n\ttype BaseContainerRuntimeFactoryProps,\n\tContainerRuntimeFactoryWithDefaultDataStore,\n\ttype ContainerRuntimeFactoryWithDefaultDataStoreProps,\n} from \"./container-runtime-factories/index.js\";\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH;;;;;;;;;;;;;GAaG;AAEH,6DAA4F;AAAnF,6GAAA,iBAAiB,OAAA;AAAE,iHAAA,qBAAqB,OAAA;AACjD,oDAOiC;AANhC,sGAAA,UAAU,OAAA;AAIV,0GAAA,cAAc,OAAA;AACd,gHAAA,oBAAoB,OAAA;AAErB,mEAKgD;AAJ/C,uHAAA,2BAA2B,OAAA;AAE3B,uIAAA,2CAA2C,OAAA","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\n/**\n * The `aqueduct` package is a library for building Fluid objects and Fluid\n * containers within the Fluid Framework. Its goal is to provide a thin base\n * layer over the existing Fluid Framework interfaces that allows developers to\n * get started quickly.\n *\n * @remarks\n * About the library name: An \"aqueduct\" is a way to transport water from a source\n * to another location. The library name was chosen because its purpose is to\n * facilitate using lower level constructs and therefore handle 'fluid' items\n * same as an aqueduct.\n *\n * @packageDocumentation\n */\n\nexport { DataObjectFactory, PureDataObjectFactory } from \"./data-object-factories/index.js\";\nexport {\n\tDataObject,\n\ttype DataObjectKind,\n\ttype DataObjectTypes,\n\ttype IDataObjectProps,\n\tPureDataObject,\n\tcreateDataObjectKind,\n} from \"./data-objects/index.js\";\nexport {\n\tBaseContainerRuntimeFactory,\n\ttype BaseContainerRuntimeFactoryProps,\n\tContainerRuntimeFactoryWithDefaultDataStore,\n\ttype ContainerRuntimeFactoryWithDefaultDataStoreProps,\n} from \"./container-runtime-factories/index.js\";\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"dataObjectFactory.d.ts","sourceRoot":"","sources":["../../src/data-object-factories/dataObjectFactory.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,qBAAqB,EAAE,MAAM,oCAAoC,CAAC;AAC3E,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,gDAAgD,CAAC;AAQtF,OAAO,KAAK,EAAE,kCAAkC,EAAE,MAAM,8CAA8C,CAAC;AACvG,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,qCAAqC,CAAC;AAErF,OAAO,KAAK,EAAE,UAAU,EAAE,eAAe,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAC;AAE9F,OAAO,EAAE,qBAAqB,EAAE,MAAM,4BAA4B,CAAC;AAEnE;;;;;;;;;GASG;AACH,qBAAa,iBAAiB,CAC7B,IAAI,SAAS,UAAU,CAAC,CAAC,CAAC,EAC1B,CAAC,SAAS,eAAe,GAAG,eAAe,CAC1C,SAAQ,qBAAqB,CAAC,IAAI,EAAE,CAAC,CAAC;gBAEtC,IAAI,EAAE,MAAM,EACZ,IAAI,EAAE,KAAK,KAAK,EAAE,gBAAgB,CAAC,CAAC,CAAC,KAAK,IAAI,EAC9C,aAAa,iDAAiC,EAC9C,iBAAiB,EAAE,yBAAyB,CAAC,CAAC,CAAC,mBAAmB,CAAC,CAAC,EACpE,eAAe,CAAC,EAAE,kCAAkC,EACpD,cAAc,GAAE,OAAO,qBAA6C;CAkBrE"}
1
+ {"version":3,"file":"dataObjectFactory.d.ts","sourceRoot":"","sources":["../../src/data-object-factories/dataObjectFactory.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,qBAAqB,EAAE,MAAM,oCAAoC,CAAC;AAC3E,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,gDAAgD,CAAC;AAOtF,OAAO,KAAK,EAAE,kCAAkC,EAAE,MAAM,8CAA8C,CAAC;AACvG,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,qCAAqC,CAAC;AAErF,OAAO,KAAK,EAAE,UAAU,EAAE,eAAe,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAC;AAE9F,OAAO,EAAE,qBAAqB,EAAE,MAAM,4BAA4B,CAAC;AAEnE;;;;;;;;;GASG;AACH,qBAAa,iBAAiB,CAC7B,IAAI,SAAS,UAAU,CAAC,CAAC,CAAC,EAC1B,CAAC,SAAS,eAAe,GAAG,eAAe,CAC1C,SAAQ,qBAAqB,CAAC,IAAI,EAAE,CAAC,CAAC;gBAEtC,IAAI,EAAE,MAAM,EACZ,IAAI,EAAE,KAAK,KAAK,EAAE,gBAAgB,CAAC,CAAC,CAAC,KAAK,IAAI,EAC9C,aAAa,iDAAiC,EAC9C,iBAAiB,EAAE,yBAAyB,CAAC,CAAC,CAAC,mBAAmB,CAAC,CAAC,EACpE,eAAe,CAAC,EAAE,kCAAkC,EACpD,cAAc,GAAE,OAAO,qBAA6C;CAkBrE"}
@@ -3,9 +3,7 @@
3
3
  * Licensed under the MIT License.
4
4
  */
5
5
  import { FluidDataStoreRuntime } from "@fluidframework/datastore/internal";
6
- import { SharedMap, DirectoryFactory, MapFactory,
7
- // eslint-disable-next-line import/no-deprecated
8
- SharedDirectory, } from "@fluidframework/map/internal";
6
+ import { SharedMap, DirectoryFactory, MapFactory, SharedDirectory, } from "@fluidframework/map/internal";
9
7
  import { PureDataObjectFactory } from "./pureDataObjectFactory.js";
10
8
  /**
11
9
  * DataObjectFactory is the IFluidDataStoreFactory for use with DataObjects.
@@ -1 +1 @@
1
- {"version":3,"file":"dataObjectFactory.js","sourceRoot":"","sources":["../../src/data-object-factories/dataObjectFactory.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,qBAAqB,EAAE,MAAM,oCAAoC,CAAC;AAE3E,OAAO,EACN,SAAS,EACT,gBAAgB,EAChB,UAAU;AACV,gDAAgD;AAChD,eAAe,GACf,MAAM,8BAA8B,CAAC;AAMtC,OAAO,EAAE,qBAAqB,EAAE,MAAM,4BAA4B,CAAC;AAEnE;;;;;;;;;GASG;AACH,MAAM,OAAO,iBAGX,SAAQ,qBAA8B;IACvC,YACC,IAAY,EACZ,IAA8C,EAC9C,gBAA4C,EAAE,EAC9C,iBAAoE,EACpE,eAAoD,EACpD,iBAA+C,qBAAqB;QAEpE,MAAM,aAAa,GAAG,CAAC,GAAG,aAAa,CAAC,CAAC;QAEzC,IAAI,CAAC,aAAa,CAAC,IAAI,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,OAAO,CAAC,IAAI,KAAK,gBAAgB,CAAC,IAAI,CAAC,EAAE,CAAC;YAC9E,sCAAsC;YACtC,gDAAgD;YAChD,aAAa,CAAC,IAAI,CAAC,eAAe,CAAC,UAAU,EAAE,CAAC,CAAC;QAClD,CAAC;QAED,0GAA0G;QAC1G,IAAI,CAAC,aAAa,CAAC,IAAI,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,OAAO,CAAC,IAAI,KAAK,UAAU,CAAC,IAAI,CAAC,EAAE,CAAC;YACxE,gCAAgC;YAChC,aAAa,CAAC,IAAI,CAAC,SAAS,CAAC,UAAU,EAAE,CAAC,CAAC;QAC5C,CAAC;QAED,KAAK,CAAC,IAAI,EAAE,IAAI,EAAE,aAAa,EAAE,iBAAiB,EAAE,eAAe,EAAE,cAAc,CAAC,CAAC;IACtF,CAAC;CACD","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { FluidDataStoreRuntime } from \"@fluidframework/datastore/internal\";\nimport type { IChannelFactory } from \"@fluidframework/datastore-definitions/internal\";\nimport {\n\tSharedMap,\n\tDirectoryFactory,\n\tMapFactory,\n\t// eslint-disable-next-line import/no-deprecated\n\tSharedDirectory,\n} from \"@fluidframework/map/internal\";\nimport type { NamedFluidDataStoreRegistryEntries } from \"@fluidframework/runtime-definitions/internal\";\nimport type { FluidObjectSymbolProvider } from \"@fluidframework/synthesize/internal\";\n\nimport type { DataObject, DataObjectTypes, IDataObjectProps } from \"../data-objects/index.js\";\n\nimport { PureDataObjectFactory } from \"./pureDataObjectFactory.js\";\n\n/**\n * DataObjectFactory is the IFluidDataStoreFactory for use with DataObjects.\n * It facilitates DataObject's features (such as its shared directory) by\n * ensuring relevant shared objects etc are available to the factory.\n *\n * @typeParam TObj - DataObject (concrete type)\n * @typeParam I - The input types for the DataObject\n * @legacy\n * @alpha\n */\nexport class DataObjectFactory<\n\tTObj extends DataObject<I>,\n\tI extends DataObjectTypes = DataObjectTypes,\n> extends PureDataObjectFactory<TObj, I> {\n\tpublic constructor(\n\t\ttype: string,\n\t\tctor: new (props: IDataObjectProps<I>) => TObj,\n\t\tsharedObjects: readonly IChannelFactory[] = [],\n\t\toptionalProviders: FluidObjectSymbolProvider<I[\"OptionalProviders\"]>,\n\t\tregistryEntries?: NamedFluidDataStoreRegistryEntries,\n\t\truntimeFactory: typeof FluidDataStoreRuntime = FluidDataStoreRuntime,\n\t) {\n\t\tconst mergedObjects = [...sharedObjects];\n\n\t\tif (!sharedObjects.some((factory) => factory.type === DirectoryFactory.Type)) {\n\t\t\t// User did not register for directory\n\t\t\t// eslint-disable-next-line import/no-deprecated\n\t\t\tmergedObjects.push(SharedDirectory.getFactory());\n\t\t}\n\n\t\t// TODO: Remove SharedMap factory when compatibility with SharedMap DataObject is no longer needed in 0.10\n\t\tif (!sharedObjects.some((factory) => factory.type === MapFactory.Type)) {\n\t\t\t// User did not register for map\n\t\t\tmergedObjects.push(SharedMap.getFactory());\n\t\t}\n\n\t\tsuper(type, ctor, mergedObjects, optionalProviders, registryEntries, runtimeFactory);\n\t}\n}\n"]}
1
+ {"version":3,"file":"dataObjectFactory.js","sourceRoot":"","sources":["../../src/data-object-factories/dataObjectFactory.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,qBAAqB,EAAE,MAAM,oCAAoC,CAAC;AAE3E,OAAO,EACN,SAAS,EACT,gBAAgB,EAChB,UAAU,EACV,eAAe,GACf,MAAM,8BAA8B,CAAC;AAMtC,OAAO,EAAE,qBAAqB,EAAE,MAAM,4BAA4B,CAAC;AAEnE;;;;;;;;;GASG;AACH,MAAM,OAAO,iBAGX,SAAQ,qBAA8B;IACvC,YACC,IAAY,EACZ,IAA8C,EAC9C,gBAA4C,EAAE,EAC9C,iBAAoE,EACpE,eAAoD,EACpD,iBAA+C,qBAAqB;QAEpE,MAAM,aAAa,GAAG,CAAC,GAAG,aAAa,CAAC,CAAC;QAEzC,IAAI,CAAC,aAAa,CAAC,IAAI,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,OAAO,CAAC,IAAI,KAAK,gBAAgB,CAAC,IAAI,CAAC,EAAE,CAAC;YAC9E,sCAAsC;YACtC,gDAAgD;YAChD,aAAa,CAAC,IAAI,CAAC,eAAe,CAAC,UAAU,EAAE,CAAC,CAAC;QAClD,CAAC;QAED,0GAA0G;QAC1G,IAAI,CAAC,aAAa,CAAC,IAAI,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,OAAO,CAAC,IAAI,KAAK,UAAU,CAAC,IAAI,CAAC,EAAE,CAAC;YACxE,gCAAgC;YAChC,aAAa,CAAC,IAAI,CAAC,SAAS,CAAC,UAAU,EAAE,CAAC,CAAC;QAC5C,CAAC;QAED,KAAK,CAAC,IAAI,EAAE,IAAI,EAAE,aAAa,EAAE,iBAAiB,EAAE,eAAe,EAAE,cAAc,CAAC,CAAC;IACtF,CAAC;CACD","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { FluidDataStoreRuntime } from \"@fluidframework/datastore/internal\";\nimport type { IChannelFactory } from \"@fluidframework/datastore-definitions/internal\";\nimport {\n\tSharedMap,\n\tDirectoryFactory,\n\tMapFactory,\n\tSharedDirectory,\n} from \"@fluidframework/map/internal\";\nimport type { NamedFluidDataStoreRegistryEntries } from \"@fluidframework/runtime-definitions/internal\";\nimport type { FluidObjectSymbolProvider } from \"@fluidframework/synthesize/internal\";\n\nimport type { DataObject, DataObjectTypes, IDataObjectProps } from \"../data-objects/index.js\";\n\nimport { PureDataObjectFactory } from \"./pureDataObjectFactory.js\";\n\n/**\n * DataObjectFactory is the IFluidDataStoreFactory for use with DataObjects.\n * It facilitates DataObject's features (such as its shared directory) by\n * ensuring relevant shared objects etc are available to the factory.\n *\n * @typeParam TObj - DataObject (concrete type)\n * @typeParam I - The input types for the DataObject\n * @legacy\n * @alpha\n */\nexport class DataObjectFactory<\n\tTObj extends DataObject<I>,\n\tI extends DataObjectTypes = DataObjectTypes,\n> extends PureDataObjectFactory<TObj, I> {\n\tpublic constructor(\n\t\ttype: string,\n\t\tctor: new (props: IDataObjectProps<I>) => TObj,\n\t\tsharedObjects: readonly IChannelFactory[] = [],\n\t\toptionalProviders: FluidObjectSymbolProvider<I[\"OptionalProviders\"]>,\n\t\tregistryEntries?: NamedFluidDataStoreRegistryEntries,\n\t\truntimeFactory: typeof FluidDataStoreRuntime = FluidDataStoreRuntime,\n\t) {\n\t\tconst mergedObjects = [...sharedObjects];\n\n\t\tif (!sharedObjects.some((factory) => factory.type === DirectoryFactory.Type)) {\n\t\t\t// User did not register for directory\n\t\t\t// eslint-disable-next-line import/no-deprecated\n\t\t\tmergedObjects.push(SharedDirectory.getFactory());\n\t\t}\n\n\t\t// TODO: Remove SharedMap factory when compatibility with SharedMap DataObject is no longer needed in 0.10\n\t\tif (!sharedObjects.some((factory) => factory.type === MapFactory.Type)) {\n\t\t\t// User did not register for map\n\t\t\tmergedObjects.push(SharedMap.getFactory());\n\t\t}\n\n\t\tsuper(type, ctor, mergedObjects, optionalProviders, registryEntries, runtimeFactory);\n\t}\n}\n"]}
@@ -9,7 +9,7 @@ import type { IContainerRuntimeBase, IDataStore, IFluidDataStoreChannel, IFluidD
9
9
  import type { FluidObjectSymbolProvider } from "@fluidframework/synthesize/internal";
10
10
  import type { DataObjectTypes, IDataObjectProps, PureDataObject } from "../data-objects/index.js";
11
11
  /**
12
- * PureDataObjectFactory is a barebones IFluidDataStoreFactory for use with PureDataObject.
12
+ * PureDataObjectFactory is a bare-bones IFluidDataStoreFactory for use with PureDataObject.
13
13
  * Consumers should typically use DataObjectFactory instead unless creating
14
14
  * another base data store factory.
15
15
  *
@@ -57,7 +57,7 @@ async function createDataObject(ctor, context, sharedObjectRegistry, optionalPro
57
57
  return { instance, runtime };
58
58
  }
59
59
  /**
60
- * PureDataObjectFactory is a barebones IFluidDataStoreFactory for use with PureDataObject.
60
+ * PureDataObjectFactory is a bare-bones IFluidDataStoreFactory for use with PureDataObject.
61
61
  * Consumers should typically use DataObjectFactory instead unless creating
62
62
  * another base data store factory.
63
63
  *
@@ -1 +1 @@
1
- {"version":3,"file":"pureDataObjectFactory.js","sourceRoot":"","sources":["../../src/data-object-factories/pureDataObjectFactory.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,sBAAsB,EAAE,MAAM,4CAA4C,CAAC;AAGpF,OAAO,EAAE,MAAM,EAAE,MAAM,qCAAqC,CAAC;AAC7D,OAAO,EACN,qBAAqB,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AAC,CAAC;YAC5E,MAAM,CAAC,MAAM,KAAK,SAAS,EAAE,KAAK,CAAC,0CAA0C,CAAC,CAAC;YAC/E,OAAO,CAAC,MAAM,MAAM,CAAC,GAAG,EAAE,CAAS,CAAC;QACrC,CAAC;QACD,OAAO,QAAQ,CAAC;IACjB,CAAC;IAES,KAAK,CAAC,yBAAyB,CACxC,gBAAuC,EACvC,WAA+B,EAC/B,YAAgC,EAChC,cAAuB;QAEvB,MAAM,OAAO,GAAG,gBAAgB,CAAC,uBAAuB,CAAC,WAAW,EAAE,cAAc,CAAC,CAAC;QACtF,OAAO,IAAI,CAAC,kBAAkB,CAAC,OAAO,EAAE,YAAY,CAAC,CAAC;IACvD,CAAC;IAES,KAAK,CAAC,kBAAkB,CACjC,OAAuC,EACvC,YAAgC;QAEhC,MAAM,EAAE,QAAQ,EAAE,OAAO,EAAE,GAAG,MAAM,gBAAgB,CACnD,IAAI,CAAC,IAAI,EACT,OAAO,EACP,IAAI,CAAC,oBAAoB,EACzB,IAAI,CAAC,iBAAiB,EACtB,IAAI,CAAC,YAAY,EACjB,KAAK,EAAE,WAAW;QAClB,YAAY,CACZ,CAAC;QAEF,MAAM,OAAO,CAAC,aAAa,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;QAE3C,OAAO,QAAQ,CAAC;IACjB,CAAC;CACD","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { FluidDataStoreRegistry } from \"@fluidframework/container-runtime/internal\";\nimport type { IContainerRuntime } from \"@fluidframework/container-runtime-definitions/internal\";\nimport type { FluidObject, IRequest } from \"@fluidframework/core-interfaces\";\nimport { assert } from \"@fluidframework/core-utils/internal\";\nimport {\n\tFluidDataStoreRuntime,\n\ttype ISharedObjectRegistry,\n\tmixinRequestHandler,\n} from \"@fluidframework/datastore/internal\";\nimport type {\n\tIChannelFactory,\n\tIFluidDataStoreRuntime,\n} from \"@fluidframework/datastore-definitions/internal\";\nimport type {\n\tIContainerRuntimeBase,\n\tIDataStore,\n\tIFluidDataStoreChannel,\n\tIFluidDataStoreContext,\n\tIFluidDataStoreContextDetached,\n\tIFluidDataStoreFactory,\n\tIFluidDataStoreRegistry,\n\tIProvideFluidDataStoreRegistry,\n\tNamedFluidDataStoreRegistryEntries,\n\tNamedFluidDataStoreRegistryEntry,\n} from \"@fluidframework/runtime-definitions/internal\";\nimport type {\n\tAsyncFluidObjectProvider,\n\tFluidObjectSymbolProvider,\n\tIFluidDependencySynthesizer,\n} from \"@fluidframework/synthesize/internal\";\n\nimport type {\n\tDataObjectTypes,\n\tIDataObjectProps,\n\tPureDataObject,\n} from \"../data-objects/index.js\";\n\n/**\n * Proxy over PureDataObject\n * Does delayed creation & initialization of PureDataObject\n */\nasync function createDataObject<\n\tTObj extends PureDataObject,\n\tI extends DataObjectTypes = DataObjectTypes,\n>(\n\tctor: new (props: IDataObjectProps<I>) => TObj,\n\tcontext: IFluidDataStoreContext,\n\tsharedObjectRegistry: ISharedObjectRegistry,\n\toptionalProviders: FluidObjectSymbolProvider<I[\"OptionalProviders\"]>,\n\truntimeClassArg: typeof FluidDataStoreRuntime,\n\texisting: boolean,\n\tinitProps?: I[\"InitialState\"],\n): Promise<{\n\tinstance: TObj;\n\truntime: FluidDataStoreRuntime;\n}> {\n\t// base\n\tlet runtimeClass = runtimeClassArg;\n\n\t// request mixin in\n\truntimeClass = mixinRequestHandler(\n\t\tasync (request: IRequest, runtimeArg: FluidDataStoreRuntime) => {\n\t\t\t// The provideEntryPoint callback below always returns TObj, so this cast is safe\n\t\t\tconst dataObject = (await runtimeArg.entryPoint.get()) as TObj;\n\t\t\tassert(\n\t\t\t\tdataObject.request !== undefined,\n\t\t\t\t0x795 /* Data store runtime entryPoint does not have request */,\n\t\t\t);\n\t\t\treturn dataObject.request(request);\n\t\t},\n\t\truntimeClass,\n\t);\n\n\t// Create a new runtime for our data store, as if via new FluidDataStoreRuntime,\n\t// but using the runtimeClass that's been augmented with mixins\n\t// The runtime is what Fluid uses to create DDS' and route to your data store\n\tconst runtime: FluidDataStoreRuntime = new runtimeClass(\n\t\t// calls new FluidDataStoreRuntime(...)\n\t\tcontext,\n\t\tsharedObjectRegistry,\n\t\texisting,\n\t\tasync (rt: IFluidDataStoreRuntime) => {\n\t\t\tassert(instance !== undefined, 0x46a /* entryPoint is undefined */);\n\t\t\t// Calling finishInitialization here like PureDataObject.getDataObject did, to keep the same behavior,\n\t\t\t// since accessing the runtime's entryPoint is how we want the data object to be retrieved going forward.\n\t\t\t// Without this I ran into issues with the load-existing flow not working correctly.\n\t\t\tawait instance.finishInitialization(true);\n\t\t\treturn instance;\n\t\t} /* provideEntryPoint */,\n\t);\n\n\t// Create object right away.\n\t// This allows object to register various callbacks with runtime before runtime\n\t// becomes globally available. But it's not full initialization - constructor can't\n\t// access DDSes or other services of runtime as objects are not fully initialized.\n\t// In order to use object, we need to go through full initialization by calling finishInitialization().\n\tconst scope: FluidObject<IFluidDependencySynthesizer> = context.scope;\n\tconst providers =\n\t\tscope.IFluidDependencySynthesizer?.synthesize<I[\"OptionalProviders\"]>(\n\t\t\toptionalProviders,\n\t\t\t{},\n\t\t) ??\n\t\t// eslint-disable-next-line @typescript-eslint/consistent-type-assertions\n\t\t({} as AsyncFluidObjectProvider<never>);\n\n\tconst instance = new ctor({ runtime, context, providers, initProps });\n\n\t// if it's a newly created object, we need to wait for it to finish initialization\n\t// as that results in creation of DDSes, before it gets attached, providing atomic\n\t// guarantee of creation.\n\t// WARNING: we can't do the same (yet) for already existing PureDataObject!\n\t// This will result in deadlock, as it tries to resolve internal handles, but any\n\t// handle resolution goes through root (container runtime), which can't route it back\n\t// to this data store, as it's still not initialized and not known to container runtime yet.\n\t// In the future, we should address it by using relative paths for handles and be able to resolve\n\t// local DDSes while data store is not fully initialized.\n\tif (!existing) {\n\t\tawait instance.finishInitialization(existing);\n\t}\n\n\treturn { instance, runtime };\n}\n\n/**\n * PureDataObjectFactory is a barebones IFluidDataStoreFactory for use with PureDataObject.\n * Consumers should typically use DataObjectFactory instead unless creating\n * another base data store factory.\n *\n * @typeParam TObj - DataObject (concrete type)\n * @typeParam I - The input types for the DataObject\n * @legacy\n * @alpha\n */\nexport class PureDataObjectFactory<\n\tTObj extends PureDataObject<I>,\n\tI extends DataObjectTypes = DataObjectTypes,\n> implements IFluidDataStoreFactory, Partial<IProvideFluidDataStoreRegistry>\n{\n\tprivate readonly sharedObjectRegistry: ISharedObjectRegistry;\n\tprivate readonly registry: IFluidDataStoreRegistry | undefined;\n\n\tpublic constructor(\n\t\t/**\n\t\t * {@inheritDoc @fluidframework/runtime-definitions#IFluidDataStoreFactory.\"type\"}\n\t\t */\n\t\tpublic readonly type: string,\n\t\tprivate readonly ctor: new (props: IDataObjectProps<I>) => TObj,\n\t\tsharedObjects: readonly IChannelFactory[],\n\t\tprivate readonly optionalProviders: FluidObjectSymbolProvider<I[\"OptionalProviders\"]>,\n\t\tregistryEntries?: NamedFluidDataStoreRegistryEntries,\n\t\tprivate readonly runtimeClass: typeof FluidDataStoreRuntime = FluidDataStoreRuntime,\n\t) {\n\t\tif (this.type === \"\") {\n\t\t\tthrow new Error(\"undefined type member\");\n\t\t}\n\t\tif (registryEntries !== undefined) {\n\t\t\tthis.registry = new FluidDataStoreRegistry(registryEntries);\n\t\t}\n\t\tthis.sharedObjectRegistry = new Map(sharedObjects.map((ext) => [ext.type, ext]));\n\t}\n\n\t/**\n\t * {@inheritDoc @fluidframework/runtime-definitions#IProvideFluidDataStoreFactory.IFluidDataStoreFactory}\n\t */\n\tpublic get IFluidDataStoreFactory(): this {\n\t\treturn this;\n\t}\n\n\t/**\n\t * {@inheritDoc @fluidframework/runtime-definitions#IProvideFluidDataStoreRegistry.IFluidDataStoreRegistry}\n\t */\n\tpublic get IFluidDataStoreRegistry(): IFluidDataStoreRegistry | undefined {\n\t\treturn this.registry;\n\t}\n\n\t/**\n\t * Convenience helper to get the data store's/factory's data store registry entry.\n\t * The return type hides the factory's generics, easing grouping of registry\n\t * entries that differ only in this way into the same array.\n\t * @returns The NamedFluidDataStoreRegistryEntry\n\t */\n\tpublic get registryEntry(): NamedFluidDataStoreRegistryEntry {\n\t\treturn [this.type, Promise.resolve(this)];\n\t}\n\n\t/**\n\t * {@inheritDoc @fluidframework/runtime-definitions#IFluidDataStoreFactory.instantiateDataStore}\n\t */\n\tpublic async instantiateDataStore(\n\t\tcontext: IFluidDataStoreContext,\n\t\texisting: boolean,\n\t): Promise<IFluidDataStoreChannel> {\n\t\tconst { runtime } = await createDataObject(\n\t\t\tthis.ctor,\n\t\t\tcontext,\n\t\t\tthis.sharedObjectRegistry,\n\t\t\tthis.optionalProviders,\n\t\t\tthis.runtimeClass,\n\t\t\texisting,\n\t\t);\n\n\t\treturn runtime;\n\t}\n\n\t/**\n\t * Creates a new instance of the object. Uses parent context's registry to build package path to this factory.\n\t * In other words, registry of context passed in has to contain this factory, with the name that matches\n\t * this factory's type.\n\t * It is intended to be used by data store objects that create sub-objects.\n\t * @param context - The context being used to create the runtime\n\t * (the created object will have its own new context created as well)\n\t * @param initialState - The initial state to provide to the created data store.\n\t * @param loadingGroupId - NOT production ready, EXPERIMENTAL, please read {@link https://github.com/microsoft/FluidFramework/blob/main/packages/runtime/container-runtime/README.md | README}. The service needs to support this feature, does not work for most services\n\t * @returns an object created by this factory. Data store and objects created are not attached to container.\n\t * They get attached only when a handle to one of them is attached to already attached objects.\n\t */\n\tpublic async createChildInstance(\n\t\tparentContext: IFluidDataStoreContext,\n\t\tinitialState?: I[\"InitialState\"],\n\t\tloadingGroupId?: string,\n\t): Promise<TObj> {\n\t\treturn this.createNonRootInstanceCore(\n\t\t\tparentContext.containerRuntime,\n\t\t\t[...parentContext.packagePath, this.type],\n\t\t\tinitialState,\n\t\t\tloadingGroupId,\n\t\t);\n\t}\n\n\t/**\n\t * Creates a new instance of the object. Uses peer context's registry and its package path to identify this factory.\n\t * In other words, registry of context passed in has to have this factory.\n\t * Intended to be used by data store objects that need to create peers (similar) instances of existing objects.\n\t * @param context - The component context being used to create the object\n\t * (the created object will have its own new context created as well)\n\t * @param initialState - The initial state to provide to the created component.\n\t * @param loadingGroupId - NOT production ready, EXPERIMENTAL, please read {@link https://github.com/microsoft/FluidFramework/blob/main/packages/runtime/container-runtime/README.md | README}. The service needs to support this feature, does not work for most services\n\t * @returns an object created by this factory. Data store and objects created are not attached to container.\n\t * They get attached only when a handle to one of them is attached to already attached objects.\n\t */\n\tpublic async createPeerInstance(\n\t\tpeerContext: IFluidDataStoreContext,\n\t\tinitialState?: I[\"InitialState\"],\n\t\tloadingGroupId?: string, // DO NOT USE, this is an experimental feature\n\t): Promise<TObj> {\n\t\treturn this.createNonRootInstanceCore(\n\t\t\tpeerContext.containerRuntime,\n\t\t\tpeerContext.packagePath,\n\t\t\tinitialState,\n\t\t\tloadingGroupId,\n\t\t);\n\t}\n\n\t/**\n\t * Creates a new instance of the object. Uses container's registry to find this factory.\n\t * It's expected that only container owners would use this functionality, as only such developers\n\t * have knowledge of entries in container registry.\n\t * The name in this registry for such record should match type of this factory.\n\t * @param runtime - container runtime. It's registry is used to create an object.\n\t * @param initialState - The initial state to provide to the created component.\n\t * @param loadingGroupId - NOT production ready, EXPERIMENTAL, please read {@link https://github.com/microsoft/FluidFramework/blob/main/packages/runtime/container-runtime/README.md | README}. The service needs to support this feature, does not work for most services\n\t * @returns an object created by this factory. Data store and objects created are not attached to container.\n\t * They get attached only when a handle to one of them is attached to already attached objects.\n\t */\n\tpublic async createInstance(\n\t\truntime: IContainerRuntimeBase,\n\t\tinitialState?: I[\"InitialState\"],\n\t\tloadingGroupId?: string,\n\t): Promise<TObj> {\n\t\treturn this.createNonRootInstanceCore(runtime, [this.type], initialState, loadingGroupId);\n\t}\n\n\t/**\n\t * Creates a new instance of the object with a datastore which exposes the aliasing api.\n\t * @param runtime - container runtime. It is the runtime that will be used to create the object. It will produce\n\t * the underlying infrastructure to get the data object to operate.\n\t * @param initialState - The initial state to provide to the created component.\n\t * @param packagePath - The path to the data store factory to use to create the data object.\n\t * @param loadingGroupId - NOT production ready, EXPERIMENTAL, please read {@link https://github.com/microsoft/FluidFramework/blob/main/packages/runtime/container-runtime/README.md | README}. The service needs to support this feature, does not work for most services\n\t * @returns an array containing the object created by this factory and an IDataStore object that enables users to\n\t * alias the data object.\n\t * The data object is attached only when it is attached to the handle graph that connects to an aliased object or\n\t * when the data object is aliased.\n\t */\n\tpublic async createInstanceWithDataStore(\n\t\tcontainerRuntime: IContainerRuntimeBase,\n\t\tinitialState?: I[\"InitialState\"],\n\t\tpackagePath?: Readonly<string[]>,\n\t\tloadingGroupId?: string,\n\t): Promise<[TObj, IDataStore]> {\n\t\tconst context = containerRuntime.createDetachedDataStore(\n\t\t\tpackagePath ?? [this.type],\n\t\t\tloadingGroupId,\n\t\t);\n\t\tconst { instance, runtime } = await createDataObject(\n\t\t\tthis.ctor,\n\t\t\tcontext,\n\t\t\tthis.sharedObjectRegistry,\n\t\t\tthis.optionalProviders,\n\t\t\tthis.runtimeClass,\n\t\t\tfalse, // existing\n\t\t\tinitialState,\n\t\t);\n\t\tconst dataStore = await context.attachRuntime(this, runtime);\n\n\t\treturn [instance, dataStore];\n\t}\n\n\t/**\n\t * Creates a new root instance of the object. Uses container's registry to find this factory.\n\t * It's expected that only container owners would use this functionality, as only such developers\n\t * have knowledge of entries in container registry.\n\t * The name in this registry for such record should match type of this factory.\n\t * @param runtime - container runtime. It's registry is used to create an object.\n\t * @param initialState - The initial state to provide to the created component.\n\t * @returns an object created by this factory. Data store and objects created are not attached to container.\n\t * They get attached only when a handle to one of them is attached to already attached objects.\n\t *\n\t * @deprecated - the issue is that it does not allow the customer to decide the conflict resolution policy when an\n\t * aliasing conflict occurs. Use {@link PureDataObjectFactory.createInstanceWithDataStore} instead.\n\t */\n\tpublic async createRootInstance(\n\t\trootDataStoreId: string,\n\t\truntime: IContainerRuntime,\n\t\tinitialState?: I[\"InitialState\"],\n\t): Promise<TObj> {\n\t\tconst context = runtime.createDetachedDataStore([this.type]);\n\t\tconst { instance, runtime: dataStoreRuntime } = await createDataObject(\n\t\t\tthis.ctor,\n\t\t\tcontext,\n\t\t\tthis.sharedObjectRegistry,\n\t\t\tthis.optionalProviders,\n\t\t\tthis.runtimeClass,\n\t\t\tfalse, // existing\n\t\t\tinitialState,\n\t\t);\n\t\tconst dataStore = await context.attachRuntime(this, dataStoreRuntime);\n\t\tconst result = await dataStore.trySetAlias(rootDataStoreId);\n\t\tif (result !== \"Success\") {\n\t\t\tconst handle = await runtime.getAliasedDataStoreEntryPoint(rootDataStoreId);\n\t\t\tassert(handle !== undefined, 0x8e1 /* Should have retrieved aliased handle */);\n\t\t\treturn (await handle.get()) as TObj;\n\t\t}\n\t\treturn instance;\n\t}\n\n\tprotected async createNonRootInstanceCore(\n\t\tcontainerRuntime: IContainerRuntimeBase,\n\t\tpackagePath: Readonly<string[]>,\n\t\tinitialState?: I[\"InitialState\"],\n\t\tloadingGroupId?: string,\n\t): Promise<TObj> {\n\t\tconst context = containerRuntime.createDetachedDataStore(packagePath, loadingGroupId);\n\t\treturn this.createInstanceCore(context, initialState);\n\t}\n\n\tprotected async createInstanceCore(\n\t\tcontext: IFluidDataStoreContextDetached,\n\t\tinitialState?: I[\"InitialState\"],\n\t): Promise<TObj> {\n\t\tconst { instance, runtime } = await createDataObject(\n\t\t\tthis.ctor,\n\t\t\tcontext,\n\t\t\tthis.sharedObjectRegistry,\n\t\t\tthis.optionalProviders,\n\t\t\tthis.runtimeClass,\n\t\t\tfalse, // existing\n\t\t\tinitialState,\n\t\t);\n\n\t\tawait context.attachRuntime(this, runtime);\n\n\t\treturn instance;\n\t}\n}\n"]}
1
+ {"version":3,"file":"pureDataObjectFactory.js","sourceRoot":"","sources":["../../src/data-object-factories/pureDataObjectFactory.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,sBAAsB,EAAE,MAAM,4CAA4C,CAAC;AAGpF,OAAO,EAAE,MAAM,EAAE,MAAM,qCAAqC,CAAC;AAC7D,OAA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B,CAAC,eAAe,CAAC,CAAC;YAC5E,MAAM,CAAC,MAAM,KAAK,SAAS,EAAE,KAAK,CAAC,0CAA0C,CAAC,CAAC;YAC/E,OAAO,CAAC,MAAM,MAAM,CAAC,GAAG,EAAE,CAAS,CAAC;QACrC,CAAC;QACD,OAAO,QAAQ,CAAC;IACjB,CAAC;IAES,KAAK,CAAC,yBAAyB,CACxC,gBAAuC,EACvC,WAA+B,EAC/B,YAAgC,EAChC,cAAuB;QAEvB,MAAM,OAAO,GAAG,gBAAgB,CAAC,uBAAuB,CAAC,WAAW,EAAE,cAAc,CAAC,CAAC;QACtF,OAAO,IAAI,CAAC,kBAAkB,CAAC,OAAO,EAAE,YAAY,CAAC,CAAC;IACvD,CAAC;IAES,KAAK,CAAC,kBAAkB,CACjC,OAAuC,EACvC,YAAgC;QAEhC,MAAM,EAAE,QAAQ,EAAE,OAAO,EAAE,GAAG,MAAM,gBAAgB,CACnD,IAAI,CAAC,IAAI,EACT,OAAO,EACP,IAAI,CAAC,oBAAoB,EACzB,IAAI,CAAC,iBAAiB,EACtB,IAAI,CAAC,YAAY,EACjB,KAAK,EAAE,WAAW;QAClB,YAAY,CACZ,CAAC;QAEF,MAAM,OAAO,CAAC,aAAa,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;QAE3C,OAAO,QAAQ,CAAC;IACjB,CAAC;CACD","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { FluidDataStoreRegistry } from \"@fluidframework/container-runtime/internal\";\nimport type { IContainerRuntime } from \"@fluidframework/container-runtime-definitions/internal\";\nimport type { FluidObject, IRequest } from \"@fluidframework/core-interfaces\";\nimport { assert } from \"@fluidframework/core-utils/internal\";\nimport {\n\tFluidDataStoreRuntime,\n\ttype ISharedObjectRegistry,\n\tmixinRequestHandler,\n} from \"@fluidframework/datastore/internal\";\nimport type {\n\tIChannelFactory,\n\tIFluidDataStoreRuntime,\n} from \"@fluidframework/datastore-definitions/internal\";\nimport type {\n\tIContainerRuntimeBase,\n\tIDataStore,\n\tIFluidDataStoreChannel,\n\tIFluidDataStoreContext,\n\tIFluidDataStoreContextDetached,\n\tIFluidDataStoreFactory,\n\tIFluidDataStoreRegistry,\n\tIProvideFluidDataStoreRegistry,\n\tNamedFluidDataStoreRegistryEntries,\n\tNamedFluidDataStoreRegistryEntry,\n} from \"@fluidframework/runtime-definitions/internal\";\nimport type {\n\tAsyncFluidObjectProvider,\n\tFluidObjectSymbolProvider,\n\tIFluidDependencySynthesizer,\n} from \"@fluidframework/synthesize/internal\";\n\nimport type {\n\tDataObjectTypes,\n\tIDataObjectProps,\n\tPureDataObject,\n} from \"../data-objects/index.js\";\n\n/**\n * Proxy over PureDataObject\n * Does delayed creation & initialization of PureDataObject\n */\nasync function createDataObject<\n\tTObj extends PureDataObject,\n\tI extends DataObjectTypes = DataObjectTypes,\n>(\n\tctor: new (props: IDataObjectProps<I>) => TObj,\n\tcontext: IFluidDataStoreContext,\n\tsharedObjectRegistry: ISharedObjectRegistry,\n\toptionalProviders: FluidObjectSymbolProvider<I[\"OptionalProviders\"]>,\n\truntimeClassArg: typeof FluidDataStoreRuntime,\n\texisting: boolean,\n\tinitProps?: I[\"InitialState\"],\n): Promise<{\n\tinstance: TObj;\n\truntime: FluidDataStoreRuntime;\n}> {\n\t// base\n\tlet runtimeClass = runtimeClassArg;\n\n\t// request mixin in\n\truntimeClass = mixinRequestHandler(\n\t\tasync (request: IRequest, runtimeArg: FluidDataStoreRuntime) => {\n\t\t\t// The provideEntryPoint callback below always returns TObj, so this cast is safe\n\t\t\tconst dataObject = (await runtimeArg.entryPoint.get()) as TObj;\n\t\t\tassert(\n\t\t\t\tdataObject.request !== undefined,\n\t\t\t\t0x795 /* Data store runtime entryPoint does not have request */,\n\t\t\t);\n\t\t\treturn dataObject.request(request);\n\t\t},\n\t\truntimeClass,\n\t);\n\n\t// Create a new runtime for our data store, as if via new FluidDataStoreRuntime,\n\t// but using the runtimeClass that's been augmented with mixins\n\t// The runtime is what Fluid uses to create DDS' and route to your data store\n\tconst runtime: FluidDataStoreRuntime = new runtimeClass(\n\t\t// calls new FluidDataStoreRuntime(...)\n\t\tcontext,\n\t\tsharedObjectRegistry,\n\t\texisting,\n\t\tasync (rt: IFluidDataStoreRuntime) => {\n\t\t\tassert(instance !== undefined, 0x46a /* entryPoint is undefined */);\n\t\t\t// Calling finishInitialization here like PureDataObject.getDataObject did, to keep the same behavior,\n\t\t\t// since accessing the runtime's entryPoint is how we want the data object to be retrieved going forward.\n\t\t\t// Without this I ran into issues with the load-existing flow not working correctly.\n\t\t\tawait instance.finishInitialization(true);\n\t\t\treturn instance;\n\t\t} /* provideEntryPoint */,\n\t);\n\n\t// Create object right away.\n\t// This allows object to register various callbacks with runtime before runtime\n\t// becomes globally available. But it's not full initialization - constructor can't\n\t// access DDSes or other services of runtime as objects are not fully initialized.\n\t// In order to use object, we need to go through full initialization by calling finishInitialization().\n\tconst scope: FluidObject<IFluidDependencySynthesizer> = context.scope;\n\tconst providers =\n\t\tscope.IFluidDependencySynthesizer?.synthesize<I[\"OptionalProviders\"]>(\n\t\t\toptionalProviders,\n\t\t\t{},\n\t\t) ??\n\t\t// eslint-disable-next-line @typescript-eslint/consistent-type-assertions\n\t\t({} as AsyncFluidObjectProvider<never>);\n\n\tconst instance = new ctor({ runtime, context, providers, initProps });\n\n\t// if it's a newly created object, we need to wait for it to finish initialization\n\t// as that results in creation of DDSes, before it gets attached, providing atomic\n\t// guarantee of creation.\n\t// WARNING: we can't do the same (yet) for already existing PureDataObject!\n\t// This will result in deadlock, as it tries to resolve internal handles, but any\n\t// handle resolution goes through root (container runtime), which can't route it back\n\t// to this data store, as it's still not initialized and not known to container runtime yet.\n\t// In the future, we should address it by using relative paths for handles and be able to resolve\n\t// local DDSes while data store is not fully initialized.\n\tif (!existing) {\n\t\tawait instance.finishInitialization(existing);\n\t}\n\n\treturn { instance, runtime };\n}\n\n/**\n * PureDataObjectFactory is a bare-bones IFluidDataStoreFactory for use with PureDataObject.\n * Consumers should typically use DataObjectFactory instead unless creating\n * another base data store factory.\n *\n * @typeParam TObj - DataObject (concrete type)\n * @typeParam I - The input types for the DataObject\n * @legacy\n * @alpha\n */\nexport class PureDataObjectFactory<\n\tTObj extends PureDataObject<I>,\n\tI extends DataObjectTypes = DataObjectTypes,\n> implements IFluidDataStoreFactory, Partial<IProvideFluidDataStoreRegistry>\n{\n\tprivate readonly sharedObjectRegistry: ISharedObjectRegistry;\n\tprivate readonly registry: IFluidDataStoreRegistry | undefined;\n\n\tpublic constructor(\n\t\t/**\n\t\t * {@inheritDoc @fluidframework/runtime-definitions#IFluidDataStoreFactory.\"type\"}\n\t\t */\n\t\tpublic readonly type: string,\n\t\tprivate readonly ctor: new (props: IDataObjectProps<I>) => TObj,\n\t\tsharedObjects: readonly IChannelFactory[],\n\t\tprivate readonly optionalProviders: FluidObjectSymbolProvider<I[\"OptionalProviders\"]>,\n\t\tregistryEntries?: NamedFluidDataStoreRegistryEntries,\n\t\tprivate readonly runtimeClass: typeof FluidDataStoreRuntime = FluidDataStoreRuntime,\n\t) {\n\t\tif (this.type === \"\") {\n\t\t\tthrow new Error(\"undefined type member\");\n\t\t}\n\t\tif (registryEntries !== undefined) {\n\t\t\tthis.registry = new FluidDataStoreRegistry(registryEntries);\n\t\t}\n\t\tthis.sharedObjectRegistry = new Map(sharedObjects.map((ext) => [ext.type, ext]));\n\t}\n\n\t/**\n\t * {@inheritDoc @fluidframework/runtime-definitions#IProvideFluidDataStoreFactory.IFluidDataStoreFactory}\n\t */\n\tpublic get IFluidDataStoreFactory(): this {\n\t\treturn this;\n\t}\n\n\t/**\n\t * {@inheritDoc @fluidframework/runtime-definitions#IProvideFluidDataStoreRegistry.IFluidDataStoreRegistry}\n\t */\n\tpublic get IFluidDataStoreRegistry(): IFluidDataStoreRegistry | undefined {\n\t\treturn this.registry;\n\t}\n\n\t/**\n\t * Convenience helper to get the data store's/factory's data store registry entry.\n\t * The return type hides the factory's generics, easing grouping of registry\n\t * entries that differ only in this way into the same array.\n\t * @returns The NamedFluidDataStoreRegistryEntry\n\t */\n\tpublic get registryEntry(): NamedFluidDataStoreRegistryEntry {\n\t\treturn [this.type, Promise.resolve(this)];\n\t}\n\n\t/**\n\t * {@inheritDoc @fluidframework/runtime-definitions#IFluidDataStoreFactory.instantiateDataStore}\n\t */\n\tpublic async instantiateDataStore(\n\t\tcontext: IFluidDataStoreContext,\n\t\texisting: boolean,\n\t): Promise<IFluidDataStoreChannel> {\n\t\tconst { runtime } = await createDataObject(\n\t\t\tthis.ctor,\n\t\t\tcontext,\n\t\t\tthis.sharedObjectRegistry,\n\t\t\tthis.optionalProviders,\n\t\t\tthis.runtimeClass,\n\t\t\texisting,\n\t\t);\n\n\t\treturn runtime;\n\t}\n\n\t/**\n\t * Creates a new instance of the object. Uses parent context's registry to build package path to this factory.\n\t * In other words, registry of context passed in has to contain this factory, with the name that matches\n\t * this factory's type.\n\t * It is intended to be used by data store objects that create sub-objects.\n\t * @param context - The context being used to create the runtime\n\t * (the created object will have its own new context created as well)\n\t * @param initialState - The initial state to provide to the created data store.\n\t * @param loadingGroupId - NOT production ready, EXPERIMENTAL, please read {@link https://github.com/microsoft/FluidFramework/blob/main/packages/runtime/container-runtime/README.md | README}. The service needs to support this feature, does not work for most services\n\t * @returns an object created by this factory. Data store and objects created are not attached to container.\n\t * They get attached only when a handle to one of them is attached to already attached objects.\n\t */\n\tpublic async createChildInstance(\n\t\tparentContext: IFluidDataStoreContext,\n\t\tinitialState?: I[\"InitialState\"],\n\t\tloadingGroupId?: string,\n\t): Promise<TObj> {\n\t\treturn this.createNonRootInstanceCore(\n\t\t\tparentContext.containerRuntime,\n\t\t\t[...parentContext.packagePath, this.type],\n\t\t\tinitialState,\n\t\t\tloadingGroupId,\n\t\t);\n\t}\n\n\t/**\n\t * Creates a new instance of the object. Uses peer context's registry and its package path to identify this factory.\n\t * In other words, registry of context passed in has to have this factory.\n\t * Intended to be used by data store objects that need to create peers (similar) instances of existing objects.\n\t * @param context - The component context being used to create the object\n\t * (the created object will have its own new context created as well)\n\t * @param initialState - The initial state to provide to the created component.\n\t * @param loadingGroupId - NOT production ready, EXPERIMENTAL, please read {@link https://github.com/microsoft/FluidFramework/blob/main/packages/runtime/container-runtime/README.md | README}. The service needs to support this feature, does not work for most services\n\t * @returns an object created by this factory. Data store and objects created are not attached to container.\n\t * They get attached only when a handle to one of them is attached to already attached objects.\n\t */\n\tpublic async createPeerInstance(\n\t\tpeerContext: IFluidDataStoreContext,\n\t\tinitialState?: I[\"InitialState\"],\n\t\tloadingGroupId?: string, // DO NOT USE, this is an experimental feature\n\t): Promise<TObj> {\n\t\treturn this.createNonRootInstanceCore(\n\t\t\tpeerContext.containerRuntime,\n\t\t\tpeerContext.packagePath,\n\t\t\tinitialState,\n\t\t\tloadingGroupId,\n\t\t);\n\t}\n\n\t/**\n\t * Creates a new instance of the object. Uses container's registry to find this factory.\n\t * It's expected that only container owners would use this functionality, as only such developers\n\t * have knowledge of entries in container registry.\n\t * The name in this registry for such record should match type of this factory.\n\t * @param runtime - container runtime. It's registry is used to create an object.\n\t * @param initialState - The initial state to provide to the created component.\n\t * @param loadingGroupId - NOT production ready, EXPERIMENTAL, please read {@link https://github.com/microsoft/FluidFramework/blob/main/packages/runtime/container-runtime/README.md | README}. The service needs to support this feature, does not work for most services\n\t * @returns an object created by this factory. Data store and objects created are not attached to container.\n\t * They get attached only when a handle to one of them is attached to already attached objects.\n\t */\n\tpublic async createInstance(\n\t\truntime: IContainerRuntimeBase,\n\t\tinitialState?: I[\"InitialState\"],\n\t\tloadingGroupId?: string,\n\t): Promise<TObj> {\n\t\treturn this.createNonRootInstanceCore(runtime, [this.type], initialState, loadingGroupId);\n\t}\n\n\t/**\n\t * Creates a new instance of the object with a datastore which exposes the aliasing api.\n\t * @param runtime - container runtime. It is the runtime that will be used to create the object. It will produce\n\t * the underlying infrastructure to get the data object to operate.\n\t * @param initialState - The initial state to provide to the created component.\n\t * @param packagePath - The path to the data store factory to use to create the data object.\n\t * @param loadingGroupId - NOT production ready, EXPERIMENTAL, please read {@link https://github.com/microsoft/FluidFramework/blob/main/packages/runtime/container-runtime/README.md | README}. The service needs to support this feature, does not work for most services\n\t * @returns an array containing the object created by this factory and an IDataStore object that enables users to\n\t * alias the data object.\n\t * The data object is attached only when it is attached to the handle graph that connects to an aliased object or\n\t * when the data object is aliased.\n\t */\n\tpublic async createInstanceWithDataStore(\n\t\tcontainerRuntime: IContainerRuntimeBase,\n\t\tinitialState?: I[\"InitialState\"],\n\t\tpackagePath?: Readonly<string[]>,\n\t\tloadingGroupId?: string,\n\t): Promise<[TObj, IDataStore]> {\n\t\tconst context = containerRuntime.createDetachedDataStore(\n\t\t\tpackagePath ?? [this.type],\n\t\t\tloadingGroupId,\n\t\t);\n\t\tconst { instance, runtime } = await createDataObject(\n\t\t\tthis.ctor,\n\t\t\tcontext,\n\t\t\tthis.sharedObjectRegistry,\n\t\t\tthis.optionalProviders,\n\t\t\tthis.runtimeClass,\n\t\t\tfalse, // existing\n\t\t\tinitialState,\n\t\t);\n\t\tconst dataStore = await context.attachRuntime(this, runtime);\n\n\t\treturn [instance, dataStore];\n\t}\n\n\t/**\n\t * Creates a new root instance of the object. Uses container's registry to find this factory.\n\t * It's expected that only container owners would use this functionality, as only such developers\n\t * have knowledge of entries in container registry.\n\t * The name in this registry for such record should match type of this factory.\n\t * @param runtime - container runtime. It's registry is used to create an object.\n\t * @param initialState - The initial state to provide to the created component.\n\t * @returns an object created by this factory. Data store and objects created are not attached to container.\n\t * They get attached only when a handle to one of them is attached to already attached objects.\n\t *\n\t * @deprecated - the issue is that it does not allow the customer to decide the conflict resolution policy when an\n\t * aliasing conflict occurs. Use {@link PureDataObjectFactory.createInstanceWithDataStore} instead.\n\t */\n\tpublic async createRootInstance(\n\t\trootDataStoreId: string,\n\t\truntime: IContainerRuntime,\n\t\tinitialState?: I[\"InitialState\"],\n\t): Promise<TObj> {\n\t\tconst context = runtime.createDetachedDataStore([this.type]);\n\t\tconst { instance, runtime: dataStoreRuntime } = await createDataObject(\n\t\t\tthis.ctor,\n\t\t\tcontext,\n\t\t\tthis.sharedObjectRegistry,\n\t\t\tthis.optionalProviders,\n\t\t\tthis.runtimeClass,\n\t\t\tfalse, // existing\n\t\t\tinitialState,\n\t\t);\n\t\tconst dataStore = await context.attachRuntime(this, dataStoreRuntime);\n\t\tconst result = await dataStore.trySetAlias(rootDataStoreId);\n\t\tif (result !== \"Success\") {\n\t\t\tconst handle = await runtime.getAliasedDataStoreEntryPoint(rootDataStoreId);\n\t\t\tassert(handle !== undefined, 0x8e1 /* Should have retrieved aliased handle */);\n\t\t\treturn (await handle.get()) as TObj;\n\t\t}\n\t\treturn instance;\n\t}\n\n\tprotected async createNonRootInstanceCore(\n\t\tcontainerRuntime: IContainerRuntimeBase,\n\t\tpackagePath: Readonly<string[]>,\n\t\tinitialState?: I[\"InitialState\"],\n\t\tloadingGroupId?: string,\n\t): Promise<TObj> {\n\t\tconst context = containerRuntime.createDetachedDataStore(packagePath, loadingGroupId);\n\t\treturn this.createInstanceCore(context, initialState);\n\t}\n\n\tprotected async createInstanceCore(\n\t\tcontext: IFluidDataStoreContextDetached,\n\t\tinitialState?: I[\"InitialState\"],\n\t): Promise<TObj> {\n\t\tconst { instance, runtime } = await createDataObject(\n\t\t\tthis.ctor,\n\t\t\tcontext,\n\t\t\tthis.sharedObjectRegistry,\n\t\t\tthis.optionalProviders,\n\t\t\tthis.runtimeClass,\n\t\t\tfalse, // existing\n\t\t\tinitialState,\n\t\t);\n\n\t\tawait context.attachRuntime(this, runtime);\n\n\t\treturn instance;\n\t}\n}\n"]}
@@ -5,7 +5,7 @@
5
5
  import { type ISharedDirectory } from "@fluidframework/map/internal";
6
6
  import type { SharedObjectKind } from "@fluidframework/shared-object-base";
7
7
  import { PureDataObject } from "./pureDataObject.js";
8
- import type { DataObjectTypes } from "./types.js";
8
+ import type { DataObjectKind, DataObjectTypes } from "./types.js";
9
9
  /**
10
10
  * DataObject is a base data store that is primed with a root directory. It
11
11
  * ensures that it is created and ready before you can access it.
@@ -42,5 +42,5 @@ export declare abstract class DataObject<I extends DataObjectTypes = DataObjectT
42
42
  * @typeParam T - The kind of data object.
43
43
  * @internal
44
44
  */
45
- export declare function createDataObjectKind<T extends new (...any: any[]) => DataObject>(factory: T): T & SharedObjectKind<InstanceType<T>>;
45
+ export declare function createDataObjectKind<T extends DataObjectKind>(factory: T): T & SharedObjectKind<T extends DataObjectKind<infer I> ? I : unknown>;
46
46
  //# sourceMappingURL=dataObject.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"dataObject.d.ts","sourceRoot":"","sources":["../../src/data-objects/dataObject.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EACN,KAAK,gBAAgB,EAGrB,MAAM,8BAA8B,CAAC;AACtC,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,oCAAoC,CAAC;AAE3E,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AACrD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAElD;;;;;;;;;;;GAWG;AACH,8BAAsB,UAAU,CAC/B,CAAC,SAAS,eAAe,GAAG,eAAe,CAC1C,SAAQ,cAAc,CAAC,CAAC,CAAC;IAC1B,OAAO,CAAC,YAAY,CAA+B;IACnD,OAAO,CAAC,QAAQ,CAAC,eAAe,CAAU;IAE1C;;;OAGG;IACH,SAAS,KAAK,IAAI,IAAI,gBAAgB,CAMrC;IAED;;;OAGG;IACmB,kBAAkB,CAAC,QAAQ,EAAE,OAAO,GAAG,OAAO,CAAC,IAAI,CAAC;IA2B1E;;;OAGG;IACH,SAAS,CAAC,2BAA2B,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM;CAG3D;AAED;;;;GAIG;AACH,wBAAgB,oBAAoB,CAAC,CAAC,SAAS,KAAK,GAAG,GAAG,OAAA,KAAK,UAAU,EACxE,OAAO,EAAE,CAAC,GACR,CAAC,GAAG,gBAAgB,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC,CAEvC"}
1
+ {"version":3,"file":"dataObject.d.ts","sourceRoot":"","sources":["../../src/data-objects/dataObject.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EACN,KAAK,gBAAgB,EAGrB,MAAM,8BAA8B,CAAC;AACtC,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,oCAAoC,CAAC;AAE3E,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AACrD,OAAO,KAAK,EAAE,cAAc,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAElE;;;;;;;;;;;GAWG;AACH,8BAAsB,UAAU,CAC/B,CAAC,SAAS,eAAe,GAAG,eAAe,CAC1C,SAAQ,cAAc,CAAC,CAAC,CAAC;IAC1B,OAAO,CAAC,YAAY,CAA+B;IACnD,OAAO,CAAC,QAAQ,CAAC,eAAe,CAAU;IAE1C;;;OAGG;IACH,SAAS,KAAK,IAAI,IAAI,gBAAgB,CAMrC;IAED;;;OAGG;IACmB,kBAAkB,CAAC,QAAQ,EAAE,OAAO,GAAG,OAAO,CAAC,IAAI,CAAC;IA2B1E;;;OAGG;IACH,SAAS,CAAC,2BAA2B,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM;CAG3D;AAED;;;;GAIG;AACH,wBAAgB,oBAAoB,CAAC,CAAC,SAAS,cAAc,EAC5D,OAAO,EAAE,CAAC,GACR,CAAC,GAAG,gBAAgB,CAAC,CAAC,SAAS,cAAc,CAAC,MAAM,CAAC,CAAC,GAAG,CAAC,GAAG,OAAO,CAAC,CAEvE"}
@@ -1 +1 @@
1
- {"version":3,"file":"dataObject.js","sourceRoot":"","sources":["../../src/data-objects/dataObject.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAEN,UAAU,EACV,eAAe,GACf,MAAM,8BAA8B,CAAC;AAGtC,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;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ED;;;;GAIG;AACH,MAAM,UAAU,oBAAoB,CACnC,OAAU;IAEV,OAAO,OAAgD,CAAC;AACzD,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport {\n\ttype ISharedDirectory,\n\tMapFactory,\n\tSharedDirectory,\n} from \"@fluidframework/map/internal\";\nimport type { SharedObjectKind } from \"@fluidframework/shared-object-base\";\n\nimport { PureDataObject } from \"./pureDataObject.js\";\nimport type { DataObjectTypes } from \"./types.js\";\n\n/**\n * DataObject is a base data store that is primed with a root directory. It\n * ensures that it is created and ready before you can access it.\n *\n * Having a single root directory allows for easier development. Instead of creating\n * and registering channels with the runtime any new DDS that is set on the root\n * will automatically be registered.\n *\n * @typeParam I - The optional input types used to strongly type the data object\n * @legacy\n * @alpha\n */\nexport abstract class DataObject<\n\tI extends DataObjectTypes = DataObjectTypes,\n> extends PureDataObject<I> {\n\tprivate internalRoot: ISharedDirectory | undefined;\n\tprivate readonly rootDirectoryId = \"root\";\n\n\t/**\n\t * The root directory will either be ready or will return an error. If an error is thrown\n\t * the root has not been correctly created/set.\n\t */\n\tprotected get root(): ISharedDirectory {\n\t\tif (!this.internalRoot) {\n\t\t\tthrow new Error(this.getUninitializedErrorString(`root`));\n\t\t}\n\n\t\treturn this.internalRoot;\n\t}\n\n\t/**\n\t * Initializes internal objects and calls initialization overrides.\n\t * Caller is responsible for ensuring this is only invoked once.\n\t */\n\tpublic override async initializeInternal(existing: boolean): Promise<void> {\n\t\tif (existing) {\n\t\t\t// data store has a root directory so we just need to set it before calling initializingFromExisting\n\t\t\tthis.internalRoot = (await this.runtime.getChannel(\n\t\t\t\tthis.rootDirectoryId,\n\t\t\t)) as ISharedDirectory;\n\n\t\t\t// This will actually be an ISharedMap if the channel was previously created by the older version of\n\t\t\t// DataObject which used a SharedMap. Since SharedMap and SharedDirectory are compatible unless\n\t\t\t// SharedDirectory-only commands are used on SharedMap, this will mostly just work for compatibility.\n\t\t\tif (this.internalRoot.attributes.type === MapFactory.Type) {\n\t\t\t\tthis.runtime.logger.send({\n\t\t\t\t\tcategory: \"generic\",\n\t\t\t\t\teventName: \"MapDataObject\",\n\t\t\t\t\tmessage:\n\t\t\t\t\t\t\"Legacy document, SharedMap is masquerading as SharedDirectory in DataObject\",\n\t\t\t\t});\n\t\t\t}\n\t\t} else {\n\t\t\t// Create a root directory and register it before calling initializingFirstTime\n\t\t\tthis.internalRoot = SharedDirectory.create(this.runtime, this.rootDirectoryId);\n\t\t\tthis.internalRoot.bindToContext();\n\t\t}\n\n\t\tawait super.initializeInternal(existing);\n\t}\n\n\t/**\n\t * Generates an error string indicating an item is uninitialized.\n\t * @param item - The name of the item that was uninitialized.\n\t */\n\tprotected getUninitializedErrorString(item: string): string {\n\t\treturn `${item} must be initialized before being accessed.`;\n\t}\n}\n\n/**\n * Utility for creating SharedObjectKind instances for data objects.\n * @typeParam T - The kind of data object.\n * @internal\n */\nexport function createDataObjectKind<T extends new (...any) => DataObject>(\n\tfactory: T,\n): T & SharedObjectKind<InstanceType<T>> {\n\treturn factory as T & SharedObjectKind<InstanceType<T>>;\n}\n"]}
1
+ {"version":3,"file":"dataObject.js","sourceRoot":"","sources":["../../src/data-objects/dataObject.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAEN,UAAU,EACV,eAAe,GACf,MAAM,8BAA8B,CAAC;AAGtC,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAGrD;;;;;;;;;;;GAWG;AACH,MAAM,OAAgB,UAEpB,SAAQ,cAAiB;IAF3B;;QAIkB,oBAAe,GAAG,MAAM,CAAC;IAoD3C,CAAC;IAlDA;;;OAGG;IACH,IAAc,IAAI;QACjB,IAAI,CAAC,IAAI,CAAC,YAAY,EAAE,CAAC;YACxB,MAAM,IAAI,KAAK,CAAC,IAAI,CAAC,2BAA2B,CAAC,MAAM,CAAC,CAAC,CAAC;QAC3D,CAAC;QAED,OAAO,IAAI,CAAC,YAAY,CAAC;IAC1B,CAAC;IAED;;;OAGG;IACa,KAAK,CAAC,kBAAkB,CAAC,QAAiB;QACzD,IAAI,QAAQ,EAAE,CAAC;YACd,oGAAoG;YACpG,IAAI,CAAC,YAAY,GAAG,CAAC,MAAM,IAAI,CAAC,OAAO,CAAC,UAAU,CACjD,IAAI,CAAC,eAAe,CACpB,CAAqB,CAAC;YAEvB,oGAAoG;YACpG,gGAAgG;YAChG,qGAAqG;YACrG,IAAI,IAAI,CAAC,YAAY,CAAC,UAAU,CAAC,IAAI,KAAK,UAAU,CAAC,IAAI,EAAE,CAAC;gBAC3D,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,IAAI,CAAC;oBACxB,QAAQ,EAAE,SAAS;oBACnB,SAAS,EAAE,eAAe;oBAC1B,OAAO,EACN,6EAA6E;iBAC9E,CAAC,CAAC;YACJ,CAAC;QACF,CAAC;aAAM,CAAC;YACP,+EAA+E;YAC/E,IAAI,CAAC,YAAY,GAAG,eAAe,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,EAAE,IAAI,CAAC,eAAe,CAAC,CAAC;YAC/E,IAAI,CAAC,YAAY,CAAC,aAAa,EAAE,CAAC;QACnC,CAAC;QAED,MAAM,KAAK,CAAC,kBAAkB,CAAC,QAAQ,CAAC,CAAC;IAC1C,CAAC;IAED;;;OAGG;IACO,2BAA2B,CAAC,IAAY;QACjD,OAAO,GAAG,IAAI,6CAA6C,CAAC;IAC7D,CAAC;CACD;AAED;;;;GAIG;AACH,MAAM,UAAU,oBAAoB,CACnC,OAAU;IAEV,OAAO,OAAgF,CAAC;AACzF,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport {\n\ttype ISharedDirectory,\n\tMapFactory,\n\tSharedDirectory,\n} from \"@fluidframework/map/internal\";\nimport type { SharedObjectKind } from \"@fluidframework/shared-object-base\";\n\nimport { PureDataObject } from \"./pureDataObject.js\";\nimport type { DataObjectKind, DataObjectTypes } from \"./types.js\";\n\n/**\n * DataObject is a base data store that is primed with a root directory. It\n * ensures that it is created and ready before you can access it.\n *\n * Having a single root directory allows for easier development. Instead of creating\n * and registering channels with the runtime any new DDS that is set on the root\n * will automatically be registered.\n *\n * @typeParam I - The optional input types used to strongly type the data object\n * @legacy\n * @alpha\n */\nexport abstract class DataObject<\n\tI extends DataObjectTypes = DataObjectTypes,\n> extends PureDataObject<I> {\n\tprivate internalRoot: ISharedDirectory | undefined;\n\tprivate readonly rootDirectoryId = \"root\";\n\n\t/**\n\t * The root directory will either be ready or will return an error. If an error is thrown\n\t * the root has not been correctly created/set.\n\t */\n\tprotected get root(): ISharedDirectory {\n\t\tif (!this.internalRoot) {\n\t\t\tthrow new Error(this.getUninitializedErrorString(`root`));\n\t\t}\n\n\t\treturn this.internalRoot;\n\t}\n\n\t/**\n\t * Initializes internal objects and calls initialization overrides.\n\t * Caller is responsible for ensuring this is only invoked once.\n\t */\n\tpublic override async initializeInternal(existing: boolean): Promise<void> {\n\t\tif (existing) {\n\t\t\t// data store has a root directory so we just need to set it before calling initializingFromExisting\n\t\t\tthis.internalRoot = (await this.runtime.getChannel(\n\t\t\t\tthis.rootDirectoryId,\n\t\t\t)) as ISharedDirectory;\n\n\t\t\t// This will actually be an ISharedMap if the channel was previously created by the older version of\n\t\t\t// DataObject which used a SharedMap. Since SharedMap and SharedDirectory are compatible unless\n\t\t\t// SharedDirectory-only commands are used on SharedMap, this will mostly just work for compatibility.\n\t\t\tif (this.internalRoot.attributes.type === MapFactory.Type) {\n\t\t\t\tthis.runtime.logger.send({\n\t\t\t\t\tcategory: \"generic\",\n\t\t\t\t\teventName: \"MapDataObject\",\n\t\t\t\t\tmessage:\n\t\t\t\t\t\t\"Legacy document, SharedMap is masquerading as SharedDirectory in DataObject\",\n\t\t\t\t});\n\t\t\t}\n\t\t} else {\n\t\t\t// Create a root directory and register it before calling initializingFirstTime\n\t\t\tthis.internalRoot = SharedDirectory.create(this.runtime, this.rootDirectoryId);\n\t\t\tthis.internalRoot.bindToContext();\n\t\t}\n\n\t\tawait super.initializeInternal(existing);\n\t}\n\n\t/**\n\t * Generates an error string indicating an item is uninitialized.\n\t * @param item - The name of the item that was uninitialized.\n\t */\n\tprotected getUninitializedErrorString(item: string): string {\n\t\treturn `${item} must be initialized before being accessed.`;\n\t}\n}\n\n/**\n * Utility for creating SharedObjectKind instances for data objects.\n * @typeParam T - The kind of data object.\n * @internal\n */\nexport function createDataObjectKind<T extends DataObjectKind>(\n\tfactory: T,\n): T & SharedObjectKind<T extends DataObjectKind<infer I> ? I : unknown> {\n\treturn factory as T & SharedObjectKind<T extends DataObjectKind<infer I> ? I : unknown>;\n}\n"]}
@@ -4,5 +4,5 @@
4
4
  */
5
5
  export { DataObject, createDataObjectKind } from "./dataObject.js";
6
6
  export { PureDataObject } from "./pureDataObject.js";
7
- export type { DataObjectTypes, IDataObjectProps } from "./types.js";
7
+ export type { DataObjectKind, DataObjectTypes, IDataObjectProps } from "./types.js";
8
8
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/data-objects/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,UAAU,EAAE,oBAAoB,EAAE,MAAM,iBAAiB,CAAC;AACnE,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AACrD,YAAY,EAAE,eAAe,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/data-objects/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,UAAU,EAAE,oBAAoB,EAAE,MAAM,iBAAiB,CAAC;AACnE,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AACrD,YAAY,EAAE,cAAc,EAAE,eAAe,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/data-objects/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,UAAU,EAAE,oBAAoB,EAAE,MAAM,iBAAiB,CAAC;AACnE,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nexport { DataObject, createDataObjectKind } from \"./dataObject.js\";\nexport { PureDataObject } from \"./pureDataObject.js\";\nexport type { DataObjectTypes, IDataObjectProps } from \"./types.js\";\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/data-objects/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,UAAU,EAAE,oBAAoB,EAAE,MAAM,iBAAiB,CAAC;AACnE,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nexport { DataObject, createDataObjectKind } from \"./dataObject.js\";\nexport { PureDataObject } from \"./pureDataObject.js\";\nexport type { DataObjectKind, DataObjectTypes, IDataObjectProps } from \"./types.js\";\n"]}
@@ -4,7 +4,7 @@
4
4
  */
5
5
  import type { FluidObject, IEvent } from "@fluidframework/core-interfaces";
6
6
  import type { IFluidDataStoreRuntime } from "@fluidframework/datastore-definitions/internal";
7
- import type { IFluidDataStoreContext } from "@fluidframework/runtime-definitions/internal";
7
+ import type { IFluidDataStoreContext, IFluidDataStoreFactory } from "@fluidframework/runtime-definitions/internal";
8
8
  import type { AsyncFluidObjectProvider } from "@fluidframework/synthesize/internal";
9
9
  /**
10
10
  * This type is used as the base generic input to DataObject and PureDataObject.
@@ -35,4 +35,21 @@ export interface IDataObjectProps<I extends DataObjectTypes = DataObjectTypes> {
35
35
  readonly providers: AsyncFluidObjectProvider<I["OptionalProviders"]>;
36
36
  readonly initProps?: I["InitialState"];
37
37
  }
38
+ /**
39
+ * An object that has a factory that can create a data object.
40
+ * @typeParam T - The type of the data object.
41
+ * @internal
42
+ */
43
+ export type DataObjectKind<T = unknown> = {
44
+ readonly factory: IFluidDataStoreFactory;
45
+ } & ({
46
+ /**
47
+ * Not actually used, but required for strong typing.
48
+ */
49
+ readonly makeCovariant?: T | undefined;
50
+ }
51
+ /**
52
+ * Not actually used, but helps with strong typing.
53
+ */
54
+ | (new (...args: never[]) => T));
38
55
  //# sourceMappingURL=types.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/data-objects/types.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,EAAE,MAAM,iCAAiC,CAAC;AAC3E,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,gDAAgD,CAAC;AAC7F,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,8CAA8C,CAAC;AAC3F,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,qCAAqC,CAAC;AAEpF;;;;GAIG;AACH,MAAM,WAAW,eAAe;IAC/B;;OAEG;IACH,iBAAiB,CAAC,EAAE,WAAW,CAAC;IAChC;;OAEG;IAGH,YAAY,CAAC,EAAE,GAAG,CAAC;IACnB;;OAEG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;CAChB;AAED;;;GAGG;AACH,MAAM,WAAW,gBAAgB,CAAC,CAAC,SAAS,eAAe,GAAG,eAAe;IAC5E,QAAQ,CAAC,OAAO,EAAE,sBAAsB,CAAC;IACzC,QAAQ,CAAC,OAAO,EAAE,sBAAsB,CAAC;IACzC,QAAQ,CAAC,SAAS,EAAE,wBAAwB,CAAC,CAAC,CAAC,mBAAmB,CAAC,CAAC,CAAC;IACrE,QAAQ,CAAC,SAAS,CAAC,EAAE,CAAC,CAAC,cAAc,CAAC,CAAC;CACvC"}
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/data-objects/types.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,EAAE,MAAM,iCAAiC,CAAC;AAC3E,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,gDAAgD,CAAC;AAC7F,OAAO,KAAK,EACX,sBAAsB,EACtB,sBAAsB,EACtB,MAAM,8CAA8C,CAAC;AACtD,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,qCAAqC,CAAC;AAEpF;;;;GAIG;AACH,MAAM,WAAW,eAAe;IAC/B;;OAEG;IACH,iBAAiB,CAAC,EAAE,WAAW,CAAC;IAChC;;OAEG;IAGH,YAAY,CAAC,EAAE,GAAG,CAAC;IACnB;;OAEG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;CAChB;AAED;;;GAGG;AACH,MAAM,WAAW,gBAAgB,CAAC,CAAC,SAAS,eAAe,GAAG,eAAe;IAC5E,QAAQ,CAAC,OAAO,EAAE,sBAAsB,CAAC;IACzC,QAAQ,CAAC,OAAO,EAAE,sBAAsB,CAAC;IACzC,QAAQ,CAAC,SAAS,EAAE,wBAAwB,CAAC,CAAC,CAAC,mBAAmB,CAAC,CAAC,CAAC;IACrE,QAAQ,CAAC,SAAS,CAAC,EAAE,CAAC,CAAC,cAAc,CAAC,CAAC;CACvC;AAED;;;;GAIG;AACH,MAAM,MAAM,cAAc,CAAC,CAAC,GAAG,OAAO,IAAI;IACzC,QAAQ,CAAC,OAAO,EAAE,sBAAsB,CAAC;CACzC,GAAG,CACD;IACA;;OAEG;IACH,QAAQ,CAAC,aAAa,CAAC,EAAE,CAAC,GAAG,SAAS,CAAC;CACtC;AACH;;GAEG;GACD,CAAC,KACD,GAAG,IAAI,EAAE,KAAK,EAAE,KACX,CAAC,CAAC,CACT,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/data-objects/types.ts"],"names":[],"mappings":"AAAA;;;GAGG","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport type { FluidObject, IEvent } from \"@fluidframework/core-interfaces\";\nimport type { IFluidDataStoreRuntime } from \"@fluidframework/datastore-definitions/internal\";\nimport type { IFluidDataStoreContext } from \"@fluidframework/runtime-definitions/internal\";\nimport type { AsyncFluidObjectProvider } from \"@fluidframework/synthesize/internal\";\n\n/**\n * This type is used as the base generic input to DataObject and PureDataObject.\n * @legacy\n * @alpha\n */\nexport interface DataObjectTypes {\n\t/**\n\t * Represents a type that will define optional providers that will be injected.\n\t */\n\tOptionalProviders?: FluidObject;\n\t/**\n\t * The initial state type that the produced data object may take during creation.\n\t */\n\t// TODO: Use a real type here.\n\t// eslint-disable-next-line @typescript-eslint/no-explicit-any\n\tInitialState?: any;\n\t/**\n\t * Represents events that will be available in the EventForwarder.\n\t */\n\tEvents?: IEvent;\n}\n\n/**\n * @legacy\n * @alpha\n */\nexport interface IDataObjectProps<I extends DataObjectTypes = DataObjectTypes> {\n\treadonly runtime: IFluidDataStoreRuntime;\n\treadonly context: IFluidDataStoreContext;\n\treadonly providers: AsyncFluidObjectProvider<I[\"OptionalProviders\"]>;\n\treadonly initProps?: I[\"InitialState\"];\n}\n"]}
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/data-objects/types.ts"],"names":[],"mappings":"AAAA;;;GAGG","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport type { FluidObject, IEvent } from \"@fluidframework/core-interfaces\";\nimport type { IFluidDataStoreRuntime } from \"@fluidframework/datastore-definitions/internal\";\nimport type {\n\tIFluidDataStoreContext,\n\tIFluidDataStoreFactory,\n} from \"@fluidframework/runtime-definitions/internal\";\nimport type { AsyncFluidObjectProvider } from \"@fluidframework/synthesize/internal\";\n\n/**\n * This type is used as the base generic input to DataObject and PureDataObject.\n * @legacy\n * @alpha\n */\nexport interface DataObjectTypes {\n\t/**\n\t * Represents a type that will define optional providers that will be injected.\n\t */\n\tOptionalProviders?: FluidObject;\n\t/**\n\t * The initial state type that the produced data object may take during creation.\n\t */\n\t// TODO: Use a real type here.\n\t// eslint-disable-next-line @typescript-eslint/no-explicit-any\n\tInitialState?: any;\n\t/**\n\t * Represents events that will be available in the EventForwarder.\n\t */\n\tEvents?: IEvent;\n}\n\n/**\n * @legacy\n * @alpha\n */\nexport interface IDataObjectProps<I extends DataObjectTypes = DataObjectTypes> {\n\treadonly runtime: IFluidDataStoreRuntime;\n\treadonly context: IFluidDataStoreContext;\n\treadonly providers: AsyncFluidObjectProvider<I[\"OptionalProviders\"]>;\n\treadonly initProps?: I[\"InitialState\"];\n}\n\n/**\n * An object that has a factory that can create a data object.\n * @typeParam T - The type of the data object.\n * @internal\n */\nexport type DataObjectKind<T = unknown> = {\n\treadonly factory: IFluidDataStoreFactory;\n} & (\n\t| {\n\t\t\t/**\n\t\t\t * Not actually used, but required for strong typing.\n\t\t\t */\n\t\t\treadonly makeCovariant?: T | undefined;\n\t }\n\t/**\n\t * Not actually used, but helps with strong typing.\n\t */\n\t| (new (\n\t\t\t...args: never[]\n\t ) => T)\n);\n"]}
package/lib/index.d.ts CHANGED
@@ -17,6 +17,6 @@
17
17
  * @packageDocumentation
18
18
  */
19
19
  export { DataObjectFactory, PureDataObjectFactory } from "./data-object-factories/index.js";
20
- export { DataObject, type DataObjectTypes, type IDataObjectProps, PureDataObject, createDataObjectKind, } from "./data-objects/index.js";
20
+ export { DataObject, type DataObjectKind, type DataObjectTypes, type IDataObjectProps, PureDataObject, createDataObjectKind, } from "./data-objects/index.js";
21
21
  export { BaseContainerRuntimeFactory, type BaseContainerRuntimeFactoryProps, ContainerRuntimeFactoryWithDefaultDataStore, type ContainerRuntimeFactoryWithDefaultDataStoreProps, } from "./container-runtime-factories/index.js";
22
22
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;;;;;;;;;;;;GAaG;AAEH,OAAO,EAAE,iBAAiB,EAAE,qBAAqB,EAAE,MAAM,kCAAkC,CAAC;AAC5F,OAAO,EACN,UAAU,EACV,KAAK,eAAe,EACpB,KAAK,gBAAgB,EACrB,cAAc,EACd,oBAAoB,GACpB,MAAM,yBAAyB,CAAC;AACjC,OAAO,EACN,2BAA2B,EAC3B,KAAK,gCAAgC,EACrC,2CAA2C,EAC3C,KAAK,gDAAgD,GACrD,MAAM,wCAAwC,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;;;;;;;;;;;;GAaG;AAEH,OAAO,EAAE,iBAAiB,EAAE,qBAAqB,EAAE,MAAM,kCAAkC,CAAC;AAC5F,OAAO,EACN,UAAU,EACV,KAAK,cAAc,EACnB,KAAK,eAAe,EACpB,KAAK,gBAAgB,EACrB,cAAc,EACd,oBAAoB,GACpB,MAAM,yBAAyB,CAAC;AACjC,OAAO,EACN,2BAA2B,EAC3B,KAAK,gCAAgC,EACrC,2CAA2C,EAC3C,KAAK,gDAAgD,GACrD,MAAM,wCAAwC,CAAC"}
package/lib/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;;;;;;;;;;;;GAaG;AAEH,OAAO,EAAE,iBAAiB,EAAE,qBAAqB,EAAE,MAAM,kCAAkC,CAAC;AAC5F,OAAO,EACN,UAAU,EAGV,cAAc,EACd,oBAAoB,GACpB,MAAM,yBAAyB,CAAC;AACjC,OAAO,EACN,2BAA2B,EAE3B,2CAA2C,GAE3C,MAAM,wCAAwC,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\n/**\n * The `aqueduct` package is a library for building Fluid objects and Fluid\n * containers within the Fluid Framework. Its goal is to provide a thin base\n * layer over the existing Fluid Framework interfaces that allows developers to\n * get started quickly.\n *\n * @remarks\n * About the library name: An \"aqueduct\" is a way to transport water from a source\n * to another location. The library name was chosen because its purpose is to\n * facilitate using lower level constructs and therefore handle 'fluid' items\n * same as an aqueduct.\n *\n * @packageDocumentation\n */\n\nexport { DataObjectFactory, PureDataObjectFactory } from \"./data-object-factories/index.js\";\nexport {\n\tDataObject,\n\ttype DataObjectTypes,\n\ttype IDataObjectProps,\n\tPureDataObject,\n\tcreateDataObjectKind,\n} from \"./data-objects/index.js\";\nexport {\n\tBaseContainerRuntimeFactory,\n\ttype BaseContainerRuntimeFactoryProps,\n\tContainerRuntimeFactoryWithDefaultDataStore,\n\ttype ContainerRuntimeFactoryWithDefaultDataStoreProps,\n} from \"./container-runtime-factories/index.js\";\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;;;;;;;;;;;;GAaG;AAEH,OAAO,EAAE,iBAAiB,EAAE,qBAAqB,EAAE,MAAM,kCAAkC,CAAC;AAC5F,OAAO,EACN,UAAU,EAIV,cAAc,EACd,oBAAoB,GACpB,MAAM,yBAAyB,CAAC;AACjC,OAAO,EACN,2BAA2B,EAE3B,2CAA2C,GAE3C,MAAM,wCAAwC,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\n/**\n * The `aqueduct` package is a library for building Fluid objects and Fluid\n * containers within the Fluid Framework. Its goal is to provide a thin base\n * layer over the existing Fluid Framework interfaces that allows developers to\n * get started quickly.\n *\n * @remarks\n * About the library name: An \"aqueduct\" is a way to transport water from a source\n * to another location. The library name was chosen because its purpose is to\n * facilitate using lower level constructs and therefore handle 'fluid' items\n * same as an aqueduct.\n *\n * @packageDocumentation\n */\n\nexport { DataObjectFactory, PureDataObjectFactory } from \"./data-object-factories/index.js\";\nexport {\n\tDataObject,\n\ttype DataObjectKind,\n\ttype DataObjectTypes,\n\ttype IDataObjectProps,\n\tPureDataObject,\n\tcreateDataObjectKind,\n} from \"./data-objects/index.js\";\nexport {\n\tBaseContainerRuntimeFactory,\n\ttype BaseContainerRuntimeFactoryProps,\n\tContainerRuntimeFactoryWithDefaultDataStore,\n\ttype ContainerRuntimeFactoryWithDefaultDataStoreProps,\n} from \"./container-runtime-factories/index.js\";\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fluidframework/aqueduct",
3
- "version": "2.22.1",
3
+ "version": "2.23.0-325054",
4
4
  "description": "A set of implementations for Fluid Framework interfaces.",
5
5
  "homepage": "https://fluidframework.com",
6
6
  "repository": {
@@ -69,29 +69,29 @@
69
69
  "temp-directory": "nyc/.nyc_output"
70
70
  },
71
71
  "dependencies": {
72
- "@fluid-internal/client-utils": "~2.22.1",
73
- "@fluidframework/container-definitions": "~2.22.1",
74
- "@fluidframework/container-runtime": "~2.22.1",
75
- "@fluidframework/container-runtime-definitions": "~2.22.1",
76
- "@fluidframework/core-interfaces": "~2.22.1",
77
- "@fluidframework/core-utils": "~2.22.1",
78
- "@fluidframework/datastore": "~2.22.1",
79
- "@fluidframework/datastore-definitions": "~2.22.1",
80
- "@fluidframework/map": "~2.22.1",
81
- "@fluidframework/request-handler": "~2.22.1",
82
- "@fluidframework/runtime-definitions": "~2.22.1",
83
- "@fluidframework/runtime-utils": "~2.22.1",
84
- "@fluidframework/shared-object-base": "~2.22.1",
85
- "@fluidframework/synthesize": "~2.22.1"
72
+ "@fluid-internal/client-utils": "2.23.0-325054",
73
+ "@fluidframework/container-definitions": "2.23.0-325054",
74
+ "@fluidframework/container-runtime": "2.23.0-325054",
75
+ "@fluidframework/container-runtime-definitions": "2.23.0-325054",
76
+ "@fluidframework/core-interfaces": "2.23.0-325054",
77
+ "@fluidframework/core-utils": "2.23.0-325054",
78
+ "@fluidframework/datastore": "2.23.0-325054",
79
+ "@fluidframework/datastore-definitions": "2.23.0-325054",
80
+ "@fluidframework/map": "2.23.0-325054",
81
+ "@fluidframework/request-handler": "2.23.0-325054",
82
+ "@fluidframework/runtime-definitions": "2.23.0-325054",
83
+ "@fluidframework/runtime-utils": "2.23.0-325054",
84
+ "@fluidframework/shared-object-base": "2.23.0-325054",
85
+ "@fluidframework/synthesize": "2.23.0-325054"
86
86
  },
87
87
  "devDependencies": {
88
88
  "@arethetypeswrong/cli": "^0.17.1",
89
89
  "@biomejs/biome": "~1.9.3",
90
- "@fluid-internal/mocha-test-setup": "~2.22.1",
91
- "@fluid-tools/build-cli": "^0.51.0",
90
+ "@fluid-internal/mocha-test-setup": "2.23.0-325054",
91
+ "@fluid-tools/build-cli": "^0.54.0",
92
92
  "@fluidframework/aqueduct-previous": "npm:@fluidframework/aqueduct@2.22.0",
93
93
  "@fluidframework/build-common": "^2.0.3",
94
- "@fluidframework/build-tools": "^0.51.0",
94
+ "@fluidframework/build-tools": "^0.54.0",
95
95
  "@fluidframework/eslint-config-fluid": "^5.7.3",
96
96
  "@microsoft/api-extractor": "7.47.8",
97
97
  "@types/mocha": "^10.0.10",
@@ -9,7 +9,6 @@ import {
9
9
  SharedMap,
10
10
  DirectoryFactory,
11
11
  MapFactory,
12
- // eslint-disable-next-line import/no-deprecated
13
12
  SharedDirectory,
14
13
  } from "@fluidframework/map/internal";
15
14
  import type { NamedFluidDataStoreRegistryEntries } from "@fluidframework/runtime-definitions/internal";
@@ -127,7 +127,7 @@ async function createDataObject<
127
127
  }
128
128
 
129
129
  /**
130
- * PureDataObjectFactory is a barebones IFluidDataStoreFactory for use with PureDataObject.
130
+ * PureDataObjectFactory is a bare-bones IFluidDataStoreFactory for use with PureDataObject.
131
131
  * Consumers should typically use DataObjectFactory instead unless creating
132
132
  * another base data store factory.
133
133
  *
@@ -11,7 +11,7 @@ import {
11
11
  import type { SharedObjectKind } from "@fluidframework/shared-object-base";
12
12
 
13
13
  import { PureDataObject } from "./pureDataObject.js";
14
- import type { DataObjectTypes } from "./types.js";
14
+ import type { DataObjectKind, DataObjectTypes } from "./types.js";
15
15
 
16
16
  /**
17
17
  * DataObject is a base data store that is primed with a root directory. It
@@ -88,8 +88,8 @@ export abstract class DataObject<
88
88
  * @typeParam T - The kind of data object.
89
89
  * @internal
90
90
  */
91
- export function createDataObjectKind<T extends new (...any) => DataObject>(
91
+ export function createDataObjectKind<T extends DataObjectKind>(
92
92
  factory: T,
93
- ): T & SharedObjectKind<InstanceType<T>> {
94
- return factory as T & SharedObjectKind<InstanceType<T>>;
93
+ ): T & SharedObjectKind<T extends DataObjectKind<infer I> ? I : unknown> {
94
+ return factory as T & SharedObjectKind<T extends DataObjectKind<infer I> ? I : unknown>;
95
95
  }
@@ -5,4 +5,4 @@
5
5
 
6
6
  export { DataObject, createDataObjectKind } from "./dataObject.js";
7
7
  export { PureDataObject } from "./pureDataObject.js";
8
- export type { DataObjectTypes, IDataObjectProps } from "./types.js";
8
+ export type { DataObjectKind, DataObjectTypes, IDataObjectProps } from "./types.js";
@@ -5,7 +5,10 @@
5
5
 
6
6
  import type { FluidObject, IEvent } from "@fluidframework/core-interfaces";
7
7
  import type { IFluidDataStoreRuntime } from "@fluidframework/datastore-definitions/internal";
8
- import type { IFluidDataStoreContext } from "@fluidframework/runtime-definitions/internal";
8
+ import type {
9
+ IFluidDataStoreContext,
10
+ IFluidDataStoreFactory,
11
+ } from "@fluidframework/runtime-definitions/internal";
9
12
  import type { AsyncFluidObjectProvider } from "@fluidframework/synthesize/internal";
10
13
 
11
14
  /**
@@ -40,3 +43,25 @@ export interface IDataObjectProps<I extends DataObjectTypes = DataObjectTypes> {
40
43
  readonly providers: AsyncFluidObjectProvider<I["OptionalProviders"]>;
41
44
  readonly initProps?: I["InitialState"];
42
45
  }
46
+
47
+ /**
48
+ * An object that has a factory that can create a data object.
49
+ * @typeParam T - The type of the data object.
50
+ * @internal
51
+ */
52
+ export type DataObjectKind<T = unknown> = {
53
+ readonly factory: IFluidDataStoreFactory;
54
+ } & (
55
+ | {
56
+ /**
57
+ * Not actually used, but required for strong typing.
58
+ */
59
+ readonly makeCovariant?: T | undefined;
60
+ }
61
+ /**
62
+ * Not actually used, but helps with strong typing.
63
+ */
64
+ | (new (
65
+ ...args: never[]
66
+ ) => T)
67
+ );
package/src/index.ts CHANGED
@@ -21,6 +21,7 @@
21
21
  export { DataObjectFactory, PureDataObjectFactory } from "./data-object-factories/index.js";
22
22
  export {
23
23
  DataObject,
24
+ type DataObjectKind,
24
25
  type DataObjectTypes,
25
26
  type IDataObjectProps,
26
27
  PureDataObject,