@churchapps/apihelper 0.4.46 → 0.5.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/auth/AuthenticatedUser.d.ts +2 -2
- package/dist/auth/AuthenticatedUser.d.ts.map +1 -1
- package/dist/auth/AuthenticatedUser.js +1 -5
- package/dist/auth/AuthenticatedUser.js.map +1 -1
- package/dist/auth/CustomAuthProvider.d.ts +1 -1
- package/dist/auth/CustomAuthProvider.d.ts.map +1 -1
- package/dist/auth/CustomAuthProvider.js +9 -15
- package/dist/auth/CustomAuthProvider.js.map +1 -1
- package/dist/auth/Principal.js +1 -5
- package/dist/auth/Principal.js.map +1 -1
- package/dist/auth/index.d.ts +3 -3
- package/dist/auth/index.d.ts.map +1 -1
- package/dist/auth/index.js +3 -9
- package/dist/auth/index.js.map +1 -1
- package/dist/controllers/CustomBaseController.d.ts +12 -4
- package/dist/controllers/CustomBaseController.d.ts.map +1 -1
- package/dist/controllers/CustomBaseController.js +7 -11
- package/dist/controllers/CustomBaseController.js.map +1 -1
- package/dist/controllers/ErrorController.d.ts +2 -2
- package/dist/controllers/ErrorController.d.ts.map +1 -1
- package/dist/controllers/ErrorController.js +8 -14
- package/dist/controllers/ErrorController.js.map +1 -1
- package/dist/controllers/index.d.ts +2 -2
- package/dist/controllers/index.d.ts.map +1 -1
- package/dist/controllers/index.js +2 -7
- package/dist/controllers/index.js.map +1 -1
- package/dist/helpers/AwsHelper.js +21 -25
- package/dist/helpers/AwsHelper.js.map +1 -1
- package/dist/helpers/BasePermissions.js +1 -5
- package/dist/helpers/BasePermissions.js.map +1 -1
- package/dist/helpers/DB.js +6 -10
- package/dist/helpers/DB.js.map +1 -1
- package/dist/helpers/DBCreator.js +7 -14
- package/dist/helpers/DBCreator.js.map +1 -1
- package/dist/helpers/EmailHelper.d.ts +1 -1
- package/dist/helpers/EmailHelper.d.ts.map +1 -1
- package/dist/helpers/EmailHelper.js +19 -26
- package/dist/helpers/EmailHelper.js.map +1 -1
- package/dist/helpers/EncryptionHelper.js +6 -13
- package/dist/helpers/EncryptionHelper.js.map +1 -1
- package/dist/helpers/EnvironmentBase.js +5 -9
- package/dist/helpers/EnvironmentBase.js.map +1 -1
- package/dist/helpers/FileStorageHelper.js +24 -31
- package/dist/helpers/FileStorageHelper.js.map +1 -1
- package/dist/helpers/Interfaces.js +1 -2
- package/dist/helpers/LoggingHelper.js +10 -17
- package/dist/helpers/LoggingHelper.js.map +1 -1
- package/dist/helpers/MySqlHelper.js +1 -5
- package/dist/helpers/MySqlHelper.js.map +1 -1
- package/dist/helpers/OmitEmpty.js +1 -4
- package/dist/helpers/OmitEmpty.js.map +1 -1
- package/dist/helpers/Pool.js +7 -14
- package/dist/helpers/Pool.js.map +1 -1
- package/dist/helpers/SlugHelper.js +1 -5
- package/dist/helpers/SlugHelper.js.map +1 -1
- package/dist/helpers/index.d.ts +14 -14
- package/dist/helpers/index.d.ts.map +1 -1
- package/dist/helpers/index.js +15 -31
- package/dist/helpers/index.js.map +1 -1
- package/dist/index.d.ts +3 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -19
- package/dist/index.js.map +1 -1
- package/dist/models/ErrorLog.js +1 -5
- package/dist/models/ErrorLog.js.map +1 -1
- package/dist/models/index.d.ts +1 -1
- package/dist/models/index.d.ts.map +1 -1
- package/dist/models/index.js +1 -5
- package/dist/models/index.js.map +1 -1
- package/package.json +3 -2
- package/src/auth/AuthenticatedUser.ts +2 -2
- package/src/auth/CustomAuthProvider.ts +2 -2
- package/src/auth/index.ts +3 -3
- package/src/controllers/CustomBaseController.ts +2 -2
- package/src/controllers/ErrorController.ts +2 -2
- package/src/controllers/index.ts +2 -2
- package/src/helpers/AwsHelper.ts +1 -1
- package/src/helpers/DB.ts +2 -2
- package/src/helpers/DBCreator.ts +1 -1
- package/src/helpers/EmailHelper.ts +2 -1
- package/src/helpers/EncryptionHelper.ts +1 -1
- package/src/helpers/EnvironmentBase.ts +1 -1
- package/src/helpers/FileStorageHelper.ts +2 -2
- package/src/helpers/LoggingHelper.ts +1 -1
- package/src/helpers/Pool.ts +1 -1
- package/src/helpers/index.ts +14 -14
- package/src/index.ts +3 -3
- package/src/models/index.ts +1 -1
- package/tsconfig.json +2 -2
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AuthenticatedUser.d.ts","sourceRoot":"","sources":["../../src/auth/AuthenticatedUser.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"AuthenticatedUser.d.ts","sourceRoot":"","sources":["../../src/auth/AuthenticatedUser.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAC3C,OAAO,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AAEvD,qBAAa,iBAAiB;IACrB,EAAE,EAAE,MAAM,CAAC;IACX,QAAQ,EAAE,MAAM,CAAC;IACjB,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,MAAM,CAAC;IAChB,WAAW,EAAE,MAAM,EAAE,CAAC;IACtB,QAAQ,EAAE,MAAM,CAAC;IACjB,SAAS,EAAE,MAAM,CAAC;IAClB,QAAQ,EAAE,MAAM,CAAC;IACjB,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,QAAQ,CAAC,EAAE,MAAM,EAAE,CAAC;IACpB,cAAc,CAAC,EAAE,MAAM,EAAE,CAAC;IAC1B,GAAG,EAAE,MAAM,CAAC;gBAEA,SAAS,EAAE,SAAS;IAehC,WAAW,CAAC,UAAU,EAAE,WAAW;CAW3C"}
|
|
@@ -1,7 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.AuthenticatedUser = void 0;
|
|
4
|
-
class AuthenticatedUser {
|
|
1
|
+
export class AuthenticatedUser {
|
|
5
2
|
constructor(principal) {
|
|
6
3
|
this.jwt = principal.details.jwt || "";
|
|
7
4
|
this.id = principal.details.id || "";
|
|
@@ -28,5 +25,4 @@ class AuthenticatedUser {
|
|
|
28
25
|
return result;
|
|
29
26
|
}
|
|
30
27
|
}
|
|
31
|
-
exports.AuthenticatedUser = AuthenticatedUser;
|
|
32
28
|
//# sourceMappingURL=AuthenticatedUser.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AuthenticatedUser.js","sourceRoot":"","sources":["../../src/auth/AuthenticatedUser.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"AuthenticatedUser.js","sourceRoot":"","sources":["../../src/auth/AuthenticatedUser.ts"],"names":[],"mappings":"AAGA,MAAM,OAAO,iBAAiB;IAc5B,YAAmB,SAAoB;QACrC,IAAI,CAAC,GAAG,GAAG,SAAS,CAAC,OAAO,CAAC,GAAG,IAAI,EAAE,CAAC;QACvC,IAAI,CAAC,EAAE,GAAG,SAAS,CAAC,OAAO,CAAC,EAAE,IAAI,EAAE,CAAC;QACrC,IAAI,CAAC,QAAQ,GAAG,SAAS,CAAC,OAAO,CAAC,QAAQ,IAAI,EAAE,CAAC;QACjD,IAAI,CAAC,WAAW,GAAG,SAAS,CAAC,OAAO,CAAC,WAAW,IAAI,EAAE,CAAC;QACvD,IAAI,CAAC,OAAO,GAAG,SAAS,CAAC,OAAO,CAAC,OAAO,IAAI,EAAE,CAAC;QAC/C,IAAI,CAAC,KAAK,GAAG,SAAS,CAAC,OAAO,CAAC,KAAK,IAAI,EAAE,CAAC;QAC3C,IAAI,CAAC,QAAQ,GAAG,SAAS,CAAC,OAAO,CAAC,QAAQ,IAAI,EAAE,CAAC;QACjD,IAAI,CAAC,SAAS,GAAG,SAAS,CAAC,OAAO,CAAC,SAAS,IAAI,EAAE,CAAC;QACnD,IAAI,CAAC,QAAQ,GAAG,SAAS,CAAC,OAAO,CAAC,QAAQ,IAAI,EAAE,CAAC;QACjD,IAAI,CAAC,gBAAgB,GAAG,SAAS,CAAC,OAAO,CAAC,gBAAgB,CAAC;QAC3D,IAAI,CAAC,QAAQ,GAAG,SAAS,CAAC,OAAO,CAAC,QAAQ,IAAI,EAAE,CAAC;QACjD,IAAI,CAAC,cAAc,GAAG,SAAS,CAAC,OAAO,CAAC,cAAc,IAAI,EAAE,CAAC;IAC/D,CAAC;IAEM,WAAW,CAAC,UAAuB;QACxC,MAAM,GAAG,GAAG,CAAC,UAAU,CAAC,OAAO,CAAC;YAC9B,CAAC,CAAC,UAAU,CAAC,OAAO,GAAG,GAAG,GAAG,UAAU,CAAC,WAAW,GAAG,IAAI,GAAG,UAAU,CAAC,MAAM;YAC9E,CAAC,CAAC,UAAU,CAAC,WAAW,GAAG,IAAI,GAAG,UAAU,CAAC,MAAM,CAAC;QAEtD,IAAI,MAAM,GAAG,KAAK,CAAC;QACnB,IAAI,CAAC,WAAW,EAAE,OAAO,CAAC,CAAC,CAAS,EAAE,EAAE;YACtC,IAAI,CAAC,KAAK,GAAG;gBAAE,MAAM,GAAG,IAAI,CAAC;QAC/B,CAAC,CAAC,CAAC;QACH,OAAO,MAAM,CAAC;IAChB,CAAC;CACF"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { interfaces } from "inversify-express-utils";
|
|
2
2
|
import express from "express";
|
|
3
|
-
import { Principal } from "./";
|
|
3
|
+
import { Principal } from "./Principal.js";
|
|
4
4
|
export declare class CustomAuthProvider implements interfaces.AuthProvider {
|
|
5
5
|
getUser(req: express.Request, _res: express.Response, _next: express.NextFunction): Promise<Principal>;
|
|
6
6
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CustomAuthProvider.d.ts","sourceRoot":"","sources":["../../src/auth/CustomAuthProvider.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AACrD,OAAO,OAAO,MAAM,SAAS,CAAC;AAE9B,OAAO,EAAE,SAAS,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"CustomAuthProvider.d.ts","sourceRoot":"","sources":["../../src/auth/CustomAuthProvider.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AACrD,OAAO,OAAO,MAAM,SAAS,CAAC;AAE9B,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAG3C,qBACa,kBAAmB,YAAW,UAAU,CAAC,YAAY;IAEnD,OAAO,CAAC,GAAG,EAAE,OAAO,CAAC,OAAO,EAAE,IAAI,EAAE,OAAO,CAAC,QAAQ,EAAE,KAAK,EAAE,OAAO,CAAC,YAAY,GAAG,OAAO,CAAC,SAAS,CAAC;CAcpH"}
|
|
@@ -1,19 +1,13 @@
|
|
|
1
|
-
"use strict";
|
|
2
1
|
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
2
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
3
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
4
|
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
5
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
6
|
};
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
};
|
|
11
|
-
|
|
12
|
-
exports.CustomAuthProvider = void 0;
|
|
13
|
-
const inversify_1 = require("inversify");
|
|
14
|
-
const jsonwebtoken_1 = __importDefault(require("jsonwebtoken"));
|
|
15
|
-
const _1 = require("./");
|
|
16
|
-
const __1 = require("..");
|
|
7
|
+
import { injectable } from "inversify";
|
|
8
|
+
import jwt from "jsonwebtoken";
|
|
9
|
+
import { Principal } from "./Principal.js";
|
|
10
|
+
import { EnvironmentBase } from "../helpers/EnvironmentBase.js";
|
|
17
11
|
let CustomAuthProvider = class CustomAuthProvider {
|
|
18
12
|
// public async getUser(req: express.Request, res: express.Response, next: express.NextFunction): Promise<interfaces.Principal> {
|
|
19
13
|
async getUser(req, _res, _next) {
|
|
@@ -22,8 +16,8 @@ let CustomAuthProvider = class CustomAuthProvider {
|
|
|
22
16
|
const token = authHeader.split(" ")[1];
|
|
23
17
|
if (!token)
|
|
24
18
|
return null;
|
|
25
|
-
const decoded =
|
|
26
|
-
const result = decoded ? new
|
|
19
|
+
const decoded = jwt.verify(token, EnvironmentBase.jwtSecret);
|
|
20
|
+
const result = decoded ? new Principal(typeof decoded === 'object' && decoded !== null ? decoded : {}) : null;
|
|
27
21
|
if (result)
|
|
28
22
|
result.details.jwt = token;
|
|
29
23
|
return result;
|
|
@@ -31,8 +25,8 @@ let CustomAuthProvider = class CustomAuthProvider {
|
|
|
31
25
|
return null;
|
|
32
26
|
}
|
|
33
27
|
};
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
(0, inversify_1.injectable)()
|
|
28
|
+
CustomAuthProvider = __decorate([
|
|
29
|
+
injectable()
|
|
37
30
|
], CustomAuthProvider);
|
|
31
|
+
export { CustomAuthProvider };
|
|
38
32
|
//# sourceMappingURL=CustomAuthProvider.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CustomAuthProvider.js","sourceRoot":"","sources":["../../src/auth/CustomAuthProvider.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"CustomAuthProvider.js","sourceRoot":"","sources":["../../src/auth/CustomAuthProvider.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AAGvC,OAAO,GAAG,MAAM,cAAc,CAAC;AAC/B,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAC3C,OAAO,EAAE,eAAe,EAAE,MAAM,+BAA+B,CAAC;AAGzD,IAAM,kBAAkB,GAAxB,MAAM,kBAAkB;IAC7B,iIAAiI;IAC1H,KAAK,CAAC,OAAO,CAAC,GAAoB,EAAE,IAAsB,EAAE,KAA2B;QAC5F,MAAM,UAAU,GAAG,GAAG,CAAC,OAAO,CAAC,aAAa,CAAC;QAC7C,IAAI,UAAU,EAAE,CAAC;YACf,MAAM,KAAK,GAAG,UAAU,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC;YACvC,IAAI,CAAC,KAAK;gBAAE,OAAO,IAAI,CAAC;YACxB,MAAM,OAAO,GAAG,GAAG,CAAC,MAAM,CAAC,KAAK,EAAE,eAAe,CAAC,SAAS,CAAC,CAAC;YAE7D,MAAM,MAAM,GAAG,OAAO,CAAC,CAAC,CAAC,IAAI,SAAS,CAAC,OAAO,OAAO,KAAK,QAAQ,IAAI,OAAO,KAAK,IAAI,CAAC,CAAC,CAAC,OAAkC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC;YACzI,IAAI,MAAM;gBAAE,MAAM,CAAC,OAAO,CAAC,GAAG,GAAG,KAAK,CAAC;YACvC,OAAO,MAAM,CAAC;QAChB,CAAC;QAED,OAAO,IAAI,CAAC;IACd,CAAC;CACF,CAAA;AAhBY,kBAAkB;IAD9B,UAAU,EAAE;GACA,kBAAkB,CAgB9B"}
|
package/dist/auth/Principal.js
CHANGED
|
@@ -1,7 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.Principal = void 0;
|
|
4
|
-
class Principal {
|
|
1
|
+
export class Principal {
|
|
5
2
|
constructor(details) {
|
|
6
3
|
this.details = details;
|
|
7
4
|
}
|
|
@@ -15,5 +12,4 @@ class Principal {
|
|
|
15
12
|
return Promise.resolve(role === "admin");
|
|
16
13
|
}
|
|
17
14
|
}
|
|
18
|
-
exports.Principal = Principal;
|
|
19
15
|
//# sourceMappingURL=Principal.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Principal.js","sourceRoot":"","sources":["../../src/auth/Principal.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"Principal.js","sourceRoot":"","sources":["../../src/auth/Principal.ts"],"names":[],"mappings":"AAkBA,MAAM,OAAO,SAAS;IAGpB,YAAmB,OAAyB;QAC1C,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;IACzB,CAAC;IAEM,eAAe;QACpB,OAAO,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;IAC/B,CAAC;IAEM,eAAe,CAAC,UAA2B;QAChD,OAAO,OAAO,CAAC,OAAO,CAAC,UAAU,KAAK,IAAI,CAAC,CAAC;IAC9C,CAAC;IAEM,QAAQ,CAAC,IAAY;QAC1B,OAAO,OAAO,CAAC,OAAO,CAAC,IAAI,KAAK,OAAO,CAAC,CAAC;IAC3C,CAAC;CAEF"}
|
package/dist/auth/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { AuthenticatedUser } from "./AuthenticatedUser";
|
|
2
|
-
export { CustomAuthProvider } from "./CustomAuthProvider";
|
|
3
|
-
export { Principal } from "./Principal";
|
|
1
|
+
export { AuthenticatedUser } from "./AuthenticatedUser.js";
|
|
2
|
+
export { CustomAuthProvider } from "./CustomAuthProvider.js";
|
|
3
|
+
export { Principal } from "./Principal.js";
|
|
4
4
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/auth/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/auth/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/auth/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAC3D,OAAO,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;AAC7D,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC"}
|
package/dist/auth/index.js
CHANGED
|
@@ -1,10 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
var AuthenticatedUser_1 = require("./AuthenticatedUser");
|
|
5
|
-
Object.defineProperty(exports, "AuthenticatedUser", { enumerable: true, get: function () { return AuthenticatedUser_1.AuthenticatedUser; } });
|
|
6
|
-
var CustomAuthProvider_1 = require("./CustomAuthProvider");
|
|
7
|
-
Object.defineProperty(exports, "CustomAuthProvider", { enumerable: true, get: function () { return CustomAuthProvider_1.CustomAuthProvider; } });
|
|
8
|
-
var Principal_1 = require("./Principal");
|
|
9
|
-
Object.defineProperty(exports, "Principal", { enumerable: true, get: function () { return Principal_1.Principal; } });
|
|
1
|
+
export { AuthenticatedUser } from "./AuthenticatedUser.js";
|
|
2
|
+
export { CustomAuthProvider } from "./CustomAuthProvider.js";
|
|
3
|
+
export { Principal } from "./Principal.js";
|
|
10
4
|
//# sourceMappingURL=index.js.map
|
package/dist/auth/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/auth/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/auth/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAC3D,OAAO,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;AAC7D,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC"}
|
|
@@ -1,12 +1,20 @@
|
|
|
1
1
|
import { BaseHttpController } from "inversify-express-utils";
|
|
2
2
|
import express from "express";
|
|
3
|
-
import { LoggingHelper } from "../helpers/LoggingHelper";
|
|
4
|
-
import { AuthenticatedUser } from "../auth";
|
|
3
|
+
import { LoggingHelper } from "../helpers/LoggingHelper.js";
|
|
4
|
+
import { AuthenticatedUser } from "../auth/index.js";
|
|
5
5
|
export declare class CustomBaseController extends BaseHttpController {
|
|
6
6
|
logger: LoggingHelper;
|
|
7
7
|
constructor();
|
|
8
|
-
error(errors: string[]):
|
|
9
|
-
|
|
8
|
+
error(errors: string[]): {
|
|
9
|
+
readonly json: unknown;
|
|
10
|
+
readonly statusCode: number;
|
|
11
|
+
executeAsync(): Promise<import("inversify-express-utils").HttpResponseMessage>;
|
|
12
|
+
};
|
|
13
|
+
denyAccess(errors: string[]): {
|
|
14
|
+
readonly json: unknown;
|
|
15
|
+
readonly statusCode: number;
|
|
16
|
+
executeAsync(): Promise<import("inversify-express-utils").HttpResponseMessage>;
|
|
17
|
+
};
|
|
10
18
|
authUser(): AuthenticatedUser;
|
|
11
19
|
include(req: express.Request, item: string): boolean;
|
|
12
20
|
actionWrapper(_req: express.Request, _res: express.Response, fetchFunction: (_au: AuthenticatedUser) => unknown): Promise<unknown>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CustomBaseController.d.ts","sourceRoot":"","sources":["../../src/controllers/CustomBaseController.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;AAC7D,OAAO,OAAO,MAAM,SAAS,CAAC;AAC9B,OAAO,EAAE,aAAa,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"CustomBaseController.d.ts","sourceRoot":"","sources":["../../src/controllers/CustomBaseController.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;AAC7D,OAAO,OAAO,MAAM,SAAS,CAAC;AAC9B,OAAO,EAAE,aAAa,EAAE,MAAM,6BAA6B,CAAC;AAC5D,OAAO,EAAE,iBAAiB,EAAa,MAAM,kBAAkB,CAAC;AAEhE,qBAAa,oBAAqB,SAAQ,kBAAkB;IAEjD,MAAM,EAAE,aAAa,CAAC;;IAOtB,KAAK,CAAC,MAAM,EAAE,MAAM,EAAE;;;;;IAItB,UAAU,CAAC,MAAM,EAAE,MAAM,EAAE;;;;;IAI3B,QAAQ,IAAI,iBAAiB;IAK7B,OAAO,CAAC,GAAG,EAAE,OAAO,CAAC,OAAO,EAAE,IAAI,EAAE,MAAM;IAUpC,aAAa,CAAC,IAAI,EAAE,OAAO,CAAC,OAAO,EAAE,IAAI,EAAE,OAAO,CAAC,QAAQ,EAAE,aAAa,EAAE,CAAC,GAAG,EAAE,iBAAiB,KAAK,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC;IAWlI,iBAAiB,CAAC,IAAI,EAAE,OAAO,CAAC,OAAO,EAAE,IAAI,EAAE,OAAO,CAAC,QAAQ,EAAE,aAAa,EAAE,MAAM,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC;CAahI"}
|
|
@@ -1,13 +1,10 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
const LoggingHelper_1 = require("../helpers/LoggingHelper");
|
|
6
|
-
const auth_1 = require("../auth");
|
|
7
|
-
class CustomBaseController extends inversify_express_utils_1.BaseHttpController {
|
|
1
|
+
import { BaseHttpController } from "inversify-express-utils";
|
|
2
|
+
import { LoggingHelper } from "../helpers/LoggingHelper.js";
|
|
3
|
+
import { AuthenticatedUser, Principal } from "../auth/index.js";
|
|
4
|
+
export class CustomBaseController extends BaseHttpController {
|
|
8
5
|
constructor() {
|
|
9
6
|
super();
|
|
10
|
-
this.logger =
|
|
7
|
+
this.logger = LoggingHelper.getCurrent();
|
|
11
8
|
}
|
|
12
9
|
error(errors) {
|
|
13
10
|
return this.json({ errors }, 500);
|
|
@@ -17,9 +14,9 @@ class CustomBaseController extends inversify_express_utils_1.BaseHttpController
|
|
|
17
14
|
}
|
|
18
15
|
authUser() {
|
|
19
16
|
if (this.httpContext.user === null)
|
|
20
|
-
return new
|
|
17
|
+
return new AuthenticatedUser(new Principal({}));
|
|
21
18
|
else
|
|
22
|
-
return new
|
|
19
|
+
return new AuthenticatedUser(this.httpContext.user);
|
|
23
20
|
}
|
|
24
21
|
include(req, item) {
|
|
25
22
|
let result = false;
|
|
@@ -54,5 +51,4 @@ class CustomBaseController extends inversify_express_utils_1.BaseHttpController
|
|
|
54
51
|
}
|
|
55
52
|
}
|
|
56
53
|
}
|
|
57
|
-
exports.CustomBaseController = CustomBaseController;
|
|
58
54
|
//# sourceMappingURL=CustomBaseController.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CustomBaseController.js","sourceRoot":"","sources":["../../src/controllers/CustomBaseController.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"CustomBaseController.js","sourceRoot":"","sources":["../../src/controllers/CustomBaseController.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;AAE7D,OAAO,EAAE,aAAa,EAAE,MAAM,6BAA6B,CAAC;AAC5D,OAAO,EAAE,iBAAiB,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAEhE,MAAM,OAAO,oBAAqB,SAAQ,kBAAkB;IAIxD;QACI,KAAK,EAAE,CAAA;QACP,IAAI,CAAC,MAAM,GAAG,aAAa,CAAC,UAAU,EAAE,CAAC;IAC7C,CAAC;IAEM,KAAK,CAAC,MAAgB;QACzB,OAAO,IAAI,CAAC,IAAI,CAAC,EAAE,MAAM,EAAE,EAAE,GAAG,CAAC,CAAC;IACtC,CAAC;IAEM,UAAU,CAAC,MAAgB;QAC9B,OAAO,IAAI,CAAC,IAAI,CAAC,EAAE,MAAM,EAAE,EAAE,GAAG,CAAC,CAAC;IACtC,CAAC;IAEM,QAAQ;QACX,IAAI,IAAI,CAAC,WAAW,CAAC,IAAI,KAAK,IAAI;YAAE,OAAO,IAAI,iBAAiB,CAAC,IAAI,SAAS,CAAC,EAAE,CAAC,CAAC,CAAC;;YAC/E,OAAO,IAAI,iBAAiB,CAAC,IAAI,CAAC,WAAW,CAAC,IAAiB,CAAC,CAAC;IAC1E,CAAC;IAEM,OAAO,CAAC,GAAoB,EAAE,IAAY;QAC7C,IAAI,MAAM,GAAG,KAAK,CAAC;QACnB,IAAI,GAAG,CAAC,KAAK,CAAC,OAAO,KAAK,SAAS,EAAE,CAAC;YAClC,MAAM,KAAK,GAAW,GAAG,CAAC,KAAK,CAAC,OAAiB,CAAC;YAClD,MAAM,KAAK,GAAG,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;YAC/B,IAAI,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;gBAAE,MAAM,GAAG,IAAI,CAAC;QAChD,CAAC;QACD,OAAO,MAAM,CAAC;IAClB,CAAC;IAEM,KAAK,CAAC,aAAa,CAAC,IAAqB,EAAE,IAAsB,EAAE,aAAkD;QACxH,IAAI,CAAC;YACD,MAAM,MAAM,GAAG,MAAM,aAAa,CAAC,IAAI,CAAC,QAAQ,EAAE,CAAC,CAAC;YACpD,MAAM,IAAI,CAAC,MAAM,CAAC,KAAK,EAAE,CAAC;YAC1B,OAAO,MAAM,CAAC;QAClB,CAAC;QAAC,OAAO,CAAU,EAAE,CAAC;YAClB,yDAAyD;YACzD,MAAM,CAAC,CAAC;QACZ,CAAC;IACL,CAAC;IAEM,KAAK,CAAC,iBAAiB,CAAC,IAAqB,EAAE,IAAsB,EAAE,aAA4B;QACtG,IAAI,CAAC;YACD,MAAM,MAAM,GAAG,MAAM,aAAa,EAAE,CAAC;YACrC,MAAM,IAAI,CAAC,MAAM,CAAC,KAAK,EAAE,CAAC;YAC1B,OAAO,MAAM,CAAC;QAClB,CAAC;QAAC,OAAO,CAAU,EAAE,CAAC;YAClB,yDAAyD;YACzD,MAAM,CAAC,CAAC;QACZ,CAAC;IACL,CAAC;CAIJ"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import express from "express";
|
|
2
|
-
import { CustomBaseController } from "./CustomBaseController";
|
|
3
|
-
import { ErrorLog } from "../models";
|
|
2
|
+
import { CustomBaseController } from "./CustomBaseController.js";
|
|
3
|
+
import { ErrorLog } from "../models/index.js";
|
|
4
4
|
export declare class ErrorController extends CustomBaseController {
|
|
5
5
|
save(req: express.Request<{}, {}, ErrorLog[]>, _res: express.Response): Promise<ErrorLog[]>;
|
|
6
6
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ErrorController.d.ts","sourceRoot":"","sources":["../../src/controllers/ErrorController.ts"],"names":[],"mappings":"AACA,OAAO,OAAO,MAAM,SAAS,CAAC;AAC9B,OAAO,EAAE,oBAAoB,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"ErrorController.d.ts","sourceRoot":"","sources":["../../src/controllers/ErrorController.ts"],"names":[],"mappings":"AACA,OAAO,OAAO,MAAM,SAAS,CAAC;AAC9B,OAAO,EAAE,oBAAoB,EAAE,MAAM,2BAA2B,CAAC;AACjE,OAAO,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAG9C,qBACa,eAAgB,SAAQ,oBAAoB;IAGxC,IAAI,CAAC,GAAG,EAAE,OAAO,CAAC,OAAO,CAAC,EAAE,EAAE,EAAE,EAAE,QAAQ,EAAE,CAAC,EAAE,IAAI,EAAE,OAAO,CAAC,QAAQ,GAAG,OAAO,CAAC,QAAQ,EAAE,CAAC;CAsB3G"}
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
"use strict";
|
|
2
1
|
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
2
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
3
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
@@ -8,15 +7,10 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
|
|
|
8
7
|
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
8
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
9
|
};
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
};
|
|
14
|
-
|
|
15
|
-
exports.ErrorController = void 0;
|
|
16
|
-
const inversify_express_utils_1 = require("inversify-express-utils");
|
|
17
|
-
const express_1 = __importDefault(require("express"));
|
|
18
|
-
const CustomBaseController_1 = require("./CustomBaseController");
|
|
19
|
-
let ErrorController = class ErrorController extends CustomBaseController_1.CustomBaseController {
|
|
10
|
+
import { controller, httpPost } from "inversify-express-utils";
|
|
11
|
+
import express from "express";
|
|
12
|
+
import { CustomBaseController } from "./CustomBaseController.js";
|
|
13
|
+
let ErrorController = class ErrorController extends CustomBaseController {
|
|
20
14
|
async save(req, _res) {
|
|
21
15
|
// try {
|
|
22
16
|
/*
|
|
@@ -39,14 +33,14 @@ let ErrorController = class ErrorController extends CustomBaseController_1.Custo
|
|
|
39
33
|
// };
|
|
40
34
|
}
|
|
41
35
|
};
|
|
42
|
-
exports.ErrorController = ErrorController;
|
|
43
36
|
__decorate([
|
|
44
|
-
|
|
37
|
+
httpPost("/"),
|
|
45
38
|
__metadata("design:type", Function),
|
|
46
39
|
__metadata("design:paramtypes", [Object, Object]),
|
|
47
40
|
__metadata("design:returntype", Promise)
|
|
48
41
|
], ErrorController.prototype, "save", null);
|
|
49
|
-
|
|
50
|
-
|
|
42
|
+
ErrorController = __decorate([
|
|
43
|
+
controller("/errors")
|
|
51
44
|
], ErrorController);
|
|
45
|
+
export { ErrorController };
|
|
52
46
|
//# sourceMappingURL=ErrorController.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ErrorController.js","sourceRoot":"","sources":["../../src/controllers/ErrorController.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"ErrorController.js","sourceRoot":"","sources":["../../src/controllers/ErrorController.ts"],"names":[],"mappings":";;;;;;;;;AAAA,OAAO,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,yBAAyB,CAAC;AAC/D,OAAO,OAAO,MAAM,SAAS,CAAC;AAC9B,OAAO,EAAE,oBAAoB,EAAE,MAAM,2BAA2B,CAAC;AAK1D,IAAM,eAAe,GAArB,MAAM,eAAgB,SAAQ,oBAAoB;IAGxC,AAAN,KAAK,CAAC,IAAI,CAAC,GAAwC,EAAE,IAAsB;QAC9E,QAAQ;QACR;;;;;WAKG;QACH,GAAG,CAAC,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE;YACrB,IAAI,WAAW,GAAG,KAAK,CAAC,OAAO,CAAC;YAChC,IAAI,KAAK,CAAC,iBAAiB,KAAK,SAAS;gBAAE,WAAW,IAAI,IAAI,GAAG,KAAK,CAAC,iBAAiB,CAAC;YACzF,kFAAkF;YAClF,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,KAAK,CAAC,WAAW,EAAE,KAAK,CAAC,KAAK,EAAE,WAAW,CAAC,CAAC;QACjE,CAAC,CAAC,CAAC;QACH,MAAM,IAAI,CAAC,MAAM,CAAC,KAAK,EAAE,CAAC;QAC1B,OAAO,GAAG,CAAC,IAAI,CAAC;QAChB,gBAAgB;QAChB,iBAAiB;QACjB,KAAK;IAET,CAAC;CAEJ,CAAA;AAtBgB;IADZ,QAAQ,CAAC,GAAG,CAAC;;;;2CAqBb;AAvBQ,eAAe;IAD3B,UAAU,CAAC,SAAS,CAAC;GACT,eAAe,CAyB3B"}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export { CustomBaseController } from "./CustomBaseController";
|
|
2
|
-
export { ErrorController } from "./ErrorController";
|
|
1
|
+
export { CustomBaseController } from "./CustomBaseController.js";
|
|
2
|
+
export { ErrorController } from "./ErrorController.js";
|
|
3
3
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/controllers/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/controllers/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,MAAM,2BAA2B,CAAC;AACjE,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC"}
|
|
@@ -1,8 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
exports.ErrorController = exports.CustomBaseController = void 0;
|
|
4
|
-
var CustomBaseController_1 = require("./CustomBaseController");
|
|
5
|
-
Object.defineProperty(exports, "CustomBaseController", { enumerable: true, get: function () { return CustomBaseController_1.CustomBaseController; } });
|
|
6
|
-
var ErrorController_1 = require("./ErrorController");
|
|
7
|
-
Object.defineProperty(exports, "ErrorController", { enumerable: true, get: function () { return ErrorController_1.ErrorController; } });
|
|
1
|
+
export { CustomBaseController } from "./CustomBaseController.js";
|
|
2
|
+
export { ErrorController } from "./ErrorController.js";
|
|
8
3
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/controllers/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/controllers/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,MAAM,2BAA2B,CAAC;AACjE,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC"}
|
|
@@ -1,18 +1,15 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
const _1 = require(".");
|
|
7
|
-
const client_ssm_1 = require("@aws-sdk/client-ssm");
|
|
8
|
-
class AwsHelper {
|
|
1
|
+
import { S3Client, GetObjectCommand, PutObjectCommand, DeleteObjectCommand, CopyObjectCommand, ListObjectsV2Command } from "@aws-sdk/client-s3";
|
|
2
|
+
import { createPresignedPost } from "@aws-sdk/s3-presigned-post";
|
|
3
|
+
import { EnvironmentBase } from "./EnvironmentBase.js";
|
|
4
|
+
import { SSMClient, GetParameterCommand } from "@aws-sdk/client-ssm";
|
|
5
|
+
export class AwsHelper {
|
|
9
6
|
//Pulls from AWS SSM Parameter Store
|
|
10
7
|
static async readParameter(parameterName) {
|
|
11
8
|
let result = "";
|
|
12
9
|
try {
|
|
13
|
-
const ssm = new
|
|
10
|
+
const ssm = new SSMClient({ region: "us-east-2" });
|
|
14
11
|
const params = { Name: parameterName, WithDecryption: true };
|
|
15
|
-
const command = new
|
|
12
|
+
const command = new GetParameterCommand(params);
|
|
16
13
|
const response = await ssm.send(command);
|
|
17
14
|
result = response?.Parameter?.Value || "";
|
|
18
15
|
}
|
|
@@ -23,15 +20,15 @@ class AwsHelper {
|
|
|
23
20
|
}
|
|
24
21
|
static getClient() {
|
|
25
22
|
if (!this._client) {
|
|
26
|
-
this._client = new
|
|
23
|
+
this._client = new S3Client({});
|
|
27
24
|
}
|
|
28
25
|
return this._client;
|
|
29
26
|
}
|
|
30
27
|
static async S3PresignedUrl(key) {
|
|
31
28
|
if (key.startsWith("/"))
|
|
32
29
|
key = key.substring(1);
|
|
33
|
-
const { url, fields } = await
|
|
34
|
-
Bucket:
|
|
30
|
+
const { url, fields } = await createPresignedPost(this.getClient(), {
|
|
31
|
+
Bucket: EnvironmentBase.s3Bucket,
|
|
35
32
|
Key: key,
|
|
36
33
|
Conditions: [
|
|
37
34
|
["starts-with", "$Content-Type", ""],
|
|
@@ -44,8 +41,8 @@ class AwsHelper {
|
|
|
44
41
|
static async S3Upload(key, contentType, contents) {
|
|
45
42
|
if (key.startsWith("/"))
|
|
46
43
|
key = key.substring(1);
|
|
47
|
-
const command = new
|
|
48
|
-
Bucket:
|
|
44
|
+
const command = new PutObjectCommand({
|
|
45
|
+
Bucket: EnvironmentBase.s3Bucket,
|
|
49
46
|
Key: key,
|
|
50
47
|
Body: contents,
|
|
51
48
|
ACL: "public-read",
|
|
@@ -56,8 +53,8 @@ class AwsHelper {
|
|
|
56
53
|
static async S3Remove(key) {
|
|
57
54
|
if (key.startsWith("/"))
|
|
58
55
|
key = key.substring(1);
|
|
59
|
-
const command = new
|
|
60
|
-
Bucket:
|
|
56
|
+
const command = new DeleteObjectCommand({
|
|
57
|
+
Bucket: EnvironmentBase.s3Bucket,
|
|
61
58
|
Key: key
|
|
62
59
|
});
|
|
63
60
|
await this.getClient().send(command);
|
|
@@ -71,16 +68,16 @@ class AwsHelper {
|
|
|
71
68
|
return this.S3Rename(oldKey, newKey);
|
|
72
69
|
}
|
|
73
70
|
static async S3Copy(oldKey, newKey) {
|
|
74
|
-
const command = new
|
|
75
|
-
Bucket:
|
|
76
|
-
CopySource: `/${
|
|
71
|
+
const command = new CopyObjectCommand({
|
|
72
|
+
Bucket: EnvironmentBase.s3Bucket,
|
|
73
|
+
CopySource: `/${EnvironmentBase.s3Bucket}/${oldKey}`,
|
|
77
74
|
Key: newKey,
|
|
78
75
|
ACL: "public-read"
|
|
79
76
|
});
|
|
80
77
|
await this.getClient().send(command);
|
|
81
78
|
}
|
|
82
79
|
static async S3List(path) {
|
|
83
|
-
return this.S3ListMultiPage(this.getClient(),
|
|
80
|
+
return this.S3ListMultiPage(this.getClient(), EnvironmentBase.s3Bucket, path);
|
|
84
81
|
}
|
|
85
82
|
static async S3ListMultiPage(s3, bucket, path) {
|
|
86
83
|
const result = [];
|
|
@@ -93,7 +90,7 @@ class AwsHelper {
|
|
|
93
90
|
return result;
|
|
94
91
|
}
|
|
95
92
|
static async S3ListManual(s3, bucket, path, continuationToken) {
|
|
96
|
-
const command = new
|
|
93
|
+
const command = new ListObjectsV2Command({
|
|
97
94
|
Bucket: bucket,
|
|
98
95
|
Prefix: path,
|
|
99
96
|
MaxKeys: 10000,
|
|
@@ -103,8 +100,8 @@ class AwsHelper {
|
|
|
103
100
|
}
|
|
104
101
|
static async S3Read(key) {
|
|
105
102
|
try {
|
|
106
|
-
const command = new
|
|
107
|
-
Bucket:
|
|
103
|
+
const command = new GetObjectCommand({
|
|
104
|
+
Bucket: EnvironmentBase.s3Bucket,
|
|
108
105
|
Key: key
|
|
109
106
|
});
|
|
110
107
|
const response = await this.getClient().send(command);
|
|
@@ -116,5 +113,4 @@ class AwsHelper {
|
|
|
116
113
|
}
|
|
117
114
|
}
|
|
118
115
|
}
|
|
119
|
-
exports.AwsHelper = AwsHelper;
|
|
120
116
|
//# sourceMappingURL=AwsHelper.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AwsHelper.js","sourceRoot":"","sources":["../../src/helpers/AwsHelper.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"AwsHelper.js","sourceRoot":"","sources":["../../src/helpers/AwsHelper.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,mBAAmB,EAAE,iBAAiB,EAAE,oBAAoB,EAAuB,MAAM,oBAAoB,CAAC;AACrK,OAAO,EAAE,mBAAmB,EAAE,MAAM,4BAA4B,CAAC;AACjE,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AACvD,OAAO,EAAE,SAAS,EAAE,mBAAmB,EAAE,MAAM,qBAAqB,CAAC;AAErE,MAAM,OAAO,SAAS;IAEpB,oCAAoC;IACpC,MAAM,CAAC,KAAK,CAAC,aAAa,CAAC,aAAqB;QAC9C,IAAI,MAAM,GAAG,EAAE,CAAC;QAChB,IAAI,CAAC;YACH,MAAM,GAAG,GAAG,IAAI,SAAS,CAAC,EAAE,MAAM,EAAE,WAAW,EAAE,CAAC,CAAC;YACnD,MAAM,MAAM,GAAG,EAAE,IAAI,EAAE,aAAa,EAAE,cAAc,EAAE,IAAI,EAAE,CAAC;YAC7D,MAAM,OAAO,GAAG,IAAI,mBAAmB,CAAC,MAAM,CAAC,CAAC;YAChD,MAAM,QAAQ,GAAG,MAAM,GAAG,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;YACzC,MAAM,GAAG,QAAQ,EAAE,SAAS,EAAE,KAAK,IAAI,EAAE,CAAC;QAC5C,CAAC;QAAC,MAAM,CAAC;YACP,MAAM,GAAG,EAAE,CAAC;QACd,CAAC;QACD,OAAO,MAAM,CAAC;IAChB,CAAC;IAKO,MAAM,CAAC,SAAS;QACtB,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Q,CAAC,IAAI,EAAE,iBAAiB,EAAE,CAAC;QAClD,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,OAAO,CAAC,KAAK,CAAC,wBAAwB,EAAE,KAAK,CAAC,CAAC;YAC/C,OAAO,IAAI,CAAC;QACd,CAAC;IACH,CAAC;CAEF"}
|
|
@@ -1,9 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.BasePermissions = void 0;
|
|
4
|
-
class BasePermissions {
|
|
1
|
+
export class BasePermissions {
|
|
5
2
|
}
|
|
6
|
-
exports.BasePermissions = BasePermissions;
|
|
7
3
|
BasePermissions.forms = {
|
|
8
4
|
admin: { contentType: "Forms", action: "Admin" },
|
|
9
5
|
edit: { contentType: "Forms", action: "Edit" }
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BasePermissions.js","sourceRoot":"","sources":["../../src/helpers/BasePermissions.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"BasePermissions.js","sourceRoot":"","sources":["../../src/helpers/BasePermissions.ts"],"names":[],"mappings":"AAAA,MAAM,OAAO,eAAe;;AACnB,qBAAK,GAAG;IACb,KAAK,EAAE,EAAE,WAAW,EAAE,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE;IAChD,IAAI,EAAE,EAAE,WAAW,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE;CAC/C,CAAC;AACK,qBAAK,GAAG;IACb,IAAI,EAAE,EAAE,WAAW,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE;CAC/C,CAAC;AACK,qBAAK,GAAG;IACb,IAAI,EAAE,EAAE,WAAW,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE;CAC/C,CAAC;AACK,wBAAQ,GAAG;IAChB,IAAI,EAAE,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,EAAE;CAClD,CAAC"}
|
package/dist/helpers/DB.js
CHANGED
|
@@ -1,13 +1,10 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
const Pool_1 = require("./Pool");
|
|
5
|
-
const LoggingHelper_1 = require("./LoggingHelper");
|
|
6
|
-
class DB {
|
|
1
|
+
import { Pool } from "./Pool.js";
|
|
2
|
+
import { LoggingHelper } from "./LoggingHelper.js";
|
|
3
|
+
export class DB {
|
|
7
4
|
// wraps in promise
|
|
8
5
|
static async getConnection() {
|
|
9
6
|
const promise = new Promise((resolve, reject) => {
|
|
10
|
-
|
|
7
|
+
Pool.current.getConnection((ex, conn) => { if (ex)
|
|
11
8
|
reject(ex);
|
|
12
9
|
else
|
|
13
10
|
resolve(conn); });
|
|
@@ -21,7 +18,7 @@ class DB {
|
|
|
21
18
|
const promise = new Promise((resolve, reject) => {
|
|
22
19
|
connection.query(sql, params, async (ex, rows) => {
|
|
23
20
|
if (ex) {
|
|
24
|
-
|
|
21
|
+
LoggingHelper.getCurrent().error(ex);
|
|
25
22
|
reject(ex);
|
|
26
23
|
}
|
|
27
24
|
else {
|
|
@@ -39,7 +36,7 @@ class DB {
|
|
|
39
36
|
result = await this.getQuery(connection, sql, params);
|
|
40
37
|
}
|
|
41
38
|
catch (ex) {
|
|
42
|
-
|
|
39
|
+
LoggingHelper.getCurrent().error(ex);
|
|
43
40
|
}
|
|
44
41
|
finally {
|
|
45
42
|
connection.release();
|
|
@@ -51,5 +48,4 @@ class DB {
|
|
|
51
48
|
return result?.length > 0 ? result[0] : null;
|
|
52
49
|
}
|
|
53
50
|
}
|
|
54
|
-
exports.DB = DB;
|
|
55
51
|
//# sourceMappingURL=DB.js.map
|
package/dist/helpers/DB.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DB.js","sourceRoot":"","sources":["../../src/helpers/DB.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"DB.js","sourceRoot":"","sources":["../../src/helpers/DB.ts"],"names":[],"mappings":"AAAA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;QACpD,IAAI,MAAM,GAAY,IAAI,CAAC;QAC3B,MAAM,UAAU,GAAG,MAAM,IAAI,CAAC,aAAa,EAAE,CAAC;QAC9C,IAAI,CAAC;YAAC,MAAM,GAAG,MAAM,IAAI,CAAC,QAAQ,CAAC,UAAU,EAAE,GAAG,EAAE,MAAM,CAAC,CAAC;QAAC,CAAC;QAC9D,OAAO,EAAW,EAAE,CAAC;YAAC,aAAa,CAAC,UAAU,EAAE,CAAC,KAAK,CAAC,EAAW,CAAC,CAAC;QAAC,CAAC;gBAC9D,CAAC;YAAC,UAAU,CAAC,OAAO,EAAE,CAAC;QAAC,CAAC;QACjC,OAAO,MAAM,CAAC;IAClB,CAAC;IAEM,MAAM,CAAC,KAAK,CAAC,QAAQ,CAAC,GAAW,EAAE,MAAiB;QACvD,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,KAAK,CAAC,GAAG,EAAE,MAAM,CAAc,CAAC;QAC1D,OAAO,MAAM,EAAE,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC;IACjD,CAAC;CACJ"}
|
|
@@ -1,15 +1,9 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.DBCreator = void 0;
|
|
7
|
-
const dotenv_1 = __importDefault(require("dotenv"));
|
|
8
|
-
const fs_1 = __importDefault(require("fs"));
|
|
9
|
-
const DB_1 = require("./DB");
|
|
10
|
-
class DBCreator {
|
|
1
|
+
import dotenv from "dotenv";
|
|
2
|
+
import fs from "fs";
|
|
3
|
+
import { DB } from "./DB.js";
|
|
4
|
+
export class DBCreator {
|
|
11
5
|
static async init(selectedTables) {
|
|
12
|
-
|
|
6
|
+
dotenv.config();
|
|
13
7
|
const todo = [];
|
|
14
8
|
selectedTables.forEach(async (st) => {
|
|
15
9
|
this.tables.forEach(async (t) => {
|
|
@@ -23,7 +17,7 @@ class DBCreator {
|
|
|
23
17
|
}
|
|
24
18
|
static async runScript(title, file, customDelimeter) {
|
|
25
19
|
console.log("Creating '" + title + "'");
|
|
26
|
-
const sql =
|
|
20
|
+
const sql = fs.readFileSync(file, "utf-8");
|
|
27
21
|
let del = /;(?=END)\s*$|;(?!\nEND)\s*$/gm;
|
|
28
22
|
if (customDelimeter) {
|
|
29
23
|
del = /\$\$$/gm;
|
|
@@ -31,10 +25,9 @@ class DBCreator {
|
|
|
31
25
|
const statements = sql.split(del);
|
|
32
26
|
for (const statement of statements)
|
|
33
27
|
if (statement.length > 3)
|
|
34
|
-
await
|
|
28
|
+
await DB.query(statement, []);
|
|
35
29
|
}
|
|
36
30
|
}
|
|
37
|
-
exports.DBCreator = DBCreator;
|
|
38
31
|
DBCreator.tables = [
|
|
39
32
|
{ title: "Links", file: "links.mysql" },
|
|
40
33
|
{ title: "Pages", file: "pages.mysql" },
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DBCreator.js","sourceRoot":"","sources":["../../src/helpers/DBCreator.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"DBCreator.js","sourceRoot":"","sources":["../../src/helpers/DBCreator.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,MAAM,QAAQ,CAAC;AAC5B,OAAO,EAAE,MAAM,IAAI,CAAC;AACpB,OAAO,EAAE,EAAE,EAAE,MAAM,SAAS,CAAC;AAE7B,MAAM,OAAO,SAAS;IAQb,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,cAAwB;QAC/C,MAAM,CAAC,MAAM,EAAE,CAAC;QAEhB,MAAM,IAAI,GAAsC,EAAE,CAAC;QACnD,cAAc,CAAC,OAAO,CAAC,KAAK,EAAC,EAAE,EAAC,EAAE;YAChC,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,KAAK,EAAC,CAAC,EAAC,EAAE;gBAC5B,IAAI,CAAC,CAAC,KAAK,KAAK,EAAE;oBA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