Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@kentico/kontent-backup-manager

Package Overview
Dependencies
Maintainers
11
Versions
33
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@kentico/kontent-backup-manager - npm Package Compare versions

Comparing version 3.1.0 to 3.2.0

2

dist/cjs/lib/clean/clean.service.js

@@ -463,3 +463,3 @@ "use strict";

if (!languageId) {
throw Error("Missing language id for item '" + contentItemId + "'");
throw Error("Missing language id for item '".concat(contentItemId, "'"));
}

@@ -466,0 +466,0 @@ return [4 /*yield*/, this_6.client

@@ -85,3 +85,3 @@ "use strict";

if (newId) {
return replaceAttr + "=\"" + newId + "\"";
return "".concat(replaceAttr, "=\"").concat(newId, "\"");
}

@@ -88,0 +88,0 @@ }

@@ -97,3 +97,3 @@ #!/usr/bin/env node

if (config.enableLog) {
console.log("Exported: " + item.title + " | " + item.type);
console.log("Exported: ".concat(item.title, " | ").concat(item.type));
}

@@ -127,3 +127,3 @@ }

console.log("Project contains inconsistencies which may cause future import to not work.");
console.log("See '" + logFilename + "' for more details.");
console.log("See '".concat(logFilename, "' for more details."));
_a.label = 6;

@@ -137,3 +137,3 @@ case 6:

var getLogFilename = function (filename) {
return (0, core_1.getFilenameWithoutExtension)(filename) + "_log.json";
return "".concat((0, core_1.getFilenameWithoutExtension)(filename), "_log.json");
};

@@ -148,3 +148,3 @@ var cleanAsync = function (config) { return __awaiter(void 0, void 0, void 0, function () {

if (config.enableLog) {
console.log("Deleted: " + item.title + " | " + item.type);
console.log("Deleted: ".concat(item.title, " | ").concat(item.type));
}

@@ -179,3 +179,3 @@ },

if (config.enableLog) {
console.log("Imported: " + item.title + " | " + item.type);
console.log("Imported: ".concat(item.title, " | ").concat(item.type));
}

@@ -214,3 +214,3 @@ },

console.log("Project could not be imported due to data inconsistencies.");
console.log("A log file '" + logFilename + "' with issues was created in current folder.");
console.log("A log file '".concat(logFilename, "' with issues was created in current folder."));
console.log("To import data regardless of issues, set 'force' config parameter to true");

@@ -296,3 +296,3 @@ _a.label = 6;

if (configFilename) {
configFile = (0, fs_1.readFileSync)("./" + configFilename);
configFile = (0, fs_1.readFileSync)("./".concat(configFilename));
return [2 /*return*/, JSON.parse(configFile.toString())];

@@ -343,3 +343,3 @@ }

var date = new Date();
return "kontent-backup-" + date.getDate() + "-" + (date.getMonth() + 1) + "-" + date.getFullYear() + "-" + date.getHours() + "-" + date.getMinutes();
return "kontent-backup-".concat(date.getDate(), "-").concat(date.getMonth() + 1, "-").concat(date.getFullYear(), "-").concat(date.getHours(), "-").concat(date.getMinutes());
};

@@ -346,0 +346,0 @@ run()

@@ -54,3 +54,3 @@ "use strict";

if (this.config.enableLog) {
console.log("Reading file '" + filePath + "'");
console.log("Reading file '".concat(filePath, "'"));
}

@@ -75,3 +75,3 @@ return [4 /*yield*/, fs_1.promises.readFile(filePath)];

filePath = this.getFilePath(fileNameWithoutExtension);
console.log("Writing file '" + filePath + "'");
console.log("Writing file '".concat(filePath, "'"));
return [4 /*yield*/, fs_1.promises.writeFile(filePath, content)];

@@ -88,3 +88,3 @@ case 1:

var filenameWithExtension = fileNameWithoutExtension + this.zipExtension;
return "./" + filenameWithExtension;
return "./".concat(filenameWithExtension);
};

@@ -91,0 +91,0 @@ return FileService;

@@ -48,3 +48,3 @@ "use strict";

// called when any content is deleted
console.log("Deleted: " + item.title + " | " + item.type);
console.log("Deleted: ".concat(item.title, " | ").concat(item.type));
},

@@ -51,0 +51,0 @@ projectId: 'targetProjectId',

@@ -59,3 +59,3 @@ "use strict";

// called when any content is exported
console.log("Exported: " + item.title + " | " + item.type);
console.log("Exported: ".concat(item.title, " | ").concat(item.type));
}

@@ -62,0 +62,0 @@ });

@@ -57,3 +57,3 @@ "use strict";

// called when any content is imported
console.log("Imported: " + item.title + " | " + item.type);
console.log("Imported: ".concat(item.title, " | ").concat(item.type));
},

@@ -60,0 +60,0 @@ // be careful when filtering data to import because you might break data consistency.

@@ -162,3 +162,3 @@ "use strict";

if (!assetsFolder) {
throw Error("Could not create folder '" + this.filesName + "'");
throw Error("Could not create folder '".concat(this.filesName, "'"));
}

@@ -179,3 +179,3 @@ if (this.config.enableLog) {

if (!assetIdShortFolder) {
throw Error("Could not create folder '" + this.filesName + "'");
throw Error("Could not create folder '".concat(this.filesName, "'"));
}

@@ -185,3 +185,3 @@ assetIdFolderName = asset.id;

if (!assetIdFolder) {
throw Error("Could not create folder '" + this.filesName + "'");
throw Error("Could not create folder '".concat(this.filesName, "'"));
}

@@ -286,3 +286,3 @@ assetFilename = asset.file_name;

}
throw Error("Unsupported context '" + this.config.context + "'");
throw Error("Unsupported context '".concat(this.config.context, "'"));
};

@@ -294,3 +294,3 @@ /**

ZipService.prototype.getFullAssetPath = function (assetId, filename) {
return this.filesName + "/" + assetId.substr(0, 3) + "/" + assetId + "/" + filename;
return "".concat(this.filesName, "/").concat(assetId.substr(0, 3), "/").concat(assetId, "/").concat(filename);
};

@@ -306,3 +306,3 @@ ZipService.prototype.readAndParseJsonFile = function (fileContents, filename) {

if (!file) {
throw Error("Invalid file '" + filename + "'");
throw Error("Invalid file '".concat(filename, "'"));
}

@@ -325,3 +325,3 @@ return [4 /*yield*/, file.async('text')];

if (enableLog) {
console.log("Start asset download: " + url);
console.log("Start asset download: ".concat(url));
}

@@ -328,0 +328,0 @@ return [4 /*yield*/, this.httpService.getAsync({

{
"name": "@kentico/kontent-backup-manager",
"version": "3.1.0",
"version": "3.2.0",
"description": "This utility enables backup & restore of Kentico Kontent projects",

@@ -46,5 +46,5 @@ "preferGlobal": true,

"dependencies": {
"@kentico/kontent-management": "1.5.0",
"@kentico/kontent-management": "1.7.0",
"jszip": "3.7.1",
"yargs": "17.2.0"
"yargs": "17.3.0"
},

@@ -54,9 +54,9 @@ "devDependencies": {

"@types/jszip": "3.4.1",
"@types/node": "16.9.6",
"@types/yargs": "17.0.3",
"standard-version": "9.3.1",
"ts-node": "10.2.1",
"@types/node": "16.11.12",
"@types/yargs": "17.0.7",
"standard-version": "9.3.2",
"ts-node": "10.4.0",
"tslint": "6.1.3",
"typescript": "4.4.3"
"typescript": "4.5.4"
}
}
{
"name": "@kentico/kontent-backup-manager",
"version": "3.1.0",
"version": "3.2.0",
"description": "This utility enables backup & restore of Kentico Kontent projects",

@@ -46,5 +46,5 @@ "preferGlobal": true,

"dependencies": {
"@kentico/kontent-management": "1.5.0",
"@kentico/kontent-management": "1.7.0",
"jszip": "3.7.1",
"yargs": "17.2.0"
"yargs": "17.3.0"
},

@@ -54,9 +54,9 @@ "devDependencies": {

"@types/jszip": "3.4.1",
"@types/node": "16.9.6",
"@types/yargs": "17.0.3",
"standard-version": "9.3.1",
"ts-node": "10.2.1",
"@types/node": "16.11.12",
"@types/yargs": "17.0.7",
"standard-version": "9.3.2",
"ts-node": "10.4.0",
"tslint": "6.1.3",
"typescript": "4.4.3"
"typescript": "4.5.4"
}
}

@@ -414,3 +414,3 @@ import { __awaiter, __generator, __values } from "tslib";

if (!languageId) {
throw Error("Missing language id for item '" + contentItemId + "'");
throw Error("Missing language id for item '".concat(contentItemId, "'"));
}

@@ -417,0 +417,0 @@ return [4 /*yield*/, this_6.client

@@ -72,3 +72,3 @@ import { __values } from "tslib";

if (newId) {
return replaceAttr + "=\"" + newId + "\"";
return "".concat(replaceAttr, "=\"").concat(newId, "\"");
}

@@ -75,0 +75,0 @@ }

@@ -49,3 +49,3 @@ #!/usr/bin/env node

if (config.enableLog) {
console.log("Exported: " + item.title + " | " + item.type);
console.log("Exported: ".concat(item.title, " | ").concat(item.type));
}

@@ -79,3 +79,3 @@ }

console.log("Project contains inconsistencies which may cause future import to not work.");
console.log("See '" + logFilename + "' for more details.");
console.log("See '".concat(logFilename, "' for more details."));
_a.label = 6;

@@ -89,3 +89,3 @@ case 6:

var getLogFilename = function (filename) {
return getFilenameWithoutExtension(filename) + "_log.json";
return "".concat(getFilenameWithoutExtension(filename), "_log.json");
};

@@ -100,3 +100,3 @@ var cleanAsync = function (config) { return __awaiter(void 0, void 0, void 0, function () {

if (config.enableLog) {
console.log("Deleted: " + item.title + " | " + item.type);
console.log("Deleted: ".concat(item.title, " | ").concat(item.type));
}

@@ -131,3 +131,3 @@ },

if (config.enableLog) {
console.log("Imported: " + item.title + " | " + item.type);
console.log("Imported: ".concat(item.title, " | ").concat(item.type));
}

@@ -166,3 +166,3 @@ },

console.log("Project could not be imported due to data inconsistencies.");
console.log("A log file '" + logFilename + "' with issues was created in current folder.");
console.log("A log file '".concat(logFilename, "' with issues was created in current folder."));
console.log("To import data regardless of issues, set 'force' config parameter to true");

@@ -248,3 +248,3 @@ _a.label = 6;

if (configFilename) {
configFile = readFileSync("./" + configFilename);
configFile = readFileSync("./".concat(configFilename));
return [2 /*return*/, JSON.parse(configFile.toString())];

@@ -295,3 +295,3 @@ }

var date = new Date();
return "kontent-backup-" + date.getDate() + "-" + (date.getMonth() + 1) + "-" + date.getFullYear() + "-" + date.getHours() + "-" + date.getMinutes();
return "kontent-backup-".concat(date.getDate(), "-").concat(date.getMonth() + 1, "-").concat(date.getFullYear(), "-").concat(date.getHours(), "-").concat(date.getMinutes());
};

@@ -298,0 +298,0 @@ run()

@@ -16,3 +16,3 @@ import { __awaiter, __generator } from "tslib";

if (this.config.enableLog) {
console.log("Reading file '" + filePath + "'");
console.log("Reading file '".concat(filePath, "'"));
}

@@ -37,3 +37,3 @@ return [4 /*yield*/, promises.readFile(filePath)];

filePath = this.getFilePath(fileNameWithoutExtension);
console.log("Writing file '" + filePath + "'");
console.log("Writing file '".concat(filePath, "'"));
return [4 /*yield*/, promises.writeFile(filePath, content)];

@@ -50,3 +50,3 @@ case 1:

var filenameWithExtension = fileNameWithoutExtension + this.zipExtension;
return "./" + filenameWithExtension;
return "./".concat(filenameWithExtension);
};

@@ -53,0 +53,0 @@ return FileService;

@@ -11,3 +11,3 @@ import { __awaiter, __generator } from "tslib";

// called when any content is deleted
console.log("Deleted: " + item.title + " | " + item.type);
console.log("Deleted: ".concat(item.title, " | ").concat(item.type));
},

@@ -14,0 +14,0 @@ projectId: 'targetProjectId',

@@ -22,3 +22,3 @@ import { __awaiter, __generator } from "tslib";

// called when any content is exported
console.log("Exported: " + item.title + " | " + item.type);
console.log("Exported: ".concat(item.title, " | ").concat(item.type));
}

@@ -25,0 +25,0 @@ });

@@ -20,3 +20,3 @@ import { __awaiter, __generator } from "tslib";

// called when any content is imported
console.log("Imported: " + item.title + " | " + item.type);
console.log("Imported: ".concat(item.title, " | ").concat(item.type));
},

@@ -23,0 +23,0 @@ // be careful when filtering data to import because you might break data consistency.

@@ -113,3 +113,3 @@ import { __awaiter, __generator, __values } from "tslib";

if (!assetsFolder) {
throw Error("Could not create folder '" + this.filesName + "'");
throw Error("Could not create folder '".concat(this.filesName, "'"));
}

@@ -130,3 +130,3 @@ if (this.config.enableLog) {

if (!assetIdShortFolder) {
throw Error("Could not create folder '" + this.filesName + "'");
throw Error("Could not create folder '".concat(this.filesName, "'"));
}

@@ -136,3 +136,3 @@ assetIdFolderName = asset.id;

if (!assetIdFolder) {
throw Error("Could not create folder '" + this.filesName + "'");
throw Error("Could not create folder '".concat(this.filesName, "'"));
}

@@ -237,3 +237,3 @@ assetFilename = asset.file_name;

}
throw Error("Unsupported context '" + this.config.context + "'");
throw Error("Unsupported context '".concat(this.config.context, "'"));
};

@@ -245,3 +245,3 @@ /**

ZipService.prototype.getFullAssetPath = function (assetId, filename) {
return this.filesName + "/" + assetId.substr(0, 3) + "/" + assetId + "/" + filename;
return "".concat(this.filesName, "/").concat(assetId.substr(0, 3), "/").concat(assetId, "/").concat(filename);
};

@@ -257,3 +257,3 @@ ZipService.prototype.readAndParseJsonFile = function (fileContents, filename) {

if (!file) {
throw Error("Invalid file '" + filename + "'");
throw Error("Invalid file '".concat(filename, "'"));
}

@@ -276,3 +276,3 @@ return [4 /*yield*/, file.async('text')];

if (enableLog) {
console.log("Start asset download: " + url);
console.log("Start asset download: ".concat(url));
}

@@ -279,0 +279,0 @@ return [4 /*yield*/, this.httpService.getAsync({

{
"name": "@kentico/kontent-backup-manager",
"version": "3.1.0",
"version": "3.2.0",
"description": "This utility enables backup & restore of Kentico Kontent projects",

@@ -46,5 +46,5 @@ "preferGlobal": true,

"dependencies": {
"@kentico/kontent-management": "1.5.0",
"@kentico/kontent-management": "1.7.0",
"jszip": "3.7.1",
"yargs": "17.2.0"
"yargs": "17.3.0"
},

@@ -54,9 +54,9 @@ "devDependencies": {

"@types/jszip": "3.4.1",
"@types/node": "16.9.6",
"@types/yargs": "17.0.3",
"standard-version": "9.3.1",
"ts-node": "10.2.1",
"@types/node": "16.11.12",
"@types/yargs": "17.0.7",
"standard-version": "9.3.2",
"ts-node": "10.4.0",
"tslint": "6.1.3",
"typescript": "4.4.3"
"typescript": "4.5.4"
}
}

@@ -568,3 +568,3 @@ import {

.withData((builder) => {
return contentType;
return contentType as any;
})

@@ -764,3 +764,3 @@ .toPromise()

external_id: contentTypeSnippet.external_id
};
} as any;
})

@@ -767,0 +767,0 @@ .toPromise()

{
"name": "@kentico/kontent-backup-manager",
"version": "3.1.0",
"version": "3.2.0",
"description": "This utility enables backup & restore of Kentico Kontent projects",

@@ -46,5 +46,5 @@ "preferGlobal": true,

"dependencies": {
"@kentico/kontent-management": "1.5.0",
"@kentico/kontent-management": "1.7.0",
"jszip": "3.7.1",
"yargs": "17.2.0"
"yargs": "17.3.0"
},

@@ -54,9 +54,9 @@ "devDependencies": {

"@types/jszip": "3.4.1",
"@types/node": "16.9.6",
"@types/yargs": "17.0.3",
"standard-version": "9.3.1",
"ts-node": "10.2.1",
"@types/node": "16.11.12",
"@types/yargs": "17.0.7",
"standard-version": "9.3.2",
"ts-node": "10.4.0",
"tslint": "6.1.3",
"typescript": "4.4.3"
"typescript": "4.5.4"
}
}

@@ -86,5 +86,8 @@ [![npm version](https://badge.fury.io/js/%40kentico%2Fkontent-backup-manager.svg)](https://badge.fury.io/js/%40kentico%2Fkontent-backup-manager)

### Backup in code
### Backup in code
```typescript
import { ExportService, ImportService, ZipService } from "@kentico/kontent-backup-manager";
import { FileService } from '@kentico/kontent-backup-manager/dist/cjs/lib/node';
const run = async () => {

@@ -106,7 +109,15 @@ const exportService = new ExportService({

const zipService = new ZipService({
filename: 'file',
context: 'node.js',
enableLog: true
});
await zipService.createZipAsync(data);
// prepare zip data
const zipData = await zipService.createZipAsync(data);
const fileService = new FileService({
enableLog: true,
});
// create file on FS
await fileService.writeFileAsync('backup', zipData);
};

@@ -120,5 +131,15 @@

```typescript
import { ExportService, ImportService, ZipService } from "@kentico/kontent-backup-manager";
import { FileService } from '@kentico/kontent-backup-manager/dist/cjs/lib/node';
const run = async () => {
const fileService = new FileService({
enableLog: true,
});
// load file
const zipFile = await fileService.loadFileAsync('backup');
const zipService = new ZipService({
filename: 'xxx',
context: 'node.js',
enableLog: true

@@ -133,10 +154,3 @@ });

canImport: {
asset: (item) => {
if(item.title.startsWith('_corporate')) {
// asset will be imported only if the title starts with "_corporate"
return true;
}
// otherwise asset will NOT be imported
return false;
},
asset: (item) => true, // assets will be imported
contentType: (item) => {

@@ -166,6 +180,6 @@ if (item.codename === 'article') {

// read export data from zip
const data = await zipService.extractZipAsync();
const importData = await zipService.extractZipAsync(zipFile);
// restore into target project
await importService.importFromSourceAsync(data);
await importService.importFromSourceAsync(importData);
};

@@ -172,0 +186,0 @@

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc