@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.
Files changed (208) hide show
  1. package/dist/{chunk-0d0zd2yg.js → chunk-037vwvd4.js} +2 -2
  2. package/dist/{chunk-jksb9ers.js → chunk-10w8mg8e.js} +1 -1
  3. package/dist/{chunk-dre2fgj0.js → chunk-2z8amjqt.js} +1 -1
  4. package/dist/chunk-4t7sy5qt.js +10 -0
  5. package/dist/chunk-642xajvx.js +59 -0
  6. package/dist/chunk-6hs00zfd.js +13 -0
  7. package/dist/chunk-8pw0syzf.js +9 -0
  8. package/dist/{chunk-eeb7yskp.js → chunk-awphtyzp.js} +4 -4
  9. package/dist/{chunk-8tffnbpn.js → chunk-ayyrgqyv.js} +1 -1
  10. package/dist/{chunk-12qzn7jw.js → chunk-dmsev7vs.js} +1 -1
  11. package/dist/{chunk-gtn1kn0z.js → chunk-hv6g22kf.js} +4 -4
  12. package/dist/chunk-hwfebx4x.js +11 -0
  13. package/dist/chunk-j7dyc5ks.js +101 -0
  14. package/dist/chunk-jz3wd472.js +23 -0
  15. package/dist/{chunk-afd82epa.js → chunk-kne89z1w.js} +13 -13
  16. package/dist/{chunk-fs3wm3p4.js → chunk-r7yr9p57.js} +6 -6
  17. package/dist/{chunk-afyz8rg5.js → chunk-s53cbgkb.js} +28 -18
  18. package/dist/chunk-txazb0xn.js +27 -0
  19. package/dist/chunk-y5dtkmnp.js +8 -0
  20. package/dist/chunk-yrt0ffvf.js +9 -0
  21. package/dist/chunk-zn2nm5gg.js +9 -0
  22. package/dist/{chunk-7t524zqh.js → chunk-zv4ta4fb.js} +3 -3
  23. package/dist/errors/{base-error.d.ts → app-error.d.ts} +2 -1
  24. package/dist/errors/http-error.d.ts +2 -2
  25. package/dist/errors/index.d.ts +2 -1
  26. package/dist/errors/index.js +6 -4
  27. package/dist/errors/internal-error.d.ts +4 -0
  28. package/dist/modules/data/data.d.ts +5 -5
  29. package/dist/modules/data/enums/data-error-keys.d.ts +1 -1
  30. package/dist/modules/data/enums/index.js +1 -1
  31. package/dist/modules/data/index.js +3 -3
  32. package/dist/modules/database/enums/database-error-keys.d.ts +26 -26
  33. package/dist/modules/database/enums/index.js +1 -1
  34. package/dist/modules/database/enums/mssql-error-code.d.ts +23 -23
  35. package/dist/modules/database/index.js +5 -5
  36. package/dist/modules/database/mssql.d.ts +9 -9
  37. package/dist/modules/elysia/cache/cache.d.ts +1 -1
  38. package/dist/modules/elysia/cache/index.js +3 -3
  39. package/dist/modules/elysia/db-resolver/enums/db-resolver-error-keys.d.ts +1 -1
  40. package/dist/modules/elysia/db-resolver/enums/index.js +1 -1
  41. package/dist/modules/elysia/db-resolver/index.js +53 -10
  42. package/dist/modules/elysia/error/enums/error.keys.d.ts +4 -4
  43. package/dist/modules/elysia/error/enums/index.js +1 -1
  44. package/dist/modules/elysia/error/error.d.ts +5 -5
  45. package/dist/modules/elysia/error/index.js +14 -14
  46. package/dist/modules/elysia/microservice/enums/index.js +1 -1
  47. package/dist/modules/elysia/microservice/enums/microservice-success-keys.d.ts +2 -2
  48. package/dist/modules/elysia/microservice/index.js +1 -1
  49. package/dist/modules/elysia/rate-limit/enums/index.js +1 -1
  50. package/dist/modules/elysia/rate-limit/enums/rate-limit-error-keys.d.ts +1 -1
  51. package/dist/modules/elysia/rate-limit/index.js +7 -6
  52. package/dist/modules/elysia/rate-limit/rate-limit.d.ts +1 -1
  53. package/dist/modules/jwt/enums/index.js +2 -2
  54. package/dist/modules/jwt/enums/jwt-error-keys.d.ts +3 -3
  55. package/dist/modules/jwt/enums/parse-human-time-to-seconds-error-keys.d.ts +1 -1
  56. package/dist/modules/jwt/index.js +10 -12
  57. package/dist/modules/jwt/utils/index.js +3 -3
  58. package/dist/modules/jwt/utils/parse-human-time-to-seconds.d.ts +1 -1
  59. package/dist/modules/kv-store/bun-redis/index.js +25 -17
  60. package/dist/modules/kv-store/enums/index.js +1 -1
  61. package/dist/modules/kv-store/enums/kv-store-error-keys.d.ts +3 -3
  62. package/dist/modules/kv-store/ioredis/index.js +17 -17
  63. package/dist/modules/kv-store/memory/index.js +4 -98
  64. package/dist/modules/logger/enums/index.js +1 -1
  65. package/dist/modules/logger/enums/logger-error-keys.d.ts +7 -7
  66. package/dist/modules/logger/events/logger-events.d.ts +4 -4
  67. package/dist/modules/logger/index.js +91 -20
  68. package/dist/modules/logger/logger.d.ts +2 -2
  69. package/dist/modules/logger/sinks/console-logger.d.ts +1 -1
  70. package/dist/modules/logger/sinks/file-logger/enums/file-logger-error-keys.d.ts +1 -1
  71. package/dist/modules/logger/sinks/file-logger/file-logger.d.ts +3 -3
  72. package/dist/modules/logger/sinks/index.js +10 -11
  73. package/dist/modules/logger/types/logger-options.d.ts +1 -1
  74. package/dist/modules/logger/types/logger-sink.d.ts +1 -1
  75. package/dist/modules/logger/worker-logger.d.ts +1 -0
  76. package/dist/modules/mailer/enums/index.js +1 -1
  77. package/dist/modules/mailer/enums/mailer-error-keys.d.ts +3 -3
  78. package/dist/modules/mailer/index.js +6 -6
  79. package/dist/modules/mailer/smtp.d.ts +4 -4
  80. package/dist/modules/repository/index.js +4 -4
  81. package/dist/modules/repository/repository.d.ts +28 -12
  82. package/dist/modules/repository/types/filter.d.ts +2 -5
  83. package/dist/modules/repository/types/global-search.d.ts +12 -0
  84. package/dist/modules/repository/types/index.d.ts +2 -1
  85. package/dist/modules/repository/types/{order-by-item.d.ts → order-by.d.ts} +3 -3
  86. package/dist/modules/repository/types/query-options.d.ts +4 -5
  87. package/dist/modules/schema-builder/build-adaptive-where-clause-schema.d.ts +17 -0
  88. package/dist/modules/schema-builder/build-count-schema.d.ts +12 -0
  89. package/dist/modules/{elysia/crud/utils/create-delete-schema.d.ts → schema-builder/build-delete-schema.d.ts} +3 -3
  90. package/dist/modules/schema-builder/build-filters-schema.d.ts +12 -0
  91. package/dist/modules/schema-builder/build-find-schema.d.ts +12 -0
  92. package/dist/modules/schema-builder/build-global-search-schema.d.ts +12 -0
  93. package/dist/modules/schema-builder/build-insert-schema.d.ts +3 -0
  94. package/dist/modules/schema-builder/build-order-by-schema.d.ts +12 -0
  95. package/dist/modules/schema-builder/build-selected-fields.d.ts +12 -0
  96. package/dist/modules/schema-builder/build-update-one-schema.d.ts +12 -0
  97. package/dist/modules/schema-builder/build-update-schema.d.ts +12 -0
  98. package/dist/modules/schema-builder/clean-schema.d.ts +2 -0
  99. package/dist/modules/schema-builder/index.d.ts +12 -0
  100. package/dist/modules/schema-builder/index.js +230 -0
  101. package/dist/modules/{elysia/crud → schema-builder}/types/count-schema.d.ts +3 -3
  102. package/dist/modules/schema-builder/types/delete-schema.d.ts +12 -0
  103. package/dist/modules/schema-builder/types/filter-schema.d.ts +12 -0
  104. package/dist/modules/schema-builder/types/find-schema.d.ts +16 -0
  105. package/dist/modules/{elysia/crud/types/q-schema.d.ts → schema-builder/types/global-search-schema.d.ts} +1 -1
  106. package/dist/modules/schema-builder/types/index.d.ts +12 -0
  107. package/dist/modules/{elysia/crud → schema-builder}/types/insert-schema.d.ts +1 -1
  108. package/dist/modules/schema-builder/types/order-by-schema.d.ts +5 -0
  109. package/dist/modules/{elysia/crud → schema-builder}/types/update-schema.d.ts +4 -4
  110. package/dist/{shared → modules/schema-builder}/utils/flatten.d.ts +1 -1
  111. package/dist/modules/schema-builder/utils/index.d.ts +2 -0
  112. package/dist/modules/schema-builder/utils/index.js +9 -0
  113. package/dist/modules/singleton-manager/enums/index.js +1 -1
  114. package/dist/modules/singleton-manager/enums/singleton-manager-error-keys.d.ts +2 -2
  115. package/dist/modules/singleton-manager/index.js +3 -3
  116. package/dist/modules/singleton-manager/singleton-manager.d.ts +3 -3
  117. package/dist/modules/totp/enums/index.js +1 -1
  118. package/dist/modules/totp/enums/totp-error-keys.d.ts +5 -5
  119. package/dist/modules/totp/index.js +6 -6
  120. package/dist/modules/totp/otp-auth-uri.d.ts +1 -1
  121. package/dist/modules/totp/utils/base32.d.ts +1 -1
  122. package/dist/modules/totp/utils/generate-secret-bytes.d.ts +1 -1
  123. package/dist/modules/totp/utils/index.js +5 -5
  124. package/dist/shared/types/index.d.ts +0 -1
  125. package/dist/shared/utils/env.d.ts +1 -1
  126. package/dist/shared/utils/index.d.ts +0 -1
  127. package/dist/shared/utils/index.js +4 -8
  128. package/package.json +19 -22
  129. package/dist/chunk-441xs5k1.js +0 -53
  130. package/dist/chunk-4v86f7gp.js +0 -59
  131. package/dist/chunk-6w9ja96e.js +0 -9
  132. package/dist/chunk-9cgzhc50.js +0 -15
  133. package/dist/chunk-9d3zvgp6.js +0 -9
  134. package/dist/chunk-9dzsj7f2.js +0 -23
  135. package/dist/chunk-9r5anep5.js +0 -11
  136. package/dist/chunk-p14h6jfs.js +0 -365
  137. package/dist/chunk-pjv1ekwr.js +0 -284
  138. package/dist/chunk-rz5p4j3p.js +0 -13
  139. package/dist/chunk-spnh9dzk.js +0 -10
  140. package/dist/chunk-w7h898m3.js +0 -14
  141. package/dist/chunk-xhhj1gvj.js +0 -9
  142. package/dist/chunk-z0ct35ft.js +0 -8
  143. package/dist/errors/utils/index.d.ts +0 -1
  144. package/dist/errors/utils/index.js +0 -16
  145. package/dist/errors/utils/is-nowarajs-error.ts.d.ts +0 -4
  146. package/dist/modules/elysia/crud/crud-schema.d.ts +0 -18
  147. package/dist/modules/elysia/crud/crud.d.ts +0 -38
  148. package/dist/modules/elysia/crud/enums/crud-success-keys.d.ts +0 -10
  149. package/dist/modules/elysia/crud/enums/index.d.ts +0 -1
  150. package/dist/modules/elysia/crud/enums/index.js +0 -7
  151. package/dist/modules/elysia/crud/index.d.ts +0 -2
  152. package/dist/modules/elysia/crud/index.js +0 -153
  153. package/dist/modules/elysia/crud/operations/count.d.ts +0 -258
  154. package/dist/modules/elysia/crud/operations/delete.d.ts +0 -258
  155. package/dist/modules/elysia/crud/operations/deleteOne.d.ts +0 -258
  156. package/dist/modules/elysia/crud/operations/find.d.ts +0 -258
  157. package/dist/modules/elysia/crud/operations/findOne.d.ts +0 -258
  158. package/dist/modules/elysia/crud/operations/index.d.ts +0 -8
  159. package/dist/modules/elysia/crud/operations/index.js +0 -34
  160. package/dist/modules/elysia/crud/operations/insert.d.ts +0 -258
  161. package/dist/modules/elysia/crud/operations/update.d.ts +0 -268
  162. package/dist/modules/elysia/crud/operations/updateOne.d.ts +0 -268
  163. package/dist/modules/elysia/crud/operations/utils/get-db-injection.d.ts +0 -8
  164. package/dist/modules/elysia/crud/types/count-response-200-schema.d.ts +0 -5
  165. package/dist/modules/elysia/crud/types/crud-operation-base.d.ts +0 -4
  166. package/dist/modules/elysia/crud/types/crud-operation-count.d.ts +0 -14
  167. package/dist/modules/elysia/crud/types/crud-operation-delete-one.d.ts +0 -14
  168. package/dist/modules/elysia/crud/types/crud-operation-delete.d.ts +0 -14
  169. package/dist/modules/elysia/crud/types/crud-operation-find-one.d.ts +0 -14
  170. package/dist/modules/elysia/crud/types/crud-operation-find.d.ts +0 -14
  171. package/dist/modules/elysia/crud/types/crud-operation-insert.d.ts +0 -14
  172. package/dist/modules/elysia/crud/types/crud-operation-update-one.d.ts +0 -16
  173. package/dist/modules/elysia/crud/types/crud-operation-update.d.ts +0 -14
  174. package/dist/modules/elysia/crud/types/crud-operations.d.ts +0 -19
  175. package/dist/modules/elysia/crud/types/crud-options.d.ts +0 -44
  176. package/dist/modules/elysia/crud/types/crud-schema-models-type.d.ts +0 -12
  177. package/dist/modules/elysia/crud/types/crud-schema-operations.d.ts +0 -10
  178. package/dist/modules/elysia/crud/types/crud-schema-options.d.ts +0 -13
  179. package/dist/modules/elysia/crud/types/delete-schema.d.ts +0 -12
  180. package/dist/modules/elysia/crud/types/filter-schema.d.ts +0 -9
  181. package/dist/modules/elysia/crud/types/find-schema.d.ts +0 -16
  182. package/dist/modules/elysia/crud/types/id-param-schema.d.ts +0 -4
  183. package/dist/modules/elysia/crud/types/index.d.ts +0 -29
  184. package/dist/modules/elysia/crud/types/order-schema.d.ts +0 -11
  185. package/dist/modules/elysia/crud/types/properties-schema.d.ts +0 -9
  186. package/dist/modules/elysia/crud/types/response-200-schema.d.ts +0 -11
  187. package/dist/modules/elysia/crud/utils/create-adaptive-where-clause-schema.d.ts +0 -17
  188. package/dist/modules/elysia/crud/utils/create-count-response-200-schema.d.ts +0 -8
  189. package/dist/modules/elysia/crud/utils/create-count-schema.d.ts +0 -12
  190. package/dist/modules/elysia/crud/utils/create-filters-schema.d.ts +0 -14
  191. package/dist/modules/elysia/crud/utils/create-find-schema.d.ts +0 -12
  192. package/dist/modules/elysia/crud/utils/create-id-param-schema.d.ts +0 -2
  193. package/dist/modules/elysia/crud/utils/create-insert-schema.d.ts +0 -8
  194. package/dist/modules/elysia/crud/utils/create-order-schema.d.ts +0 -12
  195. package/dist/modules/elysia/crud/utils/create-properties-schema.d.ts +0 -12
  196. package/dist/modules/elysia/crud/utils/create-q-schema.d.ts +0 -12
  197. package/dist/modules/elysia/crud/utils/create-response-200-schema.d.ts +0 -3
  198. package/dist/modules/elysia/crud/utils/create-selected-fields-schema.d.ts +0 -12
  199. package/dist/modules/elysia/crud/utils/create-update-one-schema.d.ts +0 -3
  200. package/dist/modules/elysia/crud/utils/create-update-schema.d.ts +0 -3
  201. package/dist/modules/elysia/crud/utils/index.d.ts +0 -16
  202. package/dist/modules/elysia/crud/utils/index.js +0 -41
  203. /package/dist/modules/{elysia/crud → schema-builder}/types/adaptive-where-clause-schema.d.ts +0 -0
  204. /package/dist/modules/{elysia/crud → schema-builder}/types/index.js +0 -0
  205. /package/dist/modules/{elysia/crud/types/selected-field-schema.d.ts → schema-builder/types/selected-fields-schema.d.ts} +0 -0
  206. /package/dist/{shared → modules/schema-builder}/types/tflatten.d.ts +0 -0
  207. /package/dist/modules/{elysia/crud → schema-builder}/types/update-one-schema.d.ts +0 -0
  208. /package/dist/modules/{elysia/crud → schema-builder}/utils/is-date-from-elysia-typebox.d.ts +0 -0
@@ -1,14 +1,14 @@
1
1
  // @bun
2
2
  import {
3
- BaseError
4
- } from "../../../chunk-9cgzhc50.js";
3
+ InternalError
4
+ } from "../../../chunk-jz3wd472.js";
5
5
 
6
6
  // source/modules/logger/sinks/console-logger.ts
7
7
  class ConsoleLoggerSink {
8
- async log(level, timestamp, object) {
9
- const sanitizedContent = typeof object === "string" ? object : JSON.stringify(object);
10
- await Bun.write(Bun.stdout, `{"timestamp":${timestamp},"level":"${level}","content":${sanitizedContent}}
11
- `);
8
+ log(level, timestamp, object) {
9
+ const logEntry = { timestamp, level, content: object };
10
+ const logLevel = level.toLowerCase();
11
+ console[logLevel]?.(JSON.stringify(logEntry));
12
12
  }
13
13
  }
14
14
  // source/modules/logger/sinks/devnull-logger.ts
@@ -17,7 +17,7 @@ class DevNullLoggerSink {
17
17
  }
18
18
  // source/modules/logger/sinks/file-logger/enums/file-logger-error-keys.ts
19
19
  var FILE_LOGGER_ERROR_KEYS = {
20
- FAILED_TO_CLOSE_STREAM: "mrx-core.file_logger.error.failed_to_close_stream"
20
+ FAILED_TO_CLOSE_STREAM: "nowarajs.logger.file_logger.error.failed_to_close_stream"
21
21
  };
22
22
  // source/modules/logger/sinks/file-logger/file-logger.ts
23
23
  import { createWriteStream } from "fs";
@@ -36,10 +36,9 @@ class FileLoggerSink {
36
36
  async log(level, timestamp, object) {
37
37
  if (this._isClosed)
38
38
  return;
39
- const sanitizedContent = typeof object === "string" ? object : JSON.stringify(object);
40
- const message = `{"timestamp":${timestamp},"level":"${level}","content":${sanitizedContent}}
39
+ const logEntry = JSON.stringify({ timestamp, level, content: object }) + `
41
40
  `;
42
- const canContinue = this._stream.write(message);
41
+ const canContinue = this._stream.write(logEntry);
43
42
  if (!canContinue)
44
43
  await new Promise((resolve) => {
45
44
  this._stream.once("drain", resolve);
@@ -52,7 +51,7 @@ class FileLoggerSink {
52
51
  return new Promise((resolve, reject) => {
53
52
  this._stream.end((err) => {
54
53
  if (err)
55
- reject(new BaseError(FILE_LOGGER_ERROR_KEYS.FAILED_TO_CLOSE_STREAM, err.message));
54
+ reject(new InternalError(FILE_LOGGER_ERROR_KEYS.FAILED_TO_CLOSE_STREAM, err.message));
56
55
  else
57
56
  resolve();
58
57
  });
@@ -23,7 +23,7 @@ export interface LoggerOptions {
23
23
  * Maximum time in milliseconds to wait before flushing a partial batch.
24
24
  * Prevents logs from being delayed indefinitely when batch size is not reached.
25
25
  * Set to 0 to disable time-based flushing.
26
- * @default 0.1 (100 microseconds)
26
+ * @default 0.1 (milliseconds)
27
27
  */
28
28
  batchTimeout?: number;
29
29
  /**
@@ -4,7 +4,7 @@ export interface LoggerSink<TLogObject = unknown, TConfig = unknown> {
4
4
  readonly config?: TConfig;
5
5
  /**
6
6
  * Logs a message with the sink's implementation.
7
- * si vous voulez créer votre propre sink vous devrez implémenter cette méthode et tout ce qui est importation doit etre sous forme d'importation dynamique
7
+ * If you want to create your own sink, you must implement this method and all imports must be in the form of dynamic imports.
8
8
  *
9
9
  * @param level - The log level at which the message should be logged.
10
10
  * @param timestamp - The date at which the message was logged.
@@ -0,0 +1 @@
1
+ export declare const workerFunction: () => void;
@@ -1,7 +1,7 @@
1
1
  // @bun
2
2
  import {
3
3
  MAILER_ERROR_KEYS
4
- } from "../../../chunk-6w9ja96e.js";
4
+ } from "../../../chunk-yrt0ffvf.js";
5
5
  export {
6
6
  MAILER_ERROR_KEYS
7
7
  };
@@ -1,5 +1,5 @@
1
1
  export declare const MAILER_ERROR_KEYS: {
2
- readonly SMTP_ALREADY_CONNECTED: "mrx-core.mailer.error.smtp.already_connected";
3
- readonly SMTP_CONNECTION_ERROR: "mrx-core.mailer.error.smtp.connection_error";
4
- readonly SMTP_NOT_CONNECTED: "mrx-core.mailer.error.smtp.not_connected";
2
+ readonly SMTP_ALREADY_CONNECTED: "mrx.mrx-core.mailer.error.smtp.already_connected";
3
+ readonly SMTP_CONNECTION_ERROR: "mrx.mrx-core.mailer.error.smtp.connection_error";
4
+ readonly SMTP_NOT_CONNECTED: "mrx.mrx-core.mailer.error.smtp.not_connected";
5
5
  };
@@ -1,10 +1,10 @@
1
1
  // @bun
2
2
  import {
3
3
  MAILER_ERROR_KEYS
4
- } from "../../chunk-6w9ja96e.js";
4
+ } from "../../chunk-yrt0ffvf.js";
5
5
  import {
6
- BaseError
7
- } from "../../chunk-9cgzhc50.js";
6
+ InternalError
7
+ } from "../../chunk-jz3wd472.js";
8
8
 
9
9
  // source/modules/mailer/smtp.ts
10
10
  import { createTransport } from "nodemailer";
@@ -20,7 +20,7 @@ class SMTP {
20
20
  }
21
21
  async connect() {
22
22
  if (this._transporter)
23
- throw new BaseError(MAILER_ERROR_KEYS.SMTP_ALREADY_CONNECTED);
23
+ throw new InternalError(MAILER_ERROR_KEYS.SMTP_ALREADY_CONNECTED);
24
24
  this._transporter = createTransport({
25
25
  host: this._config.host,
26
26
  port: this._config.port,
@@ -35,7 +35,7 @@ class SMTP {
35
35
  try {
36
36
  await this._transporter.verify();
37
37
  } catch (error) {
38
- throw new BaseError(MAILER_ERROR_KEYS.SMTP_CONNECTION_ERROR, error);
38
+ throw new InternalError(MAILER_ERROR_KEYS.SMTP_CONNECTION_ERROR, error);
39
39
  }
40
40
  }
41
41
  disconnect() {
@@ -46,7 +46,7 @@ class SMTP {
46
46
  }
47
47
  async sendMail(options) {
48
48
  if (!this._transporter)
49
- throw new BaseError(MAILER_ERROR_KEYS.SMTP_NOT_CONNECTED);
49
+ throw new InternalError(MAILER_ERROR_KEYS.SMTP_NOT_CONNECTED);
50
50
  return this._transporter.sendMail(options);
51
51
  }
52
52
  }
@@ -4,7 +4,7 @@ import type { SMTPOptions } from './types/smtp-options';
4
4
  * The `SMTP` class manages the connection and operations with an SMTP server.
5
5
  *
6
6
  * This class provides methods to connect, disconnect, and send emails using
7
- * the Nodemailer library. It supports connection pooling and error handling ({@link BaseError}).
7
+ * the Nodemailer library. It supports connection pooling and error handling ({@link InternalError}).
8
8
  *
9
9
  * @example
10
10
  * ```ts
@@ -39,8 +39,8 @@ export declare class SMTP {
39
39
  * It enables connection pooling for efficient resource usage and sets the maximum number of
40
40
  * concurrent connections as specified in the configuration (default: 5).
41
41
  *
42
- * @throws ({@link BaseError}) - If the transporter is already connected.
43
- * @throws ({@link BaseError}) - If the connection or verification fails.
42
+ * @throws ({@link InternalError}) - If the transporter is already connected.
43
+ * @throws ({@link InternalError}) - If the connection or verification fails.
44
44
  */
45
45
  connect(): Promise<void>;
46
46
  /**
@@ -54,7 +54,7 @@ export declare class SMTP {
54
54
  *
55
55
  * @param options - The mail options, such as recipient, subject, and content.
56
56
  *
57
- * @throws ({@link BaseError}) - If the transporter is not connected.
57
+ * @throws ({@link InternalError}) - If the transporter is not connected.
58
58
  *
59
59
  * @returns A promise resolving to the result of the send operation.
60
60
  */
@@ -1,12 +1,12 @@
1
1
  // @bun
2
2
  import {
3
3
  Repository
4
- } from "../../chunk-afyz8rg5.js";
4
+ } from "../../chunk-s53cbgkb.js";
5
5
  import"../../chunk-grfyngq0.js";
6
- import"../../chunk-4v86f7gp.js";
7
- import"../../chunk-7t524zqh.js";
6
+ import"../../chunk-zv4ta4fb.js";
8
7
  import"../../chunk-sqts8vyk.js";
9
- import"../../chunk-9cgzhc50.js";
8
+ import"../../chunk-jz3wd472.js";
9
+ import"../../chunk-642xajvx.js";
10
10
  export {
11
11
  Repository
12
12
  };
@@ -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';
@@ -17,7 +17,7 @@ import type { QueryOptionsExtendStream } from './types/query-options-extend-stre
17
17
  * const users = await repo.find({ limit: 10 });
18
18
  * ```
19
19
  */
20
- export declare class Repository<TModel = unknown> {
20
+ export declare class Repository<TModel = Record<string, unknown>> {
21
21
  /**
22
22
  * The Knex instance used for database operations.
23
23
  */
@@ -124,7 +124,7 @@ export declare class Repository<TModel = unknown> {
124
124
  * });
125
125
  * ```
126
126
  */
127
- findStream<KModel extends TModel = NoInfer<TModel>>(options?: QueryOptionsExtendStream<KModel>): StreamWithAsyncIterable<KModel>;
127
+ findStream<KModel extends TModel = TModel>(options?: QueryOptionsExtendStream<KModel>): StreamWithAsyncIterable<Required<KModel>>;
128
128
  /**
129
129
  * Finds records in the database based on the specified query options and returns the results
130
130
  * as an array. This method supports comprehensive filtering, pagination, field selection, and sorting
@@ -191,7 +191,7 @@ export declare class Repository<TModel = unknown> {
191
191
  * });
192
192
  * ```
193
193
  */
194
- find<KModel extends TModel = NoInfer<TModel>>(options?: QueryOptionsExtendPagination<KModel>): Promise<KModel[]>;
194
+ find<KModel extends TModel = TModel>(options?: QueryOptionsExtendPagination<KModel>): Promise<Required<KModel>[]>;
195
195
  /**
196
196
  * Counts the number of records in the database based on the specified query options.
197
197
  * This method supports advanced filtering capabilities to count records that match specific criteria.
@@ -228,7 +228,7 @@ export declare class Repository<TModel = unknown> {
228
228
  * });
229
229
  * ```
230
230
  */
231
- count<KModel extends TModel = NoInfer<TModel>>(options?: Omit<QueryOptions<KModel>, 'selectedFields' | 'orderBy'>): Promise<number>;
231
+ count<KModel extends TModel = TModel>(options?: Omit<QueryOptions<KModel>, 'selectedFields' | 'orderBy'>): Promise<number>;
232
232
  /**
233
233
  * Inserts new records into the database and returns the inserted records.
234
234
  * This method supports bulk insertion of multiple records at once.
@@ -265,7 +265,7 @@ export declare class Repository<TModel = unknown> {
265
265
  * });
266
266
  * ```
267
267
  */
268
- insert<KModel extends TModel = NoInfer<TModel>>(data: Partial<KModel> | Partial<KModel>[], options?: Omit<QueryOptions<KModel>, 'filters' | 'orderBy'>): Promise<KModel[]>;
268
+ insert<KModel extends TModel = TModel>(data: Partial<NoInfer<KModel>> | Partial<NoInfer<KModel>>[], options?: Omit<QueryOptions<KModel>, 'filters' | 'orderBy'>): Promise<Required<KModel>[]>;
269
269
  /**
270
270
  * Updates existing records in the database based on the specified query options and returns the updated records.
271
271
  * This method supports advanced filtering capabilities to update records that match specific criteria.
@@ -304,7 +304,7 @@ export declare class Repository<TModel = unknown> {
304
304
  * });
305
305
  * ```
306
306
  */
307
- update<KModel extends TModel = NoInfer<TModel>>(data: Partial<KModel>, options: Omit<QueryOptions<KModel>, 'orderBy' | 'filters'> & Required<Pick<QueryOptions<KModel>, 'filters'>>): Promise<KModel[]>;
307
+ update<KModel extends TModel = TModel>(data: Partial<NoInfer<KModel>>, options: Omit<QueryOptionsExtendPagination<KModel>, 'orderBy' | 'filters'> & Required<Pick<QueryOptions<KModel>, 'filters'>>): Promise<Required<KModel>[]>;
308
308
  /**
309
309
  * Deletes records from the database based on the specified query options and returns the deleted records.
310
310
  * This method supports advanced filtering capabilities to filter the records before deletion.
@@ -342,7 +342,7 @@ export declare class Repository<TModel = unknown> {
342
342
  * });
343
343
  * ```
344
344
  */
345
- delete<KModel extends TModel = NoInfer<TModel>>(options: Omit<QueryOptions<KModel>, 'orderBy' | 'filters'> & Required<Pick<QueryOptions<KModel>, 'filters'>>): Promise<KModel[]>;
345
+ delete<KModel extends TModel = NoInfer<TModel>>(options: Omit<QueryOptions<KModel>, 'orderBy' | 'filters'> & Required<Pick<QueryOptions<KModel>, 'filters'>>): Promise<Required<KModel>[]>;
346
346
  /**
347
347
  * Applies selected fields to a Knex.js query builder. This method supports both single and multiple field selections.
348
348
  * It is used to specify which fields should be returned in the query results.
@@ -352,7 +352,7 @@ export declare class Repository<TModel = unknown> {
352
352
  * @param query - The Knex.js query builder to apply the selected fields to.
353
353
  * @param selectedFields - The fields to select. Can be a single field or an array of fields.
354
354
  */
355
- protected _applySelectedFields<KModel>(query: Knex.QueryBuilder, selectedFields: QueryOptions<KModel>['selectedFields'] | undefined): void;
355
+ protected _applySelectedFields<KModel>(query: Knex.QueryBuilder, selectedFields: QueryOptions<KModel>['selectedFields']): void;
356
356
  /**
357
357
  * Applies filter criteria to a Knex.js query builder. This method supports complex queries
358
358
  * using operators like `$eq`, `$neq`, `$lt`, `$lte`, `$gt`, `$gte`, `$in`, `$nin`, `$between`, `$nbetween`,
@@ -373,7 +373,7 @@ export declare class Repository<TModel = 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 = 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.
@@ -417,5 +433,5 @@ export declare class Repository<TModel = unknown> {
417
433
  *
418
434
  * @returns An array of records returned by the query.
419
435
  */
420
- protected _executeQuery<KModel>(query: Knex.QueryBuilder, throwIfNoResult?: QueryOptions<KModel>['throwIfNoResult']): Promise<KModel[]>;
436
+ protected _executeQuery<KModel>(query: Knex.QueryBuilder, throwIfNoResult?: QueryOptions<KModel>['throwIfNoResult']): Promise<Required<KModel>[]>;
421
437
  }
@@ -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';