bkper-js 2.8.0 → 2.9.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 CHANGED
@@ -6,7 +6,18 @@ See what's new and what has changed in bkper-js
6
6
  ----
7
7
 
8
8
  **September 2025**
9
-
9
+ * **v2.8.0 - INTERNAL REFACTOR:**
10
+ * Introduced abstract `Resource` class for all model entities
11
+ * Improved config management with `getConfig()` pattern for config resolution
12
+ * Enhanced type safety with explicit Config type usage throughout
13
+ * Standardized `json()` method across resources for consistent JSON serialization
14
+ * Maintained full backward compatibility - no breaking changes to existing APIs
15
+ * Added `App.getOwnerWebsiteUrl`
16
+ * Added `App.getReadme`
17
+ * Added `App.getRepositoryUrl`
18
+ * Added `App.getWebsiteUrl`
19
+ * Added `App.isInstallable`
20
+ * Added `App.isRepositoryPrivate`
10
21
  * Added `Collaborator`
11
22
  * Added `Collaborator.json`
12
23
  * Added `Collaborator.getId`
package/lib/index.d.ts CHANGED
@@ -18,6 +18,11 @@
18
18
  export declare class Account extends Resource<bkper.Account> {
19
19
 
20
20
  constructor(book: Book, payload?: bkper.Account);
21
+ /**
22
+ * Gets the configuration object for this Account.
23
+ *
24
+ * @returns The Config object from the parent Book
25
+ */
21
26
  getConfig(): Config;
22
27
  /**
23
28
  * Gets the Account internal id.
@@ -39,6 +44,12 @@ export declare class Account extends Resource<bkper.Account> {
39
44
  * @returns This Account, for chaining
40
45
  */
41
46
  setName(name: string): Account;
47
+ /**
48
+ * Tells if the balance of this Account has been verified/audited.
49
+ *
50
+ * @returns True if the balance of this Account has been verified/audited
51
+ */
52
+ isBalanceVerified(): boolean | undefined;
42
53
  /**
43
54
  * Gets the normalized name of this Account without spaces or special characters.
44
55
  *
@@ -439,6 +450,11 @@ export declare class Amount {
439
450
  export declare class App extends Resource<bkper.App> {
440
451
  private config?;
441
452
  constructor(payload?: bkper.App, config?: Config);
453
+ /**
454
+ * Gets the configuration object for this App.
455
+ *
456
+ * @returns The Config object for this App or the global config
457
+ */
442
458
  getConfig(): Config;
443
459
  /**
444
460
  * Sets the webhook url for development.
@@ -1311,6 +1327,11 @@ export declare class Book extends Resource<bkper.Book> {
1311
1327
 
1312
1328
 
1313
1329
  constructor(payload?: bkper.Book, config?: Config);
1330
+ /**
1331
+ * Gets the configuration object for this Book.
1332
+ *
1333
+ * @returns The Config object for this Book or the global config
1334
+ */
1314
1335
  getConfig(): Config;
1315
1336
  /**
1316
1337
  * Gets the unique identifier of this Book.
@@ -1945,6 +1966,11 @@ export declare enum BotResponseType {
1945
1966
  export declare class Collaborator extends Resource<bkper.Collaborator> {
1946
1967
 
1947
1968
  constructor(book: Book, payload?: bkper.Collaborator);
1969
+ /**
1970
+ * Gets the configuration object for this Collaborator.
1971
+ *
1972
+ * @returns The Config object from the parent Book
1973
+ */
1948
1974
  getConfig(): Config;
1949
1975
  /**
1950
1976
  * Gets the Collaborator internal id.
@@ -2008,6 +2034,11 @@ export declare class Collaborator extends Resource<bkper.Collaborator> {
2008
2034
  export declare class Collection extends Resource<bkper.Collection> {
2009
2035
  private config?;
2010
2036
  constructor(payload?: bkper.Collection, config?: Config);
2037
+ /**
2038
+ * Gets the configuration object for this Collection.
2039
+ *
2040
+ * @returns The Config object for this Collection or the global config
2041
+ */
2011
2042
  getConfig(): Config;
2012
2043
  /**
2013
2044
  * Gets the unique identifier of this Collection.
@@ -2144,6 +2175,11 @@ export declare interface Config {
2144
2175
  export declare class Connection extends Resource<bkper.Connection> {
2145
2176
  private config?;
2146
2177
  constructor(payload?: bkper.Connection, config?: Config);
2178
+ /**
2179
+ * Gets the configuration object for this Connection.
2180
+ *
2181
+ * @returns The Config object for this Connection or the global config
2182
+ */
2147
2183
  getConfig(): Config;
2148
2184
  /**
2149
2185
  * Gets the id of the Connection.
@@ -2310,6 +2346,11 @@ export declare class Conversation extends Resource<bkper.Conversation> {
2310
2346
 
2311
2347
  private config?;
2312
2348
  constructor(agent: Agent, payload?: bkper.Conversation, config?: Config);
2349
+ /**
2350
+ * Gets the configuration object for this Conversation.
2351
+ *
2352
+ * @returns The Config object for this Conversation or the global config
2353
+ */
2313
2354
  getConfig(): Config;
2314
2355
  /**
2315
2356
  * Gets the Agent associated to this Conversation.
@@ -2523,6 +2564,11 @@ export declare enum EventType {
2523
2564
  export declare class File extends Resource<bkper.File> {
2524
2565
 
2525
2566
  constructor(book: Book, payload?: bkper.File);
2567
+ /**
2568
+ * Gets the configuration object for this File.
2569
+ *
2570
+ * @returns The Config object from the parent Book
2571
+ */
2526
2572
  getConfig(): Config;
2527
2573
  /**
2528
2574
  * Gets the File id.
@@ -2652,6 +2698,11 @@ export declare class Group extends Resource<bkper.Group> {
2652
2698
 
2653
2699
 
2654
2700
  constructor(book: Book, payload?: bkper.Group);
2701
+ /**
2702
+ * Gets the configuration object for this Group.
2703
+ *
2704
+ * @returns The Config object from the parent Book
2705
+ */
2655
2706
  getConfig(): Config;
2656
2707
  /**
2657
2708
  * Gets the id of this Group.
@@ -2673,6 +2724,12 @@ export declare class Group extends Resource<bkper.Group> {
2673
2724
  * @returns This Group, for chaining
2674
2725
  */
2675
2726
  setName(name: string): Group;
2727
+ /**
2728
+ * Tells if the balance of this Group has been verified/audited.
2729
+ *
2730
+ * @returns True if the balance of this Group has been verified/audited
2731
+ */
2732
+ isBalanceVerified(): Promise<boolean | undefined>;
2676
2733
  /**
2677
2734
  * Tells if the Group is locked by the Book owner.
2678
2735
  *
@@ -2893,6 +2950,11 @@ export declare class Group extends Resource<bkper.Group> {
2893
2950
  export declare class Integration extends Resource<bkper.Integration> {
2894
2951
  private config?;
2895
2952
  constructor(payload?: bkper.Integration, config?: Config);
2953
+ /**
2954
+ * Gets the configuration object for this Integration.
2955
+ *
2956
+ * @returns The Config object for this Integration or the global config
2957
+ */
2896
2958
  getConfig(): Config;
2897
2959
  /**
2898
2960
  * Gets the [[Book]] id of the Integration.
@@ -3004,6 +3066,11 @@ export declare class Message extends Resource<bkper.Message> {
3004
3066
 
3005
3067
 
3006
3068
  constructor(conversation: Conversation, payload?: bkper.Message, config?: Config);
3069
+ /**
3070
+ * Gets the configuration object for this Message.
3071
+ *
3072
+ * @returns The Config object from the parent Conversation
3073
+ */
3007
3074
  getConfig(): Config;
3008
3075
  /**
3009
3076
  * Gets the Message universal identifier.
@@ -3210,6 +3277,11 @@ export declare enum Permission {
3210
3277
  export declare class Query extends Resource<bkper.Query> {
3211
3278
 
3212
3279
  constructor(book: Book, payload?: bkper.Query);
3280
+ /**
3281
+ * Gets the configuration object for this Query.
3282
+ *
3283
+ * @returns The Config object from the parent Book
3284
+ */
3213
3285
  getConfig(): Config;
3214
3286
  /**
3215
3287
  * Gets the Query universal identifier.
@@ -3276,7 +3348,7 @@ declare abstract class Resource<T = any> {
3276
3348
  /**
3277
3349
  * The underlying payload data for this resource
3278
3350
  */
3279
- protected payload: T;
3351
+ payload: T;
3280
3352
  /**
3281
3353
  * Constructs a new Resource
3282
3354
  * @param payload - The data payload for this resource
@@ -3307,6 +3379,11 @@ declare abstract class Resource<T = any> {
3307
3379
  export declare class Template extends Resource<bkper.Template> {
3308
3380
  private config?;
3309
3381
  constructor(json?: bkper.Template, config?: Config);
3382
+ /**
3383
+ * Gets the configuration object for this Template.
3384
+ *
3385
+ * @returns The Config object for this Template or the global config
3386
+ */
3310
3387
  getConfig(): Config;
3311
3388
  /**
3312
3389
  * Gets the name of the Template.
@@ -3369,6 +3446,11 @@ export declare class Template extends Resource<bkper.Template> {
3369
3446
  export declare class Transaction extends Resource<bkper.Transaction> {
3370
3447
 
3371
3448
  constructor(book: Book, payload?: bkper.Transaction);
3449
+ /**
3450
+ * Gets the configuration object for this Transaction.
3451
+ *
3452
+ * @returns The Config object from the parent Book
3453
+ */
3372
3454
  getConfig(): Config;
3373
3455
  /**
3374
3456
  * Gets the book associated with this transaction.
@@ -3867,6 +3949,11 @@ export declare class TransactionList {
3867
3949
  export declare class User extends Resource<bkper.User> {
3868
3950
  private config?;
3869
3951
  constructor(payload?: bkper.User, config?: Config);
3952
+ /**
3953
+ * Gets the configuration object for this User.
3954
+ *
3955
+ * @returns The Config object for this User or the global config
3956
+ */
3870
3957
  getConfig(): Config;
3871
3958
  /**
3872
3959
  * Gets the id of the User.
@@ -26,6 +26,11 @@ export class Account extends Resource {
26
26
  super(payload || { createdAt: `${Date.now()}` });
27
27
  this.book = book;
28
28
  }
29
+ /**
30
+ * Gets the configuration object for this Account.
31
+ *
32
+ * @returns The Config object from the parent Book
33
+ */
29
34
  getConfig() {
30
35
  return this.book.getConfig();
31
36
  }
@@ -56,6 +61,14 @@ export class Account extends Resource {
56
61
  this.payload.name = name;
57
62
  return this;
58
63
  }
64
+ /**
65
+ * Tells if the balance of this Account has been verified/audited.
66
+ *
67
+ * @returns True if the balance of this Account has been verified/audited
68
+ */
69
+ isBalanceVerified() {
70
+ return this.payload.balanceVerified;
71
+ }
59
72
  /**
60
73
  * Gets the normalized name of this Account without spaces or special characters.
61
74
  *
package/lib/model/App.js CHANGED
@@ -22,6 +22,11 @@ export class App extends Resource {
22
22
  super(payload);
23
23
  this.config = config;
24
24
  }
25
+ /**
26
+ * Gets the configuration object for this App.
27
+ *
28
+ * @returns The Config object for this App or the global config
29
+ */
25
30
  getConfig() {
26
31
  return this.config || Bkper.globalConfig;
27
32
  }
package/lib/model/Book.js CHANGED
@@ -51,6 +51,11 @@ export class Book extends Resource {
51
51
  this.mapGroups(this.payload.groups);
52
52
  this.mapAccounts(this.payload.accounts);
53
53
  }
54
+ /**
55
+ * Gets the configuration object for this Book.
56
+ *
57
+ * @returns The Config object for this Book or the global config
58
+ */
54
59
  getConfig() {
55
60
  return this.config || Bkper.globalConfig;
56
61
  }
@@ -21,6 +21,11 @@ export class Collaborator extends Resource {
21
21
  super(payload);
22
22
  this.book = book;
23
23
  }
24
+ /**
25
+ * Gets the configuration object for this Collaborator.
26
+ *
27
+ * @returns The Config object from the parent Book
28
+ */
24
29
  getConfig() {
25
30
  return this.book.getConfig();
26
31
  }
@@ -21,6 +21,11 @@ export class Collection extends Resource {
21
21
  super(payload);
22
22
  this.config = config;
23
23
  }
24
+ /**
25
+ * Gets the configuration object for this Collection.
26
+ *
27
+ * @returns The Config object for this Collection or the global config
28
+ */
24
29
  getConfig() {
25
30
  return this.config || Bkper.globalConfig;
26
31
  }
@@ -21,6 +21,11 @@ export class Connection extends Resource {
21
21
  super(payload);
22
22
  this.config = config;
23
23
  }
24
+ /**
25
+ * Gets the configuration object for this Connection.
26
+ *
27
+ * @returns The Config object for this Connection or the global config
28
+ */
24
29
  getConfig() {
25
30
  return this.config || Bkper.globalConfig;
26
31
  }
@@ -25,6 +25,11 @@ export class Conversation extends Resource {
25
25
  this.agent = agent;
26
26
  this.config = config;
27
27
  }
28
+ /**
29
+ * Gets the configuration object for this Conversation.
30
+ *
31
+ * @returns The Config object for this Conversation or the global config
32
+ */
28
33
  getConfig() {
29
34
  return this.config || Bkper.globalConfig;
30
35
  }
package/lib/model/File.js CHANGED
@@ -22,6 +22,11 @@ export class File extends Resource {
22
22
  super(payload || { createdAt: `${Date.now()}` });
23
23
  this.book = book;
24
24
  }
25
+ /**
26
+ * Gets the configuration object for this File.
27
+ *
28
+ * @returns The Config object from the parent Book
29
+ */
25
30
  getConfig() {
26
31
  return this.book.getConfig();
27
32
  }
@@ -27,6 +27,11 @@ export class Group extends Resource {
27
27
  this.children = new Map();
28
28
  this.book = book;
29
29
  }
30
+ /**
31
+ * Gets the configuration object for this Group.
32
+ *
33
+ * @returns The Config object from the parent Book
34
+ */
30
35
  getConfig() {
31
36
  return this.book.getConfig();
32
37
  }
@@ -57,6 +62,22 @@ export class Group extends Resource {
57
62
  this.payload.name = name;
58
63
  return this;
59
64
  }
65
+ /**
66
+ * Tells if the balance of this Group has been verified/audited.
67
+ *
68
+ * @returns True if the balance of this Group has been verified/audited
69
+ */
70
+ isBalanceVerified() {
71
+ return __awaiter(this, void 0, void 0, function* () {
72
+ const accounts = yield this.getAccounts();
73
+ for (const account of accounts) {
74
+ if (!account.isBalanceVerified()) {
75
+ return false;
76
+ }
77
+ }
78
+ return true;
79
+ });
80
+ }
60
81
  /**
61
82
  * Tells if the Group is locked by the Book owner.
62
83
  *
@@ -20,6 +20,11 @@ export class Integration extends Resource {
20
20
  super(payload || {});
21
21
  this.config = config;
22
22
  }
23
+ /**
24
+ * Gets the configuration object for this Integration.
25
+ *
26
+ * @returns The Config object for this Integration or the global config
27
+ */
23
28
  getConfig() {
24
29
  return this.config || Bkper.globalConfig;
25
30
  }
@@ -23,6 +23,11 @@ export class Message extends Resource {
23
23
  super(payload || {});
24
24
  this.conversation = conversation;
25
25
  }
26
+ /**
27
+ * Gets the configuration object for this Message.
28
+ *
29
+ * @returns The Config object from the parent Conversation
30
+ */
26
31
  getConfig() {
27
32
  return this.conversation.getConfig();
28
33
  }
@@ -21,6 +21,11 @@ export class Query extends Resource {
21
21
  super(payload);
22
22
  this.book = book;
23
23
  }
24
+ /**
25
+ * Gets the configuration object for this Query.
26
+ *
27
+ * @returns The Config object from the parent Book
28
+ */
24
29
  getConfig() {
25
30
  return this.book.getConfig();
26
31
  }
@@ -12,6 +12,11 @@ export class Template extends Resource {
12
12
  super(json);
13
13
  this.config = config;
14
14
  }
15
+ /**
16
+ * Gets the configuration object for this Template.
17
+ *
18
+ * @returns The Config object for this Template or the global config
19
+ */
15
20
  getConfig() {
16
21
  return this.config || Bkper.globalConfig;
17
22
  }
@@ -26,6 +26,11 @@ export class Transaction extends Resource {
26
26
  super(payload || { createdAt: `${Date.now()}` });
27
27
  this.book = book;
28
28
  }
29
+ /**
30
+ * Gets the configuration object for this Transaction.
31
+ *
32
+ * @returns The Config object from the parent Book
33
+ */
29
34
  getConfig() {
30
35
  return this.book.getConfig();
31
36
  }
package/lib/model/User.js CHANGED
@@ -25,6 +25,11 @@ export class User extends Resource {
25
25
  super(payload);
26
26
  this.config = config;
27
27
  }
28
+ /**
29
+ * Gets the configuration object for this User.
30
+ *
31
+ * @returns The Config object for this User or the global config
32
+ */
28
33
  getConfig() {
29
34
  return this.config || Bkper.globalConfig;
30
35
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "bkper-js",
3
- "version": "2.8.0",
3
+ "version": "2.9.0",
4
4
  "description": "Javascript client for Bkper REST API",
5
5
  "main": "./lib/index.js",
6
6
  "module": "./lib/index.js",
@@ -34,7 +34,7 @@
34
34
  "postversion": "git push --tags && yarn publish --new-version $npm_package_version && git push && echo \"Successfully released version $npm_package_version!\""
35
35
  },
36
36
  "peerDependencies": {
37
- "@bkper/bkper-api-types": "^5.25.0"
37
+ "@bkper/bkper-api-types": "^5.26.0"
38
38
  },
39
39
  "dependencies": {
40
40
  "big.js": "^6.0.3",