typekro 0.2.2 → 0.3.1

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 (213) hide show
  1. package/README.md +4 -3
  2. package/dist/.tsbuildinfo +1 -1
  3. package/dist/core/composition/imperative.d.ts.map +1 -1
  4. package/dist/core/composition/imperative.js +15 -2
  5. package/dist/core/composition/imperative.js.map +1 -1
  6. package/dist/core/composition/typekro-runtime/typekro-runtime.d.ts.map +1 -1
  7. package/dist/core/composition/typekro-runtime/typekro-runtime.js +24 -25
  8. package/dist/core/composition/typekro-runtime/typekro-runtime.js.map +1 -1
  9. package/dist/core/dependencies/type-guards.d.ts.map +1 -1
  10. package/dist/core/dependencies/type-guards.js +7 -2
  11. package/dist/core/dependencies/type-guards.js.map +1 -1
  12. package/dist/core/deployment/engine.d.ts +13 -1
  13. package/dist/core/deployment/engine.d.ts.map +1 -1
  14. package/dist/core/deployment/engine.js +48 -3
  15. package/dist/core/deployment/engine.js.map +1 -1
  16. package/dist/core/errors.d.ts +85 -0
  17. package/dist/core/errors.d.ts.map +1 -1
  18. package/dist/core/errors.js +135 -0
  19. package/dist/core/errors.js.map +1 -1
  20. package/dist/core/evaluation/cel-optimizer.d.ts.map +1 -1
  21. package/dist/core/evaluation/cel-optimizer.js +7 -13
  22. package/dist/core/evaluation/cel-optimizer.js.map +1 -1
  23. package/dist/core/expressions/analyzer.d.ts +584 -0
  24. package/dist/core/expressions/analyzer.d.ts.map +1 -0
  25. package/dist/core/expressions/analyzer.js +2956 -0
  26. package/dist/core/expressions/analyzer.js.map +1 -0
  27. package/dist/core/expressions/cache.d.ts +136 -0
  28. package/dist/core/expressions/cache.d.ts.map +1 -0
  29. package/dist/core/expressions/cache.js +347 -0
  30. package/dist/core/expressions/cache.js.map +1 -0
  31. package/dist/core/expressions/cel-conversion-engine.d.ts +126 -0
  32. package/dist/core/expressions/cel-conversion-engine.d.ts.map +1 -0
  33. package/dist/core/expressions/cel-conversion-engine.js +293 -0
  34. package/dist/core/expressions/cel-conversion-engine.js.map +1 -0
  35. package/dist/core/expressions/compile-time-validation.d.ts +270 -0
  36. package/dist/core/expressions/compile-time-validation.d.ts.map +1 -0
  37. package/dist/core/expressions/compile-time-validation.js +506 -0
  38. package/dist/core/expressions/compile-time-validation.js.map +1 -0
  39. package/dist/core/expressions/composition-integration.d.ts +315 -0
  40. package/dist/core/expressions/composition-integration.d.ts.map +1 -0
  41. package/dist/core/expressions/composition-integration.js +936 -0
  42. package/dist/core/expressions/composition-integration.js.map +1 -0
  43. package/dist/core/expressions/conditional-expression-processor.d.ts +154 -0
  44. package/dist/core/expressions/conditional-expression-processor.d.ts.map +1 -0
  45. package/dist/core/expressions/conditional-expression-processor.js +479 -0
  46. package/dist/core/expressions/conditional-expression-processor.js.map +1 -0
  47. package/dist/core/expressions/conditional-integration.d.ts +133 -0
  48. package/dist/core/expressions/conditional-integration.d.ts.map +1 -0
  49. package/dist/core/expressions/conditional-integration.js +293 -0
  50. package/dist/core/expressions/conditional-integration.js.map +1 -0
  51. package/dist/core/expressions/conditional-validation.d.ts +181 -0
  52. package/dist/core/expressions/conditional-validation.d.ts.map +1 -0
  53. package/dist/core/expressions/conditional-validation.js +460 -0
  54. package/dist/core/expressions/conditional-validation.js.map +1 -0
  55. package/dist/core/expressions/context-aware-generator.d.ts +127 -0
  56. package/dist/core/expressions/context-aware-generator.d.ts.map +1 -0
  57. package/dist/core/expressions/context-aware-generator.js +500 -0
  58. package/dist/core/expressions/context-aware-generator.js.map +1 -0
  59. package/dist/core/expressions/context-detector.d.ts +148 -0
  60. package/dist/core/expressions/context-detector.d.ts.map +1 -0
  61. package/dist/core/expressions/context-detector.js +546 -0
  62. package/dist/core/expressions/context-detector.js.map +1 -0
  63. package/dist/core/expressions/context-switcher.d.ts +185 -0
  64. package/dist/core/expressions/context-switcher.d.ts.map +1 -0
  65. package/dist/core/expressions/context-switcher.js +515 -0
  66. package/dist/core/expressions/context-switcher.js.map +1 -0
  67. package/dist/core/expressions/context-validator.d.ts +176 -0
  68. package/dist/core/expressions/context-validator.d.ts.map +1 -0
  69. package/dist/core/expressions/context-validator.js +452 -0
  70. package/dist/core/expressions/context-validator.js.map +1 -0
  71. package/dist/core/expressions/custom-context-manager.d.ts +194 -0
  72. package/dist/core/expressions/custom-context-manager.d.ts.map +1 -0
  73. package/dist/core/expressions/custom-context-manager.js +390 -0
  74. package/dist/core/expressions/custom-context-manager.js.map +1 -0
  75. package/dist/core/expressions/expression-proxy.d.ts +80 -0
  76. package/dist/core/expressions/expression-proxy.d.ts.map +1 -0
  77. package/dist/core/expressions/expression-proxy.js +227 -0
  78. package/dist/core/expressions/expression-proxy.js.map +1 -0
  79. package/dist/core/expressions/factory-integration.d.ts +132 -0
  80. package/dist/core/expressions/factory-integration.d.ts.map +1 -0
  81. package/dist/core/expressions/factory-integration.js +327 -0
  82. package/dist/core/expressions/factory-integration.js.map +1 -0
  83. package/dist/core/expressions/factory-pattern-handler.d.ts +88 -0
  84. package/dist/core/expressions/factory-pattern-handler.d.ts.map +1 -0
  85. package/dist/core/expressions/factory-pattern-handler.js +336 -0
  86. package/dist/core/expressions/factory-pattern-handler.js.map +1 -0
  87. package/dist/core/expressions/field-hydration-processor.d.ts +188 -0
  88. package/dist/core/expressions/field-hydration-processor.d.ts.map +1 -0
  89. package/dist/core/expressions/field-hydration-processor.js +562 -0
  90. package/dist/core/expressions/field-hydration-processor.js.map +1 -0
  91. package/dist/core/expressions/imperative-analyzer.d.ts +21 -0
  92. package/dist/core/expressions/imperative-analyzer.d.ts.map +1 -0
  93. package/dist/core/expressions/imperative-analyzer.js +457 -0
  94. package/dist/core/expressions/imperative-analyzer.js.map +1 -0
  95. package/dist/core/expressions/index.d.ts +54 -0
  96. package/dist/core/expressions/index.d.ts.map +1 -0
  97. package/dist/core/expressions/index.js +50 -0
  98. package/dist/core/expressions/index.js.map +1 -0
  99. package/dist/core/expressions/lazy-analysis.d.ts +1128 -0
  100. package/dist/core/expressions/lazy-analysis.d.ts.map +1 -0
  101. package/dist/core/expressions/lazy-analysis.js +2443 -0
  102. package/dist/core/expressions/lazy-analysis.js.map +1 -0
  103. package/dist/core/expressions/magic-assignable-analyzer.d.ts +123 -0
  104. package/dist/core/expressions/magic-assignable-analyzer.d.ts.map +1 -0
  105. package/dist/core/expressions/magic-assignable-analyzer.js +352 -0
  106. package/dist/core/expressions/magic-assignable-analyzer.js.map +1 -0
  107. package/dist/core/expressions/magic-proxy-analyzer.d.ts +206 -0
  108. package/dist/core/expressions/magic-proxy-analyzer.d.ts.map +1 -0
  109. package/dist/core/expressions/magic-proxy-analyzer.js +639 -0
  110. package/dist/core/expressions/magic-proxy-analyzer.js.map +1 -0
  111. package/dist/core/expressions/magic-proxy-detector.d.ts +154 -0
  112. package/dist/core/expressions/magic-proxy-detector.d.ts.map +1 -0
  113. package/dist/core/expressions/magic-proxy-detector.js +242 -0
  114. package/dist/core/expressions/magic-proxy-detector.js.map +1 -0
  115. package/dist/core/expressions/migration-helpers.d.ts +133 -0
  116. package/dist/core/expressions/migration-helpers.d.ts.map +1 -0
  117. package/dist/core/expressions/migration-helpers.js +443 -0
  118. package/dist/core/expressions/migration-helpers.js.map +1 -0
  119. package/dist/core/expressions/optionality-handler.d.ts +503 -0
  120. package/dist/core/expressions/optionality-handler.d.ts.map +1 -0
  121. package/dist/core/expressions/optionality-handler.js +1306 -0
  122. package/dist/core/expressions/optionality-handler.js.map +1 -0
  123. package/dist/core/expressions/readiness-integration.d.ts +119 -0
  124. package/dist/core/expressions/readiness-integration.d.ts.map +1 -0
  125. package/dist/core/expressions/readiness-integration.js +386 -0
  126. package/dist/core/expressions/readiness-integration.js.map +1 -0
  127. package/dist/core/expressions/resource-analyzer.d.ts +486 -0
  128. package/dist/core/expressions/resource-analyzer.d.ts.map +1 -0
  129. package/dist/core/expressions/resource-analyzer.js +1086 -0
  130. package/dist/core/expressions/resource-analyzer.js.map +1 -0
  131. package/dist/core/expressions/resource-validation.d.ts +187 -0
  132. package/dist/core/expressions/resource-validation.d.ts.map +1 -0
  133. package/dist/core/expressions/resource-validation.js +552 -0
  134. package/dist/core/expressions/resource-validation.js.map +1 -0
  135. package/dist/core/expressions/runtime-error-mapper.d.ts +138 -0
  136. package/dist/core/expressions/runtime-error-mapper.d.ts.map +1 -0
  137. package/dist/core/expressions/runtime-error-mapper.js +412 -0
  138. package/dist/core/expressions/runtime-error-mapper.js.map +1 -0
  139. package/dist/core/expressions/source-map.d.ts +168 -0
  140. package/dist/core/expressions/source-map.d.ts.map +1 -0
  141. package/dist/core/expressions/source-map.js +350 -0
  142. package/dist/core/expressions/source-map.js.map +1 -0
  143. package/dist/core/expressions/status-builder-analyzer.d.ts +353 -0
  144. package/dist/core/expressions/status-builder-analyzer.d.ts.map +1 -0
  145. package/dist/core/expressions/status-builder-analyzer.js +1311 -0
  146. package/dist/core/expressions/status-builder-analyzer.js.map +1 -0
  147. package/dist/core/expressions/type-inference.d.ts +184 -0
  148. package/dist/core/expressions/type-inference.d.ts.map +1 -0
  149. package/dist/core/expressions/type-inference.js +838 -0
  150. package/dist/core/expressions/type-inference.js.map +1 -0
  151. package/dist/core/expressions/type-safety.d.ts +203 -0
  152. package/dist/core/expressions/type-safety.d.ts.map +1 -0
  153. package/dist/core/expressions/type-safety.js +442 -0
  154. package/dist/core/expressions/type-safety.js.map +1 -0
  155. package/dist/core/expressions/types.d.ts +282 -0
  156. package/dist/core/expressions/types.d.ts.map +1 -0
  157. package/dist/core/expressions/types.js +8 -0
  158. package/dist/core/expressions/types.js.map +1 -0
  159. package/dist/core/kubernetes/client-provider.js +2 -2
  160. package/dist/core/kubernetes/client-provider.js.map +1 -1
  161. package/dist/core/references/cel.d.ts +13 -1
  162. package/dist/core/references/cel.d.ts.map +1 -1
  163. package/dist/core/references/cel.js +50 -0
  164. package/dist/core/references/cel.js.map +1 -1
  165. package/dist/core/references/schema-proxy.d.ts.map +1 -1
  166. package/dist/core/references/schema-proxy.js +13 -8
  167. package/dist/core/references/schema-proxy.js.map +1 -1
  168. package/dist/core/serialization/core.d.ts.map +1 -1
  169. package/dist/core/serialization/core.js +573 -9
  170. package/dist/core/serialization/core.js.map +1 -1
  171. package/dist/core/types/deployment.d.ts +7 -0
  172. package/dist/core/types/deployment.d.ts.map +1 -1
  173. package/dist/core/types/deployment.js +7 -0
  174. package/dist/core/types/deployment.js.map +1 -1
  175. package/dist/core/types/index.d.ts +1 -0
  176. package/dist/core/types/index.d.ts.map +1 -1
  177. package/dist/core/types/index.js.map +1 -1
  178. package/dist/core/validation/cel-validator.d.ts.map +1 -1
  179. package/dist/core/validation/cel-validator.js +4 -8
  180. package/dist/core/validation/cel-validator.js.map +1 -1
  181. package/dist/core.d.ts +1 -1
  182. package/dist/core.d.ts.map +1 -1
  183. package/dist/core.js +1 -1
  184. package/dist/core.js.map +1 -1
  185. package/dist/factories/helm/helm-release.d.ts.map +1 -1
  186. package/dist/factories/helm/helm-release.js +0 -5
  187. package/dist/factories/helm/helm-release.js.map +1 -1
  188. package/dist/factories/helm/types.d.ts +1 -1
  189. package/dist/factories/helm/types.d.ts.map +1 -1
  190. package/dist/factories/index.js +1 -0
  191. package/dist/factories/index.js.map +1 -1
  192. package/dist/factories/shared.d.ts.map +1 -1
  193. package/dist/factories/shared.js +21 -1
  194. package/dist/factories/shared.js.map +1 -1
  195. package/dist/factories/simple/index.d.ts +2 -2
  196. package/dist/factories/simple/index.d.ts.map +1 -1
  197. package/dist/factories/simple/workloads/deployment.d.ts +3 -3
  198. package/dist/factories/simple/workloads/deployment.d.ts.map +1 -1
  199. package/dist/factories/simple/workloads/deployment.js +37 -11
  200. package/dist/factories/simple/workloads/deployment.js.map +1 -1
  201. package/dist/index.d.ts +1 -1
  202. package/dist/index.d.ts.map +1 -1
  203. package/dist/index.js +1 -1
  204. package/dist/index.js.map +1 -1
  205. package/dist/utils/index.d.ts +1 -1
  206. package/dist/utils/index.d.ts.map +1 -1
  207. package/dist/utils/index.js +1 -1
  208. package/dist/utils/index.js.map +1 -1
  209. package/dist/utils/type-guards.d.ts +6 -0
  210. package/dist/utils/type-guards.d.ts.map +1 -1
  211. package/dist/utils/type-guards.js +25 -2
  212. package/dist/utils/type-guards.js.map +1 -1
  213. package/package.json +6 -1
@@ -0,0 +1,138 @@
1
+ /**
2
+ * Runtime error mapping utilities for CEL expressions
3
+ * Maps runtime CEL evaluation errors back to original JavaScript expressions
4
+ */
5
+ import { ConversionError } from '../errors.js';
6
+ import type { SourceMapBuilder, SourceMapEntry } from './source-map.js';
7
+ /**
8
+ * Information about a CEL runtime error
9
+ */
10
+ export interface CelRuntimeError {
11
+ /** The CEL expression that failed */
12
+ celExpression: string;
13
+ /** The runtime error message */
14
+ errorMessage: string;
15
+ /** Error type/category */
16
+ errorType: 'evaluation' | 'type-mismatch' | 'null-reference' | 'field-not-found' | 'syntax' | 'unknown';
17
+ /** Location in the CEL expression where the error occurred */
18
+ celLocation?: {
19
+ position: number;
20
+ length: number;
21
+ };
22
+ /** Additional context about the error */
23
+ context?: {
24
+ resourceId?: string;
25
+ fieldPath?: string;
26
+ expectedType?: string;
27
+ actualType?: string;
28
+ availableFields?: string[];
29
+ };
30
+ }
31
+ /**
32
+ * Mapped error information linking CEL runtime errors to original JavaScript
33
+ */
34
+ export interface MappedRuntimeError {
35
+ /** The original JavaScript expression */
36
+ originalExpression: string;
37
+ /** Source location in the original JavaScript */
38
+ sourceLocation: {
39
+ line: number;
40
+ column: number;
41
+ length: number;
42
+ };
43
+ /** The CEL expression that failed */
44
+ celExpression: string;
45
+ /** The runtime error details */
46
+ runtimeError: CelRuntimeError;
47
+ /** Context where the expression was used */
48
+ context: 'status' | 'resource' | 'condition' | 'readiness';
49
+ /** Suggested fixes for the error */
50
+ suggestions: string[];
51
+ /** Source mapping entry used for the mapping */
52
+ sourceMapping: SourceMapEntry;
53
+ }
54
+ /**
55
+ * Maps CEL runtime errors back to original JavaScript expressions using source maps
56
+ */
57
+ export declare class CelRuntimeErrorMapper {
58
+ private sourceMap;
59
+ constructor(sourceMap: SourceMapBuilder);
60
+ /**
61
+ * Map a CEL runtime error to the original JavaScript expression
62
+ */
63
+ mapRuntimeError(celError: CelRuntimeError): MappedRuntimeError | null;
64
+ /**
65
+ * Map multiple CEL runtime errors
66
+ */
67
+ mapMultipleErrors(celErrors: CelRuntimeError[]): MappedRuntimeError[];
68
+ /**
69
+ * Create a user-friendly error message from a mapped runtime error
70
+ */
71
+ createUserFriendlyError(mappedError: MappedRuntimeError): ConversionError;
72
+ /**
73
+ * Parse a CEL runtime error from various error formats
74
+ */
75
+ static parseCelRuntimeError(celExpression: string, error: Error | string | any): CelRuntimeError;
76
+ /**
77
+ * Map CEL error type to ConversionError expression type
78
+ */
79
+ private static mapErrorTypeToExpressionType;
80
+ /**
81
+ * Categorize the error type based on the error message
82
+ */
83
+ private static categorizeError;
84
+ /**
85
+ * Extract context information from the error message
86
+ */
87
+ private static extractErrorContext;
88
+ /**
89
+ * Find the location in the CEL expression where the error occurred
90
+ */
91
+ private static findErrorLocation;
92
+ /**
93
+ * Generate suggestions for fixing the error
94
+ */
95
+ private generateSuggestions;
96
+ /**
97
+ * Create a comprehensive error report for debugging
98
+ */
99
+ createErrorReport(mappedErrors: MappedRuntimeError[]): string;
100
+ /**
101
+ * Get statistics about runtime errors
102
+ */
103
+ getErrorStatistics(mappedErrors: MappedRuntimeError[]): {
104
+ totalErrors: number;
105
+ errorsByType: Record<string, number>;
106
+ errorsByContext: Record<string, number>;
107
+ mostCommonErrors: Array<{
108
+ type: string;
109
+ count: number;
110
+ }>;
111
+ };
112
+ }
113
+ /**
114
+ * Utility functions for working with CEL runtime errors
115
+ */
116
+ export declare class CelRuntimeErrorUtils {
117
+ /**
118
+ * Check if an error is likely a CEL runtime error
119
+ */
120
+ static isCelRuntimeError(error: any): boolean;
121
+ /**
122
+ * Extract CEL expression from error context
123
+ */
124
+ static extractCelExpressionFromError(error: any): string | null;
125
+ /**
126
+ * Create a standardized error message format
127
+ */
128
+ static formatErrorMessage(originalExpression: string, celExpression: string, errorMessage: string, context: string, suggestions: string[]): string;
129
+ /**
130
+ * Check if two runtime errors are similar (same root cause)
131
+ */
132
+ static areErrorsSimilar(error1: CelRuntimeError, error2: CelRuntimeError): boolean;
133
+ /**
134
+ * Group similar errors together
135
+ */
136
+ static groupSimilarErrors(errors: CelRuntimeError[]): CelRuntimeError[][];
137
+ }
138
+ //# sourceMappingURL=runtime-error-mapper.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"runtime-error-mapper.d.ts","sourceRoot":"","sources":["../../../src/core/expressions/runtime-error-mapper.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAC/C,OAAO,KAAK,EAAE,gBAAgB,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AAExE;;GAEG;AACH,MAAM,WAAW,eAAe;IAC9B,qCAAqC;IACrC,aAAa,EAAE,MAAM,CAAC;IACtB,gCAAgC;IAChC,YAAY,EAAE,MAAM,CAAC;IACrB,0BAA0B;IAC1B,SAAS,EAAE,YAAY,GAAG,eAAe,GAAG,gBAAgB,GAAG,iBAAiB,GAAG,QAAQ,GAAG,SAAS,CAAC;IACxG,8DAA8D;IAC9D,WAAW,CAAC,EAAE;QACZ,QAAQ,EAAE,MAAM,CAAC;QACjB,MAAM,EAAE,MAAM,CAAC;KAChB,CAAC;IACF,yCAAyC;IACzC,OAAO,CAAC,EAAE;QACR,UAAU,CAAC,EAAE,MAAM,CAAC;QACpB,SAAS,CAAC,EAAE,MAAM,CAAC;QACnB,YAAY,CAAC,EAAE,MAAM,CAAC;QACtB,UAAU,CAAC,EAAE,MAAM,CAAC;QACpB,eAAe,CAAC,EAAE,MAAM,EAAE,CAAC;KAC5B,CAAC;CACH;AAED;;GAEG;AACH,MAAM,WAAW,kBAAkB;IACjC,yCAAyC;IACzC,kBAAkB,EAAE,MAAM,CAAC;IAC3B,iDAAiD;IACjD,cAAc,EAAE;QACd,IAAI,EAAE,MAAM,C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,MAAM,EAAE,MAAM,CAAC,CAAC;QACrC,eAAe,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;QACxC,gBAAgB,EAAE,KAAK,CAAC;YAAE,IAAI,EAAE,MAAM,CAAC;YAAC,KAAK,EAAE,MAAM,CAAA;SAAE,CAAC,CAAC;KAC1D;CAwBF;AAED;;GAEG;AACH,qBAAa,oBAAoB;IAC/B;;OAEG;IACH,MAAM,CAAC,iBAAiB,CAAC,KAAK,EAAE,GAAG,GAAG,OAAO;IAmB7C;;OAEG;IACH,MAAM,CAAC,6BAA6B,CAAC,KAAK,EAAE,GAAG,GAAG,MAAM,GAAG,IAAI;IAoB/D;;OAEG;IACH,MAAM,CAAC,kBAAkB,CACvB,kBAAkB,EAAE,MAAM,EAC1B,aAAa,EAAE,MAAM,EACrB,YAAY,EAAE,MAAM,EACpB,OAAO,EAAE,MAAM,EACf,WAAW,EAAE,MAAM,EAAE,GACpB,MAAM;IAgBT;;OAEG;IACH,MAAM,CAAC,gBAAgB,CAAC,MAAM,EAAE,eAAe,EAAE,MAAM,EAAE,eAAe,GAAG,OAAO;IAkBlF;;OAEG;IACH,MAAM,CAAC,kBAAkB,CAAC,MAAM,EAAE,eAAe,EAAE,GAAG,eAAe,EAAE,EAAE;CAwB1E"}
@@ -0,0 +1,412 @@
1
+ /**
2
+ * Runtime error mapping utilities for CEL expressions
3
+ * Maps runtime CEL evaluation errors back to original JavaScript expressions
4
+ */
5
+ import { ConversionError } from '../errors.js';
6
+ /**
7
+ * Maps CEL runtime errors back to original JavaScript expressions using source maps
8
+ */
9
+ export class CelRuntimeErrorMapper {
10
+ sourceMap;
11
+ constructor(sourceMap) {
12
+ this.sourceMap = sourceMap;
13
+ }
14
+ /**
15
+ * Map a CEL runtime error to the original JavaScript expression
16
+ */
17
+ mapRuntimeError(celError) {
18
+ // Find the source mapping for this CEL expression
19
+ const sourceMapping = this.sourceMap.findOriginalExpression(celError.celExpression);
20
+ if (!sourceMapping) {
21
+ // No source mapping found - can't map back to original
22
+ return null;
23
+ }
24
+ // Generate suggestions based on the error type and context
25
+ const suggestions = this.generateSuggestions(celError, sourceMapping);
26
+ return {
27
+ originalExpression: sourceMapping.originalExpression,
28
+ sourceLocation: sourceMapping.sourceLocation,
29
+ celExpression: celError.celExpression,
30
+ runtimeError: celError,
31
+ context: sourceMapping.context,
32
+ suggestions,
33
+ sourceMapping,
34
+ };
35
+ }
36
+ /**
37
+ * Map multiple CEL runtime errors
38
+ */
39
+ mapMultipleErrors(celErrors) {
40
+ const mappedErrors = [];
41
+ for (const celError of celErrors) {
42
+ const mapped = this.mapRuntimeError(celError);
43
+ if (mapped) {
44
+ mappedErrors.push(mapped);
45
+ }
46
+ }
47
+ return mappedErrors;
48
+ }
49
+ /**
50
+ * Create a user-friendly error message from a mapped runtime error
51
+ */
52
+ createUserFriendlyError(mappedError) {
53
+ const { originalExpression, sourceLocation, runtimeError, context, suggestions } = mappedError;
54
+ let message = `Runtime error in ${context} expression:\n`;
55
+ message += ` Original: ${originalExpression}\n`;
56
+ message += ` CEL: ${mappedError.celExpression}\n`;
57
+ message += ` Error: ${runtimeError.errorMessage}`;
58
+ // Add context-specific information
59
+ if (runtimeError.context) {
60
+ if (runtimeError.context.resourceId) {
61
+ message += `\n Resource: ${runtimeError.context.resourceId}`;
62
+ }
63
+ if (runtimeError.context.fieldPath) {
64
+ message += `\n Field: ${runtimeError.context.fieldPath}`;
65
+ }
66
+ if (runtimeError.context.expectedType && runtimeError.context.actualType) {
67
+ message += `\n Expected: ${runtimeError.context.expectedType}`;
68
+ message += `\n Actual: ${runtimeError.context.actualType}`;
69
+ }
70
+ }
71
+ // Map CEL error type to ConversionError expression type
72
+ const expressionType = CelRuntimeErrorMapper.mapErrorTypeToExpressionType(runtimeError.errorType);
73
+ return new ConversionError(message, originalExpression, expressionType, sourceLocation, {
74
+ analysisContext: context,
75
+ ...(runtimeError.context?.availableFields && {
76
+ availableReferences: runtimeError.context.availableFields
77
+ }),
78
+ }, suggestions);
79
+ }
80
+ /**
81
+ * Parse a CEL runtime error from various error formats
82
+ */
83
+ static parseCelRuntimeError(celExpression, error) {
84
+ const errorMessage = error instanceof Error ? error.message : String(error);
85
+ // Determine error type from the message
86
+ const errorType = CelRuntimeErrorMapper.categorizeError(errorMessage);
87
+ // Extract context information from the error
88
+ const context = CelRuntimeErrorMapper.extractErrorContext(errorMessage, celExpression);
89
+ // Try to find the location in the CEL expression where the error occurred
90
+ const celLocation = CelRuntimeErrorMapper.findErrorLocation(errorMessage, celExpression);
91
+ const result = {
92
+ celExpression,
93
+ errorMessage,
94
+ errorType,
95
+ };
96
+ if (celLocation) {
97
+ result.celLocation = celLocation;
98
+ }
99
+ if (context) {
100
+ result.context = context;
101
+ }
102
+ return result;
103
+ }
104
+ /**
105
+ * Map CEL error type to ConversionError expression type
106
+ */
107
+ static mapErrorTypeToExpressionType(errorType) {
108
+ switch (errorType) {
109
+ case 'field-not-found':
110
+ return 'member-access';
111
+ case 'type-mismatch':
112
+ return 'binary-operation';
113
+ case 'evaluation':
114
+ return 'function-call';
115
+ case 'syntax':
116
+ return 'javascript';
117
+ case 'null-reference':
118
+ return 'member-access';
119
+ default:
120
+ return 'unknown';
121
+ }
122
+ }
123
+ /**
124
+ * Categorize the error type based on the error message
125
+ */
126
+ static categorizeError(errorMessage) {
127
+ const message = errorMessage.toLowerCase();
128
+ if (message.includes('null') || message.includes('undefined')) {
129
+ return 'null-reference';
130
+ }
131
+ if (message.includes('type') || message.includes('expected')) {
132
+ return 'type-mismatch';
133
+ }
134
+ if (message.includes('field') || message.includes('property') || message.includes('not found')) {
135
+ return 'field-not-found';
136
+ }
137
+ if (message.includes('syntax') || message.includes('parse')) {
138
+ return 'syntax';
139
+ }
140
+ if (message.includes('evaluation') || message.includes('runtime')) {
141
+ return 'evaluation';
142
+ }
143
+ return 'unknown';
144
+ }
145
+ /**
146
+ * Extract context information from the error message
147
+ */
148
+ static extractErrorContext(errorMessage, celExpression) {
149
+ const context = {};
150
+ // Extract resource ID from CEL expression
151
+ const resourceMatch = celExpression.match(/resources\.(\w+)\./);
152
+ if (resourceMatch?.[1]) {
153
+ context.resourceId = resourceMatch[1];
154
+ }
155
+ // Extract field path from CEL expression
156
+ const fieldMatch = celExpression.match(/\.([a-zA-Z0-9_.]+)$/);
157
+ if (fieldMatch?.[1]) {
158
+ context.fieldPath = fieldMatch[1];
159
+ }
160
+ // Extract type information from error message
161
+ const typeMatch = errorMessage.match(/expected (\w+), got (\w+)/i);
162
+ if (typeMatch?.[1] && typeMatch[2]) {
163
+ context.expectedType = typeMatch[1];
164
+ context.actualType = typeMatch[2];
165
+ }
166
+ return context;
167
+ }
168
+ /**
169
+ * Find the location in the CEL expression where the error occurred
170
+ */
171
+ static findErrorLocation(errorMessage, celExpression) {
172
+ // Try to extract position information from error message
173
+ const positionMatch = errorMessage.match(/at position (\d+)/i);
174
+ if (positionMatch?.[1]) {
175
+ const position = parseInt(positionMatch[1], 10);
176
+ return {
177
+ position,
178
+ length: 1, // Default length
179
+ };
180
+ }
181
+ // Try to find the problematic part in the expression
182
+ const fieldMatch = errorMessage.match(/field '(\w+)'/i);
183
+ if (fieldMatch?.[1]) {
184
+ const fieldName = fieldMatch[1];
185
+ const position = celExpression.indexOf(fieldName);
186
+ if (position >= 0) {
187
+ return {
188
+ position,
189
+ length: fieldName.length,
190
+ };
191
+ }
192
+ }
193
+ return undefined;
194
+ }
195
+ /**
196
+ * Generate suggestions for fixing the error
197
+ */
198
+ generateSuggestions(celError, sourceMapping) {
199
+ const suggestions = [];
200
+ switch (celError.errorType) {
201
+ case 'null-reference':
202
+ suggestions.push('Use optional chaining (?.) to handle potentially null values');
203
+ suggestions.push('Add a null check before accessing the field');
204
+ suggestions.push('Provide a default value using the || operator');
205
+ if (celError.context?.resourceId) {
206
+ suggestions.push(`Ensure the '${celError.context.resourceId}' resource is deployed and ready`);
207
+ }
208
+ break;
209
+ case 'field-not-found':
210
+ suggestions.push('Check that the field name is spelled correctly');
211
+ suggestions.push('Verify that the field exists in the resource schema');
212
+ if (celError.context?.availableFields?.length) {
213
+ suggestions.push(`Available fields: ${celError.context.availableFields.join(', ')}`);
214
+ }
215
+ if (celError.context?.resourceId) {
216
+ suggestions.push(`Check the status of the '${celError.context.resourceId}' resource`);
217
+ }
218
+ break;
219
+ case 'type-mismatch':
220
+ if (celError.context?.expectedType && celError.context?.actualType) {
221
+ suggestions.push(`Convert the value from ${celError.context.actualType} to ${celError.context.expectedType}`);
222
+ }
223
+ suggestions.push('Check that the field contains the expected data type');
224
+ suggestions.push('Add type checking or conversion in your expression');
225
+ break;
226
+ case 'evaluation':
227
+ suggestions.push('Check that all referenced resources are available');
228
+ suggestions.push('Verify that the expression logic is correct');
229
+ suggestions.push('Consider simplifying the expression');
230
+ break;
231
+ case 'syntax':
232
+ suggestions.push('Check the CEL expression syntax');
233
+ suggestions.push('Verify that all operators and functions are valid');
234
+ suggestions.push('Consider using simpler JavaScript expressions');
235
+ break;
236
+ default:
237
+ suggestions.push('Check the CEL expression and referenced resources');
238
+ suggestions.push('Verify that all dependencies are available');
239
+ suggestions.push('Consider using optional chaining for potentially missing fields');
240
+ }
241
+ // Add context-specific suggestions
242
+ if (sourceMapping.context === 'status') {
243
+ suggestions.push('Status expressions are evaluated after resource deployment');
244
+ suggestions.push('Ensure all referenced resources are included in your resource graph');
245
+ }
246
+ else if (sourceMapping.context === 'resource') {
247
+ suggestions.push('Resource expressions are evaluated during resource creation');
248
+ suggestions.push('Only reference schema fields or other resources in the same graph');
249
+ }
250
+ return suggestions;
251
+ }
252
+ /**
253
+ * Create a comprehensive error report for debugging
254
+ */
255
+ createErrorReport(mappedErrors) {
256
+ if (mappedErrors.length === 0) {
257
+ return 'No runtime errors to report.';
258
+ }
259
+ const report = [
260
+ '=== CEL Runtime Error Report ===',
261
+ `Generated: ${new Date().toISOString()}`,
262
+ `Total Errors: ${mappedErrors.length}`,
263
+ '',
264
+ ];
265
+ mappedErrors.forEach((error, index) => {
266
+ report.push(`## Error ${index + 1}: ${error.runtimeError.errorType}`);
267
+ report.push('');
268
+ report.push(`**Original Expression**: \`${error.originalExpression}\``);
269
+ report.push(`**CEL Expression**: \`${error.celExpression}\``);
270
+ report.push(`**Context**: ${error.context}`);
271
+ report.push(`**Location**: Line ${error.sourceLocation.line}, Column ${error.sourceLocation.column}`);
272
+ report.push(`**Error Message**: ${error.runtimeError.errorMessage}`);
273
+ if (error.runtimeError.context?.resourceId) {
274
+ report.push(`**Resource**: ${error.runtimeError.context.resourceId}`);
275
+ }
276
+ if (error.runtimeError.context?.fieldPath) {
277
+ report.push(`**Field**: ${error.runtimeError.context.fieldPath}`);
278
+ }
279
+ if (error.suggestions.length > 0) {
280
+ report.push('');
281
+ report.push('**Suggestions**:');
282
+ error.suggestions.forEach(suggestion => {
283
+ report.push(`- ${suggestion}`);
284
+ });
285
+ }
286
+ report.push('');
287
+ });
288
+ return report.join('\n');
289
+ }
290
+ /**
291
+ * Get statistics about runtime errors
292
+ */
293
+ getErrorStatistics(mappedErrors) {
294
+ const errorsByType = {};
295
+ const errorsByContext = {};
296
+ mappedErrors.forEach(error => {
297
+ const type = error.runtimeError.errorType;
298
+ const context = error.context;
299
+ errorsByType[type] = (errorsByType[type] || 0) + 1;
300
+ errorsByContext[context] = (errorsByContext[context] || 0) + 1;
301
+ });
302
+ const mostCommonErrors = Object.entries(errorsByType)
303
+ .map(([type, count]) => ({ type, count }))
304
+ .sort((a, b) => b.count - a.count)
305
+ .slice(0, 5);
306
+ return {
307
+ totalErrors: mappedErrors.length,
308
+ errorsByType,
309
+ errorsByContext,
310
+ mostCommonErrors,
311
+ };
312
+ }
313
+ }
314
+ /**
315
+ * Utility functions for working with CEL runtime errors
316
+ */
317
+ export class CelRuntimeErrorUtils {
318
+ /**
319
+ * Check if an error is likely a CEL runtime error
320
+ */
321
+ static isCelRuntimeError(error) {
322
+ if (!error)
323
+ return false;
324
+ const message = error.message || String(error);
325
+ const celIndicators = [
326
+ 'cel',
327
+ 'expression',
328
+ 'evaluation',
329
+ 'resources.',
330
+ 'schema.',
331
+ 'field not found',
332
+ 'type mismatch'
333
+ ];
334
+ return celIndicators.some(indicator => message.toLowerCase().includes(indicator));
335
+ }
336
+ /**
337
+ * Extract CEL expression from error context
338
+ */
339
+ static extractCelExpressionFromError(error) {
340
+ if (!error)
341
+ return null;
342
+ const message = error.message || String(error);
343
+ // Try to find CEL expression in error message
344
+ const celMatch = message.match(/expression[:\s]+['"`]([^'"`]+)['"`]/i);
345
+ if (celMatch) {
346
+ return celMatch[1];
347
+ }
348
+ // Try to find ${...} patterns
349
+ const templateMatch = message.match(/\$\{([^}]+)\}/);
350
+ if (templateMatch) {
351
+ return templateMatch[1];
352
+ }
353
+ return null;
354
+ }
355
+ /**
356
+ * Create a standardized error message format
357
+ */
358
+ static formatErrorMessage(originalExpression, celExpression, errorMessage, context, suggestions) {
359
+ let formatted = `JavaScript to CEL Runtime Error in ${context}:\n`;
360
+ formatted += ` Original: ${originalExpression}\n`;
361
+ formatted += ` CEL: ${celExpression}\n`;
362
+ formatted += ` Error: ${errorMessage}`;
363
+ if (suggestions.length > 0) {
364
+ formatted += '\n\nSuggestions:\n';
365
+ suggestions.forEach((suggestion, index) => {
366
+ formatted += ` ${index + 1}. ${suggestion}\n`;
367
+ });
368
+ }
369
+ return formatted;
370
+ }
371
+ /**
372
+ * Check if two runtime errors are similar (same root cause)
373
+ */
374
+ static areErrorsSimilar(error1, error2) {
375
+ // Same error type and similar expressions
376
+ if (error1.errorType !== error2.errorType) {
377
+ return false;
378
+ }
379
+ // Same resource context
380
+ if (error1.context?.resourceId !== error2.context?.resourceId) {
381
+ return false;
382
+ }
383
+ // Similar error messages (allowing for minor variations)
384
+ const message1 = error1.errorMessage.toLowerCase().replace(/['"]/g, '');
385
+ const message2 = error2.errorMessage.toLowerCase().replace(/['"]/g, '');
386
+ return message1.includes(message2) || message2.includes(message1);
387
+ }
388
+ /**
389
+ * Group similar errors together
390
+ */
391
+ static groupSimilarErrors(errors) {
392
+ const groups = [];
393
+ const processed = new Set();
394
+ for (let i = 0; i < errors.length; i++) {
395
+ if (processed.has(i) || !errors[i])
396
+ continue;
397
+ const group = [errors[i]];
398
+ processed.add(i);
399
+ for (let j = i + 1; j < errors.length; j++) {
400
+ if (processed.has(j) || !errors[j])
401
+ continue;
402
+ if (errors[i] && errors[j] && CelRuntimeErrorUtils.areErrorsSimilar(errors[i], errors[j])) {
403
+ group.push(errors[j]);
404
+ processed.add(j);
405
+ }
406
+ }
407
+ groups.push(group.filter(Boolean));
408
+ }
409
+ return groups;
410
+ }
411
+ }
412
+ //# sourceMappingURL=runtime-error-mapper.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"runtime-error-mapper.js","sourceRoot":"","sources":["../../../src/core/expressions/runtime-error-mapper.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAoD/C;;GAEG;AACH,MAAM,OAAO,qBAAqB;IACZ;IAApB,YAAoB,SAA2B;QAA3B,cAAS,GAAT,SAAS,CAAkB;IAAG,CAAC;IAEnD;;OAEG;IACH,eAAe,CAAC,QAAyB;QACvC,kDAAkD;QAClD,MAAM,aAAa,GAAG,IAAI,CAAC,SAAS,CAAC,sBAAsB,CAAC,QAAQ,CAAC,aAAa,CAAC,CAAC;QAEpF,IAAI,CAAC,aAAa,EAAE,CAAC;YACnB,uDAAuD;YACvD,OAAO,IAAI,CAAC;QACd,CAAC;QAED,2DAA2D;QAC3D,MAAM,WAAW,GAAG,IAAI,CAAC,mBAAmB,CAAC,QAAQ,EAAE,aAAa,CAAC,CAAC;QAEtE,OAAO;YACL,kBAAkB,EAAE,aAAa,CAAC,kBAAkB;YACpD,cAAc,EAAE,aAAa,CAAC,cAAc;YAC5C,aAAa,EAAE,QAAQ,CAAC,aAAa;YACrC,YAAY,EAAE,QAAQ;YACtB,OAAO,EAAE,aAAa,CAAC,OAA4D;YACnF,WAAW;YACX,aAAa;SACd,CAAC;IACJ,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