speedly 1.2.24 → 1.2.28
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/cjs/modules/translation/translation.validator.d.ts +1 -3
- package/dist/cjs/modules/translation/translation.validator.js +12 -8
- package/dist/cjs/uploader/uploader.js +4 -4
- package/dist/cjs/util/makeOptional.d.ts +1 -0
- package/dist/cjs/util/makeOptional.js +17 -0
- package/dist/esm/modules/translation/translation.validator.js +10 -8
- package/dist/esm/uploader/uploader.js +4 -4
- package/dist/esm/util/makeOptional.d.ts +1 -0
- package/dist/esm/util/makeOptional.js +17 -0
- package/package.json +1 -1
|
@@ -1,14 +1,18 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
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
|
+
const makeOptional_1 = __importDefault(require("../../util/makeOptional"));
|
|
7
|
+
const yup_config_1 = require("./../../yup.config");
|
|
8
|
+
const paramId = (0, yup_config_1.object)({
|
|
9
|
+
id: (0, yup_config_1.string)().required('id is required').oid('id is invalid')
|
|
6
10
|
});
|
|
7
|
-
const schema = object({
|
|
8
|
-
translatedText: string().required('translatedText is required'),
|
|
11
|
+
const schema = (0, yup_config_1.object)({
|
|
12
|
+
translatedText: (0, yup_config_1.string)().required('translatedText is required'),
|
|
9
13
|
});
|
|
10
14
|
//? exports
|
|
11
15
|
exports.put = {
|
|
12
16
|
params: paramId,
|
|
13
|
-
|
|
17
|
+
body: (0, makeOptional_1.default)(schema)
|
|
14
18
|
};
|
|
@@ -38,7 +38,7 @@ exports.default = (destination = "/image", config = configs) => {
|
|
|
38
38
|
fs_1.default.mkdirSync(currentPath);
|
|
39
39
|
}
|
|
40
40
|
});
|
|
41
|
-
cb(null, path_1.default.join(
|
|
41
|
+
cb(null, path_1.default.join(configs.path, dest));
|
|
42
42
|
}
|
|
43
43
|
catch (err) {
|
|
44
44
|
cb(err, "");
|
|
@@ -53,7 +53,7 @@ exports.default = (destination = "/image", config = configs) => {
|
|
|
53
53
|
const originalName = Buffer.from(file.originalname, "latin1").toString("utf8");
|
|
54
54
|
const fileName = (configs.prefix ? configs.prefix + "-" : "") +
|
|
55
55
|
originalName.replace(/\.\w+$/, "") + ext;
|
|
56
|
-
const filePath = path_1.default.join(
|
|
56
|
+
const filePath = path_1.default.join(configs.path, dest, fileName);
|
|
57
57
|
console.log('uploader', 65, filePath);
|
|
58
58
|
try {
|
|
59
59
|
fs_1.default.existsSync(filePath);
|
|
@@ -103,7 +103,7 @@ exports.default = (destination = "/image", config = configs) => {
|
|
|
103
103
|
req.mediaId = mediaDoc.insertedId;
|
|
104
104
|
}
|
|
105
105
|
req.body[fieldName] = path_1.default
|
|
106
|
-
.join("/static", path_1.default.relative(path_1.default.join(
|
|
106
|
+
.join("/static", path_1.default.relative(path_1.default.join(configs.path), req.file.path))
|
|
107
107
|
.replaceAll(/\\/g, "/");
|
|
108
108
|
}
|
|
109
109
|
next();
|
|
@@ -115,7 +115,7 @@ exports.default = (destination = "/image", config = configs) => {
|
|
|
115
115
|
return res.status(405).json({ message: err.message });
|
|
116
116
|
if (req.files && Array.isArray(req.files) && req.files.length) {
|
|
117
117
|
req.body[fieldName] = req.files.map(file => path_1.default
|
|
118
|
-
.join("/static", path_1.default.relative(path_1.default.join(
|
|
118
|
+
.join("/static", path_1.default.relative(path_1.default.join(configs.path), file.path))
|
|
119
119
|
.replaceAll(/\\/g, "/"));
|
|
120
120
|
}
|
|
121
121
|
next();
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export default function (schema: any): any;
|
|
@@ -0,0 +1,17 @@
|
|
|
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.default = default_1;
|
|
7
|
+
const yup_config_1 = __importDefault(require("./../yup.config"));
|
|
8
|
+
function default_1(schema) {
|
|
9
|
+
if (schema.fields) {
|
|
10
|
+
const shape = {};
|
|
11
|
+
for (const key in schema.fields) {
|
|
12
|
+
shape[key] = schema.fields[key].optional();
|
|
13
|
+
}
|
|
14
|
+
return yup_config_1.default.object().shape(shape);
|
|
15
|
+
}
|
|
16
|
+
return schema;
|
|
17
|
+
}
|
|
@@ -1,16 +1,18 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
2
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
const
|
|
6
|
-
|
|
7
|
-
id: string().required('id is required').oid('id is invalid')
|
|
6
|
+
const makeOptional_1 = __importDefault(require("../../util/makeOptional"));
|
|
7
|
+
const yup_config_1 = require("./../../yup.config");
|
|
8
|
+
const paramId = (0, yup_config_1.object)({
|
|
9
|
+
id: (0, yup_config_1.string)().required('id is required').oid('id is invalid')
|
|
8
10
|
});
|
|
9
|
-
const schema = object({
|
|
10
|
-
translatedText: string().required('translatedText is required'),
|
|
11
|
+
const schema = (0, yup_config_1.object)({
|
|
12
|
+
translatedText: (0, yup_config_1.string)().required('translatedText is required'),
|
|
11
13
|
});
|
|
12
14
|
//? exports
|
|
13
15
|
exports.put = {
|
|
14
16
|
params: paramId,
|
|
15
|
-
|
|
17
|
+
body: (0, makeOptional_1.default)(schema)
|
|
16
18
|
};
|
|
@@ -38,7 +38,7 @@ exports.default = (destination = "/image", config = configs) => {
|
|
|
38
38
|
fs_1.default.mkdirSync(currentPath);
|
|
39
39
|
}
|
|
40
40
|
});
|
|
41
|
-
cb(null, path_1.default.join(
|
|
41
|
+
cb(null, path_1.default.join(configs.path, dest));
|
|
42
42
|
}
|
|
43
43
|
catch (err) {
|
|
44
44
|
cb(err, "");
|
|
@@ -53,7 +53,7 @@ exports.default = (destination = "/image", config = configs) => {
|
|
|
53
53
|
const originalName = Buffer.from(file.originalname, "latin1").toString("utf8");
|
|
54
54
|
const fileName = (configs.prefix ? configs.prefix + "-" : "") +
|
|
55
55
|
originalName.replace(/\.\w+$/, "") + ext;
|
|
56
|
-
const filePath = path_1.default.join(
|
|
56
|
+
const filePath = path_1.default.join(configs.path, dest, fileName);
|
|
57
57
|
console.log('uploader', 65, filePath);
|
|
58
58
|
try {
|
|
59
59
|
fs_1.default.existsSync(filePath);
|
|
@@ -103,7 +103,7 @@ exports.default = (destination = "/image", config = configs) => {
|
|
|
103
103
|
req.mediaId = mediaDoc.insertedId;
|
|
104
104
|
}
|
|
105
105
|
req.body[fieldName] = path_1.default
|
|
106
|
-
.join("/static", path_1.default.relative(path_1.default.join(
|
|
106
|
+
.join("/static", path_1.default.relative(path_1.default.join(configs.path), req.file.path))
|
|
107
107
|
.replaceAll(/\\/g, "/");
|
|
108
108
|
}
|
|
109
109
|
next();
|
|
@@ -115,7 +115,7 @@ exports.default = (destination = "/image", config = configs) => {
|
|
|
115
115
|
return res.status(405).json({ message: err.message });
|
|
116
116
|
if (req.files && Array.isArray(req.files) && req.files.length) {
|
|
117
117
|
req.body[fieldName] = req.files.map(file => path_1.default
|
|
118
|
-
.join("/static", path_1.default.relative(path_1.default.join(
|
|
118
|
+
.join("/static", path_1.default.relative(path_1.default.join(configs.path), file.path))
|
|
119
119
|
.replaceAll(/\\/g, "/"));
|
|
120
120
|
}
|
|
121
121
|
next();
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export default function (schema: any): any;
|
|
@@ -0,0 +1,17 @@
|
|
|
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.default = default_1;
|
|
7
|
+
const yup_config_1 = __importDefault(require("./../yup.config"));
|
|
8
|
+
function default_1(schema) {
|
|
9
|
+
if (schema.fields) {
|
|
10
|
+
const shape = {};
|
|
11
|
+
for (const key in schema.fields) {
|
|
12
|
+
shape[key] = schema.fields[key].optional();
|
|
13
|
+
}
|
|
14
|
+
return yup_config_1.default.object().shape(shape);
|
|
15
|
+
}
|
|
16
|
+
return schema;
|
|
17
|
+
}
|