@prefecthq/graphs 2.2.5 → 2.2.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -16,8 +16,8 @@ export declare const DEFAULT_HORIZONTAL_SCALE_MULTIPLIER = 0.25;
16
16
  export declare const DEFAULT_HORIZONTAL_SCALE = 1;
17
17
  export declare const DEFAULT_GUIDES_COUNT = 30;
18
18
  export declare const DEFAULT_GUIDES_MIN_GAP = 260;
19
- export declare const DEFAULT_ROOT_ARTIFACT_BOTTOM_OFFSET = 10;
20
- export declare const DEFAULT_ROOT_ARTIFACT_COLLISION_THROTTLE = 250;
19
+ export declare const DEFAULT_ROOT_COLLISION_THROTTLE = 250;
21
20
  export declare const DEFAULT_VIEWPORT_Z_INDEX = 1;
22
21
  export declare const DEFAULT_ROOT_FLOW_STATE_Z_INDEX = 2;
23
- export declare const DEFAULT_ROOT_ARTIFACT_Z_INDEX = 3;
22
+ export declare const DEFAULT_ROOT_EVENT_Z_INDEX = 3;
23
+ export declare const DEFAULT_ROOT_ARTIFACT_Z_INDEX = 4;
@@ -0,0 +1,3 @@
1
+ import { Sprite } from 'pixi.js';
2
+ import { CircleStyle } from '../textures/circle';
3
+ export declare function circleFactory(style: CircleStyle): Promise<Sprite>;
@@ -4,4 +4,5 @@ export declare function dataFactory(runId: string, callback: DataCallback): Prom
4
4
  start: () => Promise<void>;
5
5
  stop: () => void;
6
6
  }>;
7
+ export declare function getIntervalForDataSize(data: RunGraphData): number;
7
8
  export {};
@@ -0,0 +1,9 @@
1
+ import { Container } from 'pixi.js';
2
+ import { RunGraphEvent } from '../models';
3
+ export type EventFactory = Awaited<ReturnType<typeof eventFactory>>;
4
+ export declare function eventFactory(event: RunGraphEvent): Promise<{
5
+ element: Container<import("pixi.js").DisplayObject>;
6
+ render: () => void;
7
+ getId: () => string;
8
+ getDate: () => Date;
9
+ }>;
@@ -0,0 +1,12 @@
1
+ import { Container } from 'pixi.js';
2
+ export type EventClusterFactory = Awaited<ReturnType<typeof eventClusterFactory>>;
3
+ export type EventClusterFactoryRenderProps = {
4
+ ids: string[];
5
+ date: Date;
6
+ };
7
+ export declare function eventClusterFactory(): Promise<{
8
+ element: Container<import("pixi.js").DisplayObject>;
9
+ render: (props?: EventClusterFactoryRenderProps) => Promise<void>;
10
+ getIds: () => string[];
11
+ getDate: () => Date | null;
12
+ }>;
@@ -0,0 +1,7 @@
1
+ import { RunGraphEvent } from '../models';
2
+ type EventDataCallback = (data: RunGraphEvent[]) => void;
3
+ export declare function eventDataFactory(runId: string, callback: EventDataCallback): Promise<{
4
+ start: () => Promise<void>;
5
+ stop: () => void;
6
+ }>;
7
+ export {};
@@ -0,0 +1,17 @@
1
+ import { EventFactory } from '../factories/event';
2
+ import { EventClusterFactory } from '../factories/eventCluster';
3
+ import { RunGraphEvent } from '../models';
4
+ export type FlowRunEventFactory = Awaited<ReturnType<typeof flowRunEventFactory>>;
5
+ type EventFactoryOptions = {
6
+ type: 'event';
7
+ event: RunGraphEvent;
8
+ } | {
9
+ type: 'cluster';
10
+ };
11
+ type EventFactoryType<T> = T extends {
12
+ type: 'event';
13
+ } ? EventFactory : T extends {
14
+ type: 'cluster';
15
+ } ? EventClusterFactory : never;
16
+ export declare function flowRunEventFactory<T extends EventFactoryOptions>(options: T): Promise<EventFactoryType<T>>;
17
+ export {};
@@ -0,0 +1,4 @@
1
+ import { RunGraphEvent } from '../models';
2
+ export declare function flowRunEventsFactory(): Promise<{
3
+ render: (newData?: RunGraphEvent[]) => Promise<void>;
4
+ }>;
@@ -1,5 +1,5 @@
1
1
  import { ColorSource } from 'pixi.js';
2
- import { RunGraphArtifact } from '../models';
2
+ import { RunGraphArtifact, RunGraphEvent } from '../models';
3
3
  import { GraphItemSelection } from '../models/selection';
4
4
  import { RunGraphStateEvent, StateType } from '../models/states';
5
5
  import { ViewportDateRange } from '../models/viewport';
@@ -16,6 +16,7 @@ export type RunGraphData = {
16
16
  nodes: RunGraphNodes;
17
17
  artifacts?: RunGraphArtifact[];
18
18
  states?: RunGraphStateEvent[];
19
+ events?: RunGraphEvent[];
19
20
  };
20
21
  export type RunGraphNodes = Map<string, RunGraphNode>;
21
22
  export type RunGraphNode = {
@@ -36,6 +37,7 @@ export declare const runGraphNodeKinds: readonly ["flow-run", "task-run"];
36
37
  export type RunGraphNodeKind = typeof runGraphNodeKinds[number];
37
38
  export declare function isRunGraphNodeType(value: unknown): value is RunGraphNodeKind;
38
39
  export type RunGraphFetch = (runId: string) => RunGraphData | Promise<RunGraphData>;
40
+ export type RunGraphFetchEvents = (runId: string) => RunGraphEvent[] | Promise<RunGraphEvent[]>;
39
41
  export type RunGraphNodeStyles = {
40
42
  background?: ColorSource;
41
43
  };
@@ -77,6 +79,12 @@ export type RunGraphStyles = {
77
79
  flowStateBarHeight?: number;
78
80
  flowStateSelectedBarHeight?: number;
79
81
  flowStateAreaAlpha?: number;
82
+ eventTargetSize?: number;
83
+ eventSelectedBorderInset?: number;
84
+ eventRadiusDefault?: number;
85
+ eventColor?: ColorSource;
86
+ eventClusterRadiusDefault?: number;
87
+ eventClusterColor?: ColorSource;
80
88
  guideLineWidth?: number;
81
89
  guideLineColor?: ColorSource;
82
90
  guideTextTopPadding?: number;
@@ -91,6 +99,7 @@ export type RunGraphStyles = {
91
99
  export type RunGraphConfig = {
92
100
  runId: string;
93
101
  fetch: RunGraphFetch;
102
+ fetchEvents?: RunGraphFetchEvents;
94
103
  animationDuration?: number;
95
104
  styles?: RunGraphStyles;
96
105
  disableAnimationsThreshold?: number;
@@ -0,0 +1,21 @@
1
+ export type RunGraphEventResource = {
2
+ 'prefect.resource.id': string;
3
+ 'prefect.resource.role'?: string;
4
+ 'prefect.resource.name'?: string;
5
+ 'prefect.name'?: string;
6
+ 'prefect-cloud.name'?: string;
7
+ } & Record<string, string | undefined>;
8
+ export type EventRelatedResource = RunGraphEventResource & {
9
+ 'prefect.resource.role': string;
10
+ };
11
+ export type RunGraphEvent = {
12
+ id: string;
13
+ occurred: Date;
14
+ account: string;
15
+ event: string;
16
+ payload: unknown;
17
+ received: Date;
18
+ related: EventRelatedResource[];
19
+ resource: RunGraphEventResource;
20
+ workspace: string | null;
21
+ };
@@ -1,4 +1,5 @@
1
1
  export * from './artifact';
2
+ export * from './event';
2
3
  export * from './RunGraph';
3
4
  export * from './viewport';
4
5
  export * from './selection';
@@ -17,6 +17,7 @@ export type LayoutSettings = {
17
17
  disableGuides: boolean;
18
18
  disableEdges: boolean;
19
19
  disableArtifacts: boolean;
20
+ disableEvents: boolean;
20
21
  isTemporal: () => boolean;
21
22
  isDependency: () => boolean;
22
23
  isWaterfall: () => boolean;
@@ -26,4 +26,18 @@ export interface StateSelection extends RunGraphStateEvent {
26
26
  position?: GraphSelectionPosition;
27
27
  }
28
28
  export declare function isStateSelection(selection: GraphItemSelection): selection is StateSelection;
29
- export type GraphItemSelection = NodeSelection | ArtifactSelection | ArtifactsSelection | StateSelection;
29
+ export type EventSelection = {
30
+ id: string;
31
+ occurred: Date;
32
+ kind: 'event';
33
+ position?: GraphSelectionPosition;
34
+ };
35
+ export declare function isEventSelection(selection: GraphItemSelection): selection is EventSelection;
36
+ export type EventsSelection = {
37
+ kind: 'events';
38
+ occurred: Date | null;
39
+ ids: string[];
40
+ position?: GraphSelectionPosition;
41
+ };
42
+ export declare function isEventsSelection(selection: GraphItemSelection): selection is EventsSelection;
43
+ export type GraphItemSelection = NodeSelection | ArtifactSelection | ArtifactsSelection | StateSelection | EventSelection | EventsSelection;
@@ -3,6 +3,7 @@ import { Viewport } from 'pixi-viewport';
3
3
  import { Application, Container } from 'pixi.js';
4
4
  import { EffectScope } from 'vue';
5
5
  import { HorizontalScale } from '../factories/position';
6
+ import { RunGraphEvent } from '../models';
6
7
  import { LayoutSettings } from '../models/layout';
7
8
  import { RequiredGraphConfig, RunGraphData } from '../models/RunGraph';
8
9
  import { GraphItemSelection } from '../models/selection';
@@ -32,6 +33,8 @@ type Events = {
32
33
  edgeCullCreated: VisibilityCull;
33
34
  runDataCreated: RunGraphData;
34
35
  runDataUpdated: RunGraphData;
36
+ eventDataCreated: RunGraphEvent[];
37
+ eventDataUpdated: RunGraphEvent[];
35
38
  itemSelected: GraphItemSelection | null;
36
39
  layoutUpdated: void;
37
40
  toggleCullCreated: VisibilityCull;
@@ -0,0 +1,2 @@
1
+ export declare function startFlowRunEvents(): Promise<void>;
2
+ export declare function stopFlowRunEvents(): void;
@@ -10,6 +10,7 @@ export declare const layout: {
10
10
  disableGuides: boolean;
11
11
  disableEdges: boolean;
12
12
  disableArtifacts: boolean;
13
+ disableEvents: boolean;
13
14
  isTemporal: () => boolean;
14
15
  isDependency: () => boolean;
15
16
  isWaterfall: () => boolean;
@@ -27,3 +28,4 @@ export declare function setHorizontalMode(mode: HorizontalMode): void;
27
28
  export declare function setVerticalMode(mode: VerticalMode): void;
28
29
  export declare function setDisabledEdges(value: boolean): void;
29
30
  export declare function setDisabledArtifacts(value: boolean): void;
31
+ export declare function setDisabledEvents(value: boolean): void;
@@ -0,0 +1,5 @@
1
+ import { RenderTexture } from 'pixi.js';
2
+ export type CircleStyle = {
3
+ radius: number;
4
+ };
5
+ export declare function getCircleTexture(style: CircleStyle): Promise<RenderTexture>;
@@ -0,0 +1,21 @@
1
+ import { Container } from 'pixi.js';
2
+ type ItemFactory = {
3
+ element: Container;
4
+ getId: () => string;
5
+ getDate: () => Date;
6
+ } & Record<string, unknown>;
7
+ type ClusterFactory = {
8
+ element: Container;
9
+ getIds: () => string[];
10
+ getDate: () => Date | null;
11
+ render: (props: {
12
+ ids: string[];
13
+ date: Date;
14
+ }) => void;
15
+ } & Record<string, unknown>;
16
+ type ClusterHorizontalCollisionsProps = {
17
+ items: Map<string, ItemFactory | ClusterFactory>;
18
+ createCluster: () => Promise<ClusterFactory>;
19
+ };
20
+ export declare function clusterHorizontalCollisions({ items, createCluster }: ClusterHorizontalCollisionsProps): Promise<void>;
21
+ export {};
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@prefecthq/graphs",
3
3
  "private": false,
4
- "version": "2.2.5",
4
+ "version": "2.2.7",
5
5
  "description": "Large scale graphs designed for Prefect",
6
6
  "scripts": {
7
7
  "serve": "vite --host --mode=demo",