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

savim

Package Overview
Dependencies
Maintainers
0
Versions
225
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

savim - npm Package Compare versions

Comparing version 1.2.179 to 1.2.180

793

dist/savim.cjs.development.js

@@ -7,333 +7,42 @@ 'use strict';

var _regeneratorRuntime = _interopDefault(require('regenerator-runtime'));
var Pino = _interopDefault(require('pino'));
function asyncGeneratorStep(n, t, e, r, o, a, c) {
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
try {
var i = n[a](c),
u = i.value;
} catch (n) {
return void e(n);
var info = gen[key](arg);
var value = info.value;
} catch (error) {
reject(error);
return;
}
i.done ? t(u) : Promise.resolve(u).then(r, o);
if (info.done) {
resolve(value);
} else {
Promise.resolve(value).then(_next, _throw);
}
}
function _asyncToGenerator(n) {
function _asyncToGenerator(fn) {
return function () {
var t = this,
e = arguments;
return new Promise(function (r, o) {
var a = n.apply(t, e);
function _next(n) {
asyncGeneratorStep(a, r, o, _next, _throw, "next", n);
var self = this,
args = arguments;
return new Promise(function (resolve, reject) {
var gen = fn.apply(self, args);
function _next(value) {
asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value);
}
function _throw(n) {
asyncGeneratorStep(a, r, o, _next, _throw, "throw", n);
function _throw(err) {
asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err);
}
_next(void 0);
_next(undefined);
});
};
}
function _regeneratorRuntime() {
_regeneratorRuntime = function () {
return e;
};
var t,
e = {},
r = Object.prototype,
n = r.hasOwnProperty,
o = Object.defineProperty || function (t, e, r) {
t[e] = r.value;
},
i = "function" == typeof Symbol ? Symbol : {},
a = i.iterator || "@@iterator",
c = i.asyncIterator || "@@asyncIterator",
u = i.toStringTag || "@@toStringTag";
function define(t, e, r) {
return Object.defineProperty(t, e, {
value: r,
enumerable: !0,
configurable: !0,
writable: !0
}), t[e];
}
try {
define({}, "");
} catch (t) {
define = function (t, e, r) {
return t[e] = r;
};
}
function wrap(t, e, r, n) {
var i = e && e.prototype instanceof Generator ? e : Generator,
a = Object.create(i.prototype),
c = new Context(n || []);
return o(a, "_invoke", {
value: makeInvokeMethod(t, r, c)
}), a;
}
function tryCatch(t, e, r) {
try {
return {
type: "normal",
arg: t.call(e, r)
};
} catch (t) {
return {
type: "throw",
arg: t
};
}
}
e.wrap = wrap;
var h = "suspendedStart",
l = "suspendedYield",
f = "executing",
s = "completed",
y = {};
function Generator() {}
function GeneratorFunction() {}
function GeneratorFunctionPrototype() {}
var p = {};
define(p, a, function () {
return this;
});
var d = Object.getPrototypeOf,
v = d && d(d(values([])));
v && v !== r && n.call(v, a) && (p = v);
var g = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(p);
function defineIteratorMethods(t) {
["next", "throw", "return"].forEach(function (e) {
define(t, e, function (t) {
return this._invoke(e, t);
});
});
}
function AsyncIterator(t, e) {
function invoke(r, o, i, a) {
var c = tryCatch(t[r], t, o);
if ("throw" !== c.type) {
var u = c.arg,
h = u.value;
return h && "object" == typeof h && n.call(h, "__await") ? e.resolve(h.__await).then(function (t) {
invoke("next", t, i, a);
}, function (t) {
invoke("throw", t, i, a);
}) : e.resolve(h).then(function (t) {
u.value = t, i(u);
}, function (t) {
return invoke("throw", t, i, a);
});
}
a(c.arg);
}
var r;
o(this, "_invoke", {
value: function (t, n) {
function callInvokeWithMethodAndArg() {
return new e(function (e, r) {
invoke(t, n, e, r);
});
}
return r = r ? r.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg();
}
});
}
function makeInvokeMethod(e, r, n) {
var o = h;
return function (i, a) {
if (o === f) throw Error("Generator is already running");
if (o === s) {
if ("throw" === i) throw a;
return {
value: t,
done: !0
};
}
for (n.method = i, n.arg = a;;) {
var c = n.delegate;
if (c) {
var u = maybeInvokeDelegate(c, n);
if (u) {
if (u === y) continue;
return u;
}
}
if ("next" === n.method) n.sent = n._sent = n.arg;else if ("throw" === n.method) {
if (o === h) throw o = s, n.arg;
n.dispatchException(n.arg);
} else "return" === n.method && n.abrupt("return", n.arg);
o = f;
var p = tryCatch(e, r, n);
if ("normal" === p.type) {
if (o = n.done ? s : l, p.arg === y) continue;
return {
value: p.arg,
done: n.done
};
}
"throw" === p.type && (o = s, n.method = "throw", n.arg = p.arg);
}
};
}
function maybeInvokeDelegate(e, r) {
var n = r.method,
o = e.iterator[n];
if (o === t) return r.delegate = null, "throw" === n && e.iterator.return && (r.method = "return", r.arg = t, maybeInvokeDelegate(e, r), "throw" === r.method) || "return" !== n && (r.method = "throw", r.arg = new TypeError("The iterator does not provide a '" + n + "' method")), y;
var i = tryCatch(o, e.iterator, r.arg);
if ("throw" === i.type) return r.method = "throw", r.arg = i.arg, r.delegate = null, y;
var a = i.arg;
return a ? a.done ? (r[e.resultName] = a.value, r.next = e.nextLoc, "return" !== r.method && (r.method = "next", r.arg = t), r.delegate = null, y) : a : (r.method = "throw", r.arg = new TypeError("iterator result is not an object"), r.delegate = null, y);
}
function pushTryEntry(t) {
var e = {
tryLoc: t[0]
};
1 in t && (e.catchLoc = t[1]), 2 in t && (e.finallyLoc = t[2], e.afterLoc = t[3]), this.tryEntries.push(e);
}
function resetTryEntry(t) {
var e = t.completion || {};
e.type = "normal", delete e.arg, t.completion = e;
}
function Context(t) {
this.tryEntries = [{
tryLoc: "root"
}], t.forEach(pushTryEntry, this), this.reset(!0);
}
function values(e) {
if (e || "" === e) {
var r = e[a];
if (r) return r.call(e);
if ("function" == typeof e.next) return e;
if (!isNaN(e.length)) {
var o = -1,
i = function next() {
for (; ++o < e.length;) if (n.call(e, o)) return next.value = e[o], next.done = !1, next;
return next.value = t, next.done = !0, next;
};
return i.next = i;
}
}
throw new TypeError(typeof e + " is not iterable");
}
return GeneratorFunction.prototype = GeneratorFunctionPrototype, o(g, "constructor", {
value: GeneratorFunctionPrototype,
configurable: !0
}), o(GeneratorFunctionPrototype, "constructor", {
value: GeneratorFunction,
configurable: !0
}), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, u, "GeneratorFunction"), e.isGeneratorFunction = function (t) {
var e = "function" == typeof t && t.constructor;
return !!e && (e === GeneratorFunction || "GeneratorFunction" === (e.displayName || e.name));
}, e.mark = function (t) {
return Object.setPrototypeOf ? Object.setPrototypeOf(t, GeneratorFunctionPrototype) : (t.__proto__ = GeneratorFunctionPrototype, define(t, u, "GeneratorFunction")), t.prototype = Object.create(g), t;
}, e.awrap = function (t) {
return {
__await: t
};
}, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, c, function () {
return this;
}), e.AsyncIterator = AsyncIterator, e.async = function (t, r, n, o, i) {
void 0 === i && (i = Promise);
var a = new AsyncIterator(wrap(t, r, n, o), i);
return e.isGeneratorFunction(r) ? a : a.next().then(function (t) {
return t.done ? t.value : a.next();
});
}, defineIteratorMethods(g), define(g, u, "Generator"), define(g, a, function () {
return this;
}), define(g, "toString", function () {
return "[object Generator]";
}), e.keys = function (t) {
var e = Object(t),
r = [];
for (var n in e) r.push(n);
return r.reverse(), function next() {
for (; r.length;) {
var t = r.pop();
if (t in e) return next.value = t, next.done = !1, next;
}
return next.done = !0, next;
};
}, e.values = values, Context.prototype = {
constructor: Context,
reset: function (e) {
if (this.prev = 0, this.next = 0, this.sent = this._sent = t, this.done = !1, this.delegate = null, this.method = "next", this.arg = t, this.tryEntries.forEach(resetTryEntry), !e) for (var r in this) "t" === r.charAt(0) && n.call(this, r) && !isNaN(+r.slice(1)) && (this[r] = t);
},
stop: function () {
this.done = !0;
var t = this.tryEntries[0].completion;
if ("throw" === t.type) throw t.arg;
return this.rval;
},
dispatchException: function (e) {
if (this.done) throw e;
var r = this;
function handle(n, o) {
return a.type = "throw", a.arg = e, r.next = n, o && (r.method = "next", r.arg = t), !!o;
}
for (var o = this.tryEntries.length - 1; o >= 0; --o) {
var i = this.tryEntries[o],
a = i.completion;
if ("root" === i.tryLoc) return handle("end");
if (i.tryLoc <= this.prev) {
var c = n.call(i, "catchLoc"),
u = n.call(i, "finallyLoc");
if (c && u) {
if (this.prev < i.catchLoc) return handle(i.catchLoc, !0);
if (this.prev < i.finallyLoc) return handle(i.finallyLoc);
} else if (c) {
if (this.prev < i.catchLoc) return handle(i.catchLoc, !0);
} else {
if (!u) throw Error("try statement without catch or finally");
if (this.prev < i.finallyLoc) return handle(i.finallyLoc);
}
}
}
},
abrupt: function (t, e) {
for (var r = this.tryEntries.length - 1; r >= 0; --r) {
var o = this.tryEntries[r];
if (o.tryLoc <= this.prev && n.call(o, "finallyLoc") && this.prev < o.finallyLoc) {
var i = o;
break;
}
}
i && ("break" === t || "continue" === t) && i.tryLoc <= e && e <= i.finallyLoc && (i = null);
var a = i ? i.completion : {};
return a.type = t, a.arg = e, i ? (this.method = "next", this.next = i.finallyLoc, y) : this.complete(a);
},
complete: function (t, e) {
if ("throw" === t.type) throw t.arg;
return "break" === t.type || "continue" === t.type ? this.next = t.arg : "return" === t.type ? (this.rval = this.arg = t.arg, this.method = "return", this.next = "end") : "normal" === t.type && e && (this.next = e), y;
},
finish: function (t) {
for (var e = this.tryEntries.length - 1; e >= 0; --e) {
var r = this.tryEntries[e];
if (r.finallyLoc === t) return this.complete(r.completion, r.afterLoc), resetTryEntry(r), y;
}
},
catch: function (t) {
for (var e = this.tryEntries.length - 1; e >= 0; --e) {
var r = this.tryEntries[e];
if (r.tryLoc === t) {
var n = r.completion;
if ("throw" === n.type) {
var o = n.arg;
resetTryEntry(r);
}
return o;
}
}
throw Error("illegal catch attempt");
},
delegateYield: function (e, r, n) {
return this.delegate = {
iterator: values(e),
resultName: r,
nextLoc: n
}, "next" === this.method && (this.arg = t), y;
}
}, e;
}
var SavimProviderInterface =
// eslint-disable-next-line @typescript-eslint/no-unused-vars, @typescript-eslint/no-empty-function
var SavimProviderInterface = // eslint-disable-next-line @typescript-eslint/no-unused-vars, @typescript-eslint/no-empty-function
function SavimProviderInterface(_config) {};

@@ -343,7 +52,10 @@ var Savim = /*#__PURE__*/function () {

var _this = this;
this.log = log;
this.providers = {};
this.getInvolvedProvider = function (providerName) {
var ProvidersKeys = Object.keys(_this.providers);
var provider = undefined;
if (providerName && _this.providers[providerName]) {

@@ -354,4 +66,6 @@ provider = _this.providers[providerName];

}
return provider;
};
this.logger = Pino({

@@ -361,268 +75,357 @@ level: log || 'info'

}
var _proto = Savim.prototype;
_proto.addProvider = /*#__PURE__*/function () {
var _addProvider = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(provider, config, providerName) {
var _addProvider = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(provider, config, providerName) {
var newProvider;
return _regeneratorRuntime().wrap(function _callee$(_context) {
while (1) switch (_context.prev = _context.next) {
case 0:
newProvider = new provider(config);
_context.next = 3;
return newProvider.isHealthy();
case 3:
if (_context.sent) {
_context.next = 6;
break;
}
this.logger.error("[SAVIM] Provider " + newProvider.name + " is not healthy !");
throw 'Provider is not healthy !';
case 6:
if (!this.providers[providerName || newProvider.name]) {
_context.next = 9;
break;
}
this.logger.error("[SAVIM] Provider " + (providerName || newProvider.name) + " is not healthy !");
throw 'Provider already exist !';
case 9:
this.providers[providerName || newProvider.name] = newProvider;
case 10:
case "end":
return _context.stop();
return _regeneratorRuntime.wrap(function _callee$(_context) {
while (1) {
switch (_context.prev = _context.next) {
case 0:
newProvider = new provider(config);
_context.next = 3;
return newProvider.isHealthy();
case 3:
if (_context.sent) {
_context.next = 6;
break;
}
this.logger.error("[SAVIM] Provider " + newProvider.name + " is not healthy !");
throw 'Provider is not healthy !';
case 6:
if (!this.providers[providerName || newProvider.name]) {
_context.next = 9;
break;
}
this.logger.error("[SAVIM] Provider " + (providerName || newProvider.name) + " is not healthy !");
throw 'Provider already exist !';
case 9:
this.providers[providerName || newProvider.name] = newProvider;
case 10:
case "end":
return _context.stop();
}
}
}, _callee, this);
}));
function addProvider(_x, _x2, _x3) {
return _addProvider.apply(this, arguments);
}
return addProvider;
}();
_proto.removeProvider = /*#__PURE__*/function () {
var _removeProvider = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(providerName) {
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
while (1) switch (_context2.prev = _context2.next) {
case 0:
if (this.providers[providerName]) {
delete this.providers[providerName];
}
case 1:
case "end":
return _context2.stop();
var _removeProvider = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2(providerName) {
return _regeneratorRuntime.wrap(function _callee2$(_context2) {
while (1) {
switch (_context2.prev = _context2.next) {
case 0:
if (this.providers[providerName]) {
delete this.providers[providerName];
}
case 1:
case "end":
return _context2.stop();
}
}
}, _callee2, this);
}));
function removeProvider(_x4) {
return _removeProvider.apply(this, arguments);
}
return removeProvider;
}();
_proto.uploadFile = /*#__PURE__*/function () {
var _uploadFile = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(filenameWithPath, content, params, providerName) {
var _uploadFile = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee3(filenameWithPath, content, params, providerName) {
var provider;
return _regeneratorRuntime().wrap(function _callee3$(_context3) {
while (1) switch (_context3.prev = _context3.next) {
case 0:
if (params === void 0) {
params = {};
}
provider = this.getInvolvedProvider(providerName);
this.logger.debug("[SAVIM] Upload file " + (provider ? "(Provider: " + provider.name + ")" : '(No provider)') + " " + (provider ? "(Provider: " + provider.name + ")" : '(No provider)') + " " + filenameWithPath);
this.logger.debug(params);
if (!provider) {
_context3.next = 6;
break;
}
return _context3.abrupt("return", provider.uploadFile(filenameWithPath, content, params));
case 6:
return _context3.abrupt("return", undefined);
case 7:
case "end":
return _context3.stop();
return _regeneratorRuntime.wrap(function _callee3$(_context3) {
while (1) {
switch (_context3.prev = _context3.next) {
case 0:
if (params === void 0) {
params = {};
}
provider = this.getInvolvedProvider(providerName);
this.logger.debug("[SAVIM] Upload file " + (provider ? "(Provider: " + provider.name + ")" : '(No provider)') + " " + (provider ? "(Provider: " + provider.name + ")" : '(No provider)') + " " + filenameWithPath);
this.logger.debug(params);
if (!provider) {
_context3.next = 6;
break;
}
return _context3.abrupt("return", provider.uploadFile(filenameWithPath, content, params));
case 6:
return _context3.abrupt("return", undefined);
case 7:
case "end":
return _context3.stop();
}
}
}, _callee3, this);
}));
function uploadFile(_x5, _x6, _x7, _x8) {
return _uploadFile.apply(this, arguments);
}
return uploadFile;
}();
_proto.getFile = /*#__PURE__*/function () {
var _getFile = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4(filenameWithPath, params, providerName) {
var _getFile = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee4(filenameWithPath, params, providerName) {
var provider;
return _regeneratorRuntime().wrap(function _callee4$(_context4) {
while (1) switch (_context4.prev = _context4.next) {
case 0:
if (params === void 0) {
params = {};
}
provider = this.getInvolvedProvider(providerName);
this.logger.debug("[SAVIM] Get file " + (provider ? "(Provider: " + provider.name + ")" : '(No provider)') + " " + (provider ? "(Provider: " + provider.name + ")" : '(No provider)') + " " + filenameWithPath);
this.logger.debug(params);
if (!provider) {
_context4.next = 6;
break;
}
return _context4.abrupt("return", provider.getFile(filenameWithPath, params));
case 6:
return _context4.abrupt("return", undefined);
case 7:
case "end":
return _context4.stop();
return _regeneratorRuntime.wrap(function _callee4$(_context4) {
while (1) {
switch (_context4.prev = _context4.next) {
case 0:
if (params === void 0) {
params = {};
}
provider = this.getInvolvedProvider(providerName);
this.logger.debug("[SAVIM] Get file " + (provider ? "(Provider: " + provider.name + ")" : '(No provider)') + " " + (provider ? "(Provider: " + provider.name + ")" : '(No provider)') + " " + filenameWithPath);
this.logger.debug(params);
if (!provider) {
_context4.next = 6;
break;
}
return _context4.abrupt("return", provider.getFile(filenameWithPath, params));
case 6:
return _context4.abrupt("return", undefined);
case 7:
case "end":
return _context4.stop();
}
}
}, _callee4, this);
}));
function getFile(_x9, _x10, _x11) {
return _getFile.apply(this, arguments);
}
return getFile;
}();
_proto.deleteFile = /*#__PURE__*/function () {
var _deleteFile = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee5(filenameWithPath, params, providerName) {
var _deleteFile = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee5(filenameWithPath, params, providerName) {
var provider;
return _regeneratorRuntime().wrap(function _callee5$(_context5) {
while (1) switch (_context5.prev = _context5.next) {
case 0:
if (params === void 0) {
params = {};
}
provider = this.getInvolvedProvider(providerName);
this.logger.debug("[SAVIM] Delete file " + (provider ? "(Provider: " + provider.name + ")" : '(No provider)') + " " + (provider ? "(Provider: " + provider.name + ")" : '(No provider)'));
this.logger.debug(params);
if (!provider) {
_context5.next = 6;
break;
}
return _context5.abrupt("return", provider.deleteFile(filenameWithPath, params));
case 6:
return _context5.abrupt("return", undefined);
case 7:
case "end":
return _context5.stop();
return _regeneratorRuntime.wrap(function _callee5$(_context5) {
while (1) {
switch (_context5.prev = _context5.next) {
case 0:
if (params === void 0) {
params = {};
}
provider = this.getInvolvedProvider(providerName);
this.logger.debug("[SAVIM] Delete file " + (provider ? "(Provider: " + provider.name + ")" : '(No provider)') + " " + (provider ? "(Provider: " + provider.name + ")" : '(No provider)'));
this.logger.debug(params);
if (!provider) {
_context5.next = 6;
break;
}
return _context5.abrupt("return", provider.deleteFile(filenameWithPath, params));
case 6:
return _context5.abrupt("return", undefined);
case 7:
case "end":
return _context5.stop();
}
}
}, _callee5, this);
}));
function deleteFile(_x12, _x13, _x14) {
return _deleteFile.apply(this, arguments);
}
return deleteFile;
}();
_proto.createFolder = /*#__PURE__*/function () {
var _createFolder = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee6(path, params, providerName) {
var _createFolder = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee6(path, params, providerName) {
var provider;
return _regeneratorRuntime().wrap(function _callee6$(_context6) {
while (1) switch (_context6.prev = _context6.next) {
case 0:
if (params === void 0) {
params = {};
}
provider = this.getInvolvedProvider(providerName);
this.logger.debug("[SAVIM] Create folder " + (provider ? "(Provider: " + provider.name + ")" : '(No provider)') + " " + (provider ? "(Provider: " + provider.name + ")" : '(No provider)') + " " + path);
this.logger.debug(params);
if (!provider) {
_context6.next = 6;
break;
}
return _context6.abrupt("return", provider.createFolder(path, params));
case 6:
return _context6.abrupt("return", undefined);
case 7:
case "end":
return _context6.stop();
return _regeneratorRuntime.wrap(function _callee6$(_context6) {
while (1) {
switch (_context6.prev = _context6.next) {
case 0:
if (params === void 0) {
params = {};
}
provider = this.getInvolvedProvider(providerName);
this.logger.debug("[SAVIM] Create folder " + (provider ? "(Provider: " + provider.name + ")" : '(No provider)') + " " + (provider ? "(Provider: " + provider.name + ")" : '(No provider)') + " " + path);
this.logger.debug(params);
if (!provider) {
_context6.next = 6;
break;
}
return _context6.abrupt("return", provider.createFolder(path, params));
case 6:
return _context6.abrupt("return", undefined);
case 7:
case "end":
return _context6.stop();
}
}
}, _callee6, this);
}));
function createFolder(_x15, _x16, _x17) {
return _createFolder.apply(this, arguments);
}
return createFolder;
}();
_proto.deleteFolder = /*#__PURE__*/function () {
var _deleteFolder = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee7(path, params, providerName) {
var _deleteFolder = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee7(path, params, providerName) {
var provider;
return _regeneratorRuntime().wrap(function _callee7$(_context7) {
while (1) switch (_context7.prev = _context7.next) {
case 0:
if (params === void 0) {
params = {};
}
provider = this.getInvolvedProvider(providerName);
this.logger.debug("[SAVIM] Delete folder " + (provider ? "(Provider: " + provider.name + ")" : '(No provider)') + " " + (provider ? "(Provider: " + provider.name + ")" : '(No provider)'));
this.logger.debug(params);
if (!provider) {
_context7.next = 6;
break;
}
return _context7.abrupt("return", provider.deleteFolder(path, params));
case 6:
return _context7.abrupt("return", undefined);
case 7:
case "end":
return _context7.stop();
return _regeneratorRuntime.wrap(function _callee7$(_context7) {
while (1) {
switch (_context7.prev = _context7.next) {
case 0:
if (params === void 0) {
params = {};
}
provider = this.getInvolvedProvider(providerName);
this.logger.debug("[SAVIM] Delete folder " + (provider ? "(Provider: " + provider.name + ")" : '(No provider)') + " " + (provider ? "(Provider: " + provider.name + ")" : '(No provider)'));
this.logger.debug(params);
if (!provider) {
_context7.next = 6;
break;
}
return _context7.abrupt("return", provider.deleteFolder(path, params));
case 6:
return _context7.abrupt("return", undefined);
case 7:
case "end":
return _context7.stop();
}
}
}, _callee7, this);
}));
function deleteFolder(_x18, _x19, _x20) {
return _deleteFolder.apply(this, arguments);
}
return deleteFolder;
}();
_proto.getFolders = /*#__PURE__*/function () {
var _getFolders = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee8(path, params, providerName) {
var _getFolders = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee8(path, params, providerName) {
var provider;
return _regeneratorRuntime().wrap(function _callee8$(_context8) {
while (1) switch (_context8.prev = _context8.next) {
case 0:
if (params === void 0) {
params = {};
}
provider = this.getInvolvedProvider(providerName);
this.logger.debug("[SAVIM] Get folders " + (provider ? "(Provider: " + provider.name + ")" : '(No provider)') + " " + (provider ? "(Provider: " + provider.name + ")" : '(No provider)') + " " + path);
this.logger.debug(params);
if (!provider) {
_context8.next = 6;
break;
}
return _context8.abrupt("return", provider.getFolders(path, params));
case 6:
return _context8.abrupt("return", undefined);
case 7:
case "end":
return _context8.stop();
return _regeneratorRuntime.wrap(function _callee8$(_context8) {
while (1) {
switch (_context8.prev = _context8.next) {
case 0:
if (params === void 0) {
params = {};
}
provider = this.getInvolvedProvider(providerName);
this.logger.debug("[SAVIM] Get folders " + (provider ? "(Provider: " + provider.name + ")" : '(No provider)') + " " + (provider ? "(Provider: " + provider.name + ")" : '(No provider)') + " " + path);
this.logger.debug(params);
if (!provider) {
_context8.next = 6;
break;
}
return _context8.abrupt("return", provider.getFolders(path, params));
case 6:
return _context8.abrupt("return", undefined);
case 7:
case "end":
return _context8.stop();
}
}
}, _callee8, this);
}));
function getFolders(_x21, _x22, _x23) {
return _getFolders.apply(this, arguments);
}
return getFolders;
}();
_proto.getFiles = /*#__PURE__*/function () {
var _getFiles = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee9(path, params, providerName) {
var _getFiles = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee9(path, params, providerName) {
var provider;
return _regeneratorRuntime().wrap(function _callee9$(_context9) {
while (1) switch (_context9.prev = _context9.next) {
case 0:
if (params === void 0) {
params = {};
}
provider = this.getInvolvedProvider(providerName);
this.logger.debug("[SAVIM] Get files " + (provider ? "(Provider: " + provider.name + ")" : '(No provider)') + " " + (provider ? "(Provider: " + provider.name + ")" : '(No provider)') + " " + path);
this.logger.debug(params);
if (!provider) {
_context9.next = 6;
break;
}
return _context9.abrupt("return", provider.getFiles(path, params));
case 6:
return _context9.abrupt("return", undefined);
case 7:
case "end":
return _context9.stop();
return _regeneratorRuntime.wrap(function _callee9$(_context9) {
while (1) {
switch (_context9.prev = _context9.next) {
case 0:
if (params === void 0) {
params = {};
}
provider = this.getInvolvedProvider(providerName);
this.logger.debug("[SAVIM] Get files " + (provider ? "(Provider: " + provider.name + ")" : '(No provider)') + " " + (provider ? "(Provider: " + provider.name + ")" : '(No provider)') + " " + path);
this.logger.debug(params);
if (!provider) {
_context9.next = 6;
break;
}
return _context9.abrupt("return", provider.getFiles(path, params));
case 6:
return _context9.abrupt("return", undefined);
case 7:
case "end":
return _context9.stop();
}
}
}, _callee9, this);
}));
function getFiles(_x24, _x25, _x26) {
return _getFiles.apply(this, arguments);
}
return getFiles;
}();
return Savim;

@@ -629,0 +432,0 @@ }();

@@ -1,2 +0,2 @@

"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var r,t=(r=require("pino"))&&"object"==typeof r&&"default"in r?r.default:r;function e(r,t,e,n,o,i,a){try{var u=r[i](a),c=u.value}catch(r){return void e(r)}u.done?t(c):Promise.resolve(c).then(n,o)}function n(r){return function(){var t=this,n=arguments;return new Promise((function(o,i){var a=r.apply(t,n);function u(r){e(a,o,i,u,c,"next",r)}function c(r){e(a,o,i,u,c,"throw",r)}u(void 0)}))}}function o(){o=function(){return t};var r,t={},e=Object.prototype,n=e.hasOwnProperty,i=Object.defineProperty||function(r,t,e){r[t]=e.value},a="function"==typeof Symbol?Symbol:{},u=a.iterator||"@@iterator",c=a.asyncIterator||"@@asyncIterator",s=a.toStringTag||"@@toStringTag";function l(r,t,e){return Object.defineProperty(r,t,{value:e,enumerable:!0,configurable:!0,writable:!0}),r[t]}try{l({},"")}catch(r){l=function(r,t,e){return r[t]=e}}function f(r,t,e,n){var o=Object.create((t&&t.prototype instanceof y?t:y).prototype),a=new _(n||[]);return i(o,"_invoke",{value:N(r,e,a)}),o}function h(r,t,e){try{return{type:"normal",arg:r.call(t,e)}}catch(r){return{type:"throw",arg:r}}}t.wrap=f;var v="suspendedStart",d="executing",p="completed",g={};function y(){}function m(){}function b(){}var w={};l(w,u,(function(){return this}));var x=Object.getPrototypeOf,P=x&&x(x(j([])));P&&P!==e&&n.call(P,u)&&(w=P);var L=b.prototype=y.prototype=Object.create(w);function k(r){["next","throw","return"].forEach((function(t){l(r,t,(function(r){return this._invoke(t,r)}))}))}function E(r,t){function e(o,i,a,u){var c=h(r[o],r,i);if("throw"!==c.type){var s=c.arg,l=s.value;return l&&"object"==typeof l&&n.call(l,"__await")?t.resolve(l.__await).then((function(r){e("next",r,a,u)}),(function(r){e("throw",r,a,u)})):t.resolve(l).then((function(r){s.value=r,a(s)}),(function(r){return e("throw",r,a,u)}))}u(c.arg)}var o;i(this,"_invoke",{value:function(r,n){function i(){return new t((function(t,o){e(r,n,t,o)}))}return o=o?o.then(i,i):i()}})}function N(t,e,n){var o=v;return function(i,a){if(o===d)throw Error("Generator is already running");if(o===p){if("throw"===i)throw a;return{value:r,done:!0}}for(n.method=i,n.arg=a;;){var u=n.delegate;if(u){var c=I(u,n);if(c){if(c===g)continue;return c}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if(o===v)throw o=p,n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);o=d;var s=h(t,e,n);if("normal"===s.type){if(o=n.done?p:"suspendedYield",s.arg===g)continue;return{value:s.arg,done:n.done}}"throw"===s.type&&(o=p,n.method="throw",n.arg=s.arg)}}}function I(t,e){var n=e.method,o=t.iterator[n];if(o===r)return e.delegate=null,"throw"===n&&t.iterator.return&&(e.method="return",e.arg=r,I(t,e),"throw"===e.method)||"return"!==n&&(e.method="throw",e.arg=new TypeError("The iterator does not provide a '"+n+"' method")),g;var i=h(o,t.iterator,e.arg);if("throw"===i.type)return e.method="throw",e.arg=i.arg,e.delegate=null,g;var a=i.arg;return a?a.done?(e[t.resultName]=a.value,e.next=t.nextLoc,"return"!==e.method&&(e.method="next",e.arg=r),e.delegate=null,g):a:(e.method="throw",e.arg=new TypeError("iterator result is not an object"),e.delegate=null,g)}function F(r){var t={tryLoc:r[0]};1 in r&&(t.catchLoc=r[1]),2 in r&&(t.finallyLoc=r[2],t.afterLoc=r[3]),this.tryEntries.push(t)}function S(r){var t=r.completion||{};t.type="normal",delete t.arg,r.completion=t}function _(r){this.tryEntries=[{tryLoc:"root"}],r.forEach(F,this),this.reset(!0)}function j(t){if(t||""===t){var e=t[u];if(e)return e.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var o=-1,i=function e(){for(;++o<t.length;)if(n.call(t,o))return e.value=t[o],e.done=!1,e;return e.value=r,e.done=!0,e};return i.next=i}}throw new TypeError(typeof t+" is not iterable")}return m.prototype=b,i(L,"constructor",{value:b,configurable:!0}),i(b,"constructor",{value:m,configurable:!0}),m.displayName=l(b,s,"GeneratorFunction"),t.isGeneratorFunction=function(r){var t="function"==typeof r&&r.constructor;return!!t&&(t===m||"GeneratorFunction"===(t.displayName||t.name))},t.mark=function(r){return Object.setPrototypeOf?Object.setPrototypeOf(r,b):(r.__proto__=b,l(r,s,"GeneratorFunction")),r.prototype=Object.create(L),r},t.awrap=function(r){return{__await:r}},k(E.prototype),l(E.prototype,c,(function(){return this})),t.AsyncIterator=E,t.async=function(r,e,n,o,i){void 0===i&&(i=Promise);var a=new E(f(r,e,n,o),i);return t.isGeneratorFunction(e)?a:a.next().then((function(r){return r.done?r.value:a.next()}))},k(L),l(L,s,"Generator"),l(L,u,(function(){return this})),l(L,"toString",(function(){return"[object Generator]"})),t.keys=function(r){var t=Object(r),e=[];for(var n in t)e.push(n);return e.reverse(),function r(){for(;e.length;){var n=e.pop();if(n in t)return r.value=n,r.done=!1,r}return r.done=!0,r}},t.values=j,_.prototype={constructor:_,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=r,this.done=!1,this.delegate=null,this.method="next",this.arg=r,this.tryEntries.forEach(S),!t)for(var e in this)"t"===e.charAt(0)&&n.call(this,e)&&!isNaN(+e.slice(1))&&(this[e]=r)},stop:function(){this.done=!0;var r=this.tryEntries[0].completion;if("throw"===r.type)throw r.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var e=this;function o(n,o){return u.type="throw",u.arg=t,e.next=n,o&&(e.method="next",e.arg=r),!!o}for(var i=this.tryEntries.length-1;i>=0;--i){var a=this.tryEntries[i],u=a.completion;if("root"===a.tryLoc)return o("end");if(a.tryLoc<=this.prev){var c=n.call(a,"catchLoc"),s=n.call(a,"finallyLoc");if(c&&s){if(this.prev<a.catchLoc)return o(a.catchLoc,!0);if(this.prev<a.finallyLoc)return o(a.finallyLoc)}else if(c){if(this.prev<a.catchLoc)return o(a.catchLoc,!0)}else{if(!s)throw Error("try statement without catch or finally");if(this.prev<a.finallyLoc)return o(a.finallyLoc)}}}},abrupt:function(r,t){for(var e=this.tryEntries.length-1;e>=0;--e){var o=this.tryEntries[e];if(o.tryLoc<=this.prev&&n.call(o,"finallyLoc")&&this.prev<o.finallyLoc){var i=o;break}}i&&("break"===r||"continue"===r)&&i.tryLoc<=t&&t<=i.finallyLoc&&(i=null);var a=i?i.completion:{};return a.type=r,a.arg=t,i?(this.method="next",this.next=i.finallyLoc,g):this.complete(a)},complete:function(r,t){if("throw"===r.type)throw r.arg;return"break"===r.type||"continue"===r.type?this.next=r.arg:"return"===r.type?(this.rval=this.arg=r.arg,this.method="return",this.next="end"):"normal"===r.type&&t&&(this.next=t),g},finish:function(r){for(var t=this.tryEntries.length-1;t>=0;--t){var e=this.tryEntries[t];if(e.finallyLoc===r)return this.complete(e.completion,e.afterLoc),S(e),g}},catch:function(r){for(var t=this.tryEntries.length-1;t>=0;--t){var e=this.tryEntries[t];if(e.tryLoc===r){var n=e.completion;if("throw"===n.type){var o=n.arg;S(e)}return o}}throw Error("illegal catch attempt")},delegateYield:function(t,e,n){return this.delegate={iterator:j(t),resultName:e,nextLoc:n},"next"===this.method&&(this.arg=r),g}},t}exports.Savim=function(){function r(r){var e=this;this.log=r,this.providers={},this.getInvolvedProvider=function(r){var t=Object.keys(e.providers),n=void 0;return r&&e.providers[r]?n=e.providers[r]:(null==t?void 0:t.length)>0&&(n=e.providers[t[0]]),n},this.logger=t({level:r||"info"})}var e=r.prototype;return e.addProvider=function(){var r=n(o().mark((function r(t,e,n){var i;return o().wrap((function(r){for(;;)switch(r.prev=r.next){case 0:return i=new t(e),r.next=3,i.isHealthy();case 3:if(r.sent){r.next=6;break}throw this.logger.error("[SAVIM] Provider "+i.name+" is not healthy !"),"Provider is not healthy !";case 6:if(!this.providers[n||i.name]){r.next=9;break}throw this.logger.error("[SAVIM] Provider "+(n||i.name)+" is not healthy !"),"Provider already exist !";case 9:this.providers[n||i.name]=i;case 10:case"end":return r.stop()}}),r,this)})));return function(t,e,n){return r.apply(this,arguments)}}(),e.removeProvider=function(){var r=n(o().mark((function r(t){return o().wrap((function(r){for(;;)switch(r.prev=r.next){case 0:this.providers[t]&&delete this.providers[t];case 1:case"end":return r.stop()}}),r,this)})));return function(t){return r.apply(this,arguments)}}(),e.uploadFile=function(){var r=n(o().mark((function r(t,e,n,i){var a;return o().wrap((function(r){for(;;)switch(r.prev=r.next){case 0:if(void 0===n&&(n={}),a=this.getInvolvedProvider(i),this.logger.debug("[SAVIM] Upload file "+(a?"(Provider: "+a.name+")":"(No provider)")+" "+(a?"(Provider: "+a.name+")":"(No provider)")+" "+t),this.logger.debug(n),!a){r.next=6;break}return r.abrupt("return",a.uploadFile(t,e,n));case 6:return r.abrupt("return",void 0);case 7:case"end":return r.stop()}}),r,this)})));return function(t,e,n,o){return r.apply(this,arguments)}}(),e.getFile=function(){var r=n(o().mark((function r(t,e,n){var i;return o().wrap((function(r){for(;;)switch(r.prev=r.next){case 0:if(void 0===e&&(e={}),i=this.getInvolvedProvider(n),this.logger.debug("[SAVIM] Get file "+(i?"(Provider: "+i.name+")":"(No provider)")+" "+(i?"(Provider: "+i.name+")":"(No provider)")+" "+t),this.logger.debug(e),!i){r.next=6;break}return r.abrupt("return",i.getFile(t,e));case 6:return r.abrupt("return",void 0);case 7:case"end":return r.stop()}}),r,this)})));return function(t,e,n){return r.apply(this,arguments)}}(),e.deleteFile=function(){var r=n(o().mark((function r(t,e,n){var i;return o().wrap((function(r){for(;;)switch(r.prev=r.next){case 0:if(void 0===e&&(e={}),i=this.getInvolvedProvider(n),this.logger.debug("[SAVIM] Delete file "+(i?"(Provider: "+i.name+")":"(No provider)")+" "+(i?"(Provider: "+i.name+")":"(No provider)")),this.logger.debug(e),!i){r.next=6;break}return r.abrupt("return",i.deleteFile(t,e));case 6:return r.abrupt("return",void 0);case 7:case"end":return r.stop()}}),r,this)})));return function(t,e,n){return r.apply(this,arguments)}}(),e.createFolder=function(){var r=n(o().mark((function r(t,e,n){var i;return o().wrap((function(r){for(;;)switch(r.prev=r.next){case 0:if(void 0===e&&(e={}),i=this.getInvolvedProvider(n),this.logger.debug("[SAVIM] Create folder "+(i?"(Provider: "+i.name+")":"(No provider)")+" "+(i?"(Provider: "+i.name+")":"(No provider)")+" "+t),this.logger.debug(e),!i){r.next=6;break}return r.abrupt("return",i.createFolder(t,e));case 6:return r.abrupt("return",void 0);case 7:case"end":return r.stop()}}),r,this)})));return function(t,e,n){return r.apply(this,arguments)}}(),e.deleteFolder=function(){var r=n(o().mark((function r(t,e,n){var i;return o().wrap((function(r){for(;;)switch(r.prev=r.next){case 0:if(void 0===e&&(e={}),i=this.getInvolvedProvider(n),this.logger.debug("[SAVIM] Delete folder "+(i?"(Provider: "+i.name+")":"(No provider)")+" "+(i?"(Provider: "+i.name+")":"(No provider)")),this.logger.debug(e),!i){r.next=6;break}return r.abrupt("return",i.deleteFolder(t,e));case 6:return r.abrupt("return",void 0);case 7:case"end":return r.stop()}}),r,this)})));return function(t,e,n){return r.apply(this,arguments)}}(),e.getFolders=function(){var r=n(o().mark((function r(t,e,n){var i;return o().wrap((function(r){for(;;)switch(r.prev=r.next){case 0:if(void 0===e&&(e={}),i=this.getInvolvedProvider(n),this.logger.debug("[SAVIM] Get folders "+(i?"(Provider: "+i.name+")":"(No provider)")+" "+(i?"(Provider: "+i.name+")":"(No provider)")+" "+t),this.logger.debug(e),!i){r.next=6;break}return r.abrupt("return",i.getFolders(t,e));case 6:return r.abrupt("return",void 0);case 7:case"end":return r.stop()}}),r,this)})));return function(t,e,n){return r.apply(this,arguments)}}(),e.getFiles=function(){var r=n(o().mark((function r(t,e,n){var i;return o().wrap((function(r){for(;;)switch(r.prev=r.next){case 0:if(void 0===e&&(e={}),i=this.getInvolvedProvider(n),this.logger.debug("[SAVIM] Get files "+(i?"(Provider: "+i.name+")":"(No provider)")+" "+(i?"(Provider: "+i.name+")":"(No provider)")+" "+t),this.logger.debug(e),!i){r.next=6;break}return r.abrupt("return",i.getFiles(t,e));case 6:return r.abrupt("return",void 0);case 7:case"end":return r.stop()}}),r,this)})));return function(t,e,n){return r.apply(this,arguments)}}(),r}(),exports.SavimProviderInterface=function(r){};
"use strict";function r(r){return r&&"object"==typeof r&&"default"in r?r.default:r}Object.defineProperty(exports,"__esModule",{value:!0});var e=r(require("regenerator-runtime")),t=r(require("pino"));function n(r,e,t,n,i,o,u){try{var a=r[o](u),s=a.value}catch(r){return void t(r)}a.done?e(s):Promise.resolve(s).then(n,i)}function i(r){return function(){var e=this,t=arguments;return new Promise((function(i,o){var u=r.apply(e,t);function a(r){n(u,i,o,a,s,"next",r)}function s(r){n(u,i,o,a,s,"throw",r)}a(void 0)}))}}exports.Savim=function(){function r(r){var e=this;this.log=r,this.providers={},this.getInvolvedProvider=function(r){var t=Object.keys(e.providers),n=void 0;return r&&e.providers[r]?n=e.providers[r]:(null==t?void 0:t.length)>0&&(n=e.providers[t[0]]),n},this.logger=t({level:r||"info"})}var n=r.prototype;return n.addProvider=function(){var r=i(e.mark((function r(t,n,i){var o;return e.wrap((function(r){for(;;)switch(r.prev=r.next){case 0:return o=new t(n),r.next=3,o.isHealthy();case 3:if(r.sent){r.next=6;break}throw this.logger.error("[SAVIM] Provider "+o.name+" is not healthy !"),"Provider is not healthy !";case 6:if(!this.providers[i||o.name]){r.next=9;break}throw this.logger.error("[SAVIM] Provider "+(i||o.name)+" is not healthy !"),"Provider already exist !";case 9:this.providers[i||o.name]=o;case 10:case"end":return r.stop()}}),r,this)})));return function(e,t,n){return r.apply(this,arguments)}}(),n.removeProvider=function(){var r=i(e.mark((function r(t){return e.wrap((function(r){for(;;)switch(r.prev=r.next){case 0:this.providers[t]&&delete this.providers[t];case 1:case"end":return r.stop()}}),r,this)})));return function(e){return r.apply(this,arguments)}}(),n.uploadFile=function(){var r=i(e.mark((function r(t,n,i,o){var u;return e.wrap((function(r){for(;;)switch(r.prev=r.next){case 0:if(void 0===i&&(i={}),u=this.getInvolvedProvider(o),this.logger.debug("[SAVIM] Upload file "+(u?"(Provider: "+u.name+")":"(No provider)")+" "+(u?"(Provider: "+u.name+")":"(No provider)")+" "+t),this.logger.debug(i),!u){r.next=6;break}return r.abrupt("return",u.uploadFile(t,n,i));case 6:return r.abrupt("return",void 0);case 7:case"end":return r.stop()}}),r,this)})));return function(e,t,n,i){return r.apply(this,arguments)}}(),n.getFile=function(){var r=i(e.mark((function r(t,n,i){var o;return e.wrap((function(r){for(;;)switch(r.prev=r.next){case 0:if(void 0===n&&(n={}),o=this.getInvolvedProvider(i),this.logger.debug("[SAVIM] Get file "+(o?"(Provider: "+o.name+")":"(No provider)")+" "+(o?"(Provider: "+o.name+")":"(No provider)")+" "+t),this.logger.debug(n),!o){r.next=6;break}return r.abrupt("return",o.getFile(t,n));case 6:return r.abrupt("return",void 0);case 7:case"end":return r.stop()}}),r,this)})));return function(e,t,n){return r.apply(this,arguments)}}(),n.deleteFile=function(){var r=i(e.mark((function r(t,n,i){var o;return e.wrap((function(r){for(;;)switch(r.prev=r.next){case 0:if(void 0===n&&(n={}),o=this.getInvolvedProvider(i),this.logger.debug("[SAVIM] Delete file "+(o?"(Provider: "+o.name+")":"(No provider)")+" "+(o?"(Provider: "+o.name+")":"(No provider)")),this.logger.debug(n),!o){r.next=6;break}return r.abrupt("return",o.deleteFile(t,n));case 6:return r.abrupt("return",void 0);case 7:case"end":return r.stop()}}),r,this)})));return function(e,t,n){return r.apply(this,arguments)}}(),n.createFolder=function(){var r=i(e.mark((function r(t,n,i){var o;return e.wrap((function(r){for(;;)switch(r.prev=r.next){case 0:if(void 0===n&&(n={}),o=this.getInvolvedProvider(i),this.logger.debug("[SAVIM] Create folder "+(o?"(Provider: "+o.name+")":"(No provider)")+" "+(o?"(Provider: "+o.name+")":"(No provider)")+" "+t),this.logger.debug(n),!o){r.next=6;break}return r.abrupt("return",o.createFolder(t,n));case 6:return r.abrupt("return",void 0);case 7:case"end":return r.stop()}}),r,this)})));return function(e,t,n){return r.apply(this,arguments)}}(),n.deleteFolder=function(){var r=i(e.mark((function r(t,n,i){var o;return e.wrap((function(r){for(;;)switch(r.prev=r.next){case 0:if(void 0===n&&(n={}),o=this.getInvolvedProvider(i),this.logger.debug("[SAVIM] Delete folder "+(o?"(Provider: "+o.name+")":"(No provider)")+" "+(o?"(Provider: "+o.name+")":"(No provider)")),this.logger.debug(n),!o){r.next=6;break}return r.abrupt("return",o.deleteFolder(t,n));case 6:return r.abrupt("return",void 0);case 7:case"end":return r.stop()}}),r,this)})));return function(e,t,n){return r.apply(this,arguments)}}(),n.getFolders=function(){var r=i(e.mark((function r(t,n,i){var o;return e.wrap((function(r){for(;;)switch(r.prev=r.next){case 0:if(void 0===n&&(n={}),o=this.getInvolvedProvider(i),this.logger.debug("[SAVIM] Get folders "+(o?"(Provider: "+o.name+")":"(No provider)")+" "+(o?"(Provider: "+o.name+")":"(No provider)")+" "+t),this.logger.debug(n),!o){r.next=6;break}return r.abrupt("return",o.getFolders(t,n));case 6:return r.abrupt("return",void 0);case 7:case"end":return r.stop()}}),r,this)})));return function(e,t,n){return r.apply(this,arguments)}}(),n.getFiles=function(){var r=i(e.mark((function r(t,n,i){var o;return e.wrap((function(r){for(;;)switch(r.prev=r.next){case 0:if(void 0===n&&(n={}),o=this.getInvolvedProvider(i),this.logger.debug("[SAVIM] Get files "+(o?"(Provider: "+o.name+")":"(No provider)")+" "+(o?"(Provider: "+o.name+")":"(No provider)")+" "+t),this.logger.debug(n),!o){r.next=6;break}return r.abrupt("return",o.getFiles(t,n));case 6:return r.abrupt("return",void 0);case 7:case"end":return r.stop()}}),r,this)})));return function(e,t,n){return r.apply(this,arguments)}}(),r}(),exports.SavimProviderInterface=function(r){};
//# sourceMappingURL=savim.cjs.production.min.js.map

@@ -0,332 +1,41 @@

import _regeneratorRuntime from 'regenerator-runtime';
import Pino from 'pino';
function asyncGeneratorStep(n, t, e, r, o, a, c) {
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
try {
var i = n[a](c),
u = i.value;
} catch (n) {
return void e(n);
var info = gen[key](arg);
var value = info.value;
} catch (error) {
reject(error);
return;
}
i.done ? t(u) : Promise.resolve(u).then(r, o);
if (info.done) {
resolve(value);
} else {
Promise.resolve(value).then(_next, _throw);
}
}
function _asyncToGenerator(n) {
function _asyncToGenerator(fn) {
return function () {
var t = this,
e = arguments;
return new Promise(function (r, o) {
var a = n.apply(t, e);
function _next(n) {
asyncGeneratorStep(a, r, o, _next, _throw, "next", n);
var self = this,
args = arguments;
return new Promise(function (resolve, reject) {
var gen = fn.apply(self, args);
function _next(value) {
asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value);
}
function _throw(n) {
asyncGeneratorStep(a, r, o, _next, _throw, "throw", n);
function _throw(err) {
asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err);
}
_next(void 0);
_next(undefined);
});
};
}
function _regeneratorRuntime() {
_regeneratorRuntime = function () {
return e;
};
var t,
e = {},
r = Object.prototype,
n = r.hasOwnProperty,
o = Object.defineProperty || function (t, e, r) {
t[e] = r.value;
},
i = "function" == typeof Symbol ? Symbol : {},
a = i.iterator || "@@iterator",
c = i.asyncIterator || "@@asyncIterator",
u = i.toStringTag || "@@toStringTag";
function define(t, e, r) {
return Object.defineProperty(t, e, {
value: r,
enumerable: !0,
configurable: !0,
writable: !0
}), t[e];
}
try {
define({}, "");
} catch (t) {
define = function (t, e, r) {
return t[e] = r;
};
}
function wrap(t, e, r, n) {
var i = e && e.prototype instanceof Generator ? e : Generator,
a = Object.create(i.prototype),
c = new Context(n || []);
return o(a, "_invoke", {
value: makeInvokeMethod(t, r, c)
}), a;
}
function tryCatch(t, e, r) {
try {
return {
type: "normal",
arg: t.call(e, r)
};
} catch (t) {
return {
type: "throw",
arg: t
};
}
}
e.wrap = wrap;
var h = "suspendedStart",
l = "suspendedYield",
f = "executing",
s = "completed",
y = {};
function Generator() {}
function GeneratorFunction() {}
function GeneratorFunctionPrototype() {}
var p = {};
define(p, a, function () {
return this;
});
var d = Object.getPrototypeOf,
v = d && d(d(values([])));
v && v !== r && n.call(v, a) && (p = v);
var g = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(p);
function defineIteratorMethods(t) {
["next", "throw", "return"].forEach(function (e) {
define(t, e, function (t) {
return this._invoke(e, t);
});
});
}
function AsyncIterator(t, e) {
function invoke(r, o, i, a) {
var c = tryCatch(t[r], t, o);
if ("throw" !== c.type) {
var u = c.arg,
h = u.value;
return h && "object" == typeof h && n.call(h, "__await") ? e.resolve(h.__await).then(function (t) {
invoke("next", t, i, a);
}, function (t) {
invoke("throw", t, i, a);
}) : e.resolve(h).then(function (t) {
u.value = t, i(u);
}, function (t) {
return invoke("throw", t, i, a);
});
}
a(c.arg);
}
var r;
o(this, "_invoke", {
value: function (t, n) {
function callInvokeWithMethodAndArg() {
return new e(function (e, r) {
invoke(t, n, e, r);
});
}
return r = r ? r.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg();
}
});
}
function makeInvokeMethod(e, r, n) {
var o = h;
return function (i, a) {
if (o === f) throw Error("Generator is already running");
if (o === s) {
if ("throw" === i) throw a;
return {
value: t,
done: !0
};
}
for (n.method = i, n.arg = a;;) {
var c = n.delegate;
if (c) {
var u = maybeInvokeDelegate(c, n);
if (u) {
if (u === y) continue;
return u;
}
}
if ("next" === n.method) n.sent = n._sent = n.arg;else if ("throw" === n.method) {
if (o === h) throw o = s, n.arg;
n.dispatchException(n.arg);
} else "return" === n.method && n.abrupt("return", n.arg);
o = f;
var p = tryCatch(e, r, n);
if ("normal" === p.type) {
if (o = n.done ? s : l, p.arg === y) continue;
return {
value: p.arg,
done: n.done
};
}
"throw" === p.type && (o = s, n.method = "throw", n.arg = p.arg);
}
};
}
function maybeInvokeDelegate(e, r) {
var n = r.method,
o = e.iterator[n];
if (o === t) return r.delegate = null, "throw" === n && e.iterator.return && (r.method = "return", r.arg = t, maybeInvokeDelegate(e, r), "throw" === r.method) || "return" !== n && (r.method = "throw", r.arg = new TypeError("The iterator does not provide a '" + n + "' method")), y;
var i = tryCatch(o, e.iterator, r.arg);
if ("throw" === i.type) return r.method = "throw", r.arg = i.arg, r.delegate = null, y;
var a = i.arg;
return a ? a.done ? (r[e.resultName] = a.value, r.next = e.nextLoc, "return" !== r.method && (r.method = "next", r.arg = t), r.delegate = null, y) : a : (r.method = "throw", r.arg = new TypeError("iterator result is not an object"), r.delegate = null, y);
}
function pushTryEntry(t) {
var e = {
tryLoc: t[0]
};
1 in t && (e.catchLoc = t[1]), 2 in t && (e.finallyLoc = t[2], e.afterLoc = t[3]), this.tryEntries.push(e);
}
function resetTryEntry(t) {
var e = t.completion || {};
e.type = "normal", delete e.arg, t.completion = e;
}
function Context(t) {
this.tryEntries = [{
tryLoc: "root"
}], t.forEach(pushTryEntry, this), this.reset(!0);
}
function values(e) {
if (e || "" === e) {
var r = e[a];
if (r) return r.call(e);
if ("function" == typeof e.next) return e;
if (!isNaN(e.length)) {
var o = -1,
i = function next() {
for (; ++o < e.length;) if (n.call(e, o)) return next.value = e[o], next.done = !1, next;
return next.value = t, next.done = !0, next;
};
return i.next = i;
}
}
throw new TypeError(typeof e + " is not iterable");
}
return GeneratorFunction.prototype = GeneratorFunctionPrototype, o(g, "constructor", {
value: GeneratorFunctionPrototype,
configurable: !0
}), o(GeneratorFunctionPrototype, "constructor", {
value: GeneratorFunction,
configurable: !0
}), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, u, "GeneratorFunction"), e.isGeneratorFunction = function (t) {
var e = "function" == typeof t && t.constructor;
return !!e && (e === GeneratorFunction || "GeneratorFunction" === (e.displayName || e.name));
}, e.mark = function (t) {
return Object.setPrototypeOf ? Object.setPrototypeOf(t, GeneratorFunctionPrototype) : (t.__proto__ = GeneratorFunctionPrototype, define(t, u, "GeneratorFunction")), t.prototype = Object.create(g), t;
}, e.awrap = function (t) {
return {
__await: t
};
}, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, c, function () {
return this;
}), e.AsyncIterator = AsyncIterator, e.async = function (t, r, n, o, i) {
void 0 === i && (i = Promise);
var a = new AsyncIterator(wrap(t, r, n, o), i);
return e.isGeneratorFunction(r) ? a : a.next().then(function (t) {
return t.done ? t.value : a.next();
});
}, defineIteratorMethods(g), define(g, u, "Generator"), define(g, a, function () {
return this;
}), define(g, "toString", function () {
return "[object Generator]";
}), e.keys = function (t) {
var e = Object(t),
r = [];
for (var n in e) r.push(n);
return r.reverse(), function next() {
for (; r.length;) {
var t = r.pop();
if (t in e) return next.value = t, next.done = !1, next;
}
return next.done = !0, next;
};
}, e.values = values, Context.prototype = {
constructor: Context,
reset: function (e) {
if (this.prev = 0, this.next = 0, this.sent = this._sent = t, this.done = !1, this.delegate = null, this.method = "next", this.arg = t, this.tryEntries.forEach(resetTryEntry), !e) for (var r in this) "t" === r.charAt(0) && n.call(this, r) && !isNaN(+r.slice(1)) && (this[r] = t);
},
stop: function () {
this.done = !0;
var t = this.tryEntries[0].completion;
if ("throw" === t.type) throw t.arg;
return this.rval;
},
dispatchException: function (e) {
if (this.done) throw e;
var r = this;
function handle(n, o) {
return a.type = "throw", a.arg = e, r.next = n, o && (r.method = "next", r.arg = t), !!o;
}
for (var o = this.tryEntries.length - 1; o >= 0; --o) {
var i = this.tryEntries[o],
a = i.completion;
if ("root" === i.tryLoc) return handle("end");
if (i.tryLoc <= this.prev) {
var c = n.call(i, "catchLoc"),
u = n.call(i, "finallyLoc");
if (c && u) {
if (this.prev < i.catchLoc) return handle(i.catchLoc, !0);
if (this.prev < i.finallyLoc) return handle(i.finallyLoc);
} else if (c) {
if (this.prev < i.catchLoc) return handle(i.catchLoc, !0);
} else {
if (!u) throw Error("try statement without catch or finally");
if (this.prev < i.finallyLoc) return handle(i.finallyLoc);
}
}
}
},
abrupt: function (t, e) {
for (var r = this.tryEntries.length - 1; r >= 0; --r) {
var o = this.tryEntries[r];
if (o.tryLoc <= this.prev && n.call(o, "finallyLoc") && this.prev < o.finallyLoc) {
var i = o;
break;
}
}
i && ("break" === t || "continue" === t) && i.tryLoc <= e && e <= i.finallyLoc && (i = null);
var a = i ? i.completion : {};
return a.type = t, a.arg = e, i ? (this.method = "next", this.next = i.finallyLoc, y) : this.complete(a);
},
complete: function (t, e) {
if ("throw" === t.type) throw t.arg;
return "break" === t.type || "continue" === t.type ? this.next = t.arg : "return" === t.type ? (this.rval = this.arg = t.arg, this.method = "return", this.next = "end") : "normal" === t.type && e && (this.next = e), y;
},
finish: function (t) {
for (var e = this.tryEntries.length - 1; e >= 0; --e) {
var r = this.tryEntries[e];
if (r.finallyLoc === t) return this.complete(r.completion, r.afterLoc), resetTryEntry(r), y;
}
},
catch: function (t) {
for (var e = this.tryEntries.length - 1; e >= 0; --e) {
var r = this.tryEntries[e];
if (r.tryLoc === t) {
var n = r.completion;
if ("throw" === n.type) {
var o = n.arg;
resetTryEntry(r);
}
return o;
}
}
throw Error("illegal catch attempt");
},
delegateYield: function (e, r, n) {
return this.delegate = {
iterator: values(e),
resultName: r,
nextLoc: n
}, "next" === this.method && (this.arg = t), y;
}
}, e;
}
var SavimProviderInterface =
// eslint-disable-next-line @typescript-eslint/no-unused-vars, @typescript-eslint/no-empty-function
var SavimProviderInterface = // eslint-disable-next-line @typescript-eslint/no-unused-vars, @typescript-eslint/no-empty-function
function SavimProviderInterface(_config) {};

@@ -336,7 +45,10 @@ var Savim = /*#__PURE__*/function () {

var _this = this;
this.log = log;
this.providers = {};
this.getInvolvedProvider = function (providerName) {
var ProvidersKeys = Object.keys(_this.providers);
var provider = undefined;
if (providerName && _this.providers[providerName]) {

@@ -347,4 +59,6 @@ provider = _this.providers[providerName];

}
return provider;
};
this.logger = Pino({

@@ -354,268 +68,357 @@ level: log || 'info'

}
var _proto = Savim.prototype;
_proto.addProvider = /*#__PURE__*/function () {
var _addProvider = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(provider, config, providerName) {
var _addProvider = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(provider, config, providerName) {
var newProvider;
return _regeneratorRuntime().wrap(function _callee$(_context) {
while (1) switch (_context.prev = _context.next) {
case 0:
newProvider = new provider(config);
_context.next = 3;
return newProvider.isHealthy();
case 3:
if (_context.sent) {
_context.next = 6;
break;
}
this.logger.error("[SAVIM] Provider " + newProvider.name + " is not healthy !");
throw 'Provider is not healthy !';
case 6:
if (!this.providers[providerName || newProvider.name]) {
_context.next = 9;
break;
}
this.logger.error("[SAVIM] Provider " + (providerName || newProvider.name) + " is not healthy !");
throw 'Provider already exist !';
case 9:
this.providers[providerName || newProvider.name] = newProvider;
case 10:
case "end":
return _context.stop();
return _regeneratorRuntime.wrap(function _callee$(_context) {
while (1) {
switch (_context.prev = _context.next) {
case 0:
newProvider = new provider(config);
_context.next = 3;
return newProvider.isHealthy();
case 3:
if (_context.sent) {
_context.next = 6;
break;
}
this.logger.error("[SAVIM] Provider " + newProvider.name + " is not healthy !");
throw 'Provider is not healthy !';
case 6:
if (!this.providers[providerName || newProvider.name]) {
_context.next = 9;
break;
}
this.logger.error("[SAVIM] Provider " + (providerName || newProvider.name) + " is not healthy !");
throw 'Provider already exist !';
case 9:
this.providers[providerName || newProvider.name] = newProvider;
case 10:
case "end":
return _context.stop();
}
}
}, _callee, this);
}));
function addProvider(_x, _x2, _x3) {
return _addProvider.apply(this, arguments);
}
return addProvider;
}();
_proto.removeProvider = /*#__PURE__*/function () {
var _removeProvider = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(providerName) {
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
while (1) switch (_context2.prev = _context2.next) {
case 0:
if (this.providers[providerName]) {
delete this.providers[providerName];
}
case 1:
case "end":
return _context2.stop();
var _removeProvider = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2(providerName) {
return _regeneratorRuntime.wrap(function _callee2$(_context2) {
while (1) {
switch (_context2.prev = _context2.next) {
case 0:
if (this.providers[providerName]) {
delete this.providers[providerName];
}
case 1:
case "end":
return _context2.stop();
}
}
}, _callee2, this);
}));
function removeProvider(_x4) {
return _removeProvider.apply(this, arguments);
}
return removeProvider;
}();
_proto.uploadFile = /*#__PURE__*/function () {
var _uploadFile = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(filenameWithPath, content, params, providerName) {
var _uploadFile = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee3(filenameWithPath, content, params, providerName) {
var provider;
return _regeneratorRuntime().wrap(function _callee3$(_context3) {
while (1) switch (_context3.prev = _context3.next) {
case 0:
if (params === void 0) {
params = {};
}
provider = this.getInvolvedProvider(providerName);
this.logger.debug("[SAVIM] Upload file " + (provider ? "(Provider: " + provider.name + ")" : '(No provider)') + " " + (provider ? "(Provider: " + provider.name + ")" : '(No provider)') + " " + filenameWithPath);
this.logger.debug(params);
if (!provider) {
_context3.next = 6;
break;
}
return _context3.abrupt("return", provider.uploadFile(filenameWithPath, content, params));
case 6:
return _context3.abrupt("return", undefined);
case 7:
case "end":
return _context3.stop();
return _regeneratorRuntime.wrap(function _callee3$(_context3) {
while (1) {
switch (_context3.prev = _context3.next) {
case 0:
if (params === void 0) {
params = {};
}
provider = this.getInvolvedProvider(providerName);
this.logger.debug("[SAVIM] Upload file " + (provider ? "(Provider: " + provider.name + ")" : '(No provider)') + " " + (provider ? "(Provider: " + provider.name + ")" : '(No provider)') + " " + filenameWithPath);
this.logger.debug(params);
if (!provider) {
_context3.next = 6;
break;
}
return _context3.abrupt("return", provider.uploadFile(filenameWithPath, content, params));
case 6:
return _context3.abrupt("return", undefined);
case 7:
case "end":
return _context3.stop();
}
}
}, _callee3, this);
}));
function uploadFile(_x5, _x6, _x7, _x8) {
return _uploadFile.apply(this, arguments);
}
return uploadFile;
}();
_proto.getFile = /*#__PURE__*/function () {
var _getFile = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4(filenameWithPath, params, providerName) {
var _getFile = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee4(filenameWithPath, params, providerName) {
var provider;
return _regeneratorRuntime().wrap(function _callee4$(_context4) {
while (1) switch (_context4.prev = _context4.next) {
case 0:
if (params === void 0) {
params = {};
}
provider = this.getInvolvedProvider(providerName);
this.logger.debug("[SAVIM] Get file " + (provider ? "(Provider: " + provider.name + ")" : '(No provider)') + " " + (provider ? "(Provider: " + provider.name + ")" : '(No provider)') + " " + filenameWithPath);
this.logger.debug(params);
if (!provider) {
_context4.next = 6;
break;
}
return _context4.abrupt("return", provider.getFile(filenameWithPath, params));
case 6:
return _context4.abrupt("return", undefined);
case 7:
case "end":
return _context4.stop();
return _regeneratorRuntime.wrap(function _callee4$(_context4) {
while (1) {
switch (_context4.prev = _context4.next) {
case 0:
if (params === void 0) {
params = {};
}
provider = this.getInvolvedProvider(providerName);
this.logger.debug("[SAVIM] Get file " + (provider ? "(Provider: " + provider.name + ")" : '(No provider)') + " " + (provider ? "(Provider: " + provider.name + ")" : '(No provider)') + " " + filenameWithPath);
this.logger.debug(params);
if (!provider) {
_context4.next = 6;
break;
}
return _context4.abrupt("return", provider.getFile(filenameWithPath, params));
case 6:
return _context4.abrupt("return", undefined);
case 7:
case "end":
return _context4.stop();
}
}
}, _callee4, this);
}));
function getFile(_x9, _x10, _x11) {
return _getFile.apply(this, arguments);
}
return getFile;
}();
_proto.deleteFile = /*#__PURE__*/function () {
var _deleteFile = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee5(filenameWithPath, params, providerName) {
var _deleteFile = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee5(filenameWithPath, params, providerName) {
var provider;
return _regeneratorRuntime().wrap(function _callee5$(_context5) {
while (1) switch (_context5.prev = _context5.next) {
case 0:
if (params === void 0) {
params = {};
}
provider = this.getInvolvedProvider(providerName);
this.logger.debug("[SAVIM] Delete file " + (provider ? "(Provider: " + provider.name + ")" : '(No provider)') + " " + (provider ? "(Provider: " + provider.name + ")" : '(No provider)'));
this.logger.debug(params);
if (!provider) {
_context5.next = 6;
break;
}
return _context5.abrupt("return", provider.deleteFile(filenameWithPath, params));
case 6:
return _context5.abrupt("return", undefined);
case 7:
case "end":
return _context5.stop();
return _regeneratorRuntime.wrap(function _callee5$(_context5) {
while (1) {
switch (_context5.prev = _context5.next) {
case 0:
if (params === void 0) {
params = {};
}
provider = this.getInvolvedProvider(providerName);
this.logger.debug("[SAVIM] Delete file " + (provider ? "(Provider: " + provider.name + ")" : '(No provider)') + " " + (provider ? "(Provider: " + provider.name + ")" : '(No provider)'));
this.logger.debug(params);
if (!provider) {
_context5.next = 6;
break;
}
return _context5.abrupt("return", provider.deleteFile(filenameWithPath, params));
case 6:
return _context5.abrupt("return", undefined);
case 7:
case "end":
return _context5.stop();
}
}
}, _callee5, this);
}));
function deleteFile(_x12, _x13, _x14) {
return _deleteFile.apply(this, arguments);
}
return deleteFile;
}();
_proto.createFolder = /*#__PURE__*/function () {
var _createFolder = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee6(path, params, providerName) {
var _createFolder = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee6(path, params, providerName) {
var provider;
return _regeneratorRuntime().wrap(function _callee6$(_context6) {
while (1) switch (_context6.prev = _context6.next) {
case 0:
if (params === void 0) {
params = {};
}
provider = this.getInvolvedProvider(providerName);
this.logger.debug("[SAVIM] Create folder " + (provider ? "(Provider: " + provider.name + ")" : '(No provider)') + " " + (provider ? "(Provider: " + provider.name + ")" : '(No provider)') + " " + path);
this.logger.debug(params);
if (!provider) {
_context6.next = 6;
break;
}
return _context6.abrupt("return", provider.createFolder(path, params));
case 6:
return _context6.abrupt("return", undefined);
case 7:
case "end":
return _context6.stop();
return _regeneratorRuntime.wrap(function _callee6$(_context6) {
while (1) {
switch (_context6.prev = _context6.next) {
case 0:
if (params === void 0) {
params = {};
}
provider = this.getInvolvedProvider(providerName);
this.logger.debug("[SAVIM] Create folder " + (provider ? "(Provider: " + provider.name + ")" : '(No provider)') + " " + (provider ? "(Provider: " + provider.name + ")" : '(No provider)') + " " + path);
this.logger.debug(params);
if (!provider) {
_context6.next = 6;
break;
}
return _context6.abrupt("return", provider.createFolder(path, params));
case 6:
return _context6.abrupt("return", undefined);
case 7:
case "end":
return _context6.stop();
}
}
}, _callee6, this);
}));
function createFolder(_x15, _x16, _x17) {
return _createFolder.apply(this, arguments);
}
return createFolder;
}();
_proto.deleteFolder = /*#__PURE__*/function () {
var _deleteFolder = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee7(path, params, providerName) {
var _deleteFolder = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee7(path, params, providerName) {
var provider;
return _regeneratorRuntime().wrap(function _callee7$(_context7) {
while (1) switch (_context7.prev = _context7.next) {
case 0:
if (params === void 0) {
params = {};
}
provider = this.getInvolvedProvider(providerName);
this.logger.debug("[SAVIM] Delete folder " + (provider ? "(Provider: " + provider.name + ")" : '(No provider)') + " " + (provider ? "(Provider: " + provider.name + ")" : '(No provider)'));
this.logger.debug(params);
if (!provider) {
_context7.next = 6;
break;
}
return _context7.abrupt("return", provider.deleteFolder(path, params));
case 6:
return _context7.abrupt("return", undefined);
case 7:
case "end":
return _context7.stop();
return _regeneratorRuntime.wrap(function _callee7$(_context7) {
while (1) {
switch (_context7.prev = _context7.next) {
case 0:
if (params === void 0) {
params = {};
}
provider = this.getInvolvedProvider(providerName);
this.logger.debug("[SAVIM] Delete folder " + (provider ? "(Provider: " + provider.name + ")" : '(No provider)') + " " + (provider ? "(Provider: " + provider.name + ")" : '(No provider)'));
this.logger.debug(params);
if (!provider) {
_context7.next = 6;
break;
}
return _context7.abrupt("return", provider.deleteFolder(path, params));
case 6:
return _context7.abrupt("return", undefined);
case 7:
case "end":
return _context7.stop();
}
}
}, _callee7, this);
}));
function deleteFolder(_x18, _x19, _x20) {
return _deleteFolder.apply(this, arguments);
}
return deleteFolder;
}();
_proto.getFolders = /*#__PURE__*/function () {
var _getFolders = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee8(path, params, providerName) {
var _getFolders = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee8(path, params, providerName) {
var provider;
return _regeneratorRuntime().wrap(function _callee8$(_context8) {
while (1) switch (_context8.prev = _context8.next) {
case 0:
if (params === void 0) {
params = {};
}
provider = this.getInvolvedProvider(providerName);
this.logger.debug("[SAVIM] Get folders " + (provider ? "(Provider: " + provider.name + ")" : '(No provider)') + " " + (provider ? "(Provider: " + provider.name + ")" : '(No provider)') + " " + path);
this.logger.debug(params);
if (!provider) {
_context8.next = 6;
break;
}
return _context8.abrupt("return", provider.getFolders(path, params));
case 6:
return _context8.abrupt("return", undefined);
case 7:
case "end":
return _context8.stop();
return _regeneratorRuntime.wrap(function _callee8$(_context8) {
while (1) {
switch (_context8.prev = _context8.next) {
case 0:
if (params === void 0) {
params = {};
}
provider = this.getInvolvedProvider(providerName);
this.logger.debug("[SAVIM] Get folders " + (provider ? "(Provider: " + provider.name + ")" : '(No provider)') + " " + (provider ? "(Provider: " + provider.name + ")" : '(No provider)') + " " + path);
this.logger.debug(params);
if (!provider) {
_context8.next = 6;
break;
}
return _context8.abrupt("return", provider.getFolders(path, params));
case 6:
return _context8.abrupt("return", undefined);
case 7:
case "end":
return _context8.stop();
}
}
}, _callee8, this);
}));
function getFolders(_x21, _x22, _x23) {
return _getFolders.apply(this, arguments);
}
return getFolders;
}();
_proto.getFiles = /*#__PURE__*/function () {
var _getFiles = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee9(path, params, providerName) {
var _getFiles = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee9(path, params, providerName) {
var provider;
return _regeneratorRuntime().wrap(function _callee9$(_context9) {
while (1) switch (_context9.prev = _context9.next) {
case 0:
if (params === void 0) {
params = {};
}
provider = this.getInvolvedProvider(providerName);
this.logger.debug("[SAVIM] Get files " + (provider ? "(Provider: " + provider.name + ")" : '(No provider)') + " " + (provider ? "(Provider: " + provider.name + ")" : '(No provider)') + " " + path);
this.logger.debug(params);
if (!provider) {
_context9.next = 6;
break;
}
return _context9.abrupt("return", provider.getFiles(path, params));
case 6:
return _context9.abrupt("return", undefined);
case 7:
case "end":
return _context9.stop();
return _regeneratorRuntime.wrap(function _callee9$(_context9) {
while (1) {
switch (_context9.prev = _context9.next) {
case 0:
if (params === void 0) {
params = {};
}
provider = this.getInvolvedProvider(providerName);
this.logger.debug("[SAVIM] Get files " + (provider ? "(Provider: " + provider.name + ")" : '(No provider)') + " " + (provider ? "(Provider: " + provider.name + ")" : '(No provider)') + " " + path);
this.logger.debug(params);
if (!provider) {
_context9.next = 6;
break;
}
return _context9.abrupt("return", provider.getFiles(path, params));
case 6:
return _context9.abrupt("return", undefined);
case 7:
case "end":
return _context9.stop();
}
}
}, _callee9, this);
}));
function getFiles(_x24, _x25, _x26) {
return _getFiles.apply(this, arguments);
}
return getFiles;
}();
return Savim;

@@ -622,0 +425,0 @@ }();

{
"version": "1.2.179",
"version": "1.2.180",
"license": "MIT",

@@ -18,6 +18,3 @@ "main": "dist/index.js",

"lint": "eslint src test --fix",
"prepare": "tsdx build",
"size": "size-limit",
"analyze": "size-limit --why",
"np": "np"
"prepare": "tsdx build"
},

@@ -43,12 +40,2 @@ "husky": {

},
"size-limit": [
{
"path": "dist/savim.cjs.production.min.js",
"limit": "10 KB"
},
{
"path": "dist/savim.esm.js",
"limit": "10 KB"
}
],
"jest": {

@@ -67,3 +54,2 @@ "collectCoverage": true,

"@jest/globals": "29.7.0",
"@size-limit/preset-small-lib": "11.1.4",
"@types/jest": "^29.5.0",

@@ -80,5 +66,3 @@ "@typescript-eslint/eslint-plugin": "7.16.0",

"jest-environment-jsdom": "^29.5.0",
"np": "10.0.6",
"prettier": "3.3.3",
"size-limit": "11.1.4",
"ts-jest": "^29.1.0",

@@ -92,3 +76,4 @@ "tsdx": "0.14.1",

"pino": "^9.0.0"
}
},
"packageManager": "pnpm@9.5.0"
}

Sorry, the diff of this file is not supported yet

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