@alepha/react 0.11.12 → 0.12.1

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 (85) hide show
  1. package/dist/auth/chunk-DhGyd7sr.js +28 -0
  2. package/dist/auth/index.browser.js +394 -114
  3. package/dist/auth/index.browser.js.map +1 -1
  4. package/dist/auth/index.cjs +80 -1927
  5. package/dist/auth/index.cjs.map +1 -1
  6. package/dist/auth/index.d.cts +1130 -420
  7. package/dist/auth/index.d.ts +1130 -420
  8. package/dist/auth/index.js +72 -1918
  9. package/dist/auth/index.js.map +1 -1
  10. package/dist/core/chunk-DhGyd7sr.js +28 -0
  11. package/dist/core/index.browser.js +79 -79
  12. package/dist/core/index.browser.js.map +1 -1
  13. package/dist/core/index.cjs +89 -85
  14. package/dist/core/index.cjs.map +1 -1
  15. package/dist/core/index.d.cts +1654 -154
  16. package/dist/core/index.d.ts +1654 -154
  17. package/dist/core/index.js +79 -79
  18. package/dist/core/index.js.map +1 -1
  19. package/dist/form/chunk-DhGyd7sr.js +28 -0
  20. package/dist/form/index.cjs +28 -8
  21. package/dist/form/index.cjs.map +1 -1
  22. package/dist/form/index.d.cts +215 -7
  23. package/dist/form/index.d.ts +215 -7
  24. package/dist/form/index.js +18 -3
  25. package/dist/form/index.js.map +1 -1
  26. package/dist/head/chunk-DhGyd7sr.js +28 -0
  27. package/dist/head/index.browser.js +385 -59
  28. package/dist/head/index.browser.js.map +1 -1
  29. package/dist/head/index.cjs +12 -8
  30. package/dist/head/index.cjs.map +1 -1
  31. package/dist/head/index.d.cts +1230 -24
  32. package/dist/head/index.d.ts +1230 -29
  33. package/dist/head/index.js +2 -2
  34. package/dist/head/index.js.map +1 -1
  35. package/dist/i18n/chunk-DhGyd7sr.js +28 -0
  36. package/dist/i18n/index.cjs +33 -20
  37. package/dist/i18n/index.cjs.map +1 -1
  38. package/dist/i18n/index.d.cts +282 -13
  39. package/dist/i18n/index.d.ts +282 -13
  40. package/dist/i18n/index.js +23 -14
  41. package/dist/i18n/index.js.map +1 -1
  42. package/dist/websocket/index.cjs +21 -8
  43. package/dist/websocket/index.cjs.map +1 -1
  44. package/dist/websocket/index.js +11 -2
  45. package/dist/websocket/index.js.map +1 -1
  46. package/package.json +7 -6
  47. package/src/auth/index.browser.ts +3 -6
  48. package/src/auth/index.shared.ts +0 -1
  49. package/src/auth/index.ts +3 -16
  50. package/src/auth/providers/ReactAuthProvider.ts +1 -614
  51. package/src/auth/services/ReactAuth.ts +6 -17
  52. package/src/core/descriptors/$page.ts +1 -1
  53. package/src/core/index.browser.ts +1 -0
  54. package/src/core/index.native.ts +21 -0
  55. package/src/core/index.shared-router.ts +15 -0
  56. package/src/core/index.shared.ts +0 -14
  57. package/src/core/index.ts +1 -0
  58. package/src/core/services/ReactRouter.ts +2 -2
  59. package/src/form/errors/FormValidationError.ts +20 -0
  60. package/src/form/hooks/useForm.ts +1 -1
  61. package/src/form/index.ts +1 -0
  62. package/src/head/providers/BrowserHeadProvider.ts +1 -1
  63. package/src/i18n/descriptors/$dictionary.ts +7 -3
  64. package/src/i18n/providers/I18nProvider.ts +9 -10
  65. package/src/websocket/hooks/useRoom.tsx +21 -2
  66. package/dist/auth/index.d.cts.map +0 -1
  67. package/dist/auth/index.d.ts.map +0 -1
  68. package/dist/core/index.d.cts.map +0 -1
  69. package/dist/core/index.d.ts.map +0 -1
  70. package/dist/form/index.d.cts.map +0 -1
  71. package/dist/form/index.d.ts.map +0 -1
  72. package/dist/head/index.d.cts.map +0 -1
  73. package/dist/head/index.d.ts.map +0 -1
  74. package/dist/i18n/index.d.cts.map +0 -1
  75. package/dist/i18n/index.d.ts.map +0 -1
  76. package/dist/websocket/index.d.cts.map +0 -1
  77. package/dist/websocket/index.d.ts.map +0 -1
  78. package/src/auth/descriptors/$auth.ts +0 -436
  79. package/src/auth/descriptors/$authApple.ts +0 -8
  80. package/src/auth/descriptors/$authGithub.ts +0 -81
  81. package/src/auth/descriptors/$authGoogle.ts +0 -38
  82. package/src/auth/errors/SessionExpiredError.ts +0 -6
  83. package/src/auth/schemas/tokenResponseSchema.ts +0 -11
  84. package/src/auth/schemas/tokensSchema.ts +0 -21
  85. package/src/auth/schemas/userinfoResponseSchema.ts +0 -10
@@ -1,10 +1,115 @@
1
- import * as alepha1 from "alepha";
2
- import { Alepha, Descriptor, KIND, TypeBoxError } from "alepha";
3
- import { DateTime, DateTimeProvider } from "alepha/datetime";
4
- import * as alepha_logger0 from "alepha/logger";
5
- import * as typebox0 from "typebox";
6
- import * as alepha_server_cookies0 from "alepha/server/cookies";
1
+ import * as alepha16 from "alepha";
2
+ import { Alepha, Async, Descriptor, KIND, LogLevel, LoggerInterface, Static, TSchema, TypeBoxError } from "alepha";
3
+ import dayjsDuration from "dayjs/plugin/duration.js";
4
+ import DayjsApi, { Dayjs, ManipulateType, PluginFunc } from "dayjs";
7
5
 
6
+ //#region ../alepha/src/datetime/providers/DateTimeProvider.d.ts
7
+
8
+ type DateTime = DayjsApi.Dayjs;
9
+ type Duration = dayjsDuration.Duration;
10
+ type DurationLike = number | dayjsDuration.Duration | [number, ManipulateType];
11
+ declare class DateTimeProvider {
12
+ static PLUGINS: Array<PluginFunc<any>>;
13
+ protected alepha: Alepha;
14
+ protected ref: DateTime | null;
15
+ protected readonly timeouts: Timeout[];
16
+ protected readonly intervals: Interval[];
17
+ constructor();
18
+ protected readonly onStart: alepha16.HookDescriptor<"start">;
19
+ protected readonly onStop: alepha16.HookDescriptor<"stop">;
20
+ setLocale(locale: string): void;
21
+ isDateTime(value: unknown): value is DateTime;
22
+ /**
23
+ * Create a new UTC DateTime instance.
24
+ */
25
+ utc(date: string | number | Date | Dayjs | null | undefined): DateTime;
26
+ /**
27
+ * Create a new DateTime instance.
28
+ */
29
+ of(date: string | number | Date | Dayjs | null | undefined): DateTime;
30
+ /**
31
+ * Get the current date as a string.
32
+ */
33
+ toISOString(date?: Date | string | DateTime): string;
34
+ /**
35
+ * Get the current date.
36
+ */
37
+ now(): DateTime;
38
+ /**
39
+ * Get the current date as a string.
40
+ *
41
+ * This is much faster than `DateTimeProvider.now().toISOString()` as it avoids creating a DateTime instance.
42
+ */
43
+ nowISOString(): string;
44
+ /**
45
+ * Get the current date as milliseconds since epoch.
46
+ *
47
+ * This is much faster than `DateTimeProvider.now().valueOf()` as it avoids creating a DateTime instance.
48
+ */
49
+ nowMillis(): number;
50
+ /**
51
+ * Get the current date as a string.
52
+ *
53
+ * @protected
54
+ */
55
+ protected getCurrentDate(): DateTime;
56
+ /**
57
+ * Create a new Duration instance.
58
+ */
59
+ duration: (duration: DurationLike, unit?: ManipulateType) => Duration;
60
+ isDurationLike(value: unknown): value is DurationLike;
61
+ /**
62
+ * Return a promise that resolves after the next tick.
63
+ * It uses `setTimeout` with 0 ms delay.
64
+ */
65
+ tick(): Promise<void>;
66
+ /**
67
+ * Wait for a certain duration.
68
+ *
69
+ * You can clear the timeout by using the `AbortSignal` API.
70
+ * Aborted signal will resolve the promise immediately, it does not reject it.
71
+ */
72
+ wait(duration: DurationLike, options?: {
73
+ signal?: AbortSignal;
74
+ now?: number;
75
+ }): Promise<void>;
76
+ createInterval(run: () => unknown, duration: DurationLike, start?: boolean): Interval;
77
+ /**
78
+ * Run a callback after a certain duration.
79
+ */
80
+ createTimeout(callback: () => void, duration: DurationLike, now?: number): Timeout;
81
+ clearTimeout(timeout: Timeout): void;
82
+ clearInterval(interval: Interval): void;
83
+ /**
84
+ * Run a function with a deadline.
85
+ */
86
+ deadline<T>(fn: (signal: AbortSignal) => Promise<T>, duration: DurationLike): Promise<T>;
87
+ /**
88
+ * Add time to the current date.
89
+ */
90
+ travel(duration: DurationLike, unit?: ManipulateType): Promise<void>;
91
+ /**
92
+ * Stop the time.
93
+ */
94
+ pause(): DateTime;
95
+ /**
96
+ * Reset the reference date.
97
+ */
98
+ reset(): void;
99
+ }
100
+ interface Interval {
101
+ timer?: any;
102
+ duration: number;
103
+ run: () => unknown;
104
+ }
105
+ interface Timeout {
106
+ now: number;
107
+ timer?: any;
108
+ duration: number;
109
+ callback: () => void;
110
+ clear: () => void;
111
+ }
112
+ //#endregion
8
113
  //#region src/i18n/components/Localize.d.ts
9
114
  interface LocalizeProps {
10
115
  value: string | number | Date | DateTime | TypeBoxError;
@@ -32,6 +137,169 @@ interface LocalizeProps {
32
137
  }
33
138
  declare const Localize: (props: LocalizeProps) => string;
34
139
  //#endregion
140
+ //#region ../alepha/src/logger/schemas/logEntrySchema.d.ts
141
+ declare const logEntrySchema: alepha16.TObject<{
142
+ level: alepha16.TUnsafe<"SILENT" | "TRACE" | "DEBUG" | "INFO" | "WARN" | "ERROR">;
143
+ message: alepha16.TString;
144
+ service: alepha16.TString;
145
+ module: alepha16.TString;
146
+ context: alepha16.TOptional<alepha16.TString>;
147
+ app: alepha16.TOptional<alepha16.TString>;
148
+ data: alepha16.TOptional<alepha16.TAny>;
149
+ timestamp: alepha16.TNumber;
150
+ }>;
151
+ type LogEntry = Static<typeof logEntrySchema>;
152
+ //#endregion
153
+ //#region ../alepha/src/logger/providers/LogDestinationProvider.d.ts
154
+ declare abstract class LogDestinationProvider {
155
+ abstract write(message: string, entry: LogEntry): void;
156
+ }
157
+ //#endregion
158
+ //#region ../alepha/src/logger/providers/LogFormatterProvider.d.ts
159
+ declare abstract class LogFormatterProvider {
160
+ abstract format(entry: LogEntry): string;
161
+ }
162
+ //#endregion
163
+ //#region ../alepha/src/logger/services/Logger.d.ts
164
+ declare class Logger implements LoggerInterface {
165
+ protected readonly alepha: Alepha;
166
+ protected readonly formatter: LogFormatterProvider;
167
+ protected readonly destination: LogDestinationProvider;
168
+ protected readonly dateTimeProvider: DateTimeProvider;
169
+ protected readonly levels: Record<string, number>;
170
+ protected readonly service: string;
171
+ protected readonly module: string;
172
+ protected readonly app?: string;
173
+ protected appLogLevel: string;
174
+ protected logLevel: LogLevel;
175
+ constructor(service: string, module: string);
176
+ get context(): string | undefined;
177
+ get level(): string;
178
+ parseLevel(level: string, app: string): LogLevel;
179
+ private matchesPattern;
180
+ asLogLevel(something: string): LogLevel;
181
+ error(message: string, data?: unknown): void;
182
+ warn(message: string, data?: unknown): void;
183
+ info(message: string, data?: unknown): void;
184
+ debug(message: string, data?: unknown): void;
185
+ trace(message: string, data?: unknown): void;
186
+ protected log(level: LogLevel, message: string, data?: unknown): void;
187
+ protected emit(entry: LogEntry, message?: string): void;
188
+ }
189
+ //#endregion
190
+ //#region ../alepha/src/logger/index.d.ts
191
+ declare const envSchema: alepha16.TObject<{
192
+ /**
193
+ * Default log level for the application.
194
+ *
195
+ * Default by environment:
196
+ * - dev = info
197
+ * - prod = info
198
+ * - test = error
199
+ *
200
+ * Levels are: "trace" | "debug" | "info" | "warn" | "error" | "silent"
201
+ *
202
+ * Level can be set for a specific module:
203
+ *
204
+ * @example
205
+ * LOG_LEVEL=my.module.name:debug,info # Set debug level for my.module.name and info for all other modules
206
+ * LOG_LEVEL=alepha:trace, info # Set trace level for all alepha modules and info for all other modules
207
+ */
208
+ LOG_LEVEL: alepha16.TOptional<alepha16.TString>;
209
+ /**
210
+ * Built-in log formats.
211
+ * - "json" - JSON format, useful for structured logging and log aggregation. {@link JsonFormatterProvider}
212
+ * - "pretty" - Simple text format, human-readable, with colors. {@link SimpleFormatterProvider}
213
+ * - "raw" - Raw format, no formatting, just the message. {@link RawFormatterProvider}
214
+ */
215
+ LOG_FORMAT: alepha16.TOptional<alepha16.TUnsafe<"json" | "pretty" | "raw">>;
216
+ }>;
217
+ declare module "alepha" {
218
+ interface Env extends Partial<Static<typeof envSchema>> {}
219
+ interface State {
220
+ /**
221
+ * Current log level for the application or specific modules.
222
+ */
223
+ "alepha.logger.level"?: string;
224
+ }
225
+ interface Hooks {
226
+ log: {
227
+ message?: string;
228
+ entry: LogEntry;
229
+ };
230
+ }
231
+ }
232
+ //#endregion
233
+ //#region ../alepha/src/server-cookies/descriptors/$cookie.d.ts
234
+ interface CookieDescriptorOptions<T extends TSchema> {
235
+ /** The schema for the cookie's value, used for validation and type safety. */
236
+ schema: T;
237
+ /** The name of the cookie. */
238
+ name?: string;
239
+ /** The cookie's path. Defaults to "/". */
240
+ path?: string;
241
+ /** Time-to-live for the cookie. Maps to `Max-Age`. */
242
+ ttl?: DurationLike;
243
+ /** If true, the cookie is only sent over HTTPS. Defaults to true in production. */
244
+ secure?: boolean;
245
+ /** If true, the cookie cannot be accessed by client-side scripts. */
246
+ httpOnly?: boolean;
247
+ /** SameSite policy for the cookie. Defaults to "lax". */
248
+ sameSite?: "strict" | "lax" | "none";
249
+ /** The domain for the cookie. */
250
+ domain?: string;
251
+ /** If true, the cookie value will be compressed using zlib. */
252
+ compress?: boolean;
253
+ /** If true, the cookie value will be encrypted. Requires `COOKIE_SECRET` env var. */
254
+ encrypt?: boolean;
255
+ /** If true, the cookie will be signed to prevent tampering. Requires `COOKIE_SECRET` env var. */
256
+ sign?: boolean;
257
+ }
258
+ interface AbstractCookieDescriptor<T extends TSchema> {
259
+ readonly name: string;
260
+ readonly options: CookieDescriptorOptions<T>;
261
+ set(value: Static<T>, options?: {
262
+ cookies?: Cookies;
263
+ ttl?: DurationLike;
264
+ }): void;
265
+ get(options?: {
266
+ cookies?: Cookies;
267
+ }): Static<T> | undefined;
268
+ del(options?: {
269
+ cookies?: Cookies;
270
+ }): void;
271
+ }
272
+ interface Cookies {
273
+ req: Record<string, string>;
274
+ res: Record<string, Cookie | null>;
275
+ }
276
+ interface Cookie {
277
+ value: string;
278
+ path?: string;
279
+ maxAge?: number;
280
+ secure?: boolean;
281
+ httpOnly?: boolean;
282
+ sameSite?: "strict" | "lax" | "none";
283
+ domain?: string;
284
+ }
285
+ //#endregion
286
+ //#region ../alepha/src/server-cookies/index.d.ts
287
+ declare module "alepha/server" {
288
+ interface ServerRequest {
289
+ cookies: Cookies;
290
+ }
291
+ }
292
+ /**
293
+ * Provides HTTP cookie management capabilities for server requests and responses with type-safe cookie descriptors.
294
+ *
295
+ * The server-cookies module enables declarative cookie handling using the `$cookie` descriptor on class properties.
296
+ * It offers automatic cookie parsing, secure cookie configuration, and seamless integration with server routes
297
+ * for managing user sessions, preferences, and authentication tokens.
298
+ *
299
+ * @see {@link $cookie}
300
+ * @module alepha.server.cookies
301
+ */
302
+ //#endregion
35
303
  //#region src/i18n/hooks/useI18n.d.ts
36
304
  /**
37
305
  * Hook to access the i18n service.
@@ -41,11 +309,12 @@ type ServiceDictionary<T extends object> = { [K in keyof T]: T[K] extends Dictio
41
309
  //#endregion
42
310
  //#region src/i18n/providers/I18nProvider.d.ts
43
311
  declare class I18nProvider<S extends object, K$1 extends keyof ServiceDictionary<S>> {
44
- protected logger: alepha_logger0.Logger;
312
+ protected log: Logger;
45
313
  protected alepha: Alepha;
46
314
  protected dateTimeProvider: DateTimeProvider;
47
- protected cookie: alepha_server_cookies0.AbstractCookieDescriptor<typebox0.TString>;
315
+ protected cookie: AbstractCookieDescriptor<alepha16.TString>;
48
316
  readonly registry: Array<{
317
+ target: string;
49
318
  name: string;
50
319
  lang: string;
51
320
  loader: () => Promise<Record<string, string>>;
@@ -62,11 +331,11 @@ declare class I18nProvider<S extends object, K$1 extends keyof ServiceDictionary
62
331
  };
63
332
  get languages(): string[];
64
333
  constructor();
65
- protected readonly onRender: alepha1.HookDescriptor<"server:onRequest">;
66
- protected readonly onStart: alepha1.HookDescriptor<"start">;
334
+ protected readonly onRender: alepha16.HookDescriptor<"server:onRequest">;
335
+ protected readonly onStart: alepha16.HookDescriptor<"start">;
67
336
  protected refreshLocale(): void;
68
337
  setLang: (lang: string) => Promise<void>;
69
- protected readonly mutate: alepha1.HookDescriptor<"state:mutate">;
338
+ protected readonly mutate: alepha16.HookDescriptor<"state:mutate">;
70
339
  get lang(): string;
71
340
  translate: (key: string, args?: string[]) => string;
72
341
  readonly l: (value: I18nLocalizeType, options?: I18nLocalizeOptions) => string;
@@ -140,7 +409,7 @@ declare const $dictionary: {
140
409
  interface DictionaryDescriptorOptions<T extends Record<string, string>> {
141
410
  lang?: string;
142
411
  name?: string;
143
- lazy: () => Promise<{
412
+ lazy: () => Async<{
144
413
  default: T;
145
414
  }>;
146
415
  }
@@ -162,7 +431,7 @@ declare module "alepha" {
162
431
  *
163
432
  * @module alepha.react.i18n
164
433
  */
165
- declare const AlephaReactI18n: alepha1.Service<alepha1.Module>;
434
+ declare const AlephaReactI18n: alepha16.Service<alepha16.Module>;
166
435
  //#endregion
167
436
  export { $dictionary, AlephaReactI18n, DictionaryDescriptor, DictionaryDescriptorOptions, I18nLocalizeOptions, I18nLocalizeType, I18nProvider, Localize, type LocalizeProps, ServiceDictionary, useI18n };
168
437
  //# sourceMappingURL=index.d.cts.map
@@ -1,10 +1,115 @@
1
- import * as alepha1 from "alepha";
2
- import { Alepha, Descriptor, KIND, TypeBoxError } from "alepha";
3
- import { DateTime, DateTimeProvider } from "alepha/datetime";
4
- import * as alepha_logger0 from "alepha/logger";
5
- import * as alepha_server_cookies0 from "alepha/server/cookies";
6
- import * as typebox0 from "typebox";
1
+ import * as alepha16 from "alepha";
2
+ import { Alepha, Async, Descriptor, KIND, LogLevel, LoggerInterface, Static, TSchema, TypeBoxError } from "alepha";
3
+ import dayjsDuration from "dayjs/plugin/duration.js";
4
+ import DayjsApi, { Dayjs, ManipulateType, PluginFunc } from "dayjs";
7
5
 
6
+ //#region ../alepha/src/datetime/providers/DateTimeProvider.d.ts
7
+
8
+ type DateTime = DayjsApi.Dayjs;
9
+ type Duration = dayjsDuration.Duration;
10
+ type DurationLike = number | dayjsDuration.Duration | [number, ManipulateType];
11
+ declare class DateTimeProvider {
12
+ static PLUGINS: Array<PluginFunc<any>>;
13
+ protected alepha: Alepha;
14
+ protected ref: DateTime | null;
15
+ protected readonly timeouts: Timeout[];
16
+ protected readonly intervals: Interval[];
17
+ constructor();
18
+ protected readonly onStart: alepha16.HookDescriptor<"start">;
19
+ protected readonly onStop: alepha16.HookDescriptor<"stop">;
20
+ setLocale(locale: string): void;
21
+ isDateTime(value: unknown): value is DateTime;
22
+ /**
23
+ * Create a new UTC DateTime instance.
24
+ */
25
+ utc(date: string | number | Date | Dayjs | null | undefined): DateTime;
26
+ /**
27
+ * Create a new DateTime instance.
28
+ */
29
+ of(date: string | number | Date | Dayjs | null | undefined): DateTime;
30
+ /**
31
+ * Get the current date as a string.
32
+ */
33
+ toISOString(date?: Date | string | DateTime): string;
34
+ /**
35
+ * Get the current date.
36
+ */
37
+ now(): DateTime;
38
+ /**
39
+ * Get the current date as a string.
40
+ *
41
+ * This is much faster than `DateTimeProvider.now().toISOString()` as it avoids creating a DateTime instance.
42
+ */
43
+ nowISOString(): string;
44
+ /**
45
+ * Get the current date as milliseconds since epoch.
46
+ *
47
+ * This is much faster than `DateTimeProvider.now().valueOf()` as it avoids creating a DateTime instance.
48
+ */
49
+ nowMillis(): number;
50
+ /**
51
+ * Get the current date as a string.
52
+ *
53
+ * @protected
54
+ */
55
+ protected getCurrentDate(): DateTime;
56
+ /**
57
+ * Create a new Duration instance.
58
+ */
59
+ duration: (duration: DurationLike, unit?: ManipulateType) => Duration;
60
+ isDurationLike(value: unknown): value is DurationLike;
61
+ /**
62
+ * Return a promise that resolves after the next tick.
63
+ * It uses `setTimeout` with 0 ms delay.
64
+ */
65
+ tick(): Promise<void>;
66
+ /**
67
+ * Wait for a certain duration.
68
+ *
69
+ * You can clear the timeout by using the `AbortSignal` API.
70
+ * Aborted signal will resolve the promise immediately, it does not reject it.
71
+ */
72
+ wait(duration: DurationLike, options?: {
73
+ signal?: AbortSignal;
74
+ now?: number;
75
+ }): Promise<void>;
76
+ createInterval(run: () => unknown, duration: DurationLike, start?: boolean): Interval;
77
+ /**
78
+ * Run a callback after a certain duration.
79
+ */
80
+ createTimeout(callback: () => void, duration: DurationLike, now?: number): Timeout;
81
+ clearTimeout(timeout: Timeout): void;
82
+ clearInterval(interval: Interval): void;
83
+ /**
84
+ * Run a function with a deadline.
85
+ */
86
+ deadline<T>(fn: (signal: AbortSignal) => Promise<T>, duration: DurationLike): Promise<T>;
87
+ /**
88
+ * Add time to the current date.
89
+ */
90
+ travel(duration: DurationLike, unit?: ManipulateType): Promise<void>;
91
+ /**
92
+ * Stop the time.
93
+ */
94
+ pause(): DateTime;
95
+ /**
96
+ * Reset the reference date.
97
+ */
98
+ reset(): void;
99
+ }
100
+ interface Interval {
101
+ timer?: any;
102
+ duration: number;
103
+ run: () => unknown;
104
+ }
105
+ interface Timeout {
106
+ now: number;
107
+ timer?: any;
108
+ duration: number;
109
+ callback: () => void;
110
+ clear: () => void;
111
+ }
112
+ //#endregion
8
113
  //#region src/i18n/components/Localize.d.ts
9
114
  interface LocalizeProps {
10
115
  value: string | number | Date | DateTime | TypeBoxError;
@@ -32,6 +137,169 @@ interface LocalizeProps {
32
137
  }
33
138
  declare const Localize: (props: LocalizeProps) => string;
34
139
  //#endregion
140
+ //#region ../alepha/src/logger/schemas/logEntrySchema.d.ts
141
+ declare const logEntrySchema: alepha16.TObject<{
142
+ level: alepha16.TUnsafe<"SILENT" | "TRACE" | "DEBUG" | "INFO" | "WARN" | "ERROR">;
143
+ message: alepha16.TString;
144
+ service: alepha16.TString;
145
+ module: alepha16.TString;
146
+ context: alepha16.TOptional<alepha16.TString>;
147
+ app: alepha16.TOptional<alepha16.TString>;
148
+ data: alepha16.TOptional<alepha16.TAny>;
149
+ timestamp: alepha16.TNumber;
150
+ }>;
151
+ type LogEntry = Static<typeof logEntrySchema>;
152
+ //#endregion
153
+ //#region ../alepha/src/logger/providers/LogDestinationProvider.d.ts
154
+ declare abstract class LogDestinationProvider {
155
+ abstract write(message: string, entry: LogEntry): void;
156
+ }
157
+ //#endregion
158
+ //#region ../alepha/src/logger/providers/LogFormatterProvider.d.ts
159
+ declare abstract class LogFormatterProvider {
160
+ abstract format(entry: LogEntry): string;
161
+ }
162
+ //#endregion
163
+ //#region ../alepha/src/logger/services/Logger.d.ts
164
+ declare class Logger implements LoggerInterface {
165
+ protected readonly alepha: Alepha;
166
+ protected readonly formatter: LogFormatterProvider;
167
+ protected readonly destination: LogDestinationProvider;
168
+ protected readonly dateTimeProvider: DateTimeProvider;
169
+ protected readonly levels: Record<string, number>;
170
+ protected readonly service: string;
171
+ protected readonly module: string;
172
+ protected readonly app?: string;
173
+ protected appLogLevel: string;
174
+ protected logLevel: LogLevel;
175
+ constructor(service: string, module: string);
176
+ get context(): string | undefined;
177
+ get level(): string;
178
+ parseLevel(level: string, app: string): LogLevel;
179
+ private matchesPattern;
180
+ asLogLevel(something: string): LogLevel;
181
+ error(message: string, data?: unknown): void;
182
+ warn(message: string, data?: unknown): void;
183
+ info(message: string, data?: unknown): void;
184
+ debug(message: string, data?: unknown): void;
185
+ trace(message: string, data?: unknown): void;
186
+ protected log(level: LogLevel, message: string, data?: unknown): void;
187
+ protected emit(entry: LogEntry, message?: string): void;
188
+ }
189
+ //#endregion
190
+ //#region ../alepha/src/logger/index.d.ts
191
+ declare const envSchema: alepha16.TObject<{
192
+ /**
193
+ * Default log level for the application.
194
+ *
195
+ * Default by environment:
196
+ * - dev = info
197
+ * - prod = info
198
+ * - test = error
199
+ *
200
+ * Levels are: "trace" | "debug" | "info" | "warn" | "error" | "silent"
201
+ *
202
+ * Level can be set for a specific module:
203
+ *
204
+ * @example
205
+ * LOG_LEVEL=my.module.name:debug,info # Set debug level for my.module.name and info for all other modules
206
+ * LOG_LEVEL=alepha:trace, info # Set trace level for all alepha modules and info for all other modules
207
+ */
208
+ LOG_LEVEL: alepha16.TOptional<alepha16.TString>;
209
+ /**
210
+ * Built-in log formats.
211
+ * - "json" - JSON format, useful for structured logging and log aggregation. {@link JsonFormatterProvider}
212
+ * - "pretty" - Simple text format, human-readable, with colors. {@link SimpleFormatterProvider}
213
+ * - "raw" - Raw format, no formatting, just the message. {@link RawFormatterProvider}
214
+ */
215
+ LOG_FORMAT: alepha16.TOptional<alepha16.TUnsafe<"json" | "pretty" | "raw">>;
216
+ }>;
217
+ declare module "alepha" {
218
+ interface Env extends Partial<Static<typeof envSchema>> {}
219
+ interface State {
220
+ /**
221
+ * Current log level for the application or specific modules.
222
+ */
223
+ "alepha.logger.level"?: string;
224
+ }
225
+ interface Hooks {
226
+ log: {
227
+ message?: string;
228
+ entry: LogEntry;
229
+ };
230
+ }
231
+ }
232
+ //#endregion
233
+ //#region ../alepha/src/server-cookies/descriptors/$cookie.d.ts
234
+ interface CookieDescriptorOptions<T extends TSchema> {
235
+ /** The schema for the cookie's value, used for validation and type safety. */
236
+ schema: T;
237
+ /** The name of the cookie. */
238
+ name?: string;
239
+ /** The cookie's path. Defaults to "/". */
240
+ path?: string;
241
+ /** Time-to-live for the cookie. Maps to `Max-Age`. */
242
+ ttl?: DurationLike;
243
+ /** If true, the cookie is only sent over HTTPS. Defaults to true in production. */
244
+ secure?: boolean;
245
+ /** If true, the cookie cannot be accessed by client-side scripts. */
246
+ httpOnly?: boolean;
247
+ /** SameSite policy for the cookie. Defaults to "lax". */
248
+ sameSite?: "strict" | "lax" | "none";
249
+ /** The domain for the cookie. */
250
+ domain?: string;
251
+ /** If true, the cookie value will be compressed using zlib. */
252
+ compress?: boolean;
253
+ /** If true, the cookie value will be encrypted. Requires `COOKIE_SECRET` env var. */
254
+ encrypt?: boolean;
255
+ /** If true, the cookie will be signed to prevent tampering. Requires `COOKIE_SECRET` env var. */
256
+ sign?: boolean;
257
+ }
258
+ interface AbstractCookieDescriptor<T extends TSchema> {
259
+ readonly name: string;
260
+ readonly options: CookieDescriptorOptions<T>;
261
+ set(value: Static<T>, options?: {
262
+ cookies?: Cookies;
263
+ ttl?: DurationLike;
264
+ }): void;
265
+ get(options?: {
266
+ cookies?: Cookies;
267
+ }): Static<T> | undefined;
268
+ del(options?: {
269
+ cookies?: Cookies;
270
+ }): void;
271
+ }
272
+ interface Cookies {
273
+ req: Record<string, string>;
274
+ res: Record<string, Cookie | null>;
275
+ }
276
+ interface Cookie {
277
+ value: string;
278
+ path?: string;
279
+ maxAge?: number;
280
+ secure?: boolean;
281
+ httpOnly?: boolean;
282
+ sameSite?: "strict" | "lax" | "none";
283
+ domain?: string;
284
+ }
285
+ //#endregion
286
+ //#region ../alepha/src/server-cookies/index.d.ts
287
+ declare module "alepha/server" {
288
+ interface ServerRequest {
289
+ cookies: Cookies;
290
+ }
291
+ }
292
+ /**
293
+ * Provides HTTP cookie management capabilities for server requests and responses with type-safe cookie descriptors.
294
+ *
295
+ * The server-cookies module enables declarative cookie handling using the `$cookie` descriptor on class properties.
296
+ * It offers automatic cookie parsing, secure cookie configuration, and seamless integration with server routes
297
+ * for managing user sessions, preferences, and authentication tokens.
298
+ *
299
+ * @see {@link $cookie}
300
+ * @module alepha.server.cookies
301
+ */
302
+ //#endregion
35
303
  //#region src/i18n/hooks/useI18n.d.ts
36
304
  /**
37
305
  * Hook to access the i18n service.
@@ -41,11 +309,12 @@ type ServiceDictionary<T extends object> = { [K in keyof T]: T[K] extends Dictio
41
309
  //#endregion
42
310
  //#region src/i18n/providers/I18nProvider.d.ts
43
311
  declare class I18nProvider<S extends object, K$1 extends keyof ServiceDictionary<S>> {
44
- protected logger: alepha_logger0.Logger;
312
+ protected log: Logger;
45
313
  protected alepha: Alepha;
46
314
  protected dateTimeProvider: DateTimeProvider;
47
- protected cookie: alepha_server_cookies0.AbstractCookieDescriptor<typebox0.TString>;
315
+ protected cookie: AbstractCookieDescriptor<alepha16.TString>;
48
316
  readonly registry: Array<{
317
+ target: string;
49
318
  name: string;
50
319
  lang: string;
51
320
  loader: () => Promise<Record<string, string>>;
@@ -62,11 +331,11 @@ declare class I18nProvider<S extends object, K$1 extends keyof ServiceDictionary
62
331
  };
63
332
  get languages(): string[];
64
333
  constructor();
65
- protected readonly onRender: alepha1.HookDescriptor<"server:onRequest">;
66
- protected readonly onStart: alepha1.HookDescriptor<"start">;
334
+ protected readonly onRender: alepha16.HookDescriptor<"server:onRequest">;
335
+ protected readonly onStart: alepha16.HookDescriptor<"start">;
67
336
  protected refreshLocale(): void;
68
337
  setLang: (lang: string) => Promise<void>;
69
- protected readonly mutate: alepha1.HookDescriptor<"state:mutate">;
338
+ protected readonly mutate: alepha16.HookDescriptor<"state:mutate">;
70
339
  get lang(): string;
71
340
  translate: (key: string, args?: string[]) => string;
72
341
  readonly l: (value: I18nLocalizeType, options?: I18nLocalizeOptions) => string;
@@ -140,7 +409,7 @@ declare const $dictionary: {
140
409
  interface DictionaryDescriptorOptions<T extends Record<string, string>> {
141
410
  lang?: string;
142
411
  name?: string;
143
- lazy: () => Promise<{
412
+ lazy: () => Async<{
144
413
  default: T;
145
414
  }>;
146
415
  }
@@ -162,7 +431,7 @@ declare module "alepha" {
162
431
  *
163
432
  * @module alepha.react.i18n
164
433
  */
165
- declare const AlephaReactI18n: alepha1.Service<alepha1.Module>;
434
+ declare const AlephaReactI18n: alepha16.Service<alepha16.Module>;
166
435
  //#endregion
167
436
  export { $dictionary, AlephaReactI18n, DictionaryDescriptor, DictionaryDescriptorOptions, I18nLocalizeOptions, I18nLocalizeType, I18nProvider, Localize, type LocalizeProps, ServiceDictionary, useI18n };
168
437
  //# sourceMappingURL=index.d.ts.map