bkper-js 2.9.0 → 2.9.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/CHANGELOG.md CHANGED
@@ -12,12 +12,14 @@ See what's new and what has changed in bkper-js
12
12
  * Enhanced type safety with explicit Config type usage throughout
13
13
  * Standardized `json()` method across resources for consistent JSON serialization
14
14
  * Maintained full backward compatibility - no breaking changes to existing APIs
15
+ * Added `Account.isBalanceVerified`
15
16
  * Added `App.getOwnerWebsiteUrl`
16
17
  * Added `App.getReadme`
17
18
  * Added `App.getRepositoryUrl`
18
19
  * Added `App.getWebsiteUrl`
19
20
  * Added `App.isInstallable`
20
21
  * Added `App.isRepositoryPrivate`
22
+ * Added `Book.getCollaborators`
21
23
  * Added `Collaborator`
22
24
  * Added `Collaborator.json`
23
25
  * Added `Collaborator.getId`
@@ -28,7 +30,7 @@ See what's new and what has changed in bkper-js
28
30
  * Added `Collaborator.create`
29
31
  * Added `Collaborator.update`
30
32
  * Added `Collaborator.remove`
31
- * Added `Book.getCollaborators`
33
+ * Added `Group.isBalanceVerified`
32
34
  * Replaced axios with native Fetch API for better compatibility with multiple environments
33
35
 
34
36
  **August 2025**
package/lib/index.d.ts CHANGED
@@ -18,12 +18,7 @@
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
- */
26
- getConfig(): Config;
21
+
27
22
  /**
28
23
  * Gets the Account internal id.
29
24
  *
@@ -450,12 +445,7 @@ export declare class Amount {
450
445
  export declare class App extends Resource<bkper.App> {
451
446
  private config?;
452
447
  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
- */
458
- getConfig(): Config;
448
+
459
449
  /**
460
450
  * Sets the webhook url for development.
461
451
  *
@@ -1327,12 +1317,7 @@ export declare class Book extends Resource<bkper.Book> {
1327
1317
 
1328
1318
 
1329
1319
  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
- */
1335
- getConfig(): Config;
1320
+
1336
1321
  /**
1337
1322
  * Gets the unique identifier of this Book.
1338
1323
  *
@@ -1966,12 +1951,7 @@ export declare enum BotResponseType {
1966
1951
  export declare class Collaborator extends Resource<bkper.Collaborator> {
1967
1952
 
1968
1953
  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
- */
1974
- getConfig(): Config;
1954
+
1975
1955
  /**
1976
1956
  * Gets the Collaborator internal id.
1977
1957
  *
@@ -2034,12 +2014,7 @@ export declare class Collaborator extends Resource<bkper.Collaborator> {
2034
2014
  export declare class Collection extends Resource<bkper.Collection> {
2035
2015
  private config?;
2036
2016
  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
- */
2042
- getConfig(): Config;
2017
+
2043
2018
  /**
2044
2019
  * Gets the unique identifier of this Collection.
2045
2020
  *
@@ -2175,12 +2150,7 @@ export declare interface Config {
2175
2150
  export declare class Connection extends Resource<bkper.Connection> {
2176
2151
  private config?;
2177
2152
  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
- */
2183
- getConfig(): Config;
2153
+
2184
2154
  /**
2185
2155
  * Gets the id of the Connection.
2186
2156
  *
@@ -2346,12 +2316,7 @@ export declare class Conversation extends Resource<bkper.Conversation> {
2346
2316
 
2347
2317
  private config?;
2348
2318
  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
- */
2354
- getConfig(): Config;
2319
+
2355
2320
  /**
2356
2321
  * Gets the Agent associated to this Conversation.
2357
2322
  *
@@ -2481,6 +2446,7 @@ export declare class Event {
2481
2446
  * @returns True if this Event has at least one Bot Response of type ERROR
2482
2447
  */
2483
2448
  hasErrorResponse(): boolean;
2449
+
2484
2450
  }
2485
2451
 
2486
2452
  /**
@@ -2564,12 +2530,7 @@ export declare enum EventType {
2564
2530
  export declare class File extends Resource<bkper.File> {
2565
2531
 
2566
2532
  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
- */
2572
- getConfig(): Config;
2533
+
2573
2534
  /**
2574
2535
  * Gets the File id.
2575
2536
  *
@@ -2698,12 +2659,7 @@ export declare class Group extends Resource<bkper.Group> {
2698
2659
 
2699
2660
 
2700
2661
  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
- */
2706
- getConfig(): Config;
2662
+
2707
2663
  /**
2708
2664
  * Gets the id of this Group.
2709
2665
  *
@@ -2950,12 +2906,7 @@ export declare class Group extends Resource<bkper.Group> {
2950
2906
  export declare class Integration extends Resource<bkper.Integration> {
2951
2907
  private config?;
2952
2908
  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
- */
2958
- getConfig(): Config;
2909
+
2959
2910
  /**
2960
2911
  * Gets the [[Book]] id of the Integration.
2961
2912
  *
@@ -3066,12 +3017,7 @@ export declare class Message extends Resource<bkper.Message> {
3066
3017
 
3067
3018
 
3068
3019
  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
- */
3074
- getConfig(): Config;
3020
+
3075
3021
  /**
3076
3022
  * Gets the Message universal identifier.
3077
3023
  *
@@ -3277,12 +3223,7 @@ export declare enum Permission {
3277
3223
  export declare class Query extends Resource<bkper.Query> {
3278
3224
 
3279
3225
  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
- */
3285
- getConfig(): Config;
3226
+
3286
3227
  /**
3287
3228
  * Gets the Query universal identifier.
3288
3229
  *
@@ -3359,14 +3300,7 @@ declare abstract class Resource<T = any> {
3359
3300
  * @returns An immutable copy of the json payload
3360
3301
  */
3361
3302
  json(): T;
3362
- /**
3363
- * Gets the effective configuration for this resource.
3364
- * Each resource must implement this to either:
3365
- * - Return its own config (for root containers like Book, Collection)
3366
- * - Delegate to its container (for contained resources like Account, Transaction)
3367
- * @returns The resolved configuration
3368
- */
3369
- abstract getConfig(): Config;
3303
+
3370
3304
  }
3371
3305
 
3372
3306
  /**
@@ -3379,12 +3313,7 @@ declare abstract class Resource<T = any> {
3379
3313
  export declare class Template extends Resource<bkper.Template> {
3380
3314
  private config?;
3381
3315
  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
- */
3387
- getConfig(): Config;
3316
+
3388
3317
  /**
3389
3318
  * Gets the name of the Template.
3390
3319
  *
@@ -3446,12 +3375,7 @@ export declare class Template extends Resource<bkper.Template> {
3446
3375
  export declare class Transaction extends Resource<bkper.Transaction> {
3447
3376
 
3448
3377
  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
- */
3454
- getConfig(): Config;
3378
+
3455
3379
  /**
3456
3380
  * Gets the book associated with this transaction.
3457
3381
  *
@@ -3949,12 +3873,7 @@ export declare class TransactionList {
3949
3873
  export declare class User extends Resource<bkper.User> {
3950
3874
  private config?;
3951
3875
  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
- */
3957
- getConfig(): Config;
3876
+
3958
3877
  /**
3959
3878
  * Gets the id of the User.
3960
3879
  *
@@ -26,11 +26,7 @@ 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
+ /** @internal */
34
30
  getConfig() {
35
31
  return this.book.getConfig();
36
32
  }
package/lib/model/App.js CHANGED
@@ -22,11 +22,7 @@ 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
+ /** @internal */
30
26
  getConfig() {
31
27
  return this.config || Bkper.globalConfig;
32
28
  }
package/lib/model/Book.js CHANGED
@@ -51,11 +51,7 @@ 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
+ /** @internal */
59
55
  getConfig() {
60
56
  return this.config || Bkper.globalConfig;
61
57
  }
@@ -75,8 +75,7 @@ export class BotResponse {
75
75
  throw new Error("Agent id null!");
76
76
  }
77
77
  const updatedEventPayload = yield EventService.replayBotResponse(this.event.getBook(), eventId, agentId, this.event.getBook().getConfig());
78
- this.event.payload = updatedEventPayload;
79
- this.findAndUpdateBotResponsePayload(updatedEventPayload);
78
+ this.updateCache(updatedEventPayload);
80
79
  return this;
81
80
  });
82
81
  }
@@ -96,19 +95,19 @@ export class BotResponse {
96
95
  throw new Error("Agent id null!");
97
96
  }
98
97
  const updatedEventPayload = yield EventService.deleteBotResponse(this.event.getBook(), eventId, agentId, this.event.getBook().getConfig());
99
- this.event.payload = updatedEventPayload;
100
- this.findAndUpdateBotResponsePayload(updatedEventPayload);
98
+ this.updateCache(updatedEventPayload);
101
99
  return this;
102
100
  });
103
101
  }
104
102
  /** @internal */
105
- findAndUpdateBotResponsePayload(event) {
106
- if (event && event.botResponses) {
107
- const updatedPayload = event.botResponses.find(r => r.agentId && r.agentId === this.getAgentId());
108
- if (updatedPayload) {
109
- this.payload = updatedPayload;
110
- }
111
- }
103
+ updateCache(updatedEventPayload) {
104
+ var _a;
105
+ // Update event
106
+ this.event.payload = updatedEventPayload;
107
+ this.event.clearCache();
108
+ // Update bot response
109
+ const updatedBotResponsePayload = (_a = updatedEventPayload === null || updatedEventPayload === void 0 ? void 0 : updatedEventPayload.botResponses) === null || _a === void 0 ? void 0 : _a.find(r => r.agentId && r.agentId === this.getAgentId());
110
+ this.payload = updatedBotResponsePayload || {};
112
111
  }
113
112
  }
114
113
  //# sourceMappingURL=BotResponse.js.map
@@ -21,11 +21,7 @@ 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
+ /** @internal */
29
25
  getConfig() {
30
26
  return this.book.getConfig();
31
27
  }
@@ -21,11 +21,7 @@ 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
+ /** @internal */
29
25
  getConfig() {
30
26
  return this.config || Bkper.globalConfig;
31
27
  }
@@ -21,11 +21,7 @@ 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
+ /** @internal */
29
25
  getConfig() {
30
26
  return this.config || Bkper.globalConfig;
31
27
  }
@@ -25,11 +25,7 @@ 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
+ /** @internal */
33
29
  getConfig() {
34
30
  return this.config || Bkper.globalConfig;
35
31
  }
@@ -103,5 +103,9 @@ export class Event {
103
103
  }
104
104
  return false;
105
105
  }
106
+ /** @internal */
107
+ clearCache() {
108
+ this.botResponses = undefined;
109
+ }
106
110
  }
107
111
  //# sourceMappingURL=Event.js.map
package/lib/model/File.js CHANGED
@@ -22,11 +22,7 @@ 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
+ /** @internal */
30
26
  getConfig() {
31
27
  return this.book.getConfig();
32
28
  }
@@ -27,11 +27,7 @@ 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
+ /** @internal */
35
31
  getConfig() {
36
32
  return this.book.getConfig();
37
33
  }
@@ -20,11 +20,7 @@ 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
+ /** @internal */
28
24
  getConfig() {
29
25
  return this.config || Bkper.globalConfig;
30
26
  }
@@ -23,11 +23,7 @@ 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
+ /** @internal */
31
27
  getConfig() {
32
28
  return this.conversation.getConfig();
33
29
  }
@@ -21,11 +21,7 @@ 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
+ /** @internal */
29
25
  getConfig() {
30
26
  return this.book.getConfig();
31
27
  }
@@ -12,11 +12,7 @@ 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
+ /** @internal */
20
16
  getConfig() {
21
17
  return this.config || Bkper.globalConfig;
22
18
  }
@@ -26,11 +26,7 @@ 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
+ /** @internal */
34
30
  getConfig() {
35
31
  return this.book.getConfig();
36
32
  }
package/lib/model/User.js CHANGED
@@ -25,11 +25,7 @@ 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
+ /** @internal */
33
29
  getConfig() {
34
30
  return this.config || Bkper.globalConfig;
35
31
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "bkper-js",
3
- "version": "2.9.0",
3
+ "version": "2.9.2",
4
4
  "description": "Javascript client for Bkper REST API",
5
5
  "main": "./lib/index.js",
6
6
  "module": "./lib/index.js",
@@ -42,7 +42,7 @@
42
42
  "luxon": "^1.25.0"
43
43
  },
44
44
  "devDependencies": {
45
- "@microsoft/api-extractor": "^7.12.1",
45
+ "@microsoft/api-extractor": "^7.52.12",
46
46
  "@types/big.js": "^6.0.2",
47
47
  "@types/chai": "^4.2.14",
48
48
  "@types/luxon": "^1.25.1",