Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
Object.keys(prevDeps).forEach(name => {
// Is package to be removed? Only if it belongs to the internal
// subpackage list (`pkgNames`) or it matches the custom `linkPattern`
const fRemove =
pkgNames.indexOf(name) >= 0 || (regex != null && regex.test(name));
if (!fRemove) return;
const version = prevDeps[name];
if (version == null) return;
nextDeps = omit(nextDeps, [name]);
if (!removedPackagesByType[type]) removedPackagesByType[type] = {};
removedPackagesByType[type][name] = version;
allRemovedPackages[name] = version;
});
nextSpecs = timmSet(nextSpecs, type, nextDeps);
const mergeSchemas = (a: Schema, b: Schema): Schema => {
let out = a;
// Non-model specs are merged from `b`
out = merge(out, omit(b, ['models']));
// Merge models
let models = out.models;
Object.keys(b.models).forEach(modelName => {
let model = models[modelName];
const bModel: Object = b.models[modelName];
// Models from b that didn't exist in a
if (!model) {
models = timmSet(models, modelName, bModel);
return;
}
// Preexisting models
const { description, includes, fields, relations } = bModel;
model = merge(model, {
const cloneNodeForLogging = (node: Node): Object =>
omit(node, ['_parent', '_children']);
Object.keys(fields).forEach(fieldName => {
if (fieldName === 'id' && op === 'create') return;
const field = fields[fieldName];
if (!field.existsInServer || !field.existsInClient) return;
const spec = omit(
field,
op === 'create' ? ['description'] : ['description', 'isRequired']
);
contents = contents.concat(writeField(fieldName, spec, options));
});
Object.keys(relations).forEach(fieldName => {
const doDeserialize = (obj) => {
if (!isObject(obj)) return obj;
let out;
if (Array.isArray(obj)) {
out = obj.map((el) => doDeserialize(el));
} else if (obj instanceof Date) {
out = new Date(obj);
} else {
switch (obj[STORYBOARD_TYPE_ATTR]) {
case 'UNDEFINED':
out = undefined;
break;
case 'ERROR':
out = omit(obj, STORYBOARD_TYPE_ATTR);
break;
case 'BUFFER':
out = Buffer.from(obj.data);
break;
default:
out = {};
Object.keys(obj).forEach((key) => {
out[key] = doDeserialize(obj[key]);
});
break;
}
}
return out;
};
Model.prototype.toJSON = function toJSON() {
let json = originalToJSON.call(this);
json = omit(json, notPublishedFields);
return json;
};
.then(() => {
const persistedSettings = omit(settings, ['serverFilter', 'localClientFilter']);
this.props.updateSettings(persistedSettings);
if (settings.serverFilter !== this.props.serverFilter) {
this.props.setServerFilter(settings.serverFilter);
}
if (settings.localClientFilter !== this.props.localClientFilter) {
this.props.setLocalClientFilter(settings.localClientFilter);
}
this.props.onClose();
});
}