bootifyjs 2.0.0 → 2.1.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.
- package/README.md +149 -24
- package/dist/BootifyApp.d.ts +21 -3
- package/dist/BootifyApp.d.ts.map +1 -1
- package/dist/BootifyApp.js +57 -14
- package/dist/BootifyApp.js.map +1 -1
- package/dist/config/AppConfig.js +1 -1
- package/dist/config/AppConfig.js.map +1 -1
- package/dist/examples/adapters/pino-logger.adapter.d.ts +18 -0
- package/dist/examples/adapters/pino-logger.adapter.d.ts.map +1 -0
- package/dist/{logging/core/adapters/pino.adapter.js → examples/adapters/pino-logger.adapter.js} +26 -27
- package/dist/examples/adapters/pino-logger.adapter.js.map +1 -0
- package/dist/examples/controllers/todo.controller.d.ts.map +1 -1
- package/dist/examples/controllers/todo.controller.js +1 -4
- package/dist/examples/controllers/todo.controller.js.map +1 -1
- package/dist/examples/index.d.ts.map +1 -1
- package/dist/examples/index.js +85 -47
- package/dist/examples/index.js.map +1 -1
- package/dist/examples/services/scheduled-tasks.service.d.ts.map +1 -1
- package/dist/examples/services/scheduled-tasks.service.js +15 -4
- package/dist/examples/services/scheduled-tasks.service.js.map +1 -1
- package/dist/logging/core/decorators.d.ts +12 -2
- package/dist/logging/core/decorators.d.ts.map +1 -1
- package/dist/logging/core/decorators.js +50 -15
- package/dist/logging/core/decorators.js.map +1 -1
- package/dist/logging/core/logger-builder.d.ts +50 -7
- package/dist/logging/core/logger-builder.d.ts.map +1 -1
- package/dist/logging/core/logger-builder.js +107 -23
- package/dist/logging/core/logger-builder.js.map +1 -1
- package/dist/logging/core/logger.d.ts +20 -0
- package/dist/logging/core/logger.d.ts.map +1 -1
- package/dist/logging/core/logger.js +21 -1
- package/dist/logging/core/logger.js.map +1 -1
- package/dist/logging/core/logger.provider.d.ts +3 -0
- package/dist/logging/core/logger.provider.d.ts.map +1 -1
- package/dist/logging/core/logger.provider.js +16 -1
- package/dist/logging/core/logger.provider.js.map +1 -1
- package/dist/logging/index.d.ts +20 -14
- package/dist/logging/index.d.ts.map +1 -1
- package/dist/logging/index.js +24 -16
- package/dist/logging/index.js.map +1 -1
- package/dist/scheduling/scheduler.service.d.ts +1 -0
- package/dist/scheduling/scheduler.service.d.ts.map +1 -1
- package/dist/scheduling/scheduler.service.js +35 -17
- package/dist/scheduling/scheduler.service.js.map +1 -1
- package/package.json +1 -1
- package/dist/logging/core/adapters/index.d.ts +0 -2
- package/dist/logging/core/adapters/index.d.ts.map +0 -1
- package/dist/logging/core/adapters/index.js +0 -18
- package/dist/logging/core/adapters/index.js.map +0 -1
- package/dist/logging/core/adapters/pino.adapter.d.ts +0 -32
- package/dist/logging/core/adapters/pino.adapter.d.ts.map +0 -1
- package/dist/logging/core/adapters/pino.adapter.js.map +0 -1
package/README.md
CHANGED
|
@@ -11,6 +11,7 @@ Our goal is to make building complex, scalable, and maintainable backend applica
|
|
|
11
11
|
- **Event-Driven Architecture:** A built-in, asynchronous event bus with automatic retries and a dead-letter queue, plus high-performance buffered event processing with worker threads, priority queues, and advanced monitoring.
|
|
12
12
|
- **Pluggable Caching:** A decorator-driven caching system that works out-of-the-box with an in-memory store and can be seamlessly extended to use Redis or other backends.
|
|
13
13
|
- **Type-Safe Configuration:** A schema-driven configuration system that validates your environment at startup, catching errors early and providing fully typed config objects.
|
|
14
|
+
- **Flexible Logging:** A builder-pattern logging system with no external dependencies - bring your own logger (Pino, Winston, etc.) or use the built-in BaseLogger.
|
|
14
15
|
- **Built on Fastify:** Leverage the incredible performance and rich plugin ecosystem of one of the fastest web frameworks for Node.js.
|
|
15
16
|
|
|
16
17
|
## Getting Started
|
|
@@ -19,7 +20,7 @@ Our goal is to make building complex, scalable, and maintainable backend applica
|
|
|
19
20
|
|
|
20
21
|
To create a new BootifyJS project, you can use our upcoming CLI or set it up manually.
|
|
21
22
|
|
|
22
|
-
```
|
|
23
|
+
```bash
|
|
23
24
|
# (Coming Soon)
|
|
24
25
|
# npx bootifyjs-cli new my-project
|
|
25
26
|
|
|
@@ -29,33 +30,29 @@ npm install bootifyjs fastify reflect-metadata
|
|
|
29
30
|
|
|
30
31
|
### Your First Application
|
|
31
32
|
|
|
32
|
-
Here
|
|
33
|
+
Here's a simple "Hello World" application to show you how easy it is to get started.
|
|
33
34
|
|
|
34
35
|
**1. Create your main server file:**
|
|
35
36
|
|
|
36
|
-
```
|
|
37
|
+
```typescript
|
|
37
38
|
// src/server.ts
|
|
38
|
-
import
|
|
39
|
-
import {
|
|
39
|
+
import "reflect-metadata";
|
|
40
|
+
import { createBootify, Controller, Get } from "bootifyjs";
|
|
40
41
|
|
|
41
|
-
@Controller(
|
|
42
|
+
@Controller("/hello")
|
|
42
43
|
export class HelloController {
|
|
43
|
-
@Get(
|
|
44
|
+
@Get("/")
|
|
44
45
|
sayHello() {
|
|
45
|
-
return { message:
|
|
46
|
+
return { message: "Hello from BootifyJS!" };
|
|
46
47
|
}
|
|
47
48
|
}
|
|
48
49
|
|
|
49
50
|
async function main() {
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
port: 3000,
|
|
56
|
-
});
|
|
57
|
-
|
|
58
|
-
await start();
|
|
51
|
+
await createBootify()
|
|
52
|
+
.setServiceName("my-app")
|
|
53
|
+
.setPort(3000)
|
|
54
|
+
.useControllers([HelloController])
|
|
55
|
+
.start();
|
|
59
56
|
}
|
|
60
57
|
|
|
61
58
|
main();
|
|
@@ -63,12 +60,139 @@ main();
|
|
|
63
60
|
|
|
64
61
|
**2. Run your application:**
|
|
65
62
|
|
|
66
|
-
```
|
|
63
|
+
```bash
|
|
67
64
|
npx ts-node src/server.ts
|
|
68
65
|
```
|
|
69
66
|
|
|
70
67
|
You can now visit `http://localhost:3000/hello` in your browser or with `curl` to see your application running!
|
|
71
68
|
|
|
69
|
+
### Builder Pattern API
|
|
70
|
+
|
|
71
|
+
BootifyJS uses a fluent builder pattern for configuration:
|
|
72
|
+
|
|
73
|
+
```typescript
|
|
74
|
+
import { createBootify } from "bootifyjs";
|
|
75
|
+
import { z } from "zod";
|
|
76
|
+
|
|
77
|
+
const configSchema = z.object({
|
|
78
|
+
DATABASE_URL: z.string(),
|
|
79
|
+
REDIS_HOST: z.string().default("localhost"),
|
|
80
|
+
});
|
|
81
|
+
|
|
82
|
+
async function main() {
|
|
83
|
+
const { app, start, logger } = await createBootify()
|
|
84
|
+
.setServiceName("my-api")
|
|
85
|
+
.setPort(3000)
|
|
86
|
+
.setHostname("0.0.0.0")
|
|
87
|
+
.useConfig(configSchema)
|
|
88
|
+
.useControllers([UserController, ProductController])
|
|
89
|
+
.useMiddleware(authMiddleware)
|
|
90
|
+
.useErrorHandler((error, request, reply) => {
|
|
91
|
+
logger.error("Request failed", error);
|
|
92
|
+
reply.status(500).send({ error: "Internal Server Error" });
|
|
93
|
+
})
|
|
94
|
+
.useLogger((builder) =>
|
|
95
|
+
builder
|
|
96
|
+
.setLevel("debug")
|
|
97
|
+
.configureConsole({ colorize: true, prettyPrint: true })
|
|
98
|
+
)
|
|
99
|
+
.beforeStart(async (app) => {
|
|
100
|
+
// Run migrations, connect to databases, etc.
|
|
101
|
+
})
|
|
102
|
+
.afterStart(async (app) => {
|
|
103
|
+
// Post-startup tasks
|
|
104
|
+
})
|
|
105
|
+
.build();
|
|
106
|
+
|
|
107
|
+
await start();
|
|
108
|
+
}
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
### Available Builder Methods
|
|
112
|
+
|
|
113
|
+
| Method | Description |
|
|
114
|
+
| ------------------------- | ---------------------------------------------------- |
|
|
115
|
+
| `setServiceName(name)` | Set the application name (used in logs) |
|
|
116
|
+
| `setPort(port)` | Set the server port |
|
|
117
|
+
| `setHostname(host)` | Set the server hostname |
|
|
118
|
+
| `setFastifyOptions(opts)` | Pass custom Fastify options |
|
|
119
|
+
| `useConfig(schema)` | Initialize type-safe config with Zod schema |
|
|
120
|
+
| `useControllers([...])` | Register controller classes |
|
|
121
|
+
| `usePlugin(fn)` | Register a Fastify plugin |
|
|
122
|
+
| `useMiddleware(fn)` | Add request middleware |
|
|
123
|
+
| `useMiddlewares([...])` | Add multiple middlewares |
|
|
124
|
+
| `useErrorHandler(fn)` | Set custom error handler |
|
|
125
|
+
| `useLogger(fn)` | Configure the logging system |
|
|
126
|
+
| `useScheduler(enabled)` | Enable/disable the job scheduler |
|
|
127
|
+
| `beforeStart(fn)` | Hook to run before server starts |
|
|
128
|
+
| `afterStart(fn)` | Hook to run after server starts |
|
|
129
|
+
| `build()` | Build and return `{ app, start, logger, scheduler }` |
|
|
130
|
+
| `start()` | Build and start the server immediately |
|
|
131
|
+
|
|
132
|
+
## Logging
|
|
133
|
+
|
|
134
|
+
BootifyJS provides a flexible logging system with no external dependencies:
|
|
135
|
+
|
|
136
|
+
```typescript
|
|
137
|
+
import { createLogger, getLogger } from "bootifyjs/logging";
|
|
138
|
+
|
|
139
|
+
// Option 1: Use built-in BaseLogger
|
|
140
|
+
const logger = createLogger()
|
|
141
|
+
.setLevel("debug")
|
|
142
|
+
.setServiceName("my-api")
|
|
143
|
+
.configureConsole({ colorize: true, prettyPrint: true })
|
|
144
|
+
.build();
|
|
145
|
+
|
|
146
|
+
logger.info("Server started", { port: 3000 });
|
|
147
|
+
logger.error("Something went wrong", new Error("Oops"), { userId: 123 });
|
|
148
|
+
```
|
|
149
|
+
|
|
150
|
+
### Bring Your Own Logger
|
|
151
|
+
|
|
152
|
+
Create an adapter that implements `ILogger`:
|
|
153
|
+
|
|
154
|
+
```typescript
|
|
155
|
+
// adapters/pino-adapter.ts
|
|
156
|
+
import pino from "pino";
|
|
157
|
+
import { ILogger, LogContext } from "bootifyjs/logging";
|
|
158
|
+
|
|
159
|
+
export class PinoAdapter implements ILogger {
|
|
160
|
+
private logger: pino.Logger;
|
|
161
|
+
|
|
162
|
+
constructor(options: { level?: string; prettyPrint?: boolean } = {}) {
|
|
163
|
+
this.logger = pino({
|
|
164
|
+
level: options.level ?? "info",
|
|
165
|
+
transport: options.prettyPrint
|
|
166
|
+
? { target: "pino-pretty", options: { colorize: true } }
|
|
167
|
+
: undefined,
|
|
168
|
+
});
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
info(message: string, context?: LogContext): void {
|
|
172
|
+
this.logger.info(context ?? {}, message);
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
error(message: string, error?: Error, context?: LogContext): void {
|
|
176
|
+
this.logger.error({ ...context, err: error }, message);
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
// ... implement other methods: trace, debug, warn, fatal, child
|
|
180
|
+
}
|
|
181
|
+
```
|
|
182
|
+
|
|
183
|
+
Then use it with BootifyApp:
|
|
184
|
+
|
|
185
|
+
```typescript
|
|
186
|
+
import { createBootify } from "bootifyjs";
|
|
187
|
+
import { PinoAdapter } from "./adapters/pino-adapter";
|
|
188
|
+
|
|
189
|
+
createBootify()
|
|
190
|
+
.useLogger((builder) =>
|
|
191
|
+
builder.use(new PinoAdapter({ level: "info", prettyPrint: true }))
|
|
192
|
+
)
|
|
193
|
+
.start();
|
|
194
|
+
```
|
|
195
|
+
|
|
72
196
|
## Philosophy
|
|
73
197
|
|
|
74
198
|
BootifyJS is built on a few core principles:
|
|
@@ -76,14 +200,15 @@ BootifyJS is built on a few core principles:
|
|
|
76
200
|
- **Developer Experience First:** Frameworks should reduce boilerplate and complexity, not add to it. Our primary goal is to make development fast, intuitive, and enjoyable.
|
|
77
201
|
- **Convention Over Configuration:** We provide sensible defaults and automatic wiring so you can focus on writing business logic.
|
|
78
202
|
- **Robustness by Default:** Features like startup validation, graceful shutdown, and resilient event handling are built-in, helping you write production-ready code from day one.
|
|
79
|
-
- **Extensibility:** While the framework works out-of-the-box, it's designed to be pluggable and extensible. You can easily bring your own implementations for caching, authentication, and more.
|
|
203
|
+
- **Extensibility:** While the framework works out-of-the-box, it's designed to be pluggable and extensible. You can easily bring your own implementations for caching, authentication, logging, and more.
|
|
80
204
|
|
|
81
205
|
## Documentation
|
|
82
206
|
|
|
83
207
|
Dive deeper into the features of BootifyJS:
|
|
84
208
|
|
|
85
|
-
- [**Core Module**](https://github.com/piyushpriyadarshi/bootifyjs/tree/main/src/core
|
|
86
|
-
- [**Configuration**](https://github.com/piyushpriyadarshi/bootifyjs/tree/main/src/config
|
|
87
|
-
- [**Events Module**](https://github.com/piyushpriyadarshi/bootifyjs/tree/main/src/events
|
|
88
|
-
- [**Cache Module**](https://github.com/piyushpriyadarshi/bootifyjs/tree/main/src/cache
|
|
89
|
-
- [**Logging**](https://github.com/piyushpriyadarshi/bootifyjs/tree/main/src/logging
|
|
209
|
+
- [**Core Module**](https://github.com/piyushpriyadarshi/bootifyjs/tree/main/src/core): Learn about the Dependency Injection system, decorators, and component lifecycle.
|
|
210
|
+
- [**Configuration**](https://github.com/piyushpriyadarshi/bootifyjs/tree/main/src/config): Master the type-safe, schema-driven configuration system.
|
|
211
|
+
- [**Events Module**](https://github.com/piyushpriyadarshi/bootifyjs/tree/main/src/events): Master the event bus for building decoupled, event-driven services.
|
|
212
|
+
- [**Cache Module**](https://github.com/piyushpriyadarshi/bootifyjs/tree/main/src/cache): Speed up your application with our decorator-driven caching system.
|
|
213
|
+
- [**Logging**](https://github.com/piyushpriyadarshi/bootifyjs/tree/main/src/logging): Understand the structured, context-aware logging system.
|
|
214
|
+
- [**Scheduling**](https://github.com/piyushpriyadarshi/bootifyjs/tree/main/src/scheduling): Set up cron jobs and scheduled tasks.
|
package/dist/BootifyApp.d.ts
CHANGED
|
@@ -2,12 +2,12 @@ import { FastifyInstance, FastifyReply, FastifyRequest, FastifyServerOptions } f
|
|
|
2
2
|
import { ZodObject } from 'zod';
|
|
3
3
|
import { FastifyMiddleware } from './core/decorators';
|
|
4
4
|
import { Constructor } from './core/di-container';
|
|
5
|
-
import {
|
|
6
|
-
import { StreamingStartupLogger } from './logging/core/streaming-startup-logger';
|
|
5
|
+
import { ILogger, LoggerBuilder, StreamingStartupLogger } from './logging';
|
|
7
6
|
import { SchedulerService } from './scheduling/scheduler.service';
|
|
8
7
|
export type PluginRegistrationFn = (app: FastifyInstance) => Promise<void> | void;
|
|
9
8
|
export type ErrorHandlerFn = (error: Error, request: FastifyRequest, reply: FastifyReply) => Promise<void> | void;
|
|
10
9
|
export type LifecycleHookFn = (app: FastifyInstance) => Promise<void> | void;
|
|
10
|
+
export type LoggerConfigFn = (builder: LoggerBuilder) => LoggerBuilder;
|
|
11
11
|
export declare class BootifyApp {
|
|
12
12
|
private app;
|
|
13
13
|
private logger;
|
|
@@ -21,10 +21,16 @@ export declare class BootifyApp {
|
|
|
21
21
|
private afterStartHooks;
|
|
22
22
|
private customErrorHandler?;
|
|
23
23
|
private enableScheduler;
|
|
24
|
+
private loggerConfigFn?;
|
|
25
|
+
private serviceName;
|
|
24
26
|
private fastifyOptions;
|
|
25
27
|
setFastifyOptions(options: FastifyServerOptions): this;
|
|
26
28
|
setPort(port: number): this;
|
|
27
29
|
setHostname(hostname: string): this;
|
|
30
|
+
/**
|
|
31
|
+
* Set the service/application name (used in logs)
|
|
32
|
+
*/
|
|
33
|
+
setServiceName(name: string): this;
|
|
28
34
|
useConfig(schema: ZodObject<any>): this;
|
|
29
35
|
useControllers(controllers: Constructor[]): this;
|
|
30
36
|
usePlugin(plugin: PluginRegistrationFn): this;
|
|
@@ -34,10 +40,22 @@ export declare class BootifyApp {
|
|
|
34
40
|
beforeStart(hook: LifecycleHookFn): this;
|
|
35
41
|
afterStart(hook: LifecycleHookFn): this;
|
|
36
42
|
useScheduler(enabled?: boolean): this;
|
|
43
|
+
/**
|
|
44
|
+
* Configure the logger using the builder pattern
|
|
45
|
+
*
|
|
46
|
+
* @example
|
|
47
|
+
* createBootify()
|
|
48
|
+
* .useLogger(builder => builder
|
|
49
|
+
* .setLevel('debug')
|
|
50
|
+
* .addTransport(new MyCustomTransport())
|
|
51
|
+
* )
|
|
52
|
+
*/
|
|
53
|
+
useLogger(configFn: LoggerConfigFn): this;
|
|
54
|
+
private initializeLogger;
|
|
37
55
|
build(): Promise<{
|
|
38
56
|
app: FastifyInstance;
|
|
39
57
|
start: () => Promise<void>;
|
|
40
|
-
logger:
|
|
58
|
+
logger: ILogger;
|
|
41
59
|
startupLogger: StreamingStartupLogger;
|
|
42
60
|
scheduler?: SchedulerService;
|
|
43
61
|
}>;
|
package/dist/BootifyApp.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BootifyApp.d.ts","sourceRoot":"","sources":["../src/BootifyApp.ts"],"names":[],"mappings":"AAAA,OAAgB,EAAE,eAAe,EAAE,YAAY,EAAE,cAAc,EAAE,oBAAoB,EAAE,MAAM,SAAS,CAAA;AACtG,OAAO,EAAE,SAAS,EAAE,MAAM,KAAK,CAAA;AAG/B,OAAO,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAA;AACrD,OAAO,EAAE,WAAW,EAAa,MAAM,qBAAqB,CAAA;
|
|
1
|
+
{"version":3,"file":"BootifyApp.d.ts","sourceRoot":"","sources":["../src/BootifyApp.ts"],"names":[],"mappings":"AAAA,OAAgB,EAAE,eAAe,EAAE,YAAY,EAAE,cAAc,EAAE,oBAAoB,EAAE,MAAM,SAAS,CAAA;AACtG,OAAO,EAAE,SAAS,EAAE,MAAM,KAAK,CAAA;AAG/B,OAAO,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAA;AACrD,OAAO,EAAE,WAAW,EAAa,MAAM,qBAAqB,CAAA;AAE5D,OAAO,EAEH,OAAO,EACP,aAAa,EAGb,sBAAsB,EACzB,MAAM,WAAW,CAAA;AAClB,OAAO,EAAE,gBAAgB,EAAE,MAAM,gCAAgC,CAAA;AAEjE,MAAM,MAAM,oBAAoB,GAAG,CAAC,GAAG,EAAE,eAAe,KAAK,OAAO,CAAC,IAAI,CAAC,GAAG,IAAI,CAAA;AACjF,MAAM,MAAM,cAAc,GAAG,CAAC,KAAK,EAAE,KAAK,EAAE,OAAO,EAAE,cAAc,EAAE,KAAK,EAAE,YAAY,KAAK,OAAO,CAAC,IAA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e,CAAC,OAAO,EAAE,cAAc,GAAG,IAAI;IAK9C,WAAW,CAAC,IAAI,EAAE,eAAe,GAAG,IAAI;IAKxC,UAAU,CAAC,IAAI,EAAE,eAAe,GAAG,IAAI;IAKvC,YAAY,CAAC,OAAO,GAAE,OAAc,GAAG,IAAI;IAK3C;;;;;;;;;OASG;IACH,SAAS,CAAC,QAAQ,EAAE,cAAc,GAAG,IAAI;IAKzC,OAAO,CAAC,gBAAgB;IAiBlB,KAAK,IAAI,OAAO,CAAC;QACnB,GAAG,EAAE,eAAe,CAAA;QACpB,KAAK,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAA;QAC1B,MAAM,EAAE,OAAO,CAAA;QACf,aAAa,EAAE,sBAAsB,CAAA;QACrC,SAAS,CAAC,EAAE,gBAAgB,CAAA;KAC/B,CAAC;IA0EI,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC;IAK5B,OAAO,CAAC,qBAAqB;CAgBhC;AAED,wBAAgB,aAAa,IAAI,UAAU,CAE1C"}
|
package/dist/BootifyApp.js
CHANGED
|
@@ -21,6 +21,7 @@ class BootifyApp {
|
|
|
21
21
|
this.beforeStartHooks = [];
|
|
22
22
|
this.afterStartHooks = [];
|
|
23
23
|
this.enableScheduler = true;
|
|
24
|
+
this.serviceName = 'bootify-app';
|
|
24
25
|
this.fastifyOptions = {
|
|
25
26
|
logger: false,
|
|
26
27
|
ignoreTrailingSlash: true,
|
|
@@ -38,6 +39,13 @@ class BootifyApp {
|
|
|
38
39
|
this.hostname = hostname;
|
|
39
40
|
return this;
|
|
40
41
|
}
|
|
42
|
+
/**
|
|
43
|
+
* Set the service/application name (used in logs)
|
|
44
|
+
*/
|
|
45
|
+
setServiceName(name) {
|
|
46
|
+
this.serviceName = name;
|
|
47
|
+
return this;
|
|
48
|
+
}
|
|
41
49
|
useConfig(schema) {
|
|
42
50
|
AppConfig_1.AppConfig.initialize(schema);
|
|
43
51
|
return this;
|
|
@@ -76,25 +84,54 @@ class BootifyApp {
|
|
|
76
84
|
this.enableScheduler = enabled;
|
|
77
85
|
return this;
|
|
78
86
|
}
|
|
87
|
+
/**
|
|
88
|
+
* Configure the logger using the builder pattern
|
|
89
|
+
*
|
|
90
|
+
* @example
|
|
91
|
+
* createBootify()
|
|
92
|
+
* .useLogger(builder => builder
|
|
93
|
+
* .setLevel('debug')
|
|
94
|
+
* .addTransport(new MyCustomTransport())
|
|
95
|
+
* )
|
|
96
|
+
*/
|
|
97
|
+
useLogger(configFn) {
|
|
98
|
+
this.loggerConfigFn = configFn;
|
|
99
|
+
return this;
|
|
100
|
+
}
|
|
101
|
+
initializeLogger() {
|
|
102
|
+
let builder = (0, logging_1.createLogger)()
|
|
103
|
+
.setServiceName(this.serviceName)
|
|
104
|
+
.setLevel(process.env.LOG_LEVEL || 'info')
|
|
105
|
+
.addContextProvider(new logging_1.RequestContextProvider())
|
|
106
|
+
.setBaseContext({
|
|
107
|
+
environment: process.env.NODE_ENV || 'development',
|
|
108
|
+
});
|
|
109
|
+
// Apply user customizations
|
|
110
|
+
if (this.loggerConfigFn) {
|
|
111
|
+
builder = this.loggerConfigFn(builder);
|
|
112
|
+
}
|
|
113
|
+
return builder.build();
|
|
114
|
+
}
|
|
79
115
|
async build() {
|
|
80
|
-
|
|
81
|
-
this.logger =
|
|
82
|
-
|
|
83
|
-
startupLogger.
|
|
116
|
+
// Initialize the new logging system
|
|
117
|
+
this.logger = this.initializeLogger();
|
|
118
|
+
// Initialize startup logger (still uses the streaming one for nice output)
|
|
119
|
+
this.startupLogger = di_container_1.container.resolve(logging_1.StreamingStartupLogger);
|
|
120
|
+
this.startupLogger.logStartupBanner();
|
|
84
121
|
this.app = (0, fastify_1.default)(this.fastifyOptions);
|
|
85
122
|
for (const plugin of this.plugins) {
|
|
86
123
|
await plugin(this.app);
|
|
87
124
|
}
|
|
88
125
|
if (this.controllers.length > 0) {
|
|
89
|
-
startupLogger.logPhaseStart('Registering Controllers');
|
|
90
|
-
startupLogger.logComponentStart('Controllers', `${this.controllers.length} found`);
|
|
126
|
+
this.startupLogger.logPhaseStart('Registering Controllers');
|
|
127
|
+
this.startupLogger.logComponentStart('Controllers', `${this.controllers.length} found`);
|
|
91
128
|
(0, router_1.registerControllers)(this.app, this.controllers);
|
|
92
|
-
startupLogger.logComponentComplete();
|
|
129
|
+
this.startupLogger.logComponentComplete();
|
|
93
130
|
}
|
|
94
131
|
if (this.customErrorHandler) {
|
|
95
132
|
this.app.setErrorHandler(this.customErrorHandler);
|
|
96
133
|
}
|
|
97
|
-
startupLogger.logStartupComplete();
|
|
134
|
+
this.startupLogger.logStartupComplete();
|
|
98
135
|
if (this.enableScheduler) {
|
|
99
136
|
this.scheduler = di_container_1.container.resolve(scheduler_service_1.SchedulerService);
|
|
100
137
|
}
|
|
@@ -104,19 +141,25 @@ class BootifyApp {
|
|
|
104
141
|
await hook(this.app);
|
|
105
142
|
}
|
|
106
143
|
if (this.enableScheduler && this.scheduler) {
|
|
107
|
-
startupLogger.logComponentStart('Scheduler', 'Starting scheduled jobs');
|
|
144
|
+
this.startupLogger.logComponentStart('Scheduler', 'Starting scheduled jobs');
|
|
108
145
|
await this.scheduler.start();
|
|
109
|
-
startupLogger.logComponentComplete();
|
|
146
|
+
this.startupLogger.logComponentComplete();
|
|
110
147
|
}
|
|
111
148
|
await this.app.listen({ port: this.port, host: this.hostname });
|
|
112
|
-
startupLogger.logStartupSummary(this.port, this.hostname);
|
|
149
|
+
this.startupLogger.logStartupSummary(this.port, this.hostname);
|
|
150
|
+
// Log with the new logger
|
|
151
|
+
this.logger.info('Application started successfully', {
|
|
152
|
+
port: this.port,
|
|
153
|
+
host: this.hostname,
|
|
154
|
+
environment: process.env.NODE_ENV,
|
|
155
|
+
});
|
|
113
156
|
for (const hook of this.afterStartHooks) {
|
|
114
157
|
await hook(this.app);
|
|
115
158
|
}
|
|
116
159
|
this.setupGracefulShutdown();
|
|
117
160
|
}
|
|
118
161
|
catch (err) {
|
|
119
|
-
this.
|
|
162
|
+
this.logger.error('Failed to start application', err);
|
|
120
163
|
process.exit(1);
|
|
121
164
|
}
|
|
122
165
|
};
|
|
@@ -134,12 +177,12 @@ class BootifyApp {
|
|
|
134
177
|
}
|
|
135
178
|
setupGracefulShutdown() {
|
|
136
179
|
const shutdown = async (signal) => {
|
|
137
|
-
|
|
180
|
+
this.logger.info(`Received ${signal}, shutting down gracefully...`);
|
|
138
181
|
if (this.scheduler) {
|
|
139
182
|
await this.scheduler.stop();
|
|
140
183
|
}
|
|
141
184
|
await this.app.close();
|
|
142
|
-
|
|
185
|
+
this.logger.info('Shutdown complete');
|
|
143
186
|
process.exit(0);
|
|
144
187
|
};
|
|
145
188
|
process.on('SIGTERM', () => shutdown('SIGTERM'));
|
package/dist/BootifyApp.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BootifyApp.js","sourceRoot":"","sources":["../src/BootifyApp.ts"],"names":[],"mappings":";;;;;;
|
|
1
|
+
{"version":3,"file":"BootifyApp.js","sourceRoot":"","sources":["../src/BootifyApp.ts"],"names":[],"mappings":";;;;;;AAuPA,sCAEC;AAzPD,sDAAsG;AAEtG,kDAA8C;AAC9C,2CAAsE;AAEtE,sDAA4D;AAC5D,0CAAmD;AACnD,uCAOkB;AAClB,sEAAiE;AAOjE,MAAa,UAAU;IAAvB;QAKY,SAAI,GAAW,+BAAmB,CAAA;QAClC,aAAQ,GAAW,+BAAmB,CAAA;QACtC,gBAAW,GAAkB,EAAE,CAAA;QAC/B,YAAO,GAA2B,EAAE,CAAA;QACpC,qBAAgB,GAAsB,EAAE,CAAA;QACxC,oBAAe,GAAsB,EAAE,CAAA;QAEvC,oBAAe,GAAY,IAAI,CAAA;QAE/B,gBAAW,GAAW,aAAa,CAAA;QACnC,mBAAc,GAAyB;YAC3C,MAAM,EAAE,KAAK;YACb,mBAAmB,EAAE,IAAI;SAC5B,CAAA;IA6ML,CAAC;IA3MG,iBAAiB,CAAC,OAA6B;QAC3C,IAAI,CAAC,cAAc,GAA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C,KAAK,EAAE,CAAA;QACpC,MAAM,KAAK,EAAE,CAAA;IACjB,CAAC;IAEO,qBAAqB;QACzB,MAAM,QAAQ,GAAG,KAAK,EAAE,MAAc,EAAE,EAAE;YACtC,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,YAAY,MAAM,+BAA+B,CAAC,CAAA;YAEnE,IAAI,IAAI,CAAC,SAAS,EAAE,CAAC;gBACjB,MAAM,IAAI,CAAC,SAAS,CAAC,IAAI,EAAE,CAAA;YAC/B,CAAC;YAED,MAAM,IAAI,CAAC,GAAG,CAAC,KAAK,EAAE,CAAA;YACtB,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,mBAAmB,CAAC,CAAA;YACrC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAA;QACnB,CAAC,CAAA;QAED,OAAO,CAAC,EAAE,CAAC,SAAS,EAAE,GAAG,EAAE,CAAC,QAAQ,CAAC,SAAS,CAAC,CAAC,CAAA;QAChD,OAAO,CAAC,EAAE,CAAC,QAAQ,EAAE,GAAG,EAAE,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC,CAAA;IAClD,CAAC;CACJ;AA/ND,gCA+NC;AAED,SAAgB,aAAa;IACzB,OAAO,IAAI,UAAU,EAAE,CAAA;AAC3B,CAAC"}
|
package/dist/config/AppConfig.js
CHANGED
|
@@ -35,7 +35,7 @@ FrameworkConfigSchema = FrameworkConfigSchema.merge(LoggingConfigSchema);
|
|
|
35
35
|
class AppConfig {
|
|
36
36
|
constructor(userSchema) {
|
|
37
37
|
// Merge framework and user schemas
|
|
38
|
-
this.mergedSchema = FrameworkConfigSchema.merge(userSchema || zod_1.z.object({}));
|
|
38
|
+
this.mergedSchema = FrameworkConfigSchema.merge(userSchema || zod_1.z.object({})).passthrough();
|
|
39
39
|
// Validate and load configuration
|
|
40
40
|
this.config = this.validateConfig();
|
|
41
41
|
// Optional debug output
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AppConfig.js","sour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;QAC5E,MAAM,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC,OAAO,CAAC,CAAC,GAAG,EAAE,EAAE;YACvC,IAAI,aAAa,CAAC,IAAI,CAAC,CAAC,SAAS,EAAE,EAAE,CAAC,GAAG,CAAC,WAAW,EAAE,CAAC,QAAQ,CAAC,SAAS,CAAC,CAAC,EAAE,CAAC;gBAC7E,WAAW,CAAC,GAA+B,CAAC,GAAG,OAAc,CAAA;YAC/D,CAAC;QACH,CAAC,CAAC,CAAA;QAEF,OAAO,CAAC,GAAG,CAAC,uBAAuB,EAAE,WAAW,CAAC,CAAA;IACnD,CAAC;CACF;AAnHD,8BAmHC"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { ILogger, LogContext } from '../../logging';
|
|
2
|
+
export interface PinoLoggerOptions {
|
|
3
|
+
level?: string;
|
|
4
|
+
serviceName?: string;
|
|
5
|
+
prettyPrint?: boolean;
|
|
6
|
+
}
|
|
7
|
+
export declare class PinoLoggerAdapter implements ILogger {
|
|
8
|
+
private logger;
|
|
9
|
+
constructor(options?: PinoLoggerOptions);
|
|
10
|
+
trace(message: string, context?: LogContext): void;
|
|
11
|
+
debug(message: string, context?: LogContext): void;
|
|
12
|
+
info(message: string, context?: LogContext): void;
|
|
13
|
+
warn(message: string, context?: LogContext): void;
|
|
14
|
+
error(message: string, error?: Error, context?: LogContext): void;
|
|
15
|
+
fatal(message: string, error?: Error, context?: LogContext): void;
|
|
16
|
+
child(bindings: LogContext): ILogger;
|
|
17
|
+
}
|
|
18
|
+
//# sourceMappingURL=pino-logger.adapter.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pino-logger.adapter.d.ts","sourceRoot":"","sources":["../../../src/examples/adapters/pino-logger.adapter.ts"],"names":[],"mappings":"AAaA,OAAO,EAAE,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAA;AAEnD,MAAM,WAAW,iBAAiB;IAC9B,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,WAAW,CAAC,EAAE,OAAO,CAAA;CACxB;AAED,qBAAa,iBAAkB,YAAW,OAAO;IAC7C,OAAO,CAAC,MAAM,CAAa;gBAEf,OAAO,GAAE,iBAAsB;IAoC3C,KAAK,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,UAAU,GAAG,IAAI;IAIlD,KAAK,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,UAAU,GAAG,IAAI;IAIlD,IAAI,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,UAAU,GAAG,IAAI;IAIjD,IAAI,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,UAAU,GAAG,IAAI;IAIjD,KAAK,CAAC,OAAO,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,KAAK,EAAE,OAAO,CAAC,EAAE,UAAU,GAAG,IAAI;IAIjE,KAAK,CAAC,OAAO,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,KAAK,EAAE,OAAO,CAAC,EAAE,UAAU,GAAG,IAAI;IAIjE,KAAK,CAAC,QAAQ,EAAE,UAAU,GAAG,OAAO;CAKvC"}
|
package/dist/{logging/core/adapters/pino.adapter.js → examples/adapters/pino-logger.adapter.js}
RENAMED
|
@@ -3,34 +3,40 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.
|
|
6
|
+
exports.PinoLoggerAdapter = void 0;
|
|
7
7
|
/**
|
|
8
|
-
* Pino Adapter
|
|
8
|
+
* Example: Pino Logger Adapter with Request Context
|
|
9
9
|
*
|
|
10
|
-
* This
|
|
11
|
-
*
|
|
12
|
-
*
|
|
10
|
+
* This shows how users can create their own logger adapter
|
|
11
|
+
* that implements the ILogger interface from BootifyJS.
|
|
12
|
+
*
|
|
13
|
+
* This adapter automatically includes request context (requestId, userId, etc.)
|
|
14
|
+
* in all log entries using Pino's mixin feature.
|
|
15
|
+
*
|
|
16
|
+
* Users must install pino themselves: npm install pino pino-pretty
|
|
13
17
|
*/
|
|
14
18
|
const pino_1 = __importDefault(require("pino"));
|
|
15
|
-
|
|
19
|
+
const request_context_service_1 = require("../../core/request-context.service");
|
|
20
|
+
class PinoLoggerAdapter {
|
|
16
21
|
constructor(options = {}) {
|
|
17
22
|
const pinoOptions = {
|
|
18
23
|
level: options.level ?? 'info',
|
|
19
24
|
messageKey: 'message',
|
|
20
25
|
base: {
|
|
21
|
-
service: options.serviceName ?? '
|
|
26
|
+
service: options.serviceName ?? 'app',
|
|
22
27
|
pid: process.pid,
|
|
23
28
|
},
|
|
24
29
|
timestamp: () => `,"timestamp":"${new Date().toISOString()}"`,
|
|
25
|
-
|
|
30
|
+
// Mixin automatically adds request context to every log entry
|
|
31
|
+
mixin() {
|
|
32
|
+
const store = request_context_service_1.requestContextStore.getStore();
|
|
33
|
+
if (!store) {
|
|
34
|
+
return {};
|
|
35
|
+
}
|
|
36
|
+
return Object.fromEntries(store.entries());
|
|
37
|
+
},
|
|
26
38
|
};
|
|
27
|
-
if (options.
|
|
28
|
-
this.logger = (0, pino_1.default)({
|
|
29
|
-
...pinoOptions,
|
|
30
|
-
transport: { targets: options.transports },
|
|
31
|
-
});
|
|
32
|
-
}
|
|
33
|
-
else if (options.prettyPrint) {
|
|
39
|
+
if (options.prettyPrint) {
|
|
34
40
|
this.logger = (0, pino_1.default)({
|
|
35
41
|
...pinoOptions,
|
|
36
42
|
transport: {
|
|
@@ -66,17 +72,10 @@ class PinoAdapter {
|
|
|
66
72
|
this.logger.fatal({ ...context, err: error }, message);
|
|
67
73
|
}
|
|
68
74
|
child(bindings) {
|
|
69
|
-
const
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
return adapter;
|
|
73
|
-
}
|
|
74
|
-
/**
|
|
75
|
-
* Get the underlying Pino logger for advanced usage
|
|
76
|
-
*/
|
|
77
|
-
getPinoInstance() {
|
|
78
|
-
return this.logger;
|
|
75
|
+
const childLogger = new PinoLoggerAdapter();
|
|
76
|
+
childLogger.logger = this.logger.child(bindings);
|
|
77
|
+
return childLogger;
|
|
79
78
|
}
|
|
80
79
|
}
|
|
81
|
-
exports.
|
|
82
|
-
//# sourceMappingURL=pino.adapter.js.map
|
|
80
|
+
exports.PinoLoggerAdapter = PinoLoggerAdapter;
|
|
81
|
+
//# sourceMappingURL=pino-logger.adapter.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pino-logger.adapter.js","sourceRoot":"","sources":["../../../src/examples/adapters/pino-logger.adapter.ts"],"names":[],"mappings":";;;;;;AAAA;;;;;;;;;;GAUG;AACH,gDAAuB;AACvB,gFAAwE;AASxE,MAAa,iBAAiB;IAG1B,YAAY,UAA6B,EAAE;QACvC,MAAM,WAAW,GAAuB;YACpC,KAAK,EAAE,OAAO,CAAC,KAAK,IAAI,MAAM;YAC9B,UAAU,EAAE,SAAS;YACrB,IAAI,EAAE;gBACF,OAAO,EAAE,OAAO,CAAC,WAAW,IAAI,KAAK;gBACrC,GAAG,EAAE,OAAO,CAAC,GAAG;aACnB;YACD,SAAS,EAAE,GAAG,EAAE,CAAC,iBAAiB,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE,GAAG;YAC7D,8DAA8D;YAC9D,KAAK;gBACD,MAAM,KAAK,GAAG,6CAAmB,CAAC,QAAQ,EAAE,CAAA;gBAC5C,IAAI,CAAC,KAAK,EAAE,CAAC;oBACT,OAAO,EAAE,CAAA;gBACb,CAAC;gBACD,OAAO,MAAM,CAAC,WAAW,CAAC,KAAK,CAAC,OAAO,EAAE,CAAC,CAAA;YAC9C,CAAC;SACJ,CAAA;QAED,IAAI,OAAO,CAAC,WAAW,EAAE,CAAC;YACtB,IAAI,CAAC,MAAM,GAAG,IAAA,cAAI,EAAC;gBACf,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,iBAAiB,EAAE,CACtC;QAAE,WAAmB,CAAC,MAAM,GAAG,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAA;QAC/D,OAAO,WAAW,CAAA;IACtB,CAAC;CACJ;AApED,8CAoEC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"todo.controller.d.ts","sourceRoot":"","sources":["../../../src/examples/controllers/todo.controller.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAkBvB,OAAO,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAA;AAUtD,QAAA,MAAM,UAAU;;;;;;EAIH,CAAA;AAUb,qBAGa,cAAc;IACb,OAAO,CAAC,QAAQ,CAAC,WAAW;gBAAX,WAAW,EAAE,WAAW;IAGrD,OAAO,CAAC,cAAc,CAAiB;IAGvC,OAAO,CAAC,WAAW,CAAc;IAEjC,OAAO,CAAC,MAAM,
|
|
1
|
+
{"version":3,"file":"todo.controller.d.ts","sourceRoot":"","sources":["../../../src/examples/controllers/todo.controller.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAkBvB,OAAO,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAA;AAUtD,QAAA,MAAM,UAAU;;;;;;EAIH,CAAA;AAUb,qBAGa,cAAc;IACb,OAAO,CAAC,QAAQ,CAAC,WAAW;gBAAX,WAAW,EAAE,WAAW;IAGrD,OAAO,CAAC,cAAc,CAAiB;IAGvC,OAAO,CAAC,WAAW,CAAc;IAEjC,OAAO,CAAC,MAAM,CAAU;IAQxB,WAAW;;;;;IAqBX,WAAW,CAAc,EAAE,EAAE,MAAM;;;;;IA2B7B,UAAU,CAAS,IAAI,EAAE,CAAC,CAAC,KAAK,CAAC,OAAO,UAAU,CAAC;;;;;CAc1D"}
|
|
@@ -20,7 +20,6 @@ const decorators_2 = require("../../core/decorators");
|
|
|
20
20
|
const di_container_1 = require("../../core/di-container");
|
|
21
21
|
const request_context_service_1 = require("../../core/request-context.service");
|
|
22
22
|
const decorators_3 = require("../../logging/core/decorators");
|
|
23
|
-
const logger_1 = require("../../logging/core/logger");
|
|
24
23
|
const tracing_service_1 = require("../../logging/core/tracing.service");
|
|
25
24
|
const todo_service_1 = require("../services/todo.service");
|
|
26
25
|
const createTodoSchema = {
|
|
@@ -50,9 +49,7 @@ let TodoController = class TodoController {
|
|
|
50
49
|
// name: 'get all todos',
|
|
51
50
|
// })
|
|
52
51
|
console.log(context.store());
|
|
53
|
-
|
|
54
|
-
logger1.info('Hello from logger 1 get all todo');
|
|
55
|
-
console.log(this.logger === logger1);
|
|
52
|
+
// Using the injected logger from @Loggable decorator
|
|
56
53
|
this.logger.info('Hello from get all todo');
|
|
57
54
|
// this.tracingService.spanEnd(span, 'ok')
|
|
58
55
|
return this.todoService.getAllTodos();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"todo.controller.js","sourceRoot":"","sources":["../../../src/examples/controllers/todo.controller.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,6BAAuB;AACvB,qCAAwC;AACxC,uDAAkD;AAClD,sDAS8B;AAC9B,0DAAmD;AACnD,gFAA0E;AAC1E,8DAA+D;
|
|
1
|
+
{"version":3,"file":"todo.controller.js","sourceRoot":"","sources":["../../../src/examples/controllers/todo.controller.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,6BAAuB;AACvB,qCAAwC;AACxC,uDAAkD;AAClD,sDAS8B;AAC9B,0DAAmD;AACnD,gFAA0E;AAC1E,8DAA+D;AAE/D,wEAAmE;AACnE,2DAAsD;AAEtD,MAAM,gBAAgB,GAAG;IACvB,IAAI,EAAE,OAAC;SACJ,MAAM,CAAC;QACN,IAAI,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,EAAE,sBAAsB,CAAC;KAChD,CAAC;SACD,QAAQ,EAAE;CACd,CAAA;AAED,MAAM,UAAU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EAAE,CAAC,OAAO,CAAC;QACf,WAAW,EAAE,YAAY;KAC1B,CAAC;IACF,yCAAyC;;IACvB,WAAA,IAAA,iBAAI,GAAE,CAAA;;;;gDAavB;yBA9EU,cAAc;IAH1B,IAAA,qBAAQ,GAAE;IACV,IAAA,uBAAU,EAAC,QAAQ,CAAC;IACrB,4EAA4E;;qCAEhC,0BAAW;GAD1C,cAAc,CA+E1B"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/examples/index.ts"],"names":[],"mappings":"AAEA,OAAO,kBAAkB,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/examples/index.ts"],"names":[],"mappings":"AAEA,OAAO,kBAAkB,CAAC;AAe1B,OAAO,mCAAmC,CAAC;AAG3C,OAAO,oCAAoC,CAAC"}
|