@go-avro/avro-js 0.0.2-beta.10 → 0.0.2-beta.12

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.
@@ -23,6 +23,6 @@ export declare class AvroQueryClient {
23
23
  }, cancelToken?: CancelToken): Promise<Boolean>;
24
24
  logout(cancelToken?: CancelToken): Promise<void>;
25
25
  fetchJobs(companyGuid: string, amt?: number, knownIds?: string[], unknownIds?: string[], keyword?: string, offset?: number, cancelToken?: CancelToken, headers?: Record<string, string>): Promise<any>;
26
- fetchEvents(companyGuid: string, amt?: number, known_ids?: string[], unknown_ids?: string[], keyword?: string, unbilled?: boolean, billed?: boolean, paid?: boolean, offset?: number, cancelToken?: CancelToken, headers?: Record<string, string>): Promise<any>;
26
+ fetchEvents(companyGuid: string, amt?: number, known_ids?: string[], unknown_ids?: string[], keyword?: string, offset?: number, unbilled?: boolean, billed?: boolean, paid?: boolean, job_id?: string | null, cancelToken?: CancelToken, headers?: Record<string, string>): Promise<any>;
27
27
  fetchBills(companyGuid: string, amt?: number, known_ids?: string[], unknown_ids?: string[], keyword?: string, offset?: number, cancelToken?: CancelToken, headers?: Record<string, string>): Promise<any>;
28
28
  }
@@ -106,8 +106,13 @@ export class AvroQueryClient {
106
106
  }
107
107
  _fetch(method, path, body, cancelToken, headers = {}, isIdempotent = false, retryCount = 0) {
108
108
  const checkCancelled = () => {
109
- if (cancelToken?.isCancelled()) {
110
- return new StandardError(0, 'Request cancelled');
109
+ try {
110
+ if (cancelToken?.isCancelled()) {
111
+ return new StandardError(0, 'Request cancelled');
112
+ }
113
+ }
114
+ catch (error) {
115
+ throw new StandardError(0, `Error checking cancellation (${typeof cancelToken}): ${error}`);
111
116
  }
112
117
  return null;
113
118
  };
@@ -219,12 +224,13 @@ export class AvroQueryClient {
219
224
  throw new StandardError(500, 'Failed to fetch jobs');
220
225
  });
221
226
  }
222
- fetchEvents(companyGuid, amt = 50, known_ids = [], unknown_ids = [], keyword = '', unbilled = true, billed = true, paid = true, offset = 0, cancelToken, headers = {}) {
227
+ fetchEvents(companyGuid, amt = 50, known_ids = [], unknown_ids = [], keyword = '', offset = 0, unbilled = true, billed = true, paid = true, job_id = null, cancelToken, headers = {}) {
223
228
  const body = {
224
229
  amt,
225
230
  known_ids,
226
231
  unknown_ids,
227
232
  query: keyword,
233
+ job_id,
228
234
  };
229
235
  if (!companyGuid) {
230
236
  return Promise.reject(new StandardError(400, 'Company GUID is required'));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@go-avro/avro-js",
3
- "version": "0.0.2-beta.10",
3
+ "version": "0.0.2-beta.12",
4
4
  "description": "JS client for Avro backend integration.",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",