New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@agility/cli

Package Overview
Dependencies
Maintainers
3
Versions
20
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@agility/cli - npm Package Compare versions

Comparing version 0.0.4 to 0.0.5

3

dist/asset.d.ts

@@ -6,2 +6,5 @@ import * as mgmtApi from '@agility/management-sdk';

_multibar: cliProgress.MultiBar;
unProcessedAssets: {
[key: number]: string;
};
constructor(options: mgmtApi.Options, multibar: cliProgress.MultiBar);

@@ -8,0 +11,0 @@ getGalleries(guid: string): Promise<void>;

74

dist/asset.js

@@ -69,2 +69,3 @@ "use strict";

this._multibar = multibar;
this.unProcessedAssets = {};
}

@@ -136,5 +137,5 @@ asset.prototype.getGalleries = function (guid) {

return __awaiter(this, void 0, void 0, function () {
var apiClient, fileExport, pageSize, recordOffset, index, multiExport, initialRecords, totalRecords, iterations, progressBar2, i, extension, filePath, folderPath, fileName, i, assets, j, extension, filePath, folderPath, fileName;
return __generator(this, function (_a) {
switch (_a.label) {
var apiClient, fileExport, pageSize, recordOffset, index, multiExport, initialRecords, totalRecords, iterations, progressBar2, i, extension, filePath, folderPath, fileName, i, assets, j, extension, filePath, folderPath, fileName, _a, _b;
return __generator(this, function (_c) {
switch (_c.label) {
case 0:

@@ -149,5 +150,6 @@ apiClient = new mgmtApi.ApiClient(this._options);

case 1:
initialRecords = _a.sent();
initialRecords = _c.sent();
totalRecords = initialRecords.totalCount;
fileExport.createFolder('assets/json');
fileExport.createFolder('assets/failedAssets');
fileExport.exportFiles('assets/json', index, initialRecords);

@@ -164,3 +166,3 @@ iterations = Math.round(totalRecords / pageSize);

i = 0;
_a.label = 2;
_c.label = 2;
case 2:

@@ -176,8 +178,8 @@ if (!(i < initialRecords.assetMedias.length)) return [3 /*break*/, 7];

case 3:
_a.sent();
_c.sent();
return [3 /*break*/, 6];
case 4: return [4 /*yield*/, fileExport.downloadFile(initialRecords.assetMedias[i].originUrl, ".agility-files/assets/".concat(fileName))];
case 5:
_a.sent();
_a.label = 6;
_c.sent();
_c.label = 6;
case 6:

@@ -187,7 +189,7 @@ i++;

case 7:
if (!multiExport) return [3 /*break*/, 17];
if (!multiExport) return [3 /*break*/, 21];
i = 0;
_a.label = 8;
_c.label = 8;
case 8:
if (!(i < iterations)) return [3 /*break*/, 16];
if (!(i < iterations)) return [3 /*break*/, 20];
recordOffset += pageSize;

@@ -203,8 +205,8 @@ if (index === 1) {

case 9:
assets = _a.sent();
assets = _c.sent();
fileExport.exportFiles('assets/json', index, assets);
j = 0;
_a.label = 10;
_c.label = 10;
case 10:
if (!(j < assets.assetMedias.length)) return [3 /*break*/, 15];
if (!(j < assets.assetMedias.length)) return [3 /*break*/, 19];
extension = assets.assetMedias[j].fileName.substring(assets.assetMedias[j].fileName.lastIndexOf(".") + 1);

@@ -214,25 +216,41 @@ filePath = this.getFilePath(assets.assetMedias[j].originUrl);

fileName = "".concat(assets.assetMedias[j].fileName);
if (!folderPath) return [3 /*break*/, 12];
if (!folderPath) return [3 /*break*/, 15];
fileExport.createFolder("assets/".concat(folderPath));
_c.label = 11;
case 11:
_c.trys.push([11, 13, , 14]);
return [4 /*yield*/, fileExport.downloadFile(assets.assetMedias[j].originUrl, ".agility-files/assets/".concat(folderPath, "/").concat(fileName))];
case 11:
_a.sent();
case 12:
_c.sent();
return [3 /*break*/, 14];
case 12: return [4 /*yield*/, fileExport.downloadFile(assets.assetMedias[j].originUrl, ".agility-files/assets/".concat(fileName))];
case 13:
_a.sent();
_a.label = 14;
case 14:
_a = _c.sent();
this.unProcessedAssets[assets.assetMedias[j].mediaID] = assets.assetMedias[j].fileName;
return [3 /*break*/, 14];
case 14: return [3 /*break*/, 18];
case 15:
_c.trys.push([15, 17, , 18]);
return [4 /*yield*/, fileExport.downloadFile(assets.assetMedias[j].originUrl, ".agility-files/assets/".concat(fileName))];
case 16:
_c.sent();
return [3 /*break*/, 18];
case 17:
_b = _c.sent();
this.unProcessedAssets[assets.assetMedias[j].mediaID] = assets.assetMedias[j].fileName;
return [3 /*break*/, 18];
case 18:
j++;
return [3 /*break*/, 10];
case 15:
case 19:
i++;
return [3 /*break*/, 8];
case 16: return [3 /*break*/, 18];
case 17:
case 20: return [3 /*break*/, 22];
case 21:
progressBar2.update(1);
_a.label = 18;
case 18: return [4 /*yield*/, this.getGalleries(guid)];
case 19:
_a.sent();
_c.label = 22;
case 22:
fileExport.exportFiles('assets/failedAssets', 'unProcessedAssets', this.unProcessedAssets);
return [4 /*yield*/, this.getGalleries(guid)];
case 23:
_c.sent();
return [2 /*return*/];

@@ -239,0 +257,0 @@ }

@@ -175,11 +175,18 @@ "use strict";

return __awaiter(this, void 0, void 0, function () {
var apiPath, response;
return __generator(this, function (_a) {
switch (_a.label) {
var apiPath, response, _a;
return __generator(this, function (_b) {
switch (_b.label) {
case 0:
apiPath = "GetPreviewKey?guid=".concat(guid);
_b.label = 1;
case 1:
_b.trys.push([1, 3, , 4]);
return [4 /*yield*/, this.executeGet(apiPath, guid)];
case 1:
response = _a.sent();
case 2:
response = _b.sent();
return [2 /*return*/, response.data];
case 3:
_a = _b.sent();
return [2 /*return*/, null];
case 4: return [2 /*return*/];
}

@@ -191,5 +198,5 @@ });

return __awaiter(this, void 0, void 0, function () {
var baseUrl, instance, apiPath, resp, err_3;
return __generator(this, function (_a) {
switch (_a.label) {
var baseUrl, instance, apiPath, resp, _a;
return __generator(this, function (_b) {
switch (_b.label) {
case 0:

@@ -201,5 +208,5 @@ baseUrl = this.determineBaseUrl(guid);

apiPath = '/users/me';
_a.label = 1;
_b.label = 1;
case 1:
_a.trys.push([1, 3, , 4]);
_b.trys.push([1, 3, , 4]);
return [4 /*yield*/, instance.get(apiPath, {

@@ -212,7 +219,7 @@ headers: {

case 2:
resp = _a.sent();
resp = _b.sent();
return [2 /*return*/, resp.data];
case 3:
err_3 = _a.sent();
return [3 /*break*/, 4];
_a = _b.sent();
return [2 /*return*/, null];
case 4: return [2 /*return*/];

@@ -219,0 +226,0 @@ }

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

return __awaiter(this, void 0, void 0, function () {
var code, data, form, token, syncKey, contentPageSync, multibar, assetsSync, containerSync, modelSync;
var code, data, form, token, multibar, syncKey, contentPageSync, assetsSync, containerSync, modelSync;
return __generator(this, function (_a) {

@@ -97,10 +97,10 @@ switch (_a.label) {

this.options.token = token.access_token;
multibar = (0, multibar_1.createMultibar)({ name: 'Instance' });
return [4 /*yield*/, this.auth.getPreviewKey(this.sourceGuid)];
case 2:
syncKey = _a.sent();
contentPageSync = new sync_1.sync(this.sourceGuid, syncKey, this.locale, this.channel, this.options);
contentPageSync = new sync_1.sync(this.sourceGuid, syncKey, this.locale, this.channel, this.options, multibar);
return [4 /*yield*/, contentPageSync.sync()];
case 3:
_a.sent();
multibar = (0, multibar_1.createMultibar)({ name: 'Instance' });
assetsSync = new asset_1.asset(this.options, multibar);

@@ -107,0 +107,0 @@ return [4 /*yield*/, assetsSync.getAssets(this.sourceGuid)];

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

return __awaiter(this, void 0, void 0, function () {
var apiClient, containers, progressBar3, fileExport, index, i, container_1, progressCount;
var apiClient, containers, progressBar3, fileExport, index, i, container_1, referenceName, progressCount;
return __generator(this, function (_a) {

@@ -92,3 +92,5 @@ switch (_a.label) {

container_1 = _a.sent();
fileExport.exportFiles('containers', container_1.referenceName, container_1);
referenceName = container_1.referenceName.replace(/[^a-zA-Z ]/g, "");
;
fileExport.exportFiles('containers', referenceName, container_1);
progressCount = i + 1;

@@ -95,0 +97,0 @@ if (index === 1) {

@@ -15,4 +15,5 @@ export declare class fileOperations {

codeFileExists(): boolean;
fileExists(path: string): boolean;
cleanup(path: string): void;
cliFolderExists(): boolean;
}

@@ -180,2 +180,8 @@ "use strict";

};
fileOperations.prototype.fileExists = function (path) {
if (fs.existsSync(path)) {
return true;
}
return false;
};
fileOperations.prototype.cleanup = function (path) {

@@ -182,0 +188,0 @@ var _this = this;

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

return __awaiter(this, void 0, void 0, function () {
var code, codeFileStatus, data, form, guid, locale, channel, token, syncKey, contentPageSync, multibar, assetsSync, containerSync, modelSync;
var code, codeFileStatus, data, form, guid, locale, channel, token, multibar, user, syncKey, contentPageSync, assetsSync, containerSync, modelSync;
return __generator(this, function (_a) {

@@ -130,5 +130,4 @@ switch (_a.label) {

codeFileStatus = code.codeFileExists();
if (!codeFileStatus) return [3 /*break*/, 7];
if (!codeFileStatus) return [3 /*break*/, 12];
code.cleanup('.agility-files');
console.log(colors.yellow('Pulling your instance...'));
data = JSON.parse(code.readTempFile('code.json'));

@@ -143,29 +142,43 @@ form = new FormData();

token = _a.sent();
multibar = (0, multibar_1.createMultibar)({ name: 'Pull' });
options = new mgmtApi.Options();
options.token = token.access_token;
return [4 /*yield*/, auth.getUser(guid, token.access_token)];
case 2:
user = _a.sent();
if (!user) return [3 /*break*/, 10];
return [4 /*yield*/, auth.getPreviewKey(guid)];
case 2:
case 3:
syncKey = _a.sent();
contentPageSync = new sync_1.sync(guid, syncKey, locale, channel, options);
if (!syncKey) return [3 /*break*/, 8];
console.log(colors.yellow('Pulling your instance...'));
contentPageSync = new sync_1.sync(guid, syncKey, locale, channel, options, multibar);
return [4 /*yield*/, contentPageSync.sync()];
case 3:
case 4:
_a.sent();
multibar = (0, multibar_1.createMultibar)({ name: 'Pull' });
assetsSync = new asset_1.asset(options, multibar);
return [4 /*yield*/, assetsSync.getAssets(guid)];
case 4:
case 5:
_a.sent();
containerSync = new container_1.container(options, multibar);
return [4 /*yield*/, containerSync.getContainers(guid)];
case 5:
case 6:
_a.sent();
modelSync = new model_1.model(options, multibar);
return [4 /*yield*/, modelSync.getModels(guid)];
case 6:
case 7:
_a.sent();
return [3 /*break*/, 8];
case 7:
console.log('Please authenticate first to perform the pull operation.');
_a.label = 8;
case 8: return [2 /*return*/];
return [3 /*break*/, 9];
case 8:
console.log(colors.red('Please add a preview key to your instance to perform pull operation.'));
_a.label = 9;
case 9: return [3 /*break*/, 11];
case 10:
console.log(colors.red('Please authenticate first to perform the push operation.'));
_a.label = 11;
case 11: return [3 /*break*/, 13];
case 12:
console.log(colors.red('Please authenticate first to perform the push operation.'));
_a.label = 13;
case 13: return [2 /*return*/];
}

@@ -193,3 +206,3 @@ });

return __awaiter(this, void 0, void 0, function () {
var guid, locale, code, codeFileStatus, agilityFolder, data, multibar, form, token, pushSync;
var guid, locale, code, codeFileStatus, agilityFolder, data, multibar, form, token, user, pushSync;
return __generator(this, function (_a) {

@@ -203,6 +216,5 @@ switch (_a.label) {

codeFileStatus = code.codeFileExists();
if (!codeFileStatus) return [3 /*break*/, 5];
if (!codeFileStatus) return [3 /*break*/, 8];
agilityFolder = code.cliFolderExists();
if (!agilityFolder) return [3 /*break*/, 3];
console.log(colors.yellow('Pushing your instance...'));
if (!agilityFolder) return [3 /*break*/, 6];
data = JSON.parse(code.readTempFile('code.json'));

@@ -217,2 +229,7 @@ multibar = (0, multibar_1.createMultibar)({ name: 'Push' });

options.token = token.access_token;
return [4 /*yield*/, auth.getUser(guid, token.access_token)];
case 2:
user = _a.sent();
if (!user) return [3 /*break*/, 4];
console.log(colors.yellow('Pushing your instance...'));
pushSync = new push_1.push(options, multibar);

@@ -259,3 +276,3 @@ /*

return [4 /*yield*/, pushSync.pushInstance(guid, locale)];
case 2:
case 3:
/*

@@ -301,11 +318,15 @@ TODO: Inquirer for Content and Pages.

_a.sent();
return [3 /*break*/, 4];
case 3:
return [3 /*break*/, 5];
case 4:
console.log(colors.red('Please authenticate first to perform the push operation.'));
_a.label = 5;
case 5: return [3 /*break*/, 7];
case 6:
console.log(colors.red('Please pull an instance first to push an instance.'));
_a.label = 4;
case 4: return [3 /*break*/, 6];
case 5:
_a.label = 7;
case 7: return [3 /*break*/, 9];
case 8:
console.log(colors.red('Please authenticate first to perform the push operation.'));
_a.label = 6;
case 6: return [2 /*return*/];
_a.label = 9;
case 9: return [2 /*return*/];
}

@@ -343,3 +364,3 @@ });

return __awaiter(this, void 0, void 0, function () {
var sourceGuid, targetGuid, locale, channel, code, codeFileStatus, cloneSync, agilityFolder;
var sourceGuid, targetGuid, locale, channel, code, codeFileStatus, data, form, token, user, cloneSync, agilityFolder;
return __generator(this, function (_a) {

@@ -353,5 +374,16 @@ switch (_a.label) {

code = new fileOperations_1.fileOperations();
auth = new auth_1.Auth();
codeFileStatus = code.codeFileExists();
if (!codeFileStatus) return [3 /*break*/, 5];
if (!codeFileStatus) return [3 /*break*/, 9];
code.cleanup('.agility-files');
data = JSON.parse(code.readTempFile('code.json'));
form = new FormData();
form.append('cliCode', data.code);
return [4 /*yield*/, auth.cliPoll(form, sourceGuid)];
case 1:
token = _a.sent();
return [4 /*yield*/, auth.getUser(sourceGuid, token.access_token)];
case 2:
user = _a.sent();
if (!user) return [3 /*break*/, 7];
console.log(colors.yellow('Cloning your instance...'));

@@ -361,19 +393,23 @@ cloneSync = new clone_1.clone(sourceGuid, targetGuid, locale, channel);

return [4 /*yield*/, cloneSync.pull()];
case 1:
case 3:
_a.sent();
agilityFolder = code.cliFolderExists();
if (!agilityFolder) return [3 /*break*/, 3];
if (!agilityFolder) return [3 /*break*/, 5];
console.log(colors.yellow('Pushing your instance...'));
return [4 /*yield*/, cloneSync.push()];
case 2:
case 4:
_a.sent();
return [3 /*break*/, 4];
case 3:
return [3 /*break*/, 6];
case 5:
console.log(colors.red('Please pull an instance first to push an instance.'));
_a.label = 4;
case 4: return [3 /*break*/, 6];
case 5:
_a.label = 6;
case 6: return [3 /*break*/, 8];
case 7:
console.log(colors.red('Please authenticate first to perform the clone operation.'));
_a.label = 6;
case 6: return [2 /*return*/];
_a.label = 8;
case 8: return [3 /*break*/, 10];
case 9:
console.log(colors.red('Please authenticate first to perform the clone operation.'));
_a.label = 10;
case 10: return [2 /*return*/];
}

@@ -380,0 +416,0 @@ });

import * as mgmtApi from '@agility/management-sdk';
import * as cliProgress from 'cli-progress';
export declare class sync {

@@ -8,3 +9,4 @@ _guid: string;

_options: mgmtApi.Options;
constructor(guid: string, apiKey: string, locale: string, channel: string, options: mgmtApi.Options);
_multibar: cliProgress.MultiBar;
constructor(guid: string, apiKey: string, locale: string, channel: string, options: mgmtApi.Options, multibar: cliProgress.MultiBar);
sync(): Promise<void>;

@@ -11,0 +13,0 @@ getPageTemplates(): Promise<void>;

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

var sync = /** @class */ (function () {
function sync(guid, apiKey, locale, channel, options) {
function sync(guid, apiKey, locale, channel, options, multibar) {
this._guid = guid;

@@ -74,2 +74,3 @@ this._apiKey = apiKey;

this._options = options;
this._multibar = multibar;
}

@@ -105,3 +106,3 @@ sync.prototype.sync = function () {

return __awaiter(this, void 0, void 0, function () {
var apiClient, pageTemplates, fileExport, i, template;
var apiClient, pageTemplates, progressBar0, index, fileExport, i, template;
return __generator(this, function (_a) {

@@ -114,5 +115,10 @@ switch (_a.label) {

pageTemplates = _a.sent();
progressBar0 = this._multibar.create(pageTemplates.length, 0);
progressBar0.update(0, { name: 'Templates' });
index = 1;
fileExport = new fileOperations_1.fileOperations();
for (i = 0; i < pageTemplates.length; i++) {
template = pageTemplates[i];
progressBar0.update(index);
index += 1;
fileExport.exportFiles('templates', template.pageTemplateID, template);

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

return __awaiter(this, void 0, void 0, function () {
var apiClient, fileOperation, files, i, pageItem, page, _a;
var apiClient, fileOperation, files, progressBar01, index, i, pageItem, page, _a;
return __generator(this, function (_b) {

@@ -135,2 +141,5 @@ switch (_b.label) {

files = fileOperation.readDirectory("".concat(this._locale, "/page"));
progressBar01 = this._multibar.create(files.length, 0);
progressBar01.update(0, { name: 'Modifying Page Object' });
index = 1;
i = 0;

@@ -141,2 +150,4 @@ _b.label = 1;

pageItem = JSON.parse(files[i]);
progressBar01.update(index);
index += 1;
_b.label = 2;

@@ -143,0 +154,0 @@ case 2:

{
"name": "@agility/cli",
"version": "0.0.4",
"version": "0.0.5",
"description": "Agility CLI for working with your content.",

@@ -33,7 +33,7 @@ "repository": {

"license": "ISC",
"bin" : {
"agility" : "dist/index.js"
"bin": {
"agility": "dist/index.js"
},
"dependencies": {
"@agility/content-sync": "^1.1.3",
"@agility/content-sync": "^1.1.4",
"@agility/management-sdk": "^0.1.13",

@@ -40,0 +40,0 @@ "@types/node": "^18.11.17",

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

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