@wave-av/workflow-sdk 1.0.0
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/CHANGELOG.md +9 -0
- package/LICENSE +21 -0
- package/README.md +250 -0
- package/dist/chunk-M3UAADWT.mjs +237 -0
- package/dist/chunk-O4EIGRTS.mjs +57 -0
- package/dist/client.d.mts +141 -0
- package/dist/client.d.ts +141 -0
- package/dist/client.js +262 -0
- package/dist/client.mjs +8 -0
- package/dist/index.d.mts +173 -0
- package/dist/index.d.ts +173 -0
- package/dist/index.js +507 -0
- package/dist/index.mjs +200 -0
- package/dist/types.d.mts +615 -0
- package/dist/types.d.ts +615 -0
- package/dist/types.js +85 -0
- package/dist/types.mjs +14 -0
- package/package.json +73 -0
package/dist/index.d.mts
ADDED
|
@@ -0,0 +1,173 @@
|
|
|
1
|
+
import { RetryPolicy, WorkflowPhase, WorkflowConfig, WorkflowDefinition } from './types.mjs';
|
|
2
|
+
export { AnyWorkflowEvent, ExecuteWorkflowRequest, ExecuteWorkflowRequestSchema, ExecuteWorkflowResponse, ExecutionCompletedEvent, ExecutionFailedEvent, ExecutionLog, ExecutionStartedEvent, ExecutionStatus, ListExecutionsRequest, ListExecutionsResponse, PhaseCompletedEvent, PhaseCondition, PhaseExecutionStatus, PhaseStartedEvent, WorkflowAgent, WorkflowAgentSchema, WorkflowConfigSchema, WorkflowDefinitionSchema, WorkflowEvent, WorkflowExecution, WorkflowPhaseSchema } from './types.mjs';
|
|
3
|
+
export { WaveWorkflowClient, WaveWorkflowClientConfig, WorkflowClientEvents, createClient } from './client.mjs';
|
|
4
|
+
import 'zod';
|
|
5
|
+
import 'eventemitter3';
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* WAVE Workflow Builder
|
|
9
|
+
*
|
|
10
|
+
* Fluent builder API for creating workflow definitions.
|
|
11
|
+
*/
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* Workflow Builder
|
|
15
|
+
*
|
|
16
|
+
* @example
|
|
17
|
+
* ```typescript
|
|
18
|
+
* const workflow = new WorkflowBuilder('my-workflow')
|
|
19
|
+
* .name('My Workflow')
|
|
20
|
+
* .description('Processes data through multiple stages')
|
|
21
|
+
* .category('data-processing')
|
|
22
|
+
* .version('1.0.0')
|
|
23
|
+
* .phase('extract', (phase) =>
|
|
24
|
+
* phase
|
|
25
|
+
* .description('Extract data from source')
|
|
26
|
+
* .agent('data-extractor', { source: 'api' })
|
|
27
|
+
* )
|
|
28
|
+
* .phase('transform', (phase) =>
|
|
29
|
+
* phase
|
|
30
|
+
* .description('Transform data')
|
|
31
|
+
* .agent('data-transformer')
|
|
32
|
+
* )
|
|
33
|
+
* .phase('load', (phase) =>
|
|
34
|
+
* phase
|
|
35
|
+
* .description('Load data to destination')
|
|
36
|
+
* .agent('data-loader', { destination: 'database' })
|
|
37
|
+
* )
|
|
38
|
+
* .config({
|
|
39
|
+
* timeout_seconds: 3600,
|
|
40
|
+
* checkpoint_enabled: true,
|
|
41
|
+
* })
|
|
42
|
+
* .build();
|
|
43
|
+
* ```
|
|
44
|
+
*/
|
|
45
|
+
declare class WorkflowBuilder {
|
|
46
|
+
private definition;
|
|
47
|
+
constructor(slug: string);
|
|
48
|
+
/**
|
|
49
|
+
* Set the workflow name
|
|
50
|
+
*/
|
|
51
|
+
name(name: string): this;
|
|
52
|
+
/**
|
|
53
|
+
* Set the workflow description
|
|
54
|
+
*/
|
|
55
|
+
description(description: string): this;
|
|
56
|
+
/**
|
|
57
|
+
* Set the workflow category
|
|
58
|
+
*/
|
|
59
|
+
category(category: string): this;
|
|
60
|
+
/**
|
|
61
|
+
* Set the workflow version
|
|
62
|
+
*/
|
|
63
|
+
version(version: string): this;
|
|
64
|
+
/**
|
|
65
|
+
* Add tags to the workflow
|
|
66
|
+
*/
|
|
67
|
+
tags(...tags: string[]): this;
|
|
68
|
+
/**
|
|
69
|
+
* Add a phase to the workflow
|
|
70
|
+
*/
|
|
71
|
+
phase(name: string, builder: (phase: PhaseBuilder) => PhaseBuilder): this;
|
|
72
|
+
/**
|
|
73
|
+
* Set workflow configuration
|
|
74
|
+
*/
|
|
75
|
+
config(config: WorkflowConfig): this;
|
|
76
|
+
/**
|
|
77
|
+
* Set timeout in seconds
|
|
78
|
+
*/
|
|
79
|
+
timeout(seconds: number): this;
|
|
80
|
+
/**
|
|
81
|
+
* Enable checkpointing
|
|
82
|
+
*/
|
|
83
|
+
enableCheckpoints(): this;
|
|
84
|
+
/**
|
|
85
|
+
* Set max retries
|
|
86
|
+
*/
|
|
87
|
+
maxRetries(retries: number): this;
|
|
88
|
+
/**
|
|
89
|
+
* Build and validate the workflow definition
|
|
90
|
+
*/
|
|
91
|
+
build(): Omit<WorkflowDefinition, 'id' | 'organization_id' | 'created_by' | 'status' | 'created_at' | 'updated_at'>;
|
|
92
|
+
/**
|
|
93
|
+
* Export as JSON
|
|
94
|
+
*/
|
|
95
|
+
toJSON(): string;
|
|
96
|
+
}
|
|
97
|
+
/**
|
|
98
|
+
* Phase Builder
|
|
99
|
+
*/
|
|
100
|
+
declare class PhaseBuilder {
|
|
101
|
+
private phase;
|
|
102
|
+
constructor(name: string, order: number);
|
|
103
|
+
/**
|
|
104
|
+
* Set phase description
|
|
105
|
+
*/
|
|
106
|
+
description(description: string): this;
|
|
107
|
+
/**
|
|
108
|
+
* Add an agent to the phase
|
|
109
|
+
*/
|
|
110
|
+
agent(type: string, config?: Record<string, unknown>): this;
|
|
111
|
+
/**
|
|
112
|
+
* Add an agent with full configuration
|
|
113
|
+
*/
|
|
114
|
+
agentWithRetry(type: string, config: Record<string, unknown>, retryPolicy: RetryPolicy): this;
|
|
115
|
+
/**
|
|
116
|
+
* Set conditional execution based on expression
|
|
117
|
+
*/
|
|
118
|
+
runIf(expression: string): this;
|
|
119
|
+
/**
|
|
120
|
+
* Set conditional execution based on previous phase status
|
|
121
|
+
*/
|
|
122
|
+
runAfter(status: 'completed' | 'skipped'): this;
|
|
123
|
+
/**
|
|
124
|
+
* Set failure behavior
|
|
125
|
+
*/
|
|
126
|
+
onFailure(behavior: 'fail' | 'skip' | 'retry'): this;
|
|
127
|
+
/**
|
|
128
|
+
* Build the phase
|
|
129
|
+
*/
|
|
130
|
+
build(): WorkflowPhase;
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
/**
|
|
134
|
+
* WAVE Workflow SDK
|
|
135
|
+
*
|
|
136
|
+
* Official SDK for building and executing workflows on the WAVE platform.
|
|
137
|
+
*
|
|
138
|
+
* @packageDocumentation
|
|
139
|
+
* @module @wave/workflow-sdk
|
|
140
|
+
*
|
|
141
|
+
* @example
|
|
142
|
+
* ```typescript
|
|
143
|
+
* import { WaveWorkflowClient } from '@wave/workflow-sdk';
|
|
144
|
+
*
|
|
145
|
+
* const client = new WaveWorkflowClient({
|
|
146
|
+
* apiKey: process.env.WAVE_API_KEY!,
|
|
147
|
+
* organizationId: 'org_123',
|
|
148
|
+
* });
|
|
149
|
+
*
|
|
150
|
+
* // Execute a workflow
|
|
151
|
+
* const execution = await client.execute('my-workflow', {
|
|
152
|
+
* input_params: { environment: 'production' },
|
|
153
|
+
* });
|
|
154
|
+
*
|
|
155
|
+
* // Wait for completion
|
|
156
|
+
* const result = await client.waitForCompletion(execution.id, {
|
|
157
|
+
* onProgress: (exec) => console.log(`Status: ${exec.status}`),
|
|
158
|
+
* });
|
|
159
|
+
*
|
|
160
|
+
* console.log('Output:', result.output);
|
|
161
|
+
* ```
|
|
162
|
+
*/
|
|
163
|
+
|
|
164
|
+
/**
|
|
165
|
+
* SDK version
|
|
166
|
+
*/
|
|
167
|
+
declare const VERSION = "1.0.0";
|
|
168
|
+
/**
|
|
169
|
+
* Default API base URL
|
|
170
|
+
*/
|
|
171
|
+
declare const DEFAULT_API_URL = "https://api.wave.online";
|
|
172
|
+
|
|
173
|
+
export { DEFAULT_API_URL, RetryPolicy, VERSION, WorkflowBuilder, WorkflowConfig, WorkflowDefinition, WorkflowPhase };
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,173 @@
|
|
|
1
|
+
import { RetryPolicy, WorkflowPhase, WorkflowConfig, WorkflowDefinition } from './types.js';
|
|
2
|
+
export { AnyWorkflowEvent, ExecuteWorkflowRequest, ExecuteWorkflowRequestSchema, ExecuteWorkflowResponse, ExecutionCompletedEvent, ExecutionFailedEvent, ExecutionLog, ExecutionStartedEvent, ExecutionStatus, ListExecutionsRequest, ListExecutionsResponse, PhaseCompletedEvent, PhaseCondition, PhaseExecutionStatus, PhaseStartedEvent, WorkflowAgent, WorkflowAgentSchema, WorkflowConfigSchema, WorkflowDefinitionSchema, WorkflowEvent, WorkflowExecution, WorkflowPhaseSchema } from './types.js';
|
|
3
|
+
export { WaveWorkflowClient, WaveWorkflowClientConfig, WorkflowClientEvents, createClient } from './client.js';
|
|
4
|
+
import 'zod';
|
|
5
|
+
import 'eventemitter3';
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* WAVE Workflow Builder
|
|
9
|
+
*
|
|
10
|
+
* Fluent builder API for creating workflow definitions.
|
|
11
|
+
*/
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* Workflow Builder
|
|
15
|
+
*
|
|
16
|
+
* @example
|
|
17
|
+
* ```typescript
|
|
18
|
+
* const workflow = new WorkflowBuilder('my-workflow')
|
|
19
|
+
* .name('My Workflow')
|
|
20
|
+
* .description('Processes data through multiple stages')
|
|
21
|
+
* .category('data-processing')
|
|
22
|
+
* .version('1.0.0')
|
|
23
|
+
* .phase('extract', (phase) =>
|
|
24
|
+
* phase
|
|
25
|
+
* .description('Extract data from source')
|
|
26
|
+
* .agent('data-extractor', { source: 'api' })
|
|
27
|
+
* )
|
|
28
|
+
* .phase('transform', (phase) =>
|
|
29
|
+
* phase
|
|
30
|
+
* .description('Transform data')
|
|
31
|
+
* .agent('data-transformer')
|
|
32
|
+
* )
|
|
33
|
+
* .phase('load', (phase) =>
|
|
34
|
+
* phase
|
|
35
|
+
* .description('Load data to destination')
|
|
36
|
+
* .agent('data-loader', { destination: 'database' })
|
|
37
|
+
* )
|
|
38
|
+
* .config({
|
|
39
|
+
* timeout_seconds: 3600,
|
|
40
|
+
* checkpoint_enabled: true,
|
|
41
|
+
* })
|
|
42
|
+
* .build();
|
|
43
|
+
* ```
|
|
44
|
+
*/
|
|
45
|
+
declare class WorkflowBuilder {
|
|
46
|
+
private definition;
|
|
47
|
+
constructor(slug: string);
|
|
48
|
+
/**
|
|
49
|
+
* Set the workflow name
|
|
50
|
+
*/
|
|
51
|
+
name(name: string): this;
|
|
52
|
+
/**
|
|
53
|
+
* Set the workflow description
|
|
54
|
+
*/
|
|
55
|
+
description(description: string): this;
|
|
56
|
+
/**
|
|
57
|
+
* Set the workflow category
|
|
58
|
+
*/
|
|
59
|
+
category(category: string): this;
|
|
60
|
+
/**
|
|
61
|
+
* Set the workflow version
|
|
62
|
+
*/
|
|
63
|
+
version(version: string): this;
|
|
64
|
+
/**
|
|
65
|
+
* Add tags to the workflow
|
|
66
|
+
*/
|
|
67
|
+
tags(...tags: string[]): this;
|
|
68
|
+
/**
|
|
69
|
+
* Add a phase to the workflow
|
|
70
|
+
*/
|
|
71
|
+
phase(name: string, builder: (phase: PhaseBuilder) => PhaseBuilder): this;
|
|
72
|
+
/**
|
|
73
|
+
* Set workflow configuration
|
|
74
|
+
*/
|
|
75
|
+
config(config: WorkflowConfig): this;
|
|
76
|
+
/**
|
|
77
|
+
* Set timeout in seconds
|
|
78
|
+
*/
|
|
79
|
+
timeout(seconds: number): this;
|
|
80
|
+
/**
|
|
81
|
+
* Enable checkpointing
|
|
82
|
+
*/
|
|
83
|
+
enableCheckpoints(): this;
|
|
84
|
+
/**
|
|
85
|
+
* Set max retries
|
|
86
|
+
*/
|
|
87
|
+
maxRetries(retries: number): this;
|
|
88
|
+
/**
|
|
89
|
+
* Build and validate the workflow definition
|
|
90
|
+
*/
|
|
91
|
+
build(): Omit<WorkflowDefinition, 'id' | 'organization_id' | 'created_by' | 'status' | 'created_at' | 'updated_at'>;
|
|
92
|
+
/**
|
|
93
|
+
* Export as JSON
|
|
94
|
+
*/
|
|
95
|
+
toJSON(): string;
|
|
96
|
+
}
|
|
97
|
+
/**
|
|
98
|
+
* Phase Builder
|
|
99
|
+
*/
|
|
100
|
+
declare class PhaseBuilder {
|
|
101
|
+
private phase;
|
|
102
|
+
constructor(name: string, order: number);
|
|
103
|
+
/**
|
|
104
|
+
* Set phase description
|
|
105
|
+
*/
|
|
106
|
+
description(description: string): this;
|
|
107
|
+
/**
|
|
108
|
+
* Add an agent to the phase
|
|
109
|
+
*/
|
|
110
|
+
agent(type: string, config?: Record<string, unknown>): this;
|
|
111
|
+
/**
|
|
112
|
+
* Add an agent with full configuration
|
|
113
|
+
*/
|
|
114
|
+
agentWithRetry(type: string, config: Record<string, unknown>, retryPolicy: RetryPolicy): this;
|
|
115
|
+
/**
|
|
116
|
+
* Set conditional execution based on expression
|
|
117
|
+
*/
|
|
118
|
+
runIf(expression: string): this;
|
|
119
|
+
/**
|
|
120
|
+
* Set conditional execution based on previous phase status
|
|
121
|
+
*/
|
|
122
|
+
runAfter(status: 'completed' | 'skipped'): this;
|
|
123
|
+
/**
|
|
124
|
+
* Set failure behavior
|
|
125
|
+
*/
|
|
126
|
+
onFailure(behavior: 'fail' | 'skip' | 'retry'): this;
|
|
127
|
+
/**
|
|
128
|
+
* Build the phase
|
|
129
|
+
*/
|
|
130
|
+
build(): WorkflowPhase;
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
/**
|
|
134
|
+
* WAVE Workflow SDK
|
|
135
|
+
*
|
|
136
|
+
* Official SDK for building and executing workflows on the WAVE platform.
|
|
137
|
+
*
|
|
138
|
+
* @packageDocumentation
|
|
139
|
+
* @module @wave/workflow-sdk
|
|
140
|
+
*
|
|
141
|
+
* @example
|
|
142
|
+
* ```typescript
|
|
143
|
+
* import { WaveWorkflowClient } from '@wave/workflow-sdk';
|
|
144
|
+
*
|
|
145
|
+
* const client = new WaveWorkflowClient({
|
|
146
|
+
* apiKey: process.env.WAVE_API_KEY!,
|
|
147
|
+
* organizationId: 'org_123',
|
|
148
|
+
* });
|
|
149
|
+
*
|
|
150
|
+
* // Execute a workflow
|
|
151
|
+
* const execution = await client.execute('my-workflow', {
|
|
152
|
+
* input_params: { environment: 'production' },
|
|
153
|
+
* });
|
|
154
|
+
*
|
|
155
|
+
* // Wait for completion
|
|
156
|
+
* const result = await client.waitForCompletion(execution.id, {
|
|
157
|
+
* onProgress: (exec) => console.log(`Status: ${exec.status}`),
|
|
158
|
+
* });
|
|
159
|
+
*
|
|
160
|
+
* console.log('Output:', result.output);
|
|
161
|
+
* ```
|
|
162
|
+
*/
|
|
163
|
+
|
|
164
|
+
/**
|
|
165
|
+
* SDK version
|
|
166
|
+
*/
|
|
167
|
+
declare const VERSION = "1.0.0";
|
|
168
|
+
/**
|
|
169
|
+
* Default API base URL
|
|
170
|
+
*/
|
|
171
|
+
declare const DEFAULT_API_URL = "https://api.wave.online";
|
|
172
|
+
|
|
173
|
+
export { DEFAULT_API_URL, RetryPolicy, VERSION, WorkflowBuilder, WorkflowConfig, WorkflowDefinition, WorkflowPhase };
|