alepha 0.13.5 → 0.13.7

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 (136) hide show
  1. package/dist/api-audits/index.browser.js +116 -0
  2. package/dist/api-audits/index.browser.js.map +1 -0
  3. package/dist/api-audits/index.d.ts +1194 -0
  4. package/dist/api-audits/index.js +674 -0
  5. package/dist/api-audits/index.js.map +1 -0
  6. package/dist/api-notifications/index.d.ts +147 -147
  7. package/dist/api-parameters/index.browser.js +36 -5
  8. package/dist/api-parameters/index.browser.js.map +1 -1
  9. package/dist/api-parameters/index.d.ts +711 -33
  10. package/dist/api-parameters/index.js +831 -17
  11. package/dist/api-parameters/index.js.map +1 -1
  12. package/dist/api-users/index.d.ts +16 -3
  13. package/dist/api-users/index.js +699 -19
  14. package/dist/api-users/index.js.map +1 -1
  15. package/dist/api-verifications/index.js +2 -1
  16. package/dist/api-verifications/index.js.map +1 -1
  17. package/dist/bin/index.js +1 -0
  18. package/dist/bin/index.js.map +1 -1
  19. package/dist/cli/index.d.ts +85 -31
  20. package/dist/cli/index.js +205 -33
  21. package/dist/cli/index.js.map +1 -1
  22. package/dist/command/index.d.ts +67 -6
  23. package/dist/command/index.js +30 -3
  24. package/dist/command/index.js.map +1 -1
  25. package/dist/core/index.browser.js +241 -61
  26. package/dist/core/index.browser.js.map +1 -1
  27. package/dist/core/index.d.ts +170 -90
  28. package/dist/core/index.js +264 -67
  29. package/dist/core/index.js.map +1 -1
  30. package/dist/core/index.native.js +248 -65
  31. package/dist/core/index.native.js.map +1 -1
  32. package/dist/email/index.js +15 -10554
  33. package/dist/email/index.js.map +1 -1
  34. package/dist/logger/index.d.ts +4 -4
  35. package/dist/logger/index.js +77 -72
  36. package/dist/logger/index.js.map +1 -1
  37. package/dist/orm/index.d.ts +5 -1
  38. package/dist/orm/index.js +24 -7
  39. package/dist/orm/index.js.map +1 -1
  40. package/dist/queue/index.d.ts +4 -4
  41. package/dist/redis/index.d.ts +10 -10
  42. package/dist/security/index.d.ts +28 -28
  43. package/dist/server/index.d.ts +10 -1
  44. package/dist/server/index.js +20 -6
  45. package/dist/server/index.js.map +1 -1
  46. package/dist/server-auth/index.d.ts +163 -152
  47. package/dist/server-auth/index.js +40 -10
  48. package/dist/server-auth/index.js.map +1 -1
  49. package/dist/server-cookies/index.js +5 -1
  50. package/dist/server-cookies/index.js.map +1 -1
  51. package/dist/server-links/index.d.ts +33 -33
  52. package/dist/server-security/index.d.ts +9 -9
  53. package/dist/thread/index.js +2 -2
  54. package/dist/thread/index.js.map +1 -1
  55. package/dist/vite/index.d.ts +2 -2
  56. package/dist/vite/index.js +102 -45
  57. package/dist/vite/index.js.map +1 -1
  58. package/dist/websocket/index.browser.js +3 -3
  59. package/dist/websocket/index.browser.js.map +1 -1
  60. package/dist/websocket/index.d.ts +7 -7
  61. package/dist/websocket/index.js +4 -4
  62. package/dist/websocket/index.js.map +1 -1
  63. package/package.json +14 -9
  64. package/src/api-audits/controllers/AuditController.ts +186 -0
  65. package/src/api-audits/entities/audits.ts +132 -0
  66. package/src/api-audits/index.browser.ts +18 -0
  67. package/src/api-audits/index.ts +58 -0
  68. package/src/api-audits/primitives/$audit.ts +159 -0
  69. package/src/api-audits/schemas/auditQuerySchema.ts +23 -0
  70. package/src/api-audits/schemas/auditResourceSchema.ts +9 -0
  71. package/src/api-audits/schemas/createAuditSchema.ts +27 -0
  72. package/src/api-audits/services/AuditService.ts +412 -0
  73. package/src/api-parameters/controllers/ConfigController.ts +324 -0
  74. package/src/api-parameters/entities/parameters.ts +93 -10
  75. package/src/api-parameters/index.ts +43 -4
  76. package/src/api-parameters/primitives/$config.ts +291 -19
  77. package/src/api-parameters/schedulers/ConfigActivationScheduler.ts +30 -0
  78. package/src/api-parameters/services/ConfigStore.ts +491 -0
  79. package/src/api-users/atoms/realmAuthSettingsAtom.ts +19 -0
  80. package/src/api-users/controllers/UserRealmController.ts +0 -2
  81. package/src/api-users/index.ts +2 -0
  82. package/src/api-users/primitives/$userRealm.ts +18 -3
  83. package/src/api-users/providers/UserRealmProvider.ts +6 -3
  84. package/src/api-users/services/RegistrationService.ts +2 -1
  85. package/src/api-users/services/SessionService.ts +4 -0
  86. package/src/api-users/services/UserService.ts +3 -0
  87. package/src/api-verifications/index.ts +7 -1
  88. package/src/bin/index.ts +1 -0
  89. package/src/cli/assets/biomeJson.ts +1 -1
  90. package/src/cli/assets/dummySpecTs.ts +7 -0
  91. package/src/cli/assets/editorconfig.ts +13 -0
  92. package/src/cli/assets/mainTs.ts +14 -0
  93. package/src/cli/commands/BiomeCommands.ts +2 -0
  94. package/src/cli/commands/CoreCommands.ts +28 -9
  95. package/src/cli/commands/VerifyCommands.ts +2 -1
  96. package/src/cli/commands/ViteCommands.ts +8 -9
  97. package/src/cli/services/AlephaCliUtils.ts +214 -23
  98. package/src/command/helpers/Asker.ts +0 -1
  99. package/src/command/primitives/$command.ts +67 -0
  100. package/src/command/providers/CliProvider.ts +39 -8
  101. package/src/core/Alepha.ts +40 -30
  102. package/src/core/helpers/jsonSchemaToTypeBox.ts +307 -0
  103. package/src/core/index.shared.ts +1 -0
  104. package/src/core/index.ts +30 -3
  105. package/src/core/providers/EventManager.ts +1 -1
  106. package/src/core/providers/StateManager.ts +23 -12
  107. package/src/core/providers/TypeProvider.ts +26 -34
  108. package/src/logger/index.ts +8 -6
  109. package/src/logger/primitives/$logger.ts +1 -1
  110. package/src/logger/providers/{SimpleFormatterProvider.ts → PrettyFormatterProvider.ts} +10 -1
  111. package/src/orm/index.ts +6 -0
  112. package/src/orm/services/PgRelationManager.ts +2 -2
  113. package/src/orm/services/PostgresModelBuilder.ts +11 -7
  114. package/src/orm/services/Repository.ts +16 -7
  115. package/src/orm/services/SqliteModelBuilder.ts +10 -0
  116. package/src/server/index.ts +6 -0
  117. package/src/server/primitives/$action.ts +10 -1
  118. package/src/server/providers/ServerBodyParserProvider.ts +11 -5
  119. package/src/server/providers/ServerRouterProvider.ts +13 -7
  120. package/src/server-auth/primitives/$auth.ts +7 -0
  121. package/src/server-auth/providers/ServerAuthProvider.ts +51 -8
  122. package/src/server-cookies/index.ts +2 -1
  123. package/src/thread/primitives/$thread.ts +2 -2
  124. package/src/vite/index.ts +0 -2
  125. package/src/vite/tasks/buildServer.ts +3 -4
  126. package/src/vite/tasks/generateCloudflare.ts +35 -19
  127. package/src/vite/tasks/generateDocker.ts +18 -4
  128. package/src/vite/tasks/generateSitemap.ts +5 -7
  129. package/src/vite/tasks/generateVercel.ts +76 -41
  130. package/src/vite/tasks/runAlepha.ts +16 -1
  131. package/src/websocket/providers/NodeWebSocketServerProvider.ts +3 -11
  132. package/src/websocket/services/WebSocketClient.ts +3 -3
  133. package/dist/cli/dist-BlfFtOk2.js +0 -2770
  134. package/dist/cli/dist-BlfFtOk2.js.map +0 -1
  135. package/src/api-parameters/controllers/ParameterController.ts +0 -45
  136. package/src/api-parameters/services/ParameterStore.ts +0 -23
@@ -1,9 +1,9 @@
1
1
  import { AsyncLocalStorage } from "node:async_hooks";
2
2
  import { Validator } from "typebox/compile";
3
- import * as TypeBox from "typebox";
4
- import { Static as Static$1, StaticDecode, StaticDecode as Static, StaticEncode, StaticEncode as StaticEncode$1, TAny, TAny as TAny$1, TArray, TArray as TArray$1, TArrayOptions, TBigInt, TBoolean, TBoolean as TBoolean$1, TInteger, TInteger as TInteger$1, TInterface, TKeysToIndexer, TKeysToIndexer as TKeysToIndexer$1, TNull, TNull as TNull$1, TNumber, TNumber as TNumber$1, TNumberOptions, TNumberOptions as TNumberOptions$1, TObject, TObject as TObject$1, TObjectOptions, TObjectOptions as TObjectOptions$1, TOmit, TOptional, TOptionalAdd, TOptionalAdd as TOptionalAdd$1, TPartial, TPick, TPick as TPick$1, TProperties, TProperties as TProperties$1, TRecord, TRecord as TRecord$1, TSchema, TSchema as TSchema$1, TSchemaOptions, TString, TString as TString$1, TStringOptions, TStringOptions as TStringOptions$1, TTuple, TUnion, TUnion as TUnion$1, TUnsafe, TUnsafe as TUnsafe$1, TVoid } from "typebox";
5
- import TypeBoxFormat from "typebox/format";
6
- import * as TypeBoxValue from "typebox/value";
3
+ import * as typebox0 from "typebox";
4
+ import { Static as Static$1, StaticDecode, StaticDecode as Static, StaticEncode, StaticEncode as StaticEncode$1, TAny, TAny as TAny$1, TArray, TArray as TArray$1, TArrayOptions, TBigInt, TBoolean, TBoolean as TBoolean$1, TInteger, TInteger as TInteger$1, TInterface, TKeysToIndexer, TKeysToIndexer as TKeysToIndexer$1, TNull, TNull as TNull$1, TNumber, TNumber as TNumber$1, TNumberOptions, TNumberOptions as TNumberOptions$1, TObject, TObject as TObject$1, TObjectOptions, TObjectOptions as TObjectOptions$1, TOmit, TOptional, TOptionalAdd, TOptionalAdd as TOptionalAdd$1, TPartial, TPick, TPick as TPick$1, TProperties, TProperties as TProperties$1, TRecord, TRecord as TRecord$1, TSchema, TSchema as TSchema$1, TSchemaOptions, TString, TString as TString$1, TStringOptions, TStringOptions as TStringOptions$1, TTuple, TUnion, TUnion as TUnion$1, TUnsafe, TUnsafe as TUnsafe$1, TVoid, Type } from "typebox";
5
+ import Format from "typebox/format";
6
+ import * as Value from "typebox/value";
7
7
  import { TLocalizedValidationError } from "typebox/error";
8
8
  import { Readable } from "node:stream";
9
9
  import { ReadableStream as ReadableStream$1 } from "node:stream/web";
@@ -216,33 +216,27 @@ type StreamLike = ReadableStream | ReadableStream$1 | Readable | NodeJS.Readable
216
216
  type TStream = TUnsafe$1<StreamLike>;
217
217
  //#endregion
218
218
  //#region ../../src/core/providers/TypeProvider.d.ts
219
- declare const isUUID: typeof TypeBoxFormat.IsUuid;
220
- declare const isEmail: typeof TypeBoxFormat.IsEmail;
221
- declare const isURL: typeof TypeBoxFormat.IsUrl;
222
- declare const isDateTime: typeof TypeBoxFormat.IsDateTime;
223
- declare const isDate: typeof TypeBoxFormat.IsDate;
224
- declare const isTime: typeof TypeBoxFormat.IsTime;
225
- declare const isDuration: typeof TypeBoxFormat.IsDuration;
219
+ declare const isUUID: typeof Format.IsUuid;
226
220
  declare class TypeGuard {
227
221
  isBigInt: (value: TSchema$1) => value is TString$1;
228
222
  isUUID: (value: TSchema$1) => value is TString$1;
229
- isObject: typeof TypeBox.IsObject;
230
- isNumber: typeof TypeBox.IsNumber;
231
- isString: typeof TypeBox.IsString;
232
- isBoolean: typeof TypeBox.IsBoolean;
233
- isAny: typeof TypeBox.IsAny;
234
- isArray: typeof TypeBox.IsArray;
235
- isOptional: typeof TypeBox.IsOptional;
236
- isUnion: typeof TypeBox.IsUnion;
237
- isInteger: typeof TypeBox.IsInteger;
238
- isNull: typeof TypeBox.IsNull;
239
- isUndefined: typeof TypeBox.IsUndefined;
240
- isUnsafe: typeof TypeBox.IsUnsafe;
241
- isRecord: typeof TypeBox.IsRecord;
242
- isTuple: typeof TypeBox.IsTuple;
243
- isVoid: typeof TypeBox.IsVoid;
244
- isLiteral: typeof TypeBox.IsLiteral;
245
- isSchema: typeof TypeBox.IsSchema;
223
+ isObject: typeof Type.IsObject;
224
+ isNumber: typeof Type.IsNumber;
225
+ isString: typeof Type.IsString;
226
+ isBoolean: typeof Type.IsBoolean;
227
+ isAny: typeof Type.IsAny;
228
+ isArray: typeof Type.IsArray;
229
+ isOptional: typeof Type.IsOptional;
230
+ isUnion: typeof Type.IsUnion;
231
+ isInteger: typeof Type.IsInteger;
232
+ isNull: typeof Type.IsNull;
233
+ isUndefined: typeof Type.IsUndefined;
234
+ isUnsafe: typeof Type.IsUnsafe;
235
+ isRecord: typeof Type.IsRecord;
236
+ isTuple: typeof Type.IsTuple;
237
+ isVoid: typeof Type.IsVoid;
238
+ isLiteral: typeof Type.IsLiteral;
239
+ isSchema: typeof Type.IsSchema;
246
240
  isFile: (value: TSchema$1) => value is TFile;
247
241
  isDateTime: (schema: unknown) => boolean;
248
242
  isDate: (schema: unknown) => boolean;
@@ -260,7 +254,7 @@ declare module "typebox" {
260
254
  }
261
255
  }
262
256
  declare class TypeProvider {
263
- static format: typeof TypeBoxFormat;
257
+ static format: typeof Format;
264
258
  static translateError(error: TypeBoxError, locale?: string): string;
265
259
  static setLocale(locale: string): void;
266
260
  static isValidBigInt(value: string | number): boolean;
@@ -307,16 +301,16 @@ declare class TypeProvider {
307
301
  * It can be overridden in the array options.
308
302
  */
309
303
  static DEFAULT_ARRAY_MAX_ITEMS: number;
310
- raw: typeof TypeBox.Type;
311
- any: typeof TypeBox.Any;
312
- void: typeof TypeBox.Void;
313
- undefined: typeof TypeBox.Undefined;
314
- record: typeof TypeBox.Record;
315
- union: typeof TypeBox.Union;
316
- tuple: typeof TypeBox.Tuple;
317
- null: typeof TypeBox.Null;
318
- const: typeof TypeBox.Literal;
319
- options: typeof TypeBox.Options;
304
+ raw: typeof Type;
305
+ any: typeof Type.Any;
306
+ void: typeof Type.Void;
307
+ undefined: typeof Type.Undefined;
308
+ record: typeof Type.Record;
309
+ union: typeof Type.Union;
310
+ tuple: typeof Type.Tuple;
311
+ null: typeof Type.Null;
312
+ const: typeof Type.Literal;
313
+ options: typeof Type.Options;
320
314
  /**
321
315
  * Type guards to check the type of schema.
322
316
  * This is not a runtime type check, but a compile-time type guard.
@@ -372,7 +366,7 @@ declare class TypeProvider {
372
366
  * Create a schema for a JSON object.
373
367
  * This is a record with string keys and any values.
374
368
  */
375
- json(options?: TSchemaOptions): TRecord$1<string, TAny$1>;
369
+ json<T = any>(options?: TSchemaOptions): TRecord$1<string, TAny$1>;
376
370
  /**
377
371
  * Create a schema for a boolean.
378
372
  */
@@ -405,13 +399,13 @@ declare class TypeProvider {
405
399
  /**
406
400
  * Create a schema that maps all properties of an object schema to nullable.
407
401
  */
408
- nullify: <T extends TSchema$1>(schema: T, options?: TObjectOptions$1) => TypeBox.TMappedInstantiate<{}, {
402
+ nullify: <T extends TSchema$1>(schema: T, options?: TObjectOptions$1) => typebox0.TMappedInstantiate<{}, {
409
403
  callstack: [];
410
- }, TypeBox.TIdentifier<"K">, TypeBox.TKeyOfInstantiate<{}, {
404
+ }, Type.TIdentifier<"K">, typebox0.TKeyOfInstantiate<{}, {
411
405
  callstack: [];
412
- }, T>, TypeBox.TRef<"K">, TUnion$1<[TypeBox.TIndexInstantiate<{}, {
406
+ }, T>, Type.TRef<"K">, TUnion$1<[typebox0.TIndexInstantiate<{}, {
413
407
  callstack: [];
414
- }, T, TypeBox.TRef<"K">>, TNull$1]>>;
408
+ }, T, Type.TRef<"K">>, TNull$1]>>;
415
409
  /**
416
410
  * Create a schema for a string enum.
417
411
  */
@@ -475,7 +469,7 @@ declare class TypeProvider {
475
469
  valueLabel: (options?: TObjectOptions$1) => TObject$1<{
476
470
  value: TString$1;
477
471
  label: TString$1;
478
- description: TypeBox.TOptional<TString$1>;
472
+ description: Type.TOptional<TString$1>;
479
473
  }>;
480
474
  datetime: (options?: TStringOptions$1) => TString$1;
481
475
  date: (options?: TStringOptions$1) => TString$1;
@@ -759,7 +753,7 @@ declare class JsonSchemaCodec extends SchemaCodec {
759
753
  //#endregion
760
754
  //#region ../../src/core/providers/SchemaValidator.d.ts
761
755
  declare class SchemaValidator {
762
- protected cache: Map<TSchema$1, Validator<TypeBox.TProperties, TSchema$1, unknown, unknown>>;
756
+ protected cache: Map<TSchema$1, Validator<typebox0.TProperties, TSchema$1, unknown, unknown>>;
763
757
  /**
764
758
  * Validate the value against the provided schema.
765
759
  *
@@ -863,7 +857,7 @@ declare class CodecManager {
863
857
  //#endregion
864
858
  //#region ../../src/core/providers/EventManager.d.ts
865
859
  declare class EventManager {
866
- protected logFn?: () => LoggerInterface | undefined;
860
+ logFn?: () => LoggerInterface | undefined;
867
861
  /**
868
862
  * List of events that can be triggered. Powered by $hook().
869
863
  */
@@ -909,7 +903,7 @@ declare class StateManager<State$1 extends object = State> {
909
903
  protected readonly als: AlsProvider;
910
904
  protected readonly events: EventManager;
911
905
  protected readonly codec: JsonSchemaCodec;
912
- protected readonly atoms: Map<keyof State$1, Atom<TObject$1<TypeBox.TProperties>, string>>;
906
+ protected readonly atoms: Map<keyof State$1, Atom<TObject$1<typebox0.TProperties>, string>>;
913
907
  protected store: Partial<State$1>;
914
908
  constructor(store?: Partial<State$1>);
915
909
  getAtoms(context?: boolean): Array<AtomWithValue>;
@@ -922,8 +916,8 @@ declare class StateManager<State$1 extends object = State> {
922
916
  /**
923
917
  * Set a value in the state
924
918
  */
925
- set<T extends TAtomObject>(target: Atom<T>, value: AtomStatic<T>): this;
926
- set<Key extends keyof State$1>(target: Key, value: State$1[Key] | undefined): this;
919
+ set<T extends TAtomObject>(target: Atom<T>, value: AtomStatic<T>, options?: SetStateOptions): this;
920
+ set<Key extends keyof State$1>(target: Key, value: State$1[Key] | undefined, options?: SetStateOptions): this;
927
921
  /**
928
922
  * Mutate a value in the state.
929
923
  */
@@ -940,7 +934,7 @@ declare class StateManager<State$1 extends object = State> {
940
934
  /**
941
935
  * Push a value to an array in the state
942
936
  */
943
- push<Key extends keyof OnlyArray<State$1>>(key: Key, value: NonNullable<State$1[Key]> extends Array<infer U> ? U : never): this;
937
+ push<Key extends keyof OnlyArray<State$1>>(key: Key, ...value: Array<NonNullable<State$1[Key]> extends Array<infer U> ? U : never>): this;
944
938
  /**
945
939
  * Clear all state
946
940
  */
@@ -951,6 +945,10 @@ declare class StateManager<State$1 extends object = State> {
951
945
  keys(): (keyof State$1)[];
952
946
  }
953
947
  type OnlyArray<T extends object> = { [K in keyof T]: NonNullable<T[K]> extends Array<any> ? K : never };
948
+ interface SetStateOptions {
949
+ skipContext?: boolean;
950
+ skipEvents?: boolean;
951
+ }
954
952
  //#endregion
955
953
  //#region ../../src/core/Alepha.d.ts
956
954
  /**
@@ -1107,12 +1105,6 @@ declare class Alepha {
1107
1105
  * A promise that resolves when the App has started.
1108
1106
  */
1109
1107
  protected starting?: PromiseWithResolvers<this>;
1110
- /**
1111
- * Initial state of the container.
1112
- *
1113
- * > Used to initialize the StateManager.
1114
- */
1115
- protected init: Partial<State>;
1116
1108
  /**
1117
1109
  * During the instantiation process, we keep a list of pending instantiations.
1118
1110
  * > It allows us to detect circular dependencies.
@@ -1152,21 +1144,21 @@ declare class Alepha {
1152
1144
  *
1153
1145
  * Mocked for browser environments.
1154
1146
  */
1155
- get context(): AlsProvider;
1147
+ context: AlsProvider;
1156
1148
  /**
1157
1149
  * Event manager to handle lifecycle events and custom events.
1158
1150
  */
1159
- get events(): EventManager;
1151
+ events: EventManager;
1160
1152
  /**
1161
1153
  * State manager to store arbitrary values.
1162
1154
  */
1163
- get store(): StateManager<State>;
1155
+ store: StateManager<State>;
1164
1156
  /**
1165
1157
  * Codec manager for encoding and decoding data with different formats.
1166
1158
  *
1167
1159
  * Supports multiple codec formats (JSON, Protobuf, etc.) with a unified interface.
1168
1160
  */
1169
- get codec(): CodecManager;
1161
+ codec: CodecManager;
1170
1162
  /**
1171
1163
  * Get logger instance.
1172
1164
  */
@@ -1175,7 +1167,7 @@ declare class Alepha {
1175
1167
  * The environment variables for the App.
1176
1168
  */
1177
1169
  get env(): Readonly<Env>;
1178
- constructor(init?: Partial<State>);
1170
+ constructor(state?: Partial<State>);
1179
1171
  set<T extends TAtomObject>(target: Atom<T>, value: AtomStatic<T>): this;
1180
1172
  set<Key extends keyof State>(target: Key, value: State[Key] | undefined): this;
1181
1173
  /**
@@ -1328,6 +1320,15 @@ declare class Alepha {
1328
1320
  * @return The schema object with environment variables applied.
1329
1321
  */
1330
1322
  parseEnv<T extends TObject$1>(schema: T): Static$1<T>;
1323
+ /**
1324
+ * Get all environment variable schemas and their parsed values.
1325
+ *
1326
+ * This is useful for DevTools to display all expected environment variables.
1327
+ */
1328
+ getEnvSchemas(): Array<{
1329
+ schema: TSchema;
1330
+ values: Record<string, any>;
1331
+ }>;
1331
1332
  /**
1332
1333
  * Dump the current dependency graph of the App.
1333
1334
  *
@@ -1473,33 +1474,6 @@ interface Hooks {
1473
1474
  };
1474
1475
  }
1475
1476
  //#endregion
1476
- //#region ../../src/core/interfaces/Run.d.ts
1477
- interface RunOptions {
1478
- /**
1479
- * Environment variables to be used by the application.
1480
- * It will be merged with the current process environment.
1481
- */
1482
- env?: Env;
1483
- /**
1484
- * A callback that will be executed before the application starts.
1485
- */
1486
- configure?: (alepha: Alepha) => Async<void>;
1487
- /**
1488
- * A callback that will be executed once the application is ready.
1489
- * This is useful for initializing resources or starting background tasks.
1490
- */
1491
- ready?: (alepha: Alepha) => Async<void>;
1492
- /**
1493
- * If true, the application will .stop() after the ready callback is executed.
1494
- * Useful for one-time tasks!
1495
- */
1496
- once?: boolean;
1497
- /**
1498
- * If true, the application will run in cluster mode.
1499
- */
1500
- cluster?: boolean;
1501
- }
1502
- //#endregion
1503
1477
  //#region ../../src/core/constants/OPTIONS.d.ts
1504
1478
  /**
1505
1479
  * Used for primitives options.
@@ -1675,6 +1649,84 @@ declare function createPagination<T>(entities: T[], limit?: number, offset?: num
1675
1649
  direction: "asc" | "desc";
1676
1650
  }>): Page<T>;
1677
1651
  //#endregion
1652
+ //#region ../../src/core/helpers/jsonSchemaToTypeBox.d.ts
1653
+ /**
1654
+ * JSON Schema representation for conversion to TypeBox.
1655
+ */
1656
+ interface JsonSchemaObject {
1657
+ type?: string | string[];
1658
+ properties?: Record<string, JsonSchemaObject>;
1659
+ required?: string[];
1660
+ items?: JsonSchemaObject;
1661
+ enum?: (string | number | boolean)[];
1662
+ const?: unknown;
1663
+ format?: string;
1664
+ title?: string;
1665
+ description?: string;
1666
+ default?: unknown;
1667
+ minLength?: number;
1668
+ maxLength?: number;
1669
+ minimum?: number;
1670
+ maximum?: number;
1671
+ exclusiveMinimum?: number;
1672
+ exclusiveMaximum?: number;
1673
+ multipleOf?: number;
1674
+ pattern?: string;
1675
+ minItems?: number;
1676
+ maxItems?: number;
1677
+ uniqueItems?: boolean;
1678
+ "~kind"?: string;
1679
+ oneOf?: JsonSchemaObject[];
1680
+ anyOf?: JsonSchemaObject[];
1681
+ allOf?: JsonSchemaObject[];
1682
+ not?: JsonSchemaObject;
1683
+ $ref?: string;
1684
+ }
1685
+ /**
1686
+ * Converts a JSON Schema object to a TypeBox schema using Alepha's type system.
1687
+ *
1688
+ * This is useful when receiving JSON Schema from an API (e.g., configuration schemas)
1689
+ * and needing to use them with TypeBox-based form rendering or validation.
1690
+ *
1691
+ * **Supports:**
1692
+ * - Basic types: string, number, integer, boolean, null, object, array
1693
+ * - String formats: email, uuid, date-time, date, time, url/uri, binary, bigint, duration, color
1694
+ * - Enums (string enums)
1695
+ * - Nested objects with required/optional properties
1696
+ * - Arrays with item schemas
1697
+ * - Common validation options: minLength, maxLength, minimum, maximum, pattern
1698
+ *
1699
+ * **Not supported:**
1700
+ * - oneOf, anyOf, allOf, not (composition schemas)
1701
+ * - $ref (references)
1702
+ * - additionalProperties, patternProperties
1703
+ *
1704
+ * @param schema - JSON Schema object to convert
1705
+ * @returns TypeBox TSchema
1706
+ *
1707
+ * @example
1708
+ * ```ts
1709
+ * const jsonSchema = {
1710
+ * type: "object",
1711
+ * properties: {
1712
+ * email: { type: "string", format: "email" },
1713
+ * age: { type: "integer", minimum: 0 },
1714
+ * active: { type: "boolean" },
1715
+ * },
1716
+ * required: ["email"]
1717
+ * };
1718
+ *
1719
+ * const typeBoxSchema = jsonSchemaToTypeBox(jsonSchema);
1720
+ * // Equivalent to:
1721
+ * // t.object({
1722
+ * // email: t.email(),
1723
+ * // age: t.optional(t.integer({ minimum: 0 })),
1724
+ * // active: t.optional(t.boolean()),
1725
+ * // })
1726
+ * ```
1727
+ */
1728
+ declare function jsonSchemaToTypeBox(schema: JsonSchemaObject): TSchema$1;
1729
+ //#endregion
1678
1730
  //#region ../../src/core/interfaces/Pagination.d.ts
1679
1731
  /**
1680
1732
  * Generic pagination request parameters.
@@ -1908,7 +1960,35 @@ declare const pageQuerySchema: TObject<{
1908
1960
  }>;
1909
1961
  type PageQuery = Static<typeof pageQuerySchema>;
1910
1962
  //#endregion
1963
+ //#region ../../src/core/interfaces/Run.d.ts
1964
+ interface RunOptions {
1965
+ /**
1966
+ * Environment variables to be used by the application.
1967
+ * It will be merged with the current process environment.
1968
+ */
1969
+ env?: Env;
1970
+ /**
1971
+ * A callback that will be executed before the application starts.
1972
+ */
1973
+ configure?: (alepha: Alepha) => Async<void>;
1974
+ /**
1975
+ * A callback that will be executed once the application is ready.
1976
+ * This is useful for initializing resources or starting background tasks.
1977
+ */
1978
+ ready?: (alepha: Alepha) => Async<void>;
1979
+ /**
1980
+ * If true, the application will .stop() after the ready callback is executed.
1981
+ * Useful for one-time tasks!
1982
+ */
1983
+ once?: boolean;
1984
+ /**
1985
+ * If true, the application will run in cluster mode.
1986
+ */
1987
+ cluster?: boolean;
1988
+ }
1989
+ //#endregion
1911
1990
  //#region ../../src/core/index.d.ts
1991
+ declare const AlephaCore: Service<Module>;
1912
1992
  /**
1913
1993
  * Run Alepha application, trigger start lifecycle.
1914
1994
  *
@@ -1925,5 +2005,5 @@ type PageQuery = Static<typeof pageQuerySchema>;
1925
2005
  */
1926
2006
  declare const run: (entry: Alepha | Service | Array<Service>, opts?: RunOptions) => Alepha;
1927
2007
  //#endregion
1928
- export { $atom, $context, $env, $hook, $inject, $module, $use, AbstractClass, Alepha, AlephaError, AlsProvider, AppNotStartedError, Async, AsyncFn, AsyncLocalStorageData, Atom, AtomOptions, AtomStatic, AtomWithValue, CircularDependencyError, CodecManager, ContainerLockedError, ContextPrimitive, DecodeOptions, EncodeOptions, EncodeResult, Encoding, Env, EventManager, FileLike, Hook, HookOptions, HookPrimitive, Hooks, InjectOptions, InjectPrimitive, InstantiableClass, JsonSchemaCodec, KIND, LogLevel, LoggerInterface, MaybePromise, Module, ModulePrimitiveOptions, OPTIONS, Page, PageMetadata, PageQuery, PageRequest, Primitive, PrimitiveArgs, PrimitiveConfig, PrimitiveFactory, PrimitiveFactoryLike, RunFunction, SchemaCodec, Service, ServiceEntry, ServiceSubstitution, SortDirection, SortField, State, StateManager, type Static, type StaticDecode, type StaticEncode, StreamLike, type TAny, type TArray, TAtomObject, type TBigInt, type TBoolean, TFile, type TInteger, type TKeysToIndexer, type TNull, type TNumber, type TNumberOptions, type TObject, type TObjectOptions, type TOptional, type TOptionalAdd, TPage, type TPick, type TProperties, type TRecord, type TSchema, TStream, type TString, type TStringOptions, TTextOptions, type TTuple, type TUnion, type TUnsafe, type TVoid, TextLength, TooLateSubstitutionError, TypeBox, TypeBoxError, TypeBoxErrorParams, TypeBoxFormat, TypeBoxValue, TypeGuard, TypeProvider, WithModule, createPagination, createPrimitive, isClass, isDate, isDateTime, isDuration, isEmail, isFileLike, isTime, isTypeFile, isURL, isUUID, pageMetadataSchema, pageQuerySchema, pageSchema, run, t };
2008
+ export { $atom, $context, $env, $hook, $inject, $module, $use, AbstractClass, Alepha, AlephaCore, AlephaError, AlsProvider, AppNotStartedError, Async, AsyncFn, AsyncLocalStorageData, Atom, AtomOptions, AtomStatic, AtomWithValue, CircularDependencyError, CodecManager, ContainerLockedError, ContextPrimitive, DecodeOptions, EncodeOptions, EncodeResult, Encoding, Env, EventManager, FileLike, Format, Hook, HookOptions, HookPrimitive, Hooks, InjectOptions, InjectPrimitive, InstantiableClass, JsonSchemaCodec, JsonSchemaObject, KIND, LogLevel, LoggerInterface, MaybePromise, Module, ModulePrimitiveOptions, OPTIONS, Page, PageMetadata, PageQuery, PageRequest, Primitive, PrimitiveArgs, PrimitiveConfig, PrimitiveFactory, PrimitiveFactoryLike, RunFunction, SchemaCodec, Service, ServiceEntry, ServiceSubstitution, SetStateOptions, SortDirection, SortField, State, StateManager, type Static, type StaticDecode, type StaticEncode, StreamLike, type TAny, type TArray, TAtomObject, type TBigInt, type TBoolean, TFile, type TInteger, type TKeysToIndexer, type TNull, type TNumber, type TNumberOptions, type TObject, type TObjectOptions, type TOptional, type TOptionalAdd, TPage, type TPick, type TProperties, type TRecord, type TSchema, TStream, type TString, type TStringOptions, TTextOptions, type TTuple, type TUnion, type TUnsafe, type TVoid, TextLength, TooLateSubstitutionError, Type, TypeBoxError, TypeBoxErrorParams, TypeGuard, TypeProvider, Value, WithModule, createPagination, createPrimitive, isClass, isFileLike, isTypeFile, isUUID, jsonSchemaToTypeBox, pageMetadataSchema, pageQuerySchema, pageSchema, run, t };
1929
2009
  //# sourceMappingURL=index.d.ts.map