diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json
index 1d79f5a..36dd046 100644
--- a/.devcontainer/devcontainer.json
+++ b/.devcontainer/devcontainer.json
@@ -28,7 +28,7 @@
// Add the IDs of extensions you want installed when the container is created.
"extensions": [
"firsttris.vscode-jest-runner"
- ]
+ ],
// Use 'forwardPorts' to make a list of ports inside the container available locally.
// "forwardPorts": [],
@@ -37,7 +37,7 @@
// "runServices": [],
// Uncomment the next line if you want to keep your containers running after VS Code shuts down.
- // "shutdownAction": "none",
+ "shutdownAction": "stopCompose",
// Uncomment the next line to run commands after the container is created - for example installing curl.
// "postCreateCommand": "apt-get update && apt-get install -y curl",
diff --git a/.gitignore b/.gitignore
index ff63c33..28e3e9c 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,4 +1,5 @@
node_modules/
.history/
.docker/zsh/history/.zsh_history
-tsconfig.tsbuildinfo
\ No newline at end of file
+tsconfig.tsbuildinfo
+src/__coverage
\ No newline at end of file
diff --git a/jest.config.ts b/jest.config.ts
index 9996888..768b04c 100644
--- a/jest.config.ts
+++ b/jest.config.ts
@@ -23,7 +23,7 @@ export default {
// collectCoverageFrom: undefined,
// The directory where Jest should output its coverage files
- coverageDirectory: "coverage",
+ coverageDirectory: "__coverage",
// An array of regexp pattern strings used to skip coverage collection
// coveragePathIgnorePatterns: [
@@ -34,12 +34,13 @@ export default {
coverageProvider: "v8",
// A list of reporter names that Jest uses when writing coverage reports
- // coverageReporters: [
- // "json",
+ coverageReporters: [
+ "json",
+ "html"
// "text",
// "lcov",
// "clover"
- // ],
+ ],
// An object that configures minimum threshold enforcement for coverage results
// coverageThreshold: undefined,
diff --git a/package-lock.json b/package-lock.json
index f17fc19..4e04f72 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -707,121 +707,121 @@
}
},
"@swc/core": {
- "version": "1.2.140",
- "resolved": "https://registry.npmjs.org/@swc/core/-/core-1.2.140.tgz",
- "integrity": "sha512-RKaWVry/+lVeKGD0eI2sxx5BBk/PTh2nQcLijhF8hThI9ipJtyo1JAJqE+mOynOXegb9puOEsj13ihngAVTBZQ==",
- "dev": true,
- "requires": {
- "@swc/core-android-arm-eabi": "1.2.140",
- "@swc/core-android-arm64": "1.2.140",
- "@swc/core-darwin-arm64": "1.2.140",
- "@swc/core-darwin-x64": "1.2.140",
- "@swc/core-freebsd-x64": "1.2.140",
- "@swc/core-linux-arm-gnueabihf": "1.2.140",
- "@swc/core-linux-arm64-gnu": "1.2.140",
- "@swc/core-linux-arm64-musl": "1.2.140",
- "@swc/core-linux-x64-gnu": "1.2.140",
- "@swc/core-linux-x64-musl": "1.2.140",
- "@swc/core-win32-arm64-msvc": "1.2.140",
- "@swc/core-win32-ia32-msvc": "1.2.140",
- "@swc/core-win32-x64-msvc": "1.2.140"
+ "version": "1.2.154",
+ "resolved": "https://registry.npmjs.org/@swc/core/-/core-1.2.154.tgz",
+ "integrity": "sha512-Wz61emNkLRnnbBriqV2DEn4oqfsanKeT5OrBw1ZpIXlZ1qx5h3ft5yuJm0jvSBj+oiTeX+BZcE4f2VEwE1xvqQ==",
+ "dev": true,
+ "requires": {
+ "@swc/core-android-arm-eabi": "1.2.154",
+ "@swc/core-android-arm64": "1.2.154",
+ "@swc/core-darwin-arm64": "1.2.154",
+ "@swc/core-darwin-x64": "1.2.154",
+ "@swc/core-freebsd-x64": "1.2.154",
+ "@swc/core-linux-arm-gnueabihf": "1.2.154",
+ "@swc/core-linux-arm64-gnu": "1.2.154",
+ "@swc/core-linux-arm64-musl": "1.2.154",
+ "@swc/core-linux-x64-gnu": "1.2.154",
+ "@swc/core-linux-x64-musl": "1.2.154",
+ "@swc/core-win32-arm64-msvc": "1.2.154",
+ "@swc/core-win32-ia32-msvc": "1.2.154",
+ "@swc/core-win32-x64-msvc": "1.2.154"
}
},
"@swc/core-android-arm-eabi": {
- "version": "1.2.140",
- "resolved": "https://registry.npmjs.org/@swc/core-android-arm-eabi/-/core-android-arm-eabi-1.2.140.tgz",
- "integrity": "sha512-wxJNMg6BS0jZhuNHdemcI2GJtJzzM+DbcNpjafpWhmITRK06UoSMeN6V0C1WLU/vgFHZQkxfhqwXhuabVAWwiQ==",
+ "version": "1.2.154",
+ "resolved": "https://registry.npmjs.org/@swc/core-android-arm-eabi/-/core-android-arm-eabi-1.2.154.tgz",
+ "integrity": "sha512-zwpOQ6EVHUQSK0AiwruRv/uwvLKBbj9wJ7n3Y6hipoeXYNGYzlDpuxsWzBgNtpLYozSKsL9ErByvNGWjR1uvRw==",
"dev": true,
"optional": true
},
"@swc/core-android-arm64": {
- "version": "1.2.140",
- "resolved": "https://registry.npmjs.org/@swc/core-android-arm64/-/core-android-arm64-1.2.140.tgz",
- "integrity": "sha512-jq7vKqisa0Hm02HwXnf0SaLiow1Ezjm2IQorsPcMVh82i461k6YDiay6qgcvgDhkqVPVL+FR7dF39jjmk0v5Bw==",
+ "version": "1.2.154",
+ "resolved": "https://registry.npmjs.org/@swc/core-android-arm64/-/core-android-arm64-1.2.154.tgz",
+ "integrity": "sha512-MYNCY1KXYfcHPfkDdokVZqm5NqmQrhURXf9/PjpkDgcNu/7IDBxvPsFoBTq6Czl/FyEF1QyilfgoTpP/liyYNA==",
"dev": true,
"optional": true
},
"@swc/core-darwin-arm64": {
- "version": "1.2.140",
- "resolved": "https://registry.npmjs.org/@swc/core-darwin-arm64/-/core-darwin-arm64-1.2.140.tgz",
- "integrity": "sha512-TWlyLablaopI3Cf6Zooknw0kd0Sla2r7ZCqfC/lK/8a8zwN8335gJcSXtyVeWnF3nx5F+rZZY9EPdJqJ3jL0Cw==",
+ "version": "1.2.154",
+ "resolved": "https://registry.npmjs.org/@swc/core-darwin-arm64/-/core-darwin-arm64-1.2.154.tgz",
+ "integrity": "sha512-30Zpyp/RdR9ywJcneDYoESRdoJVI/mVMzTvWzPDHUpkABgPTXA4h53kL1e6oIYEp4uOkcKFFD4iAzbz1tj/vhw==",
"dev": true,
"optional": true
},
"@swc/core-darwin-x64": {
- "version": "1.2.140",
- "resolved": "https://registry.npmjs.org/@swc/core-darwin-x64/-/core-darwin-x64-1.2.140.tgz",
- "integrity": "sha512-d44A0PW+ZP8wRh/iFhu0UzUwRkcswGkUXJy1187Q3jLm6uxdW2rH4DoFQHRuABXh4tDjd3cXRClz/xSURNIJDA==",
+ "version": "1.2.154",
+ "resolved": "https://registry.npmjs.org/@swc/core-darwin-x64/-/core-darwin-x64-1.2.154.tgz",
+ "integrity": "sha512-t3oRoDd3q2jlRdpCO1gG3GB6nbl0Z+jHFsIcKzdeBVhnG3R6pqOflA6GYrNEaIyskPf0WT5POcpBv38I7liyPQ==",
"dev": true,
"optional": true
},
"@swc/core-freebsd-x64": {
- "version": "1.2.140",
- "resolved": "https://registry.npmjs.org/@swc/core-freebsd-x64/-/core-freebsd-x64-1.2.140.tgz",
- "integrity": "sha512-L4luX3JDrNDouYcjvDUsdE2CLk/EMpEHHveUSM+dHvyVeJ/eVPZFTyeiBpc1E/rymHWa2C2nIYAe/v8yZqcjDA==",
+ "version": "1.2.154",
+ "resolved": "https://registry.npmjs.org/@swc/core-freebsd-x64/-/core-freebsd-x64-1.2.154.tgz",
+ "integrity": "sha512-YSQF9AekPRbQTPNNlaWmJqds1QfbS9qDDL9zyUcC2XVk5bAKQQMmVYSRTJm4aV6no2Vy+C5yQeuR2vDwVUUXvw==",
"dev": true,
"optional": true
},
"@swc/core-linux-arm-gnueabihf": {
- "version": "1.2.140",
- "resolved": "https://registry.npmjs.org/@swc/core-linux-arm-gnueabihf/-/core-linux-arm-gnueabihf-1.2.140.tgz",
- "integrity": "sha512-rNjGhWvBazig/5/gqdMziPXsSse3/sv5zTy8GfKP8F9ZhToxJ+Hg5Vr+DqrrzVgVE5zhzbiWxoiScr6W+wER6g==",
+ "version": "1.2.154",
+ "resolved": "https://registry.npmjs.org/@swc/core-linux-arm-gnueabihf/-/core-linux-arm-gnueabihf-1.2.154.tgz",
+ "integrity": "sha512-xAg+eP7wsQ2I8jOPDmvbqe6N1UvjUWD1/1jq1zF3kCwH7352kZWljFdJ0WcojUN0pX5lyIl4QWN1xarhtprFhg==",
"dev": true,
"optional": true
},
"@swc/core-linux-arm64-gnu": {
- "version": "1.2.140",
- "resolved": "https://registry.npmjs.org/@swc/core-linux-arm64-gnu/-/core-linux-arm64-gnu-1.2.140.tgz",
- "integrity": "sha512-ws7uMHVbwXkXr8CRwmYgQca5mB36iJ/Y4LNXvfpaPsmQsCDVBvXmg4pEk4g/0e53By02GcErn31kPisJsiHt5w==",
+ "version": "1.2.154",
+ "resolved": "https://registry.npmjs.org/@swc/core-linux-arm64-gnu/-/core-linux-arm64-gnu-1.2.154.tgz",
+ "integrity": "sha512-lxrZyD6sONGZsL/wgB4q65/U4lwdWHJv81NSp+ScjvNSKeSJz/a+fxMB7FVf/iEpCtZobLgFUZO+sRVtO2jH3g==",
"dev": true,
"optional": true
},
"@swc/core-linux-arm64-musl": {
- "version": "1.2.140",
- "resolved": "https://registry.npmjs.org/@swc/core-linux-arm64-musl/-/core-linux-arm64-musl-1.2.140.tgz",
- "integrity": "sha512-YwueGxb9IXfDh5B/3ezI3F8deoyhiNNuItnUjoUG2+xuNyjGBr8EOoddfbnZD1HxqRyyZXIhed4Lohsz5LQi+g==",
+ "version": "1.2.154",
+ "resolved": "https://registry.npmjs.org/@swc/core-linux-arm64-musl/-/core-linux-arm64-musl-1.2.154.tgz",
+ "integrity": "sha512-dnPzLhCHyTLAKmJYHq7W6WJ1Pp+0vnM4mX091EjN5Pw+JTSF1ItNAWya8n87PV3LaDz5sF0JqGwHEqAzgfokHg==",
"dev": true,
"optional": true
},
"@swc/core-linux-x64-gnu": {
- "version": "1.2.140",
- "resolved": "https://registry.npmjs.org/@swc/core-linux-x64-gnu/-/core-linux-x64-gnu-1.2.140.tgz",
- "integrity": "sha512-z3O9uDHQA/fhiJeYp7jvoeiHiFsS5Y0t1SBU2eqQnCSlJK7V+V0Fn6WmcmVlnowI3ffI+k1lyncoQNGhlrUZZQ==",
+ "version": "1.2.154",
+ "resolved": "https://registry.npmjs.org/@swc/core-linux-x64-gnu/-/core-linux-x64-gnu-1.2.154.tgz",
+ "integrity": "sha512-kdDxQxbt5ANoYXJE804GBJmh/ppiKWI996Ax2vuiUPUil9PtzIe5uxEAh/OwM9Tq+7YSfNcHUF2ZG/a6N7CvmA==",
"dev": true,
"optional": true
},
"@swc/core-linux-x64-musl": {
- "version": "1.2.140",
- "resolved": "https://registry.npmjs.org/@swc/core-linux-x64-musl/-/core-linux-x64-musl-1.2.140.tgz",
- "integrity": "sha512-PYlKrlzTkYVpFg2LnLI+Lk4I8X+/xWZvUZCAPo+GjbMpRDmp2/K9GWFNQxMBAHft+Z97jqzbL/GA37Op954XbQ==",
+ "version": "1.2.154",
+ "resolved": "https://registry.npmjs.org/@swc/core-linux-x64-musl/-/core-linux-x64-musl-1.2.154.tgz",
+ "integrity": "sha512-g8GJCj2W4jla9R9EvbFnrEiykLK1utZLTQxi8TEx3Vjjv3iTDkA3VEq+JUHDZUzj8wsRcmxB2x23RxXXJ9PbtA==",
"dev": true,
"optional": true
},
"@swc/core-win32-arm64-msvc": {
- "version": "1.2.140",
- "resolved": "https://registry.npmjs.org/@swc/core-win32-arm64-msvc/-/core-win32-arm64-msvc-1.2.140.tgz",
- "integrity": "sha512-OJrpVLHzrA+U0vLXEoQ4xWGuZr3oTwmR/J+g8+899wCMA6NAekWoO9k+mLku6RkOHD8Q6cHmVA7nEJFdkvi2ng==",
+ "version": "1.2.154",
+ "resolved": "https://registry.npmjs.org/@swc/core-win32-arm64-msvc/-/core-win32-arm64-msvc-1.2.154.tgz",
+ "integrity": "sha512-zRa0L56etjgK6YjIY3bh9XlT+Zf8tWgdGGkXqimm9RMMgGBrJ0e+Wg8j5LCM0a9YMONPNwqM1P9UK2i32AFM+Q==",
"dev": true,
"optional": true
},
"@swc/core-win32-ia32-msvc": {
- "version": "1.2.140",
- "resolved": "https://registry.npmjs.org/@swc/core-win32-ia32-msvc/-/core-win32-ia32-msvc-1.2.140.tgz",
- "integrity": "sha512-tH7nQPI0QopAgl+/lQIu8bIohmiof0zHOWd17TYV2C4gPka4VQH4CvF8NJLEdLnRhn+r0tHlrREWnuPakzN+Lw==",
+ "version": "1.2.154",
+ "resolved": "https://registry.npmjs.org/@swc/core-win32-ia32-msvc/-/core-win32-ia32-msvc-1.2.154.tgz",
+ "integrity": "sha512-Vojk27M5Dnpxw2Oh2D2mnTc8Jl2ZWpjOASYSwOZ+pM3qx1LWhVrTjR3NxZIMMlQ7uygE2GxjwolCVaknMDHXJw==",
"dev": true,
"optional": true
},
"@swc/core-win32-x64-msvc": {
- "version": "1.2.140",
- "resolved": "https://registry.npmjs.org/@swc/core-win32-x64-msvc/-/core-win32-x64-msvc-1.2.140.tgz",
- "integrity": "sha512-OtRarHcQ30WrkmIUXB96K1h1bsY830POJ0kb02VxTn/U9366BWs42fIoURa+637jPCZLfAceln10jxjfII1Iyg==",
+ "version": "1.2.154",
+ "resolved": "https://registry.npmjs.org/@swc/core-win32-x64-msvc/-/core-win32-x64-msvc-1.2.154.tgz",
+ "integrity": "sha512-8+x7yoLsw42VE/9b92yCigpmodMlKaMbUvmVtXFcmx/KpzdUpgN+5e4XfljkmYTBZTSYbwqGM8K2jceGsfZmLg==",
"dev": true,
"optional": true
},
"@swc/jest": {
- "version": "0.2.17",
- "resolved": "https://registry.npmjs.org/@swc/jest/-/jest-0.2.17.tgz",
- "integrity": "sha512-n/g989+O8xxMcTZnP0phDrrgezGZBQBf7cX4QuzEsn07QkWbqmMsfaCxdF0kzajXublXWJ8yk5vRe3VNk1tczA==",
+ "version": "0.2.20",
+ "resolved": "https://registry.npmjs.org/@swc/jest/-/jest-0.2.20.tgz",
+ "integrity": "sha512-5qSUBYY1wyIMn7p0Vl9qqV4hMI69oJwZCIPUpBsTFWN2wlwn6RDugzdgCn+bLXVYh+Cxi8bJcZ1uumDgsoL+FA==",
"dev": true,
"requires": {
"@jest/create-cache-key-function": "^27.4.2"
diff --git a/package.json b/package.json
index 7e439aa..2e1310b 100644
--- a/package.json
+++ b/package.json
@@ -11,8 +11,8 @@
"license": "ISC",
"devDependencies": {
"@sucrase/jest-plugin": "^2.2.0",
- "@swc/core": "^1.2.140",
- "@swc/jest": "^0.2.17",
+ "@swc/core": "^1.2.154",
+ "@swc/jest": "^0.2.20",
"@types/jest": "^27.4.0",
"@types/node": "^17.0.18",
"@types/uuid": "^8.3.4",
diff --git a/src/@core/@seedwork/@types/jest.d.ts b/src/@core/@seedwork/@types/jest.d.ts
index fcf63e0..66dcb24 100644
--- a/src/@core/@seedwork/@types/jest.d.ts
+++ b/src/@core/@seedwork/@types/jest.d.ts
@@ -1,8 +1,10 @@
///
+type Expected = { validator: ClassValidatorFields; data: any } | Entity;
+
declare namespace jest {
// noinspection JSUnusedGlobalSymbols
interface Matchers {
- containErrorMessages: (expected: { [field: string]: string[] }) => R;
+ containErrorMessages: (expected: Expected) => R;
}
}
diff --git a/src/@core/@seedwork/application/errors/bad-entity-operation.error.ts b/src/@core/@seedwork/application/errors/bad-entity-operation.error.ts
new file mode 100644
index 0000000..6c75733
--- /dev/null
+++ b/src/@core/@seedwork/application/errors/bad-entity-operation.error.ts
@@ -0,0 +1,8 @@
+import ErrorBag from "../../domain/errors/error-bag";
+
+export default class BadEntityOperationError extends Error {
+ constructor(public error: ErrorBag, message?: string) {
+ super(message ?? "An entity operation was executed with error");
+ this.name = "BadEntityOperationError";
+ }
+}
diff --git a/src/@core/@seedwork/application/use-case.ts b/src/@core/@seedwork/application/use-case.ts
new file mode 100644
index 0000000..0d86731
--- /dev/null
+++ b/src/@core/@seedwork/application/use-case.ts
@@ -0,0 +1,3 @@
+export default interface UseCase{
+ execute(input: Input): Output | Promise