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.
- package/build/dev-kit/app/Config/Application.d.ts +3 -0
- package/build/dev-kit/app/Config/Application.js +14 -0
- package/build/dev-kit/app/Config/Database.d.ts +3 -0
- package/build/dev-kit/app/Config/Database.js +24 -0
- package/build/dev-kit/app/Events/UserEvent.d.ts +3 -0
- package/build/dev-kit/app/Events/UserEvent.js +16 -0
- package/build/dev-kit/app/Hooks/CustomerHook.d.ts +3 -0
- package/build/dev-kit/app/Hooks/CustomerHook.js +16 -0
- package/build/dev-kit/app/Hooks/EmployeeHook.d.ts +2 -0
- package/build/dev-kit/app/Hooks/EmployeeHook.js +16 -0
- package/build/dev-kit/app/Hooks/UserHook.d.ts +3 -0
- package/build/dev-kit/app/Hooks/UserHook.js +17 -0
- package/build/dev-kit/app/Models/Customer.d.ts +7 -0
- package/build/dev-kit/app/Models/Customer.js +15 -0
- package/build/dev-kit/app/Models/Employee.d.ts +9 -0
- package/build/dev-kit/app/Models/Employee.js +21 -0
- package/build/dev-kit/app/Models/EmployeeAddress.d.ts +8 -0
- package/build/dev-kit/app/Models/EmployeeAddress.js +18 -0
- package/build/dev-kit/app/Models/Post.d.ts +6 -0
- package/build/dev-kit/app/Models/Post.js +14 -0
- package/build/dev-kit/app/Models/User.d.ts +7 -0
- package/build/dev-kit/app/Models/User.js +23 -0
- package/build/dev-kit/app/Serialization/UserSerialization.d.ts +3 -0
- package/build/dev-kit/app/Serialization/UserSerialization.js +6 -0
- package/build/dev-kit/app/config.d.ts +3 -0
- package/build/dev-kit/app/config.js +31 -0
- package/build/dev-kit/app/init.d.ts +4 -0
- package/build/dev-kit/app/init.js +16 -0
- package/build/dev-kit/app/v1/Events/UserEvent.d.ts +3 -0
- package/build/dev-kit/app/v1/Events/UserEvent.js +16 -0
- package/build/dev-kit/app/v1/Hooks/Customer/onBeforeForceDelete.d.ts +3 -0
- package/build/dev-kit/app/v1/Hooks/Customer/onBeforeForceDelete.js +14 -0
- package/build/dev-kit/app/v1/Hooks/CustomerHook.d.ts +3 -0
- package/build/dev-kit/app/v1/Hooks/CustomerHook.js +16 -0
- package/build/dev-kit/app/v1/Hooks/Employee/onBeforeForceDelete.d.ts +2 -0
- package/build/dev-kit/app/v1/Hooks/Employee/onBeforeForceDelete.js +14 -0
- package/build/dev-kit/app/v1/Hooks/EmployeeHook.d.ts +2 -0
- package/build/dev-kit/app/v1/Hooks/EmployeeHook.js +16 -0
- package/build/dev-kit/app/v1/Hooks/User/onBeforeInsert.d.ts +2 -0
- package/build/dev-kit/app/v1/Hooks/User/onBeforeInsert.js +14 -0
- package/build/dev-kit/app/v1/Hooks/UserHook.d.ts +3 -0
- package/build/dev-kit/app/v1/Hooks/UserHook.js +17 -0
- package/build/dev-kit/app/v1/Models/Customer.d.ts +7 -0
- package/build/dev-kit/app/v1/Models/Customer.js +15 -0
- package/build/dev-kit/app/v1/Models/Employee.d.ts +9 -0
- package/build/dev-kit/app/v1/Models/Employee.js +21 -0
- package/build/dev-kit/app/v1/Models/EmployeeAddress.d.ts +8 -0
- package/build/dev-kit/app/v1/Models/EmployeeAddress.js +18 -0
- package/build/dev-kit/app/v1/Models/Post.d.ts +6 -0
- package/build/dev-kit/app/v1/Models/Post.js +14 -0
- package/build/dev-kit/app/v1/Models/User.d.ts +7 -0
- package/build/dev-kit/app/v1/Models/User.js +23 -0
- package/build/dev-kit/app/v1/Serialization/PostSerialization.d.ts +3 -0
- package/build/dev-kit/app/v1/Serialization/PostSerialization.js +6 -0
- package/build/dev-kit/app/v1/Serialization/UserSerialization.d.ts +3 -0
- package/build/dev-kit/app/v1/Serialization/UserSerialization.js +5 -0
- package/build/dev-kit/app/v1/config.d.ts +3 -0
- package/build/dev-kit/app/v1/config.js +19 -0
- package/build/dev-kit/app/v1/init.d.ts +4 -0
- package/build/dev-kit/app/v1/init.js +16 -0
- package/build/dev-kit/app/v2/Events/UserEvent.d.ts +3 -0
- package/build/dev-kit/app/v2/Events/UserEvent.js +16 -0
- package/build/dev-kit/app/v2/Hooks/CustomerHook.d.ts +3 -0
- package/build/dev-kit/app/v2/Hooks/CustomerHook.js +16 -0
- package/build/dev-kit/app/v2/Hooks/EmployeeHook.d.ts +2 -0
- package/build/dev-kit/app/v2/Hooks/EmployeeHook.js +16 -0
- package/build/dev-kit/app/v2/Hooks/UserHook.d.ts +3 -0
- package/build/dev-kit/app/v2/Hooks/UserHook.js +17 -0
- package/build/dev-kit/app/v2/Models/Customer.d.ts +10 -0
- package/build/dev-kit/app/v2/Models/Customer.js +20 -0
- package/build/dev-kit/app/v2/Models/Employee.d.ts +9 -0
- package/build/dev-kit/app/v2/Models/Employee.js +21 -0
- package/build/dev-kit/app/v2/Models/EmployeeAddress.d.ts +8 -0
- package/build/dev-kit/app/v2/Models/EmployeeAddress.js +18 -0
- package/build/dev-kit/app/v2/Models/Post.d.ts +6 -0
- package/build/dev-kit/app/v2/Models/Post.js +14 -0
- package/build/dev-kit/app/v2/Models/User.d.ts +7 -0
- package/build/dev-kit/app/v2/Models/User.js +23 -0
- package/build/dev-kit/app/v2/Serialization/UserSerialization.d.ts +3 -0
- package/build/dev-kit/app/v2/Serialization/UserSerialization.js +5 -0
- package/build/dev-kit/app/v2/config.d.ts +3 -0
- package/build/dev-kit/app/v2/config.js +9 -0
- package/build/dev-kit/app/v2/init.d.ts +4 -0
- package/build/dev-kit/app/v2/init.js +16 -0
- package/build/dev-kit/app/v3/config.d.ts +3 -0
- package/build/dev-kit/app/v3/config.js +9 -0
- package/build/dev-kit/config.d.ts +3 -0
- package/build/dev-kit/config.js +31 -0
- package/build/dev-kit.d.ts +1 -0
- package/build/dev-kit.js +16 -0
- package/build/package.json +67 -0
- package/build/src/Builders/ModelTreeBuilder.d.ts +3 -0
- package/build/src/Builders/ModelTreeBuilder.js +21 -17
- package/build/src/Builders/RouterBuilder.d.ts +3 -0
- package/build/src/Builders/RouterBuilder.js +27 -25
- package/build/src/Enums.d.ts +10 -0
- package/build/src/Enums.js +12 -1
- package/build/src/Exceptions/AxeError.d.ts +8 -0
- package/build/src/Exceptions/AxeError.js +11 -0
- package/build/src/Handlers/AllHandler.js +4 -5
- package/build/src/Handlers/DocsHandler.d.ts +3 -0
- package/build/src/Handlers/DocsHandler.js +22 -0
- package/build/src/Handlers/HandlerFactory.d.ts +1 -1
- package/build/src/Handlers/HandlerFactory.js +1 -1
- package/build/src/Handlers/Helpers.d.ts +4 -3
- package/build/src/Handlers/Helpers.js +9 -10
- package/build/src/Handlers/PaginateHandler.js +4 -5
- package/build/src/Handlers/PatchHandler.js +2 -2
- package/build/src/Handlers/RoutesHandler.d.ts +3 -0
- package/build/src/Handlers/RoutesHandler.js +16 -0
- package/build/src/Handlers/ShowHandler.js +4 -5
- package/build/src/Handlers/StoreHandler.js +2 -2
- package/build/src/Handlers/UpdateHandler.js +2 -2
- package/build/src/Helpers.d.ts +4 -0
- package/build/src/Helpers.js +78 -0
- package/build/src/Interfaces.d.ts +36 -13
- package/build/src/Middlewares/acceptLanguageMiddleware.js +3 -5
- package/build/src/Model.d.ts +0 -1
- package/build/src/Model.js +0 -4
- package/build/src/Resolvers/FileResolver.js +4 -2
- package/build/src/Resolvers/FolderResolver.js +1 -0
- package/build/src/Resolvers/GeneralHookResolver.d.ts +4 -2
- package/build/src/Resolvers/GeneralHookResolver.js +5 -8
- package/build/src/Resolvers/ModelResolver.d.ts +6 -0
- package/build/src/Resolvers/ModelResolver.js +81 -19
- package/build/src/Resolvers/TransactionResolver.d.ts +4 -2
- package/build/src/Resolvers/TransactionResolver.js +5 -4
- package/build/src/Resolvers/VersionConfigResolver.d.ts +7 -0
- package/build/src/Resolvers/VersionConfigResolver.js +59 -0
- package/build/src/Resolvers/VersionResolver.d.ts +7 -0
- package/build/src/Resolvers/VersionResolver.js +65 -0
- package/build/src/Resolvers/index.d.ts +3 -2
- package/build/src/Resolvers/index.js +5 -3
- package/build/src/Server.d.ts +3 -2
- package/build/src/Server.js +74 -46
- package/build/src/Services/APIService.d.ts +16 -0
- package/build/src/Services/APIService.js +79 -0
- package/build/src/Services/DocumentationService.d.ts +3 -1
- package/build/src/Services/DocumentationService.js +6 -0
- package/build/src/Services/LogService.d.ts +4 -1
- package/build/src/Services/LogService.js +6 -0
- package/build/src/Services/ModelService.d.ts +3 -0
- package/build/src/Services/ModelService.js +4 -0
- package/build/src/Services/SchemaValidatorService.d.ts +3 -0
- package/build/src/Services/SchemaValidatorService.js +12 -8
- package/build/src/Services/index.d.ts +2 -1
- package/build/src/Services/index.js +3 -1
- package/build/src/Types.d.ts +2 -0
- package/build/src/Types.js +2 -0
- package/build/src/constants.js +0 -1
- package/package.json +6 -5
- 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,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,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,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,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,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,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,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,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,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,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,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 {};
|
package/build/dev-kit.js
ADDED
|
@@ -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
|
+
}
|
|
@@ -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 =
|
|
18
|
-
const
|
|
19
|
-
|
|
20
|
-
this.
|
|
21
|
-
this.
|
|
22
|
-
|
|
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(
|
|
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
|
|
35
|
+
return this.version.modelList
|
|
36
|
+
.get()
|
|
37
|
+
.filter((model) => !childModels.includes(model.name));
|
|
34
38
|
}
|
|
35
|
-
createRecursiveTree(tree
|
|
39
|
+
createRecursiveTree(tree) {
|
|
36
40
|
for (const model of tree) {
|
|
37
|
-
this.setChildrens(model
|
|
41
|
+
this.setChildrens(model);
|
|
38
42
|
}
|
|
39
43
|
}
|
|
40
|
-
setChildrens(model
|
|
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
|
|
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
|
|
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: [] }));
|