bkper-js 2.36.0 → 2.38.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/dist/bkper.min.js +2 -2
- package/dist/bkper.min.js.map +3 -3
- package/lib/index.d.ts +42 -2
- package/lib/model/Collaborator.js +8 -0
- package/lib/model/Connection.js +18 -7
- package/lib/model/Integration.js +28 -3
- package/lib/model/ResourceProperty.js +14 -0
- package/package.json +2 -2
package/lib/index.d.ts
CHANGED
|
@@ -2328,6 +2328,12 @@ export declare class Collaborator extends Resource<bkper.Collaborator> {
|
|
|
2328
2328
|
* @returns This Collaborator, for chaining
|
|
2329
2329
|
*/
|
|
2330
2330
|
setPermission(permission: Permission): Collaborator;
|
|
2331
|
+
/**
|
|
2332
|
+
* Gets the public avatar url of the Collaborator.
|
|
2333
|
+
*
|
|
2334
|
+
* @returns The Collaborator's public avatar url
|
|
2335
|
+
*/
|
|
2336
|
+
getAvatarUrl(): string | undefined;
|
|
2331
2337
|
/**
|
|
2332
2338
|
* Performs create new Collaborator.
|
|
2333
2339
|
*
|
|
@@ -2574,7 +2580,7 @@ export declare class Connection extends ResourceProperty<bkper.Connection> {
|
|
|
2574
2580
|
*
|
|
2575
2581
|
* @returns The Connection type
|
|
2576
2582
|
*/
|
|
2577
|
-
getType():
|
|
2583
|
+
getType(): 'APP' | 'BANK' | undefined;
|
|
2578
2584
|
/**
|
|
2579
2585
|
* Sets the Connection type.
|
|
2580
2586
|
*
|
|
@@ -2582,7 +2588,7 @@ export declare class Connection extends ResourceProperty<bkper.Connection> {
|
|
|
2582
2588
|
*
|
|
2583
2589
|
* @returns The Connection, for chaining
|
|
2584
2590
|
*/
|
|
2585
|
-
setType(type:
|
|
2591
|
+
setType(type: 'APP' | 'BANK'): Connection;
|
|
2586
2592
|
/**
|
|
2587
2593
|
* Cleans any token property stored in the Connection.
|
|
2588
2594
|
*/
|
|
@@ -2599,6 +2605,12 @@ export declare class Connection extends ResourceProperty<bkper.Connection> {
|
|
|
2599
2605
|
* @returns The created Connection, for chaining
|
|
2600
2606
|
*/
|
|
2601
2607
|
create(): Promise<Connection>;
|
|
2608
|
+
/**
|
|
2609
|
+
* Performs update Connection.
|
|
2610
|
+
*
|
|
2611
|
+
* @returns The updated Connection object
|
|
2612
|
+
*/
|
|
2613
|
+
update(): Promise<Connection>;
|
|
2602
2614
|
/**
|
|
2603
2615
|
* Performs remove Connection.
|
|
2604
2616
|
*
|
|
@@ -3197,6 +3209,14 @@ export declare class Integration extends ResourceProperty<bkper.Integration> {
|
|
|
3197
3209
|
* @returns The Integration's name
|
|
3198
3210
|
*/
|
|
3199
3211
|
getName(): string | undefined;
|
|
3212
|
+
/**
|
|
3213
|
+
* Sets the name of the Integration.
|
|
3214
|
+
*
|
|
3215
|
+
* @param name - The name of the Integration
|
|
3216
|
+
*
|
|
3217
|
+
* @returns The Integration, for chaining
|
|
3218
|
+
*/
|
|
3219
|
+
setName(name: string): Integration;
|
|
3200
3220
|
/**
|
|
3201
3221
|
* Gets the name of the user who added the Integration.
|
|
3202
3222
|
*
|
|
@@ -3241,6 +3261,12 @@ export declare class Integration extends ResourceProperty<bkper.Integration> {
|
|
|
3241
3261
|
* @returns The Integration last update date in milliseconds
|
|
3242
3262
|
*/
|
|
3243
3263
|
getLastUpdateMs(): string | undefined;
|
|
3264
|
+
/**
|
|
3265
|
+
* Performs update Integration.
|
|
3266
|
+
*
|
|
3267
|
+
* @returns The updated Integration object
|
|
3268
|
+
*/
|
|
3269
|
+
update(): Promise<Integration>;
|
|
3244
3270
|
/**
|
|
3245
3271
|
* Performs remove Integration.
|
|
3246
3272
|
*
|
|
@@ -3457,6 +3483,16 @@ declare abstract class Resource<T = any> {
|
|
|
3457
3483
|
* Extends Resource<T> and adds property management methods for entities
|
|
3458
3484
|
* that have a properties field in their payload.
|
|
3459
3485
|
*
|
|
3486
|
+
* Custom property keys are normalized and validated by the Bkper API when
|
|
3487
|
+
* resources are persisted:
|
|
3488
|
+
*
|
|
3489
|
+
* - Keys can have up to 30 characters after normalization.
|
|
3490
|
+
* - Keys are normalized to lowercase, spaces become underscores, and unsupported
|
|
3491
|
+
* punctuation is removed.
|
|
3492
|
+
* - Keys ending with an underscore (`_`) are treated as hidden/internal by SDK
|
|
3493
|
+
* visible-property helpers.
|
|
3494
|
+
* - Empty, null, or undefined values clear the property when saved.
|
|
3495
|
+
*
|
|
3460
3496
|
* @public
|
|
3461
3497
|
*/
|
|
3462
3498
|
declare abstract class ResourceProperty<T extends {
|
|
@@ -3494,6 +3530,10 @@ declare abstract class ResourceProperty<T extends {
|
|
|
3494
3530
|
/**
|
|
3495
3531
|
* Sets a custom property in this resource.
|
|
3496
3532
|
*
|
|
3533
|
+
* Property keys are normalized and validated by the API when saved. Keep keys
|
|
3534
|
+
* to 30 characters or fewer after normalization. Use a trailing underscore
|
|
3535
|
+
* (`_`) for hidden/internal properties.
|
|
3536
|
+
*
|
|
3497
3537
|
* @param key - The property key
|
|
3498
3538
|
* @param value - The property value, or null/undefined to clean it
|
|
3499
3539
|
*
|
|
@@ -71,6 +71,14 @@ export class Collaborator extends Resource {
|
|
|
71
71
|
this.payload.permission = permission;
|
|
72
72
|
return this;
|
|
73
73
|
}
|
|
74
|
+
/**
|
|
75
|
+
* Gets the public avatar url of the Collaborator.
|
|
76
|
+
*
|
|
77
|
+
* @returns The Collaborator's public avatar url
|
|
78
|
+
*/
|
|
79
|
+
getAvatarUrl() {
|
|
80
|
+
return this.payload.avatarUrl;
|
|
81
|
+
}
|
|
74
82
|
/**
|
|
75
83
|
* Performs create new Collaborator.
|
|
76
84
|
*
|
package/lib/model/Connection.js
CHANGED
|
@@ -7,10 +7,10 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
7
7
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
8
|
});
|
|
9
9
|
};
|
|
10
|
-
import { ResourceProperty } from
|
|
11
|
-
import { Bkper } from
|
|
12
|
-
import * as ConnectionService from
|
|
13
|
-
import { Integration } from
|
|
10
|
+
import { ResourceProperty } from './ResourceProperty.js';
|
|
11
|
+
import { Bkper } from './Bkper.js';
|
|
12
|
+
import * as ConnectionService from '../service/connection-service.js';
|
|
13
|
+
import { Integration } from './Integration.js';
|
|
14
14
|
/**
|
|
15
15
|
* This class defines a Connection from an [[User]] to an external service.
|
|
16
16
|
*
|
|
@@ -138,8 +138,8 @@ export class Connection extends ResourceProperty {
|
|
|
138
138
|
*/
|
|
139
139
|
clearTokenProperties() {
|
|
140
140
|
this.getPropertyKeys()
|
|
141
|
-
.filter(
|
|
142
|
-
.forEach(
|
|
141
|
+
.filter(key => key.includes('token'))
|
|
142
|
+
.forEach(key => this.deleteProperty(key));
|
|
143
143
|
}
|
|
144
144
|
/**
|
|
145
145
|
* Gets the existing [[Integrations]] on the Connection.
|
|
@@ -153,7 +153,7 @@ export class Connection extends ResourceProperty {
|
|
|
153
153
|
return [];
|
|
154
154
|
}
|
|
155
155
|
const integrationsPlain = yield ConnectionService.listIntegrations(id, this.getConfig());
|
|
156
|
-
const integrations = integrationsPlain.map(
|
|
156
|
+
const integrations = integrationsPlain.map(i => new Integration(i, this.config));
|
|
157
157
|
return integrations;
|
|
158
158
|
});
|
|
159
159
|
}
|
|
@@ -168,6 +168,17 @@ export class Connection extends ResourceProperty {
|
|
|
168
168
|
return this;
|
|
169
169
|
});
|
|
170
170
|
}
|
|
171
|
+
/**
|
|
172
|
+
* Performs update Connection.
|
|
173
|
+
*
|
|
174
|
+
* @returns The updated Connection object
|
|
175
|
+
*/
|
|
176
|
+
update() {
|
|
177
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
178
|
+
this.payload = yield ConnectionService.updateConnection(this.payload, this.getConfig());
|
|
179
|
+
return this;
|
|
180
|
+
});
|
|
181
|
+
}
|
|
171
182
|
/**
|
|
172
183
|
* Performs remove Connection.
|
|
173
184
|
*
|
package/lib/model/Integration.js
CHANGED
|
@@ -7,9 +7,9 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
7
7
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
8
|
});
|
|
9
9
|
};
|
|
10
|
-
import * as IntegrationService from
|
|
11
|
-
import { ResourceProperty } from
|
|
12
|
-
import { Bkper } from
|
|
10
|
+
import * as IntegrationService from '../service/integration-service.js';
|
|
11
|
+
import { ResourceProperty } from './ResourceProperty.js';
|
|
12
|
+
import { Bkper } from './Bkper.js';
|
|
13
13
|
/**
|
|
14
14
|
* This class defines a Integration from an [[User]] to an external service.
|
|
15
15
|
*
|
|
@@ -48,6 +48,17 @@ export class Integration extends ResourceProperty {
|
|
|
48
48
|
getName() {
|
|
49
49
|
return this.payload.name;
|
|
50
50
|
}
|
|
51
|
+
/**
|
|
52
|
+
* Sets the name of the Integration.
|
|
53
|
+
*
|
|
54
|
+
* @param name - The name of the Integration
|
|
55
|
+
*
|
|
56
|
+
* @returns The Integration, for chaining
|
|
57
|
+
*/
|
|
58
|
+
setName(name) {
|
|
59
|
+
this.payload.name = name;
|
|
60
|
+
return this;
|
|
61
|
+
}
|
|
51
62
|
/**
|
|
52
63
|
* Gets the name of the user who added the Integration.
|
|
53
64
|
*
|
|
@@ -106,6 +117,20 @@ export class Integration extends ResourceProperty {
|
|
|
106
117
|
getLastUpdateMs() {
|
|
107
118
|
return this.payload.lastUpdateMs;
|
|
108
119
|
}
|
|
120
|
+
/**
|
|
121
|
+
* Performs update Integration.
|
|
122
|
+
*
|
|
123
|
+
* @returns The updated Integration object
|
|
124
|
+
*/
|
|
125
|
+
update() {
|
|
126
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
127
|
+
const bookId = this.getBookId();
|
|
128
|
+
if (bookId) {
|
|
129
|
+
this.payload = yield IntegrationService.updateIntegration(bookId, this.payload, this.getConfig());
|
|
130
|
+
}
|
|
131
|
+
return this;
|
|
132
|
+
});
|
|
133
|
+
}
|
|
109
134
|
/**
|
|
110
135
|
* Performs remove Integration.
|
|
111
136
|
*
|
|
@@ -5,6 +5,16 @@ import { Resource } from "./Resource.js";
|
|
|
5
5
|
* Extends Resource<T> and adds property management methods for entities
|
|
6
6
|
* that have a properties field in their payload.
|
|
7
7
|
*
|
|
8
|
+
* Custom property keys are normalized and validated by the Bkper API when
|
|
9
|
+
* resources are persisted:
|
|
10
|
+
*
|
|
11
|
+
* - Keys can have up to 30 characters after normalization.
|
|
12
|
+
* - Keys are normalized to lowercase, spaces become underscores, and unsupported
|
|
13
|
+
* punctuation is removed.
|
|
14
|
+
* - Keys ending with an underscore (`_`) are treated as hidden/internal by SDK
|
|
15
|
+
* visible-property helpers.
|
|
16
|
+
* - Empty, null, or undefined values clear the property when saved.
|
|
17
|
+
*
|
|
8
18
|
* @public
|
|
9
19
|
*/
|
|
10
20
|
export class ResourceProperty extends Resource {
|
|
@@ -62,6 +72,10 @@ export class ResourceProperty extends Resource {
|
|
|
62
72
|
/**
|
|
63
73
|
* Sets a custom property in this resource.
|
|
64
74
|
*
|
|
75
|
+
* Property keys are normalized and validated by the API when saved. Keep keys
|
|
76
|
+
* to 30 characters or fewer after normalization. Use a trailing underscore
|
|
77
|
+
* (`_`) for hidden/internal properties.
|
|
78
|
+
*
|
|
65
79
|
* @param key - The property key
|
|
66
80
|
* @param value - The property value, or null/undefined to clean it
|
|
67
81
|
*
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "bkper-js",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.38.0",
|
|
4
4
|
"description": "Javascript client for Bkper REST API",
|
|
5
5
|
"main": "./lib/index.js",
|
|
6
6
|
"module": "./lib/index.js",
|
|
@@ -38,7 +38,7 @@
|
|
|
38
38
|
"release:major": "npm version major -m \"chore(release): v%s\""
|
|
39
39
|
},
|
|
40
40
|
"dependencies": {
|
|
41
|
-
"@bkper/bkper-api-types": "^5.
|
|
41
|
+
"@bkper/bkper-api-types": "^5.42.0",
|
|
42
42
|
"big.js": "^6.0.3",
|
|
43
43
|
"dayjs": "^1.10.3",
|
|
44
44
|
"luxon": "^1.25.0",
|