@mrxsys/mrx-core 2.11.1-1-and-275-20251023 → 2.12.0-1-and-288-20251203
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-0d0zd2yg.js → chunk-037vwvd4.js} +2 -2
- package/dist/{chunk-jksb9ers.js → chunk-10w8mg8e.js} +1 -1
- package/dist/{chunk-dre2fgj0.js → chunk-2z8amjqt.js} +1 -1
- package/dist/chunk-4t7sy5qt.js +10 -0
- package/dist/chunk-642xajvx.js +59 -0
- package/dist/chunk-6hs00zfd.js +13 -0
- package/dist/chunk-8pw0syzf.js +9 -0
- package/dist/{chunk-eeb7yskp.js → chunk-awphtyzp.js} +4 -4
- package/dist/{chunk-8tffnbpn.js → chunk-ayyrgqyv.js} +1 -1
- package/dist/{chunk-12qzn7jw.js → chunk-dmsev7vs.js} +1 -1
- package/dist/{chunk-gtn1kn0z.js → chunk-hv6g22kf.js} +4 -4
- package/dist/chunk-hwfebx4x.js +11 -0
- package/dist/chunk-j7dyc5ks.js +101 -0
- package/dist/chunk-jz3wd472.js +23 -0
- package/dist/{chunk-afd82epa.js → chunk-kne89z1w.js} +13 -13
- package/dist/{chunk-fs3wm3p4.js → chunk-r7yr9p57.js} +6 -6
- package/dist/{chunk-afyz8rg5.js → chunk-s53cbgkb.js} +28 -18
- package/dist/chunk-txazb0xn.js +27 -0
- package/dist/chunk-y5dtkmnp.js +8 -0
- package/dist/chunk-yrt0ffvf.js +9 -0
- package/dist/chunk-zn2nm5gg.js +9 -0
- package/dist/{chunk-7t524zqh.js → chunk-zv4ta4fb.js} +3 -3
- package/dist/errors/{base-error.d.ts → app-error.d.ts} +2 -1
- package/dist/errors/http-error.d.ts +2 -2
- package/dist/errors/index.d.ts +2 -1
- package/dist/errors/index.js +6 -4
- package/dist/errors/internal-error.d.ts +4 -0
- package/dist/modules/data/data.d.ts +5 -5
- package/dist/modules/data/enums/data-error-keys.d.ts +1 -1
- package/dist/modules/data/enums/index.js +1 -1
- package/dist/modules/data/index.js +3 -3
- package/dist/modules/database/enums/database-error-keys.d.ts +26 -26
- package/dist/modules/database/enums/index.js +1 -1
- package/dist/modules/database/enums/mssql-error-code.d.ts +23 -23
- package/dist/modules/database/index.js +5 -5
- package/dist/modules/database/mssql.d.ts +9 -9
- package/dist/modules/elysia/cache/cache.d.ts +1 -1
- package/dist/modules/elysia/cache/index.js +3 -3
- package/dist/modules/elysia/db-resolver/enums/db-resolver-error-keys.d.ts +1 -1
- package/dist/modules/elysia/db-resolver/enums/index.js +1 -1
- package/dist/modules/elysia/db-resolver/index.js +53 -10
- package/dist/modules/elysia/error/enums/error.keys.d.ts +4 -4
- package/dist/modules/elysia/error/enums/index.js +1 -1
- package/dist/modules/elysia/error/error.d.ts +5 -5
- package/dist/modules/elysia/error/index.js +14 -14
- package/dist/modules/elysia/microservice/enums/index.js +1 -1
- package/dist/modules/elysia/microservice/enums/microservice-success-keys.d.ts +2 -2
- package/dist/modules/elysia/microservice/index.js +1 -1
- package/dist/modules/elysia/rate-limit/enums/index.js +1 -1
- package/dist/modules/elysia/rate-limit/enums/rate-limit-error-keys.d.ts +1 -1
- package/dist/modules/elysia/rate-limit/index.js +7 -6
- package/dist/modules/elysia/rate-limit/rate-limit.d.ts +1 -1
- package/dist/modules/jwt/enums/index.js +2 -2
- package/dist/modules/jwt/enums/jwt-error-keys.d.ts +3 -3
- package/dist/modules/jwt/enums/parse-human-time-to-seconds-error-keys.d.ts +1 -1
- package/dist/modules/jwt/index.js +10 -12
- package/dist/modules/jwt/utils/index.js +3 -3
- package/dist/modules/jwt/utils/parse-human-time-to-seconds.d.ts +1 -1
- package/dist/modules/kv-store/bun-redis/index.js +25 -17
- package/dist/modules/kv-store/enums/index.js +1 -1
- package/dist/modules/kv-store/enums/kv-store-error-keys.d.ts +3 -3
- package/dist/modules/kv-store/ioredis/index.js +17 -17
- package/dist/modules/kv-store/memory/index.js +4 -98
- package/dist/modules/logger/enums/index.js +1 -1
- package/dist/modules/logger/enums/logger-error-keys.d.ts +7 -7
- package/dist/modules/logger/events/logger-events.d.ts +4 -4
- package/dist/modules/logger/index.js +91 -20
- package/dist/modules/logger/logger.d.ts +2 -2
- package/dist/modules/logger/sinks/console-logger.d.ts +1 -1
- package/dist/modules/logger/sinks/file-logger/enums/file-logger-error-keys.d.ts +1 -1
- package/dist/modules/logger/sinks/file-logger/file-logger.d.ts +3 -3
- package/dist/modules/logger/sinks/index.js +10 -11
- package/dist/modules/logger/types/logger-options.d.ts +1 -1
- package/dist/modules/logger/types/logger-sink.d.ts +1 -1
- package/dist/modules/logger/worker-logger.d.ts +1 -0
- package/dist/modules/mailer/enums/index.js +1 -1
- package/dist/modules/mailer/enums/mailer-error-keys.d.ts +3 -3
- package/dist/modules/mailer/index.js +6 -6
- package/dist/modules/mailer/smtp.d.ts +4 -4
- package/dist/modules/repository/index.js +4 -4
- package/dist/modules/repository/repository.d.ts +28 -12
- package/dist/modules/repository/types/filter.d.ts +2 -5
- package/dist/modules/repository/types/global-search.d.ts +12 -0
- package/dist/modules/repository/types/index.d.ts +2 -1
- package/dist/modules/repository/types/{order-by-item.d.ts → order-by.d.ts} +3 -3
- package/dist/modules/repository/types/query-options.d.ts +4 -5
- package/dist/modules/schema-builder/build-adaptive-where-clause-schema.d.ts +17 -0
- package/dist/modules/schema-builder/build-count-schema.d.ts +12 -0
- package/dist/modules/{elysia/crud/utils/create-delete-schema.d.ts → schema-builder/build-delete-schema.d.ts} +3 -3
- package/dist/modules/schema-builder/build-filters-schema.d.ts +12 -0
- package/dist/modules/schema-builder/build-find-schema.d.ts +12 -0
- package/dist/modules/schema-builder/build-global-search-schema.d.ts +12 -0
- package/dist/modules/schema-builder/build-insert-schema.d.ts +3 -0
- package/dist/modules/schema-builder/build-order-by-schema.d.ts +12 -0
- package/dist/modules/schema-builder/build-selected-fields.d.ts +12 -0
- package/dist/modules/schema-builder/build-update-one-schema.d.ts +12 -0
- package/dist/modules/schema-builder/build-update-schema.d.ts +12 -0
- package/dist/modules/schema-builder/clean-schema.d.ts +2 -0
- package/dist/modules/schema-builder/index.d.ts +12 -0
- package/dist/modules/schema-builder/index.js +230 -0
- package/dist/modules/{elysia/crud → schema-builder}/types/count-schema.d.ts +3 -3
- package/dist/modules/schema-builder/types/delete-schema.d.ts +12 -0
- package/dist/modules/schema-builder/types/filter-schema.d.ts +12 -0
- package/dist/modules/schema-builder/types/find-schema.d.ts +16 -0
- package/dist/modules/{elysia/crud/types/q-schema.d.ts → schema-builder/types/global-search-schema.d.ts} +1 -1
- package/dist/modules/schema-builder/types/index.d.ts +12 -0
- package/dist/modules/{elysia/crud → schema-builder}/types/insert-schema.d.ts +1 -1
- package/dist/modules/schema-builder/types/order-by-schema.d.ts +5 -0
- package/dist/modules/{elysia/crud → schema-builder}/types/update-schema.d.ts +4 -4
- package/dist/{shared → modules/schema-builder}/utils/flatten.d.ts +1 -1
- package/dist/modules/schema-builder/utils/index.d.ts +2 -0
- package/dist/modules/schema-builder/utils/index.js +9 -0
- package/dist/modules/singleton-manager/enums/index.js +1 -1
- package/dist/modules/singleton-manager/enums/singleton-manager-error-keys.d.ts +2 -2
- package/dist/modules/singleton-manager/index.js +3 -3
- package/dist/modules/singleton-manager/singleton-manager.d.ts +3 -3
- package/dist/modules/totp/enums/index.js +1 -1
- package/dist/modules/totp/enums/totp-error-keys.d.ts +5 -5
- package/dist/modules/totp/index.js +6 -6
- package/dist/modules/totp/otp-auth-uri.d.ts +1 -1
- package/dist/modules/totp/utils/base32.d.ts +1 -1
- package/dist/modules/totp/utils/generate-secret-bytes.d.ts +1 -1
- package/dist/modules/totp/utils/index.js +5 -5
- package/dist/shared/types/index.d.ts +0 -1
- package/dist/shared/utils/env.d.ts +1 -1
- package/dist/shared/utils/index.d.ts +0 -1
- package/dist/shared/utils/index.js +4 -8
- package/package.json +19 -22
- package/dist/chunk-441xs5k1.js +0 -53
- package/dist/chunk-4v86f7gp.js +0 -59
- package/dist/chunk-6w9ja96e.js +0 -9
- 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-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-w7h898m3.js +0 -14
- package/dist/chunk-xhhj1gvj.js +0 -9
- package/dist/chunk-z0ct35ft.js +0 -8
- package/dist/errors/utils/index.d.ts +0 -1
- package/dist/errors/utils/index.js +0 -16
- package/dist/errors/utils/is-nowarajs-error.ts.d.ts +0 -4
- package/dist/modules/elysia/crud/crud-schema.d.ts +0 -18
- package/dist/modules/elysia/crud/crud.d.ts +0 -38
- package/dist/modules/elysia/crud/enums/crud-success-keys.d.ts +0 -10
- package/dist/modules/elysia/crud/enums/index.d.ts +0 -1
- package/dist/modules/elysia/crud/enums/index.js +0 -7
- package/dist/modules/elysia/crud/index.d.ts +0 -2
- package/dist/modules/elysia/crud/index.js +0 -153
- package/dist/modules/elysia/crud/operations/count.d.ts +0 -258
- package/dist/modules/elysia/crud/operations/delete.d.ts +0 -258
- package/dist/modules/elysia/crud/operations/deleteOne.d.ts +0 -258
- package/dist/modules/elysia/crud/operations/find.d.ts +0 -258
- package/dist/modules/elysia/crud/operations/findOne.d.ts +0 -258
- package/dist/modules/elysia/crud/operations/index.d.ts +0 -8
- package/dist/modules/elysia/crud/operations/index.js +0 -34
- package/dist/modules/elysia/crud/operations/insert.d.ts +0 -258
- package/dist/modules/elysia/crud/operations/update.d.ts +0 -268
- package/dist/modules/elysia/crud/operations/updateOne.d.ts +0 -268
- package/dist/modules/elysia/crud/operations/utils/get-db-injection.d.ts +0 -8
- package/dist/modules/elysia/crud/types/count-response-200-schema.d.ts +0 -5
- package/dist/modules/elysia/crud/types/crud-operation-base.d.ts +0 -4
- package/dist/modules/elysia/crud/types/crud-operation-count.d.ts +0 -14
- package/dist/modules/elysia/crud/types/crud-operation-delete-one.d.ts +0 -14
- package/dist/modules/elysia/crud/types/crud-operation-delete.d.ts +0 -14
- package/dist/modules/elysia/crud/types/crud-operation-find-one.d.ts +0 -14
- package/dist/modules/elysia/crud/types/crud-operation-find.d.ts +0 -14
- package/dist/modules/elysia/crud/types/crud-operation-insert.d.ts +0 -14
- package/dist/modules/elysia/crud/types/crud-operation-update-one.d.ts +0 -16
- package/dist/modules/elysia/crud/types/crud-operation-update.d.ts +0 -14
- package/dist/modules/elysia/crud/types/crud-operations.d.ts +0 -19
- package/dist/modules/elysia/crud/types/crud-options.d.ts +0 -44
- package/dist/modules/elysia/crud/types/crud-schema-models-type.d.ts +0 -12
- package/dist/modules/elysia/crud/types/crud-schema-operations.d.ts +0 -10
- package/dist/modules/elysia/crud/types/crud-schema-options.d.ts +0 -13
- package/dist/modules/elysia/crud/types/delete-schema.d.ts +0 -12
- package/dist/modules/elysia/crud/types/filter-schema.d.ts +0 -9
- package/dist/modules/elysia/crud/types/find-schema.d.ts +0 -16
- package/dist/modules/elysia/crud/types/id-param-schema.d.ts +0 -4
- package/dist/modules/elysia/crud/types/index.d.ts +0 -29
- package/dist/modules/elysia/crud/types/order-schema.d.ts +0 -11
- package/dist/modules/elysia/crud/types/properties-schema.d.ts +0 -9
- package/dist/modules/elysia/crud/types/response-200-schema.d.ts +0 -11
- package/dist/modules/elysia/crud/utils/create-adaptive-where-clause-schema.d.ts +0 -17
- package/dist/modules/elysia/crud/utils/create-count-response-200-schema.d.ts +0 -8
- package/dist/modules/elysia/crud/utils/create-count-schema.d.ts +0 -12
- package/dist/modules/elysia/crud/utils/create-filters-schema.d.ts +0 -14
- package/dist/modules/elysia/crud/utils/create-find-schema.d.ts +0 -12
- package/dist/modules/elysia/crud/utils/create-id-param-schema.d.ts +0 -2
- package/dist/modules/elysia/crud/utils/create-insert-schema.d.ts +0 -8
- package/dist/modules/elysia/crud/utils/create-order-schema.d.ts +0 -12
- package/dist/modules/elysia/crud/utils/create-properties-schema.d.ts +0 -12
- package/dist/modules/elysia/crud/utils/create-q-schema.d.ts +0 -12
- package/dist/modules/elysia/crud/utils/create-response-200-schema.d.ts +0 -3
- package/dist/modules/elysia/crud/utils/create-selected-fields-schema.d.ts +0 -12
- package/dist/modules/elysia/crud/utils/create-update-one-schema.d.ts +0 -3
- package/dist/modules/elysia/crud/utils/create-update-schema.d.ts +0 -3
- package/dist/modules/elysia/crud/utils/index.d.ts +0 -16
- package/dist/modules/elysia/crud/utils/index.js +0 -41
- /package/dist/modules/{elysia/crud → schema-builder}/types/adaptive-where-clause-schema.d.ts +0 -0
- /package/dist/modules/{elysia/crud → schema-builder}/types/index.js +0 -0
- /package/dist/modules/{elysia/crud/types/selected-field-schema.d.ts → schema-builder/types/selected-fields-schema.d.ts} +0 -0
- /package/dist/{shared → modules/schema-builder}/types/tflatten.d.ts +0 -0
- /package/dist/modules/{elysia/crud → schema-builder}/types/update-one-schema.d.ts +0 -0
- /package/dist/modules/{elysia/crud → schema-builder}/utils/is-date-from-elysia-typebox.d.ts +0 -0
|
@@ -0,0 +1,230 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import {
|
|
3
|
+
flatten,
|
|
4
|
+
isDateFromElysiaTypeBox
|
|
5
|
+
} from "../../chunk-txazb0xn.js";
|
|
6
|
+
import {
|
|
7
|
+
filterByKeyExclusionRecursive
|
|
8
|
+
} from "../../chunk-hv6g22kf.js";
|
|
9
|
+
import"../../chunk-10w8mg8e.js";
|
|
10
|
+
import"../../chunk-jz3wd472.js";
|
|
11
|
+
|
|
12
|
+
// source/modules/schema-builder/build-adaptive-where-clause-schema.ts
|
|
13
|
+
import { KindGuard } from "@sinclair/typebox/type";
|
|
14
|
+
import { t } from "elysia";
|
|
15
|
+
var buildAdaptiveWhereClauseSchema = (schema) => {
|
|
16
|
+
const common = {
|
|
17
|
+
$eq: schema,
|
|
18
|
+
$neq: schema,
|
|
19
|
+
$isNull: t.Boolean()
|
|
20
|
+
};
|
|
21
|
+
const strNumDate = KindGuard.IsString(schema) || KindGuard.IsNumber(schema) || isDateFromElysiaTypeBox(schema) ? {
|
|
22
|
+
$in: t.Array(schema, { minItems: 1, uniqueItems: true }),
|
|
23
|
+
$nin: t.Array(schema, { minItems: 1, uniqueItems: true }),
|
|
24
|
+
$like: t.String(),
|
|
25
|
+
$nlike: t.String()
|
|
26
|
+
} : {};
|
|
27
|
+
const numDate = KindGuard.IsNumber(schema) || isDateFromElysiaTypeBox(schema) ? {
|
|
28
|
+
$lt: schema,
|
|
29
|
+
$lte: schema,
|
|
30
|
+
$gt: schema,
|
|
31
|
+
$gte: schema,
|
|
32
|
+
$between: t.Tuple([schema, schema]),
|
|
33
|
+
$nbetween: t.Tuple([schema, schema])
|
|
34
|
+
} : {};
|
|
35
|
+
return t.Partial(t.Object({
|
|
36
|
+
...common,
|
|
37
|
+
...strNumDate,
|
|
38
|
+
...numDate
|
|
39
|
+
}));
|
|
40
|
+
};
|
|
41
|
+
// source/modules/schema-builder/build-count-schema.ts
|
|
42
|
+
import { t as t4 } from "elysia";
|
|
43
|
+
|
|
44
|
+
// source/modules/schema-builder/build-filters-schema.ts
|
|
45
|
+
import { t as t3 } from "elysia";
|
|
46
|
+
|
|
47
|
+
// source/modules/schema-builder/build-global-search-schema.ts
|
|
48
|
+
import { t as t2 } from "elysia/type-system";
|
|
49
|
+
var buildGlobalSearchSchema = (schema) => t2.Union([
|
|
50
|
+
t2.Object({
|
|
51
|
+
selectedFields: t2.Union([
|
|
52
|
+
t2.KeyOf(schema),
|
|
53
|
+
t2.Array(t2.KeyOf(schema), {
|
|
54
|
+
minItems: 1,
|
|
55
|
+
uniqueItems: true
|
|
56
|
+
})
|
|
57
|
+
]),
|
|
58
|
+
value: t2.Union([
|
|
59
|
+
t2.Number(),
|
|
60
|
+
t2.String()
|
|
61
|
+
])
|
|
62
|
+
}),
|
|
63
|
+
t2.Number(),
|
|
64
|
+
t2.String()
|
|
65
|
+
]);
|
|
66
|
+
|
|
67
|
+
// source/modules/schema-builder/build-filters-schema.ts
|
|
68
|
+
var buildFilterSchema = (schema) => {
|
|
69
|
+
const clauseSchema = {
|
|
70
|
+
$q: buildGlobalSearchSchema(schema)
|
|
71
|
+
};
|
|
72
|
+
for (const [key, propertySchema] of Object.entries(schema.properties))
|
|
73
|
+
clauseSchema[key] = flatten(t3.Union([
|
|
74
|
+
propertySchema,
|
|
75
|
+
buildAdaptiveWhereClauseSchema(propertySchema)
|
|
76
|
+
]));
|
|
77
|
+
return t3.Object(clauseSchema, {
|
|
78
|
+
minProperties: 1
|
|
79
|
+
});
|
|
80
|
+
};
|
|
81
|
+
|
|
82
|
+
// source/modules/schema-builder/clean-schema.ts
|
|
83
|
+
var cleanSchema = (schema) => filterByKeyExclusionRecursive(schema, [
|
|
84
|
+
"minLength",
|
|
85
|
+
"maxLength",
|
|
86
|
+
"pattern",
|
|
87
|
+
"minimum",
|
|
88
|
+
"maximum",
|
|
89
|
+
"exclusiveMinimum",
|
|
90
|
+
"exclusiveMaximum",
|
|
91
|
+
"multipleOf",
|
|
92
|
+
"minItems",
|
|
93
|
+
"maxItems",
|
|
94
|
+
"maxContains",
|
|
95
|
+
"minContains",
|
|
96
|
+
"minProperties",
|
|
97
|
+
"maxProperties",
|
|
98
|
+
"uniqueItems",
|
|
99
|
+
"minimumTimestamp",
|
|
100
|
+
"maximumTimestamp",
|
|
101
|
+
"exclusiveMinimumTimestamp",
|
|
102
|
+
"exclusiveMaximumTimestamp",
|
|
103
|
+
"multipleOfTimestamp",
|
|
104
|
+
"required",
|
|
105
|
+
"default"
|
|
106
|
+
]);
|
|
107
|
+
|
|
108
|
+
// source/modules/schema-builder/build-count-schema.ts
|
|
109
|
+
var buildCountSchema = (schema) => {
|
|
110
|
+
const sanitizedSchema = cleanSchema(schema);
|
|
111
|
+
const filterSchema = buildFilterSchema(sanitizedSchema);
|
|
112
|
+
return t4.Partial(t4.Object({
|
|
113
|
+
queryOptions: t4.Partial(t4.Object({
|
|
114
|
+
filters: t4.Union([
|
|
115
|
+
filterSchema,
|
|
116
|
+
t4.Array(filterSchema, { minItems: 1, uniqueItems: true })
|
|
117
|
+
])
|
|
118
|
+
}))
|
|
119
|
+
}));
|
|
120
|
+
};
|
|
121
|
+
// source/modules/schema-builder/build-delete-schema.ts
|
|
122
|
+
import { t as t6 } from "elysia";
|
|
123
|
+
|
|
124
|
+
// source/modules/schema-builder/build-selected-fields.ts
|
|
125
|
+
import { t as t5 } from "elysia/type-system";
|
|
126
|
+
var buildSelectedFieldsSchema = (schema) => t5.Union([
|
|
127
|
+
t5.KeyOf(schema),
|
|
128
|
+
t5.Literal("*"),
|
|
129
|
+
t5.Array(t5.KeyOf(schema), {
|
|
130
|
+
minItems: 1,
|
|
131
|
+
uniqueItems: true
|
|
132
|
+
})
|
|
133
|
+
]);
|
|
134
|
+
|
|
135
|
+
// source/modules/schema-builder/build-delete-schema.ts
|
|
136
|
+
var buildDeleteSchema = (schema) => {
|
|
137
|
+
const sanitizedSchema = cleanSchema(schema);
|
|
138
|
+
const filterSchema = buildFilterSchema(sanitizedSchema);
|
|
139
|
+
return t6.Object({
|
|
140
|
+
queryOptions: t6.Object({
|
|
141
|
+
selectedFields: t6.Optional(buildSelectedFieldsSchema(sanitizedSchema)),
|
|
142
|
+
filters: t6.Union([
|
|
143
|
+
filterSchema,
|
|
144
|
+
t6.Array(filterSchema, { minItems: 1 })
|
|
145
|
+
])
|
|
146
|
+
})
|
|
147
|
+
});
|
|
148
|
+
};
|
|
149
|
+
// source/modules/schema-builder/build-find-schema.ts
|
|
150
|
+
import { t as t8 } from "elysia";
|
|
151
|
+
|
|
152
|
+
// source/modules/schema-builder/build-order-by-schema.ts
|
|
153
|
+
import { t as t7 } from "elysia/type-system";
|
|
154
|
+
var buildOrderBySchema = (schema) => t7.Object({
|
|
155
|
+
selectedField: t7.KeyOf(schema),
|
|
156
|
+
direction: t7.Union([t7.Literal("asc"), t7.Literal("desc")])
|
|
157
|
+
});
|
|
158
|
+
|
|
159
|
+
// source/modules/schema-builder/build-find-schema.ts
|
|
160
|
+
var buildFindSchema = (schema) => {
|
|
161
|
+
const sanitizedSchema = cleanSchema(schema);
|
|
162
|
+
const filterSchema = buildFilterSchema(sanitizedSchema);
|
|
163
|
+
return t8.Partial(t8.Object({
|
|
164
|
+
queryOptions: t8.Partial(t8.Object({
|
|
165
|
+
selectedFields: buildSelectedFieldsSchema(sanitizedSchema),
|
|
166
|
+
orderBy: buildOrderBySchema(sanitizedSchema),
|
|
167
|
+
filters: t8.Union([
|
|
168
|
+
filterSchema,
|
|
169
|
+
t8.Array(filterSchema, { minItems: 1, uniqueItems: true })
|
|
170
|
+
]),
|
|
171
|
+
limit: t8.Number({
|
|
172
|
+
default: 100,
|
|
173
|
+
minimum: 1
|
|
174
|
+
}),
|
|
175
|
+
offset: t8.Number({
|
|
176
|
+
default: 0,
|
|
177
|
+
minimum: 0
|
|
178
|
+
})
|
|
179
|
+
}))
|
|
180
|
+
}));
|
|
181
|
+
};
|
|
182
|
+
// source/modules/schema-builder/build-insert-schema.ts
|
|
183
|
+
import { t as t9 } from "elysia";
|
|
184
|
+
var buildInsertSchema = (schema) => t9.Object({
|
|
185
|
+
queryOptions: t9.Optional(t9.Object({
|
|
186
|
+
selectedFields: buildSelectedFieldsSchema(schema)
|
|
187
|
+
})),
|
|
188
|
+
data: t9.Union([
|
|
189
|
+
schema,
|
|
190
|
+
t9.Array(schema, {
|
|
191
|
+
minItems: 1,
|
|
192
|
+
uniqueItems: true
|
|
193
|
+
})
|
|
194
|
+
])
|
|
195
|
+
});
|
|
196
|
+
// source/modules/schema-builder/build-update-one-schema.ts
|
|
197
|
+
import { t as t10 } from "elysia";
|
|
198
|
+
var buildUpdateOneSchema = (schema) => t10.Object({
|
|
199
|
+
data: t10.Partial(schema)
|
|
200
|
+
});
|
|
201
|
+
// source/modules/schema-builder/build-update-schema.ts
|
|
202
|
+
import { t as t11 } from "elysia";
|
|
203
|
+
var buildUpdateSchema = (schema) => {
|
|
204
|
+
const sanitizedSchema = cleanSchema(schema);
|
|
205
|
+
const filterSchema = buildFilterSchema(sanitizedSchema);
|
|
206
|
+
return t11.Object({
|
|
207
|
+
queryOptions: t11.Object({
|
|
208
|
+
selectedFields: t11.Optional(buildSelectedFieldsSchema(sanitizedSchema)),
|
|
209
|
+
filters: t11.Union([
|
|
210
|
+
filterSchema,
|
|
211
|
+
t11.Array(filterSchema, { minItems: 1, uniqueItems: true })
|
|
212
|
+
])
|
|
213
|
+
}),
|
|
214
|
+
data: t11.Partial(schema)
|
|
215
|
+
});
|
|
216
|
+
};
|
|
217
|
+
export {
|
|
218
|
+
cleanSchema,
|
|
219
|
+
buildUpdateSchema,
|
|
220
|
+
buildUpdateOneSchema,
|
|
221
|
+
buildSelectedFieldsSchema,
|
|
222
|
+
buildOrderBySchema,
|
|
223
|
+
buildInsertSchema,
|
|
224
|
+
buildGlobalSearchSchema,
|
|
225
|
+
buildFindSchema,
|
|
226
|
+
buildFilterSchema,
|
|
227
|
+
buildDeleteSchema,
|
|
228
|
+
buildCountSchema,
|
|
229
|
+
buildAdaptiveWhereClauseSchema
|
|
230
|
+
};
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import type { TArray, TObject, TPartial, TUnion } from '@sinclair/typebox/type';
|
|
2
|
-
import type {
|
|
2
|
+
import type { FilterSchema } from './filter-schema';
|
|
3
3
|
export type CountSchema<TSourceCountSchema extends TObject> = TPartial<TObject<{
|
|
4
4
|
queryOptions: TPartial<TObject<{
|
|
5
5
|
filters: TUnion<[
|
|
6
|
-
|
|
7
|
-
TArray<
|
|
6
|
+
FilterSchema<TSourceCountSchema>,
|
|
7
|
+
TArray<FilterSchema<TSourceCountSchema>>
|
|
8
8
|
]>;
|
|
9
9
|
}>>;
|
|
10
10
|
}>>;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { TArray, TObject, TOptional, TUnion } from '@sinclair/typebox/type';
|
|
2
|
+
import type { FilterSchema } from './filter-schema';
|
|
3
|
+
import type { SelectedFieldsSchema } from './selected-fields-schema';
|
|
4
|
+
export type DeleteSchema<TSourceDeleteSchema extends TObject> = TObject<{
|
|
5
|
+
queryOptions: TObject<{
|
|
6
|
+
selectedFields: TOptional<SelectedFieldsSchema<TSourceDeleteSchema>>;
|
|
7
|
+
filters: TUnion<[
|
|
8
|
+
FilterSchema<TSourceDeleteSchema>,
|
|
9
|
+
TArray<FilterSchema<TSourceDeleteSchema>>
|
|
10
|
+
]>;
|
|
11
|
+
}>;
|
|
12
|
+
}>;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { Static, TObject, TPartial, TUnion } from '@sinclair/typebox/type';
|
|
2
|
+
import type { AdaptiveWhereClauseSchema } from './adaptive-where-clause-schema';
|
|
3
|
+
import type { GlobalSearchSchema } from './global-search-schema';
|
|
4
|
+
import type { TFlatten } from './tflatten';
|
|
5
|
+
export type FilterSchema<TSourceSchema extends TObject> = TPartial<TObject<{
|
|
6
|
+
$q: GlobalSearchSchema<TSourceSchema>;
|
|
7
|
+
} & {
|
|
8
|
+
[K in keyof Static<TSourceSchema>]: TFlatten<TUnion<[
|
|
9
|
+
TSourceSchema['properties'][K],
|
|
10
|
+
AdaptiveWhereClauseSchema<TSourceSchema['properties'][K]>
|
|
11
|
+
]>>;
|
|
12
|
+
}>>;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { TArray, TNumber, TObject, TPartial, TUnion } from '@sinclair/typebox/type';
|
|
2
|
+
import type { FilterSchema } from './filter-schema';
|
|
3
|
+
import type { OrderBySchema } from './order-by-schema';
|
|
4
|
+
import type { SelectedFieldsSchema } from './selected-fields-schema';
|
|
5
|
+
export type FindSchema<TSourceFindSchema extends TObject> = TPartial<TObject<{
|
|
6
|
+
queryOptions: TPartial<TObject<{
|
|
7
|
+
selectedFields: SelectedFieldsSchema<TSourceFindSchema>;
|
|
8
|
+
orderBy: OrderBySchema<TSourceFindSchema>;
|
|
9
|
+
filters: TUnion<[
|
|
10
|
+
FilterSchema<TSourceFindSchema>,
|
|
11
|
+
TArray<FilterSchema<TSourceFindSchema>>
|
|
12
|
+
]>;
|
|
13
|
+
limit: TNumber;
|
|
14
|
+
offset: TNumber;
|
|
15
|
+
}>>;
|
|
16
|
+
}>>;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { TArray, TKeyOf, TNumber, TObject, TString, TUnion } from '@sinclair/typebox/type';
|
|
2
|
-
export type
|
|
2
|
+
export type GlobalSearchSchema<TSourceSchema extends TObject> = TUnion<[
|
|
3
3
|
TObject<{
|
|
4
4
|
selectedFields: TUnion<[
|
|
5
5
|
TKeyOf<TSourceSchema>,
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export type { AdaptiveWhereClauseSchema } from './adaptive-where-clause-schema';
|
|
2
|
+
export type { CountSchema } from './count-schema';
|
|
3
|
+
export type { DeleteSchema } from './delete-schema';
|
|
4
|
+
export type { FilterSchema } from './filter-schema';
|
|
5
|
+
export type { FindSchema } from './find-schema';
|
|
6
|
+
export type { GlobalSearchSchema } from './global-search-schema';
|
|
7
|
+
export type { InsertSchema } from './insert-schema';
|
|
8
|
+
export type { OrderBySchema } from './order-by-schema';
|
|
9
|
+
export type { SelectedFieldsSchema } from './selected-fields-schema';
|
|
10
|
+
export type { TFlatten } from './tflatten';
|
|
11
|
+
export type { UpdateOneSchema } from './update-one-schema';
|
|
12
|
+
export type { UpdateSchema } from './update-schema';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { TArray, TObject, TOptional, TUnion } from '@sinclair/typebox/type';
|
|
2
|
-
import type { SelectedFieldsSchema } from '
|
|
2
|
+
import type { SelectedFieldsSchema } from './selected-fields-schema';
|
|
3
3
|
export type InsertSchema<TSourceInsertSchema extends TObject> = TObject<{
|
|
4
4
|
queryOptions: TOptional<TObject<{
|
|
5
5
|
selectedFields: SelectedFieldsSchema<TSourceInsertSchema>;
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import type { TArray, TObject, TOptional, TPartial, TUnion } from '@sinclair/typebox/type';
|
|
2
|
-
import type {
|
|
3
|
-
import type { SelectedFieldsSchema } from '
|
|
2
|
+
import type { FilterSchema } from './filter-schema';
|
|
3
|
+
import type { SelectedFieldsSchema } from './selected-fields-schema';
|
|
4
4
|
export type UpdateSchema<TSourceUpdateSchema extends TObject> = TObject<{
|
|
5
5
|
queryOptions: TObject<{
|
|
6
6
|
selectedFields: TOptional<SelectedFieldsSchema<TSourceUpdateSchema>>;
|
|
7
7
|
filters: TUnion<[
|
|
8
|
-
|
|
9
|
-
TArray<
|
|
8
|
+
FilterSchema<TSourceUpdateSchema>,
|
|
9
|
+
TArray<FilterSchema<TSourceUpdateSchema>>
|
|
10
10
|
]>;
|
|
11
11
|
}>;
|
|
12
12
|
data: TPartial<TSourceUpdateSchema>;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import type { TSchema } from '@sinclair/typebox/type';
|
|
2
|
-
import type { TFlatten } from '
|
|
2
|
+
import type { TFlatten } from '../../../modules/schema-builder/types/tflatten';
|
|
3
3
|
export declare const flatten: <Type extends TSchema>(type: Type) => TFlatten<Type>;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
export declare const SINGLETON_MANAGER_ERROR_KEYS: {
|
|
2
|
-
readonly CLASS_INSTANCE_ALREADY_REGISTERED: "mrx-core.singleton-manager.error.class_instance_already_registered";
|
|
3
|
-
readonly CLASS_INSTANCE_NOT_REGISTERED: "mrx-core.singleton-manager.error.class_instance_not_registered";
|
|
2
|
+
readonly CLASS_INSTANCE_ALREADY_REGISTERED: "mrx.mrx-core.singleton-manager.error.class_instance_already_registered";
|
|
3
|
+
readonly CLASS_INSTANCE_NOT_REGISTERED: "mrx.mrx-core.singleton-manager.error.class_instance_not_registered";
|
|
4
4
|
};
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
// @bun
|
|
2
2
|
import {
|
|
3
3
|
SingletonManager
|
|
4
|
-
} from "../../chunk-
|
|
5
|
-
import"../../chunk-
|
|
6
|
-
import"../../chunk-
|
|
4
|
+
} from "../../chunk-r7yr9p57.js";
|
|
5
|
+
import"../../chunk-y5dtkmnp.js";
|
|
6
|
+
import"../../chunk-jz3wd472.js";
|
|
7
7
|
export {
|
|
8
8
|
SingletonManager
|
|
9
9
|
};
|
|
@@ -39,7 +39,7 @@ export declare class SingletonManager {
|
|
|
39
39
|
* @param name - The name of the class.
|
|
40
40
|
* @param instance - The instance of the class to register as singleton.
|
|
41
41
|
*
|
|
42
|
-
* @throws ({@link
|
|
42
|
+
* @throws ({@link InternalError}) If the name is already registered, it throws an error.
|
|
43
43
|
*/
|
|
44
44
|
static register<TClass extends object>(name: string, instance: TClass): void;
|
|
45
45
|
/**
|
|
@@ -47,7 +47,7 @@ export declare class SingletonManager {
|
|
|
47
47
|
*
|
|
48
48
|
* @param name - The name of the class to unregister.
|
|
49
49
|
*
|
|
50
|
-
* @throws ({@link
|
|
50
|
+
* @throws ({@link InternalError}) If the name is not registered, it throws an error.
|
|
51
51
|
*/
|
|
52
52
|
static unregister(name: string): void;
|
|
53
53
|
/**
|
|
@@ -57,7 +57,7 @@ export declare class SingletonManager {
|
|
|
57
57
|
*
|
|
58
58
|
* @param name - The name of the class to get the singleton instance.
|
|
59
59
|
*
|
|
60
|
-
* @throws ({@link
|
|
60
|
+
* @throws ({@link InternalError}) If the class is not registered, it throws an error.
|
|
61
61
|
*
|
|
62
62
|
* @returns The singleton instance of the class.
|
|
63
63
|
*/
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
export declare const TOTP_ERROR_KEYS: {
|
|
2
|
-
readonly INVALID_ALGORITHM: "mrx-core.totp.error.invalid_algorithm";
|
|
3
|
-
readonly INVALID_BASE32_CHARACTER: "mrx-core.totp.error.invalid_base32_character";
|
|
4
|
-
readonly INVALID_OTP_AUTH_URI: "mrx-core.totp.error.invalid_otp_auth_uri";
|
|
5
|
-
readonly INVALID_SECRET_LENGTH: "mrx-core.totp.error.invalid_secret_length";
|
|
6
|
-
readonly MISSING_SECRET: "mrx-core.totp.error.missing_secret";
|
|
2
|
+
readonly INVALID_ALGORITHM: "mrx.mrx-core.totp.error.invalid_algorithm";
|
|
3
|
+
readonly INVALID_BASE32_CHARACTER: "mrx.mrx-core.totp.error.invalid_base32_character";
|
|
4
|
+
readonly INVALID_OTP_AUTH_URI: "mrx.mrx-core.totp.error.invalid_otp_auth_uri";
|
|
5
|
+
readonly INVALID_SECRET_LENGTH: "mrx.mrx-core.totp.error.invalid_secret_length";
|
|
6
|
+
readonly MISSING_SECRET: "mrx.mrx-core.totp.error.missing_secret";
|
|
7
7
|
};
|
|
@@ -6,10 +6,10 @@ import {
|
|
|
6
6
|
} from "../../chunk-m3grz32t.js";
|
|
7
7
|
import {
|
|
8
8
|
TOTP_ERROR_KEYS
|
|
9
|
-
} from "../../chunk-
|
|
9
|
+
} from "../../chunk-hwfebx4x.js";
|
|
10
10
|
import {
|
|
11
|
-
|
|
12
|
-
} from "../../chunk-
|
|
11
|
+
InternalError
|
|
12
|
+
} from "../../chunk-jz3wd472.js";
|
|
13
13
|
|
|
14
14
|
// source/modules/totp/hotp.ts
|
|
15
15
|
import { webcrypto } from "crypto";
|
|
@@ -47,13 +47,13 @@ var buildOtpAuthUri = ({
|
|
|
47
47
|
var parseOtpAuthUri = (uri) => {
|
|
48
48
|
const url = new URL(uri);
|
|
49
49
|
if (url.protocol !== "otpauth:")
|
|
50
|
-
throw new
|
|
50
|
+
throw new InternalError(TOTP_ERROR_KEYS.INVALID_OTP_AUTH_URI);
|
|
51
51
|
if (url.hostname !== "totp")
|
|
52
|
-
throw new
|
|
52
|
+
throw new InternalError(TOTP_ERROR_KEYS.INVALID_OTP_AUTH_URI);
|
|
53
53
|
const label = decodeURIComponent(url.pathname.slice(1));
|
|
54
54
|
const secretBase32 = url.searchParams.get("secret");
|
|
55
55
|
if (!secretBase32)
|
|
56
|
-
throw new
|
|
56
|
+
throw new InternalError(TOTP_ERROR_KEYS.MISSING_SECRET);
|
|
57
57
|
const issuerParam = url.searchParams.get("issuer");
|
|
58
58
|
const issuer = issuerParam ? decodeURIComponent(issuerParam) : undefined;
|
|
59
59
|
const algorithm = url.searchParams.get("algorithm") || "SHA-1";
|
|
@@ -12,7 +12,7 @@ export declare const buildOtpAuthUri: ({ secretBase32, label, issuer, algorithm,
|
|
|
12
12
|
*
|
|
13
13
|
* @param uri - OTPAuth URI to parse
|
|
14
14
|
*
|
|
15
|
-
* @throws ({@link
|
|
15
|
+
* @throws ({@link InternalError}) - if the URI is invalid or missing required parameters
|
|
16
16
|
*
|
|
17
17
|
* @returns Parsed URI parameters
|
|
18
18
|
*/
|
|
@@ -12,7 +12,7 @@ export declare const base32Encode: (input: string | Uint8Array, withPadding?: bo
|
|
|
12
12
|
*
|
|
13
13
|
* @param base32 - Base32 string to decode
|
|
14
14
|
*
|
|
15
|
-
* @throws ({@link
|
|
15
|
+
* @throws ({@link InternalError}) - if invalid Base32 character is found
|
|
16
16
|
*
|
|
17
17
|
* @returns Decoded bytes
|
|
18
18
|
*/
|
|
@@ -6,10 +6,10 @@ import {
|
|
|
6
6
|
} from "../../../chunk-m3grz32t.js";
|
|
7
7
|
import {
|
|
8
8
|
TOTP_ERROR_KEYS
|
|
9
|
-
} from "../../../chunk-
|
|
9
|
+
} from "../../../chunk-hwfebx4x.js";
|
|
10
10
|
import {
|
|
11
|
-
|
|
12
|
-
} from "../../../chunk-
|
|
11
|
+
InternalError
|
|
12
|
+
} from "../../../chunk-jz3wd472.js";
|
|
13
13
|
|
|
14
14
|
// source/modules/totp/utils/base32.ts
|
|
15
15
|
var BASE32_ALPHABET = "ABCDEFGHIJKLMNOPQRSTUVWXYZ234567";
|
|
@@ -43,7 +43,7 @@ var base32Decode = (base32) => {
|
|
|
43
43
|
for (const char of cleanBase32) {
|
|
44
44
|
const charValue = BASE32_ALPHABET.indexOf(char);
|
|
45
45
|
if (charValue === -1)
|
|
46
|
-
throw new
|
|
46
|
+
throw new InternalError(TOTP_ERROR_KEYS.INVALID_BASE32_CHARACTER, `Invalid Base32 character: ${char}`);
|
|
47
47
|
value = value << 5 | charValue;
|
|
48
48
|
bits += 5;
|
|
49
49
|
if (bits >= 8) {
|
|
@@ -57,7 +57,7 @@ var base32Decode = (base32) => {
|
|
|
57
57
|
import { getRandomValues } from "crypto";
|
|
58
58
|
var generateSecretBytes = (length = 20) => {
|
|
59
59
|
if (length <= 0)
|
|
60
|
-
throw new
|
|
60
|
+
throw new InternalError(TOTP_ERROR_KEYS.INVALID_SECRET_LENGTH);
|
|
61
61
|
return getRandomValues(new Uint8Array(length));
|
|
62
62
|
};
|
|
63
63
|
// source/modules/totp/utils/time-remaining.ts
|
|
@@ -5,6 +5,6 @@ import type { TSchema } from '@sinclair/typebox';
|
|
|
5
5
|
* @param schema - The schema to validate the environment variables against.
|
|
6
6
|
* @param env - The environment variables to validate. Defaults to `process.env`.
|
|
7
7
|
*
|
|
8
|
-
* @throws ({@link
|
|
8
|
+
* @throws ({@link InternalError}) - If the environment variables are invalid based on the schema.
|
|
9
9
|
*/
|
|
10
10
|
export declare const validateEnv: (schema: TSchema, env?: Record<string, unknown>) => void;
|
|
@@ -2,16 +2,13 @@
|
|
|
2
2
|
import {
|
|
3
3
|
UTILS_ERROR_KEYS
|
|
4
4
|
} from "../../chunk-n0n14mf8.js";
|
|
5
|
-
import {
|
|
6
|
-
flatten
|
|
7
|
-
} from "../../chunk-9dzsj7f2.js";
|
|
8
5
|
import {
|
|
9
6
|
isDateString,
|
|
10
7
|
makeStreamAsyncIterable
|
|
11
8
|
} from "../../chunk-grfyngq0.js";
|
|
12
9
|
import {
|
|
13
|
-
|
|
14
|
-
} from "../../chunk-
|
|
10
|
+
InternalError
|
|
11
|
+
} from "../../chunk-jz3wd472.js";
|
|
15
12
|
|
|
16
13
|
// source/shared/utils/env.ts
|
|
17
14
|
import { Value } from "@sinclair/typebox/value";
|
|
@@ -19,12 +16,11 @@ var validateEnv = (schema, env = process.env) => {
|
|
|
19
16
|
try {
|
|
20
17
|
Value.Assert(schema, Value.Parse(schema, env));
|
|
21
18
|
} catch (error) {
|
|
22
|
-
throw new
|
|
19
|
+
throw new InternalError(UTILS_ERROR_KEYS.INVALID_ENVIRONMENT, error);
|
|
23
20
|
}
|
|
24
21
|
};
|
|
25
22
|
export {
|
|
26
23
|
validateEnv,
|
|
27
24
|
makeStreamAsyncIterable,
|
|
28
|
-
isDateString
|
|
29
|
-
flatten
|
|
25
|
+
isDateString
|
|
30
26
|
};
|