@fluidframework/datastore 2.41.0-338401 → 2.42.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 (76) hide show
  1. package/.eslintrc.cjs +1 -4
  2. package/CHANGELOG.md +8 -0
  3. package/dist/channelContext.d.ts +7 -5
  4. package/dist/channelContext.d.ts.map +1 -1
  5. package/dist/channelContext.js +3 -1
  6. package/dist/channelContext.js.map +1 -1
  7. package/dist/channelDeltaConnection.d.ts +5 -5
  8. package/dist/channelDeltaConnection.d.ts.map +1 -1
  9. package/dist/channelDeltaConnection.js +7 -6
  10. package/dist/channelDeltaConnection.js.map +1 -1
  11. package/dist/channelStorageService.js +2 -2
  12. package/dist/channelStorageService.js.map +1 -1
  13. package/dist/dataStoreRuntime.d.ts +20 -0
  14. package/dist/dataStoreRuntime.d.ts.map +1 -1
  15. package/dist/dataStoreRuntime.js +125 -48
  16. package/dist/dataStoreRuntime.js.map +1 -1
  17. package/dist/fluidHandle.d.ts.map +1 -1
  18. package/dist/fluidHandle.js +6 -2
  19. package/dist/fluidHandle.js.map +1 -1
  20. package/dist/localChannelContext.d.ts +8 -6
  21. package/dist/localChannelContext.d.ts.map +1 -1
  22. package/dist/localChannelContext.js +8 -6
  23. package/dist/localChannelContext.js.map +1 -1
  24. package/dist/localChannelStorageService.d.ts.map +1 -1
  25. package/dist/localChannelStorageService.js +6 -4
  26. package/dist/localChannelStorageService.js.map +1 -1
  27. package/dist/packageVersion.d.ts +1 -1
  28. package/dist/packageVersion.d.ts.map +1 -1
  29. package/dist/packageVersion.js +1 -1
  30. package/dist/packageVersion.js.map +1 -1
  31. package/dist/remoteChannelContext.d.ts +7 -5
  32. package/dist/remoteChannelContext.d.ts.map +1 -1
  33. package/dist/remoteChannelContext.js +5 -4
  34. package/dist/remoteChannelContext.js.map +1 -1
  35. package/lib/channelContext.d.ts +7 -5
  36. package/lib/channelContext.d.ts.map +1 -1
  37. package/lib/channelContext.js +3 -1
  38. package/lib/channelContext.js.map +1 -1
  39. package/lib/channelDeltaConnection.d.ts +5 -5
  40. package/lib/channelDeltaConnection.d.ts.map +1 -1
  41. package/lib/channelDeltaConnection.js +7 -6
  42. package/lib/channelDeltaConnection.js.map +1 -1
  43. package/lib/channelStorageService.js +2 -2
  44. package/lib/channelStorageService.js.map +1 -1
  45. package/lib/dataStoreRuntime.d.ts +20 -0
  46. package/lib/dataStoreRuntime.d.ts.map +1 -1
  47. package/lib/dataStoreRuntime.js +125 -48
  48. package/lib/dataStoreRuntime.js.map +1 -1
  49. package/lib/fluidHandle.d.ts.map +1 -1
  50. package/lib/fluidHandle.js +6 -2
  51. package/lib/fluidHandle.js.map +1 -1
  52. package/lib/localChannelContext.d.ts +8 -6
  53. package/lib/localChannelContext.d.ts.map +1 -1
  54. package/lib/localChannelContext.js +8 -6
  55. package/lib/localChannelContext.js.map +1 -1
  56. package/lib/localChannelStorageService.d.ts.map +1 -1
  57. package/lib/localChannelStorageService.js +6 -4
  58. package/lib/localChannelStorageService.js.map +1 -1
  59. package/lib/packageVersion.d.ts +1 -1
  60. package/lib/packageVersion.d.ts.map +1 -1
  61. package/lib/packageVersion.js +1 -1
  62. package/lib/packageVersion.js.map +1 -1
  63. package/lib/remoteChannelContext.d.ts +7 -5
  64. package/lib/remoteChannelContext.d.ts.map +1 -1
  65. package/lib/remoteChannelContext.js +5 -4
  66. package/lib/remoteChannelContext.js.map +1 -1
  67. package/package.json +16 -16
  68. package/src/channelContext.ts +7 -5
  69. package/src/channelDeltaConnection.ts +19 -19
  70. package/src/channelStorageService.ts +3 -3
  71. package/src/dataStoreRuntime.ts +174 -75
  72. package/src/fluidHandle.ts +7 -3
  73. package/src/localChannelContext.ts +18 -16
  74. package/src/localChannelStorageService.ts +6 -4
  75. package/src/packageVersion.ts +1 -1
  76. package/src/remoteChannelContext.ts +19 -19
@@ -42,7 +42,9 @@ import { ISharedObjectRegistry } from "./dataStoreRuntime.js";
42
42
  */
43
43
  export abstract class LocalChannelContextBase implements IChannelContext {
44
44
  private globallyVisible = false;
45
- /** Tracks the messages for this channel that are sent while it's not loaded */
45
+ /**
46
+ * Tracks the messages for this channel that are sent while it's not loaded
47
+ */
46
48
  protected pendingMessagesState: IPendingMessagesState = {
47
49
  messageCollections: [],
48
50
  pendingCount: 0,
@@ -57,7 +59,7 @@ export abstract class LocalChannelContextBase implements IChannelContext {
57
59
  assert(!this.id.includes("/"), 0x30f /* Channel context ID cannot contain slashes */);
58
60
  }
59
61
 
60
- protected get isGloballyVisible() {
62
+ protected get isGloballyVisible(): boolean {
61
63
  return this.globallyVisible;
62
64
  }
63
65
 
@@ -72,7 +74,7 @@ export abstract class LocalChannelContextBase implements IChannelContext {
72
74
  return this._channel !== undefined;
73
75
  }
74
76
 
75
- public setConnectionState(connected: boolean, clientId?: string) {
77
+ public setConnectionState(connected: boolean, clientId?: string): void {
76
78
  // Connection events are ignored if the data store is not yet globallyVisible or loaded
77
79
  if (this.globallyVisible && this.isLoaded) {
78
80
  this.services.value.deltaConnection.setConnectionState(connected);
@@ -101,13 +103,13 @@ export abstract class LocalChannelContextBase implements IChannelContext {
101
103
  );
102
104
  const propsCopy = {
103
105
  ...messageCollection,
104
- messagesContent: Array.from(messageCollection.messagesContent),
106
+ messagesContent: [...messageCollection.messagesContent],
105
107
  };
106
108
  this.pendingMessagesState.messageCollections.push(propsCopy);
107
109
  }
108
110
  }
109
111
 
110
- public reSubmit(content: any, localOpMetadata: unknown, squash: boolean) {
112
+ public reSubmit(content: unknown, localOpMetadata: unknown, squash: boolean): void {
111
113
  assert(this.isLoaded, 0x18a /* "Channel should be loaded to resubmit ops" */);
112
114
  assert(
113
115
  this.globallyVisible,
@@ -115,7 +117,7 @@ export abstract class LocalChannelContextBase implements IChannelContext {
115
117
  );
116
118
  this.services.value.deltaConnection.reSubmit(content, localOpMetadata, squash);
117
119
  }
118
- public rollback(content: any, localOpMetadata: unknown) {
120
+ public rollback(content: unknown, localOpMetadata: unknown): void {
119
121
  assert(this.isLoaded, 0x2ee /* "Channel should be loaded to rollback ops" */);
120
122
  assert(
121
123
  this.globallyVisible,
@@ -198,7 +200,7 @@ export abstract class LocalChannelContextBase implements IChannelContext {
198
200
  return channel.getGCData(fullGC);
199
201
  }
200
202
 
201
- public updateUsedRoutes(usedRoutes: string[]) {
203
+ public updateUsedRoutes(usedRoutes: string[]): void {
202
204
  /**
203
205
  * Currently, DDSes are always considered referenced and are not garbage collected.
204
206
  * Once we have GC at DDS level, this channel context's used routes will be updated as per the passed
@@ -216,7 +218,7 @@ export class RehydratedLocalChannelContext extends LocalChannelContextBase {
216
218
  dataStoreContext: IFluidDataStoreContext,
217
219
  storageService: IDocumentStorageService,
218
220
  logger: ITelemetryLoggerExt,
219
- submitFn: (content: any, localOpMetadata: unknown) => void,
221
+ submitFn: (content: unknown, localOpMetadata: unknown) => void,
220
222
  dirtyFn: (address: string) => void,
221
223
  private readonly snapshotTree: ISnapshotTree,
222
224
  extraBlob?: Map<string, ArrayBufferLike>,
@@ -267,9 +269,9 @@ export class RehydratedLocalChannelContext extends LocalChannelContextBase {
267
269
  this.services.value.deltaConnection.processMessages(messageCollection);
268
270
  }
269
271
  return channel;
270
- } catch (err) {
272
+ } catch (error) {
271
273
  throw DataProcessingError.wrapIfUnrecognized(
272
- err,
274
+ error,
273
275
  "rehydratedLocalChannelContextFailedToLoadChannel",
274
276
  undefined,
275
277
  );
@@ -282,7 +284,7 @@ export class RehydratedLocalChannelContext extends LocalChannelContextBase {
282
284
  };
283
285
  }
284
286
 
285
- public override applyStashedOp(content) {
287
+ public override applyStashedOp(content: unknown): unknown {
286
288
  return this.services.value.deltaConnection.applyStashedOp(content);
287
289
  }
288
290
 
@@ -293,12 +295,12 @@ export class RehydratedLocalChannelContext extends LocalChannelContextBase {
293
295
  let sanitize = false;
294
296
  const blobsContents = snapshotTree.blobsContents;
295
297
  if (blobsContents !== undefined) {
296
- Object.entries(blobsContents).forEach(([key, value]) => {
298
+ for (const [key, value] of Object.entries(blobsContents)) {
297
299
  blobMap.set(key, value);
298
300
  if (snapshotTree.blobs[key] !== undefined) {
299
301
  sanitize = true;
300
302
  }
301
- });
303
+ }
302
304
  }
303
305
  for (const value of Object.values(snapshotTree.trees)) {
304
306
  sanitize = sanitize || this.isSnapshotInOldFormatAndCollectBlobs(value, blobMap);
@@ -306,7 +308,7 @@ export class RehydratedLocalChannelContext extends LocalChannelContextBase {
306
308
  return sanitize;
307
309
  }
308
310
 
309
- private sanitizeSnapshot(snapshotTree: ISnapshotTree) {
311
+ private sanitizeSnapshot(snapshotTree: ISnapshotTree): void {
310
312
  const blobMapInitial = new Map(Object.entries(snapshotTree.blobs));
311
313
  for (const [blobName, blobId] of blobMapInitial.entries()) {
312
314
  const blobValue = blobMapInitial.get(blobId);
@@ -329,7 +331,7 @@ export class LocalChannelContext extends LocalChannelContextBase {
329
331
  dataStoreContext: IFluidDataStoreContext,
330
332
  storageService: IDocumentStorageService,
331
333
  logger: ITelemetryLoggerExt,
332
- submitFn: (content: any, localOpMetadata: unknown) => void,
334
+ submitFn: (content: unknown, localOpMetadata: unknown) => void,
333
335
  dirtyFn: (address: string) => void,
334
336
  ) {
335
337
  super(
@@ -355,7 +357,7 @@ export class LocalChannelContext extends LocalChannelContextBase {
355
357
  };
356
358
  }
357
359
 
358
- public applyStashedOp() {
360
+ public applyStashedOp(): void {
359
361
  throw new Error("no stashed ops on local channel");
360
362
  }
361
363
  }
@@ -21,7 +21,7 @@ export class LocalChannelStorageService implements IChannelStorageService {
21
21
 
22
22
  public async contains(path: string): Promise<boolean> {
23
23
  const blob = this.readBlobSync(path);
24
- return blob !== undefined ? blob.contents !== undefined : false;
24
+ return blob === undefined ? false : blob.contents !== undefined;
25
25
  }
26
26
 
27
27
  public async list(path: string): Promise<string[]> {
@@ -35,17 +35,19 @@ export class LocalChannelStorageService implements IChannelStorageService {
35
35
  private readBlobSyncInternal(path: string, tree: ITree): IBlob | undefined {
36
36
  for (const entry of tree.entries) {
37
37
  switch (entry.type) {
38
- case TreeEntry.Blob:
38
+ case TreeEntry.Blob: {
39
39
  if (path === entry.path) {
40
40
  return entry.value;
41
41
  }
42
42
  break;
43
+ }
43
44
 
44
- case TreeEntry.Tree:
45
+ case TreeEntry.Tree: {
45
46
  if (path.startsWith(entry.path)) {
46
- return this.readBlobSyncInternal(path.substr(entry.path.length + 1), entry.value);
47
+ return this.readBlobSyncInternal(path.slice(entry.path.length + 1), entry.value);
47
48
  }
48
49
  break;
50
+ }
49
51
 
50
52
  default:
51
53
  }
@@ -6,4 +6,4 @@
6
6
  */
7
7
 
8
8
  export const pkgName = "@fluidframework/datastore";
9
- export const pkgVersion = "2.41.0-338401";
9
+ export const pkgVersion = "2.42.0";
@@ -43,7 +43,9 @@ import { ISharedObjectRegistry } from "./dataStoreRuntime.js";
43
43
 
44
44
  export class RemoteChannelContext implements IChannelContext {
45
45
  private isLoaded = false;
46
- /** Tracks the messages for this channel that are sent while it's not loaded */
46
+ /**
47
+ * Tracks the messages for this channel that are sent while it's not loaded
48
+ */
47
49
  private pendingMessagesState: IPendingMessagesState | undefined = {
48
50
  messageCollections: [],
49
51
  pendingCount: 0,
@@ -60,7 +62,7 @@ export class RemoteChannelContext implements IChannelContext {
60
62
  runtime: IFluidDataStoreRuntime,
61
63
  dataStoreContext: IFluidDataStoreContext,
62
64
  storageService: IDocumentStorageService,
63
- submitFn: (content: any, localOpMetadata: unknown) => void,
65
+ submitFn: (content: unknown, localOpMetadata: unknown) => void,
64
66
  dirtyFn: (address: string) => void,
65
67
  private readonly id: string,
66
68
  baseSnapshot: ISnapshotTree,
@@ -128,21 +130,19 @@ export class RemoteChannelContext implements IChannelContext {
128
130
  return this.channel;
129
131
  });
130
132
 
131
- const thisSummarizeInternal = async (
132
- fullTree: boolean,
133
- trackState: boolean,
134
- telemetryContext?: ITelemetryContext,
135
- incrementalSummaryContext?: IExperimentalIncrementalSummaryContext,
136
- ) =>
137
- this.summarizeInternal(
133
+ this.summarizerNode = createSummarizerNode(
134
+ async (
138
135
  fullTree,
139
136
  trackState,
140
137
  telemetryContext,
141
138
  incrementalSummaryContext,
142
- );
143
-
144
- this.summarizerNode = createSummarizerNode(
145
- thisSummarizeInternal,
139
+ ): Promise<ISummarizeInternalResult> =>
140
+ this.summarizeInternal(
141
+ fullTree,
142
+ trackState,
143
+ telemetryContext,
144
+ incrementalSummaryContext,
145
+ ),
146
146
  async (fullGC?: boolean) => this.getGCDataInternal(fullGC),
147
147
  );
148
148
 
@@ -157,7 +157,7 @@ export class RemoteChannelContext implements IChannelContext {
157
157
  return this.channelP;
158
158
  }
159
159
 
160
- public setConnectionState(connected: boolean, clientId?: string) {
160
+ public setConnectionState(connected: boolean, clientId?: string): void {
161
161
  // Connection events are ignored if the data store is not yet loaded
162
162
  if (!this.isLoaded) {
163
163
  return;
@@ -166,7 +166,7 @@ export class RemoteChannelContext implements IChannelContext {
166
166
  this.services.deltaConnection.setConnectionState(connected);
167
167
  }
168
168
 
169
- public applyStashedOp(content: any): unknown {
169
+ public applyStashedOp(content: unknown): unknown {
170
170
  assert(this.isLoaded, 0x194 /* "Remote channel must be loaded when rebasing op" */);
171
171
  return this.services.deltaConnection.applyStashedOp(content);
172
172
  }
@@ -189,7 +189,7 @@ export class RemoteChannelContext implements IChannelContext {
189
189
  );
190
190
  this.pendingMessagesState.messageCollections.push({
191
191
  ...messageCollection,
192
- messagesContent: Array.from(messagesContent),
192
+ messagesContent: [...messagesContent],
193
193
  });
194
194
  this.pendingMessagesState.pendingCount += messagesContent.length;
195
195
  this.thresholdOpsCounter.sendIfMultiple(
@@ -199,13 +199,13 @@ export class RemoteChannelContext implements IChannelContext {
199
199
  }
200
200
  }
201
201
 
202
- public reSubmit(content: any, localOpMetadata: unknown, squash: boolean) {
202
+ public reSubmit(content: unknown, localOpMetadata: unknown, squash: boolean): void {
203
203
  assert(this.isLoaded, 0x196 /* "Remote channel must be loaded when resubmitting op" */);
204
204
 
205
205
  this.services.deltaConnection.reSubmit(content, localOpMetadata, squash);
206
206
  }
207
207
 
208
- public rollback(content: any, localOpMetadata: unknown) {
208
+ public rollback(content: unknown, localOpMetadata: unknown): void {
209
209
  assert(this.isLoaded, 0x2f0 /* "Remote channel must be loaded when rolling back op" */);
210
210
 
211
211
  this.services.deltaConnection.rollback(content, localOpMetadata);
@@ -263,7 +263,7 @@ export class RemoteChannelContext implements IChannelContext {
263
263
  return channel.getGCData(fullGC);
264
264
  }
265
265
 
266
- public updateUsedRoutes(usedRoutes: string[]) {
266
+ public updateUsedRoutes(usedRoutes: string[]): void {
267
267
  /**
268
268
  * Currently, DDSes are always considered referenced and are not garbage collected. Update the summarizer node's
269
269
  * used routes to contain a route to this channel context.