alepha 0.11.9 → 0.11.11

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 (167) hide show
  1. package/README.md +61 -17
  2. package/dist/index.cjs +17089 -0
  3. package/dist/index.cjs.map +1 -0
  4. package/dist/index.d.cts +1 -0
  5. package/dist/index.d.ts +2 -0
  6. package/dist/index.js +17088 -0
  7. package/dist/index.js.map +1 -0
  8. package/package.json +42 -365
  9. package/src/assets/biomeJson.ts +33 -0
  10. package/src/assets/tsconfigJson.ts +18 -0
  11. package/src/assets/viteConfigTs.ts +14 -0
  12. package/src/commands/BiomeCommands.ts +41 -0
  13. package/src/commands/CoreCommands.ts +169 -0
  14. package/src/commands/DrizzleCommands.ts +228 -0
  15. package/src/commands/VerifyCommands.ts +44 -0
  16. package/src/commands/ViteCommands.ts +119 -0
  17. package/src/index.ts +35 -0
  18. package/src/services/ProcessRunner.ts +89 -0
  19. package/src/services/ProjectUtils.ts +508 -0
  20. package/src/version.ts +7 -0
  21. package/api/files.cjs +0 -8
  22. package/api/files.d.ts +0 -438
  23. package/api/files.js +0 -1
  24. package/api/jobs.cjs +0 -8
  25. package/api/jobs.d.ts +0 -327
  26. package/api/jobs.js +0 -1
  27. package/api/notifications.cjs +0 -8
  28. package/api/notifications.d.ts +0 -263
  29. package/api/notifications.js +0 -1
  30. package/api/users.cjs +0 -8
  31. package/api/users.d.ts +0 -923
  32. package/api/users.js +0 -1
  33. package/api/verifications.cjs +0 -8
  34. package/api/verifications.d.ts +0 -1
  35. package/api/verifications.js +0 -1
  36. package/batch.cjs +0 -8
  37. package/batch.d.ts +0 -154
  38. package/batch.js +0 -1
  39. package/bucket.cjs +0 -8
  40. package/bucket.d.ts +0 -520
  41. package/bucket.js +0 -1
  42. package/cache/redis.cjs +0 -8
  43. package/cache/redis.d.ts +0 -40
  44. package/cache/redis.js +0 -1
  45. package/cache.cjs +0 -8
  46. package/cache.d.ts +0 -288
  47. package/cache.js +0 -1
  48. package/command.cjs +0 -8
  49. package/command.d.ts +0 -269
  50. package/command.js +0 -1
  51. package/core.cjs +0 -8
  52. package/core.d.ts +0 -1904
  53. package/core.js +0 -1
  54. package/datetime.cjs +0 -8
  55. package/datetime.d.ts +0 -144
  56. package/datetime.js +0 -1
  57. package/devtools.cjs +0 -8
  58. package/devtools.d.ts +0 -252
  59. package/devtools.js +0 -1
  60. package/email.cjs +0 -8
  61. package/email.d.ts +0 -187
  62. package/email.js +0 -1
  63. package/fake.cjs +0 -8
  64. package/fake.d.ts +0 -73
  65. package/fake.js +0 -1
  66. package/file.cjs +0 -8
  67. package/file.d.ts +0 -528
  68. package/file.js +0 -1
  69. package/lock/redis.cjs +0 -8
  70. package/lock/redis.d.ts +0 -24
  71. package/lock/redis.js +0 -1
  72. package/lock.cjs +0 -8
  73. package/lock.d.ts +0 -552
  74. package/lock.js +0 -1
  75. package/logger.cjs +0 -8
  76. package/logger.d.ts +0 -287
  77. package/logger.js +0 -1
  78. package/postgres.cjs +0 -8
  79. package/postgres.d.ts +0 -2143
  80. package/postgres.js +0 -1
  81. package/queue/redis.cjs +0 -8
  82. package/queue/redis.d.ts +0 -29
  83. package/queue/redis.js +0 -1
  84. package/queue.cjs +0 -8
  85. package/queue.d.ts +0 -760
  86. package/queue.js +0 -1
  87. package/react/auth.cjs +0 -8
  88. package/react/auth.d.ts +0 -504
  89. package/react/auth.js +0 -1
  90. package/react/form.cjs +0 -8
  91. package/react/form.d.ts +0 -211
  92. package/react/form.js +0 -1
  93. package/react/head.cjs +0 -8
  94. package/react/head.d.ts +0 -120
  95. package/react/head.js +0 -1
  96. package/react/i18n.cjs +0 -8
  97. package/react/i18n.d.ts +0 -168
  98. package/react/i18n.js +0 -1
  99. package/react.cjs +0 -8
  100. package/react.d.ts +0 -1263
  101. package/react.js +0 -1
  102. package/redis.cjs +0 -8
  103. package/redis.d.ts +0 -82
  104. package/redis.js +0 -1
  105. package/retry.cjs +0 -8
  106. package/retry.d.ts +0 -162
  107. package/retry.js +0 -1
  108. package/router.cjs +0 -8
  109. package/router.d.ts +0 -45
  110. package/router.js +0 -1
  111. package/scheduler.cjs +0 -8
  112. package/scheduler.d.ts +0 -145
  113. package/scheduler.js +0 -1
  114. package/security.cjs +0 -8
  115. package/security.d.ts +0 -586
  116. package/security.js +0 -1
  117. package/server/cache.cjs +0 -8
  118. package/server/cache.d.ts +0 -163
  119. package/server/cache.js +0 -1
  120. package/server/compress.cjs +0 -8
  121. package/server/compress.d.ts +0 -38
  122. package/server/compress.js +0 -1
  123. package/server/cookies.cjs +0 -8
  124. package/server/cookies.d.ts +0 -144
  125. package/server/cookies.js +0 -1
  126. package/server/cors.cjs +0 -8
  127. package/server/cors.d.ts +0 -45
  128. package/server/cors.js +0 -1
  129. package/server/health.cjs +0 -8
  130. package/server/health.d.ts +0 -58
  131. package/server/health.js +0 -1
  132. package/server/helmet.cjs +0 -8
  133. package/server/helmet.d.ts +0 -98
  134. package/server/helmet.js +0 -1
  135. package/server/links.cjs +0 -8
  136. package/server/links.d.ts +0 -322
  137. package/server/links.js +0 -1
  138. package/server/metrics.cjs +0 -8
  139. package/server/metrics.d.ts +0 -35
  140. package/server/metrics.js +0 -1
  141. package/server/multipart.cjs +0 -8
  142. package/server/multipart.d.ts +0 -42
  143. package/server/multipart.js +0 -1
  144. package/server/proxy.cjs +0 -8
  145. package/server/proxy.d.ts +0 -234
  146. package/server/proxy.js +0 -1
  147. package/server/security.cjs +0 -8
  148. package/server/security.d.ts +0 -92
  149. package/server/security.js +0 -1
  150. package/server/static.cjs +0 -8
  151. package/server/static.d.ts +0 -119
  152. package/server/static.js +0 -1
  153. package/server/swagger.cjs +0 -8
  154. package/server/swagger.d.ts +0 -161
  155. package/server/swagger.js +0 -1
  156. package/server.cjs +0 -8
  157. package/server.d.ts +0 -849
  158. package/server.js +0 -1
  159. package/topic/redis.cjs +0 -8
  160. package/topic/redis.d.ts +0 -42
  161. package/topic/redis.js +0 -1
  162. package/topic.cjs +0 -8
  163. package/topic.d.ts +0 -819
  164. package/topic.js +0 -1
  165. package/vite.cjs +0 -8
  166. package/vite.d.ts +0 -186
  167. package/vite.js +0 -1
package/logger.d.ts DELETED
@@ -1,287 +0,0 @@
1
- import * as _alepha_core0 from "alepha";
2
- import { Alepha, KIND, LogLevel, LoggerInterface, Static } from "alepha";
3
- import { DateTimeProvider } from "alepha/datetime";
4
- import * as typebox0 from "typebox";
5
-
6
- //#region src/schemas/logEntrySchema.d.ts
7
- declare const logEntrySchema: typebox0.TObject<{
8
- level: typebox0.TUnsafe<"SILENT" | "TRACE" | "DEBUG" | "INFO" | "WARN" | "ERROR">;
9
- message: typebox0.TString;
10
- service: typebox0.TString;
11
- module: typebox0.TString;
12
- context: typebox0.TOptional<typebox0.TString>;
13
- app: typebox0.TOptional<typebox0.TString>;
14
- data: typebox0.TOptional<typebox0.TAny>;
15
- timestamp: typebox0.TString;
16
- }>;
17
- type LogEntry = Static<typeof logEntrySchema>;
18
- //#endregion
19
- //#region src/providers/LogDestinationProvider.d.ts
20
- declare abstract class LogDestinationProvider {
21
- abstract write(message: string, entry: LogEntry): void;
22
- }
23
- //#endregion
24
- //#region src/providers/LogFormatterProvider.d.ts
25
- declare abstract class LogFormatterProvider {
26
- abstract format(entry: LogEntry): string;
27
- }
28
- //#endregion
29
- //#region src/services/Logger.d.ts
30
- declare class Logger implements LoggerInterface {
31
- protected readonly alepha: Alepha;
32
- protected readonly formatter: LogFormatterProvider;
33
- protected readonly destination: LogDestinationProvider;
34
- protected readonly dateTimeProvider: DateTimeProvider;
35
- protected readonly levels: Record<string, number>;
36
- protected readonly service: string;
37
- protected readonly module: string;
38
- protected readonly app?: string;
39
- protected appLogLevel: string;
40
- protected logLevel: LogLevel;
41
- constructor(service: string, module: string);
42
- get context(): string | undefined;
43
- get level(): string;
44
- parseLevel(level: string, app: string): LogLevel;
45
- private matchesPattern;
46
- asLogLevel(something: string): LogLevel;
47
- error(message: string, data?: unknown): void;
48
- warn(message: string, data?: unknown): void;
49
- info(message: string, data?: unknown): void;
50
- debug(message: string, data?: unknown): void;
51
- trace(message: string, data?: unknown): void;
52
- protected log(level: LogLevel, message: string, data?: unknown): void;
53
- protected emit(entry: LogEntry, message?: string): void;
54
- }
55
- //#endregion
56
- //#region src/descriptors/$logger.d.ts
57
- /**
58
- * Create a logger.
59
- *
60
- * `name` is optional, by default it will use the name of the service.
61
- *
62
- * @example
63
- * ```ts
64
- * import { $logger } from "alepha";
65
- *
66
- * class MyService {
67
- * log = $logger();
68
- *
69
- * constructor() {
70
- * this.log.info("Service initialized");
71
- * // print something like '[23:45:53.326] INFO <app.MyService>: Service initialized'
72
- * }
73
- * }
74
- * ```
75
- */
76
- declare const $logger: {
77
- (options?: LoggerDescriptorOptions): Logger;
78
- [KIND]: typeof Logger;
79
- };
80
- interface LoggerDescriptorOptions {
81
- name?: string;
82
- }
83
- //#endregion
84
- //#region src/providers/ConsoleColorProvider.d.ts
85
- declare class ConsoleColorProvider {
86
- static readonly COLORS: {
87
- RESET: string;
88
- BLACK: string;
89
- RED: string;
90
- GREEN: string;
91
- ORANGE: string;
92
- BLUE: string;
93
- PURPLE: string;
94
- CYAN: string;
95
- GREY_LIGHT: string;
96
- GREY_LIGHT_BOLD: string;
97
- GREY_DARK: string;
98
- GREY_DARK_BOLD: string;
99
- WHITE: string;
100
- WHITE_BOLD: string;
101
- SILENT: string;
102
- ERROR: string;
103
- WARN: string;
104
- INFO: string;
105
- DEBUG: string;
106
- TRACE: string;
107
- };
108
- protected readonly env: {
109
- NO_COLOR?: string | undefined;
110
- FORCE_COLOR?: string | undefined;
111
- };
112
- protected readonly alepha: Alepha;
113
- protected enabled: boolean;
114
- constructor();
115
- isEnabled(): boolean;
116
- set(color: keyof typeof ConsoleColorProvider.COLORS, text: string, reset?: string): string;
117
- }
118
- //#endregion
119
- //#region src/providers/ConsoleDestinationProvider.d.ts
120
- declare class ConsoleDestinationProvider extends LogDestinationProvider {
121
- write(message: string): void;
122
- }
123
- //#endregion
124
- //#region src/providers/JsonFormatterProvider.d.ts
125
- declare class JsonFormatterProvider extends LogFormatterProvider {
126
- format(entry: LogEntry): string;
127
- formatJsonError(error: Error): object;
128
- }
129
- //#endregion
130
- //#region src/providers/MemoryDestinationProvider.d.ts
131
- declare class MemoryDestinationProvider extends LogDestinationProvider {
132
- protected entries: Array<LogEntry & {
133
- formatted: string;
134
- }>;
135
- readonly options: {
136
- maxEntries: number;
137
- };
138
- write(formatted: string, entry: LogEntry): void;
139
- get logs(): ({
140
- context?: string | undefined;
141
- app?: string | undefined;
142
- data?: any;
143
- level: "SILENT" | "TRACE" | "DEBUG" | "INFO" | "WARN" | "ERROR";
144
- message: string;
145
- service: string;
146
- module: string;
147
- timestamp: string;
148
- } & {
149
- formatted: string;
150
- })[];
151
- clear(): void;
152
- }
153
- //#endregion
154
- //#region src/providers/SimpleFormatterProvider.d.ts
155
- declare class SimpleFormatterProvider extends LogFormatterProvider {
156
- protected color: ConsoleColorProvider;
157
- protected alepha: Alepha;
158
- format(entry: LogEntry): string;
159
- formatTimestamp(iso: string): string;
160
- protected pad2: (n: number) => string;
161
- protected pad3: (n: number) => string;
162
- /**
163
- * Avoid to display the whole UUID in development mode
164
- */
165
- protected formatContext(context: string): string;
166
- protected formatError(error: Error): string;
167
- }
168
- //#endregion
169
- //#region src/index.d.ts
170
- /**
171
- * Minimalist logger module for Alepha.
172
- *
173
- * It offers a global logger interface (info, warn, ...) via the `$logger` descriptor.
174
- *
175
- * ```ts
176
- * import { $logger } from "alepha/logger";
177
- *
178
- * class App {
179
- * log = $logger();
180
- * }
181
- * ```
182
- *
183
- * ### Formatting and Destinations
184
- *
185
- * `AlephaLogger` is **extensible**, destinations and formatters can be added or replaced.
186
- *
187
- * Default log destinations are:
188
- * - ConsoleDestinationProvider: logs to the console.
189
- * - MemoryDestinationProvider: stores logs in memory for later retrieval.
190
- *
191
- * Default log formatters are:
192
- * - JsonFormatterProvider: formats logs as JSON.
193
- * - SimpleFormatterProvider: formats logs as simple text (with colors when possible).
194
- * - RawFormatterProvider: formats logs as raw text without any formatting.
195
- *
196
- * ### Event Emission
197
- *
198
- * The logger emits 'log' events that can be listened to by external code, allowing for custom log processing and destinations.
199
- *
200
- * ```ts
201
- * class CustomDestination {
202
- * onLog = $hook({
203
- * on: "log",
204
- * handler: (ev) => {
205
- * // ev.message (formatted message)
206
- * // ev.entry (level, raw message, ...)
207
- * }
208
- * });
209
- * }
210
- * ```
211
- *
212
- * ### Log Level
213
- *
214
- * You can configure the log level and format via environment variables:
215
- *
216
- * - `LOG_LEVEL`: Sets the default log level for the application.
217
- * - `LOG_FORMAT`: Sets the default log format for the application.
218
- *
219
- * ```bash
220
- * LOG_LEVEL=debug LOG_FORMAT=json node src/index.ts
221
- * ```
222
- *
223
- * Log level is also available in the state as `logLevel`, which can be used to dynamically change the log level at runtime.
224
- * ```ts
225
- * alepha.state.set("alepha.logger.level", "debug");
226
- * ```
227
- *
228
- * Log level is $module aware, meaning you can set different log levels for different modules.
229
- *
230
- * **Module-specific configuration:**
231
- * - `LOG_LEVEL=my.module.name:debug,info` - debug for `my.module.name` (and submodules), info for others
232
- * - `LOG_LEVEL=alepha:trace,my.app:error,info` - trace for alepha modules, error for my.app modules, info for others
233
- *
234
- * **Wildcard patterns (NEW):**
235
- * - `LOG_LEVEL=alepha.*:debug,info` - debug for all alepha submodules
236
- * - `LOG_LEVEL=*.test:silent,*.core:trace,info` - silent for test modules, trace for core modules
237
- *
238
- * **Robust parsing:**
239
- * - Empty parts are gracefully skipped: `LOG_LEVEL=",,debug,,"` works fine
240
- * - Better error messages: "Invalid log level 'bad' for module pattern 'alepha'"
241
- */
242
- declare const AlephaLogger: _alepha_core0.Service<_alepha_core0.Module>;
243
- declare const envSchema: _alepha_core0.TObject<{
244
- /**
245
- * Default log level for the application.
246
- *
247
- * Default by environment:
248
- * - dev = info
249
- * - prod = info
250
- * - test = error
251
- *
252
- * Levels are: "trace" | "debug" | "info" | "warn" | "error" | "silent"
253
- *
254
- * Level can be set for a specific module:
255
- *
256
- * @example
257
- * LOG_LEVEL=my.module.name:debug,info # Set debug level for my.module.name and info for all other modules
258
- * LOG_LEVEL=alepha:trace, info # Set trace level for all alepha modules and info for all other modules
259
- */
260
- LOG_LEVEL: _alepha_core0.TOptional<_alepha_core0.TString>;
261
- /**
262
- * Built-in log formats.
263
- * - "json" - JSON format, useful for structured logging and log aggregation. {@link JsonFormatterProvider}
264
- * - "text" - Simple text format, human-readable, with colors. {@link SimpleFormatterProvider}
265
- * - "raw" - Raw format, no formatting, just the message. {@link RawFormatterProvider}
266
- */
267
- LOG_FORMAT: _alepha_core0.TOptional<_alepha_core0.TUnsafe<"json" | "text" | "raw">>;
268
- }>;
269
- declare module "alepha" {
270
- interface Env extends Partial<Static<typeof envSchema>> {}
271
- interface State {
272
- /**
273
- * Current log level for the application or specific modules.
274
- */
275
- "alepha.logger.level"?: string;
276
- }
277
- interface Hooks {
278
- log: {
279
- message?: string;
280
- entry: LogEntry;
281
- };
282
- }
283
- }
284
- //# sourceMappingURL=index.d.ts.map
285
- //#endregion
286
- export { $logger, AlephaLogger, ConsoleColorProvider, ConsoleDestinationProvider, JsonFormatterProvider, LogDestinationProvider, LogEntry, LogFormatterProvider, Logger, LoggerDescriptorOptions, MemoryDestinationProvider, SimpleFormatterProvider, logEntrySchema };
287
- //# sourceMappingURL=index.d.ts.map
package/logger.js DELETED
@@ -1 +0,0 @@
1
- export * from '@alepha/logger'
package/postgres.cjs DELETED
@@ -1,8 +0,0 @@
1
- 'use strict';
2
- var m = require('@alepha/postgres');
3
- Object.keys(m).forEach(function (k) {
4
- if (k !== 'default' && !Object.prototype.hasOwnProperty.call(exports, k)) Object.defineProperty(exports, k, {
5
- enumerable: true,
6
- get: function () { return m[k]; }
7
- });
8
- });