@hapiboo/module-auth 1.0.0

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,19 @@
1
+ import { IFluxModule } from '@hapiboo/flux';
2
+ import { securityService, IFluxRequest, IFluxTokenRequest, IFluxDataRequest } from './service/security';
3
+ import { IAuthPerformers, IAuthSettings, IAuthEmailLink } from './service/settings';
4
+ import { authenticationService } from './service/authentication';
5
+ import { authorizationService } from './service/authorization';
6
+ import { Credential, Role, UserAccess, Permission, User } from './models';
7
+ export declare namespace auth {
8
+ function init(jwt_secret: string, settings: IAuthSettings, performers: IAuthPerformers): void;
9
+ namespace services {
10
+ const authentication: typeof authenticationService;
11
+ const authorization: typeof authorizationService;
12
+ const security: typeof securityService;
13
+ }
14
+ const routes: import("@hapiboo/server").IRoutingItem[];
15
+ const module: IFluxModule;
16
+ }
17
+ export { Credential, Role, UserAccess, Permission, User };
18
+ export { IAuthSettings, IAuthPerformers, IAuthEmailLink };
19
+ export { IFluxRequest, IFluxTokenRequest, IFluxDataRequest };
package/dist/index.js ADDED
@@ -0,0 +1,35 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.User = exports.Permission = exports.UserAccess = exports.Role = exports.Credential = exports.auth = void 0;
4
+ const security_1 = require("./service/security");
5
+ const settings_1 = require("./service/settings");
6
+ const authentication_1 = require("./service/authentication");
7
+ const authorization_1 = require("./service/authorization");
8
+ const models_1 = require("./models");
9
+ Object.defineProperty(exports, "Credential", { enumerable: true, get: function () { return models_1.Credential; } });
10
+ Object.defineProperty(exports, "Role", { enumerable: true, get: function () { return models_1.Role; } });
11
+ Object.defineProperty(exports, "UserAccess", { enumerable: true, get: function () { return models_1.UserAccess; } });
12
+ Object.defineProperty(exports, "Permission", { enumerable: true, get: function () { return models_1.Permission; } });
13
+ Object.defineProperty(exports, "User", { enumerable: true, get: function () { return models_1.User; } });
14
+ const router_1 = require("./router");
15
+ var auth;
16
+ (function (auth) {
17
+ function init(jwt_secret, settings, performers) {
18
+ settings_1.authSettings.init(settings, performers);
19
+ security_1.securityService.initialize(jwt_secret);
20
+ }
21
+ auth.init = init;
22
+ let services;
23
+ (function (services) {
24
+ services.authentication = authentication_1.authenticationService;
25
+ services.authorization = authorization_1.authorizationService;
26
+ services.security = security_1.securityService;
27
+ })(services = auth.services || (auth.services = {}));
28
+ auth.routes = [router_1.router];
29
+ auth.module = {
30
+ name: 'hAPIboo Authorization Module',
31
+ models: [models_1.User, models_1.Credential, models_1.Role, models_1.Permission, models_1.UserAccess]
32
+ };
33
+ })(auth || (exports.auth = auth = {}));
34
+ //// TODO ////
35
+ // add flag to reset permissions on permission change (in case we have more than single instance running)
@@ -0,0 +1,43 @@
1
+ export type CredentialType = 'password' | 'sso' | 'token';
2
+ export type CredentialStatus = 'active' | 'pending' | 'revoked';
3
+ export declare class Credential {
4
+ id: string;
5
+ name: string;
6
+ user_id: string;
7
+ type: CredentialType;
8
+ status: CredentialStatus;
9
+ confirmation: string;
10
+ invite: string;
11
+ recovery: string;
12
+ refreshCode: string;
13
+ password?: Password;
14
+ sso?: Sso;
15
+ token?: Token;
16
+ clone(model: this): this;
17
+ createPassword(id: string, name: string, user_id: string, status: CredentialStatus, base64Password: string, confirmationCode: string | undefined, inviteCode: string | undefined): this;
18
+ setNewPassword(base64Password: string): this;
19
+ invalidateCredential(): this;
20
+ checkPasswordCorrectness(base64Password: string): boolean;
21
+ changePassword(oldBase64Password: string, newBase64Password: string): boolean;
22
+ checkConfirmed(code: string, base64password: string): boolean;
23
+ checkInvite(invite: string, base64password: string): boolean;
24
+ checkRecovery(recovery: string, base64password: string): boolean;
25
+ setRecoveryCode(recovery: string): boolean;
26
+ setRefreshCode(token: string): boolean;
27
+ }
28
+ export declare class Password {
29
+ hash: string;
30
+ salt: string;
31
+ length: number;
32
+ iterations: number;
33
+ lastChangedAt: string;
34
+ create(base64Password: string): Password;
35
+ clone(model: Password): Password;
36
+ checkPasswordCorrectness(base64password: string): boolean;
37
+ private setPassword;
38
+ private getHash;
39
+ }
40
+ export declare class Sso {
41
+ }
42
+ export declare class Token {
43
+ }
@@ -0,0 +1,221 @@
1
+ "use strict";
2
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
5
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
6
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
7
+ };
8
+ Object.defineProperty(exports, "__esModule", { value: true });
9
+ exports.Token = exports.Sso = exports.Password = exports.Credential = void 0;
10
+ const date_1 = require("@hapiboo/date");
11
+ const crypto_1 = require("@hapiboo/crypto");
12
+ const flux_1 = require("@hapiboo/flux");
13
+ const settings_1 = require("../service/settings");
14
+ const naming_1 = require("./naming");
15
+ let Credential = class Credential {
16
+ constructor() {
17
+ this.id = '';
18
+ this.name = '';
19
+ this.user_id = '';
20
+ this.type = 'password';
21
+ this.status = 'active';
22
+ this.confirmation = '';
23
+ this.invite = '';
24
+ this.recovery = '';
25
+ this.refreshCode = '';
26
+ }
27
+ clone(model) {
28
+ this.id = model.id;
29
+ this.name = model.name;
30
+ this.user_id = model.user_id;
31
+ this.type = model.type;
32
+ this.status = model.status;
33
+ this.confirmation = model.confirmation;
34
+ this.invite = model.invite;
35
+ this.recovery = model.recovery;
36
+ this.refreshCode = model.refreshCode;
37
+ if (model.password) {
38
+ this.password = new Password().clone(model.password);
39
+ }
40
+ else {
41
+ this.password = undefined;
42
+ }
43
+ if (model.sso) {
44
+ this.sso = new Sso();
45
+ }
46
+ else {
47
+ this.sso = undefined;
48
+ }
49
+ if (model.token) {
50
+ this.token = new Token();
51
+ }
52
+ else {
53
+ this.token = undefined;
54
+ }
55
+ return this;
56
+ }
57
+ createPassword(id, name, user_id, status, base64Password, confirmationCode, inviteCode) {
58
+ this.id = id;
59
+ this.name = name;
60
+ this.user_id = user_id;
61
+ this.type = 'password';
62
+ this.status = status;
63
+ this.confirmation = confirmationCode ?? '';
64
+ this.invite = inviteCode ?? '';
65
+ this.password = new Password().create(base64Password);
66
+ this.sso = undefined;
67
+ this.token = undefined;
68
+ return this;
69
+ }
70
+ setNewPassword(base64Password) {
71
+ if (this.type === 'password') {
72
+ this.password = new Password().create(base64Password);
73
+ this.recovery = '';
74
+ this.refreshCode = '';
75
+ }
76
+ return this;
77
+ }
78
+ invalidateCredential() {
79
+ this.status = 'revoked';
80
+ this.confirmation = '';
81
+ this.invite = '';
82
+ this.recovery = '';
83
+ this.refreshCode = '';
84
+ return this;
85
+ }
86
+ checkPasswordCorrectness(base64Password) {
87
+ return (this.type === 'password' && this.password !== undefined) && this.password.checkPasswordCorrectness(base64Password);
88
+ }
89
+ changePassword(oldBase64Password, newBase64Password) {
90
+ if (this.checkPasswordCorrectness(oldBase64Password)) {
91
+ this.setNewPassword(newBase64Password);
92
+ return true;
93
+ }
94
+ else {
95
+ return false;
96
+ }
97
+ }
98
+ checkConfirmed(code, base64password) {
99
+ if (this.type === 'password' && this.confirmation === code && this.checkPasswordCorrectness(base64password) && this.status === 'pending') {
100
+ this.status = 'active';
101
+ this.confirmation = '';
102
+ this.invite = '';
103
+ this.recovery = '';
104
+ this.refreshCode = '';
105
+ return true;
106
+ }
107
+ else {
108
+ return false;
109
+ }
110
+ }
111
+ checkInvite(invite, base64password) {
112
+ if (this.type === 'password' && this.invite === invite && this.status === 'pending') {
113
+ this.setNewPassword(base64password);
114
+ this.status = 'active';
115
+ this.confirmation = '';
116
+ this.invite = '';
117
+ return true;
118
+ }
119
+ else {
120
+ return false;
121
+ }
122
+ }
123
+ checkRecovery(recovery, base64password) {
124
+ if (this.type === 'password' && this.recovery === recovery) {
125
+ this.setNewPassword(base64password);
126
+ this.confirmation = '';
127
+ this.invite = '';
128
+ this.status = 'active';
129
+ return true;
130
+ }
131
+ else {
132
+ return false;
133
+ }
134
+ }
135
+ setRecoveryCode(recovery) {
136
+ if (this.type === 'password') {
137
+ this.recovery = recovery;
138
+ return true;
139
+ }
140
+ else {
141
+ return false;
142
+ }
143
+ }
144
+ setRefreshCode(token) {
145
+ if (this.type === 'password') {
146
+ this.refreshCode = token;
147
+ return true;
148
+ }
149
+ else {
150
+ return false;
151
+ }
152
+ }
153
+ };
154
+ exports.Credential = Credential;
155
+ __decorate([
156
+ (0, flux_1.FluxIdentifier)()
157
+ ], Credential.prototype, "id", void 0);
158
+ __decorate([
159
+ (0, flux_1.FluxColumn)(naming_1.naming.credentials.columns.name)
160
+ ], Credential.prototype, "name", void 0);
161
+ __decorate([
162
+ (0, flux_1.FluxColumn)(naming_1.naming.credentials.columns.user_id)
163
+ ], Credential.prototype, "user_id", void 0);
164
+ __decorate([
165
+ (0, flux_1.FluxColumn)(naming_1.naming.credentials.columns.type)
166
+ ], Credential.prototype, "type", void 0);
167
+ __decorate([
168
+ (0, flux_1.FluxColumn)(naming_1.naming.credentials.columns.status)
169
+ ], Credential.prototype, "status", void 0);
170
+ __decorate([
171
+ (0, flux_1.FluxColumn)(naming_1.naming.credentials.columns.confirmation)
172
+ ], Credential.prototype, "confirmation", void 0);
173
+ __decorate([
174
+ (0, flux_1.FluxColumn)(naming_1.naming.credentials.columns.invite)
175
+ ], Credential.prototype, "invite", void 0);
176
+ __decorate([
177
+ (0, flux_1.FluxColumn)(naming_1.naming.credentials.columns.recovery)
178
+ ], Credential.prototype, "recovery", void 0);
179
+ exports.Credential = Credential = __decorate([
180
+ (0, flux_1.FluxTable)(naming_1.naming.credentials.table)
181
+ ], Credential);
182
+ class Password {
183
+ constructor() {
184
+ this.hash = '';
185
+ this.salt = '';
186
+ this.length = 0;
187
+ this.iterations = 0;
188
+ this.lastChangedAt = date_1.DateObject.now().toUtc();
189
+ }
190
+ create(base64Password) {
191
+ this.setPassword(base64Password);
192
+ return this;
193
+ }
194
+ clone(model) {
195
+ this.length = model.length;
196
+ this.iterations = model.iterations;
197
+ this.salt = model.salt;
198
+ this.hash = model.hash;
199
+ return this;
200
+ }
201
+ checkPasswordCorrectness(base64password) {
202
+ return this.hash === this.getHash(base64password);
203
+ }
204
+ setPassword(base64Password) {
205
+ this.length = settings_1.authSettings.passwordHashLength;
206
+ this.iterations = settings_1.authSettings.passwordHashIterations;
207
+ this.salt = crypto_1.cryptoProvider.generateSalt(this.length);
208
+ this.hash = this.getHash(base64Password);
209
+ this.lastChangedAt = date_1.DateObject.now().toUtc();
210
+ }
211
+ getHash(base64Password) {
212
+ return crypto_1.cryptoProvider.generateHash(base64Password, this.salt, this.iterations, this.length);
213
+ }
214
+ }
215
+ exports.Password = Password;
216
+ class Sso {
217
+ }
218
+ exports.Sso = Sso;
219
+ class Token {
220
+ }
221
+ exports.Token = Token;
@@ -0,0 +1,4 @@
1
+ import { Credential, CredentialType } from './credential';
2
+ import { Role, UserAccess, Permission } from './role';
3
+ import { User, UserType } from './user';
4
+ export { Credential, CredentialType, Role, UserAccess, Permission, User, UserType };
@@ -0,0 +1,11 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.User = exports.Permission = exports.UserAccess = exports.Role = exports.Credential = void 0;
4
+ const credential_1 = require("./credential");
5
+ Object.defineProperty(exports, "Credential", { enumerable: true, get: function () { return credential_1.Credential; } });
6
+ const role_1 = require("./role");
7
+ Object.defineProperty(exports, "Role", { enumerable: true, get: function () { return role_1.Role; } });
8
+ Object.defineProperty(exports, "UserAccess", { enumerable: true, get: function () { return role_1.UserAccess; } });
9
+ Object.defineProperty(exports, "Permission", { enumerable: true, get: function () { return role_1.Permission; } });
10
+ const user_1 = require("./user");
11
+ Object.defineProperty(exports, "User", { enumerable: true, get: function () { return user_1.User; } });
@@ -0,0 +1,50 @@
1
+ export declare const naming: {
2
+ users: {
3
+ table: string;
4
+ columns: {
5
+ account_id: string;
6
+ type: string;
7
+ status: string;
8
+ };
9
+ indexes: {
10
+ by_account: string;
11
+ by_type: string;
12
+ };
13
+ };
14
+ credentials: {
15
+ table: string;
16
+ columns: {
17
+ name: string;
18
+ user_id: string;
19
+ type: string;
20
+ status: string;
21
+ confirmation: string;
22
+ invite: string;
23
+ recovery: string;
24
+ };
25
+ };
26
+ roles: {
27
+ table: string;
28
+ };
29
+ permissions: {
30
+ table: string;
31
+ };
32
+ user_access: {
33
+ table: string;
34
+ columns: {
35
+ account_id: string;
36
+ user_id: string;
37
+ permission_id: string;
38
+ role_id: string;
39
+ };
40
+ indexes: {
41
+ user_account: string;
42
+ user_permission: string;
43
+ user_role: string;
44
+ account_permission: string;
45
+ account_role: string;
46
+ account_user: string;
47
+ role_permission: string;
48
+ };
49
+ };
50
+ };
@@ -0,0 +1,53 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.naming = void 0;
4
+ exports.naming = {
5
+ users: {
6
+ table: 'authentication.users',
7
+ columns: {
8
+ account_id: 'account_id',
9
+ type: 'type',
10
+ status: 'status',
11
+ },
12
+ indexes: {
13
+ by_account: 'by_account',
14
+ by_type: 'by_type',
15
+ }
16
+ },
17
+ credentials: {
18
+ table: 'authentication.credentials',
19
+ columns: {
20
+ name: 'name',
21
+ user_id: 'user_id',
22
+ type: 'type',
23
+ status: 'status',
24
+ confirmation: 'confirmation',
25
+ invite: 'invite',
26
+ recovery: 'recovery',
27
+ }
28
+ },
29
+ roles: {
30
+ table: 'authentication.roles'
31
+ },
32
+ permissions: {
33
+ table: 'authentication.permissions'
34
+ },
35
+ user_access: {
36
+ table: 'authentication.user_access',
37
+ columns: {
38
+ account_id: 'account_id',
39
+ user_id: 'user_id',
40
+ permission_id: 'permission_id',
41
+ role_id: 'role_id',
42
+ },
43
+ indexes: {
44
+ user_account: 'user_account',
45
+ user_permission: 'user_permission',
46
+ user_role: 'user_role',
47
+ account_permission: 'account_permission',
48
+ account_role: 'account_role',
49
+ account_user: 'account_user',
50
+ role_permission: 'role_permission',
51
+ }
52
+ }
53
+ };
@@ -0,0 +1,28 @@
1
+ import { IFluxObject } from '@hapiboo/flux';
2
+ export declare class Role {
3
+ id: string;
4
+ name: string;
5
+ description: string;
6
+ lucide_icon: string;
7
+ permissions: string[];
8
+ clone(model: this): this;
9
+ create(id: string, name: string, description: string, lucide_icon: string, permissions: string[]): Role;
10
+ edit(name: string, description: string, lucide_icon: string, permissions: string[]): Role;
11
+ }
12
+ export declare class Permission implements IFluxObject {
13
+ id: string;
14
+ name: string;
15
+ constructor();
16
+ clone(model: this): this;
17
+ create(id: string, name: string): Permission;
18
+ }
19
+ export declare class UserAccess {
20
+ id: string;
21
+ account_id: string;
22
+ user_id: string;
23
+ permission_id: string;
24
+ role_id: string | undefined;
25
+ clone(model: this): this;
26
+ createFromRole(id: string, account_id: string, user_id: string, role_id: string, permission_id: string): UserAccess;
27
+ createFromPermission(id: string, account_id: string, user_id: string, permission_id: string): UserAccess;
28
+ }
@@ -0,0 +1,133 @@
1
+ "use strict";
2
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
5
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
6
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
7
+ };
8
+ Object.defineProperty(exports, "__esModule", { value: true });
9
+ exports.UserAccess = exports.Permission = exports.Role = void 0;
10
+ const flux_1 = require("@hapiboo/flux");
11
+ const naming_1 = require("./naming");
12
+ let Role = class Role {
13
+ constructor() {
14
+ this.id = '';
15
+ this.name = '';
16
+ this.description = '';
17
+ this.lucide_icon = '';
18
+ this.permissions = [];
19
+ }
20
+ clone(model) {
21
+ this.id = model.id;
22
+ this.name = model.name;
23
+ this.description = model.description;
24
+ this.lucide_icon = model.lucide_icon;
25
+ this.permissions = [...model.permissions];
26
+ return this;
27
+ }
28
+ create(id, name, description, lucide_icon, permissions) {
29
+ this.id = id;
30
+ this.name = name;
31
+ this.description = description;
32
+ this.lucide_icon = lucide_icon;
33
+ this.permissions = permissions;
34
+ return this;
35
+ }
36
+ edit(name, description, lucide_icon, permissions) {
37
+ this.name = name;
38
+ this.description = description;
39
+ this.lucide_icon = lucide_icon;
40
+ this.permissions = permissions;
41
+ return this;
42
+ }
43
+ };
44
+ exports.Role = Role;
45
+ __decorate([
46
+ (0, flux_1.FluxIdentifier)()
47
+ ], Role.prototype, "id", void 0);
48
+ exports.Role = Role = __decorate([
49
+ (0, flux_1.FluxTable)(naming_1.naming.roles.table)
50
+ ], Role);
51
+ let Permission = class Permission {
52
+ constructor() {
53
+ this.id = '';
54
+ this.name = '';
55
+ return this;
56
+ }
57
+ clone(model) {
58
+ this.id = model.id;
59
+ this.name = model.name;
60
+ return this;
61
+ }
62
+ create(id, name) {
63
+ this.id = id;
64
+ this.name = name;
65
+ return this;
66
+ }
67
+ };
68
+ exports.Permission = Permission;
69
+ __decorate([
70
+ (0, flux_1.FluxIdentifier)()
71
+ ], Permission.prototype, "id", void 0);
72
+ exports.Permission = Permission = __decorate([
73
+ (0, flux_1.FluxTable)(naming_1.naming.permissions.table)
74
+ ], Permission);
75
+ let UserAccess = class UserAccess {
76
+ constructor() {
77
+ this.id = '';
78
+ this.account_id = '';
79
+ this.user_id = '';
80
+ this.permission_id = '';
81
+ }
82
+ clone(model) {
83
+ this.id = model.id;
84
+ this.account_id = model.account_id;
85
+ this.user_id = model.user_id;
86
+ this.role_id = model.role_id;
87
+ this.permission_id = model.permission_id;
88
+ return this;
89
+ }
90
+ createFromRole(id, account_id, user_id, role_id, permission_id) {
91
+ this.id = id;
92
+ this.account_id = account_id;
93
+ this.user_id = user_id;
94
+ this.permission_id = permission_id;
95
+ this.role_id = role_id;
96
+ return this;
97
+ }
98
+ createFromPermission(id, account_id, user_id, permission_id) {
99
+ this.id = id;
100
+ this.account_id = account_id;
101
+ this.user_id = user_id;
102
+ this.permission_id = permission_id;
103
+ this.role_id = undefined;
104
+ return this;
105
+ }
106
+ };
107
+ exports.UserAccess = UserAccess;
108
+ __decorate([
109
+ (0, flux_1.FluxIdentifier)()
110
+ ], UserAccess.prototype, "id", void 0);
111
+ __decorate([
112
+ (0, flux_1.FluxColumn)(naming_1.naming.user_access.columns.account_id)
113
+ ], UserAccess.prototype, "account_id", void 0);
114
+ __decorate([
115
+ (0, flux_1.FluxColumn)(naming_1.naming.user_access.columns.user_id)
116
+ ], UserAccess.prototype, "user_id", void 0);
117
+ __decorate([
118
+ (0, flux_1.FluxColumn)(naming_1.naming.user_access.columns.permission_id)
119
+ ], UserAccess.prototype, "permission_id", void 0);
120
+ __decorate([
121
+ (0, flux_1.FluxColumn)(naming_1.naming.user_access.columns.role_id)
122
+ ], UserAccess.prototype, "role_id", void 0);
123
+ exports.UserAccess = UserAccess = __decorate([
124
+ (0, flux_1.FluxTable)(naming_1.naming.user_access.table),
125
+ (0, flux_1.FluxIndex)(naming_1.naming.user_access.indexes.user_account, naming_1.naming.user_access.columns.user_id, naming_1.naming.user_access.columns.account_id),
126
+ (0, flux_1.FluxIndex)(naming_1.naming.user_access.indexes.user_permission, naming_1.naming.user_access.columns.user_id, naming_1.naming.user_access.columns.permission_id)
127
+ //@FluxIndex(naming.user_access.indexes.user_role, naming.user_access.columns.user_id, naming.user_access.columns.role_id)
128
+ //@FluxIndex(naming.user_access.indexes.account_permission, naming.user_access.columns.account_id, naming.user_access.columns.permission_id)
129
+ //@FluxIndex(naming.user_access.indexes.account_role, naming.user_access.columns.account_id, naming.user_access.columns.role_id)
130
+ ,
131
+ (0, flux_1.FluxIndex)(naming_1.naming.user_access.indexes.account_user, naming_1.naming.user_access.columns.account_id, naming_1.naming.user_access.columns.user_id)
132
+ //@FluxIndex(naming.user_access.indexes.role_permission, naming.user_access.columns.role_id, naming.user_access.columns.permission_id)
133
+ ], UserAccess);
@@ -0,0 +1,25 @@
1
+ export type UserType = 'standard' | 'admin';
2
+ export type UserStatus = 'created' | 'active' | 'banned' | 'deleted';
3
+ export declare class User {
4
+ id: string;
5
+ account_id: string;
6
+ type: UserType;
7
+ status: UserStatus;
8
+ profile: Profile;
9
+ createdAt: string;
10
+ updatedAt: string;
11
+ lastLoginAt: string;
12
+ clone(model: this): this;
13
+ create(id: string, account_id: string | undefined, type: UserType, status: UserStatus, display: string, email: string): User;
14
+ updateName(name: string): this;
15
+ confirm(): this;
16
+ }
17
+ export declare class Profile {
18
+ display: string;
19
+ email: string;
20
+ phone: string;
21
+ locale: string;
22
+ avatarUrl: string;
23
+ clone(model: this): this;
24
+ create(display: string, email: string): Profile;
25
+ }