arcanajs 3.0.1 → 5.0.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.
Files changed (99) hide show
  1. package/dist/529.js +2 -0
  2. package/dist/529.js.map +1 -0
  3. package/dist/630.js +3 -0
  4. package/dist/630.js.LICENSE.txt +14 -0
  5. package/dist/630.js.map +1 -0
  6. package/dist/arcanajs.auth.js +3 -0
  7. package/dist/arcanajs.auth.js.LICENSE.txt +14 -0
  8. package/dist/arcanajs.auth.js.map +1 -0
  9. package/dist/arcanajs.js +2 -1
  10. package/dist/arcanajs.js.LICENSE.txt +14 -0
  11. package/dist/arcanajs.js.map +1 -1
  12. package/dist/arcanajs.mail.js +2 -0
  13. package/dist/arcanajs.mail.js.map +1 -0
  14. package/dist/arcanajs.validator.js +2 -0
  15. package/dist/arcanajs.validator.js.map +1 -0
  16. package/dist/arcanox.js +2 -0
  17. package/dist/arcanox.js.map +1 -0
  18. package/dist/cli/commands/db.d.ts +1 -0
  19. package/dist/cli/commands/dependency.d.ts +1 -0
  20. package/dist/cli/commands/make/Controller.d.ts +3 -0
  21. package/dist/cli/commands/make/Factory.d.ts +2 -0
  22. package/dist/cli/commands/make/Middleware.d.ts +1 -0
  23. package/dist/cli/commands/make/Migration.d.ts +2 -0
  24. package/dist/cli/commands/make/Model.d.ts +2 -0
  25. package/dist/cli/commands/make/Provider.d.ts +1 -0
  26. package/dist/cli/commands/make/Request.d.ts +1 -0
  27. package/dist/cli/commands/make/Seeder.d.ts +2 -0
  28. package/dist/cli/commands/make.d.ts +1 -0
  29. package/dist/cli/commands/migrate.d.ts +1 -0
  30. package/dist/cli/index.d.ts +1 -0
  31. package/dist/cli/index.js +1 -1
  32. package/dist/cli/index.js.map +1 -1
  33. package/dist/cli/utils/toPascalCase.d.ts +1 -0
  34. package/dist/cli/utils/writeFile.d.ts +1 -0
  35. package/dist/lib/arcanox/Model.d.ts +203 -0
  36. package/dist/lib/arcanox/QueryBuilder.d.ts +141 -0
  37. package/dist/lib/arcanox/adapters/MongoAdapter.d.ts +22 -0
  38. package/dist/lib/arcanox/adapters/MySQLAdapter.d.ts +27 -0
  39. package/dist/lib/arcanox/adapters/PostgresAdapter.d.ts +27 -0
  40. package/dist/lib/arcanox/extensions/MongoExtensions.d.ts +33 -0
  41. package/dist/lib/arcanox/factory/Factory.d.ts +26 -0
  42. package/dist/lib/arcanox/factory/index.d.ts +1 -0
  43. package/dist/lib/arcanox/providers/DatabaseProvider.d.ts +10 -0
  44. package/dist/lib/arcanox/relations/BelongsTo.d.ts +11 -0
  45. package/dist/lib/arcanox/relations/BelongsToMany.d.ts +15 -0
  46. package/dist/lib/arcanox/relations/HasMany.d.ts +11 -0
  47. package/dist/lib/arcanox/relations/HasOne.d.ts +11 -0
  48. package/dist/lib/arcanox/relations/Relation.d.ts +14 -0
  49. package/dist/lib/arcanox/schema/Blueprint.d.ts +183 -0
  50. package/dist/lib/arcanox/schema/Migration.d.ts +76 -0
  51. package/dist/lib/arcanox/schema/Schema.d.ts +49 -0
  52. package/dist/lib/arcanox/schema/index.d.ts +4 -0
  53. package/dist/lib/arcanox/seeder/Seeder.d.ts +13 -0
  54. package/dist/lib/arcanox/seeder/index.d.ts +1 -0
  55. package/dist/lib/arcanox/support/Macroable.d.ts +19 -0
  56. package/dist/lib/arcanox/types.d.ts +76 -0
  57. package/dist/lib/auth/AuthProvider.d.ts +10 -0
  58. package/dist/lib/auth/JWTService.d.ts +11 -0
  59. package/dist/lib/auth/SessionManager.d.ts +4 -0
  60. package/dist/lib/auth/middleware/AuthMiddleware.d.ts +5 -0
  61. package/dist/lib/auth/middleware/AuthenticatedMiddleware.d.ts +5 -0
  62. package/dist/lib/auth/middleware/GuestMiddleware.d.ts +5 -0
  63. package/dist/lib/auth/middleware/RoleMiddleware.d.ts +7 -0
  64. package/dist/lib/auth/types/AuthConfig.d.ts +24 -0
  65. package/dist/lib/auth/types/JWTPayload.d.ts +10 -0
  66. package/dist/lib/auth/types/index.d.ts +2 -0
  67. package/dist/lib/auth/utils/PasswordHasher.d.ts +16 -0
  68. package/dist/lib/auth/utils/TokenBlacklist.d.ts +9 -0
  69. package/dist/lib/index.arcanox.d.ts +20 -0
  70. package/dist/lib/index.auth.d.ts +11 -0
  71. package/dist/lib/index.client.d.ts +2 -0
  72. package/dist/lib/index.mail.d.ts +8 -0
  73. package/dist/lib/{index.d.ts → index.server.d.ts} +6 -12
  74. package/dist/lib/index.validator.d.ts +6 -0
  75. package/dist/lib/mail/MailProvider.d.ts +10 -0
  76. package/dist/lib/mail/MailService.d.ts +57 -0
  77. package/dist/lib/mail/Mailable.d.ts +106 -0
  78. package/dist/lib/mail/index.d.ts +6 -0
  79. package/dist/lib/mail/queue/MailQueue.d.ts +51 -0
  80. package/dist/lib/mail/queue/index.d.ts +1 -0
  81. package/dist/lib/mail/types/MailConfig.d.ts +146 -0
  82. package/dist/lib/mail/types/index.d.ts +1 -0
  83. package/dist/lib/mail/utils/TemplateRenderer.d.ts +34 -0
  84. package/dist/lib/mail/utils/index.d.ts +1 -0
  85. package/dist/lib/server/ArcanaJSServer.d.ts +49 -16
  86. package/dist/lib/server/Container.d.ts +39 -0
  87. package/dist/lib/server/MiddlewareBinder.d.ts +4 -0
  88. package/dist/lib/server/ResponseHandlerMiddleware.d.ts +0 -25
  89. package/dist/lib/server/Router.d.ts +31 -32
  90. package/dist/lib/server/http/FormRequest.d.ts +10 -0
  91. package/dist/lib/server/http/JsonResource.d.ts +13 -0
  92. package/dist/lib/server/http/Middleware.d.ts +4 -0
  93. package/dist/lib/server/support/ServiceProvider.d.ts +17 -0
  94. package/dist/lib/server/utils/dynamicRequire.d.ts +6 -0
  95. package/dist/lib/validation/ValidationException.d.ts +5 -0
  96. package/dist/lib/validation/Validator.d.ts +55 -0
  97. package/dist/types/global.d.ts +102 -0
  98. package/package.json +90 -25
  99. package/dist/lib/global.d.ts +0 -61
@@ -0,0 +1,57 @@
1
+ import { Mailable } from "./Mailable";
2
+ import { MailConfig, MailMessage } from "./types";
3
+ /**
4
+ * Core mail service for sending emails
5
+ */
6
+ export declare class MailService {
7
+ private static config?;
8
+ private static transporter?;
9
+ /**
10
+ * Initialize the mail service
11
+ */
12
+ static init(config: MailConfig): Promise<void>;
13
+ /**
14
+ * Create nodemailer transporter based on configuration
15
+ */
16
+ private static createTransporter;
17
+ /**
18
+ * Create SMTP transporter
19
+ */
20
+ private static createSMTPTransporter;
21
+ /**
22
+ * Create SendGrid transporter
23
+ */
24
+ private static createSendGridTransporter;
25
+ /**
26
+ * Create Mailgun transporter
27
+ */
28
+ private static createMailgunTransporter;
29
+ /**
30
+ * Create AWS SES transporter
31
+ */
32
+ private static createSESTransporter;
33
+ /**
34
+ * Create log-only transporter (for testing)
35
+ */
36
+ private static createLogTransporter;
37
+ /**
38
+ * Send an email immediately
39
+ */
40
+ static send(mailable: Mailable | MailMessage): Promise<void>;
41
+ /**
42
+ * Queue an email for async sending
43
+ */
44
+ static queue(mailable: Mailable): Promise<void>;
45
+ /**
46
+ * Send a raw email message
47
+ */
48
+ static sendRaw(message: MailMessage): Promise<void>;
49
+ /**
50
+ * Get the mail configuration
51
+ */
52
+ static getConfig(): MailConfig | undefined;
53
+ /**
54
+ * Verify transporter connection
55
+ */
56
+ static verify(): Promise<boolean>;
57
+ }
@@ -0,0 +1,106 @@
1
+ import { MailAttachment, MailMessage } from "./types";
2
+ /**
3
+ * Abstract base class for creating email messages
4
+ *
5
+ * @example
6
+ * ```typescript
7
+ * class WelcomeEmail extends Mailable {
8
+ * constructor(private user: User) {
9
+ * super();
10
+ * }
11
+ *
12
+ * build() {
13
+ * return this
14
+ * .to(this.user.email)
15
+ * .subject('Welcome to ArcanaJS!')
16
+ * .view('emails/welcome', { name: this.user.name });
17
+ * }
18
+ * }
19
+ *
20
+ * // Send the email
21
+ * await new WelcomeEmail(user).send();
22
+ * ```
23
+ */
24
+ export declare abstract class Mailable {
25
+ protected message: Partial<MailMessage>;
26
+ protected viewName?: string;
27
+ protected viewData?: Record<string, any>;
28
+ /**
29
+ * Build the email message
30
+ * Must be implemented by subclasses
31
+ */
32
+ abstract build(): this;
33
+ /**
34
+ * Set the recipient(s)
35
+ */
36
+ to(address: string | string[], name?: string): this;
37
+ /**
38
+ * Set the sender
39
+ */
40
+ from(address: string, name?: string): this;
41
+ /**
42
+ * Set the email subject
43
+ */
44
+ subject(subject: string): this;
45
+ /**
46
+ * Set the email view template
47
+ */
48
+ view(template: string, data?: Record<string, any>): this;
49
+ /**
50
+ * Set HTML content directly
51
+ */
52
+ html(content: string): this;
53
+ /**
54
+ * Set plain text content
55
+ */
56
+ text(content: string): this;
57
+ /**
58
+ * Add CC recipient(s)
59
+ */
60
+ cc(address: string | string[]): this;
61
+ /**
62
+ * Add BCC recipient(s)
63
+ */
64
+ bcc(address: string | string[]): this;
65
+ /**
66
+ * Set reply-to address
67
+ */
68
+ replyTo(address: string): this;
69
+ /**
70
+ * Add an attachment
71
+ */
72
+ attach(attachment: MailAttachment): this;
73
+ /**
74
+ * Attach a file from path
75
+ */
76
+ attachFromPath(path: string, filename?: string): this;
77
+ /**
78
+ * Attach data as a file
79
+ */
80
+ attachData(content: string | Buffer, filename: string, contentType?: string): this;
81
+ /**
82
+ * Set email priority
83
+ */
84
+ priority(level: "high" | "normal" | "low"): this;
85
+ /**
86
+ * Add custom headers
87
+ */
88
+ withHeaders(headers: Record<string, string>): this;
89
+ /**
90
+ * Get the built message
91
+ * @internal
92
+ */
93
+ getMessage(): {
94
+ message: Partial<MailMessage>;
95
+ viewName?: string;
96
+ viewData?: Record<string, any>;
97
+ };
98
+ /**
99
+ * Send the email immediately
100
+ */
101
+ send(): Promise<void>;
102
+ /**
103
+ * Queue the email for async sending
104
+ */
105
+ queue(): Promise<void>;
106
+ }
@@ -0,0 +1,6 @@
1
+ export * from "./Mailable";
2
+ export * from "./MailProvider";
3
+ export * from "./MailService";
4
+ export * from "./queue";
5
+ export * from "./types";
6
+ export * from "./utils";
@@ -0,0 +1,51 @@
1
+ import { Mailable } from "../Mailable";
2
+ import { MailQueueConfig } from "../types";
3
+ /**
4
+ * Mail queue for async email processing
5
+ */
6
+ export declare class MailQueue {
7
+ private static config?;
8
+ private static queue;
9
+ private static processing;
10
+ private static redisClient?;
11
+ /**
12
+ * Initialize the mail queue
13
+ */
14
+ static init(config: MailQueueConfig): Promise<void>;
15
+ /**
16
+ * Initialize Redis connection
17
+ */
18
+ private static initRedis;
19
+ /**
20
+ * Add a job to the queue
21
+ */
22
+ static add(mailable: Mailable): Promise<void>;
23
+ /**
24
+ * Start processing the queue
25
+ */
26
+ private static startProcessing;
27
+ /**
28
+ * Process next job in queue
29
+ */
30
+ private static processNext;
31
+ /**
32
+ * Handle failed job
33
+ */
34
+ private static handleFailedJob;
35
+ /**
36
+ * Store failed job for manual review
37
+ */
38
+ private static storeFailedJob;
39
+ /**
40
+ * Generate unique job ID
41
+ */
42
+ private static generateId;
43
+ /**
44
+ * Get queue size
45
+ */
46
+ static size(): Promise<number>;
47
+ /**
48
+ * Clear the queue
49
+ */
50
+ static clear(): Promise<void>;
51
+ }
@@ -0,0 +1 @@
1
+ export * from "./MailQueue";
@@ -0,0 +1,146 @@
1
+ import { Transporter } from "nodemailer";
2
+ /**
3
+ * Supported mail transport drivers
4
+ */
5
+ export type MailDriver = "smtp" | "sendgrid" | "mailgun" | "ses" | "log";
6
+ /**
7
+ * SMTP Configuration
8
+ */
9
+ export interface SMTPConfig {
10
+ host: string;
11
+ port: number;
12
+ secure?: boolean;
13
+ auth?: {
14
+ user: string;
15
+ pass: string;
16
+ };
17
+ tls?: {
18
+ rejectUnauthorized?: boolean;
19
+ };
20
+ }
21
+ /**
22
+ * SendGrid Configuration
23
+ */
24
+ export interface SendGridConfig {
25
+ apiKey: string;
26
+ }
27
+ /**
28
+ * Mailgun Configuration
29
+ */
30
+ export interface MailgunConfig {
31
+ apiKey: string;
32
+ domain: string;
33
+ host?: string;
34
+ }
35
+ /**
36
+ * AWS SES Configuration
37
+ */
38
+ export interface SESConfig {
39
+ region: string;
40
+ accessKeyId: string;
41
+ secretAccessKey: string;
42
+ sessionToken?: string;
43
+ }
44
+ /**
45
+ * Mail Queue Configuration
46
+ */
47
+ export interface MailQueueConfig {
48
+ enabled: boolean;
49
+ driver: "memory" | "redis";
50
+ redis?: {
51
+ host: string;
52
+ port: number;
53
+ password?: string;
54
+ db?: number;
55
+ };
56
+ retries?: number;
57
+ retryDelay?: number;
58
+ }
59
+ /**
60
+ * Mail Template Configuration
61
+ */
62
+ export interface MailTemplateConfig {
63
+ engine: "ejs" | "handlebars";
64
+ viewsPath: string;
65
+ layoutsPath?: string;
66
+ defaultLayout?: string;
67
+ inlineCss?: boolean;
68
+ }
69
+ /**
70
+ * Default Sender Configuration
71
+ */
72
+ export interface MailFromConfig {
73
+ address: string;
74
+ name?: string;
75
+ }
76
+ /**
77
+ * Main Mail Configuration
78
+ */
79
+ export interface MailConfig {
80
+ /**
81
+ * Default mail driver to use
82
+ */
83
+ default: MailDriver;
84
+ /**
85
+ * Default "from" address and name
86
+ */
87
+ from: MailFromConfig;
88
+ /**
89
+ * SMTP Configuration
90
+ */
91
+ smtp?: SMTPConfig;
92
+ /**
93
+ * SendGrid Configuration
94
+ */
95
+ sendgrid?: SendGridConfig;
96
+ /**
97
+ * Mailgun Configuration
98
+ */
99
+ mailgun?: MailgunConfig;
100
+ /**
101
+ * AWS SES Configuration
102
+ */
103
+ ses?: SESConfig;
104
+ /**
105
+ * Queue Configuration
106
+ */
107
+ queue?: MailQueueConfig;
108
+ /**
109
+ * Template Configuration
110
+ */
111
+ templates?: MailTemplateConfig;
112
+ /**
113
+ * Reply-to address
114
+ */
115
+ replyTo?: MailFromConfig;
116
+ }
117
+ /**
118
+ * Mail Message Options
119
+ */
120
+ export interface MailMessage {
121
+ to: string | string[];
122
+ from?: MailFromConfig;
123
+ subject: string;
124
+ html?: string;
125
+ text?: string;
126
+ cc?: string | string[];
127
+ bcc?: string | string[];
128
+ replyTo?: string;
129
+ attachments?: MailAttachment[];
130
+ headers?: Record<string, string>;
131
+ priority?: "high" | "normal" | "low";
132
+ }
133
+ /**
134
+ * Mail Attachment
135
+ */
136
+ export interface MailAttachment {
137
+ filename: string;
138
+ content?: string | Buffer;
139
+ path?: string;
140
+ contentType?: string;
141
+ cid?: string;
142
+ }
143
+ /**
144
+ * Nodemailer Transporter Type
145
+ */
146
+ export type MailTransporter = Transporter;
@@ -0,0 +1 @@
1
+ export * from "./MailConfig";
@@ -0,0 +1,34 @@
1
+ import { MailTemplateConfig } from "../types";
2
+ /**
3
+ * Template renderer for email views
4
+ */
5
+ export declare class TemplateRenderer {
6
+ private static config?;
7
+ /**
8
+ * Initialize the template renderer
9
+ */
10
+ static init(config: MailTemplateConfig): void;
11
+ /**
12
+ * Render a template to HTML
13
+ */
14
+ static render(templateName: string, data?: Record<string, any>): Promise<{
15
+ html: string;
16
+ text: string;
17
+ }>;
18
+ /**
19
+ * Render EJS template
20
+ */
21
+ private static renderEJS;
22
+ /**
23
+ * Render Handlebars template
24
+ */
25
+ private static renderHandlebars;
26
+ /**
27
+ * Apply layout to rendered content
28
+ */
29
+ private static applyLayout;
30
+ /**
31
+ * Convert HTML to plain text
32
+ */
33
+ private static htmlToText;
34
+ }
@@ -0,0 +1 @@
1
+ export * from "./TemplateRenderer";
@@ -1,6 +1,7 @@
1
1
  import { Express, RequestHandler } from "express";
2
2
  import React from "react";
3
- export interface ArcanaJSConfig<TDb = any> {
3
+ import { ServiceProvider } from "./support/ServiceProvider";
4
+ export interface ArcanaJSConfig {
4
5
  port?: number | string;
5
6
  views?: Record<string, React.FC<any>>;
6
7
  viewsDir?: string;
@@ -14,39 +15,71 @@ export interface ArcanaJSConfig<TDb = any> {
14
15
  distDir?: string;
15
16
  indexFile?: string;
16
17
  layout?: React.FC<any>;
17
- /** Optional function to establish a DB connection. Should return a Promise resolving to the DB client/connection. */
18
- dbConnect?: () => Promise<TDb> | TDb;
19
18
  /** Automatically register SIGINT/SIGTERM handlers to call stop(). Default: true */
20
19
  autoHandleSignals?: boolean;
20
+ /** Auth configuration */
21
+ auth?: any;
22
+ /** Mail configuration */
23
+ mail?: any;
24
+ /** Database configuration */
25
+ database?: any;
26
+ /** Service providers to load */
27
+ providers?: (new (app: ArcanaJSServer) => ServiceProvider)[];
21
28
  }
22
29
  declare global {
23
30
  namespace Express {
24
- interface Request {
31
+ interface Response {
25
32
  /**
26
- * Normalized DB object optionally attached to the request by ArcanaJSServer.
27
- * It may be either the raw client, or an object like `{ client, db, close }`.
33
+ * Sends a success response with a standard format.
34
+ *
35
+ * @param data - The data payload to include in the response (default: {}).
36
+ * @param message - A descriptive message for the success (default: "Success").
37
+ * @param status - The HTTP status code to return (default: 200).
38
+ * @returns The Express Response object.
28
39
  */
29
- db?: any;
40
+ success: (data?: string | object | null, message?: string, status?: number) => Response;
41
+ /**
42
+ * Sends an error response with a standard format.
43
+ *
44
+ * @param message - A descriptive message for the error (default: "Error").
45
+ * @param status - The HTTP status code to return (default: 500).
46
+ * @param error - Additional error details or object (default: null).
47
+ * @param data - Optional data payload to include in the error response (default: null).
48
+ * @returns The Express Response object.
49
+ */
50
+ error: (message?: string, status?: number, error?: string | object | null | undefined | unknown, data?: string | object | null) => Response;
51
+ /**
52
+ * Renders a React page using ArcanaJS SSR.
53
+ *
54
+ * @param page - The name of the page component to render.
55
+ * @param data - Initial data to pass to the page component (default: {}).
56
+ * @param params - Route parameters (default: {}).
57
+ * @returns The Express Response object.
58
+ */
59
+ renderPage(page: string, data?: any, params?: Record<string, string>): Response;
30
60
  }
31
61
  }
32
62
  }
33
- declare class ArcanaJSServer<TDb = any> {
63
+ import { Container } from "./Container";
64
+ declare class ArcanaJSServer {
34
65
  app: Express;
66
+ container: Container;
35
67
  private config;
36
68
  private serverInstance?;
37
69
  private _sigintHandler?;
38
70
  private _sigtermHandler?;
39
- constructor(config: ArcanaJSConfig<TDb>);
40
- /**
41
- * Normalize different DB client shapes into a single object exposing:
42
- * { client?: any, db?: any, close: async () => void }
43
- */
44
- private normalizeDb;
45
- private initialize;
71
+ private providers;
72
+ private initialized;
73
+ constructor(config: ArcanaJSConfig);
74
+ private initializeAsync;
75
+ private loadConfigurations;
76
+ private registerProviders;
77
+ private bootProviders;
78
+ private setupMiddleware;
46
79
  private loadViewsFromContext;
47
80
  private loadViewsFromAlias;
48
81
  private discoverViews;
49
- start(): void;
82
+ start(): Promise<void>;
50
83
  /**
51
84
  * Stop the HTTP server and close DB connection if present.
52
85
  */
@@ -0,0 +1,39 @@
1
+ import "reflect-metadata";
2
+ export type ClassConstructor<T = any> = new (...args: any[]) => T;
3
+ export type FactoryFunction<T = any> = (container: Container) => T;
4
+ export declare class Container {
5
+ private static instance;
6
+ private bindings;
7
+ private singletons;
8
+ constructor();
9
+ /**
10
+ * Get the global container instance
11
+ */
12
+ static getInstance(): Container;
13
+ /**
14
+ * Bind a class or factory to the container
15
+ */
16
+ bind<T>(key: string | ClassConstructor<T>, value: ClassConstructor<T> | FactoryFunction<T>): void;
17
+ /**
18
+ * Bind a singleton to the container
19
+ */
20
+ singleton<T>(key: string | ClassConstructor<T>, value: ClassConstructor<T> | FactoryFunction<T>): void;
21
+ /**
22
+ * Resolve a dependency from the container
23
+ */
24
+ make<T>(key: string | ClassConstructor<T>): T;
25
+ /**
26
+ * Check if a service is registered in the container
27
+ */
28
+ has(key: string | ClassConstructor): boolean;
29
+ /**
30
+ * Alias for make() - resolve a dependency from the container
31
+ */
32
+ resolve<T>(key: string | ClassConstructor<T>): T;
33
+ /**
34
+ * Instantiate a class, resolving its dependencies
35
+ */
36
+ private build;
37
+ private isConstructor;
38
+ }
39
+ export declare const container: Container;
@@ -0,0 +1,4 @@
1
+ import { NextFunction, Request, Response } from "express";
2
+ export default class MiddlewareBinder {
3
+ static handle(middleware: any, method?: string): (req: Request, res: Response, next: NextFunction) => Promise<void>;
4
+ }
@@ -1,27 +1,2 @@
1
1
  import type { NextFunction, Request, Response } from "express";
2
- declare global {
3
- namespace Express {
4
- interface Response {
5
- /**
6
- * Sends a success response with a standard format.
7
- *
8
- * @param data - The data payload to include in the response (default: {}).
9
- * @param message - A descriptive message for the success (default: "Success").
10
- * @param status - The HTTP status code to return (default: 200).
11
- * @returns The Express Response object.
12
- */
13
- success: (data?: string | object | null, message?: string, status?: number) => Response;
14
- /**
15
- * Sends an error response with a standard format.
16
- *
17
- * @param message - A descriptive message for the error (default: "Error").
18
- * @param status - The HTTP status code to return (default: 500).
19
- * @param error - Additional error details or object (default: null).
20
- * @param data - Optional data payload to include in the error response (default: null).
21
- * @returns The Express Response object.
22
- */
23
- error: (message?: string, status?: number, error?: string | object | null, data?: string | object | null) => Response;
24
- }
25
- }
26
- }
27
2
  export declare const responseHandler: (req: Request, res: Response, next: NextFunction) => void;