@domain.js/main 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.
Files changed (76) hide show
  1. package/.eslintrc.js +67 -0
  2. package/.husky/pre-commit +7 -0
  3. package/.test/test.ts +13 -0
  4. package/.test/test2.js +45 -0
  5. package/.travis.yml +8 -0
  6. package/.vscode/settings.json +3 -0
  7. package/README.md +6 -0
  8. package/dist/cli/index.d.ts +2 -0
  9. package/dist/cli/index.js +221 -0
  10. package/dist/deps/aes/index.d.ts +4 -0
  11. package/dist/deps/aes/index.js +16 -0
  12. package/dist/deps/axios/index.d.ts +22 -0
  13. package/dist/deps/axios/index.js +56 -0
  14. package/dist/deps/cache/After.d.ts +3 -0
  15. package/dist/deps/cache/After.js +28 -0
  16. package/dist/deps/cache/Before.d.ts +4 -0
  17. package/dist/deps/cache/Before.js +16 -0
  18. package/dist/deps/cache/Define.d.ts +28 -0
  19. package/dist/deps/cache/Define.js +2 -0
  20. package/dist/deps/cache/index.d.ts +5 -0
  21. package/dist/deps/cache/index.js +50 -0
  22. package/dist/deps/checker/index.d.ts +11 -0
  23. package/dist/deps/checker/index.js +25 -0
  24. package/dist/deps/cia/errors.d.ts +6 -0
  25. package/dist/deps/cia/errors.js +36 -0
  26. package/dist/deps/cia/index.d.ts +53 -0
  27. package/dist/deps/cia/index.js +291 -0
  28. package/dist/deps/counter/index.d.ts +16 -0
  29. package/dist/deps/counter/index.js +16 -0
  30. package/dist/deps/cron/index.d.ts +33 -0
  31. package/dist/deps/cron/index.js +98 -0
  32. package/dist/deps/defines.d.ts +35 -0
  33. package/dist/deps/defines.js +36 -0
  34. package/dist/deps/graceful/index.d.ts +14 -0
  35. package/dist/deps/graceful/index.js +115 -0
  36. package/dist/deps/hash/index.d.ts +17 -0
  37. package/dist/deps/hash/index.js +17 -0
  38. package/dist/deps/logger/index.d.ts +14 -0
  39. package/dist/deps/logger/index.js +100 -0
  40. package/dist/deps/parallel/index.d.ts +34 -0
  41. package/dist/deps/parallel/index.js +93 -0
  42. package/dist/deps/redis/index.d.ts +6 -0
  43. package/dist/deps/redis/index.js +9 -0
  44. package/dist/deps/rest/Before.d.ts +5 -0
  45. package/dist/deps/rest/Before.js +9 -0
  46. package/dist/deps/rest/defines.d.ts +50 -0
  47. package/dist/deps/rest/defines.js +2 -0
  48. package/dist/deps/rest/index.d.ts +34 -0
  49. package/dist/deps/rest/index.js +79 -0
  50. package/dist/deps/rest/stats.d.ts +6 -0
  51. package/dist/deps/rest/stats.js +155 -0
  52. package/dist/deps/rest/utils.d.ts +23 -0
  53. package/dist/deps/rest/utils.js +419 -0
  54. package/dist/deps/schema/index.d.ts +11 -0
  55. package/dist/deps/schema/index.js +39 -0
  56. package/dist/deps/sequelize/index.d.ts +11 -0
  57. package/dist/deps/sequelize/index.js +17 -0
  58. package/dist/deps/signer/index.d.ts +20 -0
  59. package/dist/deps/signer/index.js +36 -0
  60. package/dist/dm/dm.d.ts +21 -0
  61. package/dist/dm/dm.js +57 -0
  62. package/dist/dm/index.d.ts +12 -0
  63. package/dist/dm/index.js +56 -0
  64. package/dist/http/index.d.ts +12 -0
  65. package/dist/http/index.js +34 -0
  66. package/dist/http/router.d.ts +23 -0
  67. package/dist/http/router.js +215 -0
  68. package/dist/http/utils.d.ts +29 -0
  69. package/dist/http/utils.js +185 -0
  70. package/dist/index.d.ts +65 -0
  71. package/dist/index.js +18 -0
  72. package/dist/utils/index.d.ts +36 -0
  73. package/dist/utils/index.js +84 -0
  74. package/jest.config.js +6 -0
  75. package/package.json +79 -0
  76. package/tsconfig.json +13 -0
@@ -0,0 +1,185 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Utils = void 0;
4
+ const os = require("os");
5
+ const fs = require("fs");
6
+ const crypto = require("crypto");
7
+ const _ = require("lodash");
8
+ const xlsx = require("xlsx");
9
+ const csv_stringify_1 = require("csv-stringify");
10
+ const str2arr = ["_includes", "dimensions", "metrics", "_attrs"];
11
+ const enc = encodeURI;
12
+ const TMPDIR = os.tmpdir();
13
+ function Utils(cnf) {
14
+ const proxyIps = new Set((cnf.proxyIps || "127.0.0.1").split(","));
15
+ const utils = {
16
+ ucwords(value) {
17
+ return `${value[0].toUpperCase()}${value.substring(1)}`;
18
+ },
19
+ /** 真实的连接请求端ip */
20
+ remoteIp(req) {
21
+ const { socket } = req;
22
+ return socket.remoteAddress || "";
23
+ },
24
+ /**
25
+ * 获取客户端真实ip地址
26
+ */
27
+ clientIp(req) {
28
+ return (req.headers["x-forwarded-for"] || req.headers["x-real-ip"] || utils.remoteIp(req))
29
+ .toString()
30
+ .split(",")[0];
31
+ },
32
+ /**
33
+ * 获取可信任的真实ip
34
+ */
35
+ realIp(req) {
36
+ const remoteIp = utils.remoteIp(req);
37
+ if (!proxyIps.has(remoteIp))
38
+ return remoteIp;
39
+ return (req.headers["x-real-ip"] || remoteIp).toString();
40
+ },
41
+ /**
42
+ * 构造profile参数
43
+ */
44
+ makeProfile(req, method, customFn) {
45
+ const obj = {
46
+ clientIp: utils.clientIp(req),
47
+ remoteIp: utils.remoteIp(req),
48
+ realIp: utils.realIp(req),
49
+ userAgent: req.userAgent(),
50
+ startedAt: new Date(),
51
+ requestId: req.id(),
52
+ };
53
+ const token = req.headers["x-auth-token"] || req.query.access_token || req.query.accessToken;
54
+ // token 和签名认证只能二选一
55
+ if (token) {
56
+ obj.token = token;
57
+ }
58
+ else {
59
+ // 处理签名认证的方式
60
+ const signature = req.headers["x-auth-signature"];
61
+ if (signature) {
62
+ obj.sign = {
63
+ signature,
64
+ uri: req.url || "/",
65
+ key: req.headers["x-auth-key"],
66
+ timestamp: Number(req.headers["x-auth-timestamp"]) | 0,
67
+ signMethod: req.headers["x-auth-sign-method"],
68
+ signVersion: req.headers["x-auth-sign-version"],
69
+ method,
70
+ };
71
+ }
72
+ }
73
+ // 客户端发布号
74
+ obj.revision = req.headers["x-auth-revision"];
75
+ // 用户uuid 可以长期跨app
76
+ obj.uuid = req.headers["x-auth-uuid"];
77
+ if (customFn)
78
+ Object.assign(obj, customFn(obj, req));
79
+ return Object.freeze(obj);
80
+ },
81
+ /**
82
+ * 构造领域方法所需的 params 参数
83
+ */
84
+ makeParams(req) {
85
+ let params = { ...req.params, ...req.query };
86
+ if (_.isObject(req.body) && !Array.isArray(req.body)) {
87
+ params = { ...req.body, ...params };
88
+ }
89
+ else if (req.body) {
90
+ params.__raw = req.body;
91
+ }
92
+ // 逗号分隔的属性,自动转换为 array
93
+ for (const k of str2arr) {
94
+ if (params[k] && _.isString(params[k]))
95
+ params[k] = params[k].split(",");
96
+ }
97
+ if (_.size(req.files))
98
+ params.__files = req.files;
99
+ return params;
100
+ },
101
+ /**
102
+ *
103
+ * 输出csv相关
104
+ */
105
+ async outputCSV(rows, params, res, isXLSX = false) {
106
+ const { _names, _cols, _filename } = params;
107
+ if (!_.isString(_cols))
108
+ return false;
109
+ if (_names && !_.isString(_names))
110
+ return false;
111
+ const keys = _cols.split(",");
112
+ const titles = (_names || _cols).split(",");
113
+ const filename = _filename || `data.${isXLSX ? "xlsx" : "csv"}`;
114
+ res.header("Content-disposition", `attachment; filename*=UTF-8''${enc(filename)}`);
115
+ const mimeType = isXLSX ? "application/xlsx" : "text/csv";
116
+ res.header("Content-type", mimeType);
117
+ if (isXLSX) {
118
+ const file = `${TMPDIR}/${crypto.randomBytes(16).toString("hex")}.xlsx`;
119
+ const workBook = xlsx.utils.book_new();
120
+ const workSheet = xlsx.utils.aoa_to_sheet([
121
+ titles,
122
+ ...rows.map((x) => keys.map((k) => x[k])),
123
+ ]);
124
+ xlsx.utils.book_append_sheet(workBook, workSheet);
125
+ xlsx.writeFile(workBook, file, { bookType: "xlsx", type: "binary" });
126
+ await new Promise((resolve) => {
127
+ const stream = fs.createReadStream(file);
128
+ stream.pipe(res);
129
+ stream.on("end", () => {
130
+ resolve();
131
+ fs.unlinkSync(file);
132
+ });
133
+ });
134
+ }
135
+ else {
136
+ await new Promise((resolve) => {
137
+ const stream = (0, csv_stringify_1.stringify)(rows, {
138
+ header: true,
139
+ columns: _.zipObject(keys, titles),
140
+ });
141
+ stream.pipe(res);
142
+ stream.on("end", resolve);
143
+ });
144
+ }
145
+ return true;
146
+ },
147
+ jsonSchema2Swagger(schema, verb, methodPath, swaggerDocJson) {
148
+ if (verb === "post" || verb === "put" || verb === "patch") {
149
+ swaggerDocJson.definitions[methodPath] = schema;
150
+ return [
151
+ {
152
+ name: "body",
153
+ in: "body",
154
+ require: true,
155
+ description: schema.description,
156
+ operationId: methodPath,
157
+ schema: {
158
+ $ref: `#/definitions/${methodPath}`,
159
+ },
160
+ },
161
+ ];
162
+ }
163
+ const parameters = [];
164
+ if (!_.has(schema, "properties")) {
165
+ return parameters;
166
+ }
167
+ const requireds = schema.required ? schema.required : [];
168
+ for (const prop of Object.keys(schema.properties)) {
169
+ const val = schema.properties[prop];
170
+ const param = {
171
+ name: prop,
172
+ in: "query",
173
+ ...val,
174
+ };
175
+ if (requireds.includes("prop")) {
176
+ param.required = true;
177
+ }
178
+ parameters.push(param);
179
+ }
180
+ return parameters;
181
+ },
182
+ };
183
+ return utils;
184
+ }
185
+ exports.Utils = Utils;
@@ -0,0 +1,65 @@
1
+ import Deps = require("./deps/defines");
2
+ export { Main as Http } from "./http";
3
+ export * as DM from "./dm";
4
+ export * as utils from "./utils";
5
+ declare type TDeps = typeof Deps;
6
+ declare type Merge<T> = {
7
+ [k in keyof T]: T[k];
8
+ };
9
+ /**
10
+ * Include from T those types that are assignable to U
11
+ */
12
+ declare type Include<T, U> = T extends U ? T : never;
13
+ declare type RemoveReadonlyArray<T> = T extends ReadonlyArray<infer T1> ? T1 : false;
14
+ export declare function Main<T extends Readonly<Array<keyof TDeps>>>(features: T): (cnf: Merge<{
15
+ aes: typeof import("./deps/aes");
16
+ axios: typeof import("./deps/axios");
17
+ cache: typeof import("./deps/cache");
18
+ checker: typeof import("./deps/checker");
19
+ cia: typeof import("./deps/cia");
20
+ counter: typeof import("./deps/counter");
21
+ cron: typeof import("./deps/cron");
22
+ graceful: typeof import("./deps/graceful");
23
+ hash: typeof import("./deps/hash");
24
+ logger: typeof import("./deps/logger");
25
+ parallel: typeof import("./deps/parallel");
26
+ redis: typeof import("./deps/redis");
27
+ rest: typeof import("./deps/rest");
28
+ schema: typeof import("./deps/schema");
29
+ sequelize: typeof import("./deps/sequelize");
30
+ signer: typeof import("./deps/signer");
31
+ }[Include<"logger", RemoveReadonlyArray<T>> | Include<"aes", RemoveReadonlyArray<T>> | Include<"cache", RemoveReadonlyArray<T>> | Include<"redis", RemoveReadonlyArray<T>> | Include<"graceful", RemoveReadonlyArray<T>> | Include<"cia", RemoveReadonlyArray<T>> | Include<"counter", RemoveReadonlyArray<T>> | Include<"cron", RemoveReadonlyArray<T>> | Include<"hash", RemoveReadonlyArray<T>> | Include<"parallel", RemoveReadonlyArray<T>> | Include<"sequelize", RemoveReadonlyArray<T>> | Include<"schema", RemoveReadonlyArray<T>> | Include<"rest", RemoveReadonlyArray<T>> | Include<"axios", RemoveReadonlyArray<T>> | Include<"checker", RemoveReadonlyArray<T>> | Include<"signer", RemoveReadonlyArray<T>>]["Main"] extends (arg: infer R, ...args: any[]) => any ? R : {}>) => { [k in keyof Pick<{
32
+ aes: typeof import("./deps/aes");
33
+ axios: typeof import("./deps/axios");
34
+ cache: typeof import("./deps/cache");
35
+ checker: typeof import("./deps/checker");
36
+ cia: typeof import("./deps/cia");
37
+ counter: typeof import("./deps/counter");
38
+ cron: typeof import("./deps/cron");
39
+ graceful: typeof import("./deps/graceful");
40
+ hash: typeof import("./deps/hash");
41
+ logger: typeof import("./deps/logger");
42
+ parallel: typeof import("./deps/parallel");
43
+ redis: typeof import("./deps/redis");
44
+ rest: typeof import("./deps/rest");
45
+ schema: typeof import("./deps/schema");
46
+ sequelize: typeof import("./deps/sequelize");
47
+ signer: typeof import("./deps/signer");
48
+ }, RemoveReadonlyArray<T>>]: ReturnType<Pick<{
49
+ aes: typeof import("./deps/aes");
50
+ axios: typeof import("./deps/axios");
51
+ cache: typeof import("./deps/cache");
52
+ checker: typeof import("./deps/checker");
53
+ cia: typeof import("./deps/cia");
54
+ counter: typeof import("./deps/counter");
55
+ cron: typeof import("./deps/cron");
56
+ graceful: typeof import("./deps/graceful");
57
+ hash: typeof import("./deps/hash");
58
+ logger: typeof import("./deps/logger");
59
+ parallel: typeof import("./deps/parallel");
60
+ redis: typeof import("./deps/redis");
61
+ rest: typeof import("./deps/rest");
62
+ schema: typeof import("./deps/schema");
63
+ sequelize: typeof import("./deps/sequelize");
64
+ signer: typeof import("./deps/signer");
65
+ }, RemoveReadonlyArray<T>>[k]["Main"]>; };
package/dist/index.js ADDED
@@ -0,0 +1,18 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Main = exports.utils = exports.DM = exports.Http = void 0;
4
+ const _ = require("lodash");
5
+ const DM = require("./dm");
6
+ const Deps = require("./deps/defines");
7
+ var http_1 = require("./http");
8
+ Object.defineProperty(exports, "Http", { enumerable: true, get: function () { return http_1.Main; } });
9
+ exports.DM = require("./dm");
10
+ exports.utils = require("./utils");
11
+ function Main(features) {
12
+ return (cnf) => {
13
+ const deps = {};
14
+ const modules = DM.auto(_.pick(Deps, features), deps, [cnf, deps]);
15
+ return modules;
16
+ };
17
+ }
18
+ exports.Main = Main;
@@ -0,0 +1,36 @@
1
+ /** 计算给定字符串的md5值 */
2
+ export declare const md5: (str: {
3
+ toString: () => string;
4
+ }) => string;
5
+ /**
6
+ 生成随机字符串,
7
+ @type: "strong" 强壮型 包括特殊字符
8
+ @type: "normal" 普通型 不包括特殊字符
9
+ @type: string 随机串字典手动指定
10
+ */
11
+ export declare function randStr(len: number, type: "strong"): string;
12
+ export declare function randStr(len: number, type: "normal"): string;
13
+ export declare function randStr(len: number, type: string): string;
14
+ /** 将字符串里的换行,制表符替换为普通空格 */
15
+ export declare const nt2space: (value: string) => string;
16
+ /** 首字符大写 */
17
+ export declare const ucfirst: (value: string) => string;
18
+ /** 首字符小写 */
19
+ export declare const lcfirst: (value: string) => string;
20
+ /** 睡眠等待 */
21
+ export declare const sleep: (ms: number) => Promise<unknown>;
22
+ /** 深度冻结一个对象,防止被不小心篡改 */
23
+ export declare const deepFreeze: <T>(object: T) => Readonly<T>;
24
+ /** try catch 包裹执行, 记录错误日志 */
25
+ declare type TryCatchLogFn = <T extends (...args: any[]) => Promise<void>, L extends (...args: any[]) => void>(fn: T, errorLog: L) => (...args: Parameters<T>) => Promise<void>;
26
+ export declare const tryCatchLog: TryCatchLogFn;
27
+ /**
28
+ 判断某个秒级时间戳是否已过期,基于当前时间
29
+ */
30
+ export declare const inExpired: (time: number, life: number) => boolean;
31
+ declare type Params = {
32
+ [K: string]: string;
33
+ };
34
+ /** 修改指定url上添加一些参数 */
35
+ export declare const modifiyURL: (address: string, adds?: Params | undefined, removes?: string[] | undefined) => string;
36
+ export {};
@@ -0,0 +1,84 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.modifiyURL = exports.inExpired = exports.tryCatchLog = exports.deepFreeze = exports.sleep = exports.lcfirst = exports.ucfirst = exports.nt2space = exports.randStr = exports.md5 = void 0;
4
+ const crypto = require("crypto");
5
+ /** 随机字符串字典 */
6
+ const RAND_STR_DICT = {
7
+ normal: "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789",
8
+ strong: "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789!#$%&’()*+,-./:;<=>?@[]^_`{|}~",
9
+ };
10
+ /** 计算给定字符串的md5值 */
11
+ const md5 = (str) => {
12
+ const hash = crypto.createHash("md5");
13
+ return hash.update(str.toString()).digest().toString("hex");
14
+ };
15
+ exports.md5 = md5;
16
+ function randStr(len, type) {
17
+ const dict = type === "strong" || type === "normal" ? RAND_STR_DICT[type] : type;
18
+ const { length } = dict;
19
+ /** 随机字符串的长度不能等于 0 或者负数 */
20
+ len |= 0;
21
+ len = Math.max(len, 3);
22
+ return Array(len)
23
+ .fill("")
24
+ .map(() => dict[Math.floor(Math.random() * length)])
25
+ .join("");
26
+ }
27
+ exports.randStr = randStr;
28
+ /** 将字符串里的换行,制表符替换为普通空格 */
29
+ const nt2space = (value) => value.replace(/(\\[ntrfv]|\s)+/g, " ").trim();
30
+ exports.nt2space = nt2space;
31
+ /** 首字符大写 */
32
+ const ucfirst = (value) => value[0].toUpperCase() + value.substring(1);
33
+ exports.ucfirst = ucfirst;
34
+ /** 首字符小写 */
35
+ const lcfirst = (value) => value[0].toLowerCase() + value.substring(1);
36
+ exports.lcfirst = lcfirst;
37
+ /** 睡眠等待 */
38
+ const sleep = (ms) => new Promise((resolve) => setTimeout(resolve, ms));
39
+ exports.sleep = sleep;
40
+ /** 深度冻结一个对象,防止被不小心篡改 */
41
+ const deepFreeze = (object) => {
42
+ // Retrieve the property names defined on object
43
+ const propNames = Object.getOwnPropertyNames(object);
44
+ for (const name of propNames) {
45
+ const value = object[name];
46
+ if (value && typeof value === "object") {
47
+ (0, exports.deepFreeze)(value);
48
+ }
49
+ }
50
+ return Object.freeze(object);
51
+ };
52
+ exports.deepFreeze = deepFreeze;
53
+ const tryCatchLog = (fn, errorLog) => async (...args) => {
54
+ try {
55
+ await fn(...args);
56
+ }
57
+ catch (e) {
58
+ errorLog(e);
59
+ }
60
+ };
61
+ exports.tryCatchLog = tryCatchLog;
62
+ /**
63
+ 判断某个秒级时间戳是否已过期,基于当前时间
64
+ */
65
+ const inExpired = (time, life) => {
66
+ const now = (Date.now() / 1000) | 0;
67
+ return time < now - life;
68
+ };
69
+ exports.inExpired = inExpired;
70
+ /** 修改指定url上添加一些参数 */
71
+ const modifiyURL = (address, adds, removes) => {
72
+ const obj = new URL(address);
73
+ if (typeof adds === "object") {
74
+ for (const key of Object.keys(adds)) {
75
+ obj.searchParams.append(key, adds[key]);
76
+ }
77
+ }
78
+ if (Array.isArray(removes)) {
79
+ for (const key of removes)
80
+ obj.searchParams.delete(key);
81
+ }
82
+ return obj.toString();
83
+ };
84
+ exports.modifiyURL = modifiyURL;
package/jest.config.js ADDED
@@ -0,0 +1,6 @@
1
+ /** @type {import('ts-jest/dist/types').InitialOptionsTsJest} */
2
+ module.exports = {
3
+ preset: "ts-jest",
4
+ testEnvironment: "node",
5
+ forceExit: true,
6
+ };
package/package.json ADDED
@@ -0,0 +1,79 @@
1
+ {
2
+ "name": "@domain.js/main",
3
+ "version": "0.1.0",
4
+ "description": "DDD framework",
5
+ "main": "dist/index.js",
6
+ "scripts": {
7
+ "build": "tsc",
8
+ "test": "export NODE_ENV=test && jest ./src --coverage",
9
+ "test:watch": "export NODE_ENV=test && jest ./src --watch",
10
+ "prepare": "husky install",
11
+ "lint-staged": "lint-staged",
12
+ "lint-staged:js": "eslint --ext .js,.ts",
13
+ "loadDeps": "ts-node src/cli/index.ts loadDeps ./ ts"
14
+ },
15
+ "author": "Redstone Zhao",
16
+ "license": "MIT",
17
+ "devDependencies": {
18
+ "@types/async": "^3.2.10",
19
+ "@types/crypto-js": "^4.0.2",
20
+ "@types/ioredis": "^4.28.1",
21
+ "@types/jest": "^27.0.3",
22
+ "@types/lodash": "^4.14.177",
23
+ "@types/lru-cache": "^5.1.1",
24
+ "@types/restify": "^8.5.4",
25
+ "@types/restify-errors": "^4.3.4",
26
+ "@types/uuid": "^8.3.3",
27
+ "@types/validator": "^13.7.0",
28
+ "@typescript-eslint/eslint-plugin": "^4.22.0",
29
+ "@typescript-eslint/parser": "^4.22.0",
30
+ "babel-eslint": "^10.1.0",
31
+ "codecov": "^3.8.3",
32
+ "eslint": "^7.11.0",
33
+ "eslint-config-airbnb": "^18.2.0",
34
+ "eslint-config-prettier": "^8.3.0",
35
+ "eslint-plugin-import": "^2.22.1",
36
+ "eslint-plugin-jsx-a11y": "^6.3.1",
37
+ "eslint-plugin-prettier": "^3.4.0",
38
+ "eslint-plugin-react": "^7.21.4",
39
+ "husky": "^7.0.0",
40
+ "jest": "^27.3.1",
41
+ "lint-staged": "^11.0.0",
42
+ "prettier": "^2.3.0",
43
+ "sequelize-json-schema": "^2.1.1",
44
+ "ts-jest": "^27.0.7",
45
+ "typescript": "^4.5.2"
46
+ },
47
+ "prettier": {
48
+ "printWidth": 100,
49
+ "trailingComma": "all"
50
+ },
51
+ "lint-staged": {
52
+ "**/*.{js,ts}": [
53
+ "prettier --write",
54
+ "eslint --fix"
55
+ ]
56
+ },
57
+ "dependencies": {
58
+ "ajv": "^8.8.1",
59
+ "ajv-formats": "^2.1.1",
60
+ "async": "^3.2.2",
61
+ "axios": "^0.24.0",
62
+ "cron-parser": "^4.1.0",
63
+ "crypto-js": "^4.1.1",
64
+ "csv-stringify": "^6.0.2",
65
+ "human-interval": "^2.0.1",
66
+ "ioredis": "^4.28.0",
67
+ "lodash": "^4.17.21",
68
+ "lru-cache": "^6.0.0",
69
+ "moment": "^2.29.1",
70
+ "mysql2": "^2.3.3",
71
+ "restify": "^8.6.0",
72
+ "restify-errors": "^8.0.2",
73
+ "sequelize": "^6.9.0",
74
+ "swagger-ui-restify": "^3.0.8",
75
+ "ts-node": "^10.4.0",
76
+ "uuid": "^8.3.2",
77
+ "xlsx": "^0.17.4"
78
+ }
79
+ }
package/tsconfig.json ADDED
@@ -0,0 +1,13 @@
1
+ {
2
+ "compilerOptions": {
3
+ "target": "es2018",
4
+ "module": "commonjs",
5
+ "moduleResolution": "node",
6
+ "declaration": true,
7
+ "outDir": "./dist",
8
+ "strict": true,
9
+ "rootDir": "./src/"
10
+ },
11
+ "include": ["./"],
12
+ "exclude": ["./src/**/*.test.ts", "./src/**/samples/*", "node_modules", "dist"]
13
+ }