bkper-js 2.14.0 → 2.15.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 +2 -0
- package/lib/index.d.ts +22 -14
- package/lib/model/Account.js +1 -1
- package/lib/model/Book.js +14 -1
- package/lib/model/Connection.js +1 -1
- package/lib/model/File.js +1 -1
- package/lib/model/Group.js +1 -1
- package/lib/model/Integration.js +1 -1
- package/lib/model/Transaction.js +2 -2
- package/lib/service/book-service.js +6 -0
- package/lib/tsdoc-metadata.json +1 -1
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -8,6 +8,8 @@ See what's new and what has changed in bkper-js
|
|
|
8
8
|
|
|
9
9
|
- Files attached to transactions are now created internally when transaction is persisted
|
|
10
10
|
- Added `Transaction.removeFile`
|
|
11
|
+
- Added `Book.countTransactions`
|
|
12
|
+
- Added `Book.remove`
|
|
11
13
|
|
|
12
14
|
**September 2025**
|
|
13
15
|
|
package/lib/index.d.ts
CHANGED
|
@@ -95,11 +95,11 @@ export declare class Account extends Resource<bkper.Account> {
|
|
|
95
95
|
* Sets a custom property in the Account.
|
|
96
96
|
*
|
|
97
97
|
* @param key - The property key
|
|
98
|
-
* @param value - The property value
|
|
98
|
+
* @param value - The property value, or null/undefined to clean it
|
|
99
99
|
*
|
|
100
100
|
* @returns This Account, for chaining
|
|
101
101
|
*/
|
|
102
|
-
setProperty(key: string, value: string | null): Account;
|
|
102
|
+
setProperty(key: string, value: string | null | undefined): Account;
|
|
103
103
|
/**
|
|
104
104
|
* Deletes a custom property.
|
|
105
105
|
*
|
|
@@ -1578,11 +1578,11 @@ export declare class Book extends Resource<bkper.Book> {
|
|
|
1578
1578
|
* Sets a custom property in the Book.
|
|
1579
1579
|
*
|
|
1580
1580
|
* @param key - The property key
|
|
1581
|
-
* @param value - The property value
|
|
1581
|
+
* @param value - The property value, or null/undefined to clean it
|
|
1582
1582
|
*
|
|
1583
1583
|
* @returns This Book, for chaining
|
|
1584
1584
|
*/
|
|
1585
|
-
setProperty(key: string, value: string | null): Book;
|
|
1585
|
+
setProperty(key: string, value: string | null | undefined): Book;
|
|
1586
1586
|
/**
|
|
1587
1587
|
* Formats a date according to date pattern of the Book.
|
|
1588
1588
|
*
|
|
@@ -1909,6 +1909,14 @@ export declare class Book extends Resource<bkper.Book> {
|
|
|
1909
1909
|
* @returns The updated Book object
|
|
1910
1910
|
*/
|
|
1911
1911
|
update(): Promise<Book>;
|
|
1912
|
+
/**
|
|
1913
|
+
* Warning!
|
|
1914
|
+
*
|
|
1915
|
+
* Deletes this Book and all its data (transactions, accounts, groups). Book owner only.
|
|
1916
|
+
*
|
|
1917
|
+
* @returns This Book after deletion
|
|
1918
|
+
*/
|
|
1919
|
+
remove(): Promise<Book>;
|
|
1912
1920
|
/**
|
|
1913
1921
|
* Create a [[BalancesReport]] based on query.
|
|
1914
1922
|
*
|
|
@@ -2344,11 +2352,11 @@ export declare class Connection extends Resource<bkper.Connection> {
|
|
|
2344
2352
|
* Sets a custom property in the Connection.
|
|
2345
2353
|
*
|
|
2346
2354
|
* @param key - The property key
|
|
2347
|
-
* @param value - The property value
|
|
2355
|
+
* @param value - The property value, or null/undefined to clean it
|
|
2348
2356
|
*
|
|
2349
2357
|
* @returns The Connection, for chaining
|
|
2350
2358
|
*/
|
|
2351
|
-
setProperty(key: string, value: string | null): Connection;
|
|
2359
|
+
setProperty(key: string, value: string | null | undefined): Connection;
|
|
2352
2360
|
/**
|
|
2353
2361
|
* Deletes a custom property stored in the Connection.
|
|
2354
2362
|
*
|
|
@@ -2651,11 +2659,11 @@ export declare class File extends Resource<bkper.File> {
|
|
|
2651
2659
|
* Sets a custom property in the File.
|
|
2652
2660
|
*
|
|
2653
2661
|
* @param key - The property key
|
|
2654
|
-
* @param value - The property value
|
|
2662
|
+
* @param value - The property value, or null/undefined to clean it
|
|
2655
2663
|
*
|
|
2656
2664
|
* @returns This File, for chaining
|
|
2657
2665
|
*/
|
|
2658
|
-
setProperty(key: string, value: string | null): File;
|
|
2666
|
+
setProperty(key: string, value: string | null | undefined): File;
|
|
2659
2667
|
/**
|
|
2660
2668
|
* Deletes a custom property.
|
|
2661
2669
|
*
|
|
@@ -2778,11 +2786,11 @@ export declare class Group extends Resource<bkper.Group> {
|
|
|
2778
2786
|
* Sets a custom property in the Group.
|
|
2779
2787
|
*
|
|
2780
2788
|
* @param key - The property key
|
|
2781
|
-
* @param value - The property value
|
|
2789
|
+
* @param value - The property value, or null/undefined to clean it
|
|
2782
2790
|
*
|
|
2783
2791
|
* @returns This Group, for chaining
|
|
2784
2792
|
*/
|
|
2785
|
-
setProperty(key: string, value: string | null): Group;
|
|
2793
|
+
setProperty(key: string, value: string | null | undefined): Group;
|
|
2786
2794
|
/**
|
|
2787
2795
|
* Delete a custom property
|
|
2788
2796
|
*
|
|
@@ -3029,11 +3037,11 @@ export declare class Integration extends Resource<bkper.Integration> {
|
|
|
3029
3037
|
* Sets a custom property in the Integration.
|
|
3030
3038
|
*
|
|
3031
3039
|
* @param key - The property key
|
|
3032
|
-
* @param value - The property value
|
|
3040
|
+
* @param value - The property value, or null/undefined to clean it
|
|
3033
3041
|
*
|
|
3034
3042
|
* @returns The Integration, for chaining
|
|
3035
3043
|
*/
|
|
3036
|
-
setProperty(key: string, value: string | null): Integration;
|
|
3044
|
+
setProperty(key: string, value: string | null | undefined): Integration;
|
|
3037
3045
|
/**
|
|
3038
3046
|
* Deletes a custom property stored in the Integration.
|
|
3039
3047
|
*
|
|
@@ -3487,11 +3495,11 @@ export declare class Transaction extends Resource<bkper.Transaction> {
|
|
|
3487
3495
|
* Sets a custom property in the Transaction.
|
|
3488
3496
|
*
|
|
3489
3497
|
* @param key - The property key
|
|
3490
|
-
* @param value - The property value
|
|
3498
|
+
* @param value - The property value, or null/undefined to clean it
|
|
3491
3499
|
*
|
|
3492
3500
|
* @returns This Transaction, for chaining
|
|
3493
3501
|
*/
|
|
3494
|
-
setProperty(key: string, value: string | null): Transaction;
|
|
3502
|
+
setProperty(key: string, value: string | null | undefined): Transaction;
|
|
3495
3503
|
/**
|
|
3496
3504
|
* Delete a custom property
|
|
3497
3505
|
*
|
package/lib/model/Account.js
CHANGED
|
@@ -137,7 +137,7 @@ export class Account extends Resource {
|
|
|
137
137
|
* Sets a custom property in the Account.
|
|
138
138
|
*
|
|
139
139
|
* @param key - The property key
|
|
140
|
-
* @param value - The property value
|
|
140
|
+
* @param value - The property value, or null/undefined to clean it
|
|
141
141
|
*
|
|
142
142
|
* @returns This Account, for chaining
|
|
143
143
|
*/
|
package/lib/model/Book.js
CHANGED
|
@@ -420,7 +420,7 @@ export class Book extends Resource {
|
|
|
420
420
|
* Sets a custom property in the Book.
|
|
421
421
|
*
|
|
422
422
|
* @param key - The property key
|
|
423
|
-
* @param value - The property value
|
|
423
|
+
* @param value - The property value, or null/undefined to clean it
|
|
424
424
|
*
|
|
425
425
|
* @returns This Book, for chaining
|
|
426
426
|
*/
|
|
@@ -1172,6 +1172,19 @@ export class Book extends Resource {
|
|
|
1172
1172
|
return this;
|
|
1173
1173
|
});
|
|
1174
1174
|
}
|
|
1175
|
+
/**
|
|
1176
|
+
* Warning!
|
|
1177
|
+
*
|
|
1178
|
+
* Deletes this Book and all its data (transactions, accounts, groups). Book owner only.
|
|
1179
|
+
*
|
|
1180
|
+
* @returns This Book after deletion
|
|
1181
|
+
*/
|
|
1182
|
+
remove() {
|
|
1183
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
1184
|
+
this.payload = yield BookService.deleteBook(this.getId(), this.getConfig());
|
|
1185
|
+
return this;
|
|
1186
|
+
});
|
|
1187
|
+
}
|
|
1175
1188
|
/**
|
|
1176
1189
|
* Create a [[BalancesReport]] based on query.
|
|
1177
1190
|
*
|
package/lib/model/Connection.js
CHANGED
|
@@ -174,7 +174,7 @@ export class Connection extends Resource {
|
|
|
174
174
|
* Sets a custom property in the Connection.
|
|
175
175
|
*
|
|
176
176
|
* @param key - The property key
|
|
177
|
-
* @param value - The property value
|
|
177
|
+
* @param value - The property value, or null/undefined to clean it
|
|
178
178
|
*
|
|
179
179
|
* @returns The Connection, for chaining
|
|
180
180
|
*/
|
package/lib/model/File.js
CHANGED
|
@@ -165,7 +165,7 @@ export class File extends Resource {
|
|
|
165
165
|
* Sets a custom property in the File.
|
|
166
166
|
*
|
|
167
167
|
* @param key - The property key
|
|
168
|
-
* @param value - The property value
|
|
168
|
+
* @param value - The property value, or null/undefined to clean it
|
|
169
169
|
*
|
|
170
170
|
* @returns This File, for chaining
|
|
171
171
|
*/
|
package/lib/model/Group.js
CHANGED
|
@@ -180,7 +180,7 @@ export class Group extends Resource {
|
|
|
180
180
|
* Sets a custom property in the Group.
|
|
181
181
|
*
|
|
182
182
|
* @param key - The property key
|
|
183
|
-
* @param value - The property value
|
|
183
|
+
* @param value - The property value, or null/undefined to clean it
|
|
184
184
|
*
|
|
185
185
|
* @returns This Group, for chaining
|
|
186
186
|
*/
|
package/lib/model/Integration.js
CHANGED
|
@@ -147,7 +147,7 @@ export class Integration extends Resource {
|
|
|
147
147
|
* Sets a custom property in the Integration.
|
|
148
148
|
*
|
|
149
149
|
* @param key - The property key
|
|
150
|
-
* @param value - The property value
|
|
150
|
+
* @param value - The property value, or null/undefined to clean it
|
|
151
151
|
*
|
|
152
152
|
* @returns The Integration, for chaining
|
|
153
153
|
*/
|
package/lib/model/Transaction.js
CHANGED
|
@@ -371,7 +371,7 @@ export class Transaction extends Resource {
|
|
|
371
371
|
* Sets a custom property in the Transaction.
|
|
372
372
|
*
|
|
373
373
|
* @param key - The property key
|
|
374
|
-
* @param value - The property value
|
|
374
|
+
* @param value - The property value, or null/undefined to clean it
|
|
375
375
|
*
|
|
376
376
|
* @returns This Transaction, for chaining
|
|
377
377
|
*/
|
|
@@ -713,7 +713,7 @@ export class Transaction extends Resource {
|
|
|
713
713
|
let dateObject = Utils.parseDate(date, this.book.getDatePattern(), this.book.getTimeZone());
|
|
714
714
|
this.payload.date = Utils.formatDateISO(dateObject, this.book.getTimeZone());
|
|
715
715
|
}
|
|
716
|
-
else if (date.indexOf("-")) {
|
|
716
|
+
else if (date.indexOf("-") >= 0) {
|
|
717
717
|
this.payload.date = date;
|
|
718
718
|
}
|
|
719
719
|
}
|
|
@@ -74,4 +74,10 @@ export function copyBook(bookId, name, copyTransactions, fromDate, config) {
|
|
|
74
74
|
return response.data;
|
|
75
75
|
});
|
|
76
76
|
}
|
|
77
|
+
export function deleteBook(bookId, config) {
|
|
78
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
79
|
+
const response = yield new HttpBooksApiV5Request(`${bookId}`, config).setMethod('DELETE').fetch();
|
|
80
|
+
return response.data;
|
|
81
|
+
});
|
|
82
|
+
}
|
|
77
83
|
//# sourceMappingURL=book-service.js.map
|
package/lib/tsdoc-metadata.json
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "bkper-js",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.15.0",
|
|
4
4
|
"description": "Javascript client for Bkper REST API",
|
|
5
5
|
"main": "./lib/index.js",
|
|
6
6
|
"module": "./lib/index.js",
|
|
@@ -35,7 +35,7 @@
|
|
|
35
35
|
"postversion": "git push --tags && yarn publish --new-version $npm_package_version && git push && echo \"Successfully released version $npm_package_version!\""
|
|
36
36
|
},
|
|
37
37
|
"peerDependencies": {
|
|
38
|
-
"@bkper/bkper-api-types": "^5.
|
|
38
|
+
"@bkper/bkper-api-types": "^5.30.0"
|
|
39
39
|
},
|
|
40
40
|
"dependencies": {
|
|
41
41
|
"big.js": "^6.0.3",
|