timonel 3.1.0 → 3.1.1

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 CHANGED
@@ -1,3 +1,9 @@
1
+ ## [3.1.1](https://github.com/KenkoGeek/timonel/compare/v3.1.0...v3.1.1) (2026-03-15)
2
+
3
+ ### Bug Fixes
4
+
5
+ - **deps:** update dev and library deps ([8c1baa1](https://github.com/KenkoGeek/timonel/commit/8c1baa19c400c79d201af58f7d447a1938fa3f46))
6
+
1
7
  # [3.1.0](https://github.com/KenkoGeek/timonel/compare/v3.0.0...v3.1.0) (2026-01-10)
2
8
 
3
9
  ### Features
package/README.md CHANGED
@@ -735,7 +735,7 @@ The Policy Engine supports a rich ecosystem of plugins for various use cases:
735
735
  "types": "dist/index.d.ts",
736
736
  "keywords": ["timonel", "policy", "security", "kubernetes"],
737
737
  "peerDependencies": {
738
- "timonel": "^3.0.0"
738
+ "timonel": "^3.1.0"
739
739
  }
740
740
  }
741
741
 
@@ -787,13 +787,13 @@ policyEngine.invalidateCache({ all: true });
787
787
  Policy engine configuration options
788
788
  - **[Policy Examples](https://github.com/KenkoGeek/timonel/wiki/Policy-Examples)** - Example plugins
789
789
  and usage patterns
790
- - **[Examples](https://github.com/KenkoGeek/timonel/wiki/Examples)** - Real-world usage examples (Outdated)
790
+ - **[Examples](https://github.com/KenkoGeek/timonel/wiki/Examples)** - Real-world usage examples
791
791
  - **[Best Practices](https://github.com/KenkoGeek/timonel/wiki/Best-Practices)** - Recommended
792
792
  patterns and practices
793
793
  - **[Contributing](https://github.com/KenkoGeek/timonel/wiki/Contributing)** - Development setup
794
794
  and guidelines
795
795
  - **[Timonel Examples Repository](https://github.com/KenkoGeek/timonel-examples)** - Curated
796
- collection of ready-to-run Timonel sample projects
796
+ collection of ready-to-run Timonel sample projects (Outdated)
797
797
 
798
798
  ## 🔧 Troubleshooting
799
799
 
@@ -814,7 +814,7 @@ If you get `Error: Cannot find module 'cdk8s'` when running `tl umbrella synth`:
814
814
  "cdk8s": "^2.70.28",
815
815
  "cdk8s-plus-33": "^2.4.6",
816
816
  "constructs": "^10.4.3",
817
- "timonel": "^3.0.0-beta.1"
817
+ "timonel": "^3.1.0"
818
818
  },
819
819
  "devDependencies": {
820
820
  "@types/node": "^24.5.2",
@@ -75,7 +75,10 @@ export class Rutter {
75
75
  manifestObject = parse(yamlOrObject);
76
76
  }
77
77
  catch (error) {
78
- throw new Error(`Invalid YAML provided to addManifest(): ${error instanceof Error ? error.message : UNKNOWN_ERROR_MESSAGE}`);
78
+ const cause = error instanceof Error ? error : new Error(UNKNOWN_ERROR_MESSAGE);
79
+ const wrappedError = new Error(`Invalid YAML provided to addManifest(): ${error instanceof Error ? error.message : UNKNOWN_ERROR_MESSAGE}`);
80
+ wrappedError.cause = cause;
81
+ throw wrappedError;
79
82
  }
80
83
  }
81
84
  else if (typeof yamlOrObject === 'object' && yamlOrObject !== null) {
@@ -134,7 +137,10 @@ ${yamlContent.trim()}
134
137
  this.assets.push(conditionalAsset);
135
138
  }
136
139
  catch (error) {
137
- throw new Error(`Failed to generate conditional template for manifest '${id}': ${error instanceof Error ? error.message : UNKNOWN_ERROR_MESSAGE}`);
140
+ const cause = error instanceof Error ? error : new Error(UNKNOWN_ERROR_MESSAGE);
141
+ const wrappedError = new Error(`Failed to generate conditional template for manifest '${id}': ${error instanceof Error ? error.message : UNKNOWN_ERROR_MESSAGE}`);
142
+ wrappedError.cause = cause;
143
+ throw wrappedError;
138
144
  }
139
145
  return new ApiObject(this.chart, `${id}-placeholder`, {
140
146
  apiVersion: manifestObject['apiVersion'],
@@ -312,40 +312,36 @@ export function preprocessHelmConstructs(obj) {
312
312
  const isInline = value.options?.inline ?? false;
313
313
  if (!isInline && (ifData.else === undefined || !('else' in ifData))) {
314
314
  const preprocessedThen = preprocessHelmConstructs(ifData.then);
315
- let thenValueStr = '';
316
- let isMultilineObject = false;
317
- if (isHelmExpression(preprocessedThen)) {
318
- thenValueStr = preprocessedThen.value.trim();
319
- isMultilineObject = thenValueStr.includes('\n');
320
- }
321
- else if (typeof preprocessedThen === 'string') {
322
- thenValueStr = preprocessedThen.trim();
323
- isMultilineObject = thenValueStr.includes('\n');
324
- }
325
- else if (Array.isArray(preprocessedThen)) {
326
- const tempDoc = new Document(preprocessedThen);
327
- thenValueStr = tempDoc.toString({ lineWidth: 0 }).trim();
328
- isMultilineObject = true;
329
- }
330
- else {
315
+ const serializedThen = (() => {
316
+ if (isHelmExpression(preprocessedThen)) {
317
+ const valueStr = preprocessedThen.value.trim();
318
+ return { thenValueStr: valueStr, isMultilineObject: valueStr.includes('\n') };
319
+ }
320
+ if (typeof preprocessedThen === 'string') {
321
+ const valueStr = preprocessedThen.trim();
322
+ return { thenValueStr: valueStr, isMultilineObject: valueStr.includes('\n') };
323
+ }
331
324
  const tempDoc = new Document(preprocessedThen);
332
- thenValueStr = tempDoc.toString({ lineWidth: 0 }).trim();
333
- isMultilineObject = thenValueStr.includes('\n');
334
- }
325
+ const valueStr = tempDoc.toString({ lineWidth: 0 }).trim();
326
+ return {
327
+ thenValueStr: valueStr,
328
+ isMultilineObject: Array.isArray(preprocessedThen) || valueStr.includes('\n'),
329
+ };
330
+ })();
335
331
  const constructOptions = isHelmConstruct(value) ? value.options : undefined;
336
332
  const trimLeft = constructOptions?.trimLeft ?? true;
337
333
  const openTag = `{{${trimLeft ? '-' : ''} `;
338
334
  const closeTag = ` ${(constructOptions?.trimRight ?? true) ? '-' : ''}}}`;
339
335
  let formattedContent;
340
- if (isMultilineObject) {
341
- const indentedValue = thenValueStr
336
+ if (serializedThen.isMultilineObject) {
337
+ const indentedValue = serializedThen.thenValueStr
342
338
  .split('\n')
343
339
  .map((line) => ' ' + line)
344
340
  .join('\n');
345
341
  formattedContent = `${key}:\n${indentedValue}`;
346
342
  }
347
343
  else {
348
- formattedContent = `${key}: ${thenValueStr}`;
344
+ formattedContent = `${key}: ${serializedThen.thenValueStr}`;
349
345
  }
350
346
  const conditionalTemplate = `${openTag}if ${ifData.condition}${closeTag}\n ${formattedContent}\n${openTag}end${closeTag}`;
351
347
  result[key] = createHelmExpression(`__FIELD_CONDITIONAL__:${key}:${conditionalTemplate}`);
@@ -374,17 +370,11 @@ export function preprocessHelmConstructs(obj) {
374
370
  if (isHelmConstruct(value) && value.type === 'fieldConditional') {
375
371
  const fieldData = value.data;
376
372
  const preprocessedThen = preprocessHelmConstructs(fieldData.then);
377
- let thenValueStr = '';
378
- if (isHelmExpression(preprocessedThen)) {
379
- thenValueStr = preprocessedThen.value;
380
- }
381
- else if (typeof preprocessedThen === 'string') {
382
- thenValueStr = preprocessedThen;
383
- }
384
- else {
385
- const tempDoc = new Document(preprocessedThen);
386
- thenValueStr = tempDoc.toString({ lineWidth: 0 }).trim();
387
- }
373
+ const thenValueStr = isHelmExpression(preprocessedThen)
374
+ ? preprocessedThen.value
375
+ : typeof preprocessedThen === 'string'
376
+ ? preprocessedThen
377
+ : new Document(preprocessedThen).toString({ lineWidth: 0 }).trim();
388
378
  const conditionalTemplate = `{{- if ${fieldData.condition} }}\n ${fieldData.fieldKey}: ${thenValueStr}\n{{- end }}`;
389
379
  result[`__fieldConditionalTemplate_${fieldData.fieldKey}`] = conditionalTemplate;
390
380
  continue;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "timonel",
3
3
  "type": "module",
4
- "version": "3.1.0",
4
+ "version": "3.1.1",
5
5
  "description": "Timonel: programmatic Helm chart generator using cdk8s (TypeScript)",
6
6
  "bin": {
7
7
  "timonel": "dist/cli.js",
@@ -102,43 +102,43 @@
102
102
  ]
103
103
  },
104
104
  "dependencies": {
105
- "cdk8s": "^2.70.42",
106
- "cdk8s-plus-33": "^2.4.19",
107
- "constructs": "^10.4.4",
105
+ "cdk8s": "^2.70.51",
106
+ "cdk8s-plus-33": "^2.4.37",
107
+ "constructs": "^10.5.1",
108
108
  "handlebars": "^4.7.8",
109
- "pino": "^10.1.1",
109
+ "pino": "^10.3.1",
110
110
  "pino-pretty": "^13.1.3",
111
111
  "ts-node": "^10.9.2",
112
112
  "yaml": "^2.8.2"
113
113
  },
114
114
  "devDependencies": {
115
- "@commitlint/cli": "^20.3.1",
116
- "@commitlint/config-conventional": "^20.3.1",
117
- "@eslint/js": "^9.39.2",
115
+ "@commitlint/cli": "^20.5.0",
116
+ "@commitlint/config-conventional": "^20.5.0",
117
+ "@eslint/js": "^10.0.1",
118
118
  "@semantic-release/changelog": "^6.0.3",
119
119
  "@semantic-release/exec": "^7.1.0",
120
120
  "@semantic-release/git": "^10.0.1",
121
- "@types/node": "^25.0.5",
122
- "@typescript-eslint/eslint-plugin": "^8.52.0",
123
- "@typescript-eslint/parser": "^8.52.0",
124
- "@vitest/coverage-v8": "^4.0.16",
121
+ "@types/node": "^25.5.0",
122
+ "@typescript-eslint/eslint-plugin": "^8.57.0",
123
+ "@typescript-eslint/parser": "^8.57.0",
124
+ "@vitest/coverage-v8": "^4.1.0",
125
125
  "conventional-changelog-cli": "^5.0.0",
126
- "eslint": "^9.39.2",
126
+ "eslint": "^10.0.3",
127
127
  "eslint-config-prettier": "^10.1.8",
128
128
  "eslint-import-resolver-typescript": "^4.4.4",
129
129
  "eslint-plugin-import": "^2.32.0",
130
- "eslint-plugin-security": "^3.0.1",
131
- "eslint-plugin-sonarjs": "^3.0.5",
132
- "eslint-plugin-unused-imports": "^4.3.0",
130
+ "eslint-plugin-security": "^4.0.0",
131
+ "eslint-plugin-sonarjs": "^4.0.2",
132
+ "eslint-plugin-unused-imports": "^4.4.1",
133
133
  "husky": "^9.1.7",
134
- "lint-staged": "^16.2.7",
134
+ "lint-staged": "^16.4.0",
135
135
  "markdownlint": "^0.40.0",
136
- "markdownlint-cli": "^0.47.0",
137
- "prettier": "^3.7.4",
138
- "semantic-release": "^25.0.2",
136
+ "markdownlint-cli": "^0.48.0",
137
+ "prettier": "^3.8.1",
138
+ "semantic-release": "^25.0.3",
139
139
  "tsx": "^4.21.0",
140
140
  "typescript": "^5.9.3",
141
- "vitest": "^4.0.16"
141
+ "vitest": "^4.1.0"
142
142
  },
143
143
  "files": [
144
144
  "dist",