@orbytautomation/engine 0.2.4 → 0.3.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/README.md +1 -1
- package/dist/errors/ErrorCodes.d.ts +205 -6
- package/dist/errors/ErrorCodes.d.ts.map +1 -1
- package/dist/errors/ErrorCodes.js +398 -5
- package/dist/errors/ErrorCodes.js.map +1 -1
- package/dist/errors/ErrorDebugger.d.ts +98 -0
- package/dist/errors/ErrorDebugger.d.ts.map +1 -0
- package/dist/errors/ErrorDebugger.js +283 -0
- package/dist/errors/ErrorDebugger.js.map +1 -0
- package/dist/errors/ErrorDetector.d.ts +148 -0
- package/dist/errors/ErrorDetector.d.ts.map +1 -0
- package/dist/errors/ErrorDetector.js +358 -0
- package/dist/errors/ErrorDetector.js.map +1 -0
- package/dist/errors/ErrorFormatter.d.ts +92 -3
- package/dist/errors/ErrorFormatter.d.ts.map +1 -1
- package/dist/errors/ErrorFormatter.js +220 -4
- package/dist/errors/ErrorFormatter.js.map +1 -1
- package/dist/errors/ErrorHandler.d.ts +259 -0
- package/dist/errors/ErrorHandler.d.ts.map +1 -0
- package/dist/errors/ErrorHandler.js +378 -0
- package/dist/errors/ErrorHandler.js.map +1 -0
- package/dist/errors/FieldRegistry.d.ts +39 -0
- package/dist/errors/FieldRegistry.d.ts.map +1 -1
- package/dist/errors/FieldRegistry.js +172 -74
- package/dist/errors/FieldRegistry.js.map +1 -1
- package/dist/errors/OrbytError.d.ts +85 -3
- package/dist/errors/OrbytError.d.ts.map +1 -1
- package/dist/errors/OrbytError.js +151 -4
- package/dist/errors/OrbytError.js.map +1 -1
- package/dist/errors/SchedulerError.d.ts +93 -1
- package/dist/errors/SchedulerError.d.ts.map +1 -1
- package/dist/errors/SchedulerError.js +145 -1
- package/dist/errors/SchedulerError.js.map +1 -1
- package/dist/errors/SecurityErrors.d.ts +94 -12
- package/dist/errors/SecurityErrors.d.ts.map +1 -1
- package/dist/errors/SecurityErrors.js +162 -18
- package/dist/errors/SecurityErrors.js.map +1 -1
- package/dist/errors/StepError.d.ts +111 -1
- package/dist/errors/StepError.d.ts.map +1 -1
- package/dist/errors/StepError.js +182 -1
- package/dist/errors/StepError.js.map +1 -1
- package/dist/errors/WorkflowError.d.ts +139 -2
- package/dist/errors/WorkflowError.d.ts.map +1 -1
- package/dist/errors/WorkflowError.js +264 -22
- package/dist/errors/WorkflowError.js.map +1 -1
- package/dist/errors/index.d.ts +5 -1
- package/dist/errors/index.d.ts.map +1 -1
- package/dist/errors/index.js +7 -4
- package/dist/errors/index.js.map +1 -1
- package/dist/loader/WorkflowLoader.d.ts +83 -21
- package/dist/loader/WorkflowLoader.d.ts.map +1 -1
- package/dist/loader/WorkflowLoader.js +169 -55
- package/dist/loader/WorkflowLoader.js.map +1 -1
- package/dist/parser/SchemaValidator.d.ts.map +1 -1
- package/dist/parser/SchemaValidator.js +2 -1
- package/dist/parser/SchemaValidator.js.map +1 -1
- package/package.json +1 -1
|
@@ -1,11 +1,36 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Security Error System
|
|
3
3
|
*
|
|
4
|
-
* Structured errors for security violations.
|
|
5
|
-
* These errors are thrown when users attempt to
|
|
4
|
+
* Structured errors for security violations in workflows.
|
|
5
|
+
* These errors are thrown when users attempt to:
|
|
6
|
+
* - Manipulate engine-controlled fields
|
|
7
|
+
* - Use reserved field names/annotations
|
|
8
|
+
* - Override billing, execution, or identity fields
|
|
9
|
+
* - Bypass security boundaries
|
|
10
|
+
*
|
|
11
|
+
* CRITICAL: Security errors indicate attempts to compromise:
|
|
12
|
+
* - Billing integrity and usage tracking
|
|
13
|
+
* - Audit trails and compliance
|
|
14
|
+
* - Execution identity and ownership
|
|
15
|
+
* - Security boundaries
|
|
16
|
+
*
|
|
17
|
+
* USAGE:
|
|
18
|
+
* =====
|
|
19
|
+
* Use factory methods for creating security errors:
|
|
20
|
+
*
|
|
21
|
+
* ```typescript
|
|
22
|
+
* // ❌ Bad: Generic error
|
|
23
|
+
* throw new Error('Reserved field');
|
|
24
|
+
*
|
|
25
|
+
* // ✅ Good: Structured security error
|
|
26
|
+
* throw SecurityError.reservedFieldOverride('_internal', 'workflow.context');
|
|
27
|
+
* ```
|
|
6
28
|
*
|
|
7
29
|
* @module errors/security
|
|
8
30
|
*/
|
|
31
|
+
import { ExitCodes } from '@dev-ecosystem/core';
|
|
32
|
+
import { OrbytError } from './OrbytError.js';
|
|
33
|
+
import { OrbytErrorCode, ErrorSeverity } from './ErrorCodes.js';
|
|
9
34
|
/**
|
|
10
35
|
* Security error codes
|
|
11
36
|
*/
|
|
@@ -30,21 +55,37 @@ export var SecurityErrorCode;
|
|
|
30
55
|
* Security Error
|
|
31
56
|
*
|
|
32
57
|
* Thrown when users attempt to manipulate engine-controlled fields.
|
|
33
|
-
*
|
|
58
|
+
* Extends OrbytError to provide consistent error handling with proper exit codes.
|
|
59
|
+
*
|
|
60
|
+
* CRITICAL: Security violations indicate attempts to compromise:
|
|
61
|
+
* - Billing integrity → Manipulating usage tracking
|
|
62
|
+
* - Audit compliance → Hiding execution traces
|
|
63
|
+
* - System security → Bypassing access controls
|
|
34
64
|
*/
|
|
35
|
-
export class SecurityError extends
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
65
|
+
export class SecurityError extends OrbytError {
|
|
66
|
+
violations; // For backward compatibility
|
|
67
|
+
constructor(diagnostic) {
|
|
68
|
+
// Support both new OrbytError format and legacy SecurityViolationDetails[] format
|
|
69
|
+
if (Array.isArray(diagnostic)) {
|
|
70
|
+
// Legacy format: convert to OrbytError diagnostic
|
|
71
|
+
const errorMessage = SecurityError.formatViolations(diagnostic);
|
|
72
|
+
super({
|
|
73
|
+
code: OrbytErrorCode.RUNTIME_PERMISSION_DENIED,
|
|
74
|
+
exitCode: ExitCodes.SECURITY_VIOLATION,
|
|
75
|
+
message: errorMessage,
|
|
76
|
+
hint: 'Remove all reserved fields from your workflow',
|
|
77
|
+
severity: ErrorSeverity.ERROR,
|
|
78
|
+
context: { violations: diagnostic },
|
|
79
|
+
});
|
|
80
|
+
this.violations = diagnostic;
|
|
81
|
+
}
|
|
82
|
+
else {
|
|
83
|
+
// New format: use OrbytError diagnostic
|
|
84
|
+
super({
|
|
85
|
+
...diagnostic,
|
|
86
|
+
severity: ErrorSeverity.ERROR,
|
|
87
|
+
exitCode: diagnostic.exitCode || ExitCodes.SECURITY_VIOLATION,
|
|
88
|
+
});
|
|
48
89
|
}
|
|
49
90
|
}
|
|
50
91
|
/**
|
|
@@ -123,6 +164,93 @@ export class SecurityError extends Error {
|
|
|
123
164
|
lines.push('━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━');
|
|
124
165
|
return lines.join('\n');
|
|
125
166
|
}
|
|
167
|
+
// ==================== FACTORY METHODS ====================
|
|
168
|
+
/**
|
|
169
|
+
* Create reserved field override error
|
|
170
|
+
*
|
|
171
|
+
* @param field - Reserved field name that was attempted
|
|
172
|
+
* @param path - Path where field was found
|
|
173
|
+
* @param fieldType - Type of reserved field (e.g., 'billing', 'execution', 'internal')
|
|
174
|
+
* @returns SecurityError for reserved field violation
|
|
175
|
+
*/
|
|
176
|
+
static reservedFieldOverride(field, path, fieldType = 'internal') {
|
|
177
|
+
const reasons = {
|
|
178
|
+
billing: 'Billing fields control cost tracking and cannot be user-defined',
|
|
179
|
+
execution: 'Execution fields are managed by engine for workflow orchestration',
|
|
180
|
+
identity: 'Identity fields track user/org ownership and cannot be modified',
|
|
181
|
+
ownership: 'Ownership fields establish resource access control',
|
|
182
|
+
usage: 'Usage counters track resource consumption for billing',
|
|
183
|
+
internal: 'Internal state fields are engine-managed and cannot be set by users',
|
|
184
|
+
};
|
|
185
|
+
return new SecurityError({
|
|
186
|
+
code: OrbytErrorCode.RUNTIME_PERMISSION_DENIED,
|
|
187
|
+
exitCode: ExitCodes.SECURITY_VIOLATION,
|
|
188
|
+
message: `Reserved field "${field}" cannot be set in workflow`,
|
|
189
|
+
hint: `Remove "${field}" from your workflow. ${reasons[fieldType]}`,
|
|
190
|
+
path,
|
|
191
|
+
severity: ErrorSeverity.ERROR,
|
|
192
|
+
context: { field, fieldType, reason: reasons[fieldType] },
|
|
193
|
+
});
|
|
194
|
+
}
|
|
195
|
+
/**
|
|
196
|
+
* Create reserved annotation namespace error
|
|
197
|
+
*
|
|
198
|
+
* @param annotation - Annotation key that uses reserved namespace
|
|
199
|
+
* @param path - Path where annotation was found
|
|
200
|
+
* @returns SecurityError for reserved annotation usage
|
|
201
|
+
*/
|
|
202
|
+
static reservedAnnotation(annotation, path) {
|
|
203
|
+
return new SecurityError({
|
|
204
|
+
code: OrbytErrorCode.RUNTIME_PERMISSION_DENIED,
|
|
205
|
+
exitCode: ExitCodes.SECURITY_VIOLATION,
|
|
206
|
+
message: `Reserved annotation namespace "${annotation}" cannot be used`,
|
|
207
|
+
hint: 'Annotations starting with "orbyt." or "_" are reserved. Use your own namespace',
|
|
208
|
+
path,
|
|
209
|
+
severity: ErrorSeverity.ERROR,
|
|
210
|
+
context: { annotation },
|
|
211
|
+
});
|
|
212
|
+
}
|
|
213
|
+
/**
|
|
214
|
+
* Create field manipulation detected error
|
|
215
|
+
*
|
|
216
|
+
* @param fields - Array of protected fields that were attempted
|
|
217
|
+
* @param path - Path where manipulation was detected
|
|
218
|
+
* @returns SecurityError with multiple violations
|
|
219
|
+
*/
|
|
220
|
+
static fieldManipulationDetected(fields, path) {
|
|
221
|
+
const fieldList = fields.map(f => f.field).join(', ');
|
|
222
|
+
return new SecurityError({
|
|
223
|
+
code: OrbytErrorCode.RUNTIME_PERMISSION_DENIED,
|
|
224
|
+
exitCode: ExitCodes.SECURITY_VIOLATION,
|
|
225
|
+
message: `Attempt to manipulate protected fields: ${fieldList}`,
|
|
226
|
+
hint: 'Remove all engine-controlled fields from your workflow definition',
|
|
227
|
+
path,
|
|
228
|
+
severity: ErrorSeverity.ERROR,
|
|
229
|
+
context: { fields },
|
|
230
|
+
});
|
|
231
|
+
}
|
|
232
|
+
/**
|
|
233
|
+
* Create permission denied error
|
|
234
|
+
*
|
|
235
|
+
* @param resource - Resource that was attempted to access
|
|
236
|
+
* @param path - Path where access was attempted
|
|
237
|
+
* @param requiredPermission - Required permission that was missing (optional)
|
|
238
|
+
* @returns SecurityError for insufficient permissions
|
|
239
|
+
*/
|
|
240
|
+
static permissionDenied(resource, path, requiredPermission) {
|
|
241
|
+
const hint = requiredPermission
|
|
242
|
+
? `This operation requires permission: ${requiredPermission}`
|
|
243
|
+
: 'Check access permissions and workflow ownership';
|
|
244
|
+
return new SecurityError({
|
|
245
|
+
code: OrbytErrorCode.RUNTIME_PERMISSION_DENIED,
|
|
246
|
+
exitCode: ExitCodes.PERMISSION_DENIED,
|
|
247
|
+
message: `Permission denied for resource: ${resource}`,
|
|
248
|
+
hint,
|
|
249
|
+
path,
|
|
250
|
+
severity: ErrorSeverity.ERROR,
|
|
251
|
+
context: { resource, requiredPermission },
|
|
252
|
+
});
|
|
253
|
+
}
|
|
126
254
|
/**
|
|
127
255
|
* Convert to JSON for API responses
|
|
128
256
|
*/
|
|
@@ -131,13 +259,29 @@ export class SecurityError extends Error {
|
|
|
131
259
|
error: this.name,
|
|
132
260
|
code: this.code,
|
|
133
261
|
message: this.message,
|
|
134
|
-
|
|
135
|
-
|
|
262
|
+
exitCode: this.exitCode,
|
|
263
|
+
hint: this.hint,
|
|
264
|
+
violations: this.violations, // Legacy support
|
|
265
|
+
severity: this.severity,
|
|
266
|
+
context: this.diagnostic.context,
|
|
136
267
|
};
|
|
137
268
|
}
|
|
138
269
|
}
|
|
139
270
|
/**
|
|
140
271
|
* Create a security error for reserved field violations
|
|
272
|
+
*
|
|
273
|
+
* @deprecated Use SecurityError.reservedFieldOverride() or other factory methods instead
|
|
274
|
+
* @param violations - Array of security violation details
|
|
275
|
+
* @returns SecurityError instance
|
|
276
|
+
*
|
|
277
|
+
* @example
|
|
278
|
+
* ```typescript
|
|
279
|
+
* // Old way (legacy):
|
|
280
|
+
* const error = createSecurityError([{ field: '_internal', ... }]);
|
|
281
|
+
*
|
|
282
|
+
* // New way (preferred):
|
|
283
|
+
* const error = SecurityError.reservedFieldOverride('_internal', 'workflow.context');
|
|
284
|
+
* ```
|
|
141
285
|
*/
|
|
142
286
|
export function createSecurityError(violations) {
|
|
143
287
|
return new SecurityError(violations);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SecurityErrors.js","sourceRoot":"","sources":["../../src/errors/SecurityErrors.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"SecurityErrors.js","sourceRoot":"","sources":["../../src/errors/SecurityErrors.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AAEH,OAAO,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAChD,OAAO,EAAE,UAAU,EAA6B,MAAM,iBAAiB,CAAC;AACxE,OAAO,EAAE,cAAc,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAEhE;;GAEG;AACH,MAAM,CAAN,IAAY,iBAqBX;AArBD,WAAY,iBAAiB;IAC3B,kDAAkD;IAClD,+EAA0D,CAAA;IAE1D,mDAAmD;IACnD,6EAAwD,CAAA;IAExD,sDAAsD;IACtD,+EAA0D,CAAA;IAE1D,6CAA6C;IAC7C,iFAA4D,CAAA;IAE5D,iDAAiD;IACjD,6EAAwD,CAAA;IAExD,kDAAkD;IAClD,+EAA0D,CAAA;IAE1D,0DAA0D;IAC1D,2FAAsE,CAAA;AACxE,CAAC,EArBW,iBAAiB,KAAjB,iBAAiB,QAqB5B;AA0BD;;;;;;;;;;GAUG;AACH,MAAM,OAAO,aAAc,SAAQ,UAAU;IAC3B,UAAU,CAA8B,CAAC,6BAA6B;IAEtF,YAAY,UAA6D;QACvE,kFAA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ACrB,QAAQ,EAAE,IAAI,CAAC,QAAQ;YACvB,IAAI,EAAE,IAAI,CAAC,IAAI;YACf,UAAU,EAAE,IAAI,CAAC,UAAU,EAAE,iBAAiB;YAC9C,QAAQ,EAAE,IAAI,CAAC,QAAQ;YACvB,OAAO,EAAE,IAAI,CAAC,UAAU,CAAC,OAAO;SACjC,CAAC;IACJ,CAAC;CACF;AAED;;;;;;;;;;;;;;;GAeG;AACH,MAAM,UAAU,mBAAmB,CAAC,UAAsC;IACxE,OAAO,IAAI,aAAa,CAAC,UAAU,CAAC,CAAC;AACvC,CAAC"}
|
|
@@ -1,2 +1,112 @@
|
|
|
1
|
-
|
|
1
|
+
/**
|
|
2
|
+
* Step Error
|
|
3
|
+
*
|
|
4
|
+
* Structured error for step-level execution failures.
|
|
5
|
+
* Provides detailed context about which step failed and why.
|
|
6
|
+
*
|
|
7
|
+
* Exit codes:
|
|
8
|
+
* - STEP_FAILED: General step execution failure
|
|
9
|
+
* - TIMEOUT: Step timeout
|
|
10
|
+
* - VALIDATION_FAILED: Invalid step configuration
|
|
11
|
+
* - DEPENDENCY_FAILED: Dependency not met
|
|
12
|
+
*
|
|
13
|
+
* @module errors
|
|
14
|
+
*/
|
|
15
|
+
import { ExitCodes } from '@dev-ecosystem/core';
|
|
16
|
+
import { OrbytError } from './OrbytError.js';
|
|
17
|
+
/**
|
|
18
|
+
* Step error codes from ecosystem-core
|
|
19
|
+
*/
|
|
20
|
+
export declare enum StepErrorCode {
|
|
21
|
+
/** Step not found in workflow */
|
|
22
|
+
STEP_NOT_FOUND = "ORBYT-STEP-001",
|
|
23
|
+
/** Step execution timeout */
|
|
24
|
+
STEP_TIMEOUT = "ORBYT-STEP-002",
|
|
25
|
+
/** Step execution failed */
|
|
26
|
+
STEP_EXECUTION_FAILED = "ORBYT-STEP-003",
|
|
27
|
+
/** Step dependency not met */
|
|
28
|
+
STEP_DEPENDENCY_FAILED = "ORBYT-STEP-004",
|
|
29
|
+
/** Invalid step configuration */
|
|
30
|
+
STEP_CONFIG_INVALID = "ORBYT-STEP-005",
|
|
31
|
+
/** Duplicate step ID */
|
|
32
|
+
STEP_DUPLICATE_ID = "ORBYT-STEP-006",
|
|
33
|
+
/** Step condition evaluation failed */
|
|
34
|
+
STEP_CONDITION_FAILED = "ORBYT-STEP-007",
|
|
35
|
+
/** Step output mapping failed */
|
|
36
|
+
STEP_OUTPUT_MAPPING_FAILED = "ORBYT-STEP-008"
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* Step-specific error context
|
|
40
|
+
*/
|
|
41
|
+
export interface StepErrorContext {
|
|
42
|
+
/** Step ID where error occurred */
|
|
43
|
+
stepId: string;
|
|
44
|
+
/** Step name (human-readable) */
|
|
45
|
+
stepName?: string;
|
|
46
|
+
/** Action being executed */
|
|
47
|
+
action?: string;
|
|
48
|
+
/** Step index in workflow */
|
|
49
|
+
stepIndex?: number;
|
|
50
|
+
/** Input parameters that were used */
|
|
51
|
+
inputs?: Record<string, any>;
|
|
52
|
+
/** Dependencies that were not met */
|
|
53
|
+
missingDependencies?: string[];
|
|
54
|
+
/** Timeout duration if applicable */
|
|
55
|
+
timeoutDuration?: string;
|
|
56
|
+
/** Exit code if available */
|
|
57
|
+
exitCode?: number;
|
|
58
|
+
/** Additional context */
|
|
59
|
+
[key: string]: any;
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* Step Error class
|
|
63
|
+
*/
|
|
64
|
+
export declare class StepError extends OrbytError {
|
|
65
|
+
readonly stepId: string;
|
|
66
|
+
readonly stepName?: string;
|
|
67
|
+
readonly action?: string;
|
|
68
|
+
constructor(params: {
|
|
69
|
+
code: StepErrorCode;
|
|
70
|
+
message: string;
|
|
71
|
+
stepId: string;
|
|
72
|
+
stepName?: string;
|
|
73
|
+
action?: string;
|
|
74
|
+
context?: Partial<StepErrorContext>;
|
|
75
|
+
hint?: string;
|
|
76
|
+
cause?: Error;
|
|
77
|
+
exitCode?: ExitCodes;
|
|
78
|
+
});
|
|
79
|
+
/**
|
|
80
|
+
* Determine exit code based on step error code
|
|
81
|
+
*/
|
|
82
|
+
private static getExitCode;
|
|
83
|
+
/**
|
|
84
|
+
* Determine severity based on error code
|
|
85
|
+
*/
|
|
86
|
+
private static determineSeverity;
|
|
87
|
+
/**
|
|
88
|
+
* Factory: Step not found
|
|
89
|
+
*/
|
|
90
|
+
static notFound(stepId: string, workflowName?: string): StepError;
|
|
91
|
+
/**
|
|
92
|
+
* Factory: Step execution timeout
|
|
93
|
+
*/
|
|
94
|
+
static timeout(stepId: string, duration: string, stepName?: string): StepError;
|
|
95
|
+
/**
|
|
96
|
+
* Factory: Step execution failed
|
|
97
|
+
*/
|
|
98
|
+
static executionFailed(stepId: string, action: string, cause: Error, stepName?: string): StepError;
|
|
99
|
+
/**
|
|
100
|
+
* Factory: Step dependency failed
|
|
101
|
+
*/
|
|
102
|
+
static dependencyFailed(stepId: string, missingDependencies: string[], stepName?: string): StepError;
|
|
103
|
+
/**
|
|
104
|
+
* Factory: Invalid step configuration
|
|
105
|
+
*/
|
|
106
|
+
static invalidConfig(stepId: string, reason: string, stepName?: string): StepError;
|
|
107
|
+
/**
|
|
108
|
+
* Factory: Duplicate step ID
|
|
109
|
+
*/
|
|
110
|
+
static duplicateId(stepId: string): StepError;
|
|
111
|
+
}
|
|
2
112
|
//# sourceMappingURL=StepError.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"StepError.d.ts","sourceRoot":"","sources":["../../src/errors/StepError.ts"],"names":[],"mappings":""}
|
|
1
|
+
{"version":3,"file":"StepError.d.ts","sourceRoot":"","sources":["../../src/errors/StepError.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,OAAO,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAChD,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAG7C;;GAEG;AACH,oBAAY,aAAa;IACvB,iCAAiC;IACjC,cAAc,mBAAmB;IAEjC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C;QACpC,IAAI,CAAC,EAAE,MAAM,CAAC;QACd,KAAK,CAAC,EAAE,KAAK,CAAC;QACd,QAAQ,CAAC,EAAE,SAAS,CAAC;KACtB;IAqBD;;OAEG;IACH,OAAO,CAAC,MAAM,CAAC,WAAW;IAyB1B;;OAEG;IACH,OAAO,CAAC,MAAM,CAAC,iBAAiB;IAqBhC;;OAEG;IACH,MAAM,CAAC,QAAQ,CAAC,MAAM,EAAE,MAAM,EAAE,YAAY,CAAC,EAAE,MAAM,GAAG,SAAS;IASjE;;OAEG;IACH,MAAM,CAAC,OAAO,CAAC,MAAM,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,QAAQ,CAAC,EAAE,MAAM,GAAG,SAAS;IAW9E;;OAEG;IACH,MAAM,CAAC,eAAe,CACpB,MAAM,EAAE,MAAM,EACd,MAAM,EAAE,MAAM,EACd,KAAK,EAAE,KAAK,EACZ,QAAQ,CAAC,EAAE,MAAM,GAChB,SAAS;IAYZ;;OAEG;IACH,MAAM,CAAC,gBAAgB,CACrB,MAAM,EAAE,MAAM,EACd,mBAAmB,EAAE,MAAM,EAAE,EAC7B,QAAQ,CAAC,EAAE,MAAM,GAChB,SAAS;IAWZ;;OAEG;IACH,MAAM,CAAC,aAAa,CAClB,MAAM,EAAE,MAAM,EACd,MAAM,EAAE,MAAM,EACd,QAAQ,CAAC,EAAE,MAAM,GAChB,SAAS;IAUZ;;OAEG;IACH,MAAM,CAAC,WAAW,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS;CAQ9C"}
|
package/dist/errors/StepError.js
CHANGED
|
@@ -1,2 +1,183 @@
|
|
|
1
|
-
|
|
1
|
+
/**
|
|
2
|
+
* Step Error
|
|
3
|
+
*
|
|
4
|
+
* Structured error for step-level execution failures.
|
|
5
|
+
* Provides detailed context about which step failed and why.
|
|
6
|
+
*
|
|
7
|
+
* Exit codes:
|
|
8
|
+
* - STEP_FAILED: General step execution failure
|
|
9
|
+
* - TIMEOUT: Step timeout
|
|
10
|
+
* - VALIDATION_FAILED: Invalid step configuration
|
|
11
|
+
* - DEPENDENCY_FAILED: Dependency not met
|
|
12
|
+
*
|
|
13
|
+
* @module errors
|
|
14
|
+
*/
|
|
15
|
+
import { ExitCodes } from '@dev-ecosystem/core';
|
|
16
|
+
import { OrbytError } from './OrbytError.js';
|
|
17
|
+
import { ErrorSeverity } from './ErrorCodes.js';
|
|
18
|
+
/**
|
|
19
|
+
* Step error codes from ecosystem-core
|
|
20
|
+
*/
|
|
21
|
+
export var StepErrorCode;
|
|
22
|
+
(function (StepErrorCode) {
|
|
23
|
+
/** Step not found in workflow */
|
|
24
|
+
StepErrorCode["STEP_NOT_FOUND"] = "ORBYT-STEP-001";
|
|
25
|
+
/** Step execution timeout */
|
|
26
|
+
StepErrorCode["STEP_TIMEOUT"] = "ORBYT-STEP-002";
|
|
27
|
+
/** Step execution failed */
|
|
28
|
+
StepErrorCode["STEP_EXECUTION_FAILED"] = "ORBYT-STEP-003";
|
|
29
|
+
/** Step dependency not met */
|
|
30
|
+
StepErrorCode["STEP_DEPENDENCY_FAILED"] = "ORBYT-STEP-004";
|
|
31
|
+
/** Invalid step configuration */
|
|
32
|
+
StepErrorCode["STEP_CONFIG_INVALID"] = "ORBYT-STEP-005";
|
|
33
|
+
/** Duplicate step ID */
|
|
34
|
+
StepErrorCode["STEP_DUPLICATE_ID"] = "ORBYT-STEP-006";
|
|
35
|
+
/** Step condition evaluation failed */
|
|
36
|
+
StepErrorCode["STEP_CONDITION_FAILED"] = "ORBYT-STEP-007";
|
|
37
|
+
/** Step output mapping failed */
|
|
38
|
+
StepErrorCode["STEP_OUTPUT_MAPPING_FAILED"] = "ORBYT-STEP-008";
|
|
39
|
+
})(StepErrorCode || (StepErrorCode = {}));
|
|
40
|
+
/**
|
|
41
|
+
* Step Error class
|
|
42
|
+
*/
|
|
43
|
+
export class StepError extends OrbytError {
|
|
44
|
+
stepId;
|
|
45
|
+
stepName;
|
|
46
|
+
action;
|
|
47
|
+
constructor(params) {
|
|
48
|
+
super({
|
|
49
|
+
code: params.code,
|
|
50
|
+
message: params.message,
|
|
51
|
+
exitCode: params.exitCode || StepError.getExitCode(params.code),
|
|
52
|
+
severity: StepError.determineSeverity(params.code),
|
|
53
|
+
context: {
|
|
54
|
+
stepId: params.stepId,
|
|
55
|
+
stepName: params.stepName,
|
|
56
|
+
action: params.action,
|
|
57
|
+
causeMessage: params.cause?.message,
|
|
58
|
+
...params.context,
|
|
59
|
+
},
|
|
60
|
+
hint: params.hint,
|
|
61
|
+
});
|
|
62
|
+
this.stepId = params.stepId;
|
|
63
|
+
this.stepName = params.stepName;
|
|
64
|
+
this.action = params.action;
|
|
65
|
+
}
|
|
66
|
+
/**
|
|
67
|
+
* Determine exit code based on step error code
|
|
68
|
+
*/
|
|
69
|
+
static getExitCode(code) {
|
|
70
|
+
switch (code) {
|
|
71
|
+
case StepErrorCode.STEP_NOT_FOUND:
|
|
72
|
+
case StepErrorCode.STEP_CONFIG_INVALID:
|
|
73
|
+
case StepErrorCode.STEP_DUPLICATE_ID:
|
|
74
|
+
return ExitCodes.VALIDATION_FAILED;
|
|
75
|
+
case StepErrorCode.STEP_TIMEOUT:
|
|
76
|
+
return ExitCodes.TIMEOUT;
|
|
77
|
+
case StepErrorCode.STEP_DEPENDENCY_FAILED:
|
|
78
|
+
return ExitCodes.DEPENDENCY_FAILED;
|
|
79
|
+
case StepErrorCode.STEP_EXECUTION_FAILED:
|
|
80
|
+
return ExitCodes.STEP_FAILED;
|
|
81
|
+
case StepErrorCode.STEP_CONDITION_FAILED:
|
|
82
|
+
case StepErrorCode.STEP_OUTPUT_MAPPING_FAILED:
|
|
83
|
+
return ExitCodes.STEP_FAILED;
|
|
84
|
+
default:
|
|
85
|
+
return ExitCodes.STEP_FAILED;
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
/**
|
|
89
|
+
* Determine severity based on error code
|
|
90
|
+
*/
|
|
91
|
+
static determineSeverity(code) {
|
|
92
|
+
switch (code) {
|
|
93
|
+
case StepErrorCode.STEP_NOT_FOUND:
|
|
94
|
+
case StepErrorCode.STEP_CONFIG_INVALID:
|
|
95
|
+
case StepErrorCode.STEP_DUPLICATE_ID:
|
|
96
|
+
return ErrorSeverity.ERROR;
|
|
97
|
+
case StepErrorCode.STEP_TIMEOUT:
|
|
98
|
+
case StepErrorCode.STEP_EXECUTION_FAILED:
|
|
99
|
+
case StepErrorCode.STEP_DEPENDENCY_FAILED:
|
|
100
|
+
return ErrorSeverity.ERROR;
|
|
101
|
+
case StepErrorCode.STEP_CONDITION_FAILED:
|
|
102
|
+
case StepErrorCode.STEP_OUTPUT_MAPPING_FAILED:
|
|
103
|
+
return ErrorSeverity.WARNING;
|
|
104
|
+
default:
|
|
105
|
+
return ErrorSeverity.ERROR;
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
/**
|
|
109
|
+
* Factory: Step not found
|
|
110
|
+
*/
|
|
111
|
+
static notFound(stepId, workflowName) {
|
|
112
|
+
return new StepError({
|
|
113
|
+
code: StepErrorCode.STEP_NOT_FOUND,
|
|
114
|
+
message: `Step "${stepId}" not found in workflow${workflowName ? ` "${workflowName}"` : ''}`,
|
|
115
|
+
stepId,
|
|
116
|
+
hint: 'Check that the step ID is spelled correctly and exists in the workflow definition.',
|
|
117
|
+
});
|
|
118
|
+
}
|
|
119
|
+
/**
|
|
120
|
+
* Factory: Step execution timeout
|
|
121
|
+
*/
|
|
122
|
+
static timeout(stepId, duration, stepName) {
|
|
123
|
+
return new StepError({
|
|
124
|
+
code: StepErrorCode.STEP_TIMEOUT,
|
|
125
|
+
message: `Step "${stepName || stepId}" exceeded timeout of ${duration}`,
|
|
126
|
+
stepId,
|
|
127
|
+
stepName,
|
|
128
|
+
context: { timeoutDuration: duration },
|
|
129
|
+
hint: `The step took longer than ${duration}. Consider increasing the timeout or optimizing the step.`,
|
|
130
|
+
});
|
|
131
|
+
}
|
|
132
|
+
/**
|
|
133
|
+
* Factory: Step execution failed
|
|
134
|
+
*/
|
|
135
|
+
static executionFailed(stepId, action, cause, stepName) {
|
|
136
|
+
return new StepError({
|
|
137
|
+
code: StepErrorCode.STEP_EXECUTION_FAILED,
|
|
138
|
+
message: `Step "${stepName || stepId}" failed during execution of "${action}"`,
|
|
139
|
+
stepId,
|
|
140
|
+
stepName,
|
|
141
|
+
action,
|
|
142
|
+
cause,
|
|
143
|
+
hint: 'Check the step configuration and adapter implementation. See the underlying error for details.',
|
|
144
|
+
});
|
|
145
|
+
}
|
|
146
|
+
/**
|
|
147
|
+
* Factory: Step dependency failed
|
|
148
|
+
*/
|
|
149
|
+
static dependencyFailed(stepId, missingDependencies, stepName) {
|
|
150
|
+
return new StepError({
|
|
151
|
+
code: StepErrorCode.STEP_DEPENDENCY_FAILED,
|
|
152
|
+
message: `Step "${stepName || stepId}" depends on: ${missingDependencies.join(', ')}`,
|
|
153
|
+
stepId,
|
|
154
|
+
stepName,
|
|
155
|
+
context: { missingDependencies },
|
|
156
|
+
hint: `Ensure that the following steps complete successfully: ${missingDependencies.join(', ')}`,
|
|
157
|
+
});
|
|
158
|
+
}
|
|
159
|
+
/**
|
|
160
|
+
* Factory: Invalid step configuration
|
|
161
|
+
*/
|
|
162
|
+
static invalidConfig(stepId, reason, stepName) {
|
|
163
|
+
return new StepError({
|
|
164
|
+
code: StepErrorCode.STEP_CONFIG_INVALID,
|
|
165
|
+
message: `Invalid configuration for step "${stepName || stepId}": ${reason}`,
|
|
166
|
+
stepId,
|
|
167
|
+
stepName,
|
|
168
|
+
hint: 'Review the step definition and ensure all required fields are provided with valid values.',
|
|
169
|
+
});
|
|
170
|
+
}
|
|
171
|
+
/**
|
|
172
|
+
* Factory: Duplicate step ID
|
|
173
|
+
*/
|
|
174
|
+
static duplicateId(stepId) {
|
|
175
|
+
return new StepError({
|
|
176
|
+
code: StepErrorCode.STEP_DUPLICATE_ID,
|
|
177
|
+
message: `Duplicate step ID "${stepId}" found in workflow`,
|
|
178
|
+
stepId,
|
|
179
|
+
hint: `Step IDs must be unique within a workflow. Rename one of the steps with ID "${stepId}".`,
|
|
180
|
+
});
|
|
181
|
+
}
|
|
182
|
+
}
|
|
2
183
|
//# sourceMappingURL=StepError.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"StepError.js","sourceRoot":"","sources":["../../src/errors/StepError.ts"],"names":[],"mappings":""}
|
|
1
|
+
{"version":3,"file":"StepError.js","sourceRoot":"","sources":["../../src/errors/StepError.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,OAAO,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAChD,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAC7C,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAEhD;;GAEG;AACH,MAAM,CAAN,IAAY,aAwBX;AAxBD,WAAY,aAAa;IACvB,iCAAiC;IACjC,kDAAiC,CAAA;IAEjC,6BAA6B;IAC7B,gDAA+B,CAAA;IAE/B,4BAA4B;IAC5B,yDAAwC,CAAA;IAExC,8BAA8B;IAC9B,0DAAyC,CAAA;IAEzC,iCAAiC;IACjC,uDAAsC,CAAA;IAEtC,wBAAwB;IACxB,qDAAoC,CAAA;IAEpC,uCAAuC;IACvC,yDAAwC,CAAA;IAExC,iCAAiC;IACjC,8DAA6C,CAAA;AAC/C,CAAC,EAxBW,aAAa,KAAb,aAAa,QAwBxB;AAkCD;;GAEG;AACH,MAAM,OAAO,SAAU,SAAQ,UAAU;IACvB,MAAM,CAAS;IACf,QAAQ,CAAU;IAClB,MAAM,CAAU;IAEhC,YAAY,MAUX;QACC,KAAK,CAAC;YACJ,IAAI,EAAE,MAAM,CAAC,IAAW;YACxB,OAAO,EAAE,MAAM,CAAC,OAAO;YACvB,QAAQ,EAAE,MAAM,CAAC,QAAQ,IAAI,SAAS,CAAC,WAAW,CAAC,MAAM,CAAC,IAAI,CAAC;YAC/D,QAAQ,EAAE,SAAS,CAAC,iBAAiB,CAAC,MAA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