@atlantjs/arch 2.6.3 → 3.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.
- package/@tool-box/tests/builders/errors/dummies/failure.dummy.d.ts +3 -0
- package/{tests → @tool-box/tests}/builders/errors/dummies/failure.dummy.js +1 -1
- package/@tool-box/tests/builders/generic/dummies/uuid.dummy.d.ts +3 -0
- package/{tests → @tool-box/tests}/builders/generic/dummies/uuid.dummy.js +1 -1
- package/{tests → @tool-box/tests}/create-fake-usecase.d.ts +1 -1
- package/@tool-box/tests/faker/faker.d.ts +0 -0
- package/@tool-box/tests/faker/faker.js +1 -0
- package/@tool-box/utils/datatypes/boolean-utils.d.ts +8 -0
- package/@tool-box/utils/datatypes/boolean-utils.js +19 -0
- package/{utils → @tool-box/utils}/ducts/common.d.ts +2 -2
- package/{utils → @tool-box/utils}/ducts/common.js +3 -3
- package/{utils → @tool-box/utils}/ducts/optional-type.d.ts +5 -5
- package/{utils → @tool-box/utils}/ducts/optional-type.js +11 -11
- package/{utils → @tool-box/utils}/ducts/return-type.d.ts +3 -3
- package/{utils → @tool-box/utils}/ducts/return-type.js +14 -14
- package/{utils → @tool-box/utils}/http-client/http-client-response.d.ts +3 -3
- package/{utils → @tool-box/utils}/http-client/http-client-response.get-header.failure.d.ts +1 -1
- package/{utils → @tool-box/utils}/http-client/http-client-response.get-header.failure.js +1 -1
- package/{utils → @tool-box/utils}/http-client/http-client-response.js +2 -2
- package/@tool-box/utils/randoms/random-value.d.ts +5 -0
- package/@tool-box/utils/randoms/random-value.js +25 -0
- package/arch/modules/application/databases/database.factory.abstract.d.ts +3 -0
- package/arch/modules/application/databases/database.helper.abstract.d.ts +4 -0
- package/arch/modules/application/databases/database.helper.abstract.js +6 -0
- package/{objects/arch/application/errors → arch/modules/application/failures}/failure.abstract.d.ts +1 -1
- package/{objects/arch/application/errors → arch/modules/application/failures}/failure.abstract.js +3 -3
- package/arch/modules/application/failures/unknown-failure.d.ts +15 -0
- package/{objects/arch/application/errors/unknown-application-error.js → arch/modules/application/failures/unknown-failure.js} +3 -3
- package/arch/modules/application/injections.abstract.d.ts +11 -0
- package/arch/modules/application/injections.abstract.js +45 -0
- package/arch/modules/application/injections.abstract.type.d.ts +17 -0
- package/arch/modules/domain/entities/$array.abstract.d.ts +2 -0
- package/arch/modules/domain/entities/$array.abstract.js +6 -0
- package/arch/modules/domain/entities/$date.abstract.d.ts +2 -0
- package/{tests/faker/faker.js → arch/modules/domain/entities/$date.abstract.js} +3 -3
- package/{objects/datatypes → arch/modules/domain}/entities/$number.abstract.js +1 -1
- package/arch/modules/domain/entities/$object.abstract.d.ts +2 -0
- package/arch/modules/domain/entities/$object.abstract.js +6 -0
- package/arch/modules/domain/entities/solid.abstract.d.ts +4 -0
- package/arch/modules/domain/entities/solid.abstract.js +2 -0
- package/{objects/arch/infrastructure → arch/modules/domain/enums}/http-status-codes.enum.d.ts +0 -116
- package/{objects/arch/infrastructure → arch/modules/domain/enums}/http-status-codes.enum.js +0 -116
- package/{objects/arch/domain/middleware-handler.absctract.d.ts → arch/modules/domain/middlewares/middleware.handler.absctract.d.ts} +1 -1
- package/arch/modules/domain/providers/provider.abstract.d.ts +2 -0
- package/arch/modules/domain/providers/provider.abstract.js +6 -0
- package/arch/modules/domain/solid.abstract.d.ts +4 -0
- package/arch/modules/domain/solid.abstract.js +2 -0
- package/{objects/arch/domain → arch/modules/domain/usecases}/usecase.abstract.d.ts +1 -1
- package/{objects/arch/infrastructure → arch/modules/infrastructure/controllers}/controller.abstract.d.ts +3 -3
- package/{objects/arch/infrastructure → arch/modules/infrastructure/controllers}/controller.abstract.js +2 -2
- package/arch/modules/infrastructure/controllers/payloads/payload.abstract.d.ts +2 -0
- package/arch/modules/infrastructure/controllers/payloads/payload.abstract.js +6 -0
- package/arch/modules/infrastructure/controllers/payloads/validators/validator.abstract.d.ts +2 -0
- package/arch/modules/infrastructure/controllers/payloads/validators/validator.abstract.js +6 -0
- package/arch/modules/infrastructure/controllers/responses/response.abstract.d.ts +4 -0
- package/{objects/arch/infrastructure → arch/modules/infrastructure/repositories/entities}/entity.abstract.d.ts +1 -1
- package/index.d.ts +30 -32
- package/index.js +56 -57
- package/package.json +8 -1
- package/setup/dependency-injections/container.d.ts +11 -0
- package/setup/dependency-injections/container.js +14 -0
- package/setup/dependency-injections/default-container.d.ts +4 -0
- package/setup/dependency-injections/default-container.js +20 -0
- package/setup/dependency-injections/di-container.abstract.d.ts +30 -0
- package/setup/dependency-injections/di-container.abstract.js +45 -0
- package/setup/dependency-injections/di-container.d.ts +3 -0
- package/setup/dependency-injections/di-container.js +6 -0
- package/setup/dependency-injections/index.d.ts +3 -0
- package/setup/dependency-injections/index.js +15 -0
- package/setup/env/env-vars.d.ts +7 -0
- package/setup/env/env-vars.js +28 -0
- package/setup/env/load-envs.d.ts +1 -0
- package/setup/env/load-envs.js +30 -0
- package/setup/index.d.ts +5 -0
- package/setup/index.js +37 -0
- package/setup/server/body-parser-middleware.d.ts +9 -0
- package/setup/server/body-parser-middleware.js +31 -0
- package/setup/server/cors-middleware.d.ts +10 -0
- package/setup/server/cors-middleware.js +38 -0
- package/setup/server/default-error-handler-middleware.d.ts +8 -0
- package/setup/server/default-error-handler-middleware.js +45 -0
- package/setup/server/server.d.ts +6 -0
- package/setup/server/server.js +61 -0
- package/tsconfig.tsbuildinfo +1 -1
- package/configs/env/env-vars.d.ts +0 -3
- package/configs/env/env-vars.js +0 -20
- package/external-files/biome.json +0 -47
- package/external-files/typescript/tsconfig-backend.json +0 -3
- package/external-files/typescript/tsconfig-default.json +0 -45
- package/external-files/typescript/tsconfig-frontend.json +0 -3
- package/external-files/typescript/tsconfig-lib.json +0 -6
- package/external-files/typescript/tsconfig-mobile.json +0 -3
- package/objects/arch/application/errors/unknown-application-error.d.ts +0 -15
- package/objects/arch/application/injections.abstract.d.ts +0 -4
- package/objects/arch/application/injections.abstract.js +0 -6
- package/objects/arch/application/injections.abstract.type.d.ts +0 -22
- package/objects/arch/domain/solid.abstract.d.ts +0 -4
- package/objects/arch/infrastructure/response.abstract.d.ts +0 -4
- package/tests/builders/errors/dummies/failure.dummy.d.ts +0 -3
- package/tests/builders/generic/dummies/uuid.dummy.d.ts +0 -3
- package/tests/faker/faker.d.ts +0 -2
- package/utils/randoms/random-enum-value.d.ts +0 -2
- package/utils/randoms/random-enum-value.js +0 -20
- package/utils/randoms/random-number.d.ts +0 -6
- package/utils/randoms/random-number.js +0 -6
- package/{tests → @tool-box/tests}/builders/errors/failure.builder.d.ts +0 -0
- package/{tests → @tool-box/tests}/builders/errors/failure.builder.js +1 -1
- /package/{tests → @tool-box/tests}/builders/generic/uuid.builder.d.ts +0 -0
- /package/{tests → @tool-box/tests}/builders/generic/uuid.builder.js +0 -0
- /package/{tests → @tool-box/tests}/create-fake-usecase.js +0 -0
- /package/{tests → @tool-box/tests}/entity-builder.util.d.ts +0 -0
- /package/{tests → @tool-box/tests}/entity-builder.util.js +0 -0
- /package/{utils → @tool-box/utils}/arrays/extended-map.d.ts +0 -0
- /package/{utils → @tool-box/utils}/arrays/extended-map.js +0 -0
- /package/{utils → @tool-box/utils}/datatypes/generic-types.d.ts +0 -0
- /package/{utils → @tool-box/utils}/datatypes/generic-types.js +0 -0
- /package/{utils → @tool-box/utils}/datatypes/string-utils.d.ts +0 -0
- /package/{utils → @tool-box/utils}/datatypes/string-utils.js +0 -0
- /package/{utils → @tool-box/utils}/http-client/http-client-exception.d.ts +0 -0
- /package/{utils → @tool-box/utils}/http-client/http-client-exception.js +0 -0
- /package/{utils → @tool-box/utils}/http-client/http-client-request.d.ts +0 -0
- /package/{utils → @tool-box/utils}/http-client/http-client-request.js +0 -0
- /package/{utils → @tool-box/utils}/http-client/http-client.d.ts +0 -0
- /package/{utils → @tool-box/utils}/http-client/http-client.js +0 -0
- /package/{utils → @tool-box/utils}/type-guard/guardian-exception.d.ts +0 -0
- /package/{utils → @tool-box/utils}/type-guard/guardian-exception.js +0 -0
- /package/{utils → @tool-box/utils}/type-guard/guardian.d.ts +0 -0
- /package/{utils → @tool-box/utils}/type-guard/guardian.js +0 -0
- /package/{utils → @tool-box/utils}/type-guard/guardian.type.d.ts +0 -0
- /package/{utils → @tool-box/utils}/type-guard/guardian.type.js +0 -0
- /package/{objects/arch/application/errors/failure.abstract.type.js → arch/modules/application/databases/database.factory.abstract.js} +0 -0
- /package/{objects/arch/application/errors → arch/modules/application/failures}/failure.abstract.type.d.ts +0 -0
- /package/{objects/arch/application/injections.abstract.type.js → arch/modules/application/failures/failure.abstract.type.js} +0 -0
- /package/{objects/arch/domain/solid.abstract.js → arch/modules/application/injections.abstract.type.js} +0 -0
- /package/{objects/datatypes → arch/modules/domain}/entities/$boolean.abstract.d.ts +0 -0
- /package/{objects/datatypes → arch/modules/domain}/entities/$boolean.abstract.js +0 -0
- /package/{objects/datatypes → arch/modules/domain}/entities/$number.abstract.d.ts +0 -0
- /package/{objects/datatypes → arch/modules/domain}/entities/$string.abstract.d.ts +0 -0
- /package/{objects/datatypes → arch/modules/domain}/entities/$string.abstract.js +0 -0
- /package/{objects/datatypes → arch/modules/domain}/entities/uuid.abstract.d.ts +0 -0
- /package/{objects/datatypes → arch/modules/domain}/entities/uuid.abstract.js +0 -0
- /package/{objects/configs → arch/modules/domain}/enums/node-envs.enum.d.ts +0 -0
- /package/{objects/configs → arch/modules/domain}/enums/node-envs.enum.js +0 -0
- /package/{objects/arch/domain/middleware-handler.absctract.js → arch/modules/domain/middlewares/middleware.handler.absctract.js} +0 -0
- /package/{objects/arch/domain → arch/modules/domain/repositories}/repository.abstract.d.ts +0 -0
- /package/{objects/arch/domain → arch/modules/domain/repositories}/repository.abstract.js +0 -0
- /package/{objects/arch/domain → arch/modules/domain/services}/service.abstract.d.ts +0 -0
- /package/{objects/arch/domain → arch/modules/domain/services}/service.abstract.js +0 -0
- /package/{objects/arch/domain → arch/modules/domain/usecases}/usecase.abstract.js +0 -0
- /package/{objects/arch/infrastructure → arch/modules/infrastructure/controllers/responses}/response.abstract.js +0 -0
- /package/{objects/arch/infrastructure → arch/modules/infrastructure/repositories/entities}/entity.abstract.js +0 -0
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.ApplicationFailureDummy = void 0;
|
|
4
|
-
const failure_abstract_1 = require("
|
|
4
|
+
const failure_abstract_1 = require("../../../../../arch/modules/application/failures/failure.abstract");
|
|
5
5
|
class ApplicationFailureDummy extends failure_abstract_1.FailureAbstract {
|
|
6
6
|
}
|
|
7
7
|
exports.ApplicationFailureDummy = ApplicationFailureDummy;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.UuidDummy = void 0;
|
|
4
|
-
const uuid_abstract_1 = require("
|
|
4
|
+
const uuid_abstract_1 = require("../../../../../arch/modules/domain/entities/uuid.abstract");
|
|
5
5
|
class UuidDummy extends uuid_abstract_1.UuidAbstract {
|
|
6
6
|
}
|
|
7
7
|
exports.UuidDummy = UuidDummy;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { FailureAbstract } from "../objects/arch/application/errors/failure.abstract";
|
|
2
1
|
import { Return } from "../utils/ducts/return-type";
|
|
2
|
+
import { FailureAbstract } from "../../arch/modules/application/failures/failure.abstract";
|
|
3
3
|
export declare class CreateFakeUsecase {
|
|
4
4
|
private _response;
|
|
5
5
|
static new<UsecaseStub>(): UsecaseStub & CreateFakeUsecase;
|
|
File without changes
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Boolean.prototype.truthy = function () {
|
|
3
|
+
return this === true;
|
|
4
|
+
};
|
|
5
|
+
Boolean.prototype.falsy = function () {
|
|
6
|
+
return this === false || this === undefined;
|
|
7
|
+
};
|
|
8
|
+
Boolean.prototype.not = function () {
|
|
9
|
+
return !this.valueOf();
|
|
10
|
+
};
|
|
11
|
+
Boolean.prototype.and = function (value) {
|
|
12
|
+
return this.valueOf() && value;
|
|
13
|
+
};
|
|
14
|
+
Boolean.prototype.or = function (value) {
|
|
15
|
+
return this.valueOf() || value;
|
|
16
|
+
};
|
|
17
|
+
Boolean.prototype.equal = function (value) {
|
|
18
|
+
return this === value;
|
|
19
|
+
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
export declare const
|
|
2
|
-
export declare const
|
|
1
|
+
export declare const SuccessReturn: unique symbol;
|
|
2
|
+
export declare const ValueReturn: unique symbol;
|
|
3
3
|
export declare const FnVal: unique symbol;
|
|
4
4
|
export declare const EmptyArray: readonly any[];
|
|
5
5
|
export type FalseyValues = false | null | undefined | 0 | 0n | "";
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.EmptyArray = exports.FnVal = exports.
|
|
3
|
+
exports.EmptyArray = exports.FnVal = exports.ValueReturn = exports.SuccessReturn = void 0;
|
|
4
4
|
exports.isTruthy = isTruthy;
|
|
5
5
|
const guardian_1 = require("../type-guard/guardian");
|
|
6
|
-
exports.
|
|
7
|
-
exports.
|
|
6
|
+
exports.SuccessReturn = Symbol("SuccessReturn");
|
|
7
|
+
exports.ValueReturn = Symbol("ValueReturn");
|
|
8
8
|
exports.FnVal = Symbol("FnVal");
|
|
9
9
|
exports.EmptyArray = Object.freeze([]);
|
|
10
10
|
function isTruthy(val) {
|
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
import { FalseyValues, IterType,
|
|
1
|
+
import { FalseyValues, IterType, SuccessReturn, ValueReturn } from "./common";
|
|
2
2
|
export type Something<T> = OptionalType<T> & {
|
|
3
|
-
[
|
|
3
|
+
[SuccessReturn]: true;
|
|
4
4
|
};
|
|
5
5
|
export type Nothing = OptionalType<never> & {
|
|
6
|
-
[
|
|
6
|
+
[SuccessReturn]: false;
|
|
7
7
|
};
|
|
8
8
|
export type Optional<T> = OptionalType<T>;
|
|
9
9
|
type From<T> = Exclude<T, Error | FalseyValues>;
|
|
10
10
|
declare class OptionalType<T> {
|
|
11
|
-
readonly [
|
|
12
|
-
readonly [
|
|
11
|
+
readonly [SuccessReturn]: boolean;
|
|
12
|
+
readonly [ValueReturn]: T;
|
|
13
13
|
constructor(val: T, something: boolean);
|
|
14
14
|
[Symbol.iterator](this: Optional<T>): IterType<T>;
|
|
15
15
|
hasSomething(this: Optional<T>): this is Something<T>;
|
|
@@ -6,34 +6,34 @@ exports.Something = Something;
|
|
|
6
6
|
const common_1 = require("./common");
|
|
7
7
|
class OptionalType {
|
|
8
8
|
constructor(val, something) {
|
|
9
|
-
this[common_1.
|
|
10
|
-
this[common_1.
|
|
9
|
+
this[common_1.SuccessReturn] = something;
|
|
10
|
+
this[common_1.ValueReturn] = val;
|
|
11
11
|
}
|
|
12
12
|
[Symbol.iterator]() {
|
|
13
|
-
return this[common_1.
|
|
14
|
-
? this[common_1.
|
|
13
|
+
return this[common_1.SuccessReturn]
|
|
14
|
+
? this[common_1.ValueReturn][Symbol.iterator]()
|
|
15
15
|
: common_1.EmptyArray[Symbol.iterator]();
|
|
16
16
|
}
|
|
17
17
|
hasSomething() {
|
|
18
|
-
return this[common_1.
|
|
18
|
+
return this[common_1.SuccessReturn];
|
|
19
19
|
}
|
|
20
20
|
hasNothing() {
|
|
21
|
-
return !this[common_1.
|
|
21
|
+
return !this[common_1.SuccessReturn];
|
|
22
22
|
}
|
|
23
23
|
unpack() {
|
|
24
|
-
if (this[common_1.
|
|
25
|
-
return this[common_1.
|
|
24
|
+
if (this[common_1.SuccessReturn]) {
|
|
25
|
+
return this[common_1.ValueReturn];
|
|
26
26
|
}
|
|
27
27
|
throw new Error("Failed to unpack optional value. There is nothing in here");
|
|
28
28
|
}
|
|
29
29
|
unpackAnyway() {
|
|
30
|
-
return this[common_1.
|
|
30
|
+
return this[common_1.ValueReturn];
|
|
31
31
|
}
|
|
32
32
|
unpackOr(def) {
|
|
33
|
-
return this[common_1.
|
|
33
|
+
return this[common_1.SuccessReturn] ? this[common_1.ValueReturn] : def;
|
|
34
34
|
}
|
|
35
35
|
unpackOrElse(f) {
|
|
36
|
-
return this[common_1.
|
|
36
|
+
return this[common_1.SuccessReturn] ? this[common_1.ValueReturn] : f();
|
|
37
37
|
}
|
|
38
38
|
}
|
|
39
39
|
function Optional(val) {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { FailureAbstract } from "
|
|
2
|
-
import { FalseyValues, IterType,
|
|
1
|
+
import { FailureAbstract } from "../../../arch/modules/application/failures/failure.abstract";
|
|
2
|
+
import { FalseyValues, IterType, SuccessReturn, ValueReturn } from "./common";
|
|
3
3
|
export type Success<SuccessReturn> = ReturnType<SuccessReturn, never>;
|
|
4
4
|
export type Failure<FailureReturn> = ReturnType<never, FailureReturn>;
|
|
5
5
|
export type Return<T, E> = ReturnType<T, E>;
|
|
@@ -16,7 +16,7 @@ export declare class ReturnType<SuccessReturn, FailureReturn> {
|
|
|
16
16
|
unwrapOr(this: Return<SuccessReturn, FailureReturn>, def: SuccessReturn): SuccessReturn;
|
|
17
17
|
unwrapAnyway(this: Return<SuccessReturn, FailureReturn>): SuccessReturn | FailureReturn | undefined;
|
|
18
18
|
}
|
|
19
|
-
export declare function
|
|
19
|
+
export declare function Return<T>(val: T): Return<From<T>, (T extends Error ? T : never) | (Extract<FalseyValues, T> extends never ? never : null)>;
|
|
20
20
|
export declare function Success<SuccessReturn>(successValue?: SuccessReturn): Success<SuccessReturn>;
|
|
21
21
|
export declare function Failure<FailureReturn extends FailureAbstract | null | undefined>(failureValue?: FailureReturn): Failure<FailureReturn>;
|
|
22
22
|
export {};
|
|
@@ -1,47 +1,47 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.ReturnType = void 0;
|
|
4
|
-
exports.
|
|
4
|
+
exports.Return = Return;
|
|
5
5
|
exports.Success = Success;
|
|
6
6
|
exports.Failure = Failure;
|
|
7
7
|
const common_1 = require("./common");
|
|
8
8
|
class ReturnType {
|
|
9
9
|
constructor(value, hasSuccess) {
|
|
10
|
-
this[common_1.
|
|
11
|
-
this[common_1.
|
|
10
|
+
this[common_1.ValueReturn] = value;
|
|
11
|
+
this[common_1.SuccessReturn] = hasSuccess;
|
|
12
12
|
}
|
|
13
13
|
[Symbol.iterator]() {
|
|
14
|
-
return this[common_1.
|
|
15
|
-
? this[common_1.
|
|
14
|
+
return this[common_1.SuccessReturn]
|
|
15
|
+
? this[common_1.ValueReturn][Symbol.iterator]()
|
|
16
16
|
: common_1.EmptyArray[Symbol.iterator]();
|
|
17
17
|
}
|
|
18
18
|
hasSuccess() {
|
|
19
|
-
return this[common_1.
|
|
19
|
+
return this[common_1.SuccessReturn];
|
|
20
20
|
}
|
|
21
21
|
hasFailure() {
|
|
22
|
-
return !this[common_1.
|
|
22
|
+
return !this[common_1.SuccessReturn];
|
|
23
23
|
}
|
|
24
24
|
unwrap() {
|
|
25
|
-
if (this[common_1.
|
|
26
|
-
return this[common_1.
|
|
25
|
+
if (this[common_1.SuccessReturn]) {
|
|
26
|
+
return this[common_1.ValueReturn];
|
|
27
27
|
}
|
|
28
28
|
throw new Error("Failed to unwrap Return. There is failure in here");
|
|
29
29
|
}
|
|
30
30
|
unwrapFail() {
|
|
31
|
-
if (this[common_1.
|
|
31
|
+
if (this[common_1.SuccessReturn]) {
|
|
32
32
|
throw new Error("Failed to unwrapFail Return. There is success in here");
|
|
33
33
|
}
|
|
34
|
-
return this[common_1.
|
|
34
|
+
return this[common_1.ValueReturn];
|
|
35
35
|
}
|
|
36
36
|
unwrapOr(def) {
|
|
37
|
-
return this[common_1.
|
|
37
|
+
return this[common_1.SuccessReturn] ? this[common_1.ValueReturn] : def;
|
|
38
38
|
}
|
|
39
39
|
unwrapAnyway() {
|
|
40
|
-
return this[common_1.
|
|
40
|
+
return this[common_1.ValueReturn];
|
|
41
41
|
}
|
|
42
42
|
}
|
|
43
43
|
exports.ReturnType = ReturnType;
|
|
44
|
-
function
|
|
44
|
+
function Return(val) {
|
|
45
45
|
return from(val);
|
|
46
46
|
}
|
|
47
47
|
function Success(successValue) {
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { AxiosResponseHeaders, RawAxiosResponseHeaders } from "axios";
|
|
2
|
-
import {
|
|
3
|
-
import { Newable, ObjectType } from "../datatypes/generic-types";
|
|
2
|
+
import { ObjectType, Newable } from "../datatypes/generic-types";
|
|
4
3
|
import { Optional } from "../ducts/optional-type";
|
|
5
|
-
import { Return } from "
|
|
4
|
+
import { Return } from "../ducts/return-type";
|
|
5
|
+
import { FailureAbstract } from "../../../arch/modules/application/failures/failure.abstract";
|
|
6
6
|
type Header = RawAxiosResponseHeaders | AxiosResponseHeaders;
|
|
7
7
|
export declare class HttpClientResponse {
|
|
8
8
|
readonly statusCode: number;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { FailureAbstract } from "
|
|
1
|
+
import { FailureAbstract } from "../../../arch/modules/application/failures/failure.abstract";
|
|
2
2
|
export declare class HttpClientResponseGetHeaderFailure extends FailureAbstract {
|
|
3
3
|
constructor(keyName: string, error?: any);
|
|
4
4
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.HttpClientResponseGetHeaderFailure = void 0;
|
|
4
|
-
const failure_abstract_1 = require("
|
|
4
|
+
const failure_abstract_1 = require("../../../arch/modules/application/failures/failure.abstract");
|
|
5
5
|
class HttpClientResponseGetHeaderFailure extends failure_abstract_1.FailureAbstract {
|
|
6
6
|
constructor(keyName, error) {
|
|
7
7
|
super({
|
|
@@ -3,11 +3,11 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.HttpClientResponse = void 0;
|
|
4
4
|
const class_transformer_1 = require("class-transformer");
|
|
5
5
|
const class_validator_1 = require("class-validator");
|
|
6
|
-
const http_status_codes_enum_1 = require("../../objects/arch/infrastructure/http-status-codes.enum");
|
|
7
6
|
const optional_type_1 = require("../ducts/optional-type");
|
|
7
|
+
const return_type_1 = require("../ducts/return-type");
|
|
8
8
|
const http_client_response_get_header_failure_1 = require("./http-client-response.get-header.failure");
|
|
9
9
|
const guardian_1 = require("../type-guard/guardian");
|
|
10
|
-
const
|
|
10
|
+
const http_status_codes_enum_1 = require("../../../arch/modules/domain/enums/http-status-codes.enum");
|
|
11
11
|
class HttpClientResponse {
|
|
12
12
|
constructor(statusCode, data, headers) {
|
|
13
13
|
this.statusCode = statusCode;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export declare class RandomValue {
|
|
2
|
+
static randomNumber(min: number, max: number): number;
|
|
3
|
+
static randomEnumValue<T extends Record<string, unknown>>(anEnum: T): T[keyof T];
|
|
4
|
+
static randomEnumValueExcept<T extends Record<string, unknown>>(anEnum: T, excepts: Array<T[keyof T]>): T[keyof T];
|
|
5
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.RandomValue = void 0;
|
|
4
|
+
class RandomValue {
|
|
5
|
+
static randomNumber(min, max) {
|
|
6
|
+
return Math.floor(Math.random() * (max - min + 1)) + min;
|
|
7
|
+
}
|
|
8
|
+
static randomEnumValue(anEnum) {
|
|
9
|
+
const keys = Object.keys(anEnum).filter((x) => Number.isNaN(Number(x)));
|
|
10
|
+
const randomKeyIndex = Math.floor(Math.random() * keys.length);
|
|
11
|
+
const randomKey = keys[randomKeyIndex];
|
|
12
|
+
return anEnum[randomKey];
|
|
13
|
+
}
|
|
14
|
+
static randomEnumValueExcept(anEnum, excepts) {
|
|
15
|
+
const exceptKeys = excepts.map((value) => Object.keys(anEnum).find((key) => anEnum[key] === value));
|
|
16
|
+
const validKeys = Object.keys(anEnum).filter((key) => Number.isNaN(Number(key)) && !exceptKeys.includes(key));
|
|
17
|
+
if (validKeys.length === 0) {
|
|
18
|
+
throw new Error("No valid enum keys available after excluding 'excepts'.");
|
|
19
|
+
}
|
|
20
|
+
const randomKeyIndex = Math.floor(Math.random() * validKeys.length);
|
|
21
|
+
const randomKey = validKeys[randomKeyIndex];
|
|
22
|
+
return anEnum[randomKey];
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
exports.RandomValue = RandomValue;
|
package/{objects/arch/application/errors → arch/modules/application/failures}/failure.abstract.d.ts
RENAMED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { FailureProps, FailurePrimitive } from "./failure.abstract.type";
|
|
2
2
|
import { SolidAbstract } from "../../domain/solid.abstract";
|
|
3
3
|
export declare abstract class FailureAbstract implements SolidAbstract {
|
|
4
4
|
private readonly props;
|
package/{objects/arch/application/errors → arch/modules/application/failures}/failure.abstract.js
RENAMED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.FailureAbstract = void 0;
|
|
4
|
-
const
|
|
5
|
-
const node_envs_enum_1 = require("
|
|
6
|
-
const
|
|
4
|
+
const guardian_1 = require("../../../../@tool-box/utils/type-guard/guardian");
|
|
5
|
+
const node_envs_enum_1 = require("../../domain/enums/node-envs.enum");
|
|
6
|
+
const env_vars_1 = require("../../../../setup/env/env-vars");
|
|
7
7
|
class FailureAbstract {
|
|
8
8
|
constructor(props) {
|
|
9
9
|
this.props = props;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
interface UnknownFailurePrimitive {
|
|
2
|
+
code: string;
|
|
3
|
+
message: string;
|
|
4
|
+
}
|
|
5
|
+
interface UnknownFailureProps {
|
|
6
|
+
className: string;
|
|
7
|
+
failure: UnknownFailurePrimitive;
|
|
8
|
+
}
|
|
9
|
+
export declare class UnknownFailure {
|
|
10
|
+
protected readonly unknownCode: string;
|
|
11
|
+
protected readonly unknownMessage: string;
|
|
12
|
+
constructor({ className, failure }: UnknownFailureProps);
|
|
13
|
+
toPlain(): UnknownFailurePrimitive;
|
|
14
|
+
}
|
|
15
|
+
export {};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
4
|
-
class
|
|
3
|
+
exports.UnknownFailure = void 0;
|
|
4
|
+
class UnknownFailure {
|
|
5
5
|
constructor({ className, failure }) {
|
|
6
6
|
this.unknownCode = className.toKebabCase();
|
|
7
7
|
this.unknownMessage = failure.message;
|
|
@@ -13,4 +13,4 @@ class UnknownApplicationFailure {
|
|
|
13
13
|
};
|
|
14
14
|
}
|
|
15
15
|
}
|
|
16
|
-
exports.
|
|
16
|
+
exports.UnknownFailure = UnknownFailure;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { Injections } from "./injections.abstract.type";
|
|
2
|
+
export declare abstract class InjectionsAbstract {
|
|
3
|
+
protected abstract _injections: Injections;
|
|
4
|
+
constructor();
|
|
5
|
+
private injectControllers;
|
|
6
|
+
private injectMiddlewares;
|
|
7
|
+
private injectUsecases;
|
|
8
|
+
private injectServices;
|
|
9
|
+
private injectRepositories;
|
|
10
|
+
private injectProviders;
|
|
11
|
+
}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.InjectionsAbstract = void 0;
|
|
4
|
+
const dependency_injections_1 = require("../../../setup/dependency-injections");
|
|
5
|
+
class InjectionsAbstract {
|
|
6
|
+
constructor() {
|
|
7
|
+
this.injectControllers();
|
|
8
|
+
this.injectMiddlewares();
|
|
9
|
+
this.injectUsecases();
|
|
10
|
+
this.injectServices();
|
|
11
|
+
this.injectRepositories();
|
|
12
|
+
this.injectProviders();
|
|
13
|
+
}
|
|
14
|
+
injectControllers() {
|
|
15
|
+
this._injections.controllers?.map((controller) => {
|
|
16
|
+
dependency_injections_1.diContainer.bind(controller).toSelf();
|
|
17
|
+
});
|
|
18
|
+
}
|
|
19
|
+
injectMiddlewares() {
|
|
20
|
+
this._injections.middlewares?.map((middleware) => {
|
|
21
|
+
dependency_injections_1.diContainer.bind(middleware).toSelf();
|
|
22
|
+
});
|
|
23
|
+
}
|
|
24
|
+
injectUsecases() {
|
|
25
|
+
this._injections.usecases?.map((usecase) => {
|
|
26
|
+
dependency_injections_1.diContainer.bind(usecase.ref).to(usecase.target);
|
|
27
|
+
});
|
|
28
|
+
}
|
|
29
|
+
injectServices() {
|
|
30
|
+
this._injections.services?.map((service) => {
|
|
31
|
+
dependency_injections_1.diContainer.bind(service.ref).to(service.target);
|
|
32
|
+
});
|
|
33
|
+
}
|
|
34
|
+
injectRepositories() {
|
|
35
|
+
this._injections.repositories?.map((repository) => {
|
|
36
|
+
dependency_injections_1.diContainer.bind(repository.ref).to(repository.target);
|
|
37
|
+
});
|
|
38
|
+
}
|
|
39
|
+
injectProviders() {
|
|
40
|
+
this._injections.providers?.map((provider) => {
|
|
41
|
+
dependency_injections_1.diContainer.bind(provider.ref).to(provider.target);
|
|
42
|
+
});
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
exports.InjectionsAbstract = InjectionsAbstract;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { Newable } from "../../../@tool-box/utils/datatypes/generic-types";
|
|
2
|
+
import { RepositoryAbstract } from "../domain/repositories/repository.abstract";
|
|
3
|
+
import { ServiceAbstract } from "../domain/services/service.abstract";
|
|
4
|
+
import { UsecaseAbstract } from "../domain/usecases/usecase.abstract";
|
|
5
|
+
interface BindTo<T> {
|
|
6
|
+
ref: Newable<Symbol>;
|
|
7
|
+
target: Newable<T>;
|
|
8
|
+
}
|
|
9
|
+
export interface Injections {
|
|
10
|
+
controllers?: [];
|
|
11
|
+
middlewares?: [];
|
|
12
|
+
usecases?: BindTo<UsecaseAbstract>[];
|
|
13
|
+
services?: BindTo<ServiceAbstract>[];
|
|
14
|
+
repositories?: BindTo<RepositoryAbstract>[];
|
|
15
|
+
providers?: BindTo<RepositoryAbstract>[];
|
|
16
|
+
}
|
|
17
|
+
export {};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.$number = void 0;
|
|
4
|
-
const guardian_1 = require("
|
|
4
|
+
const guardian_1 = require("../../../../@tool-box/utils/type-guard/guardian");
|
|
5
5
|
class $number {
|
|
6
6
|
constructor(value) {
|
|
7
7
|
this.value = value;
|