@grupodiariodaregiao/bunstone 0.0.27
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 +91 -0
- package/bin/cli.ts +182 -0
- package/dist/index.d.ts +36 -0
- package/dist/index.js +4316 -0
- package/dist/lib/adapters/cache-adapter.d.ts +19 -0
- package/dist/lib/adapters/form-data.d.ts +4 -0
- package/dist/lib/adapters/upload-adapter.d.ts +22 -0
- package/dist/lib/app-startup.d.ts +76 -0
- package/dist/lib/components/layout.d.ts +8 -0
- package/dist/lib/constants/index.d.ts +1 -0
- package/dist/lib/controller.d.ts +14 -0
- package/dist/lib/cqrs/command-bus.d.ts +19 -0
- package/dist/lib/cqrs/cqrs-module.d.ts +2 -0
- package/dist/lib/cqrs/decorators/command-handler.decorator.d.ts +7 -0
- package/dist/lib/cqrs/decorators/event-handler.decorator.d.ts +7 -0
- package/dist/lib/cqrs/decorators/query-handler.decorator.d.ts +7 -0
- package/dist/lib/cqrs/decorators/saga.decorator.d.ts +7 -0
- package/dist/lib/cqrs/event-bus.d.ts +38 -0
- package/dist/lib/cqrs/interfaces/command.interface.d.ts +5 -0
- package/dist/lib/cqrs/interfaces/event.interface.d.ts +5 -0
- package/dist/lib/cqrs/interfaces/query.interface.d.ts +5 -0
- package/dist/lib/cqrs/query-bus.d.ts +19 -0
- package/dist/lib/database/sql-module.d.ts +25 -0
- package/dist/lib/guard.d.ts +8 -0
- package/dist/lib/http-exceptions.d.ts +73 -0
- package/dist/lib/http-methods.d.ts +36 -0
- package/dist/lib/http-params.d.ts +28 -0
- package/dist/lib/injectable.d.ts +12 -0
- package/dist/lib/interfaces/class-constructor.d.ts +6 -0
- package/dist/lib/interfaces/guard-contract.d.ts +7 -0
- package/dist/lib/jwt/jwt-module.d.ts +13 -0
- package/dist/lib/jwt.d.ts +5 -0
- package/dist/lib/module.d.ts +18 -0
- package/dist/lib/openapi.d.ts +52 -0
- package/dist/lib/render.d.ts +7 -0
- package/dist/lib/schedule/cron/cron.d.ts +7 -0
- package/dist/lib/schedule/cron/mappers/map-providers-with-cron.d.ts +8 -0
- package/dist/lib/schedule/timeout/mappers/map-providers-with-timeouts.d.ts +9 -0
- package/dist/lib/schedule/timeout/timeout.d.ts +7 -0
- package/dist/lib/types/http-request.d.ts +13 -0
- package/dist/lib/types/module-config.d.ts +14 -0
- package/dist/lib/types/options.d.ts +24 -0
- package/dist/lib/utils/colors.d.ts +36 -0
- package/dist/lib/utils/dependency-injection.d.ts +25 -0
- package/dist/lib/utils/is-class.d.ts +1 -0
- package/dist/lib/utils/is-zod-schema.d.ts +2 -0
- package/dist/lib/utils/logger.d.ts +38 -0
- package/dist/lib/utils/map-providers.d.ts +14 -0
- package/package.json +47 -0
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Configuration options for a module.
|
|
3
|
+
* @property providers - An array of provider classes.
|
|
4
|
+
* @property imports - An array of imported module classes.
|
|
5
|
+
* @property controllers - An array of controller classes.
|
|
6
|
+
* @property exports - An array of exported provider classes.
|
|
7
|
+
*/
|
|
8
|
+
export type ModuleConfig = {
|
|
9
|
+
providers?: (new (...args: any[]) => any)[];
|
|
10
|
+
imports?: (new (...args: any[]) => any)[];
|
|
11
|
+
controllers?: (new (...args: any[]) => any)[];
|
|
12
|
+
exports?: (new (...args: any[]) => any)[];
|
|
13
|
+
global?: boolean;
|
|
14
|
+
};
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import type { CORSConfig } from "@elysiajs/cors";
|
|
2
|
+
/**
|
|
3
|
+
* Options for configuring the application.
|
|
4
|
+
* @property cors - CORS configuration options.
|
|
5
|
+
* @property swagger - Swagger configuration options.
|
|
6
|
+
*/
|
|
7
|
+
export type Options = {
|
|
8
|
+
cors?: CORSConfig;
|
|
9
|
+
viewsDir?: string;
|
|
10
|
+
swagger?: {
|
|
11
|
+
path?: string;
|
|
12
|
+
documentation?: {
|
|
13
|
+
info: {
|
|
14
|
+
title: string;
|
|
15
|
+
version: string;
|
|
16
|
+
description?: string;
|
|
17
|
+
};
|
|
18
|
+
tags?: {
|
|
19
|
+
name: string;
|
|
20
|
+
description: string;
|
|
21
|
+
}[];
|
|
22
|
+
};
|
|
23
|
+
};
|
|
24
|
+
};
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
export declare const colors: {
|
|
2
|
+
readonly red: "\u001B[31m";
|
|
3
|
+
readonly green: "\u001B[32m";
|
|
4
|
+
readonly blue: "\u001B[34m";
|
|
5
|
+
readonly purple: "\u001B[35m";
|
|
6
|
+
readonly reset: "\u001B[0m";
|
|
7
|
+
readonly yellow: "\u001B[33m";
|
|
8
|
+
readonly cyan: "\u001B[36m";
|
|
9
|
+
readonly magenta: "\u001B[35m";
|
|
10
|
+
readonly gray: "\u001B[90m";
|
|
11
|
+
readonly white: "\u001B[37m";
|
|
12
|
+
readonly brightRed: "\u001B[91m";
|
|
13
|
+
readonly brightGreen: "\u001B[92m";
|
|
14
|
+
readonly brightYellow: "\u001B[93m";
|
|
15
|
+
readonly brightBlue: "\u001B[94m";
|
|
16
|
+
readonly brightMagenta: "\u001B[95m";
|
|
17
|
+
readonly brightCyan: "\u001B[96m";
|
|
18
|
+
readonly brightWhite: "\u001B[97m";
|
|
19
|
+
readonly bgRed: "\u001B[41m";
|
|
20
|
+
readonly bgGreen: "\u001B[42m";
|
|
21
|
+
readonly bgYellow: "\u001B[43m";
|
|
22
|
+
readonly bgBlue: "\u001B[44m";
|
|
23
|
+
readonly bgMagenta: "\u001B[45m";
|
|
24
|
+
readonly bgCyan: "\u001B[46m";
|
|
25
|
+
readonly bgWhite: "\u001B[47m";
|
|
26
|
+
readonly bold: "\u001B[1m";
|
|
27
|
+
readonly dim: "\u001B[2m";
|
|
28
|
+
readonly italic: "\u001B[3m";
|
|
29
|
+
readonly underline: "\u001B[4m";
|
|
30
|
+
readonly blink: "\u001B[5m";
|
|
31
|
+
readonly reverse: "\u001B[7m";
|
|
32
|
+
readonly hidden: "\u001B[8m";
|
|
33
|
+
readonly strikethrough: "\u001B[9m";
|
|
34
|
+
};
|
|
35
|
+
export type Color = keyof typeof colors;
|
|
36
|
+
export declare const colorize: (text: string, ...styles: string[]) => string;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import "reflect-metadata";
|
|
2
|
+
/**
|
|
3
|
+
* Utility functions for dependency injection.
|
|
4
|
+
*/
|
|
5
|
+
export declare class GlobalRegistry {
|
|
6
|
+
private static globalDeps;
|
|
7
|
+
static register(type: any, instance: any): void;
|
|
8
|
+
static get(type: any): any;
|
|
9
|
+
static has(type: any): boolean;
|
|
10
|
+
static getAll(): Map<any, any>;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Resolves dependencies for a constructor based on parameter types.
|
|
14
|
+
* @param paramTypes Array of parameter types.
|
|
15
|
+
* @param deps Map of available dependencies.
|
|
16
|
+
* @returns Array of resolved dependencies.
|
|
17
|
+
*/
|
|
18
|
+
export declare function resolveDependencies(paramTypes: any[], deps: Map<any, any>): any[];
|
|
19
|
+
/**
|
|
20
|
+
* Resolves a single type, creating an instance if it doesn't exist in the deps map.
|
|
21
|
+
* @param type The class/type to resolve.
|
|
22
|
+
* @param deps Map of available dependencies.
|
|
23
|
+
* @returns The resolved instance.
|
|
24
|
+
*/
|
|
25
|
+
export declare function resolveType(type: any, deps: Map<any, any>): any;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function isClass(fn: any): boolean;
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
export declare enum LogLevel {
|
|
2
|
+
DEBUG = 0,
|
|
3
|
+
INFO = 1,
|
|
4
|
+
WARN = 2,
|
|
5
|
+
ERROR = 3,
|
|
6
|
+
FATAL = 4
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* Options for configuring the logger.
|
|
10
|
+
*/
|
|
11
|
+
export interface LoggerOptions {
|
|
12
|
+
level?: LogLevel;
|
|
13
|
+
timestamp?: boolean;
|
|
14
|
+
pretty?: boolean;
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* A logger class with support for different log levels, colors, and formatting.
|
|
18
|
+
*/
|
|
19
|
+
export declare class Logger {
|
|
20
|
+
private name;
|
|
21
|
+
private level;
|
|
22
|
+
private showTimestamp;
|
|
23
|
+
private pretty;
|
|
24
|
+
constructor(name: string, options?: LoggerOptions);
|
|
25
|
+
private getTimestamp;
|
|
26
|
+
private formatMessage;
|
|
27
|
+
private shouldLog;
|
|
28
|
+
debug(...args: any[]): void;
|
|
29
|
+
info(...args: any[]): void;
|
|
30
|
+
log(...args: any[]): void;
|
|
31
|
+
warn(...args: any[]): void;
|
|
32
|
+
error(...args: any[]): void;
|
|
33
|
+
fatal(...args: any[]): void;
|
|
34
|
+
child(childName: string): Logger;
|
|
35
|
+
setLevel(level: LogLevel): void;
|
|
36
|
+
group(label: string, callback: () => void): void;
|
|
37
|
+
time<T>(label: string, callback: () => Promise<T> | T): Promise<T>;
|
|
38
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Utility to map providers with specific decorator types.
|
|
3
|
+
*/
|
|
4
|
+
/**
|
|
5
|
+
* Maps providers to their decorated methods based on type.
|
|
6
|
+
* @param providers Array of provider classes.
|
|
7
|
+
* @param type The type of decorator (e.g., 'cron', 'timeout').
|
|
8
|
+
* @returns A map of providers to their methods.
|
|
9
|
+
*/
|
|
10
|
+
export declare function mapProvidersWithType(providers: (new (...args: any[]) => any)[] | undefined, type: string): Map<any, {
|
|
11
|
+
expression?: string;
|
|
12
|
+
delay?: number;
|
|
13
|
+
methodName: string;
|
|
14
|
+
}[]>;
|
package/package.json
ADDED
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@grupodiariodaregiao/bunstone",
|
|
3
|
+
"main": "./dist/index.js",
|
|
4
|
+
"module": "./dist/index.js",
|
|
5
|
+
"types": "./dist/index.d.ts",
|
|
6
|
+
"version": "0.0.27",
|
|
7
|
+
"type": "module",
|
|
8
|
+
"bin": {
|
|
9
|
+
"bunstone": "./bin/cli.ts"
|
|
10
|
+
},
|
|
11
|
+
"files": [
|
|
12
|
+
"dist",
|
|
13
|
+
"bin",
|
|
14
|
+
"README.md"
|
|
15
|
+
],
|
|
16
|
+
"scripts": {
|
|
17
|
+
"test": "bun test",
|
|
18
|
+
"build": "rm -rf dist && bun build ./index.ts --outdir ./dist --target bun && tsc --emitDeclarationOnly --declaration --outDir dist",
|
|
19
|
+
"docs:dev": "vitepress dev docs",
|
|
20
|
+
"docs:build": "vitepress build docs",
|
|
21
|
+
"docs:preview": "vitepress preview docs"
|
|
22
|
+
},
|
|
23
|
+
"devDependencies": {
|
|
24
|
+
"@types/bun": "latest",
|
|
25
|
+
"vitepress": "^1.6.4"
|
|
26
|
+
},
|
|
27
|
+
"peerDependencies": {
|
|
28
|
+
"typescript": "^5"
|
|
29
|
+
},
|
|
30
|
+
"dependencies": {
|
|
31
|
+
"@elysiajs/cors": "^1.4.1",
|
|
32
|
+
"@elysiajs/jwt": "^1.4.0",
|
|
33
|
+
"@elysiajs/swagger": "^1.3.1",
|
|
34
|
+
"elysia": "^1.4.19",
|
|
35
|
+
"node-cron": "^4.2.1",
|
|
36
|
+
"reflect-metadata": "^0.2.2",
|
|
37
|
+
"zod": "^4.3.2"
|
|
38
|
+
},
|
|
39
|
+
"repository": {
|
|
40
|
+
"type": "git",
|
|
41
|
+
"url": "git+https://github.com/diariodaregiao/bunstone.git"
|
|
42
|
+
},
|
|
43
|
+
"publishConfig": {
|
|
44
|
+
"registry": "https://registry.npmjs.org/"
|
|
45
|
+
},
|
|
46
|
+
"packageManager": "yarn@1.22.22+sha512.a6b2f7906b721bba3d67d4aff083df04dad64c399707841b7acf00f6b133b7ac24255f2652fa22ae3534329dc6180534e98d17432037ff6fd140556e2bb3137e"
|
|
47
|
+
}
|