@fluidframework/protocol-base
Advanced tools
Comparing version 2.0.0-178198 to 2.0.0-181438
@@ -89,3 +89,7 @@ "use strict"; | ||
// this ensures future state changes will not affect outside callers | ||
return Object.assign({ sequenceNumber: this.sequenceNumber, minimumSequenceNumber: this.minimumSequenceNumber }, this._quorum.snapshot()); | ||
return { | ||
sequenceNumber: this.sequenceNumber, | ||
minimumSequenceNumber: this.minimumSequenceNumber, | ||
...this._quorum.snapshot(), | ||
}; | ||
} | ||
@@ -92,0 +96,0 @@ } |
@@ -39,4 +39,3 @@ "use strict"; | ||
snapshot() { | ||
var _a; | ||
(_a = this.snapshotCache) !== null && _a !== void 0 ? _a : (this.snapshotCache = Array.from(this.members)); | ||
this.snapshotCache ?? (this.snapshotCache = Array.from(this.members)); | ||
return this.snapshotCache; | ||
@@ -112,4 +111,3 @@ } | ||
snapshot() { | ||
var _a, _b; | ||
(_a = this.proposalsSnapshotCache) !== null && _a !== void 0 ? _a : (this.proposalsSnapshotCache = Array.from(this.proposals).map(([sequenceNumber, proposal]) => [ | ||
this.proposalsSnapshotCache ?? (this.proposalsSnapshotCache = Array.from(this.proposals).map(([sequenceNumber, proposal]) => [ | ||
sequenceNumber, | ||
@@ -119,3 +117,3 @@ { sequenceNumber, key: proposal.key, value: proposal.value }, | ||
])); | ||
(_b = this.valuesSnapshotCache) !== null && _b !== void 0 ? _b : (this.valuesSnapshotCache = Array.from(this.values)); | ||
this.valuesSnapshotCache ?? (this.valuesSnapshotCache = Array.from(this.values)); | ||
return { | ||
@@ -136,4 +134,3 @@ proposals: this.proposalsSnapshotCache, | ||
get(key) { | ||
var _a; | ||
return (_a = this.values.get(key)) === null || _a === void 0 ? void 0 : _a.value; | ||
return this.values.get(key)?.value; | ||
} | ||
@@ -261,3 +258,24 @@ /** | ||
this.valuesSnapshotCache = undefined; | ||
// check if there are multiple proposals with matching keys | ||
let proposalSettled = false; | ||
let proposalKeySeen = false; | ||
for (const [, p] of this.proposals) { | ||
if (p.key === committedProposal.key) { | ||
if (!proposalKeySeen) { | ||
// set proposalSettled to true if the proposal key match is unique thus far | ||
proposalSettled = true; | ||
} | ||
else { | ||
// set proposalSettled to false if matching proposal key is not unique | ||
proposalSettled = false; | ||
break; | ||
} | ||
proposalKeySeen = true; | ||
} | ||
} | ||
this.emit("approveProposal", committedProposal.sequenceNumber, committedProposal.key, committedProposal.value, committedProposal.approvalSequenceNumber); | ||
// emit approveProposalComplete when all pending proposals are processed | ||
if (proposalSettled) { | ||
this.emit("approveProposalComplete", committedProposal.sequenceNumber, committedProposal.key, committedProposal.value, committedProposal.approvalSequenceNumber); | ||
} | ||
this.proposals.delete(proposal.sequenceNumber); | ||
@@ -264,0 +282,0 @@ // clear the proposals cache |
@@ -86,5 +86,9 @@ /*! | ||
// this ensures future state changes will not affect outside callers | ||
return Object.assign({ sequenceNumber: this.sequenceNumber, minimumSequenceNumber: this.minimumSequenceNumber }, this._quorum.snapshot()); | ||
return { | ||
sequenceNumber: this.sequenceNumber, | ||
minimumSequenceNumber: this.minimumSequenceNumber, | ||
...this._quorum.snapshot(), | ||
}; | ||
} | ||
} | ||
//# sourceMappingURL=protocol.js.map |
@@ -36,4 +36,3 @@ /*! | ||
snapshot() { | ||
var _a; | ||
(_a = this.snapshotCache) !== null && _a !== void 0 ? _a : (this.snapshotCache = Array.from(this.members)); | ||
this.snapshotCache ?? (this.snapshotCache = Array.from(this.members)); | ||
return this.snapshotCache; | ||
@@ -108,4 +107,3 @@ } | ||
snapshot() { | ||
var _a, _b; | ||
(_a = this.proposalsSnapshotCache) !== null && _a !== void 0 ? _a : (this.proposalsSnapshotCache = Array.from(this.proposals).map(([sequenceNumber, proposal]) => [ | ||
this.proposalsSnapshotCache ?? (this.proposalsSnapshotCache = Array.from(this.proposals).map(([sequenceNumber, proposal]) => [ | ||
sequenceNumber, | ||
@@ -115,3 +113,3 @@ { sequenceNumber, key: proposal.key, value: proposal.value }, | ||
])); | ||
(_b = this.valuesSnapshotCache) !== null && _b !== void 0 ? _b : (this.valuesSnapshotCache = Array.from(this.values)); | ||
this.valuesSnapshotCache ?? (this.valuesSnapshotCache = Array.from(this.values)); | ||
return { | ||
@@ -132,4 +130,3 @@ proposals: this.proposalsSnapshotCache, | ||
get(key) { | ||
var _a; | ||
return (_a = this.values.get(key)) === null || _a === void 0 ? void 0 : _a.value; | ||
return this.values.get(key)?.value; | ||
} | ||
@@ -257,3 +254,24 @@ /** | ||
this.valuesSnapshotCache = undefined; | ||
// check if there are multiple proposals with matching keys | ||
let proposalSettled = false; | ||
let proposalKeySeen = false; | ||
for (const [, p] of this.proposals) { | ||
if (p.key === committedProposal.key) { | ||
if (!proposalKeySeen) { | ||
// set proposalSettled to true if the proposal key match is unique thus far | ||
proposalSettled = true; | ||
} | ||
else { | ||
// set proposalSettled to false if matching proposal key is not unique | ||
proposalSettled = false; | ||
break; | ||
} | ||
proposalKeySeen = true; | ||
} | ||
} | ||
this.emit("approveProposal", committedProposal.sequenceNumber, committedProposal.key, committedProposal.value, committedProposal.approvalSequenceNumber); | ||
// emit approveProposalComplete when all pending proposals are processed | ||
if (proposalSettled) { | ||
this.emit("approveProposalComplete", committedProposal.sequenceNumber, committedProposal.key, committedProposal.value, committedProposal.approvalSequenceNumber); | ||
} | ||
this.proposals.delete(proposal.sequenceNumber); | ||
@@ -260,0 +278,0 @@ // clear the proposals cache |
{ | ||
"name": "@fluidframework/protocol-base", | ||
"version": "2.0.0-178198", | ||
"version": "2.0.0-181438", | ||
"description": "Fluid protocol base", | ||
@@ -62,3 +62,3 @@ "homepage": "https://fluidframework.com", | ||
"@fluidframework/common-utils": "^1.1.1", | ||
"@fluidframework/gitresources": "2.0.0-178198", | ||
"@fluidframework/gitresources": "2.0.0-181438", | ||
"@fluidframework/protocol-definitions": "^1.1.0", | ||
@@ -68,5 +68,5 @@ "events": "^3.1.0" | ||
"devDependencies": { | ||
"@fluid-tools/build-cli": "^0.21.0", | ||
"@fluidframework/build-common": "^1.2.0", | ||
"@fluidframework/build-tools": "^0.21.0", | ||
"@fluid-tools/build-cli": "^0.22.0", | ||
"@fluidframework/build-common": "^2.0.0", | ||
"@fluidframework/build-tools": "^0.22.0", | ||
"@fluidframework/eslint-config-fluid": "^2.0.0", | ||
@@ -73,0 +73,0 @@ "@fluidframework/protocol-base-previous": "npm:@fluidframework/protocol-base@0.1040.1000", |
@@ -371,2 +371,19 @@ /*! | ||
// check if there are multiple proposals with matching keys | ||
let proposalSettled = false; | ||
let proposalKeySeen = false; | ||
for (const [, p] of this.proposals) { | ||
if (p.key === committedProposal.key) { | ||
if (!proposalKeySeen) { | ||
// set proposalSettled to true if the proposal key match is unique thus far | ||
proposalSettled = true; | ||
} else { | ||
// set proposalSettled to false if matching proposal key is not unique | ||
proposalSettled = false; | ||
break; | ||
} | ||
proposalKeySeen = true; | ||
} | ||
} | ||
this.emit( | ||
@@ -380,2 +397,13 @@ "approveProposal", | ||
// emit approveProposalComplete when all pending proposals are processed | ||
if (proposalSettled) { | ||
this.emit( | ||
"approveProposalComplete", | ||
committedProposal.sequenceNumber, | ||
committedProposal.key, | ||
committedProposal.value, | ||
committedProposal.approvalSequenceNumber, | ||
); | ||
} | ||
this.proposals.delete(proposal.sequenceNumber); | ||
@@ -382,0 +410,0 @@ |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
200797
2487
+ Added@fluidframework/gitresources@2.0.0-181438(transitive)
- Removed@fluidframework/gitresources@2.0.0-178198(transitive)