refactor: project structure and update configurations

This commit is contained in:
Lucàs
2025-07-14 13:18:40 +02:00
parent 4744dce006
commit f0bc58cdd6
27 changed files with 775 additions and 82 deletions
+46
View File
@@ -0,0 +1,46 @@
import { type Parser, ParserType } from '.';
import { parse } from 'yaml';
/**
* YamlParser class implements the Parser interface for parsing YAML data.
*/
export class YamlParser implements Parser {
/**
* The type of the parser.
* This is used to identify the parser type in the system.
*/
static readonly TYPE: ParserType = ParserType.YAML;
/**
* Singleton instance of the parser.
* This ensures that only one instance of the parser exists.
*/
static instance?: YamlParser;
private constructor() {}
/**
* @inheritdoc
*/
public static getInstance(): YamlParser {
if (!this.instance) {
this.instance = new YamlParser();
}
return this.instance;
}
getInstance(): Parser {
throw new Error('Method not implemented.');
}
/**
* @inheritdoc
*/
public parse(data: string): object {
try {
return parse(data);
} catch (error) {
throw new Error('Failed to parse YAML data', { cause: error });
}
}
}