bkper-js 2.10.0 → 2.10.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 CHANGED
@@ -2451,6 +2451,12 @@ export declare enum EventType {
2451
2451
  export declare class File extends Resource<bkper.File> {
2452
2452
 
2453
2453
  constructor(book: Book, payload?: bkper.File);
2454
+ /**
2455
+ * Gets the Book this File belongs to.
2456
+ *
2457
+ * @returns The Book instance that owns this File
2458
+ */
2459
+ getBook(): Book;
2454
2460
 
2455
2461
  /**
2456
2462
  * Gets the File id.
package/lib/model/File.js CHANGED
@@ -22,6 +22,14 @@ export class File extends Resource {
22
22
  super(payload || { createdAt: `${Date.now()}` });
23
23
  this.book = book;
24
24
  }
25
+ /**
26
+ * Gets the Book this File belongs to.
27
+ *
28
+ * @returns The Book instance that owns this File
29
+ */
30
+ getBook() {
31
+ return this.book;
32
+ }
25
33
  /** @internal */
26
34
  getConfig() {
27
35
  return this.book.getConfig();
@@ -219,8 +219,13 @@ export class Transaction extends Resource {
219
219
  * @returns This Transaction, for chaining
220
220
  */
221
221
  setFiles(files) {
222
- const filePayloads = files.map((file) => file.json());
223
- this.payload.files = [...filePayloads];
222
+ const filePayloads = files.map((file) => {
223
+ return {
224
+ id: file.getId(),
225
+ name: file.getName()
226
+ };
227
+ });
228
+ this.payload.files = filePayloads;
224
229
  return this;
225
230
  }
226
231
  /**
@@ -440,12 +445,12 @@ export class Transaction extends Resource {
440
445
  setDebitAccount(account) {
441
446
  if (account instanceof Account) {
442
447
  if (account != null && account.getId() != null) {
443
- this.payload.debitAccount = account.json();
448
+ this.payload.debitAccount = { id: account.getId(), name: account.getName() };
444
449
  }
445
450
  }
446
451
  else {
447
452
  if (account != null && account.id != null) {
448
- this.payload.debitAccount = account;
453
+ this.payload.debitAccount = { id: account.id, name: account.name };
449
454
  }
450
455
  }
451
456
  return this;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "bkper-js",
3
- "version": "2.10.0",
3
+ "version": "2.10.2",
4
4
  "description": "Javascript client for Bkper REST API",
5
5
  "main": "./lib/index.js",
6
6
  "module": "./lib/index.js",