bkper-js 1.19.0 → 1.19.2
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/lib/index.d.ts +23 -22
- package/lib/model/Book.js +12 -1
- package/package.json +1 -1
package/lib/index.d.ts
CHANGED
|
@@ -382,31 +382,31 @@ export declare interface BalancesContainer {
|
|
|
382
382
|
/**
|
|
383
383
|
* @returns The parent BalancesReport of the container
|
|
384
384
|
*/
|
|
385
|
-
getBalancesReport()
|
|
385
|
+
getBalancesReport: () => BalancesReport;
|
|
386
386
|
/**
|
|
387
387
|
* @returns The [[Account]] or [[Group]] name
|
|
388
388
|
*/
|
|
389
|
-
getName()
|
|
389
|
+
getName: () => string | undefined;
|
|
390
390
|
/**
|
|
391
391
|
* @returns The [[Account]] or [[Group]] name without spaces or special characters.
|
|
392
392
|
*/
|
|
393
|
-
getNormalizedName()
|
|
393
|
+
getNormalizedName: () => string | undefined;
|
|
394
394
|
/**
|
|
395
395
|
* @returns The [[Group]] associated with this container
|
|
396
396
|
*/
|
|
397
|
-
getGroup()
|
|
397
|
+
getGroup: () => Promise<Group | null>;
|
|
398
398
|
/**
|
|
399
399
|
* @returns The [[Account]] associated with this container
|
|
400
400
|
*/
|
|
401
|
-
getAccount()
|
|
401
|
+
getAccount: () => Promise<Account | null>;
|
|
402
402
|
/**
|
|
403
403
|
* @returns The parent BalanceContainer.
|
|
404
404
|
*/
|
|
405
|
-
getParent()
|
|
405
|
+
getParent: () => BalancesContainer | null;
|
|
406
406
|
/**
|
|
407
407
|
* @returns The depth in the parent chain up to the root.
|
|
408
408
|
*/
|
|
409
|
-
getDepth()
|
|
409
|
+
getDepth: () => number;
|
|
410
410
|
/**
|
|
411
411
|
* @returns Gets the credit nature of the BalancesContainer, based on [[Account]] or [[Group]].
|
|
412
412
|
*
|
|
@@ -415,7 +415,7 @@ export declare interface BalancesContainer {
|
|
|
415
415
|
* For [[Group]], the credit nature will be the same, if all accounts containing on it has the same credit nature. False if mixed.
|
|
416
416
|
*
|
|
417
417
|
*/
|
|
418
|
-
isCredit()
|
|
418
|
+
isCredit: () => boolean | undefined;
|
|
419
419
|
/**
|
|
420
420
|
*
|
|
421
421
|
* Tell if this balance container is permament, based on the [[Account]] or [[Group]].
|
|
@@ -428,57 +428,57 @@ export declare interface BalancesContainer {
|
|
|
428
428
|
*
|
|
429
429
|
* @returns True if its a permanent Account
|
|
430
430
|
*/
|
|
431
|
-
isPermanent()
|
|
431
|
+
isPermanent: () => boolean | undefined;
|
|
432
432
|
/**
|
|
433
433
|
* @returns True if this balance container if from an [[Account]]
|
|
434
434
|
*/
|
|
435
|
-
isFromAccount()
|
|
435
|
+
isFromAccount: () => boolean;
|
|
436
436
|
/**
|
|
437
437
|
* @returns True if this balance container if from a [[Group]]
|
|
438
438
|
*/
|
|
439
|
-
isFromGroup()
|
|
439
|
+
isFromGroup: () => boolean;
|
|
440
440
|
/**
|
|
441
441
|
* @returns True if the balance container is from a parent group
|
|
442
442
|
*/
|
|
443
|
-
hasGroupBalances()
|
|
443
|
+
hasGroupBalances: () => boolean;
|
|
444
444
|
/**
|
|
445
445
|
* @returns The cumulative balance to the date.
|
|
446
446
|
*/
|
|
447
|
-
getCumulativeBalance()
|
|
447
|
+
getCumulativeBalance: () => Amount;
|
|
448
448
|
/**
|
|
449
449
|
* @returns The cumulative raw balance to the date.
|
|
450
450
|
*/
|
|
451
|
-
getCumulativeBalanceRaw()
|
|
451
|
+
getCumulativeBalanceRaw: () => Amount;
|
|
452
452
|
/**
|
|
453
453
|
* @returns The cumulative balance formatted according to [[Book]] decimal format and fraction digits.
|
|
454
454
|
*/
|
|
455
|
-
getCumulativeBalanceText()
|
|
455
|
+
getCumulativeBalanceText: () => string;
|
|
456
456
|
/**
|
|
457
457
|
* @returns The cumulative raw balance formatted according to [[Book]] decimal format and fraction digits.
|
|
458
458
|
*/
|
|
459
|
-
getCumulativeBalanceRawText()
|
|
459
|
+
getCumulativeBalanceRawText: () => string;
|
|
460
460
|
/**
|
|
461
461
|
* @returns The balance on the date period.
|
|
462
462
|
*/
|
|
463
|
-
getPeriodBalance()
|
|
463
|
+
getPeriodBalance: () => Amount;
|
|
464
464
|
/**
|
|
465
465
|
* @returns The raw balance on the date period.
|
|
466
466
|
*/
|
|
467
|
-
getPeriodBalanceRaw()
|
|
467
|
+
getPeriodBalanceRaw: () => Amount;
|
|
468
468
|
/**
|
|
469
469
|
* @returns The balance on the date period formatted according to [[Book]] decimal format and fraction digits
|
|
470
470
|
*/
|
|
471
|
-
getPeriodBalanceText()
|
|
471
|
+
getPeriodBalanceText: () => string;
|
|
472
472
|
/**
|
|
473
473
|
* @returns The raw balance on the date period formatted according to [[Book]] decimal format and fraction digits
|
|
474
474
|
*/
|
|
475
|
-
getPeriodBalanceRawText()
|
|
475
|
+
getPeriodBalanceRawText: () => string;
|
|
476
476
|
/**
|
|
477
477
|
* @returns All child [[BalancesContainers]].
|
|
478
478
|
*
|
|
479
479
|
* **NOTE**: Only for Group balance containers. Accounts returns null.
|
|
480
480
|
*/
|
|
481
|
-
getBalancesContainers()
|
|
481
|
+
getBalancesContainers: () => BalancesContainer[];
|
|
482
482
|
/**
|
|
483
483
|
* Gets a specific [[BalancesContainer]].
|
|
484
484
|
*
|
|
@@ -486,7 +486,7 @@ export declare interface BalancesContainer {
|
|
|
486
486
|
*
|
|
487
487
|
* @returns The retrieved [[BalancesContainer]].
|
|
488
488
|
*/
|
|
489
|
-
getBalancesContainer(name: string)
|
|
489
|
+
getBalancesContainer: (name: string) => BalancesContainer;
|
|
490
490
|
}
|
|
491
491
|
|
|
492
492
|
/**
|
|
@@ -934,6 +934,7 @@ export declare class Book {
|
|
|
934
934
|
*/
|
|
935
935
|
getAccounts(): Promise<Account[]>;
|
|
936
936
|
private mapAccounts;
|
|
937
|
+
|
|
937
938
|
/**
|
|
938
939
|
* Lists transactions in the Book based on the provided query, limit, and cursor, for pagination.
|
|
939
940
|
*
|
package/lib/model/Book.js
CHANGED
|
@@ -522,7 +522,7 @@ export class Book {
|
|
|
522
522
|
const group = (_a = this.idGroupMap) === null || _a === void 0 ? void 0 : _a.get(groupPayload.id || "");
|
|
523
523
|
if (group != null) {
|
|
524
524
|
group.addAccount(account);
|
|
525
|
-
//TODO add known group to account
|
|
525
|
+
// TODO add known group to account
|
|
526
526
|
}
|
|
527
527
|
}
|
|
528
528
|
}
|
|
@@ -631,8 +631,19 @@ export class Book {
|
|
|
631
631
|
for (const account of accountsObj) {
|
|
632
632
|
this.updateAccountCache(account);
|
|
633
633
|
}
|
|
634
|
+
this.ensureGroupsAccountMapsLoaded();
|
|
634
635
|
return accountsObj;
|
|
635
636
|
}
|
|
637
|
+
/** @internal */
|
|
638
|
+
ensureGroupsAccountMapsLoaded() {
|
|
639
|
+
if (this.idGroupMap) {
|
|
640
|
+
for (const group of this.idGroupMap.values()) {
|
|
641
|
+
if (group.accounts == null) {
|
|
642
|
+
group.accounts = new Set();
|
|
643
|
+
}
|
|
644
|
+
}
|
|
645
|
+
}
|
|
646
|
+
}
|
|
636
647
|
/**
|
|
637
648
|
* Lists transactions in the Book based on the provided query, limit, and cursor, for pagination.
|
|
638
649
|
*
|