
Security News
Another Round of TEA Protocol Spam Floods npm, But It’s Not a Worm
Recent coverage mislabels the latest TEA protocol spam as a worm. Here’s what’s actually happening.
apim-tools
Advanced tools
APIM 平台客户端工具,提供 mock 中间件 和 mock 管理 web界面
npm i apim-tools --save-dev
express 中间件使用function artProcessor(customOptions) {
return function (mockData, options, context) {
const tplOptions = {
tplDir: customOptions.tplDir || options.tplDir || options.baseDir
};
return new Promise((resolve, reject) => {
if (!isPlainObject(mockData)) {
return resolve({_data: mockData});
}
let tpl = mockData._tpl;
if (tpl) {
let tplFile = pathUtil.join(tplOptions.tplDir, tpl);
let tplData = context.normalizeMockData(mockData);
context.logger.debug('render art template using data', tplData);
let result = art(tplFile, tplData);
return resolve({_data: result});
}
else {
context.logger.error('to render tpl file missing');
return reject('to render tpl file missing');
}
});
};
}
const apimMw = require('apim-tools').express({
// express server 使用的端口号
port: 9090,
// 设置存储的 mock 相关数据存储的根目录
root: __dirname + '/mock',
// 项目 schema token 具体到 apim 平台查看
schemaToken: 'd79e5fa60c5ed6111b6a06a2f4fcbb6b',
// 是否启动时候立刻自动同步
startAutoSync: true,
// 是否开启注入选项,默认会在页面注入 mock 管理的入口
injector: true,
// 自定义 mock,只有不存在接口定义 mock 才走该自定义 mock 规则
// mock 规则定义同 https://github.com/wuhy/autoresponse
mockRules: [
{
match: '/users/:id',
method: ['get', 'patch']
}
],
// 自定义 mock 数据处理器或者选项
processors: {
// 使用 smarty 处理器,接口平台定义的页面模板类型选择 Smarty
smarty: {
baseDir: __dirname + '/mock'
},
// 使用 etpl 处理器,接口平台定义的页面模板类型选择 ETPL
etpl: {
tplDir: __dirname + '/templates',
tplExtName: 'etpl',
encoding: 'utf-8',
engine: {
commandOpen: '{{',
commandClose: '}}',
variableOpen: '{%',
variableClose: '%}'
},
filters: { // 默认提供 json_encode
myFilter: function (source) {
return source;
}
}
},
// 自定义 art-template 处理器,接口平台定义的页面模板类型选择其它,
// 默认的处理器名为模板的文件扩展名
art: artProcessor({
tplDir: __dirname + '/templates'
})
}
});
app.use(apimMw);
const apim = require('apim-tools')({
root: __dirname + '/mock'
});
let promise = apim.testAPI({
path: '/api/getUserInfo?uid=22', // 请求路径
method: 'get', // 请求方法
body: {}, // body 数据,可选
envId: 11, // 可选,默认使用配置的环境
});
let expressMw = apim.express;
// ...
FAQs
APIM Tools
We found that apim-tools 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.

Security News
Recent coverage mislabels the latest TEA protocol spam as a worm. Here’s what’s actually happening.

Security News
PyPI adds Trusted Publishing support for GitLab Self-Managed as adoption reaches 25% of uploads

Research
/Security News
A malicious Chrome extension posing as an Ethereum wallet steals seed phrases by encoding them into Sui transactions, enabling full wallet takeover.