@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
|
@@ -0,0 +1,378 @@
|
|
|
1
|
+
import { StringSchema, NullSchema, UndefinedSchema, ArraySchema, HelmValueSchema, ActualBooleanSchema, ActualNumberSchema, StringBooleanSchema, } from "./schemas.js";
|
|
2
|
+
import { shouldAllowArbitraryProps, getWellKnownK8sFieldType, } from "./config.js";
|
|
3
|
+
import { sanitizePropertyName, sanitizeTypeName, capitalizeFirst, } from "./utils.js";
|
|
4
|
+
import { mergeDescriptions, inferPrimitiveType, } from "./type-converter-helpers.js";
|
|
5
|
+
/**
|
|
6
|
+
* Convert JSON schema type to TypeScript type string
|
|
7
|
+
*/
|
|
8
|
+
export function jsonSchemaToTypeScript(schema) {
|
|
9
|
+
// Handle oneOf - union of types
|
|
10
|
+
if (schema.oneOf) {
|
|
11
|
+
const types = schema.oneOf.map((s) => jsonSchemaToTypeScript(s));
|
|
12
|
+
return types.join(" | ");
|
|
13
|
+
}
|
|
14
|
+
// Handle anyOf - union of types
|
|
15
|
+
if (schema.anyOf) {
|
|
16
|
+
const types = schema.anyOf.map((s) => jsonSchemaToTypeScript(s));
|
|
17
|
+
return types.join(" | ");
|
|
18
|
+
}
|
|
19
|
+
// Handle enum
|
|
20
|
+
if (schema.enum) {
|
|
21
|
+
return schema.enum
|
|
22
|
+
.map((v) => StringSchema.safeParse(v).success ? `"${String(v)}"` : String(v))
|
|
23
|
+
.join(" | ");
|
|
24
|
+
}
|
|
25
|
+
// Handle array type
|
|
26
|
+
if (schema.type === "array" && schema.items) {
|
|
27
|
+
const itemType = jsonSchemaToTypeScript(schema.items);
|
|
28
|
+
return `${itemType}[]`;
|
|
29
|
+
}
|
|
30
|
+
// Handle basic types
|
|
31
|
+
const stringTypeCheck = StringSchema.safeParse(schema.type);
|
|
32
|
+
if (stringTypeCheck.success) {
|
|
33
|
+
switch (stringTypeCheck.data) {
|
|
34
|
+
case "string":
|
|
35
|
+
return "string";
|
|
36
|
+
case "number":
|
|
37
|
+
case "integer":
|
|
38
|
+
return "number";
|
|
39
|
+
case "boolean":
|
|
40
|
+
return "boolean";
|
|
41
|
+
case "object":
|
|
42
|
+
return "object";
|
|
43
|
+
case "array":
|
|
44
|
+
return "unknown[]";
|
|
45
|
+
case "null":
|
|
46
|
+
return "null";
|
|
47
|
+
default:
|
|
48
|
+
return "unknown";
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
// Handle multiple types
|
|
52
|
+
const arrayTypeCheck = ArraySchema.safeParse(schema.type);
|
|
53
|
+
if (arrayTypeCheck.success) {
|
|
54
|
+
return arrayTypeCheck.data
|
|
55
|
+
.map((t) => {
|
|
56
|
+
if (!StringSchema.safeParse(t).success) {
|
|
57
|
+
return "unknown";
|
|
58
|
+
}
|
|
59
|
+
const typeStr = String(t);
|
|
60
|
+
switch (typeStr) {
|
|
61
|
+
case "string":
|
|
62
|
+
return "string";
|
|
63
|
+
case "number":
|
|
64
|
+
case "integer":
|
|
65
|
+
return "number";
|
|
66
|
+
case "boolean":
|
|
67
|
+
return "boolean";
|
|
68
|
+
case "object":
|
|
69
|
+
return "object";
|
|
70
|
+
case "array":
|
|
71
|
+
return "unknown[]";
|
|
72
|
+
case "null":
|
|
73
|
+
return "null";
|
|
74
|
+
default:
|
|
75
|
+
return "unknown";
|
|
76
|
+
}
|
|
77
|
+
})
|
|
78
|
+
.join(" | ");
|
|
79
|
+
}
|
|
80
|
+
return "unknown";
|
|
81
|
+
}
|
|
82
|
+
/**
|
|
83
|
+
* Infer TypeScript type from actual runtime value
|
|
84
|
+
*/
|
|
85
|
+
export function inferTypeFromValue(value) {
|
|
86
|
+
// Check null/undefined
|
|
87
|
+
if (NullSchema.safeParse(value).success ||
|
|
88
|
+
UndefinedSchema.safeParse(value).success) {
|
|
89
|
+
return null;
|
|
90
|
+
}
|
|
91
|
+
// Check for actual boolean
|
|
92
|
+
if (ActualBooleanSchema.safeParse(value).success) {
|
|
93
|
+
return "boolean";
|
|
94
|
+
}
|
|
95
|
+
// Check for actual number
|
|
96
|
+
if (ActualNumberSchema.safeParse(value).success) {
|
|
97
|
+
return "number";
|
|
98
|
+
}
|
|
99
|
+
// Check if it's a string that looks like a boolean
|
|
100
|
+
if (StringBooleanSchema.safeParse(value).success) {
|
|
101
|
+
return "boolean";
|
|
102
|
+
}
|
|
103
|
+
// Check if it's a string that looks like a number
|
|
104
|
+
const stringCheck = StringSchema.safeParse(value);
|
|
105
|
+
if (stringCheck.success) {
|
|
106
|
+
const trimmed = stringCheck.data.trim();
|
|
107
|
+
if (trimmed !== "" &&
|
|
108
|
+
!Number.isNaN(Number(trimmed)) &&
|
|
109
|
+
Number.isFinite(Number(trimmed))) {
|
|
110
|
+
return "number";
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
// Check for array
|
|
114
|
+
if (ArraySchema.safeParse(value).success) {
|
|
115
|
+
return "array";
|
|
116
|
+
}
|
|
117
|
+
// Check for object
|
|
118
|
+
if (HelmValueSchema.safeParse(value).success) {
|
|
119
|
+
return "object";
|
|
120
|
+
}
|
|
121
|
+
// Plain string
|
|
122
|
+
if (StringSchema.safeParse(value).success) {
|
|
123
|
+
return "string";
|
|
124
|
+
}
|
|
125
|
+
return "unknown";
|
|
126
|
+
}
|
|
127
|
+
/**
|
|
128
|
+
* Check if inferred type is compatible with schema type
|
|
129
|
+
*/
|
|
130
|
+
export function typesAreCompatible(inferredType, schemaType) {
|
|
131
|
+
// Exact match
|
|
132
|
+
if (inferredType === schemaType) {
|
|
133
|
+
return true;
|
|
134
|
+
}
|
|
135
|
+
// Check if the inferred type is part of a union in the schema
|
|
136
|
+
// For example: schemaType might be "number | \"default\"" and inferredType is "string"
|
|
137
|
+
const schemaTypes = schemaType
|
|
138
|
+
.split("|")
|
|
139
|
+
.map((t) => t.trim().replaceAll(/^["']|["']$/g, ""));
|
|
140
|
+
// If schema is a union, check if inferred type is compatible with any part
|
|
141
|
+
if (schemaTypes.length > 1) {
|
|
142
|
+
for (const st of schemaTypes) {
|
|
143
|
+
// Handle quoted strings in unions (like "default")
|
|
144
|
+
if (inferredType === "string" && st.startsWith('"') && st.endsWith('"')) {
|
|
145
|
+
return true;
|
|
146
|
+
}
|
|
147
|
+
if (st === inferredType) {
|
|
148
|
+
return true;
|
|
149
|
+
}
|
|
150
|
+
// Arrays
|
|
151
|
+
if (inferredType === "array" && st.endsWith("[]")) {
|
|
152
|
+
return true;
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
// Handle array types
|
|
157
|
+
if (inferredType === "array" && schemaType.endsWith("[]")) {
|
|
158
|
+
return true;
|
|
159
|
+
}
|
|
160
|
+
// Handle specific string literals - if schema expects specific strings and value is a string
|
|
161
|
+
if (inferredType === "string" && schemaType.includes('"')) {
|
|
162
|
+
return true;
|
|
163
|
+
}
|
|
164
|
+
// unknown is compatible with everything (schema might be less specific)
|
|
165
|
+
if (schemaType === "unknown" || inferredType === "unknown") {
|
|
166
|
+
return true;
|
|
167
|
+
}
|
|
168
|
+
return false;
|
|
169
|
+
}
|
|
170
|
+
/**
|
|
171
|
+
* Convert Helm values to TypeScript interface
|
|
172
|
+
*/
|
|
173
|
+
export function convertToTypeScriptInterface(options) {
|
|
174
|
+
const keyPrefix = options.keyPrefix ?? "";
|
|
175
|
+
const properties = {};
|
|
176
|
+
const schemaProps = options.schema?.properties;
|
|
177
|
+
for (const [key, value] of Object.entries(options.values)) {
|
|
178
|
+
const sanitizedKey = sanitizePropertyName(key);
|
|
179
|
+
const typeNameSuffix = sanitizeTypeName(key);
|
|
180
|
+
const propertySchema = schemaProps?.[key];
|
|
181
|
+
const fullKey = keyPrefix ? `${keyPrefix}.${key}` : key;
|
|
182
|
+
const yamlComment = options.yamlComments?.get(fullKey);
|
|
183
|
+
properties[sanitizedKey] = convertValueToProperty({
|
|
184
|
+
value,
|
|
185
|
+
nestedTypeName: `${options.interfaceName}${capitalizeFirst(typeNameSuffix)}`,
|
|
186
|
+
schema: propertySchema,
|
|
187
|
+
propertyName: key,
|
|
188
|
+
yamlComment,
|
|
189
|
+
yamlComments: options.yamlComments,
|
|
190
|
+
fullKey,
|
|
191
|
+
chartName: options.chartName,
|
|
192
|
+
});
|
|
193
|
+
}
|
|
194
|
+
// Check if this interface should allow arbitrary properties
|
|
195
|
+
const allowArbitraryProps = options.chartName != null && options.chartName !== ""
|
|
196
|
+
? shouldAllowArbitraryProps(keyPrefix, options.chartName, keyPrefix.split(".").pop() ?? "", options.yamlComments?.get(keyPrefix))
|
|
197
|
+
: false;
|
|
198
|
+
return {
|
|
199
|
+
name: options.interfaceName,
|
|
200
|
+
properties,
|
|
201
|
+
allowArbitraryProps,
|
|
202
|
+
};
|
|
203
|
+
}
|
|
204
|
+
/**
|
|
205
|
+
* Convert a value to a TypeProperty using JSON schema information
|
|
206
|
+
*/
|
|
207
|
+
function convertWithSchema(ctx) {
|
|
208
|
+
const { value, nestedTypeName, schema, propertyName, yamlComment, yamlComments, fullKey, chartName, } = ctx;
|
|
209
|
+
// Infer the type from the actual value for comparison
|
|
210
|
+
const inferredType = inferTypeFromValue(value);
|
|
211
|
+
const schemaType = jsonSchemaToTypeScript(schema);
|
|
212
|
+
// Warn about type mismatches
|
|
213
|
+
if (inferredType !== "" &&
|
|
214
|
+
inferredType != null &&
|
|
215
|
+
!typesAreCompatible(inferredType, schemaType)) {
|
|
216
|
+
const propName = propertyName !== "" && propertyName != null ? `'${propertyName}': ` : "";
|
|
217
|
+
console.warn(` ⚠️ Type mismatch for ${propName}Schema says '${schemaType}' but value suggests '${inferredType}' (value: ${String(value).slice(0, 50)})`);
|
|
218
|
+
}
|
|
219
|
+
const description = mergeDescriptions(schema.description, yamlComment);
|
|
220
|
+
const defaultValue = schema.default === undefined ? value : schema.default;
|
|
221
|
+
// If schema defines it as an object with properties, recurse
|
|
222
|
+
const helmValueCheckForProps = HelmValueSchema.safeParse(value);
|
|
223
|
+
if (schema.properties && helmValueCheckForProps.success) {
|
|
224
|
+
const nestedInterface = convertToTypeScriptInterface({
|
|
225
|
+
values: helmValueCheckForProps.data,
|
|
226
|
+
interfaceName: nestedTypeName,
|
|
227
|
+
schema,
|
|
228
|
+
yamlComments,
|
|
229
|
+
keyPrefix: fullKey,
|
|
230
|
+
chartName,
|
|
231
|
+
});
|
|
232
|
+
return {
|
|
233
|
+
type: nestedTypeName,
|
|
234
|
+
optional: true,
|
|
235
|
+
nested: nestedInterface,
|
|
236
|
+
description,
|
|
237
|
+
default: defaultValue,
|
|
238
|
+
};
|
|
239
|
+
}
|
|
240
|
+
// Handle object types without explicit properties
|
|
241
|
+
const helmValueCheckForObject = HelmValueSchema.safeParse(value);
|
|
242
|
+
if (schemaType === "object" && helmValueCheckForObject.success) {
|
|
243
|
+
const nestedInterface = convertToTypeScriptInterface({
|
|
244
|
+
values: helmValueCheckForObject.data,
|
|
245
|
+
interfaceName: nestedTypeName,
|
|
246
|
+
yamlComments,
|
|
247
|
+
keyPrefix: fullKey,
|
|
248
|
+
chartName,
|
|
249
|
+
});
|
|
250
|
+
return {
|
|
251
|
+
type: nestedTypeName,
|
|
252
|
+
optional: true,
|
|
253
|
+
nested: nestedInterface,
|
|
254
|
+
description,
|
|
255
|
+
default: defaultValue,
|
|
256
|
+
};
|
|
257
|
+
}
|
|
258
|
+
return {
|
|
259
|
+
type: schemaType,
|
|
260
|
+
optional: true,
|
|
261
|
+
description,
|
|
262
|
+
default: defaultValue,
|
|
263
|
+
};
|
|
264
|
+
}
|
|
265
|
+
/**
|
|
266
|
+
* Infer array element type from sampled elements
|
|
267
|
+
*/
|
|
268
|
+
function inferArrayType(ctx, arrayValue) {
|
|
269
|
+
const { nestedTypeName } = ctx;
|
|
270
|
+
if (arrayValue.length === 0) {
|
|
271
|
+
return { type: "unknown[]", optional: true };
|
|
272
|
+
}
|
|
273
|
+
// Sample multiple elements for better type inference
|
|
274
|
+
const elementTypes = new Set();
|
|
275
|
+
const elementTypeProps = [];
|
|
276
|
+
const sampleSize = Math.min(arrayValue.length, 3);
|
|
277
|
+
for (let i = 0; i < sampleSize; i++) {
|
|
278
|
+
const elementType = convertValueToProperty({
|
|
279
|
+
value: arrayValue[i],
|
|
280
|
+
nestedTypeName,
|
|
281
|
+
});
|
|
282
|
+
elementTypes.add(elementType.type);
|
|
283
|
+
elementTypeProps.push(elementType);
|
|
284
|
+
}
|
|
285
|
+
// If all elements have the same type, use that
|
|
286
|
+
if (elementTypes.size === 1) {
|
|
287
|
+
return inferUniformArrayType(ctx, elementTypes, elementTypeProps);
|
|
288
|
+
}
|
|
289
|
+
// If mixed types, use union type for common cases
|
|
290
|
+
const types = [...elementTypes].toSorted();
|
|
291
|
+
if (types.length <= 3 &&
|
|
292
|
+
types.every((t) => ["string", "number", "boolean"].includes(t))) {
|
|
293
|
+
return { type: `(${types.join(" | ")})[]`, optional: true };
|
|
294
|
+
}
|
|
295
|
+
return { type: "unknown[]", optional: true };
|
|
296
|
+
}
|
|
297
|
+
/**
|
|
298
|
+
* Build TypeProperty for a uniform-type array
|
|
299
|
+
*/
|
|
300
|
+
function inferUniformArrayType(ctx, elementTypes, elementTypeProps) {
|
|
301
|
+
const { nestedTypeName, chartName, fullKey, propertyName, yamlComment } = ctx;
|
|
302
|
+
const elementType = [...elementTypes][0];
|
|
303
|
+
const elementProp = elementTypeProps[0];
|
|
304
|
+
if (elementType === "" || !elementProp || elementType == null) {
|
|
305
|
+
return { type: "unknown[]", optional: true };
|
|
306
|
+
}
|
|
307
|
+
if (elementProp.nested) {
|
|
308
|
+
const arrayElementTypeName = `${nestedTypeName}Element`;
|
|
309
|
+
const allowArbitraryProps = chartName !== "" && fullKey !== "" && chartName != null && fullKey != null
|
|
310
|
+
? shouldAllowArbitraryProps(fullKey, chartName, propertyName ?? "", yamlComment)
|
|
311
|
+
: false;
|
|
312
|
+
const arrayElementInterface = {
|
|
313
|
+
name: arrayElementTypeName,
|
|
314
|
+
properties: elementProp.nested.properties,
|
|
315
|
+
allowArbitraryProps,
|
|
316
|
+
};
|
|
317
|
+
return {
|
|
318
|
+
type: `${arrayElementTypeName}[]`,
|
|
319
|
+
optional: true,
|
|
320
|
+
nested: arrayElementInterface,
|
|
321
|
+
};
|
|
322
|
+
}
|
|
323
|
+
return { type: `${elementType}[]`, optional: true };
|
|
324
|
+
}
|
|
325
|
+
function convertValueToProperty(opts) {
|
|
326
|
+
const { value, nestedTypeName, schema, propertyName, yamlComment, yamlComments, fullKey, chartName, } = opts;
|
|
327
|
+
// If we have a JSON schema for this property, prefer it over inference
|
|
328
|
+
if (schema) {
|
|
329
|
+
return convertWithSchema({ ...opts, schema });
|
|
330
|
+
}
|
|
331
|
+
// Check for null/undefined first
|
|
332
|
+
if (NullSchema.safeParse(value).success ||
|
|
333
|
+
UndefinedSchema.safeParse(value).success) {
|
|
334
|
+
return { type: "unknown", optional: true };
|
|
335
|
+
}
|
|
336
|
+
// Well-known Kubernetes fields (resources, nodeSelector, tolerations,
|
|
337
|
+
// affinity) have an API-defined shape. Inferring them from a chart's default
|
|
338
|
+
// subset produces types that are too narrow (e.g. resources.requests that
|
|
339
|
+
// only allow cpu). Emit the canonical permissive type instead — but only
|
|
340
|
+
// when the default value's shape is compatible, so RBAC `resources:
|
|
341
|
+
// ["secrets"]` arrays stay arrays.
|
|
342
|
+
if (propertyName !== "" && propertyName != null) {
|
|
343
|
+
const wellKnown = getWellKnownK8sFieldType(propertyName, value);
|
|
344
|
+
if (wellKnown) {
|
|
345
|
+
return {
|
|
346
|
+
type: wellKnown.type,
|
|
347
|
+
optional: true,
|
|
348
|
+
description: yamlComment ?? wellKnown.description,
|
|
349
|
+
};
|
|
350
|
+
}
|
|
351
|
+
}
|
|
352
|
+
// Check for array (before coercion checks)
|
|
353
|
+
const arrayResult = ArraySchema.safeParse(value);
|
|
354
|
+
if (arrayResult.success) {
|
|
355
|
+
return inferArrayType(opts, arrayResult.data);
|
|
356
|
+
}
|
|
357
|
+
// Check for object (before primitive coercion checks)
|
|
358
|
+
const objectResult = HelmValueSchema.safeParse(value);
|
|
359
|
+
if (objectResult.success) {
|
|
360
|
+
const nestedInterface = convertToTypeScriptInterface({
|
|
361
|
+
values: objectResult.data,
|
|
362
|
+
interfaceName: nestedTypeName,
|
|
363
|
+
yamlComments,
|
|
364
|
+
keyPrefix: fullKey,
|
|
365
|
+
chartName,
|
|
366
|
+
});
|
|
367
|
+
return {
|
|
368
|
+
type: nestedTypeName,
|
|
369
|
+
optional: true,
|
|
370
|
+
nested: nestedInterface,
|
|
371
|
+
description: yamlComment,
|
|
372
|
+
default: value,
|
|
373
|
+
};
|
|
374
|
+
}
|
|
375
|
+
// Infer primitive type from runtime value
|
|
376
|
+
return inferPrimitiveType(value, yamlComment);
|
|
377
|
+
}
|
|
378
|
+
//# sourceMappingURL=type-converter.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"type-converter.js","sourceRoot":"","sources":["../src/type-converter.ts"],"names":[],"mappings":"AAMA,OAAO,EACL,YAAY,EACZ,UAAU,EACV,eAAe,EACf,WAAW,EACX,eAAe,EACf,mBAAmB,EACnB,kBAAkB,EAClB,mBAAmB,GACpB,MAAM,cAAc,CAAC;AACtB,OAAO,EACL,yBAAyB,EACzB,wBAAwB,GACzB,MAAM,aAAa,CAAC;AACrB,OAAO,EACL,oBAAoB,EACpB,gBAAgB,EAChB,eAAe,GAChB,MAAM,YAAY,CAAC;AAEpB,OAAO,EACL,iBAAiB,EACjB,kBAAkB,GACnB,MAAM,6BAA6B,CAAC;AAErC;;GAEG;AACH,MAAM,UAAU,sBAAsB,CAAC,MAA0B;IAC/D,gCAAgC;IAChC,IAAI,MAAM,CAAC,KAAK,EAAE,CAAC;QACjB,MAAM,KAAK,GAAG,MAAM,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,sBAAsB,CAAC,CAAC,CAAC,CAAC,CAAC;QACjE,OAAO,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,CAA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,QAAQ,EAAE,IAAI;YACd,MAAM,EAAE,eAAe;YACvB,WAAW,EAAE,WAAW;YACxB,OAAO,EAAE,KAAK;SACf,CAAC;IACJ,CAAC;IAED,0CAA0C;IAC1C,OAAO,kBAAkB,CAAC,KAAK,EAAE,WAAW,CAAC,CAAC;AAChD,CAAC"}
|
package/dist/types.d.ts
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
export type ChartInfo = {
|
|
2
|
+
name: string;
|
|
3
|
+
repoUrl: string;
|
|
4
|
+
version: string;
|
|
5
|
+
chartName: string;
|
|
6
|
+
oci?: boolean;
|
|
7
|
+
};
|
|
8
|
+
export type JSONSchemaProperty = {
|
|
9
|
+
type?: string | string[];
|
|
10
|
+
enum?: unknown[];
|
|
11
|
+
oneOf?: JSONSchemaProperty[];
|
|
12
|
+
anyOf?: JSONSchemaProperty[];
|
|
13
|
+
items?: JSONSchemaProperty;
|
|
14
|
+
properties?: Record<string, JSONSchemaProperty>;
|
|
15
|
+
required?: string[];
|
|
16
|
+
description?: string;
|
|
17
|
+
default?: unknown;
|
|
18
|
+
};
|
|
19
|
+
export type TypeScriptInterface = {
|
|
20
|
+
name: string;
|
|
21
|
+
properties: Record<string, TypeProperty>;
|
|
22
|
+
/**
|
|
23
|
+
* If true, add an index signature to allow arbitrary additional properties
|
|
24
|
+
* Useful for config maps, arbitrary key-value stores, etc.
|
|
25
|
+
*/
|
|
26
|
+
allowArbitraryProps?: boolean;
|
|
27
|
+
};
|
|
28
|
+
export type TypeProperty = {
|
|
29
|
+
type: string;
|
|
30
|
+
optional: boolean;
|
|
31
|
+
description?: string;
|
|
32
|
+
default?: unknown;
|
|
33
|
+
nested?: TypeScriptInterface;
|
|
34
|
+
};
|
|
35
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAEA,MAAM,MAAM,SAAS,GAAG;IACtB,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,MAAM,CAAC;IAChB,SAAS,EAAE,MAAM,CAAC;IAGlB,GAAG,CAAC,EAAE,OAAO,CAAC;CACf,CAAC;AAEF,MAAM,MAAM,kBAAkB,GAAG;IAC/B,IAAI,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC;IACzB,IAAI,CAAC,EAAE,OAAO,EAAE,CAAC;IACjB,KAAK,CAAC,EAAE,kBAAkB,EAAE,CAAC;IAC7B,KAAK,CAAC,EAAE,kBAAkB,EAAE,CAAC;IAC7B,KAAK,CAAC,EAAE,kBAAkB,CAAC;IAC3B,UAAU,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,kBAAkB,CAAC,CAAC;IAChD,QAAQ,CAAC,EAAE,MAAM,EAAE,CAAC;IACpB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB,CAAC;AAEF,MAAM,MAAM,mBAAmB,GAAG;IAChC,IAAI,EAAE,MAAM,CAAC;IACb,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,YAAY,CAAC,CAAC;IACzC;;;OAGG;IACH,mBAAmB,CAAC,EAAE,OAAO,CAAC;CAC/B,CAAC;AAEF,MAAM,MAAM,YAAY,GAAG;IACzB,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,OAAO,CAAC;IAClB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,MAAM,CAAC,EAAE,mBAAmB,CAAC;CAC9B,CAAC"}
|
package/dist/types.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,uDAAuD"}
|
package/dist/utils.d.ts
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Utility functions for Helm type generation
|
|
3
|
+
*/
|
|
4
|
+
/**
|
|
5
|
+
* Sanitize property names for TypeScript interfaces
|
|
6
|
+
* Handles special characters, reserved keywords, and invalid syntax
|
|
7
|
+
*/
|
|
8
|
+
export declare function sanitizePropertyName(key: string): string;
|
|
9
|
+
/**
|
|
10
|
+
* Sanitize type names by removing invalid characters and normalizing
|
|
11
|
+
*/
|
|
12
|
+
export declare function sanitizeTypeName(key: string): string;
|
|
13
|
+
/**
|
|
14
|
+
* Capitalize the first letter of a string
|
|
15
|
+
*/
|
|
16
|
+
export declare function capitalizeFirst(str: string): string;
|
|
17
|
+
//# sourceMappingURL=utils.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH;;;GAGG;AACH,wBAAgB,oBAAoB,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAgDxD;AAED;;GAEG;AACH,wBAAgB,gBAAgB,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAOpD;AAED;;GAEG;AACH,wBAAgB,eAAe,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAEnD"}
|
package/dist/utils.js
ADDED
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Utility functions for Helm type generation
|
|
3
|
+
*/
|
|
4
|
+
/**
|
|
5
|
+
* Sanitize property names for TypeScript interfaces
|
|
6
|
+
* Handles special characters, reserved keywords, and invalid syntax
|
|
7
|
+
*/
|
|
8
|
+
export function sanitizePropertyName(key) {
|
|
9
|
+
// TypeScript reserved keywords that need quoting
|
|
10
|
+
const reservedKeywords = new Set([
|
|
11
|
+
"break",
|
|
12
|
+
"case",
|
|
13
|
+
"catch",
|
|
14
|
+
"class",
|
|
15
|
+
"const",
|
|
16
|
+
"continue",
|
|
17
|
+
"debugger",
|
|
18
|
+
"default",
|
|
19
|
+
"delete",
|
|
20
|
+
"do",
|
|
21
|
+
"else",
|
|
22
|
+
"enum",
|
|
23
|
+
"export",
|
|
24
|
+
"extends",
|
|
25
|
+
"false",
|
|
26
|
+
"finally",
|
|
27
|
+
"for",
|
|
28
|
+
"function",
|
|
29
|
+
"if",
|
|
30
|
+
"import",
|
|
31
|
+
"in",
|
|
32
|
+
"instanceof",
|
|
33
|
+
"new",
|
|
34
|
+
"null",
|
|
35
|
+
"return",
|
|
36
|
+
"super",
|
|
37
|
+
"switch",
|
|
38
|
+
"this",
|
|
39
|
+
"throw",
|
|
40
|
+
"true",
|
|
41
|
+
"try",
|
|
42
|
+
"typeof",
|
|
43
|
+
"var",
|
|
44
|
+
"void",
|
|
45
|
+
"while",
|
|
46
|
+
"with",
|
|
47
|
+
]);
|
|
48
|
+
// Check if key needs quoting
|
|
49
|
+
const needsQuoting = reservedKeywords.has(key) ||
|
|
50
|
+
/[^\w$]/.test(key) || // Contains special characters
|
|
51
|
+
/^\d/.test(key); // Starts with digit
|
|
52
|
+
return needsQuoting ? `"${key}"` : key;
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* Sanitize type names by removing invalid characters and normalizing
|
|
56
|
+
*/
|
|
57
|
+
export function sanitizeTypeName(key) {
|
|
58
|
+
return (key
|
|
59
|
+
.replaceAll(/[^a-z0-9]/gi, "") // Remove all special characters
|
|
60
|
+
.replace(/^\d+/, "") || // Remove leading digits
|
|
61
|
+
"Property"); // Fallback if empty
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* Capitalize the first letter of a string
|
|
65
|
+
*/
|
|
66
|
+
export function capitalizeFirst(str) {
|
|
67
|
+
return str.charAt(0).toUpperCase() + str.slice(1);
|
|
68
|
+
}
|
|
69
|
+
//# sourceMappingURL=utils.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH;;;GAGG;AACH,MAAM,UAAU,oBA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|
|
1
|
+
/**
|
|
2
|
+
* Filter out commented-out YAML blocks from the START of a comment string
|
|
3
|
+
* The YAML AST gives us ALL comments, including commented-out config sections
|
|
4
|
+
* We only remove these if they appear BEFORE the real documentation starts
|
|
5
|
+
*/
|
|
6
|
+
export declare function filterCommentedOutYAML(comment: string): string;
|
|
7
|
+
//# sourceMappingURL=yaml-comment-filters.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"yaml-comment-filters.d.ts","sourceRoot":"","sources":["../src/yaml-comment-filters.ts"],"names":[],"mappings":"AAkCA;;;;GAIG;AACH,wBAAgB,sBAAsB,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CA+D9D"}
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
import { isYAMLKey } from "./yaml-comments.js";
|
|
2
|
+
/**
|
|
3
|
+
* Helper: Check if a line is part of a commented YAML block
|
|
4
|
+
*/
|
|
5
|
+
function isPartOfYAMLBlock(line, trimmed) {
|
|
6
|
+
return (line.startsWith(" ") ||
|
|
7
|
+
line.startsWith("\t") ||
|
|
8
|
+
trimmed.startsWith("-") ||
|
|
9
|
+
trimmed.startsWith("#"));
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* Helper: Check if this is a section header followed by a YAML key
|
|
13
|
+
*/
|
|
14
|
+
function isSectionHeaderForCommentedBlock(nextLine) {
|
|
15
|
+
if (nextLine === "" || nextLine == null) {
|
|
16
|
+
return false;
|
|
17
|
+
}
|
|
18
|
+
const nextTrimmed = nextLine.trim();
|
|
19
|
+
return /^[\w.-]+:\s*(?:\||$)/.test(nextTrimmed);
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Helper: Check if line indicates start of real documentation
|
|
23
|
+
*/
|
|
24
|
+
function isRealDocumentation(trimmed) {
|
|
25
|
+
return trimmed.startsWith("--") || trimmed.startsWith("#");
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Filter out commented-out YAML blocks from the START of a comment string
|
|
29
|
+
* The YAML AST gives us ALL comments, including commented-out config sections
|
|
30
|
+
* We only remove these if they appear BEFORE the real documentation starts
|
|
31
|
+
*/
|
|
32
|
+
export function filterCommentedOutYAML(comment) {
|
|
33
|
+
const lines = comment.split("\n");
|
|
34
|
+
let startIndex = 0;
|
|
35
|
+
let inCommentedBlock = false;
|
|
36
|
+
let hasSeenRealDoc = false;
|
|
37
|
+
// First pass: find where real documentation starts
|
|
38
|
+
for (let i = 0; i < lines.length; i++) {
|
|
39
|
+
const line = lines[i] ?? "";
|
|
40
|
+
const trimmed = line.trim();
|
|
41
|
+
// Blank line could be end of commented block
|
|
42
|
+
if (trimmed === "") {
|
|
43
|
+
if (inCommentedBlock) {
|
|
44
|
+
inCommentedBlock = false;
|
|
45
|
+
}
|
|
46
|
+
continue;
|
|
47
|
+
}
|
|
48
|
+
// Check if this looks like a commented-out YAML key
|
|
49
|
+
const looksLikeYAMLKeyLocal = isYAMLKey(trimmed);
|
|
50
|
+
if (looksLikeYAMLKeyLocal && !hasSeenRealDoc) {
|
|
51
|
+
// This starts a commented-out YAML block
|
|
52
|
+
inCommentedBlock = true;
|
|
53
|
+
continue;
|
|
54
|
+
}
|
|
55
|
+
// If we're in a commented block, check if this line is part of it
|
|
56
|
+
if (inCommentedBlock) {
|
|
57
|
+
if (isPartOfYAMLBlock(line, trimmed)) {
|
|
58
|
+
continue;
|
|
59
|
+
}
|
|
60
|
+
else {
|
|
61
|
+
// This line doesn't look like YAML content, we're out of the block
|
|
62
|
+
inCommentedBlock = false;
|
|
63
|
+
hasSeenRealDoc = true;
|
|
64
|
+
startIndex = i;
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
else if (!hasSeenRealDoc) {
|
|
68
|
+
const nextLine = lines[i + 1];
|
|
69
|
+
// Check if this is a section header for a commented-out block
|
|
70
|
+
if (isSectionHeaderForCommentedBlock(nextLine)) {
|
|
71
|
+
continue;
|
|
72
|
+
}
|
|
73
|
+
// Check if this line indicates real documentation
|
|
74
|
+
if (isRealDocumentation(trimmed)) {
|
|
75
|
+
hasSeenRealDoc = true;
|
|
76
|
+
startIndex = i;
|
|
77
|
+
}
|
|
78
|
+
else {
|
|
79
|
+
// First real prose line
|
|
80
|
+
hasSeenRealDoc = true;
|
|
81
|
+
startIndex = i;
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
// Return everything from where real documentation starts
|
|
86
|
+
return lines
|
|
87
|
+
.slice(startIndex)
|
|
88
|
+
.map((l) => l.trim())
|
|
89
|
+
.join("\n");
|
|
90
|
+
}
|
|
91
|
+
//# sourceMappingURL=yaml-comment-filters.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"yaml-comment-filters.js","sourceRoot":"","sources":["../src/yaml-comment-filters.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAE/C;;GAEG;AACH,SAAS,iBAAiB,CAAC,IAAY,EAAE,OAAe;IACtD,OAAO,CACL,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC;QACpB,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC;QACrB,OAAO,CAAC,UAAU,CAAC,GAAG,CAAC;QACvB,OAAO,CAAC,UAAU,CAAC,GAAG,CAAC,CACxB,CAAC;AACJ,CAAC;AAED;;GAEG;AACH,SAAS,gCAAgC,CACvC,QAA4B;IAE5B,IAAI,QAAQ,KAAK,EAAE,IAAI,QAAQ,IAAI,IAAI,EAAE,CAAC;QACxC,OAAO,KAAK,CAAC;IACf,CAAC;IACD,MAAM,WAAW,GAAG,QAAQ,CAAC,IAAI,EAAE,CAAC;IACpC,OAAO,sBAAsB,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC;AAClD,CAAC;AAED;;GAEG;AACH,SAAS,mBAAmB,CAAC,OAAe;IAC1C,OAAO,OAAO,CAAC,UAAU,CAAC,IAAI,CAAC,IAAI,OAAO,CAAC,UAAU,CAAC,GAAG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YAE9B,8DAA8D;YAC9D,IAAI,gCAAgC,CAAC,QAAQ,CAAC,EAAE,CAAC;gBAC/C,SAAS;YACX,CAAC;YAED,kDAAkD;YAClD,IAAI,mBAAmB,CAAC,OAAO,CAAC,EAAE,CAAC;gBACjC,cAAc,GAAG,IAAI,CAAC;gBACtB,UAAU,GAAG,CAAC,CAAC;YACjB,CAAC;iBAAM,CAAC;gBACN,wBAAwB;gBACxB,cAAc,GAAG,IAAI,CAAC;gBACtB,UAAU,GAAG,CAAC,CAAC;YACjB,CAAC;QACH,CAAC;IACH,CAAC;IAED,yDAAyD;IACzD,OAAO,KAAK;SACT,KAAK,CAAC,UAAU,CAAC;SACjB,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC;SACpB,IAAI,CAAC,IAAI,CAAC,CAAC;AAChB,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { CommentWithMetadata } from "./yaml-comments.js";
|
|
2
|
+
/**
|
|
3
|
+
* Regex-based fallback parser for comments that the YAML AST loses
|
|
4
|
+
* This handles cases with commented-out YAML keys and inconsistent indentation
|
|
5
|
+
* Returns comments with metadata for debugging
|
|
6
|
+
*/
|
|
7
|
+
export declare function parseCommentsWithRegex(yamlContent: string): Map<string, CommentWithMetadata>;
|
|
8
|
+
//# sourceMappingURL=yaml-comment-regex-parser.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"yaml-comment-regex-parser.d.ts","sourceRoot":"","sources":["../src/yaml-comment-regex-parser.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,oBAAoB,CAAC;AAE9D;;;;GAIG;AACH,wBAAgB,sBAAsB,CACpC,WAAW,EAAE,MAAM,GAClB,GAAG,CAAC,MAAM,EAAE,mBAAmB,CAAC,CA4IlC"}
|