typekro 0.28.0 → 0.29.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 (674) hide show
  1. package/dist/.tsbuildinfo +1 -1
  2. package/dist/advanced/index.d.ts +5 -1
  3. package/dist/advanced/index.d.ts.map +1 -1
  4. package/dist/advanced/index.js +2 -3
  5. package/dist/advanced/index.js.map +1 -1
  6. package/dist/alchemy/deployers.d.ts +6 -4
  7. package/dist/alchemy/deployers.d.ts.map +1 -1
  8. package/dist/alchemy/deployers.js +46 -9
  9. package/dist/alchemy/deployers.js.map +1 -1
  10. package/dist/alchemy/index.d.ts +2 -3
  11. package/dist/alchemy/index.d.ts.map +1 -1
  12. package/dist/alchemy/index.js +1 -1
  13. package/dist/alchemy/index.js.map +1 -1
  14. package/dist/alchemy/kro-delete.d.ts +6 -5
  15. package/dist/alchemy/kro-delete.d.ts.map +1 -1
  16. package/dist/alchemy/kro-delete.js +169 -22
  17. package/dist/alchemy/kro-delete.js.map +1 -1
  18. package/dist/alchemy/resource-registration.d.ts +24 -31
  19. package/dist/alchemy/resource-registration.d.ts.map +1 -1
  20. package/dist/alchemy/resource-registration.js +439 -75
  21. package/dist/alchemy/resource-registration.js.map +1 -1
  22. package/dist/alchemy/types.d.ts +56 -14
  23. package/dist/alchemy/types.d.ts.map +1 -1
  24. package/dist/alchemy/utilities.d.ts +2 -2
  25. package/dist/alchemy/utilities.d.ts.map +1 -1
  26. package/dist/compositions/typekro-runtime/typekro-runtime.d.ts.map +1 -1
  27. package/dist/compositions/typekro-runtime/typekro-runtime.js +31 -28
  28. package/dist/compositions/typekro-runtime/typekro-runtime.js.map +1 -1
  29. package/dist/compositions/typekro-runtime/types.d.ts +12 -0
  30. package/dist/compositions/typekro-runtime/types.d.ts.map +1 -1
  31. package/dist/core/composition/analysis-metadata.d.ts +15 -0
  32. package/dist/core/composition/analysis-metadata.d.ts.map +1 -0
  33. package/dist/core/composition/analysis-metadata.js +20 -0
  34. package/dist/core/composition/analysis-metadata.js.map +1 -0
  35. package/dist/core/composition/imperative.d.ts.map +1 -1
  36. package/dist/core/composition/imperative.js +38 -9
  37. package/dist/core/composition/imperative.js.map +1 -1
  38. package/dist/core/composition/nested-status-cel.js +3 -3
  39. package/dist/core/composition/nested-status-cel.js.map +1 -1
  40. package/dist/core/constants/brands.d.ts +1 -1
  41. package/dist/core/constants/brands.d.ts.map +1 -1
  42. package/dist/core/constants/brands.js +1 -1
  43. package/dist/core/constants/brands.js.map +1 -1
  44. package/dist/core/dependencies/resolver.d.ts +3 -1
  45. package/dist/core/dependencies/resolver.d.ts.map +1 -1
  46. package/dist/core/dependencies/resolver.js +29 -13
  47. package/dist/core/dependencies/resolver.js.map +1 -1
  48. package/dist/core/deployment/deletion-result.d.ts +22 -0
  49. package/dist/core/deployment/deletion-result.d.ts.map +1 -0
  50. package/dist/core/deployment/deletion-result.js +108 -0
  51. package/dist/core/deployment/deletion-result.js.map +1 -0
  52. package/dist/core/deployment/deployment-state-discovery.d.ts +1 -0
  53. package/dist/core/deployment/deployment-state-discovery.d.ts.map +1 -1
  54. package/dist/core/deployment/deployment-state-discovery.js +89 -9
  55. package/dist/core/deployment/deployment-state-discovery.js.map +1 -1
  56. package/dist/core/deployment/direct-factory.d.ts +46 -25
  57. package/dist/core/deployment/direct-factory.d.ts.map +1 -1
  58. package/dist/core/deployment/direct-factory.js +536 -126
  59. package/dist/core/deployment/direct-factory.js.map +1 -1
  60. package/dist/core/deployment/engine.d.ts +4 -1
  61. package/dist/core/deployment/engine.d.ts.map +1 -1
  62. package/dist/core/deployment/engine.js +105 -34
  63. package/dist/core/deployment/engine.js.map +1 -1
  64. package/dist/core/deployment/errors.d.ts +20 -1
  65. package/dist/core/deployment/errors.d.ts.map +1 -1
  66. package/dist/core/deployment/errors.js +55 -0
  67. package/dist/core/deployment/errors.js.map +1 -1
  68. package/dist/core/deployment/event-monitor.d.ts +4 -3
  69. package/dist/core/deployment/event-monitor.d.ts.map +1 -1
  70. package/dist/core/deployment/event-monitor.js +17 -5
  71. package/dist/core/deployment/event-monitor.js.map +1 -1
  72. package/dist/core/deployment/index.d.ts +1 -1
  73. package/dist/core/deployment/index.d.ts.map +1 -1
  74. package/dist/core/deployment/index.js +1 -1
  75. package/dist/core/deployment/index.js.map +1 -1
  76. package/dist/core/deployment/k8s-helpers.d.ts +1 -1
  77. package/dist/core/deployment/k8s-helpers.d.ts.map +1 -1
  78. package/dist/core/deployment/k8s-helpers.js +11 -5
  79. package/dist/core/deployment/k8s-helpers.js.map +1 -1
  80. package/dist/core/deployment/kro-factory.d.ts +54 -30
  81. package/dist/core/deployment/kro-factory.d.ts.map +1 -1
  82. package/dist/core/deployment/kro-factory.js +2002 -259
  83. package/dist/core/deployment/kro-factory.js.map +1 -1
  84. package/dist/core/deployment/kro-instance-admission.d.ts +17 -0
  85. package/dist/core/deployment/kro-instance-admission.d.ts.map +1 -0
  86. package/dist/core/deployment/kro-instance-admission.js +73 -0
  87. package/dist/core/deployment/kro-instance-admission.js.map +1 -0
  88. package/dist/core/deployment/kro-instance-safety.d.ts +0 -3
  89. package/dist/core/deployment/kro-instance-safety.d.ts.map +1 -1
  90. package/dist/core/deployment/kro-instance-safety.js +0 -11
  91. package/dist/core/deployment/kro-instance-safety.js.map +1 -1
  92. package/dist/core/deployment/kro-namespace-teardown.d.ts +63 -5
  93. package/dist/core/deployment/kro-namespace-teardown.d.ts.map +1 -1
  94. package/dist/core/deployment/kro-namespace-teardown.js +124 -12
  95. package/dist/core/deployment/kro-namespace-teardown.js.map +1 -1
  96. package/dist/core/deployment/kro-readiness.d.ts +2 -0
  97. package/dist/core/deployment/kro-readiness.d.ts.map +1 -1
  98. package/dist/core/deployment/kro-readiness.js +50 -8
  99. package/dist/core/deployment/kro-readiness.js.map +1 -1
  100. package/dist/core/deployment/poll-timeout.d.ts +45 -0
  101. package/dist/core/deployment/poll-timeout.d.ts.map +1 -0
  102. package/dist/core/deployment/poll-timeout.js +78 -0
  103. package/dist/core/deployment/poll-timeout.js.map +1 -0
  104. package/dist/core/deployment/readiness.d.ts.map +1 -1
  105. package/dist/core/deployment/readiness.js +30 -21
  106. package/dist/core/deployment/readiness.js.map +1 -1
  107. package/dist/core/deployment/resource-applier.d.ts +19 -3
  108. package/dist/core/deployment/resource-applier.d.ts.map +1 -1
  109. package/dist/core/deployment/resource-applier.js +263 -44
  110. package/dist/core/deployment/resource-applier.js.map +1 -1
  111. package/dist/core/deployment/rollback-manager.d.ts +6 -1
  112. package/dist/core/deployment/rollback-manager.d.ts.map +1 -1
  113. package/dist/core/deployment/rollback-manager.js +38 -12
  114. package/dist/core/deployment/rollback-manager.js.map +1 -1
  115. package/dist/core/deployment/schema-cel-evaluator.d.ts.map +1 -1
  116. package/dist/core/deployment/schema-cel-evaluator.js +63 -0
  117. package/dist/core/deployment/schema-cel-evaluator.js.map +1 -1
  118. package/dist/core/deployment/shared-utilities.d.ts +11 -6
  119. package/dist/core/deployment/shared-utilities.d.ts.map +1 -1
  120. package/dist/core/deployment/shared-utilities.js +169 -14
  121. package/dist/core/deployment/shared-utilities.js.map +1 -1
  122. package/dist/core/deployment/singleton-gitops.d.ts.map +1 -1
  123. package/dist/core/deployment/singleton-gitops.js +0 -2
  124. package/dist/core/deployment/singleton-gitops.js.map +1 -1
  125. package/dist/core/deployment/singleton-owner-drift.d.ts +11 -2
  126. package/dist/core/deployment/singleton-owner-drift.d.ts.map +1 -1
  127. package/dist/core/deployment/singleton-owner-drift.js +30 -13
  128. package/dist/core/deployment/singleton-owner-drift.js.map +1 -1
  129. package/dist/core/deployment/strategies/base-strategy.d.ts +2 -0
  130. package/dist/core/deployment/strategies/base-strategy.d.ts.map +1 -1
  131. package/dist/core/deployment/strategies/base-strategy.js +19 -2
  132. package/dist/core/deployment/strategies/base-strategy.js.map +1 -1
  133. package/dist/core/deployment/strategies/direct-strategy.d.ts +3 -0
  134. package/dist/core/deployment/strategies/direct-strategy.d.ts.map +1 -1
  135. package/dist/core/deployment/strategies/direct-strategy.js +31 -8
  136. package/dist/core/deployment/strategies/direct-strategy.js.map +1 -1
  137. package/dist/core/deployment/strategies/index.d.ts +1 -1
  138. package/dist/core/deployment/strategies/index.d.ts.map +1 -1
  139. package/dist/core/deployment/strategies/index.js +1 -1
  140. package/dist/core/deployment/strategies/index.js.map +1 -1
  141. package/dist/core/errors.d.ts +2 -2
  142. package/dist/core/errors.d.ts.map +1 -1
  143. package/dist/core/errors.js.map +1 -1
  144. package/dist/core/expressions/analysis/cel-emitter.d.ts.map +1 -1
  145. package/dist/core/expressions/analysis/cel-emitter.js +17 -13
  146. package/dist/core/expressions/analysis/cel-emitter.js.map +1 -1
  147. package/dist/core/expressions/analysis/expression-metadata.d.ts +15 -0
  148. package/dist/core/expressions/analysis/expression-metadata.d.ts.map +1 -0
  149. package/dist/core/expressions/analysis/expression-metadata.js +10 -0
  150. package/dist/core/expressions/analysis/expression-metadata.js.map +1 -0
  151. package/dist/core/expressions/analysis/ready-when.d.ts +3 -0
  152. package/dist/core/expressions/analysis/ready-when.d.ts.map +1 -0
  153. package/dist/core/expressions/analysis/ready-when.js +127 -0
  154. package/dist/core/expressions/analysis/ready-when.js.map +1 -0
  155. package/dist/core/expressions/composition/composition-analyzer-helpers.d.ts +3 -2
  156. package/dist/core/expressions/composition/composition-analyzer-helpers.d.ts.map +1 -1
  157. package/dist/core/expressions/composition/composition-analyzer-helpers.js +6 -4
  158. package/dist/core/expressions/composition/composition-analyzer-helpers.js.map +1 -1
  159. package/dist/core/expressions/composition/composition-analyzer-ternary.d.ts +3 -2
  160. package/dist/core/expressions/composition/composition-analyzer-ternary.d.ts.map +1 -1
  161. package/dist/core/expressions/composition/composition-analyzer-ternary.js +12 -12
  162. package/dist/core/expressions/composition/composition-analyzer-ternary.js.map +1 -1
  163. package/dist/core/expressions/composition/composition-analyzer-traversal.d.ts.map +1 -1
  164. package/dist/core/expressions/composition/composition-analyzer-traversal.js +68 -4
  165. package/dist/core/expressions/composition/composition-analyzer-traversal.js.map +1 -1
  166. package/dist/core/expressions/composition/composition-analyzer-types.d.ts +2 -0
  167. package/dist/core/expressions/composition/composition-analyzer-types.d.ts.map +1 -1
  168. package/dist/core/expressions/composition/composition-analyzer.d.ts.map +1 -1
  169. package/dist/core/expressions/composition/composition-analyzer.js +2 -0
  170. package/dist/core/expressions/composition/composition-analyzer.js.map +1 -1
  171. package/dist/core/expressions/factory/status-builder-analyzer.d.ts.map +1 -1
  172. package/dist/core/expressions/factory/status-builder-analyzer.js +14 -1
  173. package/dist/core/expressions/factory/status-builder-analyzer.js.map +1 -1
  174. package/dist/core/kubernetes/api.d.ts.map +1 -1
  175. package/dist/core/kubernetes/api.js +2 -3
  176. package/dist/core/kubernetes/api.js.map +1 -1
  177. package/dist/core/kubernetes/bun-api-client.d.ts +1 -1
  178. package/dist/core/kubernetes/bun-api-client.d.ts.map +1 -1
  179. package/dist/core/kubernetes/bun-api-client.js +17 -17
  180. package/dist/core/kubernetes/bun-api-client.js.map +1 -1
  181. package/dist/core/kubernetes/bun-http-library.d.ts +16 -0
  182. package/dist/core/kubernetes/bun-http-library.d.ts.map +1 -1
  183. package/dist/core/kubernetes/bun-http-library.js +7 -1
  184. package/dist/core/kubernetes/bun-http-library.js.map +1 -1
  185. package/dist/core/kubernetes/bun-watch.d.ts +30 -0
  186. package/dist/core/kubernetes/bun-watch.d.ts.map +1 -0
  187. package/dist/core/kubernetes/bun-watch.js +144 -0
  188. package/dist/core/kubernetes/bun-watch.js.map +1 -0
  189. package/dist/core/kubernetes/client-node-runtime.d.ts +10 -0
  190. package/dist/core/kubernetes/client-node-runtime.d.ts.map +1 -0
  191. package/dist/core/kubernetes/client-node-runtime.js +15 -0
  192. package/dist/core/kubernetes/client-node-runtime.js.map +1 -0
  193. package/dist/core/kubernetes/client-provider.d.ts +21 -1
  194. package/dist/core/kubernetes/client-provider.d.ts.map +1 -1
  195. package/dist/core/kubernetes/client-provider.js +10 -10
  196. package/dist/core/kubernetes/client-provider.js.map +1 -1
  197. package/dist/core/kubernetes/index.d.ts +1 -1
  198. package/dist/core/kubernetes/index.d.ts.map +1 -1
  199. package/dist/core/kubernetes/index.js.map +1 -1
  200. package/dist/core/metadata/resource-metadata.d.ts +24 -1
  201. package/dist/core/metadata/resource-metadata.d.ts.map +1 -1
  202. package/dist/core/metadata/resource-metadata.js +8 -4
  203. package/dist/core/metadata/resource-metadata.js.map +1 -1
  204. package/dist/core/planning/artifact-codec.d.ts +14 -0
  205. package/dist/core/planning/artifact-codec.d.ts.map +1 -0
  206. package/dist/core/planning/artifact-codec.js +329 -0
  207. package/dist/core/planning/artifact-codec.js.map +1 -0
  208. package/dist/core/planning/artifacts.d.ts +212 -0
  209. package/dist/core/planning/artifacts.d.ts.map +1 -0
  210. package/dist/core/planning/artifacts.js +5 -0
  211. package/dist/core/planning/artifacts.js.map +1 -0
  212. package/dist/core/planning/aspects.d.ts +11 -0
  213. package/dist/core/planning/aspects.d.ts.map +1 -0
  214. package/dist/core/planning/aspects.js +77 -0
  215. package/dist/core/planning/aspects.js.map +1 -0
  216. package/dist/core/planning/canonical.d.ts +10 -0
  217. package/dist/core/planning/canonical.d.ts.map +1 -0
  218. package/dist/core/planning/canonical.js +54 -0
  219. package/dist/core/planning/canonical.js.map +1 -0
  220. package/dist/core/planning/capabilities.d.ts +16 -0
  221. package/dist/core/planning/capabilities.d.ts.map +1 -0
  222. package/dist/core/planning/capabilities.js +90 -0
  223. package/dist/core/planning/capabilities.js.map +1 -0
  224. package/dist/core/planning/capture.d.ts +29 -0
  225. package/dist/core/planning/capture.d.ts.map +1 -0
  226. package/dist/core/planning/capture.js +18 -0
  227. package/dist/core/planning/capture.js.map +1 -0
  228. package/dist/core/planning/compiler.d.ts +12 -0
  229. package/dist/core/planning/compiler.d.ts.map +1 -0
  230. package/dist/core/planning/compiler.js +631 -0
  231. package/dist/core/planning/compiler.js.map +1 -0
  232. package/dist/core/planning/direct-runtime-adapter.d.ts +39 -0
  233. package/dist/core/planning/direct-runtime-adapter.d.ts.map +1 -0
  234. package/dist/core/planning/direct-runtime-adapter.js +238 -0
  235. package/dist/core/planning/direct-runtime-adapter.js.map +1 -0
  236. package/dist/core/planning/execution-record.d.ts +21 -0
  237. package/dist/core/planning/execution-record.d.ts.map +1 -0
  238. package/dist/core/planning/execution-record.js +304 -0
  239. package/dist/core/planning/execution-record.js.map +1 -0
  240. package/dist/core/planning/index.d.ts +20 -0
  241. package/dist/core/planning/index.d.ts.map +1 -0
  242. package/dist/core/planning/index.js +18 -0
  243. package/dist/core/planning/index.js.map +1 -0
  244. package/dist/core/planning/kro-bundle.d.ts +24 -0
  245. package/dist/core/planning/kro-bundle.d.ts.map +1 -0
  246. package/dist/core/planning/kro-bundle.js +314 -0
  247. package/dist/core/planning/kro-bundle.js.map +1 -0
  248. package/dist/core/planning/kro-runtime-adapter.d.ts +28 -0
  249. package/dist/core/planning/kro-runtime-adapter.d.ts.map +1 -0
  250. package/dist/core/planning/kro-runtime-adapter.js +211 -0
  251. package/dist/core/planning/kro-runtime-adapter.js.map +1 -0
  252. package/dist/core/planning/materialization.d.ts +54 -0
  253. package/dist/core/planning/materialization.d.ts.map +1 -0
  254. package/dist/core/planning/materialization.js +489 -0
  255. package/dist/core/planning/materialization.js.map +1 -0
  256. package/dist/core/planning/plan-codec.d.ts +11 -0
  257. package/dist/core/planning/plan-codec.d.ts.map +1 -0
  258. package/dist/core/planning/plan-codec.js +555 -0
  259. package/dist/core/planning/plan-codec.js.map +1 -0
  260. package/dist/core/planning/planner.d.ts +21 -0
  261. package/dist/core/planning/planner.d.ts.map +1 -0
  262. package/dist/core/planning/planner.js +1518 -0
  263. package/dist/core/planning/planner.js.map +1 -0
  264. package/dist/core/planning/schema.d.ts +10 -0
  265. package/dist/core/planning/schema.d.ts.map +1 -0
  266. package/dist/core/planning/schema.js +159 -0
  267. package/dist/core/planning/schema.js.map +1 -0
  268. package/dist/core/planning/types.d.ts +441 -0
  269. package/dist/core/planning/types.d.ts.map +1 -0
  270. package/dist/core/planning/types.js +3 -0
  271. package/dist/core/planning/types.js.map +1 -0
  272. package/dist/core/planning/values.d.ts +76 -0
  273. package/dist/core/planning/values.d.ts.map +1 -0
  274. package/dist/core/planning/values.js +852 -0
  275. package/dist/core/planning/values.js.map +1 -0
  276. package/dist/core/proxy/create-resource.d.ts +12 -0
  277. package/dist/core/proxy/create-resource.d.ts.map +1 -1
  278. package/dist/core/proxy/create-resource.js +39 -9
  279. package/dist/core/proxy/create-resource.js.map +1 -1
  280. package/dist/core/readiness/evaluator-factories.d.ts +3 -1
  281. package/dist/core/readiness/evaluator-factories.d.ts.map +1 -1
  282. package/dist/core/readiness/evaluator-factories.js +130 -5
  283. package/dist/core/readiness/evaluator-factories.js.map +1 -1
  284. package/dist/core/readiness/index.d.ts +2 -1
  285. package/dist/core/readiness/index.d.ts.map +1 -1
  286. package/dist/core/readiness/index.js +2 -1
  287. package/dist/core/readiness/index.js.map +1 -1
  288. package/dist/core/readiness/portable-strategies.d.ts +28 -0
  289. package/dist/core/readiness/portable-strategies.d.ts.map +1 -0
  290. package/dist/core/readiness/portable-strategies.js +55 -0
  291. package/dist/core/readiness/portable-strategies.js.map +1 -0
  292. package/dist/core/readiness/strategy-configuration.d.ts +12 -0
  293. package/dist/core/readiness/strategy-configuration.d.ts.map +1 -0
  294. package/dist/core/readiness/strategy-configuration.js +51 -0
  295. package/dist/core/readiness/strategy-configuration.js.map +1 -0
  296. package/dist/core/references/cel-evaluator.d.ts +5 -0
  297. package/dist/core/references/cel-evaluator.d.ts.map +1 -1
  298. package/dist/core/references/cel-evaluator.js +33 -2
  299. package/dist/core/references/cel-evaluator.js.map +1 -1
  300. package/dist/core/references/external-refs.d.ts +2 -0
  301. package/dist/core/references/external-refs.d.ts.map +1 -1
  302. package/dist/core/references/external-refs.js +3 -1
  303. package/dist/core/references/external-refs.js.map +1 -1
  304. package/dist/core/references/resolver.d.ts +7 -1
  305. package/dist/core/references/resolver.d.ts.map +1 -1
  306. package/dist/core/references/resolver.js +91 -9
  307. package/dist/core/references/resolver.js.map +1 -1
  308. package/dist/core/references/schema-proxy.d.ts.map +1 -1
  309. package/dist/core/references/schema-proxy.js +35 -21
  310. package/dist/core/references/schema-proxy.js.map +1 -1
  311. package/dist/core/resources/factory-registry.d.ts +64 -2
  312. package/dist/core/resources/factory-registry.d.ts.map +1 -1
  313. package/dist/core/resources/factory-registry.js +74 -3
  314. package/dist/core/resources/factory-registry.js.map +1 -1
  315. package/dist/core/resources/index.d.ts +3 -2
  316. package/dist/core/resources/index.d.ts.map +1 -1
  317. package/dist/core/resources/index.js +2 -1
  318. package/dist/core/resources/index.js.map +1 -1
  319. package/dist/core/resources/live-comparison.d.ts +58 -0
  320. package/dist/core/resources/live-comparison.d.ts.map +1 -0
  321. package/dist/core/resources/live-comparison.js +293 -0
  322. package/dist/core/resources/live-comparison.js.map +1 -0
  323. package/dist/core/runtime/standalone-operation.d.ts +12 -0
  324. package/dist/core/runtime/standalone-operation.d.ts.map +1 -0
  325. package/dist/core/runtime/standalone-operation.js +62 -0
  326. package/dist/core/runtime/standalone-operation.js.map +1 -0
  327. package/dist/core/serialization/cel-references.d.ts.map +1 -1
  328. package/dist/core/serialization/cel-references.js +11 -1
  329. package/dist/core/serialization/cel-references.js.map +1 -1
  330. package/dist/core/serialization/core.d.ts.map +1 -1
  331. package/dist/core/serialization/core.js +277 -182
  332. package/dist/core/serialization/core.js.map +1 -1
  333. package/dist/core/serialization/schema.d.ts.map +1 -1
  334. package/dist/core/serialization/schema.js +3 -3
  335. package/dist/core/serialization/schema.js.map +1 -1
  336. package/dist/core/serialization/status-analysis-pipeline.d.ts +1 -1
  337. package/dist/core/serialization/status-analysis-pipeline.d.ts.map +1 -1
  338. package/dist/core/serialization/status-analysis-pipeline.js +14 -11
  339. package/dist/core/serialization/status-analysis-pipeline.js.map +1 -1
  340. package/dist/core/serialization/yaml.d.ts +5 -1
  341. package/dist/core/serialization/yaml.d.ts.map +1 -1
  342. package/dist/core/serialization/yaml.js +35 -182
  343. package/dist/core/serialization/yaml.js.map +1 -1
  344. package/dist/core/types/deployment.d.ts +135 -14
  345. package/dist/core/types/deployment.d.ts.map +1 -1
  346. package/dist/core/types/kubernetes.d.ts +3 -0
  347. package/dist/core/types/kubernetes.d.ts.map +1 -1
  348. package/dist/core/types/resource-graph.d.ts +7 -1
  349. package/dist/core/types/resource-graph.d.ts.map +1 -1
  350. package/dist/core/types/serialization.d.ts +8 -1
  351. package/dist/core/types/serialization.d.ts.map +1 -1
  352. package/dist/core/validation/cel-validator.d.ts.map +1 -1
  353. package/dist/core/validation/cel-validator.js +25 -16
  354. package/dist/core/validation/cel-validator.js.map +1 -1
  355. package/dist/experimental-planning.d.ts +13 -0
  356. package/dist/experimental-planning.d.ts.map +1 -0
  357. package/dist/experimental-planning.js +12 -0
  358. package/dist/experimental-planning.js.map +1 -0
  359. package/dist/factories/apisix/compositions/apisix-bootstrap.d.ts.map +1 -1
  360. package/dist/factories/apisix/compositions/apisix-bootstrap.js +27 -22
  361. package/dist/factories/apisix/compositions/apisix-bootstrap.js.map +1 -1
  362. package/dist/factories/apisix/compositions/apisix-helm-repository.d.ts +15 -0
  363. package/dist/factories/apisix/compositions/apisix-helm-repository.d.ts.map +1 -0
  364. package/dist/factories/apisix/compositions/apisix-helm-repository.js +28 -0
  365. package/dist/factories/apisix/compositions/apisix-helm-repository.js.map +1 -0
  366. package/dist/factories/apisix/compositions/index.d.ts +1 -0
  367. package/dist/factories/apisix/compositions/index.d.ts.map +1 -1
  368. package/dist/factories/apisix/compositions/index.js +1 -0
  369. package/dist/factories/apisix/compositions/index.js.map +1 -1
  370. package/dist/factories/apisix/types.d.ts +22 -0
  371. package/dist/factories/apisix/types.d.ts.map +1 -1
  372. package/dist/factories/apisix/types.js +16 -0
  373. package/dist/factories/apisix/types.js.map +1 -1
  374. package/dist/factories/apisix/utils/admin-credentials.d.ts +1 -0
  375. package/dist/factories/apisix/utils/admin-credentials.d.ts.map +1 -1
  376. package/dist/factories/apisix/utils/admin-credentials.js +5 -4
  377. package/dist/factories/apisix/utils/admin-credentials.js.map +1 -1
  378. package/dist/factories/caddy/compositions/caddy-ingress.d.ts.map +1 -1
  379. package/dist/factories/caddy/compositions/caddy-ingress.js +9 -2
  380. package/dist/factories/caddy/compositions/caddy-ingress.js.map +1 -1
  381. package/dist/factories/cert-manager/compositions/cert-manager-bootstrap.d.ts.map +1 -1
  382. package/dist/factories/cert-manager/compositions/cert-manager-bootstrap.js +11 -25
  383. package/dist/factories/cert-manager/compositions/cert-manager-bootstrap.js.map +1 -1
  384. package/dist/factories/cert-manager/resources/certificates.d.ts.map +1 -1
  385. package/dist/factories/cert-manager/resources/certificates.js +2 -1
  386. package/dist/factories/cert-manager/resources/certificates.js.map +1 -1
  387. package/dist/factories/cert-manager/resources/challenges.d.ts.map +1 -1
  388. package/dist/factories/cert-manager/resources/challenges.js +3 -0
  389. package/dist/factories/cert-manager/resources/challenges.js.map +1 -1
  390. package/dist/factories/cilium/compositions/cilium-bootstrap.d.ts +4 -4
  391. package/dist/factories/cilium/resources/gateway.d.ts.map +1 -1
  392. package/dist/factories/cilium/resources/gateway.js +13 -12
  393. package/dist/factories/cilium/resources/gateway.js.map +1 -1
  394. package/dist/factories/cilium/resources/networking.d.ts.map +1 -1
  395. package/dist/factories/cilium/resources/networking.js +9 -0
  396. package/dist/factories/cilium/resources/networking.js.map +1 -1
  397. package/dist/factories/clickhouse/compositions/clickhouse-operator-bootstrap.d.ts +2 -1
  398. package/dist/factories/clickhouse/compositions/clickhouse-operator-bootstrap.d.ts.map +1 -1
  399. package/dist/factories/clickhouse/compositions/clickhouse-operator-bootstrap.js +2 -6
  400. package/dist/factories/clickhouse/compositions/clickhouse-operator-bootstrap.js.map +1 -1
  401. package/dist/factories/clickhouse/resources/installation.d.ts.map +1 -1
  402. package/dist/factories/clickhouse/resources/installation.js +2 -0
  403. package/dist/factories/clickhouse/resources/installation.js.map +1 -1
  404. package/dist/factories/clickhouse/resources/keeper.d.ts.map +1 -1
  405. package/dist/factories/clickhouse/resources/keeper.js +2 -0
  406. package/dist/factories/clickhouse/resources/keeper.js.map +1 -1
  407. package/dist/factories/clickhouse/types.d.ts +5 -2
  408. package/dist/factories/clickhouse/types.d.ts.map +1 -1
  409. package/dist/factories/clickhouse/types.js +2 -1
  410. package/dist/factories/clickhouse/types.js.map +1 -1
  411. package/dist/factories/clickstack/compositions/k8s-telemetry.d.ts +4 -2
  412. package/dist/factories/clickstack/compositions/k8s-telemetry.d.ts.map +1 -1
  413. package/dist/factories/clickstack/compositions/k8s-telemetry.js +2 -5
  414. package/dist/factories/clickstack/compositions/k8s-telemetry.js.map +1 -1
  415. package/dist/factories/clickstack/types.d.ts +2 -1
  416. package/dist/factories/clickstack/types.d.ts.map +1 -1
  417. package/dist/factories/clickstack/types.js +3 -1
  418. package/dist/factories/clickstack/types.js.map +1 -1
  419. package/dist/factories/cnpg/compositions/cnpg-bootstrap.d.ts +2 -1
  420. package/dist/factories/cnpg/compositions/cnpg-bootstrap.d.ts.map +1 -1
  421. package/dist/factories/cnpg/compositions/cnpg-bootstrap.js +3 -8
  422. package/dist/factories/cnpg/compositions/cnpg-bootstrap.js.map +1 -1
  423. package/dist/factories/cnpg/resources/backup.d.ts.map +1 -1
  424. package/dist/factories/cnpg/resources/backup.js +2 -0
  425. package/dist/factories/cnpg/resources/backup.js.map +1 -1
  426. package/dist/factories/cnpg/resources/cluster.d.ts.map +1 -1
  427. package/dist/factories/cnpg/resources/cluster.js +2 -1
  428. package/dist/factories/cnpg/resources/cluster.js.map +1 -1
  429. package/dist/factories/cnpg/resources/pooler.d.ts.map +1 -1
  430. package/dist/factories/cnpg/resources/pooler.js +2 -0
  431. package/dist/factories/cnpg/resources/pooler.js.map +1 -1
  432. package/dist/factories/cnpg/resources/scheduled-backup.d.ts.map +1 -1
  433. package/dist/factories/cnpg/resources/scheduled-backup.js +2 -1
  434. package/dist/factories/cnpg/resources/scheduled-backup.js.map +1 -1
  435. package/dist/factories/cnpg/types.d.ts +6 -3
  436. package/dist/factories/cnpg/types.d.ts.map +1 -1
  437. package/dist/factories/cnpg/types.js +2 -1
  438. package/dist/factories/cnpg/types.js.map +1 -1
  439. package/dist/factories/dagster/compositions/dagster-bootstrap.d.ts +2 -0
  440. package/dist/factories/dagster/compositions/dagster-bootstrap.d.ts.map +1 -1
  441. package/dist/factories/dagster/types.d.ts +5 -0
  442. package/dist/factories/dagster/types.d.ts.map +1 -1
  443. package/dist/factories/dagster/types.js +1 -0
  444. package/dist/factories/dagster/types.js.map +1 -1
  445. package/dist/factories/dagster/utils/helm-values-mapper.js +3 -0
  446. package/dist/factories/dagster/utils/helm-values-mapper.js.map +1 -1
  447. package/dist/factories/external-dns/compositions/external-dns-bootstrap.d.ts.map +1 -1
  448. package/dist/factories/external-dns/compositions/external-dns-bootstrap.js +7 -4
  449. package/dist/factories/external-dns/compositions/external-dns-bootstrap.js.map +1 -1
  450. package/dist/factories/external-dns/resources/dns-endpoint.d.ts.map +1 -1
  451. package/dist/factories/external-dns/resources/dns-endpoint.js +20 -18
  452. package/dist/factories/external-dns/resources/dns-endpoint.js.map +1 -1
  453. package/dist/factories/flux/git-repository.d.ts.map +1 -1
  454. package/dist/factories/flux/git-repository.js +41 -34
  455. package/dist/factories/flux/git-repository.js.map +1 -1
  456. package/dist/factories/flux/kustomize/readiness-evaluators.d.ts +0 -6
  457. package/dist/factories/flux/kustomize/readiness-evaluators.d.ts.map +1 -1
  458. package/dist/factories/flux/kustomize/readiness-evaluators.js +12 -2
  459. package/dist/factories/flux/kustomize/readiness-evaluators.js.map +1 -1
  460. package/dist/factories/harbor/compositions/harbor-installation.d.ts +46 -38
  461. package/dist/factories/harbor/compositions/harbor-installation.d.ts.map +1 -1
  462. package/dist/factories/harbor/compositions/harbor-installation.js +4 -2
  463. package/dist/factories/harbor/compositions/harbor-installation.js.map +1 -1
  464. package/dist/factories/harbor/types.d.ts +13 -11
  465. package/dist/factories/harbor/types.d.ts.map +1 -1
  466. package/dist/factories/harbor/types.js +11 -9
  467. package/dist/factories/harbor/types.js.map +1 -1
  468. package/dist/factories/helm/helm-repository.d.ts.map +1 -1
  469. package/dist/factories/helm/helm-repository.js +14 -1
  470. package/dist/factories/helm/helm-repository.js.map +1 -1
  471. package/dist/factories/helm/index.d.ts +2 -0
  472. package/dist/factories/helm/index.d.ts.map +1 -1
  473. package/dist/factories/helm/index.js +1 -0
  474. package/dist/factories/helm/index.js.map +1 -1
  475. package/dist/factories/helm/readiness-evaluators.d.ts.map +1 -1
  476. package/dist/factories/helm/readiness-evaluators.js +46 -7
  477. package/dist/factories/helm/readiness-evaluators.js.map +1 -1
  478. package/dist/factories/helm/status.d.ts +18 -0
  479. package/dist/factories/helm/status.d.ts.map +1 -0
  480. package/dist/factories/helm/status.js +38 -0
  481. package/dist/factories/helm/status.js.map +1 -0
  482. package/dist/factories/index.d.ts +2 -2
  483. package/dist/factories/index.d.ts.map +1 -1
  484. package/dist/factories/index.js +4 -4
  485. package/dist/factories/index.js.map +1 -1
  486. package/dist/factories/inngest/compositions/inngest-bootstrap.d.ts +1 -1
  487. package/dist/factories/inngest/compositions/inngest-bootstrap.d.ts.map +1 -1
  488. package/dist/factories/inngest/compositions/inngest-bootstrap.js +2 -4
  489. package/dist/factories/inngest/compositions/inngest-bootstrap.js.map +1 -1
  490. package/dist/factories/inngest/resources/helm.d.ts.map +1 -1
  491. package/dist/factories/inngest/resources/helm.js +12 -3
  492. package/dist/factories/inngest/resources/helm.js.map +1 -1
  493. package/dist/factories/inngest/types.d.ts +3 -7
  494. package/dist/factories/inngest/types.d.ts.map +1 -1
  495. package/dist/factories/inngest/types.js +1 -1
  496. package/dist/factories/inngest/types.js.map +1 -1
  497. package/dist/factories/kro/kro-crd.d.ts.map +1 -1
  498. package/dist/factories/kro/kro-crd.js +32 -33
  499. package/dist/factories/kro/kro-crd.js.map +1 -1
  500. package/dist/factories/kro/kro-custom-resource.d.ts.map +1 -1
  501. package/dist/factories/kro/kro-custom-resource.js +91 -85
  502. package/dist/factories/kro/kro-custom-resource.js.map +1 -1
  503. package/dist/factories/kro/resource-graph-definition.d.ts.map +1 -1
  504. package/dist/factories/kro/resource-graph-definition.js +127 -117
  505. package/dist/factories/kro/resource-graph-definition.js.map +1 -1
  506. package/dist/factories/kubernetes/autoscaling/horizontal-pod-autoscaler-v1.d.ts.map +1 -1
  507. package/dist/factories/kubernetes/autoscaling/horizontal-pod-autoscaler-v1.js +27 -26
  508. package/dist/factories/kubernetes/autoscaling/horizontal-pod-autoscaler-v1.js.map +1 -1
  509. package/dist/factories/kubernetes/autoscaling/horizontal-pod-autoscaler.d.ts.map +1 -1
  510. package/dist/factories/kubernetes/autoscaling/horizontal-pod-autoscaler.js +22 -22
  511. package/dist/factories/kubernetes/autoscaling/horizontal-pod-autoscaler.js.map +1 -1
  512. package/dist/factories/kubernetes/certificates/certificate-signing-request.d.ts.map +1 -1
  513. package/dist/factories/kubernetes/certificates/certificate-signing-request.js +41 -39
  514. package/dist/factories/kubernetes/certificates/certificate-signing-request.js.map +1 -1
  515. package/dist/factories/kubernetes/core/component-status.d.ts.map +1 -1
  516. package/dist/factories/kubernetes/core/component-status.js +14 -16
  517. package/dist/factories/kubernetes/core/component-status.js.map +1 -1
  518. package/dist/factories/kubernetes/core/namespace.d.ts.map +1 -1
  519. package/dist/factories/kubernetes/core/namespace.js +31 -38
  520. package/dist/factories/kubernetes/core/namespace.js.map +1 -1
  521. package/dist/factories/kubernetes/core/node.d.ts.map +1 -1
  522. package/dist/factories/kubernetes/core/node.js +17 -25
  523. package/dist/factories/kubernetes/core/node.js.map +1 -1
  524. package/dist/factories/kubernetes/core/pod.d.ts.map +1 -1
  525. package/dist/factories/kubernetes/core/pod.js +31 -35
  526. package/dist/factories/kubernetes/core/pod.js.map +1 -1
  527. package/dist/factories/kubernetes/extensions/custom-resource-definition.d.ts.map +1 -1
  528. package/dist/factories/kubernetes/extensions/custom-resource-definition.js +34 -36
  529. package/dist/factories/kubernetes/extensions/custom-resource-definition.js.map +1 -1
  530. package/dist/factories/kubernetes/extensions/custom-resource.d.ts.map +1 -1
  531. package/dist/factories/kubernetes/extensions/custom-resource.js +2 -4
  532. package/dist/factories/kubernetes/extensions/custom-resource.js.map +1 -1
  533. package/dist/factories/kubernetes/networking/endpoints.d.ts.map +1 -1
  534. package/dist/factories/kubernetes/networking/endpoints.js +29 -30
  535. package/dist/factories/kubernetes/networking/endpoints.js.map +1 -1
  536. package/dist/factories/kubernetes/networking/ingress.d.ts.map +1 -1
  537. package/dist/factories/kubernetes/networking/ingress.js +46 -57
  538. package/dist/factories/kubernetes/networking/ingress.js.map +1 -1
  539. package/dist/factories/kubernetes/networking/network-policy.d.ts +9 -0
  540. package/dist/factories/kubernetes/networking/network-policy.d.ts.map +1 -1
  541. package/dist/factories/kubernetes/networking/network-policy.js +51 -1
  542. package/dist/factories/kubernetes/networking/network-policy.js.map +1 -1
  543. package/dist/factories/kubernetes/networking/service.d.ts.map +1 -1
  544. package/dist/factories/kubernetes/networking/service.js +48 -40
  545. package/dist/factories/kubernetes/networking/service.js.map +1 -1
  546. package/dist/factories/kubernetes/policy/pod-disruption-budget.d.ts.map +1 -1
  547. package/dist/factories/kubernetes/policy/pod-disruption-budget.js +40 -46
  548. package/dist/factories/kubernetes/policy/pod-disruption-budget.js.map +1 -1
  549. package/dist/factories/kubernetes/policy/resource-quota.d.ts.map +1 -1
  550. package/dist/factories/kubernetes/policy/resource-quota.js +30 -34
  551. package/dist/factories/kubernetes/policy/resource-quota.js.map +1 -1
  552. package/dist/factories/kubernetes/storage/persistent-volume-claim.d.ts.map +1 -1
  553. package/dist/factories/kubernetes/storage/persistent-volume-claim.js +22 -21
  554. package/dist/factories/kubernetes/storage/persistent-volume-claim.js.map +1 -1
  555. package/dist/factories/kubernetes/storage/persistent-volume.d.ts.map +1 -1
  556. package/dist/factories/kubernetes/storage/persistent-volume.js +32 -38
  557. package/dist/factories/kubernetes/storage/persistent-volume.js.map +1 -1
  558. package/dist/factories/kubernetes/storage/volume-attachment.d.ts.map +1 -1
  559. package/dist/factories/kubernetes/storage/volume-attachment.js +12 -11
  560. package/dist/factories/kubernetes/storage/volume-attachment.js.map +1 -1
  561. package/dist/factories/kubernetes/workloads/cron-job.d.ts.map +1 -1
  562. package/dist/factories/kubernetes/workloads/cron-job.js +39 -34
  563. package/dist/factories/kubernetes/workloads/cron-job.js.map +1 -1
  564. package/dist/factories/kubernetes/workloads/daemon-set.d.ts.map +1 -1
  565. package/dist/factories/kubernetes/workloads/daemon-set.js +24 -23
  566. package/dist/factories/kubernetes/workloads/daemon-set.js.map +1 -1
  567. package/dist/factories/kubernetes/workloads/deployment.d.ts.map +1 -1
  568. package/dist/factories/kubernetes/workloads/deployment.js +45 -35
  569. package/dist/factories/kubernetes/workloads/deployment.js.map +1 -1
  570. package/dist/factories/kubernetes/workloads/job.d.ts.map +1 -1
  571. package/dist/factories/kubernetes/workloads/job.js +87 -77
  572. package/dist/factories/kubernetes/workloads/job.js.map +1 -1
  573. package/dist/factories/kubernetes/workloads/replica-set.d.ts.map +1 -1
  574. package/dist/factories/kubernetes/workloads/replica-set.js +24 -24
  575. package/dist/factories/kubernetes/workloads/replica-set.js.map +1 -1
  576. package/dist/factories/kubernetes/workloads/replication-controller.d.ts.map +1 -1
  577. package/dist/factories/kubernetes/workloads/replication-controller.js +37 -26
  578. package/dist/factories/kubernetes/workloads/replication-controller.js.map +1 -1
  579. package/dist/factories/kubernetes/workloads/stateful-set.d.ts.map +1 -1
  580. package/dist/factories/kubernetes/workloads/stateful-set.js +69 -55
  581. package/dist/factories/kubernetes/workloads/stateful-set.js.map +1 -1
  582. package/dist/factories/kubernetes/yaml/yaml-artifact-applier.d.ts +15 -0
  583. package/dist/factories/kubernetes/yaml/yaml-artifact-applier.d.ts.map +1 -0
  584. package/dist/factories/kubernetes/yaml/yaml-artifact-applier.js +69 -0
  585. package/dist/factories/kubernetes/yaml/yaml-artifact-applier.js.map +1 -0
  586. package/dist/factories/kubernetes/yaml/yaml-directory.d.ts +2 -1
  587. package/dist/factories/kubernetes/yaml/yaml-directory.d.ts.map +1 -1
  588. package/dist/factories/kubernetes/yaml/yaml-directory.js +3 -34
  589. package/dist/factories/kubernetes/yaml/yaml-directory.js.map +1 -1
  590. package/dist/factories/kubernetes/yaml/yaml-file.d.ts +13 -91
  591. package/dist/factories/kubernetes/yaml/yaml-file.d.ts.map +1 -1
  592. package/dist/factories/kubernetes/yaml/yaml-file.js +21 -311
  593. package/dist/factories/kubernetes/yaml/yaml-file.js.map +1 -1
  594. package/dist/factories/nats/compositions/nats-bootstrap.d.ts +2 -2
  595. package/dist/factories/nats/compositions/nats-bootstrap.d.ts.map +1 -1
  596. package/dist/factories/nats/compositions/nats-bootstrap.js +2 -3
  597. package/dist/factories/nats/compositions/nats-bootstrap.js.map +1 -1
  598. package/dist/factories/nats/resources/jetstream.d.ts.map +1 -1
  599. package/dist/factories/nats/resources/jetstream.js +2 -0
  600. package/dist/factories/nats/resources/jetstream.js.map +1 -1
  601. package/dist/factories/nats/types.d.ts +3 -3
  602. package/dist/factories/nats/types.js +1 -1
  603. package/dist/factories/nats/types.js.map +1 -1
  604. package/dist/factories/ory/compositions/ory-platform-stack.d.ts.map +1 -1
  605. package/dist/factories/ory/compositions/ory-platform-stack.js +35 -9
  606. package/dist/factories/ory/compositions/ory-platform-stack.js.map +1 -1
  607. package/dist/factories/ory/resources/oathkeeper-rule.d.ts.map +1 -1
  608. package/dist/factories/ory/resources/oathkeeper-rule.js +11 -8
  609. package/dist/factories/ory/resources/oathkeeper-rule.js.map +1 -1
  610. package/dist/factories/ory/resources/oauth2-client.d.ts.map +1 -1
  611. package/dist/factories/ory/resources/oauth2-client.js +12 -9
  612. package/dist/factories/ory/resources/oauth2-client.js.map +1 -1
  613. package/dist/factories/ory/types.d.ts +3 -0
  614. package/dist/factories/ory/types.d.ts.map +1 -1
  615. package/dist/factories/ory/types.js +1 -0
  616. package/dist/factories/ory/types.js.map +1 -1
  617. package/dist/factories/rook/compositions/rook-ceph-operator-installation.d.ts +2 -2
  618. package/dist/factories/rook/compositions/rook-ceph-operator-installation.d.ts.map +1 -1
  619. package/dist/factories/rook/compositions/rook-ceph-operator-installation.js +2 -3
  620. package/dist/factories/rook/compositions/rook-ceph-operator-installation.js.map +1 -1
  621. package/dist/factories/rook/resources/ceph-object-store-user.d.ts.map +1 -1
  622. package/dist/factories/rook/resources/ceph-object-store-user.js +2 -0
  623. package/dist/factories/rook/resources/ceph-object-store-user.js.map +1 -1
  624. package/dist/factories/rook/resources/ceph-object-store.d.ts.map +1 -1
  625. package/dist/factories/rook/resources/ceph-object-store.js +2 -0
  626. package/dist/factories/rook/resources/ceph-object-store.js.map +1 -1
  627. package/dist/factories/rook/resources/object-bucket-claim.d.ts.map +1 -1
  628. package/dist/factories/rook/resources/object-bucket-claim.js +2 -0
  629. package/dist/factories/rook/resources/object-bucket-claim.js.map +1 -1
  630. package/dist/factories/rook/types.d.ts +1 -1
  631. package/dist/factories/rook/types.js +1 -1
  632. package/dist/factories/rook/types.js.map +1 -1
  633. package/dist/factories/searxng/compositions/searxng-bootstrap.d.ts.map +1 -1
  634. package/dist/factories/searxng/compositions/searxng-bootstrap.js +2 -2
  635. package/dist/factories/searxng/compositions/searxng-bootstrap.js.map +1 -1
  636. package/dist/factories/searxng/resources/searxng.d.ts.map +1 -1
  637. package/dist/factories/searxng/resources/searxng.js +2 -0
  638. package/dist/factories/searxng/resources/searxng.js.map +1 -1
  639. package/dist/factories/valkey/compositions/valkey-bootstrap.d.ts +2 -2
  640. package/dist/factories/valkey/compositions/valkey-bootstrap.d.ts.map +1 -1
  641. package/dist/factories/valkey/compositions/valkey-bootstrap.js +4 -9
  642. package/dist/factories/valkey/compositions/valkey-bootstrap.js.map +1 -1
  643. package/dist/factories/valkey/resources/valkey.d.ts.map +1 -1
  644. package/dist/factories/valkey/resources/valkey.js +2 -1
  645. package/dist/factories/valkey/resources/valkey.js.map +1 -1
  646. package/dist/factories/valkey/types.d.ts +3 -7
  647. package/dist/factories/valkey/types.d.ts.map +1 -1
  648. package/dist/factories/valkey/types.js +1 -1
  649. package/dist/factories/valkey/types.js.map +1 -1
  650. package/dist/factories/webapp/compositions/web-app-with-processing.d.ts +3 -2
  651. package/dist/factories/webapp/compositions/web-app-with-processing.d.ts.map +1 -1
  652. package/dist/factories/webapp/compositions/web-app-with-processing.js +7 -6
  653. package/dist/factories/webapp/compositions/web-app-with-processing.js.map +1 -1
  654. package/dist/factories/webapp/types.d.ts +1 -0
  655. package/dist/factories/webapp/types.d.ts.map +1 -1
  656. package/dist/factories/webapp/types.js +2 -0
  657. package/dist/factories/webapp/types.js.map +1 -1
  658. package/dist/index.d.ts +2 -1
  659. package/dist/index.d.ts.map +1 -1
  660. package/dist/index.js +1 -1
  661. package/dist/index.js.map +1 -1
  662. package/dist/shared/brands.d.ts +7 -0
  663. package/dist/shared/brands.d.ts.map +1 -1
  664. package/dist/shared/brands.js +7 -0
  665. package/dist/shared/brands.js.map +1 -1
  666. package/dist/utils/index.d.ts +3 -3
  667. package/dist/utils/index.d.ts.map +1 -1
  668. package/dist/utils/index.js +3 -3
  669. package/dist/utils/index.js.map +1 -1
  670. package/package.json +20 -5
  671. package/dist/factories/kubernetes/yaml/conflict-handler.d.ts +0 -23
  672. package/dist/factories/kubernetes/yaml/conflict-handler.d.ts.map +0 -1
  673. package/dist/factories/kubernetes/yaml/conflict-handler.js +0 -83
  674. package/dist/factories/kubernetes/yaml/conflict-handler.js.map +0 -1
@@ -0,0 +1,1518 @@
1
+ import { isCelExpression, isKubernetesRef, isMixedTemplate, isResourceReference, } from '../../utils/type-guards.js';
2
+ import { applyAspects } from '../aspects/apply.js';
3
+ import { DependencyResolver } from '../dependencies/index.js';
4
+ import { TypeKroError } from '../errors.js';
5
+ import { convertReadyWhenCallbackToCel } from '../expressions/analysis/ready-when.js';
6
+ import { copyResourceMetadata, getForEach, getMetadataField, getReadinessEvaluator, getResourceId, getResourceScope, getTemplateOverrides, setResourceId, } from '../metadata/resource-metadata.js';
7
+ import { getPortableReadinessStrategy, getRuntimeReadinessClassification, } from '../readiness/portable-strategies.js';
8
+ import { getFactoryRegistration, getFactoryRegistrationsForGVK, } from '../resources/factory-registry.js';
9
+ import { createAspectManifest } from './aspects.js';
10
+ import { canonicalDigest, canonicalStringify } from './canonical.js';
11
+ import { schemaToIR } from './schema.js';
12
+ import { collectArtifactOutputUses, expressionIR, lowerPlanValue } from './values.js';
13
+ /** Error raised by strict semantic planning. */
14
+ export class SemanticPlanningError extends TypeKroError {
15
+ constructor(message, diagnostics) {
16
+ super(message, 'SEMANTIC_PLANNING_FAILED', { diagnostics });
17
+ this.name = 'SemanticPlanningError';
18
+ }
19
+ }
20
+ function compositionIdentity(capture) {
21
+ const diagnosticSourceDigest = canonicalDigest(capture.diagnosticSource);
22
+ const revision = capture.ir.definition.revision;
23
+ return revision
24
+ ? {
25
+ name: capture.ir.definition.name,
26
+ apiVersion: capture.ir.definition.apiVersion,
27
+ kind: capture.ir.definition.kind,
28
+ stability: 'stable',
29
+ revision: { kind: 'version', value: revision },
30
+ diagnosticSourceDigest,
31
+ }
32
+ : {
33
+ name: capture.ir.definition.name,
34
+ apiVersion: capture.ir.definition.apiVersion,
35
+ kind: capture.ir.definition.kind,
36
+ stability: 'preview-unstable',
37
+ diagnosticSourceDigest,
38
+ };
39
+ }
40
+ function markNestedStatusReferences(value, nestedStatusMappings) {
41
+ if (value.kind === 'sensitive-value') {
42
+ return {
43
+ ...value,
44
+ value: markNestedStatusReferences(value.value, nestedStatusMappings),
45
+ };
46
+ }
47
+ if (value.kind === 'reference') {
48
+ if (value.source !== 'resource' || !value.resourceId || value.nestedComposition)
49
+ return value;
50
+ const fieldPath = value.fieldPath.replace(/^status\./, '');
51
+ return Object.hasOwn(nestedStatusMappings, `__nestedStatus:${value.resourceId}:${fieldPath}`)
52
+ ? { ...value, nestedComposition: true }
53
+ : value;
54
+ }
55
+ if (value.kind === 'array') {
56
+ return {
57
+ ...value,
58
+ items: value.items.map((item) => markNestedStatusReferences(item, nestedStatusMappings)),
59
+ };
60
+ }
61
+ if (value.kind === 'object') {
62
+ return {
63
+ ...value,
64
+ entries: value.entries.map((entry) => ({
65
+ ...entry,
66
+ value: markNestedStatusReferences(entry.value, nestedStatusMappings),
67
+ })),
68
+ };
69
+ }
70
+ if (value.kind === 'template') {
71
+ return {
72
+ ...value,
73
+ segments: value.segments.map((segment) => {
74
+ if (segment.kind !== 'reference' ||
75
+ segment.source !== 'resource' ||
76
+ !segment.resourceId ||
77
+ segment.nestedComposition) {
78
+ return segment;
79
+ }
80
+ const fieldPath = segment.fieldPath.replace(/^status\./, '');
81
+ return Object.hasOwn(nestedStatusMappings, `__nestedStatus:${segment.resourceId}:${fieldPath}`)
82
+ ? { ...segment, nestedComposition: true }
83
+ : segment;
84
+ }),
85
+ };
86
+ }
87
+ return value;
88
+ }
89
+ function summarizeValue(value) {
90
+ switch (value.kind) {
91
+ case 'sensitive-binding':
92
+ return { resource: false, spec: false, sensitive: true };
93
+ case 'sensitive-value': {
94
+ const wrapped = summarizeValue(value.value);
95
+ return { ...wrapped, sensitive: true };
96
+ }
97
+ case 'reference':
98
+ return {
99
+ resource: value.source === 'resource',
100
+ spec: value.source === 'spec',
101
+ sensitive: false,
102
+ };
103
+ case 'expression':
104
+ return {
105
+ resource: value.expression.references.some((reference) => reference.source === 'resource'),
106
+ spec: value.expression.references.some((reference) => reference.source === 'spec'),
107
+ sensitive: value.expression.sensitivity === 'sensitive',
108
+ };
109
+ case 'template':
110
+ return {
111
+ resource: value.segments.some((segment) => segment.kind === 'reference' && segment.source === 'resource'),
112
+ spec: value.segments.some((segment) => segment.kind === 'reference' && segment.source === 'spec'),
113
+ sensitive: false,
114
+ };
115
+ case 'array':
116
+ return value.items.reduce((summary, item) => {
117
+ const child = summarizeValue(item);
118
+ return {
119
+ resource: summary.resource || child.resource,
120
+ spec: summary.spec || child.spec,
121
+ sensitive: summary.sensitive || child.sensitive,
122
+ };
123
+ }, { resource: false, spec: false, sensitive: false });
124
+ case 'object':
125
+ return value.entries.reduce((summary, entry) => {
126
+ const child = summarizeValue(entry.value);
127
+ return {
128
+ resource: summary.resource || child.resource,
129
+ spec: summary.spec || child.spec,
130
+ sensitive: summary.sensitive || child.sensitive,
131
+ };
132
+ }, { resource: false, spec: false, sensitive: false });
133
+ default:
134
+ return { resource: false, spec: false, sensitive: false };
135
+ }
136
+ }
137
+ function specPathIsSensitive(fieldPath, sensitivePaths) {
138
+ for (const sensitivePath of sensitivePaths) {
139
+ if (fieldPath === sensitivePath ||
140
+ fieldPath.startsWith(`${sensitivePath}.`) ||
141
+ sensitivePath.startsWith(`${fieldPath}.`)) {
142
+ return true;
143
+ }
144
+ }
145
+ return false;
146
+ }
147
+ function markSensitiveSpecReferences(value, sensitivePaths) {
148
+ if (sensitivePaths.size === 0 || value.kind === 'sensitive-binding')
149
+ return value;
150
+ if (value.kind === 'sensitive-value')
151
+ return value;
152
+ if (value.kind === 'reference' &&
153
+ value.source === 'spec' &&
154
+ specPathIsSensitive(value.fieldPath, sensitivePaths)) {
155
+ return { kind: 'sensitive-value', value };
156
+ }
157
+ if (value.kind === 'expression' &&
158
+ value.expression.references.some((reference) => reference.source === 'spec' && specPathIsSensitive(reference.fieldPath, sensitivePaths))) {
159
+ return { kind: 'sensitive-value', value };
160
+ }
161
+ if (value.kind === 'template' &&
162
+ value.segments.some((segment) => (segment.kind === 'reference' &&
163
+ segment.source === 'spec' &&
164
+ specPathIsSensitive(segment.fieldPath, sensitivePaths)) ||
165
+ (segment.kind === 'expression' &&
166
+ segment.expression.references.some((reference) => reference.source === 'spec' &&
167
+ specPathIsSensitive(reference.fieldPath, sensitivePaths))))) {
168
+ return { kind: 'sensitive-value', value };
169
+ }
170
+ if (value.kind === 'array') {
171
+ return {
172
+ ...value,
173
+ items: value.items.map((item) => markSensitiveSpecReferences(item, sensitivePaths)),
174
+ };
175
+ }
176
+ if (value.kind === 'object') {
177
+ return {
178
+ ...value,
179
+ entries: value.entries.map((entry) => ({
180
+ ...entry,
181
+ value: markSensitiveSpecReferences(entry.value, sensitivePaths),
182
+ })),
183
+ };
184
+ }
185
+ return value;
186
+ }
187
+ /**
188
+ * Preserve symbolic leaves whose meaning cannot be recovered from an already
189
+ * materialized manifest. Concrete object/array shape remains authoritative so
190
+ * direct-only JavaScript branches and nested composition expansion are not
191
+ * undone by the overlay.
192
+ */
193
+ function preserveCapturedDynamicValue(concrete, captured, sensitivePaths) {
194
+ const symbolic = markSensitiveSpecReferences(captured, sensitivePaths);
195
+ switch (symbolic.kind) {
196
+ case 'sensitive-binding':
197
+ case 'sensitive-value':
198
+ case 'external-input':
199
+ case 'artifact-output':
200
+ return symbolic;
201
+ case 'reference':
202
+ return symbolic.source === 'resource' && symbolic.nestedComposition !== true
203
+ ? symbolic
204
+ : concrete;
205
+ case 'expression':
206
+ return symbolic.expression.references.some((reference) => reference.source === 'resource')
207
+ ? symbolic
208
+ : concrete;
209
+ case 'template':
210
+ return symbolic.segments.some((segment) => (segment.kind === 'reference' &&
211
+ segment.source === 'resource' &&
212
+ segment.nestedComposition !== true) ||
213
+ (segment.kind === 'expression' &&
214
+ segment.expression.references.some((reference) => reference.source === 'resource')))
215
+ ? symbolic
216
+ : concrete;
217
+ case 'array':
218
+ return concrete.kind === 'array'
219
+ ? {
220
+ ...concrete,
221
+ items: concrete.items.map((item, index) => {
222
+ const capturedItem = symbolic.items[index];
223
+ return capturedItem
224
+ ? preserveCapturedDynamicValue(item, capturedItem, sensitivePaths)
225
+ : item;
226
+ }),
227
+ }
228
+ : concrete;
229
+ case 'object': {
230
+ if (concrete.kind !== 'object')
231
+ return concrete;
232
+ const capturedEntries = new Map(symbolic.entries.map((entry) => [entry.key, entry.value]));
233
+ return {
234
+ ...concrete,
235
+ entries: concrete.entries.map((entry) => {
236
+ const capturedValue = capturedEntries.get(entry.key);
237
+ return capturedValue
238
+ ? {
239
+ ...entry,
240
+ value: preserveCapturedDynamicValue(entry.value, capturedValue, sensitivePaths),
241
+ }
242
+ : entry;
243
+ }),
244
+ };
245
+ }
246
+ default:
247
+ return concrete;
248
+ }
249
+ }
250
+ function statusProjections(statusMappings, diagnostics, specSchema, sensitiveSpecPaths = new Set()) {
251
+ const outputs = {};
252
+ const projections = [];
253
+ // Nested-composition analysis stores Maps and helper tables beside the user status mapping.
254
+ // The established schema serializer already excludes this `__*` metadata; semantic planning
255
+ // must apply the same boundary so strict value diagnostics do not mistake internal Maps for
256
+ // user-authored status values.
257
+ for (const key of Object.keys(statusMappings)
258
+ .filter((key) => !key.startsWith('__'))
259
+ .sort()) {
260
+ const lowered = lowerPlanValue(statusMappings[key], { specSchema });
261
+ const value = markSensitiveSpecReferences(lowered.value, sensitiveSpecPaths);
262
+ outputs[key] = value;
263
+ diagnostics.push(...lowered.diagnostics.map((diagnostic) => ({
264
+ ...diagnostic,
265
+ path: `$.outputs.${key}${diagnostic.path?.slice(1) ?? ''}`,
266
+ })));
267
+ const summary = summarizeValue(value);
268
+ const source = summary.resource
269
+ ? 'live-resource'
270
+ : summary.spec
271
+ ? 'desired-spec'
272
+ : 'static';
273
+ const native = summary.resource && !summary.spec && !summary.sensitive;
274
+ projections.push({
275
+ path: key,
276
+ source,
277
+ mode: native ? 'native' : 'client-only',
278
+ ...(native ? { persistedPath: key } : {}),
279
+ value,
280
+ });
281
+ if (summary.sensitive) {
282
+ diagnostics.push({
283
+ code: 'PLAN_STATUS_SENSITIVE',
284
+ severity: 'error',
285
+ message: `Status field ${key} derives from sensitive data and cannot be projected.`,
286
+ path: `$.status.${key}`,
287
+ });
288
+ }
289
+ }
290
+ return { outputs, projections };
291
+ }
292
+ function filteredStatusSchema(schema, persistedFields) {
293
+ if (schema.root.kind !== 'object')
294
+ return schema;
295
+ const root = {
296
+ kind: 'object',
297
+ properties: schema.root.properties.filter((property) => persistedFields.has(property.name)),
298
+ };
299
+ return {
300
+ version: 1,
301
+ root,
302
+ digest: canonicalDigest({ version: 1, root }),
303
+ diagnostics: schema.diagnostics,
304
+ };
305
+ }
306
+ function buildStatusContract(capture, diagnostics, strict, specSchema, sensitiveSpecPaths = new Set()) {
307
+ const hydratedSchema = schemaToIR(capture.ir.definition.statusSchema, { strict: false });
308
+ diagnostics.push(...hydratedSchema.diagnostics);
309
+ const projected = statusProjections(capture.ir.statusMappings, diagnostics, specSchema, sensitiveSpecPaths);
310
+ const persistedFields = new Set(projected.projections
311
+ .filter((projection) => projection.mode === 'native' || projection.mode === 'relay')
312
+ .map((projection) => projection.path.split('.')[0])
313
+ .filter((field) => field !== undefined));
314
+ const persistedSchema = filteredStatusSchema(hydratedSchema, persistedFields);
315
+ if (strict && diagnostics.some((diagnostic) => diagnostic.severity === 'error')) {
316
+ throw new SemanticPlanningError('Status contract is not portable.', diagnostics);
317
+ }
318
+ return {
319
+ contract: {
320
+ persistedSchema,
321
+ hydratedSchema,
322
+ projections: projected.projections,
323
+ },
324
+ outputs: projected.outputs,
325
+ };
326
+ }
327
+ function inputManifest(options, diagnostics) {
328
+ const manifest = [];
329
+ for (const name of Object.keys(options.inputs ?? {}).sort()) {
330
+ const binding = options.inputs?.[name];
331
+ if (!binding)
332
+ continue;
333
+ if (binding.kind === 'ordinary') {
334
+ const lowered = lowerPlanValue(binding.value);
335
+ diagnostics.push(...lowered.diagnostics.map((diagnostic) => ({
336
+ ...diagnostic,
337
+ path: `$.inputs.${name}${diagnostic.path?.slice(1) ?? ''}`,
338
+ })));
339
+ if (lowered.sensitivity === 'sensitive') {
340
+ diagnostics.push({
341
+ code: 'PLAN_INPUT_KIND_MISMATCH',
342
+ severity: 'error',
343
+ message: `Ordinary input ${name} contains a sensitive binding; declare it as sensitive.`,
344
+ path: `$.inputs.${name}`,
345
+ });
346
+ }
347
+ manifest.push({ name, kind: 'ordinary', value: lowered.value });
348
+ }
349
+ else if (binding.kind === 'sensitive') {
350
+ manifest.push({
351
+ name,
352
+ kind: 'sensitive',
353
+ binding: binding.binding,
354
+ ...(binding.version !== undefined ? { version: binding.version } : {}),
355
+ });
356
+ }
357
+ else {
358
+ manifest.push({ name, kind: 'artifact', requirement: binding.requirement });
359
+ }
360
+ }
361
+ return manifest;
362
+ }
363
+ function validateArtifactRequirements(inputs, valueSurface, diagnostics) {
364
+ const requirements = inputs.filter((input) => input.kind === 'artifact');
365
+ const byId = new Map();
366
+ requirements.forEach((input, index) => {
367
+ const { requirement } = input;
368
+ const path = `$.inputs.${input.name}.requirement`;
369
+ if (requirement.id.length === 0 || requirement.kind.length === 0) {
370
+ diagnostics.push({
371
+ code: 'PLAN_ARTIFACT_REQUIREMENT_INVALID',
372
+ severity: 'error',
373
+ message: `Artifact requirement ${index} must have non-empty id and kind fields.`,
374
+ path,
375
+ });
376
+ }
377
+ if (requirement.outputs.length === 0 ||
378
+ requirement.outputs.some((output) => output.length === 0) ||
379
+ new Set(requirement.outputs).size !== requirement.outputs.length) {
380
+ diagnostics.push({
381
+ code: 'PLAN_ARTIFACT_REQUIREMENT_OUTPUTS_INVALID',
382
+ severity: 'error',
383
+ message: `Artifact requirement ${requirement.id || index} must declare unique, non-empty outputs.`,
384
+ path: `${path}.outputs`,
385
+ });
386
+ }
387
+ const prior = byId.get(requirement.id);
388
+ if (prior && canonicalStringify(prior) !== canonicalStringify(requirement)) {
389
+ diagnostics.push({
390
+ code: 'PLAN_ARTIFACT_REQUIREMENT_ID_CONFLICT',
391
+ severity: 'error',
392
+ message: `Artifact requirement id ${requirement.id} is declared with conflicting definitions.`,
393
+ path,
394
+ });
395
+ }
396
+ else if (requirement.id.length > 0) {
397
+ byId.set(requirement.id, requirement);
398
+ }
399
+ });
400
+ for (const use of collectArtifactOutputUses(valueSurface)) {
401
+ const requirement = byId.get(use.requirementId);
402
+ if (!requirement) {
403
+ diagnostics.push({
404
+ code: 'PLAN_ARTIFACT_OUTPUT_REQUIREMENT_UNDECLARED',
405
+ severity: 'error',
406
+ message: `Artifact output ${use.requirementId}.${use.output} refers to an undeclared requirement.`,
407
+ path: '$.artifactOutputs',
408
+ details: { requirementId: use.requirementId, output: use.output },
409
+ });
410
+ continue;
411
+ }
412
+ if (!requirement.outputs.includes(use.output)) {
413
+ diagnostics.push({
414
+ code: 'PLAN_ARTIFACT_OUTPUT_UNDECLARED',
415
+ severity: 'error',
416
+ message: `Artifact requirement ${use.requirementId} does not declare output ${use.output}.`,
417
+ path: '$.artifactOutputs',
418
+ details: { requirementId: use.requirementId, output: use.output },
419
+ });
420
+ }
421
+ }
422
+ }
423
+ function cloneCanonicalizerInput(value, seen = new WeakMap()) {
424
+ if (value === null ||
425
+ typeof value !== 'object' ||
426
+ isKubernetesRef(value) ||
427
+ isCelExpression(value) ||
428
+ isMixedTemplate(value) ||
429
+ isResourceReference(value)) {
430
+ return value;
431
+ }
432
+ const prior = seen.get(value);
433
+ if (prior)
434
+ return prior;
435
+ if (Array.isArray(value)) {
436
+ const clone = [];
437
+ seen.set(value, clone);
438
+ value.forEach((entry) => clone.push(cloneCanonicalizerInput(entry, seen)));
439
+ return clone;
440
+ }
441
+ const clone = {};
442
+ seen.set(value, clone);
443
+ for (const key of Object.keys(value)) {
444
+ clone[key] = cloneCanonicalizerInput(Reflect.get(value, key), seen);
445
+ }
446
+ return clone;
447
+ }
448
+ function canonicalizeResource(resource, diagnostics) {
449
+ const registeredFactoryName = getMetadataField(resource, 'factoryName');
450
+ const exactRegistration = registeredFactoryName
451
+ ? getFactoryRegistration(registeredFactoryName)
452
+ : undefined;
453
+ const gvkRegistrations = getFactoryRegistrationsForGVK(resource.apiVersion, resource.kind);
454
+ let registrations;
455
+ if (exactRegistration &&
456
+ exactRegistration.apiVersion === resource.apiVersion &&
457
+ exactRegistration.kind === resource.kind) {
458
+ registrations = [exactRegistration];
459
+ }
460
+ else {
461
+ registrations = gvkRegistrations;
462
+ if (registeredFactoryName) {
463
+ diagnostics.push({
464
+ code: 'PLAN_FACTORY_PROVENANCE_INVALID',
465
+ severity: 'error',
466
+ message: `Resource provenance names factory ${registeredFactoryName}, but it is not registered for ${resource.apiVersion}/${resource.kind}.`,
467
+ path: '$.provenance.canonicalizers',
468
+ details: { factoryName: registeredFactoryName },
469
+ });
470
+ }
471
+ else if (gvkRegistrations.length > 1) {
472
+ diagnostics.push({
473
+ code: 'PLAN_FACTORY_PROVENANCE_AMBIGUOUS',
474
+ severity: 'error',
475
+ message: `${resource.apiVersion}/${resource.kind} was created without factory provenance and has multiple registered factories. Pass factoryName to createResource().`,
476
+ path: '$.provenance.canonicalizers',
477
+ details: { apiVersion: resource.apiVersion, kind: resource.kind },
478
+ });
479
+ }
480
+ }
481
+ const canonicalizers = registrations
482
+ .flatMap((registration) => registration.desiredCanonicalizer
483
+ ? [
484
+ {
485
+ canonicalizer: registration.desiredCanonicalizer,
486
+ factoryName: registration.factoryName,
487
+ },
488
+ ]
489
+ : [])
490
+ .filter((entry, index, all) => all.findIndex((candidate) => candidate.canonicalizer.id === entry.canonicalizer.id) ===
491
+ index)
492
+ .sort((left, right) => left.canonicalizer.id.localeCompare(right.canonicalizer.id));
493
+ let current = resource;
494
+ const manifest = [];
495
+ for (const { canonicalizer, factoryName } of canonicalizers) {
496
+ const first = canonicalizer.canonicalize(cloneCanonicalizerInput(current));
497
+ const second = canonicalizer.canonicalize(cloneCanonicalizerInput(current));
498
+ const firstLowered = lowerPlanValue(first);
499
+ const secondLowered = lowerPlanValue(second);
500
+ diagnostics.push(...firstLowered.diagnostics, ...secondLowered.diagnostics);
501
+ if (canonicalStringify(firstLowered.value) !== canonicalStringify(secondLowered.value)) {
502
+ diagnostics.push({
503
+ code: 'PLAN_CANONICALIZER_NONDETERMINISTIC',
504
+ severity: 'error',
505
+ message: `Desired canonicalizer ${canonicalizer.id}@${canonicalizer.revision} produced different outputs for identical inputs.`,
506
+ path: '$.provenance.canonicalizers',
507
+ });
508
+ }
509
+ current = first;
510
+ manifest.push({
511
+ id: canonicalizer.id,
512
+ revision: canonicalizer.revision,
513
+ stage: 'desired',
514
+ factoryName,
515
+ });
516
+ }
517
+ return { resource: current, canonicalizers: manifest };
518
+ }
519
+ function factoryRegistrationForResource(resource) {
520
+ const factoryName = getMetadataField(resource, 'factoryName');
521
+ if (factoryName) {
522
+ const registration = getFactoryRegistration(factoryName);
523
+ if (registration?.apiVersion === resource.apiVersion && registration.kind === resource.kind) {
524
+ return registration;
525
+ }
526
+ return undefined;
527
+ }
528
+ const registrations = getFactoryRegistrationsForGVK(resource.apiVersion, resource.kind);
529
+ return registrations.length === 1 ? registrations[0] : undefined;
530
+ }
531
+ function factoryRepresentationRequirements(resource, logicalId, diagnostics) {
532
+ const registration = factoryRegistrationForResource(resource);
533
+ const producer = registration?.representationRequirements;
534
+ if (!registration || !producer)
535
+ return [];
536
+ let first;
537
+ let second;
538
+ try {
539
+ first = producer.produce(cloneCanonicalizerInput(resource));
540
+ second = producer.produce(cloneCanonicalizerInput(resource));
541
+ }
542
+ catch (_error) {
543
+ diagnostics.push({
544
+ code: 'PLAN_REPRESENTATION_PRODUCER_FAILED',
545
+ severity: 'error',
546
+ message: `Representation producer ${producer.id}@${producer.revision} failed for ${logicalId}.`,
547
+ path: `$.nodes.${logicalId}`,
548
+ details: { producer: producer.id },
549
+ });
550
+ return [];
551
+ }
552
+ const lower = (requirements, pass) => requirements.map((requirement, index) => {
553
+ const lowered = lowerPlanValue(requirement.inputs);
554
+ diagnostics.push(...lowered.diagnostics.map((diagnostic) => ({
555
+ ...diagnostic,
556
+ path: `$.nodes.${logicalId}.representationRequirements.${pass}[${index}]${diagnostic.path?.slice(1) ?? ''}`,
557
+ })));
558
+ return {
559
+ target: requirement.target,
560
+ kind: requirement.kind,
561
+ extension: requirement.extension,
562
+ version: requirement.version,
563
+ inputs: lowered.value,
564
+ sourceNodeId: logicalId,
565
+ factoryName: registration.factoryName,
566
+ };
567
+ });
568
+ const firstLowered = lower(first, 'first');
569
+ const secondLowered = lower(second, 'second');
570
+ if (canonicalStringify(firstLowered) !== canonicalStringify(secondLowered)) {
571
+ diagnostics.push({
572
+ code: 'PLAN_REPRESENTATION_PRODUCER_NONDETERMINISTIC',
573
+ severity: 'error',
574
+ message: `Representation producer ${producer.id}@${producer.revision} produced different declarations for identical inputs.`,
575
+ path: `$.nodes.${logicalId}.representationRequirements`,
576
+ details: { producer: producer.id },
577
+ });
578
+ }
579
+ return firstLowered;
580
+ }
581
+ function planValueReferences(value) {
582
+ switch (value.kind) {
583
+ case 'sensitive-value':
584
+ return planValueReferences(value.value);
585
+ case 'reference':
586
+ return value.source === 'resource' && value.resourceId
587
+ ? [{ resourceId: value.resourceId, fieldPath: value.fieldPath }]
588
+ : [];
589
+ case 'expression':
590
+ return value.expression.references.flatMap((reference) => reference.source === 'resource' && reference.resourceId
591
+ ? [{ resourceId: reference.resourceId, fieldPath: reference.fieldPath }]
592
+ : []);
593
+ case 'template':
594
+ return value.segments.flatMap((segment) => {
595
+ if (segment.kind === 'reference') {
596
+ return segment.source === 'resource' && segment.resourceId
597
+ ? [{ resourceId: segment.resourceId, fieldPath: segment.fieldPath }]
598
+ : [];
599
+ }
600
+ if (segment.kind === 'expression') {
601
+ return segment.expression.references.flatMap((reference) => reference.source === 'resource' && reference.resourceId
602
+ ? [{ resourceId: reference.resourceId, fieldPath: reference.fieldPath }]
603
+ : []);
604
+ }
605
+ return [];
606
+ });
607
+ case 'array':
608
+ return value.items.flatMap((item) => planValueReferences(item));
609
+ case 'object':
610
+ return value.entries.flatMap((entry) => planValueReferences(entry.value));
611
+ default:
612
+ return [];
613
+ }
614
+ }
615
+ function planValueCapabilities(value, nodeId) {
616
+ switch (value.kind) {
617
+ case 'sensitive-value':
618
+ return [
619
+ {
620
+ id: 'typekro.sensitive-materialization',
621
+ version: 1,
622
+ ...(nodeId ? { nodeId } : {}),
623
+ },
624
+ ...planValueCapabilities(value.value, nodeId),
625
+ ];
626
+ case 'expression':
627
+ return value.expression.language === 'raw-cel'
628
+ ? [{ id: 'typekro.raw-cel', version: 1, target: 'kro', ...(nodeId ? { nodeId } : {}) }]
629
+ : value.expression.sensitivity === 'sensitive'
630
+ ? [
631
+ {
632
+ id: 'typekro.sensitive-materialization',
633
+ version: 1,
634
+ ...(nodeId ? { nodeId } : {}),
635
+ },
636
+ ]
637
+ : [];
638
+ case 'sensitive-binding':
639
+ return [
640
+ {
641
+ id: 'typekro.sensitive-materialization',
642
+ version: 1,
643
+ ...(nodeId ? { nodeId } : {}),
644
+ },
645
+ ];
646
+ case 'external-input':
647
+ return [{ id: 'typekro.external-input', version: 1, ...(nodeId ? { nodeId } : {}) }];
648
+ case 'artifact-output':
649
+ return [
650
+ {
651
+ id: 'typekro.artifact-output',
652
+ version: 1,
653
+ host: 'alchemy',
654
+ output: 'live',
655
+ ...(nodeId ? { nodeId } : {}),
656
+ },
657
+ ];
658
+ case 'template':
659
+ return [];
660
+ case 'array':
661
+ return value.items.flatMap((item) => planValueCapabilities(item, nodeId));
662
+ case 'object':
663
+ return value.entries.flatMap((entry) => planValueCapabilities(entry.value, nodeId));
664
+ default:
665
+ return [];
666
+ }
667
+ }
668
+ function uniqueCapabilities(capabilities) {
669
+ return [
670
+ ...new Map(capabilities.map((capability) => [canonicalStringify(capability), capability])).values(),
671
+ ].sort((left, right) => canonicalStringify(left).localeCompare(canonicalStringify(right)));
672
+ }
673
+ function purityDiagnostics(source) {
674
+ const unsupportedEffects = [
675
+ { pattern: /\bMath\.random\s*\(/, effect: 'randomness' },
676
+ { pattern: /\bDate\.now\s*\(|\bnew\s+Date\s*\(/, effect: 'wall-clock time' },
677
+ { pattern: /\b(?:process|Bun)\.env\b|\bDeno\.env\b/, effect: 'environment access' },
678
+ { pattern: /\bfetch\s*\(/, effect: 'network access' },
679
+ {
680
+ pattern: /\b(?:readFile|readFileSync|exec|execSync|spawn|spawnSync)\s*\(/,
681
+ effect: 'ambient I/O',
682
+ },
683
+ ];
684
+ return unsupportedEffects.flatMap(({ pattern, effect }) => pattern.test(source)
685
+ ? [
686
+ {
687
+ code: 'PLAN_AMBIENT_EFFECT_UNSUPPORTED',
688
+ severity: 'error',
689
+ message: `Composition source contains undeclared ${effect}, which is outside the supported planning subset.`,
690
+ path: '$.composition',
691
+ details: { effect },
692
+ },
693
+ ]
694
+ : []);
695
+ }
696
+ function resourceIdentity(resource, specSchema) {
697
+ const name = lowerPlanValue(resource.metadata?.name, { specSchema }).value;
698
+ const namespace = resource.metadata?.namespace;
699
+ const declaredScope = getResourceScope(resource);
700
+ return {
701
+ apiVersion: resource.apiVersion,
702
+ kind: resource.kind,
703
+ name,
704
+ ...(namespace !== undefined
705
+ ? { namespace: lowerPlanValue(namespace, { specSchema }).value }
706
+ : {}),
707
+ scope: declaredScope === 'cluster' || declaredScope === 'namespaced'
708
+ ? declaredScope
709
+ : namespace === undefined
710
+ ? 'cluster'
711
+ : 'namespaced',
712
+ };
713
+ }
714
+ function collectSensitiveSpecPaths(value, paths) {
715
+ switch (value.kind) {
716
+ case 'reference':
717
+ if (value.source === 'spec')
718
+ paths.add(value.fieldPath);
719
+ return;
720
+ case 'expression':
721
+ value.expression.references.forEach((reference) => {
722
+ if (reference.source === 'spec')
723
+ paths.add(reference.fieldPath);
724
+ });
725
+ return;
726
+ case 'template':
727
+ value.segments.forEach((segment) => {
728
+ if (segment.kind === 'reference' && segment.source === 'spec') {
729
+ paths.add(segment.fieldPath);
730
+ }
731
+ else if (segment.kind === 'expression') {
732
+ segment.expression.references.forEach((reference) => {
733
+ if (reference.source === 'spec')
734
+ paths.add(reference.fieldPath);
735
+ });
736
+ }
737
+ });
738
+ return;
739
+ case 'sensitive-value':
740
+ collectSensitiveSpecPaths(value.value, paths);
741
+ return;
742
+ case 'array':
743
+ value.items.forEach((item) => collectSensitiveSpecPaths(item, paths));
744
+ return;
745
+ case 'object':
746
+ value.entries.forEach((entry) => collectSensitiveSpecPaths(entry.value, paths));
747
+ return;
748
+ default:
749
+ return;
750
+ }
751
+ }
752
+ function sensitiveSpecReferences(value, sensitivePaths) {
753
+ const references = new Set();
754
+ collectSensitiveSpecPaths(value, references);
755
+ return [...references]
756
+ .filter((fieldPath) => specPathIsSensitive(fieldPath, sensitivePaths))
757
+ .sort();
758
+ }
759
+ function diagnoseSensitiveControlFlow(diagnostics, nodeId, controlFlow, value, path, sensitivePaths) {
760
+ if (!summarizeValue(value).sensitive)
761
+ return;
762
+ const exposure = controlFlow === 'activation'
763
+ ? 'resource existence'
764
+ : controlFlow === 'readiness'
765
+ ? 'readiness state or timing'
766
+ : 'resource cardinality and identity';
767
+ const sensitiveReferences = sensitiveSpecReferences(value, sensitivePaths);
768
+ diagnostics.push({
769
+ code: 'PLAN_SENSITIVE_CONTROL_FLOW',
770
+ severity: 'error',
771
+ message: `Resource ${nodeId} ${controlFlow} depends on sensitive data and would expose it through ${exposure}.`,
772
+ path,
773
+ details: {
774
+ controlFlow,
775
+ ...(sensitiveReferences.length > 0 ? { sensitivePath: sensitiveReferences.join(',') } : {}),
776
+ },
777
+ });
778
+ }
779
+ function secretValueHasDynamicSource(value) {
780
+ switch (value.kind) {
781
+ case 'reference':
782
+ case 'external-input':
783
+ case 'artifact-output':
784
+ case 'sensitive-binding':
785
+ case 'sensitive-value':
786
+ return true;
787
+ case 'expression':
788
+ return value.expression.references.length > 0;
789
+ case 'template':
790
+ return value.segments.some((segment) => segment.kind === 'reference' ||
791
+ (segment.kind === 'expression' && segment.expression.references.length > 0));
792
+ case 'array':
793
+ return value.items.some(secretValueHasDynamicSource);
794
+ case 'object':
795
+ return value.entries.some((entry) => secretValueHasDynamicSource(entry.value));
796
+ default:
797
+ return false;
798
+ }
799
+ }
800
+ function classifySecretLeaf(value, logicalId, field, keyPath, diagnostics, sensitiveSpecPaths) {
801
+ if (value.kind === 'sensitive-binding' || value.kind === 'sensitive-value') {
802
+ collectSensitiveSpecPaths(value, sensitiveSpecPaths);
803
+ return value;
804
+ }
805
+ if (value.kind === 'omitted')
806
+ return value;
807
+ if (value.kind === 'array') {
808
+ return {
809
+ ...value,
810
+ items: value.items.map((item, index) => classifySecretLeaf(item, logicalId, field, `${keyPath}/${index}`, diagnostics, sensitiveSpecPaths)),
811
+ };
812
+ }
813
+ if (value.kind === 'object') {
814
+ return {
815
+ ...value,
816
+ entries: value.entries.map((entry) => ({
817
+ ...entry,
818
+ value: classifySecretLeaf(entry.value, logicalId, field, `${keyPath}/${entry.key}`, diagnostics, sensitiveSpecPaths),
819
+ })),
820
+ };
821
+ }
822
+ if (secretValueHasDynamicSource(value)) {
823
+ collectSensitiveSpecPaths(value, sensitiveSpecPaths);
824
+ return { kind: 'sensitive-value', value };
825
+ }
826
+ const binding = `inline-secret/${logicalId}/${field}/${keyPath}`;
827
+ diagnostics.push({
828
+ code: 'PLAN_INLINE_SECRET_REQUIRES_BINDING',
829
+ severity: 'error',
830
+ message: `Secret ${logicalId} field ${field}.${keyPath.replaceAll('/', '.')} contains inline material and requires a named sensitive binding for serialization.`,
831
+ path: `$.nodes.${logicalId}.desired.${field}.${keyPath.replaceAll('/', '.')}`,
832
+ });
833
+ return { kind: 'sensitive-binding', binding };
834
+ }
835
+ function classifySecretValues(value, logicalId, diagnostics, sensitiveSpecPaths) {
836
+ if (value.kind !== 'object')
837
+ return value;
838
+ return {
839
+ ...value,
840
+ entries: value.entries.map((entry) => {
841
+ if ((entry.key !== 'data' && entry.key !== 'stringData') || entry.value.kind !== 'object') {
842
+ return entry;
843
+ }
844
+ return {
845
+ ...entry,
846
+ value: {
847
+ ...entry.value,
848
+ entries: entry.value.entries.map((secretEntry) => ({
849
+ ...secretEntry,
850
+ value: classifySecretLeaf(secretEntry.value, logicalId, entry.key, secretEntry.key, diagnostics, sensitiveSpecPaths),
851
+ })),
852
+ },
853
+ };
854
+ }),
855
+ };
856
+ }
857
+ function inspectSensitiveSpecPaths(resources, specSchema, diagnostics) {
858
+ const paths = new Set();
859
+ for (const [logicalId, resource] of Object.entries(resources)) {
860
+ if (resource.kind !== 'Secret')
861
+ continue;
862
+ const lowered = lowerPlanValue(resource, { specSchema });
863
+ diagnostics.push(...lowered.diagnostics.map((diagnostic) => ({
864
+ ...diagnostic,
865
+ path: `$.nodes.${logicalId}.desired${diagnostic.path?.slice(1) ?? ''}`,
866
+ })));
867
+ if (lowered.value.kind !== 'object')
868
+ continue;
869
+ for (const entry of lowered.value.entries) {
870
+ if (entry.key === 'data' || entry.key === 'stringData') {
871
+ collectSensitiveSpecPaths(entry.value, paths);
872
+ }
873
+ }
874
+ }
875
+ return paths;
876
+ }
877
+ function redactConcreteSpecPath(value, segments, binding, index = 0) {
878
+ if (index === segments.length) {
879
+ switch (value.kind) {
880
+ case 'reference':
881
+ case 'expression':
882
+ case 'template':
883
+ case 'sensitive-binding':
884
+ case 'sensitive-value':
885
+ case 'external-input':
886
+ case 'artifact-output':
887
+ case 'omitted':
888
+ return value;
889
+ default:
890
+ return { kind: 'sensitive-binding', binding };
891
+ }
892
+ }
893
+ const segment = segments[index];
894
+ if (!segment)
895
+ return value;
896
+ if (value.kind === 'object') {
897
+ return {
898
+ ...value,
899
+ entries: value.entries.map((entry) => entry.key === segment
900
+ ? {
901
+ ...entry,
902
+ value: redactConcreteSpecPath(entry.value, segments, binding, index + 1),
903
+ }
904
+ : entry),
905
+ };
906
+ }
907
+ if (value.kind === 'array' && (segment === '$item' || /^\d+$/.test(segment))) {
908
+ const indexes = segment === '$item' ? value.items.map((_, itemIndex) => itemIndex) : [Number(segment)];
909
+ const selected = new Set(indexes);
910
+ return {
911
+ ...value,
912
+ items: value.items.map((item, itemIndex) => selected.has(itemIndex) ? redactConcreteSpecPath(item, segments, binding, index + 1) : item),
913
+ };
914
+ }
915
+ return value;
916
+ }
917
+ function redactSensitiveSpecValues(value, paths) {
918
+ return [...paths]
919
+ .sort()
920
+ .reduce((current, fieldPath) => redactConcreteSpecPath(current, fieldPath.split('.').filter(Boolean), `spec/${fieldPath.replaceAll('.', '/')}`), value);
921
+ }
922
+ function lifecyclePolicy(resource) {
923
+ const external = Reflect.get(resource, '__externalRef') === true;
924
+ const scopes = getMetadataField(resource, 'scopes') ?? [];
925
+ const legacyShared = getMetadataField(resource, 'lifecycle') === 'shared';
926
+ const shared = scopes.length > 0 || legacyShared || external;
927
+ return {
928
+ creation: external ? 'require-existing' : 'create',
929
+ management: external ? 'reference-only' : 'authoritative',
930
+ deletion: shared ? 'retain' : 'delete',
931
+ instancing: scopes.length > 0
932
+ ? { kind: 'per-scope', key: lowerPlanValue([...scopes].sort().join('|')).value }
933
+ : { kind: 'per-instance' },
934
+ sharing: shared ? 'shareable' : 'exclusive',
935
+ };
936
+ }
937
+ function buildResourceNodes(graph, diagnostics, capturedResources, nestedStatusMappings, specSchema, preserveCapturedDynamics = false) {
938
+ const nodes = [];
939
+ const graphIdToLogical = new Map();
940
+ const referenceIdToLogical = new Map();
941
+ const canonicalizers = new Map();
942
+ const representationRequirements = [];
943
+ const sensitiveSpecPaths = new Set(preserveCapturedDynamics
944
+ ? inspectSensitiveSpecPaths(capturedResources, specSchema, diagnostics)
945
+ : []);
946
+ const capturedResourceByLogicalId = new Map();
947
+ for (const [captureId, resource] of Object.entries(capturedResources)) {
948
+ capturedResourceByLogicalId.set(captureId, resource);
949
+ const resourceId = getResourceId(resource);
950
+ if (resourceId)
951
+ capturedResourceByLogicalId.set(resourceId, resource);
952
+ }
953
+ const lower = (value) => lowerPlanValue(value, { specSchema });
954
+ const lowerAnalyzedExpression = (value) => {
955
+ if (typeof value === 'string' && value.startsWith('${') && value.endsWith('}')) {
956
+ return {
957
+ kind: 'expression',
958
+ expression: expressionIR(value.slice(2, -1)),
959
+ };
960
+ }
961
+ return lower(value).value;
962
+ };
963
+ const iterationDimensions = (dimensions, logicalId) => {
964
+ const itemPathByVariable = new Map();
965
+ return dimensions.flatMap((dimension, index) => {
966
+ const entries = Object.entries(dimension);
967
+ const entry = entries[0];
968
+ if (entries.length !== 1 || !entry) {
969
+ diagnostics.push({
970
+ code: 'PLAN_ITERATION_DIMENSION_INVALID',
971
+ severity: 'error',
972
+ message: `Iteration dimension ${index} on ${logicalId} must contain exactly one variable and collection expression.`,
973
+ path: `$.nodes.${logicalId}.iteration[${index}]`,
974
+ });
975
+ return [];
976
+ }
977
+ const [variable, wrappedExpression] = entry;
978
+ const expression = wrappedExpression.startsWith('${') && wrappedExpression.endsWith('}')
979
+ ? wrappedExpression.slice(2, -1)
980
+ : wrappedExpression;
981
+ const collectionRoot = expression.split(/\.(?:filter|map)\s*\(/, 1)[0]?.trim();
982
+ let itemPath;
983
+ if (collectionRoot?.startsWith('schema.spec.')) {
984
+ itemPath = `${collectionRoot.slice('schema.spec.'.length)}.$item`;
985
+ }
986
+ else if (collectionRoot) {
987
+ const [parentVariable, ...suffix] = collectionRoot.split('.');
988
+ const parentPath = parentVariable ? itemPathByVariable.get(parentVariable) : undefined;
989
+ if (parentPath) {
990
+ itemPath = `${parentPath}${suffix.length > 0 ? `.${suffix.join('.')}` : ''}.$item`;
991
+ }
992
+ }
993
+ if (!itemPath) {
994
+ diagnostics.push({
995
+ code: 'PLAN_ITERATION_ITEM_PATH_UNRESOLVED',
996
+ severity: 'error',
997
+ message: `Iteration dimension ${variable} on ${logicalId} has no resolvable schema item path.`,
998
+ path: `$.nodes.${logicalId}.iteration[${index}]`,
999
+ details: { expression },
1000
+ });
1001
+ return [];
1002
+ }
1003
+ itemPathByVariable.set(variable, itemPath);
1004
+ return [
1005
+ {
1006
+ variable,
1007
+ collection: { kind: 'expression', expression: expressionIR(expression) },
1008
+ itemPath,
1009
+ },
1010
+ ];
1011
+ });
1012
+ };
1013
+ const appendResourceNode = (resource, fallbackId) => {
1014
+ const logicalId = getResourceId(resource) ?? fallbackId;
1015
+ if (nodes.some((node) => node.id === logicalId))
1016
+ return;
1017
+ referenceIdToLogical.set(logicalId, logicalId);
1018
+ const canonicalized = canonicalizeResource(resource, diagnostics);
1019
+ representationRequirements.push(...factoryRepresentationRequirements(resource, logicalId, diagnostics));
1020
+ canonicalized.canonicalizers.forEach((entry) => canonicalizers.set(entry.id, entry));
1021
+ const desired = lower(canonicalized.resource);
1022
+ diagnostics.push(...desired.diagnostics.map((diagnostic) => ({
1023
+ ...diagnostic,
1024
+ path: `$.nodes.${logicalId}.desired${diagnostic.path?.slice(1) ?? ''}`,
1025
+ })));
1026
+ const iteration = iterationDimensions(getForEach(resource) ?? [], logicalId);
1027
+ const activation = (getMetadataField(resource, 'includeWhen') ?? []).map((condition) => markNestedStatusReferences(lowerAnalyzedExpression(condition), nestedStatusMappings));
1028
+ const readiness = (getMetadataField(resource, 'readyWhen') ?? []).map((condition) => typeof condition === 'function'
1029
+ ? {
1030
+ kind: 'expression',
1031
+ expression: expressionIR(convertReadyWhenCallbackToCel(condition, iteration.length > 0 ? 'each' : logicalId)),
1032
+ }
1033
+ : markNestedStatusReferences(lowerAnalyzedExpression(condition), nestedStatusMappings));
1034
+ const templateOverrides = (getTemplateOverrides(resource) ?? []).map((override) => ({
1035
+ propertyPath: override.propertyPath,
1036
+ value: lowerAnalyzedExpression(override.celExpression),
1037
+ }));
1038
+ const evaluator = getReadinessEvaluator(resource);
1039
+ const readinessStrategy = getMetadataField(resource, 'readinessStrategy') ??
1040
+ (evaluator ? getPortableReadinessStrategy(evaluator) : undefined) ??
1041
+ (evaluator
1042
+ ? {
1043
+ kind: 'runtime-binding',
1044
+ binding: `readiness:${logicalId}`,
1045
+ version: 1,
1046
+ classification: getRuntimeReadinessClassification(evaluator) ?? {
1047
+ reason: 'unclassified-evaluator',
1048
+ description: 'This evaluator has not declared whether it can be reconstructed from canonical artifact data.',
1049
+ },
1050
+ }
1051
+ : undefined);
1052
+ if (readinessStrategy?.kind === 'runtime-binding' &&
1053
+ readinessStrategy.classification?.reason === 'unclassified-evaluator') {
1054
+ diagnostics.push({
1055
+ code: 'PLAN_READINESS_EVALUATOR_UNCLASSIFIED',
1056
+ severity: 'error',
1057
+ message: `Readiness evaluator on ${logicalId} has no durable strategy or explicit runtime classification. ` +
1058
+ `Register deterministic evaluators with registerPortableReadinessEvaluator(), or mark process-local behavior with identifyRuntimeReadinessEvaluator().`,
1059
+ path: `$.nodes.${logicalId}.readinessStrategy`,
1060
+ details: { binding: readinessStrategy.binding },
1061
+ });
1062
+ }
1063
+ const capturedResource = preserveCapturedDynamics
1064
+ ? capturedResourceByLogicalId.get(logicalId)
1065
+ : undefined;
1066
+ const capturedDesired = capturedResource ? lower(capturedResource) : undefined;
1067
+ if (capturedDesired) {
1068
+ diagnostics.push(...capturedDesired.diagnostics.map((diagnostic) => ({
1069
+ ...diagnostic,
1070
+ path: `$.nodes.${logicalId}.capturedDesired${diagnostic.path?.slice(1) ?? ''}`,
1071
+ })));
1072
+ }
1073
+ const mergedDesired = capturedDesired
1074
+ ? preserveCapturedDynamicValue(desired.value, markNestedStatusReferences(capturedDesired.value, nestedStatusMappings), sensitiveSpecPaths)
1075
+ : desired.value;
1076
+ const publicSecretPlaceholder = canonicalized.resource.kind === 'Secret' &&
1077
+ getMetadataField(resource, 'secretMaterial') === 'public-placeholder';
1078
+ if (publicSecretPlaceholder) {
1079
+ diagnostics.push({
1080
+ code: 'PLAN_PUBLIC_SECRET_PLACEHOLDER',
1081
+ severity: 'warning',
1082
+ message: `Secret ${logicalId} explicitly contains public placeholder material.`,
1083
+ path: `$.nodes.${logicalId}.desired`,
1084
+ details: { classification: 'public-placeholder' },
1085
+ });
1086
+ }
1087
+ const desiredValue = markNestedStatusReferences(canonicalized.resource.kind === 'Secret' && !publicSecretPlaceholder
1088
+ ? classifySecretValues(mergedDesired, logicalId, diagnostics, sensitiveSpecPaths)
1089
+ : mergedDesired, nestedStatusMappings);
1090
+ const requiredCapabilities = uniqueCapabilities([
1091
+ ...planValueCapabilities(desiredValue, logicalId),
1092
+ ...activation.flatMap((value) => planValueCapabilities(value, logicalId)),
1093
+ ...readiness.flatMap((value) => planValueCapabilities(value, logicalId)),
1094
+ ...(iteration.length > 0 ? [{ id: 'typekro.iteration', version: 1, nodeId: logicalId }] : []),
1095
+ ...(templateOverrides.length > 0
1096
+ ? [
1097
+ {
1098
+ id: 'typekro.template-overrides',
1099
+ version: 1,
1100
+ nodeId: logicalId,
1101
+ },
1102
+ ]
1103
+ : []),
1104
+ ]);
1105
+ nodes.push({
1106
+ id: logicalId,
1107
+ type: 'kubernetes-resource',
1108
+ identity: resourceIdentity(canonicalized.resource, specSchema),
1109
+ desired: desiredValue,
1110
+ lifecycle: lifecyclePolicy(resource),
1111
+ activation,
1112
+ readiness,
1113
+ ...(readinessStrategy ? { readinessStrategy } : {}),
1114
+ ...(iteration.length > 0 ? { iteration } : {}),
1115
+ ...(templateOverrides.length > 0 ? { templateOverrides } : {}),
1116
+ requiredCapabilities,
1117
+ });
1118
+ };
1119
+ for (const graphResource of graph.resources) {
1120
+ const logicalId = getResourceId(graphResource.manifest) ?? graphResource.id;
1121
+ graphIdToLogical.set(graphResource.id, logicalId);
1122
+ appendResourceNode(graphResource.manifest, graphResource.id);
1123
+ }
1124
+ // Direct materialization intentionally omits require-existing resources from
1125
+ // its apply graph. They remain semantic nodes, so recover them from capture
1126
+ // without treating them as deployable resources.
1127
+ for (const [captureId, resource] of Object.entries(capturedResources)) {
1128
+ if (Reflect.get(resource, '__externalRef') === true) {
1129
+ appendResourceNode(resource, captureId);
1130
+ }
1131
+ }
1132
+ for (let index = 0; index < nodes.length; index += 1) {
1133
+ const node = nodes[index];
1134
+ if (!node)
1135
+ continue;
1136
+ const desired = node.desired
1137
+ ? markSensitiveSpecReferences(node.desired, sensitiveSpecPaths)
1138
+ : undefined;
1139
+ const activation = node.activation.map((value) => markSensitiveSpecReferences(value, sensitiveSpecPaths));
1140
+ const readiness = node.readiness.map((value) => markSensitiveSpecReferences(value, sensitiveSpecPaths));
1141
+ const iteration = node.iteration?.map((dimension) => ({
1142
+ ...dimension,
1143
+ collection: markSensitiveSpecReferences(dimension.collection, sensitiveSpecPaths),
1144
+ }));
1145
+ const templateOverrides = node.templateOverrides?.map((override) => ({
1146
+ ...override,
1147
+ value: markSensitiveSpecReferences(override.value, sensitiveSpecPaths),
1148
+ }));
1149
+ activation.forEach((value, conditionIndex) => diagnoseSensitiveControlFlow(diagnostics, node.id, 'activation', value, `$.nodes.${node.id}.activation[${conditionIndex}]`, sensitiveSpecPaths));
1150
+ readiness.forEach((value, conditionIndex) => diagnoseSensitiveControlFlow(diagnostics, node.id, 'readiness', value, `$.nodes.${node.id}.readiness[${conditionIndex}]`, sensitiveSpecPaths));
1151
+ iteration?.forEach((dimension, dimensionIndex) => diagnoseSensitiveControlFlow(diagnostics, node.id, 'iteration', dimension.collection, `$.nodes.${node.id}.iteration[${dimensionIndex}].collection`, sensitiveSpecPaths));
1152
+ nodes[index] = {
1153
+ ...node,
1154
+ ...(desired ? { desired } : {}),
1155
+ activation,
1156
+ readiness,
1157
+ ...(iteration ? { iteration } : {}),
1158
+ ...(templateOverrides ? { templateOverrides } : {}),
1159
+ requiredCapabilities: uniqueCapabilities([
1160
+ ...node.requiredCapabilities,
1161
+ ...(desired ? planValueCapabilities(desired, node.id) : []),
1162
+ ...activation.flatMap((value) => planValueCapabilities(value, node.id)),
1163
+ ...readiness.flatMap((value) => planValueCapabilities(value, node.id)),
1164
+ ...(iteration ?? []).flatMap((dimension) => planValueCapabilities(dimension.collection, node.id)),
1165
+ ...(templateOverrides ?? []).flatMap((override) => planValueCapabilities(override.value, node.id)),
1166
+ ]),
1167
+ };
1168
+ }
1169
+ for (const node of nodes) {
1170
+ if (!node.identity)
1171
+ continue;
1172
+ const identityFields = [
1173
+ ['name', node.identity.name],
1174
+ ...(node.identity.namespace ? [['namespace', node.identity.namespace]] : []),
1175
+ ];
1176
+ for (const [field, value] of identityFields) {
1177
+ const sensitiveReferences = sensitiveSpecReferences(value, sensitiveSpecPaths);
1178
+ if (sensitiveReferences.length === 0)
1179
+ continue;
1180
+ diagnostics.push({
1181
+ code: 'PLAN_SENSITIVE_IDENTITY',
1182
+ severity: 'error',
1183
+ message: `Resource ${node.id} ${field} derives from sensitive spec data and would expose it through Kubernetes identity.`,
1184
+ path: `$.nodes.${node.id}.identity.${field}`,
1185
+ details: { sensitivePath: sensitiveReferences.join(',') },
1186
+ });
1187
+ }
1188
+ }
1189
+ const edges = [];
1190
+ for (const graphResource of graph.resources) {
1191
+ const dependent = graphIdToLogical.get(graphResource.id);
1192
+ if (!dependent)
1193
+ continue;
1194
+ for (const dependencyGraphId of graph.dependencyGraph.getDependencies(graphResource.id)) {
1195
+ const prerequisite = graphIdToLogical.get(dependencyGraphId);
1196
+ if (prerequisite)
1197
+ edges.push({ kind: 'existence', prerequisite, dependent });
1198
+ }
1199
+ const explicitReady = getMetadataField(graphResource.manifest, 'dependsOn') ?? [];
1200
+ for (const dependency of explicitReady) {
1201
+ const prerequisite = referenceIdToLogical.get(dependency.resourceId);
1202
+ if (prerequisite)
1203
+ edges.push({ kind: 'ready', prerequisite, dependent });
1204
+ }
1205
+ }
1206
+ for (const node of nodes) {
1207
+ if (!node.desired)
1208
+ continue;
1209
+ for (const reference of planValueReferences(node.desired)) {
1210
+ const producer = referenceIdToLogical.get(reference.resourceId);
1211
+ if (producer && producer !== node.id) {
1212
+ edges.push({ kind: 'output', producer, consumer: node.id, output: reference.fieldPath });
1213
+ }
1214
+ }
1215
+ }
1216
+ const uniqueEdges = [
1217
+ ...new Map(edges.map((edge) => [canonicalStringify(edge), edge])).values(),
1218
+ ].sort((left, right) => canonicalStringify(left).localeCompare(canonicalStringify(right)));
1219
+ return {
1220
+ nodes: nodes.sort((left, right) => left.id.localeCompare(right.id)),
1221
+ edges: uniqueEdges,
1222
+ canonicalizers: [...canonicalizers.values()].sort((left, right) => left.id.localeCompare(right.id)),
1223
+ representationRequirements: [...representationRequirements].sort((left, right) => canonicalStringify(left).localeCompare(canonicalStringify(right))),
1224
+ sensitiveSpecPaths,
1225
+ };
1226
+ }
1227
+ function closureNodes(capture) {
1228
+ const capability = {
1229
+ id: 'typekro.runtime-closure',
1230
+ version: 1,
1231
+ host: 'standalone',
1232
+ output: 'live',
1233
+ };
1234
+ return {
1235
+ nodes: capture.ir.compatibilityClosures.map((id) => ({
1236
+ id,
1237
+ type: 'compatibility-closure',
1238
+ lifecycle: {
1239
+ creation: 'create',
1240
+ management: 'cooperative',
1241
+ deletion: 'retain',
1242
+ instancing: { kind: 'per-instance' },
1243
+ sharing: 'exclusive',
1244
+ },
1245
+ activation: [],
1246
+ readiness: [],
1247
+ requiredCapabilities: [{ ...capability, nodeId: id }],
1248
+ })),
1249
+ capabilities: capture.ir.compatibilityClosures.length > 0 ? [capability] : [],
1250
+ };
1251
+ }
1252
+ /**
1253
+ * Build the target-neutral graph from captured authoring templates. Concrete
1254
+ * direct materialization is an adapter concern and must not erase spec
1255
+ * references or specialize graph shape before KRO compilation.
1256
+ */
1257
+ function symbolicResourceGraph(capture, options, aspectMode) {
1258
+ // Applying aspects to symbolic values preserves their authoring order and
1259
+ // keeps the resulting desired state in the semantic digest. KRO-specific
1260
+ // capability rejection remains a compiler responsibility.
1261
+ const resources = applyAspects(capture.ir.resources, {
1262
+ mode: aspectMode,
1263
+ aspects: options.aspects ?? [],
1264
+ });
1265
+ const deployable = Object.entries(resources).map(([logicalId, resource]) => {
1266
+ const manifest = { ...resource };
1267
+ Object.defineProperty(manifest, 'id', {
1268
+ value: logicalId,
1269
+ enumerable: false,
1270
+ configurable: true,
1271
+ });
1272
+ copyResourceMetadata(resource, manifest);
1273
+ setResourceId(manifest, getResourceId(resource) ?? logicalId);
1274
+ return manifest;
1275
+ });
1276
+ return {
1277
+ name: `${capture.ir.definition.name}-symbolic`,
1278
+ resources: deployable.map((manifest) => ({ id: manifest.id, manifest })),
1279
+ dependencyGraph: new DependencyResolver().buildDependencyGraph(deployable),
1280
+ };
1281
+ }
1282
+ function instanceName(spec, fallback) {
1283
+ if (spec && typeof spec === 'object') {
1284
+ const name = Reflect.get(spec, 'name');
1285
+ if (typeof name === 'string' && name.length > 0)
1286
+ return lowerPlanValue(name).value;
1287
+ }
1288
+ return lowerPlanValue(fallback).value;
1289
+ }
1290
+ function buildPlanOnce(capture, spec, options, materializedGraph, shouldValidateSpec = true, aspectMode = 'direct') {
1291
+ const diagnostics = [];
1292
+ if (shouldValidateSpec)
1293
+ capture.validate(spec);
1294
+ diagnostics.push(...purityDiagnostics(capture.diagnosticSource));
1295
+ const plannedSpec = lowerPlanValue(spec);
1296
+ diagnostics.push(...plannedSpec.diagnostics.map((diagnostic) => ({
1297
+ ...diagnostic,
1298
+ path: `$.spec${diagnostic.path?.slice(1) ?? ''}`,
1299
+ })));
1300
+ const identity = compositionIdentity(capture);
1301
+ const specSchema = schemaToIR(capture.ir.definition.specSchema, { strict: false });
1302
+ diagnostics.push(...specSchema.diagnostics);
1303
+ const inputs = inputManifest(options, diagnostics);
1304
+ const aspects = createAspectManifest(options.aspects);
1305
+ diagnostics.push(...aspects.diagnostics);
1306
+ const graph = materializedGraph ?? symbolicResourceGraph(capture, options, aspectMode);
1307
+ const resources = buildResourceNodes(graph, diagnostics, capture.ir.resources, capture.ir.nestedStatusMappings, specSchema, materializedGraph !== undefined);
1308
+ const status = buildStatusContract(capture, diagnostics, false, specSchema, resources.sensitiveSpecPaths);
1309
+ const semanticSpec = redactSensitiveSpecValues(plannedSpec.value, resources.sensitiveSpecPaths);
1310
+ const closures = closureNodes(capture);
1311
+ const capturedRequirements = capture.representationRequirements();
1312
+ diagnostics.push(...capturedRequirements.diagnostics);
1313
+ const representationRequirements = [
1314
+ ...capturedRequirements.requirements,
1315
+ ...resources.representationRequirements,
1316
+ ].sort((left, right) => canonicalStringify(left).localeCompare(canonicalStringify(right)));
1317
+ representationRequirements.forEach((requirement, index) => {
1318
+ if (requirement.extension.length === 0 ||
1319
+ requirement.kind.length === 0 ||
1320
+ !Number.isSafeInteger(requirement.version) ||
1321
+ requirement.version < 1) {
1322
+ diagnostics.push({
1323
+ code: 'PLAN_REPRESENTATION_REQUIREMENT_INVALID',
1324
+ severity: 'error',
1325
+ message: `Representation requirement ${index} must have a non-empty extension/kind and positive integer version.`,
1326
+ path: `$.representationRequirements[${index}]`,
1327
+ });
1328
+ }
1329
+ });
1330
+ const requiredCapabilities = uniqueCapabilities([
1331
+ ...resources.nodes.flatMap((node) => node.requiredCapabilities),
1332
+ ...closures.capabilities,
1333
+ ...inputs.flatMap((input) => {
1334
+ if (input.kind === 'ordinary')
1335
+ return planValueCapabilities(input.value);
1336
+ if (input.kind === 'sensitive') {
1337
+ return [{ id: 'typekro.sensitive-materialization', version: 1 }];
1338
+ }
1339
+ return [
1340
+ {
1341
+ id: 'typekro.artifact-input',
1342
+ version: 1,
1343
+ host: 'alchemy',
1344
+ output: 'live',
1345
+ },
1346
+ ];
1347
+ }),
1348
+ ...Object.values(status.outputs).flatMap((value) => planValueCapabilities(value)),
1349
+ ...representationRequirements.map((requirement) => ({
1350
+ id: requirement.extension,
1351
+ version: requirement.version,
1352
+ target: requirement.target,
1353
+ })),
1354
+ ]);
1355
+ const durabilityReasons = [];
1356
+ if (identity.stability === 'preview-unstable') {
1357
+ durabilityReasons.push({
1358
+ code: 'PLAN_IDENTITY_PREVIEW_UNSTABLE',
1359
+ severity: 'warning',
1360
+ message: 'Composition has no explicit version or compiler-produced bundle digest.',
1361
+ path: '$.composition',
1362
+ });
1363
+ }
1364
+ if (!aspects.stable)
1365
+ durabilityReasons.push(...aspects.diagnostics);
1366
+ const canonicalizers = resources.canonicalizers;
1367
+ const semanticPayload = {
1368
+ version: 1,
1369
+ schemas: {
1370
+ specDigest: specSchema.digest,
1371
+ persistedStatusDigest: status.contract.persistedSchema.digest,
1372
+ hydratedStatusDigest: status.contract.hydratedSchema.digest,
1373
+ },
1374
+ instance: {
1375
+ composition: capture.ir.definition.name,
1376
+ name: instanceName(spec, capture.ir.definition.name),
1377
+ },
1378
+ spec: semanticSpec,
1379
+ nodes: [...resources.nodes, ...closures.nodes].sort((left, right) => left.id.localeCompare(right.id)),
1380
+ edges: resources.edges,
1381
+ outputs: status.outputs,
1382
+ inputs,
1383
+ aspects: aspects.manifest,
1384
+ representationRequirements,
1385
+ canonicalizers,
1386
+ requiredCapabilities,
1387
+ };
1388
+ validateArtifactRequirements(inputs, {
1389
+ spec: semanticSpec,
1390
+ nodes: semanticPayload.nodes,
1391
+ outputs: status.outputs,
1392
+ representationRequirements,
1393
+ }, diagnostics);
1394
+ const semanticContentDigest = canonicalDigest(semanticPayload);
1395
+ const planIdentityDigest = canonicalDigest({ composition: identity, semanticContentDigest });
1396
+ return {
1397
+ version: 1,
1398
+ composition: identity,
1399
+ schemas: {
1400
+ irVersion: 1,
1401
+ spec: specSchema,
1402
+ specDigest: specSchema.digest,
1403
+ persistedStatusDigest: status.contract.persistedSchema.digest,
1404
+ hydratedStatusDigest: status.contract.hydratedSchema.digest,
1405
+ },
1406
+ status: status.contract,
1407
+ instance: semanticPayload.instance,
1408
+ spec: semanticSpec,
1409
+ nodes: semanticPayload.nodes,
1410
+ edges: resources.edges,
1411
+ outputs: status.outputs,
1412
+ inputs,
1413
+ aspects: aspects.manifest,
1414
+ representationRequirements,
1415
+ provenance: { canonicalizers },
1416
+ requiredCapabilities,
1417
+ durability: {
1418
+ cacheEligible: durabilityReasons.length === 0,
1419
+ provenanceEligible: durabilityReasons.length === 0,
1420
+ reasons: durabilityReasons,
1421
+ },
1422
+ inputDigest: canonicalDigest(inputs),
1423
+ aspectDigest: aspects.digest,
1424
+ semanticContentDigest,
1425
+ planIdentityDigest,
1426
+ diagnostics: [...diagnostics, ...durabilityReasons],
1427
+ };
1428
+ }
1429
+ /** Produce static inspection from the same capture used by planning. */
1430
+ export function inspectCapturedComposition(capture) {
1431
+ const diagnostics = [];
1432
+ diagnostics.push(...purityDiagnostics(capture.diagnosticSource));
1433
+ const specSchema = schemaToIR(capture.ir.definition.specSchema, { strict: false });
1434
+ diagnostics.push(...specSchema.diagnostics);
1435
+ const sensitiveSpecPaths = inspectSensitiveSpecPaths(capture.ir.resources, specSchema, diagnostics);
1436
+ const status = buildStatusContract(capture, diagnostics, false, specSchema, sensitiveSpecPaths);
1437
+ const potentialCapabilities = uniqueCapabilities([
1438
+ ...capture.ir.potentialCapabilities,
1439
+ ...(sensitiveSpecPaths.size > 0
1440
+ ? [{ id: 'typekro.sensitive-materialization', version: 1 }]
1441
+ : []),
1442
+ ]);
1443
+ return {
1444
+ version: 1,
1445
+ composition: compositionIdentity(capture),
1446
+ specSchema,
1447
+ status: status.contract,
1448
+ potentialCapabilities,
1449
+ diagnostics,
1450
+ };
1451
+ }
1452
+ /** Produce a deterministic semantic plan without contacting Kubernetes or providers. */
1453
+ export function planCapturedComposition(capture, spec, options = {}) {
1454
+ const first = buildPlanOnce(capture, spec, options);
1455
+ if (options.strict) {
1456
+ const second = buildPlanOnce(capture, spec, { ...options, strict: false });
1457
+ if (first.semanticContentDigest !== second.semanticContentDigest) {
1458
+ throw new SemanticPlanningError('Planning produced nondeterministic semantic content.', [
1459
+ {
1460
+ code: 'PLAN_NONDETERMINISTIC',
1461
+ severity: 'error',
1462
+ message: 'Two planning passes over identical declared inputs produced different digests.',
1463
+ path: '$',
1464
+ details: {
1465
+ firstDigest: first.semanticContentDigest,
1466
+ secondDigest: second.semanticContentDigest,
1467
+ },
1468
+ },
1469
+ ]);
1470
+ }
1471
+ const errors = first.diagnostics.filter((diagnostic) => diagnostic.severity === 'error');
1472
+ if (errors.length > 0) {
1473
+ throw new SemanticPlanningError('Strict semantic planning rejected the composition.', errors);
1474
+ }
1475
+ }
1476
+ return first;
1477
+ }
1478
+ /** Build the shared symbolic plan used to compile a KRO graph definition. */
1479
+ export function planCapturedTemplate(capture, symbolicSpec, options = {}) {
1480
+ const first = buildPlanOnce(capture, symbolicSpec, options, undefined, false, 'kro');
1481
+ if (options.strict) {
1482
+ const second = buildPlanOnce(capture, symbolicSpec, { ...options, strict: false }, undefined, false, 'kro');
1483
+ if (first.semanticContentDigest !== second.semanticContentDigest) {
1484
+ throw new SemanticPlanningError('Template planning produced nondeterministic semantic content.', [
1485
+ {
1486
+ code: 'PLAN_NONDETERMINISTIC',
1487
+ severity: 'error',
1488
+ message: 'Two template-planning passes produced different semantic digests.',
1489
+ path: '$',
1490
+ details: {
1491
+ firstDigest: first.semanticContentDigest,
1492
+ secondDigest: second.semanticContentDigest,
1493
+ },
1494
+ },
1495
+ ]);
1496
+ }
1497
+ const errors = first.diagnostics.filter((diagnostic) => diagnostic.severity === 'error');
1498
+ if (errors.length > 0) {
1499
+ throw new SemanticPlanningError('Strict semantic template planning rejected the composition.', errors);
1500
+ }
1501
+ }
1502
+ return first;
1503
+ }
1504
+ /**
1505
+ * Plan an already materialized graph. This is the production bridge used by
1506
+ * factory facades so author code executes once per operation.
1507
+ */
1508
+ export function planMaterializedComposition(capture, spec, graph, options = {}) {
1509
+ const plan = buildPlanOnce(capture, spec, options, graph);
1510
+ if (options.strict) {
1511
+ const errors = plan.diagnostics.filter((diagnostic) => diagnostic.severity === 'error');
1512
+ if (errors.length > 0) {
1513
+ throw new SemanticPlanningError('Strict semantic planning rejected the composition.', errors);
1514
+ }
1515
+ }
1516
+ return plan;
1517
+ }
1518
+ //# sourceMappingURL=planner.js.map