@happyvertical/smrt-ledgers 0.40.40 → 0.40.41

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.
@@ -1,226 +1,170 @@
1
1
  {
2
2
  "version": "1.0.0",
3
- "timestamp": 1785468278736,
3
+ "timestamp": 1785471935919,
4
4
  "packageName": "@happyvertical/smrt-ledgers",
5
- "packageVersion": "0.40.40",
5
+ "packageVersion": "0.40.41",
6
6
  "objects": {
7
- "@happyvertical/smrt-ledgers:Account": {
8
- "name": "account",
9
- "className": "Account",
10
- "qualifiedName": "@happyvertical/smrt-ledgers:Account",
7
+ "@happyvertical/smrt-ledgers:AccountCollection": {
8
+ "name": "accountcollection",
9
+ "className": "AccountCollection",
10
+ "qualifiedName": "@happyvertical/smrt-ledgers:AccountCollection",
11
11
  "collection": "accounts",
12
- "filePath": "/home/runner/_work/smrt/smrt/packages/ledgers/src/models/Account.ts",
12
+ "filePath": "/home/runner/_work/smrt/smrt/packages/ledgers/src/collections/Accounts.ts",
13
13
  "packageName": "@happyvertical/smrt-ledgers",
14
- "fields": {
15
- "parentId": {
16
- "type": "foreignKey",
17
- "required": false,
18
- "related": "Account",
19
- "_meta": {
20
- "nullable": true
21
- }
22
- },
23
- "tenantId": {
24
- "type": "text",
25
- "required": false,
26
- "_meta": {
27
- "sqlType": "UUID",
28
- "nullable": true,
29
- "__tenancy": {
30
- "isTenantIdField": true,
31
- "autoFilter": true,
32
- "required": false,
33
- "autoPopulate": true,
34
- "nullable": true,
35
- "mode": "optional",
36
- "field": "tenantId",
37
- "allowSuperAdminBypass": false
38
- }
39
- }
40
- },
41
- "number": {
42
- "type": "text",
43
- "required": false,
44
- "default": ""
45
- },
46
- "name": {
47
- "type": "text",
48
- "required": false,
49
- "default": ""
50
- },
51
- "description": {
52
- "type": "text",
53
- "required": false,
54
- "default": ""
55
- },
56
- "type": {
57
- "type": "text",
58
- "required": false,
59
- "default": "asset"
60
- },
61
- "active": {
62
- "type": "boolean",
63
- "required": false,
64
- "default": true
65
- },
66
- "metadata": {
67
- "type": "json",
68
- "required": false,
69
- "default": {}
70
- }
71
- },
14
+ "fields": {},
72
15
  "methods": {
73
- "getParent": {
74
- "name": "getParent",
75
- "async": true,
76
- "parameters": [],
77
- "returnType": "Promise<null>",
78
- "isStatic": false,
79
- "isPublic": true
80
- },
81
- "getChildren": {
82
- "name": "getChildren",
16
+ "findByNumber": {
17
+ "name": "findByNumber",
83
18
  "async": true,
84
- "parameters": [],
85
- "returnType": "Promise",
19
+ "parameters": [
20
+ {
21
+ "name": "number",
22
+ "type": "string",
23
+ "optional": false
24
+ }
25
+ ],
26
+ "returnType": "Promise<Account | null>",
86
27
  "isStatic": false,
87
28
  "isPublic": true
88
29
  },
89
- "getAncestors": {
90
- "name": "getAncestors",
30
+ "findByType": {
31
+ "name": "findByType",
91
32
  "async": true,
92
- "parameters": [],
93
- "returnType": "Promise",
33
+ "parameters": [
34
+ {
35
+ "name": "type",
36
+ "type": "AccountType",
37
+ "optional": false
38
+ }
39
+ ],
40
+ "returnType": "Promise<Account[]>",
94
41
  "isStatic": false,
95
42
  "isPublic": true
96
43
  },
97
- "getDescendants": {
98
- "name": "getDescendants",
44
+ "findActive": {
45
+ "name": "findActive",
99
46
  "async": true,
100
47
  "parameters": [],
101
- "returnType": "Promise",
48
+ "returnType": "Promise<Account[]>",
102
49
  "isStatic": false,
103
50
  "isPublic": true
104
51
  },
105
- "getHierarchy": {
106
- "name": "getHierarchy",
52
+ "findTopLevel": {
53
+ "name": "findTopLevel",
107
54
  "async": true,
108
55
  "parameters": [],
109
- "returnType": "Promise<HierarchyView>",
56
+ "returnType": "Promise<Account[]>",
110
57
  "isStatic": false,
111
58
  "isPublic": true
112
59
  },
113
- "moveTo": {
114
- "name": "moveTo",
60
+ "findChildren": {
61
+ "name": "findChildren",
115
62
  "async": true,
116
63
  "parameters": [
117
64
  {
118
- "name": "newParent",
119
- "type": "string | null",
65
+ "name": "parentId",
66
+ "type": "string",
120
67
  "optional": false
121
68
  }
122
69
  ],
123
- "returnType": "Promise<void>",
124
- "isStatic": false,
125
- "isPublic": true
126
- },
127
- "isTopLevel": {
128
- "name": "isTopLevel",
129
- "async": false,
130
- "parameters": [],
131
- "returnType": "boolean",
70
+ "returnType": "Promise<Account[]>",
132
71
  "isStatic": false,
133
72
  "isPublic": true
134
73
  },
135
- "isDebitNormal": {
136
- "name": "isDebitNormal",
137
- "async": false,
74
+ "getTree": {
75
+ "name": "getTree",
76
+ "async": true,
138
77
  "parameters": [],
139
- "returnType": "boolean",
78
+ "returnType": "Promise<AccountTree>",
140
79
  "isStatic": false,
141
80
  "isPublic": true
142
81
  },
143
- "isCreditNormal": {
144
- "name": "isCreditNormal",
145
- "async": false,
146
- "parameters": [],
147
- "returnType": "boolean",
82
+ "getOrCreateByNumber": {
83
+ "name": "getOrCreateByNumber",
84
+ "async": true,
85
+ "parameters": [
86
+ {
87
+ "name": "number",
88
+ "type": "string",
89
+ "optional": false
90
+ },
91
+ {
92
+ "name": "defaults",
93
+ "type": "Partial<object>",
94
+ "optional": true
95
+ }
96
+ ],
97
+ "returnType": "Promise<Account>",
148
98
  "isStatic": false,
149
99
  "isPublic": true
150
100
  },
151
- "getFullPath": {
152
- "name": "getFullPath",
101
+ "groupByType": {
102
+ "name": "groupByType",
153
103
  "async": true,
154
104
  "parameters": [],
155
- "returnType": "Promise<string>",
105
+ "returnType": "Promise<Record<AccountType, Account[]>>",
156
106
  "isStatic": false,
157
107
  "isPublic": true
158
108
  },
159
- "toTreeNode": {
160
- "name": "toTreeNode",
109
+ "getDescendants": {
110
+ "name": "getDescendants",
161
111
  "async": true,
162
- "parameters": [],
163
- "returnType": "Promise<AccountTreeNode>",
112
+ "parameters": [
113
+ {
114
+ "name": "accountId",
115
+ "type": "string",
116
+ "optional": false
117
+ }
118
+ ],
119
+ "returnType": "Promise<Account[]>",
164
120
  "isStatic": false,
165
121
  "isPublic": true
166
122
  },
167
- "getBalance": {
168
- "name": "getBalance",
123
+ "findByTenant": {
124
+ "name": "findByTenant",
169
125
  "async": true,
170
126
  "parameters": [
171
127
  {
172
- "name": "asOfDate",
173
- "type": "Date",
174
- "optional": true
128
+ "name": "tenantId",
129
+ "type": "string",
130
+ "optional": false
175
131
  }
176
132
  ],
177
- "returnType": "Promise<number>",
133
+ "returnType": "Promise<Account[]>",
178
134
  "isStatic": false,
179
135
  "isPublic": true
180
136
  },
181
- "createChild": {
182
- "name": "createChild",
137
+ "findGlobal": {
138
+ "name": "findGlobal",
139
+ "async": true,
140
+ "parameters": [],
141
+ "returnType": "Promise<Account[]>",
142
+ "isStatic": false,
143
+ "isPublic": true
144
+ },
145
+ "findWithGlobals": {
146
+ "name": "findWithGlobals",
183
147
  "async": true,
184
148
  "parameters": [
185
149
  {
186
- "name": "options",
187
- "type": "Omit<AccountOptions, 'parentId' | 'type'>",
150
+ "name": "tenantId",
151
+ "type": "string",
188
152
  "optional": false
189
153
  }
190
154
  ],
191
- "returnType": "Promise<Account>",
155
+ "returnType": "Promise<Account[]>",
192
156
  "isStatic": false,
193
157
  "isPublic": true
194
158
  }
195
159
  },
196
- "decoratorConfig": {
197
- "api": {
198
- "include": [
199
- "list",
200
- "get",
201
- "create",
202
- "update",
203
- "delete"
204
- ]
205
- },
206
- "mcp": {
207
- "include": [
208
- "list",
209
- "get",
210
- "create"
211
- ]
212
- },
213
- "cli": true,
214
- "tenantScoped": {
215
- "mode": "optional"
216
- }
217
- },
218
- "extends": "SmrtHierarchical",
219
- "exportName": "Account",
220
- "collectionExportName": "AccountCollection",
160
+ "decoratorConfig": {},
161
+ "extends": "SmrtCollection",
162
+ "extendsTypeArg": "Account",
163
+ "exportName": "AccountCollection",
164
+ "collectionExportName": "AccountCollectionCollection",
221
165
  "schema": {
222
- "tableName": "accounts",
223
- "ddl": "CREATE TABLE IF NOT EXISTS \"accounts\" (\n \"id\" UUID PRIMARY KEY NOT NULL,\n \"slug\" TEXT NOT NULL,\n \"context\" TEXT NOT NULL DEFAULT '',\n \"created_at\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\n \"updated_at\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\n \"parent_id\" UUID,\n \"tenant_id\" UUID,\n \"number\" TEXT DEFAULT '',\n \"name\" TEXT DEFAULT '',\n \"description\" TEXT DEFAULT '',\n \"type\" TEXT DEFAULT 'asset',\n \"active\" BOOLEAN DEFAULT TRUE,\n \"metadata\" JSON DEFAULT '{}'\n);",
166
+ "tableName": "account_collections",
167
+ "ddl": "CREATE TABLE IF NOT EXISTS \"account_collections\" (\n \"id\" UUID PRIMARY KEY NOT NULL,\n \"slug\" TEXT NOT NULL,\n \"context\" TEXT NOT NULL DEFAULT '',\n \"created_at\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\n \"updated_at\" TIMESTAMP NOT NULL DEFAULT current_timestamp\n);",
224
168
  "columns": {
225
169
  "id": {
226
170
  "type": "UUID",
@@ -246,65 +190,17 @@
246
190
  "type": "TIMESTAMP",
247
191
  "notNull": true,
248
192
  "default": "current_timestamp"
249
- },
250
- "parent_id": {
251
- "type": "UUID",
252
- "referenceKind": "foreignKey",
253
- "notNull": false,
254
- "unique": false
255
- },
256
- "tenant_id": {
257
- "type": "UUID",
258
- "referenceKind": "tenantId",
259
- "notNull": false,
260
- "unique": false
261
- },
262
- "number": {
263
- "type": "TEXT",
264
- "notNull": false,
265
- "unique": false,
266
- "default": ""
267
- },
268
- "name": {
269
- "type": "TEXT",
270
- "notNull": false,
271
- "unique": false,
272
- "default": ""
273
- },
274
- "description": {
275
- "type": "TEXT",
276
- "notNull": false,
277
- "unique": false,
278
- "default": ""
279
- },
280
- "type": {
281
- "type": "TEXT",
282
- "notNull": false,
283
- "unique": false,
284
- "default": "asset"
285
- },
286
- "active": {
287
- "type": "BOOLEAN",
288
- "notNull": false,
289
- "unique": false,
290
- "default": true
291
- },
292
- "metadata": {
293
- "type": "JSON",
294
- "notNull": false,
295
- "unique": false,
296
- "default": {}
297
- }
298
- },
299
- "indexes": [
300
- {
301
- "name": "accounts_id_idx",
302
- "columns": [
303
- "id"
304
- ]
193
+ }
194
+ },
195
+ "indexes": [
196
+ {
197
+ "name": "account_collections_id_idx",
198
+ "columns": [
199
+ "id"
200
+ ]
305
201
  },
306
202
  {
307
- "name": "accounts_slug_context_idx",
203
+ "name": "account_collections_slug_context_idx",
308
204
  "columns": [
309
205
  "slug",
310
206
  "context"
@@ -312,217 +208,171 @@
312
208
  "unique": true
313
209
  }
314
210
  ],
315
- "version": "d63f1df8"
211
+ "version": "3802b462"
316
212
  }
317
213
  },
318
- "@happyvertical/smrt-ledgers:Journal": {
319
- "name": "journal",
320
- "className": "Journal",
321
- "qualifiedName": "@happyvertical/smrt-ledgers:Journal",
322
- "collection": "journals",
323
- "filePath": "/home/runner/_work/smrt/smrt/packages/ledgers/src/models/Journal.ts",
214
+ "@happyvertical/smrt-ledgers:JournalEntryCollection": {
215
+ "name": "journalentrycollection",
216
+ "className": "JournalEntryCollection",
217
+ "qualifiedName": "@happyvertical/smrt-ledgers:JournalEntryCollection",
218
+ "collection": "journalentries",
219
+ "filePath": "/home/runner/_work/smrt/smrt/packages/ledgers/src/collections/JournalEntries.ts",
324
220
  "packageName": "@happyvertical/smrt-ledgers",
325
- "fields": {
326
- "tenantId": {
327
- "type": "text",
328
- "required": false,
329
- "_meta": {
330
- "sqlType": "UUID",
331
- "nullable": true,
332
- "__tenancy": {
333
- "isTenantIdField": true,
334
- "autoFilter": true,
335
- "required": false,
336
- "autoPopulate": true,
337
- "nullable": true,
338
- "mode": "optional",
339
- "field": "tenantId",
340
- "allowSuperAdminBypass": false
341
- }
342
- }
343
- },
344
- "number": {
345
- "type": "text",
346
- "required": false,
347
- "default": ""
348
- },
349
- "date": {
350
- "type": "datetime",
351
- "required": false
352
- },
353
- "description": {
354
- "type": "text",
355
- "required": false,
356
- "default": ""
357
- },
358
- "sourceModule": {
359
- "type": "text",
360
- "required": false,
361
- "default": ""
362
- },
363
- "sourceRef": {
364
- "type": "text",
365
- "required": false
366
- },
367
- "status": {
368
- "type": "text",
369
- "required": false,
370
- "default": "draft"
371
- },
372
- "postedAt": {
373
- "type": "datetime",
374
- "required": false
375
- },
376
- "voidedAt": {
377
- "type": "datetime",
378
- "required": false
379
- },
380
- "voidReason": {
381
- "type": "text",
382
- "required": false
383
- },
384
- "metadata": {
385
- "type": "json",
386
- "required": false,
387
- "default": {}
388
- }
389
- },
221
+ "fields": {},
390
222
  "methods": {
391
- "isDraft": {
392
- "name": "isDraft",
393
- "async": false,
394
- "parameters": [],
395
- "returnType": "boolean",
396
- "isStatic": false,
397
- "isPublic": true
398
- },
399
- "isPosted": {
400
- "name": "isPosted",
401
- "async": false,
402
- "parameters": [],
403
- "returnType": "boolean",
404
- "isStatic": false,
405
- "isPublic": true
406
- },
407
- "isVoided": {
408
- "name": "isVoided",
409
- "async": false,
410
- "parameters": [],
411
- "returnType": "boolean",
412
- "isStatic": false,
413
- "isPublic": true
414
- },
415
- "isEditable": {
416
- "name": "isEditable",
417
- "async": false,
418
- "parameters": [],
419
- "returnType": "boolean",
223
+ "findByJournal": {
224
+ "name": "findByJournal",
225
+ "async": true,
226
+ "parameters": [
227
+ {
228
+ "name": "journalId",
229
+ "type": "string",
230
+ "optional": false
231
+ }
232
+ ],
233
+ "returnType": "Promise<JournalEntry[]>",
420
234
  "isStatic": false,
421
235
  "isPublic": true
422
236
  },
423
- "getEntries": {
424
- "name": "getEntries",
237
+ "findByAccount": {
238
+ "name": "findByAccount",
425
239
  "async": true,
426
- "parameters": [],
427
- "returnType": "Promise",
240
+ "parameters": [
241
+ {
242
+ "name": "accountId",
243
+ "type": "string",
244
+ "optional": false
245
+ }
246
+ ],
247
+ "returnType": "Promise<JournalEntry[]>",
428
248
  "isStatic": false,
429
249
  "isPublic": true
430
250
  },
431
- "getTotalDebits": {
432
- "name": "getTotalDebits",
251
+ "getAccountBalance": {
252
+ "name": "getAccountBalance",
433
253
  "async": true,
434
- "parameters": [],
254
+ "parameters": [
255
+ {
256
+ "name": "accountId",
257
+ "type": "string",
258
+ "optional": false
259
+ },
260
+ {
261
+ "name": "asOfDate",
262
+ "type": "Date",
263
+ "optional": true
264
+ }
265
+ ],
435
266
  "returnType": "Promise<number>",
436
267
  "isStatic": false,
437
268
  "isPublic": true
438
269
  },
439
- "getTotalCredits": {
440
- "name": "getTotalCredits",
270
+ "getTrialBalance": {
271
+ "name": "getTrialBalance",
441
272
  "async": true,
442
- "parameters": [],
443
- "returnType": "Promise<number>",
273
+ "parameters": [
274
+ {
275
+ "name": "asOfDate",
276
+ "type": "Date",
277
+ "optional": true
278
+ }
279
+ ],
280
+ "returnType": "Promise<TrialBalanceRow[]>",
444
281
  "isStatic": false,
445
282
  "isPublic": true
446
283
  },
447
- "isBalanced": {
448
- "name": "isBalanced",
284
+ "getTotalsForDateRange": {
285
+ "name": "getTotalsForDateRange",
449
286
  "async": true,
450
- "parameters": [],
451
- "returnType": "Promise<boolean>",
287
+ "parameters": [
288
+ {
289
+ "name": "start",
290
+ "type": "Date",
291
+ "optional": false
292
+ },
293
+ {
294
+ "name": "end",
295
+ "type": "Date",
296
+ "optional": false
297
+ }
298
+ ],
299
+ "returnType": "Promise<object>",
452
300
  "isStatic": false,
453
301
  "isPublic": true
454
302
  },
455
- "addEntry": {
456
- "name": "addEntry",
303
+ "findByAccounts": {
304
+ "name": "findByAccounts",
457
305
  "async": true,
458
306
  "parameters": [
459
307
  {
460
- "name": "data",
461
- "type": "JournalEntryData",
308
+ "name": "accountIds",
309
+ "type": "string[]",
462
310
  "optional": false
463
311
  }
464
312
  ],
465
- "returnType": "Promise<void>",
313
+ "returnType": "Promise<JournalEntry[]>",
466
314
  "isStatic": false,
467
315
  "isPublic": true
468
316
  },
469
- "post": {
470
- "name": "post",
317
+ "getAccountLedger": {
318
+ "name": "getAccountLedger",
471
319
  "async": true,
472
- "parameters": [],
473
- "returnType": "Promise<void>",
320
+ "parameters": [
321
+ {
322
+ "name": "accountId",
323
+ "type": "string",
324
+ "optional": false
325
+ }
326
+ ],
327
+ "returnType": "Promise<Array<object>>",
474
328
  "isStatic": false,
475
329
  "isPublic": true
476
330
  },
477
- "void": {
478
- "name": "void",
331
+ "findByTenant": {
332
+ "name": "findByTenant",
479
333
  "async": true,
480
334
  "parameters": [
481
335
  {
482
- "name": "reason",
336
+ "name": "tenantId",
483
337
  "type": "string",
484
338
  "optional": false
485
339
  }
486
340
  ],
487
- "returnType": "Promise<void>",
341
+ "returnType": "Promise<JournalEntry[]>",
488
342
  "isStatic": false,
489
343
  "isPublic": true
490
344
  },
491
- "summarize": {
492
- "name": "summarize",
345
+ "findGlobal": {
346
+ "name": "findGlobal",
493
347
  "async": true,
494
348
  "parameters": [],
495
- "returnType": "Promise<string>",
349
+ "returnType": "Promise<JournalEntry[]>",
496
350
  "isStatic": false,
497
351
  "isPublic": true
498
- }
499
- },
500
- "decoratorConfig": {
501
- "api": {
502
- "include": [
503
- "list",
504
- "get",
505
- "create"
506
- ]
507
352
  },
508
- "mcp": {
509
- "include": [
510
- "list",
511
- "get",
512
- "create"
513
- ]
514
- },
515
- "cli": true,
516
- "tenantScoped": {
517
- "mode": "optional"
353
+ "findWithGlobals": {
354
+ "name": "findWithGlobals",
355
+ "async": true,
356
+ "parameters": [
357
+ {
358
+ "name": "tenantId",
359
+ "type": "string",
360
+ "optional": false
361
+ }
362
+ ],
363
+ "returnType": "Promise<JournalEntry[]>",
364
+ "isStatic": false,
365
+ "isPublic": true
518
366
  }
519
367
  },
520
- "extends": "SmrtObject",
521
- "exportName": "Journal",
522
- "collectionExportName": "JournalCollection",
368
+ "decoratorConfig": {},
369
+ "extends": "SmrtCollection",
370
+ "extendsTypeArg": "JournalEntry",
371
+ "exportName": "JournalEntryCollection",
372
+ "collectionExportName": "JournalEntryCollectionCollection",
523
373
  "schema": {
524
- "tableName": "journals",
525
- "ddl": "CREATE TABLE IF NOT EXISTS \"journals\" (\n \"id\" UUID PRIMARY KEY NOT NULL,\n \"slug\" TEXT NOT NULL,\n \"context\" TEXT NOT NULL DEFAULT '',\n \"created_at\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\n \"updated_at\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\n \"tenant_id\" UUID,\n \"number\" TEXT DEFAULT '',\n \"date\" TIMESTAMP,\n \"description\" TEXT DEFAULT '',\n \"source_module\" TEXT DEFAULT '',\n \"source_ref\" TEXT,\n \"status\" TEXT DEFAULT 'draft',\n \"posted_at\" TIMESTAMP,\n \"voided_at\" TIMESTAMP,\n \"void_reason\" TEXT,\n \"metadata\" JSON DEFAULT '{}'\n);",
374
+ "tableName": "journal_entry_collections",
375
+ "ddl": "CREATE TABLE IF NOT EXISTS \"journal_entry_collections\" (\n \"id\" UUID PRIMARY KEY NOT NULL,\n \"slug\" TEXT NOT NULL,\n \"context\" TEXT NOT NULL DEFAULT '',\n \"created_at\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\n \"updated_at\" TIMESTAMP NOT NULL DEFAULT current_timestamp\n);",
526
376
  "columns": {
527
377
  "id": {
528
378
  "type": "UUID",
@@ -548,78 +398,17 @@
548
398
  "type": "TIMESTAMP",
549
399
  "notNull": true,
550
400
  "default": "current_timestamp"
551
- },
552
- "tenant_id": {
553
- "type": "UUID",
554
- "referenceKind": "tenantId",
555
- "notNull": false,
556
- "unique": false
557
- },
558
- "number": {
559
- "type": "TEXT",
560
- "notNull": false,
561
- "unique": false,
562
- "default": ""
563
- },
564
- "date": {
565
- "type": "TIMESTAMP",
566
- "notNull": false,
567
- "unique": false
568
- },
569
- "description": {
570
- "type": "TEXT",
571
- "notNull": false,
572
- "unique": false,
573
- "default": ""
574
- },
575
- "source_module": {
576
- "type": "TEXT",
577
- "notNull": false,
578
- "unique": false,
579
- "default": ""
580
- },
581
- "source_ref": {
582
- "type": "TEXT",
583
- "notNull": false,
584
- "unique": false
585
- },
586
- "status": {
587
- "type": "TEXT",
588
- "notNull": false,
589
- "unique": false,
590
- "default": "draft"
591
- },
592
- "posted_at": {
593
- "type": "TIMESTAMP",
594
- "notNull": false,
595
- "unique": false
596
- },
597
- "voided_at": {
598
- "type": "TIMESTAMP",
599
- "notNull": false,
600
- "unique": false
601
- },
602
- "void_reason": {
603
- "type": "TEXT",
604
- "notNull": false,
605
- "unique": false
606
- },
607
- "metadata": {
608
- "type": "JSON",
609
- "notNull": false,
610
- "unique": false,
611
- "default": {}
612
401
  }
613
402
  },
614
403
  "indexes": [
615
404
  {
616
- "name": "journals_id_idx",
405
+ "name": "journal_entry_collections_id_idx",
617
406
  "columns": [
618
407
  "id"
619
408
  ]
620
409
  },
621
410
  {
622
- "name": "journals_slug_context_idx",
411
+ "name": "journal_entry_collections_slug_context_idx",
623
412
  "columns": [
624
413
  "slug",
625
414
  "context"
@@ -627,248 +416,256 @@
627
416
  "unique": true
628
417
  }
629
418
  ],
630
- "version": "4b51d204"
419
+ "version": "2cb6f73a"
631
420
  }
632
421
  },
633
- "@happyvertical/smrt-ledgers:JournalEntry": {
634
- "name": "journalentry",
635
- "className": "JournalEntry",
636
- "qualifiedName": "@happyvertical/smrt-ledgers:JournalEntry",
637
- "collection": "journalentries",
638
- "filePath": "/home/runner/_work/smrt/smrt/packages/ledgers/src/models/JournalEntry.ts",
422
+ "@happyvertical/smrt-ledgers:JournalCollection": {
423
+ "name": "journalcollection",
424
+ "className": "JournalCollection",
425
+ "qualifiedName": "@happyvertical/smrt-ledgers:JournalCollection",
426
+ "collection": "journals",
427
+ "filePath": "/home/runner/_work/smrt/smrt/packages/ledgers/src/collections/Journals.ts",
639
428
  "packageName": "@happyvertical/smrt-ledgers",
640
- "fields": {
641
- "tenantId": {
642
- "type": "text",
643
- "required": false,
644
- "_meta": {
645
- "sqlType": "UUID",
646
- "nullable": true,
647
- "__tenancy": {
648
- "isTenantIdField": true,
649
- "autoFilter": true,
650
- "required": false,
651
- "autoPopulate": true,
652
- "nullable": true,
653
- "mode": "optional",
654
- "field": "tenantId",
655
- "allowSuperAdminBypass": false
429
+ "fields": {},
430
+ "methods": {
431
+ "findByNumber": {
432
+ "name": "findByNumber",
433
+ "async": true,
434
+ "parameters": [
435
+ {
436
+ "name": "number",
437
+ "type": "string",
438
+ "optional": false
656
439
  }
657
- }
658
- },
659
- "journalId": {
660
- "type": "foreignKey",
661
- "required": false,
662
- "related": "Journal"
663
- },
664
- "accountId": {
665
- "type": "foreignKey",
666
- "required": false,
667
- "related": "Account"
668
- },
669
- "debit": {
670
- "type": "decimal",
671
- "required": false,
672
- "default": 0
673
- },
674
- "credit": {
675
- "type": "decimal",
676
- "required": false,
677
- "default": 0
440
+ ],
441
+ "returnType": "Promise<Journal | null>",
442
+ "isStatic": false,
443
+ "isPublic": true
678
444
  },
679
- "currency": {
680
- "type": "text",
681
- "required": false,
682
- "default": "USD"
445
+ "findByDateRange": {
446
+ "name": "findByDateRange",
447
+ "async": true,
448
+ "parameters": [
449
+ {
450
+ "name": "start",
451
+ "type": "Date",
452
+ "optional": false
453
+ },
454
+ {
455
+ "name": "end",
456
+ "type": "Date",
457
+ "optional": false
458
+ }
459
+ ],
460
+ "returnType": "Promise<Journal[]>",
461
+ "isStatic": false,
462
+ "isPublic": true
683
463
  },
684
- "exchangeRate": {
685
- "type": "decimal",
686
- "required": false,
687
- "default": 1
464
+ "findBySource": {
465
+ "name": "findBySource",
466
+ "async": true,
467
+ "parameters": [
468
+ {
469
+ "name": "sourceModule",
470
+ "type": "string",
471
+ "optional": false
472
+ }
473
+ ],
474
+ "returnType": "Promise<Journal[]>",
475
+ "isStatic": false,
476
+ "isPublic": true
688
477
  },
689
- "memo": {
690
- "type": "text",
691
- "required": false,
692
- "default": ""
478
+ "findByStatus": {
479
+ "name": "findByStatus",
480
+ "async": true,
481
+ "parameters": [
482
+ {
483
+ "name": "status",
484
+ "type": "JournalStatus",
485
+ "optional": false
486
+ }
487
+ ],
488
+ "returnType": "Promise<Journal[]>",
489
+ "isStatic": false,
490
+ "isPublic": true
693
491
  },
694
- "metadata": {
695
- "type": "json",
696
- "required": false,
697
- "default": {}
698
- }
699
- },
700
- "methods": {
701
- "isDebit": {
702
- "name": "isDebit",
703
- "async": false,
492
+ "findDrafts": {
493
+ "name": "findDrafts",
494
+ "async": true,
704
495
  "parameters": [],
705
- "returnType": "boolean",
496
+ "returnType": "Promise<Journal[]>",
706
497
  "isStatic": false,
707
498
  "isPublic": true
708
499
  },
709
- "isCredit": {
710
- "name": "isCredit",
711
- "async": false,
500
+ "findPosted": {
501
+ "name": "findPosted",
502
+ "async": true,
712
503
  "parameters": [],
713
- "returnType": "boolean",
504
+ "returnType": "Promise<Journal[]>",
714
505
  "isStatic": false,
715
506
  "isPublic": true
716
507
  },
717
- "getAmount": {
718
- "name": "getAmount",
719
- "async": false,
720
- "parameters": [],
721
- "returnType": "number",
508
+ "createWithEntries": {
509
+ "name": "createWithEntries",
510
+ "async": true,
511
+ "parameters": [
512
+ {
513
+ "name": "data",
514
+ "type": "CreateJournalData",
515
+ "optional": false
516
+ }
517
+ ],
518
+ "returnType": "Promise<Journal>",
722
519
  "isStatic": false,
723
520
  "isPublic": true
724
521
  },
725
- "getBaseAmount": {
726
- "name": "getBaseAmount",
727
- "async": false,
728
- "parameters": [],
729
- "returnType": "number",
522
+ "post": {
523
+ "name": "post",
524
+ "async": true,
525
+ "parameters": [
526
+ {
527
+ "name": "journalId",
528
+ "type": "string",
529
+ "optional": false
530
+ }
531
+ ],
532
+ "returnType": "Promise<Journal>",
730
533
  "isStatic": false,
731
534
  "isPublic": true
732
535
  },
733
- "getJournal": {
734
- "name": "getJournal",
536
+ "void": {
537
+ "name": "void",
735
538
  "async": true,
736
- "parameters": [],
737
- "returnType": "Promise<null>",
539
+ "parameters": [
540
+ {
541
+ "name": "journalId",
542
+ "type": "string",
543
+ "optional": false
544
+ },
545
+ {
546
+ "name": "reason",
547
+ "type": "string",
548
+ "optional": false
549
+ }
550
+ ],
551
+ "returnType": "Promise<Journal>",
738
552
  "isStatic": false,
739
553
  "isPublic": true
740
554
  },
741
- "getAccount": {
742
- "name": "getAccount",
555
+ "findBySourceRef": {
556
+ "name": "findBySourceRef",
743
557
  "async": true,
744
- "parameters": [],
745
- "returnType": "Promise<null>",
558
+ "parameters": [
559
+ {
560
+ "name": "sourceRef",
561
+ "type": "string",
562
+ "optional": false
563
+ }
564
+ ],
565
+ "returnType": "Promise<Journal[]>",
746
566
  "isStatic": false,
747
567
  "isPublic": true
748
568
  },
749
- "getDescription": {
750
- "name": "getDescription",
569
+ "findByMonth": {
570
+ "name": "findByMonth",
751
571
  "async": true,
752
- "parameters": [],
753
- "returnType": "Promise<string>",
572
+ "parameters": [
573
+ {
574
+ "name": "year",
575
+ "type": "number",
576
+ "optional": false
577
+ },
578
+ {
579
+ "name": "month",
580
+ "type": "number",
581
+ "optional": false
582
+ }
583
+ ],
584
+ "returnType": "Promise<Journal[]>",
754
585
  "isStatic": false,
755
586
  "isPublic": true
756
- }
757
- },
758
- "decoratorConfig": {
759
- "api": {
760
- "include": [
761
- "list",
762
- "get"
763
- ]
764
587
  },
765
- "mcp": {
766
- "include": [
767
- "list",
768
- "get"
769
- ]
588
+ "findByTenant": {
589
+ "name": "findByTenant",
590
+ "async": true,
591
+ "parameters": [
592
+ {
593
+ "name": "tenantId",
594
+ "type": "string",
595
+ "optional": false
596
+ }
597
+ ],
598
+ "returnType": "Promise<Journal[]>",
599
+ "isStatic": false,
600
+ "isPublic": true
770
601
  },
771
- "cli": true,
772
- "tenantScoped": {
773
- "mode": "optional"
602
+ "findGlobal": {
603
+ "name": "findGlobal",
604
+ "async": true,
605
+ "parameters": [],
606
+ "returnType": "Promise<Journal[]>",
607
+ "isStatic": false,
608
+ "isPublic": true
609
+ },
610
+ "findWithGlobals": {
611
+ "name": "findWithGlobals",
612
+ "async": true,
613
+ "parameters": [
614
+ {
615
+ "name": "tenantId",
616
+ "type": "string",
617
+ "optional": false
618
+ }
619
+ ],
620
+ "returnType": "Promise<Journal[]>",
621
+ "isStatic": false,
622
+ "isPublic": true
774
623
  }
775
624
  },
776
- "extends": "SmrtObject",
777
- "exportName": "JournalEntry",
778
- "collectionExportName": "JournalEntryCollection",
625
+ "decoratorConfig": {},
626
+ "extends": "SmrtCollection",
627
+ "extendsTypeArg": "Journal",
628
+ "exportName": "JournalCollection",
629
+ "collectionExportName": "JournalCollectionCollection",
779
630
  "schema": {
780
- "tableName": "journal_entries",
781
- "ddl": "CREATE TABLE IF NOT EXISTS \"journal_entries\" (\n \"id\" UUID PRIMARY KEY NOT NULL,\n \"slug\" TEXT NOT NULL,\n \"context\" TEXT NOT NULL DEFAULT '',\n \"created_at\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\n \"updated_at\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\n \"tenant_id\" UUID,\n \"journal_id\" UUID,\n \"account_id\" UUID,\n \"debit\" REAL DEFAULT 0,\n \"credit\" REAL DEFAULT 0,\n \"currency\" TEXT DEFAULT 'USD',\n \"exchange_rate\" REAL DEFAULT 1,\n \"memo\" TEXT DEFAULT '',\n \"metadata\" JSON DEFAULT '{}'\n);",
631
+ "tableName": "journal_collections",
632
+ "ddl": "CREATE TABLE IF NOT EXISTS \"journal_collections\" (\n \"id\" UUID PRIMARY KEY NOT NULL,\n \"slug\" TEXT NOT NULL,\n \"context\" TEXT NOT NULL DEFAULT '',\n \"created_at\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\n \"updated_at\" TIMESTAMP NOT NULL DEFAULT current_timestamp\n);",
782
633
  "columns": {
783
634
  "id": {
784
635
  "type": "UUID",
785
636
  "primaryKey": true,
786
- "referenceKind": "id",
787
- "notNull": true
788
- },
789
- "slug": {
790
- "type": "TEXT",
791
- "notNull": true
792
- },
793
- "context": {
794
- "type": "TEXT",
795
- "notNull": true,
796
- "default": ""
797
- },
798
- "created_at": {
799
- "type": "TIMESTAMP",
800
- "notNull": true,
801
- "default": "current_timestamp"
802
- },
803
- "updated_at": {
804
- "type": "TIMESTAMP",
805
- "notNull": true,
806
- "default": "current_timestamp"
807
- },
808
- "tenant_id": {
809
- "type": "UUID",
810
- "referenceKind": "tenantId",
811
- "notNull": false,
812
- "unique": false
813
- },
814
- "journal_id": {
815
- "type": "UUID",
816
- "referenceKind": "foreignKey",
817
- "notNull": false,
818
- "unique": false
819
- },
820
- "account_id": {
821
- "type": "UUID",
822
- "referenceKind": "foreignKey",
823
- "notNull": false,
824
- "unique": false
825
- },
826
- "debit": {
827
- "type": "REAL",
828
- "notNull": false,
829
- "unique": false,
830
- "default": 0
831
- },
832
- "credit": {
833
- "type": "REAL",
834
- "notNull": false,
835
- "unique": false,
836
- "default": 0
637
+ "referenceKind": "id",
638
+ "notNull": true
837
639
  },
838
- "currency": {
640
+ "slug": {
839
641
  "type": "TEXT",
840
- "notNull": false,
841
- "unique": false,
842
- "default": "USD"
843
- },
844
- "exchange_rate": {
845
- "type": "REAL",
846
- "notNull": false,
847
- "unique": false,
848
- "default": 1
642
+ "notNull": true
849
643
  },
850
- "memo": {
644
+ "context": {
851
645
  "type": "TEXT",
852
- "notNull": false,
853
- "unique": false,
646
+ "notNull": true,
854
647
  "default": ""
855
648
  },
856
- "metadata": {
857
- "type": "JSON",
858
- "notNull": false,
859
- "unique": false,
860
- "default": {}
649
+ "created_at": {
650
+ "type": "TIMESTAMP",
651
+ "notNull": true,
652
+ "default": "current_timestamp"
653
+ },
654
+ "updated_at": {
655
+ "type": "TIMESTAMP",
656
+ "notNull": true,
657
+ "default": "current_timestamp"
861
658
  }
862
659
  },
863
660
  "indexes": [
864
661
  {
865
- "name": "journal_entries_id_idx",
662
+ "name": "journal_collections_id_idx",
866
663
  "columns": [
867
664
  "id"
868
665
  ]
869
666
  },
870
667
  {
871
- "name": "journal_entries_slug_context_idx",
668
+ "name": "journal_collections_slug_context_idx",
872
669
  "columns": [
873
670
  "slug",
874
671
  "context"
@@ -876,170 +673,226 @@
876
673
  "unique": true
877
674
  }
878
675
  ],
879
- "version": "b5a42f7b"
676
+ "version": "665cc41d"
880
677
  }
881
678
  },
882
- "@happyvertical/smrt-ledgers:AccountCollection": {
883
- "name": "accountcollection",
884
- "className": "AccountCollection",
885
- "qualifiedName": "@happyvertical/smrt-ledgers:AccountCollection",
679
+ "@happyvertical/smrt-ledgers:Account": {
680
+ "name": "account",
681
+ "className": "Account",
682
+ "qualifiedName": "@happyvertical/smrt-ledgers:Account",
886
683
  "collection": "accounts",
887
- "filePath": "/home/runner/_work/smrt/smrt/packages/ledgers/src/collections/Accounts.ts",
684
+ "filePath": "/home/runner/_work/smrt/smrt/packages/ledgers/src/models/Account.ts",
888
685
  "packageName": "@happyvertical/smrt-ledgers",
889
- "fields": {},
686
+ "fields": {
687
+ "parentId": {
688
+ "type": "foreignKey",
689
+ "required": false,
690
+ "related": "Account",
691
+ "_meta": {
692
+ "nullable": true
693
+ }
694
+ },
695
+ "tenantId": {
696
+ "type": "text",
697
+ "required": false,
698
+ "_meta": {
699
+ "sqlType": "UUID",
700
+ "nullable": true,
701
+ "__tenancy": {
702
+ "isTenantIdField": true,
703
+ "autoFilter": true,
704
+ "required": false,
705
+ "autoPopulate": true,
706
+ "nullable": true,
707
+ "mode": "optional",
708
+ "field": "tenantId",
709
+ "allowSuperAdminBypass": false
710
+ }
711
+ }
712
+ },
713
+ "number": {
714
+ "type": "text",
715
+ "required": false,
716
+ "default": ""
717
+ },
718
+ "name": {
719
+ "type": "text",
720
+ "required": false,
721
+ "default": ""
722
+ },
723
+ "description": {
724
+ "type": "text",
725
+ "required": false,
726
+ "default": ""
727
+ },
728
+ "type": {
729
+ "type": "text",
730
+ "required": false,
731
+ "default": "asset"
732
+ },
733
+ "active": {
734
+ "type": "boolean",
735
+ "required": false,
736
+ "default": true
737
+ },
738
+ "metadata": {
739
+ "type": "json",
740
+ "required": false,
741
+ "default": {}
742
+ }
743
+ },
890
744
  "methods": {
891
- "findByNumber": {
892
- "name": "findByNumber",
745
+ "getParent": {
746
+ "name": "getParent",
893
747
  "async": true,
894
- "parameters": [
895
- {
896
- "name": "number",
897
- "type": "string",
898
- "optional": false
899
- }
900
- ],
901
- "returnType": "Promise<Account | null>",
748
+ "parameters": [],
749
+ "returnType": "Promise<null>",
902
750
  "isStatic": false,
903
751
  "isPublic": true
904
752
  },
905
- "findByType": {
906
- "name": "findByType",
753
+ "getChildren": {
754
+ "name": "getChildren",
907
755
  "async": true,
908
- "parameters": [
909
- {
910
- "name": "type",
911
- "type": "AccountType",
912
- "optional": false
913
- }
914
- ],
915
- "returnType": "Promise<Account[]>",
756
+ "parameters": [],
757
+ "returnType": "Promise",
916
758
  "isStatic": false,
917
759
  "isPublic": true
918
760
  },
919
- "findActive": {
920
- "name": "findActive",
761
+ "getAncestors": {
762
+ "name": "getAncestors",
921
763
  "async": true,
922
764
  "parameters": [],
923
- "returnType": "Promise<Account[]>",
765
+ "returnType": "Promise",
924
766
  "isStatic": false,
925
767
  "isPublic": true
926
768
  },
927
- "findTopLevel": {
928
- "name": "findTopLevel",
769
+ "getDescendants": {
770
+ "name": "getDescendants",
929
771
  "async": true,
930
772
  "parameters": [],
931
- "returnType": "Promise<Account[]>",
773
+ "returnType": "Promise",
932
774
  "isStatic": false,
933
775
  "isPublic": true
934
776
  },
935
- "findChildren": {
936
- "name": "findChildren",
777
+ "getHierarchy": {
778
+ "name": "getHierarchy",
779
+ "async": true,
780
+ "parameters": [],
781
+ "returnType": "Promise<HierarchyView>",
782
+ "isStatic": false,
783
+ "isPublic": true
784
+ },
785
+ "moveTo": {
786
+ "name": "moveTo",
937
787
  "async": true,
938
788
  "parameters": [
939
789
  {
940
- "name": "parentId",
941
- "type": "string",
790
+ "name": "newParent",
791
+ "type": "string | null",
942
792
  "optional": false
943
793
  }
944
794
  ],
945
- "returnType": "Promise<Account[]>",
795
+ "returnType": "Promise<void>",
946
796
  "isStatic": false,
947
797
  "isPublic": true
948
798
  },
949
- "getTree": {
950
- "name": "getTree",
951
- "async": true,
799
+ "isTopLevel": {
800
+ "name": "isTopLevel",
801
+ "async": false,
952
802
  "parameters": [],
953
- "returnType": "Promise<AccountTree>",
803
+ "returnType": "boolean",
954
804
  "isStatic": false,
955
805
  "isPublic": true
956
806
  },
957
- "getOrCreateByNumber": {
958
- "name": "getOrCreateByNumber",
807
+ "isDebitNormal": {
808
+ "name": "isDebitNormal",
809
+ "async": false,
810
+ "parameters": [],
811
+ "returnType": "boolean",
812
+ "isStatic": false,
813
+ "isPublic": true
814
+ },
815
+ "isCreditNormal": {
816
+ "name": "isCreditNormal",
817
+ "async": false,
818
+ "parameters": [],
819
+ "returnType": "boolean",
820
+ "isStatic": false,
821
+ "isPublic": true
822
+ },
823
+ "getFullPath": {
824
+ "name": "getFullPath",
959
825
  "async": true,
960
- "parameters": [
961
- {
962
- "name": "number",
963
- "type": "string",
964
- "optional": false
965
- },
966
- {
967
- "name": "defaults",
968
- "type": "Partial<object>",
969
- "optional": true
970
- }
971
- ],
972
- "returnType": "Promise<Account>",
826
+ "parameters": [],
827
+ "returnType": "Promise<string>",
973
828
  "isStatic": false,
974
829
  "isPublic": true
975
830
  },
976
- "groupByType": {
977
- "name": "groupByType",
831
+ "toTreeNode": {
832
+ "name": "toTreeNode",
978
833
  "async": true,
979
834
  "parameters": [],
980
- "returnType": "Promise<Record<AccountType, Account[]>>",
835
+ "returnType": "Promise<AccountTreeNode>",
981
836
  "isStatic": false,
982
837
  "isPublic": true
983
838
  },
984
- "getDescendants": {
985
- "name": "getDescendants",
839
+ "getBalance": {
840
+ "name": "getBalance",
986
841
  "async": true,
987
842
  "parameters": [
988
843
  {
989
- "name": "accountId",
990
- "type": "string",
991
- "optional": false
844
+ "name": "asOfDate",
845
+ "type": "Date",
846
+ "optional": true
992
847
  }
993
848
  ],
994
- "returnType": "Promise<Account[]>",
849
+ "returnType": "Promise<number>",
995
850
  "isStatic": false,
996
851
  "isPublic": true
997
852
  },
998
- "findByTenant": {
999
- "name": "findByTenant",
853
+ "createChild": {
854
+ "name": "createChild",
1000
855
  "async": true,
1001
856
  "parameters": [
1002
857
  {
1003
- "name": "tenantId",
1004
- "type": "string",
858
+ "name": "options",
859
+ "type": "Omit<AccountOptions, 'parentId' | 'type'>",
1005
860
  "optional": false
1006
861
  }
1007
862
  ],
1008
- "returnType": "Promise<Account[]>",
863
+ "returnType": "Promise<Account>",
1009
864
  "isStatic": false,
1010
865
  "isPublic": true
866
+ }
867
+ },
868
+ "decoratorConfig": {
869
+ "api": {
870
+ "include": [
871
+ "list",
872
+ "get",
873
+ "create",
874
+ "update",
875
+ "delete"
876
+ ]
1011
877
  },
1012
- "findGlobal": {
1013
- "name": "findGlobal",
1014
- "async": true,
1015
- "parameters": [],
1016
- "returnType": "Promise<Account[]>",
1017
- "isStatic": false,
1018
- "isPublic": true
878
+ "mcp": {
879
+ "include": [
880
+ "list",
881
+ "get",
882
+ "create"
883
+ ]
1019
884
  },
1020
- "findWithGlobals": {
1021
- "name": "findWithGlobals",
1022
- "async": true,
1023
- "parameters": [
1024
- {
1025
- "name": "tenantId",
1026
- "type": "string",
1027
- "optional": false
1028
- }
1029
- ],
1030
- "returnType": "Promise<Account[]>",
1031
- "isStatic": false,
1032
- "isPublic": true
885
+ "cli": true,
886
+ "tenantScoped": {
887
+ "mode": "optional"
1033
888
  }
1034
889
  },
1035
- "decoratorConfig": {},
1036
- "extends": "SmrtCollection",
1037
- "extendsTypeArg": "Account",
1038
- "exportName": "AccountCollection",
1039
- "collectionExportName": "AccountCollectionCollection",
890
+ "extends": "SmrtHierarchical",
891
+ "exportName": "Account",
892
+ "collectionExportName": "AccountCollection",
1040
893
  "schema": {
1041
- "tableName": "account_collections",
1042
- "ddl": "CREATE TABLE IF NOT EXISTS \"account_collections\" (\n \"id\" UUID PRIMARY KEY NOT NULL,\n \"slug\" TEXT NOT NULL,\n \"context\" TEXT NOT NULL DEFAULT '',\n \"created_at\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\n \"updated_at\" TIMESTAMP NOT NULL DEFAULT current_timestamp\n);",
894
+ "tableName": "accounts",
895
+ "ddl": "CREATE TABLE IF NOT EXISTS \"accounts\" (\n \"id\" UUID PRIMARY KEY NOT NULL,\n \"slug\" TEXT NOT NULL,\n \"context\" TEXT NOT NULL DEFAULT '',\n \"created_at\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\n \"updated_at\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\n \"parent_id\" UUID,\n \"tenant_id\" UUID,\n \"number\" TEXT DEFAULT '',\n \"name\" TEXT DEFAULT '',\n \"description\" TEXT DEFAULT '',\n \"type\" TEXT DEFAULT 'asset',\n \"active\" BOOLEAN DEFAULT TRUE,\n \"metadata\" JSON DEFAULT '{}'\n);",
1043
896
  "columns": {
1044
897
  "id": {
1045
898
  "type": "UUID",
@@ -1065,17 +918,65 @@
1065
918
  "type": "TIMESTAMP",
1066
919
  "notNull": true,
1067
920
  "default": "current_timestamp"
921
+ },
922
+ "parent_id": {
923
+ "type": "UUID",
924
+ "referenceKind": "foreignKey",
925
+ "notNull": false,
926
+ "unique": false
927
+ },
928
+ "tenant_id": {
929
+ "type": "UUID",
930
+ "referenceKind": "tenantId",
931
+ "notNull": false,
932
+ "unique": false
933
+ },
934
+ "number": {
935
+ "type": "TEXT",
936
+ "notNull": false,
937
+ "unique": false,
938
+ "default": ""
939
+ },
940
+ "name": {
941
+ "type": "TEXT",
942
+ "notNull": false,
943
+ "unique": false,
944
+ "default": ""
945
+ },
946
+ "description": {
947
+ "type": "TEXT",
948
+ "notNull": false,
949
+ "unique": false,
950
+ "default": ""
951
+ },
952
+ "type": {
953
+ "type": "TEXT",
954
+ "notNull": false,
955
+ "unique": false,
956
+ "default": "asset"
957
+ },
958
+ "active": {
959
+ "type": "BOOLEAN",
960
+ "notNull": false,
961
+ "unique": false,
962
+ "default": true
963
+ },
964
+ "metadata": {
965
+ "type": "JSON",
966
+ "notNull": false,
967
+ "unique": false,
968
+ "default": {}
1068
969
  }
1069
970
  },
1070
971
  "indexes": [
1071
972
  {
1072
- "name": "account_collections_id_idx",
973
+ "name": "accounts_id_idx",
1073
974
  "columns": [
1074
975
  "id"
1075
976
  ]
1076
977
  },
1077
978
  {
1078
- "name": "account_collections_slug_context_idx",
979
+ "name": "accounts_slug_context_idx",
1079
980
  "columns": [
1080
981
  "slug",
1081
982
  "context"
@@ -1083,171 +984,217 @@
1083
984
  "unique": true
1084
985
  }
1085
986
  ],
1086
- "version": "3802b462"
987
+ "version": "d63f1df8"
1087
988
  }
1088
989
  },
1089
- "@happyvertical/smrt-ledgers:JournalEntryCollection": {
1090
- "name": "journalentrycollection",
1091
- "className": "JournalEntryCollection",
1092
- "qualifiedName": "@happyvertical/smrt-ledgers:JournalEntryCollection",
1093
- "collection": "journalentries",
1094
- "filePath": "/home/runner/_work/smrt/smrt/packages/ledgers/src/collections/JournalEntries.ts",
990
+ "@happyvertical/smrt-ledgers:Journal": {
991
+ "name": "journal",
992
+ "className": "Journal",
993
+ "qualifiedName": "@happyvertical/smrt-ledgers:Journal",
994
+ "collection": "journals",
995
+ "filePath": "/home/runner/_work/smrt/smrt/packages/ledgers/src/models/Journal.ts",
1095
996
  "packageName": "@happyvertical/smrt-ledgers",
1096
- "fields": {},
1097
- "methods": {
1098
- "findByJournal": {
1099
- "name": "findByJournal",
1100
- "async": true,
1101
- "parameters": [
1102
- {
1103
- "name": "journalId",
1104
- "type": "string",
1105
- "optional": false
997
+ "fields": {
998
+ "tenantId": {
999
+ "type": "text",
1000
+ "required": false,
1001
+ "_meta": {
1002
+ "sqlType": "UUID",
1003
+ "nullable": true,
1004
+ "__tenancy": {
1005
+ "isTenantIdField": true,
1006
+ "autoFilter": true,
1007
+ "required": false,
1008
+ "autoPopulate": true,
1009
+ "nullable": true,
1010
+ "mode": "optional",
1011
+ "field": "tenantId",
1012
+ "allowSuperAdminBypass": false
1106
1013
  }
1107
- ],
1108
- "returnType": "Promise<JournalEntry[]>",
1014
+ }
1015
+ },
1016
+ "number": {
1017
+ "type": "text",
1018
+ "required": false,
1019
+ "default": ""
1020
+ },
1021
+ "date": {
1022
+ "type": "datetime",
1023
+ "required": false
1024
+ },
1025
+ "description": {
1026
+ "type": "text",
1027
+ "required": false,
1028
+ "default": ""
1029
+ },
1030
+ "sourceModule": {
1031
+ "type": "text",
1032
+ "required": false,
1033
+ "default": ""
1034
+ },
1035
+ "sourceRef": {
1036
+ "type": "text",
1037
+ "required": false
1038
+ },
1039
+ "status": {
1040
+ "type": "text",
1041
+ "required": false,
1042
+ "default": "draft"
1043
+ },
1044
+ "postedAt": {
1045
+ "type": "datetime",
1046
+ "required": false
1047
+ },
1048
+ "voidedAt": {
1049
+ "type": "datetime",
1050
+ "required": false
1051
+ },
1052
+ "voidReason": {
1053
+ "type": "text",
1054
+ "required": false
1055
+ },
1056
+ "metadata": {
1057
+ "type": "json",
1058
+ "required": false,
1059
+ "default": {}
1060
+ }
1061
+ },
1062
+ "methods": {
1063
+ "isDraft": {
1064
+ "name": "isDraft",
1065
+ "async": false,
1066
+ "parameters": [],
1067
+ "returnType": "boolean",
1109
1068
  "isStatic": false,
1110
1069
  "isPublic": true
1111
1070
  },
1112
- "findByAccount": {
1113
- "name": "findByAccount",
1114
- "async": true,
1115
- "parameters": [
1116
- {
1117
- "name": "accountId",
1118
- "type": "string",
1119
- "optional": false
1120
- }
1121
- ],
1122
- "returnType": "Promise<JournalEntry[]>",
1071
+ "isPosted": {
1072
+ "name": "isPosted",
1073
+ "async": false,
1074
+ "parameters": [],
1075
+ "returnType": "boolean",
1123
1076
  "isStatic": false,
1124
1077
  "isPublic": true
1125
1078
  },
1126
- "getAccountBalance": {
1127
- "name": "getAccountBalance",
1128
- "async": true,
1129
- "parameters": [
1130
- {
1131
- "name": "accountId",
1132
- "type": "string",
1133
- "optional": false
1134
- },
1135
- {
1136
- "name": "asOfDate",
1137
- "type": "Date",
1138
- "optional": true
1139
- }
1140
- ],
1141
- "returnType": "Promise<number>",
1079
+ "isVoided": {
1080
+ "name": "isVoided",
1081
+ "async": false,
1082
+ "parameters": [],
1083
+ "returnType": "boolean",
1142
1084
  "isStatic": false,
1143
1085
  "isPublic": true
1144
1086
  },
1145
- "getTrialBalance": {
1146
- "name": "getTrialBalance",
1147
- "async": true,
1148
- "parameters": [
1149
- {
1150
- "name": "asOfDate",
1151
- "type": "Date",
1152
- "optional": true
1153
- }
1154
- ],
1155
- "returnType": "Promise<TrialBalanceRow[]>",
1087
+ "isEditable": {
1088
+ "name": "isEditable",
1089
+ "async": false,
1090
+ "parameters": [],
1091
+ "returnType": "boolean",
1156
1092
  "isStatic": false,
1157
1093
  "isPublic": true
1158
1094
  },
1159
- "getTotalsForDateRange": {
1160
- "name": "getTotalsForDateRange",
1095
+ "getEntries": {
1096
+ "name": "getEntries",
1161
1097
  "async": true,
1162
- "parameters": [
1163
- {
1164
- "name": "start",
1165
- "type": "Date",
1166
- "optional": false
1167
- },
1168
- {
1169
- "name": "end",
1170
- "type": "Date",
1171
- "optional": false
1172
- }
1173
- ],
1174
- "returnType": "Promise<object>",
1098
+ "parameters": [],
1099
+ "returnType": "Promise",
1100
+ "isStatic": false,
1101
+ "isPublic": true
1102
+ },
1103
+ "getTotalDebits": {
1104
+ "name": "getTotalDebits",
1105
+ "async": true,
1106
+ "parameters": [],
1107
+ "returnType": "Promise<number>",
1175
1108
  "isStatic": false,
1176
1109
  "isPublic": true
1177
1110
  },
1178
- "findByAccounts": {
1179
- "name": "findByAccounts",
1111
+ "getTotalCredits": {
1112
+ "name": "getTotalCredits",
1180
1113
  "async": true,
1181
- "parameters": [
1182
- {
1183
- "name": "accountIds",
1184
- "type": "string[]",
1185
- "optional": false
1186
- }
1187
- ],
1188
- "returnType": "Promise<JournalEntry[]>",
1114
+ "parameters": [],
1115
+ "returnType": "Promise<number>",
1189
1116
  "isStatic": false,
1190
1117
  "isPublic": true
1191
1118
  },
1192
- "getAccountLedger": {
1193
- "name": "getAccountLedger",
1119
+ "isBalanced": {
1120
+ "name": "isBalanced",
1194
1121
  "async": true,
1195
- "parameters": [
1196
- {
1197
- "name": "accountId",
1198
- "type": "string",
1199
- "optional": false
1200
- }
1201
- ],
1202
- "returnType": "Promise<Array<object>>",
1122
+ "parameters": [],
1123
+ "returnType": "Promise<boolean>",
1203
1124
  "isStatic": false,
1204
1125
  "isPublic": true
1205
1126
  },
1206
- "findByTenant": {
1207
- "name": "findByTenant",
1127
+ "addEntry": {
1128
+ "name": "addEntry",
1208
1129
  "async": true,
1209
1130
  "parameters": [
1210
1131
  {
1211
- "name": "tenantId",
1212
- "type": "string",
1132
+ "name": "data",
1133
+ "type": "JournalEntryData",
1213
1134
  "optional": false
1214
1135
  }
1215
1136
  ],
1216
- "returnType": "Promise<JournalEntry[]>",
1137
+ "returnType": "Promise<void>",
1217
1138
  "isStatic": false,
1218
1139
  "isPublic": true
1219
1140
  },
1220
- "findGlobal": {
1221
- "name": "findGlobal",
1141
+ "post": {
1142
+ "name": "post",
1222
1143
  "async": true,
1223
1144
  "parameters": [],
1224
- "returnType": "Promise<JournalEntry[]>",
1145
+ "returnType": "Promise<void>",
1225
1146
  "isStatic": false,
1226
1147
  "isPublic": true
1227
1148
  },
1228
- "findWithGlobals": {
1229
- "name": "findWithGlobals",
1149
+ "void": {
1150
+ "name": "void",
1230
1151
  "async": true,
1231
1152
  "parameters": [
1232
1153
  {
1233
- "name": "tenantId",
1154
+ "name": "reason",
1234
1155
  "type": "string",
1235
1156
  "optional": false
1236
1157
  }
1237
1158
  ],
1238
- "returnType": "Promise<JournalEntry[]>",
1159
+ "returnType": "Promise<void>",
1160
+ "isStatic": false,
1161
+ "isPublic": true
1162
+ },
1163
+ "summarize": {
1164
+ "name": "summarize",
1165
+ "async": true,
1166
+ "parameters": [],
1167
+ "returnType": "Promise<string>",
1239
1168
  "isStatic": false,
1240
1169
  "isPublic": true
1241
1170
  }
1242
1171
  },
1243
- "decoratorConfig": {},
1244
- "extends": "SmrtCollection",
1245
- "extendsTypeArg": "JournalEntry",
1246
- "exportName": "JournalEntryCollection",
1247
- "collectionExportName": "JournalEntryCollectionCollection",
1172
+ "decoratorConfig": {
1173
+ "api": {
1174
+ "include": [
1175
+ "list",
1176
+ "get",
1177
+ "create"
1178
+ ]
1179
+ },
1180
+ "mcp": {
1181
+ "include": [
1182
+ "list",
1183
+ "get",
1184
+ "create"
1185
+ ]
1186
+ },
1187
+ "cli": true,
1188
+ "tenantScoped": {
1189
+ "mode": "optional"
1190
+ }
1191
+ },
1192
+ "extends": "SmrtObject",
1193
+ "exportName": "Journal",
1194
+ "collectionExportName": "JournalCollection",
1248
1195
  "schema": {
1249
- "tableName": "journal_entry_collections",
1250
- "ddl": "CREATE TABLE IF NOT EXISTS \"journal_entry_collections\" (\n \"id\" UUID PRIMARY KEY NOT NULL,\n \"slug\" TEXT NOT NULL,\n \"context\" TEXT NOT NULL DEFAULT '',\n \"created_at\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\n \"updated_at\" TIMESTAMP NOT NULL DEFAULT current_timestamp\n);",
1196
+ "tableName": "journals",
1197
+ "ddl": "CREATE TABLE IF NOT EXISTS \"journals\" (\n \"id\" UUID PRIMARY KEY NOT NULL,\n \"slug\" TEXT NOT NULL,\n \"context\" TEXT NOT NULL DEFAULT '',\n \"created_at\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\n \"updated_at\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\n \"tenant_id\" UUID,\n \"number\" TEXT DEFAULT '',\n \"date\" TIMESTAMP,\n \"description\" TEXT DEFAULT '',\n \"source_module\" TEXT DEFAULT '',\n \"source_ref\" TEXT,\n \"status\" TEXT DEFAULT 'draft',\n \"posted_at\" TIMESTAMP,\n \"voided_at\" TIMESTAMP,\n \"void_reason\" TEXT,\n \"metadata\" JSON DEFAULT '{}'\n);",
1251
1198
  "columns": {
1252
1199
  "id": {
1253
1200
  "type": "UUID",
@@ -1273,17 +1220,78 @@
1273
1220
  "type": "TIMESTAMP",
1274
1221
  "notNull": true,
1275
1222
  "default": "current_timestamp"
1223
+ },
1224
+ "tenant_id": {
1225
+ "type": "UUID",
1226
+ "referenceKind": "tenantId",
1227
+ "notNull": false,
1228
+ "unique": false
1229
+ },
1230
+ "number": {
1231
+ "type": "TEXT",
1232
+ "notNull": false,
1233
+ "unique": false,
1234
+ "default": ""
1235
+ },
1236
+ "date": {
1237
+ "type": "TIMESTAMP",
1238
+ "notNull": false,
1239
+ "unique": false
1240
+ },
1241
+ "description": {
1242
+ "type": "TEXT",
1243
+ "notNull": false,
1244
+ "unique": false,
1245
+ "default": ""
1246
+ },
1247
+ "source_module": {
1248
+ "type": "TEXT",
1249
+ "notNull": false,
1250
+ "unique": false,
1251
+ "default": ""
1252
+ },
1253
+ "source_ref": {
1254
+ "type": "TEXT",
1255
+ "notNull": false,
1256
+ "unique": false
1257
+ },
1258
+ "status": {
1259
+ "type": "TEXT",
1260
+ "notNull": false,
1261
+ "unique": false,
1262
+ "default": "draft"
1263
+ },
1264
+ "posted_at": {
1265
+ "type": "TIMESTAMP",
1266
+ "notNull": false,
1267
+ "unique": false
1268
+ },
1269
+ "voided_at": {
1270
+ "type": "TIMESTAMP",
1271
+ "notNull": false,
1272
+ "unique": false
1273
+ },
1274
+ "void_reason": {
1275
+ "type": "TEXT",
1276
+ "notNull": false,
1277
+ "unique": false
1278
+ },
1279
+ "metadata": {
1280
+ "type": "JSON",
1281
+ "notNull": false,
1282
+ "unique": false,
1283
+ "default": {}
1276
1284
  }
1277
1285
  },
1278
1286
  "indexes": [
1279
1287
  {
1280
- "name": "journal_entry_collections_id_idx",
1288
+ "name": "journals_id_idx",
1281
1289
  "columns": [
1282
1290
  "id"
1283
1291
  ]
1284
1292
  },
1285
1293
  {
1286
- "name": "journal_entry_collections_slug_context_idx",
1294
+ "name": "journals_slug_context_idx",
1287
1295
  "columns": [
1288
1296
  "slug",
1289
1297
  "context"
@@ -1291,220 +1299,158 @@
1291
1299
  "unique": true
1292
1300
  }
1293
1301
  ],
1294
- "version": "2cb6f73a"
1302
+ "version": "4b51d204"
1295
1303
  }
1296
1304
  },
1297
- "@happyvertical/smrt-ledgers:JournalCollection": {
1298
- "name": "journalcollection",
1299
- "className": "JournalCollection",
1300
- "qualifiedName": "@happyvertical/smrt-ledgers:JournalCollection",
1301
- "collection": "journals",
1302
- "filePath": "/home/runner/_work/smrt/smrt/packages/ledgers/src/collections/Journals.ts",
1305
+ "@happyvertical/smrt-ledgers:JournalEntry": {
1306
+ "name": "journalentry",
1307
+ "className": "JournalEntry",
1308
+ "qualifiedName": "@happyvertical/smrt-ledgers:JournalEntry",
1309
+ "collection": "journalentries",
1310
+ "filePath": "/home/runner/_work/smrt/smrt/packages/ledgers/src/models/JournalEntry.ts",
1303
1311
  "packageName": "@happyvertical/smrt-ledgers",
1304
- "fields": {},
1305
- "methods": {
1306
- "findByNumber": {
1307
- "name": "findByNumber",
1308
- "async": true,
1309
- "parameters": [
1310
- {
1311
- "name": "number",
1312
- "type": "string",
1313
- "optional": false
1312
+ "fields": {
1313
+ "tenantId": {
1314
+ "type": "text",
1315
+ "required": false,
1316
+ "_meta": {
1317
+ "sqlType": "UUID",
1318
+ "nullable": true,
1319
+ "__tenancy": {
1320
+ "isTenantIdField": true,
1321
+ "autoFilter": true,
1322
+ "required": false,
1323
+ "autoPopulate": true,
1324
+ "nullable": true,
1325
+ "mode": "optional",
1326
+ "field": "tenantId",
1327
+ "allowSuperAdminBypass": false
1314
1328
  }
1315
- ],
1316
- "returnType": "Promise<Journal | null>",
1317
- "isStatic": false,
1318
- "isPublic": true
1329
+ }
1319
1330
  },
1320
- "findByDateRange": {
1321
- "name": "findByDateRange",
1322
- "async": true,
1323
- "parameters": [
1324
- {
1325
- "name": "start",
1326
- "type": "Date",
1327
- "optional": false
1328
- },
1329
- {
1330
- "name": "end",
1331
- "type": "Date",
1332
- "optional": false
1333
- }
1334
- ],
1335
- "returnType": "Promise<Journal[]>",
1336
- "isStatic": false,
1337
- "isPublic": true
1331
+ "journalId": {
1332
+ "type": "foreignKey",
1333
+ "required": false,
1334
+ "related": "Journal"
1338
1335
  },
1339
- "findBySource": {
1340
- "name": "findBySource",
1341
- "async": true,
1342
- "parameters": [
1343
- {
1344
- "name": "sourceModule",
1345
- "type": "string",
1346
- "optional": false
1347
- }
1348
- ],
1349
- "returnType": "Promise<Journal[]>",
1350
- "isStatic": false,
1351
- "isPublic": true
1336
+ "accountId": {
1337
+ "type": "foreignKey",
1338
+ "required": false,
1339
+ "related": "Account"
1340
+ },
1341
+ "debit": {
1342
+ "type": "decimal",
1343
+ "required": false,
1344
+ "default": 0
1345
+ },
1346
+ "credit": {
1347
+ "type": "decimal",
1348
+ "required": false,
1349
+ "default": 0
1352
1350
  },
1353
- "findByStatus": {
1354
- "name": "findByStatus",
1355
- "async": true,
1356
- "parameters": [
1357
- {
1358
- "name": "status",
1359
- "type": "JournalStatus",
1360
- "optional": false
1361
- }
1362
- ],
1363
- "returnType": "Promise<Journal[]>",
1364
- "isStatic": false,
1365
- "isPublic": true
1351
+ "currency": {
1352
+ "type": "text",
1353
+ "required": false,
1354
+ "default": "USD"
1366
1355
  },
1367
- "findDrafts": {
1368
- "name": "findDrafts",
1369
- "async": true,
1370
- "parameters": [],
1371
- "returnType": "Promise<Journal[]>",
1372
- "isStatic": false,
1373
- "isPublic": true
1356
+ "exchangeRate": {
1357
+ "type": "decimal",
1358
+ "required": false,
1359
+ "default": 1
1374
1360
  },
1375
- "findPosted": {
1376
- "name": "findPosted",
1377
- "async": true,
1378
- "parameters": [],
1379
- "returnType": "Promise<Journal[]>",
1380
- "isStatic": false,
1381
- "isPublic": true
1361
+ "memo": {
1362
+ "type": "text",
1363
+ "required": false,
1364
+ "default": ""
1382
1365
  },
1383
- "createWithEntries": {
1384
- "name": "createWithEntries",
1385
- "async": true,
1386
- "parameters": [
1387
- {
1388
- "name": "data",
1389
- "type": "CreateJournalData",
1390
- "optional": false
1391
- }
1392
- ],
1393
- "returnType": "Promise<Journal>",
1366
+ "metadata": {
1367
+ "type": "json",
1368
+ "required": false,
1369
+ "default": {}
1370
+ }
1371
+ },
1372
+ "methods": {
1373
+ "isDebit": {
1374
+ "name": "isDebit",
1375
+ "async": false,
1376
+ "parameters": [],
1377
+ "returnType": "boolean",
1394
1378
  "isStatic": false,
1395
1379
  "isPublic": true
1396
1380
  },
1397
- "post": {
1398
- "name": "post",
1399
- "async": true,
1400
- "parameters": [
1401
- {
1402
- "name": "journalId",
1403
- "type": "string",
1404
- "optional": false
1405
- }
1406
- ],
1407
- "returnType": "Promise<Journal>",
1381
+ "isCredit": {
1382
+ "name": "isCredit",
1383
+ "async": false,
1384
+ "parameters": [],
1385
+ "returnType": "boolean",
1408
1386
  "isStatic": false,
1409
1387
  "isPublic": true
1410
1388
  },
1411
- "void": {
1412
- "name": "void",
1413
- "async": true,
1414
- "parameters": [
1415
- {
1416
- "name": "journalId",
1417
- "type": "string",
1418
- "optional": false
1419
- },
1420
- {
1421
- "name": "reason",
1422
- "type": "string",
1423
- "optional": false
1424
- }
1425
- ],
1426
- "returnType": "Promise<Journal>",
1389
+ "getAmount": {
1390
+ "name": "getAmount",
1391
+ "async": false,
1392
+ "parameters": [],
1393
+ "returnType": "number",
1427
1394
  "isStatic": false,
1428
1395
  "isPublic": true
1429
1396
  },
1430
- "findBySourceRef": {
1431
- "name": "findBySourceRef",
1432
- "async": true,
1433
- "parameters": [
1434
- {
1435
- "name": "sourceRef",
1436
- "type": "string",
1437
- "optional": false
1438
- }
1439
- ],
1440
- "returnType": "Promise<Journal[]>",
1397
+ "getBaseAmount": {
1398
+ "name": "getBaseAmount",
1399
+ "async": false,
1400
+ "parameters": [],
1401
+ "returnType": "number",
1441
1402
  "isStatic": false,
1442
1403
  "isPublic": true
1443
1404
  },
1444
- "findByMonth": {
1445
- "name": "findByMonth",
1405
+ "getJournal": {
1406
+ "name": "getJournal",
1446
1407
  "async": true,
1447
- "parameters": [
1448
- {
1449
- "name": "year",
1450
- "type": "number",
1451
- "optional": false
1452
- },
1453
- {
1454
- "name": "month",
1455
- "type": "number",
1456
- "optional": false
1457
- }
1458
- ],
1459
- "returnType": "Promise<Journal[]>",
1408
+ "parameters": [],
1409
+ "returnType": "Promise<null>",
1460
1410
  "isStatic": false,
1461
1411
  "isPublic": true
1462
1412
  },
1463
- "findByTenant": {
1464
- "name": "findByTenant",
1413
+ "getAccount": {
1414
+ "name": "getAccount",
1465
1415
  "async": true,
1466
- "parameters": [
1467
- {
1468
- "name": "tenantId",
1469
- "type": "string",
1470
- "optional": false
1471
- }
1472
- ],
1473
- "returnType": "Promise<Journal[]>",
1416
+ "parameters": [],
1417
+ "returnType": "Promise<null>",
1474
1418
  "isStatic": false,
1475
1419
  "isPublic": true
1476
1420
  },
1477
- "findGlobal": {
1478
- "name": "findGlobal",
1421
+ "getDescription": {
1422
+ "name": "getDescription",
1479
1423
  "async": true,
1480
1424
  "parameters": [],
1481
- "returnType": "Promise<Journal[]>",
1425
+ "returnType": "Promise<string>",
1482
1426
  "isStatic": false,
1483
1427
  "isPublic": true
1428
+ }
1429
+ },
1430
+ "decoratorConfig": {
1431
+ "api": {
1432
+ "include": [
1433
+ "list",
1434
+ "get"
1435
+ ]
1484
1436
  },
1485
- "findWithGlobals": {
1486
- "name": "findWithGlobals",
1487
- "async": true,
1488
- "parameters": [
1489
- {
1490
- "name": "tenantId",
1491
- "type": "string",
1492
- "optional": false
1493
- }
1494
- ],
1495
- "returnType": "Promise<Journal[]>",
1496
- "isStatic": false,
1497
- "isPublic": true
1437
+ "mcp": {
1438
+ "include": [
1439
+ "list",
1440
+ "get"
1441
+ ]
1442
+ },
1443
+ "cli": true,
1444
+ "tenantScoped": {
1445
+ "mode": "optional"
1498
1446
  }
1499
1447
  },
1500
- "decoratorConfig": {},
1501
- "extends": "SmrtCollection",
1502
- "extendsTypeArg": "Journal",
1503
- "exportName": "JournalCollection",
1504
- "collectionExportName": "JournalCollectionCollection",
1448
+ "extends": "SmrtObject",
1449
+ "exportName": "JournalEntry",
1450
+ "collectionExportName": "JournalEntryCollection",
1505
1451
  "schema": {
1506
- "tableName": "journal_collections",
1507
- "ddl": "CREATE TABLE IF NOT EXISTS \"journal_collections\" (\n \"id\" UUID PRIMARY KEY NOT NULL,\n \"slug\" TEXT NOT NULL,\n \"context\" TEXT NOT NULL DEFAULT '',\n \"created_at\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\n \"updated_at\" TIMESTAMP NOT NULL DEFAULT current_timestamp\n);",
1452
+ "tableName": "journal_entries",
1453
+ "ddl": "CREATE TABLE IF NOT EXISTS \"journal_entries\" (\n \"id\" UUID PRIMARY KEY NOT NULL,\n \"slug\" TEXT NOT NULL,\n \"context\" TEXT NOT NULL DEFAULT '',\n \"created_at\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\n \"updated_at\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\n \"tenant_id\" UUID,\n \"journal_id\" UUID,\n \"account_id\" UUID,\n \"debit\" REAL DEFAULT 0,\n \"credit\" REAL DEFAULT 0,\n \"currency\" TEXT DEFAULT 'USD',\n \"exchange_rate\" REAL DEFAULT 1,\n \"memo\" TEXT DEFAULT '',\n \"metadata\" JSON DEFAULT '{}'\n);",
1508
1454
  "columns": {
1509
1455
  "id": {
1510
1456
  "type": "UUID",
@@ -1530,17 +1476,71 @@
1530
1476
  "type": "TIMESTAMP",
1531
1477
  "notNull": true,
1532
1478
  "default": "current_timestamp"
1479
+ },
1480
+ "tenant_id": {
1481
+ "type": "UUID",
1482
+ "referenceKind": "tenantId",
1483
+ "notNull": false,
1484
+ "unique": false
1485
+ },
1486
+ "journal_id": {
1487
+ "type": "UUID",
1488
+ "referenceKind": "foreignKey",
1489
+ "notNull": false,
1490
+ "unique": false
1491
+ },
1492
+ "account_id": {
1493
+ "type": "UUID",
1494
+ "referenceKind": "foreignKey",
1495
+ "notNull": false,
1496
+ "unique": false
1497
+ },
1498
+ "debit": {
1499
+ "type": "REAL",
1500
+ "notNull": false,
1501
+ "unique": false,
1502
+ "default": 0
1503
+ },
1504
+ "credit": {
1505
+ "type": "REAL",
1506
+ "notNull": false,
1507
+ "unique": false,
1508
+ "default": 0
1509
+ },
1510
+ "currency": {
1511
+ "type": "TEXT",
1512
+ "notNull": false,
1513
+ "unique": false,
1514
+ "default": "USD"
1515
+ },
1516
+ "exchange_rate": {
1517
+ "type": "REAL",
1518
+ "notNull": false,
1519
+ "unique": false,
1520
+ "default": 1
1521
+ },
1522
+ "memo": {
1523
+ "type": "TEXT",
1524
+ "notNull": false,
1525
+ "unique": false,
1526
+ "default": ""
1527
+ },
1528
+ "metadata": {
1529
+ "type": "JSON",
1530
+ "notNull": false,
1531
+ "unique": false,
1532
+ "default": {}
1533
1533
  }
1534
1534
  },
1535
1535
  "indexes": [
1536
1536
  {
1537
- "name": "journal_collections_id_idx",
1537
+ "name": "journal_entries_id_idx",
1538
1538
  "columns": [
1539
1539
  "id"
1540
1540
  ]
1541
1541
  },
1542
1542
  {
1543
- "name": "journal_collections_slug_context_idx",
1543
+ "name": "journal_entries_slug_context_idx",
1544
1544
  "columns": [
1545
1545
  "slug",
1546
1546
  "context"
@@ -1548,7 +1548,7 @@
1548
1548
  "unique": true
1549
1549
  }
1550
1550
  ],
1551
- "version": "665cc41d"
1551
+ "version": "b5a42f7b"
1552
1552
  }
1553
1553
  }
1554
1554
  },