@nocobase/database 1.6.0-alpha.3 → 1.6.0-alpha.30
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/lib/{relation-repository → belongs-to-array}/belongs-to-array-repository.d.ts +3 -1
- package/lib/{relation-repository → belongs-to-array}/belongs-to-array-repository.js +26 -3
- package/lib/collection.d.ts +4 -0
- package/lib/database.js +1 -0
- package/lib/dialects/mysql-dialect.d.ts +1 -0
- package/lib/dialects/mysql-dialect.js +5 -0
- package/lib/fields/belongs-to-many-field.js +4 -1
- package/lib/fields/unix-timestamp-field.js +7 -4
- package/lib/filter-match.js +3 -1
- package/lib/index.d.ts +1 -1
- package/lib/index.js +2 -2
- package/lib/inherited-collection.js +3 -0
- package/lib/interfaces/datetime-interface.d.ts +23 -0
- package/lib/interfaces/datetime-interface.js +28 -4
- package/lib/interfaces/datetime-no-tz-interface.d.ts +8 -0
- package/lib/interfaces/datetime-no-tz-interface.js +10 -3
- package/lib/interfaces/to-many-interface.js +12 -2
- package/lib/operators/boolean.js +19 -6
- package/lib/operators/string.js +64 -36
- package/lib/relation-repository/hasmany-repository.d.ts +2 -1
- package/lib/relation-repository/multiple-relation-repository.d.ts +6 -10
- package/lib/relation-repository/multiple-relation-repository.js +7 -0
- package/lib/relation-repository/relation-repository.d.ts +5 -1
- package/lib/relation-repository/relation-repository.js +35 -1
- package/lib/relation-repository/single-relation-repository.d.ts +3 -10
- package/lib/relation-repository/single-relation-repository.js +3 -1
- package/lib/relation-repository/types.d.ts +77 -6
- package/lib/repository.d.ts +6 -6
- package/lib/repository.js +18 -48
- package/lib/update-associations.d.ts +5 -3
- package/lib/update-associations.js +15 -23
- package/lib/utils/filter-utils.d.ts +13 -0
- package/lib/utils/filter-utils.js +86 -0
- package/lib/utils.d.ts +3 -0
- package/lib/utils.js +18 -0
- package/package.json +4 -4
package/lib/utils.d.ts
CHANGED
|
@@ -13,3 +13,6 @@ export declare function getTableName(collectionName: string, options: any): any;
|
|
|
13
13
|
export declare function snakeCase(name: string): any;
|
|
14
14
|
export declare function patchSequelizeQueryInterface(db: Database): void;
|
|
15
15
|
export declare function percent2float(value: string): number;
|
|
16
|
+
export declare function isUndefinedOrNull(value: any): boolean;
|
|
17
|
+
export declare function isStringOrNumber(value: any): boolean;
|
|
18
|
+
export declare function getKeysByPrefix(keys: string[], prefix: string): string[];
|
package/lib/utils.js
CHANGED
|
@@ -38,7 +38,10 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
38
38
|
var utils_exports = {};
|
|
39
39
|
__export(utils_exports, {
|
|
40
40
|
checkIdentifier: () => checkIdentifier,
|
|
41
|
+
getKeysByPrefix: () => getKeysByPrefix,
|
|
41
42
|
getTableName: () => getTableName,
|
|
43
|
+
isStringOrNumber: () => isStringOrNumber,
|
|
44
|
+
isUndefinedOrNull: () => isUndefinedOrNull,
|
|
42
45
|
md5: () => md5,
|
|
43
46
|
patchSequelizeQueryInterface: () => patchSequelizeQueryInterface,
|
|
44
47
|
percent2float: () => percent2float,
|
|
@@ -125,10 +128,25 @@ function percent2float(value) {
|
|
|
125
128
|
return parseFloat(value) * v / (100 * v);
|
|
126
129
|
}
|
|
127
130
|
__name(percent2float, "percent2float");
|
|
131
|
+
function isUndefinedOrNull(value) {
|
|
132
|
+
return typeof value === "undefined" || value === null;
|
|
133
|
+
}
|
|
134
|
+
__name(isUndefinedOrNull, "isUndefinedOrNull");
|
|
135
|
+
function isStringOrNumber(value) {
|
|
136
|
+
return typeof value === "string" || typeof value === "number";
|
|
137
|
+
}
|
|
138
|
+
__name(isStringOrNumber, "isStringOrNumber");
|
|
139
|
+
function getKeysByPrefix(keys, prefix) {
|
|
140
|
+
return keys.filter((key) => key.startsWith(`${prefix}.`)).map((key) => key.substring(prefix.length + 1));
|
|
141
|
+
}
|
|
142
|
+
__name(getKeysByPrefix, "getKeysByPrefix");
|
|
128
143
|
// Annotate the CommonJS export names for ESM import in node:
|
|
129
144
|
0 && (module.exports = {
|
|
130
145
|
checkIdentifier,
|
|
146
|
+
getKeysByPrefix,
|
|
131
147
|
getTableName,
|
|
148
|
+
isStringOrNumber,
|
|
149
|
+
isUndefinedOrNull,
|
|
132
150
|
md5,
|
|
133
151
|
patchSequelizeQueryInterface,
|
|
134
152
|
percent2float,
|
package/package.json
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nocobase/database",
|
|
3
|
-
"version": "1.6.0-alpha.
|
|
3
|
+
"version": "1.6.0-alpha.30",
|
|
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.6.0-alpha.
|
|
10
|
-
"@nocobase/utils": "1.6.0-alpha.
|
|
9
|
+
"@nocobase/logger": "1.6.0-alpha.30",
|
|
10
|
+
"@nocobase/utils": "1.6.0-alpha.30",
|
|
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": "
|
|
41
|
+
"gitHead": "4d092cae372fada3df9b57c55705ea3b7dfa6786"
|
|
42
42
|
}
|