New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@sanity/mutator

Package Overview
Dependencies
Maintainers
6
Versions
1464
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@sanity/mutator - npm Package Compare versions

Comparing version 0.106.10 to 0.106.12

yarn.lock

30

lib/document/BufferedDocument.js

@@ -144,7 +144,7 @@ 'use strict';

}
(0, _debug2.default)('Committing local changes');
(0, _debug2.default)('Committing local changes'
// Collect current staged mutations into a commit and ...
this.commits.push(new Commit([this.buffer.purge()]));
);this.commits.push(new Commit([this.buffer.purge()])
// ... clear the table for the next commit.
this.buffer = new _SquashingBuffer2.default(this.LOCAL);
);this.buffer = new _SquashingBuffer2.default(this.LOCAL);
this.performCommits();

@@ -189,10 +189,10 @@ }

(0, _debug2.default)('Commit succeeded');
docResponder.success();
docResponder.success
// Keep running the committer until no more commits
_this2._cycleCommitter();
();_this2._cycleCommitter();
},
failure: function failure() {
(0, _debug2.default)('Commit failed');
(0, _debug2.default)('Commit failed'
// Re stage commit
commit.tries += 1;
);commit.tries += 1;
if (_this2.LOCAL !== null) {

@@ -203,6 +203,6 @@ // Only schedule this commit for a retry of the document still exist to avoid looping

}
docResponder.failure();
docResponder.failure
// Retry
// TODO: Be able to _not_ retry if failure is permanent
setTimeout(function () {
();setTimeout(function () {
return _this2._cycleCommitter();

@@ -227,7 +227,7 @@ }, 1000);

value: function handleDocumentDeleted() {
(0, _debug2.default)('Document deleted');
(0, _debug2.default)('Document deleted'
// If the document was just deleted, fire the onDelete event with the absolutely latest version of the document
// before someone deleted it so that the client may revive the document in the last state the user saw it, should
// she so desire.
if (this.LOCAL !== null && this.onDelete) {
);if (this.LOCAL !== null && this.onDelete) {
this.onDelete(this.LOCAL);

@@ -251,6 +251,6 @@ }

}
(0, _debug2.default)('Document mutated from remote with local changes');
(0, _debug2.default)('Document mutated from remote with local changes'
// If there are local edits, and the document was deleted, we need to purge those local edits now
if (this.document.EDGE === null) {
);if (this.document.EDGE === null) {
this.handleDocumentDeleted();

@@ -274,5 +274,5 @@ }

}, this.document.EDGE);
this.LOCAL = this.buffer.rebase(this.LOCAL);
this.LOCAL = this.buffer.rebase(this.LOCAL
// Copy over rev, since we don't care if it changed, we only care about the content
if (oldLocal !== null && this.LOCAL !== null) {
);if (oldLocal !== null && this.LOCAL !== null) {
oldLocal._rev = this.LOCAL._rev;

@@ -279,0 +279,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;
});
}
}

@@ -241,6 +239,6 @@

this.HEAD = mut.apply(this.HEAD);
this.HEAD = mut.apply(this.HEAD
// Eliminate from incoming set
this.incoming = this.incoming.filter(function (m) {
);this.incoming = this.incoming.filter(function (m) {
return m.transactionId != mut.transactionId;

@@ -310,6 +308,6 @@ });

}
(0, _debug2.default)('The mutation was not the upcoming mutation, scrubbing. Pending: ' + this.pending.length + ', Submitted: ' + this.submitted.length);
(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
// see if we have an out of order situation
this.submitted = this.submitted.filter(function (mut) {
);this.submitted = this.submitted.filter(function (mut) {
return mut.transactionId != txnId;

@@ -320,6 +318,6 @@ });

});
(0, _debug2.default)('After scrubbing: Pending: ' + this.pending.length + ', Submitted: ' + this.submitted.length);
(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
// so must rebase
return true;
);return true;
}

@@ -362,5 +360,5 @@ }, {

return mutation.transactionId != pendingTxnId;
});
}
// Rebase to revert document to what it looked like before the failed mutation
this.rebase();
);this.rebase();
}

@@ -371,5 +369,5 @@ }, {

var oldEdge = this.EDGE;
this.EDGE = _Mutation2.default.applyAll(this.HEAD, this.submitted.concat(this.pending));
this.EDGE = _Mutation2.default.applyAll(this.HEAD, this.submitted.concat(this.pending)
// Copy over rev, since we don't care if it changed, we only care about the content
if (oldEdge !== null && this.EDGE !== null) {
);if (oldEdge !== null && this.EDGE !== null) {
oldEdge._rev = this.EDGE._rev;

@@ -376,0 +374,0 @@ }

@@ -83,8 +83,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 {

@@ -91,0 +89,0 @@ throw new Error('Unsupported mutation ' + JSON.stringify(mutation, null, 2));

@@ -153,6 +153,6 @@ 'use strict';

}
(0, _debug2.default)('Unoptimizable mutation detected, purging optimization buffer');
(0, _debug2.default)('Unoptimizable mutation detected, purging optimization buffer'
// console.log("Unoptimizable operation, stashing", JSON.stringify(op))
// Un-optimisable operations causes everything to be stashed
this.staged.push(op);
);this.staged.push(op);
this.stashStagedOperations();

@@ -175,5 +175,5 @@ }

// we won't optimise
var matches = (0, _extractWithPath2.default)(path, this.PRESTAGE);
var matches = (0, _extractWithPath2.default)(path, this.PRESTAGE
// If we are not overwriting exactly one key, this cannot be optimised, so we bail
if (matches.length !== 1) {
);if (matches.length !== 1) {
// console.log('Not optimisable because match count is != 1', JSON.stringify(matches))

@@ -211,5 +211,5 @@ return false;

// operation touching this path in the buffer.
var canonicalPath = (0, _arrayToJSONMatchPath2.default)(match.path);
var canonicalPath = (0, _arrayToJSONMatchPath2.default)(match.path
// Store this operation, overwriting any previous operations touching this same path
if (op) {
);if (op) {
this.setOperations[canonicalPath] = op;

@@ -216,0 +216,0 @@ } else {

@@ -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 {

@@ -172,26 +170,24 @@ // arrived

}
});
}
// If there are recursive terms, we need to add a lead for every descendant ...
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
});
);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
});
}
})();
} else if (probe.containerType() == 'object') {
probe.attributeKeys().forEach(function (name) {
leads.push({
target: _Expression2.default.attributeReference(name),
matcher: recursivesMatcher
});
});
}
}

@@ -198,0 +194,0 @@

@@ -58,5 +58,5 @@ 'use strict';

value: function consume() {
var result = this.peek();
var result = this.peek
// console.log("consumed", result)
this.i += 1;
();this.i += 1;
return result;

@@ -70,5 +70,5 @@ }

value: function probe(pattern) {
var token = this.peek();
var token = this.peek
// console.log("Probing", token, "for", pattern)
if (!token) {
();if (!token) {
// console.log(" -> nay", token)

@@ -260,5 +260,5 @@ return null;

while (expr) {
terms.push(expr);
terms.push(expr
// End of union?
if (this.match({ type: 'paren', symbol: ']' })) {
);if (this.match({ type: 'paren', symbol: ']' })) {
break;

@@ -265,0 +265,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) {

@@ -78,5 +78,5 @@ 'use strict';

function minIndex(targets, accessor) {
var result = (0, _min3.default)((0, _util.targetsToIndicies)(targets, accessor));
var result = (0, _min3.default)((0, _util.targetsToIndicies)(targets, accessor)
// Ranges may be zero-length and not turn up in indices
targets.forEach(function (target) {
);targets.forEach(function (target) {
if (target.isRange()) {

@@ -95,5 +95,5 @@ var _target$expandRange = target.expandRange(),

function maxIndex(targets, accessor) {
var result = (0, _max3.default)((0, _util.targetsToIndicies)(targets, accessor));
var result = (0, _max3.default)((0, _util.targetsToIndicies)(targets, accessor)
// Ranges may be zero-length and not turn up in indices
targets.forEach(function (target) {
);targets.forEach(function (target) {
if (target.isRange()) {

@@ -100,0 +100,0 @@ var _target$expandRange2 = target.expandRange(),

@@ -110,3 +110,3 @@ 'use strict';

}
});
}
// Each time we run the matcher, we might also get a delivery. This means that a

@@ -117,3 +117,3 @@ // term in the jsonpath terminated here and the patch should be applied. The delivery

// to do its work, so here we just pass those to the patch and we're done.
if (delivery) {
);if (delivery) {
var patch = delivery.payload;

@@ -120,0 +120,0 @@ result = patch.apply(delivery.targets, result);

{
"name": "@sanity/mutator",
"version": "0.106.10",
"version": "0.106.12",
"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",

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc