Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
public static addInputSchemaToOperatorSchema(operatorSchema: OperatorSchema, inputSchema: ReadonlyArray): OperatorSchema {
// If the inputSchema is empty, just return the original operator metadata.
if (!inputSchema || inputSchema.length === 0) {
return operatorSchema;
}
const jsonSchemaToModify = cloneDeep(operatorSchema.jsonSchema);
const operatorProperties = jsonSchemaToModify.properties;
if (!operatorProperties) {
throw new Error(`Operator ${operatorSchema.operatorType} does not have properties in its schema`);
}
// There are some operators which only take one of the attributes as input (eg: Analytics group) and some
// which take more than one (eg: Search group). Therefore, the jsonSchema for these operators are different.
// TODO: Standardize this i.e. All operators should accept input schema in a common key of json.
// TODO: Join operators have two inputs - inner and outer. Autocomplete API currently returns all attributes
// in a single array. So, we can't differentiate between inner and outer. Therefore, autocomplete isn't applicable
// to Join yet.
const items_key_in_schemajson = 'items';
const attribute_list_key_in_schemajson = 'attributes';
const single_attribute_in_schemajson = 'attribute';
if (single_attribute_in_schemajson in operatorProperties) {
newNode.options.tupleItems ? 'tuple' : 'list';
}
if (isArray(newNode.items)) {
const arrayListItems =
newNode.items.filter(item => item.type !== '$ref').length -
newNode.options.tupleItems;
if (arrayListItems > newNode.options.listItems) {
newNode.options.listItems = arrayListItems;
nodeDataMap.set('listItems', arrayListItems);
}
}
if (!hasOwn(jsf.layoutRefLibrary, itemRefPointer)) {
jsf.layoutRefLibrary[itemRefPointer] =
cloneDeep(newNode.items[newNode.items.length - 1]);
if (recursive) {
jsf.layoutRefLibrary[itemRefPointer].recursiveReference = true;
}
forEach(jsf.layoutRefLibrary[itemRefPointer], (item, key) => {
if (hasOwn(item, '_id')) { item._id = null; }
if (recursive) {
if (hasOwn(item, 'dataPointer')) {
item.dataPointer = item.dataPointer.slice(itemRefPointer.length);
}
}
}, 'top-down');
}
// Add any additional default items
if (!newNode.recursiveReference || newNode.options.required) {
const arrayLength = Math.min(Math.max(
parseLogs() {
this.splittedLogs = this.getLogsSplitted()
.map((log, i) => {
if (this.ansiViewSelected) {
return { lineNumber: i + 1, value: this.ansi_up.ansi_to_html(log) };
}
return { lineNumber: i + 1, value: log };
});
this.splittedLogsToDisplay = cloneDeep(this.splittedLogs);
if (!this.allLogsView && this.splittedLogs.length > 1000 && !this._route.snapshot.fragment) {
this.limitFrom = 30;
this.limitTo = this.splittedLogs.length - 40;
this.splittedLogsToDisplay.splice(this.limitFrom, this.limitTo - this.limitFrom);
} else {
this.splittedLogsToDisplay = this.splittedLogs;
}
}
const createInitialState = (currentState) => ({ ...cloneDeep(currentState), ...defaultFields })
set pipeline(data: Pipeline) {
this.oldName = data.name;
this.editablePipeline = cloneDeep(data);
}
.subscribe(app => {
this.selectedApplication = app;
this.variables = cloneDeep(app.variables);
if (this.variables) {
this.variables.forEach(v => {
if (v.type === 'password') {
v.value = '';
}
});
}
this._cd.markForCheck();
});
}
selectedJobManual(j: Job) {
let queryParams = cloneDeep(this._route.snapshot.queryParams);
queryParams['stageId'] = null;
queryParams['actionId'] = null;
queryParams['stepOrder'] = null;
queryParams['line'] = null;
this.manual = true;
this._router.navigate(['.'], { relativeTo: this._route, queryParams, fragment: null });
this.selectedJob(j);
}
private initializeData() {
if (hasValue(this.data)) {
this.jsf.formValues = cloneDeep(this.data);
this.formValuesInput = 'data';
} else if (hasValue(this.model)) {
this.jsf.AngularSchemaFormCompatibility = true;
this.jsf.formValues = cloneDeep(this.model);
this.formValuesInput = 'model';
} else if (hasValue(this.ngModel)) {
this.jsf.AngularSchemaFormCompatibility = true;
this.jsf.formValues = cloneDeep(this.ngModel);
this.formValuesInput = 'ngModel';
} else if (isObject(this.form) && hasValue(this.form.value)) {
this.jsf.JsonFormCompatibility = true;
this.jsf.formValues = cloneDeep(this.form.value);
this.formValuesInput = 'form.value';
} else if (isObject(this.form) && hasValue(this.form.data)) {
this.jsf.formValues = cloneDeep(this.form.data);
this.formValuesInput = 'form.data';
reset: () => {
this.userUnderEdit = cloneDeep(this.userData);
},
delete: () => {