@fluidframework/container-loader 2.0.0-internal.5.3.4 → 2.0.0-internal.5.4.2

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 (78) hide show
  1. package/CHANGELOG.md +4 -0
  2. package/README.md +6 -3
  3. package/dist/audience.d.ts +1 -0
  4. package/dist/audience.d.ts.map +1 -1
  5. package/dist/audience.js +3 -1
  6. package/dist/audience.js.map +1 -1
  7. package/dist/connectionManager.d.ts.map +1 -1
  8. package/dist/connectionManager.js +6 -11
  9. package/dist/connectionManager.js.map +1 -1
  10. package/dist/container.d.ts +2 -3
  11. package/dist/container.d.ts.map +1 -1
  12. package/dist/container.js +58 -93
  13. package/dist/container.js.map +1 -1
  14. package/dist/debugLogger.d.ts +30 -0
  15. package/dist/debugLogger.d.ts.map +1 -0
  16. package/dist/debugLogger.js +96 -0
  17. package/dist/debugLogger.js.map +1 -0
  18. package/dist/deltaManager.d.ts +0 -1
  19. package/dist/deltaManager.d.ts.map +1 -1
  20. package/dist/deltaManager.js +17 -9
  21. package/dist/deltaManager.js.map +1 -1
  22. package/dist/loader.d.ts.map +1 -1
  23. package/dist/loader.js +16 -5
  24. package/dist/loader.js.map +1 -1
  25. package/dist/packageVersion.d.ts +1 -1
  26. package/dist/packageVersion.js +1 -1
  27. package/dist/packageVersion.js.map +1 -1
  28. package/dist/protocol.d.ts +4 -2
  29. package/dist/protocol.d.ts.map +1 -1
  30. package/dist/protocol.js +23 -1
  31. package/dist/protocol.js.map +1 -1
  32. package/dist/quorum.d.ts +4 -1
  33. package/dist/quorum.d.ts.map +1 -1
  34. package/dist/quorum.js +1 -13
  35. package/dist/quorum.js.map +1 -1
  36. package/lib/audience.d.ts +1 -0
  37. package/lib/audience.d.ts.map +1 -1
  38. package/lib/audience.js +3 -1
  39. package/lib/audience.js.map +1 -1
  40. package/lib/connectionManager.d.ts.map +1 -1
  41. package/lib/connectionManager.js +7 -9
  42. package/lib/connectionManager.js.map +1 -1
  43. package/lib/container.d.ts +2 -3
  44. package/lib/container.d.ts.map +1 -1
  45. package/lib/container.js +61 -96
  46. package/lib/container.js.map +1 -1
  47. package/lib/debugLogger.d.ts +30 -0
  48. package/lib/debugLogger.d.ts.map +1 -0
  49. package/lib/debugLogger.js +92 -0
  50. package/lib/debugLogger.js.map +1 -0
  51. package/lib/deltaManager.d.ts +0 -1
  52. package/lib/deltaManager.d.ts.map +1 -1
  53. package/lib/deltaManager.js +15 -4
  54. package/lib/deltaManager.js.map +1 -1
  55. package/lib/loader.d.ts.map +1 -1
  56. package/lib/loader.js +16 -5
  57. package/lib/loader.js.map +1 -1
  58. package/lib/packageVersion.d.ts +1 -1
  59. package/lib/packageVersion.js +1 -1
  60. package/lib/packageVersion.js.map +1 -1
  61. package/lib/protocol.d.ts +4 -2
  62. package/lib/protocol.d.ts.map +1 -1
  63. package/lib/protocol.js +23 -1
  64. package/lib/protocol.js.map +1 -1
  65. package/lib/quorum.d.ts +4 -1
  66. package/lib/quorum.d.ts.map +1 -1
  67. package/lib/quorum.js +0 -11
  68. package/lib/quorum.js.map +1 -1
  69. package/package.json +12 -12
  70. package/src/audience.ts +6 -0
  71. package/src/connectionManager.ts +7 -12
  72. package/src/container.ts +78 -116
  73. package/src/debugLogger.ts +113 -0
  74. package/src/deltaManager.ts +28 -4
  75. package/src/loader.ts +16 -7
  76. package/src/packageVersion.ts +1 -1
  77. package/src/protocol.ts +33 -1
  78. package/src/quorum.ts +0 -10
package/src/protocol.ts CHANGED
@@ -4,6 +4,7 @@
4
4
  */
5
5
 
6
6
  import { IAudienceOwner } from "@fluidframework/container-definitions";
7
+ import { canBeCoalescedByService } from "@fluidframework/driver-utils";
7
8
  import {
8
9
  IProtocolHandler as IBaseProtocolHandler,
9
10
  IQuorumSnapshot,
@@ -11,8 +12,12 @@ import {
11
12
  } from "@fluidframework/protocol-base";
12
13
  import {
13
14
  IDocumentAttributes,
15
+ IProcessMessageResult,
16
+ ISequencedClient,
17
+ ISequencedDocumentMessage,
14
18
  ISignalClient,
15
19
  ISignalMessage,
20
+ MessageType,
16
21
  } from "@fluidframework/protocol-definitions";
17
22
 
18
23
  // "term" was an experimental feature that is being removed. The only safe value to use is 1.
@@ -44,7 +49,8 @@ export class ProtocolHandler extends ProtocolOpHandler implements IProtocolHandl
44
49
  attributes: IDocumentAttributes,
45
50
  quorumSnapshot: IQuorumSnapshot,
46
51
  sendProposal: (key: string, value: any) => number,
47
- readonly audience: IAudienceOwner,
52
+ public readonly audience: IAudienceOwner,
53
+ private readonly shouldClientHaveLeft: (clientId: string) => boolean,
48
54
  ) {
49
55
  super(
50
56
  attributes.minimumSequenceNumber,
@@ -66,6 +72,32 @@ export class ProtocolHandler extends ProtocolOpHandler implements IProtocolHandl
66
72
  }
67
73
  }
68
74
 
75
+ public processMessage(
76
+ message: ISequencedDocumentMessage,
77
+ local: boolean,
78
+ ): IProcessMessageResult {
79
+ const client: ISequencedClient | undefined = this.quorum.getMember(message.clientId);
80
+
81
+ // Check and report if we're getting messages from a clientId that we previously
82
+ // flagged as shouldHaveLeft, or from a client that's not in the quorum but should be
83
+ if (message.clientId != null) {
84
+ if (client === undefined && message.type !== MessageType.ClientJoin) {
85
+ // pre-0.58 error message: messageClientIdMissingFromQuorum
86
+ throw new Error("Remote message's clientId is missing from the quorum");
87
+ }
88
+
89
+ // Here checking canBeCoalescedByService is used as an approximation of "is benign to process despite being unexpected".
90
+ // It's still not good to see these messages from unexpected clientIds, but since they don't harm the integrity of the
91
+ // document we don't need to blow up aggressively.
92
+ if (this.shouldClientHaveLeft(message.clientId) && !canBeCoalescedByService(message)) {
93
+ // pre-0.58 error message: messageClientIdShouldHaveLeft
94
+ throw new Error("Remote message's clientId already should have left");
95
+ }
96
+ }
97
+
98
+ return super.processMessage(message, local);
99
+ }
100
+
69
101
  public processSignal(message: ISignalMessage) {
70
102
  const innerContent = message.content as { content: any; type: string };
71
103
  switch (innerContent.type) {
package/src/quorum.ts CHANGED
@@ -2,19 +2,9 @@
2
2
  * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
3
3
  * Licensed under the MIT License.
4
4
  */
5
- import { assert } from "@fluidframework/common-utils";
6
5
  import { IFluidCodeDetails } from "@fluidframework/core-interfaces";
7
6
  import { ICommittedProposal } from "@fluidframework/protocol-definitions";
8
7
 
9
- export function getCodeDetailsFromQuorumValues(
10
- quorumValues: [string, ICommittedProposal][],
11
- ): IFluidCodeDetails {
12
- const qValuesMap = new Map(quorumValues);
13
- const proposal = qValuesMap.get("code");
14
- assert(proposal !== undefined, 0x2dc /* "Cannot find code proposal" */);
15
- return proposal?.value as IFluidCodeDetails;
16
- }
17
-
18
8
  export function initQuorumValuesFromCodeDetails(
19
9
  source: IFluidCodeDetails,
20
10
  ): [string, ICommittedProposal][] {