@andrewcaires/api 5.3.4 → 5.3.6
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/README.md +22 -18
- package/dist/index.cjs.js +2 -2
- package/dist/index.d.ts +180 -63
- package/dist/index.esm.js +2 -2
- package/package.json +7 -7
package/dist/index.d.ts
CHANGED
|
@@ -1,48 +1,37 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* @andrewcaires/api v5.3.
|
|
2
|
+
* @andrewcaires/api v5.3.6
|
|
3
3
|
* Simple api for small applications using express, jsonwebtoken, sequelize and websocket
|
|
4
4
|
* (c) 2026 Andrew Caires
|
|
5
5
|
* @license: MIT
|
|
6
6
|
*/
|
|
7
|
-
import { Context, Application as Application$1, ExpressOptions,
|
|
8
|
-
import { Hash, Env as Env$1 } from '@andrewcaires/node';
|
|
7
|
+
import { Context, Application as Application$1, ExpressOptions, ResponseError } from '@andrewcaires/express';
|
|
9
8
|
import { ModelFindOptions, ModelUpdateOptions, Model as Model$1, Sequelize } from '@andrewcaires/sequelize';
|
|
10
|
-
import {
|
|
9
|
+
import { TypeObjectString, TypeAnyObject, TypeAnyFunction, TypeAnyConstructor, EventEmitter, TypeObject, ValidationBase, ValidationShape } from '@andrewcaires/utils.js';
|
|
11
10
|
import { WebSocketServer } from 'ws';
|
|
12
11
|
import { Model, CreateOptions, Attributes, FindOptions, IncludeOptions, FindAttributeOptions, ModelStatic } from 'sequelize';
|
|
12
|
+
import { Env as Env$1 } from '@andrewcaires/node';
|
|
13
13
|
import { Store, SessionData } from 'express-session';
|
|
14
14
|
|
|
15
|
-
interface
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
forgot?: ForgotModel;
|
|
19
|
-
token?: string;
|
|
20
|
-
user?: UserModel;
|
|
15
|
+
interface AuthResult {
|
|
16
|
+
access: UserAuthModel | UserKeyModel;
|
|
17
|
+
user: UserModel;
|
|
21
18
|
}
|
|
22
19
|
|
|
23
20
|
interface AuthEvents {
|
|
24
21
|
"auth.activation": {
|
|
25
22
|
ctx: Context;
|
|
26
|
-
register: RegisterModel;
|
|
27
|
-
user: UserModel;
|
|
28
23
|
};
|
|
29
24
|
"auth.failure": {
|
|
30
25
|
ctx: Context;
|
|
31
|
-
user?: UserModel;
|
|
32
26
|
};
|
|
33
27
|
"auth.login": {
|
|
34
28
|
ctx: Context;
|
|
35
|
-
auth: UserAuthModel;
|
|
36
|
-
user: UserModel;
|
|
37
29
|
};
|
|
38
30
|
"auth.logout": {
|
|
39
31
|
ctx: Context;
|
|
40
|
-
auth: UserAuthModel;
|
|
41
|
-
user: UserModel;
|
|
42
32
|
};
|
|
43
33
|
"auth.renew": {
|
|
44
34
|
ctx: Context;
|
|
45
|
-
auth: UserAuthModel;
|
|
46
35
|
};
|
|
47
36
|
}
|
|
48
37
|
|
|
@@ -81,7 +70,7 @@ interface ApplicationEvents extends AuthEvents, ForgotEvents, RegisterEvents {
|
|
|
81
70
|
|
|
82
71
|
declare module "express-serve-static-core" {
|
|
83
72
|
interface Request {
|
|
84
|
-
|
|
73
|
+
access?: UserAuthModel | UserKeyModel;
|
|
85
74
|
}
|
|
86
75
|
}
|
|
87
76
|
|
|
@@ -209,7 +198,7 @@ declare enum UserStatus {
|
|
|
209
198
|
|
|
210
199
|
declare class RegisterModel extends Model$1 {
|
|
211
200
|
readonly id: string;
|
|
212
|
-
|
|
201
|
+
hash: string;
|
|
213
202
|
expired_at: number;
|
|
214
203
|
active: boolean;
|
|
215
204
|
readonly created_at: Date;
|
|
@@ -221,7 +210,7 @@ declare class RegisterModel extends Model$1 {
|
|
|
221
210
|
|
|
222
211
|
declare class UserAuthModel extends Model$1 {
|
|
223
212
|
readonly id: string;
|
|
224
|
-
|
|
213
|
+
hash: string;
|
|
225
214
|
ip_address: string;
|
|
226
215
|
user_agent: string;
|
|
227
216
|
revoked_at: Date | null;
|
|
@@ -264,7 +253,7 @@ declare class GroupModel extends Model$1 {
|
|
|
264
253
|
readonly updated_at: Date;
|
|
265
254
|
readonly deleted_at: Date | null;
|
|
266
255
|
users_groups: Array<UserGroupModel>;
|
|
267
|
-
|
|
256
|
+
groups_permissions: Array<GroupPermissionModel>;
|
|
268
257
|
}
|
|
269
258
|
|
|
270
259
|
declare class UserTenantModel extends Model$1 {
|
|
@@ -279,6 +268,7 @@ declare class UserTenantModel extends Model$1 {
|
|
|
279
268
|
declare class TenantModel extends Model$1 {
|
|
280
269
|
readonly id: string;
|
|
281
270
|
name: string;
|
|
271
|
+
description: string;
|
|
282
272
|
status: TenantStatus;
|
|
283
273
|
metadata: TypeAnyObject;
|
|
284
274
|
readonly created_at: Date;
|
|
@@ -384,6 +374,14 @@ declare class MigrationModel extends Model$1 {
|
|
|
384
374
|
readonly updated_at: Date;
|
|
385
375
|
}
|
|
386
376
|
|
|
377
|
+
declare class SecretModel extends Model$1 {
|
|
378
|
+
readonly id: string;
|
|
379
|
+
key: string;
|
|
380
|
+
hash: string;
|
|
381
|
+
readonly created_at: Date;
|
|
382
|
+
readonly updated_at: Date;
|
|
383
|
+
}
|
|
384
|
+
|
|
387
385
|
declare class SessionModel extends Model$1 {
|
|
388
386
|
readonly id: string;
|
|
389
387
|
data: TypeAnyObject;
|
|
@@ -392,6 +390,21 @@ declare class SessionModel extends Model$1 {
|
|
|
392
390
|
readonly updated_at: Date;
|
|
393
391
|
}
|
|
394
392
|
|
|
393
|
+
declare class UserKeyModel extends Model$1 {
|
|
394
|
+
readonly id: string;
|
|
395
|
+
name: string;
|
|
396
|
+
prefix: string;
|
|
397
|
+
hash: string;
|
|
398
|
+
last_used_at: Date | null;
|
|
399
|
+
expires_at: Date | null;
|
|
400
|
+
revoked_at: Date | null;
|
|
401
|
+
readonly created_at: Date;
|
|
402
|
+
readonly updated_at: Date;
|
|
403
|
+
readonly deleted_at: Date | null;
|
|
404
|
+
user_id: string;
|
|
405
|
+
user: UserModel;
|
|
406
|
+
}
|
|
407
|
+
|
|
395
408
|
declare class Loggable {
|
|
396
409
|
get log(): (message: string) => void;
|
|
397
410
|
static get log(): (message: string) => void;
|
|
@@ -417,6 +430,15 @@ declare class Log {
|
|
|
417
430
|
private static writeRaw;
|
|
418
431
|
}
|
|
419
432
|
|
|
433
|
+
declare class Secret extends Loggable {
|
|
434
|
+
private static encryptor;
|
|
435
|
+
static all(keys?: Array<string>): Promise<Array<string>>;
|
|
436
|
+
static del(key: string): Promise<boolean>;
|
|
437
|
+
static get(key: string, value?: string): Promise<string>;
|
|
438
|
+
static set(key: string, value: string): Promise<void>;
|
|
439
|
+
private static init;
|
|
440
|
+
}
|
|
441
|
+
|
|
420
442
|
declare class SessionStore extends Store {
|
|
421
443
|
constructor();
|
|
422
444
|
all: (callback: TypeAnyFunction) => Promise<void>;
|
|
@@ -434,14 +456,23 @@ declare abstract class Service {
|
|
|
434
456
|
}
|
|
435
457
|
|
|
436
458
|
declare class AuthService extends Service {
|
|
459
|
+
private readonly options;
|
|
437
460
|
private readonly userAttributes;
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
461
|
+
private readonly userService;
|
|
462
|
+
constructor();
|
|
463
|
+
createApiKey(ctx: Context, name: string, expires_at: Date, user: UserModel): Promise<string>;
|
|
464
|
+
createApiToken(ctx: Context, user: UserModel): Promise<{
|
|
465
|
+
token: string;
|
|
466
|
+
}>;
|
|
467
|
+
renewApiToken(token: string): Promise<{
|
|
468
|
+
token: string;
|
|
469
|
+
}>;
|
|
470
|
+
apiAuth(ctx: Context): Promise<AuthResult>;
|
|
471
|
+
apiKeyAuth(key: string): Promise<AuthResult>;
|
|
472
|
+
apiTokenAuth(token: string): Promise<AuthResult>;
|
|
473
|
+
private attachAuthContext;
|
|
474
|
+
private safeEqual;
|
|
475
|
+
private verifyJwt;
|
|
445
476
|
}
|
|
446
477
|
|
|
447
478
|
declare class ModelService<M extends Model<any>> extends Service {
|
|
@@ -480,7 +511,6 @@ declare class UserService extends Service {
|
|
|
480
511
|
}
|
|
481
512
|
|
|
482
513
|
declare class Application<T extends ApplicationEvents = ApplicationEvents> extends Application$1<T> {
|
|
483
|
-
readonly hash: Hash;
|
|
484
514
|
authService: AuthService;
|
|
485
515
|
userService: UserService;
|
|
486
516
|
private _webSocket?;
|
|
@@ -497,14 +527,13 @@ interface BaseController extends Loggable {
|
|
|
497
527
|
declare abstract class BaseController<T extends TypeAnyObject = TypeAnyObject> extends EventEmitter<T> {
|
|
498
528
|
protected readonly permissions: Array<string>;
|
|
499
529
|
name(): string;
|
|
500
|
-
session(ctx: Context, user_agent: string, store: IStore): Promise<void>;
|
|
501
530
|
sync(): Promise<void>;
|
|
502
531
|
}
|
|
503
532
|
|
|
504
533
|
declare abstract class ModelController<M extends Model<any>, T extends TypeAnyObject = TypeAnyObject> extends BaseController<T> {
|
|
505
534
|
protected readonly attributes: Array<string>;
|
|
506
535
|
protected abstract readonly model: ModelStatic<M>;
|
|
507
|
-
protected readonly permissions:
|
|
536
|
+
protected readonly permissions: string[];
|
|
508
537
|
protected readonly search: Array<string>;
|
|
509
538
|
private service;
|
|
510
539
|
protected countAll(options: ModelArgumentsCount<M>): Promise<number>;
|
|
@@ -521,16 +550,16 @@ declare abstract class ModelController<M extends Model<any>, T extends TypeAnyOb
|
|
|
521
550
|
declare class AuditsController extends ModelController<AuditModel> {
|
|
522
551
|
protected readonly model: typeof AuditModel;
|
|
523
552
|
protected readonly permissions: string[];
|
|
524
|
-
protected all(ctx: Context
|
|
553
|
+
protected all(ctx: Context): Promise<void>;
|
|
525
554
|
protected get(ctx: Context): Promise<void>;
|
|
526
555
|
}
|
|
527
556
|
|
|
528
557
|
declare class AuthController extends BaseController<AuthEvents> {
|
|
529
558
|
protected readonly authService: AuthService;
|
|
530
|
-
protected login(ctx: Context,
|
|
531
|
-
protected logout(ctx: Context,
|
|
532
|
-
protected
|
|
533
|
-
protected
|
|
559
|
+
protected login(ctx: Context, username: string, password: string, remember: boolean, app: Application): Promise<void>;
|
|
560
|
+
protected logout(ctx: Context, access: UserAuthModel | UserKeyModel, app: Application): Promise<void>;
|
|
561
|
+
protected user(ctx: Context): Promise<void>;
|
|
562
|
+
protected renew(ctx: Context, old: string, app: Application): Promise<void>;
|
|
534
563
|
}
|
|
535
564
|
|
|
536
565
|
declare abstract class CrudController<M extends Model<any>, T extends TypeAnyObject = TypeAnyObject> extends ModelController<M, T> {
|
|
@@ -572,17 +601,25 @@ declare class ForgotController extends BaseController<ForgotEvents> {
|
|
|
572
601
|
|
|
573
602
|
declare class GroupsController extends CrudController<GroupModel> {
|
|
574
603
|
protected readonly model: typeof GroupModel;
|
|
604
|
+
protected userModelService: ModelService<UserModel>;
|
|
575
605
|
private schemaCreate;
|
|
576
606
|
private schemaUpdate;
|
|
577
607
|
CrudValidateCreate(): TypeObject<ValidationBase>;
|
|
578
608
|
CrudValidateUpdate(): TypeObject<ValidationBase>;
|
|
609
|
+
sync(): Promise<void>;
|
|
610
|
+
protected users(ctx: Context, group_id: string): Promise<void>;
|
|
611
|
+
private checkGroup;
|
|
579
612
|
}
|
|
580
613
|
|
|
581
|
-
declare class GroupsPermissionsController extends ModelController<
|
|
582
|
-
protected readonly model: typeof
|
|
614
|
+
declare class GroupsPermissionsController extends ModelController<PermissionModel> {
|
|
615
|
+
protected readonly model: typeof PermissionModel;
|
|
583
616
|
protected readonly permissions: never[];
|
|
617
|
+
protected add(ctx: Context, group_id: string, permissions: Array<string>): Promise<void>;
|
|
584
618
|
protected all(ctx: Context, group_id: string): Promise<void>;
|
|
585
|
-
protected
|
|
619
|
+
protected del(ctx: Context, group_id: string, permissions: Array<string>): Promise<void>;
|
|
620
|
+
protected set(ctx: Context, group_id: string, permissions: Array<string>): Promise<void>;
|
|
621
|
+
private addPermissions;
|
|
622
|
+
private checkGroup;
|
|
586
623
|
}
|
|
587
624
|
|
|
588
625
|
declare class HealthController {
|
|
@@ -602,24 +639,25 @@ declare class McpController extends BaseController {
|
|
|
602
639
|
sync(app?: Application): Promise<void>;
|
|
603
640
|
protected get(ctx: Context): Promise<void>;
|
|
604
641
|
protected options(ctx: Context): Promise<void>;
|
|
605
|
-
protected post(ctx: Context): Promise<void>;
|
|
606
|
-
protected delete(ctx: Context): Promise<void>;
|
|
607
|
-
private getMcpToolMetadata;
|
|
608
|
-
private discoverMcpTools;
|
|
609
|
-
private createMcpToolFromMetadata;
|
|
642
|
+
protected post(ctx: Context<any, Application>): Promise<void>;
|
|
643
|
+
protected delete(ctx: Context<any, Application>): Promise<void>;
|
|
610
644
|
private isJsonParseError;
|
|
611
645
|
private isMcpEndpoint;
|
|
612
646
|
private jsonParseErrorResponse;
|
|
613
647
|
private respond;
|
|
614
|
-
private
|
|
648
|
+
private setResponseHeaders;
|
|
615
649
|
}
|
|
616
650
|
|
|
617
651
|
declare class PermissionsController extends CrudController<PermissionModel> {
|
|
618
652
|
protected readonly model: typeof PermissionModel;
|
|
653
|
+
protected groupModelService: ModelService<GroupModel>;
|
|
619
654
|
private schemaCreate;
|
|
620
655
|
private schemaUpdate;
|
|
621
656
|
CrudValidateCreate(): TypeObject<ValidationBase>;
|
|
622
657
|
CrudValidateUpdate(): TypeObject<ValidationBase>;
|
|
658
|
+
sync(): Promise<void>;
|
|
659
|
+
protected groups(ctx: Context, permission_id: string): Promise<void>;
|
|
660
|
+
private checkPermission;
|
|
623
661
|
}
|
|
624
662
|
|
|
625
663
|
declare class RegisterController extends BaseController<RegisterEvents> {
|
|
@@ -634,6 +672,18 @@ declare class SetupController extends BaseController {
|
|
|
634
672
|
protected setup(ctx: Context): Promise<void>;
|
|
635
673
|
}
|
|
636
674
|
|
|
675
|
+
declare class TenantsController extends CrudController<TenantModel> {
|
|
676
|
+
protected readonly model: typeof TenantModel;
|
|
677
|
+
protected userModelService: ModelService<UserModel>;
|
|
678
|
+
private schemaCreate;
|
|
679
|
+
private schemaUpdate;
|
|
680
|
+
CrudValidateCreate(): TypeObject<ValidationBase>;
|
|
681
|
+
CrudValidateUpdate(): TypeObject<ValidationBase>;
|
|
682
|
+
sync(): Promise<void>;
|
|
683
|
+
protected users(ctx: Context, tenant_id: string): Promise<void>;
|
|
684
|
+
private checkTenant;
|
|
685
|
+
}
|
|
686
|
+
|
|
637
687
|
declare const McpErrorCode: {
|
|
638
688
|
readonly ParseError: -32700;
|
|
639
689
|
readonly InvalidRequest: -32600;
|
|
@@ -707,6 +757,15 @@ interface McpSession {
|
|
|
707
757
|
expiresAt: number;
|
|
708
758
|
protocolVersion: McpProtocolVersion;
|
|
709
759
|
initialized: boolean;
|
|
760
|
+
access?: unknown;
|
|
761
|
+
groups?: Array<string>;
|
|
762
|
+
permissions?: Array<string>;
|
|
763
|
+
tenants?: Array<{
|
|
764
|
+
id: string;
|
|
765
|
+
name: string;
|
|
766
|
+
}>;
|
|
767
|
+
user?: unknown;
|
|
768
|
+
userId?: string;
|
|
710
769
|
}
|
|
711
770
|
interface McpToolDefinition {
|
|
712
771
|
name: string;
|
|
@@ -724,6 +783,15 @@ interface McpToolDeclaration {
|
|
|
724
783
|
}
|
|
725
784
|
interface McpToolContext {
|
|
726
785
|
session: McpSession;
|
|
786
|
+
access?: unknown;
|
|
787
|
+
groups?: Array<string>;
|
|
788
|
+
permissions?: Array<string>;
|
|
789
|
+
tenants?: Array<{
|
|
790
|
+
id: string;
|
|
791
|
+
name: string;
|
|
792
|
+
}>;
|
|
793
|
+
user?: unknown;
|
|
794
|
+
userId?: string;
|
|
727
795
|
}
|
|
728
796
|
type McpToolInput = Record<string, unknown>;
|
|
729
797
|
type McpToolOutput = unknown;
|
|
@@ -782,6 +850,7 @@ declare class McpToolRegistry {
|
|
|
782
850
|
call(name: string, argumentsValue: unknown, session: McpSession): Promise<McpCallToolResult>;
|
|
783
851
|
private isCallToolResult;
|
|
784
852
|
private normalizeMcpValidation;
|
|
853
|
+
private normalizeSchema;
|
|
785
854
|
private outputValidationError;
|
|
786
855
|
private toolInputValidationError;
|
|
787
856
|
private validateAdditionalProperties;
|
|
@@ -793,9 +862,11 @@ interface McpHttpHandlerOptions {
|
|
|
793
862
|
logger?: McpLogger;
|
|
794
863
|
serverName?: string;
|
|
795
864
|
serverVersion?: string;
|
|
865
|
+
allowedHeaders?: Array<string>;
|
|
796
866
|
}
|
|
797
867
|
declare const MCP_HTTP_ALLOWED_METHODS: readonly ["POST", "DELETE", "OPTIONS"];
|
|
798
868
|
declare const MCP_HTTP_ALLOW: string;
|
|
869
|
+
declare const MCP_HTTP_DEFAULT_ALLOWED_HEADERS: readonly ["Content-Type", "Accept", "MCP-Session-Id", "MCP-Protocol-Version"];
|
|
799
870
|
declare const isJsonParseError: (error: unknown) => error is Error & {
|
|
800
871
|
status?: number;
|
|
801
872
|
statusCode?: number;
|
|
@@ -808,9 +879,12 @@ declare class McpHttpHandler {
|
|
|
808
879
|
private readonly logger?;
|
|
809
880
|
private readonly serverName;
|
|
810
881
|
private readonly serverVersion;
|
|
882
|
+
private readonly allowedHeaders;
|
|
811
883
|
constructor(options: McpHttpHandlerOptions);
|
|
812
884
|
post(ctx: Context): Promise<McpHttpResponse>;
|
|
813
885
|
delete(ctx: Context): McpHttpResponse;
|
|
886
|
+
get(): McpHttpResponse;
|
|
887
|
+
options(): McpHttpResponse;
|
|
814
888
|
private initialize;
|
|
815
889
|
private initialized;
|
|
816
890
|
private callTool;
|
|
@@ -823,6 +897,13 @@ declare class McpHttpHandler {
|
|
|
823
897
|
private validateObjectParams;
|
|
824
898
|
private withTransportHeaders;
|
|
825
899
|
private errorResponse;
|
|
900
|
+
private getBody;
|
|
901
|
+
private getHeader;
|
|
902
|
+
private getHeaderFromRequest;
|
|
903
|
+
private getHeaderFromRecord;
|
|
904
|
+
private normalizeHeaderValue;
|
|
905
|
+
private normalizeAllowedHeaders;
|
|
906
|
+
private getAuthContext;
|
|
826
907
|
}
|
|
827
908
|
|
|
828
909
|
declare const isJsonRpcId: (value: unknown) => value is McpJsonRpcId;
|
|
@@ -838,6 +919,9 @@ interface McpToolMetadata extends McpToolDeclaration {
|
|
|
838
919
|
type McpDecoratedToolHandler = (_argumentsValue: Record<string, unknown>, _context: McpToolContext) => ReturnType<McpRegisteredTool["run"]>;
|
|
839
920
|
declare const assertValidMcpToolDefinition: (definition: McpToolDeclaration) => void;
|
|
840
921
|
|
|
922
|
+
declare const getMcpToolMetadata: (target: object | TypeAnyConstructor<object>) => Array<McpToolMetadata>;
|
|
923
|
+
declare const discoverMcpTools: (controllers: Array<object>) => Array<McpRegisteredTool>;
|
|
924
|
+
|
|
841
925
|
declare class TestController extends BaseController {
|
|
842
926
|
protected json(ctx: Context): Promise<void>;
|
|
843
927
|
protected sum(args: TypeAnyObject, _context: McpToolContext): Promise<{
|
|
@@ -897,10 +981,11 @@ declare class TestController extends BaseController {
|
|
|
897
981
|
|
|
898
982
|
declare class UsersController extends ModelController<UserModel> {
|
|
899
983
|
protected readonly model: typeof UserModel;
|
|
984
|
+
protected readonly permissions: string[];
|
|
900
985
|
path: string;
|
|
901
986
|
constructor();
|
|
902
987
|
protected avatar(ctx: Context, user: UserModel): Promise<void>;
|
|
903
|
-
|
|
988
|
+
protected avatar_del(ctx: Context, user: UserModel): Promise<void>;
|
|
904
989
|
protected add(ctx: Context): Promise<void>;
|
|
905
990
|
protected all(ctx: Context): Promise<void>;
|
|
906
991
|
protected rows(ctx: Context): Promise<void>;
|
|
@@ -909,11 +994,36 @@ declare class UsersController extends ModelController<UserModel> {
|
|
|
909
994
|
protected set(ctx: Context): Promise<void>;
|
|
910
995
|
}
|
|
911
996
|
|
|
912
|
-
declare class UsersGroupsController extends ModelController<
|
|
913
|
-
protected readonly model: typeof
|
|
997
|
+
declare class UsersGroupsController extends ModelController<GroupModel> {
|
|
998
|
+
protected readonly model: typeof GroupModel;
|
|
999
|
+
protected readonly permissions: never[];
|
|
1000
|
+
protected add(ctx: Context, user_id: string, groups: Array<string>): Promise<void>;
|
|
1001
|
+
protected all(ctx: Context, user_id: string): Promise<void>;
|
|
1002
|
+
protected del(ctx: Context, user_id: string, groups: Array<string>): Promise<void>;
|
|
1003
|
+
protected set(ctx: Context, user_id: string, groups: Array<string>): Promise<void>;
|
|
1004
|
+
private addGroups;
|
|
1005
|
+
private checkUser;
|
|
1006
|
+
}
|
|
1007
|
+
|
|
1008
|
+
declare class UsersKeysController extends ModelController<UserKeyModel> {
|
|
1009
|
+
protected readonly model: typeof UserKeyModel;
|
|
1010
|
+
protected readonly permissions: string[];
|
|
1011
|
+
protected add(ctx: Context, user: UserModel, body: TypeAnyObject, app: Application): Promise<void>;
|
|
1012
|
+
protected add_admin(ctx: Context, id: string, body: TypeAnyObject, app: Application): Promise<void>;
|
|
1013
|
+
protected all(ctx: Context, user: UserModel): Promise<void>;
|
|
1014
|
+
protected all_admin(ctx: Context, id: string): Promise<void>;
|
|
1015
|
+
private checkUser;
|
|
1016
|
+
}
|
|
1017
|
+
|
|
1018
|
+
declare class UsersTenantsController extends ModelController<TenantModel> {
|
|
1019
|
+
protected readonly model: typeof TenantModel;
|
|
914
1020
|
protected readonly permissions: never[];
|
|
1021
|
+
protected add(ctx: Context, user_id: string, tenants: Array<string>): Promise<void>;
|
|
915
1022
|
protected all(ctx: Context, user_id: string): Promise<void>;
|
|
916
|
-
protected
|
|
1023
|
+
protected del(ctx: Context, user_id: string, tenants: Array<string>): Promise<void>;
|
|
1024
|
+
protected set(ctx: Context, user_id: string, tenants: Array<string>): Promise<void>;
|
|
1025
|
+
private addTenants;
|
|
1026
|
+
private checkUser;
|
|
917
1027
|
}
|
|
918
1028
|
|
|
919
1029
|
declare const sequelize: Sequelize;
|
|
@@ -932,9 +1042,11 @@ declare const HasGroups: (...groups: Array<string>) => MethodDecorator;
|
|
|
932
1042
|
|
|
933
1043
|
declare const HasPermissions: (...permissions: Array<string>) => MethodDecorator;
|
|
934
1044
|
|
|
1045
|
+
declare const HasScope: (scope?: string) => MethodDecorator;
|
|
1046
|
+
|
|
935
1047
|
declare const IsAuthenticated: () => MethodDecorator;
|
|
936
1048
|
|
|
937
|
-
declare const
|
|
1049
|
+
declare const ReqAccess: (key?: string) => ParameterDecorator;
|
|
938
1050
|
|
|
939
1051
|
declare const ReqGroup: (key?: string) => ParameterDecorator;
|
|
940
1052
|
|
|
@@ -944,6 +1056,10 @@ declare const ReqPermission: (key?: string) => ParameterDecorator;
|
|
|
944
1056
|
|
|
945
1057
|
declare const ReqPermissions: (key?: string) => ParameterDecorator;
|
|
946
1058
|
|
|
1059
|
+
declare const ReqTenant: (key?: string) => ParameterDecorator;
|
|
1060
|
+
|
|
1061
|
+
declare const ReqTenants: (key?: string) => ParameterDecorator;
|
|
1062
|
+
|
|
947
1063
|
declare const ReqUser: (key?: string) => ParameterDecorator;
|
|
948
1064
|
|
|
949
1065
|
type McpToolOptions = Omit<McpToolMetadata, "propertyKey">;
|
|
@@ -952,6 +1068,7 @@ declare const McpTool: (options: McpToolOptions) => MethodDecorator;
|
|
|
952
1068
|
declare const Audit: (active?: boolean) => ClassDecorator;
|
|
953
1069
|
|
|
954
1070
|
declare class Env extends Env$1 {
|
|
1071
|
+
static readonly AUDIT_IGNORE: string[];
|
|
955
1072
|
static readonly BASE_NAME: string;
|
|
956
1073
|
static readonly CONSOLE_ERROR: boolean;
|
|
957
1074
|
static readonly DATABASE_URI: string;
|
|
@@ -959,13 +1076,17 @@ declare class Env extends Env$1 {
|
|
|
959
1076
|
static readonly DATABASE_AUDIT: boolean;
|
|
960
1077
|
static readonly DATABASE_PREFIX: string;
|
|
961
1078
|
static readonly DATABASE_TIMEZONE: string;
|
|
1079
|
+
static readonly ENCRYPTION_SECRET: string;
|
|
962
1080
|
static readonly HTTP_CROSS: string;
|
|
1081
|
+
static readonly HTTP_HYBRID: boolean;
|
|
1082
|
+
static readonly HTTP_NOTFOUND: string;
|
|
1083
|
+
static readonly HTTP_PATH: string;
|
|
963
1084
|
static readonly HTTP_PORT: number;
|
|
964
1085
|
static readonly HTTP_PUBLIC: string;
|
|
1086
|
+
static readonly HTTP_REDIRECT: string;
|
|
965
1087
|
static readonly HTTP_TLS_CA: Buffer<ArrayBufferLike> | null;
|
|
966
1088
|
static readonly HTTP_TLS_CRT: Buffer<ArrayBufferLike> | null;
|
|
967
1089
|
static readonly HTTP_TLS_KEY: Buffer<ArrayBufferLike> | null;
|
|
968
|
-
static readonly KEY_HEADER: string;
|
|
969
1090
|
static readonly MODEL_LIMIT: number;
|
|
970
1091
|
static readonly MODEL_LIMIT_MAX: number;
|
|
971
1092
|
static readonly MCP_SESSION_TTL: number;
|
|
@@ -978,9 +1099,12 @@ declare class Env extends Env$1 {
|
|
|
978
1099
|
static readonly SLEEP_FORGOT: number;
|
|
979
1100
|
static readonly SLEEP_REGISTRY: number;
|
|
980
1101
|
static readonly TENANT_HEADER: string;
|
|
981
|
-
static readonly
|
|
1102
|
+
static readonly TOKEN_COOKIE: string;
|
|
1103
|
+
static readonly TOKEN_COOKIE_SET: boolean;
|
|
982
1104
|
static readonly TOKEN_HEADER: string;
|
|
983
|
-
static readonly
|
|
1105
|
+
static readonly TOKEN_PEPPER: string;
|
|
1106
|
+
static readonly TOKEN_PREFIX: string;
|
|
1107
|
+
static readonly TOKEN_SECRET: string;
|
|
984
1108
|
static readonly TOKEN_TTL: number;
|
|
985
1109
|
static readonly TOKEN_TTL_FORGOT: number;
|
|
986
1110
|
static readonly TOKEN_TTL_RENEW: number;
|
|
@@ -989,19 +1113,12 @@ declare class Env extends Env$1 {
|
|
|
989
1113
|
static readonly API_BODYPARSER_INFLATE: boolean;
|
|
990
1114
|
static readonly API_BODYPARSER_LIMIT: string;
|
|
991
1115
|
static readonly API_BODYPARSER_TYPE: string;
|
|
992
|
-
static readonly API_HTTP_HYBRID: boolean;
|
|
993
|
-
static readonly API_HTTP_NOTFOUND: string;
|
|
994
|
-
static readonly API_HTTP_PATH: string;
|
|
995
|
-
static readonly API_HTTP_REDIRECT: string;
|
|
996
|
-
static readonly API_KEY_HASH: string;
|
|
997
1116
|
static readonly API_SESSION_NAME: string;
|
|
998
1117
|
static readonly API_SESSION_LIFETIME: number;
|
|
999
1118
|
static readonly API_SESSION_SECRET: string;
|
|
1000
|
-
static readonly API_TOKEN_COOKIE: string;
|
|
1001
|
-
static readonly API_TOKEN_COOKIE_SET: boolean;
|
|
1002
1119
|
static readonly API_USER_HISTORY: boolean;
|
|
1003
1120
|
static readonly API_WEBSOCKET_START: boolean;
|
|
1004
1121
|
}
|
|
1005
1122
|
|
|
1006
|
-
export { Application, Audit, AuditModel, AuditTypes, AuditsController, AuthController, AuthService, BaseController, CanCreate, CanDelete, CanRead, CanUpdate, Config, ConfigModel, CrudController, Env, FilesController, ForgotController, ForgotModel, GroupModel, GroupPermissionModel, GroupTypes, GroupsController, GroupsPermissionsController, HasGroups, HasPermissions, HealthController, IsAuthenticated, Log, LogLevels, LogModel, Loggable, LogsController, MCP_DEFAULT_PROTOCOL_VERSION, MCP_HTTP_ALLOW, MCP_HTTP_ALLOWED_METHODS, MCP_PROTOCOL_VERSION_HEADER, MCP_SESSION_ID_HEADER, MCP_SUPPORTED_PROTOCOL_VERSIONS, MCP_TOOL_METADATA, McpController, McpError, McpErrorCode, McpHttpHandler, McpInternalError, McpInvalidParamsError, McpInvalidRequestError, McpInvalidSessionError, McpMethodNotFoundError, McpParseError, McpServerError, McpSessionStore, McpTool, McpToolNotFoundError, McpToolRegistry, MigrationModel, ModelController, ModelService, PermissionModel, PermissionsController, RegisterController, RegisterModel,
|
|
1007
|
-
export type { ApplicationEvents, AuthEvents,
|
|
1123
|
+
export { Application, Audit, AuditModel, AuditTypes, AuditsController, AuthController, AuthService, BaseController, CanCreate, CanDelete, CanRead, CanUpdate, Config, ConfigModel, CrudController, Env, FilesController, ForgotController, ForgotModel, GroupModel, GroupPermissionModel, GroupTypes, GroupsController, GroupsPermissionsController, HasGroups, HasPermissions, HasScope, HealthController, IsAuthenticated, Log, LogLevels, LogModel, Loggable, LogsController, MCP_DEFAULT_PROTOCOL_VERSION, MCP_HTTP_ALLOW, MCP_HTTP_ALLOWED_METHODS, MCP_HTTP_DEFAULT_ALLOWED_HEADERS, MCP_PROTOCOL_VERSION_HEADER, MCP_SESSION_ID_HEADER, MCP_SUPPORTED_PROTOCOL_VERSIONS, MCP_TOOL_METADATA, McpController, McpError, McpErrorCode, McpHttpHandler, McpInternalError, McpInvalidParamsError, McpInvalidRequestError, McpInvalidSessionError, McpMethodNotFoundError, McpParseError, McpServerError, McpSessionStore, McpTool, McpToolNotFoundError, McpToolRegistry, MigrationModel, ModelController, ModelService, PermissionModel, PermissionsController, RegisterController, RegisterModel, ReqAccess, ReqGroup, ReqGroups, ReqPermission, ReqPermissions, ReqTenant, ReqTenants, ReqUser, Secret, SecretModel, Service, SessionModel, SessionStore, SetupController, TenantModel, TenantStatus, TenantsController, TestController, UserAuthModel, UserGroupModel, UserKeyModel, UserModel, UserPasswordModel, UserService, UserStatus, UserTenantModel, UsersController, UsersGroupsController, UsersKeysController, UsersTenantsController, assertValidMcpToolDefinition, canFactory, discoverMcpTools, getMcpToolMetadata, isJsonParseError, isJsonRpcId, jsonParseErrorResponse, jsonRpcError, jsonRpcErrorFromCode, jsonRpcResult, parseJsonRpcRequest, sequelize };
|
|
1124
|
+
export type { ApplicationEvents, AuthEvents, AuthResult, ForgotEvents, McpCallToolResult, McpDecoratedToolHandler, McpHttpHandlerOptions, McpHttpResponse, McpJsonRpcErrorBody, McpJsonRpcErrorResult, McpJsonRpcId, McpJsonRpcRequest, McpJsonRpcResult, McpLogger, McpNormalizedValidation, McpProtocolVersion, McpRegisteredTool, McpSession, McpToolCallLog, McpToolContext, McpToolDeclaration, McpToolDefinition, McpToolHandlerResult, McpToolInput, McpToolMetadata, McpToolOptions, McpToolOutput, ModelArgumentsBase, ModelArgumentsCount, ModelArgumentsCreate, ModelArgumentsDelete, ModelArgumentsFindAll, ModelArgumentsFindOne, ModelArgumentsInclude, ModelArgumentsUpdate, ModelCallbackFindAll, ModelCallbackFindOne, ModelOptions, ModelResultFindAll, RegisterEvents };
|