Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
invoke = (action: Ro.ActionRepresentation | Ro.InvokableActionMember, parms: Dictionary, urlParms: Dictionary): Promise => {
const invokeMap = action.getInvokeMap();
if (invokeMap) {
each(urlParms, (v, k) => invokeMap.setUrlParameter(k!, v));
each(parms, (v, k) => invokeMap.setParameter(k!, v));
return this.retrieve(invokeMap, Ro.ActionResultRepresentation);
}
return Promise.reject(`attempting to invoke uninvokable action ${action.actionId()}`);
}
private handleRedirectedObject(response: Ro.IHateoasModel, data: Ro.IRepresentation) {
if (response instanceof Ro.ActionResultRepresentation && Ro.isIDomainObjectRepresentation(data)) {
const actionResult: Ro.IActionInvokeRepresentation = {
resultType: 'object',
result: data,
links: [],
extensions: {}
};
return actionResult;
}
return data;
}
private invokeActionInternal(
invokeMap: Ro.InvokeMap,
action: Ro.ActionRepresentation | Ro.InvokableActionMember,
fromPaneId: number,
toPaneId: number,
setDirty: () => void,
gotoResult: boolean = false) {
invokeMap.inlinePropertyDetails(false);
if (action.extensions().returnType() === 'list' && action.extensions().renderEagerly()) {
invokeMap.inlineCollectionItems(true);
}
return this.repLoader.retrieve(invokeMap, Ro.ActionResultRepresentation, action.parent.etagDigest)
.then((result: Ro.ActionResultRepresentation) => {
setDirty();
this.setMessages(result);
if (gotoResult) {
this.setResult(action, result, fromPaneId, toPaneId, 1, this.configService.config.defaultPageSize);
}
return result;
});
}