@nocobase/database 0.12.0-alpha.2 → 0.12.0-alpha.4
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/database.js
CHANGED
|
@@ -112,14 +112,14 @@ const DialectVersionAccessors = {
|
|
|
112
112
|
if (v.toLowerCase().includes('mariadb')) {
|
|
113
113
|
return '';
|
|
114
114
|
}
|
|
115
|
-
const m = /([\d
|
|
115
|
+
const m = /([\d+.]+)/.exec(v);
|
|
116
116
|
return m[0];
|
|
117
117
|
}
|
|
118
118
|
},
|
|
119
119
|
postgres: {
|
|
120
120
|
sql: 'select version() as version',
|
|
121
121
|
get: v => {
|
|
122
|
-
const m = /([\d
|
|
122
|
+
const m = /([\d+.]+)/.exec(v);
|
|
123
123
|
return _semver().default.minVersion(m[0]).version;
|
|
124
124
|
}
|
|
125
125
|
}
|
|
@@ -236,16 +236,6 @@ class Database extends _events().EventEmitter {
|
|
|
236
236
|
queryInterface: this.sequelize.getQueryInterface()
|
|
237
237
|
}, migratorOptions.context);
|
|
238
238
|
this.migrations = new _migration.Migrations(context);
|
|
239
|
-
this.migrator = new (_umzug().Umzug)({
|
|
240
|
-
logger: migratorOptions.logger || console,
|
|
241
|
-
migrations: this.migrations.callback(),
|
|
242
|
-
context,
|
|
243
|
-
storage: new (_umzug().SequelizeStorage)(_objectSpread(_objectSpread({
|
|
244
|
-
modelName: `${this.options.tablePrefix || ''}migrations`
|
|
245
|
-
}, migratorOptions.storage), {}, {
|
|
246
|
-
sequelize: this.sequelize
|
|
247
|
-
}))
|
|
248
|
-
});
|
|
249
239
|
this.sequelize.beforeDefine((model, opts) => {
|
|
250
240
|
if (this.options.tablePrefix) {
|
|
251
241
|
opts.tableName = `${this.options.tablePrefix}${opts.tableName || opts.modelName || opts.name.plural}`;
|
|
@@ -259,9 +249,20 @@ class Database extends _events().EventEmitter {
|
|
|
259
249
|
duplicator: 'required',
|
|
260
250
|
fields: [{
|
|
261
251
|
type: 'string',
|
|
262
|
-
name: 'name'
|
|
252
|
+
name: 'name',
|
|
253
|
+
primaryKey: true
|
|
263
254
|
}]
|
|
264
255
|
});
|
|
256
|
+
this.migrator = new (_umzug().Umzug)({
|
|
257
|
+
logger: migratorOptions.logger || console,
|
|
258
|
+
migrations: this.migrations.callback(),
|
|
259
|
+
context,
|
|
260
|
+
storage: new (_umzug().SequelizeStorage)(_objectSpread(_objectSpread({
|
|
261
|
+
modelName: `${this.options.tablePrefix || ''}migrations`
|
|
262
|
+
}, migratorOptions.storage), {}, {
|
|
263
|
+
sequelize: this.sequelize
|
|
264
|
+
}))
|
|
265
|
+
});
|
|
265
266
|
this.initListener();
|
|
266
267
|
(0, _utils2.patchSequelizeQueryInterface)(this);
|
|
267
268
|
}
|
|
@@ -670,7 +671,7 @@ class Database extends _events().EventEmitter {
|
|
|
670
671
|
const _options$retry = options.retry,
|
|
671
672
|
retry = _options$retry === void 0 ? 10 : _options$retry,
|
|
672
673
|
others = _objectWithoutProperties(options, _excluded2);
|
|
673
|
-
const delay = ms => new Promise(
|
|
674
|
+
const delay = ms => new Promise(resolve => setTimeout(resolve, ms));
|
|
674
675
|
let count = 1;
|
|
675
676
|
const authenticate = /*#__PURE__*/function () {
|
|
676
677
|
var _ref6 = _asyncToGenerator(function* () {
|
|
@@ -11,6 +11,13 @@ function _sequelize() {
|
|
|
11
11
|
};
|
|
12
12
|
return data;
|
|
13
13
|
}
|
|
14
|
+
function _lodash() {
|
|
15
|
+
const data = _interopRequireDefault(require("lodash"));
|
|
16
|
+
_lodash = function _lodash() {
|
|
17
|
+
return data;
|
|
18
|
+
};
|
|
19
|
+
return data;
|
|
20
|
+
}
|
|
14
21
|
var _targetCollectionDecorator = _interopRequireDefault(require("../decorators/target-collection-decorator"));
|
|
15
22
|
var _updateAssociations = require("../update-associations");
|
|
16
23
|
var _updateGuard = require("../update-guard");
|
|
@@ -123,8 +130,7 @@ class MultipleRelationRepository extends _relationRepository.RelationRepository
|
|
|
123
130
|
const transaction = yield _this6.getTransaction(options);
|
|
124
131
|
const guard = _updateGuard.UpdateGuard.fromOptions(_this6.targetModel, options);
|
|
125
132
|
const values = guard.sanitize(options.values);
|
|
126
|
-
const
|
|
127
|
-
const instances = yield _this6.find(_objectSpread(_objectSpread({}, queryOptions), {}, {
|
|
133
|
+
const instances = yield _this6.find(_objectSpread(_objectSpread({}, _lodash().default.omit(options, ['values'])), {}, {
|
|
128
134
|
transaction
|
|
129
135
|
}));
|
|
130
136
|
var _iterator = _createForOfIteratorHelper(instances),
|
package/package.json
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nocobase/database",
|
|
3
|
-
"version": "0.12.0-alpha.
|
|
3
|
+
"version": "0.12.0-alpha.4",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "./lib/index.js",
|
|
6
6
|
"types": "./lib/index.d.ts",
|
|
7
7
|
"license": "Apache-2.0",
|
|
8
8
|
"dependencies": {
|
|
9
|
-
"@nocobase/logger": "0.12.0-alpha.
|
|
10
|
-
"@nocobase/utils": "0.12.0-alpha.
|
|
9
|
+
"@nocobase/logger": "0.12.0-alpha.4",
|
|
10
|
+
"@nocobase/utils": "0.12.0-alpha.4",
|
|
11
11
|
"async-mutex": "^0.3.2",
|
|
12
12
|
"cron-parser": "4.4.0",
|
|
13
13
|
"dayjs": "^1.11.8",
|
|
@@ -29,5 +29,5 @@
|
|
|
29
29
|
"url": "git+https://github.com/nocobase/nocobase.git",
|
|
30
30
|
"directory": "packages/database"
|
|
31
31
|
},
|
|
32
|
-
"gitHead": "
|
|
32
|
+
"gitHead": "215dc3b2437c501ca903b56cc378ab5e81c8a11c"
|
|
33
33
|
}
|