@mrxsys/mrx-core 2.12.0-1-and-290-20251215 → 2.12.0-1-and-291-20260102
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/dist/modules/elysia/cache/cache.d.ts +2 -177
- package/dist/modules/elysia/cache/index.js +1 -1
- package/dist/modules/elysia/cache/utils/generate-cache-key.d.ts +2 -0
- package/dist/modules/elysia/db-resolver/db-resolver.d.ts +7 -167
- package/dist/modules/elysia/db-resolver/index.js +2 -2
- package/dist/modules/elysia/rate-limit/index.js +1 -2
- package/dist/modules/elysia/rate-limit/rate-limit.d.ts +8 -404
- package/dist/modules/schema-builder/index.d.ts +0 -6
- package/dist/modules/schema-builder/index.js +20 -123
- package/package.json +8 -8
- package/dist/modules/schema-builder/build-count-schema.d.ts +0 -12
- package/dist/modules/schema-builder/build-delete-schema.d.ts +0 -12
- package/dist/modules/schema-builder/build-find-schema.d.ts +0 -12
- package/dist/modules/schema-builder/build-insert-schema.d.ts +0 -3
- package/dist/modules/schema-builder/build-update-one-schema.d.ts +0 -12
- package/dist/modules/schema-builder/build-update-schema.d.ts +0 -12
|
@@ -1,183 +1,8 @@
|
|
|
1
|
-
import { Elysia } from 'elysia';
|
|
1
|
+
import { Elysia, type DefinitionBase, type MetadataBase, type SingletonBase } from 'elysia';
|
|
2
2
|
import type { KvStore } from '../../../modules/kv-store/types/kv-store';
|
|
3
3
|
import type { CacheOptions } from './types/cache-options';
|
|
4
|
-
export declare const cache: (store?: KvStore) => Elysia<"", {
|
|
5
|
-
decorator: {};
|
|
6
|
-
store: {};
|
|
7
|
-
derive: {};
|
|
8
|
-
resolve: {};
|
|
9
|
-
}, {
|
|
10
|
-
typebox: {};
|
|
11
|
-
error: {};
|
|
12
|
-
}, {
|
|
13
|
-
schema: {};
|
|
14
|
-
standaloneSchema: {};
|
|
4
|
+
export declare const cache: (store?: KvStore) => Elysia<"", SingletonBase, DefinitionBase, MetadataBase & {
|
|
15
5
|
macro: Partial<{
|
|
16
6
|
readonly isCached: CacheOptions;
|
|
17
7
|
}>;
|
|
18
|
-
macroFn: {
|
|
19
|
-
readonly isCached: ({ ttl, prefix }: CacheOptions) => {
|
|
20
|
-
readonly afterHandle: ({ set, responseValue, request }: {
|
|
21
|
-
body: unknown;
|
|
22
|
-
query: Record<string, string>;
|
|
23
|
-
params: {};
|
|
24
|
-
headers: Record<string, string | undefined>;
|
|
25
|
-
cookie: Record<string, import("elysia").Cookie<unknown>>;
|
|
26
|
-
server: import("elysia/universal/server").Server | null;
|
|
27
|
-
redirect: import("elysia").redirect;
|
|
28
|
-
set: {
|
|
29
|
-
headers: import("elysia").HTTPHeaders;
|
|
30
|
-
status?: number | keyof import("elysia").StatusMap;
|
|
31
|
-
redirect?: string;
|
|
32
|
-
cookie?: Record<string, import("elysia/cookies").ElysiaCookie>;
|
|
33
|
-
};
|
|
34
|
-
path: string;
|
|
35
|
-
route: string;
|
|
36
|
-
request: Request;
|
|
37
|
-
store: {};
|
|
38
|
-
status: <const Code extends number | keyof import("elysia").StatusMap, const T = Code extends 100 | 101 | 102 | 103 | 200 | 201 | 202 | 203 | 204 | 205 | 206 | 207 | 208 | 400 | 401 | 402 | 403 | 404 | 405 | 406 | 407 | 408 | 409 | 410 | 411 | 412 | 413 | 414 | 415 | 416 | 417 | 418 | 421 | 422 | 423 | 424 | 425 | 426 | 428 | 429 | 431 | 451 | 500 | 501 | 502 | 503 | 504 | 505 | 506 | 507 | 508 | 510 | 511 | 300 | 301 | 302 | 303 | 304 | 307 | 308 | 420 ? {
|
|
39
|
-
readonly 100: "Continue";
|
|
40
|
-
readonly 101: "Switching Protocols";
|
|
41
|
-
readonly 102: "Processing";
|
|
42
|
-
readonly 103: "Early Hints";
|
|
43
|
-
readonly 200: "OK";
|
|
44
|
-
readonly 201: "Created";
|
|
45
|
-
readonly 202: "Accepted";
|
|
46
|
-
readonly 203: "Non-Authoritative Information";
|
|
47
|
-
readonly 204: "No Content";
|
|
48
|
-
readonly 205: "Reset Content";
|
|
49
|
-
readonly 206: "Partial Content";
|
|
50
|
-
readonly 207: "Multi-Status";
|
|
51
|
-
readonly 208: "Already Reported";
|
|
52
|
-
readonly 300: "Multiple Choices";
|
|
53
|
-
readonly 301: "Moved Permanently";
|
|
54
|
-
readonly 302: "Found";
|
|
55
|
-
readonly 303: "See Other";
|
|
56
|
-
readonly 304: "Not Modified";
|
|
57
|
-
readonly 307: "Temporary Redirect";
|
|
58
|
-
readonly 308: "Permanent Redirect";
|
|
59
|
-
readonly 400: "Bad Request";
|
|
60
|
-
readonly 401: "Unauthorized";
|
|
61
|
-
readonly 402: "Payment Required";
|
|
62
|
-
readonly 403: "Forbidden";
|
|
63
|
-
readonly 404: "Not Found";
|
|
64
|
-
readonly 405: "Method Not Allowed";
|
|
65
|
-
readonly 406: "Not Acceptable";
|
|
66
|
-
readonly 407: "Proxy Authentication Required";
|
|
67
|
-
readonly 408: "Request Timeout";
|
|
68
|
-
readonly 409: "Conflict";
|
|
69
|
-
readonly 410: "Gone";
|
|
70
|
-
readonly 411: "Length Required";
|
|
71
|
-
readonly 412: "Precondition Failed";
|
|
72
|
-
readonly 413: "Payload Too Large";
|
|
73
|
-
readonly 414: "URI Too Long";
|
|
74
|
-
readonly 415: "Unsupported Media Type";
|
|
75
|
-
readonly 416: "Range Not Satisfiable";
|
|
76
|
-
readonly 417: "Expectation Failed";
|
|
77
|
-
readonly 418: "I'm a teapot";
|
|
78
|
-
readonly 420: "Enhance Your Calm";
|
|
79
|
-
readonly 421: "Misdirected Request";
|
|
80
|
-
readonly 422: "Unprocessable Content";
|
|
81
|
-
readonly 423: "Locked";
|
|
82
|
-
readonly 424: "Failed Dependency";
|
|
83
|
-
readonly 425: "Too Early";
|
|
84
|
-
readonly 426: "Upgrade Required";
|
|
85
|
-
readonly 428: "Precondition Required";
|
|
86
|
-
readonly 429: "Too Many Requests";
|
|
87
|
-
readonly 431: "Request Header Fields Too Large";
|
|
88
|
-
readonly 451: "Unavailable For Legal Reasons";
|
|
89
|
-
readonly 500: "Internal Server Error";
|
|
90
|
-
readonly 501: "Not Implemented";
|
|
91
|
-
readonly 502: "Bad Gateway";
|
|
92
|
-
readonly 503: "Service Unavailable";
|
|
93
|
-
readonly 504: "Gateway Timeout";
|
|
94
|
-
readonly 505: "HTTP Version Not Supported";
|
|
95
|
-
readonly 506: "Variant Also Negotiates";
|
|
96
|
-
readonly 507: "Insufficient Storage";
|
|
97
|
-
readonly 508: "Loop Detected";
|
|
98
|
-
readonly 510: "Not Extended";
|
|
99
|
-
readonly 511: "Network Authentication Required";
|
|
100
|
-
}[Code] : Code>(code: Code, response?: T) => import("elysia").ElysiaCustomStatusResponse<Code, T, Code extends "Continue" | "Switching Protocols" | "Processing" | "Early Hints" | "OK" | "Created" | "Accepted" | "Non-Authoritative Information" | "No Content" | "Reset Content" | "Partial Content" | "Multi-Status" | "Already Reported" | "Multiple Choices" | "Moved Permanently" | "Found" | "See Other" | "Not Modified" | "Temporary Redirect" | "Permanent Redirect" | "Bad Request" | "Unauthorized" | "Payment Required" | "Forbidden" | "Not Found" | "Method Not Allowed" | "Not Acceptable" | "Proxy Authentication Required" | "Request Timeout" | "Conflict" | "Gone" | "Length Required" | "Precondition Failed" | "Payload Too Large" | "URI Too Long" | "Unsupported Media Type" | "Range Not Satisfiable" | "Expectation Failed" | "I'm a teapot" | "Enhance Your Calm" | "Misdirected Request" | "Unprocessable Content" | "Locked" | "Failed Dependency" | "Too Early" | "Upgrade Required" | "Precondition Required" | "Too Many Requests" | "Request Header Fields Too Large" | "Unavailable For Legal Reasons" | "Internal Server Error" | "Not Implemented" | "Bad Gateway" | "Service Unavailable" | "Gateway Timeout" | "HTTP Version Not Supported" | "Variant Also Negotiates" | "Insufficient Storage" | "Loop Detected" | "Not Extended" | "Network Authentication Required" ? {
|
|
101
|
-
readonly Continue: 100;
|
|
102
|
-
readonly "Switching Protocols": 101;
|
|
103
|
-
readonly Processing: 102;
|
|
104
|
-
readonly "Early Hints": 103;
|
|
105
|
-
readonly OK: 200;
|
|
106
|
-
readonly Created: 201;
|
|
107
|
-
readonly Accepted: 202;
|
|
108
|
-
readonly "Non-Authoritative Information": 203;
|
|
109
|
-
readonly "No Content": 204;
|
|
110
|
-
readonly "Reset Content": 205;
|
|
111
|
-
readonly "Partial Content": 206;
|
|
112
|
-
readonly "Multi-Status": 207;
|
|
113
|
-
readonly "Already Reported": 208;
|
|
114
|
-
readonly "Multiple Choices": 300;
|
|
115
|
-
readonly "Moved Permanently": 301;
|
|
116
|
-
readonly Found: 302;
|
|
117
|
-
readonly "See Other": 303;
|
|
118
|
-
readonly "Not Modified": 304;
|
|
119
|
-
readonly "Temporary Redirect": 307;
|
|
120
|
-
readonly "Permanent Redirect": 308;
|
|
121
|
-
readonly "Bad Request": 400;
|
|
122
|
-
readonly Unauthorized: 401;
|
|
123
|
-
readonly "Payment Required": 402;
|
|
124
|
-
readonly Forbidden: 403;
|
|
125
|
-
readonly "Not Found": 404;
|
|
126
|
-
readonly "Method Not Allowed": 405;
|
|
127
|
-
readonly "Not Acceptable": 406;
|
|
128
|
-
readonly "Proxy Authentication Required": 407;
|
|
129
|
-
readonly "Request Timeout": 408;
|
|
130
|
-
readonly Conflict: 409;
|
|
131
|
-
readonly Gone: 410;
|
|
132
|
-
readonly "Length Required": 411;
|
|
133
|
-
readonly "Precondition Failed": 412;
|
|
134
|
-
readonly "Payload Too Large": 413;
|
|
135
|
-
readonly "URI Too Long": 414;
|
|
136
|
-
readonly "Unsupported Media Type": 415;
|
|
137
|
-
readonly "Range Not Satisfiable": 416;
|
|
138
|
-
readonly "Expectation Failed": 417;
|
|
139
|
-
readonly "I'm a teapot": 418;
|
|
140
|
-
readonly "Enhance Your Calm": 420;
|
|
141
|
-
readonly "Misdirected Request": 421;
|
|
142
|
-
readonly "Unprocessable Content": 422;
|
|
143
|
-
readonly Locked: 423;
|
|
144
|
-
readonly "Failed Dependency": 424;
|
|
145
|
-
readonly "Too Early": 425;
|
|
146
|
-
readonly "Upgrade Required": 426;
|
|
147
|
-
readonly "Precondition Required": 428;
|
|
148
|
-
readonly "Too Many Requests": 429;
|
|
149
|
-
readonly "Request Header Fields Too Large": 431;
|
|
150
|
-
readonly "Unavailable For Legal Reasons": 451;
|
|
151
|
-
readonly "Internal Server Error": 500;
|
|
152
|
-
readonly "Not Implemented": 501;
|
|
153
|
-
readonly "Bad Gateway": 502;
|
|
154
|
-
readonly "Service Unavailable": 503;
|
|
155
|
-
readonly "Gateway Timeout": 504;
|
|
156
|
-
readonly "HTTP Version Not Supported": 505;
|
|
157
|
-
readonly "Variant Also Negotiates": 506;
|
|
158
|
-
readonly "Insufficient Storage": 507;
|
|
159
|
-
readonly "Loop Detected": 508;
|
|
160
|
-
readonly "Not Extended": 510;
|
|
161
|
-
readonly "Network Authentication Required": 511;
|
|
162
|
-
}[Code] : Code>;
|
|
163
|
-
} & {
|
|
164
|
-
responseValue: unknown;
|
|
165
|
-
response: unknown;
|
|
166
|
-
}) => Promise<void>;
|
|
167
|
-
};
|
|
168
|
-
};
|
|
169
|
-
parser: {};
|
|
170
|
-
response: {};
|
|
171
|
-
}, {}, {
|
|
172
|
-
derive: {};
|
|
173
|
-
resolve: {};
|
|
174
|
-
schema: {};
|
|
175
|
-
standaloneSchema: {};
|
|
176
|
-
response: {};
|
|
177
|
-
}, {
|
|
178
|
-
derive: {};
|
|
179
|
-
resolve: {};
|
|
180
|
-
schema: {};
|
|
181
|
-
standaloneSchema: {};
|
|
182
|
-
response: {};
|
|
183
8
|
}>;
|
|
@@ -30,7 +30,7 @@ var generateCacheKey = async (request) => {
|
|
|
30
30
|
const hasher = new Bun.CryptoHasher("sha256");
|
|
31
31
|
hasher.update(method);
|
|
32
32
|
hasher.update(url);
|
|
33
|
-
hasher.update(JSON.stringify(headers));
|
|
33
|
+
hasher.update(JSON.stringify([...headers.entries()]));
|
|
34
34
|
await _calculateBodyHash(request.body, hasher);
|
|
35
35
|
return hasher.digest("hex");
|
|
36
36
|
};
|
|
@@ -1,172 +1,26 @@
|
|
|
1
|
-
import { Elysia } from 'elysia';
|
|
1
|
+
import { Elysia, type DefinitionBase, type MetadataBase } from 'elysia';
|
|
2
2
|
import { MSSQL } from '../../../modules/database/mssql';
|
|
3
3
|
import type { MSSQLDatabaseOptions } from '../../../modules/database/types/mssql-database-option';
|
|
4
|
+
import type { TObject, TString } from '@sinclair/typebox';
|
|
4
5
|
export declare const dbResolver: (prefixDatabaseName?: string) => Elysia<"", {
|
|
5
6
|
decorator: {};
|
|
6
7
|
store: {};
|
|
7
8
|
derive: {};
|
|
8
9
|
resolve: {};
|
|
9
|
-
}, {
|
|
10
|
+
}, DefinitionBase & {
|
|
10
11
|
typebox: {
|
|
11
|
-
|
|
12
|
-
|
|
12
|
+
DbResolverHeader: TObject<{
|
|
13
|
+
"database-using": TString;
|
|
13
14
|
}>;
|
|
14
15
|
};
|
|
15
|
-
|
|
16
|
-
}, {
|
|
17
|
-
schema: {};
|
|
18
|
-
standaloneSchema: {};
|
|
16
|
+
}, MetadataBase & {
|
|
19
17
|
macro: Partial<{
|
|
20
18
|
readonly injectDynamicDB: Omit<MSSQLDatabaseOptions, "databaseName">;
|
|
21
19
|
readonly injectStaticDB: string;
|
|
22
20
|
}>;
|
|
23
21
|
macroFn: {
|
|
24
22
|
readonly injectDynamicDB: (config: Omit<MSSQLDatabaseOptions, "databaseName">) => {
|
|
25
|
-
readonly
|
|
26
|
-
readonly resolve: ({ headers }: {
|
|
27
|
-
body: unknown;
|
|
28
|
-
query: Record<string, string>;
|
|
29
|
-
params: Record<string, string>;
|
|
30
|
-
headers: Record<string, string | undefined>;
|
|
31
|
-
cookie: Record<string, import("elysia").Cookie<unknown>>;
|
|
32
|
-
server: import("elysia/universal/server").Server | null;
|
|
33
|
-
redirect: import("elysia").redirect;
|
|
34
|
-
set: {
|
|
35
|
-
headers: import("elysia").HTTPHeaders;
|
|
36
|
-
status?: number | keyof import("elysia").StatusMap;
|
|
37
|
-
redirect?: string;
|
|
38
|
-
cookie?: Record<string, import("elysia/cookies").ElysiaCookie>;
|
|
39
|
-
};
|
|
40
|
-
path: string;
|
|
41
|
-
route: string;
|
|
42
|
-
request: Request;
|
|
43
|
-
store: {};
|
|
44
|
-
status: <const Code extends number | keyof import("elysia").StatusMap, const T = Code extends 100 | 101 | 102 | 103 | 200 | 201 | 202 | 203 | 204 | 205 | 206 | 207 | 208 | 400 | 401 | 402 | 403 | 404 | 405 | 406 | 407 | 408 | 409 | 410 | 411 | 412 | 413 | 414 | 415 | 416 | 417 | 418 | 421 | 422 | 423 | 424 | 425 | 426 | 428 | 429 | 431 | 451 | 500 | 501 | 502 | 503 | 504 | 505 | 506 | 507 | 508 | 510 | 511 | 300 | 301 | 302 | 303 | 304 | 307 | 308 | 420 ? {
|
|
45
|
-
readonly 100: "Continue";
|
|
46
|
-
readonly 101: "Switching Protocols";
|
|
47
|
-
readonly 102: "Processing";
|
|
48
|
-
readonly 103: "Early Hints";
|
|
49
|
-
readonly 200: "OK";
|
|
50
|
-
readonly 201: "Created";
|
|
51
|
-
readonly 202: "Accepted";
|
|
52
|
-
readonly 203: "Non-Authoritative Information";
|
|
53
|
-
readonly 204: "No Content";
|
|
54
|
-
readonly 205: "Reset Content";
|
|
55
|
-
readonly 206: "Partial Content";
|
|
56
|
-
readonly 207: "Multi-Status";
|
|
57
|
-
readonly 208: "Already Reported";
|
|
58
|
-
readonly 300: "Multiple Choices";
|
|
59
|
-
readonly 301: "Moved Permanently";
|
|
60
|
-
readonly 302: "Found";
|
|
61
|
-
readonly 303: "See Other";
|
|
62
|
-
readonly 304: "Not Modified";
|
|
63
|
-
readonly 307: "Temporary Redirect";
|
|
64
|
-
readonly 308: "Permanent Redirect";
|
|
65
|
-
readonly 400: "Bad Request";
|
|
66
|
-
readonly 401: "Unauthorized";
|
|
67
|
-
readonly 402: "Payment Required";
|
|
68
|
-
readonly 403: "Forbidden";
|
|
69
|
-
readonly 404: "Not Found";
|
|
70
|
-
readonly 405: "Method Not Allowed";
|
|
71
|
-
readonly 406: "Not Acceptable";
|
|
72
|
-
readonly 407: "Proxy Authentication Required";
|
|
73
|
-
readonly 408: "Request Timeout";
|
|
74
|
-
readonly 409: "Conflict";
|
|
75
|
-
readonly 410: "Gone";
|
|
76
|
-
readonly 411: "Length Required";
|
|
77
|
-
readonly 412: "Precondition Failed";
|
|
78
|
-
readonly 413: "Payload Too Large";
|
|
79
|
-
readonly 414: "URI Too Long";
|
|
80
|
-
readonly 415: "Unsupported Media Type";
|
|
81
|
-
readonly 416: "Range Not Satisfiable";
|
|
82
|
-
readonly 417: "Expectation Failed";
|
|
83
|
-
readonly 418: "I'm a teapot";
|
|
84
|
-
readonly 420: "Enhance Your Calm";
|
|
85
|
-
readonly 421: "Misdirected Request";
|
|
86
|
-
readonly 422: "Unprocessable Content";
|
|
87
|
-
readonly 423: "Locked";
|
|
88
|
-
readonly 424: "Failed Dependency";
|
|
89
|
-
readonly 425: "Too Early";
|
|
90
|
-
readonly 426: "Upgrade Required";
|
|
91
|
-
readonly 428: "Precondition Required";
|
|
92
|
-
readonly 429: "Too Many Requests";
|
|
93
|
-
readonly 431: "Request Header Fields Too Large";
|
|
94
|
-
readonly 451: "Unavailable For Legal Reasons";
|
|
95
|
-
readonly 500: "Internal Server Error";
|
|
96
|
-
readonly 501: "Not Implemented";
|
|
97
|
-
readonly 502: "Bad Gateway";
|
|
98
|
-
readonly 503: "Service Unavailable";
|
|
99
|
-
readonly 504: "Gateway Timeout";
|
|
100
|
-
readonly 505: "HTTP Version Not Supported";
|
|
101
|
-
readonly 506: "Variant Also Negotiates";
|
|
102
|
-
readonly 507: "Insufficient Storage";
|
|
103
|
-
readonly 508: "Loop Detected";
|
|
104
|
-
readonly 510: "Not Extended";
|
|
105
|
-
readonly 511: "Network Authentication Required";
|
|
106
|
-
}[Code] : Code>(code: Code, response?: T) => import("elysia").ElysiaCustomStatusResponse<Code, T, Code extends "Continue" | "Switching Protocols" | "Processing" | "Early Hints" | "OK" | "Created" | "Accepted" | "Non-Authoritative Information" | "No Content" | "Reset Content" | "Partial Content" | "Multi-Status" | "Already Reported" | "Multiple Choices" | "Moved Permanently" | "Found" | "See Other" | "Not Modified" | "Temporary Redirect" | "Permanent Redirect" | "Bad Request" | "Unauthorized" | "Payment Required" | "Forbidden" | "Not Found" | "Method Not Allowed" | "Not Acceptable" | "Proxy Authentication Required" | "Request Timeout" | "Conflict" | "Gone" | "Length Required" | "Precondition Failed" | "Payload Too Large" | "URI Too Long" | "Unsupported Media Type" | "Range Not Satisfiable" | "Expectation Failed" | "I'm a teapot" | "Enhance Your Calm" | "Misdirected Request" | "Unprocessable Content" | "Locked" | "Failed Dependency" | "Too Early" | "Upgrade Required" | "Precondition Required" | "Too Many Requests" | "Request Header Fields Too Large" | "Unavailable For Legal Reasons" | "Internal Server Error" | "Not Implemented" | "Bad Gateway" | "Service Unavailable" | "Gateway Timeout" | "HTTP Version Not Supported" | "Variant Also Negotiates" | "Insufficient Storage" | "Loop Detected" | "Not Extended" | "Network Authentication Required" ? {
|
|
107
|
-
readonly Continue: 100;
|
|
108
|
-
readonly "Switching Protocols": 101;
|
|
109
|
-
readonly Processing: 102;
|
|
110
|
-
readonly "Early Hints": 103;
|
|
111
|
-
readonly OK: 200;
|
|
112
|
-
readonly Created: 201;
|
|
113
|
-
readonly Accepted: 202;
|
|
114
|
-
readonly "Non-Authoritative Information": 203;
|
|
115
|
-
readonly "No Content": 204;
|
|
116
|
-
readonly "Reset Content": 205;
|
|
117
|
-
readonly "Partial Content": 206;
|
|
118
|
-
readonly "Multi-Status": 207;
|
|
119
|
-
readonly "Already Reported": 208;
|
|
120
|
-
readonly "Multiple Choices": 300;
|
|
121
|
-
readonly "Moved Permanently": 301;
|
|
122
|
-
readonly Found: 302;
|
|
123
|
-
readonly "See Other": 303;
|
|
124
|
-
readonly "Not Modified": 304;
|
|
125
|
-
readonly "Temporary Redirect": 307;
|
|
126
|
-
readonly "Permanent Redirect": 308;
|
|
127
|
-
readonly "Bad Request": 400;
|
|
128
|
-
readonly Unauthorized: 401;
|
|
129
|
-
readonly "Payment Required": 402;
|
|
130
|
-
readonly Forbidden: 403;
|
|
131
|
-
readonly "Not Found": 404;
|
|
132
|
-
readonly "Method Not Allowed": 405;
|
|
133
|
-
readonly "Not Acceptable": 406;
|
|
134
|
-
readonly "Proxy Authentication Required": 407;
|
|
135
|
-
readonly "Request Timeout": 408;
|
|
136
|
-
readonly Conflict: 409;
|
|
137
|
-
readonly Gone: 410;
|
|
138
|
-
readonly "Length Required": 411;
|
|
139
|
-
readonly "Precondition Failed": 412;
|
|
140
|
-
readonly "Payload Too Large": 413;
|
|
141
|
-
readonly "URI Too Long": 414;
|
|
142
|
-
readonly "Unsupported Media Type": 415;
|
|
143
|
-
readonly "Range Not Satisfiable": 416;
|
|
144
|
-
readonly "Expectation Failed": 417;
|
|
145
|
-
readonly "I'm a teapot": 418;
|
|
146
|
-
readonly "Enhance Your Calm": 420;
|
|
147
|
-
readonly "Misdirected Request": 421;
|
|
148
|
-
readonly "Unprocessable Content": 422;
|
|
149
|
-
readonly Locked: 423;
|
|
150
|
-
readonly "Failed Dependency": 424;
|
|
151
|
-
readonly "Too Early": 425;
|
|
152
|
-
readonly "Upgrade Required": 426;
|
|
153
|
-
readonly "Precondition Required": 428;
|
|
154
|
-
readonly "Too Many Requests": 429;
|
|
155
|
-
readonly "Request Header Fields Too Large": 431;
|
|
156
|
-
readonly "Unavailable For Legal Reasons": 451;
|
|
157
|
-
readonly "Internal Server Error": 500;
|
|
158
|
-
readonly "Not Implemented": 501;
|
|
159
|
-
readonly "Bad Gateway": 502;
|
|
160
|
-
readonly "Service Unavailable": 503;
|
|
161
|
-
readonly "Gateway Timeout": 504;
|
|
162
|
-
readonly "HTTP Version Not Supported": 505;
|
|
163
|
-
readonly "Variant Also Negotiates": 506;
|
|
164
|
-
readonly "Insufficient Storage": 507;
|
|
165
|
-
readonly "Loop Detected": 508;
|
|
166
|
-
readonly "Not Extended": 510;
|
|
167
|
-
readonly "Network Authentication Required": 511;
|
|
168
|
-
}[Code] : Code>;
|
|
169
|
-
}) => Promise<{
|
|
23
|
+
readonly resolve: () => Promise<{
|
|
170
24
|
dynamicDB: MSSQL;
|
|
171
25
|
}>;
|
|
172
26
|
};
|
|
@@ -176,18 +30,4 @@ export declare const dbResolver: (prefixDatabaseName?: string) => Elysia<"", {
|
|
|
176
30
|
};
|
|
177
31
|
};
|
|
178
32
|
};
|
|
179
|
-
parser: {};
|
|
180
|
-
response: {};
|
|
181
|
-
}, {}, {
|
|
182
|
-
derive: {};
|
|
183
|
-
resolve: {};
|
|
184
|
-
schema: {};
|
|
185
|
-
standaloneSchema: {};
|
|
186
|
-
response: {};
|
|
187
|
-
}, {
|
|
188
|
-
derive: {};
|
|
189
|
-
resolve: {};
|
|
190
|
-
schema: {};
|
|
191
|
-
standaloneSchema: {};
|
|
192
|
-
response: {};
|
|
193
33
|
}>;
|
|
@@ -22,13 +22,13 @@ import"../../../chunk-642xajvx.js";
|
|
|
22
22
|
// source/modules/elysia/db-resolver/db-resolver.ts
|
|
23
23
|
import { Elysia, t } from "elysia";
|
|
24
24
|
var dbResolver = (prefixDatabaseName = "") => new Elysia().model({
|
|
25
|
-
|
|
25
|
+
DbResolverHeader: t.Object({
|
|
26
26
|
"database-using": t.String()
|
|
27
27
|
})
|
|
28
28
|
}).macro({
|
|
29
29
|
injectDynamicDB(config) {
|
|
30
30
|
return {
|
|
31
|
-
headers: "
|
|
31
|
+
headers: "DbResolverHeader",
|
|
32
32
|
async resolve({ headers }) {
|
|
33
33
|
const databaseName = headers["database-using"];
|
|
34
34
|
if (!SingletonManager.has(`${prefixDatabaseName}${databaseName}`)) {
|
|
@@ -14,9 +14,8 @@ import"../../../chunk-jz3wd472.js";
|
|
|
14
14
|
|
|
15
15
|
// source/modules/elysia/rate-limit/rate-limit.ts
|
|
16
16
|
import { Elysia } from "elysia";
|
|
17
|
-
var rateLimit = (store) => {
|
|
17
|
+
var rateLimit = (store = new MemoryStore) => {
|
|
18
18
|
const restrictedRoutes = new Map;
|
|
19
|
-
store = store || new MemoryStore;
|
|
20
19
|
const rateLimitCheck = async (key, limit, window, set) => {
|
|
21
20
|
if (set.headers["X-RateLimit-Limit"])
|
|
22
21
|
return;
|
|
@@ -1,415 +1,19 @@
|
|
|
1
1
|
import type { KvStore } from '../../../modules/kv-store/types/kv-store';
|
|
2
|
-
import { Elysia, type
|
|
2
|
+
import { Elysia, type DefinitionBase, type MetadataBase, type SingletonBase } from 'elysia';
|
|
3
3
|
import type { RateLimitOptions } from './types/rate-limit-options';
|
|
4
4
|
/**
|
|
5
|
-
* Rate limiting plugin for Elysia applications
|
|
5
|
+
* Rate limiting plugin for Elysia applications.
|
|
6
6
|
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
7
|
+
* Tracks request rates per IP and route, enforcing configurable limits with a fixed time window.
|
|
8
|
+
* Adds `X-RateLimit-Limit`, `X-RateLimit-Remaining`, and `X-RateLimit-Reset` headers to responses.
|
|
9
9
|
*
|
|
10
|
-
*
|
|
11
|
-
*
|
|
12
|
-
* - Each route can have its own limit and time window configuration
|
|
13
|
-
* - Route-level rate limits override global rate limits
|
|
14
|
-
* - Headers are added to all responses indicating the current rate limit status
|
|
10
|
+
* @param store - KV store for tracking limits. Defaults to in-memory.
|
|
11
|
+
* @returns Elysia plugin with `rateLimit` macro
|
|
15
12
|
*
|
|
16
|
-
*
|
|
17
|
-
* The plugin adds the following headers to all responses (including 429 errors):
|
|
18
|
-
* - `X-RateLimit-Limit`: The maximum number of requests allowed in the window
|
|
19
|
-
* - `X-RateLimit-Remaining`: The number of requests remaining in the current window
|
|
20
|
-
* - `X-RateLimit-Reset`: The time in seconds until the rate limit resets (Unix timestamp)
|
|
21
|
-
*
|
|
22
|
-
* When a rate limit is exceeded, the response includes a 429 (Too Many Requests) status code
|
|
23
|
-
* and the error key `elysia.rate-limit.error.exceeded`, along with the rate limit headers
|
|
24
|
-
* to help clients implement exponential backoff retry strategies.
|
|
25
|
-
*
|
|
26
|
-
* @param store - The KV store instance for tracking rate limits. Defaults to an in-memory store.
|
|
27
|
-
* Supports any `KvStore` implementation from `@mrxsys/mrx-core/modules/kv-store` (e.g., `MemoryStore`, `IoRedisStore`)
|
|
28
|
-
*
|
|
29
|
-
* @returns An {@link Elysia} plugin that adds rate limiting functionality via the `rateLimit` macro
|
|
30
|
-
*
|
|
31
|
-
* @example
|
|
32
|
-
* Basic usage with default in-memory store (development)
|
|
33
|
-
* ```ts
|
|
34
|
-
* import { rateLimit } from '@mrxsys/mrx-core/modules/elysia/elysia-ratelimit';
|
|
35
|
-
* import { Elysia } from 'elysia';
|
|
36
|
-
*
|
|
37
|
-
* const app = new Elysia()
|
|
38
|
-
* .use(rateLimit())
|
|
39
|
-
* .get('/api/data', () => ({ message: 'Hello World' }), {
|
|
40
|
-
* rateLimit: {
|
|
41
|
-
* limit: 100, // 100 requests
|
|
42
|
-
* window: 60 // per minute
|
|
43
|
-
* }
|
|
44
|
-
* })
|
|
45
|
-
* .listen(3000);
|
|
46
|
-
* ```
|
|
47
|
-
*
|
|
48
|
-
* @example
|
|
49
|
-
* Using Redis store for distributed rate limiting (production)
|
|
50
|
-
* ```ts
|
|
51
|
-
* import { IoRedisStore } from '@mrxsys/mrx-core/modules/kv-store/ioredis'; // or use bun-redis
|
|
52
|
-
* import { rateLimit } from '@mrxsys/mrx-core/modules/elysia/elysia-ratelimit';
|
|
53
|
-
* import { Elysia } from 'elysia';
|
|
54
|
-
*
|
|
55
|
-
* const redisStore = new IoRedisStore({
|
|
56
|
-
* host: 'localhost',
|
|
57
|
-
* port: 6379
|
|
58
|
-
* });
|
|
59
|
-
* await redisStore.connect();
|
|
60
|
-
*
|
|
61
|
-
* const app = new Elysia()
|
|
62
|
-
* .use(rateLimit(redisStore))
|
|
63
|
-
* .get('/api/endpoint', () => ({ data: 'content' }), {
|
|
64
|
-
* rateLimit: {
|
|
65
|
-
* limit: 1000, // 1000 requests
|
|
66
|
-
* window: 3600 // per hour
|
|
67
|
-
* }
|
|
68
|
-
* })
|
|
69
|
-
* .listen(3000);
|
|
70
|
-
* ```
|
|
71
|
-
*
|
|
72
|
-
* @example
|
|
73
|
-
* Global rate limit with route-level overrides
|
|
74
|
-
* ```ts
|
|
75
|
-
* const app = new Elysia()
|
|
76
|
-
* .use(rateLimit())
|
|
77
|
-
* .guard({
|
|
78
|
-
* rateLimit: {
|
|
79
|
-
* limit: 100,
|
|
80
|
-
* window: 60
|
|
81
|
-
* }
|
|
82
|
-
* })
|
|
83
|
-
* .get('/api/slow', () => 'content', {
|
|
84
|
-
* rateLimit: {
|
|
85
|
-
* limit: 10, // Override global: stricter limit
|
|
86
|
-
* window: 60
|
|
87
|
-
* }
|
|
88
|
-
* })
|
|
89
|
-
* .get('/api/fast', () => 'content') // Uses global limit
|
|
90
|
-
* .listen(3000);
|
|
91
|
-
* ```
|
|
92
|
-
*
|
|
93
|
-
* @throws ({@link HttpError}) – `elysia.rate-limit.error.exceeded` when the rate limit is exceeded (HTTP 429)
|
|
13
|
+
* @throws ({@link HttpError}) – `elysia.rate-limit.error.exceeded` (HTTP 429)
|
|
94
14
|
*/
|
|
95
|
-
export declare const rateLimit: (store?: KvStore) => Elysia<"", {
|
|
96
|
-
decorator: {};
|
|
97
|
-
store: {};
|
|
98
|
-
derive: {};
|
|
99
|
-
resolve: {};
|
|
100
|
-
}, {
|
|
101
|
-
typebox: {};
|
|
102
|
-
error: {};
|
|
103
|
-
}, {
|
|
104
|
-
schema: {};
|
|
105
|
-
standaloneSchema: {};
|
|
15
|
+
export declare const rateLimit: (store?: KvStore) => Elysia<"rateLimit", SingletonBase, DefinitionBase, MetadataBase & {
|
|
106
16
|
macro: Partial<{
|
|
107
17
|
readonly rateLimit: RateLimitOptions;
|
|
108
18
|
}>;
|
|
109
|
-
macroFn: {
|
|
110
|
-
readonly rateLimit: ({ limit, window }: RateLimitOptions) => {
|
|
111
|
-
readonly transform: ({ request }: {
|
|
112
|
-
body: unknown;
|
|
113
|
-
query: Record<string, string>;
|
|
114
|
-
params: {};
|
|
115
|
-
headers: Record<string, string | undefined>;
|
|
116
|
-
cookie: Record<string, import("elysia").Cookie<unknown>>;
|
|
117
|
-
server: import("elysia/universal/server").Server | null;
|
|
118
|
-
redirect: import("elysia").redirect;
|
|
119
|
-
set: {
|
|
120
|
-
headers: HTTPHeaders;
|
|
121
|
-
status?: number | keyof StatusMap;
|
|
122
|
-
redirect?: string;
|
|
123
|
-
cookie?: Record<string, import("elysia/cookies").ElysiaCookie>;
|
|
124
|
-
};
|
|
125
|
-
path: string;
|
|
126
|
-
route: string;
|
|
127
|
-
request: Request;
|
|
128
|
-
store: {};
|
|
129
|
-
status: <const Code extends number | keyof StatusMap, const T = Code extends 100 | 101 | 102 | 103 | 200 | 201 | 202 | 203 | 204 | 205 | 206 | 207 | 208 | 400 | 401 | 402 | 403 | 404 | 405 | 406 | 407 | 408 | 409 | 410 | 411 | 412 | 413 | 414 | 415 | 416 | 417 | 418 | 421 | 422 | 423 | 424 | 425 | 426 | 428 | 429 | 431 | 451 | 500 | 501 | 502 | 503 | 504 | 505 | 506 | 507 | 508 | 510 | 511 | 300 | 301 | 302 | 303 | 304 | 307 | 308 | 420 ? {
|
|
130
|
-
readonly 100: "Continue";
|
|
131
|
-
readonly 101: "Switching Protocols";
|
|
132
|
-
readonly 102: "Processing";
|
|
133
|
-
readonly 103: "Early Hints";
|
|
134
|
-
readonly 200: "OK";
|
|
135
|
-
readonly 201: "Created";
|
|
136
|
-
readonly 202: "Accepted";
|
|
137
|
-
readonly 203: "Non-Authoritative Information";
|
|
138
|
-
readonly 204: "No Content";
|
|
139
|
-
readonly 205: "Reset Content";
|
|
140
|
-
readonly 206: "Partial Content";
|
|
141
|
-
readonly 207: "Multi-Status";
|
|
142
|
-
readonly 208: "Already Reported";
|
|
143
|
-
readonly 300: "Multiple Choices";
|
|
144
|
-
readonly 301: "Moved Permanently";
|
|
145
|
-
readonly 302: "Found";
|
|
146
|
-
readonly 303: "See Other";
|
|
147
|
-
readonly 304: "Not Modified";
|
|
148
|
-
readonly 307: "Temporary Redirect";
|
|
149
|
-
readonly 308: "Permanent Redirect";
|
|
150
|
-
readonly 400: "Bad Request";
|
|
151
|
-
readonly 401: "Unauthorized";
|
|
152
|
-
readonly 402: "Payment Required";
|
|
153
|
-
readonly 403: "Forbidden";
|
|
154
|
-
readonly 404: "Not Found";
|
|
155
|
-
readonly 405: "Method Not Allowed";
|
|
156
|
-
readonly 406: "Not Acceptable";
|
|
157
|
-
readonly 407: "Proxy Authentication Required";
|
|
158
|
-
readonly 408: "Request Timeout";
|
|
159
|
-
readonly 409: "Conflict";
|
|
160
|
-
readonly 410: "Gone";
|
|
161
|
-
readonly 411: "Length Required";
|
|
162
|
-
readonly 412: "Precondition Failed";
|
|
163
|
-
readonly 413: "Payload Too Large";
|
|
164
|
-
readonly 414: "URI Too Long";
|
|
165
|
-
readonly 415: "Unsupported Media Type";
|
|
166
|
-
readonly 416: "Range Not Satisfiable";
|
|
167
|
-
readonly 417: "Expectation Failed";
|
|
168
|
-
readonly 418: "I'm a teapot";
|
|
169
|
-
readonly 420: "Enhance Your Calm";
|
|
170
|
-
readonly 421: "Misdirected Request";
|
|
171
|
-
readonly 422: "Unprocessable Content";
|
|
172
|
-
readonly 423: "Locked";
|
|
173
|
-
readonly 424: "Failed Dependency";
|
|
174
|
-
readonly 425: "Too Early";
|
|
175
|
-
readonly 426: "Upgrade Required";
|
|
176
|
-
readonly 428: "Precondition Required";
|
|
177
|
-
readonly 429: "Too Many Requests";
|
|
178
|
-
readonly 431: "Request Header Fields Too Large";
|
|
179
|
-
readonly 451: "Unavailable For Legal Reasons";
|
|
180
|
-
readonly 500: "Internal Server Error";
|
|
181
|
-
readonly 501: "Not Implemented";
|
|
182
|
-
readonly 502: "Bad Gateway";
|
|
183
|
-
readonly 503: "Service Unavailable";
|
|
184
|
-
readonly 504: "Gateway Timeout";
|
|
185
|
-
readonly 505: "HTTP Version Not Supported";
|
|
186
|
-
readonly 506: "Variant Also Negotiates";
|
|
187
|
-
readonly 507: "Insufficient Storage";
|
|
188
|
-
readonly 508: "Loop Detected";
|
|
189
|
-
readonly 510: "Not Extended";
|
|
190
|
-
readonly 511: "Network Authentication Required";
|
|
191
|
-
}[Code] : Code>(code: Code, response?: T) => import("elysia").ElysiaCustomStatusResponse<Code, T, Code extends "Continue" | "Switching Protocols" | "Processing" | "Early Hints" | "OK" | "Created" | "Accepted" | "Non-Authoritative Information" | "No Content" | "Reset Content" | "Partial Content" | "Multi-Status" | "Already Reported" | "Multiple Choices" | "Moved Permanently" | "Found" | "See Other" | "Not Modified" | "Temporary Redirect" | "Permanent Redirect" | "Bad Request" | "Unauthorized" | "Payment Required" | "Forbidden" | "Not Found" | "Method Not Allowed" | "Not Acceptable" | "Proxy Authentication Required" | "Request Timeout" | "Conflict" | "Gone" | "Length Required" | "Precondition Failed" | "Payload Too Large" | "URI Too Long" | "Unsupported Media Type" | "Range Not Satisfiable" | "Expectation Failed" | "I'm a teapot" | "Enhance Your Calm" | "Misdirected Request" | "Unprocessable Content" | "Locked" | "Failed Dependency" | "Too Early" | "Upgrade Required" | "Precondition Required" | "Too Many Requests" | "Request Header Fields Too Large" | "Unavailable For Legal Reasons" | "Internal Server Error" | "Not Implemented" | "Bad Gateway" | "Service Unavailable" | "Gateway Timeout" | "HTTP Version Not Supported" | "Variant Also Negotiates" | "Insufficient Storage" | "Loop Detected" | "Not Extended" | "Network Authentication Required" ? {
|
|
192
|
-
readonly Continue: 100;
|
|
193
|
-
readonly "Switching Protocols": 101;
|
|
194
|
-
readonly Processing: 102;
|
|
195
|
-
readonly "Early Hints": 103;
|
|
196
|
-
readonly OK: 200;
|
|
197
|
-
readonly Created: 201;
|
|
198
|
-
readonly Accepted: 202;
|
|
199
|
-
readonly "Non-Authoritative Information": 203;
|
|
200
|
-
readonly "No Content": 204;
|
|
201
|
-
readonly "Reset Content": 205;
|
|
202
|
-
readonly "Partial Content": 206;
|
|
203
|
-
readonly "Multi-Status": 207;
|
|
204
|
-
readonly "Already Reported": 208;
|
|
205
|
-
readonly "Multiple Choices": 300;
|
|
206
|
-
readonly "Moved Permanently": 301;
|
|
207
|
-
readonly Found: 302;
|
|
208
|
-
readonly "See Other": 303;
|
|
209
|
-
readonly "Not Modified": 304;
|
|
210
|
-
readonly "Temporary Redirect": 307;
|
|
211
|
-
readonly "Permanent Redirect": 308;
|
|
212
|
-
readonly "Bad Request": 400;
|
|
213
|
-
readonly Unauthorized: 401;
|
|
214
|
-
readonly "Payment Required": 402;
|
|
215
|
-
readonly Forbidden: 403;
|
|
216
|
-
readonly "Not Found": 404;
|
|
217
|
-
readonly "Method Not Allowed": 405;
|
|
218
|
-
readonly "Not Acceptable": 406;
|
|
219
|
-
readonly "Proxy Authentication Required": 407;
|
|
220
|
-
readonly "Request Timeout": 408;
|
|
221
|
-
readonly Conflict: 409;
|
|
222
|
-
readonly Gone: 410;
|
|
223
|
-
readonly "Length Required": 411;
|
|
224
|
-
readonly "Precondition Failed": 412;
|
|
225
|
-
readonly "Payload Too Large": 413;
|
|
226
|
-
readonly "URI Too Long": 414;
|
|
227
|
-
readonly "Unsupported Media Type": 415;
|
|
228
|
-
readonly "Range Not Satisfiable": 416;
|
|
229
|
-
readonly "Expectation Failed": 417;
|
|
230
|
-
readonly "I'm a teapot": 418;
|
|
231
|
-
readonly "Enhance Your Calm": 420;
|
|
232
|
-
readonly "Misdirected Request": 421;
|
|
233
|
-
readonly "Unprocessable Content": 422;
|
|
234
|
-
readonly Locked: 423;
|
|
235
|
-
readonly "Failed Dependency": 424;
|
|
236
|
-
readonly "Too Early": 425;
|
|
237
|
-
readonly "Upgrade Required": 426;
|
|
238
|
-
readonly "Precondition Required": 428;
|
|
239
|
-
readonly "Too Many Requests": 429;
|
|
240
|
-
readonly "Request Header Fields Too Large": 431;
|
|
241
|
-
readonly "Unavailable For Legal Reasons": 451;
|
|
242
|
-
readonly "Internal Server Error": 500;
|
|
243
|
-
readonly "Not Implemented": 501;
|
|
244
|
-
readonly "Bad Gateway": 502;
|
|
245
|
-
readonly "Service Unavailable": 503;
|
|
246
|
-
readonly "Gateway Timeout": 504;
|
|
247
|
-
readonly "HTTP Version Not Supported": 505;
|
|
248
|
-
readonly "Variant Also Negotiates": 506;
|
|
249
|
-
readonly "Insufficient Storage": 507;
|
|
250
|
-
readonly "Loop Detected": 508;
|
|
251
|
-
readonly "Not Extended": 510;
|
|
252
|
-
readonly "Network Authentication Required": 511;
|
|
253
|
-
}[Code] : Code>;
|
|
254
|
-
}) => void;
|
|
255
|
-
readonly beforeHandle: ({ set, request, server }: {
|
|
256
|
-
body: unknown;
|
|
257
|
-
query: Record<string, string>;
|
|
258
|
-
params: {};
|
|
259
|
-
headers: Record<string, string | undefined>;
|
|
260
|
-
cookie: Record<string, import("elysia").Cookie<unknown>>;
|
|
261
|
-
server: import("elysia/universal/server").Server | null;
|
|
262
|
-
redirect: import("elysia").redirect;
|
|
263
|
-
set: {
|
|
264
|
-
headers: HTTPHeaders;
|
|
265
|
-
status?: number | keyof StatusMap;
|
|
266
|
-
redirect?: string;
|
|
267
|
-
cookie?: Record<string, import("elysia/cookies").ElysiaCookie>;
|
|
268
|
-
};
|
|
269
|
-
path: string;
|
|
270
|
-
route: string;
|
|
271
|
-
request: Request;
|
|
272
|
-
store: {};
|
|
273
|
-
status: <const Code extends number | keyof StatusMap, const T = Code extends 100 | 101 | 102 | 103 | 200 | 201 | 202 | 203 | 204 | 205 | 206 | 207 | 208 | 400 | 401 | 402 | 403 | 404 | 405 | 406 | 407 | 408 | 409 | 410 | 411 | 412 | 413 | 414 | 415 | 416 | 417 | 418 | 421 | 422 | 423 | 424 | 425 | 426 | 428 | 429 | 431 | 451 | 500 | 501 | 502 | 503 | 504 | 505 | 506 | 507 | 508 | 510 | 511 | 300 | 301 | 302 | 303 | 304 | 307 | 308 | 420 ? {
|
|
274
|
-
readonly 100: "Continue";
|
|
275
|
-
readonly 101: "Switching Protocols";
|
|
276
|
-
readonly 102: "Processing";
|
|
277
|
-
readonly 103: "Early Hints";
|
|
278
|
-
readonly 200: "OK";
|
|
279
|
-
readonly 201: "Created";
|
|
280
|
-
readonly 202: "Accepted";
|
|
281
|
-
readonly 203: "Non-Authoritative Information";
|
|
282
|
-
readonly 204: "No Content";
|
|
283
|
-
readonly 205: "Reset Content";
|
|
284
|
-
readonly 206: "Partial Content";
|
|
285
|
-
readonly 207: "Multi-Status";
|
|
286
|
-
readonly 208: "Already Reported";
|
|
287
|
-
readonly 300: "Multiple Choices";
|
|
288
|
-
readonly 301: "Moved Permanently";
|
|
289
|
-
readonly 302: "Found";
|
|
290
|
-
readonly 303: "See Other";
|
|
291
|
-
readonly 304: "Not Modified";
|
|
292
|
-
readonly 307: "Temporary Redirect";
|
|
293
|
-
readonly 308: "Permanent Redirect";
|
|
294
|
-
readonly 400: "Bad Request";
|
|
295
|
-
readonly 401: "Unauthorized";
|
|
296
|
-
readonly 402: "Payment Required";
|
|
297
|
-
readonly 403: "Forbidden";
|
|
298
|
-
readonly 404: "Not Found";
|
|
299
|
-
readonly 405: "Method Not Allowed";
|
|
300
|
-
readonly 406: "Not Acceptable";
|
|
301
|
-
readonly 407: "Proxy Authentication Required";
|
|
302
|
-
readonly 408: "Request Timeout";
|
|
303
|
-
readonly 409: "Conflict";
|
|
304
|
-
readonly 410: "Gone";
|
|
305
|
-
readonly 411: "Length Required";
|
|
306
|
-
readonly 412: "Precondition Failed";
|
|
307
|
-
readonly 413: "Payload Too Large";
|
|
308
|
-
readonly 414: "URI Too Long";
|
|
309
|
-
readonly 415: "Unsupported Media Type";
|
|
310
|
-
readonly 416: "Range Not Satisfiable";
|
|
311
|
-
readonly 417: "Expectation Failed";
|
|
312
|
-
readonly 418: "I'm a teapot";
|
|
313
|
-
readonly 420: "Enhance Your Calm";
|
|
314
|
-
readonly 421: "Misdirected Request";
|
|
315
|
-
readonly 422: "Unprocessable Content";
|
|
316
|
-
readonly 423: "Locked";
|
|
317
|
-
readonly 424: "Failed Dependency";
|
|
318
|
-
readonly 425: "Too Early";
|
|
319
|
-
readonly 426: "Upgrade Required";
|
|
320
|
-
readonly 428: "Precondition Required";
|
|
321
|
-
readonly 429: "Too Many Requests";
|
|
322
|
-
readonly 431: "Request Header Fields Too Large";
|
|
323
|
-
readonly 451: "Unavailable For Legal Reasons";
|
|
324
|
-
readonly 500: "Internal Server Error";
|
|
325
|
-
readonly 501: "Not Implemented";
|
|
326
|
-
readonly 502: "Bad Gateway";
|
|
327
|
-
readonly 503: "Service Unavailable";
|
|
328
|
-
readonly 504: "Gateway Timeout";
|
|
329
|
-
readonly 505: "HTTP Version Not Supported";
|
|
330
|
-
readonly 506: "Variant Also Negotiates";
|
|
331
|
-
readonly 507: "Insufficient Storage";
|
|
332
|
-
readonly 508: "Loop Detected";
|
|
333
|
-
readonly 510: "Not Extended";
|
|
334
|
-
readonly 511: "Network Authentication Required";
|
|
335
|
-
}[Code] : Code>(code: Code, response?: T) => import("elysia").ElysiaCustomStatusResponse<Code, T, Code extends "Continue" | "Switching Protocols" | "Processing" | "Early Hints" | "OK" | "Created" | "Accepted" | "Non-Authoritative Information" | "No Content" | "Reset Content" | "Partial Content" | "Multi-Status" | "Already Reported" | "Multiple Choices" | "Moved Permanently" | "Found" | "See Other" | "Not Modified" | "Temporary Redirect" | "Permanent Redirect" | "Bad Request" | "Unauthorized" | "Payment Required" | "Forbidden" | "Not Found" | "Method Not Allowed" | "Not Acceptable" | "Proxy Authentication Required" | "Request Timeout" | "Conflict" | "Gone" | "Length Required" | "Precondition Failed" | "Payload Too Large" | "URI Too Long" | "Unsupported Media Type" | "Range Not Satisfiable" | "Expectation Failed" | "I'm a teapot" | "Enhance Your Calm" | "Misdirected Request" | "Unprocessable Content" | "Locked" | "Failed Dependency" | "Too Early" | "Upgrade Required" | "Precondition Required" | "Too Many Requests" | "Request Header Fields Too Large" | "Unavailable For Legal Reasons" | "Internal Server Error" | "Not Implemented" | "Bad Gateway" | "Service Unavailable" | "Gateway Timeout" | "HTTP Version Not Supported" | "Variant Also Negotiates" | "Insufficient Storage" | "Loop Detected" | "Not Extended" | "Network Authentication Required" ? {
|
|
336
|
-
readonly Continue: 100;
|
|
337
|
-
readonly "Switching Protocols": 101;
|
|
338
|
-
readonly Processing: 102;
|
|
339
|
-
readonly "Early Hints": 103;
|
|
340
|
-
readonly OK: 200;
|
|
341
|
-
readonly Created: 201;
|
|
342
|
-
readonly Accepted: 202;
|
|
343
|
-
readonly "Non-Authoritative Information": 203;
|
|
344
|
-
readonly "No Content": 204;
|
|
345
|
-
readonly "Reset Content": 205;
|
|
346
|
-
readonly "Partial Content": 206;
|
|
347
|
-
readonly "Multi-Status": 207;
|
|
348
|
-
readonly "Already Reported": 208;
|
|
349
|
-
readonly "Multiple Choices": 300;
|
|
350
|
-
readonly "Moved Permanently": 301;
|
|
351
|
-
readonly Found: 302;
|
|
352
|
-
readonly "See Other": 303;
|
|
353
|
-
readonly "Not Modified": 304;
|
|
354
|
-
readonly "Temporary Redirect": 307;
|
|
355
|
-
readonly "Permanent Redirect": 308;
|
|
356
|
-
readonly "Bad Request": 400;
|
|
357
|
-
readonly Unauthorized: 401;
|
|
358
|
-
readonly "Payment Required": 402;
|
|
359
|
-
readonly Forbidden: 403;
|
|
360
|
-
readonly "Not Found": 404;
|
|
361
|
-
readonly "Method Not Allowed": 405;
|
|
362
|
-
readonly "Not Acceptable": 406;
|
|
363
|
-
readonly "Proxy Authentication Required": 407;
|
|
364
|
-
readonly "Request Timeout": 408;
|
|
365
|
-
readonly Conflict: 409;
|
|
366
|
-
readonly Gone: 410;
|
|
367
|
-
readonly "Length Required": 411;
|
|
368
|
-
readonly "Precondition Failed": 412;
|
|
369
|
-
readonly "Payload Too Large": 413;
|
|
370
|
-
readonly "URI Too Long": 414;
|
|
371
|
-
readonly "Unsupported Media Type": 415;
|
|
372
|
-
readonly "Range Not Satisfiable": 416;
|
|
373
|
-
readonly "Expectation Failed": 417;
|
|
374
|
-
readonly "I'm a teapot": 418;
|
|
375
|
-
readonly "Enhance Your Calm": 420;
|
|
376
|
-
readonly "Misdirected Request": 421;
|
|
377
|
-
readonly "Unprocessable Content": 422;
|
|
378
|
-
readonly Locked: 423;
|
|
379
|
-
readonly "Failed Dependency": 424;
|
|
380
|
-
readonly "Too Early": 425;
|
|
381
|
-
readonly "Upgrade Required": 426;
|
|
382
|
-
readonly "Precondition Required": 428;
|
|
383
|
-
readonly "Too Many Requests": 429;
|
|
384
|
-
readonly "Request Header Fields Too Large": 431;
|
|
385
|
-
readonly "Unavailable For Legal Reasons": 451;
|
|
386
|
-
readonly "Internal Server Error": 500;
|
|
387
|
-
readonly "Not Implemented": 501;
|
|
388
|
-
readonly "Bad Gateway": 502;
|
|
389
|
-
readonly "Service Unavailable": 503;
|
|
390
|
-
readonly "Gateway Timeout": 504;
|
|
391
|
-
readonly "HTTP Version Not Supported": 505;
|
|
392
|
-
readonly "Variant Also Negotiates": 506;
|
|
393
|
-
readonly "Insufficient Storage": 507;
|
|
394
|
-
readonly "Loop Detected": 508;
|
|
395
|
-
readonly "Not Extended": 510;
|
|
396
|
-
readonly "Network Authentication Required": 511;
|
|
397
|
-
}[Code] : Code>;
|
|
398
|
-
}) => Promise<void>;
|
|
399
|
-
};
|
|
400
|
-
};
|
|
401
|
-
parser: {};
|
|
402
|
-
response: {};
|
|
403
|
-
}, {}, {
|
|
404
|
-
derive: {};
|
|
405
|
-
resolve: {};
|
|
406
|
-
schema: {};
|
|
407
|
-
standaloneSchema: {};
|
|
408
|
-
response: {};
|
|
409
|
-
}, {
|
|
410
|
-
derive: {};
|
|
411
|
-
resolve: {};
|
|
412
|
-
schema: {};
|
|
413
|
-
standaloneSchema: {};
|
|
414
|
-
response: {};
|
|
415
19
|
}>;
|
|
@@ -1,12 +1,6 @@
|
|
|
1
1
|
export { buildAdaptiveWhereClauseSchema } from './build-adaptive-where-clause-schema';
|
|
2
|
-
export { buildCountSchema } from './build-count-schema';
|
|
3
|
-
export { buildDeleteSchema } from './build-delete-schema';
|
|
4
2
|
export { buildFilterSchema } from './build-filters-schema';
|
|
5
|
-
export { buildFindSchema } from './build-find-schema';
|
|
6
3
|
export { buildGlobalSearchSchema } from './build-global-search-schema';
|
|
7
|
-
export { buildInsertSchema } from './build-insert-schema';
|
|
8
4
|
export { buildOrderBySchema } from './build-order-by-schema';
|
|
9
5
|
export { buildSelectedFieldsSchema } from './build-selected-fields';
|
|
10
|
-
export { buildUpdateOneSchema } from './build-update-one-schema';
|
|
11
|
-
export { buildUpdateSchema } from './build-update-schema';
|
|
12
6
|
export { cleanSchema } from './clean-schema';
|
|
@@ -18,15 +18,16 @@ var buildAdaptiveWhereClauseSchema = (schema) => {
|
|
|
18
18
|
$neq: schema,
|
|
19
19
|
$isNull: t.Boolean()
|
|
20
20
|
};
|
|
21
|
-
|
|
21
|
+
const isDateElysiaTypeBox = isDateFromElysiaTypeBox(schema);
|
|
22
|
+
if (KindGuard.IsUnion(schema) && !isDateElysiaTypeBox)
|
|
22
23
|
[schema] = schema.anyOf.filter((s) => !KindGuard.IsNull(s));
|
|
23
|
-
const strNumDate = KindGuard.IsString(schema) || KindGuard.IsNumber(schema) ||
|
|
24
|
+
const strNumDate = KindGuard.IsString(schema) || KindGuard.IsNumber(schema) || isDateElysiaTypeBox || KindGuard.IsDate(schema) ? {
|
|
24
25
|
$in: t.Array(schema, { minItems: 1, uniqueItems: true }),
|
|
25
26
|
$nin: t.Array(schema, { minItems: 1, uniqueItems: true }),
|
|
26
27
|
$like: t.String(),
|
|
27
28
|
$nlike: t.String()
|
|
28
29
|
} : {};
|
|
29
|
-
const numDate = KindGuard.IsNumber(schema) ||
|
|
30
|
+
const numDate = KindGuard.IsNumber(schema) || isDateElysiaTypeBox || KindGuard.IsDate(schema) ? {
|
|
30
31
|
$lt: schema,
|
|
31
32
|
$lte: schema,
|
|
32
33
|
$gt: schema,
|
|
@@ -40,9 +41,6 @@ var buildAdaptiveWhereClauseSchema = (schema) => {
|
|
|
40
41
|
...numDate
|
|
41
42
|
}));
|
|
42
43
|
};
|
|
43
|
-
// source/modules/schema-builder/build-count-schema.ts
|
|
44
|
-
import { t as t4 } from "elysia";
|
|
45
|
-
|
|
46
44
|
// source/modules/schema-builder/build-filters-schema.ts
|
|
47
45
|
import { t as t3 } from "elysia";
|
|
48
46
|
|
|
@@ -80,7 +78,22 @@ var buildFilterSchema = (schema) => {
|
|
|
80
78
|
minProperties: 1
|
|
81
79
|
}));
|
|
82
80
|
};
|
|
83
|
-
|
|
81
|
+
// source/modules/schema-builder/build-order-by-schema.ts
|
|
82
|
+
import { t as t4 } from "elysia/type-system";
|
|
83
|
+
var buildOrderBySchema = (schema) => t4.Object({
|
|
84
|
+
selectedField: t4.KeyOf(schema),
|
|
85
|
+
direction: t4.Union([t4.Literal("asc"), t4.Literal("desc")])
|
|
86
|
+
});
|
|
87
|
+
// source/modules/schema-builder/build-selected-fields.ts
|
|
88
|
+
import { t as t5 } from "elysia/type-system";
|
|
89
|
+
var buildSelectedFieldsSchema = (schema) => t5.Union([
|
|
90
|
+
t5.KeyOf(schema),
|
|
91
|
+
t5.Literal("*"),
|
|
92
|
+
t5.Array(t5.KeyOf(schema), {
|
|
93
|
+
minItems: 1,
|
|
94
|
+
uniqueItems: true
|
|
95
|
+
})
|
|
96
|
+
]);
|
|
84
97
|
// source/modules/schema-builder/clean-schema.ts
|
|
85
98
|
var cleanSchema = (schema) => filterByKeyExclusionRecursive(schema, [
|
|
86
99
|
"minLength",
|
|
@@ -106,127 +119,11 @@ var cleanSchema = (schema) => filterByKeyExclusionRecursive(schema, [
|
|
|
106
119
|
"required",
|
|
107
120
|
"default"
|
|
108
121
|
]);
|
|
109
|
-
|
|
110
|
-
// source/modules/schema-builder/build-count-schema.ts
|
|
111
|
-
var buildCountSchema = (schema) => {
|
|
112
|
-
const sanitizedSchema = cleanSchema(schema);
|
|
113
|
-
const filterSchema = buildFilterSchema(sanitizedSchema);
|
|
114
|
-
return t4.Partial(t4.Object({
|
|
115
|
-
queryOptions: t4.Partial(t4.Object({
|
|
116
|
-
filters: t4.Union([
|
|
117
|
-
filterSchema,
|
|
118
|
-
t4.Array(filterSchema, { minItems: 1, uniqueItems: true })
|
|
119
|
-
])
|
|
120
|
-
}))
|
|
121
|
-
}));
|
|
122
|
-
};
|
|
123
|
-
// source/modules/schema-builder/build-delete-schema.ts
|
|
124
|
-
import { t as t6 } from "elysia";
|
|
125
|
-
|
|
126
|
-
// source/modules/schema-builder/build-selected-fields.ts
|
|
127
|
-
import { t as t5 } from "elysia/type-system";
|
|
128
|
-
var buildSelectedFieldsSchema = (schema) => t5.Union([
|
|
129
|
-
t5.KeyOf(schema),
|
|
130
|
-
t5.Literal("*"),
|
|
131
|
-
t5.Array(t5.KeyOf(schema), {
|
|
132
|
-
minItems: 1,
|
|
133
|
-
uniqueItems: true
|
|
134
|
-
})
|
|
135
|
-
]);
|
|
136
|
-
|
|
137
|
-
// source/modules/schema-builder/build-delete-schema.ts
|
|
138
|
-
var buildDeleteSchema = (schema) => {
|
|
139
|
-
const sanitizedSchema = cleanSchema(schema);
|
|
140
|
-
const filterSchema = buildFilterSchema(sanitizedSchema);
|
|
141
|
-
return t6.Object({
|
|
142
|
-
queryOptions: t6.Object({
|
|
143
|
-
selectedFields: t6.Optional(buildSelectedFieldsSchema(sanitizedSchema)),
|
|
144
|
-
filters: t6.Union([
|
|
145
|
-
filterSchema,
|
|
146
|
-
t6.Array(filterSchema, { minItems: 1 })
|
|
147
|
-
])
|
|
148
|
-
})
|
|
149
|
-
});
|
|
150
|
-
};
|
|
151
|
-
// source/modules/schema-builder/build-find-schema.ts
|
|
152
|
-
import { t as t8 } from "elysia";
|
|
153
|
-
|
|
154
|
-
// source/modules/schema-builder/build-order-by-schema.ts
|
|
155
|
-
import { t as t7 } from "elysia/type-system";
|
|
156
|
-
var buildOrderBySchema = (schema) => t7.Object({
|
|
157
|
-
selectedField: t7.KeyOf(schema),
|
|
158
|
-
direction: t7.Union([t7.Literal("asc"), t7.Literal("desc")])
|
|
159
|
-
});
|
|
160
|
-
|
|
161
|
-
// source/modules/schema-builder/build-find-schema.ts
|
|
162
|
-
var buildFindSchema = (schema) => {
|
|
163
|
-
const sanitizedSchema = cleanSchema(schema);
|
|
164
|
-
const filterSchema = buildFilterSchema(sanitizedSchema);
|
|
165
|
-
return t8.Partial(t8.Object({
|
|
166
|
-
queryOptions: t8.Partial(t8.Object({
|
|
167
|
-
selectedFields: buildSelectedFieldsSchema(sanitizedSchema),
|
|
168
|
-
orderBy: buildOrderBySchema(sanitizedSchema),
|
|
169
|
-
filters: t8.Union([
|
|
170
|
-
filterSchema,
|
|
171
|
-
t8.Array(filterSchema, { minItems: 1, uniqueItems: true })
|
|
172
|
-
]),
|
|
173
|
-
limit: t8.Number({
|
|
174
|
-
default: 100,
|
|
175
|
-
minimum: 1
|
|
176
|
-
}),
|
|
177
|
-
offset: t8.Number({
|
|
178
|
-
default: 0,
|
|
179
|
-
minimum: 0
|
|
180
|
-
})
|
|
181
|
-
}))
|
|
182
|
-
}));
|
|
183
|
-
};
|
|
184
|
-
// source/modules/schema-builder/build-insert-schema.ts
|
|
185
|
-
import { t as t9 } from "elysia";
|
|
186
|
-
var buildInsertSchema = (schema) => t9.Object({
|
|
187
|
-
queryOptions: t9.Optional(t9.Object({
|
|
188
|
-
selectedFields: buildSelectedFieldsSchema(schema)
|
|
189
|
-
})),
|
|
190
|
-
data: t9.Union([
|
|
191
|
-
schema,
|
|
192
|
-
t9.Array(schema, {
|
|
193
|
-
minItems: 1,
|
|
194
|
-
uniqueItems: true
|
|
195
|
-
})
|
|
196
|
-
])
|
|
197
|
-
});
|
|
198
|
-
// source/modules/schema-builder/build-update-one-schema.ts
|
|
199
|
-
import { t as t10 } from "elysia";
|
|
200
|
-
var buildUpdateOneSchema = (schema) => t10.Object({
|
|
201
|
-
data: t10.Partial(schema)
|
|
202
|
-
});
|
|
203
|
-
// source/modules/schema-builder/build-update-schema.ts
|
|
204
|
-
import { t as t11 } from "elysia";
|
|
205
|
-
var buildUpdateSchema = (schema) => {
|
|
206
|
-
const sanitizedSchema = cleanSchema(schema);
|
|
207
|
-
const filterSchema = buildFilterSchema(sanitizedSchema);
|
|
208
|
-
return t11.Object({
|
|
209
|
-
queryOptions: t11.Object({
|
|
210
|
-
selectedFields: t11.Optional(buildSelectedFieldsSchema(sanitizedSchema)),
|
|
211
|
-
filters: t11.Union([
|
|
212
|
-
filterSchema,
|
|
213
|
-
t11.Array(filterSchema, { minItems: 1, uniqueItems: true })
|
|
214
|
-
])
|
|
215
|
-
}),
|
|
216
|
-
data: t11.Partial(schema)
|
|
217
|
-
});
|
|
218
|
-
};
|
|
219
122
|
export {
|
|
220
123
|
cleanSchema,
|
|
221
|
-
buildUpdateSchema,
|
|
222
|
-
buildUpdateOneSchema,
|
|
223
124
|
buildSelectedFieldsSchema,
|
|
224
125
|
buildOrderBySchema,
|
|
225
|
-
buildInsertSchema,
|
|
226
126
|
buildGlobalSearchSchema,
|
|
227
|
-
buildFindSchema,
|
|
228
127
|
buildFilterSchema,
|
|
229
|
-
buildDeleteSchema,
|
|
230
|
-
buildCountSchema,
|
|
231
128
|
buildAdaptiveWhereClauseSchema
|
|
232
129
|
};
|
package/package.json
CHANGED
|
@@ -1,31 +1,31 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mrxsys/mrx-core",
|
|
3
|
-
"version": "2.12.0-1-and-
|
|
3
|
+
"version": "2.12.0-1-and-291-20260102",
|
|
4
4
|
"author": "Ruby",
|
|
5
5
|
"devDependencies": {
|
|
6
6
|
"@eslint/js": "^9.39.2",
|
|
7
|
-
"@sinclair/typebox": "0.34.
|
|
7
|
+
"@sinclair/typebox": "0.34.46",
|
|
8
8
|
"@stylistic/eslint-plugin": "^5.6.1",
|
|
9
|
-
"@types/bun": "^1.3.
|
|
9
|
+
"@types/bun": "^1.3.5",
|
|
10
10
|
"@types/nodemailer": "^7.0.4",
|
|
11
11
|
"elysia": "1.4.19",
|
|
12
12
|
"eslint": "^9.39.2",
|
|
13
|
-
"globals": "^
|
|
13
|
+
"globals": "^17.0.0",
|
|
14
14
|
"ioredis": "^5.8.2",
|
|
15
15
|
"jose": "^6.1.3",
|
|
16
16
|
"knex": "^3.1.0",
|
|
17
17
|
"mssql": "^12.2.0",
|
|
18
|
-
"nodemailer": "^7.0.
|
|
19
|
-
"typescript-eslint": "^8.
|
|
18
|
+
"nodemailer": "^7.0.12",
|
|
19
|
+
"typescript-eslint": "^8.51.0"
|
|
20
20
|
},
|
|
21
21
|
"peerDependencies": {
|
|
22
|
-
"@sinclair/typebox": "0.34.
|
|
22
|
+
"@sinclair/typebox": "0.34.46",
|
|
23
23
|
"elysia": "^1.4.19",
|
|
24
24
|
"ioredis": "^5.8.2",
|
|
25
25
|
"jose": "^6.1.3",
|
|
26
26
|
"mssql": "^12.2.0",
|
|
27
27
|
"knex": "^3.1.0",
|
|
28
|
-
"nodemailer": "^7.0.
|
|
28
|
+
"nodemailer": "^7.0.12",
|
|
29
29
|
"typescript": "^5.9.3"
|
|
30
30
|
},
|
|
31
31
|
"exports": {
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import type { TObject } from '@sinclair/typebox/type';
|
|
2
|
-
import type { CountSchema } from './types/count-schema';
|
|
3
|
-
/**
|
|
4
|
-
* Build a CountSchema
|
|
5
|
-
*
|
|
6
|
-
* @template TSourceSchema - The TypeBox object schema to create count capabilities for
|
|
7
|
-
*
|
|
8
|
-
* @param schema - The source object schema type.
|
|
9
|
-
*
|
|
10
|
-
* @returns A CountSchema based on the provided schema
|
|
11
|
-
*/
|
|
12
|
-
export declare const buildCountSchema: <const TSourceCountSchema extends TObject>(schema: TSourceCountSchema) => CountSchema<TSourceCountSchema>;
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import type { TObject } from '@sinclair/typebox/type';
|
|
2
|
-
import type { DeleteSchema } from './types/delete-schema';
|
|
3
|
-
/**
|
|
4
|
-
* Creates a DeleteSchema.
|
|
5
|
-
*
|
|
6
|
-
* @template TSourceSchema - The TypeBox object schema to create delete capabilities for
|
|
7
|
-
*
|
|
8
|
-
* @param schema - The base object schema to create delete schema for.
|
|
9
|
-
*
|
|
10
|
-
* @returns A TypeBox object schema containing queryOptions with selected fields and filters for delete operations
|
|
11
|
-
*/
|
|
12
|
-
export declare const buildDeleteSchema: <TSourceDeleteSchema extends TObject>(schema: TSourceDeleteSchema) => DeleteSchema<TSourceDeleteSchema>;
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import type { TObject } from '@sinclair/typebox/type';
|
|
2
|
-
import type { FindSchema } from './types/find-schema';
|
|
3
|
-
/**
|
|
4
|
-
* Build a FindSchema.
|
|
5
|
-
*
|
|
6
|
-
* @template TSourceSchema - The source object schema type.
|
|
7
|
-
*
|
|
8
|
-
* @param schema - The base object schema to create search schemas for.
|
|
9
|
-
*
|
|
10
|
-
* @returns A TypeBox object schema for search with selected fields, order by, filters, limit, and offset
|
|
11
|
-
*/
|
|
12
|
-
export declare const buildFindSchema: <TSourceFindSchema extends TObject>(schema: TSourceFindSchema) => FindSchema<TSourceFindSchema>;
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import type { TObject } from '@sinclair/typebox/type';
|
|
2
|
-
import type { UpdateOneSchema } from './types/update-one-schema';
|
|
3
|
-
/**
|
|
4
|
-
* Builds a UpdateOneSchema.
|
|
5
|
-
*
|
|
6
|
-
* @template TSourceUpdateSchema - The source object schema to build the update schema from.
|
|
7
|
-
*
|
|
8
|
-
* @param schema - The source object schema to build the update schema from.
|
|
9
|
-
*
|
|
10
|
-
* @returns A TypeBox object schema for updating a single record.
|
|
11
|
-
*/
|
|
12
|
-
export declare const buildUpdateOneSchema: <TSourceUpdateSchema extends TObject>(schema: TSourceUpdateSchema) => UpdateOneSchema<TSourceUpdateSchema>;
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import type { TObject } from '@sinclair/typebox/type';
|
|
2
|
-
import type { UpdateSchema } from './types/update-schema';
|
|
3
|
-
/**
|
|
4
|
-
* Builds an UpdateSchema.
|
|
5
|
-
*
|
|
6
|
-
* @template TSourceUpdateSchema - The TypeBox object schema to build the update schema from.
|
|
7
|
-
*
|
|
8
|
-
* @param schema - The source object schema to build the update schema from.
|
|
9
|
-
*
|
|
10
|
-
* @returns The update
|
|
11
|
-
*/
|
|
12
|
-
export declare const buildUpdateSchema: <TSourceUpdateSchema extends TObject>(schema: TSourceUpdateSchema) => UpdateSchema<TSourceUpdateSchema>;
|