@nocobase/database 1.8.19 → 1.8.21

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.
@@ -12,4 +12,5 @@ export declare class NumberInterface extends BaseInterface {
12
12
  toValue(value: any): Promise<any>;
13
13
  parseValue(value: any): any;
14
14
  validate(value: any): boolean;
15
+ toString(value: number, ctx?: any): string | number;
15
16
  }
@@ -7,9 +7,11 @@
7
7
  * For more information, please refer to: https://www.nocobase.com/agreement.
8
8
  */
9
9
 
10
+ var __create = Object.create;
10
11
  var __defProp = Object.defineProperty;
11
12
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
12
13
  var __getOwnPropNames = Object.getOwnPropertyNames;
14
+ var __getProtoOf = Object.getPrototypeOf;
13
15
  var __hasOwnProp = Object.prototype.hasOwnProperty;
14
16
  var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
15
17
  var __export = (target, all) => {
@@ -24,12 +26,21 @@ var __copyProps = (to, from, except, desc) => {
24
26
  }
25
27
  return to;
26
28
  };
29
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
30
+ // If the importer is in node compatibility mode or this is not an ESM
31
+ // file that has been converted to a CommonJS file using a Babel-
32
+ // compatible transform (i.e. "__esModule" has not been set), then set
33
+ // "default" to the CommonJS "module.exports" for node compatibility.
34
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
35
+ mod
36
+ ));
27
37
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
28
38
  var number_interface_exports = {};
29
39
  __export(number_interface_exports, {
30
40
  NumberInterface: () => NumberInterface
31
41
  });
32
42
  module.exports = __toCommonJS(number_interface_exports);
43
+ var import_lodash = __toESM(require("lodash"));
33
44
  var import_base_interface = require("./base-interface");
34
45
  const _NumberInterface = class _NumberInterface extends import_base_interface.BaseInterface {
35
46
  sanitizeValue(value) {
@@ -63,6 +74,23 @@ const _NumberInterface = class _NumberInterface extends import_base_interface.Ba
63
74
  validate(value) {
64
75
  return !isNaN(value);
65
76
  }
77
+ toString(value, ctx) {
78
+ var _a, _b, _c, _d;
79
+ value = super.toString(value, ctx);
80
+ const step = (_c = (_b = (_a = this.options) == null ? void 0 : _a.uiSchema) == null ? void 0 : _b["x-component-props"]) == null ? void 0 : _c.step;
81
+ if (value != null && !import_lodash.default.isUndefined(step)) {
82
+ const s = step.toString();
83
+ const precision = ((_d = s.split(".")[1]) == null ? void 0 : _d.length) || 0;
84
+ const num = Number(value);
85
+ if (precision > 0) {
86
+ const factor = Math.pow(10, precision);
87
+ const rounded = Math.round(num * factor) / factor;
88
+ return rounded.toFixed(precision);
89
+ }
90
+ return num.toFixed(0);
91
+ }
92
+ return value;
93
+ }
66
94
  };
67
95
  __name(_NumberInterface, "NumberInterface");
68
96
  let NumberInterface = _NumberInterface;
package/lib/repository.js CHANGED
@@ -345,6 +345,9 @@ const _Repository = class _Repository {
345
345
  subQuery: false,
346
346
  ...this.buildQueryOptions(options)
347
347
  };
348
+ if (!import_lodash2.default.isUndefined(opts.limit)) {
349
+ opts.limit = Number(opts.limit);
350
+ }
348
351
  let rows;
349
352
  if (opts.include && opts.include.length > 0) {
350
353
  const eagerLoadingTree = import_eager_loading_tree.EagerLoadingTree.buildFromSequelizeOptions({
package/package.json CHANGED
@@ -1,13 +1,13 @@
1
1
  {
2
2
  "name": "@nocobase/database",
3
- "version": "1.8.19",
3
+ "version": "1.8.21",
4
4
  "description": "",
5
5
  "main": "./lib/index.js",
6
6
  "types": "./lib/index.d.ts",
7
7
  "license": "AGPL-3.0",
8
8
  "dependencies": {
9
- "@nocobase/logger": "1.8.19",
10
- "@nocobase/utils": "1.8.19",
9
+ "@nocobase/logger": "1.8.21",
10
+ "@nocobase/utils": "1.8.21",
11
11
  "async-mutex": "^0.3.2",
12
12
  "chalk": "^4.1.1",
13
13
  "cron-parser": "4.4.0",
@@ -38,5 +38,5 @@
38
38
  "url": "git+https://github.com/nocobase/nocobase.git",
39
39
  "directory": "packages/database"
40
40
  },
41
- "gitHead": "0366aabbedcb1a902bc748bfaf144cf0346e5da7"
41
+ "gitHead": "13c0e6083154a2161dde2d6a950f5186ced27aa4"
42
42
  }