bkper-js 2.15.2 → 2.16.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/lib/index.d.ts CHANGED
@@ -3012,13 +3012,12 @@ declare abstract class ResourceProperty<T extends {
3012
3012
  * Sets the custom properties of this resource.
3013
3013
  *
3014
3014
  * @param properties - Object with key/value pair properties
3015
- * @param filterHidden - If true, hidden properties (ending with "_") will not be set. Defaults to false.
3016
3015
  *
3017
3016
  * @returns This resource, for chaining
3018
3017
  */
3019
3018
  setProperties(properties: {
3020
3019
  [key: string]: string;
3021
- }, filterHidden?: boolean): this;
3020
+ }): this;
3022
3021
  /**
3023
3022
  * Gets the property value for given keys. First property found will be retrieved.
3024
3023
  *
@@ -3032,11 +3031,10 @@ declare abstract class ResourceProperty<T extends {
3032
3031
  *
3033
3032
  * @param key - The property key
3034
3033
  * @param value - The property value, or null/undefined to clean it
3035
- * @param filterHidden - If true, hidden properties (ending with "_") will not be set. Defaults to false.
3036
3034
  *
3037
3035
  * @returns This resource, for chaining
3038
3036
  */
3039
- setProperty(key: string, value: string | null | undefined, filterHidden?: boolean): this;
3037
+ setProperty(key: string, value: string | null | undefined): this;
3040
3038
  /**
3041
3039
  * Deletes a custom property.
3042
3040
  *
@@ -3051,6 +3049,36 @@ declare abstract class ResourceProperty<T extends {
3051
3049
  * @returns Array of property keys sorted alphabetically
3052
3050
  */
3053
3051
  getPropertyKeys(): string[];
3052
+ /**
3053
+ * Sets a custom property in this resource, filtering out hidden properties.
3054
+ * Hidden properties are those whose keys end with an underscore "_".
3055
+ *
3056
+ * @param key - The property key
3057
+ * @param value - The property value, or null/undefined to clean it
3058
+ *
3059
+ * @returns This resource, for chaining
3060
+ */
3061
+ setVisibleProperty(key: string, value: string | null | undefined): this;
3062
+ /**
3063
+ * Sets the custom properties of this resource, filtering out hidden properties.
3064
+ * Hidden properties are those whose keys end with an underscore "_".
3065
+ *
3066
+ * @param properties - Object with key/value pair properties
3067
+ *
3068
+ * @returns This resource, for chaining
3069
+ */
3070
+ setVisibleProperties(properties: {
3071
+ [key: string]: string;
3072
+ }): this;
3073
+ /**
3074
+ * Gets the visible custom properties stored in this resource.
3075
+ * Hidden properties (those ending with "_") are excluded from the result.
3076
+ *
3077
+ * @returns Object with key/value pair properties, excluding hidden properties
3078
+ */
3079
+ getVisibleProperties(): {
3080
+ [key: string]: string;
3081
+ };
3054
3082
  }
3055
3083
 
3056
3084
  /**
@@ -33,24 +33,11 @@ export class ResourceProperty extends Resource {
33
33
  * Sets the custom properties of this resource.
34
34
  *
35
35
  * @param properties - Object with key/value pair properties
36
- * @param filterHidden - If true, hidden properties (ending with "_") will not be set. Defaults to false.
37
36
  *
38
37
  * @returns This resource, for chaining
39
38
  */
40
- setProperties(properties, filterHidden = false) {
41
- if (!filterHidden) {
42
- this.payload.properties = Object.assign({}, properties);
43
- return this;
44
- }
45
- const filteredProperties = {};
46
- for (const key in properties) {
47
- if (Object.prototype.hasOwnProperty.call(properties, key)) {
48
- if (!this.isHiddenProperty(key)) {
49
- filteredProperties[key] = properties[key];
50
- }
51
- }
52
- }
53
- this.payload.properties = Object.assign({}, filteredProperties);
39
+ setProperties(properties) {
40
+ this.payload.properties = Object.assign({}, properties);
54
41
  return this;
55
42
  }
56
43
  /**
@@ -77,17 +64,13 @@ export class ResourceProperty extends Resource {
77
64
  *
78
65
  * @param key - The property key
79
66
  * @param value - The property value, or null/undefined to clean it
80
- * @param filterHidden - If true, hidden properties (ending with "_") will not be set. Defaults to false.
81
67
  *
82
68
  * @returns This resource, for chaining
83
69
  */
84
- setProperty(key, value, filterHidden = false) {
70
+ setProperty(key, value) {
85
71
  if (key == null || key.trim() == "") {
86
72
  return this;
87
73
  }
88
- if (filterHidden && this.isHiddenProperty(key)) {
89
- return this;
90
- }
91
74
  if (this.payload.properties == null) {
92
75
  this.payload.properties = {};
93
76
  }
@@ -126,5 +109,60 @@ export class ResourceProperty extends Resource {
126
109
  propertyKeys = propertyKeys.sort();
127
110
  return propertyKeys;
128
111
  }
112
+ /**
113
+ * Sets a custom property in this resource, filtering out hidden properties.
114
+ * Hidden properties are those whose keys end with an underscore "_".
115
+ *
116
+ * @param key - The property key
117
+ * @param value - The property value, or null/undefined to clean it
118
+ *
119
+ * @returns This resource, for chaining
120
+ */
121
+ setVisibleProperty(key, value) {
122
+ if (this.isHiddenProperty(key)) {
123
+ return this;
124
+ }
125
+ return this.setProperty(key, value);
126
+ }
127
+ /**
128
+ * Sets the custom properties of this resource, filtering out hidden properties.
129
+ * Hidden properties are those whose keys end with an underscore "_".
130
+ *
131
+ * @param properties - Object with key/value pair properties
132
+ *
133
+ * @returns This resource, for chaining
134
+ */
135
+ setVisibleProperties(properties) {
136
+ if (properties == null) {
137
+ return this;
138
+ }
139
+ const filteredProperties = {};
140
+ for (const key in properties) {
141
+ if (Object.prototype.hasOwnProperty.call(properties, key)) {
142
+ if (!this.isHiddenProperty(key)) {
143
+ filteredProperties[key] = properties[key];
144
+ }
145
+ }
146
+ }
147
+ return this.setProperties(filteredProperties);
148
+ }
149
+ /**
150
+ * Gets the visible custom properties stored in this resource.
151
+ * Hidden properties (those ending with "_") are excluded from the result.
152
+ *
153
+ * @returns Object with key/value pair properties, excluding hidden properties
154
+ */
155
+ getVisibleProperties() {
156
+ const allProperties = this.getProperties();
157
+ const visibleProperties = {};
158
+ for (const key in allProperties) {
159
+ if (Object.prototype.hasOwnProperty.call(allProperties, key)) {
160
+ if (!this.isHiddenProperty(key)) {
161
+ visibleProperties[key] = allProperties[key];
162
+ }
163
+ }
164
+ }
165
+ return visibleProperties;
166
+ }
129
167
  }
130
168
  //# sourceMappingURL=ResourceProperty.js.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "bkper-js",
3
- "version": "2.15.2",
3
+ "version": "2.16.0",
4
4
  "description": "Javascript client for Bkper REST API",
5
5
  "main": "./lib/index.js",
6
6
  "module": "./lib/index.js",
package/CHANGELOG.md DELETED
@@ -1,385 +0,0 @@
1
- ### **Changelog**
2
-
3
- See what's new and what has changed in bkper-js
4
-
5
- ## 2025
6
-
7
- **October 2025**
8
-
9
- - Files attached to transactions are now created internally when transaction is persisted
10
- - Added `Transaction.removeFile`
11
- - Added `Book.countTransactions`
12
- - Added `Book.remove`
13
-
14
- **September 2025**
15
-
16
- - **v2.8.0 - INTERNAL REFACTOR:**
17
- - Introduced abstract `Resource` class for all model entities
18
- - Improved config management with `getConfig()` pattern for config resolution
19
- - Enhanced type safety with explicit Config type usage throughout
20
- - Standardized `json()` method across resources for consistent JSON serialization
21
- - Maintained full backward compatibility - no breaking changes to existing APIs
22
- - Added `Account.isBalanceVerified`
23
- - Added `App.getOwnerWebsiteUrl`
24
- - Added `App.getReadme`
25
- - Added `App.getRepositoryUrl`
26
- - Added `App.getWebsiteUrl`
27
- - Added `App.isInstallable`
28
- - Added `App.isRepositoryPrivate`
29
- - Added `Book.getCollaborators`
30
- - Added `Book.getBacklog`
31
- - Added `Backlog`
32
- - Added `Backlog.getCount`
33
- - Added `Collaborator`
34
- - Added `Collaborator.json`
35
- - Added `Collaborator.getId`
36
- - Added `Collaborator.getEmail`
37
- - Added `Collaborator.getPermission`
38
- - Added `Collaborator.setEmail`
39
- - Added `Collaborator.setPermission`
40
- - Added `Collaborator.create`
41
- - Added `Collaborator.update`
42
- - Added `Collaborator.remove`
43
- - Added `Group.isBalanceVerified`
44
- - Deprecated `Integration.getLogo`
45
- - Added `Integration.getLogoUrl`
46
- - Added `Integration.getLogoUrlDark`
47
- - Added `Transaction.getCreatedBy`
48
- - Replaced axios with native Fetch API for better compatibility with multiple environments
49
-
50
- **August 2025**
51
-
52
- - Added `File.getProperties`
53
- - Added `File.setProperties`
54
- - Added `File.getProperty`
55
- - Added `File.setProperty`
56
- - Added `File.deleteProperty`
57
-
58
- **July 2025**
59
-
60
- - **BREAKING CHANGE:** Refactored `Bkper` class from static methods to constructor-based pattern
61
- - **BREAKING CHANGE:** Removed deprecated methods: `Transaction.remove()`, `Transaction.restore()`, `Account.getBalance()`, `Account.getBalanceRaw()`
62
- - **MIGRATION:** Use `transaction.trash()` and `transaction.untrash()` instead of `remove()` and `restore()`
63
- - **MIGRATION:** Use `Book.getBalancesReport()` instead of `Account.getBalance()` methods
64
- - Added `Balance` class back for improved balance reporting
65
- - Added `BalancesDataTableBuilder` for building balance data tables
66
- - Added `BalanceType` enum with TOTAL, PERIOD, and CUMULATIVE options
67
- - Added `includeGroups` parameter to `Bkper.getBook()` method for selective group loading
68
-
69
- **June 2025**
70
-
71
- - Added `Book.copy`
72
- - Added `Transaction.getUpdatedAt`
73
- - Added `Transaction.getUpdatedAtFormatted`
74
-
75
- **May 2025**
76
-
77
- - Added `Group.isLocked`
78
- - Added `Group.setLocked`
79
- - Added `Query`
80
- - Added `Query.json`
81
- - Added `Query.getId`
82
- - Added `Query.getTitle`
83
- - Added `Query.setTitle`
84
- - Added `Query.getQuery`
85
- - Added `Query.setQuery`
86
- - Added `Query.create`
87
- - Added `Query.update`
88
- - Added `Query.remove`
89
- - Added `Book.getSavedQueries`
90
- - Added `Book.batchPostTransactions`
91
- - Added `Book.batchCheckTransactions`
92
- - Added `Book.batchUncheckTransactions`
93
- - Added `Book.batchUpdateTransactions`
94
- - Added `Book.batchUntrashTransactions`
95
-
96
- **April 2025**
97
-
98
- - Added `Book.batchCreateAccounts`
99
- - Added `Book.batchCreateGroups`
100
-
101
- **March 2025**
102
-
103
- - Added `Agent.getLogoUrlDark`
104
- - Added `App.getFilePatterns`
105
- - Added `App.getLogoUrlDark`
106
- - Added `App.getOwnerLogoUrl`
107
- - Added `App.getOwnerName`
108
- - Added `App.isPublished`
109
- - Added `Transaction.getAgentName`
110
- - Added `Transaction.getAgentLogoUrl`
111
- - Added `Transaction.getAgentLogoUrlDark`
112
-
113
- **February 2025**
114
-
115
- - Added `EventType` enum
116
- - Added `BotResponseType` enum
117
- - Added `Agent`
118
- - Added `Agent.getId`
119
- - Added `Agent.getLogoUrl`
120
- - Added `Agent.getName`
121
- - Added `Agent.json`
122
- - Added `App.getDescription`
123
- - Added `App.getEvents`
124
- - Added `App.getLogoUrl`
125
- - Added `App.getName`
126
- - Added `App.hasEvents`
127
- - Added `Book.batchReplayEvents`
128
- - Added `Book.getApps`
129
- - Added `BotResponse`
130
- - Added `BotResponse.getAgentId`
131
- - Added `BotResponse.getCreatedAt`
132
- - Added `BotResponse.getEvent`
133
- - Added `BotResponse.getMessage`
134
- - Added `BotResponse.getType`
135
- - Added `BotResponse.remove`
136
- - Added `BotResponse.replay`
137
- - Added `Event.getAgent`
138
- - Added `Event.getBook`
139
- - Added `Event.getBotResponses`
140
- - Added `Event.getCreatedAt`
141
- - Added `Event.getId`
142
- - Added `Event.getType`
143
- - Added `Event.getUser`
144
- - Added `Event.hasErrorResponse`
145
- - Added `User.getAvatarUrl`
146
-
147
- **January 2025**
148
-
149
- - Added `BalancesContainer`
150
- - Added `BalancesContainer.getName`
151
- - Added `BalancesContainer.getNormalizedName`
152
- - Added `BalancesContainer.getGroup`
153
- - Added `BalancesContainer.getAccount`
154
- - Added `BalancesContainer.getParent`
155
- - Added `BalancesContainer.getDepth`
156
- - Added `BalancesContainer.isCredit`
157
- - Added `BalancesContainer.isPermanent`
158
- - Added `BalancesContainer.isFromAccount`
159
- - Added `BalancesContainer.isFromGroup`
160
- - Added `BalancesContainer.hasGroupBalances`
161
- - Added `BalancesContainer.getCumulativeBalance`
162
- - Added `BalancesContainer.getCumulativeBalanceRaw`
163
- - Added `BalancesContainer.getCumulativeBalanceText`
164
- - Added `BalancesContainer.getCumulativeBalanceRawText`
165
- - Added `BalancesContainer.getPeriodBalance`
166
- - Added `BalancesContainer.getPeriodBalanceRaw`
167
- - Added `BalancesContainer.getPeriodBalanceText`
168
- - Added `BalancesContainer.getPeriodBalanceRawText`
169
- - Added `BalancesContainer.getBalancesContainers`
170
- - Added `BalancesContainer.getBalancesContainer`
171
- - Added `BalancesReport`
172
- - Added `BalancesReport.getBook`
173
- - Added `BalancesReport.getPeriod`
174
- - Added `BalancesReport.getBalancesContainers`
175
- - Added `BalancesReport.getBalancesContainer`
176
- - Added `Book.getAutoPost`
177
- - Added `Book.setAutoPost`
178
- - Added `Group.isCredit`
179
- - Added `Group.isMixed`
180
- - Added `User.getPlan`
181
- - Added `User.hasBillingEnabled`
182
-
183
- ## 2024
184
-
185
- **December 2024**
186
-
187
- - Added `Book.listEvents`
188
- - Added `EventList`
189
- - Added `EventList.getCursor`
190
- - Added `EventList.getFirst`
191
- - Added `EventList.getItems`
192
- - Added `EventList.size`
193
- - Added `Group.isPermanent`
194
- - Added `Group.hasParent`
195
- - Added `Group.getChildren`
196
- - Added `Group.getDescendants`
197
- - Added `Group.getDescendantTreeIds`
198
- - Added `Group.hasChildren`
199
- - Added `Group.isLeaf`
200
- - Added `Group.isRoot`
201
- - Added `Group.getDepth`
202
- - Added `Group.getRoot`
203
- - Added `Group.getRootName`
204
- - Added `Group.hasAccounts`
205
-
206
- **November 2024**
207
-
208
- - Added `Transaction.trash`
209
- - Added `Transaction.untrash`
210
- - Added `Transaction.getAmountFormatted`
211
- - Added `Transaction.isLocked`
212
- - Removed `Transaction.remove` from `Transaction`
213
- - Removed `Transaction.restore` from `Transaction`
214
-
215
- **October 2024**
216
-
217
- - Exposed `payload` property on all objects from `bkper-js` interface
218
- - Added `Collection.addBooks`
219
- - Added `Collection.create`
220
- - Added `Collection.getOwnerUsername`
221
- - Added `Collection.getPermission`
222
- - Added `Collection.getUpdatedAt`
223
- - Added `Collection.remove`
224
- - Added `Collection.removeBooks`
225
- - Added `Collection.setName`
226
- - Added `Collection.update`
227
- - Added `Bkper.getBillingPortalUrl`
228
- - Added `Connection.getDateAddedMs`
229
- - Added `Connection.getLogo`
230
- - Added `Connection.remove`
231
- - Added `Integration.getAddedBy`
232
- - Added `Integration.getAgentId`
233
- - Added `Integration.getDateAddedMs`
234
- - Added `Integration.getLastUpdateMs`
235
- - Added `Integration.getLogo`
236
- - Added `Integration.remove`
237
- - Added `TransactionList` returned from `Book.listTransactions`
238
- - Removed `TransactionIterator` from `Transaction`
239
- - Removed `newTransaction` from `Book`. Use `Transaction` constructor instead
240
- - Removed `newAccount` from `Book`. Use `Account` constructor instead
241
- - Removed `newGroup` from `Book`. Use `Group` constructor instead
242
- - Removed `newFile` from `Book`. Use `File` constructor instead
243
-
244
- **September 2024**
245
-
246
- - Extracted `bkper-js` from `bkper` as a standalone library.
247
- - Added `Config.requestRetryHandler`
248
- - Added `Visibility` enum
249
- - Added `App.json`
250
- - Added `Bkper.getApps`
251
- - Added `Bkper.getBooks`
252
- - Added `Bkper.getTemplates`
253
- - Added `Bkper.newBook`
254
- - Added `Book.getTotalTransactions`
255
- - Added `Book.getTotalTransactionsCurrentMonth`
256
- - Added `Book.getTotalTransactionsCurrentYear`
257
- - Added `Book.getVisibility`
258
- - Added `Book.create`
259
- - Added `Collection.json`
260
- - Added `Template`
261
- - Added `Template.getBookId`
262
- - Added `Template.getBookLink`
263
- - Added `Template.getCategory`
264
- - Added `Template.getDescription`
265
- - Added `Template.getImageUrl`
266
- - Added `Template.getName`
267
- - Added `Template.getSheetsLink`
268
- - Added `Template.getTimesUsed`
269
- - Added `Template.json`
270
- - Added `User.getEmail`
271
- - Added `User.getHostedDomain`
272
- - Added `User.isFree`
273
- - Added `User.hasStartedTrial`
274
- - Added `User.getDaysLeftInTrial`
275
- - Added `User.hasUsedConnections`
276
- - Added `User.json`
277
-
278
- **January 2024**
279
-
280
- - Added `Transaction.setChecked`
281
-
282
- ## 2023
283
-
284
- **June 2023**
285
-
286
- - Added `Bkper.getUser`
287
- - Added `Bkper.setConfig`
288
- - Added `Book.batchTrashTransactions`
289
- - Added `Book.createIntegration`
290
- - Added `Book.getIntegrations`
291
- - Added `Book.updateIntegration`
292
- - Added `Config` interface
293
- - Added `Connection`
294
- - Added `Connection.clearTokenProperties`
295
- - Added `Connection.create`
296
- - Added `Connection.deleteProperty`
297
- - Added `Connection.getAgentId`
298
- - Added `Connection.getEmail`
299
- - Added `Connection.getId`
300
- - Added `Connection.getIntegrations`
301
- - Added `Connection.getName`
302
- - Added `Connection.getProperties`
303
- - Added `Connection.getProperty`
304
- - Added `Connection.getPropertyKeys`
305
- - Added `Connection.getType`
306
- - Added `Connection.getUUID`
307
- - Added `Connection.json`
308
- - Added `Connection.setAgentId`
309
- - Added `Connection.setName`
310
- - Added `Connection.setProperties`
311
- - Added `Connection.setProperty`
312
- - Added `Connection.setType`
313
- - Added `Connection.setUUID`
314
- - Added `Integration`
315
- - Added `Integration.deleteProperty`
316
- - Added `Integration.getBookId`
317
- - Added `Integration.getId`
318
- - Added `Integration.getName`
319
- - Added `Integration.getProperties`
320
- - Added `Integration.getProperty`
321
- - Added `Integration.json`
322
- - Added `Integration.setProperties`
323
- - Added `Integration.setProperty`
324
- - Added `User`
325
- - Added `User.getConnection`
326
- - Added `User.getConnections`
327
- - Added `User.getFullName`
328
- - Added `User.getId`
329
- - Added `User.getName`
330
- - Deprecated `Bkper.setApiKey`
331
- - Deprecated `Bkper.setOAuthTokenProvider`
332
-
333
- ## 2022
334
-
335
- **September 2022**
336
-
337
- - Deprecated `Account.getBalance`
338
-
339
- **May 2022**
340
-
341
- - Added `Book.parseDate`
342
-
343
- **April 2022**
344
-
345
- - Added `Book.getClosingDate`
346
- - Added `Book.setClosingDate`
347
-
348
- ## 2021
349
-
350
- **October 2021**
351
-
352
- - Added `Book.getGroupsByAccount`
353
-
354
- **May 2021**
355
-
356
- - Added `Group.getParent`
357
- - Added `Group.setParent`
358
- - **BREAKING CHANGE:** Removed `AccountsDataTableBuilder`
359
- - **BREAKING CHANGE:** Removed `BalancesDataTableBuilder`
360
- - **BREAKING CHANGE:** Removed `TransactionsDataTableBuilder`
361
- - **BREAKING CHANGE:** Removed `BalancesReport`
362
- - **BREAKING CHANGE:** Removed `Balance`
363
- - **BREAKING CHANGE:** Removed `BalancesContainer`
364
-
365
- **April 2021**
366
-
367
- - Added `Book.getLockDate`
368
- - Added `Book.setLockDate`
369
-
370
- **March 2021**
371
-
372
- - **BREAKING CHANGE:** Removed `BalanceCheckedType`
373
-
374
- **February 2021**
375
-
376
- - Added `Book.getPeriod`
377
- - Added `Book.setPeriod`
378
- - Added `Book.getPeriodStartMonth`
379
- - Added `Book.setPeriodStartMonth`
380
- - Added `Book.getPageSize`
381
- - Added `Book.setPageSize`
382
-
383
- **January 2021**
384
-
385
- - `bkper` client library published