bkper-js 1.0.0 → 1.2.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/README.md +4 -4
- package/lib/index.d.ts +115 -97
- package/lib/index.js +15 -35
- package/lib/model/Account.js +30 -50
- package/lib/model/Amount.js +6 -13
- package/lib/model/App.js +6 -10
- package/lib/model/Bkper.js +14 -41
- package/lib/model/Book.js +64 -103
- package/lib/model/Collection.js +5 -9
- package/lib/model/Config.js +1 -2
- package/lib/model/Connection.js +8 -32
- package/lib/model/Enums.js +12 -15
- package/lib/model/File.js +19 -32
- package/lib/model/Group.js +16 -40
- package/lib/model/Integration.js +6 -7
- package/lib/model/Transaction.js +59 -77
- package/lib/model/TransactionIterator.js +15 -19
- package/lib/model/TransactionPage.js +14 -40
- package/lib/model/User.js +9 -34
- package/lib/service/account-service.js +9 -15
- package/lib/service/app-service.js +7 -12
- package/lib/service/balances-service.js +3 -6
- package/lib/service/book-service.js +7 -12
- package/lib/service/connection-service.js +16 -21
- package/lib/service/file-service.js +5 -9
- package/lib/service/group-service.js +18 -24
- package/lib/service/http-api-request.js +50 -101
- package/lib/service/http-request.js +78 -0
- package/lib/service/integration-service.js +9 -15
- package/lib/service/transaction-service.js +27 -37
- package/lib/service/user-service.js +3 -6
- package/lib/utils.js +72 -85
- package/package.json +9 -7
package/lib/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Bkper REST API
|
|
2
|
+
* Bkper REST API Javascript client for Node.js and browsers.
|
|
3
3
|
*
|
|
4
4
|
* Learn more at https://bkper.com/docs
|
|
5
5
|
*
|
|
@@ -19,6 +19,7 @@
|
|
|
19
19
|
export declare class Account {
|
|
20
20
|
|
|
21
21
|
|
|
22
|
+
constructor(book: Book, json?: bkper.Account);
|
|
22
23
|
/**
|
|
23
24
|
*
|
|
24
25
|
* @returns The wrapped plain json object
|
|
@@ -27,11 +28,11 @@ export declare class Account {
|
|
|
27
28
|
/**
|
|
28
29
|
* Gets the account internal id.
|
|
29
30
|
*/
|
|
30
|
-
getId(): string;
|
|
31
|
+
getId(): string | undefined;
|
|
31
32
|
/**
|
|
32
33
|
* Gets the account name.
|
|
33
34
|
*/
|
|
34
|
-
getName(): string;
|
|
35
|
+
getName(): string | undefined;
|
|
35
36
|
/**
|
|
36
37
|
*
|
|
37
38
|
* Sets the name of the Account.
|
|
@@ -75,7 +76,7 @@ export declare class Account {
|
|
|
75
76
|
*
|
|
76
77
|
* @param keys - The property key
|
|
77
78
|
*/
|
|
78
|
-
getProperty(...keys: string[]): string;
|
|
79
|
+
getProperty(...keys: string[]): string | undefined;
|
|
79
80
|
/**
|
|
80
81
|
* Sets a custom property in the Account.
|
|
81
82
|
*
|
|
@@ -84,7 +85,7 @@ export declare class Account {
|
|
|
84
85
|
*
|
|
85
86
|
* @returns This Account, for chainning.
|
|
86
87
|
*/
|
|
87
|
-
setProperty(key: string, value: string): Account;
|
|
88
|
+
setProperty(key: string, value: string | null): Account;
|
|
88
89
|
/**
|
|
89
90
|
* Delete a custom property
|
|
90
91
|
*
|
|
@@ -108,7 +109,7 @@ export declare class Account {
|
|
|
108
109
|
/**
|
|
109
110
|
* Tell if this account is archived.
|
|
110
111
|
*/
|
|
111
|
-
isArchived(): boolean;
|
|
112
|
+
isArchived(): boolean | undefined;
|
|
112
113
|
/**
|
|
113
114
|
* Set account archived/unarchived.
|
|
114
115
|
*
|
|
@@ -120,7 +121,7 @@ export declare class Account {
|
|
|
120
121
|
*
|
|
121
122
|
* Accounts with transaction posted, even with zero balance, can only be archived.
|
|
122
123
|
*/
|
|
123
|
-
hasTransactionPosted(): boolean;
|
|
124
|
+
hasTransactionPosted(): boolean | undefined;
|
|
124
125
|
/**
|
|
125
126
|
*
|
|
126
127
|
* Tell if the account is permanent.
|
|
@@ -133,7 +134,7 @@ export declare class Account {
|
|
|
133
134
|
*
|
|
134
135
|
* @returns True if its a permanent Account
|
|
135
136
|
*/
|
|
136
|
-
isPermanent(): boolean;
|
|
137
|
+
isPermanent(): boolean | undefined;
|
|
137
138
|
/**
|
|
138
139
|
* Tell if the account has a Credit nature or Debit otherwise
|
|
139
140
|
*
|
|
@@ -154,7 +155,7 @@ export declare class Account {
|
|
|
154
155
|
*
|
|
155
156
|
* As a rule of thumb, and for simple understanding, almost all accounts are Debit nature (NOT credit), except the ones that "offers" amount for the books, like revenue accounts.
|
|
156
157
|
*/
|
|
157
|
-
isCredit(): boolean;
|
|
158
|
+
isCredit(): boolean | undefined;
|
|
158
159
|
/**
|
|
159
160
|
* Get the [[Groups]] of this account.
|
|
160
161
|
*/
|
|
@@ -314,7 +315,7 @@ export declare class Amount {
|
|
|
314
315
|
*/
|
|
315
316
|
export declare class App {
|
|
316
317
|
|
|
317
|
-
constructor(json
|
|
318
|
+
constructor(json?: bkper.App);
|
|
318
319
|
/**
|
|
319
320
|
*
|
|
320
321
|
* Sets the webhook url for development.
|
|
@@ -326,31 +327,31 @@ export declare class App {
|
|
|
326
327
|
*
|
|
327
328
|
* @returns The App universal identifier
|
|
328
329
|
*/
|
|
329
|
-
getId(): string;
|
|
330
|
+
getId(): string | undefined;
|
|
330
331
|
/**
|
|
331
332
|
* Sets the whitelabeled user emails
|
|
332
333
|
*
|
|
333
334
|
* @returns This App for chaining
|
|
334
335
|
*/
|
|
335
|
-
setUserEmails(emails
|
|
336
|
+
setUserEmails(emails?: string): App;
|
|
336
337
|
/**
|
|
337
338
|
* Sets the developer email
|
|
338
339
|
*
|
|
339
340
|
* @returns This App for chaining
|
|
340
341
|
*/
|
|
341
|
-
setDeveloperEmail(email
|
|
342
|
+
setDeveloperEmail(email?: string): App;
|
|
342
343
|
/**
|
|
343
344
|
* Sets the client secret
|
|
344
345
|
*
|
|
345
346
|
* @returns This App for chaining
|
|
346
347
|
*/
|
|
347
|
-
setClientSecret(clientSecret
|
|
348
|
+
setClientSecret(clientSecret?: string): App;
|
|
348
349
|
/**
|
|
349
350
|
* Sets the readme text
|
|
350
351
|
*
|
|
351
352
|
* @returns This App for chaining
|
|
352
353
|
*/
|
|
353
|
-
setReadme(readme
|
|
354
|
+
setReadme(readme?: string): App;
|
|
354
355
|
/**
|
|
355
356
|
* Performs the app creation, applying pending changes.
|
|
356
357
|
*
|
|
@@ -368,7 +369,7 @@ export declare class App {
|
|
|
368
369
|
}
|
|
369
370
|
|
|
370
371
|
/**
|
|
371
|
-
* This is the main Entry Point of the [bkper-
|
|
372
|
+
* This is the main Entry Point of the [bkper-js](https://www.npmjs.com/package/bkper-js) library.
|
|
372
373
|
*
|
|
373
374
|
* @public
|
|
374
375
|
*/
|
|
@@ -424,7 +425,7 @@ export declare class Book {
|
|
|
424
425
|
|
|
425
426
|
|
|
426
427
|
|
|
427
|
-
constructor(json
|
|
428
|
+
constructor(json?: bkper.Book);
|
|
428
429
|
/**
|
|
429
430
|
* @returns The wrapped plain json object
|
|
430
431
|
*/
|
|
@@ -436,7 +437,7 @@ export declare class Book {
|
|
|
436
437
|
/**
|
|
437
438
|
* @returns The name of this Book
|
|
438
439
|
*/
|
|
439
|
-
getName(): string;
|
|
440
|
+
getName(): string | undefined;
|
|
440
441
|
/**
|
|
441
442
|
*
|
|
442
443
|
* Sets the name of the Book.
|
|
@@ -447,11 +448,11 @@ export declare class Book {
|
|
|
447
448
|
/**
|
|
448
449
|
* @returns The number of fraction digits supported by this Book. Same as getDecimalPlaces
|
|
449
450
|
*/
|
|
450
|
-
getFractionDigits(): number;
|
|
451
|
+
getFractionDigits(): number | undefined;
|
|
451
452
|
/**
|
|
452
453
|
* @returns The number of decimal places supported by this Book. Same as getFractionDigits
|
|
453
454
|
*/
|
|
454
|
-
getDecimalPlaces(): number;
|
|
455
|
+
getDecimalPlaces(): number | undefined;
|
|
455
456
|
/**
|
|
456
457
|
*
|
|
457
458
|
* Sets the number of fraction digits (decimal places) supported by this Book
|
|
@@ -482,7 +483,7 @@ export declare class Book {
|
|
|
482
483
|
/**
|
|
483
484
|
* @returns The transactions pagination page size
|
|
484
485
|
*/
|
|
485
|
-
getPageSize(): number;
|
|
486
|
+
getPageSize(): number | undefined;
|
|
486
487
|
/**
|
|
487
488
|
* Sets the transactions pagination page size
|
|
488
489
|
*
|
|
@@ -492,7 +493,7 @@ export declare class Book {
|
|
|
492
493
|
/**
|
|
493
494
|
* @returns The name of the owner of the Book
|
|
494
495
|
*/
|
|
495
|
-
getOwnerName(): string;
|
|
496
|
+
getOwnerName(): string | undefined;
|
|
496
497
|
/**
|
|
497
498
|
* @returns The permission for the current user
|
|
498
499
|
*/
|
|
@@ -500,11 +501,11 @@ export declare class Book {
|
|
|
500
501
|
/**
|
|
501
502
|
* @returns The collection of this book
|
|
502
503
|
*/
|
|
503
|
-
getCollection(): Collection;
|
|
504
|
+
getCollection(): Collection | undefined;
|
|
504
505
|
/**
|
|
505
506
|
* @returns The date pattern of the Book. Current: dd/MM/yyyy | MM/dd/yyyy | yyyy/MM/dd
|
|
506
507
|
*/
|
|
507
|
-
getDatePattern(): string;
|
|
508
|
+
getDatePattern(): string | undefined;
|
|
508
509
|
/**
|
|
509
510
|
*
|
|
510
511
|
* Sets the date pattern of the Book. Current: dd/MM/yyyy | MM/dd/yyyy | yyyy/MM/dd
|
|
@@ -515,7 +516,7 @@ export declare class Book {
|
|
|
515
516
|
/**
|
|
516
517
|
* @returns The lock date of the Book in ISO format yyyy-MM-dd
|
|
517
518
|
*/
|
|
518
|
-
getLockDate(): string;
|
|
519
|
+
getLockDate(): string | undefined;
|
|
519
520
|
/**
|
|
520
521
|
*
|
|
521
522
|
* Sets the lock date of the Book in ISO format yyyy-MM-dd.
|
|
@@ -526,7 +527,7 @@ export declare class Book {
|
|
|
526
527
|
/**
|
|
527
528
|
* @returns The closing date of the Book in ISO format yyyy-MM-dd
|
|
528
529
|
*/
|
|
529
|
-
getClosingDate(): string;
|
|
530
|
+
getClosingDate(): string | undefined;
|
|
530
531
|
/**
|
|
531
532
|
*
|
|
532
533
|
* Sets the closing date of the Book in ISO format yyyy-MM-dd.
|
|
@@ -548,7 +549,7 @@ export declare class Book {
|
|
|
548
549
|
/**
|
|
549
550
|
* @returns The time zone of the Book
|
|
550
551
|
*/
|
|
551
|
-
getTimeZone(): string;
|
|
552
|
+
getTimeZone(): string | undefined;
|
|
552
553
|
/**
|
|
553
554
|
*
|
|
554
555
|
* Sets the time zone of the Book
|
|
@@ -559,11 +560,11 @@ export declare class Book {
|
|
|
559
560
|
/**
|
|
560
561
|
* @returns The time zone offset of the book, in minutes
|
|
561
562
|
*/
|
|
562
|
-
getTimeZoneOffset(): number;
|
|
563
|
+
getTimeZoneOffset(): number | undefined;
|
|
563
564
|
/**
|
|
564
565
|
* @returns The last update date of the book, in in milliseconds
|
|
565
566
|
*/
|
|
566
|
-
getLastUpdateMs(): number;
|
|
567
|
+
getLastUpdateMs(): number | undefined;
|
|
567
568
|
/**
|
|
568
569
|
* Gets the custom properties stored in this Book
|
|
569
570
|
*/
|
|
@@ -575,7 +576,7 @@ export declare class Book {
|
|
|
575
576
|
*
|
|
576
577
|
* @param keys - The property key
|
|
577
578
|
*/
|
|
578
|
-
getProperty(...keys: string[]): string;
|
|
579
|
+
getProperty(...keys: string[]): string | undefined;
|
|
579
580
|
/**
|
|
580
581
|
* Sets the custom properties of the Book
|
|
581
582
|
*
|
|
@@ -594,7 +595,7 @@ export declare class Book {
|
|
|
594
595
|
*
|
|
595
596
|
* @returns This Book, for chainning.
|
|
596
597
|
*/
|
|
597
|
-
setProperty(key: string, value: string): Book;
|
|
598
|
+
setProperty(key: string, value: string | null): Book;
|
|
598
599
|
/**
|
|
599
600
|
* Formats a date according to date pattern of the Book.
|
|
600
601
|
*
|
|
@@ -621,7 +622,7 @@ export declare class Book {
|
|
|
621
622
|
/**
|
|
622
623
|
* Parse a value string according to [[DecimalSeparator]] and fraction digits of the Book.
|
|
623
624
|
*/
|
|
624
|
-
parseValue(value: string): Amount;
|
|
625
|
+
parseValue(value: string): Amount | undefined;
|
|
625
626
|
/**
|
|
626
627
|
* Rounds a value according to the number of fraction digits of the Book
|
|
627
628
|
*
|
|
@@ -672,8 +673,6 @@ export declare class Book {
|
|
|
672
673
|
* @returns a collection of transactions that remained in a previous iterator when the continuation token was generated
|
|
673
674
|
*/
|
|
674
675
|
continueTransactionIterator(query: string, continuationToken: string): TransactionIterator;
|
|
675
|
-
configureTransactions_(transactions: Transaction[]): Transaction[];
|
|
676
|
-
|
|
677
676
|
/**
|
|
678
677
|
* Instantiate a new [[Transaction]]
|
|
679
678
|
*
|
|
@@ -731,7 +730,7 @@ export declare class Book {
|
|
|
731
730
|
*
|
|
732
731
|
* @returns The matching Account object
|
|
733
732
|
*/
|
|
734
|
-
getAccount(idOrName
|
|
733
|
+
getAccount(idOrName?: string): Promise<Account | undefined>;
|
|
735
734
|
|
|
736
735
|
removeGroupCache(group: Group): void;
|
|
737
736
|
/**
|
|
@@ -741,7 +740,7 @@ export declare class Book {
|
|
|
741
740
|
*
|
|
742
741
|
* @returns The matching Group object
|
|
743
742
|
*/
|
|
744
|
-
getGroup(idOrName
|
|
743
|
+
getGroup(idOrName?: string): Promise<Group | undefined>;
|
|
745
744
|
/**
|
|
746
745
|
* Gets all [[Groups]] of this Book
|
|
747
746
|
*/
|
|
@@ -776,7 +775,7 @@ export declare class Book {
|
|
|
776
775
|
/**
|
|
777
776
|
* Retrieve a transaction by id
|
|
778
777
|
*/
|
|
779
|
-
getTransaction(id: string): Promise<Transaction>;
|
|
778
|
+
getTransaction(id: string): Promise<Transaction | undefined>;
|
|
780
779
|
/**
|
|
781
780
|
* Instantiate a new [[BkperFile]]
|
|
782
781
|
*
|
|
@@ -811,11 +810,11 @@ export declare class Collection {
|
|
|
811
810
|
/**
|
|
812
811
|
* @returns The id of this Collection
|
|
813
812
|
*/
|
|
814
|
-
getId(): string;
|
|
813
|
+
getId(): string | undefined;
|
|
815
814
|
/**
|
|
816
815
|
* @returns The name of this Collection
|
|
817
816
|
*/
|
|
818
|
-
getName(): string;
|
|
817
|
+
getName(): string | undefined;
|
|
819
818
|
/**
|
|
820
819
|
* @returns All Books of this collection.
|
|
821
820
|
*/
|
|
@@ -850,6 +849,17 @@ export declare interface Config {
|
|
|
850
849
|
* Custom request error handler
|
|
851
850
|
*/
|
|
852
851
|
requestErrorHandler?: (error: any) => any;
|
|
852
|
+
/**
|
|
853
|
+
* Custom request retry handler.
|
|
854
|
+
*
|
|
855
|
+
* This function is called when a request fails and needs to be retried.
|
|
856
|
+
* It provides the HTTP status code, error message, and the number of retry attempts made so far.
|
|
857
|
+
*
|
|
858
|
+
* @param code - The HTTP status code of the failed request.
|
|
859
|
+
* @param message - The error message associated with the failed request.
|
|
860
|
+
* @param attempt - The number of retry attempts made so far.
|
|
861
|
+
*/
|
|
862
|
+
requestRetryHandler?: (status?: number, message?: string, attempt?: number) => Promise<void>;
|
|
853
863
|
/**
|
|
854
864
|
* Sets the base api url. Default to https://app.bkper.com/_ah/api/bkper
|
|
855
865
|
*/
|
|
@@ -875,13 +885,13 @@ export declare class Connection {
|
|
|
875
885
|
*
|
|
876
886
|
* @returns The Connection's id
|
|
877
887
|
*/
|
|
878
|
-
getId(): string;
|
|
888
|
+
getId(): string | undefined;
|
|
879
889
|
/**
|
|
880
890
|
* Gets the agentId of the Connection.
|
|
881
891
|
*
|
|
882
892
|
* @returns The Connection's agentId
|
|
883
893
|
*/
|
|
884
|
-
getAgentId(): string;
|
|
894
|
+
getAgentId(): string | undefined;
|
|
885
895
|
/**
|
|
886
896
|
* Sets the Connection agentId.
|
|
887
897
|
*
|
|
@@ -895,13 +905,13 @@ export declare class Connection {
|
|
|
895
905
|
*
|
|
896
906
|
* @returns The Connection name
|
|
897
907
|
*/
|
|
898
|
-
getName(): string;
|
|
908
|
+
getName(): string | undefined;
|
|
899
909
|
/**
|
|
900
910
|
* Gets the email of the owner of the Connection.
|
|
901
911
|
*
|
|
902
912
|
* @returns The Connection owner's email
|
|
903
913
|
*/
|
|
904
|
-
getEmail(): string;
|
|
914
|
+
getEmail(): string | undefined;
|
|
905
915
|
/**
|
|
906
916
|
* Sets the name of the Connection.
|
|
907
917
|
*
|
|
@@ -923,13 +933,13 @@ export declare class Connection {
|
|
|
923
933
|
*
|
|
924
934
|
* @returns The Connection's universal unique identifier name
|
|
925
935
|
*/
|
|
926
|
-
getUUID(): string;
|
|
936
|
+
getUUID(): string | undefined;
|
|
927
937
|
/**
|
|
928
938
|
* Gets the type of the Connection.
|
|
929
939
|
*
|
|
930
940
|
* @returns The Connection type
|
|
931
941
|
*/
|
|
932
|
-
getType(): "APP" | "BANK";
|
|
942
|
+
getType(): "APP" | "BANK" | undefined;
|
|
933
943
|
/**
|
|
934
944
|
* Sets the Connection type.
|
|
935
945
|
*
|
|
@@ -963,7 +973,7 @@ export declare class Connection {
|
|
|
963
973
|
*
|
|
964
974
|
* @returns The retrieved property value
|
|
965
975
|
*/
|
|
966
|
-
getProperty(...keys: string[]): string;
|
|
976
|
+
getProperty(...keys: string[]): string | undefined;
|
|
967
977
|
/**
|
|
968
978
|
* Sets a custom property in the Connection.
|
|
969
979
|
*
|
|
@@ -972,7 +982,7 @@ export declare class Connection {
|
|
|
972
982
|
*
|
|
973
983
|
* @returns The Connection, for chaining
|
|
974
984
|
*/
|
|
975
|
-
setProperty(key: string, value: string): Connection;
|
|
985
|
+
setProperty(key: string, value: string | null): Connection;
|
|
976
986
|
/**
|
|
977
987
|
* Deletes a custom property stored in the Connection.
|
|
978
988
|
*
|
|
@@ -1032,14 +1042,20 @@ export declare enum DecimalSeparator {
|
|
|
1032
1042
|
export declare class File {
|
|
1033
1043
|
|
|
1034
1044
|
|
|
1045
|
+
constructor(book: Book, json?: bkper.File);
|
|
1046
|
+
/**
|
|
1047
|
+
*
|
|
1048
|
+
* @returns The wrapped plain json object
|
|
1049
|
+
*/
|
|
1050
|
+
json(): bkper.Transaction;
|
|
1035
1051
|
/**
|
|
1036
1052
|
* Gets the File id
|
|
1037
1053
|
*/
|
|
1038
|
-
getId(): string;
|
|
1054
|
+
getId(): string | undefined;
|
|
1039
1055
|
/**
|
|
1040
1056
|
* Gets the File name
|
|
1041
1057
|
*/
|
|
1042
|
-
getName(): string;
|
|
1058
|
+
getName(): string | undefined;
|
|
1043
1059
|
/**
|
|
1044
1060
|
*
|
|
1045
1061
|
* Sets the name of the File.
|
|
@@ -1050,7 +1066,7 @@ export declare class File {
|
|
|
1050
1066
|
/**
|
|
1051
1067
|
* Gets the File content type
|
|
1052
1068
|
*/
|
|
1053
|
-
getContentType(): string;
|
|
1069
|
+
getContentType(): string | undefined;
|
|
1054
1070
|
/**
|
|
1055
1071
|
*
|
|
1056
1072
|
* Sets the File content type.
|
|
@@ -1061,7 +1077,7 @@ export declare class File {
|
|
|
1061
1077
|
/**
|
|
1062
1078
|
* Gets the file content Base64 encoded
|
|
1063
1079
|
*/
|
|
1064
|
-
getContent(): Promise<string>;
|
|
1080
|
+
getContent(): Promise<string | undefined>;
|
|
1065
1081
|
/**
|
|
1066
1082
|
*
|
|
1067
1083
|
* Sets the File content Base64 encoded.
|
|
@@ -1072,11 +1088,11 @@ export declare class File {
|
|
|
1072
1088
|
/**
|
|
1073
1089
|
* Gets the file serving url for accessing via browser
|
|
1074
1090
|
*/
|
|
1075
|
-
getUrl(): string;
|
|
1091
|
+
getUrl(): string | undefined;
|
|
1076
1092
|
/**
|
|
1077
1093
|
* Gets the file size in bytes
|
|
1078
1094
|
*/
|
|
1079
|
-
getSize(): number;
|
|
1095
|
+
getSize(): number | undefined;
|
|
1080
1096
|
/**
|
|
1081
1097
|
* Perform create new File.
|
|
1082
1098
|
*/
|
|
@@ -1094,8 +1110,9 @@ export declare class File {
|
|
|
1094
1110
|
*/
|
|
1095
1111
|
export declare class Group {
|
|
1096
1112
|
|
|
1097
|
-
accounts: Set<Account>;
|
|
1098
1113
|
|
|
1114
|
+
|
|
1115
|
+
constructor(book: Book, json?: bkper.Group);
|
|
1099
1116
|
/**
|
|
1100
1117
|
*
|
|
1101
1118
|
* @returns The wrapped plain json object
|
|
@@ -1104,21 +1121,21 @@ export declare class Group {
|
|
|
1104
1121
|
/**
|
|
1105
1122
|
* @returns The id of this Group
|
|
1106
1123
|
*/
|
|
1107
|
-
getId(): string;
|
|
1124
|
+
getId(): string | undefined;
|
|
1108
1125
|
/**
|
|
1109
1126
|
* @returns The parent Group
|
|
1110
1127
|
*/
|
|
1111
|
-
getParent(): Promise<Group>;
|
|
1128
|
+
getParent(): Promise<Group | undefined>;
|
|
1112
1129
|
/**
|
|
1113
1130
|
* Sets the parent Group.
|
|
1114
1131
|
*
|
|
1115
1132
|
* @returns This Group, for chainning.
|
|
1116
1133
|
*/
|
|
1117
|
-
setParent(group: Group | null): Group;
|
|
1134
|
+
setParent(group: Group | null | undefined): Group;
|
|
1118
1135
|
/**
|
|
1119
1136
|
* @returns The name of this Group
|
|
1120
1137
|
*/
|
|
1121
|
-
getName(): string;
|
|
1138
|
+
getName(): string | undefined;
|
|
1122
1139
|
/**
|
|
1123
1140
|
* Sets the name of the Group.
|
|
1124
1141
|
*
|
|
@@ -1136,7 +1153,7 @@ export declare class Group {
|
|
|
1136
1153
|
/**
|
|
1137
1154
|
* @returns True if this group has any account in it
|
|
1138
1155
|
*/
|
|
1139
|
-
hasAccounts(): boolean;
|
|
1156
|
+
hasAccounts(): boolean | undefined;
|
|
1140
1157
|
/**
|
|
1141
1158
|
* @returns The type for of the accounts of this group. Null if mixed
|
|
1142
1159
|
*/
|
|
@@ -1162,14 +1179,14 @@ export declare class Group {
|
|
|
1162
1179
|
*
|
|
1163
1180
|
* @param keys - The property key
|
|
1164
1181
|
*/
|
|
1165
|
-
getProperty(...keys: string[]): string;
|
|
1182
|
+
getProperty(...keys: string[]): string | undefined;
|
|
1166
1183
|
/**
|
|
1167
1184
|
* Sets a custom property in the Group.
|
|
1168
1185
|
*
|
|
1169
1186
|
* @param key - The property key
|
|
1170
1187
|
* @param value - The property value
|
|
1171
1188
|
*/
|
|
1172
|
-
setProperty(key: string, value: string): Group;
|
|
1189
|
+
setProperty(key: string, value: string | null): Group;
|
|
1173
1190
|
/**
|
|
1174
1191
|
* Delete a custom property
|
|
1175
1192
|
*
|
|
@@ -1181,7 +1198,7 @@ export declare class Group {
|
|
|
1181
1198
|
/**
|
|
1182
1199
|
* Tell if the Group is hidden on main transactions menu
|
|
1183
1200
|
*/
|
|
1184
|
-
isHidden(): boolean;
|
|
1201
|
+
isHidden(): boolean | undefined;
|
|
1185
1202
|
/**
|
|
1186
1203
|
* Hide/Show group on main menu.
|
|
1187
1204
|
*/
|
|
@@ -1207,7 +1224,7 @@ export declare class Group {
|
|
|
1207
1224
|
*/
|
|
1208
1225
|
export declare class Integration {
|
|
1209
1226
|
|
|
1210
|
-
constructor(json
|
|
1227
|
+
constructor(json?: bkper.Integration);
|
|
1211
1228
|
/**
|
|
1212
1229
|
* Gets the wrapped plain json object of the Integration.
|
|
1213
1230
|
*
|
|
@@ -1219,19 +1236,19 @@ export declare class Integration {
|
|
|
1219
1236
|
*
|
|
1220
1237
|
* @returns The Integration's Book id
|
|
1221
1238
|
*/
|
|
1222
|
-
getBookId(): string;
|
|
1239
|
+
getBookId(): string | undefined;
|
|
1223
1240
|
/**
|
|
1224
1241
|
* Gets the id of the Integration.
|
|
1225
1242
|
*
|
|
1226
1243
|
* @returns This Integration's id
|
|
1227
1244
|
*/
|
|
1228
|
-
getId(): string;
|
|
1245
|
+
getId(): string | undefined;
|
|
1229
1246
|
/**
|
|
1230
1247
|
* Gets the name of the Integration.
|
|
1231
1248
|
*
|
|
1232
1249
|
* @returns The Integration's name
|
|
1233
1250
|
*/
|
|
1234
|
-
getName(): string;
|
|
1251
|
+
getName(): string | undefined;
|
|
1235
1252
|
/**
|
|
1236
1253
|
* Gets the custom properties stored in the Integration.
|
|
1237
1254
|
*
|
|
@@ -1257,7 +1274,7 @@ export declare class Integration {
|
|
|
1257
1274
|
*
|
|
1258
1275
|
* @returns The retrieved property value
|
|
1259
1276
|
*/
|
|
1260
|
-
getProperty(...keys: string[]): string;
|
|
1277
|
+
getProperty(...keys: string[]): string | undefined;
|
|
1261
1278
|
/**
|
|
1262
1279
|
* Sets a custom property in the Integration.
|
|
1263
1280
|
*
|
|
@@ -1266,7 +1283,7 @@ export declare class Integration {
|
|
|
1266
1283
|
*
|
|
1267
1284
|
* @returns The Integration, for chaining
|
|
1268
1285
|
*/
|
|
1269
|
-
setProperty(key: string, value: string): Integration;
|
|
1286
|
+
setProperty(key: string, value: string | null): Integration;
|
|
1270
1287
|
/**
|
|
1271
1288
|
* Deletes a custom property stored in the Integration.
|
|
1272
1289
|
*
|
|
@@ -1382,6 +1399,7 @@ export declare enum Permission {
|
|
|
1382
1399
|
export declare class Transaction {
|
|
1383
1400
|
|
|
1384
1401
|
|
|
1402
|
+
constructor(book: Book, json?: bkper.Transaction);
|
|
1385
1403
|
/**
|
|
1386
1404
|
*
|
|
1387
1405
|
* @returns The wrapped plain json object
|
|
@@ -1390,11 +1408,11 @@ export declare class Transaction {
|
|
|
1390
1408
|
/**
|
|
1391
1409
|
* @returns The id of the Transaction.
|
|
1392
1410
|
*/
|
|
1393
|
-
getId(): string;
|
|
1411
|
+
getId(): string | undefined;
|
|
1394
1412
|
/**
|
|
1395
1413
|
* @returns The id of the agent that created this transaction
|
|
1396
1414
|
*/
|
|
1397
|
-
getAgentId(): string;
|
|
1415
|
+
getAgentId(): string | undefined;
|
|
1398
1416
|
/**
|
|
1399
1417
|
* Remote ids are used to avoid duplication.
|
|
1400
1418
|
*
|
|
@@ -1412,11 +1430,11 @@ export declare class Transaction {
|
|
|
1412
1430
|
/**
|
|
1413
1431
|
* @returns True if transaction was already posted to the accounts. False if is still a Draft.
|
|
1414
1432
|
*/
|
|
1415
|
-
isPosted(): boolean;
|
|
1433
|
+
isPosted(): boolean | undefined;
|
|
1416
1434
|
/**
|
|
1417
1435
|
* @returns True if transaction is checked.
|
|
1418
1436
|
*/
|
|
1419
|
-
isChecked(): boolean;
|
|
1437
|
+
isChecked(): boolean | undefined;
|
|
1420
1438
|
/**
|
|
1421
1439
|
* Set the check state of the Transaction.
|
|
1422
1440
|
*
|
|
@@ -1428,7 +1446,7 @@ export declare class Transaction {
|
|
|
1428
1446
|
/**
|
|
1429
1447
|
* @returns True if transaction is in trash.
|
|
1430
1448
|
*/
|
|
1431
|
-
isTrashed(): boolean;
|
|
1449
|
+
isTrashed(): boolean | undefined;
|
|
1432
1450
|
/**
|
|
1433
1451
|
* @returns All #hashtags used on the transaction.
|
|
1434
1452
|
*/
|
|
@@ -1493,7 +1511,7 @@ export declare class Transaction {
|
|
|
1493
1511
|
*
|
|
1494
1512
|
* @param keys - The property key
|
|
1495
1513
|
*/
|
|
1496
|
-
getProperty(...keys: string[]): string;
|
|
1514
|
+
getProperty(...keys: string[]): string | undefined;
|
|
1497
1515
|
/**
|
|
1498
1516
|
* Gets the custom properties keys stored in this Transaction.
|
|
1499
1517
|
*/
|
|
@@ -1506,7 +1524,7 @@ export declare class Transaction {
|
|
|
1506
1524
|
*
|
|
1507
1525
|
* @returns This Transaction, for chainning.
|
|
1508
1526
|
*/
|
|
1509
|
-
setProperty(key: string, value: string): Transaction;
|
|
1527
|
+
setProperty(key: string, value: string | null): Transaction;
|
|
1510
1528
|
/**
|
|
1511
1529
|
* Delete a custom property
|
|
1512
1530
|
*
|
|
@@ -1518,11 +1536,11 @@ export declare class Transaction {
|
|
|
1518
1536
|
/**
|
|
1519
1537
|
* @returns The credit account. The same as origin account.
|
|
1520
1538
|
*/
|
|
1521
|
-
getCreditAccount(): Promise<Account>;
|
|
1539
|
+
getCreditAccount(): Promise<Account | undefined>;
|
|
1522
1540
|
/**
|
|
1523
1541
|
* @returns The credit account name.
|
|
1524
1542
|
*/
|
|
1525
|
-
getCreditAccountName(): Promise<string>;
|
|
1543
|
+
getCreditAccountName(): Promise<string | undefined>;
|
|
1526
1544
|
/**
|
|
1527
1545
|
*
|
|
1528
1546
|
* Sets the credit/origin Account of the Transaction. Same as from().
|
|
@@ -1545,11 +1563,11 @@ export declare class Transaction {
|
|
|
1545
1563
|
* @returns The debit account. The same as destination account.
|
|
1546
1564
|
*
|
|
1547
1565
|
*/
|
|
1548
|
-
getDebitAccount(): Promise<Account>;
|
|
1566
|
+
getDebitAccount(): Promise<Account | undefined>;
|
|
1549
1567
|
/**
|
|
1550
1568
|
* @returns The debit account name.
|
|
1551
1569
|
*/
|
|
1552
|
-
getDebitAccountName(): Promise<string>;
|
|
1570
|
+
getDebitAccountName(): Promise<string | undefined>;
|
|
1553
1571
|
/**
|
|
1554
1572
|
*
|
|
1555
1573
|
* Sets the debit/destination Account of the Transaction. Same as to().
|
|
@@ -1571,7 +1589,7 @@ export declare class Transaction {
|
|
|
1571
1589
|
/**
|
|
1572
1590
|
* @returns The amount of the transaction.
|
|
1573
1591
|
*/
|
|
1574
|
-
getAmount(): Amount;
|
|
1592
|
+
getAmount(): Amount | undefined;
|
|
1575
1593
|
/**
|
|
1576
1594
|
*
|
|
1577
1595
|
* Sets the amount of the Transaction.
|
|
@@ -1584,40 +1602,40 @@ export declare class Transaction {
|
|
|
1584
1602
|
*
|
|
1585
1603
|
* @param account - The account object, id or name.
|
|
1586
1604
|
*/
|
|
1587
|
-
getCreditAmount(account: Account | string): Promise<Amount>;
|
|
1605
|
+
getCreditAmount(account: Account | string): Promise<Amount | undefined>;
|
|
1588
1606
|
/**
|
|
1589
1607
|
* Gets the absolute amount of this transaction if the given account is at the debit side, else null.
|
|
1590
1608
|
*
|
|
1591
1609
|
* @param account - The account object, id or name.
|
|
1592
1610
|
*/
|
|
1593
|
-
getDebitAmount(account: Account | string): Promise<Amount>;
|
|
1611
|
+
getDebitAmount(account: Account | string): Promise<Amount | undefined>;
|
|
1594
1612
|
/**
|
|
1595
1613
|
* Gets the [[Account]] at the other side of the transaction given the one in one side.
|
|
1596
1614
|
*
|
|
1597
1615
|
* @param account - The account object, id or name.
|
|
1598
1616
|
*/
|
|
1599
|
-
getOtherAccount(account: Account | string): Promise<Account>;
|
|
1617
|
+
getOtherAccount(account: Account | string): Promise<Account | undefined>;
|
|
1600
1618
|
/**
|
|
1601
1619
|
*
|
|
1602
1620
|
* The account name at the other side of the transaction given the one in one side.
|
|
1603
1621
|
*
|
|
1604
1622
|
* @param account - The account object, id or name.
|
|
1605
1623
|
*/
|
|
1606
|
-
getOtherAccountName(account: string | Account): Promise<string>;
|
|
1624
|
+
getOtherAccountName(account: string | Account): Promise<string | undefined>;
|
|
1607
1625
|
/**
|
|
1608
1626
|
*
|
|
1609
1627
|
* Tell if the given account is credit on the transaction
|
|
1610
1628
|
*
|
|
1611
1629
|
* @param account - The account object
|
|
1612
1630
|
*/
|
|
1613
|
-
isCredit(account
|
|
1631
|
+
isCredit(account?: Account): Promise<boolean>;
|
|
1614
1632
|
/**
|
|
1615
1633
|
*
|
|
1616
1634
|
* Tell if the given account is debit on the transaction
|
|
1617
1635
|
*
|
|
1618
1636
|
* @param account - The account object
|
|
1619
1637
|
*/
|
|
1620
|
-
isDebit(account
|
|
1638
|
+
isDebit(account?: Account): Promise<boolean>;
|
|
1621
1639
|
|
|
1622
1640
|
/**
|
|
1623
1641
|
* @returns The description of this transaction.
|
|
@@ -1633,7 +1651,7 @@ export declare class Transaction {
|
|
|
1633
1651
|
/**
|
|
1634
1652
|
* @returns The Transaction date, in ISO format yyyy-MM-dd.
|
|
1635
1653
|
*/
|
|
1636
|
-
getDate(): string;
|
|
1654
|
+
getDate(): string | undefined;
|
|
1637
1655
|
/**
|
|
1638
1656
|
*
|
|
1639
1657
|
* Sets the date of the Transaction.
|
|
@@ -1648,11 +1666,11 @@ export declare class Transaction {
|
|
|
1648
1666
|
/**
|
|
1649
1667
|
* @returns The Transaction date number, in format YYYYMMDD.
|
|
1650
1668
|
*/
|
|
1651
|
-
getDateValue(): number;
|
|
1669
|
+
getDateValue(): number | undefined;
|
|
1652
1670
|
/**
|
|
1653
1671
|
* @returns The Transaction date, formatted on the date pattern of the [[Book]].
|
|
1654
1672
|
*/
|
|
1655
|
-
getDateFormatted(): string;
|
|
1673
|
+
getDateFormatted(): string | undefined;
|
|
1656
1674
|
/**
|
|
1657
1675
|
* @returns The date the transaction was created.
|
|
1658
1676
|
*/
|
|
@@ -1672,7 +1690,7 @@ export declare class Transaction {
|
|
|
1672
1690
|
*
|
|
1673
1691
|
* @param raw - True to get the raw balance, no matter the credit nature of the [[Account]].
|
|
1674
1692
|
*/
|
|
1675
|
-
getAccountBalance(raw?: boolean): Promise<Amount>;
|
|
1693
|
+
getAccountBalance(raw?: boolean): Promise<Amount | undefined>;
|
|
1676
1694
|
/**
|
|
1677
1695
|
* Perform create new draft transaction.
|
|
1678
1696
|
*/
|
|
@@ -1740,7 +1758,7 @@ export declare class TransactionIterator {
|
|
|
1740
1758
|
*
|
|
1741
1759
|
* Continuation tokens are generally valid short period of time.
|
|
1742
1760
|
*/
|
|
1743
|
-
getContinuationToken(): string;
|
|
1761
|
+
getContinuationToken(): string | undefined;
|
|
1744
1762
|
/**
|
|
1745
1763
|
* Sets a continuation token from previous paused iteration
|
|
1746
1764
|
*/
|
|
@@ -1752,11 +1770,11 @@ export declare class TransactionIterator {
|
|
|
1752
1770
|
/**
|
|
1753
1771
|
* Gets the next transaction in the collection of transactions.
|
|
1754
1772
|
*/
|
|
1755
|
-
next(): Promise<Transaction>;
|
|
1773
|
+
next(): Promise<Transaction | undefined>;
|
|
1756
1774
|
/**
|
|
1757
1775
|
* @returns The account, when filtering by a single account.
|
|
1758
1776
|
*/
|
|
1759
|
-
getAccount(): Promise<Account>;
|
|
1777
|
+
getAccount(): Promise<Account | undefined>;
|
|
1760
1778
|
}
|
|
1761
1779
|
|
|
1762
1780
|
/**
|
|
@@ -1766,25 +1784,25 @@ export declare class TransactionIterator {
|
|
|
1766
1784
|
*/
|
|
1767
1785
|
export declare class User {
|
|
1768
1786
|
|
|
1769
|
-
constructor(
|
|
1787
|
+
constructor(json?: bkper.User);
|
|
1770
1788
|
/**
|
|
1771
1789
|
* Gets the id of the User.
|
|
1772
1790
|
*
|
|
1773
1791
|
* @returns The User's id
|
|
1774
1792
|
*/
|
|
1775
|
-
getId(): string;
|
|
1793
|
+
getId(): string | undefined;
|
|
1776
1794
|
/**
|
|
1777
1795
|
* Gets the name of the User.
|
|
1778
1796
|
*
|
|
1779
1797
|
* @returns The User's name
|
|
1780
1798
|
*/
|
|
1781
|
-
getName(): string;
|
|
1799
|
+
getName(): string | undefined;
|
|
1782
1800
|
/**
|
|
1783
1801
|
* Gets the full name of the User.
|
|
1784
1802
|
*
|
|
1785
1803
|
* @returns The User's full name
|
|
1786
1804
|
*/
|
|
1787
|
-
getFullName(): string;
|
|
1805
|
+
getFullName(): string | undefined;
|
|
1788
1806
|
/**
|
|
1789
1807
|
* Gets the [[Connections]] of the User.
|
|
1790
1808
|
*
|