@abtnode/models 1.16.8-next-d1e52353 → 1.16.8-next-f9099675

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.
@@ -13,6 +13,7 @@ function createAuditLogModel() {
13
13
  sequelize,
14
14
  modelName: 'AuditLog',
15
15
  tableName: 'audit_logs',
16
+ indexes: [{ fields: ['scope', 'category', 'id'] }, { fields: ['scope', 'actor', 'id'] }],
16
17
  timestamps: true,
17
18
  });
18
19
  }
@@ -13,6 +13,7 @@ function createBackupModel() {
13
13
  sequelize,
14
14
  modelName: 'Backup',
15
15
  tableName: 'backups',
16
+ indexes: [{ fields: ['appPid', 'id'] }],
16
17
  timestamps: true,
17
18
  });
18
19
  }
@@ -12,6 +12,7 @@ function createConnectedAccountModel() {
12
12
  sequelize,
13
13
  modelName: 'ConnectedAccount',
14
14
  tableName: 'connected_accounts',
15
+ indexes: [{ fields: ['userDid', 'did'] }],
15
16
  timestamps: false,
16
17
  });
17
18
  }
@@ -62,7 +62,7 @@ __exportStar(require("./connection"), exports);
62
62
  __exportStar(require("./backup"), exports);
63
63
  const instances = new Map();
64
64
  function createSequelize(dbPath, config = {
65
- logging: !!process.env.SEQUELIZE_LOGGING || ['production', 'test'].includes(process.env.NODE_ENV) === false,
65
+ logging: !!process.env.DEBUG || ['production', 'test'].includes(process.env.NODE_ENV) === false,
66
66
  }) {
67
67
  if (instances.has(dbPath)) {
68
68
  return instances.get(dbPath);
@@ -12,6 +12,7 @@ function createPassportModel() {
12
12
  sequelize,
13
13
  modelName: 'Passport',
14
14
  tableName: 'passports',
15
+ indexes: [{ fields: ['name', 'status', 'userDid'] }],
15
16
  timestamps: false,
16
17
  });
17
18
  }
@@ -12,7 +12,7 @@ function createSessionModel() {
12
12
  ...this.GENESIS_ATTRIBUTES,
13
13
  }, {
14
14
  sequelize,
15
- indexes: [{ fields: ['type', 'id'] }],
15
+ indexes: [{ fields: ['type', 'id'] }, { fields: ['key', 'id'] }],
16
16
  modelName: 'Session',
17
17
  tableName: 'sessions',
18
18
  timestamps: true,
@@ -1,6 +1,4 @@
1
1
  import { TUserInfo } from '@abtnode/types';
2
2
  import { DynamicModel } from '../types';
3
- export type UserState = Omit<TUserInfo, 'passports' | 'connectedAccounts'> & {
4
- extra: Record<string, any>;
5
- };
3
+ export type UserState = Omit<TUserInfo, 'passports' | 'connectedAccounts' | 'source' | 'extraConfigs'>;
6
4
  export declare function createUserModel(): DynamicModel<UserState>;
@@ -13,7 +13,7 @@ function createUserModel() {
13
13
  modelName: 'User',
14
14
  tableName: 'users',
15
15
  timestamps: true,
16
- indexes: [{ fields: ['email'] }, { fields: ['fullName'] }],
16
+ indexes: [{ fields: ['approved', 'did'] }, { fields: ['email', 'did'] }, { fields: ['fullName', 'did'] }],
17
17
  });
18
18
  }
19
19
  static associate(models) {
@@ -68,13 +68,8 @@ function createUserModel() {
68
68
  index: true,
69
69
  defaultValue: true,
70
70
  },
71
- // server extended
72
- extra: {
73
- type: sequelize_1.DataTypes.JSON,
74
- defaultValue: {},
75
- },
76
71
  // app extended
77
- meta: {
72
+ extra: {
78
73
  type: sequelize_1.DataTypes.JSON,
79
74
  defaultValue: {},
80
75
  },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@abtnode/models",
3
- "version": "1.16.8-next-d1e52353",
3
+ "version": "1.16.8-next-f9099675",
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,7 +32,7 @@
32
32
  "url": "https://github.com/ArcBlock/blocklet-server/issues"
33
33
  },
34
34
  "dependencies": {
35
- "@abtnode/types": "1.16.8-next-d1e52353",
35
+ "@abtnode/types": "1.16.8-next-f9099675",
36
36
  "@nedb/core": "^2.1.5",
37
37
  "lodash.clonedeep": "^4.5.0",
38
38
  "lodash.get": "^4.4.2",
@@ -54,5 +54,5 @@
54
54
  "typescript": "^4.8.4"
55
55
  },
56
56
  "resolutions": {},
57
- "gitHead": "d357376aa3df9ef789befc7f548629deecb04d96"
57
+ "gitHead": "02702513382f0b2297eff3520fc77f630eec578f"
58
58
  }