@andrewcaires/api 5.2.3 → 5.3.1
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 +52 -0
- package/dist/index.cjs.js +2 -2
- package/dist/index.d.ts +394 -22
- package/dist/index.esm.js +2 -2
- package/package.json +14 -13
package/dist/index.d.ts
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* @andrewcaires/api v5.
|
|
2
|
+
* @andrewcaires/api v5.3.1
|
|
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, IStore } from '@andrewcaires/express';
|
|
7
|
+
import { Context, Application as Application$1, ExpressOptions, IStore, ResponseError } from '@andrewcaires/express';
|
|
8
8
|
import { Hash, Env as Env$1 } from '@andrewcaires/node';
|
|
9
9
|
import { ModelFindOptions, ModelUpdateOptions, Model as Model$1, Sequelize } from '@andrewcaires/sequelize';
|
|
10
|
-
import { TypeAnyObject, TypeObjectString, TypeAnyFunction, TypeAnyConstructor, EventEmitter, TypeObject, ValidationBase } from '@andrewcaires/utils.js';
|
|
10
|
+
import { TypeAnyObject, TypeObjectString, TypeAnyFunction, TypeAnyConstructor, EventEmitter, TypeObject, ValidationBase, ValidationShape } from '@andrewcaires/utils.js';
|
|
11
11
|
import { WebSocketServer } from 'ws';
|
|
12
12
|
import { Model, CreateOptions, Attributes, FindOptions, IncludeOptions, FindAttributeOptions, ModelStatic } from 'sequelize';
|
|
13
13
|
import { Store, SessionData } from 'express-session';
|
|
@@ -103,6 +103,15 @@ declare module "express-serve-static-core" {
|
|
|
103
103
|
}
|
|
104
104
|
}
|
|
105
105
|
|
|
106
|
+
declare module "express-serve-static-core" {
|
|
107
|
+
interface Request {
|
|
108
|
+
tenants?: Array<{
|
|
109
|
+
id: string;
|
|
110
|
+
name: string;
|
|
111
|
+
}>;
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
|
|
106
115
|
declare module "express-serve-static-core" {
|
|
107
116
|
interface Request {
|
|
108
117
|
user?: UserModel;
|
|
@@ -171,12 +180,25 @@ declare enum AuditTypes {
|
|
|
171
180
|
UPDATE = "UPDATE"
|
|
172
181
|
}
|
|
173
182
|
|
|
174
|
-
declare enum
|
|
183
|
+
declare enum GroupTypes {
|
|
184
|
+
SYSTEM = "system",
|
|
185
|
+
TENANT = "tenant"
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
declare enum LogLevels {
|
|
175
189
|
INFO = "info",
|
|
176
190
|
WARN = "warn",
|
|
177
191
|
ERROR = "error"
|
|
178
192
|
}
|
|
179
193
|
|
|
194
|
+
declare enum TenantStatus {
|
|
195
|
+
ACTIVE = "active",
|
|
196
|
+
PENDING = "pending",
|
|
197
|
+
SUSPENDED = "suspended",
|
|
198
|
+
DISABLED = "disabled",
|
|
199
|
+
ARCHIVED = "archived"
|
|
200
|
+
}
|
|
201
|
+
|
|
180
202
|
declare enum UserStatus {
|
|
181
203
|
ACTIVE = "active",
|
|
182
204
|
PENDING = "pending",
|
|
@@ -215,6 +237,7 @@ declare class PermissionModel extends Model$1 {
|
|
|
215
237
|
name: string;
|
|
216
238
|
description: string;
|
|
217
239
|
active: boolean;
|
|
240
|
+
metadata: TypeAnyObject;
|
|
218
241
|
readonly created_at: Date;
|
|
219
242
|
readonly updated_at: Date;
|
|
220
243
|
readonly deleted_at: Date | null;
|
|
@@ -234,7 +257,9 @@ declare class GroupModel extends Model$1 {
|
|
|
234
257
|
readonly id: string;
|
|
235
258
|
name: string;
|
|
236
259
|
description: string;
|
|
260
|
+
type: GroupTypes;
|
|
237
261
|
active: boolean;
|
|
262
|
+
metadata: TypeAnyObject;
|
|
238
263
|
readonly created_at: Date;
|
|
239
264
|
readonly updated_at: Date;
|
|
240
265
|
readonly deleted_at: Date | null;
|
|
@@ -242,6 +267,26 @@ declare class GroupModel extends Model$1 {
|
|
|
242
267
|
groups_Permission: Array<GroupPermissionModel>;
|
|
243
268
|
}
|
|
244
269
|
|
|
270
|
+
declare class UserTenantModel extends Model$1 {
|
|
271
|
+
readonly id: string;
|
|
272
|
+
readonly created_at: Date;
|
|
273
|
+
tenant_id: string;
|
|
274
|
+
tenant: TenantModel;
|
|
275
|
+
user_id: string;
|
|
276
|
+
user: UserModel;
|
|
277
|
+
}
|
|
278
|
+
|
|
279
|
+
declare class TenantModel extends Model$1 {
|
|
280
|
+
readonly id: string;
|
|
281
|
+
name: string;
|
|
282
|
+
status: TenantStatus;
|
|
283
|
+
metadata: TypeAnyObject;
|
|
284
|
+
readonly created_at: Date;
|
|
285
|
+
readonly updated_at: Date;
|
|
286
|
+
readonly deleted_at: Date | null;
|
|
287
|
+
users_tenants: Array<UserTenantModel>;
|
|
288
|
+
}
|
|
289
|
+
|
|
245
290
|
declare class UserGroupModel extends Model$1 {
|
|
246
291
|
readonly id: string;
|
|
247
292
|
readonly created_at: Date;
|
|
@@ -249,6 +294,8 @@ declare class UserGroupModel extends Model$1 {
|
|
|
249
294
|
group: GroupModel;
|
|
250
295
|
user_id: string;
|
|
251
296
|
user: UserModel;
|
|
297
|
+
tenant_id: string;
|
|
298
|
+
tenant: TenantModel;
|
|
252
299
|
}
|
|
253
300
|
|
|
254
301
|
declare class UserPasswordModel extends Model$1 {
|
|
@@ -278,6 +325,7 @@ declare class UserModel extends Model$1 {
|
|
|
278
325
|
registers: Array<RegisterModel>;
|
|
279
326
|
users_groups: Array<UserGroupModel>;
|
|
280
327
|
users_passwords: Array<UserPasswordModel>;
|
|
328
|
+
users_tenants: Array<UserTenantModel>;
|
|
281
329
|
}
|
|
282
330
|
|
|
283
331
|
declare class AuditModel extends Model$1 {
|
|
@@ -322,7 +370,7 @@ declare class ForgotModel extends Model$1 {
|
|
|
322
370
|
|
|
323
371
|
declare class LogModel extends Model$1 {
|
|
324
372
|
readonly id: string;
|
|
325
|
-
level:
|
|
373
|
+
level: LogLevels;
|
|
326
374
|
message: string;
|
|
327
375
|
source: string;
|
|
328
376
|
readonly created_at: Date;
|
|
@@ -423,10 +471,12 @@ declare class ModelService<M extends Model<any>> extends Service {
|
|
|
423
471
|
declare class UserService extends Service {
|
|
424
472
|
private hashOptions;
|
|
425
473
|
createPassword(user_id: string, value: string, ctx?: Context): Promise<void>;
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
474
|
+
getGroups(user_id: string, tenant_id?: string | null): Promise<Array<string>>;
|
|
475
|
+
getPermissions(user_id: string, tenant_id?: string | null): Promise<Array<string>>;
|
|
476
|
+
getTenants(user_id: string): Promise<Array<{
|
|
477
|
+
id: string;
|
|
478
|
+
name: string;
|
|
479
|
+
}>>;
|
|
430
480
|
}
|
|
431
481
|
|
|
432
482
|
declare class Application<T extends ApplicationEvents = ApplicationEvents> extends Application$1<T> {
|
|
@@ -499,14 +549,14 @@ declare abstract class CrudController<M extends Model<any>, T extends TypeAnyObj
|
|
|
499
549
|
protected del(ctx: Context): Promise<void>;
|
|
500
550
|
protected get(ctx: Context): Promise<void>;
|
|
501
551
|
protected set(ctx: Context): Promise<void>;
|
|
502
|
-
protected validate(ctx: Context, obj: TypeObject<ValidationBase>):
|
|
503
|
-
protected validateCreate(ctx: Context):
|
|
504
|
-
protected validateUpdate(ctx: Context):
|
|
552
|
+
protected validate(ctx: Context, obj: TypeObject<ValidationBase>): void;
|
|
553
|
+
protected validateCreate(ctx: Context): void;
|
|
554
|
+
protected validateUpdate(ctx: Context): void;
|
|
505
555
|
}
|
|
506
556
|
|
|
507
557
|
declare class FilesController extends BaseController {
|
|
508
558
|
protected readonly directory: string;
|
|
509
|
-
protected readonly permissions:
|
|
559
|
+
protected readonly permissions: string[];
|
|
510
560
|
protected files(ctx: Context): Promise<TypeAnyObject | void>;
|
|
511
561
|
private info;
|
|
512
562
|
name(): string;
|
|
@@ -541,10 +591,29 @@ declare class HealthController {
|
|
|
541
591
|
|
|
542
592
|
declare class LogsController extends ModelController<LogModel> {
|
|
543
593
|
protected readonly model: typeof LogModel;
|
|
544
|
-
protected readonly permissions:
|
|
594
|
+
protected readonly permissions: string[];
|
|
545
595
|
protected all(ctx: Context): Promise<void>;
|
|
546
596
|
}
|
|
547
597
|
|
|
598
|
+
declare class McpController extends BaseController {
|
|
599
|
+
private readonly tools;
|
|
600
|
+
private toolsRegistered;
|
|
601
|
+
private readonly handler;
|
|
602
|
+
private readonly rateLimiter;
|
|
603
|
+
sync(app?: Application): Promise<void>;
|
|
604
|
+
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;
|
|
610
|
+
private request;
|
|
611
|
+
private isJsonParseError;
|
|
612
|
+
private isMcpEndpoint;
|
|
613
|
+
private jsonParseErrorResponse;
|
|
614
|
+
private respond;
|
|
615
|
+
}
|
|
616
|
+
|
|
548
617
|
declare class PermissionsController extends CrudController<PermissionModel> {
|
|
549
618
|
protected readonly model: typeof PermissionModel;
|
|
550
619
|
private schemaCreate;
|
|
@@ -565,6 +634,301 @@ declare class SetupController extends BaseController {
|
|
|
565
634
|
protected setup(ctx: Context): Promise<void>;
|
|
566
635
|
}
|
|
567
636
|
|
|
637
|
+
declare const McpErrorCode: {
|
|
638
|
+
readonly ParseError: -32700;
|
|
639
|
+
readonly InvalidRequest: -32600;
|
|
640
|
+
readonly MethodNotFound: -32601;
|
|
641
|
+
readonly InvalidParams: -32602;
|
|
642
|
+
readonly InternalError: -32603;
|
|
643
|
+
readonly ServerError: -32000;
|
|
644
|
+
readonly InvalidSession: -32001;
|
|
645
|
+
};
|
|
646
|
+
type McpErrorCode = typeof McpErrorCode[keyof typeof McpErrorCode];
|
|
647
|
+
declare class McpError extends ResponseError {
|
|
648
|
+
readonly code: McpErrorCode;
|
|
649
|
+
readonly data?: unknown;
|
|
650
|
+
constructor(message: string, code?: McpErrorCode, status?: number, data?: unknown);
|
|
651
|
+
}
|
|
652
|
+
declare class McpParseError extends McpError {
|
|
653
|
+
constructor(message?: string, data?: unknown);
|
|
654
|
+
}
|
|
655
|
+
declare class McpInvalidRequestError extends McpError {
|
|
656
|
+
constructor(message?: string, data?: unknown);
|
|
657
|
+
}
|
|
658
|
+
declare class McpMethodNotFoundError extends McpError {
|
|
659
|
+
constructor(method: string);
|
|
660
|
+
}
|
|
661
|
+
declare class McpInvalidParamsError extends McpError {
|
|
662
|
+
constructor(message?: string, data?: unknown);
|
|
663
|
+
}
|
|
664
|
+
declare class McpInternalError extends McpError {
|
|
665
|
+
constructor(message?: string, data?: unknown);
|
|
666
|
+
}
|
|
667
|
+
declare class McpServerError extends McpError {
|
|
668
|
+
constructor(message?: string, data?: unknown);
|
|
669
|
+
}
|
|
670
|
+
declare class McpInvalidSessionError extends McpError {
|
|
671
|
+
constructor(message?: string, status?: number);
|
|
672
|
+
}
|
|
673
|
+
declare class McpToolNotFoundError extends McpError {
|
|
674
|
+
constructor(toolName: string);
|
|
675
|
+
}
|
|
676
|
+
|
|
677
|
+
declare const MCP_SUPPORTED_PROTOCOL_VERSIONS: readonly ["2025-11-25", "2025-06-18"];
|
|
678
|
+
declare const MCP_DEFAULT_PROTOCOL_VERSION: "2025-11-25";
|
|
679
|
+
declare const MCP_PROTOCOL_VERSION_HEADER = "MCP-Protocol-Version";
|
|
680
|
+
declare const MCP_SESSION_ID_HEADER = "MCP-Session-Id";
|
|
681
|
+
type McpProtocolVersion = typeof MCP_SUPPORTED_PROTOCOL_VERSIONS[number];
|
|
682
|
+
type McpJsonRpcId = string | number;
|
|
683
|
+
interface McpJsonRpcRequest {
|
|
684
|
+
jsonrpc: "2.0";
|
|
685
|
+
id?: McpJsonRpcId;
|
|
686
|
+
method: string;
|
|
687
|
+
params?: unknown;
|
|
688
|
+
}
|
|
689
|
+
interface McpJsonRpcErrorBody {
|
|
690
|
+
code: number;
|
|
691
|
+
message: string;
|
|
692
|
+
data?: unknown;
|
|
693
|
+
}
|
|
694
|
+
interface McpJsonRpcResult {
|
|
695
|
+
jsonrpc: "2.0";
|
|
696
|
+
id: McpJsonRpcId;
|
|
697
|
+
result: unknown;
|
|
698
|
+
}
|
|
699
|
+
interface McpJsonRpcErrorResult {
|
|
700
|
+
jsonrpc: "2.0";
|
|
701
|
+
id: McpJsonRpcId | null;
|
|
702
|
+
error: McpJsonRpcErrorBody;
|
|
703
|
+
}
|
|
704
|
+
interface McpSessionContext {
|
|
705
|
+
auth?: unknown;
|
|
706
|
+
groups?: unknown;
|
|
707
|
+
permissions?: unknown;
|
|
708
|
+
profile?: unknown;
|
|
709
|
+
user?: unknown;
|
|
710
|
+
userId?: string | number;
|
|
711
|
+
}
|
|
712
|
+
interface McpSession extends McpSessionContext {
|
|
713
|
+
sessionId: string;
|
|
714
|
+
createdAt: number;
|
|
715
|
+
expiresAt: number;
|
|
716
|
+
protocolVersion: McpProtocolVersion;
|
|
717
|
+
initialized: boolean;
|
|
718
|
+
}
|
|
719
|
+
interface McpToolDefinition {
|
|
720
|
+
name: string;
|
|
721
|
+
title: string;
|
|
722
|
+
description: string;
|
|
723
|
+
inputSchema: Record<string, unknown>;
|
|
724
|
+
outputSchema?: Record<string, unknown>;
|
|
725
|
+
}
|
|
726
|
+
interface McpToolDeclaration {
|
|
727
|
+
name: string;
|
|
728
|
+
title: string;
|
|
729
|
+
description: string;
|
|
730
|
+
input?: ValidationShape;
|
|
731
|
+
output?: ValidationShape;
|
|
732
|
+
}
|
|
733
|
+
interface McpToolContext extends McpSessionContext {
|
|
734
|
+
session: McpSession;
|
|
735
|
+
}
|
|
736
|
+
type McpToolInput = Record<string, unknown>;
|
|
737
|
+
type McpToolOutput = unknown;
|
|
738
|
+
interface McpCallToolResult {
|
|
739
|
+
content: Array<{
|
|
740
|
+
type: "text";
|
|
741
|
+
text: string;
|
|
742
|
+
}>;
|
|
743
|
+
structuredContent?: unknown;
|
|
744
|
+
isError?: boolean;
|
|
745
|
+
}
|
|
746
|
+
type McpToolHandlerResult = McpCallToolResult | McpToolOutput;
|
|
747
|
+
interface McpRegisteredTool extends McpToolDeclaration {
|
|
748
|
+
run(_argumentsValue: McpToolInput, _context: McpToolContext): Promise<McpToolHandlerResult> | McpToolHandlerResult;
|
|
749
|
+
}
|
|
750
|
+
interface McpHttpRequest {
|
|
751
|
+
body: unknown;
|
|
752
|
+
headers: Record<string, string | undefined>;
|
|
753
|
+
context?: McpSessionContext;
|
|
754
|
+
ip?: string;
|
|
755
|
+
}
|
|
756
|
+
interface McpHttpResponse {
|
|
757
|
+
status: number;
|
|
758
|
+
headers?: Record<string, string>;
|
|
759
|
+
body?: unknown;
|
|
760
|
+
}
|
|
761
|
+
interface McpToolCallLog {
|
|
762
|
+
sessionId: string;
|
|
763
|
+
userId?: string | number;
|
|
764
|
+
toolName: string;
|
|
765
|
+
durationMs: number;
|
|
766
|
+
success: boolean;
|
|
767
|
+
error?: string;
|
|
768
|
+
}
|
|
769
|
+
interface McpLogger {
|
|
770
|
+
toolCall(_log: McpToolCallLog): void | Promise<void>;
|
|
771
|
+
}
|
|
772
|
+
|
|
773
|
+
declare class McpSessionStore {
|
|
774
|
+
private readonly sessions;
|
|
775
|
+
private readonly ttl;
|
|
776
|
+
private readonly now;
|
|
777
|
+
constructor(ttl?: number, now?: () => number);
|
|
778
|
+
create(protocolVersion: McpProtocolVersion, context?: McpSessionContext): McpSession;
|
|
779
|
+
get(sessionId: string): McpSession | undefined;
|
|
780
|
+
require(sessionId: string): McpSession;
|
|
781
|
+
markInitialized(sessionId: string): McpSession;
|
|
782
|
+
delete(sessionId: string): boolean;
|
|
783
|
+
cleanup(): void;
|
|
784
|
+
size(): number;
|
|
785
|
+
private isExpired;
|
|
786
|
+
}
|
|
787
|
+
|
|
788
|
+
interface McpNormalizedValidation {
|
|
789
|
+
schema: TypeAnyObject;
|
|
790
|
+
validation?: ValidationBase;
|
|
791
|
+
}
|
|
792
|
+
declare class McpToolRegistry {
|
|
793
|
+
private readonly tools;
|
|
794
|
+
constructor(tools?: Array<McpRegisteredTool>);
|
|
795
|
+
register(tool: McpRegisteredTool): void;
|
|
796
|
+
list(): Array<McpToolDefinition>;
|
|
797
|
+
call(name: string, argumentsValue: unknown, session: McpSession): Promise<McpCallToolResult>;
|
|
798
|
+
private isCallToolResult;
|
|
799
|
+
private normalizeMcpValidation;
|
|
800
|
+
private outputValidationError;
|
|
801
|
+
private toolInputValidationError;
|
|
802
|
+
private validateAdditionalProperties;
|
|
803
|
+
}
|
|
804
|
+
|
|
805
|
+
interface McpHttpHandlerOptions {
|
|
806
|
+
sessions: McpSessionStore;
|
|
807
|
+
tools: McpToolRegistry;
|
|
808
|
+
allowedOrigins?: Array<string>;
|
|
809
|
+
logger?: McpLogger;
|
|
810
|
+
serverName?: string;
|
|
811
|
+
serverVersion?: string;
|
|
812
|
+
}
|
|
813
|
+
declare const MCP_HTTP_ALLOWED_METHODS: readonly ["POST", "DELETE", "OPTIONS"];
|
|
814
|
+
declare const MCP_HTTP_ALLOW: string;
|
|
815
|
+
declare const isJsonParseError: (error: unknown) => error is Error & {
|
|
816
|
+
status?: number;
|
|
817
|
+
statusCode?: number;
|
|
818
|
+
type?: string;
|
|
819
|
+
};
|
|
820
|
+
declare const jsonParseErrorResponse: (error: unknown) => McpHttpResponse | undefined;
|
|
821
|
+
declare class McpHttpHandler {
|
|
822
|
+
private readonly sessions;
|
|
823
|
+
private readonly tools;
|
|
824
|
+
private readonly allowedOrigins;
|
|
825
|
+
private readonly logger?;
|
|
826
|
+
private readonly serverName;
|
|
827
|
+
private readonly serverVersion;
|
|
828
|
+
constructor(options: McpHttpHandlerOptions);
|
|
829
|
+
post(request: McpHttpRequest): Promise<McpHttpResponse>;
|
|
830
|
+
delete(request: McpHttpRequest): McpHttpResponse;
|
|
831
|
+
get(request: McpHttpRequest): McpHttpResponse;
|
|
832
|
+
options(request: McpHttpRequest): McpHttpResponse;
|
|
833
|
+
private initialize;
|
|
834
|
+
private initialized;
|
|
835
|
+
private callTool;
|
|
836
|
+
private requireRequestId;
|
|
837
|
+
private withSession;
|
|
838
|
+
private withInitializedSession;
|
|
839
|
+
private requireSession;
|
|
840
|
+
private validateProtocolHeader;
|
|
841
|
+
private negotiateProtocolVersion;
|
|
842
|
+
private parseToolCallParams;
|
|
843
|
+
private validateObjectParams;
|
|
844
|
+
private validateOrigin;
|
|
845
|
+
private withTransportHeaders;
|
|
846
|
+
private transportHeaders;
|
|
847
|
+
private getAllowedOrigin;
|
|
848
|
+
private getSessionHeader;
|
|
849
|
+
private getHeader;
|
|
850
|
+
private errorResponse;
|
|
851
|
+
}
|
|
852
|
+
|
|
853
|
+
declare const isJsonRpcId: (value: unknown) => value is McpJsonRpcId;
|
|
854
|
+
declare const jsonRpcResult: (id: McpJsonRpcId, result: unknown) => McpJsonRpcResult;
|
|
855
|
+
declare const jsonRpcError: (id: McpJsonRpcId | null, error: McpError) => McpJsonRpcErrorResult;
|
|
856
|
+
declare const jsonRpcErrorFromCode: (id: McpJsonRpcId | null, code: McpErrorCode, message: string, data?: unknown) => McpJsonRpcErrorResult;
|
|
857
|
+
declare const parseJsonRpcRequest: (body: unknown) => McpJsonRpcRequest;
|
|
858
|
+
|
|
859
|
+
declare class McpRateLimiter {
|
|
860
|
+
private readonly entries;
|
|
861
|
+
private readonly max;
|
|
862
|
+
private readonly windowMs;
|
|
863
|
+
private readonly now;
|
|
864
|
+
constructor(max?: number, windowMs?: number, now?: () => number);
|
|
865
|
+
consume(key: string): boolean;
|
|
866
|
+
}
|
|
867
|
+
|
|
868
|
+
declare const MCP_TOOL_METADATA: unique symbol;
|
|
869
|
+
interface McpToolMetadata extends McpToolDeclaration {
|
|
870
|
+
propertyKey: string | symbol;
|
|
871
|
+
}
|
|
872
|
+
type McpDecoratedToolHandler = (_argumentsValue: Record<string, unknown>, _context: McpToolContext) => ReturnType<McpRegisteredTool["run"]>;
|
|
873
|
+
declare const assertValidMcpToolDefinition: (definition: McpToolDeclaration) => void;
|
|
874
|
+
|
|
875
|
+
declare class TestController extends BaseController {
|
|
876
|
+
protected json(ctx: Context): Promise<void>;
|
|
877
|
+
protected sum(args: TypeAnyObject, _context: McpToolContext): Promise<{
|
|
878
|
+
value: number;
|
|
879
|
+
}>;
|
|
880
|
+
protected multiply(args: TypeAnyObject, _context: McpToolContext): Promise<{
|
|
881
|
+
value: number;
|
|
882
|
+
}>;
|
|
883
|
+
protected average(args: TypeAnyObject, _context: McpToolContext): Promise<{
|
|
884
|
+
value: number;
|
|
885
|
+
count: number;
|
|
886
|
+
}>;
|
|
887
|
+
protected validationString(args: TypeAnyObject, _context: McpToolContext): Promise<{
|
|
888
|
+
length: number;
|
|
889
|
+
normalized: string;
|
|
890
|
+
}>;
|
|
891
|
+
protected validationNumber(args: TypeAnyObject, _context: McpToolContext): Promise<{
|
|
892
|
+
doubled: number;
|
|
893
|
+
}>;
|
|
894
|
+
protected validationBoolean(args: TypeAnyObject, _context: McpToolContext): Promise<{
|
|
895
|
+
active: any;
|
|
896
|
+
}>;
|
|
897
|
+
protected validationArray(args: TypeAnyObject, _context: McpToolContext): Promise<{
|
|
898
|
+
count: number;
|
|
899
|
+
}>;
|
|
900
|
+
protected validationObject(args: TypeAnyObject, _context: McpToolContext): Promise<{
|
|
901
|
+
summary: {
|
|
902
|
+
name: any;
|
|
903
|
+
adult: boolean;
|
|
904
|
+
};
|
|
905
|
+
}>;
|
|
906
|
+
protected validationEnum(args: TypeAnyObject, _context: McpToolContext): Promise<{
|
|
907
|
+
status: any;
|
|
908
|
+
}>;
|
|
909
|
+
protected validationDate(args: TypeAnyObject, _context: McpToolContext): Promise<{
|
|
910
|
+
iso: string;
|
|
911
|
+
timestamp: number;
|
|
912
|
+
}>;
|
|
913
|
+
protected validationOptional(args: TypeAnyObject, _context: McpToolContext): Promise<{
|
|
914
|
+
nickname?: string | undefined;
|
|
915
|
+
name: any;
|
|
916
|
+
hasNickname: boolean;
|
|
917
|
+
}>;
|
|
918
|
+
protected validationDefaults(args: TypeAnyObject, _context: McpToolContext): Promise<{
|
|
919
|
+
name: any;
|
|
920
|
+
limit: any;
|
|
921
|
+
}>;
|
|
922
|
+
protected validationParse(args: TypeAnyObject, _context: McpToolContext): Promise<{
|
|
923
|
+
active: any;
|
|
924
|
+
amount: any;
|
|
925
|
+
}>;
|
|
926
|
+
protected validationNested(args: TypeAnyObject, _context: McpToolContext): Promise<{
|
|
927
|
+
userId: any;
|
|
928
|
+
scoreCount: number;
|
|
929
|
+
}>;
|
|
930
|
+
}
|
|
931
|
+
|
|
568
932
|
declare class UsersController extends ModelController<UserModel> {
|
|
569
933
|
protected readonly model: typeof UserModel;
|
|
570
934
|
path: string;
|
|
@@ -616,6 +980,9 @@ declare const ReqPermissions: (key?: string) => ParameterDecorator;
|
|
|
616
980
|
|
|
617
981
|
declare const ReqUser: (key?: string) => ParameterDecorator;
|
|
618
982
|
|
|
983
|
+
type McpToolOptions = Omit<McpToolMetadata, "propertyKey">;
|
|
984
|
+
declare const McpTool: (options: McpToolOptions) => MethodDecorator;
|
|
985
|
+
|
|
619
986
|
declare const Audit: (active?: boolean) => ClassDecorator;
|
|
620
987
|
|
|
621
988
|
declare class Env extends Env$1 {
|
|
@@ -627,11 +994,18 @@ declare class Env extends Env$1 {
|
|
|
627
994
|
static readonly DATABASE_PREFIX: string;
|
|
628
995
|
static readonly DATABASE_TIMEZONE: string;
|
|
629
996
|
static readonly HTTP_CROSS: string;
|
|
997
|
+
static readonly HTTP_PORT: number;
|
|
998
|
+
static readonly HTTP_PUBLIC: string;
|
|
630
999
|
static readonly HTTP_TLS_CA: Buffer<ArrayBufferLike> | null;
|
|
631
1000
|
static readonly HTTP_TLS_CRT: Buffer<ArrayBufferLike> | null;
|
|
632
1001
|
static readonly HTTP_TLS_KEY: Buffer<ArrayBufferLike> | null;
|
|
1002
|
+
static readonly KEY_HEADER: string;
|
|
633
1003
|
static readonly MODEL_LIMIT: number;
|
|
634
1004
|
static readonly MODEL_LIMIT_MAX: number;
|
|
1005
|
+
static readonly MCP_ALLOWED_ORIGINS: string;
|
|
1006
|
+
static readonly MCP_RATE_LIMIT_MAX: number;
|
|
1007
|
+
static readonly MCP_RATE_LIMIT_WINDOW: number;
|
|
1008
|
+
static readonly MCP_SESSION_TTL: number;
|
|
635
1009
|
static readonly PASSWORD_ALGORITHM: number;
|
|
636
1010
|
static readonly PASSWORD_MEMORY_COST: number;
|
|
637
1011
|
static readonly PASSWORD_PARALLELISM: number;
|
|
@@ -640,33 +1014,31 @@ declare class Env extends Env$1 {
|
|
|
640
1014
|
static readonly SLEEP_AUTH: number;
|
|
641
1015
|
static readonly SLEEP_FORGOT: number;
|
|
642
1016
|
static readonly SLEEP_REGISTRY: number;
|
|
1017
|
+
static readonly TENANT_HEADER: string;
|
|
643
1018
|
static readonly TOKEN_CRT: Buffer<ArrayBufferLike> | null;
|
|
1019
|
+
static readonly TOKEN_HEADER: string;
|
|
644
1020
|
static readonly TOKEN_KEY: Buffer<ArrayBufferLike> | null;
|
|
645
1021
|
static readonly TOKEN_TTL: number;
|
|
1022
|
+
static readonly TOKEN_TTL_FORGOT: number;
|
|
1023
|
+
static readonly TOKEN_TTL_RENEW: number;
|
|
646
1024
|
static readonly TOKEN_TYPE: string;
|
|
647
1025
|
static readonly API_BODYPARSER_STRICT: boolean;
|
|
648
1026
|
static readonly API_BODYPARSER_INFLATE: boolean;
|
|
649
1027
|
static readonly API_BODYPARSER_LIMIT: string;
|
|
650
1028
|
static readonly API_BODYPARSER_TYPE: string;
|
|
651
|
-
static readonly API_HTTP_PORT: number;
|
|
652
|
-
static readonly API_HTTP_PUBLIC: string;
|
|
653
1029
|
static readonly API_HTTP_HYBRID: boolean;
|
|
654
1030
|
static readonly API_HTTP_NOTFOUND: string;
|
|
655
1031
|
static readonly API_HTTP_PATH: string;
|
|
656
1032
|
static readonly API_HTTP_REDIRECT: string;
|
|
657
1033
|
static readonly API_KEY_HASH: string;
|
|
658
|
-
static readonly API_KEY_HEADER: string;
|
|
659
1034
|
static readonly API_SESSION_NAME: string;
|
|
660
1035
|
static readonly API_SESSION_LIFETIME: number;
|
|
661
1036
|
static readonly API_SESSION_SECRET: string;
|
|
662
1037
|
static readonly API_TOKEN_COOKIE: string;
|
|
663
1038
|
static readonly API_TOKEN_COOKIE_SET: boolean;
|
|
664
|
-
static readonly API_TOKEN_FORGOT: number;
|
|
665
|
-
static readonly API_TOKEN_HEADER: string;
|
|
666
|
-
static readonly API_TOKEN_RENEW: number;
|
|
667
1039
|
static readonly API_USER_HISTORY: boolean;
|
|
668
1040
|
static readonly API_WEBSOCKET_START: boolean;
|
|
669
1041
|
}
|
|
670
1042
|
|
|
671
|
-
export { Application, Audit, AuditModel, AuditTypes, AuditsController, AuthController, AuthService, BaseController, CanCreate, CanDelete, CanRead, CanUpdate, Config, ConfigModel, CrudController, Env, FilesController, ForgotController, ForgotModel, GroupModel, GroupPermissionModel, GroupsController, GroupsPermissionsController, HasGroups, HasPermissions, HealthController, IsAuthenticated, Log, LogModel, Loggable,
|
|
672
|
-
export type { ApplicationEvents, AuthEvents, ForgotEvents, IAuthParameters, ModelArgumentsBase, ModelArgumentsCount, ModelArgumentsCreate, ModelArgumentsDelete, ModelArgumentsFindAll, ModelArgumentsFindOne, ModelArgumentsInclude, ModelArgumentsUpdate, ModelCallbackFindAll, ModelCallbackFindOne, ModelOptions, ModelResultFindAll, RegisterEvents };
|
|
1043
|
+
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, McpRateLimiter, McpServerError, McpSessionStore, McpTool, McpToolNotFoundError, McpToolRegistry, MigrationModel, ModelController, ModelService, PermissionModel, PermissionsController, RegisterController, RegisterModel, ReqAuth, ReqGroup, ReqGroups, ReqPermission, ReqPermissions, ReqUser, Service, SessionModel, SessionStore, SetupController, TenantModel, TenantStatus, TestController, UserAuthModel, UserGroupModel, UserModel, UserPasswordModel, UserService, UserStatus, UserTenantModel, UsersController, UsersGroupsController, assertValidMcpToolDefinition, canFactory, isJsonParseError, isJsonRpcId, jsonParseErrorResponse, jsonRpcError, jsonRpcErrorFromCode, jsonRpcResult, parseJsonRpcRequest, sequelize };
|
|
1044
|
+
export type { ApplicationEvents, AuthEvents, ForgotEvents, IAuthParameters, McpCallToolResult, McpDecoratedToolHandler, McpHttpHandlerOptions, McpHttpRequest, McpHttpResponse, McpJsonRpcErrorBody, McpJsonRpcErrorResult, McpJsonRpcId, McpJsonRpcRequest, McpJsonRpcResult, McpLogger, McpNormalizedValidation, McpProtocolVersion, McpRegisteredTool, McpSession, McpSessionContext, McpToolCallLog, McpToolContext, McpToolDeclaration, McpToolDefinition, McpToolHandlerResult, McpToolInput, McpToolMetadata, McpToolOptions, McpToolOutput, ModelArgumentsBase, ModelArgumentsCount, ModelArgumentsCreate, ModelArgumentsDelete, ModelArgumentsFindAll, ModelArgumentsFindOne, ModelArgumentsInclude, ModelArgumentsUpdate, ModelCallbackFindAll, ModelCallbackFindOne, ModelOptions, ModelResultFindAll, RegisterEvents };
|