@gct-paas/cli 0.0.1-dev.9 → 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/actions/gen-api/api-manage.cjs +46 -0
- package/dist/actions/gen-api/api-manage.d.ts +36 -0
- package/dist/actions/gen-api/gen-api.cjs +157 -0
- package/dist/actions/gen-api/gen-api.d.ts +58 -0
- package/dist/actions/gen-api/model-manage.cjs +127 -0
- package/dist/actions/gen-api/model-manage.d.ts +124 -0
- package/dist/actions/index.cjs +12 -0
- package/dist/actions/index.d.ts +1 -0
- package/dist/commands/gen-api/gen-api.cjs +16 -0
- package/dist/commands/gen-api/gen-api.d.ts +44 -0
- package/dist/commands/index.cjs +2 -0
- package/dist/core/handlebars/constant/index.cjs +8 -0
- package/dist/core/handlebars/constant/index.d.ts +2 -0
- package/dist/core/handlebars/handlebars-engine.cjs +134 -0
- package/dist/core/handlebars/handlebars-engine.d.ts +74 -0
- package/dist/core/handlebars/helpers/and/and.cjs +21 -0
- package/dist/core/handlebars/helpers/and/and.d.ts +13 -0
- package/dist/core/handlebars/helpers/camel-case/camel-case.cjs +20 -0
- package/dist/core/handlebars/helpers/camel-case/camel-case.d.ts +13 -0
- package/dist/core/handlebars/helpers/concat/concat.cjs +17 -0
- package/dist/core/handlebars/helpers/concat/concat.d.ts +13 -0
- package/dist/core/handlebars/helpers/eq/eq.cjs +19 -0
- package/dist/core/handlebars/helpers/eq/eq.d.ts +14 -0
- package/dist/core/handlebars/helpers/format-import/format-import.cjs +41 -0
- package/dist/core/handlebars/helpers/format-import/format-import.d.ts +13 -0
- package/dist/core/handlebars/helpers/format-import-item/format-import-item.cjs +40 -0
- package/dist/core/handlebars/helpers/format-import-item/format-import-item.d.ts +13 -0
- package/dist/core/handlebars/helpers/format-js-type/format-js-type.cjs +41 -0
- package/dist/core/handlebars/helpers/format-js-type/format-js-type.d.ts +14 -0
- package/dist/core/handlebars/helpers/gt/gt.cjs +19 -0
- package/dist/core/handlebars/helpers/gt/gt.d.ts +14 -0
- package/dist/core/handlebars/helpers/gte/gte.cjs +19 -0
- package/dist/core/handlebars/helpers/gte/gte.d.ts +14 -0
- package/dist/core/handlebars/helpers/helper-base.cjs +19 -0
- package/dist/core/handlebars/helpers/helper-base.d.ts +22 -0
- package/dist/core/handlebars/helpers/includes/includes.cjs +18 -0
- package/dist/core/handlebars/helpers/includes/includes.d.ts +13 -0
- package/dist/core/handlebars/helpers/index.cjs +52 -0
- package/dist/core/handlebars/helpers/index.d.ts +6 -0
- package/dist/core/handlebars/helpers/json/json.cjs +16 -0
- package/dist/core/handlebars/helpers/json/json.d.ts +13 -0
- package/dist/core/handlebars/helpers/lower-case/lower-case.cjs +19 -0
- package/dist/core/handlebars/helpers/lower-case/lower-case.d.ts +13 -0
- package/dist/core/handlebars/helpers/lt/lt.cjs +19 -0
- package/dist/core/handlebars/helpers/lt/lt.d.ts +14 -0
- package/dist/core/handlebars/helpers/lte/lte.cjs +19 -0
- package/dist/core/handlebars/helpers/lte/lte.d.ts +14 -0
- package/dist/core/handlebars/helpers/neq/neq.cjs +19 -0
- package/dist/core/handlebars/helpers/neq/neq.d.ts +14 -0
- package/dist/core/handlebars/helpers/not/not.cjs +21 -0
- package/dist/core/handlebars/helpers/not/not.d.ts +14 -0
- package/dist/core/handlebars/helpers/not-includes/not-includes.cjs +18 -0
- package/dist/core/handlebars/helpers/not-includes/not-includes.d.ts +13 -0
- package/dist/core/handlebars/helpers/or/or.cjs +23 -0
- package/dist/core/handlebars/helpers/or/or.d.ts +13 -0
- package/dist/core/handlebars/helpers/pascal-case/pascal-case.cjs +20 -0
- package/dist/core/handlebars/helpers/pascal-case/pascal-case.d.ts +13 -0
- package/dist/core/handlebars/helpers/snake-case/snake-case.cjs +20 -0
- package/dist/core/handlebars/helpers/snake-case/snake-case.d.ts +13 -0
- package/dist/core/handlebars/helpers/spinal-case/spinal-case.cjs +20 -0
- package/dist/core/handlebars/helpers/spinal-case/spinal-case.d.ts +13 -0
- package/dist/core/handlebars/helpers/upper-case/upper-case.cjs +19 -0
- package/dist/core/handlebars/helpers/upper-case/upper-case.d.ts +13 -0
- package/dist/core/handlebars/index.cjs +27 -0
- package/dist/core/handlebars/index.d.ts +2 -0
- package/dist/core/handlebars/utils/helper/helper.cjs +41 -0
- package/dist/core/handlebars/utils/helper/helper.d.ts +33 -0
- package/dist/core/handlebars/utils/index.cjs +20 -0
- package/dist/core/handlebars/utils/index.d.ts +17 -0
- package/dist/core/index.cjs +27 -0
- package/dist/core/index.d.ts +2 -0
- package/dist/core/interface/index.cjs +1 -0
- package/dist/core/interface/index.d.ts +1 -0
- package/dist/index.cjs +1 -1
- package/es/actions/gen-api/api-manage.d.ts +36 -0
- package/es/actions/gen-api/api-manage.mjs +38 -0
- package/es/actions/gen-api/gen-api.d.ts +58 -0
- package/es/actions/gen-api/gen-api.mjs +164 -0
- package/es/actions/gen-api/model-manage.d.ts +124 -0
- package/es/actions/gen-api/model-manage.mjs +126 -0
- package/es/actions/index.d.ts +1 -0
- package/es/actions/index.mjs +1 -0
- package/es/commands/gen-api/gen-api.d.ts +44 -0
- package/es/commands/gen-api/gen-api.mjs +15 -0
- package/es/commands/index.mjs +2 -0
- package/es/core/handlebars/constant/index.d.ts +2 -0
- package/es/core/handlebars/constant/index.mjs +2 -0
- package/es/core/handlebars/handlebars-engine.d.ts +74 -0
- package/es/core/handlebars/handlebars-engine.mjs +122 -0
- package/es/core/handlebars/helpers/and/and.d.ts +13 -0
- package/es/core/handlebars/helpers/and/and.mjs +14 -0
- package/es/core/handlebars/helpers/camel-case/camel-case.d.ts +13 -0
- package/es/core/handlebars/helpers/camel-case/camel-case.mjs +13 -0
- package/es/core/handlebars/helpers/concat/concat.d.ts +13 -0
- package/es/core/handlebars/helpers/concat/concat.mjs +10 -0
- package/es/core/handlebars/helpers/eq/eq.d.ts +14 -0
- package/es/core/handlebars/helpers/eq/eq.mjs +12 -0
- package/es/core/handlebars/helpers/format-import/format-import.d.ts +13 -0
- package/es/core/handlebars/helpers/format-import/format-import.mjs +34 -0
- package/es/core/handlebars/helpers/format-import-item/format-import-item.d.ts +13 -0
- package/es/core/handlebars/helpers/format-import-item/format-import-item.mjs +33 -0
- package/es/core/handlebars/helpers/format-js-type/format-js-type.d.ts +14 -0
- package/es/core/handlebars/helpers/format-js-type/format-js-type.mjs +34 -0
- package/es/core/handlebars/helpers/gt/gt.d.ts +14 -0
- package/es/core/handlebars/helpers/gt/gt.mjs +12 -0
- package/es/core/handlebars/helpers/gte/gte.d.ts +14 -0
- package/es/core/handlebars/helpers/gte/gte.mjs +12 -0
- package/es/core/handlebars/helpers/helper-base.d.ts +22 -0
- package/es/core/handlebars/helpers/helper-base.mjs +11 -0
- package/es/core/handlebars/helpers/includes/includes.d.ts +13 -0
- package/es/core/handlebars/helpers/includes/includes.mjs +11 -0
- package/es/core/handlebars/helpers/index.d.ts +6 -0
- package/es/core/handlebars/helpers/index.mjs +46 -0
- package/es/core/handlebars/helpers/json/json.d.ts +13 -0
- package/es/core/handlebars/helpers/json/json.mjs +13 -0
- package/es/core/handlebars/helpers/lower-case/lower-case.d.ts +13 -0
- package/es/core/handlebars/helpers/lower-case/lower-case.mjs +12 -0
- package/es/core/handlebars/helpers/lt/lt.d.ts +14 -0
- package/es/core/handlebars/helpers/lt/lt.mjs +12 -0
- package/es/core/handlebars/helpers/lte/lte.d.ts +14 -0
- package/es/core/handlebars/helpers/lte/lte.mjs +12 -0
- package/es/core/handlebars/helpers/neq/neq.d.ts +14 -0
- package/es/core/handlebars/helpers/neq/neq.mjs +12 -0
- package/es/core/handlebars/helpers/not/not.d.ts +14 -0
- package/es/core/handlebars/helpers/not/not.mjs +12 -0
- package/es/core/handlebars/helpers/not-includes/not-includes.d.ts +13 -0
- package/es/core/handlebars/helpers/not-includes/not-includes.mjs +11 -0
- package/es/core/handlebars/helpers/or/or.d.ts +13 -0
- package/es/core/handlebars/helpers/or/or.mjs +16 -0
- package/es/core/handlebars/helpers/pascal-case/pascal-case.d.ts +13 -0
- package/es/core/handlebars/helpers/pascal-case/pascal-case.mjs +13 -0
- package/es/core/handlebars/helpers/snake-case/snake-case.d.ts +13 -0
- package/es/core/handlebars/helpers/snake-case/snake-case.mjs +13 -0
- package/es/core/handlebars/helpers/spinal-case/spinal-case.d.ts +13 -0
- package/es/core/handlebars/helpers/spinal-case/spinal-case.mjs +13 -0
- package/es/core/handlebars/helpers/upper-case/upper-case.d.ts +13 -0
- package/es/core/handlebars/helpers/upper-case/upper-case.mjs +12 -0
- package/es/core/handlebars/index.d.ts +2 -0
- package/es/core/handlebars/index.mjs +2 -0
- package/es/core/handlebars/utils/helper/helper.d.ts +33 -0
- package/es/core/handlebars/utils/helper/helper.mjs +54 -0
- package/es/core/handlebars/utils/index.d.ts +17 -0
- package/es/core/handlebars/utils/index.mjs +7 -0
- package/es/core/index.d.ts +2 -0
- package/es/core/index.mjs +2 -0
- package/es/core/interface/index.d.ts +1 -0
- package/es/core/interface/index.mjs +0 -0
- package/es/index.mjs +1 -1
- package/package.json +10 -7
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.HandlebarsEngine = void 0;
|
|
7
|
+
var _handlebars = _interopRequireDefault(require("handlebars"));
|
|
8
|
+
var _helpers = require("./helpers/index.cjs");
|
|
9
|
+
var _utils = require("./utils/index.cjs");
|
|
10
|
+
var _constant = require("./constant/index.cjs");
|
|
11
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
12
|
+
class HandlebarsEngine {
|
|
13
|
+
/**
|
|
14
|
+
* 编译参数
|
|
15
|
+
*
|
|
16
|
+
* @protected
|
|
17
|
+
* @type {CompileOptions}
|
|
18
|
+
*/
|
|
19
|
+
compileOpt = {
|
|
20
|
+
compat: true,
|
|
21
|
+
noEscape: true
|
|
22
|
+
};
|
|
23
|
+
/**
|
|
24
|
+
* Handlebars 运行时参数
|
|
25
|
+
*
|
|
26
|
+
* @protected
|
|
27
|
+
* @type {Handlebars.RuntimeOptions}
|
|
28
|
+
*/
|
|
29
|
+
runtimeOpt = {
|
|
30
|
+
allowProtoPropertiesByDefault: true
|
|
31
|
+
};
|
|
32
|
+
/**
|
|
33
|
+
* 忽略编译的上下文标签规则
|
|
34
|
+
*
|
|
35
|
+
* @protected
|
|
36
|
+
*/
|
|
37
|
+
tagReg = /^[a-zA-Z0-9:_-]+$/;
|
|
38
|
+
/**
|
|
39
|
+
* 模板映射内容
|
|
40
|
+
*
|
|
41
|
+
* @type {Map<string, string>} Map<模板路径, 模板内容>
|
|
42
|
+
*/
|
|
43
|
+
temps = /* @__PURE__ */new Map();
|
|
44
|
+
constructor() {
|
|
45
|
+
(0, _helpers.installHelpers)();
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* 注册宏
|
|
49
|
+
*
|
|
50
|
+
* @param {string} key 宏标识
|
|
51
|
+
* @param {string} template 宏模板内容
|
|
52
|
+
*/
|
|
53
|
+
registerMacro(key, template) {
|
|
54
|
+
key = (0, _utils.winToUnixPath)(key);
|
|
55
|
+
if (key.endsWith(_constant.TEMP_EXTENSION)) {
|
|
56
|
+
key = key.replace(_constant.TEMP_EXTENSION, "");
|
|
57
|
+
_handlebars.default.registerPartial(key, template);
|
|
58
|
+
} else {
|
|
59
|
+
_handlebars.default.registerPartial(key, template);
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
/**
|
|
63
|
+
* 注册模板
|
|
64
|
+
*
|
|
65
|
+
* @param {string} key
|
|
66
|
+
* @param {string} template
|
|
67
|
+
*/
|
|
68
|
+
registerTemp(key, template) {
|
|
69
|
+
key = (0, _utils.winToUnixPath)(key);
|
|
70
|
+
if (key.endsWith(_constant.TEMP_EXTENSION)) {
|
|
71
|
+
key = key.replace(_constant.TEMP_EXTENSION, "");
|
|
72
|
+
this.temps.set(key, template);
|
|
73
|
+
} else {
|
|
74
|
+
this.temps.set(key, template);
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
/**
|
|
78
|
+
* 编译模板获取所有使用到的上下文级参数标识
|
|
79
|
+
*
|
|
80
|
+
* @param {string} template
|
|
81
|
+
* @return {*} {string[]}
|
|
82
|
+
*/
|
|
83
|
+
parseContextTags(template) {
|
|
84
|
+
const program = _handlebars.default.parse(template);
|
|
85
|
+
const set = /* @__PURE__ */new Set();
|
|
86
|
+
this.calcTemplateTags(set, program.body);
|
|
87
|
+
return Array.from(set);
|
|
88
|
+
}
|
|
89
|
+
/**
|
|
90
|
+
* 计算编译模板中的参数标签
|
|
91
|
+
*
|
|
92
|
+
* @protected
|
|
93
|
+
* @param {Set<string>} set
|
|
94
|
+
* @param {Record<string, any>[]} tags
|
|
95
|
+
*/
|
|
96
|
+
calcTemplateTags(set, tags) {
|
|
97
|
+
tags.forEach(item => {
|
|
98
|
+
switch (item.type) {
|
|
99
|
+
case "SubExpression":
|
|
100
|
+
if (item.params?.length > 0) {
|
|
101
|
+
this.calcTemplateTags(set, item.params);
|
|
102
|
+
}
|
|
103
|
+
return;
|
|
104
|
+
case "MustacheStatement":
|
|
105
|
+
case "PathExpression":
|
|
106
|
+
{
|
|
107
|
+
const tag = item.path ? item.path.original : item.original;
|
|
108
|
+
if (_utils.HelperUtil.isHelperName(tag)) {
|
|
109
|
+
if (item.params?.length > 0) {
|
|
110
|
+
this.calcTemplateTags(set, item.params);
|
|
111
|
+
}
|
|
112
|
+
return;
|
|
113
|
+
}
|
|
114
|
+
if (this.tagReg.test(tag)) {
|
|
115
|
+
set.add(tag);
|
|
116
|
+
}
|
|
117
|
+
break;
|
|
118
|
+
}
|
|
119
|
+
default:
|
|
120
|
+
}
|
|
121
|
+
});
|
|
122
|
+
}
|
|
123
|
+
/**
|
|
124
|
+
* 直接工具模板和数据编译
|
|
125
|
+
*
|
|
126
|
+
* @param {string} template
|
|
127
|
+
* @param {IObject} data
|
|
128
|
+
* @return {*} {string}
|
|
129
|
+
*/
|
|
130
|
+
render(template, data) {
|
|
131
|
+
return _handlebars.default.compile(template, this.compileOpt)(data, this.runtimeOpt);
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
exports.HandlebarsEngine = HandlebarsEngine;
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import Handlebars from 'handlebars';
|
|
2
|
+
import { IObject } from '../interface';
|
|
3
|
+
/**
|
|
4
|
+
* 生成器
|
|
5
|
+
*
|
|
6
|
+
* @export
|
|
7
|
+
* @class HandlebarsEngine
|
|
8
|
+
*/
|
|
9
|
+
export declare class HandlebarsEngine {
|
|
10
|
+
/**
|
|
11
|
+
* 编译参数
|
|
12
|
+
*
|
|
13
|
+
* @protected
|
|
14
|
+
* @type {CompileOptions}
|
|
15
|
+
*/
|
|
16
|
+
protected compileOpt: CompileOptions;
|
|
17
|
+
/**
|
|
18
|
+
* Handlebars 运行时参数
|
|
19
|
+
*
|
|
20
|
+
* @protected
|
|
21
|
+
* @type {Handlebars.RuntimeOptions}
|
|
22
|
+
*/
|
|
23
|
+
protected runtimeOpt: Handlebars.RuntimeOptions;
|
|
24
|
+
/**
|
|
25
|
+
* 忽略编译的上下文标签规则
|
|
26
|
+
*
|
|
27
|
+
* @protected
|
|
28
|
+
*/
|
|
29
|
+
protected tagReg: RegExp;
|
|
30
|
+
/**
|
|
31
|
+
* 模板映射内容
|
|
32
|
+
*
|
|
33
|
+
* @type {Map<string, string>} Map<模板路径, 模板内容>
|
|
34
|
+
*/
|
|
35
|
+
readonly temps: Map<string, string>;
|
|
36
|
+
constructor();
|
|
37
|
+
/**
|
|
38
|
+
* 注册宏
|
|
39
|
+
*
|
|
40
|
+
* @param {string} key 宏标识
|
|
41
|
+
* @param {string} template 宏模板内容
|
|
42
|
+
*/
|
|
43
|
+
registerMacro(key: string, template: string): void;
|
|
44
|
+
/**
|
|
45
|
+
* 注册模板
|
|
46
|
+
*
|
|
47
|
+
* @param {string} key
|
|
48
|
+
* @param {string} template
|
|
49
|
+
*/
|
|
50
|
+
registerTemp(key: string, template: string): void;
|
|
51
|
+
/**
|
|
52
|
+
* 编译模板获取所有使用到的上下文级参数标识
|
|
53
|
+
*
|
|
54
|
+
* @param {string} template
|
|
55
|
+
* @return {*} {string[]}
|
|
56
|
+
*/
|
|
57
|
+
parseContextTags(template: string): string[];
|
|
58
|
+
/**
|
|
59
|
+
* 计算编译模板中的参数标签
|
|
60
|
+
*
|
|
61
|
+
* @protected
|
|
62
|
+
* @param {Set<string>} set
|
|
63
|
+
* @param {Record<string, any>[]} tags
|
|
64
|
+
*/
|
|
65
|
+
protected calcTemplateTags(set: Set<string>, tags: Record<string, any>[]): void;
|
|
66
|
+
/**
|
|
67
|
+
* 直接工具模板和数据编译
|
|
68
|
+
*
|
|
69
|
+
* @param {string} template
|
|
70
|
+
* @param {IObject} data
|
|
71
|
+
* @return {*} {string}
|
|
72
|
+
*/
|
|
73
|
+
render(template: string, data: IObject): string;
|
|
74
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.HelperAnd = void 0;
|
|
7
|
+
var _utils = require("../../utils/index.cjs");
|
|
8
|
+
var _helperBase = require("../helper-base.cjs");
|
|
9
|
+
class HelperAnd extends _helperBase.HelperBase {
|
|
10
|
+
constructor() {
|
|
11
|
+
super("and");
|
|
12
|
+
}
|
|
13
|
+
onExecute(...args) {
|
|
14
|
+
const options = args[args.length - 1];
|
|
15
|
+
args.pop();
|
|
16
|
+
const arr = args.filter(item => !!item);
|
|
17
|
+
const bol = arr.length === args.length;
|
|
18
|
+
return _utils.HelperUtil.handleJudgmentExecute(this, bol, options);
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
exports.HelperAnd = HelperAnd;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { HelperBase } from '../helper-base';
|
|
2
|
+
/**
|
|
3
|
+
* 并且条件模式
|
|
4
|
+
*
|
|
5
|
+
* @description 判断: word wor2 word3 必须在判断中必须全部为 true, 用法: {{#and word word2 word3}}xxx{{else}}yyy{{/and}}、{{and word word2 word3}} 返回值为 boolean 类型
|
|
6
|
+
* @export
|
|
7
|
+
* @class HelperAnd
|
|
8
|
+
* @extends {HelperBase}
|
|
9
|
+
*/
|
|
10
|
+
export declare class HelperAnd extends HelperBase {
|
|
11
|
+
constructor();
|
|
12
|
+
onExecute(...args: unknown[] | Handlebars.HelperOptions[]): string | boolean;
|
|
13
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.HelperCamelCase = void 0;
|
|
7
|
+
var _lodashEs = require("lodash-es");
|
|
8
|
+
var _helperBase = require("../helper-base.cjs");
|
|
9
|
+
class HelperCamelCase extends _helperBase.HelperBase {
|
|
10
|
+
constructor() {
|
|
11
|
+
super("camelCase");
|
|
12
|
+
}
|
|
13
|
+
onExecute(param) {
|
|
14
|
+
if (!param) {
|
|
15
|
+
return "";
|
|
16
|
+
}
|
|
17
|
+
return (0, _lodashEs.camelCase)(param);
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
exports.HelperCamelCase = HelperCamelCase;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { HelperBase } from '../helper-base';
|
|
2
|
+
/**
|
|
3
|
+
* 转驼峰
|
|
4
|
+
*
|
|
5
|
+
* @description 用法 {{camelCase xxx}},效果: this-is-my-name => thisIsMyName
|
|
6
|
+
* @export
|
|
7
|
+
* @class HelperCamelCase
|
|
8
|
+
* @extends {HelperBase}
|
|
9
|
+
*/
|
|
10
|
+
export declare class HelperCamelCase extends HelperBase {
|
|
11
|
+
constructor();
|
|
12
|
+
onExecute(param: string): string;
|
|
13
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.HelperConcat = void 0;
|
|
7
|
+
var _helperBase = require("../helper-base.cjs");
|
|
8
|
+
class HelperConcat extends _helperBase.HelperBase {
|
|
9
|
+
constructor() {
|
|
10
|
+
super("concat");
|
|
11
|
+
}
|
|
12
|
+
onExecute(...args) {
|
|
13
|
+
args.pop();
|
|
14
|
+
return args.join("");
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
exports.HelperConcat = HelperConcat;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { HelperBase } from '../helper-base';
|
|
2
|
+
/**
|
|
3
|
+
* 字符串拼接
|
|
4
|
+
*
|
|
5
|
+
* @description 用法:{{concat string1 string2 string3}} 返回值为 string 类型
|
|
6
|
+
* @export
|
|
7
|
+
* @class HelperConcat
|
|
8
|
+
* @extends {HelperBase}
|
|
9
|
+
*/
|
|
10
|
+
export declare class HelperConcat extends HelperBase {
|
|
11
|
+
constructor();
|
|
12
|
+
onExecute(...args: string[]): string;
|
|
13
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.HelperEq = void 0;
|
|
7
|
+
var _lodashEs = require("lodash-es");
|
|
8
|
+
var _utils = require("../../utils/index.cjs");
|
|
9
|
+
var _helperBase = require("../helper-base.cjs");
|
|
10
|
+
class HelperEq extends _helperBase.HelperBase {
|
|
11
|
+
constructor() {
|
|
12
|
+
super("eq");
|
|
13
|
+
}
|
|
14
|
+
onExecute(param, param2, options) {
|
|
15
|
+
const bol = (0, _lodashEs.eq)(param, param2);
|
|
16
|
+
return _utils.HelperUtil.handleJudgmentExecute(this, bol, options);
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
exports.HelperEq = HelperEq;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import * as Handlebars from 'handlebars';
|
|
2
|
+
import { HelperBase } from '../helper-base';
|
|
3
|
+
/**
|
|
4
|
+
* 等于
|
|
5
|
+
*
|
|
6
|
+
* @description 判断: word === word2, 用法: {{#eq word word2}}xxx{{else}}yyy{{/eq}}、{{eq word 'xxx'}} 返回值为 boolean 类型
|
|
7
|
+
* @export
|
|
8
|
+
* @class HelperEq
|
|
9
|
+
* @extends {HelperBase}
|
|
10
|
+
*/
|
|
11
|
+
export declare class HelperEq extends HelperBase {
|
|
12
|
+
constructor();
|
|
13
|
+
onExecute(param: unknown, param2: unknown, options: Handlebars.HelperOptions): string | boolean;
|
|
14
|
+
}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.HelperFormatImport = void 0;
|
|
7
|
+
var _helperBase = require("../helper-base.cjs");
|
|
8
|
+
class HelperFormatImport extends _helperBase.HelperBase {
|
|
9
|
+
constructor() {
|
|
10
|
+
super("formatImport");
|
|
11
|
+
}
|
|
12
|
+
onExecute(param) {
|
|
13
|
+
if (!param || param.length === 0) {
|
|
14
|
+
return "";
|
|
15
|
+
}
|
|
16
|
+
const items = param.map(item => {
|
|
17
|
+
if (item.indexOf("\xAB") > -1) {
|
|
18
|
+
const arr = item.split("\xAB");
|
|
19
|
+
return arr[arr.length - 1].split("\xBB")[0];
|
|
20
|
+
}
|
|
21
|
+
return item;
|
|
22
|
+
}).filter(item => {
|
|
23
|
+
const keys = item.split(",");
|
|
24
|
+
const tag = keys[0];
|
|
25
|
+
switch (tag) {
|
|
26
|
+
case "string":
|
|
27
|
+
case "object":
|
|
28
|
+
case "void":
|
|
29
|
+
case "integer":
|
|
30
|
+
case "int":
|
|
31
|
+
case "long":
|
|
32
|
+
case "Map":
|
|
33
|
+
return false;
|
|
34
|
+
default:
|
|
35
|
+
return true;
|
|
36
|
+
}
|
|
37
|
+
});
|
|
38
|
+
return Array.from(new Set(items)).join(",");
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
exports.HelperFormatImport = HelperFormatImport;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { HelperBase } from '../helper-base';
|
|
2
|
+
/**
|
|
3
|
+
* 格式化导入
|
|
4
|
+
*
|
|
5
|
+
* @description 专门格式化导入的 response 对象,效果: ResponseEntity«List«TraceSettingResponse»» => TraceSettingResponse
|
|
6
|
+
* @export
|
|
7
|
+
* @class HelperFormatImport
|
|
8
|
+
* @extends {HelperBase}
|
|
9
|
+
*/
|
|
10
|
+
export declare class HelperFormatImport extends HelperBase {
|
|
11
|
+
constructor();
|
|
12
|
+
onExecute(param: string[]): string;
|
|
13
|
+
}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.HelperFormatImportItem = void 0;
|
|
7
|
+
var _helperBase = require("../helper-base.cjs");
|
|
8
|
+
class HelperFormatImportItem extends _helperBase.HelperBase {
|
|
9
|
+
constructor() {
|
|
10
|
+
super("formatImportItem");
|
|
11
|
+
}
|
|
12
|
+
onExecute(param) {
|
|
13
|
+
if (!param) {
|
|
14
|
+
return "";
|
|
15
|
+
}
|
|
16
|
+
if (param.indexOf("\xAB") > -1) {
|
|
17
|
+
const arr = param.split("\xAB");
|
|
18
|
+
const text = arr[arr.length - 1].split("\xBB")[0];
|
|
19
|
+
let keys = text.split(",");
|
|
20
|
+
if (keys.length > 1) {
|
|
21
|
+
return "IObject";
|
|
22
|
+
}
|
|
23
|
+
keys = keys.map(key => {
|
|
24
|
+
if (key === "Void") {
|
|
25
|
+
return "void";
|
|
26
|
+
}
|
|
27
|
+
if (key === "int" || key === "long") {
|
|
28
|
+
return "number";
|
|
29
|
+
}
|
|
30
|
+
if (key === "Map") {
|
|
31
|
+
return "IObject";
|
|
32
|
+
}
|
|
33
|
+
return key;
|
|
34
|
+
});
|
|
35
|
+
return keys.join(",");
|
|
36
|
+
}
|
|
37
|
+
return param;
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
exports.HelperFormatImportItem = HelperFormatImportItem;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { HelperBase } from '../helper-base';
|
|
2
|
+
/**
|
|
3
|
+
* 格式化导入
|
|
4
|
+
*
|
|
5
|
+
* @description 专门格式化导入的 response 对象,效果: ResponseEntity«List«TraceSettingResponse»» => TraceSettingResponse
|
|
6
|
+
* @export
|
|
7
|
+
* @class HelperFormatImportItem
|
|
8
|
+
* @extends {HelperBase}
|
|
9
|
+
*/
|
|
10
|
+
export declare class HelperFormatImportItem extends HelperBase {
|
|
11
|
+
constructor();
|
|
12
|
+
onExecute(param: string): string;
|
|
13
|
+
}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.HelperFormatJsType = void 0;
|
|
7
|
+
var _helperBase = require("../helper-base.cjs");
|
|
8
|
+
class HelperFormatJsType extends _helperBase.HelperBase {
|
|
9
|
+
constructor() {
|
|
10
|
+
super("formatJsType");
|
|
11
|
+
}
|
|
12
|
+
onExecute(param, cfg) {
|
|
13
|
+
if (!param) {
|
|
14
|
+
return "unknown";
|
|
15
|
+
}
|
|
16
|
+
if (param === "array") {
|
|
17
|
+
if (cfg) {
|
|
18
|
+
let type = cfg.type || cfg.originalRef;
|
|
19
|
+
if (type) {
|
|
20
|
+
if (type === "integer") {
|
|
21
|
+
type = "number";
|
|
22
|
+
} else if (type.startsWith("Triple\xAB")) {
|
|
23
|
+
type = "unknown";
|
|
24
|
+
}
|
|
25
|
+
} else {
|
|
26
|
+
type = "unknown";
|
|
27
|
+
}
|
|
28
|
+
return type + "[]";
|
|
29
|
+
}
|
|
30
|
+
return "unknown[]";
|
|
31
|
+
}
|
|
32
|
+
if (param === "integer") {
|
|
33
|
+
return "number";
|
|
34
|
+
}
|
|
35
|
+
if (param === "object") {
|
|
36
|
+
return "Record<string, unknown>";
|
|
37
|
+
}
|
|
38
|
+
return param;
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
exports.HelperFormatJsType = HelperFormatJsType;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { IObject } from '../../../interface';
|
|
2
|
+
import { HelperBase } from '../helper-base';
|
|
3
|
+
/**
|
|
4
|
+
* 格式化导入
|
|
5
|
+
*
|
|
6
|
+
* @description 针对后台的 swagger 生成的 js 类型,进行对 js 的类型转换
|
|
7
|
+
* @export
|
|
8
|
+
* @class HelperFormatJsType
|
|
9
|
+
* @extends {HelperBase}
|
|
10
|
+
*/
|
|
11
|
+
export declare class HelperFormatJsType extends HelperBase {
|
|
12
|
+
constructor();
|
|
13
|
+
onExecute(param: string, cfg?: IObject): string;
|
|
14
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.HelperGt = void 0;
|
|
7
|
+
var _lodashEs = require("lodash-es");
|
|
8
|
+
var _utils = require("../../utils/index.cjs");
|
|
9
|
+
var _helperBase = require("../helper-base.cjs");
|
|
10
|
+
class HelperGt extends _helperBase.HelperBase {
|
|
11
|
+
constructor() {
|
|
12
|
+
super("gt");
|
|
13
|
+
}
|
|
14
|
+
onExecute(param, param2, options) {
|
|
15
|
+
const bol = (0, _lodashEs.gt)(param, param2);
|
|
16
|
+
return _utils.HelperUtil.handleJudgmentExecute(this, bol, options);
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
exports.HelperGt = HelperGt;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import * as Handlebars from 'handlebars';
|
|
2
|
+
import { HelperBase } from '../helper-base';
|
|
3
|
+
/**
|
|
4
|
+
* 大于
|
|
5
|
+
*
|
|
6
|
+
* @description 判断: word > word2, 用法: {{#gt word word2}}xxx{{else}}yyy{{/gt}}、{{gt word word2}} 返回值为 boolean 类型
|
|
7
|
+
* @export
|
|
8
|
+
* @class HelperGt
|
|
9
|
+
* @extends {HelperBase}
|
|
10
|
+
*/
|
|
11
|
+
export declare class HelperGt extends HelperBase {
|
|
12
|
+
constructor();
|
|
13
|
+
onExecute(param: unknown, param2: unknown, options: Handlebars.HelperOptions): string | boolean;
|
|
14
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.HelperGte = void 0;
|
|
7
|
+
var _lodashEs = require("lodash-es");
|
|
8
|
+
var _utils = require("../../utils/index.cjs");
|
|
9
|
+
var _helperBase = require("../helper-base.cjs");
|
|
10
|
+
class HelperGte extends _helperBase.HelperBase {
|
|
11
|
+
constructor() {
|
|
12
|
+
super("gte");
|
|
13
|
+
}
|
|
14
|
+
onExecute(param, param2, options) {
|
|
15
|
+
const bol = (0, _lodashEs.gte)(param, param2);
|
|
16
|
+
return _utils.HelperUtil.handleJudgmentExecute(this, bol, options);
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
exports.HelperGte = HelperGte;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import * as Handlebars from 'handlebars';
|
|
2
|
+
import { HelperBase } from '../helper-base';
|
|
3
|
+
/**
|
|
4
|
+
* 大于等于
|
|
5
|
+
*
|
|
6
|
+
* @description 判断: word >= word2, 用法 {{#gte word word2}}xxx{{else}}yyy{{/gte}}、{{gte word word2}} 返回值为 boolean 类型
|
|
7
|
+
* @export
|
|
8
|
+
* @class HelperGte
|
|
9
|
+
* @extends {HelperBase}
|
|
10
|
+
*/
|
|
11
|
+
export declare class HelperGte extends HelperBase {
|
|
12
|
+
constructor();
|
|
13
|
+
onExecute(param: unknown, param2: unknown, options: Handlebars.HelperOptions): string | boolean;
|
|
14
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.HelperBase = void 0;
|
|
7
|
+
var _handlebars = _interopRequireDefault(require("handlebars"));
|
|
8
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
9
|
+
class HelperBase {
|
|
10
|
+
/**
|
|
11
|
+
* Creates an instance of HelperBase.
|
|
12
|
+
*
|
|
13
|
+
* @param {string} tag 助手标识
|
|
14
|
+
*/
|
|
15
|
+
constructor(tag) {
|
|
16
|
+
_handlebars.default.registerHelper(tag, this.onExecute);
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
exports.HelperBase = HelperBase;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* helper 基类
|
|
3
|
+
*
|
|
4
|
+
* @export
|
|
5
|
+
* @class HelperBase
|
|
6
|
+
*/
|
|
7
|
+
export declare abstract class HelperBase {
|
|
8
|
+
/**
|
|
9
|
+
* Creates an instance of HelperBase.
|
|
10
|
+
*
|
|
11
|
+
* @param {string} tag 助手标识
|
|
12
|
+
*/
|
|
13
|
+
constructor(tag: string);
|
|
14
|
+
/**
|
|
15
|
+
* 助手执行
|
|
16
|
+
*
|
|
17
|
+
* @abstract
|
|
18
|
+
* @param {...unknown[]} args
|
|
19
|
+
* @return {*} {(string | boolean)}
|
|
20
|
+
*/
|
|
21
|
+
abstract onExecute(...args: unknown[]): string | boolean;
|
|
22
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.HelperIncludes = void 0;
|
|
7
|
+
var _utils = require("../../utils/index.cjs");
|
|
8
|
+
var _helperBase = require("../helper-base.cjs");
|
|
9
|
+
class HelperIncludes extends _helperBase.HelperBase {
|
|
10
|
+
constructor() {
|
|
11
|
+
super("includes");
|
|
12
|
+
}
|
|
13
|
+
onExecute(param, param2, options) {
|
|
14
|
+
const bol = param.includes(param2);
|
|
15
|
+
return _utils.HelperUtil.handleJudgmentExecute(this, bol, options);
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
exports.HelperIncludes = HelperIncludes;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { HelperBase } from '../helper-base';
|
|
2
|
+
/**
|
|
3
|
+
* 字符串包含内容
|
|
4
|
+
*
|
|
5
|
+
* @description 判断: 'test'.includes('t'), 用法: {{#includes word word2}}xxx{{else}}yyy{{/includes}}、{{includes word word2}} 返回值为 boolean 类型
|
|
6
|
+
* @export
|
|
7
|
+
* @class HelperIncludes
|
|
8
|
+
* @extends {HelperBase}
|
|
9
|
+
*/
|
|
10
|
+
export declare class HelperIncludes extends HelperBase {
|
|
11
|
+
constructor();
|
|
12
|
+
onExecute(param: string, param2: string, options: Handlebars.HelperOptions): string | boolean;
|
|
13
|
+
}
|