Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
schemaBaseClone.required = schemaBaseClone.required.concat(
schemaBaseClone.dependencies[dependencyKey]
);
}
}
}
}
// split schemas up based on optional dependencies
for (let dependencyKey of dependencyKeys) {
let isRequired =
Array.isArray(schema.required) &&
schema.required.indexOf(dependencyKey) !== -1;
if (!isRequired) {
let optionalSchemaClone = clone(schemaBaseClone);
optionalSchemaClone.required.push(dependencyKey);
optionalSchemaClone.required = optionalSchemaClone.required.concat(
optionalSchemaClone.dependencies[dependencyKey]
);
schemasPermutated.push(optionalSchemaClone);
delete schemaBaseClone.properties[dependencyKey];
}
}
// the base schema with no options
schemasPermutated.push(schemaBaseClone);
}
return schemasPermutated;
};
function removeUndefinedKeys(data: any): any {
const clonedData: any = cloneDeep(data);
if (clonedData !== undefined) {
Object.keys(clonedData).forEach((key: string) => {
if (typeof clonedData[key] === "undefined") {
// if this is a child we may be getting undefined default props, remove these
delete clonedData[key];
}
});
}
return clonedData;
}
it('renders YAML editor component', () => {
wrapper = wrapper.setProps({ClusterServiceVersion: {loaded: true, data: _.cloneDeep(testClusterServiceVersion)}} as any);
expect(wrapper.find(Firehose).childAt(0).dive().find(CreateYAML).exists()).toBe(true);
});
getAllBatchDetails() {
this.showBatchList = false;
this.showError = false;
this.batchList = [];
const searchParams: any = {
filters: {
status: this.batchStatus.toString(),
courseId: this.courseId
},
offset: 0,
sort_by: { createdDate: 'desc' }
};
const searchParamsCreator = _.cloneDeep(searchParams);
const searchParamsMentor = _.cloneDeep(searchParams);
if (this.courseMentor) {
searchParamsCreator.filters.createdBy = this.userService.userid;
searchParamsMentor.filters.mentors = [this.userService.userid];
combineLatest(
this.courseBatchService.getAllBatchDetails(searchParamsCreator),
this.courseBatchService.getAllBatchDetails(searchParamsMentor),
).pipe(takeUntil(this.unsubscribe))
.subscribe((data) => {
this.batchList = _.union(data[0].result.response.content, data[1].result.response.content);
if (this.batchList.length > 0) {
this.fetchUserDetails();
} else {
this.showBatchList = true;
}
}, (err) => {
onFilterChange(filterType, id, value) {
const { activeFilters, selectedCategoryId, categories } = this.state;
if (filterType === 'keyword') {
updateURLParams(KEYWORD_URL_PARAM, `${value}`);
} else {
const groupFilter = _.cloneDeep(activeFilters[filterType]);
_.set(groupFilter, [id, 'active'], value);
updateURLParams(filterType, getFilterSearchParam(groupFilter));
}
const updatedFilters = updateActiveFilters(activeFilters, filterType, id, value);
this.updateMountedState(this.getUpdatedState(categories, selectedCategoryId, updatedFilters));
}
settleColor,
settleFillColor,
bidColor,
bidFillColor,
askColor,
askFillColor,
axisLineColor
} = this._getThemeColors();
let {name: baseSymbol, prefix: basePrefix} = utils.replaceName(base);
let {name: quoteSymbol, prefix: quotePrefix} = utils.replaceName(quote);
baseSymbol = (basePrefix || "") + baseSymbol;
quoteSymbol = (quotePrefix || "") + quoteSymbol;
let flatBids = cloneDeep(flat_bids),
flatAsks = cloneDeep(flat_asks),
flatCalls = cloneDeep(flat_calls),
flatSettles = cloneDeep(flat_settles);
let config = {
chart: {
type: "area",
backgroundColor: "rgba(255, 0, 0, 0)",
spacing: [10, 0, 5, 0]
},
title: {
text: null
},
credits: {
enabled: false
},
legend: {
data() {
return {
value: null,
schema: null,
loadingPromise: null,
localErrors: {},
molDBOptions: [],
possibleAdducts: {},
metaspaceOptions: cloneDeep(defaultMetaspaceOptions),
submitter: null,
initialValue: null,
initialMetaspaceOptions: null,
}
},
validate(externalErrors?: IShortValidationErrors, validatorOptions?: ValidatorOptions) {
if (externalErrors === undefined) {
externalErrors = cloneDeep(this.externalErrors);
}
if (validatorOptions === undefined) {
validatorOptions = cloneDeep(this.validatorOptions);
}
if (!externalErrors) {
externalErrors = {};
}
const errors = validateSync(this.object, validatorOptions);
const transformedErrors = this.transformValidationErrors(errors);
const allErrors = this.mergeErrors(externalErrors, transformedErrors);
this.markAsInvalidForExternalErrors(externalErrors, this.controls);
this.customValidateErrors.next(allErrors);
}
private markAsInvalidForExternalErrors(errors: IShortValidationErrors, controls: {
getUserList(requestParam: SearchParam = {}): Observable {
if (_.isEmpty(requestParam) && this.defaultUserList) {
return observableOf(this.defaultUserList);
} else {
const request = _.cloneDeep(requestParam);
const option = {
url: this.configService.urlConFig.URLS.ADMIN.USER_SEARCH,
data: {
request: {
filters: requestParam.filters || {},
query: requestParam.query || ''
}
}
};
if (requestParam.limit) {
option.data.request['limit'] = requestParam.limit;
}
const mentorOrg = this.userService.userProfile.roleOrgMap['COURSE_MENTOR'];
if (mentorOrg && mentorOrg.includes(this.userService.rootOrgId)) {
option.data.request.filters['rootOrgId'] = this.userService.rootOrgId;
} else if (mentorOrg) {
public resolver(schema: any, data: any): any {
if (data.pluginModifiedString === 5) {
return undefined;
}
return Object.assign({}, schema, { type: "number" });
}
}
const plugins: Array> = [
new MyUpdateSchemaPlugin({
id: "plugins/pluginModifiedString",
}),
];
const beforeDataUpdateSchema: any = cloneDeep(pluginSchema);
set(beforeDataUpdateSchema, "properties.pluginModifiedString.type", "number");
set(
beforeDataUpdateSchema,
"properties.oneOfs.oneOf[0].properties.pluginModifiedString.type",
"number"
);
const mappedSchema: any = mapPluginsToSchema(pluginSchema, {}, plugins);
expect(mappedSchema).toEqual(beforeDataUpdateSchema);
const afterDataUpdateSchema: any = cloneDeep(mappedSchema);
unset(afterDataUpdateSchema, "properties.pluginModifiedString");
unset(
afterDataUpdateSchema,
"properties.oneOfs.oneOf[0].properties.pluginModifiedString"