@contentstack/datasync-manager 2.0.8 → 2.0.10
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/plugins/helper.js +1 -1
- package/dist/util/fs.js +5 -15
- package/package.json +7 -4
package/dist/plugins/helper.js
CHANGED
|
@@ -198,5 +198,5 @@ exports.buildAssetObject = (asset, locale, entry_uid, content_type_uid) => {
|
|
|
198
198
|
return Object.assign(Object.assign({ _content_type_uid: '_assets' }, asset), { _type: 'publish', entry_content_type: content_type_uid, entry_reffered_in: entry_uid, locale, uid: asset.uid });
|
|
199
199
|
};
|
|
200
200
|
exports.sanitizePath = (str) => {
|
|
201
|
-
return str === null || str === void 0 ? void 0 : str.replace(/^(\.\.(\/|\\|$))
|
|
201
|
+
return str === null || str === void 0 ? void 0 : str.replace(/^([\/\\]){2,}/, "./").replace(/[\/\\]+/g, "/").replace(/(\.\.(\/|\\|$))+/g, ""); // Remove directory traversal (../ or ..\)
|
|
202
202
|
};
|
package/dist/util/fs.js
CHANGED
|
@@ -13,7 +13,7 @@ exports.mkdirpSync = exports.stat = exports.mkdir = exports.readFileSync = expor
|
|
|
13
13
|
const Debug = require("debug");
|
|
14
14
|
const fs_1 = require("fs");
|
|
15
15
|
Object.defineProperty(exports, "existsSync", { enumerable: true, get: function () { return fs_1.existsSync; } });
|
|
16
|
-
const mkdirp_1 =
|
|
16
|
+
const mkdirp_1 = require("mkdirp");
|
|
17
17
|
const path_1 = require("path");
|
|
18
18
|
const write_file_atomic_1 = __importDefault(require("write-file-atomic"));
|
|
19
19
|
const debug = Debug('sm:util-fs');
|
|
@@ -29,7 +29,7 @@ const writeFile = (filePath, data) => {
|
|
|
29
29
|
try {
|
|
30
30
|
const fileDirectory = (0, path_1.dirname)(filePath);
|
|
31
31
|
if (!(0, fs_1.existsSync)(fileDirectory)) {
|
|
32
|
-
mkdirp_1.
|
|
32
|
+
(0, mkdirp_1.mkdirpSync)(fileDirectory);
|
|
33
33
|
}
|
|
34
34
|
return (0, write_file_atomic_1.default)(filePath, (typeof data === 'object') ? JSON.stringify(data) : data, (wfError) => {
|
|
35
35
|
if (wfError) {
|
|
@@ -98,19 +98,9 @@ exports.readFileSync = readFileSync;
|
|
|
98
98
|
*/
|
|
99
99
|
const mkdir = (path) => {
|
|
100
100
|
debug(`mkdir called on ${path}`);
|
|
101
|
-
return
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
if (error) {
|
|
105
|
-
return reject(error);
|
|
106
|
-
}
|
|
107
|
-
return resolve('');
|
|
108
|
-
});
|
|
109
|
-
}
|
|
110
|
-
catch (error) {
|
|
111
|
-
return reject(error);
|
|
112
|
-
}
|
|
113
|
-
});
|
|
101
|
+
return (0, mkdirp_1.mkdirp)(path)
|
|
102
|
+
.then(() => '')
|
|
103
|
+
.catch(error => Promise.reject(error));
|
|
114
104
|
};
|
|
115
105
|
exports.mkdir = mkdir;
|
|
116
106
|
/**
|
package/package.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@contentstack/datasync-manager",
|
|
3
3
|
"author": "Contentstack LLC <support@contentstack.com>",
|
|
4
|
-
"version": "2.0.
|
|
4
|
+
"version": "2.0.10",
|
|
5
5
|
"description": "The primary module of Contentstack DataSync. Syncs Contentstack data with your server using Contentstack Sync API",
|
|
6
6
|
"main": "dist/index.js",
|
|
7
7
|
"dependencies": {
|
|
8
8
|
"@braintree/sanitize-url": "^7.1.1",
|
|
9
|
-
"debug": "^4.4.
|
|
9
|
+
"debug": "^4.4.1",
|
|
10
10
|
"dns-socket": "^4.2.2",
|
|
11
11
|
"lodash": "^4.17.21",
|
|
12
12
|
"marked": "^4.3.0",
|
|
@@ -27,10 +27,12 @@
|
|
|
27
27
|
"@types/rimraf": "2.0.5",
|
|
28
28
|
"@types/write-file-atomic": "2.1.2",
|
|
29
29
|
"eslint": "^8.57.1",
|
|
30
|
+
"husky": "^9.1.7",
|
|
30
31
|
"jest": "^29.7.0",
|
|
31
32
|
"jest-html-reporter": "^3.10.2",
|
|
32
|
-
"mkdirp": "^
|
|
33
|
+
"mkdirp": "^3.0.1",
|
|
33
34
|
"nock": "^10.0.6",
|
|
35
|
+
"node-notifier": "^10.0.1",
|
|
34
36
|
"rimraf": "^2.7.1",
|
|
35
37
|
"semantic-release": "^24.2.1",
|
|
36
38
|
"ts-jest": "^29.2.5",
|
|
@@ -47,7 +49,8 @@
|
|
|
47
49
|
"tslint": "npx tslint -c tslint.json 'src/**/*.ts' --fix",
|
|
48
50
|
"test": "PLUGIN_PATH=./test/dummy jest --colors --coverage --verbose",
|
|
49
51
|
"lint": "eslint",
|
|
50
|
-
"semantic-release": "semantic-release"
|
|
52
|
+
"semantic-release": "semantic-release",
|
|
53
|
+
"husky-check": "npx husky && chmod +x .husky/pre-commit"
|
|
51
54
|
},
|
|
52
55
|
"engines": {
|
|
53
56
|
"node": ">=8"
|