Socket
Socket
Sign inDemoInstall

koa-rtapi

Package Overview
Dependencies
119
Maintainers
1
Versions
71
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 1.2.4 to 1.2.5

4

code-pure/index.js

@@ -27,3 +27,3 @@ 'use strict'

// 日志
log: function (k1, k2, k3) {
rlog: function (k1, k2, k3) {
const t = this;

@@ -42,3 +42,3 @@ if (typeof k1 === 'object') {

/** 启动服务 */
kapp.use(rtapi.env(cfg.env, cfg.log)) // 添加配置
kapp.use(rtapi.env(cfg.env, cfg.rlog)) // 添加配置
.use(require('koa-bodyparser')()) // 支持post-body

@@ -45,0 +45,0 @@ .use(rtapi.api(cfg.apis)) // 开启rtapi

@@ -13,3 +13,3 @@ /*<%#

this._client = ctx.env.mysql['db1'];
this._client.ctx = ctx;
this._client._ctx = ctx;
}

@@ -16,0 +16,0 @@

@@ -80,7 +80,7 @@ 'use strict';

}
const tables = await new Access(body).query(sql1);
const tables = await new Access(body).setCtx(t.ctx).query(sql1);
// 获取字段
const sql2 = 'SELECT * FROM information_schema.COLUMNS WHERE TABLE_SCHEMA=database()';
const columns = await new Access(body).query(sql2);
const columns = await new Access(body).setCtx(t.ctx).query(sql2);

@@ -87,0 +87,0 @@ for (let table of tables) {

@@ -34,3 +34,3 @@ 'use strict'

// 日志
log: function (k1, k2, k3) {
rlog: function (k1, k2, k3) {
const t = this;

@@ -49,3 +49,3 @@ if (typeof k1 === 'object') {

/** 启动服务 */
kapp.use(rtapi.env(cfg.env, cfg.log)) // 添加配置
kapp.use(rtapi.env(cfg.env, cfg.rlog)) // 添加配置
.use(require('koa2-cors')()) // 开启跨域

@@ -52,0 +52,0 @@ .use(require('koa-static')(cfg.stc.root, cfg.stc.opts)) // 静态支持

@@ -5,2 +5,3 @@ #!/usr/bin/env node

// 拷贝文件夹
function copyDir(src, dst) {

@@ -28,2 +29,18 @@

// 删除文件夹
function delDir(path) {
let files = [];
if (fs.existsSync(path)) {
files = fs.readdirSync(path);
files.forEach(function (file, index) {
const curPath = path + "/" + file;
const isDir = fs.statSync(curPath).isDirectory();
isDir ? delDir(curPath) : fs.unlinkSync(curPath);
});
fs.rmdirSync(path);
}
};
const [, , ...argv] = process.argv;

@@ -33,3 +50,7 @@ const dir = __dirname + '/code' + (argv[0] || '');

// 删除初始化文件夹
delDir(__dirname + '/code');
delDir(__dirname + '/code-pure');
console.log('code copy success');

@@ -45,2 +45,6 @@ import mysql from 'mysql';

/** 设置上下文 */
setCtx(ctx: any): Access;
/** 设置表名和主键 */

@@ -47,0 +51,0 @@ setEntity(sheetName: string, primaryKey: string): Access;

@@ -9,2 +9,3 @@ const mysql = require('mysql');

t.db_cfg = db_cfg; // 数据库配置
t.ctx = db_cfg._ctx || null; // 上下文

@@ -20,2 +21,7 @@ if (acc_cfg) {

// 设置上下文
setCtx(ctx) {
return (this.ctx = ctx) && this;
}
// #region 构建表名

@@ -52,3 +58,3 @@

// 日志
t.db_cfg.ctx.rlog('sql', sql, paras);
t.ctx && t.ctx.rlog && t.ctx.rlog('sql', sql, paras);

@@ -55,0 +61,0 @@ return new Promise((res, rej) => {

@@ -30,3 +30,6 @@ import Access from './access';

/** 数量和偏移量 */
limit(count: number, offset?: number): Select;
/** 构建为sql语句 */

@@ -33,0 +36,0 @@ toSql(): string;

@@ -36,2 +36,13 @@

/** 数量和偏移量 */
limit(count, offset) {
const t = this;
if (count) {
t._limit = 'limit ' + (offset ? `${offset},${count}` : count);
}
return t;
}
/** 构建为sql语句 */

@@ -67,2 +78,8 @@ toSql() {

// limit
const limit = t._limit;
if (limit) {
sql.push(limit);
}
return sql.join(' ');

@@ -69,0 +86,0 @@ }

{
"name": "koa-rtapi",
"version": "1.2.4",
"version": "1.2.5",
"description": "koa api in rtworld company",

@@ -5,0 +5,0 @@ "main": "index.js",

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