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,457 @@
1
+ /**
2
+ * Imperative Composition Analyzer
3
+ *
4
+ * This module analyzes imperative composition functions to detect JavaScript expressions
5
+ * that contain KubernetesRef objects and converts them to CEL expressions.
6
+ */
7
+ import { Parser } from 'acorn';
8
+ import * as estraverse from 'estraverse';
9
+ import { Cel } from '../references/cel.js';
10
+ import { getComponentLogger } from '../logging/index.js';
11
+ const logger = getComponentLogger('imperative-analyzer');
12
+ /**
13
+ * Analyze an imperative composition function to detect JavaScript expressions
14
+ * that should be converted to CEL expressions.
15
+ */
16
+ export function analyzeImperativeComposition(compositionFn, resources, options) {
17
+ logger.debug('Analyzing imperative composition function', {
18
+ resourceCount: Object.keys(resources).length,
19
+ factoryType: options.factoryType,
20
+ resourceIds: Object.keys(resources)
21
+ });
22
+ try {
23
+ // Parse the composition function source code
24
+ const functionSource = compositionFn.toString();
25
+ logger.debug('Parsing composition function source', {
26
+ sourceLength: functionSource.length,
27
+ functionSource: functionSource.substring(0, 500) + (functionSource.length > 500 ? '...' : '')
28
+ });
29
+ const ast = Parser.parse(functionSource, {
30
+ ecmaVersion: 2022,
31
+ sourceType: 'script',
32
+ locations: true,
33
+ ranges: true
34
+ });
35
+ // Find the return statement in the composition function
36
+ const returnStatement = findReturnStatement(ast);
37
+ if (!returnStatement || !returnStatement.argument) {
38
+ logger.debug('No return statement found in composition function');
39
+ return {
40
+ statusMappings: {},
41
+ hasJavaScriptExpressions: false,
42
+ errors: ['No return statement found in composition function']
43
+ };
44
+ }
45
+ // Check if the return statement returns an object literal
46
+ if (returnStatement.argument.type !== 'ObjectExpression') {
47
+ logger.debug('Return statement does not return an object literal');
48
+ return {
49
+ statusMappings: {},
50
+ hasJavaScriptExpressions: false,
51
+ errors: ['Return statement must return an object literal']
52
+ };
53
+ }
54
+ // Analyze each property in the returned object
55
+ const statusMappings = {};
56
+ const errors = [];
57
+ let hasJavaScriptExpressions = false;
58
+ // Process properties recursively to handle nested objects
59
+ function processProperties(properties, parentPath = '') {
60
+ for (const property of properties) {
61
+ if (property.type === 'Property' && property.key.type === 'Identifier') {
62
+ const fieldName = property.key.name;
63
+ const fullFieldName = parentPath ? `${parentPath}.${fieldName}` : fieldName;
64
+ try {
65
+ // Check if this is a nested object
66
+ if (property.value.type === 'ObjectExpression') {
67
+ logger.debug('Found nested object property', { fieldName, fullFieldName });
68
+ // Create nested object in statusMappings
69
+ if (parentPath) {
70
+ // Navigate to the parent object and create the nested structure
71
+ const pathParts = parentPath.split('.');
72
+ let current = statusMappings;
73
+ for (const part of pathParts) {
74
+ if (!current[part])
75
+ current[part] = {};
76
+ current = current[part];
77
+ }
78
+ if (!current[fieldName])
79
+ current[fieldName] = {};
80
+ }
81
+ else {
82
+ if (!statusMappings[fieldName])
83
+ statusMappings[fieldName] = {};
84
+ }
85
+ // Recursively process nested properties
86
+ processProperties(property.value.properties, fullFieldName);
87
+ continue;
88
+ }
89
+ // Convert the property value to source code
90
+ const propertySource = getNodeSource(property.value, functionSource);
91
+ logger.debug('Analyzing property', {
92
+ fieldName,
93
+ fullFieldName,
94
+ propertySource: propertySource.substring(0, 100) + (propertySource.length > 100 ? '...' : '')
95
+ });
96
+ // Check if this expression contains resource references
97
+ if (containsResourceReferences(propertySource)) {
98
+ logger.debug('Found resource references in property', { fieldName, fullFieldName, propertySource });
99
+ // Convert resource references to proper format for CEL
100
+ const convertedSource = convertResourceReferencesToCel(propertySource, resources);
101
+ logger.debug('Converted resource references', {
102
+ fieldName,
103
+ fullFieldName,
104
+ originalSource: propertySource.substring(0, 100),
105
+ convertedSource: convertedSource.substring(0, 100)
106
+ });
107
+ // For imperative compositions, create CEL expressions directly from the converted source
108
+ const celExpression = Cel.expr(convertedSource);
109
+ // Set the CEL expression at the correct nested path
110
+ if (parentPath) {
111
+ const pathParts = parentPath.split('.');
112
+ let current = statusMappings;
113
+ for (const part of pathParts) {
114
+ if (!current[part])
115
+ current[part] = {};
116
+ current = current[part];
117
+ }
118
+ current[fieldName] = celExpression;
119
+ }
120
+ else {
121
+ statusMappings[fieldName] = celExpression;
122
+ }
123
+ hasJavaScriptExpressions = true;
124
+ logger.debug('Created direct CEL expression for property', {
125
+ fieldName,
126
+ fullFieldName,
127
+ expression: convertedSource
128
+ });
129
+ }
130
+ else {
131
+ // No resource references, keep as static value
132
+ const staticValue = evaluateStaticExpression(property.value);
133
+ // Set the static value at the correct nested path
134
+ if (parentPath) {
135
+ const pathParts = parentPath.split('.');
136
+ let current = statusMappings;
137
+ for (const part of pathParts) {
138
+ if (!current[part])
139
+ current[part] = {};
140
+ current = current[part];
141
+ }
142
+ current[fieldName] = staticValue;
143
+ }
144
+ else {
145
+ statusMappings[fieldName] = staticValue;
146
+ }
147
+ logger.debug('Property has no resource references, keeping as static', { fieldName, fullFieldName });
148
+ }
149
+ }
150
+ catch (error) {
151
+ const errorMessage = `Failed to analyze property '${fullFieldName}': ${error instanceof Error ? error.message : String(error)}`;
152
+ errors.push(errorMessage);
153
+ logger.debug('Property analysis failed', { fieldName, fullFieldName, error: errorMessage });
154
+ // Fallback to static evaluation
155
+ try {
156
+ const staticValue = evaluateStaticExpression(property.value);
157
+ if (parentPath) {
158
+ const pathParts = parentPath.split('.');
159
+ let current = statusMappings;
160
+ for (const part of pathParts) {
161
+ if (!current[part])
162
+ current[part] = {};
163
+ current = current[part];
164
+ }
165
+ current[fieldName] = staticValue;
166
+ }
167
+ else {
168
+ statusMappings[fieldName] = staticValue;
169
+ }
170
+ }
171
+ catch (_evalError) {
172
+ if (parentPath) {
173
+ const pathParts = parentPath.split('.');
174
+ let current = statusMappings;
175
+ for (const part of pathParts) {
176
+ if (!current[part])
177
+ current[part] = {};
178
+ current = current[part];
179
+ }
180
+ current[fieldName] = null;
181
+ }
182
+ else {
183
+ statusMappings[fieldName] = null;
184
+ }
185
+ }
186
+ }
187
+ }
188
+ }
189
+ }
190
+ // Start processing from the top-level properties
191
+ processProperties(returnStatement.argument.properties);
192
+ logger.debug('Imperative composition analysis complete', {
193
+ statusFieldCount: Object.keys(statusMappings).length,
194
+ hasJavaScriptExpressions,
195
+ errorCount: errors.length
196
+ });
197
+ return {
198
+ statusMappings,
199
+ hasJavaScriptExpressions,
200
+ errors
201
+ };
202
+ }
203
+ catch (error) {
204
+ const errorMessage = `Failed to analyze imperative composition: ${error instanceof Error ? error.message : String(error)}`;
205
+ logger.error('Imperative composition analysis failed', error);
206
+ return {
207
+ statusMappings: {},
208
+ hasJavaScriptExpressions: false,
209
+ errors: [errorMessage]
210
+ };
211
+ }
212
+ }
213
+ /**
214
+ * Find the return statement in an AST
215
+ */
216
+ function findReturnStatement(ast) {
217
+ let returnStatement = null;
218
+ estraverse.traverse(ast, {
219
+ enter: (node) => {
220
+ if (node.type === 'ReturnStatement') {
221
+ returnStatement = node;
222
+ return estraverse.VisitorOption.Break;
223
+ }
224
+ // Continue normal traversal
225
+ return undefined;
226
+ }
227
+ });
228
+ return returnStatement;
229
+ }
230
+ /**
231
+ * Extract source code for a specific AST node
232
+ */
233
+ function getNodeSource(node, fullSource) {
234
+ if (node.range) {
235
+ return fullSource.substring(node.range[0], node.range[1]);
236
+ }
237
+ // Fallback: try to reconstruct the source
238
+ switch (node.type) {
239
+ case 'Literal':
240
+ return typeof node.value === 'string' ? `"${node.value}"` : String(node.value);
241
+ case 'Identifier':
242
+ return node.name;
243
+ case 'BinaryExpression':
244
+ return `${getNodeSource(node.left, fullSource)} ${node.operator} ${getNodeSource(node.right, fullSource)}`;
245
+ case 'ConditionalExpression':
246
+ return `${getNodeSource(node.test, fullSource)} ? ${getNodeSource(node.consequent, fullSource)} : ${getNodeSource(node.alternate, fullSource)}`;
247
+ case 'LogicalExpression':
248
+ return `${getNodeSource(node.left, fullSource)} ${node.operator} ${getNodeSource(node.right, fullSource)}`;
249
+ case 'MemberExpression': {
250
+ const object = getNodeSource(node.object, fullSource);
251
+ const property = node.computed ? `[${getNodeSource(node.property, fullSource)}]` : `.${node.property.name}`;
252
+ return object + property;
253
+ }
254
+ case 'ObjectExpression': {
255
+ const properties = node.properties.map((prop) => {
256
+ const key = prop.key.name || prop.key.value;
257
+ const value = getNodeSource(prop.value, fullSource);
258
+ return `${key}: ${value}`;
259
+ }).join(', ');
260
+ return `{ ${properties} }`;
261
+ }
262
+ default:
263
+ return '<unknown>';
264
+ }
265
+ }
266
+ /**
267
+ * Check if a source string contains resource references or schema references
268
+ */
269
+ function containsResourceReferences(source) {
270
+ // Look for patterns like:
271
+ // - kroHelmRelease.status.phase (resource references)
272
+ // - fluxHelmRelease.status.phase (resource references)
273
+ // - variableName.status.something (resource references)
274
+ // - variableName.metadata.something (resource references)
275
+ // - spec.hostname (schema references)
276
+ // - spec.name (schema references)
277
+ const referencePatterns = [
278
+ /\w+\.status\./,
279
+ /\w+\.metadata\./,
280
+ /\w+\.spec\./,
281
+ /\w+\.data\./,
282
+ /\bspec\./ // Schema references
283
+ ];
284
+ return referencePatterns.some(pattern => pattern.test(source));
285
+ }
286
+ /**
287
+ * Convert resource references and schema references in source code to proper CEL format
288
+ *
289
+ * This function handles template literals and converts them to proper CEL string concatenation.
290
+ * For example: `https://${spec.hostname}/api` becomes: "https://" + schema.spec.hostname + "/api"
291
+ * For example: `Deployment ${deployment.metadata.name} has ${deployment.status.readyReplicas} replicas`
292
+ * becomes: "Deployment " + deployment.metadata.name + " has " + deployment.status.readyReplicas + " replicas"
293
+ */
294
+ function convertResourceReferencesToCel(source, resources) {
295
+ // Check if this is a template literal
296
+ if (source.startsWith('`') && source.endsWith('`')) {
297
+ return convertTemplateLiteralToCel(source, resources);
298
+ }
299
+ // Check if this is a string literal that contains KubernetesRef placeholders
300
+ if (source.includes('__KUBERNETES_REF_')) {
301
+ return convertStringWithKubernetesRefs(source);
302
+ }
303
+ // For non-template literals, return as-is (other expressions should already be valid CEL)
304
+ return source;
305
+ }
306
+ /**
307
+ * Convert a JavaScript template literal to CEL string concatenation
308
+ */
309
+ function convertTemplateLiteralToCel(templateLiteral, resources) {
310
+ // Remove the backticks
311
+ let content = templateLiteral.slice(1, -1);
312
+ // First, convert any special KubernetesRef strings in the content
313
+ content = convertTemplateLiteralContent(content);
314
+ // Parse template literal parts
315
+ const parts = [];
316
+ let currentPart = '';
317
+ let i = 0;
318
+ while (i < content.length) {
319
+ if (content[i] === '$' && content[i + 1] === '{') {
320
+ // Found interpolation start
321
+ if (currentPart) {
322
+ // Add the literal string part (quoted for CEL)
323
+ parts.push(`"${currentPart.replace(/"/g, '\\"')}"`);
324
+ currentPart = '';
325
+ }
326
+ // Find the matching closing brace
327
+ let braceCount = 1;
328
+ let j = i + 2;
329
+ let expression = '';
330
+ while (j < content.length && braceCount > 0) {
331
+ if (content[j] === '{')
332
+ braceCount++;
333
+ if (content[j] === '}')
334
+ braceCount--;
335
+ if (braceCount > 0)
336
+ expression += content[j];
337
+ j++;
338
+ }
339
+ // Convert the expression part
340
+ if (expression.trim()) {
341
+ const convertedExpression = convertExpressionToCel(expression.trim());
342
+ parts.push(convertedExpression);
343
+ }
344
+ i = j;
345
+ }
346
+ else {
347
+ currentPart += content[i];
348
+ i++;
349
+ }
350
+ }
351
+ // Add any remaining literal part
352
+ if (currentPart) {
353
+ parts.push(`"${currentPart.replace(/"/g, '\\"')}"`);
354
+ }
355
+ // Join parts with + for CEL string concatenation
356
+ return parts.join(' + ');
357
+ }
358
+ /**
359
+ * Convert individual expressions within template literals to CEL format
360
+ */
361
+ function convertExpressionToCel(expression) {
362
+ // Convert schema references: spec.hostname -> schema.spec.hostname
363
+ if (expression.startsWith('spec.')) {
364
+ return `schema.${expression}`;
365
+ }
366
+ // Resource references are already in correct format
367
+ return expression;
368
+ }
369
+ /**
370
+ * Convert template literal content that may contain special KubernetesRef strings
371
+ */
372
+ function convertTemplateLiteralContent(content) {
373
+ // Replace special KubernetesRef strings with proper CEL expressions
374
+ return content.replace(/__KUBERNETES_REF_([^_]+)_([^_]+)__/g, (match, resourceId, fieldPath) => {
375
+ if (resourceId === '__schema__') {
376
+ return `schema.${fieldPath}`;
377
+ }
378
+ else {
379
+ return `${resourceId}.${fieldPath}`;
380
+ }
381
+ });
382
+ }
383
+ /**
384
+ * Convert a string literal that contains KubernetesRef placeholders to CEL string concatenation
385
+ */
386
+ function convertStringWithKubernetesRefs(source) {
387
+ // Remove quotes if present
388
+ let content = source;
389
+ if ((content.startsWith('"') && content.endsWith('"')) || (content.startsWith("'") && content.endsWith("'"))) {
390
+ content = content.slice(1, -1);
391
+ }
392
+ // Split the string by KubernetesRef placeholders
393
+ const parts = [];
394
+ const refPattern = /__KUBERNETES_REF_([^_]+)_([^_]+)__/g;
395
+ let lastIndex = 0;
396
+ let match = refPattern.exec(content);
397
+ while (match !== null) {
398
+ // Add the literal part before the reference
399
+ if (match.index > lastIndex) {
400
+ const literalPart = content.slice(lastIndex, match.index);
401
+ if (literalPart) {
402
+ parts.push(`"${literalPart.replace(/"/g, '\\"')}"`);
403
+ }
404
+ }
405
+ // Add the reference part
406
+ const [, resourceId, fieldPath] = match;
407
+ if (resourceId === '__schema__') {
408
+ parts.push(`schema.${fieldPath}`);
409
+ }
410
+ else {
411
+ parts.push(`${resourceId}.${fieldPath}`);
412
+ }
413
+ lastIndex = match.index + match[0].length;
414
+ match = refPattern.exec(content);
415
+ }
416
+ // Add any remaining literal part
417
+ if (lastIndex < content.length) {
418
+ const literalPart = content.slice(lastIndex);
419
+ if (literalPart) {
420
+ parts.push(`"${literalPart.replace(/"/g, '\\"')}"`);
421
+ }
422
+ }
423
+ // Join parts with + for CEL string concatenation
424
+ return parts.join(' + ');
425
+ }
426
+ /**
427
+ * Evaluate a static expression (no resource references)
428
+ */
429
+ function evaluateStaticExpression(node) {
430
+ switch (node.type) {
431
+ case 'Literal':
432
+ return node.value;
433
+ case 'Identifier':
434
+ // For identifiers, we can't evaluate them statically
435
+ return node.name;
436
+ case 'BinaryExpression':
437
+ // For binary expressions with literals, we could evaluate them
438
+ // But for safety, just return a placeholder
439
+ return null;
440
+ case 'ConditionalExpression':
441
+ return null;
442
+ case 'LogicalExpression':
443
+ return null;
444
+ case 'ObjectExpression': {
445
+ const obj = {};
446
+ for (const prop of node.properties) {
447
+ if (prop.type === 'Property' && prop.key.type === 'Identifier') {
448
+ obj[prop.key.name] = evaluateStaticExpression(prop.value);
449
+ }
450
+ }
451
+ return obj;
452
+ }
453
+ default:
454
+ return null;
455
+ }
456
+ }
457
+ //# sourceMappingURL=imperative-analyzer.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"imperative-analyzer.js","sourceRoot":"","sources":["../../../src/core/expressions/imperative-analyzer.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AAC/B,OAAO,KAAK,UAAU,MAAM,YAAY,CAAC;AACzC,OAAO,EAAE,GAAG,EAAE,MAAM,sBAAsB,CAAC;AAC3C,OAAO,EAAE,kBAAkB,EAAE,MAAM,qBAAqB,CAAC;AAKzD,MAAM,MAAM,GAAG,kBAAkB,CAAC,qBAAqB,CAAC,CAAC;AAYzD;;;GAGG;AACH,MAAM,UAAU,4BAA4B,CAC1C,aAAuB,EACvB,SAA6C,EAC7C,OAAkC;IAElC,MAAM,CAAC,KAAK,CAAC,2CAA2C,EAAE;QACxD,aAAa,EAAE,MAAM,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC,MAAM;QAC5C,WAAW,EAAE,OAAO,CAAC,WAAW;QAChC,WAAW,EAAE,MAAM,CAAC,IAAI,CAAC,SAAS,CAAC;KACpC,CAAC,CAAC;IAEH,IAAI,CAAC;QACH,6CAA6C;QAC7C,MAAM,cAAc,GAAG,aAAa,CAAC,QAAQ,EAAE,CAAC;QAEhD,MAAM,CAAC,KAAK,CAAC,qCAAqC,EAAE;YAClD,YAAY,EAAE,cAAc,CAAC,MAAM;YACnC,cAAc,EAAE,cAAc,CAAC,SAAS,CAAC,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IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,GAAG,wBAAwB,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;gBAC5D,CAAC;YACH,CAAC;YACD,OAAO,GAAG,CAAC;QACb,CAAC;QACD;YACE,OAAO,IAAI,CAAC;IAChB,CAAC;AACH,CAAC"}
@@ -0,0 +1,54 @@
1
+ /**
2
+ * JavaScript to CEL Expression Analysis and Type Safety Integration
3
+ *
4
+ * This module provides comprehensive type safety integration for JavaScript
5
+ * to CEL expression conversion, including compile-time validation, runtime
6
+ * type inference, and resource reference validation.
7
+ */
8
+ export { JavaScriptToCelAnalyzer } from './analyzer.js';
9
+ export type { AnalysisContext, ExpressionValidationReport, ValidationSummary } from './analyzer.js';
10
+ export { ExpressionTypeValidator, TypeRegistry, TypeSafetyUtils, TypeValidationError, TypeValidationWarning } from './type-safety.js';
11
+ export type { TypeInfo, TypeValidationResult } from './type-safety.js';
12
+ export { CelTypeInferenceEngine, TypeInferenceError, TypeInferenceWarning } from './type-inference.js';
13
+ export type { CelTypeInferenceResult, TypeInferenceContext, TypeInferenceMetadata } from './type-inference.js';
14
+ export { ResourceReferenceValidator, ResourceValidationError, ResourceValidationWarning } from './resource-validation.js';
15
+ export type { ResourceValidationResult, ResourceValidationMetadata, ValidationContext } from './resource-validation.js';
16
+ export { CompileTimeTypeChecker, CompileTimeError, CompileTimeWarning } from './compile-time-validation.js';
17
+ export type { CompileTimeValidationResult, CompileTimeTypeInfo, CompileTimeValidationContext, TypeCompatibilityIssue } from './compile-time-validation.js';
18
+ export { DirectFactoryExpressionHandler, KroFactoryExpressionHandler, FactoryPatternHandlerFactory, handleExpressionWithFactoryPattern } from './factory-pattern-handler.js';
19
+ export type { FactoryPatternType, FactoryExpressionHandler } from './factory-pattern-handler.js';
20
+ export { SourceMapBuilder, SourceMapUtils } from './source-map.js';
21
+ export type { SourceMapEntry } from './source-map.js';
22
+ export { CelRuntimeErrorMapper, CelRuntimeErrorUtils } from './runtime-error-mapper.js';
23
+ export type { CelRuntimeError, MappedRuntimeError } from './runtime-error-mapper.js';
24
+ export { MagicAssignableAnalyzer, analyzeMagicAssignable, analyzeMagicAssignableShape } from './magic-assignable-analyzer.js';
25
+ export type { ProcessedMagicAssignable, ProcessedMagicAssignableShape, MagicAssignableAnalysisOptions } from './magic-assignable-analyzer.js';
26
+ export { ExpressionCache, globalExpressionCache } from './cache.js';
27
+ export type { CacheStats, CacheOptions } from './cache.js';
28
+ export { EnhancedTypeOptionalityHandler, analyzeOptionalityRequirements, generateNullSafeCelExpression, handleOptionalChainingWithEnhancedTypes, generateCelWithHasChecks, detectNullSafetyRequirements, integrateWithFieldHydrationTiming, handleUndefinedToDefinedTransitions } from './optionality-handler.js';
29
+ export type { OptionalityAnalysisResult, FieldHydrationState, OptionalityContext, OptionalityHandlingOptions, OptionalChainingPattern, EnhancedTypeFieldInfo, HydrationStateAnalysis, HydrationTransitionPlan, HydrationPhase, HydrationTransitionHandler, HydrationState, UndefinedToDefinedTransitionResult } from './optionality-handler.js';
30
+ export { StatusBuilderAnalyzer, analyzeStatusBuilder, analyzeStatusBuilderForToResourceGraph, analyzeReturnObjectWithMagicProxy, generateStatusContextCel } from './status-builder-analyzer.js';
31
+ export type { StatusBuilderFunction, StatusFieldAnalysisResult, StatusBuilderAnalysisResult, ReturnStatementAnalysis, PropertyAnalysis, StatusBuilderAnalysisOptions, StatusFieldHandlingInfo, StatusHandlingStrategy, StatusFieldCategory, FieldAvailabilityEstimate } from './status-builder-analyzer.js';
32
+ export { ResourceAnalyzer, DependencyTracker, ResourceTypeValidator, analyzeResourceConfig, analyzeFactoryResourceConfig } from './resource-analyzer.js';
33
+ export type { ResourceAnalysisContext, ResourceAnalysisResult, ResourceTypeValidationResult, DependencyInfo, DependencyGraph, DependencyTrackingOptions, CircularDependencyAnalysis, CircularChainAnalysis, CircularDependencyRecommendation, ResourceTypeValidationContext, ResourceTypeInfo, SchemaValidator, SchemaFieldValidationResult, FieldPathValidationResult, TypeCompatibilityValidationResult } from './resource-analyzer.js';
34
+ export { ExpressionContextDetector, contextDetector } from './context-detector.js';
35
+ export type { ExpressionContext, ContextDetectionResult, CelGenerationStrategy, ContextMetadata, ContextDetectionConfig } from './context-detector.js';
36
+ export { LazyAnalyzedExpression, LazyExpressionCollection, OnDemandExpressionAnalyzer, ExpressionTreeAnalyzer, LazyExpressionTreeLoader, MagicProxyLazyIntegration, MemoryOptimizedExpressionManager, ParallelExpressionAnalyzer, ExpressionAnalysisProfiler, OptimizedKubernetesRefDetector, OptimizedExpressionTraverser, ExpressionComplexityAnalyzer, TraversalAction, createLazyExpression, createLazyCollection, shouldUseLazyAnalysis, globalOnDemandAnalyzer, globalTreeAnalyzer, globalLazyTreeLoader, globalMagicProxyIntegration, globalMemoryOptimizedManager, globalParallelAnalyzer, globalExpressionProfiler, globalOptimizedDetector, globalOptimizedTraverser, globalComplexityAnalyzer } from './lazy-analysis.js';
37
+ export type { LazyCollectionStats, ExpressionTreeResult, ExpressionTreeStats, LazyProxyOptions, LazyTreeLoaderStats, MagicProxyIntegrationStats, MemoryOptimizationOptions, MemoryStats, MemoryCleanupResult, ParallelAnalysisStats, AdvancedParallelAnalysisStats, AdaptiveAnalysisOptions, PerformanceProfile, PerformanceStats, TraversalContext, TraversalOptions, TraversalResult, ComplexityThresholds, ComplexityLevel, MemoryImpact, ComplexityMetrics, ComplexityWarning, ComplexityAnalysisResult, ComplexityStats } from './lazy-analysis.js';
38
+ export { ContextAwareCelGenerator, CelGenerationUtils, contextAwareCelGenerator } from './context-aware-generator.js';
39
+ export type { CelGenerationConfig, CelGenerationResult, CelGenerationDebugInfo } from './context-aware-generator.js';
40
+ export { ContextExpressionValidator, ContextValidationUtils, contextValidator } from './context-validator.js';
41
+ export type { ValidationSeverity, ContextValidationRule, ContextValidationConfig, ContextValidationReport, ValidationIssue } from './context-validator.js';
42
+ export { ExpressionContextSwitcher, ContextSwitchingUtils, createContextSwitcher } from './context-switcher.js';
43
+ export type { ContextSwitchingConfig, ContextSwitchingRule, ContextSwitchPoint, ContextSwitchingResult, ContextSwitchingMetrics } from './context-switcher.js';
44
+ export { CelToJavaScriptMigrationHelper, analyzeCelMigrationOpportunities, generateCelMigrationGuide } from './migration-helpers.js';
45
+ export type { MigrationSuggestion, MigrationCategory, MigrationAnalysisResult } from './migration-helpers.js';
46
+ export { FactoryExpressionAnalyzer, factoryExpressionAnalyzer, withExpressionAnalysis, analyzeFactoryConfig, processFactoryValue } from './factory-integration.js';
47
+ export type { FactoryAnalysisConfig, FactoryConfigAnalysisResult, FactoryExpressionContext, ExpressionAnalysisResult, FactoryAnalysisResult } from './factory-integration.js';
48
+ export { MagicProxyDetector, magicProxyDetector, detectMagicProxyRefs, containsMagicProxyRefs, extractMagicProxyRefs, analyzeMagicProxyRefSource } from './magic-proxy-detector.js';
49
+ export type { MagicProxyRefInfo, MagicProxyDetectionResult, MagicProxyDetectionConfig } from './magic-proxy-detector.js';
50
+ export { CelConversionEngine, celConversionEngine, convertToCel, kubernetesRefToCel, needsCelConversion } from './cel-conversion-engine.js';
51
+ export type { CelConversionConfig, CelConversionResult } from './cel-conversion-engine.js';
52
+ export { CompositionExpressionAnalyzer, CompositionIntegrationHooks, CompositionContextTracker, MagicProxyScopeManager, compositionIntegration, compositionUsesKubernetesRefs, getCompositionAnalysis } from './composition-integration.js';
53
+ export type { CompositionAnalysisResult, CompositionPattern, PatternAnalysisConfig, NestedCompositionScope } from './composition-integration.js';
54
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/core/expressions/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAGH,OAAO,EAAE,uBAAuB,EAAE,MAAM,eAAe,CAAC;AACxD,YAAY,EACV,eAAe,EACf,0BAA0B,EAC1B,iBAAiB,EAClB,MAAM,eAAe,CAAC;AAGvB,OAAO,EACL,uBAAuB,EACvB,YAAY,EACZ,eAAe,EACf,mBAAmB,EACnB,qBAAqB,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B,MAAM,uBAAuB,CAAC;AAC/B,YAAY,EACV,sBAAsB,EACtB,oBAAoB,EACpB,kBAAkB,EAClB,sBAAsB,EACtB,uBAAuB,EACxB,MAAM,uBAAuB,CAAC;AAG/B,OAAO,EACL,8BAA8B,EAC9B,gCAAgC,EAChC,yBAAyB,EAC1B,MAAM,wBAAwB,CAAC;AAChC,YAAY,EACV,mBAAmB,EACnB,iBAAiB,EACjB,uBAAuB,EACxB,MAAM,wBAAwB,CAAC;AAGhC,OAAO,EACL,yBAAyB,EACzB,yBAAyB,EACzB,sBAAsB,EACtB,oBAAoB,EACpB,mBAAmB,EACpB,MAAM,0BAA0B,CAAC;AAClC,YAAY,EACV,qBAAqB,EACrB,2BAA2B,EAC3B,wBAAwB,EACxB,wBAAwB,EACxB,qBAAqB,EACtB,MAAM,0BAA0B,CAAC;AAGlC,OAAO,EACL,kBAAkB,EAClB,kBAAkB,EAClB,oBAAoB,EACpB,sBAAsB,EACtB,qBAAqB,EACrB,0BAA0B,EAC3B,MAAM,2BAA2B,CAAC;AACnC,YAAY,EACV,iBAAiB,EACjB,yBAAyB,EACzB,yBAAyB,EAC1B,MAAM,2BAA2B,CAAC;AAGnC,OAAO,EACL,mBAAmB,EACnB,mBAAmB,EACnB,YAAY,EACZ,kBAAkB,EAClB,kBAAkB,EACnB,MAAM,4BAA4B,CAAC;AACpC,YAAY,EACV,mBAAmB,EACnB,mBAAmB,EACpB,MAAM,4BAA4B,CAAC;AAGpC,OAAO,EACL,6BAA6B,EAC7B,2BAA2B,EAC3B,yBAAyB,EACzB,sBAAsB,EACtB,sBAAsB,EACtB,6BAA6B,EAC7B,sBAAsB,EACvB,MAAM,8BAA8B,CAAC;AACtC,YAAY,EACV,yBAAyB,EACzB,kBAAkB,EAClB,qBAAqB,EACrB,sBAAsB,EACvB,MAAM,8BAA8B,CAAC"}
@@ -0,0 +1,50 @@
1
+ /**
2
+ * JavaScript to CEL Expression Analysis and Type Safety Integration
3
+ *
4
+ * This module provides comprehensive type safety integration for JavaScript
5
+ * to CEL expression conversion, including compile-time validation, runtime
6
+ * type inference, and resource reference validation.
7
+ */
8
+ // Core analyzer
9
+ export { JavaScriptToCelAnalyzer } from './analyzer.js';
10
+ // Type safety integration
11
+ export { ExpressionTypeValidator, TypeRegistry, TypeSafetyUtils, TypeValidationError, TypeValidationWarning } from './type-safety.js';
12
+ // Type inference
13
+ export { CelTypeInferenceEngine, TypeInferenceError, TypeInferenceWarning } from './type-inference.js';
14
+ // Resource validation
15
+ export { ResourceReferenceValidator, ResourceValidationError, ResourceValidationWarning } from './resource-validation.js';
16
+ // Compile-time validation
17
+ export { CompileTimeTypeChecker, CompileTimeError, CompileTimeWarning } from './compile-time-validation.js';
18
+ // Factory pattern integration
19
+ export { DirectFactoryExpressionHandler, KroFactoryExpressionHandler, FactoryPatternHandlerFactory, handleExpressionWithFactoryPattern } from './factory-pattern-handler.js';
20
+ // Source mapping and error handling
21
+ export { SourceMapBuilder, SourceMapUtils } from './source-map.js';
22
+ export { CelRuntimeErrorMapper, CelRuntimeErrorUtils } from './runtime-error-mapper.js';
23
+ // MagicAssignable type integration
24
+ export { MagicAssignableAnalyzer, analyzeMagicAssignable, analyzeMagicAssignableShape } from './magic-assignable-analyzer.js';
25
+ // Performance optimization and caching
26
+ export { ExpressionCache, globalExpressionCache } from './cache.js';
27
+ // Enhanced Type Optionality Support
28
+ export { EnhancedTypeOptionalityHandler, analyzeOptionalityRequirements, generateNullSafeCelExpression, handleOptionalChainingWithEnhancedTypes, generateCelWithHasChecks, detectNullSafetyRequirements, integrateWithFieldHydrationTiming, handleUndefinedToDefinedTransitions } from './optionality-handler.js';
29
+ // Status Builder Analysis
30
+ export { StatusBuilderAnalyzer, analyzeStatusBuilder, analyzeStatusBuilderForToResourceGraph, analyzeReturnObjectWithMagicProxy, generateStatusContextCel } from './status-builder-analyzer.js';
31
+ // Resource Builder Integration
32
+ export { ResourceAnalyzer, DependencyTracker, ResourceTypeValidator, analyzeResourceConfig, analyzeFactoryResourceConfig } from './resource-analyzer.js';
33
+ // Context-Aware Conversion
34
+ export { ExpressionContextDetector, contextDetector } from './context-detector.js';
35
+ // Lazy Analysis Support
36
+ export { LazyAnalyzedExpression, LazyExpressionCollection, OnDemandExpressionAnalyzer, ExpressionTreeAnalyzer, LazyExpressionTreeLoader, MagicProxyLazyIntegration, MemoryOptimizedExpressionManager, ParallelExpressionAnalyzer, ExpressionAnalysisProfiler, OptimizedKubernetesRefDetector, OptimizedExpressionTraverser, ExpressionComplexityAnalyzer, TraversalAction, createLazyExpression, createLazyCollection, shouldUseLazyAnalysis, globalOnDemandAnalyzer, globalTreeAnalyzer, globalLazyTreeLoader, globalMagicProxyIntegration, globalMemoryOptimizedManager, globalParallelAnalyzer, globalExpressionProfiler, globalOptimizedDetector, globalOptimizedTraverser, globalComplexityAnalyzer } from './lazy-analysis.js';
37
+ export { ContextAwareCelGenerator, CelGenerationUtils, contextAwareCelGenerator } from './context-aware-generator.js';
38
+ export { ContextExpressionValidator, ContextValidationUtils, contextValidator } from './context-validator.js';
39
+ export { ExpressionContextSwitcher, ContextSwitchingUtils, createContextSwitcher } from './context-switcher.js';
40
+ // Migration helpers
41
+ export { CelToJavaScriptMigrationHelper, analyzeCelMigrationOpportunities, generateCelMigrationGuide } from './migration-helpers.js';
42
+ // Factory integration
43
+ export { FactoryExpressionAnalyzer, factoryExpressionAnalyzer, withExpressionAnalysis, analyzeFactoryConfig, processFactoryValue } from './factory-integration.js';
44
+ // Magic proxy detection
45
+ export { MagicProxyDetector, magicProxyDetector, detectMagicProxyRefs, containsMagicProxyRefs, extractMagicProxyRefs, analyzeMagicProxyRefSource } from './magic-proxy-detector.js';
46
+ // CEL conversion engine
47
+ export { CelConversionEngine, celConversionEngine, convertToCel, kubernetesRefToCel, needsCelConversion } from './cel-conversion-engine.js';
48
+ // Composition integration
49
+ export { CompositionExpressionAnalyzer, CompositionIntegrationHooks, CompositionContextTracker, MagicProxyScopeManager, compositionIntegration, compositionUsesKubernetesRefs, getCompositionAnalysis } from './composition-integration.js';
50
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/core/expressions/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,gBAAgB;AAChB,OAAO,EAAE,uBAAuB,EAAE,MAAM,eAAe,CAAC;AAOxD,0BAA0B;AAC1B,OAAO,EACL,uBAAuB,EACvB,YAAY,EACZ,eAAe,EACf,mBAAmB,EACnB,qBAAqB,EACtB,MAAM,kBAAkB,CAAC;AAM1B,iBAAiB;AACjB,OAAO,EACL,sBAAsB,EACtB,kBAAkB,EAClB,oBAAoB,EACrB,MAAM,qBAAqB,CAAC;AAO7B,sBAAsB;AACtB,OAAO,EACL,0BAA0B,EAC1B,uBAAuB,EACvB,yBAAyB,EAC1B,MAAM,0BAA0B,CAAC;AAOlC,0BAA0B;AAC1B,OAAO,EACL,sBAAsB,EACtB,gBAAgB,EAChB,kBAAkB,EACnB,MAAM,8BAA8B,CAAC;AAQtC,8BAA8B;AAC9B,OAAO,EACL,8BAA8B,EAC9B,2BAA2B,EAC3B,4BAA4B,EAC5B,kCAAkC,EACnC,MAAM,8BAA8B,CAAC;AAMtC,oCAAoC;AACpC,OAAO,EAAE,gBAAgB,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AAGnE,OAAO,EAAE,qBAAqB,EAAE,oBAAoB,EAAE,MAAM,2BAA2B,CAAC;AAMxF,mCAAmC;AACnC,OAAO,EACL,uBAAuB,EACvB,sBAAsB,EACtB,2BAA2B,EAC5B,MAAM,gCAAgC,CAAC;AAOxC,uCAAuC;AACvC,OAAO,EAAE,eAAe,EAAE,qBAAqB,EAAE,MAAM,YAAY,CAAC;AAMpE,oCAAoC;AACpC,OAAO,EACL,8BAA8B,EAC9B,8BAA8B,EAC9B,6BAA6B,EAC7B,uCAAuC,EACvC,wBAAwB,EACxB,4BAA4B,EAC5B,iCAAiC,EACjC,mCAAmC,EACpC,MAAM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