Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Socket
Sign inDemoInstall

@es-git/fetch-mixin

Package Overview
Dependencies
Maintainers
1
Versions
19
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@es-git/fetch-mixin - npm Package Compare versions

Comparing version 0.4.1 to 0.4.2

4

es/index.js

@@ -21,3 +21,3 @@ var __rest = (this && this.__rest) || function (s, e) {

const refNames = await super.listRefs();
const localRefs = await Promise.all(refNames.map(name => super.getRef(name)));
const localRefs = await Promise.all(refNames.map(async (name) => ({ name, hash: await super.getRef(name) })));
const shallows = toArray(await super.loadMetadata('shallow'));

@@ -56,3 +56,3 @@ const _a = await gitFetch({

ref: name,
from: localRefs[refNames.indexOf(name)],
from: localRefs[refNames.indexOf(name)].hash,
to: hash

@@ -59,0 +59,0 @@ }));

@@ -98,3 +98,3 @@ "use strict";

var _ref = (0, _asyncToGenerator3.default)( /*#__PURE__*/_regenerator2.default.mark(function _callee(url) {
var _ref = (0, _asyncToGenerator3.default)( /*#__PURE__*/_regenerator2.default.mark(function _callee2(url) {
var _this3 = this;

@@ -104,28 +104,56 @@

var refNames, localRefs, shallows, _a, objects, refs, result, objects_1, objects_1_1, _ref2, hash, body, unshallow, shallow, _iteratorNormalCompletion, _didIteratorError, _iteratorError, _iterator, _step, _step$value, name, e_1, _b;
var refNames, localRefs, shallows, _a, objects, refs, result, objects_1, objects_1_1, _ref3, hash, body, unshallow, shallow, _iteratorNormalCompletion, _didIteratorError, _iteratorError, _iterator, _step, _step$value, name, e_1, _b;
return _regenerator2.default.wrap(function _callee$(_context) {
return _regenerator2.default.wrap(function _callee2$(_context2) {
while (1) {
switch (_context.prev = _context.next) {
switch (_context2.prev = _context2.next) {
case 0:
_context.next = 2;
_context2.next = 2;
return (0, _get3.default)(FetchRepo.prototype.__proto__ || (0, _getPrototypeOf2.default)(FetchRepo.prototype), "listRefs", this).call(this);
case 2:
refNames = _context.sent;
_context.next = 5;
return _promise2.default.all(refNames.map(function (name) {
return (0, _get3.default)(FetchRepo.prototype.__proto__ || (0, _getPrototypeOf2.default)(FetchRepo.prototype), "getRef", _this3).call(_this3, name);
}));
refNames = _context2.sent;
_context2.next = 5;
return _promise2.default.all(refNames.map(function () {
(0, _newArrowCheck3.default)(this, _this3);
var _ref2 = (0, _asyncToGenerator3.default)( /*#__PURE__*/_regenerator2.default.mark(function _callee(name) {
return _regenerator2.default.wrap(function _callee$(_context) {
while (1) {
switch (_context.prev = _context.next) {
case 0:
_context.t0 = name;
_context.next = 3;
return (0, _get3.default)(FetchRepo.prototype.__proto__ || (0, _getPrototypeOf2.default)(FetchRepo.prototype), "getRef", _this3).call(_this3, name);
case 3:
_context.t1 = _context.sent;
return _context.abrupt("return", {
name: _context.t0,
hash: _context.t1
});
case 5:
case "end":
return _context.stop();
}
}
}, _callee, _this3);
}));
return function (_x3) {
return _ref2.apply(this, arguments);
};
}.bind(this)()));
case 5:
localRefs = _context.sent;
_context.t0 = toArray;
_context.next = 9;
localRefs = _context2.sent;
_context2.t0 = toArray;
_context2.next = 9;
return (0, _get3.default)(FetchRepo.prototype.__proto__ || (0, _getPrototypeOf2.default)(FetchRepo.prototype), "loadMetadata", this).call(this, 'shallow');
case 9:
_context.t1 = _context.sent;
shallows = (0, _context.t0)(_context.t1);
_context.next = 13;
_context2.t1 = _context2.sent;
shallows = (0, _context2.t0)(_context2.t1);
_context2.next = 13;
return (0, _httpTransport.fetch)({

@@ -144,61 +172,61 @@ url: url,

case 13:
_a = _context.sent;
_a = _context2.sent;
objects = _a.objects;
refs = _a.refs;
result = __rest(_a, ["objects", "refs"]);
_context.prev = 17;
_context2.prev = 17;
objects_1 = __asyncValues(objects);
case 19:
_context.next = 21;
_context2.next = 21;
return objects_1.next();
case 21:
objects_1_1 = _context.sent;
objects_1_1 = _context2.sent;
if (objects_1_1.done) {
_context.next = 32;
_context2.next = 32;
break;
}
_context.next = 25;
_context2.next = 25;
return objects_1_1.value;
case 25:
_ref2 = _context.sent;
hash = _ref2.hash;
body = _ref2.body;
_context.next = 30;
_ref3 = _context2.sent;
hash = _ref3.hash;
body = _ref3.body;
_context2.next = 30;
return (0, _get3.default)(FetchRepo.prototype.__proto__ || (0, _getPrototypeOf2.default)(FetchRepo.prototype), "saveRaw", this).call(this, hash, body);
case 30:
_context.next = 19;
_context2.next = 19;
break;
case 32:
_context.next = 37;
_context2.next = 37;
break;
case 34:
_context.prev = 34;
_context.t2 = _context["catch"](17);
e_1 = { error: _context.t2 };
_context2.prev = 34;
_context2.t2 = _context2["catch"](17);
e_1 = { error: _context2.t2 };
case 37:
_context.prev = 37;
_context.prev = 38;
_context2.prev = 37;
_context2.prev = 38;
if (!(objects_1_1 && !objects_1_1.done && (_b = objects_1.return))) {
_context.next = 42;
_context2.next = 42;
break;
}
_context.next = 42;
_context2.next = 42;
return _b.call(objects_1);
case 42:
_context.prev = 42;
_context2.prev = 42;
if (!e_1) {
_context.next = 45;
_context2.next = 45;
break;

@@ -210,25 +238,25 @@ }

case 45:
return _context.finish(42);
return _context2.finish(42);
case 46:
return _context.finish(37);
return _context2.finish(37);
case 47:
_context.next = 49;
_context2.next = 49;
return result.unshallow;
case 49:
unshallow = _context.sent;
_context.next = 52;
unshallow = _context2.sent;
_context2.next = 52;
return result.shallow;
case 52:
shallow = _context.sent;
shallow = _context2.sent;
if (!(shallow.length || unshallow.length)) {
_context.next = 56;
_context2.next = 56;
break;
}
_context.next = 56;
_context2.next = 56;
return (0, _get3.default)(FetchRepo.prototype.__proto__ || (0, _getPrototypeOf2.default)(FetchRepo.prototype), "saveMetadata", this).call(this, 'shallow', fromArray(shallows.concat(shallow).filter(function (hash) {

@@ -242,3 +270,3 @@ return !unshallow.includes(hash);

_iteratorError = undefined;
_context.prev = 59;
_context2.prev = 59;
_iterator = (0, _getIterator3.default)(refs);

@@ -248,3 +276,3 @@

if (_iteratorNormalCompletion = (_step = _iterator.next()).done) {
_context.next = 68;
_context2.next = 68;
break;

@@ -254,3 +282,3 @@ }

_step$value = _step.value, name = _step$value.name, hash = _step$value.hash;
_context.next = 65;
_context2.next = 65;
return (0, _get3.default)(FetchRepo.prototype.__proto__ || (0, _getPrototypeOf2.default)(FetchRepo.prototype), "setRef", this).call(this, name, hash);

@@ -260,18 +288,18 @@

_iteratorNormalCompletion = true;
_context.next = 61;
_context2.next = 61;
break;
case 68:
_context.next = 74;
_context2.next = 74;
break;
case 70:
_context.prev = 70;
_context.t3 = _context["catch"](59);
_context2.prev = 70;
_context2.t3 = _context2["catch"](59);
_didIteratorError = true;
_iteratorError = _context.t3;
_iteratorError = _context2.t3;
case 74:
_context.prev = 74;
_context.prev = 75;
_context2.prev = 74;
_context2.prev = 75;

@@ -283,6 +311,6 @@ if (!_iteratorNormalCompletion && _iterator.return) {

case 77:
_context.prev = 77;
_context2.prev = 77;
if (!_didIteratorError) {
_context.next = 80;
_context2.next = 80;
break;

@@ -294,14 +322,14 @@ }

case 80:
return _context.finish(77);
return _context2.finish(77);
case 81:
return _context.finish(74);
return _context2.finish(74);
case 82:
return _context.abrupt("return", refs.map(function (_ref3) {
var name = _ref3.name,
hash = _ref3.hash;
return _context2.abrupt("return", refs.map(function (_ref4) {
var name = _ref4.name,
hash = _ref4.hash;
return {
ref: name,
from: localRefs[refNames.indexOf(name)],
from: localRefs[refNames.indexOf(name)].hash,
to: hash

@@ -313,6 +341,6 @@ };

case "end":
return _context.stop();
return _context2.stop();
}
}
}, _callee, this, [[17, 34, 37, 47], [38,, 42, 46], [59, 70, 74, 82], [75,, 77, 81]]);
}, _callee2, this, [[17, 34, 37, 47], [38,, 42, 46], [59, 70, 74, 82], [75,, 77, 81]]);
}));

@@ -319,0 +347,0 @@

{
"name": "@es-git/fetch-mixin",
"version": "0.4.1",
"version": "0.4.2",
"description": "",

@@ -42,5 +42,5 @@ "main": "js/index.js",

"dependencies": {
"@es-git/core": "^0.4.0",
"@es-git/http-transport": "^0.4.1"
"@es-git/core": "^0.4.2",
"@es-git/http-transport": "^0.4.2"
}
}

@@ -25,3 +25,3 @@ import { Type, Mode, Constructor, IRawRepo, Hash, isFile, encode, decode } from '@es-git/core';

const refNames = await super.listRefs();
const localRefs = await Promise.all(refNames.map(name => super.getRef(name) as Promise<string>));
const localRefs = await Promise.all(refNames.map(async name => ({name, hash: await super.getRef(name) as string})));
const shallows = toArray(await super.loadMetadata('shallow'));

@@ -55,3 +55,3 @@ const {objects, refs, ...result} = await gitFetch({

ref: name,
from: localRefs[refNames.indexOf(name)],
from: localRefs[refNames.indexOf(name)].hash,
to: hash

@@ -58,0 +58,0 @@ }))

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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