
Research
Malicious npm Packages Impersonate Flashbots SDKs, Targeting Ethereum Wallet Credentials
Four npm packages disguised as cryptographic tools steal developer credentials and send them to attacker-controlled Telegram infrastructure.
icinfo-api-generator-test
Advanced tools
解析后端的微服务api文档,自动生成所需要的接口函数(TS格式的)
npm i icinfo-api-generator
在需要的项目中创建一个文件,比如 api.js
const axios = require('axios')
const { generate } = require('icinfo-api-generator')
async function main() {
const apis = [
'http://api.fed.icinfo.co/zzk/dtcenter/dt-qualities/develop/api.json',
]
apis.forEach(async url => {
const result = await axios(url)
generate(result.data, {
// mockDir: 'src/mock/data',
tsDir: 'src/services',
merge: true,
request: 'http.request',
prepend: `
import { ExAxiosRequestConfig } from 'icinfo-request'
import http from "@/scripts/http"`,
optionsType: 'ExAxiosRequestConfig',
dataDescription: '要提交给服务器的数据',
optionsDescription: '附加选项',
newLine: '\n',
})
// eslint-disable-next-line no-console
console.log('已成功生成:', url.replace(/\/api\.json$/, ''))
})
}
main()
同时在package.json
配置scripts
"api": "node api.js"
执行方法为
npm run api
名称 | 类型 | 是否必填 | 说明 | 默认值 | 备注 |
---|---|---|---|---|---|
getMockData | function | 否 | 自定义个别字段的模拟数据 | - | - |
mockCount | function | 否 | 自定义个别字段的模拟个数 | - | - |
mockDir | string | 否 | 模拟数据文件夹地址 | - | - |
merge | boolean | 否 | 是否合并已有的模拟数据 | - | - |
mockDepth | number | 否 | 嵌套对象的最多模拟次数 | - | - |
mockPrefix | string | 否 | 模拟数据的前缀 | - | - |
tsDir | string | 否 | 接口文件夹地址 | - | - |
docFile | string | 否 | 生成的文档文件名 | - | - |
prepend | string | 否 | 模块前追加的内容 | - | - |
optionsType | string | 否 | 选项的类型 | - | - |
dataDescription | string | 否 | 数据的描述 | - | - |
optionsDescription | string | 否 | 附加选项的描述 | - | - |
request | string | 否 | 发起请求接口名 | - | - |
newLine | string | 否 | 使用的换行符 | - | - |
apiType | 'jquery'|'axios' | 否 | 参数配置的类型, 默认为jquery.ajax的方案,可选axios方案 | 'jquery' | - |
scriptType | 'ts'|'js' | 否 | 脚本类型,默认生成ts类型,可选js类型 | 'ts' | - |
include | string[] | 否 | 只有名称匹配的api全路径才会被生成 | - | - |
FAQs
解析后端的微服务api文档,自动生成所需要的接口函数(TS格式的)
The npm package icinfo-api-generator-test receives a total of 0 weekly downloads. As such, icinfo-api-generator-test popularity was classified as not popular.
We found that icinfo-api-generator-test demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Four npm packages disguised as cryptographic tools steal developer credentials and send them to attacker-controlled Telegram infrastructure.
Security News
Ruby maintainers from Bundler and rbenv teams are building rv to bring Python uv's speed and unified tooling approach to Ruby development.
Security News
Following last week’s supply chain attack, Nx published findings on the GitHub Actions exploit and moved npm publishing to Trusted Publishers.