arek-e-docsnap 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 (50) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +314 -0
  3. package/dist/bin/cli.d.ts +14 -0
  4. package/dist/bin/cli.d.ts.map +1 -0
  5. package/dist/cli/App.d.ts +15 -0
  6. package/dist/cli/App.d.ts.map +1 -0
  7. package/dist/cli/screens/ClassificationScreen.d.ts +13 -0
  8. package/dist/cli/screens/ClassificationScreen.d.ts.map +1 -0
  9. package/dist/cli/screens/CompleteScreen.d.ts +13 -0
  10. package/dist/cli/screens/CompleteScreen.d.ts.map +1 -0
  11. package/dist/cli/screens/PartnerSetupScreen.d.ts +8 -0
  12. package/dist/cli/screens/PartnerSetupScreen.d.ts.map +1 -0
  13. package/dist/cli/screens/SettlementPreviewScreen.d.ts +13 -0
  14. package/dist/cli/screens/SettlementPreviewScreen.d.ts.map +1 -0
  15. package/dist/cli/screens/TransactionReviewScreen.d.ts +13 -0
  16. package/dist/cli/screens/TransactionReviewScreen.d.ts.map +1 -0
  17. package/dist/cli/state.d.ts +79 -0
  18. package/dist/cli/state.d.ts.map +1 -0
  19. package/dist/cli.js +33723 -0
  20. package/dist/domain/errors.d.ts +70 -0
  21. package/dist/domain/errors.d.ts.map +1 -0
  22. package/dist/domain/models.d.ts +289 -0
  23. package/dist/domain/models.d.ts.map +1 -0
  24. package/dist/domain/settlement.d.ts +30 -0
  25. package/dist/domain/settlement.d.ts.map +1 -0
  26. package/dist/index.d.ts +18 -0
  27. package/dist/index.d.ts.map +1 -0
  28. package/dist/index.js +312 -0
  29. package/dist/layers/config.d.ts +14 -0
  30. package/dist/layers/config.d.ts.map +1 -0
  31. package/dist/layers/filesystem.d.ts +16 -0
  32. package/dist/layers/filesystem.d.ts.map +1 -0
  33. package/dist/layers/logger.d.ts +16 -0
  34. package/dist/layers/logger.d.ts.map +1 -0
  35. package/dist/pdf.worker.mjs +28 -0
  36. package/dist/services/export.d.ts +56 -0
  37. package/dist/services/export.d.ts.map +1 -0
  38. package/dist/services/ocr-tesseract.d.ts +2 -0
  39. package/dist/services/ocr-tesseract.d.ts.map +1 -0
  40. package/dist/services/ocr.d.ts +32 -0
  41. package/dist/services/ocr.d.ts.map +1 -0
  42. package/dist/utils/compression.d.ts +31 -0
  43. package/dist/utils/compression.d.ts.map +1 -0
  44. package/dist/utils/console.d.ts +27 -0
  45. package/dist/utils/console.d.ts.map +1 -0
  46. package/dist/utils/progress.d.ts +30 -0
  47. package/dist/utils/progress.d.ts.map +1 -0
  48. package/dist/utils/transaction-parser.d.ts +41 -0
  49. package/dist/utils/transaction-parser.d.ts.map +1 -0
  50. package/package.json +95 -0
@@ -0,0 +1,70 @@
1
+ /**
2
+ * Error Types for arek-e-docsnap
3
+ *
4
+ * Defines all possible errors in the application using a tagged union pattern.
5
+ * This enables precise error handling and recovery strategies.
6
+ */
7
+ export declare class ParseError extends Error {
8
+ readonly _tag = "ParseError";
9
+ readonly raw: string;
10
+ readonly reason: string;
11
+ readonly line?: number;
12
+ constructor(raw: string, reason: string, line?: number);
13
+ }
14
+ export declare class OCRError extends Error {
15
+ readonly _tag = "OCRError";
16
+ readonly pageNumber: number;
17
+ readonly reason: string;
18
+ readonly confidence: number;
19
+ constructor(pageNumber: number, reason: string, confidence: number);
20
+ }
21
+ export declare class ValidationError extends Error {
22
+ readonly _tag = "ValidationError";
23
+ readonly field: string;
24
+ readonly value: unknown;
25
+ readonly reason: string;
26
+ constructor(field: string, value: unknown, reason: string);
27
+ }
28
+ export declare class ClassificationError extends Error {
29
+ readonly _tag = "ClassificationError";
30
+ readonly itemId: string;
31
+ readonly reason: string;
32
+ constructor(itemId: string, reason: string);
33
+ }
34
+ export declare class FileError extends Error {
35
+ readonly _tag = "FileError";
36
+ readonly path: string;
37
+ readonly message: string;
38
+ constructor(path: string, message: string);
39
+ }
40
+ export declare class UserCancelledError extends Error {
41
+ readonly _tag = "UserCancelled";
42
+ readonly message: string;
43
+ constructor(message: string);
44
+ }
45
+ export declare class UnknownError extends Error {
46
+ readonly _tag = "UnknownError";
47
+ readonly message: string;
48
+ readonly originalError?: Error;
49
+ constructor(message: string, originalError?: Error);
50
+ }
51
+ /**
52
+ * Union of all application errors
53
+ * Used in Effect<Success, AppError, Requirements>
54
+ */
55
+ export type AppError = ParseError | OCRError | ValidationError | ClassificationError | FileError | UserCancelledError | UnknownError;
56
+ /**
57
+ * Type guard functions for error types
58
+ */
59
+ export declare const isParseError: (error: AppError) => error is ParseError;
60
+ export declare const isOCRError: (error: AppError) => error is OCRError;
61
+ export declare const isValidationError: (error: AppError) => error is ValidationError;
62
+ export declare const isClassificationError: (error: AppError) => error is ClassificationError;
63
+ export declare const isFileError: (error: AppError) => error is FileError;
64
+ export declare const isUserCancelled: (error: AppError) => error is UserCancelledError;
65
+ export declare const isUnknownError: (error: AppError) => error is UnknownError;
66
+ /**
67
+ * Utility function to create error messages
68
+ */
69
+ export declare const errorMessage: (error: AppError) => string;
70
+ //# sourceMappingURL=errors.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../../src/domain/errors.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,qBAAa,UAAW,SAAQ,KAAK;IACnC,QAAQ,CAAC,IAAI,gBAAgB;IAC7B,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,CAAC;gBACX,GAAG,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,MAAM;CAOvD;AAED,qBAAa,QAAS,SAAQ,KAAK;IACjC,QAAQ,CAAC,IAAI,cAAc;IAC3B,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;IAC5B,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,UAA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nB,SAAS,GACT,kBAAkB,GAClB,YAAY,CAAC;AAEjB;;GAEG;AACH,eAAO,MAAM,YAAY,GAAI,OAAO,QAAQ,KAAG,KAAK,IAAI,UAC3B,CAAC;AAE9B,eAAO,MAAM,UAAU,GAAI,OAAO,QAAQ,KAAG,KAAK,IAAI,QAC3B,CAAC;AAE5B,eAAO,MAAM,iBAAiB,GAC5B,OAAO,QAAQ,KACd,KAAK,IAAI,eACsB,CAAC;AAEnC,eAAO,MAAM,qBAAqB,GAChC,OAAO,QAAQ,KACd,KAAK,IAAI,mBAC0B,CAAC;AAEvC,eAAO,MAAM,WAAW,GAAI,OAAO,QAAQ,KAAG,KAAK,IAAI,SAC3B,CAAC;AAE7B,eAAO,MAAM,eAAe,GAC1B,OAAO,QAAQ,KACd,KAAK,IAAI,kBACoB,CAAC;AAEjC,eAAO,MAAM,cAAc,GAAI,OAAO,QAAQ,KAAG,KAAK,IAAI,YAC3B,CAAC;AAEhC;;GAEG;AACH,eAAO,MAAM,YAAY,GAAI,OAAO,QAAQ,KAAG,MA0B9C,CAAC"}
@@ -0,0 +1,289 @@
1
+ import * as S from "effect/Schema";
2
+ declare const Partner_base: S.Class<Partner, {
3
+ id: typeof S.String;
4
+ name: S.filter<typeof S.String>;
5
+ color: S.optional<typeof S.String>;
6
+ }, S.Struct.Encoded<{
7
+ id: typeof S.String;
8
+ name: S.filter<typeof S.String>;
9
+ color: S.optional<typeof S.String>;
10
+ }>, never, {
11
+ readonly id: string;
12
+ } & {
13
+ readonly name: string;
14
+ } & {
15
+ readonly color?: string | undefined;
16
+ }, {}, {}>;
17
+ /**
18
+ * Domain Models for arek-e-docsnap
19
+ *
20
+ * This module defines the core domain types for the expense splitting application.
21
+ * All types are built with Effect.Schema for validation and serialization.
22
+ */
23
+ export declare class Partner extends Partner_base {
24
+ }
25
+ declare const RawTransaction_base: S.Class<RawTransaction, {
26
+ dateStr: typeof S.String;
27
+ description: S.filter<typeof S.String>;
28
+ amountStr: typeof S.String;
29
+ cardholder: S.optional<typeof S.String>;
30
+ ocrConfidence: S.optional<S.filter<typeof S.Number>>;
31
+ }, S.Struct.Encoded<{
32
+ dateStr: typeof S.String;
33
+ description: S.filter<typeof S.String>;
34
+ amountStr: typeof S.String;
35
+ cardholder: S.optional<typeof S.String>;
36
+ ocrConfidence: S.optional<S.filter<typeof S.Number>>;
37
+ }>, never, {
38
+ readonly dateStr: string;
39
+ } & {
40
+ readonly amountStr: string;
41
+ } & {
42
+ readonly description: string;
43
+ } & {
44
+ readonly cardholder?: string | undefined;
45
+ } & {
46
+ readonly ocrConfidence?: number | undefined;
47
+ }, {}, {}>;
48
+ export declare class RawTransaction extends RawTransaction_base {
49
+ }
50
+ declare const Transaction_base: S.Class<Transaction, {
51
+ id: typeof S.String;
52
+ date: typeof S.Date;
53
+ description: S.filter<S.filter<typeof S.String>>;
54
+ amount: S.filter<S.filter<typeof S.Number>>;
55
+ currency: S.Literal<["SEK", "EUR", "USD", "CHF"]>;
56
+ category: typeof S.String;
57
+ confidence: S.filter<typeof S.Number>;
58
+ }, S.Struct.Encoded<{
59
+ id: typeof S.String;
60
+ date: typeof S.Date;
61
+ description: S.filter<S.filter<typeof S.String>>;
62
+ amount: S.filter<S.filter<typeof S.Number>>;
63
+ currency: S.Literal<["SEK", "EUR", "USD", "CHF"]>;
64
+ category: typeof S.String;
65
+ confidence: S.filter<typeof S.Number>;
66
+ }>, never, {
67
+ readonly id: string;
68
+ } & {
69
+ readonly description: string;
70
+ } & {
71
+ readonly date: Date;
72
+ } & {
73
+ readonly category: string;
74
+ } & {
75
+ readonly amount: number;
76
+ } & {
77
+ readonly currency: "SEK" | "EUR" | "USD" | "CHF";
78
+ } & {
79
+ readonly confidence: number;
80
+ }, {}, {}>;
81
+ export declare class Transaction extends Transaction_base {
82
+ }
83
+ declare const ExpenseItem_base: S.Class<ExpenseItem, {
84
+ id: typeof S.String;
85
+ date: typeof S.Date;
86
+ description: S.filter<S.filter<typeof S.String>>;
87
+ amount: S.filter<S.filter<typeof S.Number>>;
88
+ currency: S.Literal<["SEK", "EUR", "USD", "CHF"]>;
89
+ category: typeof S.String;
90
+ confidence: S.filter<typeof S.Number>;
91
+ partner: typeof S.String;
92
+ isShared: typeof S.Boolean;
93
+ notes: S.optional<typeof S.String>;
94
+ }, S.Struct.Encoded<{
95
+ id: typeof S.String;
96
+ date: typeof S.Date;
97
+ description: S.filter<S.filter<typeof S.String>>;
98
+ amount: S.filter<S.filter<typeof S.Number>>;
99
+ currency: S.Literal<["SEK", "EUR", "USD", "CHF"]>;
100
+ category: typeof S.String;
101
+ confidence: S.filter<typeof S.Number>;
102
+ partner: typeof S.String;
103
+ isShared: typeof S.Boolean;
104
+ notes: S.optional<typeof S.String>;
105
+ }>, never, {
106
+ readonly id: string;
107
+ } & {
108
+ readonly description: string;
109
+ } & {
110
+ readonly date: Date;
111
+ } & {
112
+ readonly category: string;
113
+ } & {
114
+ readonly amount: number;
115
+ } & {
116
+ readonly currency: "SEK" | "EUR" | "USD" | "CHF";
117
+ } & {
118
+ readonly confidence: number;
119
+ } & {
120
+ readonly partner: string;
121
+ } & {
122
+ readonly isShared: boolean;
123
+ } & {
124
+ readonly notes?: string | undefined;
125
+ }, {}, {}>;
126
+ export declare class ExpenseItem extends ExpenseItem_base {
127
+ }
128
+ declare const ExpenseDocument_base: S.Class<ExpenseDocument, {
129
+ id: typeof S.String;
130
+ date: typeof S.Date;
131
+ source: typeof S.String;
132
+ items: S.Array$<typeof ExpenseItem>;
133
+ partners: S.Array$<typeof Partner>;
134
+ }, S.Struct.Encoded<{
135
+ id: typeof S.String;
136
+ date: typeof S.Date;
137
+ source: typeof S.String;
138
+ items: S.Array$<typeof ExpenseItem>;
139
+ partners: S.Array$<typeof Partner>;
140
+ }>, never, {
141
+ readonly id: string;
142
+ } & {
143
+ readonly date: Date;
144
+ } & {
145
+ readonly source: string;
146
+ } & {
147
+ readonly items: readonly ExpenseItem[];
148
+ } & {
149
+ readonly partners: readonly Partner[];
150
+ }, {}, {}>;
151
+ export declare class ExpenseDocument extends ExpenseDocument_base {
152
+ }
153
+ declare const Settlement_base: S.Class<Settlement, {
154
+ from: typeof S.String;
155
+ to: typeof S.String;
156
+ amount: S.filter<S.filter<typeof S.Number>>;
157
+ reason: typeof S.String;
158
+ }, S.Struct.Encoded<{
159
+ from: typeof S.String;
160
+ to: typeof S.String;
161
+ amount: S.filter<S.filter<typeof S.Number>>;
162
+ reason: typeof S.String;
163
+ }>, never, {
164
+ readonly from: string;
165
+ } & {
166
+ readonly amount: number;
167
+ } & {
168
+ readonly to: string;
169
+ } & {
170
+ readonly reason: string;
171
+ }, {}, {}>;
172
+ export declare class Settlement extends Settlement_base {
173
+ }
174
+ declare const ItemSummary_base: S.Class<ItemSummary, {
175
+ byPartner: S.Record$<typeof S.String, S.Struct<{
176
+ count: typeof S.Number;
177
+ total: typeof S.Number;
178
+ }>>;
179
+ byCategory: S.Record$<typeof S.String, S.Struct<{
180
+ count: typeof S.Number;
181
+ total: typeof S.Number;
182
+ }>>;
183
+ }, S.Struct.Encoded<{
184
+ byPartner: S.Record$<typeof S.String, S.Struct<{
185
+ count: typeof S.Number;
186
+ total: typeof S.Number;
187
+ }>>;
188
+ byCategory: S.Record$<typeof S.String, S.Struct<{
189
+ count: typeof S.Number;
190
+ total: typeof S.Number;
191
+ }>>;
192
+ }>, never, {
193
+ readonly byPartner: {
194
+ readonly [x: string]: {
195
+ readonly count: number;
196
+ readonly total: number;
197
+ };
198
+ };
199
+ } & {
200
+ readonly byCategory: {
201
+ readonly [x: string]: {
202
+ readonly count: number;
203
+ readonly total: number;
204
+ };
205
+ };
206
+ }, {}, {}>;
207
+ export declare class ItemSummary extends ItemSummary_base {
208
+ }
209
+ declare const ExpenseReport_base: S.Class<ExpenseReport, {
210
+ document: typeof ExpenseDocument;
211
+ itemsSummary: typeof ItemSummary;
212
+ settlements: S.Array$<typeof Settlement>;
213
+ }, S.Struct.Encoded<{
214
+ document: typeof ExpenseDocument;
215
+ itemsSummary: typeof ItemSummary;
216
+ settlements: S.Array$<typeof Settlement>;
217
+ }>, never, {
218
+ readonly document: ExpenseDocument;
219
+ } & {
220
+ readonly itemsSummary: ItemSummary;
221
+ } & {
222
+ readonly settlements: readonly Settlement[];
223
+ }, {}, {}>;
224
+ export declare class ExpenseReport extends ExpenseReport_base {
225
+ }
226
+ declare const AppConfig_base: S.Class<AppConfig, {
227
+ defaultPartners: S.Array$<typeof S.String>;
228
+ defaultCategories: S.Array$<typeof S.String>;
229
+ language: S.Literal<["en", "sv", "de", "fr"]>;
230
+ currency: S.Literal<["SEK", "EUR", "USD", "CHF"]>;
231
+ outputFormat: S.Literal<["xlsx", "csv", "json"]>;
232
+ autoOpenExcel: typeof S.Boolean;
233
+ debug: S.optional<typeof S.Boolean>;
234
+ }, S.Struct.Encoded<{
235
+ defaultPartners: S.Array$<typeof S.String>;
236
+ defaultCategories: S.Array$<typeof S.String>;
237
+ language: S.Literal<["en", "sv", "de", "fr"]>;
238
+ currency: S.Literal<["SEK", "EUR", "USD", "CHF"]>;
239
+ outputFormat: S.Literal<["xlsx", "csv", "json"]>;
240
+ autoOpenExcel: typeof S.Boolean;
241
+ debug: S.optional<typeof S.Boolean>;
242
+ }>, never, {
243
+ readonly currency: "SEK" | "EUR" | "USD" | "CHF";
244
+ } & {
245
+ readonly autoOpenExcel: boolean;
246
+ } & {
247
+ readonly defaultPartners: readonly string[];
248
+ } & {
249
+ readonly defaultCategories: readonly string[];
250
+ } & {
251
+ readonly language: "en" | "sv" | "de" | "fr";
252
+ } & {
253
+ readonly outputFormat: "xlsx" | "csv" | "json";
254
+ } & {
255
+ readonly debug?: boolean | undefined;
256
+ }, {}, {}>;
257
+ export declare class AppConfig extends AppConfig_base {
258
+ }
259
+ declare const StatementMetadata_base: S.Class<StatementMetadata, {
260
+ statementDate: typeof S.Date;
261
+ source: typeof S.String;
262
+ totalTransactions: S.filter<S.filter<typeof S.Number>>;
263
+ downloadDate: typeof S.Date;
264
+ currency: S.Literal<["SEK", "EUR", "USD", "CHF"]>;
265
+ language: typeof S.String;
266
+ }, S.Struct.Encoded<{
267
+ statementDate: typeof S.Date;
268
+ source: typeof S.String;
269
+ totalTransactions: S.filter<S.filter<typeof S.Number>>;
270
+ downloadDate: typeof S.Date;
271
+ currency: S.Literal<["SEK", "EUR", "USD", "CHF"]>;
272
+ language: typeof S.String;
273
+ }>, never, {
274
+ readonly currency: "SEK" | "EUR" | "USD" | "CHF";
275
+ } & {
276
+ readonly source: string;
277
+ } & {
278
+ readonly language: string;
279
+ } & {
280
+ readonly statementDate: Date;
281
+ } & {
282
+ readonly downloadDate: Date;
283
+ } & {
284
+ readonly totalTransactions: number;
285
+ }, {}, {}>;
286
+ export declare class StatementMetadata extends StatementMetadata_base {
287
+ }
288
+ export {};
289
+ //# sourceMappingURL=models.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"models.d.ts","sourceRoot":"","sources":["../../src/domain/models.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC,MAAM,eAAe,CAAC;;;;;;;;;;;;;;;;AAEnC;;;;;GAKG;AAMH,qBAAa,OAAQ,SAAQ,YAI3B;CAAG;;;;;;;;;;;;;;;;;;;;;;;;AAML,qBAAa,cAAe,SAAQ,mBAMlC;CAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEL,qBAAa,WAAY,SAAQ,gBAQ/B;CAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEL,qBAAa,WAAY,SAAQ,gBAW/B;CAAG;;;;;;;;;;;;;;;;;;;;;;;;AAML,qBAAa,eAAgB,SAAQ,oBAQnC;CAAG;;;;;;;;;;;;;;;;;;;;AAML,qBAAa,UAAW,SAAQ,eAK9B;CAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAML,qBAAa,WAAY,SAAQ,gBAe/B;CAAG;;;;;;;;;;;;;;;;AAEL,qBAAa,aAAc,SAAQ,kBAIjC;CAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAML,qBAAa,SAAU,SAAQ,cAQ7B;CAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAML,qBAAa,iBAAkB,SAAQ,sBASrC;CAAG"}
@@ -0,0 +1,30 @@
1
+ import { Settlement, ExpenseItem, Partner } from "./models";
2
+ /**
3
+ * Settlement Calculation Engine
4
+ *
5
+ * Implements simplified debt settlement algorithm:
6
+ * - Calculates what each partner paid vs. should pay
7
+ * - Generates minimal transactions to settle debts
8
+ * - Handles multi-partner scenarios
9
+ */
10
+ export interface SettlementResult {
11
+ readonly balances: Map<string, number>;
12
+ readonly settlements: Settlement[];
13
+ }
14
+ /**
15
+ * Calculate settlements between partners
16
+ *
17
+ * @param items - All expense items (some shared, some personal)
18
+ * @param partners - List of all partners involved
19
+ * @returns Settlement transactions needed
20
+ */
21
+ export declare const calculateSettlement: (items: ExpenseItem[], partners: Partner[]) => SettlementResult;
22
+ /**
23
+ * Format settlement amount for display
24
+ */
25
+ export declare const formatSettlementAmount: (amountCents: number, currency?: string) => string;
26
+ /**
27
+ * Create human-readable settlement summary
28
+ */
29
+ export declare const settlementSummary: (settlements: Settlement[], partners: Map<string, Partner>, currency?: string) => string;
30
+ //# sourceMappingURL=settlement.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"settlement.d.ts","sourceRoot":"","sources":["../../src/domain/settlement.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,WAAW,EAAE,OAAO,EAAE,MAAM,UAAU,CAAC;AAE5D;;;;;;;GAOG;AAEH,MAAM,WAAW,gBAAgB;IAC/B,QAAQ,CAAC,QAAQ,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACvC,QAAQ,CAAC,WAAW,EAAE,UAAU,EAAE,CAAC;CACpC;AAED;;;;;;GAMG;AACH,eAAO,MAAM,mBAAmB,GAC9B,OAAO,WAAW,EAAE,EACpB,UAAU,OAAO,EAAE,KAClB,gBAqEF,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,sBAAsB,GACjC,aAAa,MAAM,EACnB,WAAU,MAAc,KACvB,MAGF,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,iBAAiB,GAC5B,aAAa,UAAU,EAAE,EACzB,UAAU,GAAG,CAAC,MAAM,EAAE,OAAO,CAAC,EAC9B,WAAU,MAAc,KACvB,MAkBF,CAAC"}
@@ -0,0 +1,18 @@
1
+ /**
2
+ * arek-e-docsnap - Public API
3
+ *
4
+ * Main entry point for programmatic use of the library
5
+ */
6
+ export type { Partner, RawTransaction, Transaction, ExpenseItem, ExpenseDocument, Settlement, ExpenseReport, AppConfig, StatementMetadata, } from "./domain/models";
7
+ export { Partner as PartnerClass, RawTransaction as RawTransactionClass, Transaction as TransactionClass, ExpenseItem as ExpenseItemClass, ExpenseDocument as ExpenseDocumentClass, Settlement as SettlementClass, ExpenseReport as ExpenseReportClass, AppConfig as AppConfigClass, StatementMetadata as StatementMetadataClass, } from "./domain/models";
8
+ export type { ParseError, OCRError, ValidationError, ClassificationError, FileError, UserCancelledError, UnknownError, AppError, } from "./domain/errors";
9
+ export { isParseError, isOCRError, isValidationError, isClassificationError, isFileError, isUserCancelled, isUnknownError, errorMessage, } from "./domain/errors";
10
+ export type { SettlementResult } from "./domain/settlement";
11
+ export { calculateSettlement, formatSettlementAmount, settlementSummary, } from "./domain/settlement";
12
+ export type { Logger } from "./layers/logger";
13
+ export { Logger as LoggerTag, LoggerLive } from "./layers/logger";
14
+ export type { FileSystem } from "./layers/filesystem";
15
+ export { FileSystem as FileSystemTag } from "./layers/filesystem";
16
+ export type { ConfigService } from "./layers/config";
17
+ export { ConfigService as ConfigServiceTag } from "./layers/config";
18
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAGH,YAAY,EACV,OAAO,EACP,cAAc,EACd,WAAW,EACX,WAAW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