typekro 0.3.0 → 0.4.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 (443) hide show
  1. package/README.md +142 -1054
  2. package/dist/.tsbuildinfo +1 -1
  3. package/dist/alchemy/deployers.d.ts +0 -5
  4. package/dist/alchemy/deployers.d.ts.map +1 -1
  5. package/dist/alchemy/deployers.js +25 -72
  6. package/dist/alchemy/deployers.js.map +1 -1
  7. package/dist/core/composition/imperative.d.ts +2 -2
  8. package/dist/core/composition/imperative.d.ts.map +1 -1
  9. package/dist/core/composition/imperative.js +394 -10
  10. package/dist/core/composition/imperative.js.map +1 -1
  11. package/dist/core/composition/typekro-runtime/typekro-runtime.d.ts +1 -9
  12. package/dist/core/composition/typekro-runtime/typekro-runtime.d.ts.map +1 -1
  13. package/dist/core/composition/typekro-runtime/typekro-runtime.js +76 -10
  14. package/dist/core/composition/typekro-runtime/typekro-runtime.js.map +1 -1
  15. package/dist/core/composition/typekro-runtime/types.d.ts +8 -5
  16. package/dist/core/composition/typekro-runtime/types.d.ts.map +1 -1
  17. package/dist/core/composition/typekro-runtime/types.js.map +1 -1
  18. package/dist/core/constants/brands.d.ts +20 -0
  19. package/dist/core/constants/brands.d.ts.map +1 -1
  20. package/dist/core/constants/brands.js +20 -0
  21. package/dist/core/constants/brands.js.map +1 -1
  22. package/dist/core/deployment/direct-factory.d.ts +36 -1
  23. package/dist/core/deployment/direct-factory.d.ts.map +1 -1
  24. package/dist/core/deployment/direct-factory.js +289 -4
  25. package/dist/core/deployment/direct-factory.js.map +1 -1
  26. package/dist/core/deployment/engine.d.ts +57 -2
  27. package/dist/core/deployment/engine.d.ts.map +1 -1
  28. package/dist/core/deployment/engine.js +677 -49
  29. package/dist/core/deployment/engine.js.map +1 -1
  30. package/dist/core/deployment/event-filter.d.ts.map +1 -1
  31. package/dist/core/deployment/event-filter.js +6 -7
  32. package/dist/core/deployment/event-filter.js.map +1 -1
  33. package/dist/core/deployment/event-monitor.d.ts +36 -2
  34. package/dist/core/deployment/event-monitor.d.ts.map +1 -1
  35. package/dist/core/deployment/event-monitor.js +183 -33
  36. package/dist/core/deployment/event-monitor.js.map +1 -1
  37. package/dist/core/deployment/kro-factory.d.ts +22 -0
  38. package/dist/core/deployment/kro-factory.d.ts.map +1 -1
  39. package/dist/core/deployment/kro-factory.js +291 -27
  40. package/dist/core/deployment/kro-factory.js.map +1 -1
  41. package/dist/core/deployment/readiness.d.ts.map +1 -1
  42. package/dist/core/deployment/readiness.js +4 -2
  43. package/dist/core/deployment/readiness.js.map +1 -1
  44. package/dist/core/deployment/rollback-manager.d.ts +2 -1
  45. package/dist/core/deployment/rollback-manager.d.ts.map +1 -1
  46. package/dist/core/deployment/rollback-manager.js +5 -2
  47. package/dist/core/deployment/rollback-manager.js.map +1 -1
  48. package/dist/core/deployment/shared-utilities.js.map +1 -1
  49. package/dist/core/deployment/status-hydrator.d.ts +1 -1
  50. package/dist/core/deployment/status-hydrator.d.ts.map +1 -1
  51. package/dist/core/deployment/status-hydrator.js +8 -5
  52. package/dist/core/deployment/status-hydrator.js.map +1 -1
  53. package/dist/core/deployment/strategies/base-strategy.d.ts.map +1 -1
  54. package/dist/core/deployment/strategies/base-strategy.js +60 -21
  55. package/dist/core/deployment/strategies/base-strategy.js.map +1 -1
  56. package/dist/core/deployment/strategies/direct-strategy.d.ts +7 -0
  57. package/dist/core/deployment/strategies/direct-strategy.d.ts.map +1 -1
  58. package/dist/core/deployment/strategies/direct-strategy.js +50 -0
  59. package/dist/core/deployment/strategies/direct-strategy.js.map +1 -1
  60. package/dist/core/deployment/strategies/kro-strategy.d.ts +5 -0
  61. package/dist/core/deployment/strategies/kro-strategy.d.ts.map +1 -1
  62. package/dist/core/deployment/strategies/kro-strategy.js +53 -4
  63. package/dist/core/deployment/strategies/kro-strategy.js.map +1 -1
  64. package/dist/core/evaluation/cel-optimizer.d.ts.map +1 -1
  65. package/dist/core/evaluation/cel-optimizer.js +7 -13
  66. package/dist/core/evaluation/cel-optimizer.js.map +1 -1
  67. package/dist/core/expressions/analyzer.d.ts +6 -6
  68. package/dist/core/expressions/analyzer.d.ts.map +1 -1
  69. package/dist/core/expressions/analyzer.js +40 -75
  70. package/dist/core/expressions/analyzer.js.map +1 -1
  71. package/dist/core/expressions/cel-conversion-engine.d.ts.map +1 -1
  72. package/dist/core/expressions/cel-conversion-engine.js +10 -11
  73. package/dist/core/expressions/cel-conversion-engine.js.map +1 -1
  74. package/dist/core/expressions/composition-integration.d.ts +2 -2
  75. package/dist/core/expressions/composition-integration.d.ts.map +1 -1
  76. package/dist/core/expressions/composition-integration.js +20 -12
  77. package/dist/core/expressions/composition-integration.js.map +1 -1
  78. package/dist/core/expressions/field-hydration-processor.d.ts +4 -1
  79. package/dist/core/expressions/field-hydration-processor.d.ts.map +1 -1
  80. package/dist/core/expressions/field-hydration-processor.js +12 -13
  81. package/dist/core/expressions/field-hydration-processor.js.map +1 -1
  82. package/dist/core/expressions/imperative-analyzer.d.ts.map +1 -1
  83. package/dist/core/expressions/imperative-analyzer.js +193 -49
  84. package/dist/core/expressions/imperative-analyzer.js.map +1 -1
  85. package/dist/core/expressions/index.d.ts +2 -0
  86. package/dist/core/expressions/index.d.ts.map +1 -1
  87. package/dist/core/expressions/index.js +2 -0
  88. package/dist/core/expressions/index.js.map +1 -1
  89. package/dist/core/expressions/magic-proxy-analyzer.d.ts +1 -1
  90. package/dist/core/expressions/magic-proxy-analyzer.d.ts.map +1 -1
  91. package/dist/core/expressions/magic-proxy-analyzer.js +8 -7
  92. package/dist/core/expressions/magic-proxy-analyzer.js.map +1 -1
  93. package/dist/core/expressions/parser.d.ts +163 -0
  94. package/dist/core/expressions/parser.d.ts.map +1 -0
  95. package/dist/core/expressions/parser.js +272 -0
  96. package/dist/core/expressions/parser.js.map +1 -0
  97. package/dist/core/expressions/status-builder-analyzer.d.ts.map +1 -1
  98. package/dist/core/expressions/status-builder-analyzer.js +15 -5
  99. package/dist/core/expressions/status-builder-analyzer.js.map +1 -1
  100. package/dist/core/kubernetes/api.d.ts.map +1 -1
  101. package/dist/core/kubernetes/api.js +5 -6
  102. package/dist/core/kubernetes/api.js.map +1 -1
  103. package/dist/core/kubernetes/bun-api-client.d.ts +95 -0
  104. package/dist/core/kubernetes/bun-api-client.d.ts.map +1 -0
  105. package/dist/core/kubernetes/bun-api-client.js +160 -0
  106. package/dist/core/kubernetes/bun-api-client.js.map +1 -0
  107. package/dist/core/kubernetes/bun-http-library.d.ts +38 -0
  108. package/dist/core/kubernetes/bun-http-library.d.ts.map +1 -0
  109. package/dist/core/kubernetes/bun-http-library.js +133 -0
  110. package/dist/core/kubernetes/bun-http-library.js.map +1 -0
  111. package/dist/core/kubernetes/client-provider.d.ts +3 -0
  112. package/dist/core/kubernetes/client-provider.d.ts.map +1 -1
  113. package/dist/core/kubernetes/client-provider.js +32 -23
  114. package/dist/core/kubernetes/client-provider.js.map +1 -1
  115. package/dist/core/kubernetes/errors.d.ts +189 -0
  116. package/dist/core/kubernetes/errors.d.ts.map +1 -0
  117. package/dist/core/kubernetes/errors.js +298 -0
  118. package/dist/core/kubernetes/errors.js.map +1 -0
  119. package/dist/core/kubernetes/index.d.ts +19 -0
  120. package/dist/core/kubernetes/index.d.ts.map +1 -0
  121. package/dist/core/kubernetes/index.js +23 -0
  122. package/dist/core/kubernetes/index.js.map +1 -0
  123. package/dist/core/kubernetes/type-guards.d.ts +142 -0
  124. package/dist/core/kubernetes/type-guards.d.ts.map +1 -0
  125. package/dist/core/kubernetes/type-guards.js +151 -0
  126. package/dist/core/kubernetes/type-guards.js.map +1 -0
  127. package/dist/core/logging/logger.d.ts.map +1 -1
  128. package/dist/core/logging/logger.js +8 -0
  129. package/dist/core/logging/logger.js.map +1 -1
  130. package/dist/core/readiness/cluster-state.d.ts.map +1 -1
  131. package/dist/core/readiness/cluster-state.js +6 -4
  132. package/dist/core/readiness/cluster-state.js.map +1 -1
  133. package/dist/core/references/cel-evaluator.d.ts.map +1 -1
  134. package/dist/core/references/cel-evaluator.js +12 -2
  135. package/dist/core/references/cel-evaluator.js.map +1 -1
  136. package/dist/core/references/cel.d.ts +13 -1
  137. package/dist/core/references/cel.d.ts.map +1 -1
  138. package/dist/core/references/cel.js +50 -0
  139. package/dist/core/references/cel.js.map +1 -1
  140. package/dist/core/references/resolver.d.ts +28 -1
  141. package/dist/core/references/resolver.d.ts.map +1 -1
  142. package/dist/core/references/resolver.js +325 -11
  143. package/dist/core/references/resolver.js.map +1 -1
  144. package/dist/core/references/schema-proxy.d.ts.map +1 -1
  145. package/dist/core/references/schema-proxy.js +27 -13
  146. package/dist/core/references/schema-proxy.js.map +1 -1
  147. package/dist/core/scope/resolver.d.ts +16 -0
  148. package/dist/core/scope/resolver.d.ts.map +1 -0
  149. package/dist/core/scope/resolver.js +45 -0
  150. package/dist/core/scope/resolver.js.map +1 -0
  151. package/dist/core/serialization/core.d.ts +1 -1
  152. package/dist/core/serialization/core.d.ts.map +1 -1
  153. package/dist/core/serialization/core.js +78 -54
  154. package/dist/core/serialization/core.js.map +1 -1
  155. package/dist/core/types/common.d.ts +23 -1
  156. package/dist/core/types/common.d.ts.map +1 -1
  157. package/dist/core/types/deployment.d.ts +71 -1
  158. package/dist/core/types/deployment.d.ts.map +1 -1
  159. package/dist/core/types/deployment.js +24 -0
  160. package/dist/core/types/deployment.js.map +1 -1
  161. package/dist/core/types/factory-scope.d.ts +42 -0
  162. package/dist/core/types/factory-scope.d.ts.map +1 -0
  163. package/dist/core/types/factory-scope.js +14 -0
  164. package/dist/core/types/factory-scope.js.map +1 -0
  165. package/dist/core/types/kubernetes.d.ts +146 -4
  166. package/dist/core/types/kubernetes.d.ts.map +1 -1
  167. package/dist/core/types/references.d.ts +47 -3
  168. package/dist/core/types/references.d.ts.map +1 -1
  169. package/dist/core/types/references.js.map +1 -1
  170. package/dist/core/types/serialization.d.ts +17 -6
  171. package/dist/core/types/serialization.d.ts.map +1 -1
  172. package/dist/core/utils/crd-patcher.d.ts +30 -0
  173. package/dist/core/utils/crd-patcher.d.ts.map +1 -0
  174. package/dist/core/utils/crd-patcher.js +198 -0
  175. package/dist/core/utils/crd-patcher.js.map +1 -0
  176. package/dist/core/utils/crd-schema-fix.d.ts +108 -0
  177. package/dist/core/utils/crd-schema-fix.d.ts.map +1 -0
  178. package/dist/core/utils/crd-schema-fix.js +245 -0
  179. package/dist/core/utils/crd-schema-fix.js.map +1 -0
  180. package/dist/core/utils/index.d.ts +12 -0
  181. package/dist/core/utils/index.d.ts.map +1 -0
  182. package/dist/core/utils/index.js +12 -0
  183. package/dist/core/utils/index.js.map +1 -0
  184. package/dist/core/utils/minimal-connection-reset-suppression.d.ts +16 -0
  185. package/dist/core/utils/minimal-connection-reset-suppression.d.ts.map +1 -0
  186. package/dist/core/utils/minimal-connection-reset-suppression.js +72 -0
  187. package/dist/core/utils/minimal-connection-reset-suppression.js.map +1 -0
  188. package/dist/core/utils/output-filter.d.ts +16 -0
  189. package/dist/core/utils/output-filter.d.ts.map +1 -0
  190. package/dist/core/utils/output-filter.js +90 -0
  191. package/dist/core/utils/output-filter.js.map +1 -0
  192. package/dist/core/utils/scoped-error-suppression.d.ts +25 -0
  193. package/dist/core/utils/scoped-error-suppression.d.ts.map +1 -0
  194. package/dist/core/utils/scoped-error-suppression.js +226 -0
  195. package/dist/core/utils/scoped-error-suppression.js.map +1 -0
  196. package/dist/core/validation/cel-validator.d.ts.map +1 -1
  197. package/dist/core/validation/cel-validator.js +51 -15
  198. package/dist/core/validation/cel-validator.js.map +1 -1
  199. package/dist/factories/apisix/compositions/apisix-bootstrap.d.ts +38 -0
  200. package/dist/factories/apisix/compositions/apisix-bootstrap.d.ts.map +1 -0
  201. package/dist/factories/apisix/compositions/apisix-bootstrap.js +280 -0
  202. package/dist/factories/apisix/compositions/apisix-bootstrap.js.map +1 -0
  203. package/dist/factories/apisix/compositions/index.d.ts +5 -0
  204. package/dist/factories/apisix/compositions/index.d.ts.map +1 -0
  205. package/dist/factories/apisix/compositions/index.js +5 -0
  206. package/dist/factories/apisix/compositions/index.js.map +1 -0
  207. package/dist/factories/apisix/index.d.ts +11 -0
  208. package/dist/factories/apisix/index.d.ts.map +1 -0
  209. package/dist/factories/apisix/index.js +11 -0
  210. package/dist/factories/apisix/index.js.map +1 -0
  211. package/dist/factories/apisix/resources/helm.d.ts +59 -0
  212. package/dist/factories/apisix/resources/helm.d.ts.map +1 -0
  213. package/dist/factories/apisix/resources/helm.js +175 -0
  214. package/dist/factories/apisix/resources/helm.js.map +1 -0
  215. package/dist/factories/apisix/resources/index.d.ts +5 -0
  216. package/dist/factories/apisix/resources/index.d.ts.map +1 -0
  217. package/dist/factories/apisix/resources/index.js +5 -0
  218. package/dist/factories/apisix/resources/index.js.map +1 -0
  219. package/dist/factories/apisix/types.d.ts +339 -0
  220. package/dist/factories/apisix/types.d.ts.map +1 -0
  221. package/dist/factories/apisix/types.js +88 -0
  222. package/dist/factories/apisix/types.js.map +1 -0
  223. package/dist/factories/apisix/utils/helm-values-mapper.d.ts +19 -0
  224. package/dist/factories/apisix/utils/helm-values-mapper.d.ts.map +1 -0
  225. package/dist/factories/apisix/utils/helm-values-mapper.js +108 -0
  226. package/dist/factories/apisix/utils/helm-values-mapper.js.map +1 -0
  227. package/dist/factories/apisix/utils/index.d.ts +5 -0
  228. package/dist/factories/apisix/utils/index.d.ts.map +1 -0
  229. package/dist/factories/apisix/utils/index.js +5 -0
  230. package/dist/factories/apisix/utils/index.js.map +1 -0
  231. package/dist/factories/cert-manager/compositions/cert-manager-bootstrap.d.ts +45 -0
  232. package/dist/factories/cert-manager/compositions/cert-manager-bootstrap.d.ts.map +1 -0
  233. package/dist/factories/cert-manager/compositions/cert-manager-bootstrap.js +323 -0
  234. package/dist/factories/cert-manager/compositions/cert-manager-bootstrap.js.map +1 -0
  235. package/dist/factories/cert-manager/compositions/index.d.ts +2 -0
  236. package/dist/factories/cert-manager/compositions/index.d.ts.map +1 -0
  237. package/dist/factories/cert-manager/compositions/index.js +2 -0
  238. package/dist/factories/cert-manager/compositions/index.js.map +1 -0
  239. package/dist/factories/cert-manager/index.d.ts +10 -0
  240. package/dist/factories/cert-manager/index.d.ts.map +1 -0
  241. package/dist/factories/cert-manager/index.js +19 -0
  242. package/dist/factories/cert-manager/index.js.map +1 -0
  243. package/dist/factories/cert-manager/resources/certificates.d.ts +39 -0
  244. package/dist/factories/cert-manager/resources/certificates.d.ts.map +1 -0
  245. package/dist/factories/cert-manager/resources/certificates.js +132 -0
  246. package/dist/factories/cert-manager/resources/certificates.js.map +1 -0
  247. package/dist/factories/cert-manager/resources/challenges.d.ts +113 -0
  248. package/dist/factories/cert-manager/resources/challenges.d.ts.map +1 -0
  249. package/dist/factories/cert-manager/resources/challenges.js +281 -0
  250. package/dist/factories/cert-manager/resources/challenges.js.map +1 -0
  251. package/dist/factories/cert-manager/resources/helm.d.ts +57 -0
  252. package/dist/factories/cert-manager/resources/helm.d.ts.map +1 -0
  253. package/dist/factories/cert-manager/resources/helm.js +390 -0
  254. package/dist/factories/cert-manager/resources/helm.js.map +1 -0
  255. package/dist/factories/cert-manager/resources/index.d.ts +5 -0
  256. package/dist/factories/cert-manager/resources/index.d.ts.map +1 -0
  257. package/dist/factories/cert-manager/resources/index.js +6 -0
  258. package/dist/factories/cert-manager/resources/index.js.map +1 -0
  259. package/dist/factories/cert-manager/resources/issuers.d.ts +79 -0
  260. package/dist/factories/cert-manager/resources/issuers.d.ts.map +1 -0
  261. package/dist/factories/cert-manager/resources/issuers.js +204 -0
  262. package/dist/factories/cert-manager/resources/issuers.js.map +1 -0
  263. package/dist/factories/cert-manager/types.d.ts +1015 -0
  264. package/dist/factories/cert-manager/types.d.ts.map +1 -0
  265. package/dist/factories/cert-manager/types.js +198 -0
  266. package/dist/factories/cert-manager/types.js.map +1 -0
  267. package/dist/factories/cert-manager/utils/helm-values-mapper.d.ts +19 -0
  268. package/dist/factories/cert-manager/utils/helm-values-mapper.d.ts.map +1 -0
  269. package/dist/factories/cert-manager/utils/helm-values-mapper.js +117 -0
  270. package/dist/factories/cert-manager/utils/helm-values-mapper.js.map +1 -0
  271. package/dist/factories/cert-manager/utils/index.d.ts +2 -0
  272. package/dist/factories/cert-manager/utils/index.d.ts.map +1 -0
  273. package/dist/factories/cert-manager/utils/index.js +2 -0
  274. package/dist/factories/cert-manager/utils/index.js.map +1 -0
  275. package/dist/factories/cilium/compositions/cilium-bootstrap.d.ts +220 -0
  276. package/dist/factories/cilium/compositions/cilium-bootstrap.d.ts.map +1 -0
  277. package/dist/factories/cilium/compositions/cilium-bootstrap.js +293 -0
  278. package/dist/factories/cilium/compositions/cilium-bootstrap.js.map +1 -0
  279. package/dist/factories/cilium/compositions/index.d.ts +8 -0
  280. package/dist/factories/cilium/compositions/index.d.ts.map +1 -0
  281. package/dist/factories/cilium/compositions/index.js +11 -0
  282. package/dist/factories/cilium/compositions/index.js.map +1 -0
  283. package/dist/factories/cilium/index.d.ts +10 -0
  284. package/dist/factories/cilium/index.d.ts.map +1 -0
  285. package/dist/factories/cilium/index.js +19 -0
  286. package/dist/factories/cilium/index.js.map +1 -0
  287. package/dist/factories/cilium/resources/bgp.d.ts +10 -0
  288. package/dist/factories/cilium/resources/bgp.d.ts.map +1 -0
  289. package/dist/factories/cilium/resources/bgp.js +14 -0
  290. package/dist/factories/cilium/resources/bgp.js.map +1 -0
  291. package/dist/factories/cilium/resources/gateway.d.ts +72 -0
  292. package/dist/factories/cilium/resources/gateway.d.ts.map +1 -0
  293. package/dist/factories/cilium/resources/gateway.js +118 -0
  294. package/dist/factories/cilium/resources/gateway.js.map +1 -0
  295. package/dist/factories/cilium/resources/helm.d.ts +93 -0
  296. package/dist/factories/cilium/resources/helm.d.ts.map +1 -0
  297. package/dist/factories/cilium/resources/helm.js +377 -0
  298. package/dist/factories/cilium/resources/helm.js.map +1 -0
  299. package/dist/factories/cilium/resources/index.d.ts +14 -0
  300. package/dist/factories/cilium/resources/index.d.ts.map +1 -0
  301. package/dist/factories/cilium/resources/index.js +35 -0
  302. package/dist/factories/cilium/resources/index.js.map +1 -0
  303. package/dist/factories/cilium/resources/load-balancer.d.ts +9 -0
  304. package/dist/factories/cilium/resources/load-balancer.d.ts.map +1 -0
  305. package/dist/factories/cilium/resources/load-balancer.js +12 -0
  306. package/dist/factories/cilium/resources/load-balancer.js.map +1 -0
  307. package/dist/factories/cilium/resources/networking.d.ts +202 -0
  308. package/dist/factories/cilium/resources/networking.d.ts.map +1 -0
  309. package/dist/factories/cilium/resources/networking.js +581 -0
  310. package/dist/factories/cilium/resources/networking.js.map +1 -0
  311. package/dist/factories/cilium/resources/observability.d.ts +9 -0
  312. package/dist/factories/cilium/resources/observability.d.ts.map +1 -0
  313. package/dist/factories/cilium/resources/observability.js +11 -0
  314. package/dist/factories/cilium/resources/observability.js.map +1 -0
  315. package/dist/factories/cilium/resources/security.d.ts +10 -0
  316. package/dist/factories/cilium/resources/security.d.ts.map +1 -0
  317. package/dist/factories/cilium/resources/security.js +14 -0
  318. package/dist/factories/cilium/resources/security.js.map +1 -0
  319. package/dist/factories/cilium/types.d.ts +1001 -0
  320. package/dist/factories/cilium/types.d.ts.map +1 -0
  321. package/dist/factories/cilium/types.js +79 -0
  322. package/dist/factories/cilium/types.js.map +1 -0
  323. package/dist/factories/external-dns/compositions/external-dns-bootstrap.d.ts +32 -0
  324. package/dist/factories/external-dns/compositions/external-dns-bootstrap.d.ts.map +1 -0
  325. package/dist/factories/external-dns/compositions/external-dns-bootstrap.js +152 -0
  326. package/dist/factories/external-dns/compositions/external-dns-bootstrap.js.map +1 -0
  327. package/dist/factories/external-dns/compositions/index.d.ts +2 -0
  328. package/dist/factories/external-dns/compositions/index.d.ts.map +1 -0
  329. package/dist/factories/external-dns/compositions/index.js +3 -0
  330. package/dist/factories/external-dns/compositions/index.js.map +1 -0
  331. package/dist/factories/external-dns/index.d.ts +10 -0
  332. package/dist/factories/external-dns/index.d.ts.map +1 -0
  333. package/dist/factories/external-dns/index.js +19 -0
  334. package/dist/factories/external-dns/index.js.map +1 -0
  335. package/dist/factories/external-dns/resources/dns-endpoint.d.ts +54 -0
  336. package/dist/factories/external-dns/resources/dns-endpoint.d.ts.map +1 -0
  337. package/dist/factories/external-dns/resources/dns-endpoint.js +53 -0
  338. package/dist/factories/external-dns/resources/dns-endpoint.js.map +1 -0
  339. package/dist/factories/external-dns/resources/helm.d.ts +57 -0
  340. package/dist/factories/external-dns/resources/helm.d.ts.map +1 -0
  341. package/dist/factories/external-dns/resources/helm.js +435 -0
  342. package/dist/factories/external-dns/resources/helm.js.map +1 -0
  343. package/dist/factories/external-dns/resources/index.d.ts +3 -0
  344. package/dist/factories/external-dns/resources/index.d.ts.map +1 -0
  345. package/dist/factories/external-dns/resources/index.js +4 -0
  346. package/dist/factories/external-dns/resources/index.js.map +1 -0
  347. package/dist/factories/external-dns/types.d.ts +180 -0
  348. package/dist/factories/external-dns/types.d.ts.map +1 -0
  349. package/dist/factories/external-dns/types.js +39 -0
  350. package/dist/factories/external-dns/types.js.map +1 -0
  351. package/dist/factories/flux/git-repository.d.ts +2 -2
  352. package/dist/factories/flux/git-repository.d.ts.map +1 -1
  353. package/dist/factories/helm/types.d.ts +24 -3
  354. package/dist/factories/helm/types.d.ts.map +1 -1
  355. package/dist/factories/index.d.ts +7 -1
  356. package/dist/factories/index.d.ts.map +1 -1
  357. package/dist/factories/index.js +21 -1
  358. package/dist/factories/index.js.map +1 -1
  359. package/dist/factories/kubernetes/config/config-map.d.ts +4 -1
  360. package/dist/factories/kubernetes/config/config-map.d.ts.map +1 -1
  361. package/dist/factories/kubernetes/config/config-map.js +4 -0
  362. package/dist/factories/kubernetes/config/config-map.js.map +1 -1
  363. package/dist/factories/kubernetes/config/secret.d.ts +6 -1
  364. package/dist/factories/kubernetes/config/secret.d.ts.map +1 -1
  365. package/dist/factories/kubernetes/config/secret.js +4 -0
  366. package/dist/factories/kubernetes/config/secret.js.map +1 -1
  367. package/dist/factories/kubernetes/networking/service.d.ts.map +1 -1
  368. package/dist/factories/kubernetes/networking/service.js +6 -1
  369. package/dist/factories/kubernetes/networking/service.js.map +1 -1
  370. package/dist/factories/kubernetes/rbac/cluster-role-binding.d.ts.map +1 -1
  371. package/dist/factories/kubernetes/rbac/cluster-role-binding.js +1 -1
  372. package/dist/factories/kubernetes/rbac/cluster-role-binding.js.map +1 -1
  373. package/dist/factories/kubernetes/rbac/cluster-role.d.ts.map +1 -1
  374. package/dist/factories/kubernetes/rbac/cluster-role.js +1 -1
  375. package/dist/factories/kubernetes/rbac/cluster-role.js.map +1 -1
  376. package/dist/factories/kubernetes/scheduling/priority-class.d.ts.map +1 -1
  377. package/dist/factories/kubernetes/scheduling/priority-class.js +1 -1
  378. package/dist/factories/kubernetes/scheduling/priority-class.js.map +1 -1
  379. package/dist/factories/kubernetes/storage/storage-class.d.ts.map +1 -1
  380. package/dist/factories/kubernetes/storage/storage-class.js +1 -1
  381. package/dist/factories/kubernetes/storage/storage-class.js.map +1 -1
  382. package/dist/factories/kubernetes/workloads/deployment.d.ts.map +1 -1
  383. package/dist/factories/kubernetes/workloads/deployment.js +9 -4
  384. package/dist/factories/kubernetes/workloads/deployment.js.map +1 -1
  385. package/dist/factories/kubernetes/yaml/yaml-directory.js +2 -2
  386. package/dist/factories/kubernetes/yaml/yaml-directory.js.map +1 -1
  387. package/dist/factories/kubernetes/yaml/yaml-file.d.ts +31 -1
  388. package/dist/factories/kubernetes/yaml/yaml-file.d.ts.map +1 -1
  389. package/dist/factories/kubernetes/yaml/yaml-file.js +80 -7
  390. package/dist/factories/kubernetes/yaml/yaml-file.js.map +1 -1
  391. package/dist/factories/pebble/compositions/index.d.ts +2 -0
  392. package/dist/factories/pebble/compositions/index.d.ts.map +1 -0
  393. package/dist/factories/pebble/compositions/index.js +3 -0
  394. package/dist/factories/pebble/compositions/index.js.map +1 -0
  395. package/dist/factories/pebble/compositions/pebble-bootstrap.d.ts +56 -0
  396. package/dist/factories/pebble/compositions/pebble-bootstrap.d.ts.map +1 -0
  397. package/dist/factories/pebble/compositions/pebble-bootstrap.js +97 -0
  398. package/dist/factories/pebble/compositions/pebble-bootstrap.js.map +1 -0
  399. package/dist/factories/pebble/index.d.ts +10 -0
  400. package/dist/factories/pebble/index.d.ts.map +1 -0
  401. package/dist/factories/pebble/index.js +19 -0
  402. package/dist/factories/pebble/index.js.map +1 -0
  403. package/dist/factories/pebble/resources/helm.d.ts +99 -0
  404. package/dist/factories/pebble/resources/helm.d.ts.map +1 -0
  405. package/dist/factories/pebble/resources/helm.js +167 -0
  406. package/dist/factories/pebble/resources/helm.js.map +1 -0
  407. package/dist/factories/pebble/resources/index.d.ts +2 -0
  408. package/dist/factories/pebble/resources/index.d.ts.map +1 -0
  409. package/dist/factories/pebble/resources/index.js +3 -0
  410. package/dist/factories/pebble/resources/index.js.map +1 -0
  411. package/dist/factories/pebble/types.d.ts +184 -0
  412. package/dist/factories/pebble/types.d.ts.map +1 -0
  413. package/dist/factories/pebble/types.js +23 -0
  414. package/dist/factories/pebble/types.js.map +1 -0
  415. package/dist/factories/pebble/utils/helm-values-mapper.d.ts +21 -0
  416. package/dist/factories/pebble/utils/helm-values-mapper.d.ts.map +1 -0
  417. package/dist/factories/pebble/utils/helm-values-mapper.js +96 -0
  418. package/dist/factories/pebble/utils/helm-values-mapper.js.map +1 -0
  419. package/dist/factories/shared.d.ts +18 -1
  420. package/dist/factories/shared.d.ts.map +1 -1
  421. package/dist/factories/shared.js +89 -8
  422. package/dist/factories/shared.js.map +1 -1
  423. package/dist/factories/simple/config/config-map.d.ts +7 -2
  424. package/dist/factories/simple/config/config-map.d.ts.map +1 -1
  425. package/dist/factories/simple/config/config-map.js +3 -0
  426. package/dist/factories/simple/config/config-map.js.map +1 -1
  427. package/dist/factories/simple/config/secret.d.ts +11 -2
  428. package/dist/factories/simple/config/secret.d.ts.map +1 -1
  429. package/dist/factories/simple/config/secret.js +23 -1
  430. package/dist/factories/simple/config/secret.js.map +1 -1
  431. package/dist/factories/simple/storage/persistent-volume-claim.d.ts.map +1 -1
  432. package/dist/factories/simple/storage/persistent-volume-claim.js +1 -0
  433. package/dist/factories/simple/storage/persistent-volume-claim.js.map +1 -1
  434. package/dist/factories/simple/types.d.ts +5 -1
  435. package/dist/factories/simple/types.d.ts.map +1 -1
  436. package/dist/utils/helpers.d.ts.map +1 -1
  437. package/dist/utils/helpers.js +67 -0
  438. package/dist/utils/helpers.js.map +1 -1
  439. package/dist/utils/type-guards.d.ts +5 -0
  440. package/dist/utils/type-guards.d.ts.map +1 -1
  441. package/dist/utils/type-guards.js +9 -3
  442. package/dist/utils/type-guards.js.map +1 -1
  443. package/package.json +49 -5
package/README.md CHANGED
@@ -1,1156 +1,244 @@
1
- # typekro
1
+ # TypeKro
2
2
 
3
3
  <div align="center">
4
-   <img src="docs/public/typekro-logo.svg" alt="TypeKro Logo" width="200" />
4
+ <img src="docs/public/typekro-logo.svg" alt="TypeKro Logo" width="200" />
5
+
6
+ **Write TypeScript. Deploy Kubernetes. Runtime intelligence included.**
5
7
  </div>
6
8
 
7
9
  [![NPM Version](https://img.shields.io/npm/v/typekro.svg)](https://www.npmjs.com/package/typekro)
8
10
  [![License](https://img.shields.io/badge/License-Apache_2.0-blue.svg)](LICENSE)
9
11
  [![GitHub stars](https://img.shields.io/github/stars/yehudacohen/typekro)](https://github.com/yehudacohen/typekro)
10
12
  [![Build Status](https://img.shields.io/github/actions/workflow/status/yehudacohen/typekro/deploy.yml?branch=master)](https://github.com/yehudacohen/typekro/actions)
11
- [![Coverage](https://codecov.io/gh/yehudacohen/typekro/branch/master/graph/badge.svg)](https://codecov.io/gh/yehudacohen/typekro)
12
13
 
13
- 📚 **[Documentation](https://typekro.run)** • 💬 **[Discord Community](https://discord.gg/kKNSDDjW)** • 🚀 **[Getting Started](https://typekro.run/guide/getting-started)**
14
- ## **TypeKro: Kubernetes with TypeScript**
14
+ 📚 **[Documentation](https://typekro.run)** • 💬 **[Discord](https://discord.gg/kKNSDDjW)** • 🚀 **[Getting Started](https://typekro.run/guide/getting-started)**
15
15
 
16
- **A control plane aware framework for orchestrating kubernetes resources like a programmer**
17
-
18
- TypeKro combines the type safety of TypeScript, the GitOps-friendly output of declarative YAML, and the runtime intelligence of **Kubernetes Resource Orchestrator (KRO)** - an open-source project that enables advanced resource orchestration with runtime dependencies and CEL expressions. Write infrastructure in pure TypeScript with full IDE support, then deploy directly to clusters or generate deterministic YAML for GitOps workflows.
19
-
20
- ## Table of Contents
16
+ ---
21
17
 
22
- - [Quick Start](#quick-start) - See TypeKro in action with a 30-line web app example
23
- - [Deployment Flexibility](#deployment-flexibility) - Write once, deploy everywhere (YAML/Direct/Kro modes)
24
- - [Core Architecture](#core-architecture) - Magic proxy system, enhanced types, and CRD intelligence
25
- - [Comparison Grid](#comparison-grid) - How TypeKro compares to Pulumi, CDK8s, Helm, etc.
26
- - [GitOps Workflows](#gitops-workflows) - Deterministic YAML generation and Flux HelmRelease integration
27
- - [Complete Factory Reference](#complete-factory-reference) - All 50+ available resource factories
28
- - [Which Pattern Should I Use?](#which-pattern-should-i-use) - Decision guide based on your team and workflow
29
- - [Enhanced Type System](#enhanced-type-system) - Deep dive into schema references and type safety
30
- - [Multi-Cloud Integration with Alchemy](#multi-cloud-integration-with-alchemy) - Unified cloud + Kubernetes management
31
- - [Contributing](#contributing) - How to contribute to TypeKro development
18
+ ## What is TypeKro?
32
19
 
33
- ---
20
+ TypeKro is a TypeScript-first framework for orchestrating Kubernetes resources with type safety and runtime intelligence. Write infrastructure in pure TypeScript with full IDE support, then deploy directly to clusters or generate deterministic YAML for GitOps workflows.
34
21
 
35
22
  ## Quick Start
36
23
 
37
- Write Kubernetes infrastructure in pure TypeScript with full IDE support and type safety:
24
+ ```bash
25
+ bun add typekro arktype
26
+ ```
38
27
 
39
28
  ```typescript
40
29
  import { type } from 'arktype';
41
- import { kubernetesComposition, simple, Cel } from 'typekro';
42
-
43
- // Build your infrastructure with full type safety using imperative composition
44
- const deploymentService = kubernetesComposition(
45
- {
46
- name: 'deployment-service',
47
- apiVersion: 'example.com/v1alpha1',
48
- kind: 'DeploymentService',
49
- spec: type({ name: 'string', environment: '"dev" | "staging" | "prod"' }),
50
- status: type({ ready: 'boolean', url: 'string' })
51
- },
52
- (spec) => {
53
- // Resources auto-register when created - no explicit builders needed!
54
- const deployment = simple.Deployment({
55
- name: spec.name, // ← Full IDE autocomplete
56
- image: 'nginx',
57
- replicas: spec.environment === 'prod' ? 3 : 1, // Type-safe logic
58
- labels: {
59
- app: 'deployment',
60
- env: spec.environment // ← Validated enum
61
- },
62
- ports: [{ containerPort: 80 }]
63
- });
64
-
65
- const service = simple.Service({
66
- name: spec.name,
67
- selector: { app: 'deployment' }, // ← Cross-resource reference
68
- ports: [{ port: 80, targetPort: 80 }]
69
- });
70
-
71
- // Return status with JavaScript expressions - automatically converted to CEL
72
- return {
73
- ready: deployment.status.readyReplicas > 0, // ← Natural JavaScript
74
- url: `http://${spec.name}.${spec.environment}.svc` // ← Template literals
75
- };
76
- }
77
- );
30
+ import { kubernetesComposition } from 'typekro';
31
+ import { Deployment, Service } from 'typekro/simple';
32
+
33
+ // Define a reusable WebApp composition
34
+ const WebApp = kubernetesComposition({
35
+ name: 'webapp',
36
+ apiVersion: 'example.com/v1',
37
+ kind: 'WebApp',
38
+ spec: type({ name: 'string', image: 'string', replicas: 'number' }),
39
+ status: type({ ready: 'boolean', endpoint: 'string' })
40
+ }, (spec) => {
41
+ const deploy = Deployment({ id: 'app', name: spec.name, image: spec.image, replicas: spec.replicas });
42
+ const svc = Service({ id: 'svc', name: `${spec.name}-svc`, selector: { app: spec.name }, ports: [{ port: 80 }] });
43
+
44
+ return {
45
+ ready: deploy.status.readyReplicas > 0, // ✨ JavaScript → CEL
46
+ endpoint: `http://${svc.status.clusterIP}` // Template → CEL
47
+ };
48
+ });
49
+
50
+ // Deploy multiple instances with a simple loop
51
+ const apps = [
52
+ { name: 'frontend', image: 'nginx', replicas: 3 },
53
+ { name: 'api', image: 'node:20', replicas: 2 }
54
+ ];
78
55
 
79
- // Deploy instantly with full type checking
80
- await deploymentService.factory('direct').deploy({
81
- name: 'my-app', // ← IDE validates this exists
82
- environment: 'staging' // ← Only accepts: "dev" | "staging" | "prod"
83
- });
56
+ const factory = WebApp.factory('direct', { namespace: 'production' });
57
+ for (const app of apps) await factory.deploy(app);
84
58
  ```
85
59
 
86
- **Key Features Demonstrated:**
87
- - **Full IDE autocomplete** - IntelliSense for all properties
88
- - **Compile-time type checking** - Catch errors before deployment
89
- - **JavaScript-to-CEL conversion** - Write natural JavaScript, get CEL automatically
90
- - **Runtime validation** - ArkType validates deployment specs
91
- - **Zero YAML required** - Pure TypeScript infrastructure
92
- - **Instant deployment** - No kubectl, no YAML files
60
+ **What this demonstrates:**
61
+ - **Reusable compositions** - Define once, deploy many times
62
+ - **Type-safe schemas** - ArkType validates at compile-time and runtime
63
+ - **Cross-resource references** - `svc.status.clusterIP` references live cluster state
64
+ - **JavaScript-to-CEL** - Status expressions become runtime CEL
65
+ - **Native loops** - Just `for...of` to deploy multiple apps
93
66
 
94
- **Deploy anywhere:** Generate KRO YAML for GitOps with `factory.toYaml()` or integrate with multi-cloud using Alchemy.
67
+ ## Why TypeKro?
95
68
 
96
- ::: tip Imperative vs Declarative
97
- This example uses TypeKro's **imperative composition pattern** (`kubernetesComposition`) - the recommended approach for most use cases. For teams preferring explicit resource/status builders, TypeKro also supports a **declarative pattern** (`toResourceGraph`). [Learn more about both patterns →](https://typekro.run/guide/imperative-composition)
98
- :::
99
-
100
- ---
101
-
102
- ## Comparison Grid
103
-
104
- | Feature | TypeKro | Pulumi | CDK8s | Helm | Kustomize | Crossplane |
105
- |---------|---------|---------|--------|------|-----------|------------|
106
- | **Type Safety** | ✅ Full TypeScript | ✅ Multi-language | ✅ TypeScript | ❌ Templates | ❌ YAML | ❌ YAML |
107
- | **GitOps Ready** | ✅ Deterministic YAML | ❌ State backend | ✅ YAML output | ✅ Charts | ✅ YAML | ✅ YAML |
108
- | **Runtime Dependencies** | ✅ KRO + CEL expressions | ❌ Deploy-time only | ❌ Static | ❌ Templates | ❌ Static | ✅ Compositions |
109
- | **IDE Support** | ✅ Full autocomplete | ✅ Language support | ✅ TypeScript | ❌ Limited | ❌ Limited | ❌ Limited |
110
- | **Learning Curve** | 🟢 Just TypeScript | 🔴 New concepts | 🟡 TypeScript + K8s | 🔴 Templates | 🔴 YAML hell | 🔴 Complex |
111
- | **Kubernetes Native** | ✅ Pure K8s resources | ❌ Abstraction layer | ✅ Pure K8s | ✅ K8s resources | ✅ K8s resources | ✅ K8s + CRDs |
112
- | **Cross-Resource Refs** | ✅ Runtime resolution | ❌ Deploy-time | ❌ Manual | ❌ Manual | ❌ Manual | ✅ Built-in |
113
- | **Multi-Cloud** | 🟡 Via Alchemy | ✅ Native | ❌ K8s only | ❌ K8s only | ❌ K8s only | ✅ Native |
114
- | **State Management** | ✅ Stateless | ❌ State backend | ✅ Stateless | ✅ Stateless | ✅ Stateless | ✅ Controller |
115
- | **CRD Timing** | ✅ Automatic | ❌ Manual | ❌ Manual | ❌ Manual | ❌ Manual | ✅ Built-in |
116
-
117
- ---
69
+ | Feature | TypeKro | Pulumi | CDK8s | Helm |
70
+ |---------|---------|--------|-------|------|
71
+ | **Type Safety** | ✅ Full TypeScript | ✅ Multi-lang | ✅ TypeScript | ❌ Templates |
72
+ | **GitOps Ready** | ✅ Deterministic YAML | ❌ State backend | ✅ YAML output | ✅ Charts |
73
+ | **Runtime Refs** | ✅ CEL expressions | ❌ Deploy-time | ❌ Static | ❌ Templates |
74
+ | **Learning Curve** | 🟢 Just TypeScript | 🔴 New concepts | 🟡 TS + K8s | 🔴 Templates |
75
+ | **Stateless** | ✅ | ❌ State backend | ✅ | ✅ |
76
+ | **Cross-Resource** | ✅ Runtime resolution | ❌ Deploy-time | ❌ Manual | ❌ Manual |
118
77
 
119
- ## Deployment Flexibility
78
+ ## Deployment Modes
120
79
 
121
- ### Deploy the Same Resource Graph using GitOps, Direct Kubernetes API Integration, or using KRO
122
-
123
- TypeKro offers deployment flexibility.
124
-
125
- > **What is KRO?** [Kubernetes Resource Orchestrator](https://kro.run/) is an open-source project by AWS Labs that enables resources to reference each other's runtime state using CEL expressions. TypeKro works in Direct Mode (no KRO required) for simple deployments, or KRO Mode for advanced orchestration.
126
-
127
- The same TypeScript code can be deployed in multiple ways without modification:
80
+ TypeKro supports multiple deployment strategies from the same code:
128
81
 
129
82
  ```typescript
130
- // Define your infrastructure once with imperative composition
131
- const webappGraph = kubernetesComposition(
132
- {
133
- name: 'my-webapp',
134
- apiVersion: 'example.com/v1',
135
- kind: 'WebApp',
136
- spec: WebAppSpec,
137
- status: WebAppStatus
138
- },
139
- (spec) => {
140
- // Resources auto-register when created - no explicit builders needed!
141
- const deployment = simple.Deployment({
142
- name: spec.name,
143
- image: spec.image,
144
- replicas: spec.replicas
145
- });
146
-
147
- const service = simple.Service({
148
- name: `${spec.name}-service`,
149
- selector: { app: spec.name },
150
- ports: [{ port: 80, targetPort: 80 }]
151
- });
152
-
153
- // Return status with CEL expressions and resource references
154
- return {
155
- ready: Cel.expr<boolean>(deployment.status.readyReplicas, ' > 0'),
156
- url: Cel.template('http://%s-service', spec.name)
157
- };
158
- }
159
- );
160
-
161
- const spec = { name: 'my-app', image: 'nginx:1.21', replicas: 3 };
162
-
163
- // Deploy the SAME code in different ways:
164
-
165
- // 1. Generate YAML for GitOps (no cluster interaction)
166
- const kroFactory = webappGraph.factory('kro', { namespace: 'dev' });
167
- const yaml = kroFactory.toYaml();
168
- writeFileSync('k8s/webapp.yaml', yaml);
169
-
170
- // 2. Deploy directly to cluster (immediate)
171
- const directFactory = webappGraph.factory('direct', { namespace: 'dev' });
172
- const directInstance = await directFactory.deploy(spec);
173
-
174
- // 3. Integrate with Alchemy for multi-cloud coordination
175
- await alchemyScope.run(async () => {
176
- const alchemyFactory = webappGraph.factory('direct', {
177
- namespace: 'dev',
178
- alchemyScope: alchemyScope
179
- });
180
- await alchemyFactory.deploy(spec);
181
- });
182
- ```
183
-
184
- This flexibility eliminates the need to rewrite infrastructure code when changing deployment strategies or environments.
185
-
186
- ### Core Deployment Strategies
187
-
188
- #### 1. YAML Generation (GitOps)
83
+ // 1. Direct deployment - immediate, no Kro required
84
+ const factory = graph.factory('direct', { namespace: 'dev' });
85
+ await factory.deploy(spec);
189
86
 
190
- Generate deterministic Kubernetes YAML that integrates with any GitOps workflow:
87
+ // 2. Kro deployment - runtime CEL evaluation
88
+ const kroFactory = graph.factory('kro', { namespace: 'prod' });
89
+ await kroFactory.deploy(spec);
191
90
 
192
- ```typescript
193
- // Generate ResourceGraphDefinition YAML
194
- const kroFactory = webappGraph.factory('kro', { namespace: 'default' });
91
+ // 3. YAML generation - GitOps workflows
195
92
  const yaml = kroFactory.toYaml();
196
-
197
- // Save for GitOps deployment
198
- writeFileSync('manifests/webapp.yaml', yaml);
199
-
200
- // Or pipe directly to kubectl
201
- console.log(yaml); // bun run generate.ts | kubectl apply -f -
93
+ writeFileSync('k8s/app.yaml', yaml);
202
94
  ```
203
95
 
204
- **When to use:**
205
- - GitOps workflows (ArgoCD, Flux)
206
- - Audit requirements
207
- - Multi-environment promotion
208
- - CI/CD integration
209
-
210
- **Benefits:**
211
- - No cluster access needed during build
212
- - Git-friendly deterministic output
213
- - Works with existing GitOps tools
214
- - Version control for infrastructure changes
215
-
216
- #### 2. Direct Deployment (Imperative)
96
+ ## Core Features
217
97
 
218
- Deploy directly to your cluster for rapid iteration:
98
+ ### Type-Safe Schemas with ArkType
219
99
 
220
100
  ```typescript
221
- // Create factory and deploy immediately
222
- const factory = webappGraph.factory('direct', { namespace: 'development' });
223
-
224
- // Deploy with specific configuration
225
- const instance = await factory.deploy({
226
-   name: 'webapp-dev',
227
-   image: 'nginx:latest',
228
-   replicas: 1
101
+ const AppSpec = type({
102
+ name: 'string',
103
+ image: 'string',
104
+ replicas: 'number',
105
+ 'environment?': '"dev" | "staging" | "prod"'
229
106
  });
230
-
231
- // Get the generated ResourceGraphDefinition
232
- console.log('Generated RGD:', factory.toYaml());
233
107
  ```
234
108
 
235
- **When to use:**
236
- - Local development
237
- - Testing and experimentation
238
- - Rapid prototyping
239
- - Direct cluster management
240
-
241
- **Benefits:**
242
- - Immediate feedback
243
- - No Git workflow overhead
244
- - Live iteration on infrastructure
245
- - Integrated with development workflow
246
-
247
- #### 3. Kro Deployment (Recommended for Production)
248
-
249
- Leverage Kubernetes Resource Orchestrator for advanced runtime capabilities:
109
+ ### Cross-Resource References
250
110
 
251
111
  ```typescript
252
- // Deploy as ResourceGraphDefinition with runtime resolution
253
- const kroFactory = webappGraph.factory('kro', { namespace: 'production' });
254
-
255
- // Apply the ResourceGraphDefinition to cluster
256
- await kroFactory.deploy({ 
257
-   name: 'webapp-prod',
258
-   image: 'nginx:1.21', 
259
-   replicas: 3 
112
+ const db = Deployment({ id: 'database', name: 'postgres', image: 'postgres:15' });
113
+ const api = Deployment({
114
+ id: 'api',
115
+ name: 'api-server',
116
+ image: 'node:20',
117
+ env: {
118
+ DB_HOST: db.metadata.name // Runtime reference
119
+ }
260
120
  });
261
-
262
- // Kro handles:
263
- // - Runtime CEL expression evaluation
264
- // - Cross-resource dependency resolution  
265
- // - Automatic reconciliation and drift correction
266
- // - Status propagation and health monitoring
267
121
  ```
268
122
 
269
- **When to use:**
270
- - Production environments
271
- - Complex resource dependencies
272
- - Self-healing infrastructure requirements
273
- - Advanced orchestration needs
274
-
275
- **Benefits:**
276
- - Runtime dependency resolution
277
- - Automatic reconciliation
278
- - Built-in health monitoring
279
- - Kubernetes-native operation
280
-
281
- ### Advanced Deployment Patterns
282
-
283
- #### Environment-Specific Deployments
123
+ ### JavaScript-to-CEL Conversion
284
124
 
285
- Deploy the same graph to different environments with environment-specific configurations:
125
+ Write natural JavaScript - TypeKro converts to CEL:
286
126
 
287
127
  ```typescript
288
- // Development: Direct deployment for fast iteration
289
- const factory = webappGraph.factory('direct', { namespace: 'dev' });
290
- await devFactory.deploy({
291
-   name: 'webapp-dev',
292
-   image: 'nginx:latest',
293
-   replicas: 1
294
- });
295
-
296
- // Staging: Kro deployment for testing runtime dependencies  
297
- const factory = webappGraph.factory('kro', { namespace: 'staging' });
298
- await stagingFactory.deploy({
299
-   name: 'webapp-staging',
300
-   image: 'nginx:1.21-rc',
301
-   replicas: 2,
302
- });
303
-
304
- // Production: GitOps deployment
305
- const factory = webappGraph.factory('kro', { namespace: 'production' });
306
- const prodYaml = prodFactory.toYaml();
307
- writeFileSync('k8s/production/webapp.yaml', prodYaml);
308
- // Deployed via ArgoCD/Flux
309
- ```
310
-
311
-
312
- ### Deployment Strategy Decision Matrix
313
-
314
- | **Scenario** | **Recommended Strategy** | **Why** |
315
- |--------------|-------------------------|---------|
316
- | Local development | Direct Deployment | Fast feedback, no GitOps overhead |
317
- | CI/CD pipeline testing | Direct Deployment | Immediate validation, isolated environments |
318
- | Production deployment | Kro + GitOps | Runtime intelligence + audit trail |
319
- | Multi-environment promotion | YAML Generation | Consistent artifacts across environments |
320
- | Complex runtime dependencies | Kro Deployment | Advanced orchestration capabilities |
321
- | Multi-cloud infrastructure | [Alchemy Integration](#multi-cloud-integration-with-alchemy) | Unified cloud + Kubernetes management |
322
- | Rapid prototyping | Direct Deployment | Minimal setup, immediate results |
323
- | Regulated environments | YAML Generation + GitOps | Audit trail, approval workflows |
324
-
325
- ---
326
-
327
- ## GitOps Workflows
328
-
329
- ### Deterministic YAML Generation
330
-
331
- TypeKro generates stable, deterministic YAML output perfect for GitOps workflows:
332
-
333
- ```typescript
334
- // generate-manifests.ts
335
- import { writeFileSync } from 'fs';
336
-
337
- const graph = kubernetesComposition(/* ... */);
338
-
339
- // Same input always generates identical YAML
340
- const factory = graph.factory('kro', { namespace: 'default' });
341
- const yaml = factory.toYaml();
342
-
343
- // Write to file for GitOps
344
- writeFileSync('k8s/my-app.yaml', yaml);
345
- console.log('Generated k8s/my-app.yaml for GitOps deployment');
346
- ```
347
-
348
- **Multi-Environment GitOps Workflow:**
349
-
350
- ```typescript
351
- // scripts/generate-all-environments.ts
352
- const environments = ['development', 'staging', 'production'];
353
-
354
- for (const env of environments) {
355
-   // Generate ResourceGraphDefinition YAML for this environment
356
-   const factory = webappGraph.factory('kro', { namespace: env });
357
-   const rgdYaml = factory.toYaml();
358
-   writeFileSync(`k8s/${env}/webapp-rgd.yaml`, rgdYaml);
359
-   
360
-   // Generate instance YAML with environment-specific spec
361
-   const instanceSpec = {
362
-     name: `webapp-${env}`,
363
-     image: env === 'production' ? 'nginx:1.21' : 'nginx:latest',
364
-     replicas: env === 'production' ? 3 : 1,
365
-   };
366
-   
367
-   const instanceYaml = factory.toYaml(instanceSpec);
368
-   writeFileSync(`k8s/${env}/webapp-instance.yaml`, instanceYaml);
369
- }
128
+ return {
129
+ ready: deploy.status.readyReplicas > 0, // → ${app.status.readyReplicas > 0}
130
+ url: `http://${svc.status.clusterIP}`, // → http://${svc.status.clusterIP}
131
+ phase: deploy.status.phase === 'Running' ? 'up' : 'down'
132
+ };
370
133
  ```
371
134
 
372
- **Benefits for GitOps:**
373
- - **Deterministic Output** - Same input always generates identical YAML
374
- - **Git-Friendly** - Clean, readable YAML that diffs well  
375
- - **Stable Resource IDs** - Consistent resource identifiers across deployments
376
- - **No External State** - Pure functions, no external dependencies
377
-
378
- ### Flux HelmRelease Integration
379
-
380
- Deploy Helm charts with full TypeScript type safety and schema references:
135
+ ### Helm Integration
381
136
 
382
137
  ```typescript
383
138
  import { helmRelease, helmRepository } from 'typekro';
384
139
 
385
- const InfraSpec = type({
386
-   name: 'string',
387
-   replicas: 'number'
388
-   loadBalancerIP: 'string',
389
-   environment: 'string'
390
- });
391
-
392
- const infraGraph = kubernetesComposition(
393
-   {
394
-     name: 'ingress-infrastructure',
395
-     apiVersion: 'infrastructure.example.com/v1',
396
-     kind: 'IngressInfra',
397
-     spec: InfraSpec,
398
-     status: type({ ready: 'boolean' })
399
-   },
400
- (schema) => {
401
- // Create Helm repository first
402
- const repository = helmRepository({
403
- name: 'nginx-repo',
404
- url: 'https://kubernetes.github.io/ingress-nginx'
405
- });
406
-
407
- // Create Helm release using helmRelease factory
408
- const controller = helmRelease({
409
- name: Cel.template('%s-ingress', schema.spec.name),
410
- repository: repository, // Reference repository
411
- chart: 'ingress-nginx',
412
- values: {
413
- controller: {
414
- replicaCount: schema.spec.replicas, // Schema reference
415
- service: {
416
- loadBalancerIP: schema.spec.loadBalancerIP // Schema reference
417
- },
418
- config: {
419
- 'custom-config': Cel.template('env-%s', schema.spec.environment) // CEL expression
420
- }
421
- }
422
- }
423
- });
424
-
425
- return { repository, controller };
426
- },
427
-   (schema, resources) => ({
428
-     ready: Cel.expr(resources.controller.status.conditions, '[?@.type=="Ready"].status == "True"')
429
-   })
430
- );
431
-
432
- // Deploy via Flux
433
- const factory = infraGraph.factory('kro', { namespace: 'flux-system' });
434
- const yaml = factory.toYaml();
435
- writeFileSync('k8s/ingress-controller.yaml', yaml);
436
- ```
437
-
438
- **Key Benefits:**
439
- - **Type-safe Helm values** - Full TypeScript validation for chart values
440
- - **Schema references in values** - Connect Helm charts to your resource graph schema
441
- - **Runtime value resolution** - CEL expressions evaluate at deployment time
442
- - **Full integration with Flux CD HelmRelease**
443
-
444
- ### External YAML Integration
445
-
446
- Integrate existing YAML manifests and Kustomizations into TypeKro resource graphs:
447
-
448
- ```typescript
449
- import { yamlFile, yamlDirectory } from 'typekro';
450
-
451
- const AppSpec = type({
452
-   name: 'string',
453
-   image: 'string'
140
+ const repo = helmRepository({
141
+ name: 'bitnami',
142
+ url: 'https://charts.bitnami.com/bitnami'
454
143
  });
455
144
 
456
- const hybridGraph = kubernetesComposition(
457
- {
458
- name: 'hybrid-app',
459
- apiVersion: 'apps.example.com/v1',
460
- kind: 'HybridApp',
461
- spec: AppSpec,
462
- status: type({ ready: 'boolean' })
463
- },
464
- (spec) => {
465
- // Include external YAML files
466
- const monitoring = yamlFile({
467
- path: './k8s/prometheus-operator.yaml',
468
- namespace: 'default' // Can use static namespace or reference
469
- });
470
-
471
- // Include entire directories with Kustomization
472
- const monitoringStack = yamlDirectory({
473
- path: './k8s/monitoring/',
474
- recursive: true,
475
- kustomization: {
476
- namePrefix: Cel.template('%s-', spec.name), // Dynamic prefix
477
- namespace: 'default',
478
- commonLabels: {
479
- 'app.kubernetes.io/instance': spec.name // Schema reference
480
- }
481
- }
482
- });
483
-
484
- // Include from Git repositories
485
- const kubePrometheus = yamlDirectory({
486
- path: 'https://github.com/prometheus-operator/kube-prometheus.git//manifests',
487
- ref: 'v0.12.0',
488
- namespace: 'monitoring'
489
- });
490
-
491
- // TypeKro resources that reference external resources
492
- const app = simple.Deployment({
493
- name: spec.name,
494
- image: spec.image,
495
- env: {
496
- PROMETHEUS_URL: 'http://prometheus-operated.monitoring.svc.cluster.local:9090'
497
- }
498
- });
499
-
500
- // Return status
501
- return {
502
- ready: Cel.expr<boolean>(app.status.readyReplicas, ' > 0')
503
- };
504
- }
505
- );
506
- ```
507
-
508
- **Integration Capabilities:**
509
- - **File and directory inclusion** - Bring existing YAML into resource graphs
510
- - **Kustomization support** - Apply transformations with schema references  
511
- - **Git repository sources** - Include manifests directly from Git
512
- - **Mixed TypeKro + YAML** - Combine hand-written YAML with TypeKro resources
513
-
514
- ---
515
-
516
- ## Complete Factory Reference
517
-
518
- TypeKro provides 50+ factory functions for all major Kubernetes resources:
519
-
520
- **Core Resources:** `simple.Deployment()`, `simple.Service()`, `simple.ConfigMap()`, `simple.Secret()`, `simple.Pvc()`
521
-
522
- **Advanced:** `helmRelease()`, `yamlFile()`, `customResource()`, `networkPolicy()`, `serviceAccount()`, plus comprehensive RBAC, storage, networking, and workload resources.
523
-
524
- All resources support full type safety, cross-resource references, IDE autocomplete, and CEL expression integration.
525
-
526
- **[📖 View Complete Factory Reference →](docs/api/factories.md)**
527
-
528
- ---
529
-
530
- ## Which Pattern Should I Use?
531
-
532
- ### 🆕 "I'm new to Kubernetes"
533
- **→ Use: Direct Deployment**
534
- ```typescript
535
- const factory = graph.factory('direct', { namespace: 'default' });
536
- await factory.deploy(spec);
537
- ```
538
- - Immediate feedback loop
539
- - No external dependencies  
540
- - Built-in CRD timing intelligence
541
- - Great for learning
542
-
543
- ### 🔄 "I have existing YAML and want to migrate gradually"  
544
- **→ Use: yamlFile() + gradual adoption**
545
- ```typescript
546
- const hybridGraph = kubernetesComposition(
547
- {
548
- name: 'legacy-app',
549
- apiVersion: 'apps.example.com/v1',
550
- kind: 'LegacyApp',
551
- spec: type({ name: 'string' }),
552
- status: type({ ready: 'boolean' })
553
- },
554
- (spec) => {
555
- const existing = yamlFile({ path: './existing/app.yaml' }); // Keep existing
556
- const newService = simple.Service({ // Add TypeKro gradually
557
- name: spec.name,
558
- selector: { app: spec.name }
559
- });
560
-
561
- return {
562
- ready: Cel.expr<boolean>(newService.status.ready, ' == true')
563
- };
564
- }
565
- );
566
- ```
567
- - Preserve existing workflows
568
- - Migrate incrementally
569
- - Zero disruption migration path
570
-
571
- ### 🚀 "I want GitOps workflows"
572
- **→ Use: YAML Generation + Flux HelmRelease**
573
- ```typescript
574
- const factory = graph.factory('kro', { namespace: 'production' });
575
- const yaml = factory.toYaml();
576
- writeFileSync('k8s/app.yaml', yaml);
577
- ```
578
- - Deterministic YAML output
579
- - Git-based workflows  
580
- - Works with ArgoCD, Flux, kubectl
581
-
582
- ### ☁️ "I need multi-cloud infrastructure"
583
- **→ Use: [Alchemy Integration](#multi-cloud-integration-with-alchemy)**
584
- ```typescript
585
- await alchemyScope.run(async () => {
586
- const factory = graph.factory('direct', {
587
- namespace: 'default',
588
- alchemyScope: alchemyScope
589
- });
590
- await factory.deploy(spec);
591
- });
592
- ```
593
- - Unified TypeScript across cloud + K8s
594
- - Individual resource registration
595
- - Type-safe cloud resources
596
-
597
- ### 📦 "I want to deploy Helm charts with type safety"
598
- **→ Use: helmRelease() patterns**
599
- ```typescript
600
- helmRelease({
145
+ const release = helmRelease({
601
146
  name: 'nginx',
602
- repository: repository,
147
+ repository: repo,
603
148
  chart: 'nginx',
604
149
  values: {
605
- replicaCount: spec.replicas, // Type-safe values
606
- service: {
607
- loadBalancerIP: spec.ip // Schema references
608
- }
609
- }
610
- })
611
- ```
612
- - Type-safe Helm values
613
- - Schema references in chart values
614
- - Flux CD integration
615
-
616
- ### 🔗 "I have complex runtime dependencies"
617
- **→ Use: Kro Deployment + CEL expressions**
618
- ```typescript
619
- simple.Deployment({
620
-   env: {
621
-     DB_HOST: database.service.spec.clusterIP,           // Runtime resolution
622
-     API_URL: Cel.template('http://%s:8080', 
623
-       webService.status.loadBalancer.ingress[0].ip)     // Status references
624
-   }
625
- })
626
- ```
627
- - Runtime resource resolution
628
- - Advanced orchestration
629
- - Self-healing infrastructure
630
- - Production-ready patterns
631
-
632
- ### 🎯 "I need to make the right choice for my team"
633
-
634
- | **Team Size** | **K8s Experience** | **Deployment Model** | **Recommended Pattern** |
635
- |---------------|-------------------|---------------------|------------------------|
636
- | Small (1-3) | Beginner | Any | Direct Deployment |
637
- | Small (1-3) | Expert | GitOps | YAML Generation |
638
- | Medium (4-10) | Mixed | GitOps | Kro + GitOps |
639
- | Large (10+) | Expert | Enterprise GitOps | Kro + GitOps + Alchemy |
640
- | Any | Any | Multi-cloud | [Alchemy Integration](#multi-cloud-integration-with-alchemy) |
641
- | Any | Any | Helm-heavy | HelmRelease patterns |
642
-
643
- Choose based on your team's needs, not just technical capabilities. You can always evolve your approach as requirements change.
644
-
645
- ---
646
-
647
- ## Multi-Cloud Integration with Alchemy
648
-
649
- TypeKro integrates seamlessly with [Alchemy](https://alchemy.run) to enable unified cloud + Kubernetes infrastructure management. Alchemy is infrastructure-as-TypeScript that lets you deploy to Cloudflare, AWS, and more with pure TypeScript.
650
-
651
- ### Why Use TypeKro + Alchemy?
652
-
653
- - **Unified TypeScript Experience**: Write both cloud resources and Kubernetes resources in the same language
654
- - **Cross-Platform References**: Cloud resources can reference Kubernetes resources and vice versa
655
- - **Type-Safe Integration**: Full TypeScript validation across your entire infrastructure stack
656
- - **Flexible Deployment**: Use any TypeKro deployment strategy (Direct, YAML, KRO) with Alchemy
657
-
658
- ### Individual Resource Registration Pattern
659
-
660
- Register specific TypeKro resources with Alchemy for hybrid cloud-native applications:
661
-
662
- ```typescript
663
- import alchemy from 'alchemy';
664
- import { Bucket } from 'alchemy/aws';
665
-
666
- // 1. Create Alchemy scope
667
- const app = await alchemy('webapp-infrastructure');
668
-
669
- // 2. Create cloud resources with Alchemy
670
- const bucket = await Bucket('webapp-uploads');
671
-
672
- // 3. Create Kubernetes resources that reference cloud resources
673
- const webappGraph = kubernetesComposition(
674
- {
675
- name: 'webapp-with-cloud',
676
- apiVersion: 'example.com/v1',
677
- kind: 'CloudWebApp',
678
- spec: type({ name: 'string', image: 'string', replicas: 'number' }),
679
- status: type({ ready: 'boolean' })
680
- },
681
- (spec) => {
682
- const app = simple.Deployment({
683
- name: spec.name,
684
- image: spec.image,
685
- env: {
686
- BUCKET_NAME: bucket.name, // Reference to Alchemy resource
687
- API_URL: Cel.template('http://%s-service', spec.name)
688
- }
689
- });
690
-
691
- return {
692
- ready: Cel.expr<boolean>(app.status.readyReplicas, ' > 0')
693
- };
694
- }
695
- );
696
-
697
- // Deploy TypeKro resources with Alchemy integration
698
- await app.run(async () => {
699
- const factory = webappGraph.factory('direct', {
700
- namespace: 'default',
701
- alchemyScope: app
702
- });
703
- await factory.deploy({
704
- name: 'webapp',
705
- image: 'nginx:1.21',
706
- replicas: 3
707
- });
708
- });
709
- ```
710
-
711
- ### Real-World Cloud-Native Application
712
-
713
- Here's a complete example showing TypeKro + Alchemy for a production cloud-native application:
714
-
715
- ```typescript
716
- import alchemy from 'alchemy';
717
- import { Bucket, Function as LambdaFunction } from 'alchemy/aws';
718
- import { kubernetesComposition, simple, type } from 'typekro';
719
-
720
- // 1. Create Alchemy scope
721
- const app = await alchemy('cloud-native-app');
722
-
723
- // 2. Cloud resources with Alchemy
724
- const api = await LambdaFunction('database-function', {
725
-   code: './functions/database.js',
726
-   environment: {
727
-     DATABASE_URL: 'postgresql://...'
728
-   }
729
- });
730
-
731
- const bucket = await Bucket('app-uploads');
732
-
733
- // 3. Kubernetes resources with TypeKro that reference cloud resources
734
- const AppSpec = type({
735
-   name: 'string',
736
-   image: 'string',
737
-   replicas: 'number'
738
- });
739
-
740
- const appGraph = kubernetesComposition(
741
- {
742
- name: 'cloud-native-app',
743
- apiVersion: 'example.com/v1',
744
- kind: 'CloudNativeApp',
745
- spec: AppSpec,
746
- status: type({ ready: 'boolean' })
747
- },
748
- (spec) => {
749
- // Create redis first
750
- const redis = simple.Deployment({
751
- name: Cel.template('%s-redis', spec.name),
752
- image: 'redis:7',
753
- labels: { app: Cel.template('%s-redis', spec.name), component: 'cache' }
754
- });
755
-
756
- // Create app that references redis
757
- const app = simple.Deployment({
758
- name: spec.name,
759
- image: spec.image,
760
- labels: { app: spec.name, component: 'web' },
761
- env: {
762
- // Reference cloud resources
763
- API_URL: api.url,
764
- UPLOAD_BUCKET: bucket.name,
765
- // Reference other Kubernetes resources by field
766
- REDIS_HOST: redis.metadata.name
767
- }
768
- });
769
-
770
- return {
771
- ready: Cel.expr<boolean>(app.status.readyReplicas, ' > 0')
772
- };
150
+ replicaCount: spec.replicas // Type-safe values
773
151
  }
774
- );
775
-
776
- // 4. Deploy as unified infrastructure
777
- await app.run(async () => {
778
- const factory = appGraph.factory('direct', {
779
- namespace: 'production',
780
- alchemyScope: app
781
- });
782
- await factory.deploy({
783
- name: 'myapp',
784
- image: 'myapp:v1.2.3',
785
- replicas: 5
786
- });
787
- });
788
- ```
789
-
790
- ### Integration Patterns
791
-
792
- TypeKro works with all Alchemy deployment patterns:
793
-
794
- #### Pattern 1: Cloud-First with Kubernetes Extensions
795
- ```typescript
796
- // Start with cloud infrastructure
797
- const app = await alchemy('my-platform');
798
- const database = await RDS('main-db');
799
- const cache = await ElastiCache('redis-cluster');
800
-
801
- // Add Kubernetes workloads that use cloud resources
802
- const k8sWorkloads = webappGraph.factory('kro', { namespace: 'apps' });
803
- await app.run(async () => {
804
- const factory = k8sWorkloads.factory('kro', {
805
- namespace: 'apps',
806
- alchemyScope: app
807
- });
808
- await factory.deploy({
809
- databaseUrl: database.endpoint,
810
- redisUrl: cache.endpoint
811
- });
812
- });
813
- ```
814
-
815
- #### Pattern 2: Kubernetes-First with Cloud Services
816
- ```typescript
817
- // Start with cloud infrastructure first
818
- const app = await alchemy('support-services');
819
- const monitoring = await CloudWatch('webapp-metrics');
820
- const storage = await S3('webapp-data');
821
-
822
- // Deploy Kubernetes resources with access to cloud resources
823
- await app.run(async () => {
824
- const factory = webappGraph.factory('direct', {
825
- namespace: 'default',
826
- alchemyScope: app
827
- });
828
- await factory.deploy({
829
- name: 'webapp',
830
- image: 'myapp:latest',
831
- // Kubernetes resources can reference cloud resources
832
- monitoring: monitoring.endpoint,
833
- storage: storage.bucketName
834
- });
835
- });
836
- ```
837
-
838
- ### Benefits of TypeKro + Alchemy Integration
839
-
840
- - **Single Language**: TypeScript for everything - no YAML, HCL, or domain-specific languages
841
- - **Type Safety Across Platforms**: Catch configuration errors at compile time, not runtime
842
- - **Cross-Platform References**: Natural references between cloud and Kubernetes resources
843
- - **Deployment Flexibility**: Use any TypeKro deployment strategy with Alchemy
844
- - **IDE Support**: Full autocomplete and refactoring across your entire infrastructure
845
- - **GitOps Compatible**: Generate deterministic YAML while maintaining cloud resource management
846
-
847
- ---
848
-
849
-
850
- ## Core Architecture
851
-
852
- TypeKro's architecture enables compile-time type safety with runtime intelligence through three key systems:
853
-
854
- ```mermaid
855
- graph TD
856
- A[TypeScript Code] --> B[Magic Proxy System]
857
- B --> C[Schema References]
858
- B --> D[Static Values]
859
- C --> E[CEL Expressions]
860
- D --> F[Direct Values]
861
- E --> G[Runtime Resolution]
862
- F --> G
863
- G --> H{Deployment Strategy}
864
-
865
- H --> I[YAML Generation]
866
- H --> J[Direct Deployment]
867
- H --> K[KRO Deployment]
868
-
869
- I --> L[GitOps Tools<br/>ArgoCD, Flux, kubectl]
870
- J --> M[Kubernetes API<br/>Immediate Deployment]
871
- K --> N[KRO Controller<br/>Runtime Dependencies]
872
-
873
- L --> O[Kubernetes Cluster]
874
- M --> O
875
- N --> O
876
-
877
- subgraph "Compile Time"
878
- A
879
- B
880
- C
881
- D
882
- P[IDE Support<br/>Autocomplete<br/>Type Safety]
883
- end
884
-
885
- subgraph "Runtime"
886
- E
887
- G
888
- Q[CEL Evaluation<br/>Cross-Resource Refs<br/>Status Propagation]
889
- end
890
-
891
- A -.-> P
892
- N -.-> Q
893
-
894
- style A fill:#e1f5fe
895
- style B fill:#f3e5f5
896
- style O fill:#e8f5e8
897
- style P fill:#fff3e0
898
- style Q fill:#fff3e0
899
- ```
900
-
901
- ### Magic Proxy System
902
-
903
- TypeKro's "magic" comes from its **proxy system** that creates different behaviors for execution-time vs runtime values:
904
-
905
- #### Static Values (Known at Execution Time)
906
- ```typescript
907
- const deployment = simple.Deployment({
908
-   name: 'my-app',        // Static string
909
-   replicas: 3,           // Static number
910
152
  });
911
-
912
- // Accessing static values returns the actual value
913
- console.log(deployment.spec.replicas); // Returns: 3
914
153
  ```
915
154
 
916
- #### Dynamic References (Unknown at Execution Time)
917
- ```typescript
918
- const deployment = simple.Deployment({
919
-   name: schema.spec.name,  // Schema reference - unknown until runtime
920
- });
921
-
922
- // Accessing schema or status fields creates KubernetesRef objects
923
- const nameRef = schema.spec.name;        // Creates: KubernetesRef<string>
924
- const statusRef = deployment.status.readyReplicas; // Creates: KubernetesRef<number>
925
- ```
155
+ ### YAML File Integration
926
156
 
927
- #### The `$` Prefix for Explicit References
928
157
  ```typescript
929
- const configMap = simple.ConfigMap({
930
-   name: 'config',
931
-   data: { key: 'value' }  // Static value
932
- });
158
+ import { yamlFile } from 'typekro';
933
159
 
934
- const deployment = simple.Deployment({
935
-   name: 'app',
936
-   env: {
937
-     // Static behavior: Uses the known value "value" at execution time
938
-     STATIC_VALUE: configMap.data.key,
939
-     
940
-     // Dynamic behavior: Creates reference resolved by Kro at runtime
941
-     DYNAMIC_VALUE: configMap.data.$key,
942
-   }
160
+ const existing = yamlFile({
161
+ path: './k8s/existing-deployment.yaml',
162
+ namespace: 'default'
943
163
  });
944
164
  ```
945
165
 
946
- **Key Rule**: Schema references (`schema.spec.*`) and status references (`resource.status.*`) are automatically converted to CEL expressions. For explicit runtime references to other resource properties, use the `$` prefix.
947
-
948
- ### Enhanced Types (RefOrValue Pattern)
949
-
950
- Every factory function accepts `RefOrValue<T>`, which means any parameter can be:
951
-
952
- ```typescript
953
- // 1. Direct value
954
- name: "my-app"
955
-
956
- // 2. Schema reference (becomes CEL)
957
- name: schema.spec.name
958
-
959
- // 3. CEL expression 
960
- name: Cel.template("%s-service", schema.spec.name)
961
-
962
- // 4. Reference to another resource
963
- env: {
964
-   DB_HOST: database.service.spec.clusterIP  // Runtime resolution
965
- }
966
- ```
967
-
968
- This pattern provides **compile-time type safety** while enabling **runtime flexibility**.
969
-
970
- ### CRD Installation Intelligence
971
-
972
- TypeKro's direct deployer automatically handles Custom Resource Definition timing:
973
-
974
- ```typescript
975
- // TypeKro automatically detects CRD dependencies
976
- const kroResources = [
977
-   kroDefinition,           // CRD must be installed first
978
-   kroInstance             // Instance depends on CRD
979
- ];
980
-
981
- const factory = graph.factory('direct', { namespace: 'default' });
982
- await factory.deploy(spec);  // ✅ Automatically waits for CRD readiness
983
- ```
984
-
985
- **Benefits:**
986
- - **No "CRD not found" errors** - Automatic timing coordination
987
- - **Zero manual ordering** - Intelligent dependency detection  
988
- - **Production reliability** - Handles CRD establishment properly
166
+ ## Factory Functions
989
167
 
990
- ### Runtime vs Compile-time Behavior
168
+ TypeKro provides 50+ factory functions for Kubernetes resources:
991
169
 
992
- | **Aspect** | **Compile-time** | **Runtime** |
993
- |------------|------------------|-------------|
994
- | **Type checking** | Full TypeScript validation | N/A |
995
- | **IDE support** | Autocomplete, refactoring | N/A |
996
- | **Schema references** | Appear as typed properties | Resolve to CEL expressions |
997
- | **Resource references** | Type-safe property access | Runtime cluster state lookup |
998
- | **Validation** | TypeScript + arktype schemas | Kubernetes validation + CEL |
170
+ **Workloads:** `Deployment`, `StatefulSet`, `DaemonSet`, `Job`, `CronJob`
999
171
 
1000
- ---
172
+ **Networking:** `Service`, `Ingress`, `NetworkPolicy`
1001
173
 
174
+ **Config:** `ConfigMap`, `Secret`
1002
175
 
1003
- ## Enhanced Type System
176
+ **Storage:** `PersistentVolumeClaim`, `PersistentVolume`, `StorageClass`
1004
177
 
1005
- TypeKro provides **enhanced types** through its magic proxy system, eliminating the need for optional chaining (`?.`) when working with schema and resource references.
178
+ **RBAC:** `ServiceAccount`, `Role`, `RoleBinding`, `ClusterRole`, `ClusterRoleBinding`
1006
179
 
1007
- ### Schema References - Always Present
180
+ **[View Complete API Reference →](https://typekro.run/api/)**
1008
181
 
1009
- When you access schema fields in the resource builder, TypeScript treats them as always present:
182
+ ## What is Kro?
1010
183
 
1011
- ```typescript
1012
- const graph = toResourceGraph(
1013
-   {
1014
-     name: 'my-app',
1015
-     spec: type({
1016
-       name: 'string',
1017
-       image: 'string',
1018
-       replicas: 'number',
1019
-       environment: 'string',
1020
-     }),
1021
-     status: type({
1022
-       ready: 'boolean',
1023
-       url: 'string',
1024
-     }),
1025
-   },
1026
-   (schema) => ({
1027
-     deployment: simple.Deployment({
1028
-       // ✅ No optional chaining needed - TypeScript knows these exist
1029
-       name: schema.spec.name,           // Type: string (not string | undefined)
1030
-       image: schema.spec.image,         // Type: string (not string | undefined)
1031
-       replicas: schema.spec.replicas,   // Type: number (not number | undefined)
1032
-       
1033
-       env: {
1034
-         NODE_ENV: schema.spec.environment,  // Type: string
1035
-       },
1036
-     }),
1037
-   }),
1038
-   (schema, resources) => ({
1039
-     // ✅ Status fields are also enhanced - no optional chaining needed
1040
-     ready: Cel.expr(resources.deployment.status.readyReplicas, ' > 0'),
1041
-     url: Cel.template('https://%s.example.com', schema.spec.name),
1042
-   })
1043
- );
1044
- ```
1045
-
1046
- ### Resource Status References - Enhanced Types
184
+ [Kubernetes Resource Orchestrator (Kro)](https://kro.run/) is an open-source project by AWS Labs that enables resources to reference each other's runtime state using CEL expressions.
1047
185
 
1048
- Resource status fields are enhanced to be non-optional within the builders:
186
+ TypeKro works in **Direct Mode** (no Kro required) for simple deployments, or **Kro Mode** for advanced orchestration with runtime dependencies.
1049
187
 
1050
- ```typescript
1051
- // Without TypeKro (regular Kubernetes types)
1052
- const regularK8s = {
1053
-   // These would require optional chaining
1054
-   replicas: deployment.status?.readyReplicas,        // number | undefined
1055
-   conditions: deployment.status?.conditions?.[0],   // Condition | undefined
1056
- };
188
+ ## Documentation
1057
189
 
1058
- // With TypeKro (enhanced types)
1059
- const graph = toResourceGraph(
1060
-   // ... schema definition
1061
-   (schema, resources) => ({
1062
-     // ✅ No optional chaining needed - enhanced types guarantee presence
1063
-     replicas: resources.deployment.status.readyReplicas,     // Type: number
1064
-     phase: resources.deployment.status.phase,                // Type: string
1065
-     conditions: resources.deployment.status.conditions[0],   // Type: Condition
1066
-     
1067
-     // Complex expressions work naturally
1068
-     healthy: Cel.expr(
1069
-       resources.deployment.status.readyReplicas, ' == ',
1070
-       resources.deployment.spec.replicas
1071
-     ),
1072
-   })
1073
- );
1074
- ```
190
+ - **[Getting Started](https://typekro.run/guide/getting-started)** - 5-minute quick start
191
+ - **[Core Concepts](https://typekro.run/guide/imperative-composition)** - kubernetesComposition API
192
+ - **[API Reference](https://typekro.run/api/)** - Complete API documentation
193
+ - **[Examples](https://typekro.run/examples/)** - Real-world patterns
1075
194
 
1076
- ### How Enhanced Types Work
195
+ ## Installation
1077
196
 
1078
- The magic proxy system provides type enhancement while respecting the static/dynamic value distinction:
197
+ ```bash
198
+ # Using bun (recommended)
199
+ bun add typekro arktype
1079
200
 
1080
- 1. **Enhanced Type Safety**: Schema and resource references appear as non-optional TypeScript types
1081
- 2. **Dynamic Reference Creation**: Schema and status field access creates `KubernetesRef<T>` objects
1082
- 3. **Static Value Preservation**: Known values at execution time remain as actual values
201
+ # Using npm
202
+ npm install typekro arktype
1083
203
 
1084
- ```typescript
1085
- // Schema references (always dynamic - unknown until runtime)
1086
- const nameRef = schema.spec.name;                    // Creates: KubernetesRef<string>
1087
- const imageRef = schema.spec.image;                  // Creates: KubernetesRef<string>
1088
-
1089
- // Resource status references (always dynamic - runtime cluster state)
1090
- const replicasRef = resources.deployment.status.readyReplicas;  // Creates: KubernetesRef<number>
1091
-
1092
- // Static values (known at execution time)
1093
- const staticName = 'my-app';                         // Remains: string
1094
- const staticReplicas = 3;                            // Remains: number
1095
-
1096
- // Mixed usage in factory functions
1097
- const deployment = simple.Deployment({
1098
-   name: schema.spec.name,        // Dynamic: KubernetesRef<string> → CEL expression
1099
-   replicas: 3,                   // Static: number → direct value
1100
-   image: 'nginx:latest'          // Static: string → direct value
1101
- });
204
+ # Using yarn
205
+ yarn add typekro arktype
1102
206
  ```
1103
207
 
1104
- ### Benefits of Enhanced Types
208
+ ## Requirements
1105
209
 
1106
- - **No Optional Chaining**: Write cleaner code without `?.` operators
1107
- - **Better IntelliSense**: Full autocomplete for all schema and status fields
1108
- - **Execution-Time Safety**: Catch typos and missing fields when building resources
1109
- - **Runtime Flexibility**: References are resolved dynamically by Kro
1110
- - **Natural Syntax**: Write code that looks like direct property access
1111
-
1112
- This enhanced type system makes TypeKro feel natural to use while maintaining the powerful reference resolution capabilities needed for complex Kubernetes deployments.
1113
-
1114
- ---
210
+ - Node.js 18+ or Bun
211
+ - TypeScript 5.0+
212
+ - Kubernetes cluster (for deployment)
213
+ - Kro controller (optional, for runtime features)
1115
214
 
1116
215
  ## Contributing
1117
216
 
1118
- We welcome contributions to TypeKro! Whether you're fixing bugs, adding features, or improving documentation, your help makes TypeKro better for everyone.
1119
-
1120
- ### Quick Start for Contributors
217
+ We welcome contributions! See [CONTRIBUTING.md](CONTRIBUTING.md) for guidelines.
1121
218
 
1122
219
  ```bash
1123
- # Fork and clone the repository
1124
- git clone https://github.com/your-username/typekro.git
220
+ # Clone the repository
221
+ git clone https://github.com/yehudacohen/typekro.git
1125
222
  cd typekro
1126
223
 
1127
- # Install dependencies (we use Bun)
224
+ # Install dependencies
1128
225
  bun install
1129
226
 
1130
- # Run tests to ensure everything works
227
+ # Run tests
1131
228
  bun run test
1132
229
 
1133
- # Make your changes and run quality checks
1134
- bun run quality
230
+ # Build
231
+ bun run build
1135
232
  ```
1136
233
 
1137
- ### What Can You Contribute?
1138
-
1139
- - 🐛 **Bug Fixes** - Help us squash bugs and improve reliability
1140
- - ✨ **New Features** - Add factory functions for new Kubernetes resources
1141
- - 📚 **Documentation** - Improve examples, guides, and API documentation
1142
- - 🧪 **Tests** - Add test coverage for edge cases and new functionality
1143
- - 🔧 **Tooling** - Improve development experience and CI/CD
1144
-
1145
- **[📖 Read the Complete Contributing Guide →](CONTRIBUTING.md)**
234
+ ## License
1146
235
 
1147
- The contributing guide includes:
1148
- - Detailed setup instructions
1149
- - Code structure and architectural principles
1150
- - Testing guidelines and examples
1151
- - PR submission process
1152
- - Release workflow
236
+ Apache 2.0 - See [LICENSE](LICENSE) for details.
1153
237
 
1154
- ## License
238
+ ---
1155
239
 
1156
- Apache 2.0 - see [LICENSE](LICENSE) for details.
240
+ <div align="center">
241
+ <strong>Built with ❤️ for the Kubernetes community</strong>
242
+
243
+ [Documentation](https://typekro.run) • [Discord](https://discord.gg/kKNSDDjW) • [GitHub](https://github.com/yehudacohen/typekro)
244
+ </div>