jcc-express-mvc 1.6.19 → 1.7.1
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/Cache.d.ts +2 -0
- package/Core/Cache.d.ts.map +1 -0
- package/Core/Cache.js +17 -0
- package/Core/Event.d.ts +2 -0
- package/Core/Event.d.ts.map +1 -0
- package/Core/Event.js +17 -0
- package/Core/Job.d.ts +2 -0
- package/Core/Job.d.ts.map +1 -0
- package/Core/Job.js +17 -0
- package/Core/Provider.d.ts +1 -0
- package/Core/Provider.d.ts.map +1 -1
- package/Core/Provider.js +1 -0
- package/Core/Storage.d.ts +2 -0
- package/Core/Storage.d.ts.map +1 -0
- package/Core/Storage.js +17 -0
- package/global.d.ts +25 -0
- package/index.d.ts +33 -6
- package/index.d.ts.map +1 -1
- package/index.js +2 -1
- package/lib/Application/Application.d.ts +2 -0
- package/lib/Application/Application.d.ts.map +1 -1
- package/lib/Application/Application.js +16 -0
- package/lib/Application/ApplicationBuilder.d.ts.map +1 -1
- package/lib/Application/ApplicationBuilder.js +13 -0
- package/lib/Command-Line/NodeArtisanCommand.d.ts.map +1 -1
- package/lib/Command-Line/NodeArtisanCommand.js +43 -6
- package/lib/Command-Line/RouteCommand.d.ts +1 -1
- package/lib/Command-Line/RouteCommand.d.ts.map +1 -1
- package/lib/Command-Line/RouteCommand.js +8 -5
- package/lib/Command-Line/command.d.ts +4 -0
- package/lib/Command-Line/command.d.ts.map +1 -1
- package/lib/Command-Line/command.js +100 -1
- package/lib/Command-Line/files/Event.d.ts +8 -0
- package/lib/Command-Line/files/Event.d.ts.map +1 -0
- package/lib/Command-Line/files/Event.js +26 -0
- package/lib/Command-Line/files/Listener.d.ts +8 -0
- package/lib/Command-Line/files/Listener.d.ts.map +1 -0
- package/lib/Command-Line/files/Listener.js +29 -0
- package/lib/Command-Line/files/Migration.d.ts.map +1 -1
- package/lib/Command-Line/files/Migration.js +3 -1
- package/lib/Command-Line/files/jobClass.d.ts +2 -0
- package/lib/Command-Line/files/jobClass.d.ts.map +1 -0
- package/lib/Command-Line/files/jobClass.js +23 -0
- package/lib/Command-Line/files/jobs.d.ts +3 -0
- package/lib/Command-Line/files/jobs.d.ts.map +1 -0
- package/lib/Command-Line/files/jobs.js +42 -0
- package/lib/Container/index.d.ts +4 -3
- package/lib/Container/index.d.ts.map +1 -1
- package/lib/Container/index.js +24 -104
- package/lib/Date/index.d.ts +576 -5
- package/lib/Date/index.d.ts.map +1 -1
- package/lib/Date/index.js +821 -71
- package/lib/Dependancy/index.d.ts +1 -0
- package/lib/Dependancy/index.d.ts.map +1 -1
- package/lib/Dependancy/index.js +8 -0
- package/lib/Event/Event.d.ts +26 -0
- package/lib/Event/Event.d.ts.map +1 -0
- package/lib/Event/Event.js +72 -0
- package/lib/Event/Types.d.ts +3 -0
- package/lib/Event/Types.d.ts.map +1 -0
- package/lib/Event/Types.js +2 -0
- package/lib/Express/ExpressApplication.d.ts.map +1 -1
- package/lib/Express/ExpressApplication.js +0 -3
- package/lib/Global/helpers.d.ts +3 -0
- package/lib/Global/helpers.d.ts.map +1 -0
- package/lib/Global/helpers.js +32 -0
- package/lib/Interface/index.d.ts +4 -0
- package/lib/Interface/index.d.ts.map +1 -1
- package/lib/Jcc-eloquent/lib/Builder.d.ts +77 -15
- package/lib/Jcc-eloquent/lib/Builder.d.ts.map +1 -1
- package/lib/Jcc-eloquent/lib/Builder.js +314 -136
- package/lib/Jcc-eloquent/lib/DB/index.d.ts +2 -1
- package/lib/Jcc-eloquent/lib/DB/index.d.ts.map +1 -1
- package/lib/Jcc-eloquent/lib/DB/index.js +3 -0
- package/lib/Jcc-eloquent/lib/Interfaces/index.d.ts +9 -0
- package/lib/Jcc-eloquent/lib/Interfaces/index.d.ts.map +1 -1
- package/lib/Jcc-eloquent/lib/Migration.js +4 -4
- package/lib/Jcc-eloquent/lib/Model.js +3 -3
- package/lib/Jcc-eloquent/lib/QueryBuilder.d.ts +23 -7
- package/lib/Jcc-eloquent/lib/QueryBuilder.d.ts.map +1 -1
- package/lib/Jcc-eloquent/lib/QueryBuilder.js +55 -13
- package/lib/Jcc-eloquent/lib/Relations/BelongsTo.d.ts +2 -0
- package/lib/Jcc-eloquent/lib/Relations/BelongsTo.d.ts.map +1 -1
- package/lib/Jcc-eloquent/lib/Relations/BelongsTo.js +12 -1
- package/lib/Jcc-eloquent/lib/Relations/BelongsToMany.d.ts +2 -0
- package/lib/Jcc-eloquent/lib/Relations/BelongsToMany.d.ts.map +1 -1
- package/lib/Jcc-eloquent/lib/Relations/BelongsToMany.js +8 -0
- package/lib/Jcc-eloquent/lib/Relations/HasMany.d.ts +2 -0
- package/lib/Jcc-eloquent/lib/Relations/HasMany.d.ts.map +1 -1
- package/lib/Jcc-eloquent/lib/Relations/HasMany.js +18 -1
- package/lib/Jcc-eloquent/lib/Relations/HasOne.d.ts +2 -0
- package/lib/Jcc-eloquent/lib/Relations/HasOne.d.ts.map +1 -1
- package/lib/Jcc-eloquent/lib/Relations/HasOne.js +14 -2
- package/lib/Jcc-eloquent/lib/Relations/MorphMany.d.ts +2 -0
- package/lib/Jcc-eloquent/lib/Relations/MorphMany.d.ts.map +1 -1
- package/lib/Jcc-eloquent/lib/Relations/MorphMany.js +8 -0
- package/lib/Jcc-eloquent/lib/Relations/MorphOne.d.ts +2 -0
- package/lib/Jcc-eloquent/lib/Relations/MorphOne.d.ts.map +1 -1
- package/lib/Jcc-eloquent/lib/Relations/MorphOne.js +8 -0
- package/lib/Jcc-eloquent/lib/Relations/MorphTo.d.ts +2 -0
- package/lib/Jcc-eloquent/lib/Relations/MorphTo.d.ts.map +1 -1
- package/lib/Jcc-eloquent/lib/Relations/MorphTo.js +3 -0
- package/lib/Jcc-eloquent/lib/Relations/Relation.d.ts +8 -1
- package/lib/Jcc-eloquent/lib/Relations/Relation.d.ts.map +1 -1
- package/lib/Jcc-eloquent/lib/Rollback.js +1 -1
- package/lib/Jcc-eloquent/lib/Schema/BluePrint/index.d.ts +6 -1
- package/lib/Jcc-eloquent/lib/Schema/BluePrint/index.d.ts.map +1 -1
- package/lib/Jcc-eloquent/lib/Schema/BluePrint/index.js +62 -4
- package/lib/Jcc-eloquent/lib/Schema/index.js +2 -2
- package/lib/Jcc-eloquent/lib/Types/index.d.ts +7 -0
- package/lib/Jcc-eloquent/lib/Types/index.d.ts.map +1 -1
- package/lib/Jcc-eloquent/lib/utils/index.d.ts +0 -34
- package/lib/Jcc-eloquent/lib/utils/index.d.ts.map +1 -1
- package/lib/Jcc-eloquent/lib/utils/index.js +0 -75
- package/lib/Mail/index.js +3 -3
- package/lib/Providers/EventServiceProvider.d.ts +14 -0
- package/lib/Providers/EventServiceProvider.d.ts.map +1 -0
- package/lib/Providers/EventServiceProvider.js +31 -0
- package/lib/Providers/ServiceProvider.d.ts +6 -0
- package/lib/Providers/ServiceProvider.d.ts.map +1 -1
- package/lib/Providers/ServiceProvider.js +26 -0
- package/lib/Providers/SocketServiceProvider.d.ts.map +1 -1
- package/lib/Queue/Drivers/DatabaseDriver.d.ts +10 -0
- package/lib/Queue/Drivers/DatabaseDriver.d.ts.map +1 -0
- package/lib/Queue/Drivers/DatabaseDriver.js +72 -0
- package/lib/Queue/Drivers/MemoryDriver.d.ts +17 -0
- package/lib/Queue/Drivers/MemoryDriver.d.ts.map +1 -0
- package/lib/Queue/Drivers/MemoryDriver.js +68 -0
- package/lib/Queue/Job.d.ts +29 -0
- package/lib/Queue/Job.d.ts.map +1 -0
- package/lib/Queue/Job.js +53 -0
- package/lib/Queue/JobsLogger.d.ts +12 -0
- package/lib/Queue/JobsLogger.d.ts.map +1 -0
- package/lib/Queue/JobsLogger.js +36 -0
- package/lib/Queue/Queue.d.ts +40 -0
- package/lib/Queue/Queue.d.ts.map +1 -0
- package/lib/Queue/Queue.js +162 -0
- package/lib/Queue/index.d.ts +5 -0
- package/lib/Queue/index.d.ts.map +1 -0
- package/lib/Queue/index.js +20 -0
- package/lib/Queue/interface.d.ts +54 -0
- package/lib/Queue/interface.d.ts.map +1 -0
- package/lib/Queue/interface.js +2 -0
- package/lib/Queue/type.d.ts +28 -0
- package/lib/Queue/type.d.ts.map +1 -0
- package/lib/Queue/type.js +2 -0
- package/lib/Routes/Route.d.ts.map +1 -1
- package/lib/Routes/Route.js +4 -0
- package/lib/Routes/RouteBuilder.d.ts +3 -0
- package/lib/Routes/RouteBuilder.d.ts.map +1 -1
- package/lib/Routes/RouteBuilder.js +22 -5
- package/lib/Server/index.d.ts.map +1 -1
- package/lib/Server/index.js +3 -2
- package/lib/Session/DatabaseSession.d.ts +1 -1
- package/lib/Session/DatabaseSession.d.ts.map +1 -1
- package/lib/Session/DatabaseSession.js +9 -8
- package/lib/Type/global.d.ts +7 -0
- package/lib/Type/global.d.ts.map +1 -0
- package/lib/Type/global.js +2 -0
- package/lib/Type/index.d.ts +3 -2
- package/lib/Type/index.d.ts.map +1 -1
- package/lib/util/Str.d.ts.map +1 -1
- package/lib/util/Str.js +10 -2
- package/lib/util/index.d.ts +3 -2
- package/lib/util/index.d.ts.map +1 -1
- package/lib/util/index.js +60 -18
- package/package.json +1 -1
package/Core/Cache.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Cache.d.ts","sourceRoot":"","sources":["../../Framework/Core/Cache.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAC"}
|
package/Core/Cache.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/Cache"), exports);
|
package/Core/Event.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Event.d.ts","sourceRoot":"","sources":["../../Framework/Core/Event.ts"],"names":[],"mappings":"AAAA,cAAc,oBAAoB,CAAC"}
|
package/Core/Event.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/Event/Event"), exports);
|
package/Core/Job.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Job.d.ts","sourceRoot":"","sources":["../../Framework/Core/Job.ts"],"names":[],"mappings":"AAAA,cAAc,kBAAkB,CAAA"}
|
package/Core/Job.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/Job"), exports);
|
package/Core/Provider.d.ts
CHANGED
package/Core/Provider.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Provider.d.ts","sourceRoot":"","sources":["../../Framework/Core/Provider.ts"],"names":[],"mappings":"AAAA,cAAc,kCAAkC,CAAC;AACjD,cAAc,wCAAwC,CAAC"}
|
|
1
|
+
{"version":3,"file":"Provider.d.ts","sourceRoot":"","sources":["../../Framework/Core/Provider.ts"],"names":[],"mappings":"AAAA,cAAc,kCAAkC,CAAC;AACjD,cAAc,wCAAwC,CAAC;AACvD,cAAc,uCAAuC,CAAC"}
|
package/Core/Provider.js
CHANGED
|
@@ -16,3 +16,4 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
17
|
__exportStar(require("../lib/Providers/ServiceProvider"), exports);
|
|
18
18
|
__exportStar(require("../lib/Providers/SocketServiceProvider"), exports);
|
|
19
|
+
__exportStar(require("../lib/Providers/EventServiceProvider"), exports);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Storage.d.ts","sourceRoot":"","sources":["../../Framework/Core/Storage.ts"],"names":[],"mappings":"AAAA,cAAc,gBAAgB,CAAC"}
|
package/Core/Storage.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/Storage"), exports);
|
package/global.d.ts
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import {
|
|
2
|
+
bcrypt,
|
|
3
|
+
jwtSign,
|
|
4
|
+
jwtVerify,
|
|
5
|
+
verifyHash,
|
|
6
|
+
rootPath,
|
|
7
|
+
} from "./lib/Type/global";
|
|
8
|
+
|
|
9
|
+
import { Event } from "./lib/Event/Event";
|
|
10
|
+
import { Queue } from "./lib/Queue";
|
|
11
|
+
import { Container } from "./lib/Container";
|
|
12
|
+
|
|
13
|
+
declare global {
|
|
14
|
+
var app: Container;
|
|
15
|
+
var bcrypt: bcrypt;
|
|
16
|
+
var emit: OmitThisParameter<Event["dispatch"]>;
|
|
17
|
+
var env: (key: string, defaultValue?: string | null) => string | null;
|
|
18
|
+
var dispatch: OmitThisParameter<Queue["push"]>;
|
|
19
|
+
var jwtVerify: jwtVerify;
|
|
20
|
+
var jwtSign: jwtSign;
|
|
21
|
+
var rootPath: rootPath;
|
|
22
|
+
var verifyHash: verifyHash;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
export {};
|
package/index.d.ts
CHANGED
|
@@ -1,10 +1,37 @@
|
|
|
1
|
+
/// <reference path="./global.d.ts" />
|
|
2
|
+
|
|
1
3
|
export { Authentication as Auth } from "./lib/Auth";
|
|
2
4
|
export { config } from "./lib/Config/Config";
|
|
3
|
-
export type {
|
|
5
|
+
export type {
|
|
6
|
+
AppRequest as Request,
|
|
7
|
+
AppResponse as Response,
|
|
8
|
+
AppNext as Next,
|
|
9
|
+
} from "./lib/Interface";
|
|
4
10
|
import { HttpContext as AppHttpContext } from "./lib/Interface";
|
|
5
|
-
export {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
11
|
+
export {
|
|
12
|
+
bcrypt,
|
|
13
|
+
verifyHash,
|
|
14
|
+
jwtSign,
|
|
15
|
+
jwtVerify,
|
|
16
|
+
saveImage,
|
|
17
|
+
asyncHandler,
|
|
18
|
+
cloudinaryUpload,
|
|
19
|
+
rootPath,
|
|
20
|
+
} from "./lib/util";
|
|
21
|
+
export declare const guest: (
|
|
22
|
+
req: import("./lib/Interface").AppRequest,
|
|
23
|
+
res: import("./lib/Interface").AppResponse,
|
|
24
|
+
next: import("./lib/Interface").AppNext
|
|
25
|
+
) => any;
|
|
26
|
+
export declare const apiAuth: (
|
|
27
|
+
req: import("./lib/Interface").AppRequest,
|
|
28
|
+
res: import("./lib/Interface").AppResponse,
|
|
29
|
+
next: import("./lib/Interface").AppNext
|
|
30
|
+
) => Promise<import("./lib/Interface").AppResponse | undefined>;
|
|
31
|
+
export declare const auth: (
|
|
32
|
+
req: import("./lib/Interface").AppRequest,
|
|
33
|
+
res: import("./lib/Interface").AppResponse,
|
|
34
|
+
next: import("./lib/Interface").AppNext
|
|
35
|
+
) => Promise<void>;
|
|
9
36
|
export declare const httpContext: AppHttpContext;
|
|
10
|
-
//# sourceMappingURL=index.d.ts.map
|
|
37
|
+
//# 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":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../Framework/index.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,cAAc,IAAI,IAAI,EAAE,MAAM,YAAY,CAAC;AAEpD,OAAO,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAC7C,YAAY,EACV,UAAU,IAAI,OAAO,EACrB,WAAW,IAAI,QAAQ,EACvB,OAAO,IAAI,IAAI,GAChB,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAAE,WAAW,IAAI,cAAc,EAAE,MAAM,iBAAiB,CAAC;AAEhE,OAAO,EACL,MAAM,EACN,UAAU,EACV,OAAO,EACP,SAAS,EACT,SAAS,EACT,YAAY,EACZ,gBAAgB,EAChB,QAAQ,GACT,MAAM,YAAY,CAAC;AAEpB,eAAO,MAAM,KAAK,yIAAuB,CAAC;AAC1C,eAAO,MAAM,OAAO,gMAAyB,CAAC;AAC9C,eAAO,MAAM,IAAI,mJAAsB,CAAC;AACxC,eAAO,MAAM,WAAW,EAAS,cAAc,CAAC"}
|
package/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.httpContext = exports.auth = exports.apiAuth = exports.guest = exports.cloudinaryUpload = exports.asyncHandler = exports.saveImage = exports.jwtVerify = exports.jwtSign = exports.verifyHash = exports.bcrypt = exports.config = exports.Auth = void 0;
|
|
3
|
+
exports.httpContext = exports.auth = exports.apiAuth = exports.guest = exports.rootPath = exports.cloudinaryUpload = exports.asyncHandler = exports.saveImage = exports.jwtVerify = exports.jwtSign = exports.verifyHash = exports.bcrypt = exports.config = exports.Auth = void 0;
|
|
4
4
|
const AuthMiddleware_1 = require("./lib/Auth/AuthMiddleware");
|
|
5
5
|
var Auth_1 = require("./lib/Auth");
|
|
6
6
|
Object.defineProperty(exports, "Auth", { enumerable: true, get: function () { return Auth_1.Authentication; } });
|
|
@@ -14,6 +14,7 @@ Object.defineProperty(exports, "jwtVerify", { enumerable: true, get: function ()
|
|
|
14
14
|
Object.defineProperty(exports, "saveImage", { enumerable: true, get: function () { return util_1.saveImage; } });
|
|
15
15
|
Object.defineProperty(exports, "asyncHandler", { enumerable: true, get: function () { return util_1.asyncHandler; } });
|
|
16
16
|
Object.defineProperty(exports, "cloudinaryUpload", { enumerable: true, get: function () { return util_1.cloudinaryUpload; } });
|
|
17
|
+
Object.defineProperty(exports, "rootPath", { enumerable: true, get: function () { return util_1.rootPath; } });
|
|
17
18
|
exports.guest = AuthMiddleware_1.authMiddleware.guest;
|
|
18
19
|
exports.apiAuth = AuthMiddleware_1.authMiddleware.apiAuth;
|
|
19
20
|
exports.auth = AuthMiddleware_1.authMiddleware.auth;
|
|
@@ -13,6 +13,8 @@ export declare class Application extends ExpressApplication {
|
|
|
13
13
|
registerProviders(Provider: new (app: Application) => ServiceProvider): this;
|
|
14
14
|
boot(): this;
|
|
15
15
|
private bootProvider;
|
|
16
|
+
private bootSubscribers;
|
|
17
|
+
private bootListeners;
|
|
16
18
|
version(): string;
|
|
17
19
|
run(): Promise<void>;
|
|
18
20
|
static configuration(): ApplicationBuilder;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Application.d.ts","sourceRoot":"","sources":["../../../Framework/lib/Application/Application.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAC;AAE/D,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAE1D,OAAO,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAC3C,OAAO,EAAE,kBAAkB,EAAE,MAAM,+BAA+B,CAAC;
|
|
1
|
+
{"version":3,"file":"Application.d.ts","sourceRoot":"","sources":["../../../Framework/lib/Application/Application.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAC;AAE/D,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAE1D,OAAO,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAC3C,OAAO,EAAE,kBAAkB,EAAE,MAAM,+BAA+B,CAAC;AAQnE,qBAAa,WAAY,SAAQ,kBAAkB;IACjD,OAAO,CAAC,MAAM,CAAkB;IAChC,OAAO,CAAC,SAAS,CAAyB;IACnC,QAAQ,EAAE,MAAM,CAAY;IAC5B,YAAY,EAAE,WAAW,EAAE,CAAM;IACxC,OAAO,CAAC,OAAO,CAAW;IACnB,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAM;;IAYxC,iBAAiB,CAAC,QAAQ,EAAE,KAAK,GAAG,EAAE,WAAW,KAAK,eAAe,GAAG,IAAI;IAqB5E,IAAI,IAAI,IAAI;IAUZ,OAAO,CAAC,YAAY;IAIpB,OAAO,CAAC,eAAe;IAIvB,OAAO,CAAC,aAAa;IAId,OAAO;IAKR,GAAG,IAAI,OAAO,CAAC,IAAI,CAAC;IAiB1B,MAAM,CAAC,aAAa;IAIpB,MAAM,CAAC,WAAW;CAGnB"}
|
|
@@ -11,6 +11,7 @@ const ExpressApplication_1 = require("../Express/ExpressApplication");
|
|
|
11
11
|
const Server_1 = require("../Server");
|
|
12
12
|
const RouteBuilder_1 = require("../Routes/RouteBuilder");
|
|
13
13
|
const Config_1 = require("../Config/Config");
|
|
14
|
+
const Event_1 = require("../Event/Event");
|
|
14
15
|
const rootPath = app_root_path_1.default.path;
|
|
15
16
|
class Application extends ExpressApplication_1.ExpressApplication {
|
|
16
17
|
constructor() {
|
|
@@ -23,6 +24,9 @@ class Application extends ExpressApplication_1.ExpressApplication {
|
|
|
23
24
|
this.config = {};
|
|
24
25
|
this.instance("app", this);
|
|
25
26
|
this.singleton("RouteServiceProvider", RouteServiceProvider_1.RouteServiceProvider);
|
|
27
|
+
this.singleton(Event_1.Event.name, () => {
|
|
28
|
+
return new Event_1.Event(this);
|
|
29
|
+
});
|
|
26
30
|
}
|
|
27
31
|
// Register a service provider
|
|
28
32
|
registerProviders(Provider) {
|
|
@@ -32,6 +36,12 @@ class Application extends ExpressApplication_1.ExpressApplication {
|
|
|
32
36
|
if (this.booted) {
|
|
33
37
|
this.bootProvider(provider);
|
|
34
38
|
}
|
|
39
|
+
if (provider.bootSubscribers) {
|
|
40
|
+
this.bootSubscribers(provider);
|
|
41
|
+
}
|
|
42
|
+
if (provider.bootListeners) {
|
|
43
|
+
this.bootListeners(provider);
|
|
44
|
+
}
|
|
35
45
|
return this;
|
|
36
46
|
}
|
|
37
47
|
// Boot all registered service providers
|
|
@@ -46,6 +56,12 @@ class Application extends ExpressApplication_1.ExpressApplication {
|
|
|
46
56
|
bootProvider(provider) {
|
|
47
57
|
provider.boot();
|
|
48
58
|
}
|
|
59
|
+
bootSubscribers(provider) {
|
|
60
|
+
provider.subscribers();
|
|
61
|
+
}
|
|
62
|
+
bootListeners(provider) {
|
|
63
|
+
provider.listeners();
|
|
64
|
+
}
|
|
49
65
|
version() {
|
|
50
66
|
return this.VERSION;
|
|
51
67
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ApplicationBuilder.d.ts","sourceRoot":"","sources":["../../../Framework/lib/Application/ApplicationBuilder.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC5C,OAAO,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAC;AAC/D,OAAO,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"ApplicationBuilder.d.ts","sourceRoot":"","sources":["../../../Framework/lib/Application/ApplicationBuilder.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC5C,OAAO,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAC;AAC/D,OAAO,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAQ3C,qBAAa,kBAAkB;IACtB,GAAG,EAAE,WAAW,CAAC;gBAEZ,GAAG,EAAE,WAAW;IAIrB,UAAU,CAAC,MAAM,EAAE,GAAG;IAKtB,UAAU,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC;IAetC,WAAW,CAAC,WAAW,EAAE,WAAW,EAAE;IAOtC,aAAa,CAClB,SAAS,EAAE,KAAK,CAAC,KAAK,GAAG,EAAE,WAAW,KAAK,eAAe,CAAC;IAS7D,OAAO,CAAC,UAAU;IAMlB,OAAO,CAAC,gBAAgB;IAIjB,WAAW;IAKX,cAAc;IAWd,MAAM;CAKd"}
|
|
@@ -3,6 +3,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.ApplicationBuilder = void 0;
|
|
4
4
|
const Middleware_1 = require("../Middleware");
|
|
5
5
|
const NodeArtisanCommand_1 = require("../Command-Line/NodeArtisanCommand");
|
|
6
|
+
const helpers_1 = require("../Global/helpers");
|
|
7
|
+
const Queue_1 = require("../Queue");
|
|
6
8
|
class ApplicationBuilder {
|
|
7
9
|
constructor(app) {
|
|
8
10
|
this.app = app;
|
|
@@ -13,6 +15,13 @@ class ApplicationBuilder {
|
|
|
13
15
|
}
|
|
14
16
|
withConfig(config) {
|
|
15
17
|
this.app.config = { ...this.app.config, ...config };
|
|
18
|
+
//
|
|
19
|
+
this.app.singleton("Queue", () => {
|
|
20
|
+
const defaultConnection = config.queue.default;
|
|
21
|
+
const queueConfig = config.queue.connections[defaultConnection];
|
|
22
|
+
return new Queue_1.Queue(queueConfig);
|
|
23
|
+
});
|
|
24
|
+
//
|
|
16
25
|
return this;
|
|
17
26
|
}
|
|
18
27
|
withRouting(routeConfig) {
|
|
@@ -23,6 +32,8 @@ class ApplicationBuilder {
|
|
|
23
32
|
}
|
|
24
33
|
withProviders(providers) {
|
|
25
34
|
providers.forEach((Provider) => this.app.registerProviders(Provider));
|
|
35
|
+
//
|
|
36
|
+
// this.withEvents();
|
|
26
37
|
return this;
|
|
27
38
|
}
|
|
28
39
|
withEvents() {
|
|
@@ -45,6 +56,8 @@ class ApplicationBuilder {
|
|
|
45
56
|
return this;
|
|
46
57
|
}
|
|
47
58
|
create() {
|
|
59
|
+
//
|
|
60
|
+
(0, helpers_1.globalHelpers)(this.app);
|
|
48
61
|
return this.app;
|
|
49
62
|
}
|
|
50
63
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"NodeArtisanCommand.d.ts","sourceRoot":"","sources":["../../../Framework/lib/Command-Line/NodeArtisanCommand.ts"],"names":[],"mappings":";AAEA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAapC,qBAAa,aAAa;IAExB,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;IAOrB,OAAO,CAAC,aAAa;
|
|
1
|
+
{"version":3,"file":"NodeArtisanCommand.d.ts","sourceRoot":"","sources":["../../../Framework/lib/Command-Line/NodeArtisanCommand.ts"],"names":[],"mappings":";AAEA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAapC,qBAAa,aAAa;IAExB,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;IAOrB,OAAO,CAAC,aAAa;IAiMrB,KAAK,CAAC,IAAI,EAAE,MAAM,EAAE;CAIrB"}
|
|
@@ -46,11 +46,13 @@ class ConsoleKernel {
|
|
|
46
46
|
if (!secondArg) {
|
|
47
47
|
this.make.createModel(firstArg);
|
|
48
48
|
}
|
|
49
|
-
if (secondArg
|
|
49
|
+
if (secondArg && secondArg.includes("m")) {
|
|
50
50
|
//
|
|
51
|
-
this.make.createModel(firstArg);
|
|
52
|
-
this.make.createController(`${(0, inflection_1.pluralize)(firstArg)}Controller`);
|
|
53
51
|
this.make.createMigration(`create_${(0, util_1.pluralizeStr)(firstArg)}_table`, "");
|
|
52
|
+
if (secondArg && secondArg.includes("c")) {
|
|
53
|
+
this.make.createController(`${(0, inflection_1.pluralize)(firstArg)}Controller`);
|
|
54
|
+
}
|
|
55
|
+
this.make.createModel(firstArg);
|
|
54
56
|
}
|
|
55
57
|
process.exit(0);
|
|
56
58
|
});
|
|
@@ -62,7 +64,36 @@ class ConsoleKernel {
|
|
|
62
64
|
process.exit(0);
|
|
63
65
|
});
|
|
64
66
|
this.defineCommand("make:migration").action((firstArg, secondArg) => {
|
|
65
|
-
|
|
67
|
+
if (secondArg && secondArg.includes("=")) {
|
|
68
|
+
this.make.createMigration(firstArg, secondArg.split("=")[1]);
|
|
69
|
+
}
|
|
70
|
+
else {
|
|
71
|
+
this.make.createMigration(firstArg, "");
|
|
72
|
+
}
|
|
73
|
+
process.exit(0);
|
|
74
|
+
});
|
|
75
|
+
this.defineCommand("make:event").action(async (firstArg, secondArg) => {
|
|
76
|
+
this.make.createEvent(firstArg);
|
|
77
|
+
// await Queue.start();
|
|
78
|
+
});
|
|
79
|
+
this.defineCommand("make:listener").action(async (firstArg, secondArg) => {
|
|
80
|
+
if (secondArg && secondArg.includes("=")) {
|
|
81
|
+
const getClass = secondArg.split("=")[1];
|
|
82
|
+
this.make.createEventListener(firstArg, getClass);
|
|
83
|
+
}
|
|
84
|
+
else {
|
|
85
|
+
this.make.createEventListener(firstArg);
|
|
86
|
+
}
|
|
87
|
+
// await Queue.start();
|
|
88
|
+
});
|
|
89
|
+
//make:queue-table
|
|
90
|
+
this.defineCommand("make:queue-table").action(async (firstArg, secondArg) => {
|
|
91
|
+
this.make.createQueueTable();
|
|
92
|
+
await this.migrate.runMigration();
|
|
93
|
+
process.exit(0);
|
|
94
|
+
});
|
|
95
|
+
this.defineCommand("make:job").action(async (firstArg, secondArg) => {
|
|
96
|
+
this.make.createJob(firstArg);
|
|
66
97
|
process.exit(0);
|
|
67
98
|
});
|
|
68
99
|
this.defineCommand("migrate").action(async (firstArg, secondArg) => {
|
|
@@ -100,10 +131,16 @@ class ConsoleKernel {
|
|
|
100
131
|
});
|
|
101
132
|
this.defineCommand("queue:work").action(async (firstArg, secondArg) => {
|
|
102
133
|
console.log("Starting the queue worker...");
|
|
103
|
-
|
|
134
|
+
const queue = app.resolve("Queue");
|
|
135
|
+
await queue.work();
|
|
104
136
|
});
|
|
105
137
|
this.defineCommand("route:list").action(async (firstArg, secondArg) => {
|
|
106
|
-
|
|
138
|
+
if (firstArg && firstArg.includes("middleware")) {
|
|
139
|
+
await this.route.display(firstArg.split(/\=/g)[1]);
|
|
140
|
+
}
|
|
141
|
+
else {
|
|
142
|
+
await this.route.display();
|
|
143
|
+
}
|
|
107
144
|
process.exit(0);
|
|
108
145
|
});
|
|
109
146
|
this.defineCommand("db-tinker").action((firstArg, secondArg) => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RouteCommand.d.ts","sourceRoot":"","sources":["../../../Framework/lib/Command-Line/RouteCommand.ts"],"names":[],"mappings":"AAOA,qBAAa,YAAY;YACT,iBAAiB;IAe/B,OAAO,CAAC,WAAW;IAgBnB,OAAO,CAAC,QAAQ;YAIF,YAAY;
|
|
1
|
+
{"version":3,"file":"RouteCommand.d.ts","sourceRoot":"","sources":["../../../Framework/lib/Command-Line/RouteCommand.ts"],"names":[],"mappings":"AAOA,qBAAa,YAAY;YACT,iBAAiB;IAe/B,OAAO,CAAC,WAAW;IAgBnB,OAAO,CAAC,QAAQ;YAIF,YAAY;IA+C1B,OAAO,CAAC,gBAAgB;IAsBlB,OAAO,CAAC,UAAU,CAAC,EAAE,MAAM;CAGlC"}
|
|
@@ -35,9 +35,12 @@ class RouteCommand {
|
|
|
35
35
|
colorUrl(url) {
|
|
36
36
|
return url.replace(/(:\w+)/g, (match) => colors_1.default.rainbow(match));
|
|
37
37
|
}
|
|
38
|
-
async formatRoutes() {
|
|
38
|
+
async formatRoutes(middleware) {
|
|
39
39
|
try {
|
|
40
|
-
const
|
|
40
|
+
const routeLists = (await this.callRouteProvider()) || [];
|
|
41
|
+
const routes = middleware
|
|
42
|
+
? routeLists.filter((route) => this.formatMiddleware(route.middlewares).includes(middleware))
|
|
43
|
+
: routeLists;
|
|
41
44
|
const table = new cli_table3_1.default({
|
|
42
45
|
head: [
|
|
43
46
|
colors_1.default.cyan("Method"),
|
|
@@ -65,7 +68,7 @@ class RouteCommand {
|
|
|
65
68
|
: "-",
|
|
66
69
|
]);
|
|
67
70
|
}
|
|
68
|
-
console.log(table.toString());
|
|
71
|
+
routes.length ? console.log(table.toString()) : "";
|
|
69
72
|
}
|
|
70
73
|
catch (error) {
|
|
71
74
|
console.log(error.message);
|
|
@@ -94,8 +97,8 @@ class RouteCommand {
|
|
|
94
97
|
})
|
|
95
98
|
.join(", ");
|
|
96
99
|
}
|
|
97
|
-
async display() {
|
|
98
|
-
await this.formatRoutes();
|
|
100
|
+
async display(middleware) {
|
|
101
|
+
await this.formatRoutes(middleware);
|
|
99
102
|
}
|
|
100
103
|
}
|
|
101
104
|
exports.RouteCommand = RouteCommand;
|
|
@@ -5,5 +5,9 @@ export declare class MakeCommand {
|
|
|
5
5
|
createRequest(requestName: string): any;
|
|
6
6
|
createMigration(migrationName: string, optionalTable: string): any;
|
|
7
7
|
createSeeder(name: string): any;
|
|
8
|
+
createEvent(event: string): any;
|
|
9
|
+
createJob(job: string): any;
|
|
10
|
+
createEventListener(event: string, listener?: string): any;
|
|
11
|
+
createQueueTable(): void;
|
|
8
12
|
}
|
|
9
13
|
//# sourceMappingURL=command.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"command.d.ts","sourceRoot":"","sources":["../../../Framework/lib/Command-Line/command.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"command.d.ts","sourceRoot":"","sources":["../../../Framework/lib/Command-Line/command.ts"],"names":[],"mappings":"AAkBA,qBAAa,WAAW;IACtB,gBAAgB,CAAC,cAAc,EAAE,MAAM,EAAE,SAAS,UAAQ,GAAG,GAAG;IAkChE,mBAAmB,CAAC,cAAc,EAAE,MAAM,EAAE,SAAS,UAAQ,GAAG,GAAG;IAkDnE,WAAW,CAAC,SAAS,EAAE,MAAM,GAAG,GAAG;IAoBnC,aAAa,CAAC,WAAW,EAAE,MAAM,GAAG,GAAG;IA0BvC,eAAe,CAAC,aAAa,EAAE,MAAM,EAAE,aAAa,EAAE,MAAM,GAAG,GAAG;IA4BlE,YAAY,CAAC,IAAI,EAAE,MAAM,GAAG,GAAG;IA2B/B,WAAW,CAAC,KAAK,EAAE,MAAM,GAAG,GAAG;IA8B/B,SAAS,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG;IA8B3B,mBAAmB,CAAC,KAAK,EAAE,MAAM,EAAE,QAAQ,CAAC,EAAE,MAAM,GAAG,GAAG;IAmC1D,gBAAgB;CA8BjB"}
|
|
@@ -15,6 +15,10 @@ const Migration_1 = __importDefault(require("./files/Migration"));
|
|
|
15
15
|
const colors_1 = __importDefault(require("colors"));
|
|
16
16
|
const utils_1 = require("./utils");
|
|
17
17
|
const Seeder_1 = __importDefault(require("./files/Seeder"));
|
|
18
|
+
const Event_1 = __importDefault(require("./files/Event"));
|
|
19
|
+
const Listener_1 = __importDefault(require("./files/Listener"));
|
|
20
|
+
const jobs_1 = require("./files/jobs");
|
|
21
|
+
const jobClass_1 = require("./files/jobClass");
|
|
18
22
|
const rootPath = app_root_path_1.default.path;
|
|
19
23
|
colors_1.default.enable();
|
|
20
24
|
class MakeCommand {
|
|
@@ -134,7 +138,7 @@ class MakeCommand {
|
|
|
134
138
|
}
|
|
135
139
|
catch (err) {
|
|
136
140
|
return console.log(colors_1.default.red(`${migrationName} migration not added`), {
|
|
137
|
-
err,
|
|
141
|
+
err: err?.message,
|
|
138
142
|
}); // Log error if request addition fails
|
|
139
143
|
}
|
|
140
144
|
}
|
|
@@ -160,5 +164,100 @@ class MakeCommand {
|
|
|
160
164
|
}); // Log error if request addition fails
|
|
161
165
|
}
|
|
162
166
|
}
|
|
167
|
+
createEvent(event) {
|
|
168
|
+
try {
|
|
169
|
+
if (!event) {
|
|
170
|
+
console.log(colors_1.default.red("Please give a name for your controller"));
|
|
171
|
+
return;
|
|
172
|
+
}
|
|
173
|
+
const eventsPath = path_1.default.resolve(`${rootPath}/app/Events`);
|
|
174
|
+
if (!fs_1.default.existsSync(eventsPath)) {
|
|
175
|
+
fs_1.default.mkdirSync(eventsPath, { recursive: true });
|
|
176
|
+
}
|
|
177
|
+
const eventFile = `${eventsPath}/${event}.ts`;
|
|
178
|
+
if (fs_1.default.existsSync(eventFile)) {
|
|
179
|
+
console.log(colors_1.default.yellow(`${eventsPath} Event already exists`));
|
|
180
|
+
return;
|
|
181
|
+
}
|
|
182
|
+
fs_1.default.writeFileSync(`${eventsPath}/${event}.ts`, (0, Event_1.default)(event) // Create a basic controller file
|
|
183
|
+
);
|
|
184
|
+
return console.log(`${event} Event added successfully [${eventFile}]`);
|
|
185
|
+
}
|
|
186
|
+
catch (err) {
|
|
187
|
+
console.log(colors_1.default.red(`${event} Event not added`));
|
|
188
|
+
console.log(err.message);
|
|
189
|
+
}
|
|
190
|
+
}
|
|
191
|
+
createJob(job) {
|
|
192
|
+
try {
|
|
193
|
+
if (!job) {
|
|
194
|
+
console.log(colors_1.default.red("Please give a name for your Job"));
|
|
195
|
+
return;
|
|
196
|
+
}
|
|
197
|
+
const jobsPath = path_1.default.resolve(`${rootPath}/app/Jobs`);
|
|
198
|
+
if (!fs_1.default.existsSync(jobsPath)) {
|
|
199
|
+
fs_1.default.mkdirSync(jobsPath, { recursive: true });
|
|
200
|
+
}
|
|
201
|
+
const jobFile = `${jobsPath}/${job}.ts`;
|
|
202
|
+
if (fs_1.default.existsSync(jobFile)) {
|
|
203
|
+
console.log(colors_1.default.yellow(`${jobsPath} Event already exists`));
|
|
204
|
+
return;
|
|
205
|
+
}
|
|
206
|
+
fs_1.default.writeFileSync(`${jobsPath}/${job}.ts`, (0, jobClass_1.createJobClass)(job) // Create a basic controller file
|
|
207
|
+
);
|
|
208
|
+
return console.log(`${job} Job added successfully [${jobFile}]`);
|
|
209
|
+
}
|
|
210
|
+
catch (err) {
|
|
211
|
+
console.log(colors_1.default.red(`${job} Job not added`));
|
|
212
|
+
console.log(err.message);
|
|
213
|
+
}
|
|
214
|
+
}
|
|
215
|
+
createEventListener(event, listener) {
|
|
216
|
+
try {
|
|
217
|
+
if (!event) {
|
|
218
|
+
console.log(colors_1.default.red("Please give a name for your controller"));
|
|
219
|
+
return;
|
|
220
|
+
}
|
|
221
|
+
const eventsListenerPath = path_1.default.resolve(`${rootPath}/app/Listener`);
|
|
222
|
+
if (!fs_1.default.existsSync(eventsListenerPath)) {
|
|
223
|
+
fs_1.default.mkdirSync(eventsListenerPath, { recursive: true });
|
|
224
|
+
}
|
|
225
|
+
const eventFile = `${eventsListenerPath}/${event}.ts`;
|
|
226
|
+
if (fs_1.default.existsSync(eventFile)) {
|
|
227
|
+
console.log(colors_1.default.yellow(`${eventsListenerPath} Event listner already exists`));
|
|
228
|
+
return;
|
|
229
|
+
}
|
|
230
|
+
fs_1.default.writeFileSync(`${eventsListenerPath}/${event}.ts`, (0, Listener_1.default)(event, listener) // Create a basic controller file
|
|
231
|
+
);
|
|
232
|
+
return console.log(`${event} Event listener added successfully [${eventFile}]`);
|
|
233
|
+
}
|
|
234
|
+
catch (err) {
|
|
235
|
+
console.log(colors_1.default.red(`${event} Event listener not added`));
|
|
236
|
+
console.log(err.message);
|
|
237
|
+
}
|
|
238
|
+
}
|
|
239
|
+
createQueueTable() {
|
|
240
|
+
try {
|
|
241
|
+
let migrationPath = path_1.default.resolve(`${rootPath}/database/migrations`);
|
|
242
|
+
if (!fs_1.default.existsSync(migrationPath)) {
|
|
243
|
+
fs_1.default.mkdirSync(migrationPath, { recursive: true });
|
|
244
|
+
}
|
|
245
|
+
if (fs_1.default.existsSync(`${migrationPath}/jobs.ts`)) {
|
|
246
|
+
// Check if request file already exists
|
|
247
|
+
return console.log(colors_1.default.yellow(`jobs table already exist`)); // Log a warning if request file already exists
|
|
248
|
+
}
|
|
249
|
+
if (fs_1.default.existsSync(`${migrationPath}/failed_jobs.ts`)) {
|
|
250
|
+
// Check if request file already exists
|
|
251
|
+
return console.log(colors_1.default.yellow(`failed_jobs table already exist`)); // Log a warning if request file already exists
|
|
252
|
+
}
|
|
253
|
+
fs_1.default.writeFileSync(`${migrationPath}/${(0, utils_1.formatDate)()}_jobs_table.ts`, jobs_1.jobsMigration);
|
|
254
|
+
fs_1.default.writeFileSync(`${migrationPath}/${(0, utils_1.formatDate)()}__failed_jobs_table.ts`, jobs_1.failedJobsMigration);
|
|
255
|
+
return console.log(colors_1.default.green("Queue table created successfully"));
|
|
256
|
+
}
|
|
257
|
+
catch (error) {
|
|
258
|
+
console.log(colors_1.default.red("Queue table not created"));
|
|
259
|
+
console.log(error);
|
|
260
|
+
}
|
|
261
|
+
}
|
|
163
262
|
}
|
|
164
263
|
exports.MakeCommand = MakeCommand;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Event.d.ts","sourceRoot":"","sources":["../../../../Framework/lib/Command-Line/files/Event.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,QAAA,MAAM,WAAW,GAAI,MAAM,MAAM,KAAG,MAiBnC,CAAC;AAEF,eAAe,WAAW,CAAC"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
/**
|
|
4
|
+
* Function to create a controller file
|
|
5
|
+
* @param name string
|
|
6
|
+
* @returns string
|
|
7
|
+
*/
|
|
8
|
+
const createEvent = (name) => {
|
|
9
|
+
return `
|
|
10
|
+
|
|
11
|
+
import { Inject } from "jcc-express-mvc/Core/Dependency";
|
|
12
|
+
|
|
13
|
+
@Inject()
|
|
14
|
+
export class ${name}{
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
constructor() {
|
|
18
|
+
//
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
//
|
|
23
|
+
}
|
|
24
|
+
`;
|
|
25
|
+
};
|
|
26
|
+
exports.default = createEvent;
|