jcc-express-mvc 1.3.12 → 1.3.14
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/{Interface.d.ts → Container.d.ts} +2 -2
- package/Container.d.ts.map +1 -0
- package/FormRequest.d.ts +2 -0
- package/FormRequest.d.ts.map +1 -0
- package/FormRequest.js +17 -0
- package/Route.d.ts +3 -0
- package/Route.d.ts.map +1 -0
- package/Route.js +6 -0
- package/cli.d.ts +1 -1
- package/cli.d.ts.map +1 -1
- package/cli.js +1 -1
- package/http.d.ts +2 -0
- package/http.d.ts.map +1 -0
- package/http.js +2 -0
- package/index.d.ts +2 -10
- package/index.d.ts.map +1 -1
- package/index.js +1 -6
- package/lib/App.js +1 -1
- package/lib/Command-Line/MakeCommand.d.ts.map +1 -1
- package/lib/Command-Line/MakeCommand.js +19 -0
- package/lib/Command-Line/NodeArtisanCommand.d.ts +4 -1
- package/lib/Command-Line/NodeArtisanCommand.d.ts.map +1 -1
- package/lib/Command-Line/NodeArtisanCommand.js +4 -4
- package/lib/Command-Line/NodeTinker/ConsoleInput.d.ts +1 -1
- package/lib/Command-Line/NodeTinker/ConsoleInput.d.ts.map +1 -1
- package/lib/Command-Line/NodeTinker/ConsoleInput.js +23 -28
- package/lib/Command-Line/NodeTinker/Tinker.d.ts +1 -1
- package/lib/Command-Line/NodeTinker/Tinker.d.ts.map +1 -1
- package/lib/Command-Line/NodeTinker/TinkerCommand.d.ts +2 -1
- package/lib/Command-Line/NodeTinker/TinkerCommand.d.ts.map +1 -1
- package/lib/Command-Line/NodeTinker/TinkerCommand.js +25 -0
- package/lib/Command-Line/command.js +1 -1
- package/lib/Command-Line/files/Controller.js +1 -1
- package/lib/Command-Line/files/Migration.d.ts.map +1 -1
- package/lib/Command-Line/files/Migration.js +6 -5
- package/lib/Command-Line/files/Request.d.ts.map +1 -1
- package/lib/Command-Line/files/Request.js +2 -1
- package/lib/Dependancy/index.d.ts +1 -0
- package/lib/Dependancy/index.d.ts.map +1 -1
- package/lib/Dependancy/index.js +2 -2
- package/lib/Error/AppErrorHandler.d.ts.map +1 -1
- package/lib/Error/AppErrorHandler.js +1 -12
- package/lib/Error/DisplayErrorCode.d.ts.map +1 -1
- package/lib/Error/DisplayErrorCode.js +3 -1
- package/lib/Error/public/error.html +56 -21
- package/lib/Middlewares/index.d.ts.map +1 -1
- package/lib/Middlewares/index.js +2 -2
- package/lib/Passport/config.js +1 -1
- package/lib/Routes/RouteBuilder.d.ts +2 -2
- package/lib/Routes/RouteBuilder.d.ts.map +1 -1
- package/lib/Routes/RouteBuilder.js +7 -7
- package/lib/Routes/Router.js +1 -1
- package/lib/Services/ServiceProvider.d.ts +3 -3
- package/lib/Services/ServiceProvider.d.ts.map +1 -1
- package/lib/util/index.d.ts +7 -0
- package/lib/util/index.d.ts.map +1 -1
- package/lib/util/index.js +15 -4
- package/package.json +1 -1
- package/Interface.d.ts.map +0 -1
- /package/{Interface.js → Container.js} +0 -0
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export interface
|
|
1
|
+
export interface Container {
|
|
2
2
|
/**
|
|
3
3
|
* Bind a service to the container.
|
|
4
4
|
* @param key The unique key to identify the service.
|
|
@@ -47,4 +47,4 @@ export interface ServiceInterface {
|
|
|
47
47
|
*/
|
|
48
48
|
alias(key: string, alias: string): void;
|
|
49
49
|
}
|
|
50
|
-
//# sourceMappingURL=
|
|
50
|
+
//# sourceMappingURL=Container.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Container.d.ts","sourceRoot":"","sources":["../framework/Container.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,SAAS;IACxB;;;;OAIG;IACH,IAAI,CAAC,CAAC,EAAE,GAAG,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,CAAC,GAAG,IAAI,CAAC;IAE9C;;;;OAIG;IACH,SAAS,CAAC,CAAC,EAAE,GAAG,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,CAAC,GAAG,IAAI,CAAC;IAEnD;;;;;OAKG;IACH,OAAO,CAAC,CAAC,EAAE,GAAG,EAAE,MAAM,GAAG,CAAC,CAAC;IAE3B;;;;;;;OAOG;IACH,IAAI,CAAC,CAAC,EAAE,MAAM,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,KAAK,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;IAE9C;;;;OAIG;IACH,GAAG,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;IAE1B;;;;OAIG;IACH,IAAI,CAAC,CAAC,EAAE,GAAG,EAAE,MAAM,GAAG,CAAC,CAAC;IAExB;;;;;OAKG;IACH,KAAK,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;CACzC"}
|
package/FormRequest.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FormRequest.d.ts","sourceRoot":"","sources":["../framework/FormRequest.ts"],"names":[],"mappings":"AAAA,cAAc,2BAA2B,CAAC"}
|
package/FormRequest.js
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./lib/Request/FormRequest"), exports);
|
package/Route.d.ts
ADDED
package/Route.d.ts.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Route.d.ts","sourceRoot":"","sources":["../framework/Route.ts"],"names":[],"mappings":"AACA,eAAO,MAAM,KAAK,2CAAkB,CAAC;AACrC,eAAO,MAAM,QAAQ,2CAAkB,CAAC"}
|
package/Route.js
ADDED
package/cli.d.ts
CHANGED
package/cli.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cli.d.ts","sourceRoot":"","sources":["../framework/cli.ts"],"names":[],"mappings":"AAAA,cAAc,uCAAuC,CAAC;AACtD,cAAc,
|
|
1
|
+
{"version":3,"file":"cli.d.ts","sourceRoot":"","sources":["../framework/cli.ts"],"names":[],"mappings":"AAAA,cAAc,uCAAuC,CAAC;AACtD,cAAc,6CAA6C,CAAC"}
|
package/cli.js
CHANGED
|
@@ -15,4 +15,4 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
17
|
__exportStar(require("./lib/Command-Line/NodeArtisanCommand"), exports);
|
|
18
|
-
__exportStar(require("./lib/Command-Line/NodeTinker/
|
|
18
|
+
__exportStar(require("./lib/Command-Line/NodeTinker/TinkerCommand"), exports);
|
package/http.d.ts
ADDED
package/http.d.ts.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"http.d.ts","sourceRoot":"","sources":["../framework/http.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,UAAU,IAAI,OAAO,EACrB,WAAW,IAAI,QAAQ,EACvB,OAAO,IAAI,IAAI,GAChB,MAAM,iBAAiB,CAAC"}
|
package/http.js
ADDED
package/index.d.ts
CHANGED
|
@@ -1,22 +1,14 @@
|
|
|
1
1
|
import { config as appConfig } from "./lib/Config/Config";
|
|
2
2
|
import Kernel from "./lib/HttpKernel/HttpKernel";
|
|
3
3
|
import Authentication from "./lib/Auth";
|
|
4
|
-
import { AppRequest, AppResponse, AppNext } from "./lib/Interface";
|
|
5
|
-
import { FormRequest as AppFormRequest } from "./lib/Request/FormRequest";
|
|
6
4
|
import { bcrypt as appBcrypt, verifyHash as appVerifyHash, jwtSign as appJwtSign, jwtVerify as appjwtVerify } from "./lib/util";
|
|
7
|
-
export declare const Route: import("./lib/Routes/Router").Router<any>;
|
|
8
|
-
export declare const ApiRoute: import("./lib/Routes/Router").Router<any>;
|
|
9
5
|
export declare const HttpKernel: typeof Kernel;
|
|
10
6
|
export declare const config: typeof appConfig;
|
|
11
7
|
export declare const Auth: typeof Authentication;
|
|
12
|
-
export declare const auth: (request:
|
|
13
|
-
export declare const apiAuth: (request:
|
|
14
|
-
export declare const FormRequest: typeof AppFormRequest;
|
|
8
|
+
export declare const auth: (request: import("./http").Request, response: import("./http").Response, next: import("./http").Next) => any;
|
|
9
|
+
export declare const apiAuth: (request: import("./http").Request, response: import("./http").Response, next: import("./http").Next) => any;
|
|
15
10
|
export declare const bcrypt: typeof appBcrypt;
|
|
16
11
|
export declare const jwtSign: typeof appJwtSign;
|
|
17
12
|
export declare const jwtVerify: typeof appjwtVerify;
|
|
18
13
|
export declare const verifyHash: typeof appVerifyHash;
|
|
19
|
-
export type Request = AppRequest;
|
|
20
|
-
export type Response = AppResponse;
|
|
21
|
-
export type Next = AppNext;
|
|
22
14
|
//# sourceMappingURL=index.d.ts.map
|
package/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../framework/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,IAAI,SAAS,EAAE,MAAM,qBAAqB,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../framework/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,IAAI,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAC1D,OAAO,MAAM,MAAM,6BAA6B,CAAC;AACjD,OAAO,cAAc,MAAM,YAAY,CAAC;AAExC,OAAO,EACL,MAAM,IAAI,SAAS,EACnB,UAAU,IAAI,aAAa,EAC3B,OAAO,IAAI,UAAU,EACrB,SAAS,IAAI,YAAY,EAC1B,MAAM,YAAY,CAAC;AAEpB,eAAO,MAAM,UAAU,eAAS,CAAC;AACjC,eAAO,MAAM,MAAM,EAAE,OAAO,SAAqB,CAAC;AAClD,eAAO,MAAM,IAAI,EAAE,OAAO,cAA+B,CAAC;AAC1D,eAAO,MAAM,IAAI,8GAAsB,CAAC;AACxC,eAAO,MAAM,OAAO,8GAAyB,CAAC;AAC9C,eAAO,MAAM,MAAM,EAAE,OAAO,SAAqB,CAAC;AAClD,eAAO,MAAM,OAAO,EAAE,OAAO,UAAuB,CAAC;AACrD,eAAO,MAAM,SAAS,EAAE,OAAO,YAA2B,CAAC;AAC3D,eAAO,MAAM,UAAU,EAAE,OAAO,aAA6B,CAAC"}
|
package/index.js
CHANGED
|
@@ -3,22 +3,17 @@ 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.verifyHash = exports.jwtVerify = exports.jwtSign = exports.bcrypt = exports.
|
|
6
|
+
exports.verifyHash = exports.jwtVerify = exports.jwtSign = exports.bcrypt = exports.apiAuth = exports.auth = exports.Auth = exports.config = exports.HttpKernel = void 0;
|
|
7
7
|
const Config_1 = require("./lib/Config/Config");
|
|
8
|
-
const App_1 = require("./lib/App");
|
|
9
8
|
const HttpKernel_1 = __importDefault(require("./lib/HttpKernel/HttpKernel"));
|
|
10
9
|
const Auth_1 = __importDefault(require("./lib/Auth"));
|
|
11
10
|
const AuthMiddleware_1 = require("./lib/Auth/AuthMiddleware");
|
|
12
|
-
const FormRequest_1 = require("./lib/Request/FormRequest");
|
|
13
11
|
const util_1 = require("./lib/util");
|
|
14
|
-
exports.Route = App_1.app.webRoutes();
|
|
15
|
-
exports.ApiRoute = App_1.app.apiRoutes();
|
|
16
12
|
exports.HttpKernel = HttpKernel_1.default;
|
|
17
13
|
exports.config = Config_1.config;
|
|
18
14
|
exports.Auth = Auth_1.default;
|
|
19
15
|
exports.auth = AuthMiddleware_1.authMiddleware.auth;
|
|
20
16
|
exports.apiAuth = AuthMiddleware_1.authMiddleware.apiAuth;
|
|
21
|
-
exports.FormRequest = FormRequest_1.FormRequest;
|
|
22
17
|
exports.bcrypt = util_1.bcrypt;
|
|
23
18
|
exports.jwtSign = util_1.jwtSign;
|
|
24
19
|
exports.jwtVerify = util_1.jwtVerify;
|
package/lib/App.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MakeCommand.d.ts","sourceRoot":"","sources":["../../../framework/lib/Command-Line/MakeCommand.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"MakeCommand.d.ts","sourceRoot":"","sources":["../../../framework/lib/Command-Line/MakeCommand.ts"],"names":[],"mappings":"AAIA,eAAO,MAAM,WAAW,gBAAgB,KAAK,CAAC,GAAG,CAAC,QA0HjD,CAAC"}
|
|
@@ -4,7 +4,9 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.makeCommand = void 0;
|
|
7
|
+
const util_1 = require("../util");
|
|
7
8
|
const command_1 = __importDefault(require("./command"));
|
|
9
|
+
const inflection_1 = require("inflection");
|
|
8
10
|
const makeCommand = (commandArg = []) => {
|
|
9
11
|
let index = commandArg.findIndex((arg, index) => arg.includes(":")); //commandArg[0].split(":")[1] || commandArg[1].split(":")[1]; // Extract the command type from the first argument
|
|
10
12
|
let command = commandArg[index].split(":")[1] || "";
|
|
@@ -32,6 +34,23 @@ const makeCommand = (commandArg = []) => {
|
|
|
32
34
|
(command === "apiController" || command === "ApiController")) {
|
|
33
35
|
return command_1.default.addApi(commandArg[index + 1], commandArg[index + 2]); // Add an API controller
|
|
34
36
|
}
|
|
37
|
+
if (commandArg.length === index + 3 &&
|
|
38
|
+
(command === "model" || command === "Model") &&
|
|
39
|
+
commandArg[index + 2] === "-mcr") {
|
|
40
|
+
const modelName = commandArg[index + 1];
|
|
41
|
+
command_1.default.addModel(modelName); // Add a model
|
|
42
|
+
command_1.default.addWeb(`${(0, inflection_1.pluralize)(modelName)}Controller`);
|
|
43
|
+
return command_1.default.addMigration(`create_${(0, util_1.pluralizeStr)(modelName)}_table`, "");
|
|
44
|
+
}
|
|
45
|
+
if (commandArg.length === index + 3 &&
|
|
46
|
+
(command === "model" || command === "Model") &&
|
|
47
|
+
commandArg[index + 2] === "-mcsr") {
|
|
48
|
+
const modelName = commandArg[index + 1];
|
|
49
|
+
command_1.default.addModel(modelName); // Add a model
|
|
50
|
+
command_1.default.addWeb(`${(0, inflection_1.pluralize)(modelName)}Controller`);
|
|
51
|
+
command_1.default.addMigration(`create_${(0, util_1.pluralizeStr)(modelName)}_table`, "");
|
|
52
|
+
return command_1.default.addSeeder(`${modelName}Seeder`);
|
|
53
|
+
}
|
|
35
54
|
// If the command is for creating a model
|
|
36
55
|
if (commandArg.length === index + 2 &&
|
|
37
56
|
(command === "model" || command === "Model")) {
|
|
@@ -1,2 +1,5 @@
|
|
|
1
|
-
export declare
|
|
1
|
+
export declare class ConsoleKernel {
|
|
2
|
+
parse(consoleArgs: Array<any>): Promise<void>;
|
|
3
|
+
getAction(actionType: string, type: string | undefined, argvs: Array<any>): Promise<void>;
|
|
4
|
+
}
|
|
2
5
|
//# sourceMappingURL=NodeArtisanCommand.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"NodeArtisanCommand.d.ts","sourceRoot":"","sources":["../../../framework/lib/Command-Line/NodeArtisanCommand.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"NodeArtisanCommand.d.ts","sourceRoot":"","sources":["../../../framework/lib/Command-Line/NodeArtisanCommand.ts"],"names":[],"mappings":"AAIA,qBAAa,aAAa;IAElB,KAAK,CAAC,WAAW,EAAE,KAAK,CAAC,GAAG,CAAC;IAS7B,SAAS,CAAC,UAAU,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,YAAK,EAAE,KAAK,EAAE,KAAK,CAAC,GAAG,CAAC;CAmBzE"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.ConsoleKernel = void 0;
|
|
4
4
|
const DBCommand_1 = require("./DBCommand");
|
|
5
5
|
const MakeCommand_1 = require("./MakeCommand");
|
|
6
6
|
const MigrateCommand_1 = require("./MigrateCommand");
|
|
@@ -22,8 +22,7 @@ class ConsoleKernel {
|
|
|
22
22
|
await (0, DBCommand_1.DBCommand)(argvs);
|
|
23
23
|
return;
|
|
24
24
|
case "make":
|
|
25
|
-
|
|
26
|
-
console.log(data);
|
|
25
|
+
await (0, MakeCommand_1.makeCommand)(argvs);
|
|
27
26
|
return;
|
|
28
27
|
default:
|
|
29
28
|
console.log("Sorry command not found");
|
|
@@ -31,4 +30,5 @@ class ConsoleKernel {
|
|
|
31
30
|
}
|
|
32
31
|
}
|
|
33
32
|
}
|
|
34
|
-
exports.
|
|
33
|
+
exports.ConsoleKernel = ConsoleKernel;
|
|
34
|
+
// export const getArgv = new ConsoleKernel().parse.bind(new ConsoleKernel());
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export
|
|
1
|
+
export {};
|
|
2
2
|
//# sourceMappingURL=ConsoleInput.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ConsoleInput.d.ts","sourceRoot":"","sources":["../../../../framework/lib/Command-Line/NodeTinker/ConsoleInput.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"ConsoleInput.d.ts","sourceRoot":"","sources":["../../../../framework/lib/Command-Line/NodeTinker/ConsoleInput.ts"],"names":[],"mappings":""}
|
|
@@ -1,30 +1,25 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
};
|
|
2
|
+
// import { TinkerCommand } from "./TinkerCommand";
|
|
3
|
+
// import readline from "readline";
|
|
5
4
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
|
|
7
|
-
const
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
});
|
|
28
|
-
return;
|
|
29
|
-
};
|
|
30
|
-
exports.consoleInput = consoleInput;
|
|
5
|
+
// export const consoleInput = () => {
|
|
6
|
+
// const rl = readline.createInterface({
|
|
7
|
+
// input: process.stdin,
|
|
8
|
+
// output: process.stdout,
|
|
9
|
+
// prompt: "> ",
|
|
10
|
+
// });
|
|
11
|
+
// rl.prompt();
|
|
12
|
+
// rl.on("line", (inputLine: string) => {
|
|
13
|
+
// const [command, ...args] = inputLine.trim().split(" ");
|
|
14
|
+
// // const tc = new TinkerCommand();
|
|
15
|
+
// tc.extractCommand(command)
|
|
16
|
+
// .then((res) => console.log(res))
|
|
17
|
+
// .catch((err) => console.log(err));
|
|
18
|
+
// return rl.prompt();
|
|
19
|
+
// });
|
|
20
|
+
// rl.on("close", () => {
|
|
21
|
+
// console.log("Goodbye, Have a nice day.");
|
|
22
|
+
// process.exit(0);
|
|
23
|
+
// });
|
|
24
|
+
// return;
|
|
25
|
+
// };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Tinker.d.ts","sourceRoot":"","sources":["../../../../framework/lib/Command-Line/NodeTinker/Tinker.ts"],"names":[],"mappings":"AACA,qBAAa,UAAU;IACrB,OAAO,CAAC,KAAK,CAA+C;IAE5D,QAAQ;IAER;;;;OAIG;IACH,OAAO,CAAC,cAAc;IAItB;;;;OAIG;IACH,OAAO,CAAC,cAAc;
|
|
1
|
+
{"version":3,"file":"Tinker.d.ts","sourceRoot":"","sources":["../../../../framework/lib/Command-Line/NodeTinker/Tinker.ts"],"names":[],"mappings":"AACA,qBAAa,UAAU;IACrB,OAAO,CAAC,KAAK,CAA+C;IAE5D,QAAQ;IAER;;;;OAIG;IACH,OAAO,CAAC,cAAc;IAItB;;;;OAIG;IACH,OAAO,CAAC,cAAc;cAeN,cAAc,CAAC,KAAK,EAAE,MAAM;CAuB7C"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TinkerCommand.d.ts","sourceRoot":"","sources":["../../../../framework/lib/Command-Line/NodeTinker/TinkerCommand.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;
|
|
1
|
+
{"version":3,"file":"TinkerCommand.d.ts","sourceRoot":"","sources":["../../../../framework/lib/Command-Line/NodeTinker/TinkerCommand.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AAGtC,qBAAa,aAAc,SAAQ,UAAU;YAC7B,UAAU;IAajB,YAAY;CAuBpB"}
|
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
2
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
6
|
exports.TinkerCommand = void 0;
|
|
4
7
|
const Tinker_1 = require("./Tinker");
|
|
8
|
+
const readline_1 = __importDefault(require("readline"));
|
|
5
9
|
class TinkerCommand extends Tinker_1.TinkerNode {
|
|
6
10
|
async getCommand(command) {
|
|
7
11
|
switch (command) {
|
|
@@ -13,5 +17,26 @@ class TinkerCommand extends Tinker_1.TinkerNode {
|
|
|
13
17
|
return this.extractCommand(command);
|
|
14
18
|
}
|
|
15
19
|
}
|
|
20
|
+
consoleInput() {
|
|
21
|
+
const rl = readline_1.default.createInterface({
|
|
22
|
+
input: process.stdin,
|
|
23
|
+
output: process.stdout,
|
|
24
|
+
prompt: "> ",
|
|
25
|
+
});
|
|
26
|
+
rl.prompt();
|
|
27
|
+
rl.on("line", (inputLine) => {
|
|
28
|
+
const [command, ...args] = inputLine.trim().split(" ");
|
|
29
|
+
// const tc = new TinkerCommand();
|
|
30
|
+
this.getCommand(command)
|
|
31
|
+
.then((res) => console.log(res))
|
|
32
|
+
.catch((err) => console.log(err));
|
|
33
|
+
return rl.prompt();
|
|
34
|
+
});
|
|
35
|
+
rl.on("close", () => {
|
|
36
|
+
console.log("Goodbye, Have a nice day.");
|
|
37
|
+
process.exit(0);
|
|
38
|
+
});
|
|
39
|
+
return;
|
|
40
|
+
}
|
|
16
41
|
}
|
|
17
42
|
exports.TinkerCommand = TinkerCommand;
|
|
@@ -28,7 +28,7 @@ class Command {
|
|
|
28
28
|
}
|
|
29
29
|
if (modelName && typeof modelName === "string") {
|
|
30
30
|
// If model name is provided, create a resource controller
|
|
31
|
-
fs_1.default.writeFileSync(`${webControllerPath}/${controllerName}
|
|
31
|
+
fs_1.default.writeFileSync(`${webControllerPath}/${controllerName}`, (0, ResourcesController_1.default)(controllerName, modelName));
|
|
32
32
|
return console.log(`${controllerName} added successfully`.green); // Log success message
|
|
33
33
|
}
|
|
34
34
|
fs_1.default.writeFileSync(`${webControllerPath}/${controllerName}.ts`, (0, Controller_1.default)(controllerName));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Migration.d.ts","sourceRoot":"","sources":["../../../../framework/lib/Command-Line/files/Migration.ts"],"names":[],"mappings":"AA2BA;;;;;;;GAOG;AACH,QAAA,MAAM,eAAe,UACZ,MAAM,iBACE,MAAM,iBACN,MAAM,KACpB,
|
|
1
|
+
{"version":3,"file":"Migration.d.ts","sourceRoot":"","sources":["../../../../framework/lib/Command-Line/files/Migration.ts"],"names":[],"mappings":"AA2BA;;;;;;;GAOG;AACH,QAAA,MAAM,eAAe,UACZ,MAAM,iBACE,MAAM,iBACN,MAAM,KACpB,MA0BF,CAAC;AAEF,eAAe,eAAe,CAAC"}
|
|
@@ -11,8 +11,8 @@ const inflection_1 = require("inflection");
|
|
|
11
11
|
const generateDownMigration = (action, tableName) => {
|
|
12
12
|
if (action === "create") {
|
|
13
13
|
return `
|
|
14
|
-
|
|
15
|
-
return
|
|
14
|
+
down(){
|
|
15
|
+
return Schema.dropTable("${tableName}");
|
|
16
16
|
}
|
|
17
17
|
`;
|
|
18
18
|
}
|
|
@@ -37,14 +37,15 @@ const createMigration = (table, migrationName, optionalTable) => {
|
|
|
37
37
|
const getActionType = migrationName.split(/\_/g)[0] || "";
|
|
38
38
|
const schemaAction = getActionType.trim().toLowerCase() == "create" ? "create" : "table";
|
|
39
39
|
//optionalTable if user specify --table=users
|
|
40
|
+
const addDefaultColumns = () => `table.id();
|
|
41
|
+
table.timestamps();
|
|
42
|
+
table.softDeletes();`;
|
|
40
43
|
const tableName = schemaAction === "create" ? (0, inflection_1.pluralize)(table) : (0, inflection_1.pluralize)(optionalTable);
|
|
41
44
|
return `import {Schema} from "jcc-eloquent";
|
|
42
45
|
export class Migration {
|
|
43
46
|
up() {
|
|
44
47
|
return Schema.${schemaAction}("${tableName}", (table) => {
|
|
45
|
-
|
|
46
|
-
table.timestamps();
|
|
47
|
-
table.softDeletes();
|
|
48
|
+
${schemaAction === "create" ? addDefaultColumns() : ""}
|
|
48
49
|
});
|
|
49
50
|
}
|
|
50
51
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Request.d.ts","sourceRoot":"","sources":["../../../../framework/lib/Command-Line/files/Request.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,QAAA,MAAM,aAAa,aAAc,MAAM,KAAG,
|
|
1
|
+
{"version":3,"file":"Request.d.ts","sourceRoot":"","sources":["../../../../framework/lib/Command-Line/files/Request.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,QAAA,MAAM,aAAa,aAAc,MAAM,KAAG,MAyBzC,CAAC;AAEF,eAAe,aAAa,CAAC"}
|
|
@@ -7,7 +7,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
7
7
|
*/
|
|
8
8
|
const createRequest = (fileName) => {
|
|
9
9
|
return `
|
|
10
|
-
import {
|
|
10
|
+
import { FormRequest } from "jcc-express-mvc/FormRequest";
|
|
11
|
+
import {Request} from "jcc-express-mvc/http"
|
|
11
12
|
|
|
12
13
|
export class ${fileName} extends FormRequest {
|
|
13
14
|
constructor(req:Request) {
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import "reflect-metadata";
|
|
2
2
|
export declare function Inject(serviceName?: string): ParameterDecorator;
|
|
3
3
|
export declare function Injectable(singleton?: boolean): ClassDecorator;
|
|
4
|
+
export declare const app: import("../Services/ServiceContainer").ServiceContainer;
|
|
4
5
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../framework/lib/Dependancy/index.ts"],"names":[],"mappings":"AACA,OAAO,kBAAkB,CAAC;AAG1B,wBAAgB,MAAM,CAAC,WAAW,CAAC,EAAE,MAAM,GAAG,kBAAkB,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../framework/lib/Dependancy/index.ts"],"names":[],"mappings":"AACA,OAAO,kBAAkB,CAAC;AAG1B,wBAAgB,MAAM,CAAC,WAAW,CAAC,EAAE,MAAM,GAAG,kBAAkB,CAY/D;AAED,wBAAgB,UAAU,CAAC,SAAS,GAAE,OAAe,GAAG,cAAc,CAOrE;AAED,eAAO,MAAM,GAAG,yDAAyB,CAAC"}
|
package/lib/Dependancy/index.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.app = void 0;
|
|
3
4
|
exports.Inject = Inject;
|
|
4
5
|
exports.Injectable = Injectable;
|
|
5
6
|
const App_1 = require("../App");
|
|
@@ -8,9 +9,7 @@ require("reflect-metadata");
|
|
|
8
9
|
function Inject(serviceName) {
|
|
9
10
|
return (target, propertyKey, parameterIndex) => {
|
|
10
11
|
const existingInjectedParameters = Reflect.getMetadata("inject_params", target) || [];
|
|
11
|
-
// Add the new injection metadata (index ensures correct parameter order)
|
|
12
12
|
existingInjectedParameters[parameterIndex] = { serviceName };
|
|
13
|
-
// Define the metadata again, ensuring the parameters are in correct order
|
|
14
13
|
Reflect.defineMetadata("inject_params", existingInjectedParameters, target);
|
|
15
14
|
};
|
|
16
15
|
}
|
|
@@ -22,3 +21,4 @@ function Injectable(singleton = false) {
|
|
|
22
21
|
: container.bind(target.name, () => new target());
|
|
23
22
|
};
|
|
24
23
|
}
|
|
24
|
+
exports.app = App_1.app.container;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AppErrorHandler.d.ts","sourceRoot":"","sources":["../../../framework/lib/Error/AppErrorHandler.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAMtC,qBAAa,eAAe;IAC1B,OAAO,CAAC,GAAG,CAAc;gBACb,GAAG,EAAE,WAAW;IAI5B;;;;OAIG;IACI,MAAM,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO;IAI5B,kBAAkB;IAMzB,OAAO,CAAC,gBAAgB;
|
|
1
|
+
{"version":3,"file":"AppErrorHandler.d.ts","sourceRoot":"","sources":["../../../framework/lib/Error/AppErrorHandler.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAMtC,qBAAa,eAAe;IAC1B,OAAO,CAAC,GAAG,CAAc;gBACb,GAAG,EAAE,WAAW;IAI5B;;;;OAIG;IACI,MAAM,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO;IAI5B,kBAAkB;IAMzB,OAAO,CAAC,gBAAgB;IAyBxB,OAAO,CAAC,GAAG,EAAE,GAAG;CAwBjB"}
|
|
@@ -33,7 +33,6 @@ class AppErrorHandler {
|
|
|
33
33
|
const currentError = stackArray[index];
|
|
34
34
|
const parts = currentError.split(/\s/g);
|
|
35
35
|
const errorPath = parts[parts.length - 1];
|
|
36
|
-
console.log(errorPath);
|
|
37
36
|
if (index >= 5) {
|
|
38
37
|
return "Internal server error";
|
|
39
38
|
}
|
|
@@ -45,32 +44,22 @@ class AppErrorHandler {
|
|
|
45
44
|
handler(app) {
|
|
46
45
|
app.use((err, req, res, next) => {
|
|
47
46
|
let error = { ...err };
|
|
48
|
-
let statusCode = 0;
|
|
49
47
|
if (err.type === error_1.VALIDATION_ERROR) {
|
|
50
48
|
error.message = err.message;
|
|
51
49
|
// console.log("object");
|
|
52
50
|
return res.status(400).redirectBack();
|
|
53
51
|
}
|
|
54
52
|
if (err.type === error_1.API_VALIDATION_ERROR) {
|
|
55
|
-
return res.json({
|
|
53
|
+
return res.status(400).json({ errors: err.message });
|
|
56
54
|
}
|
|
57
55
|
if (err.error_action === "database") {
|
|
58
56
|
const errArray = err.stack?.split(/\n/g) || [];
|
|
59
57
|
const errorPath = this.extractErrorPath(errArray);
|
|
60
58
|
return DisplayErrorCode_1.DisplayError.show(errorPath, err.message, res);
|
|
61
59
|
}
|
|
62
|
-
// if (err.error_action === "app_error") {
|
|
63
60
|
const errArray = err.stack?.split(/\n/g) || [];
|
|
64
61
|
const errorPath = this.extractErrorPath(errArray, true);
|
|
65
62
|
return DisplayErrorCode_1.DisplayError.show(errorPath, err.message, res);
|
|
66
|
-
// }
|
|
67
|
-
return res
|
|
68
|
-
.json({
|
|
69
|
-
message: err.message,
|
|
70
|
-
stack: err.stack,
|
|
71
|
-
// type: err.type,
|
|
72
|
-
})
|
|
73
|
-
.status(statusCode || 500);
|
|
74
63
|
});
|
|
75
64
|
}
|
|
76
65
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DisplayErrorCode.d.ts","sourceRoot":"","sources":["../../../framework/lib/Error/DisplayErrorCode.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AAErD,qBAAa,YAAa,SAAQ,gBAAgB;IAChD;;;;;;OAMG;IACH,MAAM,CAAC,IAAI,CAAC,SAAS,EAAE,MAAM,EAAE,OAAO,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG;IAyBrD;;;;;;;OAOG;IACH,MAAM,CAAC,UAAU,CAAC,GAAG,EAAE,GAAG,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,GAAG,EAAE,OAAO,EAAE,GAAG;
|
|
1
|
+
{"version":3,"file":"DisplayErrorCode.d.ts","sourceRoot":"","sources":["../../../framework/lib/Error/DisplayErrorCode.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AAErD,qBAAa,YAAa,SAAQ,gBAAgB;IAChD;;;;;;OAMG;IACH,MAAM,CAAC,IAAI,CAAC,SAAS,EAAE,MAAM,EAAE,OAAO,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG;IAyBrD;;;;;;;OAOG;IACH,MAAM,CAAC,UAAU,CAAC,GAAG,EAAE,GAAG,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,GAAG,EAAE,OAAO,EAAE,GAAG;CAMlE"}
|
|
@@ -42,7 +42,9 @@ class DisplayError extends ErrorHightLight_1.ErrorHighLighter {
|
|
|
42
42
|
*/
|
|
43
43
|
static renderHtml(res, code, line, message) {
|
|
44
44
|
this.compileCodeToFile(code, line, message);
|
|
45
|
-
return res
|
|
45
|
+
return res
|
|
46
|
+
.status(500)
|
|
47
|
+
.sendFile(path_1.default.join(__dirname, "public", "error.html"));
|
|
46
48
|
}
|
|
47
49
|
}
|
|
48
50
|
exports.DisplayError = DisplayError;
|
|
@@ -14,31 +14,66 @@
|
|
|
14
14
|
<body class="">
|
|
15
15
|
<div class="code-container">
|
|
16
16
|
<div class="error-message">
|
|
17
|
-
|
|
17
|
+
Unknown column 'category' in 'where clause'
|
|
18
|
+
SELECT * FROM products WHERE category = 1
|
|
19
|
+
SELECT * FROM products WHERE category = 1 <p> /home/abdou/Documents/GAMBTECH/FRAMEWORK/jcc/app/Http/Controllers/UsersController.ts 17:17 </p>
|
|
18
20
|
</div>
|
|
19
21
|
<div class="container">
|
|
20
22
|
<pre
|
|
21
|
-
data-line="
|
|
23
|
+
data-line="17"
|
|
22
24
|
class="line-numbers"
|
|
23
|
-
><code class="language-javascript">1. import {
|
|
24
|
-
2. import {
|
|
25
|
-
3.
|
|
26
|
-
4.
|
|
27
|
-
5.
|
|
28
|
-
6.
|
|
29
|
-
7.
|
|
30
|
-
8.
|
|
31
|
-
9.
|
|
32
|
-
10.
|
|
33
|
-
11.
|
|
34
|
-
12.
|
|
35
|
-
13.
|
|
36
|
-
14.
|
|
37
|
-
15.
|
|
38
|
-
16.
|
|
39
|
-
17.
|
|
40
|
-
18.
|
|
41
|
-
19.
|
|
25
|
+
><code class="language-javascript">1. import { Request, Response, Next, bcrypt, Auth } from "@framework/index";
|
|
26
|
+
2. import { Inject } from "@framework/Dependency";
|
|
27
|
+
3. import { User } from "@/Model/User";
|
|
28
|
+
4. import { Calculator } from "@/Services/Calculator";
|
|
29
|
+
5. import { CategoryService } from "@/Services/CategorySercvice";
|
|
30
|
+
6.
|
|
31
|
+
7. // import { User } from "../../Models/User";
|
|
32
|
+
8. export class UsersController {
|
|
33
|
+
9. //
|
|
34
|
+
10. // private calculator: any;
|
|
35
|
+
11. constructor(
|
|
36
|
+
12. @Inject("Calculator") private calculator: Calculator,
|
|
37
|
+
13. @Inject("CategoryService") private cat: CategoryService,
|
|
38
|
+
14. ) {}
|
|
39
|
+
15.
|
|
40
|
+
16. async index(req: Request, res: Response, next: Next) {
|
|
41
|
+
17. console.log(await this.cat.all());
|
|
42
|
+
18. return res.json({
|
|
43
|
+
19. message: this.calculator.add(1, 4), //await User.first(),
|
|
44
|
+
20. });
|
|
45
|
+
21. }
|
|
46
|
+
22.
|
|
47
|
+
23. //
|
|
48
|
+
24.
|
|
49
|
+
25. async store(req: Request, res: Response, next: Next) {
|
|
50
|
+
26. await req.apiValidate({
|
|
51
|
+
27. name: ["required"],
|
|
52
|
+
28. email: ["required", "unique:users"],
|
|
53
|
+
29. password: ["required", "min:6"],
|
|
54
|
+
30. });
|
|
55
|
+
31.
|
|
56
|
+
32. // const save = await User.create({
|
|
57
|
+
33. // name: req.body.name,
|
|
58
|
+
34. // email: req.body.email,
|
|
59
|
+
35. // password: await bcrypt(req.body.password),
|
|
60
|
+
36. // });
|
|
61
|
+
37.
|
|
62
|
+
38. // return save
|
|
63
|
+
39. // ? Auth.attempt(req, res, next)
|
|
64
|
+
40. // :
|
|
65
|
+
41. return res.json({ message: "Invalid credentials" });
|
|
66
|
+
42. }
|
|
67
|
+
43.
|
|
68
|
+
44. //
|
|
69
|
+
45.
|
|
70
|
+
46. async show(req: Request, res: Response, next: Next) {
|
|
71
|
+
47. return res.json({
|
|
72
|
+
48. message: await User.find(req.params.id),
|
|
73
|
+
49. });
|
|
74
|
+
50. }
|
|
75
|
+
51. }
|
|
76
|
+
52. </code></pre>
|
|
42
77
|
</div>
|
|
43
78
|
</div>
|
|
44
79
|
<script src="/js/app-error-prism.js"> </script>
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../framework/lib/Middlewares/index.ts"],"names":[],"mappings":"AAAA,OAAO,OAAO,EAAE,EAAE,WAAW,EAAkB,MAAM,SAAS,CAAC;AAW/D,QAAA,MAAQ,MAAM,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../framework/lib/Middlewares/index.ts"],"names":[],"mappings":"AAAA,OAAO,OAAO,EAAE,EAAE,WAAW,EAAkB,MAAM,SAAS,CAAC;AAW/D,QAAA,MAAQ,MAAM,KAAmD,CAAC;AAKlE,qBAAa,UAAW,SAAQ,MAAM;IAEpC,OAAO,CAAC,GAAG,CAAc;IACzB,OAAO,CAAC,OAAO,CAAiB;gBACpB,UAAU,EAAE,OAAO,OAAO,EAAE,GAAG,EAAE,WAAW;IAOxD;;;OAGG;IACH,OAAO,CAAC,iBAAiB;IAKzB;;;OAGG;IACH,OAAO,CAAC,WAAW;IAUnB;;;OAGG;IAOH;;;;OAIG;IACH,OAAO,CAAC,uBAAuB;IAM/B;;;OAGG;IACH,OAAO,CAAC,kBAAkB;IAO1B;;;OAGG;IACH,OAAO,CAAC,iBAAiB;IAMzB;;;OAGG;IACH,OAAO,CAAC,SAAS;IAejB,OAAO,CAAC,MAAM;CAef"}
|
package/lib/Middlewares/index.js
CHANGED
|
@@ -13,8 +13,8 @@ const Response_1 = require("../Response");
|
|
|
13
13
|
const request_1 = require("../Request/request");
|
|
14
14
|
const Constants_1 = require("../Error/Constants");
|
|
15
15
|
const path_1 = __importDefault(require("path"));
|
|
16
|
-
const { Kernel } = require(`${app_root_path_1.default.path}/app/Http/kernel
|
|
17
|
-
const { templateEngine } = require(`${app_root_path_1.default.path}/app/Config/engine
|
|
16
|
+
const { Kernel } = require(`${app_root_path_1.default.path}/app/Http/kernel`);
|
|
17
|
+
const { templateEngine } = require(`${app_root_path_1.default.path}/app/Config/engine`);
|
|
18
18
|
const config_1 = require("../Passport/config");
|
|
19
19
|
//
|
|
20
20
|
class Middleware extends Kernel {
|
package/lib/Passport/config.js
CHANGED
|
@@ -9,7 +9,7 @@ const LocalStrategy = passport_local_1.default.Strategy;
|
|
|
9
9
|
const util_1 = require("../util");
|
|
10
10
|
const AppError_1 = require("../Error/AppError");
|
|
11
11
|
const error_1 = require("../Error/Constants/error");
|
|
12
|
-
const { User } = (0, util_1.getModel)("User
|
|
12
|
+
const { User } = (0, util_1.getModel)("User");
|
|
13
13
|
class PassportAuth {
|
|
14
14
|
/**
|
|
15
15
|
* Configures Passport.js to use a local authentication strategy.
|
|
@@ -30,9 +30,9 @@ export declare class RouteBuilder {
|
|
|
30
30
|
static setMiddle(middleware?: Array<any> | ExpressCallback): void;
|
|
31
31
|
/**
|
|
32
32
|
* Sets the controller for the route group.
|
|
33
|
-
* @param {object}
|
|
33
|
+
* @param {object} Controller - The controller object.
|
|
34
34
|
*/
|
|
35
|
-
static setController(
|
|
35
|
+
static setController(Controller: any, appContainer?: any): void;
|
|
36
36
|
validateCallback(callback: RequestHandler | Array<any>): RequestHandler;
|
|
37
37
|
hasController(): boolean;
|
|
38
38
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RouteBuilder.d.ts","sourceRoot":"","sources":["../../../framework/lib/Routes/RouteBuilder.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AACtD,OAAO,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAC/C,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAQlC,qBAAa,YAAY;IACvB,OAAO,CAAC,GAAG,CAAc;IACzB,OAAO,CAAC,SAAS,CAAC,CAAS;IAC3B,OAAO,CAAC,QAAQ,CAAS;IACzB,OAAO,CAAC,gBAAgB,CAAM;IAC9B,OAAO,CAAC,MAAM,CAAC,UAAU,CAAM;IAE/B,OAAO,CAAC,MAAM,CAAC,UAAU,CAA+B;gBAEtD,GAAG,EAAE,WAAW,EAChB,OAAO,EAAE,OAAO;IAUlB;;;;OAIG;IACH,SAAS,CAAC,WAAW,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM;IAM3C;;;;;;OAMG;IACH,OAAO,CAAC,sBAAsB;IAK9B;;;OAGG;WACW,SAAS,CAAC,UAAU,GAAE,KAAK,CAAC,GAAG,CAAC,GAAG,eAAoB;IAIrE;;;OAGG;WACW,aAAa,CAAC,UAAU,EAAE,GAAG;
|
|
1
|
+
{"version":3,"file":"RouteBuilder.d.ts","sourceRoot":"","sources":["../../../framework/lib/Routes/RouteBuilder.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AACtD,OAAO,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAC/C,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAQlC,qBAAa,YAAY;IACvB,OAAO,CAAC,GAAG,CAAc;IACzB,OAAO,CAAC,SAAS,CAAC,CAAS;IAC3B,OAAO,CAAC,QAAQ,CAAS;IACzB,OAAO,CAAC,gBAAgB,CAAM;IAC9B,OAAO,CAAC,MAAM,CAAC,UAAU,CAAM;IAE/B,OAAO,CAAC,MAAM,CAAC,UAAU,CAA+B;gBAEtD,GAAG,EAAE,WAAW,EAChB,OAAO,EAAE,OAAO;IAUlB;;;;OAIG;IACH,SAAS,CAAC,WAAW,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM;IAM3C;;;;;;OAMG;IACH,OAAO,CAAC,sBAAsB;IAK9B;;;OAGG;WACW,SAAS,CAAC,UAAU,GAAE,KAAK,CAAC,GAAG,CAAC,GAAG,eAAoB;IAIrE;;;OAGG;WACW,aAAa,CAAC,UAAU,EAAE,GAAG,EAAE,YAAY,CAAC,EAAE,GAAG;IAM/D,gBAAgB,CAAC,QAAQ,EAAE,cAAc,GAAG,KAAK,CAAC,GAAG,CAAC,GAAG,cAAc;IAevE,aAAa,IAAI,OAAO;IAMxB;;;;;OAKG;IACH,OAAO,CAAC,WAAW;IAaZ,UAAU,CAAC,CAAC,EACjB,UAAU,EAAE,MAAM,WAAW,EAC7B,GAAG,EAAE,MAAM,EACX,QAAQ,EAAE,cAAc,GAAG,MAAM,GAAG,KAAK,CAAC,GAAG,CAAC;IAazC,iBAAiB,CAAC,CAAC,EAAE,UAAU,EAAE,KAAK,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,CAAC,GAAG,CAAC;IAIrE,OAAO,CAAC,cAAc;CAuBvB"}
|
|
@@ -42,17 +42,18 @@ class RouteBuilder {
|
|
|
42
42
|
}
|
|
43
43
|
/**
|
|
44
44
|
* Sets the controller for the route group.
|
|
45
|
-
* @param {object}
|
|
45
|
+
* @param {object} Controller - The controller object.
|
|
46
46
|
*/
|
|
47
|
-
static setController(
|
|
48
|
-
|
|
47
|
+
static setController(Controller, appContainer) {
|
|
48
|
+
appContainer.singleton(Controller.name, () => new Controller());
|
|
49
|
+
this.controller = Controller;
|
|
49
50
|
}
|
|
50
51
|
validateCallback(callback) {
|
|
51
52
|
if (Array.isArray(callback)) {
|
|
52
53
|
if (callback.length == 2) {
|
|
53
54
|
const [Controller, method] = callback;
|
|
54
|
-
const instance =
|
|
55
|
-
return instance[method];
|
|
55
|
+
const instance = this.resolveController(Controller);
|
|
56
|
+
return instance[method].bind(instance);
|
|
56
57
|
}
|
|
57
58
|
throw new AppError_1.AppError(`Method not define ${callback[0]}`, error_1.ROUTE_CALLBACK_ERROR);
|
|
58
59
|
}
|
|
@@ -87,9 +88,8 @@ class RouteBuilder {
|
|
|
87
88
|
resolveHandler(callback) {
|
|
88
89
|
if (this.hasController() && typeof callback === "string") {
|
|
89
90
|
const Controller = RouteBuilder.controller;
|
|
90
|
-
this.serviceContainer.
|
|
91
|
+
// this.serviceContainer.singleton(Controller.name, () => new Controller());
|
|
91
92
|
const instance = this.resolveController(Controller);
|
|
92
|
-
// console.log(instance);
|
|
93
93
|
//new Controller();
|
|
94
94
|
// Ensure the method exists on the instance
|
|
95
95
|
if (typeof instance[callback] !== "function") {
|
package/lib/Routes/Router.js
CHANGED
|
@@ -16,7 +16,7 @@ class Router {
|
|
|
16
16
|
* @returns {Routes} - Returns the Routes instance.
|
|
17
17
|
*/
|
|
18
18
|
controller(controller) {
|
|
19
|
-
RouteBuilder_1.RouteBuilder.setController(controller);
|
|
19
|
+
RouteBuilder_1.RouteBuilder.setController(controller, this.appPath.container);
|
|
20
20
|
return this;
|
|
21
21
|
}
|
|
22
22
|
/**
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Container } from "@framework/Container";
|
|
2
2
|
export declare abstract class ServiceProvider {
|
|
3
|
-
protected app:
|
|
3
|
+
protected app: Container;
|
|
4
4
|
protected bootingCallbacks: Array<any>;
|
|
5
5
|
protected bootedCallbacks: Array<any>;
|
|
6
6
|
static publishes: Array<any>;
|
|
7
7
|
static publishGroups: Array<any>;
|
|
8
|
-
constructor(app:
|
|
8
|
+
constructor(app: Container);
|
|
9
9
|
register(): void;
|
|
10
10
|
boot(): void;
|
|
11
11
|
booting(callback: any): void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ServiceProvider.d.ts","sourceRoot":"","sources":["../../../framework/lib/Services/ServiceProvider.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"ServiceProvider.d.ts","sourceRoot":"","sources":["../../../framework/lib/Services/ServiceProvider.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AAEjD,8BAAsB,eAAe;IAEnC,SAAS,CAAC,GAAG,EAAE,SAAS,CAAC;IAEzB,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,SAAS;IAInB,QAAQ,IAAI,IAAI;IAEhB,IAAI,IAAI,IAAI;IAEZ,OAAO,CAAC,QAAQ,EAAE,GAAG,GAAG,IAAI;IAI5B,MAAM,CAAC,QAAQ,EAAE,GAAG,GAAG,IAAI;IAI3B,oBAAoB,IAAI,IAAI;IAM5B,mBAAmB,IAAI,IAAI;CAKnC"}
|
package/lib/util/index.d.ts
CHANGED
|
@@ -96,4 +96,11 @@ export declare const capitalize: (str: string) => string;
|
|
|
96
96
|
export declare const asyncHandler: (func: any) => any;
|
|
97
97
|
export declare const getModelFile: (modelName: string) => string;
|
|
98
98
|
export declare const cloudinaryUpload: (path: string) => any;
|
|
99
|
+
/**
|
|
100
|
+
* Pluralizes a string.
|
|
101
|
+
*
|
|
102
|
+
* @param {string} str - The string to pluralize.
|
|
103
|
+
* @returns {string} The pluralized string.
|
|
104
|
+
*/
|
|
105
|
+
export declare const pluralizeStr: (str: string) => string;
|
|
99
106
|
//# sourceMappingURL=index.d.ts.map
|
package/lib/util/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../framework/lib/util/index.ts"],"names":[],"mappings":"AAeA;;;;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,MAAM,QAAQ,SAAU,MAAM,KAAG,GACM,CAAC;AAE/C;;;;GAIG;AACH,eAAO,MAAM,aAAa,SAAU,MAAM,KAAG,GACW,CAAC;AAEzD;;;;GAIG;AACH,eAAO,MAAM,UAAU,SAAU,MAAM,KAAG,GACW,CAAC;AAEtD;;;;GAIG;AACH,eAAO,MAAM,QAAQ,SAAU,MAAM,KAAG,GAEvC,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,YAAY,QAAO,KAAK,CAAC,GAAG,CAGxC,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,MAAM,QAAe,MAAM,KAAG,OAAO,CAAC,MAAM,CAGxD,CAAC;AAEF;;;;;GAKG;AACH,eAAO,MAAM,UAAU,WACb,MAAM,QACR,MAAM,KACX,OAAO,CAAC,OAAO,CAEjB,CAAC;AAEF;;;;GAIG;AAEH,eAAO,MAAM,OAAO,SAAU,MAAM,KAAG,MAAM,GAAG,GAM/C,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,SAAS,UAAW,MAAM,KAAG,MAAM,GAAG,GAMlD,CAAC;AAEF;;;;;;GAMG;AACH,eAAO,MAAM,SAAS,QACf,GAAG,aACG,MAAM,WACT,MAAM,WAgBf,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,UAAU,QAAS,MAAM,KAAG,MAExC,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,YAAY,SAChB,GAAG,KAAG,GAEsC,CAAC;AAEtD,eAAO,MAAM,YAAY,cAAe,MAAM,KAAG,MAEhD,CAAC;AAEF,eAAO,MAAM,gBAAgB,SAAU,MAAM,KAAG,GAe5C,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../framework/lib/util/index.ts"],"names":[],"mappings":"AAeA;;;;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,MAAM,QAAQ,SAAU,MAAM,KAAG,GACM,CAAC;AAE/C;;;;GAIG;AACH,eAAO,MAAM,aAAa,SAAU,MAAM,KAAG,GACW,CAAC;AAEzD;;;;GAIG;AACH,eAAO,MAAM,UAAU,SAAU,MAAM,KAAG,GACW,CAAC;AAEtD;;;;GAIG;AACH,eAAO,MAAM,QAAQ,SAAU,MAAM,KAAG,GAEvC,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,YAAY,QAAO,KAAK,CAAC,GAAG,CAGxC,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,MAAM,QAAe,MAAM,KAAG,OAAO,CAAC,MAAM,CAGxD,CAAC;AAEF;;;;;GAKG;AACH,eAAO,MAAM,UAAU,WACb,MAAM,QACR,MAAM,KACX,OAAO,CAAC,OAAO,CAEjB,CAAC;AAEF;;;;GAIG;AAEH,eAAO,MAAM,OAAO,SAAU,MAAM,KAAG,MAAM,GAAG,GAM/C,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,SAAS,UAAW,MAAM,KAAG,MAAM,GAAG,GAMlD,CAAC;AAEF;;;;;;GAMG;AACH,eAAO,MAAM,SAAS,QACf,GAAG,aACG,MAAM,WACT,MAAM,WAgBf,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,UAAU,QAAS,MAAM,KAAG,MAExC,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,YAAY,SAChB,GAAG,KAAG,GAEsC,CAAC;AAEtD,eAAO,MAAM,YAAY,cAAe,MAAM,KAAG,MAEhD,CAAC;AAEF,eAAO,MAAM,gBAAgB,SAAU,MAAM,KAAG,GAe5C,CAAC;AAEL;;;;;GAKG;AACH,eAAO,MAAM,YAAY,QAAS,MAAM,KAAG,MAG1C,CAAC"}
|
package/lib/util/index.js
CHANGED
|
@@ -3,7 +3,7 @@ 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.cloudinaryUpload = exports.getModelFile = exports.asyncHandler = exports.capitalize = exports.saveImage = exports.jwtVerify = exports.jwtSign = exports.verifyHash = exports.bcrypt = exports.getProviders = exports.getRoute = exports.getRequest = exports.getMiddleware = exports.getModel = exports.getApiController = exports.getController = exports.loadRoutes = exports.rootPath = void 0;
|
|
6
|
+
exports.pluralizeStr = exports.cloudinaryUpload = exports.getModelFile = exports.asyncHandler = exports.capitalize = exports.saveImage = exports.jwtVerify = exports.jwtSign = exports.verifyHash = exports.bcrypt = exports.getProviders = exports.getRoute = exports.getRequest = exports.getMiddleware = exports.getModel = exports.getApiController = exports.getController = exports.loadRoutes = exports.rootPath = void 0;
|
|
7
7
|
const bcryptjs_1 = __importDefault(require("bcryptjs"));
|
|
8
8
|
const app_root_path_1 = __importDefault(require("app-root-path"));
|
|
9
9
|
const jsonwebtoken_1 = __importDefault(require("jsonwebtoken"));
|
|
@@ -27,8 +27,8 @@ exports.rootPath = rootPath;
|
|
|
27
27
|
* Function load all route files
|
|
28
28
|
*/
|
|
29
29
|
const loadRoutes = () => {
|
|
30
|
-
(0, exports.getRoute)("api
|
|
31
|
-
(0, exports.getRoute)("web
|
|
30
|
+
(0, exports.getRoute)("api");
|
|
31
|
+
(0, exports.getRoute)("web");
|
|
32
32
|
};
|
|
33
33
|
exports.loadRoutes = loadRoutes;
|
|
34
34
|
/**
|
|
@@ -80,7 +80,7 @@ exports.getRoute = getRoute;
|
|
|
80
80
|
* @returns {Array} - The route file .
|
|
81
81
|
*/
|
|
82
82
|
const getProviders = () => {
|
|
83
|
-
const getProvdiers = require(`${getRootPath}/app/Config/app
|
|
83
|
+
const getProvdiers = require(`${getRootPath}/app/Config/app`);
|
|
84
84
|
return [...getProvdiers["providers"]];
|
|
85
85
|
};
|
|
86
86
|
exports.getProviders = getProviders;
|
|
@@ -189,3 +189,14 @@ const cloudinaryUpload = (path) => new Promise((resolve, reject) => {
|
|
|
189
189
|
});
|
|
190
190
|
});
|
|
191
191
|
exports.cloudinaryUpload = cloudinaryUpload;
|
|
192
|
+
/**
|
|
193
|
+
* Pluralizes a string.
|
|
194
|
+
*
|
|
195
|
+
* @param {string} str - The string to pluralize.
|
|
196
|
+
* @returns {string} The pluralized string.
|
|
197
|
+
*/
|
|
198
|
+
const pluralizeStr = (str) => {
|
|
199
|
+
const newStr = str.split(/(?=[A-Z])/).join("_");
|
|
200
|
+
return (0, inflection_1.pluralize)(`${newStr}`.toLowerCase()); //pluralize(`${str}`.toLowerCase());
|
|
201
|
+
};
|
|
202
|
+
exports.pluralizeStr = pluralizeStr;
|
package/package.json
CHANGED
package/Interface.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"Interface.d.ts","sourceRoot":"","sources":["../framework/Interface.ts"],"names":[],"mappings":"AAEA,MAAM,WAAW,gBAAgB;IAC/B;;;;OAIG;IACH,IAAI,CAAC,CAAC,EAAE,GAAG,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,CAAC,GAAG,IAAI,CAAC;IAE9C;;;;OAIG;IACH,SAAS,CAAC,CAAC,EAAE,GAAG,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,CAAC,GAAG,IAAI,CAAC;IAEnD;;;;;OAKG;IACH,OAAO,CAAC,CAAC,EAAE,GAAG,EAAE,MAAM,GAAG,CAAC,CAAC;IAE3B;;;;;;;OAOG;IACH,IAAI,CAAC,CAAC,EAAE,MAAM,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,KAAK,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;IAE9C;;;;OAIG;IACH,GAAG,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;IAE1B;;;;OAIG;IACH,IAAI,CAAC,CAAC,EAAE,GAAG,EAAE,MAAM,GAAG,CAAC,CAAC;IAExB;;;;;OAKG;IACH,KAAK,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;CACzC"}
|
|
File without changes
|