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 createView(app: IObjectRef, viewId: string, idtype: IDType, selection: Range, options?): IAction {
const view = getPlugin(EXTENSION_POINT_TDP_VIEW, viewId);
// assert view
return action(meta('Add ' + view.name, cat.visual, op.create), CMD_CREATE_VIEW, createViewImpl, [app], {
viewId,
idtype: idtype ? idtype.id : null,
selection: selection ? selection.toString() : none().toString(),
options
});
}
export function setAndUpdateSelection(view: IObjectRef, target: IObjectRef, idtype: IDType, range: Range) {
// assert view
return action(meta('Select ' + (idtype ? idtype.name : 'None'), cat.selection, op.update), CMD_SET_SELECTION, setSelectionImpl, [view, target], {
idtype: idtype ? idtype.id : null,
range: range.toString()
});
}
export function replaceView(app: IObjectRef, existingView: IObjectRef, viewId: string, idtype: IDType, selection: Range, options?): IAction {
const view = getPlugin(EXTENSION_POINT_TDP_VIEW, viewId);
// assert view
return action(meta('Replace ' + existingView.name + ' with ' + view.name, cat.visual, op.update), CMD_REPLACE_VIEW, replaceViewImpl, [app, existingView], {
viewId,
idtype: idtype ? idtype.id : null,
selection: selection ? selection.toString() : none().toString(),
options
});
}
export function setSelection(view: IObjectRef, idtype: IDType, range: Range) {
// assert view
return action(meta('Select ' + (idtype ? idtype.name : 'None'), cat.selection, op.update), CMD_SET_SELECTION, setSelectionImpl, [view], {
idtype: idtype ? idtype.id : null,
range: range.toString()
});
}
export function removeView(app: IObjectRef, view: IObjectRef, oldFocus = -1): IAction {
// assert view
return action(meta('Remove ' + view.toString(), cat.visual, op.remove), CMD_REMOVE_VIEW, removeViewImpl, [app, view], {
viewId: view.value.desc.id,
focus: oldFocus
});
}
export function removeScore(provider:IObjectRef, scoreId: string, params: any, columnId: string|string[]) {
return action(meta('Remove Score', cat.data, op.remove), CMD_REMOVE_SCORE, removeScoreImpl, [provider], {
id: scoreId,
params,
columnId
});
}
export async function pushScoreAsync(graph: ProvenanceGraph, provider:IObjectRef, scoreId: string, params: any) {
const actionParams = {id: scoreId, params};
const result = await addScoreAsync([provider], actionParams);
return graph.pushWithResult(action(meta('Add Score', cat.data, op.create), CMD_ADD_SCORE, addScoreImpl, [provider], actionParams), result);
}