@fluidframework/container-loader 2.3.0-288113 → 2.3.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 (60) hide show
  1. package/CHANGELOG.md +4 -0
  2. package/dist/connectionManager.d.ts.map +1 -1
  3. package/dist/connectionManager.js +0 -6
  4. package/dist/connectionManager.js.map +1 -1
  5. package/dist/container.d.ts.map +1 -1
  6. package/dist/container.js +7 -30
  7. package/dist/container.js.map +1 -1
  8. package/dist/containerStorageAdapter.js +1 -1
  9. package/dist/containerStorageAdapter.js.map +1 -1
  10. package/dist/deltaManager.d.ts.map +1 -1
  11. package/dist/deltaManager.js +6 -21
  12. package/dist/deltaManager.js.map +1 -1
  13. package/dist/packageVersion.d.ts +1 -1
  14. package/dist/packageVersion.d.ts.map +1 -1
  15. package/dist/packageVersion.js +1 -1
  16. package/dist/packageVersion.js.map +1 -1
  17. package/dist/protocol/protocol.d.ts.map +1 -1
  18. package/dist/protocol/protocol.js +1 -2
  19. package/dist/protocol/protocol.js.map +1 -1
  20. package/dist/serializedStateManager.d.ts.map +1 -1
  21. package/dist/serializedStateManager.js +3 -16
  22. package/dist/serializedStateManager.js.map +1 -1
  23. package/dist/utils.d.ts.map +1 -1
  24. package/dist/utils.js +2 -11
  25. package/dist/utils.js.map +1 -1
  26. package/lib/connectionManager.d.ts.map +1 -1
  27. package/lib/connectionManager.js +0 -6
  28. package/lib/connectionManager.js.map +1 -1
  29. package/lib/container.d.ts.map +1 -1
  30. package/lib/container.js +8 -31
  31. package/lib/container.js.map +1 -1
  32. package/lib/containerStorageAdapter.js +1 -1
  33. package/lib/containerStorageAdapter.js.map +1 -1
  34. package/lib/deltaManager.d.ts.map +1 -1
  35. package/lib/deltaManager.js +7 -22
  36. package/lib/deltaManager.js.map +1 -1
  37. package/lib/packageVersion.d.ts +1 -1
  38. package/lib/packageVersion.d.ts.map +1 -1
  39. package/lib/packageVersion.js +1 -1
  40. package/lib/packageVersion.js.map +1 -1
  41. package/lib/protocol/protocol.d.ts.map +1 -1
  42. package/lib/protocol/protocol.js +1 -2
  43. package/lib/protocol/protocol.js.map +1 -1
  44. package/lib/serializedStateManager.d.ts.map +1 -1
  45. package/lib/serializedStateManager.js +3 -16
  46. package/lib/serializedStateManager.js.map +1 -1
  47. package/lib/tsdoc-metadata.json +1 -1
  48. package/lib/utils.d.ts.map +1 -1
  49. package/lib/utils.js +2 -11
  50. package/lib/utils.js.map +1 -1
  51. package/package.json +17 -16
  52. package/src/connectionManager.ts +3 -9
  53. package/src/container.ts +9 -34
  54. package/src/containerStorageAdapter.ts +1 -1
  55. package/src/deltaManager.ts +11 -26
  56. package/src/packageVersion.ts +1 -1
  57. package/src/protocol/protocol.ts +1 -2
  58. package/src/serializedStateManager.ts +7 -18
  59. package/src/utils.ts +6 -15
  60. package/tsconfig.json +1 -0
@@ -30,11 +30,7 @@ import {
30
30
  type IClientDetails,
31
31
  type IClientConfiguration,
32
32
  } from "@fluidframework/driver-definitions/internal";
33
- import {
34
- MessageType2,
35
- NonRetryableError,
36
- isRuntimeMessage,
37
- } from "@fluidframework/driver-utils/internal";
33
+ import { NonRetryableError, isRuntimeMessage } from "@fluidframework/driver-utils/internal";
38
34
  import {
39
35
  type ITelemetryErrorEventExt,
40
36
  type ITelemetryGenericEventExt,
@@ -116,7 +112,7 @@ function isClientMessage(message: ISequencedDocumentMessage | IDocumentMessage):
116
112
  case MessageType.Propose:
117
113
  case MessageType.Reject:
118
114
  case MessageType.NoOp:
119
- case MessageType2.Accept:
115
+ case MessageType.Accept:
120
116
  case MessageType.Summarize: {
121
117
  return true;
122
118
  }
@@ -357,22 +353,16 @@ export class DeltaManager<TConnectionManager extends IConnectionManager>
357
353
 
358
354
  if (batch.length === 1) {
359
355
  assert(
360
- // Non null asserting here because of the length check above
361
- // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
362
- (batch[0]!.metadata as IBatchMetadata)?.batch === undefined,
356
+ (batch[0].metadata as IBatchMetadata)?.batch === undefined,
363
357
  0x3c9 /* no batch markup on single message */,
364
358
  );
365
359
  } else {
366
360
  assert(
367
- // TODO why are we non null asserting here?
368
- // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
369
- (batch[0]!.metadata as IBatchMetadata)?.batch === true,
361
+ (batch[0].metadata as IBatchMetadata)?.batch === true,
370
362
  0x3ca /* no start batch markup */,
371
363
  );
372
364
  assert(
373
- // TODO why are we non null asserting here?
374
- // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
375
- (batch[batch.length - 1]!.metadata as IBatchMetadata)?.batch === false,
365
+ (batch[batch.length - 1].metadata as IBatchMetadata)?.batch === false,
376
366
  0x3cb /* no end batch markup */,
377
367
  );
378
368
  }
@@ -490,8 +480,9 @@ export class DeltaManager<TConnectionManager extends IConnectionManager>
490
480
  if (this.handler === undefined) {
491
481
  throw new Error("Attempted to process an inbound signal without a handler attached");
492
482
  }
483
+
493
484
  this.handler.processSignal({
494
- clientId: message.clientId,
485
+ ...message,
495
486
  content: JSON.parse(message.content as string),
496
487
  });
497
488
  });
@@ -898,12 +889,8 @@ export class DeltaManager<TConnectionManager extends IConnectionManager>
898
889
  return;
899
890
  }
900
891
 
901
- // Non null asserting here because of the length check above
902
- // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
903
- const from = messages[0]!.sequenceNumber;
904
- // Non null asserting here because of the length check above
905
- // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
906
- const last = messages[messages.length - 1]!.sequenceNumber;
892
+ const from = messages[0].sequenceNumber;
893
+ const last = messages[messages.length - 1].sequenceNumber;
907
894
 
908
895
  // Report stats about missing and duplicate ops
909
896
  // This helps better understand why we fetch ops from storage, and thus may delay
@@ -970,9 +957,7 @@ export class DeltaManager<TConnectionManager extends IConnectionManager>
970
957
  }
971
958
  }
972
959
 
973
- // Non null asserting here because of the length check above
974
- // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
975
- this.updateLatestKnownOpSeqNumber(messages[messages.length - 1]!.sequenceNumber);
960
+ this.updateLatestKnownOpSeqNumber(messages[messages.length - 1].sequenceNumber);
976
961
 
977
962
  const n = this.previouslyProcessedMessage?.sequenceNumber;
978
963
  assert(
@@ -1046,7 +1031,7 @@ export class DeltaManager<TConnectionManager extends IConnectionManager>
1046
1031
  });
1047
1032
  }
1048
1033
 
1049
- // TODO Remove after SPO picks up the latest build.
1034
+ // TODO: AB#12052: Stop parsing message.contents here, let the downstream handlers do it
1050
1035
  if (
1051
1036
  typeof message.contents === "string" &&
1052
1037
  message.contents !== "" &&
@@ -6,4 +6,4 @@
6
6
  */
7
7
 
8
8
  export const pkgName = "@fluidframework/container-loader";
9
- export const pkgVersion = "2.3.0-288113";
9
+ export const pkgVersion = "2.3.1";
@@ -125,8 +125,7 @@ export class ProtocolOpHandler implements IProtocolHandler {
125
125
  }
126
126
 
127
127
  case MessageType.Propose: {
128
- // back-compat: ADO #1385: This should become unconditional eventually.
129
- // Can be done only after Container.processRemoteMessage() stops parsing content!
128
+ // This should become unconditional once DeltaManager.processInboundMessage() stops parsing content (ADO #12052)
130
129
  if (typeof message.contents === "string") {
131
130
  message.contents = JSON.parse(message.contents);
132
131
  }
@@ -188,9 +188,7 @@ export class SerializedStateManager {
188
188
  if (pendingLocalState && pendingLocalState.savedOps.length > 0) {
189
189
  const savedOpsSize = pendingLocalState.savedOps.length;
190
190
  this.lastSavedOpSequenceNumber =
191
- // Non null asserting here because of the length check above
192
- // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
193
- pendingLocalState.savedOps[savedOpsSize - 1]!.sequenceNumber;
191
+ pendingLocalState.savedOps[savedOpsSize - 1].sequenceNumber;
194
192
  }
195
193
  containerEvent.on("saved", () => this.updateSnapshotAndProcessedOpsMaybe());
196
194
  }
@@ -343,9 +341,7 @@ export class SerializedStateManager {
343
341
  if (
344
342
  snapshotSequenceNumber === undefined ||
345
343
  this.processedOps.length === 0 ||
346
- // Non null asserting here because of the length check above
347
- // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
348
- this.processedOps[this.processedOps.length - 1]!.sequenceNumber <
344
+ this.processedOps[this.processedOps.length - 1].sequenceNumber <
349
345
  this.lastSavedOpSequenceNumber ||
350
346
  this.containerDirty()
351
347
  ) {
@@ -353,13 +349,9 @@ export class SerializedStateManager {
353
349
  // Pending state would be behind the latest snapshot.
354
350
  return -1;
355
351
  }
356
- // Non null asserting here because of the length check above
357
- // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
358
- const firstProcessedOpSequenceNumber = this.processedOps[0]!.sequenceNumber;
352
+ const firstProcessedOpSequenceNumber = this.processedOps[0].sequenceNumber;
359
353
  const lastProcessedOpSequenceNumber =
360
- // Non null asserting here because of the length check above
361
- // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
362
- this.processedOps[this.processedOps.length - 1]!.sequenceNumber;
354
+ this.processedOps[this.processedOps.length - 1].sequenceNumber;
363
355
 
364
356
  if (snapshotSequenceNumber < firstProcessedOpSequenceNumber) {
365
357
  // Snapshot seq number is older than our first processed op, which could mean we're fetching
@@ -385,9 +377,7 @@ export class SerializedStateManager {
385
377
  snapshotSequenceNumber,
386
378
  firstProcessedOpSequenceNumber,
387
379
  newFirstProcessedOpSequenceNumber:
388
- // Non null asserting here because of the length check above
389
- // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
390
- this.processedOps.length === 0 ? undefined : this.processedOps[0]!.sequenceNumber,
380
+ this.processedOps.length === 0 ? undefined : this.processedOps[0].sequenceNumber,
391
381
  });
392
382
  }
393
383
  return snapshotSequenceNumber;
@@ -411,9 +401,8 @@ export class SerializedStateManager {
411
401
  ".protocol" in baseSnapshot.trees
412
402
  ? baseSnapshot.trees[".protocol"].blobs.attributes
413
403
  : baseSnapshot.blobs[".attributes"];
414
- // TODO why are we non null asserting here?
415
- // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-non-null-assertion
416
- const attributes = JSON.parse(snapshotBlobs[attributesHash!]!);
404
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
405
+ const attributes = JSON.parse(snapshotBlobs[attributesHash]);
417
406
  assert(
418
407
  // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
419
408
  attributes.sequenceNumber === 0,
package/src/utils.ts CHANGED
@@ -94,12 +94,8 @@ export function tryParseCompatibleResolvedUrl(url: string): IParsedUrl | undefin
94
94
  const match = regex.exec(parsed.pathname);
95
95
  return match?.length === 3
96
96
  ? {
97
- // Non null asserting here because of the length check above
98
- // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
99
- id: match[1]!,
100
- // Non null asserting here because of the length check above
101
- // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
102
- path: match[2]!,
97
+ id: match[1],
98
+ path: match[2],
103
99
  query,
104
100
  // URLSearchParams returns null if the param is not provided.
105
101
  version: parsed.searchParams.get("version") ?? undefined,
@@ -151,9 +147,7 @@ function convertSummaryToSnapshotAndBlobs(summary: ISummaryTree): SnapshotWithBl
151
147
  };
152
148
  const keys = Object.keys(summary.tree);
153
149
  for (const key of keys) {
154
- // TODO change this to use object.entries
155
- // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
156
- const summaryObject = summary.tree[key]!;
150
+ const summaryObject = summary.tree[key];
157
151
 
158
152
  switch (summaryObject.type) {
159
153
  case SummaryType.Tree: {
@@ -286,9 +280,8 @@ export const combineSnapshotTreeAndSnapshotBlobs = (
286
280
 
287
281
  // Process blobs in the current level
288
282
  for (const [, id] of Object.entries(baseSnapshot.blobs)) {
289
- const snapshot = snapshotBlobs[id];
290
- if (snapshot !== undefined) {
291
- blobsContents[id] = stringToBuffer(snapshot, "utf8");
283
+ if (snapshotBlobs[id]) {
284
+ blobsContents[id] = stringToBuffer(snapshotBlobs[id], "utf8");
292
285
  }
293
286
  }
294
287
 
@@ -427,9 +420,7 @@ export async function getDocumentAttributes(
427
420
  ? tree.trees[".protocol"].blobs.attributes
428
421
  : tree.blobs[".attributes"];
429
422
 
430
- // Non null asserting here because of the length check above
431
- // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
432
- const attributes = await readAndParse<IDocumentAttributes>(storage, attributesHash!);
423
+ const attributes = await readAndParse<IDocumentAttributes>(storage, attributesHash);
433
424
 
434
425
  return attributes;
435
426
  }
package/tsconfig.json CHANGED
@@ -5,6 +5,7 @@
5
5
  "compilerOptions": {
6
6
  "rootDir": "./src",
7
7
  "outDir": "./lib",
8
+ "noUncheckedIndexedAccess": false,
8
9
  "exactOptionalPropertyTypes": false,
9
10
  },
10
11
  }