typekro 0.1.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 (620) hide show
  1. package/LICENSE +185 -0
  2. package/README.md +1137 -0
  3. package/dist/.tsbuildinfo +1 -0
  4. package/dist/alchemy/deployers.d.ts +39 -0
  5. package/dist/alchemy/deployers.d.ts.map +1 -0
  6. package/dist/alchemy/deployers.js +194 -0
  7. package/dist/alchemy/deployers.js.map +1 -0
  8. package/dist/alchemy/deployment.d.ts +12 -0
  9. package/dist/alchemy/deployment.d.ts.map +1 -0
  10. package/dist/alchemy/deployment.js +12 -0
  11. package/dist/alchemy/deployment.js.map +1 -0
  12. package/dist/alchemy/index.d.ts +17 -0
  13. package/dist/alchemy/index.d.ts.map +1 -0
  14. package/dist/alchemy/index.js +20 -0
  15. package/dist/alchemy/index.js.map +1 -0
  16. package/dist/alchemy/resolver.d.ts +127 -0
  17. package/dist/alchemy/resolver.d.ts.map +1 -0
  18. package/dist/alchemy/resolver.js +341 -0
  19. package/dist/alchemy/resolver.js.map +1 -0
  20. package/dist/alchemy/resource-registration.d.ts +22 -0
  21. package/dist/alchemy/resource-registration.d.ts.map +1 -0
  22. package/dist/alchemy/resource-registration.js +218 -0
  23. package/dist/alchemy/resource-registration.js.map +1 -0
  24. package/dist/alchemy/type-inference.d.ts +13 -0
  25. package/dist/alchemy/type-inference.d.ts.map +1 -0
  26. package/dist/alchemy/type-inference.js +67 -0
  27. package/dist/alchemy/type-inference.js.map +1 -0
  28. package/dist/alchemy/types.d.ts +92 -0
  29. package/dist/alchemy/types.d.ts.map +1 -0
  30. package/dist/alchemy/types.js +8 -0
  31. package/dist/alchemy/types.js.map +1 -0
  32. package/dist/alchemy/utilities.d.ts +12 -0
  33. package/dist/alchemy/utilities.d.ts.map +1 -0
  34. package/dist/alchemy/utilities.js +16 -0
  35. package/dist/alchemy/utilities.js.map +1 -0
  36. package/dist/alchemy/wrapper.d.ts +16 -0
  37. package/dist/alchemy/wrapper.d.ts.map +1 -0
  38. package/dist/alchemy/wrapper.js +23 -0
  39. package/dist/alchemy/wrapper.js.map +1 -0
  40. package/dist/core/composition/composition.d.ts +94 -0
  41. package/dist/core/composition/composition.d.ts.map +1 -0
  42. package/dist/core/composition/composition.js +230 -0
  43. package/dist/core/composition/composition.js.map +1 -0
  44. package/dist/core/composition/index.d.ts +12 -0
  45. package/dist/core/composition/index.d.ts.map +1 -0
  46. package/dist/core/composition/index.js +12 -0
  47. package/dist/core/composition/index.js.map +1 -0
  48. package/dist/core/composition/typekro-runtime/index.d.ts +3 -0
  49. package/dist/core/composition/typekro-runtime/index.d.ts.map +1 -0
  50. package/dist/core/composition/typekro-runtime/index.js +2 -0
  51. package/dist/core/composition/typekro-runtime/index.js.map +1 -0
  52. package/dist/core/composition/typekro-runtime/typekro-runtime.d.ts +39 -0
  53. package/dist/core/composition/typekro-runtime/typekro-runtime.d.ts.map +1 -0
  54. package/dist/core/composition/typekro-runtime/typekro-runtime.js +100 -0
  55. package/dist/core/composition/typekro-runtime/typekro-runtime.js.map +1 -0
  56. package/dist/core/composition/typekro-runtime/types.d.ts +16 -0
  57. package/dist/core/composition/typekro-runtime/types.d.ts.map +1 -0
  58. package/dist/core/composition/typekro-runtime/types.js +12 -0
  59. package/dist/core/composition/typekro-runtime/types.js.map +1 -0
  60. package/dist/core/composition/types.d.ts +264 -0
  61. package/dist/core/composition/types.d.ts.map +1 -0
  62. package/dist/core/composition/types.js +2 -0
  63. package/dist/core/composition/types.js.map +1 -0
  64. package/dist/core/constants/brands.d.ts +42 -0
  65. package/dist/core/constants/brands.d.ts.map +1 -0
  66. package/dist/core/constants/brands.js +51 -0
  67. package/dist/core/constants/brands.js.map +1 -0
  68. package/dist/core/dependencies/graph.d.ts +67 -0
  69. package/dist/core/dependencies/graph.d.ts.map +1 -0
  70. package/dist/core/dependencies/graph.js +220 -0
  71. package/dist/core/dependencies/graph.js.map +1 -0
  72. package/dist/core/dependencies/index.d.ts +7 -0
  73. package/dist/core/dependencies/index.d.ts.map +1 -0
  74. package/dist/core/dependencies/index.js +8 -0
  75. package/dist/core/dependencies/index.js.map +1 -0
  76. package/dist/core/dependencies/resolver.d.ts +53 -0
  77. package/dist/core/dependencies/resolver.d.ts.map +1 -0
  78. package/dist/core/dependencies/resolver.js +167 -0
  79. package/dist/core/dependencies/resolver.js.map +1 -0
  80. package/dist/core/dependencies/type-guards.d.ts +17 -0
  81. package/dist/core/dependencies/type-guards.d.ts.map +1 -0
  82. package/dist/core/dependencies/type-guards.js +35 -0
  83. package/dist/core/dependencies/type-guards.js.map +1 -0
  84. package/dist/core/deployment/deployment-strategies.d.ts +12 -0
  85. package/dist/core/deployment/deployment-strategies.d.ts.map +1 -0
  86. package/dist/core/deployment/deployment-strategies.js +11 -0
  87. package/dist/core/deployment/deployment-strategies.js.map +1 -0
  88. package/dist/core/deployment/direct-factory.d.ts +111 -0
  89. package/dist/core/deployment/direct-factory.d.ts.map +1 -0
  90. package/dist/core/deployment/direct-factory.js +627 -0
  91. package/dist/core/deployment/direct-factory.js.map +1 -0
  92. package/dist/core/deployment/engine.d.ts +128 -0
  93. package/dist/core/deployment/engine.d.ts.map +1 -0
  94. package/dist/core/deployment/engine.js +1408 -0
  95. package/dist/core/deployment/engine.js.map +1 -0
  96. package/dist/core/deployment/index.d.ts +14 -0
  97. package/dist/core/deployment/index.d.ts.map +1 -0
  98. package/dist/core/deployment/index.js +14 -0
  99. package/dist/core/deployment/index.js.map +1 -0
  100. package/dist/core/deployment/kro-factory.d.ts +143 -0
  101. package/dist/core/deployment/kro-factory.d.ts.map +1 -0
  102. package/dist/core/deployment/kro-factory.js +837 -0
  103. package/dist/core/deployment/kro-factory.js.map +1 -0
  104. package/dist/core/deployment/readiness.d.ts +54 -0
  105. package/dist/core/deployment/readiness.d.ts.map +1 -0
  106. package/dist/core/deployment/readiness.js +175 -0
  107. package/dist/core/deployment/readiness.js.map +1 -0
  108. package/dist/core/deployment/rollback-manager.d.ts +63 -0
  109. package/dist/core/deployment/rollback-manager.d.ts.map +1 -0
  110. package/dist/core/deployment/rollback-manager.js +225 -0
  111. package/dist/core/deployment/rollback-manager.js.map +1 -0
  112. package/dist/core/deployment/shared-utilities.d.ts +41 -0
  113. package/dist/core/deployment/shared-utilities.d.ts.map +1 -0
  114. package/dist/core/deployment/shared-utilities.js +100 -0
  115. package/dist/core/deployment/shared-utilities.js.map +1 -0
  116. package/dist/core/deployment/status-hydrator.d.ts +86 -0
  117. package/dist/core/deployment/status-hydrator.d.ts.map +1 -0
  118. package/dist/core/deployment/status-hydrator.js +262 -0
  119. package/dist/core/deployment/status-hydrator.js.map +1 -0
  120. package/dist/core/deployment/strategies/alchemy-strategy.d.ts +107 -0
  121. package/dist/core/deployment/strategies/alchemy-strategy.d.ts.map +1 -0
  122. package/dist/core/deployment/strategies/alchemy-strategy.js +446 -0
  123. package/dist/core/deployment/strategies/alchemy-strategy.js.map +1 -0
  124. package/dist/core/deployment/strategies/base-strategy.d.ts +50 -0
  125. package/dist/core/deployment/strategies/base-strategy.d.ts.map +1 -0
  126. package/dist/core/deployment/strategies/base-strategy.js +82 -0
  127. package/dist/core/deployment/strategies/base-strategy.js.map +1 -0
  128. package/dist/core/deployment/strategies/direct-strategy.d.ts +29 -0
  129. package/dist/core/deployment/strategies/direct-strategy.d.ts.map +1 -0
  130. package/dist/core/deployment/strategies/direct-strategy.js +80 -0
  131. package/dist/core/deployment/strategies/direct-strategy.js.map +1 -0
  132. package/dist/core/deployment/strategies/index.d.ts +12 -0
  133. package/dist/core/deployment/strategies/index.d.ts.map +1 -0
  134. package/dist/core/deployment/strategies/index.js +12 -0
  135. package/dist/core/deployment/strategies/index.js.map +1 -0
  136. package/dist/core/deployment/strategies/kro-strategy.d.ts +41 -0
  137. package/dist/core/deployment/strategies/kro-strategy.d.ts.map +1 -0
  138. package/dist/core/deployment/strategies/kro-strategy.js +270 -0
  139. package/dist/core/deployment/strategies/kro-strategy.js.map +1 -0
  140. package/dist/core/direct-deployment.d.ts +8 -0
  141. package/dist/core/direct-deployment.d.ts.map +1 -0
  142. package/dist/core/direct-deployment.js +9 -0
  143. package/dist/core/direct-deployment.js.map +1 -0
  144. package/dist/core/errors.d.ts +73 -0
  145. package/dist/core/errors.d.ts.map +1 -0
  146. package/dist/core/errors.js +250 -0
  147. package/dist/core/errors.js.map +1 -0
  148. package/dist/core/evaluation/cel-optimizer.d.ts +48 -0
  149. package/dist/core/evaluation/cel-optimizer.d.ts.map +1 -0
  150. package/dist/core/evaluation/cel-optimizer.js +176 -0
  151. package/dist/core/evaluation/cel-optimizer.js.map +1 -0
  152. package/dist/core/factory.d.ts +12 -0
  153. package/dist/core/factory.d.ts.map +1 -0
  154. package/dist/core/factory.js +13 -0
  155. package/dist/core/factory.js.map +1 -0
  156. package/dist/core/kubernetes/api.d.ts +43 -0
  157. package/dist/core/kubernetes/api.d.ts.map +1 -0
  158. package/dist/core/kubernetes/api.js +209 -0
  159. package/dist/core/kubernetes/api.js.map +1 -0
  160. package/dist/core/kubernetes/client-provider.d.ts +204 -0
  161. package/dist/core/kubernetes/client-provider.d.ts.map +1 -0
  162. package/dist/core/kubernetes/client-provider.js +421 -0
  163. package/dist/core/kubernetes/client-provider.js.map +1 -0
  164. package/dist/core/logging/config.d.ts +14 -0
  165. package/dist/core/logging/config.d.ts.map +1 -0
  166. package/dist/core/logging/config.js +57 -0
  167. package/dist/core/logging/config.js.map +1 -0
  168. package/dist/core/logging/index.d.ts +4 -0
  169. package/dist/core/logging/index.d.ts.map +1 -0
  170. package/dist/core/logging/index.js +4 -0
  171. package/dist/core/logging/index.js.map +1 -0
  172. package/dist/core/logging/logger.d.ts +26 -0
  173. package/dist/core/logging/logger.d.ts.map +1 -0
  174. package/dist/core/logging/logger.js +114 -0
  175. package/dist/core/logging/logger.js.map +1 -0
  176. package/dist/core/logging/types.d.ts +93 -0
  177. package/dist/core/logging/types.d.ts.map +1 -0
  178. package/dist/core/logging/types.js +2 -0
  179. package/dist/core/logging/types.js.map +1 -0
  180. package/dist/core/readiness/cluster-state.d.ts +229 -0
  181. package/dist/core/readiness/cluster-state.d.ts.map +1 -0
  182. package/dist/core/readiness/cluster-state.js +360 -0
  183. package/dist/core/readiness/cluster-state.js.map +1 -0
  184. package/dist/core/readiness/index.d.ts +5 -0
  185. package/dist/core/readiness/index.d.ts.map +1 -0
  186. package/dist/core/readiness/index.js +5 -0
  187. package/dist/core/readiness/index.js.map +1 -0
  188. package/dist/core/readiness/registry.d.ts +45 -0
  189. package/dist/core/readiness/registry.d.ts.map +1 -0
  190. package/dist/core/readiness/registry.js +62 -0
  191. package/dist/core/readiness/registry.js.map +1 -0
  192. package/dist/core/references/cel-evaluator.d.ts +102 -0
  193. package/dist/core/references/cel-evaluator.d.ts.map +1 -0
  194. package/dist/core/references/cel-evaluator.js +288 -0
  195. package/dist/core/references/cel-evaluator.js.map +1 -0
  196. package/dist/core/references/cel.d.ts +75 -0
  197. package/dist/core/references/cel.d.ts.map +1 -0
  198. package/dist/core/references/cel.js +213 -0
  199. package/dist/core/references/cel.js.map +1 -0
  200. package/dist/core/references/external-refs.d.ts +37 -0
  201. package/dist/core/references/external-refs.d.ts.map +1 -0
  202. package/dist/core/references/external-refs.js +53 -0
  203. package/dist/core/references/external-refs.js.map +1 -0
  204. package/dist/core/references/index.d.ts +15 -0
  205. package/dist/core/references/index.d.ts.map +1 -0
  206. package/dist/core/references/index.js +19 -0
  207. package/dist/core/references/index.js.map +1 -0
  208. package/dist/core/references/resolver.d.ts +117 -0
  209. package/dist/core/references/resolver.d.ts.map +1 -0
  210. package/dist/core/references/resolver.js +554 -0
  211. package/dist/core/references/resolver.js.map +1 -0
  212. package/dist/core/references/schema-proxy.d.ts +38 -0
  213. package/dist/core/references/schema-proxy.d.ts.map +1 -0
  214. package/dist/core/references/schema-proxy.js +163 -0
  215. package/dist/core/references/schema-proxy.js.map +1 -0
  216. package/dist/core/serialization/core.d.ts +15 -0
  217. package/dist/core/serialization/core.d.ts.map +1 -0
  218. package/dist/core/serialization/core.js +169 -0
  219. package/dist/core/serialization/core.js.map +1 -0
  220. package/dist/core/serialization/index.d.ts +9 -0
  221. package/dist/core/serialization/index.d.ts.map +1 -0
  222. package/dist/core/serialization/index.js +12 -0
  223. package/dist/core/serialization/index.js.map +1 -0
  224. package/dist/core/serialization/schema.d.ts +14 -0
  225. package/dist/core/serialization/schema.d.ts.map +1 -0
  226. package/dist/core/serialization/schema.js +33 -0
  227. package/dist/core/serialization/schema.js.map +1 -0
  228. package/dist/core/serialization/validation.d.ts +18 -0
  229. package/dist/core/serialization/validation.d.ts.map +1 -0
  230. package/dist/core/serialization/validation.js +165 -0
  231. package/dist/core/serialization/validation.js.map +1 -0
  232. package/dist/core/serialization/yaml.d.ts +10 -0
  233. package/dist/core/serialization/yaml.d.ts.map +1 -0
  234. package/dist/core/serialization/yaml.js +63 -0
  235. package/dist/core/serialization/yaml.js.map +1 -0
  236. package/dist/core/types/common.d.ts +41 -0
  237. package/dist/core/types/common.d.ts.map +1 -0
  238. package/dist/core/types/common.js +9 -0
  239. package/dist/core/types/common.js.map +1 -0
  240. package/dist/core/types/dependencies.d.ts +14 -0
  241. package/dist/core/types/dependencies.d.ts.map +1 -0
  242. package/dist/core/types/dependencies.js +5 -0
  243. package/dist/core/types/dependencies.js.map +1 -0
  244. package/dist/core/types/deployment.d.ts +265 -0
  245. package/dist/core/types/deployment.d.ts.map +1 -0
  246. package/dist/core/types/deployment.js +20 -0
  247. package/dist/core/types/deployment.js.map +1 -0
  248. package/dist/core/types/index.d.ts +19 -0
  249. package/dist/core/types/index.d.ts.map +1 -0
  250. package/dist/core/types/index.js +15 -0
  251. package/dist/core/types/index.js.map +1 -0
  252. package/dist/core/types/kubernetes.d.ts +352 -0
  253. package/dist/core/types/kubernetes.d.ts.map +1 -0
  254. package/dist/core/types/kubernetes.js +5 -0
  255. package/dist/core/types/kubernetes.js.map +1 -0
  256. package/dist/core/types/references.d.ts +54 -0
  257. package/dist/core/types/references.d.ts.map +1 -0
  258. package/dist/core/types/references.js +14 -0
  259. package/dist/core/types/references.js.map +1 -0
  260. package/dist/core/types/resource-graph.d.ts +93 -0
  261. package/dist/core/types/resource-graph.d.ts.map +1 -0
  262. package/dist/core/types/resource-graph.js +8 -0
  263. package/dist/core/types/resource-graph.js.map +1 -0
  264. package/dist/core/types/serialization.d.ts +210 -0
  265. package/dist/core/types/serialization.d.ts.map +1 -0
  266. package/dist/core/types/serialization.js +5 -0
  267. package/dist/core/types/serialization.js.map +1 -0
  268. package/dist/core/types/yaml.d.ts +92 -0
  269. package/dist/core/types/yaml.d.ts.map +1 -0
  270. package/dist/core/types/yaml.js +2 -0
  271. package/dist/core/types/yaml.js.map +1 -0
  272. package/dist/core/types.d.ts +8 -0
  273. package/dist/core/types.d.ts.map +1 -0
  274. package/dist/core/types.js +9 -0
  275. package/dist/core/types.js.map +1 -0
  276. package/dist/core/validation/cel-validator.d.ts +47 -0
  277. package/dist/core/validation/cel-validator.d.ts.map +1 -0
  278. package/dist/core/validation/cel-validator.js +200 -0
  279. package/dist/core/validation/cel-validator.js.map +1 -0
  280. package/dist/core/yaml/index.d.ts +5 -0
  281. package/dist/core/yaml/index.d.ts.map +1 -0
  282. package/dist/core/yaml/index.js +5 -0
  283. package/dist/core/yaml/index.js.map +1 -0
  284. package/dist/core/yaml/path-resolver.d.ts +122 -0
  285. package/dist/core/yaml/path-resolver.d.ts.map +1 -0
  286. package/dist/core/yaml/path-resolver.js +556 -0
  287. package/dist/core/yaml/path-resolver.js.map +1 -0
  288. package/dist/core.d.ts +30 -0
  289. package/dist/core.d.ts.map +1 -0
  290. package/dist/core.js +59 -0
  291. package/dist/core.js.map +1 -0
  292. package/dist/factories/flux/git-repository.d.ts +62 -0
  293. package/dist/factories/flux/git-repository.d.ts.map +1 -0
  294. package/dist/factories/flux/git-repository.js +34 -0
  295. package/dist/factories/flux/git-repository.js.map +1 -0
  296. package/dist/factories/flux/index.d.ts +10 -0
  297. package/dist/factories/flux/index.d.ts.map +1 -0
  298. package/dist/factories/flux/index.js +11 -0
  299. package/dist/factories/flux/index.js.map +1 -0
  300. package/dist/factories/flux/kustomize/index.d.ts +4 -0
  301. package/dist/factories/flux/kustomize/index.d.ts.map +1 -0
  302. package/dist/factories/flux/kustomize/index.js +3 -0
  303. package/dist/factories/flux/kustomize/index.js.map +1 -0
  304. package/dist/factories/flux/kustomize/kustomization.d.ts +178 -0
  305. package/dist/factories/flux/kustomize/kustomization.d.ts.map +1 -0
  306. package/dist/factories/flux/kustomize/kustomization.js +108 -0
  307. package/dist/factories/flux/kustomize/kustomization.js.map +1 -0
  308. package/dist/factories/flux/kustomize/readiness-evaluators.d.ts +9 -0
  309. package/dist/factories/flux/kustomize/readiness-evaluators.d.ts.map +1 -0
  310. package/dist/factories/flux/kustomize/readiness-evaluators.js +71 -0
  311. package/dist/factories/flux/kustomize/readiness-evaluators.js.map +1 -0
  312. package/dist/factories/flux/kustomize/types.d.ts +2 -0
  313. package/dist/factories/flux/kustomize/types.d.ts.map +1 -0
  314. package/dist/factories/flux/kustomize/types.js +2 -0
  315. package/dist/factories/flux/kustomize/types.js.map +1 -0
  316. package/dist/factories/helm/helm-release.d.ts +139 -0
  317. package/dist/factories/helm/helm-release.d.ts.map +1 -0
  318. package/dist/factories/helm/helm-release.js +180 -0
  319. package/dist/factories/helm/helm-release.js.map +1 -0
  320. package/dist/factories/helm/helm-repository.d.ts +24 -0
  321. package/dist/factories/helm/helm-repository.d.ts.map +1 -0
  322. package/dist/factories/helm/helm-repository.js +57 -0
  323. package/dist/factories/helm/helm-repository.js.map +1 -0
  324. package/dist/factories/helm/index.d.ts +8 -0
  325. package/dist/factories/helm/index.d.ts.map +1 -0
  326. package/dist/factories/helm/index.js +8 -0
  327. package/dist/factories/helm/index.js.map +1 -0
  328. package/dist/factories/helm/readiness-evaluators.d.ts +55 -0
  329. package/dist/factories/helm/readiness-evaluators.d.ts.map +1 -0
  330. package/dist/factories/helm/readiness-evaluators.js +295 -0
  331. package/dist/factories/helm/readiness-evaluators.js.map +1 -0
  332. package/dist/factories/helm/types.d.ts +21 -0
  333. package/dist/factories/helm/types.d.ts.map +1 -0
  334. package/dist/factories/helm/types.js +2 -0
  335. package/dist/factories/helm/types.js.map +1 -0
  336. package/dist/factories/index.d.ts +12 -0
  337. package/dist/factories/index.d.ts.map +1 -0
  338. package/dist/factories/index.js +31 -0
  339. package/dist/factories/index.js.map +1 -0
  340. package/dist/factories/kro/index.d.ts +11 -0
  341. package/dist/factories/kro/index.d.ts.map +1 -0
  342. package/dist/factories/kro/index.js +10 -0
  343. package/dist/factories/kro/index.js.map +1 -0
  344. package/dist/factories/kro/kro-crd.d.ts +14 -0
  345. package/dist/factories/kro/kro-crd.d.ts.map +1 -0
  346. package/dist/factories/kro/kro-crd.js +51 -0
  347. package/dist/factories/kro/kro-crd.js.map +1 -0
  348. package/dist/factories/kro/kro-custom-resource.d.ts +23 -0
  349. package/dist/factories/kro/kro-custom-resource.d.ts.map +1 -0
  350. package/dist/factories/kro/kro-custom-resource.js +153 -0
  351. package/dist/factories/kro/kro-custom-resource.js.map +1 -0
  352. package/dist/factories/kro/resource-graph-definition.d.ts +12 -0
  353. package/dist/factories/kro/resource-graph-definition.d.ts.map +1 -0
  354. package/dist/factories/kro/resource-graph-definition.js +94 -0
  355. package/dist/factories/kro/resource-graph-definition.js.map +1 -0
  356. package/dist/factories/kubernetes/admission/index.d.ts +9 -0
  357. package/dist/factories/kubernetes/admission/index.d.ts.map +1 -0
  358. package/dist/factories/kubernetes/admission/index.js +9 -0
  359. package/dist/factories/kubernetes/admission/index.js.map +1 -0
  360. package/dist/factories/kubernetes/admission/mutating-webhook-configuration.d.ts +5 -0
  361. package/dist/factories/kubernetes/admission/mutating-webhook-configuration.d.ts.map +1 -0
  362. package/dist/factories/kubernetes/admission/mutating-webhook-configuration.js +10 -0
  363. package/dist/factories/kubernetes/admission/mutating-webhook-configuration.js.map +1 -0
  364. package/dist/factories/kubernetes/admission/validating-webhook-configuration.d.ts +5 -0
  365. package/dist/factories/kubernetes/admission/validating-webhook-configuration.d.ts.map +1 -0
  366. package/dist/factories/kubernetes/admission/validating-webhook-configuration.js +10 -0
  367. package/dist/factories/kubernetes/admission/validating-webhook-configuration.js.map +1 -0
  368. package/dist/factories/kubernetes/autoscaling/horizontal-pod-autoscaler-v1.d.ts +6 -0
  369. package/dist/factories/kubernetes/autoscaling/horizontal-pod-autoscaler-v1.d.ts.map +1 -0
  370. package/dist/factories/kubernetes/autoscaling/horizontal-pod-autoscaler-v1.js +35 -0
  371. package/dist/factories/kubernetes/autoscaling/horizontal-pod-autoscaler-v1.js.map +1 -0
  372. package/dist/factories/kubernetes/autoscaling/horizontal-pod-autoscaler.d.ts +6 -0
  373. package/dist/factories/kubernetes/autoscaling/horizontal-pod-autoscaler.d.ts.map +1 -0
  374. package/dist/factories/kubernetes/autoscaling/horizontal-pod-autoscaler.js +31 -0
  375. package/dist/factories/kubernetes/autoscaling/horizontal-pod-autoscaler.js.map +1 -0
  376. package/dist/factories/kubernetes/autoscaling/index.d.ts +9 -0
  377. package/dist/factories/kubernetes/autoscaling/index.d.ts.map +1 -0
  378. package/dist/factories/kubernetes/autoscaling/index.js +9 -0
  379. package/dist/factories/kubernetes/autoscaling/index.js.map +1 -0
  380. package/dist/factories/kubernetes/certificates/certificate-signing-request.d.ts +6 -0
  381. package/dist/factories/kubernetes/certificates/certificate-signing-request.d.ts.map +1 -0
  382. package/dist/factories/kubernetes/certificates/certificate-signing-request.js +48 -0
  383. package/dist/factories/kubernetes/certificates/certificate-signing-request.js.map +1 -0
  384. package/dist/factories/kubernetes/certificates/index.d.ts +8 -0
  385. package/dist/factories/kubernetes/certificates/index.d.ts.map +1 -0
  386. package/dist/factories/kubernetes/certificates/index.js +8 -0
  387. package/dist/factories/kubernetes/certificates/index.js.map +1 -0
  388. package/dist/factories/kubernetes/config/config-map.d.ts +5 -0
  389. package/dist/factories/kubernetes/config/config-map.d.ts.map +1 -0
  390. package/dist/factories/kubernetes/config/config-map.js +16 -0
  391. package/dist/factories/kubernetes/config/config-map.js.map +1 -0
  392. package/dist/factories/kubernetes/config/index.d.ts +9 -0
  393. package/dist/factories/kubernetes/config/index.d.ts.map +1 -0
  394. package/dist/factories/kubernetes/config/index.js +9 -0
  395. package/dist/factories/kubernetes/config/index.js.map +1 -0
  396. package/dist/factories/kubernetes/config/secret.d.ts +5 -0
  397. package/dist/factories/kubernetes/config/secret.d.ts.map +1 -0
  398. package/dist/factories/kubernetes/config/secret.js +16 -0
  399. package/dist/factories/kubernetes/config/secret.js.map +1 -0
  400. package/dist/factories/kubernetes/coordination/index.d.ts +8 -0
  401. package/dist/factories/kubernetes/coordination/index.d.ts.map +1 -0
  402. package/dist/factories/kubernetes/coordination/index.js +8 -0
  403. package/dist/factories/kubernetes/coordination/index.js.map +1 -0
  404. package/dist/factories/kubernetes/coordination/lease.d.ts +5 -0
  405. package/dist/factories/kubernetes/coordination/lease.d.ts.map +1 -0
  406. package/dist/factories/kubernetes/coordination/lease.js +10 -0
  407. package/dist/factories/kubernetes/coordination/lease.js.map +1 -0
  408. package/dist/factories/kubernetes/core/component-status.d.ts +4 -0
  409. package/dist/factories/kubernetes/core/component-status.d.ts.map +1 -0
  410. package/dist/factories/kubernetes/core/component-status.js +25 -0
  411. package/dist/factories/kubernetes/core/component-status.js.map +1 -0
  412. package/dist/factories/kubernetes/core/index.d.ts +11 -0
  413. package/dist/factories/kubernetes/core/index.d.ts.map +1 -0
  414. package/dist/factories/kubernetes/core/index.js +11 -0
  415. package/dist/factories/kubernetes/core/index.js.map +1 -0
  416. package/dist/factories/kubernetes/core/namespace.d.ts +9 -0
  417. package/dist/factories/kubernetes/core/namespace.d.ts.map +1 -0
  418. package/dist/factories/kubernetes/core/namespace.js +48 -0
  419. package/dist/factories/kubernetes/core/namespace.js.map +1 -0
  420. package/dist/factories/kubernetes/core/node.d.ts +6 -0
  421. package/dist/factories/kubernetes/core/node.d.ts.map +1 -0
  422. package/dist/factories/kubernetes/core/node.js +34 -0
  423. package/dist/factories/kubernetes/core/node.js.map +1 -0
  424. package/dist/factories/kubernetes/core/pod.d.ts +6 -0
  425. package/dist/factories/kubernetes/core/pod.d.ts.map +1 -0
  426. package/dist/factories/kubernetes/core/pod.js +44 -0
  427. package/dist/factories/kubernetes/core/pod.js.map +1 -0
  428. package/dist/factories/kubernetes/extensions/custom-resource-definition.d.ts +6 -0
  429. package/dist/factories/kubernetes/extensions/custom-resource-definition.d.ts.map +1 -0
  430. package/dist/factories/kubernetes/extensions/custom-resource-definition.js +45 -0
  431. package/dist/factories/kubernetes/extensions/custom-resource-definition.js.map +1 -0
  432. package/dist/factories/kubernetes/extensions/custom-resource.d.ts +12 -0
  433. package/dist/factories/kubernetes/extensions/custom-resource.d.ts.map +1 -0
  434. package/dist/factories/kubernetes/extensions/custom-resource.js +17 -0
  435. package/dist/factories/kubernetes/extensions/custom-resource.js.map +1 -0
  436. package/dist/factories/kubernetes/extensions/index.d.ts +9 -0
  437. package/dist/factories/kubernetes/extensions/index.d.ts.map +1 -0
  438. package/dist/factories/kubernetes/extensions/index.js +9 -0
  439. package/dist/factories/kubernetes/extensions/index.js.map +1 -0
  440. package/dist/factories/kubernetes/index.d.ts +24 -0
  441. package/dist/factories/kubernetes/index.d.ts.map +1 -0
  442. package/dist/factories/kubernetes/index.js +75 -0
  443. package/dist/factories/kubernetes/index.js.map +1 -0
  444. package/dist/factories/kubernetes/networking/endpoint-slice.d.ts +4 -0
  445. package/dist/factories/kubernetes/networking/endpoint-slice.d.ts.map +1 -0
  446. package/dist/factories/kubernetes/networking/endpoint-slice.js +10 -0
  447. package/dist/factories/kubernetes/networking/endpoint-slice.js.map +1 -0
  448. package/dist/factories/kubernetes/networking/endpoints.d.ts +4 -0
  449. package/dist/factories/kubernetes/networking/endpoints.d.ts.map +1 -0
  450. package/dist/factories/kubernetes/networking/endpoints.js +39 -0
  451. package/dist/factories/kubernetes/networking/endpoints.js.map +1 -0
  452. package/dist/factories/kubernetes/networking/index.d.ts +13 -0
  453. package/dist/factories/kubernetes/networking/index.d.ts.map +1 -0
  454. package/dist/factories/kubernetes/networking/index.js +13 -0
  455. package/dist/factories/kubernetes/networking/index.js.map +1 -0
  456. package/dist/factories/kubernetes/networking/ingress-class.d.ts +5 -0
  457. package/dist/factories/kubernetes/networking/ingress-class.d.ts.map +1 -0
  458. package/dist/factories/kubernetes/networking/ingress-class.js +16 -0
  459. package/dist/factories/kubernetes/networking/ingress-class.js.map +1 -0
  460. package/dist/factories/kubernetes/networking/ingress.d.ts +5 -0
  461. package/dist/factories/kubernetes/networking/ingress.d.ts.map +1 -0
  462. package/dist/factories/kubernetes/networking/ingress.js +33 -0
  463. package/dist/factories/kubernetes/networking/ingress.js.map +1 -0
  464. package/dist/factories/kubernetes/networking/network-policy.d.ts +5 -0
  465. package/dist/factories/kubernetes/networking/network-policy.d.ts.map +1 -0
  466. package/dist/factories/kubernetes/networking/network-policy.js +17 -0
  467. package/dist/factories/kubernetes/networking/network-policy.js.map +1 -0
  468. package/dist/factories/kubernetes/networking/service.d.ts +5 -0
  469. package/dist/factories/kubernetes/networking/service.d.ts.map +1 -0
  470. package/dist/factories/kubernetes/networking/service.js +64 -0
  471. package/dist/factories/kubernetes/networking/service.js.map +1 -0
  472. package/dist/factories/kubernetes/policy/index.d.ts +10 -0
  473. package/dist/factories/kubernetes/policy/index.d.ts.map +1 -0
  474. package/dist/factories/kubernetes/policy/index.js +10 -0
  475. package/dist/factories/kubernetes/policy/index.js.map +1 -0
  476. package/dist/factories/kubernetes/policy/limit-range.d.ts +5 -0
  477. package/dist/factories/kubernetes/policy/limit-range.d.ts.map +1 -0
  478. package/dist/factories/kubernetes/policy/limit-range.js +17 -0
  479. package/dist/factories/kubernetes/policy/limit-range.js.map +1 -0
  480. package/dist/factories/kubernetes/policy/pod-disruption-budget.d.ts +6 -0
  481. package/dist/factories/kubernetes/policy/pod-disruption-budget.d.ts.map +1 -0
  482. package/dist/factories/kubernetes/policy/pod-disruption-budget.js +55 -0
  483. package/dist/factories/kubernetes/policy/pod-disruption-budget.js.map +1 -0
  484. package/dist/factories/kubernetes/policy/resource-quota.d.ts +6 -0
  485. package/dist/factories/kubernetes/policy/resource-quota.d.ts.map +1 -0
  486. package/dist/factories/kubernetes/policy/resource-quota.js +43 -0
  487. package/dist/factories/kubernetes/policy/resource-quota.js.map +1 -0
  488. package/dist/factories/kubernetes/rbac/cluster-role-binding.d.ts +4 -0
  489. package/dist/factories/kubernetes/rbac/cluster-role-binding.d.ts.map +1 -0
  490. package/dist/factories/kubernetes/rbac/cluster-role-binding.js +17 -0
  491. package/dist/factories/kubernetes/rbac/cluster-role-binding.js.map +1 -0
  492. package/dist/factories/kubernetes/rbac/cluster-role.d.ts +4 -0
  493. package/dist/factories/kubernetes/rbac/cluster-role.d.ts.map +1 -0
  494. package/dist/factories/kubernetes/rbac/cluster-role.js +17 -0
  495. package/dist/factories/kubernetes/rbac/cluster-role.js.map +1 -0
  496. package/dist/factories/kubernetes/rbac/index.d.ts +12 -0
  497. package/dist/factories/kubernetes/rbac/index.d.ts.map +1 -0
  498. package/dist/factories/kubernetes/rbac/index.js +12 -0
  499. package/dist/factories/kubernetes/rbac/index.js.map +1 -0
  500. package/dist/factories/kubernetes/rbac/role-binding.d.ts +4 -0
  501. package/dist/factories/kubernetes/rbac/role-binding.d.ts.map +1 -0
  502. package/dist/factories/kubernetes/rbac/role-binding.js +17 -0
  503. package/dist/factories/kubernetes/rbac/role-binding.js.map +1 -0
  504. package/dist/factories/kubernetes/rbac/role.d.ts +4 -0
  505. package/dist/factories/kubernetes/rbac/role.d.ts.map +1 -0
  506. package/dist/factories/kubernetes/rbac/role.js +17 -0
  507. package/dist/factories/kubernetes/rbac/role.js.map +1 -0
  508. package/dist/factories/kubernetes/rbac/service-account.d.ts +4 -0
  509. package/dist/factories/kubernetes/rbac/service-account.d.ts.map +1 -0
  510. package/dist/factories/kubernetes/rbac/service-account.js +17 -0
  511. package/dist/factories/kubernetes/rbac/service-account.js.map +1 -0
  512. package/dist/factories/kubernetes/scheduling/index.d.ts +9 -0
  513. package/dist/factories/kubernetes/scheduling/index.d.ts.map +1 -0
  514. package/dist/factories/kubernetes/scheduling/index.js +9 -0
  515. package/dist/factories/kubernetes/scheduling/index.js.map +1 -0
  516. package/dist/factories/kubernetes/scheduling/priority-class.d.ts +4 -0
  517. package/dist/factories/kubernetes/scheduling/priority-class.d.ts.map +1 -0
  518. package/dist/factories/kubernetes/scheduling/priority-class.js +16 -0
  519. package/dist/factories/kubernetes/scheduling/priority-class.js.map +1 -0
  520. package/dist/factories/kubernetes/scheduling/runtime-class.d.ts +5 -0
  521. package/dist/factories/kubernetes/scheduling/runtime-class.d.ts.map +1 -0
  522. package/dist/factories/kubernetes/scheduling/runtime-class.js +10 -0
  523. package/dist/factories/kubernetes/scheduling/runtime-class.js.map +1 -0
  524. package/dist/factories/kubernetes/storage/csi-driver.d.ts +5 -0
  525. package/dist/factories/kubernetes/storage/csi-driver.d.ts.map +1 -0
  526. package/dist/factories/kubernetes/storage/csi-driver.js +16 -0
  527. package/dist/factories/kubernetes/storage/csi-driver.js.map +1 -0
  528. package/dist/factories/kubernetes/storage/csi-node.d.ts +5 -0
  529. package/dist/factories/kubernetes/storage/csi-node.d.ts.map +1 -0
  530. package/dist/factories/kubernetes/storage/csi-node.js +10 -0
  531. package/dist/factories/kubernetes/storage/csi-node.js.map +1 -0
  532. package/dist/factories/kubernetes/storage/index.d.ts +13 -0
  533. package/dist/factories/kubernetes/storage/index.d.ts.map +1 -0
  534. package/dist/factories/kubernetes/storage/index.js +13 -0
  535. package/dist/factories/kubernetes/storage/index.js.map +1 -0
  536. package/dist/factories/kubernetes/storage/persistent-volume-claim.d.ts +6 -0
  537. package/dist/factories/kubernetes/storage/persistent-volume-claim.d.ts.map +1 -0
  538. package/dist/factories/kubernetes/storage/persistent-volume-claim.js +30 -0
  539. package/dist/factories/kubernetes/storage/persistent-volume-claim.js.map +1 -0
  540. package/dist/factories/kubernetes/storage/persistent-volume.d.ts +6 -0
  541. package/dist/factories/kubernetes/storage/persistent-volume.d.ts.map +1 -0
  542. package/dist/factories/kubernetes/storage/persistent-volume.js +47 -0
  543. package/dist/factories/kubernetes/storage/persistent-volume.js.map +1 -0
  544. package/dist/factories/kubernetes/storage/storage-class.d.ts +4 -0
  545. package/dist/factories/kubernetes/storage/storage-class.d.ts.map +1 -0
  546. package/dist/factories/kubernetes/storage/storage-class.js +17 -0
  547. package/dist/factories/kubernetes/storage/storage-class.js.map +1 -0
  548. package/dist/factories/kubernetes/storage/volume-attachment.d.ts +6 -0
  549. package/dist/factories/kubernetes/storage/volume-attachment.d.ts.map +1 -0
  550. package/dist/factories/kubernetes/storage/volume-attachment.js +10 -0
  551. package/dist/factories/kubernetes/storage/volume-attachment.js.map +1 -0
  552. package/dist/factories/kubernetes/types.d.ts +8 -0
  553. package/dist/factories/kubernetes/types.d.ts.map +1 -0
  554. package/dist/factories/kubernetes/types.js +8 -0
  555. package/dist/factories/kubernetes/types.js.map +1 -0
  556. package/dist/factories/kubernetes/workloads/cron-job.d.ts +6 -0
  557. package/dist/factories/kubernetes/workloads/cron-job.d.ts.map +1 -0
  558. package/dist/factories/kubernetes/workloads/cron-job.js +53 -0
  559. package/dist/factories/kubernetes/workloads/cron-job.js.map +1 -0
  560. package/dist/factories/kubernetes/workloads/daemon-set.d.ts +6 -0
  561. package/dist/factories/kubernetes/workloads/daemon-set.d.ts.map +1 -0
  562. package/dist/factories/kubernetes/workloads/daemon-set.js +32 -0
  563. package/dist/factories/kubernetes/workloads/daemon-set.js.map +1 -0
  564. package/dist/factories/kubernetes/workloads/deployment.d.ts +5 -0
  565. package/dist/factories/kubernetes/workloads/deployment.d.ts.map +1 -0
  566. package/dist/factories/kubernetes/workloads/deployment.js +59 -0
  567. package/dist/factories/kubernetes/workloads/deployment.js.map +1 -0
  568. package/dist/factories/kubernetes/workloads/index.d.ts +14 -0
  569. package/dist/factories/kubernetes/workloads/index.d.ts.map +1 -0
  570. package/dist/factories/kubernetes/workloads/index.js +14 -0
  571. package/dist/factories/kubernetes/workloads/index.js.map +1 -0
  572. package/dist/factories/kubernetes/workloads/job.d.ts +6 -0
  573. package/dist/factories/kubernetes/workloads/job.d.ts.map +1 -0
  574. package/dist/factories/kubernetes/workloads/job.js +105 -0
  575. package/dist/factories/kubernetes/workloads/job.js.map +1 -0
  576. package/dist/factories/kubernetes/workloads/replica-set.d.ts +6 -0
  577. package/dist/factories/kubernetes/workloads/replica-set.d.ts.map +1 -0
  578. package/dist/factories/kubernetes/workloads/replica-set.js +33 -0
  579. package/dist/factories/kubernetes/workloads/replica-set.js.map +1 -0
  580. package/dist/factories/kubernetes/workloads/replication-controller.d.ts +6 -0
  581. package/dist/factories/kubernetes/workloads/replication-controller.d.ts.map +1 -0
  582. package/dist/factories/kubernetes/workloads/replication-controller.js +56 -0
  583. package/dist/factories/kubernetes/workloads/replication-controller.js.map +1 -0
  584. package/dist/factories/kubernetes/workloads/stateful-set.d.ts +6 -0
  585. package/dist/factories/kubernetes/workloads/stateful-set.d.ts.map +1 -0
  586. package/dist/factories/kubernetes/workloads/stateful-set.js +81 -0
  587. package/dist/factories/kubernetes/workloads/stateful-set.js.map +1 -0
  588. package/dist/factories/kubernetes/yaml/index.d.ts +6 -0
  589. package/dist/factories/kubernetes/yaml/index.d.ts.map +1 -0
  590. package/dist/factories/kubernetes/yaml/index.js +6 -0
  591. package/dist/factories/kubernetes/yaml/index.js.map +1 -0
  592. package/dist/factories/kubernetes/yaml/yaml-directory.d.ts +54 -0
  593. package/dist/factories/kubernetes/yaml/yaml-directory.d.ts.map +1 -0
  594. package/dist/factories/kubernetes/yaml/yaml-directory.js +178 -0
  595. package/dist/factories/kubernetes/yaml/yaml-directory.js.map +1 -0
  596. package/dist/factories/kubernetes/yaml/yaml-file.d.ts +54 -0
  597. package/dist/factories/kubernetes/yaml/yaml-file.d.ts.map +1 -0
  598. package/dist/factories/kubernetes/yaml/yaml-file.js +181 -0
  599. package/dist/factories/kubernetes/yaml/yaml-file.js.map +1 -0
  600. package/dist/factories/shared.d.ts +11 -0
  601. package/dist/factories/shared.d.ts.map +1 -0
  602. package/dist/factories/shared.js +364 -0
  603. package/dist/factories/shared.js.map +1 -0
  604. package/dist/index.d.ts +9 -0
  605. package/dist/index.d.ts.map +1 -0
  606. package/dist/index.js +49 -0
  607. package/dist/index.js.map +1 -0
  608. package/dist/utils/helpers.d.ts +69 -0
  609. package/dist/utils/helpers.d.ts.map +1 -0
  610. package/dist/utils/helpers.js +405 -0
  611. package/dist/utils/helpers.js.map +1 -0
  612. package/dist/utils/index.d.ts +9 -0
  613. package/dist/utils/index.d.ts.map +1 -0
  614. package/dist/utils/index.js +11 -0
  615. package/dist/utils/index.js.map +1 -0
  616. package/dist/utils/type-guards.d.ts +34 -0
  617. package/dist/utils/type-guards.d.ts.map +1 -0
  618. package/dist/utils/type-guards.js +66 -0
  619. package/dist/utils/type-guards.js.map +1 -0
  620. package/package.json +109 -0
@@ -0,0 +1,122 @@
1
+ /**
2
+ * Path resolution system for YAML resources
3
+ * Handles local files, directories, and Git repositories
4
+ */
5
+ import { TypeKroError } from '../errors.js';
6
+ /**
7
+ * Information parsed from a git: URL
8
+ */
9
+ export interface GitPathInfo {
10
+ host: string;
11
+ owner: string;
12
+ repo: string;
13
+ path: string;
14
+ ref: string;
15
+ }
16
+ /**
17
+ * Result of content resolution
18
+ */
19
+ export interface ResolvedContent {
20
+ content: string;
21
+ source: 'local' | 'git' | 'http';
22
+ originalPath: string;
23
+ resolvedPath?: string;
24
+ }
25
+ /**
26
+ * Result of directory discovery
27
+ */
28
+ export interface DiscoveredFile {
29
+ path: string;
30
+ relativePath: string;
31
+ content: string;
32
+ }
33
+ /**
34
+ * YAML-specific error types
35
+ */
36
+ export declare class YamlPathResolutionError extends TypeKroError {
37
+ readonly resourceName: string;
38
+ readonly path: string;
39
+ readonly suggestions?: string[] | undefined;
40
+ constructor(message: string, resourceName: string, path: string, suggestions?: string[] | undefined);
41
+ static invalidGitUrl(resourceName: string, userInput: string): YamlPathResolutionError;
42
+ static fileNotFound(resourceName: string, filePath: string): YamlPathResolutionError;
43
+ static directoryNotFound(resourceName: string, dirPath: string): YamlPathResolutionError;
44
+ }
45
+ export declare class GitContentError extends TypeKroError {
46
+ readonly resourceName: string;
47
+ readonly gitPath: string;
48
+ readonly suggestions?: string[] | undefined;
49
+ constructor(message: string, resourceName: string, gitPath: string, suggestions?: string[] | undefined);
50
+ static repositoryNotFound(resourceName: string, gitPath: string): GitContentError;
51
+ static authenticationFailed(resourceName: string, gitPath: string): GitContentError;
52
+ static pathNotFound(resourceName: string, gitPath: string, pathInRepo: string): GitContentError;
53
+ }
54
+ export declare class YamlProcessingError extends TypeKroError {
55
+ readonly resourceName: string;
56
+ readonly filePath: string;
57
+ readonly line?: number | undefined;
58
+ readonly suggestions?: string[] | undefined;
59
+ constructor(message: string, resourceName: string, filePath: string, line?: number | undefined, suggestions?: string[] | undefined);
60
+ static invalidYaml(resourceName: string, filePath: string, line?: number): YamlProcessingError;
61
+ }
62
+ /**
63
+ * Unified path resolver for local files and Git repositories
64
+ */
65
+ export declare class PathResolver {
66
+ /**
67
+ * Resolve content from a path (local file or git: URL)
68
+ */
69
+ resolveContent(filePath: string, resourceName?: string): Promise<ResolvedContent>;
70
+ /**
71
+ * Resolve content from a local file
72
+ */
73
+ resolveLocalContent(localPath: string, resourceName?: string): Promise<string>;
74
+ /**
75
+ * Resolve content from a Git repository
76
+ */
77
+ resolveGitContent(gitPath: string, resourceName?: string): Promise<string>;
78
+ /**
79
+ * Parse a git: URL into components
80
+ * Format: git:github.com/owner/repo/path/to/file.yaml[@ref]
81
+ */
82
+ parseGitPath(gitPath: string, resourceName?: string): GitPathInfo;
83
+ /**
84
+ * Fetch content from Git repository
85
+ * Currently supports GitHub API for public repositories
86
+ */
87
+ private fetchFromGit;
88
+ /**
89
+ * Discover YAML files in a directory (local or Git)
90
+ */
91
+ discoverYamlFiles(dirPath: string, options?: {
92
+ recursive?: boolean;
93
+ include?: string[];
94
+ exclude?: string[];
95
+ }, resourceName?: string): Promise<DiscoveredFile[]>;
96
+ /**
97
+ * Discover YAML files in a local directory
98
+ */
99
+ private discoverLocalYamlFiles;
100
+ /**
101
+ * Recursively walk a directory and collect YAML files
102
+ */
103
+ private walkDirectory;
104
+ /**
105
+ * Discover YAML files in a Git repository directory
106
+ */
107
+ private discoverGitYamlFiles;
108
+ /**
109
+ * Check if a file path matches any of the given glob patterns
110
+ * Simple implementation - could be enhanced with a proper glob library
111
+ */
112
+ private matchesPatterns;
113
+ /**
114
+ * Resolve content from an HTTP/HTTPS URL
115
+ */
116
+ private resolveHttpContent;
117
+ }
118
+ /**
119
+ * Default path resolver instance
120
+ */
121
+ export declare const pathResolver: PathResolver;
122
+ //# sourceMappingURL=path-resolver.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"path-resolver.d.ts","sourceRoot":"","sources":["../../../src/core/yaml/path-resolver.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAIH,OAAO,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAE5C;;GAEG;AACH,MAAM,WAAW,WAAW;IAC1B,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,GAAG,EAAE,MAAM,CAAC;CACb;AAED;;GAEG;AACH,MAAM,WAAW,eAAe;IAC9B,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,EAAE,OAAO,GAAG,KAAK,GAAG,MAAM,CAAC;IACjC,YAAY,EAAE,MAAM,CAAC;IACrB,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB;AAED;;GAEG;AACH,MAAM,WAAW,cAAc;IAC7B,IAAI,EAAE,MAAM,CAAC;IACb,YAAY,EAAE,MAAM,CAAC;IACrB,OAAO,EAAE,MAAM,CAAC;CACjB;AAED;;GAEG;AACH,qBAAa,uBAAwB,SAAQ,YAAY;aAGrC,YAAY,EAAE,MAAM;aACpB,IAAI,EAAE,MAAM;aACZ,WAAW,CAAC,EAAE,MAAM,EAAE;gBAHtC,OAAO,EAAE,MAAM,EACC,YAAY,EAAE,MAAM,EACpB,IAAI,EAAE,MAAM,EACZ,WAAW,CAAC,EAAE,MAAM,EAAE,YAAA;IAUxC,MAAM,CAAC,aAAa,CAAC,YAAY,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,uBAAuB;IAatF,MAAM,CAAC,YAAY,CAAC,YAAY,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,uBAAuB;IAcpF,MAAM,CAAC,iBAAiB,CAAC,YAAY,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,uBAAuB;CAazF;AAED,qBAAa,eAAgB,SAAQ,YAAY;aAG7B,YAAY,EAAE,MAAM;aACpB,OAAO,EAAE,MAAM;aACf,WAAW,CAAC,EAAE,MAAM,EAAE;gBAHtC,OAAO,EAAE,MAAM,EACC,YAAY,EAAE,MAAM,EACpB,OAAO,EAAE,MAAM,EACf,WAAW,CAAC,EAAE,MAAM,EAAE,YAAA;IAUxC,MAAM,CAAC,kBAAkB,CAAC,YAAY,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,eAAe;IAcjF,MAAM,CAAC,oBAAoB,CAAC,YAAY,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,eAAe;IAcnF,MAAM,CAAC,YAAY,CAAC,YAAY,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,GAAG,eAAe;CAahG;AAED,qBAAa,mBAAoB,SAAQ,YAAY;aAGjC,YAAY,EAAE,MAAM;aACpB,QAAQ,EAAE,MAAM;aAChB,IAAI,CAAC,EAAE,MAAM;aACb,WAAW,CAAC,EAAE,MAAM,EAAE;gBAJtC,OAAO,EAAE,MAAM,EACC,YAAY,EAAE,MAAM,EACpB,QAAQ,EAAE,MAAM,EAChB,IAAI,CAAC,EAAE,MAAM,YAAA,EACb,WAAW,CAAC,EAAE,MAAM,EAAE,YAAA;IAWxC,MAAM,CAAC,WAAW,CAAC,YAAY,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,MAAM,GAAG,mBAAmB;CAe/F;AAED;;GAEG;AACH,qBAAa,YAAY;IACvB;;OAEG;IACG,cAAc,CAAC,QAAQ,EAAE,MAAM,EAAE,YAAY,GAAE,MAAkB,GAAG,OAAO,CAAC,eAAe,CAAC;IA0BlG;;OAEG;IACG,mBAAmB,CAAC,SAAS,EAAE,MAAM,EAAE,YAAY,GAAE,MAAkB,GAAG,OAAO,CAAC,MAAM,CAAC;IAkE/F;;OAEG;IACG,iBAAiB,CAAC,OAAO,EAAE,MAAM,EAAE,YAAY,GAAE,MAAkB,GAAG,OAAO,CAAC,MAAM,CAAC;IAK3F;;;OAGG;IACH,YAAY,CAAC,OAAO,EAAE,MAAM,EAAE,YAAY,GAAE,MAAkB,GAAG,WAAW;IAiB5E;;;OAGG;YACW,YAAY;IAqG1B;;OAEG;IACG,iBAAiB,CACrB,OAAO,EAAE,MAAM,EACf,OAAO,GAAE;QACP,SAAS,CAAC,EAAE,OAAO,CAAC;QACpB,OAAO,CAAC,EAAE,MAAM,EAAE,CAAC;QACnB,OAAO,CAAC,EAAE,MAAM,EAAE,CAAC;KACf,EACN,YAAY,GAAE,MAAkB,GAC/B,OAAO,CAAC,cAAc,EAAE,CAAC;IAc5B;;OAEG;YACW,sBAAsB;IAyDpC;;OAEG;YACW,aAAa;IAyC3B;;OAEG;YACW,oBAAoB;IAqIlC;;;OAGG;IACH,OAAO,CAAC,eAAe;IA6CvB;;OAEG;YACW,kBAAkB;CAoDjC;AAED;;GAEG;AACH,eAAO,MAAM,YAAY,cAAqB,CAAC"}
@@ -0,0 +1,556 @@
1
+ /**
2
+ * Path resolution system for YAML resources
3
+ * Handles local files, directories, and Git repositories
4
+ */
5
+ import * as fs from 'node:fs';
6
+ import * as path from 'node:path';
7
+ import { TypeKroError } from '../errors.js';
8
+ /**
9
+ * YAML-specific error types
10
+ */
11
+ export class YamlPathResolutionError extends TypeKroError {
12
+ resourceName;
13
+ path;
14
+ suggestions;
15
+ constructor(message, resourceName, path, suggestions) {
16
+ super(message, 'YAML_PATH_RESOLUTION_ERROR', {
17
+ resourceName,
18
+ path,
19
+ suggestions,
20
+ });
21
+ this.resourceName = resourceName;
22
+ this.path = path;
23
+ this.suggestions = suggestions;
24
+ this.name = 'YamlPathResolutionError';
25
+ }
26
+ static invalidGitUrl(resourceName, userInput) {
27
+ return new YamlPathResolutionError(`Invalid git URL format for resource '${resourceName}'. Expected: git:github.com/owner/repo/path@ref\nGot: ${userInput}`, resourceName, userInput, [
28
+ 'Use format: git:github.com/owner/repo/path@ref',
29
+ 'Example: git:github.com/fluxcd/helm-controller/config/default@main',
30
+ 'Use GitPaths.fluxHelm() for common controllers',
31
+ ]);
32
+ }
33
+ static fileNotFound(resourceName, filePath) {
34
+ return new YamlPathResolutionError(`File not found for resource '${resourceName}': ${filePath}`, resourceName, filePath, [
35
+ 'Check that the file path is correct and the file exists',
36
+ 'Ensure the file has proper read permissions',
37
+ 'For relative paths, check they are relative to the current working directory',
38
+ 'Use absolute paths if needed to avoid path resolution issues',
39
+ ]);
40
+ }
41
+ static directoryNotFound(resourceName, dirPath) {
42
+ return new YamlPathResolutionError(`Directory not found for resource '${resourceName}': ${dirPath}`, resourceName, dirPath, [
43
+ 'Check that the directory path is correct and the directory exists',
44
+ 'Ensure the directory has proper read permissions',
45
+ 'For relative paths, check they are relative to the current working directory',
46
+ 'Use absolute paths if needed to avoid path resolution issues',
47
+ ]);
48
+ }
49
+ }
50
+ export class GitContentError extends TypeKroError {
51
+ resourceName;
52
+ gitPath;
53
+ suggestions;
54
+ constructor(message, resourceName, gitPath, suggestions) {
55
+ super(message, 'GIT_CONTENT_ERROR', {
56
+ resourceName,
57
+ gitPath,
58
+ suggestions,
59
+ });
60
+ this.resourceName = resourceName;
61
+ this.gitPath = gitPath;
62
+ this.suggestions = suggestions;
63
+ this.name = 'GitContentError';
64
+ }
65
+ static repositoryNotFound(resourceName, gitPath) {
66
+ return new GitContentError(`Git repository not found for resource '${resourceName}': ${gitPath}`, resourceName, gitPath, [
67
+ 'Check that the repository exists and is accessible',
68
+ 'Verify the repository URL and path are correct',
69
+ 'For private repositories, ensure authentication is configured',
70
+ 'Try using a specific branch or tag: @main, @v1.0.0',
71
+ ]);
72
+ }
73
+ static authenticationFailed(resourceName, gitPath) {
74
+ return new GitContentError(`Git authentication failed for resource '${resourceName}': ${gitPath}`, resourceName, gitPath, [
75
+ 'Ensure Git credentials are properly configured',
76
+ 'For GitHub, check that your personal access token has the required permissions',
77
+ 'For private repositories, verify you have read access',
78
+ 'Consider using SSH keys for authentication',
79
+ ]);
80
+ }
81
+ static pathNotFound(resourceName, gitPath, pathInRepo) {
82
+ return new GitContentError(`Path not found in Git repository for resource '${resourceName}': ${pathInRepo} in ${gitPath}`, resourceName, gitPath, [
83
+ 'Check that the path exists in the specified branch/tag',
84
+ 'Verify the path is correct (case-sensitive)',
85
+ 'Try browsing the repository to confirm the path structure',
86
+ 'Ensure you are using the correct branch or tag reference',
87
+ ]);
88
+ }
89
+ }
90
+ export class YamlProcessingError extends TypeKroError {
91
+ resourceName;
92
+ filePath;
93
+ line;
94
+ suggestions;
95
+ constructor(message, resourceName, filePath, line, suggestions) {
96
+ super(message, 'YAML_PROCESSING_ERROR', {
97
+ resourceName,
98
+ filePath,
99
+ line,
100
+ suggestions,
101
+ });
102
+ this.resourceName = resourceName;
103
+ this.filePath = filePath;
104
+ this.line = line;
105
+ this.suggestions = suggestions;
106
+ this.name = 'YamlProcessingError';
107
+ }
108
+ static invalidYaml(resourceName, filePath, line) {
109
+ const lineInfo = line ? ` at line ${line}` : '';
110
+ return new YamlProcessingError(`Invalid YAML syntax in resource '${resourceName}' file '${filePath}'${lineInfo}`, resourceName, filePath, line, [
111
+ 'Check YAML syntax for proper indentation and structure',
112
+ 'Ensure all strings are properly quoted',
113
+ 'Validate YAML using a linter or online validator',
114
+ 'Check for tabs vs spaces consistency',
115
+ ]);
116
+ }
117
+ }
118
+ /**
119
+ * Unified path resolver for local files and Git repositories
120
+ */
121
+ export class PathResolver {
122
+ /**
123
+ * Resolve content from a path (local file or git: URL)
124
+ */
125
+ async resolveContent(filePath, resourceName = 'unknown') {
126
+ if (filePath.startsWith('git:')) {
127
+ const content = await this.resolveGitContent(filePath, resourceName);
128
+ return {
129
+ content,
130
+ source: 'git',
131
+ originalPath: filePath,
132
+ };
133
+ }
134
+ else if (filePath.startsWith('https://') || filePath.startsWith('http://')) {
135
+ const content = await this.resolveHttpContent(filePath, resourceName);
136
+ return {
137
+ content,
138
+ source: 'http',
139
+ originalPath: filePath,
140
+ };
141
+ }
142
+ else {
143
+ const content = await this.resolveLocalContent(filePath, resourceName);
144
+ return {
145
+ content,
146
+ source: 'local',
147
+ originalPath: filePath,
148
+ resolvedPath: path.isAbsolute(filePath) ? filePath : path.resolve(process.cwd(), filePath),
149
+ };
150
+ }
151
+ }
152
+ /**
153
+ * Resolve content from a local file
154
+ */
155
+ async resolveLocalContent(localPath, resourceName = 'unknown') {
156
+ try {
157
+ // Resolve relative paths
158
+ const resolvedPath = path.isAbsolute(localPath)
159
+ ? localPath
160
+ : path.resolve(process.cwd(), localPath);
161
+ // Check if file exists
162
+ if (!fs.existsSync(resolvedPath)) {
163
+ throw YamlPathResolutionError.fileNotFound(resourceName, localPath);
164
+ }
165
+ // Check if it's a file (not a directory)
166
+ const stats = fs.statSync(resolvedPath);
167
+ if (!stats.isFile()) {
168
+ throw new YamlPathResolutionError(`Path is not a file for resource '${resourceName}': ${localPath}`, resourceName, localPath, [
169
+ 'Ensure the path points to a file, not a directory',
170
+ 'Use yamlDirectory() factory for directory processing',
171
+ 'Check that the path is correct',
172
+ ]);
173
+ }
174
+ // Read file content
175
+ return fs.readFileSync(resolvedPath, 'utf-8');
176
+ }
177
+ catch (error) {
178
+ if (error instanceof YamlPathResolutionError) {
179
+ throw error;
180
+ }
181
+ // Handle other file system errors
182
+ if (error instanceof Error) {
183
+ if (error.message.includes('ENOENT')) {
184
+ throw YamlPathResolutionError.fileNotFound(resourceName, localPath);
185
+ }
186
+ if (error.message.includes('EACCES')) {
187
+ throw new YamlPathResolutionError(`Permission denied reading file for resource '${resourceName}': ${localPath}`, resourceName, localPath, [
188
+ 'Check file permissions and ensure read access',
189
+ 'Run with appropriate user permissions',
190
+ 'Verify the file is not locked by another process',
191
+ ]);
192
+ }
193
+ }
194
+ throw new YamlPathResolutionError(`Failed to read file for resource '${resourceName}': ${localPath}. ${error}`, resourceName, localPath, [
195
+ 'Check that the file exists and is readable',
196
+ 'Verify file permissions',
197
+ 'Ensure the path is correct',
198
+ ]);
199
+ }
200
+ }
201
+ /**
202
+ * Resolve content from a Git repository
203
+ */
204
+ async resolveGitContent(gitPath, resourceName = 'unknown') {
205
+ const parsed = this.parseGitPath(gitPath, resourceName);
206
+ return this.fetchFromGit(parsed, resourceName);
207
+ }
208
+ /**
209
+ * Parse a git: URL into components
210
+ * Format: git:github.com/owner/repo/path/to/file.yaml[@ref]
211
+ */
212
+ parseGitPath(gitPath, resourceName = 'unknown') {
213
+ // Match git: URLs with optional @ref suffix
214
+ const match = gitPath.match(/^git:([^/]+)\/([^/]+)\/([^/]+)\/(.+?)(?:@(.+))?$/);
215
+ if (!match) {
216
+ throw YamlPathResolutionError.invalidGitUrl(resourceName, gitPath);
217
+ }
218
+ return {
219
+ host: match[1],
220
+ owner: match[2],
221
+ repo: match[3],
222
+ path: match[4],
223
+ ref: match[5] || 'main',
224
+ };
225
+ }
226
+ /**
227
+ * Fetch content from Git repository
228
+ * Currently supports GitHub API for public repositories
229
+ */
230
+ async fetchFromGit(gitInfo, resourceName) {
231
+ // For now, we'll implement GitHub API support
232
+ // In the future, this could be extended to support other Git hosts
233
+ if (gitInfo.host !== 'github.com') {
234
+ throw new GitContentError(`Unsupported Git host for resource '${resourceName}': ${gitInfo.host}. Currently only github.com is supported.`, resourceName, `git:${gitInfo.host}/${gitInfo.owner}/${gitInfo.repo}/${gitInfo.path}@${gitInfo.ref}`, [
235
+ 'Use github.com for Git repositories',
236
+ 'Consider using local files or copying the repository locally',
237
+ 'Future versions may support additional Git hosts',
238
+ ]);
239
+ }
240
+ try {
241
+ // Use GitHub API to fetch file content
242
+ const apiUrl = `https://api.github.com/repos/${gitInfo.owner}/${gitInfo.repo}/contents/${gitInfo.path}?ref=${gitInfo.ref}`;
243
+ const response = await fetch(apiUrl, {
244
+ headers: {
245
+ 'Accept': 'application/vnd.github.v3+json',
246
+ 'User-Agent': 'TypeKro/1.0',
247
+ // TODO: Add authentication support for private repositories
248
+ // 'Authorization': `token ${process.env.GITHUB_TOKEN}`,
249
+ },
250
+ });
251
+ if (!response.ok) {
252
+ if (response.status === 404) {
253
+ // Check if it's the repository or the path that's not found
254
+ const repoCheckUrl = `https://api.github.com/repos/${gitInfo.owner}/${gitInfo.repo}`;
255
+ const repoResponse = await fetch(repoCheckUrl, {
256
+ headers: {
257
+ 'Accept': 'application/vnd.github.v3+json',
258
+ 'User-Agent': 'TypeKro/1.0',
259
+ },
260
+ });
261
+ if (!repoResponse.ok) {
262
+ throw GitContentError.repositoryNotFound(resourceName, `git:${gitInfo.host}/${gitInfo.owner}/${gitInfo.repo}`);
263
+ }
264
+ else {
265
+ throw GitContentError.pathNotFound(resourceName, `git:${gitInfo.host}/${gitInfo.owner}/${gitInfo.repo}`, gitInfo.path);
266
+ }
267
+ }
268
+ if (response.status === 401 || response.status === 403) {
269
+ throw GitContentError.authenticationFailed(resourceName, `git:${gitInfo.host}/${gitInfo.owner}/${gitInfo.repo}/${gitInfo.path}@${gitInfo.ref}`);
270
+ }
271
+ throw new GitContentError(`Failed to fetch Git content for resource '${resourceName}': HTTP ${response.status} ${response.statusText}`, resourceName, `git:${gitInfo.host}/${gitInfo.owner}/${gitInfo.repo}/${gitInfo.path}@${gitInfo.ref}`, [
272
+ 'Check that the repository and path exist',
273
+ 'Verify the branch or tag reference is correct',
274
+ 'For private repositories, ensure authentication is configured',
275
+ 'Check GitHub API rate limits',
276
+ ]);
277
+ }
278
+ const data = await response.json();
279
+ // GitHub API returns base64-encoded content for files
280
+ if (data.type === 'file' && data.content) {
281
+ return Buffer.from(data.content, 'base64').toString('utf-8');
282
+ }
283
+ throw new GitContentError(`Unexpected content type from Git repository for resource '${resourceName}': expected file, got ${data.type}`, resourceName, `git:${gitInfo.host}/${gitInfo.owner}/${gitInfo.repo}/${gitInfo.path}@${gitInfo.ref}`, [
284
+ 'Ensure the path points to a file, not a directory',
285
+ 'Use yamlDirectory() factory for directory processing',
286
+ 'Check that the path is correct in the repository',
287
+ ]);
288
+ }
289
+ catch (error) {
290
+ if (error instanceof GitContentError) {
291
+ throw error;
292
+ }
293
+ // Handle network and other errors
294
+ throw new GitContentError(`Network error fetching Git content for resource '${resourceName}': ${error}`, resourceName, `git:${gitInfo.host}/${gitInfo.owner}/${gitInfo.repo}/${gitInfo.path}@${gitInfo.ref}`, [
295
+ 'Check your internet connection',
296
+ 'Verify the repository URL is correct',
297
+ 'Check if GitHub is accessible',
298
+ 'Consider using local files if network access is limited',
299
+ ]);
300
+ }
301
+ }
302
+ /**
303
+ * Discover YAML files in a directory (local or Git)
304
+ */
305
+ async discoverYamlFiles(dirPath, options = {}, resourceName = 'unknown') {
306
+ const { recursive = true, include = ['**/*.yaml', '**/*.yml'], exclude = [], } = options;
307
+ if (dirPath.startsWith('git:')) {
308
+ return this.discoverGitYamlFiles(dirPath, { recursive, include, exclude }, resourceName);
309
+ }
310
+ else {
311
+ return this.discoverLocalYamlFiles(dirPath, { recursive, include, exclude }, resourceName);
312
+ }
313
+ }
314
+ /**
315
+ * Discover YAML files in a local directory
316
+ */
317
+ async discoverLocalYamlFiles(dirPath, options, resourceName) {
318
+ try {
319
+ // Resolve relative paths
320
+ const resolvedPath = path.isAbsolute(dirPath)
321
+ ? dirPath
322
+ : path.resolve(process.cwd(), dirPath);
323
+ // Check if directory exists
324
+ if (!fs.existsSync(resolvedPath)) {
325
+ throw YamlPathResolutionError.directoryNotFound(resourceName, dirPath);
326
+ }
327
+ // Check if it's a directory
328
+ const stats = fs.statSync(resolvedPath);
329
+ if (!stats.isDirectory()) {
330
+ throw new YamlPathResolutionError(`Path is not a directory for resource '${resourceName}': ${dirPath}`, resourceName, dirPath, [
331
+ 'Ensure the path points to a directory, not a file',
332
+ 'Use yamlFile() factory for single file processing',
333
+ 'Check that the path is correct',
334
+ ]);
335
+ }
336
+ const files = [];
337
+ await this.walkDirectory(resolvedPath, resolvedPath, files, options, resourceName);
338
+ return files;
339
+ }
340
+ catch (error) {
341
+ if (error instanceof YamlPathResolutionError) {
342
+ throw error;
343
+ }
344
+ throw new YamlPathResolutionError(`Failed to discover files in directory for resource '${resourceName}': ${dirPath}. ${error}`, resourceName, dirPath, [
345
+ 'Check that the directory exists and is readable',
346
+ 'Verify directory permissions',
347
+ 'Ensure the path is correct',
348
+ ]);
349
+ }
350
+ }
351
+ /**
352
+ * Recursively walk a directory and collect YAML files
353
+ */
354
+ async walkDirectory(currentPath, basePath, files, options, resourceName) {
355
+ const entries = fs.readdirSync(currentPath, { withFileTypes: true });
356
+ for (const entry of entries) {
357
+ const fullPath = path.join(currentPath, entry.name);
358
+ const relativePath = path.relative(basePath, fullPath);
359
+ if (entry.isDirectory()) {
360
+ if (options.recursive) {
361
+ await this.walkDirectory(fullPath, basePath, files, options, resourceName);
362
+ }
363
+ }
364
+ else if (entry.isFile()) {
365
+ // Check if file matches include/exclude patterns
366
+ if (this.matchesPatterns(relativePath, options.include) &&
367
+ !this.matchesPatterns(relativePath, options.exclude)) {
368
+ try {
369
+ const content = fs.readFileSync(fullPath, 'utf-8');
370
+ files.push({
371
+ path: fullPath,
372
+ relativePath,
373
+ content,
374
+ });
375
+ }
376
+ catch (error) {
377
+ // Log warning but continue processing other files
378
+ console.warn(`Warning: Could not read file ${fullPath}: ${error}`);
379
+ }
380
+ }
381
+ }
382
+ }
383
+ }
384
+ /**
385
+ * Discover YAML files in a Git repository directory
386
+ */
387
+ async discoverGitYamlFiles(gitPath, options, resourceName) {
388
+ const parsed = this.parseGitPath(gitPath, resourceName);
389
+ // For now, we'll implement a simple approach using GitHub API
390
+ // This could be enhanced to support more complex directory traversal
391
+ if (parsed.host !== 'github.com') {
392
+ throw new GitContentError(`Unsupported Git host for directory discovery in resource '${resourceName}': ${parsed.host}. Currently only github.com is supported.`, resourceName, gitPath, [
393
+ 'Use github.com for Git repositories',
394
+ 'Consider using local files or cloning the repository locally',
395
+ 'Future versions may support additional Git hosts',
396
+ ]);
397
+ }
398
+ try {
399
+ // Use GitHub API to list directory contents
400
+ const apiUrl = `https://api.github.com/repos/${parsed.owner}/${parsed.repo}/contents/${parsed.path}?ref=${parsed.ref}`;
401
+ const response = await fetch(apiUrl, {
402
+ headers: {
403
+ 'Accept': 'application/vnd.github.v3+json',
404
+ 'User-Agent': 'TypeKro/1.0',
405
+ },
406
+ });
407
+ if (!response.ok) {
408
+ if (response.status === 404) {
409
+ throw GitContentError.pathNotFound(resourceName, gitPath, parsed.path);
410
+ }
411
+ throw new GitContentError(`Failed to list Git directory for resource '${resourceName}': HTTP ${response.status}`, resourceName, gitPath, [
412
+ 'Check that the repository and directory path exist',
413
+ 'Verify the branch or tag reference is correct',
414
+ 'For private repositories, ensure authentication is configured',
415
+ ]);
416
+ }
417
+ const data = await response.json();
418
+ if (!Array.isArray(data)) {
419
+ throw new GitContentError(`Expected directory listing from Git repository for resource '${resourceName}', but got a file`, resourceName, gitPath, [
420
+ 'Ensure the path points to a directory, not a file',
421
+ 'Use yamlFile() factory for single file processing',
422
+ 'Check that the path is correct in the repository',
423
+ ]);
424
+ }
425
+ const files = [];
426
+ // Process files in the directory
427
+ for (const item of data) {
428
+ if (item.type === 'file') {
429
+ const relativePath = item.name;
430
+ // Check if file matches include/exclude patterns
431
+ if (this.matchesPatterns(relativePath, options.include) &&
432
+ !this.matchesPatterns(relativePath, options.exclude)) {
433
+ try {
434
+ // Fetch file content
435
+ const fileContent = await this.resolveGitContent(`git:${parsed.host}/${parsed.owner}/${parsed.repo}/${item.path}@${parsed.ref}`, resourceName);
436
+ files.push({
437
+ path: item.path,
438
+ relativePath,
439
+ content: fileContent,
440
+ });
441
+ }
442
+ catch (error) {
443
+ // Log warning but continue processing other files
444
+ console.warn(`Warning: Could not fetch file ${item.path}: ${error}`);
445
+ }
446
+ }
447
+ }
448
+ else if (item.type === 'dir' && options.recursive) {
449
+ // Recursively process subdirectories
450
+ const subDirFiles = await this.discoverGitYamlFiles(`git:${parsed.host}/${parsed.owner}/${parsed.repo}/${item.path}@${parsed.ref}`, options, resourceName);
451
+ // Adjust relative paths for subdirectory files
452
+ const adjustedFiles = subDirFiles.map(file => ({
453
+ ...file,
454
+ relativePath: path.join(item.name, file.relativePath),
455
+ }));
456
+ files.push(...adjustedFiles);
457
+ }
458
+ }
459
+ return files;
460
+ }
461
+ catch (error) {
462
+ if (error instanceof GitContentError) {
463
+ throw error;
464
+ }
465
+ throw new GitContentError(`Network error discovering Git directory for resource '${resourceName}': ${error}`, resourceName, gitPath, [
466
+ 'Check your internet connection',
467
+ 'Verify the repository URL is correct',
468
+ 'Check if GitHub is accessible',
469
+ 'Consider using local files if network access is limited',
470
+ ]);
471
+ }
472
+ }
473
+ /**
474
+ * Check if a file path matches any of the given glob patterns
475
+ * Simple implementation - could be enhanced with a proper glob library
476
+ */
477
+ matchesPatterns(filePath, patterns) {
478
+ if (patterns.length === 0) {
479
+ return false;
480
+ }
481
+ return patterns.some(pattern => {
482
+ // Convert simple glob patterns to regex
483
+ // This is a basic implementation - could use a proper glob library like minimatch
484
+ try {
485
+ // Simple cases first
486
+ if (pattern === '*') {
487
+ return true;
488
+ }
489
+ if (!pattern.includes('*') && !pattern.includes('?')) {
490
+ // Exact match
491
+ return filePath === pattern;
492
+ }
493
+ // Handle ** first (before escaping)
494
+ let regexPattern = pattern.replace(/\*\*/g, '__DOUBLESTAR__');
495
+ // Escape special regex characters except * and ?
496
+ regexPattern = regexPattern.replace(/[.+^${}()|[\]\\]/g, '\\$&');
497
+ // Convert glob patterns to regex
498
+ regexPattern = regexPattern
499
+ .replace(/__DOUBLESTAR__/g, '.*') // ** matches any number of directories (including /)
500
+ .replace(/\\\*/g, '[^/]*') // * matches any characters except /
501
+ .replace(/\\\?/g, '.'); // ? matches any single character
502
+ const regex = new RegExp(`^${regexPattern}$`);
503
+ return regex.test(filePath);
504
+ }
505
+ catch (_error) {
506
+ // If regex fails, fall back to simple extension matching
507
+ if (pattern.startsWith('*.')) {
508
+ const extension = pattern.substring(2);
509
+ return filePath.endsWith(`.${extension}`);
510
+ }
511
+ return false;
512
+ }
513
+ });
514
+ }
515
+ /**
516
+ * Resolve content from an HTTP/HTTPS URL
517
+ */
518
+ async resolveHttpContent(url, resourceName = 'unknown') {
519
+ try {
520
+ const response = await fetch(url);
521
+ if (!response.ok) {
522
+ throw new YamlPathResolutionError(`Failed to fetch HTTP resource for resource '${resourceName}': HTTP ${response.status} ${response.statusText}`, resourceName, url, [
523
+ 'Check that the URL is correct and accessible',
524
+ 'Verify the resource exists at the specified URL',
525
+ 'Check network connectivity and firewall settings',
526
+ 'For private resources, ensure proper authentication is configured',
527
+ ]);
528
+ }
529
+ const content = await response.text();
530
+ if (!content || content.trim().length === 0) {
531
+ throw new YamlPathResolutionError(`Empty content received from HTTP resource for resource '${resourceName}': ${url}`, resourceName, url, [
532
+ 'Check that the URL points to a valid YAML file',
533
+ 'Verify the resource is not empty',
534
+ 'Try accessing the URL directly in a browser',
535
+ ]);
536
+ }
537
+ return content;
538
+ }
539
+ catch (error) {
540
+ if (error instanceof YamlPathResolutionError) {
541
+ throw error;
542
+ }
543
+ throw new YamlPathResolutionError(`Failed to resolve HTTP content for resource '${resourceName}': ${error instanceof Error ? error.message : String(error)}`, resourceName, url, [
544
+ 'Check network connectivity',
545
+ 'Verify the URL is correct and accessible',
546
+ 'Check for any firewall or proxy issues',
547
+ 'Try accessing the URL directly to verify it works',
548
+ ]);
549
+ }
550
+ }
551
+ }
552
+ /**
553
+ * Default path resolver instance
554
+ */
555
+ export const pathResolver = new PathResolver();
556
+ //# sourceMappingURL=path-resolver.js.map