@fluidframework/datastore 2.0.0-internal.3.0.5 → 2.0.0-internal.3.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (65) hide show
  1. package/.eslintrc.js +5 -7
  2. package/.mocharc.js +2 -2
  3. package/README.md +3 -0
  4. package/api-extractor.json +2 -2
  5. package/dist/channelContext.d.ts.map +1 -1
  6. package/dist/channelContext.js.map +1 -1
  7. package/dist/channelDeltaConnection.d.ts.map +1 -1
  8. package/dist/channelDeltaConnection.js.map +1 -1
  9. package/dist/channelStorageService.d.ts.map +1 -1
  10. package/dist/channelStorageService.js +1 -3
  11. package/dist/channelStorageService.js.map +1 -1
  12. package/dist/dataStoreRuntime.d.ts +11 -24
  13. package/dist/dataStoreRuntime.d.ts.map +1 -1
  14. package/dist/dataStoreRuntime.js +68 -86
  15. package/dist/dataStoreRuntime.js.map +1 -1
  16. package/dist/fluidHandle.d.ts.map +1 -1
  17. package/dist/fluidHandle.js.map +1 -1
  18. package/dist/localChannelContext.d.ts.map +1 -1
  19. package/dist/localChannelContext.js +9 -5
  20. package/dist/localChannelContext.js.map +1 -1
  21. package/dist/localChannelStorageService.d.ts.map +1 -1
  22. package/dist/localChannelStorageService.js.map +1 -1
  23. package/dist/packageVersion.d.ts +1 -1
  24. package/dist/packageVersion.js +1 -1
  25. package/dist/packageVersion.js.map +1 -1
  26. package/dist/remoteChannelContext.d.ts.map +1 -1
  27. package/dist/remoteChannelContext.js +2 -2
  28. package/dist/remoteChannelContext.js.map +1 -1
  29. package/lib/channelContext.d.ts.map +1 -1
  30. package/lib/channelContext.js.map +1 -1
  31. package/lib/channelDeltaConnection.d.ts.map +1 -1
  32. package/lib/channelDeltaConnection.js.map +1 -1
  33. package/lib/channelStorageService.d.ts.map +1 -1
  34. package/lib/channelStorageService.js +1 -3
  35. package/lib/channelStorageService.js.map +1 -1
  36. package/lib/dataStoreRuntime.d.ts +11 -24
  37. package/lib/dataStoreRuntime.d.ts.map +1 -1
  38. package/lib/dataStoreRuntime.js +71 -89
  39. package/lib/dataStoreRuntime.js.map +1 -1
  40. package/lib/fluidHandle.d.ts.map +1 -1
  41. package/lib/fluidHandle.js.map +1 -1
  42. package/lib/localChannelContext.d.ts.map +1 -1
  43. package/lib/localChannelContext.js +9 -5
  44. package/lib/localChannelContext.js.map +1 -1
  45. package/lib/localChannelStorageService.d.ts.map +1 -1
  46. package/lib/localChannelStorageService.js.map +1 -1
  47. package/lib/packageVersion.d.ts +1 -1
  48. package/lib/packageVersion.js +1 -1
  49. package/lib/packageVersion.js.map +1 -1
  50. package/lib/remoteChannelContext.d.ts.map +1 -1
  51. package/lib/remoteChannelContext.js +2 -2
  52. package/lib/remoteChannelContext.js.map +1 -1
  53. package/package.json +111 -110
  54. package/prettier.config.cjs +1 -1
  55. package/src/channelContext.ts +66 -65
  56. package/src/channelDeltaConnection.ts +50 -44
  57. package/src/channelStorageService.ts +58 -54
  58. package/src/dataStoreRuntime.ts +1122 -1086
  59. package/src/fluidHandle.ts +87 -91
  60. package/src/localChannelContext.ts +302 -255
  61. package/src/localChannelStorageService.ts +47 -45
  62. package/src/packageVersion.ts +1 -1
  63. package/src/remoteChannelContext.ts +300 -291
  64. package/tsconfig.esnext.json +6 -6
  65. package/tsconfig.json +9 -13
@@ -3,111 +3,107 @@
3
3
  * Licensed under the MIT License.
4
4
  */
5
5
 
6
- import {
7
- IFluidHandle,
8
- IFluidHandleContext,
9
- FluidObject,
10
- } from "@fluidframework/core-interfaces";
6
+ import { IFluidHandle, IFluidHandleContext, FluidObject } from "@fluidframework/core-interfaces";
11
7
  import { generateHandleContextPath } from "@fluidframework/runtime-utils";
12
8
 
13
9
  /**
14
10
  * Handle for a shared {@link @fluidframework/core-interfaces#FluidObject}.
15
11
  */
16
12
  export class FluidObjectHandle<T extends FluidObject = FluidObject> implements IFluidHandle {
17
- private readonly pendingHandlesToMakeVisible: Set<IFluidHandle> = new Set();
13
+ private readonly pendingHandlesToMakeVisible: Set<IFluidHandle> = new Set();
18
14
 
19
- /**
20
- * {@inheritDoc @fluidframework/core-interfaces#IFluidHandle.absolutePath}
21
- */
22
- public readonly absolutePath: string;
15
+ /**
16
+ * {@inheritDoc @fluidframework/core-interfaces#IFluidHandle.absolutePath}
17
+ */
18
+ public readonly absolutePath: string;
23
19
 
24
- /**
25
- * {@inheritDoc @fluidframework/core-interfaces#IProvideFluidHandle.IFluidHandle}
26
- */
27
- public get IFluidHandle(): IFluidHandle {
28
- return this;
29
- }
20
+ /**
21
+ * {@inheritDoc @fluidframework/core-interfaces#IProvideFluidHandle.IFluidHandle}
22
+ */
23
+ public get IFluidHandle(): IFluidHandle {
24
+ return this;
25
+ }
30
26
 
31
- /**
32
- * {@inheritDoc @fluidframework/core-interfaces#IFluidHandle.isAttached}
33
- */
34
- public get isAttached(): boolean {
35
- return this.routeContext.isAttached;
36
- }
27
+ /**
28
+ * {@inheritDoc @fluidframework/core-interfaces#IFluidHandle.isAttached}
29
+ */
30
+ public get isAttached(): boolean {
31
+ return this.routeContext.isAttached;
32
+ }
37
33
 
38
- /**
39
- * Tells whether the object of this handle is visible in the container locally or globally.
40
- */
41
- private get visible(): boolean {
42
- /**
43
- * If the object of this handle is attached, it is visible in the container. Ideally, checking local visibility
44
- * should be enough for a handle. However, there are scenarios where the object becomes locally visible but the
45
- * handle does not know this - This will happen is attachGraph is never called on the handle. Couple of examples
46
- * where this can happen:
47
- *
48
- * 1. Handles to DDS other than the default handle won't know if the DDS becomes visible after the handle was
49
- * created.
50
- *
51
- * 2. Handles to root data stores will never know that it was visible because the handle will not be stores in
52
- * another DDS and so, attachGraph will never be called on it.
53
- */
54
- return this.isAttached || this.locallyVisible;
55
- }
34
+ /**
35
+ * Tells whether the object of this handle is visible in the container locally or globally.
36
+ */
37
+ private get visible(): boolean {
38
+ /**
39
+ * If the object of this handle is attached, it is visible in the container. Ideally, checking local visibility
40
+ * should be enough for a handle. However, there are scenarios where the object becomes locally visible but the
41
+ * handle does not know this - This will happen is attachGraph is never called on the handle. Couple of examples
42
+ * where this can happen:
43
+ *
44
+ * 1. Handles to DDS other than the default handle won't know if the DDS becomes visible after the handle was
45
+ * created.
46
+ *
47
+ * 2. Handles to root data stores will never know that it was visible because the handle will not be stores in
48
+ * another DDS and so, attachGraph will never be called on it.
49
+ */
50
+ return this.isAttached || this.locallyVisible;
51
+ }
56
52
 
57
- /**
58
- * Tracks whether this handle is locally visible in the container.
59
- */
60
- private locallyVisible: boolean = false;
53
+ /**
54
+ * Tracks whether this handle is locally visible in the container.
55
+ */
56
+ private locallyVisible: boolean = false;
61
57
 
62
- /**
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.
69
- */
70
- constructor(
71
- protected readonly value: T | Promise<T>,
72
- public readonly path: string,
73
- public readonly routeContext: IFluidHandleContext,
74
- ) {
75
- this.absolutePath = generateHandleContextPath(path, this.routeContext);
76
- }
58
+ /**
59
+ * Creates a new `FluidObjectHandle`.
60
+ *
61
+ * @param value - The {@link @fluidframework/core-interfaces#FluidObject} object this handle is for.
62
+ * @param path - The path to this handle relative to the `routeContext`.
63
+ * @param routeContext - The parent {@link @fluidframework/core-interfaces#IFluidHandleContext} that has a route
64
+ * to this handle.
65
+ */
66
+ constructor(
67
+ protected readonly value: T | Promise<T>,
68
+ public readonly path: string,
69
+ public readonly routeContext: IFluidHandleContext,
70
+ ) {
71
+ this.absolutePath = generateHandleContextPath(path, this.routeContext);
72
+ }
77
73
 
78
- /**
79
- * {@inheritDoc @fluidframework/core-interfaces#IFluidHandle.get}
80
- */
81
- public async get(): Promise<any> {
82
- // Note that this return works whether we received a T or a Promise<T> for this.value in the constructor.
83
- return this.value;
84
- }
74
+ /**
75
+ * {@inheritDoc @fluidframework/core-interfaces#IFluidHandle.get}
76
+ */
77
+ public async get(): Promise<any> {
78
+ // Note that this return works whether we received a T or a Promise<T> for this.value in the constructor.
79
+ return this.value;
80
+ }
85
81
 
86
- /**
87
- * {@inheritDoc @fluidframework/core-interfaces#IFluidHandle.attachGraph }
88
- */
89
- public attachGraph(): void {
90
- if (this.visible) {
91
- return;
92
- }
82
+ /**
83
+ * {@inheritDoc @fluidframework/core-interfaces#IFluidHandle.attachGraph }
84
+ */
85
+ public attachGraph(): void {
86
+ if (this.visible) {
87
+ return;
88
+ }
93
89
 
94
- this.locallyVisible = true;
95
- this.pendingHandlesToMakeVisible.forEach((handle) => {
96
- handle.attachGraph();
97
- });
98
- this.pendingHandlesToMakeVisible.clear();
99
- this.routeContext.attachGraph();
100
- }
90
+ this.locallyVisible = true;
91
+ this.pendingHandlesToMakeVisible.forEach((handle) => {
92
+ handle.attachGraph();
93
+ });
94
+ this.pendingHandlesToMakeVisible.clear();
95
+ this.routeContext.attachGraph();
96
+ }
101
97
 
102
- /**
103
- * {@inheritDoc @fluidframework/core-interfaces#IFluidHandle.bind}
104
- */
105
- public bind(handle: IFluidHandle) {
106
- // If this handle is visible, attach the graph of the incoming handle as well.
107
- if (this.visible) {
108
- handle.attachGraph();
109
- return;
110
- }
111
- this.pendingHandlesToMakeVisible.add(handle);
112
- }
98
+ /**
99
+ * {@inheritDoc @fluidframework/core-interfaces#IFluidHandle.bind}
100
+ */
101
+ public bind(handle: IFluidHandle) {
102
+ // If this handle is visible, attach the graph of the incoming handle as well.
103
+ if (this.visible) {
104
+ handle.attachGraph();
105
+ return;
106
+ }
107
+ this.pendingHandlesToMakeVisible.add(handle);
108
+ }
113
109
  }