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

@hzab/data-model

Package Overview
Dependencies
Maintainers
2
Versions
22
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@hzab/data-model - npm Package Compare versions

Comparing version 1.0.0 to 1.0.1

5

CHANGELOG.md

@@ -0,1 +1,6 @@

# @hzab/data-model@1.0.1
- fix: 修复 delete 入参问题
- fix: getApiUrl :xx 参数替换正则处理
# @hzab/data-model@0.2.3

@@ -2,0 +7,0 @@

2

package.json
{
"name": "@hzab/data-model",
"version": "1.0.0",
"version": "1.0.1",
"description": "data model",

@@ -5,0 +5,0 @@ "main": "src",

@@ -82,3 +82,3 @@ import _ from "lodash";

if (!_.isString(value) || !_.isNumber(value) || _.isBoolean(value)) {
apiUrl = apiUrl.replace(`:${key}`, value);
apiUrl = apiUrl.replace(new RegExp(`:${key}$|:${key}(?=\/)`), value);
}

@@ -223,11 +223,23 @@ });

delete(params, ctx) {
let _params = _.cloneDeep(params);
/**
* 删除接口
* @param {*} config axios.delete config 参数,
* @param {*} config.params axios.delete url 参数,
* @param {*} config.data axios.delete data 参数,
* @param {*} ctx
* @returns
*/
delete(config, ctx) {
let _config = _.cloneDeep(config) || {};
if (this.deleteReqMap) {
_params = this.deleteReqMap(_params);
_config = this.deleteReqMap(_config);
}
return new Promise((resolve, reject) => {
const apiUrl = this.getApiUrl(this.deleteApi, _params, ctx);
const apiUrl = this.getApiUrl(
this.deleteApi,
Object.assign(_.cloneDeep(_config), _config.params, _config.data),
ctx,
);
this.axios
.delete(apiUrl, { ...this.axiosConf, params: _params })
.delete(apiUrl, { ...this.axiosConf, ..._config })
.then((response) => {

@@ -249,11 +261,23 @@ this.handleRes(

multipleDelete(params, ctx) {
let _params = _.cloneDeep(params);
/**
* 批量删除接口
* @param {*} config axios.delete config 参数,
* @param {*} config.params axios.delete url 参数,
* @param {*} config.data axios.delete data 参数,
* @param {*} ctx
* @returns
*/
multipleDelete(config, ctx) {
let _config = _.cloneDeep(config) || {};
if (this.multipleDeleteReqMap) {
_params = this.multipleDeleteReqMap(_params);
_config = this.multipleDeleteReqMap(_config);
}
return new Promise((resolve, reject) => {
const apiUrl = this.getApiUrl(this.multipleDeleteApi, _params, ctx);
const apiUrl = this.getApiUrl(
this.multipleDeleteApi,
Object.assign(_.cloneDeep(_config), _config.params, _config.data),
ctx,
);
this.axios
.delete(apiUrl, { ...this.axiosConf, params: _params })
.delete(apiUrl, { ...this.axiosConf, ..._config })
.then((response) => {

@@ -260,0 +284,0 @@ this.handleRes(

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