@buenojs/bueno 0.8.4 → 0.8.6

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 (234) hide show
  1. package/README.md +264 -17
  2. package/dist/cli/{index.js → bin.js} +413 -332
  3. package/dist/container/index.js +273 -0
  4. package/dist/context/index.js +219 -0
  5. package/dist/database/index.js +493 -0
  6. package/dist/frontend/index.js +7697 -0
  7. package/dist/graphql/index.js +2156 -0
  8. package/dist/health/index.js +364 -0
  9. package/dist/i18n/index.js +345 -0
  10. package/dist/index.js +9694 -5047
  11. package/dist/jobs/index.js +819 -0
  12. package/dist/lock/index.js +367 -0
  13. package/dist/logger/index.js +281 -0
  14. package/dist/metrics/index.js +289 -0
  15. package/dist/middleware/index.js +77 -0
  16. package/dist/migrations/index.js +571 -0
  17. package/dist/modules/index.js +3411 -0
  18. package/dist/notification/index.js +484 -0
  19. package/dist/observability/index.js +331 -0
  20. package/dist/openapi/index.js +795 -0
  21. package/dist/orm/index.js +1356 -0
  22. package/dist/router/index.js +886 -0
  23. package/dist/rpc/index.js +691 -0
  24. package/dist/schema/index.js +400 -0
  25. package/dist/telemetry/index.js +595 -0
  26. package/dist/template/index.js +640 -0
  27. package/dist/templates/index.js +640 -0
  28. package/dist/testing/index.js +1111 -0
  29. package/dist/types/index.js +60 -0
  30. package/llms.txt +231 -0
  31. package/package.json +125 -27
  32. package/src/cache/index.ts +2 -1
  33. package/src/cli/ARCHITECTURE.md +3 -3
  34. package/src/cli/bin.ts +2 -2
  35. package/src/cli/commands/build.ts +183 -165
  36. package/src/cli/commands/dev.ts +96 -89
  37. package/src/cli/commands/generate.ts +142 -111
  38. package/src/cli/commands/help.ts +20 -16
  39. package/src/cli/commands/index.ts +3 -6
  40. package/src/cli/commands/migration.ts +124 -105
  41. package/src/cli/commands/new.ts +294 -232
  42. package/src/cli/commands/start.ts +81 -79
  43. package/src/cli/core/args.ts +68 -50
  44. package/src/cli/core/console.ts +89 -95
  45. package/src/cli/core/index.ts +4 -4
  46. package/src/cli/core/prompt.ts +65 -62
  47. package/src/cli/core/spinner.ts +23 -20
  48. package/src/cli/index.ts +46 -38
  49. package/src/cli/templates/database/index.ts +37 -18
  50. package/src/cli/templates/database/mysql.ts +3 -3
  51. package/src/cli/templates/database/none.ts +2 -2
  52. package/src/cli/templates/database/postgresql.ts +3 -3
  53. package/src/cli/templates/database/sqlite.ts +3 -3
  54. package/src/cli/templates/deploy.ts +29 -26
  55. package/src/cli/templates/docker.ts +41 -30
  56. package/src/cli/templates/frontend/index.ts +33 -15
  57. package/src/cli/templates/frontend/none.ts +2 -2
  58. package/src/cli/templates/frontend/react.ts +18 -18
  59. package/src/cli/templates/frontend/solid.ts +15 -15
  60. package/src/cli/templates/frontend/svelte.ts +17 -17
  61. package/src/cli/templates/frontend/vue.ts +15 -15
  62. package/src/cli/templates/generators/index.ts +29 -29
  63. package/src/cli/templates/generators/types.ts +21 -21
  64. package/src/cli/templates/index.ts +6 -6
  65. package/src/cli/templates/project/api.ts +37 -36
  66. package/src/cli/templates/project/default.ts +25 -25
  67. package/src/cli/templates/project/fullstack.ts +28 -26
  68. package/src/cli/templates/project/index.ts +55 -16
  69. package/src/cli/templates/project/minimal.ts +17 -12
  70. package/src/cli/templates/project/types.ts +10 -5
  71. package/src/cli/templates/project/website.ts +15 -15
  72. package/src/cli/utils/fs.ts +55 -41
  73. package/src/cli/utils/index.ts +3 -3
  74. package/src/cli/utils/strings.ts +47 -33
  75. package/src/cli/utils/version.ts +14 -8
  76. package/src/config/env-validation.ts +100 -0
  77. package/src/config/env.ts +169 -41
  78. package/src/config/index.ts +28 -20
  79. package/src/config/loader.ts +25 -16
  80. package/src/config/merge.ts +21 -10
  81. package/src/config/types.ts +566 -25
  82. package/src/config/validation.ts +215 -7
  83. package/src/container/forward-ref.ts +22 -22
  84. package/src/container/index.ts +34 -12
  85. package/src/context/index.ts +11 -1
  86. package/src/database/index.ts +7 -190
  87. package/src/database/orm/builder.ts +457 -0
  88. package/src/database/orm/casts/index.ts +130 -0
  89. package/src/database/orm/casts/types.ts +25 -0
  90. package/src/database/orm/compiler.ts +304 -0
  91. package/src/database/orm/hooks/index.ts +114 -0
  92. package/src/database/orm/index.ts +61 -0
  93. package/src/database/orm/model-registry.ts +59 -0
  94. package/src/database/orm/model.ts +821 -0
  95. package/src/database/orm/relationships/base.ts +146 -0
  96. package/src/database/orm/relationships/belongs-to-many.ts +179 -0
  97. package/src/database/orm/relationships/belongs-to.ts +56 -0
  98. package/src/database/orm/relationships/has-many.ts +45 -0
  99. package/src/database/orm/relationships/has-one.ts +41 -0
  100. package/src/database/orm/relationships/index.ts +11 -0
  101. package/src/database/orm/scopes/index.ts +55 -0
  102. package/src/events/__tests__/event-system.test.ts +235 -0
  103. package/src/events/config.ts +238 -0
  104. package/src/events/example-usage.ts +185 -0
  105. package/src/events/index.ts +278 -0
  106. package/src/events/manager.ts +385 -0
  107. package/src/events/registry.ts +182 -0
  108. package/src/events/types.ts +124 -0
  109. package/src/frontend/api-routes.ts +65 -23
  110. package/src/frontend/bundler.ts +76 -34
  111. package/src/frontend/console-client.ts +2 -2
  112. package/src/frontend/console-stream.ts +94 -38
  113. package/src/frontend/dev-server.ts +94 -46
  114. package/src/frontend/file-router.ts +61 -19
  115. package/src/frontend/frameworks/index.ts +37 -10
  116. package/src/frontend/frameworks/react.ts +10 -8
  117. package/src/frontend/frameworks/solid.ts +11 -9
  118. package/src/frontend/frameworks/svelte.ts +15 -9
  119. package/src/frontend/frameworks/vue.ts +13 -11
  120. package/src/frontend/hmr-client.ts +12 -10
  121. package/src/frontend/hmr.ts +146 -103
  122. package/src/frontend/index.ts +14 -5
  123. package/src/frontend/islands.ts +41 -22
  124. package/src/frontend/isr.ts +59 -37
  125. package/src/frontend/layout.ts +36 -21
  126. package/src/frontend/ssr/react.ts +74 -27
  127. package/src/frontend/ssr/solid.ts +54 -20
  128. package/src/frontend/ssr/svelte.ts +48 -14
  129. package/src/frontend/ssr/vue.ts +50 -18
  130. package/src/frontend/ssr.ts +83 -39
  131. package/src/frontend/types.ts +91 -56
  132. package/src/graphql/built-in-engine.ts +598 -0
  133. package/src/graphql/context-builder.ts +110 -0
  134. package/src/graphql/decorators.ts +358 -0
  135. package/src/graphql/execution-pipeline.ts +227 -0
  136. package/src/graphql/graphql-module.ts +563 -0
  137. package/src/graphql/index.ts +101 -0
  138. package/src/graphql/metadata.ts +237 -0
  139. package/src/graphql/schema-builder.ts +319 -0
  140. package/src/graphql/subscription-handler.ts +283 -0
  141. package/src/graphql/types.ts +324 -0
  142. package/src/health/index.ts +21 -9
  143. package/src/i18n/engine.ts +305 -0
  144. package/src/i18n/index.ts +38 -0
  145. package/src/i18n/loader.ts +218 -0
  146. package/src/i18n/middleware.ts +164 -0
  147. package/src/i18n/negotiator.ts +162 -0
  148. package/src/i18n/types.ts +158 -0
  149. package/src/index.ts +182 -27
  150. package/src/jobs/drivers/memory.ts +315 -0
  151. package/src/jobs/drivers/redis.ts +459 -0
  152. package/src/jobs/index.ts +30 -0
  153. package/src/jobs/queue.ts +281 -0
  154. package/src/jobs/types.ts +295 -0
  155. package/src/jobs/worker.ts +380 -0
  156. package/src/logger/index.ts +1 -3
  157. package/src/logger/transports/index.ts +62 -22
  158. package/src/metrics/index.ts +25 -16
  159. package/src/migrations/index.ts +9 -0
  160. package/src/modules/filters.ts +13 -17
  161. package/src/modules/guards.ts +49 -26
  162. package/src/modules/index.ts +457 -299
  163. package/src/modules/interceptors.ts +58 -20
  164. package/src/modules/lazy.ts +11 -19
  165. package/src/modules/lifecycle.ts +15 -7
  166. package/src/modules/metadata.ts +15 -5
  167. package/src/modules/pipes.ts +94 -72
  168. package/src/notification/channels/base.ts +68 -0
  169. package/src/notification/channels/email.ts +105 -0
  170. package/src/notification/channels/push.ts +104 -0
  171. package/src/notification/channels/sms.ts +105 -0
  172. package/src/notification/channels/whatsapp.ts +104 -0
  173. package/src/notification/index.ts +48 -0
  174. package/src/notification/service.ts +354 -0
  175. package/src/notification/types.ts +344 -0
  176. package/src/observability/__tests__/observability.test.ts +483 -0
  177. package/src/observability/breadcrumbs.ts +114 -0
  178. package/src/observability/index.ts +136 -0
  179. package/src/observability/interceptor.ts +85 -0
  180. package/src/observability/service.ts +303 -0
  181. package/src/observability/trace.ts +37 -0
  182. package/src/observability/types.ts +196 -0
  183. package/src/openapi/__tests__/decorators.test.ts +335 -0
  184. package/src/openapi/__tests__/document-builder.test.ts +285 -0
  185. package/src/openapi/__tests__/route-scanner.test.ts +334 -0
  186. package/src/openapi/__tests__/schema-generator.test.ts +275 -0
  187. package/src/openapi/decorators.ts +328 -0
  188. package/src/openapi/document-builder.ts +274 -0
  189. package/src/openapi/index.ts +112 -0
  190. package/src/openapi/metadata.ts +112 -0
  191. package/src/openapi/route-scanner.ts +289 -0
  192. package/src/openapi/schema-generator.ts +256 -0
  193. package/src/openapi/swagger-module.ts +166 -0
  194. package/src/openapi/types.ts +398 -0
  195. package/src/orm/index.ts +10 -0
  196. package/src/rpc/index.ts +3 -1
  197. package/src/schema/index.ts +9 -0
  198. package/src/security/index.ts +15 -6
  199. package/src/ssg/index.ts +9 -8
  200. package/src/telemetry/index.ts +76 -22
  201. package/src/template/index.ts +7 -0
  202. package/src/templates/engine.ts +224 -0
  203. package/src/templates/index.ts +9 -0
  204. package/src/templates/loader.ts +331 -0
  205. package/src/templates/renderers/markdown.ts +212 -0
  206. package/src/templates/renderers/simple.ts +269 -0
  207. package/src/templates/types.ts +154 -0
  208. package/src/testing/index.ts +100 -27
  209. package/src/types/optional-deps.d.ts +347 -187
  210. package/src/validation/index.ts +92 -2
  211. package/src/validation/schemas.ts +536 -0
  212. package/tests/integration/cli.test.ts +19 -19
  213. package/tests/integration/fullstack.test.ts +4 -4
  214. package/tests/unit/cli.test.ts +1 -1
  215. package/tests/unit/database.test.ts +2 -72
  216. package/tests/unit/env-validation.test.ts +166 -0
  217. package/tests/unit/events.test.ts +910 -0
  218. package/tests/unit/graphql.test.ts +991 -0
  219. package/tests/unit/i18n.test.ts +455 -0
  220. package/tests/unit/jobs.test.ts +493 -0
  221. package/tests/unit/notification.test.ts +988 -0
  222. package/tests/unit/observability.test.ts +453 -0
  223. package/tests/unit/orm/builder.test.ts +323 -0
  224. package/tests/unit/orm/casts.test.ts +179 -0
  225. package/tests/unit/orm/compiler.test.ts +220 -0
  226. package/tests/unit/orm/eager-loading.test.ts +285 -0
  227. package/tests/unit/orm/hooks.test.ts +191 -0
  228. package/tests/unit/orm/model.test.ts +373 -0
  229. package/tests/unit/orm/relationships.test.ts +303 -0
  230. package/tests/unit/orm/scopes.test.ts +74 -0
  231. package/tests/unit/templates-simple.test.ts +53 -0
  232. package/tests/unit/templates.test.ts +454 -0
  233. package/tests/unit/validation.test.ts +18 -24
  234. package/tsconfig.json +11 -3
@@ -0,0 +1,398 @@
1
+ /**
2
+ * OpenAPI 3.1 Type Definitions
3
+ *
4
+ * Comprehensive type definitions for generating OpenAPI 3.1 specifications.
5
+ */
6
+
7
+ // Type alias for class constructors
8
+ export type Constructor = new (...args: unknown[]) => unknown;
9
+
10
+ /**
11
+ * OpenAPI Document - Root object containing the entire API specification
12
+ */
13
+ export interface OpenAPIDocument {
14
+ openapi: '3.1.0';
15
+ info: OpenAPIInfo;
16
+ servers?: OpenAPIServer[];
17
+ paths: OpenAPIPaths;
18
+ components?: OpenAPIComponents;
19
+ security?: OpenAPISecurity[];
20
+ tags?: OpenAPITag[];
21
+ }
22
+
23
+ /**
24
+ * OpenAPI Info - Metadata about the API
25
+ */
26
+ export interface OpenAPIInfo {
27
+ title: string;
28
+ version: string;
29
+ description?: string;
30
+ contact?: OpenAPIContact;
31
+ license?: OpenAPILicense;
32
+ termsOfService?: string;
33
+ }
34
+
35
+ export interface OpenAPIContact {
36
+ name?: string;
37
+ url?: string;
38
+ email?: string;
39
+ }
40
+
41
+ export interface OpenAPILicense {
42
+ name: string;
43
+ url?: string;
44
+ }
45
+
46
+ /**
47
+ * OpenAPI Server - Server information
48
+ */
49
+ export interface OpenAPIServer {
50
+ url: string;
51
+ description?: string;
52
+ }
53
+
54
+ /**
55
+ * OpenAPI Paths - Map of path patterns to path items
56
+ */
57
+ export type OpenAPIPaths = Record<string, OpenAPIPath>;
58
+
59
+ /**
60
+ * OpenAPI Path Item - HTTP operations for a path
61
+ */
62
+ export interface OpenAPIPath {
63
+ summary?: string;
64
+ description?: string;
65
+ get?: OpenAPIOperation;
66
+ post?: OpenAPIOperation;
67
+ put?: OpenAPIOperation;
68
+ patch?: OpenAPIOperation;
69
+ delete?: OpenAPIOperation;
70
+ head?: OpenAPIOperation;
71
+ options?: OpenAPIOperation;
72
+ parameters?: OpenAPIParameter[];
73
+ }
74
+
75
+ /**
76
+ * OpenAPI Operation - Single HTTP operation
77
+ */
78
+ export interface OpenAPIOperation {
79
+ operationId?: string;
80
+ summary?: string;
81
+ description?: string;
82
+ tags?: string[];
83
+ externalDocs?: OpenAPIExternalDocs;
84
+ parameters?: OpenAPIParameter[];
85
+ requestBody?: OpenAPIRequestBody;
86
+ responses: OpenAPIResponses;
87
+ callbacks?: Record<string, unknown>;
88
+ deprecated?: boolean;
89
+ security?: OpenAPISecurity[];
90
+ servers?: OpenAPIServer[];
91
+ }
92
+
93
+ export interface OpenAPIExternalDocs {
94
+ url: string;
95
+ description?: string;
96
+ }
97
+
98
+ /**
99
+ * OpenAPI Parameter - Request parameter (path, query, header, cookie)
100
+ */
101
+ export interface OpenAPIParameter {
102
+ name: string;
103
+ in: 'path' | 'query' | 'header' | 'cookie';
104
+ description?: string;
105
+ required?: boolean;
106
+ deprecated?: boolean;
107
+ allowEmptyValue?: boolean;
108
+ style?: string;
109
+ explode?: boolean;
110
+ allowReserved?: boolean;
111
+ schema?: OpenAPISchema;
112
+ example?: unknown;
113
+ examples?: Record<string, OpenAPIExample>;
114
+ content?: Record<string, OpenAPIMediaType>;
115
+ }
116
+
117
+ /**
118
+ * OpenAPI Request Body
119
+ */
120
+ export interface OpenAPIRequestBody {
121
+ description?: string;
122
+ content: Record<string, OpenAPIMediaType>;
123
+ required?: boolean;
124
+ }
125
+
126
+ /**
127
+ * OpenAPI Media Type
128
+ */
129
+ export interface OpenAPIMediaType {
130
+ schema?: OpenAPISchema;
131
+ example?: unknown;
132
+ examples?: Record<string, OpenAPIExample>;
133
+ encoding?: Record<string, unknown>;
134
+ }
135
+
136
+ /**
137
+ * OpenAPI Example
138
+ */
139
+ export interface OpenAPIExample {
140
+ summary?: string;
141
+ description?: string;
142
+ value?: unknown;
143
+ externalValue?: string;
144
+ }
145
+
146
+ /**
147
+ * OpenAPI Response
148
+ */
149
+ export interface OpenAPIResponse {
150
+ description: string;
151
+ headers?: Record<string, OpenAPIHeader>;
152
+ content?: Record<string, OpenAPIMediaType>;
153
+ links?: Record<string, unknown>;
154
+ }
155
+
156
+ /**
157
+ * OpenAPI Header
158
+ */
159
+ export interface OpenAPIHeader {
160
+ description?: string;
161
+ required?: boolean;
162
+ deprecated?: boolean;
163
+ schema?: OpenAPISchema;
164
+ example?: unknown;
165
+ examples?: Record<string, OpenAPIExample>;
166
+ content?: Record<string, OpenAPIMediaType>;
167
+ }
168
+
169
+ /**
170
+ * OpenAPI Responses - Map of status codes to responses
171
+ */
172
+ export type OpenAPIResponses = Record<string | 'default', OpenAPIResponse>;
173
+
174
+ /**
175
+ * OpenAPI Schema - JSON Schema with OpenAPI extensions
176
+ */
177
+ export interface OpenAPISchema {
178
+ // JSON Schema keywords
179
+ type?: 'string' | 'number' | 'integer' | 'boolean' | 'array' | 'object' | 'null';
180
+ format?: string;
181
+ title?: string;
182
+ description?: string;
183
+ default?: unknown;
184
+ example?: unknown;
185
+ examples?: unknown[];
186
+
187
+ // Object schema
188
+ properties?: Record<string, OpenAPISchema>;
189
+ required?: string[];
190
+ additionalProperties?: boolean | OpenAPISchema;
191
+ maxProperties?: number;
192
+ minProperties?: number;
193
+
194
+ // Array schema
195
+ items?: OpenAPISchema;
196
+ maxItems?: number;
197
+ minItems?: number;
198
+ uniqueItems?: boolean;
199
+
200
+ // String schema
201
+ maxLength?: number;
202
+ minLength?: number;
203
+ pattern?: string;
204
+
205
+ // Numeric schema
206
+ maximum?: number;
207
+ minimum?: number;
208
+ exclusiveMaximum?: boolean;
209
+ exclusiveMinimum?: boolean;
210
+ multipleOf?: number;
211
+
212
+ // Enum
213
+ enum?: unknown[];
214
+
215
+ // Schema composition
216
+ allOf?: OpenAPISchema[];
217
+ oneOf?: OpenAPISchema[];
218
+ anyOf?: OpenAPISchema[];
219
+ not?: OpenAPISchema;
220
+
221
+ // References
222
+ $ref?: string;
223
+
224
+ // OpenAPI extensions
225
+ nullable?: boolean;
226
+ discriminator?: OpenAPIDiscriminator;
227
+ readOnly?: boolean;
228
+ writeOnly?: boolean;
229
+ xml?: OpenAPIXML;
230
+ externalDocs?: OpenAPIExternalDocs;
231
+ deprecated?: boolean;
232
+ }
233
+
234
+ export interface OpenAPIDiscriminator {
235
+ propertyName: string;
236
+ mapping?: Record<string, string>;
237
+ }
238
+
239
+ export interface OpenAPIXML {
240
+ name?: string;
241
+ namespace?: string;
242
+ prefix?: string;
243
+ attribute?: boolean;
244
+ wrapped?: boolean;
245
+ }
246
+
247
+ /**
248
+ * OpenAPI Components - Reusable schema definitions
249
+ */
250
+ export interface OpenAPIComponents {
251
+ schemas?: Record<string, OpenAPISchema>;
252
+ responses?: Record<string, OpenAPIResponse>;
253
+ parameters?: Record<string, OpenAPIParameter>;
254
+ examples?: Record<string, OpenAPIExample>;
255
+ requestBodies?: Record<string, OpenAPIRequestBody>;
256
+ headers?: Record<string, OpenAPIHeader>;
257
+ securitySchemes?: Record<string, OpenAPISecurityScheme>;
258
+ links?: Record<string, unknown>;
259
+ callbacks?: Record<string, unknown>;
260
+ pathItems?: Record<string, OpenAPIPath>;
261
+ }
262
+
263
+ /**
264
+ * OpenAPI Security Scheme
265
+ */
266
+ export interface OpenAPISecurityScheme {
267
+ type: 'apiKey' | 'http' | 'oauth2' | 'openIdConnect';
268
+ description?: string;
269
+ name?: string; // for apiKey
270
+ in?: 'query' | 'header' | 'cookie'; // for apiKey
271
+ scheme?: string; // for http (e.g., 'bearer', 'basic')
272
+ bearerFormat?: string; // for http with bearer
273
+ flows?: OpenAPIOAuthFlows; // for oauth2
274
+ openIdConnectUrl?: string; // for openIdConnect
275
+ }
276
+
277
+ export interface OpenAPIOAuthFlows {
278
+ implicit?: OpenAPIOAuthFlow;
279
+ password?: OpenAPIOAuthFlow;
280
+ clientCredentials?: OpenAPIOAuthFlow;
281
+ authorizationCode?: OpenAPIOAuthFlow;
282
+ }
283
+
284
+ export interface OpenAPIOAuthFlow {
285
+ authorizationUrl: string;
286
+ tokenUrl?: string;
287
+ refreshUrl?: string;
288
+ scopes: Record<string, string>;
289
+ }
290
+
291
+ /**
292
+ * OpenAPI Security - Security requirement object
293
+ */
294
+ export type OpenAPISecurity = Record<string, string[]>;
295
+
296
+ /**
297
+ * OpenAPI Tag - Tag information
298
+ */
299
+ export interface OpenAPITag {
300
+ name: string;
301
+ description?: string;
302
+ externalDocs?: OpenAPIExternalDocs;
303
+ }
304
+
305
+ /**
306
+ * Options for Swagger UI
307
+ */
308
+ export interface SwaggerOptions {
309
+ title?: string;
310
+ customCss?: string;
311
+ customSiteTitle?: string;
312
+ customfavIcon?: string;
313
+ swaggerUrl?: string;
314
+ swaggerVersion?: string;
315
+ }
316
+
317
+ /**
318
+ * Decorator Options - Used when decorating controllers/methods
319
+ */
320
+
321
+ export interface ApiOperationOptions {
322
+ summary?: string;
323
+ description?: string;
324
+ operationId?: string;
325
+ deprecated?: boolean;
326
+ }
327
+
328
+ export interface ApiResponseOptions {
329
+ status: number | 'default';
330
+ description: string;
331
+ type?: Constructor | Constructor[];
332
+ schema?: OpenAPISchema;
333
+ headers?: Record<string, OpenAPIHeader>;
334
+ }
335
+
336
+ export interface ApiParamOptions {
337
+ name: string;
338
+ type?: 'string' | 'number' | 'boolean' | 'integer';
339
+ description?: string;
340
+ required?: boolean;
341
+ example?: unknown;
342
+ schema?: OpenAPISchema;
343
+ }
344
+
345
+ export interface ApiQueryOptions {
346
+ name: string;
347
+ type?: 'string' | 'number' | 'boolean' | 'integer' | 'array';
348
+ description?: string;
349
+ required?: boolean;
350
+ example?: unknown;
351
+ schema?: OpenAPISchema;
352
+ }
353
+
354
+ export interface ApiHeaderOptions {
355
+ name: string;
356
+ description?: string;
357
+ required?: boolean;
358
+ schema?: OpenAPISchema;
359
+ }
360
+
361
+ export interface ApiBodyOptions {
362
+ type?: Constructor;
363
+ description?: string;
364
+ required?: boolean;
365
+ schema?: OpenAPISchema;
366
+ }
367
+
368
+ export interface ApiPropertyOptions {
369
+ description?: string;
370
+ example?: unknown;
371
+ type?: Constructor | string;
372
+ format?: string;
373
+ required?: boolean;
374
+ nullable?: boolean;
375
+ enum?: unknown[];
376
+ minimum?: number;
377
+ maximum?: number;
378
+ minLength?: number;
379
+ maxLength?: number;
380
+ pattern?: string;
381
+ default?: unknown;
382
+ readOnly?: boolean;
383
+ writeOnly?: boolean;
384
+ items?: OpenAPISchema;
385
+ maxItems?: number;
386
+ minItems?: number;
387
+ }
388
+
389
+ export interface SecuritySchemeOptions {
390
+ description?: string;
391
+ bearerFormat?: string;
392
+ }
393
+
394
+ export interface ApiKeySecurityOptions {
395
+ in: 'header' | 'query' | 'cookie';
396
+ name: string;
397
+ description?: string;
398
+ }
@@ -0,0 +1,10 @@
1
+ /**
2
+ * Bueno ORM Entry Point
3
+ *
4
+ * Subpath export: '@buenojs/bueno/orm'
5
+ *
6
+ * @example
7
+ * import { Model, setDefaultDatabase } from '@buenojs/bueno/orm';
8
+ */
9
+
10
+ export * from "../database/orm";
package/src/rpc/index.ts CHANGED
@@ -262,7 +262,9 @@ class OptimisticStore {
262
262
  previousData,
263
263
  timestamp: Date.now(),
264
264
  status: "pending",
265
- onRollback: callbacks?.onRollback as ((previousData: unknown) => void) | undefined,
265
+ onRollback: callbacks?.onRollback as
266
+ | ((previousData: unknown) => void)
267
+ | undefined,
266
268
  onConfirm: callbacks?.onConfirm as ((data: unknown) => void) | undefined,
267
269
  });
268
270
  return id;
@@ -0,0 +1,9 @@
1
+ /**
2
+ * Bueno Schema
3
+ *
4
+ * Database schema definition, type inference, and SQL generation utilities.
5
+ *
6
+ * @example
7
+ * import { defineTable, type InferType } from '@buenojs/bueno/schema';
8
+ */
9
+ export * from "../database/schema";
@@ -40,15 +40,22 @@ export const Password = {
40
40
  needsRehash(hash: string, options?: PasswordOptions): boolean {
41
41
  const algorithm = options?.algorithm ?? "argon2id";
42
42
  // Check if needsRehash exists on Bun.password (it may not in all versions)
43
- if (typeof (Bun.password as unknown as Record<string, unknown>).needsRehash === 'function') {
44
- const needsRehashFn = (Bun.password as unknown as Record<string, unknown>).needsRehash as (hash: string, options: { algorithm: string }) => boolean;
43
+ if (
44
+ typeof (Bun.password as unknown as Record<string, unknown>)
45
+ .needsRehash === "function"
46
+ ) {
47
+ const needsRehashFn = (Bun.password as unknown as Record<string, unknown>)
48
+ .needsRehash as (
49
+ hash: string,
50
+ options: { algorithm: string },
51
+ ) => boolean;
45
52
  return !needsRehashFn(hash, { algorithm });
46
53
  }
47
54
  // Fallback: check if hash starts with the expected algorithm prefix
48
- if (algorithm === 'argon2id' && !hash.startsWith('$argon2id')) {
55
+ if (algorithm === "argon2id" && !hash.startsWith("$argon2id")) {
49
56
  return true;
50
57
  }
51
- if (algorithm === 'bcrypt' && !hash.startsWith('$2')) {
58
+ if (algorithm === "bcrypt" && !hash.startsWith("$2")) {
52
59
  return true;
53
60
  }
54
61
  return false;
@@ -387,7 +394,9 @@ export function createRBACMiddleware(
387
394
 
388
395
  return (allowedRoles: string[]): Middleware => {
389
396
  return async (context: Context, next: () => Promise<Response>) => {
390
- const user = context.get("user") as { userId?: string | number } | undefined;
397
+ const user = context.get("user") as
398
+ | { userId?: string | number }
399
+ | undefined;
391
400
 
392
401
  if (!user?.userId) {
393
402
  return context.status(401).json({ error: "Unauthorized" });
@@ -433,4 +442,4 @@ export function createAPIKeyMiddleware(options: APIKeyOptions): Middleware {
433
442
 
434
443
  return next();
435
444
  };
436
- }
445
+ }
package/src/ssg/index.ts CHANGED
@@ -200,7 +200,6 @@ function parseTableRow(line: string): string[] {
200
200
  return content.split("|").map((cell) => cell.trim());
201
201
  }
202
202
 
203
-
204
203
  function parseMarkdown(markdown: string): string {
205
204
  let html = markdown;
206
205
 
@@ -241,8 +240,8 @@ function parseMarkdown(markdown: string): string {
241
240
  // Generate slug from heading text
242
241
  const slug = trimmedText
243
242
  .toLowerCase()
244
- .replace(/[^a-z0-9]+/g, '-')
245
- .replace(/^-|-$/g, '');
243
+ .replace(/[^a-z0-9]+/g, "-")
244
+ .replace(/^-|-$/g, "");
246
245
  return `<h${level} id="${slug}">${trimmedText}</h${level}>`;
247
246
  });
248
247
 
@@ -495,11 +494,13 @@ export class SSG {
495
494
 
496
495
  if (!layout) {
497
496
  console.warn(`Layout not found: ${layoutName}, using default`);
498
- return this.layouts.get("default")?.({
499
- content: page.html,
500
- page,
501
- site: this.siteConfig,
502
- }) ?? "";
497
+ return (
498
+ this.layouts.get("default")?.({
499
+ content: page.html,
500
+ page,
501
+ site: this.siteConfig,
502
+ }) ?? ""
503
+ );
503
504
  }
504
505
 
505
506
  return layout({