jcc-express-mvc 1.2.8 → 1.3.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/index.d.ts +25 -0
- package/index.d.ts.map +1 -0
- package/index.js +1 -5
- package/lib/App.d.ts +19 -0
- package/lib/App.d.ts.map +1 -0
- package/lib/Auth/AuthMiddleware.d.ts +8 -0
- package/lib/Auth/AuthMiddleware.d.ts.map +1 -0
- package/lib/Auth/index.d.ts +16 -0
- package/lib/Auth/index.d.ts.map +1 -0
- package/lib/Command-Line/NodeArtisanCommand.d.ts +7 -0
- package/lib/Command-Line/NodeArtisanCommand.d.ts.map +1 -0
- package/lib/Command-Line/command.d.ts +11 -0
- package/lib/Command-Line/command.d.ts.map +1 -0
- package/lib/Command-Line/files/Controller.d.ts +8 -0
- package/lib/Command-Line/files/Controller.d.ts.map +1 -0
- package/lib/Command-Line/files/Migration.d.ts +3 -0
- package/lib/Command-Line/files/Migration.d.ts.map +1 -0
- package/lib/Command-Line/files/Models.d.ts +8 -0
- package/lib/Command-Line/files/Models.d.ts.map +1 -0
- package/lib/Command-Line/files/Request.d.ts +8 -0
- package/lib/Command-Line/files/Request.d.ts.map +1 -0
- package/lib/Command-Line/files/ResourcesController.d.ts +8 -0
- package/lib/Command-Line/files/ResourcesController.d.ts.map +1 -0
- package/lib/Command-Line/utils.d.ts +2 -0
- package/lib/Command-Line/utils.d.ts.map +1 -0
- package/lib/Config/Config.d.ts +8 -0
- package/lib/Config/Config.d.ts.map +1 -0
- package/lib/Error/AppError.d.ts +7 -0
- package/lib/Error/AppError.d.ts.map +1 -0
- package/lib/Error/AppErrorHandler.d.ts +10 -0
- package/lib/Error/AppErrorHandler.d.ts.map +1 -0
- package/lib/Error/Constants/error.d.ts +13 -0
- package/lib/Error/Constants/error.d.ts.map +1 -0
- package/lib/Error/Constants/index.d.ts +4 -0
- package/lib/Error/Constants/index.d.ts.map +1 -0
- package/lib/HttpKernel/HttpKernel.d.ts +7 -0
- package/lib/HttpKernel/HttpKernel.d.ts.map +1 -0
- package/lib/Interface/index.d.ts +43 -0
- package/lib/Interface/index.d.ts.map +1 -0
- package/lib/Middlewares/index.d.ts +45 -0
- package/lib/Middlewares/index.d.ts.map +1 -0
- package/lib/Middlewares/isLogin.d.ts +16 -0
- package/lib/Middlewares/isLogin.d.ts.map +1 -0
- package/lib/Passport/config.d.ts +10 -0
- package/lib/Passport/config.d.ts.map +1 -0
- package/lib/Request/FormRequest.d.ts +36 -0
- package/lib/Request/FormRequest.d.ts.map +1 -0
- package/lib/Request/request.d.ts +17 -0
- package/lib/Request/request.d.ts.map +1 -0
- package/lib/Response/index.d.ts +23 -0
- package/lib/Response/index.d.ts.map +1 -0
- package/lib/Routes/RouteBuilder.d.ts +45 -0
- package/lib/Routes/RouteBuilder.d.ts.map +1 -0
- package/lib/Routes/Router.d.ts +69 -0
- package/lib/Routes/Router.d.ts.map +1 -0
- package/lib/Server/index.d.ts +8 -0
- package/lib/Server/index.d.ts.map +1 -0
- package/lib/Services/ServiceContainer.d.ts +10 -0
- package/lib/Services/ServiceContainer.d.ts.map +1 -0
- package/lib/Services/ServiceProvider.d.ts +14 -0
- package/lib/Services/ServiceProvider.d.ts.map +1 -0
- package/lib/Templating-engine/engineHelper.d.ts +45 -0
- package/lib/Templating-engine/engineHelper.d.ts.map +1 -0
- package/lib/Templating-engine/expressions.d.ts +14 -0
- package/lib/Templating-engine/expressions.d.ts.map +1 -0
- package/lib/Templating-engine/index.d.ts +83 -0
- package/lib/Templating-engine/index.d.ts.map +1 -0
- package/lib/Type/index.d.ts +24 -0
- package/lib/Type/index.d.ts.map +1 -0
- package/lib/Validation/index.d.ts +12 -0
- package/lib/Validation/index.d.ts.map +1 -0
- package/lib/Validation/rules.d.ts +5 -0
- package/lib/Validation/rules.d.ts.map +1 -0
- package/lib/Validation/validate.d.ts +196 -0
- package/lib/Validation/validate.d.ts.map +1 -0
- package/lib/util/index.d.ts +93 -0
- package/lib/util/index.d.ts.map +1 -0
- package/package.json +2 -1
- package/lib/Database/src/BaseEntity.js +0 -208
- package/lib/Database/src/BaseModel.js +0 -44
- package/lib/Database/src/Builder.js +0 -430
- package/lib/Database/src/Cast/index.js +0 -98
- package/lib/Database/src/Cast/types.js +0 -25
- package/lib/Database/src/Date/index.js +0 -36
- package/lib/Database/src/Model.js +0 -53
- package/lib/Database/src/Query.js +0 -16
- package/lib/Database/src/QueryBuilder.js +0 -354
- package/lib/Database/src/QueryInstance.js +0 -28
- package/lib/Database/src/RelationBuilder.js +0 -97
- package/lib/Database/src/Schema/BaseSchemaEntity/index.js +0 -26
- package/lib/Database/src/Schema/BluePrint/index.js +0 -257
- package/lib/Database/src/Schema/index.js +0 -18
- package/lib/Database/src/db/connection.js +0 -22
- package/lib/Database/src/type.js +0 -2
- package/lib/Database/src/utils/index.js +0 -112
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import { Application, RequestHandler } from "express";
|
|
2
|
+
import { ExpressCallback } from "../Interface/index";
|
|
3
|
+
import { AppPath } from "../Type";
|
|
4
|
+
export declare class Router<T extends Record<string, RequestHandler>> {
|
|
5
|
+
private app;
|
|
6
|
+
private routeBuilder;
|
|
7
|
+
private appPath;
|
|
8
|
+
constructor(app: Application, appPaths: AppPath);
|
|
9
|
+
/**
|
|
10
|
+
* Sets the controller for the routes.
|
|
11
|
+
* @param {Object} controller - Controller class or object.
|
|
12
|
+
* @returns {Routes} - Returns the Routes instance.
|
|
13
|
+
*/
|
|
14
|
+
controller(controller: any): this;
|
|
15
|
+
/**
|
|
16
|
+
* Sets a prefix for the routes.
|
|
17
|
+
* @param {string} url - Prefix URL for the routes.
|
|
18
|
+
* @returns {Routes} - Returns the Routes instance.
|
|
19
|
+
*/
|
|
20
|
+
prefix(url: string): this;
|
|
21
|
+
/**
|
|
22
|
+
* Sets middleware functions for the router.
|
|
23
|
+
* @param {Array | function} middleware - Array of middleware functions.
|
|
24
|
+
* @returns {Router} - Returns the router instance.
|
|
25
|
+
*/
|
|
26
|
+
middleware(middleware: Array<ExpressCallback> | ExpressCallback): this;
|
|
27
|
+
/**
|
|
28
|
+
* Groups routes using a callback function.
|
|
29
|
+
* @param {Function} callback - Callback function for defining grouped routes.
|
|
30
|
+
* @returns {Routes} - Returns the Routes instance.
|
|
31
|
+
*/
|
|
32
|
+
group(callback: (Route: Router<T>) => void): this;
|
|
33
|
+
/**
|
|
34
|
+
* Adds a route handler for GET requests.
|
|
35
|
+
* @param {string} url - Route url.
|
|
36
|
+
* @param {Function} callback - Callback function to handle the request.
|
|
37
|
+
* @returns {Router} - Returns the router instance.
|
|
38
|
+
*/
|
|
39
|
+
get<T>(url: string, callback: ExpressCallback | Array<any> | string): T;
|
|
40
|
+
/**
|
|
41
|
+
* Adds a route handler for POST requests.
|
|
42
|
+
* @param {string} url - Route url.
|
|
43
|
+
* @param {Function} callback - Callback function to handle the request.
|
|
44
|
+
* @returns {Router} - Returns the router instance.
|
|
45
|
+
*/
|
|
46
|
+
post<T>(url: string, callback: ExpressCallback | Array<any> | string): T;
|
|
47
|
+
/**
|
|
48
|
+
* Adds a route handler for PATCH requests.
|
|
49
|
+
* @param {string} url - Route url.
|
|
50
|
+
* @param {Function} callback - Callback function to handle the request.
|
|
51
|
+
* @returns {Router} - Returns the router instance.
|
|
52
|
+
*/
|
|
53
|
+
patch<T>(url: string, callback: ExpressCallback | Array<any> | string): T;
|
|
54
|
+
/**
|
|
55
|
+
* Adds a route handler for PUT requests.
|
|
56
|
+
* @param {string} url - Route path.
|
|
57
|
+
* @param {Function} callback - Callback function to handle the request.
|
|
58
|
+
* @returns {Router} - Returns the router instance.
|
|
59
|
+
*/
|
|
60
|
+
put<T>(url: string, callback: ExpressCallback | Array<any> | string): T;
|
|
61
|
+
/**
|
|
62
|
+
* Adds a route handler for DELETE requests.
|
|
63
|
+
* @param {string} path - Route path.
|
|
64
|
+
* @param {Function} callback - Callback function to handle the request.
|
|
65
|
+
* @returns {Router} - Returns the router instance.
|
|
66
|
+
*/
|
|
67
|
+
delete<T>(url: string, callback: ExpressCallback | Array<any> | string): T;
|
|
68
|
+
}
|
|
69
|
+
//# sourceMappingURL=Router.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Router.d.ts","sourceRoot":"","sources":["../../../framework/lib/Routes/Router.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AACtD,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AAErD,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAElC,qBAAa,MAAM,CAAC,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,cAAc,CAAC;IAC1D,OAAO,CAAC,GAAG,CAAc;IAEzB,OAAO,CAAC,YAAY,CAAM;IAC1B,OAAO,CAAC,OAAO,CAAU;gBAGb,GAAG,EAAE,WAAW,EAAE,QAAQ,EAAE,OAAO;IAO/C;;;;OAIG;IACI,UAAU,CAAC,UAAU,EAAE,GAAG,GAAG,IAAI;IAKxC;;;;OAIG;IACI,MAAM,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI;IAKhC;;;;OAIG;IACI,UAAU,CACf,UAAU,EAAE,KAAK,CAAC,eAAe,CAAC,GAAG,eAAe,GACnD,IAAI;IAKP;;;;OAIG;IACI,KAAK,CAAC,QAAQ,EAAE,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC,CAAC,KAAK,IAAI,GAAG,IAAI;IAKxD;;;;;OAKG;IACI,GAAG,CAAC,CAAC,EACV,GAAG,EAAE,MAAM,EACX,QAAQ,EAAE,eAAe,GAAG,KAAK,CAAC,GAAG,CAAC,GAAG,MAAM,GAC9C,CAAC;IASJ;;;;;OAKG;IACI,IAAI,CAAC,CAAC,EACX,GAAG,EAAE,MAAM,EACX,QAAQ,EAAE,eAAe,GAAG,KAAK,CAAC,GAAG,CAAC,GAAG,MAAM,GAC9C,CAAC;IAIJ;;;;;OAKG;IACI,KAAK,CAAC,CAAC,EACZ,GAAG,EAAE,MAAM,EACX,QAAQ,EAAE,eAAe,GAAG,KAAK,CAAC,GAAG,CAAC,GAAG,MAAM,GAC9C,CAAC;IAIJ;;;;;OAKG;IACI,GAAG,CAAC,CAAC,EACV,GAAG,EAAE,MAAM,EACX,QAAQ,EAAE,eAAe,GAAG,KAAK,CAAC,GAAG,CAAC,GAAG,MAAM,GAC9C,CAAC;IAIJ;;;;;OAKG;IACI,MAAM,CAAC,CAAC,EACb,GAAG,EAAE,MAAM,EACX,QAAQ,EAAE,eAAe,GAAG,KAAK,CAAC,GAAG,CAAC,GAAG,MAAM,GAC9C,CAAC;CAiBL"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../framework/lib/Server/index.ts"],"names":[],"mappings":"AAAA,OAAO,OAAO,EAAE,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAI/C,qBAAa,SAAS;IACpB,SAAS,CAAC,OAAO,EAAE,OAAO,OAAO,CAAW;IAC5C,SAAS,CAAC,GAAG,EAAE,WAAW,CAAa;IAEhC,MAAM,CAAC,IAAI,EAAE,MAAM,GAAG,GAAG;IA0BhC,UAAU,CAAC,GAAG,EAAE,GAAG;CAKpB"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { ServiceConstructor } from "../Type";
|
|
2
|
+
declare class ServiceContainer {
|
|
3
|
+
private services;
|
|
4
|
+
private singletons;
|
|
5
|
+
bind<T>(key: string, Constructor: ServiceConstructor<T>, isSingleton?: boolean): void;
|
|
6
|
+
resolve<T>(key: string): T;
|
|
7
|
+
}
|
|
8
|
+
export declare const container: ServiceContainer;
|
|
9
|
+
export {};
|
|
10
|
+
//# sourceMappingURL=ServiceContainer.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ServiceContainer.d.ts","sourceRoot":"","sources":["../../../framework/lib/Services/ServiceContainer.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,SAAS,CAAC;AAG7C,cAAM,gBAAgB;IACpB,OAAO,CAAC,QAAQ,CAA0B;IAC1C,OAAO,CAAC,UAAU,CAA0B;IAErC,IAAI,CAAC,CAAC,EACX,GAAG,EAAE,MAAM,EACX,WAAW,EAAE,kBAAkB,CAAC,CAAC,CAAC,EAClC,WAAW,UAAQ,GAClB,IAAI;IAIA,OAAO,CAAC,CAAC,EAAE,GAAG,EAAE,MAAM,GAAG,CAAC;CAgBlC;AAED,eAAO,MAAM,SAAS,kBAAyB,CAAC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export declare abstract class ServiceProvier {
|
|
2
|
+
protected app: any;
|
|
3
|
+
protected bootingCallbacks: Array<any>;
|
|
4
|
+
protected bootedCallbacks: Array<any>;
|
|
5
|
+
static publishes: Array<any>;
|
|
6
|
+
static publishGroups: Array<any>;
|
|
7
|
+
constructor(app: any);
|
|
8
|
+
register(): void;
|
|
9
|
+
booting(callback: any): void;
|
|
10
|
+
booted(callback: any): void;
|
|
11
|
+
callBootingCallbacks(): void;
|
|
12
|
+
callBootedCallbacks(): void;
|
|
13
|
+
}
|
|
14
|
+
//# sourceMappingURL=ServiceProvider.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ServiceProvider.d.ts","sourceRoot":"","sources":["../../../framework/lib/Services/ServiceProvider.ts"],"names":[],"mappings":"AAAA,8BAAsB,cAAc;IAElC,SAAS,CAAC,GAAG,EAAE,GAAG,CAAC;IAEnB,SAAS,CAAC,gBAAgB,EAAE,KAAK,CAAC,GAAG,CAAC,CAAM;IAE5C,SAAS,CAAC,eAAe,EAAE,KAAK,CAAC,GAAG,CAAC,CAAM;IAE3C,OAAc,SAAS,EAAE,KAAK,CAAC,GAAG,CAAC,CAAM;IAEzC,OAAc,aAAa,EAAE,KAAK,CAAC,GAAG,CAAC,CAAM;gBAEjC,GAAG,EAAE,GAAG;IAIb,QAAQ,IAAI,IAAI;IAEhB,OAAO,CAAC,QAAQ,EAAE,GAAG,GAAG,IAAI;IAI5B,MAAM,CAAC,QAAQ,EAAE,GAAG,GAAG,IAAI;IAI3B,oBAAoB,IAAI,IAAI;IAM5B,mBAAmB,IAAI,IAAI;CAKnC"}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { ContentType } from "../Type";
|
|
2
|
+
import { TemplateRegex } from "./expressions";
|
|
3
|
+
export declare class EngineHelpers extends TemplateRegex {
|
|
4
|
+
/**
|
|
5
|
+
* Extracts content before and after a match within a string.
|
|
6
|
+
* @param {string} content - The original string.
|
|
7
|
+
* @param {object} match - The match object containing index and matched content.
|
|
8
|
+
* @returns {object} - Object containing content before and after the match.
|
|
9
|
+
*/
|
|
10
|
+
protected content(content: string, match: any): ContentType;
|
|
11
|
+
/**
|
|
12
|
+
* Escapes special characters in a string to HTML entities.
|
|
13
|
+
* @param {string} str - The original string.
|
|
14
|
+
* @returns {string} - The string with special characters replaced by HTML entities.
|
|
15
|
+
*/
|
|
16
|
+
private htmlspecialchars;
|
|
17
|
+
/**
|
|
18
|
+
* Replaces placeholders in layout content with section body content.
|
|
19
|
+
* @param {string} content - The content with section placeholders.
|
|
20
|
+
* @param {string} layoutContent - The layout content.
|
|
21
|
+
* @returns {string} - The layout content with replaced section content.
|
|
22
|
+
*/
|
|
23
|
+
protected layout(content: string, layoutContent: string): string;
|
|
24
|
+
/**
|
|
25
|
+
* Accesses nested properties of an object using dot notation.
|
|
26
|
+
* @param {object} obj - The object to access properties from.
|
|
27
|
+
* @param {string} propertyString - Dot-separated string representing the property path.
|
|
28
|
+
* @returns {*} - The value of the nested property, or an empty string if not found.
|
|
29
|
+
*/
|
|
30
|
+
protected accessNestedProperty(obj: any, propertyString: string): string;
|
|
31
|
+
/**
|
|
32
|
+
* Reads file content from the specified path.
|
|
33
|
+
* @param {string} path - The path to the file.
|
|
34
|
+
* @returns {string} - The content of the file.
|
|
35
|
+
*/
|
|
36
|
+
protected readFile(path: string): string;
|
|
37
|
+
/**
|
|
38
|
+
* Removes quotes from a string.
|
|
39
|
+
* @param {string} str - The original string.
|
|
40
|
+
* @returns {string} - The string with quotes removed.
|
|
41
|
+
*/
|
|
42
|
+
protected removeQuotes(str: string): string;
|
|
43
|
+
protected evaluateCondition(condition: string, locals: any): string | boolean;
|
|
44
|
+
}
|
|
45
|
+
//# sourceMappingURL=engineHelper.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"engineHelper.d.ts","sourceRoot":"","sources":["../../../framework/lib/Templating-engine/engineHelper.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AACtC,OAAO,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AAI9C,qBAAa,aAAc,SAAQ,aAAa;IAG9C;;;;;OAKG;IACH,SAAS,CAAC,OAAO,CAAC,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,GAAG,GAAG,WAAW;IAM3D;;;;OAIG;IACH,OAAO,CAAC,gBAAgB;IAcxB;;;;;OAKG;IACH,SAAS,CAAC,MAAM,CAAC,OAAO,EAAE,MAAM,EAAE,aAAa,EAAE,MAAM,GAAG,MAAM;IA2BhE;;;;;OAKG;IACH,SAAS,CAAC,oBAAoB,CAAC,GAAG,EAAE,GAAG,EAAE,cAAc,EAAE,MAAM,GAAG,MAAM;IAKxE;;;;OAIG;IACH,SAAS,CAAC,QAAQ,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM;IASxC;;;;OAIG;IACH,SAAS,CAAC,YAAY,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM;IAI3C,SAAS,CAAC,iBAAiB,CAAC,SAAS,EAAE,MAAM,EAAE,MAAM,EAAE,GAAG;CA+B3D"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export declare abstract class TemplateRegex {
|
|
2
|
+
protected directives: {
|
|
3
|
+
extends: RegExp;
|
|
4
|
+
foreach: RegExp;
|
|
5
|
+
if: RegExp;
|
|
6
|
+
include: RegExp;
|
|
7
|
+
ternary: RegExp;
|
|
8
|
+
variable: RegExp;
|
|
9
|
+
auth: RegExp;
|
|
10
|
+
guest: RegExp;
|
|
11
|
+
};
|
|
12
|
+
protected sectionRegex: RegExp;
|
|
13
|
+
}
|
|
14
|
+
//# sourceMappingURL=expressions.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"expressions.d.ts","sourceRoot":"","sources":["../../../framework/lib/Templating-engine/expressions.ts"],"names":[],"mappings":"AAAA,8BAAsB,aAAa;IAEjC,SAAS,CAAC,UAAU;;;;;;;;;MAWlB;IAEF,SAAS,CAAC,YAAY,SAC2H;CAClJ"}
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
import { EngineHelpers } from "./engineHelper";
|
|
2
|
+
declare class TemplatingEngine extends EngineHelpers {
|
|
3
|
+
private option;
|
|
4
|
+
/**
|
|
5
|
+
* Handles variable directives in the template content.
|
|
6
|
+
* @param {string} content - Template content.
|
|
7
|
+
* @param {Object} match - Match object from the regular expression.
|
|
8
|
+
* @param {Object} param - Local variables for rendering.
|
|
9
|
+
* @returns {string} - Rendered content.
|
|
10
|
+
*/
|
|
11
|
+
private handleVariable;
|
|
12
|
+
/**
|
|
13
|
+
* Handles the @foreach directive in the template content.
|
|
14
|
+
* @param {string} content - Template content.
|
|
15
|
+
* @param {Object} match - Match object from the regular expression.
|
|
16
|
+
* @param {Object} param - Local variables for rendering.
|
|
17
|
+
* @returns {string} - Rendered content.
|
|
18
|
+
*/
|
|
19
|
+
private handleLoop;
|
|
20
|
+
/**
|
|
21
|
+
* Handles the @if directive in the template content.
|
|
22
|
+
* @param {string} content - Template content.
|
|
23
|
+
* @param {Object} match - Match object from the regular expression.
|
|
24
|
+
* @param {Object} param - Local variables for rendering.
|
|
25
|
+
* @returns {string} - Rendered content.
|
|
26
|
+
*/
|
|
27
|
+
private handleCondition;
|
|
28
|
+
/**
|
|
29
|
+
* Handles the @ternary directive in the template content.
|
|
30
|
+
* @param {string} content - Template content.
|
|
31
|
+
* @param {Object} match - Match object from the regular expression.
|
|
32
|
+
* @param {Object} param - Local variables for rendering.
|
|
33
|
+
* @returns {string} - Rendered content.
|
|
34
|
+
*/
|
|
35
|
+
private ternary;
|
|
36
|
+
/**
|
|
37
|
+
* Handles the @extends directive in the template content.
|
|
38
|
+
* @param {string} content - Template content.
|
|
39
|
+
* @returns {Promise<string>} - Rendered layout content.
|
|
40
|
+
*/
|
|
41
|
+
extends(content: string): Promise<string>;
|
|
42
|
+
/**
|
|
43
|
+
* Handles the @include directive in the template content.
|
|
44
|
+
* @param {string} content - Template content.
|
|
45
|
+
* @param {Object} match - Match object from the regular expression.
|
|
46
|
+
* @param {Object} param - Local variables for rendering.
|
|
47
|
+
* @returns {string} - Rendered content with included file content.
|
|
48
|
+
*/
|
|
49
|
+
private includes;
|
|
50
|
+
/**
|
|
51
|
+
* Handles the @auth directive in the template content.
|
|
52
|
+
* @param {string} content - Template content.
|
|
53
|
+
* @param {Object} match - Match object from the regular expression.
|
|
54
|
+
* @param {Object} param - Local variables for rendering.
|
|
55
|
+
* @returns {string} - Rendered content based on authentication status.
|
|
56
|
+
*/
|
|
57
|
+
private auth;
|
|
58
|
+
/**
|
|
59
|
+
* Handles the @guest directive in the template content.
|
|
60
|
+
* @param {string} content - Template content.
|
|
61
|
+
* @param {Object} match - Match object from the regular expression.
|
|
62
|
+
* @param {Object} param - Local variables for rendering.
|
|
63
|
+
* @returns {string} - Rendered content based on guest status.
|
|
64
|
+
*/
|
|
65
|
+
private guest;
|
|
66
|
+
/**
|
|
67
|
+
* Parses the template content based on the defined directives.
|
|
68
|
+
* @param {string} content - Template content.
|
|
69
|
+
* @param {Object} param - Local variables for rendering.
|
|
70
|
+
* @returns {string} - Rendered content.
|
|
71
|
+
*/
|
|
72
|
+
private parser;
|
|
73
|
+
/**
|
|
74
|
+
* Compiles the template content by processing directives and extending layouts.
|
|
75
|
+
* @param {string} content - Template content.
|
|
76
|
+
* @returns {Promise<string>} - Compiled content.
|
|
77
|
+
*/
|
|
78
|
+
private compiler;
|
|
79
|
+
render(filePath: string, locals: any, callback: any): Promise<any>;
|
|
80
|
+
}
|
|
81
|
+
export declare const jsBladeEngine: TemplatingEngine;
|
|
82
|
+
export {};
|
|
83
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../framework/lib/Templating-engine/index.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAG/C,cAAM,gBAAiB,SAAQ,aAAa;IAC1C,OAAO,CAAC,MAAM,CAAM;IAEpB;;;;;;OAMG;IACH,OAAO,CAAC,cAAc;IAOtB;;;;;;OAMG;IACH,OAAO,CAAC,UAAU;IAuBlB;;;;;;OAMG;IACH,OAAO,CAAC,eAAe;IAevB;;;;;;OAMG;IACH,OAAO,CAAC,OAAO;IAYf;;;;OAIG;IACG,OAAO,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;IAa/C;;;;;;OAMG;IACH,OAAO,CAAC,QAAQ;IAYhB;;;;;;OAMG;IACH,OAAO,CAAC,IAAI;IAmBZ;;;;;;OAMG;IACH,OAAO,CAAC,KAAK;IASb;;;;;OAKG;IACH,OAAO,CAAC,MAAM;IAmCd;;;;OAIG;YACW,QAAQ;IAQhB,MAAM,CAAC,QAAQ,EAAE,MAAM,EAAE,MAAM,EAAE,GAAG,EAAE,QAAQ,EAAE,GAAG;CAa1D;AAED,eAAO,MAAM,aAAa,kBAAyB,CAAC"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
export type ExpressCallback = {};
|
|
2
|
+
export type AppPath = {
|
|
3
|
+
basePath?: string;
|
|
4
|
+
prefixUrl?: string;
|
|
5
|
+
};
|
|
6
|
+
export type ServiceConstructor<T> = new (...args: any[]) => T;
|
|
7
|
+
export type ConfigType = {
|
|
8
|
+
naem: string;
|
|
9
|
+
};
|
|
10
|
+
export type KernelMiddleware = {
|
|
11
|
+
web: Array<any>;
|
|
12
|
+
api: Array<any>;
|
|
13
|
+
};
|
|
14
|
+
export type ContentType = {
|
|
15
|
+
beforMatch: string;
|
|
16
|
+
afterMatch: string;
|
|
17
|
+
};
|
|
18
|
+
export type ObjectType = {
|
|
19
|
+
[key: string]: Array<any>;
|
|
20
|
+
};
|
|
21
|
+
export type ValidationObject = {
|
|
22
|
+
[key: string]: any;
|
|
23
|
+
};
|
|
24
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../framework/lib/Type/index.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,eAAe,GAAG,EAAE,CAAC;AAEjC,MAAM,MAAM,OAAO,GAAG;IACpB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB,CAAC;AAEF,MAAM,MAAM,kBAAkB,CAAC,CAAC,IAAI,KAAK,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,CAAC,CAAC;AAE9D,MAAM,MAAM,UAAU,GAAG;IAAE,IAAI,EAAE,MAAM,CAAA;CAAE,CAAC;AAE1C,MAAM,MAAM,gBAAgB,GAAG;IAC7B,GAAG,EAAE,KAAK,CAAC,GAAG,CAAC,CAAC;IAChB,GAAG,EAAE,KAAK,CAAC,GAAG,CAAC,CAAC;CACjB,CAAC;AAEF,MAAM,MAAM,WAAW,GAAG;IACxB,UAAU,EAAE,MAAM,CAAC;IACnB,UAAU,EAAE,MAAM,CAAC;CACpB,CAAC;AAEF,MAAM,MAAM,UAAU,GAAG;IACvB,CAAC,GAAG,EAAE,MAAM,GAAG,KAAK,CAAC,GAAG,CAAC,CAAC;CAC3B,CAAC;AAEF,MAAM,MAAM,gBAAgB,GAAG;IAC7B,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAC;CACpB,CAAC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { ObjectType } from "../Type";
|
|
2
|
+
import { AppRequest } from "../Interface";
|
|
3
|
+
/**
|
|
4
|
+
* Validates form data.
|
|
5
|
+
* @param {string} errorType - The type of error.
|
|
6
|
+
* @param {object} req - The request object.
|
|
7
|
+
* @param {object} formData - The form data to validate.
|
|
8
|
+
* @returns {object} - Validated data.
|
|
9
|
+
* @throws {Error} - Throws error if validation fails.
|
|
10
|
+
*/
|
|
11
|
+
export declare const validateRequest: (errorType: string, req: AppRequest, formData: ObjectType) => Promise<any>;
|
|
12
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../framework/lib/Validation/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAoB,MAAM,SAAS,CAAC;AAEvD,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAwE1C;;;;;;;GAOG;AACH,eAAO,MAAM,eAAe,cACf,MAAM,OACZ,UAAU,YACL,UAAU,KACnB,OAAO,CAAC,GAAG,CASb,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"rules.d.ts","sourceRoot":"","sources":["../../../framework/lib/Validation/rules.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAEtC,qBAAa,KAAM,SAAQ,QAAQ;cACjB,QAAQ,CACtB,UAAU,EAAE,MAAM,EAClB,SAAS,EAAE,GAAG,EACd,UAAU,EAAE,GAAG,EACf,WAAW,EAAE,MAAM;CA4FtB"}
|
|
@@ -0,0 +1,196 @@
|
|
|
1
|
+
export declare abstract class Validate {
|
|
2
|
+
/**
|
|
3
|
+
* Validates if a field is required.
|
|
4
|
+
* @param {string} fieldName - The name of the field.
|
|
5
|
+
* @param {string} value - The value of the field.
|
|
6
|
+
* @returns {string|boolean} - Error message if validation fails, otherwise false.
|
|
7
|
+
*/
|
|
8
|
+
protected required(fieldName: string, value: string): string | boolean;
|
|
9
|
+
/**
|
|
10
|
+
* Validates if a field is required.
|
|
11
|
+
* @param {string} fieldName - The name of the field.
|
|
12
|
+
* @param {object} value - The value of the field.
|
|
13
|
+
* @returns {string|boolean} - Error message if validation fails, otherwise false.
|
|
14
|
+
*/
|
|
15
|
+
protected object(fieldName: string, value: string): string | boolean;
|
|
16
|
+
/**
|
|
17
|
+
* Validates if a field is required.
|
|
18
|
+
* @param {string} fieldName - The name of the field.
|
|
19
|
+
* @param {string} value - The value of the field.
|
|
20
|
+
* @returns {string|boolean} - Error message if validation fails, otherwise false.
|
|
21
|
+
*/
|
|
22
|
+
protected array(fieldName: string, value: string): string | boolean;
|
|
23
|
+
/**
|
|
24
|
+
* Validates if a field meets a minimum length requirement.
|
|
25
|
+
* @param {string} fieldName - The name of the field.
|
|
26
|
+
* @param {string} fieldValue - The value of the field.
|
|
27
|
+
* @param {number|number} minValue - The minimum length requirement.
|
|
28
|
+
* @returns {string|boolean} - Error message if validation fails, otherwise false.
|
|
29
|
+
*/
|
|
30
|
+
protected min(fieldName: string, fieldValue: string, minValue: string | number): string | boolean;
|
|
31
|
+
/**
|
|
32
|
+
* Validates if a field meets a maximum length requirement.
|
|
33
|
+
* @param {string} fieldName - The name of the field.
|
|
34
|
+
* @param {string} fieldValue - The value of the field.
|
|
35
|
+
* @param {number} maxValue - The maximum length requirement.
|
|
36
|
+
* @returns {string|boolean} - Error message if validation fails, otherwise false.
|
|
37
|
+
*/
|
|
38
|
+
protected max(fieldName: string, fieldValue: string, maxValue: string | number): string | boolean;
|
|
39
|
+
/**
|
|
40
|
+
* Validates if a field is a valid email address.
|
|
41
|
+
* @param {string} fieldValue - The value of the email field.
|
|
42
|
+
* @returns {string|boolean} - Error message if validation fails, otherwise false.
|
|
43
|
+
*/
|
|
44
|
+
protected email(fieldValue: string): string | boolean;
|
|
45
|
+
/**
|
|
46
|
+
* Validates if a field is a boolean value.
|
|
47
|
+
* @param {string} fieldName - The name of the field being validated.
|
|
48
|
+
* @param {any} fieldValue - The value of the field.
|
|
49
|
+
* @returns {string|boolean} - Error message if validation fails, otherwise false.
|
|
50
|
+
*/
|
|
51
|
+
protected bool(fieldName: string, fieldValue: string): string | boolean;
|
|
52
|
+
/**
|
|
53
|
+
* Validates if a field is a float number.
|
|
54
|
+
* @param {string} fieldName - The name of the field being validated.
|
|
55
|
+
* @param {any} fieldValue - The value of the field.
|
|
56
|
+
* @returns {string|boolean} - Error message if validation fails, otherwise false.
|
|
57
|
+
*/
|
|
58
|
+
protected float(fieldName: string, fieldValue: string): string | boolean;
|
|
59
|
+
/**
|
|
60
|
+
* Validates if a field is a numeric value.
|
|
61
|
+
* @param {string} fieldName - The name of the field being validated.
|
|
62
|
+
* @param {any} fieldValue - The value of the field.
|
|
63
|
+
* @returns {string|boolean} - Error message if validation fails, otherwise false.
|
|
64
|
+
*/
|
|
65
|
+
protected num(fieldName: string, fieldValue: string): string | boolean;
|
|
66
|
+
/**
|
|
67
|
+
* Validates if a field contains only alphabetical characters.
|
|
68
|
+
* @param {string} fieldName - The name of the field being validated.
|
|
69
|
+
* @param {string} fieldValue - The value of the field.
|
|
70
|
+
* @returns {string|boolean} - Error message if validation fails, otherwise false.
|
|
71
|
+
*/
|
|
72
|
+
protected alpha(fieldName: string, fieldValue: string): string | boolean;
|
|
73
|
+
/**
|
|
74
|
+
* Validates if a field contains only alphanumeric characters.
|
|
75
|
+
* @param {string} fieldName - The name of the field being validated.
|
|
76
|
+
* @param {string} fieldValue - The value of the field.
|
|
77
|
+
* @returns {string|boolean} - Error message if validation fails, otherwise false.
|
|
78
|
+
*/
|
|
79
|
+
protected alphaNum(fieldName: string, fieldValue: string): string | boolean;
|
|
80
|
+
/**
|
|
81
|
+
* Validates if two fields have the same value.
|
|
82
|
+
* @param {string[]} fieldNames - The names of the fields being compared.
|
|
83
|
+
* @param {string[]} fieldValues - The values of the fields being compared.
|
|
84
|
+
* @returns {string|boolean} - Error message if validation fails, otherwise false.
|
|
85
|
+
*/
|
|
86
|
+
protected same(fieldNames?: string | Array<any>, fieldValues?: string | Array<any>): string | boolean;
|
|
87
|
+
/**
|
|
88
|
+
* Validates if a field is a valid credit card number.
|
|
89
|
+
* @param {string} fieldName - The name of the field being validated.
|
|
90
|
+
* @param {string} fieldValue - The value of the field.
|
|
91
|
+
* @returns {string|boolean} - Error message if validation fails, otherwise false.
|
|
92
|
+
*/
|
|
93
|
+
protected creditCard(fieldName: string, fieldValue: string): string | boolean;
|
|
94
|
+
/**
|
|
95
|
+
* Validates if a field is a valid URL.
|
|
96
|
+
* @param {string} fieldName - The name of the field being validated.
|
|
97
|
+
* @param {string} fieldValue - The value of the field.
|
|
98
|
+
* @returns {string|boolean} - Error message if validation fails, otherwise false.
|
|
99
|
+
*/
|
|
100
|
+
protected url(fieldName: string, fieldValue: string): string | boolean;
|
|
101
|
+
/**
|
|
102
|
+
* Validates if a field is a valid decimal number.
|
|
103
|
+
* @param {string} fieldName - The name of the field being validated.
|
|
104
|
+
* @param {string} fieldValue - The value of the field.
|
|
105
|
+
* @returns {string|boolean} - Error message if validation fails, otherwise false.
|
|
106
|
+
*/
|
|
107
|
+
protected decimal(fieldName: string, fieldValue: string): string | boolean;
|
|
108
|
+
/**
|
|
109
|
+
* Validates if a field is a valid integer.
|
|
110
|
+
* @param {string} fieldName - The name of the field being validated.
|
|
111
|
+
* @param {string} fieldValue - The value of the field.
|
|
112
|
+
* @returns {string|boolean} - Error message if validation fails, otherwise false.
|
|
113
|
+
*/
|
|
114
|
+
protected int(fieldName: string, fieldValue: string): string | boolean;
|
|
115
|
+
/**
|
|
116
|
+
* Validates if a field is a valid JSON string.
|
|
117
|
+
* @param {string} fieldName - The name of the field being validated.
|
|
118
|
+
* @param {string} fieldValue - The value of the field.
|
|
119
|
+
* @returns {string|boolean} - Error message if validation fails, otherwise false.
|
|
120
|
+
*/
|
|
121
|
+
protected json(fieldName: string, fieldValue: string): string | boolean;
|
|
122
|
+
/**
|
|
123
|
+
* Validates if a field value is unique in a given model.
|
|
124
|
+
* @param {string} fieldName - The name of the field being validated.
|
|
125
|
+
* @param {string} fieldValue - The value of the field.
|
|
126
|
+
* @param {string} model - The name of the model to check uniqueness against.
|
|
127
|
+
* @returns {string|boolean} - Error message if validation fails, otherwise false.
|
|
128
|
+
*/
|
|
129
|
+
protected unqiue(fieldName: string, fieldValue: string, model: string): Promise<any>;
|
|
130
|
+
/**
|
|
131
|
+
* Validates if a field value is a valid JSON Web Token (JWT).
|
|
132
|
+
* @param {string} fieldName - The name of the field being validated.
|
|
133
|
+
* @param {string} fieldValue - The value of the field.
|
|
134
|
+
* @returns {string|boolean} - Error message if validation fails, otherwise false.
|
|
135
|
+
*/
|
|
136
|
+
protected jwt(fieldName: string, fieldValue: string): string | boolean;
|
|
137
|
+
/**
|
|
138
|
+
* Validates if a field is a valid postal code.
|
|
139
|
+
* @param {string} fieldName - The name of the field being validated.
|
|
140
|
+
* @param {string} fieldValue - The value of the field.
|
|
141
|
+
* @returns {string|boolean} - Error message if validation fails, otherwise false.
|
|
142
|
+
*/
|
|
143
|
+
protected postal(fieldName: string, fieldValue: string, secondValue?: any): string | boolean;
|
|
144
|
+
/**
|
|
145
|
+
* Indicates that a field is nullable and does not require validation.
|
|
146
|
+
* @returns {boolean} - Always returns false to indicate that the field is nullable.
|
|
147
|
+
*/
|
|
148
|
+
protected nullable(): boolean;
|
|
149
|
+
/**
|
|
150
|
+
* Validates if a field is a valid phone number.
|
|
151
|
+
* @param {string} fieldName - The name of the field being validated.
|
|
152
|
+
* @param {string} fieldValue - The value of the field.
|
|
153
|
+
* @returns {string|boolean} - Error message if validation fails, otherwise false.
|
|
154
|
+
*/
|
|
155
|
+
protected phone(fieldName: string, fieldValue: string): string | boolean;
|
|
156
|
+
/**
|
|
157
|
+
* Validates if a field is a valid slug.
|
|
158
|
+
* @param {string} fieldName - The name of the field being validated.
|
|
159
|
+
* @param {string} fieldValue - The value of the field.
|
|
160
|
+
* @returns {string|boolean} - Error message if validation fails, otherwise false.
|
|
161
|
+
*/
|
|
162
|
+
protected slug(fieldName: string, fieldValue: string): string | boolean;
|
|
163
|
+
/**
|
|
164
|
+
* Indicates that the field should be skipped during validation.
|
|
165
|
+
* @returns {boolean} - Always returns false to indicate that the field should not be skipped.
|
|
166
|
+
*/
|
|
167
|
+
protected skip(): boolean;
|
|
168
|
+
/**
|
|
169
|
+
* Validates if a field is a valid MongoDB ObjectId.
|
|
170
|
+
* @param {string} fieldName - The name of the field being validated.
|
|
171
|
+
* @param {string} fieldValue - The value of the field.
|
|
172
|
+
* @returns {string|boolean} - Error message if validation fails, otherwise false.
|
|
173
|
+
*/
|
|
174
|
+
protected mongoId(fieldName: string, fieldValue: string): string | boolean;
|
|
175
|
+
/**
|
|
176
|
+
* Extracts data from the request object.
|
|
177
|
+
* @param {object} req - The request object.
|
|
178
|
+
* @param {string} data - The name of the data to extract from the request.
|
|
179
|
+
* @returns {any} - The extracted data from the request.
|
|
180
|
+
*/
|
|
181
|
+
protected request(req: any, data: string): string | any;
|
|
182
|
+
/**
|
|
183
|
+
* Extracts a value from a string based on index.
|
|
184
|
+
* @param {string} data - The string containing values.
|
|
185
|
+
* @param {number} index - The index of the value to extract.
|
|
186
|
+
* @returns {string} - The extracted value.
|
|
187
|
+
*/
|
|
188
|
+
extractValue(data: string, index: number): string;
|
|
189
|
+
/**
|
|
190
|
+
* Determines if a validation rule requires a second value.
|
|
191
|
+
* @param {string} data - The validation rule.
|
|
192
|
+
* @returns {boolean} - True if a second value is required, otherwise false.
|
|
193
|
+
*/
|
|
194
|
+
secondValue(data: string): boolean;
|
|
195
|
+
}
|
|
196
|
+
//# sourceMappingURL=validate.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"validate.d.ts","sourceRoot":"","sources":["../../../framework/lib/Validation/validate.ts"],"names":[],"mappings":"AAGA,8BAAsB,Q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,OAAO;IAI7B;;;;;OAKG;IACH,SAAS,CAAC,KAAK,CAAC,SAAS,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,GAAG,MAAM,GAAG,OAAO;IAMxE;;;;;OAKG;IACH,SAAS,CAAC,IAAI,CAAC,SAAS,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,GAAG,MAAM,GAAG,OAAO;IAMvE;;;OAGG;IACH,SAAS,CAAC,IAAI,IAAI,OAAO;IAIzB;;;;;OAKG;IACH,SAAS,CAAC,OAAO,CAAC,SAAS,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,GAAG,MAAM,GAAG,OAAO;IAM1E;;;;;OAKG;IACH,SAAS,CAAC,OAAO,CAAC,GAAG,EAAE,GAAG,EAAE,IAAI,EAAE,MAAM,GAAG,MAAM,GAAG,GAAG;IAIvD;;;;;OAKG;IACH,YAAY,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,MAAM;IAIjD;;;;OAIG;IACH,WAAW,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO;CAKnC"}
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Function to retrieve the root path of the project.
|
|
3
|
+
* @param {string} file - The file path relative to the project root.
|
|
4
|
+
* @returns {string} - Absolute path of the specified file.
|
|
5
|
+
*/
|
|
6
|
+
export declare const rootPath: (file: string) => any;
|
|
7
|
+
/**
|
|
8
|
+
* Function load all route files
|
|
9
|
+
*/
|
|
10
|
+
export declare const loadRoutes: () => void;
|
|
11
|
+
/**
|
|
12
|
+
* Function to retrieve a controller module.
|
|
13
|
+
* @param {string} file - The name of the controller file.
|
|
14
|
+
* @returns {object} - The controller module.
|
|
15
|
+
*/
|
|
16
|
+
export declare const getController: (file: string) => any;
|
|
17
|
+
/**
|
|
18
|
+
* Function to retrieve an API controller module.
|
|
19
|
+
* @param {string} file - The name of the API controller file.
|
|
20
|
+
* @returns {object} - The API controller module.
|
|
21
|
+
*/
|
|
22
|
+
export declare const getApiController: (file: string) => any;
|
|
23
|
+
/**
|
|
24
|
+
* Function to retrieve a model module.
|
|
25
|
+
* @param {string} file - The name of the model file.
|
|
26
|
+
* @returns {object} - The model module.
|
|
27
|
+
*/
|
|
28
|
+
export declare const getModel: (file: string) => any;
|
|
29
|
+
/**
|
|
30
|
+
* Function to retrieve a middleware module.
|
|
31
|
+
* @param {string} file - The name of the middleware file.
|
|
32
|
+
* @returns {object} - The middleware module.
|
|
33
|
+
*/
|
|
34
|
+
export declare const getMiddleware: (file: string) => any;
|
|
35
|
+
/**
|
|
36
|
+
* Function to retrieve a request module.
|
|
37
|
+
* @param {string} file - The name of the request file.
|
|
38
|
+
* @returns {object} - The request module.
|
|
39
|
+
*/
|
|
40
|
+
export declare const getRequest: (file: string) => any;
|
|
41
|
+
/**
|
|
42
|
+
* Function to retrieve a registered route.
|
|
43
|
+
* @param {string} file - The name of the request file.
|
|
44
|
+
* @returns {routefile} - The route file .
|
|
45
|
+
*/
|
|
46
|
+
export declare const getRoute: (file: string) => any;
|
|
47
|
+
/**
|
|
48
|
+
* Function to hash a string using bcrypt.
|
|
49
|
+
* @param {string} string - The string to be hashed.
|
|
50
|
+
* @returns {Promise<string>} - Hashed string.
|
|
51
|
+
*/
|
|
52
|
+
export declare const bcrypt: (str: string) => Promise<string>;
|
|
53
|
+
/**
|
|
54
|
+
* Function to verify a string against a bcrypt hash.
|
|
55
|
+
* @param {string} string - The string to be verified.
|
|
56
|
+
* @param {string} hash - The hash to verify against.
|
|
57
|
+
* @returns {Promise<boolean>} - Boolean indicating whether the string matches the hash.
|
|
58
|
+
*/
|
|
59
|
+
export declare const verifyHash: (string: string, hash: string) => Promise<boolean>;
|
|
60
|
+
/**
|
|
61
|
+
* Function to sign a JWT token.
|
|
62
|
+
* @param {object} data - The data to be encoded in the token.
|
|
63
|
+
* @returns {string} - Signed JWT token.
|
|
64
|
+
*/
|
|
65
|
+
export declare const jwtSign: (data: string) => string | any;
|
|
66
|
+
/**
|
|
67
|
+
* Function to verify a JWT token.
|
|
68
|
+
* @param {string} token - The JWT token to be verified.
|
|
69
|
+
* @returns {object} - Decoded JWT payload.
|
|
70
|
+
*/
|
|
71
|
+
export declare const jwtVerify: (token: string) => string | any;
|
|
72
|
+
/**
|
|
73
|
+
* Function to save an image file.
|
|
74
|
+
* @param {object} req - The request object containing the file.
|
|
75
|
+
* @param {string} fieldName - The name of the field containing the file.
|
|
76
|
+
* @param {string} folder - The folder where the image will be saved (default: 'image').
|
|
77
|
+
* @returns {string|boolean} - The filename if saved successfully, otherwise false.
|
|
78
|
+
*/
|
|
79
|
+
export declare const saveImage: (req: any, fieldName: string, folder?: string) => string;
|
|
80
|
+
/**
|
|
81
|
+
* Function to capitalize the first letter of a string.
|
|
82
|
+
* @param {string} str - The input string.
|
|
83
|
+
* @returns {string} - The capitalized string.
|
|
84
|
+
*/
|
|
85
|
+
export declare const capitalize: (str: string) => string;
|
|
86
|
+
/**
|
|
87
|
+
* Function to handle asynchronous middleware functions.
|
|
88
|
+
* @param {function} func - The asynchronous middleware function.
|
|
89
|
+
* @returns {function} - Asynchronous middleware function wrapped in a promise.
|
|
90
|
+
*/
|
|
91
|
+
export declare const asyncHandler: (func: any) => any;
|
|
92
|
+
export declare const getModelFile: (modelName: string) => string;
|
|
93
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../framework/lib/util/index.ts"],"names":[],"mappings":"AAcA;;;;GAIG;AACH,eAAO,MAAM,QAAQ,SAAU,MAAM,KAAG,GAC0B,CAAC;AAEnE;;GAEG;AACH,eAAO,MAAM,UAAU,QAAO,IAG7B,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,aAAa,SAAU,MAAM,KAAG,GACW,CAAC;AAEzD;;;;GAIG;AACH,eAAO,MAAM,gBAAgB,SAAU,MAAM,KAAG,GACY,CAAC;AAE7D;;;;GAIG;AACH,eAAO,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