@domain.js/main 0.3.10 → 0.3.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/dist/cfg/index.js CHANGED
@@ -6,6 +6,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.Main = void 0;
7
7
  const ajv_1 = __importDefault(require("ajv"));
8
8
  const ajv_formats_1 = __importDefault(require("ajv-formats"));
9
+ const ajv_keywords_1 = __importDefault(require("ajv-keywords"));
9
10
  const lodash_1 = __importDefault(require("lodash"));
10
11
  function Main(object, schema) {
11
12
  if (typeof schema !== "object")
@@ -13,6 +14,7 @@ function Main(object, schema) {
13
14
  const FIELDS = new Set(Object.keys(schema.properties));
14
15
  const ajv = new ajv_1.default({ allowUnionTypes: true, coerceTypes: true, useDefaults: true });
15
16
  (0, ajv_formats_1.default)(ajv);
17
+ (0, ajv_keywords_1.default)(ajv);
16
18
  const validate = ajv.compile(schema);
17
19
  const obj = lodash_1.default.pick(object, [...FIELDS]);
18
20
  if (!validate(obj)) {
package/dist/cli/index.js CHANGED
@@ -57,10 +57,10 @@ const makeDefineFile = async (modules, targetFile, isTS) => {
57
57
  const name = path.relative(dirname, x);
58
58
  const variable = filePath2Var(name);
59
59
  if (isTS) {
60
- content.push(`import * as ${variable} from "./${name}"`);
60
+ content.push(`import * as ${variable} from "./${name}";`);
61
61
  }
62
62
  else {
63
- content.push(`const ${variable} = require("./${name}")`);
63
+ content.push(`const ${variable} = require("./${name}");`);
64
64
  }
65
65
  _exports.push(`"${file2Module(name).replace(/[/]/, ".")}": ${variable},`);
66
66
  }
@@ -73,7 +73,7 @@ const makeDefineFile = async (modules, targetFile, isTS) => {
73
73
  content.push("module.exports = {");
74
74
  }
75
75
  for (const x of _exports)
76
- content.push(x);
76
+ content.push(` ${x}`);
77
77
  content.push("};");
78
78
  fs.writeFileSync(targetFile, content.join("\n"));
79
79
  await codeStyleFormat(targetFile);
@@ -1,5 +1,6 @@
1
1
  import * as ajv from "ajv";
2
2
  import * as ajvFormats from "ajv-formats";
3
+ import ajvKeywords from "ajv-keywords";
3
4
  import * as async from "async";
4
5
  import * as axios from "axios";
5
6
  import * as cronParser from "cron-parser";
@@ -35,6 +36,7 @@ export interface Defaults {
35
36
  * @link https://www.npmjs.com/package/ajv-formats
36
37
  */
37
38
  ajvFormats: typeof ajvFormats;
39
+ ajvKeywords: typeof ajvKeywords;
38
40
  /**
39
41
  * Async is a utility module which provides straight-forward
40
42
  * powerful functions for working with asynchronous JavaScript.
package/dist/defaults.js CHANGED
@@ -25,6 +25,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
25
25
  exports.defaults = void 0;
26
26
  const ajv = __importStar(require("ajv"));
27
27
  const ajvFormats = __importStar(require("ajv-formats"));
28
+ const ajv_keywords_1 = __importDefault(require("ajv-keywords"));
28
29
  const async = __importStar(require("async"));
29
30
  const axios = __importStar(require("axios"));
30
31
  const cronParser = __importStar(require("cron-parser"));
@@ -43,6 +44,7 @@ exports.defaults = {
43
44
  uuid,
44
45
  ajv,
45
46
  ajvFormats,
47
+ ajvKeywords: ajv_keywords_1.default,
46
48
  async,
47
49
  axios,
48
50
  cronParser,
@@ -1,5 +1,6 @@
1
1
  import * as ajv from "ajv";
2
2
  import addFormats from "ajv-formats";
3
+ import ajvKeywords from "ajv-keywords";
3
4
  interface Cnf {
4
5
  schema?: ConstructorParameters<typeof ajv.default>[0];
5
6
  }
@@ -8,6 +9,7 @@ interface Deps {
8
9
  default: typeof ajv.default;
9
10
  };
10
11
  ajvFormats: typeof addFormats;
12
+ ajvKeywords: typeof ajvKeywords;
11
13
  }
12
14
  declare type Schema = ajv.Schema;
13
15
  /**
@@ -27,9 +27,10 @@ const util = __importStar(require("util"));
27
27
  * @returns auto, validate, complie, ajv
28
28
  */
29
29
  function Main(cnf, deps) {
30
- const { ajv: { default: Ajv }, ajvFormats, } = deps;
30
+ const { ajv: { default: Ajv }, ajvFormats, ajvKeywords, } = deps;
31
31
  const ajv = new Ajv(cnf.schema || {});
32
32
  ajvFormats(ajv);
33
+ ajvKeywords(ajv);
33
34
  /**
34
35
  * Ajv complie function
35
36
  * @param schema Definition of data format, Ajv specification
@@ -79,4 +80,4 @@ function Main(cnf, deps) {
79
80
  });
80
81
  }
81
82
  exports.Main = Main;
82
- exports.Deps = ["ajv", "ajvFormats"];
83
+ exports.Deps = ["ajv", "ajvFormats", "ajvKeywords"];
@@ -83,5 +83,7 @@ export declare class ModelBase<Attrs extends {} = any, Attrs4Create extends {} =
83
83
  };
84
84
  /** 联合唯一列名称集合,用来自动恢复软删除的资源 */
85
85
  static unique?: string[];
86
+ /** cache 是否开启 */
87
+ static cache: boolean;
86
88
  }
87
89
  export {};
@@ -61,3 +61,5 @@ ModelBase.sort = {
61
61
  defaultDirection: "DESC",
62
62
  allow: ["id"],
63
63
  };
64
+ /** cache 是否开启 */
65
+ ModelBase.cache = true;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@domain.js/main",
3
- "version": "0.3.10",
3
+ "version": "0.3.13",
4
4
  "description": "DDD framework",
5
5
  "main": "dist/index.js",
6
6
  "bin": {
@@ -22,7 +22,6 @@
22
22
  "@typescript-eslint/parser": "^5.11.0",
23
23
  "babel-eslint": "^10.1.0",
24
24
  "codecov": "^3.8.3",
25
- "eslint": "^8.8.0",
26
25
  "eslint-config-airbnb": "^18.2.0",
27
26
  "eslint-config-alloy": "^4.4.0",
28
27
  "eslint-config-prettier": "^8.3.0",
@@ -32,6 +31,7 @@
32
31
  "eslint-plugin-react": "^7.21.4",
33
32
  "eslint-plugin-simple-import-sort": "^7.0.0",
34
33
  "eslint-plugin-unused-imports": "^2.0.0",
34
+ "eslint": "^8.8.0",
35
35
  "husky": "^7.0.0",
36
36
  "jest": "^27.3.1",
37
37
  "lint-staged": "^11.0.0",
@@ -58,12 +58,13 @@
58
58
  "@types/jest": "^27.0.3",
59
59
  "@types/lodash": "^4.14.177",
60
60
  "@types/lru-cache": "^5.1.1",
61
- "@types/restify": "^8.5.4",
62
61
  "@types/restify-errors": "^4.3.4",
62
+ "@types/restify": "^8.5.4",
63
63
  "@types/uuid": "^8.3.3",
64
64
  "@types/validator": "^13.7.0",
65
65
  "ajv": "^8.8.1",
66
66
  "ajv-formats": "^2.1.1",
67
+ "ajv-keywords": "^5.1.0",
67
68
  "async": "^3.2.2",
68
69
  "axios": "^0.24.0",
69
70
  "cron-parser": "^4.1.0",