@senhainfo/shared-utils 1.0.1
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/lib/app-log.d.ts +16 -0
- package/lib/app-log.d.ts.map +1 -0
- package/lib/app-log.js +47 -0
- package/lib/app-log.js.map +1 -0
- package/lib/exceptions/app-exception.d.ts +21 -0
- package/lib/exceptions/app-exception.d.ts.map +1 -0
- package/lib/exceptions/app-exception.js +27 -0
- package/lib/exceptions/app-exception.js.map +1 -0
- package/lib/exceptions/forbidden.d.ts +5 -0
- package/lib/exceptions/forbidden.d.ts.map +1 -0
- package/lib/exceptions/forbidden.js +12 -0
- package/lib/exceptions/forbidden.js.map +1 -0
- package/lib/exceptions/inactive.d.ts +5 -0
- package/lib/exceptions/inactive.d.ts.map +1 -0
- package/lib/exceptions/inactive.js +12 -0
- package/lib/exceptions/inactive.js.map +1 -0
- package/lib/exceptions/index.d.ts +9 -0
- package/lib/exceptions/index.d.ts.map +1 -0
- package/lib/exceptions/index.js +25 -0
- package/lib/exceptions/index.js.map +1 -0
- package/lib/exceptions/invalid-credentials.d.ts +5 -0
- package/lib/exceptions/invalid-credentials.d.ts.map +1 -0
- package/lib/exceptions/invalid-credentials.js +11 -0
- package/lib/exceptions/invalid-credentials.js.map +1 -0
- package/lib/exceptions/invalid-token.d.ts +5 -0
- package/lib/exceptions/invalid-token.d.ts.map +1 -0
- package/lib/exceptions/invalid-token.js +12 -0
- package/lib/exceptions/invalid-token.js.map +1 -0
- package/lib/exceptions/missing-token.d.ts +5 -0
- package/lib/exceptions/missing-token.d.ts.map +1 -0
- package/lib/exceptions/missing-token.js +12 -0
- package/lib/exceptions/missing-token.js.map +1 -0
- package/lib/exceptions/not-found.d.ts +5 -0
- package/lib/exceptions/not-found.d.ts.map +1 -0
- package/lib/exceptions/not-found.js +12 -0
- package/lib/exceptions/not-found.js.map +1 -0
- package/lib/exceptions/unauthorized-exception.d.ts +5 -0
- package/lib/exceptions/unauthorized-exception.d.ts.map +1 -0
- package/lib/exceptions/unauthorized-exception.js +12 -0
- package/lib/exceptions/unauthorized-exception.js.map +1 -0
- package/lib/execute-promise.d.ts +3 -0
- package/lib/execute-promise.d.ts.map +1 -0
- package/lib/execute-promise.js +33 -0
- package/lib/execute-promise.js.map +1 -0
- package/lib/format-case.d.ts +6 -0
- package/lib/format-case.d.ts.map +1 -0
- package/lib/format-case.js +32 -0
- package/lib/format-case.js.map +1 -0
- package/lib/format-text.d.ts +8 -0
- package/lib/format-text.d.ts.map +1 -0
- package/lib/format-text.js +97 -0
- package/lib/format-text.js.map +1 -0
- package/lib/get-ip-address.d.ts +5 -0
- package/lib/get-ip-address.d.ts.map +1 -0
- package/lib/get-ip-address.js +35 -0
- package/lib/get-ip-address.js.map +1 -0
- package/lib/http-status-enum.d.ts +51 -0
- package/lib/http-status-enum.d.ts.map +1 -0
- package/lib/http-status-enum.js +55 -0
- package/lib/http-status-enum.js.map +1 -0
- package/lib/index.d.ts +9 -0
- package/lib/index.d.ts.map +1 -0
- package/lib/index.js +48 -0
- package/lib/index.js.map +1 -0
- package/lib/xor-encrypt.d.ts +7 -0
- package/lib/xor-encrypt.d.ts.map +1 -0
- package/lib/xor-encrypt.js +16 -0
- package/lib/xor-encrypt.js.map +1 -0
- package/package.json +25 -0
package/lib/app-log.d.ts
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
interface AppLogOptions {
|
|
2
|
+
logPath: string;
|
|
3
|
+
}
|
|
4
|
+
interface LogFileProps {
|
|
5
|
+
file: string;
|
|
6
|
+
message: string;
|
|
7
|
+
error?: string;
|
|
8
|
+
query?: string;
|
|
9
|
+
}
|
|
10
|
+
export declare class AppLog {
|
|
11
|
+
private options;
|
|
12
|
+
constructor(options?: AppLogOptions);
|
|
13
|
+
save({ file, message, error, query }: LogFileProps): Promise<void>;
|
|
14
|
+
}
|
|
15
|
+
export {};
|
|
16
|
+
//# sourceMappingURL=app-log.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"app-log.d.ts","sourceRoot":"","sources":["../src/app-log.ts"],"names":[],"mappings":"AAIA,UAAU,aAAa;IACrB,OAAO,EAAE,MAAM,CAAC;CACjB;AAED,UAAU,YAAY;IACpB,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;IAChB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED,qBAAa,MAAM;IACjB,OAAO,CAAC,OAAO,CAEb;gBAEU,OAAO,CAAC,EAAE,aAAa;IAM5B,IAAI,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,EAAE,YAAY,GAAG,OAAO,CAAC,IAAI,CAAC;CAiC1E"}
|
package/lib/app-log.js
ADDED
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.AppLog = void 0;
|
|
7
|
+
const date_fns_1 = require("date-fns");
|
|
8
|
+
const node_fs_1 = __importDefault(require("node:fs"));
|
|
9
|
+
const node_path_1 = __importDefault(require("node:path"));
|
|
10
|
+
class AppLog {
|
|
11
|
+
constructor(options) {
|
|
12
|
+
this.options = {
|
|
13
|
+
logPath: node_path_1.default.resolve("api_logs"),
|
|
14
|
+
};
|
|
15
|
+
if (options) {
|
|
16
|
+
Object.assign(this.options, options);
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
save({ file, message, error, query }) {
|
|
20
|
+
return new Promise((resolve, reject) => {
|
|
21
|
+
const date = (0, date_fns_1.format)(new Date(), "dd/MM/yyyy HH:mm:ss");
|
|
22
|
+
const currentTime = new Date().getTime();
|
|
23
|
+
const logPath = this.options.logPath;
|
|
24
|
+
if (!node_fs_1.default.existsSync(logPath)) {
|
|
25
|
+
node_fs_1.default.mkdirSync(logPath);
|
|
26
|
+
}
|
|
27
|
+
const filename = node_path_1.default.resolve(logPath, `${currentTime}-${file}.txt`);
|
|
28
|
+
let data = `Error on file ${file} - ${date}`;
|
|
29
|
+
data += `\n\nMessage: ${message}`;
|
|
30
|
+
if (error) {
|
|
31
|
+
data += `\nError: ${error}`;
|
|
32
|
+
}
|
|
33
|
+
if (query) {
|
|
34
|
+
data += `\n\n${query.replace(/^ {6}/gm, "").replace(/\t\t/g, "\t").trim()}`;
|
|
35
|
+
}
|
|
36
|
+
try {
|
|
37
|
+
node_fs_1.default.writeFileSync(filename, data);
|
|
38
|
+
}
|
|
39
|
+
catch (error) {
|
|
40
|
+
return reject(error);
|
|
41
|
+
}
|
|
42
|
+
return resolve();
|
|
43
|
+
});
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
exports.AppLog = AppLog;
|
|
47
|
+
//# sourceMappingURL=app-log.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"app-log.js","sourceRoot":"","sources":["../src/app-log.ts"],"names":[],"mappings":";;;;;;AAAA,uCAAkC;AAClC,sDAAyB;AACzB,0DAA6B;AAa7B,MAAa,MAAM;IAKjB,YAAY,OAAuB;QAJ3B,YAAO,GAAkB;YAC/B,OAAO,EAAE,mBAAI,CAAC,OAAO,CAAC,UAAU,CAAC;SAClC,CAAC;QAGA,IAAI,OAAO,EAAE,CAAC;YACZ,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;QACvC,CAAC;IACH,CAAC;IAEM,IAAI,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,KAAK,EAAE,KAAK,EAAgB;QACvD,OAAO,IAAI,OAAO,CAAO,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;YAC3C,MAAM,IAAI,GAAG,IAAA,iBAAM,EAAC,IAAI,IAAI,EAAE,EAAE,qBAAq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T_FOUND = "SI_NOT_FOUND",
|
|
6
|
+
INVALID_CREDENTIALS = "SI_INVALID_CREDENTIALS",
|
|
7
|
+
INVALID_TOKEN = "SI_INVALID_TOKEN",
|
|
8
|
+
MISSING_TOKEN = "SI_MISSING_TOKEN",
|
|
9
|
+
UNAUTHORIZED = "SI_UNAUTHORIZED",
|
|
10
|
+
FORBIDDEN = "SI_FORBIDDEN",
|
|
11
|
+
INVALID_REQUEST_BODY = "SI_INVALID_REQUEST_BODY",
|
|
12
|
+
INACTIVE = "SI_INACTIVE"
|
|
13
|
+
}
|
|
14
|
+
export declare class AppException {
|
|
15
|
+
readonly name: string;
|
|
16
|
+
readonly message: string;
|
|
17
|
+
readonly status: HttpStatusCodes;
|
|
18
|
+
readonly errors?: any[];
|
|
19
|
+
constructor(name: string, message: string, status?: HttpStatusCodes, errors?: any[]);
|
|
20
|
+
}
|
|
21
|
+
//# sourceMappingURL=app-exception.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"app-exception.d.ts","sourceRoot":"","sources":["../../src/exceptions/app-exception.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AAEtD,oBAAY,gBAAgB;IAC1B,WAAW,mBAAmB;IAC9B,qBAAqB,6BAA6B;IAClD,SAAS,iBAAiB;IAC1B,mBAAmB,2BAA2B;IAC9C,aAAa,qBAAqB;IAClC,aAAa,qBAAqB;IAClC,YAAY,oBAAoB;IAChC,SAAS,iBAAiB;IAC1B,oBAAoB,4BAA4B;IAChD,QAAQ,gBAAgB;CACzB;AAED,qBAAa,YAAY;IACvB,SAAgB,IAAI,EAAE,MAAM,CAAC;IAC7B,SAAgB,OAAO,EAAE,MAAM,CAAC;IAChC,SAAgB,MAAM,EAAE,eAAe,CAAC;IACxC,SAAgB,MAAM,CAAC,EAAE,GAAG,EAAE,CAAC;gBAEnB,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,kBAA8B,EAAE,MAAM,CAAC,EAAE,GAAG,EAAE;CAMhG"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.AppException = exports.AppExceptionEnum = void 0;
|
|
4
|
+
const http_status_enum_1 = require("../http-status-enum");
|
|
5
|
+
var AppExceptionEnum;
|
|
6
|
+
(function (AppExceptionEnum) {
|
|
7
|
+
AppExceptionEnum["BAD_REQUEST"] = "SI_BAD_REQUEST";
|
|
8
|
+
AppExceptionEnum["INTERNAL_SERVER_ERROR"] = "SI_INTERNAL_SERVER_ERROR";
|
|
9
|
+
AppExceptionEnum["NOT_FOUND"] = "SI_NOT_FOUND";
|
|
10
|
+
AppExceptionEnum["INVALID_CREDENTIALS"] = "SI_INVALID_CREDENTIALS";
|
|
11
|
+
AppExceptionEnum["INVALID_TOKEN"] = "SI_INVALID_TOKEN";
|
|
12
|
+
AppExceptionEnum["MISSING_TOKEN"] = "SI_MISSING_TOKEN";
|
|
13
|
+
AppExceptionEnum["UNAUTHORIZED"] = "SI_UNAUTHORIZED";
|
|
14
|
+
AppExceptionEnum["FORBIDDEN"] = "SI_FORBIDDEN";
|
|
15
|
+
AppExceptionEnum["INVALID_REQUEST_BODY"] = "SI_INVALID_REQUEST_BODY";
|
|
16
|
+
AppExceptionEnum["INACTIVE"] = "SI_INACTIVE";
|
|
17
|
+
})(AppExceptionEnum || (exports.AppExceptionEnum = AppExceptionEnum = {}));
|
|
18
|
+
class AppException {
|
|
19
|
+
constructor(name, message, status = http_status_enum_1.HttpStatusCodes.BAD_REQUEST, errors) {
|
|
20
|
+
this.name = name;
|
|
21
|
+
this.message = message;
|
|
22
|
+
this.status = status;
|
|
23
|
+
this.errors = errors;
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
exports.AppException = AppException;
|
|
27
|
+
//# sourceMappingURL=app-exception.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"app-exception.js","sourceRoot":"","sources":["../../src/exceptions/app-exception.ts"],"names":[],"mappings":";;;AAAA,0DAAsD;AAEtD,IAAY,gBAWX;AAXD,WAAY,gBAAgB;IAC1B,kDAA8B,CAAA;IAC9B,sEAAkD,CAAA;IAClD,8CAA0B,CAAA;IAC1B,kEAA8C,CAAA;IAC9C,sDAAkC,CAAA;IAClC,sDAAkC,CAAA;IAClC,oDAAgC,CAAA;IAChC,8CAA0B,CAAA;IAC1B,oEAAgD,CAAA;IAChD,4CAAwB,CAAA;AAC1B,CAAC,EAXW,gBAAgB,gCAAhB,gBAAgB,QAW3B;AAED,MAAa,YAAY;IAMvB,YAAY,IAAY,EAAE,OAAe,EAAE,MAAM,GAAG,kCAAe,CAAC,WAAW,EAAE,MAAc;QAC7F,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;QACjB,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;QACvB,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;QACrB,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;IACvB,CAAC;CACF;AAZD,oCAYC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"forbidden.d.ts","sourceRoot":"","sources":["../../src/exceptions/forbidden.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,YAAY,EAAoB,MAAM,iBAAiB,CAAC;AAEjE,qBAAa,kBAAmB,SAAQ,YAAY;gBACtC,OAAO,SAA4C;CAGhE"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ForbiddenException = void 0;
|
|
4
|
+
const http_status_enum_1 = require("../http-status-enum");
|
|
5
|
+
const app_exception_1 = require("./app-exception");
|
|
6
|
+
class ForbiddenException extends app_exception_1.AppException {
|
|
7
|
+
constructor(message = "Sem permissão para acessar este recurso") {
|
|
8
|
+
super(app_exception_1.AppExceptionEnum.FORBIDDEN, message, http_status_enum_1.HttpStatusCodes.FORBIDDEN);
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
exports.ForbiddenException = ForbiddenException;
|
|
12
|
+
//# sourceMappingURL=forbidden.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"forbidden.js","sourceRoot":"","sources":["../../src/exceptions/forbidden.ts"],"names":[],"mappings":";;;AAAA,0DAAsD;AAEtD,mDAAiE;AAEjE,MAAa,kBAAmB,SAAQ,4BAAY;IAClD,YAAY,OAAO,GAAG,yCAAyC;QAC7D,KAAK,CAAC,gCAAgB,CAAC,SAAS,EAAE,OAAO,EAAE,kCAAe,CAAC,SAAS,CAAC,CAAC;IACxE,CAAC;CACF;AAJD,gDAIC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"inactive.d.ts","sourceRoot":"","sources":["../../src/exceptions/inactive.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,YAAY,EAAoB,MAAM,iBAAiB,CAAC;AAEjE,qBAAa,iBAAkB,SAAQ,YAAY;gBACrC,OAAO,SAAY;CAGhC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.InactiveException = void 0;
|
|
4
|
+
const http_status_enum_1 = require("../http-status-enum");
|
|
5
|
+
const app_exception_1 = require("./app-exception");
|
|
6
|
+
class InactiveException extends app_exception_1.AppException {
|
|
7
|
+
constructor(message = "Inativo") {
|
|
8
|
+
super(app_exception_1.AppExceptionEnum.INACTIVE, message, http_status_enum_1.HttpStatusCodes.FORBIDDEN);
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
exports.InactiveException = InactiveException;
|
|
12
|
+
//# sourceMappingURL=inactive.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"inactive.js","sourceRoot":"","sources":["../../src/exceptions/inactive.ts"],"names":[],"mappings":";;;AAAA,0DAAsD;AAEtD,mDAAiE;AAEjE,MAAa,iBAAkB,SAAQ,4BAAY;IACjD,YAAY,OAAO,GAAG,SAAS;QAC7B,KAAK,CAAC,gCAAgB,CAAC,QAAQ,EAAE,OAAO,EAAE,kCAAe,CAAC,SAAS,CAAC,CAAC;IACvE,CAAC;CACF;AAJD,8CAIC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export * from "./app-exception";
|
|
2
|
+
export * from "./forbidden";
|
|
3
|
+
export * from "./inactive";
|
|
4
|
+
export * from "./invalid-credentials";
|
|
5
|
+
export * from "./invalid-token";
|
|
6
|
+
export * from "./missing-token";
|
|
7
|
+
export * from "./not-found";
|
|
8
|
+
export * from "./unauthorized-exception";
|
|
9
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/exceptions/index.ts"],"names":[],"mappings":"AAAA,cAAc,iBAAiB,CAAC;AAChC,cAAc,aAAa,CAAC;AAC5B,cAAc,YAAY,CAAC;AAC3B,cAAc,uBAAuB,CAAC;AACtC,cAAc,iBAAiB,CAAC;AAChC,cAAc,iBAAiB,CAAC;AAChC,cAAc,aAAa,CAAC;AAC5B,cAAc,0BAA0B,CAAC"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./app-exception"), exports);
|
|
18
|
+
__exportStar(require("./forbidden"), exports);
|
|
19
|
+
__exportStar(require("./inactive"), exports);
|
|
20
|
+
__exportStar(require("./invalid-credentials"), exports);
|
|
21
|
+
__exportStar(require("./invalid-token"), exports);
|
|
22
|
+
__exportStar(require("./missing-token"), exports);
|
|
23
|
+
__exportStar(require("./not-found"), exports);
|
|
24
|
+
__exportStar(require("./unauthorized-exception"), exports);
|
|
25
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/exceptions/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,kDAAgC;AAChC,8CAA4B;AAC5B,6CAA2B;AAC3B,wDAAsC;AACtC,kDAAgC;AAChC,kDAAgC;AAChC,8CAA4B;AAC5B,2DAAyC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"invalid-credentials.d.ts","sourceRoot":"","sources":["../../src/exceptions/invalid-credentials.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,qBAAqB,EAAE,MAAM,0BAA0B,CAAC;AAEjE,qBAAa,2BAA4B,SAAQ,qBAAqB;gBACxD,OAAO,SAAgC;CAGpD"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.InvalidCredentialsException = void 0;
|
|
4
|
+
const unauthorized_exception_1 = require("./unauthorized-exception");
|
|
5
|
+
class InvalidCredentialsException extends unauthorized_exception_1.UnauthorizedException {
|
|
6
|
+
constructor(message = "Usuário ou senha incorretos") {
|
|
7
|
+
super(message);
|
|
8
|
+
}
|
|
9
|
+
}
|
|
10
|
+
exports.InvalidCredentialsException = InvalidCredentialsException;
|
|
11
|
+
//# sourceMappingURL=invalid-credentials.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"invalid-credentials.js","sourceRoot":"","sources":["../../src/exceptions/invalid-credentials.ts"],"names":[],"mappings":";;;AAAA,qEAAiE;AAEjE,MAAa,2BAA4B,SAAQ,8CAAqB;IACpE,YAAY,OAAO,GAAG,6BAA6B;QACjD,KAAK,CAAC,OAAO,CAAC,CAAC;IACjB,CAAC;CACF;AAJD,kEAIC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"invalid-token.d.ts","sourceRoot":"","sources":["../../src/exceptions/invalid-token.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAoB,MAAM,iBAAiB,CAAC;AAEjE,qBAAa,qBAAsB,SAAQ,YAAY;gBACzC,OAAO,SAA+C;CAGnE"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.InvalidTokenException = void 0;
|
|
4
|
+
const http_status_enum_1 = require("../http-status-enum");
|
|
5
|
+
const app_exception_1 = require("./app-exception");
|
|
6
|
+
class InvalidTokenException extends app_exception_1.AppException {
|
|
7
|
+
constructor(message = "Token de acesso inválido, tente novamente!") {
|
|
8
|
+
super(app_exception_1.AppExceptionEnum.INVALID_TOKEN, message, http_status_enum_1.HttpStatusCodes.UNAUTHORIZED);
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
exports.InvalidTokenException = InvalidTokenException;
|
|
12
|
+
//# sourceMappingURL=invalid-token.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"invalid-token.js","sourceRoot":"","sources":["../../src/exceptions/invalid-token.ts"],"names":[],"mappings":";;;AAAA,0DAAsD;AACtD,mDAAiE;AAEjE,MAAa,qBAAsB,SAAQ,4BAAY;IACrD,YAAY,OAAO,GAAG,4CAA4C;QAChE,KAAK,CAAC,gCAAgB,CAAC,aAAa,EAAE,OAAO,EAAE,kCAAe,CAAC,YAAY,CAAC,CAAC;IAC/E,CAAC;CACF;AAJD,sDAIC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"missing-token.d.ts","sourceRoot":"","sources":["../../src/exceptions/missing-token.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAoB,MAAM,iBAAiB,CAAC;AAEjE,qBAAa,qBAAsB,SAAQ,YAAY;gBACzC,OAAO,SAAkC;CAGtD"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.MissingTokenException = void 0;
|
|
4
|
+
const http_status_enum_1 = require("../http-status-enum");
|
|
5
|
+
const app_exception_1 = require("./app-exception");
|
|
6
|
+
class MissingTokenException extends app_exception_1.AppException {
|
|
7
|
+
constructor(message = "Token de acesso não informado") {
|
|
8
|
+
super(app_exception_1.AppExceptionEnum.MISSING_TOKEN, message, http_status_enum_1.HttpStatusCodes.UNAUTHORIZED);
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
exports.MissingTokenException = MissingTokenException;
|
|
12
|
+
//# sourceMappingURL=missing-token.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"missing-token.js","sourceRoot":"","sources":["../../src/exceptions/missing-token.ts"],"names":[],"mappings":";;;AAAA,0DAAsD;AACtD,mDAAiE;AAEjE,MAAa,qBAAsB,SAAQ,4BAAY;IACrD,YAAY,OAAO,GAAG,+BAA+B;QACnD,KAAK,CAAC,gCAAgB,CAAC,aAAa,EAAE,OAAO,EAAE,kCAAe,CAAC,YAAY,CAAC,CAAC;IAC/E,CAAC;CACF;AAJD,sDAIC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"not-found.d.ts","sourceRoot":"","sources":["../../src/exceptions/not-found.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAoB,MAAM,iBAAiB,CAAC;AAEjE,qBAAa,iBAAkB,SAAQ,YAAY;gBACrC,OAAO,SAAmB;CAGvC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.NotFoundException = void 0;
|
|
4
|
+
const http_status_enum_1 = require("../http-status-enum");
|
|
5
|
+
const app_exception_1 = require("./app-exception");
|
|
6
|
+
class NotFoundException extends app_exception_1.AppException {
|
|
7
|
+
constructor(message = "Não encontrado") {
|
|
8
|
+
super(app_exception_1.AppExceptionEnum.NOT_FOUND, message, http_status_enum_1.HttpStatusCodes.NOT_FOUND);
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
exports.NotFoundException = NotFoundException;
|
|
12
|
+
//# sourceMappingURL=not-found.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"not-found.js","sourceRoot":"","sources":["../../src/exceptions/not-found.ts"],"names":[],"mappings":";;;AAAA,0DAAsD;AACtD,mDAAiE;AAEjE,MAAa,iBAAkB,SAAQ,4BAAY;IACjD,YAAY,OAAO,GAAG,gBAAgB;QACpC,KAAK,CAAC,gCAAgB,CAAC,SAAS,EAAE,OAAO,EAAE,kCAAe,CAAC,SAAS,CAAC,CAAC;IACxE,CAAC;CACF;AAJD,8CAIC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"unauthorized-exception.d.ts","sourceRoot":"","sources":["../../src/exceptions/unauthorized-exception.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAoB,MAAM,iBAAiB,CAAC;AAEjE,qBAAa,qBAAsB,SAAQ,YAAY;gBACzC,OAAO,SAAoB;CAGxC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.UnauthorizedException = void 0;
|
|
4
|
+
const http_status_enum_1 = require("../http-status-enum");
|
|
5
|
+
const app_exception_1 = require("./app-exception");
|
|
6
|
+
class UnauthorizedException extends app_exception_1.AppException {
|
|
7
|
+
constructor(message = "Sem autorização") {
|
|
8
|
+
super(app_exception_1.AppExceptionEnum.UNAUTHORIZED, message, http_status_enum_1.HttpStatusCodes.UNAUTHORIZED);
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
exports.UnauthorizedException = UnauthorizedException;
|
|
12
|
+
//# sourceMappingURL=unauthorized-exception.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"unauthorized-exception.js","sourceRoot":"","sources":["../../src/exceptions/unauthorized-exception.ts"],"names":[],"mappings":";;;AAAA,0DAAsD;AACtD,mDAAiE;AAEjE,MAAa,qBAAsB,SAAQ,4BAAY;IACrD,YAAY,OAAO,GAAG,iBAAiB;QACrC,KAAK,CAAC,gCAAgB,CAAC,YAAY,EAAE,OAAO,EAAE,kCAAe,CAAC,YAAY,CAAC,CAAC;IAC9E,CAAC;CACF;AAJD,sDAIC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"execute-promise.d.ts","sourceRoot":"","sources":["../src/execute-promise.ts"],"names":[],"mappings":"AAEA,iBAAe,cAAc,CAAC,CAAC,EAAE,OAAO,EAAE,OAAO,CAAC,CAAC,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC,EAAE,MAAM,GAAG,IAAI,EAAE,GAAG,CAAC,CAAC,CAAC,CAAC;AAqBzF,OAAO,EAAE,cAAc,EAAE,CAAC"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.executePromise = executePromise;
|
|
13
|
+
const axios_1 = require("axios");
|
|
14
|
+
function executePromise(promise) {
|
|
15
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
16
|
+
var _a;
|
|
17
|
+
try {
|
|
18
|
+
const result = yield promise;
|
|
19
|
+
return [result, null, null];
|
|
20
|
+
}
|
|
21
|
+
catch (error) {
|
|
22
|
+
let message = `Erro ao executar ação`;
|
|
23
|
+
if (error instanceof Error) {
|
|
24
|
+
message = error.message;
|
|
25
|
+
}
|
|
26
|
+
if (error instanceof axios_1.AxiosError) {
|
|
27
|
+
message = ((_a = error.response) === null || _a === void 0 ? void 0 : _a.data.message) || error.message;
|
|
28
|
+
}
|
|
29
|
+
return [null, message, error];
|
|
30
|
+
}
|
|
31
|
+
});
|
|
32
|
+
}
|
|
33
|
+
//# sourceMappingURL=execute-promise.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"execute-promise.js","sourceRoot":"","sources":["../src/execute-promise.ts"],"names":[],"mappings":";;;;;;;;;;;AAuBS,wCAAc;AAvBvB,iCAAmC;AAInC,SAAe,cAAc,CAAI,OAAmB;;;QAClD,IAAI,CAAC;YACH,MAAM,MAAM,GAAG,MAAM,OAAO,CAAC;YAC7B,OAAO,CAAC,MAAM,EAAE,IAAI,EAAE,IAAI,CAAC,CAAC;QAC9B,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,IAAI,OAAO,GAAG,uBAAuB,CAAC;YAEtC,IAAI,KAAK,YAAY,KAAK,EAAE,CAAC;gBAC3B,OAAO,GAAG,KAAK,CAAC,OAAO,CAAC;YAC1B,CAAC;YAED,IAAI,KAAK,YAAY,kBAAU,EAAE,CAAC;gBAChC,OAAO,GAAG,CAAA,MAAA,KAAK,CAAC,QAAQ,0CAAE,IAAI,CAAC,OAAO,KAAI,KAAK,CAAC,OAAO,CAAC;YAC1D,CAAC;YAED,OAAO,CAAC,IAAI,EAAE,OAAO,EAAE,KAAK,CAAC,CAAC;QAChC,CAAC;IACH,CAAC;CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"format-case.d.ts","sourceRoot":"","sources":["../src/format-case.ts"],"names":[],"mappings":"AAAA,qBAAa,UAAU;IACd,YAAY,CAAC,IAAI,CAAC,EAAE,MAAM,GAAG,MAAM;IAWnC,WAAW,CAAC,IAAI,CAAC,EAAE,MAAM,GAAG,MAAM;IASlC,WAAW,CAAC,IAAI,CAAC,EAAE,MAAM,GAAG,MAAM;CAU1C"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.FormatCase = void 0;
|
|
4
|
+
class FormatCase {
|
|
5
|
+
toPascalCase(text) {
|
|
6
|
+
if (!text) {
|
|
7
|
+
return "";
|
|
8
|
+
}
|
|
9
|
+
return text
|
|
10
|
+
.split(/[-_]/)
|
|
11
|
+
.map((word) => word.charAt(0).toUpperCase() + word.slice(1))
|
|
12
|
+
.join("");
|
|
13
|
+
}
|
|
14
|
+
toCamelCase(text) {
|
|
15
|
+
if (!text) {
|
|
16
|
+
return "";
|
|
17
|
+
}
|
|
18
|
+
const pascalCase = this.toPascalCase(text);
|
|
19
|
+
return pascalCase.charAt(0).toLowerCase() + pascalCase.slice(1);
|
|
20
|
+
}
|
|
21
|
+
toSnakeCase(text) {
|
|
22
|
+
if (!text) {
|
|
23
|
+
return "";
|
|
24
|
+
}
|
|
25
|
+
return text
|
|
26
|
+
.split(/(?=[A-Z])/)
|
|
27
|
+
.join("_")
|
|
28
|
+
.toLowerCase();
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
exports.FormatCase = FormatCase;
|
|
32
|
+
//# sourceMappingURL=format-case.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"format-case.js","sourceRoot":"","sources":["../src/format-case.ts"],"names":[],"mappings":";;;AAAA,MAAa,UAAU;IACd,YAAY,CAAC,IAAa;QAC/B,IAAI,CAAC,IAAI,EAAE,CAAC;YACV,OAAO,EAAE,CAAC;QACZ,CAAC;QAED,OAAO,IAAI;aACR,KAAK,CAAC,MAAM,CAAC;aACb,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,WAAW,EAAE,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;aAC3D,IAAI,CAAC,EAAE,CAAC,CAAC;IACd,CAAC;IAEM,WAAW,CAAC,IAAa;QAC9B,IAAI,CAAC,IAAI,EAAE,CAAC;YACV,OAAO,EAAE,CAAC;QACZ,CAAC;QAED,MAAM,UAAU,GAAG,IAAI,CAAC,YAAY,CAAC,IAAI,CAAC,CAAC;QAC3C,OAAO,UAAU,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,WAAW,EAAE,GAAG,UAAU,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;IAClE,CAAC;IAEM,WAAW,CAAC,IAAa;QAC9B,IAAI,CAAC,IAAI,EAAE,CAAC;YACV,OAAO,EAAE,CAAC;QACZ,CAAC;QAED,OAAO,IAAI;aACR,KAAK,CAAC,WAAW,CAAC;aAClB,IAAI,CAAC,GAAG,CAAC;aACT,WAAW,EAAE,CAAC;IACnB,CAAC;CACF;AA/BD,gCA+BC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
type CapitalizeModeType = "words" | "first-letter";
|
|
2
|
+
export declare class FormatText {
|
|
3
|
+
normalize(text?: string): string;
|
|
4
|
+
capitalize(text?: string, mode?: CapitalizeModeType): string;
|
|
5
|
+
removeSpecialCharacters(text?: string): string;
|
|
6
|
+
}
|
|
7
|
+
export {};
|
|
8
|
+
//# sourceMappingURL=format-text.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"format-text.d.ts","sourceRoot":"","sources":["../src/format-text.ts"],"names":[],"mappings":"AAAA,KAAK,kBAAkB,GAAG,OAAO,GAAG,cAAc,CAAC;AAEnD,qBAAa,UAAU;IACd,SAAS,CAAC,IAAI,CAAC,EAAE,MAAM,GAAG,MAAM;IAQhC,UAAU,CAAC,IAAI,CAAC,EAAE,MAAM,EAAE,IAAI,GAAE,kBAA4B,GAAG,MAAM;IAsGrE,uBAAuB,CAAC,IAAI,CAAC,EAAE,MAAM,GAAG,MAAM;CAOtD"}
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.FormatText = void 0;
|
|
4
|
+
class FormatText {
|
|
5
|
+
normalize(text) {
|
|
6
|
+
if (!text) {
|
|
7
|
+
return "";
|
|
8
|
+
}
|
|
9
|
+
return text.normalize("NFD").replace(/[\u0300-\u036f]/g, "");
|
|
10
|
+
}
|
|
11
|
+
capitalize(text, mode = "words") {
|
|
12
|
+
if (!text) {
|
|
13
|
+
return "";
|
|
14
|
+
}
|
|
15
|
+
if (mode === "first-letter") {
|
|
16
|
+
return text.charAt(0).toUpperCase() + text.slice(1).toLowerCase();
|
|
17
|
+
}
|
|
18
|
+
const words = text.split(" ");
|
|
19
|
+
const capitalizedWords = words.map((word, index) => {
|
|
20
|
+
// Should capitalize when first word
|
|
21
|
+
if (word.match(/^(?:de|da|das|do|dos|del|by|à|e|o|ou|y)$/i)) {
|
|
22
|
+
if (index === 0) {
|
|
23
|
+
return word.toUpperCase();
|
|
24
|
+
}
|
|
25
|
+
return word.toLowerCase();
|
|
26
|
+
}
|
|
27
|
+
// Shouldn't capitalize when first word
|
|
28
|
+
if (word.match(/^(?:em|por|para)$/i)) {
|
|
29
|
+
if (!(index === 0)) {
|
|
30
|
+
return word.toLowerCase();
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
// Exclusive for Senha Informática
|
|
34
|
+
if (word.match(/^(?:pj|ga7|lg|mt|gp|gbl|wl|hkd|nm|amd|crm|gg|rca)$/i)) {
|
|
35
|
+
return word.toUpperCase();
|
|
36
|
+
}
|
|
37
|
+
// Matches special cases
|
|
38
|
+
if (word.match(/^(?:cde)$/i)) {
|
|
39
|
+
return word.toUpperCase();
|
|
40
|
+
}
|
|
41
|
+
// Matches roman numerals
|
|
42
|
+
if (word.match(/^(?=[MDCLXVI])M*(C[MD]|D?C*)(X[CL]|L?X*)(I[XV]|V?I*)$/i)) {
|
|
43
|
+
return word.toUpperCase();
|
|
44
|
+
}
|
|
45
|
+
// Matches patterns like "A.B." or "A.B.C."
|
|
46
|
+
if (word.match(/[A-Z]\.[A-Z]/) || word.match(/[A-Z]\.[A-Z]\.[A-Z]/)) {
|
|
47
|
+
return word.toUpperCase();
|
|
48
|
+
}
|
|
49
|
+
// Matches patterns like "`A"
|
|
50
|
+
if (word.match(/`[A-Z]/)) {
|
|
51
|
+
const [first, second] = word.split("`");
|
|
52
|
+
return (first.charAt(0).toUpperCase() +
|
|
53
|
+
first.slice(1).toLowerCase() +
|
|
54
|
+
"`" +
|
|
55
|
+
second.charAt(0).toUpperCase() +
|
|
56
|
+
second.slice(1).toLowerCase());
|
|
57
|
+
}
|
|
58
|
+
// Matches patterns like "'A"
|
|
59
|
+
if (word.match(/'[A-Z]/)) {
|
|
60
|
+
const [first, second] = word.split("'");
|
|
61
|
+
return (first.charAt(0).toUpperCase() +
|
|
62
|
+
first.slice(1).toLowerCase() +
|
|
63
|
+
"'" +
|
|
64
|
+
second.charAt(0).toUpperCase() +
|
|
65
|
+
second.slice(1).toLowerCase());
|
|
66
|
+
}
|
|
67
|
+
// Matches patterns like "/A" (word after slash, e.g. "A/B")
|
|
68
|
+
if (word.match(/\/[A-Z]/)) {
|
|
69
|
+
const [first, second] = word.split("/");
|
|
70
|
+
return (first.charAt(0).toUpperCase() +
|
|
71
|
+
first.slice(1).toLowerCase() +
|
|
72
|
+
"/" +
|
|
73
|
+
second.charAt(0).toUpperCase() +
|
|
74
|
+
second.slice(1).toLowerCase());
|
|
75
|
+
}
|
|
76
|
+
// Matches patterns like "A-B"
|
|
77
|
+
if (word.match(/[A-Z]-[A-Z]/)) {
|
|
78
|
+
const [first, second] = word.split("-");
|
|
79
|
+
return (first.charAt(0).toUpperCase() +
|
|
80
|
+
first.slice(1).toLowerCase() +
|
|
81
|
+
"-" +
|
|
82
|
+
second.charAt(0).toUpperCase() +
|
|
83
|
+
second.slice(1).toLowerCase());
|
|
84
|
+
}
|
|
85
|
+
return word.charAt(0).toUpperCase() + word.slice(1).toLowerCase();
|
|
86
|
+
});
|
|
87
|
+
return capitalizedWords.join(" ").replace("`", "'");
|
|
88
|
+
}
|
|
89
|
+
removeSpecialCharacters(text) {
|
|
90
|
+
if (!text) {
|
|
91
|
+
return "";
|
|
92
|
+
}
|
|
93
|
+
return text.replace(/[^a-zA-Z0-9]/g, "");
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
exports.FormatText = FormatText;
|
|
97
|
+
//# sourceMappingURL=format-text.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"format-text.js","sourceRoot":"","sources":["../src/format-text.ts"],"names":[],"mappings":";;;AAEA,MAAa,UAAU;IACd,SAAS,CAAC,IAAa;QAC5B,IAAI,CAAC,IAAI,EAAE,CAAC;YACV,OAAO,EAAE,CAAC;QACZ,CAAC;QAED,OAAO,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC,OAAO,CAAC,kBAAkB,EAAE,EAA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,CAAC;QACZ,CAAC;QAED,OAAO,IAAI,CAAC,OAAO,CAAC,eAAe,EAAE,EAAE,CAAC,CAAC;IAC3C,CAAC;CACF;AAtHD,gCAsHC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"get-ip-address.d.ts","sourceRoot":"","sources":["../src/get-ip-address.ts"],"names":[],"mappings":"AAIA,wBAAgB,YAAY,IAAI;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,CA4B7D"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.getIPAddress = getIPAddress;
|
|
7
|
+
const node_os_1 = __importDefault(require("node:os"));
|
|
8
|
+
const nets = node_os_1.default.networkInterfaces();
|
|
9
|
+
function getIPAddress() {
|
|
10
|
+
let ipv4 = "";
|
|
11
|
+
let ipv6 = "";
|
|
12
|
+
for (const key in nets) {
|
|
13
|
+
if (key === "Ethernet" || key === "Wi-Fi" || key === "NIC1") {
|
|
14
|
+
const connection = nets[key];
|
|
15
|
+
if (!connection) {
|
|
16
|
+
break;
|
|
17
|
+
}
|
|
18
|
+
for (const net of connection) {
|
|
19
|
+
if (net.family === "IPv4" || net.family === "IPv6") {
|
|
20
|
+
if (net.family === "IPv4") {
|
|
21
|
+
ipv4 = net.address;
|
|
22
|
+
}
|
|
23
|
+
else {
|
|
24
|
+
ipv6 = net.address;
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
return {
|
|
31
|
+
ipv4,
|
|
32
|
+
ipv6,
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
//# sourceMappingURL=get-ip-address.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"get-ip-address.js","sourceRoot":"","sources":["../src/get-ip-address.ts"],"names":[],"mappings":";;;;;AAIA,oCA4BC;AAhCD,sDAAyB;AAEzB,MAAM,IAAI,GAAG,iBAAE,CAAC,iBAAiB,EAAE,CAAC;AAEpC,SAAgB,YAAY;IAC1B,IAAI,IAAI,GAAG,EAAE,CAAC;IACd,IAAI,IAAI,GAAG,EAAE,CAAC;IAEd,KAAK,MAAM,GAAG,IAAI,IAAI,EAAE,CAAC;QACvB,IAAI,GAAG,KAAK,UAAU,IAAI,GAAG,KAAK,OAAO,IAAI,GAAG,KAAK,MAAM,EAAE,CAAC;YAC5D,MAAM,UAAU,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC;YAE7B,IAAI,CAAC,UAAU,EAAE,CAAC;gBAChB,MAAM;YACR,CAAC;YAED,KAAK,MAAM,GAAG,IAAI,UAAU,EAAE,CAAC;gBAC7B,IAAI,GAAG,CAAC,MAAM,KAAK,MAAM,IAAI,GAAG,CAAC,MAAM,KAAK,MAAM,EAAE,CAAC;oBACnD,IAAI,GAAG,CAAC,MAAM,KAAK,MAAM,EAAE,CAAC;wBAC1B,IAAI,GAAG,GAAG,CAAC,OAAO,CAAC;oBACrB,CAAC;yBAAM,CAAC;wBACN,IAAI,GAAG,GAAG,CAAC,OAAO,CAAC;oBACrB,CAAC;gBACH,CAAC;YACH,CAAC;QACH,CAAC;IACH,CAAC;IAED,OAAO;QACL,IAAI;QACJ,IAAI;KACL,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
export declare enum HttpStatusCodes {
|
|
2
|
+
CONTINUE = 100,
|
|
3
|
+
SWITCHING_PROTOCOLS = 101,
|
|
4
|
+
PROCESSING = 102,
|
|
5
|
+
EARLYHINTS = 103,
|
|
6
|
+
OK = 200,
|
|
7
|
+
CREATED = 201,
|
|
8
|
+
ACCEPTED = 202,
|
|
9
|
+
NON_AUTHORITATIVE_INFORMATION = 203,
|
|
10
|
+
NO_CONTENT = 204,
|
|
11
|
+
RESET_CONTENT = 205,
|
|
12
|
+
PARTIAL_CONTENT = 206,
|
|
13
|
+
AMBIGUOUS = 300,
|
|
14
|
+
MOVED_PERMANENTLY = 301,
|
|
15
|
+
FOUND = 302,
|
|
16
|
+
SEE_OTHER = 303,
|
|
17
|
+
NOT_MODIFIED = 304,
|
|
18
|
+
TEMPORARY_REDIRECT = 307,
|
|
19
|
+
PERMANENT_REDIRECT = 308,
|
|
20
|
+
BAD_REQUEST = 400,
|
|
21
|
+
UNAUTHORIZED = 401,
|
|
22
|
+
PAYMENT_REQUIRED = 402,
|
|
23
|
+
FORBIDDEN = 403,
|
|
24
|
+
NOT_FOUND = 404,
|
|
25
|
+
METHOD_NOT_ALLOWED = 405,
|
|
26
|
+
NOT_ACCEPTABLE = 406,
|
|
27
|
+
PROXY_AUTHENTICATION_REQUIRED = 407,
|
|
28
|
+
REQUEST_TIMEOUT = 408,
|
|
29
|
+
CONFLICT = 409,
|
|
30
|
+
GONE = 410,
|
|
31
|
+
LENGTH_REQUIRED = 411,
|
|
32
|
+
PRECONDITION_FAILED = 412,
|
|
33
|
+
PAYLOAD_TOO_LARGE = 413,
|
|
34
|
+
URI_TOO_LONG = 414,
|
|
35
|
+
UNSUPPORTED_MEDIA_TYPE = 415,
|
|
36
|
+
REQUESTED_RANGE_NOT_SATISFIABLE = 416,
|
|
37
|
+
EXPECTATION_FAILED = 417,
|
|
38
|
+
I_AM_A_TEAPOT = 418,
|
|
39
|
+
MISDIRECTED = 421,
|
|
40
|
+
UNPROCESSABLE_ENTITY = 422,
|
|
41
|
+
FAILED_DEPENDENCY = 424,
|
|
42
|
+
PRECONDITION_REQUIRED = 428,
|
|
43
|
+
TOO_MANY_REQUESTS = 429,
|
|
44
|
+
INTERNAL_SERVER_ERROR = 500,
|
|
45
|
+
NOT_IMPLEMENTED = 501,
|
|
46
|
+
BAD_GATEWAY = 502,
|
|
47
|
+
SERVICE_UNAVAILABLE = 503,
|
|
48
|
+
GATEWAY_TIMEOUT = 504,
|
|
49
|
+
HTTP_VERSION_NOT_SUPPORTED = 505
|
|
50
|
+
}
|
|
51
|
+
//# sourceMappingURL=http-status-enum.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"http-status-enum.d.ts","sourceRoot":"","sources":["../src/http-status-enum.ts"],"names":[],"mappings":"AAAA,oBAAY,eAAe;IACzB,QAAQ,MAAM;IACd,mBAAmB,MAAM;IACzB,UAAU,MAAM;IAChB,UAAU,MAAM;IAChB,EAAE,MAAM;IACR,OAAO,MAAM;IACb,QAAQ,MAAM;IACd,6BAA6B,MAAM;IACnC,UAAU,MAAM;IAChB,aAAa,MAAM;IACnB,eAAe,MAAM;IACrB,SAAS,MAAM;IACf,iBAAiB,MAAM;IACvB,KAAK,MAAM;IACX,SAAS,MAAM;IACf,YAAY,MAAM;IAClB,kBAAkB,MAAM;IACxB,kBAAkB,MAAM;IACxB,WAAW,MAAM;IACjB,YAAY,MAAM;IAClB,gBAAgB,MAAM;IACtB,SAAS,MAAM;IACf,SAAS,MAAM;IACf,kBAAkB,MAAM;IACxB,cAAc,MAAM;IACpB,6BAA6B,MAAM;IACnC,eAAe,MAAM;IACrB,QAAQ,MAAM;IACd,IAAI,MAAM;IACV,eAAe,MAAM;IACrB,mBAAmB,MAAM;IACzB,iBAAiB,MAAM;IACvB,YAAY,MAAM;IAClB,sBAAsB,MAAM;IAC5B,+BAA+B,MAAM;IACrC,kBAAkB,MAAM;IACxB,aAAa,MAAM;IACnB,WAAW,MAAM;IACjB,oBAAoB,MAAM;IAC1B,iBAAiB,MAAM;IACvB,qBAAqB,MAAM;IAC3B,iBAAiB,MAAM;IACvB,qBAAqB,MAAM;IAC3B,eAAe,MAAM;IACrB,WAAW,MAAM;IACjB,mBAAmB,MAAM;IACzB,eAAe,MAAM;IACrB,0BAA0B,MAAM;CACjC"}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.HttpStatusCodes = void 0;
|
|
4
|
+
var HttpStatusCodes;
|
|
5
|
+
(function (HttpStatusCodes) {
|
|
6
|
+
HttpStatusCodes[HttpStatusCodes["CONTINUE"] = 100] = "CONTINUE";
|
|
7
|
+
HttpStatusCodes[HttpStatusCodes["SWITCHING_PROTOCOLS"] = 101] = "SWITCHING_PROTOCOLS";
|
|
8
|
+
HttpStatusCodes[HttpStatusCodes["PROCESSING"] = 102] = "PROCESSING";
|
|
9
|
+
HttpStatusCodes[HttpStatusCodes["EARLYHINTS"] = 103] = "EARLYHINTS";
|
|
10
|
+
HttpStatusCodes[HttpStatusCodes["OK"] = 200] = "OK";
|
|
11
|
+
HttpStatusCodes[HttpStatusCodes["CREATED"] = 201] = "CREATED";
|
|
12
|
+
HttpStatusCodes[HttpStatusCodes["ACCEPTED"] = 202] = "ACCEPTED";
|
|
13
|
+
HttpStatusCodes[HttpStatusCodes["NON_AUTHORITATIVE_INFORMATION"] = 203] = "NON_AUTHORITATIVE_INFORMATION";
|
|
14
|
+
HttpStatusCodes[HttpStatusCodes["NO_CONTENT"] = 204] = "NO_CONTENT";
|
|
15
|
+
HttpStatusCodes[HttpStatusCodes["RESET_CONTENT"] = 205] = "RESET_CONTENT";
|
|
16
|
+
HttpStatusCodes[HttpStatusCodes["PARTIAL_CONTENT"] = 206] = "PARTIAL_CONTENT";
|
|
17
|
+
HttpStatusCodes[HttpStatusCodes["AMBIGUOUS"] = 300] = "AMBIGUOUS";
|
|
18
|
+
HttpStatusCodes[HttpStatusCodes["MOVED_PERMANENTLY"] = 301] = "MOVED_PERMANENTLY";
|
|
19
|
+
HttpStatusCodes[HttpStatusCodes["FOUND"] = 302] = "FOUND";
|
|
20
|
+
HttpStatusCodes[HttpStatusCodes["SEE_OTHER"] = 303] = "SEE_OTHER";
|
|
21
|
+
HttpStatusCodes[HttpStatusCodes["NOT_MODIFIED"] = 304] = "NOT_MODIFIED";
|
|
22
|
+
HttpStatusCodes[HttpStatusCodes["TEMPORARY_REDIRECT"] = 307] = "TEMPORARY_REDIRECT";
|
|
23
|
+
HttpStatusCodes[HttpStatusCodes["PERMANENT_REDIRECT"] = 308] = "PERMANENT_REDIRECT";
|
|
24
|
+
HttpStatusCodes[HttpStatusCodes["BAD_REQUEST"] = 400] = "BAD_REQUEST";
|
|
25
|
+
HttpStatusCodes[HttpStatusCodes["UNAUTHORIZED"] = 401] = "UNAUTHORIZED";
|
|
26
|
+
HttpStatusCodes[HttpStatusCodes["PAYMENT_REQUIRED"] = 402] = "PAYMENT_REQUIRED";
|
|
27
|
+
HttpStatusCodes[HttpStatusCodes["FORBIDDEN"] = 403] = "FORBIDDEN";
|
|
28
|
+
HttpStatusCodes[HttpStatusCodes["NOT_FOUND"] = 404] = "NOT_FOUND";
|
|
29
|
+
HttpStatusCodes[HttpStatusCodes["METHOD_NOT_ALLOWED"] = 405] = "METHOD_NOT_ALLOWED";
|
|
30
|
+
HttpStatusCodes[HttpStatusCodes["NOT_ACCEPTABLE"] = 406] = "NOT_ACCEPTABLE";
|
|
31
|
+
HttpStatusCodes[HttpStatusCodes["PROXY_AUTHENTICATION_REQUIRED"] = 407] = "PROXY_AUTHENTICATION_REQUIRED";
|
|
32
|
+
HttpStatusCodes[HttpStatusCodes["REQUEST_TIMEOUT"] = 408] = "REQUEST_TIMEOUT";
|
|
33
|
+
HttpStatusCodes[HttpStatusCodes["CONFLICT"] = 409] = "CONFLICT";
|
|
34
|
+
HttpStatusCodes[HttpStatusCodes["GONE"] = 410] = "GONE";
|
|
35
|
+
HttpStatusCodes[HttpStatusCodes["LENGTH_REQUIRED"] = 411] = "LENGTH_REQUIRED";
|
|
36
|
+
HttpStatusCodes[HttpStatusCodes["PRECONDITION_FAILED"] = 412] = "PRECONDITION_FAILED";
|
|
37
|
+
HttpStatusCodes[HttpStatusCodes["PAYLOAD_TOO_LARGE"] = 413] = "PAYLOAD_TOO_LARGE";
|
|
38
|
+
HttpStatusCodes[HttpStatusCodes["URI_TOO_LONG"] = 414] = "URI_TOO_LONG";
|
|
39
|
+
HttpStatusCodes[HttpStatusCodes["UNSUPPORTED_MEDIA_TYPE"] = 415] = "UNSUPPORTED_MEDIA_TYPE";
|
|
40
|
+
HttpStatusCodes[HttpStatusCodes["REQUESTED_RANGE_NOT_SATISFIABLE"] = 416] = "REQUESTED_RANGE_NOT_SATISFIABLE";
|
|
41
|
+
HttpStatusCodes[HttpStatusCodes["EXPECTATION_FAILED"] = 417] = "EXPECTATION_FAILED";
|
|
42
|
+
HttpStatusCodes[HttpStatusCodes["I_AM_A_TEAPOT"] = 418] = "I_AM_A_TEAPOT";
|
|
43
|
+
HttpStatusCodes[HttpStatusCodes["MISDIRECTED"] = 421] = "MISDIRECTED";
|
|
44
|
+
HttpStatusCodes[HttpStatusCodes["UNPROCESSABLE_ENTITY"] = 422] = "UNPROCESSABLE_ENTITY";
|
|
45
|
+
HttpStatusCodes[HttpStatusCodes["FAILED_DEPENDENCY"] = 424] = "FAILED_DEPENDENCY";
|
|
46
|
+
HttpStatusCodes[HttpStatusCodes["PRECONDITION_REQUIRED"] = 428] = "PRECONDITION_REQUIRED";
|
|
47
|
+
HttpStatusCodes[HttpStatusCodes["TOO_MANY_REQUESTS"] = 429] = "TOO_MANY_REQUESTS";
|
|
48
|
+
HttpStatusCodes[HttpStatusCodes["INTERNAL_SERVER_ERROR"] = 500] = "INTERNAL_SERVER_ERROR";
|
|
49
|
+
HttpStatusCodes[HttpStatusCodes["NOT_IMPLEMENTED"] = 501] = "NOT_IMPLEMENTED";
|
|
50
|
+
HttpStatusCodes[HttpStatusCodes["BAD_GATEWAY"] = 502] = "BAD_GATEWAY";
|
|
51
|
+
HttpStatusCodes[HttpStatusCodes["SERVICE_UNAVAILABLE"] = 503] = "SERVICE_UNAVAILABLE";
|
|
52
|
+
HttpStatusCodes[HttpStatusCodes["GATEWAY_TIMEOUT"] = 504] = "GATEWAY_TIMEOUT";
|
|
53
|
+
HttpStatusCodes[HttpStatusCodes["HTTP_VERSION_NOT_SUPPORTED"] = 505] = "HTTP_VERSION_NOT_SUPPORTED";
|
|
54
|
+
})(HttpStatusCodes || (exports.HttpStatusCodes = HttpStatusCodes = {}));
|
|
55
|
+
//# sourceMappingURL=http-status-enum.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"http-status-enum.js","sourceRoot":"","sources":["../src/http-status-enum.ts"],"names":[],"mappings":";;;AAAA,IAAY,eAiDX;AAjDD,WAAY,eAAe;IACzB,+DAAc,CAAA;IACd,qFAAyB,CAAA;IACzB,mEAAgB,CAAA;IAChB,mEAAgB,CAAA;IAChB,mDAAQ,CAAA;IACR,6DAAa,CAAA;IACb,+DAAc,CAAA;IACd,yGAAmC,CAAA;IACnC,mEAAgB,CAAA;IAChB,yEAAmB,CAAA;IACnB,6EAAqB,CAAA;IACrB,iEAAe,CAAA;IACf,iFAAuB,CAAA;IACvB,yDAAW,CAAA;IACX,iEAAe,CAAA;IACf,uEAAkB,CAAA;IAClB,mFAAwB,CAAA;IACxB,mFAAwB,CAAA;IACxB,qEAAiB,CAAA;IACjB,uEAAkB,CAAA;IAClB,+EAAsB,CAAA;IACtB,iEAAe,CAAA;IACf,iEAAe,CAAA;IACf,mFAAwB,CAAA;IACxB,2EAAoB,CAAA;IACpB,yGAAmC,CAAA;IACnC,6EAAqB,CAAA;IACrB,+DAAc,CAAA;IACd,uDAAU,CAAA;IACV,6EAAqB,CAAA;IACrB,qFAAyB,CAAA;IACzB,iFAAuB,CAAA;IACvB,uEAAkB,CAAA;IAClB,2FAA4B,CAAA;IAC5B,6GAAqC,CAAA;IACrC,mFAAwB,CAAA;IACxB,yEAAmB,CAAA;IACnB,qEAAiB,CAAA;IACjB,uFAA0B,CAAA;IAC1B,iFAAuB,CAAA;IACvB,yFAA2B,CAAA;IAC3B,iFAAuB,CAAA;IACvB,yFAA2B,CAAA;IAC3B,6EAAqB,CAAA;IACrB,qEAAiB,CAAA;IACjB,qFAAyB,CAAA;IACzB,6EAAqB,CAAA;IACrB,mGAAgC,CAAA;AAClC,CAAC,EAjDW,eAAe,+BAAf,eAAe,QAiD1B"}
|
package/lib/index.d.ts
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export * from "./app-log";
|
|
2
|
+
export * from "./execute-promise";
|
|
3
|
+
export * from "./format-case";
|
|
4
|
+
export * from "./format-text";
|
|
5
|
+
export * from "./get-ip-address";
|
|
6
|
+
export * from "./http-status-enum";
|
|
7
|
+
export * from "./xor-encrypt";
|
|
8
|
+
export * as Exceptions from "./exceptions";
|
|
9
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,WAAW,CAAC;AAC1B,cAAc,mBAAmB,CAAC;AAClC,cAAc,eAAe,CAAC;AAC9B,cAAc,eAAe,CAAC;AAC9B,cAAc,kBAAkB,CAAC;AACjC,cAAc,oBAAoB,CAAC;AACnC,cAAc,eAAe,CAAC;AAE9B,OAAO,KAAK,UAAU,MAAM,cAAc,CAAC"}
|
package/lib/index.js
ADDED
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
19
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
20
|
+
};
|
|
21
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
22
|
+
var ownKeys = function(o) {
|
|
23
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
24
|
+
var ar = [];
|
|
25
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
26
|
+
return ar;
|
|
27
|
+
};
|
|
28
|
+
return ownKeys(o);
|
|
29
|
+
};
|
|
30
|
+
return function (mod) {
|
|
31
|
+
if (mod && mod.__esModule) return mod;
|
|
32
|
+
var result = {};
|
|
33
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
34
|
+
__setModuleDefault(result, mod);
|
|
35
|
+
return result;
|
|
36
|
+
};
|
|
37
|
+
})();
|
|
38
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
|
+
exports.Exceptions = void 0;
|
|
40
|
+
__exportStar(require("./app-log"), exports);
|
|
41
|
+
__exportStar(require("./execute-promise"), exports);
|
|
42
|
+
__exportStar(require("./format-case"), exports);
|
|
43
|
+
__exportStar(require("./format-text"), exports);
|
|
44
|
+
__exportStar(require("./get-ip-address"), exports);
|
|
45
|
+
__exportStar(require("./http-status-enum"), exports);
|
|
46
|
+
__exportStar(require("./xor-encrypt"), exports);
|
|
47
|
+
exports.Exceptions = __importStar(require("./exceptions"));
|
|
48
|
+
//# sourceMappingURL=index.js.map
|
package/lib/index.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,4CAA0B;AAC1B,oDAAkC;AAClC,gDAA8B;AAC9B,gDAA8B;AAC9B,mDAAiC;AACjC,qDAAmC;AACnC,gDAA8B;AAE9B,2DAA2C"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"xor-encrypt.d.ts","sourceRoot":"","sources":["../src/xor-encrypt.ts"],"names":[],"mappings":"AAAA,UAAU,eAAe;IACvB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,MAAM,CAAC;CACd;AAED,wBAAgB,UAAU,CAAC,EAAE,KAAK,EAAE,IAAI,EAAE,EAAE,eAAe,GAAG,MAAM,CAanE"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.xorEncrypt = xorEncrypt;
|
|
4
|
+
function xorEncrypt({ value, hash }) {
|
|
5
|
+
if (!value || !value.trim() || !hash) {
|
|
6
|
+
return "";
|
|
7
|
+
}
|
|
8
|
+
for (let i = 0; i < hash.length; i++) {
|
|
9
|
+
value = value
|
|
10
|
+
.split("")
|
|
11
|
+
.map((char) => String.fromCharCode(hash[i].charCodeAt(0) ^ char.charCodeAt(0)))
|
|
12
|
+
.join("");
|
|
13
|
+
}
|
|
14
|
+
return value;
|
|
15
|
+
}
|
|
16
|
+
//# sourceMappingURL=xor-encrypt.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"xor-encrypt.js","sourceRoot":"","sources":["../src/xor-encrypt.ts"],"names":[],"mappings":";;AAKA,gCAaC;AAbD,SAAgB,UAAU,CAAC,EAAE,KAAK,EAAE,IAAI,EAAmB;IACzD,IAAI,CAAC,KAAK,IAAI,CAAC,KAAK,CAAC,IAAI,EAAE,IAAI,CAAC,IAAI,EAAE,CAAC;QACrC,OAAO,EAAE,CAAC;IACZ,CAAC;IAED,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,IAAI,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC;QACrC,KAAK,GAAG,KAAK;aACV,KAAK,CAAC,EAAE,CAAC;aACT,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,MAAM,CAAC,YAAY,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,GAAG,IAAI,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,CAAC;aAC9E,IAAI,CAAC,EAAE,CAAC,CAAC;IACd,CAAC;IAED,OAAO,KAAK,CAAC;AACf,CAAC"}
|
package/package.json
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@senhainfo/shared-utils",
|
|
3
|
+
"version": "1.0.1",
|
|
4
|
+
"repository": "https://github.com/senha-info/shared-utils.git",
|
|
5
|
+
"author": "Bruno Gaspar <bruninhoogaspar@gmail.com>",
|
|
6
|
+
"license": "MIT",
|
|
7
|
+
"main": "./lib/index.js",
|
|
8
|
+
"types": "./lib/index.d.ts",
|
|
9
|
+
"files": [
|
|
10
|
+
"lib"
|
|
11
|
+
],
|
|
12
|
+
"scripts": {
|
|
13
|
+
"build": "tsc",
|
|
14
|
+
"prepare": "npm run build"
|
|
15
|
+
},
|
|
16
|
+
"devDependencies": {
|
|
17
|
+
"@types/node": "^22.13.5",
|
|
18
|
+
"tsx": "^4.19.3",
|
|
19
|
+
"typescript": "^5.7.3"
|
|
20
|
+
},
|
|
21
|
+
"dependencies": {
|
|
22
|
+
"axios": "^1.8.1",
|
|
23
|
+
"date-fns": "^4.1.0"
|
|
24
|
+
}
|
|
25
|
+
}
|