md2cv 1.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 +19 -0
- package/LICENSE +674 -0
- package/README.md +219 -0
- package/dist/bin.d.ts +6 -0
- package/dist/bin.d.ts.map +1 -0
- package/dist/bin.js +10 -0
- package/dist/bin.js.map +1 -0
- package/dist/cli/index.d.ts +50 -0
- package/dist/cli/index.d.ts.map +1 -0
- package/dist/cli/index.js +278 -0
- package/dist/cli/index.js.map +1 -0
- package/dist/generator/index.d.ts +36 -0
- package/dist/generator/index.d.ts.map +1 -0
- package/dist/generator/index.js +302 -0
- package/dist/generator/index.js.map +1 -0
- package/dist/generator/resume_en.d.ts +22 -0
- package/dist/generator/resume_en.d.ts.map +1 -0
- package/dist/generator/resume_en.js +524 -0
- package/dist/generator/resume_en.js.map +1 -0
- package/dist/generator/resume_ja.d.ts +22 -0
- package/dist/generator/resume_ja.d.ts.map +1 -0
- package/dist/generator/resume_ja.js +440 -0
- package/dist/generator/resume_ja.js.map +1 -0
- package/dist/generator/rirekisho/components.d.ts +83 -0
- package/dist/generator/rirekisho/components.d.ts.map +1 -0
- package/dist/generator/rirekisho/components.js +405 -0
- package/dist/generator/rirekisho/components.js.map +1 -0
- package/dist/generator/rirekisho/data.d.ts +18 -0
- package/dist/generator/rirekisho/data.d.ts.map +1 -0
- package/dist/generator/rirekisho/data.js +274 -0
- package/dist/generator/rirekisho/data.js.map +1 -0
- package/dist/generator/rirekisho/index.d.ts +20 -0
- package/dist/generator/rirekisho/index.d.ts.map +1 -0
- package/dist/generator/rirekisho/index.js +67 -0
- package/dist/generator/rirekisho/index.js.map +1 -0
- package/dist/generator/rirekisho/layout.d.ts +20 -0
- package/dist/generator/rirekisho/layout.d.ts.map +1 -0
- package/dist/generator/rirekisho/layout.js +354 -0
- package/dist/generator/rirekisho/layout.js.map +1 -0
- package/dist/generator/rirekisho/styles.d.ts +9 -0
- package/dist/generator/rirekisho/styles.d.ts.map +1 -0
- package/dist/generator/rirekisho/styles.js +362 -0
- package/dist/generator/rirekisho/styles.js.map +1 -0
- package/dist/generator/rirekisho/types.d.ts +163 -0
- package/dist/generator/rirekisho/types.d.ts.map +1 -0
- package/dist/generator/rirekisho/types.js +80 -0
- package/dist/generator/rirekisho/types.js.map +1 -0
- package/dist/index.d.ts +10 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +10 -0
- package/dist/index.js.map +1 -0
- package/dist/parser/index.d.ts +21 -0
- package/dist/parser/index.d.ts.map +1 -0
- package/dist/parser/index.js +639 -0
- package/dist/parser/index.js.map +1 -0
- package/dist/types/config.d.ts +64 -0
- package/dist/types/config.d.ts.map +1 -0
- package/dist/types/config.js +5 -0
- package/dist/types/config.js.map +1 -0
- package/dist/types/errors.d.ts +78 -0
- package/dist/types/errors.d.ts.map +1 -0
- package/dist/types/errors.js +146 -0
- package/dist/types/errors.js.map +1 -0
- package/dist/types/index.d.ts +9 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/types/index.js +9 -0
- package/dist/types/index.js.map +1 -0
- package/dist/types/metadata.d.ts +55 -0
- package/dist/types/metadata.d.ts.map +1 -0
- package/dist/types/metadata.js +136 -0
- package/dist/types/metadata.js.map +1 -0
- package/dist/types/result.d.ts +50 -0
- package/dist/types/result.d.ts.map +1 -0
- package/dist/types/result.js +74 -0
- package/dist/types/result.js.map +1 -0
- package/dist/types/sections.d.ts +168 -0
- package/dist/types/sections.d.ts.map +1 -0
- package/dist/types/sections.js +122 -0
- package/dist/types/sections.js.map +1 -0
- package/dist/validator/index.d.ts +20 -0
- package/dist/validator/index.d.ts.map +1 -0
- package/dist/validator/index.js +67 -0
- package/dist/validator/index.js.map +1 -0
- package/examples/example-cv-en.md +77 -0
- package/examples/example-cv-ja.md +116 -0
- package/examples/sample-photo.png +0 -0
- package/package.json +93 -0
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Configuration types for CLI and frontmatter
|
|
3
|
+
*/
|
|
4
|
+
/**
|
|
5
|
+
* Output format types
|
|
6
|
+
*/
|
|
7
|
+
export type OutputFormat = 'cv' | 'rirekisho' | 'both';
|
|
8
|
+
export type OutputType = 'html' | 'pdf' | 'both';
|
|
9
|
+
export type PaperSize = 'a3' | 'a4' | 'b4' | 'b5' | 'letter';
|
|
10
|
+
export type LogFormat = 'json' | 'text';
|
|
11
|
+
/**
|
|
12
|
+
* Chronological order for history entries
|
|
13
|
+
* - asc: oldest first (default for rirekisho)
|
|
14
|
+
* - desc: newest first (default for CV)
|
|
15
|
+
*/
|
|
16
|
+
export type ChronologicalOrder = 'asc' | 'desc';
|
|
17
|
+
/**
|
|
18
|
+
* CLI options parsed from command line
|
|
19
|
+
*/
|
|
20
|
+
export interface CLIOptions {
|
|
21
|
+
readonly input: string;
|
|
22
|
+
readonly output: string | undefined;
|
|
23
|
+
readonly format: OutputFormat;
|
|
24
|
+
readonly outputType: OutputType;
|
|
25
|
+
readonly paperSize: PaperSize | undefined;
|
|
26
|
+
readonly config: string | undefined;
|
|
27
|
+
readonly debug: boolean;
|
|
28
|
+
readonly logFormat: LogFormat;
|
|
29
|
+
readonly chronologicalOrder: ChronologicalOrder | undefined;
|
|
30
|
+
readonly hideMotivation: boolean;
|
|
31
|
+
readonly photo: string | undefined;
|
|
32
|
+
readonly sectionOrder: string | undefined;
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Configuration file schema (JSON or YAML)
|
|
36
|
+
*/
|
|
37
|
+
export interface ConfigFile {
|
|
38
|
+
readonly format?: OutputFormat;
|
|
39
|
+
readonly outputType?: OutputType;
|
|
40
|
+
readonly paperSize?: PaperSize;
|
|
41
|
+
readonly output?: string;
|
|
42
|
+
readonly logFormat?: LogFormat;
|
|
43
|
+
readonly chronologicalOrder?: ChronologicalOrder;
|
|
44
|
+
readonly hideMotivation?: boolean;
|
|
45
|
+
readonly photo?: string;
|
|
46
|
+
readonly sectionOrder?: string[];
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* Merged configuration from CLI, config file, and defaults
|
|
50
|
+
*/
|
|
51
|
+
export interface ResolvedConfig {
|
|
52
|
+
readonly input: string;
|
|
53
|
+
readonly output: string;
|
|
54
|
+
readonly format: OutputFormat;
|
|
55
|
+
readonly outputType: OutputType;
|
|
56
|
+
readonly paperSize: PaperSize;
|
|
57
|
+
readonly debug: boolean;
|
|
58
|
+
readonly logFormat: LogFormat;
|
|
59
|
+
readonly chronologicalOrder: ChronologicalOrder | undefined;
|
|
60
|
+
readonly hideMotivation: boolean;
|
|
61
|
+
readonly photo: string | undefined;
|
|
62
|
+
readonly sectionOrder: string[] | undefined;
|
|
63
|
+
}
|
|
64
|
+
//# sourceMappingURL=config.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../src/types/config.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH;;GAEG;AACH,MAAM,MAAM,YAAY,GAAG,IAAI,GAAG,WAAW,GAAG,MAAM,CAAC;AACvD,MAAM,MAAM,UAAU,GAAG,MAAM,GAAG,KAAK,GAAG,MAAM,CAAC;AACjD,MAAM,MAAM,SAAS,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,QAAQ,CAAC;AAC7D,MAAM,MAAM,SAAS,GAAG,MAAM,GAAG,MAAM,CAAC;AAExC;;;;GAIG;AACH,MAAM,MAAM,kBAAkB,GAAG,KAAK,GAAG,MAAM,CAAC;AAEhD;;GAEG;AACH,MAAM,WAAW,UAAU;IACzB,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC;IACpC,QAAQ,CAAC,MAAM,EAAE,YAAY,CAAC;IAC9B,QAAQ,CAAC,UAAU,EAAE,UAAU,CAAC;IAChC,QAAQ,CAAC,SAAS,EAAE,SAAS,GAAG,SAAS,CAAC;IAC1C,Q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E,kBAAkB,GAAG,SAAS,CAAC;IAC5D,QAAQ,CAAC,cAAc,EAAE,OAAO,CAAC;IACjC,QAAQ,CAAC,KAAK,EAAE,MAAM,GAAG,SAAS,CAAC;IACnC,QAAQ,CAAC,YAAY,EAAE,MAAM,EAAE,GAAG,SAAS,CAAC;CAC7C"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config.js","sourceRoot":"","sources":["../../src/types/config.ts"],"names":[],"mappings":"AAAA;;GAEG"}
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Error types for the Resume Converter application
|
|
3
|
+
* All errors include context information and stack trace for debugging
|
|
4
|
+
* Validates: Requirements 8.1
|
|
5
|
+
*/
|
|
6
|
+
export interface BaseError {
|
|
7
|
+
readonly message: string;
|
|
8
|
+
readonly context: Record<string, unknown>;
|
|
9
|
+
readonly stack: string | undefined;
|
|
10
|
+
readonly timestamp: string;
|
|
11
|
+
}
|
|
12
|
+
export interface ParseError extends BaseError {
|
|
13
|
+
readonly type: 'parse';
|
|
14
|
+
readonly line: number;
|
|
15
|
+
readonly column: number;
|
|
16
|
+
readonly source: string;
|
|
17
|
+
}
|
|
18
|
+
export interface ValidationError extends BaseError {
|
|
19
|
+
readonly type: 'validation';
|
|
20
|
+
readonly field: string;
|
|
21
|
+
readonly expected: string;
|
|
22
|
+
readonly received: string;
|
|
23
|
+
}
|
|
24
|
+
export interface TransformError extends BaseError {
|
|
25
|
+
readonly type: 'transform';
|
|
26
|
+
readonly section: string;
|
|
27
|
+
readonly operation: string;
|
|
28
|
+
}
|
|
29
|
+
export interface OutputError extends BaseError {
|
|
30
|
+
readonly type: 'output';
|
|
31
|
+
readonly format: 'pdf' | 'html';
|
|
32
|
+
readonly cause: Error | undefined;
|
|
33
|
+
}
|
|
34
|
+
export interface ConfigError extends BaseError {
|
|
35
|
+
readonly type: 'config';
|
|
36
|
+
readonly path: string;
|
|
37
|
+
readonly expected: string;
|
|
38
|
+
readonly received: string;
|
|
39
|
+
}
|
|
40
|
+
export interface LintError extends BaseError {
|
|
41
|
+
readonly type: 'lint';
|
|
42
|
+
readonly file: string;
|
|
43
|
+
readonly line: number;
|
|
44
|
+
readonly column: number;
|
|
45
|
+
readonly ruleId: string;
|
|
46
|
+
readonly severity: 'error' | 'warning';
|
|
47
|
+
}
|
|
48
|
+
export type ResumeConverterError = ParseError | ValidationError | TransformError | OutputError | ConfigError | LintError;
|
|
49
|
+
/**
|
|
50
|
+
* Creates a ParseError with full context
|
|
51
|
+
*/
|
|
52
|
+
export declare function createParseError(message: string, line: number, column: number, source: string, context?: Record<string, unknown>): ParseError;
|
|
53
|
+
/**
|
|
54
|
+
* Creates a ValidationError with full context
|
|
55
|
+
*/
|
|
56
|
+
export declare function createValidationError(message: string, field: string, expected: string, received: string, context?: Record<string, unknown>): ValidationError;
|
|
57
|
+
/**
|
|
58
|
+
* Creates a TransformError with full context
|
|
59
|
+
*/
|
|
60
|
+
export declare function createTransformError(message: string, section: string, operation: string, context?: Record<string, unknown>): TransformError;
|
|
61
|
+
/**
|
|
62
|
+
* Creates an OutputError with full context
|
|
63
|
+
*/
|
|
64
|
+
export declare function createOutputError(message: string, format: 'pdf' | 'html', cause?: Error, context?: Record<string, unknown>): OutputError;
|
|
65
|
+
/**
|
|
66
|
+
* Creates a ConfigError with full context
|
|
67
|
+
*/
|
|
68
|
+
export declare function createConfigError(message: string, path: string, expected: string, received: string, context?: Record<string, unknown>): ConfigError;
|
|
69
|
+
/**
|
|
70
|
+
* Creates a LintError with full context
|
|
71
|
+
*/
|
|
72
|
+
export declare function createLintError(message: string, file: string, line: number, column: number, ruleId: string, severity: 'error' | 'warning', context?: Record<string, unknown>): LintError;
|
|
73
|
+
/**
|
|
74
|
+
* Formats an error for logging with full context and stack trace
|
|
75
|
+
* Validates: Requirements 8.1
|
|
76
|
+
*/
|
|
77
|
+
export declare function formatErrorForLogging(error: ResumeConverterError): string;
|
|
78
|
+
//# sourceMappingURL=errors.d.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EACf,MAAM,EAAE,KAAK,GAAG,MAAM,EACtB,KAAK,CAAC,EAAE,KAAK,EACb,OAAO,GAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAM,GACpC,WAAW,CAUb;AAED;;GAEG;AACH,wBAAgB,iBAAiB,CAC/B,OAAO,EAAE,MAAM,EACf,IAAI,EAAE,MAAM,EACZ,QAAQ,EAAE,MAAM,EAChB,QAAQ,EAAE,MAAM,EAChB,OAAO,GAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAM,GACpC,WAAW,CAWb;AAED;;GAEG;AACH,wBAAgB,eAAe,CAC7B,OAAO,EAAE,MAAM,EACf,IAAI,EAAE,MAAM,EACZ,IAAI,EAAE,MAAM,EACZ,MAAM,EAAE,MAAM,EACd,MAAM,EAAE,MAAM,EACd,QAAQ,EAAE,OAAO,GAAG,SAAS,EAC7B,OAAO,GAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAM,GACpC,SAAS,CAaX;AAED;;;GAGG;AACH,wBAAgB,qBAAqB,CAAC,KAAK,EAAE,oBAAoB,GAAG,MAAM,CAiDzE"}
|
|
@@ -0,0 +1,146 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Error types for the Resume Converter application
|
|
3
|
+
* All errors include context information and stack trace for debugging
|
|
4
|
+
* Validates: Requirements 8.1
|
|
5
|
+
*/
|
|
6
|
+
/**
|
|
7
|
+
* Creates a ParseError with full context
|
|
8
|
+
*/
|
|
9
|
+
export function createParseError(message, line, column, source, context = {}) {
|
|
10
|
+
return {
|
|
11
|
+
type: 'parse',
|
|
12
|
+
message,
|
|
13
|
+
line,
|
|
14
|
+
column,
|
|
15
|
+
source,
|
|
16
|
+
context,
|
|
17
|
+
stack: new Error().stack,
|
|
18
|
+
timestamp: new Date().toISOString(),
|
|
19
|
+
};
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Creates a ValidationError with full context
|
|
23
|
+
*/
|
|
24
|
+
export function createValidationError(message, field, expected, received, context = {}) {
|
|
25
|
+
return {
|
|
26
|
+
type: 'validation',
|
|
27
|
+
message,
|
|
28
|
+
field,
|
|
29
|
+
expected,
|
|
30
|
+
received,
|
|
31
|
+
context,
|
|
32
|
+
stack: new Error().stack,
|
|
33
|
+
timestamp: new Date().toISOString(),
|
|
34
|
+
};
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Creates a TransformError with full context
|
|
38
|
+
*/
|
|
39
|
+
export function createTransformError(message, section, operation, context = {}) {
|
|
40
|
+
return {
|
|
41
|
+
type: 'transform',
|
|
42
|
+
message,
|
|
43
|
+
section,
|
|
44
|
+
operation,
|
|
45
|
+
context,
|
|
46
|
+
stack: new Error().stack,
|
|
47
|
+
timestamp: new Date().toISOString(),
|
|
48
|
+
};
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* Creates an OutputError with full context
|
|
52
|
+
*/
|
|
53
|
+
export function createOutputError(message, format, cause, context = {}) {
|
|
54
|
+
return {
|
|
55
|
+
type: 'output',
|
|
56
|
+
message,
|
|
57
|
+
format,
|
|
58
|
+
cause,
|
|
59
|
+
context,
|
|
60
|
+
stack: new Error().stack,
|
|
61
|
+
timestamp: new Date().toISOString(),
|
|
62
|
+
};
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* Creates a ConfigError with full context
|
|
66
|
+
*/
|
|
67
|
+
export function createConfigError(message, path, expected, received, context = {}) {
|
|
68
|
+
return {
|
|
69
|
+
type: 'config',
|
|
70
|
+
message,
|
|
71
|
+
path,
|
|
72
|
+
expected,
|
|
73
|
+
received,
|
|
74
|
+
context,
|
|
75
|
+
stack: new Error().stack,
|
|
76
|
+
timestamp: new Date().toISOString(),
|
|
77
|
+
};
|
|
78
|
+
}
|
|
79
|
+
/**
|
|
80
|
+
* Creates a LintError with full context
|
|
81
|
+
*/
|
|
82
|
+
export function createLintError(message, file, line, column, ruleId, severity, context = {}) {
|
|
83
|
+
return {
|
|
84
|
+
type: 'lint',
|
|
85
|
+
message,
|
|
86
|
+
file,
|
|
87
|
+
line,
|
|
88
|
+
column,
|
|
89
|
+
ruleId,
|
|
90
|
+
severity,
|
|
91
|
+
context,
|
|
92
|
+
stack: new Error().stack,
|
|
93
|
+
timestamp: new Date().toISOString(),
|
|
94
|
+
};
|
|
95
|
+
}
|
|
96
|
+
/**
|
|
97
|
+
* Formats an error for logging with full context and stack trace
|
|
98
|
+
* Validates: Requirements 8.1
|
|
99
|
+
*/
|
|
100
|
+
export function formatErrorForLogging(error) {
|
|
101
|
+
const lines = [
|
|
102
|
+
`[${error.timestamp}] ${error.type.toUpperCase()} ERROR: ${error.message}`,
|
|
103
|
+
];
|
|
104
|
+
// Add type-specific details
|
|
105
|
+
switch (error.type) {
|
|
106
|
+
case 'parse':
|
|
107
|
+
lines.push(` Location: ${error.source}:${error.line}:${error.column}`);
|
|
108
|
+
break;
|
|
109
|
+
case 'validation':
|
|
110
|
+
lines.push(` Field: ${error.field}`);
|
|
111
|
+
lines.push(` Expected: ${error.expected}`);
|
|
112
|
+
lines.push(` Received: ${error.received}`);
|
|
113
|
+
break;
|
|
114
|
+
case 'transform':
|
|
115
|
+
lines.push(` Section: ${error.section}`);
|
|
116
|
+
lines.push(` Operation: ${error.operation}`);
|
|
117
|
+
break;
|
|
118
|
+
case 'output':
|
|
119
|
+
lines.push(` Format: ${error.format}`);
|
|
120
|
+
if (error.cause) {
|
|
121
|
+
lines.push(` Cause: ${error.cause.message}`);
|
|
122
|
+
}
|
|
123
|
+
break;
|
|
124
|
+
case 'config':
|
|
125
|
+
lines.push(` Path: ${error.path}`);
|
|
126
|
+
lines.push(` Expected: ${error.expected}`);
|
|
127
|
+
lines.push(` Received: ${error.received}`);
|
|
128
|
+
break;
|
|
129
|
+
case 'lint':
|
|
130
|
+
lines.push(` File: ${error.file}:${error.line}:${error.column}`);
|
|
131
|
+
lines.push(` Rule: ${error.ruleId}`);
|
|
132
|
+
lines.push(` Severity: ${error.severity}`);
|
|
133
|
+
break;
|
|
134
|
+
}
|
|
135
|
+
// Add context if present
|
|
136
|
+
if (Object.keys(error.context).length > 0) {
|
|
137
|
+
lines.push(` Context: ${JSON.stringify(error.context)}`);
|
|
138
|
+
}
|
|
139
|
+
// Add stack trace
|
|
140
|
+
if (error.stack != null) {
|
|
141
|
+
lines.push(` Stack trace:`);
|
|
142
|
+
lines.push(error.stack.split('\n').slice(1).join('\n'));
|
|
143
|
+
}
|
|
144
|
+
return lines.join('\n');
|
|
145
|
+
}
|
|
146
|
+
//# sourceMappingURL=errors.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"errors.js","sourceRoot":"","sources":["../../src/types/errors.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AA2DH;;GAEG;AACH,MAAM,UAAU,gBAAgB,CAC9B,OAAe,EACf,IAAY,EACZ,MAAc,EACd,MAAc,EACd,UAAmC,EAAE;IAErC,OAAO;QACL,IAAI,EAAE,OAAO;QACb,OAAO;QACP,IAAI;QACJ,MAAM;QACN,MAAM;QACN,OAAO;QACP,KAAK,EAAE,IAAI,KAAK,EAAE,CAAC,KAAK;QACxB,SAAS,EAAE,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE;KACpC,CAAC;AACJ,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,qBAAqB,CACnC,OAAe,EACf,KAAa,EACb,QAAgB,EAChB,QAAgB,EAChB,UAAmC,EAAE;IAErC,OAAO;QACL,IAAI,EAAE,YAAY;QAClB,OAAO;QACP,KAAK;QACL,QAAQ;QACR,QAAQ;QACR,OAAO;QACP,KAAK,EAAE,IAAI,KAAK,EAAE,CAAC,KAAK;QACxB,SAAS,EAAE,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE;KACpC,CAAC;AACJ,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,oBAAoB,CAClC,OAAe,EACf,OAAe,EACf,SAAiB,EACjB,UAAmC,EAAE;IAErC,OAAO;QACL,IAAI,EAAE,WAAW;QACjB,OAAO;QACP,OAAO;QACP,S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YACT,KAAK,CAAC,IAAI,CAAC,WAAW,KAAK,CAAC,IAAI,IAAI,KAAK,CAAC,IAAI,IAAI,KAAK,CAAC,MAAM,EAAE,CAAC,CAAC;YAClE,KAAK,CAAC,IAAI,CAAC,WAAW,KAAK,CAAC,MAAM,EAAE,CAAC,CAAC;YACtC,KAAK,CAAC,IAAI,CAAC,eAAe,KAAK,CAAC,QAAQ,EAAE,CAAC,CAAC;YAC5C,MAAM;IACV,CAAC;IAED,yBAAyB;IACzB,IAAI,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QAC1C,KAAK,CAAC,IAAI,CAAC,cAAc,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,OAAO,CAAC,EAAE,CAAC,CAAC;IAC5D,CAAC;IAED,kBAAkB;IAClB,IAAI,KAAK,CAAC,KAAK,IAAI,IAAI,EAAE,CAAC;QACxB,KAAK,CAAC,IAAI,CAAC,gBAAgB,CAAC,CAAC;QAC7B,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC;IAC1D,CAAC;IAED,OAAO,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AAC1B,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,cAAc,aAAa,CAAC;AAC5B,cAAc,aAAa,CAAC;AAC5B,cAAc,eAAe,CAAC;AAC9B,cAAc,aAAa,CAAC;AAC5B,cAAc,eAAe,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,cAAc,aAAa,CAAC;AAC5B,cAAc,aAAa,CAAC;AAC5B,cAAc,eAAe,CAAC;AAC9B,cAAc,aAAa,CAAC;AAC5B,cAAc,eAAe,CAAC"}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Metadata types for resume frontmatter and environment variables
|
|
3
|
+
*/
|
|
4
|
+
/**
|
|
5
|
+
* Metadata field definition
|
|
6
|
+
*/
|
|
7
|
+
export interface MetadataFieldDef {
|
|
8
|
+
readonly envVars: readonly string[];
|
|
9
|
+
readonly frontmatterKeys: readonly string[];
|
|
10
|
+
readonly required: boolean;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* All metadata field definitions
|
|
14
|
+
* Priority: frontmatter > environment variables
|
|
15
|
+
*/
|
|
16
|
+
export declare const METADATA_FIELDS: Record<string, MetadataFieldDef>;
|
|
17
|
+
/**
|
|
18
|
+
* Resolved metadata after merging env vars and frontmatter
|
|
19
|
+
*/
|
|
20
|
+
export interface CVMetadata {
|
|
21
|
+
readonly name: string;
|
|
22
|
+
readonly email_address: string;
|
|
23
|
+
readonly phone_number: string;
|
|
24
|
+
readonly name_ja?: string;
|
|
25
|
+
readonly name_furigana?: string;
|
|
26
|
+
readonly post_code?: string;
|
|
27
|
+
readonly home_address?: string;
|
|
28
|
+
readonly home_address_furigana?: string;
|
|
29
|
+
readonly email_address2?: string;
|
|
30
|
+
readonly phone_number2?: string;
|
|
31
|
+
readonly post_code2?: string;
|
|
32
|
+
readonly home_address2?: string;
|
|
33
|
+
readonly home_address2_furigana?: string;
|
|
34
|
+
readonly gender?: Gender;
|
|
35
|
+
readonly dob?: Date;
|
|
36
|
+
readonly linkedin?: string;
|
|
37
|
+
}
|
|
38
|
+
export type ResumeMetadata = CVMetadata;
|
|
39
|
+
/**
|
|
40
|
+
* Gender type
|
|
41
|
+
*/
|
|
42
|
+
export type Gender = 'male' | 'female' | 'other' | undefined;
|
|
43
|
+
/**
|
|
44
|
+
* Get required metadata field names
|
|
45
|
+
*/
|
|
46
|
+
export declare function getRequiredFields(): string[];
|
|
47
|
+
/**
|
|
48
|
+
* Load metadata value from environment variables
|
|
49
|
+
*/
|
|
50
|
+
export declare function loadFromEnv(fieldName: string): string | undefined;
|
|
51
|
+
/**
|
|
52
|
+
* Load metadata value from frontmatter
|
|
53
|
+
*/
|
|
54
|
+
export declare function loadFromFrontmatter(fieldName: string, frontmatter: Record<string, unknown>): string | undefined;
|
|
55
|
+
//# sourceMappingURL=metadata.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"metadata.d.ts","sourceRoot":"","sources":["../../src/types/metadata.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH;;GAEG;AACH,MAAM,WAAW,gBAAgB;IAC/B,QAAQ,CAAC,OAAO,EAAE,SAAS,MAAM,EAAE,CAAC;IACpC,QAAQ,CAAC,eAAe,EAAE,SAAS,MAAM,EAAE,CAAC;IAC5C,QAAQ,CAAC,QAAQ,EAAE,OAAO,CAAC;CAC5B;AAED;;;GAGG;AACH,eAAO,MAAM,eAAe,EAAE,MAAM,CAAC,MAAM,EAAE,gBAAgB,CA2FnD,CAAC;AAEX;;GAEG;AACH,MAAM,WAAW,UAAU;IAEzB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,aAAa,EAAE,MAAM,CAAC;IAC/B,QAAQ,CAAC,YAAY,EAAE,MAAM,CAAC;IAG9B,QAAQ,CAAC,OAAO,CAAC,EAAE,MAAM,CAAC;IAC1B,QAAQ,CAAC,aAAa,CAAC,EAAE,MAAM,CAAC;IAGhC,QAAQ,CAAC,SAAS,CAAC,EAAE,MAAM,CAAC;IAC5B,QAAQ,CAAC,YAAY,CAAC,EAAE,MAAM,CAAC;IAC/B,QAAQ,CAAC,qBAAqB,CAAC,EAAE,MAAM,CAAC;IAGxC,QAAQ,CAAC,cAAc,CAAC,EAAE,MAAM,CAAC;IACjC,QAAQ,CAAC,aAAa,CAAC,EAAE,MAAM,CAAC;IAChC,QAAQ,CAAC,UAAU,CAAC,EAAE,MAAM,CAAC;IAC7B,QAAQ,CAAC,aAAa,CAAC,EAAE,MAAM,CAAC;IAChC,QAAQ,CAAC,sBAAsB,CAAC,EAAE,MAAM,CAAC;IAGzC,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,GAAG,CAAC,EAAE,IAAI,CAAC;IAGpB,QAAQ,CAAC,QAAQ,CAAC,EAAE,MAAM,CAAC;CAC5B;AAGD,MAAM,MAAM,cAAc,GAAG,UAAU,CAAC;AAExC;;GAEG;AACH,MAAM,MAAM,MAAM,GAAG,MAAM,GAAG,QAAQ,GAAG,OAAO,GAAG,SAAS,CAAC;AAE7D;;GAEG;AACH,wBAAgB,iBAAiB,IAAI,MAAM,EAAE,CAI5C;AAED;;GAEG;AACH,wBAAgB,WAAW,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CASjE;AAED;;GAEG;AACH,wBAAgB,mBAAmB,CACjC,SAAS,EAAE,MAAM,EACjB,WAAW,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GACnC,MAAM,GAAG,SAAS,CASpB"}
|
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Metadata types for resume frontmatter and environment variables
|
|
3
|
+
*/
|
|
4
|
+
/**
|
|
5
|
+
* All metadata field definitions
|
|
6
|
+
* Priority: frontmatter > environment variables
|
|
7
|
+
*/
|
|
8
|
+
export const METADATA_FIELDS = {
|
|
9
|
+
name: {
|
|
10
|
+
envVars: ['NAME'],
|
|
11
|
+
frontmatterKeys: ['name'],
|
|
12
|
+
required: true,
|
|
13
|
+
},
|
|
14
|
+
name_ja: {
|
|
15
|
+
envVars: ['NAME_JA'],
|
|
16
|
+
frontmatterKeys: ['name_ja'],
|
|
17
|
+
required: false,
|
|
18
|
+
},
|
|
19
|
+
name_furigana: {
|
|
20
|
+
envVars: ['NAME_FURIGANA', 'NAME_HURIGANA'],
|
|
21
|
+
frontmatterKeys: ['name_furigana', 'name_hurigana'],
|
|
22
|
+
required: false,
|
|
23
|
+
},
|
|
24
|
+
email_address: {
|
|
25
|
+
envVars: ['EMAIL_ADDRESS', 'EMAIL_ADDRESS1'],
|
|
26
|
+
frontmatterKeys: ['email_address', 'email_address1'],
|
|
27
|
+
required: true,
|
|
28
|
+
},
|
|
29
|
+
email_address2: {
|
|
30
|
+
envVars: ['EMAIL_ADDRESS2'],
|
|
31
|
+
frontmatterKeys: ['email_address2'],
|
|
32
|
+
required: false,
|
|
33
|
+
},
|
|
34
|
+
phone_number: {
|
|
35
|
+
envVars: ['PHONE_NUMBER', 'PHONE_NUMBER1'],
|
|
36
|
+
frontmatterKeys: ['phone_number', 'phone_number1'],
|
|
37
|
+
required: true,
|
|
38
|
+
},
|
|
39
|
+
phone_number2: {
|
|
40
|
+
envVars: ['PHONE_NUMBER2'],
|
|
41
|
+
frontmatterKeys: ['phone_number2'],
|
|
42
|
+
required: false,
|
|
43
|
+
},
|
|
44
|
+
post_code: {
|
|
45
|
+
envVars: ['POST_CODE', 'POST_CODE1'],
|
|
46
|
+
frontmatterKeys: ['post_code', 'post_code1'],
|
|
47
|
+
required: false,
|
|
48
|
+
},
|
|
49
|
+
home_address: {
|
|
50
|
+
envVars: ['HOME_ADDRESS', 'HOME_ADDRESS1'],
|
|
51
|
+
frontmatterKeys: ['home_address', 'home_address1'],
|
|
52
|
+
required: false,
|
|
53
|
+
},
|
|
54
|
+
home_address_furigana: {
|
|
55
|
+
envVars: [
|
|
56
|
+
'HOME_ADDRESS_FURIGANA',
|
|
57
|
+
'HOME_ADDRESS_HURIGANA',
|
|
58
|
+
'HOME_ADDRESS1_FURIGANA',
|
|
59
|
+
'HOME_ADDRESS1_HURIGANA',
|
|
60
|
+
],
|
|
61
|
+
frontmatterKeys: [
|
|
62
|
+
'home_address_furigana',
|
|
63
|
+
'home_address_hurigana',
|
|
64
|
+
'home_address1_furigana',
|
|
65
|
+
'home_address1_hurigana',
|
|
66
|
+
],
|
|
67
|
+
required: false,
|
|
68
|
+
},
|
|
69
|
+
post_code2: {
|
|
70
|
+
envVars: ['POST_CODE2'],
|
|
71
|
+
frontmatterKeys: ['post_code2'],
|
|
72
|
+
required: false,
|
|
73
|
+
},
|
|
74
|
+
home_address2: {
|
|
75
|
+
envVars: ['HOME_ADDRESS2'],
|
|
76
|
+
frontmatterKeys: ['home_address2'],
|
|
77
|
+
required: false,
|
|
78
|
+
},
|
|
79
|
+
home_address2_furigana: {
|
|
80
|
+
envVars: ['HOME_ADDRESS2_FURIGANA', 'HOME_ADDRESS2_HURIGANA'],
|
|
81
|
+
frontmatterKeys: ['home_address2_furigana', 'home_address2_hurigana'],
|
|
82
|
+
required: false,
|
|
83
|
+
},
|
|
84
|
+
gender: {
|
|
85
|
+
envVars: ['GENDER'],
|
|
86
|
+
frontmatterKeys: ['gender'],
|
|
87
|
+
required: false,
|
|
88
|
+
},
|
|
89
|
+
dob: {
|
|
90
|
+
envVars: ['DOB', 'DATE_OF_BIRTH'],
|
|
91
|
+
frontmatterKeys: ['dob', 'date_of_birth'],
|
|
92
|
+
required: false,
|
|
93
|
+
},
|
|
94
|
+
linkedin: {
|
|
95
|
+
envVars: ['LINKEDIN', 'LINKEDIN_URL'],
|
|
96
|
+
frontmatterKeys: ['linkedin', 'linkedin_url'],
|
|
97
|
+
required: false,
|
|
98
|
+
},
|
|
99
|
+
};
|
|
100
|
+
/**
|
|
101
|
+
* Get required metadata field names
|
|
102
|
+
*/
|
|
103
|
+
export function getRequiredFields() {
|
|
104
|
+
return Object.entries(METADATA_FIELDS)
|
|
105
|
+
.filter(([, def]) => def.required)
|
|
106
|
+
.map(([key]) => key);
|
|
107
|
+
}
|
|
108
|
+
/**
|
|
109
|
+
* Load metadata value from environment variables
|
|
110
|
+
*/
|
|
111
|
+
export function loadFromEnv(fieldName) {
|
|
112
|
+
const def = METADATA_FIELDS[fieldName];
|
|
113
|
+
if (!def)
|
|
114
|
+
return undefined;
|
|
115
|
+
for (const envVar of def.envVars) {
|
|
116
|
+
const value = process.env[envVar];
|
|
117
|
+
if (value)
|
|
118
|
+
return value;
|
|
119
|
+
}
|
|
120
|
+
return undefined;
|
|
121
|
+
}
|
|
122
|
+
/**
|
|
123
|
+
* Load metadata value from frontmatter
|
|
124
|
+
*/
|
|
125
|
+
export function loadFromFrontmatter(fieldName, frontmatter) {
|
|
126
|
+
const def = METADATA_FIELDS[fieldName];
|
|
127
|
+
if (!def)
|
|
128
|
+
return undefined;
|
|
129
|
+
for (const key of def.frontmatterKeys) {
|
|
130
|
+
const value = frontmatter[key];
|
|
131
|
+
if (typeof value === 'string' && value)
|
|
132
|
+
return value;
|
|
133
|
+
}
|
|
134
|
+
return undefined;
|
|
135
|
+
}
|
|
136
|
+
//# sourceMappingURL=metadata.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"metadata.js","sourceRoot":"","sources":["../../src/types/metadata.ts"],"names":[],"mappings":"AAAA;;GAEG;AAWH;;;GAGG;AACH,MAAM,CAAC,MAAM,eAAe,GAAqC;IAC/D,IAAI,EAAE;QACJ,OAAO,EAAE,CAAC,MAAM,CAAC;QACjB,eAAe,EAAE,CAAC,MAAM,CAAC;QACzB,QAAQ,EAAE,IAAI;KACf;IACD,OAAO,EAAE;QACP,OAAO,EAAE,CAAC,SAAS,CAAC;QACpB,eAAe,EAAE,CAAC,SAAS,CAAC;QAC5B,QAAQ,EAAE,KAAK;KAChB;IACD,aAAa,EAAE;QACb,OAAO,EAAE,CAAC,eAAe,EAAE,eAAe,CAAC;QAC3C,eAAe,EAAE,CAAC,eAAe,EAAE,eAAe,CAAC;QACnD,QAAQ,EAAE,KAAK;KAChB;IACD,aAAa,EAAE;QACb,OAAO,EAAE,CAAC,eAAe,EAAE,gBAAgB,CAAC;QAC5C,eAAe,EAAE,CAAC,eAAe,EAAE,gBAAgB,CAAC;QACpD,QAAQ,EAAE,IAAI;KACf;IACD,cA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vC,IAAI,CAAC,GAAG;QAAE,OAAO,SAAS,CAAC;IAE3B,KAAK,MAAM,GAAG,IAAI,GAAG,CAAC,eAAe,EAAE,CAAC;QACtC,MAAM,KAAK,GAAG,WAAW,CAAC,GAAG,CAAC,CAAC;QAC/B,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK;YAAE,OAAO,KAAK,CAAC;IACvD,CAAC;IACD,OAAO,SAAS,CAAC;AACnB,CAAC"}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Result type for error handling - represents either success or failure
|
|
3
|
+
* This is a discriminated union that forces explicit error handling
|
|
4
|
+
*/
|
|
5
|
+
export type Result<T, E> = Success<T> | Failure<E>;
|
|
6
|
+
export interface Success<T> {
|
|
7
|
+
readonly ok: true;
|
|
8
|
+
readonly value: T;
|
|
9
|
+
}
|
|
10
|
+
export interface Failure<E> {
|
|
11
|
+
readonly ok: false;
|
|
12
|
+
readonly error: E;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Creates a successful Result
|
|
16
|
+
*/
|
|
17
|
+
export declare function success<T>(value: T): Success<T>;
|
|
18
|
+
/**
|
|
19
|
+
* Creates a failed Result
|
|
20
|
+
*/
|
|
21
|
+
export declare function failure<E>(error: E): Failure<E>;
|
|
22
|
+
/**
|
|
23
|
+
* Type guard to check if a Result is successful
|
|
24
|
+
*/
|
|
25
|
+
export declare function isSuccess<T, E>(result: Result<T, E>): result is Success<T>;
|
|
26
|
+
/**
|
|
27
|
+
* Type guard to check if a Result is a failure
|
|
28
|
+
*/
|
|
29
|
+
export declare function isFailure<T, E>(result: Result<T, E>): result is Failure<E>;
|
|
30
|
+
/**
|
|
31
|
+
* Maps a successful Result's value using the provided function
|
|
32
|
+
*/
|
|
33
|
+
export declare function map<T, U, E>(result: Result<T, E>, fn: (value: T) => U): Result<U, E>;
|
|
34
|
+
/**
|
|
35
|
+
* Maps a failed Result's error using the provided function
|
|
36
|
+
*/
|
|
37
|
+
export declare function mapError<T, E, F>(result: Result<T, E>, fn: (error: E) => F): Result<T, F>;
|
|
38
|
+
/**
|
|
39
|
+
* Chains Result operations - flatMap/bind
|
|
40
|
+
*/
|
|
41
|
+
export declare function flatMap<T, U, E>(result: Result<T, E>, fn: (value: T) => Result<U, E>): Result<U, E>;
|
|
42
|
+
/**
|
|
43
|
+
* Unwraps a Result, throwing if it's a failure
|
|
44
|
+
*/
|
|
45
|
+
export declare function unwrap<T, E>(result: Result<T, E>): T;
|
|
46
|
+
/**
|
|
47
|
+
* Unwraps a Result with a default value for failures
|
|
48
|
+
*/
|
|
49
|
+
export declare function unwrapOr<T, E>(result: Result<T, E>, defaultValue: T): T;
|
|
50
|
+
//# sourceMappingURL=result.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"result.d.ts","sourceRoot":"","sources":["../../src/types/result.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,MAAM,MAAM,MAAM,CAAC,CAAC,EAAE,CAAC,IAAI,OAAO,CAAC,CAAC,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC,CAAC;AAEnD,MAAM,WAAW,OAAO,CAAC,CAAC;IACxB,QAAQ,CAAC,EAAE,EAAE,IAAI,CAAC;IAClB,QAAQ,CAAC,KAAK,EAAE,CAAC,CAAC;CACnB;AAED,MAAM,WAAW,OAAO,CAAC,CAAC;IACxB,QAAQ,CAAC,EAAE,EAAE,KAAK,CAAC;IACnB,QAAQ,CAAC,KAAK,EAAE,CAAC,CAAC;CACnB;AAED;;GAEG;AACH,wBAAgB,OAAO,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC,CAE/C;AAED;;GAEG;AACH,wBAAgB,OAAO,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC,CAE/C;AAED;;GAEG;AACH,wBAAgB,SAAS,CAAC,CAAC,EAAE,CAAC,EAAE,MAAM,EAA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