@accounter/shaam-uniform-format-generator 0.1.0 → 0.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/README.md +366 -13
- package/dist/README.md +476 -0
- package/dist/cjs/api/generate-report-legacy.js +6 -0
- package/dist/cjs/api/generate-report.js +328 -0
- package/dist/cjs/constants.js +11 -0
- package/dist/cjs/generator/format/encoder.js +86 -0
- package/dist/cjs/generator/records/a000-sum.js +66 -0
- package/dist/cjs/generator/records/a000.js +349 -0
- package/dist/cjs/generator/records/a100.js +107 -0
- package/dist/cjs/generator/records/b100.js +305 -0
- package/dist/cjs/generator/records/b110.js +255 -0
- package/dist/cjs/generator/records/c100.js +338 -0
- package/dist/cjs/generator/records/d110.js +272 -0
- package/dist/cjs/generator/records/d120.js +278 -0
- package/{cjs → dist/cjs}/generator/records/index.js +1 -0
- package/dist/cjs/generator/records/m100.js +177 -0
- package/dist/cjs/generator/records/z900.js +93 -0
- package/{cjs → dist/cjs}/index.js +3 -0
- package/dist/cjs/records/a100.js +78 -0
- package/dist/cjs/records/index.js +20 -0
- package/dist/cjs/records/z900.js +82 -0
- package/dist/cjs/types/enums.js +457 -0
- package/{cjs → dist/cjs}/types/index.js +6 -1
- package/dist/cjs/utils/file-helpers.js +198 -0
- package/dist/cjs/utils/index.js +8 -0
- package/dist/cjs/utils/key-generator.js +71 -0
- package/dist/esm/api/generate-report-legacy.js +2 -0
- package/dist/esm/api/generate-report.js +325 -0
- package/dist/esm/constants.js +8 -0
- package/dist/esm/generator/format/encoder.js +77 -0
- package/dist/esm/generator/records/a000-sum.js +61 -0
- package/dist/esm/generator/records/a000.js +344 -0
- package/dist/esm/generator/records/a100.js +102 -0
- package/dist/esm/generator/records/b100.js +300 -0
- package/dist/esm/generator/records/b110.js +250 -0
- package/dist/esm/generator/records/c100.js +333 -0
- package/dist/esm/generator/records/d110.js +267 -0
- package/dist/esm/generator/records/d120.js +273 -0
- package/{esm → dist/esm}/generator/records/index.js +1 -0
- package/dist/esm/generator/records/m100.js +172 -0
- package/dist/esm/generator/records/z900.js +88 -0
- package/{esm → dist/esm}/index.js +3 -0
- package/dist/esm/records/a100.js +73 -0
- package/dist/esm/records/index.js +11 -0
- package/dist/esm/records/z900.js +77 -0
- package/dist/esm/types/enums.js +454 -0
- package/{esm → dist/esm}/types/index.js +5 -1
- package/dist/esm/utils/file-helpers.js +188 -0
- package/dist/esm/utils/index.js +5 -0
- package/dist/esm/utils/key-generator.js +65 -0
- package/dist/package.json +54 -0
- package/dist/typings/api/generate-report-legacy.d.cts +1 -0
- package/dist/typings/api/generate-report-legacy.d.ts +1 -0
- package/dist/typings/constants.d.cts +8 -0
- package/dist/typings/constants.d.ts +8 -0
- package/dist/typings/generator/format/encoder.d.cts +57 -0
- package/dist/typings/generator/format/encoder.d.ts +57 -0
- package/dist/typings/generator/records/a000-sum.d.cts +40 -0
- package/dist/typings/generator/records/a000-sum.d.ts +40 -0
- package/dist/typings/generator/records/a000.d.cts +238 -0
- package/dist/typings/generator/records/a000.d.ts +238 -0
- package/dist/typings/generator/records/a100.d.cts +59 -0
- package/dist/typings/generator/records/a100.d.ts +59 -0
- package/dist/typings/generator/records/b100.d.cts +101 -0
- package/dist/typings/generator/records/b100.d.ts +101 -0
- package/dist/typings/generator/records/b110.d.cts +89 -0
- package/dist/typings/generator/records/b110.d.ts +89 -0
- package/dist/typings/generator/records/c100.d.cts +133 -0
- package/dist/typings/generator/records/c100.d.ts +133 -0
- package/dist/typings/generator/records/d110.d.cts +98 -0
- package/dist/typings/generator/records/d110.d.ts +98 -0
- package/dist/typings/generator/records/d120.d.cts +95 -0
- package/dist/typings/generator/records/d120.d.ts +95 -0
- package/{typings → dist/typings}/generator/records/index.d.cts +1 -0
- package/{typings → dist/typings}/generator/records/index.d.ts +1 -0
- package/dist/typings/generator/records/m100.d.cts +69 -0
- package/dist/typings/generator/records/m100.d.ts +69 -0
- package/dist/typings/generator/records/z900.d.cts +61 -0
- package/dist/typings/generator/records/z900.d.ts +61 -0
- package/{typings → dist/typings}/index.d.cts +3 -0
- package/{typings → dist/typings}/index.d.ts +3 -0
- package/dist/typings/records/a100.d.cts +35 -0
- package/dist/typings/records/a100.d.ts +35 -0
- package/dist/typings/records/index.d.cts +2 -0
- package/dist/typings/records/index.d.ts +2 -0
- package/dist/typings/records/z900.d.cts +38 -0
- package/dist/typings/records/z900.d.ts +38 -0
- package/dist/typings/types/enums.d.cts +162 -0
- package/dist/typings/types/enums.d.ts +162 -0
- package/{typings → dist/typings}/types/index.d.cts +17 -14
- package/{typings → dist/typings}/types/index.d.ts +17 -14
- package/dist/typings/utils/file-helpers.d.cts +131 -0
- package/dist/typings/utils/file-helpers.d.ts +131 -0
- package/dist/typings/utils/index.d.cts +5 -0
- package/dist/typings/utils/index.d.ts +5 -0
- package/dist/typings/utils/key-generator.d.cts +41 -0
- package/dist/typings/utils/key-generator.d.ts +41 -0
- package/documentation/IncomeTax_IncomeTaxSoftwareHousesInfo_horaot1.31_2_05.pdf +0 -0
- package/documentation/_4D6963726F736F667420576F7264202D20F8E5E0E9ED20F8E7E5F720F8E5E0E9ED20F9F7E5F32E646F63_.pdf +0 -0
- package/documentation/a000-sum.csv +3 -0
- package/documentation/a000.csv +37 -0
- package/documentation/a100.csv +7 -0
- package/documentation/b100.csv +29 -0
- package/documentation/b110.csv +26 -0
- package/documentation/c100.csv +37 -0
- package/documentation/d110.csv +27 -0
- package/documentation/d120.csv +26 -0
- package/documentation/m100.csv +17 -0
- package/documentation/z900.csv +8 -0
- package/package.json +50 -29
- package/prompt_plan.md +259 -0
- package/spec.md +206 -0
- package/src/api/generate-report.ts +366 -0
- package/src/api/parse-files.ts +33 -0
- package/src/constants.ts +9 -0
- package/src/format/index.ts +6 -0
- package/src/format/newline.ts +8 -0
- package/src/format/padding.ts +39 -0
- package/src/generator/format/decoder.ts +15 -0
- package/src/generator/format/encoder.ts +95 -0
- package/src/generator/format/index.ts +6 -0
- package/src/generator/index.ts +6 -0
- package/src/generator/records/a000-sum.ts +78 -0
- package/src/generator/records/a000.ts +373 -0
- package/src/generator/records/a100.ts +118 -0
- package/src/generator/records/b100.ts +317 -0
- package/src/generator/records/b110.ts +267 -0
- package/src/generator/records/c100.ts +347 -0
- package/src/generator/records/d110.ts +286 -0
- package/src/generator/records/d120.ts +293 -0
- package/src/generator/records/index.ts +14 -0
- package/src/generator/records/m100.ts +185 -0
- package/src/generator/records/z900.ts +104 -0
- package/src/index.ts +18 -0
- package/src/parser/data-parser.ts +14 -0
- package/src/parser/index.ts +6 -0
- package/src/parser/ini-parser.ts +14 -0
- package/src/types/enums.ts +531 -0
- package/src/types/index.ts +110 -0
- package/src/utils/file-helpers.ts +221 -0
- package/src/utils/index.ts +6 -0
- package/src/utils/key-generator.ts +75 -0
- package/src/validation/errors.ts +35 -0
- package/src/validation/index.ts +6 -0
- package/src/validation/validate-input.ts +67 -0
- package/tests/debug-output.test.ts +81 -0
- package/tests/format/crlf-join.test.ts +124 -0
- package/tests/format/encoder.test.ts +80 -0
- package/tests/format/newline.test.ts +19 -0
- package/tests/format/padding.test.ts +74 -0
- package/tests/index.test.ts +29 -0
- package/tests/ini-text.test.ts +122 -0
- package/tests/integration/comprehensive.integration.test.ts +350 -0
- package/tests/integration/roundtrip.integration.test.ts +377 -0
- package/tests/records/a000-sum.test.ts +278 -0
- package/tests/records/a000.test.ts +318 -0
- package/tests/records/a100.test.ts +239 -0
- package/tests/records/b100.test.ts +419 -0
- package/tests/records/b110.test.ts +445 -0
- package/tests/records/c100.test.ts +333 -0
- package/tests/records/d110.test.ts +93 -0
- package/tests/records/d120.test.ts +275 -0
- package/tests/records/m100.test.ts +437 -0
- package/tests/records/z900.test.ts +254 -0
- package/tests/types/enums.test.ts +290 -0
- package/tests/utils/file-helpers.test.ts +276 -0
- package/tests/utils/key-generator.test.ts +121 -0
- package/tests/validation/document-type-validation.test.ts +521 -0
- package/tests/validation/validate-input.test.ts +219 -0
- package/todo.md +203 -0
- package/tsconfig.json +10 -0
- package/vitest.config.ts +11 -0
- package/cjs/api/generate-report.js +0 -53
- package/cjs/generator/format/encoder.js +0 -46
- package/cjs/generator/records/a000.js +0 -8
- package/cjs/generator/records/a100.js +0 -8
- package/cjs/generator/records/b100.js +0 -8
- package/cjs/generator/records/b110.js +0 -8
- package/cjs/generator/records/c100.js +0 -8
- package/cjs/generator/records/d110.js +0 -8
- package/cjs/generator/records/d120.js +0 -8
- package/cjs/generator/records/m100.js +0 -8
- package/cjs/generator/records/z900.js +0 -8
- package/esm/api/generate-report.js +0 -50
- package/esm/generator/format/encoder.js +0 -42
- package/esm/generator/records/a000.js +0 -5
- package/esm/generator/records/a100.js +0 -5
- package/esm/generator/records/b100.js +0 -5
- package/esm/generator/records/b110.js +0 -5
- package/esm/generator/records/c100.js +0 -5
- package/esm/generator/records/d110.js +0 -5
- package/esm/generator/records/d120.js +0 -5
- package/esm/generator/records/m100.js +0 -5
- package/esm/generator/records/z900.js +0 -5
- package/typings/generator/format/encoder.d.cts +0 -33
- package/typings/generator/format/encoder.d.ts +0 -33
- package/typings/generator/records/a000.d.cts +0 -4
- package/typings/generator/records/a000.d.ts +0 -4
- package/typings/generator/records/a100.d.cts +0 -4
- package/typings/generator/records/a100.d.ts +0 -4
- package/typings/generator/records/b100.d.cts +0 -4
- package/typings/generator/records/b100.d.ts +0 -4
- package/typings/generator/records/b110.d.cts +0 -4
- package/typings/generator/records/b110.d.ts +0 -4
- package/typings/generator/records/c100.d.cts +0 -4
- package/typings/generator/records/c100.d.ts +0 -4
- package/typings/generator/records/d110.d.cts +0 -4
- package/typings/generator/records/d110.d.ts +0 -4
- package/typings/generator/records/d120.d.cts +0 -4
- package/typings/generator/records/d120.d.ts +0 -4
- package/typings/generator/records/m100.d.cts +0 -4
- package/typings/generator/records/m100.d.ts +0 -4
- package/typings/generator/records/z900.d.cts +0 -4
- package/typings/generator/records/z900.d.ts +0 -4
- /package/{cjs → dist/cjs}/api/parse-files.js +0 -0
- /package/{cjs → dist/cjs}/format/index.js +0 -0
- /package/{cjs → dist/cjs}/format/newline.js +0 -0
- /package/{cjs → dist/cjs}/format/padding.js +0 -0
- /package/{cjs → dist/cjs}/generator/format/decoder.js +0 -0
- /package/{cjs → dist/cjs}/generator/format/index.js +0 -0
- /package/{cjs → dist/cjs}/generator/index.js +0 -0
- /package/{cjs → dist/cjs}/package.json +0 -0
- /package/{cjs → dist/cjs}/parser/data-parser.js +0 -0
- /package/{cjs → dist/cjs}/parser/index.js +0 -0
- /package/{cjs → dist/cjs}/parser/ini-parser.js +0 -0
- /package/{cjs → dist/cjs}/validation/errors.js +0 -0
- /package/{cjs → dist/cjs}/validation/index.js +0 -0
- /package/{cjs → dist/cjs}/validation/validate-input.js +0 -0
- /package/{esm → dist/esm}/api/parse-files.js +0 -0
- /package/{esm → dist/esm}/format/index.js +0 -0
- /package/{esm → dist/esm}/format/newline.js +0 -0
- /package/{esm → dist/esm}/format/padding.js +0 -0
- /package/{esm → dist/esm}/generator/format/decoder.js +0 -0
- /package/{esm → dist/esm}/generator/format/index.js +0 -0
- /package/{esm → dist/esm}/generator/index.js +0 -0
- /package/{esm → dist/esm}/parser/data-parser.js +0 -0
- /package/{esm → dist/esm}/parser/index.js +0 -0
- /package/{esm → dist/esm}/parser/ini-parser.js +0 -0
- /package/{esm → dist/esm}/validation/errors.js +0 -0
- /package/{esm → dist/esm}/validation/index.js +0 -0
- /package/{esm → dist/esm}/validation/validate-input.js +0 -0
- /package/{typings → dist/typings}/api/generate-report.d.cts +0 -0
- /package/{typings → dist/typings}/api/generate-report.d.ts +0 -0
- /package/{typings → dist/typings}/api/parse-files.d.cts +0 -0
- /package/{typings → dist/typings}/api/parse-files.d.ts +0 -0
- /package/{typings → dist/typings}/format/index.d.cts +0 -0
- /package/{typings → dist/typings}/format/index.d.ts +0 -0
- /package/{typings → dist/typings}/format/newline.d.cts +0 -0
- /package/{typings → dist/typings}/format/newline.d.ts +0 -0
- /package/{typings → dist/typings}/format/padding.d.cts +0 -0
- /package/{typings → dist/typings}/format/padding.d.ts +0 -0
- /package/{typings → dist/typings}/generator/format/decoder.d.cts +0 -0
- /package/{typings → dist/typings}/generator/format/decoder.d.ts +0 -0
- /package/{typings → dist/typings}/generator/format/index.d.cts +0 -0
- /package/{typings → dist/typings}/generator/format/index.d.ts +0 -0
- /package/{typings → dist/typings}/generator/index.d.cts +0 -0
- /package/{typings → dist/typings}/generator/index.d.ts +0 -0
- /package/{typings → dist/typings}/parser/data-parser.d.cts +0 -0
- /package/{typings → dist/typings}/parser/data-parser.d.ts +0 -0
- /package/{typings → dist/typings}/parser/index.d.cts +0 -0
- /package/{typings → dist/typings}/parser/index.d.ts +0 -0
- /package/{typings → dist/typings}/parser/ini-parser.d.cts +0 -0
- /package/{typings → dist/typings}/parser/ini-parser.d.ts +0 -0
- /package/{typings → dist/typings}/validation/errors.d.cts +0 -0
- /package/{typings → dist/typings}/validation/errors.d.ts +0 -0
- /package/{typings → dist/typings}/validation/index.d.cts +0 -0
- /package/{typings → dist/typings}/validation/index.d.ts +0 -0
- /package/{typings → dist/typings}/validation/validate-input.d.cts +0 -0
- /package/{typings → dist/typings}/validation/validate-input.d.ts +0 -0
|
@@ -0,0 +1,531 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* SHAAM Uniform Format Enums and Code Tables
|
|
3
|
+
* Based on SHAAM specification version 1.31
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
import { z } from 'zod';
|
|
7
|
+
|
|
8
|
+
// ================================================================================
|
|
9
|
+
// RECORD TYPE CODES
|
|
10
|
+
// ================================================================================
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* SHAAM Record Type Codes
|
|
14
|
+
* Used to identify the type of each record in the format
|
|
15
|
+
*/
|
|
16
|
+
export const RecordTypeEnum = z.enum([
|
|
17
|
+
'A000', // Header record (INI.TXT)
|
|
18
|
+
'A100', // Business opening record
|
|
19
|
+
'B100', // Journal entry line record
|
|
20
|
+
'B110', // Account record
|
|
21
|
+
'C100', // Document header record
|
|
22
|
+
'D110', // Document line record
|
|
23
|
+
'D120', // Payment/receipt record
|
|
24
|
+
'M100', // Inventory item record
|
|
25
|
+
'Z900', // Closing record
|
|
26
|
+
]);
|
|
27
|
+
|
|
28
|
+
export type RecordType = z.infer<typeof RecordTypeEnum>;
|
|
29
|
+
|
|
30
|
+
// ================================================================================
|
|
31
|
+
// DOCUMENT TYPES (Appendix 1)
|
|
32
|
+
// ================================================================================
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* Document Type Enum for SHAAM format
|
|
36
|
+
* Based on Appendix 1 of the SHAAM specification
|
|
37
|
+
*/
|
|
38
|
+
export const DocumentTypeEnum = z.enum([
|
|
39
|
+
'100', // הזמנה - Order
|
|
40
|
+
'200', // תעודת משלוח - Delivery Note
|
|
41
|
+
'210', // תעודת החזרה - Return Note
|
|
42
|
+
'300', // חשבונית / חשבונית עסקה - Invoice / Transaction Invoice
|
|
43
|
+
'305', // חשבונית מס - Tax Invoice
|
|
44
|
+
'320', // חשבונית מס קבלה - Receipt Tax Invoice
|
|
45
|
+
'325', // תעודת זיכוי - Credit Note
|
|
46
|
+
'330', // חשבונית מס זיכוי - Credit Tax Invoice
|
|
47
|
+
'340', // קבלה - Receipt
|
|
48
|
+
'400', // תעודת חיוב - Debit Note
|
|
49
|
+
'410', // תעודת זיכוי כללי - General Credit Note
|
|
50
|
+
'420', // תעודת העברה - Transfer Note
|
|
51
|
+
'430', // מסמך רכש - Purchase Document
|
|
52
|
+
'500', // חשבון ספק - Supplier Invoice
|
|
53
|
+
'600', // קבלה מרוכזת - Consolidated Receipt
|
|
54
|
+
'700', // חיוב/זיכוי כרטיס אשראי - Credit Card Charge/Credit
|
|
55
|
+
'710', // קבלה - כרטיס אשראי - Credit Card Receipt
|
|
56
|
+
]);
|
|
57
|
+
|
|
58
|
+
export type DocumentType = z.infer<typeof DocumentTypeEnum>;
|
|
59
|
+
|
|
60
|
+
/**
|
|
61
|
+
* Document Type Labels in Hebrew
|
|
62
|
+
*/
|
|
63
|
+
export const DocumentTypeLabels: Record<DocumentType, string> = {
|
|
64
|
+
'100': 'הזמנה',
|
|
65
|
+
'200': 'תעודת משלוח',
|
|
66
|
+
'210': 'תעודת החזרה',
|
|
67
|
+
'300': 'חשבונית / חשבונית עסקה',
|
|
68
|
+
'305': 'חשבונית מס',
|
|
69
|
+
'320': 'חשבונית מס קבלה',
|
|
70
|
+
'325': 'תעודת זיכוי',
|
|
71
|
+
'330': 'חשבונית מס זיכוי',
|
|
72
|
+
'340': 'קבלה',
|
|
73
|
+
'400': 'תעודת חיוב',
|
|
74
|
+
'410': 'תעודת זיכוי כללי',
|
|
75
|
+
'420': 'תעודת העברה',
|
|
76
|
+
'430': 'מסמך רכש',
|
|
77
|
+
'500': 'חשבון ספק',
|
|
78
|
+
'600': 'קבלה מרוכזת',
|
|
79
|
+
'700': 'חיוב/זיכוי כרטיס אשראי',
|
|
80
|
+
'710': 'קבלה - כרטיס אשראי',
|
|
81
|
+
};
|
|
82
|
+
|
|
83
|
+
/**
|
|
84
|
+
* Document Type Labels in English
|
|
85
|
+
*/
|
|
86
|
+
export const DocumentTypeLabelsEn: Record<DocumentType, string> = {
|
|
87
|
+
'100': 'Order',
|
|
88
|
+
'200': 'Delivery Note',
|
|
89
|
+
'210': 'Return Note',
|
|
90
|
+
'300': 'Invoice / Transaction Invoice',
|
|
91
|
+
'305': 'Tax Invoice',
|
|
92
|
+
'320': 'Receipt Tax Invoice',
|
|
93
|
+
'325': 'Credit Note',
|
|
94
|
+
'330': 'Credit Tax Invoice',
|
|
95
|
+
'340': 'Receipt',
|
|
96
|
+
'400': 'Debit Note',
|
|
97
|
+
'410': 'General Credit Note',
|
|
98
|
+
'420': 'Transfer Note',
|
|
99
|
+
'430': 'Purchase Document',
|
|
100
|
+
'500': 'Supplier Invoice',
|
|
101
|
+
'600': 'Consolidated Receipt',
|
|
102
|
+
'700': 'Credit Card Charge/Credit',
|
|
103
|
+
'710': 'Credit Card Receipt',
|
|
104
|
+
};
|
|
105
|
+
|
|
106
|
+
// ================================================================================
|
|
107
|
+
// CURRENCY CODES (Appendix 2)
|
|
108
|
+
// ================================================================================
|
|
109
|
+
|
|
110
|
+
/**
|
|
111
|
+
* Currency Code Enum for SHAAM format
|
|
112
|
+
* Based on Appendix 2 of the SHAAM specification
|
|
113
|
+
* Using ISO 4217 currency codes
|
|
114
|
+
*/
|
|
115
|
+
export const CurrencyCodeEnum = z.enum([
|
|
116
|
+
'ILS', // Israeli New Shekel (שקל חדש)
|
|
117
|
+
'USD', // US Dollar (דולר אמריקאי)
|
|
118
|
+
'EUR', // Euro (יורו)
|
|
119
|
+
'GBP', // British Pound (לירה שטרלינג)
|
|
120
|
+
'JPY', // Japanese Yen (ין יפני)
|
|
121
|
+
'CAD', // Canadian Dollar (דולר קנדי)
|
|
122
|
+
'AUD', // Australian Dollar (דולר אוסטרלי)
|
|
123
|
+
'CHF', // Swiss Franc (פרנק שוויצרי)
|
|
124
|
+
'SEK', // Swedish Krona (כתר שוודי)
|
|
125
|
+
'NOK', // Norwegian Krone (כתר נורווגי)
|
|
126
|
+
'DKK', // Danish Krone (כתר דני)
|
|
127
|
+
'CNY', // Chinese Yuan (יואן סיני)
|
|
128
|
+
'HKD', // Hong Kong Dollar (דולר הונג קונג)
|
|
129
|
+
'SGD', // Singapore Dollar (דולר סינגפורי)
|
|
130
|
+
'NZD', // New Zealand Dollar (דולר ניו זילנדי)
|
|
131
|
+
'ZAR', // South African Rand (ראנד דרום אפריקאי)
|
|
132
|
+
'RUB', // Russian Ruble (רובל רוסי)
|
|
133
|
+
'BRL', // Brazilian Real (ריאל ברזילאי)
|
|
134
|
+
'MXN', // Mexican Peso (פסו מקסיקני)
|
|
135
|
+
'INR', // Indian Rupee (רופי הודי)
|
|
136
|
+
'THB', // Thai Baht (באט תאילנדי)
|
|
137
|
+
'KRW', // South Korean Won (וון דרום קוריאני)
|
|
138
|
+
'TRY', // Turkish Lira (לירה טורקית)
|
|
139
|
+
'PLN', // Polish Zloty (זלוטי פולני)
|
|
140
|
+
'CZK', // Czech Koruna (כתר צ'כי)
|
|
141
|
+
'HUF', // Hungarian Forint (פורינט הונגרי)
|
|
142
|
+
]);
|
|
143
|
+
|
|
144
|
+
export type CurrencyCode = z.infer<typeof CurrencyCodeEnum>;
|
|
145
|
+
|
|
146
|
+
/**
|
|
147
|
+
* Currency Labels in Hebrew
|
|
148
|
+
*/
|
|
149
|
+
export const CurrencyLabels: Record<CurrencyCode, string> = {
|
|
150
|
+
ILS: 'שקל חדש',
|
|
151
|
+
USD: 'דולר אמריקאי',
|
|
152
|
+
EUR: 'יורו',
|
|
153
|
+
GBP: 'לירה שטרלינג',
|
|
154
|
+
JPY: 'ין יפני',
|
|
155
|
+
CAD: 'דולר קנדי',
|
|
156
|
+
AUD: 'דולר אוסטרלי',
|
|
157
|
+
CHF: 'פרנק שוויצרי',
|
|
158
|
+
SEK: 'כתר שוודי',
|
|
159
|
+
NOK: 'כתר נורווגי',
|
|
160
|
+
DKK: 'כתר דני',
|
|
161
|
+
CNY: 'יואן סיני',
|
|
162
|
+
HKD: 'דולר הונג קונג',
|
|
163
|
+
SGD: 'דולר סינגפורי',
|
|
164
|
+
NZD: 'דולר ניו זילנדי',
|
|
165
|
+
ZAR: 'ראנד דרום אפריקאי',
|
|
166
|
+
RUB: 'רובל רוסי',
|
|
167
|
+
BRL: 'ריאל ברזילאי',
|
|
168
|
+
MXN: 'פסו מקסיקני',
|
|
169
|
+
INR: 'רופי הודי',
|
|
170
|
+
THB: 'באט תאילנדי',
|
|
171
|
+
KRW: 'וון דרום קוריאני',
|
|
172
|
+
TRY: 'לירה טורקית',
|
|
173
|
+
PLN: 'זלוטי פולני',
|
|
174
|
+
CZK: 'כתר צכי',
|
|
175
|
+
HUF: 'פורינט הונגרי',
|
|
176
|
+
};
|
|
177
|
+
|
|
178
|
+
// ================================================================================
|
|
179
|
+
// SOFTWARE AND SYSTEM ENUMS
|
|
180
|
+
// ================================================================================
|
|
181
|
+
|
|
182
|
+
/**
|
|
183
|
+
* Software Type (Field 1011)
|
|
184
|
+
* Type of accounting software
|
|
185
|
+
*/
|
|
186
|
+
export const SoftwareTypeEnum = z.enum(['1', '2']);
|
|
187
|
+
export type SoftwareType = z.infer<typeof SoftwareTypeEnum>;
|
|
188
|
+
|
|
189
|
+
export const SoftwareTypeLabels: Record<SoftwareType, string> = {
|
|
190
|
+
'1': 'Single-year', // תוכנה חד-שנתית
|
|
191
|
+
'2': 'Multi-year', // תוכנה רב-שנתית
|
|
192
|
+
};
|
|
193
|
+
|
|
194
|
+
/**
|
|
195
|
+
* Accounting Type (Field 1013)
|
|
196
|
+
* Type of bookkeeping system
|
|
197
|
+
*/
|
|
198
|
+
export const AccountingTypeEnum = z.enum(['0', '1', '2']);
|
|
199
|
+
export type AccountingType = z.infer<typeof AccountingTypeEnum>;
|
|
200
|
+
|
|
201
|
+
export const AccountingTypeLabels: Record<AccountingType, string> = {
|
|
202
|
+
'0': 'N/A', // לא רלוונטי
|
|
203
|
+
'1': 'Single-entry', // הנהלת חשבונות יחידה
|
|
204
|
+
'2': 'Double-entry', // הנהלת חשבונות כפולה
|
|
205
|
+
};
|
|
206
|
+
|
|
207
|
+
/**
|
|
208
|
+
* Balance Required Flag (Field 1014)
|
|
209
|
+
* Whether balance verification is required
|
|
210
|
+
*/
|
|
211
|
+
export const BalanceRequiredEnum = z.enum(['0', '1']);
|
|
212
|
+
export type BalanceRequired = z.infer<typeof BalanceRequiredEnum>;
|
|
213
|
+
|
|
214
|
+
export const BalanceRequiredLabels: Record<BalanceRequired, string> = {
|
|
215
|
+
'0': 'Not required', // לא נדרש
|
|
216
|
+
'1': 'Required', // נדרש
|
|
217
|
+
};
|
|
218
|
+
|
|
219
|
+
/**
|
|
220
|
+
* Language Code (Field 1031)
|
|
221
|
+
* Language used in the report
|
|
222
|
+
*/
|
|
223
|
+
export const LanguageCodeEnum = z.enum(['0', '1', '2']);
|
|
224
|
+
export type LanguageCode = z.infer<typeof LanguageCodeEnum>;
|
|
225
|
+
|
|
226
|
+
export const LanguageCodeLabels: Record<LanguageCode, string> = {
|
|
227
|
+
'0': 'Hebrew', // עברית
|
|
228
|
+
'1': 'Arabic', // ערבית
|
|
229
|
+
'2': 'Other', // אחר
|
|
230
|
+
};
|
|
231
|
+
|
|
232
|
+
/**
|
|
233
|
+
* Character Encoding (Field 1032)
|
|
234
|
+
* Character encoding used in the file
|
|
235
|
+
*/
|
|
236
|
+
export const CharacterEncodingEnum = z.enum(['1', '2']);
|
|
237
|
+
export type CharacterEncoding = z.infer<typeof CharacterEncodingEnum>;
|
|
238
|
+
|
|
239
|
+
export const CharacterEncodingLabels: Record<CharacterEncoding, string> = {
|
|
240
|
+
'1': 'ISO-8859-8-i', // ISO-8859-8-i
|
|
241
|
+
'2': 'CP-862', // CP-862
|
|
242
|
+
};
|
|
243
|
+
|
|
244
|
+
/**
|
|
245
|
+
* Branch Info Flag (Field 1034)
|
|
246
|
+
* Whether the business has branches
|
|
247
|
+
*/
|
|
248
|
+
export const BranchInfoFlagEnum = z.enum(['0', '1']);
|
|
249
|
+
export type BranchInfoFlag = z.infer<typeof BranchInfoFlagEnum>;
|
|
250
|
+
|
|
251
|
+
export const BranchInfoFlagLabels: Record<BranchInfoFlag, string> = {
|
|
252
|
+
'0': 'No branches', // אין סניפים
|
|
253
|
+
'1': 'Has branches', // יש סניפים
|
|
254
|
+
};
|
|
255
|
+
|
|
256
|
+
// ================================================================================
|
|
257
|
+
// TRANSACTION AND ACCOUNTING ENUMS
|
|
258
|
+
// ================================================================================
|
|
259
|
+
|
|
260
|
+
/**
|
|
261
|
+
* Debit/Credit Indicator (Field 1366)
|
|
262
|
+
* Whether the transaction is a debit or credit
|
|
263
|
+
*/
|
|
264
|
+
export const DebitCreditIndicatorEnum = z.enum(['1', '2']);
|
|
265
|
+
export type DebitCreditIndicator = z.infer<typeof DebitCreditIndicatorEnum>;
|
|
266
|
+
|
|
267
|
+
export const DebitCreditIndicatorLabels: Record<DebitCreditIndicator, string> = {
|
|
268
|
+
'1': 'Debit', // חובה
|
|
269
|
+
'2': 'Credit', // זכות
|
|
270
|
+
};
|
|
271
|
+
|
|
272
|
+
/**
|
|
273
|
+
* Payment Method Codes
|
|
274
|
+
* Common payment methods used in D120 records
|
|
275
|
+
*/
|
|
276
|
+
export const PaymentMethodEnum = z.enum([
|
|
277
|
+
'1', // מזומן - Cash
|
|
278
|
+
'2', // שיק - Check
|
|
279
|
+
'3', // כרטיס אשראי - Credit Card
|
|
280
|
+
'4', // העברה בנקאית - Bank Transfer
|
|
281
|
+
'5', // הוראת קבע - Standing Order
|
|
282
|
+
'6', // אחר - Other
|
|
283
|
+
]);
|
|
284
|
+
export type PaymentMethod = z.infer<typeof PaymentMethodEnum>;
|
|
285
|
+
|
|
286
|
+
export const PaymentMethodLabels: Record<PaymentMethod, string> = {
|
|
287
|
+
'1': 'Cash', // מזומן
|
|
288
|
+
'2': 'Check', // שיק
|
|
289
|
+
'3': 'Credit Card', // כרטיס אשראי
|
|
290
|
+
'4': 'Bank Transfer', // העברה בנקאית
|
|
291
|
+
'5': 'Standing Order', // הוראת קבע
|
|
292
|
+
'6': 'Other', // אחר
|
|
293
|
+
};
|
|
294
|
+
|
|
295
|
+
// ================================================================================
|
|
296
|
+
// ACCOUNT AND BUSINESS ENUMS
|
|
297
|
+
// ================================================================================
|
|
298
|
+
|
|
299
|
+
/**
|
|
300
|
+
* Trial Balance Codes
|
|
301
|
+
* Common account types used in chart of accounts
|
|
302
|
+
*/
|
|
303
|
+
export const TrialBalanceCodeEnum = z.enum([
|
|
304
|
+
'Asset', // נכסים
|
|
305
|
+
'Liability', // התחייבויות
|
|
306
|
+
'Equity', // הון
|
|
307
|
+
'Revenue', // הכנסות
|
|
308
|
+
'Expense', // הוצאות
|
|
309
|
+
'Other', // אחר
|
|
310
|
+
]);
|
|
311
|
+
export type TrialBalanceCode = z.infer<typeof TrialBalanceCodeEnum>;
|
|
312
|
+
|
|
313
|
+
export const TrialBalanceCodeLabels: Record<TrialBalanceCode, string> = {
|
|
314
|
+
Asset: 'נכסים',
|
|
315
|
+
Liability: 'התחייבויות',
|
|
316
|
+
Equity: 'הון',
|
|
317
|
+
Revenue: 'הכנסות',
|
|
318
|
+
Expense: 'הוצאות',
|
|
319
|
+
Other: 'אחר',
|
|
320
|
+
};
|
|
321
|
+
|
|
322
|
+
// ================================================================================
|
|
323
|
+
// COUNTRY CODES
|
|
324
|
+
// ================================================================================
|
|
325
|
+
|
|
326
|
+
/**
|
|
327
|
+
* Country Codes (ISO 3166-1 alpha-2)
|
|
328
|
+
* Used for addresses and international transactions
|
|
329
|
+
*/
|
|
330
|
+
export const CountryCodeEnum = z.enum([
|
|
331
|
+
'IL', // Israel - ישראל
|
|
332
|
+
'US', // United States - ארצות הברית
|
|
333
|
+
'GB', // United Kingdom - בריטניה
|
|
334
|
+
'DE', // Germany - גרמניה
|
|
335
|
+
'FR', // France - צרפת
|
|
336
|
+
'IT', // Italy - איטליה
|
|
337
|
+
'ES', // Spain - ספרד
|
|
338
|
+
'NL', // Netherlands - הולנד
|
|
339
|
+
'BE', // Belgium - בלגיה
|
|
340
|
+
'CH', // Switzerland - שוויץ
|
|
341
|
+
'AT', // Austria - אוסטריה
|
|
342
|
+
'SE', // Sweden - שוודיה
|
|
343
|
+
'NO', // Norway - נורווגיה
|
|
344
|
+
'DK', // Denmark - דנמרק
|
|
345
|
+
'FI', // Finland - פינלנד
|
|
346
|
+
'IE', // Ireland - אירלנד
|
|
347
|
+
'PT', // Portugal - פורטוגל
|
|
348
|
+
'GR', // Greece - יוון
|
|
349
|
+
'PL', // Poland - פולין
|
|
350
|
+
'CZ', // Czech Republic - צ'כיה
|
|
351
|
+
'HU', // Hungary - הונגריה
|
|
352
|
+
'SK', // Slovakia - סלובקיה
|
|
353
|
+
'SI', // Slovenia - סלובניה
|
|
354
|
+
'HR', // Croatia - קרואטיה
|
|
355
|
+
'BG', // Bulgaria - בולגריה
|
|
356
|
+
'RO', // Romania - רומניה
|
|
357
|
+
'LT', // Lithuania - ליטא
|
|
358
|
+
'LV', // Latvia - לטביה
|
|
359
|
+
'EE', // Estonia - אסטוניה
|
|
360
|
+
'MT', // Malta - מלטה
|
|
361
|
+
'CY', // Cyprus - קפריסין
|
|
362
|
+
'LU', // Luxembourg - לוקסמבורג
|
|
363
|
+
'CA', // Canada - קנדה
|
|
364
|
+
'MX', // Mexico - מקסיקו
|
|
365
|
+
'JP', // Japan - יפן
|
|
366
|
+
'CN', // China - סין
|
|
367
|
+
'KR', // South Korea - דרום קוריאה
|
|
368
|
+
'IN', // India - הודו
|
|
369
|
+
'AU', // Australia - אוסטרליה
|
|
370
|
+
'NZ', // New Zealand - ניו זילנד
|
|
371
|
+
'ZA', // South Africa - דרום אפריקה
|
|
372
|
+
'BR', // Brazil - ברזיל
|
|
373
|
+
'AR', // Argentina - ארגנטינה
|
|
374
|
+
'CL', // Chile - צ'ילה
|
|
375
|
+
'SG', // Singapore - סינגפור
|
|
376
|
+
'HK', // Hong Kong - הונג קונג
|
|
377
|
+
'TH', // Thailand - תאילנד
|
|
378
|
+
'MY', // Malaysia - מלזיה
|
|
379
|
+
'ID', // Indonesia - אינדונזיה
|
|
380
|
+
'PH', // Philippines - פיליפינים
|
|
381
|
+
'VN', // Vietnam - וייטנאם
|
|
382
|
+
'AE', // United Arab Emirates - איחוד האמירויות הערביות
|
|
383
|
+
'SA', // Saudi Arabia - סעודיה
|
|
384
|
+
'EG', // Egypt - מצרים
|
|
385
|
+
'TR', // Turkey - טורקיה
|
|
386
|
+
'RU', // Russia - רוסיה
|
|
387
|
+
'UA', // Ukraine - אוקראינה
|
|
388
|
+
]);
|
|
389
|
+
|
|
390
|
+
export type CountryCode = z.infer<typeof CountryCodeEnum>;
|
|
391
|
+
|
|
392
|
+
/**
|
|
393
|
+
* Country Labels in Hebrew
|
|
394
|
+
*/
|
|
395
|
+
export const CountryLabels: Record<CountryCode, string> = {
|
|
396
|
+
IL: 'ישראל',
|
|
397
|
+
US: 'ארצות הברית',
|
|
398
|
+
GB: 'בריטניה',
|
|
399
|
+
DE: 'גרמניה',
|
|
400
|
+
FR: 'צרפת',
|
|
401
|
+
IT: 'איטליה',
|
|
402
|
+
ES: 'ספרד',
|
|
403
|
+
NL: 'הולנד',
|
|
404
|
+
BE: 'בלגיה',
|
|
405
|
+
CH: 'שוויץ',
|
|
406
|
+
AT: 'אוסטריה',
|
|
407
|
+
SE: 'שוודיה',
|
|
408
|
+
NO: 'נורווגיה',
|
|
409
|
+
DK: 'דנמרק',
|
|
410
|
+
FI: 'פינלנד',
|
|
411
|
+
IE: 'אירלנד',
|
|
412
|
+
PT: 'פורטוגל',
|
|
413
|
+
GR: 'יוון',
|
|
414
|
+
PL: 'פולין',
|
|
415
|
+
CZ: 'צכיה',
|
|
416
|
+
HU: 'הונגריה',
|
|
417
|
+
SK: 'סלובקיה',
|
|
418
|
+
SI: 'סלובניה',
|
|
419
|
+
HR: 'קרואטיה',
|
|
420
|
+
BG: 'בולגריה',
|
|
421
|
+
RO: 'רומניה',
|
|
422
|
+
LT: 'ליטא',
|
|
423
|
+
LV: 'לטביה',
|
|
424
|
+
EE: 'אסטוניה',
|
|
425
|
+
MT: 'מלטה',
|
|
426
|
+
CY: 'קפריסין',
|
|
427
|
+
LU: 'לוקסמבורג',
|
|
428
|
+
CA: 'קנדה',
|
|
429
|
+
MX: 'מקסיקו',
|
|
430
|
+
JP: 'יפן',
|
|
431
|
+
CN: 'סין',
|
|
432
|
+
KR: 'דרום קוריאה',
|
|
433
|
+
IN: 'הודו',
|
|
434
|
+
AU: 'אוסטרליה',
|
|
435
|
+
NZ: 'ניו זילנד',
|
|
436
|
+
ZA: 'דרום אפריקה',
|
|
437
|
+
BR: 'ברזיל',
|
|
438
|
+
AR: 'ארגנטינה',
|
|
439
|
+
CL: 'צילה',
|
|
440
|
+
SG: 'סינגפור',
|
|
441
|
+
HK: 'הונג קונג',
|
|
442
|
+
TH: 'תאילנד',
|
|
443
|
+
MY: 'מלזיה',
|
|
444
|
+
ID: 'אינדונזיה',
|
|
445
|
+
PH: 'פיליפינים',
|
|
446
|
+
VN: 'וייטנאם',
|
|
447
|
+
AE: 'איחוד האמירויות הערביות',
|
|
448
|
+
SA: 'סעודיה',
|
|
449
|
+
EG: 'מצרים',
|
|
450
|
+
TR: 'טורקיה',
|
|
451
|
+
RU: 'רוסיה',
|
|
452
|
+
UA: 'אוקראינה',
|
|
453
|
+
};
|
|
454
|
+
|
|
455
|
+
// ================================================================================
|
|
456
|
+
// UTILITY TYPES AND UNIONS
|
|
457
|
+
// ================================================================================
|
|
458
|
+
|
|
459
|
+
/**
|
|
460
|
+
* All available enums as a union for type checking
|
|
461
|
+
*/
|
|
462
|
+
export type ShaamEnum =
|
|
463
|
+
| RecordType
|
|
464
|
+
| DocumentType
|
|
465
|
+
| CurrencyCode
|
|
466
|
+
| SoftwareType
|
|
467
|
+
| AccountingType
|
|
468
|
+
| BalanceRequired
|
|
469
|
+
| LanguageCode
|
|
470
|
+
| CharacterEncoding
|
|
471
|
+
| BranchInfoFlag
|
|
472
|
+
| DebitCreditIndicator
|
|
473
|
+
| PaymentMethod
|
|
474
|
+
| TrialBalanceCode
|
|
475
|
+
| CountryCode;
|
|
476
|
+
|
|
477
|
+
/**
|
|
478
|
+
* Enum validation schemas for use in other parts of the application
|
|
479
|
+
*/
|
|
480
|
+
export const ShaamEnumSchemas = {
|
|
481
|
+
RecordType: RecordTypeEnum,
|
|
482
|
+
DocumentType: DocumentTypeEnum,
|
|
483
|
+
CurrencyCode: CurrencyCodeEnum,
|
|
484
|
+
SoftwareType: SoftwareTypeEnum,
|
|
485
|
+
AccountingType: AccountingTypeEnum,
|
|
486
|
+
BalanceRequired: BalanceRequiredEnum,
|
|
487
|
+
LanguageCode: LanguageCodeEnum,
|
|
488
|
+
CharacterEncoding: CharacterEncodingEnum,
|
|
489
|
+
BranchInfoFlag: BranchInfoFlagEnum,
|
|
490
|
+
DebitCreditIndicator: DebitCreditIndicatorEnum,
|
|
491
|
+
PaymentMethod: PaymentMethodEnum,
|
|
492
|
+
TrialBalanceCode: TrialBalanceCodeEnum,
|
|
493
|
+
CountryCode: CountryCodeEnum,
|
|
494
|
+
} as const;
|
|
495
|
+
|
|
496
|
+
/**
|
|
497
|
+
* All label mappings for easy lookup
|
|
498
|
+
*/
|
|
499
|
+
export const ShaamLabels = {
|
|
500
|
+
DocumentType: DocumentTypeLabels,
|
|
501
|
+
DocumentTypeEn: DocumentTypeLabelsEn,
|
|
502
|
+
Currency: CurrencyLabels,
|
|
503
|
+
SoftwareType: SoftwareTypeLabels,
|
|
504
|
+
AccountingType: AccountingTypeLabels,
|
|
505
|
+
BalanceRequired: BalanceRequiredLabels,
|
|
506
|
+
LanguageCode: LanguageCodeLabels,
|
|
507
|
+
CharacterEncoding: CharacterEncodingLabels,
|
|
508
|
+
BranchInfoFlag: BranchInfoFlagLabels,
|
|
509
|
+
DebitCreditIndicator: DebitCreditIndicatorLabels,
|
|
510
|
+
PaymentMethod: PaymentMethodLabels,
|
|
511
|
+
TrialBalanceCode: TrialBalanceCodeLabels,
|
|
512
|
+
Country: CountryLabels,
|
|
513
|
+
} as const;
|
|
514
|
+
|
|
515
|
+
// ================================================================================
|
|
516
|
+
// CONSTANTS
|
|
517
|
+
// ================================================================================
|
|
518
|
+
|
|
519
|
+
/**
|
|
520
|
+
* SHAAM System Constants
|
|
521
|
+
*/
|
|
522
|
+
export const SHAAM_CONSTANTS = {
|
|
523
|
+
VERSION: '&OF1.31&',
|
|
524
|
+
DEFAULT_CURRENCY: 'ILS' as CurrencyCode,
|
|
525
|
+
DEFAULT_LANGUAGE: '0' as LanguageCode,
|
|
526
|
+
DEFAULT_ENCODING: '1' as CharacterEncoding,
|
|
527
|
+
DEFAULT_SOFTWARE_TYPE: '2' as SoftwareType,
|
|
528
|
+
DEFAULT_ACCOUNTING_TYPE: '2' as AccountingType,
|
|
529
|
+
DEFAULT_BALANCE_REQUIRED: '1' as BalanceRequired,
|
|
530
|
+
DEFAULT_BRANCH_INFO: '0' as BranchInfoFlag,
|
|
531
|
+
} as const;
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Type definitions for SHAAM uniform format generator
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import { z } from 'zod';
|
|
6
|
+
// Import DocumentTypeEnum from enums for backward compatibility
|
|
7
|
+
import { DocumentTypeEnum } from './enums.js';
|
|
8
|
+
|
|
9
|
+
// Re-export all enums and types from enums.ts
|
|
10
|
+
export * from './enums.js';
|
|
11
|
+
|
|
12
|
+
// Business metadata schema
|
|
13
|
+
export const BusinessMetadataSchema = z.object({
|
|
14
|
+
businessId: z.string().min(1, 'Business ID is required'),
|
|
15
|
+
name: z.string().min(1, 'Business name is required'),
|
|
16
|
+
taxId: z.string().min(1, 'Tax ID is required'),
|
|
17
|
+
reportingPeriod: z.object({
|
|
18
|
+
startDate: z.string().min(1, 'Start date is required'),
|
|
19
|
+
endDate: z.string().min(1, 'End date is required'),
|
|
20
|
+
}),
|
|
21
|
+
});
|
|
22
|
+
|
|
23
|
+
// Document schema
|
|
24
|
+
export const DocumentSchema = z.object({
|
|
25
|
+
id: z.string().min(1, 'Document ID is required'),
|
|
26
|
+
type: DocumentTypeEnum.describe('Document type - must be valid SHAAM document type'),
|
|
27
|
+
date: z.string().min(1, 'Document date is required'),
|
|
28
|
+
amount: z.number(),
|
|
29
|
+
description: z.string().optional(),
|
|
30
|
+
});
|
|
31
|
+
|
|
32
|
+
// Journal entry schema
|
|
33
|
+
export const JournalEntrySchema = z.object({
|
|
34
|
+
id: z.string().min(1, 'Journal entry ID is required'),
|
|
35
|
+
date: z.string().min(1, 'Journal entry date is required'),
|
|
36
|
+
amount: z.number(),
|
|
37
|
+
accountId: z.string().min(1, 'Account ID is required'),
|
|
38
|
+
description: z.string().optional(),
|
|
39
|
+
});
|
|
40
|
+
|
|
41
|
+
// Account schema
|
|
42
|
+
export const AccountSchema = z.object({
|
|
43
|
+
id: z.string().min(1, 'Account ID is required'),
|
|
44
|
+
name: z.string().min(1, 'Account name is required'),
|
|
45
|
+
type: z.string().min(1, 'Account type is required'),
|
|
46
|
+
balance: z.number(),
|
|
47
|
+
});
|
|
48
|
+
|
|
49
|
+
// Inventory item schema
|
|
50
|
+
export const InventoryItemSchema = z.object({
|
|
51
|
+
id: z.string().min(1, 'Inventory item ID is required'),
|
|
52
|
+
name: z.string().min(1, 'Inventory item name is required'),
|
|
53
|
+
quantity: z.number(),
|
|
54
|
+
unitPrice: z.number(),
|
|
55
|
+
});
|
|
56
|
+
|
|
57
|
+
// Main input schema
|
|
58
|
+
export const ReportInputSchema = z.object({
|
|
59
|
+
business: BusinessMetadataSchema,
|
|
60
|
+
documents: z.array(DocumentSchema),
|
|
61
|
+
journalEntries: z.array(JournalEntrySchema),
|
|
62
|
+
accounts: z.array(AccountSchema),
|
|
63
|
+
inventory: z.array(InventoryItemSchema),
|
|
64
|
+
});
|
|
65
|
+
|
|
66
|
+
// Output schema
|
|
67
|
+
export const ReportOutputSchema = z.object({
|
|
68
|
+
iniText: z.string(),
|
|
69
|
+
dataText: z.string(),
|
|
70
|
+
iniFile: z.instanceof(File),
|
|
71
|
+
dataFile: z.instanceof(File),
|
|
72
|
+
summary: z.object({
|
|
73
|
+
totalRecords: z.number(),
|
|
74
|
+
perType: z.record(z.string(), z.number()),
|
|
75
|
+
errors: z
|
|
76
|
+
.array(
|
|
77
|
+
z.object({
|
|
78
|
+
recordType: z.string(),
|
|
79
|
+
recordIndex: z.number(),
|
|
80
|
+
field: z.string(),
|
|
81
|
+
message: z.string(),
|
|
82
|
+
}),
|
|
83
|
+
)
|
|
84
|
+
.optional(),
|
|
85
|
+
}),
|
|
86
|
+
});
|
|
87
|
+
|
|
88
|
+
// TypeScript types
|
|
89
|
+
export type DocumentType = z.infer<typeof DocumentTypeEnum>;
|
|
90
|
+
export type BusinessMetadata = z.infer<typeof BusinessMetadataSchema>;
|
|
91
|
+
export type Document = z.infer<typeof DocumentSchema>;
|
|
92
|
+
export type JournalEntry = z.infer<typeof JournalEntrySchema>;
|
|
93
|
+
export type Account = z.infer<typeof AccountSchema>;
|
|
94
|
+
export type InventoryItem = z.infer<typeof InventoryItemSchema>;
|
|
95
|
+
export type ReportInput = z.infer<typeof ReportInputSchema>;
|
|
96
|
+
export type ReportOutput = z.infer<typeof ReportOutputSchema>;
|
|
97
|
+
|
|
98
|
+
// Validation error type
|
|
99
|
+
export interface ValidationError {
|
|
100
|
+
recordType: string;
|
|
101
|
+
recordIndex: number;
|
|
102
|
+
field: string;
|
|
103
|
+
message: string;
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
// Generation options
|
|
107
|
+
export interface GenerationOptions {
|
|
108
|
+
validationMode?: 'fail-fast' | 'collect-all';
|
|
109
|
+
fileNameBase?: string;
|
|
110
|
+
}
|