plutin 1.0.0 → 1.1.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/dist/core/decorators/controller-http-decorator.cjs +2 -444
- package/dist/core/decorators/controller-http-decorator.cjs.map +1 -1
- package/dist/core/decorators/controller-http-decorator.js +2 -452
- package/dist/core/decorators/controller-http-decorator.js.map +1 -1
- package/dist/core/http/base-controller.cjs +2 -444
- package/dist/core/http/base-controller.cjs.map +1 -1
- package/dist/core/http/base-controller.js +2 -452
- package/dist/core/http/base-controller.js.map +1 -1
- package/dist/{core/index.cjs → index.cjs} +303 -39
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +20 -0
- package/dist/index.d.ts +20 -0
- package/dist/{core/index.js → index.js} +285 -34
- package/dist/index.js.map +1 -0
- package/dist/infra/adapters/http/express-adapter.cjs +4 -446
- package/dist/infra/adapters/http/express-adapter.cjs.map +1 -1
- package/dist/infra/adapters/http/express-adapter.d.cts +2 -2
- package/dist/infra/adapters/http/express-adapter.d.ts +2 -2
- package/dist/infra/adapters/http/express-adapter.js +4 -454
- package/dist/infra/adapters/http/express-adapter.js.map +1 -1
- package/dist/infra/adapters/http/fastify-adapter.cjs +5 -447
- package/dist/infra/adapters/http/fastify-adapter.cjs.map +1 -1
- package/dist/infra/adapters/http/fastify-adapter.d.cts +2 -2
- package/dist/infra/adapters/http/fastify-adapter.d.ts +2 -2
- package/dist/infra/adapters/http/fastify-adapter.js +5 -455
- package/dist/infra/adapters/http/fastify-adapter.js.map +1 -1
- package/dist/infra/env/index.cjs +3 -9
- package/dist/infra/env/index.cjs.map +1 -1
- package/dist/infra/env/index.d.cts +21 -5
- package/dist/infra/env/index.d.ts +21 -5
- package/dist/infra/env/index.js +2 -8
- package/dist/infra/env/index.js.map +1 -1
- package/package.json +4 -4
- package/readme.md +3 -0
- package/dist/core/index.cjs.map +0 -1
- package/dist/core/index.d.cts +0 -18
- package/dist/core/index.d.ts +0 -18
- package/dist/core/index.js.map +0 -1
- package/dist/infra/index.cjs +0 -781
- package/dist/infra/index.cjs.map +0 -1
- package/dist/infra/index.d.cts +0 -5
- package/dist/infra/index.d.ts +0 -5
- package/dist/infra/index.js +0 -752
- package/dist/infra/index.js.map +0 -1
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __create = Object.create;
|
|
2
3
|
var __defProp = Object.defineProperty;
|
|
3
4
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
5
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
5
7
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
8
|
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
7
9
|
var __commonJS = (cb, mod) => function __require() {
|
|
@@ -19,6 +21,14 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
19
21
|
}
|
|
20
22
|
return to;
|
|
21
23
|
};
|
|
24
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
25
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
26
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
27
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
28
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
29
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
30
|
+
mod
|
|
31
|
+
));
|
|
22
32
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
23
33
|
|
|
24
34
|
// node_modules/dotenv/package.json
|
|
@@ -429,19 +439,22 @@ var require_cli_options = __commonJS({
|
|
|
429
439
|
}
|
|
430
440
|
});
|
|
431
441
|
|
|
432
|
-
// src/
|
|
433
|
-
var
|
|
434
|
-
__export(
|
|
442
|
+
// src/index.ts
|
|
443
|
+
var src_exports = {};
|
|
444
|
+
__export(src_exports, {
|
|
435
445
|
AggregateRoot: () => AggregateRoot,
|
|
436
446
|
Controller: () => Controller,
|
|
437
447
|
Entity: () => Entity,
|
|
438
448
|
Inject: () => Inject,
|
|
449
|
+
SentryNotifier: () => SentryNotifier,
|
|
439
450
|
UniqueEntityId: () => UniqueEntityId,
|
|
440
451
|
ValueObject: () => ValueObject,
|
|
441
452
|
WatchedList: () => WatchedList,
|
|
442
|
-
|
|
453
|
+
baseEnvSchema: () => baseEnvSchema,
|
|
454
|
+
getTakeAndSkip: () => getTakeAndSkip,
|
|
455
|
+
zodValidator: () => zodValidator
|
|
443
456
|
});
|
|
444
|
-
module.exports = __toCommonJS(
|
|
457
|
+
module.exports = __toCommonJS(src_exports);
|
|
445
458
|
|
|
446
459
|
// src/core/http/base-controller.ts
|
|
447
460
|
var import_reflect_metadata2 = require("reflect-metadata");
|
|
@@ -606,37 +619,6 @@ var ValidationError = class extends Error {
|
|
|
606
619
|
}
|
|
607
620
|
};
|
|
608
621
|
|
|
609
|
-
// node_modules/dotenv/config.js
|
|
610
|
-
(function() {
|
|
611
|
-
require_main().config(Object.assign({}, require_env_options(), require_cli_options()(process.argv)));
|
|
612
|
-
})();
|
|
613
|
-
|
|
614
|
-
// src/infra/env/index.ts
|
|
615
|
-
var import_zod = require("zod");
|
|
616
|
-
var envSchema = import_zod.z.object({
|
|
617
|
-
NODE_ENV: import_zod.z.enum([
|
|
618
|
-
"test",
|
|
619
|
-
"development",
|
|
620
|
-
"production"
|
|
621
|
-
]).default("production"),
|
|
622
|
-
ENVIRONMENT: import_zod.z.enum([
|
|
623
|
-
"test",
|
|
624
|
-
"development",
|
|
625
|
-
"staging",
|
|
626
|
-
"production"
|
|
627
|
-
]).default("development"),
|
|
628
|
-
PORT: import_zod.z.coerce.number().default(3333),
|
|
629
|
-
SHOULD_NOTIFY_ERROR: import_zod.z.coerce.boolean().default(true),
|
|
630
|
-
SENTRY_DSN: import_zod.z.string().optional(),
|
|
631
|
-
DISCORD_WEBHOOK_URL: import_zod.z.string().optional()
|
|
632
|
-
});
|
|
633
|
-
var _env = envSchema.safeParse(process.env);
|
|
634
|
-
if (_env.success === false) {
|
|
635
|
-
console.error("\u274C Invalid environment variables.", _env.error.format());
|
|
636
|
-
throw new Error("Invalid environment variables.");
|
|
637
|
-
}
|
|
638
|
-
var env = _env.data;
|
|
639
|
-
|
|
640
622
|
// src/core/http/base-controller.ts
|
|
641
623
|
var BaseController = class {
|
|
642
624
|
static {
|
|
@@ -676,7 +658,7 @@ var BaseController = class {
|
|
|
676
658
|
}
|
|
677
659
|
buildContextError(request) {
|
|
678
660
|
return {
|
|
679
|
-
env: env.ENVIRONMENT,
|
|
661
|
+
env: process.env.ENVIRONMENT,
|
|
680
662
|
request: {
|
|
681
663
|
body: request.body,
|
|
682
664
|
headers: request.headers,
|
|
@@ -720,7 +702,7 @@ var BaseController = class {
|
|
|
720
702
|
}
|
|
721
703
|
};
|
|
722
704
|
}
|
|
723
|
-
if (env.SHOULD_NOTIFY_ERROR) {
|
|
705
|
+
if (process.env.SHOULD_NOTIFY_ERROR) {
|
|
724
706
|
await this.errorNotifier.notify(error, context);
|
|
725
707
|
}
|
|
726
708
|
return {
|
|
@@ -943,15 +925,297 @@ function getTakeAndSkip(size, page) {
|
|
|
943
925
|
};
|
|
944
926
|
}
|
|
945
927
|
__name(getTakeAndSkip, "getTakeAndSkip");
|
|
928
|
+
|
|
929
|
+
// src/infra/adapters/http/express-adapter.ts
|
|
930
|
+
var import_cors = __toESM(require("cors"), 1);
|
|
931
|
+
var import_express = __toESM(require("express"), 1);
|
|
932
|
+
|
|
933
|
+
// src/infra/adapters/http/validate-controller-metadata.ts
|
|
934
|
+
var import_reflect_metadata3 = require("reflect-metadata");
|
|
935
|
+
|
|
936
|
+
// src/infra/adapters/http/fastify-adapter.ts
|
|
937
|
+
var import_cors2 = __toESM(require("@fastify/cors"), 1);
|
|
938
|
+
var import_fastify = __toESM(require("fastify"), 1);
|
|
939
|
+
var import_qs = __toESM(require("qs"), 1);
|
|
940
|
+
|
|
941
|
+
// src/infra/adapters/notifications/discord.ts
|
|
942
|
+
var import_discord_webhook_node = require("discord-webhook-node");
|
|
943
|
+
function _ts_decorate(decorators, target, key, desc) {
|
|
944
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
945
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
|
|
946
|
+
r = Reflect.decorate(decorators, target, key, desc);
|
|
947
|
+
else
|
|
948
|
+
for (var i = decorators.length - 1; i >= 0; i--)
|
|
949
|
+
if (d = decorators[i])
|
|
950
|
+
r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
951
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
952
|
+
}
|
|
953
|
+
__name(_ts_decorate, "_ts_decorate");
|
|
954
|
+
function _ts_metadata(k, v) {
|
|
955
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function")
|
|
956
|
+
return Reflect.metadata(k, v);
|
|
957
|
+
}
|
|
958
|
+
__name(_ts_metadata, "_ts_metadata");
|
|
959
|
+
function _ts_param(paramIndex, decorator) {
|
|
960
|
+
return function(target, key) {
|
|
961
|
+
decorator(target, key, paramIndex);
|
|
962
|
+
};
|
|
963
|
+
}
|
|
964
|
+
__name(_ts_param, "_ts_param");
|
|
965
|
+
var DiscordNotifier = class {
|
|
966
|
+
static {
|
|
967
|
+
__name(this, "DiscordNotifier");
|
|
968
|
+
}
|
|
969
|
+
options;
|
|
970
|
+
webhook;
|
|
971
|
+
constructor(options) {
|
|
972
|
+
this.options = options;
|
|
973
|
+
this.webhook = new import_discord_webhook_node.Webhook(this.options.url);
|
|
974
|
+
}
|
|
975
|
+
async notify(error, context) {
|
|
976
|
+
const embed = new import_discord_webhook_node.MessageBuilder().setTitle("\u{1F6A8} Error").addField("Message", `\`\`\`${error.message.slice(0, 300)}\`\`\``).addField("Route:", `\`[${context?.request?.method}] ${context?.request?.url}\``, true).addField("Params:", "```json\n" + JSON.stringify(context?.request?.params, null, 2) + "\n```", true).addField("Query:", "```json\n" + JSON.stringify(context?.request?.query, null, 2) + "\n```", true).addField("Headers:", "```json\n" + JSON.stringify(context?.request?.headers, null, 2) + "\n```", true).addField("Body:", "```json\n" + JSON.stringify(context?.request?.body, null, 2) + "\n```").addField("Stack Trace:", "```" + (error.stack || "No stack provided").slice(0, 900) + "```").setFooter(`Env: ${this.options.env || "development"}`).setTimestamp();
|
|
977
|
+
await this.webhook.send(embed);
|
|
978
|
+
}
|
|
979
|
+
};
|
|
980
|
+
DiscordNotifier = _ts_decorate([
|
|
981
|
+
_ts_param(0, Inject("DiscordConfig")),
|
|
982
|
+
_ts_metadata("design:type", Function),
|
|
983
|
+
_ts_metadata("design:paramtypes", [
|
|
984
|
+
typeof DiscordOptions === "undefined" ? Object : DiscordOptions
|
|
985
|
+
])
|
|
986
|
+
], DiscordNotifier);
|
|
987
|
+
|
|
988
|
+
// src/infra/adapters/notifications/sentry.ts
|
|
989
|
+
var Sentry = __toESM(require("@sentry/node"), 1);
|
|
990
|
+
function _ts_decorate2(decorators, target, key, desc) {
|
|
991
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
992
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
|
|
993
|
+
r = Reflect.decorate(decorators, target, key, desc);
|
|
994
|
+
else
|
|
995
|
+
for (var i = decorators.length - 1; i >= 0; i--)
|
|
996
|
+
if (d = decorators[i])
|
|
997
|
+
r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
998
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
999
|
+
}
|
|
1000
|
+
__name(_ts_decorate2, "_ts_decorate");
|
|
1001
|
+
function _ts_metadata2(k, v) {
|
|
1002
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function")
|
|
1003
|
+
return Reflect.metadata(k, v);
|
|
1004
|
+
}
|
|
1005
|
+
__name(_ts_metadata2, "_ts_metadata");
|
|
1006
|
+
function _ts_param2(paramIndex, decorator) {
|
|
1007
|
+
return function(target, key) {
|
|
1008
|
+
decorator(target, key, paramIndex);
|
|
1009
|
+
};
|
|
1010
|
+
}
|
|
1011
|
+
__name(_ts_param2, "_ts_param");
|
|
1012
|
+
var SentryNotifier = class {
|
|
1013
|
+
static {
|
|
1014
|
+
__name(this, "SentryNotifier");
|
|
1015
|
+
}
|
|
1016
|
+
options;
|
|
1017
|
+
constructor(options) {
|
|
1018
|
+
this.options = options;
|
|
1019
|
+
Sentry.init({
|
|
1020
|
+
dsn: this.options.dsn,
|
|
1021
|
+
environment: this.options.environment,
|
|
1022
|
+
attachStacktrace: true,
|
|
1023
|
+
tracesSampleRate: this.options.environment === "production" ? 0.1 : 1,
|
|
1024
|
+
maxBreadcrumbs: 100,
|
|
1025
|
+
debug: this.options.environment !== "production"
|
|
1026
|
+
});
|
|
1027
|
+
}
|
|
1028
|
+
async notify(error, context) {
|
|
1029
|
+
Sentry.withScope((scope) => {
|
|
1030
|
+
scope.setLevel("error");
|
|
1031
|
+
if (context?.env)
|
|
1032
|
+
scope.setTag("env", context.env);
|
|
1033
|
+
if (context?.user) {
|
|
1034
|
+
scope.setUser({
|
|
1035
|
+
id: context.user.id,
|
|
1036
|
+
username: context.user.name,
|
|
1037
|
+
email: context.user.email
|
|
1038
|
+
});
|
|
1039
|
+
}
|
|
1040
|
+
if (context?.request) {
|
|
1041
|
+
const { body, query, params, headers, method, url, requestId } = context.request;
|
|
1042
|
+
scope.setContext("http", {
|
|
1043
|
+
method,
|
|
1044
|
+
requestId,
|
|
1045
|
+
url,
|
|
1046
|
+
headers,
|
|
1047
|
+
query,
|
|
1048
|
+
body,
|
|
1049
|
+
params
|
|
1050
|
+
});
|
|
1051
|
+
}
|
|
1052
|
+
Sentry.captureException(error);
|
|
1053
|
+
});
|
|
1054
|
+
}
|
|
1055
|
+
};
|
|
1056
|
+
SentryNotifier = _ts_decorate2([
|
|
1057
|
+
_ts_param2(0, Inject("SentryConfig")),
|
|
1058
|
+
_ts_metadata2("design:type", Function),
|
|
1059
|
+
_ts_metadata2("design:paramtypes", [
|
|
1060
|
+
typeof SentryOptions === "undefined" ? Object : SentryOptions
|
|
1061
|
+
])
|
|
1062
|
+
], SentryNotifier);
|
|
1063
|
+
|
|
1064
|
+
// src/infra/adapters/validators/zod/zod-map-error.ts
|
|
1065
|
+
var ZodMapError = class {
|
|
1066
|
+
static {
|
|
1067
|
+
__name(this, "ZodMapError");
|
|
1068
|
+
}
|
|
1069
|
+
static mapCommon(error) {
|
|
1070
|
+
return {
|
|
1071
|
+
type: error.code,
|
|
1072
|
+
path: error.path.join("."),
|
|
1073
|
+
property: error.path.pop(),
|
|
1074
|
+
propertyType: error.expected,
|
|
1075
|
+
receivedValue: error.received,
|
|
1076
|
+
message: error.message
|
|
1077
|
+
};
|
|
1078
|
+
}
|
|
1079
|
+
static mapInvalidUnion(error) {
|
|
1080
|
+
const [errors] = error.unionErrors.flat().map((err) => err.issues.map((item) => this.mapCommon(item)));
|
|
1081
|
+
return errors;
|
|
1082
|
+
}
|
|
1083
|
+
static mapInvalidType(error) {
|
|
1084
|
+
return [
|
|
1085
|
+
this.mapCommon(error)
|
|
1086
|
+
];
|
|
1087
|
+
}
|
|
1088
|
+
static mapErrorsFactory(error) {
|
|
1089
|
+
if (error.code === "invalid_union") {
|
|
1090
|
+
return this.mapInvalidUnion(error);
|
|
1091
|
+
}
|
|
1092
|
+
return this.mapInvalidType(error);
|
|
1093
|
+
}
|
|
1094
|
+
static mapErrors(errors) {
|
|
1095
|
+
const standardizedErrors = /* @__PURE__ */ new Map();
|
|
1096
|
+
errors.flat().forEach((error) => {
|
|
1097
|
+
const keyError = standardizedErrors.get(error.path[0]);
|
|
1098
|
+
if (keyError) {
|
|
1099
|
+
if (!keyError.propertyErrors) {
|
|
1100
|
+
keyError.propertyErrors = [];
|
|
1101
|
+
}
|
|
1102
|
+
keyError.propertyErrors.push(...this.mapErrorsFactory(error));
|
|
1103
|
+
return;
|
|
1104
|
+
}
|
|
1105
|
+
standardizedErrors.set(error.path[0], {
|
|
1106
|
+
location: error.path[0],
|
|
1107
|
+
propertyErrors: Array.from([
|
|
1108
|
+
...this.mapErrorsFactory(error)
|
|
1109
|
+
])
|
|
1110
|
+
});
|
|
1111
|
+
});
|
|
1112
|
+
return Array.from(standardizedErrors, ([, arr]) => ({
|
|
1113
|
+
...arr
|
|
1114
|
+
})).flat();
|
|
1115
|
+
}
|
|
1116
|
+
};
|
|
1117
|
+
|
|
1118
|
+
// src/infra/adapters/validators/zod/index.ts
|
|
1119
|
+
var ZodValidator = class {
|
|
1120
|
+
static {
|
|
1121
|
+
__name(this, "ZodValidator");
|
|
1122
|
+
}
|
|
1123
|
+
zodSchema;
|
|
1124
|
+
constructor(zodSchema) {
|
|
1125
|
+
this.zodSchema = zodSchema;
|
|
1126
|
+
}
|
|
1127
|
+
async validate(requestHttp) {
|
|
1128
|
+
const errors = [];
|
|
1129
|
+
const { data: headersData = {}, error: headersErrors = {} } = requestHttp.headers ? await this.zodSchema.shape.headers.safeParseAsync(requestHttp.headers, {
|
|
1130
|
+
path: [
|
|
1131
|
+
"headers"
|
|
1132
|
+
]
|
|
1133
|
+
}) : {};
|
|
1134
|
+
if (headersErrors?.errors) {
|
|
1135
|
+
errors.push(headersErrors?.errors);
|
|
1136
|
+
}
|
|
1137
|
+
const { data: paramsData = {}, error: paramsErrors = {} } = requestHttp.params ? await this.zodSchema.shape.params.safeParseAsync(requestHttp.params, {
|
|
1138
|
+
path: [
|
|
1139
|
+
"params"
|
|
1140
|
+
]
|
|
1141
|
+
}) : {};
|
|
1142
|
+
if (paramsErrors?.errors) {
|
|
1143
|
+
errors.push(paramsErrors?.errors);
|
|
1144
|
+
}
|
|
1145
|
+
const { data: queryData = {}, error: queryErrors = {} } = requestHttp.query ? await this.zodSchema.shape.query.safeParseAsync(requestHttp.query, {
|
|
1146
|
+
path: [
|
|
1147
|
+
"query"
|
|
1148
|
+
]
|
|
1149
|
+
}) : {};
|
|
1150
|
+
if (queryErrors?.errors) {
|
|
1151
|
+
errors.push(queryErrors?.errors);
|
|
1152
|
+
}
|
|
1153
|
+
const { data: bodyData = {}, error: bodyErrors = {} } = requestHttp.body ? await this.zodSchema.shape.body.safeParseAsync(requestHttp.body, {
|
|
1154
|
+
path: [
|
|
1155
|
+
"body"
|
|
1156
|
+
]
|
|
1157
|
+
}) : {};
|
|
1158
|
+
if (bodyErrors?.errors) {
|
|
1159
|
+
errors.push(bodyErrors?.errors);
|
|
1160
|
+
}
|
|
1161
|
+
if (errors.length) {
|
|
1162
|
+
throw new ValidationError(ZodMapError.mapErrors(errors));
|
|
1163
|
+
}
|
|
1164
|
+
return {
|
|
1165
|
+
body: bodyData,
|
|
1166
|
+
headers: headersData,
|
|
1167
|
+
params: paramsData,
|
|
1168
|
+
query: queryData
|
|
1169
|
+
};
|
|
1170
|
+
}
|
|
1171
|
+
};
|
|
1172
|
+
|
|
1173
|
+
// src/infra/adapters/validators/zod/zod-validator.ts
|
|
1174
|
+
function zodValidator(schema) {
|
|
1175
|
+
return async (request) => {
|
|
1176
|
+
const validator = new ZodValidator(schema);
|
|
1177
|
+
const validatedRequest = await validator.validate(request);
|
|
1178
|
+
return validatedRequest;
|
|
1179
|
+
};
|
|
1180
|
+
}
|
|
1181
|
+
__name(zodValidator, "zodValidator");
|
|
1182
|
+
|
|
1183
|
+
// node_modules/dotenv/config.js
|
|
1184
|
+
(function() {
|
|
1185
|
+
require_main().config(Object.assign({}, require_env_options(), require_cli_options()(process.argv)));
|
|
1186
|
+
})();
|
|
1187
|
+
|
|
1188
|
+
// src/infra/env/index.ts
|
|
1189
|
+
var import_zod = require("zod");
|
|
1190
|
+
var baseEnvSchema = import_zod.z.object({
|
|
1191
|
+
NODE_ENV: import_zod.z.enum([
|
|
1192
|
+
"test",
|
|
1193
|
+
"development",
|
|
1194
|
+
"production"
|
|
1195
|
+
]).default("production"),
|
|
1196
|
+
ENVIRONMENT: import_zod.z.enum([
|
|
1197
|
+
"test",
|
|
1198
|
+
"development",
|
|
1199
|
+
"staging",
|
|
1200
|
+
"production"
|
|
1201
|
+
]).default("development"),
|
|
1202
|
+
PORT: import_zod.z.coerce.number().default(3333),
|
|
1203
|
+
SHOULD_NOTIFY_ERROR: import_zod.z.coerce.boolean().default(true),
|
|
1204
|
+
SENTRY_DSN: import_zod.z.string().optional(),
|
|
1205
|
+
DISCORD_WEBHOOK_URL: import_zod.z.string().optional()
|
|
1206
|
+
});
|
|
946
1207
|
// Annotate the CommonJS export names for ESM import in node:
|
|
947
1208
|
0 && (module.exports = {
|
|
948
1209
|
AggregateRoot,
|
|
949
1210
|
Controller,
|
|
950
1211
|
Entity,
|
|
951
1212
|
Inject,
|
|
1213
|
+
SentryNotifier,
|
|
952
1214
|
UniqueEntityId,
|
|
953
1215
|
ValueObject,
|
|
954
1216
|
WatchedList,
|
|
955
|
-
|
|
1217
|
+
baseEnvSchema,
|
|
1218
|
+
getTakeAndSkip,
|
|
1219
|
+
zodValidator
|
|
956
1220
|
});
|
|
957
1221
|
//# sourceMappingURL=index.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../node_modules/dotenv/package.json","../node_modules/dotenv/lib/main.js","../node_modules/dotenv/lib/env-options.js","../node_modules/dotenv/lib/cli-options.js","../src/index.ts","../src/core/http/base-controller.ts","../src/core/decorators/dependency-container.ts","../src/core/errors/api-common-error.ts","../src/core/errors/application-error.ts","../src/core/errors/conflict-error.ts","../src/core/errors/domain-error.ts","../src/core/errors/infra-error.ts","../src/core/errors/validation-error.ts","../src/core/decorators/controller-http-decorator.ts","../src/core/entities/unique-entity-id.ts","../src/core/entities/entity.ts","../src/core/entities/aggregate-root.ts","../src/core/entities/value-object.ts","../src/core/entities/watched-list.ts","../src/core/http/get-take-and-skip.ts","../src/infra/adapters/http/express-adapter.ts","../src/infra/adapters/http/validate-controller-metadata.ts","../src/infra/adapters/http/fastify-adapter.ts","../src/infra/adapters/notifications/discord.ts","../src/infra/adapters/notifications/sentry.ts","../src/infra/adapters/validators/zod/zod-map-error.ts","../src/infra/adapters/validators/zod/index.ts","../src/infra/adapters/validators/zod/zod-validator.ts","../node_modules/dotenv/config.js","../src/infra/env/index.ts"],"sourcesContent":["{\n \"name\": \"dotenv\",\n \"version\": \"16.5.0\",\n \"description\": \"Loads environment variables from .env file\",\n \"main\": \"lib/main.js\",\n \"types\": \"lib/main.d.ts\",\n \"exports\": {\n \".\": {\n \"types\": \"./lib/main.d.ts\",\n \"require\": \"./lib/main.js\",\n \"default\": \"./lib/main.js\"\n },\n \"./config\": \"./config.js\",\n \"./config.js\": \"./config.js\",\n \"./lib/env-options\": \"./lib/env-options.js\",\n \"./lib/env-options.js\": \"./lib/env-options.js\",\n \"./lib/cli-options\": \"./lib/cli-options.js\",\n \"./lib/cli-options.js\": \"./lib/cli-options.js\",\n \"./package.json\": \"./package.json\"\n },\n \"scripts\": {\n \"dts-check\": \"tsc --project tests/types/tsconfig.json\",\n \"lint\": \"standard\",\n \"pretest\": \"npm run lint && npm run dts-check\",\n \"test\": \"tap run --allow-empty-coverage --disable-coverage --timeout=60000\",\n \"test:coverage\": \"tap run --show-full-coverage --timeout=60000 --coverage-report=lcov\",\n \"prerelease\": \"npm test\",\n \"release\": \"standard-version\"\n },\n \"repository\": {\n \"type\": \"git\",\n \"url\": \"git://github.com/motdotla/dotenv.git\"\n },\n \"homepage\": \"https://github.com/motdotla/dotenv#readme\",\n \"funding\": \"https://dotenvx.com\",\n \"keywords\": [\n \"dotenv\",\n \"env\",\n \".env\",\n \"environment\",\n \"variables\",\n \"config\",\n \"settings\"\n ],\n \"readmeFilename\": \"README.md\",\n \"license\": \"BSD-2-Clause\",\n \"devDependencies\": {\n \"@types/node\": \"^18.11.3\",\n \"decache\": \"^4.6.2\",\n \"sinon\": \"^14.0.1\",\n \"standard\": \"^17.0.0\",\n \"standard-version\": \"^9.5.0\",\n \"tap\": \"^19.2.0\",\n \"typescript\": \"^4.8.4\"\n },\n \"engines\": {\n \"node\": \">=12\"\n },\n \"browser\": {\n \"fs\": false\n }\n}\n","const fs = require('fs')\nconst path = require('path')\nconst os = require('os')\nconst crypto = require('crypto')\nconst packageJson = require('../package.json')\n\nconst version = packageJson.version\n\nconst LINE = /(?:^|^)\\s*(?:export\\s+)?([\\w.-]+)(?:\\s*=\\s*?|:\\s+?)(\\s*'(?:\\\\'|[^'])*'|\\s*\"(?:\\\\\"|[^\"])*\"|\\s*`(?:\\\\`|[^`])*`|[^#\\r\\n]+)?\\s*(?:#.*)?(?:$|$)/mg\n\n// Parse src into an Object\nfunction parse (src) {\n const obj = {}\n\n // Convert buffer to string\n let lines = src.toString()\n\n // Convert line breaks to same format\n lines = lines.replace(/\\r\\n?/mg, '\\n')\n\n let match\n while ((match = LINE.exec(lines)) != null) {\n const key = match[1]\n\n // Default undefined or null to empty string\n let value = (match[2] || '')\n\n // Remove whitespace\n value = value.trim()\n\n // Check if double quoted\n const maybeQuote = value[0]\n\n // Remove surrounding quotes\n value = value.replace(/^(['\"`])([\\s\\S]*)\\1$/mg, '$2')\n\n // Expand newlines if double quoted\n if (maybeQuote === '\"') {\n value = value.replace(/\\\\n/g, '\\n')\n value = value.replace(/\\\\r/g, '\\r')\n }\n\n // Add to object\n obj[key] = value\n }\n\n return obj\n}\n\nfunction _parseVault (options) {\n const vaultPath = _vaultPath(options)\n\n // Parse .env.vault\n const result = DotenvModule.configDotenv({ path: vaultPath })\n if (!result.parsed) {\n const err = new Error(`MISSING_DATA: Cannot parse ${vaultPath} for an unknown reason`)\n err.code = 'MISSING_DATA'\n throw err\n }\n\n // handle scenario for comma separated keys - for use with key rotation\n // example: DOTENV_KEY=\"dotenv://:key_1234@dotenvx.com/vault/.env.vault?environment=prod,dotenv://:key_7890@dotenvx.com/vault/.env.vault?environment=prod\"\n const keys = _dotenvKey(options).split(',')\n const length = keys.length\n\n let decrypted\n for (let i = 0; i < length; i++) {\n try {\n // Get full key\n const key = keys[i].trim()\n\n // Get instructions for decrypt\n const attrs = _instructions(result, key)\n\n // Decrypt\n decrypted = DotenvModule.decrypt(attrs.ciphertext, attrs.key)\n\n break\n } catch (error) {\n // last key\n if (i + 1 >= length) {\n throw error\n }\n // try next key\n }\n }\n\n // Parse decrypted .env string\n return DotenvModule.parse(decrypted)\n}\n\nfunction _warn (message) {\n console.log(`[dotenv@${version}][WARN] ${message}`)\n}\n\nfunction _debug (message) {\n console.log(`[dotenv@${version}][DEBUG] ${message}`)\n}\n\nfunction _dotenvKey (options) {\n // prioritize developer directly setting options.DOTENV_KEY\n if (options && options.DOTENV_KEY && options.DOTENV_KEY.length > 0) {\n return options.DOTENV_KEY\n }\n\n // secondary infra already contains a DOTENV_KEY environment variable\n if (process.env.DOTENV_KEY && process.env.DOTENV_KEY.length > 0) {\n return process.env.DOTENV_KEY\n }\n\n // fallback to empty string\n return ''\n}\n\nfunction _instructions (result, dotenvKey) {\n // Parse DOTENV_KEY. Format is a URI\n let uri\n try {\n uri = new URL(dotenvKey)\n } catch (error) {\n if (error.code === 'ERR_INVALID_URL') {\n const err = new Error('INVALID_DOTENV_KEY: Wrong format. Must be in valid uri format like dotenv://:key_1234@dotenvx.com/vault/.env.vault?environment=development')\n err.code = 'INVALID_DOTENV_KEY'\n throw err\n }\n\n throw error\n }\n\n // Get decrypt key\n const key = uri.password\n if (!key) {\n const err = new Error('INVALID_DOTENV_KEY: Missing key part')\n err.code = 'INVALID_DOTENV_KEY'\n throw err\n }\n\n // Get environment\n const environment = uri.searchParams.get('environment')\n if (!environment) {\n const err = new Error('INVALID_DOTENV_KEY: Missing environment part')\n err.code = 'INVALID_DOTENV_KEY'\n throw err\n }\n\n // Get ciphertext payload\n const environmentKey = `DOTENV_VAULT_${environment.toUpperCase()}`\n const ciphertext = result.parsed[environmentKey] // DOTENV_VAULT_PRODUCTION\n if (!ciphertext) {\n const err = new Error(`NOT_FOUND_DOTENV_ENVIRONMENT: Cannot locate environment ${environmentKey} in your .env.vault file.`)\n err.code = 'NOT_FOUND_DOTENV_ENVIRONMENT'\n throw err\n }\n\n return { ciphertext, key }\n}\n\nfunction _vaultPath (options) {\n let possibleVaultPath = null\n\n if (options && options.path && options.path.length > 0) {\n if (Array.isArray(options.path)) {\n for (const filepath of options.path) {\n if (fs.existsSync(filepath)) {\n possibleVaultPath = filepath.endsWith('.vault') ? filepath : `${filepath}.vault`\n }\n }\n } else {\n possibleVaultPath = options.path.endsWith('.vault') ? options.path : `${options.path}.vault`\n }\n } else {\n possibleVaultPath = path.resolve(process.cwd(), '.env.vault')\n }\n\n if (fs.existsSync(possibleVaultPath)) {\n return possibleVaultPath\n }\n\n return null\n}\n\nfunction _resolveHome (envPath) {\n return envPath[0] === '~' ? path.join(os.homedir(), envPath.slice(1)) : envPath\n}\n\nfunction _configVault (options) {\n const debug = Boolean(options && options.debug)\n if (debug) {\n _debug('Loading env from encrypted .env.vault')\n }\n\n const parsed = DotenvModule._parseVault(options)\n\n let processEnv = process.env\n if (options && options.processEnv != null) {\n processEnv = options.processEnv\n }\n\n DotenvModule.populate(processEnv, parsed, options)\n\n return { parsed }\n}\n\nfunction configDotenv (options) {\n const dotenvPath = path.resolve(process.cwd(), '.env')\n let encoding = 'utf8'\n const debug = Boolean(options && options.debug)\n\n if (options && options.encoding) {\n encoding = options.encoding\n } else {\n if (debug) {\n _debug('No encoding is specified. UTF-8 is used by default')\n }\n }\n\n let optionPaths = [dotenvPath] // default, look for .env\n if (options && options.path) {\n if (!Array.isArray(options.path)) {\n optionPaths = [_resolveHome(options.path)]\n } else {\n optionPaths = [] // reset default\n for (const filepath of options.path) {\n optionPaths.push(_resolveHome(filepath))\n }\n }\n }\n\n // Build the parsed data in a temporary object (because we need to return it). Once we have the final\n // parsed data, we will combine it with process.env (or options.processEnv if provided).\n let lastError\n const parsedAll = {}\n for (const path of optionPaths) {\n try {\n // Specifying an encoding returns a string instead of a buffer\n const parsed = DotenvModule.parse(fs.readFileSync(path, { encoding }))\n\n DotenvModule.populate(parsedAll, parsed, options)\n } catch (e) {\n if (debug) {\n _debug(`Failed to load ${path} ${e.message}`)\n }\n lastError = e\n }\n }\n\n let processEnv = process.env\n if (options && options.processEnv != null) {\n processEnv = options.processEnv\n }\n\n DotenvModule.populate(processEnv, parsedAll, options)\n\n if (lastError) {\n return { parsed: parsedAll, error: lastError }\n } else {\n return { parsed: parsedAll }\n }\n}\n\n// Populates process.env from .env file\nfunction config (options) {\n // fallback to original dotenv if DOTENV_KEY is not set\n if (_dotenvKey(options).length === 0) {\n return DotenvModule.configDotenv(options)\n }\n\n const vaultPath = _vaultPath(options)\n\n // dotenvKey exists but .env.vault file does not exist\n if (!vaultPath) {\n _warn(`You set DOTENV_KEY but you are missing a .env.vault file at ${vaultPath}. Did you forget to build it?`)\n\n return DotenvModule.configDotenv(options)\n }\n\n return DotenvModule._configVault(options)\n}\n\nfunction decrypt (encrypted, keyStr) {\n const key = Buffer.from(keyStr.slice(-64), 'hex')\n let ciphertext = Buffer.from(encrypted, 'base64')\n\n const nonce = ciphertext.subarray(0, 12)\n const authTag = ciphertext.subarray(-16)\n ciphertext = ciphertext.subarray(12, -16)\n\n try {\n const aesgcm = crypto.createDecipheriv('aes-256-gcm', key, nonce)\n aesgcm.setAuthTag(authTag)\n return `${aesgcm.update(ciphertext)}${aesgcm.final()}`\n } catch (error) {\n const isRange = error instanceof RangeError\n const invalidKeyLength = error.message === 'Invalid key length'\n const decryptionFailed = error.message === 'Unsupported state or unable to authenticate data'\n\n if (isRange || invalidKeyLength) {\n const err = new Error('INVALID_DOTENV_KEY: It must be 64 characters long (or more)')\n err.code = 'INVALID_DOTENV_KEY'\n throw err\n } else if (decryptionFailed) {\n const err = new Error('DECRYPTION_FAILED: Please check your DOTENV_KEY')\n err.code = 'DECRYPTION_FAILED'\n throw err\n } else {\n throw error\n }\n }\n}\n\n// Populate process.env with parsed values\nfunction populate (processEnv, parsed, options = {}) {\n const debug = Boolean(options && options.debug)\n const override = Boolean(options && options.override)\n\n if (typeof parsed !== 'object') {\n const err = new Error('OBJECT_REQUIRED: Please check the processEnv argument being passed to populate')\n err.code = 'OBJECT_REQUIRED'\n throw err\n }\n\n // Set process.env\n for (const key of Object.keys(parsed)) {\n if (Object.prototype.hasOwnProperty.call(processEnv, key)) {\n if (override === true) {\n processEnv[key] = parsed[key]\n }\n\n if (debug) {\n if (override === true) {\n _debug(`\"${key}\" is already defined and WAS overwritten`)\n } else {\n _debug(`\"${key}\" is already defined and was NOT overwritten`)\n }\n }\n } else {\n processEnv[key] = parsed[key]\n }\n }\n}\n\nconst DotenvModule = {\n configDotenv,\n _configVault,\n _parseVault,\n config,\n decrypt,\n parse,\n populate\n}\n\nmodule.exports.configDotenv = DotenvModule.configDotenv\nmodule.exports._configVault = DotenvModule._configVault\nmodule.exports._parseVault = DotenvModule._parseVault\nmodule.exports.config = DotenvModule.config\nmodule.exports.decrypt = DotenvModule.decrypt\nmodule.exports.parse = DotenvModule.parse\nmodule.exports.populate = DotenvModule.populate\n\nmodule.exports = DotenvModule\n","// ../config.js accepts options via environment variables\nconst options = {}\n\nif (process.env.DOTENV_CONFIG_ENCODING != null) {\n options.encoding = process.env.DOTENV_CONFIG_ENCODING\n}\n\nif (process.env.DOTENV_CONFIG_PATH != null) {\n options.path = process.env.DOTENV_CONFIG_PATH\n}\n\nif (process.env.DOTENV_CONFIG_DEBUG != null) {\n options.debug = process.env.DOTENV_CONFIG_DEBUG\n}\n\nif (process.env.DOTENV_CONFIG_OVERRIDE != null) {\n options.override = process.env.DOTENV_CONFIG_OVERRIDE\n}\n\nif (process.env.DOTENV_CONFIG_DOTENV_KEY != null) {\n options.DOTENV_KEY = process.env.DOTENV_CONFIG_DOTENV_KEY\n}\n\nmodule.exports = options\n","const re = /^dotenv_config_(encoding|path|debug|override|DOTENV_KEY)=(.+)$/\n\nmodule.exports = function optionMatcher (args) {\n return args.reduce(function (acc, cur) {\n const matches = cur.match(re)\n if (matches) {\n acc[matches[1]] = matches[2]\n }\n return acc\n }, {})\n}\n","// core decorators\nexport * from './core/decorators/controller-http-decorator'\nexport * from './core/decorators/dependency-container'\n\n// core entities\nexport * from './core/entities/aggregate-root'\nexport * from './core/entities/common-dto'\nexport * from './core/entities/domain-event'\nexport * from './core/entities/entity'\nexport * from './core/entities/optional'\nexport * from './core/entities/unique-entity-id'\nexport * from './core/entities/value-object'\nexport * from './core/entities/watched-list'\n\n// core errors\nexport * from './core/errors/application-error'\nexport * from './core/errors/conflict-error'\nexport * from './core/errors/domain-error'\nexport * from './core/errors/http-client-error'\nexport * from './core/errors/infra-error'\n\n// core http\nexport * from './core/http/base-controller'\nexport * from './core/http/dto-response'\nexport * from './core/http/get-take-and-skip'\nexport * from './core/http/health-connections'\nexport * from './core/http/pagination'\nexport * from './core/http/validator'\n\n// infra adapters http\nexport * from './infra/adapters/http/express-adapter'\nexport * from './infra/adapters/http/fastify-adapter'\n\n// infra adapters notifications\nexport * from './infra/adapters/notifications/discord'\nexport * from './infra/adapters/notifications/in-memory'\nexport * from './infra/adapters/notifications/sentry'\n\n// infra adapters validations\nexport * from './infra/adapters/validators/zod/zod-validator'\n\n// infra common env\nexport * from './infra/env'\n","import 'reflect-metadata'\n\nimport DependencyContainer from '../../core/decorators/dependency-container'\nimport ApplicationError from '../../core/errors/application-error'\nimport ConflictError from '../../core/errors/conflict-error'\nimport DomainError from '../../core/errors/domain-error'\nimport InfraError from '../../core/errors/infra-error'\nimport ValidationError from '../../core/errors/validation-error'\nimport { MiddlewareFunction } from '../../infra/adapters/validators/zod/zod-validator'\nimport IErrorNotifier from './error-notifier'\n\nexport type AnyObject = Record<string, any>\n\nexport type Request = {\n body: AnyObject\n params: AnyObject\n headers: AnyObject\n query: AnyObject\n}\n\nexport type Response = {\n code: number\n data: any\n}\n\nexport type ContextError = {\n env: string\n user?: {\n id?: string\n name?: string\n email?: string\n }\n request?: {\n method?: string\n requestId?: string\n url?: string\n headers?: any\n query?: any\n body?: any\n params?: any\n }\n}\n\nexport default abstract class BaseController {\n protected readonly errorNotifier: IErrorNotifier\n\n abstract handle<T>(request: T | Request): Promise<Response>\n\n constructor() {\n this.errorNotifier = DependencyContainer.resolveToken('IErrorNotifier')\n }\n\n protected success<T>(dto?: T): Response {\n return {\n code: 200,\n data: { data: dto },\n }\n }\n\n protected noContent(): Response {\n return {\n code: 204,\n data: undefined,\n }\n }\n\n protected created<T>(dto?: T): Response {\n return {\n code: 201,\n data: dto ? { data: dto } : undefined,\n }\n }\n\n protected paginated<T>(dto?: T): Response {\n return {\n code: 200,\n data: dto,\n }\n }\n\n protected buildContextError(request: Request): ContextError {\n return {\n env: process.env.ENVIRONMENT as string,\n request: {\n body: request.body,\n headers: request.headers,\n params: request.params,\n query: request.query,\n },\n }\n }\n\n public async failure(error: Error, context: ContextError): Promise<Response> {\n if (error instanceof ConflictError) {\n return {\n code: error.props.code,\n data: {\n message: error.message,\n errorCode: error.props.errorCode,\n occurredAt: error.props.occurredAt,\n items: Array.isArray(error.conflictProps)\n ? error.conflictProps\n : [error.conflictProps],\n },\n }\n }\n\n if (\n error instanceof DomainError ||\n error instanceof ApplicationError ||\n error instanceof InfraError\n ) {\n return {\n code: error.props.code,\n data: {\n message: error.message,\n errorCode: error.props.errorCode,\n occurredAt: error.props.occurredAt,\n },\n }\n }\n\n if (error instanceof ValidationError) {\n return {\n code: error.props.code,\n data: {\n message: error.props.message,\n errorCode: error.props.errorCode,\n occurredAt: error.props.occurredAt,\n errors: error.props.errors,\n },\n }\n }\n\n if (process.env.SHOULD_NOTIFY_ERROR) {\n await this.errorNotifier.notify(error, context)\n }\n\n return {\n code: 500,\n data: {\n code: 500,\n message: 'Server failed. Contact the administrator!',\n },\n }\n }\n\n public async execute(request: Request): Promise<Response> {\n const routeMetadata = Reflect.getMetadata('route', this.constructor)\n\n if (!routeMetadata) {\n throw new InfraError('Route metadata not found.')\n }\n\n const middlewares: MiddlewareFunction[] = routeMetadata.middlewares || []\n\n let processedRequest = request\n\n if (middlewares.length) {\n for (const middleware of middlewares) {\n processedRequest = await middleware(processedRequest)\n }\n }\n\n return await this.handle(processedRequest)\n }\n}\n","import 'reflect-metadata'\n\ntype Class<T = any> = new (...args: any[]) => T\n\ntype Registration =\n | { type: 'class'; myClass: Class; singleton: boolean }\n | { type: 'value'; value: any }\n\nexport default class DependencyContainer {\n static registry = new Map<string, Registration>()\n static singletons = new Map<string, any>()\n\n static register<T>(\n token: string,\n myClass: Class<T>,\n options: { singleton: boolean }\n ) {\n this.registry.set(token, {\n type: 'class',\n myClass,\n singleton: options.singleton,\n })\n }\n\n static registerValue<T>(token: string, value: T) {\n this.registry.set(token, { type: 'value', value })\n }\n\n static resolve<T>(target: Class<T>): T {\n const paramTypes = Reflect.getMetadata('design:paramtypes', target) || []\n\n const injectMetadata: Record<number, string> =\n Reflect.getOwnMetadata('inject:params', target) || {}\n\n const params = paramTypes.map((_: any, index: number) => {\n const token = injectMetadata[index]\n\n if (!token) {\n throw new Error(\n `Missing @Inject token for parameter index ${index} in ${target.name}`\n )\n }\n\n return this.resolveToken(token)\n })\n\n return new target(...params)\n }\n\n static resolveToken(token: string): any {\n const registration = this.registry.get(token)\n\n if (!registration) {\n throw new Error(\n `\"${token}\" not registered. Please register it in the container.`\n )\n }\n\n if (registration.type === 'value') {\n return registration.value\n }\n\n const { myClass, singleton } = registration\n\n if (singleton) {\n if (!this.singletons.has(token)) {\n const instance = this.resolve(myClass)\n this.singletons.set(token, instance)\n }\n return this.singletons.get(token)\n }\n\n return this.resolve(myClass)\n }\n}\n\nexport function Inject(token: string): ParameterDecorator {\n return (\n target: object,\n _propertyKey: string | symbol | undefined,\n parameterIndex: number\n ): void => {\n const constructor =\n typeof target === 'function' ? target : target.constructor\n\n const existingInjectedParams: Record<number, string> =\n Reflect.getOwnMetadata('inject:params', constructor) || {}\n\n existingInjectedParams[parameterIndex] = token\n\n Reflect.defineMetadata('inject:params', existingInjectedParams, constructor)\n }\n}\n","export type PropertiesError = {\n receivedValue?: any\n type: string\n message: string\n property: string | number | undefined\n propertyType?: string\n path?: string\n}\n\nexport type CommonError = {\n location: string\n propertyErrors?: PropertiesError[]\n}\n\nexport type ApiCommonError = {\n code: number\n occurredAt: Date\n message: string\n errorCode: string\n errors?: CommonError[]\n}\n\nexport enum ApiErrorEnum {\n DOMAIN = 'ERR001',\n APPLICATION = 'ERR002',\n INFRA = 'ERR003',\n HTTP_CLIENT = 'ERR004',\n VALIDATOR = 'ERR005',\n}\n","import { type ApiCommonError, ApiErrorEnum } from './api-common-error'\n\nexport default class ApplicationError extends Error {\n props: ApiCommonError\n\n constructor(message: string) {\n super(message)\n this.props = {\n code: 400,\n errorCode: ApiErrorEnum.APPLICATION,\n message,\n occurredAt: new Date(),\n }\n }\n}\n","import { type ApiCommonError, ApiErrorEnum } from './api-common-error'\n\ntype ConflictProps = { id: string; [key: string]: unknown }\n\nexport default class ConflictError<T extends ConflictProps> extends Error {\n props: ApiCommonError\n conflictProps: T | T[]\n\n constructor(conflictProps: T | T[]) {\n super('Resource already exists.')\n this.conflictProps = conflictProps\n this.props = {\n code: 409,\n errorCode: ApiErrorEnum.APPLICATION,\n message: this.message,\n occurredAt: new Date(),\n }\n }\n}\n","import { type ApiCommonError, ApiErrorEnum } from './api-common-error'\n\nexport default class DomainError extends Error {\n props: ApiCommonError\n\n constructor(message: string) {\n super(message)\n this.props = {\n code: 400,\n errorCode: ApiErrorEnum.DOMAIN,\n message,\n occurredAt: new Date(),\n }\n }\n}\n","import { type ApiCommonError, ApiErrorEnum } from './api-common-error'\n\nexport default class InfraError extends Error {\n props: ApiCommonError\n\n constructor(message: string) {\n super(message)\n this.props = {\n code: 400,\n errorCode: ApiErrorEnum.INFRA,\n message,\n occurredAt: new Date(),\n }\n }\n}\n","import {\n type ApiCommonError,\n ApiErrorEnum,\n type CommonError,\n} from './api-common-error'\n\nexport default class ValidationError extends Error {\n props: ApiCommonError\n\n constructor(errors: CommonError[]) {\n super('Validation Error')\n this.props = {\n code: 400,\n errorCode: ApiErrorEnum.VALIDATOR,\n message: 'Validation Error',\n occurredAt: new Date(),\n errors,\n }\n }\n}\n","import { MiddlewareFunction } from '../../infra/adapters/validators/zod/zod-validator'\nimport BaseController from '../http/base-controller'\nimport type { MethodType } from '../http/http'\n\ntype Props = {\n method: MethodType\n path: string\n middlewares?: MiddlewareFunction[]\n}\n\nexport function Controller({\n method,\n path,\n middlewares = [],\n}: Props): ClassDecorator {\n return (target: any) => {\n if (!(target.prototype instanceof BaseController)) {\n throw new Error(\n `The class ${target.name} should extends abstract class BaseController`\n )\n }\n\n Reflect.defineMetadata(\n 'route',\n { method, path: `/api/${path}`, middlewares },\n target\n )\n }\n}\n","import { randomUUID } from 'node:crypto'\n\nexport class UniqueEntityId {\n private value: string\n\n constructor(value?: string) {\n this.value = value ?? randomUUID()\n }\n\n toString() {\n return this.value\n }\n\n toValue() {\n return this.value\n }\n\n public equals(id: UniqueEntityId) {\n return id.toValue() === this.toValue()\n }\n}\n","import { CommonDTO } from './common-dto'\nimport { UniqueEntityId } from './unique-entity-id'\n\nexport abstract class Entity<Props extends CommonDTO> {\n private _id: UniqueEntityId\n protected props: Props\n\n get id() {\n return this._id\n }\n\n set id(id: UniqueEntityId) {\n this._id = id\n }\n\n get createdAt() {\n return this.props.createdAt\n }\n\n set createdAt(date: Date) {\n this.props.createdAt = date\n }\n\n get updatedAt(): Date | undefined | null {\n return this.props.updatedAt\n }\n\n public touch() {\n this.props.updatedAt = new Date()\n }\n\n protected constructor(props: Props, id?: UniqueEntityId) {\n this._id = id ?? new UniqueEntityId(id)\n this.props = props\n }\n\n public equals(entity: Entity<any>) {\n if (entity === this) {\n return true\n }\n\n if (entity.id === this._id) {\n return true\n }\n\n return false\n }\n}\n","import { CommonDTO } from './common-dto'\nimport { Entity } from './entity'\n\nexport abstract class AggregateRoot<\n Props extends CommonDTO,\n> extends Entity<Props> {}\n","export abstract class ValueObject<Props> {\n protected props: Props\n\n protected constructor(props: Props) {\n this.props = props\n }\n}\n","export abstract class WatchedList<T> {\n public currentItems: T[]\n private initial: T[]\n private new: T[]\n private removed: T[]\n private updated: T[]\n\n constructor(initialItems?: T[]) {\n this.currentItems = initialItems || []\n this.initial = initialItems || []\n this.new = []\n this.removed = []\n this.updated = []\n }\n\n abstract compareItems(a: T, b: T): boolean\n\n public getItems(): T[] {\n return this.currentItems\n }\n\n public getNewItems(): T[] {\n return this.new\n }\n\n public getRemovedItems(): T[] {\n return this.removed\n }\n\n public getUpdatedItems(): T[] {\n return this.updated\n }\n\n public addUpdatedItem(item: T) {\n return this.updated.push(item)\n }\n\n private isCurrentItem(item: T): boolean {\n return (\n this.currentItems.filter((v: T) => this.compareItems(item, v)).length !==\n 0\n )\n }\n\n private isNewItem(item: T): boolean {\n return this.new.filter((v: T) => this.compareItems(item, v)).length !== 0\n }\n\n private isRemovedItem(item: T): boolean {\n return (\n this.removed.filter((v: T) => this.compareItems(item, v)).length !== 0\n )\n }\n\n private removeFromNew(item: T): void {\n this.new = this.new.filter((v) => !this.compareItems(v, item))\n }\n\n private removeFromCurrent(item: T): void {\n this.currentItems = this.currentItems.filter(\n (v) => !this.compareItems(item, v)\n )\n }\n\n private removeFromRemoved(item: T): void {\n this.removed = this.removed.filter((v) => !this.compareItems(item, v))\n }\n\n private wasAddedInitially(item: T): boolean {\n return (\n this.initial.filter((v: T) => this.compareItems(item, v)).length !== 0\n )\n }\n\n public exists(item: T): boolean {\n return this.isCurrentItem(item)\n }\n\n public add(item: T): void {\n if (this.isRemovedItem(item)) {\n this.removeFromRemoved(item)\n }\n\n if (!this.isNewItem(item) && !this.wasAddedInitially(item)) {\n this.new.push(item)\n }\n\n if (!this.isCurrentItem(item)) {\n this.currentItems.push(item)\n }\n }\n\n public remove(item: T): void {\n this.removeFromCurrent(item)\n\n if (this.isNewItem(item)) {\n this.removeFromNew(item)\n\n return\n }\n\n if (!this.isRemovedItem(item)) {\n this.removed.push(item)\n }\n }\n\n public update(items: T[]): void {\n const newItems = items.filter((a) => {\n return !this.getItems().some((b) => this.compareItems(a, b))\n })\n\n const removedItems = this.getItems().filter((a) => {\n return !items.some((b) => this.compareItems(a, b))\n })\n\n const updatedItems = items.filter(\n (item) =>\n !newItems.some(\n (a) =>\n this.compareItems(item, a) &&\n !removedItems.some((b) => this.compareItems(item, b))\n )\n )\n\n this.currentItems = items\n this.new = newItems\n this.removed = removedItems\n this.updated = updatedItems\n }\n}\n","export function getTakeAndSkip(size: string, page: string) {\n const take = size ? Number(size) : 20\n const skip = page ? Number(page) : 1\n\n return { take, skip }\n}\n","import cors from 'cors'\nimport express, { Express, Request, Response } from 'express'\n\nimport type BaseController from '../../../core/http/base-controller'\nimport type IHttp from '../../../core/http/http'\nimport { ErrorResponseCode } from './response-error-code'\nimport { validateControllerMetadata } from './validate-controller-metadata'\n\nexport default class ExpressAdapter implements IHttp {\n readonly instance: Express\n private server: any\n\n constructor(readonly env: Record<string, any>) {\n this.instance = express()\n this.instance.use(cors())\n this.instance.use(express.json({ limit: '10mb' }))\n this.instance.use(express.urlencoded({ limit: '10mb', extended: false }))\n this.instance.disable('x-powered-by')\n }\n\n registerRoute(controllerClass: BaseController): void {\n const { metadata } = validateControllerMetadata(controllerClass)\n\n this.instance[metadata.method](\n metadata.path,\n async (request: Request, response: Response) => {\n const requestData = {\n body: request.body,\n params: request.params,\n headers: request.headers,\n query: request.query,\n }\n\n try {\n const output = await controllerClass.execute(requestData)\n response\n .status(output.code || 204)\n .json(output.data || { code: ErrorResponseCode.NO_CONTENT_BODY })\n } catch (err: any) {\n const error = await controllerClass.failure(err, {\n env: this.env.ENVIRONMENT,\n request: {\n body: requestData.body,\n headers: requestData.headers,\n params: request.params,\n query: requestData.query,\n url: metadata.path,\n method: metadata.method,\n },\n })\n response.status(error.code).json(\n error.data || {\n error: ErrorResponseCode.NO_CONTENT_ERROR,\n }\n )\n }\n }\n )\n }\n\n async startServer(port: number): Promise<void> {\n return new Promise((resolve) => {\n this.server = this.instance.listen(port, () => {\n console.log(`🚀 Server is running on PORT ${port}`)\n resolve()\n })\n })\n }\n\n async closeServer(): Promise<void> {\n return new Promise((resolve, reject) => {\n if (this.server) {\n this.server.close((err: any) => {\n if (err) return reject(err)\n resolve()\n })\n } else {\n resolve()\n }\n })\n }\n}\n","import 'reflect-metadata'\n\nimport type Controller from '../../../core/http/base-controller'\nimport type { MethodType } from '../../../core/http/http'\n\nexport function validateControllerMetadata(controller: Controller) {\n const metadata = Reflect.getMetadata('route', controller.constructor) as {\n method: MethodType\n path: string\n }\n\n if (!metadata) {\n throw new Error(\n `Controller ${controller.constructor.name} not have metadata. Need to add decorator.`\n )\n }\n\n return {\n metadata,\n }\n}\n","import cors from '@fastify/cors'\nimport type IHttp from 'core/http/http'\nimport fastify, { FastifyInstance, FastifyReply, FastifyRequest } from 'fastify'\nimport qs from 'qs'\n\nimport BaseController, { Request } from '../../../core/http/base-controller'\nimport { ErrorResponseCode } from './response-error-code'\nimport { validateControllerMetadata } from './validate-controller-metadata'\n\nexport default class FastifyAdapter implements IHttp {\n readonly instance: FastifyInstance\n\n constructor(readonly env: Record<string, any>) {\n this.instance = fastify({\n bodyLimit: 10 * 1024 * 1024,\n querystringParser: (str) => qs.parse(str),\n })\n\n this.instance.register(cors)\n }\n\n registerRoute(controllerClass: BaseController): void {\n const { metadata } = validateControllerMetadata(controllerClass)\n\n this.instance[metadata.method](\n metadata.path,\n async (request: FastifyRequest, reply: FastifyReply) => {\n const requestData = {\n body: request.body,\n params: request.params,\n headers: request.headers,\n query: request.query,\n } as Request\n\n try {\n const output = await controllerClass.execute(requestData)\n return reply.status(output.code || 200).send(\n output.data || {\n code: ErrorResponseCode.NO_CONTENT_BODY,\n }\n )\n } catch (err: any) {\n const error = await controllerClass.failure(err, {\n env: this.env.ENVIRONMENT,\n request: {\n body: requestData.body,\n headers: requestData.headers,\n params: request.params,\n query: requestData.query,\n url: metadata.path,\n method: metadata.method,\n },\n })\n return reply.status(error.code || 200).send(\n error.data || {\n code: ErrorResponseCode.NO_CONTENT_ERROR,\n }\n )\n }\n }\n )\n }\n\n async startServer(port: number): Promise<void> {\n await this.instance.listen({ port })\n\n if (this.env.NODE_ENV !== 'test') {\n console.log(`🚀 Server is running on PORT ${port}`)\n }\n }\n\n async closeServer() {\n await this.instance.close()\n }\n}\n","import { Inject } from 'core/decorators/dependency-container'\nimport { MessageBuilder, Webhook } from 'discord-webhook-node'\n\nimport type { ContextError } from '../../../core/http/base-controller'\nimport type IErrorNotifier from '../../../core/http/error-notifier'\n\ntype DiscordOptions = {\n url: string\n env: string\n}\n\nexport default class DiscordNotifier implements IErrorNotifier {\n private webhook: Webhook\n\n constructor(\n @Inject('DiscordConfig') private readonly options: DiscordOptions\n ) {\n this.webhook = new Webhook(this.options.url)\n }\n\n async notify(error: Error, context: ContextError): Promise<void> {\n const embed = new MessageBuilder()\n .setTitle('🚨 Error')\n .addField('Message', `\\`\\`\\`${error.message.slice(0, 300)}\\`\\`\\``)\n .addField(\n 'Route:',\n `\\`[${context?.request?.method}] ${context?.request?.url}\\``,\n true\n )\n .addField(\n 'Params:',\n '```json\\n' +\n JSON.stringify(context?.request?.params, null, 2) +\n '\\n```',\n true\n )\n .addField(\n 'Query:',\n '```json\\n' +\n JSON.stringify(context?.request?.query, null, 2) +\n '\\n```',\n true\n )\n .addField(\n 'Headers:',\n '```json\\n' +\n JSON.stringify(context?.request?.headers, null, 2) +\n '\\n```',\n true\n )\n .addField(\n 'Body:',\n '```json\\n' + JSON.stringify(context?.request?.body, null, 2) + '\\n```'\n )\n .addField(\n 'Stack Trace:',\n '```' + (error.stack || 'No stack provided').slice(0, 900) + '```'\n )\n .setFooter(`Env: ${this.options.env || 'development'}`)\n .setTimestamp()\n\n await this.webhook.send(embed)\n }\n}\n","import * as Sentry from '@sentry/node'\nimport type { ContextError } from 'core/http/base-controller'\n\nimport { Inject } from '../../../core/decorators/dependency-container'\nimport IErrorNotifier from '../../../core/http/error-notifier'\n\ntype SentryOptions = {\n dsn: string\n environment: string\n}\n\nexport class SentryNotifier implements IErrorNotifier {\n constructor(@Inject('SentryConfig') private readonly options: SentryOptions) {\n Sentry.init({\n dsn: this.options.dsn,\n environment: this.options.environment,\n attachStacktrace: true,\n tracesSampleRate: this.options.environment === 'production' ? 0.1 : 1.0,\n maxBreadcrumbs: 100,\n debug: this.options.environment !== 'production',\n })\n }\n\n async notify(error: Error, context: ContextError): Promise<void> {\n Sentry.withScope((scope) => {\n scope.setLevel('error')\n\n if (context?.env) scope.setTag('env', context.env)\n\n if (context?.user) {\n scope.setUser({\n id: context.user.id,\n username: context.user.name,\n email: context.user.email,\n })\n }\n\n if (context?.request) {\n const { body, query, params, headers, method, url, requestId } =\n context.request\n\n scope.setContext('http', {\n method,\n requestId,\n url,\n headers,\n query,\n body,\n params,\n })\n }\n\n Sentry.captureException(error)\n })\n }\n}\n","import type { ZodIssue } from 'zod'\n\nimport type {\n CommonError,\n PropertiesError,\n} from '../../../../core/errors/api-common-error'\n\ntype ZodError = ZodIssue & {\n expected: string\n received: string\n}\n\ntype ZodInvalidUnion = ZodError & {\n code: 'invalid_union'\n}\n\nexport default class ZodMapError {\n private static mapCommon(error: ZodError): PropertiesError {\n return {\n type: error.code,\n path: error.path.join('.'),\n property: error.path.pop(),\n propertyType: error.expected,\n receivedValue: error.received,\n message: error.message,\n }\n }\n\n private static mapInvalidUnion(error: ZodInvalidUnion): PropertiesError[] {\n const [errors] = error.unionErrors\n .flat()\n .map((err) => err.issues.map((item: any) => this.mapCommon(item)))\n\n return errors\n }\n\n private static mapInvalidType(error: ZodError): PropertiesError[] {\n return [this.mapCommon(error)]\n }\n\n private static mapErrorsFactory(error: ZodError): PropertiesError[] {\n if (error.code === 'invalid_union') {\n return this.mapInvalidUnion(error)\n }\n\n return this.mapInvalidType(error)\n }\n\n static mapErrors(errors: ZodIssue[][]) {\n const standardizedErrors = new Map<string | number, CommonError>()\n\n errors.flat().forEach((error) => {\n const keyError = standardizedErrors.get(error.path[0])\n\n if (keyError) {\n if (!keyError.propertyErrors) {\n keyError.propertyErrors = []\n }\n\n keyError.propertyErrors.push(\n ...this.mapErrorsFactory(error as ZodError)\n )\n\n return\n }\n\n standardizedErrors.set(error.path[0], {\n location: error.path[0],\n propertyErrors: Array.from([\n ...this.mapErrorsFactory(error as ZodError),\n ]),\n } as CommonError)\n })\n\n return Array.from(standardizedErrors, ([, arr]) => ({\n ...arr,\n })).flat()\n }\n}\n","import { ZodEffects, type ZodError, ZodObject } from 'zod'\n\nimport ValidationError from '../../../../core/errors/validation-error'\nimport IValidationHTTP, { RequestHttp } from '../../../../core/http/validator'\nimport ZodMapError from './zod-map-error'\nimport { zodValidator } from './zod-validator'\n\ntype SchemaDefinition = {\n headers: ZodObject<Record<string, any>>\n params: ZodObject<Record<string, any>>\n query: ZodObject<Record<string, any>>\n body:\n | ZodObject<Record<string, any>>\n | ZodEffects<ZodObject<Record<string, any>>>\n}\n\ntype ZodSchemaObject = ZodObject<SchemaDefinition>\n\nexport default class ZodValidator implements IValidationHTTP {\n constructor(private zodSchema: ZodSchemaObject) {}\n\n async validate<T>(requestHttp: RequestHttp): Promise<T> {\n const errors = []\n\n const {\n data: headersData = {},\n error: headersErrors = {} as ZodError<{ errors: ZodError[] }>,\n } = requestHttp.headers\n ? await this.zodSchema.shape.headers.safeParseAsync(requestHttp.headers, {\n path: ['headers'],\n })\n : {}\n\n if (headersErrors?.errors) {\n errors.push(headersErrors?.errors)\n }\n\n const {\n data: paramsData = {},\n error: paramsErrors = {} as ZodError<{ errors: ZodError[] }>,\n } = requestHttp.params\n ? await this.zodSchema.shape.params.safeParseAsync(requestHttp.params, {\n path: ['params'],\n })\n : {}\n\n if (paramsErrors?.errors) {\n errors.push(paramsErrors?.errors)\n }\n\n const {\n data: queryData = {},\n error: queryErrors = {} as ZodError<{ errors: ZodError[] }>,\n } = requestHttp.query\n ? await this.zodSchema.shape.query.safeParseAsync(requestHttp.query, {\n path: ['query'],\n })\n : {}\n\n if (queryErrors?.errors) {\n errors.push(queryErrors?.errors)\n }\n\n const {\n data: bodyData = {},\n error: bodyErrors = {} as ZodError<{ errors: ZodError[] }>,\n } = requestHttp.body\n ? await this.zodSchema.shape.body.safeParseAsync(requestHttp.body, {\n path: ['body'],\n })\n : {}\n\n if (bodyErrors?.errors) {\n errors.push(bodyErrors?.errors)\n }\n\n if (errors.length) {\n throw new ValidationError(ZodMapError.mapErrors(errors))\n }\n\n return {\n body: bodyData,\n headers: headersData,\n params: paramsData,\n query: queryData,\n } as T\n }\n}\n\nexport { zodValidator }\n","import { z } from 'zod'\n\nimport { Request } from '../../../../core/http/base-controller'\nimport ZodValidator from './index'\n\nexport type ZodSchema = z.ZodObject<{\n headers: z.ZodObject<Record<string, any>>\n params: z.ZodObject<Record<string, any>>\n query: z.ZodObject<Record<string, any>>\n body:\n | z.ZodObject<Record<string, any>>\n | z.ZodEffects<z.ZodObject<Record<string, any>>>\n}>\n\nexport type MiddlewareFunction = (request: Request) => Promise<Request>\n\nexport function zodValidator(schema: ZodSchema): MiddlewareFunction {\n return async (request: Request): Promise<Request> => {\n const validator = new ZodValidator(schema)\n const validatedRequest = await validator.validate<Request>(request)\n return validatedRequest\n }\n}\n","(function () {\n require('./lib/main').config(\n Object.assign(\n {},\n require('./lib/env-options'),\n require('./lib/cli-options')(process.argv)\n )\n )\n})()\n","import 'dotenv/config'\n\nimport { z } from 'zod'\n\nexport const baseEnvSchema = z.object({\n NODE_ENV: z.enum(['test', 'development', 'production']).default('production'),\n ENVIRONMENT: z\n .enum(['test', 'development', 'staging', 'production'])\n .default('development'),\n PORT: z.coerce.number().default(3333),\n SHOULD_NOTIFY_ERROR: z.coerce.boolean().default(true),\n SENTRY_DSN: z.string().optional(),\n DISCORD_WEBHOOK_URL: z.string().optional(),\n})\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA,8CAAAA,SAAA;AAAA,IAAAA,QAAA;AAAA,MACE,MAAQ;AAAA,MACR,SAAW;AAAA,MACX,aAAe;AA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BC,qBAAqBd,aAAEY,OAAM,EAAGC,SAAQ;AAC1C,CAAA;","names":["module","module","fs","require","path","os","crypto","packageJson","version","LINE","parse","src","obj","lines","toString","replace","match","exec","key","value","trim","maybeQuote","_parseVault","options","vaultPath","_vaultPath","result","DotenvModule","configDotenv","parsed","err","Error","code","keys","_dotenvKey","split","length","decrypted","i","attrs","_instructions","decrypt","ciphertext","error","_warn","message","console","log","_debug","DOTENV_KEY","process","env","dotenvKey","uri","URL","password","environment","searchParams","get","environmentKey","toUpperCase","possibleVaultPath","Array","isArray","filepath","existsSync","endsWith","resolve","cwd","_resolveHome","envPath","join","homedir","slice","_configVault","debug","Boolean","processEnv","populate","dotenvPath","encoding","optionPaths","push","lastError","parsedAll","readFileSync","e","config","encrypted","keyStr","Buffer","from","nonce","subarray","authTag","aesgcm","createDecipheriv","setAuthTag","update","final","isRange","RangeError","invalidKeyLength","decryptionFailed","override","Object","prototype","hasOwnProperty","call","exports","module","options","process","env","DOTENV_CONFIG_ENCODING","encoding","DOTENV_CONFIG_PATH","path","DOTENV_CONFIG_DEBUG","debug","DOTENV_CONFIG_OVERRIDE","override","DOTENV_CONFIG_DOTENV_KEY","DOTENV_KEY","exports","module","re","exports","optionMatcher","args","reduce","acc","cur","matches","match","import_reflect_metadata","DependencyContainer","registry","Map","singletons","register","token","myClass","options","set","type","singleton","registerValue","value","resolve","target","paramTypes","Reflect","getMetadata","injectMetadata","getOwnMetadata","params","map","_","index","Error","name","resolveToken","registration","get","has","instance","Inject","_propertyKey","parameterIndex","constructor","existingInjectedParams","defineMetadata","ApiErrorEnum","ApplicationError","Error","props","constructor","message","code","errorCode","ApiErrorEnum","APPLICATION","occurredAt","Date","ConflictError","Error","props","conflictProps","constructor","code","errorCode","ApiErrorEnum","APPLICATION","message","occurredAt","Date","DomainError","Error","props","constructor","message","code","errorCode","ApiErrorEnum","DOMAIN","occurredAt","Date","InfraError","Error","props","constructor","message","code","errorCode","ApiErrorEnum","INFRA","occurredAt","Date","ValidationError","Error","props","constructor","errors","code","errorCode","ApiErrorEnum","VALIDATOR","message","occurredAt","Date","BaseController","errorNotifier","constructor","DependencyContainer","resolveToken","success","dto","code","data","noContent","undefined","created","paginated","buildContextError","request","env","process","ENVIRONMENT","body","headers","params","query","failure","error","context","ConflictError","props","message","errorCode","occurredAt","items","Array","isArray","conflictProps","DomainError","ApplicationError","InfraError","ValidationError","errors","SHOULD_NOTIFY_ERROR","notify","execute","routeMetadata","Reflect","getMetadata","middlewares","processedRequest","length","middleware","handle","Controller","method","path","middlewares","target","prototype","BaseController","Error","name","Reflect","defineMetadata","UniqueEntityId","value","constructor","randomUUID","toString","toValue","equals","id","Entity","_id","props","id","createdAt","date","updatedAt","touch","Date","UniqueEntityId","equals","entity","AggregateRoot","Entity","ValueObject","props","WatchedList","currentItems","initial","new","removed","updated","constructor","initialItems","getItems","getNewItems","getRemovedItems","getUpdatedItems","addUpdatedItem","item","push","isCurrentItem","filter","v","compareItems","length","isNewItem","isRemovedItem","removeFromNew","removeFromCurrent","removeFromRemoved","wasAddedInitially","exists","add","remove","update","items","newItems","a","some","b","removedItems","updatedItems","getTakeAndSkip","size","page","take","Number","skip","import_reflect_metadata","import_cors","DiscordNotifier","webhook","constructor","options","Webhook","url","notify","error","context","embed","MessageBuilder","setTitle","addField","message","slice","request","method","JSON","stringify","params","query","headers","body","stack","setFooter","env","setTimestamp","send","SentryNotifier","constructor","options","Sentry","init","dsn","environment","attachStacktrace","tracesSampleRate","maxBreadcrumbs","debug","notify","error","context","withScope","scope","setLevel","env","setTag","user","setUser","id","username","name","email","request","body","query","params","headers","method","url","requestId","setContext","captureException","ZodMapError","mapCommon","error","type","code","path","join","property","pop","propertyType","expected","receivedValue","received","message","mapInvalidUnion","errors","unionErrors","flat","map","err","issues","item","mapInvalidType","mapErrorsFactory","mapErrors","standardizedErrors","Map","forEach","keyError","get","propertyErrors","push","set","location","Array","from","arr","ZodValidator","constructor","zodSchema","validate","requestHttp","errors","data","headersData","error","headersErrors","headers","shape","safeParseAsync","path","push","paramsData","paramsErrors","params","queryData","queryErrors","query","bodyData","bodyErrors","body","length","ValidationError","ZodMapError","mapErrors","zodValidator","schema","request","validator","ZodValidator","validatedRequest","validate","require","config","Object","assign","process","argv","baseEnvSchema","z","object","NODE_ENV","enum","default","ENVIRONMENT","PORT","coerce","number","SHOULD_NOTIFY_ERROR","boolean","SENTRY_DSN","string","optional","DISCORD_WEBHOOK_URL"]}
|
package/dist/index.d.cts
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
export { Controller } from './core/decorators/controller-http-decorator.cjs';
|
|
2
|
+
export { Inject } from './core/decorators/dependency-container.cjs';
|
|
3
|
+
export { AggregateRoot } from './core/entities/aggregate-root.cjs';
|
|
4
|
+
export { CommonDTO, CreateCommonDTO } from './core/entities/common-dto.cjs';
|
|
5
|
+
export { Entity } from './core/entities/entity.cjs';
|
|
6
|
+
export { Optional } from './core/entities/optional.cjs';
|
|
7
|
+
export { UniqueEntityId } from './core/entities/unique-entity-id.cjs';
|
|
8
|
+
export { ValueObject } from './core/entities/value-object.cjs';
|
|
9
|
+
export { WatchedList } from './core/entities/watched-list.cjs';
|
|
10
|
+
export { A as AnyObject, C as ContextError, R as Request, a as Response } from './base-controller-cec5714c.js';
|
|
11
|
+
export { DtoResponsePagination } from './core/http/dto-response.cjs';
|
|
12
|
+
export { getTakeAndSkip } from './core/http/get-take-and-skip.cjs';
|
|
13
|
+
export { ICheckDB, IHealthCheck } from './core/http/health-connections.cjs';
|
|
14
|
+
export { NotPagination, Pagination } from './core/http/pagination.cjs';
|
|
15
|
+
export { RequestHttp } from './core/http/validator.cjs';
|
|
16
|
+
export { SentryNotifier } from './infra/adapters/notifications/sentry.cjs';
|
|
17
|
+
export { MiddlewareFunction, ZodSchema, zodValidator } from './infra/adapters/validators/zod/zod-validator.cjs';
|
|
18
|
+
export { baseEnvSchema } from './infra/env/index.cjs';
|
|
19
|
+
import './core/http/http.cjs';
|
|
20
|
+
import 'zod';
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
export { Controller } from './core/decorators/controller-http-decorator.js';
|
|
2
|
+
export { Inject } from './core/decorators/dependency-container.js';
|
|
3
|
+
export { AggregateRoot } from './core/entities/aggregate-root.js';
|
|
4
|
+
export { CommonDTO, CreateCommonDTO } from './core/entities/common-dto.js';
|
|
5
|
+
export { Entity } from './core/entities/entity.js';
|
|
6
|
+
export { Optional } from './core/entities/optional.js';
|
|
7
|
+
export { UniqueEntityId } from './core/entities/unique-entity-id.js';
|
|
8
|
+
export { ValueObject } from './core/entities/value-object.js';
|
|
9
|
+
export { WatchedList } from './core/entities/watched-list.js';
|
|
10
|
+
export { A as AnyObject, C as ContextError, R as Request, a as Response } from './base-controller-cec5714c.js';
|
|
11
|
+
export { DtoResponsePagination } from './core/http/dto-response.js';
|
|
12
|
+
export { getTakeAndSkip } from './core/http/get-take-and-skip.js';
|
|
13
|
+
export { ICheckDB, IHealthCheck } from './core/http/health-connections.js';
|
|
14
|
+
export { NotPagination, Pagination } from './core/http/pagination.js';
|
|
15
|
+
export { RequestHttp } from './core/http/validator.js';
|
|
16
|
+
export { SentryNotifier } from './infra/adapters/notifications/sentry.js';
|
|
17
|
+
export { MiddlewareFunction, ZodSchema, zodValidator } from './infra/adapters/validators/zod/zod-validator.js';
|
|
18
|
+
export { baseEnvSchema } from './infra/env/index.js';
|
|
19
|
+
import './core/http/http.js';
|
|
20
|
+
import 'zod';
|