@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.
Files changed (57) hide show
  1. package/README.md +1 -1
  2. package/dist/errors/ErrorCodes.d.ts +205 -6
  3. package/dist/errors/ErrorCodes.d.ts.map +1 -1
  4. package/dist/errors/ErrorCodes.js +398 -5
  5. package/dist/errors/ErrorCodes.js.map +1 -1
  6. package/dist/errors/ErrorDebugger.d.ts +98 -0
  7. package/dist/errors/ErrorDebugger.d.ts.map +1 -0
  8. package/dist/errors/ErrorDebugger.js +283 -0
  9. package/dist/errors/ErrorDebugger.js.map +1 -0
  10. package/dist/errors/ErrorDetector.d.ts +148 -0
  11. package/dist/errors/ErrorDetector.d.ts.map +1 -0
  12. package/dist/errors/ErrorDetector.js +358 -0
  13. package/dist/errors/ErrorDetector.js.map +1 -0
  14. package/dist/errors/ErrorFormatter.d.ts +92 -3
  15. package/dist/errors/ErrorFormatter.d.ts.map +1 -1
  16. package/dist/errors/ErrorFormatter.js +220 -4
  17. package/dist/errors/ErrorFormatter.js.map +1 -1
  18. package/dist/errors/ErrorHandler.d.ts +259 -0
  19. package/dist/errors/ErrorHandler.d.ts.map +1 -0
  20. package/dist/errors/ErrorHandler.js +378 -0
  21. package/dist/errors/ErrorHandler.js.map +1 -0
  22. package/dist/errors/FieldRegistry.d.ts +39 -0
  23. package/dist/errors/FieldRegistry.d.ts.map +1 -1
  24. package/dist/errors/FieldRegistry.js +172 -74
  25. package/dist/errors/FieldRegistry.js.map +1 -1
  26. package/dist/errors/OrbytError.d.ts +85 -3
  27. package/dist/errors/OrbytError.d.ts.map +1 -1
  28. package/dist/errors/OrbytError.js +151 -4
  29. package/dist/errors/OrbytError.js.map +1 -1
  30. package/dist/errors/SchedulerError.d.ts +93 -1
  31. package/dist/errors/SchedulerError.d.ts.map +1 -1
  32. package/dist/errors/SchedulerError.js +145 -1
  33. package/dist/errors/SchedulerError.js.map +1 -1
  34. package/dist/errors/SecurityErrors.d.ts +94 -12
  35. package/dist/errors/SecurityErrors.d.ts.map +1 -1
  36. package/dist/errors/SecurityErrors.js +162 -18
  37. package/dist/errors/SecurityErrors.js.map +1 -1
  38. package/dist/errors/StepError.d.ts +111 -1
  39. package/dist/errors/StepError.d.ts.map +1 -1
  40. package/dist/errors/StepError.js +182 -1
  41. package/dist/errors/StepError.js.map +1 -1
  42. package/dist/errors/WorkflowError.d.ts +139 -2
  43. package/dist/errors/WorkflowError.d.ts.map +1 -1
  44. package/dist/errors/WorkflowError.js +264 -22
  45. package/dist/errors/WorkflowError.js.map +1 -1
  46. package/dist/errors/index.d.ts +5 -1
  47. package/dist/errors/index.d.ts.map +1 -1
  48. package/dist/errors/index.js +7 -4
  49. package/dist/errors/index.js.map +1 -1
  50. package/dist/loader/WorkflowLoader.d.ts +83 -21
  51. package/dist/loader/WorkflowLoader.d.ts.map +1 -1
  52. package/dist/loader/WorkflowLoader.js +169 -55
  53. package/dist/loader/WorkflowLoader.js.map +1 -1
  54. package/dist/parser/SchemaValidator.d.ts.map +1 -1
  55. package/dist/parser/SchemaValidator.js +2 -1
  56. package/dist/parser/SchemaValidator.js.map +1 -1
  57. package/package.json +1 -1
@@ -11,53 +11,61 @@
11
11
  /**
12
12
  * Valid fields at workflow root level
13
13
  * MUST stay in sync with OrbytWorkflowSchema in @dev-ecosystem/core
14
+ * Last synced: 2026-02-15
14
15
  */
15
16
  export const ROOT_FIELDS = [
16
- // Core required fields
17
- 'version',
18
- 'kind',
19
- 'workflow',
20
- // Configuration fields
21
- 'metadata',
22
- 'annotations',
23
- 'triggers',
24
- 'secrets',
25
- 'inputs',
26
- 'context',
27
- 'defaults',
28
- 'policies',
29
- 'permissions',
30
- 'resources',
31
- 'outputs',
32
- 'on',
33
- 'usage',
17
+ // Core required fields (REQUIRED)
18
+ 'version', // Schema version (semantic versioning)
19
+ 'kind', // Type of executable (workflow, pipeline, job, playbook, automation)
20
+ 'workflow', // Core workflow execution definition
21
+ // Optional metadata & documentation
22
+ 'metadata', // Human-readable metadata
23
+ 'annotations', // Zero-impact annotations for tooling
24
+ // Execution configuration
25
+ 'triggers', // Execution triggers (manual, cron, event, webhook)
26
+ 'secrets', // External secret references
27
+ 'inputs', // Runtime parameters
28
+ 'context', // Runtime environment context
29
+ 'defaults', // Default settings for all steps
30
+ 'policies', // Execution policies
31
+ 'permissions', // Security permissions
32
+ 'resources', // Resource constraints (future)
33
+ // Outputs & hooks
34
+ 'outputs', // Final workflow outputs returned to caller
35
+ 'on', // Lifecycle hooks (success, failure, always) - future
36
+ // Usage tracking
37
+ 'usage', // Usage tracking configuration (production)
34
38
  // Production-ready universal fields
35
- 'strategy',
36
- 'profiles',
37
- 'compliance',
38
- 'provenance',
39
- 'execution',
40
- 'outputsSchema',
41
- 'telemetry',
42
- 'accounting',
43
- 'compatibility',
44
- 'failurePolicy',
45
- 'rollback',
46
- 'governance',
39
+ 'strategy', // Execution strategy (production)
40
+ 'profiles', // Environment-specific profiles (future)
41
+ // Future-safe fields
42
+ 'compliance', // Compliance metadata (future)
43
+ 'provenance', // Provenance tracking (future: AI-generated workflows)
44
+ 'execution', // Execution strategy (future: multi-environment)
45
+ 'outputsSchema', // Output schema for validation (future)
46
+ 'telemetry', // Telemetry controls (future)
47
+ 'accounting', // Cost and usage accounting (future)
48
+ 'compatibility', // Version compatibility (future)
49
+ 'failurePolicy', // Failure semantics (future)
50
+ 'rollback', // Rollback configuration (future)
51
+ 'governance', // Governance metadata (future: enterprise)
47
52
  ];
48
53
  /**
49
54
  * Valid fields in metadata object
55
+ * MUST stay in sync with MetadataSchema in @dev-ecosystem/core
56
+ * Last synced: 2026-02-15
50
57
  */
51
58
  export const METADATA_FIELDS = [
52
- 'name',
53
- 'description',
54
- 'tags',
55
- 'owner',
56
- 'version',
57
- 'createdAt',
58
- 'updatedAt',
59
- 'v1',
60
- 'future',
59
+ 'name', // Human-readable workflow name
60
+ 'description', // Detailed workflow description
61
+ 'tags', // Categorization tags
62
+ 'owner', // Owner team or individual
63
+ 'version', // Workflow version (not schema version)
64
+ 'createdAt', // Creation timestamp
65
+ 'updatedAt', // Last update timestamp
66
+ // Version tracking flags (future-safe)
67
+ 'v1', // Marks workflow as using v1 features
68
+ 'future', // Marks workflow as using future/experimental features
61
69
  ];
62
70
  /**
63
71
  * Valid fields in workflow body
@@ -68,62 +76,72 @@ export const WORKFLOW_FIELDS = [
68
76
  /**
69
77
  * Valid fields in step definition
70
78
  * MUST stay in sync with StepSchema in @dev-ecosystem/core
79
+ * Last synced: 2026-02-15
71
80
  */
72
81
  export const STEP_FIELDS = [
73
82
  // Core required fields
74
- 'id',
75
- 'uses',
76
- // Common fields
77
- 'name',
78
- 'with',
79
- 'when',
80
- 'needs',
81
- 'retry',
82
- 'timeout',
83
- 'continueOnError',
84
- 'outputs',
85
- 'env',
86
- 'usage',
83
+ 'id', // Unique step identifier (must start with letter)
84
+ 'uses', // Action to execute (namespace.action format)
85
+ // Common optional fields
86
+ 'name', // Human-readable step name
87
+ 'with', // Adapter-specific input parameters
88
+ 'when', // Conditional execution expression
89
+ 'needs', // Explicit step dependencies
90
+ 'retry', // Step-specific retry config
91
+ 'timeout', // Step execution timeout (e.g., '30s', '5m')
92
+ 'continueOnError', // Continue workflow even if step fails
93
+ 'outputs', // Map step outputs to named values
94
+ 'env', // Environment variables for this step
95
+ // Usage tracking (production)
96
+ 'usage', // Usage tracking override (per-step billing)
87
97
  // Production-ready universal fields
88
- 'ref',
89
- 'requires',
90
- 'hints',
91
- 'contracts',
92
- 'profiles',
93
- 'onFailure',
94
- 'telemetry',
95
- 'rollback',
98
+ 'ref', // Versioned step reference (e.g., @^1)
99
+ 'requires', // Capability requirements (future)
100
+ 'hints', // Execution hints for optimization (future)
101
+ 'contracts', // Data contracts for validation (future)
102
+ 'profiles', // Environment-specific profiles (future)
103
+ 'onFailure', // Failure handling configuration (future)
104
+ 'telemetry', // Telemetry configuration (future)
105
+ 'rollback', // Step-level rollback logic (future)
96
106
  ];
97
107
  /**
98
108
  * Valid fields in secrets config
109
+ * MUST stay in sync with SecretsSchema in @dev-ecosystem/core
110
+ * Last synced: 2026-02-15
99
111
  */
100
112
  export const SECRETS_FIELDS = [
101
- 'vault',
102
- 'keys',
113
+ 'vault', // Secret vault provider (default: 'vaulta')
114
+ 'keys', // Map of logical names to provider-specific secret paths
103
115
  ];
104
116
  /**
105
117
  * Valid fields in context config
118
+ * MUST stay in sync with ContextSchema in @dev-ecosystem/core
119
+ * Last synced: 2026-02-15
106
120
  */
107
121
  export const CONTEXT_FIELDS = [
108
- 'env',
109
- 'platform',
110
- 'workspace',
122
+ 'env', // Environment (local, dev, staging, prod)
123
+ 'platform', // Platform identifier
124
+ 'workspace', // Workspace path
111
125
  ];
112
126
  /**
113
127
  * Valid fields in defaults config
128
+ * MUST stay in sync with DefaultsSchema in @dev-ecosystem/core
129
+ * Last synced: 2026-02-15
114
130
  */
115
131
  export const DEFAULTS_FIELDS = [
116
- 'retry',
117
- 'timeout',
118
- 'adapter',
132
+ 'retry', // Default retry configuration
133
+ 'timeout', // Default step timeout (e.g., '30s')
134
+ 'adapter', // Default adapter
119
135
  ];
120
136
  /**
121
137
  * Valid fields in policies config
138
+ * MUST stay in sync with PoliciesSchema in @dev-ecosystem/core
139
+ * Last synced: 2026-02-15
122
140
  */
123
141
  export const POLICIES_FIELDS = [
124
- 'failure',
125
- 'concurrency',
126
- 'sandbox',
142
+ 'failure', // Failure policy (stop, continue, isolate)
143
+ 'concurrency', // Max concurrent steps
144
+ 'sandbox', // Sandbox level (none, basic, strict)
127
145
  ];
128
146
  /**
129
147
  * Valid fields in permissions config
@@ -134,11 +152,13 @@ export const PERMISSIONS_FIELDS = [
134
152
  ];
135
153
  /**
136
154
  * Valid fields in retry config
155
+ * MUST stay in sync with RetryConfigSchema in @dev-ecosystem/core
156
+ * Last synced: 2026-02-15
137
157
  */
138
158
  export const RETRY_FIELDS = [
139
- 'max',
140
- 'backoff',
141
- 'delay',
159
+ 'max', // Maximum retry attempts
160
+ 'backoff', // Backoff strategy (linear, exponential)
161
+ 'delay', // Initial delay in milliseconds
142
162
  ];
143
163
  /**
144
164
  * Valid fields in usage tracking config
@@ -162,6 +182,84 @@ export const STEP_USAGE_FIELDS = [
162
182
  'unit',
163
183
  'weight',
164
184
  ];
185
+ // ============================================================================
186
+ // RESERVED/INTERNAL FIELDS (Engine-controlled, users cannot set these)
187
+ // ============================================================================
188
+ /**
189
+ * Reserved workflow-level fields (engine-controlled, NEVER user-set)
190
+ * These fields would trigger SecurityError if found in user YAML
191
+ * MUST stay in sync with RESERVED_WORKFLOW_FIELDS in security/ReservedFields.ts
192
+ * Last synced: 2026-02-15
193
+ */
194
+ export const RESERVED_WORKFLOW_FIELDS = [
195
+ '_internal', // Internal execution context
196
+ '_identity', // Execution identity (executionId, runId, traceId)
197
+ '_ownership', // Ownership context (userId, workspaceId, subscriptionId)
198
+ '_billing', // Billing context (billingId, pricingTier, costCalculated)
199
+ '_usage', // Usage tracking counters
200
+ '_audit', // Audit trail fields
201
+ '_system', // System fields
202
+ '_engine', // Engine metadata
203
+ '_execution', // Execution context (internal)
204
+ '_runtime', // Runtime context (internal)
205
+ '_security', // Security context
206
+ '_metadata', // Internal metadata
207
+ ];
208
+ /**
209
+ * Reserved context fields (engine-controlled, users cannot set in context)
210
+ * MUST stay in sync with RESERVED_CONTEXT_FIELDS in security/ReservedFields.ts
211
+ * Last synced: 2026-02-15
212
+ */
213
+ export const RESERVED_CONTEXT_FIELDS = [
214
+ '_internal',
215
+ '_identity',
216
+ '_ownership',
217
+ '_billing',
218
+ '_usage',
219
+ '_audit',
220
+ '_system',
221
+ '_engine',
222
+ '_security',
223
+ 'executionId',
224
+ 'runId',
225
+ 'traceId',
226
+ 'userId',
227
+ 'workspaceId',
228
+ 'subscriptionId',
229
+ 'subscriptionTier',
230
+ 'billingId',
231
+ 'billingMode',
232
+ 'pricingTier',
233
+ 'pricingModel',
234
+ 'billingSnapshot',
235
+ ];
236
+ /**
237
+ * Reserved step fields (engine-controlled, users cannot set in steps)
238
+ * MUST stay in sync with RESERVED_STEP_FIELDS in security/ReservedFields.ts
239
+ * Last synced: 2026-02-15
240
+ */
241
+ export const RESERVED_STEP_FIELDS = [
242
+ '_internal',
243
+ '_billing',
244
+ '_usage',
245
+ '_audit',
246
+ 'executionId',
247
+ 'runId',
248
+ 'stepExecutionId',
249
+ ];
250
+ /**
251
+ * Reserved annotation prefixes (engine-controlled namespaces)
252
+ * MUST stay in sync with RESERVED_ANNOTATION_PREFIXES in security/ReservedFields.ts
253
+ * Last synced: 2026-02-15
254
+ */
255
+ export const RESERVED_ANNOTATION_PREFIXES = [
256
+ 'engine.',
257
+ 'system.',
258
+ 'internal.',
259
+ 'billing.',
260
+ 'audit.',
261
+ 'security.',
262
+ ];
165
263
  /**
166
264
  * Field registry map - maps path prefixes to valid fields
167
265
  */
@@ -1 +1 @@
1
- {"version":3,"file":"FieldRegistry.js","sourceRoot":"","sources":["../../src/errors/FieldRegistry.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH;;;GAGG;AACH,MAAM,CAAC,MAAM,WAAW,GAAG;IACzB,uBAAuB;IACvB,SAAS;IACT,MAAM;IACN,UAAU;IAEV,uBAAuB;IACvB,UAAU;IACV,aAAa;IACb,UAAU;IACV,SAAS;IACT,QAAQ;IACR,SAAS;IACT,UAAU;IACV,UAAU;IACV,aAAa;IACb,WAAW;IACX,SAAS;IACT,IAAI;IACJ,OAAO;IAEP,oCAAoC;IACpC,UAAU;IACV,UAAU;IACV,YAAY;IACZ,YAAY;IACZ,WAAW;IACX,eAAe;IACf,WAAW;IACX,YAAY;IACZ,eAAe;IACf,eAAe;IACf,UAAU;IACV,YAAY;CACJ,CAAC;AAEX;;GAEG;AACH,MAAM,CAAC,MAAM,eAAe,GAAG;IAC7B,MAAM;IACN,aAAa;IACb,MAAM;IACN,OAAO;IACP,SAAS;IACT,WAAW;IACX,WAAW;IACX,IAAI;IACJ,QAAQ;CACA,CAAC;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MAAM,UAAU,YAAY,CAAC,KAAa,EAAE,IAAY;IACtD,MAAM,WAAW,GAAG,cAAc,CAAC,IAAI,CAAC,CAAC;IACzC,OAAO,WAAW,CAAC,QAAQ,CAAC,KAAY,CAAC,CAAC;AAC5C,CAAC"}
@@ -4,37 +4,72 @@
4
4
  * Foundation for all Orbyt errors with diagnostic capabilities.
5
5
  * Provides structured error information for CLI, UI, and AI integrations.
6
6
  *
7
+ * ARCHITECTURE:
8
+ * - Error codes (ORB-XX-NNN): Structured codes for error identification
9
+ * - Exit codes (from @dev-ecosystem/core): Process exit codes for shell scripts
10
+ * - Severity levels: ERROR, WARNING, INFO
11
+ * - Context + hints: Help users debug and fix issues
12
+ *
7
13
  * @module errors
8
14
  */
15
+ import { ExitCodes } from '@dev-ecosystem/core';
9
16
  import { OrbytErrorCode, ErrorSeverity } from './ErrorCodes.js';
10
17
  /**
11
18
  * Diagnostic error information
19
+ * Contains all data needed to understand and debug an error
12
20
  */
13
21
  export interface OrbytErrorDiagnostic {
14
- /** Stable error code */
22
+ /** Structured error code (e.g., ORB-S-001) */
15
23
  code: OrbytErrorCode;
16
24
  /** Human-readable error message */
17
25
  message: string;
26
+ /** Process exit code from ecosystem-core (for CLI) */
27
+ exitCode?: ExitCodes;
18
28
  /** Path to the error location (e.g., "workflow.steps[2].uses") */
19
29
  path?: string;
20
30
  /** Optional suggestion for fixing the error */
21
31
  hint?: string;
22
- /** Error severity */
32
+ /** Error severity (ERROR, WARNING, INFO) */
23
33
  severity: ErrorSeverity;
24
- /** Additional context data */
34
+ /** Additional context data for debugging */
25
35
  context?: Record<string, any>;
26
36
  }
27
37
  /**
28
38
  * Base error class for all Orbyt errors
39
+ *
40
+ * Provides rich diagnostic information including:
41
+ * - Structured error code
42
+ * - Exit code for process termination
43
+ * - Location in workflow where error occurred
44
+ * - Hints for fixing the error
45
+ * - Additional context for debugging
46
+ *
47
+ * @example
48
+ * ```typescript
49
+ * throw new OrbytError({
50
+ * code: OrbytErrorCode.SCHEMA_MISSING_FIELD,
51
+ * message: 'Missing required field "version"',
52
+ * exitCode: ExitCodes.INVALID_SCHEMA,
53
+ * path: 'workflow',
54
+ * hint: 'Add "version: 1.0" to your workflow definition',
55
+ * severity: ErrorSeverity.ERROR,
56
+ * });
57
+ * ```
29
58
  */
30
59
  export declare class OrbytError extends Error {
31
60
  /** Error diagnostic information */
32
61
  readonly diagnostic: OrbytErrorDiagnostic;
62
+ /** Timestamp when error occurred */
63
+ readonly timestamp: Date;
33
64
  constructor(diagnostic: OrbytErrorDiagnostic);
34
65
  /**
35
66
  * Get the error code
36
67
  */
37
68
  get code(): OrbytErrorCode;
69
+ /**
70
+ * Get the exit code for process termination
71
+ */
72
+ get exitCode(): ExitCodes;
38
73
  /**
39
74
  * Get the error path (where it occurred)
40
75
  */
@@ -47,13 +82,60 @@ export declare class OrbytError extends Error {
47
82
  * Get error severity
48
83
  */
49
84
  get severity(): ErrorSeverity;
85
+ /**
86
+ * Get detailed error description
87
+ */
88
+ get description(): string;
89
+ /**
90
+ * Check if this is a user-fixable error
91
+ * @returns True if user can fix by changing workflow
92
+ */
93
+ get isUserError(): boolean;
94
+ /**
95
+ * Check if this error is retryable
96
+ * @returns True if retry might succeed
97
+ */
98
+ get isRetryable(): boolean;
99
+ /**
100
+ * Get error category (Schema, Validation, Execution, Runtime)
101
+ */
102
+ get category(): string;
50
103
  /**
51
104
  * Format error as string for logging/display
105
+ * Includes all diagnostic information in a readable format
106
+ *
107
+ * @returns Formatted error string
52
108
  */
53
109
  toString(): string;
110
+ /**
111
+ * Format error as detailed string with full diagnostic info
112
+ * Used for verbose logging and debugging
113
+ *
114
+ * @returns Detailed formatted error string with box drawing
115
+ */
116
+ toDetailedString(): string;
117
+ /**
118
+ * Get human-readable description of exit code
119
+ */
120
+ getExitCodeDescription(): string;
54
121
  /**
55
122
  * Convert to JSON for structured logging
123
+ * Suitable for sending to logging services, APIs, or storing in databases
124
+ *
125
+ * @returns JSON representation of error
56
126
  */
57
127
  toJSON(): object;
128
+ /**
129
+ * Create a simplified error object for CLI display
130
+ * Contains only essential information for user-facing output
131
+ *
132
+ * @returns Simplified error object
133
+ */
134
+ toSimpleObject(): {
135
+ code: string;
136
+ message: string;
137
+ hint?: string;
138
+ path?: string;
139
+ };
58
140
  }
59
141
  //# sourceMappingURL=OrbytError.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"OrbytError.d.ts","sourceRoot":"","sources":["../../src/errors/OrbytError.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAAE,cAAc,EAAE,aAAa,EAAoB,MAAM,iBAAiB,CAAC;AAElF;;GAEG;AACH,MAAM,WAAW,oBAAoB;IACnC,wBAAwB;IACxB,IAAI,EAAE,cAAc,CAAC;IAErB,mCAAmC;IACnC,OAAO,EAAE,MAAM,CAAC;IAEhB,kEAAkE;IAClE,IAAI,CAAC,EAAE,MAAM,CAAC;IAEd,+CAA+C;IAC/C,IAAI,CAAC,EAAE,MAAM,CAAC;IAEd,qBAAqB;IACrB,QAAQ,EAAE,aAAa,CAAC;IAExB,8BAA8B;IAC9B,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;CAC/B;AAED;;GAEG;AACH,qBAAa,UAAW,SAAQ,KAAK;IACnC,mCAAmC;IACnC,SAAgB,UAAU,EAAE,oBAAoB,CAAC;gBAErC,UAAU,EAAE,oBAAoB;IAW5C;;OAEG;IACH,IAAI,IAAI,IAAI,cAAc,CAEzB;IAED;;OAEG;IACH,IAAI,IAAI,IAAI,MAAM,GAAG,SAAS,CAE7B;IAED;;OAEG;IACH,IAAI,IAAI,IAAI,MAAM,GAAG,SAAS,CAE7B;IAED;;OAEG;IACH,IAAI,QAAQ,IAAI,aAAa,CAE5B;IAED;;OAEG;IACH,QAAQ,IAAI,MAAM;IAgBlB;;OAEG;IACH,MAAM,IAAI,MAAM;CAWjB"}
1
+ {"version":3,"file":"OrbytError.d.ts","sourceRoot":"","sources":["../../src/err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