@workglow/task-graph 0.0.124 → 0.0.125
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.
- package/README.md +4 -0
- package/dist/browser.d.ts +1 -0
- package/dist/browser.d.ts.map +1 -1
- package/dist/browser.js +642 -1
- package/dist/browser.js.map +5 -4
- package/dist/debug/console/ConsoleFormatters.d.ts +45 -0
- package/dist/debug/console/ConsoleFormatters.d.ts.map +1 -0
- package/dist/types.d.ts +1 -0
- package/dist/types.d.ts.map +1 -1
- package/package.json +7 -7
- package/src/debug/README.md +115 -0
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2025 Steven Roussey <sroussey@gmail.com>
|
|
4
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
5
|
+
*/
|
|
6
|
+
type Config = Record<string, unknown>;
|
|
7
|
+
type JsonMLTagName = string;
|
|
8
|
+
interface JsonMLAttributes {
|
|
9
|
+
readonly [key: string]: unknown;
|
|
10
|
+
}
|
|
11
|
+
type JsonMLNode = JsonMLText | JsonMLElementDef;
|
|
12
|
+
type JsonMLText = string;
|
|
13
|
+
type JsonMLElementDef = [JsonMLTagName, JsonMLAttributes?, ...JsonMLNode[]];
|
|
14
|
+
declare abstract class ConsoleFormatter {
|
|
15
|
+
abstract header(value: unknown, config?: Config): JsonMLElementDef | null;
|
|
16
|
+
abstract hasBody(value: unknown, config?: Config): boolean;
|
|
17
|
+
abstract body(value: unknown, config?: Config): JsonMLElementDef | null;
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Returns whether the browser is in dark mode
|
|
21
|
+
*/
|
|
22
|
+
export declare function isDarkMode(): boolean;
|
|
23
|
+
declare global {
|
|
24
|
+
interface Window {
|
|
25
|
+
devtoolsFormatters?: ConsoleFormatter[];
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Installs custom DevTools formatters for Workglow task graphs, workflows, and related objects.
|
|
30
|
+
* Call this function once in your application to enable rich console output for debugging.
|
|
31
|
+
*
|
|
32
|
+
* @example
|
|
33
|
+
* ```ts
|
|
34
|
+
* import { installDevToolsFormatters } from "@workglow/task-graph";
|
|
35
|
+
*
|
|
36
|
+
* // Call early in your app initialization
|
|
37
|
+
* installDevToolsFormatters();
|
|
38
|
+
*
|
|
39
|
+
* // Now console.log will show rich output for Workflow, Task, TaskGraph, etc.
|
|
40
|
+
* console.log(myWorkflow);
|
|
41
|
+
* ```
|
|
42
|
+
*/
|
|
43
|
+
export declare function installDevToolsFormatters(): void;
|
|
44
|
+
export {};
|
|
45
|
+
//# sourceMappingURL=ConsoleFormatters.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ConsoleFormatters.d.ts","sourceRoot":"","sources":["../../../src/debug/console/ConsoleFormatters.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAUH,KAAK,MAAM,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;AAwBtC,KAAK,aAAa,GAAG,MAAM,CAAC;AAE5B,UAAU,gBAAgB;IACxB,QAAQ,EAAE,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;CACjC;AAED,KAAK,UAAU,GAAG,UAAU,GAAG,gBAAgB,CAAC;AAEhD,KAAK,UAAU,GAAG,MAAM,CAAC;AAEzB,KAAK,gBAAgB,GAAG,CAAC,aAAa,EAAE,gBAAgB,CAAC,EAAE,GAAG,UAAU,EAAE,CAAC,CAAC;AAE5E,uBAAe,gBAAgB;IAC7B,QAAQ,CAAC,MAAM,CAAC,KAAK,EAAE,OAAO,EAAE,MAAM,CAAC,EAAE,MAAM,GAAG,gBAAgB,GAAG,IAAI,CAAC;IAC1E,QAAQ,CAAC,OAAO,CAAC,KAAK,EAAE,OAAO,EAAE,MAAM,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC;IAC3D,QAAQ,CAAC,IAAI,CAAC,KAAK,EAAE,OAAO,EAAE,MAAM,CAAC,EAAE,MAAM,GAAG,gBAAgB,GAAG,IAAI,CAAC;CACzE;AAED;;GAEG;AACH,wBAAgB,UAAU,IAAI,OAAO,CAEpC;AAk0BD,OAAO,CAAC,MAAM,CAAC,CAAC;IACd,UAAU,MAAM;QACd,kBAAkB,CAAC,EAAE,gBAAgB,EAAE,CAAC;KACzC;CACF;AAED;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,yBAAyB,IAAI,IAAI,CAWhD"}
|
package/dist/types.d.ts
CHANGED
package/dist/types.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,cAAc,UAAU,CAAC"}
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,cAAc,UAAU,CAAC;AACzB,cAAc,mCAAmC,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@workglow/task-graph",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.0.
|
|
4
|
+
"version": "0.0.125",
|
|
5
5
|
"description": "Task graph management for Workglow, providing DAG construction, execution planning, and workflow orchestration.",
|
|
6
6
|
"scripts": {
|
|
7
7
|
"watch": "concurrently -c 'auto' 'bun:watch-*'",
|
|
@@ -37,9 +37,9 @@
|
|
|
37
37
|
"access": "public"
|
|
38
38
|
},
|
|
39
39
|
"peerDependencies": {
|
|
40
|
-
"@workglow/job-queue": "0.0.
|
|
41
|
-
"@workglow/storage": "0.0.
|
|
42
|
-
"@workglow/util": "0.0.
|
|
40
|
+
"@workglow/job-queue": "0.0.125",
|
|
41
|
+
"@workglow/storage": "0.0.125",
|
|
42
|
+
"@workglow/util": "0.0.125"
|
|
43
43
|
},
|
|
44
44
|
"peerDependenciesMeta": {
|
|
45
45
|
"@workglow/job-queue": {
|
|
@@ -53,8 +53,8 @@
|
|
|
53
53
|
}
|
|
54
54
|
},
|
|
55
55
|
"devDependencies": {
|
|
56
|
-
"@workglow/job-queue": "0.0.
|
|
57
|
-
"@workglow/storage": "0.0.
|
|
58
|
-
"@workglow/util": "0.0.
|
|
56
|
+
"@workglow/job-queue": "0.0.125",
|
|
57
|
+
"@workglow/storage": "0.0.125",
|
|
58
|
+
"@workglow/util": "0.0.125"
|
|
59
59
|
}
|
|
60
60
|
}
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
# Chrome DevTools formatters (`ConsoleFormatters`)
|
|
2
|
+
|
|
3
|
+
Debug utilities for Workglow task graphs and workflows.
|
|
4
|
+
|
|
5
|
+
## Overview
|
|
6
|
+
|
|
7
|
+
`ConsoleFormatters.ts` is re-exported from the main **`@workglow/task-graph`** entry when using the **browser** build (`dist/browser.js`). It provides Chrome DevTools custom formatters for rich console output for task graphs, workflows, tasks, and dataflows.
|
|
8
|
+
|
|
9
|
+
This code is **browser-oriented** (it uses `window` and the DevTools formatter API). Do not call it from Node-only bundles.
|
|
10
|
+
|
|
11
|
+
## Features
|
|
12
|
+
|
|
13
|
+
- **Chrome DevTools Custom Formatters**: Rich, colored console output for Workglow objects
|
|
14
|
+
- **Dark Mode Support**: Automatically adapts colors based on browser theme
|
|
15
|
+
- **DAG Visualization**: Visual graph rendering for directed acyclic graphs
|
|
16
|
+
- **React Element Formatting**: Pretty-print React elements in the console
|
|
17
|
+
|
|
18
|
+
## Installation
|
|
19
|
+
|
|
20
|
+
`@workglow/util` is a peer dependency of `@workglow/task-graph` (graph and schema types used by the formatters).
|
|
21
|
+
|
|
22
|
+
```bash
|
|
23
|
+
npm install @workglow/task-graph @workglow/util
|
|
24
|
+
# or
|
|
25
|
+
bun add @workglow/task-graph @workglow/util
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
## Usage
|
|
29
|
+
|
|
30
|
+
### Installing DevTools Formatters
|
|
31
|
+
|
|
32
|
+
Call `installDevToolsFormatters()` early in your application to enable rich console output:
|
|
33
|
+
|
|
34
|
+
```typescript
|
|
35
|
+
import { installDevToolsFormatters } from "@workglow/task-graph";
|
|
36
|
+
|
|
37
|
+
// Call once during app initialization
|
|
38
|
+
installDevToolsFormatters();
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
### Enabling Custom Formatters in Chrome DevTools
|
|
42
|
+
|
|
43
|
+
1. Open Chrome DevTools (F12 or Cmd+Option+I)
|
|
44
|
+
2. Go to Settings (gear icon or F1)
|
|
45
|
+
3. Under "Console", check "Enable custom formatters"
|
|
46
|
+
4. Refresh the page
|
|
47
|
+
|
|
48
|
+
### Viewing Rich Output
|
|
49
|
+
|
|
50
|
+
Once formatters are installed and enabled, simply `console.log` any Workglow object:
|
|
51
|
+
|
|
52
|
+
```typescript
|
|
53
|
+
import { Workflow } from "@workglow/task-graph";
|
|
54
|
+
import { installDevToolsFormatters } from "@workglow/task-graph";
|
|
55
|
+
|
|
56
|
+
installDevToolsFormatters();
|
|
57
|
+
|
|
58
|
+
const workflow = new Workflow();
|
|
59
|
+
// ... add tasks ...
|
|
60
|
+
|
|
61
|
+
// Rich formatted output in DevTools
|
|
62
|
+
console.log(workflow);
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
## Supported Objects
|
|
66
|
+
|
|
67
|
+
The following Workglow objects will display with rich formatting:
|
|
68
|
+
|
|
69
|
+
- **Workflow**: Shows task count, error state, and expandable task list
|
|
70
|
+
- **TaskGraph**: Displays all tasks and dataflows with DAG visualization
|
|
71
|
+
- **Task**: Shows input/output data, configuration, and status with color coding
|
|
72
|
+
- **Dataflow**: Displays source and target connections with values
|
|
73
|
+
- **DirectedAcyclicGraph**: Renders a visual canvas representation
|
|
74
|
+
- **React Elements**: Pretty-prints React components with props
|
|
75
|
+
|
|
76
|
+
## API
|
|
77
|
+
|
|
78
|
+
### `installDevToolsFormatters()`
|
|
79
|
+
|
|
80
|
+
Registers custom formatters with Chrome DevTools. Call once during application startup.
|
|
81
|
+
|
|
82
|
+
```typescript
|
|
83
|
+
import { installDevToolsFormatters } from "@workglow/task-graph";
|
|
84
|
+
|
|
85
|
+
installDevToolsFormatters();
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
### `isDarkMode()`
|
|
89
|
+
|
|
90
|
+
Returns whether the browser is currently in dark mode.
|
|
91
|
+
|
|
92
|
+
```typescript
|
|
93
|
+
import { isDarkMode } from "@workglow/task-graph";
|
|
94
|
+
|
|
95
|
+
if (isDarkMode()) {
|
|
96
|
+
console.log("Using dark theme colors");
|
|
97
|
+
}
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
## Color Coding
|
|
101
|
+
|
|
102
|
+
The formatters use consistent color coding:
|
|
103
|
+
|
|
104
|
+
| Color | Meaning |
|
|
105
|
+
| --------- | ------------------------------ |
|
|
106
|
+
| Green | Input parameters |
|
|
107
|
+
| Red/Brown | Output values |
|
|
108
|
+
| Yellow | Highlighted names/keywords |
|
|
109
|
+
| Grey | Punctuation and secondary text |
|
|
110
|
+
|
|
111
|
+
Colors automatically adjust for dark/light mode.
|
|
112
|
+
|
|
113
|
+
## License
|
|
114
|
+
|
|
115
|
+
Apache 2.0 - See [LICENSE](../../LICENSE) for details.
|