@mrxsys/mrx-core 2.11.0 → 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-sbpj7f3p.js → chunk-kne89z1w.js} +1 -1
- package/dist/{chunk-7j86h1nd.js → chunk-s53cbgkb.js} +14 -9
- package/dist/chunk-txazb0xn.js +27 -0
- package/dist/modules/database/index.js +2 -2
- package/dist/modules/elysia/db-resolver/index.js +50 -7
- package/dist/modules/repository/index.js +1 -1
- package/dist/modules/repository/repository.d.ts +19 -3
- 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/shared/types/index.d.ts +0 -1
- package/dist/shared/utils/index.d.ts +0 -1
- package/dist/shared/utils/index.js +1 -5
- package/package.json +7 -9
- package/dist/chunk-4g0x6g4j.js +0 -365
- package/dist/chunk-9dzsj7f2.js +0 -23
- package/dist/chunk-tmvj28bq.js +0 -284
- package/dist/chunk-w7h898m3.js +0 -14
- package/dist/chunk-yzgdqb02.js +0 -53
- 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 -274
- package/dist/modules/elysia/crud/operations/delete.d.ts +0 -274
- package/dist/modules/elysia/crud/operations/deleteOne.d.ts +0 -274
- package/dist/modules/elysia/crud/operations/find.d.ts +0 -274
- package/dist/modules/elysia/crud/operations/findOne.d.ts +0 -274
- 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 -274
- package/dist/modules/elysia/crud/operations/update.d.ts +0 -274
- package/dist/modules/elysia/crud/operations/updateOne.d.ts +0 -274
- 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 -3
- 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
package/dist/chunk-4g0x6g4j.js
DELETED
|
@@ -1,365 +0,0 @@
|
|
|
1
|
-
// @bun
|
|
2
|
-
import {
|
|
3
|
-
flatten
|
|
4
|
-
} from "./chunk-9dzsj7f2.js";
|
|
5
|
-
import {
|
|
6
|
-
filterByKeyExclusionRecursive
|
|
7
|
-
} from "./chunk-hv6g22kf.js";
|
|
8
|
-
|
|
9
|
-
// source/modules/elysia/crud/utils/create-count-response-200-schema.ts
|
|
10
|
-
import { t } from "elysia";
|
|
11
|
-
var createCountResponse200Schema = () => t.Object({
|
|
12
|
-
message: t.String(),
|
|
13
|
-
content: t.Number()
|
|
14
|
-
});
|
|
15
|
-
|
|
16
|
-
// source/modules/elysia/crud/utils/is-date-from-elysia-typebox.ts
|
|
17
|
-
import { KindGuard } from "@sinclair/typebox";
|
|
18
|
-
var isDateFromElysiaTypeBox = (schema) => KindGuard.IsUnion(schema) && schema.anyOf.length === 4 && schema.anyOf.some((item) => KindGuard.IsDate(item)) && schema.anyOf.some((item) => KindGuard.IsString(item) && item.format === "date-time") && schema.anyOf.some((item) => KindGuard.IsString(item) && item.format === "date") && schema.anyOf.some((item) => KindGuard.IsNumber(item));
|
|
19
|
-
|
|
20
|
-
// source/modules/elysia/crud/utils/create-adaptive-where-clause-schema.ts
|
|
21
|
-
import { KindGuard as KindGuard2 } from "@sinclair/typebox/type";
|
|
22
|
-
import { t as t2 } from "elysia";
|
|
23
|
-
var createAdaptiveWhereClauseSchema = (schema) => {
|
|
24
|
-
const common = {
|
|
25
|
-
$eq: schema,
|
|
26
|
-
$neq: schema,
|
|
27
|
-
$isNull: t2.Boolean()
|
|
28
|
-
};
|
|
29
|
-
const strNumDate = KindGuard2.IsString(schema) || KindGuard2.IsNumber(schema) || isDateFromElysiaTypeBox(schema) ? {
|
|
30
|
-
$in: t2.Array(schema, { minItems: 1, uniqueItems: true }),
|
|
31
|
-
$nin: t2.Array(schema, { minItems: 1, uniqueItems: true }),
|
|
32
|
-
$like: t2.String(),
|
|
33
|
-
$nlike: t2.String()
|
|
34
|
-
} : {};
|
|
35
|
-
const numDate = KindGuard2.IsNumber(schema) || isDateFromElysiaTypeBox(schema) ? {
|
|
36
|
-
$lt: schema,
|
|
37
|
-
$lte: schema,
|
|
38
|
-
$gt: schema,
|
|
39
|
-
$gte: schema,
|
|
40
|
-
$between: t2.Tuple([schema, schema]),
|
|
41
|
-
$nbetween: t2.Tuple([schema, schema])
|
|
42
|
-
} : {};
|
|
43
|
-
return t2.Partial(t2.Object({ ...common, ...strNumDate, ...numDate }));
|
|
44
|
-
};
|
|
45
|
-
|
|
46
|
-
// source/modules/elysia/crud/utils/create-properties-schema.ts
|
|
47
|
-
import { t as t3 } from "elysia";
|
|
48
|
-
var createPropertiesSchema = (schema) => {
|
|
49
|
-
const { properties } = schema;
|
|
50
|
-
const clauseSchema = {};
|
|
51
|
-
for (const [key, propertySchema] of Object.entries(properties))
|
|
52
|
-
clauseSchema[key] = flatten(t3.Union([
|
|
53
|
-
createAdaptiveWhereClauseSchema(propertySchema),
|
|
54
|
-
propertySchema
|
|
55
|
-
]));
|
|
56
|
-
return t3.Object(clauseSchema);
|
|
57
|
-
};
|
|
58
|
-
|
|
59
|
-
// source/modules/elysia/crud/utils/create-q-schema.ts
|
|
60
|
-
import { t as t4 } from "elysia/type-system";
|
|
61
|
-
var createQSchema = (schema) => t4.Union([
|
|
62
|
-
t4.Object({
|
|
63
|
-
selectedFields: t4.Union([
|
|
64
|
-
t4.KeyOf(schema),
|
|
65
|
-
t4.Array(t4.KeyOf(schema), {
|
|
66
|
-
minItems: 1,
|
|
67
|
-
uniqueItems: true
|
|
68
|
-
})
|
|
69
|
-
]),
|
|
70
|
-
value: t4.Union([
|
|
71
|
-
t4.Number(),
|
|
72
|
-
t4.String()
|
|
73
|
-
])
|
|
74
|
-
}),
|
|
75
|
-
t4.Number(),
|
|
76
|
-
t4.String()
|
|
77
|
-
]);
|
|
78
|
-
|
|
79
|
-
// source/modules/elysia/crud/utils/create-filters-schema.ts
|
|
80
|
-
import { t as t5 } from "elysia";
|
|
81
|
-
var createFiltersSchema = (schema) => t5.Composite([
|
|
82
|
-
t5.Object({
|
|
83
|
-
$q: createQSchema(schema)
|
|
84
|
-
}),
|
|
85
|
-
createPropertiesSchema(schema)
|
|
86
|
-
], {
|
|
87
|
-
minProperties: 1
|
|
88
|
-
});
|
|
89
|
-
|
|
90
|
-
// source/modules/elysia/crud/utils/create-count-schema.ts
|
|
91
|
-
import { t as t6 } from "elysia";
|
|
92
|
-
var createCountSchema = (schema) => {
|
|
93
|
-
const sanitizedSchema = filterByKeyExclusionRecursive(schema, [
|
|
94
|
-
"minLength",
|
|
95
|
-
"maxLength",
|
|
96
|
-
"pattern",
|
|
97
|
-
"minimum",
|
|
98
|
-
"maximum",
|
|
99
|
-
"exclusiveMinimum",
|
|
100
|
-
"exclusiveMaximum",
|
|
101
|
-
"multipleOf",
|
|
102
|
-
"minItems",
|
|
103
|
-
"maxItems",
|
|
104
|
-
"maxContains",
|
|
105
|
-
"minContains",
|
|
106
|
-
"minProperties",
|
|
107
|
-
"maxProperties",
|
|
108
|
-
"uniqueItems",
|
|
109
|
-
"minimumTimestamp",
|
|
110
|
-
"maximumTimestamp",
|
|
111
|
-
"exclusiveMinimumTimestamp",
|
|
112
|
-
"exclusiveMaximumTimestamp",
|
|
113
|
-
"multipleOfTimestamp",
|
|
114
|
-
"required",
|
|
115
|
-
"examples",
|
|
116
|
-
"example",
|
|
117
|
-
"default",
|
|
118
|
-
"title",
|
|
119
|
-
"description"
|
|
120
|
-
]);
|
|
121
|
-
return t6.Partial(t6.Object({
|
|
122
|
-
queryOptions: t6.Partial(t6.Object({
|
|
123
|
-
filters: t6.Union([
|
|
124
|
-
t6.Partial(createFiltersSchema(sanitizedSchema)),
|
|
125
|
-
t6.Array(t6.Partial(createFiltersSchema(sanitizedSchema)))
|
|
126
|
-
])
|
|
127
|
-
}))
|
|
128
|
-
}));
|
|
129
|
-
};
|
|
130
|
-
|
|
131
|
-
// source/modules/elysia/crud/utils/create-selected-fields-schema.ts
|
|
132
|
-
import { t as t7 } from "elysia/type-system";
|
|
133
|
-
var createSelectedFieldsSchema = (schema) => t7.Union([
|
|
134
|
-
t7.KeyOf(schema),
|
|
135
|
-
t7.Literal("*"),
|
|
136
|
-
t7.Array(t7.KeyOf(schema), {
|
|
137
|
-
minItems: 1,
|
|
138
|
-
uniqueItems: true
|
|
139
|
-
})
|
|
140
|
-
]);
|
|
141
|
-
|
|
142
|
-
// source/modules/elysia/crud/utils/create-delete-schema.ts
|
|
143
|
-
import { t as t8 } from "elysia";
|
|
144
|
-
var createDeleteSchema = (schema) => {
|
|
145
|
-
const sanitizedSchema = filterByKeyExclusionRecursive(schema, [
|
|
146
|
-
"minLength",
|
|
147
|
-
"maxLength",
|
|
148
|
-
"pattern",
|
|
149
|
-
"minimum",
|
|
150
|
-
"maximum",
|
|
151
|
-
"exclusiveMinimum",
|
|
152
|
-
"exclusiveMaximum",
|
|
153
|
-
"multipleOf",
|
|
154
|
-
"minItems",
|
|
155
|
-
"maxItems",
|
|
156
|
-
"maxContains",
|
|
157
|
-
"minContains",
|
|
158
|
-
"minProperties",
|
|
159
|
-
"maxProperties",
|
|
160
|
-
"uniqueItems",
|
|
161
|
-
"minimumTimestamp",
|
|
162
|
-
"maximumTimestamp",
|
|
163
|
-
"exclusiveMinimumTimestamp",
|
|
164
|
-
"exclusiveMaximumTimestamp",
|
|
165
|
-
"multipleOfTimestamp",
|
|
166
|
-
"required",
|
|
167
|
-
"examples",
|
|
168
|
-
"example",
|
|
169
|
-
"default",
|
|
170
|
-
"title",
|
|
171
|
-
"description"
|
|
172
|
-
]);
|
|
173
|
-
return t8.Object({
|
|
174
|
-
queryOptions: t8.Object({
|
|
175
|
-
selectedFields: t8.Optional(createSelectedFieldsSchema(sanitizedSchema)),
|
|
176
|
-
filters: t8.Union([
|
|
177
|
-
t8.Partial(createFiltersSchema(sanitizedSchema)),
|
|
178
|
-
t8.Array(t8.Partial(createFiltersSchema(sanitizedSchema)), { minItems: 1 })
|
|
179
|
-
])
|
|
180
|
-
})
|
|
181
|
-
});
|
|
182
|
-
};
|
|
183
|
-
|
|
184
|
-
// source/modules/elysia/crud/utils/create-order-schema.ts
|
|
185
|
-
import { t as t9 } from "elysia/type-system";
|
|
186
|
-
var createOrderSchema = (schema) => t9.Union([
|
|
187
|
-
t9.Object({
|
|
188
|
-
selectedField: t9.KeyOf(schema),
|
|
189
|
-
direction: t9.Union([t9.Literal("asc"), t9.Literal("desc")])
|
|
190
|
-
}),
|
|
191
|
-
t9.Array(t9.Object({
|
|
192
|
-
selectedField: t9.KeyOf(schema),
|
|
193
|
-
direction: t9.Union([t9.Literal("asc"), t9.Literal("desc")])
|
|
194
|
-
}), {
|
|
195
|
-
minItems: 1,
|
|
196
|
-
uniqueItems: true
|
|
197
|
-
})
|
|
198
|
-
]);
|
|
199
|
-
|
|
200
|
-
// source/modules/elysia/crud/utils/create-find-schema.ts
|
|
201
|
-
import { t as t10 } from "elysia";
|
|
202
|
-
var createFindSchema = (schema) => {
|
|
203
|
-
const sanitizedSchema = filterByKeyExclusionRecursive(schema, [
|
|
204
|
-
"minLength",
|
|
205
|
-
"maxLength",
|
|
206
|
-
"pattern",
|
|
207
|
-
"minimum",
|
|
208
|
-
"maximum",
|
|
209
|
-
"exclusiveMinimum",
|
|
210
|
-
"exclusiveMaximum",
|
|
211
|
-
"multipleOf",
|
|
212
|
-
"minItems",
|
|
213
|
-
"maxItems",
|
|
214
|
-
"maxContains",
|
|
215
|
-
"minContains",
|
|
216
|
-
"minProperties",
|
|
217
|
-
"maxProperties",
|
|
218
|
-
"uniqueItems",
|
|
219
|
-
"minimumTimestamp",
|
|
220
|
-
"maximumTimestamp",
|
|
221
|
-
"exclusiveMinimumTimestamp",
|
|
222
|
-
"exclusiveMaximumTimestamp",
|
|
223
|
-
"multipleOfTimestamp",
|
|
224
|
-
"required",
|
|
225
|
-
"examples",
|
|
226
|
-
"example",
|
|
227
|
-
"default",
|
|
228
|
-
"title",
|
|
229
|
-
"description"
|
|
230
|
-
]);
|
|
231
|
-
return t10.Partial(t10.Object({
|
|
232
|
-
queryOptions: t10.Partial(t10.Object({
|
|
233
|
-
selectedFields: createSelectedFieldsSchema(sanitizedSchema),
|
|
234
|
-
orderBy: createOrderSchema(sanitizedSchema),
|
|
235
|
-
filters: t10.Union([
|
|
236
|
-
t10.Partial(createFiltersSchema(sanitizedSchema)),
|
|
237
|
-
t10.Array(t10.Partial(createFiltersSchema(sanitizedSchema)))
|
|
238
|
-
]),
|
|
239
|
-
limit: t10.Number({
|
|
240
|
-
default: 100,
|
|
241
|
-
minimum: 1
|
|
242
|
-
}),
|
|
243
|
-
offset: t10.Number({
|
|
244
|
-
default: 0,
|
|
245
|
-
minimum: 0
|
|
246
|
-
})
|
|
247
|
-
}))
|
|
248
|
-
}));
|
|
249
|
-
};
|
|
250
|
-
|
|
251
|
-
// source/modules/elysia/crud/utils/create-id-param-schema.ts
|
|
252
|
-
import { t as t11 } from "elysia";
|
|
253
|
-
var createIdParamSchema = () => t11.Object({
|
|
254
|
-
id: t11.Union([
|
|
255
|
-
t11.String(),
|
|
256
|
-
t11.Number({
|
|
257
|
-
minimum: 1,
|
|
258
|
-
maximum: Number.MAX_SAFE_INTEGER
|
|
259
|
-
})
|
|
260
|
-
])
|
|
261
|
-
});
|
|
262
|
-
|
|
263
|
-
// source/modules/elysia/crud/utils/create-insert-schema.ts
|
|
264
|
-
import { t as t12 } from "elysia";
|
|
265
|
-
var createInsertSchema = (schema) => t12.Object({
|
|
266
|
-
queryOptions: t12.Optional(t12.Object({
|
|
267
|
-
selectedFields: createSelectedFieldsSchema(schema)
|
|
268
|
-
})),
|
|
269
|
-
data: t12.Union([
|
|
270
|
-
schema,
|
|
271
|
-
t12.Array(schema, {
|
|
272
|
-
minItems: 1,
|
|
273
|
-
uniqueItems: true
|
|
274
|
-
})
|
|
275
|
-
])
|
|
276
|
-
});
|
|
277
|
-
|
|
278
|
-
// source/modules/elysia/crud/utils/create-response-200-schema.ts
|
|
279
|
-
import { t as t13 } from "elysia";
|
|
280
|
-
var createResponse200Schema = (schema) => {
|
|
281
|
-
const sanitizedSchema = filterByKeyExclusionRecursive(schema, [
|
|
282
|
-
"minLength",
|
|
283
|
-
"maxLength",
|
|
284
|
-
"pattern",
|
|
285
|
-
"minimum",
|
|
286
|
-
"maximum",
|
|
287
|
-
"exclusiveMinimum",
|
|
288
|
-
"exclusiveMaximum",
|
|
289
|
-
"multipleOf",
|
|
290
|
-
"minItems",
|
|
291
|
-
"maxItems",
|
|
292
|
-
"maxContains",
|
|
293
|
-
"minContains",
|
|
294
|
-
"minProperties",
|
|
295
|
-
"maxProperties",
|
|
296
|
-
"uniqueItems",
|
|
297
|
-
"minimumTimestamp",
|
|
298
|
-
"maximumTimestamp",
|
|
299
|
-
"exclusiveMinimumTimestamp",
|
|
300
|
-
"exclusiveMaximumTimestamp",
|
|
301
|
-
"multipleOfTimestamp",
|
|
302
|
-
"required",
|
|
303
|
-
"default"
|
|
304
|
-
]);
|
|
305
|
-
const { properties } = sanitizedSchema;
|
|
306
|
-
const responseSchema = {};
|
|
307
|
-
for (const key in properties)
|
|
308
|
-
responseSchema[key] = flatten(t13.Union([properties[key], t13.Null()]));
|
|
309
|
-
return t13.Object({
|
|
310
|
-
message: t13.String(),
|
|
311
|
-
content: t13.Array(t13.Required(t13.Object(responseSchema)))
|
|
312
|
-
});
|
|
313
|
-
};
|
|
314
|
-
|
|
315
|
-
// source/modules/elysia/crud/utils/create-update-one-schema.ts
|
|
316
|
-
import { t as t14 } from "elysia";
|
|
317
|
-
var createUpdateOneSchema = (schema) => t14.Object({
|
|
318
|
-
data: t14.Partial(schema)
|
|
319
|
-
});
|
|
320
|
-
|
|
321
|
-
// source/modules/elysia/crud/utils/create-update-schema.ts
|
|
322
|
-
import { t as t15 } from "elysia";
|
|
323
|
-
var createUpdateSchema = (schema) => {
|
|
324
|
-
const sanitizedSchema = filterByKeyExclusionRecursive(schema, [
|
|
325
|
-
"minLength",
|
|
326
|
-
"maxLength",
|
|
327
|
-
"pattern",
|
|
328
|
-
"minimum",
|
|
329
|
-
"maximum",
|
|
330
|
-
"exclusiveMinimum",
|
|
331
|
-
"exclusiveMaximum",
|
|
332
|
-
"multipleOf",
|
|
333
|
-
"minItems",
|
|
334
|
-
"maxItems",
|
|
335
|
-
"maxContains",
|
|
336
|
-
"minContains",
|
|
337
|
-
"minProperties",
|
|
338
|
-
"maxProperties",
|
|
339
|
-
"uniqueItems",
|
|
340
|
-
"minimumTimestamp",
|
|
341
|
-
"maximumTimestamp",
|
|
342
|
-
"exclusiveMinimumTimestamp",
|
|
343
|
-
"exclusiveMaximumTimestamp",
|
|
344
|
-
"multipleOfTimestamp",
|
|
345
|
-
"required",
|
|
346
|
-
"examples",
|
|
347
|
-
"example",
|
|
348
|
-
"default",
|
|
349
|
-
"title",
|
|
350
|
-
"description"
|
|
351
|
-
]);
|
|
352
|
-
schema.minProperties = 1;
|
|
353
|
-
return t15.Object({
|
|
354
|
-
queryOptions: t15.Object({
|
|
355
|
-
selectedFields: t15.Optional(createSelectedFieldsSchema(sanitizedSchema)),
|
|
356
|
-
filters: t15.Union([
|
|
357
|
-
t15.Partial(createFiltersSchema(sanitizedSchema)),
|
|
358
|
-
t15.Array(t15.Partial(createFiltersSchema(sanitizedSchema)), { minItems: 1 })
|
|
359
|
-
])
|
|
360
|
-
}),
|
|
361
|
-
data: t15.Partial(schema)
|
|
362
|
-
});
|
|
363
|
-
};
|
|
364
|
-
|
|
365
|
-
export { createCountResponse200Schema, isDateFromElysiaTypeBox, createAdaptiveWhereClauseSchema, createPropertiesSchema, createQSchema, createFiltersSchema, createCountSchema, createSelectedFieldsSchema, createDeleteSchema, createOrderSchema, createFindSchema, createIdParamSchema, createInsertSchema, createResponse200Schema, createUpdateOneSchema, createUpdateSchema };
|
package/dist/chunk-9dzsj7f2.js
DELETED
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
// @bun
|
|
2
|
-
// source/shared/utils/flatten.ts
|
|
3
|
-
import { KindGuard } from "@sinclair/typebox";
|
|
4
|
-
import { t } from "elysia";
|
|
5
|
-
var _flattenInto = (type, result) => {
|
|
6
|
-
if (KindGuard.IsUnion(type))
|
|
7
|
-
for (const subType of type.anyOf)
|
|
8
|
-
_flattenInto(subType, result);
|
|
9
|
-
else
|
|
10
|
-
result.push(type);
|
|
11
|
-
};
|
|
12
|
-
var flatten = (type) => {
|
|
13
|
-
if (!KindGuard.IsUnion(type))
|
|
14
|
-
return type;
|
|
15
|
-
const isAlreadyFlat = type.anyOf.every((subType) => !KindGuard.IsUnion(subType));
|
|
16
|
-
if (isAlreadyFlat)
|
|
17
|
-
return type;
|
|
18
|
-
const result = [];
|
|
19
|
-
_flattenInto(type, result);
|
|
20
|
-
return t.Union(result);
|
|
21
|
-
};
|
|
22
|
-
|
|
23
|
-
export { flatten };
|
package/dist/chunk-tmvj28bq.js
DELETED
|
@@ -1,284 +0,0 @@
|
|
|
1
|
-
// @bun
|
|
2
|
-
import {
|
|
3
|
-
dbResolver
|
|
4
|
-
} from "./chunk-yzgdqb02.js";
|
|
5
|
-
import {
|
|
6
|
-
CRUD_SUCCESS_KEYS
|
|
7
|
-
} from "./chunk-w7h898m3.js";
|
|
8
|
-
|
|
9
|
-
// source/modules/elysia/crud/operations/count.ts
|
|
10
|
-
import { Elysia } from "elysia";
|
|
11
|
-
|
|
12
|
-
// source/modules/elysia/crud/operations/utils/get-db-injection.ts
|
|
13
|
-
var getDbInjection = (database) => typeof database === "string" ? {
|
|
14
|
-
injectStaticDB: database
|
|
15
|
-
} : {
|
|
16
|
-
injectDynamicDB: database
|
|
17
|
-
};
|
|
18
|
-
|
|
19
|
-
// source/modules/elysia/crud/operations/count.ts
|
|
20
|
-
var count = (database, tableName, {
|
|
21
|
-
hook,
|
|
22
|
-
method = "POST",
|
|
23
|
-
path = "/count"
|
|
24
|
-
}) => new Elysia({
|
|
25
|
-
name: `count[${tableName}]`
|
|
26
|
-
}).use(dbResolver("database:")).route(method, path, async (ctx) => {
|
|
27
|
-
const db = ctx.dynamicDB || ctx.staticDB;
|
|
28
|
-
const body = ctx.body;
|
|
29
|
-
const data = await db.getRepository(tableName).count({
|
|
30
|
-
...body.queryOptions,
|
|
31
|
-
throwIfNoResult: true
|
|
32
|
-
});
|
|
33
|
-
return {
|
|
34
|
-
message: CRUD_SUCCESS_KEYS.COUNT_RESPONSE,
|
|
35
|
-
content: data
|
|
36
|
-
};
|
|
37
|
-
}, {
|
|
38
|
-
detail: {
|
|
39
|
-
summary: "Count",
|
|
40
|
-
description: `Count ${tableName} records based on query options.`
|
|
41
|
-
},
|
|
42
|
-
...getDbInjection(database),
|
|
43
|
-
body: `${tableName}Count`,
|
|
44
|
-
response: `${tableName}CountResponse200`,
|
|
45
|
-
...hook
|
|
46
|
-
});
|
|
47
|
-
|
|
48
|
-
// source/modules/elysia/crud/operations/delete.ts
|
|
49
|
-
import { Elysia as Elysia2 } from "elysia";
|
|
50
|
-
var batchDelete = (database, tableName, {
|
|
51
|
-
hook,
|
|
52
|
-
method = "DELETE",
|
|
53
|
-
path = "/"
|
|
54
|
-
}) => new Elysia2({
|
|
55
|
-
name: `delete[${tableName}]`
|
|
56
|
-
}).use(dbResolver("database:")).route(method, path, async (ctx) => {
|
|
57
|
-
const db = ctx.dynamicDB || ctx.staticDB;
|
|
58
|
-
const body = ctx.body;
|
|
59
|
-
const selectedFields = body.queryOptions?.selectedFields ?? "*";
|
|
60
|
-
const data = await db.getRepository(tableName).delete({
|
|
61
|
-
filters: body.queryOptions.filters,
|
|
62
|
-
selectedFields,
|
|
63
|
-
throwIfNoResult: true
|
|
64
|
-
});
|
|
65
|
-
return {
|
|
66
|
-
message: CRUD_SUCCESS_KEYS.DELETE_RESPONSE,
|
|
67
|
-
content: data
|
|
68
|
-
};
|
|
69
|
-
}, {
|
|
70
|
-
detail: {
|
|
71
|
-
summary: "Delete",
|
|
72
|
-
description: `Delete ${tableName} records based on query options.`
|
|
73
|
-
},
|
|
74
|
-
...getDbInjection(database),
|
|
75
|
-
body: `${tableName}Delete`,
|
|
76
|
-
response: `${tableName}Response200`,
|
|
77
|
-
...hook
|
|
78
|
-
});
|
|
79
|
-
|
|
80
|
-
// source/modules/elysia/crud/operations/deleteOne.ts
|
|
81
|
-
import { Elysia as Elysia3 } from "elysia";
|
|
82
|
-
var deleteOne = (database, tableName, {
|
|
83
|
-
hook,
|
|
84
|
-
method = "DELETE",
|
|
85
|
-
path = "/:id"
|
|
86
|
-
}) => new Elysia3({
|
|
87
|
-
name: `deleteOne[${tableName}]`
|
|
88
|
-
}).use(dbResolver("database:")).route(method, path, async (ctx) => {
|
|
89
|
-
const db = ctx.dynamicDB || ctx.staticDB;
|
|
90
|
-
const { id } = ctx.params;
|
|
91
|
-
const [primaryKey] = db.getTable(tableName).primaryKey;
|
|
92
|
-
const data = await db.getRepository(tableName).delete({
|
|
93
|
-
selectedFields: "*",
|
|
94
|
-
filters: {
|
|
95
|
-
[primaryKey]: id
|
|
96
|
-
},
|
|
97
|
-
throwIfNoResult: {
|
|
98
|
-
httpStatusCode: "NOT_FOUND",
|
|
99
|
-
message: `Record with id ${id} not found in ${tableName}`
|
|
100
|
-
}
|
|
101
|
-
});
|
|
102
|
-
return {
|
|
103
|
-
message: CRUD_SUCCESS_KEYS.DELETE_ONE_RESPONSE,
|
|
104
|
-
content: data
|
|
105
|
-
};
|
|
106
|
-
}, {
|
|
107
|
-
detail: {
|
|
108
|
-
summary: "Delete One",
|
|
109
|
-
description: `Delete a single ${tableName} record by its primary key.`
|
|
110
|
-
},
|
|
111
|
-
...getDbInjection(database),
|
|
112
|
-
params: `${tableName}IdParam`,
|
|
113
|
-
response: `${tableName}Response200`,
|
|
114
|
-
...hook
|
|
115
|
-
});
|
|
116
|
-
|
|
117
|
-
// source/modules/elysia/crud/operations/find.ts
|
|
118
|
-
import { Elysia as Elysia4 } from "elysia";
|
|
119
|
-
var find = (database, tableName, {
|
|
120
|
-
hook,
|
|
121
|
-
method = "POST",
|
|
122
|
-
path = "/find"
|
|
123
|
-
}) => new Elysia4({
|
|
124
|
-
name: `find[${tableName}]`
|
|
125
|
-
}).use(dbResolver("database:")).route(method, path, async (ctx) => {
|
|
126
|
-
const db = ctx.dynamicDB || ctx.staticDB;
|
|
127
|
-
const body = ctx.body;
|
|
128
|
-
const data = await db.getRepository(tableName).find({
|
|
129
|
-
...body?.queryOptions || {},
|
|
130
|
-
throwIfNoResult: false
|
|
131
|
-
});
|
|
132
|
-
return {
|
|
133
|
-
message: CRUD_SUCCESS_KEYS.FIND_RESPONSE,
|
|
134
|
-
content: data
|
|
135
|
-
};
|
|
136
|
-
}, {
|
|
137
|
-
detail: {
|
|
138
|
-
summary: "Find",
|
|
139
|
-
description: `Find ${tableName} records based on query options.`
|
|
140
|
-
},
|
|
141
|
-
...getDbInjection(database),
|
|
142
|
-
body: `${tableName}Find`,
|
|
143
|
-
response: `${tableName}Response200`,
|
|
144
|
-
...hook
|
|
145
|
-
});
|
|
146
|
-
|
|
147
|
-
// source/modules/elysia/crud/operations/findOne.ts
|
|
148
|
-
import { Elysia as Elysia5 } from "elysia";
|
|
149
|
-
var findOne = (database, tableName, {
|
|
150
|
-
hook,
|
|
151
|
-
method = "GET",
|
|
152
|
-
path = "/:id"
|
|
153
|
-
}) => new Elysia5({
|
|
154
|
-
name: `findOne[${tableName}]`
|
|
155
|
-
}).use(dbResolver("database:")).route(method, path, async (ctx) => {
|
|
156
|
-
const db = ctx.dynamicDB || ctx.staticDB;
|
|
157
|
-
const { id } = ctx.params;
|
|
158
|
-
const [primaryKey] = db.getTable(tableName).primaryKey;
|
|
159
|
-
const data = await db.getRepository(tableName).find({
|
|
160
|
-
filters: {
|
|
161
|
-
[primaryKey]: id
|
|
162
|
-
},
|
|
163
|
-
throwIfNoResult: {
|
|
164
|
-
httpStatusCode: "NOT_FOUND",
|
|
165
|
-
message: `Record with id ${id} not found in ${tableName}`
|
|
166
|
-
}
|
|
167
|
-
});
|
|
168
|
-
return {
|
|
169
|
-
message: CRUD_SUCCESS_KEYS.FIND_ONE_RESPONSE,
|
|
170
|
-
content: data
|
|
171
|
-
};
|
|
172
|
-
}, {
|
|
173
|
-
detail: {
|
|
174
|
-
summary: "Find One",
|
|
175
|
-
description: `Find a single ${tableName} record by its primary key.`
|
|
176
|
-
},
|
|
177
|
-
...getDbInjection(database),
|
|
178
|
-
params: `${tableName}IdParam`,
|
|
179
|
-
response: `${tableName}Response200`,
|
|
180
|
-
...hook
|
|
181
|
-
});
|
|
182
|
-
|
|
183
|
-
// source/modules/elysia/crud/operations/insert.ts
|
|
184
|
-
import { Elysia as Elysia6 } from "elysia";
|
|
185
|
-
var insert = (database, tableName, {
|
|
186
|
-
hook,
|
|
187
|
-
method = "POST",
|
|
188
|
-
path = "/"
|
|
189
|
-
}) => new Elysia6({
|
|
190
|
-
name: `insert[${tableName}]`
|
|
191
|
-
}).use(dbResolver("database:")).route(method, path, async (ctx) => {
|
|
192
|
-
const db = ctx.dynamicDB || ctx.staticDB;
|
|
193
|
-
const body = ctx.body;
|
|
194
|
-
const selectedFields = body.queryOptions?.selectedFields ?? "*";
|
|
195
|
-
const data = await db.getRepository(tableName).insert(body.data, {
|
|
196
|
-
selectedFields,
|
|
197
|
-
throwIfNoResult: true
|
|
198
|
-
});
|
|
199
|
-
return {
|
|
200
|
-
message: CRUD_SUCCESS_KEYS.INSERT_RESPONSE,
|
|
201
|
-
content: data
|
|
202
|
-
};
|
|
203
|
-
}, {
|
|
204
|
-
detail: {
|
|
205
|
-
summary: "Insert",
|
|
206
|
-
description: `Insert one or more records into the ${tableName} table.`
|
|
207
|
-
},
|
|
208
|
-
...getDbInjection(database),
|
|
209
|
-
body: `${tableName}Insert`,
|
|
210
|
-
response: `${tableName}Response200`,
|
|
211
|
-
...hook
|
|
212
|
-
});
|
|
213
|
-
|
|
214
|
-
// source/modules/elysia/crud/operations/update.ts
|
|
215
|
-
import { Elysia as Elysia7 } from "elysia";
|
|
216
|
-
var update = (database, tableName, {
|
|
217
|
-
hook,
|
|
218
|
-
method = "PATCH",
|
|
219
|
-
path = "/"
|
|
220
|
-
}) => new Elysia7({
|
|
221
|
-
name: `update[${tableName}]`
|
|
222
|
-
}).use(dbResolver("database:")).route(method, path, async (ctx) => {
|
|
223
|
-
const db = ctx.dynamicDB || ctx.staticDB;
|
|
224
|
-
const body = ctx.body;
|
|
225
|
-
const data = await db.getRepository(tableName).update(body.data, {
|
|
226
|
-
filters: body.queryOptions.filters,
|
|
227
|
-
selectedFields: body.queryOptions.selectedFields ?? "*",
|
|
228
|
-
throwIfNoResult: true
|
|
229
|
-
});
|
|
230
|
-
return {
|
|
231
|
-
message: CRUD_SUCCESS_KEYS.UPDATE_RESPONSE,
|
|
232
|
-
content: data
|
|
233
|
-
};
|
|
234
|
-
}, {
|
|
235
|
-
detail: {
|
|
236
|
-
summary: "Update",
|
|
237
|
-
description: `Update one or more ${tableName} records based on query options.`
|
|
238
|
-
},
|
|
239
|
-
...getDbInjection(database),
|
|
240
|
-
body: `${tableName}Update`,
|
|
241
|
-
response: `${tableName}Response200`,
|
|
242
|
-
...hook
|
|
243
|
-
});
|
|
244
|
-
|
|
245
|
-
// source/modules/elysia/crud/operations/updateOne.ts
|
|
246
|
-
import { Elysia as Elysia8 } from "elysia";
|
|
247
|
-
var updateOne = (database, tableName, {
|
|
248
|
-
hook,
|
|
249
|
-
method = "PATCH",
|
|
250
|
-
path = "/:id"
|
|
251
|
-
}) => new Elysia8({
|
|
252
|
-
name: `updateOne[${tableName}]`
|
|
253
|
-
}).use(dbResolver("database:")).route(method, path, async (ctx) => {
|
|
254
|
-
const db = ctx.dynamicDB || ctx.staticDB;
|
|
255
|
-
const { id } = ctx.params;
|
|
256
|
-
const body = ctx.body;
|
|
257
|
-
const [primaryKey] = db.getTable(tableName).primaryKey;
|
|
258
|
-
const data = await db.getRepository(tableName).update(body.data, {
|
|
259
|
-
selectedFields: "*",
|
|
260
|
-
filters: {
|
|
261
|
-
[primaryKey]: id
|
|
262
|
-
},
|
|
263
|
-
throwIfNoResult: {
|
|
264
|
-
httpStatusCode: "NOT_FOUND",
|
|
265
|
-
message: `Record with id ${id} not found in ${tableName}`
|
|
266
|
-
}
|
|
267
|
-
});
|
|
268
|
-
return {
|
|
269
|
-
message: CRUD_SUCCESS_KEYS.UPDATE_ONE_RESPONSE,
|
|
270
|
-
content: data
|
|
271
|
-
};
|
|
272
|
-
}, {
|
|
273
|
-
detail: {
|
|
274
|
-
summary: "Update Single Record",
|
|
275
|
-
description: `Update a single record in the ${tableName} table by its primary key.`
|
|
276
|
-
},
|
|
277
|
-
...getDbInjection(database),
|
|
278
|
-
params: `${tableName}IdParam`,
|
|
279
|
-
body: `${tableName}UpdateOne`,
|
|
280
|
-
response: `${tableName}Response200`,
|
|
281
|
-
...hook
|
|
282
|
-
});
|
|
283
|
-
|
|
284
|
-
export { count, batchDelete, deleteOne, find, findOne, insert, update, updateOne };
|
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 };
|