Socket
Socket
Sign inDemoInstall

vue-axios-http

Package Overview
Dependencies
24
Maintainers
1
Versions
24
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 3.2.0 to 3.2.1

15

CHANGELOG.md

@@ -5,2 +5,17 @@ # Changelog

### [3.2.1](https://github.com/chantouchsek/vue-axios-http/compare/v3.2.0...v3.2.1) (2023-01-26)
### Bug Fixes
* :bug: change export order ([0863b39](https://github.com/chantouchsek/vue-axios-http/commit/0863b39b40f3d2966b7dfb3389bb844b750e68cd))
* :bug: make form as any type and added new method ([2b7f45f](https://github.com/chantouchsek/vue-axios-http/commit/2b7f45fb6c76dfe5f4b8a7c1e92e5bb42dcd4514))
* :bug: remove type-fest ([5f048e9](https://github.com/chantouchsek/vue-axios-http/commit/5f048e99b7f2f30082676dcaad309a457167beba))
* :bug: removed checking method type ([5f87c91](https://github.com/chantouchsek/vue-axios-http/commit/5f87c917af13da0db04f8608718d5ccfc0803d9e))
* :fire: renamed property ([9dcb639](https://github.com/chantouchsek/vue-axios-http/commit/9dcb6391ec48f52983c777e8984d9d00f171cb69))
* :pencil2: inline and make some code ([6ff84d1](https://github.com/chantouchsek/vue-axios-http/commit/6ff84d1807e2cb65ef01b8cbad8436982ce16b82))
* :pencil2: remove not used function ([64510d0](https://github.com/chantouchsek/vue-axios-http/commit/64510d0b30499ccc26d5d3e06d45850661d1493e))
* **deps:** update lock file ([f4fe511](https://github.com/chantouchsek/vue-axios-http/commit/f4fe511cdc54035c781ebaab259392578df8ea66))
* fire: removed unused method ([f55988a](https://github.com/chantouchsek/vue-axios-http/commit/f55988ab7da61003403c327699f58529ba6c9477))
## [3.2.0](https://github.com/chantouchsek/vue-axios-http/compare/v3.1.3...v3.2.0) (2023-01-25)

@@ -7,0 +22,0 @@

13

dist/core/BaseService.d.ts
/// <reference types="@types/qs" />
import type { AxiosInstance, Method, AxiosRequestConfig } from 'axios';
import type { Errors } from '..';
import qs, { IParseOptions } from 'qs';
import type { ValidatorType } from './Validator';
import type { AxiosInstance, Method, AxiosRequestConfig, AxiosResponse } from 'axios';
import type { IParseOptions } from 'qs';
declare class BaseService {
errors: Errors;
errors: ValidatorType;
parameters: Record<string, any>;

@@ -15,3 +15,3 @@ endpoint: string;

get $errorProperty(): string;
get $parsedQs(): qs.IParseOptions;
get $parsedQs(): IParseOptions;
all<T = any>(): Promise<T>;

@@ -26,3 +26,4 @@ find<T = any>(id: number | string): Promise<T>;

remove<T = any>(id: string | number): Promise<T>;
submit<T = any>(method: Method, parameter?: string | number, form?: T, config?: AxiosRequestConfig): Promise<T>;
submit<T = any>(method: Method, param?: string | number, form?: any, config?: AxiosRequestConfig): Promise<T>;
$submit<T = any>(method: Method, param?: string | number, form?: any, config?: AxiosRequestConfig): Promise<AxiosResponse<T, any>>;
private __getParameterString;

@@ -29,0 +30,0 @@ private static __validateRequestType;

@@ -6,6 +6,6 @@ "use strict";

Object.defineProperty(exports, "__esModule", { value: true });
const lodash_1 = require("lodash");
const qs_1 = __importDefault(require("qs"));
const Validator_1 = __importDefault(require("./Validator"));
const util_1 = require("../util");
const lodash_1 = require("lodash");
const qs_1 = __importDefault(require("qs"));
const validator = Validator_1.default;

@@ -63,3 +63,10 @@ const UNPROCESSABLE_ENTITY = 422;

}
submit(method, parameter, form, config) {
submit(method, param, form, config) {
return new Promise((resolve, reject) => {
this.$submit(method, param, form, config)
.then(({ data }) => resolve(data))
.catch((err) => reject(err));
});
}
$submit(method, param, form, config) {
BaseService.__validateRequestType(method);

@@ -69,3 +76,3 @@ this.beforeSubmit();

const data = (0, util_1.hasFiles)(form) ? (0, util_1.objectToFormData)(form) : form;
const endpoint = parameter ? `/${this.endpoint}/${parameter}` : `/${this.endpoint}`;
const endpoint = param ? `/${this.endpoint}/${param}` : `/${this.endpoint}`;
const url = this.__getParameterString((0, util_1.removeDoubleSlash)(endpoint));

@@ -76,3 +83,3 @@ config = Object.assign({}, config, { url, data, method });

this.onSuccess();
resolve(response.data || {});
resolve(response);
})

@@ -79,0 +86,0 @@ .catch((error) => {

@@ -30,7 +30,10 @@ "use strict";

const fields = this.fields(field);
let fd = '';
for (const f of fields) {
if (!(0, lodash_1.has)(this.errors, f))
continue;
return this.first(f);
if ((0, lodash_1.has)(this.errors, f)) {
fd = f;
break;
}
}
return this.first(fd);
}

@@ -37,0 +40,0 @@ else {

@@ -0,15 +1,12 @@

/// <reference types="@types/qs" />
import type { ValidatorType } from './core/Validator';
import type { IParseOptions } from 'qs';
import type _Vue from 'vue';
import BaseService from './core/BaseService';
import Validator from './core/Validator';
import _Vue from 'vue';
import './vue';
export type Errors = ValidatorType;
export type { ValidatorType };
declare class AxiosHttp {
export declare class AxiosHttp {
installed: boolean;
parsedQs: {
comma: boolean;
allowDots: boolean;
ignoreQueryPrefix: boolean;
};
parsedQs: IParseOptions;
install(Vue: typeof _Vue, options?: Record<string, any>): void;

@@ -16,0 +13,0 @@ }

@@ -20,3 +20,4 @@ "use strict";

Object.defineProperty(exports, "__esModule", { value: true });
exports.BaseService = exports.Validator = void 0;
exports.BaseService = exports.Validator = exports.AxiosHttp = void 0;
const lodash_1 = require("lodash");
const BaseService_1 = __importDefault(require("./core/BaseService"));

@@ -26,3 +27,2 @@ exports.BaseService = BaseService_1.default;

exports.Validator = Validator_1.default;
const lodash_1 = require("lodash");
// augment typings of Vue.js

@@ -43,6 +43,3 @@ require("./vue");

this.installed = true;
const defaultOption = (0, lodash_1.merge)({
parsedQs: this.parsedQs,
errorProperty: 'errors',
}, options);
const defaultOption = (0, lodash_1.merge)({ parsedQs: this.parsedQs, errorProperty: 'errors' }, options);
const { $axios, errorProperty, parsedQs } = defaultOption;

@@ -58,5 +55,4 @@ BaseService_1.default.$http = $axios;

Vue.util.defineReactive(this.$options, '$errors', Validator_1.default);
if (!this.$options.computed) {
if (!this.$options.computed)
this.$options.computed = {};
}
this.$options.computed.$errors = function () {

@@ -71,3 +67,4 @@ // eslint-disable-next-line @typescript-eslint/ban-ts-comment

}
exports.AxiosHttp = AxiosHttp;
__exportStar(require("./util"), exports);
exports.default = new AxiosHttp();
export declare function objectToFormData(object: any, formData?: FormData, parent?: string): FormData;
export declare function hasFilesDeep(object: any): boolean;
export declare function hasFilesDeep(obj: any): boolean;
export declare function hasFiles(form: any): boolean;

@@ -46,23 +46,22 @@ "use strict";

}
function hasFilesDeep(object) {
if (object === null) {
function hasFilesDeep(obj) {
if (obj === null)
return false;
}
if (typeof object === 'object') {
for (const key in object) {
if ((0, objects_1.hasOwnProperty)(object, key)) {
if ((0, objects_1.isFile)(object[key])) {
return true;
}
}
if (typeof obj === 'object') {
for (const key in obj) {
if ((0, objects_1.hasOwnProperty)(obj, key) && (0, objects_1.isFile)(obj[key]))
return true;
}
}
if ((0, objects_1.isArray)(object)) {
for (const key in object) {
if ((0, objects_1.hasOwnProperty)(object, key)) {
return hasFilesDeep(object[key]);
if ((0, objects_1.isArray)(obj)) {
let f = '';
for (const key in obj) {
if ((0, objects_1.hasOwnProperty)(obj, key)) {
f = key;
break;
}
}
return hasFilesDeep(obj[f]);
}
return (0, objects_1.isFile)(object);
return (0, objects_1.isFile)(obj);
}

@@ -69,0 +68,0 @@ exports.hasFilesDeep = hasFilesDeep;

@@ -1,3 +0,3 @@

import _Vue from 'vue';
import type { ValidatorType } from './core/Validator';
import type _Vue from 'vue';
declare module '@nuxt/types' {

@@ -4,0 +4,0 @@ interface Context {

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

import { resolve, join } from 'path'
import { resolve, join } from 'node:path'

@@ -12,3 +12,2 @@ module.exports = function nuxtAxiosHttpModule(moduleOptions = {}) {

})
// this.options.build.transpile.push(/^escape-string-regexp/)
}

@@ -15,0 +14,0 @@

@@ -7,3 +7,3 @@ import Vue from 'vue'

Vue.use(AxiosHttp, { errorProperty: errorProperty, parsedQs })
Vue.use(AxiosHttp, { errorProperty, parsedQs })

@@ -10,0 +10,0 @@ export default function ({ $axios }, inject) {

{
"name": "vue-axios-http",
"version": "3.2.0",
"version": "3.2.1",
"description": "Elegant and simple way to build requests for REST API",

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

"@typescript-eslint/parser": "^5.9.0",
"@vitest/coverage-c8": "^0.28.1",
"@vitest/coverage-c8": "^0.28.2",
"@vue/test-utils": "^1.3.3",

@@ -78,3 +78,3 @@ "axios-mock-adapter": "^1.20.0",

"vite": "^4.0.4",
"vitest": "^0.28.1",
"vitest": "^0.28.2",
"vue": "^2.7.14"

@@ -81,0 +81,0 @@ },

SocketSocket SOC 2 Logo

Product

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc