@e-mc/core 0.0.4 → 0.2.0

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.
Files changed (2) hide show
  1. package/index.js +10 -20
  2. package/package.json +3 -3
package/index.js CHANGED
@@ -1084,27 +1084,17 @@ class ClientDb extends Client {
1084
1084
  return ClientDb.storeResult(this.moduleName + '_' + source, uuidKey || credential, queryString, result, options);
1085
1085
  }
1086
1086
  applyState(items, value, as) {
1087
- if (!Array.isArray(items)) {
1088
- items = [items];
1089
- }
1090
- for (let i = 0, length = items.length; i < length; ++i) {
1091
- const item = items[i];
1092
- switch (value) {
1093
- case 8 /* DB_TRANSACTION.TERMINATE */:
1094
- switch (item.transactionState) {
1095
- case 4 /* DB_TRANSACTION.COMMIT */:
1096
- case 32 /* DB_TRANSACTION.FAIL */:
1097
- item.transactionState |= value;
1098
- break;
1099
- }
1100
- continue;
1101
- case 16 /* DB_TRANSACTION.ABORT */:
1102
- if (!item.transactionState) {
1103
- item.transactionState = value;
1104
- }
1105
- continue;
1087
+ for (const item of Array.isArray(items) ? items : [items]) {
1088
+ if ((0, types_1.hasBit)(value, 8 /* DB_TRANSACTION.TERMINATE */)) {
1089
+ const state = item.transactionState || (item.transactionState = 0);
1090
+ if ((0, types_1.hasBit)(state, 4 /* DB_TRANSACTION.COMMIT */) || (0, types_1.hasBit)(state, 32 /* DB_TRANSACTION.FAIL */)) {
1091
+ item.transactionState |= value;
1092
+ }
1093
+ }
1094
+ else if ((0, types_1.hasBit)(value, 16 /* DB_TRANSACTION.ABORT */)) {
1095
+ item.transactionState || (item.transactionState = value);
1106
1096
  }
1107
- if (as) {
1097
+ else if (as) {
1108
1098
  item.transactionState = value;
1109
1099
  }
1110
1100
  else {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@e-mc/core",
3
- "version": "0.0.4",
3
+ "version": "0.2.0",
4
4
  "description": "Core modules for E-mc.",
5
5
  "main": "index.js",
6
6
  "types": "index.d.ts",
@@ -20,8 +20,8 @@
20
20
  "license": "BSD 3-Clause",
21
21
  "homepage": "https://github.com/anpham6/e-mc#readme",
22
22
  "dependencies": {
23
- "@e-mc/module": "0.0.4",
24
- "@e-mc/types": "0.0.4",
23
+ "@e-mc/module": "0.2.0",
24
+ "@e-mc/types": "0.2.0",
25
25
  "picomatch": "^2.3.1"
26
26
  }
27
27
  }