@workflow/web-shared 4.0.1-beta.5
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/LICENSE.md +21 -0
- package/README.md +76 -0
- package/dist/api/workflow-api-client.d.ts +303 -0
- package/dist/api/workflow-api-client.d.ts.map +1 -0
- package/dist/api/workflow-api-client.js +797 -0
- package/dist/api/workflow-api-client.js.map +1 -0
- package/dist/api/workflow-server-actions.d.ts +97 -0
- package/dist/api/workflow-server-actions.d.ts.map +1 -0
- package/dist/api/workflow-server-actions.js +329 -0
- package/dist/api/workflow-server-actions.js.map +1 -0
- package/dist/components/ui/alert.d.ts +9 -0
- package/dist/components/ui/alert.d.ts.map +1 -0
- package/dist/components/ui/alert.jsx +22 -0
- package/dist/components/ui/alert.jsx.map +1 -0
- package/dist/index.d.ts +7 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +5 -0
- package/dist/index.js.map +1 -0
- package/dist/lib/utils.d.ts +11 -0
- package/dist/lib/utils.d.ts.map +1 -0
- package/dist/lib/utils.js +19 -0
- package/dist/lib/utils.js.map +1 -0
- package/dist/run-trace-view.d.ts +8 -0
- package/dist/run-trace-view.d.ts.map +1 -0
- package/dist/run-trace-view.jsx +25 -0
- package/dist/run-trace-view.jsx.map +1 -0
- package/dist/sidebar/attribute-panel.d.ts +11 -0
- package/dist/sidebar/attribute-panel.d.ts.map +1 -0
- package/dist/sidebar/attribute-panel.jsx +153 -0
- package/dist/sidebar/attribute-panel.jsx.map +1 -0
- package/dist/sidebar/detail-card.d.ts +6 -0
- package/dist/sidebar/detail-card.d.ts.map +1 -0
- package/dist/sidebar/detail-card.jsx +13 -0
- package/dist/sidebar/detail-card.jsx.map +1 -0
- package/dist/sidebar/events-list.d.ts +8 -0
- package/dist/sidebar/events-list.d.ts.map +1 -0
- package/dist/sidebar/events-list.jsx +67 -0
- package/dist/sidebar/events-list.jsx.map +1 -0
- package/dist/sidebar/workflow-detail-panel.d.ts +8 -0
- package/dist/sidebar/workflow-detail-panel.d.ts.map +1 -0
- package/dist/sidebar/workflow-detail-panel.jsx +59 -0
- package/dist/sidebar/workflow-detail-panel.jsx.map +1 -0
- package/dist/trace-viewer/components/map.d.ts +8 -0
- package/dist/trace-viewer/components/map.d.ts.map +1 -0
- package/dist/trace-viewer/components/map.jsx +164 -0
- package/dist/trace-viewer/components/map.jsx.map +1 -0
- package/dist/trace-viewer/components/markers.d.ts +22 -0
- package/dist/trace-viewer/components/markers.d.ts.map +1 -0
- package/dist/trace-viewer/components/markers.jsx +400 -0
- package/dist/trace-viewer/components/markers.jsx.map +1 -0
- package/dist/trace-viewer/components/node.d.ts +31 -0
- package/dist/trace-viewer/components/node.d.ts.map +1 -0
- package/dist/trace-viewer/components/node.jsx +116 -0
- package/dist/trace-viewer/components/node.jsx.map +1 -0
- package/dist/trace-viewer/components/search-input.d.ts +9 -0
- package/dist/trace-viewer/components/search-input.d.ts.map +1 -0
- package/dist/trace-viewer/components/search-input.jsx +16 -0
- package/dist/trace-viewer/components/search-input.jsx.map +1 -0
- package/dist/trace-viewer/components/search.d.ts +3 -0
- package/dist/trace-viewer/components/search.d.ts.map +1 -0
- package/dist/trace-viewer/components/search.jsx +27 -0
- package/dist/trace-viewer/components/search.jsx.map +1 -0
- package/dist/trace-viewer/components/span-detail-panel.d.ts +10 -0
- package/dist/trace-viewer/components/span-detail-panel.d.ts.map +1 -0
- package/dist/trace-viewer/components/span-detail-panel.jsx +388 -0
- package/dist/trace-viewer/components/span-detail-panel.jsx.map +1 -0
- package/dist/trace-viewer/components/ui.d.ts +28 -0
- package/dist/trace-viewer/components/ui.d.ts.map +1 -0
- package/dist/trace-viewer/components/ui.jsx +54 -0
- package/dist/trace-viewer/components/ui.jsx.map +1 -0
- package/dist/trace-viewer/components/zoom-button.d.ts +3 -0
- package/dist/trace-viewer/components/zoom-button.d.ts.map +1 -0
- package/dist/trace-viewer/components/zoom-button.jsx +40 -0
- package/dist/trace-viewer/components/zoom-button.jsx.map +1 -0
- package/dist/trace-viewer/components/zoom-icons.d.ts +11 -0
- package/dist/trace-viewer/components/zoom-icons.d.ts.map +1 -0
- package/dist/trace-viewer/components/zoom-icons.jsx +23 -0
- package/dist/trace-viewer/components/zoom-icons.jsx.map +1 -0
- package/dist/trace-viewer/context.d.ts +183 -0
- package/dist/trace-viewer/context.d.ts.map +1 -0
- package/dist/trace-viewer/context.jsx +326 -0
- package/dist/trace-viewer/context.jsx.map +1 -0
- package/dist/trace-viewer/index.d.ts +5 -0
- package/dist/trace-viewer/index.d.ts.map +1 -0
- package/dist/trace-viewer/index.jsx +4 -0
- package/dist/trace-viewer/index.jsx.map +1 -0
- package/dist/trace-viewer/trace-viewer.d.ts +22 -0
- package/dist/trace-viewer/trace-viewer.d.ts.map +1 -0
- package/dist/trace-viewer/trace-viewer.jsx +311 -0
- package/dist/trace-viewer/trace-viewer.jsx.map +1 -0
- package/dist/trace-viewer/trace-viewer.module.css +1275 -0
- package/dist/trace-viewer/types.d.ts +201 -0
- package/dist/trace-viewer/types.d.ts.map +1 -0
- package/dist/trace-viewer/types.js +2 -0
- package/dist/trace-viewer/types.js.map +1 -0
- package/dist/trace-viewer/util/constants.d.ts +9 -0
- package/dist/trace-viewer/util/constants.d.ts.map +1 -0
- package/dist/trace-viewer/util/constants.js +9 -0
- package/dist/trace-viewer/util/constants.js.map +1 -0
- package/dist/trace-viewer/util/scrollbar-width.d.ts +2 -0
- package/dist/trace-viewer/util/scrollbar-width.d.ts.map +1 -0
- package/dist/trace-viewer/util/scrollbar-width.js +14 -0
- package/dist/trace-viewer/util/scrollbar-width.js.map +1 -0
- package/dist/trace-viewer/util/timing.d.ts +8 -0
- package/dist/trace-viewer/util/timing.d.ts.map +1 -0
- package/dist/trace-viewer/util/timing.js +29 -0
- package/dist/trace-viewer/util/timing.js.map +1 -0
- package/dist/trace-viewer/util/tree.d.ts +13 -0
- package/dist/trace-viewer/util/tree.d.ts.map +1 -0
- package/dist/trace-viewer/util/tree.js +223 -0
- package/dist/trace-viewer/util/tree.js.map +1 -0
- package/dist/trace-viewer/util/use-immediate-style.d.ts +15 -0
- package/dist/trace-viewer/util/use-immediate-style.d.ts.map +1 -0
- package/dist/trace-viewer/util/use-immediate-style.js +22 -0
- package/dist/trace-viewer/util/use-immediate-style.js.map +1 -0
- package/dist/trace-viewer/util/use-streaming-spans.d.ts +8 -0
- package/dist/trace-viewer/util/use-streaming-spans.d.ts.map +1 -0
- package/dist/trace-viewer/util/use-streaming-spans.js +332 -0
- package/dist/trace-viewer/util/use-streaming-spans.js.map +1 -0
- package/dist/trace-viewer/util/use-trackpad-zoom.d.ts +6 -0
- package/dist/trace-viewer/util/use-trackpad-zoom.d.ts.map +1 -0
- package/dist/trace-viewer/util/use-trackpad-zoom.jsx +38 -0
- package/dist/trace-viewer/util/use-trackpad-zoom.jsx.map +1 -0
- package/dist/trace-viewer/worker.d.ts +2 -0
- package/dist/trace-viewer/worker.d.ts.map +1 -0
- package/dist/trace-viewer/worker.js +107 -0
- package/dist/trace-viewer/worker.js.map +1 -0
- package/dist/workflow-trace-view.d.ts +12 -0
- package/dist/workflow-trace-view.d.ts.map +1 -0
- package/dist/workflow-trace-view.jsx +129 -0
- package/dist/workflow-trace-view.jsx.map +1 -0
- package/dist/workflow-traces/event-colors.d.ts +31 -0
- package/dist/workflow-traces/event-colors.d.ts.map +1 -0
- package/dist/workflow-traces/event-colors.js +68 -0
- package/dist/workflow-traces/event-colors.js.map +1 -0
- package/dist/workflow-traces/trace-colors.d.ts +15 -0
- package/dist/workflow-traces/trace-colors.d.ts.map +1 -0
- package/dist/workflow-traces/trace-colors.js +89 -0
- package/dist/workflow-traces/trace-colors.js.map +1 -0
- package/dist/workflow-traces/trace-span-construction.d.ts +31 -0
- package/dist/workflow-traces/trace-span-construction.d.ts.map +1 -0
- package/dist/workflow-traces/trace-span-construction.js +173 -0
- package/dist/workflow-traces/trace-span-construction.js.map +1 -0
- package/dist/workflow-traces/trace-time-utils.d.ts +13 -0
- package/dist/workflow-traces/trace-time-utils.d.ts.map +1 -0
- package/dist/workflow-traces/trace-time-utils.js +34 -0
- package/dist/workflow-traces/trace-time-utils.js.map +1 -0
- package/package.json +59 -0
package/LICENSE.md
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
The MIT License (MIT)
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 Vercel, Inc.
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
# @workflow/web-shared
|
|
2
|
+
|
|
3
|
+
Workflow Observability tools for NextJS. See [Workflow DevKit](https://useworkflow.dev/docs/observability) for more information.
|
|
4
|
+
|
|
5
|
+
## Usage
|
|
6
|
+
|
|
7
|
+
This package contains client and server code to interact with the Workflow API, as well as some pre-styled components.
|
|
8
|
+
If you want to deploy a full observability experience with your NextJS app, take a look at [`@workflow/web`](../web/README.md) instead, which can be self-hosted.
|
|
9
|
+
|
|
10
|
+
You can use the API to create your own display UI, like so:
|
|
11
|
+
|
|
12
|
+
```tsx
|
|
13
|
+
import { useWorkflowRuns } from '@workflow/web-shared';
|
|
14
|
+
|
|
15
|
+
export default function MyRunsList() {
|
|
16
|
+
const {
|
|
17
|
+
data,
|
|
18
|
+
error,
|
|
19
|
+
nextPage,
|
|
20
|
+
previousPage,
|
|
21
|
+
hasNextPage,
|
|
22
|
+
hasPreviousPage,
|
|
23
|
+
reload,
|
|
24
|
+
pageInfo,
|
|
25
|
+
} = useWorkflowRuns(env, {
|
|
26
|
+
sortOrder,
|
|
27
|
+
workflowName: workflowNameFilter === 'all' ? undefined : workflowNameFilter,
|
|
28
|
+
status: status === 'all' ? undefined : status,
|
|
29
|
+
});
|
|
30
|
+
|
|
31
|
+
// Shows an interactive trace viewer for the given run
|
|
32
|
+
return <div>{runs.map((run) => (
|
|
33
|
+
<div key={run.runId}>
|
|
34
|
+
{run.workflowName}
|
|
35
|
+
{run.status}
|
|
36
|
+
{run.startedAt}
|
|
37
|
+
{run.completedAt}
|
|
38
|
+
</div>
|
|
39
|
+
))}</div>;
|
|
40
|
+
}
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
It also comes with a pre-styled interactive trace viewer that you can use to display the trace for a given run:
|
|
44
|
+
|
|
45
|
+
```tsx
|
|
46
|
+
import { RunTraceView } from '@workflow/web-shared';
|
|
47
|
+
|
|
48
|
+
export default function MyRunDetailView({ env, runId }: { env: EnvMap, runId: string }) {
|
|
49
|
+
// ... your other code
|
|
50
|
+
|
|
51
|
+
// Shows an interactive trace viewer for the given run
|
|
52
|
+
return <RunTraceView env={env} runId={runId} />;
|
|
53
|
+
}
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
## Environment Variables
|
|
57
|
+
|
|
58
|
+
For API calls to work, you'll need to pass the same environment variables that are used by the Workflow CLI.
|
|
59
|
+
See `npx workflow inspect --help` for more information.
|
|
60
|
+
|
|
61
|
+
If you're deploying this as part of your Vercel NextJS app, setting `WORKFLOW_TARGET_WORLD` to `vercel` is enough
|
|
62
|
+
to infer your other project details from the Vercel environment variables.
|
|
63
|
+
|
|
64
|
+
## Styling
|
|
65
|
+
|
|
66
|
+
In order for tailwind classes to be picked up correctly, you might need to configure your NextJS app
|
|
67
|
+
to use the correct CSS processor. E.g. if you're using PostCSS with TailwindCSS, you can do the following:
|
|
68
|
+
|
|
69
|
+
```tsx
|
|
70
|
+
// postcss.config.mjs in your NextJS app
|
|
71
|
+
const config = {
|
|
72
|
+
plugins: ['@tailwindcss/postcss'],
|
|
73
|
+
};
|
|
74
|
+
|
|
75
|
+
export default config;
|
|
76
|
+
```
|
|
@@ -0,0 +1,303 @@
|
|
|
1
|
+
import type { Hook, WorkflowRun, WorkflowRunStatus } from '@workflow/world';
|
|
2
|
+
import type { EnvMap } from './workflow-server-actions';
|
|
3
|
+
/**
|
|
4
|
+
* Gets a user-facing error message from an error object.
|
|
5
|
+
* Handles both WorkflowAPIError and regular Error instances.
|
|
6
|
+
*/
|
|
7
|
+
export declare const getErrorMessage: (error: Error | WorkflowAPIError) => string;
|
|
8
|
+
/**
|
|
9
|
+
* Error instance for API and server-side errors.
|
|
10
|
+
* `error.message` will be a user-facing error message, to be displayed in UI.
|
|
11
|
+
* `error.cause` will be a developer-facing error message, to be displayed in logs.
|
|
12
|
+
*
|
|
13
|
+
* If the error originates from an HTTP request made from a server action,
|
|
14
|
+
* these fields will be populated:
|
|
15
|
+
* - `error.request` will be a JSON-serializable object representing the request made.
|
|
16
|
+
* - `error.layer` will be 'API'
|
|
17
|
+
*
|
|
18
|
+
* If the error originates from inside the server action, or there's an error with
|
|
19
|
+
* calling the server action, these fields will be populated:
|
|
20
|
+
* - `error.layer` will be 'server'
|
|
21
|
+
*/
|
|
22
|
+
export declare class WorkflowAPIError extends Error {
|
|
23
|
+
request?: any;
|
|
24
|
+
layer?: 'client' | 'server' | 'API';
|
|
25
|
+
constructor(message: string, options?: {
|
|
26
|
+
cause?: unknown;
|
|
27
|
+
request?: any;
|
|
28
|
+
layer?: 'client' | 'server' | 'API';
|
|
29
|
+
});
|
|
30
|
+
}
|
|
31
|
+
interface PageResult<T> {
|
|
32
|
+
data: T[] | null;
|
|
33
|
+
isLoading: boolean;
|
|
34
|
+
error: Error | null;
|
|
35
|
+
}
|
|
36
|
+
interface PaginatedList<T> {
|
|
37
|
+
data: PageResult<T>;
|
|
38
|
+
allData: PageResult<T>[];
|
|
39
|
+
error: Error | null;
|
|
40
|
+
isLoading: boolean;
|
|
41
|
+
currentPage: number;
|
|
42
|
+
totalPages: number;
|
|
43
|
+
nextPage: () => void;
|
|
44
|
+
previousPage: () => void;
|
|
45
|
+
hasNextPage: boolean;
|
|
46
|
+
hasPreviousPage: boolean;
|
|
47
|
+
reload: () => void;
|
|
48
|
+
pageInfo: string;
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* Returns a list of runs with pagination control
|
|
52
|
+
*/
|
|
53
|
+
export declare function useWorkflowRuns(env: EnvMap, params: {
|
|
54
|
+
workflowName?: string;
|
|
55
|
+
status?: WorkflowRunStatus;
|
|
56
|
+
limit?: number;
|
|
57
|
+
sortOrder?: 'asc' | 'desc';
|
|
58
|
+
}): PaginatedList<WorkflowRun>;
|
|
59
|
+
/**
|
|
60
|
+
* Returns a list of hooks with pagination control
|
|
61
|
+
*/
|
|
62
|
+
export declare function useWorkflowHooks(env: EnvMap, params: {
|
|
63
|
+
runId?: string;
|
|
64
|
+
limit?: number;
|
|
65
|
+
sortOrder?: 'asc' | 'desc';
|
|
66
|
+
}): PaginatedList<Hook>;
|
|
67
|
+
/**
|
|
68
|
+
* Returns (and keeps up-to-date) all data related to a run.
|
|
69
|
+
* Items returned will _not_ have resolved data (like input/output values).
|
|
70
|
+
*/
|
|
71
|
+
export declare function useWorkflowTraceViewerData(env: EnvMap, runId: string, options?: {
|
|
72
|
+
live?: boolean;
|
|
73
|
+
}): {
|
|
74
|
+
run: {
|
|
75
|
+
runId: string;
|
|
76
|
+
deploymentId: string;
|
|
77
|
+
status: "pending" | "running" | "completed" | "failed" | "paused" | "cancelled";
|
|
78
|
+
workflowName: string;
|
|
79
|
+
input: any[];
|
|
80
|
+
createdAt: Date;
|
|
81
|
+
updatedAt: Date;
|
|
82
|
+
executionContext?: Record<string, any> | undefined;
|
|
83
|
+
output?: any;
|
|
84
|
+
error?: string | undefined;
|
|
85
|
+
errorCode?: string | undefined;
|
|
86
|
+
startedAt?: Date | undefined;
|
|
87
|
+
completedAt?: Date | undefined;
|
|
88
|
+
};
|
|
89
|
+
steps: {
|
|
90
|
+
runId: string;
|
|
91
|
+
stepId: string;
|
|
92
|
+
stepName: string;
|
|
93
|
+
status: "pending" | "running" | "completed" | "failed" | "cancelled";
|
|
94
|
+
input: any[];
|
|
95
|
+
attempt: number;
|
|
96
|
+
createdAt: Date;
|
|
97
|
+
updatedAt: Date;
|
|
98
|
+
output?: any;
|
|
99
|
+
error?: string | undefined;
|
|
100
|
+
errorCode?: string | undefined;
|
|
101
|
+
startedAt?: Date | undefined;
|
|
102
|
+
completedAt?: Date | undefined;
|
|
103
|
+
retryAfter?: Date | undefined;
|
|
104
|
+
}[];
|
|
105
|
+
hooks: {
|
|
106
|
+
runId: string;
|
|
107
|
+
hookId: string;
|
|
108
|
+
token: string;
|
|
109
|
+
ownerId: string;
|
|
110
|
+
projectId: string;
|
|
111
|
+
environment: string;
|
|
112
|
+
createdAt: Date;
|
|
113
|
+
metadata?: unknown;
|
|
114
|
+
}[];
|
|
115
|
+
events: (({
|
|
116
|
+
eventType: "step_completed";
|
|
117
|
+
correlationId: string;
|
|
118
|
+
eventData: {
|
|
119
|
+
result: any;
|
|
120
|
+
};
|
|
121
|
+
} | {
|
|
122
|
+
eventType: "step_failed";
|
|
123
|
+
correlationId: string;
|
|
124
|
+
eventData: {
|
|
125
|
+
error: any;
|
|
126
|
+
stack?: string | undefined;
|
|
127
|
+
fatal?: boolean | undefined;
|
|
128
|
+
};
|
|
129
|
+
} | {
|
|
130
|
+
eventType: "step_retrying";
|
|
131
|
+
correlationId: string;
|
|
132
|
+
eventData: {
|
|
133
|
+
attempt: number;
|
|
134
|
+
};
|
|
135
|
+
} | {
|
|
136
|
+
eventType: "step_started";
|
|
137
|
+
correlationId: string;
|
|
138
|
+
} | {
|
|
139
|
+
eventType: "hook_created";
|
|
140
|
+
correlationId: string;
|
|
141
|
+
} | {
|
|
142
|
+
eventType: "hook_received";
|
|
143
|
+
correlationId: string;
|
|
144
|
+
eventData: {
|
|
145
|
+
payload: any;
|
|
146
|
+
};
|
|
147
|
+
} | {
|
|
148
|
+
eventType: "hook_disposed";
|
|
149
|
+
correlationId: string;
|
|
150
|
+
} | {
|
|
151
|
+
eventType: "wait_created";
|
|
152
|
+
correlationId: string;
|
|
153
|
+
eventData: {
|
|
154
|
+
resumeAt: Date;
|
|
155
|
+
};
|
|
156
|
+
} | {
|
|
157
|
+
eventType: "wait_completed";
|
|
158
|
+
correlationId: string;
|
|
159
|
+
} | {
|
|
160
|
+
eventType: "workflow_completed";
|
|
161
|
+
correlationId?: string | undefined;
|
|
162
|
+
} | {
|
|
163
|
+
eventType: "workflow_failed";
|
|
164
|
+
eventData: {
|
|
165
|
+
error: any;
|
|
166
|
+
};
|
|
167
|
+
correlationId?: string | undefined;
|
|
168
|
+
} | {
|
|
169
|
+
eventType: "workflow_started";
|
|
170
|
+
correlationId?: string | undefined;
|
|
171
|
+
}) & {
|
|
172
|
+
runId: string;
|
|
173
|
+
eventId: string;
|
|
174
|
+
createdAt: Date;
|
|
175
|
+
})[];
|
|
176
|
+
loading: boolean;
|
|
177
|
+
error: Error | null;
|
|
178
|
+
update: () => Promise<{
|
|
179
|
+
foundNewItems: boolean;
|
|
180
|
+
}>;
|
|
181
|
+
};
|
|
182
|
+
/**
|
|
183
|
+
* Returns (and keeps up-to-date) data inherent to a specific run/step/hook,
|
|
184
|
+
* resolving input/output/metadata, AND loading all related events with full event data.
|
|
185
|
+
*/
|
|
186
|
+
export declare function useWorkflowResourceData(env: EnvMap, resource: 'run' | 'step' | 'hook' | 'sleep', resourceId: string, options?: {
|
|
187
|
+
refreshInterval?: number;
|
|
188
|
+
runId?: string;
|
|
189
|
+
}): {
|
|
190
|
+
data: {
|
|
191
|
+
runId: string;
|
|
192
|
+
deploymentId: string;
|
|
193
|
+
status: "pending" | "running" | "completed" | "failed" | "paused" | "cancelled";
|
|
194
|
+
workflowName: string;
|
|
195
|
+
input: any[];
|
|
196
|
+
createdAt: Date;
|
|
197
|
+
updatedAt: Date;
|
|
198
|
+
executionContext?: Record<string, any> | undefined;
|
|
199
|
+
output?: any;
|
|
200
|
+
error?: string | undefined;
|
|
201
|
+
errorCode?: string | undefined;
|
|
202
|
+
startedAt?: Date | undefined;
|
|
203
|
+
completedAt?: Date | undefined;
|
|
204
|
+
} | {
|
|
205
|
+
runId: string;
|
|
206
|
+
stepId: string;
|
|
207
|
+
stepName: string;
|
|
208
|
+
status: "pending" | "running" | "completed" | "failed" | "cancelled";
|
|
209
|
+
input: any[];
|
|
210
|
+
attempt: number;
|
|
211
|
+
createdAt: Date;
|
|
212
|
+
updatedAt: Date;
|
|
213
|
+
output?: any;
|
|
214
|
+
error?: string | undefined;
|
|
215
|
+
errorCode?: string | undefined;
|
|
216
|
+
startedAt?: Date | undefined;
|
|
217
|
+
completedAt?: Date | undefined;
|
|
218
|
+
retryAfter?: Date | undefined;
|
|
219
|
+
} | (({
|
|
220
|
+
eventType: "step_completed";
|
|
221
|
+
correlationId: string;
|
|
222
|
+
eventData: {
|
|
223
|
+
result: any;
|
|
224
|
+
};
|
|
225
|
+
} | {
|
|
226
|
+
eventType: "step_failed";
|
|
227
|
+
correlationId: string;
|
|
228
|
+
eventData: {
|
|
229
|
+
error: any;
|
|
230
|
+
stack?: string | undefined;
|
|
231
|
+
fatal?: boolean | undefined;
|
|
232
|
+
};
|
|
233
|
+
} | {
|
|
234
|
+
eventType: "step_retrying";
|
|
235
|
+
correlationId: string;
|
|
236
|
+
eventData: {
|
|
237
|
+
attempt: number;
|
|
238
|
+
};
|
|
239
|
+
} | {
|
|
240
|
+
eventType: "step_started";
|
|
241
|
+
correlationId: string;
|
|
242
|
+
} | {
|
|
243
|
+
eventType: "hook_created";
|
|
244
|
+
correlationId: string;
|
|
245
|
+
} | {
|
|
246
|
+
eventType: "hook_received";
|
|
247
|
+
correlationId: string;
|
|
248
|
+
eventData: {
|
|
249
|
+
payload: any;
|
|
250
|
+
};
|
|
251
|
+
} | {
|
|
252
|
+
eventType: "hook_disposed";
|
|
253
|
+
correlationId: string;
|
|
254
|
+
} | {
|
|
255
|
+
eventType: "wait_created";
|
|
256
|
+
correlationId: string;
|
|
257
|
+
eventData: {
|
|
258
|
+
resumeAt: Date;
|
|
259
|
+
};
|
|
260
|
+
} | {
|
|
261
|
+
eventType: "wait_completed";
|
|
262
|
+
correlationId: string;
|
|
263
|
+
} | {
|
|
264
|
+
eventType: "workflow_completed";
|
|
265
|
+
correlationId?: string | undefined;
|
|
266
|
+
} | {
|
|
267
|
+
eventType: "workflow_failed";
|
|
268
|
+
eventData: {
|
|
269
|
+
error: any;
|
|
270
|
+
};
|
|
271
|
+
correlationId?: string | undefined;
|
|
272
|
+
} | {
|
|
273
|
+
eventType: "workflow_started";
|
|
274
|
+
correlationId?: string | undefined;
|
|
275
|
+
}) & {
|
|
276
|
+
runId: string;
|
|
277
|
+
eventId: string;
|
|
278
|
+
createdAt: Date;
|
|
279
|
+
}) | {
|
|
280
|
+
runId: string;
|
|
281
|
+
hookId: string;
|
|
282
|
+
token: string;
|
|
283
|
+
ownerId: string;
|
|
284
|
+
projectId: string;
|
|
285
|
+
environment: string;
|
|
286
|
+
createdAt: Date;
|
|
287
|
+
metadata?: unknown;
|
|
288
|
+
} | null;
|
|
289
|
+
loading: boolean;
|
|
290
|
+
error: Error | null;
|
|
291
|
+
refresh: () => Promise<void>;
|
|
292
|
+
};
|
|
293
|
+
/**
|
|
294
|
+
* Cancel a workflow run
|
|
295
|
+
*/
|
|
296
|
+
export declare function cancelRun(env: EnvMap, runId: string): Promise<void>;
|
|
297
|
+
/**
|
|
298
|
+
* Start a new workflow run
|
|
299
|
+
*/
|
|
300
|
+
export declare function recreateRun(env: EnvMap, runId: string): Promise<string>;
|
|
301
|
+
export declare function readStream(env: EnvMap, streamId: string, startIndex?: number): Promise<ReadableStream<Uint8Array>>;
|
|
302
|
+
export {};
|
|
303
|
+
//# sourceMappingURL=workflow-api-client.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"workflow-api-client.d.ts","sourceRoot":"","sources":["../../src/api/workflow-api-client.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAEV,IAAI,EAEJ,WAAW,EACX,iBAAiB,EAClB,MAAM,iBAAiB,CAAC;AAGzB,OAAO,KAAK,EAAE,MAAM,EAAqB,MAAM,2BAA2B,CAAC;AAgC3E;;;GAGG;AACH,eAAO,MAAM,eAAe,GAAI,OAAO,KAAK,GAAG,gBAAgB,KAAG,MAajE,CAAC;AAmBF;;;;;;;;;;;;;GAaG;AACH,qBAAa,gBAAiB,SAAQ,KAAK;IACzC,OAAO,CAAC,EAAE,GAAG,CAAC;IACd,KAAK,CAAC,EAAE,QAAQ,GAAG,QAAQ,GAAG,KAAK,CAAC;gBAElC,OAAO,EAAE,MAAM,EACf,OAAO,CAAC,EAAE;QACR,KAAK,CAAC,EAAE,OAAO,CAAC;QAChB,OAAO,CAAC,EAAE,GAAG,CAAC;QACd,KAAK,CAAC,EAAE,QAAQ,GAAG,QAAQ,GAAG,KAAK,CAAC;KACrC;CAUJ;AAED,UAAU,UAAU,CAAC,CAAC;IACpB,IAAI,EAAE,CAAC,EAAE,GAAG,IAAI,CAAC;IACjB,SAAS,EAAE,OAAO,CAAC;IACnB,KAAK,EAAE,KAAK,GAAG,IAAI,C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