@fluidframework/datastore 2.0.0-internal.2.0.2 → 2.0.0-internal.2.1.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.
@@ -3,12 +3,17 @@
3
3
  * Licensed under the MIT License.
4
4
  */
5
5
  import { generateHandleContextPath } from "@fluidframework/runtime-utils";
6
+ /**
7
+ * Handle for a shared {@link @fluidframework/core-interfaces#FluidObject}.
8
+ */
6
9
  export class FluidObjectHandle {
7
10
  /**
8
- * Creates a new FluidObjectHandle.
9
- * @param value - The FluidObject object this handle is for.
10
- * @param path - The path to this handle relative to the routeContext.
11
- * @param routeContext - The parent IFluidHandleContext that has a route to this handle.
11
+ * Creates a new `FluidObjectHandle`.
12
+ *
13
+ * @param value - The {@link @fluidframework/core-interfaces#FluidObject} object this handle is for.
14
+ * @param path - The path to this handle relative to the `routeContext`.
15
+ * @param routeContext - The parent {@link @fluidframework/core-interfaces#IFluidHandleContext} that has a route
16
+ * to this handle.
12
17
  */
13
18
  constructor(value, path, routeContext) {
14
19
  this.value = value;
@@ -21,7 +26,15 @@ export class FluidObjectHandle {
21
26
  this.locallyVisible = false;
22
27
  this.absolutePath = generateHandleContextPath(path, this.routeContext);
23
28
  }
24
- get IFluidHandle() { return this; }
29
+ /**
30
+ * {@inheritDoc @fluidframework/core-interfaces#IProvideFluidHandle.IFluidHandle}
31
+ */
32
+ get IFluidHandle() {
33
+ return this;
34
+ }
35
+ /**
36
+ * {@inheritDoc @fluidframework/core-interfaces#IFluidHandle.isAttached}
37
+ */
25
38
  get isAttached() {
26
39
  return this.routeContext.isAttached;
27
40
  }
@@ -43,10 +56,16 @@ export class FluidObjectHandle {
43
56
  */
44
57
  return this.isAttached || this.locallyVisible;
45
58
  }
59
+ /**
60
+ * {@inheritDoc @fluidframework/core-interfaces#IFluidHandle.get}
61
+ */
46
62
  async get() {
47
63
  // Note that this return works whether we received a T or a Promise<T> for this.value in the constructor.
48
64
  return this.value;
49
65
  }
66
+ /**
67
+ * {@inheritDoc @fluidframework/core-interfaces#IFluidHandle.attachGraph }
68
+ */
50
69
  attachGraph() {
51
70
  if (this.visible) {
52
71
  return;
@@ -58,6 +77,9 @@ export class FluidObjectHandle {
58
77
  this.pendingHandlesToMakeVisible.clear();
59
78
  this.routeContext.attachGraph();
60
79
  }
80
+ /**
81
+ * {@inheritDoc @fluidframework/core-interfaces#IFluidHandle.bind}
82
+ */
61
83
  bind(handle) {
62
84
  // If this handle is visible, attach the graph of the incoming handle as well.
63
85
  if (this.visible) {
@@ -1 +1 @@
1
- {"version":3,"file":"fluidHandle.js","sourceRoot":"","sources":["../src/fluidHandle.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAOH,OAAO,EAAE,yBAAyB,EAAE,MAAM,+BAA+B,CAAC;AAE1E,MAAM,OAAO,iBAAiB;IAkC1B;;;;;OAKG;IACH,YACuB,KAAqB,EACxB,IAAY,EACZ,YAAiC;QAF9B,UAAK,GAAL,KAAK,CAAgB;QACxB,SAAI,GAAJ,IAAI,CAAQ;QACZ,iBAAY,GAAZ,YAAY,CAAqB;QA1CpC,gCAA2B,GAAsB,IAAI,GAAG,EAAE,CAAC;QA4B5E;;WAEG;QACK,mBAAc,GAAY,KAAK,CAAC;QAapC,IAAI,CAAC,YAAY,GAAG,yBAAyB,CAAC,IAAI,EAAE,IAAI,CAAC,YAAY,CAAC,CAAC;IAC3E,CAAC;IA1CD,IAAW,YAAY,KAAmB,OAAO,IAAI,CAAC,CAAC,CAAC;IAExD,IAAW,UAAU;QACjB,OAAO,IAAI,CAAC,YAAY,CAAC,UAAU,CAAC;IACxC,CAAC;IAED;;OAEG;IACH,IAAY,OAAO;QACf;;;;;;;;;;;WAWG;QACH,OAAO,IAAI,CAAC,UAAU,IAAI,IAAI,CAAC,cAAc,CAAC;IAClD,CAAC;IAqBM,KAAK,CAAC,GAAG;QACZ,yGAAyG;QACzG,OAAO,IAAI,CAAC,KAAK,CAAC;IACtB,CAAC;IAEM,WAAW;QACd,IAAI,IAAI,CAAC,OAAO,EAAE;YACd,OAAO;SACV;QAED,IAAI,CAAC,cAAc,GAAG,IAAI,CAAC;QAC3B,IAAI,CAAC,2BAA2B,CAAC,OAAO,CAAC,CAAC,MAAM,EAAE,EAAE;YAChD,MAAM,CAAC,WAAW,EAAE,CAAC;QACzB,CAAC,CAAC,CAAC;QACH,IAAI,CAAC,2BAA2B,CAAC,KAAK,EAAE,CAAC;QACzC,IAAI,CAAC,YAAY,CAAC,WAAW,EAAE,CAAC;IACpC,CAAC;IAEM,IAAI,CAAC,MAAoB;QAC5B,8EAA8E;QAC9E,IAAI,IAAI,CAAC,OAAO,EAAE;YACd,MAAM,CAAC,WAAW,EAAE,CAAC;YACrB,OAAO;SACV;QACD,IAAI,CAAC,2BAA2B,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;IACjD,CAAC;CACJ","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport {\n IFluidHandle,\n IFluidHandleContext,\n FluidObject,\n} from \"@fluidframework/core-interfaces\";\nimport { generateHandleContextPath } from \"@fluidframework/runtime-utils\";\n\nexport class FluidObjectHandle<T extends FluidObject = FluidObject> implements IFluidHandle {\n private readonly pendingHandlesToMakeVisible: Set<IFluidHandle> = new Set();\n public readonly absolutePath: string;\n\n public get IFluidHandle(): IFluidHandle { return this; }\n\n public get isAttached(): boolean {\n return this.routeContext.isAttached;\n }\n\n /**\n * Tells whether the object of this handle is visible in the container locally or globally.\n */\n private get visible(): boolean {\n /**\n * If the object of this handle is attached, it is visible in the container. Ideally, checking local visibility\n * should be enough for a handle. However, there are scenarios where the object becomes locally visible but the\n * handle does not know this - This will happen is attachGraph is never called on the handle. Couple of examples\n * where this can happen:\n *\n * 1. Handles to DDS other than the default handle won't know if the DDS becomes visible after the handle was\n * created.\n *\n * 2. Handles to root data stores will never know that it was visible because the handle will not be stores in\n * another DDS and so, attachGraph will never be called on it.\n */\n return this.isAttached || this.locallyVisible;\n }\n\n /**\n * Tracks whether this handle is locally visible in the container.\n */\n private locallyVisible: boolean = false;\n\n /**\n * Creates a new FluidObjectHandle.\n * @param value - The FluidObject object this handle is for.\n * @param path - The path to this handle relative to the routeContext.\n * @param routeContext - The parent IFluidHandleContext that has a route to this handle.\n */\n constructor(\n protected readonly value: T | Promise<T>,\n public readonly path: string,\n public readonly routeContext: IFluidHandleContext,\n ) {\n this.absolutePath = generateHandleContextPath(path, this.routeContext);\n }\n\n public async get(): Promise<any> {\n // Note that this return works whether we received a T or a Promise<T> for this.value in the constructor.\n return this.value;\n }\n\n public attachGraph(): void {\n if (this.visible) {\n return;\n }\n\n this.locallyVisible = true;\n this.pendingHandlesToMakeVisible.forEach((handle) => {\n handle.attachGraph();\n });\n this.pendingHandlesToMakeVisible.clear();\n this.routeContext.attachGraph();\n }\n\n public bind(handle: IFluidHandle) {\n // If this handle is visible, attach the graph of the incoming handle as well.\n if (this.visible) {\n handle.attachGraph();\n return;\n }\n this.pendingHandlesToMakeVisible.add(handle);\n }\n}\n"]}
1
+ {"version":3,"file":"fluidHandle.js","sourceRoot":"","sources":["../src/fluidHandle.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAOH,OAAO,EAAE,yBAAyB,EAAE,MAAM,+BAA+B,CAAC;AAE1E;;GAEG;AACH,MAAM,OAAO,iBAAiB;IA8C1B;;;;;;;OAOG;IACH,YACuB,KAAqB,EACxB,IAAY,EACZ,YAAiC;QAF9B,UAAK,GAAL,KAAK,CAAgB;QACxB,SAAI,GAAJ,IAAI,CAAQ;QACZ,iBAAY,GAAZ,YAAY,CAAqB;QAxDpC,gCAA2B,GAAsB,IAAI,GAAG,EAAE,CAAC;QAwC5E;;WAEG;QACK,mBAAc,GAAY,KAAK,CAAC;QAepC,IAAI,CAAC,YAAY,GAAG,yBAAyB,CAAC,IAAI,EAAE,IAAI,CAAC,YAAY,CAAC,CAAC;IAC3E,CAAC;IApDD;;OAEG;IACH,IAAW,YAAY;QACnB,OAAO,IAAI,CAAC;IAChB,CAAC;IAED;;OAEG;IACH,IAAW,UAAU;QACjB,OAAO,IAAI,CAAC,YAAY,CAAC,UAAU,CAAC;IACxC,CAAC;IAED;;OAEG;IACH,IAAY,OAAO;QACf;;;;;;;;;;;WAWG;QACH,OAAO,IAAI,CAAC,UAAU,IAAI,IAAI,CAAC,cAAc,CAAC;IAClD,CAAC;IAuBD;;OAEG;IACI,KAAK,CAAC,GAAG;QACZ,yGAAyG;QACzG,OAAO,IAAI,CAAC,KAAK,CAAC;IACtB,CAAC;IAED;;OAEG;IACI,WAAW;QACd,IAAI,IAAI,CAAC,OAAO,EAAE;YACd,OAAO;SACV;QAED,IAAI,CAAC,cAAc,GAAG,IAAI,CAAC;QAC3B,IAAI,CAAC,2BAA2B,CAAC,OAAO,CAAC,CAAC,MAAM,EAAE,EAAE;YAChD,MAAM,CAAC,WAAW,EAAE,CAAC;QACzB,CAAC,CAAC,CAAC;QACH,IAAI,CAAC,2BAA2B,CAAC,KAAK,EAAE,CAAC;QACzC,IAAI,CAAC,YAAY,CAAC,WAAW,EAAE,CAAC;IACpC,CAAC;IAED;;OAEG;IACI,IAAI,CAAC,MAAoB;QAC5B,8EAA8E;QAC9E,IAAI,IAAI,CAAC,OAAO,EAAE;YACd,MAAM,CAAC,WAAW,EAAE,CAAC;YACrB,OAAO;SACV;QACD,IAAI,CAAC,2BAA2B,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;IACjD,CAAC;CACJ","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport {\n IFluidHandle,\n IFluidHandleContext,\n FluidObject,\n} from \"@fluidframework/core-interfaces\";\nimport { generateHandleContextPath } from \"@fluidframework/runtime-utils\";\n\n/**\n * Handle for a shared {@link @fluidframework/core-interfaces#FluidObject}.\n */\nexport class FluidObjectHandle<T extends FluidObject = FluidObject> implements IFluidHandle {\n private readonly pendingHandlesToMakeVisible: Set<IFluidHandle> = new Set();\n\n /**\n * {@inheritDoc @fluidframework/core-interfaces#IFluidHandle.absolutePath}\n */\n public readonly absolutePath: string;\n\n /**\n * {@inheritDoc @fluidframework/core-interfaces#IProvideFluidHandle.IFluidHandle}\n */\n public get IFluidHandle(): IFluidHandle {\n return this;\n }\n\n /**\n * {@inheritDoc @fluidframework/core-interfaces#IFluidHandle.isAttached}\n */\n public get isAttached(): boolean {\n return this.routeContext.isAttached;\n }\n\n /**\n * Tells whether the object of this handle is visible in the container locally or globally.\n */\n private get visible(): boolean {\n /**\n * If the object of this handle is attached, it is visible in the container. Ideally, checking local visibility\n * should be enough for a handle. However, there are scenarios where the object becomes locally visible but the\n * handle does not know this - This will happen is attachGraph is never called on the handle. Couple of examples\n * where this can happen:\n *\n * 1. Handles to DDS other than the default handle won't know if the DDS becomes visible after the handle was\n * created.\n *\n * 2. Handles to root data stores will never know that it was visible because the handle will not be stores in\n * another DDS and so, attachGraph will never be called on it.\n */\n return this.isAttached || this.locallyVisible;\n }\n\n /**\n * Tracks whether this handle is locally visible in the container.\n */\n private locallyVisible: boolean = false;\n\n /**\n * Creates a new `FluidObjectHandle`.\n *\n * @param value - The {@link @fluidframework/core-interfaces#FluidObject} object this handle is for.\n * @param path - The path to this handle relative to the `routeContext`.\n * @param routeContext - The parent {@link @fluidframework/core-interfaces#IFluidHandleContext} that has a route\n * to this handle.\n */\n constructor(\n protected readonly value: T | Promise<T>,\n public readonly path: string,\n public readonly routeContext: IFluidHandleContext,\n ) {\n this.absolutePath = generateHandleContextPath(path, this.routeContext);\n }\n\n /**\n * {@inheritDoc @fluidframework/core-interfaces#IFluidHandle.get}\n */\n public async get(): Promise<any> {\n // Note that this return works whether we received a T or a Promise<T> for this.value in the constructor.\n return this.value;\n }\n\n /**\n * {@inheritDoc @fluidframework/core-interfaces#IFluidHandle.attachGraph }\n */\n public attachGraph(): void {\n if (this.visible) {\n return;\n }\n\n this.locallyVisible = true;\n this.pendingHandlesToMakeVisible.forEach((handle) => {\n handle.attachGraph();\n });\n this.pendingHandlesToMakeVisible.clear();\n this.routeContext.attachGraph();\n }\n\n /**\n * {@inheritDoc @fluidframework/core-interfaces#IFluidHandle.bind}\n */\n public bind(handle: IFluidHandle) {\n // If this handle is visible, attach the graph of the incoming handle as well.\n if (this.visible) {\n handle.attachGraph();\n return;\n }\n this.pendingHandlesToMakeVisible.add(handle);\n }\n}\n"]}
package/lib/index.d.ts CHANGED
@@ -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 * from "./dataStoreRuntime";
6
- export * from "./fluidHandle";
5
+ export { FluidObjectHandle } from "./fluidHandle";
6
+ export { DataStoreMessageType, FluidDataStoreRuntime, ISharedObjectRegistry, mixinRequestHandler, mixinSummaryHandler, } from "./dataStoreRuntime";
7
7
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,cAAc,oBAAoB,CAAC;AACnC,cAAc,eAAe,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAC;AAClD,OAAO,EACN,oBAAoB,EACpB,qBAAqB,EACrB,qBAAqB,EACrB,mBAAmB,EACnB,mBAAmB,GACnB,MAAM,oBAAoB,CAAC"}
package/lib/index.js CHANGED
@@ -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 * from "./dataStoreRuntime";
6
- export * from "./fluidHandle";
5
+ export { FluidObjectHandle } from "./fluidHandle";
6
+ export { DataStoreMessageType, FluidDataStoreRuntime, mixinRequestHandler, mixinSummaryHandler, } from "./dataStoreRuntime";
7
7
  //# sourceMappingURL=index.js.map
package/lib/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,cAAc,oBAAoB,CAAC;AACnC,cAAc,eAAe,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nexport * from \"./dataStoreRuntime\";\nexport * from \"./fluidHandle\";\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAC;AAClD,OAAO,EACN,oBAAoB,EACpB,qBAAqB,EAErB,mBAAmB,EACnB,mBAAmB,GACnB,MAAM,oBAAoB,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nexport { FluidObjectHandle } from \"./fluidHandle\";\nexport {\n\tDataStoreMessageType,\n\tFluidDataStoreRuntime,\n\tISharedObjectRegistry,\n\tmixinRequestHandler,\n\tmixinSummaryHandler,\n} from \"./dataStoreRuntime\";\n"]}
@@ -5,5 +5,5 @@
5
5
  * THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY
6
6
  */
7
7
  export declare const pkgName = "@fluidframework/datastore";
8
- export declare const pkgVersion = "2.0.0-internal.2.0.2";
8
+ export declare const pkgVersion = "2.0.0-internal.2.1.0";
9
9
  //# sourceMappingURL=packageVersion.d.ts.map
@@ -5,5 +5,5 @@
5
5
  * THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY
6
6
  */
7
7
  export const pkgName = "@fluidframework/datastore";
8
- export const pkgVersion = "2.0.0-internal.2.0.2";
8
+ export const pkgVersion = "2.0.0-internal.2.1.0";
9
9
  //# sourceMappingURL=packageVersion.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"packageVersion.js","sourceRoot":"","sources":["../src/packageVersion.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,MAAM,CAAC,MAAM,OAAO,GAAG,2BAA2B,CAAC;AACnD,MAAM,CAAC,MAAM,UAAU,GAAG,sBAAsB,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n *\n * THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY\n */\n\nexport const pkgName = \"@fluidframework/datastore\";\nexport const pkgVersion = \"2.0.0-internal.2.0.2\";\n"]}
1
+ {"version":3,"file":"packageVersion.js","sourceRoot":"","sources":["../src/packageVersion.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,MAAM,CAAC,MAAM,OAAO,GAAG,2BAA2B,CAAC;AACnD,MAAM,CAAC,MAAM,UAAU,GAAG,sBAAsB,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n *\n * THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY\n */\n\nexport const pkgName = \"@fluidframework/datastore\";\nexport const pkgVersion = \"2.0.0-internal.2.1.0\";\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fluidframework/datastore",
3
- "version": "2.0.0-internal.2.0.2",
3
+ "version": "2.0.0-internal.2.1.0",
4
4
  "description": "Fluid data store implementation",
5
5
  "homepage": "https://fluidframework.com",
6
6
  "repository": {
@@ -36,8 +36,6 @@
36
36
  "test:mocha:verbose": "cross-env FLUID_TEST_VERBOSE=1 npm run test:mocha",
37
37
  "tsc": "tsc",
38
38
  "tsc:watch": "tsc --watch",
39
- "tsfmt": "tsfmt --verify",
40
- "tsfmt:fix": "tsfmt --replace",
41
39
  "typetests:gen": "fluid-type-validator -g -d ."
42
40
  },
43
41
  "nyc": {
@@ -63,28 +61,29 @@
63
61
  "dependencies": {
64
62
  "@fluidframework/common-definitions": "^0.20.1",
65
63
  "@fluidframework/common-utils": "^1.0.0",
66
- "@fluidframework/container-definitions": ">=2.0.0-internal.2.0.2 <2.0.0-internal.3.0.0",
67
- "@fluidframework/container-utils": ">=2.0.0-internal.2.0.2 <2.0.0-internal.3.0.0",
68
- "@fluidframework/core-interfaces": ">=2.0.0-internal.2.0.2 <2.0.0-internal.3.0.0",
69
- "@fluidframework/datastore-definitions": ">=2.0.0-internal.2.0.2 <2.0.0-internal.3.0.0",
70
- "@fluidframework/driver-definitions": ">=2.0.0-internal.2.0.2 <2.0.0-internal.3.0.0",
71
- "@fluidframework/driver-utils": ">=2.0.0-internal.2.0.2 <2.0.0-internal.3.0.0",
72
- "@fluidframework/garbage-collector": ">=2.0.0-internal.2.0.2 <2.0.0-internal.3.0.0",
64
+ "@fluidframework/container-definitions": ">=2.0.0-internal.2.1.0 <2.0.0-internal.3.0.0",
65
+ "@fluidframework/container-utils": ">=2.0.0-internal.2.1.0 <2.0.0-internal.3.0.0",
66
+ "@fluidframework/core-interfaces": ">=2.0.0-internal.2.1.0 <2.0.0-internal.3.0.0",
67
+ "@fluidframework/datastore-definitions": ">=2.0.0-internal.2.1.0 <2.0.0-internal.3.0.0",
68
+ "@fluidframework/driver-definitions": ">=2.0.0-internal.2.1.0 <2.0.0-internal.3.0.0",
69
+ "@fluidframework/driver-utils": ">=2.0.0-internal.2.1.0 <2.0.0-internal.3.0.0",
70
+ "@fluidframework/garbage-collector": ">=2.0.0-internal.2.1.0 <2.0.0-internal.3.0.0",
73
71
  "@fluidframework/protocol-base": "^0.1038.2000",
74
72
  "@fluidframework/protocol-definitions": "^1.1.0",
75
- "@fluidframework/runtime-definitions": ">=2.0.0-internal.2.0.2 <2.0.0-internal.3.0.0",
76
- "@fluidframework/runtime-utils": ">=2.0.0-internal.2.0.2 <2.0.0-internal.3.0.0",
77
- "@fluidframework/telemetry-utils": ">=2.0.0-internal.2.0.2 <2.0.0-internal.3.0.0",
73
+ "@fluidframework/runtime-definitions": ">=2.0.0-internal.2.1.0 <2.0.0-internal.3.0.0",
74
+ "@fluidframework/runtime-utils": ">=2.0.0-internal.2.1.0 <2.0.0-internal.3.0.0",
75
+ "@fluidframework/telemetry-utils": ">=2.0.0-internal.2.1.0 <2.0.0-internal.3.0.0",
78
76
  "lodash": "^4.17.21",
79
77
  "uuid": "^8.3.1"
80
78
  },
81
79
  "devDependencies": {
82
- "@fluidframework/build-common": "^1.0.0",
83
- "@fluidframework/build-tools": "^0.4.6000",
80
+ "@fluid-tools/build-cli": "^0.5.0",
81
+ "@fluidframework/build-common": "^1.1.0",
82
+ "@fluidframework/build-tools": "^0.5.0",
84
83
  "@fluidframework/datastore-previous": "npm:@fluidframework/datastore@2.0.0-internal.2.0.0",
85
- "@fluidframework/eslint-config-fluid": "^1.0.0",
86
- "@fluidframework/mocha-test-setup": ">=2.0.0-internal.2.0.2 <2.0.0-internal.3.0.0",
87
- "@fluidframework/test-runtime-utils": ">=2.0.0-internal.2.0.2 <2.0.0-internal.3.0.0",
84
+ "@fluidframework/eslint-config-fluid": "^1.1.0",
85
+ "@fluidframework/mocha-test-setup": ">=2.0.0-internal.2.1.0 <2.0.0-internal.3.0.0",
86
+ "@fluidframework/test-runtime-utils": ">=2.0.0-internal.2.1.0 <2.0.0-internal.3.0.0",
88
87
  "@microsoft/api-extractor": "^7.22.2",
89
88
  "@rushstack/eslint-config": "^2.5.1",
90
89
  "@types/mocha": "^9.1.1",
@@ -97,11 +96,10 @@
97
96
  "mocha": "^10.0.0",
98
97
  "nyc": "^15.0.0",
99
98
  "rimraf": "^2.6.2",
100
- "typescript": "~4.5.5",
101
- "typescript-formatter": "7.1.0"
99
+ "typescript": "~4.5.5"
102
100
  },
103
101
  "typeValidation": {
104
- "version": "2.0.0-internal.2.0.1",
102
+ "version": "2.0.0-internal.2.1.0",
105
103
  "broken": {}
106
104
  }
107
105
  }
@@ -5,6 +5,7 @@
5
5
 
6
6
  import { ITelemetryLogger } from "@fluidframework/common-definitions";
7
7
  import {
8
+ FluidObject,
8
9
  IFluidHandle,
9
10
  IFluidHandleContext,
10
11
  IRequest,
@@ -62,6 +63,7 @@ import {
62
63
  create404Response,
63
64
  createResponseError,
64
65
  exceptionToResponse,
66
+ requestFluidObject,
65
67
  } from "@fluidframework/runtime-utils";
66
68
  import {
67
69
  IChannel,
@@ -79,6 +81,7 @@ import { v4 as uuid } from "uuid";
79
81
  import { IChannelContext, summarizeChannel } from "./channelContext";
80
82
  import { LocalChannelContext, LocalChannelContextBase, RehydratedLocalChannelContext } from "./localChannelContext";
81
83
  import { RemoteChannelContext } from "./remoteChannelContext";
84
+ import { FluidObjectHandle } from "./fluidHandle";
82
85
 
83
86
  export enum DataStoreMessageType {
84
87
  // Creates a new channel
@@ -99,6 +102,8 @@ export class FluidDataStoreRuntime extends
99
102
  TypedEventEmitter<IFluidDataStoreRuntimeEvents> implements
100
103
  IFluidDataStoreChannel, IFluidDataStoreRuntime, IFluidHandleContext {
101
104
  /**
105
+ * @deprecated - Instantiate the class using its constructor instead.
106
+ *
102
107
  * Loads the data store runtime
103
108
  * @param context - The data store context
104
109
  * @param sharedObjectRegistry - The registry of shared objects used by this data store
@@ -109,9 +114,18 @@ IFluidDataStoreChannel, IFluidDataStoreRuntime, IFluidHandleContext {
109
114
  sharedObjectRegistry: ISharedObjectRegistry,
110
115
  existing: boolean,
111
116
  ): FluidDataStoreRuntime {
112
- return new FluidDataStoreRuntime(context, sharedObjectRegistry, existing);
117
+ return new FluidDataStoreRuntime(
118
+ context,
119
+ sharedObjectRegistry,
120
+ existing,
121
+ async (dataStoreRuntime) => requestFluidObject(dataStoreRuntime, "/"));
113
122
  }
114
123
 
124
+ /**
125
+ * {@inheritDoc @fluidframework/datastore-definitions#IFluidDataStoreRuntime.entryPoint}
126
+ */
127
+ public readonly entryPoint?: IFluidHandle<FluidObject>;
128
+
115
129
  public get IFluidRouter() { return this; }
116
130
 
117
131
  public get connected(): boolean {
@@ -176,10 +190,22 @@ IFluidDataStoreChannel, IFluidDataStoreRuntime, IFluidHandleContext {
176
190
  // channel contexts.
177
191
  private readonly channelsBaseGCDetails: LazyPromise<Map<string, IGarbageCollectionDetailsBase>>;
178
192
 
193
+ /**
194
+ * Create an instance of a DataStore runtime.
195
+ *
196
+ * @param dataStoreContext - Context object for the runtime.
197
+ * @param sharedObjectRegistry - The registry of shared objects that this data store will be able to instantiate.
198
+ * @param existing - Pass 'true' if loading this datastore from an existing file; pass 'false' otherwise.
199
+ * @param initializeEntryPoint - Function to initialize the entryPoint object for the data store runtime. The
200
+ * handle to this data store runtime will point to the object returned by this function. If this function is not
201
+ * provided, the handle will be left undefined. This is here so we can start making handles a first-class citizen
202
+ * and the primary way of interacting with some Fluid objects, and should be used if possible.
203
+ */
179
204
  public constructor(
180
205
  private readonly dataStoreContext: IFluidDataStoreContext,
181
206
  private readonly sharedObjectRegistry: ISharedObjectRegistry,
182
207
  existing: boolean,
208
+ initializeEntryPoint?: (runtime: IFluidDataStoreRuntime) => Promise<FluidObject>,
183
209
  ) {
184
210
  super();
185
211
 
@@ -264,6 +290,11 @@ IFluidDataStoreChannel, IFluidDataStoreRuntime, IFluidHandleContext {
264
290
  });
265
291
  }
266
292
 
293
+ if (initializeEntryPoint) {
294
+ const promise = new LazyPromise(async () => initializeEntryPoint(this));
295
+ this.entryPoint = new FluidObjectHandle<FluidObject>(promise, "", this.objectsRoutingContext);
296
+ }
297
+
267
298
  this.attachListener();
268
299
  // If exists on storage or loaded from a snapshot, it should already be bound.
269
300
  this.bindState = existing ? BindState.Bound : BindState.NotBound;
@@ -10,12 +10,27 @@ import {
10
10
  } from "@fluidframework/core-interfaces";
11
11
  import { generateHandleContextPath } from "@fluidframework/runtime-utils";
12
12
 
13
+ /**
14
+ * Handle for a shared {@link @fluidframework/core-interfaces#FluidObject}.
15
+ */
13
16
  export class FluidObjectHandle<T extends FluidObject = FluidObject> implements IFluidHandle {
14
17
  private readonly pendingHandlesToMakeVisible: Set<IFluidHandle> = new Set();
18
+
19
+ /**
20
+ * {@inheritDoc @fluidframework/core-interfaces#IFluidHandle.absolutePath}
21
+ */
15
22
  public readonly absolutePath: string;
16
23
 
17
- public get IFluidHandle(): IFluidHandle { return this; }
24
+ /**
25
+ * {@inheritDoc @fluidframework/core-interfaces#IProvideFluidHandle.IFluidHandle}
26
+ */
27
+ public get IFluidHandle(): IFluidHandle {
28
+ return this;
29
+ }
18
30
 
31
+ /**
32
+ * {@inheritDoc @fluidframework/core-interfaces#IFluidHandle.isAttached}
33
+ */
19
34
  public get isAttached(): boolean {
20
35
  return this.routeContext.isAttached;
21
36
  }
@@ -45,10 +60,12 @@ export class FluidObjectHandle<T extends FluidObject = FluidObject> implements I
45
60
  private locallyVisible: boolean = false;
46
61
 
47
62
  /**
48
- * Creates a new FluidObjectHandle.
49
- * @param value - The FluidObject object this handle is for.
50
- * @param path - The path to this handle relative to the routeContext.
51
- * @param routeContext - The parent IFluidHandleContext that has a route to this handle.
63
+ * Creates a new `FluidObjectHandle`.
64
+ *
65
+ * @param value - The {@link @fluidframework/core-interfaces#FluidObject} object this handle is for.
66
+ * @param path - The path to this handle relative to the `routeContext`.
67
+ * @param routeContext - The parent {@link @fluidframework/core-interfaces#IFluidHandleContext} that has a route
68
+ * to this handle.
52
69
  */
53
70
  constructor(
54
71
  protected readonly value: T | Promise<T>,
@@ -58,11 +75,17 @@ export class FluidObjectHandle<T extends FluidObject = FluidObject> implements I
58
75
  this.absolutePath = generateHandleContextPath(path, this.routeContext);
59
76
  }
60
77
 
78
+ /**
79
+ * {@inheritDoc @fluidframework/core-interfaces#IFluidHandle.get}
80
+ */
61
81
  public async get(): Promise<any> {
62
82
  // Note that this return works whether we received a T or a Promise<T> for this.value in the constructor.
63
83
  return this.value;
64
84
  }
65
85
 
86
+ /**
87
+ * {@inheritDoc @fluidframework/core-interfaces#IFluidHandle.attachGraph }
88
+ */
66
89
  public attachGraph(): void {
67
90
  if (this.visible) {
68
91
  return;
@@ -76,6 +99,9 @@ export class FluidObjectHandle<T extends FluidObject = FluidObject> implements I
76
99
  this.routeContext.attachGraph();
77
100
  }
78
101
 
102
+ /**
103
+ * {@inheritDoc @fluidframework/core-interfaces#IFluidHandle.bind}
104
+ */
79
105
  public bind(handle: IFluidHandle) {
80
106
  // If this handle is visible, attach the graph of the incoming handle as well.
81
107
  if (this.visible) {
package/src/index.ts CHANGED
@@ -3,5 +3,11 @@
3
3
  * Licensed under the MIT License.
4
4
  */
5
5
 
6
- export * from "./dataStoreRuntime";
7
- export * from "./fluidHandle";
6
+ export { FluidObjectHandle } from "./fluidHandle";
7
+ export {
8
+ DataStoreMessageType,
9
+ FluidDataStoreRuntime,
10
+ ISharedObjectRegistry,
11
+ mixinRequestHandler,
12
+ mixinSummaryHandler,
13
+ } from "./dataStoreRuntime";
@@ -6,4 +6,4 @@
6
6
  */
7
7
 
8
8
  export const pkgName = "@fluidframework/datastore";
9
- export const pkgVersion = "2.0.0-internal.2.0.2";
9
+ export const pkgVersion = "2.0.0-internal.2.1.0";