axe-api 0.22.0 → 0.30.0-rc2

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 (152) hide show
  1. package/build/dev-kit/app/Config/Application.d.ts +3 -0
  2. package/build/dev-kit/app/Config/Application.js +14 -0
  3. package/build/dev-kit/app/Config/Database.d.ts +3 -0
  4. package/build/dev-kit/app/Config/Database.js +24 -0
  5. package/build/dev-kit/app/Events/UserEvent.d.ts +3 -0
  6. package/build/dev-kit/app/Events/UserEvent.js +16 -0
  7. package/build/dev-kit/app/Hooks/CustomerHook.d.ts +3 -0
  8. package/build/dev-kit/app/Hooks/CustomerHook.js +16 -0
  9. package/build/dev-kit/app/Hooks/EmployeeHook.d.ts +2 -0
  10. package/build/dev-kit/app/Hooks/EmployeeHook.js +16 -0
  11. package/build/dev-kit/app/Hooks/UserHook.d.ts +3 -0
  12. package/build/dev-kit/app/Hooks/UserHook.js +17 -0
  13. package/build/dev-kit/app/Models/Customer.d.ts +7 -0
  14. package/build/dev-kit/app/Models/Customer.js +15 -0
  15. package/build/dev-kit/app/Models/Employee.d.ts +9 -0
  16. package/build/dev-kit/app/Models/Employee.js +21 -0
  17. package/build/dev-kit/app/Models/EmployeeAddress.d.ts +8 -0
  18. package/build/dev-kit/app/Models/EmployeeAddress.js +18 -0
  19. package/build/dev-kit/app/Models/Post.d.ts +6 -0
  20. package/build/dev-kit/app/Models/Post.js +14 -0
  21. package/build/dev-kit/app/Models/User.d.ts +7 -0
  22. package/build/dev-kit/app/Models/User.js +23 -0
  23. package/build/dev-kit/app/Serialization/UserSerialization.d.ts +3 -0
  24. package/build/dev-kit/app/Serialization/UserSerialization.js +6 -0
  25. package/build/dev-kit/app/config.d.ts +3 -0
  26. package/build/dev-kit/app/config.js +31 -0
  27. package/build/dev-kit/app/init.d.ts +4 -0
  28. package/build/dev-kit/app/init.js +16 -0
  29. package/build/dev-kit/app/v1/Events/UserEvent.d.ts +3 -0
  30. package/build/dev-kit/app/v1/Events/UserEvent.js +16 -0
  31. package/build/dev-kit/app/v1/Hooks/Customer/onBeforeForceDelete.d.ts +3 -0
  32. package/build/dev-kit/app/v1/Hooks/Customer/onBeforeForceDelete.js +14 -0
  33. package/build/dev-kit/app/v1/Hooks/CustomerHook.d.ts +3 -0
  34. package/build/dev-kit/app/v1/Hooks/CustomerHook.js +16 -0
  35. package/build/dev-kit/app/v1/Hooks/Employee/onBeforeForceDelete.d.ts +2 -0
  36. package/build/dev-kit/app/v1/Hooks/Employee/onBeforeForceDelete.js +14 -0
  37. package/build/dev-kit/app/v1/Hooks/EmployeeHook.d.ts +2 -0
  38. package/build/dev-kit/app/v1/Hooks/EmployeeHook.js +16 -0
  39. package/build/dev-kit/app/v1/Hooks/User/onBeforeInsert.d.ts +2 -0
  40. package/build/dev-kit/app/v1/Hooks/User/onBeforeInsert.js +14 -0
  41. package/build/dev-kit/app/v1/Hooks/UserHook.d.ts +3 -0
  42. package/build/dev-kit/app/v1/Hooks/UserHook.js +17 -0
  43. package/build/dev-kit/app/v1/Models/Customer.d.ts +7 -0
  44. package/build/dev-kit/app/v1/Models/Customer.js +15 -0
  45. package/build/dev-kit/app/v1/Models/Employee.d.ts +9 -0
  46. package/build/dev-kit/app/v1/Models/Employee.js +21 -0
  47. package/build/dev-kit/app/v1/Models/EmployeeAddress.d.ts +8 -0
  48. package/build/dev-kit/app/v1/Models/EmployeeAddress.js +18 -0
  49. package/build/dev-kit/app/v1/Models/Post.d.ts +6 -0
  50. package/build/dev-kit/app/v1/Models/Post.js +14 -0
  51. package/build/dev-kit/app/v1/Models/User.d.ts +7 -0
  52. package/build/dev-kit/app/v1/Models/User.js +23 -0
  53. package/build/dev-kit/app/v1/Serialization/PostSerialization.d.ts +3 -0
  54. package/build/dev-kit/app/v1/Serialization/PostSerialization.js +6 -0
  55. package/build/dev-kit/app/v1/Serialization/UserSerialization.d.ts +3 -0
  56. package/build/dev-kit/app/v1/Serialization/UserSerialization.js +5 -0
  57. package/build/dev-kit/app/v1/config.d.ts +3 -0
  58. package/build/dev-kit/app/v1/config.js +19 -0
  59. package/build/dev-kit/app/v1/init.d.ts +4 -0
  60. package/build/dev-kit/app/v1/init.js +16 -0
  61. package/build/dev-kit/app/v2/Events/UserEvent.d.ts +3 -0
  62. package/build/dev-kit/app/v2/Events/UserEvent.js +16 -0
  63. package/build/dev-kit/app/v2/Hooks/CustomerHook.d.ts +3 -0
  64. package/build/dev-kit/app/v2/Hooks/CustomerHook.js +16 -0
  65. package/build/dev-kit/app/v2/Hooks/EmployeeHook.d.ts +2 -0
  66. package/build/dev-kit/app/v2/Hooks/EmployeeHook.js +16 -0
  67. package/build/dev-kit/app/v2/Hooks/UserHook.d.ts +3 -0
  68. package/build/dev-kit/app/v2/Hooks/UserHook.js +17 -0
  69. package/build/dev-kit/app/v2/Models/Customer.d.ts +10 -0
  70. package/build/dev-kit/app/v2/Models/Customer.js +20 -0
  71. package/build/dev-kit/app/v2/Models/Employee.d.ts +9 -0
  72. package/build/dev-kit/app/v2/Models/Employee.js +21 -0
  73. package/build/dev-kit/app/v2/Models/EmployeeAddress.d.ts +8 -0
  74. package/build/dev-kit/app/v2/Models/EmployeeAddress.js +18 -0
  75. package/build/dev-kit/app/v2/Models/Post.d.ts +6 -0
  76. package/build/dev-kit/app/v2/Models/Post.js +14 -0
  77. package/build/dev-kit/app/v2/Models/User.d.ts +7 -0
  78. package/build/dev-kit/app/v2/Models/User.js +23 -0
  79. package/build/dev-kit/app/v2/Serialization/UserSerialization.d.ts +3 -0
  80. package/build/dev-kit/app/v2/Serialization/UserSerialization.js +5 -0
  81. package/build/dev-kit/app/v2/config.d.ts +3 -0
  82. package/build/dev-kit/app/v2/config.js +9 -0
  83. package/build/dev-kit/app/v2/init.d.ts +4 -0
  84. package/build/dev-kit/app/v2/init.js +16 -0
  85. package/build/dev-kit/app/v3/config.d.ts +3 -0
  86. package/build/dev-kit/app/v3/config.js +9 -0
  87. package/build/dev-kit/config.d.ts +3 -0
  88. package/build/dev-kit/config.js +31 -0
  89. package/build/dev-kit.d.ts +1 -0
  90. package/build/dev-kit.js +16 -0
  91. package/build/package.json +67 -0
  92. package/build/src/Builders/ModelTreeBuilder.d.ts +3 -0
  93. package/build/src/Builders/ModelTreeBuilder.js +21 -17
  94. package/build/src/Builders/RouterBuilder.d.ts +3 -0
  95. package/build/src/Builders/RouterBuilder.js +27 -25
  96. package/build/src/Enums.d.ts +10 -0
  97. package/build/src/Enums.js +12 -1
  98. package/build/src/Exceptions/AxeError.d.ts +8 -0
  99. package/build/src/Exceptions/AxeError.js +11 -0
  100. package/build/src/Handlers/AllHandler.js +4 -5
  101. package/build/src/Handlers/DocsHandler.d.ts +3 -0
  102. package/build/src/Handlers/DocsHandler.js +22 -0
  103. package/build/src/Handlers/HandlerFactory.d.ts +1 -1
  104. package/build/src/Handlers/HandlerFactory.js +1 -1
  105. package/build/src/Handlers/Helpers.d.ts +4 -3
  106. package/build/src/Handlers/Helpers.js +9 -10
  107. package/build/src/Handlers/PaginateHandler.js +4 -5
  108. package/build/src/Handlers/PatchHandler.js +2 -2
  109. package/build/src/Handlers/RoutesHandler.d.ts +3 -0
  110. package/build/src/Handlers/RoutesHandler.js +16 -0
  111. package/build/src/Handlers/ShowHandler.js +4 -5
  112. package/build/src/Handlers/StoreHandler.js +2 -2
  113. package/build/src/Handlers/UpdateHandler.js +2 -2
  114. package/build/src/Helpers.d.ts +4 -0
  115. package/build/src/Helpers.js +78 -0
  116. package/build/src/Interfaces.d.ts +36 -13
  117. package/build/src/Middlewares/acceptLanguageMiddleware.js +3 -5
  118. package/build/src/Model.d.ts +0 -1
  119. package/build/src/Model.js +0 -4
  120. package/build/src/Resolvers/FileResolver.js +4 -2
  121. package/build/src/Resolvers/FolderResolver.js +1 -0
  122. package/build/src/Resolvers/GeneralHookResolver.d.ts +4 -2
  123. package/build/src/Resolvers/GeneralHookResolver.js +5 -8
  124. package/build/src/Resolvers/ModelResolver.d.ts +6 -0
  125. package/build/src/Resolvers/ModelResolver.js +81 -19
  126. package/build/src/Resolvers/TransactionResolver.d.ts +4 -2
  127. package/build/src/Resolvers/TransactionResolver.js +5 -4
  128. package/build/src/Resolvers/VersionConfigResolver.d.ts +7 -0
  129. package/build/src/Resolvers/VersionConfigResolver.js +59 -0
  130. package/build/src/Resolvers/VersionResolver.d.ts +7 -0
  131. package/build/src/Resolvers/VersionResolver.js +65 -0
  132. package/build/src/Resolvers/index.d.ts +3 -2
  133. package/build/src/Resolvers/index.js +5 -3
  134. package/build/src/Server.d.ts +3 -2
  135. package/build/src/Server.js +74 -46
  136. package/build/src/Services/APIService.d.ts +16 -0
  137. package/build/src/Services/APIService.js +79 -0
  138. package/build/src/Services/DocumentationService.d.ts +3 -1
  139. package/build/src/Services/DocumentationService.js +6 -0
  140. package/build/src/Services/LogService.d.ts +4 -1
  141. package/build/src/Services/LogService.js +6 -0
  142. package/build/src/Services/ModelService.d.ts +3 -0
  143. package/build/src/Services/ModelService.js +4 -0
  144. package/build/src/Services/SchemaValidatorService.d.ts +3 -0
  145. package/build/src/Services/SchemaValidatorService.js +12 -8
  146. package/build/src/Services/index.d.ts +2 -1
  147. package/build/src/Services/index.js +3 -1
  148. package/build/src/Types.d.ts +2 -0
  149. package/build/src/Types.js +2 -0
  150. package/build/src/constants.js +0 -1
  151. package/package.json +6 -5
  152. package/CHANGELOG.md +0 -212
@@ -0,0 +1,23 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const index_1 = require("../../../../index");
4
+ class User extends index_1.Model {
5
+ get fillable() {
6
+ return {
7
+ POST: ["email", "name", "surname"],
8
+ PUT: ["name", "surname"],
9
+ PATCH: ["name", "surname"],
10
+ };
11
+ }
12
+ get validations() {
13
+ return {
14
+ email: "required|email",
15
+ name: "required",
16
+ surname: "required",
17
+ };
18
+ }
19
+ posts() {
20
+ return this.hasMany("Post", "id", "user_id");
21
+ }
22
+ }
23
+ exports.default = User;
@@ -0,0 +1,3 @@
1
+ import { Request } from "express";
2
+ declare const _default: (item: any, request: Request) => any;
3
+ export default _default;
@@ -0,0 +1,6 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.default = (item, request) => {
4
+ console.log("v1.PostSerialization");
5
+ return item;
6
+ };
@@ -0,0 +1,3 @@
1
+ import { Request } from "express";
2
+ declare const _default: (item: any, request: Request) => any;
3
+ export default _default;
@@ -0,0 +1,5 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.default = (item, request) => {
4
+ return Object.assign(Object.assign({}, item), { fullname: `${item.name || ""} ${item.surname || ""}`.trim() });
5
+ };
@@ -0,0 +1,3 @@
1
+ import { IVersionConfig } from "../../../index";
2
+ declare const config: IVersionConfig;
3
+ export default config;
@@ -0,0 +1,19 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const index_1 = require("../../../index");
4
+ const simpleSerializer = (data, request) => {
5
+ data.signed = true;
6
+ return data;
7
+ };
8
+ const config = {
9
+ transaction: [],
10
+ serializers: [
11
+ {
12
+ handler: [index_1.HandlerTypes.PAGINATE],
13
+ serializer: [simpleSerializer],
14
+ },
15
+ ],
16
+ supportedLanguages: ["en-GB", "en", "tr", "de"],
17
+ defaultLanguage: "en-GB",
18
+ };
19
+ exports.default = config;
@@ -0,0 +1,4 @@
1
+ import { Express } from "express";
2
+ declare const onBeforeInit: (app: Express) => Promise<void>;
3
+ declare const onAfterInit: (app: Express) => Promise<void>;
4
+ export { onBeforeInit, onAfterInit };
@@ -0,0 +1,16 @@
1
+ "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ exports.onAfterInit = exports.onBeforeInit = void 0;
13
+ const onBeforeInit = (app) => __awaiter(void 0, void 0, void 0, function* () { });
14
+ exports.onBeforeInit = onBeforeInit;
15
+ const onAfterInit = (app) => __awaiter(void 0, void 0, void 0, function* () { });
16
+ exports.onAfterInit = onAfterInit;
@@ -0,0 +1,3 @@
1
+ import { IHookParameter } from "../../../../index";
2
+ declare const onAfterInsert: ({ item }: IHookParameter) => Promise<void>;
3
+ export { onAfterInsert };
@@ -0,0 +1,16 @@
1
+ "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ exports.onAfterInsert = void 0;
13
+ const onAfterInsert = ({ item }) => __awaiter(void 0, void 0, void 0, function* () {
14
+ // console.log("onAfterInsert", item);
15
+ });
16
+ exports.onAfterInsert = onAfterInsert;
@@ -0,0 +1,3 @@
1
+ import { IHookParameter } from "../../../../index";
2
+ declare const onBeforeForceDelete: ({ formData }: IHookParameter) => Promise<never>;
3
+ export { onBeforeForceDelete };
@@ -0,0 +1,16 @@
1
+ "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ exports.onBeforeForceDelete = void 0;
13
+ const onBeforeForceDelete = ({ formData }) => __awaiter(void 0, void 0, void 0, function* () {
14
+ throw new Error("Fake");
15
+ });
16
+ exports.onBeforeForceDelete = onBeforeForceDelete;
@@ -0,0 +1,2 @@
1
+ declare const onBeforeForceDelete: () => Promise<never>;
2
+ export { onBeforeForceDelete };
@@ -0,0 +1,16 @@
1
+ "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ exports.onBeforeForceDelete = void 0;
13
+ const onBeforeForceDelete = () => __awaiter(void 0, void 0, void 0, function* () {
14
+ throw new Error("This is just a test message.");
15
+ });
16
+ exports.onBeforeForceDelete = onBeforeForceDelete;
@@ -0,0 +1,3 @@
1
+ import { IHookParameter } from "../../../../index";
2
+ declare const onBeforeInsert: ({ formData }: IHookParameter) => Promise<void>;
3
+ export { onBeforeInsert };
@@ -0,0 +1,17 @@
1
+ "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ exports.onBeforeInsert = void 0;
13
+ const onBeforeInsert = ({ formData }) => __awaiter(void 0, void 0, void 0, function* () {
14
+ // const mailer = await IoCService.use("Mailer");
15
+ // formData.created_at = new Date();
16
+ });
17
+ exports.onBeforeInsert = onBeforeInsert;
@@ -0,0 +1,10 @@
1
+ import { Model } from "../../../../index";
2
+ declare class Customer extends Model {
3
+ get table(): string;
4
+ get validations(): {
5
+ name: string;
6
+ };
7
+ get fillable(): string[];
8
+ employees(): import("../../../../index").IRelation;
9
+ }
10
+ export default Customer;
@@ -0,0 +1,20 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const index_1 = require("../../../../index");
4
+ class Customer extends index_1.Model {
5
+ get table() {
6
+ return "soft_delete_1";
7
+ }
8
+ get validations() {
9
+ return {
10
+ name: "required|min:100",
11
+ };
12
+ }
13
+ get fillable() {
14
+ return ["name"];
15
+ }
16
+ employees() {
17
+ return this.hasMany("Employee", "id", "parent_id");
18
+ }
19
+ }
20
+ exports.default = Customer;
@@ -0,0 +1,9 @@
1
+ import { Model } from "../../../../index";
2
+ declare class Employee extends Model {
3
+ get table(): string;
4
+ get fillable(): string[];
5
+ get deletedAtColumn(): string;
6
+ children(): import("../../../../index").IRelation;
7
+ parent(): import("../../../../index").IRelation;
8
+ }
9
+ export default Employee;
@@ -0,0 +1,21 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const index_1 = require("../../../../index");
4
+ class Employee extends index_1.Model {
5
+ get table() {
6
+ return "soft_delete_2";
7
+ }
8
+ get fillable() {
9
+ return ["name"];
10
+ }
11
+ get deletedAtColumn() {
12
+ return "deleted_at";
13
+ }
14
+ children() {
15
+ return this.hasMany("EmployeeAddress", "id", "parent_id");
16
+ }
17
+ parent() {
18
+ return this.belongsTo("Customer", "parent_id", "id");
19
+ }
20
+ }
21
+ exports.default = Employee;
@@ -0,0 +1,8 @@
1
+ import { Model } from "../../../../index";
2
+ declare class EmployeeAddress extends Model {
3
+ get table(): string;
4
+ get fillable(): string[];
5
+ get deletedAtColumn(): string;
6
+ parent(): import("../../../../index").IRelation;
7
+ }
8
+ export default EmployeeAddress;
@@ -0,0 +1,18 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const index_1 = require("../../../../index");
4
+ class EmployeeAddress extends index_1.Model {
5
+ get table() {
6
+ return "soft_delete_3";
7
+ }
8
+ get fillable() {
9
+ return ["name"];
10
+ }
11
+ get deletedAtColumn() {
12
+ return "deleted_at";
13
+ }
14
+ parent() {
15
+ return this.belongsTo("Employee", "parent_id", "id");
16
+ }
17
+ }
18
+ exports.default = EmployeeAddress;
@@ -0,0 +1,6 @@
1
+ import { Model } from "../../../../index";
2
+ declare class Post extends Model {
3
+ get fillable(): string[];
4
+ get validations(): Record<string, string>;
5
+ }
6
+ export default Post;
@@ -0,0 +1,14 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const index_1 = require("../../../../index");
4
+ class Post extends index_1.Model {
5
+ get fillable() {
6
+ return ["title"];
7
+ }
8
+ get validations() {
9
+ return {
10
+ title: "required",
11
+ };
12
+ }
13
+ }
14
+ exports.default = Post;
@@ -0,0 +1,7 @@
1
+ import { IMethodBaseConfig, IRelation, Model } from "../../../../index";
2
+ declare class User extends Model {
3
+ get fillable(): IMethodBaseConfig;
4
+ get validations(): Record<string, string>;
5
+ posts(): IRelation;
6
+ }
7
+ export default User;
@@ -0,0 +1,23 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const index_1 = require("../../../../index");
4
+ class User extends index_1.Model {
5
+ get fillable() {
6
+ return {
7
+ POST: ["email", "name", "surname"],
8
+ PUT: ["name", "surname"],
9
+ PATCH: ["name", "surname"],
10
+ };
11
+ }
12
+ get validations() {
13
+ return {
14
+ email: "required|email",
15
+ name: "required",
16
+ surname: "required",
17
+ };
18
+ }
19
+ posts() {
20
+ return this.hasMany("Post", "id", "user_id");
21
+ }
22
+ }
23
+ exports.default = User;
@@ -0,0 +1,3 @@
1
+ import { Request } from "express";
2
+ declare const _default: (item: any, request: Request) => any;
3
+ export default _default;
@@ -0,0 +1,5 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.default = (item, request) => {
4
+ return Object.assign(Object.assign({}, item), { fullname: `${item.name || ""} ${item.surname || ""}`.trim() });
5
+ };
@@ -0,0 +1,3 @@
1
+ import { IVersionConfig } from "../../../index";
2
+ declare const config: IVersionConfig;
3
+ export default config;
@@ -0,0 +1,9 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const config = {
4
+ transaction: [],
5
+ serializers: [],
6
+ supportedLanguages: ["en-GB", "en", "tr", "de"],
7
+ defaultLanguage: "en-GB",
8
+ };
9
+ exports.default = config;
@@ -0,0 +1,4 @@
1
+ import { Express } from "express";
2
+ declare const onBeforeInit: (app: Express) => Promise<void>;
3
+ declare const onAfterInit: (app: Express) => Promise<void>;
4
+ export { onBeforeInit, onAfterInit };
@@ -0,0 +1,16 @@
1
+ "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ exports.onAfterInit = exports.onBeforeInit = void 0;
13
+ const onBeforeInit = (app) => __awaiter(void 0, void 0, void 0, function* () { });
14
+ exports.onBeforeInit = onBeforeInit;
15
+ const onAfterInit = (app) => __awaiter(void 0, void 0, void 0, function* () { });
16
+ exports.onAfterInit = onAfterInit;
@@ -0,0 +1,3 @@
1
+ import { IVersionConfig } from "../../../index";
2
+ declare const config: IVersionConfig;
3
+ export default config;
@@ -0,0 +1,9 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const config = {
4
+ transaction: [],
5
+ serializers: [],
6
+ supportedLanguages: ["en-GB", "en", "tr", "de"],
7
+ defaultLanguage: "en-GB",
8
+ };
9
+ exports.default = config;
@@ -0,0 +1,3 @@
1
+ import { IApplicationConfig } from "../index";
2
+ declare const config: IApplicationConfig;
3
+ export default config;
@@ -0,0 +1,31 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ const path_1 = __importDefault(require("path"));
7
+ const index_1 = require("../index");
8
+ const config = {
9
+ prefix: "api",
10
+ env: process.env.NODE_ENV || "production",
11
+ port: process.env.APP_PORT ? parseInt(process.env.APP_PORT) : 3000,
12
+ logLevel: index_1.LogLevels.INFO,
13
+ database: {
14
+ client: process.env.DB_CLIENT || "mysql",
15
+ connection: {
16
+ host: process.env.DB_HOST || "localhost",
17
+ user: process.env.DB_USER || "user",
18
+ password: process.env.DB_PASSWORD || "password",
19
+ database: process.env.DB_DATABASE || "database",
20
+ filename: path_1.default.join(__dirname, "..", "..", "mydb.sqlite"),
21
+ },
22
+ pool: {
23
+ min: 2,
24
+ max: 10,
25
+ },
26
+ migrations: {
27
+ tableName: "knex_migrations",
28
+ },
29
+ },
30
+ };
31
+ exports.default = config;
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,16 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ const node_color_log_1 = __importDefault(require("node-color-log"));
7
+ const dotenv_1 = __importDefault(require("dotenv"));
8
+ const path_1 = __importDefault(require("path"));
9
+ const index_1 = require("./index");
10
+ node_color_log_1.default.bgColor("yellow").color("black").log("Axe API dev-kit (1.0.0)");
11
+ node_color_log_1.default
12
+ .color("blue")
13
+ .log("Docs: https://axe-api.com/contribution/fundamentals.html \n");
14
+ dotenv_1.default.config();
15
+ const server = new index_1.Server();
16
+ server.start(path_1.default.join(__dirname, "dev-kit"));
@@ -0,0 +1,67 @@
1
+ {
2
+ "name": "axe-api",
3
+ "version": "0.20.3",
4
+ "description": "AXE API is a simple tool which has been created based on Express and Knex.js to create Rest APIs quickly.",
5
+ "main": "build/index.js",
6
+ "types": "build/index.d.ts",
7
+ "files": [
8
+ "/build"
9
+ ],
10
+ "directories": {
11
+ "test": "tests"
12
+ },
13
+ "author": "Özgür Adem Işıklı <i.ozguradem@gmail.com>",
14
+ "license": "MIT",
15
+ "scripts": {
16
+ "build": "tsc",
17
+ "build:watch": "tsc -w",
18
+ "postbuild": "sh scripts/postbuild.sh",
19
+ "dev": "ts-node-dev --respawn --clear index.ts",
20
+ "test": "jest --runInBand",
21
+ "test:dev": "jest --watch",
22
+ "lint": "eslint src/**",
23
+ "lint:watch": "esw --watch --color",
24
+ "prepare:integration": "nodemon --ignore \"./tests/**\" ./scripts/run-integration-test.js",
25
+ "test:integration:mysql8": "cd ./tests/integrations && node index.js mysql8",
26
+ "test:integration:mysql57": "cd ./tests/integrations && node index.js mysql57",
27
+ "test:integration:postgres": "cd ./tests/integrations && node index.js postgres"
28
+ },
29
+ "dependencies": {
30
+ "@types/express": "^4.17.15",
31
+ "change-case": "^4.1.2",
32
+ "dotenv": "^14.2.0",
33
+ "express": "^4.18.2",
34
+ "http-status-codes": "^2.2.0",
35
+ "knex": "^2.3.0",
36
+ "knex-paginate": "^3.0.2",
37
+ "knex-schema-inspector": "^2.0.4",
38
+ "pluralize": "^8.0.0",
39
+ "validatorjs": "^3.22.1"
40
+ },
41
+ "devDependencies": {
42
+ "@babel/core": "^7.19.1",
43
+ "@babel/preset-env": "^7.19.1",
44
+ "@babel/preset-typescript": "^7.18.6",
45
+ "@types/pluralize": "^0.0.29",
46
+ "@types/validatorjs": "^3.15.0",
47
+ "@typescript-eslint/eslint-plugin": "^5.37.0",
48
+ "@typescript-eslint/parser": "^5.37.0",
49
+ "babel-jest": "^29.0.3",
50
+ "eslint": "^7.32.0",
51
+ "eslint-config-standard": "^16.0.3",
52
+ "eslint-plugin-import": "^2.25.4",
53
+ "eslint-plugin-node": "^11.1.0",
54
+ "eslint-plugin-promise": "^5.1.0",
55
+ "eslint-plugin-unicorn": "^33.0.1",
56
+ "eslint-watch": "^7.0.0",
57
+ "glob": "^8.0.3",
58
+ "jest": "^29.0.3",
59
+ "mysql": "^2.18.1",
60
+ "nodemon": "^2.0.15",
61
+ "pg": "^8.7.1",
62
+ "set-value": ">=4.1.0",
63
+ "sqlite3": "^5.0.2",
64
+ "ts-node": "^10.9.1",
65
+ "typescript": "^4.8.3"
66
+ }
67
+ }
@@ -1,4 +1,7 @@
1
+ import { IVersion } from "../Interfaces";
1
2
  declare class ModelTreeBuilder {
3
+ private version;
4
+ constructor(version: IVersion);
2
5
  build(): Promise<void>;
3
6
  private getRootLevelOfTree;
4
7
  private createRecursiveTree;
@@ -12,38 +12,42 @@ Object.defineProperty(exports, "__esModule", { value: true });
12
12
  const Enums_1 = require("../Enums");
13
13
  const Services_1 = require("../Services");
14
14
  class ModelTreeBuilder {
15
+ constructor(version) {
16
+ this.version = version;
17
+ }
15
18
  build() {
16
19
  return __awaiter(this, void 0, void 0, function* () {
17
- const logger = yield Services_1.IoCService.useByType("LogService");
18
- const modelList = yield Services_1.IoCService.useByType("ModelListService");
19
- const tree = this.getRootLevelOfTree(modelList);
20
- this.createRecursiveTree(tree, modelList);
21
- this.addNestedRoutes(tree, modelList);
22
- Services_1.IoCService.singleton("ModelTree", () => tree);
23
- logger.info("Model tree has been created.");
20
+ const logger = Services_1.LogService.getInstance();
21
+ const tree = this.getRootLevelOfTree();
22
+ this.createRecursiveTree(tree);
23
+ this.addNestedRoutes(tree);
24
+ this.version.modelTree = tree;
25
+ logger.info(`[${this.version.name}] Model tree has been created.`);
24
26
  });
25
27
  }
26
- getRootLevelOfTree(modelList) {
28
+ getRootLevelOfTree() {
27
29
  const childModels = [];
28
- modelList.get().forEach((model) => {
30
+ this.version.modelList.get().forEach((model) => {
29
31
  childModels.push(...model.relations
30
32
  .filter((relation) => relation.type === Enums_1.Relationships.HAS_MANY)
31
33
  .map((relation) => relation.model));
32
34
  });
33
- return modelList.get().filter((model) => !childModels.includes(model.name));
35
+ return this.version.modelList
36
+ .get()
37
+ .filter((model) => !childModels.includes(model.name));
34
38
  }
35
- createRecursiveTree(tree, modelList) {
39
+ createRecursiveTree(tree) {
36
40
  for (const model of tree) {
37
- this.setChildrens(model, modelList);
41
+ this.setChildrens(model);
38
42
  }
39
43
  }
40
- setChildrens(model, modelList) {
44
+ setChildrens(model) {
41
45
  const childModelNames = this.getChildModelNames(model);
42
- model.children = modelList
46
+ model.children = this.version.modelList
43
47
  .get()
44
48
  .filter((item) => childModelNames.includes(item.name));
45
49
  for (const child of model.children) {
46
- this.setChildrens(child, modelList);
50
+ this.setChildrens(child);
47
51
  }
48
52
  }
49
53
  getChildModelNames(model) {
@@ -51,9 +55,9 @@ class ModelTreeBuilder {
51
55
  .filter((item) => item.type === Enums_1.Relationships.HAS_MANY)
52
56
  .map((item) => item.model);
53
57
  }
54
- addNestedRoutes(tree, modelList) {
58
+ addNestedRoutes(tree) {
55
59
  // We should add recursive models
56
- modelList.get().forEach((model) => {
60
+ this.version.modelList.get().forEach((model) => {
57
61
  const recursiveRelations = model.relations.filter((relation) => relation.model === model.name);
58
62
  if (recursiveRelations.length === 2) {
59
63
  tree.push(Object.assign(Object.assign({}, model), { isRecursive: true, children: [] }));
@@ -1,4 +1,7 @@
1
+ import { IVersion } from "../Interfaces";
1
2
  declare class RouterBuilder {
3
+ private version;
4
+ constructor(version: IVersion);
2
5
  build(): Promise<void>;
3
6
  private createRoutesByModelTree;
4
7
  private createRouteByModel;