@domain.js/main 0.1.9 → 0.1.13

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/.eslintrc.js CHANGED
@@ -1,67 +1,32 @@
1
1
  module.exports = {
2
- parser: "@typescript-eslint/parser",
3
- plugins: ["@typescript-eslint"],
4
- extends: ["airbnb", "eslint:recommended", "plugin:@typescript-eslint/recommended"],
5
- ignorePatterns: [".eslintrc.js"],
6
- root: true,
2
+ parser: "@typescript-eslint/parser", // 解析ts 代码编译器,将ts 语法树转化为 eslint 期望的
3
+ extends: ["alloy", "alloy/typescript"],
4
+ plugins: ["simple-import-sort", "unused-imports"],
7
5
  env: {
8
- es6: true,
6
+ // Your environments (which contains several predefined global variables)
7
+ //
9
8
  node: true,
10
- jest: true,
9
+ commonjs: true,
10
+ es6: true,
11
11
  },
12
- settings: {
13
- react: {
14
- version: "999.999.999",
15
- },
12
+ globals: {
13
+ // Your global variables (setting to false means it's not allowed to be reassigned)
14
+ //
15
+ // myGlobal: false
16
16
  },
17
17
  rules: {
18
- "nonblock-statement-body-position": "off",
19
- "operator-linebreak": ["error", "after"],
20
- "prefer-destructuring": ["error", { object: true, array: true }],
21
- indent: ["error", 2],
22
- "no-use-before-define": ["error", { functions: true, classes: true, variables: true }],
23
- "no-param-reassign": 0,
24
- "no-continue": 0,
25
- "no-console": 0,
26
- "no-debugger": 1,
27
- "no-var": 1,
28
- semi: ["error", "always"],
29
- "no-trailing-spaces": "error",
30
- "eol-last": 1,
31
- "no-underscore-dangle": 0,
32
- "no-empty": "error",
33
- "no-loop-func": "error",
34
- "no-bitwise": "off", // "error",
35
- quotes: ["error", "double"],
36
- "comma-dangle": ["error", "only-multiline"],
37
- "arrow-parens": ["error", "always"],
38
- "object-curly-newline": 0,
39
- "function-paren-newline": 0,
40
- "implicit-arrow-linebreak": 0,
41
- curly: 0,
42
- "no-mixed-operators": "error",
43
- "no-restricted-syntax": 0,
44
- "no-lone-blocks": "error",
45
- "lines-between-class-members": "off",
46
- yoda: "error",
47
- "no-plusplus": 0,
48
- "import/export": 0,
49
- "no-cond-assign": "error",
50
- "no-shadow": 0,
51
- camelcase: 0,
52
- "prefer-destructuring": 0,
53
- "import/prefer-default-export": "off",
54
- "newline-per-chained-call": 0,
55
- "@typescript-eslint/interface-name-prefix": "off",
56
- "@typescript-eslint/explicit-function-return-type": "off",
57
- "@typescript-eslint/explicit-module-boundary-types": "off",
58
- "@typescript-eslint/no-explicit-any": "off",
59
- "@typescript-eslint/no-namespace": 0,
60
- "@typescript-eslint/ban-types": 0,
61
- "import/export": 0,
62
- "import/no-unresolved": 0,
63
- "import/extensions": 0,
64
- "@typescript-eslint/no-var-requires": 0,
65
- "@typescript-eslint/no-this-alias": 0,
18
+ // Customize your rules
19
+ "spaced-comment": "off", // 注释前有空白检查
20
+ "simple-import-sort/imports": "error", // 优化import 顺序
21
+ "simple-import-sort/exports": "error", // 优化 export 顺序
22
+ "no-multiple-empty-lines": ["warn", { max: 2 }], // 强制最大连续空行数为 2
23
+ complexity: ["error", 20], // https://cn.eslint.org/docs/rules/complexity
24
+ "no-template-curly-in-string": "error", //禁止在常规字符串中出现模板字面量占位符语法
25
+ "unused-imports/no-unused-imports": "warn",
26
+ "@typescript-eslint/explicit-member-accessibility": "off", // 不强制设置类成员的可访问性
27
+ "@typescript-eslint/member-ordering": "off", // 不严格限制类成员顺序
28
+ "max-params": ["error", 6], // 函数最多6个参数
29
+ "@typescript-eslint/no-require-imports": "off", // 部分第三方库不支持 esModuleInterop 编译选项
30
+ "@typescript-eslint/prefer-optional-chain": "off", // 过多使用可选操作符降低代码可读性 foo?.a?.b?.c
66
31
  },
67
32
  };
package/.husky/pre-commit CHANGED
@@ -5,4 +5,5 @@ fi
5
5
  . "$(dirname "$0")/_/husky.sh"
6
6
 
7
7
  ts-node src/cli/index.ts loadDeps ./src/deps ts && npm run lint-staged && npm run build
8
+ npm run build
8
9
  npm tst
package/dist/cfg/index.js CHANGED
@@ -1,9 +1,31 @@
1
1
  "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
5
+ }) : (function(o, m, k, k2) {
6
+ if (k2 === undefined) k2 = k;
7
+ o[k2] = m[k];
8
+ }));
9
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
10
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
11
+ }) : function(o, v) {
12
+ o["default"] = v;
13
+ });
14
+ var __importStar = (this && this.__importStar) || function (mod) {
15
+ if (mod && mod.__esModule) return mod;
16
+ var result = {};
17
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
18
+ __setModuleDefault(result, mod);
19
+ return result;
20
+ };
21
+ var __importDefault = (this && this.__importDefault) || function (mod) {
22
+ return (mod && mod.__esModule) ? mod : { "default": mod };
23
+ };
2
24
  Object.defineProperty(exports, "__esModule", { value: true });
3
25
  exports.Main = void 0;
4
- const _ = require("lodash");
5
- const ajv_1 = require("ajv");
6
- const ajv_formats_1 = require("ajv-formats");
26
+ const _ = __importStar(require("lodash"));
27
+ const ajv_1 = __importDefault(require("ajv"));
28
+ const ajv_formats_1 = __importDefault(require("ajv-formats"));
7
29
  function Main(object, schema) {
8
30
  if (typeof schema !== "object")
9
31
  throw Error("object type isnt an object");
package/dist/cli/index.js CHANGED
@@ -1,10 +1,29 @@
1
1
  #! /usr/bin/env node
2
2
  "use strict";
3
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
4
+ if (k2 === undefined) k2 = k;
5
+ Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
6
+ }) : (function(o, m, k, k2) {
7
+ if (k2 === undefined) k2 = k;
8
+ o[k2] = m[k];
9
+ }));
10
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
11
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
12
+ }) : function(o, v) {
13
+ o["default"] = v;
14
+ });
15
+ var __importStar = (this && this.__importStar) || function (mod) {
16
+ if (mod && mod.__esModule) return mod;
17
+ var result = {};
18
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
19
+ __setModuleDefault(result, mod);
20
+ return result;
21
+ };
3
22
  Object.defineProperty(exports, "__esModule", { value: true });
4
- const fs = require("fs");
5
- const path = require("path");
6
- const readline = require("readline");
7
23
  const child_process_1 = require("child_process");
24
+ const fs = __importStar(require("fs"));
25
+ const path = __importStar(require("path"));
26
+ const readline = __importStar(require("readline"));
8
27
  const rl = readline.createInterface({
9
28
  input: process.stdin,
10
29
  output: process.stdout,
@@ -16,7 +35,7 @@ rl.setPrompt("> ");
16
35
  const _require = require;
17
36
  const showMessage = (msg, exit) => {
18
37
  rl.write(`${msg}\n`);
19
- if (exit != null)
38
+ if (exit)
20
39
  process.exit(exit);
21
40
  rl.setPrompt("> ");
22
41
  };
@@ -34,8 +53,8 @@ const makeDefineFile = async (modules, targetFile, isTS) => {
34
53
  const dirname = path.dirname(targetFile);
35
54
  const content = ["// domain-cli 自动生成"];
36
55
  const _exports = [];
37
- for (let i = 0; i < modules.length; i += 1) {
38
- const name = path.relative(dirname, modules[i]);
56
+ for (const x of modules) {
57
+ const name = path.relative(dirname, x);
39
58
  const variable = filePath2Var(name);
40
59
  if (isTS) {
41
60
  content.push(`import * as ${variable} from "./${name}"`);
@@ -1,16 +1,16 @@
1
- import * as _ from "lodash";
1
+ import _ from "lodash";
2
2
  import * as uuid from "uuid";
3
3
  import * as ajv from "ajv";
4
4
  import * as ajvFormats from "ajv-formats";
5
5
  import * as async from "async";
6
6
  import * as axios from "axios";
7
7
  import * as cronParser from "cron-parser";
8
- import humanInterval = require("human-interval");
8
+ import humanInterval from "human-interval";
9
9
  import * as IORedis from "ioredis";
10
- import * as LRU from "lru-cache";
10
+ import LRU from "lru-cache";
11
11
  import * as mysql from "mysql2";
12
12
  import * as Sequelize from "sequelize";
13
- import * as moment from "moment";
13
+ import moment from "moment";
14
14
  import * as utils from "./utils";
15
15
  import { errors } from "./basic-errors";
16
16
  /** npm packages injection */
package/dist/defaults.js CHANGED
@@ -1,35 +1,57 @@
1
1
  "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
5
+ }) : (function(o, m, k, k2) {
6
+ if (k2 === undefined) k2 = k;
7
+ o[k2] = m[k];
8
+ }));
9
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
10
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
11
+ }) : function(o, v) {
12
+ o["default"] = v;
13
+ });
14
+ var __importStar = (this && this.__importStar) || function (mod) {
15
+ if (mod && mod.__esModule) return mod;
16
+ var result = {};
17
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
18
+ __setModuleDefault(result, mod);
19
+ return result;
20
+ };
21
+ var __importDefault = (this && this.__importDefault) || function (mod) {
22
+ return (mod && mod.__esModule) ? mod : { "default": mod };
23
+ };
2
24
  Object.defineProperty(exports, "__esModule", { value: true });
3
25
  exports.defaults = void 0;
4
- const _ = require("lodash");
5
- const uuid = require("uuid");
6
- const ajv = require("ajv");
7
- const ajvFormats = require("ajv-formats");
8
- const async = require("async");
9
- const axios = require("axios");
10
- const cronParser = require("cron-parser");
11
- const humanInterval = require("human-interval");
12
- const IORedis = require("ioredis");
13
- const LRU = require("lru-cache");
14
- const mysql = require("mysql2");
15
- const Sequelize = require("sequelize");
16
- const moment = require("moment");
17
- const utils = require("./utils");
26
+ const lodash_1 = __importDefault(require("lodash"));
27
+ const uuid = __importStar(require("uuid"));
28
+ const ajv = __importStar(require("ajv"));
29
+ const ajvFormats = __importStar(require("ajv-formats"));
30
+ const async = __importStar(require("async"));
31
+ const axios = __importStar(require("axios"));
32
+ const cronParser = __importStar(require("cron-parser"));
33
+ const human_interval_1 = __importDefault(require("human-interval"));
34
+ const IORedis = __importStar(require("ioredis"));
35
+ const lru_cache_1 = __importDefault(require("lru-cache"));
36
+ const mysql = __importStar(require("mysql2"));
37
+ const Sequelize = __importStar(require("sequelize"));
38
+ const moment_1 = __importDefault(require("moment"));
39
+ const utils = __importStar(require("./utils"));
18
40
  const basic_errors_1 = require("./basic-errors");
19
41
  exports.defaults = {
20
- _,
42
+ _: lodash_1.default,
21
43
  uuid,
22
44
  ajv,
23
45
  ajvFormats,
24
46
  async,
25
47
  axios,
26
48
  cronParser,
27
- humanInterval,
49
+ humanInterval: human_interval_1.default,
28
50
  IORedis,
29
- LRU,
51
+ LRU: lru_cache_1.default,
30
52
  mysql,
31
53
  Sequelize,
32
- moment,
54
+ moment: moment_1.default,
33
55
  utils,
34
56
  U: utils,
35
57
  errors: basic_errors_1.errors,
@@ -1,8 +1,27 @@
1
1
  "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
5
+ }) : (function(o, m, k, k2) {
6
+ if (k2 === undefined) k2 = k;
7
+ o[k2] = m[k];
8
+ }));
9
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
10
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
11
+ }) : function(o, v) {
12
+ o["default"] = v;
13
+ });
14
+ var __importStar = (this && this.__importStar) || function (mod) {
15
+ if (mod && mod.__esModule) return mod;
16
+ var result = {};
17
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
18
+ __setModuleDefault(result, mod);
19
+ return result;
20
+ };
2
21
  Object.defineProperty(exports, "__esModule", { value: true });
3
22
  exports.Main = void 0;
4
- const cryptojs = require("crypto-js/core");
5
- const AES = require("crypto-js/aes");
23
+ const cryptojs = __importStar(require("crypto-js/core"));
24
+ const AES = __importStar(require("crypto-js/aes"));
6
25
  function Main() {
7
26
  // aes-256-cbc encrypt
8
27
  const encrypt = (message, key) => AES.encrypt(message, key).toString();
@@ -1,5 +1,5 @@
1
- import * as LRU from "lru-cache";
2
- import * as Redis from "ioredis";
1
+ import LRU from "lru-cache";
2
+ import Redis from "ioredis";
3
3
  import { SetRequired } from "type-fest";
4
4
  export interface CnfDef {
5
5
  cache?: {
@@ -1,36 +1,55 @@
1
1
  "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
5
+ }) : (function(o, m, k, k2) {
6
+ if (k2 === undefined) k2 = k;
7
+ o[k2] = m[k];
8
+ }));
9
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
10
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
11
+ }) : function(o, v) {
12
+ o["default"] = v;
13
+ });
14
+ var __importStar = (this && this.__importStar) || function (mod) {
15
+ if (mod && mod.__esModule) return mod;
16
+ var result = {};
17
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
18
+ __setModuleDefault(result, mod);
19
+ return result;
20
+ };
2
21
  // domain-cli 自动生成
3
- const aes = require("./aes");
4
- const cache = require("./cache");
5
- const checker = require("./checker");
6
- const counter = require("./counter");
7
- const cron = require("./cron");
8
- const graceful = require("./graceful");
9
- const hash = require("./hash");
10
- const logger = require("./logger");
11
- const myCia = require("./myCia");
12
- const parallel = require("./parallel");
13
- const redis = require("./redis");
14
- const request = require("./request");
15
- const rest = require("./rest");
16
- const schema = require("./schema");
17
- const sequelize = require("./sequelize");
18
- const signer = require("./signer");
22
+ const aes = __importStar(require("./aes"));
23
+ const cache = __importStar(require("./cache"));
24
+ const checker = __importStar(require("./checker"));
25
+ const counter = __importStar(require("./counter"));
26
+ const cron = __importStar(require("./cron"));
27
+ const graceful = __importStar(require("./graceful"));
28
+ const hash = __importStar(require("./hash"));
29
+ const logger = __importStar(require("./logger"));
30
+ const myCia = __importStar(require("./myCia"));
31
+ const parallel = __importStar(require("./parallel"));
32
+ const redis = __importStar(require("./redis"));
33
+ const request = __importStar(require("./request"));
34
+ const rest = __importStar(require("./rest"));
35
+ const schema = __importStar(require("./schema"));
36
+ const sequelize = __importStar(require("./sequelize"));
37
+ const signer = __importStar(require("./signer"));
19
38
  module.exports = {
20
- aes,
21
- cache,
22
- checker,
23
- counter,
24
- cron,
25
- graceful,
26
- hash,
27
- logger,
28
- myCia,
29
- parallel,
30
- redis,
31
- request,
32
- rest,
33
- schema,
34
- sequelize,
35
- signer,
39
+ aes: aes,
40
+ cache: cache,
41
+ checker: checker,
42
+ counter: counter,
43
+ cron: cron,
44
+ graceful: graceful,
45
+ hash: hash,
46
+ logger: logger,
47
+ myCia: myCia,
48
+ parallel: parallel,
49
+ redis: redis,
50
+ request: request,
51
+ rest: rest,
52
+ schema: schema,
53
+ sequelize: sequelize,
54
+ signer: signer,
36
55
  };
@@ -1,7 +1,26 @@
1
1
  "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
5
+ }) : (function(o, m, k, k2) {
6
+ if (k2 === undefined) k2 = k;
7
+ o[k2] = m[k];
8
+ }));
9
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
10
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
11
+ }) : function(o, v) {
12
+ o["default"] = v;
13
+ });
14
+ var __importStar = (this && this.__importStar) || function (mod) {
15
+ if (mod && mod.__esModule) return mod;
16
+ var result = {};
17
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
18
+ __setModuleDefault(result, mod);
19
+ return result;
20
+ };
2
21
  Object.defineProperty(exports, "__esModule", { value: true });
3
22
  exports.Deps = exports.Main = void 0;
4
- const process = require("process");
23
+ const process = __importStar(require("process"));
5
24
  function Graceful(info) {
6
25
  let exiting = false; // 是否正在退出
7
26
  const callbacks = [];
@@ -1,8 +1,27 @@
1
1
  "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
5
+ }) : (function(o, m, k, k2) {
6
+ if (k2 === undefined) k2 = k;
7
+ o[k2] = m[k];
8
+ }));
9
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
10
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
11
+ }) : function(o, v) {
12
+ o["default"] = v;
13
+ });
14
+ var __importStar = (this && this.__importStar) || function (mod) {
15
+ if (mod && mod.__esModule) return mod;
16
+ var result = {};
17
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
18
+ __setModuleDefault(result, mod);
19
+ return result;
20
+ };
2
21
  Object.defineProperty(exports, "__esModule", { value: true });
3
22
  exports.Deps = exports.Main = void 0;
4
- const fs = require("fs");
5
- const path = require("path");
23
+ const fs = __importStar(require("fs"));
24
+ const path = __importStar(require("path"));
6
25
  const date = (offset = 0) => new Date(Date.now() + (offset | 0)).toISOString();
7
26
  function Main(cnf, deps) {
8
27
  const { logger: { errorLogPath, infoLogPath, ignoreErrors, clientId }, } = cnf;
@@ -1,6 +1,25 @@
1
1
  "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
5
+ }) : (function(o, m, k, k2) {
6
+ if (k2 === undefined) k2 = k;
7
+ o[k2] = m[k];
8
+ }));
9
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
10
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
11
+ }) : function(o, v) {
12
+ o["default"] = v;
13
+ });
14
+ var __importStar = (this && this.__importStar) || function (mod) {
15
+ if (mod && mod.__esModule) return mod;
16
+ var result = {};
17
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
18
+ __setModuleDefault(result, mod);
19
+ return result;
20
+ };
2
21
  Object.defineProperty(exports, "__esModule", { value: true });
3
- const util = require("util");
22
+ const util = __importStar(require("util"));
4
23
  exports.default = () => {
5
24
  const defines = [
6
25
  ["duplicatRegistMessage", "The message has been registed: %s"],
@@ -1,7 +1,10 @@
1
1
  "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
2
5
  Object.defineProperty(exports, "__esModule", { value: true });
3
6
  exports.Deps = exports.Main = void 0;
4
- const errors_1 = require("./errors");
7
+ const errors_1 = __importDefault(require("./errors"));
5
8
  function Main(cnf, deps) {
6
9
  const { _, async, uuid: { v4: uuid }, logger, redis, graceful, U: { tryCatchLog }, } = deps;
7
10
  const { cia } = cnf;
@@ -1,7 +1,26 @@
1
1
  "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
5
+ }) : (function(o, m, k, k2) {
6
+ if (k2 === undefined) k2 = k;
7
+ o[k2] = m[k];
8
+ }));
9
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
10
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
11
+ }) : function(o, v) {
12
+ o["default"] = v;
13
+ });
14
+ var __importStar = (this && this.__importStar) || function (mod) {
15
+ if (mod && mod.__esModule) return mod;
16
+ var result = {};
17
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
18
+ __setModuleDefault(result, mod);
19
+ return result;
20
+ };
2
21
  Object.defineProperty(exports, "__esModule", { value: true });
3
22
  exports.Deps = exports.Main = void 0;
4
- const utils = require("../../utils");
23
+ const utils = __importStar(require("../../utils"));
5
24
  /**
6
25
  * Parallel control module
7
26
  * @param cnf Module initialization configuration parameters
@@ -1,4 +1,4 @@
1
- import * as Redis from "ioredis";
1
+ import Redis from "ioredis";
2
2
  interface Cnf {
3
3
  redis: Redis.RedisOptions;
4
4
  }
@@ -1,4 +1,4 @@
1
- import * as _ from "lodash";
1
+ import _ from "lodash";
2
2
  import * as Sequelize from "sequelize";
3
3
  import { TModel, Params } from "./defines";
4
4
  import { Stats } from "./stats";
@@ -1,7 +1,10 @@
1
1
  "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
2
5
  Object.defineProperty(exports, "__esModule", { value: true });
3
6
  exports.Deps = exports.Main = exports.Before = void 0;
4
- const _ = require("lodash");
7
+ const lodash_1 = __importDefault(require("lodash"));
5
8
  const stats_1 = require("./stats");
6
9
  var Before_1 = require("./Before");
7
10
  Object.defineProperty(exports, "Before", { enumerable: true, get: function () { return Before_1.Before; } });
@@ -24,14 +27,23 @@ function Main(cnf, deps, utils) {
24
27
  * @param _cols Allow columns to be updated
25
28
  * @returns The resource that has been updated
26
29
  */
27
- const modify = (Model, model, params, isAdmin = false, _cols) => {
30
+ const modify = async (Model, model, params, isAdmin = false, _cols) => {
28
31
  const cols = _cols || Model.editableCols || Model.writableCols || [];
29
32
  const attr = pickParams(params, cols, Model, isAdmin);
30
33
  // 避免id 被篡改,强制删除id属性
31
34
  if (attr.id)
32
35
  delete attr.id;
33
36
  Object.assign(model, attr);
34
- return model.save();
37
+ const fields = model.changed();
38
+ if (!Array.isArray(fields) || !fields.length)
39
+ return model;
40
+ try {
41
+ return await model.save();
42
+ }
43
+ catch (e) {
44
+ Object.assign(model, model.previous());
45
+ throw e;
46
+ }
35
47
  };
36
48
  /**
37
49
  * Restful add(C of CRUD) for create a resource
@@ -54,7 +66,7 @@ function Main(cnf, deps, utils) {
54
66
  return Model.create(attr);
55
67
  // 如果设置了唯一属性,且开启了回收站功能
56
68
  // 则判断是否需要执行恢复操作
57
- const where = _.pick(attr, Model.unique);
69
+ const where = lodash_1.default.pick(attr, Model.unique);
58
70
  // 根据条件查找资源
59
71
  const model = await Model.findOne({ where });
60
72
  // 资源不存在
@@ -101,7 +113,7 @@ function Main(cnf, deps, utils) {
101
113
  // 提高查询速度
102
114
  let count = 0;
103
115
  if (_ignoreTotal !== "yes")
104
- count = await Model.count(_.pick(opt, COUNT_OPT));
116
+ count = await Model.count(lodash_1.default.pick(opt, COUNT_OPT));
105
117
  if (Array.isArray(allowAttrs) && allowAttrs.length)
106
118
  opt.attributes = allowAttrs;
107
119
  const rows = (await Model.findAll(opt));
@@ -1,4 +1,4 @@
1
- import * as _ from "lodash";
1
+ import _ from "lodash";
2
2
  import * as Sequelize from "sequelize";
3
3
  import { Params, ModelExtraAtts, TModel } from "./defines";
4
4
  import { Utils } from "./utils";
@@ -1,7 +1,7 @@
1
- import * as _ from "lodash";
1
+ import type { LoDashStatic } from "lodash";
2
2
  import * as mysql from "mysql2";
3
3
  import * as Sequelize from "sequelize";
4
- import * as moment from "moment";
4
+ import moment from "moment";
5
5
  import { ModelExtraAtts, TModel, Params } from "./defines";
6
6
  interface Cnf {
7
7
  rest: {
@@ -9,7 +9,7 @@ interface Cnf {
9
9
  };
10
10
  }
11
11
  interface Deps {
12
- _: typeof _;
12
+ _: LoDashStatic;
13
13
  mysql: Pick<typeof mysql, "escape">;
14
14
  moment: typeof moment extends (...args: infer A) => infer B ? (...args: A) => B : never;
15
15
  Sequelize: Pick<typeof Sequelize, "where" | "fn" | "col" | "literal" | "Op">;
@@ -1,11 +1,29 @@
1
1
  "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
5
+ }) : (function(o, m, k, k2) {
6
+ if (k2 === undefined) k2 = k;
7
+ o[k2] = m[k];
8
+ }));
9
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
10
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
11
+ }) : function(o, v) {
12
+ o["default"] = v;
13
+ });
14
+ var __importStar = (this && this.__importStar) || function (mod) {
15
+ if (mod && mod.__esModule) return mod;
16
+ var result = {};
17
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
18
+ __setModuleDefault(result, mod);
19
+ return result;
20
+ };
2
21
  Object.defineProperty(exports, "__esModule", { value: true });
3
22
  exports.Utils = void 0;
4
- const _ = require("lodash");
5
- const mysql = require("mysql2");
23
+ const mysql = __importStar(require("mysql2"));
6
24
  function Utils(cnf, deps) {
7
25
  const { rest: { relativeMaxRangeDays: RELATIVE_MAX_RANGE = 100 }, } = cnf;
8
- const { errors, moment, Sequelize } = deps;
26
+ const { _, errors, moment, Sequelize } = deps;
9
27
  /**
10
28
  * 相对多少天的时间
11
29
  * @param Number days 相对多少天
@@ -20,7 +20,7 @@ export declare function Main(cnf: Cnf, deps: Deps): Readonly<{
20
20
  validate: (schema: Schema, data: any) => boolean;
21
21
  compile: (schema: Schema) => ajv.ValidateFunction<unknown>;
22
22
  /** intance of Ajv */
23
- ajv: ajv.default;
23
+ ajv: import("ajv").default;
24
24
  }>;
25
25
  export declare const Deps: string[];
26
26
  export {};
@@ -1,7 +1,26 @@
1
1
  "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
5
+ }) : (function(o, m, k, k2) {
6
+ if (k2 === undefined) k2 = k;
7
+ o[k2] = m[k];
8
+ }));
9
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
10
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
11
+ }) : function(o, v) {
12
+ o["default"] = v;
13
+ });
14
+ var __importStar = (this && this.__importStar) || function (mod) {
15
+ if (mod && mod.__esModule) return mod;
16
+ var result = {};
17
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
18
+ __setModuleDefault(result, mod);
19
+ return result;
20
+ };
2
21
  Object.defineProperty(exports, "__esModule", { value: true });
3
22
  exports.Deps = exports.Main = void 0;
4
- const util = require("util");
23
+ const util = __importStar(require("util"));
5
24
  /**
6
25
  * JSON schema validation module, based on Ajv: https://www.npmjs.com/package/ajv
7
26
  * @param cnf Ajv initialization parameters
@@ -1,7 +1,26 @@
1
1
  "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
5
+ }) : (function(o, m, k, k2) {
6
+ if (k2 === undefined) k2 = k;
7
+ o[k2] = m[k];
8
+ }));
9
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
10
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
11
+ }) : function(o, v) {
12
+ o["default"] = v;
13
+ });
14
+ var __importStar = (this && this.__importStar) || function (mod) {
15
+ if (mod && mod.__esModule) return mod;
16
+ var result = {};
17
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
18
+ __setModuleDefault(result, mod);
19
+ return result;
20
+ };
2
21
  Object.defineProperty(exports, "__esModule", { value: true });
3
22
  exports.Deps = exports.Main = void 0;
4
- const crypto = require("crypto");
23
+ const crypto = __importStar(require("crypto"));
5
24
  /**
6
25
  * API interface encryption signature algorithm module, based on sha256
7
26
  * @returns generator And request Methods
@@ -0,0 +1,14 @@
1
+ import * as TypeORM from "typeorm";
2
+ interface Cnf {
3
+ typeorm: {
4
+ [propName: string]: Parameters<typeof TypeORM.createConnection>[0];
5
+ };
6
+ }
7
+ interface Deps {
8
+ TypeORM: typeof TypeORM;
9
+ }
10
+ export declare function Main(cnf: Cnf, deps: Deps): Promise<{
11
+ [propName: string]: TypeORM.Connection;
12
+ }>;
13
+ export declare const Deps: string[];
14
+ export {};
@@ -0,0 +1,16 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Deps = exports.Main = void 0;
4
+ async function Main(cnf, deps) {
5
+ // 这里之所以要注入 Sequelize 是为了保证项目自身可以灵活选择自己的 Sequelize 版本, 这样改公共模块就会更加稳定, 避免频繁升级
6
+ const { typeorm: dbs } = cnf;
7
+ const { TypeORM } = deps;
8
+ const links = {};
9
+ for await (const k of Object.keys(dbs)) {
10
+ const db = dbs[k];
11
+ links[k] = await TypeORM.createConnection(db);
12
+ }
13
+ return links;
14
+ }
15
+ exports.Main = Main;
16
+ exports.Deps = ["TypeORM"];
package/dist/dm/index.js CHANGED
@@ -1,7 +1,26 @@
1
1
  "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
5
+ }) : (function(o, m, k, k2) {
6
+ if (k2 === undefined) k2 = k;
7
+ o[k2] = m[k];
8
+ }));
9
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
10
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
11
+ }) : function(o, v) {
12
+ o["default"] = v;
13
+ });
14
+ var __importStar = (this && this.__importStar) || function (mod) {
15
+ if (mod && mod.__esModule) return mod;
16
+ var result = {};
17
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
18
+ __setModuleDefault(result, mod);
19
+ return result;
20
+ };
2
21
  Object.defineProperty(exports, "__esModule", { value: true });
3
22
  exports.auto = exports.exec = void 0;
4
- const _ = require("lodash");
23
+ const _ = __importStar(require("lodash"));
5
24
  /**
6
25
  * Initialize a module
7
26
  * @param Main The function is module main function
@@ -22,6 +22,8 @@ export interface Profile {
22
22
  userAgent: string;
23
23
  startedAt: Date;
24
24
  requestId: string;
25
+ /** 自由挂载信息的节点 */
26
+ extra: Record<string, any>;
25
27
  revision?: string;
26
28
  uuid?: string;
27
29
  token?: string;
@@ -1,7 +1,26 @@
1
1
  "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
5
+ }) : (function(o, m, k, k2) {
6
+ if (k2 === undefined) k2 = k;
7
+ o[k2] = m[k];
8
+ }));
9
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
10
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
11
+ }) : function(o, v) {
12
+ o["default"] = v;
13
+ });
14
+ var __importStar = (this && this.__importStar) || function (mod) {
15
+ if (mod && mod.__esModule) return mod;
16
+ var result = {};
17
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
18
+ __setModuleDefault(result, mod);
19
+ return result;
20
+ };
2
21
  Object.defineProperty(exports, "__esModule", { value: true });
3
22
  exports.Main = void 0;
4
- const restify = require("restify");
23
+ const restify = __importStar(require("restify"));
5
24
  const router_1 = require("./router");
6
25
  const utils_1 = require("./utils");
7
26
  function Main(cnf, deps) {
@@ -1,8 +1,27 @@
1
1
  "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
5
+ }) : (function(o, m, k, k2) {
6
+ if (k2 === undefined) k2 = k;
7
+ o[k2] = m[k];
8
+ }));
9
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
10
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
11
+ }) : function(o, v) {
12
+ o["default"] = v;
13
+ });
14
+ var __importStar = (this && this.__importStar) || function (mod) {
15
+ if (mod && mod.__esModule) return mod;
16
+ var result = {};
17
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
18
+ __setModuleDefault(result, mod);
19
+ return result;
20
+ };
2
21
  Object.defineProperty(exports, "__esModule", { value: true });
3
22
  exports.Router = void 0;
4
- const _ = require("lodash");
5
- const errors = require("restify-errors");
23
+ const _ = __importStar(require("lodash"));
24
+ const errors = __importStar(require("restify-errors"));
6
25
  function Router(deps) {
7
26
  const { domain, apisRoute, getSchemaByPath, utils, server, httpCodes = {}, makeProfileHook, } = deps;
8
27
  const { ucwords, makeParams, makeProfile, outputCSV } = utils;
@@ -1,11 +1,30 @@
1
1
  "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
5
+ }) : (function(o, m, k, k2) {
6
+ if (k2 === undefined) k2 = k;
7
+ o[k2] = m[k];
8
+ }));
9
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
10
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
11
+ }) : function(o, v) {
12
+ o["default"] = v;
13
+ });
14
+ var __importStar = (this && this.__importStar) || function (mod) {
15
+ if (mod && mod.__esModule) return mod;
16
+ var result = {};
17
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
18
+ __setModuleDefault(result, mod);
19
+ return result;
20
+ };
2
21
  Object.defineProperty(exports, "__esModule", { value: true });
3
22
  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");
23
+ const os = __importStar(require("os"));
24
+ const fs = __importStar(require("fs"));
25
+ const crypto = __importStar(require("crypto"));
26
+ const _ = __importStar(require("lodash"));
27
+ const xlsx = __importStar(require("xlsx"));
9
28
  const csv_stringify_1 = require("csv-stringify");
10
29
  const str2arr = ["_includes", "dimensions", "metrics", "_attrs"];
11
30
  const enc = encodeURI;
@@ -49,6 +68,7 @@ function Utils(cnf) {
49
68
  userAgent: req.userAgent(),
50
69
  startedAt: new Date(),
51
70
  requestId: req.id(),
71
+ extra: {},
52
72
  };
53
73
  const token = req.headers["x-auth-token"] || req.query.access_token || req.query.accessToken;
54
74
  // token 和签名认证只能二选一
package/dist/index.js CHANGED
@@ -1,15 +1,34 @@
1
1
  "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
5
+ }) : (function(o, m, k, k2) {
6
+ if (k2 === undefined) k2 = k;
7
+ o[k2] = m[k];
8
+ }));
9
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
10
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
11
+ }) : function(o, v) {
12
+ o["default"] = v;
13
+ });
14
+ var __importStar = (this && this.__importStar) || function (mod) {
15
+ if (mod && mod.__esModule) return mod;
16
+ var result = {};
17
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
18
+ __setModuleDefault(result, mod);
19
+ return result;
20
+ };
2
21
  Object.defineProperty(exports, "__esModule", { value: true });
3
22
  exports.Main = exports.basicErrors = exports.Cfg = exports.utils = exports.DM = exports.Errors = exports.Http = void 0;
4
23
  const defaults_1 = require("./defaults");
5
- const DM = require("./dm");
24
+ const DM = __importStar(require("./dm"));
6
25
  const Deps = require("./deps/defines");
7
26
  var http_1 = require("./http");
8
27
  Object.defineProperty(exports, "Http", { enumerable: true, get: function () { return http_1.Main; } });
9
28
  var Errors_1 = require("./Errors");
10
29
  Object.defineProperty(exports, "Errors", { enumerable: true, get: function () { return Errors_1.Errors; } });
11
- exports.DM = require("./dm");
12
- exports.utils = require("./utils");
30
+ exports.DM = __importStar(require("./dm"));
31
+ exports.utils = __importStar(require("./utils"));
13
32
  var cfg_1 = require("./cfg");
14
33
  Object.defineProperty(exports, "Cfg", { enumerable: true, get: function () { return cfg_1.Main; } });
15
34
  exports.basicErrors = defaults_1.defaults.errors;
@@ -1,7 +1,26 @@
1
1
  "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
5
+ }) : (function(o, m, k, k2) {
6
+ if (k2 === undefined) k2 = k;
7
+ o[k2] = m[k];
8
+ }));
9
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
10
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
11
+ }) : function(o, v) {
12
+ o["default"] = v;
13
+ });
14
+ var __importStar = (this && this.__importStar) || function (mod) {
15
+ if (mod && mod.__esModule) return mod;
16
+ var result = {};
17
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
18
+ __setModuleDefault(result, mod);
19
+ return result;
20
+ };
2
21
  Object.defineProperty(exports, "__esModule", { value: true });
3
22
  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");
23
+ const crypto = __importStar(require("crypto"));
5
24
  /** 随机字符串字典 */
6
25
  const RAND_STR_DICT = {
7
26
  normal: "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@domain.js/main",
3
- "version": "0.1.9",
3
+ "version": "0.1.13",
4
4
  "description": "DDD framework",
5
5
  "main": "dist/index.js",
6
6
  "bin": {
@@ -18,25 +18,28 @@
18
18
  "author": "Redstone Zhao",
19
19
  "license": "MIT",
20
20
  "devDependencies": {
21
- "@typescript-eslint/eslint-plugin": "^4.22.0",
22
- "@typescript-eslint/parser": "^4.22.0",
21
+ "@typescript-eslint/eslint-plugin": "^5.11.0",
22
+ "@typescript-eslint/parser": "^5.11.0",
23
23
  "babel-eslint": "^10.1.0",
24
24
  "codecov": "^3.8.3",
25
- "eslint": "^7.11.0",
25
+ "eslint": "^8.8.0",
26
26
  "eslint-config-airbnb": "^18.2.0",
27
+ "eslint-config-alloy": "^4.4.0",
27
28
  "eslint-config-prettier": "^8.3.0",
28
29
  "eslint-plugin-import": "^2.22.1",
29
30
  "eslint-plugin-jsx-a11y": "^6.3.1",
30
31
  "eslint-plugin-prettier": "^3.4.0",
31
32
  "eslint-plugin-react": "^7.21.4",
33
+ "eslint-plugin-simple-import-sort": "^7.0.0",
34
+ "eslint-plugin-unused-imports": "^2.0.0",
32
35
  "husky": "^7.0.0",
33
36
  "jest": "^27.3.1",
34
37
  "lint-staged": "^11.0.0",
35
38
  "prettier": "^2.3.0",
36
39
  "sequelize-json-schema": "^2.1.1",
37
40
  "ts-jest": "^27.0.7",
38
- "ts-node": "^10.4.0",
39
- "typescript": "^4.5.2"
41
+ "ts-node": "^10.5.0",
42
+ "typescript": "^4.5.5"
40
43
  },
41
44
  "prettier": {
42
45
  "printWidth": 100,
package/tsconfig.json CHANGED
@@ -6,7 +6,8 @@
6
6
  "declaration": true,
7
7
  "outDir": "./dist",
8
8
  "strict": true,
9
- "rootDir": "./src/"
9
+ "rootDir": "./src/",
10
+ "esModuleInterop": true
10
11
  },
11
12
  "include": ["./"],
12
13
  "exclude": ["./src/**/*.test.ts", "./src/**/samples/*", "node_modules", "dist"]