New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@hzab/data-model

Package Overview
Dependencies
Maintainers
0
Versions
24
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.1.1 to 1.2.0

4

CHANGELOG.md

@@ -0,1 +1,5 @@

# @hzab/data-model@1.2.0
- feat: 增删改查 axiosConf 允许独立配置 xxxAxiosConf。如: createAxiosConf
# @hzab/data-model@1.1.1

@@ -2,0 +6,0 @@

2

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

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

@@ -52,2 +52,14 @@ # @hzab/data-model

axiosConf,
// getList 接口 axios 相关配置
getListAxiosConf,
// get 接口 axios 相关配置
getAxiosConf,
// create 接口 axios 相关配置
createAxiosConf,
// update 接口 axios 相关配置
updateAxiosConf,
// delete 接口 axios 相关配置
deleteAxiosConf,
// multipleDelete 接口 axios 相关配置
multipleDeleteAxiosConf,
// 列表接口 get 入参枚举函数

@@ -103,30 +115,36 @@ getListReqMap,

| 参数 | 类型 | 必填 | 默认值 | 说明 |
| -------------------- | -------- | ---- | ------ | ------------------------------------------- |
| query | Object | 否 | - | query 参数对象 |
| createApi | string | 否 | - | post 接口地址 |
| getApi | string | 否 | - | 详情 get 接口地址 |
| getListApi | string | 否 | - | 列表 get 接口地址 |
| updateApi | string | 否 | - | put 接口地址 |
| deleteApi | string | 否 | - | delete 接口地址 |
| multipleDeleteApi | string | 否 | - | 批量删除 delete 接口地址 |
| createMap | Function | 否 | - | createApi 接口提交前的处理函数 |
| getMap | Function | 否 | - | getApi 接口返回结果的处理函数 |
| getListMap | Function | 否 | - | getListApi 接口返回结果的处理函数 |
| getListFunc | Function | 否 | - | 自定义的列表请求函数,优先级高于 getListApi |
| updateMap | Function | 否 | - | updateApi 接口提交前的处理函数 |
| axios | Object | 否 | - | axios 实例对象 |
| axiosConf | Object | 否 | - | axios 相关配置 |
| getListReqMap | Function | 否 | - | 列表接口 get 入参枚举函数 |
| getListResMap | Function | 否 | - | 列表接口 get 出参枚举函数 |
| getReqMap | Function | 否 | - | 详情接口 get 入参枚举函数 |
| getResMap | Function | 否 | - | 详情接口 get 出参枚举函数 |
| createReqMap | Function | 否 | - | 新增接口 get 入参枚举函数 |
| createResMap | Function | 否 | - | 新增接口 get 出参枚举函数 |
| updateReqMap | Function | 否 | - | 编辑接口 get 入参枚举函数 |
| updateResMap | Function | 否 | - | 编辑接口 get 出参枚举函数 |
| deleteReqMap | Function | 否 | - | 删除接口 get 入参枚举函数 |
| deleteResMap | Function | 否 | - | 删除接口 get 出参枚举函数 |
| multipleDeleteReqMap | Function | 否 | - | 批量删除接口 get 入参枚举函数 |
| multipleDeleteResMap | Function | 否 | - | 批量删除接口 get 出参枚举函数 |
| 参数 | 类型 | 必填 | 默认值 | 说明 |
| ----------------------- | -------- | ---- | ------ | ------------------------------------------- |
| query | Object | 否 | - | query 参数对象 |
| createApi | string | 否 | - | post 接口地址 |
| getApi | string | 否 | - | 详情 get 接口地址 |
| getListApi | string | 否 | - | 列表 get 接口地址 |
| updateApi | string | 否 | - | put 接口地址 |
| deleteApi | string | 否 | - | delete 接口地址 |
| multipleDeleteApi | string | 否 | - | 批量删除 delete 接口地址 |
| createMap | Function | 否 | - | createApi 接口提交前的处理函数 |
| getMap | Function | 否 | - | getApi 接口返回结果的处理函数 |
| getListMap | Function | 否 | - | getListApi 接口返回结果的处理函数 |
| getListFunc | Function | 否 | - | 自定义的列表请求函数,优先级高于 getListApi |
| updateMap | Function | 否 | - | updateApi 接口提交前的处理函数 |
| axios | Object | 否 | - | axios 实例对象 |
| axiosConf | Object | 否 | - | axios 相关配置 |
| getListAxiosConf | Object | 否 | - | getList 接口 axios 相关配置 |
| getAxiosConf | Object | 否 | - | get 接口 axios 相关配置 |
| createAxiosConf | Object | 否 | - | create 接口 axios 相关配置 |
| updateAxiosConf | Object | 否 | - | update 接口 axios 相关配置 |
| deleteAxiosConf | Object | 否 | - | delete 接口 axios 相关配置 |
| multipleDeleteAxiosConf | Object | 否 | - | multipleDelete 接口 axios 相关配置 |
| getListReqMap | Function | 否 | - | 列表接口 get 入参枚举函数 |
| getListResMap | Function | 否 | - | 列表接口 get 出参枚举函数 |
| getReqMap | Function | 否 | - | 详情接口 get 入参枚举函数 |
| getResMap | Function | 否 | - | 详情接口 get 出参枚举函数 |
| createReqMap | Function | 否 | - | 新增接口 get 入参枚举函数 |
| createResMap | Function | 否 | - | 新增接口 get 出参枚举函数 |
| updateReqMap | Function | 否 | - | 编辑接口 get 入参枚举函数 |
| updateResMap | Function | 否 | - | 编辑接口 get 出参枚举函数 |
| deleteReqMap | Function | 否 | - | 删除接口 get 入参枚举函数 |
| deleteResMap | Function | 否 | - | 删除接口 get 出参枚举函数 |
| multipleDeleteReqMap | Function | 否 | - | 批量删除接口 get 入参枚举函数 |
| multipleDeleteResMap | Function | 否 | - | 批量删除接口 get 出参枚举函数 |

@@ -133,0 +151,0 @@ ## useDataModel

@@ -72,2 +72,17 @@ import _ from "lodash";

this.multipleDeleteResMap = multipleDeleteResMap;
const {
getListAxiosConf,
getAxiosConf,
createAxiosConf,
updateAxiosConf,
deleteAxiosConf,
multipleDeleteAxiosConf,
} = params || {};
this.getListAxiosConf = getListAxiosConf;
this.getAxiosConf = getAxiosConf;
this.createAxiosConf = createAxiosConf;
this.updateAxiosConf = updateAxiosConf;
this.deleteAxiosConf = deleteAxiosConf;
this.multipleDeleteAxiosConf = multipleDeleteAxiosConf;
}

@@ -92,3 +107,3 @@

get(q = {}, ctx = {}) {
get(q = {}, ctx = {}, axiosConf) {
let query = _.merge({}, this.query, q);

@@ -106,2 +121,4 @@ query = _.pickBy(query, (val) => !_.isNil(val) && val !== "");

...this.axiosConf,
...this.getAxiosConf,
...axiosConf,
params: query,

@@ -128,3 +145,3 @@ })

async getList(q, ctx) {
async getList(q, ctx, axiosConf) {
let query = _.merge({}, this.query, q);

@@ -146,2 +163,4 @@ query = _.pickBy(query, (val) => !_.isNil(val) && val !== "");

...this.axiosConf,
...this.getListAxiosConf,
...axiosConf,
params: query,

@@ -172,5 +191,9 @@ })

create(params, ctx) {
create(params, ctx, axiosConf) {
return new Promise((resolve, reject) => {
const opt = { ...this.axiosConf };
const opt = {
...this.axiosConf,
...this.createAxiosConf,
...axiosConf,
};
let _params = _.cloneDeep(formDataToObj(params));

@@ -203,5 +226,5 @@ if (this.createReqMap) {

update(params, ctx) {
update(params, ctx, axiosConf) {
return new Promise((resolve, reject) => {
const opt = { ...this.axiosConf };
const opt = { ...this.axiosConf, ...this.updateAxiosConf, ...axiosConf };
let _params = _.cloneDeep(formDataToObj(params));

@@ -255,3 +278,3 @@ if (this.updateReqMap) {

this.axios
.delete(apiUrl, { ...this.axiosConf, ..._config })
.delete(apiUrl, { ...this.axiosConf, ...this.deleteAxiosConf, ..._config })
.then((response) => {

@@ -294,3 +317,3 @@ this.handleRes(

this.axios
.delete(apiUrl, { ...this.axiosConf, ..._config })
.delete(apiUrl, { ...this.axiosConf, ...this.multipleDeleteAxiosConf, ..._config })
.then((response) => {

@@ -297,0 +320,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