arcanajs 5.0.0 → 5.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/arcanajs.js.map +1 -1
- package/dist/arcanox.js +1 -1
- package/dist/arcanox.js.map +1 -1
- package/dist/cli/index.js +2 -1
- package/dist/cli/index.js.LICENSE.txt +14 -0
- package/dist/cli/index.js.map +1 -1
- package/dist/lib/arcanox/Model.d.ts +7 -0
- package/dist/lib/arcanox/schema/Schema.d.ts +11 -0
- package/dist/lib/arcanox/types.d.ts +4 -2
- package/dist/lib/server/ArcanaJSServer.d.ts +0 -34
- package/dist/lib/server/DynamicRouter.d.ts +1 -1
- package/dist/types/express.d.ts +45 -0
- package/dist/types/global.d.ts +1 -0
- package/package.json +4 -1
|
@@ -16,6 +16,9 @@ export interface RelationConfig {
|
|
|
16
16
|
pivotTable?: string;
|
|
17
17
|
}
|
|
18
18
|
import { Macroable } from "./support/Macroable";
|
|
19
|
+
declare global {
|
|
20
|
+
var ArcanaDatabaseAdapter: DatabaseAdapter | undefined;
|
|
21
|
+
}
|
|
19
22
|
/**
|
|
20
23
|
* Base Model class - Arcanox ORM
|
|
21
24
|
*/
|
|
@@ -43,6 +46,10 @@ export declare class Model<T = any> extends Macroable {
|
|
|
43
46
|
* Set the database adapter
|
|
44
47
|
*/
|
|
45
48
|
static setAdapter(adapter: DatabaseAdapter): void;
|
|
49
|
+
/**
|
|
50
|
+
* Get the database adapter
|
|
51
|
+
*/
|
|
52
|
+
protected static getAdapter(): DatabaseAdapter;
|
|
46
53
|
/**
|
|
47
54
|
* Get the table name
|
|
48
55
|
*/
|
|
@@ -1,11 +1,22 @@
|
|
|
1
1
|
import type { DatabaseAdapter } from "../types";
|
|
2
2
|
import { Blueprint } from "./Blueprint";
|
|
3
|
+
/**
|
|
4
|
+
* Schema - ArcnanJS schema builder
|
|
5
|
+
* Provides fluent interface for creating and modifying database tables
|
|
6
|
+
*/
|
|
7
|
+
declare global {
|
|
8
|
+
var ArcanaDatabaseAdapter: DatabaseAdapter | undefined;
|
|
9
|
+
}
|
|
3
10
|
/**
|
|
4
11
|
* Schema - ArcnanJS schema builder
|
|
5
12
|
* Provides fluent interface for creating and modifying database tables
|
|
6
13
|
*/
|
|
7
14
|
export declare class Schema {
|
|
8
15
|
private static adapter;
|
|
16
|
+
/**
|
|
17
|
+
* Get the database adapter
|
|
18
|
+
*/
|
|
19
|
+
private static getAdapter;
|
|
9
20
|
/**
|
|
10
21
|
* Set the database adapter
|
|
11
22
|
*/
|
|
@@ -27,12 +27,14 @@ export interface DatabaseAdapter {
|
|
|
27
27
|
}
|
|
28
28
|
export interface DatabaseConfig {
|
|
29
29
|
type: "postgres" | "mysql" | "mongodb";
|
|
30
|
-
host
|
|
31
|
-
port
|
|
30
|
+
host?: string;
|
|
31
|
+
port?: number;
|
|
32
32
|
database: string;
|
|
33
33
|
username?: string;
|
|
34
34
|
password?: string;
|
|
35
35
|
ssl?: boolean;
|
|
36
|
+
url?: string;
|
|
37
|
+
uri?: string;
|
|
36
38
|
pool?: {
|
|
37
39
|
min?: number;
|
|
38
40
|
max?: number;
|
|
@@ -26,40 +26,6 @@ export interface ArcanaJSConfig {
|
|
|
26
26
|
/** Service providers to load */
|
|
27
27
|
providers?: (new (app: ArcanaJSServer) => ServiceProvider)[];
|
|
28
28
|
}
|
|
29
|
-
declare global {
|
|
30
|
-
namespace Express {
|
|
31
|
-
interface Response {
|
|
32
|
-
/**
|
|
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.
|
|
39
|
-
*/
|
|
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;
|
|
60
|
-
}
|
|
61
|
-
}
|
|
62
|
-
}
|
|
63
29
|
import { Container } from "./Container";
|
|
64
30
|
declare class ArcanaJSServer {
|
|
65
31
|
app: Express;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { NextFunction, Request, Response } from "express";
|
|
2
|
-
export declare const createDynamicRouter: (views: Record<string, any>) => (req: Request, res: Response, next: NextFunction) =>
|
|
2
|
+
export declare const createDynamicRouter: (views: Record<string, any>) => (req: Request, res: Response, next: NextFunction) => Response<any, Record<string, any>> | undefined;
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import "express-serve-static-core";
|
|
2
|
+
|
|
3
|
+
declare module "express-serve-static-core" {
|
|
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(
|
|
14
|
+
data?: string | object | null,
|
|
15
|
+
message?: string,
|
|
16
|
+
status?: number
|
|
17
|
+
): this;
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* Sends an error response with a standard format.
|
|
21
|
+
*
|
|
22
|
+
* @param message - A descriptive message for the error (default: "Error").
|
|
23
|
+
* @param status - The HTTP status code to return (default: 500).
|
|
24
|
+
* @param error - Additional error details or object (default: null).
|
|
25
|
+
* @param data - Optional data payload to include in the error response (default: null).
|
|
26
|
+
* @returns The Express Response object.
|
|
27
|
+
*/
|
|
28
|
+
error(
|
|
29
|
+
message?: string,
|
|
30
|
+
status?: number,
|
|
31
|
+
error?: string | object | null | undefined | unknown,
|
|
32
|
+
data?: string | object | null
|
|
33
|
+
): this;
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* Renders a React page using ArcanaJS SSR.
|
|
37
|
+
*
|
|
38
|
+
* @param page - The name of the page component to render.
|
|
39
|
+
* @param data - Initial data to pass to the page component (default: {}).
|
|
40
|
+
* @param params - Route parameters (default: {}).
|
|
41
|
+
* @returns The Express Response object.
|
|
42
|
+
*/
|
|
43
|
+
renderPage(page: string, data?: any, params?: Record<string, string>): this;
|
|
44
|
+
}
|
|
45
|
+
}
|
package/dist/types/global.d.ts
CHANGED
package/package.json
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
"email": "mohammed.bencheikh.dev@gmail.com",
|
|
6
6
|
"url": "https://mohammedbencheikh.com/"
|
|
7
7
|
},
|
|
8
|
-
"version": "5.0.
|
|
8
|
+
"version": "5.0.1",
|
|
9
9
|
"description": "ArcanaJS Framework",
|
|
10
10
|
"main": "./dist/arcanajs.js",
|
|
11
11
|
"scripts": {
|
|
@@ -13,6 +13,9 @@
|
|
|
13
13
|
"test": "echo \"No tests specified\" && exit 0"
|
|
14
14
|
},
|
|
15
15
|
"exports": {
|
|
16
|
+
"./express-types": {
|
|
17
|
+
"types": "./dist/types/express.d.ts"
|
|
18
|
+
},
|
|
16
19
|
"./server": {
|
|
17
20
|
"types": "./dist/lib/index.server.d.ts",
|
|
18
21
|
"default": "./dist/arcanajs.js"
|