@seip/bluebird-js 0.1.6 → 0.1.7

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/core/ai.d.ts CHANGED
@@ -1,151 +1,151 @@
1
- import type { Request, Response, NextFunction, RequestHandler } from "express";
2
-
3
- export interface AIOptions {
4
- provider?: "deepseek" | "gemini" | "openai" | "custom";
5
- model?: string;
6
- apiKey?: string;
7
- baseURL?: string;
8
- temperature?: number;
9
- thinking?: boolean | { type: string };
10
- reasoningEffort?: "low" | "medium" | "high";
11
- rateLimit?: number | { minute?: number; day?: number } | { max: number; windowMs: number };
12
- rateWindow?: number;
13
- cacheTtl?: number | boolean;
14
- system?: string;
15
- }
16
-
17
- export interface AIAskOptions {
18
- data?: Record<string, any>;
19
- sensitiveKeys?: string[];
20
- request?: Request | any;
21
- req?: Request | any;
22
- user?: string;
23
- system?: string;
24
- json?: boolean;
25
- schema?: Record<string, any>;
26
- temperature?: number;
27
- model?: string;
28
- provider?: "deepseek" | "gemini" | "openai" | "custom";
29
- apiKey?: string;
30
- baseURL?: string;
31
- cache?: number | boolean;
32
- thinking?: boolean | { type: string };
33
- reasoningEffort?: "low" | "medium" | "high";
34
- maxTokens?: number;
35
- rateLimit?: number | { minute?: number; day?: number } | { max: number; windowMs: number };
36
- }
37
-
38
- export interface AIUsage {
39
- prompt_tokens?: number;
40
- completion_tokens?: number;
41
- total_tokens?: number;
42
- [key: string]: any;
43
- }
44
-
45
- export interface AIResult<T = any> {
46
- success: boolean;
47
- text?: string;
48
- rawText?: string;
49
- parsed?: T;
50
- valid?: boolean;
51
- errors?: any;
52
- reasoning?: string | null;
53
- cached?: boolean;
54
- latency?: number;
55
- provider?: string;
56
- model?: string;
57
- usage?: AIUsage;
58
- maskedKeys?: string[];
59
- error?: string;
60
- message?: string;
61
- retryAfter?: number;
62
- }
63
-
64
- export interface AIStreamChunk {
65
- text: string;
66
- done: boolean;
67
- }
68
-
69
- export interface MaskResult {
70
- maskedPrompt: string;
71
- maskedData: Record<string, any> | null;
72
- tokenMap: Record<string, string>;
73
- reverseTokenMap: Record<string, string>;
74
- }
75
-
76
- export declare function getClientIp(req: Request | any): string;
77
-
78
- export declare function maskSensitiveData(
79
- prompt?: string,
80
- data?: Record<string, any> | null,
81
- sensitiveKeys?: string[]
82
- ): MaskResult;
83
-
84
- export declare function unmaskSensitiveData(
85
- text?: string,
86
- reverseTokenMap?: Record<string, string>
87
- ): string;
88
-
89
- export declare function extractJsonString(text?: string): string;
90
-
91
- export declare class AI {
92
- provider: string;
93
- model: string;
94
- apiKey: string;
95
- baseURL: string;
96
- temperature: number;
97
- thinking: boolean | Object;
98
- reasoningEffort?: "low" | "medium" | "high";
99
- rateLimit?: any;
100
- rateWindow: number;
101
- cacheTtl: number | boolean;
102
- system: string;
103
-
104
- constructor(options?: AIOptions);
105
-
106
- checkRateLimit(
107
- clientKey: string,
108
- limitConfig?: any
109
- ): { allowed: boolean; retryAfter: number };
110
-
111
- ask<T = any>(prompt: string | any[], options?: AIAskOptions): Promise<AIResult<T>>;
112
-
113
- askStream(
114
- prompt: string | any[],
115
- options?: AIAskOptions
116
- ): AsyncGenerator<AIStreamChunk, void, unknown>;
117
-
118
- pipe(
119
- res: Response | any,
120
- prompt: string | any[],
121
- options?: AIAskOptions & { sse?: boolean }
122
- ): Promise<void>;
123
-
124
- stream(
125
- res: Response | any,
126
- prompt: string | any[],
127
- options?: AIAskOptions & { sse?: boolean }
128
- ): Promise<void>;
129
-
130
- middleware(options?: { rateLimit?: any; message?: string }): RequestHandler;
131
-
132
- protect(options?: { rateLimit?: any; message?: string }): RequestHandler;
133
-
134
- static getClientIp(req: Request | any): string;
135
-
136
- static mask(
137
- prompt: string,
138
- data?: Record<string, any> | null,
139
- sensitiveKeys?: string[]
140
- ): MaskResult;
141
-
142
- static unmask(text: string, reverseTokenMap: Record<string, string>): string;
143
-
144
- static protect(options?: AIOptions & { message?: string }): RequestHandler;
145
-
146
- static resetRateLimits(): void;
147
- }
148
-
149
- export declare const ai: AI;
150
- export default AI;
151
-
1
+ import type { Request, Response, NextFunction, RequestHandler } from "express";
2
+
3
+ export interface AIOptions {
4
+ provider?: "deepseek" | "gemini" | "openai" | "custom";
5
+ model?: string;
6
+ apiKey?: string;
7
+ baseURL?: string;
8
+ temperature?: number;
9
+ thinking?: boolean | { type: string };
10
+ reasoningEffort?: "low" | "medium" | "high";
11
+ rateLimit?: number | { minute?: number; day?: number } | { max: number; windowMs: number };
12
+ rateWindow?: number;
13
+ cacheTtl?: number | boolean;
14
+ system?: string;
15
+ }
16
+
17
+ export interface AIAskOptions {
18
+ data?: Record<string, any>;
19
+ sensitiveKeys?: string[];
20
+ request?: Request | any;
21
+ req?: Request | any;
22
+ user?: string;
23
+ system?: string;
24
+ json?: boolean;
25
+ schema?: Record<string, any>;
26
+ temperature?: number;
27
+ model?: string;
28
+ provider?: "deepseek" | "gemini" | "openai" | "custom";
29
+ apiKey?: string;
30
+ baseURL?: string;
31
+ cache?: number | boolean;
32
+ thinking?: boolean | { type: string };
33
+ reasoningEffort?: "low" | "medium" | "high";
34
+ maxTokens?: number;
35
+ rateLimit?: number | { minute?: number; day?: number } | { max: number; windowMs: number };
36
+ }
37
+
38
+ export interface AIUsage {
39
+ prompt_tokens?: number;
40
+ completion_tokens?: number;
41
+ total_tokens?: number;
42
+ [key: string]: any;
43
+ }
44
+
45
+ export interface AIResult<T = any> {
46
+ success: boolean;
47
+ text?: string;
48
+ rawText?: string;
49
+ parsed?: T;
50
+ valid?: boolean;
51
+ errors?: any;
52
+ reasoning?: string | null;
53
+ cached?: boolean;
54
+ latency?: number;
55
+ provider?: string;
56
+ model?: string;
57
+ usage?: AIUsage;
58
+ maskedKeys?: string[];
59
+ error?: string;
60
+ message?: string;
61
+ retryAfter?: number;
62
+ }
63
+
64
+ export interface AIStreamChunk {
65
+ text: string;
66
+ done: boolean;
67
+ }
68
+
69
+ export interface MaskResult {
70
+ maskedPrompt: string;
71
+ maskedData: Record<string, any> | null;
72
+ tokenMap: Record<string, string>;
73
+ reverseTokenMap: Record<string, string>;
74
+ }
75
+
76
+ export declare function getClientIp(req: Request | any): string;
77
+
78
+ export declare function maskSensitiveData(
79
+ prompt?: string,
80
+ data?: Record<string, any> | null,
81
+ sensitiveKeys?: string[]
82
+ ): MaskResult;
83
+
84
+ export declare function unmaskSensitiveData(
85
+ text?: string,
86
+ reverseTokenMap?: Record<string, string>
87
+ ): string;
88
+
89
+ export declare function extractJsonString(text?: string): string;
90
+
91
+ export declare class AI {
92
+ provider: string;
93
+ model: string;
94
+ apiKey: string;
95
+ baseURL: string;
96
+ temperature: number;
97
+ thinking: boolean | Object;
98
+ reasoningEffort?: "low" | "medium" | "high";
99
+ rateLimit?: any;
100
+ rateWindow: number;
101
+ cacheTtl: number | boolean;
102
+ system: string;
103
+
104
+ constructor(options?: AIOptions);
105
+
106
+ checkRateLimit(
107
+ clientKey: string,
108
+ limitConfig?: any
109
+ ): { allowed: boolean; retryAfter: number };
110
+
111
+ ask<T = any>(prompt: string | any[], options?: AIAskOptions): Promise<AIResult<T>>;
112
+
113
+ askStream(
114
+ prompt: string | any[],
115
+ options?: AIAskOptions
116
+ ): AsyncGenerator<AIStreamChunk, void, unknown>;
117
+
118
+ pipe(
119
+ res: Response | any,
120
+ prompt: string | any[],
121
+ options?: AIAskOptions & { sse?: boolean }
122
+ ): Promise<void>;
123
+
124
+ stream(
125
+ res: Response | any,
126
+ prompt: string | any[],
127
+ options?: AIAskOptions & { sse?: boolean }
128
+ ): Promise<void>;
129
+
130
+ middleware(options?: { rateLimit?: any; message?: string }): RequestHandler;
131
+
132
+ protect(options?: { rateLimit?: any; message?: string }): RequestHandler;
133
+
134
+ static getClientIp(req: Request | any): string;
135
+
136
+ static mask(
137
+ prompt: string,
138
+ data?: Record<string, any> | null,
139
+ sensitiveKeys?: string[]
140
+ ): MaskResult;
141
+
142
+ static unmask(text: string, reverseTokenMap: Record<string, string>): string;
143
+
144
+ static protect(options?: AIOptions & { message?: string }): RequestHandler;
145
+
146
+ static resetRateLimits(): void;
147
+ }
148
+
149
+ export declare const ai: AI;
150
+ export default AI;
151
+