@expressots/core 2.9.0 → 2.10.0
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/lib/CHANGELOG.md +133 -85
- package/lib/cjs/application/app-container.js +93 -94
- package/lib/cjs/application/application-factory.js +74 -74
- package/lib/cjs/application/index.js +7 -7
- package/lib/cjs/common/color-service.provider.js +46 -47
- package/lib/cjs/common/index.js +2 -2
- package/lib/cjs/common/package-resolver.provider.js +35 -35
- package/lib/cjs/common/project-config.provider.js +2 -2
- package/lib/cjs/console/console.js +60 -61
- package/lib/cjs/console/index.js +5 -5
- package/lib/cjs/container-module/container-module.js +111 -111
- package/lib/cjs/container-module/index.js +6 -6
- package/lib/cjs/controller/base-controller.js +74 -75
- package/lib/cjs/controller/index.js +5 -5
- package/lib/cjs/decorator/index.js +17 -17
- package/lib/cjs/decorator/scope-binding.js +44 -44
- package/lib/cjs/error/app-error.js +26 -26
- package/lib/cjs/error/error-handler-middleware.js +28 -28
- package/lib/cjs/error/index.js +9 -9
- package/lib/cjs/error/report.js +53 -54
- package/lib/cjs/error/status-code.js +89 -89
- package/lib/cjs/index.js +26 -26
- package/lib/cjs/middleware/index.js +32 -32
- package/lib/cjs/middleware/interfaces/body-parser.interface.js +2 -2
- package/lib/cjs/middleware/interfaces/compression.interface.js +2 -2
- package/lib/cjs/middleware/interfaces/cookie-parser.interface.js +2 -2
- package/lib/cjs/middleware/interfaces/cookie-session/cookie-session.interface.js +2 -2
- package/lib/cjs/middleware/interfaces/cookie-session/keygrip.interface.js +2 -2
- package/lib/cjs/middleware/interfaces/cors.interface.js +2 -2
- package/lib/cjs/middleware/interfaces/express-rate-limit.interface.js +2 -2
- package/lib/cjs/middleware/interfaces/express-session.interface.js +2 -2
- package/lib/cjs/middleware/interfaces/helmet.interface.js +2 -2
- package/lib/cjs/middleware/interfaces/morgan.interface.js +2 -2
- package/lib/cjs/middleware/interfaces/multer.interface.js +2 -2
- package/lib/cjs/middleware/interfaces/serve-favicon.interface.js +2 -2
- package/lib/cjs/middleware/interfaces/serve-static.interface.js +2 -2
- package/lib/cjs/middleware/middleware-resolver.js +72 -72
- package/lib/cjs/middleware/middleware-service.js +480 -481
- package/lib/cjs/provider/db-in-memory/db-in-memory.provider.js +82 -82
- package/lib/cjs/provider/dto-validator/dto-validator.provider.js +53 -53
- package/lib/cjs/provider/environment/env-validator.provider.js +98 -98
- package/lib/cjs/provider/index.js +13 -13
- package/lib/cjs/provider/logger/logger.provider.js +117 -117
- package/lib/cjs/provider/provider-manager.js +49 -50
- package/lib/cjs/render/handlebars.interface.js +2 -2
- package/lib/cjs/render/index.js +2 -2
- package/lib/cjs/render/render.type.js +2 -2
- package/lib/cjs/types/application/app-container.d.ts +62 -62
- package/lib/cjs/types/application/application-factory.d.ts +34 -34
- package/lib/cjs/types/application/index.d.ts +2 -2
- package/lib/cjs/types/common/color-service.provider.d.ts +29 -29
- package/lib/cjs/types/common/index.d.ts +1 -1
- package/lib/cjs/types/common/package-resolver.provider.d.ts +8 -8
- package/lib/cjs/types/common/project-config.provider.d.ts +56 -47
- package/lib/cjs/types/console/console.d.ts +27 -27
- package/lib/cjs/types/console/index.d.ts +1 -1
- package/lib/cjs/types/container-module/container-module.d.ts +28 -28
- package/lib/cjs/types/container-module/index.d.ts +1 -1
- package/lib/cjs/types/controller/base-controller.d.ts +48 -48
- package/lib/cjs/types/controller/index.d.ts +1 -1
- package/lib/cjs/types/decorator/index.d.ts +1 -1
- package/lib/cjs/types/decorator/scope-binding.d.ts +33 -33
- package/lib/cjs/types/error/app-error.d.ts +29 -29
- package/lib/cjs/types/error/error-handler-middleware.d.ts +11 -11
- package/lib/cjs/types/error/index.d.ts +3 -3
- package/lib/cjs/types/error/report.d.ts +25 -25
- package/lib/cjs/types/error/status-code.d.ts +136 -136
- package/lib/cjs/types/index.d.ts +10 -10
- package/lib/cjs/types/middleware/index.d.ts +13 -13
- package/lib/cjs/types/middleware/interfaces/body-parser.interface.d.ts +33 -33
- package/lib/cjs/types/middleware/interfaces/compression.interface.d.ts +98 -98
- package/lib/cjs/types/middleware/interfaces/cookie-parser.interface.d.ts +9 -9
- package/lib/cjs/types/middleware/interfaces/cookie-session/cookie-session.interface.d.ts +57 -57
- package/lib/cjs/types/middleware/interfaces/cookie-session/keygrip.interface.d.ts +27 -27
- package/lib/cjs/types/middleware/interfaces/cors.interface.d.ts +57 -57
- package/lib/cjs/types/middleware/interfaces/express-rate-limit.interface.d.ts +292 -292
- package/lib/cjs/types/middleware/interfaces/express-session.interface.d.ts +207 -207
- package/lib/cjs/types/middleware/interfaces/helmet.interface.d.ts +210 -210
- package/lib/cjs/types/middleware/interfaces/morgan.interface.d.ts +40 -40
- package/lib/cjs/types/middleware/interfaces/multer.interface.d.ts +255 -255
- package/lib/cjs/types/middleware/interfaces/serve-favicon.interface.d.ts +11 -11
- package/lib/cjs/types/middleware/interfaces/serve-static.interface.d.ts +70 -70
- package/lib/cjs/types/middleware/middleware-resolver.d.ts +11 -11
- package/lib/cjs/types/middleware/middleware-service.d.ts +368 -368
- package/lib/cjs/types/provider/db-in-memory/db-in-memory.provider.d.ts +43 -43
- package/lib/cjs/types/provider/dto-validator/dto-validator.provider.d.ts +11 -11
- package/lib/cjs/types/provider/environment/env-validator.provider.d.ts +35 -35
- package/lib/cjs/types/provider/index.d.ts +5 -5
- package/lib/cjs/types/provider/logger/logger.provider.d.ts +54 -54
- package/lib/cjs/types/provider/provider-manager.d.ts +16 -16
- package/lib/cjs/types/render/handlebars.interface.d.ts +46 -46
- package/lib/cjs/types/render/index.d.ts +2 -2
- package/lib/cjs/types/render/render.type.d.ts +12 -12
- package/lib/package.json +16 -17
- package/package.json +16 -17
|
@@ -1,43 +1,43 @@
|
|
|
1
|
-
import { IProvider } from "../provider-manager";
|
|
2
|
-
export interface IMemoryDBEntity {
|
|
3
|
-
id: string;
|
|
4
|
-
}
|
|
5
|
-
/**
|
|
6
|
-
* InMemoryDB Class
|
|
7
|
-
*
|
|
8
|
-
* This class and its methods offer functionalities to simulate an in-memory database.
|
|
9
|
-
* It is particularly useful for developers starting with ExpressoTS without any database connection.
|
|
10
|
-
*
|
|
11
|
-
* @decorator @provideSingleton(InMemoryDB)
|
|
12
|
-
*/
|
|
13
|
-
export declare class InMemoryDB implements IProvider {
|
|
14
|
-
name: string;
|
|
15
|
-
version: string;
|
|
16
|
-
author: string;
|
|
17
|
-
repo: string;
|
|
18
|
-
private tables;
|
|
19
|
-
/**
|
|
20
|
-
* getTable Method
|
|
21
|
-
*
|
|
22
|
-
* Retrieves a table by its name from the in-memory database.
|
|
23
|
-
*
|
|
24
|
-
* @param tableName - The name of the table to retrieve.
|
|
25
|
-
* @returns {IEntity[]} - An array of entities.
|
|
26
|
-
*/
|
|
27
|
-
getTable(tableName: string): Array<IMemoryDBEntity>;
|
|
28
|
-
/**
|
|
29
|
-
* showTables Method
|
|
30
|
-
*
|
|
31
|
-
* Prints a list of all tables in the in-memory database to the standard output.
|
|
32
|
-
*/
|
|
33
|
-
showTables(): void;
|
|
34
|
-
/**
|
|
35
|
-
* printTable Method
|
|
36
|
-
*
|
|
37
|
-
* Prints all records in a specific table to the console.
|
|
38
|
-
* If the table doesn't exist or is empty, it notifies the user.
|
|
39
|
-
*
|
|
40
|
-
* @param tableName - The name of the table to print.
|
|
41
|
-
*/
|
|
42
|
-
printTable(tableName: string): void;
|
|
43
|
-
}
|
|
1
|
+
import { IProvider } from "../provider-manager";
|
|
2
|
+
export interface IMemoryDBEntity {
|
|
3
|
+
id: string;
|
|
4
|
+
}
|
|
5
|
+
/**
|
|
6
|
+
* InMemoryDB Class
|
|
7
|
+
*
|
|
8
|
+
* This class and its methods offer functionalities to simulate an in-memory database.
|
|
9
|
+
* It is particularly useful for developers starting with ExpressoTS without any database connection.
|
|
10
|
+
*
|
|
11
|
+
* @decorator @provideSingleton(InMemoryDB)
|
|
12
|
+
*/
|
|
13
|
+
export declare class InMemoryDB implements IProvider {
|
|
14
|
+
name: string;
|
|
15
|
+
version: string;
|
|
16
|
+
author: string;
|
|
17
|
+
repo: string;
|
|
18
|
+
private tables;
|
|
19
|
+
/**
|
|
20
|
+
* getTable Method
|
|
21
|
+
*
|
|
22
|
+
* Retrieves a table by its name from the in-memory database.
|
|
23
|
+
*
|
|
24
|
+
* @param tableName - The name of the table to retrieve.
|
|
25
|
+
* @returns {IEntity[]} - An array of entities.
|
|
26
|
+
*/
|
|
27
|
+
getTable(tableName: string): Array<IMemoryDBEntity>;
|
|
28
|
+
/**
|
|
29
|
+
* showTables Method
|
|
30
|
+
*
|
|
31
|
+
* Prints a list of all tables in the in-memory database to the standard output.
|
|
32
|
+
*/
|
|
33
|
+
showTables(): void;
|
|
34
|
+
/**
|
|
35
|
+
* printTable Method
|
|
36
|
+
*
|
|
37
|
+
* Prints all records in a specific table to the console.
|
|
38
|
+
* If the table doesn't exist or is empty, it notifies the user.
|
|
39
|
+
*
|
|
40
|
+
* @param tableName - The name of the table to print.
|
|
41
|
+
*/
|
|
42
|
+
printTable(tableName: string): void;
|
|
43
|
+
}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import "reflect-metadata";
|
|
2
|
-
import { RequestHandler } from "express";
|
|
3
|
-
/**
|
|
4
|
-
* Validate the DTO using class-validator and class-transformer.
|
|
5
|
-
* @param type - The type of the DTO to validate.
|
|
6
|
-
* @returns A RequestHandler function.
|
|
7
|
-
* @throws An exception if the DTO is invalid.
|
|
8
|
-
*
|
|
9
|
-
*/
|
|
10
|
-
declare function ValidateDTO<T extends object>(type: new () => T): RequestHandler;
|
|
11
|
-
export { ValidateDTO };
|
|
1
|
+
import "reflect-metadata";
|
|
2
|
+
import { RequestHandler } from "express";
|
|
3
|
+
/**
|
|
4
|
+
* Validate the DTO using class-validator and class-transformer.
|
|
5
|
+
* @param type - The type of the DTO to validate.
|
|
6
|
+
* @returns A RequestHandler function.
|
|
7
|
+
* @throws An exception if the DTO is invalid.
|
|
8
|
+
*
|
|
9
|
+
*/
|
|
10
|
+
declare function ValidateDTO<T extends object>(type: new () => T): RequestHandler;
|
|
11
|
+
export { ValidateDTO };
|
|
@@ -1,35 +1,35 @@
|
|
|
1
|
-
import { IProvider } from "../provider-manager";
|
|
2
|
-
type DefaultValueType = string | number | boolean | undefined;
|
|
3
|
-
/**
|
|
4
|
-
* The EnvValidatorProvider class provides utility methods for working with environment variables.
|
|
5
|
-
* It validates, loads, and retrieves environment variables from the .env file.
|
|
6
|
-
* @provide EnvValidatorProvider
|
|
7
|
-
*/
|
|
8
|
-
declare class EnvValidatorProvider implements IProvider {
|
|
9
|
-
name: string;
|
|
10
|
-
version: string;
|
|
11
|
-
author: string;
|
|
12
|
-
repo: string;
|
|
13
|
-
private logger;
|
|
14
|
-
constructor();
|
|
15
|
-
/**
|
|
16
|
-
* Retrieves the value of an environment variable, or a default value if the variable is not set.
|
|
17
|
-
* @param key - The key of the environment variable.
|
|
18
|
-
* @param defaultValue - The default value to return if the environment variable is not set.
|
|
19
|
-
* @returns The value of the environment variable, or the default value if not set.
|
|
20
|
-
*/
|
|
21
|
-
get(key: string, defaultValue?: DefaultValueType): DefaultValueType;
|
|
22
|
-
/**
|
|
23
|
-
* Validates and loads all environment variables from the .env file.
|
|
24
|
-
* If the .env file does not exist or any environment variables are not set, the process will exit with an error.
|
|
25
|
-
*/
|
|
26
|
-
checkAll(): void;
|
|
27
|
-
}
|
|
28
|
-
declare global {
|
|
29
|
-
interface String {
|
|
30
|
-
AsBoolean(): boolean | undefined;
|
|
31
|
-
AsNumber(): number | undefined;
|
|
32
|
-
AsString(): string | undefined;
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
export { EnvValidatorProvider };
|
|
1
|
+
import { IProvider } from "../provider-manager";
|
|
2
|
+
type DefaultValueType = string | number | boolean | undefined;
|
|
3
|
+
/**
|
|
4
|
+
* The EnvValidatorProvider class provides utility methods for working with environment variables.
|
|
5
|
+
* It validates, loads, and retrieves environment variables from the .env file.
|
|
6
|
+
* @provide EnvValidatorProvider
|
|
7
|
+
*/
|
|
8
|
+
declare class EnvValidatorProvider implements IProvider {
|
|
9
|
+
name: string;
|
|
10
|
+
version: string;
|
|
11
|
+
author: string;
|
|
12
|
+
repo: string;
|
|
13
|
+
private logger;
|
|
14
|
+
constructor();
|
|
15
|
+
/**
|
|
16
|
+
* Retrieves the value of an environment variable, or a default value if the variable is not set.
|
|
17
|
+
* @param key - The key of the environment variable.
|
|
18
|
+
* @param defaultValue - The default value to return if the environment variable is not set.
|
|
19
|
+
* @returns The value of the environment variable, or the default value if not set.
|
|
20
|
+
*/
|
|
21
|
+
get(key: string, defaultValue?: DefaultValueType): DefaultValueType;
|
|
22
|
+
/**
|
|
23
|
+
* Validates and loads all environment variables from the .env file.
|
|
24
|
+
* If the .env file does not exist or any environment variables are not set, the process will exit with an error.
|
|
25
|
+
*/
|
|
26
|
+
checkAll(): void;
|
|
27
|
+
}
|
|
28
|
+
declare global {
|
|
29
|
+
interface String {
|
|
30
|
+
AsBoolean(): boolean | undefined;
|
|
31
|
+
AsNumber(): number | undefined;
|
|
32
|
+
AsString(): string | undefined;
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
export { EnvValidatorProvider };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
export { IProvider, ProviderManager } from "./provider-manager";
|
|
2
|
-
export { Logger } from "./logger/logger.provider";
|
|
3
|
-
export { EnvValidatorProvider as Env } from "./environment/env-validator.provider";
|
|
4
|
-
export { ValidateDTO } from "./dto-validator/dto-validator.provider";
|
|
5
|
-
export { InMemoryDB, IMemoryDBEntity, } from "./db-in-memory/db-in-memory.provider";
|
|
1
|
+
export { IProvider, ProviderManager } from "./provider-manager";
|
|
2
|
+
export { Logger } from "./logger/logger.provider";
|
|
3
|
+
export { EnvValidatorProvider as Env } from "./environment/env-validator.provider";
|
|
4
|
+
export { ValidateDTO } from "./dto-validator/dto-validator.provider";
|
|
5
|
+
export { InMemoryDB, IMemoryDBEntity, } from "./db-in-memory/db-in-memory.provider";
|
|
@@ -1,54 +1,54 @@
|
|
|
1
|
-
import { IProvider } from "../provider-manager";
|
|
2
|
-
/**
|
|
3
|
-
* Represents the different logging levels.
|
|
4
|
-
*/
|
|
5
|
-
type LogLevel = "INFO" | "WARN" | "ERROR" | "NONE";
|
|
6
|
-
/**
|
|
7
|
-
* Class that provides logging functionality with colorized text.
|
|
8
|
-
*/
|
|
9
|
-
declare class Logger implements IProvider {
|
|
10
|
-
private pid;
|
|
11
|
-
name: string;
|
|
12
|
-
version: string;
|
|
13
|
-
author: string;
|
|
14
|
-
repo: string;
|
|
15
|
-
constructor();
|
|
16
|
-
/**
|
|
17
|
-
* Formats the log message with color, timestamps, and log levels.
|
|
18
|
-
*
|
|
19
|
-
* @param logLevel - The level of the log (e.g. INFO, WARN).
|
|
20
|
-
* @param message - The main log message.
|
|
21
|
-
* @param module - Optional module name.
|
|
22
|
-
* @returns The formatted log message.
|
|
23
|
-
*/
|
|
24
|
-
protected formatMessage(logLevel: LogLevel, message: string, module?: string): string;
|
|
25
|
-
/**
|
|
26
|
-
* Logs a generic message.
|
|
27
|
-
*
|
|
28
|
-
* @param message - The message to log.
|
|
29
|
-
* @param module - Optional module name.
|
|
30
|
-
*/
|
|
31
|
-
msg(message: string, module?: string): void;
|
|
32
|
-
/**
|
|
33
|
-
* Logs an informational message.
|
|
34
|
-
*
|
|
35
|
-
* @param message - The message to log.
|
|
36
|
-
* @param module - Optional module name.
|
|
37
|
-
*/
|
|
38
|
-
info(message: string, module?: string): void;
|
|
39
|
-
/**
|
|
40
|
-
* Logs a warning message.
|
|
41
|
-
*
|
|
42
|
-
* @param message - The message to log.
|
|
43
|
-
* @param module - Optional module name.
|
|
44
|
-
*/
|
|
45
|
-
warn(message: string, module?: string): void;
|
|
46
|
-
/**
|
|
47
|
-
* Logs an error message.
|
|
48
|
-
*
|
|
49
|
-
* @param message - The message to log.
|
|
50
|
-
* @param module - Optional module name.
|
|
51
|
-
*/
|
|
52
|
-
error(message: string, module?: string): void;
|
|
53
|
-
}
|
|
54
|
-
export { Logger, LogLevel };
|
|
1
|
+
import { IProvider } from "../provider-manager";
|
|
2
|
+
/**
|
|
3
|
+
* Represents the different logging levels.
|
|
4
|
+
*/
|
|
5
|
+
type LogLevel = "INFO" | "WARN" | "ERROR" | "NONE";
|
|
6
|
+
/**
|
|
7
|
+
* Class that provides logging functionality with colorized text.
|
|
8
|
+
*/
|
|
9
|
+
declare class Logger implements IProvider {
|
|
10
|
+
private pid;
|
|
11
|
+
name: string;
|
|
12
|
+
version: string;
|
|
13
|
+
author: string;
|
|
14
|
+
repo: string;
|
|
15
|
+
constructor();
|
|
16
|
+
/**
|
|
17
|
+
* Formats the log message with color, timestamps, and log levels.
|
|
18
|
+
*
|
|
19
|
+
* @param logLevel - The level of the log (e.g. INFO, WARN).
|
|
20
|
+
* @param message - The main log message.
|
|
21
|
+
* @param module - Optional module name.
|
|
22
|
+
* @returns The formatted log message.
|
|
23
|
+
*/
|
|
24
|
+
protected formatMessage(logLevel: LogLevel, message: string, module?: string): string;
|
|
25
|
+
/**
|
|
26
|
+
* Logs a generic message.
|
|
27
|
+
*
|
|
28
|
+
* @param message - The message to log.
|
|
29
|
+
* @param module - Optional module name.
|
|
30
|
+
*/
|
|
31
|
+
msg(message: string, module?: string): void;
|
|
32
|
+
/**
|
|
33
|
+
* Logs an informational message.
|
|
34
|
+
*
|
|
35
|
+
* @param message - The message to log.
|
|
36
|
+
* @param module - Optional module name.
|
|
37
|
+
*/
|
|
38
|
+
info(message: string, module?: string): void;
|
|
39
|
+
/**
|
|
40
|
+
* Logs a warning message.
|
|
41
|
+
*
|
|
42
|
+
* @param message - The message to log.
|
|
43
|
+
* @param module - Optional module name.
|
|
44
|
+
*/
|
|
45
|
+
warn(message: string, module?: string): void;
|
|
46
|
+
/**
|
|
47
|
+
* Logs an error message.
|
|
48
|
+
*
|
|
49
|
+
* @param message - The message to log.
|
|
50
|
+
* @param module - Optional module name.
|
|
51
|
+
*/
|
|
52
|
+
error(message: string, module?: string): void;
|
|
53
|
+
}
|
|
54
|
+
export { Logger, LogLevel };
|
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
import "reflect-metadata";
|
|
2
|
-
import { interfaces } from "inversify";
|
|
3
|
-
export interface IProvider {
|
|
4
|
-
name: string;
|
|
5
|
-
version: string;
|
|
6
|
-
author: string;
|
|
7
|
-
repo: string;
|
|
8
|
-
}
|
|
9
|
-
type ClassType<T> = new () => T;
|
|
10
|
-
export declare class ProviderManager {
|
|
11
|
-
private container;
|
|
12
|
-
private logger;
|
|
13
|
-
register(serviceIdentifier: interfaces.ServiceIdentifier<unknown>, scope?: interfaces.BindingScope): void;
|
|
14
|
-
get<P>(provider: ClassType<P>): P;
|
|
15
|
-
}
|
|
16
|
-
export {};
|
|
1
|
+
import "reflect-metadata";
|
|
2
|
+
import { interfaces } from "inversify";
|
|
3
|
+
export interface IProvider {
|
|
4
|
+
name: string;
|
|
5
|
+
version: string;
|
|
6
|
+
author: string;
|
|
7
|
+
repo: string;
|
|
8
|
+
}
|
|
9
|
+
type ClassType<T> = new () => T;
|
|
10
|
+
export declare class ProviderManager {
|
|
11
|
+
private container;
|
|
12
|
+
private logger;
|
|
13
|
+
register(serviceIdentifier: interfaces.ServiceIdentifier<unknown>, scope?: interfaces.BindingScope): void;
|
|
14
|
+
get<P>(provider: ClassType<P>): P;
|
|
15
|
+
}
|
|
16
|
+
export {};
|
|
@@ -1,46 +1,46 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Configuration options for Express Handlebars.
|
|
3
|
-
* @interface ConfigOptions
|
|
4
|
-
*/
|
|
5
|
-
interface ConfigOptions {
|
|
6
|
-
extname?: string;
|
|
7
|
-
layoutDir?: string;
|
|
8
|
-
defaultLayout?: string | false;
|
|
9
|
-
}
|
|
10
|
-
/**
|
|
11
|
-
* Callback function for rendering templates.
|
|
12
|
-
* @callback RenderCallback
|
|
13
|
-
*
|
|
14
|
-
* @param {Error | null} err - The error object.
|
|
15
|
-
* @param {string} [content] - The rendered content.
|
|
16
|
-
*/
|
|
17
|
-
interface RenderCallback {
|
|
18
|
-
(err: Error | null, content?: string): void;
|
|
19
|
-
}
|
|
20
|
-
/**
|
|
21
|
-
* Function for rendering templates.
|
|
22
|
-
* @typedef Engine
|
|
23
|
-
*
|
|
24
|
-
* @param {string} viewPath - The path to the directory containing the templates.
|
|
25
|
-
* @param {ConfigOptions} options - The configuration options for the template engine.
|
|
26
|
-
* @param {RenderCallback} [callback] - The callback function for rendering templates.
|
|
27
|
-
*/
|
|
28
|
-
type Engine = (viewPath: string, options: ConfigOptions, callback?: RenderCallback) => void;
|
|
29
|
-
/**
|
|
30
|
-
* Interface representing the configuration options for Handlebars templates.
|
|
31
|
-
*/
|
|
32
|
-
interface IHandlebars {
|
|
33
|
-
/**
|
|
34
|
-
* Specifies the extension name for the Handlebars templates.
|
|
35
|
-
*/
|
|
36
|
-
extName: string;
|
|
37
|
-
/**
|
|
38
|
-
* Specifies the path to the directory containing the Handlebars templates.
|
|
39
|
-
*/
|
|
40
|
-
viewPath: string;
|
|
41
|
-
/**
|
|
42
|
-
* Specifies the function for rendering Handlebars templates.
|
|
43
|
-
*/
|
|
44
|
-
engine: Engine;
|
|
45
|
-
}
|
|
46
|
-
export { IHandlebars };
|
|
1
|
+
/**
|
|
2
|
+
* Configuration options for Express Handlebars.
|
|
3
|
+
* @interface ConfigOptions
|
|
4
|
+
*/
|
|
5
|
+
interface ConfigOptions {
|
|
6
|
+
extname?: string;
|
|
7
|
+
layoutDir?: string;
|
|
8
|
+
defaultLayout?: string | false;
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* Callback function for rendering templates.
|
|
12
|
+
* @callback RenderCallback
|
|
13
|
+
*
|
|
14
|
+
* @param {Error | null} err - The error object.
|
|
15
|
+
* @param {string} [content] - The rendered content.
|
|
16
|
+
*/
|
|
17
|
+
interface RenderCallback {
|
|
18
|
+
(err: Error | null, content?: string): void;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Function for rendering templates.
|
|
22
|
+
* @typedef Engine
|
|
23
|
+
*
|
|
24
|
+
* @param {string} viewPath - The path to the directory containing the templates.
|
|
25
|
+
* @param {ConfigOptions} options - The configuration options for the template engine.
|
|
26
|
+
* @param {RenderCallback} [callback] - The callback function for rendering templates.
|
|
27
|
+
*/
|
|
28
|
+
type Engine = (viewPath: string, options: ConfigOptions, callback?: RenderCallback) => void;
|
|
29
|
+
/**
|
|
30
|
+
* Interface representing the configuration options for Handlebars templates.
|
|
31
|
+
*/
|
|
32
|
+
interface IHandlebars {
|
|
33
|
+
/**
|
|
34
|
+
* Specifies the extension name for the Handlebars templates.
|
|
35
|
+
*/
|
|
36
|
+
extName: string;
|
|
37
|
+
/**
|
|
38
|
+
* Specifies the path to the directory containing the Handlebars templates.
|
|
39
|
+
*/
|
|
40
|
+
viewPath: string;
|
|
41
|
+
/**
|
|
42
|
+
* Specifies the function for rendering Handlebars templates.
|
|
43
|
+
*/
|
|
44
|
+
engine: Engine;
|
|
45
|
+
}
|
|
46
|
+
export { IHandlebars };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { IHandlebars } from "./handlebars.interface";
|
|
2
|
-
export { RenderTemplateOptions } from "./render.type";
|
|
1
|
+
export { IHandlebars } from "./handlebars.interface";
|
|
2
|
+
export { RenderTemplateOptions } from "./render.type";
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import { IHandlebars } from "./handlebars.interface";
|
|
2
|
-
/**
|
|
3
|
-
* Type alias for the configuration options for rendering templates.
|
|
4
|
-
*
|
|
5
|
-
* Currently, this type alias is equivalent to the `IHandlebars` interface,
|
|
6
|
-
* and represents the configuration options for Handlebars templates.
|
|
7
|
-
*
|
|
8
|
-
* In the future, this type could be expanded to include configuration options
|
|
9
|
-
* for other template engines.
|
|
10
|
-
*/
|
|
11
|
-
type RenderTemplateOptions = IHandlebars;
|
|
12
|
-
export { RenderTemplateOptions };
|
|
1
|
+
import { IHandlebars } from "./handlebars.interface";
|
|
2
|
+
/**
|
|
3
|
+
* Type alias for the configuration options for rendering templates.
|
|
4
|
+
*
|
|
5
|
+
* Currently, this type alias is equivalent to the `IHandlebars` interface,
|
|
6
|
+
* and represents the configuration options for Handlebars templates.
|
|
7
|
+
*
|
|
8
|
+
* In the future, this type could be expanded to include configuration options
|
|
9
|
+
* for other template engines.
|
|
10
|
+
*/
|
|
11
|
+
type RenderTemplateOptions = IHandlebars;
|
|
12
|
+
export { RenderTemplateOptions };
|
package/lib/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@expressots/core",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.10.0",
|
|
4
4
|
"description": "Expressots - modern, fast, lightweight nodejs web framework (@core)",
|
|
5
5
|
"author": "Richard Zampieri",
|
|
6
6
|
"main": "./lib/cjs/index.js",
|
|
@@ -68,29 +68,28 @@
|
|
|
68
68
|
"lint:fix": "eslint \"packages/**/*.ts\" --fix"
|
|
69
69
|
},
|
|
70
70
|
"dependencies": {
|
|
71
|
-
"inversify": "6.0.
|
|
71
|
+
"inversify": "6.0.2",
|
|
72
72
|
"inversify-binding-decorators": "4.0.0",
|
|
73
|
-
"reflect-metadata": "0.2.
|
|
73
|
+
"reflect-metadata": "0.2.2"
|
|
74
74
|
},
|
|
75
75
|
"devDependencies": {
|
|
76
|
-
"@commitlint/cli": "
|
|
77
|
-
"@commitlint/config-conventional": "
|
|
76
|
+
"@commitlint/cli": "19.2.1",
|
|
77
|
+
"@commitlint/config-conventional": "19.1.0",
|
|
78
78
|
"@expressots/adapter-express": "latest",
|
|
79
|
-
"@release-it/conventional-changelog": "7.0.
|
|
80
|
-
"@types/express": "4.17.
|
|
81
|
-
"@types/node": "20.
|
|
82
|
-
"@typescript-eslint/eslint-plugin": "6.
|
|
79
|
+
"@release-it/conventional-changelog": "7.0.2",
|
|
80
|
+
"@types/express": "4.17.21",
|
|
81
|
+
"@types/node": "20.12.2",
|
|
82
|
+
"@typescript-eslint/eslint-plugin": "6.21.0",
|
|
83
83
|
"@typescript-eslint/parser": "6.6.0",
|
|
84
|
-
"@vitest/coverage-v8": "
|
|
85
|
-
"eslint": "8.
|
|
86
|
-
"eslint-config-prettier": "9.
|
|
84
|
+
"@vitest/coverage-v8": "1.4.0",
|
|
85
|
+
"eslint": "8.57.0",
|
|
86
|
+
"eslint-config-prettier": "9.1.0",
|
|
87
87
|
"husky": "9.0.11",
|
|
88
88
|
"prettier": "3.2.5",
|
|
89
|
-
"release-it": "16.
|
|
90
|
-
"
|
|
91
|
-
"
|
|
92
|
-
"
|
|
93
|
-
"vitest": "0.34.6"
|
|
89
|
+
"release-it": "16.3.0",
|
|
90
|
+
"typescript": "5.2.2",
|
|
91
|
+
"vite": "5.2.7",
|
|
92
|
+
"vitest": "1.4.0"
|
|
94
93
|
},
|
|
95
94
|
"release-it": {
|
|
96
95
|
"git": {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@expressots/core",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.10.0",
|
|
4
4
|
"description": "Expressots - modern, fast, lightweight nodejs web framework (@core)",
|
|
5
5
|
"author": "Richard Zampieri",
|
|
6
6
|
"main": "./lib/cjs/index.js",
|
|
@@ -68,29 +68,28 @@
|
|
|
68
68
|
"lint:fix": "eslint \"packages/**/*.ts\" --fix"
|
|
69
69
|
},
|
|
70
70
|
"dependencies": {
|
|
71
|
-
"inversify": "6.0.
|
|
71
|
+
"inversify": "6.0.2",
|
|
72
72
|
"inversify-binding-decorators": "4.0.0",
|
|
73
|
-
"reflect-metadata": "0.2.
|
|
73
|
+
"reflect-metadata": "0.2.2"
|
|
74
74
|
},
|
|
75
75
|
"devDependencies": {
|
|
76
|
-
"@commitlint/cli": "
|
|
77
|
-
"@commitlint/config-conventional": "
|
|
76
|
+
"@commitlint/cli": "19.2.1",
|
|
77
|
+
"@commitlint/config-conventional": "19.1.0",
|
|
78
78
|
"@expressots/adapter-express": "latest",
|
|
79
|
-
"@release-it/conventional-changelog": "7.0.
|
|
80
|
-
"@types/express": "4.17.
|
|
81
|
-
"@types/node": "20.
|
|
82
|
-
"@typescript-eslint/eslint-plugin": "6.
|
|
79
|
+
"@release-it/conventional-changelog": "7.0.2",
|
|
80
|
+
"@types/express": "4.17.21",
|
|
81
|
+
"@types/node": "20.12.2",
|
|
82
|
+
"@typescript-eslint/eslint-plugin": "6.21.0",
|
|
83
83
|
"@typescript-eslint/parser": "6.6.0",
|
|
84
|
-
"@vitest/coverage-v8": "
|
|
85
|
-
"eslint": "8.
|
|
86
|
-
"eslint-config-prettier": "9.
|
|
84
|
+
"@vitest/coverage-v8": "1.4.0",
|
|
85
|
+
"eslint": "8.57.0",
|
|
86
|
+
"eslint-config-prettier": "9.1.0",
|
|
87
87
|
"husky": "9.0.11",
|
|
88
88
|
"prettier": "3.2.5",
|
|
89
|
-
"release-it": "16.
|
|
90
|
-
"
|
|
91
|
-
"
|
|
92
|
-
"
|
|
93
|
-
"vitest": "0.34.6"
|
|
89
|
+
"release-it": "16.3.0",
|
|
90
|
+
"typescript": "5.2.2",
|
|
91
|
+
"vite": "5.2.7",
|
|
92
|
+
"vitest": "1.4.0"
|
|
94
93
|
},
|
|
95
94
|
"release-it": {
|
|
96
95
|
"git": {
|