@go-avro/avro-js 0.0.62 → 0.0.63

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.
@@ -1,7 +1,7 @@
1
1
  import { Socket } from 'socket.io-client';
2
2
  import { InfiniteData, QueryClient, UseInfiniteQueryResult, useMutation, UseQueryResult } from '@tanstack/react-query';
3
3
  import { AuthManager } from '../auth/AuthManager';
4
- import { _Event, ApiInfo, Avro, Bill, Break, Chat, Company, FinancialInsightData, RevenueInsightData, Job, EventInsightData, LoginResponse, Message, Plan, Route, ServiceMonth, Session, Team, User, UserCompanyAssociation, Skill, Group, Label, RouteScheduleConfig, CatalogItem, Payout, Prepayment, Timecard, TimecardActionType, TimecardStatus } from '../types/api';
4
+ import { _Event, ActiveSessionSummary, ApiInfo, Avro, Bill, BillInsightData, Break, Chat, Company, FinancialInsightData, RevenueInsightData, Job, EventInsightData, LoginResponse, Message, Plan, Route, ServiceMonth, Session, Team, User, UserCompanyAssociation, Skill, Group, Label, RouteScheduleConfig, CatalogItem, Payout, Prepayment, Timecard, TimecardActionType, TimecardStatus } from '../types/api';
5
5
  import { AuthState, Tokens } from '../types/auth';
6
6
  import { CancelToken, ClientId, RetryStrategy } from '../types/client';
7
7
  import { StandardError } from '../types/error';
@@ -171,6 +171,13 @@ declare module '../client/QueryClient' {
171
171
  periods: number[][];
172
172
  cumulative: boolean;
173
173
  }): UseQueryResult<FinancialInsightData[], StandardError>;
174
+ useBillAnalytics({ periods, cumulative, }: {
175
+ periods: number[][];
176
+ cumulative: boolean;
177
+ }): UseQueryResult<BillInsightData[], StandardError>;
178
+ useActiveSessions(options?: {
179
+ refetchInterval?: number;
180
+ }): UseQueryResult<ActiveSessionSummary[], StandardError>;
174
181
  useEventAnalytics({ periods, }: {
175
182
  periods: number[][];
176
183
  }): UseQueryResult<EventInsightData[], StandardError>;
@@ -214,8 +214,18 @@ const SOCKET_EVENT_CONFIG = {
214
214
  delete_bill: { entityKey: 'bills', action: 'delete', fetchPath: null },
215
215
  update_bills: { invalidateKeys: [['bills']] },
216
216
  // ── Sessions ──
217
- create_session: { entityKey: 'sessions', action: 'create', fetchPath: null },
218
- update_session: { entityKey: 'sessions', action: 'update', fetchPath: null },
217
+ create_session: {
218
+ entityKey: 'sessions',
219
+ action: 'create',
220
+ fetchPath: null,
221
+ alsoInvalidate: [['analytics', 'sessions']],
222
+ },
223
+ update_session: {
224
+ entityKey: 'sessions',
225
+ action: 'update',
226
+ fetchPath: null,
227
+ alsoInvalidate: [['analytics', 'sessions']],
228
+ },
219
229
  // ── Catalog Items ──
220
230
  create_catalog_item: {
221
231
  entityKey: 'catalog_items',
@@ -21,6 +21,33 @@ AvroQueryClient.prototype.useFinanceAnalytics = function ({ periods, cumulative,
21
21
  }),
22
22
  });
23
23
  };
24
+ AvroQueryClient.prototype.useBillAnalytics = function ({ periods, cumulative, }) {
25
+ return useQuery({
26
+ queryKey: ['analytics', 'bills', this.companyId, periods, cumulative],
27
+ queryFn: () => this.post({
28
+ path: `/company/${this.companyId}/analytics/bills`,
29
+ data: JSON.stringify({ periods, cumulative }),
30
+ headers: {
31
+ 'Content-Type': 'application/json',
32
+ },
33
+ }),
34
+ enabled: Boolean(this.companyId),
35
+ });
36
+ };
37
+ AvroQueryClient.prototype.useActiveSessions = function ({ refetchInterval, } = {}) {
38
+ return useQuery({
39
+ queryKey: ['analytics', 'sessions', this.companyId],
40
+ queryFn: () => this.post({
41
+ path: `/company/${this.companyId}/analytics/sessions`,
42
+ data: JSON.stringify({}),
43
+ headers: {
44
+ 'Content-Type': 'application/json',
45
+ },
46
+ }),
47
+ enabled: Boolean(this.companyId),
48
+ refetchInterval,
49
+ });
50
+ };
24
51
  AvroQueryClient.prototype.useEventAnalytics = function ({ periods }) {
25
52
  return useQuery({
26
53
  queryKey: ['analytics', 'events', this.companyId, periods],
@@ -208,6 +208,18 @@ export interface FinancialInsightData {
208
208
  total: number;
209
209
  };
210
210
  }
211
+ export interface BillInsightData {
212
+ start: number;
213
+ end: number;
214
+ overdue_count: number;
215
+ not_overdue_count: number;
216
+ }
217
+ export interface ActiveSessionSummary {
218
+ id: string;
219
+ user_id: string;
220
+ team_id: string | null;
221
+ time_started: number;
222
+ }
211
223
  export interface EventInsightData {
212
224
  start: number;
213
225
  end: number;
package/dist/version.d.ts CHANGED
@@ -1 +1 @@
1
- export declare const AVRO_JS_VERSION = "0.0.62";
1
+ export declare const AVRO_JS_VERSION = "0.0.63";
package/dist/version.js CHANGED
@@ -1,3 +1,3 @@
1
1
  // AUTO-GENERATED by scripts/gen-version.js — do not edit by hand.
2
2
  // Regenerated from package.json by the `prebuild` npm hook.
3
- export const AVRO_JS_VERSION = '0.0.62';
3
+ export const AVRO_JS_VERSION = '0.0.63';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@go-avro/avro-js",
3
- "version": "0.0.62",
3
+ "version": "0.0.63",
4
4
  "description": "JS client for Avro backend integration.",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",