@fluidframework/aqueduct 2.0.0-rc.2.0.1 → 2.0.0-rc.3.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (95) hide show
  1. package/.eslintrc.cjs +14 -0
  2. package/.mocharc.cjs +12 -0
  3. package/CHANGELOG.md +342 -0
  4. package/api-extractor-lint.json +4 -0
  5. package/api-extractor.json +4 -0
  6. package/api-report/aqueduct.api.md +165 -0
  7. package/dist/container-runtime-factories/baseContainerRuntimeFactory.d.ts +7 -7
  8. package/dist/container-runtime-factories/baseContainerRuntimeFactory.d.ts.map +1 -1
  9. package/dist/container-runtime-factories/baseContainerRuntimeFactory.js +9 -10
  10. package/dist/container-runtime-factories/baseContainerRuntimeFactory.js.map +1 -1
  11. package/dist/container-runtime-factories/containerRuntimeFactoryWithDefaultDataStore.d.ts +5 -5
  12. package/dist/container-runtime-factories/containerRuntimeFactoryWithDefaultDataStore.d.ts.map +1 -1
  13. package/dist/container-runtime-factories/containerRuntimeFactoryWithDefaultDataStore.js +2 -2
  14. package/dist/container-runtime-factories/containerRuntimeFactoryWithDefaultDataStore.js.map +1 -1
  15. package/dist/data-object-factories/dataObjectFactory.d.ts +4 -4
  16. package/dist/data-object-factories/dataObjectFactory.d.ts.map +1 -1
  17. package/dist/data-object-factories/dataObjectFactory.js +7 -7
  18. package/dist/data-object-factories/dataObjectFactory.js.map +1 -1
  19. package/dist/data-object-factories/pureDataObjectFactory.d.ts +5 -5
  20. package/dist/data-object-factories/pureDataObjectFactory.d.ts.map +1 -1
  21. package/dist/data-object-factories/pureDataObjectFactory.js +9 -9
  22. package/dist/data-object-factories/pureDataObjectFactory.js.map +1 -1
  23. package/dist/data-objects/dataObject.d.ts +1 -1
  24. package/dist/data-objects/dataObject.d.ts.map +1 -1
  25. package/dist/data-objects/dataObject.js +3 -3
  26. package/dist/data-objects/dataObject.js.map +1 -1
  27. package/dist/data-objects/pureDataObject.d.ts +2 -2
  28. package/dist/data-objects/pureDataObject.d.ts.map +1 -1
  29. package/dist/data-objects/pureDataObject.js +6 -6
  30. package/dist/data-objects/pureDataObject.js.map +1 -1
  31. package/dist/data-objects/types.d.ts +3 -3
  32. package/dist/data-objects/types.d.ts.map +1 -1
  33. package/dist/data-objects/types.js.map +1 -1
  34. package/dist/legacy.d.ts +23 -0
  35. package/dist/public.d.ts +12 -0
  36. package/internal.d.ts +11 -0
  37. package/legacy.d.ts +11 -0
  38. package/lib/container-runtime-factories/baseContainerRuntimeFactory.d.ts +7 -7
  39. package/lib/container-runtime-factories/baseContainerRuntimeFactory.d.ts.map +1 -1
  40. package/lib/container-runtime-factories/baseContainerRuntimeFactory.js +5 -4
  41. package/lib/container-runtime-factories/baseContainerRuntimeFactory.js.map +1 -1
  42. package/lib/container-runtime-factories/containerRuntimeFactoryWithDefaultDataStore.d.ts +5 -5
  43. package/lib/container-runtime-factories/containerRuntimeFactoryWithDefaultDataStore.d.ts.map +1 -1
  44. package/lib/container-runtime-factories/containerRuntimeFactoryWithDefaultDataStore.js +1 -1
  45. package/lib/container-runtime-factories/containerRuntimeFactoryWithDefaultDataStore.js.map +1 -1
  46. package/lib/data-object-factories/dataObjectFactory.d.ts +4 -4
  47. package/lib/data-object-factories/dataObjectFactory.d.ts.map +1 -1
  48. package/lib/data-object-factories/dataObjectFactory.js +2 -2
  49. package/lib/data-object-factories/dataObjectFactory.js.map +1 -1
  50. package/lib/data-object-factories/pureDataObjectFactory.d.ts +5 -5
  51. package/lib/data-object-factories/pureDataObjectFactory.d.ts.map +1 -1
  52. package/lib/data-object-factories/pureDataObjectFactory.js +3 -3
  53. package/lib/data-object-factories/pureDataObjectFactory.js.map +1 -1
  54. package/lib/data-objects/dataObject.d.ts +1 -1
  55. package/lib/data-objects/dataObject.d.ts.map +1 -1
  56. package/lib/data-objects/dataObject.js +1 -1
  57. package/lib/data-objects/dataObject.js.map +1 -1
  58. package/lib/data-objects/pureDataObject.d.ts +2 -2
  59. package/lib/data-objects/pureDataObject.d.ts.map +1 -1
  60. package/lib/data-objects/pureDataObject.js +2 -2
  61. package/lib/data-objects/pureDataObject.js.map +1 -1
  62. package/lib/data-objects/types.d.ts +3 -3
  63. package/lib/data-objects/types.d.ts.map +1 -1
  64. package/lib/data-objects/types.js.map +1 -1
  65. package/lib/legacy.d.ts +23 -0
  66. package/lib/public.d.ts +12 -0
  67. package/package.json +39 -64
  68. package/prettier.config.cjs +8 -0
  69. package/src/container-runtime-factories/baseContainerRuntimeFactory.ts +142 -0
  70. package/src/container-runtime-factories/containerRuntimeFactoryWithDefaultDataStore.ts +110 -0
  71. package/src/container-runtime-factories/index.ts +13 -0
  72. package/src/data-object-factories/dataObjectFactory.ts +61 -0
  73. package/src/data-object-factories/index.ts +7 -0
  74. package/src/data-object-factories/pureDataObjectFactory.ts +379 -0
  75. package/src/data-objects/dataObject.ts +78 -0
  76. package/src/data-objects/index.ts +8 -0
  77. package/src/data-objects/pureDataObject.ts +186 -0
  78. package/src/data-objects/types.ts +40 -0
  79. package/src/index.ts +33 -0
  80. package/tsconfig.cjs.json +7 -0
  81. package/tsconfig.json +9 -0
  82. package/dist/aqueduct-alpha.d.ts +0 -433
  83. package/dist/aqueduct-beta.d.ts +0 -110
  84. package/dist/aqueduct-public.d.ts +0 -110
  85. package/dist/aqueduct-untrimmed.d.ts +0 -433
  86. package/lib/aqueduct-alpha.d.ts +0 -433
  87. package/lib/aqueduct-beta.d.ts +0 -110
  88. package/lib/aqueduct-public.d.ts +0 -110
  89. package/lib/aqueduct-untrimmed.d.ts +0 -433
  90. package/lib/test/aqueduct.spec.js +0 -8
  91. package/lib/test/aqueduct.spec.js.map +0 -1
  92. package/lib/test/tsconfig.tsbuildinfo +0 -1
  93. package/lib/test/types/validateAqueductPrevious.generated.js +0 -24
  94. package/lib/test/types/validateAqueductPrevious.generated.js.map +0 -1
  95. /package/{dist → lib}/tsdoc-metadata.json +0 -0
@@ -1 +1 @@
1
- {"version":3,"file":"dataObject.js","sourceRoot":"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C,CAAC;IAC1C,CAAC;IAED;;;OAGG;IACO,2BAA2B,CAAC,IAAY;QACjD,OAAO,GAAG,IAAI,6CAA6C,CAAC;IAC7D,CAAC;CACD","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { type ISharedDirectory, MapFactory, SharedDirectory } from \"@fluidframework/map\";\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 * @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 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"]}
1
+ {"version":3,"file":"dataObject.js","sourceRoot":"","sources":["../../src/data-objects/dataObject.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAyB,UAAU,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAC;AAElG,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAGrD;;;;;;;;;;GAUG;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;YACvB,MAAM,IAAI,KAAK,CAAC,IAAI,CAAC,2BAA2B,CAAC,MAAM,CAAC,CAAC,CAAC;SAC1D;QAED,OAAO,IAAI,CAAC,YAAY,CAAC;IAC1B,CAAC;IAED;;;OAGG;IACI,KAAK,CAAC,kBAAkB,CAAC,QAAiB;QAChD,IAAI,QAAQ,EAAE;YACb,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;gBAC1D,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,IAAI,CAAC;oBACxB,QAAQ,EAAE,SAAS;oBACnB,SAAS,EAAE,eAAe;oBAC1B,OAAO,EACN,6EAA6E;iBAC9E,CAAC,CAAC;aACH;SACD;aAAM;YACN,+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;SAClC;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","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { type ISharedDirectory, MapFactory, SharedDirectory } from \"@fluidframework/map/internal\";\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 * @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 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"]}
@@ -5,8 +5,8 @@
5
5
  import { TypedEventEmitter } from "@fluid-internal/client-utils";
6
6
  import { type IEvent, type IFluidHandle, type IFluidLoadable, type IProvideFluidHandle, type IRequest, type IResponse } from "@fluidframework/core-interfaces";
7
7
  import { type IFluidDataStoreRuntime } from "@fluidframework/datastore-definitions";
8
- import { type IFluidDataStoreContext } from "@fluidframework/runtime-definitions";
9
- import { type AsyncFluidObjectProvider } from "@fluidframework/synthesize";
8
+ import { type IFluidDataStoreContext } from "@fluidframework/runtime-definitions/internal";
9
+ import { type AsyncFluidObjectProvider } from "@fluidframework/synthesize/internal";
10
10
  import { type DataObjectTypes, type IDataObjectProps } from "./types.js";
11
11
  /**
12
12
  * This is a bare-bones base class that does basic setup and enables for factory on an initialize call.
@@ -1 +1 @@
1
- {"version":3,"file":"pureDataObject.d.ts","sourceRoot":"","sources":["../../src/data-objects/pureDataObject.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,iBAAiB,EAAE,MAAM,8BAA8B,CAAC;AAEjE,OAAO,EACN,KAAK,MAAM,EACX,KAAK,YAAY,EACjB,KAAK,cAAc,EACnB,KAAK,mBAAmB,EACxB,KAAK,QAAQ,EACb,KAAK,SAAS,EACd,MAAM,iCAAiC,CAAC;AACzC,OAAO,EAAE,KAAK,sBAAsB,EAAE,MAAM,uCAAuC,CAAC;AACpF,OAAO,EAAE,KAAK,sBAAsB,EAAE,MAAM,qCAAqC,CAAC;AAClF,OAAO,EAAE,KAAK,wBAAwB,EAAE,MAAM,4BAA4B,CAAC;AAE3E,OAAO,EAAE,KAAK,eAAe,EAAE,KAAK,gBAAgB,EAAE,MAAM,YAAY,CAAC;AAEzE;;;;;;;GAOG;AACH,8BAAsB,cAAc,CAAC,CAAC,SAAS,eAAe,GAAG,eAAe,CAC/E,SAAQ,iBAAiB,CAAC,CAAC,CAAC,QAAQ,CAAC,GAAG,MAAM,CAC9C,YAAW,cAAc,EAAE,mBAAmB;IAE9C;;OAEG;IACH,SAAS,CAAC,QAAQ,CAAC,OAAO,EAAE,sBAAsB,CAAC;IAEnD;;OAEG;IACH,SAAS,CAAC,QAAQ,CAAC,OAAO,EAAE,sBAAsB,CAAC;IAEnD;;;;;;OAMG;IACH,SAAS,CAAC,QAAQ,CAAC,SAAS,EAAE,wBAAwB,CAAC,CAAC,CAAC,mBA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;gBAKxE,KAAK,EAAE,gBAAgB,CAAC,CAAC,CAAC;IAkB7C;;;;;;;OAOG;IACU,OAAO,CAAC,GAAG,EAAE,QAAQ,GAAG,OAAO,CAAC,SAAS,CAAC;IAMvD;;;;;;OAMG;IACU,oBAAoB,CAAC,QAAQ,EAAE,OAAO,GAAG,OAAO,CAAC,IAAI,CAAC;IAQnE;;;;;;OAMG;IACU,kBAAkB,CAAC,QAAQ,EAAE,OAAO,GAAG,OAAO,CAAC,IAAI,CAAC;IAgBjE;;;OAGG;cACa,aAAa,IAAI,OAAO,CAAC,IAAI,CAAC;IAE9C;;;;;OAKG;cACa,qBAAqB,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC,cAAc,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC;IAE/E;;;OAGG;cACa,wBAAwB,IAAI,OAAO,CAAC,IAAI,CAAC;IAEzD;;OAEG;cACa,cAAc,IAAI,OAAO,CAAC,IAAI,CAAC;CAC/C"}
@@ -3,8 +3,8 @@
3
3
  * Licensed under the MIT License.
4
4
  */
5
5
  import { TypedEventEmitter } from "@fluid-internal/client-utils";
6
- import { assert } from "@fluidframework/core-utils";
7
- import { create404Response } from "@fluidframework/runtime-utils";
6
+ import { assert } from "@fluidframework/core-utils/internal";
7
+ import { create404Response } from "@fluidframework/runtime-utils/internal";
8
8
  /**
9
9
  * This is a bare-bones base class that does basic setup and enables for factory on an initialize call.
10
10
  * You probably don't want to inherit from this data store directly unless
@@ -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,8BAA8B,CAAC;AACjE,OAAO,EAAE,MAAM,EAAE,MAAM,4BAA4B,CAAC;AAYpD,OAAO,EAAE,iBAAiB,EAAE,MAAM,+BAA+B,CAAC;AAGlE;;;;;;;GAOG;AACH,MAAM,OAAgB,cACrB,SAAQ,iBAAuC;I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G,IAAI,GAAG,CAAC,GAAG,CAAC,UAAU,CAAC,IAAI,CAAC;YACnE,CAAC,CAAC,EAAE,QAAQ,EAAE,cAAc,EAAE,MAAM,EAAE,GAAG,EAAE,KAAK,EAAE,IAAI,EAAE;YACxD,CAAC,CAAC,iBAAiB,CAAC,GAAG,CAAC,CAAC;IAC3B,CAAC;IAED;;;;;;OAMG;IACI,KAAK,CAAC,oBAAoB,CAAC,QAAiB;QAClD,IAAI,IAAI,CAAC,WAAW,KAAK,SAAS,EAAE;YACnC,OAAO,IAAI,CAAC,WAAW,CAAC;SACxB;QACD,IAAI,CAAC,WAAW,GAAG,IAAI,CAAC,kBAAkB,CAAC,QAAQ,CAAC,CAAC;QACrD,OAAO,IAAI,CAAC,WAAW,CAAC;IACzB,CAAC;IAED;;;;;;OAMG;IACI,KAAK,CAAC,kBAAkB,CAAC,QAAiB;QAChD,MAAM,IAAI,CAAC,aAAa,EAAE,CAAC;QAC3B,IAAI,QAAQ,EAAE;YACb,MAAM,CACL,IAAI,CAAC,SAAS,KAAK,SAAS,EAC5B,KAAK,CAAC,kEAAkE,CACxE,CAAC;YACF,MAAM,IAAI,CAAC,wBAAwB,EAAE,CAAC;SACtC;aAAM;YACN,MAAM,IAAI,CAAC,qBAAqB,CAC9B,IAAI,CAAC,OAAO,CAAC,WAAiC,IAAI,IAAI,CAAC,SAAS,CACjE,CAAC;SACF;QACD,MAAM,IAAI,CAAC,cAAc,EAAE,CAAC;IAC7B,CAAC;IAED;;;OAGG;IACO,KAAK,CAAC,aAAa,KAAmB,CAAC;IAEjD;;;;;OAKG;IACO,KAAK,CAAC,qBAAqB,CAAC,KAAyB,IAAkB,CAAC;IAElF;;;OAGG;IACO,KAAK,CAAC,wBAAwB,KAAmB,CAAC;IAE5D;;OAEG;IACO,KAAK,CAAC,cAAc,KAAmB,CAAC;CAClD","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { TypedEventEmitter } from \"@fluid-internal/client-utils\";\nimport { assert } from \"@fluidframework/core-utils\";\nimport {\n\ttype IEvent,\n\ttype IFluidHandle,\n\ttype IFluidLoadable,\n\ttype IProvideFluidHandle,\n\ttype IRequest,\n\ttype IResponse,\n} from \"@fluidframework/core-interfaces\";\nimport { type IFluidDataStoreRuntime } from \"@fluidframework/datastore-definitions\";\nimport { type IFluidDataStoreContext } from \"@fluidframework/runtime-definitions\";\nimport { type AsyncFluidObjectProvider } from \"@fluidframework/synthesize\";\nimport { create404Response } from \"@fluidframework/runtime-utils\";\nimport { type DataObjectTypes, type IDataObjectProps } from \"./types.js\";\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 * @alpha\n */\nexport abstract class PureDataObject<I extends DataObjectTypes = DataObjectTypes>\n\textends TypedEventEmitter<I[\"Events\"] & IEvent>\n\timplements IFluidLoadable, IProvideFluidHandle\n{\n\t/**\n\t * This is your FluidDataStoreRuntime object\n\t */\n\tprotected readonly runtime: IFluidDataStoreRuntime;\n\n\t/**\n\t * This context is used to talk up to the ContainerRuntime\n\t */\n\tprotected readonly context: IFluidDataStoreContext;\n\n\t/**\n\t * Providers are FluidObject keyed objects that provide back\n\t * a promise to the corresponding FluidObject or undefined.\n\t * Providers injected/provided by the Container and/or HostingApplication\n\t *\n\t * To define providers set FluidObject interfaces in the OptionalProviders generic type for your data store\n\t */\n\tprotected readonly providers: AsyncFluidObjectProvider<I[\"OptionalProviders\"]>;\n\n\tprotected initProps?: I[\"InitialState\"];\n\n\tprotected initializeP: Promise<void> | undefined;\n\n\tpublic get id(): string {\n\t\treturn this.runtime.id;\n\t}\n\n\t/**\n\t * {@inheritDoc @fluidframework/core-interfaces#IProvideFluidLoadable.IFluidLoadable}\n\t */\n\tpublic get IFluidLoadable(): this {\n\t\treturn this;\n\t}\n\n\t/**\n\t * {@inheritDoc @fluidframework/core-interfaces#IProvideFluidHandle.IFluidHandle}\n\t */\n\tpublic get IFluidHandle(): IFluidHandle<this> {\n\t\treturn this.handle;\n\t}\n\n\t/**\n\t * Handle to a data store\n\t */\n\tpublic get handle(): IFluidHandle<this> {\n\t\t// PureDataObjectFactory already provides an entryPoint initialization function to the data store runtime,\n\t\t// so this object should always have access to a non-null entryPoint. Need to cast because PureDataObject\n\t\t// tried to be too smart with its typing for handles :).\n\t\tassert(this.runtime.entryPoint !== undefined, 0x46b /* EntryPoint was undefined */);\n\t\treturn this.runtime.entryPoint as IFluidHandle<this>;\n\t}\n\n\tpublic static async getDataObject(runtime: IFluidDataStoreRuntime): Promise<PureDataObject> {\n\t\tconst obj = await runtime.entryPoint.get();\n\t\treturn obj as PureDataObject;\n\t}\n\n\tpublic constructor(props: IDataObjectProps<I>) {\n\t\tsuper();\n\t\tthis.runtime = props.runtime;\n\t\tthis.context = props.context;\n\t\tthis.providers = props.providers;\n\t\tthis.initProps = props.initProps;\n\n\t\t/* eslint-disable @typescript-eslint/no-unsafe-member-access */\n\t\t/* eslint-disable @typescript-eslint/no-explicit-any */\n\t\tassert(\n\t\t\t(this.runtime as any)._dataObject === undefined,\n\t\t\t0x0bd /* \"Object runtime already has DataObject!\" */,\n\t\t);\n\t\t(this.runtime as any)._dataObject = this;\n\t\t/* eslint-enable @typescript-eslint/no-explicit-any */\n\t\t/* eslint-enable @typescript-eslint/no-unsafe-member-access */\n\t}\n\n\t/**\n\t * Return this object if someone requests it directly\n\t * We will return this object in two scenarios:\n\t *\n\t * 1. the request url is a \"/\"\n\t *\n\t * 2. the request url is empty\n\t */\n\tpublic async request(req: IRequest): Promise<IResponse> {\n\t\treturn req.url === \"\" || req.url === \"/\" || req.url.startsWith(\"/?\")\n\t\t\t? { mimeType: \"fluid/object\", status: 200, value: this }\n\t\t\t: create404Response(req);\n\t}\n\n\t/**\n\t * Call this API to ensure PureDataObject is fully initialized.\n\t * Initialization happens on demand, only on as-needed bases.\n\t * In most cases you should allow factory/object to decide when to finish initialization.\n\t * But if you are supplying your own implementation of DataStoreRuntime factory and overriding some methods\n\t * and need a fully initialized object, then you can call this API to ensure object is fully initialized.\n\t */\n\tpublic async finishInitialization(existing: boolean): Promise<void> {\n\t\tif (this.initializeP !== undefined) {\n\t\t\treturn this.initializeP;\n\t\t}\n\t\tthis.initializeP = this.initializeInternal(existing);\n\t\treturn this.initializeP;\n\t}\n\n\t/**\n\t * Internal initialize implementation. Overwriting this will change the flow of the PureDataObject and should\n\t * generally not be done.\n\t *\n\t * Calls initializingFirstTime, initializingFromExisting, and hasInitialized. Caller is\n\t * responsible for ensuring this is only invoked once.\n\t */\n\tpublic async initializeInternal(existing: boolean): Promise<void> {\n\t\tawait this.preInitialize();\n\t\tif (existing) {\n\t\t\tassert(\n\t\t\t\tthis.initProps === undefined,\n\t\t\t\t0x0be /* \"Trying to initialize from existing while initProps is set!\" */,\n\t\t\t);\n\t\t\tawait this.initializingFromExisting();\n\t\t} else {\n\t\t\tawait this.initializingFirstTime(\n\t\t\t\t(this.context.createProps as I[\"InitialState\"]) ?? this.initProps,\n\t\t\t);\n\t\t}\n\t\tawait this.hasInitialized();\n\t}\n\n\t/**\n\t * Called every time the data store is initialized, before initializingFirstTime or\n\t * initializingFromExisting is called.\n\t */\n\tprotected async preInitialize(): Promise<void> {}\n\n\t/**\n\t * Called the first time the data store is initialized (new creations with a new\n\t * data store runtime)\n\t *\n\t * @param props - Optional props to be passed in on create\n\t */\n\tprotected async initializingFirstTime(props?: I[\"InitialState\"]): Promise<void> {}\n\n\t/**\n\t * Called every time but the first time the data store is initialized (creations\n\t * with an existing data store runtime)\n\t */\n\tprotected async initializingFromExisting(): Promise<void> {}\n\n\t/**\n\t * Called every time the data store is initialized after create or existing.\n\t */\n\tprotected async hasInitialized(): Promise<void> {}\n}\n"]}
1
+ {"version":3,"file":"pureDataObject.js","sourceRoot":"","sources":["../../src/data-objects/pureDataObject.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAA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AAkB,CAAC;IAElF;;;OAGG;IACO,KAAK,CAAC,wBAAwB,KAAmB,CAAC;IAE5D;;OAEG;IACO,KAAK,CAAC,cAAc,KAAmB,CAAC;CAClD","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { TypedEventEmitter } from \"@fluid-internal/client-utils\";\nimport {\n\ttype IEvent,\n\ttype IFluidHandle,\n\ttype IFluidLoadable,\n\ttype IProvideFluidHandle,\n\ttype IRequest,\n\ttype IResponse,\n} from \"@fluidframework/core-interfaces\";\nimport { assert } from \"@fluidframework/core-utils/internal\";\nimport { type IFluidDataStoreRuntime } from \"@fluidframework/datastore-definitions\";\nimport { type IFluidDataStoreContext } from \"@fluidframework/runtime-definitions/internal\";\nimport { create404Response } from \"@fluidframework/runtime-utils/internal\";\nimport { type AsyncFluidObjectProvider } from \"@fluidframework/synthesize/internal\";\n\nimport { type DataObjectTypes, type IDataObjectProps } from \"./types.js\";\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 * @alpha\n */\nexport abstract class PureDataObject<I extends DataObjectTypes = DataObjectTypes>\n\textends TypedEventEmitter<I[\"Events\"] & IEvent>\n\timplements IFluidLoadable, IProvideFluidHandle\n{\n\t/**\n\t * This is your FluidDataStoreRuntime object\n\t */\n\tprotected readonly runtime: IFluidDataStoreRuntime;\n\n\t/**\n\t * This context is used to talk up to the ContainerRuntime\n\t */\n\tprotected readonly context: IFluidDataStoreContext;\n\n\t/**\n\t * Providers are FluidObject keyed objects that provide back\n\t * a promise to the corresponding FluidObject or undefined.\n\t * Providers injected/provided by the Container and/or HostingApplication\n\t *\n\t * To define providers set FluidObject interfaces in the OptionalProviders generic type for your data store\n\t */\n\tprotected readonly providers: AsyncFluidObjectProvider<I[\"OptionalProviders\"]>;\n\n\tprotected initProps?: I[\"InitialState\"];\n\n\tprotected initializeP: Promise<void> | undefined;\n\n\tpublic get id(): string {\n\t\treturn this.runtime.id;\n\t}\n\n\t/**\n\t * {@inheritDoc @fluidframework/core-interfaces#IProvideFluidLoadable.IFluidLoadable}\n\t */\n\tpublic get IFluidLoadable(): this {\n\t\treturn this;\n\t}\n\n\t/**\n\t * {@inheritDoc @fluidframework/core-interfaces#IProvideFluidHandle.IFluidHandle}\n\t */\n\tpublic get IFluidHandle(): IFluidHandle<this> {\n\t\treturn this.handle;\n\t}\n\n\t/**\n\t * Handle to a data store\n\t */\n\tpublic get handle(): IFluidHandle<this> {\n\t\t// PureDataObjectFactory already provides an entryPoint initialization function to the data store runtime,\n\t\t// so this object should always have access to a non-null entryPoint. Need to cast because PureDataObject\n\t\t// tried to be too smart with its typing for handles :).\n\t\tassert(this.runtime.entryPoint !== undefined, 0x46b /* EntryPoint was undefined */);\n\t\treturn this.runtime.entryPoint as IFluidHandle<this>;\n\t}\n\n\tpublic static async getDataObject(runtime: IFluidDataStoreRuntime): Promise<PureDataObject> {\n\t\tconst obj = await runtime.entryPoint.get();\n\t\treturn obj as PureDataObject;\n\t}\n\n\tpublic constructor(props: IDataObjectProps<I>) {\n\t\tsuper();\n\t\tthis.runtime = props.runtime;\n\t\tthis.context = props.context;\n\t\tthis.providers = props.providers;\n\t\tthis.initProps = props.initProps;\n\n\t\t/* eslint-disable @typescript-eslint/no-unsafe-member-access */\n\t\t/* eslint-disable @typescript-eslint/no-explicit-any */\n\t\tassert(\n\t\t\t(this.runtime as any)._dataObject === undefined,\n\t\t\t0x0bd /* \"Object runtime already has DataObject!\" */,\n\t\t);\n\t\t(this.runtime as any)._dataObject = this;\n\t\t/* eslint-enable @typescript-eslint/no-explicit-any */\n\t\t/* eslint-enable @typescript-eslint/no-unsafe-member-access */\n\t}\n\n\t/**\n\t * Return this object if someone requests it directly\n\t * We will return this object in two scenarios:\n\t *\n\t * 1. the request url is a \"/\"\n\t *\n\t * 2. the request url is empty\n\t */\n\tpublic async request(req: IRequest): Promise<IResponse> {\n\t\treturn req.url === \"\" || req.url === \"/\" || req.url.startsWith(\"/?\")\n\t\t\t? { mimeType: \"fluid/object\", status: 200, value: this }\n\t\t\t: create404Response(req);\n\t}\n\n\t/**\n\t * Call this API to ensure PureDataObject is fully initialized.\n\t * Initialization happens on demand, only on as-needed bases.\n\t * In most cases you should allow factory/object to decide when to finish initialization.\n\t * But if you are supplying your own implementation of DataStoreRuntime factory and overriding some methods\n\t * and need a fully initialized object, then you can call this API to ensure object is fully initialized.\n\t */\n\tpublic async finishInitialization(existing: boolean): Promise<void> {\n\t\tif (this.initializeP !== undefined) {\n\t\t\treturn this.initializeP;\n\t\t}\n\t\tthis.initializeP = this.initializeInternal(existing);\n\t\treturn this.initializeP;\n\t}\n\n\t/**\n\t * Internal initialize implementation. Overwriting this will change the flow of the PureDataObject and should\n\t * generally not be done.\n\t *\n\t * Calls initializingFirstTime, initializingFromExisting, and hasInitialized. Caller is\n\t * responsible for ensuring this is only invoked once.\n\t */\n\tpublic async initializeInternal(existing: boolean): Promise<void> {\n\t\tawait this.preInitialize();\n\t\tif (existing) {\n\t\t\tassert(\n\t\t\t\tthis.initProps === undefined,\n\t\t\t\t0x0be /* \"Trying to initialize from existing while initProps is set!\" */,\n\t\t\t);\n\t\t\tawait this.initializingFromExisting();\n\t\t} else {\n\t\t\tawait this.initializingFirstTime(\n\t\t\t\t(this.context.createProps as I[\"InitialState\"]) ?? this.initProps,\n\t\t\t);\n\t\t}\n\t\tawait this.hasInitialized();\n\t}\n\n\t/**\n\t * Called every time the data store is initialized, before initializingFirstTime or\n\t * initializingFromExisting is called.\n\t */\n\tprotected async preInitialize(): Promise<void> {}\n\n\t/**\n\t * Called the first time the data store is initialized (new creations with a new\n\t * data store runtime)\n\t *\n\t * @param props - Optional props to be passed in on create\n\t */\n\tprotected async initializingFirstTime(props?: I[\"InitialState\"]): Promise<void> {}\n\n\t/**\n\t * Called every time but the first time the data store is initialized (creations\n\t * with an existing data store runtime)\n\t */\n\tprotected async initializingFromExisting(): Promise<void> {}\n\n\t/**\n\t * Called every time the data store is initialized after create or existing.\n\t */\n\tprotected async hasInitialized(): Promise<void> {}\n}\n"]}
@@ -2,10 +2,10 @@
2
2
  * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
3
3
  * Licensed under the MIT License.
4
4
  */
5
- import { type IEvent, type FluidObject } from "@fluidframework/core-interfaces";
6
- import { type AsyncFluidObjectProvider } from "@fluidframework/synthesize";
7
- import { type IFluidDataStoreContext } from "@fluidframework/runtime-definitions";
5
+ import { type FluidObject, type IEvent } from "@fluidframework/core-interfaces";
8
6
  import { type IFluidDataStoreRuntime } from "@fluidframework/datastore-definitions";
7
+ import { type IFluidDataStoreContext } from "@fluidframework/runtime-definitions/internal";
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.
11
11
  * @alpha
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/data-objects/types.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,KAAK,MAAM,EAAE,KAAK,WAAW,EAAE,MAAM,iCAAiC,CAAC;AAChF,OAAO,EAAE,KAAK,wBAAwB,EAAE,MAAM,4BAA4B,CAAC;AAC3E,OAAO,EAAE,KAAK,sBAAsB,EAAE,MAAM,qCAAqC,CAAC;AAClF,OAAO,EAAE,KAAK,sBAAsB,EAAE,MAAM,uCAAuC,CAAC;AAEpF;;;GAGG;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;;GAEG;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,EAAE,KAAK,WAAW,EAAE,KAAK,MAAM,EAAE,MAAM,iCAAiC,CAAC;AAChF,OAAO,EAAE,KAAK,sBAAsB,EAAE,MAAM,uCAAuC,CAAC;AACpF,OAAO,EAAE,KAAK,sBAAsB,EAAE,MAAM,8CAA8C,CAAC;AAC3F,OAAO,EAAE,KAAK,wBAAwB,EAAE,MAAM,qCAAqC,CAAC;AAEpF;;;GAGG;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;;GAEG;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 +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 IEvent, type FluidObject } from \"@fluidframework/core-interfaces\";\nimport { type AsyncFluidObjectProvider } from \"@fluidframework/synthesize\";\nimport { type IFluidDataStoreContext } from \"@fluidframework/runtime-definitions\";\nimport { type IFluidDataStoreRuntime } from \"@fluidframework/datastore-definitions\";\n\n/**\n * This type is used as the base generic input to DataObject and PureDataObject.\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 * @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, type IEvent } from \"@fluidframework/core-interfaces\";\nimport { type IFluidDataStoreRuntime } from \"@fluidframework/datastore-definitions\";\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 * @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 * @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"]}
@@ -0,0 +1,23 @@
1
+ /*!
2
+ * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
3
+ * Licensed under the MIT License.
4
+ */
5
+
6
+ /*
7
+ * THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.
8
+ * Generated by "flub generate entrypoints" in @fluidframework/build-tools.
9
+ */
10
+
11
+ export {
12
+ // alpha APIs
13
+ BaseContainerRuntimeFactory,
14
+ BaseContainerRuntimeFactoryProps,
15
+ ContainerRuntimeFactoryWithDefaultDataStore,
16
+ ContainerRuntimeFactoryWithDefaultDataStoreProps,
17
+ DataObject,
18
+ DataObjectFactory,
19
+ DataObjectTypes,
20
+ IDataObjectProps,
21
+ PureDataObject,
22
+ PureDataObjectFactory
23
+ } from "./index.js";
@@ -0,0 +1,12 @@
1
+ /*!
2
+ * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
3
+ * Licensed under the MIT License.
4
+ */
5
+
6
+ /*
7
+ * THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.
8
+ * Generated by "flub generate entrypoints" in @fluidframework/build-tools.
9
+ */
10
+
11
+ export {}
12
+
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fluidframework/aqueduct",
3
- "version": "2.0.0-rc.2.0.1",
3
+ "version": "2.0.0-rc.3.0.0",
4
4
  "description": "A set of implementations for Fluid Framework interfaces.",
5
5
  "homepage": "https://fluidframework.com",
6
6
  "repository": {
@@ -15,31 +15,21 @@
15
15
  "exports": {
16
16
  ".": {
17
17
  "import": {
18
- "types": "./lib/index.d.ts",
18
+ "types": "./lib/public.d.ts",
19
19
  "default": "./lib/index.js"
20
20
  },
21
21
  "require": {
22
- "types": "./dist/index.d.ts",
22
+ "types": "./dist/public.d.ts",
23
23
  "default": "./dist/index.js"
24
24
  }
25
25
  },
26
- "./public": {
26
+ "./legacy": {
27
27
  "import": {
28
- "types": "./lib/aqueduct-public.d.ts",
28
+ "types": "./lib/legacy.d.ts",
29
29
  "default": "./lib/index.js"
30
30
  },
31
31
  "require": {
32
- "types": "./dist/aqueduct-public.d.ts",
33
- "default": "./dist/index.js"
34
- }
35
- },
36
- "./alpha": {
37
- "import": {
38
- "types": "./lib/aqueduct-alpha.d.ts",
39
- "default": "./lib/index.js"
40
- },
41
- "require": {
42
- "types": "./dist/aqueduct-alpha.d.ts",
32
+ "types": "./dist/legacy.d.ts",
43
33
  "default": "./dist/index.js"
44
34
  }
45
35
  },
@@ -54,13 +44,8 @@
54
44
  }
55
45
  }
56
46
  },
57
- "main": "dist/index.js",
58
- "types": "dist/index.d.ts",
59
- "files": [
60
- "dist/**/*",
61
- "!dist/test/**",
62
- "lib/**/*"
63
- ],
47
+ "main": "lib/index.js",
48
+ "types": "lib/public.d.ts",
64
49
  "c8": {
65
50
  "all": true,
66
51
  "cache-dir": "nyc/.cache",
@@ -82,28 +67,29 @@
82
67
  "temp-directory": "nyc/.nyc_output"
83
68
  },
84
69
  "dependencies": {
85
- "@fluid-internal/client-utils": ">=2.0.0-rc.2.0.1 <2.0.0-rc.2.1.0",
86
- "@fluidframework/container-definitions": ">=2.0.0-rc.2.0.1 <2.0.0-rc.2.1.0",
87
- "@fluidframework/container-runtime": ">=2.0.0-rc.2.0.1 <2.0.0-rc.2.1.0",
88
- "@fluidframework/container-runtime-definitions": ">=2.0.0-rc.2.0.1 <2.0.0-rc.2.1.0",
89
- "@fluidframework/core-interfaces": ">=2.0.0-rc.2.0.1 <2.0.0-rc.2.1.0",
90
- "@fluidframework/core-utils": ">=2.0.0-rc.2.0.1 <2.0.0-rc.2.1.0",
91
- "@fluidframework/datastore": ">=2.0.0-rc.2.0.1 <2.0.0-rc.2.1.0",
92
- "@fluidframework/datastore-definitions": ">=2.0.0-rc.2.0.1 <2.0.0-rc.2.1.0",
93
- "@fluidframework/map": ">=2.0.0-rc.2.0.1 <2.0.0-rc.2.1.0",
94
- "@fluidframework/request-handler": ">=2.0.0-rc.2.0.1 <2.0.0-rc.2.1.0",
95
- "@fluidframework/runtime-definitions": ">=2.0.0-rc.2.0.1 <2.0.0-rc.2.1.0",
96
- "@fluidframework/runtime-utils": ">=2.0.0-rc.2.0.1 <2.0.0-rc.2.1.0",
97
- "@fluidframework/synthesize": ">=2.0.0-rc.2.0.1 <2.0.0-rc.2.1.0"
70
+ "@fluid-internal/client-utils": ">=2.0.0-rc.3.0.0 <2.0.0-rc.3.1.0",
71
+ "@fluidframework/container-definitions": ">=2.0.0-rc.3.0.0 <2.0.0-rc.3.1.0",
72
+ "@fluidframework/container-runtime": ">=2.0.0-rc.3.0.0 <2.0.0-rc.3.1.0",
73
+ "@fluidframework/container-runtime-definitions": ">=2.0.0-rc.3.0.0 <2.0.0-rc.3.1.0",
74
+ "@fluidframework/core-interfaces": ">=2.0.0-rc.3.0.0 <2.0.0-rc.3.1.0",
75
+ "@fluidframework/core-utils": ">=2.0.0-rc.3.0.0 <2.0.0-rc.3.1.0",
76
+ "@fluidframework/datastore": ">=2.0.0-rc.3.0.0 <2.0.0-rc.3.1.0",
77
+ "@fluidframework/datastore-definitions": ">=2.0.0-rc.3.0.0 <2.0.0-rc.3.1.0",
78
+ "@fluidframework/map": ">=2.0.0-rc.3.0.0 <2.0.0-rc.3.1.0",
79
+ "@fluidframework/request-handler": ">=2.0.0-rc.3.0.0 <2.0.0-rc.3.1.0",
80
+ "@fluidframework/runtime-definitions": ">=2.0.0-rc.3.0.0 <2.0.0-rc.3.1.0",
81
+ "@fluidframework/runtime-utils": ">=2.0.0-rc.3.0.0 <2.0.0-rc.3.1.0",
82
+ "@fluidframework/synthesize": ">=2.0.0-rc.3.0.0 <2.0.0-rc.3.1.0"
98
83
  },
99
84
  "devDependencies": {
100
- "@arethetypeswrong/cli": "^0.13.3",
101
- "@fluid-internal/mocha-test-setup": ">=2.0.0-rc.2.0.1 <2.0.0-rc.2.1.0",
102
- "@fluid-tools/build-cli": "^0.34.0",
85
+ "@arethetypeswrong/cli": "^0.15.2",
86
+ "@biomejs/biome": "^1.6.2",
87
+ "@fluid-internal/mocha-test-setup": ">=2.0.0-rc.3.0.0 <2.0.0-rc.3.1.0",
88
+ "@fluid-tools/build-cli": "^0.37.0",
103
89
  "@fluidframework/aqueduct-previous": "npm:@fluidframework/aqueduct@2.0.0-internal.8.0.0",
104
90
  "@fluidframework/build-common": "^2.0.3",
105
- "@fluidframework/build-tools": "^0.34.0",
106
- "@fluidframework/eslint-config-fluid": "^4.0.0",
91
+ "@fluidframework/build-tools": "^0.37.0",
92
+ "@fluidframework/eslint-config-fluid": "^5.1.0",
107
93
  "@microsoft/api-extractor": "^7.42.3",
108
94
  "@types/mocha": "^9.1.1",
109
95
  "@types/node": "^18.19.0",
@@ -119,18 +105,6 @@
119
105
  "rimraf": "^4.4.0",
120
106
  "typescript": "~5.1.6"
121
107
  },
122
- "fluidBuild": {
123
- "tasks": {
124
- "build:docs": {
125
- "dependsOn": [
126
- "...",
127
- "api-extractor:commonjs",
128
- "api-extractor:esnext"
129
- ],
130
- "script": false
131
- }
132
- }
133
- },
134
108
  "typeValidation": {
135
109
  "broken": {
136
110
  "ClassDeclaration_DataObjectFactory": {
@@ -140,33 +114,34 @@
140
114
  "forwardCompat": false
141
115
  },
142
116
  "InterfaceDeclaration_IDataObjectProps": {
143
- "forwardCompat": false
117
+ "forwardCompat": false,
118
+ "backCompat": false
144
119
  }
145
120
  }
146
121
  },
147
122
  "scripts": {
148
123
  "api": "fluid-build . --task api",
149
- "api-extractor:commonjs": "api-extractor run --config ./api-extractor-cjs.json",
150
- "api-extractor:esnext": "api-extractor run --local",
124
+ "api-extractor:commonjs": "flub generate entrypoints --outFileAlpha legacy --outDir ./dist",
125
+ "api-extractor:esnext": "flub generate entrypoints --outFileAlpha legacy --outDir ./lib --node10TypeCompat",
151
126
  "build": "fluid-build . --task build",
152
127
  "build:commonjs": "fluid-build . --task commonjs",
153
128
  "build:compile": "fluid-build . --task compile",
154
- "build:docs": "fluid-build . --task api",
129
+ "build:docs": "api-extractor run --local",
155
130
  "build:esnext": "tsc --project ./tsconfig.json",
156
131
  "build:test": "npm run build:test:esm && npm run build:test:cjs",
157
132
  "build:test:cjs": "fluid-tsc commonjs --project ./src/test/tsconfig.cjs.json",
158
133
  "build:test:esm": "tsc --project ./src/test/tsconfig.json",
159
- "check:are-the-types-wrong": "attw --pack . --entrypoints .",
134
+ "check:are-the-types-wrong": "attw --pack .",
135
+ "check:prettier": "prettier --check . --cache --ignore-path ../../../.prettierignore",
160
136
  "check:release-tags": "api-extractor run --local --config ./api-extractor-lint.json",
161
137
  "ci:build:docs": "api-extractor run",
162
- "clean": "rimraf --glob dist lib \"**/*.tsbuildinfo\" \"**/*.build.log\" _api-extractor-temp nyc",
138
+ "clean": "rimraf --glob dist lib \"*.d.ts\" \"**/*.tsbuildinfo\" \"**/*.build.log\" _api-extractor-temp nyc",
163
139
  "eslint": "eslint --format stylish src",
164
140
  "eslint:fix": "eslint --format stylish src --fix --fix-type problem,suggestion,layout",
165
- "format": "npm run prettier:fix",
166
- "lint": "npm run prettier && npm run check:release-tags && npm run eslint",
167
- "lint:fix": "npm run prettier:fix && npm run eslint:fix",
168
- "prettier": "prettier --check . --cache --ignore-path ../../../.prettierignore",
169
- "prettier:fix": "prettier --write . --cache --ignore-path ../../../.prettierignore",
141
+ "format": "fluid-build --task format .",
142
+ "format:prettier": "prettier --write . --cache --ignore-path ../../../.prettierignore",
143
+ "lint": "fluid-build . --task lint",
144
+ "lint:fix": "fluid-build . --task eslint:fix --task format",
170
145
  "test": "npm run test:mocha",
171
146
  "test:coverage": "c8 npm test",
172
147
  "test:mocha": "npm run test:mocha:esm && echo skipping cjs to avoid overhead - npm run test:mocha:cjs",
@@ -0,0 +1,8 @@
1
+ /*!
2
+ * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
3
+ * Licensed under the MIT License.
4
+ */
5
+
6
+ module.exports = {
7
+ ...require("@fluidframework/build-common/prettier.config.cjs"),
8
+ };
@@ -0,0 +1,142 @@
1
+ /*!
2
+ * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
3
+ * Licensed under the MIT License.
4
+ */
5
+
6
+ import { type IContainerContext } from "@fluidframework/container-definitions/internal";
7
+ import {
8
+ ContainerRuntime,
9
+ FluidDataStoreRegistry,
10
+ type IContainerRuntimeOptions,
11
+ } from "@fluidframework/container-runtime/internal";
12
+ import { type IContainerRuntime } from "@fluidframework/container-runtime-definitions/internal";
13
+ import { type FluidObject } from "@fluidframework/core-interfaces";
14
+ import {
15
+ type RuntimeRequestHandler,
16
+ // eslint-disable-next-line import/no-deprecated
17
+ buildRuntimeRequestHandler,
18
+ } from "@fluidframework/request-handler/internal";
19
+ import {
20
+ type IFluidDataStoreRegistry,
21
+ type IProvideFluidDataStoreRegistry,
22
+ type NamedFluidDataStoreRegistryEntries,
23
+ } from "@fluidframework/runtime-definitions/internal";
24
+ import { RuntimeFactoryHelper } from "@fluidframework/runtime-utils/internal";
25
+ import {
26
+ DependencyContainer,
27
+ type IFluidDependencySynthesizer,
28
+ type IProvideFluidDependencySynthesizer,
29
+ } from "@fluidframework/synthesize/internal";
30
+
31
+ /**
32
+ * {@link BaseContainerRuntimeFactory} construction properties.
33
+ * @alpha
34
+ */
35
+ export interface BaseContainerRuntimeFactoryProps {
36
+ /**
37
+ * The data store registry for containers produced.
38
+ */
39
+ registryEntries: NamedFluidDataStoreRegistryEntries;
40
+ /**
41
+ * @deprecated Will be removed in a future release.
42
+ */
43
+ dependencyContainer?: IFluidDependencySynthesizer;
44
+ /**
45
+ * Request handlers for containers produced.
46
+ * @deprecated Will be removed once Loader LTS version is "2.0.0-internal.7.0.0". Migrate all usage of IFluidRouter to the "entryPoint" pattern. Refer to Removing-IFluidRouter.md
47
+ */
48
+ requestHandlers?: RuntimeRequestHandler[];
49
+ /**
50
+ * The runtime options passed to the ContainerRuntime when instantiating it
51
+ */
52
+ runtimeOptions?: IContainerRuntimeOptions;
53
+ /**
54
+ * Function that will initialize the entryPoint of the ContainerRuntime instances
55
+ * created with this factory
56
+ */
57
+ provideEntryPoint: (runtime: IContainerRuntime) => Promise<FluidObject>;
58
+ }
59
+
60
+ /**
61
+ * BaseContainerRuntimeFactory produces container runtimes with the specified data store and service registries,
62
+ * request handlers, runtimeOptions, and entryPoint initialization function.
63
+ * It can be subclassed to implement a first-time initialization procedure for the containers it creates.
64
+ * @alpha
65
+ */
66
+ export class BaseContainerRuntimeFactory
67
+ extends RuntimeFactoryHelper
68
+ implements IProvideFluidDataStoreRegistry
69
+ {
70
+ /**
71
+ * {@inheritDoc @fluidframework/runtime-definitions#IProvideFluidDataStoreRegistry.IFluidDataStoreRegistry}
72
+ */
73
+ public get IFluidDataStoreRegistry(): IFluidDataStoreRegistry {
74
+ return this.registry;
75
+ }
76
+ private readonly registry: IFluidDataStoreRegistry;
77
+
78
+ private readonly registryEntries: NamedFluidDataStoreRegistryEntries;
79
+ private readonly dependencyContainer?: IFluidDependencySynthesizer;
80
+ private readonly runtimeOptions?: IContainerRuntimeOptions;
81
+ private readonly requestHandlers: RuntimeRequestHandler[];
82
+ private readonly provideEntryPoint: (runtime: IContainerRuntime) => Promise<FluidObject>;
83
+
84
+ public constructor(props: BaseContainerRuntimeFactoryProps) {
85
+ super();
86
+
87
+ this.registryEntries = props.registryEntries;
88
+ this.dependencyContainer = props.dependencyContainer;
89
+ this.runtimeOptions = props.runtimeOptions;
90
+ this.provideEntryPoint = props.provideEntryPoint;
91
+ this.requestHandlers = props.requestHandlers ?? [];
92
+ this.registry = new FluidDataStoreRegistry(this.registryEntries);
93
+ }
94
+
95
+ public async instantiateFirstTime(runtime: ContainerRuntime): Promise<void> {
96
+ await this.containerInitializingFirstTime(runtime);
97
+ await this.containerHasInitialized(runtime);
98
+ }
99
+
100
+ public async instantiateFromExisting(runtime: ContainerRuntime): Promise<void> {
101
+ await this.containerHasInitialized(runtime);
102
+ }
103
+
104
+ public async preInitialize(
105
+ context: IContainerContext,
106
+ existing: boolean,
107
+ ): Promise<ContainerRuntime> {
108
+ const scope: Partial<IProvideFluidDependencySynthesizer> = context.scope;
109
+ if (this.dependencyContainer) {
110
+ const dc = new DependencyContainer<FluidObject>(
111
+ this.dependencyContainer,
112
+ scope.IFluidDependencySynthesizer,
113
+ );
114
+ scope.IFluidDependencySynthesizer = dc;
115
+ }
116
+
117
+ return ContainerRuntime.loadRuntime({
118
+ context,
119
+ existing,
120
+ runtimeOptions: this.runtimeOptions,
121
+ registryEntries: this.registryEntries,
122
+ containerScope: scope,
123
+ // eslint-disable-next-line import/no-deprecated
124
+ requestHandler: buildRuntimeRequestHandler(...this.requestHandlers),
125
+ provideEntryPoint: this.provideEntryPoint,
126
+ });
127
+ }
128
+
129
+ /**
130
+ * Subclasses may override containerInitializingFirstTime to perform any setup steps at the time the container
131
+ * is created. This likely includes creating any initial data stores that are expected to be there at the outset.
132
+ * @param runtime - The container runtime for the container being initialized
133
+ */
134
+ protected async containerInitializingFirstTime(runtime: IContainerRuntime): Promise<void> {}
135
+
136
+ /**
137
+ * Subclasses may override containerHasInitialized to perform any steps after the container has initialized.
138
+ * This likely includes loading any data stores that are expected to be there at the outset.
139
+ * @param runtime - The container runtime for the container being initialized
140
+ */
141
+ protected async containerHasInitialized(runtime: IContainerRuntime): Promise<void> {}
142
+ }
@@ -0,0 +1,110 @@
1
+ /*!
2
+ * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
3
+ * Licensed under the MIT License.
4
+ */
5
+
6
+ import {
7
+ type ContainerRuntime,
8
+ type IContainerRuntimeOptions,
9
+ } from "@fluidframework/container-runtime/internal";
10
+ import { type IContainerRuntime } from "@fluidframework/container-runtime-definitions/internal";
11
+ import { type FluidObject, type IRequest, type IResponse } from "@fluidframework/core-interfaces";
12
+ import { type RuntimeRequestHandler } from "@fluidframework/request-handler/internal";
13
+ import {
14
+ type IFluidDataStoreFactory,
15
+ type NamedFluidDataStoreRegistryEntries,
16
+ } from "@fluidframework/runtime-definitions/internal";
17
+ import { RequestParser } from "@fluidframework/runtime-utils/internal";
18
+ import { type IFluidDependencySynthesizer } from "@fluidframework/synthesize/internal";
19
+
20
+ import { BaseContainerRuntimeFactory } from "./baseContainerRuntimeFactory.js";
21
+
22
+ const defaultDataStoreId = "default";
23
+
24
+ async function getDefaultFluidObject(runtime: IContainerRuntime): Promise<FluidObject> {
25
+ const entryPoint = await runtime.getAliasedDataStoreEntryPoint("default");
26
+ if (entryPoint === undefined) {
27
+ throw new Error("default dataStore must exist");
28
+ }
29
+ return entryPoint.get();
30
+ }
31
+
32
+ /**
33
+ * {@link ContainerRuntimeFactoryWithDefaultDataStore} construction properties.
34
+ * @alpha
35
+ */
36
+ export interface ContainerRuntimeFactoryWithDefaultDataStoreProps {
37
+ defaultFactory: IFluidDataStoreFactory;
38
+ /**
39
+ * The data store registry for containers produced.
40
+ */
41
+ registryEntries: NamedFluidDataStoreRegistryEntries;
42
+ /**
43
+ * @deprecated Will be removed in a future release.
44
+ */
45
+ dependencyContainer?: IFluidDependencySynthesizer;
46
+ /**
47
+ * Request handlers for containers produced.
48
+ * @deprecated Will be removed once Loader LTS version is "2.0.0-internal.7.0.0". Migrate all usage of IFluidRouter to the "entryPoint" pattern. Refer to Removing-IFluidRouter.md
49
+ */
50
+ requestHandlers?: RuntimeRequestHandler[];
51
+ /**
52
+ * The runtime options passed to the ContainerRuntime when instantiating it
53
+ */
54
+ runtimeOptions?: IContainerRuntimeOptions;
55
+ /**
56
+ * Function that will initialize the entryPoint of the ContainerRuntime instances
57
+ * created with this factory
58
+ */
59
+ provideEntryPoint?: (runtime: IContainerRuntime) => Promise<FluidObject>;
60
+ }
61
+
62
+ /**
63
+ * A ContainerRuntimeFactory that initializes Containers with a single default data store, which can be requested from
64
+ * the container with an empty URL.
65
+ *
66
+ * This factory should be exposed as fluidExport off the entry point to your module.
67
+ * @alpha
68
+ */
69
+ export class ContainerRuntimeFactoryWithDefaultDataStore extends BaseContainerRuntimeFactory {
70
+ public static readonly defaultDataStoreId = defaultDataStoreId;
71
+
72
+ protected readonly defaultFactory: IFluidDataStoreFactory;
73
+
74
+ public constructor(props: ContainerRuntimeFactoryWithDefaultDataStoreProps) {
75
+ const requestHandlers = props.requestHandlers ?? [];
76
+ const provideEntryPoint = props.provideEntryPoint ?? getDefaultFluidObject;
77
+
78
+ const getDefaultObject = async (
79
+ request: IRequest,
80
+ runtime: IContainerRuntime,
81
+ // eslint-disable-next-line unicorn/consistent-function-scoping
82
+ ): Promise<IResponse | undefined> => {
83
+ const parser = RequestParser.create(request);
84
+ if (parser.pathParts.length === 0) {
85
+ // This cast is safe as ContainerRuntime.loadRuntime is called in the base class
86
+ return (runtime as ContainerRuntime).resolveHandle({
87
+ url: `/${defaultDataStoreId}${parser.query}`,
88
+ headers: request.headers,
89
+ });
90
+ }
91
+ return undefined; // continue search
92
+ };
93
+
94
+ super({
95
+ ...props,
96
+ requestHandlers: [getDefaultObject, ...requestHandlers],
97
+ provideEntryPoint,
98
+ });
99
+
100
+ this.defaultFactory = props.defaultFactory;
101
+ }
102
+
103
+ /**
104
+ * {@inheritDoc BaseContainerRuntimeFactory.containerInitializingFirstTime}
105
+ */
106
+ protected async containerInitializingFirstTime(runtime: IContainerRuntime): Promise<void> {
107
+ const dataStore = await runtime.createDataStore(this.defaultFactory.type);
108
+ await dataStore.trySetAlias(defaultDataStoreId);
109
+ }
110
+ }
@@ -0,0 +1,13 @@
1
+ /*!
2
+ * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
3
+ * Licensed under the MIT License.
4
+ */
5
+
6
+ export {
7
+ BaseContainerRuntimeFactory,
8
+ type BaseContainerRuntimeFactoryProps,
9
+ } from "./baseContainerRuntimeFactory.js";
10
+ export {
11
+ ContainerRuntimeFactoryWithDefaultDataStore,
12
+ type ContainerRuntimeFactoryWithDefaultDataStoreProps,
13
+ } from "./containerRuntimeFactoryWithDefaultDataStore.js";