Socket
Socket
Sign inDemoInstall

@hubspot/cms-lib

Package Overview
Dependencies
Maintainers
13
Versions
115
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@hubspot/cms-lib - npm Package Compare versions

Comparing version 2.1.1-beta.8 to 2.1.1-beta.9

16

api/fileMapper.js

@@ -209,2 +209,17 @@ const fs = require('fs-extra');

/**
* Moves file from srcPath to destPath
*
* @async
* @param {number} portalId
* @param {string} srcPath
* @param {string} destPath
* @returns {Promise}
*/
async function moveFile(portalId, srcPath, destPath) {
return http.put(portalId, {
uri: `${FILE_MAPPER_API_PATH}/rename/${srcPath}?path=${destPath}`,
});
}
/**
* Get directory contents

@@ -232,3 +247,4 @@ *

createFileMapperNodeFromStreamResponse,
moveFile,
getDirectoryContentsByPath,
};

3

lib/constants.js

@@ -98,2 +98,4 @@ const ENVIRONMENTS = {

const FOLDER_DOT_EXTENSIONS = ['functions', 'module'];
module.exports = {

@@ -119,2 +121,3 @@ Mode,

MARKETPLACE_FOLDER,
FOLDER_DOT_EXTENSIONS,
};

68

lib/functions.js
const moment = require('moment');
const util = require('util');
const { logger } = require('../logger');
const formatCompactOutput = func => {
return `${func.method}\t/${func.route}`;
const getFunctionArrays = resp => {
return resp.objects.map(func => {
const { route, method, created, updated, secretNames } = func;
return [
route,
method,
secretNames.join(', '),
moment(created).format(),
moment(updated).format(),
];
});
};
const formatFullOutput = func => {
return `/${func.route}\nMethod: ${func.method}\nSecrets: ${util.inspect(
func.secretNames,
{
colors: true,
compact: true,
depth: 'Infinity',
}
)}\nCreated: ${func.created} (${moment(func.created).format()})\nUpdated: ${
func.updated
} (${moment(func.updated).format()})\n`;
};
const formatFunctionOutput = (func, options) => {
if (options.compact) {
return formatCompactOutput(func);
}
return formatFullOutput(func);
};
const processFunction = (func, options) => {
try {
return formatFunctionOutput(func, options);
} catch (e) {
logger.error(`Unable to process log ${JSON.stringify(func)}`);
}
};
const processOutput = (resp, options) => {
if (!resp || (resp.objects && !resp.objects.length)) {
return 'No functions found.';
} else if (resp.objects && resp.objects.length) {
return resp.objects
.map(func => {
return processFunction(func, options);
})
.join('\n');
}
return processFunction(resp, options);
};
const outputFunctions = (resp, options) => {
if (options.json) {
return logger.log(resp.objects);
}
return logger.log(processOutput(resp, options));
};
module.exports = {
outputFunctions,
getFunctionArrays,
};
{
"name": "@hubspot/cms-lib",
"version": "2.1.1-beta.8",
"version": "2.1.1-beta.9",
"description": "Library for working with the HubSpot CMS",

@@ -34,3 +34,3 @@ "license": "Apache-2.0",

},
"gitHead": "f47853ac23af22419e88e373f856f86b5a37ee85"
"gitHead": "ce313232e636e55ae57debccb46462d522c2b679"
}
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