@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.
Files changed (110) hide show
  1. package/dist/{chunk-sbpj7f3p.js → chunk-kne89z1w.js} +1 -1
  2. package/dist/{chunk-7j86h1nd.js → chunk-s53cbgkb.js} +14 -9
  3. package/dist/chunk-txazb0xn.js +27 -0
  4. package/dist/modules/database/index.js +2 -2
  5. package/dist/modules/elysia/db-resolver/index.js +50 -7
  6. package/dist/modules/repository/index.js +1 -1
  7. package/dist/modules/repository/repository.d.ts +19 -3
  8. package/dist/modules/repository/types/filter.d.ts +2 -5
  9. package/dist/modules/repository/types/global-search.d.ts +12 -0
  10. package/dist/modules/repository/types/index.d.ts +2 -1
  11. package/dist/modules/repository/types/{order-by-item.d.ts → order-by.d.ts} +3 -3
  12. package/dist/modules/repository/types/query-options.d.ts +4 -5
  13. package/dist/modules/schema-builder/build-adaptive-where-clause-schema.d.ts +17 -0
  14. package/dist/modules/schema-builder/build-count-schema.d.ts +12 -0
  15. package/dist/modules/{elysia/crud/utils/create-delete-schema.d.ts → schema-builder/build-delete-schema.d.ts} +3 -3
  16. package/dist/modules/schema-builder/build-filters-schema.d.ts +12 -0
  17. package/dist/modules/schema-builder/build-find-schema.d.ts +12 -0
  18. package/dist/modules/schema-builder/build-global-search-schema.d.ts +12 -0
  19. package/dist/modules/schema-builder/build-insert-schema.d.ts +3 -0
  20. package/dist/modules/schema-builder/build-order-by-schema.d.ts +12 -0
  21. package/dist/modules/schema-builder/build-selected-fields.d.ts +12 -0
  22. package/dist/modules/schema-builder/build-update-one-schema.d.ts +12 -0
  23. package/dist/modules/schema-builder/build-update-schema.d.ts +12 -0
  24. package/dist/modules/schema-builder/clean-schema.d.ts +2 -0
  25. package/dist/modules/schema-builder/index.d.ts +12 -0
  26. package/dist/modules/schema-builder/index.js +230 -0
  27. package/dist/modules/{elysia/crud → schema-builder}/types/count-schema.d.ts +3 -3
  28. package/dist/modules/schema-builder/types/delete-schema.d.ts +12 -0
  29. package/dist/modules/schema-builder/types/filter-schema.d.ts +12 -0
  30. package/dist/modules/schema-builder/types/find-schema.d.ts +16 -0
  31. package/dist/modules/{elysia/crud/types/q-schema.d.ts → schema-builder/types/global-search-schema.d.ts} +1 -1
  32. package/dist/modules/schema-builder/types/index.d.ts +12 -0
  33. package/dist/modules/{elysia/crud → schema-builder}/types/insert-schema.d.ts +1 -1
  34. package/dist/modules/schema-builder/types/order-by-schema.d.ts +5 -0
  35. package/dist/modules/{elysia/crud → schema-builder}/types/update-schema.d.ts +4 -4
  36. package/dist/{shared → modules/schema-builder}/utils/flatten.d.ts +1 -1
  37. package/dist/modules/schema-builder/utils/index.d.ts +2 -0
  38. package/dist/modules/schema-builder/utils/index.js +9 -0
  39. package/dist/shared/types/index.d.ts +0 -1
  40. package/dist/shared/utils/index.d.ts +0 -1
  41. package/dist/shared/utils/index.js +1 -5
  42. package/package.json +7 -9
  43. package/dist/chunk-4g0x6g4j.js +0 -365
  44. package/dist/chunk-9dzsj7f2.js +0 -23
  45. package/dist/chunk-tmvj28bq.js +0 -284
  46. package/dist/chunk-w7h898m3.js +0 -14
  47. package/dist/chunk-yzgdqb02.js +0 -53
  48. package/dist/modules/elysia/crud/crud-schema.d.ts +0 -18
  49. package/dist/modules/elysia/crud/crud.d.ts +0 -38
  50. package/dist/modules/elysia/crud/enums/crud-success-keys.d.ts +0 -10
  51. package/dist/modules/elysia/crud/enums/index.d.ts +0 -1
  52. package/dist/modules/elysia/crud/enums/index.js +0 -7
  53. package/dist/modules/elysia/crud/index.d.ts +0 -2
  54. package/dist/modules/elysia/crud/index.js +0 -153
  55. package/dist/modules/elysia/crud/operations/count.d.ts +0 -274
  56. package/dist/modules/elysia/crud/operations/delete.d.ts +0 -274
  57. package/dist/modules/elysia/crud/operations/deleteOne.d.ts +0 -274
  58. package/dist/modules/elysia/crud/operations/find.d.ts +0 -274
  59. package/dist/modules/elysia/crud/operations/findOne.d.ts +0 -274
  60. package/dist/modules/elysia/crud/operations/index.d.ts +0 -8
  61. package/dist/modules/elysia/crud/operations/index.js +0 -34
  62. package/dist/modules/elysia/crud/operations/insert.d.ts +0 -274
  63. package/dist/modules/elysia/crud/operations/update.d.ts +0 -274
  64. package/dist/modules/elysia/crud/operations/updateOne.d.ts +0 -274
  65. package/dist/modules/elysia/crud/operations/utils/get-db-injection.d.ts +0 -8
  66. package/dist/modules/elysia/crud/types/count-response-200-schema.d.ts +0 -5
  67. package/dist/modules/elysia/crud/types/crud-operation-base.d.ts +0 -4
  68. package/dist/modules/elysia/crud/types/crud-operation-count.d.ts +0 -14
  69. package/dist/modules/elysia/crud/types/crud-operation-delete-one.d.ts +0 -14
  70. package/dist/modules/elysia/crud/types/crud-operation-delete.d.ts +0 -14
  71. package/dist/modules/elysia/crud/types/crud-operation-find-one.d.ts +0 -14
  72. package/dist/modules/elysia/crud/types/crud-operation-find.d.ts +0 -14
  73. package/dist/modules/elysia/crud/types/crud-operation-insert.d.ts +0 -14
  74. package/dist/modules/elysia/crud/types/crud-operation-update-one.d.ts +0 -16
  75. package/dist/modules/elysia/crud/types/crud-operation-update.d.ts +0 -14
  76. package/dist/modules/elysia/crud/types/crud-operations.d.ts +0 -19
  77. package/dist/modules/elysia/crud/types/crud-options.d.ts +0 -44
  78. package/dist/modules/elysia/crud/types/crud-schema-models-type.d.ts +0 -12
  79. package/dist/modules/elysia/crud/types/crud-schema-operations.d.ts +0 -10
  80. package/dist/modules/elysia/crud/types/crud-schema-options.d.ts +0 -13
  81. package/dist/modules/elysia/crud/types/delete-schema.d.ts +0 -12
  82. package/dist/modules/elysia/crud/types/filter-schema.d.ts +0 -9
  83. package/dist/modules/elysia/crud/types/find-schema.d.ts +0 -16
  84. package/dist/modules/elysia/crud/types/id-param-schema.d.ts +0 -4
  85. package/dist/modules/elysia/crud/types/index.d.ts +0 -29
  86. package/dist/modules/elysia/crud/types/order-schema.d.ts +0 -11
  87. package/dist/modules/elysia/crud/types/properties-schema.d.ts +0 -9
  88. package/dist/modules/elysia/crud/types/response-200-schema.d.ts +0 -11
  89. package/dist/modules/elysia/crud/utils/create-adaptive-where-clause-schema.d.ts +0 -17
  90. package/dist/modules/elysia/crud/utils/create-count-response-200-schema.d.ts +0 -8
  91. package/dist/modules/elysia/crud/utils/create-count-schema.d.ts +0 -12
  92. package/dist/modules/elysia/crud/utils/create-filters-schema.d.ts +0 -14
  93. package/dist/modules/elysia/crud/utils/create-find-schema.d.ts +0 -12
  94. package/dist/modules/elysia/crud/utils/create-id-param-schema.d.ts +0 -2
  95. package/dist/modules/elysia/crud/utils/create-insert-schema.d.ts +0 -3
  96. package/dist/modules/elysia/crud/utils/create-order-schema.d.ts +0 -12
  97. package/dist/modules/elysia/crud/utils/create-properties-schema.d.ts +0 -12
  98. package/dist/modules/elysia/crud/utils/create-q-schema.d.ts +0 -12
  99. package/dist/modules/elysia/crud/utils/create-response-200-schema.d.ts +0 -3
  100. package/dist/modules/elysia/crud/utils/create-selected-fields-schema.d.ts +0 -12
  101. package/dist/modules/elysia/crud/utils/create-update-one-schema.d.ts +0 -3
  102. package/dist/modules/elysia/crud/utils/create-update-schema.d.ts +0 -3
  103. package/dist/modules/elysia/crud/utils/index.d.ts +0 -16
  104. package/dist/modules/elysia/crud/utils/index.js +0 -41
  105. /package/dist/modules/{elysia/crud → schema-builder}/types/adaptive-where-clause-schema.d.ts +0 -0
  106. /package/dist/modules/{elysia/crud → schema-builder}/types/index.js +0 -0
  107. /package/dist/modules/{elysia/crud/types/selected-field-schema.d.ts → schema-builder/types/selected-fields-schema.d.ts} +0 -0
  108. /package/dist/{shared → modules/schema-builder}/types/tflatten.d.ts +0 -0
  109. /package/dist/modules/{elysia/crud → schema-builder}/types/update-one-schema.d.ts +0 -0
  110. /package/dist/modules/{elysia/crud → schema-builder}/utils/is-date-from-elysia-typebox.d.ts +0 -0
@@ -1,7 +1,7 @@
1
1
  // @bun
2
2
  import {
3
3
  Repository
4
- } from "./chunk-7j86h1nd.js";
4
+ } from "./chunk-s53cbgkb.js";
5
5
  import {
6
6
  TypedEventEmitter
7
7
  } from "./chunk-mvrxngm7.js";
@@ -139,21 +139,20 @@ class Repository {
139
139
  const processing = (query2, search2) => {
140
140
  for (const key in search2) {
141
141
  const prop = search2[key];
142
- if (this._filterIsAdaptiveWhereClause(prop)) {
142
+ if (this._isAdaptiveWhereClause(prop)) {
143
143
  for (const operator in prop)
144
144
  if (operator in _operators && prop[operator] !== undefined)
145
145
  _operators[operator](query2, key, prop[operator]);
146
- } else if (key === "$q" && prop !== null && (typeof prop === "string" || typeof prop === "number")) {
146
+ } else if (key === "$q" && this._isGlobalSearchPrimitive(prop)) {
147
147
  for (const field of this._table.fields)
148
148
  if (prop)
149
149
  query2.orWhere(field, "like", `%${prop}%`);
150
- } else if (key === "$q" && prop !== null && typeof prop === "object" && "selectedFields" in prop && "value" in prop) {
151
- const { selectedFields, value } = prop;
152
- if (Array.isArray(selectedFields))
153
- for (const field of selectedFields)
154
- query2.orWhere(field, "like", `%${value}%`);
150
+ } else if (key === "$q" && this._isGlobalSearchObject(prop)) {
151
+ if (Array.isArray(prop.selectedFields))
152
+ for (const field of prop.selectedFields)
153
+ query2.orWhere(field, "like", `%${prop.value}%`);
155
154
  else
156
- query2.orWhere(selectedFields, "like", `%${value}%`);
155
+ query2.orWhere(prop.selectedFields, "like", `%${prop.value}%`);
157
156
  } else {
158
157
  if (prop !== null && typeof prop === "object" && Object.keys(prop).length === 0)
159
158
  continue;
@@ -196,9 +195,15 @@ class Repository {
196
195
  error
197
196
  });
198
197
  }
199
- _filterIsAdaptiveWhereClause(data) {
198
+ _isAdaptiveWhereClause(data) {
200
199
  return Boolean(data && typeof data === "object" && !Array.isArray(data) && Object.keys(data).some((key) => _validOperatorKeys.has(key)));
201
200
  }
201
+ _isGlobalSearchObject(data) {
202
+ return Boolean(data && typeof data === "object" && "selectedFields" in data && "value" in data);
203
+ }
204
+ _isGlobalSearchPrimitive(data) {
205
+ return data !== null && (typeof data === "string" || typeof data === "number");
206
+ }
202
207
  async _executeQuery(query, throwIfNoResult = false) {
203
208
  try {
204
209
  const result = await query;
@@ -0,0 +1,27 @@
1
+ // @bun
2
+ // source/modules/schema-builder/utils/is-date-from-elysia-typebox.ts
3
+ import { KindGuard } from "@sinclair/typebox";
4
+ 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));
5
+
6
+ // source/modules/schema-builder/utils/flatten.ts
7
+ import { KindGuard as KindGuard2 } from "@sinclair/typebox";
8
+ import { t } from "elysia";
9
+ var _flattenInto = (type, result) => {
10
+ if (KindGuard2.IsUnion(type))
11
+ for (const subType of type.anyOf)
12
+ _flattenInto(subType, result);
13
+ else
14
+ result.push(type);
15
+ };
16
+ var flatten = (type) => {
17
+ if (!KindGuard2.IsUnion(type))
18
+ return type;
19
+ const isAlreadyFlat = type.anyOf.every((subType) => !KindGuard2.IsUnion(subType));
20
+ if (isAlreadyFlat)
21
+ return type;
22
+ const result = [];
23
+ _flattenInto(type, result);
24
+ return t.Union(result);
25
+ };
26
+
27
+ export { isDateFromElysiaTypeBox, flatten };
@@ -2,8 +2,8 @@
2
2
  import {
3
3
  MSSQL,
4
4
  Table
5
- } from "../../chunk-sbpj7f3p.js";
6
- import"../../chunk-7j86h1nd.js";
5
+ } from "../../chunk-kne89z1w.js";
6
+ import"../../chunk-s53cbgkb.js";
7
7
  import"../../chunk-grfyngq0.js";
8
8
  import"../../chunk-mvrxngm7.js";
9
9
  import"../../chunk-zv4ta4fb.js";
@@ -1,18 +1,61 @@
1
1
  // @bun
2
2
  import {
3
- dbResolver
4
- } from "../../../chunk-yzgdqb02.js";
5
- import"../../../chunk-r7yr9p57.js";
3
+ SingletonManager
4
+ } from "../../../chunk-r7yr9p57.js";
6
5
  import"../../../chunk-y5dtkmnp.js";
7
- import"../../../chunk-ayyrgqyv.js";
8
- import"../../../chunk-sbpj7f3p.js";
9
- import"../../../chunk-7j86h1nd.js";
6
+ import {
7
+ DB_RESOLVER_ERROR_KEYS
8
+ } from "../../../chunk-ayyrgqyv.js";
9
+ import {
10
+ MSSQL
11
+ } from "../../../chunk-kne89z1w.js";
12
+ import"../../../chunk-s53cbgkb.js";
10
13
  import"../../../chunk-grfyngq0.js";
11
14
  import"../../../chunk-mvrxngm7.js";
12
15
  import"../../../chunk-zv4ta4fb.js";
13
16
  import"../../../chunk-sqts8vyk.js";
14
- import"../../../chunk-jz3wd472.js";
17
+ import {
18
+ InternalError
19
+ } from "../../../chunk-jz3wd472.js";
15
20
  import"../../../chunk-642xajvx.js";
21
+
22
+ // source/modules/elysia/db-resolver/db-resolver.ts
23
+ import { Elysia, t } from "elysia";
24
+ var dbResolver = (prefixDatabaseName = "") => new Elysia().model({
25
+ dbResolverHeader: t.Object({
26
+ "database-using": t.String()
27
+ })
28
+ }).macro({
29
+ injectDynamicDB(config) {
30
+ return {
31
+ headers: "dbResolverHeader",
32
+ async resolve({ headers }) {
33
+ const databaseName = headers["database-using"];
34
+ if (!SingletonManager.has(`${prefixDatabaseName}${databaseName}`)) {
35
+ SingletonManager.register(`${prefixDatabaseName}${databaseName}`, new MSSQL({
36
+ ...config,
37
+ databaseName
38
+ }));
39
+ await SingletonManager.get(`${prefixDatabaseName}${databaseName}`).connect();
40
+ }
41
+ return {
42
+ dynamicDB: SingletonManager.get(`${prefixDatabaseName}${databaseName}`)
43
+ };
44
+ }
45
+ };
46
+ },
47
+ injectStaticDB(databaseName) {
48
+ return {
49
+ resolve() {
50
+ if (!SingletonManager.has(`${prefixDatabaseName}${databaseName}`))
51
+ throw new InternalError(DB_RESOLVER_ERROR_KEYS.DB_RESOLVER_STATIC_DB_NOT_FOUND, `${prefixDatabaseName}${databaseName}`);
52
+ return {
53
+ staticDB: SingletonManager.get(`${prefixDatabaseName}${databaseName}`)
54
+ };
55
+ }
56
+ };
57
+ }
58
+ });
16
59
  export {
17
60
  dbResolver
18
61
  };
@@ -1,7 +1,7 @@
1
1
  // @bun
2
2
  import {
3
3
  Repository
4
- } from "../../chunk-7j86h1nd.js";
4
+ } from "../../chunk-s53cbgkb.js";
5
5
  import"../../chunk-grfyngq0.js";
6
6
  import"../../chunk-zv4ta4fb.js";
7
7
  import"../../chunk-sqts8vyk.js";
@@ -2,7 +2,7 @@ import type { Knex } from 'knex';
2
2
  import type { Table } from '../../modules/database/table';
3
3
  import type { StreamWithAsyncIterable } from '../../shared/types/stream-with-async-iterable';
4
4
  import type { Filter } from './types/filter';
5
- import type { OrderByItem } from './types/order-by-item';
5
+ import type { OrderBy } from './types/order-by';
6
6
  import type { QueryOptions } from './types/query-options';
7
7
  import type { QueryOptionsExtendPagination } from './types/query-options-extend-pagination';
8
8
  import type { QueryOptionsExtendStream } from './types/query-options-extend-stream';
@@ -373,7 +373,7 @@ export declare class Repository<TModel = Record<string, unknown>> {
373
373
  * @param query - The Knex.js query builder to apply the order by criteria to.
374
374
  * @param orderBy - The order by criteria. Can be a single item or an array of items.
375
375
  */
376
- protected _applyOrderBy<KModel>(query: Knex.QueryBuilder, orderBy: OrderByItem<KModel> | OrderByItem<KModel>[] | undefined): void;
376
+ protected _applyOrderBy<KModel>(query: Knex.QueryBuilder, orderBy: OrderBy<KModel> | OrderBy<KModel>[] | undefined): void;
377
377
  /**
378
378
  * Applies query options such as filters, orderBy, and transaction to a Knex.js query builder.
379
379
  *
@@ -402,7 +402,23 @@ export declare class Repository<TModel = Record<string, unknown>> {
402
402
  *
403
403
  * @returns True if the data is a WhereClause, false otherwise.
404
404
  */
405
- private _filterIsAdaptiveWhereClause;
405
+ private _isAdaptiveWhereClause;
406
+ /**
407
+ * Determines if the provided data is a QuickSearch object (excluding primitive types).
408
+ *
409
+ * @param data - The data to check.
410
+ *
411
+ * @returns True if the data is a QuickSearch object, false otherwise.
412
+ */
413
+ private _isGlobalSearchObject;
414
+ /**
415
+ * Determines if the provided data is a QuickSearch primitive (string or number).
416
+ *
417
+ * @param data - The data to check.
418
+ *
419
+ * @returns True if the data is a string or number, false otherwise.
420
+ */
421
+ private _isGlobalSearchPrimitive;
406
422
  /**
407
423
  * Executes a Knex.js query and returns the result. This method provides centralized
408
424
  * error handling and supports the option to throw an error if no records are found.
@@ -1,5 +1,5 @@
1
1
  import type { AdaptiveWhereClause } from './adaptive-where-clause';
2
- import type { SelectedFields } from './selected-fields';
2
+ import type { GlobalSearch } from './global-search';
3
3
  /**
4
4
  * Defines an filter model using either plain partials of the model TModel or a {@link AdaptiveWhereClause} filter for more dynamic querying.
5
5
  *
@@ -34,10 +34,7 @@ import type { SelectedFields } from './selected-fields';
34
34
  * ```
35
35
  */
36
36
  export type Filter<TModel> = {
37
- $q?: string | number | {
38
- selectedFields: SelectedFields<TModel>;
39
- value: string | number;
40
- };
37
+ $q?: GlobalSearch<TModel>;
41
38
  } & {
42
39
  [Key in keyof TModel]?: TModel[Key] | Partial<AdaptiveWhereClause<TModel[Key]>>;
43
40
  };
@@ -0,0 +1,12 @@
1
+ import type { SelectedFields } from './selected-fields';
2
+ /**
3
+ * Defines a global search filter that can search across one or multiple fields.
4
+ *
5
+ * @template TModel - The model type to search against.
6
+ */
7
+ export type GlobalSearch<TModel> = string | number | {
8
+ /** Fields to search in. */
9
+ selectedFields: SelectedFields<TModel>;
10
+ /** The value to search for. */
11
+ value: string | number;
12
+ };
@@ -1,8 +1,9 @@
1
1
  export type { AdaptiveWhereClause } from './adaptive-where-clause';
2
2
  export type { Filter } from './filter';
3
- export type { OrderByItem } from './order-by-item';
3
+ export type { OrderBy } from './order-by';
4
4
  export type { QueryOptions } from './query-options';
5
5
  export type { QueryOptionsExtendPagination } from './query-options-extend-pagination';
6
6
  export type { QueryOptionsExtendStream } from './query-options-extend-stream';
7
+ export type { GlobalSearch } from './global-search';
7
8
  export type { SelectedFields } from './selected-fields';
8
9
  export type { Transaction } from './transaction';
@@ -16,7 +16,7 @@
16
16
  * @example
17
17
  * Order by a single field ascending
18
18
  * ```ts
19
- * const orderBy1: OrderByItem<User> = {
19
+ * const orderBy1: OrderBy<User> = {
20
20
  * selectedField: 'id',
21
21
  * direction: 'asc'
22
22
  * };
@@ -24,13 +24,13 @@
24
24
  * @example
25
25
  * Order by a single field descending
26
26
  * ```ts
27
- * const orderBy2: OrderByItem<User> = {
27
+ * const orderBy2: OrderBy<User> = {
28
28
  * selectedField: 'name',
29
29
  * direction: 'desc'
30
30
  * };
31
31
  * ```
32
32
  */
33
- export interface OrderByItem<TModel> {
33
+ export interface OrderBy<TModel> {
34
34
  /**
35
35
  * The field to order by. Must be a key of the model or a string.
36
36
  */
@@ -1,6 +1,6 @@
1
1
  import type { HTTP_STATUS_CODES } from '../../../errors/enums/http-status-codes';
2
2
  import type { Filter } from './filter';
3
- import type { OrderByItem } from './order-by-item';
3
+ import type { OrderBy } from './order-by';
4
4
  import type { SelectedFields } from './selected-fields';
5
5
  import type { Transaction } from './transaction';
6
6
  /**
@@ -10,21 +10,20 @@ import type { Transaction } from './transaction';
10
10
  */
11
11
  export interface QueryOptions<TModel> {
12
12
  /**
13
- * The fields to select in the query. If not provided, all fields are selected. ({@link SelectedFields})
13
+ * The fields to select in the query. If not provided, all fields are selected.
14
14
  *
15
15
  * @defaultValue If not provided, all fields are selected.
16
16
  */
17
17
  readonly selectedFields?: SelectedFields<NoInfer<TModel>>;
18
18
  /**
19
19
  * The filters options to apply to the query. Can be a single object or an array of objects.
20
- * @see {@link Filter}
21
20
  */
22
21
  readonly filters?: Filter<NoInfer<TModel>> | Filter<NoInfer<TModel>>[];
23
22
  /**
24
- * Order the results by a specific column and direction. ({@link OrderByItem})
23
+ * Order the results by a specific column and direction.
25
24
  * @defaultValue If not provided, the primary key of the model is used in ascending order.
26
25
  */
27
- readonly orderBy?: OrderByItem<NoInfer<TModel>> | OrderByItem<NoInfer<TModel>>[];
26
+ readonly orderBy?: OrderBy<NoInfer<TModel>> | OrderBy<NoInfer<TModel>>[];
28
27
  /**
29
28
  * Whether to throw an error if the query does not return any result.
30
29
  * @defaultValue false
@@ -0,0 +1,17 @@
1
+ import { type TSchema } from '@sinclair/typebox/type';
2
+ import type { AdaptiveWhereClauseSchema } from './types/adaptive-where-clause-schema';
3
+ /**
4
+ * Build an AdaptiveWhereClauseSchema with appropriate operators based on the field type
5
+ *
6
+ * Generates different sets of query operators depending on the schema type:
7
+ * - All types: $eq, $neq, $isNull
8
+ * - String/Number/Date types: additional $in, $nin, $like, $nlike operators
9
+ * - Number/Date types: additional comparison operators ($lt, $lte, $gt, $gte, $between, $nbetween)
10
+ *
11
+ * @template TFieldSchema - The source object schema type.
12
+ *
13
+ * @param schema - The field schema to build the AdaptiveWhereClauseSchema for
14
+ *
15
+ * @returns An AdaptiveWhereClauseSchema
16
+ */
17
+ export declare const buildAdaptiveWhereClauseSchema: <const TFieldSchema extends TSchema>(schema: TFieldSchema) => AdaptiveWhereClauseSchema<TFieldSchema>;
@@ -0,0 +1,12 @@
1
+ import type { TObject } from '@sinclair/typebox/type';
2
+ import type { CountSchema } from './types/count-schema';
3
+ /**
4
+ * Build a CountSchema
5
+ *
6
+ * @template TSourceSchema - The TypeBox object schema to create count capabilities for
7
+ *
8
+ * @param schema - The source object schema type.
9
+ *
10
+ * @returns A CountSchema based on the provided schema
11
+ */
12
+ export declare const buildCountSchema: <const TSourceCountSchema extends TObject>(schema: TSourceCountSchema) => CountSchema<TSourceCountSchema>;
@@ -1,7 +1,7 @@
1
1
  import type { TObject } from '@sinclair/typebox/type';
2
- import type { DeleteSchema } from '../../../../modules/elysia/crud/types/delete-schema';
2
+ import type { DeleteSchema } from './types/delete-schema';
3
3
  /**
4
- * Creates a delete schema for deleting records with optional selected fields and required filtering.
4
+ * Creates a DeleteSchema.
5
5
  *
6
6
  * @template TSourceSchema - The TypeBox object schema to create delete capabilities for
7
7
  *
@@ -9,4 +9,4 @@ import type { DeleteSchema } from '../../../../modules/elysia/crud/types/delete-
9
9
  *
10
10
  * @returns A TypeBox object schema containing queryOptions with selected fields and filters for delete operations
11
11
  */
12
- export declare const createDeleteSchema: <TSourceDeleteSchema extends TObject>(schema: TSourceDeleteSchema) => DeleteSchema<TSourceDeleteSchema>;
12
+ export declare const buildDeleteSchema: <TSourceDeleteSchema extends TObject>(schema: TSourceDeleteSchema) => DeleteSchema<TSourceDeleteSchema>;
@@ -0,0 +1,12 @@
1
+ import type { TObject } from '@sinclair/typebox/type';
2
+ import type { FilterSchema } from './types/filter-schema';
3
+ /**
4
+ * Build a FilterSchema for the given source object schema.
5
+ *
6
+ * @template TSourceSchema - The source object schema type.
7
+ *
8
+ * @param schema - The source object schema to build the FilterSchema for
9
+ *
10
+ * @returns A FilterSchema for the given source object schema
11
+ */
12
+ export declare const buildFilterSchema: <const TSourceSchema extends TObject>(schema: TSourceSchema) => FilterSchema<TSourceSchema>;
@@ -0,0 +1,12 @@
1
+ import type { TObject } from '@sinclair/typebox/type';
2
+ import type { FindSchema } from './types/find-schema';
3
+ /**
4
+ * Build a FindSchema.
5
+ *
6
+ * @template TSourceSchema - The source object schema type.
7
+ *
8
+ * @param schema - The base object schema to create search schemas for.
9
+ *
10
+ * @returns A TypeBox object schema for search with selected fields, order by, filters, limit, and offset
11
+ */
12
+ export declare const buildFindSchema: <TSourceFindSchema extends TObject>(schema: TSourceFindSchema) => FindSchema<TSourceFindSchema>;
@@ -0,0 +1,12 @@
1
+ import type { TObject } from '@sinclair/typebox/type';
2
+ import type { GlobalSearchSchema } from './types/global-search-schema';
3
+ /**
4
+ * Build a GlobalSearchSchema.
5
+ *
6
+ * @template TSourceSchema - The type of the source object schema
7
+ *
8
+ * @param schema - The source object schema type.
9
+ *
10
+ * @returns A GlobalSearchSchema
11
+ */
12
+ export declare const buildGlobalSearchSchema: <const TSourceSchema extends TObject>(schema: TSourceSchema) => GlobalSearchSchema<TSourceSchema>;
@@ -0,0 +1,3 @@
1
+ import type { TObject } from '@sinclair/typebox/type';
2
+ import type { InsertSchema } from './types/insert-schema';
3
+ export declare const buildInsertSchema: <TSourceInsertSchema extends TObject>(schema: TSourceInsertSchema) => InsertSchema<TSourceInsertSchema>;
@@ -0,0 +1,12 @@
1
+ import type { TObject } from '@sinclair/typebox/type';
2
+ import type { OrderBySchema } from './types/order-by-schema';
3
+ /**
4
+ * Build a OrderBySchema for the given source object schema.
5
+ *
6
+ * @template TSourceSchema - The source object schema type.
7
+ *
8
+ * @param schema - The source object schema to build the OrderBy schema for
9
+ *
10
+ * @returns A OrderBySchema for the given source object schema
11
+ */
12
+ export declare const buildOrderBySchema: <const TSourceSchema extends TObject>(schema: TSourceSchema) => OrderBySchema<TSourceSchema>;
@@ -0,0 +1,12 @@
1
+ import type { TObject } from '@sinclair/typebox/type';
2
+ import type { SelectedFieldsSchema } from './types/selected-fields-schema';
3
+ /**
4
+ * Build a SelectSchema for selected fields based on a given object schema
5
+ *
6
+ * @template TSourceSchema - The source object schema type.
7
+ *
8
+ * @param schema - The source object schema to build the SelectSchema for
9
+ *
10
+ * @returns A SelectSchema that allows selecting keys of the source schema, the wildcard '*', or an array of keys
11
+ */
12
+ export declare const buildSelectedFieldsSchema: <const TSourceSchema extends TObject>(schema: TSourceSchema) => SelectedFieldsSchema<TSourceSchema>;
@@ -0,0 +1,12 @@
1
+ import type { TObject } from '@sinclair/typebox/type';
2
+ import type { UpdateOneSchema } from './types/update-one-schema';
3
+ /**
4
+ * Builds a UpdateOneSchema.
5
+ *
6
+ * @template TSourceUpdateSchema - The source object schema to build the update schema from.
7
+ *
8
+ * @param schema - The source object schema to build the update schema from.
9
+ *
10
+ * @returns A TypeBox object schema for updating a single record.
11
+ */
12
+ export declare const buildUpdateOneSchema: <TSourceUpdateSchema extends TObject>(schema: TSourceUpdateSchema) => UpdateOneSchema<TSourceUpdateSchema>;
@@ -0,0 +1,12 @@
1
+ import type { TObject } from '@sinclair/typebox/type';
2
+ import type { UpdateSchema } from './types/update-schema';
3
+ /**
4
+ * Builds an UpdateSchema.
5
+ *
6
+ * @template TSourceUpdateSchema - The TypeBox object schema to build the update schema from.
7
+ *
8
+ * @param schema - The source object schema to build the update schema from.
9
+ *
10
+ * @returns The update
11
+ */
12
+ export declare const buildUpdateSchema: <TSourceUpdateSchema extends TObject>(schema: TSourceUpdateSchema) => UpdateSchema<TSourceUpdateSchema>;
@@ -0,0 +1,2 @@
1
+ import type { TObject } from '@sinclair/typebox';
2
+ export declare const cleanSchema: <TSourceSchema extends TObject>(schema: TSourceSchema) => TSourceSchema;
@@ -0,0 +1,12 @@
1
+ export { buildAdaptiveWhereClauseSchema } from './build-adaptive-where-clause-schema';
2
+ export { buildCountSchema } from './build-count-schema';
3
+ export { buildDeleteSchema } from './build-delete-schema';
4
+ export { buildFilterSchema } from './build-filters-schema';
5
+ export { buildFindSchema } from './build-find-schema';
6
+ export { buildGlobalSearchSchema } from './build-global-search-schema';
7
+ export { buildInsertSchema } from './build-insert-schema';
8
+ export { buildOrderBySchema } from './build-order-by-schema';
9
+ export { buildSelectedFieldsSchema } from './build-selected-fields';
10
+ export { buildUpdateOneSchema } from './build-update-one-schema';
11
+ export { buildUpdateSchema } from './build-update-schema';
12
+ export { cleanSchema } from './clean-schema';