@andrewcaires/api 4.4.1 → 4.5.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.
- package/LICENSE +1 -1
- package/dist/index.cjs.js +3 -3
- package/dist/index.d.ts +132 -160
- package/dist/index.esm.js +3 -3
- package/package.json +16 -16
package/dist/index.d.ts
CHANGED
|
@@ -1,117 +1,60 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* @andrewcaires/api v4.
|
|
2
|
+
* @andrewcaires/api v4.5.0
|
|
3
3
|
* Simple api for small applications using express, jsonwebtoken, sequelize and websocket
|
|
4
|
-
* (c)
|
|
4
|
+
* (c) 2026 Andrew Caires
|
|
5
5
|
* @license: MIT
|
|
6
6
|
*/
|
|
7
|
-
import {
|
|
8
|
-
import { EventEmitter, TypeObjectAny, TypeObjectString, TypeObject, ValidationBase, TypeCallbackFunction } from '@andrewcaires/utils.js';
|
|
7
|
+
import { EventEmitter, TypeAnyObject, TypeObjectString, TypeObject, ValidationBase, TypeAnyFunction } from '@andrewcaires/utils.js';
|
|
9
8
|
import { Application as Application$1, Context, IStore, IUpload, IFile } from '@andrewcaires/express';
|
|
10
|
-
import { WhereOptions, Model as Model$
|
|
11
|
-
import { Model
|
|
9
|
+
import { WhereOptions, Model as Model$1, CreateOptions, Attributes, FindOptions, UpdateOptions, FindAttributeOptions, ModelStatic } from 'sequelize';
|
|
10
|
+
import { Model, Sequelize } from '@andrewcaires/sequelize';
|
|
11
|
+
import { Hash, Env as Env$1 } from '@andrewcaires/node';
|
|
12
12
|
import { WebSocketServer } from 'ws';
|
|
13
13
|
import { Store as Store$1, SessionData } from 'express-session';
|
|
14
14
|
|
|
15
|
-
declare class Env extends Env$1 {
|
|
16
|
-
static readonly API_BASE_NAME: string;
|
|
17
|
-
static readonly API_BODYPARSER_STRICT: boolean;
|
|
18
|
-
static readonly API_BODYPARSER_INFLATE: boolean;
|
|
19
|
-
static readonly API_BODYPARSER_LIMIT: string;
|
|
20
|
-
static readonly API_BODYPARSER_TYPE: string;
|
|
21
|
-
static readonly API_CONSOLE_ERROR: boolean;
|
|
22
|
-
static readonly API_DB_DATABASE: string;
|
|
23
|
-
static readonly API_DB_HOST: string;
|
|
24
|
-
static readonly API_DB_PASSWORD: string;
|
|
25
|
-
static readonly API_DB_PORT: number;
|
|
26
|
-
static readonly API_DB_TYPE: string;
|
|
27
|
-
static readonly API_DB_USERNAME: string;
|
|
28
|
-
static readonly API_DB_LOG: boolean;
|
|
29
|
-
static readonly API_DB_AUDIT: boolean;
|
|
30
|
-
static readonly API_DB_PREFIX: string;
|
|
31
|
-
static readonly API_DB_TIMEZONE: string;
|
|
32
|
-
static readonly API_HTTP_CRT: string;
|
|
33
|
-
static readonly API_HTTP_KEY: string;
|
|
34
|
-
static readonly API_HTTP_PORT: number;
|
|
35
|
-
static readonly API_HTTP_PUBLIC: string;
|
|
36
|
-
static readonly API_HTTP_CROSS: boolean;
|
|
37
|
-
static readonly API_HTTP_HYBRID: boolean;
|
|
38
|
-
static readonly API_HTTP_NOTFOUND: string;
|
|
39
|
-
static readonly API_HTTP_PATH: string;
|
|
40
|
-
static readonly API_HTTP_REDIRECT: string;
|
|
41
|
-
static readonly API_KEY_HASH: string;
|
|
42
|
-
static readonly API_KEY_HEADER: string;
|
|
43
|
-
static readonly API_MODEL_LIMIT: number;
|
|
44
|
-
static readonly API_MODEL_LIMIT_MAX: number;
|
|
45
|
-
static readonly API_SLEEP_AUTH: number;
|
|
46
|
-
static readonly API_SLEEP_FORGOT: number;
|
|
47
|
-
static readonly API_SLEEP_REGISTRY: number;
|
|
48
|
-
static readonly API_SESSION_NAME: string;
|
|
49
|
-
static readonly API_SESSION_LIFETIME: number;
|
|
50
|
-
static readonly API_SESSION_SECRET: string;
|
|
51
|
-
static readonly API_TOKEN_CRT: string;
|
|
52
|
-
static readonly API_TOKEN_KEY: string;
|
|
53
|
-
static readonly API_TOKEN_FORGOT: number;
|
|
54
|
-
static readonly API_TOKEN_HEADER: string;
|
|
55
|
-
static readonly API_TOKEN_HEADER_KEY: string;
|
|
56
|
-
static readonly API_TOKEN_LIFETIME: number;
|
|
57
|
-
static readonly API_TOKEN_RENEW: number;
|
|
58
|
-
static readonly API_UPLOAD_COUNT: number;
|
|
59
|
-
static readonly API_UPLOAD_FIELD: string;
|
|
60
|
-
static readonly API_UPLOAD_SIZE: number;
|
|
61
|
-
static readonly API_UPLOAD_TEMP: string;
|
|
62
|
-
static readonly API_USER_HISTORY: boolean;
|
|
63
|
-
static readonly API_WEBSOCKET_START: boolean;
|
|
64
|
-
}
|
|
65
|
-
|
|
66
15
|
declare abstract class Controller extends EventEmitter {
|
|
67
16
|
static readonly ATTRIBUTES: unique symbol;
|
|
68
17
|
static readonly PERMISSIONS: unique symbol;
|
|
69
18
|
}
|
|
70
19
|
|
|
71
|
-
declare class Model extends Model$1 {
|
|
72
|
-
protected static error(error: any): void;
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
declare const database: Connection;
|
|
76
|
-
|
|
77
20
|
declare class Auth extends Model {
|
|
78
|
-
id: number;
|
|
21
|
+
readonly id: number;
|
|
79
22
|
secret: string;
|
|
80
23
|
logout: Date | null;
|
|
81
24
|
user_agent: string;
|
|
82
|
-
created_at: Date;
|
|
83
|
-
updated_at: Date;
|
|
84
|
-
deleted_at: Date | null;
|
|
25
|
+
readonly created_at: Date;
|
|
26
|
+
readonly updated_at: Date;
|
|
27
|
+
readonly deleted_at: Date | null;
|
|
85
28
|
user_id: number;
|
|
86
29
|
user: User;
|
|
87
30
|
}
|
|
88
31
|
|
|
89
32
|
declare class Register extends Model {
|
|
90
|
-
id: number;
|
|
33
|
+
readonly id: number;
|
|
91
34
|
token: string;
|
|
92
35
|
state: boolean;
|
|
93
|
-
created_at: Date;
|
|
94
|
-
updated_at: Date;
|
|
95
|
-
deleted_at: Date | null;
|
|
36
|
+
readonly created_at: Date;
|
|
37
|
+
readonly updated_at: Date;
|
|
38
|
+
readonly deleted_at: Date | null;
|
|
96
39
|
user_id: number;
|
|
97
40
|
user: User;
|
|
98
41
|
}
|
|
99
42
|
|
|
100
43
|
declare class Permission extends Model {
|
|
101
|
-
id: number;
|
|
44
|
+
readonly id: number;
|
|
102
45
|
name: string;
|
|
103
46
|
route: string;
|
|
104
47
|
tag: string;
|
|
105
48
|
description: string;
|
|
106
49
|
state: boolean;
|
|
107
|
-
created_at: Date;
|
|
108
|
-
updated_at: Date;
|
|
109
|
-
deleted_at: Date | null;
|
|
50
|
+
readonly created_at: Date;
|
|
51
|
+
readonly updated_at: Date;
|
|
52
|
+
readonly deleted_at: Date | null;
|
|
110
53
|
groups_permissions: Array<GroupPermission>;
|
|
111
54
|
}
|
|
112
55
|
|
|
113
56
|
declare class GroupPermission extends Model {
|
|
114
|
-
created_at: Date;
|
|
57
|
+
readonly created_at: Date;
|
|
115
58
|
group_id: number;
|
|
116
59
|
group: Group;
|
|
117
60
|
permission_id: number;
|
|
@@ -119,19 +62,19 @@ declare class GroupPermission extends Model {
|
|
|
119
62
|
}
|
|
120
63
|
|
|
121
64
|
declare class Group extends Model {
|
|
122
|
-
id: number;
|
|
65
|
+
readonly id: number;
|
|
123
66
|
name: string;
|
|
124
67
|
description: string;
|
|
125
68
|
state: boolean;
|
|
126
|
-
created_at: Date;
|
|
127
|
-
updated_at: Date;
|
|
128
|
-
deleted_at: Date | null;
|
|
69
|
+
readonly created_at: Date;
|
|
70
|
+
readonly updated_at: Date;
|
|
71
|
+
readonly deleted_at: Date | null;
|
|
129
72
|
groups_routes: Array<GroupPermission>;
|
|
130
73
|
users_groups: Array<UserGroup>;
|
|
131
74
|
}
|
|
132
75
|
|
|
133
76
|
declare class UserGroup extends Model {
|
|
134
|
-
created_at: Date;
|
|
77
|
+
readonly created_at: Date;
|
|
135
78
|
group_id: number;
|
|
136
79
|
group: Group;
|
|
137
80
|
user_id: number;
|
|
@@ -140,13 +83,13 @@ declare class UserGroup extends Model {
|
|
|
140
83
|
|
|
141
84
|
declare class UserHistory extends Model {
|
|
142
85
|
password: string;
|
|
143
|
-
created_at: Date;
|
|
86
|
+
readonly created_at: Date;
|
|
144
87
|
user_id: number;
|
|
145
88
|
user: User;
|
|
146
89
|
}
|
|
147
90
|
|
|
148
91
|
declare class User extends Model {
|
|
149
|
-
id: number;
|
|
92
|
+
readonly id: number;
|
|
150
93
|
name: string;
|
|
151
94
|
email: string;
|
|
152
95
|
username: string;
|
|
@@ -157,9 +100,9 @@ declare class User extends Model {
|
|
|
157
100
|
date: string;
|
|
158
101
|
description: string;
|
|
159
102
|
state: boolean;
|
|
160
|
-
created_at: Date;
|
|
161
|
-
updated_at: Date;
|
|
162
|
-
deleted_at: Date | null;
|
|
103
|
+
readonly created_at: Date;
|
|
104
|
+
readonly updated_at: Date;
|
|
105
|
+
readonly deleted_at: Date | null;
|
|
163
106
|
audits: Array<Audit>;
|
|
164
107
|
auths: Array<Auth>;
|
|
165
108
|
registers: Array<Register>;
|
|
@@ -168,19 +111,19 @@ declare class User extends Model {
|
|
|
168
111
|
}
|
|
169
112
|
|
|
170
113
|
declare class Audit extends Model {
|
|
171
|
-
id: number;
|
|
114
|
+
readonly id: number;
|
|
172
115
|
type: string;
|
|
173
116
|
model: string;
|
|
174
117
|
record: string;
|
|
175
|
-
data:
|
|
176
|
-
previously:
|
|
118
|
+
data: TypeAnyObject;
|
|
119
|
+
previously: TypeAnyObject;
|
|
177
120
|
client: string;
|
|
178
121
|
href: string;
|
|
179
122
|
user_agent: string;
|
|
180
123
|
state: boolean;
|
|
181
|
-
created_at: Date;
|
|
182
|
-
updated_at: Date;
|
|
183
|
-
deleted_at: Date | null;
|
|
124
|
+
readonly created_at: Date;
|
|
125
|
+
readonly updated_at: Date;
|
|
126
|
+
readonly deleted_at: Date | null;
|
|
184
127
|
user_id: number;
|
|
185
128
|
user: User;
|
|
186
129
|
}
|
|
@@ -188,8 +131,8 @@ declare class Audit extends Model {
|
|
|
188
131
|
declare class Config extends Model {
|
|
189
132
|
key: string;
|
|
190
133
|
value: string;
|
|
191
|
-
created_at: Date;
|
|
192
|
-
updated_at: Date;
|
|
134
|
+
readonly created_at: Date;
|
|
135
|
+
readonly updated_at: Date;
|
|
193
136
|
static all(): Promise<TypeObjectString>;
|
|
194
137
|
static del(key: string, user?: User): Promise<boolean>;
|
|
195
138
|
static get(key: string, value?: string): Promise<string>;
|
|
@@ -197,23 +140,23 @@ declare class Config extends Model {
|
|
|
197
140
|
}
|
|
198
141
|
|
|
199
142
|
declare class Forgot extends Model {
|
|
200
|
-
id: number;
|
|
143
|
+
readonly id: number;
|
|
201
144
|
token: string;
|
|
202
145
|
timestamp: number;
|
|
203
146
|
state: boolean;
|
|
204
|
-
created_at: Date;
|
|
205
|
-
updated_at: Date;
|
|
206
|
-
deleted_at: Date | null;
|
|
147
|
+
readonly created_at: Date;
|
|
148
|
+
readonly updated_at: Date;
|
|
149
|
+
readonly deleted_at: Date | null;
|
|
207
150
|
user_id: number;
|
|
208
151
|
user: User;
|
|
209
152
|
}
|
|
210
153
|
|
|
211
154
|
declare class Log extends Model {
|
|
212
|
-
id: number;
|
|
155
|
+
readonly id: number;
|
|
213
156
|
type: string;
|
|
214
157
|
source: string;
|
|
215
158
|
message: string;
|
|
216
|
-
created_at: Date;
|
|
159
|
+
readonly created_at: Date;
|
|
217
160
|
static write(message: string, source?: string, show?: boolean): Promise<void>;
|
|
218
161
|
static error(message: string, source?: string, show?: boolean): Promise<void>;
|
|
219
162
|
static info(message: string, source?: string, show?: boolean): Promise<void>;
|
|
@@ -225,16 +168,16 @@ declare class Log extends Model {
|
|
|
225
168
|
declare class Migration extends Model {
|
|
226
169
|
model: string;
|
|
227
170
|
version: string;
|
|
228
|
-
created_at: Date;
|
|
229
|
-
updated_at: Date;
|
|
171
|
+
readonly created_at: Date;
|
|
172
|
+
readonly updated_at: Date;
|
|
230
173
|
}
|
|
231
174
|
|
|
232
175
|
declare class Session extends Model {
|
|
233
176
|
session: string;
|
|
234
177
|
json: string;
|
|
235
178
|
expired: number;
|
|
236
|
-
created_at: Date;
|
|
237
|
-
updated_at: Date;
|
|
179
|
+
readonly created_at: Date;
|
|
180
|
+
readonly updated_at: Date;
|
|
238
181
|
}
|
|
239
182
|
|
|
240
183
|
declare class Application extends Application$1 {
|
|
@@ -244,7 +187,7 @@ declare class Application extends Application$1 {
|
|
|
244
187
|
error(error: any, source?: string): void;
|
|
245
188
|
log(message: string, source?: string): void;
|
|
246
189
|
listen(): Promise<void>;
|
|
247
|
-
migrations(database:
|
|
190
|
+
migrations(database: Sequelize): Promise<void>;
|
|
248
191
|
websocket(): WebSocketServer | undefined;
|
|
249
192
|
}
|
|
250
193
|
|
|
@@ -265,22 +208,22 @@ declare abstract class ControllerBase extends Controller {
|
|
|
265
208
|
validation(ctx: Context, options: TypeObject<ValidationBase>): Promise<void>;
|
|
266
209
|
}
|
|
267
210
|
|
|
268
|
-
interface ArgumentsModel<M extends Model$
|
|
211
|
+
interface ArgumentsModel<M extends Model$1<M>> {
|
|
269
212
|
ctx: Context;
|
|
270
213
|
}
|
|
271
214
|
|
|
272
|
-
interface ArgumentsModelCreate<M extends Model$
|
|
215
|
+
interface ArgumentsModelCreate<M extends Model$1<M>> extends ArgumentsModel<M> {
|
|
273
216
|
options?: CreateOptions<Attributes<M>>;
|
|
274
|
-
body?:
|
|
217
|
+
body?: TypeAnyObject;
|
|
275
218
|
}
|
|
276
219
|
|
|
277
|
-
interface ArgumentsModelDelete<M extends Model$
|
|
220
|
+
interface ArgumentsModelDelete<M extends Model$1<M>> extends ArgumentsModel<M> {
|
|
278
221
|
options?: FindOptions<Attributes<M>>;
|
|
279
222
|
}
|
|
280
223
|
|
|
281
|
-
type CallbackModelAll<M> = (
|
|
224
|
+
type CallbackModelAll<M> = (_records: Array<M>) => Array<any> | Promise<Array<any>>;
|
|
282
225
|
|
|
283
|
-
interface ArgumentsModelFindAll<M extends Model$
|
|
226
|
+
interface ArgumentsModelFindAll<M extends Model$1<any>> extends ArgumentsModel<M> {
|
|
284
227
|
options?: FindOptions<Attributes<M>>;
|
|
285
228
|
callback?: CallbackModelAll<M>;
|
|
286
229
|
scope?: string;
|
|
@@ -289,46 +232,34 @@ interface ArgumentsModelFindAll<M extends Model$2<M>> extends ArgumentsModel<M>
|
|
|
289
232
|
limited?: boolean;
|
|
290
233
|
}
|
|
291
234
|
|
|
292
|
-
type CallbackModelGet<M> = (
|
|
235
|
+
type CallbackModelGet<M> = (_records: M) => any | Promise<any>;
|
|
293
236
|
|
|
294
|
-
interface ArgumentsModelFindOne<M extends Model$
|
|
237
|
+
interface ArgumentsModelFindOne<M extends Model$1<M>> extends ArgumentsModel<M> {
|
|
295
238
|
options?: FindOptions<Attributes<M>>;
|
|
296
239
|
callback?: CallbackModelGet<M>;
|
|
297
240
|
scope?: string;
|
|
298
241
|
}
|
|
299
242
|
|
|
300
|
-
interface ArgumentsModelUpdate<M extends Model$
|
|
243
|
+
interface ArgumentsModelUpdate<M extends Model$1<M>> extends ArgumentsModel<M> {
|
|
301
244
|
options?: UpdateOptions<Attributes<M>>;
|
|
302
|
-
body?:
|
|
245
|
+
body?: TypeAnyObject;
|
|
303
246
|
}
|
|
304
247
|
|
|
305
248
|
interface IAuthParameters {
|
|
306
249
|
auth?: Auth;
|
|
307
|
-
decode?:
|
|
250
|
+
decode?: TypeAnyObject;
|
|
308
251
|
error?: string;
|
|
309
252
|
forgot?: Forgot;
|
|
310
253
|
token?: string;
|
|
311
254
|
user?: User;
|
|
312
255
|
}
|
|
313
256
|
|
|
314
|
-
interface
|
|
315
|
-
database: string;
|
|
316
|
-
username: string;
|
|
317
|
-
password: string;
|
|
318
|
-
hostname: string;
|
|
319
|
-
hostport: number;
|
|
320
|
-
}
|
|
321
|
-
|
|
322
|
-
interface IMigrate {
|
|
323
|
-
version: string;
|
|
324
|
-
}
|
|
325
|
-
|
|
326
|
-
interface ResultModelAll<M extends Model$2<M>> {
|
|
257
|
+
interface ResultModelAll<M extends Model$1<M>> {
|
|
327
258
|
count: number;
|
|
328
259
|
records: Array<M>;
|
|
329
260
|
}
|
|
330
261
|
|
|
331
|
-
declare abstract class ControllerModel<M extends Model$
|
|
262
|
+
declare abstract class ControllerModel<M extends Model$1<any>> extends ControllerBase {
|
|
332
263
|
protected [ControllerBase.ATTRIBUTES]: Array<string>;
|
|
333
264
|
protected [ControllerBase.PERMISSIONS]: Array<string>;
|
|
334
265
|
protected attributes(options: FindAttributeOptions): Array<string>;
|
|
@@ -345,7 +276,7 @@ declare abstract class ControllerModel<M extends Model$2<M>> extends ControllerB
|
|
|
345
276
|
scope(name?: string): ModelStatic<M>;
|
|
346
277
|
}
|
|
347
278
|
|
|
348
|
-
declare abstract class ControllerCrud<M extends Model$
|
|
279
|
+
declare abstract class ControllerCrud<M extends Model$1<any>> extends ControllerModel<M> {
|
|
349
280
|
private _crud;
|
|
350
281
|
CrudArgumentsCreate(ctx: Context): ArgumentsModelUpdate<M>;
|
|
351
282
|
CrudArgumentsFindAll(ctx: Context): ArgumentsModelFindAll<M>;
|
|
@@ -363,6 +294,52 @@ declare abstract class ControllerCrud<M extends Model$2<M>> extends ControllerMo
|
|
|
363
294
|
protected validationUpdate(ctx: Context): Promise<void>;
|
|
364
295
|
}
|
|
365
296
|
|
|
297
|
+
declare class Env extends Env$1 {
|
|
298
|
+
static readonly API_BASE_NAME: string;
|
|
299
|
+
static readonly API_BODYPARSER_STRICT: boolean;
|
|
300
|
+
static readonly API_BODYPARSER_INFLATE: boolean;
|
|
301
|
+
static readonly API_BODYPARSER_LIMIT: string;
|
|
302
|
+
static readonly API_BODYPARSER_TYPE: string;
|
|
303
|
+
static readonly API_CONSOLE_ERROR: boolean;
|
|
304
|
+
static readonly API_DATABASE_URL: string;
|
|
305
|
+
static readonly API_DATABASE_LOG: boolean;
|
|
306
|
+
static readonly API_DATABASE_AUDIT: boolean;
|
|
307
|
+
static readonly API_DATABASE_PREFIX: string;
|
|
308
|
+
static readonly API_DATABASE_TIMEZONE: string;
|
|
309
|
+
static readonly API_HTTP_CRT: string;
|
|
310
|
+
static readonly API_HTTP_KEY: string;
|
|
311
|
+
static readonly API_HTTP_PORT: number;
|
|
312
|
+
static readonly API_HTTP_PUBLIC: string;
|
|
313
|
+
static readonly API_HTTP_CROSS: boolean;
|
|
314
|
+
static readonly API_HTTP_HYBRID: boolean;
|
|
315
|
+
static readonly API_HTTP_NOTFOUND: string;
|
|
316
|
+
static readonly API_HTTP_PATH: string;
|
|
317
|
+
static readonly API_HTTP_REDIRECT: string;
|
|
318
|
+
static readonly API_KEY_HASH: string;
|
|
319
|
+
static readonly API_KEY_HEADER: string;
|
|
320
|
+
static readonly API_MODEL_LIMIT: number;
|
|
321
|
+
static readonly API_MODEL_LIMIT_MAX: number;
|
|
322
|
+
static readonly API_SLEEP_AUTH: number;
|
|
323
|
+
static readonly API_SLEEP_FORGOT: number;
|
|
324
|
+
static readonly API_SLEEP_REGISTRY: number;
|
|
325
|
+
static readonly API_SESSION_NAME: string;
|
|
326
|
+
static readonly API_SESSION_LIFETIME: number;
|
|
327
|
+
static readonly API_SESSION_SECRET: string;
|
|
328
|
+
static readonly API_TOKEN_CRT: string;
|
|
329
|
+
static readonly API_TOKEN_KEY: string;
|
|
330
|
+
static readonly API_TOKEN_FORGOT: number;
|
|
331
|
+
static readonly API_TOKEN_HEADER: string;
|
|
332
|
+
static readonly API_TOKEN_HEADER_KEY: string;
|
|
333
|
+
static readonly API_TOKEN_LIFETIME: number;
|
|
334
|
+
static readonly API_TOKEN_RENEW: number;
|
|
335
|
+
static readonly API_UPLOAD_COUNT: number;
|
|
336
|
+
static readonly API_UPLOAD_FIELD: string;
|
|
337
|
+
static readonly API_UPLOAD_SIZE: number;
|
|
338
|
+
static readonly API_UPLOAD_TEMP: string;
|
|
339
|
+
static readonly API_USER_HISTORY: boolean;
|
|
340
|
+
static readonly API_WEBSOCKET_START: boolean;
|
|
341
|
+
}
|
|
342
|
+
|
|
366
343
|
declare class AuditsController extends ControllerModel<Audit> {
|
|
367
344
|
model(): typeof Audit;
|
|
368
345
|
protected all(ctx: Context, type: string, table: string): Promise<void>;
|
|
@@ -379,7 +356,7 @@ declare class AuthController extends ControllerBase {
|
|
|
379
356
|
declare class FilesController extends ControllerBase {
|
|
380
357
|
protected [ControllerBase.PERMISSIONS]: Array<string>;
|
|
381
358
|
directory(): string;
|
|
382
|
-
protected files(ctx: Context): Promise<
|
|
359
|
+
protected files(ctx: Context): Promise<TypeAnyObject | void>;
|
|
383
360
|
protected access(ctx: Context, name: string, user: User): Promise<void>;
|
|
384
361
|
private info;
|
|
385
362
|
name(): string;
|
|
@@ -406,7 +383,7 @@ declare class GroupsPermissionsController extends ControllerModel<GroupPermissio
|
|
|
406
383
|
model(): typeof GroupPermission;
|
|
407
384
|
protected all(ctx: Context, group_id: string): Promise<void>;
|
|
408
385
|
protected me(ctx: Context, user: User): Promise<void>;
|
|
409
|
-
protected set(ctx: Context, id: string, permissions: Array<number>, audit:
|
|
386
|
+
protected set(ctx: Context, id: string, permissions: Array<number>, audit: TypeAnyObject): Promise<void>;
|
|
410
387
|
}
|
|
411
388
|
|
|
412
389
|
declare class LogsController extends ControllerModel<Log> {
|
|
@@ -425,27 +402,27 @@ declare class PermissionsController extends ControllerCrud<Permission> {
|
|
|
425
402
|
}
|
|
426
403
|
|
|
427
404
|
declare class RegisterController extends ControllerBase {
|
|
428
|
-
protected register(ctx: Context, body:
|
|
405
|
+
protected register(ctx: Context, body: TypeAnyObject, app: Application): Promise<void>;
|
|
429
406
|
protected confirm(ctx: Context, token: string, app: Application): Promise<void>;
|
|
430
407
|
protected send(ctx: Context, username: string, app: Application): Promise<void>;
|
|
431
408
|
private getId;
|
|
432
409
|
}
|
|
433
410
|
|
|
434
411
|
declare class SetupController extends ControllerBase {
|
|
435
|
-
protected setup(ctx: Context, audit:
|
|
412
|
+
protected setup(ctx: Context, audit: TypeAnyObject): Promise<void>;
|
|
436
413
|
}
|
|
437
414
|
|
|
438
415
|
declare class UsersController extends ControllerModel<User> {
|
|
439
416
|
path: string;
|
|
440
417
|
model(): typeof User;
|
|
441
418
|
constructor();
|
|
442
|
-
protected avatar(ctx: Context, files: Array<IFile>, user: User, audit:
|
|
443
|
-
protected avatar_del(ctx: Context, user: User, audit:
|
|
444
|
-
protected password(ctx: Context, oldPassword: string, newPassword: string, user: User, audit:
|
|
419
|
+
protected avatar(ctx: Context, files: Array<IFile>, user: User, audit: TypeAnyObject): Promise<void>;
|
|
420
|
+
protected avatar_del(ctx: Context, user: User, audit: TypeAnyObject): Promise<void>;
|
|
421
|
+
protected password(ctx: Context, oldPassword: string, newPassword: string, user: User, audit: TypeAnyObject): Promise<void>;
|
|
445
422
|
protected token(ctx: Context, user: User, app: Application): Promise<void>;
|
|
446
|
-
protected token_del(ctx: Context, id: string, audit:
|
|
423
|
+
protected token_del(ctx: Context, id: string, audit: TypeAnyObject): Promise<void>;
|
|
447
424
|
protected token_get(ctx: Context, id: string, app: Application): Promise<void>;
|
|
448
|
-
protected token_renew(ctx: Context, id: string, audit:
|
|
425
|
+
protected token_renew(ctx: Context, id: string, audit: TypeAnyObject, app: Application): Promise<void>;
|
|
449
426
|
private token_new;
|
|
450
427
|
protected add(ctx: Context, password: string): Promise<void>;
|
|
451
428
|
protected all(ctx: Context): Promise<void>;
|
|
@@ -458,9 +435,11 @@ declare class UsersGroupsController extends ControllerModel<UserGroup> {
|
|
|
458
435
|
model(): typeof UserGroup;
|
|
459
436
|
protected all(ctx: Context, user_id: string): Promise<void>;
|
|
460
437
|
protected me(ctx: Context, user: User): Promise<void>;
|
|
461
|
-
protected set(ctx: Context, id: string, groups: Array<number>, audit:
|
|
438
|
+
protected set(ctx: Context, id: string, groups: Array<number>, audit: TypeAnyObject): Promise<void>;
|
|
462
439
|
}
|
|
463
440
|
|
|
441
|
+
declare const database: Sequelize;
|
|
442
|
+
|
|
464
443
|
declare const ReqAudit: (key?: string) => ParameterDecorator;
|
|
465
444
|
|
|
466
445
|
declare const ReqAuth: (key?: string) => ParameterDecorator;
|
|
@@ -476,13 +455,6 @@ declare global {
|
|
|
476
455
|
}
|
|
477
456
|
}
|
|
478
457
|
|
|
479
|
-
declare const Migrate: (version: string) => ClassDecorator;
|
|
480
|
-
|
|
481
|
-
declare class Metadata {
|
|
482
|
-
static readonly MIGRATE: unique symbol;
|
|
483
|
-
static migrations(target: any): IMigrate;
|
|
484
|
-
}
|
|
485
|
-
|
|
486
458
|
declare class AuthBase {
|
|
487
459
|
protected static error(error: any): void;
|
|
488
460
|
}
|
|
@@ -500,12 +472,12 @@ declare class AuthToken extends AuthBase {
|
|
|
500
472
|
private static verify;
|
|
501
473
|
}
|
|
502
474
|
|
|
503
|
-
declare const audit: (ctx: Context) =>
|
|
475
|
+
declare const audit: (ctx: Context) => TypeAnyObject;
|
|
504
476
|
|
|
505
477
|
declare const hooks: {
|
|
506
|
-
afterCreate: (record: Model, options:
|
|
507
|
-
afterUpdate: (record: Model, options:
|
|
508
|
-
afterDestroy: (record: Model, options:
|
|
478
|
+
afterCreate: (record: Model, options: TypeAnyObject) => Promise<void>;
|
|
479
|
+
afterUpdate: (record: Model, options: TypeAnyObject) => Promise<void>;
|
|
480
|
+
afterDestroy: (record: Model, options: TypeAnyObject) => Promise<void>;
|
|
509
481
|
};
|
|
510
482
|
|
|
511
483
|
declare const crt: {
|
|
@@ -520,14 +492,14 @@ declare const key: {
|
|
|
520
492
|
declare class Store extends Store$1 {
|
|
521
493
|
private loop;
|
|
522
494
|
constructor();
|
|
523
|
-
all: (callback:
|
|
524
|
-
clear: (callback:
|
|
525
|
-
destroy: (session_id: string, callback:
|
|
495
|
+
all: (callback: TypeAnyFunction) => Promise<void>;
|
|
496
|
+
clear: (callback: TypeAnyFunction) => Promise<void>;
|
|
497
|
+
destroy: (session_id: string, callback: TypeAnyFunction) => Promise<void>;
|
|
526
498
|
expired: () => Promise<void>;
|
|
527
|
-
get: (session_id: string, callback:
|
|
528
|
-
length: (callback:
|
|
529
|
-
set: (session_id: any, session: SessionData, callback:
|
|
499
|
+
get: (session_id: string, callback: TypeAnyFunction) => Promise<void>;
|
|
500
|
+
length: (callback: TypeAnyFunction) => Promise<void>;
|
|
501
|
+
set: (session_id: any, session: SessionData, callback: TypeAnyFunction) => Promise<void>;
|
|
530
502
|
}
|
|
531
503
|
|
|
532
|
-
export { Application, Audit, AuditsController, Auth, AuthBase, AuthController, AuthKey, AuthToken, Config, Controller, ControllerBase, ControllerCrud, ControllerModel, Env, FilesController, Forgot, ForgotController, Group, GroupPermission, GroupsController, GroupsPermissionsController, Log, LogsController,
|
|
533
|
-
export type { ArgumentsModel, ArgumentsModelCreate, ArgumentsModelDelete, ArgumentsModelFindAll, ArgumentsModelFindOne, ArgumentsModelUpdate, CallbackModelAll, CallbackModelGet, IAuthParameters,
|
|
504
|
+
export { Application, Audit, AuditsController, Auth, AuthBase, AuthController, AuthKey, AuthToken, Config, Controller, ControllerBase, ControllerCrud, ControllerModel, Env, FilesController, Forgot, ForgotController, Group, GroupPermission, GroupsController, GroupsPermissionsController, Log, LogsController, Migration, Permission, PermissionsController, Register, RegisterController, ReqAudit, ReqAuth, ReqUser, Session, SetupController, Store, User, UserGroup, UserHistory, UsersController, UsersGroupsController, audit, crt, database, hooks, key };
|
|
505
|
+
export type { ArgumentsModel, ArgumentsModelCreate, ArgumentsModelDelete, ArgumentsModelFindAll, ArgumentsModelFindOne, ArgumentsModelUpdate, CallbackModelAll, CallbackModelGet, IAuthParameters, ResultModelAll };
|