jcc-express-mvc 1.4.8 → 1.5.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/core/Queue.d.ts +2 -0
- package/core/Queue.d.ts.map +1 -0
- package/core/Queue.js +17 -0
- package/core/ServiceProvider.d.ts +2 -0
- package/core/ServiceProvider.d.ts.map +1 -0
- package/core/ServiceProvider.js +17 -0
- package/core/Str.d.ts +2 -0
- package/core/Str.d.ts.map +1 -0
- package/core/Str.js +17 -0
- package/lib/App.d.ts.map +1 -1
- package/lib/App.js +6 -4
- package/lib/Command-Line/NodeArtisanCommand.d.ts +1 -0
- package/lib/Command-Line/NodeArtisanCommand.d.ts.map +1 -1
- package/lib/Command-Line/NodeArtisanCommand.js +10 -0
- package/lib/Command-Line/NodeTinker/ConsoleInput.js +1 -1
- package/lib/Command-Line/RouteCommand.d.ts +7 -0
- package/lib/Command-Line/RouteCommand.d.ts.map +1 -0
- package/lib/Command-Line/RouteCommand.js +34 -0
- package/lib/Error/public/error.html +70 -69
- package/lib/HttpKernel/HttpKernel.d.ts +2 -2
- package/lib/HttpKernel/HttpKernel.d.ts.map +1 -1
- package/lib/Interface/index.d.ts +62 -5
- package/lib/Interface/index.d.ts.map +1 -1
- package/lib/Interface/index.js +0 -6
- package/lib/Middlewares/inertia.d.ts.map +1 -1
- package/lib/Middlewares/inertia.js +12 -2
- package/lib/Queue/DispatchEvent.d.ts +8 -0
- package/lib/Queue/DispatchEvent.d.ts.map +1 -0
- package/lib/Queue/DispatchEvent.js +21 -0
- package/lib/Queue/Job.d.ts +9 -0
- package/lib/Queue/Job.d.ts.map +1 -0
- package/lib/Queue/Job.js +50 -0
- package/lib/Queue/JobModel.d.ts +6 -0
- package/lib/Queue/JobModel.d.ts.map +1 -0
- package/lib/Queue/JobModel.js +11 -0
- package/lib/Queue/Queue.d.ts +9 -0
- package/lib/Queue/Queue.d.ts.map +1 -0
- package/lib/Queue/Queue.js +104 -0
- package/lib/Queue/type.d.ts +11 -0
- package/lib/Queue/type.d.ts.map +1 -0
- package/lib/Queue/type.js +2 -0
- package/lib/Request/FormRequest.d.ts +2 -2
- package/lib/Request/FormRequest.d.ts.map +1 -1
- package/lib/Request/FormRequest.js +2 -4
- package/lib/Routes/Route.d.ts +56 -0
- package/lib/Routes/Route.d.ts.map +1 -0
- package/lib/Routes/Route.js +113 -0
- package/lib/Routes/RouteBuilder.d.ts +9 -24
- package/lib/Routes/RouteBuilder.d.ts.map +1 -1
- package/lib/Routes/RouteBuilder.js +24 -89
- package/lib/Routes/Router.d.ts +11 -9
- package/lib/Routes/Router.d.ts.map +1 -1
- package/lib/Routes/Router.js +9 -8
- package/lib/Server/index.d.ts.map +1 -1
- package/lib/Server/index.js +3 -4
- package/lib/Services/ServiceContainer.d.ts +1 -1
- package/lib/Services/ServiceContainer.d.ts.map +1 -1
- package/lib/Services/ServiceContainer.js +3 -7
- package/lib/Templating-engine/engineHelper.d.ts.map +1 -1
- package/lib/Templating-engine/engineHelper.js +1 -24
- package/lib/Templating-engine/index.d.ts.map +1 -1
- package/lib/Templating-engine/index.js +1 -2
- package/lib/Type/index.d.ts +19 -3
- package/lib/Type/index.d.ts.map +1 -1
- package/lib/util/Str.d.ts +404 -0
- package/lib/util/Str.d.ts.map +1 -0
- package/lib/util/Str.js +576 -0
- package/lib/util/index.d.ts +2 -2
- package/lib/util/index.d.ts.map +1 -1
- package/lib/util/index.js +9 -4
- package/package.json +1 -1
package/core/Queue.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Queue.d.ts","sourceRoot":"","sources":["../../framework/core/Queue.ts"],"names":[],"mappings":"AAAA,cAAc,oBAAoB,CAAC"}
|
package/core/Queue.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/Queue/Queue"), exports);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ServiceProvider.d.ts","sourceRoot":"","sources":["../../framework/core/ServiceProvider.ts"],"names":[],"mappings":"AAAA,cAAc,iCAAiC,CAAC"}
|
|
@@ -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/Services/ServiceProvider"), exports);
|
package/core/Str.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Str.d.ts","sourceRoot":"","sources":["../../framework/core/Str.ts"],"names":[],"mappings":"AAAA,cAAc,iBAAiB,CAAC"}
|
package/core/Str.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/util/Str"), exports);
|
package/lib/App.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"App.d.ts","sourceRoot":"","sources":["../../framework/lib/App.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAC;AAGzC,OAAO,EAAE,SAAS,EAAE,MAAM,UAAU,CAAC;AAGrC,OAAO,EAAE,gBAAgB,EAAE,MAAM,6BAA6B,CAAC;
|
|
1
|
+
{"version":3,"file":"App.d.ts","sourceRoot":"","sources":["../../framework/lib/App.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAC;AAGzC,OAAO,EAAE,SAAS,EAAE,MAAM,UAAU,CAAC;AAGrC,OAAO,EAAE,gBAAgB,EAAE,MAAM,6BAA6B,CAAC;AAI/D,cAAM,GAAI,SAAQ,SAAS;IAGlB,SAAS,mBAA0B;;IAS1C,OAAO,CAAC,iBAAiB;IAQlB,SAAS,IAAI,MAAM,CAAC,GAAG,CAAC;IAW/B;;;OAGG;IACI,SAAS,IAAI,MAAM,CAAC,GAAG,CAAC;IAW/B;;;OAGG;IACI,UAAU,IAAI,GAAG;CAkBzB;AAED,eAAO,MAAM,GAAG,KAAY,CAAC"}
|
package/lib/App.js
CHANGED
|
@@ -8,6 +8,7 @@ const Server_1 = require("./Server");
|
|
|
8
8
|
const util_1 = require("./util");
|
|
9
9
|
const Constants_1 = require("./Error/Constants");
|
|
10
10
|
const ServiceContainer_1 = require("./Services/ServiceContainer");
|
|
11
|
+
const RouteBuilder_1 = require("./Routes/RouteBuilder");
|
|
11
12
|
class App extends Server_1.HttpSever {
|
|
12
13
|
constructor() {
|
|
13
14
|
super();
|
|
@@ -28,8 +29,7 @@ class App extends Server_1.HttpSever {
|
|
|
28
29
|
return new Router_1.Router(this.app, {
|
|
29
30
|
prefixUrl: "",
|
|
30
31
|
basePath: "",
|
|
31
|
-
|
|
32
|
-
});
|
|
32
|
+
}, this.container);
|
|
33
33
|
}
|
|
34
34
|
/**
|
|
35
35
|
* Method to define API routes.
|
|
@@ -39,8 +39,7 @@ class App extends Server_1.HttpSever {
|
|
|
39
39
|
return new Router_1.Router(this.app, {
|
|
40
40
|
basePath: "/api",
|
|
41
41
|
prefixUrl: "",
|
|
42
|
-
|
|
43
|
-
});
|
|
42
|
+
}, this.container);
|
|
44
43
|
}
|
|
45
44
|
/**
|
|
46
45
|
* Method to configure and start the server.
|
|
@@ -52,10 +51,13 @@ class App extends Server_1.HttpSever {
|
|
|
52
51
|
const app = this.app;
|
|
53
52
|
const { RouteServiceProvider } = (0, util_1.getProvider)("RouteServiceProvider");
|
|
54
53
|
const routeService = new RouteServiceProvider(this.container);
|
|
54
|
+
RouteBuilder_1.RouteBuilder.setServiceContainer(this.container);
|
|
55
55
|
return {
|
|
56
56
|
listen() {
|
|
57
57
|
routeService.register();
|
|
58
58
|
routeService.boot();
|
|
59
|
+
RouteBuilder_1.RouteBuilder.registerRoute(app);
|
|
60
|
+
// console.log(RouteBuilder.routeList);
|
|
59
61
|
httpErrors(app);
|
|
60
62
|
return server;
|
|
61
63
|
},
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"NodeArtisanCommand.d.ts","sourceRoot":"","sources":["../../../framework/lib/Command-Line/NodeArtisanCommand.ts"],"names":[],"mappings":";AACA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;
|
|
1
|
+
{"version":3,"file":"NodeArtisanCommand.d.ts","sourceRoot":"","sources":["../../../framework/lib/Command-Line/NodeArtisanCommand.ts"],"names":[],"mappings":";AACA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAWpC,qBAAa,aAAa;IACxB,OAAO,CAAC,OAAO,CAAiB;IAChC,OAAO,CAAC,OAAO,CAAiB;IAChC,OAAO,CAAC,EAAE,CAAmB;IAC7B,OAAO,CAAC,IAAI,CAAqB;IACjC,OAAO,CAAC,KAAK,CAAsB;IAGnC,OAAO,CAAC,aAAa;IAarB,OAAO,CAAC,aAAa;IAoHrB,KAAK,CAAC,IAAI,EAAE,MAAM,EAAE;CAIrB"}
|
|
@@ -11,12 +11,15 @@ const command_1 = require("./command");
|
|
|
11
11
|
const util_1 = require("../util");
|
|
12
12
|
const inflection_1 = require("inflection");
|
|
13
13
|
const ConsoleInput_1 = require("./NodeTinker/ConsoleInput");
|
|
14
|
+
const Queue_1 = require("../Queue/Queue");
|
|
15
|
+
const RouteCommand_1 = require("./RouteCommand");
|
|
14
16
|
class ConsoleKernel {
|
|
15
17
|
constructor() {
|
|
16
18
|
this.program = new commander_1.Command();
|
|
17
19
|
this.migrate = new MigrateCommand_1.Migrate();
|
|
18
20
|
this.db = new DBCommand_1.DBCommand();
|
|
19
21
|
this.make = new command_1.MakeCommand();
|
|
22
|
+
this.route = new RouteCommand_1.RouteCommand();
|
|
20
23
|
}
|
|
21
24
|
// Method to define a command with optional flags
|
|
22
25
|
defineCommand(command) {
|
|
@@ -88,6 +91,13 @@ class ConsoleKernel {
|
|
|
88
91
|
}
|
|
89
92
|
process.exit(0);
|
|
90
93
|
});
|
|
94
|
+
this.defineCommand("queue:work").action(async (firstArg, secondArg) => {
|
|
95
|
+
console.log("Starting the queue worker...");
|
|
96
|
+
await Queue_1.Queue.start();
|
|
97
|
+
});
|
|
98
|
+
this.defineCommand("route:list").action(async (firstArg, secondArg) => {
|
|
99
|
+
this.route.display();
|
|
100
|
+
});
|
|
91
101
|
this.defineCommand("db-tinker").action((firstArg, secondArg) => {
|
|
92
102
|
//
|
|
93
103
|
ConsoleInput_1.ConsoleInput.startTinkerConsole();
|
|
@@ -33,7 +33,7 @@ class ConsoleInput extends Tinker_1.TinkerNode {
|
|
|
33
33
|
});
|
|
34
34
|
}
|
|
35
35
|
static async evalCommand(repl, cmd, context, filename, callback) {
|
|
36
|
-
const input = cmd.trim().split(".")[0];
|
|
36
|
+
const input = cmd.trim().split(".")[0];
|
|
37
37
|
if (this.models.hasOwnProperty(input)) {
|
|
38
38
|
const result = await this.extractCommand(cmd.trim());
|
|
39
39
|
console.log(JSON.parse(JSON.stringify(result)));
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"RouteCommand.d.ts","sourceRoot":"","sources":["../../../framework/lib/Command-Line/RouteCommand.ts"],"names":[],"mappings":"AAIA,qBAAa,YAAY;IACvB,OAAO,CAAC,SAAS,CAA0B;IAE3C,OAAO,CAAC,iBAAiB;IAOzB,OAAO,CAAC,YAAY;IAYpB,OAAO;CAKR"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.RouteCommand = void 0;
|
|
4
|
+
const RouteBuilder_1 = require("../Routes/RouteBuilder");
|
|
5
|
+
const ServiceContainer_1 = require("../Services/ServiceContainer");
|
|
6
|
+
const util_1 = require("../util");
|
|
7
|
+
class RouteCommand {
|
|
8
|
+
constructor() {
|
|
9
|
+
this.container = new ServiceContainer_1.ServiceContainer();
|
|
10
|
+
}
|
|
11
|
+
callRouteProvider() {
|
|
12
|
+
const { RouteServiceProvider } = (0, util_1.getProvider)("RouteServiceProvider");
|
|
13
|
+
const routeService = new RouteServiceProvider(this.container);
|
|
14
|
+
routeService.register();
|
|
15
|
+
return routeService.boot();
|
|
16
|
+
}
|
|
17
|
+
formatRoutes() {
|
|
18
|
+
const { RouteServiceProvider } = (0, util_1.getProvider)("RouteServiceProvider");
|
|
19
|
+
const routeService = new RouteServiceProvider(this.container);
|
|
20
|
+
routeService.register();
|
|
21
|
+
routeService.boot();
|
|
22
|
+
console.log(RouteBuilder_1.RouteBuilder.routeList);
|
|
23
|
+
// const routes = RouteBuilder.routeList;
|
|
24
|
+
// for (const route of routes) {
|
|
25
|
+
// console.log(`${route.method.toUpperCase()} : ${route.url}`);
|
|
26
|
+
// }
|
|
27
|
+
}
|
|
28
|
+
display() {
|
|
29
|
+
// routeService.register();
|
|
30
|
+
// this.callRouteProvider();
|
|
31
|
+
return this.formatRoutes();
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
exports.RouteCommand = RouteCommand;
|
|
@@ -14,79 +14,80 @@
|
|
|
14
14
|
<body class="">
|
|
15
15
|
<div class="code-container">
|
|
16
16
|
<div class="error-message">
|
|
17
|
-
|
|
17
|
+
Error fetching one relationship: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ')' at line 1
|
|
18
|
+
SELECT * FROM users
|
|
19
|
+
SELECT * FROM users <p> /home/abdou/Documents/GAMBTECH/FRAMEWORK/jcc/app/Http/Controllers/MessagesController.ts 19:16 </p>
|
|
18
20
|
</div>
|
|
19
21
|
<div class="container">
|
|
20
22
|
<pre
|
|
21
|
-
data-line="
|
|
23
|
+
data-line="19"
|
|
22
24
|
class="line-numbers"
|
|
23
|
-
><code class="language-javascript">1. import "
|
|
24
|
-
2.
|
|
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.
|
|
42
|
-
20.
|
|
43
|
-
21.
|
|
44
|
-
22.
|
|
45
|
-
23.
|
|
46
|
-
24.
|
|
47
|
-
25.
|
|
48
|
-
26.
|
|
49
|
-
27.
|
|
50
|
-
28.
|
|
51
|
-
29.
|
|
52
|
-
30.
|
|
53
|
-
31.
|
|
54
|
-
32.
|
|
55
|
-
33.
|
|
56
|
-
34.
|
|
57
|
-
35.
|
|
58
|
-
36.
|
|
59
|
-
37.
|
|
60
|
-
38.
|
|
61
|
-
39.
|
|
62
|
-
40.
|
|
63
|
-
41.
|
|
64
|
-
42.
|
|
65
|
-
43.
|
|
66
|
-
44.
|
|
67
|
-
45.
|
|
68
|
-
46.
|
|
69
|
-
47.
|
|
70
|
-
48.
|
|
71
|
-
49.
|
|
72
|
-
50.
|
|
73
|
-
51.
|
|
74
|
-
52.
|
|
75
|
-
53.
|
|
76
|
-
54.
|
|
77
|
-
55.
|
|
78
|
-
56.
|
|
79
|
-
57.
|
|
80
|
-
58.
|
|
81
|
-
59.
|
|
82
|
-
60.
|
|
83
|
-
61.
|
|
84
|
-
62.
|
|
85
|
-
63. //
|
|
86
|
-
64.
|
|
87
|
-
65.
|
|
88
|
-
66.
|
|
89
|
-
67. </code></pre>
|
|
25
|
+
><code class="language-javascript">1. import { Message } from "@/Model/Message";
|
|
26
|
+
2. import { Request, Response, Next } from "@framework/core/http";
|
|
27
|
+
3.
|
|
28
|
+
4. export class MessagesController {
|
|
29
|
+
5. /**
|
|
30
|
+
6. *@access public
|
|
31
|
+
7. * @return Express Request Response
|
|
32
|
+
8. */
|
|
33
|
+
9. create(req: Request, res: Response, next: Next) {
|
|
34
|
+
10. //
|
|
35
|
+
11. }
|
|
36
|
+
12. /**
|
|
37
|
+
13. *@access public
|
|
38
|
+
14. * @return Express Request Response
|
|
39
|
+
15. */
|
|
40
|
+
16. async index(req: Request, res: Response, next: Next) {
|
|
41
|
+
17. //
|
|
42
|
+
18. return res.json({
|
|
43
|
+
19. message: await Message.with("sender", "recipient").get(),
|
|
44
|
+
20. });
|
|
45
|
+
21. }
|
|
46
|
+
22.
|
|
47
|
+
23. /**
|
|
48
|
+
24. *
|
|
49
|
+
25. *@access public
|
|
50
|
+
26. * @return Express Request Response
|
|
51
|
+
27. */
|
|
52
|
+
28. store(req: Request, res: Response, next: Next) {
|
|
53
|
+
29. //
|
|
54
|
+
30. }
|
|
55
|
+
31.
|
|
56
|
+
32. /**
|
|
57
|
+
33. *@access public
|
|
58
|
+
34. *@param {id} - string
|
|
59
|
+
35. * @return Express Request Response
|
|
60
|
+
36. */
|
|
61
|
+
37. show(req: Request, res: Response, next: Next) {
|
|
62
|
+
38. //
|
|
63
|
+
39. return res.json({ message: "Hello Show" });
|
|
64
|
+
40. }
|
|
65
|
+
41.
|
|
66
|
+
42. edit(req: Request, res: Response, next: Next) {
|
|
67
|
+
43. //
|
|
68
|
+
44. return res.json({ message: "Hi Show" });
|
|
69
|
+
45. }
|
|
70
|
+
46.
|
|
71
|
+
47. /**
|
|
72
|
+
48. *
|
|
73
|
+
49. *@access public
|
|
74
|
+
50. * @param {id} - string
|
|
75
|
+
51. * @return Express Request Response
|
|
76
|
+
52. */
|
|
77
|
+
53. update(req: Request, res: Response, next: Next) {
|
|
78
|
+
54. //
|
|
79
|
+
55. }
|
|
80
|
+
56.
|
|
81
|
+
57. /**
|
|
82
|
+
58. *@access public
|
|
83
|
+
59. * @param {id} - string
|
|
84
|
+
60. * @return Express Response
|
|
85
|
+
61. */
|
|
86
|
+
62. destroy(req: Request, res: Response, next: Next) {
|
|
87
|
+
63. //
|
|
88
|
+
64. }
|
|
89
|
+
65. }
|
|
90
|
+
66. </code></pre>
|
|
90
91
|
</div>
|
|
91
92
|
</div>
|
|
92
93
|
<script src="/js/app-error-prism.js"> </script>
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { KernelMiddleware, Middleware } from "../Type";
|
|
2
2
|
declare class HttpKernel {
|
|
3
|
-
protected middleware:
|
|
3
|
+
protected middleware: Middleware;
|
|
4
4
|
protected middlewares: KernelMiddleware;
|
|
5
5
|
}
|
|
6
6
|
export default HttpKernel;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"HttpKernel.d.ts","sourceRoot":"","sources":["../../../framework/lib/HttpKernel/HttpKernel.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"HttpKernel.d.ts","sourceRoot":"","sources":["../../../framework/lib/HttpKernel/HttpKernel.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,gBAAgB,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAEvD,cAAM,UAAU;IACd,SAAS,CAAC,UAAU,EAAE,UAAU,CAAM;IAEtC,SAAS,CAAC,WAAW,EAAE,gBAAgB,CAGrC;CACH;AAED,eAAe,UAAU,CAAC"}
|
package/lib/Interface/index.d.ts
CHANGED
|
@@ -1,10 +1,7 @@
|
|
|
1
1
|
import { NextFunction, Request, RequestHandler, Response } from "express";
|
|
2
2
|
import { ObjectType } from "../Type";
|
|
3
|
-
export interface ExpressCallback {
|
|
4
|
-
(request: AppRequest, response: AppResponse, next: NextFunction): any;
|
|
5
|
-
}
|
|
6
3
|
export interface AsynCallback {
|
|
7
|
-
(req:
|
|
4
|
+
(req: AppRequest, response: AppResponse, next: AppNext): RequestHandler;
|
|
8
5
|
}
|
|
9
6
|
export interface AppRequest extends Request {
|
|
10
7
|
user: {
|
|
@@ -76,6 +73,66 @@ export interface MethodsInterface {
|
|
|
76
73
|
method: string;
|
|
77
74
|
};
|
|
78
75
|
}
|
|
79
|
-
export interface
|
|
76
|
+
export interface BaseController {
|
|
77
|
+
new (...args: any[]): any;
|
|
78
|
+
}
|
|
79
|
+
export interface ExpressCallback {
|
|
80
|
+
(request: AppRequest, response: AppResponse, next: AppNext): any | void | Promise<any>;
|
|
81
|
+
}
|
|
82
|
+
export interface IQueue {
|
|
83
|
+
enqueue(job: new (...args: []) => any): Promise<void>;
|
|
84
|
+
dequeue(): Promise<new (...args: []) => any | null>;
|
|
85
|
+
process(handler: (job: new (...args: []) => any) => Promise<void>): void;
|
|
86
|
+
}
|
|
87
|
+
export interface IJob {
|
|
88
|
+
id: string;
|
|
89
|
+
data: any;
|
|
90
|
+
status: "Pending" | "failed" | "Complete";
|
|
91
|
+
retries: number;
|
|
92
|
+
execute(): Promise<void>;
|
|
93
|
+
}
|
|
94
|
+
export interface Container {
|
|
95
|
+
/**
|
|
96
|
+
* Bind a service to the container.
|
|
97
|
+
* @param key The unique key to identify the service.
|
|
98
|
+
* @param resolver A function that resolves the service.
|
|
99
|
+
*/
|
|
100
|
+
bind<T>(key: string, resolver: () => T): void;
|
|
101
|
+
/**
|
|
102
|
+
* Bind a singleton service to the container.
|
|
103
|
+
* @param key The unique key to identify the service.
|
|
104
|
+
* @param resolver A function that resolves the service.
|
|
105
|
+
*/
|
|
106
|
+
singleton<T>(key: string, resolver: () => T): void;
|
|
107
|
+
/**
|
|
108
|
+
* Resolve a service from the container.
|
|
109
|
+
* @param key The unique key to identify the service.
|
|
110
|
+
* @returns The resolved service instance.
|
|
111
|
+
* @throws Error if the service is not found.
|
|
112
|
+
*/
|
|
113
|
+
resolve(key: string): any;
|
|
114
|
+
/**
|
|
115
|
+
* Call a method on a service and automatically resolve its dependencies.
|
|
116
|
+
* @param key The unique key to identify the service.
|
|
117
|
+
* @param method The method to call on the service.
|
|
118
|
+
* @param args The arguments to pass to the method.
|
|
119
|
+
* @returns The result of the method call.
|
|
120
|
+
* @throws Error if the service or method is not found.
|
|
121
|
+
*/
|
|
122
|
+
call<T>(method: string, args?: Array<any>): T;
|
|
123
|
+
/**
|
|
124
|
+
* Alias for resolving a service.
|
|
125
|
+
* @param key The unique key to identify the service.
|
|
126
|
+
* @returns The resolved service instance.
|
|
127
|
+
*/
|
|
128
|
+
make(T: new (...args: any[]) => any): any;
|
|
129
|
+
/**
|
|
130
|
+
* Register an alias for a service.
|
|
131
|
+
* @param key The unique key to identify the service.
|
|
132
|
+
* @param alias The alias to register for the service.
|
|
133
|
+
* @throws Error if the original service is not found.
|
|
134
|
+
*/
|
|
135
|
+
alias(key: string, alias: string): void;
|
|
136
|
+
resolveDynamicInjection<T>(T: new (...args: any[]) => T): T;
|
|
80
137
|
}
|
|
81
138
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../framework/lib/Interface/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,OAAO,EAAE,cAAc,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAC1E,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../framework/lib/Interface/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,OAAO,EAAE,cAAc,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAC1E,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAErC,MAAM,WAAW,YAAY;IAC3B,CAAC,GAAG,EAAE,UAAU,EAAE,QAAQ,EAAE,WAAW,EAAE,IAAI,EAAE,OAAO,GAAG,cAA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Middlewares/inertia.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,WAAW,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAEhE,UAAU,cAAc;IACtB,QAAQ,EAAE,MAAM,CAAC;CAClB;
|
|
1
|
+
{"version":3,"file":"inertia.d.ts","sourceRoot":"","sources":["../../../framework/lib/Middlewares/inertia.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,WAAW,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAEhE,UAAU,cAAc;IACtB,QAAQ,EAAE,MAAM,CAAC;CAClB;AA0DD,eAAO,MAAM,OAAO,YAAa,cAAc,WAzC9B,UAAU,OAAO,WAAW,QAAQ,OAAO,SA0CxB,CAAC"}
|
|
@@ -6,9 +6,13 @@ class InertiaMiddleware {
|
|
|
6
6
|
const errors = {
|
|
7
7
|
...res.locals.errors,
|
|
8
8
|
...(res.locals.error?.email ? res.locals.error : {}),
|
|
9
|
-
};
|
|
9
|
+
};
|
|
10
10
|
const auth = { ...req.user };
|
|
11
|
-
|
|
11
|
+
const flash = {
|
|
12
|
+
message: req.flash("success")[0] || req.flash("error")[0] || "",
|
|
13
|
+
status: res.statusCode,
|
|
14
|
+
};
|
|
15
|
+
return { ...props, auth, flash, errors };
|
|
12
16
|
}
|
|
13
17
|
inertia(options) {
|
|
14
18
|
return (req, res, next) => {
|
|
@@ -32,6 +36,12 @@ class InertiaMiddleware {
|
|
|
32
36
|
option,
|
|
33
37
|
});
|
|
34
38
|
};
|
|
39
|
+
res.inertiaRedirect = (url, message, type = "success") => {
|
|
40
|
+
if (message) {
|
|
41
|
+
req.flash(type, message);
|
|
42
|
+
}
|
|
43
|
+
return res.redirect(303, url);
|
|
44
|
+
};
|
|
35
45
|
next();
|
|
36
46
|
};
|
|
37
47
|
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { EventEmitter } from "node:events";
|
|
2
|
+
export declare abstract class DispatchEvent {
|
|
3
|
+
protected static event: EventEmitter<[never]>;
|
|
4
|
+
protected static PROCESS: string;
|
|
5
|
+
static addQueueEvent(data: any): boolean;
|
|
6
|
+
static listenJobEvent(): EventEmitter<[never]>;
|
|
7
|
+
}
|
|
8
|
+
//# sourceMappingURL=DispatchEvent.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DispatchEvent.d.ts","sourceRoot":"","sources":["../../../framework/lib/Queue/DispatchEvent.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAE3C,8BAAsB,aAAa;IACjC,SAAS,CAAC,MAAM,CAAC,KAAK,wBAAsB;IAC5C,SAAS,CAAC,MAAM,CAAC,OAAO,SAAgB;WAE1B,aAAa,CAAC,IAAI,EAAE,GAAG;WAOvB,cAAc;CAQ7B"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.DispatchEvent = void 0;
|
|
4
|
+
const node_events_1 = require("node:events");
|
|
5
|
+
class DispatchEvent {
|
|
6
|
+
static addQueueEvent(data) {
|
|
7
|
+
console.log(`🚀 Emitting event for job: ${data.job} with UUID: ${data.uuid}`);
|
|
8
|
+
return this.event.emit(this.PROCESS, data);
|
|
9
|
+
}
|
|
10
|
+
static listenJobEvent() {
|
|
11
|
+
console.log("Listen Queue added. Running");
|
|
12
|
+
return this.event.on(this.PROCESS, (data) => {
|
|
13
|
+
console.log("New Queue added. Running " + data.job + " .......");
|
|
14
|
+
// const job: any = await JobModel.where("uuid", data.uuid).first();
|
|
15
|
+
// this.runQueue(job);
|
|
16
|
+
});
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
exports.DispatchEvent = DispatchEvent;
|
|
20
|
+
DispatchEvent.event = new node_events_1.EventEmitter();
|
|
21
|
+
DispatchEvent.PROCESS = "PROCESSJOB";
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { DispatchEvent } from "./DispatchEvent";
|
|
2
|
+
import { JobType } from "./type";
|
|
3
|
+
export declare abstract class Job extends DispatchEvent {
|
|
4
|
+
private static rootPath;
|
|
5
|
+
private static defaultJobPath;
|
|
6
|
+
static dispatch(path: any, ...data: any): Promise<any>;
|
|
7
|
+
protected static getJobClass(jobData: JobType): any;
|
|
8
|
+
}
|
|
9
|
+
//# sourceMappingURL=Job.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Job.d.ts","sourceRoot":"","sources":["../../../framework/lib/Queue/Job.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAIhD,OAAO,EAAE,OAAO,EAAE,MAAM,QAAQ,CAAC;AAEjC,8BAAsB,GAAI,SAAQ,aAAa;IAC7C,OAAO,CAAC,MAAM,CAAC,QAAQ,CAA4B;IACnD,OAAO,CAAC,MAAM,CAAC,cAAc,CAAsB;WAEtC,QAAQ,CAAC,IAAI,EAAE,GAAG,EAAE,GAAG,IAAI,EAAE,GAAG,GAAG,OAAO,CAAC,GAAG,CAAC;IAkC5D,SAAS,CAAC,MAAM,CAAC,WAAW,CAAC,OAAO,EAAE,OAAO;CAM9C"}
|
package/lib/Queue/Job.js
ADDED
|
@@ -0,0 +1,50 @@
|
|
|
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.Job = void 0;
|
|
7
|
+
const DispatchEvent_1 = require("./DispatchEvent");
|
|
8
|
+
const uuid_1 = require("uuid");
|
|
9
|
+
const app_root_path_1 = __importDefault(require("app-root-path"));
|
|
10
|
+
class Job extends DispatchEvent_1.DispatchEvent {
|
|
11
|
+
static async dispatch(path, ...data) {
|
|
12
|
+
try {
|
|
13
|
+
if (arguments.length == 1) {
|
|
14
|
+
data = path;
|
|
15
|
+
path = "";
|
|
16
|
+
}
|
|
17
|
+
const resolvePath = this.rootPath +
|
|
18
|
+
"/" +
|
|
19
|
+
(path ? path : this.defaultJobPath) +
|
|
20
|
+
"/" +
|
|
21
|
+
this.name;
|
|
22
|
+
const insertData = {
|
|
23
|
+
uuid: (0, uuid_1.v4)(),
|
|
24
|
+
job: this.name,
|
|
25
|
+
maxTries: 3,
|
|
26
|
+
failOnTimeout: 0,
|
|
27
|
+
timeout: 0,
|
|
28
|
+
retryUntil: 0,
|
|
29
|
+
data: {
|
|
30
|
+
commandName: resolvePath,
|
|
31
|
+
command: data,
|
|
32
|
+
},
|
|
33
|
+
};
|
|
34
|
+
// await JobModel.create(insertData);
|
|
35
|
+
this.addQueueEvent(insertData);
|
|
36
|
+
}
|
|
37
|
+
catch (error) {
|
|
38
|
+
console.log(error?.message);
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
static getJobClass(jobData) {
|
|
42
|
+
const name = jobData.job;
|
|
43
|
+
const Job = require(jobData.data?.commandName);
|
|
44
|
+
const JobClass = Job[name];
|
|
45
|
+
return new JobClass(jobData.data?.command);
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
exports.Job = Job;
|
|
49
|
+
Job.rootPath = app_root_path_1.default.path;
|
|
50
|
+
Job.defaultJobPath = "app/Jobs";
|