oak-db 1.0.5 → 1.0.6

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.
@@ -56,10 +56,12 @@ var MysqlStore = /** @class */ (function (_super) {
56
56
  }
57
57
  else {
58
58
  (0, assert_1.default)(typeof rel === 'string');
59
- if (!r[attrHead]) {
60
- r[attrHead] = {};
59
+ if (typeof r["".concat(attrHead, "Id")] === 'string') {
60
+ if (!r[attrHead]) {
61
+ r[attrHead] = {};
62
+ }
63
+ resolveAttribute(rel, r[attrHead], attrTail, value);
61
64
  }
62
- resolveAttribute(rel, r[attrHead], attrTail, value);
63
65
  }
64
66
  }
65
67
  else if (attributes[attr]) {
@@ -704,15 +704,17 @@ var SqlTranslator = /** @class */ (function () {
704
704
  };
705
705
  SqlTranslator.prototype.translateRemove = function (entity, operation, option) {
706
706
  var filter = operation.filter, sorter = operation.sorter, indexFrom = operation.indexFrom, count = operation.count;
707
+ (0, assert_1.default)(!sorter, '当前remove不支持sorter行为');
707
708
  var _a = this.analyzeJoin(entity, { filter: filter, sorter: sorter }), aliasDict = _a.aliasDict, filterRefAlias = _a.filterRefAlias, extraWhere = _a.extraWhere, fromText = _a.from, currentNumber = _a.currentNumber;
708
709
  var alias = aliasDict['./'];
709
710
  var filterText = this.translateFilter(entity, operation, aliasDict, filterRefAlias, currentNumber, extraWhere).stmt;
710
- var sorterText = sorter && sorter.length > 0 ? this.translateSorter(entity, sorter, aliasDict) : undefined;
711
- return this.populateRemoveStmt(alias, fromText, aliasDict, filterText, sorterText, indexFrom, count, option);
711
+ // const sorterText = sorter && sorter.length > 0 ? this.translateSorter(entity, sorter, aliasDict) : undefined;
712
+ return this.populateRemoveStmt(alias, fromText, aliasDict, filterText, /* sorterText */ undefined, indexFrom, count, option);
712
713
  };
713
714
  SqlTranslator.prototype.translateUpdate = function (entity, operation, option) {
714
715
  var attributes = this.schema[entity].attributes;
715
716
  var filter = operation.filter, sorter = operation.sorter, indexFrom = operation.indexFrom, count = operation.count, data = operation.data;
717
+ (0, assert_1.default)(!sorter, '当前update不支持sorter行为');
716
718
  var _a = this.analyzeJoin(entity, { filter: filter, sorter: sorter }), aliasDict = _a.aliasDict, filterRefAlias = _a.filterRefAlias, extraWhere = _a.extraWhere, fromText = _a.from, currentNumber = _a.currentNumber;
717
719
  var alias = aliasDict['./'];
718
720
  var updateText = '';
@@ -725,8 +727,8 @@ var SqlTranslator = /** @class */ (function () {
725
727
  updateText += "`".concat(alias, "`.`").concat(attr, "` = ").concat(value);
726
728
  }
727
729
  var filterText = this.translateFilter(entity, operation, aliasDict, filterRefAlias, currentNumber, extraWhere).stmt;
728
- var sorterText = sorter && this.translateSorter(entity, sorter, aliasDict);
729
- return this.populateUpdateStmt(updateText, fromText, aliasDict, filterText, sorterText, indexFrom, count, option);
730
+ // const sorterText = sorter && this.translateSorter(entity, sorter, aliasDict);
731
+ return this.populateUpdateStmt(updateText, fromText, aliasDict, filterText, /* sorterText */ undefined, indexFrom, count, option);
730
732
  };
731
733
  SqlTranslator.prototype.translateDestroyEntity = function (entity, truncate) {
732
734
  var schema = this.schema;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "oak-db",
3
- "version": "1.0.5",
3
+ "version": "1.0.6",
4
4
  "description": "oak-db",
5
5
  "main": "lib/index",
6
6
  "author": {
@@ -19,7 +19,7 @@
19
19
  "luxon": "^2.4.0",
20
20
  "mysql": "^2.18.1",
21
21
  "mysql2": "^2.3.3",
22
- "oak-domain": "^1.1.12",
22
+ "oak-domain": "^1.1.13",
23
23
  "uuid": "^8.3.2"
24
24
  },
25
25
  "license": "ISC",
@@ -30,7 +30,7 @@
30
30
  "@types/node": "^17.0.42",
31
31
  "@types/uuid": "^8.3.4",
32
32
  "mocha": "^10.0.0",
33
- "oak-general-business": "^1.0.13",
33
+ "oak-general-business": "^1.0.14",
34
34
  "ts-node": "~10.9.1",
35
35
  "tslib": "^2.4.0",
36
36
  "typescript": "~4.7.4"