bkper-js 2.35.0 → 2.35.2
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 +1 -1
- package/dist/bkper.min.js.map +3 -3
- package/lib/index.d.ts +7 -3
- package/lib/model/Book.js +2 -2
- package/lib/service/http-api-request.js +4 -4
- package/package.json +1 -1
package/lib/index.d.ts
CHANGED
|
@@ -2033,14 +2033,14 @@ export declare class Book extends ResourceProperty<bkper.Book> {
|
|
|
2033
2033
|
*
|
|
2034
2034
|
* @param afterDate - The start date (inclusive) for the events search range, in [RFC3339](https://en.wikipedia.org/wiki/ISO_8601#RFC_3339) format. Can be null
|
|
2035
2035
|
* @param beforeDate - The end date (exclusive) for the events search range, in [RFC3339](https://en.wikipedia.org/wiki/ISO_8601#RFC_3339) format. Can be null
|
|
2036
|
-
* @param onError -
|
|
2037
|
-
* @param resourceId - The ID of the event's resource (Transaction, Account, or Group). Can be null
|
|
2036
|
+
* @param onError - Filter by error state: `true` = only errors, `false` = only non-errors, `null` = all. Ignored when `resourceId` is set.
|
|
2037
|
+
* @param resourceId - The ID of the event's resource (Transaction, Account, or Group). Can be null. When set, `onError` is ignored.
|
|
2038
2038
|
* @param limit - The maximum number of events to return
|
|
2039
2039
|
* @param cursor - The cursor for pagination. Can be null
|
|
2040
2040
|
*
|
|
2041
2041
|
* @returns An [[EventList]] object containing the list of events
|
|
2042
2042
|
*/
|
|
2043
|
-
listEvents(afterDate: string | null, beforeDate: string | null, onError: boolean, resourceId: string | null, limit: number, cursor?: string): Promise<EventList>;
|
|
2043
|
+
listEvents(afterDate: string | null, beforeDate: string | null, onError: boolean | null, resourceId: string | null, limit: number, cursor?: string): Promise<EventList>;
|
|
2044
2044
|
/**
|
|
2045
2045
|
* Retrieve a transaction by id.
|
|
2046
2046
|
*
|
|
@@ -2446,6 +2446,10 @@ export declare interface Config {
|
|
|
2446
2446
|
apiKeyProvider?: () => Promise<string>;
|
|
2447
2447
|
/**
|
|
2448
2448
|
* Issue a valid OAuth2 access token with **https://www.googleapis.com/auth/userinfo.email** scope authorized.
|
|
2449
|
+
*
|
|
2450
|
+
* If omitted or if it returns undefined, requests are sent without an Authorization header.
|
|
2451
|
+
* This supports environments where authentication is injected outside bkper-js, such as
|
|
2452
|
+
* Bkper Platform outbound for server-side app routes.
|
|
2449
2453
|
*/
|
|
2450
2454
|
oauthTokenProvider?: () => Promise<string | undefined>;
|
|
2451
2455
|
/**
|
package/lib/model/Book.js
CHANGED
|
@@ -1168,8 +1168,8 @@ export class Book extends ResourceProperty {
|
|
|
1168
1168
|
*
|
|
1169
1169
|
* @param afterDate - The start date (inclusive) for the events search range, in [RFC3339](https://en.wikipedia.org/wiki/ISO_8601#RFC_3339) format. Can be null
|
|
1170
1170
|
* @param beforeDate - The end date (exclusive) for the events search range, in [RFC3339](https://en.wikipedia.org/wiki/ISO_8601#RFC_3339) format. Can be null
|
|
1171
|
-
* @param onError -
|
|
1172
|
-
* @param resourceId - The ID of the event's resource (Transaction, Account, or Group). Can be null
|
|
1171
|
+
* @param onError - Filter by error state: `true` = only errors, `false` = only non-errors, `null` = all. Ignored when `resourceId` is set.
|
|
1172
|
+
* @param resourceId - The ID of the event's resource (Transaction, Account, or Group). Can be null. When set, `onError` is ignored.
|
|
1173
1173
|
* @param limit - The maximum number of events to return
|
|
1174
1174
|
* @param cursor - The cursor for pagination. Can be null
|
|
1175
1175
|
*
|
|
@@ -37,7 +37,10 @@ export class HttpApiRequest extends HttpRequest {
|
|
|
37
37
|
return __awaiter(this, void 0, void 0, function* () {
|
|
38
38
|
this.addCustomHeaders();
|
|
39
39
|
yield this.addAgentIdHeader();
|
|
40
|
-
|
|
40
|
+
const accessToken = yield this.getAccessToken();
|
|
41
|
+
if (accessToken) {
|
|
42
|
+
this.setHeader("Authorization", `Bearer ${accessToken}`);
|
|
43
|
+
}
|
|
41
44
|
yield this.addApiKeyHeader();
|
|
42
45
|
try {
|
|
43
46
|
let resp = yield _super.execute.call(this);
|
|
@@ -200,9 +203,6 @@ export class HttpApiRequest extends HttpRequest {
|
|
|
200
203
|
if (effectiveConfig.oauthTokenProvider) {
|
|
201
204
|
token = yield effectiveConfig.oauthTokenProvider();
|
|
202
205
|
}
|
|
203
|
-
else {
|
|
204
|
-
console.warn(`Token provider NOT configured!`);
|
|
205
|
-
}
|
|
206
206
|
if (token) {
|
|
207
207
|
token = token.replace("Bearer ", "");
|
|
208
208
|
token = token.replace("bearer ", "");
|