@mrxsys/mrx-core 2.9.0-1-and-259-20250918 → 2.10.0-and-262-20250924
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/{chunk-d0p9787v.js → chunk-d9skk4k9.js} +17 -40
- package/dist/modules/elysia/cache/cache.d.ts +1 -1
- package/dist/modules/elysia/crud/index.js +1 -1
- package/dist/modules/elysia/crud/operations/index.js +1 -1
- package/dist/modules/elysia/crud/operations/utils/get-db-injection.d.ts +8 -0
- package/dist/shared/types/add-prefix-to-all-key.d.ts +9 -0
- package/dist/shared/types/index.d.ts +1 -0
- package/dist/shared/types/rename-key.d.ts +2 -2
- package/package.json +7 -8
|
@@ -5,6 +5,15 @@ import {
|
|
|
5
5
|
|
|
6
6
|
// source/modules/elysia/crud/operations/count.ts
|
|
7
7
|
import { Elysia } from "elysia";
|
|
8
|
+
|
|
9
|
+
// source/modules/elysia/crud/operations/utils/get-db-injection.ts
|
|
10
|
+
var getDbInjection = (database) => typeof database === "string" ? {
|
|
11
|
+
injectStaticDB: database
|
|
12
|
+
} : {
|
|
13
|
+
injectDynamicDB: database
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
// source/modules/elysia/crud/operations/count.ts
|
|
8
17
|
var count = (database, tableName, {
|
|
9
18
|
hook,
|
|
10
19
|
method = "POST",
|
|
@@ -23,11 +32,7 @@ var count = (database, tableName, {
|
|
|
23
32
|
content: data
|
|
24
33
|
};
|
|
25
34
|
}, {
|
|
26
|
-
...
|
|
27
|
-
injectStaticDB: database
|
|
28
|
-
} : {
|
|
29
|
-
injectDynamicDB: database
|
|
30
|
-
},
|
|
35
|
+
...getDbInjection(database),
|
|
31
36
|
body: `${tableName}Count`,
|
|
32
37
|
response: `${tableName}CountResponse200`,
|
|
33
38
|
...hook
|
|
@@ -55,11 +60,7 @@ var batchDelete = (database, tableName, {
|
|
|
55
60
|
content: data
|
|
56
61
|
};
|
|
57
62
|
}, {
|
|
58
|
-
...
|
|
59
|
-
injectStaticDB: database
|
|
60
|
-
} : {
|
|
61
|
-
injectDynamicDB: database
|
|
62
|
-
},
|
|
63
|
+
...getDbInjection(database),
|
|
63
64
|
body: `${tableName}Delete`,
|
|
64
65
|
response: `${tableName}Response200`,
|
|
65
66
|
...hook
|
|
@@ -92,11 +93,7 @@ var deleteOne = (database, tableName, {
|
|
|
92
93
|
content: data
|
|
93
94
|
};
|
|
94
95
|
}, {
|
|
95
|
-
...
|
|
96
|
-
injectStaticDB: database
|
|
97
|
-
} : {
|
|
98
|
-
injectDynamicDB: database
|
|
99
|
-
},
|
|
96
|
+
...getDbInjection(database),
|
|
100
97
|
params: `${tableName}IdParam`,
|
|
101
98
|
response: `${tableName}Response200`,
|
|
102
99
|
...hook
|
|
@@ -122,11 +119,7 @@ var find = (database, tableName, {
|
|
|
122
119
|
content: data
|
|
123
120
|
};
|
|
124
121
|
}, {
|
|
125
|
-
...
|
|
126
|
-
injectStaticDB: database
|
|
127
|
-
} : {
|
|
128
|
-
injectDynamicDB: database
|
|
129
|
-
},
|
|
122
|
+
...getDbInjection(database),
|
|
130
123
|
body: `${tableName}Find`,
|
|
131
124
|
response: `${tableName}Response200`,
|
|
132
125
|
...hook
|
|
@@ -158,11 +151,7 @@ var findOne = (database, tableName, {
|
|
|
158
151
|
content: data
|
|
159
152
|
};
|
|
160
153
|
}, {
|
|
161
|
-
...
|
|
162
|
-
injectStaticDB: database
|
|
163
|
-
} : {
|
|
164
|
-
injectDynamicDB: database
|
|
165
|
-
},
|
|
154
|
+
...getDbInjection(database),
|
|
166
155
|
params: `${tableName}IdParam`,
|
|
167
156
|
response: `${tableName}Response200`,
|
|
168
157
|
...hook
|
|
@@ -189,11 +178,7 @@ var insert = (database, tableName, {
|
|
|
189
178
|
content: data
|
|
190
179
|
};
|
|
191
180
|
}, {
|
|
192
|
-
...
|
|
193
|
-
injectStaticDB: database
|
|
194
|
-
} : {
|
|
195
|
-
injectDynamicDB: database
|
|
196
|
-
},
|
|
181
|
+
...getDbInjection(database),
|
|
197
182
|
body: `${tableName}Insert`,
|
|
198
183
|
response: `${tableName}Response200`,
|
|
199
184
|
...hook
|
|
@@ -220,11 +205,7 @@ var update = (database, tableName, {
|
|
|
220
205
|
content: data
|
|
221
206
|
};
|
|
222
207
|
}, {
|
|
223
|
-
...
|
|
224
|
-
injectStaticDB: database
|
|
225
|
-
} : {
|
|
226
|
-
injectDynamicDB: database
|
|
227
|
-
},
|
|
208
|
+
...getDbInjection(database),
|
|
228
209
|
body: `${tableName}Update`,
|
|
229
210
|
response: `${tableName}Response200`,
|
|
230
211
|
...hook
|
|
@@ -258,11 +239,7 @@ var updateOne = (database, tableName, {
|
|
|
258
239
|
content: data
|
|
259
240
|
};
|
|
260
241
|
}, {
|
|
261
|
-
...
|
|
262
|
-
injectStaticDB: database
|
|
263
|
-
} : {
|
|
264
|
-
injectDynamicDB: database
|
|
265
|
-
},
|
|
242
|
+
...getDbInjection(database),
|
|
266
243
|
params: `${tableName}IdParam`,
|
|
267
244
|
body: `${tableName}UpdateOne`,
|
|
268
245
|
response: `${tableName}Response200`,
|
|
@@ -23,7 +23,7 @@ export declare const cache: ({ defaultTtl, prefix, store }?: CacheOptions) => El
|
|
|
23
23
|
readonly afterHandle: ({ set, responseValue, store, request }: {
|
|
24
24
|
body: unknown;
|
|
25
25
|
query: Record<string, string>;
|
|
26
|
-
params:
|
|
26
|
+
params: {};
|
|
27
27
|
headers: Record<string, string | undefined>;
|
|
28
28
|
cookie: Record<string, import("elysia").Cookie<unknown>>;
|
|
29
29
|
server: import("elysia/universal/server").Server | null;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { MSSQLDatabaseOptions } from '../../../../../modules/database/types/mssql-database-option';
|
|
2
|
+
export declare const getDbInjection: (database: Omit<MSSQLDatabaseOptions, "databaseName"> | string) => {
|
|
3
|
+
injectStaticDB: string;
|
|
4
|
+
injectDynamicDB?: never;
|
|
5
|
+
} | {
|
|
6
|
+
injectDynamicDB: Omit<MSSQLDatabaseOptions, "databaseName">;
|
|
7
|
+
injectStaticDB?: never;
|
|
8
|
+
};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Adds a specified prefix to all keys in an object type.
|
|
3
|
+
*
|
|
4
|
+
* @template T - The original object type extending object
|
|
5
|
+
* @template Prefix - The prefix to add to each key
|
|
6
|
+
*/
|
|
7
|
+
export type AddPrefixToAllKeys<T extends object, Prefix extends string> = {
|
|
8
|
+
[K in keyof T as K extends string ? `${Prefix}${K}` : never]: T[K];
|
|
9
|
+
};
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Renames a key in an object type while preserving all other properties.
|
|
3
3
|
*
|
|
4
|
-
* @template T - The original object type
|
|
4
|
+
* @template T - The original object type extending object
|
|
5
5
|
* @template From - The key to rename (must exist in T)
|
|
6
6
|
* @template To - The new key name
|
|
7
7
|
*/
|
|
8
|
-
export type RenameKey<T, From extends keyof T, To extends PropertyKey> = {
|
|
8
|
+
export type RenameKey<T extends object, From extends keyof T, To extends PropertyKey> = {
|
|
9
9
|
[K in keyof T as K extends From ? To : K]: T[K];
|
|
10
10
|
};
|
package/package.json
CHANGED
|
@@ -1,23 +1,22 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mrxsys/mrx-core",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.10.0-and-262-20250924",
|
|
4
4
|
"author": "Ruby",
|
|
5
5
|
"devDependencies": {
|
|
6
|
-
"@
|
|
7
|
-
"@eslint/js": "^9.35.0",
|
|
6
|
+
"@eslint/js": "^9.36.0",
|
|
8
7
|
"@sinclair/typebox": "0.34.41",
|
|
9
|
-
"@stylistic/eslint-plugin": "^5.
|
|
8
|
+
"@stylistic/eslint-plugin": "^5.4.0",
|
|
10
9
|
"@types/bun": "^1.2.22",
|
|
11
10
|
"@types/nodemailer": "^7.0.1",
|
|
12
|
-
"elysia": "1.4.
|
|
13
|
-
"eslint": "^9.
|
|
11
|
+
"elysia": "1.4.7",
|
|
12
|
+
"eslint": "^9.36.0",
|
|
14
13
|
"globals": "^16.4.0",
|
|
15
|
-
"ioredis": "^5.
|
|
14
|
+
"ioredis": "^5.8.0",
|
|
16
15
|
"jose": "^6.1.0",
|
|
17
16
|
"knex": "^3.1.0",
|
|
18
17
|
"mssql": "^11.0.1",
|
|
19
18
|
"nodemailer": "^7.0.6",
|
|
20
|
-
"typescript-eslint": "^8.44.
|
|
19
|
+
"typescript-eslint": "^8.44.1"
|
|
21
20
|
},
|
|
22
21
|
"peerDependencies": {
|
|
23
22
|
"@sinclair/typebox": "0.34.41",
|