jcc-express-mvc 1.3.13 → 1.3.15
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/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/Command-Line/MakeCommand.d.ts.map +1 -1
- package/lib/Command-Line/MakeCommand.js +19 -0
- package/lib/Command-Line/NodeArtisanCommand.d.ts.map +1 -1
- package/lib/Command-Line/NodeArtisanCommand.js +4 -0
- package/lib/Command-Line/buildCommand.d.ts +2 -0
- package/lib/Command-Line/buildCommand.d.ts.map +1 -0
- package/lib/Command-Line/buildCommand.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/Request.d.ts.map +1 -1
- package/lib/Command-Line/files/Request.js +2 -1
- package/lib/Command-Line/files/TsConfig.d.ts +2 -0
- package/lib/Command-Line/files/TsConfig.d.ts.map +1 -0
- package/lib/Command-Line/files/TsConfig.js +20 -0
- package/lib/Dependancy/index.d.ts.map +1 -1
- package/lib/Dependancy/index.js +0 -2
- 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/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;
|
|
@@ -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 +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":"AAKA,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;CAuBzE"}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.ConsoleKernel = void 0;
|
|
4
|
+
const buildCommand_1 = require("./buildCommand");
|
|
4
5
|
const DBCommand_1 = require("./DBCommand");
|
|
5
6
|
const MakeCommand_1 = require("./MakeCommand");
|
|
6
7
|
const MigrateCommand_1 = require("./MigrateCommand");
|
|
@@ -24,6 +25,9 @@ class ConsoleKernel {
|
|
|
24
25
|
case "make":
|
|
25
26
|
await (0, MakeCommand_1.makeCommand)(argvs);
|
|
26
27
|
return;
|
|
28
|
+
case "build":
|
|
29
|
+
(0, buildCommand_1.BuildCommand)();
|
|
30
|
+
return;
|
|
27
31
|
default:
|
|
28
32
|
console.log("Sorry command not found");
|
|
29
33
|
return;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"buildCommand.d.ts","sourceRoot":"","sources":["../../../framework/lib/Command-Line/buildCommand.ts"],"names":[],"mappings":"AAMA,eAAO,MAAM,YAAY,iBAWxB,CAAC"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.BuildCommand = void 0;
|
|
7
|
+
const TsConfig_1 = require("./files/TsConfig");
|
|
8
|
+
const fs_extra_1 = __importDefault(require("fs-extra"));
|
|
9
|
+
const colors_1 = __importDefault(require("colors"));
|
|
10
|
+
const fs_1 = __importDefault(require("fs"));
|
|
11
|
+
const app_root_path_1 = __importDefault(require("app-root-path"));
|
|
12
|
+
const BuildCommand = () => {
|
|
13
|
+
try {
|
|
14
|
+
fs_1.default.writeFileSync(`${app_root_path_1.default.path}/build/tsconfig.json`, (0, TsConfig_1.TsConfig)());
|
|
15
|
+
fs_extra_1.default.copySync("resources", "build/resources");
|
|
16
|
+
fs_extra_1.default.copySync("public", "build/public");
|
|
17
|
+
fs_extra_1.default.copyFileSync("package.json", "build/package.json");
|
|
18
|
+
console.log(colors_1.default.green(`App build successfully`));
|
|
19
|
+
return process.exit(0);
|
|
20
|
+
}
|
|
21
|
+
catch (error) {
|
|
22
|
+
console.log(error.message);
|
|
23
|
+
}
|
|
24
|
+
};
|
|
25
|
+
exports.BuildCommand = BuildCommand;
|
|
@@ -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":"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) {
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TsConfig.d.ts","sourceRoot":"","sources":["../../../../framework/lib/Command-Line/files/TsConfig.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,QAAQ,cAepB,CAAC"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.TsConfig = void 0;
|
|
4
|
+
const TsConfig = () => {
|
|
5
|
+
return `{
|
|
6
|
+
"compilerOptions": {
|
|
7
|
+
"baseUrl": ".",
|
|
8
|
+
"paths": {
|
|
9
|
+
"@/Model/*": ["app/Models/*"],
|
|
10
|
+
"@Controllers/*": ["app/Http/Controllers/*"],
|
|
11
|
+
"@/Request/*": ["app/Http/Requests/*"],
|
|
12
|
+
"@Providers/*": ["app/Providers/*"],
|
|
13
|
+
"@/Services/*": ["app/Services/*"],
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
`;
|
|
19
|
+
};
|
|
20
|
+
exports.TsConfig = TsConfig;
|
|
@@ -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
|
@@ -9,9 +9,7 @@ require("reflect-metadata");
|
|
|
9
9
|
function Inject(serviceName) {
|
|
10
10
|
return (target, propertyKey, parameterIndex) => {
|
|
11
11
|
const existingInjectedParameters = Reflect.getMetadata("inject_params", target) || [];
|
|
12
|
-
// Add the new injection metadata (index ensures correct parameter order)
|
|
13
12
|
existingInjectedParameters[parameterIndex] = { serviceName };
|
|
14
|
-
// Define the metadata again, ensuring the parameters are in correct order
|
|
15
13
|
Reflect.defineMetadata("inject_params", existingInjectedParameters, target);
|
|
16
14
|
};
|
|
17
15
|
}
|
|
@@ -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,cAA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;;;;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,QA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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
|