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

axios-apicloud-adapter

Package Overview
Dependencies
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

axios-apicloud-adapter - npm Package Compare versions

Comparing version 0.1.3 to 0.1.4

41

dist/index.js

@@ -24,10 +24,2 @@ "use strict";

function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
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."); }
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; }
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
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; }

@@ -41,2 +33,6 @@

function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
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."); }
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); }

@@ -46,2 +42,6 @@

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; }
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); } }

@@ -80,4 +80,5 @@

var file2path = /*#__PURE__*/function () {
var _ref2 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee(file) {
var name, base64, path;
var _ref3 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee(_ref2) {
var _ref4, key, file, base64, path;
return regeneratorRuntime.wrap(function _callee$(_context) {

@@ -87,3 +88,3 @@ while (1) {

case 0:
name = file.name;
_ref4 = _slicedToArray(_ref2, 2), key = _ref4[0], file = _ref4[1];
_context.next = 3;

@@ -96,3 +97,3 @@ return file2Base64(file);

return writeFile({
path: "cache://".concat(name),
path: "cache://".concat(file.name),
data: base64

@@ -104,3 +105,3 @@ });

return _context.abrupt("return", {
name: name,
key: key,
path: path

@@ -118,3 +119,3 @@ });

return function file2path(_x) {
return _ref2.apply(this, arguments);
return _ref3.apply(this, arguments);
};

@@ -124,3 +125,3 @@ }();

var transformConfig = /*#__PURE__*/function () {
var _ref3 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee2(config) {
var _ref5 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee2(config) {
var fullPath, url, params, fileQueue, _iterator, _step, data, _data, key, value, files;

@@ -167,3 +168,3 @@

if (_utils["default"].isFile(value)) {
fileQueue.push(file2path(value));
fileQueue.push(file2path(data));
} else {

@@ -185,3 +186,3 @@ params.data.values[key] = value;

params.data.files = files.reduce(function (result, current) {
return _objectSpread(_objectSpread({}, result), {}, _defineProperty({}, current.name, current.path));
return _objectSpread(_objectSpread({}, result), {}, _defineProperty({}, current.key, current.path));
}, {});

@@ -207,3 +208,3 @@ delete params.headers['Content-Type'];

return function transformConfig(_x2) {
return _ref3.apply(this, arguments);
return _ref5.apply(this, arguments);
};

@@ -252,3 +253,3 @@ }();

var _default = /*#__PURE__*/function () {
var _ref4 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee3(config) {
var _ref6 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee3(config) {
var ajaxParams;

@@ -305,3 +306,3 @@ return regeneratorRuntime.wrap(function _callee3$(_context3) {

return function (_x3) {
return _ref4.apply(this, arguments);
return _ref6.apply(this, arguments);
};

@@ -308,0 +309,0 @@ }();

{
"name": "axios-apicloud-adapter",
"version": "0.1.3",
"version": "0.1.4",
"description": "axios 的 apicloud 适配器,以便于在 app 中使用原生网络请求库",

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

# axios-apicloud-adapter
> axios 的 apicloud 适配器,以便于在 app 中使用原生网络请求库
[![npm package](https://img.shields.io/npm/v/axios-apicloud-adapter.svg)](https://npmjs.org/package/axios-apicloud-adapter)
[![npm downloads](http://img.shields.io/npm/dm/axios-apicloud-adapter.svg)](https://npmjs.org/package/axios-apicloud-adapter)
## 安装

@@ -9,2 +15,3 @@

## 使用

@@ -20,2 +27,3 @@

## 特性

@@ -26,4 +34,11 @@

## 参考
* [axios-miniprogram-adapter](https://github.com/bigmeow/axios-miniprogram-adapter)
## 相关
* [vue-apicloud-quickstart](https://github.com/w-xuefeng/vue-apicloud-quickstart)
* [@w-xuefeng/vue-cli-plugin-apicloud](https://github.com/w-xuefeng/vue-cli-plugin-apicloud)

@@ -31,7 +31,6 @@ import axios from 'axios'

const file2path = async (file) => {
const { name } = file
const file2path = async ([key, file]) => {
const base64 = await file2Base64(file)
const path = await writeFile({ path: `cache://${name}`, data: base64 })
return { name, path }
const path = await writeFile({ path: `cache://${file.name}`, data: base64 })
return { key, path }
}

@@ -68,3 +67,3 @@

if (utils.isFile(value)) {
fileQueue.push(file2path(value))
fileQueue.push(file2path(data))
} else {

@@ -78,3 +77,3 @@ params.data.values[key] = value

params.data.files = files.reduce((result, current) => {
return { ...result, [current.name]: current.path }
return { ...result, [current.key]: current.path }
}, {})

@@ -81,0 +80,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