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

skynet-js

Package Overview
Dependencies
Maintainers
2
Versions
68
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

skynet-js - npm Package Compare versions

Comparing version 2.0.1 to 2.0.2

LICENSE

10

CHANGELOG.md
# Changelog
## [2.0.2]
### Added
- MIT license
### Changed
- `regeneratorRuntime` error when packaging with `webpack` has been fixed.
## [2.0.1]

@@ -4,0 +14,0 @@

31

dist/client.js
"use strict";
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
Object.defineProperty(exports, "__esModule", {

@@ -8,2 +10,6 @@ value: true

var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
var _axios = _interopRequireDefault(require("axios"));

@@ -13,10 +19,2 @@

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a 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); } }
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
var SkynetClient = /*#__PURE__*/function () {

@@ -40,5 +38,3 @@ /**

var customOptions = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
_classCallCheck(this, SkynetClient);
(0, _classCallCheck2["default"])(this, SkynetClient);
this.portalUrl = portalUrl;

@@ -53,3 +49,3 @@ this.customOptions = customOptions;

_createClass(SkynetClient, [{
(0, _createClass2["default"])(SkynetClient, [{
key: "executeRequest",

@@ -64,4 +60,8 @@ value: function executeRequest(config) {

url = (0, _utils.addUrlQuery)(url, config.query);
}
} // No other headers.
var headers = config.customUserAgent && {
"User-Agent": config.customUserAgent
};
return (0, _axios["default"])({

@@ -71,5 +71,3 @@ url: url,

data: config.data,
headers: config.customUserAgent && {
"User-Agent": config.customUserAgent
},
headers: headers,
auth: config.APIKey && {

@@ -91,3 +89,2 @@ username: "",

}]);
return SkynetClient;

@@ -94,0 +91,0 @@ }();

"use strict";
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
var _axios = _interopRequireDefault(require("axios"));

@@ -9,14 +17,6 @@

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
function _asyncToGenerator(fn) { return function () { 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(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { (0, _defineProperty2["default"])(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
var defaultDownloadOptions = _objectSpread({}, (0, _utils.defaultOptions)("/"));

@@ -55,3 +55,3 @@

_client.SkynetClient.prototype.downloadFileHns = /*#__PURE__*/function () {
var _ref = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee(domain) {
var _ref = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee(domain) {
var customOptions,

@@ -61,3 +61,3 @@ opts,

_args = arguments;
return regeneratorRuntime.wrap(function _callee$(_context) {
return _regenerator["default"].wrap(function _callee$(_context) {
while (1) {

@@ -123,7 +123,7 @@ switch (_context.prev = _context.next) {

_client.SkynetClient.prototype.getMetadata = /*#__PURE__*/function () {
var _ref2 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee2(skylink) {
var _ref2 = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee2(skylink) {
var customOptions,
opts,
_args2 = arguments;
return regeneratorRuntime.wrap(function _callee2$(_context2) {
return _regenerator["default"].wrap(function _callee2$(_context2) {
while (1) {

@@ -173,3 +173,3 @@ switch (_context2.prev = _context2.next) {

_client.SkynetClient.prototype.openFileHns = /*#__PURE__*/function () {
var _ref3 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee3(domain) {
var _ref3 = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee3(domain) {
var customOptions,

@@ -179,3 +179,3 @@ opts,

_args3 = arguments;
return regeneratorRuntime.wrap(function _callee3$(_context3) {
return _regenerator["default"].wrap(function _callee3$(_context3) {
while (1) {

@@ -210,3 +210,3 @@ switch (_context3.prev = _context3.next) {

_client.SkynetClient.prototype.resolveHns = /*#__PURE__*/function () {
var _ref4 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee4(domain) {
var _ref4 = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee4(domain) {
var customOptions,

@@ -217,3 +217,3 @@ opts,

_args4 = arguments;
return regeneratorRuntime.wrap(function _callee4$(_context4) {
return _regenerator["default"].wrap(function _callee4$(_context4) {
while (1) {

@@ -220,0 +220,0 @@ switch (_context4.prev = _context4.next) {

"use strict";
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
var _client = require("./client.js");

@@ -7,12 +15,6 @@

function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
function _asyncToGenerator(fn) { return function () { 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(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { (0, _defineProperty2["default"])(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
var defaultAddSkykeyOptions = _objectSpread({}, (0, _utils.defaultOptions)("/skynet/addskykey"));

@@ -27,6 +29,6 @@

_client.SkynetClient.prototype.addSkykey = /*#__PURE__*/function () {
var _ref = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee(skykey) {
var _ref = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee(skykey) {
var customOptions,
_args = arguments;
return regeneratorRuntime.wrap(function _callee$(_context) {
return _regenerator["default"].wrap(function _callee$(_context) {
while (1) {

@@ -52,6 +54,6 @@ switch (_context.prev = _context.next) {

_client.SkynetClient.prototype.createSkykey = /*#__PURE__*/function () {
var _ref2 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee2(skykeyName, skykeyType) {
var _ref2 = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee2(skykeyName, skykeyType) {
var customOptions,
_args2 = arguments;
return regeneratorRuntime.wrap(function _callee2$(_context2) {
return _regenerator["default"].wrap(function _callee2$(_context2) {
while (1) {

@@ -77,6 +79,6 @@ switch (_context2.prev = _context2.next) {

_client.SkynetClient.prototype.getSkykeyById = /*#__PURE__*/function () {
var _ref3 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee3(skykeyId) {
var _ref3 = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee3(skykeyId) {
var customOptions,
_args3 = arguments;
return regeneratorRuntime.wrap(function _callee3$(_context3) {
return _regenerator["default"].wrap(function _callee3$(_context3) {
while (1) {

@@ -102,6 +104,6 @@ switch (_context3.prev = _context3.next) {

_client.SkynetClient.prototype.getSkykeyByName = /*#__PURE__*/function () {
var _ref4 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee4(skykeyName) {
var _ref4 = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee4(skykeyName) {
var customOptions,
_args4 = arguments;
return regeneratorRuntime.wrap(function _callee4$(_context4) {
return _regenerator["default"].wrap(function _callee4$(_context4) {
while (1) {

@@ -127,6 +129,6 @@ switch (_context4.prev = _context4.next) {

_client.SkynetClient.prototype.getSkykeys = /*#__PURE__*/function () {
var _getSkykeys = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee5() {
var _getSkykeys = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee5() {
var customOptions,
_args5 = arguments;
return regeneratorRuntime.wrap(function _callee5$(_context5) {
return _regenerator["default"].wrap(function _callee5$(_context5) {
while (1) {

@@ -133,0 +135,0 @@ switch (_context5.prev = _context5.next) {

@@ -69,2 +69,12 @@ "use strict";

var _utils = require("./utils.js");
var _utils = require("./utils.js");
// Get the following files to run or the client's methods won't be defined.
var client = new _client.SkynetClient("https://siasky.net");
var skylink = "CABqlFxQyimh292KJlqp-7HMA_vypPnSCoB-QZjzG5ObHw";
document.getElementById("download").addEventListener("click", function () {
client.downloadFile(skylink);
});
document.getElementById("open").addEventListener("click", function () {
client.openFile(skylink);
});
"use strict";
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
Object.defineProperty(exports, "__esModule", {

@@ -8,12 +10,10 @@ value: true

function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
function _iterableToArrayLimit(arr, i) { if (typeof Symbol === "undefined" || !(Symbol.iterator in Object(arr))) return; var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
function _createForOfIteratorHelper(o, allowArrayLike) { var it; if (typeof Symbol === "undefined" || o[Symbol.iterator] == null) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = o[Symbol.iterator](); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it["return"] != null) it["return"](); } finally { if (didErr) throw err; } } }; }
function _createForOfIteratorHelper(o, allowArrayLike) { var it; if (typeof Symbol === "undefined" || o[Symbol.iterator] == null) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e2) { throw _e2; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = o[Symbol.iterator](); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e3) { didErr = true; err = _e3; }, f: function f() { try { if (!normalCompletion && it["return"] != null) it["return"](); } finally { if (didErr) throw err; } } }; }
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }

@@ -23,6 +23,2 @@

function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
function _asyncToGenerator(fn) { return function () { 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(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
/**

@@ -38,6 +34,6 @@ * Compares the provided FormData with the expected array of entries.

function _compareFormData() {
_compareFormData = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee(formData, entries) {
_compareFormData = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee(formData, entries) {
var i, _iterator, _step, _loop;
return regeneratorRuntime.wrap(function _callee$(_context2) {
return _regenerator["default"].wrap(function _callee$(_context2) {
while (1) {

@@ -49,10 +45,10 @@ switch (_context2.prev = _context2.next) {

_context2.prev = 2;
_loop = /*#__PURE__*/regeneratorRuntime.mark(function _loop() {
_loop = /*#__PURE__*/_regenerator["default"].mark(function _loop() {
var _step$value, fieldName, file, entry, expectedFieldName, expectedData, expectedFilename, reader;
return regeneratorRuntime.wrap(function _loop$(_context) {
return _regenerator["default"].wrap(function _loop$(_context) {
while (1) {
switch (_context.prev = _context.next) {
case 0:
_step$value = _slicedToArray(_step.value, 2), fieldName = _step$value[0], file = _step$value[1];
_step$value = (0, _slicedToArray2["default"])(_step.value, 2), fieldName = _step$value[0], file = _step$value[1];
entry = entries[i];

@@ -59,0 +55,0 @@ expectedFieldName = entry[0];

"use strict";
var _client = require("./client.js");
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
var _utils = require("./utils.js");
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
var _client = require("./client.js");
function _iterableToArrayLimit(arr, i) { if (typeof Symbol === "undefined" || !(Symbol.iterator in Object(arr))) return; var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
var _utils = require("./utils.js");
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
function _asyncToGenerator(fn) { return function () { 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(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { (0, _defineProperty2["default"])(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
var defaultUploadOptions = _objectSpread(_objectSpread({}, (0, _utils.defaultOptions)("/skynet/skyfile")), {}, {

@@ -36,7 +28,7 @@ portalFileFieldname: "file",

_client.SkynetClient.prototype.uploadFile = /*#__PURE__*/function () {
var _ref = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee(file) {
var _ref = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee(file) {
var customOptions,
response,
_args = arguments;
return regeneratorRuntime.wrap(function _callee$(_context) {
return _regenerator["default"].wrap(function _callee$(_context) {
while (1) {

@@ -67,3 +59,3 @@ switch (_context.prev = _context.next) {

_client.SkynetClient.prototype.uploadFileRequest = /*#__PURE__*/function () {
var _ref2 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee2(file) {
var _ref2 = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee2(file) {
var customOptions,

@@ -77,3 +69,3 @@ opts,

return regeneratorRuntime.wrap(function _callee2$(_context2) {
return _regenerator["default"].wrap(function _callee2$(_context2) {
while (1) {

@@ -129,7 +121,7 @@ switch (_context2.prev = _context2.next) {

_client.SkynetClient.prototype.uploadDirectory = /*#__PURE__*/function () {
var _ref3 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee3(directory, filename) {
var _ref3 = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee3(directory, filename) {
var customOptions,
response,
_args3 = arguments;
return regeneratorRuntime.wrap(function _callee3$(_context3) {
return _regenerator["default"].wrap(function _callee3$(_context3) {
while (1) {

@@ -160,3 +152,3 @@ switch (_context3.prev = _context3.next) {

_client.SkynetClient.prototype.uploadDirectoryRequest = /*#__PURE__*/function () {
var _ref4 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee4(directory, filename) {
var _ref4 = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee4(directory, filename) {
var customOptions,

@@ -169,3 +161,3 @@ opts,

return regeneratorRuntime.wrap(function _callee4$(_context4) {
return _regenerator["default"].wrap(function _callee4$(_context4) {
while (1) {

@@ -178,3 +170,3 @@ switch (_context4.prev = _context4.next) {

Object.entries(directory).forEach(function (_ref5) {
var _ref6 = _slicedToArray(_ref5, 2),
var _ref6 = (0, _slicedToArray2["default"])(_ref5, 2),
path = _ref6[0],

@@ -181,0 +173,0 @@ file = _ref6[1];

"use strict";
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
Object.defineProperty(exports, "__esModule", {

@@ -16,2 +18,6 @@ value: true

var _typeof2 = _interopRequireDefault(require("@babel/runtime/helpers/typeof"));
var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
var _pathBrowserify = _interopRequireDefault(require("path-browserify"));

@@ -23,18 +29,3 @@

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && Symbol.iterator in Object(iter)) return Array.from(iter); }
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
// import axios from "axios";
var defaultSkynetPortalUrl = "https://siasky.net";

@@ -84,3 +75,3 @@ exports.defaultSkynetPortalUrl = defaultSkynetPortalUrl;

return _pathBrowserify["default"].join.apply(_pathBrowserify["default"], _toConsumableArray(relative).concat([base]));
return _pathBrowserify["default"].join.apply(_pathBrowserify["default"], (0, _toConsumableArray2["default"])(relative).concat([base]));
}

@@ -120,3 +111,3 @@

function parseSkylink(skylink) {
if (typeof skylink !== "string") throw new Error("Skylink has to be a string, ".concat(_typeof(skylink), " provided")); // check for direct skylink match
if (typeof skylink !== "string") throw new Error("Skylink has to be a string, ".concat((0, _typeof2["default"])(skylink), " provided")); // check for direct skylink match

@@ -123,0 +114,0 @@ var matchDirect = skylink.match(SKYLINK_DIRECT_REGEX);

{
"name": "skynet-js",
"version": "2.0.1",
"version": "2.0.2",
"description": "Sia Skynet Javascript Client",

@@ -43,2 +43,3 @@ "main": "dist/index.js",

"dependencies": {
"@babel/runtime": "^7.11.2",
"axios": "^0.20.0",

@@ -52,2 +53,3 @@ "path-browserify": "^1.0.1",

"@babel/core": "^7.11.6",
"@babel/plugin-transform-runtime": "^7.11.5",
"@babel/preset-env": "^7.11.5",

@@ -54,0 +56,0 @@ "axios-mock-adapter": "^1.18.2",

# skynet-js - Javascript Sia Skynet Client
[![Version](https://img.shields.io/github/package-json/v/NebulousLabs/skynet-js)](https://www.npmjs.com/package/skynet-js)
[![Build Status](https://img.shields.io/github/workflow/status/NebulousLabs/skynet-js/Node.js%20CI)](https://github.com/NebulousLabs/skynet-js/actions)
[![Contributors](https://img.shields.io/github/contributors/NebulousLabs/skynet-js)](https://github.com/NebulousLabs/skynet-js/graphs/contributors)
[![License](https://img.shields.io/github/license/NebulousLabs/skynet-js)](https://github.com/NebulousLabs/skynet-js)
A Javascript module made to simplify communication with Sia Skynet portals from the browser.

@@ -4,0 +9,0 @@

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