@sanity/mutator
Advanced tools
Comparing version 0.104.9 to 0.104.10
@@ -161,12 +161,10 @@ 'use strict'; | ||
if (this.HEAD) { | ||
(function () { | ||
var updatedAt = new Date(_this2.HEAD._updatedAt); | ||
if (_this2.incoming.find(function (mut) { | ||
return mut.timestamp && mut.timestamp < updatedAt; | ||
})) { | ||
_this2.incoming = _this2.incoming.filter(function (mut) { | ||
return mut.timestamp < updatedAt; | ||
}); | ||
} | ||
})(); | ||
var updatedAt = new Date(this.HEAD._updatedAt); | ||
if (this.incoming.find(function (mut) { | ||
return mut.timestamp && mut.timestamp < updatedAt; | ||
})) { | ||
this.incoming = this.incoming.filter(function (mut) { | ||
return mut.timestamp < updatedAt; | ||
}); | ||
} | ||
} | ||
@@ -299,2 +297,3 @@ | ||
if (this.submitted[0].transactionId == txnId) { | ||
(0, _debug2.default)('Remote mutation ' + txnId + ' matches upcoming submitted mutation, consumed from \'submitted\' buffer'); | ||
this.submitted.shift(); | ||
@@ -305,5 +304,7 @@ return false; | ||
// There are no submitted, but some are pending so let's check the upcoming pending | ||
(0, _debug2.default)('Remote mutation ' + txnId + ' matches upcoming pending mutation, consumed from \'pending\' buffer'); | ||
this.pending.shift(); | ||
return false; | ||
} | ||
(0, _debug2.default)('The mutation was not the upcoming mutation, scrubbing. Pending: ' + this.pending.length + ', Submitted: ' + this.submitted.length); | ||
// The mutation was not the upcoming mutation, so we'll have to check everything to | ||
@@ -317,2 +318,3 @@ // see if we have an out of order situation | ||
}); | ||
(0, _debug2.default)('After scrubbing: Pending: ' + this.pending.length + ', Submitted: ' + this.submitted.length); | ||
// Whether we had it or not we have either a reordering, or an unexpected mutation | ||
@@ -319,0 +321,0 @@ // so must rebase |
@@ -80,8 +80,6 @@ 'use strict'; | ||
} else if (mutation.patch) { | ||
(function () { | ||
var patch = new _patch.Patcher(mutation.patch); | ||
operations.push(function (doc) { | ||
return patch.apply(doc); | ||
}); | ||
})(); | ||
var patch = new _patch.Patcher(mutation.patch); | ||
operations.push(function (doc) { | ||
return patch.apply(doc); | ||
}); | ||
} else { | ||
@@ -88,0 +86,0 @@ throw new Error('Unsupported mutation ' + JSON.stringify(mutation, null, 2)); |
@@ -157,12 +157,10 @@ 'use strict'; | ||
if (descender.tail) { | ||
(function () { | ||
// Not arrived yet | ||
var matcher = new Matcher(descender.descend(), _this2); | ||
descender.head.toFieldReferences().forEach(function (field) { | ||
leads.push({ | ||
target: descender.head, | ||
matcher: matcher | ||
}); | ||
// Not arrived yet | ||
var matcher = new Matcher(descender.descend(), _this2); | ||
descender.head.toFieldReferences().forEach(function (field) { | ||
leads.push({ | ||
target: descender.head, | ||
matcher: matcher | ||
}); | ||
})(); | ||
}); | ||
} else { | ||
@@ -176,22 +174,20 @@ // arrived | ||
if (this.hasRecursives()) { | ||
(function () { | ||
// The recustives matcher will have no active set, only inherit recursives from this | ||
var recursivesMatcher = new Matcher([], _this2); | ||
if (probe.containerType() == 'array') { | ||
var length = probe.length(); | ||
for (var i = 0; i < length; i++) { | ||
leads.push({ | ||
target: _Expression2.default.indexReference(i), | ||
matcher: recursivesMatcher | ||
}); | ||
} | ||
} else if (probe.containerType() == 'object') { | ||
probe.attributeKeys().forEach(function (name) { | ||
leads.push({ | ||
target: _Expression2.default.attributeReference(name), | ||
matcher: recursivesMatcher | ||
}); | ||
// The recustives matcher will have no active set, only inherit recursives from this | ||
var recursivesMatcher = new Matcher([], this); | ||
if (probe.containerType() == 'array') { | ||
var length = probe.length(); | ||
for (var i = 0; i < length; i++) { | ||
leads.push({ | ||
target: _Expression2.default.indexReference(i), | ||
matcher: recursivesMatcher | ||
}); | ||
} | ||
})(); | ||
} else if (probe.containerType() == 'object') { | ||
probe.attributeKeys().forEach(function (name) { | ||
leads.push({ | ||
target: _Expression2.default.attributeReference(name), | ||
matcher: recursivesMatcher | ||
}); | ||
}); | ||
} | ||
} | ||
@@ -198,0 +194,0 @@ |
@@ -7,4 +7,2 @@ 'use strict'; | ||
var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; | ||
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); | ||
@@ -140,34 +138,26 @@ | ||
value: function tokenizeQuoted() { | ||
var _this3 = this; | ||
var quote = this.peek(); | ||
if (quote == "'" || quote == '"') { | ||
var _ret2 = function () { | ||
_this3.consume(quote); | ||
var escape = false; | ||
var inner = _this3.takeWhile(function (char) { | ||
if (escape) { | ||
escape = false; | ||
return char; | ||
} | ||
if (char == '\\') { | ||
escape = true; | ||
return ''; | ||
} | ||
if (char != quote) { | ||
return char; | ||
} | ||
return null; | ||
}); | ||
_this3.consume(quote); | ||
return { | ||
v: { | ||
type: 'quoted', | ||
value: inner, | ||
quote: quote == '"' ? 'double' : 'single' | ||
} | ||
}; | ||
}(); | ||
if ((typeof _ret2 === 'undefined' ? 'undefined' : _typeof(_ret2)) === "object") return _ret2.v; | ||
this.consume(quote); | ||
var _escape = false; | ||
var inner = this.takeWhile(function (char) { | ||
if (_escape) { | ||
_escape = false; | ||
return char; | ||
} | ||
if (char == '\\') { | ||
_escape = true; | ||
return ''; | ||
} | ||
if (char != quote) { | ||
return char; | ||
} | ||
return null; | ||
}); | ||
this.consume(quote); | ||
return { | ||
type: 'quoted', | ||
value: inner, | ||
quote: quote == '"' ? 'double' : 'single' | ||
}; | ||
} | ||
@@ -228,3 +218,3 @@ return null; | ||
value: function tokenizeSymbol() { | ||
var _this4 = this; | ||
var _this3 = this; | ||
@@ -235,3 +225,3 @@ var result = null; | ||
var found = patterns.find(function (pattern) { | ||
return _this4.tryConsume(pattern); | ||
return _this3.tryConsume(pattern); | ||
}); | ||
@@ -238,0 +228,0 @@ if (found) { |
{ | ||
"name": "@sanity/mutator", | ||
"version": "0.104.9", | ||
"version": "0.104.10", | ||
"description": "A set of models to make it easier to utilize the powerful real time collaborative features of Sanity", | ||
@@ -5,0 +5,0 @@ "main": "lib/index.js", |
@@ -239,2 +239,3 @@ // @flow | ||
if (this.submitted[0].transactionId == txnId) { | ||
debug(`Remote mutation ${txnId} matches upcoming submitted mutation, consumed from 'submitted' buffer`) | ||
this.submitted.shift() | ||
@@ -245,5 +246,7 @@ return false | ||
// There are no submitted, but some are pending so let's check the upcoming pending | ||
debug(`Remote mutation ${txnId} matches upcoming pending mutation, consumed from 'pending' buffer`) | ||
this.pending.shift() | ||
return false | ||
} | ||
debug(`The mutation was not the upcoming mutation, scrubbing. Pending: ${this.pending.length}, Submitted: ${this.submitted.length}`) | ||
// The mutation was not the upcoming mutation, so we'll have to check everything to | ||
@@ -253,2 +256,3 @@ // see if we have an out of order situation | ||
this.pending = this.pending.filter(mut => mut.transactionId != txnId) | ||
debug(`After scrubbing: Pending: ${this.pending.length}, Submitted: ${this.submitted.length}`) | ||
// Whether we had it or not we have either a reordering, or an unexpected mutation | ||
@@ -255,0 +259,0 @@ // so must rebase |
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
254573
7664