@fluidframework/container-loader 0.56.3 → 0.57.0-51086
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.
- package/README.md +3 -3
- package/dist/connectionManager.d.ts +2 -2
- package/dist/connectionManager.d.ts.map +1 -1
- package/dist/connectionManager.js +28 -20
- package/dist/connectionManager.js.map +1 -1
- package/dist/container.d.ts +1 -3
- package/dist/container.d.ts.map +1 -1
- package/dist/container.js +12 -97
- package/dist/container.js.map +1 -1
- package/dist/containerContext.d.ts +2 -7
- package/dist/containerContext.d.ts.map +1 -1
- package/dist/containerContext.js +0 -12
- package/dist/containerContext.js.map +1 -1
- package/dist/contracts.d.ts +2 -2
- package/dist/contracts.d.ts.map +1 -1
- package/dist/contracts.js.map +1 -1
- package/dist/deltaManager.d.ts.map +1 -1
- package/dist/deltaManager.js +3 -14
- package/dist/deltaManager.js.map +1 -1
- package/dist/packageVersion.d.ts +1 -1
- package/dist/packageVersion.d.ts.map +1 -1
- package/dist/packageVersion.js +1 -1
- package/dist/packageVersion.js.map +1 -1
- package/lib/connectionManager.d.ts +2 -2
- package/lib/connectionManager.d.ts.map +1 -1
- package/lib/connectionManager.js +28 -20
- package/lib/connectionManager.js.map +1 -1
- package/lib/container.d.ts +1 -3
- package/lib/container.d.ts.map +1 -1
- package/lib/container.js +13 -98
- package/lib/container.js.map +1 -1
- package/lib/containerContext.d.ts +2 -7
- package/lib/containerContext.d.ts.map +1 -1
- package/lib/containerContext.js +0 -12
- package/lib/containerContext.js.map +1 -1
- package/lib/contracts.d.ts +2 -2
- package/lib/contracts.d.ts.map +1 -1
- package/lib/contracts.js.map +1 -1
- package/lib/deltaManager.d.ts.map +1 -1
- package/lib/deltaManager.js +4 -15
- package/lib/deltaManager.js.map +1 -1
- package/lib/packageVersion.d.ts +1 -1
- package/lib/packageVersion.d.ts.map +1 -1
- package/lib/packageVersion.js +1 -1
- package/lib/packageVersion.js.map +1 -1
- package/package.json +8 -8
- package/src/connectionManager.ts +54 -45
- package/src/container.ts +15 -117
- package/src/containerContext.ts +0 -16
- package/src/contracts.ts +2 -1
- package/src/deltaManager.ts +4 -16
- package/src/packageVersion.ts +1 -1
package/src/container.ts
CHANGED
|
@@ -57,14 +57,12 @@ import {
|
|
|
57
57
|
ProtocolOpHandler,
|
|
58
58
|
} from "@fluidframework/protocol-base";
|
|
59
59
|
import {
|
|
60
|
-
FileMode,
|
|
61
60
|
IClient,
|
|
62
61
|
IClientConfiguration,
|
|
63
62
|
IClientDetails,
|
|
64
63
|
ICommittedProposal,
|
|
65
64
|
IDocumentAttributes,
|
|
66
65
|
IDocumentMessage,
|
|
67
|
-
IPendingProposal,
|
|
68
66
|
IProcessMessageResult,
|
|
69
67
|
IQuorumClients,
|
|
70
68
|
IQuorumProposals,
|
|
@@ -76,12 +74,9 @@ import {
|
|
|
76
74
|
ISnapshotTree,
|
|
77
75
|
ISummaryContent,
|
|
78
76
|
ISummaryTree,
|
|
79
|
-
ITree,
|
|
80
|
-
ITreeEntry,
|
|
81
77
|
IVersion,
|
|
82
78
|
MessageType,
|
|
83
79
|
SummaryType,
|
|
84
|
-
TreeEntry,
|
|
85
80
|
} from "@fluidframework/protocol-definitions";
|
|
86
81
|
import {
|
|
87
82
|
ChildLogger,
|
|
@@ -370,7 +365,7 @@ export class Container extends EventEmitterWithErrorHandling<IContainerEvents> i
|
|
|
370
365
|
}
|
|
371
366
|
|
|
372
367
|
private _storageService: IDocumentStorageService & IDisposable | undefined;
|
|
373
|
-
private get storageService(): IDocumentStorageService
|
|
368
|
+
private get storageService(): IDocumentStorageService {
|
|
374
369
|
if (this._storageService === undefined) {
|
|
375
370
|
throw new Error("Attempted to access storageService before it was defined");
|
|
376
371
|
}
|
|
@@ -647,7 +642,7 @@ export class Container extends EventEmitterWithErrorHandling<IContainerEvents> i
|
|
|
647
642
|
this.lastVisible = performance.now();
|
|
648
643
|
} else {
|
|
649
644
|
// settimeout so this will hopefully fire after disconnect event if being hidden caused it
|
|
650
|
-
setTimeout(() => this.lastVisible = undefined, 0);
|
|
645
|
+
setTimeout(() => { this.lastVisible = undefined; }, 0);
|
|
651
646
|
}
|
|
652
647
|
};
|
|
653
648
|
document.addEventListener("visibilitychange", this.visibilityEventHandler);
|
|
@@ -683,7 +678,7 @@ export class Container extends EventEmitterWithErrorHandling<IContainerEvents> i
|
|
|
683
678
|
break;
|
|
684
679
|
default:
|
|
685
680
|
}
|
|
686
|
-
}).catch((error) =>
|
|
681
|
+
}).catch((error) => {
|
|
687
682
|
this.mc.logger.sendErrorEvent({ eventName: "RaiseConnectedEventError" }, error);
|
|
688
683
|
});
|
|
689
684
|
});
|
|
@@ -900,25 +895,6 @@ export class Container extends EventEmitterWithErrorHandling<IContainerEvents> i
|
|
|
900
895
|
);
|
|
901
896
|
}
|
|
902
897
|
|
|
903
|
-
public async snapshot(tagMessage: string, fullTree: boolean = false): Promise<void> {
|
|
904
|
-
// Only snapshot once a code quorum has been established
|
|
905
|
-
if (!this.protocolHandler.quorum.has("code") && !this.protocolHandler.quorum.has("code2")) {
|
|
906
|
-
this.mc.logger.sendTelemetryEvent({ eventName: "SkipSnapshot" });
|
|
907
|
-
return;
|
|
908
|
-
}
|
|
909
|
-
|
|
910
|
-
// Stop inbound message processing while we complete the snapshot
|
|
911
|
-
try {
|
|
912
|
-
await this.deltaManager.inbound.pause();
|
|
913
|
-
await this.snapshotCore(tagMessage, fullTree);
|
|
914
|
-
} catch (ex) {
|
|
915
|
-
this.mc.logger.sendErrorEvent({ eventName: "SnapshotExceptionError" }, ex);
|
|
916
|
-
throw ex;
|
|
917
|
-
} finally {
|
|
918
|
-
this.deltaManager.inbound.resume();
|
|
919
|
-
}
|
|
920
|
-
}
|
|
921
|
-
|
|
922
898
|
public setAutoReconnect(reconnect: boolean) {
|
|
923
899
|
if (this.closed) {
|
|
924
900
|
throw new Error("Attempting to setAutoReconnect() a closed Container");
|
|
@@ -1040,86 +1016,6 @@ export class Container extends EventEmitterWithErrorHandling<IContainerEvents> i
|
|
|
1040
1016
|
this.close(new GenericError("existingContextDoesNotSatisfyIncomingProposal"));
|
|
1041
1017
|
}
|
|
1042
1018
|
|
|
1043
|
-
private async snapshotCore(tagMessage: string, fullTree: boolean = false) {
|
|
1044
|
-
// Snapshots base document state and currently running context
|
|
1045
|
-
const root = this.snapshotBase();
|
|
1046
|
-
const dataStoreEntries = await this.context.snapshot(tagMessage, fullTree);
|
|
1047
|
-
|
|
1048
|
-
// And then combine
|
|
1049
|
-
if (dataStoreEntries !== null) {
|
|
1050
|
-
root.entries.push(...dataStoreEntries.entries);
|
|
1051
|
-
}
|
|
1052
|
-
|
|
1053
|
-
// Generate base snapshot message
|
|
1054
|
-
const deltaDetails =
|
|
1055
|
-
`${this._deltaManager.lastSequenceNumber}:${this._deltaManager.minimumSequenceNumber}`;
|
|
1056
|
-
const message = `Commit @${deltaDetails} ${tagMessage}`;
|
|
1057
|
-
|
|
1058
|
-
// Pull in the prior version and snapshot tree to store against
|
|
1059
|
-
const lastVersion = await this.getVersion(null);
|
|
1060
|
-
|
|
1061
|
-
const parents = lastVersion !== undefined ? [lastVersion.id] : [];
|
|
1062
|
-
|
|
1063
|
-
// Write the full snapshot
|
|
1064
|
-
return this.storageService.write(root, parents, message, "");
|
|
1065
|
-
}
|
|
1066
|
-
|
|
1067
|
-
private snapshotBase(): ITree {
|
|
1068
|
-
const entries: ITreeEntry[] = [];
|
|
1069
|
-
|
|
1070
|
-
const quorumSnapshot = this.protocolHandler.quorum.snapshot();
|
|
1071
|
-
entries.push({
|
|
1072
|
-
mode: FileMode.File,
|
|
1073
|
-
path: "quorumMembers",
|
|
1074
|
-
type: TreeEntry.Blob,
|
|
1075
|
-
value: {
|
|
1076
|
-
contents: JSON.stringify(quorumSnapshot.members),
|
|
1077
|
-
encoding: "utf-8",
|
|
1078
|
-
},
|
|
1079
|
-
});
|
|
1080
|
-
entries.push({
|
|
1081
|
-
mode: FileMode.File,
|
|
1082
|
-
path: "quorumProposals",
|
|
1083
|
-
type: TreeEntry.Blob,
|
|
1084
|
-
value: {
|
|
1085
|
-
contents: JSON.stringify(quorumSnapshot.proposals),
|
|
1086
|
-
encoding: "utf-8",
|
|
1087
|
-
},
|
|
1088
|
-
});
|
|
1089
|
-
entries.push({
|
|
1090
|
-
mode: FileMode.File,
|
|
1091
|
-
path: "quorumValues",
|
|
1092
|
-
type: TreeEntry.Blob,
|
|
1093
|
-
value: {
|
|
1094
|
-
contents: JSON.stringify(quorumSnapshot.values),
|
|
1095
|
-
encoding: "utf-8",
|
|
1096
|
-
},
|
|
1097
|
-
});
|
|
1098
|
-
|
|
1099
|
-
// Save attributes for the document
|
|
1100
|
-
const documentAttributes = {
|
|
1101
|
-
minimumSequenceNumber: this._deltaManager.minimumSequenceNumber,
|
|
1102
|
-
sequenceNumber: this._deltaManager.lastSequenceNumber,
|
|
1103
|
-
term: this._deltaManager.referenceTerm,
|
|
1104
|
-
};
|
|
1105
|
-
entries.push({
|
|
1106
|
-
mode: FileMode.File,
|
|
1107
|
-
path: ".attributes",
|
|
1108
|
-
type: TreeEntry.Blob,
|
|
1109
|
-
value: {
|
|
1110
|
-
contents: JSON.stringify(documentAttributes),
|
|
1111
|
-
encoding: "utf-8",
|
|
1112
|
-
},
|
|
1113
|
-
});
|
|
1114
|
-
|
|
1115
|
-
// Output the tree
|
|
1116
|
-
const root: ITree = {
|
|
1117
|
-
entries,
|
|
1118
|
-
};
|
|
1119
|
-
|
|
1120
|
-
return root;
|
|
1121
|
-
}
|
|
1122
|
-
|
|
1123
1019
|
private async getVersion(version: string | null): Promise<IVersion | undefined> {
|
|
1124
1020
|
const versions = await this.storageService.getVersions(version, 1);
|
|
1125
1021
|
return versions[0];
|
|
@@ -1425,7 +1321,8 @@ export class Container extends EventEmitterWithErrorHandling<IContainerEvents> i
|
|
|
1425
1321
|
proposals,
|
|
1426
1322
|
values,
|
|
1427
1323
|
(key, value) => this.submitMessage(MessageType.Propose, { key, value }),
|
|
1428
|
-
|
|
1324
|
+
// Quorum proposal rejection removed, delete when protocol-base 0.1035 is integrated.
|
|
1325
|
+
() => {});
|
|
1429
1326
|
|
|
1430
1327
|
const protocolLogger = ChildLogger.create(this.subLogger, "ProtocolHandler");
|
|
1431
1328
|
|
|
@@ -1442,7 +1339,7 @@ export class Container extends EventEmitterWithErrorHandling<IContainerEvents> i
|
|
|
1442
1339
|
this.connectionStateHandler.receivedRemoveMemberEvent(clientId);
|
|
1443
1340
|
});
|
|
1444
1341
|
|
|
1445
|
-
protocol.quorum.on("addProposal", (proposal:
|
|
1342
|
+
protocol.quorum.on("addProposal", (proposal: ISequencedProposal) => {
|
|
1446
1343
|
if (proposal.key === "code" || proposal.key === "code2") {
|
|
1447
1344
|
this.emit("codeDetailsProposed", proposal.value, proposal);
|
|
1448
1345
|
}
|
|
@@ -1840,10 +1737,6 @@ export class Container extends EventEmitterWithErrorHandling<IContainerEvents> i
|
|
|
1840
1737
|
pendingLocalState?: unknown,
|
|
1841
1738
|
) {
|
|
1842
1739
|
assert(this._context?.disposed !== false, 0x0dd /* "Existing context not disposed" */);
|
|
1843
|
-
// If this assert fires, our state tracking is likely not synchronized between COntainer & runtime.
|
|
1844
|
-
if (this._dirtyContainer) {
|
|
1845
|
-
this.mc.logger.sendErrorEvent({ eventName: "DirtyContainerReloadContainer" });
|
|
1846
|
-
}
|
|
1847
1740
|
|
|
1848
1741
|
// The relative loader will proxy requests to '/' to the loader itself assuming no non-cache flags
|
|
1849
1742
|
// are set. Global requests will still go directly to the loader
|
|
@@ -1862,10 +1755,7 @@ export class Container extends EventEmitterWithErrorHandling<IContainerEvents> i
|
|
|
1862
1755
|
(message) => this.submitSignal(message),
|
|
1863
1756
|
(error?: ICriticalContainerError) => this.close(error),
|
|
1864
1757
|
Container.version,
|
|
1865
|
-
(dirty: boolean) =>
|
|
1866
|
-
this._dirtyContainer = dirty;
|
|
1867
|
-
this.emit(dirty ? dirtyContainerEvent : savedContainerEvent);
|
|
1868
|
-
},
|
|
1758
|
+
(dirty: boolean) => this.updateDirtyContainerState(dirty),
|
|
1869
1759
|
existing,
|
|
1870
1760
|
pendingLocalState,
|
|
1871
1761
|
);
|
|
@@ -1873,6 +1763,14 @@ export class Container extends EventEmitterWithErrorHandling<IContainerEvents> i
|
|
|
1873
1763
|
this.emit("contextChanged", codeDetails);
|
|
1874
1764
|
}
|
|
1875
1765
|
|
|
1766
|
+
private updateDirtyContainerState(dirty: boolean) {
|
|
1767
|
+
if (this._dirtyContainer === dirty) {
|
|
1768
|
+
return;
|
|
1769
|
+
}
|
|
1770
|
+
this._dirtyContainer = dirty;
|
|
1771
|
+
this.emit(dirty ? dirtyContainerEvent : savedContainerEvent);
|
|
1772
|
+
}
|
|
1773
|
+
|
|
1876
1774
|
private logContainerError(warning: ContainerWarning) {
|
|
1877
1775
|
this.mc.logger.sendErrorEvent({ eventName: "ContainerWarning" }, warning);
|
|
1878
1776
|
}
|
package/src/containerContext.ts
CHANGED
|
@@ -6,7 +6,6 @@
|
|
|
6
6
|
import { ITelemetryLogger } from "@fluidframework/common-definitions";
|
|
7
7
|
import {
|
|
8
8
|
IFluidObject,
|
|
9
|
-
IFluidConfiguration,
|
|
10
9
|
IRequest,
|
|
11
10
|
IResponse,
|
|
12
11
|
IFluidCodeDetails,
|
|
@@ -39,7 +38,6 @@ import {
|
|
|
39
38
|
ISignalMessage,
|
|
40
39
|
ISnapshotTree,
|
|
41
40
|
ISummaryTree,
|
|
42
|
-
ITree,
|
|
43
41
|
IVersion,
|
|
44
42
|
MessageType,
|
|
45
43
|
} from "@fluidframework/protocol-definitions";
|
|
@@ -129,16 +127,6 @@ export class ContainerContext implements IContainerContext {
|
|
|
129
127
|
return this.container.options;
|
|
130
128
|
}
|
|
131
129
|
|
|
132
|
-
/**
|
|
133
|
-
* @deprecated 0.55 - Configuration is not recommended to be used and will be removed in an upcoming release.
|
|
134
|
-
*/
|
|
135
|
-
public get configuration(): IFluidConfiguration {
|
|
136
|
-
const config: Partial<IFluidConfiguration> = {
|
|
137
|
-
scopes: this.container.scopes,
|
|
138
|
-
};
|
|
139
|
-
return config as IFluidConfiguration;
|
|
140
|
-
}
|
|
141
|
-
|
|
142
130
|
public get baseSnapshot() {
|
|
143
131
|
return this._baseSnapshot;
|
|
144
132
|
}
|
|
@@ -215,10 +203,6 @@ export class ContainerContext implements IContainerContext {
|
|
|
215
203
|
this.deltaManager.dispose();
|
|
216
204
|
}
|
|
217
205
|
|
|
218
|
-
public async snapshot(tagMessage: string = "", fullTree: boolean = false): Promise<ITree | null> {
|
|
219
|
-
return this.runtime.snapshot(tagMessage, fullTree);
|
|
220
|
-
}
|
|
221
|
-
|
|
222
206
|
public getLoadedFromVersion(): IVersion | undefined {
|
|
223
207
|
return this.container.loadedFromVersion;
|
|
224
208
|
}
|
package/src/contracts.ts
CHANGED
|
@@ -10,6 +10,7 @@ import {
|
|
|
10
10
|
IDeltaQueue,
|
|
11
11
|
ReadOnlyInfo,
|
|
12
12
|
IConnectionDetails,
|
|
13
|
+
ICriticalContainerError,
|
|
13
14
|
} from "@fluidframework/container-definitions";
|
|
14
15
|
import {
|
|
15
16
|
ConnectionMode,
|
|
@@ -96,7 +97,7 @@ export interface IConnectionManager {
|
|
|
96
97
|
/**
|
|
97
98
|
* Disposed connection manager
|
|
98
99
|
*/
|
|
99
|
-
dispose(error
|
|
100
|
+
dispose(error?: ICriticalContainerError): void;
|
|
100
101
|
}
|
|
101
102
|
|
|
102
103
|
/**
|
package/src/deltaManager.ts
CHANGED
|
@@ -47,6 +47,7 @@ import {
|
|
|
47
47
|
ThrottlingWarning,
|
|
48
48
|
CreateProcessingError,
|
|
49
49
|
DataCorruptionError,
|
|
50
|
+
extractSafePropertiesFromMessage,
|
|
50
51
|
} from "@fluidframework/container-utils";
|
|
51
52
|
import { DeltaQueue } from "./deltaQueue";
|
|
52
53
|
import {
|
|
@@ -735,6 +736,7 @@ export class DeltaManager<TConnectionManager extends IConnectionManager>
|
|
|
735
736
|
sequenceNumber: message.sequenceNumber,
|
|
736
737
|
message1,
|
|
737
738
|
message2,
|
|
739
|
+
driverVersion: undefined,
|
|
738
740
|
},
|
|
739
741
|
);
|
|
740
742
|
this.close(error);
|
|
@@ -791,7 +793,7 @@ export class DeltaManager<TConnectionManager extends IConnectionManager>
|
|
|
791
793
|
// Watch the minimum sequence number and be ready to update as needed
|
|
792
794
|
if (this.minSequenceNumber > message.minimumSequenceNumber) {
|
|
793
795
|
throw new DataCorruptionError("msnMovesBackwards", {
|
|
794
|
-
...
|
|
796
|
+
...extractSafePropertiesFromMessage(message),
|
|
795
797
|
clientId: this.connectionManager.clientId,
|
|
796
798
|
});
|
|
797
799
|
}
|
|
@@ -799,7 +801,7 @@ export class DeltaManager<TConnectionManager extends IConnectionManager>
|
|
|
799
801
|
|
|
800
802
|
if (message.sequenceNumber !== this.lastProcessedSequenceNumber + 1) {
|
|
801
803
|
throw new DataCorruptionError("nonSequentialSequenceNumber", {
|
|
802
|
-
...
|
|
804
|
+
...extractSafePropertiesFromMessage(message),
|
|
803
805
|
clientId: this.connectionManager.clientId,
|
|
804
806
|
});
|
|
805
807
|
}
|
|
@@ -937,17 +939,3 @@ export class DeltaManager<TConnectionManager extends IConnectionManager>
|
|
|
937
939
|
}
|
|
938
940
|
}
|
|
939
941
|
}
|
|
940
|
-
|
|
941
|
-
// TODO: move this elsewhere and use it more broadly for DataCorruptionError/DataProcessingError
|
|
942
|
-
function extractLogSafeMessageProperties(message: Partial<ISequencedDocumentMessage>) {
|
|
943
|
-
const safeProps = {
|
|
944
|
-
messageClientId: message.clientId,
|
|
945
|
-
sequenceNumber: message.sequenceNumber,
|
|
946
|
-
clientSequenceNumber: message.clientSequenceNumber,
|
|
947
|
-
referenceSequenceNumber: message.referenceSequenceNumber,
|
|
948
|
-
minimumSequenceNumber: message.minimumSequenceNumber,
|
|
949
|
-
messageTimestamp: message.timestamp,
|
|
950
|
-
};
|
|
951
|
-
|
|
952
|
-
return safeProps;
|
|
953
|
-
}
|
package/src/packageVersion.ts
CHANGED