@luca-financial/luca-schema 3.1.0 → 3.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +24 -0
- package/README.md +37 -1
- package/dist/esm/index.d.ts +204 -12
- package/dist/esm/index.js +6 -0
- package/dist/esm/lucaValidator.js +8 -0
- package/dist/esm/schemas/enums.json +2 -0
- package/dist/esm/schemas/index.js +6 -0
- package/dist/esm/schemas/lucaSchema.json +16 -0
- package/dist/esm/schemas/recurringTransactionLink.json +31 -0
- package/dist/esm/schemas/transactionLink.json +28 -0
- package/dist/index.d.ts +204 -12
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -5,6 +5,30 @@ All notable changes to this project will be documented in this file.
|
|
|
5
5
|
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
|
6
6
|
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
7
7
|
|
|
8
|
+
## [3.3.0] - 2026-04-05
|
|
9
|
+
|
|
10
|
+
### Added
|
|
11
|
+
|
|
12
|
+
- Add support for linking related recurring transactions with a new `recurringTransactionLink` schema.
|
|
13
|
+
- Add optional `recurringTransactionLinks` support to the aggregate Luca Schema, schema exports, enums, validator metadata, generated types, and bundled example data.
|
|
14
|
+
- Add validation coverage for recurring transaction links in both entity-level and aggregate/example tests.
|
|
15
|
+
|
|
16
|
+
### Changed
|
|
17
|
+
|
|
18
|
+
- Update README and example documentation to describe recurring transaction links and their scheduled-transfer use cases.
|
|
19
|
+
|
|
20
|
+
## [3.2.0] - 2026-04-04
|
|
21
|
+
|
|
22
|
+
### Added
|
|
23
|
+
|
|
24
|
+
- Add a new `transactionLink` schema to represent links between related transactions across accounts.
|
|
25
|
+
- Add optional `transactionLinks` support to the aggregate Luca Schema, schema exports, enums, and validator metadata.
|
|
26
|
+
- Add bundled transaction-link example data and validation tests covering valid transaction-link usage.
|
|
27
|
+
|
|
28
|
+
### Changed
|
|
29
|
+
|
|
30
|
+
- Update README and example documentation to describe transaction links and how they fit into the aggregate schema.
|
|
31
|
+
|
|
8
32
|
## [3.1.0] - 2026-04-04
|
|
9
33
|
|
|
10
34
|
### Added
|
package/README.md
CHANGED
|
@@ -210,6 +210,40 @@ const transactionSplit = {
|
|
|
210
210
|
};
|
|
211
211
|
```
|
|
212
212
|
|
|
213
|
+
### RecurringTransactionLink
|
|
214
|
+
|
|
215
|
+
Validates links between related recurring transactions, such as scheduled transfer legs recorded in separate accounts.
|
|
216
|
+
|
|
217
|
+
```typescript
|
|
218
|
+
const recurringTransactionLink = {
|
|
219
|
+
id: string;
|
|
220
|
+
sourceRecurringTransactionId: string;
|
|
221
|
+
destinationRecurringTransactionId: string;
|
|
222
|
+
createdAt: string;
|
|
223
|
+
updatedAt: string | null;
|
|
224
|
+
deletedAt?: string | null;
|
|
225
|
+
version?: number;
|
|
226
|
+
};
|
|
227
|
+
```
|
|
228
|
+
|
|
229
|
+
### TransactionLink
|
|
230
|
+
|
|
231
|
+
Validates links between related transactions, such as transfers recorded in separate accounts.
|
|
232
|
+
|
|
233
|
+
```typescript
|
|
234
|
+
const transactionLink = {
|
|
235
|
+
id: string;
|
|
236
|
+
sourceTransactionId: string;
|
|
237
|
+
destinationTransactionId: string;
|
|
238
|
+
createdAt: string;
|
|
239
|
+
updatedAt: string | null;
|
|
240
|
+
deletedAt?: string | null;
|
|
241
|
+
version?: number;
|
|
242
|
+
};
|
|
243
|
+
```
|
|
244
|
+
|
|
245
|
+
Cross-transaction rules like matching dates, matching amounts, or opposite signs are not enforced by this schema and should be handled in application logic.
|
|
246
|
+
|
|
213
247
|
### LucaSchema
|
|
214
248
|
|
|
215
249
|
Validates the full ledger export.
|
|
@@ -222,7 +256,9 @@ const lucaSchema = {
|
|
|
222
256
|
statements: Statement[];
|
|
223
257
|
recurringTransactions: RecurringTransaction[];
|
|
224
258
|
recurringTransactionEvents: RecurringTransactionEvent[];
|
|
259
|
+
recurringTransactionLinks?: RecurringTransactionLink[];
|
|
225
260
|
transactions: Transaction[];
|
|
261
|
+
transactionLinks?: TransactionLink[];
|
|
226
262
|
transactionSplits: TransactionSplit[];
|
|
227
263
|
};
|
|
228
264
|
```
|
|
@@ -251,7 +287,7 @@ import {
|
|
|
251
287
|
- `validate(schemaKey, data)` → `{ valid: boolean, errors: AjvError[] }`
|
|
252
288
|
- `validateCollection(schemaKey, array)` → `{ valid: boolean, errors: [{ index, entity, errors }] }`
|
|
253
289
|
- `getDateFieldPaths(schemaKey)` → `string[]` of `format: date` fields for a schema key
|
|
254
|
-
- `getDateFieldPathsByCollection()` → `{ accounts, categories, statements, recurringTransactions, recurringTransactionEvents, transactions, transactionSplits }`
|
|
290
|
+
- `getDateFieldPathsByCollection()` → `{ accounts, categories, statements, recurringTransactions, recurringTransactionEvents, recurringTransactionLinks, transactions, transactionLinks, transactionSplits }`
|
|
255
291
|
- `getValidFields(schemaKey)` → `Set<string>` of all fields (includes common fields when applicable)
|
|
256
292
|
- `getRequiredFields(schemaKey)` → `Set<string>` of required fields (includes common required fields)
|
|
257
293
|
- `stripInvalidFields(schemaKey, data)` → new object with only schema-defined keys
|
package/dist/esm/index.d.ts
CHANGED
|
@@ -526,7 +526,42 @@ export type RecurringTransactionID = string;
|
|
|
526
526
|
* The date when the occurrence is expected.
|
|
527
527
|
*/
|
|
528
528
|
export type ExpectedDate = string;
|
|
529
|
-
|
|
529
|
+
/**
|
|
530
|
+
* Links two related recurring transactions, such as mirrored transfer schedules recorded in separate accounts.
|
|
531
|
+
*/
|
|
532
|
+
export type RecurringTransactionLink = Common5 & {
|
|
533
|
+
sourceRecurringTransactionId: SourceRecurringTransactionID;
|
|
534
|
+
destinationRecurringTransactionId: DestinationRecurringTransactionID;
|
|
535
|
+
};
|
|
536
|
+
/**
|
|
537
|
+
* UUID for the item
|
|
538
|
+
*/
|
|
539
|
+
export type ID5 = string;
|
|
540
|
+
/**
|
|
541
|
+
* The timestamp of the creation of the item
|
|
542
|
+
*/
|
|
543
|
+
export type DateCreated5 = string;
|
|
544
|
+
/**
|
|
545
|
+
* The timestamp of the last update or null if the item has not been updated yet
|
|
546
|
+
*/
|
|
547
|
+
export type LastUpdated5 = string | null;
|
|
548
|
+
/**
|
|
549
|
+
* The timestamp of when the item was soft-deleted
|
|
550
|
+
*/
|
|
551
|
+
export type DateDeleted5 = string | null;
|
|
552
|
+
/**
|
|
553
|
+
* Version number for optimistic concurrency control
|
|
554
|
+
*/
|
|
555
|
+
export type Version5 = number;
|
|
556
|
+
/**
|
|
557
|
+
* UUID of the source recurring transaction in the link.
|
|
558
|
+
*/
|
|
559
|
+
export type SourceRecurringTransactionID = string;
|
|
560
|
+
/**
|
|
561
|
+
* UUID of the destination recurring transaction in the link.
|
|
562
|
+
*/
|
|
563
|
+
export type DestinationRecurringTransactionID = string;
|
|
564
|
+
export type Transaction = Common6 & {
|
|
530
565
|
accountId: AccountID2;
|
|
531
566
|
date: Date;
|
|
532
567
|
authorizedAt?: AuthorizedAt;
|
|
@@ -556,23 +591,23 @@ export type Transaction = Common5 & {
|
|
|
556
591
|
/**
|
|
557
592
|
* UUID for the item
|
|
558
593
|
*/
|
|
559
|
-
export type
|
|
594
|
+
export type ID6 = string;
|
|
560
595
|
/**
|
|
561
596
|
* The timestamp of the creation of the item
|
|
562
597
|
*/
|
|
563
|
-
export type
|
|
598
|
+
export type DateCreated6 = string;
|
|
564
599
|
/**
|
|
565
600
|
* The timestamp of the last update or null if the item has not been updated yet
|
|
566
601
|
*/
|
|
567
|
-
export type
|
|
602
|
+
export type LastUpdated6 = string | null;
|
|
568
603
|
/**
|
|
569
604
|
* The timestamp of when the item was soft-deleted
|
|
570
605
|
*/
|
|
571
|
-
export type
|
|
606
|
+
export type DateDeleted6 = string | null;
|
|
572
607
|
/**
|
|
573
608
|
* Version number for optimistic concurrency control
|
|
574
609
|
*/
|
|
575
|
-
export type
|
|
610
|
+
export type Version6 = number;
|
|
576
611
|
/**
|
|
577
612
|
* ID of the account this transaction belongs to
|
|
578
613
|
*/
|
|
@@ -617,10 +652,45 @@ export type StatementID = string | null;
|
|
|
617
652
|
* Identifier for this transaction in a financial data aggregation service.
|
|
618
653
|
*/
|
|
619
654
|
export type AggregationServiceID1 = string | null;
|
|
655
|
+
/**
|
|
656
|
+
* Links two related transactions, such as transfer legs recorded in separate accounts.
|
|
657
|
+
*/
|
|
658
|
+
export type TransactionLink = Common7 & {
|
|
659
|
+
sourceTransactionId: SourceTransactionID;
|
|
660
|
+
destinationTransactionId: DestinationTransactionID;
|
|
661
|
+
};
|
|
662
|
+
/**
|
|
663
|
+
* UUID for the item
|
|
664
|
+
*/
|
|
665
|
+
export type ID7 = string;
|
|
666
|
+
/**
|
|
667
|
+
* The timestamp of the creation of the item
|
|
668
|
+
*/
|
|
669
|
+
export type DateCreated7 = string;
|
|
670
|
+
/**
|
|
671
|
+
* The timestamp of the last update or null if the item has not been updated yet
|
|
672
|
+
*/
|
|
673
|
+
export type LastUpdated7 = string | null;
|
|
674
|
+
/**
|
|
675
|
+
* The timestamp of when the item was soft-deleted
|
|
676
|
+
*/
|
|
677
|
+
export type DateDeleted7 = string | null;
|
|
678
|
+
/**
|
|
679
|
+
* Version number for optimistic concurrency control
|
|
680
|
+
*/
|
|
681
|
+
export type Version7 = number;
|
|
682
|
+
/**
|
|
683
|
+
* UUID of the source transaction in the link.
|
|
684
|
+
*/
|
|
685
|
+
export type SourceTransactionID = string;
|
|
686
|
+
/**
|
|
687
|
+
* UUID of the destination transaction in the link.
|
|
688
|
+
*/
|
|
689
|
+
export type DestinationTransactionID = string;
|
|
620
690
|
/**
|
|
621
691
|
* Defines a split within a transaction.
|
|
622
692
|
*/
|
|
623
|
-
export type TransactionSplit =
|
|
693
|
+
export type TransactionSplit = Common8 & {
|
|
624
694
|
transactionId: TransactionID;
|
|
625
695
|
amount: Amount2;
|
|
626
696
|
categoryId: CategoryID2;
|
|
@@ -630,23 +700,23 @@ export type TransactionSplit = Common6 & {
|
|
|
630
700
|
/**
|
|
631
701
|
* UUID for the item
|
|
632
702
|
*/
|
|
633
|
-
export type
|
|
703
|
+
export type ID8 = string;
|
|
634
704
|
/**
|
|
635
705
|
* The timestamp of the creation of the item
|
|
636
706
|
*/
|
|
637
|
-
export type
|
|
707
|
+
export type DateCreated8 = string;
|
|
638
708
|
/**
|
|
639
709
|
* The timestamp of the last update or null if the item has not been updated yet
|
|
640
710
|
*/
|
|
641
|
-
export type
|
|
711
|
+
export type LastUpdated8 = string | null;
|
|
642
712
|
/**
|
|
643
713
|
* The timestamp of when the item was soft-deleted
|
|
644
714
|
*/
|
|
645
|
-
export type
|
|
715
|
+
export type DateDeleted8 = string | null;
|
|
646
716
|
/**
|
|
647
717
|
* Version number for optimistic concurrency control
|
|
648
718
|
*/
|
|
649
|
-
export type
|
|
719
|
+
export type Version8 = number;
|
|
650
720
|
/**
|
|
651
721
|
* The identifier of the parent transaction.
|
|
652
722
|
*/
|
|
@@ -696,10 +766,18 @@ export interface LucaSchema {
|
|
|
696
766
|
* List of recurring transaction events
|
|
697
767
|
*/
|
|
698
768
|
recurringTransactionEvents: RecurringTransactionEvent[];
|
|
769
|
+
/**
|
|
770
|
+
* List of links between related recurring transactions
|
|
771
|
+
*/
|
|
772
|
+
recurringTransactionLinks?: RecurringTransactionLink[];
|
|
699
773
|
/**
|
|
700
774
|
* List of transactions
|
|
701
775
|
*/
|
|
702
776
|
transactions: Transaction[];
|
|
777
|
+
/**
|
|
778
|
+
* List of links between related transactions
|
|
779
|
+
*/
|
|
780
|
+
transactionLinks?: TransactionLink[];
|
|
703
781
|
/**
|
|
704
782
|
* List of transaction splits
|
|
705
783
|
*/
|
|
@@ -775,6 +853,26 @@ export interface Common6 {
|
|
|
775
853
|
deletedAt?: DateDeleted6;
|
|
776
854
|
version?: Version6;
|
|
777
855
|
}
|
|
856
|
+
/**
|
|
857
|
+
* Common properties for all schemas
|
|
858
|
+
*/
|
|
859
|
+
export interface Common7 {
|
|
860
|
+
id: ID7;
|
|
861
|
+
createdAt: DateCreated7;
|
|
862
|
+
updatedAt: LastUpdated7;
|
|
863
|
+
deletedAt?: DateDeleted7;
|
|
864
|
+
version?: Version7;
|
|
865
|
+
}
|
|
866
|
+
/**
|
|
867
|
+
* Common properties for all schemas
|
|
868
|
+
*/
|
|
869
|
+
export interface Common8 {
|
|
870
|
+
id: ID8;
|
|
871
|
+
createdAt: DateCreated8;
|
|
872
|
+
updatedAt: LastUpdated8;
|
|
873
|
+
deletedAt?: DateDeleted8;
|
|
874
|
+
version?: Version8;
|
|
875
|
+
}
|
|
778
876
|
|
|
779
877
|
/**
|
|
780
878
|
* Defines recurring financial transactions within the application.
|
|
@@ -926,6 +1024,53 @@ export interface Common {
|
|
|
926
1024
|
version?: Version;
|
|
927
1025
|
}
|
|
928
1026
|
|
|
1027
|
+
/**
|
|
1028
|
+
* Links two related recurring transactions, such as mirrored transfer schedules recorded in separate accounts.
|
|
1029
|
+
*/
|
|
1030
|
+
export type RecurringTransactionLink = Common & {
|
|
1031
|
+
sourceRecurringTransactionId: SourceRecurringTransactionID;
|
|
1032
|
+
destinationRecurringTransactionId: DestinationRecurringTransactionID;
|
|
1033
|
+
};
|
|
1034
|
+
/**
|
|
1035
|
+
* UUID for the item
|
|
1036
|
+
*/
|
|
1037
|
+
export type ID = string;
|
|
1038
|
+
/**
|
|
1039
|
+
* The timestamp of the creation of the item
|
|
1040
|
+
*/
|
|
1041
|
+
export type DateCreated = string;
|
|
1042
|
+
/**
|
|
1043
|
+
* The timestamp of the last update or null if the item has not been updated yet
|
|
1044
|
+
*/
|
|
1045
|
+
export type LastUpdated = string | null;
|
|
1046
|
+
/**
|
|
1047
|
+
* The timestamp of when the item was soft-deleted
|
|
1048
|
+
*/
|
|
1049
|
+
export type DateDeleted = string | null;
|
|
1050
|
+
/**
|
|
1051
|
+
* Version number for optimistic concurrency control
|
|
1052
|
+
*/
|
|
1053
|
+
export type Version = number;
|
|
1054
|
+
/**
|
|
1055
|
+
* UUID of the source recurring transaction in the link.
|
|
1056
|
+
*/
|
|
1057
|
+
export type SourceRecurringTransactionID = string;
|
|
1058
|
+
/**
|
|
1059
|
+
* UUID of the destination recurring transaction in the link.
|
|
1060
|
+
*/
|
|
1061
|
+
export type DestinationRecurringTransactionID = string;
|
|
1062
|
+
|
|
1063
|
+
/**
|
|
1064
|
+
* Common properties for all schemas
|
|
1065
|
+
*/
|
|
1066
|
+
export interface Common {
|
|
1067
|
+
id: ID;
|
|
1068
|
+
createdAt: DateCreated;
|
|
1069
|
+
updatedAt: LastUpdated;
|
|
1070
|
+
deletedAt?: DateDeleted;
|
|
1071
|
+
version?: Version;
|
|
1072
|
+
}
|
|
1073
|
+
|
|
929
1074
|
/**
|
|
930
1075
|
* Defines the schema for credit card statements.
|
|
931
1076
|
*/
|
|
@@ -1106,6 +1251,53 @@ export interface Common {
|
|
|
1106
1251
|
version?: Version;
|
|
1107
1252
|
}
|
|
1108
1253
|
|
|
1254
|
+
/**
|
|
1255
|
+
* Links two related transactions, such as transfer legs recorded in separate accounts.
|
|
1256
|
+
*/
|
|
1257
|
+
export type TransactionLink = Common & {
|
|
1258
|
+
sourceTransactionId: SourceTransactionID;
|
|
1259
|
+
destinationTransactionId: DestinationTransactionID;
|
|
1260
|
+
};
|
|
1261
|
+
/**
|
|
1262
|
+
* UUID for the item
|
|
1263
|
+
*/
|
|
1264
|
+
export type ID = string;
|
|
1265
|
+
/**
|
|
1266
|
+
* The timestamp of the creation of the item
|
|
1267
|
+
*/
|
|
1268
|
+
export type DateCreated = string;
|
|
1269
|
+
/**
|
|
1270
|
+
* The timestamp of the last update or null if the item has not been updated yet
|
|
1271
|
+
*/
|
|
1272
|
+
export type LastUpdated = string | null;
|
|
1273
|
+
/**
|
|
1274
|
+
* The timestamp of when the item was soft-deleted
|
|
1275
|
+
*/
|
|
1276
|
+
export type DateDeleted = string | null;
|
|
1277
|
+
/**
|
|
1278
|
+
* Version number for optimistic concurrency control
|
|
1279
|
+
*/
|
|
1280
|
+
export type Version = number;
|
|
1281
|
+
/**
|
|
1282
|
+
* UUID of the source transaction in the link.
|
|
1283
|
+
*/
|
|
1284
|
+
export type SourceTransactionID = string;
|
|
1285
|
+
/**
|
|
1286
|
+
* UUID of the destination transaction in the link.
|
|
1287
|
+
*/
|
|
1288
|
+
export type DestinationTransactionID = string;
|
|
1289
|
+
|
|
1290
|
+
/**
|
|
1291
|
+
* Common properties for all schemas
|
|
1292
|
+
*/
|
|
1293
|
+
export interface Common {
|
|
1294
|
+
id: ID;
|
|
1295
|
+
createdAt: DateCreated;
|
|
1296
|
+
updatedAt: LastUpdated;
|
|
1297
|
+
deletedAt?: DateDeleted;
|
|
1298
|
+
version?: Version;
|
|
1299
|
+
}
|
|
1300
|
+
|
|
1109
1301
|
/**
|
|
1110
1302
|
* Defines a split within a transaction.
|
|
1111
1303
|
*/
|
package/dist/esm/index.js
CHANGED
|
@@ -6,8 +6,10 @@ import {
|
|
|
6
6
|
lucaSchema as lucaSchemaJson,
|
|
7
7
|
recurringTransaction,
|
|
8
8
|
recurringTransactionEvent,
|
|
9
|
+
recurringTransactionLink,
|
|
9
10
|
statement,
|
|
10
11
|
transaction,
|
|
12
|
+
transactionLink,
|
|
11
13
|
transactionSplit
|
|
12
14
|
} from './schemas/index.js';
|
|
13
15
|
import { enums, LucaSchemas } from './enums.js';
|
|
@@ -29,7 +31,9 @@ const schemas = {
|
|
|
29
31
|
statement,
|
|
30
32
|
recurringTransaction,
|
|
31
33
|
recurringTransactionEvent,
|
|
34
|
+
recurringTransactionLink,
|
|
32
35
|
transaction,
|
|
36
|
+
transactionLink,
|
|
33
37
|
transactionSplit,
|
|
34
38
|
enums: enumsSchema
|
|
35
39
|
};
|
|
@@ -42,7 +46,9 @@ export const statementSchema = schemas.statement;
|
|
|
42
46
|
export const recurringTransactionSchema = schemas.recurringTransaction;
|
|
43
47
|
export const recurringTransactionEventSchema =
|
|
44
48
|
schemas.recurringTransactionEvent;
|
|
49
|
+
export const recurringTransactionLinkSchema = schemas.recurringTransactionLink;
|
|
45
50
|
export const transactionSchema = schemas.transaction;
|
|
51
|
+
export const transactionLinkSchema = schemas.transactionLink;
|
|
46
52
|
export const transactionSplitSchema = schemas.transactionSplit;
|
|
47
53
|
|
|
48
54
|
export {
|
|
@@ -8,7 +8,9 @@ import lucaSchemaJson from './schemas/lucaSchema.json' with { type: 'json' };
|
|
|
8
8
|
import statementSchemaJson from './schemas/statement.json' with { type: 'json' };
|
|
9
9
|
import recurringTransactionSchemaJson from './schemas/recurringTransaction.json' with { type: 'json' };
|
|
10
10
|
import recurringTransactionEventSchemaJson from './schemas/recurringTransactionEvent.json' with { type: 'json' };
|
|
11
|
+
import recurringTransactionLinkSchemaJson from './schemas/recurringTransactionLink.json' with { type: 'json' };
|
|
11
12
|
import transactionSchemaJson from './schemas/transaction.json' with { type: 'json' };
|
|
13
|
+
import transactionLinkSchemaJson from './schemas/transactionLink.json' with { type: 'json' };
|
|
12
14
|
import transactionSplitSchemaJson from './schemas/transactionSplit.json' with { type: 'json' };
|
|
13
15
|
|
|
14
16
|
const schemas = {
|
|
@@ -18,7 +20,9 @@ const schemas = {
|
|
|
18
20
|
statement: statementSchemaJson,
|
|
19
21
|
recurringTransaction: recurringTransactionSchemaJson,
|
|
20
22
|
recurringTransactionEvent: recurringTransactionEventSchemaJson,
|
|
23
|
+
recurringTransactionLink: recurringTransactionLinkSchemaJson,
|
|
21
24
|
transaction: transactionSchemaJson,
|
|
25
|
+
transactionLink: transactionLinkSchemaJson,
|
|
22
26
|
transactionSplit: transactionSplitSchemaJson
|
|
23
27
|
};
|
|
24
28
|
|
|
@@ -192,7 +196,9 @@ export function getDateFieldPaths(schemaKey) {
|
|
|
192
196
|
* statements: Array<string>,
|
|
193
197
|
* recurringTransactions: Array<string>,
|
|
194
198
|
* recurringTransactionEvents: Array<string>,
|
|
199
|
+
* recurringTransactionLinks: Array<string>,
|
|
195
200
|
* transactions: Array<string>,
|
|
201
|
+
* transactionLinks: Array<string>,
|
|
196
202
|
* transactionSplits: Array<string>
|
|
197
203
|
* }}
|
|
198
204
|
*/
|
|
@@ -203,7 +209,9 @@ export function getDateFieldPathsByCollection() {
|
|
|
203
209
|
statements: getDateFieldPaths('statement'),
|
|
204
210
|
recurringTransactions: getDateFieldPaths('recurringTransaction'),
|
|
205
211
|
recurringTransactionEvents: getDateFieldPaths('recurringTransactionEvent'),
|
|
212
|
+
recurringTransactionLinks: getDateFieldPaths('recurringTransactionLink'),
|
|
206
213
|
transactions: getDateFieldPaths('transaction'),
|
|
214
|
+
transactionLinks: getDateFieldPaths('transactionLink'),
|
|
207
215
|
transactionSplits: getDateFieldPaths('transactionSplit')
|
|
208
216
|
};
|
|
209
217
|
}
|
|
@@ -10,7 +10,9 @@
|
|
|
10
10
|
"STATEMENT": "statement",
|
|
11
11
|
"RECURRING_TRANSACTION": "recurringTransaction",
|
|
12
12
|
"RECURRING_TRANSACTION_EVENT": "recurringTransactionEvent",
|
|
13
|
+
"RECURRING_TRANSACTION_LINK": "recurringTransactionLink",
|
|
13
14
|
"TRANSACTION": "transaction",
|
|
15
|
+
"TRANSACTION_LINK": "transactionLink",
|
|
14
16
|
"TRANSACTION_SPLIT": "transactionSplit"
|
|
15
17
|
},
|
|
16
18
|
"$defs": {
|
|
@@ -5,7 +5,9 @@ import lucaSchema from './lucaSchema.json' with { type: 'json' };
|
|
|
5
5
|
import statement from './statement.json' with { type: 'json' };
|
|
6
6
|
import recurringTransaction from './recurringTransaction.json' with { type: 'json' };
|
|
7
7
|
import recurringTransactionEvent from './recurringTransactionEvent.json' with { type: 'json' };
|
|
8
|
+
import recurringTransactionLink from './recurringTransactionLink.json' with { type: 'json' };
|
|
8
9
|
import transaction from './transaction.json' with { type: 'json' };
|
|
10
|
+
import transactionLink from './transactionLink.json' with { type: 'json' };
|
|
9
11
|
import transactionSplit from './transactionSplit.json' with { type: 'json' };
|
|
10
12
|
import enums from './enums.json' with { type: 'json' };
|
|
11
13
|
|
|
@@ -17,7 +19,9 @@ export {
|
|
|
17
19
|
statement,
|
|
18
20
|
recurringTransaction,
|
|
19
21
|
recurringTransactionEvent,
|
|
22
|
+
recurringTransactionLink,
|
|
20
23
|
transaction,
|
|
24
|
+
transactionLink,
|
|
21
25
|
transactionSplit,
|
|
22
26
|
enums
|
|
23
27
|
};
|
|
@@ -30,7 +34,9 @@ export default {
|
|
|
30
34
|
statement,
|
|
31
35
|
recurringTransaction,
|
|
32
36
|
recurringTransactionEvent,
|
|
37
|
+
recurringTransactionLink,
|
|
33
38
|
transaction,
|
|
39
|
+
transactionLink,
|
|
34
40
|
transactionSplit,
|
|
35
41
|
enums
|
|
36
42
|
};
|
|
@@ -60,6 +60,14 @@
|
|
|
60
60
|
"$ref": "./recurringTransactionEvent.json"
|
|
61
61
|
}
|
|
62
62
|
},
|
|
63
|
+
"recurringTransactionLinks": {
|
|
64
|
+
"type": "array",
|
|
65
|
+
"description": "List of links between related recurring transactions",
|
|
66
|
+
"uniqueItems": true,
|
|
67
|
+
"items": {
|
|
68
|
+
"$ref": "./recurringTransactionLink.json"
|
|
69
|
+
}
|
|
70
|
+
},
|
|
63
71
|
"transactions": {
|
|
64
72
|
"type": "array",
|
|
65
73
|
"description": "List of transactions",
|
|
@@ -68,6 +76,14 @@
|
|
|
68
76
|
"$ref": "./transaction.json"
|
|
69
77
|
}
|
|
70
78
|
},
|
|
79
|
+
"transactionLinks": {
|
|
80
|
+
"type": "array",
|
|
81
|
+
"description": "List of links between related transactions",
|
|
82
|
+
"uniqueItems": true,
|
|
83
|
+
"items": {
|
|
84
|
+
"$ref": "./transactionLink.json"
|
|
85
|
+
}
|
|
86
|
+
},
|
|
71
87
|
"transactionSplits": {
|
|
72
88
|
"type": "array",
|
|
73
89
|
"description": "List of transaction splits",
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
3
|
+
"$id": "https://raw.githubusercontent.com/LucaFinancial/LucaSchema/main/src/schemas/recurringTransactionLink.json",
|
|
4
|
+
"title": "Recurring Transaction Link",
|
|
5
|
+
"description": "Links two related recurring transactions, such as mirrored transfer schedules recorded in separate accounts.",
|
|
6
|
+
"type": "object",
|
|
7
|
+
"allOf": [
|
|
8
|
+
{
|
|
9
|
+
"$ref": "./common.json"
|
|
10
|
+
}
|
|
11
|
+
],
|
|
12
|
+
"properties": {
|
|
13
|
+
"sourceRecurringTransactionId": {
|
|
14
|
+
"type": "string",
|
|
15
|
+
"title": "Source Recurring Transaction ID",
|
|
16
|
+
"format": "uuid",
|
|
17
|
+
"description": "UUID of the source recurring transaction in the link."
|
|
18
|
+
},
|
|
19
|
+
"destinationRecurringTransactionId": {
|
|
20
|
+
"type": "string",
|
|
21
|
+
"title": "Destination Recurring Transaction ID",
|
|
22
|
+
"format": "uuid",
|
|
23
|
+
"description": "UUID of the destination recurring transaction in the link."
|
|
24
|
+
}
|
|
25
|
+
},
|
|
26
|
+
"unevaluatedProperties": false,
|
|
27
|
+
"required": [
|
|
28
|
+
"sourceRecurringTransactionId",
|
|
29
|
+
"destinationRecurringTransactionId"
|
|
30
|
+
]
|
|
31
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
3
|
+
"$id": "https://raw.githubusercontent.com/LucaFinancial/LucaSchema/main/src/schemas/transactionLink.json",
|
|
4
|
+
"title": "Transaction Link",
|
|
5
|
+
"description": "Links two related transactions, such as transfer legs recorded in separate accounts.",
|
|
6
|
+
"type": "object",
|
|
7
|
+
"allOf": [
|
|
8
|
+
{
|
|
9
|
+
"$ref": "./common.json"
|
|
10
|
+
}
|
|
11
|
+
],
|
|
12
|
+
"properties": {
|
|
13
|
+
"sourceTransactionId": {
|
|
14
|
+
"type": "string",
|
|
15
|
+
"title": "Source Transaction ID",
|
|
16
|
+
"format": "uuid",
|
|
17
|
+
"description": "UUID of the source transaction in the link."
|
|
18
|
+
},
|
|
19
|
+
"destinationTransactionId": {
|
|
20
|
+
"type": "string",
|
|
21
|
+
"title": "Destination Transaction ID",
|
|
22
|
+
"format": "uuid",
|
|
23
|
+
"description": "UUID of the destination transaction in the link."
|
|
24
|
+
}
|
|
25
|
+
},
|
|
26
|
+
"unevaluatedProperties": false,
|
|
27
|
+
"required": ["sourceTransactionId", "destinationTransactionId"]
|
|
28
|
+
}
|
package/dist/index.d.ts
CHANGED
|
@@ -526,7 +526,42 @@ export type RecurringTransactionID = string;
|
|
|
526
526
|
* The date when the occurrence is expected.
|
|
527
527
|
*/
|
|
528
528
|
export type ExpectedDate = string;
|
|
529
|
-
|
|
529
|
+
/**
|
|
530
|
+
* Links two related recurring transactions, such as mirrored transfer schedules recorded in separate accounts.
|
|
531
|
+
*/
|
|
532
|
+
export type RecurringTransactionLink = Common5 & {
|
|
533
|
+
sourceRecurringTransactionId: SourceRecurringTransactionID;
|
|
534
|
+
destinationRecurringTransactionId: DestinationRecurringTransactionID;
|
|
535
|
+
};
|
|
536
|
+
/**
|
|
537
|
+
* UUID for the item
|
|
538
|
+
*/
|
|
539
|
+
export type ID5 = string;
|
|
540
|
+
/**
|
|
541
|
+
* The timestamp of the creation of the item
|
|
542
|
+
*/
|
|
543
|
+
export type DateCreated5 = string;
|
|
544
|
+
/**
|
|
545
|
+
* The timestamp of the last update or null if the item has not been updated yet
|
|
546
|
+
*/
|
|
547
|
+
export type LastUpdated5 = string | null;
|
|
548
|
+
/**
|
|
549
|
+
* The timestamp of when the item was soft-deleted
|
|
550
|
+
*/
|
|
551
|
+
export type DateDeleted5 = string | null;
|
|
552
|
+
/**
|
|
553
|
+
* Version number for optimistic concurrency control
|
|
554
|
+
*/
|
|
555
|
+
export type Version5 = number;
|
|
556
|
+
/**
|
|
557
|
+
* UUID of the source recurring transaction in the link.
|
|
558
|
+
*/
|
|
559
|
+
export type SourceRecurringTransactionID = string;
|
|
560
|
+
/**
|
|
561
|
+
* UUID of the destination recurring transaction in the link.
|
|
562
|
+
*/
|
|
563
|
+
export type DestinationRecurringTransactionID = string;
|
|
564
|
+
export type Transaction = Common6 & {
|
|
530
565
|
accountId: AccountID2;
|
|
531
566
|
date: Date;
|
|
532
567
|
authorizedAt?: AuthorizedAt;
|
|
@@ -556,23 +591,23 @@ export type Transaction = Common5 & {
|
|
|
556
591
|
/**
|
|
557
592
|
* UUID for the item
|
|
558
593
|
*/
|
|
559
|
-
export type
|
|
594
|
+
export type ID6 = string;
|
|
560
595
|
/**
|
|
561
596
|
* The timestamp of the creation of the item
|
|
562
597
|
*/
|
|
563
|
-
export type
|
|
598
|
+
export type DateCreated6 = string;
|
|
564
599
|
/**
|
|
565
600
|
* The timestamp of the last update or null if the item has not been updated yet
|
|
566
601
|
*/
|
|
567
|
-
export type
|
|
602
|
+
export type LastUpdated6 = string | null;
|
|
568
603
|
/**
|
|
569
604
|
* The timestamp of when the item was soft-deleted
|
|
570
605
|
*/
|
|
571
|
-
export type
|
|
606
|
+
export type DateDeleted6 = string | null;
|
|
572
607
|
/**
|
|
573
608
|
* Version number for optimistic concurrency control
|
|
574
609
|
*/
|
|
575
|
-
export type
|
|
610
|
+
export type Version6 = number;
|
|
576
611
|
/**
|
|
577
612
|
* ID of the account this transaction belongs to
|
|
578
613
|
*/
|
|
@@ -617,10 +652,45 @@ export type StatementID = string | null;
|
|
|
617
652
|
* Identifier for this transaction in a financial data aggregation service.
|
|
618
653
|
*/
|
|
619
654
|
export type AggregationServiceID1 = string | null;
|
|
655
|
+
/**
|
|
656
|
+
* Links two related transactions, such as transfer legs recorded in separate accounts.
|
|
657
|
+
*/
|
|
658
|
+
export type TransactionLink = Common7 & {
|
|
659
|
+
sourceTransactionId: SourceTransactionID;
|
|
660
|
+
destinationTransactionId: DestinationTransactionID;
|
|
661
|
+
};
|
|
662
|
+
/**
|
|
663
|
+
* UUID for the item
|
|
664
|
+
*/
|
|
665
|
+
export type ID7 = string;
|
|
666
|
+
/**
|
|
667
|
+
* The timestamp of the creation of the item
|
|
668
|
+
*/
|
|
669
|
+
export type DateCreated7 = string;
|
|
670
|
+
/**
|
|
671
|
+
* The timestamp of the last update or null if the item has not been updated yet
|
|
672
|
+
*/
|
|
673
|
+
export type LastUpdated7 = string | null;
|
|
674
|
+
/**
|
|
675
|
+
* The timestamp of when the item was soft-deleted
|
|
676
|
+
*/
|
|
677
|
+
export type DateDeleted7 = string | null;
|
|
678
|
+
/**
|
|
679
|
+
* Version number for optimistic concurrency control
|
|
680
|
+
*/
|
|
681
|
+
export type Version7 = number;
|
|
682
|
+
/**
|
|
683
|
+
* UUID of the source transaction in the link.
|
|
684
|
+
*/
|
|
685
|
+
export type SourceTransactionID = string;
|
|
686
|
+
/**
|
|
687
|
+
* UUID of the destination transaction in the link.
|
|
688
|
+
*/
|
|
689
|
+
export type DestinationTransactionID = string;
|
|
620
690
|
/**
|
|
621
691
|
* Defines a split within a transaction.
|
|
622
692
|
*/
|
|
623
|
-
export type TransactionSplit =
|
|
693
|
+
export type TransactionSplit = Common8 & {
|
|
624
694
|
transactionId: TransactionID;
|
|
625
695
|
amount: Amount2;
|
|
626
696
|
categoryId: CategoryID2;
|
|
@@ -630,23 +700,23 @@ export type TransactionSplit = Common6 & {
|
|
|
630
700
|
/**
|
|
631
701
|
* UUID for the item
|
|
632
702
|
*/
|
|
633
|
-
export type
|
|
703
|
+
export type ID8 = string;
|
|
634
704
|
/**
|
|
635
705
|
* The timestamp of the creation of the item
|
|
636
706
|
*/
|
|
637
|
-
export type
|
|
707
|
+
export type DateCreated8 = string;
|
|
638
708
|
/**
|
|
639
709
|
* The timestamp of the last update or null if the item has not been updated yet
|
|
640
710
|
*/
|
|
641
|
-
export type
|
|
711
|
+
export type LastUpdated8 = string | null;
|
|
642
712
|
/**
|
|
643
713
|
* The timestamp of when the item was soft-deleted
|
|
644
714
|
*/
|
|
645
|
-
export type
|
|
715
|
+
export type DateDeleted8 = string | null;
|
|
646
716
|
/**
|
|
647
717
|
* Version number for optimistic concurrency control
|
|
648
718
|
*/
|
|
649
|
-
export type
|
|
719
|
+
export type Version8 = number;
|
|
650
720
|
/**
|
|
651
721
|
* The identifier of the parent transaction.
|
|
652
722
|
*/
|
|
@@ -696,10 +766,18 @@ export interface LucaSchema {
|
|
|
696
766
|
* List of recurring transaction events
|
|
697
767
|
*/
|
|
698
768
|
recurringTransactionEvents: RecurringTransactionEvent[];
|
|
769
|
+
/**
|
|
770
|
+
* List of links between related recurring transactions
|
|
771
|
+
*/
|
|
772
|
+
recurringTransactionLinks?: RecurringTransactionLink[];
|
|
699
773
|
/**
|
|
700
774
|
* List of transactions
|
|
701
775
|
*/
|
|
702
776
|
transactions: Transaction[];
|
|
777
|
+
/**
|
|
778
|
+
* List of links between related transactions
|
|
779
|
+
*/
|
|
780
|
+
transactionLinks?: TransactionLink[];
|
|
703
781
|
/**
|
|
704
782
|
* List of transaction splits
|
|
705
783
|
*/
|
|
@@ -775,6 +853,26 @@ export interface Common6 {
|
|
|
775
853
|
deletedAt?: DateDeleted6;
|
|
776
854
|
version?: Version6;
|
|
777
855
|
}
|
|
856
|
+
/**
|
|
857
|
+
* Common properties for all schemas
|
|
858
|
+
*/
|
|
859
|
+
export interface Common7 {
|
|
860
|
+
id: ID7;
|
|
861
|
+
createdAt: DateCreated7;
|
|
862
|
+
updatedAt: LastUpdated7;
|
|
863
|
+
deletedAt?: DateDeleted7;
|
|
864
|
+
version?: Version7;
|
|
865
|
+
}
|
|
866
|
+
/**
|
|
867
|
+
* Common properties for all schemas
|
|
868
|
+
*/
|
|
869
|
+
export interface Common8 {
|
|
870
|
+
id: ID8;
|
|
871
|
+
createdAt: DateCreated8;
|
|
872
|
+
updatedAt: LastUpdated8;
|
|
873
|
+
deletedAt?: DateDeleted8;
|
|
874
|
+
version?: Version8;
|
|
875
|
+
}
|
|
778
876
|
|
|
779
877
|
/**
|
|
780
878
|
* Defines recurring financial transactions within the application.
|
|
@@ -926,6 +1024,53 @@ export interface Common {
|
|
|
926
1024
|
version?: Version;
|
|
927
1025
|
}
|
|
928
1026
|
|
|
1027
|
+
/**
|
|
1028
|
+
* Links two related recurring transactions, such as mirrored transfer schedules recorded in separate accounts.
|
|
1029
|
+
*/
|
|
1030
|
+
export type RecurringTransactionLink = Common & {
|
|
1031
|
+
sourceRecurringTransactionId: SourceRecurringTransactionID;
|
|
1032
|
+
destinationRecurringTransactionId: DestinationRecurringTransactionID;
|
|
1033
|
+
};
|
|
1034
|
+
/**
|
|
1035
|
+
* UUID for the item
|
|
1036
|
+
*/
|
|
1037
|
+
export type ID = string;
|
|
1038
|
+
/**
|
|
1039
|
+
* The timestamp of the creation of the item
|
|
1040
|
+
*/
|
|
1041
|
+
export type DateCreated = string;
|
|
1042
|
+
/**
|
|
1043
|
+
* The timestamp of the last update or null if the item has not been updated yet
|
|
1044
|
+
*/
|
|
1045
|
+
export type LastUpdated = string | null;
|
|
1046
|
+
/**
|
|
1047
|
+
* The timestamp of when the item was soft-deleted
|
|
1048
|
+
*/
|
|
1049
|
+
export type DateDeleted = string | null;
|
|
1050
|
+
/**
|
|
1051
|
+
* Version number for optimistic concurrency control
|
|
1052
|
+
*/
|
|
1053
|
+
export type Version = number;
|
|
1054
|
+
/**
|
|
1055
|
+
* UUID of the source recurring transaction in the link.
|
|
1056
|
+
*/
|
|
1057
|
+
export type SourceRecurringTransactionID = string;
|
|
1058
|
+
/**
|
|
1059
|
+
* UUID of the destination recurring transaction in the link.
|
|
1060
|
+
*/
|
|
1061
|
+
export type DestinationRecurringTransactionID = string;
|
|
1062
|
+
|
|
1063
|
+
/**
|
|
1064
|
+
* Common properties for all schemas
|
|
1065
|
+
*/
|
|
1066
|
+
export interface Common {
|
|
1067
|
+
id: ID;
|
|
1068
|
+
createdAt: DateCreated;
|
|
1069
|
+
updatedAt: LastUpdated;
|
|
1070
|
+
deletedAt?: DateDeleted;
|
|
1071
|
+
version?: Version;
|
|
1072
|
+
}
|
|
1073
|
+
|
|
929
1074
|
/**
|
|
930
1075
|
* Defines the schema for credit card statements.
|
|
931
1076
|
*/
|
|
@@ -1106,6 +1251,53 @@ export interface Common {
|
|
|
1106
1251
|
version?: Version;
|
|
1107
1252
|
}
|
|
1108
1253
|
|
|
1254
|
+
/**
|
|
1255
|
+
* Links two related transactions, such as transfer legs recorded in separate accounts.
|
|
1256
|
+
*/
|
|
1257
|
+
export type TransactionLink = Common & {
|
|
1258
|
+
sourceTransactionId: SourceTransactionID;
|
|
1259
|
+
destinationTransactionId: DestinationTransactionID;
|
|
1260
|
+
};
|
|
1261
|
+
/**
|
|
1262
|
+
* UUID for the item
|
|
1263
|
+
*/
|
|
1264
|
+
export type ID = string;
|
|
1265
|
+
/**
|
|
1266
|
+
* The timestamp of the creation of the item
|
|
1267
|
+
*/
|
|
1268
|
+
export type DateCreated = string;
|
|
1269
|
+
/**
|
|
1270
|
+
* The timestamp of the last update or null if the item has not been updated yet
|
|
1271
|
+
*/
|
|
1272
|
+
export type LastUpdated = string | null;
|
|
1273
|
+
/**
|
|
1274
|
+
* The timestamp of when the item was soft-deleted
|
|
1275
|
+
*/
|
|
1276
|
+
export type DateDeleted = string | null;
|
|
1277
|
+
/**
|
|
1278
|
+
* Version number for optimistic concurrency control
|
|
1279
|
+
*/
|
|
1280
|
+
export type Version = number;
|
|
1281
|
+
/**
|
|
1282
|
+
* UUID of the source transaction in the link.
|
|
1283
|
+
*/
|
|
1284
|
+
export type SourceTransactionID = string;
|
|
1285
|
+
/**
|
|
1286
|
+
* UUID of the destination transaction in the link.
|
|
1287
|
+
*/
|
|
1288
|
+
export type DestinationTransactionID = string;
|
|
1289
|
+
|
|
1290
|
+
/**
|
|
1291
|
+
* Common properties for all schemas
|
|
1292
|
+
*/
|
|
1293
|
+
export interface Common {
|
|
1294
|
+
id: ID;
|
|
1295
|
+
createdAt: DateCreated;
|
|
1296
|
+
updatedAt: LastUpdated;
|
|
1297
|
+
deletedAt?: DateDeleted;
|
|
1298
|
+
version?: Version;
|
|
1299
|
+
}
|
|
1300
|
+
|
|
1109
1301
|
/**
|
|
1110
1302
|
* Defines a split within a transaction.
|
|
1111
1303
|
*/
|