@fluidframework/aqueduct 0.54.3 → 0.55.2

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 (44) hide show
  1. package/dist/container-runtime-factories/baseContainerRuntimeFactory.d.ts +3 -3
  2. package/dist/container-runtime-factories/baseContainerRuntimeFactory.d.ts.map +1 -1
  3. package/dist/container-runtime-factories/baseContainerRuntimeFactory.js +4 -8
  4. package/dist/container-runtime-factories/baseContainerRuntimeFactory.js.map +1 -1
  5. package/dist/container-runtime-factories/containerRuntimeFactoryWithDefaultDataStore.d.ts +2 -2
  6. package/dist/container-runtime-factories/containerRuntimeFactoryWithDefaultDataStore.d.ts.map +1 -1
  7. package/dist/container-runtime-factories/containerRuntimeFactoryWithDefaultDataStore.js +3 -5
  8. package/dist/container-runtime-factories/containerRuntimeFactoryWithDefaultDataStore.js.map +1 -1
  9. package/dist/data-object-factories/dataObjectFactory.d.ts +1 -21
  10. package/dist/data-object-factories/dataObjectFactory.d.ts.map +1 -1
  11. package/dist/data-object-factories/dataObjectFactory.js +1 -17
  12. package/dist/data-object-factories/dataObjectFactory.js.map +1 -1
  13. package/dist/data-object-factories/pureDataObjectFactory.d.ts +1 -21
  14. package/dist/data-object-factories/pureDataObjectFactory.d.ts.map +1 -1
  15. package/dist/data-object-factories/pureDataObjectFactory.js +1 -17
  16. package/dist/data-object-factories/pureDataObjectFactory.js.map +1 -1
  17. package/dist/data-objects/dataObject.d.ts +1 -23
  18. package/dist/data-objects/dataObject.d.ts.map +1 -1
  19. package/dist/data-objects/dataObject.js +1 -20
  20. package/dist/data-objects/dataObject.js.map +1 -1
  21. package/dist/data-objects/index.d.ts +2 -2
  22. package/dist/data-objects/index.d.ts.map +1 -1
  23. package/dist/data-objects/index.js +1 -3
  24. package/dist/data-objects/index.js.map +1 -1
  25. package/dist/data-objects/pureDataObject.d.ts +1 -20
  26. package/dist/data-objects/pureDataObject.d.ts.map +1 -1
  27. package/dist/data-objects/pureDataObject.js +2 -18
  28. package/dist/data-objects/pureDataObject.js.map +1 -1
  29. package/dist/test/tsconfig.tsbuildinfo +20 -36
  30. package/lib/container-runtime-factories/baseContainerRuntimeFactory.js +5 -9
  31. package/lib/container-runtime-factories/baseContainerRuntimeFactory.js.map +1 -1
  32. package/lib/container-runtime-factories/containerRuntimeFactoryWithDefaultDataStore.js +3 -5
  33. package/lib/container-runtime-factories/containerRuntimeFactoryWithDefaultDataStore.js.map +1 -1
  34. package/lib/data-object-factories/dataObjectFactory.js +0 -15
  35. package/lib/data-object-factories/dataObjectFactory.js.map +1 -1
  36. package/lib/data-object-factories/pureDataObjectFactory.js +0 -15
  37. package/lib/data-object-factories/pureDataObjectFactory.js.map +1 -1
  38. package/lib/data-objects/dataObject.js +0 -18
  39. package/lib/data-objects/dataObject.js.map +1 -1
  40. package/lib/data-objects/index.js +2 -2
  41. package/lib/data-objects/index.js.map +1 -1
  42. package/lib/data-objects/pureDataObject.js +1 -16
  43. package/lib/data-objects/pureDataObject.js.map +1 -1
  44. package/package.json +23 -22
@@ -1 +1 @@
1
- {"version":3,"file":"dataObject.js","sourceRoot":"","sources":["../../src/data-objects/dataObject.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAQH,OAAO,EAAoB,UAAU,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AACpF,OAAO,EAAE,aAAa,EAAE,iBAAiB,EAAE,MAAM,+BAA+B,CAAC;AACjF,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAGlD;;;;;;;;;GASG;AACH,MAAM,OAAgB,UAAwD,SAAQ,cAAiB;IAAvG;;QAGqB,oBAAe,GAAG,MAAM,CAAC;IA2D9C,CAAC;IAzDU,KAAK,CAAC,OAAO,CAAC,OAAiB;QAClC,MAAM,aAAa,GAAG,aAAa,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;QACpD,MAAM,MAAM,GAAG,aAAa,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC;QAC1C,I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;oBAC1B,OAAO,EAAE,6EAA6E;iBACzF,CAAC,CAAC;aACN;SACJ;QAED,MAAM,KAAK,CAAC,kBAAkB,CAAC,QAAQ,CAAC,CAAC;IAC7C,CAAC;IAES,2BAA2B,CAAC,IAAY;QAC9C,OAAO,GAAG,IAAI,6CAA6C,CAAC;IAChE,CAAC;CACJ;AAED;;;;;;;;;;;;;;GAcG;AACH,wDAAwD;AACxD,MAAM,OAAgB,gBAClB,SAAQ,UAA8D;CAErE","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { IEvent } from \"@fluidframework/common-definitions\";\nimport {\n IFluidObject,\n IRequest,\n IResponse,\n} from \"@fluidframework/core-interfaces\";\nimport { ISharedDirectory, MapFactory, SharedDirectory } from \"@fluidframework/map\";\nimport { RequestParser, create404Response } from \"@fluidframework/runtime-utils\";\nimport { PureDataObject } from \"./pureDataObject\";\nimport { DataObjectTypes } from \"./types\";\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 */\nexport abstract class DataObject<I extends DataObjectTypes = DataObjectTypes> extends PureDataObject<I>\n{\n private internalRoot: ISharedDirectory | undefined;\n private readonly rootDirectoryId = \"root\";\n\n public async request(request: IRequest): Promise<IResponse> {\n const requestParser = RequestParser.create(request);\n const itemId = requestParser.pathParts[0];\n if (itemId === \"bigBlobs\") {\n const value = this.root.get<string>(requestParser.pathParts.join(\"/\"));\n if (value === undefined) {\n return create404Response(requestParser);\n }\n return { mimeType: \"fluid/object\", status: 200, value };\n } else {\n return super.request(requestParser);\n }\n }\n\n /**\n * The root directory will either be ready or will return an error. If an error is thrown\n * the root has not been correctly created/set.\n */\n protected get root(): ISharedDirectory {\n if (!this.internalRoot) {\n throw new Error(this.getUninitializedErrorString(`root`));\n }\n\n return this.internalRoot;\n }\n\n /**\n * Initializes internal objects and calls initialization overrides.\n * Caller is responsible for ensuring this is only invoked once.\n */\n public async initializeInternal(existing: boolean): Promise<void> {\n if (!existing) {\n // Create a root directory and register it before calling initializingFirstTime\n this.internalRoot = SharedDirectory.create(this.runtime, this.rootDirectoryId);\n this.internalRoot.bindToContext();\n } else {\n // data store has a root directory so we just need to set it before calling initializingFromExisting\n this.internalRoot = await this.runtime.getChannel(this.rootDirectoryId) as ISharedDirectory;\n\n // This will actually be an ISharedMap if the channel was previously created by the older version of\n // DataObject which used a SharedMap. Since SharedMap and SharedDirectory are compatible unless\n // SharedDirectory-only commands are used on SharedMap, this will mostly just work for compatibility.\n if (this.internalRoot.attributes.type === MapFactory.Type) {\n this.runtime.logger.send({\n category: \"generic\",\n eventName: \"MapDataObject\",\n message: \"Legacy document, SharedMap is masquerading as SharedDirectory in DataObject\",\n });\n }\n }\n\n await super.initializeInternal(existing);\n }\n\n protected getUninitializedErrorString(item: string) {\n return `${item} must be initialized before being accessed.`;\n }\n}\n\n/**\n * @deprecated - This type is meant to ease the transition from the old DataObject type to the new.\n * please migrate to DataObject.\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 O - represents a type that will define optional providers that will be injected\n * @typeParam S - the initial state type that the produced data object may take during creation\n * @typeParam E - represents events that will be available in the EventForwarder\n */\n// eslint-disable-next-line @typescript-eslint/ban-types\nexport abstract class LegacyDataObject<O extends IFluidObject = object, S = undefined, E extends IEvent = IEvent>\n extends DataObject<{OptionalProviders: O, InitialState: S, Events: E}> {\n\n }\n"]}
1
+ {"version":3,"file":"dataObject.js","sourceRoot":"","sources":["../../src/data-objects/dataObject.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAMH,OAAO,EAAoB,UAAU,EAAE,eAAe,EAAE,MAAM,qBA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AC,CAAC;YAC/E,IAAI,CAAC,YAAY,CAAC,aAAa,EAAE,CAAC;SACrC;aAAM;YACH,oGAAoG;YACpG,IAAI,CAAC,YAAY,GAAG,MAAM,IAAI,CAAC,OAAO,CAAC,UAAU,CAAC,IAAI,CAAC,eAAe,CAAqB,CAAC;YAE5F,oGAAoG;YACpG,gGAAgG;YAChG,qGAAqG;YACrG,IAAI,IAAI,CAAC,YAAY,CAAC,UAAU,CAAC,IAAI,KAAK,UAAU,CAAC,IAAI,EAAE;gBACvD,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,IAAI,CAAC;oBACrB,QAAQ,EAAE,SAAS;oBACnB,SAAS,EAAE,eAAe;oBAC1B,OAAO,EAAE,6EAA6E;iBACzF,CAAC,CAAC;aACN;SACJ;QAED,MAAM,KAAK,CAAC,kBAAkB,CAAC,QAAQ,CAAC,CAAC;IAC7C,CAAC;IAES,2BAA2B,CAAC,IAAY;QAC9C,OAAO,GAAG,IAAI,6CAA6C,CAAC;IAChE,CAAC;CACJ","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport {\n IRequest,\n IResponse,\n} from \"@fluidframework/core-interfaces\";\nimport { ISharedDirectory, MapFactory, SharedDirectory } from \"@fluidframework/map\";\nimport { RequestParser, create404Response } from \"@fluidframework/runtime-utils\";\nimport { PureDataObject } from \"./pureDataObject\";\nimport { DataObjectTypes } from \"./types\";\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 */\nexport abstract class DataObject<I extends DataObjectTypes = DataObjectTypes> extends PureDataObject<I>\n{\n private internalRoot: ISharedDirectory | undefined;\n private readonly rootDirectoryId = \"root\";\n\n public async request(request: IRequest): Promise<IResponse> {\n const requestParser = RequestParser.create(request);\n const itemId = requestParser.pathParts[0];\n if (itemId === \"bigBlobs\") {\n const value = this.root.get<string>(requestParser.pathParts.join(\"/\"));\n if (value === undefined) {\n return create404Response(requestParser);\n }\n return { mimeType: \"fluid/object\", status: 200, value };\n } else {\n return super.request(requestParser);\n }\n }\n\n /**\n * The root directory will either be ready or will return an error. If an error is thrown\n * the root has not been correctly created/set.\n */\n protected get root(): ISharedDirectory {\n if (!this.internalRoot) {\n throw new Error(this.getUninitializedErrorString(`root`));\n }\n\n return this.internalRoot;\n }\n\n /**\n * Initializes internal objects and calls initialization overrides.\n * Caller is responsible for ensuring this is only invoked once.\n */\n public async initializeInternal(existing: boolean): Promise<void> {\n if (!existing) {\n // Create a root directory and register it before calling initializingFirstTime\n this.internalRoot = SharedDirectory.create(this.runtime, this.rootDirectoryId);\n this.internalRoot.bindToContext();\n } else {\n // data store has a root directory so we just need to set it before calling initializingFromExisting\n this.internalRoot = await this.runtime.getChannel(this.rootDirectoryId) as ISharedDirectory;\n\n // This will actually be an ISharedMap if the channel was previously created by the older version of\n // DataObject which used a SharedMap. Since SharedMap and SharedDirectory are compatible unless\n // SharedDirectory-only commands are used on SharedMap, this will mostly just work for compatibility.\n if (this.internalRoot.attributes.type === MapFactory.Type) {\n this.runtime.logger.send({\n category: \"generic\",\n eventName: \"MapDataObject\",\n message: \"Legacy document, SharedMap is masquerading as SharedDirectory in DataObject\",\n });\n }\n }\n\n await super.initializeInternal(existing);\n }\n\n protected getUninitializedErrorString(item: string) {\n return `${item} must be initialized before being accessed.`;\n }\n}\n"]}
@@ -2,6 +2,6 @@
2
2
  * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
3
3
  * Licensed under the MIT License.
4
4
  */
5
- export { DataObject, LegacyDataObject } from "./dataObject";
6
- export { PureDataObject, LegacyPureDataObject } from "./pureDataObject";
5
+ export { DataObject } from "./dataObject";
6
+ export { PureDataObject } from "./pureDataObject";
7
7
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/data-objects/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,UAAU,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAC5D,OAAO,EAAE,cAAc,EAAE,oBAAoB,EAAE,MAAM,kBAAkB,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nexport { DataObject, LegacyDataObject } from \"./dataObject\";\nexport { PureDataObject, LegacyPureDataObject } from \"./pureDataObject\";\nexport { DataObjectTypes, DataObjectType, IDataObjectProps } from \"./types\";\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/data-objects/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1C,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nexport { DataObject } from \"./dataObject\";\nexport { PureDataObject } from \"./pureDataObject\";\nexport { DataObjectTypes, DataObjectType, IDataObjectProps } from \"./types\";\n"]}
@@ -96,7 +96,7 @@ export class PureDataObject extends EventForwarder {
96
96
  await this.hasInitialized();
97
97
  }
98
98
  /**
99
- * Retreive Fluid object using the handle get or the older requestFluidObject_UNSAFE call to fetch by ID
99
+ * Retrieve Fluid object using the handle get or the older requestFluidObject_UNSAFE call to fetch by ID
100
100
  *
101
101
  * @param key - key that object (handle/id) is stored with in the directory
102
102
  * @param directory - directory containing the object
@@ -162,19 +162,4 @@ export class PureDataObject extends EventForwarder {
162
162
  super.dispose();
163
163
  }
164
164
  }
165
- /**
166
- * @deprecated - This type is meant to ease the transition from the old PureDataObject type to the new.
167
- * please migrate to PureDataObject.
168
- *
169
- * This is a bare-bones base class that does basic setup and enables for factory on an initialize call.
170
- * You probably don't want to inherit from this data store directly unless
171
- * you are creating another base data store class
172
- *
173
- * @typeParam O - represents a type that will define optional providers that will be injected
174
- * @typeParam S - the initial state type that the produced data object may take during creation
175
- * @typeParam E - represents events that will be available in the EventForwarder
176
- */
177
- // eslint-disable-next-line @typescript-eslint/ban-types
178
- export class LegacyPureDataObject extends PureDataObject {
179
- }
180
165
  //# sourceMappingURL=pureDataObject.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"pureDataObject.js","sourceRoot":"","sources":["../../src/data-objects/pureDataObject.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAeH,OAAO,EAAE,iBAAiB,EAAE,MAAM,2BAA2B,CAAC;AAE9D,OAAO,EAAE,MAAM,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAC;AACtE,OAAO,EAAE,mBAAmB,EAAE,MAAM,iCAAiC,CAAC;AAEtE,OAAO,EAAE,oBAAoB,EAAE,MAAM,uBAAuB,CAAC;AAC7D,OAAO,EAAE,gCAAgC,EAAE,MAAM,qBAAqB,CAAC;AAGvE;;;;;;GAMG;AACH,MAAM,OAAgB,cAClB,SAAQ,cAA2C;IAiDnD,YAAmB,KAA0B;QACzC,KAAK,EAAE,CAAC;QA/CJ,cAAS,GAAG,KAAK,CAAC;QAgDtB,IAAI,CAAC,OAAO,GAAG,KAAK,CAAC,OAAO,CAAC;QAC7B,IAAI,CAAC,OAAO,GAAG,KAAK,CAAC,OAAO,CAAC;QAC7B,IAAI,CAAC,SAAS,GAAG,KAAK,CAAC,SAAS,CAAC;QACjC,IAAI,CAAC,SAAS,GAAG,KAAK,CAAC,SAAS,CAAC;QAEjC,MAAM,CAAE,IAAI,CAAC,OAAe,CAAC,WAAW,KAAK,SAAS,EAAE,KAAK,CAAC,8CAA8C,CAAC,CAAC;QAC7G,IAAI,CAAC,OAAe,CAAC,WAAW,GAAG,IAAI,CAAC;QAEzC,8GAA8G;QAC9G,4GAA4G;QAC5G,yBAAyB;QACzB,IAAI,CAAC,WAAW,GAAG,IAAI,iBAAiB,CAAC,IAAI,EAA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,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC,MAAM,CAAC,GAAG,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,yBAAyB,CAAC,GAAG,CAAC,CAAM,CAAC;SACnF;IACL,CAAC;IAED;;;;OAIG;IACO,KAAK,CAAC,yBAAyB,CAAyB,EAAU;QACxE,OAAO,mBAAmB,CAAI,IAAI,EAAE,EAAE,EAAE,IAAI,CAAC,OAAO,CAAC,gBAAgB,CAAC,CAAC,GAAG,EAAE,CAAC;IACjF,CAAC;IAED;;;OAGG;IACO,KAAK,CAAC,UAAU,CAAuC,EAAU;QACvE,OAAO,mBAAmB,CAAI,IAAI,oBAAoB,IAAI,EAAE,EAAE,EAAE,IAAI,CAAC,OAAO,CAAC,gBAAgB,CAAC,CAAC,GAAG,EAAE,CAAC;IACzG,CAAC;IAED;;;OAGG;IACO,KAAK,CAAC,aAAa,KAAoB,CAAC;IAElD;;;;;OAKG;IACO,KAAK,CAAC,qBAAqB,CAAC,KAAyC,IAAmB,CAAC;IAEnG;;;OAGG;IACO,KAAK,CAAC,wBAAwB,KAAoB,CAAC;IAE7D;;OAEG;IACO,KAAK,CAAC,cAAc,KAAoB,CAAC;IAEnD;;OAEG;IACI,OAAO;QACV,KAAK,CAAC,OAAO,EAAE,CAAC;IACpB,CAAC;CACJ;AAED;;;;;;;;;;;GAWG;AACH,wDAAwD;AACxD,MAAM,OAAgB,oBACtB,SAAQ,cAAkE;CAEzE","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport {\n IFluidObject,\n IFluidHandle,\n IFluidLoadable,\n IFluidRouter,\n IProvideFluidHandle,\n IRequest,\n IResponse,\n FluidObject,\n} from \"@fluidframework/core-interfaces\";\nimport { AsyncFluidObjectProvider, FluidObjectKey } from \"@fluidframework/synthesize\";\nimport { IFluidDataStoreContext } from \"@fluidframework/runtime-definitions\";\nimport { IFluidDataStoreRuntime } from \"@fluidframework/datastore-definitions\";\nimport { FluidObjectHandle } from \"@fluidframework/datastore\";\nimport { IDirectory } from \"@fluidframework/map\";\nimport { assert, EventForwarder } from \"@fluidframework/common-utils\";\nimport { handleFromLegacyUri } from \"@fluidframework/request-handler\";\nimport { IEvent } from \"@fluidframework/common-definitions\";\nimport { serviceRoutePathRoot } from \"../container-services\";\nimport { defaultFluidObjectRequestHandler } from \"../request-handlers\";\nimport { DataObjectTypes, DataObjectType, IDataObjectProps } from \"./types\";\n\n/**\n * This is a bare-bones base class that does basic setup and enables for factory on an initialize call.\n * You probably don't want to inherit from this data store directly unless\n * you are creating another base data store class\n *\n * @typeParam I - The optional input types used to strongly type the data object\n */\nexport abstract class PureDataObject<I extends DataObjectTypes = DataObjectTypes>\n extends EventForwarder<DataObjectType<I, \"Events\">>\n implements IFluidLoadable, IFluidRouter, IProvideFluidHandle, IFluidObject {\n private readonly innerHandle: IFluidHandle<this>;\n private _disposed = false;\n\n /**\n * This is your FluidDataStoreRuntime object\n */\n protected readonly runtime: IFluidDataStoreRuntime;\n\n /**\n * This context is used to talk up to the ContainerRuntime\n */\n protected readonly context: IFluidDataStoreContext;\n\n /**\n * Providers are IFluidObject keyed objects that provide back\n * a promise to the corresponding IFluidObject or undefined.\n * Providers injected/provided by the Container and/or HostingApplication\n *\n * To define providers set IFluidObject interfaces in the generic O type for your data store\n */\n protected readonly providers:\n // eslint-disable-next-line @typescript-eslint/ban-types\n AsyncFluidObjectProvider<FluidObjectKey<DataObjectType<I, \"OptionalProviders\">>, FluidObjectKey<object>>;\n\n protected initProps?: DataObjectType<I, \"InitialState\">;\n\n protected initializeP: Promise<void> | undefined;\n\n public get disposed() { return this._disposed; }\n\n public get id() { return this.runtime.id; }\n public get IFluidRouter() { return this; }\n public get IFluidLoadable() { return this; }\n public get IFluidHandle() { return this.innerHandle; }\n\n /**\n * Handle to a data store\n */\n public get handle(): IFluidHandle<this> { return this.innerHandle; }\n\n public static async getDataObject(runtime: IFluidDataStoreRuntime) {\n const obj = (runtime as any)._dataObject as PureDataObject;\n assert(obj !== undefined, 0x0bc /* \"Runtime has no DataObject!\" */);\n await obj.finishInitialization(true);\n return obj;\n }\n\n public constructor(props: IDataObjectProps<I>) {\n super();\n this.runtime = props.runtime;\n this.context = props.context;\n this.providers = props.providers;\n this.initProps = props.initProps;\n\n assert((this.runtime as any)._dataObject === undefined, 0x0bd /* \"Object runtime already has DataObject!\" */);\n (this.runtime as any)._dataObject = this;\n\n // Create a FluidObjectHandle with empty string as `path`. This is because reaching this PureDataObject is the\n // same as reaching its routeContext (FluidDataStoreRuntime) so there is so the relative path to it from the\n // routeContext is empty.\n this.innerHandle = new FluidObjectHandle(this, \"\", this.runtime.objectsRoutingContext);\n\n // Container event handlers\n this.runtime.once(\"dispose\", () => {\n this._disposed = true;\n this.dispose();\n });\n }\n\n // #region IFluidRouter\n\n /**\n * Return this object if someone requests it directly\n * We will return this object in two scenarios:\n * 1. the request url is a \"/\"\n * 2. the request url is empty\n */\n public async request(req: IRequest): Promise<IResponse> {\n return defaultFluidObjectRequestHandler(this, req);\n }\n\n // #endregion IFluidRouter\n\n // #region IFluidLoadable\n\n // #endregion IFluidLoadable\n\n /**\n * Call this API to ensure PureDataObject is fully initialized\n * initialization happens on demand, only on as-needed bases.\n * In most cases you should allow factory/object to decide when to finish initialization.\n * But if you are supplying your own implementation of DataStoreRuntime factory and overriding some methods\n * and need fully initialized object, then you can call this API to ensure object is fully initialized.\n */\n public async finishInitialization(existing: boolean): Promise<void> {\n if (this.initializeP !== undefined) {\n return this.initializeP;\n }\n this.initializeP = this.initializeInternal(existing);\n return this.initializeP;\n }\n\n /**\n * Internal initialize implementation. Overwriting this will change the flow of the PureDataObject and should\n * generally not be done.\n *\n * Calls initializingFirstTime, initializingFromExisting, and hasInitialized. Caller is\n * responsible for ensuring this is only invoked once.\n */\n public async initializeInternal(existing: boolean): Promise<void> {\n await this.preInitialize();\n if (existing) {\n assert(this.initProps === undefined,\n 0x0be /* \"Trying to initialize from existing while initProps is set!\" */);\n await this.initializingFromExisting();\n } else {\n await this.initializingFirstTime(\n this.context.createProps as DataObjectType<I, \"InitialState\"> ?? this.initProps);\n }\n await this.hasInitialized();\n }\n\n /**\n * Retreive Fluid object using the handle get or the older requestFluidObject_UNSAFE call to fetch by ID\n *\n * @param key - key that object (handle/id) is stored with in the directory\n * @param directory - directory containing the object\n * @param getObjectFromDirectory - optional callback for fetching object from the directory, allows users to\n * define custom types/getters for object retrieval\n */\n public async getFluidObjectFromDirectory<T extends IFluidObject & FluidObject & IFluidLoadable>(\n key: string,\n directory: IDirectory,\n getObjectFromDirectory?: (id: string, directory: IDirectory) => string | IFluidHandle | undefined):\n Promise<T | undefined> {\n const handleOrId = getObjectFromDirectory ? getObjectFromDirectory(key, directory) : directory.get(key);\n if (typeof handleOrId === \"string\") {\n // For backwards compatibility with older stored IDs\n // We update the storage with the handle so that this code path is less and less trafficked\n const fluidObject = await this.requestFluidObject_UNSAFE<T>(handleOrId);\n if (fluidObject.IFluidLoadable && fluidObject.handle) {\n directory.set(key, fluidObject.handle);\n }\n return fluidObject;\n } else {\n const handle = handleOrId?.IFluidHandle;\n return await (handle ? handle.get() : this.requestFluidObject_UNSAFE(key)) as T;\n }\n }\n\n /**\n * @deprecated\n * Gets the data store of a given id. Will follow the pattern of the container for waiting.\n * @param id - data store id\n */\n protected async requestFluidObject_UNSAFE<T extends IFluidObject>(id: string): Promise<T> {\n return handleFromLegacyUri<T>(`/${id}`, this.context.containerRuntime).get();\n }\n\n /**\n * Gets the service at a given id.\n * @param id - service id\n */\n protected async getService<T extends IFluidObject & FluidObject>(id: string): Promise<T> {\n return handleFromLegacyUri<T>(`/${serviceRoutePathRoot}/${id}`, this.context.containerRuntime).get();\n }\n\n /**\n * Called every time the data store is initialized, before initializingFirstTime or\n * initializingFromExisting is called.\n */\n protected async preInitialize(): Promise<void> { }\n\n /**\n * Called the first time the data store is initialized (new creations with a new\n * data store runtime)\n *\n * @param props - Optional props to be passed in on create\n */\n protected async initializingFirstTime(props?: DataObjectType<I, \"InitialState\">): Promise<void> { }\n\n /**\n * Called every time but the first time the data store is initialized (creations\n * with an existing data store runtime)\n */\n protected async initializingFromExisting(): Promise<void> { }\n\n /**\n * Called every time the data store is initialized after create or existing.\n */\n protected async hasInitialized(): Promise<void> { }\n\n /**\n * Called when the host container closes and disposes itself\n */\n public dispose(): void {\n super.dispose();\n }\n}\n\n/**\n * @deprecated - This type is meant to ease the transition from the old PureDataObject type to the new.\n * please migrate to PureDataObject.\n *\n * This is a bare-bones base class that does basic setup and enables for factory on an initialize call.\n * You probably don't want to inherit from this data store directly unless\n * you are creating another base data store class\n *\n * @typeParam O - represents a type that will define optional providers that will be injected\n * @typeParam S - the initial state type that the produced data object may take during creation\n * @typeParam E - represents events that will be available in the EventForwarder\n */\n// eslint-disable-next-line @typescript-eslint/ban-types\nexport abstract class LegacyPureDataObject<O extends IFluidObject = object, S = undefined, E extends IEvent = IEvent>\nextends PureDataObject<{OptionalProviders: O, InitialState: S, Events: E}> {\n\n}\n"]}
1
+ {"version":3,"file":"pureDataObject.js","sourceRoot":"","sources":["../../src/data-objects/pureDataObject.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAeH,OAAO,EAAE,iBAAiB,EAAE,MAAM,2BAA2B,CAAC;AAE9D,OAAO,EAAE,MAAM,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAC;AACtE,OAAO,EAAE,mBAAmB,EAAE,MAAM,iCAAiC,CAAC;AACtE,OAAO,EAAE,oBAAoB,EAAE,MAAM,uBAAuB,CAAC;AAC7D,OAAO,EAAE,gCAAgC,EAAE,MAAM,qBAAqB,CAAC;AAGvE;;;;;;GAMG;AACH,MAAM,OAAgB,cAClB,SAAQ,cAA2C;IAiDnD,YAAmB,KAA0B;QACzC,KAAK,EAAE,CAAC;QA/CJ,cAAS,GAAG,KAAK,CAAC;QAgDtB,IAAI,CAAC,OAAO,GAAG,KAAK,CAAC,OAAO,CAAC;QAC7B,IAAI,CAAC,OAAO,GAAG,KAAK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microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport {\n IFluidObject,\n IFluidHandle,\n IFluidLoadable,\n IFluidRouter,\n IProvideFluidHandle,\n IRequest,\n IResponse,\n FluidObject,\n} from \"@fluidframework/core-interfaces\";\nimport { AsyncFluidObjectProvider, FluidObjectKey } from \"@fluidframework/synthesize\";\nimport { IFluidDataStoreContext } from \"@fluidframework/runtime-definitions\";\nimport { IFluidDataStoreRuntime } from \"@fluidframework/datastore-definitions\";\nimport { FluidObjectHandle } from \"@fluidframework/datastore\";\nimport { IDirectory } from \"@fluidframework/map\";\nimport { assert, EventForwarder } from \"@fluidframework/common-utils\";\nimport { handleFromLegacyUri } from \"@fluidframework/request-handler\";\nimport { serviceRoutePathRoot } from \"../container-services\";\nimport { defaultFluidObjectRequestHandler } from \"../request-handlers\";\nimport { DataObjectTypes, DataObjectType, IDataObjectProps } from \"./types\";\n\n/**\n * This is a bare-bones base class that does basic setup and enables for factory on an initialize call.\n * You probably don't want to inherit from this data store directly unless\n * you are creating another base data store class\n *\n * @typeParam I - The optional input types used to strongly type the data object\n */\nexport abstract class PureDataObject<I extends DataObjectTypes = DataObjectTypes>\n extends EventForwarder<DataObjectType<I, \"Events\">>\n implements IFluidLoadable, IFluidRouter, IProvideFluidHandle, IFluidObject {\n private readonly innerHandle: IFluidHandle<this>;\n private _disposed = false;\n\n /**\n * This is your FluidDataStoreRuntime object\n */\n protected readonly runtime: IFluidDataStoreRuntime;\n\n /**\n * This context is used to talk up to the ContainerRuntime\n */\n protected readonly context: IFluidDataStoreContext;\n\n /**\n * Providers are IFluidObject keyed objects that provide back\n * a promise to the corresponding IFluidObject or undefined.\n * Providers injected/provided by the Container and/or HostingApplication\n *\n * To define providers set IFluidObject interfaces in the generic O type for your data store\n */\n protected readonly providers:\n // eslint-disable-next-line @typescript-eslint/ban-types\n AsyncFluidObjectProvider<FluidObjectKey<DataObjectType<I, \"OptionalProviders\">>, FluidObjectKey<object>>;\n\n protected initProps?: DataObjectType<I, \"InitialState\">;\n\n protected initializeP: Promise<void> | undefined;\n\n public get disposed() { return this._disposed; }\n\n public get id() { return this.runtime.id; }\n public get IFluidRouter() { return this; }\n public get IFluidLoadable() { return this; }\n public get IFluidHandle() { return this.innerHandle; }\n\n /**\n * Handle to a data store\n */\n public get handle(): IFluidHandle<this> { return this.innerHandle; }\n\n public static async getDataObject(runtime: IFluidDataStoreRuntime) {\n const obj = (runtime as any)._dataObject as PureDataObject;\n assert(obj !== undefined, 0x0bc /* \"Runtime has no DataObject!\" */);\n await obj.finishInitialization(true);\n return obj;\n }\n\n public constructor(props: IDataObjectProps<I>) {\n super();\n this.runtime = props.runtime;\n this.context = props.context;\n this.providers = props.providers;\n this.initProps = props.initProps;\n\n assert((this.runtime as any)._dataObject === undefined, 0x0bd /* \"Object runtime already has DataObject!\" */);\n (this.runtime as any)._dataObject = this;\n\n // Create a FluidObjectHandle with empty string as `path`. This is because reaching this PureDataObject is the\n // same as reaching its routeContext (FluidDataStoreRuntime) so there is so the relative path to it from the\n // routeContext is empty.\n this.innerHandle = new FluidObjectHandle(this, \"\", this.runtime.objectsRoutingContext);\n\n // Container event handlers\n this.runtime.once(\"dispose\", () => {\n this._disposed = true;\n this.dispose();\n });\n }\n\n // #region IFluidRouter\n\n /**\n * Return this object if someone requests it directly\n * We will return this object in two scenarios:\n * 1. the request url is a \"/\"\n * 2. the request url is empty\n */\n public async request(req: IRequest): Promise<IResponse> {\n return defaultFluidObjectRequestHandler(this, req);\n }\n\n // #endregion IFluidRouter\n\n // #region IFluidLoadable\n\n // #endregion IFluidLoadable\n\n /**\n * Call this API to ensure PureDataObject is fully initialized\n * initialization happens on demand, only on as-needed bases.\n * In most cases you should allow factory/object to decide when to finish initialization.\n * But if you are supplying your own implementation of DataStoreRuntime factory and overriding some methods\n * and need fully initialized object, then you can call this API to ensure object is fully initialized.\n */\n public async finishInitialization(existing: boolean): Promise<void> {\n if (this.initializeP !== undefined) {\n return this.initializeP;\n }\n this.initializeP = this.initializeInternal(existing);\n return this.initializeP;\n }\n\n /**\n * Internal initialize implementation. Overwriting this will change the flow of the PureDataObject and should\n * generally not be done.\n *\n * Calls initializingFirstTime, initializingFromExisting, and hasInitialized. Caller is\n * responsible for ensuring this is only invoked once.\n */\n public async initializeInternal(existing: boolean): Promise<void> {\n await this.preInitialize();\n if (existing) {\n assert(this.initProps === undefined,\n 0x0be /* \"Trying to initialize from existing while initProps is set!\" */);\n await this.initializingFromExisting();\n } else {\n await this.initializingFirstTime(\n this.context.createProps as DataObjectType<I, \"InitialState\"> ?? this.initProps);\n }\n await this.hasInitialized();\n }\n\n /**\n * Retrieve Fluid object using the handle get or the older requestFluidObject_UNSAFE call to fetch by ID\n *\n * @param key - key that object (handle/id) is stored with in the directory\n * @param directory - directory containing the object\n * @param getObjectFromDirectory - optional callback for fetching object from the directory, allows users to\n * define custom types/getters for object retrieval\n */\n public async getFluidObjectFromDirectory<T extends IFluidObject & FluidObject & IFluidLoadable>(\n key: string,\n directory: IDirectory,\n getObjectFromDirectory?: (id: string, directory: IDirectory) => string | IFluidHandle | undefined):\n Promise<T | undefined> {\n const handleOrId = getObjectFromDirectory ? getObjectFromDirectory(key, directory) : directory.get(key);\n if (typeof handleOrId === \"string\") {\n // For backwards compatibility with older stored IDs\n // We update the storage with the handle so that this code path is less and less trafficked\n const fluidObject = await this.requestFluidObject_UNSAFE<T>(handleOrId);\n if (fluidObject.IFluidLoadable && fluidObject.handle) {\n directory.set(key, fluidObject.handle);\n }\n return fluidObject;\n } else {\n const handle = handleOrId?.IFluidHandle;\n return await (handle ? handle.get() : this.requestFluidObject_UNSAFE(key)) as T;\n }\n }\n\n /**\n * @deprecated\n * Gets the data store of a given id. Will follow the pattern of the container for waiting.\n * @param id - data store id\n */\n protected async requestFluidObject_UNSAFE<T extends IFluidObject>(id: string): Promise<T> {\n return handleFromLegacyUri<T>(`/${id}`, this.context.containerRuntime).get();\n }\n\n /**\n * Gets the service at a given id.\n * @param id - service id\n */\n protected async getService<T extends IFluidObject & FluidObject>(id: string): Promise<T> {\n return handleFromLegacyUri<T>(`/${serviceRoutePathRoot}/${id}`, this.context.containerRuntime).get();\n }\n\n /**\n * Called every time the data store is initialized, before initializingFirstTime or\n * initializingFromExisting is called.\n */\n protected async preInitialize(): Promise<void> { }\n\n /**\n * Called the first time the data store is initialized (new creations with a new\n * data store runtime)\n *\n * @param props - Optional props to be passed in on create\n */\n protected async initializingFirstTime(props?: DataObjectType<I, \"InitialState\">): Promise<void> { }\n\n /**\n * Called every time but the first time the data store is initialized (creations\n * with an existing data store runtime)\n */\n protected async initializingFromExisting(): Promise<void> { }\n\n /**\n * Called every time the data store is initialized after create or existing.\n */\n protected async hasInitialized(): Promise<void> { }\n\n /**\n * Called when the host container closes and disposes itself\n */\n public dispose(): void {\n super.dispose();\n }\n}\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fluidframework/aqueduct",
3
- "version": "0.54.3",
3
+ "version": "0.55.2",
4
4
  "description": "A set of implementations for Fluid Framework interfaces.",
5
5
  "homepage": "https://fluidframework.com",
6
6
  "repository": "https://github.com/microsoft/FluidFramework",
@@ -26,7 +26,7 @@
26
26
  "ci:build:docs": "api-extractor run --typescript-compiler-folder ../../../node_modules/typescript && copyfiles -u 1 ./_api-extractor-temp/* ../../../_api-extractor-temp/",
27
27
  "clean": "rimraf dist lib *.tsbuildinfo *.build.log",
28
28
  "eslint": "eslint --format stylish src",
29
- "eslint:fix": "eslint --format stylish src --fix",
29
+ "eslint:fix": "eslint --format stylish src --fix --fix-type problem,suggestion,layout",
30
30
  "lint": "npm run eslint",
31
31
  "lint:fix": "npm run eslint:fix",
32
32
  "test": "npm run test:mocha",
@@ -61,39 +61,40 @@
61
61
  "@fluidframework/common-definitions": "^0.20.1",
62
62
  "@fluidframework/common-utils": "^0.32.1",
63
63
  "@fluidframework/container-definitions": "^0.44.0",
64
- "@fluidframework/container-loader": "^0.54.3",
65
- "@fluidframework/container-runtime": "^0.54.3",
66
- "@fluidframework/container-runtime-definitions": "^0.54.3",
64
+ "@fluidframework/container-loader": "^0.55.2",
65
+ "@fluidframework/container-runtime": "^0.55.2",
66
+ "@fluidframework/container-runtime-definitions": "^0.55.2",
67
67
  "@fluidframework/core-interfaces": "^0.41.0",
68
- "@fluidframework/datastore": "^0.54.3",
69
- "@fluidframework/datastore-definitions": "^0.54.3",
70
- "@fluidframework/map": "^0.54.3",
71
- "@fluidframework/request-handler": "^0.54.3",
72
- "@fluidframework/runtime-definitions": "^0.54.3",
73
- "@fluidframework/runtime-utils": "^0.54.3",
74
- "@fluidframework/synthesize": "^0.54.3",
75
- "@fluidframework/view-interfaces": "^0.54.3",
68
+ "@fluidframework/datastore": "^0.55.2",
69
+ "@fluidframework/datastore-definitions": "^0.55.2",
70
+ "@fluidframework/map": "^0.55.2",
71
+ "@fluidframework/request-handler": "^0.55.2",
72
+ "@fluidframework/runtime-definitions": "^0.55.2",
73
+ "@fluidframework/runtime-utils": "^0.55.2",
74
+ "@fluidframework/synthesize": "^0.55.2",
75
+ "@fluidframework/view-interfaces": "^0.55.2",
76
76
  "uuid": "^8.3.1"
77
77
  },
78
78
  "devDependencies": {
79
79
  "@fluidframework/build-common": "^0.23.0",
80
- "@fluidframework/eslint-config-fluid": "^0.24.0",
81
- "@fluidframework/mocha-test-setup": "^0.54.3",
80
+ "@fluidframework/eslint-config-fluid": "^0.25.0",
81
+ "@fluidframework/mocha-test-setup": "^0.55.2",
82
82
  "@microsoft/api-extractor": "^7.16.1",
83
+ "@rushstack/eslint-config": "^2.5.1",
83
84
  "@types/mocha": "^8.2.2",
84
85
  "@types/node": "^14.18.0",
85
- "@typescript-eslint/eslint-plugin": "~4.14.0",
86
- "@typescript-eslint/parser": "~4.14.0",
86
+ "@typescript-eslint/eslint-plugin": "~5.9.0",
87
+ "@typescript-eslint/parser": "~5.9.0",
87
88
  "concurrently": "^6.2.0",
88
89
  "copyfiles": "^2.1.0",
89
90
  "cross-env": "^7.0.2",
90
- "eslint": "~7.18.0",
91
+ "eslint": "~8.6.0",
92
+ "eslint-plugin-editorconfig": "~3.2.0",
91
93
  "eslint-plugin-eslint-comments": "~3.2.0",
92
- "eslint-plugin-import": "~2.22.1",
94
+ "eslint-plugin-import": "~2.25.4",
93
95
  "eslint-plugin-no-null": "~1.0.2",
94
- "eslint-plugin-prefer-arrow": "~1.2.2",
95
- "eslint-plugin-react": "~7.22.0",
96
- "eslint-plugin-unicorn": "~26.0.1",
96
+ "eslint-plugin-react": "~7.28.0",
97
+ "eslint-plugin-unicorn": "~40.0.0",
97
98
  "mocha": "^8.4.0",
98
99
  "nyc": "^15.0.0",
99
100
  "rimraf": "^2.6.2",