bkper-js 2.17.2 → 2.18.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/CHANGELOG.md +16 -0
- package/lib/index.d.ts +7 -0
- package/lib/service/http-api-request.js +12 -0
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -4,6 +4,22 @@ See what's new and what has changed in bkper-js
|
|
|
4
4
|
|
|
5
5
|
## 2025
|
|
6
6
|
|
|
7
|
+
**December 2025**
|
|
8
|
+
- Added `File.update`
|
|
9
|
+
- Added `EventType.FILE_UPDATED`
|
|
10
|
+
|
|
11
|
+
**November 2025**
|
|
12
|
+
- **v2.15.2 - INTERNAL REFACTOR:**
|
|
13
|
+
- Introduced `ResourceProperty` abstract class for model entities that support custom properties
|
|
14
|
+
- Moved shared property methods to ResourceProperty
|
|
15
|
+
- Refactor 7 model classes to extend ResourceProperty instead of Resource
|
|
16
|
+
- Eliminate ~350 lines of duplicated property management code
|
|
17
|
+
- Maintained full backward compatibility - no breaking changes to existing APIs
|
|
18
|
+
- Added `ResourceProperty.setVisibleProperty`
|
|
19
|
+
- Added `ResourceProperty.setVisibleProperties`
|
|
20
|
+
- Added `ResourceProperty.getVisibleProperties`
|
|
21
|
+
- Added `Bkper.getConfig`
|
|
22
|
+
|
|
7
23
|
**October 2025**
|
|
8
24
|
|
|
9
25
|
- Files attached to transactions are now created internally when transaction is persisted
|
package/lib/index.d.ts
CHANGED
|
@@ -2134,6 +2134,13 @@ export declare interface Config {
|
|
|
2134
2134
|
* Issue a valid OAuth2 access token with **https://www.googleapis.com/auth/userinfo.email** scope authorized.
|
|
2135
2135
|
*/
|
|
2136
2136
|
oauthTokenProvider?: () => Promise<string | undefined>;
|
|
2137
|
+
/**
|
|
2138
|
+
* Provides the agent ID to identify the calling agent for attribution purposes.
|
|
2139
|
+
*
|
|
2140
|
+
* This ID is sent via the `bkper-agent-id` header with each API request,
|
|
2141
|
+
* allowing the server to attribute actions to the correct agent.
|
|
2142
|
+
*/
|
|
2143
|
+
agentIdProvider?: () => Promise<string | undefined>;
|
|
2137
2144
|
/**
|
|
2138
2145
|
* Provides additional headers to append to the API request
|
|
2139
2146
|
*/
|
|
@@ -21,6 +21,7 @@ export class HttpApiRequest extends HttpRequest {
|
|
|
21
21
|
});
|
|
22
22
|
return __awaiter(this, void 0, void 0, function* () {
|
|
23
23
|
this.addCustomHeaders();
|
|
24
|
+
yield this.addAgentIdHeader();
|
|
24
25
|
this.setHeader("Authorization", `Bearer ${yield this.getAccessToken()}`);
|
|
25
26
|
this.addParam("key", yield this.getApiKey());
|
|
26
27
|
try {
|
|
@@ -108,6 +109,17 @@ export class HttpApiRequest extends HttpRequest {
|
|
|
108
109
|
}
|
|
109
110
|
});
|
|
110
111
|
}
|
|
112
|
+
addAgentIdHeader() {
|
|
113
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
114
|
+
const effectiveConfig = this.config;
|
|
115
|
+
if (effectiveConfig.agentIdProvider) {
|
|
116
|
+
const agentId = yield effectiveConfig.agentIdProvider();
|
|
117
|
+
if (agentId) {
|
|
118
|
+
this.setHeader('bkper-agent-id', agentId);
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
});
|
|
122
|
+
}
|
|
111
123
|
getApiKey() {
|
|
112
124
|
return __awaiter(this, void 0, void 0, function* () {
|
|
113
125
|
const effectiveConfig = this.config;
|