Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
const consoleFormatter = format(info => {
const stringifiedRest = jsonStringify(
Object.assign({}, info, {
level: undefined,
label: undefined,
message: undefined,
splat: undefined,
timestamp: undefined,
// in case error is an Error object, make it undefined here, since we print it separately
error: info.error instanceof Error ? undefined : info.error
}),
undefined,
2
)
const padding = (info.padding && info.padding[info.level]) || ''
if (stringifiedRest !== '{}') {
info[MESSAGE] = `${info.timestamp} [${info.label}] ${info.level}:${padding} ${info.message}\n${stringifiedRest}`
const eq = (str1, str2) => stringify(str1) === stringify(str2)
export function getExploreLongUrl(formData, endpointType, allowOverflow = true, extraSearch = {}) {
if (!formData.datasource) {
return null;
}
const uri = new URI('/');
const directory = getURIDirectory(formData, endpointType);
const search = uri.search(true);
Object.keys(extraSearch).forEach(key => {
search[key] = extraSearch[key];
});
search.form_data = safeStringify(formData);
if (endpointType === 'standalone') {
search.standalone = 'true';
}
const url = uri
.directory(directory)
.search(search)
.toString();
if (!allowOverflow && url.length > MAX_URL_LENGTH) {
const minimalFormData = {
datasource: formData.datasource,
viz_type: formData.viz_type,
};
return getExploreLongUrl(minimalFormData, endpointType, false, {
URL_IS_TOO_LONG_TO_SHARE: null,
});
protected valueToString(res: any): string {
if (res === undefined) {
return this.placeholderUndefined
}
if (typeof res !== 'object') {
return res.toString()
}
if (res instanceof Error) {
res = this.errorFormat(res)
}
if (Array.isArray(res)) {
const arrayWithStringifiedElements = res.map(this.valueToString.bind(this))
return `[${arrayWithStringifiedElements.join(', ')}]`
}
return stringify(res)
}
public getDynamicMetadataToken(
dynamicModuleMetadata: Partial | undefined
): string {
return dynamicModuleMetadata ? stringify(dynamicModuleMetadata) : ''
}
? values => stringify(values, null, 2)
: values => stringify(values)
concatMap(value =>
of(
(json || _.isObject(value) ? stringify(value) : String(value)) + newline
)
)
'use strict'
const fastStringify = require('fast-safe-stringify').stable;
const runHttpQuery = require('apollo-server-core').runHttpQuery;
function graphql(options) {
return {
method: ['GET', 'POST'],
url: options.path,
schema: {
querystring: {
query: {
type: 'string'
}
},
body: {
type: 'object',
properties: {
query: {
module.exports = format((info, opts = {}) => {
info[MESSAGE] = (opts.stable ? jsonStringify.stableStringify
: jsonStringify)(info, opts.replacer || replacer, opts.space);
return info;
});