Best JavaScript code snippet using stryker-parent
admmap.d.ts
Source:admmap.d.ts
1declare module HyperGraph.Layout {2 /**3 * Layout interfaces were moved here from the Service Map layout manager component.4 * Each solution should be able to provide their own implementations.5 * 6 * It has the capability of supporting three update patterns:7 * 1. Scratch: only nodes & edges added since the last doLayout call are used.8 * 2. Incremental: previous state is preserved and add/remove calls update that model (NOT SUPPORTED YET).9 * 3. Incremental + diff: caller updates entire model each time and layout service performs a diff against old model.10 * Remove calls are not necessary since the layout service will remove unreferenced elements.11 *12 * Set the incremental flag to true for update pattern #3.13 */14 export interface ILayoutManager {15 /**16 * Behaves like upsert. Adds node or marks existing node as included in the layout. 17 * Updates properties, e.g. existing node style expansion state.18 */19 addNode(id: string, parentId: string, rootId: string, expanded: boolean, nodeStyle?: INodeStyle): LayoutNode;20 addEdge(source: string, destination: string, resourceId?: string): LayoutEdge;21 /**22 * Processes the add/remove command queue to build a layout model, then calls yFiles23 * layouter to lay out the graph. Height, width and position are updated.24 * Returns LayoutGraph containing LayoutNode and LayoutEdge objects.25 */26 doLayout(layoutUpdatePattern: LayoutUpdatePattern, suggestedNodeOrder?: NodeOrderMap): LayoutGraph;27 clearGraph();28 isLayoutTypeSupported(layoutUpdatePattern: LayoutUpdatePattern): boolean;29 }30 31 export interface LayoutNode {32 id: string;33 parentId: string;34 rootId: string;35 x: number;36 y: number;37 width: number;38 height: number;39 isExpanded: boolean;40 isVisible: boolean;41 numChildren?: number;42 nodeStyle: INodeStyle;43 destinationId?: string;44 isAddedSinceLastLayout?: boolean;45 }46 /**47 * Set by layout service if edge routing is supported48 */49 export interface LayoutEdge {50 id: string;51 source: string;52 destination: string;53 segments: number[][];54 isVisible: boolean;55 sourceEdgePort: EdgePort;56 targetEdgePort: EdgePort;57 isAddedSinceLastLayout?: boolean;58 }59 export interface LayoutGraph {60 bb: BoundingBox;61 nodes: LayoutNode[];62 edges: LayoutEdge[];63 }64 65 export interface BoundingBox {66 x: number;67 y: number;68 width: number;69 height: number;70 }71 export interface SpacingBox {72 top: number;73 right: number;74 bottom: number;75 left: number;76 }77 export const enum EdgePort {78 Center,79 Top1,80 Top2,81 Top3,82 Right1,83 Right2,84 Bottom1,85 Bottom2,86 Bottom3,87 Left1,88 Left289 }90 91 export interface INodeStyle {92 name: string;93 width: number;94 height: number;95 contentLayout: LayoutStyle; // enum: list, orthog, ring96 margin: SpacingBox; // outside of node97 padding: SpacingBox; // inside node between border and child content bounds98 } 99 100 // fixme: should this be extensible?101 // seems like the layout manager should register its layout style somewhere102 export const enum LayoutStyle {103 List,104 Ihl105 }106 export const enum RoutingStyle {107 Polyline,108 Orthogonal109 }110 // Internal enum used by LayoutManager and custom layouters111 export const enum LayoutMode {112 Scratch,113 Incremental114 }115 // The model no longer uses this concept. Instead it's always IncrementalDiff and116 // the model can be cleared before an update for Scratch behavior. The model generates117 // an event that provides diff information.118 export const enum LayoutUpdatePattern {119 Scratch,120 Incremental,121 IncrementalDiff122 }123 export interface ILayoutAlgorithm {124 applyLayout(graph: any,125 mode: LayoutMode,126 incrementalNodes?: IncrementalNodesMap,127 incrementalEdges?: IncrementalEdgesMap,128 nodeOrderMap?: NodeOrderMap ): void;129 }130 export interface LayoutOptions {131 syntheticEdges?: boolean;132 }133 // Map of nodes to be treated as incremental134 export type IncrementalNodesMap = { [id: string]: LayoutNode };135 // Map of edges to be treated as incremental136 export type IncrementalEdgesMap = { [id: string]: LayoutEdge };137 // Map of node id to relative order in parent138 export type NodeOrderMap = { [id: string]: string[] };139}140declare module HyperGraph {141 interface D3EventHandler {142 (datum: any, index: number, outerIndex: number): any;143 }144 interface GraphEventHandler {145 (event: Event, node: GraphEntity, action: string, domId: string, resolvedTarget: any): void;146 }147 class Controller implements Disposable {148 widget: GraphWidget;149 interactionAdapter: InteractionStateMachine;150 private _mouseCapture;151 /** If true, disable zoom in/out behavior on mouse wheel events. Default to false. */152 disableMouseWheelZoom: boolean;153 private _sharedHandlerMap;154 private _eventHandlerMap;155 constructor(widget: GraphWidget);156 dispose(): void;157 /**158 * Sets up event handlers for interacting with the control. They're added for auto-disposal.159 */160 initEventHandlers(): void;161 addMouseCaptureHandlers(dragMouseMoveHandler: (e: MouseEvent) => void, dragMouseUpHandler: (e: MouseEvent) => void): void;162 addEventHandlers(eventHandlers: {163 [key: string]: GraphEventHandler;164 }): void;165 protected _sharedEventHandler(evt: Event, datum: any): void;166 removeEventHandlers(): void;167 /**168 * Callback for when the user moves the mouse after pressing a mouse button.169 */170 private _dragMouseMove;171 /**172 * Callback for when the user releases a mouse button.173 *174 * @param e The mouse event.175 */176 private _dragMouseUp;177 /**178 * Callback for when the user hovers a graph entity with a mouse.179 * @param graphEntity the view model backing the thing which they hovered.180 */181 /**182 * Callback for when the user leaves a hover off a graph entity with a mouse.183 * @param graphEntity the view model backing the thing which they left the mouse hover.184 */185 /**186 * Callback for when the user right-clicks on a graph entiry.187 * Long touch (hammer event press) also defaults to right-click.188 *189 * @param graphEntity the view model backing the thing which was right-clicked.190 * @param evt the event object defining the right-click.191 */192 private _entityMouseRightClick;193 /**194 * Callback for when the user presses a mouse button on a graph entity.195 *196 * @param graphEntity the view model backing the thing on which they pressed the mouse button.197 * @param e The mouse event.198 */199 private _entityMouseDown;200 /**201 * Callback for then the user releases a mouse button on a graph entity.202 *203 * @param graphEntity the view model backing the thing on which they released the mouse button.204 * @param e The mouse event.205 */206 private _entityMouseUp;207 private _entityFocusIn;208 /**209 * Callback for when the user presses a mouse button on the canvas.210 *211 * @param canvasViewModel Unused, but Knockout passes view models first in its event binding.212 * @param e The mouse event.213 */214 private _canvasMouseDown;215 /**216 * Callback for when the user releases a mouse button on the canvas.217 *218 * @param canvasViewModel Unused, but Knockout passes view models first in its event binding.219 * @param e The mouse event.220 */221 private _canvasMouseUp;222 /**223 * Callback for when the user scrolls the mouse wheel.224 *225 * The default behavior is for the mouse wheel to zoom the graph control in or out.226 * If the disableMouseWheelZoom option is set to true, the mouse wheel will instead pan the graph control up or down.227 *228 * @param e The mouse wheel event. This could be WheelEvent or MouseWheelEvent, depending on what the browser supports.229 */230 private _mouseWheel;231 /**232 * Callback for when the graph control resizes for any reason.233 */234 private _resize;235 /**236 * Callback for when the user mousedowns on the scrollbar. Stops events from propagating.237 *238 * @param viewModel The view model of the graph control.239 * @param e The mouse event.240 * @return Returns to true to tell Knockout to not prevent default.241 */242 private _scrollBarMouseDown;243 /**244 * Callback for when the user slides the horizontal scrollbar.245 *246 * @param e The scroll event.247 */248 private _scrollX;249 /**250 * Callback for when the user slides the vertical scrollbar.251 *252 * @param e The scroll event.253 */254 private _scrollY;255 /**256 * Handles key down events when the user presses a keyboard key.257 * @param e The keyboard event.258 */259 private _canvasKeyDown;260 /**261 * Callback for when the user depresses a keyboard key.262 *263 * @param e The keyboard event.264 */265 private _keyUp;266 /**267 * Handles the beginning and end of all gestures.268 *269 * @param e The gesture event270 */271 /**272 * Zooms and pans using a Hammer pinch event.273 *274 * @param e The pinch event275 */276 /**277 * Handles the screen being dragged.278 *279 * @param e The drag event280 */281 /**282 * Handles the screen being tapped.283 *284 * @param e The tap event285 */286 /**287 * Pans with inertia using a Hammer swipe event.288 *289 * @param e The swipe event290 */291 /**292 * Handles a hold on the screen.293 *294 * @param e The hold event295 */296 /**297 * Handles a tap on an entity.298 *299 * @param viewModel The GraphEntity of the entity being handled300 * @param e The tap event301 */302 /**303 * Handles a doubletap on an entity.304 * Note: when the user doubletaps, only the doubletap event will fire, not a second tap event.305 *306 * @param viewModel The GraphEntity of the entity being doubletapped307 * @param e The doubletap event308 */309 /**310 * Returns true if the specified event's target or any of its ancestors has the 'msportalfx-graph-ignore-input' CSS class311 *312 * @param e The event with the target element to check313 * @return A Boolean indicating whether the Graph should ignore the event314 */315 private _ignoreEvt;316 /**317 * Returns a string with the name of the mouse wheel event handler to listen to318 *319 * @param el The element to attach the event listener to320 * @return A string with the name of the event to listen to321 */322 private _getMouseWheelEventName;323 }324}325/// <reference types="q" />326declare module HyperGraph {327 /** Actions the user can take on the graph control. */328 const enum InteractionAction {329 /** The user double-clicked in a graph control using any mousebutton. */330 MouseDoubleClick = 0,331 /** The user pressed any mouse button in the graph control (on an entity, the canvas, etc.) */332 MouseDown = 1,333 /** The user released any mouse button in the graph control (on an entity, the canvas, etc.) */334 MouseUp = 2,335 /** The user dragged the mouse. */336 MouseMove = 3,337 /** The user pressed the delete key. */338 DeleteKeyPressed = 4,339 /** The user pressed the escape key. */340 EscapeKeyPressed = 5,341 /** The user pressed the 'A' key while holding shift. */342 CtrlAPressed = 6,343 /** The user pressed F2. */344 F2KeyPressed = 7,345 /** The user pressed 'X' while holding control. */346 ControlXPressed = 8,347 /** The user pressed the spacebar key */348 SpacebarDown = 9,349 /** The user depressed the spacebar key. */350 SpacebarUp = 10,351 /** The user pressed the up arrow. */352 UpKeyPressed = 11,353 /** The user pressed the down arrow. */354 DownKeyPressed = 12,355 /** The user pressed the left arrow. */356 LeftKeyPressed = 13,357 /** The user pressed the right arrow. */358 RightKeyPressed = 14,359 /** The user pressed the enter key */360 EnterKey = 15,361 /** The user is tabbing through the graph. Overridden only when the graph has focus */362 TabKey = 16,363 /** The user tapped an entity. */364 EntityTapped = 17,365 /** The key associtated with zooming in */366 ZoomInKeyPressed = 18,367 /** The key associated with zooming out */368 ZoomOutKeyPressed = 19,369 /** The key associated with zoom fill */370 ZoomFitKeyPressed = 20,371 /** The key associated with zooming to 100% */372 Zoom100PercentKeyPressed = 21,373 /** Changes the behavior of the tab key */374 TabBehaviorChange = 22,375 /** The user doubletapped a node. */376 NodeDoubleTapped = 23,377 /** The user dragged a node. */378 NodeDragged = 24,379 /** The user held a node. */380 NodeHeld = 25,381 /** The user entered edge creation mode */382 EdgeCreateStartKey = 26,383 /** The user entered edge select mode. */384 EdgeSelectKey = 27,385 /** The user dragged the sceen. */386 ScreenDragged = 28,387 /** The user pinched the screen. */388 ScreenPinched = 29,389 /** The user swiped the screen. */390 ScreenSwiped = 30,391 /** The user held the screen. */392 ScreenHeld = 31,393 /** The user tapped the screen. */394 ScreenTapped = 32,395 /** The user started a gesture. */396 GestureStarted = 33,397 /** The user ended a gesture. */398 GestureEnded = 34,399 }400 enum Direction {401 Left = 0,402 Right = 1,403 Up = 2,404 Down = 3,405 Descend = 4,406 Ascend = 5,407 }408 enum ElementType {409 Node = 0,410 Edge = 1,411 GroupMember = 2,412 ProcessNode = 3,413 ProcessGroupNodeLink = 4,414 ContextMenu = 5,415 PrevOrNext = 6,416 }417 class InteractionStateMachine {418 /** True if the user isn't currently performing an interaction. */419 /** The intent behind the current drag operation. None if the user isn't dragging. */420 dragging: DraggingMode;421 /** The interaction mode for keyboard input. */422 interactionMode: GraphInteractionMode;423 /** CSS classes to put on the DOM as a result of the user's interaction. */424 /** True if we're currently panning with inertia */425 private _inertiaPanning;426 inertiaPanning: boolean;427 private _inertiaVelocityX;428 private _inertiaVelocityY;429 private _lastInertiaTime;430 private _widget;431 private stage;432 private _lastMouseCoords;433 private _lastDomainCoords;434 private _lastTouchCoords;435 private _lastTouchDomainCoords;436 private _lastTouches;437 private _lastSelectTime;438 private _touchHeld;439 private _leftMousePanning;440 private _centerMousePanning;441 private _spacebarHeld;442 private _mouseDownDomainCoords;443 private _mouseDownEvent;444 private _mouseDownEntity;445 private _gestureScale;446 private _gestureDomainCoords;447 private _gesturing;448 private _pendingClearSelection;449 private _focusIndex;450 /** The start point for the multi-selection rectangle */451 multiSelectStartPoint: IPoint;452 /** The current end point for the multi-selection rectangle */453 multiSelectCurrentPoint: IPoint;454 private _multiSelecting;455 /** Used by shift+tab to correctly go back to previous element */456 private activeGraphElementStack;457 /** The buffer to which to compare two points against or to measure proximity */458 private readonly epsilon;459 /**460 * Creates a state machine for handling user interation.461 *462 * @param widget The parent widget that will use this state machine.463 */464 constructor(widget: GraphWidget);465 atRest(): boolean;466 isPanning(): boolean;467 /**468 * Responds to a user action.469 *470 * @param action The user's action.471 * @param e If the action is a mouse or keyboard action, the associated event.472 * @param relevantEntity If acting upon something in the graph widget, what they're acting on.473 */474 handleAction(action: InteractionAction, e?: Event, relevantEntity?: GraphEntity, customAction?: string): void;475 bumpSelection(direction: Direction): void;476 /**477 * Finds nearest Entity based on supplied direction. To keep things simple, we use node478 * centers, not sides.479 *480 * Returns null if there is no node in the specified direction.481 *482 * @param focusedNode483 * @param direction484 */485 private _findClosestEntity(focusedEntity, direction);486 private findFirstVisiableEdge(entities);487 focusOnGraphEntity(graphEntity: GraphEntity): Q.Promise<any>;488 /**489 * Brings a graph node into view and selects it.490 *491 * @param graphNodeViewModel the view model for the graph node to focus on492 */493 focusOnGraphNode(graphNode: GraphNode): Q.Promise<any>;494 /**495 * Brings a graph edge into view and selects it.496 *497 * @param graphNodeViewModel the view model for the graph edge to focus on498 */499 focusOnGraphEdge(graphEdge: GraphEdge): Q.Promise<any>;500 /**501 * Starts inertia at specified velocities.502 *503 * @param inertiaVelocityX Signed velocity in the x direction.504 * @param inertiaVelocityY Signed velocity in the y direction.505 */506 startInertia(inertiaVelocityX: number, inertiaVelocityY: number): void;507 /**508 * Dispose of the state machine.509 */510 dispose(): void;511 private getNextTopLeftMostNode(activeBox?);512 private getNextTopLeftMostEdge(activeBox?);513 private getNextTopLeftMostGroupMember(activeBox?, proximity?);514 private getNextTopLeftMostProcessNode(activeBox?, proximity?);515 private getNextTopLeftMostProcessGroupNodeLink(activeBox?, proximity?);516 private getNextTopLeftMostContextMenu(activeBox?, proximity?);517 private getNextTopLeftMostPrevOrNext(activeBox?, sameColumn?);518 /**519 * Finds the "next" top-leftmost element. If `activeBox` is provided, the next element is found in relation to520 * that by first evaluating y-axis from top-to-bottom then x-axis from left-to-right. If `proximity` is provided,521 * it is found in relation to proximity of `activeBox` by ensuring it is within epsilon distance of it.522 *523 * @param elementType get list of these element types to look to jump to524 * @param activeBox ClientRect of active element525 * @param proximity look within proximity of activeBox, for example to go to next item within a list but they share no relevant parent526 * @param sameColumn don't go left, stay in the same x-axis area527 */528 private getNextTopLeftMostElement(params);529 private findClosestIndex(activeTop, activeLeft, elements, proximityBox?);530 private previouslySeen(left, top);531 private nextColumn(activeLeft, nodeContainers);532 private focusTopLeftMostNode();533 private focusTopLeftMostEdge();534 private focusNextNodeOrEdge();535 private focusNextEdge();536 /**537 * Evaluates if point is within epsilon distance from origin538 *539 * @param point typically some variable we want to evaluate540 * @param origin typically a fixed point to which we compare against541 */542 private within(point, origin, customEpsilon?);543 /**544 * Evaluates if the point is within proximity of `proximityBox` by taking545 * in the height of the `ClientRect` (i.e. bottom)546 *547 * @param point x-y pair548 * @param proximityBox549 */550 private withinProximity(point, proximityBox);551 /** Helper methods for tab navigation */552 private isDependencyMapActiveElement();553 private isNodeActiveElement();554 private focusOnNodesOwnExpand();555 private isActiveElementVirtualGroupNodeCircle();556 private isActiveElementVirtualGroupNodeContextMenu();557 private isActiveElementWithinVirtualGroupNode();558 private isActiveElementWithinGroupMemberNode();559 private isActiveElementGroupMemberBar();560 private isActiveElementWithinClientOrServerGroup();561 private isActiveElementWithinMachineNode();562 private isActiveElementMachineNode();563 private isActiveElementClientOrServerGroup();564 private isActiveElementCircle();565 private isActiveElementEdge();566 private isActiveElementExpand();567 private isActiveElementContextMenu();568 private isActiveElementWithinProcessNode();569 private isActiveElementClassLink();570 private isActiveElementContextMenuOption();571 private isActiveElementPrevOrNext();572 private focusOnContextMenuExpand();573 private focusNextGroupMemberNode(noProximity?);574 private focusActiveGroupMembersOwnMenu();575 private focusOnMachineNodesOwnContextMenu();576 private focusNextProcessNode(proximity?);577 private focusNextProcessGroupNodeLink(proximity?);578 private focusNextContextMenu(proximity?);579 private focusOnPrevOrNext();580 }581}582declare module HyperGraph {583 enum KeyCode {584 Alt = 18,585 Backslash = 220,586 Backspace = 8,587 Comma = 188,588 Control = 17,589 Delete = 46,590 Down = 40,591 End = 35,592 Enter = 13,593 Equals,594 Escape = 27,595 F10 = 121,596 Home = 36,597 Left = 37,598 Menu = 93,599 Minus,600 PageDown = 34,601 PageUp = 33,602 Period = 190,603 Right = 39,604 Shift = 16,605 Slash = 191,606 Space = 32,607 Tab = 9,608 Up = 38,609 A = 65,610 B = 66,611 C = 67,612 D = 68,613 E = 69,614 F = 70,615 G = 71,616 H = 72,617 I = 73,618 J = 74,619 K = 75,620 L = 76,621 M = 77,622 N = 78,623 O = 79,624 P = 80,625 Q = 81,626 R = 82,627 S = 83,628 T = 84,629 U = 85,630 V = 86,631 W = 87,632 X = 88,633 Y = 89,634 Z = 90,635 Num0 = 48,636 Num1 = 49,637 Num2 = 50,638 Num3 = 51,639 Num4 = 52,640 Num5 = 53,641 Num6 = 54,642 Num7 = 55,643 Num8 = 56,644 Num9 = 57,645 NumMinus = 109,646 NumPlus = 107,647 }648}649declare module HyperGraph {650 const enum MouseButton {651 Left = 1,652 Middle = 2,653 Right = 3,654 }655 /**656 * A wrapper for registering and unregistering events.657 */658 class EventListenerSubscription {659 private _handler;660 private _useCapture;661 private _eventType;662 private _element;663 /**664 * Constructs a wrapper for event listeners that can remove them on dispose.665 *666 * @param element The element on which to attach the listener.667 * @param eventType The type of event to register (e.g. mousedown, focus, etc.).668 * @param handler The callback to fire when the event occurs.669 * @param useCapture False uses bubble semantics. True uses capture semantics.670 */671 constructor(element: EventTarget, eventType: string, handler: (e: Event) => void, useCapture?: boolean);672 /**673 * Remove the registered event listeners.674 */675 dispose(): void;676 }677 /**678 * A class for handling and tracking drags. Works if the user drags anywhere on the screen, even outside the browser window.679 * Works with multiple mouse buttons and retains the drag until all buttons are released.680 */681 class MouseCapture {682 private _buttonsDown;683 private _mouseMoveHandler;684 private _mouseUpHandler;685 private _beginCapture;686 private _endCapture;687 private _mouseDownOrigin;688 private _mouseUpSubscription;689 private _mouseMoveSubscription;690 private _endCaptureSubscription;691 private _countMouseDownsSubscription;692 private _beginCaptureSubscription;693 /**694 * Create a mouse capture class that tracks mouse drags.695 *696 * @param mouseDownOrigin The element on which a mouse down begins tracking a drag.697 * @param mouseMoveHandler What to do when the user drags the mouse with a button down.698 * @param mouseUpHandler What to do when the user releases a mouse button in the drag.699 */700 constructor(mouseDownOrigin: Element, mouseMoveHandler: (e: MouseEvent) => void, mouseUpHandler: (e: MouseEvent) => void);701 /**702 * Disposes of the mouse capture class.703 */704 dispose(): void;705 }706}707/// <reference types="jquery" />708declare module HyperGraph {709 var EventTypes: {710 animationstart: string;711 resize: string;712 scroll: string;713 };714 class Resize {715 static getDetectionFragment(containerClass: string): string;716 static getChildren(element: JQuery, className: string): JQuery;717 /**718 * Hooks up cross browser resize detection event (ie, webkit, moz, edge).719 *720 * @param lifetime The lifetime of the resize tracking.721 * @param element The element to monitor size changes.722 * @param handler The resize event handler.723 */724 static track(lifetime: LifetimeManager, element: JQuery, handler: (width?: number, height?: number) => void): void;725 }726}727declare module HyperGraph {728}729declare module HyperGraph.Layout {730 /**731 * A layer means one column in Heirarchical layout732 * Layer maintains all root nodes in one column. It does not maintain child nodes.733 */734 class Layer {735 outgoingConnectionCount: number;736 layerX: number;737 layerY: number;738 layerWidth: number;739 layerHeight: number;740 private nodes;741 private nodeToNodeDistance;742 private nodeWithMaxWidth;743 private uniqueMap;744 constructor(nodes?: SHLayoutNode[]);745 AddNode(node: SHLayoutNode, outgoingConnectionCount: number): void;746 GetNodes(): SHLayoutNode[];747 readonly NodeCount: number;748 ComputeLayerSize(): void;749 /**750 * Compute y coordinate of this layer based on canvasHeight and node count in this layer.751 * ComputeLayerSize should be called before this method752 * @param {number} layerX753 * @param {number} canvasHeight754 * @returns {void}755 * @memberof Layer756 */757 ComputeLayerCoordinates(layerX: number, canvasHeight: number): void;758 ComputeNodesLayout(): void;759 }760}761declare module HyperGraph.Layout {762 class OrderedStringMap<T> {763 private list;764 private uniqueMap;765 constructor();766 add(id: string, item: T): void;767 get(id: string): T;768 values(startIndex?: number, endIndex?: number): T[];769 delete(id: string): void;770 readonly length: number;771 }772 class SHLayoutGraph {773 private adjacencyList;774 private reverseAdjacencyList;775 private allNodes;776 private levelZeroNodes;777 private edges;778 private nodeIdToNodeMap;779 private edgeIdToEdgeMap;780 constructor();781 ClearGraph(): void;782 readonly AllNodes: SHLayoutNode[];783 readonly AllEdges: LayoutEdge[];784 AddNode(node: SHLayoutNode): void;785 GetNode(id: string): SHLayoutNode;786 GetAllRootNodes(): SHLayoutNode[];787 /**788 * This method removes node which is not added as part of current layout algorithm789 * Update parent of the node as well if there is any.790 * @param nodeId791 */792 RemoveNode(id: string): void;793 AddEdge(edge: LayoutEdge): void;794 GetEdge(id: string): LayoutEdge;795 GetNeighbors(id: string): SHLayoutNode[];796 RemoveEdge(id: string): void;797 private getIndex(list, id);798 }799}800declare module HyperGraph.Layout {801 interface ISHLayoutNode extends HyperGraph.Layout.LayoutNode {802 edgePortCoordinates: NumberMap<Coordinate>;803 childNodes: ISHLayoutNode[];804 }805 /**806 * Represents node is layout graph. A node can be a machine/processGroup/process/clientGroup/clientGroupMember/serverGroup/serverGroupMember807 * @export808 * @class SHLayoutNode809 * @implements {ISHLayoutNode}810 */811 class SHLayoutNode implements ISHLayoutNode {812 id: string;813 /**814 * Immediate ancestor of the node.815 * ParentId of a root node is null.816 * For example, parentId of a process can be a processGroup or machine node.817 * ParentId of a machine node is null.818 * @type {string}819 * @memberof SHLayoutNode820 */821 parentId: string;822 /**823 * Top most ancestor of the node.824 * For example, rootId of a process can be machineNode even if it is descendant of a processGroup.825 * This field is used to access rootNode of any childNode in constant time.826 * @type {string}827 * @memberof SHLayoutNode828 */829 rootId: string;830 x: number;831 y: number;832 width: number;833 height: number;834 /** @deprecated */835 isExpanded: boolean;836 /** @deprecated */837 isVisible: boolean;838 numChildren?: number;839 nodeStyle: INodeStyle;840 /**841 * This flag is used to decide if the node is added in current incremental layout or not.842 * After layout is completed, we set this flag of all nodes to false.843 * @type {boolean}844 * @memberof SHLayoutNode845 */846 isAddedSinceLastLayout?: boolean;847 edgePortCoordinates: NumberMap<Coordinate>;848 childNodes: SHLayoutNode[];849 private portCandidateYOffset;850 private childNodesMap;851 private incomingConnections;852 private outgoingConnections;853 constructor(node: HyperGraph.Layout.LayoutNode);854 readonly IncomingConnectionCount: number;855 readonly OutgoingConnectionCount: number;856 AddIncomingConnection(edge: LayoutEdge): void;857 RemoveIncomingConnection(edge: LayoutEdge): void;858 AddOutgoingConnections(edge: LayoutEdge): void;859 RemoveOutgoingConnection(edge: LayoutEdge): void;860 CalculateEdgePortCoordinates(): void;861 CalculateChildNodesCoordinates(): void;862 AddChildNode(childNode: SHLayoutNode): void;863 RemoveChildNode(childNode: SHLayoutNode): void;864 CalculateSize(): void;865 /**866 * Reset the size of the node with new node style.867 * @param {INodeStyle} nodeStyle868 * @memberof SHLayoutNode869 */870 ResetSize(nodeStyle: INodeStyle): void;871 }872}873declare module HyperGraph.Layout {874 interface SelfEdgeChannel {875 minY: number;876 maxY: number;877 edges: LayoutEdge[];878 merged: boolean;879 }880 interface MergedSelfEdgeChannel {881 range: number[];882 edges: LayoutEdge[];883 }884 class SelfEdgeLayoutManager {885 private readonly minDistanceFromNodes;886 private readonly distanceBetweenChannels;887 ComputeSelfLinksLayout(graph: SHLayoutGraph, selfEdges: LayoutEdge[]): void;888 private mergeSelfEdgeChannels(mergeBase, channel);889 }890}891/**892 * This layout algorithm works for single machine and group as single node.893 * FOr expanded group nodes, this algorithm will not work as it is.894 */895declare module HyperGraph.Layout {896 interface StringMap<T> {897 [key: string]: T;898 }899 interface NumberMap<T> {900 [key: number]: T;901 }902 interface Coordinate {903 x: number;904 y: number;905 }906 interface ITelemetryProvider {907 info: (message: string, source: string, action: string, props?: any) => void;908 error: (error: object | string, source: string, action: string, props?: any) => void;909 }910 class SimpleHierarchicalLayouter implements ILayoutManager {911 private graph;912 private layers;913 private selfEdgesLayoutManager;914 private edgeSegmentLength;915 private minimumLayerDistance;916 private nodeToNodeDistance;917 private singleSegmentEdgeErrorOffset;918 private canvasHeight;919 private canvasWidth;920 private telemetryProvider;921 constructor(telemetryProvider: ITelemetryProvider);922 clearGraph(): void;923 isLayoutTypeSupported(layoutUpdatePattern: LayoutUpdatePattern): boolean;924 addNode(id: string, parentId: string, rootId: string, expanded: boolean, nodeStyle: INodeStyle): LayoutNode;925 addEdge(source: string, destination: string): LayoutEdge;926 doLayout(layoutUpdatePattern?: LayoutUpdatePattern): LayoutGraph;927 /**928 * This method computes nodes layouts in each layer929 * @param layers930 * @param layerWithMaximumNodeCount931 */932 private computeNodesLayout();933 private computeEdgesLayout();934 private filterGraphForIncrementalDiff();935 /**936 * This method marks all nodes and edge's isAddedSinceLastLayout as false.937 * That means all these nodes will become stale once the layout is computed.938 */939 private markAllGraphElementsStaleForNextLayout();940 private isSelfEdge(edge);941 }942}943declare module HyperGraph {944 /** It works better to just highlight edges for selected nodes (no BFS traversal). */945 class AdjacencyEmphasis {946 private graphModel;947 private _forwardAdjacencyList;948 private _reverseAdjacencyList;949 constructor(graphModel: GraphModel);950 /** Create forward and backward adjacency list for the directed graph */951 createAdjacencyList(): void;952 /** Modify opacity of graph entities to display lineage of selected nodes. */953 updateAdjacencyEmphasis(selectedNodes: GraphNode[], targetElementId?: string): void;954 /**955 * Add adjacent nodes and edges to undimmed lists956 *957 * @param undimmedNodes Set of nodes that should not be dimmed958 * @param undimmedEdges Set of edges that should not be dimmed959 * @param adjacencyList Directed graph as adjacency list960 * @param selectedNodes List of nodes that have been selected961 */962 private _identifyEntitiesToEmphasize(emphasizedNodes, emphasizedEdges, adjacencyList, selectedNodes);963 clear(): void;964 /** Set adjacencyDimmed state for all nodes to be false */965 private _emphasizeAllEntities();966 }967}968declare module HyperGraph {969 enum EdgeDoubling {970 Single = 1,971 Double = 2,972 }973 enum EdgePattern {974 Solid = 1,975 Dotted = 2,976 Dashed = 3,977 }978 interface EdgeSegment extends IPoint {979 dx?: number;980 dy?: number;981 }982 function makeEdgeId(source: string, dest: string): string;983 class GraphEdge extends AbstractGraphEntity {984 sourceId: string;985 destId: string;986 sourceNode: GraphNode;987 destNode: GraphNode;988 constructor(sourceId: string, destId: string, sourceNode?: GraphNode, destNode?: GraphNode, props?: PropertyMap);989 protected setDefaultValues(): void;990 /** source and dest port ids*/991 sourcePortLocation: PortLocation;992 destPortLocation: PortLocation;993 /** Edge routing line segments, set by graphModel - set these to populate path */994 segments: EdgeSegment[];995 rawLayoutSegments: number[][];996 startPoint: IPoint;997 endPoint: IPoint;998 selfLink: boolean;999 /**1000 If this value is set then the link will be visible in the graph only if source is visible1001 and source node is selected.1002 */1003 clientGroupMemberLink: boolean;1004 /**1005 If this value is set then the link will be visible in the graph only if destination is visible1006 and destination node is selected.1007 */1008 serverGroupMemberLink: boolean;1009 /** overrides "hide self links" flag (e.g. for failed connection) */1010 forceVisible: boolean;1011 getBounds(): IRect;1012 getLeftNode(): GraphNode;1013 getRightNode(): GraphNode;1014 getNextTopSibling(): GraphEdge;1015 getNextDownSibling(): GraphEdge;1016 private getSiblings();1017 private getLeftToRightSegment(edge);1018 private getRightY(segments);1019 }1020 class AggregateEdge extends GraphEdge {1021 count: number;1022 constructor(source: string, dest: string, props?: PropertyMap);1023 protected setDefaultValues(): void;1024 edgeSet: Dictionary<GraphEdge>;1025 addEdge(edge: GraphEdge): void;1026 removeEdge(edge: GraphEdge): void;1027 }1028 class EdgeSegmentImpl implements EdgeSegment {1029 constructor(x: number, y: number);1030 x: number;1031 y: number;1032 dx: number;1033 dy: number;1034 }1035}1036declare module HyperGraph {1037 /**1038 * CRUD state/lifecyle bit flags for model entities.1039 * We want to be able to maintain Created and Updated states separately.1040 */1041 enum CrudState {1042 Unchanged = 0,1043 Created = 1,1044 Updated = 2,1045 Deleted = 4,1046 }1047 /** Base entity with property bag support. */1048 interface PropertyEntity {1049 id: string;1050 isCreated: boolean;1051 isUpdated: boolean;1052 isDeleted: boolean;1053 properties: PropertyMap;1054 crud: CrudState;1055 changeKeys: Dictionary<string>;1056 /** User-defined visibility. Overrides all internal visibility flags.1057 Note that an edge will hide automatically if its source node or dest node is not visible. */1058 visible: boolean;1059 }1060 abstract class AbstractEntity implements PropertyEntity {1061 id: string;1062 private _properties;1063 changeKeys: Dictionary<string>;1064 constructor(id: string, properties?: PropertyMap);1065 /** Calling reset on deleted object will reset to initial state - brings it back to life. */1066 reset(properties?: PropertyMap): void;1067 protected setDefaultValues(): void;1068 dispose(): void;1069 /** Nodes and edges are parents for their properties. When a property is added1070 (or removed), the parent entity state is 'updated'. */1071 readonly updated: boolean;1072 readonly properties: PropertyMap;1073 crud: CrudState;1074 readonly isCreated: boolean;1075 readonly isUpdated: boolean;1076 readonly isDeleted: boolean;1077 visible: boolean;1078 wasPropertyChanged(key: string): boolean;1079 addChangeKey(key: string): void;1080 addChangeKeys(props: PropertyMap): void;1081 updateChangeFlags(crud: CrudState, diff?: PropertyMap): void;1082 hasProperty(key: string): boolean;1083 getProperty(key: string): any;1084 setProperty(key: string, value: any): void;1085 updateProperties(properties: PropertyMap): PropertyMap;1086 }1087 interface Selectable {1088 selected: boolean;1089 selectable: boolean;1090 focused: boolean;1091 }1092 interface GraphEntity extends Selectable, PropertyEntity {1093 linkedEntities: GraphEntity[];1094 domId: string;1095 data: any;1096 /** Used internally by graph model to control visibility, e.g. process nodes are not in layout when machine is collapsed. */1097 inLayout: boolean;1098 /** true: entity has been assigned layout coordinates by layout manager */1099 hasLayoutPosition: boolean;1100 /** shorthand for (visible && inLayout && hasLayoutPosition) */1101 layoutVisible: boolean;1102 /** true when AdjacencyEmphasis has dimmed an edge */1103 adjacencyDimmed: boolean;1104 }1105 abstract class AbstractGraphEntity extends AbstractEntity implements GraphEntity {1106 linkedEntities: GraphEntity[];1107 domId: string;1108 ariaLabel: string;1109 constructor(id: string, properties?: PropertyMap);1110 protected setDefaultValues(): void;1111 dispose(): void;1112 data: any;1113 /** true: calculate layout for this entity */1114 inLayout: boolean;1115 /** true: valid layout position has been set for this entity */1116 hasLayoutPosition: boolean;1117 /** is set true by model when (visible && inLayout && hasLayoutPosition) */1118 layoutVisible: boolean;1119 /** Set according to lineage display logic. If true, the entity should have a low opacity. */1120 adjacencyDimmed: boolean;1121 selected: boolean;1122 selectable: boolean;1123 focused: boolean;1124 getId(): string;1125 /** Entity bounding rect */1126 getBounds(): IRect;1127 /**1128 * Returns whether or not this entity completely resides in rect. Overloaded in child classes.1129 * @param rect The enclosing rect to test.1130 * @return true if this entity lies in the enclosing rect. False if not.1131 */1132 liesInRect(rect: IRect): boolean;1133 }1134}1135declare module HyperGraph {1136 enum ProgressState {1137 Complete = 0,1138 Reconcile = 1,1139 Layout = 2,1140 Render = 3,1141 }1142 /** Strategies defining how edges connect to nodes and how they follow the nodes' moves. */1143 enum EdgeConnectionStrategy {1144 /** Edge line is a ray originating at the center of the start node and going to the center of the end node. */1145 NodeCenter = 0,1146 /** Edge path is a Bezier curve originating at the output port of the start node and going to the input port of the end node. */1147 NodePort = 1,1148 }1149 enum NodeType {1150 Machine = 0,1151 ProcessGroup = 10,1152 ClientGroupV3 = 13,1153 ServerGroupV3 = 14,1154 VirtualGroupNode = 20,1155 }1156 /**1157 * Used to provide implementation for a node orderer1158 * E.g. provide an ordering of list nodes in a group node1159 */1160 interface NodeOrderer {1161 setGraphModel(model: GraphModel): any;1162 getSuggestedOrder(): {1163 [id: string]: string[];1164 };1165 }1166 interface IGraphModel<T, U> {1167 addNode(id: string, properties?: Object): GraphNode;1168 addEdge(sourceId: string, destinationId: string, sourceNode: GraphNode, destNode: GraphNode, props: PropertyMap): GraphEdge;1169 getNode(id: string): T;1170 getNodes(): T[];1171 getChildNodes(node: T): T[];1172 getEdge(id: string): U;1173 getEdge(source: string, destination: string): U;1174 getEdges(): U[];1175 getSourceNode(edge: U): T;1176 getDestinationNode(edge: U): T;1177 removeNode(id: string): any;1178 removeEdge(id: string): any;1179 clear(forceClear: boolean): any;1180 /**1181 * Notifies all observers that the model has changed.1182 * Renders the graph.1183 */1184 notify(): void;1185 dispose(): any;1186 createNodeHierarchy(): void;1187 updateNodeProperties(id: string, properties: Object): boolean;1188 currentExpansionLevel: number;1189 }1190 interface GraphModel extends IGraphModel<GraphNode, GraphEdge> {1191 getEntities(): GraphEntity[];1192 getRemovedNodes(): GraphNode[];1193 getRemovedEdges(): GraphEdge[];1194 selection: SelectionManager;1195 toggleSelfLinks(nodeId: string): any;1196 entitiesAddedOrRemoved(): boolean;1197 addModelTransformFunction(transformFunction: GraphModelTransformFunction): void;1198 addModelChangeHandler(query: any, handler: GraphModelChangeHandler): void;1199 addProgressHandler(callback: (progressInfo: GraphModelProgressInfo) => void): void;1200 getNodeByDomId(id: string, includeRemoved?: boolean): GraphNode;1201 getEdgeByDomId(id: string, includeRemoved?: boolean): GraphEdge;1202 getFocusedEntity(includeRemoved?: boolean): AbstractGraphEntity;1203 }1204 interface GraphModelTransformFunction {1205 (model: GraphModel): void;1206 }1207 interface GraphModelChangeHandler {1208 (model: GraphModel): void;1209 }1210 interface GraphModelProgressInfo {1211 incremental: boolean;1212 progressState: ProgressState;1213 }1214 interface GraphModelProgressCallback {1215 (progressInfo: GraphModelProgressInfo): void;1216 }1217 /**1218 * Graph view model.1219 *1220 * To update the model:1221 * 1. optionally clear the model before updating it1222 * 2. update the model by adding/removing nodes & edges, and by updating their properties. You can also change selection!1223 * 3. call notify()1224 *1225 * Conceptually, notify produces a change event containing a subtree of changed entities and values.1226 *1227 * For a cleared model, the event is everything in the model, so it isn't required.1228 * For an existing model, the event communicates everything that has changed.1229 *1230 * Events can be aggregated into a separate change model.1231 *1232 * The current implementation uses sets of change keys on nodes and edges instead of a separate event tree.1233 */1234 class DefaultGraphModel implements GraphModel {1235 /** The graph model is the root of the model tree. Its only CRUD state is 'updated'. */1236 updated: boolean;1237 private _nodes;1238 private childNodeMap;1239 private childNodeMapIsStale;1240 private _edges;1241 selection: SelectionManager;1242 adjacencyEmphasis: AdjacencyEmphasis;1243 /** If true, reduce opacity of all graph entities except the ones selected and the ones in its upstream and downstream */1244 enableAdjacencyEmphasis: boolean;1245 private layoutService;1246 nodeOrderer: NodeOrderer;1247 /** The strategy defining how edges connect to nodes and how they follow the nodes' moves. Default is EdgeConnectionStrategy.NodeCenter. */1248 edgeConnectionStrategy: EdgeConnectionStrategy;1249 currentExpansionLevel: number;1250 private _wasCleared;1251 private transformFunctions;1252 private changeHandlers;1253 private progressHandlers;1254 constructor();1255 dispose(): void;1256 addNode(id: string, properties?: Object): GraphNode;1257 updateNodeProperties(id: string, properties: Object): boolean;1258 createNodeHierarchy(): void;1259 getNode(id: string, includeRemoved?: boolean): GraphNode;1260 getNodeByDomId(domId: string, includeRemoved?: boolean): GraphNode;1261 getEdgeByDomId(domId: string, includeRemoved?: boolean): GraphEdge;1262 getFocusedEntity(includeRemoved?: boolean): AbstractGraphEntity;1263 getNodes(): GraphNode[];1264 getRemovedNodes(): GraphNode[];1265 getChildNodes(parentNode: GraphNode): GraphNode[];1266 removeNode(id: string): void;1267 getEntities(): GraphEntity[];1268 /**1269 * Return true if create or update was successful, false if something went wrong.1270 * @param id1271 * @param props1272 */1273 addEdge(sourceId: string, destinationId: string, sourceNode: GraphNode, destNode: GraphNode, props: PropertyMap): GraphEdge;1274 /**1275 * Used internally to implement edges for collapsed nodes.1276 */1277 protected _addAggregateEdge(source: string, dest: string, edge: GraphEdge): GraphEdge;1278 getEdge(id: string): GraphEdge;1279 getEdge(source: string, destination: string): GraphEdge;1280 getEdges(): GraphEdge[];1281 getRemovedEdges(): GraphEdge[];1282 removeEdge(id: string): void;1283 /**1284 * Returns true if node(s) or edge(s) were added or removed from the model1285 */1286 entitiesAddedOrRemoved(): boolean;1287 nodesAddedOrRemoved(): boolean;1288 edgesAddedOrRemoved(): boolean;1289 /**1290 * Clear the model.1291 * @param forceClear false: mark enties as removed and use diffing, true: remove entities1292 */1293 clear(forceClear?: boolean): void;1294 getSourceNode(edge: GraphEdge): GraphNode;1295 getDestinationNode(edge: GraphEdge): GraphNode;1296 toggleSelfLinks(nodeId: string): void;1297 isSelfLink(edge: GraphEdge): boolean;1298 getInboundEdges(node: GraphNode): GraphEdge[];1299 addModelTransformFunction(callback: GraphModelTransformFunction): void;1300 addModelChangeHandler(query: any, callback: GraphModelChangeHandler): void;1301 addProgressHandler(callback: (progressInfo: GraphModelProgressInfo) => void): void;1302 /**1303 * Call notify when finished changing the model to notify views.1304 */1305 notify(): void;1306 private notifyProgress(progressState);1307 private updateDerivedProperties();1308 private reconcileState();1309 isLayoutNeeded(): boolean;1310 protected updateAggregateEdges(): void;1311 private getAbstractGraphEntityByDomId(domId, entities, includeRemoved?);1312 private isNodeInLayout(node);1313 private clearEventState();1314 setLayoutService(layoutService: Layout.ILayoutManager): void;1315 setNodeOrderer(nodeOrderer: NodeOrderer): void;1316 doLayout(layoutMode: Layout.LayoutUpdatePattern): Layout.LayoutGraph;1317 computeLayout(layoutMode: Layout.LayoutUpdatePattern): Layout.LayoutGraph;1318 applyLayout(layout: Layout.LayoutGraph): void;1319 private segmentsChanged(oldSegments, newSegments);1320 private connectEdgeToSourcePort(viewEdge, layoutSourceEdgePort);1321 private connectEdgeToDestPort(viewEdge, layoutDestEdgePort);1322 private getSourcePortLocationFromLayout(layoutPort);1323 private getDestPortLocationFromLayout(layoutPort);1324 private clearPortConnected(node);1325 private updatePortLocations(node);1326 /**1327 * Adds curved segment to edges. Looks better than hard corners and makes individual edge routing clearer.1328 */1329 calcSegments(layoutEdgeSegments: number[][]): EdgeSegment[];1330 }1331}1332declare module HyperGraph {1333 interface TreeNode {1334 /**1335 * Parent node id. All nodes can contain child nodes and can support expansion.1336 * Its size is determined by bounding rect of its child nodes + padding + border + margins.1337 */1338 parentId: string;1339 expanded: boolean;1340 level: number;1341 }1342 class GraphNode extends AbstractGraphEntity implements TreeNode {1343 /** A node can have up to 12 ports, 3 on each side. Similar to Visio connection point conventions. */1344 ports: Dictionary<GraphNodePort>;1345 private _childNodes;1346 constructor(id: string, properties?: PropertyMap);1347 protected setDefaultValues(): void;1348 dispose(): void;1349 protected createPorts(): void;1350 /** primary label displayed on the node */1351 displayName: string;1352 /** The absolute X,Y coordinates of the node on the stage (formerly "committedX") */1353 x: number;1354 y: number;1355 width: number;1356 height: number;1357 parentId: string;1358 rootId: string;1359 level: number;1360 expanded: boolean;1361 alwaysExpanded: boolean;1362 selfLinksVisible: boolean;1363 unconnectedNodesVisible: boolean;1364 numberOfInboundConnections: number;1365 numberOfOutboundConnections: number;1366 numberOfInboundSelfConnections: number;1367 numberOfOutboundSelfConnections: number;1368 segregateConnectedNodes: boolean;1369 precomputeNodeWidth: boolean;1370 filterChanged: boolean;1371 semanticZoomChange: boolean;1372 isHovered: boolean;1373 /** Entity bounding rect */1374 getBounds(): IRect;1375 addChildNode(node: GraphNode): void;1376 removeChildNode(node: GraphNode): void;1377 getChildNodes(): Array<GraphNode>;1378 getLeftEdge(): GraphEdge;1379 getRightEdge(): GraphEdge;1380 getLeftEdges(): GraphEdge[];1381 getRightEdges(): GraphEdge[];1382 }1383}1384declare module HyperGraph {1385 interface GraphWidgetPort {1386 Width: number;1387 Height: number;1388 }1389 const enum PortLocation {1390 Center = 0,1391 Top1 = 1,1392 Top2 = 2,1393 Top3 = 3,1394 Right1 = 4,1395 Right2 = 5,1396 Right3 = 6,1397 Bottom1 = 7,1398 Bottom2 = 8,1399 Bottom3 = 9,1400 Left1 = 10,1401 Left2 = 11,1402 Left3 = 12,1403 }1404 const enum PortConnectedDirection {1405 None = 0,1406 Inbound = 1,1407 Outbound = 2,1408 Both = 3,1409 }1410 /**1411 * Defines edge connection points/anchors/ports.1412 */1413 class GraphNodePort extends AbstractEntity {1414 location: PortLocation;1415 /**1416 * Creates a graph node port view model.1417 * @param graphPort The port this view model wraps around.1418 */1419 constructor(id: string, location: PortLocation);1420 setDefaultValues(): void;1421 /** The X,Y coordinates of the port relative to the node (formerly "hostRelativeX/Y") */1422 x: number;1423 y: number;1424 /** true: has at least one edge connected */1425 connected: PortConnectedDirection;1426 dispose(): void;1427 }1428}1429declare module HyperGraph {1430 class SelectedEntities {1431 selectedNodeIds: string[];1432 selectedEdgeIds: string[];1433 constructor(selectedNodeIds?: string[], selectedEdgeIds?: string[]);1434 }1435 /**1436 * This class maps the entity selection property to selection set membership.1437 * It uses the GraphModel interface because selection follows tree model conventions.1438 */1439 class SelectionManager implements IGraphModel<GraphNode, GraphEdge> {1440 graphModel: GraphModel;1441 focusedEntityId: string;1442 focusedEntity: AbstractGraphEntity;1443 currentExpansionLevel: number;1444 constructor(graphModel: DefaultGraphModel);1445 dispose(): void;1446 /**1447 * Toggles an entity's selection state.1448 *1449 * @param entityViewModel the entity to toggle selection state1450 */1451 toggleEntitySelection(selectableEntity: GraphEntity): void;1452 /**1453 * Selects an entity, clearing previous selection.1454 */1455 selectEntity(selectableEntity: GraphEntity, clearSelection?: boolean): void;1456 /**1457 * Deselects the given entity.1458 *1459 * @param entityViewModel The entity to deselect.1460 */1461 deselectEntity(selectableEntity: GraphEntity): void;1462 /**1463 * Returns true if node was added to the selection (i.e. selection has changed)1464 * @param nodeId1465 */1466 addNode(nodeId: string): GraphNode;1467 _addNode(node: GraphNode): GraphNode;1468 addEdge(edgeId: string): GraphEdge;1469 _addEdge(edge: GraphEdge): GraphEdge;1470 getNode(id: string): GraphNode;1471 getFocusedEntity(): AbstractGraphEntity;1472 getChildNodes(parentNode: GraphNode): GraphNode[];1473 createNodeHierarchy(): void;1474 getEdge(id: string): GraphEdge;1475 updateNodeProperties(id: string, properties: Object): boolean;1476 getSourceNode(edge: GraphEdge): GraphNode;1477 getDestinationNode(edge: GraphEdge): GraphNode;1478 removeNode(nodeId: string): boolean;1479 removeEdge(edgeId: string): boolean;1480 /**1481 * Selects all graph nodes and edges.1482 */1483 selectAllEntities(): void;1484 /**1485 * Removes all items from the selection.1486 */1487 clear(): void;1488 getNodes(): GraphNode[];1489 getNodeIds(): string[];1490 getEdges(): GraphEdge[];1491 getEdgeIds(): string[];1492 getSelectedEntityCount(): number;1493 getNodeCount(): number;1494 getEdgeCount(): number;1495 /**1496 * Return true if entity added or removed from the selection set.1497 * (The underlying implementation checks the selected property on entities, but1498 * entity attribute and containment map to each other.)1499 */1500 entitiesAddedOrRemoved(): boolean;1501 notify(): void;1502 }1503}1504declare module HyperGraph {1505 /** The function used to get the current time. Tests can inject their own method and control time in a more rigorous manner. */1506 var getCurrentTime: () => number;1507 /** The function used to call a function after a certain amount of time. Tests can inject their own method to control time. */1508 var setTimeoutFromCurrentTime: (handler: any, timeout?: number) => number;1509 /** A dictionary of all the animating properties. The key is the property being animated and the value is the current tween. */1510 interface IAnimationState {1511 [key: string]: number;1512 }1513 /**1514 * A dictionary of properties to animate. Each property is defined by numeric start and end values.1515 * Note: end should be either <number> or <KnockourObservable<Number>>.1516 */1517 interface IAnimationDescriptor {1518 [key: string]: {1519 start: number;1520 end: any;1521 };1522 }1523 class Animation {1524 /**1525 * A polyfill for requestAnimationFrame1526 */1527 static _requestAnimationFramePolyfill: (callback: () => void) => number;1528 static readonly requestAnimationFramePolyfill: (callback: () => void) => number;1529 static _cancelAnimationFramePolyfill: (id: number) => void;1530 static readonly cancelAnimationFramePolyfill: (id: number) => void;1531 /**1532 * A subscribable that notifies subscribers when the animation is explicitly stopped or finishes naturally.1533 */1534 animationEnded: IAnimationState;1535 private _duration;1536 private _easingFunction;1537 private _stepFunction;1538 private _startTime;1539 private _endTime;1540 private _animatedProperties;1541 private _animationStopped;1542 private _ignoreFrames;1543 /**1544 * Creates an animation that tweens some collection of values between start and end values.1545 *1546 * @param stepFunction callback for every frame of the animation1547 * @param animatedProperties a dictionary where the key is the name of the animated property and its value contains the start and end values.1548 * @param duration the length of the animation in milliseconds1549 * @param easingFunction a Callback that maps time to percentage complete for the animation.1550 */1551 constructor(stepFunction: (currentAnimationState: IAnimationState) => void, animatedProperties: IAnimationDescriptor, duration?: number, easingFunction?: (percentComplete: number) => number);1552 private static _defaultEasing(percentTime);1553 /**1554 * Starts the animation.1555 */1556 start(): void;1557 /**1558 * Stops the animation1559 */1560 stop(): void;1561 /**1562 * Whether the animation is stopped (explicitly or the animation ended).1563 */1564 readonly animationStopped: boolean;1565 private _step();1566 }1567}1568declare module HyperGraph {1569 interface StringMap<T> {1570 [key: string]: T;1571 }1572 interface IMutableDictionary<T> {1573 put(key: string, value: T): void;1574 lookup(key: string): T;1575 forEach(callback: (value: T, key: string) => any, thisArg?: any): void;1576 forEachReverse(callback: (value: T, key: string) => any, thisArg?: any): void;1577 modify(callback: () => void): void;1578 toArray(): Array<T>;1579 remove(key: string): void;1580 clear(): void;1581 dispose(): any;1582 }1583 /**1584 * Hash map. Replaces ObservableMap.1585 */1586 class Dictionary<T> implements IMutableDictionary<T> {1587 protected _map: {};1588 constructor(initialProperties?: Object);1589 dispose(): void;1590 put(key: string, value: T): void;1591 lookup(key: string): T;1592 clear(): void;1593 forEach(callback: (value: T, key: string) => any, thisArg?: any): void;1594 forEachReverse(callback: (value: T, key: string) => any, thisArg?: any): void;1595 modify(callback: () => void): void;1596 getKeys(): string[];1597 toArray(): Array<T>;1598 remove(key: string): void;1599 readonly size: number;1600 /** get values as a raw javascript object */1601 getValues(): Object;1602 clone(): Dictionary<T>;1603 assignFrom(dictionary: Dictionary<T>): void;1604 protected static _copyObjectToDictionary(from: Object, to: any): void;1605 /**1606 * Populates the view model from a key/value pairs object.1607 * The keys should map to properties on the view model.1608 * The values are applied to the corresponding keys.1609 *1610 * @param object An un-typed object with values to populate on the view model.1611 */1612 populateFromObject(object: Object): void;1613 /**1614 * Deep copies all the properties of the source object to the destination object.1615 * All properties in destination that are not in the source should remain intact.1616 * Functions are copied by reference.1617 *1618 * @param source The object whose properties need to be copied.1619 * @param destination The destination object.1620 */1621 static copyObject(source: Object, destination: any): void;1622 }1623 /**1624 * Shallow copy from a key/value pairs object.1625 *1626 * @param to An un-typed object to be populated.1627 * @param from An un-typed object with values to populate.1628 * @param scopes Scoped down the list for shallowCopy1629 */1630 function shallowCopyFromObject(to: Object, from: Object, scopes?: string[]): void;1631 /**1632 * Deep copies all the properties of the source object to the destination object.1633 * All properties in destination that are not in the source should remain intact.1634 * Functions are copied by reference.1635 *1636 * We need to ensure that properties that point to one of their ancestors doesn't cause a infinite loop.1637 * To that end, we pass in the sourceAncestors and destination ancestors and check against that.1638 *1639 * @param source The object whose properties need to be copied.1640 * @param destination The destination object.1641 * @param sourceAncestors The ancestors of the source object used to prevent circular linked list causing an infinite loop.1642 * @param destinationAncestors The ancestors of the destination object corresponding to the sourceAncestors to assign to circular linked list.1643 */1644 function _copyObject(source: Object, destination: any, sourceAncestors: Object[], destinationAncestors: Object[]): void;1645 class StringSet extends Dictionary<string> {1646 constructor();1647 add(key: string): void;1648 dispose(): void;1649 }1650}1651declare module HyperGraph {1652 interface IPoint {1653 /** The x coordinate of the point. */1654 x: number;1655 /** The y coordinate of the point. */1656 y: number;1657 }1658 interface IRect {1659 /** The x coordinate of the rectangle. */1660 x: number;1661 /** The y coordinate of the rectangle. */1662 y: number;1663 /** The height of the rectangle. */1664 height: number;1665 /** The width of the rectangle. */1666 width: number;1667 }1668 /**1669 * Returns whether or not a completely lies in b1670 *1671 * @param a the rect to test for lying in b1672 * @param b the enclosing rect1673 * @return true if a lies completely in b. false otherwise.1674 */1675 function rectLiesInRect(a: IRect, b: IRect): boolean;1676 /**1677 * Returns the first point where the ray starting at p1 and ending at p2 intersects rect.1678 *1679 * @param p1 the start point for the line to test1680 * @param p2 the end point for the line to test1681 * @param rect the rectangle1682 * @param rectPadding padding around the rectangle to make the ray float a bit off it1683 * @return where the line and rectangle intersect on the exterior of the rectangle or null if they don't1684 */1685 function rayRectIntersection(p1: IPoint, p2: IPoint, rect: IRect, rectPadding?: number): IPoint;1686}1687declare module HyperGraph {1688 function uncurryThis(f: (...args: any[]) => any): (...args: any[]) => any;1689 const applyUncurry: (f: (...args: any[]) => any, target: any, args: any[]) => any;1690 /** Returns a rfc4122 style UUID v4 GUID such as xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx. */1691 function newGuid(): string;1692 /** Returns a function that can generate globally unique identifiers. */1693 function getUniqueIdGenerator(prefix?: string): () => string;1694 /** Returns a function that can generate unique id under the prefix */1695 function getIdGenerator(prefix: string): () => string;1696 /** Returns a globally unique identifier string. */1697 const getUniqueId: () => string;1698 /** Replaces all instances of a value in a string. */1699 function replaceAll(input: string, searchValue: string, replaceValue: string): string;1700 /** Escapes regular expression special characters -[]/{}()*+?.\^$| */1701 function regexEscape(str: string): string;1702}1703declare module HyperGraph {1704 /**1705 * Uses an array to maintain ordering. Needed for edge path highlighting.1706 */1707 class OrderedDictionary<T> extends Dictionary<T> {1708 keys: any[];1709 constructor(initialProperties?: Object);1710 put(key: string, value: T): void;1711 clear(): void;1712 getKeys(): string[];1713 toArray(): Array<T>;1714 forEach(callback: (value: T, key: string) => any, thisArg?: any): void;1715 forEachReverse(callback: (value: T, key: string) => any, thisArg?: any): void;1716 remove(key: string): void;1717 readonly size: number;1718 clone(): OrderedDictionary<T>;1719 populateFromObject(object: Object): void;1720 }1721}1722declare module HyperGraph {1723 /**1724 *1725 */1726 class PropertyMap extends Dictionary<Object> {1727 constructor(initialProperties?: Object);1728 isEmpty(): boolean;1729 updateProperties(properties: PropertyMap): PropertyMap;1730 merge(propMap: PropertyMap): PropertyMap;1731 }1732}1733declare module HyperGraph {1734 function forEachKey<T>(obj: any, iterator: (key: any, value: T) => void): void;1735 class Timers {1736 /**1737 * Setup the timers to use the built-in browser timers or the setTimeout version.1738 * This function should only be invoked before any timers have been set up.1739 *1740 * @param forceUseSetTimeout Determines which timer to use.1741 */1742 static setupTimers(forceUseSetTimeout?: boolean): void;1743 /**1744 * Sets a one-time callback to be fired at the next frame refresh.1745 *1746 * @param callback The function to be called when the frame is refreshed.1747 * @return A handle to the timeout which can be cancelled.1748 */1749 static requestAnimationFrame(callback: FrameRequestCallback): number;1750 /**1751 * Cancels a timeout that was set with requestAnimationFrame.1752 *1753 * @param handle A handle to the callback.1754 */1755 static cancelAnimationFrame(handle: number): void;1756 /**1757 * Sets a recurring callback to be fired at every subsequent frame refresh.1758 *1759 * @param callback The function to be called every time the frame is refreshed.1760 * @return A handle to the callback which can be cancelled.1761 */1762 static requestAnimationFrameInterval(callback: FrameRequestCallback): number;1763 /**1764 * Cancels a recurring callback that was set with requestAnimationFrameInterval.1765 *1766 * @param handle A handle to the callback.1767 */1768 static cancelAnimationFrameInterval(handle: number): void;1769 static executeAnimationFrameInterval(time: number): void;1770 static scheduleAnimationFrameInterval(force: boolean): void;1771 static clearAnimationFrameInterval(): void;1772 }1773}1774declare module HyperGraph {1775 interface Action {1776 (): void;1777 }1778 /**1779 * An object that is disposable.1780 */1781 interface Disposable {1782 /**1783 * A function called on the object when it is disposed.1784 */1785 dispose(): void;1786 }1787 type ActionOrDisposable = Action | Disposable;1788 interface RegisterForDisposeFunction {1789 (disposables: ActionOrDisposable[]): LifetimeManagerBase;1790 (disposable: ActionOrDisposable): LifetimeManagerBase;1791 }1792 /**1793 * An object that can limit the lifetime of other objects. When a LifetimeManager object1794 * is disposed, it will dispose all other objects that were registered for disposal.1795 */1796 interface LifetimeManagerBase {1797 /**1798 * Registers an object to be disposed. It will throw if the object doesn't have dispose method.1799 * @param disposable An object to be disposed once the LifetimeManager object itself is disposed.1800 */1801 registerForDispose: RegisterForDisposeFunction;1802 }1803 interface LifetimeManager extends LifetimeManagerBase {1804 /**1805 * Create a createChildLifetime to localize the LifetimeManager.1806 * It will provide the function on tracking who create it and when it dispose, it will remove itself from Container's lifetimeManager1807 */1808 createChildLifetime(): DisposableLifetimeManager;1809 }1810 interface DisposableLifetimeManager extends Disposable, LifetimeManager {1811 /** A value indicating whether or not the lifetime is disposed. */1812 isDisposed(): boolean;1813 }1814 /**1815 * An object that tracks and invokes disposal callbacks. This can be used1816 * in other classes that wish to implement LifetimeManager.1817 */1818 class TriggerableLifetimeManager implements DisposableLifetimeManager {1819 private _disposables;1820 private _isDisposed;1821 private _isDisposing;1822 private _container;1823 private _children;1824 private _failToDispose;1825 private _diagnosticCreateStack;1826 constructor();1827 /**1828 * Gets a value indicating whether or not the lifetime is disposed.1829 */1830 isDisposed(): boolean;1831 /**1832 * See interface.1833 */1834 registerForDispose: RegisterForDisposeFunction;1835 /**1836 * See interface.1837 */1838 createChildLifetime(): DisposableLifetimeManager;1839 /**1840 * Causes the instance to regard itself as disposed, and to trigger any1841 * callbacks that were already registered.1842 */1843 dispose(): void;1844 _unregisterChildForDispose(disposable: Disposable): void;1845 _isRegistered(disposable: Disposable): boolean;1846 _registerForDispose(disposable: Disposable): void;1847 }1848}1849declare module HyperGraph {1850 function assert(expression: any, err?: string): void;1851 class Log {1852 static enableLogging: boolean;1853 static error(msg: string): void;1854 static warn(msg: string): void;1855 static debug(msg: string): void;1856 private static getTime();1857 }1858 class BrowserUtils {1859 private static _isEdge;1860 static isEdge(): boolean;1861 }1862 class EventUtils {1863 private static _eventNames;1864 static isValidEvent(eventName: string): boolean;1865 }1866 class Utils {1867 private static readonly MIN_DOM_ID_LENGTH;1868 /**1869 * Correctly extract out ID from document element's domId, for example1870 * a domId typically has the part name prepended to it like "<part>-<guid>-<int>"1871 * so this will filter out the <part> so it will return "<guid>-<int>" which can1872 * then be mapped to the internal graph model1873 *1874 * @param domId1875 */1876 static ParseDomId(domId: string): string;1877 /**1878 * Extract out part name from domId. Verifies the part has three1879 * hyphens or else it will return `undefined`1880 *1881 * @param domId1882 */1883 static ParseDomPartName(domId: string): string;1884 }1885}1886/// <reference types="d3" />1887declare module HyperGraph {1888 /**1889 * A layer holds graph elements. A graph stage can have 1..n layers.1890 */1891 class AbstractGraphStageLayer {1892 stage: GraphStage;1893 layerName: string;1894 constructor(graphStage: GraphStage, layerName: string);1895 attach(svgContainer: d3.Selection<any>): void;1896 clear(): void;1897 }1898 type LayerName = "edges" | "parentNodes" | "childNodes" | "selectedNodes";1899 type RendererName = "node" | "edge";1900 /**1901 * This is a pure SVG implementation with a single SVG element holding1902 * all node and edge shapes.1903 */1904 abstract class AbstractStage implements GraphStage {1905 private layers;1906 private renderers;1907 /** How zoomed in the user is. */1908 scale: number;1909 graphStageAnimation: GraphStageAnimation;1910 /**1911 * Computes the new scale sooming in by steps number of steps (which can be negative for zoom out).1912 * This computed scale is relative to the current scale.1913 *1914 * @param steps the number of steps to zoom in our out. In is positive, out is negative.1915 * @return the new scale that will result from zooming in or out.1916 */1917 static calculateNewZoom(steps: number, scale: number): number;1918 constructor();1919 dispose(): void;1920 abstract preRender(): any;1921 abstract postRender(): any;1922 addRenderer(rendererName: string, renderer: DomRenderer): void;1923 getRenderer(rendererName: string): DomRenderer;1924 addLayer(layerName: LayerName): GraphStageLayer;1925 getLayer(layerName: LayerName): GraphStageLayer;1926 removeLayer(layerName: LayerName): void;1927 saveNodePosition(node: GraphNode): NodePosition;1928 restoreNodePosition(node: GraphNode, oldNodePosition: NodePosition): void;1929 abstract clear(): any;1930 /** Called on attach to dom */1931 abstract attach(container: any): any;1932 abstract addEntity(graphEntity: GraphEntity, topmost: boolean): any;1933 abstract removeEntity(entity: GraphEntity): boolean;1934 abstract findEntityByDomId(domId: string): GraphEntity;1935 abstract clientToDomainCoordinates(clientPoint: IPoint): IPoint;1936 abstract bringRectIntoView(rect: IRect, animate?: boolean): any;1937 abstract zoomIn(steps?: number): any;1938 abstract zoomOut(steps?: number): any;1939 abstract zoomTo100Percent(): any;1940 abstract zoomToFit(): any;1941 abstract handleMouseWheelZoom(wheelUnits: number, clientX: number, clientY: number): void;1942 abstract setWaitCursor(boolean: any): any;1943 abstract pan(clientDx: number, clientDy: number): void;1944 abstract panWithFeedback(clientDx: number, clientDy: number): void;1945 abstract maxFeedbackDistance(): number;1946 abstract feedbackShowing(): boolean;1947 abstract updateScrollbars(): any;1948 }1949}1950/// <reference types="d3" />1951declare module HyperGraph {1952 class DefaultEdgeRenderer extends DomRenderer {1953 stage: GraphStageDom;1954 constructor(layer: GraphStageLayer);1955 addContainerToDom(edge: GraphEdge, svgContainer: d3.Selection<SVGElement>): d3.Selection<SVGElement>;1956 renderToDom(edge: GraphEdge, edgeContainer: d3.Selection<SVGElement>): d3.Selection<SVGElement>;1957 getArrowheadTransform(edge: GraphEdge): string;1958 protected getLineDisplayClasses(edge: GraphEdge): string;1959 protected getFillDisplayClasses(edge: GraphEdge): string;1960 }1961}1962/// <reference types="d3" />1963declare module HyperGraph {1964 class DefaultNodeRenderer extends DomRenderer {1965 constructor(layer: HyperGraph.GraphStageLayer);1966 protected observeEntityProperties(): void;1967 addContainerToDom(node: GraphNode, svgContainer: d3.Selection<SVGElement>): d3.Selection<SVGElement>;1968 addChildContainerToDom(node: GraphNode, childDomId: string, svgContainer: d3.Selection<SVGElement>): d3.Selection<SVGElement>;1969 protected renderSelectionRectangle(node: GraphNode): void;1970 renderToDom(node: GraphNode, nodeGroup: d3.Selection<SVGElement>): d3.Selection<SVGElement>;1971 }1972}1973/// <reference types="d3" />1974declare module HyperGraph {1975 interface GraphEntityRenderer {1976 renderToDom(entity: PropertyEntity, svgContainer: d3.Selection<any>): d3.Selection<any>;1977 }1978 /**1979 * Base DOM renderer. One renderer instance is shared by all nodes.1980 */1981 abstract class DomRenderer implements GraphEntityRenderer {1982 /** set this in constructor */1983 layer: GraphStageLayer;1984 childRenderers: DomRenderer[];1985 private _parent;1986 private _observedProperties;1987 constructor(layer: GraphStageLayer);1988 /**1989 * Renders the entity to the DOM. This implementation relies on containers to1990 * manage the upsert behavior. When an entity is first added to the DOM,1991 * an entity container is created. From that point on the container is emptied and1992 * repopulated on a render. Child elements use the same convention for1993 * efficient updating.1994 *1995 * @param entity1996 * @param svgContainer1997 */1998 addChildRenderers(childRenderers: DomRenderer[]): void;1999 observe(props: string[]): void;2000 isChanged(entity: PropertyEntity): boolean;2001 _isChanged(changeKeys: string[]): boolean;2002 /** Override this for child renderers. */2003 getContainerId(entity: GraphEntity): string;2004 /**2005 * hook for renderers to add svg defs when stage is attached2006 */2007 attach(): void;2008 protected renderErrorEntity(entity: any, svgContainer: d3.Selection<any>): void;2009 /**2010 * Template method to ensure that child elements are added to the stage svgElements map.2011 */2012 /**2013 * Create the entity container in the DOM.2014 * @param entity2015 * @param svgContainer2016 */2017 addContainerToDom(entity: GraphEntity, svgContainer: d3.Selection<any>): d3.Selection<any>;2018 addChildContainerToDom(node: GraphNode, childDomId: string, svgContainer: d3.Selection<any>): d3.Selection<any>;2019 /**2020 * Update/render the entity to the entity's DOM container.2021 * @param entity2022 * @param svgContainer2023 */2024 renderToDom(entity: GraphEntity, svgContainer: d3.Selection<any>): d3.Selection<any>;2025 protected renderTemplate(entity: any): string;2026 }2027}2028declare module HyperGraph {2029 /**2030 * Skin styles of the graph editor.2031 */2032 enum GraphEditorSkinStyle {2033 /** Canvas and node background colors are consistent with typical blade and parts background colors. */2034 Blade = 0,2035 /** Canvas background color is strictly white or black (depending on main color theme), node background color is a tint of blue. */2036 Document = 1,2037 }2038}2039/// <reference types="jquery" />2040declare module HyperGraph {2041 /**2042 * Abstraction of the dom/canvas for rendering.2043 * The stage holds graphical elements. It can zoom, pan, etc.2044 * It doesn't know anything about:2045 * * the graph model2046 * * nodes and edges2047 * * event handling2048 */2049 interface GraphStage extends Disposable {2050 scale: number;2051 graphStageAnimation: GraphStageAnimation;2052 attach(domElement: JQuery): any;2053 preRender(): any;2054 postRender(): any;2055 getRenderer(name: RendererName): GraphEntityRenderer;2056 getLayer(layerName: LayerName): GraphStageLayer;2057 addEntity(entity: GraphEntity, topmost: boolean): any;2058 removeEntity(entity: GraphEntity): boolean;2059 clientToDomainCoordinates(clientPoint: IPoint): IPoint;2060 bringRectIntoView(rect: IRect, animate?: boolean): any;2061 zoomIn(steps?: number): any;2062 zoomOut(steps?: number): any;2063 zoomTo100Percent(): any;2064 zoomToFit(): any;2065 handleMouseWheelZoom(wheelUnits: number, clientX: number, clientY: number): void;2066 setWaitCursor(boolean: any): any;2067 pan(clientDx: number, clientDy: number): void;2068 panWithFeedback(clientDx: number, clientDy: number): void;2069 maxFeedbackDistance(): number;2070 feedbackShowing(): boolean;2071 updateScrollbars(): any;2072 clear(): any;2073 saveNodePosition(node: GraphNode): NodePosition;2074 restoreNodePosition(node: GraphNode, oldNodePosition: NodePosition): void;2075 dispose(): any;2076 }2077}2078/// <reference types="q" />2079declare module HyperGraph {2080 const requestAnimationFramePolyfill: (callback: () => void) => number;2081 const cancelAnimationFramePolyfill: (id: number) => void;2082 class GraphStageAnimation {2083 private stage;2084 static _animationToCleanup: string[];2085 private _animationFrames;2086 private _lastAnimatedScale;2087 _inertiaAnimationFrame: number;2088 private _currentPanZoomAnimation;2089 private _endFeedbackAnimation;2090 _mouseMoveAnimationFrame: number;2091 _touchMoveAnimationFrame: number;2092 _touchZoomAnimationFrame: number;2093 constructor(stage: GraphStage);2094 dispose(): void;2095 /**2096 * Animates such that target becomes the top left corner of the control at the specified scale.2097 *2098 * @param target The point that will become the new top-left corner.2099 * @param targetScale The desired scale.2100 */2101 animateToLocation(target: IPoint, targetScale?: number): Q.Promise<any>;2102 /**2103 * Animates after feedback is finished.2104 * @param callback Optional function to be called once feedback has animated back into place.2105 */2106 animateEndFeedback(callback?: () => void): void;2107 runAnimation(name: string, animationCallback: () => void, count?: number): boolean;2108 stopAnimation(name: string): void;2109 animationTest(): void;2110 }2111}2112/// <reference types="d3" />2113/// <reference types="jquery" />2114/// <reference types="q" />2115declare module HyperGraph {2116 const enum DomUpdatePattern {2117 /** DOM is cleared and re-rendered */2118 Rebuild = 1,2119 /** Only changed entities are rendered */2120 Incremental = 2,2121 }2122 /**2123 * The size of scrollbars given Browser, styling, etc.2124 */2125 interface IScrollBarSize {2126 /** The width of vertical scrollbars. */2127 vertical: number;2128 /** The height of horizontal scrollbars. */2129 horizontal: number;2130 }2131 /** For saving node position on node expansion */2132 interface NodePosition {2133 oldExpansionNodeX: number;2134 oldExpansionNodeWidth: number;2135 oldExpansionNodeY: number;2136 }2137 /** How much to zoom and around what point. */2138 interface IZoomInfo {2139 /** The scale in the zoom operation. */2140 scale: number;2141 /** The point about which to zoom. */2142 location: IPoint;2143 }2144 enum GraphScrollBars {2145 None = 0,2146 Horizontal = 1,2147 Vertical = 2,2148 }2149 enum GraphScrollBarsVisibilityMode {2150 /** Scroll-bars are always visible when mouse pointer is on the graph canvas. */2151 AlwaysVisible = 0,2152 /** Scroll-bars are hidden. */2153 AlwaysHidden = 1,2154 /** Scroll-bars are only visible when nodes are outside the viewport. */2155 AppearWhenNodesOutsideOfTheView = 2,2156 }2157 interface RenderStatus {2158 created: number;2159 updated: number;2160 child: number;2161 }2162 /**2163 * D3js layer implementation that uses pure SVG renderers.2164 */2165 class GraphStageLayer extends AbstractGraphStageLayer {2166 svgContainer: d3.Selection<any>;2167 constructor(graphStage: GraphStage, layerName: string);2168 attach(svgContainer: d3.Selection<any>): void;2169 clear(): void;2170 }2171 const RENDERER_NODE: string;2172 const RENDERER_EDGE: string;2173 /**2174 * DOM-based implementation of graph stage.2175 * This is an all-SVG implementation with a single SVG element2176 * containing all node and edge shapes in one or more layers.2177 */2178 class GraphStageDom extends AbstractStage {2179 private static scrollBarSizes;2180 $element: JQuery;2181 $graphContainer: JQuery;2182 $entityEventContainer: JQuery;2183 svg: d3.Selection<any>;2184 svgDefs: d3.Selection<any>;2185 layerContainer: d3.Selection<any>;2186 domIdToNodeMap: Dictionary<GraphEntity>;2187 domIdToSvgContainerMap: Dictionary<d3.Selection<any>>;2188 domUpdateMode: DomUpdatePattern;2189 x: number;2190 y: number;2191 /** Padding (in pixels) around the graph bounds when zoomToFit is called. Takes effect for zoomToFit() calls made AFTER zoomToFitPadding observable value change. Default value is 100. */2192 zoomToFitPadding: number;2193 zoomThresholdChange: boolean;2194 private _matrixTransform;2195 private _scrollBarSizes;2196 private _viewUpdatingHorizontalScrollbar;2197 private _viewUpdatingVerticalScrollbar;2198 private _lastContainerWidth;2199 private _lastContainerHeight;2200 private _suggestedScrollBars;2201 /** The set of the scrollbars enabled for the graph instance. Make sure to initialize .scrollBarsVisibilityMode property as needed as well. */2202 scrollBars: number;2203 /** The mode of the scroll-bars appearance. Make sure to initialize .scrollBars property as needed as well. */2204 scrollBarsVisibilityMode: GraphScrollBarsVisibilityMode;2205 _oLeft: number;2206 _oRight: number;2207 _oBottom: number;2208 _oTop: number;2209 /** Currently choosen graph style skin. */2210 styleSkin: GraphEditorSkinStyle;2211 private _isDisposed;2212 constructor(styleSkin?: GraphEditorSkinStyle);2213 /**2214 * Disposes the widget.2215 */2216 dispose(): void;2217 /** Indicates if the stage has been disposed. */2218 isDisposed(): boolean;2219 /**2220 * Called on attach to dom2221 * @param container2222 */2223 attach($domElement: JQuery): void;2224 preRender(): void;2225 postRender(): void;2226 clear(): void;2227 addLayer(layerName: LayerName): GraphStageLayer;2228 removeLayer(layerName: LayerName): void;2229 getLayerKey(entity: GraphEntity): string;2230 getRendererKey(entity: GraphEntity): string;2231 /**2232 * Upserts an entity to the graph stage.2233 * In this implementation the entity is rendered to the DOM.2234 * @param entity2235 */2236 addEntity(entity: GraphEntity, topmost: boolean): RenderStatus;2237 protected _createEntity(entity: GraphEntity, renderer: DomRenderer): {2238 created: number;2239 updated: number;2240 child: number;2241 };2242 protected _updateEntity(entity: GraphEntity, renderer: DomRenderer, topmost: boolean): {2243 created: number;2244 updated: number;2245 child: number;2246 };2247 findEntityByDomId(domId: string): GraphEntity;2248 removeEntity(entity: GraphEntity): boolean;2249 protected _showHorizontalScrollBar(): boolean;2250 protected _showVerticalScrollBar(): boolean;2251 protected _horizontalScrollBarClasses(): string;2252 protected _verticalScrollBarClasses(): string;2253 /**2254 * Checks whether the specified scrollBar is enabled for the view model.2255 * @param scrollBar The scrollBar to check on.2256 * @return True if the scrollBar is enabled, false othervise.2257 */2258 scrollBarEnabled(scrollBar: GraphScrollBars): boolean;2259 /**2260 * Checks whether the scrollBars visibility mode is set to AlwaysVisible for the view model.2261 * @return True if the mode is equal to AlwaysVisible, false othervise.2262 */2263 scrollBarsAlwaysVisible(): boolean;2264 /**2265 * Checks whether the scrollBars visibility mode is set to AppearWhenNodesOutsideOfTheView for the view model.2266 * @return True if the mode is equal to AppearWhenNodesOutsideOfTheView, false othervise.2267 */2268 scrollBarsVisibleWhenNeeded(): boolean;2269 readonly _classes: string;2270 setWaitCursor(value: boolean): void;2271 /**2272 * Returns the dimensions of the graph view in client coordinates.2273 * @return The x and y offset on the page as well as the height and width of the view in client coordinates.2274 */2275 readonly viewDimensions: IRect;2276 private _querySelectElement(query);2277 /**2278 * The root SVG container for the connections.2279 */2280 private readonly _svgRootElement;2281 /**2282 * The element containing the SVG scale and pan transforms.2283 */2284 private readonly _transformElement;2285 /**2286 * The element containing and transforming the div overlays.2287 */2288 private readonly _graphOverlay;2289 /**2290 * Returns the dimensions of the entire experiment in domain coordinates2291 */2292 private readonly _graphBounds;2293 /**2294 * Converts user space screen coordinates to graph coordinates.2295 *2296 * @param clientPoint The point to convert in screen coordinates.2297 * @return The input point in graph coordinates.2298 */2299 clientToDomainCoordinates(clientPoint: IPoint): IPoint;2300 zoomIn(steps?: number): void;2301 zoomOut(steps?: number): Q.Promise<any>;2302 zoomTo100Percent(): Q.Promise<any>;2303 /** Zooms to fit the graph in the viewport. */2304 zoomToFit(): Q.Promise<any>;2305 logScale(): number;2306 /** Selects the node and brings it into the view with animation. */2307 focusOnNode(id: string): Q.Promise<any>;2308 /** Selects the edge and brings it into the view with animation. */2309 focusOnEdge(id: string): Q.Promise<any>;2310 /**2311 * Zooms and pans to at a specified scale centered around a specific point.2312 *2313 * @param clientDx The amount to pan in the x direction in client-space coordinates.2314 * @param clientDy The amount to pan in the y direction in client-space coordinates.2315 * @param domainCoords The domain coordinates to zoom about.2316 * @param targetScale The scale to zoom to.2317 */2318 pinchZoom(clientDx: number, clientDy: number, domainCoords: IPoint, targetScale: number): void;2319 /**2320 * Pans the user's view by some delta in client coordinates.2321 *2322 * @param clientDx the amount to pan in the x direction in client-space coordinates2323 * @param clientDy the amount to pan in the y direction in client-space coordinates2324 */2325 pan(clientDx: number, clientDy: number): void;2326 /**2327 * Performs a pan with touch gesture feedback (pan boundary with visible spring).2328 *2329 * @param clientDx the amount to pan in the x direction in client-space coordinates2330 * @param clientDy the amount to pan in the y direction in client-space coordinates2331 */2332 panWithFeedback(clientDx: number, clientDy: number): void;2333 /**2334 * Returns the maximum feedback distance from all directions.2335 * @return The maximum feedback distance for all directions.2336 */2337 maxFeedbackDistance(): number;2338 /**2339 * Returns whether or not any feedback is currently showing.2340 * @return true if feedback is currently showing.2341 */2342 feedbackShowing(): boolean;2343 /**2344 * Computes the canvas pan limits which are used both for scroll bar elevator sizing and to prevent the user from getting lost while they are panning.2345 * These limits are a function of where the user is currently viewing and the bounds of the graph.2346 *2347 * @param scale The scale for which to get the pan limits.2348 * @return The pan limits denoted by the top left corner (x,y) and the panning area (width,height)2349 */2350 getPanLimits(scale?: number): IRect;2351 handleMouseWheelZoom(wheelUnits: number, clientX: number, clientY: number): void;2352 /**2353 * Zooms in or out about the center of the graph2354 *2355 * @param steps The number of steps to zoom. Positive zooms in, negative out.2356 * @param animate Whether the zoom should be animated or instantaneous.2357 */2358 private _zoomAboutCenter(steps, animate?);2359 /**2360 * Zooms to a point given a scale.2361 *2362 * @param targetScale The scale to be zoomed to.2363 * @param domainCoords The point to be zoomed about.2364 */2365 zoomAboutPoint(targetScale: number, domainCoords: IPoint): void;2366 /**2367 * Performs a zoom to fit with animation.2368 */2369 private _zoomToFitWithAnimation();2370 /**2371 * Brings the desired rectangular region into view. If already in view, this is a no-op.2372 * The method attempts to make least amount of translation as well as scaling to get the rect.2373 *2374 * @param rect the rectangle to bring into view2375 * @param animate Whether or not the rect should be animated into position.2376 */2377 bringRectIntoView(rect: IRect, animate?: boolean): Q.Promise<any>;2378 /**2379 * Gets the location of an element in relation to the graph diagram.2380 *2381 * @param element A HTML element inside the graph diagram.2382 */2383 getElementRect(element: HTMLElement): IRect;2384 /**2385 * Synchronizes the scrollbar positions with the view dimensions and where the user is looking.2386 */2387 updateScrollbars(): void;2388 /**2389 * Moved from GraphWidget (2/2017 snapshot)2390 * since the implementation changes based on the type of stage.2391 *2392 * This is our primitive for setting view. The user passes the domainX and Y of the top2393 * left corner of the screen they want and the zoom level they want. This should be the only2394 * function that writes to the transform matrix.2395 *2396 * @param domainCoords The desired top left corner of the screen in domain units.2397 * @param scale The desired scale.2398 */2399 _setOriginAndZoom(domainCoords: IPoint, scale?: number): void;2400 /**2401 * Immediately zooms the control about a point without animation.2402 *2403 * @param targetScale the desired scale after the zoom operation2404 * @param domainCoords the point about which to zoom2405 */2406 private _zoomWithoutAnimation(targetScale, domainCoords);2407 /**2408 * Calculates the new top left of the view and scale given a desired scale and point around which to zoom.2409 *2410 * @param targetScale the desired scale the view should have2411 * @param domainCoords the point about which to zoom in or out2412 */2413 private _zoomToPoint(targetScale, domainCoords);2414 /**2415 * Moves the touch gesture feedback rectangle for each specified direction in client cordinates2416 *2417 * @param top Change in feedback from the top in px2418 * @param right Change in feedback from the right in px2419 * @param bottom Change in feedback from the bottom in px2420 * @param left Change in feedback from the left2421 */2422 private _moveFeedback(top, right, bottom, left);2423 /**2424 * Sets the touch gesture feedback rectangle in each specified direction in client cordinates2425 *2426 * @param top Feedback from the top in px2427 * @param right Feedback from the right in px2428 * @param bottom Feedback from the bottom in px2429 * @param left Feedback from the left in px2430 */2431 _setFeedback(top: number, right: number, bottom: number, left: number): void;2432 /**2433 * Helper function to help identifying the container with data attribute "data-control".2434 *2435 * @param elem The current element to start searching.2436 * @return The first element that has "data-control" attribute. It can be the element it starts with. If none is found, null is returned.2437 */2438 static findContainingControl(elem: Element): Element;2439 /**2440 * Returns the height of horizontal scroll bars and the width of vertical scrollbars (i.e. the invariant dimension).2441 *2442 * @return horizontal Contains the height of horizontal scrollbars and vertical contains the width of vertical scrollbars.2443 */2444 private static readonly ScrollBarSizes;2445 }2446}2447/// <reference types="d3" />2448/// <reference types="jquery" />2449declare module HyperGraph {2450 /**2451 * The definition of a Graph node skin - set of classes used to define ONLY COLOR-RELATED style properties of the elements.2452 */2453 interface IGraphSkinDefinition {2454 /** Class name representing the skin identity. Used as a CSS class in Graph.less file to style NON-COLOR-RELATED properties of the elements (border width, stroke width, etc). */2455 skinMonikerClass: string;2456 /** Classes managing colors (background, fill, stroke, etc) applied to the graph canvas. */2457 canvasColorClasses: string[];2458 /** Classes managing colors (background, fill, border color, stroke color, etc) applied to a graph node. */2459 nodeColorClasses: IGraphNodeColorClasses;2460 /** Classes managing colors (background, fill, border color, stroke color, etc) applied to a graph edge. */2461 edgeColorClasses: IGraphEdgeColorClasses;2462 /** The order and comptatibility the node states are used to apply skin color classes. */2463 nodeStatesCompatibility: IStateCompatibilityStrategy;2464 }2465 /**2466 * The definition of a tooltip view. This contains coordinates and width of the tooltipBox2467 */2468 interface ITooltipPosition {2469 x: number;2470 y: number;2471 width: number;2472 }2473 class SvgUtils {2474 /** Collection of supported graph skins. Use a value of GraphEditorSkinStyle enum as a skin key/index. */2475 static GraphSkinsCollection: {2476 [skin: number]: IGraphSkinDefinition;2477 };2478 static elideText(text: string, d3Text: d3.Selection<any>, desiredWidth: number, tooltipPosition?: ITooltipPosition): string;2479 static hasClass(target: JQuery, className: string): boolean;2480 /**2481 * Returns a value for the stroke-dash attribute of a path in respect to the specified edge style.2482 *2483 * @param style The edge line style selected.2484 * @return String value for the dash array used if the style is not a solid line, 'none' otherwise.2485 */2486 static strokeDashArray(style: EdgePattern): string;2487 /**2488 * Returns a value for the stroke-width attribute of a path in respect to the specified edge strength.2489 *2490 * @param strength The edge strength selected.2491 * @return Width value.2492 */2493 static strokeWidth(thickness: number): number;2494 }2495 /**2496 * The classes managing colors (background, fill, border color, stroke color, etc) applied to a graph node.2497 */2498 interface IGraphNodeColorClasses {2499 /** States index. */2500 [index: string]: string[];2501 /** Classes managing colors (background, fill, border color, stroke color, etc) applied to a graph node at rest. */2502 atRest: string[];2503 /** Classes managing colors (background, fill, border color, stroke color, etc) applied to a hovered graph node. */2504 hovered: string[];2505 /** Classes managing colors (background, fill, border color, stroke color, etc) applied to a selected graph node. */2506 selected: string[];2507 /** Classes managing colors (background, fill, border color, stroke color, etc) applied to a node that has focus. */2508 focused: string[];2509 /** Classes managing colors (background, fill, border color, stroke color, etc) applied to a graph node that is currently emitting an edge draft as a source node. */2510 dragSource: string[];2511 /** Classes managing colors (background, fill, border color, stroke color, etc) applied to a graph node that is currently accepting an edge draft as destination node. */2512 dragTarget: string[];2513 }2514 /**2515 * The classes managing colors (background, fill, border color, stroke color, etc) applied to a graph edge.2516 */2517 interface IGraphEdgeColorClasses {2518 /** States index. */2519 [index: string]: string[];2520 /** Classes managing colors (stroke color, etc) applied to a graph edge at rest. */2521 atRest: string[];2522 /** Classes managing colors (stroke color, etc) applied to a selected graph edge. */2523 selected: string[];2524 }2525 /**2526 * The definition of the order and comptatibility the entity states are used to apply skin color classes.2527 */2528 interface IStateCompatibilityStrategy {2529 /** Name of the entity state defined for current strategy step. */2530 state: string;2531 /** Names of the states that can be applied together with the state defined for current strategy step. */2532 compatible?: string[];2533 /** Strategy to go with in case current entity state is different from the state defined for current strategy step */2534 disjunctive?: IStateCompatibilityStrategy;2535 }2536 var StateCompatibilityStrategyDefinitions: {2537 [name: string]: IStateCompatibilityStrategy;2538 };2539}2540/// <reference types="jquery" />2541declare module HyperGraph {2542 const contextMenuSelector = ".hypergraph-context-menu";2543 const contextMenuNodeTriggerSelector = ".hypergraph-node-context-menu-trigger";2544 interface GraphContextMenuRenderer {2545 getContextMenuTemplate(event: Event, entities: any[]): any;2546 }2547 class ContextMenu {2548 private graphContextMenuRenderer;2549 private eventHandlers;2550 private popupManager;2551 private targetEntity;2552 private hideContextMenuTimer;2553 private readonly conextMenuHideDelayInMs;2554 private isActive;2555 constructor(graphContextMenuRenderer: GraphContextMenuRenderer, eventHandlers?: Object);2556 show(evt: MouseEvent, targetEntity: GraphNode, x?: number, y?: number): JQuery;2557 hide(delay?: number): void;2558 private hideContextMenu();2559 private clearContextMenu();2560 }2561}2562declare module HyperGraph {2563 var SixtyFPS: number;2564 var PanPadding: number;2565 var ZoomFactor: number;2566 var MinScale: number;2567 var MaxScale: number;2568 var AnimatedZoomDuration: number;2569 var SnapAnimationDuration: number;2570 var MoveAnimationDuration: number;2571 var EscAnimationDuration: number;2572 var UndoAnimationDuration: number;2573 var RedoAnimationDuration: number;2574 var MinVelocity: number;2575 var DoubleTapInterval: number;2576 var InertiaFriction: number;2577 var FeedbackAnimationDuration: number;2578 var MaxFeedbackInertiaDistance: number;2579 var FeedbackFriction: number;2580 var MinFeedbackIntertiaVelocity: number;2581 enum EdgeDirection {2582 All = 0,2583 Inbound = 1,2584 Outbound = 2,2585 }2586 enum PortSide {2587 None = 0,2588 Top = 1,2589 Left = 2,2590 Right = 3,2591 Bottom = 4,2592 }2593 /**2594 * What the user's drag intent is.2595 */2596 enum DraggingMode {2597 /** The user is not currently dragging an entity. */2598 None = 0,2599 /** The user is moving graph nodes. */2600 Entities = 1,2601 /** The user is creating a connection. */2602 Connection = 2,2603 /** The user is dragging a selection rectangle. */2604 SelectionRect = 3,2605 }2606 /**2607 * Determines the mode for navigating around the graph with the keyboard.2608 * Anything greater than 'Focus' traps tabbing. In order to escape keyboard2609 * trapping, set the interaction mode to 'Focus' or less.2610 */2611 enum GraphInteractionMode {2612 /**2613 * Context is passed to the contents of the node. It is up to2614 * the node to manage keyboard input and return focus to the graph.2615 */2616 NodeEdit = 0,2617 /**2618 * Context is passed to the edge for editing. It is up to2619 * the edge to manage input and return focus to the graph.2620 */2621 EdgeEdit = 1,2622 /**2623 * The graph has focus only, and is not set as the current context.2624 * NOTE: there is no 'FocusNone' state, since that will never evaluate to true -2625 * The graph will never receive keyboard input when it doesn't have focus.2626 */2627 Focus = 2,2628 /**2629 * Tab navigates around the nodes in a continuous cycle.2630 */2631 Navigation = 3,2632 /**2633 * Tab moves focus around the nodes, allowing them to be added/removed from selection2634 */2635 MultiSelect = 4,2636 /**2637 * Tab moves around the edges.2638 */2639 EdgeSelect = 5,2640 /**2641 * Tab moves focus around the nodes, to select a child node of the currently selected node.2642 */2643 EdgeCreate = 6,2644 }2645}2646/// <reference types="jquery" />2647declare module HyperGraph {2648 /**2649 * Identifies the root element for widgets. This should be valid for any stage implementation.2650 * When user clicks on element of control, GraphStageDom.findContainingControl() will search for the owning control (with data-control attribute) to set the focus.2651 */2652 const dataControlAttribute = "data-control";2653 /**2654 * GraphWidget is a component facade for the graph model, stage, and controllers.2655 * It follows some Viva component conventions but does not use Knockout.2656 *2657 * Public methods on this class are generally safe to use.2658 */2659 class GraphWidget {2660 element: JQuery;2661 options: Object;2662 lifetimeManager: DisposableLifetimeManager;2663 disposablesLifetimeManager: DisposableLifetimeManager;2664 graphModel: GraphModel;2665 stage: GraphStage;2666 domUpdatePattern: DomUpdatePattern;2667 controller: Controller;2668 contextMenu: ContextMenu;2669 /**2670 * Creates a new instance of the Widget.2671 *2672 * @param element The element to apply the widget to.2673 * @param options The view model to use, as a strongly typed GraphViewModel.ViewModel instance.2674 * @param viewModelType The view model type expected. Used to create a default view model instance if the options param is an un-typed object instance. If null, will use the widget GraphViewModel.ViewModel type.2675 */2676 constructor(element: JQuery, options?: any);2677 protected createModel(): GraphModel;2678 protected createStage(): GraphStage;2679 protected createControllers(): Controller;2680 dispose(): void;2681 selectEntity(entity: GraphEntity): void;2682 toggleExpanded(node: GraphNode): void;2683 setNodeExpanded(node: GraphNode, expanded: boolean): void;2684 /**2685 * Expand or collapse all nodes.2686 * @param expand true to expand, false to collapse2687 */2688 setAllNodesExpansion(isExpanded: boolean): void;2689 toggleSelfLinks(nodeId: string): void;2690 zoomIn(steps?: number): void;2691 zoomOut(steps?: number): void;2692 zoomToFit(): void;2693 /**2694 * Show/hide nodes and/or edges. Edges will hide automatically if you hide2695 * the node they are connected to, so in many cases you only need to specify2696 * a set of nodes.2697 */2698 showEntities(entities: GraphEntity[], visible: boolean): void;2699 addSelectionChangeHandler(handler: (selection: SelectedEntities) => void): void;2700 protected render(): void;2701 protected removeEntity(entity: GraphEntity): void;2702 protected renderEntity(entity: GraphEntity, topmost: boolean): RenderStatus;2703 protected subscribe(query: Object, handler: (data: any) => void): void;2704 private _collapseChildeNodes(node);2705 private _mapNodeComparator(leftData, rightData);2706 /**2707 * Adds a subscription to be cleaned up in the dispose().2708 * @param disposable One KnockoutComputed to be added to this._disposables.2709 */2710 private _addDisposablesToCleanUp(disposable);2711 /**2712 * Adds a list of computed to be cleaned up in the dispose().2713 * @param disposable Array of KnockoutComputed to be added to this._disposables.2714 */2715 private _addDisposablesToCleanUp(disposable);2716 readonly _disposables: LifetimeManager;2717 addDisposablesToCleanUp: RegisterForDisposeFunction;2718 }2719}2720/// <reference types="jquery" />2721declare module HyperGraph {2722 class PopupEventManager {2723 private closeHandlers;2724 private event;2725 addCloseHandler(element: JQuery, callback: {2726 (): void;2727 }): void;2728 clear(): void;2729 removeCloseHandler(): void;2730 }2731}2732declare module HyperGraph {2733 const graphContainerClassName = "hypergraph-container";2734 const graphEdgeSvgClassName = "hypergraph-connections-container";2735 const graphFeedbackContainerSelector = ".hypergraph-feedback-container";2736 const graphOverlaySelector = ".hypergraph-overlay";2737 const graphTransformSelector = ".hypergraph-transform";2738 const horizontalScrollBarSelector = ".hypergraph-horizontal-scrollbar";2739 const verticalScrollBarSelector = ".hypergraph-vertical-scrollbar";2740 const horizontalScrollRangeSelector = ".hypergraph-horizontal-scroll-range";2741 const verticalScrollRangeSelector = ".hypergraph-vertical-scroll-range";2742 var template: string;2743}2744/**2745 * Layout provider interfaces.2746 *2747 * HyperGraph tells the layout provider about the model then updates the layout.2748 * The layout provider returns a layout model with references to nodes and edges in the HyperGraph model.2749 */2750declare module HyperGraph.Layout {2751 class LayoutManager implements ILayoutManager {2752 protected nodes: {2753 [id: string]: LayoutNode;2754 };2755 protected edges: {2756 [id: string]: LayoutEdge;2757 };2758 protected nodeStyles: {2759 [name: string]: INodeStyle;2760 };2761 protected newNodes: {2762 [id: string]: LayoutNode;2763 };2764 protected newEdges: {2765 [id: string]: LayoutEdge;2766 };2767 protected yGraph: yfiles.layout.LayoutGraph;2768 protected yNodes: {2769 [id: string]: yfiles.algorithms.Node;2770 };2771 protected yEdges: {2772 [id: string]: yfiles.algorithms.Edge;2773 };2774 protected nodeIdMap: yfiles.algorithms.INodeMap;2775 protected edgeIdMap: yfiles.algorithms.IEdgeMap;2776 protected nodeIdMapForGrouping: yfiles.algorithms.INodeMap;2777 protected groupNodesMap: yfiles.algorithms.INodeMap;2778 protected parentNodeMap: yfiles.algorithms.INodeMap;2779 protected haloMap: yfiles.algorithms.INodeMap;2780 protected insetMap: yfiles.algorithms.INodeMap;2781 protected rootNodeMap: yfiles.algorithms.INodeMap;2782 protected idtoYNodeMap: yfiles.algorithms.IDataMap;2783 protected options: LayoutOptions;2784 layouter: ILayoutAlgorithm;2785 constructor(layouter: ILayoutAlgorithm, options?: LayoutOptions);2786 clearGraph(): void;2787 isLayoutTypeSupported(layoutUpdatePattern: LayoutUpdatePattern): boolean;2788 doLayout(layoutUpdatePattern: LayoutUpdatePattern, suggestedNodeOrder?: NodeOrderMap): LayoutGraph;2789 redoEdgeLayout(): LayoutGraph;2790 addNode(id: string, parentId: string, rootId: string, expanded: boolean, nodeStyle?: string): LayoutNode;2791 addNode(id: string, parentId: string, rootId: string, expanded: boolean, nodeStyle?: INodeStyle): LayoutNode;2792 removeNode(id: string): void;2793 addEdge(source: string, destination: string): LayoutEdge;2794 removeEdge(source: string, destination: string): void;2795 getGraph(): LayoutGraph;2796 getGraphBoundingBox(): BoundingBox;2797 getNode(id: string): LayoutNode;2798 getNodes(): LayoutNode[];2799 getNodesDict(): {2800 [id: string]: LayoutNode;2801 };2802 getEdge(source: string, destination: string): LayoutEdge;2803 getEdges(): LayoutEdge[];2804 getEdgesDict(): {2805 [id: string]: LayoutEdge;2806 };2807 toggleExpanded(id: string): void;2808 setExpanded(id: string, expanded: boolean): void;2809 setAllExpanded(ids: string[], expanded: boolean): void;2810 addNodeStyle(style: INodeStyle): void;2811 removeNodeStyle(name: string): void;2812 getNodeStyles(): INodeStyle[];2813 private updateYNodeStyle(id, nodeStyle);2814 private removeNodeFromGraph(id);2815 private removeEdgeFromGraph(id);2816 private resolveNodeStyle(nodeStyle);2817 private markAllGraphElementsStale();2818 private establishNodeHierarchy();2819 private filterGraphNodesForIncrementalDiff();2820 private filterGraphEdgesForIncrementalDiff();2821 private restoreNodeDefaultSize(node);2822 private translateGraphToOrigin();2823 private updateNodeLayouts();2824 private updateEdgeLayouts();2825 private getEdgePortFromRelativePoint(relPoint, nodeLayout);2826 }2827}2828declare module HyperGraph.Layout {2829 /**2830 * A custom layouter used by an RGL to place grouped nodes in a simple column2831 * It maintains the current ordering of grouped nodes2832 */2833 class SimpleColumnLayouter {2834 constructor();2835 applyLayout(graph: yfiles.layout.LayoutGraph): void;2836 }2837 /**2838 * A custom layouter responsible for routing edges in a column layout (self-links)2839 * Shapes edges into a two-bend U-style shape and shares segments between connected nodes2840 * IE if A -> B and B -> A, their edges should share a vertical segment2841 */2842 class SelfLinkRouter {2843 minDistanceFromNodes: number;2844 distanceBetweenChannels: number;2845 portCandidateYOffset: number;2846 numberOfChannels: number;2847 constructor();2848 clearEdgePoints(graph: yfiles.layout.LayoutGraph, selfEdges: yfiles.algorithms.Edge[]): void;2849 applyLayout(graph: yfiles.layout.LayoutGraph, selfEdges: yfiles.algorithms.Edge[]): void;2850 private tryMergeChannels(mergeBase, channel);2851 private routeEdge(graph, edge, channelIndex);2852 }2853 /**2854 * A custom layouter which uses an IHL and an RGL to achieve the unique ADM-style layouts2855 */2856 class RecursiveHierarchicColumnLayouter implements ILayoutAlgorithm {2857 portCandidateYOffset: number;2858 private hierarchicLayouter;2859 private recursiveLayouter;2860 private columnLayouter;2861 private selfLinkRouter;2862 constructor();2863 applyLayout(graph: yfiles.layout.LayoutGraph, mode: LayoutMode, incrementalNodes?: IncrementalNodesMap, incrementalEdges?: IncrementalEdgesMap, nodeOrderMap?: NodeOrderMap): void;2864 }2865}2866declare module DependencyMap {2867 const version = "2.0.5";2868}2869/// <reference types="q" />2870declare module DependencyMap {2871 class AdmController extends HyperGraph.Controller {2872 NAME: string;2873 mapStyle: MapStyle;2874 getMachineDetailsInSpecificGroup: boolean;2875 contextMenuYOffsetForTopLevelNode: number;2876 constructor(widget: HyperGraph.GraphWidget, mapStyle: MapStyle);2877 initEventHandlers(): void;2878 /**2879 * Workaround for IE 11's lack of CSS support in SVG shapes.2880 * Mouse enter/leave will dynamically adjust action bar height and node rect height.2881 */2882 actionBarMouseHandler(event: MouseEvent, node: GraphNode, action: string, domId: string, resolvedTargetElement: any, expanded: boolean): void;2883 nodeMouseHandler(event: MouseEvent, node: GraphNode, action: string, domId: string, resolvedTargetElement: any): boolean;2884 nodeToggledEventHandler(node: GraphNode): Q.Promise<void>;2885 private _showContextMenu(event, node);2886 private _getMachineDetails(node, mapApiProvider, telemetryCorrelationId);2887 private _getClientGroupDetails(node, mapApiProvider, telemetryCorrelationId);2888 private _getServerGroupDetails(node, mapApiProvider, telemetryCorrelationId);2889 }2890}2891declare module DependencyMap {2892 /**2893 * HyperGraph model2894 */2895 class AdmGraphModel extends HyperGraph.DefaultGraphModel {2896 NAME: string;2897 admModel: DependencyMap.MapModel;2898 enableEdgeSelection: boolean;2899 private popupManager;2900 private isV3;2901 private collapseAllMachines;2902 private admLayoutStyles;2903 constructor(admMapModel: DependencyMap.MapModel, admLayoutStyles: AdmLayoutStyles, enableSimpleMapLayout?: boolean);2904 enableSimpleMapLayout(): void;2905 setModel(collapseAllMachines: boolean, mapModel: DependencyMap.IMap, isApiV3?: boolean, groupAsSingleNode?: boolean): void;2906 addNodeBadge(nodeId: any, badge: any): void;2907 showNonAgentBackends(visible: boolean): void;2908 /**2909 * Overrides GraphModel version to perform additional validation.2910 */2911 addEdge(sourceNodeId: string, destNodeId: string, properties?: Object): GraphEdge;2912 private loadNodes(nodeMap, isApiV3?, groupAsSingleNode?);2913 updateGroupDetailsInAdmGraph(groupId: string, members: IClientOrServerGroupMemberMachine[]): void;2914 addClientGroupMembersVirtualConnections(connections: IClientGroupMemberVirtualConnection[]): void;2915 addServerGroupMembersVirtualConnections(connections: IServerGroupMemberVirtualConnection[]): void;2916 notify(): void;2917 toggleSelfLinks(nodeId: string): void;2918 /**2919 * Overridden to update aggregate edge properties. for V3, we should refactor the hypergraph to remove this logic.2920 */2921 protected _addAggregateEdge(source: string, dest: string, edge: GraphEdge): HyperGraph.GraphEdge;2922 private loadAllMachineNodes(machines);2923 private loadGroupAsSingleNode(virtualGroupNode);2924 private isConnectedProcessGroup(processgroup);2925 private addProcessGroupToGraph(processGroup, processGroupParentNode, rootNode);2926 private _mapNodeComparator(leftData, rightData);2927 private loadEdges(mapModel);2928 private createEdgeFromConnection(sourceNodeId, destNodeId, connection);2929 private createSyntheticNodeId(entityId, parentId);2930 }2931}2932import Dictionary = HyperGraph.Dictionary;2933import GraphNode = HyperGraph.GraphNode;2934import GraphEdge = HyperGraph.GraphEdge;2935declare module DependencyMap {2936 class AdmGraphNodeOrderer2 implements HyperGraph.NodeOrderer {2937 graphModel: HyperGraph.GraphModel;2938 constructor(graphModel?: HyperGraph.GraphModel);2939 setGraphModel(graphModel: HyperGraph.GraphModel): void;2940 getSuggestedOrder(): {2941 [id: string]: string[];2942 };2943 private _processNodeComparator(left, right);2944 }2945}2946declare module DependencyMap {2947 interface NodeRenderingConstants {2948 haloMargin: number;2949 haloBorderWidth: number;2950 actionBarHeight: number;2951 actionBarMinimizedHeight: number;2952 actionBarHeightBump: number;2953 actionBarBorderWidth: number;2954 borderWidth: number;2955 selectedBorderWidth: number;2956 }2957 type RendererName = "node" | "edge" | "machine" | "clientGroup" | "serverGroup" | "process" | "processGroup" | "groupedMachine" | "unconnectedProcessesGroup" | "clientAndServerGroupV3" | "groupMember" | "virtualGroup" | "placeholder";2958 const RENDERER_NODE: RendererName;2959 const RENDERER_EDGE: RendererName;2960 const RENDERER_MACHINE_NODE: RendererName;2961 const RENDERER_CLIENT_GROUP_NODE: RendererName;2962 const RENDERER_SERVER_GROUP_NODE: RendererName;2963 const RENDERER_PROCESS_GROUP_NODE: RendererName;2964 const RENDERER_PROCESS_NODE: RendererName;2965 const RENDERER_GROUPED_MACHINE_NODE: RendererName;2966 const RENDERER_GROUP_MEMBER_NODE: RendererName;2967 const RENDERER_UNCONNECTED_PROCESSES_NODE: RendererName;2968 const RENDERER_CLIENT_AND_SERVER_GROUP_NODEV3 = "clientAndServerGroupV3";2969 const RENDERER_VIRTUAL_GROUP_NODE: RendererName;2970 const RENDERER_PLACEHOLDER_NODE: RendererName;2971 class AdmGraphStage extends HyperGraph.GraphStageDom {2972 private mapStyle;2973 private admLayoutStyles;2974 private admGraphModel;2975 private admGraphWidget;2976 constructor(graphWidget: AdmGraphWidget, mapStyle: MapStyle, layoutStyles: AdmLayoutStyles, graphModel: AdmGraphModel);2977 attach(domElement: JQuery): void;2978 addRenderer(layerName: RendererName, renderer: HyperGraph.DomRenderer): void;2979 getRendererKey(entity: HyperGraph.GraphEntity): RendererName;2980 private addSvgDefs();2981 private addClipPathsToSvgDef();2982 private addImage(svgDefs, id, path, width, height);2983 private addSvg(svgDefs, id, svgString, width, height);2984 private addDropShadowFilter(svgDefs, id, offsetX, offsetY, floodColor, filterHeight?);2985 }2986}2987declare module DependencyMap {2988 interface AdmGraphWidgetOptions {2989 admMapModel: MapModel;2990 mapStyle: MapStyle;2991 layoutStyles: AdmLayoutStyles;2992 enableSimpleMapLayout?: boolean;2993 }2994 class AdmGraphWidget extends HyperGraph.GraphWidget {2995 static ResourceStrings: any;2996 static MapImagesRelativePath: string;2997 apiDataProvider: IMapApiDataProvider;2998 mapStyle: MapStyle;2999 controller: AdmController;3000 constructor(element: JQuery, options: AdmGraphWidgetOptions);3001 addNodeBadge(nodeId: string, badge: DependencyMap.Integrations.MapBadge): void;3002 showNonAgentBackends(enabled: boolean): void;3003 clear(): void;3004 protected createModel(): HyperGraph.GraphModel;3005 getMapModel(): MapModel;3006 protected createStage(): AdmGraphStage;3007 protected createControllers(): any;3008 }3009}3010declare module DependencyMap {3011 class AdmLayoutStyles {3012 mapStyle: MapStyle;3013 constructor(mapStyle: MapStyle);3014 readonly NodeStyles: {3015 [name: string]: HyperGraph.Layout.INodeStyle;3016 };3017 private static _rectangularNodeStyles;3018 private static _circularNodeStyles;3019 }3020}3021/// <reference types="knockout" />3022/// <reference types="q" />3023declare module DependencyMap {3024 interface IComputerInfo {3025 computerName: string;3026 displayName: string;3027 id: string;3028 }3029 /**3030 Options accepted by methods initializeDependencyMap or initializeDependencyMapV3 should follow this interface contract.3031 */3032 interface DependencyMapOptions {3033 /**3034 @deprecated3035 If this value is specified explicitely to 'flase' then all machine nodes in the graph are expanded.3036 This option will be omitted if the map being opened is V3 version.3037 In new API contract, UX has to make API call to get the process level details to expand any machine node.3038 */3039 collapseAllMachines: boolean;3040 /**3041 This list is optional.3042 If this list is provided then the library will try to get all Alerts and log events associated to each and every machine3043 in the list and render them in the graph.3044 */3045 computerInfo?: IComputerInfo[];3046 /**3047 * ResourceId of which the being is being rendered3048 */3049 mapId: string;3050 /**3051 * Display name of the resource.3052 */3053 mapDisplayName: string;3054 /**3055 * Type of the map.3056 * Current supported values are "groupMap" and "singleVmMap"3057 */3058 mapType: string;3059 /**3060 This list is an array of node ids which need to be highlighted in the graph.3061 This is optional list.3062 */3063 highlightEntities?: string[];3064 /**3065 * show navigation Icon for Health tab.3066 * This parameter is specific to VmInsights.3067 */3068 showHealthBadge?: boolean;3069 /**3070 * This flag indicates if group map need to be rendered as3071 */3072 groupAsSingleNode?: boolean;3073 }3074 enum MapStyle {3075 Circular = 0,3076 Rectangular = 1,3077 }3078 enum ErrorCode {3079 EmptyMachineGroup = 1,3080 MachineDoesNotExist = 2,3081 UnknownError = 3,3082 }3083 interface INavigationDisplayContent {3084 id: string;3085 displayName: string;3086 isCurrent: boolean;3087 }3088 class AdmMap {3089 static INITIAL_SERVERPORT_GROUP_COUNT: number;3090 NAME: string;3091 MAP_MAX_NUM_NODES: number;3092 MAP_MAX_NUM_EDGES: number;3093 private Strings;3094 loadState: KnockoutObservable<LoadState>;3095 showExpandCollapseButton: KnockoutObservable<boolean>;3096 showSaveMapCommand: KnockoutObservable<boolean>;3097 showFilterButton: KnockoutObservable<boolean>;3098 mapPlaceholderImagePath: KnockoutObservable<string>;3099 mapWarningImagePath: KnockoutObservable<string>;3100 mapModel: KnockoutObservable<MapModel>;3101 selectionContext: KnockoutObservable<SelectionContext>;3102 enableCircularStyles: KnockoutObservable<boolean>;3103 timeInterval: KnockoutObservable<TimeInterval>;3104 mapContext: KnockoutObservable<MapContext>;3105 onlyShowGroupProcesses: KnockoutObservable<string>;3106 showNonAgentBackends: KnockoutObservable<boolean>;3107 navigationButtonVisible: KnockoutObservableBase<boolean>;3108 navigationButtonDisplayText: KnockoutObservableBase<string>;3109 isError: KnockoutObservable<boolean>;3110 kind: DependencyMap.Api.v2.MapRequestKind;3111 mapName: string;3112 legendVisible: KnockoutObservable<boolean>;3113 filterVisible: KnockoutObservable<boolean>;3114 isIncremental: KnockoutObservable<boolean>;3115 mapContextError: KnockoutObservable<string>;3116 mapStyle: KnockoutObservable<MapStyle>;3117 progressStatus: KnockoutComputed<string>;3118 private admGraphWidget;3119 private clientGroupsToCount;3120 private progressIndicator;3121 private popupManager;3122 private layoutComputed;3123 private layoutStyles;3124 private enableEdgeSelection;3125 private mapApiDataProvider;3126 private $mapContainer;3127 private dashboardOptions;3128 private mapRawDataV3;3129 private mapBadges;3130 private mapRawDataV2;3131 private mapOptions;3132 private _mapNavigationContext;3133 private mapApiSessionId;3134 /**3135 * This is id of computer or computerGroup whose map is rendered currently.3136 */3137 private _id;3138 constructor($element: JQuery, options?: DependencyMapDashBoardOptions);3139 setMapStyleToPreview(): void;3140 setMapStyleToClassic(): void;3141 initializeDependencyMapV3(data?: Api.v3.MapResponse, options?: DependencyMapOptions): Q.Promise<void>;3142 handleErrorCode(errorCode: ErrorCode): any;3143 clearMap(clearMapNavigationContext?: boolean): void;3144 initializeDependencyMap(rawData: DependencyMap.Api.Data, options?: DependencyMapOptions): void;3145 setMapState(mapState: DependencyMap.LoadState): void;3146 /**3147 * Adds given custom properties to their corresponding map nodes.3148 * These custom properties are used to display default properties panel.3149 * @param customizedProperties3150 */3151 assignCustomizedProperties(customizedProperties: DependencyMap.Api.v2.CustomizedProperty[]): void;3152 updateClientGroupMemberCollection(clientGroupMemberCollection: Api.v2.ClientGroupMembersCollection[]): void;3153 /**3154 * updates the selection context to communicate the active selection with other components3155 * @param entity3156 */3157 updateSelectionContext(selectedNodes: IMapNode[], selectedEdge: IMapEdge, badgeType?: BadgeType): void;3158 toggleMapLegend: (data: any, event: any) => void;3159 hideMapLegend: () => void;3160 toggleProcessesFilter: () => void;3161 hideProcessesFilter: () => void;3162 /**3163 * Adds badges to the monitored machines.3164 * @param badges Badges to be added. They are Alerts, updates, changeTracking3165 */3166 addNodeBadges(badges: Integrations.MapBadge[]): void;3167 saveMapAsSvg(): void;3168 navigateToPrevContext(): void;3169 updateServerPortsVisibility(portIds: string[]): void;3170 zoomFitMap(): void;3171 enableSimpleMapLayout(): void;3172 /**3173 * Processes the raw json returned by GetCoarseMap API.3174 * @param data3175 * @param showHealthBadge: This is a boolean parameter sepecific to VmInsights.3176 * If this parameter is specified we show an Icon at the Machine node and a navigation behaviour to3177 * Health tab.3178 */3179 private processCoarseMapData(data, options?);3180 /**3181 This method parses this._id, gets the workspace and updates the TelemteryGlobalContext3182 */3183 private updateTelemetryGlobalContext();3184 private createGraphWidget();3185 private loadData(coarseMapResult, options?);3186 /**3187 * Add clientGroup members of V2 API.3188 * All members are unmonitored only.3189 * @param clientCloudInfo Client group member array3190 * @param mapModel map model3191 */3192 private updateClientGroupMembers(clientCloudInfo, mapModel);3193 private convertClientCloudInfoId(clientCloudInfoId);3194 private progressHandler(progressInfo);3195 private getNodeCount(mapResult);3196 private getEdgeCount(mapResult);3197 protected addGraphEventHandlers(): void;3198 private loadNodeServerMap(node);3199 private saveNavigationContext(mapApiResponse, mapOptions);3200 private toggleNodeSelfLinks(node);3201 private viewDetailedGroupMap(node);3202 private expandOrCollapseNode(node);3203 private zoomInMap(steps?);3204 private zoomOutMap(steps?);3205 private expandAllNodes();3206 private collapseAllNodes();3207 private calculateCoordinatesForServerPortsConfigNode();3208 }3209}3210declare module DependencyMap {3211 var BigPort: HyperGraph.GraphWidgetPort;3212 var SmallPort: HyperGraph.GraphWidgetPort;3213 var PortYOffset: number;3214 enum HttpStatusCode {3215 OK = 200,3216 }3217}3218/**3219 * AdmMapModel is the encompassing model that contains the entities, connections,3220 * and other data the UI uses to represent the domain of a map.3221 * It's the right place to augment the simple model returned by the API in ways that are useful to the UI3222 * e.g. identify and mark self-links, roll up process roles to machine, etc.3223 */3224declare module DependencyMap {3225 class MapModel implements IMap {3226 readonly NAME: string;3227 entities: {3228 [id: string]: IEntity;3229 };3230 ips: {3231 [ipAddress: string]: IEntity;3232 };3233 machineToClientOrServerGroupMap: {3234 [id: string]: GroupViewModelV3[];3235 };3236 nodes: NodeMap;3237 edges: EdgeMap;3238 badges: Integrations.MapBadge[];3239 visitedNodes: string[];3240 machineGroupMap: {3241 [id: string]: IMachine;3242 };3243 private highlyUsedServerPorts;3244 private readonly maxNumberOfServerPortsVisible;3245 constructor();3246 setModel(mapResult: Api.v2.Map, mapContext: MapContext): void;3247 setModelV3(modelResponse: Api.v3.MapResponse, mapContext: MapContext, groupAsSingleNode: boolean): void;3248 getEntityById(entityId: string, ignoreCase?: boolean): IEntity;3249 /**3250 * Returns the first entity with computer name3251 * (not any other node like client group, etc.)3252 *3253 * @param computerName name of the computer machine to retrieve3254 */3255 getEntityByComputerName(computerName: string): IEntity;3256 /**3257 * Returns the first machine matching `resourceId`3258 * @param resourceId the ARM ID3259 */3260 getEntityByResourceId(resourceId: string): IEntity;3261 getMapNodeById(nodeId: string): IMapNode;3262 getClientOrServerGroups(memberMachineId: string): GroupViewModelV3[];3263 updateGroupDetails(groupId: string, groupMemberMap: Api.v3.ClientOrServerGroupMachineMap): {3264 groupMembers: IClientOrServerGroupMemberMachine[];3265 clientGroupMemberConnections: IClientGroupMemberVirtualConnection[];3266 serverGroupMembersConnections: IServerGroupMemberVirtualConnection[];3267 };3268 hasVisited(nodeId: string): boolean;3269 updateMapModelV3(mapResponse: Api.v3.MapResponse): {3270 map: IMap;3271 clientgroupMemberVirtualConnections: ClientGroupMemberVirtualConnection[];3272 serverGroupMemberVirtualConnections: ServerGroupMemberVirtualConnection[];3273 };3274 /**3275 * This method sets the serverPorts visibility.3276 * If there are any portIds are passed to this method, then we set only those ports visible in the Map.3277 * Else, we follow below order to mark serverPorts visible.3278 * 1. Always mark ports with failed connections as Visibile3279 * 2. Always mark ports 443 and 80 as visible.3280 * 3. Give preference to ports with more dependencies3281 * @param portIds3282 */3283 updateServerPortsVisibility(portIds: string[]): void;3284 private addMachineApiDataToMapModel(machineRawData, entities, machineResult, machineGroupMembers, ips);3285 private addProcessesApiDataToMapModel(processesRawData, processGroupRawData, processResult, processGroupResult);3286 private addClientGroupApiDataToMapModel(clientGroupsRawData, entities, newlyAddedClientGroup);3287 private addServerGroupApiDataToMapModel(serverGroupsRawData, entities, newlyAddedServerGroup);3288 private addConnetionApiDataToMapModel(connectionRawData, entities, newlyAddedConnections, servergroupMemberVirtualConnections?);3289 private getRootNode(data);3290 private addProcessSummaryApiDataToMapModel(processSummaries, entities);3291 private addClientGroupSummaryApiDataToMapModel(clientGroupSummariesRawData, entities, clientOrServerGroupMemberMachines, machineGroupMap);3292 private addServerGroupSummaryApiDataToMapModel(serverGroupSummariesRawData, entities, clientOrServerGroupMemberMachines, machineGroupMap);3293 private addClientOrServerGroupMembersToGroup(members, groupViewModel, memberCount, entities, machineGroupMap, isMonitored);3294 private clearLocalCache();3295 /**3296 * Get the source or destination process from a connection entity3297 * Note: connections are typically modeled as process to process3298 * @param connection3299 * @param getSource true for source, false for destination3300 */3301 getProcessByConnection(connection: IConnection, getSource: boolean): IProcess;3302 /**3303 * Get the source or destination machine from a connection entity3304 * Note: connections are typically modeled as process to process3305 * @param connection3306 * @param getSource true for source, false for destination3307 */3308 getMachineByConnection(connection: IConnection, getSource: boolean): IMachine;3309 /**3310 * Set an arbitrary, untyped property on an entity3311 * Useful for allowing integrations to attach data to nodes3312 * @param nodeId3313 * @param name3314 * @param value3315 */3316 setEntityProperty(entityId: string, name: string, value: any): void;3317 /**3318 * Append a badge to a mapNode's badge list3319 * @param nodeId3320 * @param badge3321 */3322 addNodeBadge(nodeId: string, badge: Integrations.MapBadge): IMapNode;3323 toggleSelfLinks(nodeId: string): void;3324 /**3325 * Get count of machine clients for an entity, taking into account a possible client group3326 * @param entity3327 */3328 getClientMachinesCount(entity: Machine | Process | ProcessGroup): ApproximatedCount;3329 /**3330 * Get count of machine servers for an entity3331 * @param entity3332 */3333 getServerMachinesCount(entity: Machine | Process | ProcessGroup): ApproximatedCount;3334 }3335}3336declare module DependencyMap {3337 var AdmMapResources: {3338 all: string;3339 alertsBlueBadge: string;3340 alertsRedBadge: string;3341 alertsYellowBadge: string;3342 AllConnectionsOption: string;3343 appServerRoleIcon: string;3344 backTo: string;3345 caretDownLightIcon: string;3346 caretUpLightIcon: string;3347 caretDownDarkIcon: string;3348 caretUpDarkIcon: string;3349 changeTrackingBadge: string;3350 clientGroupIcon: string;3351 ContextMenu: string;3352 databaseRoleIcon: string;3353 errorBadge: string;3354 ErrorMapEmptyGroup: string;3355 ErrorMachineDoesNotExist: string;3356 ErrorMapGeneric: string;3357 ErrorMapNoActiveMachines: string;3358 ErrorMapTooLarge: string;3359 ExampleMapTitle: string;3360 GroupConnectionsOption: string;3361 HideSelfLinks: string;3362 ldapRoleIcon: string;3363 linuxIcon: string;3364 LoadServerMap: string;3365 ExpandGroup: string;3366 ExpandNode: string;3367 CollapseNode: string;3368 MapControlCollapseAll: string;3369 MapControlExpandAll: string;3370 MapControlFilter: string;3371 MapControlHelp: string;3372 MapControlZoomFit: string;3373 MapControlZoomIn: string;3374 MapControlZoomOut: string;3375 MapLegendAppServer: string;3376 MapLegendConnections: string;3377 MapLegendConnectionsSubtitle: string;3378 MapLegendDatabase: string;3379 MapLegendFailed: string;3380 MapLegendHeader: string;3381 MapLegendInbound: string;3382 MapLegendLdap: string;3383 MapLegendMachineRoles: string;3384 MapLegendOutbound: string;3385 MapLegendSelfLink: string;3386 MapLegendSmb: string;3387 MapLegendWebServer: string;3388 menuIconDark: string;3389 menuIconLight: string;3390 NodeHeaderClientGroupPlural: string;3391 NodeHeaderClientGroupSingular: string;3392 NodeHeaderPortPlural: string;3393 NodeHeaderPortSingular: string;3394 NodeHeaderProcessPlural: string;3395 NodeHeaderProcessSingular: string;3396 NodeHeaderServerPlural: string;3397 NodeHeaderServerSingular: string;3398 ProcessesFilterHeader: string;3399 NodeHeaderComputersPlural: string;3400 NodeHeaderComputersSingular: string;3401 ProgressComputingLayout: string;3402 ProgressLoadingData: string;3403 ProgressRenderingGraph: string;3404 securityBlueBadge: string;3405 securityRedBadge: string;3406 securityYellowBadge: string;3407 serverGroupIcon: string;3408 serviceDeskBlueBadge: string;3409 serviceDeskRedBadge: string;3410 serviceDeskYellowBadge: string;3411 ShowNonAgentBackends: string;3412 ShowSelfLinks: string;3413 SkeletonHintText: string;3414 smbRoleIcon: string;3415 updatesBlueBadge: string;3416 updatesRedBadge: string;3417 updatesYellowBadge: string;3418 warningBadge: string;3419 webServerRoleIcon: string;3420 windowsIcon: string;3421 UnconnectedProcessgroupDisplayName: string;3422 SummaryCountDependenciesHeader: string;3423 SummaryCountClients: string;3424 SummaryCountServers: string;3425 SummaryCountConnectionsHeader: string;3426 SummaryCountFailedConnections: string;3427 SummaryCountInboundConnections: string;3428 SummaryCountOutboundConnections: string;3429 FqdnHeader: string;3430 OperatingSystemLongHeader: string;3431 IPv4AddressesHeader: string;3432 IPv6AddressesHeader: string;3433 MacAddressesHeader: string;3434 CPUsHeader: string;3435 DNSNamesHeader: string;3436 MegahertzUnit: string;3437 PhysicalMemoryHeader: string;3438 MegabytesUnit: string;3439 VMStateHeader: string;3440 VMTypeHeader: string;3441 HypervisorTypeHeader: string;3442 HyperVType: string;3443 LDOMType: string;3444 LogicalPartitionType: string;3445 VMwareType: string;3446 VirtualPCType: string;3447 XenType: string;3448 LastRebootHeader: string;3449 OMSAgentIDHeader: string;3450 ADMAgentIDHeader: string;3451 ADMAgentVersionHeader: string;3452 DisplayNameHeader: string;3453 ExecutableNameHeader: string;3454 DescriptionHeader: string;3455 UsernameHeader: string;3456 DomainHeader: string;3457 CompanyNameHeader: string;3458 ProductNameHeader: string;3459 ProductVersionHeader: string;3460 WorkingDirectoryHeader: string;3461 CommandLineHeader: string;3462 ClientGroupOverviewHeader: string;3463 ClientGroupExplanation: string;3464 ClientGroupCountsHeader: string;3465 ClientGroupCountsUnmonitored: string;3466 ClientGroupCountsIpPortPairs: string;3467 ClientGroupMemberListHeader: string;3468 IpAddress: string;3469 EntityTypePort: string;3470 ServerGroupDescription: string;3471 DNSNameSingular: string;3472 EntityTypeMachine: string;3473 EntityTypeMachinePlural: string;3474 EntityTypeProcess: string;3475 EntityTypeProcessPlural: string;3476 EntityTypeClientGroup: string;3477 EntityTypeClientGroupPlural: string;3478 EntityTypeServerGroup: string;3479 EntityTypeServerGroupPlural: string;3480 EntityTypeProcessGroupPlural: string;3481 EntityTypeProcessGroup: string;3482 less: string;3483 more: string;3484 NotMonitoredHeader: string;3485 NotMonitoredMessage: string;3486 ServerSideInfo: string;3487 ClientSideInfo: string;3488 navigateToPreviousMap: string;3489 ViewAllPorts: string;3490 Connection: string;3491 };3492 var lcl: {};3493}3494/// <reference types="d3" />3495declare module DependencyMap {3496 class HelperUtils {3497 static addImage(svgDefs: d3.Selection<any>, id: string, path: string, width: number, height: number, x: number, y: number, title: string, visibility: boolean, focusable?: boolean, customClass?: string): d3.Selection<any>;3498 static SelectGraphNode(node: GraphNode): void;3499 static SelectGraphEdge(edge: MapEdge): void;3500 }3501}3502declare module DependencyMap {3503 class MapImages {3504 static readonly light_caret_up: string;3505 static readonly light_caret_down: string;3506 static readonly light_ellipsis: string;3507 static readonly light_client_group: string;3508 static readonly light_linux: string;3509 static readonly dark_caret_up: string;3510 static readonly dark_caret_down: string;3511 static readonly dark_ellipsis: string;3512 static readonly dark_linux: string;3513 static readonly dark_client_group: string;3514 static readonly triangle_expand: string;3515 static readonly triangle_collapse: string;3516 static readonly failed_connection_status: string;3517 static readonly chevron_left: string;3518 static readonly chevron_right: string;3519 static readonly chevron_left_disabled: string;3520 static readonly chevron_right_disabled: string;3521 static readonly collapse_box: string;3522 static readonly expand_box: string;3523 static readonly windows_logo: string;3524 static readonly triangle_bang_yellow: string;3525 static readonly circle_bang_red: string;3526 static readonly alerts_blue: string;3527 static readonly alerts_yellow: string;3528 static readonly alerts_red: string;3529 static readonly change_tracking_blue: string;3530 static readonly security_blue: string;3531 static readonly security_yellow: string;3532 static readonly security_red: string;3533 static readonly service_desk_blue: string;3534 static readonly service_desk_yellow: string;3535 static readonly service_desk_red: string;3536 static readonly updates_blue: string;3537 static readonly updates_yellow: string;3538 static readonly updates_red: string;3539 static readonly vm_health: string;3540 static readonly configure: string;3541 static readonly configure_light: string;3542 }3543}3544declare module DependencyMap {3545 /**3546 * Below enum defines various Map navigation operations during interaction with Main map canvas3547 */3548 enum MapNavigationOperation {3549 LoadSingleNodeMap = "LoadSingleNodeMap",3550 GroupAsSingleNodeMap = "GroupAsSingleNodeMap",3551 DetailedGroupMap = "DetailedGroupMap",3552 }3553 interface IMapNavigationOperationContext {3554 id: string;3555 mapOperation: MapNavigationOperation;3556 displayName: string;3557 mapApiResponse: Api.v3.MapResponse;3558 mapOptions: DependencyMapOptions;3559 }3560 class MapNavigationContext {3561 private mapNavOperationContexts;3562 saveMapNavigationContext(mapNavigationOperation: IMapNavigationOperationContext): void;3563 popMapNavigationContext(): IMapNavigationOperationContext;3564 getNavigationStackLength(): number;3565 getNavigationButtonDisplayName(): string;3566 clearMapNavigationContext(): void;3567 }3568}3569declare module DependencyMap {3570 class AdmMapTemplate {3571 static template: string;3572 }3573}3574/// <reference types="d3" />3575declare module DependencyMap {3576 class AdmBadgeIconCircularRenderer extends HyperGraph.DomRenderer {3577 static badgeIconIds: {3578 alerts_blue: string;3579 alerts_yellow: string;3580 alerts_red: string;3581 change_tracking_blue: string;3582 security_blue: string;3583 security_yellow: string;3584 security_red: string;3585 "service-desk-blue": string;3586 "service-desk-yellow": string;3587 "service-desk-red": string;3588 updates_blue: string;3589 updates_yellow: string;3590 updates_red: string;3591 };3592 static badgeIconPaths: {3593 alerts_blue: string;3594 alerts_yellow: string;3595 alerts_red: string;3596 change_tracking_blue: string;3597 security_blue: string;3598 security_yellow: string;3599 security_red: string;3600 "service-desk-blue": string;3601 "service-desk-yellow": string;3602 "service-desk-red": string;3603 updates_blue: string;3604 updates_yellow: string;3605 updates_red: string;3606 };3607 constructor(layer: HyperGraph.GraphStageLayer);3608 getContainerId(node: GraphNode): string;3609 renderToDom(node: GraphNode, svgContainer: d3.Selection<any>): d3.Selection<any>;3610 private allBadgesEmphasisOnly(badges);3611 private getBadgeWidths(badges, badgeIconWidth);3612 private getDigitCount(num);3613 }3614}3615/// <reference types="d3" />3616declare module DependencyMap {3617 /**3618 * This is a base class for all collapsed circular nodes.3619 * All circular nodes moseHover behavious should be same.3620 */3621 class AdmBaseNodeCircularRenderer extends AdmBaseNodeRenderer {3622 handleMouseOver(node: GraphNode, d3NodeContainerGroup: d3.Selection<any>): void;3623 handleMouseLeave(node: GraphNode, d3NodeContainerGroup: d3.Selection<any>, event: MouseEvent): void;3624 }3625}3626/// <reference types="d3" />3627declare module DependencyMap {3628 class AdmClientAndServerGroupCircularRendererV3 extends AdmPageableNodeCircularBaseRenderer {3629 roleIconRenderer: AdmRoleIconRenderer;3630 actionBarRenderer: AdmActionBarRenderer;3631 badgeIconRenderer: AdmBadgeIconRenderer;3632 graphWidget: AdmGraphWidget;3633 static iconRadius: number;3634 static iconWidth: number;3635 static iconHeight: number;3636 static outerCircleRadius: number;3637 static filterHighlighterCurvStokeWidth: number;3638 static filterHighlighterLineStrokeWidth: number;3639 static filterStrokeWidth: number;3640 constructor(graphWidget: AdmGraphWidget, layer: HyperGraph.GraphStageLayer, constants: NodeRenderingConstants);3641 renderToDom(node: GraphNode, svgNodeContainer: d3.Selection<any>): d3.Selection<any>;3642 private renderHealthCircle(node, nodeSvgContainer, centerX, centerY);3643 handleMouseOver(node: GraphNode, d3NodeContainerGroup: d3.Selection<any>): void;3644 handleMouseLeave(node: GraphNode, d3NodeContainerGroup: d3.Selection<any>, event: MouseEvent): void;3645 private getLeftBorderLineId(node);3646 private getRightBorderLineId(node);3647 }3648}3649/// <reference types="d3" />3650declare module DependencyMap {3651 class AdmClientGroupCircularRenderer extends AdmBaseNodeRenderer {3652 static clientGroupIconRadius: number;3653 static clientGroupIconWidth: number;3654 static clientGroupIconHeight: number;3655 static clientGroupOuterCircleRadius: number;3656 constructor(layer: HyperGraph.GraphStageLayer, constants: NodeRenderingConstants);3657 renderToDom(node: GraphNode, svgNodeContainer: d3.Selection<any>): d3.Selection<any>;3658 handleMouseOver(node: GraphNode, d3NodeContainerGroup: d3.Selection<any>): void;3659 handleMouseLeave(node: GraphNode, d3NodeContainerGroup: d3.Selection<any>, event: MouseEvent): void;3660 }3661}3662/// <reference types="d3" />3663declare module DependencyMap {3664 class AdmEdgeCircularRenderer extends HyperGraph.DomRenderer {3665 stage: HyperGraph.GraphStageDom;3666 layoutStyles: AdmLayoutStyles;3667 graphModel: AdmGraphModel;3668 constructor(layer: HyperGraph.GraphStageLayer, layoutStyles: AdmLayoutStyles, admGraphModel: AdmGraphModel);3669 addContainerToDom(edge: GraphEdge, svgContainer: d3.Selection<any>): d3.Selection<any>;3670 renderToDom(edge: GraphEdge, edgeContainer: d3.Selection<any>): d3.Selection<any>;3671 getArrowheadTransform(edge: GraphEdge): string;3672 protected getLineDisplayClasses(edge: GraphEdge, customizeClass?: string): string;3673 protected getFillDisplayClasses(edge: GraphEdge): string;3674 private _adjustServerGroupEdge(edge);3675 private _adjustConectionFromExpandedNode(edge);3676 }3677}3678/// <reference types="d3" />3679declare module DependencyMap {3680 /**3681 * For machines that appear in Client and Server Groups. Similar to process renderer but3682 * has ellipsis menu and no role icon.3683 */3684 class AdmGroupMemberV3CircularRenderer extends AdmGroupMemberV3Renderer {3685 portRenderer: AdmNodePortCircularRenderer;3686 admGraphWidget: AdmGraphWidget;3687 contextMenuXOffset: number;3688 contextMenuYOffset: number;3689 constructor(graphWidget: AdmGraphWidget, layer: HyperGraph.GraphStageLayer, constants: NodeRenderingConstants);3690 renderToDom(node: GraphNode, svgNodeContainer: d3.Selection<any>): d3.Selection<any>;3691 handleMouseOver(node: GraphNode, d3NodeContainerGroup: d3.Selection<any>): void;3692 handleMouseLeave(node: GraphNode, d3NodeContainerGroup: d3.Selection<any>, event: MouseEvent): void;3693 private getBgRectId(node);3694 private getContextIconId(node);3695 }3696}3697/// <reference types="d3" />3698declare module DependencyMap {3699 class AdmMachineNodeCircularRenderer extends AdmBaseNodeRenderer {3700 badgeIconRenderer: AdmBadgeIconCircularRenderer;3701 graphWidget: AdmGraphWidget;3702 static osLogoRadius: number;3703 static osIconWidth: number;3704 static osIconHeight: number;3705 static haloCircleRadiusAdjustmentSelected: number;3706 static haloCircleRadiusAdjustmentUnSelected: number;3707 constructor(graphWidget: AdmGraphWidget, layer: HyperGraph.GraphStageLayer, constants: NodeRenderingConstants);3708 /**3709 * @param svgContainer layer container for all nodes3710 * Returns the node group container for updates3711 */3712 renderToDom(node: GraphNode, svgNodeContainer: d3.Selection<any>): d3.Selection<any>;3713 handleMouseOver(node: GraphNode, d3NodeContainerGroup: d3.Selection<any>): void;3714 handleMouseLeave(node: GraphNode, d3NodeContainerGroup: d3.Selection<any>, event: MouseEvent): void;3715 private getLeftBorderLineId(node);3716 private getRightBorderLineId(node);3717 private getContextIconId(node);3718 }3719}3720/// <reference types="d3" />3721declare module DependencyMap {3722 class AdmNodePortCircularRenderer implements HyperGraph.GraphEntityRenderer {3723 layer: HyperGraph.GraphStageLayer;3724 constructor(layer: HyperGraph.GraphStageLayer);3725 renderToDom(port: HyperGraph.GraphNodePort, svgContainer: d3.Selection<any>, visible?: boolean): d3.Selection<any>;3726 }3727}3728/// <reference types="d3" />3729declare module DependencyMap {3730 interface HealthFilterHighighterDimensions {3731 innerHighlighterStartX: number;3732 innerHighlighterStartY: number;3733 innerHighlighterEndX: number;3734 innerHighlighterEndY: number;3735 innerHighlighterRadius: number;3736 outerHighlighterStartX: number;3737 outerHighlighterStartY: number;3738 outerHighlighterEndX: number;3739 outerHighlighterEndY: number;3740 outerHighlighterRadius: number;3741 }3742 class AdmPageableNodeCircularBaseRenderer extends AdmBaseNodeRenderer {3743 constructor(layer: HyperGraph.GraphStageLayer, constants: NodeRenderingConstants);3744 protected addNextAndPrevButtons(node: GraphNode, nodeViewModel: PageableGroupNodeViewModel, nodeGroup: d3.Selection<any>): void;3745 protected renderHealthStatusFullCircle(node: GraphNode, nodeSvgContainer: d3.Selection<any>, healthState: GroupMemberHealthState, centerX: number, centerY: number): void;3746 protected renderCircleSectionFromHealthState(node: GraphNode, nodeSvgContainer: d3.Selection<any>, healthState: GroupMemberHealthState, angle: number, x1: number, y1: number, x2: number, y2: number): void;3747 protected renderCircleSectionHighlighter(node: GraphNode, nodeSvgContainer: d3.Selection<any>, healthState: GroupMemberHealthState, angle: number, filterHighlighterDimensions: HealthFilterHighighterDimensions): void;3748 private getDomIdForHealthState(node, healthState);3749 protected getColorForHealthState(healthState: GroupMemberHealthState): string;3750 }3751}3752/// <reference types="d3" />3753declare module DependencyMap {3754 class AdmPlaceholderNodeCircularRenderer extends AdmBaseNodeCircularRenderer {3755 static placeholderNodeIconRadius: number;3756 static placeholderNodeIconWidth: number;3757 static placeholderNodeIconHeight: number;3758 static placeholderNodeOuterCircleRadius: number;3759 constructor(layer: HyperGraph.GraphStageLayer, constants: NodeRenderingConstants);3760 /**3761 * @param svgContainer layer container for all nodes3762 * Returns the node group container for updates3763 */3764 renderToDom(node: GraphNode, svgNodeContainer: d3.Selection<any>): d3.Selection<any>;3765 }3766}3767/// <reference types="d3" />3768declare module DependencyMap {3769 class AdmProcessGroupNodeCircularRenderer extends AdmProcessGroupNodeRenderer {3770 portRenderer: AdmNodePortRenderer;3771 constructor(layer: HyperGraph.GraphStageLayer, constants: NodeRenderingConstants);3772 renderToDom(node: GraphNode, svgNodeContainer: d3.Selection<any>): d3.Selection<any>;3773 handleMouseOver(node: GraphNode, d3NodeContainerGroup: d3.Selection<any>): void;3774 handleMouseLeave(node: GraphNode, d3NodeContainerGroup: d3.Selection<any>, event: MouseEvent): void;3775 private getHeaderRectId(node);3776 }3777}3778/// <reference types="d3" />3779declare module DependencyMap {3780 class AdmProcessNodeCircularRenderer extends AdmProcessNodeRenderer {3781 portRenderer: AdmNodePortRenderer;3782 static xCoordinate: number;3783 constructor(layer: HyperGraph.GraphStageLayer, constants: NodeRenderingConstants);3784 renderToDom(node: GraphNode, svgNodeContainer: d3.Selection<any>): d3.Selection<any>;3785 handleMouseOver(node: GraphNode, d3NodeContainerGroup: d3.Selection<any>): void;3786 handleMouseLeave(node: GraphNode, d3NodeContainerGroup: d3.Selection<any>, event: MouseEvent): void;3787 private getBgRectId(node);3788 }3789}3790/// <reference types="d3" />3791declare module DependencyMap {3792 class AdmServerGroupCircularRenderer extends AdmBaseNodeCircularRenderer {3793 roleIconRenderer: AdmRoleIconRenderer;3794 actionBarRenderer: AdmActionBarRenderer;3795 badgeIconRenderer: AdmBadgeIconRenderer;3796 static serverGroupIconRadius: number;3797 static serverGroupIconWidth: number;3798 static serverGroupIconHeight: number;3799 static serverGroupOuterCircleRadius: number;3800 constructor(layer: HyperGraph.GraphStageLayer, constants: NodeRenderingConstants);3801 renderToDom(node: GraphNode, svgNodeContainer: d3.Selection<any>): d3.Selection<any>;3802 private getLeftBorderLineId(node);3803 private getRightBorderLineId(node);3804 }3805}3806/// <reference types="d3" />3807declare module DependencyMap {3808 /**3809 * For machines that appear in Server Groups. Similar to process renderer but3810 * has ellipsis menu and no role icon.3811 */3812 class AdmServerGroupedMachineCircularRenderer extends AdmBaseNodeRenderer {3813 portRenderer: AdmNodePortRenderer;3814 constructor(layer: HyperGraph.GraphStageLayer, constants: NodeRenderingConstants);3815 renderToDom(node: GraphNode, svgNodeContainer: d3.Selection<any>): d3.Selection<any>;3816 }3817}3818/// <reference types="d3" />3819declare module DependencyMap {3820 class AdmUnconnectedProcessGroupNodeCircularRenderer extends AdmBaseNodeRenderer {3821 roleIconRenderer: AdmRoleIconRenderer;3822 static xCoordinate: number;3823 constructor(layer: HyperGraph.GraphStageLayer, constants: NodeRenderingConstants);3824 renderToDom(node: GraphNode, svgNodeContainer: d3.Selection<any>): d3.Selection<any>;3825 }3826}3827/// <reference types="d3" />3828declare module DependencyMap {3829 class AdmVirtualGroupNodeCircularRenderer extends AdmPageableNodeCircularBaseRenderer {3830 graphWidget: AdmGraphWidget;3831 static virtualGroupNodeIconRadius: number;3832 static virtualGroupNodeIconWidth: number;3833 static virtualGroupNodeIconHeight: number;3834 static virtualGroupNodeOuterCircleRadius: number;3835 constructor(graphWidget: AdmGraphWidget, layer: HyperGraph.GraphStageLayer, constants: NodeRenderingConstants);3836 /**3837 * @param svgContainer layer container for all nodes3838 * Returns the node group container for updates3839 */3840 renderToDom(node: GraphNode, svgNodeContainer: d3.Selection<any>): d3.Selection<any>;3841 handleMouseOver(node: GraphNode, d3NodeContainerGroup: d3.Selection<any>): void;3842 handleMouseLeave(node: GraphNode, d3NodeContainerGroup: d3.Selection<any>, event: MouseEvent): void;3843 private getLeftBorderLineId(node);3844 private getRightBorderLineId(node);3845 private getContextIconId(node);3846 private renderHealthCircle(node, nodeSvgContainer, centerX, centerY);3847 }3848}3849/// <reference types="d3" />3850declare module DependencyMap {3851 class AdmActionBarRenderer extends HyperGraph.DomRenderer {3852 height: number;3853 constants: NodeRenderingConstants;3854 constructor(layer: HyperGraph.GraphStageLayer, constants: NodeRenderingConstants);3855 getContainerId(node: GraphNode): string;3856 /**3857 * There are two rendering patterns:3858 * 1. svgContainer holds multiple elements, like nodes and edges3859 * 2. svgContainer holds a single element, like a node's action bar3860 *3861 * Right now it's up the renderer to manage this properly.3862 *3863 * @param node3864 * @param svgContainer3865 */3866 renderToDom(node: GraphNode, svgContainer: d3.Selection<any>, expandHeight?: boolean): d3.Selection<any>;3867 expandActionBar(node: GraphNode, d3NodeContainerGroup: d3.Selection<any>, expandedHeight: boolean): void;3868 }3869}3870/// <reference types="d3" />3871declare module DependencyMap {3872 class AdmBadgeIconRenderer extends HyperGraph.DomRenderer {3873 static badgeIconIds: {3874 alerts_blue: string;3875 alerts_yellow: string;3876 alerts_red: string;3877 change_tracking_blue: string;3878 security_blue: string;3879 security_yellow: string;3880 security_red: string;3881 "service-desk-blue": string;3882 "service-desk-yellow": string;3883 "service-desk-red": string;3884 updates_blue: string;3885 updates_yellow: string;3886 updates_red: string;3887 vmHealth: string;3888 };3889 static badgeIconPaths: {3890 alerts_blue: string;3891 alerts_yellow: string;3892 alerts_red: string;3893 change_tracking_blue: string;3894 security_blue: string;3895 security_yellow: string;3896 security_red: string;3897 "service-desk-blue": string;3898 "service-desk-yellow": string;3899 "service-desk-red": string;3900 updates_blue: string;3901 updates_yellow: string;3902 updates_red: string;3903 vmHealth: string;3904 };3905 constructor(layer: HyperGraph.GraphStageLayer);3906 getContainerId(node: GraphNode): string;3907 renderToDom(node: GraphNode, svgContainer: d3.Selection<any>): d3.Selection<any>;3908 }3909}3910/// <reference types="d3" />3911declare module DependencyMap {3912 /**3913 * Base node renderer class. One renderer instance is shared by all nodes.3914 */3915 class AdmBaseNodeRenderer extends HyperGraph.DomRenderer {3916 constants: NodeRenderingConstants;3917 constructor(layer: HyperGraph.GraphStageLayer, constants: NodeRenderingConstants);3918 protected observeEntityProperties(): void;3919 addContainerToDom(node: GraphNode, svgContainer: d3.Selection<any>): d3.Selection<any>;3920 addChildContainerToDom(node: GraphNode, childDomId: string, svgContainer: d3.Selection<any>): d3.Selection<any>;3921 expandNodeHeight(node: GraphNode, d3NodeContainerGroup: d3.Selection<any>, expandHeight: boolean): void;3922 getAdjustedNodeY(node: GraphNode, expandHeight: boolean): number;3923 getAdjustedNodeHeight(node: GraphNode, expandHeight: boolean): number;3924 protected renderSelectionRectangle(node: GraphNode): void;3925 protected getHaloCircleId(node: GraphNode): string;3926 protected generateTriangleBasedOnTheme(isExpand: boolean): string;3927 protected isDarkMode(): boolean;3928 }3929}3930/// <reference types="d3" />3931declare module DependencyMap {3932 class AdmClientAndServerGroupRendererV3 extends AdmBaseNodeRenderer {3933 roleIconRenderer: AdmRoleIconRenderer;3934 actionBarRenderer: AdmActionBarRenderer;3935 portRenderer: AdmNodePortRenderer;3936 badgeIconRenderer: AdmBadgeIconRenderer;3937 constructor(layer: HyperGraph.GraphStageLayer, constants: NodeRenderingConstants);3938 renderToDom(node: GraphNode, svgNodeContainer: d3.Selection<any>): d3.Selection<any>;3939 getAdjustedNodeHeight(node: GraphNode, expandHeight: boolean): number;3940 private renderHealthBarFilter(node, nodeSvgContainer);3941 }3942}3943/// <reference types="d3" />3944declare module DependencyMap {3945 class AdmClientGroupRenderer extends AdmBaseNodeRenderer {3946 portRenderer: AdmNodePortRenderer;3947 constructor(layer: HyperGraph.GraphStageLayer, constants: NodeRenderingConstants);3948 renderToDom(node: GraphNode, svgNodeContainer: d3.Selection<any>): d3.Selection<any>;3949 }3950}3951declare module DependencyMap {3952 class AdmContextMenuRenderer implements HyperGraph.GraphContextMenuRenderer {3953 localeStrings: any;3954 constructor(localeStrings?: any);3955 getContextMenuTemplate(event: Event, entities: any[]): string;3956 private getLoadServerMapMenuItem(node);3957 private getSelfLinksMenuItem(node);3958 private getViewDetailedMapMenuItem(node);3959 private getExpandOrCollapseNodeMenuItem(node);3960 }3961}3962/// <reference types="d3" />3963declare module DependencyMap {3964 class AdmEdgeRenderer extends HyperGraph.DomRenderer {3965 stage: HyperGraph.GraphStageDom;3966 /** Currently choosen graph style skin. Set by looking at parent widget ViewModel. */3967 constructor(layer: HyperGraph.GraphStageLayer);3968 addContainerToDom(edge: GraphEdge, svgContainer: d3.Selection<any>): d3.Selection<any>;3969 renderToDom(edge: GraphEdge, edgeContainer: d3.Selection<any>): d3.Selection<any>;3970 getArrowheadTransform(edge: GraphEdge): string;3971 protected getLineDisplayClasses(edge: GraphEdge): string;3972 protected getFillDisplayClasses(edge: GraphEdge): string;3973 }3974}3975/// <reference types="d3" />3976declare module DependencyMap {3977 /**3978 * For machines that appear in Client and Server Groups. Similar to process renderer but3979 * has ellipsis menu and no role icon.3980 */3981 class AdmGroupMemberV3Renderer extends AdmBaseNodeRenderer {3982 portRenderer: AdmNodePortRenderer;3983 constructor(layer: HyperGraph.GraphStageLayer, constants: NodeRenderingConstants);3984 renderToDom(node: GraphNode, svgNodeContainer: d3.Selection<any>): d3.Selection<any>;3985 }3986}3987/// <reference types="d3" />3988declare module DependencyMap {3989 class AdmMachineNodeRenderer extends AdmBaseNodeRenderer {3990 actionBarRenderer: AdmActionBarRenderer;3991 roleIconRenderer: AdmRoleIconRenderer;3992 badgeIconRenderer: AdmBadgeIconRenderer;3993 portRenderer: AdmNodePortRenderer;3994 constructor(layer: HyperGraph.GraphStageLayer, constants: NodeRenderingConstants);3995 /**3996 * @param svgContainer layer container for all nodes3997 * Returns the node group container for updates3998 */3999 renderToDom(node: GraphNode, svgNodeContainer: d3.Selection<any>): d3.Selection<any>;4000 expandNodeHeight(node: GraphNode, d3NodeContainerGroup: d3.Selection<any>, expandHeight: boolean): void;4001 getAdjustedNodeHeight(node: GraphNode, expandHeight: boolean): number;4002 }4003}4004/// <reference types="d3" />4005declare module DependencyMap {4006 class AdmNodePortRenderer implements HyperGraph.GraphEntityRenderer {4007 layer: HyperGraph.GraphStageLayer;4008 constructor(layer: HyperGraph.GraphStageLayer);4009 renderToDom(port: HyperGraph.GraphNodePort, svgContainer: d3.Selection<any>, visible?: boolean): d3.Selection<any>;4010 }4011}4012/// <reference types="d3" />4013declare module DependencyMap {4014 class AdmProcessGroupNodeRenderer extends AdmBaseNodeRenderer {4015 roleIconRenderer: AdmRoleIconRenderer;4016 portRenderer: AdmNodePortRenderer;4017 constructor(layer: HyperGraph.GraphStageLayer, constants: NodeRenderingConstants);4018 renderToDom(node: GraphNode, svgNodeContainer: d3.Selection<any>): d3.Selection<any>;4019 }4020}4021/// <reference types="d3" />4022declare module DependencyMap {4023 class AdmProcessNodeRenderer extends AdmBaseNodeRenderer {4024 roleIconRenderer: AdmRoleIconRenderer;4025 portRenderer: AdmNodePortRenderer;4026 constructor(layer: HyperGraph.GraphStageLayer, constants: NodeRenderingConstants);4027 renderToDom(node: GraphNode, svgNodeContainer: d3.Selection<any>): d3.Selection<any>;4028 }4029}4030/// <reference types="d3" />4031declare module DependencyMap {4032 class AdmRoleIconRenderer implements HyperGraph.GraphEntityRenderer {4033 private static roleIcons;4034 constructor();4035 renderToDom(node: GraphNode, svgContainer: d3.Selection<any>, yOffset?: number): d3.Selection<any>;4036 }4037}4038/// <reference types="d3" />4039declare module DependencyMap {4040 class AdmServerGroupRenderer extends AdmBaseNodeRenderer {4041 roleIconRenderer: AdmRoleIconRenderer;4042 actionBarRenderer: AdmActionBarRenderer;4043 portRenderer: AdmNodePortRenderer;4044 badgeIconRenderer: AdmBadgeIconRenderer;4045 constructor(layer: HyperGraph.GraphStageLayer, constants: NodeRenderingConstants);4046 renderToDom(node: GraphNode, svgNodeContainer: d3.Selection<any>): d3.Selection<any>;4047 }4048}4049/// <reference types="d3" />4050declare module DependencyMap {4051 /**4052 * For machines that appear in Server Groups. Similar to process renderer but4053 * has ellipsis menu and no role icon.4054 */4055 class AdmServerGroupedMachineRenderer extends AdmBaseNodeRenderer {4056 portRenderer: AdmNodePortRenderer;4057 constructor(layer: HyperGraph.GraphStageLayer, constants: NodeRenderingConstants);4058 renderToDom(node: GraphNode, svgNodeContainer: d3.Selection<any>): d3.Selection<any>;4059 }4060}4061/// <reference types="d3" />4062declare module DependencyMap {4063 class AdmUnconnectedProcessGroupNodeRenderer extends AdmBaseNodeRenderer {4064 roleIconRenderer: AdmRoleIconRenderer;4065 portRenderer: AdmNodePortRenderer;4066 constructor(layer: HyperGraph.GraphStageLayer, constants: NodeRenderingConstants);4067 renderToDom(node: GraphNode, svgNodeContainer: d3.Selection<any>): d3.Selection<any>;4068 }4069}4070/// <reference types="d3" />4071declare module DependencyMap {4072 class AdmUnknownNodeRenderer extends AdmBaseNodeRenderer {4073 constructor(layer: HyperGraph.GraphStageLayer);4074 renderToDom(node: GraphNode, nodeGroup: d3.Selection<any>): d3.Selection<any>;4075 }4076}4077/// <reference types="knockout" />4078declare module AdmWrapper {4079 class PopupEventManager {4080 private closeHandlers;4081 private events;4082 private transferEvent;4083 addCloseHandler(element: JQuery, callback: KnockoutObservable<boolean> | {4084 (): void;4085 }): void;4086 clear(): void;4087 removeCloseHandler(): void;4088 dispose(): void;4089 }4090}4091declare module DependencyMap.ProgressIndicators {4092 class Bar {4093 private containerElement;4094 private markCount;4095 private markInterval;4096 private markAnimationLength;4097 Start(): void;4098 Stop(): void;4099 constructor(container: any, markCount?: number, markInterval?: number, markAnimationLength?: number);4100 }4101}4102/// <reference types="knockout" />4103declare module DependencyMap {4104 interface SummaryInfo {4105 clientCount: string;4106 serverCount: string;4107 inboundConnections: string;4108 outboundConnections: string;4109 failedConnections: string;4110 }4111 interface ConnectionInfo {4112 clients?: string[];4113 servers?: string[];4114 ports?: string[];4115 ipAddress?: string[];4116 displayName?: string[];4117 failureState?: string;4118 aggCount?: number;4119 }4120 class AdmPropertiesPanel {4121 NAME: string;4122 Strings: any;4123 selectionContext: KnockoutObservable<SelectionContext>;4124 panelCollapsed: KnockoutObservable<boolean>;4125 entityIconClass: KnockoutObservable<string>;4126 leftAlign: KnockoutObservable<string>;4127 vmTypeFormatted: KnockoutObservable<string>;4128 summaryInfo: KnockoutObservable<SummaryInfo>;4129 connectionInfo: KnockoutObservable<ConnectionInfo>;4130 entityTypeDisplayNames: DependencyMap.Integrations.IEntityTypeDisplayNameMap;4131 mapModel: DependencyMap.IMap;4132 constructor($element: JQuery, options?: DependencyMapDashBoardOptions);4133 private togglePanel();4134 private ProcessSelectEntity(entity);4135 private getMachineSummaryData(machine);4136 private getProcessSummaryData(process);4137 private getProcessGroupSummaryData(processGroup);4138 private getClientGroupInboundNumber(mapNode);4139 private getEntityIconClass(entity);4140 private processEntity(entity);4141 private convertFailState(state);4142 private getVmTypeFormatted(vmType);4143 }4144}4145declare module DependencyMap {4146 class AdmPropertiesPanelTemplate {4147 static template: string;4148 }4149}4150/// <reference types="knockout" />4151interface HTMLElement {4152 dateTimeSelector(method: string, property?: string, value?: any): any;4153 fxRadio(method: string, property?: string, value?: any): any;4154}4155interface JQuery {4156 dateTimeSelector(method: string, property?: string, value?: any): any;4157 dateTimeSelector(options: any): any;4158 fxRadio(options: any): any;4159}4160interface KnockoutBindingHandlers {4161 dateTimeSelector: KnockoutBindingHandler;4162}4163interface Refresh {4164 type: any;4165}4166interface KnockoutExtenders {4167 date(target: KnockoutObservable<Date>): any;4168 dateValidation(target: KnockoutObservable<string>, formats: string[]): any;4169 defaultValue(target: KnockoutObservable<any>, value: any): any;4170 formattedDuration(target: KnockoutObservable<number>, editable: boolean): any;4171 regexValidation(target: KnockoutObservable<string>, regex: RegExp): any;4172 timeInterval(target: KnockoutObservable<DependencyMap.TimeInterval>): any;4173}4174interface FormattedDurationDisplay {4175 duration: number;4176 unit: string;4177}4178declare module DependencyMap {4179 interface TimeInterval {4180 _duration: number;4181 _end: Date;4182 _Now: Date;4183 _compareOffset?: number;4184 _isAutoRefresh?: boolean;4185 }4186 class TimeIntervalSelectorV3 {4187 cleanup: KnockoutObservable<any>;4188 refresh: KnockoutObservable<Refresh>;4189 timeIntervalIn: KnockoutObservable<TimeInterval>;4190 timeIntervalOut: KnockoutObservable<TimeInterval>;4191 allowFutureDates: KnockoutObservable<boolean>;4192 durationLimit: KnockoutObservable<number>;4193 minimumDuration: KnockoutObservable<number>;4194 relativeDurations: KnockoutObservableArray<number>;4195 customMode: KnockoutObservable<TimeIntervalSelector_CustomMode>;4196 displayDialog: KnockoutObservable<boolean>;4197 duration: KnockoutComputed<number>;4198 endDate: KnockoutObservable<Date>;4199 selectedUnit: KnockoutObservable<TimeIntervalSelector_Unit>;4200 startDate: KnockoutObservable<Date>;4201 units: KnockoutObservableArray<TimeIntervalSelector_Unit>;4202 isRelative: KnockoutObservable<boolean>;4203 readonly OneMinuteInMs: number;4204 readonly ThirtyMinutesInMs: number;4205 readonly OneHourInMs: number;4206 readonly SixHoursInMs: number;4207 readonly OneDayInMs: number;4208 readonly SevenDaysInMs: number;4209 readonly ThirtyDaysInMs: number;4210 private linkedDuration;4211 private popupManager;4212 private Strings;4213 constructor($element: JQuery, options?: any);4214 apply(isRelative?: boolean): void;4215 toggleCustom(): void;4216 applyRelativeDuration: (duration: number) => void;4217 isValidInterval(): boolean;4218 toggleDialog(): void;4219 private calcFormattedDuration(durationMS);4220 private configureExtenders();4221 private initializeWidgets(element);4222 }4223 enum TimeIntervalSelector_CustomMode {4224 Duration = 1,4225 End = 2,4226 }4227 class TimeIntervalSelector_Unit {4228 factor: number;4229 name: string;4230 constructor(name: string, factor: number);4231 }4232}4233declare module DependencyMap {4234 class TimeIntervalSelectorResources {4235 static resources: {4236 "1MillisecondDurationWarning": string;4237 "60MinutesDurationWarning": string;4238 "ApplyButton": string;4239 "CustomMode": string;4240 "CustomTimeRange": string;4241 "Day": string;4242 "Days": string;4243 "DurationLabel": string;4244 "EndLabel": string;4245 "FutureDateWarning": string;4246 "Hour": string;4247 "Hours": string;4248 "Last10080MinutesOption": string;4249 "Last10MinutesOption": string;4250 "Last1440MinutesOption": string;4251 "Last20MinutesOption": string;4252 "Last30MinutesOption": string;4253 "Last360MinutesOption": string;4254 "Last43200MinutesOption": string;4255 "Last60MinutesOption": string;4256 "Minute": string;4257 "Minutes": string;4258 "RelativeMode": string;4259 "StartDurationMode": string;4260 "StartEndMode": string;4261 "StartLabel": string;4262 "TimeFilter": string;4263 "TimeValueLabel": string;4264 "To": string;4265 "Today": string;4266 };4267 static getResources(): {4268 "1MillisecondDurationWarning": string;4269 "60MinutesDurationWarning": string;4270 "ApplyButton": string;4271 "CustomMode": string;4272 "CustomTimeRange": string;4273 "Day": string;4274 "Days": string;4275 "DurationLabel": string;4276 "EndLabel": string;4277 "FutureDateWarning": string;4278 "Hour": string;4279 "Hours": string;4280 "Last10080MinutesOption": string;4281 "Last10MinutesOption": string;4282 "Last1440MinutesOption": string;4283 "Last20MinutesOption": string;4284 "Last30MinutesOption": string;4285 "Last360MinutesOption": string;4286 "Last43200MinutesOption": string;4287 "Last60MinutesOption": string;4288 "Minute": string;4289 "Minutes": string;4290 "RelativeMode": string;4291 "StartDurationMode": string;4292 "StartEndMode": string;4293 "StartLabel": string;4294 "TimeFilter": string;4295 "TimeValueLabel": string;4296 "To": string;4297 "Today": string;4298 };4299 }4300}4301declare module DependencyMap {4302 class TimeIntervalSelectorTemplate {4303 static template: string;4304 }4305}4306/// <reference types="knockout" />4307declare module DependencyMap {4308 class AdmToolbar {4309 TIME_INTERVAL_DURATION_LIMIT: number;4310 afterBound: Function;4311 selectedEntity: DependencyMap.IArmEntity;4312 loadState: KnockoutObservable<LoadState>;4313 mapContext: KnockoutObservable<MapContext>;4314 allowFutureDates: KnockoutObservable<boolean>;4315 durationLimit: KnockoutObservable<number>;4316 minimumDuration: KnockoutObservable<number>;4317 relativeDurations: KnockoutObservableArray<number>;4318 timeInterval: KnockoutObservable<TimeInterval>;4319 timeControls: TimeIntervalSelectorV3;4320 private Strings;4321 private popupManager;4322 private defaultTimeRequestPending;4323 constructor($element: JQuery, options?: any);4324 private applyDefaultTimeInterval();4325 private configurePopupManager(observable, element);4326 }4327}4328declare module DependencyMap {4329 class AdmToolbarResources {4330 static resources: {4331 "TimeControlHeader": string;4332 };4333 static getResources(): {4334 "TimeControlHeader": string;4335 };4336 }4337}4338declare module DependencyMap {4339 class AdmToolbarTemplate {4340 static template: string;4341 }4342}4343declare module DependencyMap {4344 class AdmAlertsManager {4345 static readonly NAME: string;4346 addNodeBadges: (badges: Integrations.MapBadge[]) => void;4347 constructor();4348 static addAlertBadges(data: DependencyMap.Kusto.IKustoQueryResponse, machineNameIdMap?: StringMap<string>): void;4349 static generateQuery(localStartTime: Date, localEndTime: Date): string;4350 static generateQueryInSearchBlade(alertRuleInstanceId: string): string;4351 static convertKustoResultToAlerts(data: DependencyMap.Kusto.IKustoQueryResponse): {4352 [id: string]: Integrations.IAlert[];4353 };4354 private static formatDate;4355 private static convertToBadge(machineAlertsMap, machineNameIdMap?);4356 private static getSeverityLevel(alert);4357 }4358}4359declare module DependencyMap {4360 enum OverallHealth {4361 CRITICAL = 5,4362 WARNING = 4,4363 HEALTHY = 3,4364 UNKNOWN = 1,4365 LOADING = 0,4366 }4367 /**4368 * Utility methods for displaying VM health information on the map4369 */4370 class AdmHealthManager {4371 static readonly NAME: string;4372 constructor();4373 /**4374 * Add health emphasis on machine that matches the ARM ID4375 *4376 * @param health Overall health state4377 * @param resourceId4378 */4379 static addHealthEmphasis(health: any, resourceId: string): void;4380 private static addNodeBadges(badges);4381 private static getMachineNode(resourceId);4382 private static getHealthEmphasis(health);4383 }4384}4385declare module DependencyMap {4386 class AdmLogEventsManager {4387 static NAME: string;4388 static convertKustoResponseToLogEvents(data: any): Integrations.ILogEvents[];4389 static generateQuery(machineName: string, localStartTime: Date, localEndTime: Date): string;4390 static generateQueryInSearchBlade(logEvent: Integrations.ILogEvents, computerName: string): string;4391 }4392}4393/**4394 * Tracer which traces all basic logs into console.4395 */4396declare module DependencyMap {4397 interface GlobalContext {4398 workspace: string;4399 compute_id?: string;4400 computer_group_id?: string;4401 }4402 /**4403 * Any application which uses this map library will pass telemetry provider that implements the ITelemetry interface.4404 */4405 interface ITelemetry {4406 trackException: (exception: object | string, source: string, properties: StringMap<any>) => void;4407 trackEvent: (eventName: string, properties: StringMap<any>) => void;4408 trackDependency: (id: string, method: string, absoluteUrl: string, pathName: string, totalTime: number, success: boolean, resultCode: number) => void;4409 notifyClient: (title: string, message: string, level: NotificationStatus) => void;4410 }4411 /**4412 * From MsPortalFx.Hubs.Notifications.NotificationStatus4413 */4414 enum NotificationStatus {4415 Information = 0,4416 Warning = 1,4417 Error = 2,4418 InProgress = 3,4419 Success = 4,4420 }4421 /**4422 * Below operations are used as keys to track sequence of steps triggered as part of a single user operation.4423 * An operation can consist of one or more actions.4424 * For example, "generateMap" operation contains "processData", "layoutComputation" and "rendering" actions.4425 */4426 class TelemetryOperations {4427 /**4428 GenerateMap operation tracks the processing of raw json, graph creation, layout computation and rendering4429 */4430 static readonly GenerateMap: string;4431 /**4432 GetCoarseMap tracks the API operation to get the coarse map details.4433 */4434 static readonly GetCoarseMap: string;4435 /**4436 GetMachineDetails tracks API operation to get process level details of a machine.4437 */4438 static readonly GetMachineDetails: string;4439 /**4440 GetClientGroupMembers tracks API operation to get clientgroup members of a clientgroup.4441 */4442 static readonly GetClientGroupMembers: string;4443 /**4444 GetServerGroupMembers tracks API operation to get servergroup members of a servergroup.4445 */4446 static readonly GetServerGroupMembers: string;4447 /**4448 * LoadServerMap tracks user operation whenever user wants to load specific clientgroup member or4449 * or server group member's map.4450 */4451 static readonly LoadServerMap: string;4452 /**4453 * ToggleSelfLinks tracks user operation whenver user wants to see self links of a specific machine.4454 */4455 static readonly ToggleSelfLinks: string;4456 /**4457 * OpenLegend tracks user operation whenver user Open Legend.4458 */4459 static readonly OpenLegend: string;4460 /**4461 * CloseLegend tracks user operation whenver user close Legend.4462 */4463 static readonly CloseLegend: string;4464 /**4465 * ContextMenu tracks user operation whenver user click ContextMenu.4466 */4467 static readonly ContextMenu: string;4468 /**4469 * Tracks user operation whenver user Toggle Process Filter.4470 */4471 static readonly ToggleProcessFilter: string;4472 /**4473 * ExpandAllNodes operation tracks user operation whenever user clicks "ExpandAll" button.4474 */4475 static readonly ExpandAllNodes: string;4476 /**4477 * NavigateToHelpPage operation tracks user operation whenever user clicks Help icon on the control bar.4478 */4479 static readonly NavigateToHelpPage: string;4480 /**4481 * CollapseAllNodes operation tracks user operation whenever user clicks "CollapseAll" button.4482 */4483 static readonly CollapseAllNodes: string;4484 /**4485 * Alerts operation tracks actions associated to alerts management like alerts query generation, API call to get alerts, processing them, ...etc.4486 */4487 static readonly Alerts: string;4488 /**4489 * LogEvents operation tracks actions associated to logevents management like logevents query generation, API call to get logevents, processing them, ...etc.4490 */4491 static readonly LogEvents: string;4492 /**4493 * This operation tracks when user clicks the Expand-Group context menu item of Group node.4494 */4495 static readonly ViewDetailedGroupMap: string;4496 }4497 /**4498 * Below UserActions are used as keys to track duration of each user action.4499 * It includes getting data from API, processing in client and rendering the map.4500 * These values give true responsive time that user is experiencing for each and every given user action.4501 */4502 class TelemetryUserActions {4503 static readonly LoadMap: string;4504 static readonly ExpandClientGroup: string;4505 static readonly ExpandServerGroup: string;4506 static readonly ExpandMachine: string;4507 }4508 class TelemetryProvider {4509 private static TRACE_CONSOLE;4510 private static events;4511 private static sequenceNumber;4512 private static userActionTelemetry;4513 static telemetry: ITelemetry;4514 static globalContext: GlobalContext;4515 static appInsights: any;4516 /**4517 * Logs Informative messages like number of nodes, number of connections... etc.4518 * @param message: Debug message4519 * @param source: source component name4520 * @param action: Action being performed in the source component4521 * @param properties: Custom properties4522 * @param parentId4523 */4524 static info(message: string, source: string, action: string, properties?: any, parentId?: string): void;4525 static warn(message: string, source: string, action: string, properties?: any, parentId?: string): void;4526 /**4527 * Logs any errors or exceptions4528 * @param error: Error object4529 * @param source: Source component which triggered the error4530 * @param action: Action name in which the error occured4531 * @param operation: Name of the operation that user is performing. Like expanding a clientgroup4532 * @param properties4533 */4534 static error(error: object | string, source: string, action: string, operation?: string, properties?: object): void;4535 static startTracking(operation: string, source: string, level?: TraceLevel): string;4536 static stopTracking(operation: string, properties?: Object, traceLevel?: TraceLevel): void;4537 static isTracking(operation: any): boolean;4538 static discardTracking(operation: any): void;4539 static trackStep(operation: string, stepName: string, message?: string): void;4540 static stopAllOperationTrackings(): void;4541 /**4542 * Start tracking the userAction for telemetry4543 * @param userAction UserAction name4544 */4545 static startTrackingUserAction(userAction: string, source: string, correlationId: string, properties?: any): void;4546 /**4547 * Tracks the intermediate steps for a given user action4548 * @param stepName4549 */4550 static trackUserAction(telemetryStep: TelemetryStep): void;4551 /**4552 * Logs the duration of the userAction into telemetry provider.4553 */4554 static stopTrackingUserAction(success: boolean, apiStatusCode?: number, error?: any): void;4555 /**4556 * Transmits client notification to the user, depends on MapProvider implementation4557 *4558 * @param title Client notification title4559 * @param message Client notification message body4560 * @param level Client notification level (e.g. Error, Information, etc.)4561 */4562 static notifyClient(title: string, message: string, level: NotificationStatus): void;4563 /**4564 * This method is used to trace logs if the operation is dependent on any external components.4565 * UX is dependent on APIs. So any user actions which involve API operations will be traced here.4566 */4567 protected static traceDependency(id: string, method: string, absoluteUrl: string, pathName: string, totalTime: number, success: boolean, resultCode: number): void;4568 protected static trace(message: string, level: TraceLevel, source: string, action: string, properties: any, parentId: string): void;4569 private static traceTelemetryEvent(message, level, source, action, properties);4570 static convertTypeToString(type: EntityType): "Machine" | "Connection" | "Process" | "Port" | "Acceptor" | "ClientGroup" | "ClientGroupMember" | "ServerGroup" | "MachineWithHints" | "MachineGroup" | "ProcessGroup" | "UnconnectedProcessGroup" | "AggregatedConnection" | "NewClientGroup" | "NewServerGroup" | "ClientOrServerGroupMember" | "Unknown";4571 /**4572 * Shim the object we are handed with toJSON incase there are no enumerable items4573 * we want all own properties to appear in the final json4574 * Error has no enumerable properties...4575 * @param data data we are shimming4576 * @returns {void}4577 */4578 private static shimCustomObject(data);4579 }4580}4581/**4582 * Factory class to create portal view models from Api responses4583 */4584declare module DependencyMap {4585 class AdmViewModelFactory {4586 static ARM_SKIP_TOKEN_PARAM: string;4587 static createFromArmEntity(entity: Api.v2.ArmResource): IArmEntity;4588 static getArmEntityId(entity: Api.v2.ArmResource): string;4589 static getArmEntityType(entity: Api.v2.ArmResource): EntityType;4590 static getArmSkipToken(nextLink: string): string;4591 static isNodeMonitored(monitoringState: any): boolean;4592 static getParameterByName(name: any, url: any): string;4593 static deepCopyAllProperties(source: any, target: any): void;4594 }4595 abstract class Entity implements IEntity {4596 id: string;4597 type: EntityType;4598 constructor(id: string, type: EntityType);4599 }4600 abstract class ArmEntity extends Entity implements IArmEntity {4601 armName: string;4602 armId: string;4603 etag: string;4604 constructor(id: string, entity: Api.v2.ArmResource, type: EntityType);4605 toApi(): Api.v2.ArmResource;4606 }4607 abstract class MapEntity extends Entity implements IMapEntity {4608 isVisible: boolean;4609 isInLayout: boolean;4610 constructor(id: string, type: EntityType);4611 }4612 abstract class MapNode extends MapEntity implements IMapNode {4613 displayName: string;4614 isMonitored: boolean;4615 isHighlighted: boolean;4616 selfLinksVisible: boolean;4617 loadServerMapEnabled: boolean;4618 inboundConnections: IConnection[];4619 outboundConnections: IConnection[];4620 inboundSelfConnections: IConnection[];4621 outboundSelfConnections: IConnection[];4622 failedConnections: IConnection[];4623 clientNodes: EntityTypeMap<{4624 [id: string]: IMapNode;4625 }>;4626 serverNodes: EntityTypeMap<{4627 [id: string]: IMapNode;4628 }>;4629 badges: Integrations.MapBadge[];4630 maxBadgeEmphasis: EmphasisType;4631 constructor(id: string, type: EntityType);4632 addConnection(connection: IConnection, isInbound: boolean, isFailed: boolean, isSelfConnection: boolean): void;4633 addConnectedNode(node: IMapNode, isClient: boolean): void;4634 }4635 abstract class MapEdge extends MapEntity implements IMapEdge {4636 constructor(id: string, type: EntityType);4637 }4638 abstract class ArmMapNode extends MapNode implements IArmEntity {4639 armName: string;4640 armId: string;4641 constructor(id: string, entity: Api.v2.ArmResource, type: EntityType);4642 toApi(): Api.v2.ArmResource;4643 }4644 abstract class ArmMapEdge extends MapEdge implements IArmEntity {4645 armName: string;4646 armId: string;4647 constructor(id: string, type: EntityType);4648 toApi(): Api.v2.ArmResource;4649 }4650 class Machine extends ArmMapNode implements IMachine {4651 computerName: string;4652 fullyQualifiedDomainName: string;4653 bootTime: string;4654 virtualizationState: string;4655 virtualMachine: VirtualMachineConfiguration;4656 hypervisor: HypervisorConfiguration;4657 networking: NetworkConfiguration;4658 agent: AgentConfiguration;4659 resources: MachineResourcesConfiguration;4660 operatingSystem: OperatingSystemConfiguration;4661 timezone: TimeZoneInfo;4662 expanded: boolean;4663 roleCounts: {4664 [role: number]: number;4665 };4666 processGroups: IProcessGroup[];4667 processes: IProcess[];4668 clientGroup: IClientGroup;4669 operatingSystemType: OperatingSystemFamilyType;4670 hosting: HostingConfiguration;4671 NAME: string;4672 private _processCount;4673 constructor(id: string, entity: Api.v2.Machine);4674 processCount: number;4675 getConnectedServerCount(): number;4676 getConnectedClientCount(): number;4677 static createFromHints(id: string, entity: Api.v2.MachineHint): Machine;4678 static osFamilyToFamilyType(family: string): OperatingSystemFamilyType;4679 static ipInterfaceToCidrNotation(ipInterface: IPv4Interface): string;4680 static cloudServiceTypeFromString(roleType: string): AzureCloudServiceRoleType;4681 updateProperties(entity: Api.v2.Machine): void;4682 addProcessGroup(processGroup: IProcessGroup): void;4683 addProcess(process: IProcess): void;4684 getAllIpAddresses(): string[];4685 getHealth(): GroupMemberHealthState;4686 }4687 class MachineStub extends ArmEntity implements IMachineStub {4688 displayName: string;4689 osFamilyType: OperatingSystemFamilyType;4690 live: boolean;4691 constructor(id: string, entity: Api.v2.MachineHint);4692 static createFromMachine(machine: IMachine): IMachineStub;4693 toApi(): Api.v2.MachineHint;4694 }4695 class MachineGroup extends ArmEntity implements IMachineGroup {4696 displayName: string;4697 groupType: MachineGroupType;4698 machines: IMachineStub[];4699 constructor(id: string, entity: Api.v2.MachineGroup);4700 toApi(): Api.v2.MachineGroup;4701 addMachines(machines: IMachine[]): void;4702 private getMachineGroupTypeFromString(groupTypeStr);4703 }4704 class ProcessGroup extends ArmMapNode implements IProcessGroup {4705 processes: IProcess[];4706 machineId: string;4707 clientGroup?: IClientGroup;4708 constructor(id: string, entity: any);4709 addProcess(process: IProcess): void;4710 }4711 class Process extends ArmMapNode implements IProcess {4712 executableName: string;4713 machineId: string;4714 startTime: string;4715 details: ProcessDetails;4716 user: ProcessUser;4717 acceptorOfId: string;4718 clientOfId: string;4719 role: EntityRoleType;4720 group: string;4721 ports: IPort[];4722 processGroupId: string;4723 processGroup: IProcessGroup;4724 clientGroup: IClientGroup;4725 constructor(id: string, entity: Api.v2.Process);4726 addPort(port: IPort): void;4727 getPortNumbers(): string[];4728 static getProcessRoleType(role: string): EntityRoleType;4729 }4730 class Port extends ArmEntity implements IPort {4731 displayName: string;4732 isMonitored: boolean;4733 machineId: string;4734 ipAddress: string;4735 portNumber: number;4736 constructor(id: string, entity: Api.v2.Port);4737 }4738 class ClientGroup extends ArmMapNode implements IClientGroup {4739 destinationId: string;4740 destination: IMapNode;4741 memberCount: number;4742 isApproximate: boolean;4743 unmonitoredMemberCount: number;4744 members: IClientGroupMember[];4745 unmonitoredMembers: IClientGroupMember[];4746 membersSkipToken: string;4747 constructor(id: string, entity: Api.v2.ClientGroup);4748 setDestinationEntity(destinationEntity: IMapNode): void;4749 updateCount(memberCount: Api.v2.ClientGroupMemberCount): void;4750 updateMembers(membersCollection: Api.v2.ClientGroupMembersCollection, mapModel: IMap): void;4751 getNodeDisplayName(labelSingular: string, labelPlural: string): string;4752 }4753 class ClientGroupMember extends ArmEntity implements IClientGroupMember {4754 ipAddress: string;4755 portId: string;4756 portNumber: number;4757 processIds: string[];4758 machine: IMachine;4759 constructor(id: string, member: Api.v2.ClientGroupMember);4760 }4761 class ServerGroup extends MapNode implements IServerGroup {4762 memberViewModels: IMachine[];4763 port: IPort;4764 role: EntityRoleType;4765 constructor(id: string, port: IPort);4766 addMember(machine: IMachine): void;4767 getNodeSubheader(labelPlural: string): string;4768 }4769 class GroupMemberConnectionEndpoint implements IGroupMemberConnectionEndpoint {4770 machineName: string;4771 processName: string;4772 process: IProcess;4773 isMonitored: boolean;4774 constructor(entity: Api.v3.GroupMemberConnectionEndpoint);4775 }4776 class GroupMemberConnectionInfo implements IGroupMemberConnectionInfo {4777 failureState: ConnectionFailureState;4778 serverPort: number;4779 source: GroupMemberConnectionEndpoint;4780 destination: GroupMemberConnectionEndpoint;4781 constructor(entity: Api.v3.GroupMemberConnectionInfo);4782 }4783 abstract class ClientOrServerGroupMemberMachine extends ArmMapNode implements IClientOrServerGroupMemberMachine {4784 displayName: string;4785 connectionFailureState: ConnectionFailureState;4786 group: GroupViewModelV3;4787 connectionInfos: GroupMemberConnectionInfo[];4788 machineId: string;4789 machine: Machine;4790 operatingSystemType: OperatingSystemFamilyType;4791 constructor(id: string, entity: Api.v3.ClientOrServerGroupMember, entityType: EntityType);4792 updateProperties(entity: Api.v3.ClientOrServerGroupMember): void;4793 getHealth(): GroupMemberHealthState;4794 }4795 /**4796 ClientGroup member type in new API contract.4797 */4798 class ClientGroupMemberMachine extends ClientOrServerGroupMemberMachine {4799 constructor(id: string, entity: Api.v3.ClientOrServerGroupMember);4800 }4801 /**4802 ServerGroup member type in new API contract.4803 */4804 class ServerGroupMemberMachine extends ClientOrServerGroupMemberMachine {4805 constructor(id: string, entity: Api.v3.ClientOrServerGroupMember);4806 }4807 abstract class PageableGroupNodeViewModel extends ArmMapNode {4808 graphNode: GraphNode;4809 filteredMemberCount: number;4810 currentPageNumber: number;4811 memberCountPerPage: number;4812 monitoredMemberSummaryCount: number;4813 discoveredMemberSummaryCount: number;4814 isDiscoveredMemberCountEstimated: boolean;4815 currentHealthStateFilter: GroupMemberHealthState;4816 protected _allMemberGraphNodes: {4817 [key: number]: GraphNode;4818 };4819 protected _filteredMemberGraphNodes: {4820 [key: number]: GraphNode;4821 };4822 constructor(id: string, entity: Api.v2.ArmResource, type: EntityType);4823 addGroupMemberGraphNode(memberGraphNode: GraphNode, index: number): void;4824 getMonitoredMemberCount(): number;4825 getDiscoveredMemberCount(): number;4826 getTotalMemberCount(): number;4827 getTotalPageCount(): number;4828 moveToNextPage(): void;4829 moveToPrevPage(): void;4830 protected markCurrentPageMembersAsVisible(): void;4831 clearFilter(): void;4832 }4833 abstract class GroupViewModelV3 extends PageableGroupNodeViewModel implements IGroupViewModelV3 {4834 monitoredMemberMachines: StringMap<Machine>;4835 allGroupMembers: IClientOrServerGroupMemberMachine[];4836 role: EntityRoleType;4837 name: string;4838 constructor(id: string, entity: Api.v2.ArmResource, type: EntityType);4839 getCriticalMemberCount(): number;4840 getWarningMemberCount(): number;4841 getFilteredMemberIds(onlyMonitoredMachines?: boolean): string[];4842 getNodeSubheader(labelPlural: string): string;4843 addMemberBadge(badge: Integrations.MapBadge): void;4844 applyFilter(healthState: GroupMemberHealthState): void;4845 getFilteredClientSummaryText(): string;4846 private _getFilteredMemberCount(healthFilter);4847 }4848 class ServerGroupViewModelV3 extends GroupViewModelV3 implements IServerGroupViewModelV3 {4849 /**4850 List of machines/processgroups/processes which have outgoing connections to this serverGroup4851 */4852 clientEntities: StringMap<IEntity>;4853 /**4854 * List of client graphNodes of this ServerGroup4855 */4856 clientGraphNodes: StringMap<GraphNode>;4857 portNumber: number;4858 constructor(id: string, serverGroup: Api.v3.ServerGroup);4859 addClient(entity: IEntity): void;4860 addClientEntityGraphNode(graphNode: GraphNode): void;4861 setGraphNodeVisibility(value: boolean): void;4862 getGraphNodeVisibility(): boolean;4863 /**4864 * Graph layout algorithm need to calculate the visibility of the serverGroup based on the4865 * the visibility of dependants of this serverGroup4866 */4867 isServerGroupVisible(): boolean;4868 }4869 class ClientGroupViewModelV3 extends GroupViewModelV3 implements IClientGroupViewModelV3 {4870 destinationId: string;4871 destination: IMapNode;4872 constructor(id: string, clientGroup: Api.v3.ClientGroup);4873 setDestinationEntity(destinationEntity: IMapNode): void;4874 }4875 class VirtualGroupNodeViewModel extends PageableGroupNodeViewModel implements IVirtualGroupNode {4876 machines: Machine[];4877 totalMachineCount: number;4878 currentHealthStateFilter: GroupMemberHealthState;4879 constructor(id: string, displayName: string, machines: Machine[]);4880 getCriticalMemberCount(): number;4881 applyFilter(healthState: GroupMemberHealthState): void;4882 }4883 class AllServerPortGroupsVirtualNodeViewModel implements IAllServerPortGroupsVirtualNodeViewModel {4884 type: EntityType;4885 id: string;4886 isInLayout: boolean;4887 isVisible: boolean;4888 allServerPortGroups: IServerGroupViewModelV3[];4889 displayName: string;4890 constructor(serverGroups: IServerGroupViewModelV3[]);4891 }4892 class AggConnection extends ArmMapEdge implements IAggConnection {4893 clients: string[];4894 servers: string[];4895 connections: IConnection[];4896 portIds?: string[];4897 displayName: string;4898 failureState: ConnectionFailureState;4899 connectionCount: number;4900 constructor(id: string, connection: Api.v2.AggConnection);4901 }4902 class ClientGroupMemberVirtualConnection extends ArmMapEdge implements IClientGroupMemberVirtualConnection {4903 source: string;4904 destination: string;4905 failureState: ConnectionFailureState;4906 clientGroupMember: IClientOrServerGroupMemberMachine;4907 destinationNode: IMapNode;4908 constructor(id: string, clientGroupMember: ClientGroupMemberMachine, targetNode: IMapNode);4909 }4910 class ServerGroupMemberVirtualConnection extends ArmMapEdge implements IServerGroupMemberVirtualConnection {4911 source: string;4912 destination: string;4913 failureState: ConnectionFailureState;4914 serverGroupMember: IClientOrServerGroupMemberMachine;4915 sourceNode: IMapNode;4916 constructor(id: string, sourceNode: IMapNode, serverGroupMember: ServerGroupMemberMachine);4917 }4918 /**4919 * A virtual connection between monitored machine/group to allServerPortGroupsVirtual node4920 */4921 class AllServerPortGroupsVirtualConnection extends ArmMapEdge implements IConnection {4922 sourceNode: IMapNode;4923 destNode: AllServerPortGroupsVirtualNodeViewModel;4924 source: string;4925 destination: string;4926 failureState: ConnectionFailureState;4927 displayName: string;4928 isSelfLink: boolean;4929 forceVisible: boolean;4930 isFailedConnection: boolean;4931 constructor(id: string, sourceNode: IMapNode, destNode: AllServerPortGroupsVirtualNodeViewModel);4932 }4933 class Connection extends ArmMapEdge implements IConnection {4934 source: string;4935 destination: string;4936 serverPort: string;4937 failureState: ConnectionFailureState;4938 isSelfLink: boolean;4939 displayName: string;4940 isFailedConnection: boolean;4941 constructor(id: string, connection: Api.v2.Connection);4942 static getFailureState(failureState: string): ConnectionFailureState;4943 }4944 class Acceptor extends ArmEntity implements IAcceptor {4945 source: string;4946 destination: string;4947 constructor(id: string, acceptor: Api.v2.Acceptor);4948 }4949}4950/**4951This module has helper functions to make ajax calls.4952 */4953declare module DependencyMap.ApiDataProvider {4954 function getCoarseMapData(requestDesciptor: object, telemetryCorrelationId: string): any;4955 function getDetailedMachineMap(requestDesciptor: object, telemetryCorrelationId: string): any;4956 function getClientGroupMembers(requestDesciptor: object, telemetryCorrelationId: string): any;4957 function getServerGroupMembers(requestDesciptor: object, telemetryCorrelationId: string): any;4958}4959declare module DependencyMap {4960 class KustoUtils {4961 static GetQueryResultObjects(kustoQueryResponse: DependencyMap.Kusto.IKustoQueryResponse, excludeNulls?: boolean, tableIndex?: number): any[];4962 static convertKustoResultsToObjects(rows: any[], columns: DependencyMap.Kusto.ISearchV2ResultTableColumn[], excludeNulls: boolean): any[];4963 }4964}4965/// <reference types="q" />4966/// <reference types="knockout" />4967declare module DependencyMap {4968 interface IMapApiDataProvider {4969 /**4970 * the start time of the monitor stage4971 */4972 startDateTimeUtc: Date;4973 /**4974 * the end time of the monitor stage4975 */4976 endDateTimeUtc: Date;4977 /**4978 * this callback is optional.4979 * it will query the alerts and logEvent.4980 */4981 executeQuery?: (query: string) => Q.Promise<DependencyMap.Kusto.IKustoQueryResponse>;4982 /**4983 * This callback is used to get the coarsMap.4984 * ajax call will be triggered within the callback.4985 * This method is not suggested since ajax failures may not be stored in telemetry.4986 * 'getCoarseMapRequestDescriptor' is recommended as an alternative to this method.4987 */4988 requestCoarseMap?: () => Q.Promise<DependencyMap.Api.v3.MapResponse>;4989 /**4990 * This callback is used to get the specific client group details.4991 * ajax call will be triggered within the callback.4992 * This method is not suggested since ajax failures may not be stored in telemetry.4993 * 'getClientGroupDetailsRequestDescriptor' is recommended as an alternative to this method.4994 */4995 requestClientGroupDetails?: (id: string) => Q.Promise<DependencyMap.Api.v3.ClientOrServerGroupMachineMap>;4996 /**4997 * This callback is used to get the specific server group details.4998 * ajax call will be triggered within the callback.4999 * This method is not suggested since ajax failures may not be stored in telemetry.5000 * 'getServerGroupDetailsRequestDescriptor' is recommended as an alternative to this method.5001 */5002 requestServerGroupDetails?: (id: string) => Q.Promise<DependencyMap.Api.v3.ClientOrServerGroupMachineMap>;5003 /**5004 * This callback is used to get the specific machine details.5005 * ajax call will be triggered within the callback.5006 * This method is not suggested since ajax failures may not be stored in telemetry.5007 * 'getMachineDetailsRequestDescriptor' is recommended as an alternative to this method.5008 */5009 requestMachineDetails?: (id: string) => Q.Promise<DependencyMap.Api.v3.MapResponse>;5010 /**5011 * Below callback is called whenever user wants to load a specific {client/server}group member's map5012 * by clicking 'loadServerMap' context menu item.5013 */5014 onMapIdUpdated?: (id: string) => void;5015 /**5016 * This callback is called to get the http request descriptor which is used to make REST call5017 * to get the map of a computer or computer group.5018 * The return object looks like5019 * {5020 * contentType: 'application/json',5021 * headers: { Authorization: "" },5022 * timeout: queryTimeoutMs,5023 * type: 'GET',5024 * url: queryUrl,5025 * }5026 */5027 getCoarseMapRequestDescriptor?: (id?: string) => object;5028 /**5029 * This callback is called to get the http request desciptor which is used to make REST call5030 * to get details of sepcific client group.5031 */5032 getClientGroupDetailsRequestDescriptor?: (clientGroupId: string) => object;5033 /**5034 * This callback is called to get the http request desciptor which is used to make REST call5035 * to get details of sepcific server group.5036 */5037 getServerGroupDetailsRequestDescriptor?: (serverGroupId: string) => object;5038 /**5039 * This callback is called to get the http request desciptor which is used to make REST call5040 * to get details of sepcific machine.5041 */5042 getMachineDetailsRequestDescriptor?: (machineId: string, getFullMap?: boolean) => object;5043 /**5044 * This callback is called whenever map is rendered.5045 */5046 onMapRendered?: () => void;5047 }5048 interface DependencyMapDashBoardOptions {5049 /**5050 * Map Image relative path, to use default path, put admmap.js same level with images folder.5051 * Default path is 'images/map/'.5052 */5053 mapImagesRelativePath?: string;5054 /**5055 * Show properties Panel when entity been selected, currently the property panel only support v2 version map.5056 * For some new entity in large scale map (v3), the property panel is empty.5057 */5058 enablePropertiesPanel?: boolean;5059 /**5060 * Enable Edge Selection5061 */5062 enableEdgeSelection?: boolean;5063 /**5064 * Enable Time Control, used by AMP team5065 */5066 enableTimeControl?: boolean;5067 /**5068 * among with the enableTimeControl5069 */5070 timeControlImagesRelativePath?: string;5071 /**5072 * pass in logger.5073 */5074 telemetryListener: ITelemetry;5075 /**5076 * please indicate one from the array, default is English.5077 * ['cs', 'de', 'es', 'fr', 'hu', 'it', 'ja', 'ko', 'nl', 'pl', 'pt-br', 'pt-pt', 'ru', 'sv', 'tr', 'zh-hans', 'zh-hant']5078 */5079 language?: string;5080 /**5081 * Only need for (v3) large scale map. plesae implement the IMapApiDataProvider5082 */5083 mapApiDataProvider?: IMapApiDataProvider;5084 onSelectionUpdated?: (newSelection: SelectionContext) => void;5085 enableSimpleMapLayout?: boolean;5086 }5087 class AdmWorkspace {5088 private static map;5089 mapComponentLoadEvent: KnockoutObservable<any>;5090 showPanel: KnockoutObservable<boolean>;5091 private toolbar;5092 private propertiesPanel;5093 constructor(domElementId: string, options: DependencyMapDashBoardOptions);5094 static getMapInstance(): AdmMap;5095 static selectEntityByResourceId(resourceId: string): void;5096 initializeDependencyMap(data: DependencyMap.Api.v2.Data, options?: any): void;5097 initializeDependencyMapV3(data?: Api.v3.MapResponse, options?: DependencyMapOptions): Promise<any>;5098 clearMap(): void;5099 assignCustomizedProperties(customizedProperties: DependencyMap.Api.v2.CustomizedProperty[]): void;5100 updateClientGroupMemberCollection(clientGroupMemberCollection: DependencyMap.Api.v2.ClientGroupMembersCollection[]): void;5101 setMapState(mapState: DependencyMap.LoadState): void;5102 updateServerPortsVisibility(portIds: string[]): void;5103 /**5104 * This method sets simple layout algortihm to use.5105 * @memberof AdmWorkspace5106 */5107 enableSimpleMapLayout(): void;5108 zoomToFit(): void;5109 handleErrorCode(errorCode: ErrorCode): void;5110 }5111}5112declare module DependencyMap {5113}5114declare module DependencyMap {5115 class AdmWorkspaceTemplate {5116 static template: string;5117 }5118}5119// extend the canvas api 5120interface CanvasRenderingContext2D {5121 roundedRect(x: number, y: number, width: number, height: number,5122 cornerRadius: number, borderWidth: number,5123 fillColor: string, borderColor: string, shadowColor?: string): void;5124 dashedLine(x1: number, y1: number, x2: number, y2: number, dashLen: number): void;5125 arrowLine(x1: number, y1: number, x2: number, y2: number, which: number, angle: number, d: number): void;5126 drawArrowHead(x0: number, y0: number, x1: number, y1: number, x2: number, y2: number): void;5127}5128interface JQueryEventObject {5129 tapCount?: number;5130 deltaX?: number;5131 deltaY?: number;5132 pointers: any;5133}5134interface JQuery {5135 getBoundingClientRect(): any;5136 mousewheel: any;5137 unmousewheel: any;5138}5139/**5140 * Adm view models schemas 5141 */5142declare module DependencyMap {5143 const enum MapType {5144 groupMap = "groupMap",5145 singleVmMap = "singleVmMap"5146 }5147 const enum MachineListMode {5148 Uninitialized = 0,5149 Machines = 1,5150 MachineGroups = 2,5151 }5152 const enum OverviewTileState {5153 Uninitialized = 0,5154 Configure = 1,5155 Overview = 2,5156 Error = 3,5157 }5158 const enum LoadState {5159 // if you change numbering, check knockout bindings!5160 Complete = 0, // finished loading successfully5161 Initialized = 1, // component loaded 5162 Load = 2, // api data request 5163 Error = 3, // finished with error5164 Empty = 4, // finished with empty result 5165 // mapping/graph component states 5166 SetModel = 5, // populate graph model 5167 Reconcile = 6, // model processing performed before layout5168 Layout = 7, // graph layout5169 Render = 8, // updating DOM5170 }5171 const enum EntityType {5172 Machine = 0,5173 Process = 1,5174 Port = 2,5175 Connection = 3,5176 Acceptor = 4,5177 ClientGroup = 5,5178 ClientGroupMember = 6,5179 ServerGroup = 7,5180 MachineStub = 8,5181 MachineGroup = 9,5182 ProcessGroup = 10,5183 UnconnectedProcesses = 11,5184 AggConnection = 12,5185 ClientGroupV3 = 13,5186 ServerGroupV3 = 14,5187 ClientOrServerGroupMember =15,5188 ClientGroupMemberMachine = 16, // Machine node within clientGroup or ServerGroup5189 ServerGroupMemberMachine = 17,5190 /**5191 This type is used to represent connection between clientGroupMember and the target (machine/processgroup/process).5192 API or graphStore does not have any idea on this connection. This is pure virtual connection created by UX5193 to get its connection metrics.5194 */5195 ClientGroupMemberVirtualConnection = 18,5196 /**5197 This type is used to represent connection between machine/processgroup/process and serverGroupMember.5198 API or graphStore does not have any idea on this connection. This is pure virtual connection created by UX5199 to get its connection metrics.5200 */5201 ServerGroupMemberVirtualConnection = 19,5202 /**5203 * This is a virtual node represents group as a single node.5204 * Members of this node are machines.5205 */5206 VirtualGroupNode = 20,5207 /**5208 * This node represents all serverPort groups.5209 * This node cannot be expanded but when user opens properties panel,5210 * Then we list all serverPorts in the properties panel5211 */5212 AllPortsNode = 21,5213 /**5214 * A dummy connection type whose source is a monitored machine/group5215 * and target is AllPortsNode5216 */5217 AllServerPortGroupsVirtualConnection = 225218 }5219 // Each group member health can be critical or warning or nominal or unmonitored.5220 const enum GroupMemberHealthState {5221 Unknown = "Unknown",5222 Nominal = "Nominal",5223 Warning = "Warning",5224 Critical = "Critical",5225 None = "None"5226 }5227 const enum MachineGroupType {5228 CloudService = 0,5229 ServiceFabric = 1,5230 ScaleSet = 2,5231 Static = 35232 }5233 // Generic map of entity type to type T5234 export type EntityTypeMap<T> = { [entityType: number]: T };5235 const enum EntityRoleType {5236 Custom = -1,5237 None = 0,5238 WebServer = 1,5239 AppServer = 2,5240 DatabaseServer = 3,5241 LdapServer = 4,5242 SmbServer = 5,5243 }5244 // An element we visualize or otherwise represent in the dashboard5245 interface IEntity {5246 id: string;5247 type: EntityType;5248 }5249 // A uniquely identificable Arm-backed entity5250 interface IArmEntity extends IEntity {5251 armName: string; // unique name within arm collection5252 armId: string; // arm path to resource5253 etag?: string;5254 toApi(): Api.v2.ArmResource;5255 }5256 // Adm Entities that are visualized in the map as nodes5257 interface IMapEntity extends IEntity {5258 isVisible: boolean;5259 isInLayout: boolean;5260 }5261 export interface IGridRow extends IArmEntity {5262 displayName: string;5263 allMissing?: boolean;5264 collapsed?: boolean;5265 live?: boolean;5266 parent?: IGridRow;5267 }5268 // Entities that are nodes in the map5269 interface IMapNode extends IMapEntity {5270 displayName: string;5271 isMonitored: boolean;5272 isHighlighted: boolean;5273 selfLinksVisible: boolean;5274 loadServerMapEnabled: boolean;5275 inboundConnections?: IConnection[]; // All inbound connections including failed and selflinks are present in this array5276 outboundConnections?: IConnection[]; // All outbound connections including failed and selflinks are present in this array5277 inboundSelfConnections?: IConnection[]; // This is a subset of inboundConnections. This array contains only inbound selfLinks5278 outboundSelfConnections?: IConnection[]; // This is a subset of outboundConnections. This array contains only outbound selfLinks5279 failedConnections?: IConnection[];5280 addConnection(connection: IConnection, isInbound: boolean, isFailed: boolean, isSelfLink: boolean);5281 clientNodes: EntityTypeMap<{ [id: string]: IMapNode }>; // map of entity types to sets of client nodes 5282 serverNodes: EntityTypeMap<{ [id: string]: IMapNode }>; // map of entity types to sets of server nodes5283 addConnectedNode(node: IMapNode, isClient: boolean);5284 badges: Integrations.MapBadge[];5285 maxBadgeEmphasis: EmphasisType;5286 customizedProperties?: Api.v2.CustomizedProperty[];5287 }5288 // Entities that are edges in the map 5289 interface IMapEdge extends IMapEntity {5290 forceVisible?: boolean;5291 }5292 interface IMachine extends IMapNode, IArmEntity, IGridRow {5293 computerName?: string;5294 fullyQualifiedDomainName?: string;5295 bootTime?: string;5296 virtualizationState?: string;5297 virtualMachine?: VirtualMachineConfiguration;5298 hypervisor?: HypervisorConfiguration;5299 networking?: NetworkConfiguration;5300 agent?: AgentConfiguration;5301 resources?: MachineResourcesConfiguration;5302 operatingSystem?: OperatingSystemConfiguration;5303 timezone?: TimeZoneInfo;5304 expanded?: boolean;5305 roleCounts: { [role: number]: number }; // map of role type to count5306 processGroups: IProcessGroup[];5307 processes: IProcess[];5308 clientGroup?: IClientGroup;5309 addProcessGroup(process: IProcessGroup);5310 addProcess(process: IProcess);5311 getAllIpAddresses(): string[];5312 }5313 interface IVirtualGroupNode extends IMapNode {5314 machines: IMachine[];5315 totalMachineCount: number;5316 graphNode: GraphNode;5317 getCriticalMemberCount(): number;5318 }5319 interface IGroupMemberConnectionEndpoint {5320 machineName: string;5321 processName: string;5322 process: IProcess;5323 isMonitored: boolean;5324 }5325 interface IGroupMemberConnectionInfo {5326 failureState: ConnectionFailureState;5327 serverPort: number;5328 source: GroupMemberConnectionEndpoint;5329 destination: GroupMemberConnectionEndpoint;5330 }5331 interface IClientOrServerGroupMemberMachine extends IMapNode, IArmEntity, IGridRow {5332 computerName?: string;5333 fullyQualifiedDomainName?: string;5334 operatingSystem?: OperatingSystemConfiguration;5335 connectionFailureState?: ConnectionFailureState;5336 connectionInfos: IGroupMemberConnectionInfo[];5337 machineId: string;5338 group: IGroupViewModelV3;5339 getHealth(): GroupMemberHealthState;5340 }5341 interface IProcessGroup extends IMapNode, IGridRow {5342 processes: IProcess[];5343 clientGroup?: IClientGroup;5344 clientOfId?: string;5345 machineId: string;5346 addProcess(process: IProcess);5347 }5348 interface IProcess extends IMapNode, IArmEntity {5349 executableName: string;5350 machineId: string;5351 startTime?: string;5352 details?: ProcessDetails;5353 user?: ProcessUser;5354 acceptorOfId?: string;5355 clientOfId?: string;5356 role: EntityRoleType;5357 processGroup: IProcessGroup;5358 group?: string; // This is processGroup name5359 processGroupId?: string; // TODO: This attribute is not coming from API response.5360 ports: IPort[];5361 clientGroup?: IClientGroup;5362 addPort(port: IPort);5363 getPortNumbers(): string[];5364 }5365 interface IPort extends IArmEntity {5366 displayName: string;5367 isMonitored: boolean;5368 machineId: string;5369 ipAddress: string;5370 portNumber: number;5371 }5372 interface IClientGroup extends IMapNode, IArmEntity {5373 destinationId: string;5374 destination: IMapNode;5375 memberCount?: number;5376 isApproximate?: boolean;5377 unmonitoredMemberCount?: number;5378 members?: IClientGroupMember[];5379 unmonitoredMembers: IClientGroupMember[];5380 membersSkipToken?: string;5381 setDestinationEntity(destinationEntity: IMapNode): void;5382 updateCount(memberCount: Api.v2.ClientGroupMemberCount): void;5383 updateMembers(membersCollection: Api.v2.ClientGroupMembersCollection, mapModel: DependencyMap.IMap): void;5384 }5385 interface IClientGroupMember extends IArmEntity {5386 ipAddress: string;5387 portId: string;5388 portNumber: number;5389 processIds: string[];5390 machine?: IMachine;5391 }5392 interface IGroupViewModelV3 extends IMapNode {5393 role: EntityRoleType;5394 graphNode: GraphNode;5395 allGroupMembers: IClientOrServerGroupMemberMachine[];5396 getTotalMemberCount(): number;5397 getMonitoredMemberCount(): number;5398 getDiscoveredMemberCount(): number;5399 }5400 interface IClientGroupViewModelV3 extends IGroupViewModelV3 {5401 /**5402 Target node Id5403 */5404 destinationId: string;5405 /**5406 Target node to which this client group belongs to 5407 */5408 destination: IMapNode;5409 }5410 interface IServerGroupViewModelV3 extends IGroupViewModelV3 {5411 portNumber: number;5412 /**5413 * List of machines/processgroups/processes which have outgoing connections to this serverGroup5414 */5415 clientEntities: StringMap<IEntity>;5416 addClientEntityGraphNode(graphNode: GraphNode);5417 setGraphNodeVisibility(value: boolean);5418 getGraphNodeVisibility(): boolean;5419 }5420 interface IAllServerPortGroupsVirtualNodeViewModel extends IMapEntity {5421 allServerPortGroups: IServerGroupViewModelV3[];5422 displayName: string;5423 }5424 interface IGroupViewModel extends IMapNode {5425 memberViewModels: IMachine[];5426 port: IPort;5427 role: EntityRoleType;5428 }5429 interface IServerGroup extends IGroupViewModel {5430 }5431 //view model interface5432 interface IAggConnection extends IMapEdge, IArmEntity {5433 clients: string[];5434 servers: string[];5435 portIds?: string[];5436 connections: IConnection[];5437 displayName: string;5438 failureState: ConnectionFailureState;5439 connectionCount: number;5440 }5441 interface IClientGroupMemberVirtualConnection extends IMapEdge {5442 /**5443 MachineId of the clientGroupMember.5444 NOTE: This id is not not clientGroupMemberId. connection metrics are available for the machine but not clientgroupmember resource.5445 */5446 source: string;5447 /**5448 Id of a machine or processgroup or a process.5449 */5450 destination: string;5451 /**5452 Connection failure state.5453 */5454 failureState: ConnectionFailureState;5455 /**5456 ClientGroup member object from which the edge needs to be drawn in the graph5457 */5458 clientGroupMember: IClientOrServerGroupMemberMachine;5459 /**5460 Machine/Process/ProcessGroup node to which the connection is made.5461 */5462 destinationNode: IMapNode;5463 }5464 interface IServerGroupMemberVirtualConnection extends IMapEdge {5465 /**5466 Id of a machine or processgroup or process.5467 */5468 source: string;5469 /**5470 MachineId of the serverGroupMember.5471 NOTE: This id is not not serverGroupMemberId. connection metrics are available for the machine but not servergroupmember resource.5472 */5473 destination: string;5474 /**5475 Connection failure state.5476 */5477 failureState: ConnectionFailureState;5478 /**5479 ServerGroup member object to which the edge needs to be drawn in the graph5480 */5481 serverGroupMember: IClientOrServerGroupMemberMachine;5482 /**5483 Machine/Process/ProcessGroup node from which the connection is made.5484 */5485 sourceNode: IMapNode;5486 }5487 interface IConnection extends IMapEdge, IArmEntity {5488 source: string;5489 destination: string;5490 serverPort?: string;5491 failureState: ConnectionFailureState;5492 isSelfLink: boolean;5493 displayName: string;5494 isFailedConnection: boolean;5495 }5496 interface IAcceptor extends IArmEntity {5497 source: string;5498 destination: string;5499 }5500 interface IMachineGroup extends IArmEntity, IGridRow {5501 displayName: string;5502 machines: IMachineStub[];5503 groupType: MachineGroupType;5504 addMachines(machines: IMachine[]);5505 }5506 interface IMachineStub extends IArmEntity, IGridRow {5507 displayName: string;5508 osFamilyType: OperatingSystemFamilyType;5509 live: boolean;5510 }5511 interface NetworkConfiguration {5512 dnsNames?: string[];5513 ipv4Interfaces?: IPv4Interface[];5514 ipv6Interfaces?: IPv6Interface[];5515 macAddresses?: string[];5516 defaultIpv4Gateways?: string[];5517 }5518 interface IPv4Interface {5519 ipAddress: string;5520 subnetMask: string;5521 cidrNotation: string;5522 }5523 interface IPv6Interface {5524 ipAddress: string;5525 }5526 interface ApproximatedCount {5527 count: number;5528 isApproximate: boolean;5529 }5530 interface TimeZoneInfo {5531 fullName: string;5532 }5533 interface AgentConfiguration {5534 agentId: string;5535 dependencyAgentId: string;5536 dependencyAgentVersion?: string;5537 dependencyAgentRevision?: string;5538 rebootStatus?: string;5539 clockGranularity?: number;5540 }5541 interface OperatingSystemConfiguration {5542 fullName: string;5543 familyType: OperatingSystemFamilyType;5544 bitness: string;5545 name: string;5546 }5547 const enum OperatingSystemFamilyType {5548 Unknown = 0,5549 Windows = 1,5550 Linux = 2,5551 Solaris = 3,5552 Aix = 45553 }5554 interface MachineResourcesConfiguration {5555 physicalMemory: number;5556 cpus: number;5557 cpuSpeed: number;5558 cpuSpeedIsEstimate: boolean;5559 }5560 interface VirtualMachineConfiguration {5561 virtualMachineType: string;5562 virtualMachineName?: string;5563 nativeMachineId?: string;5564 nativeHostMachineId?: string;5565 }5566 interface HypervisorConfiguration {5567 hypervisorType: string;5568 nativeHostMachineId?: string;5569 }5570 interface HostingConfiguration {5571 provider: string;5572 vmId: string;5573 location: string;5574 name: string;5575 size: string;5576 updateDomain: string;5577 faultDomain: string;5578 subscriptionId: string;5579 resourceGroup: string;5580 image: ImageConfiguration;5581 cloudService: AzureCloudServiceConfiguration;5582 vmScaleSet: AzureVmScaleSetConfiguration;5583 serviceFabricCluster: AzureServiceFabricClusterConfiguration;5584 }5585 interface AzureCloudServiceConfiguration {5586 name: string;5587 instanceId: string;5588 deployment: string;5589 roleName: string;5590 roleType: AzureCloudServiceRoleType;5591 }5592 const enum AzureCloudServiceRoleType {5593 Unknown,5594 Worker,5595 Web5596 }5597 interface AzureServiceFabricClusterConfiguration {5598 name: string;5599 clusterId: string;5600 }5601 interface AzureVmScaleSetConfiguration {5602 name: string;5603 instanceId: string;5604 deployment: string;5605 resourceId: string;5606 }5607 interface ImageConfiguration {5608 offering: string;5609 publisher: string;5610 sku: string;5611 version: string;5612 }5613 interface ProcessDetails {5614 persistentKey: string;5615 poolId?: number;5616 firstPid?: number;5617 description?: string;5618 companyName?: string;5619 internalName?: string;5620 productName?: string;5621 productVersion?: string;5622 fileVersion?: string;5623 commandLine?: string;5624 executablePath?: string;5625 workingDirectory?: string;5626 }5627 interface ProcessUser {5628 userName: string;5629 userDomain?: string;5630 }5631 const enum ConnectionFailureState {5632 Ok = 0,5633 Failed = 1,5634 Mixed = 25635 }5636 export interface IMap {5637 entities: { [id: string]: IEntity }; // map of ids to entities (machines, conns, etc.) for fast access5638 ips: { [ipAddress: string]: IEntity } // map of ip adresses to machines5639 nodes: NodeMap;5640 edges: EdgeMap;5641 setModel(mapResult: Api.v2.Map, mapContext: MapContext, mapId: string);5642 setModelV3(modelResponse: Api.v3.MapResponse, mapContext: MapContext, groupAsSingleNode: boolean);5643 getEntityById(entityId): IEntity;5644 getMapNodeById(nodeId: string): IMapNode;5645 getMachineByConnection(connection: IConnection, getSource: boolean): IMachine;5646 setEntityProperty(entityId: string, name: string, value: any);5647 addNodeBadge(nodeId: string, badge: Integrations.MapBadge);5648 toggleSelfLinks(nodeId: string);5649 getClientMachinesCount(entity: Machine | Process | ProcessGroup): ApproximatedCount;5650 getServerMachinesCount(entity: Machine | Process | ProcessGroup): ApproximatedCount;5651 }5652 export interface NodeMap {5653 machines: IMachine[];5654 processes: IProcess[];5655 ports?: IPort[];5656 clientGroups?: IClientGroup[];5657 serverGroups?: IGroupViewModel[];5658 serverGroupsV3?: IServerGroupViewModelV3[];5659 clientGroupsV3?: IClientGroupViewModelV3[];5660 processGroups?: IProcessGroup[];5661 virtaulGroupNode?: IVirtualGroupNode;5662 allServerPortGroupsVirtualNode?: IAllServerPortGroupsVirtualNodeViewModel;5663 clientOrServerGroupMemberMachines: { [groupId: string]: IClientOrServerGroupMemberMachine[]}; // machineInstances which are part of any client/server group.5664 }5665 export interface EdgeMap {5666 connections: IConnection[];5667 acceptors: IAcceptor[];5668 }5669 const enum MapContextState {5670 Okay,5671 Empty,5672 Missing5673 }5674 export interface MapContext {5675 kind: Api.v2.MapRequestKind;5676 state: MapContextState;5677 selectedEntity?: Entity;5678 name: string; // Name of the group or machine5679 timeInterval: any; // CompositionParser.GlobalInterfaces.TimeInterval;5680 highlightEntities?: string[];5681 }5682 export interface SelectionContext {5683 /**5684 * This is latest selected entity. 5685 * @deprecated Please use edge for 'edge' selection and 'nodes' for node selection.5686 */5687 entity: IMapEntity;5688 /**5689 * Selected edge entity. Multi edge selection is not allowed and hence this value is always a single object.5690 */5691 edge: IMapEntity;5692 /**5693 * List of selected nodes.5694 */5695 nodes: IMapNode[];5696 /**5697 * Type badge of being selected. It can be 'alert', 'change tracking', 'update', ... etc5698 */5699 badgeType?: BadgeType; 5700 }5701 const enum BadgeType {5702 Alert = 'Alert',5703 Update = 'Update',5704 Health = 'Health'5705 }5706 export interface GraphEvent {5707 name: string;5708 properties: any;5709 }5710 const enum EmphasisType {5711 None = 0, //used as an alternative in code meaning no emphasis5712 Informational = 1,5713 Warning = 2,5714 Critical = 3,5715 }5716 //generic representation of an hash5717 export type HashMap<T> = { [key: number]: T;[key: string]: T };5718 const enum TraceLevel {5719 Debug = 0,5720 Info = 1,5721 Warn = 2,5722 Error = 3,5723 Disabled = 105724 }5725 interface TelemetryEvent {5726 id: string;5727 parentId?: string;5728 start: Date;5729 level: TraceLevel;5730 /**5731 * correlation Id is a guid which will be used to correlate UX operations and API operations5732 */5733 correlationId?: string;5734 /**5735 * Source is the component to which the event is associated. It can be Map or TimeControl or PropertiesPanel... etc.5736 */5737 source: string;5738 steps?: TelemetryStep[];5739 properties?: any;5740 }5741 interface TelemetryStep {5742 name: string;5743 message: string;5744 time: Date;5745 }5746}5747declare module DependencyMap.Integrations {5748 const enum SearchTriggerType {5749 OnMachineListLoaded = 0,//trigger on general searches, this includes when the machine list loads5750 OnEntitySelected = 1 //trigger when an entity is selected5751 }5752 interface ISearchIntegrationQuery {5753 queryId: string;5754 triggerType: SearchTriggerType;5755 entity?: IEntity;5756 }5757 interface IAdmMapAdapter {5758 mapApi: IAdmMapApi;5759 onMapUpdate: (mapAPI: IAdmMapApi, records: RecordMap) => void;5760 }5761 type IUpdatePanelContextFunction = (selection: SelectionContext) => void;5762 interface IAdmSummaryAdapter {5763 displayOrder: number;5764 summaries: KnockoutObservableArray<IAdmSummary<any>>;5765 onUpdate: () => void;5766 onMapSelectionUpdate: (selection: DependencyMap.SelectionContext) => void;5767 onMapUpdate: (mapAPI: IAdmMapApi) => void;5768 }5769 interface IAdmIntegrationPrerequisteRequierment {5770 header: string,5771 icon: string,5772 action: Function;5773 }5774 type AdmSummaryValue = string | string[] | IAdmSummaryCounter[];5775 //an adm summary can be a single string, an array of strings, or an array of counters5776 interface IAdmSummary<T extends AdmSummaryValue> {5777 type: IAdmSummaryType;5778 name?: string;5779 value: T;5780 action?: Function;5781 showIntegrationOnClick?: boolean;5782 emphasis?: EmphasisType;5783 }5784 interface IAdmSummaryCounter {5785 name: string;5786 value: number | string;5787 emphasis?: EmphasisType;5788 }5789 const enum IAdmSummaryType {5790 sectionHeader = 0,5791 value = 1,5792 list = 2,5793 counterSet = 3,5794 link = 45795 }5796 type GetSummariesFunction = (entity: DependencyMap.IEntity, mapModel: DependencyMap.IMap) => IAdmSummary<AdmSummaryValue>[];5797 interface IAdmMapApi {5798 mapModel: DependencyMap.IMap;5799 setEntityProperty: (entityId: string, name: string, value: any) => void;5800 addNodeBadge: (nodeId: string, badge: MapBadge) => void;5801 loadAllClientGroupMembers: (clientGroup: DependencyMap.IClientGroup) => void;5802 }5803 export interface IAlert {5804 // fields from log search5805 id: string;5806 TimeGenerated: string;5807 AlertName: string;5808 AlertRuleId: string;5809 AlertRuleInstanceId: string; // guid for alert record5810 AlertSeverity: string; // "Critical", "Warning" or "Informational"5811 Query: string;5812 QueryExecutionStartTime: string;5813 QueryExecutionEndTime: string;5814 Computer?: string; // computer name5815 ThresholdOperator?: string;5816 ThresholdValue?: number;5817 LinkToSearchResults?: string;5818 // custom fields5819 severityLevel: DependencyMap.EmphasisType;5820 /**5821 * Local time formatted value of 'TimeGenerated' property of this object.5822 */5823 formattedQueryTimeGeneated: string;5824 /**5825 * Local time formatted value of 'QueryExecutionStartTime' property of this object.5826 */5827 formattedQueryExecutionStartTime: string;5828 /**5829 * Local time formatted value of 'QueryExecutionEndTime' property of this object.5830 */5831 formattedQueryExecutionEndTime: string;5832 }5833 export interface ILogEvents {5834 Type: string;5835 AggregatedValue: number;5836 }5837 interface MapBadge {5838 integrationId: string,5839 integrationName: BadgeType,5840 emphasis: EmphasisType,5841 icon: string; // url to icon5842 count: number;5843 emphasisOnly?: boolean;5844 }5845 // Takes a list of records for an entity and returns a badge to represent it5846 interface CreateMapBadgeFunction {5847 (records: any[]): MapBadge;5848 }5849 const enum PanelBlockerType {5850 error = 0,5851 busy = 15852 }5853 interface IPanelBlocker {5854 type: PanelBlockerType;5855 message: string;5856 }5857 export interface IEntityTypeDisplayNameMap {5858 [type: number]: { plural: string, singular: string }5859 }5860 // Maps entity ids to sets of records5861 interface RecordMap {5862 [id: string]: any | any[];5863 }5864 const enum MachineMapBy {5865 agentId = 0,5866 computerName = 15867 }5868 // Maps entity ids to sets of records5869 interface MachineMap {5870 [id: string]: DependencyMap.IMachine;5871 }5872 interface MachineSummaryCount {5873 processes: number;5874 connections: number;5875 inbound: number;5876 outbound: number;5877 failedConnections: number;5878 servers: number;5879 clients: number;5880 isClientCountAproximate: boolean;5881 }5882 interface ProcessSummaryCount {5883 ports: number;5884 portNumbers: string[];5885 connections: number;5886 inbound: number;5887 outbound: number;5888 failedConnections: number;5889 servers: number;5890 clients: number;5891 isClientCountAproximate: boolean;5892 }5893}5894declare module DependencyMap.Api {5895 interface ArmResource {5896 id: string; // path to resource5897 name: string; // identifier for resource in collection5898 type?: string; // collection type5899 etag?: string;5900 kind?: string;5901 properties?: any;5902 }5903 interface Data {5904 structure: any;5905 badges?: Integrations.MapBadge[];5906 }5907}5908declare module DependencyMap.Api.v2 {5909 interface ProcessHostedService {5910 name: string;5911 displayName: string;5912 }5913 interface ArmResource extends DependencyMap.Api.ArmResource {5914 }5915 interface Machine extends ArmResource {5916 properties: {5917 displayName: string;5918 computerName?: string;5919 fullyQualifiedDomainName?: string;5920 monitoringState: string;5921 bootTime?: string;5922 virtualizationState?: string;5923 virtualMachine?: VirtualMachineConfiguration;5924 hypervisor?: HypervisorConfiguration;5925 networking?: NetworkConfiguration;5926 agent?: AgentConfiguration;5927 resources?: MachineResourcesConfiguration;5928 operatingSystem?: OperatingSystemConfiguration;5929 timezone?: TimeZoneInfo;5930 hosting?: HostingConfiguration;5931 }5932 }5933 interface HostingConfiguration {5934 kind?: string;5935 resourceId?: string;5936 provider?: string;5937 vmId?: string;5938 location?: string;5939 name?: string;5940 size?: string;5941 updateDomain?: string;5942 faultDomain?: string;5943 subscriptionId?: string;5944 resourceGroup?: string;5945 image?: ImageConfiguration;5946 cloudService?: AzureCloudServiceConfiguration;5947 vmScaleSet?: AzureVmScaleSetConfiguration;5948 serviceFabricCluster?: AzureServiceFabricClusterConfiguration;5949 }5950 interface ImageConfiguration {5951 offering?: string;5952 publisher?: string;5953 sku?: string;5954 version?: string;5955 }5956 interface AzureCloudServiceConfiguration {5957 name?: string;5958 instanceId?: string;5959 deployment?: string;5960 roleName?: string;5961 roleType?: string;5962 }5963 interface AzureVmScaleSetConfiguration {5964 name?: string;5965 instanceId?: string;5966 deployment?: string;5967 resourceId?: string;5968 }5969 interface AzureServiceFabricClusterConfiguration {5970 name?: string;5971 clusterId?: string;5972 }5973 interface MachineHint extends ArmResource {5974 properties: {5975 displayNameHint: string;5976 osFamilyHint: string;5977 }5978 }5979 interface Process extends ArmResource {5980 properties: {5981 displayName: string;5982 executableName?: string;5983 monitoringState: string;5984 startTime?: string;5985 group?: string;5986 role?: string;5987 details?: ProcessDetails;5988 user?: ProcessUser;5989 machine: ArmResource;5990 acceptorOf?: ArmResource;5991 clientOf?: ArmResource;5992 }5993 }5994 interface ProcessGroup extends ArmResource {5995 properties: {5996 displayName: string;5997 machine: ArmResource;5998 }5999 }6000 interface Port extends ArmResource {6001 properties: {6002 displayName: string;6003 monitoringState: string;6004 ipAddress: string;6005 portNumber: number;6006 machine: ArmResource;6007 }6008 }6009 interface ClientGroup extends ArmResource {6010 properties: {6011 clientsOf: ArmResource6012 }6013 }6014 interface ClientGroupMember extends ArmResource {6015 properties: {6016 ipAddress: string;6017 port: ArmResource;6018 processes: ArmResource[];6019 }6020 }6021 interface ClientGroupMemberCount {6022 startTime: string;6023 endTime: string;6024 groupId: string;6025 count: number;6026 accuracy: string;6027 }6028 //data model interface6029 interface AggConnection extends ArmResource {6030 properties: {6031 clients?: string[];6032 servers?: string[];6033 portIds?: string[];6034 }6035 }6036 interface Connection extends ArmResource {6037 properties: {6038 source: ArmResource;6039 destination: ArmResource;6040 serverPort?: ArmResource;6041 failureState?: string;6042 }6043 }6044 interface Acceptor extends ArmResource {6045 properties: {6046 source: ArmResource;6047 destination: ArmResource;6048 serverPort?: ArmResource;6049 failureState?: string;6050 }6051 }6052 interface MachineGroup extends ArmResource {6053 properties: {6054 displayName: string;6055 groupType: string;6056 machines: ArmResource[];6057 }6058 }6059 interface NetworkConfiguration {6060 dnsNames?: string[];6061 ipv4Interfaces?: IPv4Interface[];6062 ipv6Interfaces?: IPv6Interface[];6063 macAddresses?: string[];6064 defaultIpv4Gateways?: string[];6065 }6066 interface IPv4Interface {6067 ipAddress: string;6068 subnetMask: string;6069 }6070 interface IPv6Interface {6071 ipAddress: string;6072 }6073 interface TimeZoneInfo {6074 fullName: string;6075 }6076 interface AgentConfiguration {6077 agentId: string;6078 dependencyAgentId: string;6079 dependencyAgentVersion?: string;6080 dependencyAgentRevision?: string;6081 rebootStatus?: string;6082 clockGranularity?: number;6083 }6084 interface OperatingSystemConfiguration {6085 fullName: string;6086 family: string;6087 bitness: string;6088 }6089 interface MachineResourcesConfiguration {6090 physicalMemory: number;6091 cpus: number;6092 cpuSpeed: number;6093 cpuSpeedAccuracy: string;6094 }6095 interface VirtualMachineConfiguration {6096 virtualMachineType: string;6097 virtualMachineName?: string;6098 nativeMachineId?: string;6099 nativeHostMachineId?: string;6100 }6101 interface HypervisorConfiguration {6102 hypervisorType: string;6103 nativeHostMachineId?: string;6104 }6105 interface ProcessDetails {6106 persistentKey: string;6107 poolId?: number;6108 firstPid?: number;6109 description?: string;6110 companyName?: string;6111 internalName?: string;6112 productName?: string;6113 productVersion?: string;6114 fileVersion?: string;6115 commandLine?: string;6116 executablePath?: string;6117 workingDirectory?: string;6118 services?: any;6119 }6120 interface ProcessUser {6121 userName: string;6122 userDomain?: string;6123 }6124 export interface Map {6125 nodes: NodeMap;6126 edges: EdgeMap;6127 }6128 export interface NodeMap {6129 machines: Machine[];6130 processes: Process[];6131 ports: Port[];6132 clientGroups: ClientGroup[];6133 }6134 export interface EdgeMap {6135 connections: Connection[];6136 acceptors: Acceptor[];6137 }6138 export interface MachineCollection {6139 value: Machine[];6140 nextLink?: string;6141 }6142 export interface MachineGroupCollection {6143 value: MachineGroup[];6144 }6145 interface ClientGroupMembersCollection {6146 value: ClientGroupMember[];6147 nextLink?: string;6148 }6149 export interface CustomizedProperty {6150 entityId: string;6151 propertyName: string;6152 propertyValue: string;6153 }6154 export interface Data extends DependencyMap.Api.Data {6155 structure: MapResponse;6156 clientCloudInfo?: ClientGroupMembersCollection[];6157 customizedProperties?: CustomizedProperty[];6158 }6159 const enum MachineKind {6160 SingleMachine = "map:single-machine-dependency",6161 GroupMachine = "map:machine-group-dependency"6162 }6163 export type MapRequestKind = MachineKind.GroupMachine | MachineKind.SingleMachine;6164 export interface MapRequest {6165 startTime: string;6166 endTime: string;6167 kind: MapRequestKind;6168 }6169 export interface MachineMapRequest extends MapRequest {6170 machineId: string;6171 }6172 export interface MachineGroupMapRequest extends MapRequest {6173 machineGroupId: string;6174 }6175 export interface MapResponse {6176 startTime: string;6177 endTime: string;6178 map: Map;6179 }6180 interface MachineSummary extends ArmResource {6181 properties: {6182 startTime: string;6183 endTime: string;6184 live: number;6185 os: {6186 linux: number;6187 windows: number;6188 };6189 total: number;6190 }6191 }6192}6193declare module DependencyMap.Api.v3 {6194 interface ArmResource extends DependencyMap.Api.v2.ArmResource {}6195 export interface Data extends DependencyMap.Api.Data {6196 structure: MapResponse;6197 clientServerGroupMachineMap?: ClientOrServerGroupMachineMap[]; // TODO: Remove this when we integrate with API.6198 machineDetail?: Map;//TODO: same to above, maybe we can keep them6199 }6200 export interface MapResponse {6201 startTime: string;6202 endTime: string;6203 map: Map;6204 }6205 export interface Map {6206 nodes: NodeMap;6207 edges: EdgeMap;6208 summaries: MapSummaries;6209 }6210 export interface MapSummaries {6211 clientGroupSummaries: ClientGroupSummary[];6212 processesSummaries: ProcessSummary[];6213 serverGroupSummaries: ServerGroupSummary[];6214 mapSummary?: MapSummary;6215 }6216 export interface NodeMap {6217 machines: Machine[];6218 clientGroups: ClientGroup[];6219 serverGroups: ServerGroup[];6220 ports?: any[];//no need to keep it in api6221 processes?: Process[];6222 processGroups?: ProcessGroup[];6223 }6224 interface Process extends DependencyMap.Api.v2.Process { }6225 interface ProcessGroup extends ArmResource {6226 properties: {6227 displayName: string;6228 hostingMachine: ArmResource;6229 count?: any;6230 members?: any; //currently not used6231 }6232 }6233 interface Machine extends DependencyMap.Api.v2.Machine {6234 failState?: string;6235 }6236 interface ClientGroup extends DependencyMap.Api.v2.ClientGroup { }6237 interface ServerGroup extends ArmResource {6238 properties: {6239 serversOf: any, //ArmResource[],seems like not consistent. but however not used6240 portNumber: number;6241 }6242 }6243 export interface EdgeMap {6244 connections: Connection[];6245 acceptors?: any;//no need to keep it in api6246 }6247 interface Connection extends DependencyMap.Api.v2.Connection { }6248 export interface CustomizedProperty extends DependencyMap.Api.v2.CustomizedProperty {6249 }6250 export interface ClientGroupSummary {6251 summaryOf: ArmResource;6252 discoveredMembersCount: MemberCount;6253 monitoredMembersCount: MemberCount;6254 monitoredMembers: ArmResource[];6255 discoveredMembers: ArmResource[];6256 }6257 6258 export interface ProcessSummary {6259 summaryOf: ArmResource;6260 processesCount: MemberCount;6261 processesTypes: string[];6262 }6263 export interface ServerGroupSummary {6264 summaryOf: ArmResource;6265 discoveredMembersCount: MemberCount;6266 monitoredMembersCount: MemberCount;6267 monitoredMembers: ArmResource[];6268 discoveredMembers: ArmResource[];6269 }6270 export interface MapSummary {6271 requestedMachineCount: number;6272 actualMachineCount: number;6273 }6274 export interface MemberCount {6275 accuracy: string;6276 count: number;6277 }6278 6279 export interface ClientOrServerGroupMachineMap {6280 id?: string; // Id is added only to refer test data.6281 value: ClientOrServerGroupMember[];6282 }6283 export interface ClientOrServerGroupMember extends ArmResource {6284 properties: {6285 displayName: string,6286 monitoringState: string,6287 osFamily: string,6288 machineId: ArmResource,6289 machine: ArmResource,6290 connectionInfos: GroupMemberConnectionInfo[]6291 }6292 }6293 export interface GroupMemberConnectionInfo {6294 source: GroupMemberConnectionEndpoint,6295 destination: GroupMemberConnectionEndpoint,6296 portNumber: number,6297 failureState: string6298 }6299 export interface GroupMemberConnectionEndpoint {6300 machine: string,6301 process: string,6302 processId: ArmResource,6303 monitoringState: string6304 }6305}6306declare module DependencyMap.Kusto {6307 export interface IKustoQueryResponse {6308 Tables: IKustoTable[];6309 Render: IKustoResponeVisualization,6310 Statistics: IKustoStatistics,6311 Error: OneApiError6312 }6313 export interface IKustoTable {6314 Columns: ISearchV2ResultTableColumn[];6315 Rows: any[][];6316 }6317 export interface IKustoResponeVisualization {6318 visualization: string,6319 title: string,6320 accumulate: boolean,6321 isQuerySorted: boolean,6322 kind: string,6323 annotation: string,6324 by: any6325 }6326 export interface IKustoStatistics {6327 query: IQueryStatistics6328 }6329 export interface IQueryStatistics {6330 executionTime: number,6331 resourceUsage: any6332 }6333 export interface OneApiError {6334 code: string,6335 message: string,6336 target: string,6337 details: OneApiError[],6338 innererror: any6339 }6340 export interface ISearchV2ResultTableColumn {6341 ColumnName: string;6342 ColumnType: string;6343 }6344}6345interface HTMLElement {6346 selectionStart: number;6347 selectionEnd: number;6348} 6349interface HTMLTextAreaElement {6350 selectionDirection: string;6351}6352interface HTMLInputElement {6353 selectionDirection: string;6354}6355interface Window {6356 chrome: any;6357 ActiveXObject: any;6358 MsPortalFx: any;6359 // Chrome6360 OverflowEvent: any;6361}6362interface MessageEventListener extends EventListener {6363 (evt: MessageEvent): void;6364}6365interface MouseEvent {6366 // IE & Chrome6367 wheelDelta?: number;6368}6369// The following parseInt is required here because lib.d supports only string as input.6370// Even though TypeScript will not change the input to be any, it would be a big6371// change in programming habits and language to transform all variables to a string6372// before calling this function.6373/**6374 * Converts any into an integer.6375 *6376 * @param s A value to convert into a number.6377 * @param radix A value between 2 and 36 that specifies the base of the number in numString. 6378 * If this argument is not supplied, strings with a prefix of '0x' are considered hexadecimal.6379 * All other strings are considered decimal.6380 * @return Input converted to a number.6381 */6382declare function parseInt(s: any, radix?: number): number;6383// The following focus is available on HTMLElement, however, focus is available on Element6384interface Element {6385 focus(): void;6386}6387interface StringMap<T> {6388 [key: string]: T;6389}6390interface NumberMap<T> {6391 [key: number]: T;6392 length?: number;6393}6394interface NameValue<N, T> {6395 name: N;6396 value: T;6397}6398interface Error {6399 stack?: string;6400}6401interface Event {6402 // Chrome & Opera6403 horizontalOverflow: boolean;6404 verticalOverflow: boolean;6405}6406interface JQueryStatic {6407 cleanData: (elements: Element[]) => void;6408}6409interface Func<R> {6410 (): R;6411}6412interface KnockoutReadOnlyObservableBase<T> extends KnockoutSubscribable<T> {6413 peek(): T;6414 (): T;6415}6416interface KnockoutObservableBase<T> extends KnockoutObservable<T> {6417}6418interface KnockoutDisposable {6419 dispose(): void;6420}6421interface JQueryEventHandler {6422 (eventObject: JQueryEventObject, args?: any): any;6423}6424interface Set<T> {6425 add(value: T): this;6426 clear(): void;6427 delete(value: T): boolean;6428 forEach(callbackfn: (value: T, value2: T, set: Set<T>) => void, thisArg?: any): void;6429 has(value: T): boolean;6430 size: number;6431}6432interface SetConstructor {6433 new (): Set<any>;6434 new <T>(values?: T[]): Set<T>;6435 prototype: Set<any>;6436}6437declare var Set: SetConstructor;6438interface APromise<T> extends Q.Promise<T> { }...
validator.js
Source:validator.js
1import { dispatch as d3_dispatch } from 'd3-dispatch';2import { prefs } from './preferences';3import { coreDifference } from './difference';4import { geoExtent } from '../geo/extent';5import { modeSelect } from '../modes/select';6import { utilArrayChunk, utilArrayGroupBy, utilEntityAndDeepMemberIDs, utilRebind } from '../util';7import * as Validations from '../validations/index';8export function coreValidator(context) {9 let dispatch = d3_dispatch('validated', 'focusedIssue');10 let validator = utilRebind({}, dispatch, 'on');11 let _rules = {};12 let _disabledRules = {};13 let _ignoredIssueIDs = new Set();14 let _resolvedIssueIDs = new Set();15 let _baseCache = validationCache('base'); // issues before any user edits16 let _headCache = validationCache('head'); // issues after all user edits17 let _completeDiff = {}; // complete diff base -> head of what the user changed18 let _headIsCurrent = false;19 let _deferredRIC = {}; // Object( RequestIdleCallback handle : rejectPromise method )20 let _deferredST = new Set(); // Set( SetTimeout handles )21 let _headPromise; // Promise fulfilled when validation is performed up to headGraph snapshot22 const RETRY = 5000; // wait 5sec before revalidating provisional entities23 // Allow validation severity to be overridden by url queryparams...24 // See: https://github.com/openstreetmap/iD/pull/824325 //26 // Each param should contain a urlencoded comma separated list of27 // `type/subtype` rules. `*` may be used as a wildcard..28 // Examples:29 // `validationError=disconnected_way/*`30 // `validationError=disconnected_way/highway`31 // `validationError=crossing_ways/bridge*`32 // `validationError=crossing_ways/bridge*,crossing_ways/tunnel*`33 const _errorOverrides = parseHashParam(context.initialHashParams.validationError);34 const _warningOverrides = parseHashParam(context.initialHashParams.validationWarning);35 const _disableOverrides = parseHashParam(context.initialHashParams.validationDisable);36 // `parseHashParam()` (private)37 // Checks hash parameters for severity overrides38 // Arguments39 // `param` - a url hash parameter (`validationError`, `validationWarning`, or `validationDisable`)40 // Returns41 // Array of Objects like { type: RegExp, subtype: RegExp }42 //43 function parseHashParam(param) {44 let result = [];45 let rules = (param || '').split(',');46 rules.forEach(rule => {47 rule = rule.trim();48 const parts = rule.split('/', 2); // "type/subtype"49 const type = parts[0];50 const subtype = parts[1] || '*';51 if (!type || !subtype) return;52 result.push({ type: makeRegExp(type), subtype: makeRegExp(subtype) });53 });54 return result;55 function makeRegExp(str) {56 const escaped = str57 .replace(/[-\/\\^$+?.()|[\]{}]/g, '\\$&') // escape all reserved chars except for the '*'58 .replace(/\*/g, '.*'); // treat a '*' like '.*'59 return new RegExp('^' + escaped + '$');60 }61 }62 // `init()`63 // Initialize the validator, called once on iD startup64 //65 validator.init = () => {66 Object.values(Validations).forEach(validation => {67 if (typeof validation !== 'function') return;68 const fn = validation(context);69 const key = fn.type;70 _rules[key] = fn;71 });72 let disabledRules = prefs('validate-disabledRules');73 if (disabledRules) {74 disabledRules.split(',').forEach(k => _disabledRules[k] = true);75 }76 };77 // `reset()` (private)78 // Cancels deferred work and resets all caches79 //80 // Arguments81 // `resetIgnored` - `true` to clear the list of user-ignored issues82 //83 function reset(resetIgnored) {84 // empty queues85 _baseCache.queue = [];86 _headCache.queue = [];87 // cancel deferred work and reject any pending promise88 Object.keys(_deferredRIC).forEach(key => {89 window.cancelIdleCallback(key);90 _deferredRIC[key]();91 });92 _deferredRIC = {};93 _deferredST.forEach(window.clearTimeout);94 _deferredST.clear();95 // clear caches96 if (resetIgnored) _ignoredIssueIDs.clear();97 _resolvedIssueIDs.clear();98 _baseCache = validationCache('base');99 _headCache = validationCache('head');100 _completeDiff = {};101 _headIsCurrent = false;102 }103 // `reset()`104 // clear caches, called whenever iD resets after a save or switches sources105 // (clears out the _ignoredIssueIDs set also)106 //107 validator.reset = () => {108 reset(true);109 };110 // `resetIgnoredIssues()`111 // clears out the _ignoredIssueIDs Set112 //113 validator.resetIgnoredIssues = () => {114 _ignoredIssueIDs.clear();115 dispatch.call('validated'); // redraw UI116 };117 // `revalidateUnsquare()`118 // Called whenever the user changes the unsquare threshold119 // It reruns just the "unsquare_way" validation on all buildings.120 //121 validator.revalidateUnsquare = () => {122 revalidateUnsquare(_headCache);123 revalidateUnsquare(_baseCache);124 dispatch.call('validated');125 };126 function revalidateUnsquare(cache) {127 const checkUnsquareWay = _rules.unsquare_way;128 if (!cache.graph || typeof checkUnsquareWay !== 'function') return;129 // uncache existing130 cache.uncacheIssuesOfType('unsquare_way');131 const buildings = context.history().tree().intersects(geoExtent([-180,-90],[180, 90]), cache.graph) // everywhere132 .filter(entity => (entity.type === 'way' && entity.tags.building && entity.tags.building !== 'no'));133 // rerun for all buildings134 buildings.forEach(entity => {135 const detected = checkUnsquareWay(entity, cache.graph);136 if (!detected.length) return;137 cache.cacheIssues(detected);138 });139 }140 // `getIssues()`141 // Gets all issues that match the given options142 // This is called by many other places143 //144 // Arguments145 // `options` Object like:146 // {147 // what: 'all', // 'all' or 'edited'148 // where: 'all', // 'all' or 'visible'149 // includeIgnored: false, // true, false, or 'only'150 // includeDisabledRules: false // true, false, or 'only'151 // }152 //153 // Returns154 // An Array containing the issues155 //156 validator.getIssues = (options) => {157 const opts = Object.assign({ what: 'all', where: 'all', includeIgnored: false, includeDisabledRules: false }, options);158 const view = context.map().extent();159 let seen = new Set();160 let results = [];161 // collect head issues - present in the user edits162 if (_headCache.graph && _headCache.graph !== _baseCache.graph) {163 Object.values(_headCache.issuesByIssueID).forEach(issue => {164 // In the head cache, only count features that the user is responsible for - #8632165 // For example, a user can undo some work and an issue will still present in the166 // head graph, but we don't want to credit the user for causing that issue.167 const userModified = (issue.entityIds || []).some(id => _completeDiff.hasOwnProperty(id));168 if (opts.what === 'edited' && !userModified) return; // present in head but user didn't touch it169 if (!filter(issue)) return;170 seen.add(issue.id);171 results.push(issue);172 });173 }174 // collect base issues - present before user edits175 if (opts.what === 'all') {176 Object.values(_baseCache.issuesByIssueID).forEach(issue => {177 if (!filter(issue)) return;178 seen.add(issue.id);179 results.push(issue);180 });181 }182 return results;183 // Filter the issue set to include only what the calling code wants to see.184 // Note that we use `context.graph()`/`context.hasEntity()` here, not `cache.graph`,185 // because that is the graph that the calling code will be using.186 function filter(issue) {187 if (!issue) return false;188 if (seen.has(issue.id)) return false;189 if (_resolvedIssueIDs.has(issue.id)) return false;190 if (opts.includeDisabledRules === 'only' && !_disabledRules[issue.type]) return false;191 if (!opts.includeDisabledRules && _disabledRules[issue.type]) return false;192 if (opts.includeIgnored === 'only' && !_ignoredIssueIDs.has(issue.id)) return false;193 if (!opts.includeIgnored && _ignoredIssueIDs.has(issue.id)) return false;194 // This issue may involve an entity that doesn't exist in context.graph()195 // This can happen because validation is async and rendering the issue lists is async.196 if ((issue.entityIds || []).some(id => !context.hasEntity(id))) return false;197 if (opts.where === 'visible') {198 const extent = issue.extent(context.graph());199 if (!view.intersects(extent)) return false;200 }201 return true;202 }203 };204 // `getResolvedIssues()`205 // Gets the issues that have been fixed by the user.206 //207 // Resolved issues are tracked in the `_resolvedIssueIDs` Set,208 // and they should all be issues that exist in the _baseCache.209 //210 // Returns211 // An Array containing the issues212 //213 validator.getResolvedIssues = () => {214 return Array.from(_resolvedIssueIDs)215 .map(issueID => _baseCache.issuesByIssueID[issueID])216 .filter(Boolean);217 };218 // `focusIssue()`219 // Adjusts the map to focus on the given issue.220 // (requires the issue to have a reasonable extent defined)221 //222 // Arguments223 // `issue` - the issue to focus on224 //225 validator.focusIssue = (issue) => {226 // Note that we use `context.graph()`/`context.hasEntity()` here, not `cache.graph`,227 // because that is the graph that the calling code will be using.228 const graph = context.graph();229 let selectID;230 let focusCenter;231 // Try to focus the map at the center of the issue..232 const issueExtent = issue.extent(graph);233 if (issueExtent) {234 focusCenter = issueExtent.center();235 }236 // Try to select the first entity in the issue..237 if (issue.entityIds && issue.entityIds.length) {238 selectID = issue.entityIds[0];239 // If a relation, focus on one of its members instead.240 // Otherwise we might be focusing on a part of map where the relation is not visible.241 if (selectID && selectID.charAt(0) === 'r') { // relation242 const ids = utilEntityAndDeepMemberIDs([selectID], graph);243 let nodeID = ids.find(id => id.charAt(0) === 'n' && graph.hasEntity(id));244 if (!nodeID) { // relation has no downloaded nodes to focus on245 const wayID = ids.find(id => id.charAt(0) === 'w' && graph.hasEntity(id));246 if (wayID) {247 nodeID = graph.entity(wayID).first(); // focus on the first node of this way248 }249 }250 if (nodeID) {251 focusCenter = graph.entity(nodeID).loc;252 }253 }254 }255 if (focusCenter) { // Adjust the view256 const setZoom = Math.max(context.map().zoom(), 19);257 context.map().unobscuredCenterZoomEase(focusCenter, setZoom);258 }259 if (selectID) { // Enter select mode260 window.setTimeout(() => {261 context.enter(modeSelect(context, [selectID]));262 dispatch.call('focusedIssue', this, issue);263 }, 250); // after ease264 }265 };266 // `getIssuesBySeverity()`267 // Gets the issues then groups them by error/warning268 // (This just calls getIssues, then puts issues in groups)269 //270 // Arguments271 // `options` - (see `getIssues`)272 // Returns273 // Object result like:274 // {275 // error: Array of errors,276 // warning: Array of warnings277 // }278 //279 validator.getIssuesBySeverity = (options) => {280 let groups = utilArrayGroupBy(validator.getIssues(options), 'severity');281 groups.error = groups.error || [];282 groups.warning = groups.warning || [];283 return groups;284 };285 // `getEntityIssues()`286 // Gets the issues that the given entity IDs have in common, matching the given options287 // (This just calls getIssues, then filters for the given entity IDs)288 // The issues are sorted for relevance289 //290 // Arguments291 // `entityIDs` - Array or Set of entityIDs to get issues for292 // `options` - (see `getIssues`)293 // Returns294 // An Array containing the issues295 //296 validator.getSharedEntityIssues = (entityIDs, options) => {297 const orderedIssueTypes = [ // Show some issue types in a particular order:298 'missing_tag', 'missing_role', // - missing data first299 'outdated_tags', 'mismatched_geometry', // - identity issues300 'crossing_ways', 'almost_junction', // - geometry issues where fixing them might solve connectivity issues301 'disconnected_way', 'impossible_oneway' // - finally connectivity issues302 ];303 const allIssues = validator.getIssues(options);304 const forEntityIDs = new Set(entityIDs);305 return allIssues306 .filter(issue => (issue.entityIds || []).some(entityID => forEntityIDs.has(entityID)))307 .sort((issue1, issue2) => {308 if (issue1.type === issue2.type) { // issues of the same type, sort deterministically309 return issue1.id < issue2.id ? -1 : 1;310 }311 const index1 = orderedIssueTypes.indexOf(issue1.type);312 const index2 = orderedIssueTypes.indexOf(issue2.type);313 if (index1 !== -1 && index2 !== -1) { // both issue types have explicit sort orders314 return index1 - index2;315 } else if (index1 === -1 && index2 === -1) { // neither issue type has an explicit sort order, sort by type316 return issue1.type < issue2.type ? -1 : 1;317 } else { // order explicit types before everything else318 return index1 !== -1 ? -1 : 1;319 }320 });321 };322 // `getEntityIssues()`323 // Get an array of detected issues for the given entityID.324 // (This just calls getSharedEntityIssues for a single entity)325 //326 // Arguments327 // `entityID` - the entity ID to get the issues for328 // `options` - (see `getIssues`)329 // Returns330 // An Array containing the issues331 //332 validator.getEntityIssues = (entityID, options) => {333 return validator.getSharedEntityIssues([entityID], options);334 };335 // `getRuleKeys()`336 //337 // Returns338 // An Array containing the rule keys339 //340 validator.getRuleKeys = () => {341 return Object.keys(_rules);342 };343 // `isRuleEnabled()`344 //345 // Arguments346 // `key` - the rule to check (e.g. 'crossing_ways')347 // Returns348 // `true`/`false`349 //350 validator.isRuleEnabled = (key) => {351 return !_disabledRules[key];352 };353 // `toggleRule()`354 // Toggles a single validation rule,355 // then reruns the validation so that the user sees something happen in the UI356 //357 // Arguments358 // `key` - the rule to toggle (e.g. 'crossing_ways')359 //360 validator.toggleRule = (key) => {361 if (_disabledRules[key]) {362 delete _disabledRules[key];363 } else {364 _disabledRules[key] = true;365 }366 prefs('validate-disabledRules', Object.keys(_disabledRules).join(','));367 validator.validate();368 };369 // `disableRules()`370 // Disables given validation rules,371 // then reruns the validation so that the user sees something happen in the UI372 //373 // Arguments374 // `keys` - Array or Set containing rule keys to disable375 //376 validator.disableRules = (keys) => {377 _disabledRules = {};378 keys.forEach(k => _disabledRules[k] = true);379 prefs('validate-disabledRules', Object.keys(_disabledRules).join(','));380 validator.validate();381 };382 // `ignoreIssue()`383 // Don't show the given issue in lists384 //385 // Arguments386 // `issueID` - the issueID387 //388 validator.ignoreIssue = (issueID) => {389 _ignoredIssueIDs.add(issueID);390 };391 // `validate()`392 // Validates anything that has changed in the head graph since the last time it was run.393 // (head graph contains user's edits)394 //395 // Returns396 // A Promise fulfilled when the validation has completed and then dispatches a `validated` event.397 // This may take time but happen in the background during browser idle time.398 //399 validator.validate = () => {400 // Make sure the caches have graphs assigned to them.401 // (we don't do this in `reset` because context is still resetting things and `history.base()` is unstable then)402 const baseGraph = context.history().base();403 if (!_headCache.graph) _headCache.graph = baseGraph;404 if (!_baseCache.graph) _baseCache.graph = baseGraph;405 const prevGraph = _headCache.graph;406 const currGraph = context.graph();407 if (currGraph === prevGraph) { // _headCache.graph is current - we are caught up408 _headIsCurrent = true;409 dispatch.call('validated');410 return Promise.resolve();411 }412 if (_headPromise) { // Validation already in process, but we aren't caught up to current413 _headIsCurrent = false; // We will need to catch up after the validation promise fulfills414 return _headPromise;415 }416 // If we get here, its time to start validating stuff.417 _headCache.graph = currGraph; // take snapshot418 _completeDiff = context.history().difference().complete();419 const incrementalDiff = coreDifference(prevGraph, currGraph);420 let entityIDs = Object.keys(incrementalDiff.complete());421 entityIDs = _headCache.withAllRelatedEntities(entityIDs); // expand set422 if (!entityIDs.size) {423 dispatch.call('validated');424 return Promise.resolve();425 }426 _headPromise = validateEntitiesAsync(entityIDs, _headCache)427 .then(() => updateResolvedIssues(entityIDs))428 .then(() => dispatch.call('validated'))429 .catch(() => { /* ignore */ })430 .then(() => {431 _headPromise = null;432 if (!_headIsCurrent) {433 validator.validate(); // run it again to catch up to current graph434 }435 });436 return _headPromise;437 };438 // register event handlers:439 // WHEN TO RUN VALIDATION:440 // When history changes:441 context.history()442 .on('restore.validator', validator.validate) // on restore saved history443 .on('undone.validator', validator.validate) // on undo444 .on('redone.validator', validator.validate) // on redo445 .on('reset.validator', () => { // on history reset - happens after save, or enter/exit walkthrough446 reset(false); // cached issues aren't valid any longer if the history has been reset447 validator.validate();448 });449 // but not on 'change' (e.g. while drawing)450 // When user changes editing modes (to catch recent changes e.g. drawing)451 context452 .on('exit.validator', validator.validate);453 // When merging fetched data, validate base graph:454 context.history()455 .on('merge.validator', entities => {456 if (!entities) return;457 // Make sure the caches have graphs assigned to them.458 // (we don't do this in `reset` because context is still resetting things and `history.base()` is unstable then)459 const baseGraph = context.history().base();460 if (!_headCache.graph) _headCache.graph = baseGraph;461 if (!_baseCache.graph) _baseCache.graph = baseGraph;462 let entityIDs = entities.map(entity => entity.id);463 entityIDs = _baseCache.withAllRelatedEntities(entityIDs); // expand set464 validateEntitiesAsync(entityIDs, _baseCache);465 });466 // `validateEntity()` (private)467 // Runs all validation rules on a single entity.468 // Some things to note:469 // - Graph is passed in from whenever the validation was started. Validators shouldn't use470 // `context.graph()` because this all happens async, and the graph might have changed471 // (for example, nodes getting deleted before the validation can run)472 // - Validator functions may still be waiting on something and return a "provisional" result.473 // In this situation, we will schedule to revalidate the entity sometime later.474 //475 // Arguments476 // `entity` - The entity477 // `graph` - graph containing the entity478 //479 // Returns480 // Object result like:481 // {482 // issues: Array of detected issues483 // provisional: `true` if provisional result, `false` if final result484 // }485 //486 function validateEntity(entity, graph) {487 let result = { issues: [], provisional: false };488 Object.keys(_rules).forEach(runValidation); // run all rules489 return result;490 // runs validation and appends resulting issues491 function runValidation(key) {492 const fn = _rules[key];493 if (typeof fn !== 'function') {494 console.error('no such validation rule = ' + key); // eslint-disable-line no-console495 return;496 }497 let detected = fn(entity, graph);498 if (detected.provisional) { // this validation should be run again later499 result.provisional = true;500 }501 detected = detected.filter(applySeverityOverrides);502 result.issues = result.issues.concat(detected);503 // If there are any override rules that match the issue type/subtype,504 // adjust severity (or disable it) and keep/discard as quickly as possible.505 function applySeverityOverrides(issue) {506 const type = issue.type;507 const subtype = issue.subtype || '';508 let i;509 for (i = 0; i < _errorOverrides.length; i++) {510 if (_errorOverrides[i].type.test(type) && _errorOverrides[i].subtype.test(subtype)) {511 issue.severity = 'error';512 return true;513 }514 }515 for (i = 0; i < _warningOverrides.length; i++) {516 if (_warningOverrides[i].type.test(type) && _warningOverrides[i].subtype.test(subtype)) {517 issue.severity = 'warning';518 return true;519 }520 }521 for (i = 0; i < _disableOverrides.length; i++) {522 if (_disableOverrides[i].type.test(type) && _disableOverrides[i].subtype.test(subtype)) {523 return false;524 }525 }526 return true;527 }528 }529 }530 // `updateResolvedIssues()` (private)531 // Determine if any issues were resolved for the given entities.532 // This is called by `validate()` after validation of the head graph533 //534 // Give the user credit for fixing an issue if:535 // - the issue is in the base cache536 // - the issue is not in the head cache537 // - the user did something to one of the entities involved in the issue538 //539 // Arguments540 // `entityIDs` - Array or Set containing entity IDs.541 //542 function updateResolvedIssues(entityIDs) {543 entityIDs.forEach(entityID => {544 const baseIssues = _baseCache.issuesByEntityID[entityID];545 if (!baseIssues) return;546 baseIssues.forEach(issueID => {547 // Check if the user did something to one of the entities involved in this issue.548 // (This issue could involve multiple entities, e.g. disconnected routable features)549 const issue = _baseCache.issuesByIssueID[issueID];550 const userModified = (issue.entityIds || []).some(id => _completeDiff.hasOwnProperty(id));551 if (userModified && !_headCache.issuesByIssueID[issueID]) { // issue seems fixed552 _resolvedIssueIDs.add(issueID);553 } else { // issue still not resolved554 _resolvedIssueIDs.delete(issueID); // (did undo, or possibly fixed and then re-caused the issue)555 }556 });557 });558 }559 // `validateEntitiesAsync()` (private)560 // Schedule validation for many entities.561 //562 // Arguments563 // `entityIDs` - Array or Set containing entityIDs.564 // `graph` - the graph to validate that contains those entities565 // `cache` - the cache to store results in (_headCache or _baseCache)566 //567 // Returns568 // A Promise fulfilled when the validation has completed.569 // This may take time but happen in the background during browser idle time.570 //571 function validateEntitiesAsync(entityIDs, cache) {572 // Enqueue the work573 const jobs = Array.from(entityIDs).map(entityID => {574 if (cache.queuedEntityIDs.has(entityID)) return null; // queued already575 cache.queuedEntityIDs.add(entityID);576 // Clear caches for existing issues related to this entity577 cache.uncacheEntityID(entityID);578 return () => {579 cache.queuedEntityIDs.delete(entityID);580 const graph = cache.graph;581 if (!graph) return; // was reset?582 const entity = graph.hasEntity(entityID); // Sanity check: don't validate deleted entities583 if (!entity) return;584 // detect new issues and update caches585 const result = validateEntity(entity, graph);586 if (result.provisional) { // provisional result587 cache.provisionalEntityIDs.add(entityID); // we'll need to revalidate this entity again later588 }589 cache.cacheIssues(result.issues); // update cache590 };591 }).filter(Boolean);592 // Perform the work in chunks.593 // Because this will happen during idle callbacks, we want to choose a chunk size594 // that won't make the browser stutter too badly.595 cache.queue = cache.queue.concat(utilArrayChunk(jobs, 100));596 // Perform the work597 if (cache.queuePromise) return cache.queuePromise;598 cache.queuePromise = processQueue(cache)599 .then(() => revalidateProvisionalEntities(cache))600 .catch(() => { /* ignore */ })601 .finally(() => cache.queuePromise = null);602 return cache.queuePromise;603 }604 // `revalidateProvisionalEntities()` (private)605 // Sometimes a validator will return a "provisional" result.606 // In this situation, we'll need to revalidate the entity later.607 // This function waits a delay, then places them back into the validation queue.608 //609 // Arguments610 // `cache` - The cache (_headCache or _baseCache)611 //612 function revalidateProvisionalEntities(cache) {613 if (!cache.provisionalEntityIDs.size) return; // nothing to do614 const handle = window.setTimeout(() => {615 _deferredST.delete(handle);616 if (!cache.provisionalEntityIDs.size) return; // nothing to do617 validateEntitiesAsync(Array.from(cache.provisionalEntityIDs), cache);618 }, RETRY);619 _deferredST.add(handle);620 }621 // `processQueue(queue)` (private)622 // Process the next chunk of deferred validation work623 //624 // Arguments625 // `cache` - The cache (_headCache or _baseCache)626 //627 // Returns628 // A Promise fulfilled when the validation has completed.629 // This may take time but happen in the background during browser idle time.630 //631 function processQueue(cache) {632 // console.log(`${cache.which} queue length ${cache.queue.length}`);633 if (!cache.queue.length) return Promise.resolve(); // we're done634 const chunk = cache.queue.pop();635 return new Promise((resolvePromise, rejectPromise) => {636 const handle = window.requestIdleCallback(() => {637 delete (_deferredRIC[handle]);638 // const t0 = performance.now();639 chunk.forEach(job => job());640 // const t1 = performance.now();641 // console.log('chunk processed in ' + (t1 - t0) + ' ms');642 resolvePromise();643 });644 _deferredRIC[handle] = rejectPromise;645 })646 .then(() => { // dispatch an event sometimes to redraw various UI things647 if (cache.queue.length % 25 === 0) dispatch.call('validated');648 })649 .then(() => processQueue(cache));650 }651 return validator;652}653// `validationCache()` (private)654// Creates a cache to store validation state655// We create 2 of these:656// `_baseCache` for validation on the base graph (unedited)657// `_headCache` for validation on the head graph (user edits applied)658//659// Arguments660// `which` - just a String 'base' or 'head' to keep track of it661//662function validationCache(which) {663 let cache = {664 which: which,665 graph: null,666 queue: [],667 queuePromise: null,668 queuedEntityIDs: new Set(),669 provisionalEntityIDs: new Set(),670 issuesByIssueID: {}, // issue.id -> issue671 issuesByEntityID: {} // entity.id -> Set(issue.id)672 };673 cache.cacheIssue = (issue) => {674 (issue.entityIds || []).forEach(entityID => {675 if (!cache.issuesByEntityID[entityID]) {676 cache.issuesByEntityID[entityID] = new Set();677 }678 cache.issuesByEntityID[entityID].add(issue.id);679 });680 cache.issuesByIssueID[issue.id] = issue;681 };682 cache.uncacheIssue = (issue) => {683 (issue.entityIds || []).forEach(entityID => {684 if (cache.issuesByEntityID[entityID]) {685 cache.issuesByEntityID[entityID].delete(issue.id);686 }687 });688 delete cache.issuesByIssueID[issue.id];689 };690 cache.cacheIssues = (issues) => {691 issues.forEach(cache.cacheIssue);692 };693 cache.uncacheIssues = (issues) => {694 issues.forEach(cache.uncacheIssue);695 };696 cache.uncacheIssuesOfType = (type) => {697 const issuesOfType = Object.values(cache.issuesByIssueID)698 .filter(issue => issue.type === type);699 cache.uncacheIssues(issuesOfType);700 };701 // Remove a single entity and all its related issues from the caches702 cache.uncacheEntityID = (entityID) => {703 const entityIssueIDs = cache.issuesByEntityID[entityID];704 if (entityIssueIDs) {705 entityIssueIDs.forEach(issueID => {706 const issue = cache.issuesByIssueID[issueID];707 if (issue) {708 cache.uncacheIssue(issue);709 } else { // shouldn't happen, clean up710 delete cache.issuesByIssueID[issueID];711 }712 });713 }714 delete cache.issuesByEntityID[entityID];715 cache.provisionalEntityIDs.delete(entityID);716 };717 // Return the expandeded set of entityIDs related to issues for the given entityIDs718 //719 // Arguments720 // `entityIDs` - Array or Set containing entityIDs.721 //722 cache.withAllRelatedEntities = (entityIDs) => {723 let result = new Set();724 (entityIDs || []).forEach(entityID => {725 result.add(entityID); // include self726 const entityIssueIDs = cache.issuesByEntityID[entityID];727 if (entityIssueIDs) {728 entityIssueIDs.forEach(issueID => {729 const issue = cache.issuesByIssueID[issueID];730 if (issue) {731 (issue.entityIds || []).forEach(relatedID => result.add(relatedID));732 } else { // shouldn't happen, clean up733 delete cache.issuesByIssueID[issueID];734 }735 });736 }737 });738 return result;739 };740 return cache;...
mutant-test-planner.ts
Source:mutant-test-planner.ts
...48 ) {49 this.timeSpentAllTests = calculateTotalTime(this.testCoverage.testsById.values());50 }51 public async makePlan(mutants: readonly Mutant[]): Promise<readonly MutantTestPlan[]> {52 const mutantsDiff = await this.incrementalDiff(mutants);53 const mutantPlans = mutantsDiff.map((mutant) => this.planMutant(mutant));54 this.reporter.onMutationTestingPlanReady({ mutantPlans });55 this.warnAboutSlow(mutantPlans);56 return mutantPlans;57 }58 private planMutant(mutant: Mutant): MutantTestPlan {59 const isStatic = this.testCoverage.hasStaticCoverage(mutant.id);60 if (mutant.status) {61 // If this mutant was already ignored, early result62 return this.createMutantEarlyResultPlan(mutant, {63 isStatic,64 coveredBy: mutant.coveredBy,65 killedBy: mutant.killedBy,66 status: mutant.status,67 statusReason: mutant.statusReason,68 });69 } else if (this.testCoverage.hasCoverage) {70 // If there was coverage information (coverageAnalysis not "off")71 const tests = this.testCoverage.testsByMutantId.get(mutant.id) ?? [];72 const coveredBy = toTestIds(tests);73 if (!isStatic || (this.options.ignoreStatic && coveredBy.length)) {74 // If not static, or it was "hybrid" (both static and perTest coverage) and ignoreStatic is on.75 // Only run covered tests with mutant active during runtime76 const netTime = calculateTotalTime(tests);77 return this.createMutantRunPlan(mutant, { netTime, coveredBy, isStatic, testFilter: coveredBy });78 } else if (this.options.ignoreStatic) {79 // Static (w/o perTest coverage) and ignoreStatic is on -> Ignore.80 return this.createMutantEarlyResultPlan(mutant, {81 status: MutantStatus.Ignored,82 statusReason: 'Static mutant (and "ignoreStatic" was enabled)',83 isStatic,84 coveredBy,85 });86 } else {87 // Static (or hybrid) and `ignoreStatic` is off -> run all tests88 return this.createMutantRunPlan(mutant, { netTime: this.timeSpentAllTests, isStatic, coveredBy });89 }90 } else {91 // No coverage information exists, all tests need to run92 return this.createMutantRunPlan(mutant, { netTime: this.timeSpentAllTests });93 }94 }95 private createMutantEarlyResultPlan(96 mutant: Mutant,97 {98 isStatic,99 status,100 statusReason,101 coveredBy,102 killedBy,103 }: { isStatic: boolean | undefined; status: MutantStatus; statusReason?: string; coveredBy?: string[]; killedBy?: string[] }104 ): MutantEarlyResultPlan {105 return {106 plan: PlanKind.EarlyResult,107 mutant: {108 ...mutant,109 status,110 static: isStatic,111 statusReason,112 coveredBy,113 killedBy,114 },115 };116 }117 private createMutantRunPlan(118 mutant: Mutant,119 {120 netTime,121 testFilter,122 isStatic,123 coveredBy,124 }: { netTime: number; testFilter?: string[] | undefined; isStatic?: boolean | undefined; coveredBy?: string[] | undefined }125 ): MutantRunPlan {126 const { disableBail, timeoutMS, timeoutFactor } = this.options;127 const timeout = timeoutFactor * netTime + timeoutMS + this.timeOverheadMS;128 const hitCount = this.testCoverage.hitsByMutantId.get(mutant.id);129 const hitLimit = hitCount === undefined ? undefined : hitCount * HIT_LIMIT_FACTOR;130 return {131 plan: PlanKind.Run,132 netTime,133 mutant: {134 ...mutant,135 coveredBy,136 static: isStatic,137 },138 runOptions: {139 // Copy over relevant mutant fields, we don't want to copy over "static" and "coveredBy", test runners should only care about the testFilter140 activeMutant: {141 id: mutant.id,142 fileName: mutant.fileName,143 location: mutant.location,144 mutatorName: mutant.mutatorName,145 replacement: mutant.replacement,146 },147 mutantActivation: testFilter ? 'runtime' : 'static',148 timeout,149 testFilter,150 sandboxFileName: this.sandbox.sandboxFileFor(mutant.fileName),151 hitLimit,152 disableBail,153 reloadEnvironment: !testFilter,154 },155 };156 }157 private warnAboutSlow(mutantPlans: readonly MutantTestPlan[]) {158 if (!this.options.ignoreStatic && objectUtils.isWarningEnabled('slow', this.options.warnings)) {159 // Only warn when the estimated time to run all static mutants exceeds 40%160 // ... and when the average performance impact of a static mutant is estimated to be twice that (or more) of a non-static mutant161 const ABSOLUTE_CUT_OFF_PERUNAGE = 0.4;162 const RELATIVE_CUT_OFF_FACTOR = 2;163 const zeroIfNaN = (n: number) => (isNaN(n) ? 0 : n);164 const runPlans = mutantPlans.filter(isRunPlan);165 const staticRunPlans = runPlans.filter(({ mutant }) => mutant.static);166 const runTimeRunPlans = runPlans.filter(({ mutant }) => !mutant.static);167 const estimatedTimeForStaticMutants = staticRunPlans.reduce((acc, { netTime }) => acc + netTime, 0);168 const estimatedTimeForRunTimeMutants = runTimeRunPlans.reduce((acc, { netTime }) => acc + netTime, 0);169 const estimatedTotalTime = estimatedTimeForRunTimeMutants + estimatedTimeForStaticMutants;170 const avgTimeForAStaticMutant = zeroIfNaN(estimatedTimeForStaticMutants / staticRunPlans.length);171 const avgTimeForARunTimeMutant = zeroIfNaN(estimatedTimeForRunTimeMutants / runTimeRunPlans.length);172 const relativeTimeForStaticMutants = estimatedTimeForStaticMutants / estimatedTotalTime;173 const absoluteCondition = relativeTimeForStaticMutants >= ABSOLUTE_CUT_OFF_PERUNAGE;174 const relativeCondition = avgTimeForAStaticMutant >= RELATIVE_CUT_OFF_FACTOR * avgTimeForARunTimeMutant;175 if (relativeCondition && absoluteCondition) {176 const percentage = (perunage: number) => Math.round(perunage * 100);177 this.logger.warn(178 `Detected ${staticRunPlans.length} static mutants (${percentage(179 staticRunPlans.length / runPlans.length180 )}% of total) that are estimated to take ${percentage(181 relativeTimeForStaticMutants182 )}% of the time running the tests!\n You might want to enable "ignoreStatic" to ignore these static mutants for your next run. \n For more information about static mutants visit: https://stryker-mutator.io/docs/mutation-testing-elements/static-mutants.\n (disable "${optionsPath(183 'warnings',184 'slow'185 )}" to ignore this warning)`186 );187 }188 }189 }190 private async incrementalDiff(currentMutants: readonly Mutant[]): Promise<readonly Mutant[]> {191 const { incrementalReport } = this.project;192 if (incrementalReport) {193 const currentFiles = await this.readAllOriginalFiles(194 currentMutants,195 this.testCoverage.testsById.values(),196 Object.keys(incrementalReport.files),197 Object.keys(incrementalReport.testFiles ?? {})198 );199 const diffedMutants = this.incrementalDiffer.diff(currentMutants, this.testCoverage, incrementalReport, currentFiles);200 return diffedMutants;201 }202 return currentMutants;203 }204 private async readAllOriginalFiles(...
Using AI Code Generation
1const incrementalDiff = require('stryker-parent').incrementalDiff;2const diff = incrementalDiff();3console.log(diff);4const incrementalDiff = require('stryker-parent').incrementalDiff;5const diff = incrementalDiff();6console.log(diff);7const incrementalDiff = require('stryker-parent').incrementalDiff;8const diff = incrementalDiff();9console.log(diff);10const incrementalDiff = require('stryker-parent').incrementalDiff;11const diff = incrementalDiff();12console.log(diff);13const incrementalDiff = require('stryker-parent').incrementalDiff;14const diff = incrementalDiff();15console.log(diff);16const incrementalDiff = require('stryker-parent').incrementalDiff;17const diff = incrementalDiff();18console.log(diff);19const incrementalDiff = require('stryker-parent').incrementalDiff;20const diff = incrementalDiff();21console.log(diff);22const incrementalDiff = require('stryker-parent').incrementalDiff;23const diff = incrementalDiff();24console.log(diff);25const incrementalDiff = require('stryker-parent').incrementalDiff;26const diff = incrementalDiff();27console.log(diff);28const incrementalDiff = require('stryker-parent').incrementalDiff;29const diff = incrementalDiff();30console.log(diff);31const incrementalDiff = require('stryker-parent').incrementalDiff;32const diff = incrementalDiff();33console.log(diff);34const incrementalDiff = require('stryker-parent').incrementalDiff;
Using AI Code Generation
1const { incrementalDiff } = require('stryker-parent');2const { diff } = require('jest-diff');3const { readFileSync } = require('fs');4const oldFile = readFileSync('old.js', 'utf8');5const newFile = readFileSync('new.js', 'utf8');6const diffResult = incrementalDiff(oldFile, newFile);7const jestDiffResult = diff(oldFile, newFile);8console.log('diffResult', diffResult);9console.log('jestDiffResult', jestDiffResult);10diffResult { diff: ' const b = 1;11+const c = 2;12', deletedLines: 1, insertedLines: 1 }13jestDiffResult - const b = 1;14+const c = 2;15const { incrementalDiff } = require('stryker-parent');16const { diff } = require('jest-diff');17const { readFileSync } = require('fs');18const oldFile = readFileSync('old.js', 'utf8').replace(/\r/g, '');19const newFile = readFileSync('new.js', 'utf8').replace(/\r/g, '');20const diffResult = incrementalDiff(oldFile, newFile);21const jestDiffResult = diff(oldFile, newFile);22console.log('diffResult', diffResult);23console.log('jestDiffResult', jestDiffResult);
Using AI Code Generation
1const incrementalDiff = require('stryker-parent').incrementalDiff;2const diff = incrementalDiff(['a.js', 'b.js'], ['a.js', 'c.js']);3console.log(diff);4const incrementalDiff = require('stryker-parent').incrementalDiff;5const diff = incrementalDiff(['a.js', 'b.js'], ['a.js', 'c.js']);6console.log(diff);7const incrementalDiff = require('stryker-parent').incrementalDiff;8const diff = incrementalDiff(['a.js', 'b.js'], ['a.js', 'c.js']);9console.log(diff);10const incrementalDiff = require('stryker-parent').incrementalDiff;11const diff = incrementalDiff(['a.js', 'b.js'], ['a.js', 'c.js']);12console.log(diff);13const incrementalDiff = require('stryker-parent').incrementalDiff;14const diff = incrementalDiff(['a.js', 'b.js'], ['a.js', 'c.js']);15console.log(diff);16const incrementalDiff = require('stryker-parent').incrementalDiff;17const diff = incrementalDiff(['a.js', 'b.js'], ['a.js', 'c.js']);18console.log(diff);19const incrementalDiff = require('stryker-parent').incrementalDiff
Using AI Code Generation
1const incrementalDiff = require('stryker-parent').incrementalDiff;2const diff = incrementalDiff('1.0.0', '1.1.0');3console.log(diff);4const incrementalDiff = require('stryker-parent').incrementalDiff;5const diff = incrementalDiff('1.0.0', '1.1.0');6console.log(diff);7const incrementalDiff = require('stryker-parent').incrementalDiff;8const diff = incrementalDiff('1.0.0', '1.1.0');9console.log(diff);10const incrementalDiff = require('stryker-parent').incrementalDiff;11const diff = incrementalDiff('1.0.0', '1.1.0');12console.log(diff);13const incrementalDiff = require('stryker-parent').incrementalDiff;14const diff = incrementalDiff('1.0.0', '1.1.0');15console.log(diff);16const incrementalDiff = require('stryker-parent').incrementalDiff;17const diff = incrementalDiff('1.0.0', '1.1.0');18console.log(diff);19const incrementalDiff = require('stryker-parent').incrementalDiff;20const diff = incrementalDiff('1.0.0', '1.1.0');21console.log(diff);
Using AI Code Generation
1const stryker = require('stryker-parent');2const diff = stryker.incrementalDiff('test.js', 'test.js');3console.log(diff);4const stryker = require('stryker-parent');5const diff = stryker.incrementalDiff('test.js', 'test.js');6console.log(diff);7{ added: [ 'const stryker = require(\'stryker-parent\');', 'const diff = stryker.incrementalDiff(\'test.js\', \'test.js\');', '', 'console.log(diff);' ], removed: [], changed: [] }
Using AI Code Generation
1var incrementalDiff = require('stryker-parent').incrementalDiff;2var diff = incrementalDiff({3});4console.log(diff);5module.exports = {6 incrementalDiff: function (options) {7 }8};
Using AI Code Generation
1var incrementalDiff = require('stryker-parent').incrementalDiff;2var diffResult = incrementalDiff('firstString', 'secondString');3var incrementalDiff = require('stryker-parent').incrementalDiff;4var diffResult = incrementalDiff('firstString', 'secondString');5var incrementalDiff = require('stryker-parent').incrementalDiff;6var diffResult = incrementalDiff('firstString', 'secondString');7var incrementalDiff = require('stryker-parent').incrementalDiff;8var diffResult = incrementalDiff('firstString', 'secondString');9var incrementalDiff = require('stryker-parent').incrementalDiff;10var diffResult = incrementalDiff('firstString', 'secondString');11var incrementalDiff = require('stryker-parent').incrementalDiff;12var diffResult = incrementalDiff('firstString', 'secondString');13var incrementalDiff = require('stryker-parent').incrementalDiff;14var diffResult = incrementalDiff('firstString', 'secondString');15var incrementalDiff = require('stryker-parent').incrementalDiff;16var diffResult = incrementalDiff('firstString', 'secondString');17var incrementalDiff = require('stryker-parent').incrementalDiff;18var diffResult = incrementalDiff('firstString', 'secondString');19var incrementalDiff = require('stryker-parent').incrementalDiff;20var diffResult = incrementalDiff('firstString', 'secondString');
Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.
You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.
Get 100 minutes of automation test minutes FREE!!