jcc-express-mvc 1.6.7 → 1.6.16

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.
Files changed (161) hide show
  1. package/Core/Date.d.ts +2 -0
  2. package/Core/Date.d.ts.map +1 -0
  3. package/Core/Date.js +17 -0
  4. package/Eloquent.d.ts +2 -0
  5. package/Eloquent.d.ts.map +1 -0
  6. package/Eloquent.js +17 -0
  7. package/index.d.ts +2 -0
  8. package/index.d.ts.map +1 -1
  9. package/index.js +2 -1
  10. package/lib/Application/Application.d.ts +1 -0
  11. package/lib/Application/Application.d.ts.map +1 -1
  12. package/lib/Application/Application.js +4 -3
  13. package/lib/Auth/index.d.ts.map +1 -1
  14. package/lib/Auth/index.js +4 -2
  15. package/lib/Command-Line/InertiaCommand.d.ts.map +1 -1
  16. package/lib/Command-Line/MigrateCommand.js +7 -7
  17. package/lib/Command-Line/RouteCommand.d.ts.map +1 -1
  18. package/lib/Command-Line/RouteCommand.js +1 -1
  19. package/lib/Command-Line/buildCommand.d.ts.map +1 -1
  20. package/lib/Command-Line/buildCommand.js +5 -2
  21. package/lib/Command-Line/files/Controller.d.ts.map +1 -1
  22. package/lib/Command-Line/files/Controller.js +10 -7
  23. package/lib/Command-Line/files/Migration.js +1 -1
  24. package/lib/Command-Line/files/Models.js +1 -1
  25. package/lib/Command-Line/files/Request.js +1 -1
  26. package/lib/Config/Config.js +1 -1
  27. package/lib/Container/index.d.ts +13 -0
  28. package/lib/Container/index.d.ts.map +1 -1
  29. package/lib/Container/index.js +157 -1
  30. package/lib/Date/index.d.ts +24 -0
  31. package/lib/Date/index.d.ts.map +1 -0
  32. package/lib/Date/index.js +143 -0
  33. package/lib/Dependancy/index.d.ts +1 -1
  34. package/lib/Dependancy/index.d.ts.map +1 -1
  35. package/lib/Dependancy/index.js +7 -24
  36. package/lib/Error/DisplayErrorCode.d.ts +1 -13
  37. package/lib/Error/DisplayErrorCode.d.ts.map +1 -1
  38. package/lib/Error/DisplayErrorCode.js +91 -23
  39. package/lib/Interface/index.d.ts +5 -0
  40. package/lib/Interface/index.d.ts.map +1 -1
  41. package/lib/Jcc-eloquent/index.d.ts +4 -0
  42. package/lib/Jcc-eloquent/index.d.ts.map +1 -0
  43. package/lib/Jcc-eloquent/index.js +19 -0
  44. package/lib/Jcc-eloquent/lib/Attribute.d.ts +11 -0
  45. package/lib/Jcc-eloquent/lib/Attribute.d.ts.map +1 -0
  46. package/lib/Jcc-eloquent/lib/Attribute.js +13 -0
  47. package/lib/Jcc-eloquent/lib/BaseModel.d.ts +41 -0
  48. package/lib/Jcc-eloquent/lib/BaseModel.d.ts.map +1 -0
  49. package/lib/Jcc-eloquent/lib/BaseModel.js +196 -0
  50. package/lib/Jcc-eloquent/lib/Builder.d.ts +108 -0
  51. package/lib/Jcc-eloquent/lib/Builder.d.ts.map +1 -0
  52. package/lib/Jcc-eloquent/lib/Builder.js +526 -0
  53. package/lib/Jcc-eloquent/lib/Cast/index.d.ts +11 -0
  54. package/lib/Jcc-eloquent/lib/Cast/index.d.ts.map +1 -0
  55. package/lib/Jcc-eloquent/lib/Cast/index.js +98 -0
  56. package/lib/Jcc-eloquent/lib/Cast/types.d.ts +16 -0
  57. package/lib/Jcc-eloquent/lib/Cast/types.d.ts.map +1 -0
  58. package/lib/Jcc-eloquent/lib/Cast/types.js +25 -0
  59. package/lib/Jcc-eloquent/lib/DB/index.d.ts +9 -0
  60. package/lib/Jcc-eloquent/lib/DB/index.d.ts.map +1 -0
  61. package/lib/Jcc-eloquent/lib/DB/index.js +24 -0
  62. package/lib/Jcc-eloquent/lib/Database/index.d.ts +17 -0
  63. package/lib/Jcc-eloquent/lib/Database/index.d.ts.map +1 -0
  64. package/lib/Jcc-eloquent/lib/Database/index.js +60 -0
  65. package/lib/Jcc-eloquent/lib/Date/index.d.ts +10 -0
  66. package/lib/Jcc-eloquent/lib/Date/index.d.ts.map +1 -0
  67. package/lib/Jcc-eloquent/lib/Date/index.js +56 -0
  68. package/lib/Jcc-eloquent/lib/Error/DatabaseError.d.ts +6 -0
  69. package/lib/Jcc-eloquent/lib/Error/DatabaseError.d.ts.map +1 -0
  70. package/lib/Jcc-eloquent/lib/Error/DatabaseError.js +12 -0
  71. package/lib/Jcc-eloquent/lib/Error/constant.d.ts +31 -0
  72. package/lib/Jcc-eloquent/lib/Error/constant.d.ts.map +1 -0
  73. package/lib/Jcc-eloquent/lib/Error/constant.js +33 -0
  74. package/lib/Jcc-eloquent/lib/Event/Event.d.ts +20 -0
  75. package/lib/Jcc-eloquent/lib/Event/Event.d.ts.map +1 -0
  76. package/lib/Jcc-eloquent/lib/Event/Event.js +40 -0
  77. package/lib/Jcc-eloquent/lib/Event/ModelEvent.d.ts +14 -0
  78. package/lib/Jcc-eloquent/lib/Event/ModelEvent.d.ts.map +1 -0
  79. package/lib/Jcc-eloquent/lib/Event/ModelEvent.js +43 -0
  80. package/lib/Jcc-eloquent/lib/Interfaces/index.d.ts +88 -0
  81. package/lib/Jcc-eloquent/lib/Interfaces/index.d.ts.map +1 -0
  82. package/lib/Jcc-eloquent/lib/Interfaces/index.js +2 -0
  83. package/lib/Jcc-eloquent/lib/Migration.d.ts +2 -0
  84. package/lib/Jcc-eloquent/lib/Migration.d.ts.map +1 -0
  85. package/lib/Jcc-eloquent/lib/Migration.js +129 -0
  86. package/lib/Jcc-eloquent/lib/Model.d.ts +60 -0
  87. package/lib/Jcc-eloquent/lib/Model.d.ts.map +1 -0
  88. package/lib/Jcc-eloquent/lib/Model.js +343 -0
  89. package/lib/Jcc-eloquent/lib/QueryBuilder.d.ts +307 -0
  90. package/lib/Jcc-eloquent/lib/QueryBuilder.d.ts.map +1 -0
  91. package/lib/Jcc-eloquent/lib/QueryBuilder.js +533 -0
  92. package/lib/Jcc-eloquent/lib/Relations/BelongsTo.d.ts +8 -0
  93. package/lib/Jcc-eloquent/lib/Relations/BelongsTo.d.ts.map +1 -0
  94. package/lib/Jcc-eloquent/lib/Relations/BelongsTo.js +23 -0
  95. package/lib/Jcc-eloquent/lib/Relations/BelongsToMany.d.ts +24 -0
  96. package/lib/Jcc-eloquent/lib/Relations/BelongsToMany.d.ts.map +1 -0
  97. package/lib/Jcc-eloquent/lib/Relations/BelongsToMany.js +67 -0
  98. package/lib/Jcc-eloquent/lib/Relations/EagerLoading.d.ts +40 -0
  99. package/lib/Jcc-eloquent/lib/Relations/EagerLoading.d.ts.map +1 -0
  100. package/lib/Jcc-eloquent/lib/Relations/EagerLoading.js +214 -0
  101. package/lib/Jcc-eloquent/lib/Relations/HasMany.d.ts +7 -0
  102. package/lib/Jcc-eloquent/lib/Relations/HasMany.d.ts.map +1 -0
  103. package/lib/Jcc-eloquent/lib/Relations/HasMany.js +19 -0
  104. package/lib/Jcc-eloquent/lib/Relations/HasOne.d.ts +7 -0
  105. package/lib/Jcc-eloquent/lib/Relations/HasOne.d.ts.map +1 -0
  106. package/lib/Jcc-eloquent/lib/Relations/HasOne.js +15 -0
  107. package/lib/Jcc-eloquent/lib/Relations/MorphMany.d.ts +11 -0
  108. package/lib/Jcc-eloquent/lib/Relations/MorphMany.d.ts.map +1 -0
  109. package/lib/Jcc-eloquent/lib/Relations/MorphMany.js +26 -0
  110. package/lib/Jcc-eloquent/lib/Relations/MorphOne.d.ts +11 -0
  111. package/lib/Jcc-eloquent/lib/Relations/MorphOne.d.ts.map +1 -0
  112. package/lib/Jcc-eloquent/lib/Relations/MorphOne.js +28 -0
  113. package/lib/Jcc-eloquent/lib/Relations/MorphTo.d.ts +10 -0
  114. package/lib/Jcc-eloquent/lib/Relations/MorphTo.d.ts.map +1 -0
  115. package/lib/Jcc-eloquent/lib/Relations/MorphTo.js +53 -0
  116. package/lib/Jcc-eloquent/lib/Relations/Relation.d.ts +24 -0
  117. package/lib/Jcc-eloquent/lib/Relations/Relation.d.ts.map +1 -0
  118. package/lib/Jcc-eloquent/lib/Relations/Relation.js +43 -0
  119. package/lib/Jcc-eloquent/lib/Relations/index.d.ts +9 -0
  120. package/lib/Jcc-eloquent/lib/Relations/index.d.ts.map +1 -0
  121. package/lib/Jcc-eloquent/lib/Relations/index.js +24 -0
  122. package/lib/Jcc-eloquent/lib/Rollback.d.ts +23 -0
  123. package/lib/Jcc-eloquent/lib/Rollback.d.ts.map +1 -0
  124. package/lib/Jcc-eloquent/lib/Rollback.js +74 -0
  125. package/lib/Jcc-eloquent/lib/Schema/BaseSchemaEntity/index.d.ts +33 -0
  126. package/lib/Jcc-eloquent/lib/Schema/BaseSchemaEntity/index.d.ts.map +1 -0
  127. package/lib/Jcc-eloquent/lib/Schema/BaseSchemaEntity/index.js +163 -0
  128. package/lib/Jcc-eloquent/lib/Schema/BluePrint/index.d.ts +392 -0
  129. package/lib/Jcc-eloquent/lib/Schema/BluePrint/index.d.ts.map +1 -0
  130. package/lib/Jcc-eloquent/lib/Schema/BluePrint/index.js +771 -0
  131. package/lib/Jcc-eloquent/lib/Schema/Translator/Sqlite.d.ts +28 -0
  132. package/lib/Jcc-eloquent/lib/Schema/Translator/Sqlite.d.ts.map +1 -0
  133. package/lib/Jcc-eloquent/lib/Schema/Translator/Sqlite.js +204 -0
  134. package/lib/Jcc-eloquent/lib/Schema/Translator/index.d.ts +4 -0
  135. package/lib/Jcc-eloquent/lib/Schema/Translator/index.d.ts.map +1 -0
  136. package/lib/Jcc-eloquent/lib/Schema/Translator/index.js +21 -0
  137. package/lib/Jcc-eloquent/lib/Schema/Translator/postgres.d.ts +22 -0
  138. package/lib/Jcc-eloquent/lib/Schema/Translator/postgres.d.ts.map +1 -0
  139. package/lib/Jcc-eloquent/lib/Schema/Translator/postgres.js +77 -0
  140. package/lib/Jcc-eloquent/lib/Schema/index.d.ts +36 -0
  141. package/lib/Jcc-eloquent/lib/Schema/index.d.ts.map +1 -0
  142. package/lib/Jcc-eloquent/lib/Schema/index.js +219 -0
  143. package/lib/Jcc-eloquent/lib/Types/index.d.ts +11 -0
  144. package/lib/Jcc-eloquent/lib/Types/index.d.ts.map +1 -0
  145. package/lib/Jcc-eloquent/lib/Types/index.js +2 -0
  146. package/lib/Jcc-eloquent/lib/utils/index.d.ts +121 -0
  147. package/lib/Jcc-eloquent/lib/utils/index.d.ts.map +1 -0
  148. package/lib/Jcc-eloquent/lib/utils/index.js +316 -0
  149. package/lib/Middleware/index.d.ts.map +1 -1
  150. package/lib/Middleware/index.js +1 -1
  151. package/lib/Routes/RouteBuilder.d.ts +2 -34
  152. package/lib/Routes/RouteBuilder.d.ts.map +1 -1
  153. package/lib/Routes/RouteBuilder.js +8 -40
  154. package/lib/Type/index.d.ts +1 -0
  155. package/lib/Type/index.d.ts.map +1 -1
  156. package/lib/util/Str.d.ts.map +1 -1
  157. package/lib/util/Str.js +4 -1
  158. package/lib/util/index.d.ts +3 -0
  159. package/lib/util/index.d.ts.map +1 -1
  160. package/lib/util/index.js +24 -2
  161. package/package.json +1 -1
package/Core/Date.d.ts ADDED
@@ -0,0 +1,2 @@
1
+ export * from "../lib/Date";
2
+ //# sourceMappingURL=Date.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Date.d.ts","sourceRoot":"","sources":["../../Framework/Core/Date.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAC"}
package/Core/Date.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/Date"), exports);
package/Eloquent.d.ts ADDED
@@ -0,0 +1,2 @@
1
+ export * from "./lib/Jcc-eloquent";
2
+ //# sourceMappingURL=Eloquent.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Eloquent.d.ts","sourceRoot":"","sources":["../Framework/Eloquent.ts"],"names":[],"mappings":"AAAA,cAAc,oBAAoB,CAAC"}
package/Eloquent.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/Jcc-eloquent"), exports);
package/index.d.ts CHANGED
@@ -1,8 +1,10 @@
1
1
  export { Authentication as Auth } from "./lib/Auth";
2
2
  export { config } from "./lib/Config/Config";
3
3
  export type { AppRequest as Request, AppResponse as Response, AppNext as Next, } from "./lib/Interface";
4
+ import { HttpContext as AppHttpContext } from "./lib/Interface";
4
5
  export { bcrypt, verifyHash, jwtSign, jwtVerify, saveImage, asyncHandler, cloudinaryUpload, } from "./lib/util";
5
6
  export declare const guest: (req: import("./lib/Interface").AppRequest, res: import("./lib/Interface").AppResponse, next: import("./lib/Interface").AppNext) => any;
6
7
  export declare const apiAuth: (req: import("./lib/Interface").AppRequest, res: import("./lib/Interface").AppResponse, next: import("./lib/Interface").AppNext) => Promise<import("./lib/Interface").AppResponse | undefined>;
7
8
  export declare const auth: (req: import("./lib/Interface").AppRequest, res: import("./lib/Interface").AppResponse, next: import("./lib/Interface").AppNext) => Promise<void>;
9
+ export declare const httpContext: AppHttpContext;
8
10
  //# 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":"AACA,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;AAEzB,OAAO,EACL,MAAM,EACN,UAAU,EACV,OAAO,EACP,SAAS,EACT,SAAS,EACT,YAAY,EACZ,gBAAgB,GACjB,MAAM,YAAY,CAAC;AAEpB,eAAO,MAAM,KAAK,yIAAuB,CAAC;AAC1C,eAAO,MAAM,OAAO,gMAAyB,CAAC;AAC9C,eAAO,MAAM,IAAI,mJAAsB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../Framework/index.ts"],"names":[],"mappings":"AACA,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,GACjB,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.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.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; } });
@@ -17,3 +17,4 @@ Object.defineProperty(exports, "cloudinaryUpload", { enumerable: true, get: func
17
17
  exports.guest = AuthMiddleware_1.authMiddleware.guest;
18
18
  exports.apiAuth = AuthMiddleware_1.authMiddleware.apiAuth;
19
19
  exports.auth = AuthMiddleware_1.authMiddleware.auth;
20
+ exports.httpContext = {};
@@ -16,5 +16,6 @@ export declare class Application extends ExpressApplication {
16
16
  version(): string;
17
17
  run(): Promise<void>;
18
18
  static configuration(): ApplicationBuilder;
19
+ static getInstance(): Application;
19
20
  }
20
21
  //# sourceMappingURL=Application.d.ts.map
@@ -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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O;IAKR,GAAG,IAAI,OAAO,CAAC,IAAI,CAAC;IAiB1B,MAAM,CAAC,aAAa;IAIpB,MAAM,CAAC,WAAW;CAGnB"}
@@ -10,7 +10,6 @@ const RouteServiceProvider_1 = require("../Providers/RouteServiceProvider");
10
10
  const ExpressApplication_1 = require("../Express/ExpressApplication");
11
11
  const Server_1 = require("../Server");
12
12
  const RouteBuilder_1 = require("../Routes/RouteBuilder");
13
- const dotenv_1 = __importDefault(require("dotenv"));
14
13
  const Config_1 = require("../Config/Config");
15
14
  const rootPath = app_root_path_1.default.path;
16
15
  class Application extends ExpressApplication_1.ExpressApplication {
@@ -22,7 +21,6 @@ class Application extends ExpressApplication_1.ExpressApplication {
22
21
  this.configRoutes = [];
23
22
  this.VERSION = "0.0.0";
24
23
  this.config = {};
25
- dotenv_1.default.config({ path: `${rootPath}/.env`, debug: false });
26
24
  this.instance("app", this);
27
25
  this.singleton("RouteServiceProvider", RouteServiceProvider_1.RouteServiceProvider);
28
26
  }
@@ -61,10 +59,13 @@ class Application extends ExpressApplication_1.ExpressApplication {
61
59
  RouteBuilder_1.RouteBuilder.setServiceContainer(this);
62
60
  await routeServiceProvider.loadRoutes(this.configRoutes);
63
61
  const server = new Server_1.Server(this);
64
- server.server(Number(Config_1.config.get("PORT", "5500")));
62
+ server.server(Number(Config_1.config.get("PORT", "")));
65
63
  }
66
64
  static configuration() {
67
65
  return new ApplicationBuilder_1.ApplicationBuilder(new Application()).withConsole();
68
66
  }
67
+ static getInstance() {
68
+ return new this();
69
+ }
69
70
  }
70
71
  exports.Application = Application;
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../Framework/lib/Auth/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,WAAW,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAahE,qBAAa,cAAc;IACzB,qDAAqD;IACrD,OAAO,CAAC,MAAM,CAAC,cAAc;IAc7B,0DAA0D;mBACrC,OAAO;IAuB5B,4CAA4C;IAC5C,OAAO,CAAC,MAAM,CAAC,SAAS;IAuBxB,gCAAgC;IAChC,MAAM,CAAC,OAAO,GAAU,KAAK,UAAU,EAAE,KAAK,WAAW,EAAE,MAAM,OAAO,iCAsBtE;IAEF,+BAA+B;WAClB,YAAY,CAAC,GAAG,EAAE,UAAU,EAAE,GAAG,EAAE,WAAW,EAAE,IAAI,EAAE,OAAO;IAmB1E,qBAAqB;IACrB,MAAM,CAAC,MAAM,CAAC,GAAG,EAAE,UAAU,EAAE,GAAG,EAAE,WAAW;CAKhD"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../Framework/lib/Auth/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,WAAW,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAehE,qBAAa,cAAc;IACzB,qDAAqD;IACrD,OAAO,CAAC,MAAM,CAAC,cAAc;IAc7B,0DAA0D;mBACrC,OAAO;IAoB5B,4CAA4C;IAC5C,OAAO,CAAC,MAAM,CAAC,SAAS;IAuBxB,gCAAgC;IAChC,MAAM,CAAC,OAAO,GAAU,KAAK,UAAU,EAAE,KAAK,WAAW,EAAE,MAAM,OAAO,iCAsBtE;IAEF,+BAA+B;WAClB,YAAY,CAAC,GAAG,EAAE,UAAU,EAAE,GAAG,EAAE,WAAW,EAAE,IAAI,EAAE,OAAO;IAmB1E,qBAAqB;IACrB,MAAM,CAAC,MAAM,CAAC,GAAG,EAAE,UAAU,EAAE,GAAG,EAAE,WAAW;CAKhD"}
package/lib/Auth/index.js CHANGED
@@ -5,6 +5,7 @@ exports.Authentication = void 0;
5
5
  const util_1 = require("../util");
6
6
  const Config_1 = require("../Config/Config");
7
7
  const ValidationException_1 = require("../Error/ValidationException");
8
+ const Jcc_eloquent_1 = require("../Jcc-eloquent");
8
9
  const { User } = (0, util_1.getModel)("User");
9
10
  class Authentication {
10
11
  /** Get user lookup field (email, phone, username) */
@@ -36,8 +37,9 @@ class Authentication {
36
37
  }
37
38
  else {
38
39
  // JCC ORM
39
- User.hidden = User.hidden.filter((v) => v !== "password");
40
- user = await User.where(Object.keys(field)[0], Object.values(field)[0]).first();
40
+ user = await Jcc_eloquent_1.DB.table("users")
41
+ .where(Object.keys(field)[0], Object.values(field)[0])
42
+ .first();
41
43
  }
42
44
  return { user, field: Object.keys(field)[0] || "email" };
43
45
  }
@@ -1 +1 @@
1
- {"version":3,"file":"InertiaCommand.d.ts","sourceRoot":"","sources":["../../../Framework/lib/Command-Line/InertiaCommand.ts"],"names":[],"mappings":"AASA,qBAAa,cAAc;IACzB,MAAM,CAAC,UAAU,EAAE,GAAG,CAAQ;IAE9B,MAAM,CAAC,eAAe;IA0BtB,MAAM,CAAC,cAAc;CAStB"}
1
+ {"version":3,"file":"InertiaCommand.d.ts","sourceRoot":"","sources":["../../../Framework/lib/Command-Line/InertiaCommand.ts"],"names":[],"mappings":"AAKA,qBAAa,cAAc;IACzB,MAAM,CAAC,UAAU,EAAE,GAAG,CAAQ;IAE9B,MAAM,CAAC,eAAe;IA0BtB,MAAM,CAAC,cAAc;CAStB"}
@@ -4,7 +4,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.Migrate = void 0;
7
- const jcc_eloquent_1 = require("jcc-eloquent");
7
+ const Jcc_eloquent_1 = require("../Jcc-eloquent");
8
8
  const app_root_path_1 = __importDefault(require("app-root-path"));
9
9
  const rootPath = app_root_path_1.default.path;
10
10
  class Migrate {
@@ -12,18 +12,18 @@ class Migrate {
12
12
  this.migrationPath = `${rootPath}/database/migrations`;
13
13
  }
14
14
  rollback(steps) {
15
- return jcc_eloquent_1.DB.rollback(Number(steps), this.migrationPath);
15
+ return Jcc_eloquent_1.DB.rollback(Number(steps), this.migrationPath);
16
16
  }
17
17
  async fresh() {
18
- const steps = await jcc_eloquent_1.Model.select().from("migrations").count();
19
- return jcc_eloquent_1.DB.rollback(steps, this.migrationPath);
18
+ const steps = await Jcc_eloquent_1.Model.select().from("migrations").count();
19
+ return Jcc_eloquent_1.DB.rollback(steps, this.migrationPath);
20
20
  }
21
21
  async reset() {
22
- const steps = await jcc_eloquent_1.Model.select().from("migrations").count();
23
- return jcc_eloquent_1.DB.rollback(steps, this.migrationPath);
22
+ const steps = await Jcc_eloquent_1.Model.select().from("migrations").count();
23
+ return Jcc_eloquent_1.DB.rollback(steps, this.migrationPath);
24
24
  }
25
25
  async runMigration() {
26
- return jcc_eloquent_1.DB.migrate(this.migrationPath);
26
+ return Jcc_eloquent_1.DB.migrate(this.migrationPath);
27
27
  }
28
28
  }
29
29
  exports.Migrate = Migrate;
@@ -1 +1 @@
1
- {"version":3,"file":"RouteCommand.d.ts","sourceRoot":"","sources":["../../../Framework/lib/Command-Line/RouteCommand.ts"],"names":[],"mappings":"AAQA,qBAAa,YAAY;YACT,iBAAiB;IAc/B,OAAO,CAAC,WAAW;IAgBnB,OAAO,CAAC,QAAQ;YAIF,YAAY;IAwC1B,OAAO,CAAC,gBAAgB;IAsBlB,OAAO;CAGd"}
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;IAwC1B,OAAO,CAAC,gBAAgB;IAsBlB,OAAO;CAGd"}
@@ -8,9 +8,9 @@ const app_root_path_1 = __importDefault(require("app-root-path"));
8
8
  const RouteBuilder_1 = require("../Routes/RouteBuilder");
9
9
  const colors_1 = __importDefault(require("colors"));
10
10
  const cli_table3_1 = __importDefault(require("cli-table3"));
11
- const bootstrap = require(`${app_root_path_1.default.path}/bootstrap/app`);
12
11
  class RouteCommand {
13
12
  async callRouteProvider() {
13
+ const bootstrap = require(`${app_root_path_1.default.path}/bootstrap/app`);
14
14
  const app = bootstrap.app;
15
15
  const routeServiceProvider = app.resolve("RouteServiceProvider");
16
16
  RouteBuilder_1.RouteBuilder.setServiceContainer(app);
@@ -1 +1 @@
1
- {"version":3,"file":"buildCommand.d.ts","sourceRoot":"","sources":["../../../Framework/lib/Command-Line/buildCommand.ts"],"names":[],"mappings":"AAMA,eAAO,MAAM,YAAY,iBAWxB,CAAC"}
1
+ {"version":3,"file":"buildCommand.d.ts","sourceRoot":"","sources":["../../../Framework/lib/Command-Line/buildCommand.ts"],"names":[],"mappings":"AAMA,eAAO,MAAM,YAAY,iBAexB,CAAC"}
@@ -4,17 +4,20 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.BuildCommand = void 0;
7
- const TsConfig_1 = require("./files/TsConfig");
8
7
  const fs_extra_1 = __importDefault(require("fs-extra"));
9
8
  const colors_1 = __importDefault(require("colors"));
10
9
  const fs_1 = __importDefault(require("fs"));
11
10
  const app_root_path_1 = __importDefault(require("app-root-path"));
12
11
  const BuildCommand = () => {
13
12
  try {
14
- fs_1.default.writeFileSync(`${app_root_path_1.default.path}/build/tsconfig.json`, (0, TsConfig_1.TsConfig)());
13
+ const rootPath = `${app_root_path_1.default.path}/bootstrap/ssr`;
14
+ // fs.writeFileSync(`${appRootPath.path}/build/tsconfig.json`, TsConfig());
15
15
  fs_extra_1.default.copySync("resources", "build/resources");
16
16
  fs_extra_1.default.copySync("public", "build/public");
17
17
  fs_extra_1.default.copyFileSync("package.json", "build/package.json");
18
+ if (fs_1.default.existsSync(rootPath)) {
19
+ fs_extra_1.default.copySync("bootstrap/ssr", "bootstrap/ssr");
20
+ }
18
21
  console.log(colors_1.default.green(`App build successfully`));
19
22
  return process.exit(0);
20
23
  }
@@ -1 +1 @@
1
- {"version":3,"file":"Controller.d.ts","sourceRoot":"","sources":["../../../../Framework/lib/Command-Line/files/Controller.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,QAAA,MAAM,gBAAgB,GAAI,MAAM,MAAM,KAAG,MAkExC,CAAC;AAEF,eAAe,gBAAgB,CAAC"}
1
+ {"version":3,"file":"Controller.d.ts","sourceRoot":"","sources":["../../../../Framework/lib/Command-Line/files/Controller.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,QAAA,MAAM,gBAAgB,GAAI,MAAM,MAAM,KAAG,MAqExC,CAAC;AAEF,eAAe,gBAAgB,CAAC"}
@@ -7,14 +7,16 @@ Object.defineProperty(exports, "__esModule", { value: true });
7
7
  */
8
8
  const createController = (name) => {
9
9
  return `
10
- import {Request, Response,Next} from "jcc-express-mvc"
10
+ import {httpContext} from "jcc-express-mvc"
11
+ import { Inject, Method } from "jcc-express-mvc/Core/Dependency";
11
12
 
13
+ @Inject()
12
14
  export class ${name}{
13
15
  /**
14
16
  *@access public
15
17
  * @return Express Request Response
16
18
  */
17
- async create(req:Request,res:Response,next:Next)
19
+ async create({ req, res, next } = httpContext)
18
20
  {
19
21
  //
20
22
  }
@@ -22,7 +24,8 @@ const createController = (name) => {
22
24
  *@access public
23
25
  * @return Express Request Response
24
26
  */
25
- async index(req:Request,res:Response,next:Next)
27
+ @Method()
28
+ async index({ req, res, next } = httpContext)
26
29
  {
27
30
  //
28
31
  }
@@ -32,7 +35,7 @@ const createController = (name) => {
32
35
  *@access public
33
36
  * @return Express Request Response
34
37
  */
35
- async store(req:Request,res:Response,next:Next)
38
+ async store({ req, res, next } = httpContext)
36
39
  {
37
40
  //
38
41
  }
@@ -42,7 +45,7 @@ const createController = (name) => {
42
45
  *@param {id} - string
43
46
  * @return Express Request Response
44
47
  */
45
- async show(req:Request,res:Response,next:Next)
48
+ async show({ req, res, next } = httpContext)
46
49
  {
47
50
  //
48
51
  }
@@ -53,7 +56,7 @@ const createController = (name) => {
53
56
  * @param {id} - string
54
57
  * @return Express Request Response
55
58
  */
56
- async update(req:Request,res:Response,next:Next)
59
+ async update({ req, res, next } = httpContext)
57
60
  {
58
61
  //
59
62
  }
@@ -63,7 +66,7 @@ const createController = (name) => {
63
66
  * @param {id} - string
64
67
  * @return Express Response
65
68
  */
66
- async destroy(req:Request,res:Response,next:Next)
69
+ async destroy({ req, res, next } = httpContext)
67
70
  {
68
71
  //
69
72
  }
@@ -41,7 +41,7 @@ const createMigration = (table, migrationName, optionalTable) => {
41
41
  table.timestamps();
42
42
  table.softDeletes();`;
43
43
  const tableName = schemaAction === "create" ? (0, inflection_1.pluralize)(table) : (0, inflection_1.pluralize)(optionalTable);
44
- return `import {Schema} from "jcc-eloquent";
44
+ return `import {Schema} from "jcc-express-mvc/Eloquent";
45
45
  export class Migration {
46
46
  up() {
47
47
  return Schema.${schemaAction}("${tableName}", (table) => {
@@ -7,7 +7,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
7
7
  */
8
8
  const createModel = (name) => {
9
9
  return `
10
- import {Model} from "jcc-eloquent"
10
+ import {Model} from "jcc-express-mvc/Eloquent"
11
11
 
12
12
  export class ${name} extends Model{
13
13
  //
@@ -16,7 +16,7 @@ import {Request} from "jcc-express-mvc"
16
16
  }
17
17
 
18
18
 
19
- async rules (): Record<string, any>
19
+ async rules ()
20
20
  {
21
21
  await this.validate({
22
22
  //
@@ -10,7 +10,7 @@ class Config {
10
10
  constructor() {
11
11
  dotenv_1.default.config({
12
12
  path: `${app_root_path_1.default.path}/.env`,
13
- // quiet: false,
13
+ quiet: true,
14
14
  debug: false,
15
15
  });
16
16
  this.config = process.env;
@@ -1,4 +1,5 @@
1
1
  import "reflect-metadata";
2
+ import { AppNext, AppRequest, AppResponse } from "../Interface";
2
3
  export declare abstract class Container {
3
4
  private bindings;
4
5
  private instances;
@@ -11,6 +12,18 @@ export declare abstract class Container {
11
12
  resolve<T>(abstract: string, parameters?: any[], callFactory?: boolean): T;
12
13
  private isClass;
13
14
  build<T>(concrete: any, parameters?: any[]): T;
15
+ /**
16
+ * Call a method with dependency injection
17
+ * @param instance - The object instance
18
+ * @param methodName - The method name to call
19
+ * @param additionalParams - Additional parameters (like req, res, next for Express)
20
+ */
21
+ callMethod<T = any>(instance: any, methodName: string, req: AppRequest, res: AppResponse, next: AppNext): Promise<T>;
22
+ /**
23
+ * Helper to check if a type is an Express type (Request, Response, NextFunction)
24
+ * These should not be resolved from the container
25
+ */
26
+ private isExpressType;
14
27
  has(abstract: string): boolean;
15
28
  }
16
29
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../Framework/lib/Container/index.ts"],"names":[],"mappings":"AAAA,OAAO,kBAAkB,CAAC;AAE1B,8BAAsB,SAAS;IAC7B,OAAO,CAAC,QAAQ,CAA+B;IAC/C,OAAO,CAAC,SAAS,CAA+B;IAChD,OAAO,CAAC,OAAO,CAAkC;IAEjD,IAAI,CAAC,QAAQ,EAAE,MAAM,EAAE,QAAQ,EAAE,GAAG,EAAE,MAAM,GAAE,OAAe,GAAG,IAAI;IAI7D,IAAI,CAAC,CAAC,EAAE,MAAM,EAAE,KAAK,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,CAAC,GAAG,CAAC,GAAG,SAAS;IAKhE,SAAS,CAAC,QAAQ,EAAE,MAAM,EAAE,QAAQ,EAAE,GAAG,GAAG,IAAI;IAIhD,QAAQ,CAAC,QAAQ,EAAE,MAAM,EAAE,QAAQ,EAAE,GAAG,GAAG,IAAI;IAQ/C,KAAK,CAAC,QAAQ,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,IAAI;IAI5C,OAAO,CAAC,CAAC,EACP,QAAQ,EAAE,MAAM,EAChB,UAAU,GAAE,GAAG,EAAO,EACtB,WAAW,GAAE,OAAc,GAC1B,CAAC;IAyCJ,OAAO,CAAC,OAAO;IAIf,KAAK,CAAC,CAAC,EAAE,QAAQ,EAAE,GAAG,EAAE,UAAU,GAAE,GAAG,EAAO,GAAG,CAAC;IAoClD,GAAG,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO;CAO/B"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","s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O/B"}
@@ -2,6 +2,108 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.Container = void 0;
4
4
  require("reflect-metadata");
5
+ const Jcc_eloquent_1 = require("../Jcc-eloquent");
6
+ const FormRequest_1 = require("../Request/FormRequest");
7
+ const util_1 = require("../util");
8
+ // export abstract class Container {
9
+ // private bindings: Map<string, any> = new Map();
10
+ // private instances: Map<string, any> = new Map();
11
+ // private aliases: Map<string, string> = new Map();
12
+ // bind(abstract: string, concrete: any, shared: boolean = false): void {
13
+ // this.bindings.set(abstract, { concrete, shared });
14
+ // }
15
+ // public make<T>(target: new (...args: any[]) => T): T | undefined {
16
+ // this.bind(target.name, target);
17
+ // return this.resolve(target.name);
18
+ // }
19
+ // singleton(abstract: string, concrete: any): void {
20
+ // this.bind(abstract, concrete, true);
21
+ // }
22
+ // instance(abstract: string, instance: any): void {
23
+ // this.instances.set(abstract, instance);
24
+ // if (this.aliases.has(abstract)) {
25
+ // this.instances.set(this.aliases.get(abstract)!, instance);
26
+ // }
27
+ // }
28
+ // alias(abstract: string, alias: string): void {
29
+ // this.aliases.set(alias, abstract);
30
+ // }
31
+ // resolve<T>(
32
+ // abstract: string,
33
+ // parameters: any[] = [],
34
+ // callFactory: boolean = true
35
+ // ): T {
36
+ // if (this.instances.has(abstract)) {
37
+ // return this.instances.get(abstract) as T;
38
+ // }
39
+ // if (this.aliases.has(abstract)) {
40
+ // return this.resolve<T>(this.aliases.get(abstract)!, parameters);
41
+ // }
42
+ // const binding = this.bindings.get(abstract);
43
+ // if (!binding) {
44
+ // if (typeof abstract === "function") {
45
+ // return this.build<T>(abstract, parameters);
46
+ // }
47
+ // throw new Error(`No binding registered for ${abstract}`);
48
+ // }
49
+ // const concrete = binding.concrete;
50
+ // if (typeof concrete === "function" && !this.isClass(concrete)) {
51
+ // if (!callFactory) {
52
+ // return concrete;
53
+ // }
54
+ // const instance = concrete(this, ...parameters) as T;
55
+ // if (binding.shared) {
56
+ // this.instances.set(abstract, instance);
57
+ // }
58
+ // return instance;
59
+ // }
60
+ // const instance = this.build<T>(concrete, parameters);
61
+ // if (binding.shared) {
62
+ // this.instances.set(abstract, instance);
63
+ // }
64
+ // return instance;
65
+ // }
66
+ // private isClass(func: any): boolean {
67
+ // return typeof func === "function" && /^\s*class\s+/.test(func.toString());
68
+ // }
69
+ // build<T>(concrete: any, parameters: any[] = []): T {
70
+ // if (typeof concrete === "function" && !this.isClass(concrete)) {
71
+ // return concrete(this, ...parameters) as T;
72
+ // }
73
+ // const shouldInject =
74
+ // Reflect.getMetadata("design:paramtypes", concrete) || [];
75
+ // let injections: any[] = [];
76
+ // if (shouldInject) {
77
+ // const paramTypes =
78
+ // Reflect.getMetadata("design:paramtypes", concrete) || [];
79
+ // injections = paramTypes.map((param: any, index: number) => {
80
+ // if (parameters[index] !== undefined) {
81
+ // return parameters[index];
82
+ // }
83
+ // if (param && param.name) {
84
+ // try {
85
+ // return this.resolve(param.name);
86
+ // } catch (e) {
87
+ // return this.resolve(param);
88
+ // }
89
+ // }
90
+ // throw new Error(
91
+ // `Cannot resolve parameter at index ${index} for ${concrete.name}`
92
+ // );
93
+ // });
94
+ // } else {
95
+ // injections = parameters;
96
+ // }
97
+ // return new concrete(...injections);
98
+ // }
99
+ // has(abstract: string): boolean {
100
+ // return (
101
+ // this.bindings.has(abstract) ||
102
+ // this.instances.has(abstract) ||
103
+ // this.aliases.has(abstract)
104
+ // );
105
+ // }
106
+ // }
5
107
  class Container {
6
108
  constructor() {
7
109
  this.bindings = new Map();
@@ -67,7 +169,7 @@ class Container {
67
169
  }
68
170
  const shouldInject = Reflect.getMetadata("design:paramtypes", concrete) || [];
69
171
  let injections = [];
70
- if (shouldInject) {
172
+ if (shouldInject.length > 0) {
71
173
  const paramTypes = Reflect.getMetadata("design:paramtypes", concrete) || [];
72
174
  injections = paramTypes.map((param, index) => {
73
175
  if (parameters[index] !== undefined) {
@@ -89,6 +191,60 @@ class Container {
89
191
  }
90
192
  return new concrete(...injections);
91
193
  }
194
+ /**
195
+ * Call a method with dependency injection
196
+ * @param instance - The object instance
197
+ * @param methodName - The method name to call
198
+ * @param additionalParams - Additional parameters (like req, res, next for Express)
199
+ */
200
+ async callMethod(instance, methodName, req, res, next) {
201
+ try {
202
+ const methodDeps = Reflect.getMetadata("inject:method:deps", instance, methodName);
203
+ if (methodDeps && methodDeps.length > 0) {
204
+ const resolvedDeps = await Promise.all(methodDeps.map(async (dep) => {
205
+ if (!dep || !dep.name || dep.name === "Object") {
206
+ return null; // or throw / ignore
207
+ }
208
+ const resolved = this.resolve(dep);
209
+ if (resolved instanceof Jcc_eloquent_1.Model) {
210
+ // const param = req.params[Str.kebab(dep.name)];
211
+ // let dd = Object.keys(req.params).filter((param) => {
212
+ // if (param.includes("$" + Str.kebab(dep.name))) {
213
+ // const [column, data] = param.split(/\$/g);
214
+ // return { column, data };
215
+ // }
216
+ // });
217
+ return await (0, util_1.resolveModelBinding)(req, dep, resolved);
218
+ // console.log(dd);
219
+ // console.log(dd.includes(`$${dep.name}`));
220
+ // return param ? await dep.find(param) : resolved;
221
+ }
222
+ if (resolved instanceof FormRequest_1.FormRequest) {
223
+ return new dep(req);
224
+ }
225
+ return resolved;
226
+ }));
227
+ return instance[methodName].apply(instance, [
228
+ { req, res, next },
229
+ ...resolvedDeps,
230
+ ]);
231
+ }
232
+ return instance[methodName]({ req, res, next });
233
+ }
234
+ catch (error) {
235
+ throw error;
236
+ }
237
+ }
238
+ /**
239
+ * Helper to check if a type is an Express type (Request, Response, NextFunction)
240
+ * These should not be resolved from the container
241
+ */
242
+ isExpressType(type) {
243
+ if (!type || !type.name)
244
+ return false;
245
+ const expressTypes = ["Request", "Response", "NextFunction", "Function"];
246
+ return expressTypes.includes(type.name);
247
+ }
92
248
  has(abstract) {
93
249
  return (this.bindings.has(abstract) ||
94
250
  this.instances.has(abstract) ||
@@ -0,0 +1,24 @@
1
+ export declare class Carbon {
2
+ private date;
3
+ constructor(date: Date | string | number);
4
+ format(formatStr: string): string;
5
+ addDays(days: number): Carbon;
6
+ subDays(days: number): Carbon;
7
+ startOfDay(): Carbon;
8
+ endOfDay(): Carbon;
9
+ isBefore(otherDate: Date | string | number): boolean;
10
+ isAfter(otherDate: Date | string | number): boolean;
11
+ compare(otherDate: Date | string | number): number;
12
+ diffInDays(otherDate: Date | string | number): number;
13
+ static now(): Carbon;
14
+ static parse(dateString: string, formatString?: string): Date;
15
+ static today(): Carbon;
16
+ static yesterday(): Carbon;
17
+ static tomorrow(): Carbon;
18
+ static week(): Carbon;
19
+ static month(): Carbon;
20
+ static day(): Carbon;
21
+ static diff(date1: Date | string | number, date2: Date | string | number): number;
22
+ diffForHumans(otherDate: Date | string | number): string;
23
+ }
24
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../Framework/lib/Date/index.ts"],"names":[],"mappings":"AAuBA,qBAAa,MAAM;IACjB,OAAO,CAAC,IAAI,CAAO;gBAEP,IAAI,EAAE,IAAI,GAAG,MAAM,GAAG,MAAM;IASxC,MAAM,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM;IAKjC,OAAO,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM;IAM7B,OAAO,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM;IAM7B,UAAU,IAAI,MAAM;IAMpB,QAAQ,IAAI,MAAM;IAMlB,QAAQ,CAAC,SAAS,EAAE,IAAI,GAAG,MAAM,GAAG,MAAM,GAAG,OAAO;IAMpD,OAAO,CAAC,SAAS,EAAE,IAAI,GAAG,MAAM,GAAG,MAAM,GAAG,OAAO;IAMnD,OAAO,CAAC,SAAS,EAAE,IAAI,GAAG,MAAM,GAAG,MAAM,GAAG,MAAM;IAMlD,UAAU,CAAC,SAAS,EAAE,IAAI,GAAG,MAAM,GAAG,MAAM,GAAG,MAAM;IAMrD,MAAM,CAAC,GAAG,IAAI,MAAM;IAKpB,MAAM,CAAC,KAAK,CAAC,UAAU,EAAE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