@vfarcic/dot-ai 0.34.0 → 0.35.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.
|
@@ -9,6 +9,12 @@ export declare function extractUserAnswers(solution: any): Record<string, any>;
|
|
|
9
9
|
* Sanitize intent string for use as Kubernetes label (63 char limit, alphanumeric + hyphens)
|
|
10
10
|
*/
|
|
11
11
|
export declare function sanitizeIntentForLabel(intent: string): string;
|
|
12
|
+
/**
|
|
13
|
+
* Sanitize string for use as Kubernetes resource name (RFC 1123 subdomain)
|
|
14
|
+
* Names must be lowercase alphanumeric characters, hyphens, or periods
|
|
15
|
+
* Must start and end with alphanumeric character, max 63 characters
|
|
16
|
+
*/
|
|
17
|
+
export declare function sanitizeKubernetesName(name: string): string;
|
|
12
18
|
/**
|
|
13
19
|
* Generate standard dot-ai labels for Kubernetes resources
|
|
14
20
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"solution-utils.d.ts","sourceRoot":"","sources":["../../src/core/solution-utils.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH;;GAEG;AACH,wBAAgB,kBAAkB,CAAC,QAAQ,EAAE,GAAG,GAAG,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAoBrE;AAED;;GAEG;AACH,wBAAgB,sBAAsB,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAM7D;AAED;;GAEG;AACH,wBAAgB,mBAAmB,CAAC,WAAW,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,EAAE,QAAQ,EAAE,GAAG,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAiB3G;AAED;;GAEG;AACH,wBAAgB,cAAc,CAC5B,cAAc,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,SAAS,EAClD,WAAW,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,EAChC,QAAQ,EAAE,GAAG,GACZ,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAGxB"}
|
|
1
|
+
{"version":3,"file":"solution-utils.d.ts","sourceRoot":"","sources":["../../src/core/solution-utils.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH;;GAEG;AACH,wBAAgB,kBAAkB,CAAC,QAAQ,EAAE,GAAG,GAAG,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAoBrE;AAED;;GAEG;AACH,wBAAgB,sBAAsB,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAM7D;AAED;;;;GAIG;AACH,wBAAgB,sBAAsB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAwB3D;AAED;;GAEG;AACH,wBAAgB,mBAAmB,CAAC,WAAW,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,EAAE,QAAQ,EAAE,GAAG,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAiB3G;AAED;;GAEG;AACH,wBAAgB,cAAc,CAC5B,cAAc,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,SAAS,EAClD,WAAW,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,EAChC,QAAQ,EAAE,GAAG,GACZ,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAGxB"}
|
|
@@ -5,6 +5,7 @@
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.extractUserAnswers = extractUserAnswers;
|
|
7
7
|
exports.sanitizeIntentForLabel = sanitizeIntentForLabel;
|
|
8
|
+
exports.sanitizeKubernetesName = sanitizeKubernetesName;
|
|
8
9
|
exports.generateDotAiLabels = generateDotAiLabels;
|
|
9
10
|
exports.addDotAiLabels = addDotAiLabels;
|
|
10
11
|
/**
|
|
@@ -38,6 +39,31 @@ function sanitizeIntentForLabel(intent) {
|
|
|
38
39
|
.substring(0, 63)
|
|
39
40
|
.replace(/^-+|-+$/g, '');
|
|
40
41
|
}
|
|
42
|
+
/**
|
|
43
|
+
* Sanitize string for use as Kubernetes resource name (RFC 1123 subdomain)
|
|
44
|
+
* Names must be lowercase alphanumeric characters, hyphens, or periods
|
|
45
|
+
* Must start and end with alphanumeric character, max 63 characters
|
|
46
|
+
*/
|
|
47
|
+
function sanitizeKubernetesName(name) {
|
|
48
|
+
if (!name) {
|
|
49
|
+
return 'default-name';
|
|
50
|
+
}
|
|
51
|
+
let sanitized = name
|
|
52
|
+
.toLowerCase()
|
|
53
|
+
.replace(/[^a-z0-9.-]/g, '-') // Replace invalid chars with hyphens
|
|
54
|
+
.substring(0, 63); // Enforce max length
|
|
55
|
+
// Remove leading/trailing dots or hyphens
|
|
56
|
+
sanitized = sanitized.replace(/^[.-]+|[.-]+$/g, '');
|
|
57
|
+
// Ensure starts with alphanumeric
|
|
58
|
+
if (sanitized && !/^[a-z0-9]/.test(sanitized)) {
|
|
59
|
+
sanitized = 'a' + sanitized.substring(1);
|
|
60
|
+
}
|
|
61
|
+
// Ensure ends with alphanumeric
|
|
62
|
+
if (sanitized && !/[a-z0-9]$/.test(sanitized)) {
|
|
63
|
+
sanitized = sanitized.substring(0, sanitized.length - 1) + 'z';
|
|
64
|
+
}
|
|
65
|
+
return sanitized || 'default-name';
|
|
66
|
+
}
|
|
41
67
|
/**
|
|
42
68
|
* Generate standard dot-ai labels for Kubernetes resources
|
|
43
69
|
*/
|
|
@@ -297,7 +297,7 @@ function generateMetadataConfigMap(solution, userAnswers, logger) {
|
|
|
297
297
|
apiVersion: 'v1',
|
|
298
298
|
kind: 'ConfigMap',
|
|
299
299
|
metadata: {
|
|
300
|
-
name: `dot-ai-app-${appName}-${solutionId}
|
|
300
|
+
name: (0, solution_utils_1.sanitizeKubernetesName)(`dot-ai-app-${appName}-${solutionId}`),
|
|
301
301
|
namespace: namespace,
|
|
302
302
|
labels: dotAiLabels,
|
|
303
303
|
annotations: {
|