@sanity/mutator
Advanced tools
Comparing version 0.104.44 to 0.105.0-drafts.0
@@ -162,12 +162,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; | ||
}); | ||
} | ||
} | ||
@@ -174,0 +172,0 @@ |
@@ -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.44", | ||
"version": "0.105.0-drafts.0", | ||
"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", |
345749
99
7703