@abtnode/models
Advanced tools
Comparing version 1.16.11-next-3d2b39f7 to 1.16.11-next-3e55bc95
@@ -21,2 +21,3 @@ "use strict"; | ||
const MIGRATION_SCRIPT_EXTENSION = process.env.MIGRATION_SCRIPT_EXTENSION || 'js'; | ||
// eslint-disable-next-line require-await | ||
async function doSchemaMigration(dbFile, group) { | ||
@@ -23,0 +24,0 @@ const sequelize = (0, models_1.createSequelize)(dbFile); |
@@ -5,2 +5,3 @@ "use strict"; | ||
const sequelize_1 = require("sequelize"); | ||
// Add missing fields for servers from launcher | ||
const up = async ({ context }) => { | ||
@@ -7,0 +8,0 @@ await context.addColumn('servers', 'launcher', { type: sequelize_1.DataTypes.JSON }); |
@@ -5,3 +5,4 @@ import { TBlockletState } from '@abtnode/types'; | ||
updatedAt: Date; | ||
tokens: Record<string, any>; | ||
}; | ||
export declare function createBlockletModel(): DynamicModel<BlockletState>; |
@@ -10,3 +10,8 @@ "use strict"; | ||
static initialize(sequelize) { | ||
this.init({ ...this.GENESIS_ATTRIBUTES }, { | ||
this.init({ | ||
...this.GENESIS_ATTRIBUTES, | ||
tokens: { | ||
type: sequelize_1.DataTypes.JSON, | ||
}, | ||
}, { | ||
sequelize, | ||
@@ -13,0 +18,0 @@ modelName: 'Blocklet', |
@@ -30,2 +30,3 @@ "use strict"; | ||
primaryKey: true, | ||
allowNull: false, | ||
}, | ||
@@ -45,2 +46,3 @@ pk: { | ||
type: sequelize_1.DataTypes.STRING(32), | ||
allowNull: false, | ||
}, | ||
@@ -47,0 +49,0 @@ id: { |
@@ -30,2 +30,3 @@ "use strict"; | ||
primaryKey: true, | ||
allowNull: false, | ||
}, | ||
@@ -32,0 +33,0 @@ userDid: { |
@@ -11,2 +11,3 @@ "use strict"; | ||
const util_1 = require("../util"); | ||
// eslint-disable-next-line import/prefer-default-export | ||
class BaseState extends events_1.default { | ||
@@ -27,3 +28,3 @@ constructor(model, config = {}) { | ||
} | ||
async find(condition = {}, selection = {}, sort = {}) { | ||
find(condition = {}, selection = {}, sort = {}) { | ||
const params = (0, util_1.formatParams)({ | ||
@@ -37,3 +38,3 @@ attributes: (0, util_1.formatSelection)(selection), | ||
} | ||
async findOne(condition = {}, selection = {}, sort = {}) { | ||
findOne(condition = {}, selection = {}, sort = {}) { | ||
const params = (0, util_1.formatParams)({ | ||
@@ -46,3 +47,3 @@ attributes: (0, util_1.formatSelection)(selection), | ||
} | ||
async count(condition = {}) { | ||
count(condition = {}) { | ||
return this.model.count({ ...(0, util_1.formatConditions)(condition) }); | ||
@@ -72,3 +73,3 @@ } | ||
} | ||
async updateById(id, updates, options = {}) { | ||
updateById(id, updates, options = {}) { | ||
return this.update({ id }, updates, options); | ||
@@ -75,0 +76,0 @@ } |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.createStateFactory = void 0; | ||
// eslint-disable-next-line import/prefer-default-export | ||
function createStateFactory(initializer, models) { | ||
@@ -5,0 +6,0 @@ const states = {}; |
{ | ||
"name": "@abtnode/models", | ||
"version": "1.16.11-next-3d2b39f7", | ||
"version": "1.16.11-next-3e55bc95", | ||
"description": "Sequelize models for blocklet server and blocklet service", | ||
@@ -35,4 +35,4 @@ "homepage": "https://github.com/ArcBlock/blocklet-server#readme", | ||
"dependencies": { | ||
"@abtnode/logger": "1.16.11-next-3d2b39f7", | ||
"@abtnode/types": "1.16.11-next-3d2b39f7", | ||
"@abtnode/logger": "1.16.11-next-3e55bc95", | ||
"@abtnode/types": "1.16.11-next-3e55bc95", | ||
"@nedb/core": "^2.1.5", | ||
@@ -48,3 +48,3 @@ "lodash.clonedeep": "^4.5.0", | ||
"devDependencies": { | ||
"@arcblock/eslint-config-ts": "^0.2.3", | ||
"@arcblock/eslint-config-ts": "^0.2.4", | ||
"@types/jest": "^29.2.0", | ||
@@ -59,3 +59,3 @@ "@types/node": "^18.11.0", | ||
"resolutions": {}, | ||
"gitHead": "d0142bd2d1e49b94dcb5542d78e294a7b2258faa" | ||
"gitHead": "cf0251c2d85c617b03151495b5944061ceb373e5" | ||
} |
101161
73
2753
+ Added@abtnode/constant@1.16.11-next-3e55bc95(transitive)
+ Added@abtnode/logger@1.16.11-next-3e55bc95(transitive)
+ Added@abtnode/types@1.16.11-next-3e55bc95(transitive)
+ Added@types/node@22.13.7(transitive)
- Removed@abtnode/constant@1.16.11-next-3d2b39f7(transitive)
- Removed@abtnode/logger@1.16.11-next-3d2b39f7(transitive)
- Removed@abtnode/types@1.16.11-next-3d2b39f7(transitive)
- Removed@types/node@22.13.5(transitive)