@abtnode/models 1.16.13-beta-0086a35d → 1.16.13-beta-d13e9789

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.
@@ -0,0 +1,14 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.down = exports.up = void 0;
4
+ const models_1 = require("../../models");
5
+ const models = (0, models_1.getServerModels)();
6
+ const up = async ({ context }) => {
7
+ await context.createTable('runtime_insights', models.RuntimeInsight.GENESIS_ATTRIBUTES);
8
+ await context.addIndex('runtime_insights', ['did', 'date'], { unique: true });
9
+ };
10
+ exports.up = up;
11
+ const down = async ({ context }) => {
12
+ await context.dropTable('runtime_insights');
13
+ };
14
+ exports.down = down;
@@ -22,6 +22,7 @@ export * from './webhook';
22
22
  export * from './connection';
23
23
  export * from './backup';
24
24
  export * from './traffic-insight';
25
+ export * from './runtime-insight';
25
26
  export declare function createSequelize(dbPath: string, config?: Record<string, any>): any;
26
27
  export declare function destroySequelize(dbPath: string): void;
27
28
  export declare function getServiceModels(): {
@@ -59,6 +60,7 @@ export declare function getServerModels(): {
59
60
  WebHook: import("../types").DynamicModel<import("./webhook").WebHookState>;
60
61
  Backup: import("../types").DynamicModel<import("./backup").BackupState>;
61
62
  TrafficInsight: import("../types").DynamicModel<import("./traffic-insight").TrafficInsightState>;
63
+ RuntimeInsight: import("../types").DynamicModel<import("./runtime-insight").RuntimeInsightState>;
62
64
  };
63
65
  export declare function getConnectModels(): {
64
66
  Connection: import("../types").DynamicModel<import("./connection").ConnectionState>;
@@ -39,6 +39,7 @@ const webhook_1 = require("./webhook");
39
39
  const connection_1 = require("./connection");
40
40
  const backup_1 = require("./backup");
41
41
  const traffic_insight_1 = require("./traffic-insight");
42
+ const runtime_insight_1 = require("./runtime-insight");
42
43
  __exportStar(require("./message"), exports);
43
44
  __exportStar(require("./account"), exports);
44
45
  __exportStar(require("./certificate"), exports);
@@ -62,6 +63,7 @@ __exportStar(require("./webhook"), exports);
62
63
  __exportStar(require("./connection"), exports);
63
64
  __exportStar(require("./backup"), exports);
64
65
  __exportStar(require("./traffic-insight"), exports);
66
+ __exportStar(require("./runtime-insight"), exports);
65
67
  const instances = new Map();
66
68
  function createSequelize(dbPath, config = {
67
69
  logging: !process.env.DISABLE_SQLITE_LOG &&
@@ -136,6 +138,7 @@ function getServerModels() {
136
138
  WebHook: (0, webhook_1.createWebHookModel)(),
137
139
  Backup: (0, backup_1.createBackupModel)(),
138
140
  TrafficInsight: (0, traffic_insight_1.createTrafficInsightModel)(),
141
+ RuntimeInsight: (0, runtime_insight_1.createRuntimeInsightModel)(),
139
142
  };
140
143
  return models;
141
144
  }
@@ -0,0 +1,7 @@
1
+ import type { TNodeHistoryItem } from '@abtnode/types';
2
+ import { DynamicModel } from '../types';
3
+ export type RuntimeInsightState = TNodeHistoryItem & {
4
+ id: number;
5
+ did: string;
6
+ };
7
+ export declare function createRuntimeInsightModel(): DynamicModel<RuntimeInsightState>;
@@ -0,0 +1,57 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.createRuntimeInsightModel = void 0;
4
+ const sequelize_1 = require("sequelize");
5
+ function createRuntimeInsightModel() {
6
+ var _a;
7
+ return _a = class RuntimeInsight extends sequelize_1.Model {
8
+ static initialize(sequelize) {
9
+ this.init({
10
+ ...this.GENESIS_ATTRIBUTES,
11
+ }, {
12
+ sequelize,
13
+ modelName: 'RuntimeInsight',
14
+ indexes: [{ fields: ['did', 'date'], unique: true }],
15
+ tableName: 'runtime_insights',
16
+ timestamps: false,
17
+ });
18
+ }
19
+ },
20
+ _a.GENESIS_ATTRIBUTES = {
21
+ id: {
22
+ type: sequelize_1.DataTypes.INTEGER,
23
+ primaryKey: true,
24
+ autoIncrement: true,
25
+ },
26
+ did: {
27
+ type: sequelize_1.DataTypes.STRING(40),
28
+ allowNull: false,
29
+ },
30
+ date: {
31
+ type: sequelize_1.DataTypes.NUMBER,
32
+ allowNull: false,
33
+ },
34
+ cpu: {
35
+ type: sequelize_1.DataTypes.NUMBER,
36
+ defaultValue: 0,
37
+ },
38
+ mem: {
39
+ type: sequelize_1.DataTypes.NUMBER,
40
+ defaultValue: 0,
41
+ },
42
+ daemonMem: {
43
+ type: sequelize_1.DataTypes.NUMBER,
44
+ defaultValue: 0,
45
+ },
46
+ serviceMem: {
47
+ type: sequelize_1.DataTypes.NUMBER,
48
+ defaultValue: 0,
49
+ },
50
+ hubMem: {
51
+ type: sequelize_1.DataTypes.NUMBER,
52
+ defaultValue: 0,
53
+ },
54
+ },
55
+ _a;
56
+ }
57
+ exports.createRuntimeInsightModel = createRuntimeInsightModel;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@abtnode/models",
3
- "version": "1.16.13-beta-0086a35d",
3
+ "version": "1.16.13-beta-d13e9789",
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.13-beta-0086a35d",
36
- "@abtnode/types": "1.16.13-beta-0086a35d",
35
+ "@abtnode/logger": "1.16.13-beta-d13e9789",
36
+ "@abtnode/types": "1.16.13-beta-d13e9789",
37
37
  "@nedb/core": "^2.1.5",
38
38
  "lodash.clonedeep": "^4.5.0",
39
39
  "lodash.get": "^4.4.2",
@@ -54,5 +54,5 @@
54
54
  "typescript": "^5.0.4"
55
55
  },
56
56
  "resolutions": {},
57
- "gitHead": "cbf5c99e7cadf9fef4d77673cb45b44ef26436cf"
57
+ "gitHead": "fcb07d0b3c742aaa68101e302b9eca193d0db872"
58
58
  }