@sanity/mutator
Advanced tools
Comparing version 0.104.43 to 0.104.44
@@ -162,10 +162,12 @@ 'use strict'; | ||
if (this.HEAD) { | ||
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; | ||
}); | ||
} | ||
(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; | ||
}); | ||
} | ||
})(); | ||
} | ||
@@ -172,0 +174,0 @@ |
@@ -80,6 +80,8 @@ 'use strict'; | ||
} else if (mutation.patch) { | ||
var patch = new _patch.Patcher(mutation.patch); | ||
operations.push(function (doc) { | ||
return patch.apply(doc); | ||
}); | ||
(function () { | ||
var patch = new _patch.Patcher(mutation.patch); | ||
operations.push(function (doc) { | ||
return patch.apply(doc); | ||
}); | ||
})(); | ||
} else { | ||
@@ -86,0 +88,0 @@ throw new Error('Unsupported mutation ' + JSON.stringify(mutation, null, 2)); |
@@ -157,10 +157,12 @@ 'use strict'; | ||
if (descender.tail) { | ||
// Not arrived yet | ||
var matcher = new Matcher(descender.descend(), _this2); | ||
descender.head.toFieldReferences().forEach(function (field) { | ||
leads.push({ | ||
target: descender.head, | ||
matcher: matcher | ||
(function () { | ||
// Not arrived yet | ||
var matcher = new Matcher(descender.descend(), _this2); | ||
descender.head.toFieldReferences().forEach(function (field) { | ||
leads.push({ | ||
target: descender.head, | ||
matcher: matcher | ||
}); | ||
}); | ||
}); | ||
})(); | ||
} else { | ||
@@ -174,20 +176,22 @@ // arrived | ||
if (this.hasRecursives()) { | ||
// 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 | ||
(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 | ||
}); | ||
}); | ||
} | ||
} else if (probe.containerType() == 'object') { | ||
probe.attributeKeys().forEach(function (name) { | ||
leads.push({ | ||
target: _Expression2.default.attributeReference(name), | ||
matcher: recursivesMatcher | ||
}); | ||
}); | ||
} | ||
})(); | ||
} | ||
@@ -194,0 +198,0 @@ |
@@ -7,2 +7,4 @@ '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; }; }(); | ||
@@ -138,26 +140,34 @@ | ||
value: function tokenizeQuoted() { | ||
var _this3 = this; | ||
var quote = this.peek(); | ||
if (quote == "'" || quote == '"') { | ||
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' | ||
}; | ||
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; | ||
} | ||
@@ -218,3 +228,3 @@ return null; | ||
value: function tokenizeSymbol() { | ||
var _this3 = this; | ||
var _this4 = this; | ||
@@ -225,3 +235,3 @@ var result = null; | ||
var found = patterns.find(function (pattern) { | ||
return _this3.tryConsume(pattern); | ||
return _this4.tryConsume(pattern); | ||
}); | ||
@@ -228,0 +238,0 @@ if (found) { |
{ | ||
"name": "@sanity/mutator", | ||
"version": "0.104.43", | ||
"version": "0.104.44", | ||
"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", |
7718
256780
98