pangea-server 3.3.22 → 3.3.24
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/auth.helpers.js +1 -1
- package/dist/database/db.class.js +1 -3
- package/dist/helpers/file.helpers.d.ts +2 -2
- package/dist/helpers/file.helpers.js +5 -5
- package/dist/helpers/index.d.ts +1 -1
- package/dist/helpers/index.js +1 -1
- package/dist/helpers/pass.helpers.d.ts +4 -0
- package/dist/helpers/pass.helpers.js +16 -0
- package/package.json +1 -1
|
@@ -15,7 +15,7 @@ async function login(authHeader, db, accessToken, userCtor, extraWhere = {}) {
|
|
|
15
15
|
const user = await db.findOneOrNull(userCtor, where, { scopes: ['withHiddenAttributes'] });
|
|
16
16
|
if (!user)
|
|
17
17
|
helpers_1.AppError.ThrowInvalidCredentials();
|
|
18
|
-
const isPasswordValid = await helpers_1.
|
|
18
|
+
const isPasswordValid = await helpers_1.Pass.Compare(password, user.password);
|
|
19
19
|
if (!isPasswordValid)
|
|
20
20
|
helpers_1.AppError.ThrowInvalidCredentials();
|
|
21
21
|
return accessToken.getTokenData(userCtor, user);
|
|
@@ -292,9 +292,7 @@ function getInclude(model, config = {}, relDepth = new Map()) {
|
|
|
292
292
|
};
|
|
293
293
|
}
|
|
294
294
|
function getFinalOrder(order, config = {}) {
|
|
295
|
-
|
|
296
|
-
return;
|
|
297
|
-
const finalOrder = Object.entries(order).map(([key, value]) => {
|
|
295
|
+
const finalOrder = Object.entries(order || {}).map(([key, value]) => {
|
|
298
296
|
const parts = key.split('.');
|
|
299
297
|
const direction = value.toUpperCase();
|
|
300
298
|
return [...parts, direction];
|
|
@@ -3,6 +3,6 @@ export declare function uploadImage(image: UploadableImage, previousFile: Previo
|
|
|
3
3
|
export declare function uploadImages(images: UploadableImage[], ...folders: string[]): Promise<string[]>;
|
|
4
4
|
export declare function uploadVideo(file: MulterFile, previousFile: PreviousFile, ...folders: string[]): Promise<string>;
|
|
5
5
|
export declare function uploadVideos(files: MulterFile[], ...folders: string[]): Promise<string[]>;
|
|
6
|
-
export declare function deleteFile(
|
|
7
|
-
export declare function deleteFiles(
|
|
6
|
+
export declare function deleteFile(filename: string): Promise<void>;
|
|
7
|
+
export declare function deleteFiles(filenames: string[]): Promise<void[]>;
|
|
8
8
|
export {};
|
|
@@ -63,13 +63,13 @@ function uploadVideos(files, ...folders) {
|
|
|
63
63
|
return Promise.all(files.map((file) => uploadVideo(file, undefined, ...folders)));
|
|
64
64
|
}
|
|
65
65
|
exports.uploadVideos = uploadVideos;
|
|
66
|
-
async function deleteFile(
|
|
67
|
-
await s3.deleteObject({ Bucket: bucketName, Key:
|
|
68
|
-
(0, print_helpers_1.printInfo)('file', `file deleted from ${
|
|
66
|
+
async function deleteFile(filename) {
|
|
67
|
+
await s3.deleteObject({ Bucket: bucketName, Key: filename }).promise();
|
|
68
|
+
(0, print_helpers_1.printInfo)('file', `file deleted from ${filename}`);
|
|
69
69
|
}
|
|
70
70
|
exports.deleteFile = deleteFile;
|
|
71
|
-
function deleteFiles(
|
|
72
|
-
return Promise.all(
|
|
71
|
+
function deleteFiles(filenames) {
|
|
72
|
+
return Promise.all(filenames.map((filename) => deleteFile(filename)));
|
|
73
73
|
}
|
|
74
74
|
exports.deleteFiles = deleteFiles;
|
|
75
75
|
// internal functions
|
package/dist/helpers/index.d.ts
CHANGED
|
@@ -9,6 +9,6 @@ export * from './html-sanitize.helpers';
|
|
|
9
9
|
export * from './job.helpers';
|
|
10
10
|
export * from './mailer.helpers';
|
|
11
11
|
export * from './multer.helpers';
|
|
12
|
-
export * from './
|
|
12
|
+
export * from './pass.helpers';
|
|
13
13
|
export * from './print.helpers';
|
|
14
14
|
export * from './random.helpers';
|
package/dist/helpers/index.js
CHANGED
|
@@ -25,6 +25,6 @@ __exportStar(require("./html-sanitize.helpers"), exports);
|
|
|
25
25
|
__exportStar(require("./job.helpers"), exports);
|
|
26
26
|
__exportStar(require("./mailer.helpers"), exports);
|
|
27
27
|
__exportStar(require("./multer.helpers"), exports);
|
|
28
|
-
__exportStar(require("./
|
|
28
|
+
__exportStar(require("./pass.helpers"), exports);
|
|
29
29
|
__exportStar(require("./print.helpers"), exports);
|
|
30
30
|
__exportStar(require("./random.helpers"), exports);
|
|
@@ -0,0 +1,16 @@
|
|
|
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.Pass = void 0;
|
|
7
|
+
const bcrypt_1 = __importDefault(require("bcrypt"));
|
|
8
|
+
class Pass {
|
|
9
|
+
static Hash(data) {
|
|
10
|
+
return bcrypt_1.default.hash(data, 10);
|
|
11
|
+
}
|
|
12
|
+
static Compare(data, encrypted) {
|
|
13
|
+
return bcrypt_1.default.compare(data, encrypted);
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
exports.Pass = Pass;
|