@go-avro/avro-js 0.0.2-beta.13 → 0.0.2-beta.15

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.
@@ -24,5 +24,6 @@ export declare class AvroQueryClient {
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
26
  fetchEvents(companyGuid: string, amt?: number, knownIds?: string[], unknownIds?: string[], keyword?: string, offset?: number, unbilled?: boolean, billed?: boolean, paid?: boolean, jobId?: string | null, cancelToken?: CancelToken, headers?: Record<string, string>): Promise<any>;
27
- fetchBills(companyGuid: string, amt?: number, known_ids?: string[], unknown_ids?: string[], keyword?: string, offset?: number, cancelToken?: CancelToken, headers?: Record<string, string>): Promise<any>;
27
+ fetchMonths(companyGuid: string, amt?: number, knownIds?: string[], unknownIds?: string[], keyword?: string, offset?: number, unbilled?: boolean, billed?: boolean, paid?: boolean, jobId?: string | null, cancelToken?: CancelToken, headers?: Record<string, string>): Promise<any>;
28
+ fetchBills(companyGuid: string, amt?: number, knownIds?: string[], unknownIds?: string[], keyword?: string, offset?: number, paid?: boolean, cancelToken?: CancelToken, headers?: Record<string, string>): Promise<any>;
28
29
  }
@@ -247,17 +247,40 @@ export class AvroQueryClient {
247
247
  throw new StandardError(500, 'Failed to fetch events');
248
248
  });
249
249
  }
250
- fetchBills(companyGuid, amt = 50, known_ids = [], unknown_ids = [], keyword = '', offset = 0, cancelToken, headers = {}) {
250
+ fetchMonths(companyGuid, amt = 50, knownIds = [], unknownIds = [], keyword = '', offset = 0, unbilled = true, billed = true, paid = true, jobId = null, cancelToken, headers = {}) {
251
251
  const body = {
252
252
  amt,
253
- known_ids,
254
- unknown_ids,
253
+ known_ids: knownIds,
254
+ unknown_ids: unknownIds,
255
+ query: keyword,
256
+ job_id: jobId,
257
+ };
258
+ if (!companyGuid) {
259
+ return Promise.reject(new StandardError(400, 'Company GUID is required'));
260
+ }
261
+ return this._fetch('POST', `/company/${companyGuid}/months?amt=${amt}&offset=${offset}&unbilled=${unbilled}&billed=${billed}&paid=${paid}`, body, cancelToken, headers)
262
+ .then(response => {
263
+ if (!response || !Array.isArray(response)) {
264
+ throw new StandardError(400, 'Invalid months response');
265
+ }
266
+ return response;
267
+ })
268
+ .catch(err => {
269
+ console.error('Failed to fetch months:', err);
270
+ throw new StandardError(500, 'Failed to fetch months');
271
+ });
272
+ }
273
+ fetchBills(companyGuid, amt = 50, knownIds = [], unknownIds = [], keyword = '', offset = 0, paid = true, cancelToken, headers = {}) {
274
+ const body = {
275
+ amt,
276
+ known_ids: knownIds,
277
+ unknown_ids: unknownIds,
255
278
  query: keyword,
256
279
  };
257
280
  if (!companyGuid) {
258
281
  return Promise.reject(new StandardError(400, 'Company GUID is required'));
259
282
  }
260
- return this._fetch('POST', `/company/${companyGuid}/bills?amt=${amt}&offset=${offset}`, body, cancelToken, headers)
283
+ return this._fetch('POST', `/company/${companyGuid}/bills?amt=${amt}&offset=${offset}&paid=${paid}`, body, cancelToken, headers)
261
284
  .then(response => {
262
285
  if (!response || !Array.isArray(response)) {
263
286
  throw new StandardError(400, 'Invalid bills response');
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@go-avro/avro-js",
3
- "version": "0.0.2-beta.13",
3
+ "version": "0.0.2-beta.15",
4
4
  "description": "JS client for Avro backend integration.",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",