@abtnode/models 1.16.19-beta-e93c5bf3 → 1.16.19-beta-e6aac665
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/migrations/blocklet/{20231012000000-user-session copy.js → 20231012000000-user-session.js} +0 -1
- package/lib/migrations/blocklet/20231031000000-project.js +8 -4
- package/lib/migrations/connect/20231115000000-v2.js +13 -0
- package/lib/models/connection-v2.d.ts +38 -0
- package/lib/models/connection-v2.js +111 -0
- package/lib/models/index.d.ts +2 -0
- package/lib/models/index.js +3 -0
- package/package.json +5 -5
|
@@ -4,7 +4,6 @@ exports.down = exports.up = void 0;
|
|
|
4
4
|
const models_1 = require("../../models");
|
|
5
5
|
const models = (0, models_1.getBlockletModels)();
|
|
6
6
|
const up = async ({ context }) => {
|
|
7
|
-
await context.dropTable('user_sessions');
|
|
8
7
|
await context.createTable('user_sessions', models.UserSession.GENESIS_ATTRIBUTES);
|
|
9
8
|
};
|
|
10
9
|
exports.up = up;
|
|
@@ -4,10 +4,14 @@ exports.down = exports.up = void 0;
|
|
|
4
4
|
const sequelize_1 = require("sequelize");
|
|
5
5
|
const up = async ({ context }) => {
|
|
6
6
|
try {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
7
|
+
const queryInterface = context;
|
|
8
|
+
const tableDescriptions = await queryInterface.describeTable('projects');
|
|
9
|
+
if (!tableDescriptions?.componentDid) {
|
|
10
|
+
await queryInterface.addColumn('projects', 'componentDid', {
|
|
11
|
+
type: sequelize_1.DataTypes.STRING(40),
|
|
12
|
+
allowNull: true,
|
|
13
|
+
});
|
|
14
|
+
}
|
|
11
15
|
}
|
|
12
16
|
catch (err) {
|
|
13
17
|
if (process.env.NODE_ENV === 'test' && err.message.startsWith('SQLITE_ERROR: duplicate column name')) {
|
|
@@ -0,0 +1,13 @@
|
|
|
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.getConnectModels)();
|
|
6
|
+
const up = async ({ context }) => {
|
|
7
|
+
await context.createTable('connections_v2', models.ConnectionV2.GENESIS_ATTRIBUTES);
|
|
8
|
+
};
|
|
9
|
+
exports.up = up;
|
|
10
|
+
const down = async ({ context }) => {
|
|
11
|
+
await context.dropTable('connections_v2');
|
|
12
|
+
};
|
|
13
|
+
exports.down = down;
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { DynamicModel } from '../types';
|
|
2
|
+
export type ConnectionV2State = {
|
|
3
|
+
appInfo: any;
|
|
4
|
+
approveResults: any[];
|
|
5
|
+
approveUrl?: string;
|
|
6
|
+
authUrl: string;
|
|
7
|
+
autoConnect: boolean;
|
|
8
|
+
challenge: string;
|
|
9
|
+
connectUrl?: string;
|
|
10
|
+
currentConnected?: {
|
|
11
|
+
didwallet: any;
|
|
12
|
+
userDid: string;
|
|
13
|
+
userPk: string;
|
|
14
|
+
} | null;
|
|
15
|
+
currentStep: number;
|
|
16
|
+
error?: string;
|
|
17
|
+
forceConnected: boolean;
|
|
18
|
+
onlyConnect: boolean;
|
|
19
|
+
previousConnected?: {
|
|
20
|
+
didwallet: 'ios' | 'android' | 'web' | '';
|
|
21
|
+
userDid: string;
|
|
22
|
+
userPk: string;
|
|
23
|
+
} | null;
|
|
24
|
+
requestedClaims: any;
|
|
25
|
+
responseClaims: any;
|
|
26
|
+
sessionId: string;
|
|
27
|
+
status: string;
|
|
28
|
+
strategy: string | 'default' | 'smart';
|
|
29
|
+
timeout: {
|
|
30
|
+
app: number;
|
|
31
|
+
relay: number;
|
|
32
|
+
wallet: number;
|
|
33
|
+
};
|
|
34
|
+
updaterPk: string;
|
|
35
|
+
withinSession: boolean;
|
|
36
|
+
[key: string]: any;
|
|
37
|
+
};
|
|
38
|
+
export declare function createConnectionV2Model(): DynamicModel<ConnectionV2State>;
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.createConnectionV2Model = void 0;
|
|
4
|
+
// Storage for did-connect sessions
|
|
5
|
+
const sequelize_1 = require("sequelize");
|
|
6
|
+
function createConnectionV2Model() {
|
|
7
|
+
var _a;
|
|
8
|
+
return _a = class ConnectionV2 extends sequelize_1.Model {
|
|
9
|
+
static initialize(sequelize) {
|
|
10
|
+
this.init({
|
|
11
|
+
...this.GENESIS_ATTRIBUTES,
|
|
12
|
+
}, {
|
|
13
|
+
sequelize,
|
|
14
|
+
modelName: 'ConnectionV2',
|
|
15
|
+
tableName: 'connections_v2',
|
|
16
|
+
timestamps: true,
|
|
17
|
+
});
|
|
18
|
+
}
|
|
19
|
+
},
|
|
20
|
+
_a.GENESIS_ATTRIBUTES = {
|
|
21
|
+
appInfo: {
|
|
22
|
+
type: sequelize_1.DataTypes.JSON,
|
|
23
|
+
},
|
|
24
|
+
approvedResults: {
|
|
25
|
+
type: sequelize_1.DataTypes.JSON,
|
|
26
|
+
},
|
|
27
|
+
approveUrl: {
|
|
28
|
+
type: sequelize_1.DataTypes.TEXT,
|
|
29
|
+
defaultValue: '',
|
|
30
|
+
},
|
|
31
|
+
authUrl: {
|
|
32
|
+
type: sequelize_1.DataTypes.TEXT,
|
|
33
|
+
defaultValue: '',
|
|
34
|
+
},
|
|
35
|
+
autoConnect: {
|
|
36
|
+
type: sequelize_1.DataTypes.BOOLEAN,
|
|
37
|
+
default: false,
|
|
38
|
+
},
|
|
39
|
+
challenge: {
|
|
40
|
+
type: sequelize_1.DataTypes.STRING(32),
|
|
41
|
+
},
|
|
42
|
+
connectUrl: {
|
|
43
|
+
type: sequelize_1.DataTypes.TEXT,
|
|
44
|
+
defaultValue: '',
|
|
45
|
+
},
|
|
46
|
+
currentConnected: {
|
|
47
|
+
type: sequelize_1.DataTypes.JSON,
|
|
48
|
+
},
|
|
49
|
+
currentStep: {
|
|
50
|
+
type: sequelize_1.DataTypes.INTEGER,
|
|
51
|
+
},
|
|
52
|
+
error: {
|
|
53
|
+
type: sequelize_1.DataTypes.TEXT,
|
|
54
|
+
defaultValue: '',
|
|
55
|
+
},
|
|
56
|
+
forceConnected: {
|
|
57
|
+
type: sequelize_1.DataTypes.BOOLEAN,
|
|
58
|
+
default: false,
|
|
59
|
+
},
|
|
60
|
+
onlyConnect: {
|
|
61
|
+
type: sequelize_1.DataTypes.BOOLEAN,
|
|
62
|
+
default: false,
|
|
63
|
+
},
|
|
64
|
+
previousConnected: {
|
|
65
|
+
type: sequelize_1.DataTypes.JSON,
|
|
66
|
+
},
|
|
67
|
+
requestedClaims: {
|
|
68
|
+
type: sequelize_1.DataTypes.JSON,
|
|
69
|
+
},
|
|
70
|
+
responseClaims: {
|
|
71
|
+
type: sequelize_1.DataTypes.JSON,
|
|
72
|
+
},
|
|
73
|
+
sessionId: {
|
|
74
|
+
type: sequelize_1.DataTypes.STRING(40),
|
|
75
|
+
primaryKey: true,
|
|
76
|
+
},
|
|
77
|
+
status: {
|
|
78
|
+
type: sequelize_1.DataTypes.STRING(16),
|
|
79
|
+
index: true,
|
|
80
|
+
},
|
|
81
|
+
strategy: {
|
|
82
|
+
type: sequelize_1.DataTypes.STRING(16),
|
|
83
|
+
},
|
|
84
|
+
timeout: {
|
|
85
|
+
type: sequelize_1.DataTypes.JSON,
|
|
86
|
+
},
|
|
87
|
+
updaterPk: {
|
|
88
|
+
type: sequelize_1.DataTypes.STRING(255),
|
|
89
|
+
},
|
|
90
|
+
withinSession: {
|
|
91
|
+
type: sequelize_1.DataTypes.BOOLEAN,
|
|
92
|
+
default: false,
|
|
93
|
+
},
|
|
94
|
+
__extra: {
|
|
95
|
+
type: sequelize_1.DataTypes.JSON,
|
|
96
|
+
defaultValue: {},
|
|
97
|
+
},
|
|
98
|
+
createdAt: {
|
|
99
|
+
type: sequelize_1.DataTypes.DATE,
|
|
100
|
+
defaultValue: sequelize_1.DataTypes.NOW,
|
|
101
|
+
index: true,
|
|
102
|
+
},
|
|
103
|
+
updatedAt: {
|
|
104
|
+
type: sequelize_1.DataTypes.DATE,
|
|
105
|
+
defaultValue: sequelize_1.DataTypes.NOW,
|
|
106
|
+
index: true,
|
|
107
|
+
},
|
|
108
|
+
},
|
|
109
|
+
_a;
|
|
110
|
+
}
|
|
111
|
+
exports.createConnectionV2Model = createConnectionV2Model;
|
package/lib/models/index.d.ts
CHANGED
|
@@ -21,6 +21,7 @@ export * from './server';
|
|
|
21
21
|
export * from './site';
|
|
22
22
|
export * from './webhook';
|
|
23
23
|
export * from './connection';
|
|
24
|
+
export * from './connection-v2';
|
|
24
25
|
export * from './backup';
|
|
25
26
|
export * from './traffic-insight';
|
|
26
27
|
export * from './runtime-insight';
|
|
@@ -75,5 +76,6 @@ export declare function getServerModels(): {
|
|
|
75
76
|
};
|
|
76
77
|
export declare function getConnectModels(): {
|
|
77
78
|
Connection: import("../types").DynamicModel<import("./connection").ConnectionState>;
|
|
79
|
+
ConnectionV2: import("../types").DynamicModel<import("./connection-v2").ConnectionV2State>;
|
|
78
80
|
};
|
|
79
81
|
export declare function setupModels(models: any, sequelize: Sequelize): void;
|
package/lib/models/index.js
CHANGED
|
@@ -45,6 +45,7 @@ const tagging_1 = require("./tagging");
|
|
|
45
45
|
const project_1 = require("./project");
|
|
46
46
|
const release_1 = require("./release");
|
|
47
47
|
const user_session_1 = require("./user-session");
|
|
48
|
+
const connection_v2_1 = require("./connection-v2");
|
|
48
49
|
__exportStar(require("./message"), exports);
|
|
49
50
|
__exportStar(require("./account"), exports);
|
|
50
51
|
__exportStar(require("./certificate"), exports);
|
|
@@ -67,6 +68,7 @@ __exportStar(require("./server"), exports);
|
|
|
67
68
|
__exportStar(require("./site"), exports);
|
|
68
69
|
__exportStar(require("./webhook"), exports);
|
|
69
70
|
__exportStar(require("./connection"), exports);
|
|
71
|
+
__exportStar(require("./connection-v2"), exports);
|
|
70
72
|
__exportStar(require("./backup"), exports);
|
|
71
73
|
__exportStar(require("./traffic-insight"), exports);
|
|
72
74
|
__exportStar(require("./runtime-insight"), exports);
|
|
@@ -162,6 +164,7 @@ exports.getServerModels = getServerModels;
|
|
|
162
164
|
function getConnectModels() {
|
|
163
165
|
const models = {
|
|
164
166
|
Connection: (0, connection_1.createConnectionModel)(),
|
|
167
|
+
ConnectionV2: (0, connection_v2_1.createConnectionV2Model)(),
|
|
165
168
|
};
|
|
166
169
|
return models;
|
|
167
170
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@abtnode/models",
|
|
3
|
-
"version": "1.16.19-beta-
|
|
3
|
+
"version": "1.16.19-beta-e6aac665",
|
|
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,9 +32,9 @@
|
|
|
32
32
|
"url": "https://github.com/ArcBlock/blocklet-server/issues"
|
|
33
33
|
},
|
|
34
34
|
"dependencies": {
|
|
35
|
-
"@abtnode/logger": "1.16.19-beta-
|
|
36
|
-
"@abtnode/types": "1.16.19-beta-
|
|
37
|
-
"@blocklet/constant": "1.16.19-beta-
|
|
35
|
+
"@abtnode/logger": "1.16.19-beta-e6aac665",
|
|
36
|
+
"@abtnode/types": "1.16.19-beta-e6aac665",
|
|
37
|
+
"@blocklet/constant": "1.16.19-beta-e6aac665",
|
|
38
38
|
"@nedb/core": "^2.1.5",
|
|
39
39
|
"lodash.clonedeep": "^4.5.0",
|
|
40
40
|
"lodash.get": "^4.4.2",
|
|
@@ -55,5 +55,5 @@
|
|
|
55
55
|
"typescript": "^5.0.4"
|
|
56
56
|
},
|
|
57
57
|
"resolutions": {},
|
|
58
|
-
"gitHead": "
|
|
58
|
+
"gitHead": "09b0172831521ef73f7879940b977c2696b5b247"
|
|
59
59
|
}
|