@go-avro/avro-js 0.0.37 → 0.0.39

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.
Files changed (59) hide show
  1. package/dist/auth/AuthManager.d.ts +2 -2
  2. package/dist/auth/AuthManager.js +37 -32
  3. package/dist/auth/storage.d.ts +1 -1
  4. package/dist/auth/storage.js +6 -6
  5. package/dist/client/AvroQueryClientProvider.js +1 -1
  6. package/dist/client/QueryClient.d.ts +35 -17
  7. package/dist/client/QueryClient.js +505 -391
  8. package/dist/client/core/fetch.js +16 -11
  9. package/dist/client/core/utils.js +5 -5
  10. package/dist/client/core/xhr.js +28 -23
  11. package/dist/client/hooks/analytics.js +14 -14
  12. package/dist/client/hooks/avro.js +2 -2
  13. package/dist/client/hooks/bills.js +66 -30
  14. package/dist/client/hooks/catalog_items.js +57 -22
  15. package/dist/client/hooks/chats.js +4 -4
  16. package/dist/client/hooks/companies.js +96 -39
  17. package/dist/client/hooks/email.js +1 -1
  18. package/dist/client/hooks/events.js +174 -63
  19. package/dist/client/hooks/groups.js +37 -22
  20. package/dist/client/hooks/jobs.js +69 -18
  21. package/dist/client/hooks/labels.js +36 -21
  22. package/dist/client/hooks/messages.js +9 -6
  23. package/dist/client/hooks/months.js +42 -22
  24. package/dist/client/hooks/plans.js +2 -2
  25. package/dist/client/hooks/prepayments.js +42 -22
  26. package/dist/client/hooks/proposal.js +21 -5
  27. package/dist/client/hooks/root.js +4 -4
  28. package/dist/client/hooks/routes.js +77 -32
  29. package/dist/client/hooks/sessions.js +66 -34
  30. package/dist/client/hooks/skills.js +33 -18
  31. package/dist/client/hooks/teams.js +36 -21
  32. package/dist/client/hooks/timecards.js +6 -0
  33. package/dist/client/hooks/users.js +61 -29
  34. package/dist/client/hooks/waivers.js +41 -19
  35. package/dist/index.d.ts +38 -38
  36. package/dist/index.js +37 -37
  37. package/dist/types/api/Bill.d.ts +1 -1
  38. package/dist/types/api/Bill.js +1 -1
  39. package/dist/types/api/Job.d.ts +1 -1
  40. package/dist/types/api/Job.js +14 -14
  41. package/dist/types/api/LineItem.d.ts +3 -3
  42. package/dist/types/api/LineItem.js +5 -2
  43. package/dist/types/api/PaymentType.d.ts +1 -1
  44. package/dist/types/api/Prepayment.d.ts +1 -1
  45. package/dist/types/api/Route.d.ts +3 -3
  46. package/dist/types/api/Route.js +4 -2
  47. package/dist/types/api/RouteJob.d.ts +1 -1
  48. package/dist/types/api/Task.d.ts +2 -2
  49. package/dist/types/api/Task.js +12 -7
  50. package/dist/types/api/Timecard.d.ts +1 -1
  51. package/dist/types/api/TimecardAction.d.ts +1 -1
  52. package/dist/types/api/UserCompanyAssociation.d.ts +2 -2
  53. package/dist/types/api/UserCompanyAssociation.js +1 -1
  54. package/dist/types/api/_Event.d.ts +1 -1
  55. package/dist/types/api/_Event.js +1 -1
  56. package/dist/types/api.d.ts +1 -1
  57. package/dist/types/auth.d.ts +1 -1
  58. package/dist/types/client.d.ts +1 -1
  59. package/package.json +3 -2
@@ -2,7 +2,13 @@ import { useMutation, useQuery } from "@tanstack/react-query";
2
2
  import { AvroQueryClient } from "../../client/QueryClient";
3
3
  AvroQueryClient.prototype.useGetTeams = function (body, total, onProgress) {
4
4
  return useQuery({
5
- queryKey: ['teams', this.companyId, body.amt ?? 50, body.query ?? "", total ?? "all"],
5
+ queryKey: [
6
+ "teams",
7
+ this.companyId,
8
+ body.amt ?? 50,
9
+ body.query ?? "",
10
+ total ?? "all",
11
+ ],
6
12
  queryFn: async () => {
7
13
  if (typeof total !== "number") {
8
14
  return this.fetchTeams({ ...body, offset: 0 });
@@ -33,32 +39,35 @@ AvroQueryClient.prototype.useCreateTeam = function () {
33
39
  return this.post({
34
40
  path: `/company/${this.companyId}/team`,
35
41
  data: JSON.stringify(teamData),
36
- headers: { "Content-Type": "application/json" }
42
+ headers: { "Content-Type": "application/json" },
37
43
  });
38
44
  },
45
+ onSuccess: () => {
46
+ queryClient.invalidateQueries({ queryKey: ["teams"] });
47
+ },
39
48
  });
40
49
  };
41
50
  AvroQueryClient.prototype.useUpdateTeam = function () {
42
51
  const queryClient = this.getQueryClient();
43
52
  return useMutation({
44
- mutationFn: async ({ teamId, teamData }) => {
53
+ mutationFn: async ({ teamId, teamData, }) => {
45
54
  return this.put({
46
55
  path: `/team/${teamId}`,
47
56
  data: JSON.stringify(teamData),
48
- headers: { "Content-Type": "application/json" }
57
+ headers: { "Content-Type": "application/json" },
49
58
  });
50
59
  },
51
60
  onMutate: async ({ teamId, teamData }) => {
52
- await queryClient.cancelQueries({ queryKey: ['teams'] });
53
- await queryClient.cancelQueries({ queryKey: ['teams', teamId] });
54
- const previousTeams = queryClient.getQueryData(['teams']);
55
- const previousTeam = queryClient.getQueryData(['teams', teamId]);
56
- queryClient.setQueryData(['teams', teamId], (oldData) => {
61
+ await queryClient.cancelQueries({ queryKey: ["teams"] });
62
+ await queryClient.cancelQueries({ queryKey: ["teams", teamId] });
63
+ const previousTeams = queryClient.getQueryData(["teams"]);
64
+ const previousTeam = queryClient.getQueryData(["teams", teamId]);
65
+ queryClient.setQueryData(["teams", teamId], (oldData) => {
57
66
  if (!oldData)
58
67
  return oldData;
59
68
  return { ...oldData, ...teamData };
60
69
  });
61
- queryClient.setQueriesData({ queryKey: ['teams'] }, (oldData) => {
70
+ queryClient.setQueriesData({ queryKey: ["teams"] }, (oldData) => {
62
71
  if (!oldData)
63
72
  return oldData;
64
73
  if (oldData.pages) {
@@ -72,13 +81,16 @@ AvroQueryClient.prototype.useUpdateTeam = function () {
72
81
  });
73
82
  return { previousTeams, previousTeam };
74
83
  },
84
+ onSuccess: () => {
85
+ queryClient.invalidateQueries({ queryKey: ["teams"] });
86
+ },
75
87
  onError: (_err, variables, context) => {
76
88
  const { teamId } = variables;
77
89
  if (context?.previousTeams) {
78
- queryClient.setQueryData(['teams'], context.previousTeams);
90
+ queryClient.setQueryData(["teams"], context.previousTeams);
79
91
  }
80
92
  if (context?.previousTeam) {
81
- queryClient.setQueryData(['teams', teamId], context.previousTeam);
93
+ queryClient.setQueryData(["teams", teamId], context.previousTeam);
82
94
  }
83
95
  },
84
96
  });
@@ -86,16 +98,16 @@ AvroQueryClient.prototype.useUpdateTeam = function () {
86
98
  AvroQueryClient.prototype.useDeleteTeam = function () {
87
99
  const queryClient = this.getQueryClient();
88
100
  return useMutation({
89
- mutationFn: async ({ teamId, }) => {
101
+ mutationFn: async ({ teamId }) => {
90
102
  return this.delete({ path: `/team/${teamId}` });
91
103
  },
92
104
  onMutate: async ({ teamId }) => {
93
- await queryClient.cancelQueries({ queryKey: ['teams'] });
94
- await queryClient.cancelQueries({ queryKey: ['teams', teamId] });
95
- const previousRoutes = queryClient.getQueryData(['teams']);
96
- const previousRoute = queryClient.getQueryData(['teams', teamId]);
97
- queryClient.setQueryData(['teams', teamId], undefined);
98
- queryClient.setQueriesData({ queryKey: ['teams'] }, (oldData) => {
105
+ await queryClient.cancelQueries({ queryKey: ["teams"] });
106
+ await queryClient.cancelQueries({ queryKey: ["teams", teamId] });
107
+ const previousRoutes = queryClient.getQueryData(["teams"]);
108
+ const previousRoute = queryClient.getQueryData(["teams", teamId]);
109
+ queryClient.setQueryData(["teams", teamId], undefined);
110
+ queryClient.setQueriesData({ queryKey: ["teams"] }, (oldData) => {
99
111
  if (!oldData)
100
112
  return oldData;
101
113
  if (oldData.pages) {
@@ -109,13 +121,16 @@ AvroQueryClient.prototype.useDeleteTeam = function () {
109
121
  });
110
122
  return { previousRoutes, previousRoute };
111
123
  },
124
+ onSuccess: () => {
125
+ queryClient.invalidateQueries({ queryKey: ["teams"] });
126
+ },
112
127
  onError: (_err, variables, context) => {
113
128
  const { teamId } = variables;
114
129
  if (context?.previousRoutes) {
115
- queryClient.setQueryData(['teams'], context.previousRoutes);
130
+ queryClient.setQueryData(["teams"], context.previousRoutes);
116
131
  }
117
132
  if (context?.previousRoute) {
118
- queryClient.setQueryData(['teams', teamId], context.previousRoute);
133
+ queryClient.setQueryData(["teams", teamId], context.previousRoute);
119
134
  }
120
135
  },
121
136
  });
@@ -53,6 +53,9 @@ AvroQueryClient.prototype.useCreateTimecard = function () {
53
53
  headers: { "Content-Type": "application/json" },
54
54
  });
55
55
  },
56
+ onSuccess: () => {
57
+ queryClient.invalidateQueries({ queryKey: ["timecards"] });
58
+ },
56
59
  });
57
60
  };
58
61
  AvroQueryClient.prototype.useUpdateTimecard = function () {
@@ -65,5 +68,8 @@ AvroQueryClient.prototype.useUpdateTimecard = function () {
65
68
  headers: { "Content-Type": "application/json" },
66
69
  });
67
70
  },
71
+ onSuccess: () => {
72
+ queryClient.invalidateQueries({ queryKey: ["timecards"] });
73
+ },
68
74
  });
69
75
  };
@@ -3,14 +3,14 @@ import { AvroQueryClient } from "../../client/QueryClient";
3
3
  import { AuthState } from "../../types/auth";
4
4
  AvroQueryClient.prototype.useGetUser = function (userId) {
5
5
  return useQuery({
6
- queryKey: ['users', userId],
6
+ queryKey: ["users", userId],
7
7
  queryFn: () => this.get({ path: `/user/${userId}` }),
8
8
  enabled: Boolean(userId),
9
9
  });
10
10
  };
11
11
  AvroQueryClient.prototype.useSearchUsers = function (searchUsername) {
12
12
  return useQuery({
13
- queryKey: ['users', 'search', searchUsername],
13
+ queryKey: ["users", "search", searchUsername],
14
14
  queryFn: () => {
15
15
  if (!searchUsername)
16
16
  return Promise.resolve([]);
@@ -21,7 +21,7 @@ AvroQueryClient.prototype.useSearchUsers = function (searchUsername) {
21
21
  };
22
22
  AvroQueryClient.prototype.useGetSelf = function () {
23
23
  return useQuery({
24
- queryKey: ['user'],
24
+ queryKey: ["user"],
25
25
  queryFn: () => this.get({ path: `/user` }),
26
26
  enabled: this.getAuthState() === AuthState.AUTHENTICATED,
27
27
  });
@@ -31,11 +31,15 @@ AvroQueryClient.prototype.useCreateSelf = function () {
31
31
  return useMutation({
32
32
  mutationFn: async (data) => {
33
33
  return this.post({
34
- path: '/user',
34
+ path: "/user",
35
35
  data: JSON.stringify(data),
36
- headers: { "Content-Type": "application/json" }
36
+ headers: { "Content-Type": "application/json" },
37
37
  });
38
38
  },
39
+ onSuccess: () => {
40
+ queryClient.invalidateQueries({ queryKey: ["users"] });
41
+ queryClient.invalidateQueries({ queryKey: ["user"] });
42
+ },
39
43
  });
40
44
  };
41
45
  AvroQueryClient.prototype.useCreateUser = function () {
@@ -43,11 +47,15 @@ AvroQueryClient.prototype.useCreateUser = function () {
43
47
  return useMutation({
44
48
  mutationFn: async (data) => {
45
49
  return this.post({
46
- path: '/user',
50
+ path: "/user",
47
51
  data: JSON.stringify(data),
48
- headers: { "Content-Type": "application/json" }
52
+ headers: { "Content-Type": "application/json" },
49
53
  });
50
54
  },
55
+ onSuccess: () => {
56
+ queryClient.invalidateQueries({ queryKey: ["users"] });
57
+ queryClient.invalidateQueries({ queryKey: ["user"] });
58
+ },
51
59
  });
52
60
  };
53
61
  AvroQueryClient.prototype.useUpdateUser = function (userId) {
@@ -57,29 +65,38 @@ AvroQueryClient.prototype.useUpdateUser = function (userId) {
57
65
  return this.put({
58
66
  path: `/user/${userId}`,
59
67
  data: JSON.stringify(data),
60
- headers: { "Content-Type": "application/json" }
68
+ headers: { "Content-Type": "application/json" },
61
69
  });
62
70
  },
63
- // Optimistically update the user data in the cache
64
71
  onMutate: async (data) => {
65
- await queryClient.cancelQueries({ queryKey: ['user'] });
66
- await queryClient.cancelQueries({ queryKey: ['users', userId] });
67
- const previousSelf = queryClient.getQueryData(['user']);
68
- const previousUser = queryClient.getQueryData(['users', userId]);
72
+ await queryClient.cancelQueries({ queryKey: ["user"] });
73
+ await queryClient.cancelQueries({ queryKey: ["users", userId] });
74
+ const previousSelf = queryClient.getQueryData(["user"]);
75
+ const previousUser = queryClient.getQueryData(["users", userId]);
69
76
  if (previousSelf && previousSelf.id === userId) {
70
- queryClient.setQueryData(['user'], { ...previousSelf, ...data });
77
+ queryClient.setQueryData(["user"], {
78
+ ...previousSelf,
79
+ ...data,
80
+ });
71
81
  }
72
82
  if (previousUser) {
73
- queryClient.setQueryData(['users', userId], { ...previousUser, ...data });
83
+ queryClient.setQueryData(["users", userId], {
84
+ ...previousUser,
85
+ ...data,
86
+ });
74
87
  }
75
88
  return { previousSelf, previousUser };
76
89
  },
90
+ onSuccess: () => {
91
+ queryClient.invalidateQueries({ queryKey: ["users"] });
92
+ queryClient.invalidateQueries({ queryKey: ["user"] });
93
+ },
77
94
  onError: (err, _, context) => {
78
95
  if (context?.previousSelf) {
79
- queryClient.setQueryData(['user'], context.previousSelf);
96
+ queryClient.setQueryData(["user"], context.previousSelf);
80
97
  }
81
98
  if (context?.previousUser) {
82
- queryClient.setQueryData(['users', userId], context.previousUser);
99
+ queryClient.setQueryData(["users", userId], context.previousUser);
83
100
  }
84
101
  },
85
102
  });
@@ -87,31 +104,42 @@ AvroQueryClient.prototype.useUpdateUser = function (userId) {
87
104
  AvroQueryClient.prototype.useUpdateUserCompany = function () {
88
105
  const queryClient = this.getQueryClient();
89
106
  return useMutation({
90
- mutationFn: async ({ user_id, data }) => {
107
+ mutationFn: async ({ user_id, data, }) => {
91
108
  return this.put({
92
109
  path: `/company/${this.companyId}/user/${user_id}`,
93
110
  data: JSON.stringify(data),
94
- headers: { "Content-Type": "application/json" }
111
+ headers: { "Content-Type": "application/json" },
95
112
  });
96
113
  },
97
- // Optimistically update the user data and company data in the cache
98
114
  onMutate: async (data) => {
99
- await queryClient.cancelQueries({ queryKey: ['user'] });
100
- await queryClient.cancelQueries({ queryKey: ['companies', this.companyId] });
101
- const previousCompany = queryClient.getQueryData(['companies', this.companyId]);
115
+ await queryClient.cancelQueries({ queryKey: ["user"] });
116
+ await queryClient.cancelQueries({
117
+ queryKey: ["companies", this.companyId],
118
+ });
119
+ const previousCompany = queryClient.getQueryData([
120
+ "companies",
121
+ this.companyId,
122
+ ]);
102
123
  if (previousCompany) {
103
124
  let oldCompanyUser = previousCompany.users?.find((u) => u.user.id === data.user_id);
104
125
  if (oldCompanyUser) {
105
126
  oldCompanyUser = { ...oldCompanyUser, ...data.data };
106
127
  const newUsers = previousCompany.users?.map((u) => u.user.id === data.user_id ? oldCompanyUser : u) ?? [];
107
- queryClient.setQueryData(['companies', this.companyId], { ...previousCompany, users: newUsers });
128
+ queryClient.setQueryData(["companies", this.companyId], {
129
+ ...previousCompany,
130
+ users: newUsers,
131
+ });
108
132
  }
109
133
  }
110
134
  return { previousCompany };
111
135
  },
136
+ onSuccess: () => {
137
+ queryClient.invalidateQueries({ queryKey: ["users"] });
138
+ queryClient.invalidateQueries({ queryKey: ["user"] });
139
+ },
112
140
  onError: (err, _, context) => {
113
141
  if (context?.previousCompany) {
114
- queryClient.setQueryData(['companies', this.companyId], context.previousCompany);
142
+ queryClient.setQueryData(["companies", this.companyId], context.previousCompany);
115
143
  }
116
144
  },
117
145
  });
@@ -123,14 +151,18 @@ AvroQueryClient.prototype.useDeleteSelf = function () {
123
151
  return this.delete({ path: `/user` });
124
152
  },
125
153
  onMutate: async () => {
126
- await queryClient.cancelQueries({ queryKey: ['user'] });
127
- const previousUser = queryClient.getQueryData(['user']);
128
- queryClient.removeQueries({ queryKey: ['user'] });
154
+ await queryClient.cancelQueries({ queryKey: ["user"] });
155
+ const previousUser = queryClient.getQueryData(["user"]);
156
+ queryClient.removeQueries({ queryKey: ["user"] });
129
157
  return { previousUser };
130
158
  },
159
+ onSuccess: () => {
160
+ queryClient.invalidateQueries({ queryKey: ["users"] });
161
+ queryClient.invalidateQueries({ queryKey: ["user"] });
162
+ },
131
163
  onError: (err, _, context) => {
132
164
  if (context?.previousUser) {
133
- queryClient.setQueryData(['user'], context.previousUser);
165
+ queryClient.setQueryData(["user"], context.previousUser);
134
166
  }
135
167
  },
136
168
  });
@@ -1,5 +1,5 @@
1
- import { useMutation, useQuery } from '@tanstack/react-query';
2
- import { AvroQueryClient } from '../../client/QueryClient';
1
+ import { useMutation, useQuery } from "@tanstack/react-query";
2
+ import { AvroQueryClient } from "../../client/QueryClient";
3
3
  AvroQueryClient.prototype.useCreateWaiver = function () {
4
4
  const queryClient = this.getQueryClient();
5
5
  return useMutation({
@@ -7,14 +7,26 @@ AvroQueryClient.prototype.useCreateWaiver = function () {
7
7
  return this.post({
8
8
  path: `/company/${this.companyId}/waiver`,
9
9
  data: JSON.stringify(waiverData),
10
- headers: { "Content-Type": "application/json" }
10
+ headers: { "Content-Type": "application/json" },
11
11
  });
12
12
  },
13
+ onSuccess: () => {
14
+ queryClient.invalidateQueries({ queryKey: ["waivers"] });
15
+ },
13
16
  });
14
17
  };
15
18
  AvroQueryClient.prototype.useGetWaivers = function (body, total, onProgress) {
16
19
  return useQuery({
17
- queryKey: ['waivers', this.companyId, body.amt ?? 50, body.known_ids ?? [], body.unknown_ids ?? [], body.offset ?? 0, body.query ?? "", total ?? "all"],
20
+ queryKey: [
21
+ "waivers",
22
+ this.companyId,
23
+ body.amt ?? 50,
24
+ body.known_ids ?? [],
25
+ body.unknown_ids ?? [],
26
+ body.offset ?? 0,
27
+ body.query ?? "",
28
+ total ?? "all",
29
+ ],
18
30
  queryFn: async () => {
19
31
  if (typeof total !== "number") {
20
32
  return this.fetchWaivers({ ...body, offset: 0 });
@@ -41,24 +53,26 @@ AvroQueryClient.prototype.useGetWaivers = function (body, total, onProgress) {
41
53
  AvroQueryClient.prototype.useUpdateWaiver = function () {
42
54
  const queryClient = this.getQueryClient();
43
55
  return useMutation({
44
- mutationFn: async ({ waiverId, updates }) => {
56
+ mutationFn: async ({ waiverId, updates, }) => {
45
57
  return this.put({
46
58
  path: `/waiver/${waiverId}`,
47
59
  data: JSON.stringify(updates),
48
- headers: { "Content-Type": "application/json" }
60
+ headers: { "Content-Type": "application/json" },
49
61
  });
50
62
  },
51
63
  onMutate: async ({ waiverId, updates }) => {
52
- await queryClient.cancelQueries({ queryKey: ['waivers'] });
53
- await queryClient.cancelQueries({ queryKey: ['waivers', waiverId] });
54
- const previousWaivers = queryClient.getQueryData(['waivers']);
55
- const previousWaiver = queryClient.getQueryData(['waivers', waiverId]);
56
- queryClient.setQueryData(['waivers', waiverId], (oldData) => {
64
+ await queryClient.cancelQueries({ queryKey: ["waivers"] });
65
+ await queryClient.cancelQueries({
66
+ queryKey: ["waivers", waiverId],
67
+ });
68
+ const previousWaivers = queryClient.getQueryData(["waivers"]);
69
+ const previousWaiver = queryClient.getQueryData(["waivers", waiverId]);
70
+ queryClient.setQueryData(["waivers", waiverId], (oldData) => {
57
71
  if (!oldData)
58
72
  return oldData;
59
73
  return { ...oldData, ...updates };
60
74
  });
61
- queryClient.setQueriesData({ queryKey: ['waivers'] }, (oldData) => {
75
+ queryClient.setQueriesData({ queryKey: ["waivers"] }, (oldData) => {
62
76
  if (!oldData)
63
77
  return oldData;
64
78
  if (oldData.pages) {
@@ -72,13 +86,16 @@ AvroQueryClient.prototype.useUpdateWaiver = function () {
72
86
  });
73
87
  return { previousWaivers, previousWaiver };
74
88
  },
89
+ onSuccess: () => {
90
+ queryClient.invalidateQueries({ queryKey: ["waivers"] });
91
+ },
75
92
  onError: (_err, variables, context) => {
76
93
  const { waiverId } = variables;
77
94
  if (context?.previousWaivers) {
78
- queryClient.setQueryData(['waivers'], context.previousWaivers);
95
+ queryClient.setQueryData(["waivers"], context.previousWaivers);
79
96
  }
80
97
  if (context?.previousWaiver) {
81
- queryClient.setQueryData(['waivers', waiverId], context.previousWaiver);
98
+ queryClient.setQueryData(["waivers", waiverId], context.previousWaiver);
82
99
  }
83
100
  },
84
101
  });
@@ -87,12 +104,14 @@ AvroQueryClient.prototype.useDeleteWaiver = function () {
87
104
  const queryClient = this.getQueryClient();
88
105
  return useMutation({
89
106
  mutationFn: async ({ waiverId }) => {
90
- return this.delete({ path: `/waiver/${waiverId}` });
107
+ return this.delete({
108
+ path: `/waiver/${waiverId}`,
109
+ });
91
110
  },
92
111
  onMutate: async ({ waiverId }) => {
93
- await queryClient.cancelQueries({ queryKey: ['waivers'] });
94
- const previousWaivers = queryClient.getQueryData(['waivers']);
95
- queryClient.setQueriesData({ queryKey: ['waivers'] }, (oldData) => {
112
+ await queryClient.cancelQueries({ queryKey: ["waivers"] });
113
+ const previousWaivers = queryClient.getQueryData(["waivers"]);
114
+ queryClient.setQueriesData({ queryKey: ["waivers"] }, (oldData) => {
96
115
  if (!oldData)
97
116
  return oldData;
98
117
  if (oldData.pages) {
@@ -106,9 +125,12 @@ AvroQueryClient.prototype.useDeleteWaiver = function () {
106
125
  });
107
126
  return { previousWaivers };
108
127
  },
128
+ onSuccess: () => {
129
+ queryClient.invalidateQueries({ queryKey: ["waivers"] });
130
+ },
109
131
  onError: (_err, variables, context) => {
110
132
  if (context?.previousWaivers) {
111
- queryClient.setQueryData(['waivers'], context.previousWaivers);
133
+ queryClient.setQueryData(["waivers"], context.previousWaivers);
112
134
  }
113
135
  },
114
136
  });
package/dist/index.d.ts CHANGED
@@ -1,38 +1,38 @@
1
- export { AvroQueryClientConfig, AvroQueryClient } from './client/QueryClient';
2
- export { AvroQueryClientProvider, useAvroQueryClient, useSocketEvent } from './client/AvroQueryClientProvider';
3
- export { useEmailStatus } from './client/hooks/email';
4
- export type { EmailResult, EmailResultStatus, UseEmailStatusOptions } from './client/hooks/email';
5
- export { AuthManager } from './auth/AuthManager';
6
- export { MemoryStorage, LocalStorage } from './auth/storage';
7
- import './client/core/xhr';
8
- import './client/core/fetch';
9
- import './client/core/utils';
10
- import './client/hooks/root';
11
- import './client/hooks/jobs';
12
- import './client/hooks/routes';
13
- import './client/hooks/events';
14
- import './client/hooks/months';
15
- import './client/hooks/bills';
16
- import './client/hooks/companies';
17
- import './client/hooks/users';
18
- import './client/hooks/sessions';
19
- import './client/hooks/chats';
20
- import './client/hooks/catalog_items';
21
- import './client/hooks/messages';
22
- import './client/hooks/plans';
23
- import './client/hooks/prepayments';
24
- import './client/hooks/analytics';
25
- import './client/hooks/avro';
26
- import './client/hooks/teams';
27
- import './client/hooks/labels';
28
- import './client/hooks/groups';
29
- import './client/hooks/skills';
30
- import './client/hooks/proposal';
31
- import './client/hooks/timecards';
32
- import './client/hooks/waivers';
33
- import './client/hooks/email';
34
- export * from './types/api';
35
- export * from './types/auth';
36
- export * from './types/cache';
37
- export * from './types/client';
38
- export * from './types/error';
1
+ export { AvroQueryClientConfig, AvroQueryClient } from "./client/QueryClient";
2
+ export { AvroQueryClientProvider, useAvroQueryClient, useSocketEvent, } from "./client/AvroQueryClientProvider";
3
+ export { useEmailStatus } from "./client/hooks/email";
4
+ export type { EmailResult, EmailResultStatus, UseEmailStatusOptions, } from "./client/hooks/email";
5
+ export { AuthManager } from "./auth/AuthManager";
6
+ export { MemoryStorage, LocalStorage } from "./auth/storage";
7
+ import "./client/core/xhr";
8
+ import "./client/core/fetch";
9
+ import "./client/core/utils";
10
+ import "./client/hooks/root";
11
+ import "./client/hooks/jobs";
12
+ import "./client/hooks/routes";
13
+ import "./client/hooks/events";
14
+ import "./client/hooks/months";
15
+ import "./client/hooks/bills";
16
+ import "./client/hooks/companies";
17
+ import "./client/hooks/users";
18
+ import "./client/hooks/sessions";
19
+ import "./client/hooks/chats";
20
+ import "./client/hooks/catalog_items";
21
+ import "./client/hooks/messages";
22
+ import "./client/hooks/plans";
23
+ import "./client/hooks/prepayments";
24
+ import "./client/hooks/analytics";
25
+ import "./client/hooks/avro";
26
+ import "./client/hooks/teams";
27
+ import "./client/hooks/labels";
28
+ import "./client/hooks/groups";
29
+ import "./client/hooks/skills";
30
+ import "./client/hooks/proposal";
31
+ import "./client/hooks/timecards";
32
+ import "./client/hooks/waivers";
33
+ import "./client/hooks/email";
34
+ export * from "./types/api";
35
+ export * from "./types/auth";
36
+ export * from "./types/cache";
37
+ export * from "./types/client";
38
+ export * from "./types/error";
package/dist/index.js CHANGED
@@ -1,37 +1,37 @@
1
- export { AvroQueryClient } from './client/QueryClient';
2
- export { AvroQueryClientProvider, useAvroQueryClient, useSocketEvent } from './client/AvroQueryClientProvider';
3
- export { useEmailStatus } from './client/hooks/email';
4
- export { AuthManager } from './auth/AuthManager';
5
- export { MemoryStorage, LocalStorage } from './auth/storage';
6
- import './client/core/xhr';
7
- import './client/core/fetch';
8
- import './client/core/utils';
9
- import './client/hooks/root';
10
- import './client/hooks/jobs';
11
- import './client/hooks/routes';
12
- import './client/hooks/events';
13
- import './client/hooks/months';
14
- import './client/hooks/bills';
15
- import './client/hooks/companies';
16
- import './client/hooks/users';
17
- import './client/hooks/sessions';
18
- import './client/hooks/chats';
19
- import './client/hooks/catalog_items';
20
- import './client/hooks/messages';
21
- import './client/hooks/plans';
22
- import './client/hooks/prepayments';
23
- import './client/hooks/analytics';
24
- import './client/hooks/avro';
25
- import './client/hooks/teams';
26
- import './client/hooks/labels';
27
- import './client/hooks/groups';
28
- import './client/hooks/skills';
29
- import './client/hooks/proposal';
30
- import './client/hooks/timecards';
31
- import './client/hooks/waivers';
32
- import './client/hooks/email';
33
- export * from './types/api';
34
- export * from './types/auth';
35
- export * from './types/cache';
36
- export * from './types/client';
37
- export * from './types/error';
1
+ export { AvroQueryClient } from "./client/QueryClient";
2
+ export { AvroQueryClientProvider, useAvroQueryClient, useSocketEvent, } from "./client/AvroQueryClientProvider";
3
+ export { useEmailStatus } from "./client/hooks/email";
4
+ export { AuthManager } from "./auth/AuthManager";
5
+ export { MemoryStorage, LocalStorage } from "./auth/storage";
6
+ import "./client/core/xhr";
7
+ import "./client/core/fetch";
8
+ import "./client/core/utils";
9
+ import "./client/hooks/root";
10
+ import "./client/hooks/jobs";
11
+ import "./client/hooks/routes";
12
+ import "./client/hooks/events";
13
+ import "./client/hooks/months";
14
+ import "./client/hooks/bills";
15
+ import "./client/hooks/companies";
16
+ import "./client/hooks/users";
17
+ import "./client/hooks/sessions";
18
+ import "./client/hooks/chats";
19
+ import "./client/hooks/catalog_items";
20
+ import "./client/hooks/messages";
21
+ import "./client/hooks/plans";
22
+ import "./client/hooks/prepayments";
23
+ import "./client/hooks/analytics";
24
+ import "./client/hooks/avro";
25
+ import "./client/hooks/teams";
26
+ import "./client/hooks/labels";
27
+ import "./client/hooks/groups";
28
+ import "./client/hooks/skills";
29
+ import "./client/hooks/proposal";
30
+ import "./client/hooks/timecards";
31
+ import "./client/hooks/waivers";
32
+ import "./client/hooks/email";
33
+ export * from "./types/api";
34
+ export * from "./types/auth";
35
+ export * from "./types/cache";
36
+ export * from "./types/client";
37
+ export * from "./types/error";
@@ -8,7 +8,7 @@ export declare const BillStatus: {
8
8
  readonly PARTIALLY_PAID: "PARTIALLY_PAID";
9
9
  readonly MANUALLY_PAID: "MANUALLY_PAID";
10
10
  };
11
- export type BillStatus = typeof BillStatus[keyof typeof BillStatus];
11
+ export type BillStatus = (typeof BillStatus)[keyof typeof BillStatus];
12
12
  export interface Bill {
13
13
  id: string;
14
14
  invoice_id: number;
@@ -2,5 +2,5 @@ export const BillStatus = {
2
2
  SENT: "SENT",
3
3
  PAID: "PAID",
4
4
  PARTIALLY_PAID: "PARTIALLY_PAID",
5
- MANUALLY_PAID: "MANUALLY_PAID"
5
+ MANUALLY_PAID: "MANUALLY_PAID",
6
6
  };
@@ -3,7 +3,7 @@ import { _Event } from "../../types/api/_Event";
3
3
  import { RouteJob } from "../../types/api/RouteJob";
4
4
  import { Subscription } from "../../types/api/Subscription";
5
5
  import { Route } from "../../types/api/Route";
6
- declare module '../../types/api/Job' {
6
+ declare module "../../types/api/Job" {
7
7
  interface Job {
8
8
  address: string;
9
9
  company: string;