@accounter/server 0.0.9-alpha-20251211102658-1b334ef361fc6faf8cd44900059dd236994fe9ab → 0.0.9-alpha-20251211102754-3592a860d1348674bd09af63fa304ff1e439a1dd

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 (115) hide show
  1. package/CHANGELOG.md +5 -5
  2. package/GMAIL_LISTENER.md +7 -7
  3. package/dist/green-invoice-graphql/src/mesh-artifacts/index.d.ts +1 -1
  4. package/dist/server/src/__tests__/factories/charge.d.ts +3 -1
  5. package/dist/server/src/__tests__/factories/charge.js +2 -1
  6. package/dist/server/src/__tests__/factories/charge.js.map +1 -1
  7. package/dist/server/src/__tests__/factories/transaction.d.ts +3 -1
  8. package/dist/server/src/__tests__/factories/transaction.js +1 -0
  9. package/dist/server/src/__tests__/factories/transaction.js.map +1 -1
  10. package/dist/server/src/__tests__/helpers/fixture-loader.d.ts +7 -3
  11. package/dist/server/src/__tests__/helpers/fixture-loader.js +28 -20
  12. package/dist/server/src/__tests__/helpers/fixture-loader.js.map +1 -1
  13. package/dist/server/src/__tests__/helpers/fixture-types.d.ts +1 -3
  14. package/dist/server/src/modules/accountant-approval/index.js +1 -1
  15. package/dist/server/src/modules/accountant-approval/index.js.map +1 -1
  16. package/dist/server/src/modules/admin-context/index.js +1 -1
  17. package/dist/server/src/modules/admin-context/index.js.map +1 -1
  18. package/dist/server/src/modules/bank-deposits/index.js +1 -1
  19. package/dist/server/src/modules/bank-deposits/index.js.map +1 -1
  20. package/dist/server/src/modules/bank-deposits/providers/bank-deposit-transactions.provider.d.ts +4 -4
  21. package/dist/server/src/modules/business-trips/index.js +3 -3
  22. package/dist/server/src/modules/business-trips/index.js.map +1 -1
  23. package/dist/server/src/modules/charges/index.js +4 -4
  24. package/dist/server/src/modules/charges/index.js.map +1 -1
  25. package/dist/server/src/modules/charges-matcher/index.js +1 -1
  26. package/dist/server/src/modules/charges-matcher/index.js.map +1 -1
  27. package/dist/server/src/modules/charts/index.js +1 -1
  28. package/dist/server/src/modules/charts/index.js.map +1 -1
  29. package/dist/server/src/modules/common/index.js +4 -4
  30. package/dist/server/src/modules/common/index.js.map +1 -1
  31. package/dist/server/src/modules/common/resolvers/timeless-date.d.ts +1 -1
  32. package/dist/server/src/modules/contracts/index.js +1 -1
  33. package/dist/server/src/modules/contracts/index.js.map +1 -1
  34. package/dist/server/src/modules/corn-jobs/index.js +1 -1
  35. package/dist/server/src/modules/corn-jobs/index.js.map +1 -1
  36. package/dist/server/src/modules/corporate-taxes/index.js +1 -1
  37. package/dist/server/src/modules/corporate-taxes/index.js.map +1 -1
  38. package/dist/server/src/modules/corporate-taxes/providers/corporate-taxes.provider.d.ts +1 -1
  39. package/dist/server/src/modules/countries/index.js +1 -1
  40. package/dist/server/src/modules/countries/index.js.map +1 -1
  41. package/dist/server/src/modules/deel/index.js +1 -1
  42. package/dist/server/src/modules/deel/index.js.map +1 -1
  43. package/dist/server/src/modules/depreciation/index.js +1 -1
  44. package/dist/server/src/modules/depreciation/index.js.map +1 -1
  45. package/dist/server/src/modules/dividends/index.js +1 -1
  46. package/dist/server/src/modules/dividends/index.js.map +1 -1
  47. package/dist/server/src/modules/documents/index.js +3 -3
  48. package/dist/server/src/modules/documents/index.js.map +1 -1
  49. package/dist/server/src/modules/exchange-rates/index.js +1 -1
  50. package/dist/server/src/modules/exchange-rates/index.js.map +1 -1
  51. package/dist/server/src/modules/financial-accounts/index.js +2 -2
  52. package/dist/server/src/modules/financial-accounts/index.js.map +1 -1
  53. package/dist/server/src/modules/financial-entities/index.js +6 -6
  54. package/dist/server/src/modules/financial-entities/index.js.map +1 -1
  55. package/dist/server/src/modules/green-invoice/index.js +1 -1
  56. package/dist/server/src/modules/green-invoice/index.js.map +1 -1
  57. package/dist/server/src/modules/ledger/__tests__/helpers/ledger-assertions.js +5 -5
  58. package/dist/server/src/modules/ledger/__tests__/helpers/ledger-assertions.js.map +1 -1
  59. package/dist/server/src/modules/ledger/index.js +1 -1
  60. package/dist/server/src/modules/ledger/index.js.map +1 -1
  61. package/dist/server/src/modules/misc-expenses/index.js +1 -1
  62. package/dist/server/src/modules/misc-expenses/index.js.map +1 -1
  63. package/dist/server/src/modules/reports/helpers/pcn.helper.d.ts +1 -1
  64. package/dist/server/src/modules/reports/index.js +12 -12
  65. package/dist/server/src/modules/reports/index.js.map +1 -1
  66. package/dist/server/src/modules/salaries/index.js +3 -3
  67. package/dist/server/src/modules/salaries/index.js.map +1 -1
  68. package/dist/server/src/modules/sort-codes/index.js +1 -1
  69. package/dist/server/src/modules/sort-codes/index.js.map +1 -1
  70. package/dist/server/src/modules/tags/index.js +1 -1
  71. package/dist/server/src/modules/tags/index.js.map +1 -1
  72. package/dist/server/src/modules/transactions/helpers/effective-date.helper.d.ts +1 -1
  73. package/dist/server/src/modules/transactions/index.js +3 -3
  74. package/dist/server/src/modules/transactions/index.js.map +1 -1
  75. package/dist/server/src/modules/vat/index.js +1 -1
  76. package/dist/server/src/modules/vat/index.js.map +1 -1
  77. package/dist/server/src/modules/vat/providers/vat.provider.d.ts +1 -1
  78. package/docs/implementation-guide.md +2 -2
  79. package/package.json +1 -1
  80. package/src/__tests__/factories/charge.ts +4 -2
  81. package/src/__tests__/factories/transaction.ts +3 -1
  82. package/src/__tests__/helpers/fixture-loader.ts +30 -22
  83. package/src/__tests__/helpers/fixture-types.ts +1 -3
  84. package/src/modules/accountant-approval/index.ts +1 -1
  85. package/src/modules/admin-context/index.ts +1 -1
  86. package/src/modules/bank-deposits/index.ts +1 -1
  87. package/src/modules/business-trips/index.ts +3 -3
  88. package/src/modules/charges/index.ts +4 -4
  89. package/src/modules/charges-matcher/README.md +12 -12
  90. package/src/modules/charges-matcher/documentation/SPEC.md +103 -103
  91. package/src/modules/charges-matcher/index.ts +1 -1
  92. package/src/modules/charts/index.ts +1 -1
  93. package/src/modules/common/index.ts +4 -4
  94. package/src/modules/contracts/index.ts +1 -1
  95. package/src/modules/corn-jobs/index.ts +1 -1
  96. package/src/modules/corporate-taxes/index.ts +1 -1
  97. package/src/modules/countries/index.ts +1 -1
  98. package/src/modules/deel/index.ts +1 -1
  99. package/src/modules/depreciation/index.ts +1 -1
  100. package/src/modules/dividends/index.ts +1 -1
  101. package/src/modules/documents/index.ts +3 -3
  102. package/src/modules/exchange-rates/index.ts +1 -1
  103. package/src/modules/financial-accounts/index.ts +2 -2
  104. package/src/modules/financial-entities/index.ts +6 -6
  105. package/src/modules/green-invoice/index.ts +1 -1
  106. package/src/modules/ledger/__tests__/helpers/ledger-assertions.ts +5 -6
  107. package/src/modules/ledger/__tests__/ledger-scenario-a.integration.test.ts +2 -2
  108. package/src/modules/ledger/index.ts +1 -1
  109. package/src/modules/misc-expenses/index.ts +1 -1
  110. package/src/modules/reports/index.ts +12 -12
  111. package/src/modules/salaries/index.ts +3 -3
  112. package/src/modules/sort-codes/index.ts +1 -1
  113. package/src/modules/tags/index.ts +1 -1
  114. package/src/modules/transactions/index.ts +3 -3
  115. package/src/modules/vat/index.ts +1 -1
@@ -47,9 +47,9 @@ query FindChargeMatches($chargeId: UUID!) {
47
47
  ```typescript
48
48
  {
49
49
  matches: Array<{
50
- chargeId: string // UUID
51
- confidenceScore: number // 0.00 to 1.00, two decimal precision
52
- }>
50
+ chargeId: string; // UUID
51
+ confidenceScore: number; // 0.00 to 1.00, two decimal precision
52
+ }>;
53
53
  }
54
54
  ```
55
55
 
@@ -211,27 +211,27 @@ CREATE TABLE accounter_schema.documents (
211
211
 
212
212
  ```typescript
213
213
  // types.ts
214
- import type { IGetTransactionsByIdsResult } from '@modules/transactions'
215
- import type { IGetAllDocumentsResult } from '@modules/documents'
216
- import type { Currency, DocumentType } from '@modules/documents'
214
+ import type { IGetTransactionsByIdsResult } from '@modules/transactions';
215
+ import type { IGetAllDocumentsResult } from '@modules/documents';
216
+ import type { Currency, DocumentType } from '@modules/documents';
217
217
 
218
218
  // Re-export with simpler names
219
- export type Transaction = IGetTransactionsByIdsResult
220
- export type Document = IGetAllDocumentsResult
219
+ export type Transaction = IGetTransactionsByIdsResult;
220
+ export type Document = IGetAllDocumentsResult;
221
221
  ```
222
222
 
223
223
  **Simplified Transaction Interface (for matching purposes):**
224
224
 
225
225
  ```typescript
226
226
  interface Transaction {
227
- id: string // UUID
228
- charge_id: string // UUID
229
- amount: string // numeric in DB, returned as string, converted to number
230
- business_id: string | null // UUID
231
- currency: string | null
232
- event_date: Date // Used for date matching (always)
233
- source_description: string | null
234
- is_fee: boolean // Excluded if true
227
+ id: string; // UUID
228
+ charge_id: string; // UUID
229
+ amount: string; // numeric in DB, returned as string, converted to number
230
+ business_id: string | null; // UUID
231
+ currency: string | null;
232
+ event_date: Date; // Used for date matching (always)
233
+ source_description: string | null;
234
+ is_fee: boolean; // Excluded if true
235
235
  // Other fields exist but not used in matching
236
236
  }
237
237
  ```
@@ -240,15 +240,15 @@ interface Transaction {
240
240
 
241
241
  ```typescript
242
242
  interface Document {
243
- id: string // UUID
244
- charge_id: string | null // UUID
245
- creditor_id: string | null // UUID
246
- debtor_id: string | null // UUID
247
- currency_code: string | null
248
- date: Date | null
249
- total_amount: number | null // double precision in DB, returned as number
250
- type: DocumentType
251
- serial_number: string | null
243
+ id: string; // UUID
244
+ charge_id: string | null; // UUID
245
+ creditor_id: string | null; // UUID
246
+ debtor_id: string | null; // UUID
247
+ currency_code: string | null;
248
+ date: Date | null;
249
+ total_amount: number | null; // double precision in DB, returned as number
250
+ type: DocumentType;
251
+ serial_number: string | null;
252
252
  // Legacy text fields 'debtor', 'creditor' are IGNORED
253
253
  }
254
254
  ```
@@ -256,7 +256,7 @@ interface Document {
256
256
  **Currency Type:**
257
257
 
258
258
  ```typescript
259
- type Currency = 'ILS' | 'USD' | 'EUR' | 'GBP' | 'USDC' | 'GRT' | 'ETH'
259
+ type Currency = 'ILS' | 'USD' | 'EUR' | 'GBP' | 'USDC' | 'GRT' | 'ETH';
260
260
  ```
261
261
 
262
262
  **DocumentType Enum:**
@@ -269,7 +269,7 @@ type DocumentType =
269
269
  | 'OTHER'
270
270
  | 'PROFORMA'
271
271
  | 'RECEIPT'
272
- | 'UNPROCESSED'
272
+ | 'UNPROCESSED';
273
273
  ```
274
274
 
275
275
  **Custom Result Types:**
@@ -277,28 +277,28 @@ type DocumentType =
277
277
  ```typescript
278
278
  // GraphQL result types
279
279
  interface ChargeMatch {
280
- chargeId: string
281
- confidence: number
282
- amount: number
283
- currency: string | null
284
- business: string | null
285
- date: Date
286
- description: string
280
+ chargeId: string;
281
+ confidence: number;
282
+ amount: number;
283
+ currency: string | null;
284
+ business: string | null;
285
+ date: Date;
286
+ description: string;
287
287
  }
288
288
 
289
289
  interface MergedCharge {
290
- baseChargeId: string
291
- mergedChargeId: string
292
- confidence: number
290
+ baseChargeId: string;
291
+ mergedChargeId: string;
292
+ confidence: number;
293
293
  }
294
294
 
295
295
  interface ChargeMatchesResult {
296
- matches: ChargeMatch[]
296
+ matches: ChargeMatch[];
297
297
  }
298
298
 
299
299
  interface AutoMatchChargesResult {
300
- merged: MergedCharge[]
301
- skipped: string[] // Charge IDs with multiple high-confidence matches
300
+ merged: MergedCharge[];
301
+ skipped: string[]; // Charge IDs with multiple high-confidence matches
302
302
  }
303
303
  ```
304
304
 
@@ -307,12 +307,12 @@ interface AutoMatchChargesResult {
307
307
  ```typescript
308
308
  // Used by aggregation providers
309
309
  interface AggregatedData {
310
- amount: number
311
- currency: string | null
312
- businessId: string | null
313
- date: Date
314
- description: string
315
- side?: 'debtor' | 'creditor' // Only for documents
310
+ amount: number;
311
+ currency: string | null;
312
+ businessId: string | null;
313
+ date: Date;
314
+ description: string;
315
+ side?: 'debtor' | 'creditor'; // Only for documents
316
316
  }
317
317
  ```
318
318
 
@@ -1001,7 +1001,7 @@ __tests__/
1001
1001
  1. **Single Charge Lookup:**
1002
1002
 
1003
1003
  ```typescript
1004
- const charge = await context.injector.get(ChargesProvider).getChargeByIdLoader.load(chargeId)
1004
+ const charge = await context.injector.get(ChargesProvider).getChargeByIdLoader.load(chargeId);
1005
1005
  ```
1006
1006
 
1007
1007
  2. **Transactions for Charge:**
@@ -1009,7 +1009,7 @@ __tests__/
1009
1009
  ```typescript
1010
1010
  const transactions = await context.injector
1011
1011
  .get(TransactionsProvider)
1012
- .transactionsByChargeIDLoader.load(chargeId)
1012
+ .transactionsByChargeIDLoader.load(chargeId);
1013
1013
  ```
1014
1014
 
1015
1015
  3. **Documents for Charge:**
@@ -1017,7 +1017,7 @@ __tests__/
1017
1017
  ```typescript
1018
1018
  const documents = await context.injector
1019
1019
  .get(ChargesProvider)
1020
- .getDocumentsByChargeIdLoader.load(chargeId)
1020
+ .getDocumentsByChargeIdLoader.load(chargeId);
1021
1021
  ```
1022
1022
 
1023
1023
  4. **Candidate Charges (with filters):**
@@ -1025,8 +1025,8 @@ __tests__/
1025
1025
  const candidates = await chargesProvider.getChargesByFilters({
1026
1026
  ownerIds: [adminBusinessId],
1027
1027
  fromAnyDate: startDate,
1028
- toAnyDate: endDate
1029
- })
1028
+ toAnyDate: endDate,
1029
+ });
1030
1030
  ```
1031
1031
 
1032
1032
  **Filter Parameters Used:**
@@ -1068,43 +1068,43 @@ _Documents table:_
1068
1068
  **Imported Types:**
1069
1069
 
1070
1070
  ```typescript
1071
- import type { IGetTransactionsByIdsResult } from '@modules/transactions'
1072
- import type { IGetAllDocumentsResult } from '@modules/documents'
1073
- import type { Currency, DocumentType } from '@modules/documents'
1071
+ import type { IGetTransactionsByIdsResult } from '@modules/transactions';
1072
+ import type { IGetAllDocumentsResult } from '@modules/documents';
1073
+ import type { Currency, DocumentType } from '@modules/documents';
1074
1074
  ```
1075
1075
 
1076
1076
  **Re-exported Types:**
1077
1077
 
1078
1078
  ```typescript
1079
- export type Transaction = IGetTransactionsByIdsResult
1080
- export type Document = IGetAllDocumentsResult
1079
+ export type Transaction = IGetTransactionsByIdsResult;
1080
+ export type Document = IGetAllDocumentsResult;
1081
1081
  ```
1082
1082
 
1083
1083
  **Custom Types Defined:**
1084
1084
 
1085
1085
  ```typescript
1086
1086
  export interface ChargeMatch {
1087
- chargeId: string
1088
- confidence: number
1089
- amount: number
1090
- currency: string | null
1091
- business: string | null
1092
- date: Date
1093
- description: string
1087
+ chargeId: string;
1088
+ confidence: number;
1089
+ amount: number;
1090
+ currency: string | null;
1091
+ business: string | null;
1092
+ date: Date;
1093
+ description: string;
1094
1094
  }
1095
1095
 
1096
1096
  export interface MergedCharge {
1097
- baseChargeId: string
1098
- mergedChargeId: string
1099
- confidence: number
1097
+ baseChargeId: string;
1098
+ mergedChargeId: string;
1099
+ confidence: number;
1100
1100
  }
1101
1101
 
1102
1102
  export interface AggregatedData {
1103
- amount: number
1104
- currency: string | null
1105
- businessId: string | null
1106
- date: Date
1107
- description: string
1103
+ amount: number;
1104
+ currency: string | null;
1105
+ businessId: string | null;
1106
+ date: Date;
1107
+ description: string;
1108
1108
  }
1109
1109
  ```
1110
1110
 
@@ -1305,29 +1305,29 @@ export default gql`
1305
1305
 
1306
1306
  ```typescript
1307
1307
  // resolvers/find-charge-matches.resolver.ts
1308
- import { GraphQLError } from 'graphql'
1309
- import type { ChargesMatcherResolvers } from '../types.js'
1308
+ import { GraphQLError } from 'graphql';
1309
+ import type { ChargesMatcherResolvers } from '../types.js';
1310
1310
 
1311
1311
  export const findChargeMatchesResolver: ChargesMatcherResolvers = {
1312
1312
  Query: {
1313
1313
  findChargeMatches: async (_, { chargeId }, context) => {
1314
1314
  try {
1315
- const adminBusinessId = context.adminContext.defaultAdminBusinessId
1316
- const chargesMatcherProvider = context.injector.get(ChargesMatcherProvider)
1315
+ const adminBusinessId = context.adminContext.defaultAdminBusinessId;
1316
+ const chargesMatcherProvider = context.injector.get(ChargesMatcherProvider);
1317
1317
 
1318
1318
  const matches = await chargesMatcherProvider.findMatchesForCharge(
1319
1319
  chargeId,
1320
1320
  adminBusinessId,
1321
- context
1322
- )
1321
+ context,
1322
+ );
1323
1323
 
1324
- return { matches }
1324
+ return { matches };
1325
1325
  } catch (error) {
1326
- throw new GraphQLError(error instanceof Error ? error.message : 'Failed to find matches')
1326
+ throw new GraphQLError(error instanceof Error ? error.message : 'Failed to find matches');
1327
1327
  }
1328
- }
1329
- }
1330
- }
1328
+ },
1329
+ },
1330
+ };
1331
1331
  ```
1332
1332
 
1333
1333
  ### 13.3 Module Registration (Implemented)
@@ -1336,34 +1336,34 @@ export const findChargeMatchesResolver: ChargesMatcherResolvers = {
1336
1336
 
1337
1337
  ```typescript
1338
1338
  // index.ts
1339
- import { createModule } from 'graphql-modules'
1340
- import { chargesMatcherResolvers } from './resolvers/index.js'
1341
- import { ChargesMatcherProvider } from './providers/charges-matcher.provider.js'
1342
- import typeDefs from './typeDefs/charges-matcher.graphql.js'
1339
+ import { createModule } from 'graphql-modules';
1340
+ import { chargesMatcherResolvers } from './resolvers/index.js';
1341
+ import { ChargesMatcherProvider } from './providers/charges-matcher.provider.js';
1342
+ import typeDefs from './typeDefs/charges-matcher.graphql.js';
1343
1343
 
1344
1344
  export const chargesMatcherModule = createModule({
1345
1345
  id: 'chargesMatcherModule',
1346
1346
  dirname: __dirname,
1347
1347
  typeDefs,
1348
1348
  resolvers: [chargesMatcherResolvers],
1349
- providers: [ChargesMatcherProvider]
1350
- })
1349
+ providers: [ChargesMatcherProvider],
1350
+ });
1351
1351
  ```
1352
1352
 
1353
1353
  **Application Integration:**
1354
1354
 
1355
1355
  ```typescript
1356
1356
  // modules-app.ts (added after chargesModule)
1357
- import { chargesMatcherModule } from './modules/charges-matcher/index.js'
1357
+ import { chargesMatcherModule } from './modules/charges-matcher/index.js';
1358
1358
 
1359
1359
  export const application = createApplication({
1360
1360
  modules: [
1361
1361
  // ... other modules
1362
1362
  chargesModule,
1363
- chargesMatcherModule // Added here
1363
+ chargesMatcherModule, // Added here
1364
1364
  // ... more modules
1365
- ]
1366
- })
1365
+ ],
1366
+ });
1367
1367
  ```
1368
1368
 
1369
1369
  ### 13.4 Provider Implementation Pattern (Actual Code)
@@ -1371,20 +1371,20 @@ export const application = createApplication({
1371
1371
  **Injectable Provider:**
1372
1372
 
1373
1373
  ```typescript
1374
- import { Injectable, Scope } from 'graphql-modules'
1375
- import type { GraphQLModules } from '@envelop/core'
1374
+ import { Injectable, Scope } from 'graphql-modules';
1375
+ import type { GraphQLModules } from '@envelop/core';
1376
1376
 
1377
1377
  @Injectable({
1378
- scope: Scope.Operation
1378
+ scope: Scope.Operation,
1379
1379
  })
1380
1380
  export class ChargesMatcherProvider {
1381
1381
  async findMatchesForCharge(
1382
1382
  chargeId: string,
1383
1383
  adminBusinessId: string,
1384
- context: GraphQLModules.AppContext
1384
+ context: GraphQLModules.AppContext,
1385
1385
  ): Promise<ChargeMatch[]> {
1386
- const chargesProvider = context.injector.get(ChargesProvider)
1387
- const transactionsProvider = context.injector.get(TransactionsProvider)
1386
+ const chargesProvider = context.injector.get(ChargesProvider);
1387
+ const transactionsProvider = context.injector.get(TransactionsProvider);
1388
1388
 
1389
1389
  // Implementation...
1390
1390
  }
@@ -1404,14 +1404,14 @@ export class ChargesMatcherProvider {
1404
1404
  **Test Pattern Example:**
1405
1405
 
1406
1406
  ```typescript
1407
- import { describe, it, expect, vi } from 'vitest'
1407
+ import { describe, it, expect, vi } from 'vitest';
1408
1408
 
1409
1409
  describe('amount-confidence.helper', () => {
1410
1410
  it('should return 1.0 for exact match', () => {
1411
- const result = calculateAmountConfidence(100, 100)
1412
- expect(result).toBe(1.0)
1413
- })
1414
- })
1411
+ const result = calculateAmountConfidence(100, 100);
1412
+ expect(result).toBe(1.0);
1413
+ });
1414
+ });
1415
1415
  ```
1416
1416
 
1417
1417
  ### 13.6 Completion Status
@@ -1,7 +1,7 @@
1
+ import chargesMatcherTypeDefs from './typeDefs/charges-matcher.graphql.js';
1
2
  import { createModule } from 'graphql-modules';
2
3
  import { ChargesMatcherProvider } from './providers/charges-matcher.provider.js';
3
4
  import { chargesMatcherResolvers } from './resolvers/index.js';
4
- import chargesMatcherTypeDefs from './typeDefs/charges-matcher.graphql.js';
5
5
 
6
6
  const __dirname = new URL('.', import.meta.url).pathname;
7
7
 
@@ -1,6 +1,6 @@
1
+ import charts from './typeDefs/charts.graphql.js';
1
2
  import { createModule } from 'graphql-modules';
2
3
  import { chartsResolvers } from './resolvers/charts.resolver.js';
3
- import charts from './typeDefs/charts.graphql.js';
4
4
 
5
5
  const __dirname = new URL('.', import.meta.url).pathname;
6
6
 
@@ -1,11 +1,11 @@
1
- import { createModule } from 'graphql-modules';
2
- import { scalarsResolvers } from './resolvers/common.resolver.js';
3
- import { gmailListenerResolvers } from './resolvers/gmail-listener.resolver.js';
4
- import { userContextResolvers } from './resolvers/user-context.resolver.js';
5
1
  import common from './typeDefs/common.graphql.js';
6
2
  import errors from './typeDefs/errors.graphql.js';
7
3
  import gmailListener from './typeDefs/gmail-listener.graphql.js';
8
4
  import userContext from './typeDefs/user-context.graphql.js';
5
+ import { createModule } from 'graphql-modules';
6
+ import { scalarsResolvers } from './resolvers/common.resolver.js';
7
+ import { gmailListenerResolvers } from './resolvers/gmail-listener.resolver.js';
8
+ import { userContextResolvers } from './resolvers/user-context.resolver.js';
9
9
 
10
10
  const __dirname = new URL('.', import.meta.url).pathname;
11
11
 
@@ -1,7 +1,7 @@
1
+ import contracts from './typeDefs/contracts.graphql.js';
1
2
  import { createModule } from 'graphql-modules';
2
3
  import { ContractsProvider } from './providers/contracts.provider.js';
3
4
  import { contractsResolvers } from './resolvers/contracts.resolver.js';
4
- import contracts from './typeDefs/contracts.graphql.js';
5
5
 
6
6
  const __dirname = new URL('.', import.meta.url).pathname;
7
7
 
@@ -1,7 +1,7 @@
1
+ import cornJobs from './typeDefs/corn-jobs.graphql.js';
1
2
  import { createModule } from 'graphql-modules';
2
3
  import { CornJobsProvider } from './providers/corn-jobs.provider.js';
3
4
  import { cornJobsResolvers } from './resolvers/corn-jobs.resolver.js';
4
- import cornJobs from './typeDefs/corn-jobs.graphql.js';
5
5
 
6
6
  const __dirname = new URL('.', import.meta.url).pathname;
7
7
 
@@ -1,7 +1,7 @@
1
+ import corporateTaxes from './typeDefs/corporate-taxes.graphql.js';
1
2
  import { createModule } from 'graphql-modules';
2
3
  import { CorporateTaxesProvider } from './providers/corporate-taxes.provider.js';
3
4
  import { corporateTaxesResolvers } from './resolvers/corporate-taxes.resolver.js';
4
- import corporateTaxes from './typeDefs/corporate-taxes.graphql.js';
5
5
 
6
6
  const __dirname = new URL('.', import.meta.url).pathname;
7
7
 
@@ -1,7 +1,7 @@
1
+ import countries from './typeDefs/countries.graphql.js';
1
2
  import { createModule } from 'graphql-modules';
2
3
  import { CountriesProvider } from './providers/countries.provider.js';
3
4
  import { countriesResolvers } from './resolvers/countries.resolver.js';
4
- import countries from './typeDefs/countries.graphql.js';
5
5
 
6
6
  const __dirname = new URL('.', import.meta.url).pathname;
7
7
 
@@ -1,8 +1,8 @@
1
+ import deel from './typeDefs/deel.graphql.js';
1
2
  import { createModule } from 'graphql-modules';
2
3
  import { DeelContractsProvider } from './providers/deel-contracts.provider.js';
3
4
  import { DeelInvoicesProvider } from './providers/deel-invoices.provider.js';
4
5
  import { deelResolvers } from './resolvers/deel.resolvers.js';
5
- import deel from './typeDefs/deel.graphql.js';
6
6
 
7
7
  const __dirname = new URL('.', import.meta.url).pathname;
8
8
 
@@ -1,8 +1,8 @@
1
+ import depreciation from './typeDefs/depreciation.graphql.js';
1
2
  import { createModule } from 'graphql-modules';
2
3
  import { DepreciationCategoriesProvider } from './providers/depreciation-categories.provider.js';
3
4
  import { DepreciationProvider } from './providers/depreciation.provider.js';
4
5
  import { depreciationResolvers } from './resolvers/depreciation.resolver.js';
5
- import depreciation from './typeDefs/depreciation.graphql.js';
6
6
 
7
7
  const __dirname = new URL('.', import.meta.url).pathname;
8
8
 
@@ -1,6 +1,6 @@
1
+ import dividends from './typeDefs/dividends.graphql.js';
1
2
  import { createModule } from 'graphql-modules';
2
3
  import { DividendsProvider } from './providers/dividends.provider.js';
3
- import dividends from './typeDefs/dividends.graphql.js';
4
4
 
5
5
  const __dirname = new URL('.', import.meta.url).pathname;
6
6
 
@@ -1,12 +1,12 @@
1
+ import documentSuggestions from './typeDefs/document-suggestions.graphql.js';
2
+ import documents from './typeDefs/documents.graphql.js';
3
+ import issuedDocuments from './typeDefs/issued-documents.graphql.js';
1
4
  import { createModule } from 'graphql-modules';
2
5
  import { DocumentsProvider } from './providers/documents.provider.js';
3
6
  import { IssuedDocumentsProvider } from './providers/issued-documents.provider.js';
4
7
  import { documentSuggestionsResolvers } from './resolvers/document-suggestions.resolver.js';
5
8
  import { documentsResolvers } from './resolvers/documents.resolver.js';
6
9
  import { issuedDocumentsResolvers } from './resolvers/issued-documents.resolver.js';
7
- import documentSuggestions from './typeDefs/document-suggestions.graphql.js';
8
- import documents from './typeDefs/documents.graphql.js';
9
- import issuedDocuments from './typeDefs/issued-documents.graphql.js';
10
10
 
11
11
  const __dirname = new URL('.', import.meta.url).pathname;
12
12
 
@@ -1,9 +1,9 @@
1
+ import exchange from './typeDefs/exchange.graphql.js';
1
2
  import { createModule } from 'graphql-modules';
2
3
  import { CryptoExchangeProvider } from './providers/crypto-exchange.provider.js';
3
4
  import { ExchangeProvider } from './providers/exchange.provider.js';
4
5
  import { FiatExchangeProvider } from './providers/fiat-exchange.provider.js';
5
6
  import { exchangeResolvers } from './resolvers/exchange.resolver.js';
6
- import exchange from './typeDefs/exchange.graphql.js';
7
7
 
8
8
  const __dirname = new URL('.', import.meta.url).pathname;
9
9
 
@@ -1,10 +1,10 @@
1
+ import financialAccounts from './typeDefs/financial-accounts.graphql.js';
2
+ import financialBankAccounts from './typeDefs/financial-bank-accounts.graphql.js';
1
3
  import { createModule } from 'graphql-modules';
2
4
  import { FinancialAccountsProvider } from './providers/financial-accounts.provider.js';
3
5
  import { FinancialBankAccountsProvider } from './providers/financial-bank-accounts.provider.js';
4
6
  import { financialAccountsResolvers } from './resolvers/financial-accounts.resolver.js';
5
7
  import { financialBankAccountsResolvers } from './resolvers/financial-bank-accounts.resolver.js';
6
- import financialAccounts from './typeDefs/financial-accounts.graphql.js';
7
- import financialBankAccounts from './typeDefs/financial-bank-accounts.graphql.js';
8
8
 
9
9
  const __dirname = new URL('.', import.meta.url).pathname;
10
10
 
@@ -1,3 +1,9 @@
1
+ import adminBusinesses from './typeDefs/admin-businesses.graphql.js';
2
+ import businessesTransactions from './typeDefs/businesses-transactions.graphql.js';
3
+ import businesses from './typeDefs/businesses.graphql.js';
4
+ import clients from './typeDefs/clients.graphql.js';
5
+ import financialEntities from './typeDefs/financial-entities.graphql.js';
6
+ import taxCategories from './typeDefs/tax-categories.graphql.js';
1
7
  import { createModule } from 'graphql-modules';
2
8
  import { AdminBusinessesProvider } from './providers/admin-businesses.provider.js';
3
9
  import { BusinessesOperationProvider } from './providers/businesses-operation.provider.js';
@@ -11,12 +17,6 @@ import { businessesResolvers } from './resolvers/businesses.resolver.js';
11
17
  import { clientsResolvers } from './resolvers/clients.resolvers.js';
12
18
  import { financialEntitiesResolvers } from './resolvers/financial-entities.resolver.js';
13
19
  import { taxCategoriesResolvers } from './resolvers/tax-categories.resolver.js';
14
- import adminBusinesses from './typeDefs/admin-businesses.graphql.js';
15
- import businessesTransactions from './typeDefs/businesses-transactions.graphql.js';
16
- import businesses from './typeDefs/businesses.graphql.js';
17
- import clients from './typeDefs/clients.graphql.js';
18
- import financialEntities from './typeDefs/financial-entities.graphql.js';
19
- import taxCategories from './typeDefs/tax-categories.graphql.js';
20
20
 
21
21
  const __dirname = new URL('.', import.meta.url).pathname;
22
22
 
@@ -1,6 +1,6 @@
1
+ import greenInvoice from './typeDefs/green-invoice.graphql.js';
1
2
  import { createModule } from 'graphql-modules';
2
3
  import { greenInvoiceResolvers } from './resolvers/green-invoice.resolvers.js';
3
- import greenInvoice from './typeDefs/green-invoice.graphql.js';
4
4
 
5
5
  const __dirname = new URL('.', import.meta.url).pathname;
6
6
 
@@ -322,20 +322,19 @@ export function assertForeignExpenseScenario(records: LedgerRecord[], params: {
322
322
  const impliedPerLeg = params.expectedForeignAmount * params.expectedRate;
323
323
  // Determine expected leg count from aggregate
324
324
  const legCountApprox = Math.round(params.expectedLocalTotal / impliedPerLeg);
325
- // Validate each leg amount close to impliedPerLeg (within 5%)
325
+ // Validate each leg amount close to impliedPerLeg (within 0.005)
326
326
  debitLegs.forEach((amt, i) => {
327
- expectClose(amt, impliedPerLeg, impliedPerLeg * 0.05, `Debit leg ${i} amount mismatch`);
327
+ expectClose(amt, impliedPerLeg, 0.005, `Debit leg ${i} amount mismatch`);
328
328
  });
329
329
  creditLegs.forEach((amt, i) => {
330
- expectClose(amt, impliedPerLeg, impliedPerLeg * 0.05, `Credit leg ${i} amount mismatch`);
330
+ expectClose(amt, impliedPerLeg, 0.005, `Credit leg ${i} amount mismatch`);
331
331
  });
332
332
  // Aggregate totals
333
333
  const totalDebit = debitLegs.reduce((a, b) => a + b, 0);
334
334
  const totalCredit = creditLegs.reduce((a, b) => a + b, 0);
335
- expectClose(totalDebit, params.expectedLocalTotal, params.expectedLocalTotal * 0.05, 'Aggregate debit total mismatch');
336
- expectClose(totalCredit, params.expectedLocalTotal, params.expectedLocalTotal * 0.05, 'Aggregate credit total mismatch');
335
+ expectClose(totalDebit, params.expectedLocalTotal, 0.005, 'Aggregate debit total mismatch');
336
+ expectClose(totalCredit, params.expectedLocalTotal, 0.005, 'Aggregate credit total mismatch');
337
337
  // Leg count heuristic
338
338
  expect(Math.abs(debitLegs.length - legCountApprox), 'Unexpected number of debit legs').toBeLessThanOrEqual(1);
339
339
  expect(Math.abs(creditLegs.length - legCountApprox), 'Unexpected number of credit legs').toBeLessThanOrEqual(1);
340
340
  }
341
-
@@ -46,7 +46,7 @@ describe('Ledger Generation - Expense Scenario A', () => {
46
46
  const chargeId = makeUUID('charge', 'charge-office-supplies');
47
47
  await client.query(
48
48
  `DELETE FROM ${qualifyTable('ledger_records')} WHERE charge_id = $1`,
49
- [chargeId],
49
+ [chargeId]
50
50
  );
51
51
  // Also clear the scenario's fixture rows to keep DB tidy
52
52
  await client.query(
@@ -55,7 +55,7 @@ describe('Ledger Generation - Expense Scenario A', () => {
55
55
  );
56
56
  await client.query(
57
57
  `DELETE FROM ${qualifyTable('transactions')} WHERE charge_id = $1`,
58
- [chargeId],
58
+ [chargeId]
59
59
  );
60
60
  await client.query(
61
61
  `DELETE FROM ${qualifyTable('charges')} WHERE id = $1`,
@@ -1,9 +1,9 @@
1
+ import ledger from './typeDefs/ledger.graphql.js';
1
2
  import { createModule } from 'graphql-modules';
2
3
  import { BalanceCancellationProvider } from './providers/balance-cancellation.provider.js';
3
4
  import { LedgerProvider } from './providers/ledger.provider.js';
4
5
  import { UnbalancedBusinessesProvider } from './providers/unbalanced-businesses.provider.js';
5
6
  import { ledgerResolvers } from './resolvers/ledger.resolver.js';
6
- import ledger from './typeDefs/ledger.graphql.js';
7
7
 
8
8
  const __dirname = new URL('.', import.meta.url).pathname;
9
9
 
@@ -1,7 +1,7 @@
1
+ import miscExpenses from './typeDefs/misc-expenses.graphql.js';
1
2
  import { createModule } from 'graphql-modules';
2
3
  import { MiscExpensesProvider } from './providers/misc-expenses.provider.js';
3
4
  import { miscExpensesLedgerEntriesResolvers } from './resolvers/misc-expenses.resolver.js';
4
- import miscExpenses from './typeDefs/misc-expenses.graphql.js';
5
5
 
6
6
  const __dirname = new URL('.', import.meta.url).pathname;
7
7