arcanajs 3.0.1 → 4.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 (50) hide show
  1. package/dist/arcanajs.js +2 -1
  2. package/dist/arcanajs.js.LICENSE.txt +14 -0
  3. package/dist/arcanajs.js.map +1 -1
  4. package/dist/arcanox.js +2 -0
  5. package/dist/arcanox.js.map +1 -0
  6. package/dist/cli/commands/db.d.ts +1 -0
  7. package/dist/cli/commands/make.d.ts +1 -0
  8. package/dist/cli/commands/migrate.d.ts +1 -0
  9. package/dist/cli/index.d.ts +1 -0
  10. package/dist/cli/index.js +1 -1
  11. package/dist/cli/index.js.map +1 -1
  12. package/dist/lib/arcanox/Model.d.ts +203 -0
  13. package/dist/lib/arcanox/QueryBuilder.d.ts +141 -0
  14. package/dist/lib/arcanox/adapters/MongoAdapter.d.ts +22 -0
  15. package/dist/lib/arcanox/adapters/MySQLAdapter.d.ts +27 -0
  16. package/dist/lib/arcanox/adapters/PostgresAdapter.d.ts +27 -0
  17. package/dist/lib/arcanox/extensions/MongoExtensions.d.ts +33 -0
  18. package/dist/lib/arcanox/factory/Factory.d.ts +26 -0
  19. package/dist/lib/arcanox/factory/index.d.ts +1 -0
  20. package/dist/lib/arcanox/index.d.ts +13 -0
  21. package/dist/lib/arcanox/providers/DatabaseProvider.d.ts +5 -0
  22. package/dist/lib/arcanox/relations/BelongsTo.d.ts +11 -0
  23. package/dist/lib/arcanox/relations/BelongsToMany.d.ts +15 -0
  24. package/dist/lib/arcanox/relations/HasMany.d.ts +11 -0
  25. package/dist/lib/arcanox/relations/HasOne.d.ts +11 -0
  26. package/dist/lib/arcanox/relations/Relation.d.ts +14 -0
  27. package/dist/lib/arcanox/schema/Blueprint.d.ts +183 -0
  28. package/dist/lib/arcanox/schema/Migration.d.ts +76 -0
  29. package/dist/lib/arcanox/schema/Schema.d.ts +49 -0
  30. package/dist/lib/arcanox/schema/index.d.ts +4 -0
  31. package/dist/lib/arcanox/seeder/Seeder.d.ts +13 -0
  32. package/dist/lib/arcanox/seeder/index.d.ts +1 -0
  33. package/dist/lib/arcanox/support/Macroable.d.ts +19 -0
  34. package/dist/lib/arcanox/types.d.ts +76 -0
  35. package/dist/lib/index.arcanox.d.ts +6 -0
  36. package/dist/lib/{index.d.ts → index.server.d.ts} +7 -11
  37. package/dist/lib/server/ArcanaJSServer.d.ts +35 -9
  38. package/dist/lib/server/Container.d.ts +31 -0
  39. package/dist/lib/server/MiddlewareBinder.d.ts +4 -0
  40. package/dist/lib/server/ResponseHandlerMiddleware.d.ts +0 -25
  41. package/dist/lib/server/Router.d.ts +12 -3
  42. package/dist/lib/server/http/FormRequest.d.ts +10 -0
  43. package/dist/lib/server/http/JsonResource.d.ts +13 -0
  44. package/dist/lib/server/http/Middleware.d.ts +4 -0
  45. package/dist/lib/server/support/ServiceProvider.d.ts +13 -0
  46. package/dist/lib/server/utils/dynamicRequire.d.ts +6 -0
  47. package/dist/lib/server/validation/ValidationException.d.ts +5 -0
  48. package/dist/lib/server/validation/Validator.d.ts +12 -0
  49. package/package.json +26 -14
  50. package/dist/lib/global.d.ts +0 -61
@@ -0,0 +1,13 @@
1
+ import ArcanaJSServer from "../ArcanaJSServer";
2
+ export declare abstract class ServiceProvider {
3
+ protected app: ArcanaJSServer;
4
+ constructor(app: ArcanaJSServer);
5
+ /**
6
+ * Register any application services.
7
+ */
8
+ register(): void;
9
+ /**
10
+ * Bootstrap any application services.
11
+ */
12
+ boot(): void;
13
+ }
@@ -0,0 +1,6 @@
1
+ /**
2
+ * Helper to dynamically require modules at runtime, bypassing Webpack bundling.
3
+ * This is necessary for loading user configuration files, migrations, and views
4
+ * that are not part of the framework bundle but exist in the user's project.
5
+ */
6
+ export declare const dynamicRequire: (id: string) => any;
@@ -0,0 +1,5 @@
1
+ export declare class ValidationException extends Error {
2
+ errors: Record<string, string[]>;
3
+ status: number;
4
+ constructor(errors: Record<string, string[]>);
5
+ }
@@ -0,0 +1,12 @@
1
+ export declare class Validator {
2
+ protected data: any;
3
+ protected rules: Record<string, string>;
4
+ protected errors: Record<string, string[]>;
5
+ constructor(data: any, rules: Record<string, string>);
6
+ static make(data: any, rules: Record<string, string>): Validator;
7
+ fails(): boolean;
8
+ passes(): boolean;
9
+ errors_(): Record<string, string[]>;
10
+ validate(): Record<string, any>;
11
+ protected addError(field: string, message: string): void;
12
+ }
package/package.json CHANGED
@@ -5,31 +5,23 @@
5
5
  "email": "mohammed.bencheikh.dev@gmail.com",
6
6
  "url": "https://mohammedbencheikh.com/"
7
7
  },
8
- "version": "3.0.1",
8
+ "version": "4.0.0",
9
9
  "description": "ArcanaJS Framework",
10
10
  "main": "./dist/arcanajs.js",
11
- "types": "./dist/lib/index.d.ts",
12
11
  "scripts": {
13
- "build": "tsc -p tsconfig.json --emitDeclarationOnly && webpack --config webpack.config.ts && cp src/lib/global.d.ts dist/lib/"
12
+ "build": "tsc -p tsconfig.json --emitDeclarationOnly && webpack --config webpack.config.ts"
14
13
  },
15
14
  "exports": {
16
- ".": {
17
- "browser": {
18
- "types": "./dist/lib/index.client.d.ts",
19
- "default": "./dist/arcanajs.client.js"
20
- },
21
- "node": {
22
- "types": "./dist/lib/index.d.ts",
23
- "default": "./dist/arcanajs.js"
24
- },
25
- "default": "./dist/arcanajs.js"
15
+ "./arcanox": {
16
+ "types": "./dist/lib/index.arcanox.d.ts",
17
+ "default": "./dist/arcanox.js"
26
18
  },
27
19
  "./client": {
28
20
  "types": "./dist/lib/index.client.d.ts",
29
21
  "default": "./dist/arcanajs.client.js"
30
22
  },
31
23
  "./server": {
32
- "types": "./dist/lib/index.d.ts",
24
+ "types": "./dist/lib/index.server.d.ts",
33
25
  "default": "./dist/arcanajs.js"
34
26
  }
35
27
  },
@@ -44,6 +36,20 @@
44
36
  "react": "^19.0.0",
45
37
  "react-dom": "^19.0.0"
46
38
  },
39
+ "peerDependenciesMeta": {
40
+ "pg": {
41
+ "optional": true
42
+ },
43
+ "mysql2": {
44
+ "optional": true
45
+ },
46
+ "@faker-js/faker": {
47
+ "optional": true
48
+ },
49
+ "mongodb": {
50
+ "optional": true
51
+ }
52
+ },
47
53
  "dependencies": {
48
54
  "@babel/core": "^7.23.0",
49
55
  "@babel/preset-env": "^7.23.0",
@@ -71,6 +77,7 @@
71
77
  "null-loader": "^4.0.1",
72
78
  "postcss": "^8.5.6",
73
79
  "postcss-loader": "^8.2.0",
80
+ "reflect-metadata": "^0.2.2",
74
81
  "style-loader": "^4.0.0",
75
82
  "tailwindcss": "^4.1.17",
76
83
  "ts-node": "^10.9.2",
@@ -82,7 +89,12 @@
82
89
  "ws": "^8.18.3"
83
90
  },
84
91
  "devDependencies": {
92
+ "@faker-js/faker": "^10.1.0",
93
+ "@types/pg": "^8.15.6",
85
94
  "@types/webpack-node-externals": "^3.0.4",
95
+ "mongodb": "^7.0.0",
96
+ "mysql2": "^3.15.3",
97
+ "pg": "^8.16.3",
86
98
  "react": "^19.2.0",
87
99
  "react-dom": "^19.2.0"
88
100
  },
@@ -1,61 +0,0 @@
1
- // ============================================================================
2
- // Express Augmentation
3
- // ============================================================================
4
- declare module "*.module.css" {
5
- const classes: { readonly [key: string]: string };
6
- export default classes;
7
- }
8
- declare module "*.css";
9
-
10
- declare global {
11
- var __non_webpack_require__: NodeJS.Require;
12
- namespace Express {
13
- interface Request {
14
- /**
15
- * Normalized DB object optionally attached to the request by ArcanaJSServer.
16
- * It may be either the raw client, or an object like `{ client, db, close }`.
17
- */
18
- db?: any;
19
- }
20
- interface Response {
21
- /**
22
- * Render a page component with data
23
- * @param page - Name of the page component to render
24
- * @param data - Data to pass to the page component
25
- */
26
- renderPage(page: string, data?: any): void;
27
-
28
- /**
29
- * Send a success JSON response
30
- * @param data - Data to send in the response
31
- * @param message - Optional success message
32
- * @param status - HTTP status code (default: 200)
33
- */
34
- success(
35
- data?: string | object | null,
36
- message?: string,
37
- status?: number
38
- ): Response;
39
-
40
- /**
41
- * Send an error JSON response
42
- * @param message - Error message
43
- * @param status - HTTP status code (default: 500)
44
- * @param error - Error details
45
- * @param data - Additional error data
46
- */
47
- error(
48
- message?: string,
49
- status?: number,
50
- error?: string | object | null,
51
- data?: string | object | null
52
- ): Response;
53
- }
54
- }
55
-
56
- // ============================================================================
57
- // CSS Module Declarations
58
- // ============================================================================
59
- }
60
-
61
- export {};