@go-avro/avro-js 0.0.2-beta.14 → 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
+ 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>;
27
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,6 +247,29 @@ export class AvroQueryClient {
247
247
  throw new StandardError(500, 'Failed to fetch events');
248
248
  });
249
249
  }
250
+ fetchMonths(companyGuid, amt = 50, knownIds = [], unknownIds = [], keyword = '', offset = 0, unbilled = true, billed = true, paid = true, jobId = null, cancelToken, headers = {}) {
251
+ const body = {
252
+ amt,
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
+ }
250
273
  fetchBills(companyGuid, amt = 50, knownIds = [], unknownIds = [], keyword = '', offset = 0, paid = true, cancelToken, headers = {}) {
251
274
  const body = {
252
275
  amt,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@go-avro/avro-js",
3
- "version": "0.0.2-beta.14",
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",