@ereactthohir/core 1.1.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/README.md +39 -0
- package/dist/database/MigrationRunner.d.ts +21 -0
- package/dist/database/MigrationRunner.d.ts.map +1 -0
- package/dist/database/MigrationRunner.js +60 -0
- package/dist/database/MigrationRunner.js.map +1 -0
- package/dist/database/Model.d.ts +81 -0
- package/dist/database/Model.d.ts.map +1 -0
- package/dist/database/Model.js +186 -0
- package/dist/database/Model.js.map +1 -0
- package/dist/database/QueryBuilder.d.ts +132 -0
- package/dist/database/QueryBuilder.d.ts.map +1 -0
- package/dist/database/QueryBuilder.js +267 -0
- package/dist/database/QueryBuilder.js.map +1 -0
- package/dist/database/drivers/SawitDriver.d.ts +7 -0
- package/dist/database/drivers/SawitDriver.d.ts.map +1 -0
- package/dist/database/drivers/SawitDriver.js +28 -0
- package/dist/database/drivers/SawitDriver.js.map +1 -0
- package/dist/foundation/Application.d.ts +23 -0
- package/dist/foundation/Application.d.ts.map +1 -0
- package/dist/foundation/Application.js +71 -0
- package/dist/foundation/Application.js.map +1 -0
- package/dist/foundation/Cache.d.ts +35 -0
- package/dist/foundation/Cache.d.ts.map +1 -0
- package/dist/foundation/Cache.js +92 -0
- package/dist/foundation/Cache.js.map +1 -0
- package/dist/foundation/Config.d.ts +9 -0
- package/dist/foundation/Config.d.ts.map +1 -0
- package/dist/foundation/Config.js +31 -0
- package/dist/foundation/Config.js.map +1 -0
- package/dist/foundation/Container.d.ts +24 -0
- package/dist/foundation/Container.d.ts.map +1 -0
- package/dist/foundation/Container.js +94 -0
- package/dist/foundation/Container.js.map +1 -0
- package/dist/foundation/Env.d.ts +17 -0
- package/dist/foundation/Env.d.ts.map +1 -0
- package/dist/foundation/Env.js +57 -0
- package/dist/foundation/Env.js.map +1 -0
- package/dist/foundation/Events.d.ts +9 -0
- package/dist/foundation/Events.d.ts.map +1 -0
- package/dist/foundation/Events.js +23 -0
- package/dist/foundation/Events.js.map +1 -0
- package/dist/foundation/Hooks.d.ts +9 -0
- package/dist/foundation/Hooks.d.ts.map +1 -0
- package/dist/foundation/Hooks.js +28 -0
- package/dist/foundation/Hooks.js.map +1 -0
- package/dist/foundation/Logger.d.ts +6 -0
- package/dist/foundation/Logger.d.ts.map +1 -0
- package/dist/foundation/Logger.js +16 -0
- package/dist/foundation/Logger.js.map +1 -0
- package/dist/foundation/Middleware.d.ts +7 -0
- package/dist/foundation/Middleware.d.ts.map +1 -0
- package/dist/foundation/Middleware.js +7 -0
- package/dist/foundation/Middleware.js.map +1 -0
- package/dist/foundation/Pipeline.d.ts +14 -0
- package/dist/foundation/Pipeline.d.ts.map +1 -0
- package/dist/foundation/Pipeline.js +63 -0
- package/dist/foundation/Pipeline.js.map +1 -0
- package/dist/foundation/Queue.d.ts +11 -0
- package/dist/foundation/Queue.d.ts.map +1 -0
- package/dist/foundation/Queue.js +38 -0
- package/dist/foundation/Queue.js.map +1 -0
- package/dist/foundation/RateLimiter.d.ts +16 -0
- package/dist/foundation/RateLimiter.d.ts.map +1 -0
- package/dist/foundation/RateLimiter.js +51 -0
- package/dist/foundation/RateLimiter.js.map +1 -0
- package/dist/foundation/Scheduler.d.ts +10 -0
- package/dist/foundation/Scheduler.d.ts.map +1 -0
- package/dist/foundation/Scheduler.js +48 -0
- package/dist/foundation/Scheduler.js.map +1 -0
- package/dist/foundation/ServiceProvider.d.ts +23 -0
- package/dist/foundation/ServiceProvider.d.ts.map +1 -0
- package/dist/foundation/ServiceProvider.js +28 -0
- package/dist/foundation/ServiceProvider.js.map +1 -0
- package/dist/foundation/Session.d.ts +26 -0
- package/dist/foundation/Session.d.ts.map +1 -0
- package/dist/foundation/Session.js +59 -0
- package/dist/foundation/Session.js.map +1 -0
- package/dist/foundation/View.d.ts +6 -0
- package/dist/foundation/View.d.ts.map +1 -0
- package/dist/foundation/View.js +207 -0
- package/dist/foundation/View.js.map +1 -0
- package/dist/http/ApiResponse.d.ts +38 -0
- package/dist/http/ApiResponse.d.ts.map +1 -0
- package/dist/http/ApiResponse.js +152 -0
- package/dist/http/ApiResponse.js.map +1 -0
- package/dist/http/Controller.d.ts +3 -0
- package/dist/http/Controller.d.ts.map +1 -0
- package/dist/http/Controller.js +7 -0
- package/dist/http/Controller.js.map +1 -0
- package/dist/http/ExceptionHandler.d.ts +6 -0
- package/dist/http/ExceptionHandler.d.ts.map +1 -0
- package/dist/http/ExceptionHandler.js +32 -0
- package/dist/http/ExceptionHandler.js.map +1 -0
- package/dist/http/Kernel.d.ts +8 -0
- package/dist/http/Kernel.d.ts.map +1 -0
- package/dist/http/Kernel.js +59 -0
- package/dist/http/Kernel.js.map +1 -0
- package/dist/http/Middleware/AuthMiddleware.d.ts +8 -0
- package/dist/http/Middleware/AuthMiddleware.d.ts.map +1 -0
- package/dist/http/Middleware/AuthMiddleware.js +17 -0
- package/dist/http/Middleware/AuthMiddleware.js.map +1 -0
- package/dist/http/Request.d.ts +35 -0
- package/dist/http/Request.d.ts.map +1 -0
- package/dist/http/Request.js +106 -0
- package/dist/http/Request.js.map +1 -0
- package/dist/http/Response.d.ts +26 -0
- package/dist/http/Response.d.ts.map +1 -0
- package/dist/http/Response.js +90 -0
- package/dist/http/Response.js.map +1 -0
- package/dist/http/Router.d.ts +46 -0
- package/dist/http/Router.d.ts.map +1 -0
- package/dist/http/Router.js +150 -0
- package/dist/http/Router.js.map +1 -0
- package/dist/index.d.ts +38 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +55 -0
- package/dist/index.js.map +1 -0
- package/dist/security/CSRF.d.ts +18 -0
- package/dist/security/CSRF.d.ts.map +1 -0
- package/dist/security/CSRF.js +79 -0
- package/dist/security/CSRF.js.map +1 -0
- package/dist/security/Encrypter.d.ts +18 -0
- package/dist/security/Encrypter.d.ts.map +1 -0
- package/dist/security/Encrypter.js +75 -0
- package/dist/security/Encrypter.js.map +1 -0
- package/dist/security/InputSanitizer.d.ts +23 -0
- package/dist/security/InputSanitizer.d.ts.map +1 -0
- package/dist/security/InputSanitizer.js +65 -0
- package/dist/security/InputSanitizer.js.map +1 -0
- package/dist/security/PasswordHasher.d.ts +22 -0
- package/dist/security/PasswordHasher.d.ts.map +1 -0
- package/dist/security/PasswordHasher.js +68 -0
- package/dist/security/PasswordHasher.js.map +1 -0
- package/dist/services/Auth.d.ts +20 -0
- package/dist/services/Auth.d.ts.map +1 -0
- package/dist/services/Auth.js +28 -0
- package/dist/services/Auth.js.map +1 -0
- package/dist/services/Gate.d.ts +10 -0
- package/dist/services/Gate.d.ts.map +1 -0
- package/dist/services/Gate.js +36 -0
- package/dist/services/Gate.js.map +1 -0
- package/dist/services/Service.d.ts +4 -0
- package/dist/services/Service.d.ts.map +1 -0
- package/dist/services/Service.js +7 -0
- package/dist/services/Service.js.map +1 -0
- package/dist/services/Validator.d.ts +8 -0
- package/dist/services/Validator.d.ts.map +1 -0
- package/dist/services/Validator.js +39 -0
- package/dist/services/Validator.js.map +1 -0
- package/dist/src/database/Model.d.ts +13 -0
- package/dist/src/database/Model.d.ts.map +1 -0
- package/dist/src/database/Model.js +37 -0
- package/dist/src/database/Model.js.map +1 -0
- package/dist/src/database/QueryBuilder.d.ts +15 -0
- package/dist/src/database/QueryBuilder.d.ts.map +1 -0
- package/dist/src/database/QueryBuilder.js +43 -0
- package/dist/src/database/QueryBuilder.js.map +1 -0
- package/dist/src/database/drivers/SawitDriver.d.ts +7 -0
- package/dist/src/database/drivers/SawitDriver.d.ts.map +1 -0
- package/dist/src/database/drivers/SawitDriver.js +28 -0
- package/dist/src/database/drivers/SawitDriver.js.map +1 -0
- package/dist/src/foundation/Application.d.ts +13 -0
- package/dist/src/foundation/Application.d.ts.map +1 -0
- package/dist/src/foundation/Application.js +41 -0
- package/dist/src/foundation/Application.js.map +1 -0
- package/dist/src/foundation/Container.d.ts +11 -0
- package/dist/src/foundation/Container.d.ts.map +1 -0
- package/dist/src/foundation/Container.js +43 -0
- package/dist/src/foundation/Container.js.map +1 -0
- package/dist/src/foundation/Events.d.ts +9 -0
- package/dist/src/foundation/Events.d.ts.map +1 -0
- package/dist/src/foundation/Events.js +23 -0
- package/dist/src/foundation/Events.js.map +1 -0
- package/dist/src/foundation/Logger.d.ts +6 -0
- package/dist/src/foundation/Logger.d.ts.map +1 -0
- package/dist/src/foundation/Logger.js +16 -0
- package/dist/src/foundation/Logger.js.map +1 -0
- package/dist/src/foundation/Queue.d.ts +11 -0
- package/dist/src/foundation/Queue.d.ts.map +1 -0
- package/dist/src/foundation/Queue.js +38 -0
- package/dist/src/foundation/Queue.js.map +1 -0
- package/dist/src/foundation/Scheduler.d.ts +10 -0
- package/dist/src/foundation/Scheduler.d.ts.map +1 -0
- package/dist/src/foundation/Scheduler.js +48 -0
- package/dist/src/foundation/Scheduler.js.map +1 -0
- package/dist/src/foundation/ServiceProvider.d.ts +13 -0
- package/dist/src/foundation/ServiceProvider.d.ts.map +1 -0
- package/dist/src/foundation/ServiceProvider.js +14 -0
- package/dist/src/foundation/ServiceProvider.js.map +1 -0
- package/dist/src/foundation/View.d.ts +6 -0
- package/dist/src/foundation/View.d.ts.map +1 -0
- package/dist/src/foundation/View.js +37 -0
- package/dist/src/foundation/View.js.map +1 -0
- package/dist/src/http/Controller.d.ts +3 -0
- package/dist/src/http/Controller.d.ts.map +1 -0
- package/dist/src/http/Controller.js +7 -0
- package/dist/src/http/Controller.js.map +1 -0
- package/dist/src/http/ExceptionHandler.d.ts +6 -0
- package/dist/src/http/ExceptionHandler.d.ts.map +1 -0
- package/dist/src/http/ExceptionHandler.js +32 -0
- package/dist/src/http/ExceptionHandler.js.map +1 -0
- package/dist/src/http/Kernel.d.ts +8 -0
- package/dist/src/http/Kernel.d.ts.map +1 -0
- package/dist/src/http/Kernel.js +58 -0
- package/dist/src/http/Kernel.js.map +1 -0
- package/dist/src/http/Middleware/AuthMiddleware.d.ts +8 -0
- package/dist/src/http/Middleware/AuthMiddleware.d.ts.map +1 -0
- package/dist/src/http/Middleware/AuthMiddleware.js +17 -0
- package/dist/src/http/Middleware/AuthMiddleware.js.map +1 -0
- package/dist/src/http/Router.d.ts +27 -0
- package/dist/src/http/Router.d.ts.map +1 -0
- package/dist/src/http/Router.js +74 -0
- package/dist/src/http/Router.js.map +1 -0
- package/dist/src/index.d.ts +20 -0
- package/dist/src/index.d.ts.map +1 -0
- package/dist/src/index.js +37 -0
- package/dist/src/index.js.map +1 -0
- package/dist/src/services/Auth.d.ts +20 -0
- package/dist/src/services/Auth.d.ts.map +1 -0
- package/dist/src/services/Auth.js +28 -0
- package/dist/src/services/Auth.js.map +1 -0
- package/dist/src/services/Gate.d.ts +10 -0
- package/dist/src/services/Gate.d.ts.map +1 -0
- package/dist/src/services/Gate.js +36 -0
- package/dist/src/services/Gate.js.map +1 -0
- package/dist/src/services/Service.d.ts +4 -0
- package/dist/src/services/Service.d.ts.map +1 -0
- package/dist/src/services/Service.js +7 -0
- package/dist/src/services/Service.js.map +1 -0
- package/dist/src/services/Validator.d.ts +8 -0
- package/dist/src/services/Validator.d.ts.map +1 -0
- package/dist/src/services/Validator.js +39 -0
- package/dist/src/services/Validator.js.map +1 -0
- package/dist/testing/Factory.d.ts +31 -0
- package/dist/testing/Factory.d.ts.map +1 -0
- package/dist/testing/Factory.js +68 -0
- package/dist/testing/Factory.js.map +1 -0
- package/dist/testing/TestHelpers.d.ts +65 -0
- package/dist/testing/TestHelpers.d.ts.map +1 -0
- package/dist/testing/TestHelpers.js +141 -0
- package/dist/testing/TestHelpers.js.map +1 -0
- package/dist/tests/Application.test.d.ts +2 -0
- package/dist/tests/Application.test.d.ts.map +1 -0
- package/dist/tests/Application.test.js +22 -0
- package/dist/tests/Application.test.js.map +1 -0
- package/dist/tsconfig.tsbuildinfo +1 -0
- package/package.json +39 -0
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
export declare abstract class ServiceProvider {
|
|
2
|
+
protected app: any;
|
|
3
|
+
protected deferred: boolean;
|
|
4
|
+
protected providedServices: string[];
|
|
5
|
+
constructor(app: any);
|
|
6
|
+
/**
|
|
7
|
+
* Register any application services.
|
|
8
|
+
*/
|
|
9
|
+
abstract register(): void;
|
|
10
|
+
/**
|
|
11
|
+
* Bootstrap any application services.
|
|
12
|
+
*/
|
|
13
|
+
boot(): void;
|
|
14
|
+
/**
|
|
15
|
+
* Determine if the provider is deferred
|
|
16
|
+
*/
|
|
17
|
+
isDeferred(): boolean;
|
|
18
|
+
/**
|
|
19
|
+
* Get the services provided by this provider
|
|
20
|
+
*/
|
|
21
|
+
provides(): string[];
|
|
22
|
+
}
|
|
23
|
+
//# sourceMappingURL=ServiceProvider.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ServiceProvider.d.ts","sourceRoot":"","sources":["../../src/foundation/ServiceProvider.ts"],"names":[],"mappings":"AAAA,8BAAsB,eAAe;IACjC,SAAS,CAAC,GAAG,EAAE,GAAG,CAAC;IACnB,SAAS,CAAC,QAAQ,EAAE,OAAO,CAAS;IACpC,SAAS,CAAC,gBAAgB,EAAE,MAAM,EAAE,CAAM;gBAE9B,GAAG,EAAE,GAAG;IAIpB;;OAEG;IACH,QAAQ,CAAC,QAAQ,IAAI,IAAI;IAEzB;;OAEG;IACH,IAAI,IAAI,IAAI;IAEZ;;OAEG;IACH,UAAU,IAAI,OAAO;IAIrB;;OAEG;IACH,QAAQ,IAAI,MAAM,EAAE;CAGvB"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ServiceProvider = void 0;
|
|
4
|
+
class ServiceProvider {
|
|
5
|
+
constructor(app) {
|
|
6
|
+
this.deferred = false;
|
|
7
|
+
this.providedServices = [];
|
|
8
|
+
this.app = app;
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* Bootstrap any application services.
|
|
12
|
+
*/
|
|
13
|
+
boot() { }
|
|
14
|
+
/**
|
|
15
|
+
* Determine if the provider is deferred
|
|
16
|
+
*/
|
|
17
|
+
isDeferred() {
|
|
18
|
+
return this.deferred;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Get the services provided by this provider
|
|
22
|
+
*/
|
|
23
|
+
provides() {
|
|
24
|
+
return this.providedServices;
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
exports.ServiceProvider = ServiceProvider;
|
|
28
|
+
//# sourceMappingURL=ServiceProvider.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ServiceProvider.js","sourceRoot":"","sources":["../../src/foundation/ServiceProvider.ts"],"names":[],"mappings":";;;AAAA,MAAsB,eAAe;IAKjC,YAAY,GAAQ;QAHV,aAAQ,GAAY,KAAK,CAAC;QAC1B,qBAAgB,GAAa,EAAE,CAAC;QAGtC,IAAI,CAAC,GAAG,GAAG,GAAG,CAAC;IACnB,CAAC;IAOD;;OAEG;IACH,IAAI,KAAW,CAAC;IAEhB;;OAEG;IACH,UAAU;QACN,OAAO,IAAI,CAAC,QAAQ,CAAC;IACzB,CAAC;IAED;;OAEG;IACH,QAAQ;QACJ,OAAO,IAAI,CAAC,gBAAgB,CAAC;IACjC,CAAC;CACJ;AAhCD,0CAgCC"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Session Service - Secure session management
|
|
3
|
+
*/
|
|
4
|
+
export interface SessionConfig {
|
|
5
|
+
driver: 'memory' | 'file' | 'custom';
|
|
6
|
+
lifetime: number;
|
|
7
|
+
path?: string;
|
|
8
|
+
}
|
|
9
|
+
export declare class Session {
|
|
10
|
+
private data;
|
|
11
|
+
private config;
|
|
12
|
+
private sessionId;
|
|
13
|
+
constructor(config?: SessionConfig);
|
|
14
|
+
private generateSessionId;
|
|
15
|
+
put(key: string, value: any): void;
|
|
16
|
+
get(key: string, defaultValue?: any): any;
|
|
17
|
+
has(key: string): boolean;
|
|
18
|
+
forget(key: string): void;
|
|
19
|
+
flush(): void;
|
|
20
|
+
all(): Record<string, any>;
|
|
21
|
+
id(): string;
|
|
22
|
+
regenerate(): void;
|
|
23
|
+
push(key: string, value: any): void;
|
|
24
|
+
pull(key: string, defaultValue?: any): any;
|
|
25
|
+
}
|
|
26
|
+
//# sourceMappingURL=Session.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Session.d.ts","sourceRoot":"","sources":["../../src/foundation/Session.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,MAAM,WAAW,aAAa;IAC5B,MAAM,EAAE,QAAQ,GAAG,MAAM,GAAG,QAAQ,CAAC;IACrC,QAAQ,EAAE,MAAM,CAAC;IACjB,IAAI,CAAC,EAAE,MAAM,CAAC;CACf;AAED,qBAAa,OAAO;IAClB,OAAO,CAAC,IAAI,CAA0B;IACtC,OAAO,CAAC,MAAM,CAAgB;IAC9B,OAAO,CAAC,SAAS,CAAS;gBAEd,MAAM,GAAE,aAAmD;IAKvE,OAAO,CAAC,iBAAiB;IAIzB,GAAG,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,GAAG,GAAG,IAAI;IAIlC,GAAG,CAAC,GAAG,EAAE,MAAM,EAAE,YAAY,CAAC,EAAE,GAAG,GAAG,GAAG;IAIzC,GAAG,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO;IAIzB,MAAM,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI;IAIzB,KAAK,IAAI,IAAI;IAIb,GAAG,IAAI,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC;IAQ1B,EAAE,IAAI,MAAM;IAIZ,UAAU,IAAI,IAAI;IAKlB,IAAI,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,GAAG,GAAG,IAAI;IAQnC,IAAI,CAAC,GAAG,EAAE,MAAM,EAAE,YAAY,CAAC,EAAE,GAAG,GAAG,GAAG;CAK3C"}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Session Service - Secure session management
|
|
4
|
+
*/
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.Session = void 0;
|
|
7
|
+
class Session {
|
|
8
|
+
constructor(config = { driver: 'memory', lifetime: 120 }) {
|
|
9
|
+
this.data = new Map();
|
|
10
|
+
this.config = config;
|
|
11
|
+
this.sessionId = this.generateSessionId();
|
|
12
|
+
}
|
|
13
|
+
generateSessionId() {
|
|
14
|
+
return Math.random().toString(36).substring(2) + Date.now().toString(36);
|
|
15
|
+
}
|
|
16
|
+
put(key, value) {
|
|
17
|
+
this.data.set(key, value);
|
|
18
|
+
}
|
|
19
|
+
get(key, defaultValue) {
|
|
20
|
+
return this.data.get(key) ?? defaultValue;
|
|
21
|
+
}
|
|
22
|
+
has(key) {
|
|
23
|
+
return this.data.has(key);
|
|
24
|
+
}
|
|
25
|
+
forget(key) {
|
|
26
|
+
this.data.delete(key);
|
|
27
|
+
}
|
|
28
|
+
flush() {
|
|
29
|
+
this.data.clear();
|
|
30
|
+
}
|
|
31
|
+
all() {
|
|
32
|
+
const result = {};
|
|
33
|
+
this.data.forEach((value, key) => {
|
|
34
|
+
result[key] = value;
|
|
35
|
+
});
|
|
36
|
+
return result;
|
|
37
|
+
}
|
|
38
|
+
id() {
|
|
39
|
+
return this.sessionId;
|
|
40
|
+
}
|
|
41
|
+
regenerate() {
|
|
42
|
+
this.sessionId = this.generateSessionId();
|
|
43
|
+
this.flush();
|
|
44
|
+
}
|
|
45
|
+
push(key, value) {
|
|
46
|
+
const existing = this.get(key, []);
|
|
47
|
+
if (!Array.isArray(existing)) {
|
|
48
|
+
throw new Error(`Session value for "${key}" is not an array`);
|
|
49
|
+
}
|
|
50
|
+
this.put(key, [...existing, value]);
|
|
51
|
+
}
|
|
52
|
+
pull(key, defaultValue) {
|
|
53
|
+
const value = this.get(key, defaultValue);
|
|
54
|
+
this.forget(key);
|
|
55
|
+
return value;
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
exports.Session = Session;
|
|
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AE;YAC/B,MAAM,CAAC,GAAG,CAAC,GAAG,KAAK,CAAC;QACtB,CAAC,CAAC,CAAC;QACH,OAAO,MAAM,CAAC;IAChB,CAAC;IAED,EAAE;QACA,OAAO,IAAI,CAAC,SAAS,CAAC;IACxB,CAAC;IAED,UAAU;QACR,IAAI,CAAC,SAAS,GAAG,IAAI,CAAC,iBAAiB,EAAE,CAAC;QAC1C,IAAI,CAAC,KAAK,EAAE,CAAC;IACf,CAAC;IAED,IAAI,CAAC,GAAW,EAAE,KAAU;QAC1B,MAAM,QAAQ,GAAG,IAAI,CAAC,GAAG,CAAC,GAAG,EAAE,EAAE,CAAC,CAAC;QACnC,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,QAAQ,CAAC,EAAE,CAAC;YAC7B,MAAM,IAAI,KAAK,CAAC,sBAAsB,GAAG,mBAAmB,CAAC,CAAC;QAChE,CAAC;QACD,IAAI,CAAC,GAAG,CAAC,GAAG,EAAE,CAAC,GAAG,QAAQ,EAAE,KAAK,CAAC,CAAC,CAAC;IACtC,CAAC;IAED,IAAI,CAAC,GAAW,EAAE,YAAkB;QAClC,MAAM,KAAK,GAAG,IAAI,CAAC,GAAG,CAAC,GAAG,EAAE,YAAY,CAAC,CAAC;QAC1C,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;QACjB,OAAO,KAAK,CAAC;IACf,CAAC;CACF;AAhED,0BAgEC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"View.d.ts","sourceRoot":"","sources":["../../src/foundation/View.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AA+J1B,qBAAa,IAAI;WACC,MAAM,CAAC,SAAS,EAAE,KAAK,CAAC,YAAY,EAAE,IAAI,GAAE,GAAQ;CA4CrE;AAED,eAAO,MAAM,IAAI,oBAAc,CAAC"}
|
|
@@ -0,0 +1,207 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.view = exports.View = void 0;
|
|
4
|
+
const server_1 = require("react-dom/server");
|
|
5
|
+
// Import Rice UI styles
|
|
6
|
+
const riceCSS = `
|
|
7
|
+
/**
|
|
8
|
+
* Rice UI - Core CSS Framework
|
|
9
|
+
* The default and most powerful CSS framework for EreactThohir
|
|
10
|
+
*/
|
|
11
|
+
|
|
12
|
+
*, *::before, *::after {
|
|
13
|
+
box-sizing: border-box;
|
|
14
|
+
margin: 0;
|
|
15
|
+
padding: 0;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
:root {
|
|
19
|
+
--rice-primary-500: #3b82f6;
|
|
20
|
+
--rice-primary-600: #2563eb;
|
|
21
|
+
--rice-secondary-100: #f1f5f9;
|
|
22
|
+
--rice-secondary-200: #e2e8f0;
|
|
23
|
+
--rice-secondary-600: #475569;
|
|
24
|
+
--rice-secondary-900: #0f172a;
|
|
25
|
+
--rice-success-600: #059669;
|
|
26
|
+
--rice-space-2: 0.5rem;
|
|
27
|
+
--rice-space-4: 1rem;
|
|
28
|
+
--rice-space-6: 1.5rem;
|
|
29
|
+
--rice-space-8: 2rem;
|
|
30
|
+
--rice-space-12: 3rem;
|
|
31
|
+
--rice-space-16: 4rem;
|
|
32
|
+
--rice-text-sm: 0.875rem;
|
|
33
|
+
--rice-text-lg: 1.125rem;
|
|
34
|
+
--rice-text-xl: 1.25rem;
|
|
35
|
+
--rice-text-3xl: 1.875rem;
|
|
36
|
+
--rice-text-5xl: 3rem;
|
|
37
|
+
--rice-text-6xl: 3.75rem;
|
|
38
|
+
--rice-text-7xl: 4.5rem;
|
|
39
|
+
--rice-radius-lg: 0.5rem;
|
|
40
|
+
--rice-radius-xl: 0.75rem;
|
|
41
|
+
--rice-radius-2xl: 1rem;
|
|
42
|
+
--rice-radius-full: 9999px;
|
|
43
|
+
--rice-shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1);
|
|
44
|
+
--rice-shadow-xl: 0 20px 25px -5px rgb(0 0 0 / 0.1);
|
|
45
|
+
--rice-shadow-2xl: 0 25px 50px -12px rgb(0 0 0 / 0.25);
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
body {
|
|
49
|
+
font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
|
|
50
|
+
line-height: 1.5;
|
|
51
|
+
-webkit-font-smoothing: antialiased;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
.rice-min-h-screen { min-height: 100vh; }
|
|
55
|
+
.rice-bg-gradient { background: linear-gradient(135deg, #eff6ff 0%, #f3e8ff 50%, #fce7f3 100%); }
|
|
56
|
+
.rice-fixed { position: fixed; }
|
|
57
|
+
.rice-inset-0 { top: 0; right: 0; bottom: 0; left: 0; }
|
|
58
|
+
.rice-overflow-hidden { overflow: hidden; }
|
|
59
|
+
.rice-pointer-events-none { pointer-events: none; }
|
|
60
|
+
.rice-absolute { position: absolute; }
|
|
61
|
+
.rice-blur-3xl { filter: blur(64px); }
|
|
62
|
+
.rice-animate-pulse { animation: rice-pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite; }
|
|
63
|
+
.rice-relative { position: relative; }
|
|
64
|
+
.rice-z-10 { z-index: 10; }
|
|
65
|
+
.rice-p-6 { padding: 1.5rem; }
|
|
66
|
+
.rice-mb-16 { margin-bottom: 4rem; }
|
|
67
|
+
.rice-text-center { text-align: center; }
|
|
68
|
+
.rice-inline-flex { display: inline-flex; }
|
|
69
|
+
.rice-items-center { align-items: center; }
|
|
70
|
+
.rice-gap-2 { gap: 0.5rem; }
|
|
71
|
+
.rice-gap-4 { gap: 1rem; }
|
|
72
|
+
.rice-gap-6 { gap: 1.5rem; }
|
|
73
|
+
.rice-gap-8 { gap: 2rem; }
|
|
74
|
+
.rice-px-4 { padding-left: 1rem; padding-right: 1rem; }
|
|
75
|
+
.rice-py-2 { padding-top: 0.5rem; padding-bottom: 0.5rem; }
|
|
76
|
+
.rice-bg-white { background-color: white; }
|
|
77
|
+
.rice-glass { background: rgba(255, 255, 255, 0.6); backdrop-filter: blur(10px); }
|
|
78
|
+
.rice-rounded-full { border-radius: 9999px; }
|
|
79
|
+
.rice-rounded-lg { border-radius: 0.5rem; }
|
|
80
|
+
.rice-rounded-xl { border-radius: 0.75rem; }
|
|
81
|
+
.rice-rounded-2xl { border-radius: 1rem; }
|
|
82
|
+
.rice-shadow-lg { box-shadow: var(--rice-shadow-lg); }
|
|
83
|
+
.rice-shadow-xl { box-shadow: var(--rice-shadow-xl); }
|
|
84
|
+
.rice-shadow-2xl { box-shadow: var(--rice-shadow-2xl); }
|
|
85
|
+
.rice-border { border: 1px solid rgba(255, 255, 255, 0.2); }
|
|
86
|
+
.rice-text-5xl { font-size: 3rem; }
|
|
87
|
+
.rice-text-6xl { font-size: 3.75rem; }
|
|
88
|
+
.rice-text-7xl { font-size: 4.5rem; }
|
|
89
|
+
.rice-text-lg { font-size: 1.125rem; }
|
|
90
|
+
.rice-text-xl { font-size: 1.25rem; }
|
|
91
|
+
.rice-text-sm { font-size: 0.875rem; }
|
|
92
|
+
.rice-text-xs { font-size: 0.75rem; }
|
|
93
|
+
.rice-font-black { font-weight: 900; }
|
|
94
|
+
.rice-font-bold { font-weight: 700; }
|
|
95
|
+
.rice-font-semibold { font-weight: 600; }
|
|
96
|
+
.rice-font-medium { font-weight: 500; }
|
|
97
|
+
.rice-text-transparent { color: transparent; }
|
|
98
|
+
.rice-bg-clip-text { -webkit-background-clip: text; background-clip: text; }
|
|
99
|
+
.rice-gradient-primary { background: linear-gradient(to right, #4f46e5, #7c3aed, #ec4899); }
|
|
100
|
+
.rice-tracking-tight { letter-spacing: -0.025em; }
|
|
101
|
+
.rice-mb-4 { margin-bottom: 1rem; }
|
|
102
|
+
.rice-mb-8 { margin-bottom: 2rem; }
|
|
103
|
+
.rice-mb-12 { margin-bottom: 3rem; }
|
|
104
|
+
.rice-max-w-2xl { max-width: 42rem; }
|
|
105
|
+
.rice-mx-auto { margin-left: auto; margin-right: auto; }
|
|
106
|
+
.rice-flex { display: flex; }
|
|
107
|
+
.rice-flex-wrap { flex-wrap: wrap; }
|
|
108
|
+
.rice-justify-center { justify-content: center; }
|
|
109
|
+
.rice-grid { display: grid; }
|
|
110
|
+
.rice-grid-cols-1 { grid-template-columns: repeat(1, minmax(0, 1fr)); }
|
|
111
|
+
.rice-group { position: relative; }
|
|
112
|
+
.rice-p-6 { padding: 1.5rem; }
|
|
113
|
+
.rice-space-y-5 > * + * { margin-top: 1.25rem; }
|
|
114
|
+
.rice-space-y-4 > * + * { margin-top: 1rem; }
|
|
115
|
+
.rice-w-full { width: 100%; }
|
|
116
|
+
.rice-h-2 { height: 0.5rem; }
|
|
117
|
+
.rice-transition { transition: all 200ms cubic-bezier(0.4, 0, 0.2, 1); }
|
|
118
|
+
.rice-transition-all { transition: all 200ms cubic-bezier(0.4, 0, 0.2, 1); }
|
|
119
|
+
.rice-duration-300 { transition-duration: 300ms; }
|
|
120
|
+
.rice-hover-shadow-2xl:hover { box-shadow: var(--rice-shadow-2xl); }
|
|
121
|
+
.rice-hover-scale-105:hover { transform: scale(1.05); }
|
|
122
|
+
.rice-cursor-pointer { cursor: pointer; }
|
|
123
|
+
.rice-flex-col { flex-direction: column; }
|
|
124
|
+
.rice-justify-between { justify-content: space-between; }
|
|
125
|
+
.rice-mt-20 { margin-top: 5rem; }
|
|
126
|
+
.rice-pt-8 { padding-top: 2rem; }
|
|
127
|
+
.rice-border-t { border-top: 1px solid rgba(255, 255, 255, 0.3); }
|
|
128
|
+
|
|
129
|
+
@keyframes rice-pulse {
|
|
130
|
+
0%, 100% { opacity: 1; }
|
|
131
|
+
50% { opacity: 0.5; }
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
@keyframes rice-gradient {
|
|
135
|
+
0% { background-position: 0% 50%; }
|
|
136
|
+
50% { background-position: 100% 50%; }
|
|
137
|
+
100% { background-position: 0% 50%; }
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
.rice-animate-gradient {
|
|
141
|
+
background-size: 200% 200%;
|
|
142
|
+
animation: rice-gradient 3s ease infinite;
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
@media (min-width: 768px) {
|
|
146
|
+
.rice-md-p-10 { padding: 2.5rem; }
|
|
147
|
+
.rice-md-grid-cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
|
|
148
|
+
.rice-md-text-xl { font-size: 1.25rem; }
|
|
149
|
+
.rice-md-text-6xl { font-size: 3.75rem; }
|
|
150
|
+
.rice-md-flex-row { flex-direction: row; }
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
@media (min-width: 1024px) {
|
|
154
|
+
.rice-lg-p-12 { padding: 3rem; }
|
|
155
|
+
.rice-lg-grid-cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
|
|
156
|
+
.rice-lg-grid-cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
|
|
157
|
+
.rice-lg-text-7xl { font-size: 4.5rem; }
|
|
158
|
+
}
|
|
159
|
+
`;
|
|
160
|
+
class View {
|
|
161
|
+
static render(component, data = {}) {
|
|
162
|
+
const content = (0, server_1.renderToString)(component);
|
|
163
|
+
return `
|
|
164
|
+
<!DOCTYPE html>
|
|
165
|
+
<html lang="id">
|
|
166
|
+
<head>
|
|
167
|
+
<meta charset="UTF-8">
|
|
168
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
169
|
+
<title>EreactThohir App</title>
|
|
170
|
+
|
|
171
|
+
<!-- Google Fonts -->
|
|
172
|
+
<link rel="preconnect" href="https://fonts.googleapis.com">
|
|
173
|
+
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
|
|
174
|
+
<link href="https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800;900&display=swap" rel="stylesheet">
|
|
175
|
+
|
|
176
|
+
<!-- Rice UI - Default CSS Framework -->
|
|
177
|
+
<style id="rice-ui-core">
|
|
178
|
+
${riceCSS}
|
|
179
|
+
</style>
|
|
180
|
+
|
|
181
|
+
<!-- Optional: Tailwind CSS (if user chooses during installation) -->
|
|
182
|
+
<!-- <script src="https://cdn.tailwindcss.com"></script> -->
|
|
183
|
+
|
|
184
|
+
<!-- Optional: Bootstrap (if user chooses during installation) -->
|
|
185
|
+
<!-- <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/css/bootstrap.min.css" rel="stylesheet"> -->
|
|
186
|
+
</head>
|
|
187
|
+
<body>
|
|
188
|
+
<div id="root">${content}</div>
|
|
189
|
+
|
|
190
|
+
<!-- React for client-side hydration -->
|
|
191
|
+
<script crossorigin src="https://unpkg.com/react@18/umd/react.production.min.js"></script>
|
|
192
|
+
<script crossorigin src="https://unpkg.com/react-dom@18/umd/react-dom.production.min.js"></script>
|
|
193
|
+
|
|
194
|
+
<script>
|
|
195
|
+
// Client-side hydration for interactive components
|
|
196
|
+
if (typeof React !== 'undefined' && typeof ReactDOM !== 'undefined') {
|
|
197
|
+
console.log('✅ React loaded - Rice UI Framework active');
|
|
198
|
+
}
|
|
199
|
+
</script>
|
|
200
|
+
</body>
|
|
201
|
+
</html>
|
|
202
|
+
`;
|
|
203
|
+
}
|
|
204
|
+
}
|
|
205
|
+
exports.View = View;
|
|
206
|
+
exports.view = View.render;
|
|
207
|
+
//# sourceMappingURL=View.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"View.js","sourceRoot":"","sources":["../../src/foundation/View.ts"],"names":[],"mappings":";;;AACA,6CAAkD;AAElD,wBAAwB;AACxB,MAAM,OAAO,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAyJf,CAAC;AAEF,MAAa,IAAI;IACN,MAAM,CAAC,MAAM,CAAC,SAA6B,EAAE,OAAY,EAAE;QAC9D,MAAM,OAAO,GAAG,IAAA,uBAAc,EAAC,SAAS,CAAC,CAAC;QAE1C,OAAO;;;;;;;;;;;;;;;sBAeO,OAAO;;;;;;;;;;iCAUI,OAAO;;;;;;;;;;;;;;SAc/B,CAAC;IACN,CAAC;CACJ;AA7CD,oBA6CC;AAEY,QAAA,IAAI,GAAG,IAAI,CAAC,MAAM,CAAC"}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* API Response - Standardized API response format
|
|
3
|
+
*/
|
|
4
|
+
export interface ApiResponse<T = any> {
|
|
5
|
+
success: boolean;
|
|
6
|
+
code: number;
|
|
7
|
+
message: string;
|
|
8
|
+
data?: T;
|
|
9
|
+
errors?: Record<string, string[]>;
|
|
10
|
+
meta?: {
|
|
11
|
+
timestamp: number;
|
|
12
|
+
path: string;
|
|
13
|
+
version: string;
|
|
14
|
+
};
|
|
15
|
+
}
|
|
16
|
+
export declare class ApiResponseBuilder {
|
|
17
|
+
private statusCode;
|
|
18
|
+
private responseMessage;
|
|
19
|
+
private responseData;
|
|
20
|
+
private responseErrors;
|
|
21
|
+
private path;
|
|
22
|
+
private version;
|
|
23
|
+
status(code: number): this;
|
|
24
|
+
message(msg: string): this;
|
|
25
|
+
data<T>(data: T): ApiResponseBuilder;
|
|
26
|
+
errors(errors: Record<string, string[]>): this;
|
|
27
|
+
meta(path: string, version: string): this;
|
|
28
|
+
success(): ApiResponse;
|
|
29
|
+
error(): ApiResponse;
|
|
30
|
+
static ok<T>(data?: T, message?: string): ApiResponse<T>;
|
|
31
|
+
static created<T>(data?: T, message?: string): ApiResponse<T>;
|
|
32
|
+
static badRequest(errors: Record<string, string[]>, message?: string): ApiResponse;
|
|
33
|
+
static unauthorized(message?: string): ApiResponse;
|
|
34
|
+
static forbidden(message?: string): ApiResponse;
|
|
35
|
+
static notFound(message?: string): ApiResponse;
|
|
36
|
+
static serverError(message?: string): ApiResponse;
|
|
37
|
+
}
|
|
38
|
+
//# sourceMappingURL=ApiResponse.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EAAE,IAAI,CAAC,EAAE,CAAC,EAAE,OAAO,SAAqB,GAAG,WAAW,CAAC,CAAC,CAAC;IAczE,MAAM,CAAC,UAAU,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,EAAE,CAAC,EAAE,OAAO,SAAsB,GAAG,WAAW;IAc/F,MAAM,CAAC,YAAY,CAAC,OAAO,SAAiB,GAAG,WAAW;IAa1D,MAAM,CAAC,SAAS,CAAC,OAAO,SAAc,GAAG,WAAW;IAapD,MAAM,CAAC,QAAQ,CAAC,OAAO,SAAuB,GAAG,WAAW;IAa5D,MAAM,CAAC,WAAW,CAAC,OAAO,SAA0B,GAAG,WAAW;CAYnE"}
|
|
@@ -0,0 +1,152 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* API Response - Standardized API response format
|
|
4
|
+
*/
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.ApiResponseBuilder = void 0;
|
|
7
|
+
class ApiResponseBuilder {
|
|
8
|
+
constructor() {
|
|
9
|
+
this.statusCode = 200;
|
|
10
|
+
this.responseMessage = 'Success';
|
|
11
|
+
this.responseData = null;
|
|
12
|
+
this.responseErrors = {};
|
|
13
|
+
this.path = '';
|
|
14
|
+
this.version = '1.0.0';
|
|
15
|
+
}
|
|
16
|
+
status(code) {
|
|
17
|
+
this.statusCode = code;
|
|
18
|
+
return this;
|
|
19
|
+
}
|
|
20
|
+
message(msg) {
|
|
21
|
+
this.responseMessage = msg;
|
|
22
|
+
return this;
|
|
23
|
+
}
|
|
24
|
+
data(data) {
|
|
25
|
+
this.responseData = data;
|
|
26
|
+
return this;
|
|
27
|
+
}
|
|
28
|
+
errors(errors) {
|
|
29
|
+
this.responseErrors = errors;
|
|
30
|
+
return this;
|
|
31
|
+
}
|
|
32
|
+
meta(path, version) {
|
|
33
|
+
this.path = path;
|
|
34
|
+
this.version = version;
|
|
35
|
+
return this;
|
|
36
|
+
}
|
|
37
|
+
success() {
|
|
38
|
+
return {
|
|
39
|
+
success: true,
|
|
40
|
+
code: this.statusCode,
|
|
41
|
+
message: this.responseMessage,
|
|
42
|
+
data: this.responseData,
|
|
43
|
+
meta: {
|
|
44
|
+
timestamp: Date.now(),
|
|
45
|
+
path: this.path,
|
|
46
|
+
version: this.version,
|
|
47
|
+
},
|
|
48
|
+
};
|
|
49
|
+
}
|
|
50
|
+
error() {
|
|
51
|
+
return {
|
|
52
|
+
success: false,
|
|
53
|
+
code: this.statusCode,
|
|
54
|
+
message: this.responseMessage,
|
|
55
|
+
errors: this.responseErrors,
|
|
56
|
+
meta: {
|
|
57
|
+
timestamp: Date.now(),
|
|
58
|
+
path: this.path,
|
|
59
|
+
version: this.version,
|
|
60
|
+
},
|
|
61
|
+
};
|
|
62
|
+
}
|
|
63
|
+
static ok(data, message = 'Success') {
|
|
64
|
+
return {
|
|
65
|
+
success: true,
|
|
66
|
+
code: 200,
|
|
67
|
+
message,
|
|
68
|
+
data,
|
|
69
|
+
meta: {
|
|
70
|
+
timestamp: Date.now(),
|
|
71
|
+
path: '',
|
|
72
|
+
version: '1.0.0',
|
|
73
|
+
},
|
|
74
|
+
};
|
|
75
|
+
}
|
|
76
|
+
static created(data, message = 'Resource created') {
|
|
77
|
+
return {
|
|
78
|
+
success: true,
|
|
79
|
+
code: 201,
|
|
80
|
+
message,
|
|
81
|
+
data,
|
|
82
|
+
meta: {
|
|
83
|
+
timestamp: Date.now(),
|
|
84
|
+
path: '',
|
|
85
|
+
version: '1.0.0',
|
|
86
|
+
},
|
|
87
|
+
};
|
|
88
|
+
}
|
|
89
|
+
static badRequest(errors, message = 'Validation failed') {
|
|
90
|
+
return {
|
|
91
|
+
success: false,
|
|
92
|
+
code: 400,
|
|
93
|
+
message,
|
|
94
|
+
errors,
|
|
95
|
+
meta: {
|
|
96
|
+
timestamp: Date.now(),
|
|
97
|
+
path: '',
|
|
98
|
+
version: '1.0.0',
|
|
99
|
+
},
|
|
100
|
+
};
|
|
101
|
+
}
|
|
102
|
+
static unauthorized(message = 'Unauthorized') {
|
|
103
|
+
return {
|
|
104
|
+
success: false,
|
|
105
|
+
code: 401,
|
|
106
|
+
message,
|
|
107
|
+
meta: {
|
|
108
|
+
timestamp: Date.now(),
|
|
109
|
+
path: '',
|
|
110
|
+
version: '1.0.0',
|
|
111
|
+
},
|
|
112
|
+
};
|
|
113
|
+
}
|
|
114
|
+
static forbidden(message = 'Forbidden') {
|
|
115
|
+
return {
|
|
116
|
+
success: false,
|
|
117
|
+
code: 403,
|
|
118
|
+
message,
|
|
119
|
+
meta: {
|
|
120
|
+
timestamp: Date.now(),
|
|
121
|
+
path: '',
|
|
122
|
+
version: '1.0.0',
|
|
123
|
+
},
|
|
124
|
+
};
|
|
125
|
+
}
|
|
126
|
+
static notFound(message = 'Resource not found') {
|
|
127
|
+
return {
|
|
128
|
+
success: false,
|
|
129
|
+
code: 404,
|
|
130
|
+
message,
|
|
131
|
+
meta: {
|
|
132
|
+
timestamp: Date.now(),
|
|
133
|
+
path: '',
|
|
134
|
+
version: '1.0.0',
|
|
135
|
+
},
|
|
136
|
+
};
|
|
137
|
+
}
|
|
138
|
+
static serverError(message = 'Internal server error') {
|
|
139
|
+
return {
|
|
140
|
+
success: false,
|
|
141
|
+
code: 500,
|
|
142
|
+
message,
|
|
143
|
+
meta: {
|
|
144
|
+
timestamp: Date.now(),
|
|
145
|
+
path: '',
|
|
146
|
+
version: '1.0.0',
|
|
147
|
+
},
|
|
148
|
+
};
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
exports.ApiResponseBuilder = ApiResponseBuilder;
|
|
152
|
+
//# sourceMappingURL=ApiResponse.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ApiResponse.js","sourceRoot":"","sources":["../../src/http/ApiResponse.ts"],"names":[],"mappings":";AAAA;;GAEG;;;AAeH,MAAa,kBAAkB;IAA/B;QACU,eAAU,GAAG,GAAG,CAAC;QACjB,oBAAe,GAAG,S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,CAAC,OAAO,GAAG,WAAW;QACpC,OAAO;YACL,OAAO,EAAE,KAAK;YACd,IAAI,EAAE,GAAG;YACT,OAAO;YACP,IAAI,EAAE;gBACJ,SAAS,EAAE,IAAI,CAAC,GAAG,EAAE;gBACrB,IAAI,EAAE,EAAE;gBACR,OAAO,EAAE,OAAO;aACjB;SACF,CAAC;IACJ,CAAC;IAED,MAAM,CAAC,QAAQ,CAAC,OAAO,GAAG,oBAAoB;QAC5C,OAAO;YACL,OAAO,EAAE,KAAK;YACd,IAAI,EAAE,GAAG;YACT,OAAO;YACP,IAAI,EAAE;gBACJ,SAAS,EAAE,IAAI,CAAC,GAAG,EAAE;gBACrB,IAAI,EAAE,EAAE;gBACR,OAAO,EAAE,OAAO;aACjB;SACF,CAAC;IACJ,CAAC;IAED,MAAM,CAAC,WAAW,CAAC,OAAO,GAAG,uBAAuB;QAClD,OAAO;YACL,OAAO,EAAE,KAAK;YACd,IAAI,EAAE,GAAG;YACT,OAAO;YACP,IAAI,EAAE;gBACJ,SAAS,EAAE,IAAI,CAAC,GAAG,EAAE;gBACrB,IAAI,EAAE,EAAE;gBACR,OAAO,EAAE,OAAO;aACjB;SACF,CAAC;IACJ,CAAC;CACF;AA3JD,gDA2JC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Controller.d.ts","sourceRoot":"","sources":["../../src/http/Controller.ts"],"names":[],"mappings":"AAAA,8BAAsB,UAAU;CAE/B"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Controller.js","sourceRoot":"","sources":["../../src/http/Controller.ts"],"names":[],"mappings":";;;AAAA,MAAsB,UAAU;CAE/B;AAFD,gCAEC"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { Request, Response, NextFunction } from 'express';
|
|
2
|
+
export declare class ExceptionHandler {
|
|
3
|
+
static handle(error: any, req: Request, res: Response, next: NextFunction): void;
|
|
4
|
+
static setupNotFound(req: Request, res: Response): void;
|
|
5
|
+
}
|
|
6
|
+
//# sourceMappingURL=ExceptionHandler.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ExceptionHandler.d.ts","sourceRoot":"","sources":["../../src/http/ExceptionHandler.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAG1D,qBAAa,gBAAgB;WACX,MAAM,CAAC,KAAK,EAAE,GAAG,EAAE,GAAG,EAAE,OAAO,EAAE,GAAG,EAAE,QAAQ,EAAE,IAAI,EAAE,YAAY;WAiBlE,aAAa,CAAC,GAAG,EAAE,OAAO,EAAE,GAAG,EAAE,QAAQ;CAU1D"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ExceptionHandler = void 0;
|
|
4
|
+
const Logger_1 = require("../foundation/Logger");
|
|
5
|
+
class ExceptionHandler {
|
|
6
|
+
static handle(error, req, res, next) {
|
|
7
|
+
const statusCode = error.status || 500;
|
|
8
|
+
const message = error.message || 'Internal Server Error';
|
|
9
|
+
Logger_1.Logger.error(`[ExceptionHandler] ${req.method} ${req.url} - ${statusCode} - ${message}`, error);
|
|
10
|
+
res.status(statusCode).json({
|
|
11
|
+
success: false,
|
|
12
|
+
error: {
|
|
13
|
+
message,
|
|
14
|
+
code: error.code || 'INTERNAL_ERROR',
|
|
15
|
+
...(process.env.NODE_ENV === 'development' ? { stack: error.stack } : {})
|
|
16
|
+
},
|
|
17
|
+
poweredBy: 'KangPCode'
|
|
18
|
+
});
|
|
19
|
+
}
|
|
20
|
+
static setupNotFound(req, res) {
|
|
21
|
+
res.status(404).json({
|
|
22
|
+
success: false,
|
|
23
|
+
error: {
|
|
24
|
+
message: 'Resource not found',
|
|
25
|
+
code: 'NOT_FOUND'
|
|
26
|
+
},
|
|
27
|
+
poweredBy: 'KangPCode'
|
|
28
|
+
});
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
exports.ExceptionHandler = ExceptionHandler;
|
|
32
|
+
//# sourceMappingURL=ExceptionHandler.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ExceptionHandler.js","sourceRoot":"","sources":["../../src/http/ExceptionHandler.ts"],"names":[],"mappings":";;;AACA,iDAA8C;AAE9C,MAAa,gBAAgB;IAClB,MAAM,CAAC,MAAM,CAAC,KAAU,EAAE,GAAY,EAAE,GAAa,EAAE,IAAkB;QAC5E,MAAM,UAAU,GAAG,KAAK,CAAC,MAAM,IAAI,GAAG,CAAC;QACvC,MAAM,OAAO,GAAG,KAAK,CAAC,OAAO,IAAI,uBAAuB,CAAC;QAEzD,eAAM,CAAC,KAAK,CAAC,sBAAsB,GAAG,CAAC,MAAM,IAAI,GAAG,CAAC,GAAG,MAAM,UAAU,MAAM,OAAO,EAAE,EAAE,KAAK,CAAC,CAAC;QAEhG,GAAG,CAAC,MAAM,CAAC,UAAU,CAAC,CAAC,IAAI,CAAC;YACxB,OAAO,EAAE,KAAK;YACd,KAAK,EAAE;gBACH,OAAO;gBACP,IAAI,EAAE,KAAK,CAAC,IAAI,IAAI,gBAAgB;gBACpC,GAAG,CAAC,OAAO,CAAC,GAAG,CAAC,QAAQ,KAAK,aAAa,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,KAAK,CAAC,KAAK,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;aAC5E;YACD,SAAS,EAAE,WAAW;SACzB,CAAC,CAAC;IACP,CAAC;IAEM,MAAM,CAAC,aAAa,CAAC,GAAY,EAAE,GAAa;QACnD,GAAG,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC;YACjB,OAAO,EAAE,KAAK;YACd,KAAK,EAAE;gBACH,OAAO,EAAE,oBAAoB;gBAC7B,IAAI,EAAE,WAAW;aACpB;YACD,SAAS,EAAE,WAAW;SACzB,CAAC,CAAC;IACP,CAAC;CACJ;AA5BD,4CA4BC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import express from 'express';
|
|
2
|
+
export declare class Kernel {
|
|
3
|
+
protected app: express.Application;
|
|
4
|
+
constructor();
|
|
5
|
+
handle(): Promise<express.Application>;
|
|
6
|
+
listen(port: number, callback?: () => void): import("http").Server<typeof import("http").IncomingMessage, typeof import("http").ServerResponse>;
|
|
7
|
+
}
|
|
8
|
+
//# sourceMappingURL=Kernel.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Kernel.d.ts","sourceRoot":"","sources":["../../src/http/Kernel.ts"],"names":[],"mappings":"AAAA,OAAO,OAA4C,MAAM,SAAS,CAAC;AAOnE,qBAAa,MAAM;IACf,SAAS,CAAC,GAAG,EAAE,OAAO,CAAC,WAAW,CAAC;;IAStB,MAAM;IAwCZ,MAAM,CAAC,IAAI,EAAE,MAAM,EAAE,QAAQ,CAAC,EAAE,MAAM,IAAI;CAGpD"}
|