@contentstack/datasync-manager 2.0.5 → 2.0.6
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/LICENSE +1 -1
- package/dist/plugins/helper.js +3 -0
- package/dist/util/index.js +6 -5
- package/package.json +19 -19
package/LICENSE
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
The MIT License
|
|
2
2
|
|
|
3
|
-
Copyright (c)
|
|
3
|
+
Copyright (c) 2024 Contentstack LLC <https://www.contentstack.com/>
|
|
4
4
|
|
|
5
5
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
6
|
of this software and associated documentation files (the "Software"), to deal
|
package/dist/plugins/helper.js
CHANGED
|
@@ -193,3 +193,6 @@ exports.buildAssetObject = (asset, locale, entry_uid, content_type_uid) => {
|
|
|
193
193
|
asset.filename = matches[5];
|
|
194
194
|
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 });
|
|
195
195
|
};
|
|
196
|
+
exports.sanitizePath = (str) => {
|
|
197
|
+
return str === null || str === void 0 ? void 0 : str.replace(/^(\.\.(\/|\\|$))+/, '');
|
|
198
|
+
};
|
package/dist/util/index.js
CHANGED
|
@@ -27,6 +27,7 @@ const fs_1 = require("./fs");
|
|
|
27
27
|
const logger_1 = require("./logger");
|
|
28
28
|
const unprocessible_1 = require("./unprocessible");
|
|
29
29
|
const validations_1 = require("./validations");
|
|
30
|
+
const helper_1 = require("./../plugins/helper");
|
|
30
31
|
const debug = (0, debug_1.default)('util:index');
|
|
31
32
|
const formattedAssetType = '_assets';
|
|
32
33
|
const formattedContentType = '_content_types';
|
|
@@ -130,8 +131,8 @@ const formatItems = (items, config) => {
|
|
|
130
131
|
items[i]._type = config.contentstack.actions.publish;
|
|
131
132
|
// extra keys
|
|
132
133
|
items[i]._synced_at = time;
|
|
133
|
-
items[i] = (0, lodash_1.merge)(items[i], items[i].data);
|
|
134
134
|
items[i].locale = items[i].data.publish_details.locale;
|
|
135
|
+
items[i] = (0, lodash_1.merge)(items[i], items[i].data);
|
|
135
136
|
break;
|
|
136
137
|
case 'asset_unpublished':
|
|
137
138
|
delete items[i].type;
|
|
@@ -151,8 +152,8 @@ const formatItems = (items, config) => {
|
|
|
151
152
|
items[i]._content_type_uid = items[i].content_type_uid;
|
|
152
153
|
// extra keys
|
|
153
154
|
items[i]._synced_at = time;
|
|
154
|
-
items[i] = (0, lodash_1.merge)(items[i], items[i].data);
|
|
155
155
|
items[i].locale = items[i].data.publish_details.locale;
|
|
156
|
+
items[i] = (0, lodash_1.merge)(items[i], items[i].data);
|
|
156
157
|
break;
|
|
157
158
|
case 'entry_unpublished':
|
|
158
159
|
delete items[i].type;
|
|
@@ -396,19 +397,19 @@ const normalizePluginPath = (config, plugin, isInternal) => {
|
|
|
396
397
|
}
|
|
397
398
|
return plugin.path;
|
|
398
399
|
}
|
|
399
|
-
pluginPath = (0, path_1.resolve)((0, path_1.join)(config.paths.baseDir, plugin.name, 'index.js'));
|
|
400
|
+
pluginPath = (0, path_1.resolve)((0, path_1.join)((0, helper_1.sanitizePath)(config.paths.baseDir), (0, helper_1.sanitizePath)(plugin.name), 'index.js'));
|
|
400
401
|
if (!(0, fs_1.existsSync)(pluginPath)) {
|
|
401
402
|
throw new Error(`${pluginPath} does not exist!`);
|
|
402
403
|
}
|
|
403
404
|
return pluginPath;
|
|
404
405
|
}
|
|
405
406
|
if (isInternal) {
|
|
406
|
-
pluginPath = (0, path_1.join)(__dirname, '..', 'plugins', plugin.name.slice(13), 'index.js');
|
|
407
|
+
pluginPath = (0, path_1.join)((0, helper_1.sanitizePath)(__dirname), '..', 'plugins', (0, helper_1.sanitizePath)(plugin.name.slice(13)), 'index.js');
|
|
407
408
|
if ((0, fs_1.existsSync)(pluginPath)) {
|
|
408
409
|
return pluginPath;
|
|
409
410
|
}
|
|
410
411
|
}
|
|
411
|
-
pluginPath = (0, path_1.resolve)((0, path_1.join)(config.paths.plugin, plugin.name, 'index.js'));
|
|
412
|
+
pluginPath = (0, path_1.resolve)((0, path_1.join)((0, helper_1.sanitizePath)(config.paths.plugin), (0, helper_1.sanitizePath)(plugin.name), 'index.js'));
|
|
412
413
|
if (!(0, fs_1.existsSync)(pluginPath)) {
|
|
413
414
|
throw new Error(`Unable to find plugin: ${JSON.stringify(plugin)}`);
|
|
414
415
|
}
|
package/package.json
CHANGED
|
@@ -1,41 +1,41 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@contentstack/datasync-manager",
|
|
3
3
|
"author": "Contentstack LLC <support@contentstack.com>",
|
|
4
|
-
"version": "2.0.
|
|
4
|
+
"version": "2.0.6",
|
|
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": "^6.0.4",
|
|
9
|
-
"debug": "^4.3.
|
|
9
|
+
"debug": "^4.3.7",
|
|
10
10
|
"dns-socket": "^4.2.2",
|
|
11
11
|
"lodash": "^4.17.21",
|
|
12
|
-
"marked": "^4.
|
|
12
|
+
"marked": "^4.3.0",
|
|
13
13
|
"write-file-atomic": "4.0.2"
|
|
14
14
|
},
|
|
15
15
|
"devDependencies": {
|
|
16
16
|
"@semantic-release/commit-analyzer": "^9.0.2",
|
|
17
17
|
"@semantic-release/git": "^10.0.1",
|
|
18
|
-
"@semantic-release/npm": "^
|
|
18
|
+
"@semantic-release/npm": "^12.0.1",
|
|
19
19
|
"@semantic-release/release-notes-generator": "^10.0.3",
|
|
20
20
|
"@types/debug": "0.0.31",
|
|
21
|
-
"@types/jest": "23.3.
|
|
22
|
-
"@types/lodash": "4.14.
|
|
23
|
-
"@types/marked": "^4.
|
|
21
|
+
"@types/jest": "23.3.14",
|
|
22
|
+
"@types/lodash": "4.14.202",
|
|
23
|
+
"@types/marked": "^4.3.2",
|
|
24
24
|
"@types/mkdirp": "0.5.2",
|
|
25
|
-
"@types/nock": "9.3.
|
|
26
|
-
"@types/node": "10.12.
|
|
27
|
-
"@types/rimraf": "2.0.
|
|
28
|
-
"@types/write-file-atomic": "2.1.
|
|
29
|
-
"eslint": "^8.
|
|
30
|
-
"jest": "^29.0
|
|
31
|
-
"jest-html-reporter": "^3.
|
|
25
|
+
"@types/nock": "9.3.1",
|
|
26
|
+
"@types/node": "10.12.30",
|
|
27
|
+
"@types/rimraf": "2.0.5",
|
|
28
|
+
"@types/write-file-atomic": "2.1.2",
|
|
29
|
+
"eslint": "^8.57.1",
|
|
30
|
+
"jest": "^29.7.0",
|
|
31
|
+
"jest-html-reporter": "^3.10.2",
|
|
32
32
|
"mkdirp": "^1.0.4",
|
|
33
33
|
"nock": "^10.0.6",
|
|
34
|
-
"rimraf": "^2.
|
|
35
|
-
"semantic-release": "^
|
|
36
|
-
"ts-jest": "^29.
|
|
37
|
-
"tslint": "^5.
|
|
38
|
-
"typescript": "^4.9.
|
|
34
|
+
"rimraf": "^2.7.1",
|
|
35
|
+
"semantic-release": "^24.1.2",
|
|
36
|
+
"ts-jest": "^29.2.5",
|
|
37
|
+
"tslint": "^5.20.1",
|
|
38
|
+
"typescript": "^4.9.5"
|
|
39
39
|
},
|
|
40
40
|
"scripts": {
|
|
41
41
|
"clean": "rimraf dist typings coverage .tokens .ledger .checkpoint",
|