@accounter/shaam-uniform-format-generator 0.1.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/README.md +123 -0
- package/cjs/api/generate-report.js +53 -0
- package/cjs/api/parse-files.js +32 -0
- package/cjs/format/index.js +8 -0
- package/cjs/format/newline.js +10 -0
- package/cjs/format/padding.js +39 -0
- package/cjs/generator/format/decoder.js +17 -0
- package/cjs/generator/format/encoder.js +46 -0
- package/cjs/generator/format/index.js +8 -0
- package/cjs/generator/index.js +8 -0
- package/cjs/generator/records/a000.js +8 -0
- package/cjs/generator/records/a100.js +8 -0
- package/cjs/generator/records/b100.js +8 -0
- package/cjs/generator/records/b110.js +8 -0
- package/cjs/generator/records/c100.js +8 -0
- package/cjs/generator/records/d110.js +8 -0
- package/cjs/generator/records/d120.js +8 -0
- package/cjs/generator/records/index.js +15 -0
- package/cjs/generator/records/m100.js +8 -0
- package/cjs/generator/records/z900.js +8 -0
- package/cjs/index.js +19 -0
- package/cjs/package.json +1 -0
- package/cjs/parser/data-parser.js +16 -0
- package/cjs/parser/index.js +8 -0
- package/cjs/parser/ini-parser.js +16 -0
- package/cjs/types/index.js +74 -0
- package/cjs/validation/errors.js +30 -0
- package/cjs/validation/index.js +8 -0
- package/cjs/validation/validate-input.js +56 -0
- package/esm/api/generate-report.js +50 -0
- package/esm/api/parse-files.js +29 -0
- package/esm/format/index.js +5 -0
- package/esm/format/newline.js +7 -0
- package/esm/format/padding.js +35 -0
- package/esm/generator/format/decoder.js +14 -0
- package/esm/generator/format/encoder.js +42 -0
- package/esm/generator/format/index.js +5 -0
- package/esm/generator/index.js +5 -0
- package/esm/generator/records/a000.js +5 -0
- package/esm/generator/records/a100.js +5 -0
- package/esm/generator/records/b100.js +5 -0
- package/esm/generator/records/b110.js +5 -0
- package/esm/generator/records/c100.js +5 -0
- package/esm/generator/records/d110.js +5 -0
- package/esm/generator/records/d120.js +5 -0
- package/esm/generator/records/index.js +12 -0
- package/esm/generator/records/m100.js +5 -0
- package/esm/generator/records/z900.js +5 -0
- package/esm/index.js +13 -0
- package/esm/parser/data-parser.js +13 -0
- package/esm/parser/index.js +5 -0
- package/esm/parser/ini-parser.js +13 -0
- package/esm/types/index.js +71 -0
- package/esm/validation/errors.js +25 -0
- package/esm/validation/index.js +5 -0
- package/esm/validation/validate-input.js +53 -0
- package/package.json +54 -0
- package/typings/api/generate-report.d.cts +13 -0
- package/typings/api/generate-report.d.ts +13 -0
- package/typings/api/parse-files.d.cts +13 -0
- package/typings/api/parse-files.d.ts +13 -0
- package/typings/format/index.d.cts +5 -0
- package/typings/format/index.d.ts +5 -0
- package/typings/format/newline.d.cts +7 -0
- package/typings/format/newline.d.ts +7 -0
- package/typings/format/padding.d.cts +21 -0
- package/typings/format/padding.d.ts +21 -0
- package/typings/generator/format/decoder.d.cts +12 -0
- package/typings/generator/format/decoder.d.ts +12 -0
- package/typings/generator/format/encoder.d.cts +33 -0
- package/typings/generator/format/encoder.d.ts +33 -0
- package/typings/generator/format/index.d.cts +5 -0
- package/typings/generator/format/index.d.ts +5 -0
- package/typings/generator/index.d.cts +5 -0
- package/typings/generator/index.d.ts +5 -0
- package/typings/generator/records/a000.d.cts +4 -0
- package/typings/generator/records/a000.d.ts +4 -0
- package/typings/generator/records/a100.d.cts +4 -0
- package/typings/generator/records/a100.d.ts +4 -0
- package/typings/generator/records/b100.d.cts +4 -0
- package/typings/generator/records/b100.d.ts +4 -0
- package/typings/generator/records/b110.d.cts +4 -0
- package/typings/generator/records/b110.d.ts +4 -0
- package/typings/generator/records/c100.d.cts +4 -0
- package/typings/generator/records/c100.d.ts +4 -0
- package/typings/generator/records/d110.d.cts +4 -0
- package/typings/generator/records/d110.d.ts +4 -0
- package/typings/generator/records/d120.d.cts +4 -0
- package/typings/generator/records/d120.d.ts +4 -0
- package/typings/generator/records/index.d.cts +12 -0
- package/typings/generator/records/index.d.ts +12 -0
- package/typings/generator/records/m100.d.cts +4 -0
- package/typings/generator/records/m100.d.ts +4 -0
- package/typings/generator/records/z900.d.cts +4 -0
- package/typings/generator/records/z900.d.ts +4 -0
- package/typings/index.d.cts +12 -0
- package/typings/index.d.ts +12 -0
- package/typings/parser/data-parser.d.cts +10 -0
- package/typings/parser/data-parser.d.ts +10 -0
- package/typings/parser/index.d.cts +5 -0
- package/typings/parser/index.d.ts +5 -0
- package/typings/parser/ini-parser.d.cts +10 -0
- package/typings/parser/ini-parser.d.ts +10 -0
- package/typings/types/index.d.cts +371 -0
- package/typings/types/index.d.ts +371 -0
- package/typings/validation/errors.d.cts +15 -0
- package/typings/validation/errors.d.ts +15 -0
- package/typings/validation/index.d.cts +5 -0
- package/typings/validation/index.d.ts +5 -0
- package/typings/validation/validate-input.d.cts +12 -0
- package/typings/validation/validate-input.d.ts +12 -0
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* String padding utilities for fixed-width formatting
|
|
3
|
+
*/
|
|
4
|
+
/**
|
|
5
|
+
* Pads a string on the left (right-aligns the content)
|
|
6
|
+
*
|
|
7
|
+
* @param value - The string to pad
|
|
8
|
+
* @param width - Target width
|
|
9
|
+
* @param fill - Character to use for padding (default: space)
|
|
10
|
+
* @returns Left-padded string
|
|
11
|
+
*/
|
|
12
|
+
export declare function padLeft(value: string, width: number, fill?: string): string;
|
|
13
|
+
/**
|
|
14
|
+
* Pads a string on the right (left-aligns the content)
|
|
15
|
+
*
|
|
16
|
+
* @param value - The string to pad
|
|
17
|
+
* @param width - Target width
|
|
18
|
+
* @param fill - Character to use for padding (default: space)
|
|
19
|
+
* @returns Right-padded string
|
|
20
|
+
*/
|
|
21
|
+
export declare function padRight(value: string, width: number, fill?: string): string;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* String padding utilities for fixed-width formatting
|
|
3
|
+
*/
|
|
4
|
+
/**
|
|
5
|
+
* Pads a string on the left (right-aligns the content)
|
|
6
|
+
*
|
|
7
|
+
* @param value - The string to pad
|
|
8
|
+
* @param width - Target width
|
|
9
|
+
* @param fill - Character to use for padding (default: space)
|
|
10
|
+
* @returns Left-padded string
|
|
11
|
+
*/
|
|
12
|
+
export declare function padLeft(value: string, width: number, fill?: string): string;
|
|
13
|
+
/**
|
|
14
|
+
* Pads a string on the right (left-aligns the content)
|
|
15
|
+
*
|
|
16
|
+
* @param value - The string to pad
|
|
17
|
+
* @param width - Target width
|
|
18
|
+
* @param fill - Character to use for padding (default: space)
|
|
19
|
+
* @returns Right-padded string
|
|
20
|
+
*/
|
|
21
|
+
export declare function padRight(value: string, width: number, fill?: string): string;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Fixed-width decoding utilities
|
|
3
|
+
*/
|
|
4
|
+
/**
|
|
5
|
+
* Decodes a fixed-width string value
|
|
6
|
+
*
|
|
7
|
+
* @param line - The line to decode from
|
|
8
|
+
* @param start - Start position (0-based)
|
|
9
|
+
* @param length - Field length
|
|
10
|
+
* @returns Decoded and trimmed value
|
|
11
|
+
*/
|
|
12
|
+
export declare function decodeFixedWidth(line: string, start: number, length: number): string;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Fixed-width decoding utilities
|
|
3
|
+
*/
|
|
4
|
+
/**
|
|
5
|
+
* Decodes a fixed-width string value
|
|
6
|
+
*
|
|
7
|
+
* @param line - The line to decode from
|
|
8
|
+
* @param start - Start position (0-based)
|
|
9
|
+
* @param length - Field length
|
|
10
|
+
* @returns Decoded and trimmed value
|
|
11
|
+
*/
|
|
12
|
+
export declare function decodeFixedWidth(line: string, start: number, length: number): string;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Fixed-wiexport function formatField(
|
|
3
|
+
value: string,
|
|
4
|
+
width: number,
|
|
5
|
+
align: 'left' | 'right',
|
|
6
|
+
padChar = ' '
|
|
7
|
+
): string {
|
|
8
|
+
if (align === 'left') {
|
|
9
|
+
return padRight(value, width, padChar);
|
|
10
|
+
}
|
|
11
|
+
return padLeft(value, width, padChar);
|
|
12
|
+
} utilities
|
|
13
|
+
*/
|
|
14
|
+
/**
|
|
15
|
+
* Formats a field value with specified width and alignment
|
|
16
|
+
*
|
|
17
|
+
* @param value - The value to format
|
|
18
|
+
* @param width - Target field width
|
|
19
|
+
* @param align - Alignment ('left' or 'right')
|
|
20
|
+
* @param padChar - Character to use for padding (default: space)
|
|
21
|
+
* @returns Formatted fixed-width string
|
|
22
|
+
*/
|
|
23
|
+
export declare function formatField(value: string, width: number, align: 'left' | 'right', padChar?: string): string;
|
|
24
|
+
/**
|
|
25
|
+
* Encodes a value to fixed-width format with padding
|
|
26
|
+
*
|
|
27
|
+
* @param value - The value to encode
|
|
28
|
+
* @param width - Target width
|
|
29
|
+
* @param padChar - Padding character (default: space)
|
|
30
|
+
* @param align - Alignment ('left' or 'right')
|
|
31
|
+
* @returns Fixed-width encoded string
|
|
32
|
+
*/
|
|
33
|
+
export declare function encodeFixedWidth(value: string | number, width: number, padChar?: string, align?: 'left' | 'right'): string;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Fixed-wiexport function formatField(
|
|
3
|
+
value: string,
|
|
4
|
+
width: number,
|
|
5
|
+
align: 'left' | 'right',
|
|
6
|
+
padChar = ' '
|
|
7
|
+
): string {
|
|
8
|
+
if (align === 'left') {
|
|
9
|
+
return padRight(value, width, padChar);
|
|
10
|
+
}
|
|
11
|
+
return padLeft(value, width, padChar);
|
|
12
|
+
} utilities
|
|
13
|
+
*/
|
|
14
|
+
/**
|
|
15
|
+
* Formats a field value with specified width and alignment
|
|
16
|
+
*
|
|
17
|
+
* @param value - The value to format
|
|
18
|
+
* @param width - Target field width
|
|
19
|
+
* @param align - Alignment ('left' or 'right')
|
|
20
|
+
* @param padChar - Character to use for padding (default: space)
|
|
21
|
+
* @returns Formatted fixed-width string
|
|
22
|
+
*/
|
|
23
|
+
export declare function formatField(value: string, width: number, align: 'left' | 'right', padChar?: string): string;
|
|
24
|
+
/**
|
|
25
|
+
* Encodes a value to fixed-width format with padding
|
|
26
|
+
*
|
|
27
|
+
* @param value - The value to encode
|
|
28
|
+
* @param width - Target width
|
|
29
|
+
* @param padChar - Padding character (default: space)
|
|
30
|
+
* @param align - Alignment ('left' or 'right')
|
|
31
|
+
* @returns Fixed-width encoded string
|
|
32
|
+
*/
|
|
33
|
+
export declare function encodeFixedWidth(value: string | number, width: number, padChar?: string, align?: 'left' | 'right'): string;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Record type definitions and generators
|
|
3
|
+
*/
|
|
4
|
+
export * from './a000.cjs';
|
|
5
|
+
export * from './a100.cjs';
|
|
6
|
+
export * from './b100.cjs';
|
|
7
|
+
export * from './b110.cjs';
|
|
8
|
+
export * from './c100.cjs';
|
|
9
|
+
export * from './d110.cjs';
|
|
10
|
+
export * from './d120.cjs';
|
|
11
|
+
export * from './m100.cjs';
|
|
12
|
+
export * from './z900.cjs';
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Record type definitions and generators
|
|
3
|
+
*/
|
|
4
|
+
export * from './a000.js';
|
|
5
|
+
export * from './a100.js';
|
|
6
|
+
export * from './b100.js';
|
|
7
|
+
export * from './b110.js';
|
|
8
|
+
export * from './c100.js';
|
|
9
|
+
export * from './d110.js';
|
|
10
|
+
export * from './d120.js';
|
|
11
|
+
export * from './m100.js';
|
|
12
|
+
export * from './z900.js';
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @accounter/shaam-uniform-format-generator
|
|
3
|
+
*
|
|
4
|
+
* A fully typed TypeScript library for generating, parsing, and validating
|
|
5
|
+
* SHAAM uniform format tax reports (INI.TXT and BKMVDATA.TXT files).
|
|
6
|
+
*/
|
|
7
|
+
export * from './types/index.cjs';
|
|
8
|
+
export * from './generator/index.cjs';
|
|
9
|
+
export * from './parser/index.cjs';
|
|
10
|
+
export * from './validation/index.cjs';
|
|
11
|
+
export { generateUniformFormatReport } from './api/generate-report.cjs';
|
|
12
|
+
export { parseUniformFormatFiles } from './api/parse-files.cjs';
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @accounter/shaam-uniform-format-generator
|
|
3
|
+
*
|
|
4
|
+
* A fully typed TypeScript library for generating, parsing, and validating
|
|
5
|
+
* SHAAM uniform format tax reports (INI.TXT and BKMVDATA.TXT files).
|
|
6
|
+
*/
|
|
7
|
+
export * from './types/index.js';
|
|
8
|
+
export * from './generator/index.js';
|
|
9
|
+
export * from './parser/index.js';
|
|
10
|
+
export * from './validation/index.js';
|
|
11
|
+
export { generateUniformFormatReport } from './api/generate-report.js';
|
|
12
|
+
export { parseUniformFormatFiles } from './api/parse-files.js';
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* BKMVDATA.TXT file parsing utilities
|
|
3
|
+
*/
|
|
4
|
+
/**
|
|
5
|
+
* Parses BKMVDATA.TXT file content
|
|
6
|
+
*
|
|
7
|
+
* @param content - Raw BKMVDATA.TXT file content
|
|
8
|
+
* @returns Parsed data structure
|
|
9
|
+
*/
|
|
10
|
+
export declare function parseDataFile(_content: string): Record<string, unknown>;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* BKMVDATA.TXT file parsing utilities
|
|
3
|
+
*/
|
|
4
|
+
/**
|
|
5
|
+
* Parses BKMVDATA.TXT file content
|
|
6
|
+
*
|
|
7
|
+
* @param content - Raw BKMVDATA.TXT file content
|
|
8
|
+
* @returns Parsed data structure
|
|
9
|
+
*/
|
|
10
|
+
export declare function parseDataFile(_content: string): Record<string, unknown>;
|