@abtnode/models 1.16.38 → 1.16.39-beta-20250209-032436-5ceca2cb

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,9 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.down = exports.up = void 0;
4
+ const up = async ({ context }) => {
5
+ await context.addIndex('audit_logs', ['content']);
6
+ };
7
+ exports.up = up;
8
+ const down = async () => { };
9
+ exports.down = down;
@@ -0,0 +1,15 @@
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('blacklists', models.Blacklist.GENESIS_ATTRIBUTES);
8
+ await context.addIndex('blacklists', ['scope', 'expiresAt']);
9
+ await context.addIndex('blacklists', ['scope', 'key']);
10
+ };
11
+ exports.up = up;
12
+ const down = async ({ context }) => {
13
+ await context.dropTable('blacklists');
14
+ };
15
+ exports.down = down;
@@ -13,7 +13,12 @@ function createAuditLogModel() {
13
13
  sequelize,
14
14
  modelName: 'AuditLog',
15
15
  tableName: 'audit_logs',
16
- indexes: [{ fields: ['scope', 'category'] }, { fields: ['scope', 'actor'] }, { fields: ['category'] }],
16
+ indexes: [
17
+ { fields: ['scope', 'category'] },
18
+ { fields: ['scope', 'actor'] },
19
+ { fields: ['category'] },
20
+ { fields: ['content'] },
21
+ ],
17
22
  timestamps: true,
18
23
  });
19
24
  }
@@ -0,0 +1,10 @@
1
+ import { DynamicModel } from '../types';
2
+ export type BlacklistState = {
3
+ id: number;
4
+ scope: string;
5
+ key: string;
6
+ expiresAt: number;
7
+ createdAt: Date;
8
+ updatedAt: Date;
9
+ };
10
+ export declare function createBlacklistModel(): DynamicModel<BlacklistState>;
@@ -0,0 +1,50 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.createBlacklistModel = createBlacklistModel;
4
+ // Storage for multi-queue job storage
5
+ const sequelize_1 = require("sequelize");
6
+ function createBlacklistModel() {
7
+ var _a;
8
+ return _a = class Blacklist extends sequelize_1.Model {
9
+ static initialize(sequelize) {
10
+ this.init({
11
+ ...this.GENESIS_ATTRIBUTES,
12
+ }, {
13
+ sequelize,
14
+ indexes: [{ fields: ['scope', 'expiresAt'] }, { fields: ['scope', 'key'] }],
15
+ modelName: 'Blacklist',
16
+ tableName: 'blacklists',
17
+ timestamps: true,
18
+ });
19
+ }
20
+ },
21
+ _a.GENESIS_ATTRIBUTES = {
22
+ id: {
23
+ type: sequelize_1.DataTypes.INTEGER,
24
+ primaryKey: true,
25
+ autoIncrement: true,
26
+ },
27
+ scope: {
28
+ type: sequelize_1.DataTypes.STRING(32),
29
+ allowNull: false,
30
+ },
31
+ key: {
32
+ type: sequelize_1.DataTypes.STRING(64),
33
+ allowNull: false,
34
+ },
35
+ expiresAt: {
36
+ type: sequelize_1.DataTypes.NUMBER,
37
+ },
38
+ createdAt: {
39
+ type: sequelize_1.DataTypes.DATE,
40
+ defaultValue: sequelize_1.DataTypes.NOW,
41
+ index: true,
42
+ },
43
+ updatedAt: {
44
+ type: sequelize_1.DataTypes.DATE,
45
+ defaultValue: sequelize_1.DataTypes.NOW,
46
+ index: true,
47
+ },
48
+ },
49
+ _a;
50
+ }
@@ -32,6 +32,7 @@ export * from './verify-code';
32
32
  export * from './access-policy';
33
33
  export * from './response-header-policy';
34
34
  export * from './security-rule';
35
+ export * from './blacklist';
35
36
  export declare function createSequelize(dbPath: string, config?: Record<string, any>): any;
36
37
  export declare function destroySequelize(dbPath: string): void;
37
38
  export declare function getServiceModels(): {
@@ -85,6 +86,7 @@ export declare function getServerModels(): {
85
86
  RuntimeInsight: import("../types").DynamicModel<import("./runtime-insight").RuntimeInsightState>;
86
87
  Tag: import("../types").DynamicModel<import("@abtnode/types").TTag>;
87
88
  Tagging: import("../types").DynamicModel<import("./tagging").TaggingState>;
89
+ Blacklist: import("../types").DynamicModel<import("./blacklist").BlacklistState>;
88
90
  };
89
91
  export declare function getConnectModels(): {
90
92
  Connection: import("../types").DynamicModel<import("./connection").ConnectionState>;
@@ -59,6 +59,7 @@ const verify_code_1 = require("./verify-code");
59
59
  const security_rule_1 = require("./security-rule");
60
60
  const access_policy_1 = require("./access-policy");
61
61
  const response_header_policy_1 = require("./response-header-policy");
62
+ const blacklist_1 = require("./blacklist");
62
63
  __exportStar(require("./message"), exports);
63
64
  __exportStar(require("./account"), exports);
64
65
  __exportStar(require("./certificate"), exports);
@@ -91,6 +92,7 @@ __exportStar(require("./verify-code"), exports);
91
92
  __exportStar(require("./access-policy"), exports);
92
93
  __exportStar(require("./response-header-policy"), exports);
93
94
  __exportStar(require("./security-rule"), exports);
95
+ __exportStar(require("./blacklist"), exports);
94
96
  const logEnabled = !process.env.DISABLE_SQLITE_LOG &&
95
97
  (process.env.DEBUG === '@abtnode/models' || ['production', 'test'].includes(process.env.NODE_ENV) === false);
96
98
  const instances = new Map();
@@ -181,6 +183,7 @@ function getServerModels() {
181
183
  RuntimeInsight: (0, runtime_insight_1.createRuntimeInsightModel)(),
182
184
  Tag: (0, tag_1.createTagModel)(),
183
185
  Tagging: (0, tagging_1.createTaggingModel)(),
186
+ Blacklist: (0, blacklist_1.createBlacklistModel)(),
184
187
  };
185
188
  return models;
186
189
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@abtnode/models",
3
- "version": "1.16.38",
3
+ "version": "1.16.39-beta-20250209-032436-5ceca2cb",
4
4
  "description": "Sequelize models for blocklet server and blocklet service",
5
5
  "homepage": "https://github.com/ArcBlock/blocklet-server#readme",
6
6
  "publishConfig": {
@@ -33,9 +33,9 @@
33
33
  "url": "https://github.com/ArcBlock/blocklet-server/issues"
34
34
  },
35
35
  "dependencies": {
36
- "@abtnode/constant": "1.16.38",
37
- "@abtnode/logger": "1.16.38",
38
- "@abtnode/types": "1.16.38",
36
+ "@abtnode/constant": "1.16.39-beta-20250209-032436-5ceca2cb",
37
+ "@abtnode/logger": "1.16.39-beta-20250209-032436-5ceca2cb",
38
+ "@abtnode/types": "1.16.39-beta-20250209-032436-5ceca2cb",
39
39
  "lodash.clonedeep": "^4.5.0",
40
40
  "lodash.isempty": "^4.4.0",
41
41
  "sequelize": "^6.35.0",
@@ -55,5 +55,5 @@
55
55
  "typescript": "^5.6.3"
56
56
  },
57
57
  "resolutions": {},
58
- "gitHead": "c75b3026d0e3fa45ccc2af00e2a85962bf5d17af"
58
+ "gitHead": "949581a46cec2ebfb656a42632ca550ed3b0ba70"
59
59
  }