Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
name = Class.name,
options = {auto: false},
) => {
if (is.obj(name)) {
options = merge(options, name)
name = Class.name
}
const {preProcessSnapshot, postProcessSnapshot} = Class
// TS class property initializers and defaults from constructor
const values = new Class()
const {onSnapshot, onPatch, onAction} = values
let props = extractTaggedProps(Class, PropsKey)
props = pipe(
rdMap(args => args[0]),
convertValuesToMst,
)(props)
const propKeys = Object.keys(props)
const viewKeys = Object.keys(extractTaggedProps(Class, ViewsKey))
const ownKeys = Object.getOwnPropertyNames(values)
const omitKeys = ExcludeKeys.concat(propKeys).concat(viewKeys)
const descs = getOwnPropertyDescriptors(Class.prototype)
const views = pick(viewKeys, descs)
const volatile = omit(omitKeys, pick(ownKeys, values))
const actions = {}
pipe(
filter((desc, key) => !omitKeys.includes(key)),
forEach((desc, key) => {
import * as R from 'rambda';
import * as ts from '@terascope/utils';
import ajv from 'ajv';
export const getErrorMessages: (errors: ErrorLike[]) => string = R.pipe(
R.map(getErrorMessage),
R.join(', ')
);
export function throwValidationError(errors: ErrorLike[] | null | undefined): string | null {
if (errors == null) return null;
if (!errors.length) return null;
const errorMsg = getErrorMessages(errors);
const error = new ts.TSError(errorMsg, {
statusCode: 400,
});
Error.captureStackTrace(error, throwValidationError);
throw error;
}
function convertValuesToMst(obj) {
return rdMap(val => getMstType(val) || val)(obj)
}
export function renderSubtree(registry) {
return map(injectSubtree.bind(null, registry), uniqueContainers(registry))
}