kustodian 1.0.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 (351) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +346 -0
  3. package/dist/cli/bin.d.ts +3 -0
  4. package/dist/cli/bin.d.ts.map +1 -0
  5. package/dist/cli/bin.js +67 -0
  6. package/dist/cli/bin.js.map +1 -0
  7. package/dist/cli/command.d.ts +57 -0
  8. package/dist/cli/command.d.ts.map +1 -0
  9. package/dist/cli/command.js +26 -0
  10. package/dist/cli/command.js.map +1 -0
  11. package/dist/cli/commands/apply.d.ts +8 -0
  12. package/dist/cli/commands/apply.d.ts.map +1 -0
  13. package/dist/cli/commands/apply.js +802 -0
  14. package/dist/cli/commands/apply.js.map +1 -0
  15. package/dist/cli/commands/init.d.ts +5 -0
  16. package/dist/cli/commands/init.d.ts.map +1 -0
  17. package/dist/cli/commands/init.js +403 -0
  18. package/dist/cli/commands/init.js.map +1 -0
  19. package/dist/cli/commands/sources.d.ts +5 -0
  20. package/dist/cli/commands/sources.d.ts.map +1 -0
  21. package/dist/cli/commands/sources.js +377 -0
  22. package/dist/cli/commands/sources.js.map +1 -0
  23. package/dist/cli/commands/update.d.ts +5 -0
  24. package/dist/cli/commands/update.d.ts.map +1 -0
  25. package/dist/cli/commands/update.js +314 -0
  26. package/dist/cli/commands/update.js.map +1 -0
  27. package/dist/cli/commands/validate.d.ts +5 -0
  28. package/dist/cli/commands/validate.d.ts.map +1 -0
  29. package/dist/cli/commands/validate.js +126 -0
  30. package/dist/cli/commands/validate.js.map +1 -0
  31. package/dist/cli/container.d.ts +48 -0
  32. package/dist/cli/container.d.ts.map +1 -0
  33. package/dist/cli/container.js +49 -0
  34. package/dist/cli/container.js.map +1 -0
  35. package/dist/cli/index.d.ts +8 -0
  36. package/dist/cli/index.d.ts.map +1 -0
  37. package/dist/cli/index.js +9 -0
  38. package/dist/cli/index.js.map +1 -0
  39. package/dist/cli/middleware.d.ts +118 -0
  40. package/dist/cli/middleware.d.ts.map +1 -0
  41. package/dist/cli/middleware.js +280 -0
  42. package/dist/cli/middleware.js.map +1 -0
  43. package/dist/cli/runner.d.ts +34 -0
  44. package/dist/cli/runner.d.ts.map +1 -0
  45. package/dist/cli/runner.js +156 -0
  46. package/dist/cli/runner.js.map +1 -0
  47. package/dist/cli/utils/defaults.d.ts +23 -0
  48. package/dist/cli/utils/defaults.d.ts.map +1 -0
  49. package/dist/cli/utils/defaults.js +43 -0
  50. package/dist/cli/utils/defaults.js.map +1 -0
  51. package/dist/core/error.d.ts +117 -0
  52. package/dist/core/error.d.ts.map +1 -0
  53. package/dist/core/error.js +210 -0
  54. package/dist/core/error.js.map +1 -0
  55. package/dist/core/index.d.ts +6 -0
  56. package/dist/core/index.d.ts.map +1 -0
  57. package/dist/core/index.js +6 -0
  58. package/dist/core/index.js.map +1 -0
  59. package/dist/core/logger.d.ts +31 -0
  60. package/dist/core/logger.d.ts.map +1 -0
  61. package/dist/core/logger.js +78 -0
  62. package/dist/core/logger.js.map +1 -0
  63. package/dist/core/path.d.ts +57 -0
  64. package/dist/core/path.d.ts.map +1 -0
  65. package/dist/core/path.js +154 -0
  66. package/dist/core/path.js.map +1 -0
  67. package/dist/core/result.d.ts +80 -0
  68. package/dist/core/result.d.ts.map +1 -0
  69. package/dist/core/result.js +150 -0
  70. package/dist/core/result.js.map +1 -0
  71. package/dist/core/types.d.ts +80 -0
  72. package/dist/core/types.d.ts.map +1 -0
  73. package/dist/core/types.js +5 -0
  74. package/dist/core/types.js.map +1 -0
  75. package/dist/generator/external-substitutions.d.ts +21 -0
  76. package/dist/generator/external-substitutions.d.ts.map +1 -0
  77. package/dist/generator/external-substitutions.js +49 -0
  78. package/dist/generator/external-substitutions.js.map +1 -0
  79. package/dist/generator/flux.d.ts +61 -0
  80. package/dist/generator/flux.d.ts.map +1 -0
  81. package/dist/generator/flux.js +294 -0
  82. package/dist/generator/flux.js.map +1 -0
  83. package/dist/generator/generator.d.ts +77 -0
  84. package/dist/generator/generator.d.ts.map +1 -0
  85. package/dist/generator/generator.js +183 -0
  86. package/dist/generator/generator.js.map +1 -0
  87. package/dist/generator/index.d.ts +9 -0
  88. package/dist/generator/index.d.ts.map +1 -0
  89. package/dist/generator/index.js +9 -0
  90. package/dist/generator/index.js.map +1 -0
  91. package/dist/generator/kustomization-resolution.d.ts +40 -0
  92. package/dist/generator/kustomization-resolution.d.ts.map +1 -0
  93. package/dist/generator/kustomization-resolution.js +59 -0
  94. package/dist/generator/kustomization-resolution.js.map +1 -0
  95. package/dist/generator/namespace.d.ts +74 -0
  96. package/dist/generator/namespace.d.ts.map +1 -0
  97. package/dist/generator/namespace.js +109 -0
  98. package/dist/generator/namespace.js.map +1 -0
  99. package/dist/generator/output.d.ts +56 -0
  100. package/dist/generator/output.d.ts.map +1 -0
  101. package/dist/generator/output.js +171 -0
  102. package/dist/generator/output.js.map +1 -0
  103. package/dist/generator/preservation.d.ts +45 -0
  104. package/dist/generator/preservation.d.ts.map +1 -0
  105. package/dist/generator/preservation.js +71 -0
  106. package/dist/generator/preservation.js.map +1 -0
  107. package/dist/generator/substitution.d.ts +79 -0
  108. package/dist/generator/substitution.d.ts.map +1 -0
  109. package/dist/generator/substitution.js +210 -0
  110. package/dist/generator/substitution.js.map +1 -0
  111. package/dist/generator/types.d.ts +162 -0
  112. package/dist/generator/types.d.ts.map +1 -0
  113. package/dist/generator/types.js +2 -0
  114. package/dist/generator/types.js.map +1 -0
  115. package/dist/generator/validation/cycle-detection.d.ts +25 -0
  116. package/dist/generator/validation/cycle-detection.d.ts.map +1 -0
  117. package/dist/generator/validation/cycle-detection.js +101 -0
  118. package/dist/generator/validation/cycle-detection.js.map +1 -0
  119. package/dist/generator/validation/enablement.d.ts +24 -0
  120. package/dist/generator/validation/enablement.d.ts.map +1 -0
  121. package/dist/generator/validation/enablement.js +69 -0
  122. package/dist/generator/validation/enablement.js.map +1 -0
  123. package/dist/generator/validation/graph.d.ts +29 -0
  124. package/dist/generator/validation/graph.d.ts.map +1 -0
  125. package/dist/generator/validation/graph.js +106 -0
  126. package/dist/generator/validation/graph.js.map +1 -0
  127. package/dist/generator/validation/index.d.ts +38 -0
  128. package/dist/generator/validation/index.d.ts.map +1 -0
  129. package/dist/generator/validation/index.js +64 -0
  130. package/dist/generator/validation/index.js.map +1 -0
  131. package/dist/generator/validation/reference.d.ts +45 -0
  132. package/dist/generator/validation/reference.d.ts.map +1 -0
  133. package/dist/generator/validation/reference.js +143 -0
  134. package/dist/generator/validation/reference.js.map +1 -0
  135. package/dist/generator/validation/requirements.d.ts +25 -0
  136. package/dist/generator/validation/requirements.d.ts.map +1 -0
  137. package/dist/generator/validation/requirements.js +64 -0
  138. package/dist/generator/validation/requirements.js.map +1 -0
  139. package/dist/generator/validation/types.d.ts +116 -0
  140. package/dist/generator/validation/types.d.ts.map +1 -0
  141. package/dist/generator/validation/types.js +13 -0
  142. package/dist/generator/validation/types.js.map +1 -0
  143. package/dist/k8s/exec.d.ts +20 -0
  144. package/dist/k8s/exec.d.ts.map +1 -0
  145. package/dist/k8s/exec.js +47 -0
  146. package/dist/k8s/exec.js.map +1 -0
  147. package/dist/k8s/flux.d.ts +57 -0
  148. package/dist/k8s/flux.d.ts.map +1 -0
  149. package/dist/k8s/flux.js +202 -0
  150. package/dist/k8s/flux.js.map +1 -0
  151. package/dist/k8s/index.d.ts +6 -0
  152. package/dist/k8s/index.d.ts.map +1 -0
  153. package/dist/k8s/index.js +6 -0
  154. package/dist/k8s/index.js.map +1 -0
  155. package/dist/k8s/kubeconfig.d.ts +45 -0
  156. package/dist/k8s/kubeconfig.d.ts.map +1 -0
  157. package/dist/k8s/kubeconfig.js +152 -0
  158. package/dist/k8s/kubeconfig.js.map +1 -0
  159. package/dist/k8s/kubectl.d.ts +68 -0
  160. package/dist/k8s/kubectl.d.ts.map +1 -0
  161. package/dist/k8s/kubectl.js +187 -0
  162. package/dist/k8s/kubectl.js.map +1 -0
  163. package/dist/k8s/types.d.ts +65 -0
  164. package/dist/k8s/types.d.ts.map +1 -0
  165. package/dist/k8s/types.js +2 -0
  166. package/dist/k8s/types.js.map +1 -0
  167. package/dist/loader/file.d.ts +39 -0
  168. package/dist/loader/file.d.ts.map +1 -0
  169. package/dist/loader/file.js +121 -0
  170. package/dist/loader/file.js.map +1 -0
  171. package/dist/loader/index.d.ts +5 -0
  172. package/dist/loader/index.d.ts.map +1 -0
  173. package/dist/loader/index.js +5 -0
  174. package/dist/loader/index.js.map +1 -0
  175. package/dist/loader/profile.d.ts +23 -0
  176. package/dist/loader/profile.d.ts.map +1 -0
  177. package/dist/loader/profile.js +84 -0
  178. package/dist/loader/profile.js.map +1 -0
  179. package/dist/loader/project.d.ts +76 -0
  180. package/dist/loader/project.d.ts.map +1 -0
  181. package/dist/loader/project.js +279 -0
  182. package/dist/loader/project.js.map +1 -0
  183. package/dist/loader/yaml.d.ts +15 -0
  184. package/dist/loader/yaml.d.ts.map +1 -0
  185. package/dist/loader/yaml.js +44 -0
  186. package/dist/loader/yaml.js.map +1 -0
  187. package/dist/nodes/index.d.ts +5 -0
  188. package/dist/nodes/index.d.ts.map +1 -0
  189. package/dist/nodes/index.js +5 -0
  190. package/dist/nodes/index.js.map +1 -0
  191. package/dist/nodes/kubectl-labeler.d.ts +7 -0
  192. package/dist/nodes/kubectl-labeler.d.ts.map +1 -0
  193. package/dist/nodes/kubectl-labeler.js +89 -0
  194. package/dist/nodes/kubectl-labeler.js.map +1 -0
  195. package/dist/nodes/labeler.d.ts +74 -0
  196. package/dist/nodes/labeler.d.ts.map +1 -0
  197. package/dist/nodes/labeler.js +118 -0
  198. package/dist/nodes/labeler.js.map +1 -0
  199. package/dist/nodes/profile.d.ts +58 -0
  200. package/dist/nodes/profile.d.ts.map +1 -0
  201. package/dist/nodes/profile.js +128 -0
  202. package/dist/nodes/profile.js.map +1 -0
  203. package/dist/nodes/types.d.ts +84 -0
  204. package/dist/nodes/types.d.ts.map +1 -0
  205. package/dist/nodes/types.js +77 -0
  206. package/dist/nodes/types.js.map +1 -0
  207. package/dist/plugins/generators.d.ts +49 -0
  208. package/dist/plugins/generators.d.ts.map +1 -0
  209. package/dist/plugins/generators.js +7 -0
  210. package/dist/plugins/generators.js.map +1 -0
  211. package/dist/plugins/hooks.d.ts +120 -0
  212. package/dist/plugins/hooks.d.ts.map +1 -0
  213. package/dist/plugins/hooks.js +41 -0
  214. package/dist/plugins/hooks.js.map +1 -0
  215. package/dist/plugins/index.d.ts +8 -0
  216. package/dist/plugins/index.d.ts.map +1 -0
  217. package/dist/plugins/index.js +15 -0
  218. package/dist/plugins/index.js.map +1 -0
  219. package/dist/plugins/loader.d.ts +40 -0
  220. package/dist/plugins/loader.d.ts.map +1 -0
  221. package/dist/plugins/loader.js +236 -0
  222. package/dist/plugins/loader.js.map +1 -0
  223. package/dist/plugins/object-types.d.ts +71 -0
  224. package/dist/plugins/object-types.d.ts.map +1 -0
  225. package/dist/plugins/object-types.js +65 -0
  226. package/dist/plugins/object-types.js.map +1 -0
  227. package/dist/plugins/registry.d.ts +87 -0
  228. package/dist/plugins/registry.d.ts.map +1 -0
  229. package/dist/plugins/registry.js +158 -0
  230. package/dist/plugins/registry.js.map +1 -0
  231. package/dist/plugins/substitution-providers.d.ts +48 -0
  232. package/dist/plugins/substitution-providers.d.ts.map +1 -0
  233. package/dist/plugins/substitution-providers.js +2 -0
  234. package/dist/plugins/substitution-providers.js.map +1 -0
  235. package/dist/plugins/types.d.ts +288 -0
  236. package/dist/plugins/types.d.ts.map +1 -0
  237. package/dist/plugins/types.js +25 -0
  238. package/dist/plugins/types.js.map +1 -0
  239. package/dist/registry/auth.d.ts +14 -0
  240. package/dist/registry/auth.d.ts.map +1 -0
  241. package/dist/registry/auth.js +40 -0
  242. package/dist/registry/auth.js.map +1 -0
  243. package/dist/registry/client.d.ts +24 -0
  244. package/dist/registry/client.d.ts.map +1 -0
  245. package/dist/registry/client.js +85 -0
  246. package/dist/registry/client.js.map +1 -0
  247. package/dist/registry/dockerhub.d.ts +6 -0
  248. package/dist/registry/dockerhub.d.ts.map +1 -0
  249. package/dist/registry/dockerhub.js +91 -0
  250. package/dist/registry/dockerhub.js.map +1 -0
  251. package/dist/registry/ghcr.d.ts +6 -0
  252. package/dist/registry/ghcr.d.ts.map +1 -0
  253. package/dist/registry/ghcr.js +95 -0
  254. package/dist/registry/ghcr.js.map +1 -0
  255. package/dist/registry/helm.d.ts +11 -0
  256. package/dist/registry/helm.d.ts.map +1 -0
  257. package/dist/registry/helm.js +124 -0
  258. package/dist/registry/helm.js.map +1 -0
  259. package/dist/registry/index.d.ts +8 -0
  260. package/dist/registry/index.d.ts.map +1 -0
  261. package/dist/registry/index.js +12 -0
  262. package/dist/registry/index.js.map +1 -0
  263. package/dist/registry/types.d.ts +55 -0
  264. package/dist/registry/types.d.ts.map +1 -0
  265. package/dist/registry/types.js +2 -0
  266. package/dist/registry/types.js.map +1 -0
  267. package/dist/registry/version.d.ts +22 -0
  268. package/dist/registry/version.d.ts.map +1 -0
  269. package/dist/registry/version.js +62 -0
  270. package/dist/registry/version.js.map +1 -0
  271. package/dist/schema/cluster.d.ts +2890 -0
  272. package/dist/schema/cluster.d.ts.map +1 -0
  273. package/dist/schema/cluster.js +231 -0
  274. package/dist/schema/cluster.js.map +1 -0
  275. package/dist/schema/common.d.ts +1059 -0
  276. package/dist/schema/common.d.ts.map +1 -0
  277. package/dist/schema/common.js +340 -0
  278. package/dist/schema/common.js.map +1 -0
  279. package/dist/schema/index.d.ts +8 -0
  280. package/dist/schema/index.d.ts.map +1 -0
  281. package/dist/schema/index.js +8 -0
  282. package/dist/schema/index.js.map +1 -0
  283. package/dist/schema/node-list.d.ts +361 -0
  284. package/dist/schema/node-list.d.ts.map +1 -0
  285. package/dist/schema/node-list.js +104 -0
  286. package/dist/schema/node-list.js.map +1 -0
  287. package/dist/schema/profile.d.ts +166 -0
  288. package/dist/schema/profile.d.ts.map +1 -0
  289. package/dist/schema/profile.js +61 -0
  290. package/dist/schema/profile.js.map +1 -0
  291. package/dist/schema/project.d.ts +168 -0
  292. package/dist/schema/project.d.ts.map +1 -0
  293. package/dist/schema/project.js +40 -0
  294. package/dist/schema/project.js.map +1 -0
  295. package/dist/schema/sources.d.ts +338 -0
  296. package/dist/schema/sources.d.ts.map +1 -0
  297. package/dist/schema/sources.js +111 -0
  298. package/dist/schema/sources.js.map +1 -0
  299. package/dist/schema/template.d.ts +2711 -0
  300. package/dist/schema/template.d.ts.map +1 -0
  301. package/dist/schema/template.js +97 -0
  302. package/dist/schema/template.js.map +1 -0
  303. package/dist/sources/cache/index.d.ts +9 -0
  304. package/dist/sources/cache/index.d.ts.map +1 -0
  305. package/dist/sources/cache/index.js +278 -0
  306. package/dist/sources/cache/index.js.map +1 -0
  307. package/dist/sources/cache/metadata.d.ts +36 -0
  308. package/dist/sources/cache/metadata.d.ts.map +1 -0
  309. package/dist/sources/cache/metadata.js +21 -0
  310. package/dist/sources/cache/metadata.js.map +1 -0
  311. package/dist/sources/cache/ttl.d.ts +20 -0
  312. package/dist/sources/cache/ttl.d.ts.map +1 -0
  313. package/dist/sources/cache/ttl.js +53 -0
  314. package/dist/sources/cache/ttl.js.map +1 -0
  315. package/dist/sources/fetchers/git.d.ts +6 -0
  316. package/dist/sources/fetchers/git.d.ts.map +1 -0
  317. package/dist/sources/fetchers/git.js +165 -0
  318. package/dist/sources/fetchers/git.js.map +1 -0
  319. package/dist/sources/fetchers/http.d.ts +6 -0
  320. package/dist/sources/fetchers/http.d.ts.map +1 -0
  321. package/dist/sources/fetchers/http.js +159 -0
  322. package/dist/sources/fetchers/http.js.map +1 -0
  323. package/dist/sources/fetchers/index.d.ts +11 -0
  324. package/dist/sources/fetchers/index.d.ts.map +1 -0
  325. package/dist/sources/fetchers/index.js +24 -0
  326. package/dist/sources/fetchers/index.js.map +1 -0
  327. package/dist/sources/fetchers/oci.d.ts +6 -0
  328. package/dist/sources/fetchers/oci.d.ts.map +1 -0
  329. package/dist/sources/fetchers/oci.js +156 -0
  330. package/dist/sources/fetchers/oci.js.map +1 -0
  331. package/dist/sources/fetchers/types.d.ts +25 -0
  332. package/dist/sources/fetchers/types.d.ts.map +1 -0
  333. package/dist/sources/fetchers/types.js +2 -0
  334. package/dist/sources/fetchers/types.js.map +1 -0
  335. package/dist/sources/index.d.ts +6 -0
  336. package/dist/sources/index.d.ts.map +1 -0
  337. package/dist/sources/index.js +10 -0
  338. package/dist/sources/index.js.map +1 -0
  339. package/dist/sources/loader.d.ts +34 -0
  340. package/dist/sources/loader.d.ts.map +1 -0
  341. package/dist/sources/loader.js +89 -0
  342. package/dist/sources/loader.js.map +1 -0
  343. package/dist/sources/resolver.d.ts +17 -0
  344. package/dist/sources/resolver.d.ts.map +1 -0
  345. package/dist/sources/resolver.js +125 -0
  346. package/dist/sources/resolver.js.map +1 -0
  347. package/dist/sources/types.d.ts +151 -0
  348. package/dist/sources/types.d.ts.map +1 -0
  349. package/dist/sources/types.js +2 -0
  350. package/dist/sources/types.js.map +1 -0
  351. package/package.json +101 -0
@@ -0,0 +1,116 @@
1
+ /**
2
+ * Node in the dependency graph.
3
+ */
4
+ export interface GraphNodeType {
5
+ /** Unique identifier: `${template}/${kustomization}` */
6
+ readonly id: string;
7
+ /** Template name */
8
+ readonly template: string;
9
+ /** Kustomization name */
10
+ readonly kustomization: string;
11
+ /** Resolved dependency IDs */
12
+ readonly dependencies: string[];
13
+ }
14
+ /**
15
+ * Parsed dependency reference for string-based dependencies.
16
+ */
17
+ export interface ParsedDependencyRefType {
18
+ /** Template name (undefined for within-template refs) */
19
+ readonly template?: string;
20
+ /** Kustomization name */
21
+ readonly kustomization: string;
22
+ /** Original reference string */
23
+ readonly raw: string;
24
+ }
25
+ /**
26
+ * Raw external dependency reference.
27
+ */
28
+ export interface RawDependencyRefType {
29
+ /** Flux Kustomization name */
30
+ readonly name: string;
31
+ /** Flux Kustomization namespace */
32
+ readonly namespace: string;
33
+ }
34
+ /**
35
+ * Union type for all parsed dependency references.
36
+ */
37
+ export type DependencyRefType = ParsedDependencyRefType | RawDependencyRefType;
38
+ /**
39
+ * Type guard to check if a dependency reference is a raw reference.
40
+ */
41
+ export declare function is_raw_dependency_ref(ref: DependencyRefType): ref is RawDependencyRefType;
42
+ /**
43
+ * Type guard to check if a dependency reference is a parsed string reference.
44
+ */
45
+ export declare function is_parsed_dependency_ref(ref: DependencyRefType): ref is ParsedDependencyRefType;
46
+ /**
47
+ * Cycle error - circular dependency detected.
48
+ */
49
+ export interface CycleErrorType {
50
+ readonly type: 'cycle';
51
+ /** Array of node IDs forming the cycle */
52
+ readonly cycle: string[];
53
+ readonly message: string;
54
+ }
55
+ /**
56
+ * Missing reference error - dependency target doesn't exist.
57
+ */
58
+ export interface MissingReferenceErrorType {
59
+ readonly type: 'missing_reference';
60
+ /** Node ID that has the reference */
61
+ readonly source: string;
62
+ /** Missing target reference */
63
+ readonly target: string;
64
+ readonly message: string;
65
+ }
66
+ /**
67
+ * Self-reference error - kustomization depends on itself.
68
+ */
69
+ export interface SelfReferenceErrorType {
70
+ readonly type: 'self_reference';
71
+ readonly node: string;
72
+ readonly message: string;
73
+ }
74
+ /**
75
+ * Invalid reference format error.
76
+ */
77
+ export interface InvalidReferenceErrorType {
78
+ readonly type: 'invalid_reference';
79
+ readonly source: string;
80
+ readonly reference: string;
81
+ readonly message: string;
82
+ }
83
+ /**
84
+ * Union of all graph validation error types.
85
+ */
86
+ export type GraphValidationErrorType = CycleErrorType | MissingReferenceErrorType | SelfReferenceErrorType | InvalidReferenceErrorType;
87
+ /**
88
+ * Result of graph validation.
89
+ */
90
+ export interface GraphValidationResultType {
91
+ /** Whether the graph is valid (no errors) */
92
+ readonly valid: boolean;
93
+ /** All validation errors found */
94
+ readonly errors: GraphValidationErrorType[];
95
+ /** Deployment order if valid (topologically sorted) */
96
+ readonly topological_order?: string[];
97
+ }
98
+ /**
99
+ * Result of building the dependency graph.
100
+ */
101
+ export interface BuildGraphResultType {
102
+ /** All nodes in the graph */
103
+ readonly nodes: Map<string, GraphNodeType>;
104
+ /** Errors encountered during graph building */
105
+ readonly errors: GraphValidationErrorType[];
106
+ }
107
+ /**
108
+ * Result of cycle detection.
109
+ */
110
+ export interface CycleDetectionResultType {
111
+ /** All cycles found */
112
+ readonly cycles: CycleErrorType[];
113
+ /** Topological order if no cycles found, null otherwise */
114
+ readonly topological_order: string[] | null;
115
+ }
116
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/generator/validation/types.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,WAAW,aAAa;IAC5B,wDAAwD;IACxD,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;IACpB,oBAAoB;IACpB,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,yBAAyB;IACzB,QAAQ,CAAC,aAAa,EAAE,MAAM,CAAC;IAC/B,8BAA8B;IAC9B,QAAQ,CAAC,YAAY,EAAE,MAAM,EAAE,CAAC;CACjC;AAED;;GAEG;AACH,MAAM,WAAW,uBAAuB;IACtC,yDAAyD;IACzD,QAAQ,CAAC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAC3B,yBAAyB;IACzB,QAAQ,CAAC,aAAa,EAAE,MAAM,CAAC;IAC/B,gCAAgC;IAChC,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;CACtB;AAED;;GAEG;AACH,MAAM,WAAW,oBAAoB;IACnC,8BAA8B;IAC9B,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,mCAAmC;IACnC,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;CAC5B;AAED;;GAEG;AACH,MAAM,MAAM,iBAAiB,GAAG,uBAAuB,GAAG,oBAAoB,CAAC;AAE/E;;GAEG;AACH,wBAAgB,qBAAqB,CAAC,GAAG,EAAE,iBAAiB,GAAG,GAAG,IAAI,oBAAoB,CAEzF;AAED;;GAEG;AACH,wBAAgB,wBAAwB,CAAC,GAAG,EAAE,iBAAi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;AACH,MAAM,WAAW,oBAAoB;IACnC,6BAA6B;IAC7B,QAAQ,CAAC,KAAK,EAAE,GAAG,CAAC,MAAM,EAAE,aAAa,CAAC,CAAC;IAC3C,+CAA+C;IAC/C,QAAQ,CAAC,MAAM,EAAE,wBAAwB,EAAE,CAAC;CAC7C;AAED;;GAEG;AACH,MAAM,WAAW,wBAAwB;IACvC,uBAAuB;IACvB,QAAQ,CAAC,MAAM,EAAE,cAAc,EAAE,CAAC;IAClC,2DAA2D;IAC3D,QAAQ,CAAC,iBAAiB,EAAE,MAAM,EAAE,GAAG,IAAI,CAAC;CAC7C"}
@@ -0,0 +1,13 @@
1
+ /**
2
+ * Type guard to check if a dependency reference is a raw reference.
3
+ */
4
+ export function is_raw_dependency_ref(ref) {
5
+ return 'name' in ref && 'namespace' in ref;
6
+ }
7
+ /**
8
+ * Type guard to check if a dependency reference is a parsed string reference.
9
+ */
10
+ export function is_parsed_dependency_ref(ref) {
11
+ return 'kustomization' in ref;
12
+ }
13
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/generator/validation/types.ts"],"names":[],"mappings":"AAyCA;;GAEG;AACH,MAAM,UAAU,qBAAqB,CAAC,GAAsB;IAC1D,OAAO,MAAM,IAAI,GAAG,IAAI,WAAW,IAAI,GAAG,CAAC;AAC7C,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,wBAAwB,CAAC,GAAsB;IAC7D,OAAO,eAAe,IAAI,GAAG,CAAC;AAChC,CAAC"}
@@ -0,0 +1,20 @@
1
+ import type { KustodianErrorType } from '../core/index.js';
2
+ import { type ResultType } from '../core/index.js';
3
+ import type { ExecResultType } from './types.js';
4
+ /**
5
+ * Options for command execution.
6
+ */
7
+ export interface ExecOptionsType {
8
+ timeout?: number;
9
+ cwd?: string;
10
+ env?: Record<string, string>;
11
+ }
12
+ /**
13
+ * Executes a command and returns the result.
14
+ */
15
+ export declare function exec_command(command: string, args: string[], options?: ExecOptionsType): Promise<ResultType<ExecResultType, KustodianErrorType>>;
16
+ /**
17
+ * Checks if a command is available in PATH.
18
+ */
19
+ export declare function check_command(command: string): Promise<boolean>;
20
+ //# sourceMappingURL=exec.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"exec.d.ts","sourceRoot":"","sources":["../../src/k8s/exec.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,kBAAkB,CAAC;AAC3D,OAAO,EAAE,KAAK,UAAU,EAAoB,MAAM,kBAAkB,CAAC;AAErE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAIjD;;GAEG;AACH,MAAM,WAAW,eAAe;IAC9B,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,GAAG,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CAC9B;AAED;;GAEG;AACH,wBAAsB,YAAY,CAChC,OAAO,EAAE,MAAM,EACf,IAAI,EAAE,MAAM,EAAE,EACd,OAAO,GAAE,eAAoB,GAC5B,OAAO,CAAC,UAAU,CAAC,cAAc,EAAE,kBAAkB,CAAC,CAAC,CAkCzD;AAED;;GAEG;AACH,wBAAsB,aAAa,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAGrE"}
@@ -0,0 +1,47 @@
1
+ import { exec } from 'node:child_process';
2
+ import { promisify } from 'node:util';
3
+ import { failure, success } from '../core/index.js';
4
+ const execAsync = promisify(exec);
5
+ /**
6
+ * Executes a command and returns the result.
7
+ */
8
+ export async function exec_command(command, args, options = {}) {
9
+ const full_command = [command, ...args].join(' ');
10
+ const timeout = options.timeout ?? 60000;
11
+ try {
12
+ const { stdout, stderr } = await execAsync(full_command, {
13
+ timeout,
14
+ cwd: options.cwd,
15
+ env: options.env ? { ...process.env, ...options.env } : undefined,
16
+ });
17
+ return success({
18
+ exit_code: 0,
19
+ stdout: stdout.trim(),
20
+ stderr: stderr.trim(),
21
+ });
22
+ }
23
+ catch (error) {
24
+ const err = error;
25
+ // Command executed but returned non-zero exit code
26
+ if (err.stdout !== undefined || err.stderr !== undefined) {
27
+ return success({
28
+ exit_code: err.code ?? 1,
29
+ stdout: (err.stdout ?? '').trim(),
30
+ stderr: (err.stderr ?? '').trim(),
31
+ });
32
+ }
33
+ // Command failed to execute
34
+ return failure({
35
+ code: 'EXEC_ERROR',
36
+ message: `Failed to execute ${command}: ${err.message}`,
37
+ });
38
+ }
39
+ }
40
+ /**
41
+ * Checks if a command is available in PATH.
42
+ */
43
+ export async function check_command(command) {
44
+ const result = await exec_command('which', [command]);
45
+ return result.success && result.value.exit_code === 0;
46
+ }
47
+ //# sourceMappingURL=exec.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"exec.js","sourceRoot":"","sources":["../../src/k8s/exec.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,oBAAoB,CAAC;AAC1C,OAAO,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AAEtC,OAAO,EAAmB,OAAO,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAIrE,MAAM,SAAS,GAAG,SAAS,CAAC,IAAI,CAAC,CAAC;AAWlC;;GAEG;AACH,MAAM,CAAC,KAAK,UAAU,YAAY,CAChC,OAAe,EACf,IAAc,EACd,UAA2B,EAAE;IAE7B,MAAM,YAAY,GAAG,CAAC,OAAO,EAAE,GAAG,IAAI,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;IAClD,MAAM,OAAO,GAAG,OAAO,CAAC,OAAO,IAAI,KAAK,CAAC;IAEzC,IAAI,CAAC;QACH,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,GAAG,MAAM,SAAS,CAAC,YAAY,EAAE;YACvD,OAAO;YACP,GAAG,EAAE,OAAO,CAAC,GAAG;YAChB,GAAG,EAAE,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,GAAG,OAAO,CAAC,GAAG,EAAE,GAAG,OAAO,CAAC,GAAG,EAAE,CAAC,CAAC,CAAC,SAAS;SAClE,CAAC,CAAC;QAEH,OAAO,OAAO,CAAC;YACb,SAAS,EAAE,CAAC;YACZ,MAAM,EAAE,MAAM,CAAC,IAAI,EAAE;YACrB,MAAM,EAAE,MAAM,CAAC,IAAI,EAAE;SACtB,CAAC,CAAC;IACL,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,MAAM,GAAG,GAAG,KAA8E,CAAC;QAE3F,mDAAmD;QACnD,IAAI,GAAG,CAAC,MAAM,KAAK,SAAS,IAAI,GAAG,CAAC,MAAM,KAAK,SAAS,EAAE,CAAC;YACzD,OAAO,OAAO,CAAC;gBACb,SAAS,EAAE,GAAG,CAAC,IAAI,IAAI,CAAC;gBACxB,MAAM,EAAE,CAAC,GAAG,CAAC,MAAM,IAAI,EAAE,CAAC,CAAC,IAAI,EAAE;gBACjC,MAAM,EAAE,CAAC,GAAG,CAAC,MAAM,IAAI,EAAE,CAAC,CAAC,IAAI,EAAE;aAClC,CAAC,CAAC;QACL,CAAC;QAED,4BAA4B;QAC5B,OAAO,OAAO,CAAC;YACb,IAAI,EAAE,YAAY;YAClB,OAAO,EAAE,qBAAqB,OAAO,KAAK,GAAG,CAAC,OAAO,EAAE;SACxD,CAAC,CAAC;IACL,CAAC;AACH,CAAC;AAED;;GAEG;AACH,MAAM,CAAC,KAAK,UAAU,aAAa,CAAC,OAAe;IACjD,MAAM,MAAM,GAAG,MAAM,YAAY,CAAC,OAAO,EAAE,CAAC,OAAO,CAAC,CAAC,CAAC;IACtD,OAAO,MAAM,CAAC,OAAO,IAAI,MAAM,CAAC,KAAK,CAAC,SAAS,KAAK,CAAC,CAAC;AACxD,CAAC"}
@@ -0,0 +1,57 @@
1
+ import type { KustodianErrorType } from '../core/index.js';
2
+ import { type ResultType } from '../core/index.js';
3
+ import type { FluxBootstrapOptionsType, FluxResourceType, FluxStatusType } from './types.js';
4
+ /**
5
+ * Options for creating a FluxClient.
6
+ */
7
+ export interface FluxClientOptionsType {
8
+ kubeconfig?: string;
9
+ context?: string;
10
+ timeout?: number;
11
+ }
12
+ /**
13
+ * Flux client interface.
14
+ */
15
+ export interface FluxClientType {
16
+ /**
17
+ * Bootstraps Flux on the cluster.
18
+ */
19
+ bootstrap(options: FluxBootstrapOptionsType): Promise<ResultType<void, KustodianErrorType>>;
20
+ /**
21
+ * Checks Flux installation status.
22
+ */
23
+ check(): Promise<ResultType<FluxStatusType, KustodianErrorType>>;
24
+ /**
25
+ * Triggers reconciliation of a Flux resource.
26
+ */
27
+ reconcile(resource: FluxResourceType): Promise<ResultType<void, KustodianErrorType>>;
28
+ /**
29
+ * Gets a Flux resource.
30
+ */
31
+ get(resource: FluxResourceType): Promise<ResultType<unknown, KustodianErrorType>>;
32
+ /**
33
+ * Suspends a Flux resource.
34
+ */
35
+ suspend(resource: FluxResourceType): Promise<ResultType<void, KustodianErrorType>>;
36
+ /**
37
+ * Resumes a Flux resource.
38
+ */
39
+ resume(resource: FluxResourceType): Promise<ResultType<void, KustodianErrorType>>;
40
+ /**
41
+ * Uninstalls Flux from the cluster.
42
+ */
43
+ uninstall(): Promise<ResultType<void, KustodianErrorType>>;
44
+ /**
45
+ * Installs Flux on the cluster.
46
+ */
47
+ install(): Promise<ResultType<void, KustodianErrorType>>;
48
+ /**
49
+ * Checks if flux CLI is available.
50
+ */
51
+ check_cli(): Promise<ResultType<boolean, KustodianErrorType>>;
52
+ }
53
+ /**
54
+ * Creates a Flux client.
55
+ */
56
+ export declare function create_flux_client(options?: FluxClientOptionsType): FluxClientType;
57
+ //# sourceMappingURL=flux.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"flux.d.ts","sourceRoot":"","sources":["../../src/k8s/flux.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,kBAAkB,CAAC;AAC3D,OAAO,EAAE,KAAK,U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,UAAU,CAAC,OAAO,EAAE,kBAAkB,CAAC,CAAC,CAAC;CAC/D;AAED;;GAEG;AACH,wBAAgB,kBAAkB,CAAC,OAAO,GAAE,qBAA0B,GAAG,cAAc,CAgPtF"}
@@ -0,0 +1,202 @@
1
+ import { failure, success } from '../core/index.js';
2
+ import { check_command, exec_command } from './exec.js';
3
+ /**
4
+ * Creates a Flux client.
5
+ */
6
+ export function create_flux_client(options = {}) {
7
+ const base_args = [];
8
+ if (options.kubeconfig) {
9
+ base_args.push(`--kubeconfig=${options.kubeconfig}`);
10
+ }
11
+ if (options.context) {
12
+ base_args.push(`--context=${options.context}`);
13
+ }
14
+ const exec_options = {
15
+ timeout: options.timeout ?? 300000, // 5 min default for Flux operations
16
+ };
17
+ function get_resource_type(kind) {
18
+ const mapping = {
19
+ Kustomization: 'kustomization',
20
+ GitRepository: 'source git',
21
+ OCIRepository: 'source oci',
22
+ HelmRelease: 'helmrelease',
23
+ HelmRepository: 'source helm',
24
+ };
25
+ return mapping[kind];
26
+ }
27
+ return {
28
+ async bootstrap(bootstrap_options) {
29
+ const args = [
30
+ ...base_args,
31
+ 'bootstrap',
32
+ bootstrap_options.provider,
33
+ `--owner=${bootstrap_options.owner}`,
34
+ `--repository=${bootstrap_options.repository}`,
35
+ `--path=${bootstrap_options.path}`,
36
+ ];
37
+ if (bootstrap_options.branch) {
38
+ args.push(`--branch=${bootstrap_options.branch}`);
39
+ }
40
+ if (bootstrap_options.personal) {
41
+ args.push('--personal');
42
+ }
43
+ const result = await exec_command('flux', args, exec_options);
44
+ if (!result.success) {
45
+ return result;
46
+ }
47
+ if (result.value.exit_code !== 0) {
48
+ return failure({
49
+ code: 'FLUX_BOOTSTRAP_ERROR',
50
+ message: result.value.stderr || 'Failed to bootstrap Flux',
51
+ });
52
+ }
53
+ return success(undefined);
54
+ },
55
+ async check() {
56
+ const args = [...base_args, 'check'];
57
+ const result = await exec_command('flux', args, { ...exec_options, timeout: 30000 });
58
+ if (!result.success) {
59
+ return result;
60
+ }
61
+ // Parse flux check output
62
+ const output = result.value.stdout + result.value.stderr;
63
+ const installed = !output.includes('flux not installed');
64
+ // Extract version if available
65
+ const version_match = output.match(/flux-cli v?(\d+\.\d+\.\d+)/i);
66
+ const version = version_match ? version_match[1] : undefined;
67
+ // Parse component status
68
+ const components = [];
69
+ const component_names = [
70
+ 'source-controller',
71
+ 'kustomize-controller',
72
+ 'helm-controller',
73
+ 'notification-controller',
74
+ ];
75
+ for (const name of component_names) {
76
+ const ready = output.includes(`${name}`) && !output.includes(`${name}: not found`);
77
+ components.push({ name, ready });
78
+ }
79
+ const status = {
80
+ installed,
81
+ components,
82
+ };
83
+ if (version !== undefined) {
84
+ status.version = version;
85
+ }
86
+ return success(status);
87
+ },
88
+ async reconcile(resource) {
89
+ const resource_type = get_resource_type(resource.kind);
90
+ const args = [...base_args, 'reconcile', resource_type, resource.name];
91
+ if (resource.namespace) {
92
+ args.push('-n', resource.namespace);
93
+ }
94
+ const result = await exec_command('flux', args, exec_options);
95
+ if (!result.success) {
96
+ return result;
97
+ }
98
+ if (result.value.exit_code !== 0) {
99
+ return failure({
100
+ code: 'FLUX_RECONCILE_ERROR',
101
+ message: result.value.stderr || 'Failed to reconcile resource',
102
+ });
103
+ }
104
+ return success(undefined);
105
+ },
106
+ async get(resource) {
107
+ const resource_type = get_resource_type(resource.kind);
108
+ const args = [...base_args, 'get', resource_type, resource.name, '-o', 'json'];
109
+ if (resource.namespace) {
110
+ args.push('-n', resource.namespace);
111
+ }
112
+ const result = await exec_command('flux', args, exec_options);
113
+ if (!result.success) {
114
+ return result;
115
+ }
116
+ if (result.value.exit_code !== 0) {
117
+ return failure({
118
+ code: 'FLUX_GET_ERROR',
119
+ message: result.value.stderr || 'Failed to get resource',
120
+ });
121
+ }
122
+ try {
123
+ return success(JSON.parse(result.value.stdout));
124
+ }
125
+ catch {
126
+ return failure({
127
+ code: 'FLUX_PARSE_ERROR',
128
+ message: 'Failed to parse flux output',
129
+ });
130
+ }
131
+ },
132
+ async suspend(resource) {
133
+ const resource_type = get_resource_type(resource.kind);
134
+ const args = [...base_args, 'suspend', resource_type, resource.name];
135
+ if (resource.namespace) {
136
+ args.push('-n', resource.namespace);
137
+ }
138
+ const result = await exec_command('flux', args, exec_options);
139
+ if (!result.success) {
140
+ return result;
141
+ }
142
+ if (result.value.exit_code !== 0) {
143
+ return failure({
144
+ code: 'FLUX_SUSPEND_ERROR',
145
+ message: result.value.stderr || 'Failed to suspend resource',
146
+ });
147
+ }
148
+ return success(undefined);
149
+ },
150
+ async resume(resource) {
151
+ const resource_type = get_resource_type(resource.kind);
152
+ const args = [...base_args, 'resume', resource_type, resource.name];
153
+ if (resource.namespace) {
154
+ args.push('-n', resource.namespace);
155
+ }
156
+ const result = await exec_command('flux', args, exec_options);
157
+ if (!result.success) {
158
+ return result;
159
+ }
160
+ if (result.value.exit_code !== 0) {
161
+ return failure({
162
+ code: 'FLUX_RESUME_ERROR',
163
+ message: result.value.stderr || 'Failed to resume resource',
164
+ });
165
+ }
166
+ return success(undefined);
167
+ },
168
+ async uninstall() {
169
+ const args = [...base_args, 'uninstall', '--silent'];
170
+ const result = await exec_command('flux', args, exec_options);
171
+ if (!result.success) {
172
+ return result;
173
+ }
174
+ if (result.value.exit_code !== 0) {
175
+ return failure({
176
+ code: 'FLUX_UNINSTALL_ERROR',
177
+ message: result.value.stderr || 'Failed to uninstall Flux',
178
+ });
179
+ }
180
+ return success(undefined);
181
+ },
182
+ async install() {
183
+ const args = [...base_args, 'install'];
184
+ const result = await exec_command('flux', args, exec_options);
185
+ if (!result.success) {
186
+ return result;
187
+ }
188
+ if (result.value.exit_code !== 0) {
189
+ return failure({
190
+ code: 'FLUX_INSTALL_ERROR',
191
+ message: result.value.stderr || 'Failed to install Flux',
192
+ });
193
+ }
194
+ return success(undefined);
195
+ },
196
+ async check_cli() {
197
+ const available = await check_command('flux');
198
+ return success(available);
199
+ },
200
+ };
201
+ }
202
+ //# sourceMappingURL=flux.js.map
@@ -0,0 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ACb,IAAI,EAAE,oBAAoB;oBAC1B,OAAO,EAAE,MAAM,CAAC,KAAK,CAAC,MAAM,IAAI,wBAAwB;iBACzD,CAAC,CAAC;YACL,CAAC;YAED,OAAO,OAAO,CAAC,SAAS,CAAC,CAAC;QAC5B,CAAC;QAED,KAAK,CAAC,SAAS;YACb,MAAM,SAAS,GAAG,MAAM,aAAa,CAAC,MAAM,CAAC,CAAC;YAC9C,OAAO,OAAO,CAAC,SAAS,CAAC,CAAC;QAC5B,CAAC;KACF,CAAC;AACJ,CAAC"}
@@ -0,0 +1,6 @@
1
+ export * from './exec.js';
2
+ export * from './flux.js';
3
+ export * from './kubeconfig.js';
4
+ export * from './kubectl.js';
5
+ export * from './types.js';
6
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/k8s/index.ts"],"names":[],"mappings":"AAAA,cAAc,WAAW,CAAC;AAC1B,cAAc,WAAW,CAAC;AAC1B,cAAc,iBAAiB,CAAC;AAChC,cAAc,cAAc,CAAC;AAC7B,cAAc,YAAY,CAAC"}
@@ -0,0 +1,6 @@
1
+ export * from './exec.js';
2
+ export * from './flux.js';
3
+ export * from './kubeconfig.js';
4
+ export * from './kubectl.js';
5
+ export * from './types.js';
6
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/k8s/index.ts"],"names":[],"mappings":"AAAA,cAAc,WAAW,CAAC;AAC1B,cAAc,WAAW,CAAC;AAC1B,cAAc,iBAAiB,CAAC;AAChC,cAAc,cAAc,CAAC;AAC7B,cAAc,YAAY,CAAC"}
@@ -0,0 +1,45 @@
1
+ import type { KustodianErrorType } from '../core/index.js';
2
+ import { type ResultType } from '../core/index.js';
3
+ /**
4
+ * Kubeconfig context information.
5
+ */
6
+ export interface KubeconfigContextType {
7
+ name: string;
8
+ cluster: string;
9
+ user: string;
10
+ namespace?: string;
11
+ }
12
+ /**
13
+ * Kubeconfig manager interface.
14
+ */
15
+ export interface KubeconfigManagerType {
16
+ /**
17
+ * Gets the default kubeconfig path.
18
+ */
19
+ get_default_path(): string;
20
+ /**
21
+ * Gets the current context.
22
+ */
23
+ get_current_context(): Promise<ResultType<string, KustodianErrorType>>;
24
+ /**
25
+ * Sets the current context.
26
+ */
27
+ set_context(name: string): Promise<ResultType<void, KustodianErrorType>>;
28
+ /**
29
+ * Lists all available contexts.
30
+ */
31
+ list_contexts(): Promise<ResultType<KubeconfigContextType[], KustodianErrorType>>;
32
+ /**
33
+ * Checks if a kubeconfig file exists.
34
+ */
35
+ exists(kubeconfig_path?: string): Promise<boolean>;
36
+ /**
37
+ * Merges a kubeconfig into the default kubeconfig.
38
+ */
39
+ merge(new_kubeconfig: string): Promise<ResultType<void, KustodianErrorType>>;
40
+ }
41
+ /**
42
+ * Creates a kubeconfig manager.
43
+ */
44
+ export declare function create_kubeconfig_manager(): KubeconfigManagerType;
45
+ //# sourceMappingURL=kubeconfig.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"kubeconfig.d.ts","sourceRoot":"","sources":["../../src/k8s/kubeconfig.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,kBAAkB,CAAC;AAC3D,OAAO,EAAE,KAAK,UAAU,EAAoB,MAAM,kBAAkB,CAAC;AAIrE;;GAEG;AACH,MAAM,WAAW,qBAAqB;IACpC,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,EAAE,MAAM,CAAC;IACb,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED;;GAEG;AACH,MAAM,WAAW,qBAAqB;IACpC;;OAEG;IACH,gBAAgB,IAAI,MAAM,CAAC;IAE3B;;OAEG;IACH,mBAAmB,IAAI,OAAO,CAAC,UAAU,CAAC,MAAM,EAAE,kBAAkB,CAAC,CAAC,CAAC;IAEvE;;OAEG;IACH,WAAW,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,UAAU,CAAC,IAAI,EAAE,kBAAkB,CAAC,CAAC,CAAC;IAEzE;;OAEG;IACH,aAAa,IAAI,OAAO,CAAC,UAAU,CAAC,qBAAqB,EAAE,EAAE,kBAAkB,CAAC,CAAC,CAAC;IAElF;;OAEG;IACH,MAAM,CAAC,eAAe,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;IAEnD;;OAEG;IACH,KAAK,CAAC,cAAc,EAAE,MAAM,GAAG,OAAO,CAAC,UAAU,CAAC,IAAI,EAAE,kBAAkB,CAAC,CAAC,CAAC;CAC9E;AAED;;GAEG;AACH,wBAAgB,yBAAyB,IAAI,qBAAqB,CA8JjE"}