@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.
Files changed (111) hide show
  1. package/README.md +123 -0
  2. package/cjs/api/generate-report.js +53 -0
  3. package/cjs/api/parse-files.js +32 -0
  4. package/cjs/format/index.js +8 -0
  5. package/cjs/format/newline.js +10 -0
  6. package/cjs/format/padding.js +39 -0
  7. package/cjs/generator/format/decoder.js +17 -0
  8. package/cjs/generator/format/encoder.js +46 -0
  9. package/cjs/generator/format/index.js +8 -0
  10. package/cjs/generator/index.js +8 -0
  11. package/cjs/generator/records/a000.js +8 -0
  12. package/cjs/generator/records/a100.js +8 -0
  13. package/cjs/generator/records/b100.js +8 -0
  14. package/cjs/generator/records/b110.js +8 -0
  15. package/cjs/generator/records/c100.js +8 -0
  16. package/cjs/generator/records/d110.js +8 -0
  17. package/cjs/generator/records/d120.js +8 -0
  18. package/cjs/generator/records/index.js +15 -0
  19. package/cjs/generator/records/m100.js +8 -0
  20. package/cjs/generator/records/z900.js +8 -0
  21. package/cjs/index.js +19 -0
  22. package/cjs/package.json +1 -0
  23. package/cjs/parser/data-parser.js +16 -0
  24. package/cjs/parser/index.js +8 -0
  25. package/cjs/parser/ini-parser.js +16 -0
  26. package/cjs/types/index.js +74 -0
  27. package/cjs/validation/errors.js +30 -0
  28. package/cjs/validation/index.js +8 -0
  29. package/cjs/validation/validate-input.js +56 -0
  30. package/esm/api/generate-report.js +50 -0
  31. package/esm/api/parse-files.js +29 -0
  32. package/esm/format/index.js +5 -0
  33. package/esm/format/newline.js +7 -0
  34. package/esm/format/padding.js +35 -0
  35. package/esm/generator/format/decoder.js +14 -0
  36. package/esm/generator/format/encoder.js +42 -0
  37. package/esm/generator/format/index.js +5 -0
  38. package/esm/generator/index.js +5 -0
  39. package/esm/generator/records/a000.js +5 -0
  40. package/esm/generator/records/a100.js +5 -0
  41. package/esm/generator/records/b100.js +5 -0
  42. package/esm/generator/records/b110.js +5 -0
  43. package/esm/generator/records/c100.js +5 -0
  44. package/esm/generator/records/d110.js +5 -0
  45. package/esm/generator/records/d120.js +5 -0
  46. package/esm/generator/records/index.js +12 -0
  47. package/esm/generator/records/m100.js +5 -0
  48. package/esm/generator/records/z900.js +5 -0
  49. package/esm/index.js +13 -0
  50. package/esm/parser/data-parser.js +13 -0
  51. package/esm/parser/index.js +5 -0
  52. package/esm/parser/ini-parser.js +13 -0
  53. package/esm/types/index.js +71 -0
  54. package/esm/validation/errors.js +25 -0
  55. package/esm/validation/index.js +5 -0
  56. package/esm/validation/validate-input.js +53 -0
  57. package/package.json +54 -0
  58. package/typings/api/generate-report.d.cts +13 -0
  59. package/typings/api/generate-report.d.ts +13 -0
  60. package/typings/api/parse-files.d.cts +13 -0
  61. package/typings/api/parse-files.d.ts +13 -0
  62. package/typings/format/index.d.cts +5 -0
  63. package/typings/format/index.d.ts +5 -0
  64. package/typings/format/newline.d.cts +7 -0
  65. package/typings/format/newline.d.ts +7 -0
  66. package/typings/format/padding.d.cts +21 -0
  67. package/typings/format/padding.d.ts +21 -0
  68. package/typings/generator/format/decoder.d.cts +12 -0
  69. package/typings/generator/format/decoder.d.ts +12 -0
  70. package/typings/generator/format/encoder.d.cts +33 -0
  71. package/typings/generator/format/encoder.d.ts +33 -0
  72. package/typings/generator/format/index.d.cts +5 -0
  73. package/typings/generator/format/index.d.ts +5 -0
  74. package/typings/generator/index.d.cts +5 -0
  75. package/typings/generator/index.d.ts +5 -0
  76. package/typings/generator/records/a000.d.cts +4 -0
  77. package/typings/generator/records/a000.d.ts +4 -0
  78. package/typings/generator/records/a100.d.cts +4 -0
  79. package/typings/generator/records/a100.d.ts +4 -0
  80. package/typings/generator/records/b100.d.cts +4 -0
  81. package/typings/generator/records/b100.d.ts +4 -0
  82. package/typings/generator/records/b110.d.cts +4 -0
  83. package/typings/generator/records/b110.d.ts +4 -0
  84. package/typings/generator/records/c100.d.cts +4 -0
  85. package/typings/generator/records/c100.d.ts +4 -0
  86. package/typings/generator/records/d110.d.cts +4 -0
  87. package/typings/generator/records/d110.d.ts +4 -0
  88. package/typings/generator/records/d120.d.cts +4 -0
  89. package/typings/generator/records/d120.d.ts +4 -0
  90. package/typings/generator/records/index.d.cts +12 -0
  91. package/typings/generator/records/index.d.ts +12 -0
  92. package/typings/generator/records/m100.d.cts +4 -0
  93. package/typings/generator/records/m100.d.ts +4 -0
  94. package/typings/generator/records/z900.d.cts +4 -0
  95. package/typings/generator/records/z900.d.ts +4 -0
  96. package/typings/index.d.cts +12 -0
  97. package/typings/index.d.ts +12 -0
  98. package/typings/parser/data-parser.d.cts +10 -0
  99. package/typings/parser/data-parser.d.ts +10 -0
  100. package/typings/parser/index.d.cts +5 -0
  101. package/typings/parser/index.d.ts +5 -0
  102. package/typings/parser/ini-parser.d.cts +10 -0
  103. package/typings/parser/ini-parser.d.ts +10 -0
  104. package/typings/types/index.d.cts +371 -0
  105. package/typings/types/index.d.ts +371 -0
  106. package/typings/validation/errors.d.cts +15 -0
  107. package/typings/validation/errors.d.ts +15 -0
  108. package/typings/validation/index.d.cts +5 -0
  109. package/typings/validation/index.d.ts +5 -0
  110. package/typings/validation/validate-input.d.cts +12 -0
  111. package/typings/validation/validate-input.d.ts +12 -0
@@ -0,0 +1,5 @@
1
+ /**
2
+ * Format utilities for SHAAM uniform format files
3
+ */
4
+ export * from './padding.js';
5
+ export * from './newline.js';
@@ -0,0 +1,7 @@
1
+ /**
2
+ * Line ending constants for SHAAM format files
3
+ */
4
+ /**
5
+ * CRLF line ending as required by SHAAM format specification
6
+ */
7
+ export declare const CRLF = "\r\n";
@@ -0,0 +1,7 @@
1
+ /**
2
+ * Line ending constants for SHAAM format files
3
+ */
4
+ /**
5
+ * CRLF line ending as required by SHAAM format specification
6
+ */
7
+ export declare const CRLF = "\r\n";
@@ -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,5 @@
1
+ /**
2
+ * Format encoding and decoding utilities
3
+ */
4
+ export * from './encoder.cjs';
5
+ export * from './decoder.cjs';
@@ -0,0 +1,5 @@
1
+ /**
2
+ * Format encoding and decoding utilities
3
+ */
4
+ export * from './encoder.js';
5
+ export * from './decoder.js';
@@ -0,0 +1,5 @@
1
+ /**
2
+ * File generation utilities
3
+ */
4
+ export * from './records/index.cjs';
5
+ export * from './format/index.cjs';
@@ -0,0 +1,5 @@
1
+ /**
2
+ * File generation utilities
3
+ */
4
+ export * from './records/index.js';
5
+ export * from './format/index.js';
@@ -0,0 +1,4 @@
1
+ /**
2
+ * A000 - Header record for INI.TXT
3
+ */
4
+ export declare const A000_PLACEHOLDER = "A000";
@@ -0,0 +1,4 @@
1
+ /**
2
+ * A000 - Header record for INI.TXT
3
+ */
4
+ export declare const A000_PLACEHOLDER = "A000";
@@ -0,0 +1,4 @@
1
+ /**
2
+ * A100 - Opening record for BKMVDATA.TXT
3
+ */
4
+ export declare const A100_PLACEHOLDER = "A100";
@@ -0,0 +1,4 @@
1
+ /**
2
+ * A100 - Opening record for BKMVDATA.TXT
3
+ */
4
+ export declare const A100_PLACEHOLDER = "A100";
@@ -0,0 +1,4 @@
1
+ /**
2
+ * B100 - Journal entry line record
3
+ */
4
+ export declare const B100_PLACEHOLDER = "B100";
@@ -0,0 +1,4 @@
1
+ /**
2
+ * B100 - Journal entry line record
3
+ */
4
+ export declare const B100_PLACEHOLDER = "B100";
@@ -0,0 +1,4 @@
1
+ /**
2
+ * B110 - Account record
3
+ */
4
+ export declare const B110_PLACEHOLDER = "B110";
@@ -0,0 +1,4 @@
1
+ /**
2
+ * B110 - Account record
3
+ */
4
+ export declare const B110_PLACEHOLDER = "B110";
@@ -0,0 +1,4 @@
1
+ /**
2
+ * C100 - Document header record
3
+ */
4
+ export declare const C100_PLACEHOLDER = "C100";
@@ -0,0 +1,4 @@
1
+ /**
2
+ * C100 - Document header record
3
+ */
4
+ export declare const C100_PLACEHOLDER = "C100";
@@ -0,0 +1,4 @@
1
+ /**
2
+ * D110 - Document line record
3
+ */
4
+ export declare const D110_PLACEHOLDER = "D110";
@@ -0,0 +1,4 @@
1
+ /**
2
+ * D110 - Document line record
3
+ */
4
+ export declare const D110_PLACEHOLDER = "D110";
@@ -0,0 +1,4 @@
1
+ /**
2
+ * D120 - Payment/receipt record
3
+ */
4
+ export declare const D120_PLACEHOLDER = "D120";
@@ -0,0 +1,4 @@
1
+ /**
2
+ * D120 - Payment/receipt record
3
+ */
4
+ export declare const D120_PLACEHOLDER = "D120";
@@ -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,4 @@
1
+ /**
2
+ * M100 - Inventory item record
3
+ */
4
+ export declare const M100_PLACEHOLDER = "M100";
@@ -0,0 +1,4 @@
1
+ /**
2
+ * M100 - Inventory item record
3
+ */
4
+ export declare const M100_PLACEHOLDER = "M100";
@@ -0,0 +1,4 @@
1
+ /**
2
+ * Z900 - Closing record for BKMVDATA.TXT
3
+ */
4
+ export declare const Z900_PLACEHOLDER = "Z900";
@@ -0,0 +1,4 @@
1
+ /**
2
+ * Z900 - Closing record for BKMVDATA.TXT
3
+ */
4
+ export declare const Z900_PLACEHOLDER = "Z900";
@@ -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>;
@@ -0,0 +1,5 @@
1
+ /**
2
+ * File parsing utilities
3
+ */
4
+ export * from './ini-parser.cjs';
5
+ export * from './data-parser.cjs';
@@ -0,0 +1,5 @@
1
+ /**
2
+ * File parsing utilities
3
+ */
4
+ export * from './ini-parser.js';
5
+ export * from './data-parser.js';
@@ -0,0 +1,10 @@
1
+ /**
2
+ * INI.TXT file parsing utilities
3
+ */
4
+ /**
5
+ * Parses INI.TXT file content
6
+ *
7
+ * @param content - Raw INI.TXT file content
8
+ * @returns Parsed data structure
9
+ */
10
+ export declare function parseIniFile(_content: string): Record<string, unknown>;
@@ -0,0 +1,10 @@
1
+ /**
2
+ * INI.TXT file parsing utilities
3
+ */
4
+ /**
5
+ * Parses INI.TXT file content
6
+ *
7
+ * @param content - Raw INI.TXT file content
8
+ * @returns Parsed data structure
9
+ */
10
+ export declare function parseIniFile(_content: string): Record<string, unknown>;