contentful-batch-libs
Advanced tools
Comparing version 9.0.1 to 9.1.0
@@ -1,12 +0,5 @@ | ||
'use strict'; | ||
import { get } from 'lodash'; | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
exports.default = getEntityName; | ||
var _lodash = require('lodash'); | ||
function getEntityName(entity) { | ||
var name = (0, _lodash.get)(entity, 'name'); | ||
export default function getEntityName(entity) { | ||
const name = get(entity, 'name'); | ||
if (name) { | ||
@@ -16,15 +9,15 @@ return attachId(name, entity); | ||
var titleField = (0, _lodash.get)(entity, 'fields.title'); | ||
const titleField = get(entity, 'fields.title'); | ||
if (titleField) { | ||
var locales = Object.keys(titleField); | ||
const locales = Object.keys(titleField); | ||
return attachId(titleField[locales[0]], entity); | ||
} | ||
var nameField = (0, _lodash.get)(entity, 'fields.name'); | ||
const nameField = get(entity, 'fields.name'); | ||
if (nameField) { | ||
var _locales = Object.keys(nameField); | ||
return attachId(nameField[_locales[0]], entity); | ||
const locales = Object.keys(nameField); | ||
return attachId(nameField[locales[0]], entity); | ||
} | ||
var id = (0, _lodash.get)(entity, 'sys.id'); | ||
const id = get(entity, 'sys.id'); | ||
if (id) { | ||
@@ -38,3 +31,3 @@ return id; | ||
function attachId(val, entity) { | ||
var id = (0, _lodash.get)(entity, 'sys.id'); | ||
const id = get(entity, 'sys.id'); | ||
if (id) { | ||
@@ -44,3 +37,2 @@ return `${val} (${id})`; | ||
return val; | ||
} | ||
module.exports = exports['default']; | ||
} |
@@ -1,20 +0,13 @@ | ||
'use strict'; | ||
import { logToTaskOutput, formatLogMessageOneLine } from './logging'; | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
exports.wrapTask = wrapTask; | ||
var _logging = require('./logging'); | ||
// Set up log emitter listening from SDK, proper error catching and throwing of SDK errors | ||
function wrapTask(func) { | ||
return function (ctx, task) { | ||
var teardownTaskListeners = (0, _logging.logToTaskOutput)(task); | ||
return func(ctx, task).then(function () { | ||
export function wrapTask(func) { | ||
return (ctx, task) => { | ||
const teardownTaskListeners = logToTaskOutput(task); | ||
return func(ctx, task).then(() => { | ||
teardownTaskListeners(); | ||
}).catch(function (error) { | ||
}).catch(error => { | ||
teardownTaskListeners(); | ||
// Format message as human readable listr output | ||
var formattedMessage = (0, _logging.formatLogMessageOneLine)({ | ||
const formattedMessage = formatLogMessageOneLine({ | ||
ts: new Date().toJSON(), | ||
@@ -24,3 +17,3 @@ level: 'error', | ||
}); | ||
var enrichedError = new Error(formattedMessage); | ||
const enrichedError = new Error(formattedMessage); | ||
@@ -27,0 +20,0 @@ // Attach original error object for error log |
@@ -1,45 +0,17 @@ | ||
'use strict'; | ||
import EventEmitter from 'events'; | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
exports.logEmitter = undefined; | ||
exports.formatLogMessageOneLine = formatLogMessageOneLine; | ||
exports.formatLogMessageLogfile = formatLogMessageLogfile; | ||
exports.displayErrorLog = displayErrorLog; | ||
exports.writeErrorLogFile = writeErrorLogFile; | ||
exports.setupLogging = setupLogging; | ||
exports.logToTaskOutput = logToTaskOutput; | ||
import bfj from 'bfj'; | ||
import { isObject } from 'lodash'; | ||
import figures from 'figures'; | ||
import moment from 'moment'; | ||
var _events = require('events'); | ||
import getEntityName from './get-entity-name'; | ||
var _events2 = _interopRequireDefault(_events); | ||
export const logEmitter = new EventEmitter(); | ||
var _bfj = require('bfj'); | ||
var _bfj2 = _interopRequireDefault(_bfj); | ||
var _lodash = require('lodash'); | ||
var _figures = require('figures'); | ||
var _figures2 = _interopRequireDefault(_figures); | ||
var _moment = require('moment'); | ||
var _moment2 = _interopRequireDefault(_moment); | ||
var _getEntityName = require('./get-entity-name'); | ||
var _getEntityName2 = _interopRequireDefault(_getEntityName); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
var logEmitter = exports.logEmitter = new _events2.default(); | ||
function extractErrorInformation(error) { | ||
var source = error.originalError || error; | ||
const source = error.originalError || error; | ||
try { | ||
var data = JSON.parse(source.message); | ||
if ((0, _lodash.isObject)(data)) { | ||
const data = JSON.parse(source.message); | ||
if (isObject(data)) { | ||
return data; | ||
@@ -52,5 +24,4 @@ } | ||
function formatLogMessageOneLine(logMessage) { | ||
var level = logMessage.level; | ||
export function formatLogMessageOneLine(logMessage) { | ||
const { level } = logMessage; | ||
if (!level) { | ||
@@ -67,8 +38,6 @@ return logMessage.toString().replace(/\s+/g, ' '); | ||
// Display enhanced API error message when available | ||
var errorOutput = []; | ||
var data = extractErrorInformation(logMessage.error); | ||
const errorOutput = []; | ||
const data = extractErrorInformation(logMessage.error); | ||
if ('status' in data || 'statusText' in data) { | ||
var status = [data.status, data.statusText].filter(function (a) { | ||
return a; | ||
}).join(' - '); | ||
const status = [data.status, data.statusText].filter(a => a).join(' - '); | ||
errorOutput.push(`Status: ${status}`); | ||
@@ -80,8 +49,6 @@ } | ||
if ('entity' in data) { | ||
errorOutput.push(`Entity: ${(0, _getEntityName2.default)(data.entity)}`); | ||
errorOutput.push(`Entity: ${getEntityName(data.entity)}`); | ||
} | ||
if ('details' in data && 'errors' in data.details) { | ||
var errorList = data.details.errors.map(function (error) { | ||
return error.details || error.name; | ||
}); | ||
const errorList = data.details.errors.map(error => error.details || error.name); | ||
errorOutput.push(`Details: ${errorList.join(', ')}`); | ||
@@ -99,5 +66,4 @@ } | ||
function formatLogMessageLogfile(logMessage) { | ||
var level = logMessage.level; | ||
export function formatLogMessageLogfile(logMessage) { | ||
const { level } = logMessage; | ||
if (level === 'info' || level === 'warning') { | ||
@@ -112,4 +78,4 @@ return logMessage; | ||
// Enhance error with extracted API error log | ||
var data = extractErrorInformation(logMessage.error); | ||
var errorOutput = Object.assign({}, logMessage.error, { data }); | ||
const data = extractErrorInformation(logMessage.error); | ||
const errorOutput = Object.assign({}, logMessage.error, { data }); | ||
delete errorOutput.message; | ||
@@ -134,17 +100,9 @@ logMessage.error = errorOutput; | ||
// Display all errors | ||
function displayErrorLog(errorLog) { | ||
export function displayErrorLog(errorLog) { | ||
if (errorLog.length) { | ||
var warningsCount = errorLog.filter(function (error) { | ||
return error.hasOwnProperty('warning'); | ||
}).length; | ||
var errorsCount = errorLog.filter(function (error) { | ||
return error.hasOwnProperty('error'); | ||
}).length; | ||
const warningsCount = errorLog.filter(error => Object.prototype.hasOwnProperty.call(error, 'warning')).length; | ||
const errorsCount = errorLog.filter(error => Object.prototype.hasOwnProperty.call(error, 'warning')).length; | ||
console.log(`\n\nThe following ${errorsCount} errors and ${warningsCount} warnings occurred:\n`); | ||
errorLog.map(function (logMessage) { | ||
return `${(0, _moment2.default)(logMessage.ts).format('HH:mm:SS')} - ${formatLogMessageOneLine(logMessage)}`; | ||
}).map(function (logMessage) { | ||
return console.log(logMessage); | ||
}); | ||
errorLog.map(logMessage => `${moment(logMessage.ts).format('HH:mm:SS')} - ${formatLogMessageOneLine(logMessage)}`).map(logMessage => console.log(logMessage)); | ||
@@ -157,12 +115,12 @@ return; | ||
// Write all log messages instead of infos to the error log file | ||
function writeErrorLogFile(destination, errorLog) { | ||
var logFileData = errorLog.map(formatLogMessageLogfile); | ||
export function writeErrorLogFile(destination, errorLog) { | ||
const logFileData = errorLog.map(formatLogMessageLogfile); | ||
return _bfj2.default.write(destination, logFileData, { | ||
return bfj.write(destination, logFileData, { | ||
circular: 'ignore', | ||
space: 2 | ||
}).then(function () { | ||
}).then(() => { | ||
console.log('\nStored the detailed error log file at:'); | ||
console.log(destination); | ||
}).catch(function (e) { | ||
}).catch(e => { | ||
// avoid crashing when writing the log file fails | ||
@@ -174,5 +132,5 @@ console.error(e); | ||
// Init listeners for log messages, transform them into proper format and logs/displays them | ||
function setupLogging(log) { | ||
export function setupLogging(log) { | ||
function errorLogger(level, error) { | ||
var logMessage = { | ||
const logMessage = { | ||
ts: new Date().toJSON(), | ||
@@ -188,21 +146,15 @@ level, | ||
logEmitter.addListener('info', function (error) { | ||
return errorLogger('info', error); | ||
}); | ||
logEmitter.addListener('warning', function (error) { | ||
return errorLogger('warning', error); | ||
}); | ||
logEmitter.addListener('error', function (error) { | ||
return errorLogger('error', error); | ||
}); | ||
logEmitter.addListener('info', error => errorLogger('info', error)); | ||
logEmitter.addListener('warning', error => errorLogger('warning', error)); | ||
logEmitter.addListener('error', error => errorLogger('error', error)); | ||
} | ||
// Format log message to display them as task status | ||
function logToTaskOutput(task) { | ||
export function logToTaskOutput(task) { | ||
function logToTask(logMessage) { | ||
var content = formatLogMessageOneLine(logMessage); | ||
var symbols = { | ||
'info': _figures2.default.tick, | ||
'warning': _figures2.default.warning, | ||
'error': _figures2.default.cross | ||
const content = formatLogMessageOneLine(logMessage); | ||
const symbols = { | ||
info: figures.tick, | ||
warning: figures.warning, | ||
error: figures.cross | ||
}; | ||
@@ -212,8 +164,8 @@ task.output = `${symbols[logMessage.level]} ${content}`.trim(); | ||
var startTime = Date.now(); | ||
const startTime = Date.now(); | ||
logEmitter.on('display', logToTask); | ||
return function () { | ||
var seconds = Math.ceil((Date.now() - startTime) / 1000); | ||
return () => { | ||
const seconds = Math.ceil((Date.now() - startTime) / 1000); | ||
task.title = `${task.title} (${seconds}s)`; | ||
@@ -220,0 +172,0 @@ logEmitter.removeListener('display', logToTask); |
@@ -1,28 +0,6 @@ | ||
'use strict'; | ||
import { URL, format } from 'url'; | ||
import { toInteger } from 'lodash'; | ||
import HttpsProxyAgent from 'https-proxy-agent'; | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
var _slicedToArray = function () { function sliceIterator(arr, i) { var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"]) _i["return"](); } finally { if (_d) throw _e; } } return _arr; } return function (arr, i) { if (Array.isArray(arr)) { return arr; } else if (Symbol.iterator in Object(arr)) { return sliceIterator(arr, i); } else { throw new TypeError("Invalid attempt to destructure non-iterable instance"); } }; }(); | ||
exports.proxyStringToObject = proxyStringToObject; | ||
exports.proxyObjectToString = proxyObjectToString; | ||
exports.agentFromProxy = agentFromProxy; | ||
var _url = require('url'); | ||
var _lodash = require('lodash'); | ||
var _httpsProxyAgent = require('https-proxy-agent'); | ||
var _httpsProxyAgent2 = _interopRequireDefault(_httpsProxyAgent); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
function serializeAuth() { | ||
var _ref = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}, | ||
username = _ref.username, | ||
password = _ref.password; | ||
function serializeAuth({ username, password } = {}) { | ||
if (!username) { | ||
@@ -39,13 +17,3 @@ return ''; | ||
function parseAuth(authString) { | ||
// authString may be a falsy value like `null` | ||
var _split = (authString || '').split(':'), | ||
_split2 = _slicedToArray(_split, 2), | ||
username = _split2[0], | ||
password = _split2[1]; | ||
return { username, password }; | ||
} | ||
function proxyStringToObject(proxyString) { | ||
export function proxyStringToObject(proxyString) { | ||
if (!proxyString.startsWith('http')) { | ||
@@ -55,12 +23,15 @@ return proxyStringToObject(`http://${proxyString}`); | ||
var _parse = (0, _url.parse)(proxyString), | ||
host = _parse.hostname, | ||
portString = _parse.port, | ||
authString = _parse.auth, | ||
protocol = _parse.protocol; | ||
const parsedUrl = new URL(proxyString); | ||
var auth = parseAuth(authString); | ||
var port = (0, _lodash.toInteger)(portString); | ||
var isHttps = protocol === 'https:'; | ||
const host = parsedUrl.hostname; | ||
const portString = parsedUrl.port; | ||
const protocol = parsedUrl.protocol; | ||
const auth = { | ||
username: parsedUrl.username, | ||
password: parsedUrl.password | ||
}; | ||
const port = toInteger(portString); | ||
const isHttps = protocol === 'https:'; | ||
if (!auth.username) { | ||
@@ -78,11 +49,8 @@ return { host, port, isHttps }; | ||
function proxyObjectToString(proxyObject) { | ||
var hostname = proxyObject.host, | ||
port = proxyObject.port, | ||
authObject = proxyObject.auth; | ||
export function proxyObjectToString(proxyObject) { | ||
const { host: hostname, port, auth: authObject } = proxyObject; | ||
const auth = serializeAuth(authObject); | ||
var auth = serializeAuth(authObject); | ||
const formatted = format({ hostname, port, auth }); | ||
var formatted = (0, _url.format)({ hostname, port, auth }); | ||
// Ugly fix for Node 6 vs Node 8 behavior | ||
@@ -92,15 +60,13 @@ return formatted.replace(/^\/\//, ''); | ||
function agentFromProxy(proxy) { | ||
export function agentFromProxy(proxy) { | ||
if (!proxy) { | ||
return {}; | ||
} | ||
['http_proxy', 'https_proxy'].forEach(function (envStr) { | ||
['http_proxy', 'https_proxy'].forEach(envStr => { | ||
delete process.env[envStr]; | ||
delete process.env[envStr.toUpperCase()]; | ||
}); | ||
var host = proxy.host, | ||
port = proxy.port; | ||
var agent = new _httpsProxyAgent2.default({ host, port }); | ||
const { host, port } = proxy; | ||
const agent = new HttpsProxyAgent({ host, port }); | ||
return agent; | ||
} |
{ | ||
"name": "contentful-batch-libs", | ||
"version": "9.0.1", | ||
"version": "9.1.0", | ||
"description": "Library modules used by contentful batch utility CLI tools.", | ||
@@ -25,29 +25,27 @@ "main": "dist/index.js", | ||
"dependencies": { | ||
"bfj": "^5.2.1", | ||
"figures": "^2.0.0", | ||
"https-proxy-agent": "^3.0.0", | ||
"lodash": "^4.0.1", | ||
"moment": "^2.18.1" | ||
"bfj": "^7.0.2", | ||
"figures": "^3.2.0", | ||
"https-proxy-agent": "^5.0.0", | ||
"lodash": "^4.17.21", | ||
"moment": "^2.29.1" | ||
}, | ||
"devDependencies": { | ||
"babel-cli": "^6.24.0", | ||
"babel-core": "^6.25.0", | ||
"@babel/preset-env": "^7.16.4", | ||
"babel-cli": "^6.26.0", | ||
"babel-core": "^6.26.3", | ||
"babel-eslint": "^8.2.2", | ||
"babel-jest": "^22.1.0", | ||
"babel-plugin-add-module-exports": "^0.2.1", | ||
"babel-preset-env": "^1.6.1", | ||
"codecov": "^3.0.0", | ||
"cz-conventional-changelog": "^2.0.0", | ||
"eslint": "^4.14.0", | ||
"eslint-config-standard": "^11.0.0", | ||
"eslint-plugin-import": "^2.7.0", | ||
"eslint-plugin-jest": "^21.6.0", | ||
"eslint-plugin-node": "^6.0.1", | ||
"eslint-plugin-promise": "^3.5.0", | ||
"eslint-plugin-standard": "^3.0.1", | ||
"husky": "0.14.3", | ||
"jest": "^22.4.2", | ||
"rimraf": "^2.4.3", | ||
"semantic-release": "^12.4.1", | ||
"travis-deploy-once": "^4.4.1" | ||
"babel-jest": "^27.3.1", | ||
"babel-plugin-add-module-exports": "^1.0.4", | ||
"cz-conventional-changelog": "^3.3.0", | ||
"eslint": "^8.3.0", | ||
"eslint-config-standard": "^16.0.3", | ||
"eslint-plugin-import": "^2.25.3", | ||
"eslint-plugin-jest": "^25.3.0", | ||
"eslint-plugin-node": "^11.1.0", | ||
"eslint-plugin-promise": "^5.1.1", | ||
"eslint-plugin-standard": "^4.1.0", | ||
"husky": "7.0.4", | ||
"jest": "^27.3.1", | ||
"rimraf": "^3.0.2", | ||
"semantic-release": "^18.0.1" | ||
}, | ||
@@ -54,0 +52,0 @@ "files": [ |
# Contentful Batch Libs | ||
[![npm](https://img.shields.io/npm/v/contentful-batch-libs.svg)](https://www.npmjs.com/package/contentful-batch-libs) | ||
[![Build Status](https://travis-ci.org/contentful/contentful-batch-libs.svg?branch=master)](https://travis-ci.org/contentful/contentful-batch-libs) | ||
[![codecov](https://codecov.io/gh/contentful/contentful-batch-libs/branch/master/graph/badge.svg)](https://codecov.io/gh/contentful/contentful-batch-libs) | ||
[![Dependency Status](https://david-dm.org/contentful/contentful-batch-libs.svg)](https://david-dm.org/contentful/contentful-batch-libs) | ||
[![devDependency Status](https://david-dm.org/contentful/contentful-batch-libs/dev-status.svg)](https://david-dm.org/contentful/contentful-batch-libs#info=devDependencies) | ||
@@ -9,0 +5,0 @@ [![semantic-release](https://img.shields.io/badge/%20%20%F0%9F%93%A6%F0%9F%9A%80-semantic--release-e10079.svg)](https://github.com/semantic-release/semantic-release) |
@@ -11,2 +11,14 @@ import { | ||
// class NoErrorThrownError extends Error { } | ||
// const getError = async (call) => { | ||
// try { | ||
// await call() | ||
// throw new NoErrorThrownError() | ||
// } catch (error) { | ||
// return error | ||
// } | ||
// } | ||
jest.mock('../lib/logging', () => { | ||
@@ -46,3 +58,3 @@ const teardownHelperMock = jest.fn() | ||
test('wraps task and properly formats and throws error', () => { | ||
test('wraps task and properly formats and throws error', async () => { | ||
expect.assertions(9) | ||
@@ -56,16 +68,38 @@ | ||
return wrappedTask(ctx) | ||
.catch((err) => { | ||
expect(Object.keys(ctx)).toHaveLength(0, 'context got not modified by the task since it failed') | ||
expect(err.message).toBe('formatted: Task failed', 'error message contains formatted error message') | ||
expect(err.originalError.message).toBe('Task failed', 'original error message is still present') | ||
let err | ||
expect(logToTaskOutput.mock.calls).toHaveLength(1, 'task listener was initialized') | ||
expect(teardownHelperMock.mock.calls).toHaveLength(1, 'task listener was teared down again') | ||
expect(formatLogMessageOneLine.mock.calls).toHaveLength(1, 'error message was formatted') | ||
await wrappedTask(ctx) | ||
.catch((error) => { | ||
err = error | ||
}) | ||
expect(formatLogMessageOneLine.mock.calls[0][0].ts).not.toHaveLength(0, 'log message contains a timestamp') | ||
expect(formatLogMessageOneLine.mock.calls[0][0].level).toBe('error', 'log message has level of error') | ||
expect(formatLogMessageOneLine.mock.calls[0][0].error.message).toBe('Task failed', 'log message error has original error message') | ||
}) | ||
expect(Object.keys(ctx)).toHaveLength(0, 'context got not modified by the task since it failed') | ||
expect(err.message).toBe('formatted: Task failed', 'error message contains formatted error message') | ||
expect(err.originalError.message).toBe('Task failed', 'original error message is still present') | ||
expect(logToTaskOutput.mock.calls).toHaveLength(1, 'task listener was initialized') | ||
expect(teardownHelperMock.mock.calls).toHaveLength(1, 'task listener was teared down again') | ||
expect(formatLogMessageOneLine.mock.calls).toHaveLength(1, 'error message was formatted') | ||
expect(formatLogMessageOneLine.mock.calls[0][0].ts).not.toHaveLength(0, 'log message contains a timestamp') | ||
expect(formatLogMessageOneLine.mock.calls[0][0].level).toBe('error', 'log message has level of error') | ||
expect(formatLogMessageOneLine.mock.calls[0][0].error.message).toBe('Task failed', 'log message error has original error message') | ||
// const wrappedTask = wrapTask((taskCtx) => { | ||
// return Promise.reject(new Error('Task failed')) | ||
// }) | ||
// const err = await getError(async () => { wrappedTask(ctx) }) | ||
// expect(Object.keys(ctx)).toHaveLength(0, 'context got not modified by the task since it failed') | ||
// expect(err.message).toBe('formatted: Task failed', 'error message contains formatted error message') | ||
// expect(err.originalError.message).toBe('Task failed', 'original error message is still present') | ||
// expect(logToTaskOutput.mock.calls).toHaveLength(1, 'task listener was initialized') | ||
// expect(teardownHelperMock.mock.calls).toHaveLength(1, 'task listener was teared down again') | ||
// expect(formatLogMessageOneLine.mock.calls).toHaveLength(1, 'error message was formatted') | ||
// expect(formatLogMessageOneLine.mock.calls[0][0].ts).not.toHaveLength(0, 'log message contains a timestamp') | ||
// expect(formatLogMessageOneLine.mock.calls[0][0].level).toBe('error', 'log message has level of error') | ||
// expect(formatLogMessageOneLine.mock.calls[0][0].error.message).toBe('Task failed', 'log message error has original error message') | ||
}) |
@@ -67,3 +67,3 @@ import { | ||
const error = new Error(json) | ||
const output = formatLogMessageOneLine({error, level: 'error'}) | ||
const output = formatLogMessageOneLine({ error, level: 'error' }) | ||
expect(output).toBe('Error: Status: status - status text - Message: Some API error - Entity: 42 - Details: error detail - Request ID: 3') | ||
@@ -73,3 +73,3 @@ }) | ||
test('format one line message with level error', () => { | ||
const output = formatLogMessageOneLine({error: Error('normal error message'), level: 'error'}) | ||
const output = formatLogMessageOneLine({ error: Error('normal error message'), level: 'error' }) | ||
expect(output).toBe('Error: normal error message') | ||
@@ -79,3 +79,3 @@ }) | ||
test('format one line message with level warning', () => { | ||
const output = formatLogMessageOneLine({warning: 'warning text', level: 'warning'}) | ||
const output = formatLogMessageOneLine({ warning: 'warning text', level: 'warning' }) | ||
expect(output).toBe('warning text') | ||
@@ -85,3 +85,3 @@ }) | ||
test('format one line message with level info', () => { | ||
const output = formatLogMessageOneLine({info: 'info text', level: 'info'}) | ||
const output = formatLogMessageOneLine({ info: 'info text', level: 'info' }) | ||
expect(output).toBe('info text') | ||
@@ -114,3 +114,3 @@ }) | ||
const error = new Error(json) | ||
const output = formatLogMessageLogfile({error, level: 'error'}) | ||
const output = formatLogMessageLogfile({ error, level: 'error' }) | ||
expect(output.error.data.requestId).toBe(apiError.requestId) | ||
@@ -123,3 +123,3 @@ expect(output.error.data.message).toBe(apiError.message) | ||
const error = new Error('normal error message') | ||
const output = formatLogMessageLogfile({error, level: 'error'}) | ||
const output = formatLogMessageLogfile({ error, level: 'error' }) | ||
expect(output.error.message).toBe(error.message) | ||
@@ -129,3 +129,3 @@ }) | ||
test('format log file log message with level warning', () => { | ||
const logMessage = {warning: 'warning text', level: 'warning'} | ||
const logMessage = { warning: 'warning text', level: 'warning' } | ||
const output = formatLogMessageLogfile(logMessage) | ||
@@ -136,3 +136,3 @@ expect(output).toMatchObject(logMessage) | ||
test('format log file log message with level info', () => { | ||
const logMessage = {warning: 'info text', level: 'info'} | ||
const logMessage = { warning: 'info text', level: 'info' } | ||
const output = formatLogMessageLogfile(logMessage) | ||
@@ -139,0 +139,0 @@ expect(output).toMatchObject(logMessage) |
@@ -23,3 +23,3 @@ import assign from 'lodash/assign' | ||
name: 'name', | ||
locales: [ 'en-US' ] | ||
locales: ['en-US'] | ||
} | ||
@@ -48,3 +48,3 @@ | ||
type: 'Entry', | ||
contentType: assign(cloneDeep(linkMock), {linkType: 'ContentType'}), | ||
contentType: assign(cloneDeep(linkMock), { linkType: 'ContentType' }), | ||
locale: 'locale' | ||
@@ -59,9 +59,9 @@ }), | ||
type: 'EditorInterface', | ||
contentType: {sys: assign(cloneDeep(linkMock), {linkType: 'ContentType'})}, | ||
space: assign(cloneDeep(linkMock), {linkType: 'Space'}) | ||
contentType: { sys: assign(cloneDeep(linkMock), { linkType: 'ContentType' }) }, | ||
space: assign(cloneDeep(linkMock), { linkType: 'Space' }) | ||
}), | ||
controls: [ | ||
{ | ||
'fieldId': 'fieldId', | ||
'widgetId': 'singleLine' | ||
fieldId: 'fieldId', | ||
widgetId: 'singleLine' | ||
} | ||
@@ -68,0 +68,0 @@ ] |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
18
36204
103276
977
80
+ Addedagent-base@6.0.2(transitive)
+ Addedbfj@7.1.0(transitive)
+ Addedcheck-types@11.2.3(transitive)
+ Addeddebug@4.3.7(transitive)
+ Addeddeep-is@0.1.4(transitive)
+ Addedescodegen@1.14.3(transitive)
+ Addedesprima@1.2.24.0.1(transitive)
+ Addedestraverse@4.3.0(transitive)
+ Addedesutils@2.0.3(transitive)
+ Addedfast-levenshtein@2.0.6(transitive)
+ Addedfigures@3.2.0(transitive)
+ Addedhttps-proxy-agent@5.0.1(transitive)
+ Addedjsonpath@1.1.1(transitive)
+ Addedlevn@0.3.0(transitive)
+ Addedoptionator@0.8.3(transitive)
+ Addedprelude-ls@1.1.2(transitive)
+ Addedsource-map@0.6.1(transitive)
+ Addedstatic-eval@2.0.2(transitive)
+ Addedtype-check@0.3.2(transitive)
+ Addedunderscore@1.12.1(transitive)
+ Addedword-wrap@1.2.5(transitive)
- Removedagent-base@4.3.0(transitive)
- Removedbfj@5.3.1(transitive)
- Removedcheck-types@7.4.0(transitive)
- Removeddebug@3.2.7(transitive)
- Removedes6-promise@4.2.8(transitive)
- Removedes6-promisify@5.0.0(transitive)
- Removedfigures@2.0.0(transitive)
- Removedhttps-proxy-agent@3.0.1(transitive)
Updatedbfj@^7.0.2
Updatedfigures@^3.2.0
Updatedhttps-proxy-agent@^5.0.0
Updatedlodash@^4.17.21
Updatedmoment@^2.29.1