@abtnode/models 1.16.11-next-61882496 → 1.16.11-next-b5795b3a

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/migrate.js CHANGED
@@ -18,6 +18,7 @@ const models_1 = require("./models");
18
18
  const util_1 = require("./util");
19
19
  const logger = (0, logger_1.default)('@abtnode/models:migration');
20
20
  const MIGRATION_SCRIPT_EXTENSION = process.env.MIGRATION_SCRIPT_EXTENSION || 'js';
21
+ // eslint-disable-next-line require-await
21
22
  async function doSchemaMigration(dbFile, group) {
22
23
  const sequelize = (0, models_1.createSequelize)(dbFile);
23
24
  if (['server', 'blocklet', 'service', 'certificate-manager', 'connect'].includes(group) === false) {
@@ -8,6 +8,7 @@ const events_1 = __importDefault(require("events"));
8
8
  const sequelize_1 = require("sequelize");
9
9
  const lodash_clonedeep_1 = __importDefault(require("lodash.clonedeep"));
10
10
  const util_1 = require("../util");
11
+ // eslint-disable-next-line import/prefer-default-export
11
12
  class BaseState extends events_1.default {
12
13
  constructor(model, config = {}) {
13
14
  super();
@@ -23,7 +24,7 @@ class BaseState extends events_1.default {
23
24
  }
24
25
  });
25
26
  }
26
- async find(condition = {}, selection = {}, sort = {}) {
27
+ find(condition = {}, selection = {}, sort = {}) {
27
28
  const params = (0, util_1.formatParams)({
28
29
  attributes: (0, util_1.formatSelection)(selection),
29
30
  order: (0, util_1.formatOrder)(sort),
@@ -32,7 +33,7 @@ class BaseState extends events_1.default {
32
33
  });
33
34
  return this.model.findAll(params).then((x) => x.map((y) => y.toJSON()));
34
35
  }
35
- async findOne(condition = {}, selection = {}, sort = {}) {
36
+ findOne(condition = {}, selection = {}, sort = {}) {
36
37
  const params = (0, util_1.formatParams)({
37
38
  attributes: (0, util_1.formatSelection)(selection),
38
39
  order: (0, util_1.formatOrder)(sort),
@@ -40,7 +41,7 @@ class BaseState extends events_1.default {
40
41
  });
41
42
  return this.model.findOne(params).then((x) => x?.toJSON());
42
43
  }
43
- async count(condition = {}) {
44
+ count(condition = {}) {
44
45
  return this.model.count({ ...(0, util_1.formatConditions)(condition) });
45
46
  }
46
47
  async insert(doc) {
@@ -65,7 +66,7 @@ class BaseState extends events_1.default {
65
66
  const docs = options.returnUpdatedDocs ? await this.find(condition) : [];
66
67
  return [affectedRows, docs];
67
68
  }
68
- async updateById(id, updates, options = {}) {
69
+ updateById(id, updates, options = {}) {
69
70
  return this.update({ id }, updates, options);
70
71
  }
71
72
  async upsert(condition, updates) {
@@ -1,6 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.createStateFactory = void 0;
4
+ // eslint-disable-next-line import/prefer-default-export
4
5
  function createStateFactory(initializer, models) {
5
6
  const states = {};
6
7
  return new Proxy({}, {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@abtnode/models",
3
- "version": "1.16.11-next-61882496",
3
+ "version": "1.16.11-next-b5795b3a",
4
4
  "description": "Sequelize models for blocklet server and blocklet service",
5
5
  "homepage": "https://github.com/ArcBlock/blocklet-server#readme",
6
6
  "publishConfig": {
@@ -32,8 +32,8 @@
32
32
  "url": "https://github.com/ArcBlock/blocklet-server/issues"
33
33
  },
34
34
  "dependencies": {
35
- "@abtnode/logger": "1.16.11-next-61882496",
36
- "@abtnode/types": "1.16.11-next-61882496",
35
+ "@abtnode/logger": "1.16.11-next-b5795b3a",
36
+ "@abtnode/types": "1.16.11-next-b5795b3a",
37
37
  "@nedb/core": "^2.1.5",
38
38
  "lodash.clonedeep": "^4.5.0",
39
39
  "lodash.get": "^4.4.2",
@@ -44,7 +44,7 @@
44
44
  "uuid": "^8.3.2"
45
45
  },
46
46
  "devDependencies": {
47
- "@arcblock/eslint-config-ts": "^0.2.3",
47
+ "@arcblock/eslint-config-ts": "^0.2.4",
48
48
  "@types/jest": "^29.2.0",
49
49
  "@types/node": "^18.11.0",
50
50
  "@typescript-eslint/eslint-plugin": "^5.40.1",
@@ -54,5 +54,5 @@
54
54
  "typescript": "^5.0.4"
55
55
  },
56
56
  "resolutions": {},
57
- "gitHead": "75e004bf1084bd138e89aadf7629f9fd061ec74d"
57
+ "gitHead": "3a3586bb115318b2149e72ab99e441684122b3e3"
58
58
  }