@shepherdjerred/helm-types 1.7.0 → 2.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.
- package/CHANGELOG.md +78 -0
- package/LICENSE +674 -0
- package/README.md +82 -63
- package/demos/argo-cd-cli.cast +50 -0
- package/demos/record-cli-demo.sh +132 -0
- package/dist/chart-fetcher.d.ts +14 -0
- package/dist/chart-fetcher.d.ts.map +1 -0
- package/dist/chart-fetcher.js +105 -0
- package/dist/chart-fetcher.js.map +1 -0
- package/dist/chart-info-parser.d.ts +6 -0
- package/dist/chart-info-parser.d.ts.map +1 -0
- package/dist/chart-info-parser.js +50 -0
- package/dist/chart-info-parser.js.map +1 -0
- package/dist/cli.d.ts +7 -0
- package/dist/cli.d.ts.map +1 -0
- package/dist/cli.js +140 -22841
- package/dist/cli.js.map +1 -0
- package/dist/comment-parser.d.ts +10 -0
- package/dist/comment-parser.d.ts.map +1 -0
- package/dist/comment-parser.js +150 -0
- package/dist/comment-parser.js.map +1 -0
- package/dist/config.d.ts +24 -0
- package/dist/config.d.ts.map +1 -0
- package/dist/config.js +169 -0
- package/dist/config.js.map +1 -0
- package/dist/helm-types.d.ts +16 -0
- package/dist/helm-types.d.ts.map +1 -0
- package/{src/helm-types.ts → dist/helm-types.js} +1 -1
- package/dist/helm-types.js.map +1 -0
- package/dist/index.d.ts +25 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +22 -23
- package/dist/index.js.map +1 -0
- package/dist/interface-generator.d.ts +6 -0
- package/dist/interface-generator.d.ts.map +1 -0
- package/dist/interface-generator.js +181 -0
- package/dist/interface-generator.js.map +1 -0
- package/dist/schemas.d.ts +13 -0
- package/dist/schemas.d.ts.map +1 -0
- package/{src/schemas.ts → dist/schemas.js} +12 -23
- package/dist/schemas.js.map +1 -0
- package/dist/type-converter-helpers.d.ts +20 -0
- package/dist/type-converter-helpers.d.ts.map +1 -0
- package/dist/type-converter-helpers.js +75 -0
- package/dist/type-converter-helpers.js.map +1 -0
- package/dist/type-converter.d.ts +26 -0
- package/dist/type-converter.d.ts.map +1 -0
- package/dist/type-converter.js +378 -0
- package/dist/type-converter.js.map +1 -0
- package/dist/types.d.ts +35 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +3 -0
- package/dist/types.js.map +1 -0
- package/dist/utils.d.ts +17 -0
- package/dist/utils.d.ts.map +1 -0
- package/dist/utils.js +69 -0
- package/dist/utils.js.map +1 -0
- package/dist/yaml-comment-filters.d.ts +7 -0
- package/dist/yaml-comment-filters.d.ts.map +1 -0
- package/dist/yaml-comment-filters.js +91 -0
- package/dist/yaml-comment-filters.js.map +1 -0
- package/dist/yaml-comment-regex-parser.d.ts +8 -0
- package/dist/yaml-comment-regex-parser.d.ts.map +1 -0
- package/dist/yaml-comment-regex-parser.js +120 -0
- package/dist/yaml-comment-regex-parser.js.map +1 -0
- package/dist/yaml-comments.d.ts +74 -0
- package/dist/yaml-comments.d.ts.map +1 -0
- package/dist/yaml-comments.js +406 -0
- package/dist/yaml-comments.js.map +1 -0
- package/dist/yaml-preprocess.d.ts +15 -0
- package/dist/yaml-preprocess.d.ts.map +1 -0
- package/dist/yaml-preprocess.js +170 -0
- package/dist/yaml-preprocess.js.map +1 -0
- package/examples/argo-cd/generate.mjs +23 -0
- package/package.json +17 -12
- package/src/__fixtures__/sample-chart/Chart.yaml +0 -6
- package/src/__fixtures__/sample-chart/values.schema.json +0 -32
- package/src/__fixtures__/sample-chart/values.yaml +0 -22
- package/src/chart-fetcher.ts +0 -221
- package/src/chart-info-parser.ts +0 -64
- package/src/cli.ts +0 -217
- package/src/code-generator.ts +0 -226
- package/src/comment-parser.ts +0 -180
- package/src/config.ts +0 -195
- package/src/index.ts +0 -28
- package/src/interface-generator.ts +0 -238
- package/src/reset.d.ts +0 -1
- package/src/type-converter-helpers.ts +0 -108
- package/src/type-converter.ts +0 -520
- package/src/type-inference.ts +0 -548
- package/src/types.ts +0 -41
- package/src/utils.ts +0 -76
- package/src/yaml-comment-filters.ts +0 -103
- package/src/yaml-comment-regex-parser.ts +0 -150
- package/src/yaml-comments.ts +0 -507
- package/src/yaml-preprocess.ts +0 -235
package/dist/cli.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cli.js","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":";AACA;;;;GAIG;AACH,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AACvD,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AACzC,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AACpD,OAAO,EAAE,4BAA4B,EAAE,MAAM,qBAAqB,CAAC;AACnE,OAAO,EAAE,sBAAsB,EAAE,MAAM,0BAA0B,CAAC;AAGlE,MAAM,SAAS,GAAG,MAAM,CAAC,GAAG,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAqC3B,CAAC;AAeF,wCAAwC;AACxC,MAAM,QAAQ,GAAqC;IACjD,QAAQ,EAAE,MAAM;IAChB,IAAI,EAAE,MAAM;IACZ,SAAS,EAAE,OAAO;IAClB,IAAI,EAAE,OAAO;IACb,QAAQ,EAAE,MAAM;IAChB,IAAI,EAAE,MAAM;IACZ,WAAW,EAAE,SAAS;IACtB,IAAI,EAAE,SAAS;IACf,UAAU,EAAE,QAAQ;IACpB,IAAI,EAAE,QAAQ;IACd,aAAa,EAAE,WAAW;IAC1B,IAAI,EAAE,WAAW;CAClB,CAAC;AAEF,MAAM,UAAU,GAAG,IAAI,GAAG,CAAC,CAAC,QAAQ,EAAE,IAAI,CAAC,CAAC,CAAC;AAE7C;;GAEG;AACH,SAAS,YAAY,CAAC,IAAc;IAClC,MAAM,MAAM,GAAY,EAAE,CAAC;IAE3B,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,IAAI,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC;QACrC,M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UAAU,KAAK,SAAS;QAAE,OAAO,KAAK,CAAC;IAC3C,OAAO,CACL,CAAC,MAAM,QAAQ,CAAC,UAAU,CAAC,CAAC;QAC5B,CAAC,MAAM,QAAQ,CAAC,aAAa,CAAC,OAAO,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,CACjD,CAAC;AACJ,CAAC;AAED,IAAI,MAAM,YAAY,EAAE,EAAE,CAAC;IACzB,KAAK,IAAI,EAAE,CAAC;AACd,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Clean up YAML comment text for use in JSDoc
|
|
3
|
+
*/
|
|
4
|
+
export declare function cleanYAMLComment(comment: string): string;
|
|
5
|
+
/**
|
|
6
|
+
* Parse YAML comments and associate them with keys
|
|
7
|
+
* Exported for testing purposes
|
|
8
|
+
*/
|
|
9
|
+
export declare function parseYAMLComments(yamlContent: string): Map<string, string>;
|
|
10
|
+
//# sourceMappingURL=comment-parser.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"comment-parser.d.ts","sourceRoot":"","sources":["../src/comment-parser.ts"],"names":[],"mappings":"AA6CA;;GAEG;AACH,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAoCxD;AAED;;;GAGG;AACH,wBAAgB,iBAAiB,CAAC,WAAW,EAAE,MAAM,GAAG,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,CAyF1E"}
|
|
@@ -0,0 +1,150 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Check if a line looks like an example/code block rather than documentation
|
|
3
|
+
*/
|
|
4
|
+
function isExampleLine(line) {
|
|
5
|
+
return (/^-{3,}/.test(line) ||
|
|
6
|
+
/^BEGIN .*(?:KEY|CERTIFICATE)/.test(line) ||
|
|
7
|
+
/^END .*(?:KEY|CERTIFICATE)/.test(line) ||
|
|
8
|
+
(line.startsWith("-") && (line.includes(":") || /^-\s+\|/.test(line))) ||
|
|
9
|
+
/^\w+:$/.test(line) ||
|
|
10
|
+
/^[\w-]+:\s*$/.test(line) ||
|
|
11
|
+
/^[\w.-]+:\s*\|/.test(line) || // YAML multiline indicator (e.g., "policy.csv: |")
|
|
12
|
+
line.startsWith("|") ||
|
|
13
|
+
line.includes("$ARGOCD_") ||
|
|
14
|
+
line.includes("$KUBE_") ||
|
|
15
|
+
/^\s{2,}/.test(line) ||
|
|
16
|
+
/^echo\s+/.test(line) ||
|
|
17
|
+
/^[pg],\s*/.test(line) // Policy rules like "p, role:..." or "g, subject, ..."
|
|
18
|
+
);
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Check if a line looks like normal prose (sentence case, punctuation)
|
|
22
|
+
*/
|
|
23
|
+
function looksLikeProse(line) {
|
|
24
|
+
return (/^[A-Z][\w\s]+[.!?]$/.test(line) ||
|
|
25
|
+
/^[A-Z][\w\s,'"-]+(?::\s*)?$/.test(line) ||
|
|
26
|
+
line.startsWith("Ref:") ||
|
|
27
|
+
line.startsWith("See:") ||
|
|
28
|
+
line.startsWith("http://") ||
|
|
29
|
+
line.startsWith("https://"));
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Strip YAML comment markers from a single line
|
|
33
|
+
*/
|
|
34
|
+
function stripCommentMarkers(line) {
|
|
35
|
+
let result = line.replace(/^#+\s*/, "");
|
|
36
|
+
result = result.replace(/^--\s*/, "");
|
|
37
|
+
result = result.replace(/^##\s*/, "");
|
|
38
|
+
return result.trim();
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* Clean up YAML comment text for use in JSDoc
|
|
42
|
+
*/
|
|
43
|
+
export function cleanYAMLComment(comment) {
|
|
44
|
+
const lines = comment.split("\n").map((line) => stripCommentMarkers(line));
|
|
45
|
+
// Filter and clean lines
|
|
46
|
+
const cleaned = [];
|
|
47
|
+
let inCodeBlock = false;
|
|
48
|
+
for (const currentLine of lines) {
|
|
49
|
+
if (currentLine.length === 0) {
|
|
50
|
+
if (inCodeBlock) {
|
|
51
|
+
inCodeBlock = false;
|
|
52
|
+
}
|
|
53
|
+
continue;
|
|
54
|
+
}
|
|
55
|
+
if (currentLine.startsWith("@default")) {
|
|
56
|
+
continue;
|
|
57
|
+
}
|
|
58
|
+
if (isExampleLine(currentLine)) {
|
|
59
|
+
inCodeBlock = true;
|
|
60
|
+
continue;
|
|
61
|
+
}
|
|
62
|
+
if (inCodeBlock) {
|
|
63
|
+
if (looksLikeProse(currentLine)) {
|
|
64
|
+
inCodeBlock = false;
|
|
65
|
+
}
|
|
66
|
+
else {
|
|
67
|
+
continue;
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
cleaned.push(currentLine);
|
|
71
|
+
}
|
|
72
|
+
return cleaned.join("\n").trim();
|
|
73
|
+
}
|
|
74
|
+
/**
|
|
75
|
+
* Parse YAML comments and associate them with keys
|
|
76
|
+
* Exported for testing purposes
|
|
77
|
+
*/
|
|
78
|
+
export function parseYAMLComments(yamlContent) {
|
|
79
|
+
const lines = yamlContent.split("\n");
|
|
80
|
+
const comments = new Map();
|
|
81
|
+
let pendingComments = [];
|
|
82
|
+
const indentStack = [];
|
|
83
|
+
for (const line of lines) {
|
|
84
|
+
const currentLine = line;
|
|
85
|
+
const trimmed = currentLine.trim();
|
|
86
|
+
// Skip empty lines
|
|
87
|
+
if (!trimmed) {
|
|
88
|
+
// Empty lines break comment association only if we already have comments
|
|
89
|
+
// This allows comments separated by blank lines to still be associated
|
|
90
|
+
continue;
|
|
91
|
+
}
|
|
92
|
+
// Check if line is a comment
|
|
93
|
+
if (trimmed.startsWith("#")) {
|
|
94
|
+
const comment = trimmed.slice(1).trim();
|
|
95
|
+
if (comment) {
|
|
96
|
+
// Track the indentation level of the comment
|
|
97
|
+
const commentIndent = currentLine.search(/\S/);
|
|
98
|
+
pendingComments.push({ text: comment, indent: commentIndent });
|
|
99
|
+
}
|
|
100
|
+
continue;
|
|
101
|
+
}
|
|
102
|
+
// Check if line has a key
|
|
103
|
+
const keyMatch = /^(\s*)([\w-]+)\s*:/.exec(currentLine);
|
|
104
|
+
if (keyMatch) {
|
|
105
|
+
const indent = keyMatch[1]?.length ?? 0;
|
|
106
|
+
const key = keyMatch[2];
|
|
107
|
+
if (key === "" || key == null) {
|
|
108
|
+
continue;
|
|
109
|
+
}
|
|
110
|
+
// Update indent stack
|
|
111
|
+
const lastIndent = indentStack.at(-1);
|
|
112
|
+
while (lastIndent &&
|
|
113
|
+
indentStack.length > 0 &&
|
|
114
|
+
lastIndent.indent >= indent) {
|
|
115
|
+
indentStack.pop();
|
|
116
|
+
}
|
|
117
|
+
// Build full key path
|
|
118
|
+
const keyPath = indentStack.length > 0
|
|
119
|
+
? `${indentStack.map((s) => s.key).join(".")}.${key}`
|
|
120
|
+
: key;
|
|
121
|
+
// Check for inline comment
|
|
122
|
+
const inlineCommentMatch = /#\s*(\S.*)$/.exec(currentLine);
|
|
123
|
+
if (inlineCommentMatch?.[1] != null && inlineCommentMatch[1] !== "") {
|
|
124
|
+
pendingComments.push({ text: inlineCommentMatch[1].trim(), indent });
|
|
125
|
+
}
|
|
126
|
+
// Filter pending comments to only those at the same or shallower indent level as this key
|
|
127
|
+
// This prevents comments from deeper nested properties being associated with a shallower property
|
|
128
|
+
const relevantComments = pendingComments.filter((c) => c.indent <= indent);
|
|
129
|
+
// Associate relevant comments with this key
|
|
130
|
+
if (relevantComments.length > 0) {
|
|
131
|
+
// Join and clean comments
|
|
132
|
+
const commentText = cleanYAMLComment(relevantComments.map((c) => c.text).join("\n"));
|
|
133
|
+
if (commentText) {
|
|
134
|
+
comments.set(keyPath, commentText);
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
// Clear pending comments after processing
|
|
138
|
+
pendingComments = [];
|
|
139
|
+
// Add to indent stack
|
|
140
|
+
indentStack.push({ indent, key });
|
|
141
|
+
}
|
|
142
|
+
else {
|
|
143
|
+
// If we encounter a non-comment, non-key line, clear pending comments
|
|
144
|
+
// This handles list items and other YAML structures
|
|
145
|
+
pendingComments = [];
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
return comments;
|
|
149
|
+
}
|
|
150
|
+
//# sourceMappingURL=comment-parser.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"comment-parser.js","sourceRoot":"","sources":["../src/comment-parser.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,SAAS,aAAa,CAAC,IAAY;IACjC,OAAO,CACL,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC;QACnB,8BAA8B,CAAC,IAAI,CAAC,IAAI,CAAC;QACzC,4BAA4B,CAAC,IAAI,CAAC,IAAI,CAAC;QACvC,CAAC,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,IAAI,SAAS,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC;QACtE,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC;QACnB,cAAc,CAAC,IAAI,CAAC,IAAI,CAAC;QACzB,gBAAgB,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,mDAAmD;QAClF,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC;QACpB,IAAI,CAAC,QAAQ,CAAC,UAAU,CAAC;QACzB,IAAI,CAAC,QAAQ,CAAC,QAAQ,CAAC;QACvB,SAAS,CAAC,IAAI,CAAC,IAAI,CAAC;QACpB,UAAU,CAAC,IAAI,CAAC,IAAI,CAAC;QACrB,WAAW,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,uDAAuD;KAC/E,CAAC;AACJ,CAAC;AAED;;GAEG;AACH,SAAS,cAAc,CAAC,IAAY;IAClC,OAAO,CACL,qBAAqB,CAAC,IAAI,CAAC,IAAI,CAAC;QAChC,6BAA6B,CAAC,IAAI,CAAC,IAAI,CAAC;QACxC,IAAI,CAAC,UAAU,CAAC,MAAM,CAAC;QACvB,IAAI,CAAC,UAAU,CAAC,MAAM,CAAC;QACvB,IAAI,CAAC,UAA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MAAM,WAAW,GAAG,gBAAgB,CAClC,gBAAgB,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAC/C,CAAC;gBACF,IAAI,WAAW,EAAE,CAAC;oBAChB,QAAQ,CAAC,GAAG,CAAC,OAAO,EAAE,WAAW,CAAC,CAAC;gBACrC,CAAC;YACH,CAAC;YAED,0CAA0C;YAC1C,eAAe,GAAG,EAAE,CAAC;YAErB,sBAAsB;YACtB,WAAW,CAAC,IAAI,CAAC,EAAE,MAAM,EAAE,GAAG,EAAE,CAAC,CAAC;QACpC,CAAC;aAAM,CAAC;YACN,sEAAsE;YACtE,oDAAoD;YACpD,eAAe,GAAG,EAAE,CAAC;QACvB,CAAC;IACH,CAAC;IAED,OAAO,QAAQ,CAAC;AAClB,CAAC"}
|
package/dist/config.d.ts
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Return the canonical type for a well-known Kubernetes field, or undefined if
|
|
3
|
+
* the property name doesn't match or the default value's shape is incompatible
|
|
4
|
+
* (e.g. an RBAC `resources: ["secrets"]` array, which must NOT become
|
|
5
|
+
* ResourceRequirements).
|
|
6
|
+
*/
|
|
7
|
+
export declare function getWellKnownK8sFieldType(propertyName: string, value: unknown): {
|
|
8
|
+
type: string;
|
|
9
|
+
description: string;
|
|
10
|
+
} | undefined;
|
|
11
|
+
/**
|
|
12
|
+
* Configuration for types that should allow arbitrary additional properties.
|
|
13
|
+
* Maps chart names to array of key paths that should be extensible.
|
|
14
|
+
*
|
|
15
|
+
* These are typically config maps, RBAC policies, or other key-value stores
|
|
16
|
+
* where the schema doesn't enumerate all possible keys.
|
|
17
|
+
*/
|
|
18
|
+
export declare const EXTENSIBLE_TYPE_PATTERNS: Record<string, string[]>;
|
|
19
|
+
/**
|
|
20
|
+
* Pattern-based detection for extensible types.
|
|
21
|
+
* Returns true if the property should allow arbitrary keys.
|
|
22
|
+
*/
|
|
23
|
+
export declare function shouldAllowArbitraryProps(keyPath: string, chartName: string, propertyName: string, yamlComment?: string): boolean;
|
|
24
|
+
//# sourceMappingURL=config.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAuCA;;;;;GAKG;AACH,wBAAgB,wBAAwB,CACtC,YAAY,EAAE,MAAM,EACpB,KAAK,EAAE,OAAO,GACb;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,WAAW,EAAE,MAAM,CAAA;CAAE,GAAG,SAAS,CAiBnD;AAED;;;;;;GAMG;AACH,eAAO,MAAM,wBAAwB,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,EAAE,CAgD7D,CAAC;AAEF;;;GAGG;AACH,wBAAgB,yBAAyB,CACvC,OAAO,EAAE,MAAM,EACf,SAAS,EAAE,MAAM,EACjB,YAAY,EAAE,MAAM,EACpB,WAAW,CAAC,EAAE,MAAM,GACnB,OAAO,CA6DT"}
|
package/dist/config.js
ADDED
|
@@ -0,0 +1,169 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Well-known Kubernetes fields whose shape is defined by the Kubernetes API,
|
|
3
|
+
* not by whatever subset a chart's values.yaml happens to set as defaults.
|
|
4
|
+
*
|
|
5
|
+
* Inferring these from defaults produces types that are too narrow — e.g. a
|
|
6
|
+
* chart defaulting `resources: {requests: {cpu: 0.2}}` would otherwise forbid
|
|
7
|
+
* setting a memory request at all. When a property matches one of these names
|
|
8
|
+
* AND its default value has a compatible shape, the canonical permissive type
|
|
9
|
+
* is emitted instead of a defaults-derived interface.
|
|
10
|
+
*/
|
|
11
|
+
const K8S_WELL_KNOWN_FIELDS = {
|
|
12
|
+
resources: {
|
|
13
|
+
type: "{ requests?: Record<string, string | number>; limits?: Record<string, string | number> }",
|
|
14
|
+
// RBAC rules also use a key named `resources`, but as an array of strings —
|
|
15
|
+
// the object guard keeps those out.
|
|
16
|
+
allowedShapes: ["object"],
|
|
17
|
+
description: "Kubernetes container resources (standard ResourceRequirements: arbitrary resource names, string or numeric quantities)",
|
|
18
|
+
},
|
|
19
|
+
nodeselector: {
|
|
20
|
+
type: "Record<string, string>",
|
|
21
|
+
allowedShapes: ["object"],
|
|
22
|
+
description: "Kubernetes nodeSelector (arbitrary label key/value pairs)",
|
|
23
|
+
},
|
|
24
|
+
tolerations: {
|
|
25
|
+
type: "unknown[]",
|
|
26
|
+
allowedShapes: ["array"],
|
|
27
|
+
description: "Kubernetes tolerations (standard Toleration objects)",
|
|
28
|
+
},
|
|
29
|
+
affinity: {
|
|
30
|
+
type: "Record<string, unknown>",
|
|
31
|
+
allowedShapes: ["object"],
|
|
32
|
+
description: "Kubernetes affinity (standard Affinity object)",
|
|
33
|
+
},
|
|
34
|
+
};
|
|
35
|
+
/**
|
|
36
|
+
* Return the canonical type for a well-known Kubernetes field, or undefined if
|
|
37
|
+
* the property name doesn't match or the default value's shape is incompatible
|
|
38
|
+
* (e.g. an RBAC `resources: ["secrets"]` array, which must NOT become
|
|
39
|
+
* ResourceRequirements).
|
|
40
|
+
*/
|
|
41
|
+
export function getWellKnownK8sFieldType(propertyName, value) {
|
|
42
|
+
const field = K8S_WELL_KNOWN_FIELDS[propertyName.toLowerCase()];
|
|
43
|
+
if (!field) {
|
|
44
|
+
return undefined;
|
|
45
|
+
}
|
|
46
|
+
// A null/undefined default carries no shape signal — trust the name.
|
|
47
|
+
if (value != null) {
|
|
48
|
+
const shape = Array.isArray(value)
|
|
49
|
+
? "array"
|
|
50
|
+
: typeof value === "object"
|
|
51
|
+
? "object"
|
|
52
|
+
: "primitive";
|
|
53
|
+
if (shape === "primitive" || !field.allowedShapes.includes(shape)) {
|
|
54
|
+
return undefined;
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
return { type: field.type, description: field.description };
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* Configuration for types that should allow arbitrary additional properties.
|
|
61
|
+
* Maps chart names to array of key paths that should be extensible.
|
|
62
|
+
*
|
|
63
|
+
* These are typically config maps, RBAC policies, or other key-value stores
|
|
64
|
+
* where the schema doesn't enumerate all possible keys.
|
|
65
|
+
*/
|
|
66
|
+
export const EXTENSIBLE_TYPE_PATTERNS = {
|
|
67
|
+
"argo-cd": [
|
|
68
|
+
"configs.cm", // Allows accounts.*, and other custom config
|
|
69
|
+
"configs.rbac", // Allows policy.*, custom RBAC rules
|
|
70
|
+
],
|
|
71
|
+
"kube-prometheus-stack": [
|
|
72
|
+
"grafana", // Allows "grafana.ini" and other quoted config keys
|
|
73
|
+
"grafana.deploymentStrategy", // Allows Kubernetes Deployment strategy objects with flexible fields
|
|
74
|
+
"alertmanager.config.receivers", // Allows receiver-specific config blocks on array elements
|
|
75
|
+
"prometheus-node-exporter", // Allows extraHostVolumeMounts and other node exporter specific configs
|
|
76
|
+
"prometheusNodeExporter", // Also support camelCase variant
|
|
77
|
+
],
|
|
78
|
+
loki: [
|
|
79
|
+
"loki.limits_config", // Allows retention_period and other limit configs (note: underscore, not camelCase)
|
|
80
|
+
"loki.limitsConfig", // Also support camelCase variant
|
|
81
|
+
"compactor", // Allows various compactor settings
|
|
82
|
+
"minio.persistence", // Storage configs
|
|
83
|
+
],
|
|
84
|
+
minecraft: [
|
|
85
|
+
"persistence", // Storage class and other persistence options
|
|
86
|
+
],
|
|
87
|
+
openebs: [
|
|
88
|
+
"zfs-localpv", // ZFS-specific configs
|
|
89
|
+
],
|
|
90
|
+
"postgres-operator": [
|
|
91
|
+
"configGeneral", // General config allows various settings
|
|
92
|
+
],
|
|
93
|
+
chartmuseum: [
|
|
94
|
+
"persistence", // Storage options
|
|
95
|
+
],
|
|
96
|
+
"intel-device-plugins-operator": [
|
|
97
|
+
// Root level for device-specific settings
|
|
98
|
+
"",
|
|
99
|
+
],
|
|
100
|
+
"prometheus-adapter": [
|
|
101
|
+
"rules", // Allows resource, custom, external and other rule configurations
|
|
102
|
+
],
|
|
103
|
+
velero: [
|
|
104
|
+
"kubectl.image", // Allows image configuration
|
|
105
|
+
],
|
|
106
|
+
seaweedfs: [
|
|
107
|
+
"volume.dataDirs", // dataDirs elements support size, storageClass when type is persistentVolumeClaim
|
|
108
|
+
],
|
|
109
|
+
// OCI charts that document config keys only as commented-out examples in
|
|
110
|
+
// values.yaml, so inference from active defaults misses valid keys.
|
|
111
|
+
"agent-stack-k8s": [
|
|
112
|
+
"config", // config.queue / max-in-flight / empty-job-grace-period / default-checkout-params are valid but not defaulted
|
|
113
|
+
],
|
|
114
|
+
};
|
|
115
|
+
/**
|
|
116
|
+
* Pattern-based detection for extensible types.
|
|
117
|
+
* Returns true if the property should allow arbitrary keys.
|
|
118
|
+
*/
|
|
119
|
+
export function shouldAllowArbitraryProps(keyPath, chartName, propertyName, yamlComment) {
|
|
120
|
+
// Check configured patterns for this chart
|
|
121
|
+
const patterns = EXTENSIBLE_TYPE_PATTERNS[chartName];
|
|
122
|
+
if (patterns) {
|
|
123
|
+
for (const pattern of patterns) {
|
|
124
|
+
if (pattern === keyPath ||
|
|
125
|
+
(pattern === "" && keyPath.split(".").length === 1)) {
|
|
126
|
+
return true;
|
|
127
|
+
}
|
|
128
|
+
// Also match if keyPath starts with pattern
|
|
129
|
+
if (pattern && keyPath.startsWith(`${pattern}.`)) {
|
|
130
|
+
return true;
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
// Pattern-based detection from property names
|
|
135
|
+
const lowerProp = propertyName.toLowerCase();
|
|
136
|
+
const lowerPath = keyPath.toLowerCase();
|
|
137
|
+
// Common names that suggest extensibility
|
|
138
|
+
const extensibleNames = [
|
|
139
|
+
"cm", // ConfigMap data
|
|
140
|
+
"data",
|
|
141
|
+
"config",
|
|
142
|
+
"configs",
|
|
143
|
+
"settings",
|
|
144
|
+
"parameters",
|
|
145
|
+
"options",
|
|
146
|
+
"extraenv",
|
|
147
|
+
"annotations",
|
|
148
|
+
"labels",
|
|
149
|
+
"nodeaffinity",
|
|
150
|
+
"toleration",
|
|
151
|
+
];
|
|
152
|
+
if (extensibleNames.includes(lowerProp)) {
|
|
153
|
+
return true;
|
|
154
|
+
}
|
|
155
|
+
// Check for persistence/storage which often has provider-specific fields
|
|
156
|
+
if (lowerPath.includes("persistence") || lowerPath.includes("storage")) {
|
|
157
|
+
return true;
|
|
158
|
+
}
|
|
159
|
+
// Check YAML comments for hints
|
|
160
|
+
if (yamlComment !== "" && yamlComment != null) {
|
|
161
|
+
const commentLower = yamlComment.toLowerCase();
|
|
162
|
+
if (/\b(?:arbitrary|custom|additional|extra|any)\s+(?:keys?|properties?|fields?|values?)\b/i.test(commentLower) ||
|
|
163
|
+
/\bkey[\s-]?value\s+pairs?\b/i.test(commentLower)) {
|
|
164
|
+
return true;
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
return false;
|
|
168
|
+
}
|
|
169
|
+
//# sourceMappingURL=config.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config.js","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AACH,MAAM,qBAAqB,GAGvB;IACF,SAAS,EAAE;QACT,IAAI,EAAE,0FAA0F;QAChG,4EAA4E;QAC5E,oCAAoC;QACpC,aAAa,EAAE,CAAC,QAAQ,CAAC;QACzB,WAAW,EACT,wHAAwH;KAC3H;IACD,YAAY,EAAE;QACZ,IAAI,EAAE,wBAAwB;QAC9B,aAAa,EAAE,CAAC,QAAQ,CAAC;QACzB,WAAW,EAAE,2DAA2D;KACzE;IACD,WAAW,EAAE;QACX,IAAI,EAAE,WAAW;QACjB,aAAa,EAAE,CAAC,OAAO,CAAC;QACxB,WAAW,EAAE,sDAAsD;KACpE;IACD,QAAQ,EAAE;QACR,IAAI,EAAE,yBAAyB;QAC/B,aAAa,EAAE,CAAC,QAAQ,CAAC;QACzB,WAAW,EAAE,gDAAgD;KAC9D;CACF,CAAC;AAEF;;;;;GAKG;AACH,MAA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ACT,UAAU;QACV,aAAa;QACb,QAAQ;QACR,cAAc;QACd,YAAY;KACb,CAAC;IAEF,IAAI,eAAe,CAAC,QAAQ,CAAC,SAAS,CAAC,EAAE,CAAC;QACxC,OAAO,IAAI,CAAC;IACd,CAAC;IAED,yEAAyE;IACzE,IAAI,SAAS,CAAC,QAAQ,CAAC,aAAa,CAAC,IAAI,SAAS,CAAC,QAAQ,CAAC,SAAS,CAAC,EAAE,CAAC;QACvE,OAAO,IAAI,CAAC;IACd,CAAC;IAED,gCAAgC;IAChC,IAAI,WAAW,KAAK,EAAE,IAAI,WAAW,IAAI,IAAI,EAAE,CAAC;QAC9C,MAAM,YAAY,GAAG,WAAW,CAAC,WAAW,EAAE,CAAC;QAC/C,IACE,wFAAwF,CAAC,IAAI,CAC3F,YAAY,CACb;YACD,8BAA8B,CAAC,IAAI,CAAC,YAAY,CAAC,EACjD,CAAC;YACD,OAAO,IAAI,CAAC;QACd,CAAC;IACH,CAAC;IAED,OAAO,KAAK,CAAC;AACf,CAAC"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file previously served as a barrel/re-export module.
|
|
3
|
+
* Import directly from submodules instead:
|
|
4
|
+
* - ./types.ts - Core types
|
|
5
|
+
* - ./schemas.ts - Zod schemas
|
|
6
|
+
* - ./config.ts - Configuration
|
|
7
|
+
* - ./chart-info-parser.ts - Chart info parsing
|
|
8
|
+
* - ./yaml-comments.ts - YAML comments
|
|
9
|
+
* - ./chart-fetcher.ts - Chart fetching
|
|
10
|
+
* - ./type-converter.ts - Type conversion
|
|
11
|
+
* - ./interface-generator.ts - Code generation
|
|
12
|
+
* - ./utils.ts - Utilities
|
|
13
|
+
*/
|
|
14
|
+
/** Version marker for the helm-types module. */
|
|
15
|
+
export declare const HELM_TYPES_VERSION = "1.1.0";
|
|
16
|
+
//# sourceMappingURL=helm-types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"helm-types.d.ts","sourceRoot":"","sources":["../src/helm-types.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,gDAAgD;AAChD,eAAO,MAAM,kBAAkB,UAAU,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"helm-types.js","sourceRoot":"","sources":["../src/helm-types.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,gDAAgD;AAChD,MAAM,CAAC,MAAM,kBAAkB,GAAG,OAAO,CAAC"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @homelab/helm-types
|
|
3
|
+
*
|
|
4
|
+
* A library for generating TypeScript types from Helm chart values.
|
|
5
|
+
*
|
|
6
|
+
* Core functionality:
|
|
7
|
+
* - Fetch Helm charts from repositories
|
|
8
|
+
* - Parse values.yaml and values.schema.json
|
|
9
|
+
* - Generate TypeScript interfaces with JSDoc comments
|
|
10
|
+
* - Support for nested objects, arrays, and unions
|
|
11
|
+
*
|
|
12
|
+
* This is a general-purpose library that can be used with any Helm chart.
|
|
13
|
+
* Application-specific logic should be kept in your application code.
|
|
14
|
+
*
|
|
15
|
+
* The root export is the complete supported public API.
|
|
16
|
+
*/
|
|
17
|
+
export { fetchHelmChart } from "./chart-fetcher.js";
|
|
18
|
+
export type { FetchedHelmChart } from "./chart-fetcher.js";
|
|
19
|
+
export { parseChartInfoFromVersions } from "./chart-info-parser.js";
|
|
20
|
+
export { generateTypeScriptCode } from "./interface-generator.js";
|
|
21
|
+
export { convertToTypeScriptInterface, inferTypeFromValue, jsonSchemaToTypeScript, } from "./type-converter.js";
|
|
22
|
+
export type { ChartInfo, JSONSchemaProperty, TypeProperty, TypeScriptInterface, } from "./types.js";
|
|
23
|
+
export { HelmValueSchema } from "./schemas.js";
|
|
24
|
+
export type { HelmValue } from "./schemas.js";
|
|
25
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AACH,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AACpD,YAAY,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAC3D,OAAO,EAAE,0BAA0B,EAAE,MAAM,wBAAwB,CAAC;AACpE,OAAO,EAAE,sBAAsB,EAAE,MAAM,0BAA0B,CAAC;AAClE,OAAO,EACL,4BAA4B,EAC5B,kBAAkB,EAClB,sBAAsB,GACvB,MAAM,qBAAqB,CAAC;AAC7B,YAAY,EACV,SAAS,EACT,kBAAkB,EAClB,YAAY,EACZ,mBAAmB,GACpB,MAAM,YAAY,CAAC;AACpB,OAAO,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAC/C,YAAY,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -1,23 +1,22 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
export {
|
|
22
|
-
|
|
23
|
-
};
|
|
1
|
+
/**
|
|
2
|
+
* @homelab/helm-types
|
|
3
|
+
*
|
|
4
|
+
* A library for generating TypeScript types from Helm chart values.
|
|
5
|
+
*
|
|
6
|
+
* Core functionality:
|
|
7
|
+
* - Fetch Helm charts from repositories
|
|
8
|
+
* - Parse values.yaml and values.schema.json
|
|
9
|
+
* - Generate TypeScript interfaces with JSDoc comments
|
|
10
|
+
* - Support for nested objects, arrays, and unions
|
|
11
|
+
*
|
|
12
|
+
* This is a general-purpose library that can be used with any Helm chart.
|
|
13
|
+
* Application-specific logic should be kept in your application code.
|
|
14
|
+
*
|
|
15
|
+
* The root export is the complete supported public API.
|
|
16
|
+
*/
|
|
17
|
+
export { fetchHelmChart } from "./chart-fetcher.js";
|
|
18
|
+
export { parseChartInfoFromVersions } from "./chart-info-parser.js";
|
|
19
|
+
export { generateTypeScriptCode } from "./interface-generator.js";
|
|
20
|
+
export { convertToTypeScriptInterface, inferTypeFromValue, jsonSchemaToTypeScript, } from "./type-converter.js";
|
|
21
|
+
export { HelmValueSchema } from "./schemas.js";
|
|
22
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AACH,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AAEpD,OAAO,EAAE,0BAA0B,EAAE,MAAM,wBAAwB,CAAC;AACpE,OAAO,EAAE,sBAAsB,EAAE,MAAM,0BAA0B,CAAC;AAClE,OAAO,EACL,4BAA4B,EAC5B,kBAAkB,EAClB,sBAAsB,GACvB,MAAM,qBAAqB,CAAC;AAO7B,OAAO,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { TypeScriptInterface } from "./types.js";
|
|
2
|
+
/**
|
|
3
|
+
* Generate TypeScript code from interface definition
|
|
4
|
+
*/
|
|
5
|
+
export declare function generateTypeScriptCode(mainInterface: TypeScriptInterface, chartName: string): string;
|
|
6
|
+
//# sourceMappingURL=interface-generator.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"interface-generator.d.ts","sourceRoot":"","sources":["../src/interface-generator.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,YAAY,CAAC;AAStD;;GAEG;AACH,wBAAgB,sBAAsB,CACpC,aAAa,EAAE,mBAAmB,EAClC,SAAS,EAAE,MAAM,GAChB,MAAM,CAyBR"}
|