alepha 0.9.2 → 0.9.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/core.d.ts CHANGED
@@ -14,7 +14,14 @@ import { ReadableStream as ReadableStream$1 } from "node:stream/web";
14
14
  * @internal
15
15
  */
16
16
  declare const KIND: unique symbol;
17
- //# sourceMappingURL=KIND.d.ts.map
17
+ //#endregion
18
+ //#region src/constants/MODULE.d.ts
19
+ /**
20
+ * Used for identifying modules.
21
+ *
22
+ * @internal
23
+ */
24
+ declare const MODULE: unique symbol;
18
25
  //#endregion
19
26
  //#region src/interfaces/Service.d.ts
20
27
  /**
@@ -61,15 +68,8 @@ interface ServiceSubstitution<T extends object = any> {
61
68
  * And yes, you declare the *type* of the service, not the *instance*.
62
69
  */
63
70
  type ServiceEntry<T extends object = any> = Service<T> | ServiceSubstitution<T>;
64
- //# sourceMappingURL=Service.d.ts.map
65
71
  //#endregion
66
72
  //#region src/helpers/descriptor.d.ts
67
- declare const descriptorEvents: {
68
- events: Map<Service, ((alepha: Alepha) => void)[]>;
69
- on(descriptor: Service, callback: (alepha: Alepha) => void): void;
70
- emit(descriptor: Service, alepha: Alepha): void;
71
- bind(when: Service, register: Service): void;
72
- };
73
73
  interface DescriptorArgs<T extends object = {}> {
74
74
  options: T;
75
75
  alepha: Alepha;
@@ -99,20 +99,112 @@ type DescriptorFactoryLike<T extends object = any> = {
99
99
  (options: T): any;
100
100
  [KIND]: any;
101
101
  };
102
- declare const createDescriptor: <TDescriptor extends Descriptor>(descriptor: InstantiableClass<TDescriptor>, options: TDescriptor["options"]) => TDescriptor;
103
- //# sourceMappingURL=descriptor.d.ts.map
102
+ declare const createDescriptor: <TDescriptor extends Descriptor>(descriptor: InstantiableClass<TDescriptor> & {
103
+ [MODULE]?: Service;
104
+ }, options: TDescriptor["options"]) => TDescriptor;
104
105
  //#endregion
105
- //#region src/helpers/Module.d.ts
106
- interface Module {
107
- $name?: string;
108
- $services: (alepha: Alepha) => void | Alepha;
106
+ //#region src/descriptors/$inject.d.ts
107
+ /**
108
+ * Get the instance of the specified type from the context.
109
+ *
110
+ * ```ts
111
+ * class A { }
112
+ * class B {
113
+ * a = $inject(A);
114
+ * }
115
+ * ```
116
+ */
117
+ declare const $inject: <T extends object>(type: Service<T>, opts?: InjectOptions<T>) => T;
118
+ declare class InjectDescriptor extends Descriptor {}
119
+ interface InjectOptions<T extends object = any> {
120
+ /**
121
+ * Ignore current existing instance.
122
+ */
123
+ skipCache?: boolean;
124
+ /**
125
+ * Don't store the instance in the registry.
126
+ */
127
+ skipRegistration?: boolean;
128
+ /**
129
+ * Constructor arguments to pass when creating a new instance.
130
+ */
131
+ args?: ConstructorParameters<InstantiableClass<T>>;
132
+ /**
133
+ * Parent service that requested the instance.
134
+ * @internal
135
+ */
136
+ parent?: Service | null;
137
+ }
138
+ //#endregion
139
+ //#region src/constants/OPTIONS.d.ts
140
+ /**
141
+ * Used for descriptors options.
142
+ *
143
+ * @internal
144
+ */
145
+ declare const OPTIONS: unique symbol;
146
+ //#endregion
147
+ //#region src/descriptors/$module.d.ts
148
+ /**
149
+ * Wrap services and descriptors into a module.
150
+ *
151
+ * Module is just a class.
152
+ * You must attach a `name` to it.
153
+ *
154
+ * It's recommended to use `project.module.submodule` format.
155
+ *
156
+ * @example
157
+ * ```ts
158
+ * import { $module } from "alepha";
159
+ * import { MyService } from "./MyService.ts";
160
+ *
161
+ * // export MyService so it can be used everywhere
162
+ * export * from "./MyService.ts";
163
+ *
164
+ * export default $module({
165
+ * name: "my.project.module",
166
+ * // MyService will have a module context "my.project.module"
167
+ * services: [MyService],
168
+ * });
169
+ * ```
170
+ *
171
+ * - Module is used for logging and other purposes.
172
+ * - It's useful for large applications or libraries to group services and descriptors together.
173
+ * - It's probably overkill for small applications.
174
+ */
175
+ declare const $module: (options: ModuleDescriptorOptions) => Service<Module>;
176
+ interface ModuleDescriptorOptions {
177
+ /**
178
+ * Name of the module.
179
+ *
180
+ * It should be in the format of `project.module.submodule`.
181
+ */
182
+ name: string;
183
+ /**
184
+ * List of services to register in the module.
185
+ */
186
+ services?: Array<Service>;
187
+ /**
188
+ * List of $descriptors to register in the module.
189
+ */
190
+ descriptors?: Array<DescriptorFactoryLike>;
191
+ /**
192
+ * By default, module will register all services.
193
+ * You can override this behavior by providing a register function.
194
+ * It's useful when you want to register services conditionally or in a specific order.
195
+ */
196
+ register?: (alepha: Alepha) => void;
109
197
  }
110
- interface ModuleDefinition extends Module {
111
- services: Array<Service>;
198
+ interface Module {
199
+ [KIND]: "MODULE";
200
+ [OPTIONS]: ModuleDescriptorOptions;
201
+ register: (alepha: Alepha) => void;
112
202
  }
203
+ type ServiceWithModule<T extends object = any> = T & {
204
+ [MODULE]?: Service;
205
+ };
113
206
  declare const isModule: (value: unknown) => value is Module;
114
207
  declare const toModuleName: (name: string) => string;
115
- //# sourceMappingURL=Module.d.ts.map
116
208
  //#endregion
117
209
  //#region src/interfaces/Async.d.ts
118
210
  /**
@@ -127,13 +219,22 @@ type AsyncFn = (...args: any[]) => Async<any>;
127
219
  * Transforms a type T into a promise if it is not already a promise.
128
220
  */
129
221
  type MaybePromise<T> = T extends Promise<any> ? T : Promise<T>;
130
- //# sourceMappingURL=Async.d.ts.map
222
+ //#endregion
223
+ //#region src/interfaces/LoggerInterface.d.ts
224
+ type LogLevel = "error" | "warn" | "info" | "debug" | "trace" | "silent";
225
+ interface LoggerInterface {
226
+ trace(message: string, data?: unknown): void;
227
+ debug(message: string, data?: unknown): void;
228
+ info(message: string, data?: unknown): void;
229
+ warn(message: string, data?: unknown): void;
230
+ error(message: string, data?: unknown): void;
231
+ }
131
232
  //#endregion
132
233
  //#region src/providers/AlsProvider.d.ts
133
234
  type AsyncLocalStorageData = any;
134
235
  declare class AlsProvider {
135
236
  static create: () => AsyncLocalStorage<AsyncLocalStorageData> | undefined;
136
- protected als?: AsyncLocalStorage<AsyncLocalStorageData>;
237
+ als?: AsyncLocalStorage<AsyncLocalStorageData>;
137
238
  constructor();
138
239
  createContextId(): string;
139
240
  run<R>(callback: () => R, data?: Record<string, any>): R;
@@ -141,150 +242,6 @@ declare class AlsProvider {
141
242
  get<T>(key: string): T | undefined;
142
243
  set<T>(key: string, value: T): void;
143
244
  }
144
- //# sourceMappingURL=AlsProvider.d.ts.map
145
- //#endregion
146
- //#region src/services/Logger.d.ts
147
- type LogLevel = "error" | "warn" | "info" | "debug" | "trace" | "silent";
148
- interface LoggerEnv {
149
- /**
150
- * Default log level for the application.
151
- * Default by environment:
152
- * - dev = "debug"
153
- * - test = "error"
154
- * - prod = "info"
155
- *
156
- * "trace" | "debug" | "info" | "warn" | "error" | "silent"
157
- */
158
- LOG_LEVEL?: string;
159
- /**
160
- * Disable colors in the console output.
161
- */
162
- NO_COLOR?: string;
163
- /**
164
- * Force color output for the application.
165
- */
166
- FORCE_COLOR?: string;
167
- /**
168
- * Log format.
169
- *
170
- * @default "text"
171
- */
172
- LOG_FORMAT?: "json" | "text" | "cli" | "raw";
173
- }
174
- interface LoggerOptions {
175
- /**
176
- * The logging level. Can be one of "error", "warn", "info", "debug", or "trace".
177
- */
178
- level?: string;
179
- /**
180
- * The name of the application. Used to identify the source of the log messages.
181
- */
182
- app?: string;
183
- /**
184
- * The name of the logger. Like a module name or a service name.
185
- */
186
- name?: string;
187
- /**
188
- * An optional context to include in the log output. Like a request ID or a correlation ID.
189
- */
190
- context?: string;
191
- /**
192
- * An optional tag to include in the log output. Like a class name or a module name.
193
- */
194
- caller?: string;
195
- /**
196
- * Whether to use colors in the log output. Defaults to true.
197
- */
198
- color?: boolean;
199
- /**
200
- * Log output format. Can be "json", "text", or "cli".
201
- */
202
- format?: string;
203
- /**
204
- * An optional async local storage provider to use for storing context information.
205
- */
206
- als?: AlsProvider;
207
- }
208
- declare const COLORS: {
209
- reset: string;
210
- grey: string;
211
- red: string;
212
- orange: string;
213
- green: string;
214
- blue: string;
215
- white: string;
216
- cyan: string;
217
- darkGrey: string;
218
- };
219
- declare const LEVEL_COLORS: Record<string, string>;
220
- declare class Logger {
221
- protected levelOrder: Record<string, number>;
222
- readonly level: string;
223
- readonly rawLevel: string;
224
- readonly name: string;
225
- protected caller: string;
226
- protected context: string;
227
- protected app: string;
228
- protected color: boolean;
229
- protected format: string;
230
- protected als?: AlsProvider;
231
- constructor(options?: LoggerOptions);
232
- parseLevel(level: string, app: string): LogLevel;
233
- asLogLevel(something: string): LogLevel;
234
- child(options: LoggerOptions): Logger;
235
- error(message: unknown, data?: object | Error | string | unknown): void;
236
- warn(message: unknown, data?: object | Error | string): void;
237
- info(message: unknown, data?: object | Error | string): void;
238
- debug(message: unknown, data?: object | Error | string): void;
239
- trace(message: unknown, data?: object | Error | string): void;
240
- /**
241
- * Log a message to the console.
242
- */
243
- protected log(level: LogLevel, message: unknown, data?: object | Error | string): void;
244
- /**
245
- * Print a log message to the console.
246
- */
247
- protected print(formatted: string): void;
248
- /**
249
- * Format a log message to JSON.
250
- */
251
- protected formatJson(level: LogLevel, message: unknown, data?: object | Error | string): string;
252
- protected formatJsonError(error: Error): object;
253
- /**
254
- * Format a log message to a string.
255
- */
256
- protected formatLog(level: LogLevel, message: string, data?: object | Error): string;
257
- protected nowTimeFormatted(): string;
258
- protected pad2: (n: number) => string;
259
- protected pad3: (n: number) => string;
260
- protected colorize(color: string, text: string, reset?: string): string;
261
- /**
262
- * Format an error to a string.
263
- *
264
- * @param error
265
- * @protected
266
- */
267
- protected formatError(error: Error): string;
268
- }
269
- declare class MockLogger extends Logger {
270
- store: MockLoggerStore;
271
- constructor(options?: LoggerOptions & {
272
- store: MockLoggerStore;
273
- });
274
- print(msg: string): void;
275
- child(options: LoggerOptions): MockLogger;
276
- reset(): void;
277
- }
278
- interface MockLoggerStore {
279
- stack: Array<{
280
- date: string;
281
- level: string;
282
- message: string;
283
- context?: string;
284
- app?: string;
285
- } & Record<string, any>>;
286
- }
287
- //# sourceMappingURL=Logger.d.ts.map
288
245
  //#endregion
289
246
  //#region src/Alepha.d.ts
290
247
  /**
@@ -385,7 +342,7 @@ interface MockLoggerStore {
385
342
  * onCustomerHook = $hook({
386
343
  * on: "my:custom:hook",
387
344
  * handler: () => {
388
- * this.log.info("App is being configured");
345
+ * this.log?.info("App is being configured");
389
346
  * },
390
347
  * });
391
348
  * }
@@ -495,10 +452,9 @@ declare class Alepha {
495
452
  *
496
453
  * Modules are used to group services and provide a way to register them in the container.
497
454
  */
498
- protected modules: Array<ModuleDefinition>;
455
+ protected modules: Array<Module>;
499
456
  protected substitutions: Map<Service, {
500
457
  use: Service;
501
- module?: ModuleDefinition;
502
458
  }>;
503
459
  protected configurations: Map<Service, object>;
504
460
  protected descriptorRegistry: Map<Service<Descriptor<{}>>, Descriptor<{}>[]>;
@@ -513,7 +469,7 @@ declare class Alepha {
513
469
  /**
514
470
  * Get logger instance.
515
471
  */
516
- get log(): Logger;
472
+ get log(): LoggerInterface | undefined;
517
473
  /**
518
474
  * The environment variables for the App.
519
475
  */
@@ -649,31 +605,7 @@ declare class Alepha {
649
605
  *
650
606
  * @return The instance of the specified class or type.
651
607
  */
652
- inject<T extends object>(service: Service<T>, opts?: {
653
- /**
654
- * Ignore current existing instance.
655
- */
656
- skipCache?: boolean;
657
- /**
658
- * Don't store the instance in the registry.
659
- */
660
- skipRegistration?: boolean;
661
- /**
662
- * Constructor arguments to pass when creating a new instance.
663
- */
664
- args?: ConstructorParameters<InstantiableClass<T>>;
665
- /**
666
- * Parent service that requested the instance.
667
- * @internal
668
- */
669
- parent?: Service | null;
670
- /**
671
- * If the service is provided by a module, the module definition.
672
- * @internal
673
- */
674
- module?: ModuleDefinition;
675
- }): T;
676
- protected pushModule(instance: Module): void;
608
+ inject<T extends object>(service: Service<T>, opts?: InjectOptions<T>): T;
677
609
  /**
678
610
  * Configures the specified service with the provided state.
679
611
  * If service is not registered, it will do nothing.
@@ -774,14 +706,10 @@ declare class Alepha {
774
706
  module?: string;
775
707
  }>;
776
708
  descriptors<TDescriptor extends Descriptor>(factory: {
777
- [KIND]: InstantiableClass<TDescriptor> | string;
778
- }): Array<TDescriptor>;
779
- protected new<T extends object>(service: Service<T>, args?: any[], module?: ModuleDefinition): T;
709
+ [KIND]: InstantiableClass<TDescriptor>;
710
+ } | string): Array<TDescriptor>;
711
+ protected new<T extends object>(service: Service<T>, args?: any[]): T;
780
712
  protected processDescriptor(value: Descriptor, propertyKey?: string): void;
781
- /**
782
- * @internal
783
- */
784
- protected createLogger(env: Env): Logger;
785
713
  }
786
714
  interface Hook<T extends keyof Hooks = any> {
787
715
  caller?: Service;
@@ -804,9 +732,9 @@ interface ServiceDefinition<T extends object = any> {
804
732
  /**
805
733
  * If the service is provided by a module, the module definition.
806
734
  */
807
- module?: ModuleDefinition;
735
+ module?: Service;
808
736
  }
809
- interface Env extends LoggerEnv {
737
+ interface Env {
810
738
  [key: string]: string | boolean | number | undefined;
811
739
  /**
812
740
  * Optional environment variable that indicates the current environment.
@@ -822,7 +750,7 @@ interface Env extends LoggerEnv {
822
750
  MODULE_NAME?: string;
823
751
  }
824
752
  interface State {
825
- log: Logger;
753
+ log?: LoggerInterface;
826
754
  env?: Readonly<Env>;
827
755
  /**
828
756
  * If defined, the Alepha container will only register this service and its dependencies.
@@ -899,17 +827,16 @@ interface RunOptions {
899
827
  */
900
828
  cluster?: boolean;
901
829
  }
902
- //# sourceMappingURL=Run.d.ts.map
903
830
  //#endregion
904
- //#region src/constants/OPTIONS.d.ts
831
+ //#region src/constants/PRIMITIVE.d.ts
905
832
  /**
906
- * Used for descriptors options.
833
+ * Symbol to mark a value as a primitive.
834
+ *
835
+ * Used to enhance TypeBox types with metadata. See @alepha/protobuf.
907
836
  *
908
837
  * @internal
909
838
  */
910
- declare const OPTIONS: unique symbol;
911
- //# sourceMappingURL=OPTIONS.d.ts.map
912
-
839
+ declare const PRIMITIVE: unique symbol;
913
840
  //#endregion
914
841
  //#region src/descriptors/$cursor.d.ts
915
842
  /**
@@ -943,12 +870,10 @@ declare const $cursor: () => CursorDescriptor;
943
870
  */
944
871
  declare const __alephaRef: {
945
872
  context?: Alepha;
946
- definition?: Service;
947
- module?: ModuleDefinition;
948
- $services?: {
949
- module: ModuleDefinition;
950
- parent: Service;
873
+ definition?: Service & {
874
+ [MODULE]?: Service;
951
875
  };
876
+ parent?: Service;
952
877
  };
953
878
  /**
954
879
  * Cursor descriptor.
@@ -956,9 +881,8 @@ declare const __alephaRef: {
956
881
  interface CursorDescriptor {
957
882
  context: Alepha;
958
883
  definition?: Service;
959
- module?: ModuleDefinition;
884
+ module?: Service;
960
885
  }
961
- //# sourceMappingURL=$cursor.d.ts.map
962
886
  //#endregion
963
887
  //#region src/descriptors/$env.d.ts
964
888
  /**
@@ -988,8 +912,6 @@ interface CursorDescriptor {
988
912
  * ```
989
913
  */
990
914
  declare const $env: <T extends TObject$1>(type: T) => Static$1<T>;
991
- //# sourceMappingURL=$env.d.ts.map
992
-
993
915
  //#endregion
994
916
  //#region src/descriptors/$hook.d.ts
995
917
  /**
@@ -1043,7 +965,7 @@ interface HookOptions<T extends keyof Hooks> {
1043
965
  /**
1044
966
  * The handler to run when the hook is triggered.
1045
967
  */
1046
- handler: (app: Hooks[T]) => Async<any>;
968
+ handler: (args: Hooks[T]) => Async<any>;
1047
969
  /**
1048
970
  * Force the hook to run first or last on the list of hooks.
1049
971
  */
@@ -1061,152 +983,81 @@ declare class HookDescriptor<T extends keyof Hooks> extends Descriptor<HookOptio
1061
983
  called: number;
1062
984
  protected onInit(): void;
1063
985
  }
1064
- //# sourceMappingURL=$hook.d.ts.map
1065
- //#endregion
1066
- //#region src/descriptors/$inject.d.ts
1067
- /**
1068
- * Get the instance of the specified type from the context.
1069
- *
1070
- * ```ts
1071
- * class A { }
1072
- * class B {
1073
- * a = $inject(A);
1074
- * }
1075
- * ```
1076
- */
1077
- declare const $inject: <T extends object>(type: Service<T>) => T;
1078
- declare class InjectDescriptor extends Descriptor {}
1079
- //# sourceMappingURL=$inject.d.ts.map
1080
-
1081
- //#endregion
1082
- //#region src/descriptors/$logger.d.ts
1083
- /**
1084
- * Create a logger.
1085
- *
1086
- * `name` is optional, by default it will use the name of the service.
1087
- *
1088
- * @example
1089
- * ```ts
1090
- * import { $logger } from "alepha";
1091
- *
1092
- * class MyService {
1093
- * log = $logger();
1094
- *
1095
- * constructor() {
1096
- * // print something like 'date - [MyService] Service initialized'
1097
- * this.log.info("Service initialized");
1098
- * }
1099
- * }
1100
- * ```
1101
- */
1102
- declare const $logger: {
1103
- (options?: LoggerDescriptorOptions): Logger;
1104
- [KIND]: typeof Logger;
1105
- };
1106
- interface LoggerDescriptorOptions {
1107
- name?: string;
1108
- }
1109
- //# sourceMappingURL=$logger.d.ts.map
1110
-
1111
- //#endregion
1112
- //#region src/descriptors/$module.d.ts
1113
- /**
1114
- * Wrap services and descriptors into a module.
1115
- *
1116
- * Module is just a class.
1117
- * You must attach a `name` to it.
1118
- *
1119
- * It's recommended to use `project.module.submodule` format.
1120
- *
1121
- * @example
1122
- * ```ts
1123
- * import { $module } from "alepha";
1124
- * import { MyService } from "./MyService.ts";
1125
- *
1126
- * // export MyService so it can be used everywhere
1127
- * export * from "./MyService.ts";
1128
- *
1129
- * export default $module({
1130
- * name: "my.project.module",
1131
- * // MyService will have a module context "my.project.module"
1132
- * services: [MyService],
1133
- * });
1134
- * ```
1135
- *
1136
- * - Module is used for logging and other purposes.
1137
- * - It's useful for large applications or libraries to group services and descriptors together.
1138
- * - It's probably overkill for small applications.
1139
- */
1140
- declare const $module: (args: ModuleDescriptorOptions) => ModuleDescriptor;
1141
- type ModuleDescriptor = Service<Module>;
1142
- interface ModuleDescriptorOptions {
1143
- /**
1144
- * Name of the module.
1145
- *
1146
- * It should be in the format of `project.module.submodule`.
1147
- */
1148
- name: string;
1149
- /**
1150
- * List of services to register in the module.
1151
- */
1152
- services?: Array<ServiceEntry>;
1153
- /**
1154
- * List of $descriptors to register in the module.
1155
- */
1156
- descriptors?: Array<DescriptorFactoryLike>;
1157
- /**
1158
- * By default, module will register all services.
1159
- * You can override this behavior by providing a register function.
1160
- * It's useful when you want to register services conditionally or in a specific order.
1161
- */
1162
- register?: (alepha: Alepha) => void;
1163
- }
1164
- //# sourceMappingURL=$module.d.ts.map
1165
986
  //#endregion
1166
987
  //#region src/errors/AlephaError.d.ts
1167
988
  /**
1168
989
  * Default error class for Alepha.
1169
990
  */
1170
- declare class AlephaError extends Error {}
1171
- //# sourceMappingURL=AlephaError.d.ts.map
991
+ declare class AlephaError extends Error {
992
+ name: string;
993
+ }
1172
994
  //#endregion
1173
995
  //#region src/errors/AppNotStartedError.d.ts
1174
996
  declare class AppNotStartedError extends Error {
997
+ readonly name = "AppNotStartedError";
1175
998
  constructor();
1176
999
  }
1177
- //# sourceMappingURL=AppNotStartedError.d.ts.map
1178
1000
  //#endregion
1179
1001
  //#region src/errors/CircularDependencyError.d.ts
1180
1002
  declare class CircularDependencyError extends Error {
1003
+ readonly name = "CircularDependencyError";
1181
1004
  constructor(provider: string, parents?: string[]);
1182
1005
  }
1183
- //# sourceMappingURL=CircularDependencyError.d.ts.map
1184
1006
  //#endregion
1185
1007
  //#region src/errors/ContainerLockedError.d.ts
1186
1008
  declare class ContainerLockedError extends Error {
1009
+ readonly name = "ContainerLockedError";
1187
1010
  constructor(message?: string);
1188
1011
  }
1189
- //# sourceMappingURL=ContainerLockedError.d.ts.map
1190
- //#endregion
1191
- //#region src/errors/NotImplementedError.d.ts
1192
- declare class NotImplementedError extends Error {
1193
- constructor(provider: string);
1194
- }
1195
- //# sourceMappingURL=NotImplementedError.d.ts.map
1196
1012
  //#endregion
1197
1013
  //#region src/errors/TypeBoxError.d.ts
1198
1014
  declare class TypeBoxError extends Error {
1015
+ readonly name = "TypeBoxError";
1199
1016
  readonly value: ValueError;
1200
1017
  constructor(value: ValueError);
1201
1018
  }
1202
- //# sourceMappingURL=TypeBoxError.d.ts.map
1203
-
1204
1019
  //#endregion
1205
1020
  //#region src/providers/TypeProvider.d.ts
1206
1021
  declare class TypeProvider {
1207
- static DEFAULT_STRING_MAX_LENGTH: number;
1208
- static DEFAULT_LONG_STRING_MAX_LENGTH: number;
1209
- static DEFAULT_RICH_STRING_MAX_LENGTH: number;
1022
+ /**
1023
+ * Default maximum length for strings.
1024
+ *
1025
+ * It can be set to a larger value:
1026
+ * ```ts
1027
+ * TypeProvider.DEFAULT_STRING_MAX_LENGTH = 1000000;
1028
+ * TypeProvider.DEFAULT_STRING_MAX_LENGTH = undefined; // no limit (not recommended)
1029
+ * ```
1030
+ */
1031
+ static DEFAULT_STRING_MAX_LENGTH: number | undefined;
1032
+ static DEFAULT_SHORT_STRING_MAX_LENGTH: number | undefined;
1033
+ /**
1034
+ * Maximum length for long strings, such as descriptions or comments.
1035
+ * It can be overridden in the string options.
1036
+ *
1037
+ * It can be set to a larger value:
1038
+ * ```ts
1039
+ * TypeProvider.DEFAULT_LONG_STRING_MAX_LENGTH = 2048;
1040
+ * ```
1041
+ */
1042
+ static DEFAULT_LONG_STRING_MAX_LENGTH: number | undefined;
1043
+ /**
1044
+ * Maximum length for rich strings, such as HTML or Markdown.
1045
+ * This is a large value to accommodate rich text content.
1046
+ * > It's also the maximum length of PG's TEXT type.
1047
+ *
1048
+ * It can be overridden in the string options.
1049
+ *
1050
+ * It can be set to a larger value:
1051
+ * ```ts
1052
+ * TypeProvider.DEFAULT_RICH_STRING_MAX_LENGTH = 1000000;
1053
+ * ```
1054
+ */
1055
+ static DEFAULT_RICH_STRING_MAX_LENGTH: number | undefined;
1056
+ /**
1057
+ * Maximum number of items in an array.
1058
+ * This is a default value to prevent excessive memory usage.
1059
+ * It can be overridden in the array options.
1060
+ */
1210
1061
  static DEFAULT_ARRAY_MAX_ITEMS: number;
1211
1062
  static FormatRegistry: typeof FormatRegistry;
1212
1063
  raw: TypeBox.JavaScriptTypeBuilder;
@@ -1288,7 +1139,7 @@ declare class TypeProvider {
1288
1139
  * Create a schema for a bigint. Bigint is a 64-bit integer.
1289
1140
  * This is a workaround for TypeBox, which does not support bigint natively.
1290
1141
  */
1291
- bigint(options?: IntegerOptions): TNumber$1;
1142
+ bigint(options?: NumberOptions): TNumber$1;
1292
1143
  /**
1293
1144
  * Make a schema optional.
1294
1145
  *
@@ -1431,7 +1282,6 @@ declare function isISODate(str: string): boolean;
1431
1282
  declare function isISODateTime(value: string): boolean;
1432
1283
  declare function isUUID(value: string): boolean;
1433
1284
  declare function isEmail(value: string): boolean;
1434
- //# sourceMappingURL=TypeProvider.d.ts.map
1435
1285
  //#endregion
1436
1286
  //#region src/index.d.ts
1437
1287
  declare global {
@@ -1446,8 +1296,6 @@ declare global {
1446
1296
  *
1447
1297
  */
1448
1298
  declare const run: (entry: Alepha | Service | Array<Service>, opts?: RunOptions) => void;
1449
- //# sourceMappingURL=index.d.ts.map
1450
-
1451
1299
  //#endregion
1452
- export { $cursor, $env, $hook, $inject, $logger, $module, AbstractClass, Alepha, AlephaError, AlephaStringOptions, AlsProvider, AppNotStartedError, Async, AsyncFn, AsyncLocalStorageData, COLORS, CircularDependencyError, ContainerLockedError, CursorDescriptor, Descriptor, DescriptorArgs, DescriptorConfig, DescriptorFactory, DescriptorFactoryLike, Env, FileLike, Hook, HookDescriptor, HookOptions, Hooks, InjectDescriptor, InstantiableClass, KIND, LEVEL_COLORS, LogLevel, Logger, LoggerDescriptorOptions, LoggerEnv, LoggerOptions, MaybePromise, MockLogger, MockLoggerStore, Module, ModuleDefinition, ModuleDescriptor, ModuleDescriptorOptions, NotImplementedError, OPTIONS, Service, ServiceEntry, ServiceSubstitution, State, type Static, type StaticDecode, type StaticEncode, StreamLike, type TAny, type TArray, type TBoolean, TFile, type TNumber, type TObject, type TOptional, type TProperties, type TRecord, type TSchema, TStream, type TString, TextLength, TypeBox, TypeBoxError, TypeBoxValue, TypeGuard, TypeProvider, __alephaRef, createDescriptor, descriptorEvents, isEmail, isFileLike, isISODate, isISODateTime, isModule, isTypeFile, isTypeStream, isUUID, run, t, toModuleName };
1300
+ export { $cursor, $env, $hook, $inject, $module, AbstractClass, Alepha, AlephaError, AlephaStringOptions, AlsProvider, AppNotStartedError, Async, AsyncFn, AsyncLocalStorageData, CircularDependencyError, ContainerLockedError, CursorDescriptor, Descriptor, DescriptorArgs, DescriptorConfig, DescriptorFactory, DescriptorFactoryLike, Env, FileLike, Hook, HookDescriptor, HookOptions, Hooks, InjectDescriptor, InjectOptions, InstantiableClass, KIND, LogLevel, LoggerInterface, MaybePromise, Module, ModuleDescriptorOptions, OPTIONS, PRIMITIVE, Service, ServiceEntry, ServiceSubstitution, ServiceWithModule, State, type Static, type StaticDecode, type StaticEncode, StreamLike, type TAny, type TArray, type TBoolean, TFile, type TNumber, type TObject, type TOptional, type TProperties, type TRecord, type TSchema, TStream, type TString, TextLength, TypeBox, TypeBoxError, TypeBoxValue, TypeGuard, TypeProvider, __alephaRef, createDescriptor, isEmail, isFileLike, isISODate, isISODateTime, isModule, isTypeFile, isTypeStream, isUUID, run, t, toModuleName };
1453
1301
  //# sourceMappingURL=index.d.ts.map