Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
export function getFields(field: Ro.IField): Ro.IField[] {
if (field instanceof Ro.Parameter) {
const action = field.parent;
if (action instanceof Ro.InvokableActionMember || action instanceof Ro.ActionRepresentation) {
const parms = action.parameters();
return map(parms, p => p as Ro.IField);
}
}
if (field instanceof Ro.PropertyMember) {
// todo
return [];
}
return [];
}
private handleConditionalChoices(field: Ro.IField, updating: boolean, fieldEntry?: string, ) {
let enteredFields: Dictionary;
const allFields = Commandresult.getFields(field);
if (field instanceof Ro.Parameter) {
enteredFields = Commandresult.getParametersAndCurrentValue(field.parent, this.context);
}
if (field instanceof Ro.PropertyMember) {
enteredFields = this.getPropertiesAndCurrentValue(field.parent as Ro.DomainObjectRepresentation);
}
// TODO fix this any cast
const args = fromPairs(map(field.promptLink()!.arguments()! as any, (v: any, key: string) => [key, new Ro.Value(v.value)])) as Dictionary;
forEach(keys(args), key => args[key] = enteredFields[key]);
let fieldEntryOrExistingValue: string;
if (fieldEntry === undefined) {
const def = args[field.id()];
fieldEntryOrExistingValue = def ? def.toValueString() : '';