@buenojs/bueno 0.8.5 → 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.
package/README.md CHANGED
@@ -225,6 +225,133 @@ bueno generate --help
225
225
 
226
226
  ## Core Features
227
227
 
228
+ ### Background Jobs
229
+ Job queue system with Redis and memory drivers.
230
+
231
+ ```typescript
232
+ import { JobQueue, createJobQueue, startWorker } from '@buenojs/bueno/jobs';
233
+
234
+ // Create a job queue
235
+ const queue = createJobQueue({
236
+ driver: 'redis',
237
+ redisUrl: 'redis://localhost:6379',
238
+ });
239
+
240
+ // Define a job handler
241
+ queue.registerHandler('send-email', async (job) => {
242
+ const { to, subject, body } = job.data;
243
+ await emailService.send(to, subject, body);
244
+ return { success: true };
245
+ });
246
+
247
+ // Start a worker
248
+ startWorker(queue, { concurrency: 5 });
249
+
250
+ // Add a job to the queue
251
+ await queue.add('send-email', {
252
+ to: 'user@example.com',
253
+ subject: 'Welcome!',
254
+ body: 'Thank you for joining our platform.',
255
+ });
256
+ ```
257
+
258
+ ### Notifications
259
+ Multi-channel notification system with support for email, SMS, WhatsApp, and push notifications.
260
+
261
+ ```typescript
262
+ import { NotificationService, createNotificationService, EmailChannelService } from '@buenojs/bueno/notification';
263
+
264
+ // Create notification service
265
+ const notificationService = createNotificationService({
266
+ channels: [
267
+ new EmailChannelService({
268
+ smtp: {
269
+ host: 'smtp.gmail.com',
270
+ port: 587,
271
+ auth: {
272
+ user: 'your-email@gmail.com',
273
+ pass: 'your-password',
274
+ },
275
+ },
276
+ }),
277
+ ],
278
+ });
279
+
280
+ // Send a notification
281
+ await notificationService.send({
282
+ to: 'user@example.com',
283
+ subject: 'Welcome!',
284
+ body: 'Thank you for joining our platform.',
285
+ channel: 'email',
286
+ });
287
+ ```
288
+
289
+ ### Observability
290
+ Structured error tracking and observability integration.
291
+
292
+ ```typescript
293
+ import { createApp } from '@buenojs/bueno';
294
+ import { ObservabilityModule } from '@buenojs/bueno/observability';
295
+
296
+ const app = createApp(AppModule);
297
+
298
+ // Wire observability with custom reporter (e.g., Sentry)
299
+ const obs = ObservabilityModule.setup(app, {
300
+ reporter: new MyReporter(),
301
+ breadcrumbsSize: 20,
302
+ ignoreStatusCodes: [404, 401],
303
+ tags: { environment: 'production' },
304
+ });
305
+
306
+ await app.listen(3000);
307
+ ```
308
+
309
+ ### Metrics
310
+ Runtime metrics collection for memory, CPU, and event loop lag.
311
+
312
+ ```typescript
313
+ import { MetricsCollector, createMetricsCollector, toPrometheusFormat } from '@buenojs/bueno/metrics';
314
+
315
+ // Create metrics collector
316
+ const collector = createMetricsCollector({
317
+ maxHistorySize: 100,
318
+ measureEventLoopLag: true,
319
+ });
320
+
321
+ // Collect metrics periodically
322
+ collector.startPeriodicCollection(5000);
323
+
324
+ // Get metrics
325
+ const metrics = collector.getLatest();
326
+ console.log(toPrometheusFormat(metrics));
327
+ ```
328
+
329
+ ### i18n
330
+ Internationalization support with translation loading and locale negotiation.
331
+
332
+ ```typescript
333
+ import { I18n, createI18n, i18nMiddleware } from '@buenojs/bueno/i18n';
334
+
335
+ // Create i18n instance
336
+ const i18n = createI18n({
337
+ defaultLocale: 'en',
338
+ locales: ['en', 'fr', 'es'],
339
+ translations: {
340
+ en: {
341
+ welcome: 'Welcome!',
342
+ goodbye: 'Goodbye!',
343
+ },
344
+ fr: {
345
+ welcome: 'Bienvenue!',
346
+ goodbye: 'Au revoir!',
347
+ },
348
+ },
349
+ });
350
+
351
+ // Use middleware
352
+ server.use(i18nMiddleware(i18n));
353
+ ```
354
+
228
355
  ### HTTP & Routing
229
356
 
230
357
  Bueno provides a powerful and intuitive routing system with full HTTP method support.
@@ -1002,7 +1129,7 @@ bun dev
1002
1129
 
1003
1130
  ## Links
1004
1131
 
1005
- - **Documentation**: [https://buenojs.dev](https://buenojs.dev)
1132
+ - **Documentation**: [https://buenojs.dev](https://bueno.github.io)
1006
1133
  - **GitHub**: [https://github.com/buenojs/bueno](https://github.com/buenojs/bueno)
1007
1134
  - **Issues**: [https://github.com/buenojs/bueno/issues](https://github.com/buenojs/bueno/issues)
1008
1135
  - **npm**: [https://www.npmjs.com/package/@buenojs/bueno](https://www.npmjs.com/package/@buenojs/bueno)
package/dist/cli/bin.js CHANGED
@@ -1442,7 +1442,7 @@ function websiteTemplate(config) {
1442
1442
  * Uses Bueno's SSG module to generate static HTML from markdown content
1443
1443
  */
1444
1444
 
1445
- import { SSG, createSSG, type SiteConfig, type LayoutContext } from 'bueno';
1445
+ import { SSG, createSSG, type SiteConfig, type LayoutContext } from '@buenojs/bueno';
1446
1446
 
1447
1447
  // Site configuration
1448
1448
  const siteConfig: Partial<SiteConfig> = {
@@ -27,7 +27,6 @@ var __esm = (fn, res) => () => (fn && (res = fn(fn = 0)), res);
27
27
  var __require = import.meta.require;
28
28
 
29
29
  // src/container/forward-ref.ts
30
- var FORWARD_REF_SYMBOL = Symbol.for("buno.forwardRef");
31
30
  function forwardRef(fn) {
32
31
  return {
33
32
  __forwardRef: FORWARD_REF_SYMBOL,
@@ -43,12 +42,29 @@ function resolveForwardRef(ref) {
43
42
  }
44
43
  return ref;
45
44
  }
45
+ var FORWARD_REF_SYMBOL;
46
+ var init_forward_ref = __esm(() => {
47
+ FORWARD_REF_SYMBOL = Symbol.for("buno.forwardRef");
48
+ });
46
49
 
47
50
  // src/container/index.ts
51
+ var exports_container = {};
52
+ __export(exports_container, {
53
+ setContainerMetadata: () => setContainerMetadata,
54
+ resolveForwardRef: () => resolveForwardRef,
55
+ isForwardRef: () => isForwardRef,
56
+ getInjectTokens: () => getContainerMetadata,
57
+ getContainerMetadata: () => getContainerMetadata,
58
+ forwardRef: () => forwardRef,
59
+ createToken: () => createToken,
60
+ Token: () => Token,
61
+ Injectable: () => Injectable,
62
+ Inject: () => Inject,
63
+ Container: () => Container
64
+ });
48
65
  function createToken(description) {
49
66
  return Symbol(description);
50
67
  }
51
- var Token = createToken;
52
68
 
53
69
  class ResolutionStack {
54
70
  stack = new Set;
@@ -208,7 +224,6 @@ class Container {
208
224
  return child;
209
225
  }
210
226
  }
211
- var containerMetadata = new WeakMap;
212
227
  function setContainerMetadata(target, key, value) {
213
228
  if (!containerMetadata.has(target)) {
214
229
  containerMetadata.set(target, new Map);
@@ -235,6 +250,14 @@ function Inject(token) {
235
250
  setContainerMetadata(targetObj, "inject:tokens", existingTokens);
236
251
  };
237
252
  }
253
+ var Token, containerMetadata;
254
+ var init_container = __esm(() => {
255
+ init_forward_ref();
256
+ Token = createToken;
257
+ containerMetadata = new WeakMap;
258
+ });
259
+ init_container();
260
+
238
261
  export {
239
262
  setContainerMetadata,
240
263
  resolveForwardRef,