@mrxsys/mrx-core 2.11.0-2-and-275-20251029 → 2.11.0-2-and-276-20251029
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/errors/utils/is-nowarajs-error.ts.d.ts +2 -2
- package/dist/modules/data/transformers/camel-case.d.ts +2 -2
- package/dist/modules/data/transformers/kebab-case.d.ts +2 -2
- package/dist/modules/data/transformers/pascal-case.d.ts +2 -2
- package/dist/modules/data/transformers/snake-case.d.ts +2 -2
- package/dist/modules/data/types/transform-object-keys.d.ts +4 -4
- package/dist/modules/database/events/mssql-event-map.d.ts +1 -1
- package/dist/modules/database/events/table-event-map.d.ts +1 -1
- package/dist/modules/database/mssql.d.ts +2 -2
- package/dist/modules/database/table.d.ts +2 -2
- package/dist/modules/elysia/cache/cache.d.ts +1 -1
- package/dist/modules/elysia/crud/crud.d.ts +2 -2
- package/dist/modules/elysia/crud/operations/count.d.ts +3 -3
- package/dist/modules/elysia/crud/operations/delete.d.ts +3 -3
- package/dist/modules/elysia/crud/operations/deleteOne.d.ts +3 -3
- package/dist/modules/elysia/crud/operations/find.d.ts +3 -3
- package/dist/modules/elysia/crud/operations/findOne.d.ts +3 -3
- package/dist/modules/elysia/crud/operations/insert.d.ts +3 -3
- package/dist/modules/elysia/crud/operations/update.d.ts +3 -3
- package/dist/modules/elysia/crud/operations/updateOne.d.ts +3 -3
- package/dist/modules/elysia/crud/operations/utils/get-db-injection.d.ts +1 -1
- package/dist/modules/elysia/crud/types/crud-options.d.ts +1 -1
- package/dist/modules/elysia/crud/types/crud-schema-models-type.d.ts +9 -9
- package/dist/modules/elysia/crud/types/delete-schema.d.ts +2 -2
- package/dist/modules/elysia/crud/types/find-schema.d.ts +3 -3
- package/dist/modules/elysia/crud/types/insert-schema.d.ts +1 -1
- package/dist/modules/elysia/crud/types/properties-schema.d.ts +1 -1
- package/dist/modules/elysia/crud/types/response-200-schema.d.ts +1 -1
- package/dist/modules/elysia/crud/types/update-schema.d.ts +2 -2
- package/dist/modules/elysia/crud/utils/create-adaptive-where-clause-schema.d.ts +1 -1
- package/dist/modules/elysia/crud/utils/create-count-response-200-schema.d.ts +1 -1
- package/dist/modules/elysia/crud/utils/create-count-schema.d.ts +1 -1
- package/dist/modules/elysia/crud/utils/create-delete-schema.d.ts +1 -1
- package/dist/modules/elysia/crud/utils/create-filters-schema.d.ts +1 -1
- package/dist/modules/elysia/crud/utils/create-find-schema.d.ts +1 -1
- package/dist/modules/elysia/crud/utils/create-id-param-schema.d.ts +1 -1
- package/dist/modules/elysia/crud/utils/create-insert-schema.d.ts +1 -1
- package/dist/modules/elysia/crud/utils/create-order-schema.d.ts +1 -1
- package/dist/modules/elysia/crud/utils/create-properties-schema.d.ts +1 -1
- package/dist/modules/elysia/crud/utils/create-q-schema.d.ts +1 -1
- package/dist/modules/elysia/crud/utils/create-response-200-schema.d.ts +1 -1
- package/dist/modules/elysia/crud/utils/create-selected-fields-schema.d.ts +1 -1
- package/dist/modules/elysia/crud/utils/create-update-one-schema.d.ts +1 -1
- package/dist/modules/elysia/crud/utils/create-update-schema.d.ts +1 -1
- package/dist/modules/elysia/db-resolver/db-resolver.d.ts +2 -2
- package/dist/modules/elysia/rate-limit/rate-limit.d.ts +1 -1
- package/dist/modules/kv-store/bun-redis/bun-redis-store.d.ts +1 -1
- package/dist/modules/kv-store/ioredis/ioredis-store.d.ts +1 -1
- package/dist/modules/kv-store/memory/memory-store.d.ts +1 -1
- package/dist/modules/logger/events/logger-events.d.ts +1 -1
- package/dist/modules/logger/logger.d.ts +1 -1
- package/dist/modules/logger/sinks/console-logger.d.ts +2 -2
- package/dist/modules/logger/sinks/devnull-logger.d.ts +1 -1
- package/dist/modules/logger/sinks/file-logger/file-logger.d.ts +2 -2
- package/dist/modules/repository/repository.d.ts +2 -2
- package/dist/modules/repository/types/query-options.d.ts +1 -1
- package/dist/shared/utils/flatten.d.ts +1 -1
- package/package.json +4 -4
- package/dist/chunk-0d0zd2yg.js +0 -8
- package/dist/chunk-12qzn7jw.js +0 -7
- package/dist/chunk-441xs5k1.js +0 -53
- package/dist/chunk-4v86f7gp.js +0 -59
- package/dist/chunk-6w9ja96e.js +0 -9
- package/dist/chunk-7t524zqh.js +0 -26
- package/dist/chunk-8tffnbpn.js +0 -7
- package/dist/chunk-9cgzhc50.js +0 -15
- package/dist/chunk-9d3zvgp6.js +0 -9
- package/dist/chunk-9dzsj7f2.js +0 -23
- package/dist/chunk-9r5anep5.js +0 -11
- package/dist/chunk-afd82epa.js +0 -201
- package/dist/chunk-afyz8rg5.js +0 -209
- package/dist/chunk-dre2fgj0.js +0 -7
- package/dist/chunk-e30paw8a.js +0 -101
- package/dist/chunk-eeb7yskp.js +0 -61
- package/dist/chunk-fs3wm3p4.js +0 -32
- package/dist/chunk-grfyngq0.js +0 -39
- package/dist/chunk-gtn1kn0z.js +0 -79
- package/dist/chunk-jksb9ers.js +0 -7
- package/dist/chunk-m3grz32t.js +0 -27
- package/dist/chunk-mvrxngm7.js +0 -41
- package/dist/chunk-n0n14mf8.js +0 -7
- package/dist/chunk-p14h6jfs.js +0 -365
- package/dist/chunk-pjv1ekwr.js +0 -284
- package/dist/chunk-rz5p4j3p.js +0 -13
- package/dist/chunk-spnh9dzk.js +0 -10
- package/dist/chunk-sqts8vyk.js +0 -60
- package/dist/chunk-w7h898m3.js +0 -14
- package/dist/chunk-xhhj1gvj.js +0 -9
- package/dist/chunk-z0ct35ft.js +0 -8
- package/dist/errors/enums/index.js +0 -7
- package/dist/errors/index.js +0 -12
- package/dist/errors/utils/index.js +0 -16
- package/dist/modules/data/enums/index.js +0 -7
- package/dist/modules/data/index.js +0 -17
- package/dist/modules/data/transformers/index.js +0 -32
- package/dist/modules/data/types/index.js +0 -1
- package/dist/modules/database/enums/index.js +0 -9
- package/dist/modules/database/events/index.js +0 -1
- package/dist/modules/database/index.js +0 -16
- package/dist/modules/database/types/index.js +0 -1
- package/dist/modules/elysia/cache/index.js +0 -90
- package/dist/modules/elysia/cache/types/index.js +0 -1
- package/dist/modules/elysia/crud/enums/index.js +0 -7
- package/dist/modules/elysia/crud/index.js +0 -153
- package/dist/modules/elysia/crud/operations/index.js +0 -34
- package/dist/modules/elysia/crud/types/index.js +0 -1
- package/dist/modules/elysia/crud/utils/index.js +0 -41
- package/dist/modules/elysia/db-resolver/enums/index.js +0 -7
- package/dist/modules/elysia/db-resolver/index.js +0 -18
- package/dist/modules/elysia/error/enums/index.js +0 -7
- package/dist/modules/elysia/error/error.d.ts +0 -51
- package/dist/modules/elysia/error/index.js +0 -76
- package/dist/modules/elysia/microservice/enums/index.js +0 -7
- package/dist/modules/elysia/microservice/index.js +0 -100
- package/dist/modules/elysia/rate-limit/enums/index.js +0 -7
- package/dist/modules/elysia/rate-limit/index.js +0 -81
- package/dist/modules/elysia/rate-limit/types/index.js +0 -1
- package/dist/modules/jwt/enums/index.js +0 -11
- package/dist/modules/jwt/index.js +0 -51
- package/dist/modules/jwt/utils/index.js +0 -9
- package/dist/modules/kv-store/bun-redis/index.js +0 -84
- package/dist/modules/kv-store/enums/index.js +0 -7
- package/dist/modules/kv-store/ioredis/index.js +0 -86
- package/dist/modules/kv-store/memory/index.js +0 -9
- package/dist/modules/kv-store/types/index.js +0 -1
- package/dist/modules/logger/enums/index.js +0 -7
- package/dist/modules/logger/events/index.js +0 -1
- package/dist/modules/logger/index.js +0 -208
- package/dist/modules/logger/sinks/index.js +0 -66
- package/dist/modules/logger/types/index.js +0 -1
- package/dist/modules/mailer/enums/index.js +0 -7
- package/dist/modules/mailer/index.js +0 -55
- package/dist/modules/mailer/types/index.js +0 -1
- package/dist/modules/repository/index.js +0 -12
- package/dist/modules/repository/types/index.js +0 -1
- package/dist/modules/singleton-manager/enums/index.js +0 -7
- package/dist/modules/singleton-manager/index.js +0 -9
- package/dist/modules/totp/enums/index.js +0 -7
- package/dist/modules/totp/index.js +0 -104
- package/dist/modules/totp/types/index.js +0 -1
- package/dist/modules/totp/utils/index.js +0 -76
- package/dist/modules/typed-event-emitter/index.js +0 -7
- package/dist/modules/typed-event-emitter/types/index.js +0 -1
- package/dist/shared/enums/index.js +0 -7
- package/dist/shared/types/index.js +0 -1
- package/dist/shared/utils/index.js +0 -30
package/dist/chunk-sqts8vyk.js
DELETED
|
@@ -1,60 +0,0 @@
|
|
|
1
|
-
// @bun
|
|
2
|
-
// source/errors/enums/http-status-codes.ts
|
|
3
|
-
var HTTP_STATUS_CODES = {
|
|
4
|
-
CONTINUE: 100,
|
|
5
|
-
SWITCHING_PROTOCOLS: 101,
|
|
6
|
-
PROCESSING: 102,
|
|
7
|
-
EARLY_HINTS: 103,
|
|
8
|
-
OK: 200,
|
|
9
|
-
CREATED: 201,
|
|
10
|
-
ACCEPTED: 202,
|
|
11
|
-
NON_AUTHORITATIVE_INFORMATION: 203,
|
|
12
|
-
NO_CONTENT: 204,
|
|
13
|
-
RESET_CONTENT: 205,
|
|
14
|
-
PARTIAL_CONTENT: 206,
|
|
15
|
-
MULTI_STATUS: 207,
|
|
16
|
-
ALREADY_REPORTED: 208,
|
|
17
|
-
IM_USED: 226,
|
|
18
|
-
BAD_REQUEST: 400,
|
|
19
|
-
UNAUTHORIZED: 401,
|
|
20
|
-
PAYMENT_REQUIRED: 402,
|
|
21
|
-
FORBIDDEN: 403,
|
|
22
|
-
NOT_FOUND: 404,
|
|
23
|
-
METHOD_NOT_ALLOWED: 405,
|
|
24
|
-
NOT_ACCEPTABLE: 406,
|
|
25
|
-
PROXY_AUTHENTICATION_REQUIRED: 407,
|
|
26
|
-
REQUEST_TIMEOUT: 408,
|
|
27
|
-
CONFLICT: 409,
|
|
28
|
-
GONE: 410,
|
|
29
|
-
LENGTH_REQUIRED: 411,
|
|
30
|
-
PRECONDITION_FAILED: 412,
|
|
31
|
-
PAYLOAD_TOO_LARGE: 413,
|
|
32
|
-
URI_TOO_LONG: 414,
|
|
33
|
-
UNSUPPORTED_MEDIA_TYPE: 415,
|
|
34
|
-
RANGE_NOT_SATISFIABLE: 416,
|
|
35
|
-
EXPECTATION_FAILED: 417,
|
|
36
|
-
IM_A_TEAPOT: 418,
|
|
37
|
-
MISDIRECTED_REQUEST: 421,
|
|
38
|
-
UNPROCESSABLE_ENTITY: 422,
|
|
39
|
-
LOCKED: 423,
|
|
40
|
-
FAILED_DEPENDENCY: 424,
|
|
41
|
-
TOO_EARLY: 425,
|
|
42
|
-
UPGRADE_REQUIRED: 426,
|
|
43
|
-
PRECONDITION_REQUIRED: 428,
|
|
44
|
-
TOO_MANY_REQUESTS: 429,
|
|
45
|
-
REQUEST_HEADER_FIELDS_TOO_LARGE: 431,
|
|
46
|
-
UNAVAILABLE_FOR_LEGAL_REASONS: 451,
|
|
47
|
-
INTERNAL_SERVER_ERROR: 500,
|
|
48
|
-
NOT_IMPLEMENTED: 501,
|
|
49
|
-
BAD_GATEWAY: 502,
|
|
50
|
-
SERVICE_UNAVAILABLE: 503,
|
|
51
|
-
GATEWAY_TIMEOUT: 504,
|
|
52
|
-
HTTP_VERSION_NOT_SUPPORTED: 505,
|
|
53
|
-
VARIANT_ALSO_NEGOTIATES: 506,
|
|
54
|
-
INSUFFICIENT_STORAGE: 507,
|
|
55
|
-
LOOP_DETECTED: 508,
|
|
56
|
-
NOT_EXTENDED: 510,
|
|
57
|
-
NETWORK_AUTHENTICATION_REQUIRED: 511
|
|
58
|
-
};
|
|
59
|
-
|
|
60
|
-
export { HTTP_STATUS_CODES };
|
package/dist/chunk-w7h898m3.js
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
// @bun
|
|
2
|
-
// source/modules/elysia/crud/enums/crud-success-keys.ts
|
|
3
|
-
var CRUD_SUCCESS_KEYS = {
|
|
4
|
-
COUNT_RESPONSE: "mrx-core.crud.success.count_response",
|
|
5
|
-
DELETE_RESPONSE: "mrx-core.crud.success.delete_response",
|
|
6
|
-
DELETE_ONE_RESPONSE: "mrx-core.crud.success.delete_one_response",
|
|
7
|
-
FIND_RESPONSE: "mrx-core.crud.success.find_response",
|
|
8
|
-
FIND_ONE_RESPONSE: "mrx-core.crud.success.find_one_response",
|
|
9
|
-
INSERT_RESPONSE: "mrx-core.crud.success.insert_response",
|
|
10
|
-
UPDATE_RESPONSE: "mrx-core.crud.success.update_response",
|
|
11
|
-
UPDATE_ONE_RESPONSE: "mrx-core.crud.success.update_one_response"
|
|
12
|
-
};
|
|
13
|
-
|
|
14
|
-
export { CRUD_SUCCESS_KEYS };
|
package/dist/chunk-xhhj1gvj.js
DELETED
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
// @bun
|
|
2
|
-
// source/modules/kv-store/enums/kv-store-error-keys.ts
|
|
3
|
-
var KV_STORE_ERROR_KEYS = {
|
|
4
|
-
CLOSING_CONNECTION_FAILED: "mrx-core.kv-store.error.closing_connection_failed",
|
|
5
|
-
CONNECTION_FAILED: "mrx-core.kv-store.error.connection_failed",
|
|
6
|
-
NOT_INTEGER: "mrx-core.kv-store.error.not_integer"
|
|
7
|
-
};
|
|
8
|
-
|
|
9
|
-
export { KV_STORE_ERROR_KEYS };
|
package/dist/chunk-z0ct35ft.js
DELETED
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
// @bun
|
|
2
|
-
// source/modules/singleton-manager/enums/singleton-manager-error-keys.ts
|
|
3
|
-
var SINGLETON_MANAGER_ERROR_KEYS = {
|
|
4
|
-
CLASS_INSTANCE_ALREADY_REGISTERED: "mrx-core.singleton-manager.error.class_instance_already_registered",
|
|
5
|
-
CLASS_INSTANCE_NOT_REGISTERED: "mrx-core.singleton-manager.error.class_instance_not_registered"
|
|
6
|
-
};
|
|
7
|
-
|
|
8
|
-
export { SINGLETON_MANAGER_ERROR_KEYS };
|
package/dist/errors/index.js
DELETED
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
// @bun
|
|
2
|
-
import {
|
|
3
|
-
HttpError
|
|
4
|
-
} from "../../chunk-7t524zqh.js";
|
|
5
|
-
import"../../chunk-sqts8vyk.js";
|
|
6
|
-
import {
|
|
7
|
-
BaseError
|
|
8
|
-
} from "../../chunk-9cgzhc50.js";
|
|
9
|
-
|
|
10
|
-
// source/errors/utils/is-nowarajs-error.ts.ts
|
|
11
|
-
var isBaseError = (e) => e instanceof BaseError;
|
|
12
|
-
var isHttpError = (e) => e instanceof HttpError;
|
|
13
|
-
export {
|
|
14
|
-
isHttpError,
|
|
15
|
-
isBaseError
|
|
16
|
-
};
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
// @bun
|
|
2
|
-
import {
|
|
3
|
-
filterByKeyExclusion,
|
|
4
|
-
filterByKeyExclusionRecursive,
|
|
5
|
-
filterByKeyInclusion,
|
|
6
|
-
filterByValue,
|
|
7
|
-
transformKeys
|
|
8
|
-
} from "../../chunk-gtn1kn0z.js";
|
|
9
|
-
import"../../chunk-jksb9ers.js";
|
|
10
|
-
import"../../chunk-9cgzhc50.js";
|
|
11
|
-
export {
|
|
12
|
-
transformKeys,
|
|
13
|
-
filterByValue,
|
|
14
|
-
filterByKeyInclusion,
|
|
15
|
-
filterByKeyExclusionRecursive,
|
|
16
|
-
filterByKeyExclusion
|
|
17
|
-
};
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
// @bun
|
|
2
|
-
// source/modules/data/transformers/camel-case.ts
|
|
3
|
-
class CamelCaseTransformer {
|
|
4
|
-
convertCase(str) {
|
|
5
|
-
return str.replace(/(?:[-_][a-z])/giu, (group) => group[1].toUpperCase()).replace(/^[A-Z]/u, (firstLetter) => firstLetter.toLowerCase());
|
|
6
|
-
}
|
|
7
|
-
}
|
|
8
|
-
// source/modules/data/transformers/kebab-case.ts
|
|
9
|
-
class KebabCaseTransformer {
|
|
10
|
-
convertCase(str) {
|
|
11
|
-
return str.replace(/_/gu, "-").replace(/(?<=[a-z])(?=[A-Z])/gu, "-").replace(/(?<=[A-Z]+)(?=[A-Z][a-z])/gu, "-").toLowerCase();
|
|
12
|
-
}
|
|
13
|
-
}
|
|
14
|
-
// source/modules/data/transformers/pascal-case.ts
|
|
15
|
-
class PascalCaseTransformer {
|
|
16
|
-
convertCase(str) {
|
|
17
|
-
const camelCaseKey = str.replace(/(?:[-_][a-z])/giu, (group) => group[1].toUpperCase());
|
|
18
|
-
return camelCaseKey.charAt(0).toUpperCase() + camelCaseKey.slice(1);
|
|
19
|
-
}
|
|
20
|
-
}
|
|
21
|
-
// source/modules/data/transformers/snake-case.ts
|
|
22
|
-
class SnakeCaseTransformer {
|
|
23
|
-
convertCase(str) {
|
|
24
|
-
return str.replace(/(?<lower>[a-z])(?<upper>[A-Z])/gu, "$<lower>_$<upper>").replace(/[-\s]/gu, "_").toLowerCase();
|
|
25
|
-
}
|
|
26
|
-
}
|
|
27
|
-
export {
|
|
28
|
-
SnakeCaseTransformer,
|
|
29
|
-
PascalCaseTransformer,
|
|
30
|
-
KebabCaseTransformer,
|
|
31
|
-
CamelCaseTransformer
|
|
32
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
// @bun
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
// @bun
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
// @bun
|
|
2
|
-
import {
|
|
3
|
-
MSSQL,
|
|
4
|
-
Table
|
|
5
|
-
} from "../../chunk-afd82epa.js";
|
|
6
|
-
import"../../chunk-afyz8rg5.js";
|
|
7
|
-
import"../../chunk-grfyngq0.js";
|
|
8
|
-
import"../../chunk-mvrxngm7.js";
|
|
9
|
-
import"../../chunk-4v86f7gp.js";
|
|
10
|
-
import"../../chunk-7t524zqh.js";
|
|
11
|
-
import"../../chunk-sqts8vyk.js";
|
|
12
|
-
import"../../chunk-9cgzhc50.js";
|
|
13
|
-
export {
|
|
14
|
-
Table,
|
|
15
|
-
MSSQL
|
|
16
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
// @bun
|
|
@@ -1,90 +0,0 @@
|
|
|
1
|
-
// @bun
|
|
2
|
-
import {
|
|
3
|
-
MemoryStore
|
|
4
|
-
} from "../../../chunk-e30paw8a.js";
|
|
5
|
-
import"../../../chunk-xhhj1gvj.js";
|
|
6
|
-
import"../../../chunk-9cgzhc50.js";
|
|
7
|
-
|
|
8
|
-
// source/modules/elysia/cache/cache.ts
|
|
9
|
-
import { Elysia } from "elysia";
|
|
10
|
-
|
|
11
|
-
// source/modules/elysia/cache/utils/generate-cache-key.ts
|
|
12
|
-
var _calculateBodyHash = async (body, hasher) => {
|
|
13
|
-
if (!body)
|
|
14
|
-
return;
|
|
15
|
-
const reader = body.getReader();
|
|
16
|
-
try {
|
|
17
|
-
while (true) {
|
|
18
|
-
const { done, value } = await reader.read();
|
|
19
|
-
if (done)
|
|
20
|
-
break;
|
|
21
|
-
if (value)
|
|
22
|
-
hasher.update(new Uint8Array(value));
|
|
23
|
-
}
|
|
24
|
-
} finally {
|
|
25
|
-
reader.releaseLock();
|
|
26
|
-
}
|
|
27
|
-
};
|
|
28
|
-
var generateCacheKey = async (request) => {
|
|
29
|
-
const { method, url, headers } = request;
|
|
30
|
-
const hasher = new Bun.CryptoHasher("sha256");
|
|
31
|
-
hasher.update(method);
|
|
32
|
-
hasher.update(url);
|
|
33
|
-
hasher.update(JSON.stringify(headers));
|
|
34
|
-
await _calculateBodyHash(request.body, hasher);
|
|
35
|
-
return hasher.digest("hex");
|
|
36
|
-
};
|
|
37
|
-
|
|
38
|
-
// source/modules/elysia/cache/cache.ts
|
|
39
|
-
var cache = (store = new MemoryStore) => {
|
|
40
|
-
const cachedRoutes = new Map;
|
|
41
|
-
return new Elysia().onRequest(async ({ request, set }) => {
|
|
42
|
-
const route = `${request.method}:${new URL(request.url).pathname}`;
|
|
43
|
-
if (cachedRoutes.has(route)) {
|
|
44
|
-
const { ttl, prefix } = cachedRoutes.get(route);
|
|
45
|
-
const cacheKey = await generateCacheKey(request.clone());
|
|
46
|
-
const cacheItem = await store.get(`${prefix}${cacheKey}`);
|
|
47
|
-
if (cacheItem && typeof cacheItem === "object" && "response" in cacheItem && "metadata" in cacheItem) {
|
|
48
|
-
const createdAt = new Date(cacheItem.metadata.createdAt);
|
|
49
|
-
const expiresAt = new Date(createdAt.getTime() + ttl * 1000);
|
|
50
|
-
const now = Date.now();
|
|
51
|
-
const remaining = Math.max(0, Math.ceil((expiresAt.getTime() - now) / 1000));
|
|
52
|
-
set.headers["cache-control"] = `max-age=${remaining}, public`;
|
|
53
|
-
set.headers["etag"] = `"${prefix}${cacheKey}"`;
|
|
54
|
-
set.headers["last-modified"] = cacheItem.metadata.createdAt;
|
|
55
|
-
set.headers["expires"] = expiresAt.toUTCString();
|
|
56
|
-
set.headers["x-cache"] = "HIT";
|
|
57
|
-
if (cacheItem.response instanceof Response)
|
|
58
|
-
return cacheItem.response.clone();
|
|
59
|
-
return cacheItem.response;
|
|
60
|
-
}
|
|
61
|
-
set.headers["x-cache"] = "MISS";
|
|
62
|
-
}
|
|
63
|
-
return;
|
|
64
|
-
}).macro({
|
|
65
|
-
isCached: ({ ttl, prefix = "" }) => ({
|
|
66
|
-
async afterHandle({ set, responseValue, request }) {
|
|
67
|
-
const route = `${request.method}:${new URL(request.url).pathname}`;
|
|
68
|
-
if (!cachedRoutes.has(route))
|
|
69
|
-
cachedRoutes.set(route, { ttl, prefix });
|
|
70
|
-
const cacheKey = await generateCacheKey(request.clone());
|
|
71
|
-
const now = new Date;
|
|
72
|
-
set.headers["cache-control"] = `max-age=${ttl}, public`;
|
|
73
|
-
set.headers["etag"] = `"${prefix}${cacheKey}"`;
|
|
74
|
-
set.headers["last-modified"] = now.toUTCString();
|
|
75
|
-
set.headers["expires"] = new Date(now.getTime() + ttl * 1000).toUTCString();
|
|
76
|
-
set.headers["x-cache"] = "MISS";
|
|
77
|
-
const cacheItem = {
|
|
78
|
-
response: responseValue instanceof Response ? responseValue.clone() : responseValue,
|
|
79
|
-
metadata: {
|
|
80
|
-
createdAt: now.toUTCString()
|
|
81
|
-
}
|
|
82
|
-
};
|
|
83
|
-
await store.set(`${prefix}${cacheKey}`, cacheItem, ttl);
|
|
84
|
-
}
|
|
85
|
-
})
|
|
86
|
-
});
|
|
87
|
-
};
|
|
88
|
-
export {
|
|
89
|
-
cache
|
|
90
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
// @bun
|
|
@@ -1,153 +0,0 @@
|
|
|
1
|
-
// @bun
|
|
2
|
-
import {
|
|
3
|
-
createCountResponse200Schema,
|
|
4
|
-
createCountSchema,
|
|
5
|
-
createDeleteSchema,
|
|
6
|
-
createFindSchema,
|
|
7
|
-
createIdParamSchema,
|
|
8
|
-
createInsertSchema,
|
|
9
|
-
createResponse200Schema,
|
|
10
|
-
createUpdateOneSchema,
|
|
11
|
-
createUpdateSchema
|
|
12
|
-
} from "../../../chunk-p14h6jfs.js";
|
|
13
|
-
import"../../../chunk-9dzsj7f2.js";
|
|
14
|
-
import {
|
|
15
|
-
batchDelete,
|
|
16
|
-
count,
|
|
17
|
-
deleteOne,
|
|
18
|
-
find,
|
|
19
|
-
findOne,
|
|
20
|
-
insert,
|
|
21
|
-
update,
|
|
22
|
-
updateOne
|
|
23
|
-
} from "../../../chunk-pjv1ekwr.js";
|
|
24
|
-
import"../../../chunk-441xs5k1.js";
|
|
25
|
-
import"../../../chunk-fs3wm3p4.js";
|
|
26
|
-
import"../../../chunk-z0ct35ft.js";
|
|
27
|
-
import"../../../chunk-8tffnbpn.js";
|
|
28
|
-
import"../../../chunk-w7h898m3.js";
|
|
29
|
-
import"../../../chunk-gtn1kn0z.js";
|
|
30
|
-
import"../../../chunk-jksb9ers.js";
|
|
31
|
-
import"../../../chunk-afd82epa.js";
|
|
32
|
-
import"../../../chunk-afyz8rg5.js";
|
|
33
|
-
import"../../../chunk-grfyngq0.js";
|
|
34
|
-
import"../../../chunk-mvrxngm7.js";
|
|
35
|
-
import"../../../chunk-4v86f7gp.js";
|
|
36
|
-
import"../../../chunk-7t524zqh.js";
|
|
37
|
-
import"../../../chunk-sqts8vyk.js";
|
|
38
|
-
import"../../../chunk-9cgzhc50.js";
|
|
39
|
-
|
|
40
|
-
// source/modules/elysia/crud/crud.ts
|
|
41
|
-
import { Elysia as Elysia2 } from "elysia";
|
|
42
|
-
|
|
43
|
-
// source/modules/elysia/crud/crud-schema.ts
|
|
44
|
-
import { Elysia } from "elysia";
|
|
45
|
-
var crudSchema = ({
|
|
46
|
-
sourceSchemaName,
|
|
47
|
-
sourceSchema,
|
|
48
|
-
sourceInsertSchema = sourceSchema,
|
|
49
|
-
sourceFindSchema = sourceSchema,
|
|
50
|
-
sourceCountSchema = sourceSchema,
|
|
51
|
-
sourceUpdateSchema = sourceSchema,
|
|
52
|
-
sourceDeleteSchema = sourceSchema,
|
|
53
|
-
sourceResponseSchema = sourceSchema,
|
|
54
|
-
operations = {
|
|
55
|
-
count: true,
|
|
56
|
-
find: true,
|
|
57
|
-
findOne: true,
|
|
58
|
-
insert: true,
|
|
59
|
-
update: true,
|
|
60
|
-
updateOne: true,
|
|
61
|
-
delete: true,
|
|
62
|
-
deleteOne: true
|
|
63
|
-
}
|
|
64
|
-
}) => {
|
|
65
|
-
const models = {};
|
|
66
|
-
if (operations.insert)
|
|
67
|
-
models[`${sourceSchemaName}Insert`] = createInsertSchema(sourceInsertSchema);
|
|
68
|
-
if (operations.find)
|
|
69
|
-
models[`${sourceSchemaName}Find`] = createFindSchema(sourceFindSchema);
|
|
70
|
-
if (operations.count)
|
|
71
|
-
models[`${sourceSchemaName}Count`] = createCountSchema(sourceCountSchema);
|
|
72
|
-
if (operations.update)
|
|
73
|
-
models[`${sourceSchemaName}Update`] = createUpdateSchema(sourceUpdateSchema);
|
|
74
|
-
if (operations.updateOne)
|
|
75
|
-
models[`${sourceSchemaName}UpdateOne`] = createUpdateOneSchema(sourceUpdateSchema);
|
|
76
|
-
if (operations.delete)
|
|
77
|
-
models[`${sourceSchemaName}Delete`] = createDeleteSchema(sourceDeleteSchema);
|
|
78
|
-
if (operations.findOne || operations.updateOne || operations.deleteOne)
|
|
79
|
-
models[`${sourceSchemaName}IdParam`] = createIdParamSchema();
|
|
80
|
-
if (operations.find || operations.findOne || operations.insert || operations.update || operations.updateOne || operations.delete || operations.deleteOne)
|
|
81
|
-
models[`${sourceSchemaName}Response200`] = createResponse200Schema(sourceResponseSchema);
|
|
82
|
-
if (operations.count)
|
|
83
|
-
models[`${sourceSchemaName}CountResponse200`] = createCountResponse200Schema();
|
|
84
|
-
const app = new Elysia({
|
|
85
|
-
name: `crudSchemaPlugin-${sourceSchemaName}`
|
|
86
|
-
}).model(models);
|
|
87
|
-
return app;
|
|
88
|
-
};
|
|
89
|
-
|
|
90
|
-
// source/modules/elysia/crud/crud.ts
|
|
91
|
-
var crud = ({
|
|
92
|
-
database,
|
|
93
|
-
tableName,
|
|
94
|
-
schema,
|
|
95
|
-
operations = {
|
|
96
|
-
find: true,
|
|
97
|
-
findOne: true,
|
|
98
|
-
insert: true,
|
|
99
|
-
update: true,
|
|
100
|
-
updateOne: true,
|
|
101
|
-
delete: true,
|
|
102
|
-
deleteOne: true,
|
|
103
|
-
count: true
|
|
104
|
-
},
|
|
105
|
-
tags = [tableName],
|
|
106
|
-
prefix = ""
|
|
107
|
-
}) => {
|
|
108
|
-
const app = new Elysia2({
|
|
109
|
-
name: `crudPlugin[${tableName}]`,
|
|
110
|
-
tags,
|
|
111
|
-
prefix
|
|
112
|
-
}).use(crudSchema({
|
|
113
|
-
sourceSchemaName: tableName,
|
|
114
|
-
sourceSchema: schema.sourceSchema,
|
|
115
|
-
sourceInsertSchema: schema.sourceInsertSchema || schema.sourceSchema,
|
|
116
|
-
sourceFindSchema: schema.sourceFindSchema || schema.sourceSchema,
|
|
117
|
-
sourceCountSchema: schema.sourceCountSchema || schema.sourceSchema,
|
|
118
|
-
sourceUpdateSchema: schema.sourceUpdateSchema || schema.sourceSchema,
|
|
119
|
-
sourceDeleteSchema: schema.sourceDeleteSchema || schema.sourceSchema,
|
|
120
|
-
sourceResponseSchema: schema.sourceResponseSchema || schema.sourceSchema,
|
|
121
|
-
operations: {
|
|
122
|
-
find: operations.find ? true : false,
|
|
123
|
-
findOne: operations.findOne ? true : false,
|
|
124
|
-
insert: operations.insert ? true : false,
|
|
125
|
-
update: operations.update ? true : false,
|
|
126
|
-
updateOne: operations.updateOne ? true : false,
|
|
127
|
-
delete: operations.delete ? true : false,
|
|
128
|
-
deleteOne: operations.deleteOne ? true : false,
|
|
129
|
-
count: operations.count ? true : false
|
|
130
|
-
}
|
|
131
|
-
}));
|
|
132
|
-
if (operations.insert)
|
|
133
|
-
app.use(insert(database, tableName, operations.insert && typeof operations.insert === "object" ? operations.insert : {}));
|
|
134
|
-
if (operations.find)
|
|
135
|
-
app.use(find(database, tableName, operations.find && typeof operations.find === "object" ? operations.find : {}));
|
|
136
|
-
if (operations.findOne)
|
|
137
|
-
app.use(findOne(database, tableName, operations.findOne && typeof operations.findOne === "object" ? operations.findOne : {}));
|
|
138
|
-
if (operations.update)
|
|
139
|
-
app.use(update(database, tableName, operations.update && typeof operations.update === "object" ? operations.update : {}));
|
|
140
|
-
if (operations.updateOne)
|
|
141
|
-
app.use(updateOne(database, tableName, operations.updateOne && typeof operations.updateOne === "object" ? operations.updateOne : {}));
|
|
142
|
-
if (operations.delete)
|
|
143
|
-
app.use(batchDelete(database, tableName, operations.delete && typeof operations.delete === "object" ? operations.delete : {}));
|
|
144
|
-
if (operations.deleteOne)
|
|
145
|
-
app.use(deleteOne(database, tableName, operations.deleteOne && typeof operations.deleteOne === "object" ? operations.deleteOne : {}));
|
|
146
|
-
if (operations.count)
|
|
147
|
-
app.use(count(database, tableName, operations.count && typeof operations.count === "object" ? operations.count : {}));
|
|
148
|
-
return app;
|
|
149
|
-
};
|
|
150
|
-
export {
|
|
151
|
-
crudSchema,
|
|
152
|
-
crud
|
|
153
|
-
};
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
// @bun
|
|
2
|
-
import {
|
|
3
|
-
batchDelete,
|
|
4
|
-
count,
|
|
5
|
-
deleteOne,
|
|
6
|
-
find,
|
|
7
|
-
findOne,
|
|
8
|
-
insert,
|
|
9
|
-
update,
|
|
10
|
-
updateOne
|
|
11
|
-
} from "../../../../chunk-pjv1ekwr.js";
|
|
12
|
-
import"../../../../chunk-441xs5k1.js";
|
|
13
|
-
import"../../../../chunk-fs3wm3p4.js";
|
|
14
|
-
import"../../../../chunk-z0ct35ft.js";
|
|
15
|
-
import"../../../../chunk-8tffnbpn.js";
|
|
16
|
-
import"../../../../chunk-w7h898m3.js";
|
|
17
|
-
import"../../../../chunk-afd82epa.js";
|
|
18
|
-
import"../../../../chunk-afyz8rg5.js";
|
|
19
|
-
import"../../../../chunk-grfyngq0.js";
|
|
20
|
-
import"../../../../chunk-mvrxngm7.js";
|
|
21
|
-
import"../../../../chunk-4v86f7gp.js";
|
|
22
|
-
import"../../../../chunk-7t524zqh.js";
|
|
23
|
-
import"../../../../chunk-sqts8vyk.js";
|
|
24
|
-
import"../../../../chunk-9cgzhc50.js";
|
|
25
|
-
export {
|
|
26
|
-
updateOne,
|
|
27
|
-
update,
|
|
28
|
-
insert,
|
|
29
|
-
findOne,
|
|
30
|
-
find,
|
|
31
|
-
deleteOne,
|
|
32
|
-
count,
|
|
33
|
-
batchDelete
|
|
34
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
// @bun
|
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
// @bun
|
|
2
|
-
import {
|
|
3
|
-
createAdaptiveWhereClauseSchema,
|
|
4
|
-
createCountResponse200Schema,
|
|
5
|
-
createCountSchema,
|
|
6
|
-
createDeleteSchema,
|
|
7
|
-
createFiltersSchema,
|
|
8
|
-
createFindSchema,
|
|
9
|
-
createIdParamSchema,
|
|
10
|
-
createInsertSchema,
|
|
11
|
-
createOrderSchema,
|
|
12
|
-
createPropertiesSchema,
|
|
13
|
-
createQSchema,
|
|
14
|
-
createResponse200Schema,
|
|
15
|
-
createSelectedFieldsSchema,
|
|
16
|
-
createUpdateOneSchema,
|
|
17
|
-
createUpdateSchema,
|
|
18
|
-
isDateFromElysiaTypeBox
|
|
19
|
-
} from "../../../../chunk-p14h6jfs.js";
|
|
20
|
-
import"../../../../chunk-9dzsj7f2.js";
|
|
21
|
-
import"../../../../chunk-gtn1kn0z.js";
|
|
22
|
-
import"../../../../chunk-jksb9ers.js";
|
|
23
|
-
import"../../../../chunk-9cgzhc50.js";
|
|
24
|
-
export {
|
|
25
|
-
isDateFromElysiaTypeBox,
|
|
26
|
-
createUpdateSchema,
|
|
27
|
-
createUpdateOneSchema,
|
|
28
|
-
createSelectedFieldsSchema,
|
|
29
|
-
createResponse200Schema,
|
|
30
|
-
createQSchema,
|
|
31
|
-
createPropertiesSchema,
|
|
32
|
-
createOrderSchema,
|
|
33
|
-
createInsertSchema,
|
|
34
|
-
createIdParamSchema,
|
|
35
|
-
createFindSchema,
|
|
36
|
-
createFiltersSchema,
|
|
37
|
-
createDeleteSchema,
|
|
38
|
-
createCountSchema,
|
|
39
|
-
createCountResponse200Schema,
|
|
40
|
-
createAdaptiveWhereClauseSchema
|
|
41
|
-
};
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
// @bun
|
|
2
|
-
import {
|
|
3
|
-
dbResolver
|
|
4
|
-
} from "../../../chunk-441xs5k1.js";
|
|
5
|
-
import"../../../chunk-fs3wm3p4.js";
|
|
6
|
-
import"../../../chunk-z0ct35ft.js";
|
|
7
|
-
import"../../../chunk-8tffnbpn.js";
|
|
8
|
-
import"../../../chunk-afd82epa.js";
|
|
9
|
-
import"../../../chunk-afyz8rg5.js";
|
|
10
|
-
import"../../../chunk-grfyngq0.js";
|
|
11
|
-
import"../../../chunk-mvrxngm7.js";
|
|
12
|
-
import"../../../chunk-4v86f7gp.js";
|
|
13
|
-
import"../../../chunk-7t524zqh.js";
|
|
14
|
-
import"../../../chunk-sqts8vyk.js";
|
|
15
|
-
import"../../../chunk-9cgzhc50.js";
|
|
16
|
-
export {
|
|
17
|
-
dbResolver
|
|
18
|
-
};
|
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
import { Elysia } from 'elysia';
|
|
2
|
-
import { BaseError } from '../../../errors/base-error';
|
|
3
|
-
import { HttpError } from '../../../errors/http-error';
|
|
4
|
-
/**
|
|
5
|
-
* The `errorPlugin` provides an error handling system for Elysia applications.
|
|
6
|
-
*/
|
|
7
|
-
export declare const error: Elysia<"", {
|
|
8
|
-
decorator: {};
|
|
9
|
-
store: {};
|
|
10
|
-
derive: {};
|
|
11
|
-
resolve: {};
|
|
12
|
-
}, {
|
|
13
|
-
typebox: {};
|
|
14
|
-
error: {
|
|
15
|
-
readonly BaseError: BaseError<any>;
|
|
16
|
-
readonly HttpError: HttpError<any>;
|
|
17
|
-
};
|
|
18
|
-
}, {
|
|
19
|
-
schema: {};
|
|
20
|
-
standaloneSchema: {};
|
|
21
|
-
macro: {};
|
|
22
|
-
macroFn: {};
|
|
23
|
-
parser: {};
|
|
24
|
-
response: {
|
|
25
|
-
200: {
|
|
26
|
-
message: string;
|
|
27
|
-
content: any;
|
|
28
|
-
} | {
|
|
29
|
-
message: "mrx-core.error.not_found";
|
|
30
|
-
content?: never;
|
|
31
|
-
} | {
|
|
32
|
-
message: "mrx-core.error.parse";
|
|
33
|
-
content?: never;
|
|
34
|
-
} | {
|
|
35
|
-
message: "mrx-core.error.internal_server_error";
|
|
36
|
-
content?: never;
|
|
37
|
-
};
|
|
38
|
-
};
|
|
39
|
-
}, {}, {
|
|
40
|
-
derive: {};
|
|
41
|
-
resolve: {};
|
|
42
|
-
schema: {};
|
|
43
|
-
standaloneSchema: {};
|
|
44
|
-
response: {};
|
|
45
|
-
}, {
|
|
46
|
-
derive: {};
|
|
47
|
-
resolve: {};
|
|
48
|
-
schema: {};
|
|
49
|
-
standaloneSchema: {};
|
|
50
|
-
response: {};
|
|
51
|
-
}>;
|