bkper-js 2.8.0 → 2.8.1

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.
@@ -439,6 +444,11 @@ export declare class Amount {
439
444
  export declare class App extends Resource<bkper.App> {
440
445
  private config?;
441
446
  constructor(payload?: bkper.App, config?: Config);
447
+ /**
448
+ * Gets the configuration object for this App.
449
+ *
450
+ * @returns The Config object for this App or the global config
451
+ */
442
452
  getConfig(): Config;
443
453
  /**
444
454
  * Sets the webhook url for development.
@@ -1311,6 +1321,11 @@ export declare class Book extends Resource<bkper.Book> {
1311
1321
 
1312
1322
 
1313
1323
  constructor(payload?: bkper.Book, config?: Config);
1324
+ /**
1325
+ * Gets the configuration object for this Book.
1326
+ *
1327
+ * @returns The Config object for this Book or the global config
1328
+ */
1314
1329
  getConfig(): Config;
1315
1330
  /**
1316
1331
  * Gets the unique identifier of this Book.
@@ -1945,6 +1960,11 @@ export declare enum BotResponseType {
1945
1960
  export declare class Collaborator extends Resource<bkper.Collaborator> {
1946
1961
 
1947
1962
  constructor(book: Book, payload?: bkper.Collaborator);
1963
+ /**
1964
+ * Gets the configuration object for this Collaborator.
1965
+ *
1966
+ * @returns The Config object from the parent Book
1967
+ */
1948
1968
  getConfig(): Config;
1949
1969
  /**
1950
1970
  * Gets the Collaborator internal id.
@@ -2008,6 +2028,11 @@ export declare class Collaborator extends Resource<bkper.Collaborator> {
2008
2028
  export declare class Collection extends Resource<bkper.Collection> {
2009
2029
  private config?;
2010
2030
  constructor(payload?: bkper.Collection, config?: Config);
2031
+ /**
2032
+ * Gets the configuration object for this Collection.
2033
+ *
2034
+ * @returns The Config object for this Collection or the global config
2035
+ */
2011
2036
  getConfig(): Config;
2012
2037
  /**
2013
2038
  * Gets the unique identifier of this Collection.
@@ -2144,6 +2169,11 @@ export declare interface Config {
2144
2169
  export declare class Connection extends Resource<bkper.Connection> {
2145
2170
  private config?;
2146
2171
  constructor(payload?: bkper.Connection, config?: Config);
2172
+ /**
2173
+ * Gets the configuration object for this Connection.
2174
+ *
2175
+ * @returns The Config object for this Connection or the global config
2176
+ */
2147
2177
  getConfig(): Config;
2148
2178
  /**
2149
2179
  * Gets the id of the Connection.
@@ -2310,6 +2340,11 @@ export declare class Conversation extends Resource<bkper.Conversation> {
2310
2340
 
2311
2341
  private config?;
2312
2342
  constructor(agent: Agent, payload?: bkper.Conversation, config?: Config);
2343
+ /**
2344
+ * Gets the configuration object for this Conversation.
2345
+ *
2346
+ * @returns The Config object for this Conversation or the global config
2347
+ */
2313
2348
  getConfig(): Config;
2314
2349
  /**
2315
2350
  * Gets the Agent associated to this Conversation.
@@ -2523,6 +2558,11 @@ export declare enum EventType {
2523
2558
  export declare class File extends Resource<bkper.File> {
2524
2559
 
2525
2560
  constructor(book: Book, payload?: bkper.File);
2561
+ /**
2562
+ * Gets the configuration object for this File.
2563
+ *
2564
+ * @returns The Config object from the parent Book
2565
+ */
2526
2566
  getConfig(): Config;
2527
2567
  /**
2528
2568
  * Gets the File id.
@@ -2652,6 +2692,11 @@ export declare class Group extends Resource<bkper.Group> {
2652
2692
 
2653
2693
 
2654
2694
  constructor(book: Book, payload?: bkper.Group);
2695
+ /**
2696
+ * Gets the configuration object for this Group.
2697
+ *
2698
+ * @returns The Config object from the parent Book
2699
+ */
2655
2700
  getConfig(): Config;
2656
2701
  /**
2657
2702
  * Gets the id of this Group.
@@ -2893,6 +2938,11 @@ export declare class Group extends Resource<bkper.Group> {
2893
2938
  export declare class Integration extends Resource<bkper.Integration> {
2894
2939
  private config?;
2895
2940
  constructor(payload?: bkper.Integration, config?: Config);
2941
+ /**
2942
+ * Gets the configuration object for this Integration.
2943
+ *
2944
+ * @returns The Config object for this Integration or the global config
2945
+ */
2896
2946
  getConfig(): Config;
2897
2947
  /**
2898
2948
  * Gets the [[Book]] id of the Integration.
@@ -3004,6 +3054,11 @@ export declare class Message extends Resource<bkper.Message> {
3004
3054
 
3005
3055
 
3006
3056
  constructor(conversation: Conversation, payload?: bkper.Message, config?: Config);
3057
+ /**
3058
+ * Gets the configuration object for this Message.
3059
+ *
3060
+ * @returns The Config object from the parent Conversation
3061
+ */
3007
3062
  getConfig(): Config;
3008
3063
  /**
3009
3064
  * Gets the Message universal identifier.
@@ -3210,6 +3265,11 @@ export declare enum Permission {
3210
3265
  export declare class Query extends Resource<bkper.Query> {
3211
3266
 
3212
3267
  constructor(book: Book, payload?: bkper.Query);
3268
+ /**
3269
+ * Gets the configuration object for this Query.
3270
+ *
3271
+ * @returns The Config object from the parent Book
3272
+ */
3213
3273
  getConfig(): Config;
3214
3274
  /**
3215
3275
  * Gets the Query universal identifier.
@@ -3276,7 +3336,7 @@ declare abstract class Resource<T = any> {
3276
3336
  /**
3277
3337
  * The underlying payload data for this resource
3278
3338
  */
3279
- protected payload: T;
3339
+ payload: T;
3280
3340
  /**
3281
3341
  * Constructs a new Resource
3282
3342
  * @param payload - The data payload for this resource
@@ -3307,6 +3367,11 @@ declare abstract class Resource<T = any> {
3307
3367
  export declare class Template extends Resource<bkper.Template> {
3308
3368
  private config?;
3309
3369
  constructor(json?: bkper.Template, config?: Config);
3370
+ /**
3371
+ * Gets the configuration object for this Template.
3372
+ *
3373
+ * @returns The Config object for this Template or the global config
3374
+ */
3310
3375
  getConfig(): Config;
3311
3376
  /**
3312
3377
  * Gets the name of the Template.
@@ -3369,6 +3434,11 @@ export declare class Template extends Resource<bkper.Template> {
3369
3434
  export declare class Transaction extends Resource<bkper.Transaction> {
3370
3435
 
3371
3436
  constructor(book: Book, payload?: bkper.Transaction);
3437
+ /**
3438
+ * Gets the configuration object for this Transaction.
3439
+ *
3440
+ * @returns The Config object from the parent Book
3441
+ */
3372
3442
  getConfig(): Config;
3373
3443
  /**
3374
3444
  * Gets the book associated with this transaction.
@@ -3867,6 +3937,11 @@ export declare class TransactionList {
3867
3937
  export declare class User extends Resource<bkper.User> {
3868
3938
  private config?;
3869
3939
  constructor(payload?: bkper.User, config?: Config);
3940
+ /**
3941
+ * Gets the configuration object for this User.
3942
+ *
3943
+ * @returns The Config object for this User or the global config
3944
+ */
3870
3945
  getConfig(): Config;
3871
3946
  /**
3872
3947
  * 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
  }
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
  }
@@ -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.8.1",
4
4
  "description": "Javascript client for Bkper REST API",
5
5
  "main": "./lib/index.js",
6
6
  "module": "./lib/index.js",