bkper-js 1.47.2 → 1.47.3
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 +882 -357
- package/lib/model/Account.js +86 -42
- package/lib/model/Agent.js +6 -0
- package/lib/model/Amount.js +72 -13
- package/lib/model/App.js +77 -26
- package/lib/model/BalancesReport.js +11 -5
- package/lib/model/Bkper.js +2 -2
- package/lib/model/Book.js +164 -94
- package/lib/model/BotResponse.js +13 -3
- package/lib/model/Collection.js +16 -2
- package/lib/model/Connection.js +8 -6
- package/lib/model/Conversation.js +9 -2
- package/lib/model/Event.js +18 -0
- package/lib/model/EventList.js +10 -5
- package/lib/model/File.js +31 -12
- package/lib/model/Group.js +75 -33
- package/lib/model/Integration.js +4 -2
- package/lib/model/Message.js +18 -5
- package/lib/model/Query.js +18 -4
- package/lib/model/Template.js +2 -0
- package/lib/model/Transaction.js +165 -81
- package/lib/model/TransactionList.js +14 -7
- package/lib/model/User.js +7 -1
- package/package.json +1 -1
package/lib/model/Book.js
CHANGED
|
@@ -30,8 +30,7 @@ import { BalancesReport } from './BalancesReport.js';
|
|
|
30
30
|
import { App } from './App.js';
|
|
31
31
|
import { Query } from './Query.js';
|
|
32
32
|
/**
|
|
33
|
-
*
|
|
34
|
-
* A Book represents [General Ledger](https://en.wikipedia.org/wiki/General_ledger) for a company or business, but can also represent a [Ledger](https://en.wikipedia.org/wiki/Ledger) for a project or department
|
|
33
|
+
* A Book represents a [General Ledger](https://en.wikipedia.org/wiki/General_ledger) for a company or business, but can also represent a [Ledger](https://en.wikipedia.org/wiki/Ledger) for a project or department
|
|
35
34
|
*
|
|
36
35
|
* It contains all [[Accounts]] where [[Transactions]] are recorded/posted;
|
|
37
36
|
*
|
|
@@ -48,114 +47,144 @@ export class Book {
|
|
|
48
47
|
this.mapAccounts(this.payload.accounts);
|
|
49
48
|
}
|
|
50
49
|
/**
|
|
51
|
-
*
|
|
50
|
+
* Gets an immutable copy of the JSON payload for this Book.
|
|
51
|
+
*
|
|
52
|
+
* @returns An immutable copy of the JSON payload
|
|
52
53
|
*/
|
|
53
54
|
json() {
|
|
54
55
|
return Object.assign({}, this.payload);
|
|
55
56
|
}
|
|
56
57
|
/**
|
|
57
|
-
*
|
|
58
|
+
* Gets the unique identifier of this Book.
|
|
59
|
+
*
|
|
60
|
+
* @returns This Book's unique identifier
|
|
58
61
|
*/
|
|
59
62
|
getId() {
|
|
60
63
|
return this.payload.id || '';
|
|
61
64
|
}
|
|
62
65
|
/**
|
|
66
|
+
* Gets the name of this Book.
|
|
67
|
+
*
|
|
63
68
|
* @returns The name of this Book
|
|
64
69
|
*/
|
|
65
70
|
getName() {
|
|
66
71
|
return this.payload.name;
|
|
67
72
|
}
|
|
68
73
|
/**
|
|
69
|
-
*
|
|
70
74
|
* Sets the name of the Book.
|
|
71
75
|
*
|
|
72
|
-
* @
|
|
76
|
+
* @param name - The name to set
|
|
77
|
+
*
|
|
78
|
+
* @returns This Book, for chaining
|
|
73
79
|
*/
|
|
74
80
|
setName(name) {
|
|
75
81
|
this.payload.name = name;
|
|
76
82
|
return this;
|
|
77
83
|
}
|
|
78
84
|
/**
|
|
85
|
+
* Gets the number of fraction digits supported by this Book.
|
|
86
|
+
*
|
|
79
87
|
* @returns The number of fraction digits supported by this Book. Same as getDecimalPlaces
|
|
80
88
|
*/
|
|
81
89
|
getFractionDigits() {
|
|
82
90
|
return this.payload.fractionDigits;
|
|
83
91
|
}
|
|
84
92
|
/**
|
|
93
|
+
* Gets the number of decimal places supported by this Book.
|
|
94
|
+
*
|
|
85
95
|
* @returns The number of decimal places supported by this Book. Same as getFractionDigits
|
|
86
96
|
*/
|
|
87
97
|
getDecimalPlaces() {
|
|
88
98
|
return this.getFractionDigits();
|
|
89
99
|
}
|
|
90
100
|
/**
|
|
101
|
+
* Sets the number of fraction digits (decimal places) supported by this Book.
|
|
91
102
|
*
|
|
92
|
-
*
|
|
103
|
+
* @param fractionDigits - The number of fraction digits to set (0 to 8)
|
|
93
104
|
*
|
|
94
|
-
* @returns This Book, for
|
|
105
|
+
* @returns This Book, for chaining
|
|
95
106
|
*/
|
|
96
107
|
setFractionDigits(fractionDigits) {
|
|
97
108
|
this.payload.fractionDigits = fractionDigits;
|
|
98
109
|
return this;
|
|
99
110
|
}
|
|
100
111
|
/**
|
|
112
|
+
* Gets the period slice for balances visualization.
|
|
113
|
+
*
|
|
101
114
|
* @returns The period slice for balances visualization
|
|
102
115
|
*/
|
|
103
116
|
getPeriod() {
|
|
104
117
|
return this.payload.period;
|
|
105
118
|
}
|
|
106
119
|
/**
|
|
107
|
-
* Sets the period slice for balances visualization
|
|
120
|
+
* Sets the period slice for balances visualization.
|
|
121
|
+
*
|
|
122
|
+
* @param period - The period to set
|
|
108
123
|
*
|
|
109
|
-
* @returns This Book, for
|
|
124
|
+
* @returns This Book, for chaining
|
|
110
125
|
*/
|
|
111
126
|
setPeriod(period) {
|
|
112
127
|
this.payload.period = period;
|
|
113
128
|
return this;
|
|
114
129
|
}
|
|
115
130
|
/**
|
|
116
|
-
*
|
|
131
|
+
* Gets the start month when YEAR period is set.
|
|
132
|
+
*
|
|
133
|
+
* @returns The start month when YEAR period is set
|
|
117
134
|
*/
|
|
118
135
|
getPeriodStartMonth() {
|
|
119
136
|
return this.payload.periodStartMonth;
|
|
120
137
|
}
|
|
121
138
|
/**
|
|
122
|
-
* Sets the start month when YEAR period set
|
|
139
|
+
* Sets the start month when YEAR period is set.
|
|
140
|
+
*
|
|
141
|
+
* @param month - The start month to set
|
|
123
142
|
*
|
|
124
|
-
* @returns This Book, for
|
|
143
|
+
* @returns This Book, for chaining
|
|
125
144
|
*/
|
|
126
145
|
setPeriodStartMonth(month) {
|
|
127
146
|
this.payload.periodStartMonth = month;
|
|
128
147
|
return this;
|
|
129
148
|
}
|
|
130
149
|
/**
|
|
150
|
+
* Gets the transactions pagination page size.
|
|
151
|
+
*
|
|
131
152
|
* @returns The transactions pagination page size
|
|
132
153
|
*/
|
|
133
154
|
getPageSize() {
|
|
134
155
|
return this.payload.pageSize;
|
|
135
156
|
}
|
|
136
157
|
/**
|
|
137
|
-
* Sets the transactions pagination page size
|
|
158
|
+
* Sets the transactions pagination page size.
|
|
159
|
+
*
|
|
160
|
+
* @param pageSize - The page size to set
|
|
138
161
|
*
|
|
139
|
-
* @returns This Book, for
|
|
162
|
+
* @returns This Book, for chaining
|
|
140
163
|
*/
|
|
141
164
|
setPageSize(pageSize) {
|
|
142
165
|
this.payload.pageSize = pageSize;
|
|
143
166
|
return this;
|
|
144
167
|
}
|
|
145
168
|
/**
|
|
169
|
+
* Gets the name of the owner of the Book.
|
|
170
|
+
*
|
|
146
171
|
* @returns The name of the owner of the Book
|
|
147
172
|
*/
|
|
148
173
|
getOwnerName() {
|
|
149
174
|
return this.payload.ownerName;
|
|
150
175
|
}
|
|
151
176
|
/**
|
|
152
|
-
*
|
|
177
|
+
* Gets the permission for the current user in this Book.
|
|
178
|
+
*
|
|
179
|
+
* @returns The permission for the current user in this Book
|
|
153
180
|
*/
|
|
154
181
|
getPermission() {
|
|
155
182
|
return this.payload.permission;
|
|
156
183
|
}
|
|
157
184
|
/**
|
|
158
|
-
*
|
|
185
|
+
* Gets the collection of this Book, if any.
|
|
186
|
+
*
|
|
187
|
+
* @returns The collection of this Book, if any
|
|
159
188
|
*/
|
|
160
189
|
getCollection() {
|
|
161
190
|
if (this.payload.collection != null && this.collection == null) {
|
|
@@ -164,32 +193,34 @@ export class Book {
|
|
|
164
193
|
return this.collection;
|
|
165
194
|
}
|
|
166
195
|
/**
|
|
196
|
+
* Gets the date pattern of the Book.
|
|
197
|
+
*
|
|
167
198
|
* @returns The date pattern of the Book. Current: dd/MM/yyyy | MM/dd/yyyy | yyyy/MM/dd
|
|
168
199
|
*/
|
|
169
200
|
getDatePattern() {
|
|
170
201
|
return this.payload.datePattern;
|
|
171
202
|
}
|
|
172
203
|
/**
|
|
173
|
-
*
|
|
174
204
|
* Sets the date pattern of the Book. Current: dd/MM/yyyy | MM/dd/yyyy | yyyy/MM/dd
|
|
175
205
|
*
|
|
176
|
-
* @returns This Book, for
|
|
206
|
+
* @returns This Book, for chaining
|
|
177
207
|
*/
|
|
178
208
|
setDatePattern(datePattern) {
|
|
179
209
|
this.payload.datePattern = datePattern;
|
|
180
210
|
return this;
|
|
181
211
|
}
|
|
182
212
|
/**
|
|
213
|
+
* Gets the lock date of the Book in ISO format yyyy-MM-dd.
|
|
214
|
+
*
|
|
183
215
|
* @returns The lock date of the Book in ISO format yyyy-MM-dd
|
|
184
216
|
*/
|
|
185
217
|
getLockDate() {
|
|
186
218
|
return this.payload.lockDate;
|
|
187
219
|
}
|
|
188
220
|
/**
|
|
189
|
-
*
|
|
190
221
|
* Sets the lock date of the Book in ISO format yyyy-MM-dd.
|
|
191
222
|
*
|
|
192
|
-
* @returns This Book, for
|
|
223
|
+
* @returns This Book, for chaining
|
|
193
224
|
*/
|
|
194
225
|
setLockDate(lockDate) {
|
|
195
226
|
if (lockDate == null) {
|
|
@@ -199,16 +230,17 @@ export class Book {
|
|
|
199
230
|
return this;
|
|
200
231
|
}
|
|
201
232
|
/**
|
|
233
|
+
* Gets the closing date of the Book in ISO format yyyy-MM-dd.
|
|
234
|
+
*
|
|
202
235
|
* @returns The closing date of the Book in ISO format yyyy-MM-dd
|
|
203
236
|
*/
|
|
204
237
|
getClosingDate() {
|
|
205
238
|
return this.payload.closingDate;
|
|
206
239
|
}
|
|
207
240
|
/**
|
|
208
|
-
*
|
|
209
241
|
* Sets the closing date of the Book in ISO format yyyy-MM-dd.
|
|
210
242
|
*
|
|
211
|
-
* @returns This Book, for
|
|
243
|
+
* @returns This Book, for chaining
|
|
212
244
|
*/
|
|
213
245
|
setClosingDate(closingDate) {
|
|
214
246
|
if (closingDate == null) {
|
|
@@ -218,99 +250,118 @@ export class Book {
|
|
|
218
250
|
return this;
|
|
219
251
|
}
|
|
220
252
|
/**
|
|
253
|
+
* Gets the decimal separator of the Book.
|
|
254
|
+
*
|
|
221
255
|
* @returns The decimal separator of the Book
|
|
222
256
|
*/
|
|
223
257
|
getDecimalSeparator() {
|
|
224
258
|
return this.payload.decimalSeparator;
|
|
225
259
|
}
|
|
226
260
|
/**
|
|
227
|
-
*
|
|
228
261
|
* Sets the decimal separator of the Book
|
|
229
262
|
*
|
|
230
|
-
* @returns This Book, for
|
|
263
|
+
* @returns This Book, for chaining
|
|
231
264
|
*/
|
|
232
265
|
setDecimalSeparator(decimalSeparator) {
|
|
233
266
|
this.payload.decimalSeparator = decimalSeparator;
|
|
234
267
|
return this;
|
|
235
268
|
}
|
|
236
269
|
/**
|
|
270
|
+
* Gets the time zone of the Book.
|
|
271
|
+
*
|
|
237
272
|
* @returns The time zone of the Book
|
|
238
273
|
*/
|
|
239
274
|
getTimeZone() {
|
|
240
275
|
return this.payload.timeZone;
|
|
241
276
|
}
|
|
242
277
|
/**
|
|
278
|
+
* Sets the time zone of the Book.
|
|
243
279
|
*
|
|
244
|
-
*
|
|
245
|
-
*
|
|
246
|
-
* @returns This Book, for chainning.
|
|
280
|
+
* @returns This Book, for chaining
|
|
247
281
|
*/
|
|
248
282
|
setTimeZone(timeZone) {
|
|
249
283
|
this.payload.timeZone = timeZone;
|
|
250
284
|
return this;
|
|
251
285
|
}
|
|
252
286
|
/**
|
|
287
|
+
* Gets the time zone offset of the book, in minutes.
|
|
288
|
+
*
|
|
253
289
|
* @returns The time zone offset of the book, in minutes
|
|
254
290
|
*/
|
|
255
291
|
getTimeZoneOffset() {
|
|
256
292
|
return this.payload.timeZoneOffset;
|
|
257
293
|
}
|
|
258
294
|
/**
|
|
295
|
+
* Gets the auto post status of the Book.
|
|
296
|
+
*
|
|
259
297
|
* @returns The auto post status of the Book
|
|
260
298
|
*/
|
|
261
299
|
getAutoPost() {
|
|
262
300
|
return this.payload.autoPost;
|
|
263
301
|
}
|
|
264
302
|
/**
|
|
303
|
+
* Sets the auto post status of the Book.
|
|
265
304
|
*
|
|
266
|
-
*
|
|
267
|
-
*
|
|
268
|
-
* @returns This Book, for chainning.
|
|
305
|
+
* @returns This Book, for chaining
|
|
269
306
|
*/
|
|
270
307
|
setAutoPost(autoPost) {
|
|
271
308
|
this.payload.autoPost = autoPost;
|
|
272
309
|
return this;
|
|
273
310
|
}
|
|
274
311
|
/**
|
|
275
|
-
*
|
|
312
|
+
* Gets the last update date of the book, in milliseconds.
|
|
313
|
+
*
|
|
314
|
+
* @returns The last update date of the book, in milliseconds
|
|
276
315
|
*/
|
|
277
316
|
getLastUpdateMs() {
|
|
278
317
|
return this.payload.lastUpdateMs ? +this.payload.lastUpdateMs : undefined;
|
|
279
318
|
}
|
|
280
319
|
/**
|
|
320
|
+
* Gets the total number of posted transactions.
|
|
321
|
+
*
|
|
281
322
|
* @returns The total number of posted transactions
|
|
282
323
|
*/
|
|
283
324
|
getTotalTransactions() {
|
|
284
325
|
return this.payload.totalTransactions ? +(this.payload.totalTransactions) : 0;
|
|
285
326
|
}
|
|
286
327
|
/**
|
|
328
|
+
* Gets the total number of posted transactions on current month.
|
|
329
|
+
*
|
|
287
330
|
* @returns The total number of posted transactions on current month
|
|
288
331
|
*/
|
|
289
332
|
getTotalTransactionsCurrentMonth() {
|
|
290
333
|
return this.payload.totalTransactionsCurrentMonth ? +(this.payload.totalTransactionsCurrentMonth) : 0;
|
|
291
334
|
}
|
|
292
335
|
/**
|
|
336
|
+
* Gets the total number of posted transactions on current year.
|
|
337
|
+
*
|
|
293
338
|
* @returns The total number of posted transactions on current year
|
|
294
339
|
*/
|
|
295
340
|
getTotalTransactionsCurrentYear() {
|
|
296
341
|
return this.payload.totalTransactionsCurrentYear ? +(this.payload.totalTransactionsCurrentYear) : 0;
|
|
297
342
|
}
|
|
298
343
|
/**
|
|
344
|
+
* Gets the visibility of the book.
|
|
345
|
+
*
|
|
299
346
|
* @returns The visibility of the book
|
|
300
347
|
*/
|
|
301
348
|
getVisibility() {
|
|
302
349
|
return this.payload.visibility;
|
|
303
350
|
}
|
|
304
351
|
/**
|
|
305
|
-
* Gets the custom properties stored in this Book
|
|
352
|
+
* Gets the custom properties stored in this Book.
|
|
353
|
+
*
|
|
354
|
+
* @returns The custom properties object
|
|
306
355
|
*/
|
|
307
356
|
getProperties() {
|
|
308
357
|
return this.payload.properties != null ? Object.assign({}, this.payload.properties) : {};
|
|
309
358
|
}
|
|
310
359
|
/**
|
|
311
|
-
* Gets the property value for given keys. First property found will be retrieved
|
|
360
|
+
* Gets the property value for given keys. First property found will be retrieved.
|
|
361
|
+
*
|
|
362
|
+
* @param keys - The property keys to search for
|
|
312
363
|
*
|
|
313
|
-
* @
|
|
364
|
+
* @returns The property value or undefined if not found
|
|
314
365
|
*/
|
|
315
366
|
getProperty(...keys) {
|
|
316
367
|
for (let index = 0; index < keys.length; index++) {
|
|
@@ -323,11 +374,11 @@ export class Book {
|
|
|
323
374
|
return undefined;
|
|
324
375
|
}
|
|
325
376
|
/**
|
|
326
|
-
* Sets the custom properties of the Book
|
|
377
|
+
* Sets the custom properties of the Book.
|
|
327
378
|
*
|
|
328
379
|
* @param properties - Object with key/value pair properties
|
|
329
380
|
*
|
|
330
|
-
* @returns This Book, for
|
|
381
|
+
* @returns This Book, for chaining
|
|
331
382
|
*/
|
|
332
383
|
setProperties(properties) {
|
|
333
384
|
this.payload.properties = Object.assign({}, properties);
|
|
@@ -339,7 +390,7 @@ export class Book {
|
|
|
339
390
|
* @param key - The property key
|
|
340
391
|
* @param value - The property value
|
|
341
392
|
*
|
|
342
|
-
* @returns This Book, for
|
|
393
|
+
* @returns This Book, for chaining
|
|
343
394
|
*/
|
|
344
395
|
setProperty(key, value) {
|
|
345
396
|
if (key == null || key.trim() == '') {
|
|
@@ -360,7 +411,7 @@ export class Book {
|
|
|
360
411
|
* @param date - The date to format as string.
|
|
361
412
|
* @param timeZone - The output timezone of the result. Default to script's timeZone
|
|
362
413
|
*
|
|
363
|
-
* @returns The date
|
|
414
|
+
* @returns The formatted date
|
|
364
415
|
*/
|
|
365
416
|
formatDate(date, timeZone) {
|
|
366
417
|
if (timeZone == null || timeZone.trim() == "") {
|
|
@@ -369,9 +420,11 @@ export class Book {
|
|
|
369
420
|
return Utils.formatDate(date, this.getDatePattern(), timeZone);
|
|
370
421
|
}
|
|
371
422
|
/**
|
|
372
|
-
* Parse a date string according to date pattern and timezone of the Book.
|
|
423
|
+
* Parse a date string according to date pattern and timezone of the Book. Also parse ISO yyyy-mm-dd format.
|
|
373
424
|
*
|
|
374
|
-
*
|
|
425
|
+
* @param date - The date string to parse
|
|
426
|
+
*
|
|
427
|
+
* @returns The parsed Date object
|
|
375
428
|
*/
|
|
376
429
|
parseDate(date) {
|
|
377
430
|
return Utils.parseDate(date, this.getDatePattern(), this.getTimeZone());
|
|
@@ -381,7 +434,7 @@ export class Book {
|
|
|
381
434
|
*
|
|
382
435
|
* @param value - The value to be formatted.
|
|
383
436
|
*
|
|
384
|
-
* @returns The value
|
|
437
|
+
* @returns The formatted value
|
|
385
438
|
*/
|
|
386
439
|
formatValue(value) {
|
|
387
440
|
if (!value) {
|
|
@@ -391,16 +444,20 @@ export class Book {
|
|
|
391
444
|
}
|
|
392
445
|
/**
|
|
393
446
|
* Parse a value string according to [[DecimalSeparator]] and fraction digits of the Book.
|
|
447
|
+
*
|
|
448
|
+
* @param value - The value string to parse
|
|
449
|
+
*
|
|
450
|
+
* @returns The parsed Amount or undefined if parsing fails
|
|
394
451
|
*/
|
|
395
452
|
parseValue(value) {
|
|
396
453
|
return Utils.parseValue(value, this.getDecimalSeparator());
|
|
397
454
|
}
|
|
398
455
|
/**
|
|
399
|
-
* Rounds a value according to the number of fraction digits of the Book
|
|
456
|
+
* Rounds a value according to the number of fraction digits of the Book.
|
|
400
457
|
*
|
|
401
458
|
* @param value - The value to be rounded
|
|
402
459
|
*
|
|
403
|
-
* @returns The value
|
|
460
|
+
* @returns The rounded value
|
|
404
461
|
*/
|
|
405
462
|
round(value) {
|
|
406
463
|
return Utils.round(value, this.getFractionDigits());
|
|
@@ -408,7 +465,7 @@ export class Book {
|
|
|
408
465
|
/**
|
|
409
466
|
* Batch create [[Transactions]] on the Book.
|
|
410
467
|
*
|
|
411
|
-
* @param transactions The transactions to be created
|
|
468
|
+
* @param transactions - The transactions to be created
|
|
412
469
|
*
|
|
413
470
|
* @returns The created Transactions
|
|
414
471
|
*/
|
|
@@ -424,8 +481,7 @@ export class Book {
|
|
|
424
481
|
/**
|
|
425
482
|
* Batch post [[Transactions]] on the Book.
|
|
426
483
|
*
|
|
427
|
-
* @param transactions The transactions to be posted
|
|
428
|
-
*
|
|
484
|
+
* @param transactions - The transactions to be posted
|
|
429
485
|
*/
|
|
430
486
|
batchPostTransactions(transactions) {
|
|
431
487
|
return __awaiter(this, void 0, void 0, function* () {
|
|
@@ -437,12 +493,11 @@ export class Book {
|
|
|
437
493
|
/**
|
|
438
494
|
* Batch update [[Transactions]] on the Book.
|
|
439
495
|
*
|
|
440
|
-
* @param transactions The transactions to be updated
|
|
496
|
+
* @param transactions - The transactions to be updated
|
|
441
497
|
*
|
|
442
|
-
* @param updateChecked True to also update checked transactions
|
|
498
|
+
* @param updateChecked - True to also update checked transactions
|
|
443
499
|
*
|
|
444
500
|
* @returns The updated draft Transactions
|
|
445
|
-
*
|
|
446
501
|
*/
|
|
447
502
|
batchUpdateTransactions(transactions, updateChecked) {
|
|
448
503
|
return __awaiter(this, void 0, void 0, function* () {
|
|
@@ -456,8 +511,7 @@ export class Book {
|
|
|
456
511
|
/**
|
|
457
512
|
* Batch check [[Transactions]] on the Book.
|
|
458
513
|
*
|
|
459
|
-
* @param transactions The transactions to be checked
|
|
460
|
-
*
|
|
514
|
+
* @param transactions - The transactions to be checked
|
|
461
515
|
*/
|
|
462
516
|
batchCheckTransactions(transactions) {
|
|
463
517
|
return __awaiter(this, void 0, void 0, function* () {
|
|
@@ -469,8 +523,7 @@ export class Book {
|
|
|
469
523
|
/**
|
|
470
524
|
* Batch uncheck [[Transactions]] on the Book.
|
|
471
525
|
*
|
|
472
|
-
* @param transactions The transactions to be unchecked
|
|
473
|
-
*
|
|
526
|
+
* @param transactions - The transactions to be unchecked
|
|
474
527
|
*/
|
|
475
528
|
batchUncheckTransactions(transactions) {
|
|
476
529
|
return __awaiter(this, void 0, void 0, function* () {
|
|
@@ -482,10 +535,8 @@ export class Book {
|
|
|
482
535
|
/**
|
|
483
536
|
* Batch trash [[Transactions]] on the Book.
|
|
484
537
|
*
|
|
485
|
-
* @param transactions The transactions to be trashed
|
|
486
|
-
*
|
|
487
|
-
* @param trashChecked True to also trash checked transactions
|
|
488
|
-
*
|
|
538
|
+
* @param transactions - The transactions to be trashed
|
|
539
|
+
* @param trashChecked - True to also trash checked transactions
|
|
489
540
|
*/
|
|
490
541
|
batchTrashTransactions(transactions, trashChecked) {
|
|
491
542
|
return __awaiter(this, void 0, void 0, function* () {
|
|
@@ -497,8 +548,7 @@ export class Book {
|
|
|
497
548
|
/**
|
|
498
549
|
* Batch untrash [[Transactions]] on the Book.
|
|
499
550
|
*
|
|
500
|
-
* @param transactions The transactions to be untrashed
|
|
501
|
-
*
|
|
551
|
+
* @param transactions - The transactions to be untrashed
|
|
502
552
|
*/
|
|
503
553
|
batchUntrashTransactions(transactions) {
|
|
504
554
|
return __awaiter(this, void 0, void 0, function* () {
|
|
@@ -509,6 +559,9 @@ export class Book {
|
|
|
509
559
|
}
|
|
510
560
|
/**
|
|
511
561
|
* Replay [[Events]] on the Book, in batch.
|
|
562
|
+
*
|
|
563
|
+
* @param events - The events to be replayed
|
|
564
|
+
* @param errorOnly - True to only replay events with errors
|
|
512
565
|
*/
|
|
513
566
|
batchReplayEvents(events, errorOnly) {
|
|
514
567
|
return __awaiter(this, void 0, void 0, function* () {
|
|
@@ -521,7 +574,9 @@ export class Book {
|
|
|
521
574
|
/**
|
|
522
575
|
* Create [[Accounts]] on the Book, in batch.
|
|
523
576
|
*
|
|
524
|
-
* @
|
|
577
|
+
* @param accounts - The accounts to be created
|
|
578
|
+
*
|
|
579
|
+
* @returns The created Accounts
|
|
525
580
|
*/
|
|
526
581
|
batchCreateAccounts(accounts) {
|
|
527
582
|
return __awaiter(this, void 0, void 0, function* () {
|
|
@@ -543,7 +598,9 @@ export class Book {
|
|
|
543
598
|
/**
|
|
544
599
|
* Create [[Groups]] on the Book, in batch.
|
|
545
600
|
*
|
|
546
|
-
* @
|
|
601
|
+
* @param groups - The groups to be created
|
|
602
|
+
*
|
|
603
|
+
* @returns The created Groups
|
|
547
604
|
*/
|
|
548
605
|
batchCreateGroups(groups) {
|
|
549
606
|
return __awaiter(this, void 0, void 0, function* () {
|
|
@@ -569,9 +626,9 @@ export class Book {
|
|
|
569
626
|
BookService.audit(this.getId());
|
|
570
627
|
}
|
|
571
628
|
/**
|
|
572
|
-
* Retrieve installed [[Apps]] for this Book
|
|
629
|
+
* Retrieve installed [[Apps]] for this Book.
|
|
573
630
|
*
|
|
574
|
-
* @returns The Apps objects
|
|
631
|
+
* @returns The retrieved Apps objects
|
|
575
632
|
*/
|
|
576
633
|
getApps() {
|
|
577
634
|
return __awaiter(this, void 0, void 0, function* () {
|
|
@@ -586,7 +643,7 @@ export class Book {
|
|
|
586
643
|
/**
|
|
587
644
|
* Gets the existing [[Integrations]] in the Book.
|
|
588
645
|
*
|
|
589
|
-
* @returns The
|
|
646
|
+
* @returns The retrieved Integration objects
|
|
590
647
|
*/
|
|
591
648
|
getIntegrations() {
|
|
592
649
|
return __awaiter(this, void 0, void 0, function* () {
|
|
@@ -598,9 +655,9 @@ export class Book {
|
|
|
598
655
|
/**
|
|
599
656
|
* Creates a new [[Integration]] in the Book.
|
|
600
657
|
*
|
|
601
|
-
* @param integration - The Integration object or wrapped plain json
|
|
658
|
+
* @param integration - The [[Integration]] object or wrapped plain json
|
|
602
659
|
*
|
|
603
|
-
* @returns The created Integration object
|
|
660
|
+
* @returns The created [[Integration]] object
|
|
604
661
|
*/
|
|
605
662
|
createIntegration(integration) {
|
|
606
663
|
return __awaiter(this, void 0, void 0, function* () {
|
|
@@ -616,9 +673,9 @@ export class Book {
|
|
|
616
673
|
/**
|
|
617
674
|
* Updates an existing [[Integration]] in the Book.
|
|
618
675
|
*
|
|
619
|
-
* @param integration - The Integration wrapped plain json
|
|
676
|
+
* @param integration - The [[Integration]] wrapped plain json
|
|
620
677
|
*
|
|
621
|
-
* @returns The updated Integration object
|
|
678
|
+
* @returns The updated [[Integration]] object
|
|
622
679
|
*/
|
|
623
680
|
updateIntegration(integration) {
|
|
624
681
|
return __awaiter(this, void 0, void 0, function* () {
|
|
@@ -632,7 +689,7 @@ export class Book {
|
|
|
632
689
|
});
|
|
633
690
|
}
|
|
634
691
|
/**
|
|
635
|
-
* Gets an [[Account]] object
|
|
692
|
+
* Gets an [[Account]] object.
|
|
636
693
|
*
|
|
637
694
|
* @param idOrName - The id or name of the Account
|
|
638
695
|
*
|
|
@@ -746,7 +803,7 @@ export class Book {
|
|
|
746
803
|
}
|
|
747
804
|
}
|
|
748
805
|
/**
|
|
749
|
-
* Gets a [[Group]] object
|
|
806
|
+
* Gets a [[Group]] object.
|
|
750
807
|
*
|
|
751
808
|
* @param idOrName - The id or name of the Group
|
|
752
809
|
*
|
|
@@ -777,9 +834,9 @@ export class Book {
|
|
|
777
834
|
});
|
|
778
835
|
}
|
|
779
836
|
/**
|
|
780
|
-
* Gets all [[Groups]] of this Book
|
|
837
|
+
* Gets all [[Groups]] of this Book.
|
|
781
838
|
*
|
|
782
|
-
* @returns The retrieved Group objects
|
|
839
|
+
* @returns The retrieved [[Group]] objects
|
|
783
840
|
*/
|
|
784
841
|
getGroups() {
|
|
785
842
|
return __awaiter(this, void 0, void 0, function* () {
|
|
@@ -807,9 +864,9 @@ export class Book {
|
|
|
807
864
|
return groupsObj;
|
|
808
865
|
}
|
|
809
866
|
/**
|
|
810
|
-
* Gets all [[Accounts]] of this Book
|
|
867
|
+
* Gets all [[Accounts]] of this Book.
|
|
811
868
|
*
|
|
812
|
-
* @returns The retrieved Account objects
|
|
869
|
+
* @returns The retrieved [[Account]] objects
|
|
813
870
|
*/
|
|
814
871
|
getAccounts() {
|
|
815
872
|
return __awaiter(this, void 0, void 0, function* () {
|
|
@@ -895,10 +952,10 @@ export class Book {
|
|
|
895
952
|
* Lists transactions in the Book based on the provided query, limit, and cursor, for pagination.
|
|
896
953
|
*
|
|
897
954
|
* @param query - The query string to filter transactions
|
|
898
|
-
* @param limit - The maximum number of transactions to return. Default to 100, max to 1000
|
|
955
|
+
* @param limit - The maximum number of transactions to return. Default to 100, max to 1000
|
|
899
956
|
* @param cursor - The cursor for pagination
|
|
900
957
|
*
|
|
901
|
-
* @returns A
|
|
958
|
+
* @returns A [[TransactionList]] object containing the list of transactions
|
|
902
959
|
*/
|
|
903
960
|
listTransactions(query, limit, cursor) {
|
|
904
961
|
return __awaiter(this, void 0, void 0, function* () {
|
|
@@ -909,14 +966,14 @@ export class Book {
|
|
|
909
966
|
/**
|
|
910
967
|
* Lists events in the Book based on the provided parameters.
|
|
911
968
|
*
|
|
912
|
-
* @param afterDate - The start date (inclusive) for the events search range, in [RFC3339](https://en.wikipedia.org/wiki/ISO_8601#RFC_3339) format. Can be null
|
|
913
|
-
* @param beforeDate - The end date (exclusive) for the events search range, in [RFC3339](https://en.wikipedia.org/wiki/ISO_8601#RFC_3339) format. Can be null
|
|
914
|
-
* @param onError - True to search only for events on error
|
|
915
|
-
* @param resourceId - The ID of the event's resource (Transaction, Account, or Group). Can be null
|
|
916
|
-
* @param limit - The maximum number of events to return
|
|
917
|
-
* @param cursor - The cursor for pagination. Can be null
|
|
969
|
+
* @param afterDate - The start date (inclusive) for the events search range, in [RFC3339](https://en.wikipedia.org/wiki/ISO_8601#RFC_3339) format. Can be null
|
|
970
|
+
* @param beforeDate - The end date (exclusive) for the events search range, in [RFC3339](https://en.wikipedia.org/wiki/ISO_8601#RFC_3339) format. Can be null
|
|
971
|
+
* @param onError - True to search only for events on error
|
|
972
|
+
* @param resourceId - The ID of the event's resource (Transaction, Account, or Group). Can be null
|
|
973
|
+
* @param limit - The maximum number of events to return
|
|
974
|
+
* @param cursor - The cursor for pagination. Can be null
|
|
918
975
|
*
|
|
919
|
-
* @returns An EventList object containing the list of events
|
|
976
|
+
* @returns An [[EventList]] object containing the list of events
|
|
920
977
|
*/
|
|
921
978
|
listEvents(afterDate, beforeDate, onError, resourceId, limit, cursor) {
|
|
922
979
|
return __awaiter(this, void 0, void 0, function* () {
|
|
@@ -925,7 +982,11 @@ export class Book {
|
|
|
925
982
|
});
|
|
926
983
|
}
|
|
927
984
|
/**
|
|
928
|
-
* Retrieve a transaction by id
|
|
985
|
+
* Retrieve a transaction by id.
|
|
986
|
+
*
|
|
987
|
+
* @param id - The transaction ID
|
|
988
|
+
*
|
|
989
|
+
* @returns The [[Transaction]] object
|
|
929
990
|
*/
|
|
930
991
|
getTransaction(id) {
|
|
931
992
|
return __awaiter(this, void 0, void 0, function* () {
|
|
@@ -938,7 +999,11 @@ export class Book {
|
|
|
938
999
|
});
|
|
939
1000
|
}
|
|
940
1001
|
/**
|
|
941
|
-
* Retrieve a file by id
|
|
1002
|
+
* Retrieve a file by id.
|
|
1003
|
+
*
|
|
1004
|
+
* @param id - The file ID
|
|
1005
|
+
*
|
|
1006
|
+
* @returns The [[File]] object
|
|
942
1007
|
*/
|
|
943
1008
|
getFile(id) {
|
|
944
1009
|
return __awaiter(this, void 0, void 0, function* () {
|
|
@@ -961,9 +1026,9 @@ export class Book {
|
|
|
961
1026
|
/**
|
|
962
1027
|
* Creates a copy of this Book
|
|
963
1028
|
*
|
|
964
|
-
* @param name The name for the copied book
|
|
965
|
-
* @param copyTransactions True to copy transactions from the source book (user must be the Book owner)
|
|
966
|
-
* @param fromDate Start date to consider if copying transactions (numeric value in YYYYMMDD format)
|
|
1029
|
+
* @param name - The name for the copied book
|
|
1030
|
+
* @param copyTransactions - True to copy transactions from the source book (user must be the Book owner)
|
|
1031
|
+
* @param fromDate - Start date to consider if copying transactions (numeric value in YYYYMMDD format)
|
|
967
1032
|
*
|
|
968
1033
|
* @returns The copied Book object
|
|
969
1034
|
*/
|
|
@@ -975,6 +1040,8 @@ export class Book {
|
|
|
975
1040
|
}
|
|
976
1041
|
/**
|
|
977
1042
|
* Perform update Book, applying pending changes.
|
|
1043
|
+
*
|
|
1044
|
+
* @returns The updated Book object
|
|
978
1045
|
*/
|
|
979
1046
|
update() {
|
|
980
1047
|
return __awaiter(this, void 0, void 0, function* () {
|
|
@@ -983,12 +1050,11 @@ export class Book {
|
|
|
983
1050
|
});
|
|
984
1051
|
}
|
|
985
1052
|
/**
|
|
1053
|
+
* Create a [[BalancesReport]] based on query.
|
|
986
1054
|
*
|
|
987
|
-
*
|
|
1055
|
+
* @param query - The balances report query
|
|
988
1056
|
*
|
|
989
|
-
* @
|
|
990
|
-
*
|
|
991
|
-
* @return The balances report
|
|
1057
|
+
* @returns The balances report
|
|
992
1058
|
*
|
|
993
1059
|
* Example:
|
|
994
1060
|
*
|
|
@@ -999,6 +1065,8 @@ export class Book {
|
|
|
999
1065
|
*
|
|
1000
1066
|
* var accountBalance = balancesReport.getBalancesContainer("Bank Account").getCumulativeBalance();
|
|
1001
1067
|
* ```
|
|
1068
|
+
*
|
|
1069
|
+
* @returns The retrieved [[BalancesReport]] object
|
|
1002
1070
|
*/
|
|
1003
1071
|
getBalancesReport(query) {
|
|
1004
1072
|
return __awaiter(this, void 0, void 0, function* () {
|
|
@@ -1007,7 +1075,9 @@ export class Book {
|
|
|
1007
1075
|
});
|
|
1008
1076
|
}
|
|
1009
1077
|
/**
|
|
1010
|
-
*
|
|
1078
|
+
* Gets the saved queries from this book.
|
|
1079
|
+
*
|
|
1080
|
+
* @returns The saved queries from this book
|
|
1011
1081
|
*/
|
|
1012
1082
|
getSavedQueries() {
|
|
1013
1083
|
return __awaiter(this, void 0, void 0, function* () {
|