bkper-js 1.47.2 → 2.0.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.
@@ -29,18 +29,24 @@ export class Group {
29
29
  };
30
30
  }
31
31
  /**
32
+ * Gets an immutable copy of the json payload.
33
+ *
32
34
  * @returns An immutable copy of the json payload
33
35
  */
34
36
  json() {
35
37
  return Object.assign({}, this.payload);
36
38
  }
37
39
  /**
40
+ * Gets the id of this Group.
41
+ *
38
42
  * @returns The id of this Group
39
43
  */
40
44
  getId() {
41
45
  return this.payload.id;
42
46
  }
43
47
  /**
48
+ * Gets the name of this Group.
49
+ *
44
50
  * @returns The name of this Group
45
51
  */
46
52
  getName() {
@@ -49,7 +55,7 @@ export class Group {
49
55
  /**
50
56
  * Sets the name of the Group.
51
57
  *
52
- * @returns This Group, for chainning.
58
+ * @returns This Group, for chaining
53
59
  */
54
60
  setName(name) {
55
61
  this.payload.name = name;
@@ -58,7 +64,7 @@ export class Group {
58
64
  /**
59
65
  * Tells if the Group is locked by the Book owner.
60
66
  *
61
- * @returns True if the Group is locked.
67
+ * @returns True if the Group is locked
62
68
  */
63
69
  isLocked() {
64
70
  if (this.payload.locked == null) {
@@ -71,13 +77,15 @@ export class Group {
71
77
  *
72
78
  * @param locked - The locked state of the Group.
73
79
  *
74
- * @returns This Group, for chainning.
80
+ * @returns This Group, for chaining
75
81
  */
76
82
  setLocked(locked) {
77
83
  this.payload.locked = locked;
78
84
  return this;
79
85
  }
80
86
  /**
87
+ * Gets the normalized name of this group without spaces and special characters.
88
+ *
81
89
  * @returns The name of this group without spaces and special characters
82
90
  */
83
91
  getNormalizedName() {
@@ -89,7 +97,9 @@ export class Group {
89
97
  }
90
98
  }
91
99
  /**
92
- * @returns All Accounts of this group.
100
+ * Gets all Accounts of this group.
101
+ *
102
+ * @returns All Accounts of this group
93
103
  */
94
104
  getAccounts() {
95
105
  return __awaiter(this, void 0, void 0, function* () {
@@ -105,13 +115,17 @@ export class Group {
105
115
  });
106
116
  }
107
117
  /**
118
+ * Gets the type of the accounts of this group.
119
+ *
108
120
  * @returns The type for of the accounts of this group. Null if mixed
109
121
  */
110
122
  getType() {
111
123
  return this.payload.type;
112
124
  }
113
125
  /**
114
- * Gets the custom properties stored in this Group
126
+ * Gets the custom properties stored in this Group.
127
+ *
128
+ * @returns The custom properties as a key/value object
115
129
  */
116
130
  getProperties() {
117
131
  return this.payload.properties != null ? Object.assign({}, this.payload.properties) : {};
@@ -121,16 +135,18 @@ export class Group {
121
135
  *
122
136
  * @param properties - Object with key/value pair properties
123
137
  *
124
- * @returns This Group, for chainning.
138
+ * @returns This Group, for chaining
125
139
  */
126
140
  setProperties(properties) {
127
141
  this.payload.properties = Object.assign({}, properties);
128
142
  return this;
129
143
  }
130
144
  /**
131
- * Gets the property value for given keys. First property found will be retrieved
145
+ * Gets the property value for given keys. First property found will be retrieved.
132
146
  *
133
147
  * @param keys - The property key
148
+ *
149
+ * @returns The property value, or undefined if not found
134
150
  */
135
151
  getProperty(...keys) {
136
152
  for (let index = 0; index < keys.length; index++) {
@@ -147,6 +163,8 @@ export class Group {
147
163
  *
148
164
  * @param key - The property key
149
165
  * @param value - The property value
166
+ *
167
+ * @returns This Group, for chaining
150
168
  */
151
169
  setProperty(key, value) {
152
170
  if (key == null || key.trim() == '') {
@@ -166,44 +184,58 @@ export class Group {
166
184
  *
167
185
  * @param key - The property key
168
186
  *
169
- * @returns This Group, for chainning.
187
+ * @returns This Group, for chaining
170
188
  */
171
189
  deleteProperty(key) {
172
190
  this.setProperty(key, null);
173
191
  return this;
174
192
  }
175
193
  /**
176
- * Tell if the Group is hidden on main transactions menu
194
+ * Tells if the Group is hidden on main transactions menu.
195
+ *
196
+ * @returns True if the Group is hidden, false otherwise
177
197
  */
178
198
  isHidden() {
179
199
  return this.payload.hidden;
180
200
  }
181
201
  /**
182
- * Hide/Show group on main menu.
202
+ * Hide/Show group on main menu.
203
+ *
204
+ * @param hidden - Whether to hide the group
205
+ *
206
+ * @returns This Group, for chaining
183
207
  */
184
208
  setHidden(hidden) {
185
209
  this.payload.hidden = hidden;
186
210
  return this;
187
211
  }
188
212
  /**
189
- * Tell if this is a credit (Incoming and Liabities) group
213
+ * Tells if this is a credit (Incoming and Liabilities) group.
214
+ *
215
+ * @returns True if this is a credit group
190
216
  */
191
217
  isCredit() {
192
218
  return this.payload.credit;
193
219
  }
194
220
  /**
195
- * Tell if this is a mixed (Assets/Liabilities or Incoming/Outgoing) group
221
+ * Tells if this is a mixed (Assets/Liabilities or Incoming/Outgoing) group.
222
+ *
223
+ * @returns True if this is a mixed group
196
224
  */
197
225
  isMixed() {
198
226
  return this.payload.mixed;
199
227
  }
200
228
  /**
201
- * Tell if the Group is permanent
229
+ * Tells if the Group is permanent.
230
+ *
231
+ * @returns True if the Group is permanent
202
232
  */
203
233
  isPermanent() {
204
234
  return this.payload.permanent;
205
235
  }
206
236
  /**
237
+ * Gets the parent Group.
238
+ *
207
239
  * @returns The parent Group
208
240
  */
209
241
  getParent() {
@@ -212,7 +244,9 @@ export class Group {
212
244
  /**
213
245
  * Sets the parent Group.
214
246
  *
215
- * @returns This Group, for chainning.
247
+ * @param group - The parent Group to set
248
+ *
249
+ * @returns This Group, for chaining
216
250
  */
217
251
  setParent(group) {
218
252
  if (group) {
@@ -226,15 +260,15 @@ export class Group {
226
260
  /**
227
261
  * Checks if the Group has a parent.
228
262
  *
229
- * @returns True if the Group has a parent, otherwise false.
263
+ * @returns True if the Group has a parent, otherwise false
230
264
  */
231
265
  hasParent() {
232
266
  return this.payload.parent != null;
233
267
  }
234
268
  /**
235
- * Retrieves the children of the Group.
269
+ * Gets the children of the Group.
236
270
  *
237
- * @returns An array of child Groups.
271
+ * @returns An array of child Groups
238
272
  */
239
273
  getChildren() {
240
274
  return Array.from(this.children.values()) || [];
@@ -247,9 +281,9 @@ export class Group {
247
281
  }
248
282
  }
249
283
  /**
250
- * Retrieves all descendant Groups of the current Group.
284
+ * Gets all descendant Groups of the current Group.
251
285
  *
252
- * @returns A set of descendant Groups.
286
+ * @returns A set of descendant Groups
253
287
  */
254
288
  getDescendants() {
255
289
  const descendants = new Set();
@@ -257,9 +291,9 @@ export class Group {
257
291
  return descendants;
258
292
  }
259
293
  /**
260
- * Retrieves the IDs of all descendant Groups in a tree structure.
294
+ * Gets the IDs of all descendant Groups in a tree structure.
261
295
  *
262
- * @returns A set of descendant Group IDs.
296
+ * @returns A set of descendant Group IDs
263
297
  */
264
298
  getDescendantTreeIds() {
265
299
  return new Set(Array.from(this.getDescendants()).map(g => g.getId() || ""));
@@ -267,7 +301,7 @@ export class Group {
267
301
  /**
268
302
  * Checks if the Group has any children.
269
303
  *
270
- * @returns True if the Group has children, otherwise false.
304
+ * @returns True if the Group has children, otherwise false
271
305
  */
272
306
  hasChildren() {
273
307
  return this.getChildren().length > 0;
@@ -275,7 +309,7 @@ export class Group {
275
309
  /**
276
310
  * Checks if the Group is a leaf node (i.e., has no children).
277
311
  *
278
- * @returns True if the Group is a leaf, otherwise false.
312
+ * @returns True if the Group is a leaf, otherwise false
279
313
  */
280
314
  isLeaf() {
281
315
  return this.getChildren().length === 0;
@@ -283,15 +317,15 @@ export class Group {
283
317
  /**
284
318
  * Checks if the Group is a root node (i.e., has no parent).
285
319
  *
286
- * @returns True if the Group is a root, otherwise false.
320
+ * @returns True if the Group is a root, otherwise false
287
321
  */
288
322
  isRoot() {
289
323
  return this.getParent() == undefined;
290
324
  }
291
325
  /**
292
- * Retrieves the depth of the Group in the hierarchy.
326
+ * Gets the depth of the Group in the hierarchy.
293
327
  *
294
- * @returns The depth of the Group.
328
+ * @returns The depth of the Group
295
329
  */
296
330
  getDepth() {
297
331
  if (this.depth == undefined) {
@@ -305,9 +339,9 @@ export class Group {
305
339
  return this.depth;
306
340
  }
307
341
  /**
308
- * Retrieves the root Group of the current Group.
342
+ * Gets the root Group of the current Group.
309
343
  *
310
- * @returns The root Group.
344
+ * @returns The root Group
311
345
  */
312
346
  getRoot() {
313
347
  if (this.root == undefined) {
@@ -321,9 +355,9 @@ export class Group {
321
355
  return this.root;
322
356
  }
323
357
  /**
324
- * Retrieves the name of the root Group.
358
+ * Gets the name of the root Group.
325
359
  *
326
- * @returns The name of the root Group.
360
+ * @returns The name of the root Group
327
361
  */
328
362
  getRootName() {
329
363
  const root = this.getRoot();
@@ -366,13 +400,17 @@ export class Group {
366
400
  }
367
401
  }
368
402
  /**
403
+ * Tells if this group has any account in it.
404
+ *
369
405
  * @returns True if this group has any account in it
370
406
  */
371
407
  hasAccounts() {
372
408
  return this.payload.hasAccounts;
373
409
  }
374
410
  /**
375
- * Perform create new group.
411
+ * Performs create new group.
412
+ *
413
+ * @returns A promise that resolves to this Group
376
414
  */
377
415
  create() {
378
416
  return __awaiter(this, void 0, void 0, function* () {
@@ -382,7 +420,9 @@ export class Group {
382
420
  });
383
421
  }
384
422
  /**
385
- * Perform update group, applying pending changes.
423
+ * Performs update group, applying pending changes.
424
+ *
425
+ * @returns A promise that resolves to this Group
386
426
  */
387
427
  update() {
388
428
  return __awaiter(this, void 0, void 0, function* () {
@@ -392,7 +432,9 @@ export class Group {
392
432
  });
393
433
  }
394
434
  /**
395
- * Perform delete group.
435
+ * Performs delete group.
436
+ *
437
+ * @returns A promise that resolves to this Group
396
438
  */
397
439
  remove() {
398
440
  return __awaiter(this, void 0, void 0, function* () {
@@ -18,6 +18,8 @@ export class Integration {
18
18
  this.payload = payload || {};
19
19
  }
20
20
  /**
21
+ * Gets an immutable copy of the JSON payload for this Integration.
22
+ *
21
23
  * @returns An immutable copy of the json payload
22
24
  */
23
25
  json() {
@@ -100,7 +102,7 @@ export class Integration {
100
102
  *
101
103
  * @param properties - Object with key/value pair properties
102
104
  *
103
- * @returns The Integration, for chainning
105
+ * @returns The Integration, for chaining
104
106
  */
105
107
  setProperties(properties) {
106
108
  this.payload.properties = Object.assign({}, properties);
@@ -149,7 +151,7 @@ export class Integration {
149
151
  *
150
152
  * @param key - The property key
151
153
  *
152
- * @returns The Integration, for chainning
154
+ * @returns The Integration, for chaining
153
155
  */
154
156
  deleteProperty(key) {
155
157
  this.setProperty(key, null);
@@ -23,12 +23,15 @@ export class Message {
23
23
  this.payload = payload || {};
24
24
  }
25
25
  /**
26
+ * Gets the wrapped plain json object.
27
+ *
26
28
  * @returns The wrapped plain json object
27
29
  */
28
30
  json() {
29
31
  return Object.assign({}, this.payload);
30
32
  }
31
33
  /**
34
+ * Gets the Message universal identifier.
32
35
  *
33
36
  * @returns The Message universal identifier
34
37
  */
@@ -36,13 +39,15 @@ export class Message {
36
39
  return this.payload.id;
37
40
  }
38
41
  /**
42
+ * Gets the Agent associated with the Message.
39
43
  *
40
- * @returns The Agent associated with the Message, in any
44
+ * @returns The Agent associated with the Message, if any
41
45
  */
42
46
  getAgent() {
43
47
  return this.payload.agent ? new Agent(this.payload.agent) : undefined;
44
48
  }
45
49
  /**
50
+ * Gets the Conversation of the Message.
46
51
  *
47
52
  * @returns The Conversation of the Message
48
53
  */
@@ -50,6 +55,7 @@ export class Message {
50
55
  return this.conversation;
51
56
  }
52
57
  /**
58
+ * Gets the User associated with the Message.
53
59
  *
54
60
  * @returns The User associated with the Message
55
61
  */
@@ -57,6 +63,7 @@ export class Message {
57
63
  return this.payload.user ? new User(this.payload.user) : undefined;
58
64
  }
59
65
  /**
66
+ * Gets the Date the Message was created.
60
67
  *
61
68
  * @returns The Date the Message was created
62
69
  */
@@ -64,6 +71,7 @@ export class Message {
64
71
  return this.payload.createdAt ? new Date(new Number(this.payload.createdAt).valueOf()) : undefined;
65
72
  }
66
73
  /**
74
+ * Gets the text content of the Message.
67
75
  *
68
76
  * @returns The text content of the Message
69
77
  */
@@ -71,8 +79,9 @@ export class Message {
71
79
  return this.payload.content;
72
80
  }
73
81
  /**
82
+ * Sets the text content of the Message.
74
83
  *
75
- * @param content The text content of the Message
84
+ * @param content - The text content of the Message
76
85
  *
77
86
  * @returns This Message, for chaining
78
87
  */
@@ -81,6 +90,8 @@ export class Message {
81
90
  return this;
82
91
  }
83
92
  /**
93
+ * Gets the custom properties stored in this Message.
94
+ *
84
95
  * @returns The custom properties stored in this Message
85
96
  */
86
97
  getProperties() {
@@ -91,7 +102,7 @@ export class Message {
91
102
  *
92
103
  * @param properties - Object with key/value pair properties
93
104
  *
94
- * @returns This Message, for chainning.
105
+ * @returns This Message, for chaining
95
106
  */
96
107
  setProperties(properties) {
97
108
  this.payload.properties = Object.assign({}, properties);
@@ -120,7 +131,7 @@ export class Message {
120
131
  * @param key - The property key
121
132
  * @param value - The property value
122
133
  *
123
- * @returns This Message, for chainning.
134
+ * @returns This Message, for chaining
124
135
  */
125
136
  setProperty(key, value) {
126
137
  if (key == null || key.trim() == '') {
@@ -140,7 +151,7 @@ export class Message {
140
151
  *
141
152
  * @param key - The property key
142
153
  *
143
- * @returns This Message, for chainning.
154
+ * @returns This Message, for chaining
144
155
  */
145
156
  deleteProperty(key) {
146
157
  this.setProperty(key, null);
@@ -173,6 +184,8 @@ export class Message {
173
184
  }
174
185
  /**
175
186
  * Streams the Message to the Bkper API.
187
+ *
188
+ * @returns A Promise that resolves when the streaming is complete
176
189
  */
177
190
  stream() {
178
191
  return __awaiter(this, void 0, void 0, function* () {
@@ -21,19 +21,25 @@ export class Query {
21
21
  this.payload = payload || {};
22
22
  }
23
23
  /**
24
+ * Gets the wrapped plain json object.
25
+ *
24
26
  * @returns The wrapped plain json object
25
27
  */
26
28
  json() {
27
29
  return Object.assign({}, this.payload);
28
30
  }
29
31
  /**
32
+ * Gets the Query universal identifier.
33
+ *
30
34
  * @returns The Query universal identifier
31
35
  */
32
36
  getId() {
33
37
  return this.payload.id;
34
38
  }
35
39
  /**
36
- * @return The title of this saved Query
40
+ * Gets the title of this saved Query.
41
+ *
42
+ * @returns The title of this saved Query
37
43
  */
38
44
  getTitle() {
39
45
  return this.payload.title;
@@ -41,7 +47,7 @@ export class Query {
41
47
  /**
42
48
  * Sets the title of this saved Query.
43
49
  *
44
- * @param title The title of this saved Query
50
+ * @param title - The title of this saved Query
45
51
  *
46
52
  * @returns This Query, for chaining
47
53
  */
@@ -50,7 +56,9 @@ export class Query {
50
56
  return this;
51
57
  }
52
58
  /**
53
- * @return This Query string to be executed
59
+ * Gets the query string to be executed.
60
+ *
61
+ * @returns This Query string to be executed
54
62
  */
55
63
  getQuery() {
56
64
  return this.payload.query;
@@ -58,7 +66,7 @@ export class Query {
58
66
  /**
59
67
  * Sets the query string associated with this saved Query.
60
68
  *
61
- * @param query The query string to be executed
69
+ * @param query - The query string to be executed
62
70
  *
63
71
  * @returns This Query, for chaining
64
72
  */
@@ -68,6 +76,8 @@ export class Query {
68
76
  }
69
77
  /**
70
78
  * Perform create new Query.
79
+ *
80
+ * @returns This Query, for chaining
71
81
  */
72
82
  create() {
73
83
  return __awaiter(this, void 0, void 0, function* () {
@@ -78,6 +88,8 @@ export class Query {
78
88
  }
79
89
  /**
80
90
  * Perform update Query, applying pending changes.
91
+ *
92
+ * @returns This Query, for chaining
81
93
  */
82
94
  update() {
83
95
  return __awaiter(this, void 0, void 0, function* () {
@@ -88,6 +100,8 @@ export class Query {
88
100
  }
89
101
  /**
90
102
  * Perform delete Query.
103
+ *
104
+ * @returns This Query, for chaining
91
105
  */
92
106
  remove() {
93
107
  return __awaiter(this, void 0, void 0, function* () {
@@ -10,6 +10,8 @@ export class Template {
10
10
  this.payload = json || {};
11
11
  }
12
12
  /**
13
+ * Gets an immutable copy of the JSON payload for this Template.
14
+ *
13
15
  * @returns An immutable copy of the json payload
14
16
  */
15
17
  json() {