@nocobase/database 1.4.0-alpha.20241025010959 → 1.4.0-alpha.20241027230531
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/collection.d.ts +2 -0
- package/lib/collection.js +9 -1
- package/package.json +4 -4
package/lib/collection.d.ts
CHANGED
|
@@ -132,6 +132,8 @@ export declare class Collection<TModelAttributes extends {} = any, TCreationAttr
|
|
|
132
132
|
tableNameAsString(options?: {
|
|
133
133
|
ignorePublicSchema: boolean;
|
|
134
134
|
}): any;
|
|
135
|
+
getRealTableName(quoted?: boolean): any;
|
|
136
|
+
getRealFieldName(name: string, quoted?: boolean): string;
|
|
135
137
|
getTableNameWithSchemaAsString(): string;
|
|
136
138
|
quotedTableName(): any;
|
|
137
139
|
collectionSchema(): string;
|
package/lib/collection.js
CHANGED
|
@@ -51,11 +51,11 @@ module.exports = __toCommonJS(collection_exports);
|
|
|
51
51
|
var import_deepmerge = __toESM(require("deepmerge"));
|
|
52
52
|
var import_events = require("events");
|
|
53
53
|
var import_lodash = __toESM(require("lodash"));
|
|
54
|
+
var import_safe_json_stringify = __toESM(require("safe-json-stringify"));
|
|
54
55
|
var import_sequelize = require("sequelize");
|
|
55
56
|
var import_model = require("./model");
|
|
56
57
|
var import_repository = require("./repository");
|
|
57
58
|
var import_utils = require("./utils");
|
|
58
|
-
var import_safe_json_stringify = __toESM(require("safe-json-stringify"));
|
|
59
59
|
function EnsureAtomicity(target, propertyKey, descriptor) {
|
|
60
60
|
const originalMethod = descriptor.value;
|
|
61
61
|
descriptor.value = function(...args) {
|
|
@@ -636,6 +636,14 @@ const _Collection = class _Collection extends import_events.EventEmitter {
|
|
|
636
636
|
}
|
|
637
637
|
return `${schema}.${tableName}`;
|
|
638
638
|
}
|
|
639
|
+
getRealTableName(quoted = false) {
|
|
640
|
+
const realname = this.tableNameAsString();
|
|
641
|
+
return !quoted ? realname : this.db.sequelize.getQueryInterface().quoteIdentifiers(realname);
|
|
642
|
+
}
|
|
643
|
+
getRealFieldName(name, quoted = false) {
|
|
644
|
+
const realname = this.model.getAttributes()[name].field;
|
|
645
|
+
return !quoted ? name : this.db.sequelize.getQueryInterface().quoteIdentifier(realname);
|
|
646
|
+
}
|
|
639
647
|
getTableNameWithSchemaAsString() {
|
|
640
648
|
const tableName = this.model.tableName;
|
|
641
649
|
if (this.collectionSchema() && this.db.inDialect("postgres")) {
|
package/package.json
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nocobase/database",
|
|
3
|
-
"version": "1.4.0-alpha.
|
|
3
|
+
"version": "1.4.0-alpha.20241027230531",
|
|
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.4.0-alpha.
|
|
10
|
-
"@nocobase/utils": "1.4.0-alpha.
|
|
9
|
+
"@nocobase/logger": "1.4.0-alpha.20241027230531",
|
|
10
|
+
"@nocobase/utils": "1.4.0-alpha.20241027230531",
|
|
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": "6f363bf299af23580d68c8b0659e4d31d70f4687"
|
|
42
42
|
}
|