@fluidframework/datastore 1.4.0-121020 → 2.0.0-dev-rc.1.0.0.224419

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 (145) hide show
  1. package/.eslintrc.js +5 -7
  2. package/.mocharc.js +12 -0
  3. package/CHANGELOG.md +273 -0
  4. package/README.md +41 -0
  5. package/api-extractor-lint.json +4 -0
  6. package/api-extractor.json +2 -2
  7. package/api-report/datastore.api.md +168 -0
  8. package/dist/channelContext.cjs +86 -0
  9. package/dist/channelContext.cjs.map +1 -0
  10. package/dist/channelContext.d.ts +15 -9
  11. package/dist/channelContext.d.ts.map +1 -1
  12. package/dist/{channelDeltaConnection.js → channelDeltaConnection.cjs} +14 -15
  13. package/dist/channelDeltaConnection.cjs.map +1 -0
  14. package/dist/channelDeltaConnection.d.ts +4 -5
  15. package/dist/channelDeltaConnection.d.ts.map +1 -1
  16. package/dist/{channelStorageService.js → channelStorageService.cjs} +13 -16
  17. package/dist/channelStorageService.cjs.map +1 -0
  18. package/dist/channelStorageService.d.ts +2 -2
  19. package/dist/channelStorageService.d.ts.map +1 -1
  20. package/dist/{dataStoreRuntime.js → dataStoreRuntime.cjs} +302 -225
  21. package/dist/dataStoreRuntime.cjs.map +1 -0
  22. package/dist/dataStoreRuntime.d.ts +81 -37
  23. package/dist/dataStoreRuntime.d.ts.map +1 -1
  24. package/dist/datastore-alpha.d.ts +317 -0
  25. package/dist/datastore-beta.d.ts +47 -0
  26. package/dist/datastore-public.d.ts +47 -0
  27. package/dist/datastore-untrimmed.d.ts +324 -0
  28. package/dist/{fluidHandle.js → fluidHandle.cjs} +44 -16
  29. package/dist/fluidHandle.cjs.map +1 -0
  30. package/dist/fluidHandle.d.ts +33 -6
  31. package/dist/fluidHandle.d.ts.map +1 -1
  32. package/dist/index.cjs +15 -0
  33. package/dist/index.cjs.map +1 -0
  34. package/dist/index.d.ts +2 -2
  35. package/dist/index.d.ts.map +1 -1
  36. package/dist/localChannelContext.cjs +190 -0
  37. package/dist/localChannelContext.cjs.map +1 -0
  38. package/dist/localChannelContext.d.ts +12 -21
  39. package/dist/localChannelContext.d.ts.map +1 -1
  40. package/dist/{localChannelStorageService.js → localChannelStorageService.cjs} +3 -3
  41. package/dist/localChannelStorageService.cjs.map +1 -0
  42. package/dist/localChannelStorageService.d.ts.map +1 -1
  43. package/dist/remoteChannelContext.cjs +124 -0
  44. package/dist/remoteChannelContext.cjs.map +1 -0
  45. package/dist/remoteChannelContext.d.ts +5 -10
  46. package/dist/remoteChannelContext.d.ts.map +1 -1
  47. package/dist/tsdoc-metadata.json +11 -0
  48. package/lib/{channelContext.d.ts → channelContext.d.mts} +16 -10
  49. package/lib/channelContext.d.mts.map +1 -0
  50. package/lib/channelContext.mjs +78 -0
  51. package/lib/channelContext.mjs.map +1 -0
  52. package/lib/{channelDeltaConnection.d.ts → channelDeltaConnection.d.mts} +4 -5
  53. package/lib/channelDeltaConnection.d.mts.map +1 -0
  54. package/lib/{channelDeltaConnection.js → channelDeltaConnection.mjs} +11 -12
  55. package/lib/channelDeltaConnection.mjs.map +1 -0
  56. package/lib/{channelStorageService.d.ts → channelStorageService.d.mts} +2 -2
  57. package/lib/channelStorageService.d.mts.map +1 -0
  58. package/lib/{channelStorageService.js → channelStorageService.mjs} +13 -16
  59. package/lib/channelStorageService.mjs.map +1 -0
  60. package/lib/{dataStoreRuntime.d.ts → dataStoreRuntime.d.mts} +81 -37
  61. package/lib/dataStoreRuntime.d.mts.map +1 -0
  62. package/lib/{dataStoreRuntime.js → dataStoreRuntime.mjs} +286 -209
  63. package/lib/dataStoreRuntime.mjs.map +1 -0
  64. package/lib/datastore-alpha.d.mts +317 -0
  65. package/lib/datastore-beta.d.mts +47 -0
  66. package/lib/datastore-public.d.mts +47 -0
  67. package/lib/datastore-untrimmed.d.mts +324 -0
  68. package/lib/fluidHandle.d.mts +57 -0
  69. package/lib/fluidHandle.d.mts.map +1 -0
  70. package/lib/{fluidHandle.js → fluidHandle.mjs} +44 -16
  71. package/lib/fluidHandle.mjs.map +1 -0
  72. package/lib/index.d.mts +7 -0
  73. package/lib/index.d.mts.map +1 -0
  74. package/lib/index.mjs +7 -0
  75. package/lib/index.mjs.map +1 -0
  76. package/lib/{localChannelContext.d.ts → localChannelContext.d.mts} +13 -22
  77. package/lib/localChannelContext.d.mts.map +1 -0
  78. package/lib/{localChannelContext.js → localChannelContext.mjs} +73 -85
  79. package/lib/localChannelContext.mjs.map +1 -0
  80. package/lib/localChannelStorageService.d.mts.map +1 -0
  81. package/lib/{localChannelStorageService.js → localChannelStorageService.mjs} +2 -2
  82. package/lib/localChannelStorageService.mjs.map +1 -0
  83. package/lib/{remoteChannelContext.d.ts → remoteChannelContext.d.mts} +7 -12
  84. package/lib/remoteChannelContext.d.mts.map +1 -0
  85. package/lib/remoteChannelContext.mjs +120 -0
  86. package/lib/remoteChannelContext.mjs.map +1 -0
  87. package/package.json +107 -72
  88. package/{lib/index.js → prettier.config.cjs} +4 -3
  89. package/src/channelContext.ts +168 -71
  90. package/src/channelDeltaConnection.ts +52 -47
  91. package/src/channelStorageService.ts +59 -55
  92. package/src/dataStoreRuntime.ts +1158 -983
  93. package/src/fluidHandle.ts +92 -64
  94. package/src/index.ts +8 -2
  95. package/src/localChannelContext.ts +278 -272
  96. package/src/localChannelStorageService.ts +48 -46
  97. package/src/remoteChannelContext.ts +237 -300
  98. package/tsc-multi.test.json +4 -0
  99. package/tsconfig.json +11 -13
  100. package/dist/channelContext.js +0 -35
  101. package/dist/channelContext.js.map +0 -1
  102. package/dist/channelDeltaConnection.js.map +0 -1
  103. package/dist/channelStorageService.js.map +0 -1
  104. package/dist/dataStoreRuntime.js.map +0 -1
  105. package/dist/fluidHandle.js.map +0 -1
  106. package/dist/index.js +0 -19
  107. package/dist/index.js.map +0 -1
  108. package/dist/localChannelContext.js +0 -202
  109. package/dist/localChannelContext.js.map +0 -1
  110. package/dist/localChannelStorageService.js.map +0 -1
  111. package/dist/packageVersion.d.ts +0 -9
  112. package/dist/packageVersion.d.ts.map +0 -1
  113. package/dist/packageVersion.js +0 -12
  114. package/dist/packageVersion.js.map +0 -1
  115. package/dist/remoteChannelContext.js +0 -207
  116. package/dist/remoteChannelContext.js.map +0 -1
  117. package/lib/channelContext.d.ts.map +0 -1
  118. package/lib/channelContext.js +0 -29
  119. package/lib/channelContext.js.map +0 -1
  120. package/lib/channelDeltaConnection.d.ts.map +0 -1
  121. package/lib/channelDeltaConnection.js.map +0 -1
  122. package/lib/channelStorageService.d.ts.map +0 -1
  123. package/lib/channelStorageService.js.map +0 -1
  124. package/lib/dataStoreRuntime.d.ts.map +0 -1
  125. package/lib/dataStoreRuntime.js.map +0 -1
  126. package/lib/fluidHandle.d.ts +0 -30
  127. package/lib/fluidHandle.d.ts.map +0 -1
  128. package/lib/fluidHandle.js.map +0 -1
  129. package/lib/index.d.ts +0 -7
  130. package/lib/index.d.ts.map +0 -1
  131. package/lib/index.js.map +0 -1
  132. package/lib/localChannelContext.d.ts.map +0 -1
  133. package/lib/localChannelContext.js.map +0 -1
  134. package/lib/localChannelStorageService.d.ts.map +0 -1
  135. package/lib/localChannelStorageService.js.map +0 -1
  136. package/lib/packageVersion.d.ts +0 -9
  137. package/lib/packageVersion.d.ts.map +0 -1
  138. package/lib/packageVersion.js +0 -9
  139. package/lib/packageVersion.js.map +0 -1
  140. package/lib/remoteChannelContext.d.ts.map +0 -1
  141. package/lib/remoteChannelContext.js +0 -203
  142. package/lib/remoteChannelContext.js.map +0 -1
  143. package/src/packageVersion.ts +0 -9
  144. package/tsconfig.esnext.json +0 -7
  145. /package/lib/{localChannelStorageService.d.ts → localChannelStorageService.d.mts} +0 -0
@@ -3,80 +3,108 @@
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
 
9
+ /**
10
+ * Handle for a shared {@link @fluidframework/core-interfaces#FluidObject}.
11
+ * @alpha
12
+ */
13
13
  export class FluidObjectHandle<T extends FluidObject = FluidObject> implements IFluidHandle {
14
- private readonly pendingHandlesToMakeVisible: Set<IFluidHandle> = new Set();
15
- public readonly absolutePath: string;
14
+ private readonly pendingHandlesToMakeVisible: Set<IFluidHandle> = new Set();
15
+
16
+ /**
17
+ * {@inheritDoc @fluidframework/core-interfaces#IFluidHandle.absolutePath}
18
+ */
19
+ public readonly absolutePath: string;
16
20
 
17
- public get IFluidHandle(): IFluidHandle { return this; }
21
+ /**
22
+ * {@inheritDoc @fluidframework/core-interfaces#IProvideFluidHandle.IFluidHandle}
23
+ */
24
+ public get IFluidHandle(): IFluidHandle {
25
+ return this;
26
+ }
18
27
 
19
- public get isAttached(): boolean {
20
- return this.routeContext.isAttached;
21
- }
28
+ /**
29
+ * {@inheritDoc @fluidframework/core-interfaces#IFluidHandle.isAttached}
30
+ */
31
+ public get isAttached(): boolean {
32
+ return this.routeContext.isAttached;
33
+ }
22
34
 
23
- /**
24
- * Tells whether the object of this handle is visible in the container locally or globally.
25
- */
26
- private get visible(): boolean {
27
- /**
28
- * If the object of this handle is attached, it is visible in the container. Ideally, checking local visibility
29
- * should be enough for a handle. However, there are scenarios where the object becomes locally visible but the
30
- * handle does not know this - This will happen is attachGraph is never called on the handle. Couple of examples
31
- * where this can happen:
32
- * 1. Handles to DDS other than the default handle won't know if the DDS becomes visible after the handle was
33
- * created.
34
- * 2. Handles to root data stores will never know that it was visible because the handle will not be stores in
35
- * another DDS and so, attachGraph will never be called on it.
36
- */
37
- return this.isAttached || this.locallyVisible;
38
- }
35
+ /**
36
+ * Tells whether the object of this handle is visible in the container locally or globally.
37
+ */
38
+ private get visible(): boolean {
39
+ /**
40
+ * If the object of this handle is attached, it is visible in the container. Ideally, checking local visibility
41
+ * should be enough for a handle. However, there are scenarios where the object becomes locally visible but the
42
+ * handle does not know this - This will happen is attachGraph is never called on the handle. Couple of examples
43
+ * where this can happen:
44
+ *
45
+ * 1. Handles to DDS other than the default handle won't know if the DDS becomes visible after the handle was
46
+ * created.
47
+ *
48
+ * 2. Handles to root data stores will never know that it was visible because the handle will not be stores in
49
+ * another DDS and so, attachGraph will never be called on it.
50
+ */
51
+ return this.isAttached || this.locallyVisible;
52
+ }
39
53
 
40
- // Tracks whether this handle is locally visible in the container.
41
- private locallyVisible: boolean = false;
54
+ /**
55
+ * Tracks whether this handle is locally visible in the container.
56
+ */
57
+ private locallyVisible: boolean = false;
42
58
 
43
- /**
44
- * Creates a new FluidObjectHandle.
45
- * @param value - The FluidObject object this handle is for.
46
- * @param path - The path to this handle relative to the routeContext.
47
- * @param routeContext - The parent IFluidHandleContext that has a route to this handle.
48
- */
49
- constructor(
50
- protected readonly value: T,
51
- public readonly path: string,
52
- public readonly routeContext: IFluidHandleContext,
53
- ) {
54
- this.absolutePath = generateHandleContextPath(path, this.routeContext);
55
- }
59
+ /**
60
+ * Creates a new `FluidObjectHandle`.
61
+ *
62
+ * @param value - The {@link @fluidframework/core-interfaces#FluidObject} object this handle is for.
63
+ * @param path - The path to this handle relative to the `routeContext`.
64
+ * @param routeContext - The parent {@link @fluidframework/core-interfaces#IFluidHandleContext} that has a route
65
+ * to this handle.
66
+ */
67
+ constructor(
68
+ protected readonly value: T | Promise<T>,
69
+ public readonly path: string,
70
+ public readonly routeContext: IFluidHandleContext,
71
+ ) {
72
+ this.absolutePath = generateHandleContextPath(path, this.routeContext);
73
+ }
56
74
 
57
- public async get(): Promise<any> {
58
- return this.value;
59
- }
75
+ /**
76
+ * {@inheritDoc @fluidframework/core-interfaces#IFluidHandle.get}
77
+ */
78
+ public async get(): Promise<any> {
79
+ // Note that this return works whether we received a T or a Promise<T> for this.value in the constructor.
80
+ return this.value;
81
+ }
60
82
 
61
- public attachGraph(): void {
62
- if (this.visible) {
63
- return;
64
- }
83
+ /**
84
+ * {@inheritDoc @fluidframework/core-interfaces#IFluidHandle.attachGraph }
85
+ */
86
+ public attachGraph(): void {
87
+ if (this.visible) {
88
+ return;
89
+ }
65
90
 
66
- this.locallyVisible = true;
67
- this.pendingHandlesToMakeVisible.forEach((handle) => {
68
- handle.attachGraph();
69
- });
70
- this.pendingHandlesToMakeVisible.clear();
71
- this.routeContext.attachGraph();
72
- }
91
+ this.locallyVisible = true;
92
+ this.pendingHandlesToMakeVisible.forEach((handle) => {
93
+ handle.attachGraph();
94
+ });
95
+ this.pendingHandlesToMakeVisible.clear();
96
+ this.routeContext.attachGraph();
97
+ }
73
98
 
74
- public bind(handle: IFluidHandle) {
75
- // If this handle is visible, attach the graph of the incoming handle as well.
76
- if (this.visible) {
77
- handle.attachGraph();
78
- return;
79
- }
80
- this.pendingHandlesToMakeVisible.add(handle);
81
- }
99
+ /**
100
+ * {@inheritDoc @fluidframework/core-interfaces#IFluidHandle.bind}
101
+ */
102
+ public bind(handle: IFluidHandle) {
103
+ // If this handle is visible, attach the graph of the incoming handle as well.
104
+ if (this.visible) {
105
+ handle.attachGraph();
106
+ return;
107
+ }
108
+ this.pendingHandlesToMakeVisible.add(handle);
109
+ }
82
110
  }
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";