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
8
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 1.12.0 to 1.13.0

2

_commonjs/package.json
{
"name": "@kentico/kontent-backup-manager",
"version": "1.12.0",
"version": "1.13.0",
"description": "This utility enables backup & restore of Kentico Kontent projects",

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

@@ -18,4 +18,4 @@ import { ContentItemContracts, ContentTypeContracts, ContentTypeSnippetContracts, LanguageVariantContracts, TaxonomyContracts, AssetContracts, LanguageContracts, AssetFolderContracts, ProjectContracts } from '@kentico/kontent-management';

exportContentItemsAsync(): Promise<ContentItemContracts.IContentItemModelContract[]>;
exportLanguageVariantsAsync(typeIds: string[]): Promise<LanguageVariantContracts.ILanguageVariantModelContract[]>;
exportLanguageVariantsAsync(contentItemIds: string[]): Promise<LanguageVariantContracts.ILanguageVariantModelContract[]>;
private processItem;
}

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

return __awaiter(this, void 0, void 0, function () {
var exportItems, contentTypes, projectValidation, data, _u, _v, _w, _x, _y, _z, _0;
var _1;
return __generator(this, function (_2) {
switch (_2.label) {
var exportItems, contentTypes, projectValidation, contentItems, _u, data, _v, _w, _x, _y, _z, _0, _1;
var _2;
return __generator(this, function (_3) {
switch (_3.label) {
case 0:

@@ -73,80 +73,90 @@ exportItems = {

case 1:
contentTypes = _2.sent();
contentTypes = _3.sent();
return [4 /*yield*/, this.exportProjectValidationAsync()];
case 2:
projectValidation = _2.sent();
_1 = {
contentTypes: exportItems.contentType ? contentTypes : []
};
if (!exportItems.contentTypeSnippet) return [3 /*break*/, 4];
return [4 /*yield*/, this.exportContentTypeSnippetsAsync()];
projectValidation = _3.sent();
if (!(exportItems.contentItem || exportItems.languageVariant)) return [3 /*break*/, 4];
return [4 /*yield*/, this.exportContentItemsAsync()];
case 3:
_u = _2.sent();
_u = _3.sent();
return [3 /*break*/, 5];
case 4:
_u = [];
_2.label = 5;
_3.label = 5;
case 5:
_1.contentTypeSnippets = _u;
if (!exportItems.taxonomy) return [3 /*break*/, 7];
return [4 /*yield*/, this.exportTaxonomiesAsync()];
contentItems = _u;
_2 = {
contentTypes: exportItems.contentType ? contentTypes : []
};
if (!exportItems.contentTypeSnippet) return [3 /*break*/, 7];
return [4 /*yield*/, this.exportContentTypeSnippetsAsync()];
case 6:
_v = _2.sent();
_v = _3.sent();
return [3 /*break*/, 8];
case 7:
_v = [];
_2.label = 8;
_3.label = 8;
case 8:
_1.taxonomies = _v;
if (!exportItems.contentItem) return [3 /*break*/, 10];
return [4 /*yield*/, this.exportContentItemsAsync()];
_2.contentTypeSnippets = _v;
if (!exportItems.taxonomy) return [3 /*break*/, 10];
return [4 /*yield*/, this.exportTaxonomiesAsync()];
case 9:
_w = _2.sent();
_w = _3.sent();
return [3 /*break*/, 11];
case 10:
_w = [];
_2.label = 11;
_3.label = 11;
case 11:
_1.contentItems = _w;
if (!exportItems.languageVariant) return [3 /*break*/, 13];
return [4 /*yield*/, this.exportLanguageVariantsAsync(contentTypes.map(function (m) { return m.id; }))];
_2.taxonomies = _w;
if (!exportItems.contentItem) return [3 /*break*/, 13];
return [4 /*yield*/, this.exportContentItemsAsync()];
case 12:
_x = _2.sent();
_x = _3.sent();
return [3 /*break*/, 14];
case 13:
_x = [];
_2.label = 14;
_3.label = 14;
case 14:
_1.languageVariants = _x;
if (!exportItems.asset) return [3 /*break*/, 16];
return [4 /*yield*/, this.exportAssetsAsync()];
_2.contentItems = _x;
if (!exportItems.languageVariant) return [3 /*break*/, 16];
return [4 /*yield*/, this.exportLanguageVariantsAsync(contentItems.map(function (m) { return m.id; }))];
case 15:
_y = _2.sent();
_y = _3.sent();
return [3 /*break*/, 17];
case 16:
_y = [];
_2.label = 17;
_3.label = 17;
case 17:
_1.assets = _y;
if (!exportItems.language) return [3 /*break*/, 19];
return [4 /*yield*/, this.exportLanguagesAsync()];
_2.languageVariants = _y;
if (!exportItems.asset) return [3 /*break*/, 19];
return [4 /*yield*/, this.exportAssetsAsync()];
case 18:
_z = _2.sent();
_z = _3.sent();
return [3 /*break*/, 20];
case 19:
_z = [];
_2.label = 20;
_3.label = 20;
case 20:
_1.languages = _z;
if (!exportItems.assetFolder) return [3 /*break*/, 22];
return [4 /*yield*/, this.exportAssetFoldersAsync()];
_2.assets = _z;
if (!exportItems.language) return [3 /*break*/, 22];
return [4 /*yield*/, this.exportLanguagesAsync()];
case 21:
_0 = _2.sent();
_0 = _3.sent();
return [3 /*break*/, 23];
case 22:
_0 = [];
_2.label = 23;
_3.label = 23;
case 23:
data = (_1.assetFolders = _0,
_1);
_2.languages = _0;
if (!exportItems.assetFolder) return [3 /*break*/, 25];
return [4 /*yield*/, this.exportAssetFoldersAsync()];
case 24:
_1 = _3.sent();
return [3 /*break*/, 26];
case 25:
_1 = [];
_3.label = 26;
case 26:
data = (_2.assetFolders = _1,
_2);
return [2 /*return*/, {

@@ -326,5 +336,5 @@ metadata: {

};
ExportService.prototype.exportLanguageVariantsAsync = function (typeIds) {
ExportService.prototype.exportLanguageVariantsAsync = function (contentItemIds) {
return __awaiter(this, void 0, void 0, function () {
var languageVariants, _i, typeIds_1, typeId;
var languageVariants, _i, contentItemIds_1, contentItemId, response;
var _this = this;

@@ -335,36 +345,20 @@ return __generator(this, function (_a) {

languageVariants = [];
_i = 0, typeIds_1 = typeIds;
_i = 0, contentItemIds_1 = contentItemIds;
_a.label = 1;
case 1:
if (!(_i < typeIds_1.length)) return [3 /*break*/, 5];
typeId = typeIds_1[_i];
if (!(_i < contentItemIds_1.length)) return [3 /*break*/, 4];
contentItemId = contentItemIds_1[_i];
return [4 /*yield*/, this.client
.listLanguageVariantsOfContentTypeWithComponents()
.byTypeId(typeId)
.withListQueryConfig({
responseFetched: function (listResponse, token) {
languageVariants.push.apply(languageVariants, listResponse.data.items.map(function (m) { return m._raw; }));
listResponse.data.items.forEach(function (m) { var _a, _b; return _this.processItem((_b = (_a = m.item.id) === null || _a === void 0 ? void 0 : _a.toString()) !== null && _b !== void 0 ? _b : '-', 'languageVariant', m); });
}
})
.toAllPromise()];
.listLanguageVariantsOfItem()
.byItemId(contentItemId)
.toPromise()];
case 2:
_a.sent();
return [4 /*yield*/, this.client
.listLanguageVariantsOfContentType()
.byTypeId(typeId)
.withListQueryConfig({
responseFetched: function (listResponse, token) {
languageVariants.push.apply(languageVariants, listResponse.data.items.map(function (m) { return m._raw; }));
listResponse.data.items.forEach(function (m) { var _a, _b; return _this.processItem((_b = (_a = m.item.id) === null || _a === void 0 ? void 0 : _a.toString()) !== null && _b !== void 0 ? _b : '-', 'languageVariant', m); });
}
})
.toAllPromise()];
response = _a.sent();
languageVariants.push.apply(languageVariants, response.data.items.map(function (m) { return m._raw; }));
response.data.items.forEach(function (m) { var _a, _b; return _this.processItem((_b = (_a = m.item.id) === null || _a === void 0 ? void 0 : _a.toString()) !== null && _b !== void 0 ? _b : '-', 'languageVariant', m); });
_a.label = 3;
case 3:
_a.sent();
_a.label = 4;
case 4:
_i++;
return [3 /*break*/, 1];
case 5: return [2 /*return*/, languageVariants];
case 4: return [2 /*return*/, languageVariants];
}

@@ -371,0 +365,0 @@ });

@@ -5,2 +5,9 @@ # Changelog

## [1.13.0](https://github.com/Kentico/kontent-backup-manager-js/compare/v1.12.0...v1.13.0) (2020-12-17)
### Features
* uses different endpoint for fetching language variants to ensure all variants are loaded ([6bdda7d](https://github.com/Kentico/kontent-backup-manager-js/commit/6bdda7d5b7aaf73103f46ade0a6a14e31b9ece30))
## [1.12.0](https://github.com/Kentico/kontent-backup-manager-js/compare/v1.11.0...v1.12.0) (2020-10-21)

@@ -7,0 +14,0 @@

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

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

@@ -45,2 +45,3 @@ import {

const projectValidation = await this.exportProjectValidationAsync();
const contentItems = exportItems.contentItem || exportItems.languageVariant ? await this.exportContentItemsAsync() : []

@@ -53,3 +54,3 @@ const data: IExportData = {

languageVariants: exportItems.languageVariant
? await this.exportLanguageVariantsAsync(contentTypes.map((m) => m.id))
? await this.exportLanguageVariantsAsync(contentItems.map((m) => m.id))
: [],

@@ -166,32 +167,17 @@ assets: exportItems.asset ? await this.exportAssetsAsync() : [],

public async exportLanguageVariantsAsync(
typeIds: string[]
contentItemIds: string[]
): Promise<LanguageVariantContracts.ILanguageVariantModelContract[]> {
const languageVariants: LanguageVariantContracts.ILanguageVariantModelWithComponentsContract[] = [];
for (const typeId of typeIds) {
await this.client
.listLanguageVariantsOfContentTypeWithComponents()
.byTypeId(typeId)
.withListQueryConfig({
responseFetched: (listResponse, token) => {
languageVariants.push(...listResponse.data.items.map((m) => m._raw));
listResponse.data.items.forEach((m) =>
this.processItem(m.item.id?.toString() ?? '-', 'languageVariant', m)
);
}
})
.toAllPromise();
for (const contentItemId of contentItemIds) {
const response = await this.client
.listLanguageVariantsOfItem()
.byItemId(contentItemId)
.toPromise();
await this.client
.listLanguageVariantsOfContentType()
.byTypeId(typeId)
.withListQueryConfig({
responseFetched: (listResponse, token) => {
languageVariants.push(...listResponse.data.items.map((m) => m._raw));
listResponse.data.items.forEach((m) =>
this.processItem(m.item.id?.toString() ?? '-', 'languageVariant', m)
);
}
})
.toAllPromise();
languageVariants.push(...response.data.items.map((m) => m._raw));
response.data.items.forEach((m) =>
this.processItem(m.item.id?.toString() ?? '-', 'languageVariant', m)
);
}

@@ -198,0 +184,0 @@

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