@accounter/server 0.0.9-alpha-20251210153039-1cfd8df346dd211c95a70c76c63465a29236849b → 0.0.9-alpha-20251210155614-e6e65aaecafef9e8fedd0b933f613ffcf478cecf

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 (94) hide show
  1. package/CHANGELOG.md +5 -27
  2. package/dist/green-invoice-graphql/src/mesh-artifacts/index.d.ts +1 -1
  3. package/dist/server/src/__tests__/factories/business.d.ts +2 -2
  4. package/dist/server/src/__tests__/factories/business.js +4 -5
  5. package/dist/server/src/__tests__/factories/business.js.map +1 -1
  6. package/dist/server/src/__tests__/factories/business.test.js +2 -2
  7. package/dist/server/src/__tests__/factories/business.test.js.map +1 -1
  8. package/dist/server/src/__tests__/factories/charge.d.ts +9 -9
  9. package/dist/server/src/__tests__/factories/charge.js +15 -15
  10. package/dist/server/src/__tests__/factories/charge.js.map +1 -1
  11. package/dist/server/src/__tests__/factories/charge.test.js +14 -14
  12. package/dist/server/src/__tests__/factories/charge.test.js.map +1 -1
  13. package/dist/server/src/__tests__/factories/document.d.ts +9 -9
  14. package/dist/server/src/__tests__/factories/document.js +11 -11
  15. package/dist/server/src/__tests__/factories/document.js.map +1 -1
  16. package/dist/server/src/__tests__/factories/document.test.js +38 -38
  17. package/dist/server/src/__tests__/factories/document.test.js.map +1 -1
  18. package/dist/server/src/__tests__/factories/financial-account.js +2 -2
  19. package/dist/server/src/__tests__/factories/financial-account.js.map +1 -1
  20. package/dist/server/src/__tests__/factories/financial-account.test.js +7 -7
  21. package/dist/server/src/__tests__/factories/financial-account.test.js.map +1 -1
  22. package/dist/server/src/__tests__/factories/ids.d.ts +22 -0
  23. package/dist/server/src/__tests__/factories/ids.js +46 -0
  24. package/dist/server/src/__tests__/factories/ids.js.map +1 -0
  25. package/dist/server/src/__tests__/factories/ids.test.js +71 -0
  26. package/dist/server/src/__tests__/factories/ids.test.js.map +1 -0
  27. package/dist/server/src/__tests__/factories/index.d.ts +2 -2
  28. package/dist/server/src/__tests__/factories/index.js +2 -2
  29. package/dist/server/src/__tests__/factories/index.js.map +1 -1
  30. package/dist/server/src/__tests__/factories/index.test.js +12 -12
  31. package/dist/server/src/__tests__/factories/index.test.js.map +1 -1
  32. package/dist/server/src/__tests__/factories/tax-category.d.ts +3 -3
  33. package/dist/server/src/__tests__/factories/tax-category.js +5 -6
  34. package/dist/server/src/__tests__/factories/tax-category.js.map +1 -1
  35. package/dist/server/src/__tests__/factories/tax-category.test.js +4 -4
  36. package/dist/server/src/__tests__/factories/tax-category.test.js.map +1 -1
  37. package/dist/server/src/__tests__/factories/transaction.d.ts +7 -7
  38. package/dist/server/src/__tests__/factories/transaction.js +11 -11
  39. package/dist/server/src/__tests__/factories/transaction.js.map +1 -1
  40. package/dist/server/src/__tests__/factories/transaction.test.js +27 -27
  41. package/dist/server/src/__tests__/factories/transaction.test.js.map +1 -1
  42. package/dist/server/src/__tests__/fixtures/expenses/expense-scenario-a.js +20 -20
  43. package/dist/server/src/__tests__/fixtures/expenses/expense-scenario-a.js.map +1 -1
  44. package/dist/server/src/__tests__/fixtures/expenses/expense-scenario-b.js +20 -20
  45. package/dist/server/src/__tests__/fixtures/expenses/expense-scenario-b.js.map +1 -1
  46. package/dist/server/src/__tests__/fixtures/expenses/expense-scenario-b.test.js +8 -8
  47. package/dist/server/src/__tests__/fixtures/expenses/expense-scenario-b.test.js.map +1 -1
  48. package/dist/server/src/__tests__/helpers/fixture-loader.js +2 -2
  49. package/dist/server/src/__tests__/helpers/fixture-loader.js.map +1 -1
  50. package/dist/server/src/__tests__/helpers/fixture-loader.test.js +29 -32
  51. package/dist/server/src/__tests__/helpers/fixture-loader.test.js.map +1 -1
  52. package/dist/server/src/__tests__/helpers/fixture-validation.test.js +50 -50
  53. package/dist/server/src/__tests__/helpers/fixture-validation.test.js.map +1 -1
  54. package/dist/server/src/modules/ledger/__tests__/helpers/ledger-assertions.d.ts +2 -0
  55. package/dist/server/src/modules/ledger/__tests__/helpers/ledger-assertions.js +4 -0
  56. package/dist/server/src/modules/ledger/__tests__/helpers/ledger-assertions.js.map +1 -1
  57. package/dist/server/src/modules/ledger/__tests__/ledger-scenario-a.integration.test.js +20 -20
  58. package/dist/server/src/modules/ledger/__tests__/ledger-scenario-a.integration.test.js.map +1 -1
  59. package/dist/server/src/modules/ledger/__tests__/ledger-scenario-b.integration.test.js +21 -21
  60. package/dist/server/src/modules/ledger/__tests__/ledger-scenario-b.integration.test.js.map +1 -1
  61. package/package.json +1 -1
  62. package/src/__tests__/factories/business.test.ts +3 -3
  63. package/src/__tests__/factories/business.ts +4 -5
  64. package/src/__tests__/factories/charge.test.ts +14 -14
  65. package/src/__tests__/factories/charge.ts +16 -16
  66. package/src/__tests__/factories/document.test.ts +38 -38
  67. package/src/__tests__/factories/document.ts +11 -11
  68. package/src/__tests__/factories/financial-account.test.ts +7 -7
  69. package/src/__tests__/factories/financial-account.ts +3 -3
  70. package/src/__tests__/factories/ids.test.ts +80 -0
  71. package/src/__tests__/factories/ids.ts +49 -0
  72. package/src/__tests__/factories/index.test.ts +12 -12
  73. package/src/__tests__/factories/index.ts +2 -2
  74. package/src/__tests__/factories/tax-category.test.ts +4 -4
  75. package/src/__tests__/factories/tax-category.ts +6 -7
  76. package/src/__tests__/factories/transaction.test.ts +27 -27
  77. package/src/__tests__/factories/transaction.ts +11 -11
  78. package/src/__tests__/fixtures/expenses/expense-scenario-a.ts +20 -20
  79. package/src/__tests__/fixtures/expenses/expense-scenario-b.test.ts +8 -8
  80. package/src/__tests__/fixtures/expenses/expense-scenario-b.ts +20 -20
  81. package/src/__tests__/helpers/fixture-loader.test.ts +29 -31
  82. package/src/__tests__/helpers/fixture-loader.ts +2 -2
  83. package/src/__tests__/helpers/fixture-validation.test.ts +50 -50
  84. package/src/modules/ledger/__tests__/helpers/ledger-assertions.ts +5 -0
  85. package/src/modules/ledger/__tests__/ledger-scenario-a.integration.test.ts +20 -20
  86. package/src/modules/ledger/__tests__/ledger-scenario-b.integration.test.ts +21 -21
  87. package/dist/server/src/demo-fixtures/__tests__/deterministic-uuid.test.js +0 -58
  88. package/dist/server/src/demo-fixtures/__tests__/deterministic-uuid.test.js.map +0 -1
  89. package/dist/server/src/demo-fixtures/helpers/deterministic-uuid.d.ts +0 -50
  90. package/dist/server/src/demo-fixtures/helpers/deterministic-uuid.js +0 -66
  91. package/dist/server/src/demo-fixtures/helpers/deterministic-uuid.js.map +0 -1
  92. package/src/demo-fixtures/__tests__/deterministic-uuid.test.ts +0 -75
  93. package/src/demo-fixtures/helpers/deterministic-uuid.ts +0 -68
  94. /package/dist/server/src/{demo-fixtures/__tests__/deterministic-uuid.test.d.ts → __tests__/factories/ids.test.d.ts} +0 -0
@@ -23,7 +23,7 @@ import {
23
23
  createTaxCategory,
24
24
  createFinancialAccount,
25
25
  } from '../../factories';
26
- import { makeUUID } from '../../../demo-fixtures/helpers/deterministic-uuid.js';
26
+ import { makeUUID } from '../../factories/ids';
27
27
  import type { Fixture } from '../../helpers/fixture-types';
28
28
  import { CountryCode } from '../../../modules/countries/types.js';
29
29
  import { Currency } from '../../../shared/enums.js';
@@ -55,13 +55,13 @@ export const expenseScenarioA: Fixture = {
55
55
  businesses: [
56
56
  // Admin business (owner of the expense)
57
57
  createBusiness({
58
- id: makeUUID('business', 'admin-business-scenario-a'),
58
+ id: makeUUID('admin-business'),
59
59
  hebrewName: 'חשבונאות ניהול',
60
60
  country: CountryCode.Israel,
61
61
  }),
62
62
  // Supplier business
63
63
  createBusiness({
64
- id: makeUUID('business', 'supplier-local-ltd'),
64
+ id: makeUUID('supplier-local-ltd'),
65
65
  hebrewName: 'ספק מקומי בע"מ',
66
66
  country: CountryCode.Israel,
67
67
  exemptDealer: false,
@@ -73,11 +73,11 @@ export const expenseScenarioA: Fixture = {
73
73
  taxCategories: {
74
74
  taxCategories: [
75
75
  createTaxCategory({
76
- id: makeUUID('tax-category', 'expense-general'),
76
+ id: makeUUID('expense-general'),
77
77
  hashavshevetName: 'General Expenses',
78
78
  }),
79
79
  createTaxCategory({
80
- id: makeUUID('tax-category', 'bank-account-tax-category'),
80
+ id: makeUUID('bank-account-tax-category'),
81
81
  hashavshevetName: 'Bank Account',
82
82
  }),
83
83
  ],
@@ -88,7 +88,7 @@ export const expenseScenarioA: Fixture = {
88
88
  createFinancialAccount({
89
89
  accountNumber: 'BANK-ACCOUNT-001',
90
90
  type: 'BANK_ACCOUNT',
91
- ownerId: makeUUID('business', 'admin-business-scenario-a'),
91
+ ownerId: makeUUID('admin-business'),
92
92
  }),
93
93
  ],
94
94
  },
@@ -98,7 +98,7 @@ export const expenseScenarioA: Fixture = {
98
98
  {
99
99
  accountNumber: 'BANK-ACCOUNT-001',
100
100
  currency: Currency.Ils,
101
- taxCategoryId: makeUUID('tax-category', 'bank-account-tax-category'),
101
+ taxCategoryId: makeUUID('bank-account-tax-category'),
102
102
  },
103
103
  ],
104
104
  },
@@ -107,12 +107,12 @@ export const expenseScenarioA: Fixture = {
107
107
  charges: [
108
108
  createCharge(
109
109
  {
110
- owner_id: makeUUID('business', 'admin-business-scenario-a'),
111
- tax_category_id: makeUUID('tax-category', 'expense-general'),
110
+ owner_id: makeUUID('admin-business'),
111
+ tax_category_id: makeUUID('expense-general'),
112
112
  user_description: 'Office supplies purchase',
113
113
  },
114
114
  {
115
- id: makeUUID('charge', 'charge-office-supplies'),
115
+ id: makeUUID('charge-office-supplies'),
116
116
  },
117
117
  ),
118
118
  ],
@@ -122,15 +122,15 @@ export const expenseScenarioA: Fixture = {
122
122
  transactions: [
123
123
  createTransaction(
124
124
  {
125
- charge_id: makeUUID('charge', 'charge-office-supplies'),
126
- business_id: makeUUID('business', 'supplier-local-ltd'),
125
+ charge_id: makeUUID('charge-office-supplies'),
126
+ business_id: makeUUID('supplier-local-ltd'),
127
127
  amount: '-500.00', // Negative = expense/outflow
128
128
  currency: Currency.Ils,
129
129
  event_date: '2024-01-15',
130
130
  is_fee: false,
131
131
  },
132
132
  {
133
- id: makeUUID('transaction', 'transaction-supplies-payment'),
133
+ id: makeUUID('transaction-supplies-payment'),
134
134
  account_id: 'BANK-ACCOUNT-001', // Will be resolved to UUID by loader
135
135
  source_description: 'Office supplies - Local Supplier Ltd',
136
136
  debit_date: '2024-01-15',
@@ -144,16 +144,16 @@ export const expenseScenarioA: Fixture = {
144
144
  documents: [
145
145
  createDocument(
146
146
  {
147
- charge_id: makeUUID('charge', 'charge-office-supplies'),
148
- creditor_id: makeUUID('business', 'supplier-local-ltd'), // Supplier is creditor
149
- debtor_id: makeUUID('business', 'admin-business-scenario-a'), // Admin is debtor (owes money)
147
+ charge_id: makeUUID('charge-office-supplies'),
148
+ creditor_id: makeUUID('supplier-local-ltd'), // Supplier is creditor
149
+ debtor_id: makeUUID('admin-business'), // Admin is debtor (owes money)
150
150
  type: 'RECEIPT',
151
151
  total_amount: 500.0, // Matches transaction amount (positive in document)
152
152
  currency_code: Currency.Ils,
153
153
  date: '2024-01-15', // Receipt date matches transaction
154
154
  },
155
155
  {
156
- id: makeUUID('document', 'document-supplies-receipt'),
156
+ id: makeUUID('document-supplies-receipt'),
157
157
  serial_number: 'RCP-2024-001',
158
158
  vat_amount: null, // For simplicity, no VAT breakdown on receipt
159
159
  },
@@ -164,10 +164,10 @@ export const expenseScenarioA: Fixture = {
164
164
  expectations: {
165
165
  ledger: [
166
166
  {
167
- chargeId: makeUUID('charge', 'charge-office-supplies'),
167
+ chargeId: makeUUID('charge-office-supplies'),
168
168
  recordCount: 2, // Debit expense + credit bank
169
- debitEntities: [makeUUID('tax-category', 'expense-general')],
170
- creditEntities: [makeUUID('tax-category', 'bank-account-tax-category')],
169
+ debitEntities: [makeUUID('expense-general')],
170
+ creditEntities: [makeUUID('bank-account-tax-category')],
171
171
  totalDebitLocal: 500.0,
172
172
  totalCreditLocal: 500.0,
173
173
  balanced: true,
@@ -1,7 +1,7 @@
1
1
  import { describe, it, expect } from 'vitest';
2
2
  import { expenseScenarioB } from './expense-scenario-b';
3
3
  import { validateFixture } from '../../helpers/fixture-validation';
4
- import { makeUUID } from '../../../demo-fixtures/helpers/deterministic-uuid.js';
4
+ import { makeUUID } from '../../factories/ids';
5
5
  import { CountryCode } from '../../../modules/countries/types.js';
6
6
  import { Currency } from '../../../shared/enums.js';
7
7
 
@@ -39,8 +39,8 @@ describe('Expense Scenario B - USD Invoice', () => {
39
39
 
40
40
  it('should have correct business entities', () => {
41
41
  const businesses = expenseScenarioB.businesses!.businesses;
42
- const admin = businesses.find(b => b.id === makeUUID('business', 'admin-business-usd'));
43
- const supplier = businesses.find(b => b.id === makeUUID('business', 'supplier-us-vendor-llc'));
42
+ const admin = businesses.find(b => b.id === makeUUID('admin-business-usd'));
43
+ const supplier = businesses.find(b => b.id === makeUUID('supplier-us-vendor-llc'));
44
44
 
45
45
  expect(admin).toBeDefined();
46
46
  expect(admin?.country).toBe(CountryCode.Israel);
@@ -51,7 +51,7 @@ describe('Expense Scenario B - USD Invoice', () => {
51
51
  });
52
52
 
53
53
  it('should have referential integrity between charge, transaction, and document', () => {
54
- const chargeId = makeUUID('charge', 'charge-consulting-services');
54
+ const chargeId = makeUUID('charge-consulting-services');
55
55
  const charge = expenseScenarioB.charges!.charges[0];
56
56
  const transaction = expenseScenarioB.transactions!.transactions[0];
57
57
  const document = expenseScenarioB.documents!.documents[0];
@@ -94,7 +94,7 @@ describe('Expense Scenario B - USD Invoice', () => {
94
94
  it('should have ledger expectations with exchange rate', () => {
95
95
  const ledgerExpectation = expenseScenarioB.expectations!.ledger![0];
96
96
 
97
- expect(ledgerExpectation.chargeId).toBe(makeUUID('charge', 'charge-consulting-services'));
97
+ expect(ledgerExpectation.chargeId).toBe(makeUUID('charge-consulting-services'));
98
98
  expect(ledgerExpectation.recordCount).toBe(2);
99
99
  expect(ledgerExpectation.balanced).toBe(true);
100
100
  expect(ledgerExpectation.foreignCurrency).toBe('USD');
@@ -116,14 +116,14 @@ describe('Expense Scenario B - USD Invoice', () => {
116
116
  const debitEntity = ledgerExpectation.debitEntities![0];
117
117
  const creditEntity = ledgerExpectation.creditEntities![0];
118
118
 
119
- expect(debitEntity).toBe(makeUUID('tax-category', 'expense-consulting'));
120
- expect(creditEntity).toBe(makeUUID('tax-category', 'usd-account-tax-category'));
119
+ expect(debitEntity).toBe(makeUUID('expense-consulting'));
120
+ expect(creditEntity).toBe(makeUUID('usd-account-tax-category'));
121
121
  });
122
122
 
123
123
  it('should have USD account mapped to tax category', () => {
124
124
  const accountMapping = expenseScenarioB.accountTaxCategories?.mappings[0];
125
125
  expect(accountMapping?.accountNumber).toBe('USD-ACCOUNT-001');
126
126
  expect(accountMapping?.currency).toBe(Currency.Usd);
127
- expect(accountMapping?.taxCategoryId).toBe(makeUUID('tax-category', 'usd-account-tax-category'));
127
+ expect(accountMapping?.taxCategoryId).toBe(makeUUID('usd-account-tax-category'));
128
128
  });
129
129
  });
@@ -26,7 +26,7 @@ import {
26
26
  createTaxCategory,
27
27
  createFinancialAccount,
28
28
  } from '../../factories';
29
- import { makeUUID } from '../../../demo-fixtures/helpers/deterministic-uuid.js';
29
+ import { makeUUID } from '../../factories/ids';
30
30
  import type { Fixture } from '../../helpers/fixture-types';
31
31
  import { CountryCode } from '../../../modules/countries/types.js';
32
32
  import { Currency } from '../../../shared/enums.js';
@@ -67,13 +67,13 @@ export const expenseScenarioB: Fixture = {
67
67
  businesses: [
68
68
  // Admin business (owner of the expense)
69
69
  createBusiness({
70
- id: makeUUID('business', 'admin-business-usd'),
70
+ id: makeUUID('admin-business-usd'),
71
71
  hebrewName: 'חשבונאות ניהול',
72
72
  country: CountryCode.Israel,
73
73
  }),
74
74
  // US Supplier business
75
75
  createBusiness({
76
- id: makeUUID('business', 'supplier-us-vendor-llc'),
76
+ id: makeUUID('supplier-us-vendor-llc'),
77
77
  hebrewName: 'ספק אמריקאי',
78
78
  country: CountryCode['United States of America (the)'],
79
79
  exemptDealer: false,
@@ -85,11 +85,11 @@ export const expenseScenarioB: Fixture = {
85
85
  taxCategories: {
86
86
  taxCategories: [
87
87
  createTaxCategory({
88
- id: makeUUID('tax-category', 'expense-consulting'),
88
+ id: makeUUID('expense-consulting'),
89
89
  hashavshevetName: 'Consulting Expenses',
90
90
  }),
91
91
  createTaxCategory({
92
- id: makeUUID('tax-category', 'usd-account-tax-category'),
92
+ id: makeUUID('usd-account-tax-category'),
93
93
  hashavshevetName: 'Foreign Currency Account',
94
94
  }),
95
95
  ],
@@ -100,7 +100,7 @@ export const expenseScenarioB: Fixture = {
100
100
  createFinancialAccount({
101
101
  accountNumber: 'USD-ACCOUNT-001',
102
102
  type: 'BANK_ACCOUNT',
103
- ownerId: makeUUID('business', 'admin-business-usd'),
103
+ ownerId: makeUUID('admin-business-usd'),
104
104
  }),
105
105
  ],
106
106
  },
@@ -110,7 +110,7 @@ export const expenseScenarioB: Fixture = {
110
110
  {
111
111
  accountNumber: 'USD-ACCOUNT-001',
112
112
  currency: Currency.Usd,
113
- taxCategoryId: makeUUID('tax-category', 'usd-account-tax-category'),
113
+ taxCategoryId: makeUUID('usd-account-tax-category'),
114
114
  },
115
115
  ],
116
116
  },
@@ -119,12 +119,12 @@ export const expenseScenarioB: Fixture = {
119
119
  charges: [
120
120
  createCharge(
121
121
  {
122
- owner_id: makeUUID('business', 'admin-business-usd'),
123
- tax_category_id: makeUUID('tax-category', 'expense-consulting'),
122
+ owner_id: makeUUID('admin-business-usd'),
123
+ tax_category_id: makeUUID('expense-consulting'),
124
124
  user_description: 'Consulting services from US vendor',
125
125
  },
126
126
  {
127
- id: makeUUID('charge', 'charge-consulting-services'),
127
+ id: makeUUID('charge-consulting-services'),
128
128
  },
129
129
  ),
130
130
  ],
@@ -134,15 +134,15 @@ export const expenseScenarioB: Fixture = {
134
134
  transactions: [
135
135
  createTransaction(
136
136
  {
137
- charge_id: makeUUID('charge', 'charge-consulting-services'),
138
- business_id: makeUUID('business', 'supplier-us-vendor-llc'),
137
+ charge_id: makeUUID('charge-consulting-services'),
138
+ business_id: makeUUID('supplier-us-vendor-llc'),
139
139
  amount: '-200.00', // Negative = expense/outflow in USD
140
140
  currency: Currency.Usd,
141
141
  event_date: '2024-01-20',
142
142
  is_fee: false,
143
143
  },
144
144
  {
145
- id: makeUUID('transaction', 'transaction-consulting-payment'),
145
+ id: makeUUID('transaction-consulting-payment'),
146
146
  account_id: 'USD-ACCOUNT-001', // Will be resolved to UUID by loader
147
147
  source_description: 'Consulting services - US Vendor LLC',
148
148
  debit_date: '2024-01-20',
@@ -156,16 +156,16 @@ export const expenseScenarioB: Fixture = {
156
156
  documents: [
157
157
  createDocument(
158
158
  {
159
- charge_id: makeUUID('charge', 'charge-consulting-services'),
160
- creditor_id: makeUUID('business', 'supplier-us-vendor-llc'), // Supplier is creditor
161
- debtor_id: makeUUID('business', 'admin-business-usd'), // Admin is debtor
159
+ charge_id: makeUUID('charge-consulting-services'),
160
+ creditor_id: makeUUID('supplier-us-vendor-llc'), // Supplier is creditor
161
+ debtor_id: makeUUID('admin-business-usd'), // Admin is debtor
162
162
  type: 'INVOICE',
163
163
  total_amount: 200.0, // Amount in USD
164
164
  currency_code: Currency.Usd,
165
165
  date: '2024-01-20', // Invoice date matches transaction
166
166
  },
167
167
  {
168
- id: makeUUID('document', 'document-consulting-invoice'),
168
+ id: makeUUID('document-consulting-invoice'),
169
169
  serial_number: 'INV-US-2024-001',
170
170
  vat_amount: null, // US invoice - no Israeli VAT
171
171
  },
@@ -176,10 +176,10 @@ export const expenseScenarioB: Fixture = {
176
176
  expectations: {
177
177
  ledger: [
178
178
  {
179
- chargeId: makeUUID('charge', 'charge-consulting-services'),
179
+ chargeId: makeUUID('charge-consulting-services'),
180
180
  recordCount: 2, // Document + transaction entries
181
- debitEntities: [makeUUID('tax-category', 'expense-consulting'), makeUUID('tax-category', 'usd-account-tax-category')],
182
- creditEntities: [makeUUID('tax-category', 'usd-account-tax-category'), makeUUID('business', 'supplier-us-vendor-llc')],
181
+ debitEntities: [makeUUID('expense-consulting'), makeUUID('usd-account-tax-category')],
182
+ creditEntities: [makeUUID('usd-account-tax-category'), makeUUID('supplier-us-vendor-llc')],
183
183
  // Ledger processes document (700 ILS) + transaction (700 ILS) = 1400 ILS total
184
184
  // With exchange rate of 3.5 ILS/USD: 200 USD × 3.5 = 700 ILS per entry
185
185
  totalDebitLocal: 1400.0,
@@ -18,8 +18,8 @@ import {
18
18
  createCharge,
19
19
  createTransaction,
20
20
  createDocument,
21
+ makeUUID,
21
22
  } from '../factories/index.js';
22
- import { makeUUID } from '../../demo-fixtures/helpers/deterministic-uuid.js';
23
23
 
24
24
  describe('Fixture Loader', () => {
25
25
  let pool: Pool;
@@ -35,9 +35,9 @@ describe('Fixture Loader', () => {
35
35
  describe('insertFixture', () => {
36
36
  it('should insert a complete minimal fixture successfully', () =>
37
37
  withTestTransaction(pool, async client => {
38
- const businessId = makeUUID('business', 'test-business-1');
39
- const taxCategoryId = makeUUID('tax-category', 'test-tax-cat-1');
40
- const chargeId = makeUUID('charge', 'test-charge-1');
38
+ const businessId = makeUUID('test-business-1');
39
+ const taxCategoryId = makeUUID('test-tax-cat-1');
40
+ const chargeId = makeUUID('test-charge-1');
41
41
 
42
42
  const fixture: Fixture = {
43
43
  businesses: {
@@ -83,7 +83,6 @@ describe('Fixture Loader', () => {
83
83
  [businessId],
84
84
  );
85
85
  expect(businessResult.rows).toHaveLength(1);
86
- expect(businessResult.rows[0].id).toBe(businessId);
87
86
  expect(businessResult.rows[0].hebrew_name).toBe('Test Business');
88
87
 
89
88
  const taxCatResult = await client.query(
@@ -91,7 +90,6 @@ describe('Fixture Loader', () => {
91
90
  [taxCategoryId],
92
91
  );
93
92
  expect(taxCatResult.rows).toHaveLength(1);
94
- expect(taxCatResult.rows[0].id).toBe(taxCategoryId);
95
93
  expect(taxCatResult.rows[0].hashavshevet_name).toBe('Test Tax Category');
96
94
 
97
95
  const chargeResult = await client.query(
@@ -104,13 +102,13 @@ describe('Fixture Loader', () => {
104
102
 
105
103
  it('should insert fixture with transactions and documents', () =>
106
104
  withTestTransaction(pool, async client => {
107
- const supplierId = makeUUID('business', 'supplier-1');
108
- const customerId = makeUUID('business', 'customer-1');
109
- const taxCategoryId = makeUUID('tax-category', 'tax-cat-1');
105
+ const supplierId = makeUUID('supplier-1');
106
+ const customerId = makeUUID('customer-1');
107
+ const taxCategoryId = makeUUID('tax-cat-1');
110
108
  const accountNumber = 'ACC-12345';
111
- const chargeId = makeUUID('charge', 'charge-1');
112
- const transactionId = makeUUID('transaction', 'tx-1');
113
- const documentId = makeUUID('document', 'doc-1');
109
+ const chargeId = makeUUID('charge-1');
110
+ const transactionId = makeUUID('tx-1');
111
+ const documentId = makeUUID('doc-1');
114
112
 
115
113
  const fixture: Fixture = {
116
114
  businesses: {
@@ -218,7 +216,7 @@ describe('Fixture Loader', () => {
218
216
 
219
217
  it('should handle fixture with only some sections populated', () =>
220
218
  withTestTransaction(pool, async client => {
221
- const businessId = makeUUID('business', 'lonely-business');
219
+ const businessId = makeUUID('lonely-business');
222
220
 
223
221
  const fixture: Fixture = {
224
222
  businesses: {
@@ -240,8 +238,8 @@ describe('Fixture Loader', () => {
240
238
 
241
239
  it('should throw validation error before insertion for invalid FK references', () =>
242
240
  withTestTransaction(pool, async client => {
243
- const businessId = makeUUID('business', 'test-biz');
244
- const invalidChargeId = makeUUID('charge', 'invalid-charge');
241
+ const businessId = makeUUID('test-biz');
242
+ const invalidChargeId = makeUUID('invalid-charge');
245
243
 
246
244
  const fixture: Fixture = {
247
245
  businesses: {
@@ -252,7 +250,7 @@ describe('Fixture Loader', () => {
252
250
  createCharge(
253
251
  {
254
252
  owner_id: 'non-existent-owner', // Invalid FK reference
255
- tax_category_id: makeUUID('tax-category', 'tax-cat'),
253
+ tax_category_id: makeUUID('tax-cat'),
256
254
  },
257
255
  { id: invalidChargeId },
258
256
  ),
@@ -271,7 +269,7 @@ describe('Fixture Loader', () => {
271
269
  charges: [
272
270
  createCharge({
273
271
  owner_id: 'non-existent-owner',
274
- tax_category_id: makeUUID('tax-category', 'tax-cat'),
272
+ tax_category_id: makeUUID('tax-cat'),
275
273
  }),
276
274
  ],
277
275
  },
@@ -290,7 +288,7 @@ describe('Fixture Loader', () => {
290
288
 
291
289
  it('should validate fixture before insertion', () =>
292
290
  withTestTransaction(pool, async client => {
293
- const chargeId = makeUUID('charge', 'orphan-charge');
291
+ const chargeId = makeUUID('orphan-charge');
294
292
 
295
293
  const fixture: Fixture = {
296
294
  // Missing businesses and tax categories
@@ -298,8 +296,8 @@ describe('Fixture Loader', () => {
298
296
  charges: [
299
297
  createCharge(
300
298
  {
301
- owner_id: makeUUID('business', 'missing-owner'),
302
- tax_category_id: makeUUID('tax-category', 'missing-tax'),
299
+ owner_id: makeUUID('missing-owner'),
300
+ tax_category_id: makeUUID('missing-tax'),
303
301
  },
304
302
  { id: chargeId },
305
303
  ),
@@ -312,12 +310,12 @@ describe('Fixture Loader', () => {
312
310
 
313
311
  it('should insert multiple entities in correct order', () =>
314
312
  withTestTransaction(pool, async client => {
315
- const biz1 = makeUUID('business', 'biz-1');
316
- const biz2 = makeUUID('business', 'biz-2');
317
- const tax1 = makeUUID('tax-category', 'tax-1');
318
- const tax2 = makeUUID('tax-category', 'tax-2');
319
- const charge1 = makeUUID('charge', 'charge-1');
320
- const charge2 = makeUUID('charge', 'charge-2');
313
+ const biz1 = makeUUID('biz-1');
314
+ const biz2 = makeUUID('biz-2');
315
+ const tax1 = makeUUID('tax-1');
316
+ const tax2 = makeUUID('tax-2');
317
+ const charge1 = makeUUID('charge-1');
318
+ const charge2 = makeUUID('charge-2');
321
319
 
322
320
  const fixture: Fixture = {
323
321
  businesses: {
@@ -362,7 +360,7 @@ describe('Fixture Loader', () => {
362
360
 
363
361
  it('should handle ON CONFLICT for idempotent insertion', () =>
364
362
  withTestTransaction(pool, async client => {
365
- const businessId = makeUUID('business', 'duplicate-biz');
363
+ const businessId = makeUUID('duplicate-biz');
366
364
 
367
365
  const fixture: Fixture = {
368
366
  businesses: {
@@ -394,11 +392,11 @@ describe('Fixture Loader', () => {
394
392
 
395
393
  it('should insert transactions with generated source_id', () =>
396
394
  withTestTransaction(pool, async client => {
397
- const businessId = makeUUID('business', 'biz-tx');
398
- const taxCatId = makeUUID('tax-category', 'tax-tx');
399
- const chargeId = makeUUID('charge', 'charge-tx');
395
+ const businessId = makeUUID('biz-tx');
396
+ const taxCatId = makeUUID('tax-tx');
397
+ const chargeId = makeUUID('charge-tx');
400
398
  const accountNumber = 'ACC-TX-001';
401
- const transactionId = makeUUID('transaction', 'tx-with-source');
399
+ const transactionId = makeUUID('tx-with-source');
402
400
 
403
401
  const fixture: Fixture = {
404
402
  businesses: {
@@ -12,7 +12,7 @@ import type { PoolClient } from 'pg';
12
12
  import type { Fixture } from './fixture-types.js';
13
13
  import { assertValidFixture } from './fixture-validation.js';
14
14
  import { qualifyTable } from './test-db-config.js';
15
- import { makeUUID, makeUUIDLegacy } from '../../demo-fixtures/helpers/deterministic-uuid.js';
15
+ import { makeUUID } from '../factories/ids.js';
16
16
 
17
17
  /**
18
18
  * Custom error for fixture insertion failures
@@ -334,7 +334,7 @@ export async function insertFixture(
334
334
  // Insert directly into transactions_raw_list with etherscan_id to satisfy check constraint
335
335
  // This avoids triggering any creditcard/bank transaction handlers which would auto-create charges
336
336
  // etherscan_id is used because it has no INSERT trigger and is a simple UUID reference
337
- const dummyEtherscanId = transaction.id ? makeUUID('raw-transaction', `etherscan-${transaction.id}`) : makeUUIDLegacy();
337
+ const dummyEtherscanId = transaction.id ? makeUUID(`etherscan-${transaction.id}`) : makeUUID();
338
338
  const rawListResult = await client.query(
339
339
  `INSERT INTO ${qualifyTable('transactions_raw_list')} (etherscan_id)
340
340
  VALUES ($1)