@go-avro/avro-js 0.0.2-beta.130 → 0.0.2-beta.132

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.
@@ -66,6 +66,7 @@ AvroQueryClient.prototype.useCreateBill = function () {
66
66
  queryClient.invalidateQueries({ queryKey: ['bills', this.companyId] });
67
67
  queryClient.invalidateQueries({ queryKey: ['events', this.companyId] });
68
68
  queryClient.invalidateQueries({ queryKey: ['months', this.companyId] });
69
+ queryClient.invalidateQueries({ queryKey: ['company'] });
69
70
  },
70
71
  });
71
72
  };
@@ -121,6 +121,7 @@ AvroQueryClient.prototype.useCreateEvent = function () {
121
121
  queryClient.invalidateQueries({ queryKey: ['events'] });
122
122
  queryClient.invalidateQueries({ queryKey: ['job'] });
123
123
  queryClient.invalidateQueries({ queryKey: ['jobs'] });
124
+ queryClient.invalidateQueries({ queryKey: ['company'] });
124
125
  },
125
126
  });
126
127
  };
@@ -10,12 +10,8 @@ AvroQueryClient.prototype.useGetJobs = function (onProgress) {
10
10
  return useQuery({
11
11
  queryKey: ['jobs', this.companyId, this.company?.num_jobs],
12
12
  queryFn: async () => {
13
- if (this.company?.num_jobs === 0) {
14
- onProgress?.(1);
15
- return [];
16
- }
17
13
  onProgress?.(0);
18
- const pageCount = amt ? Math.ceil((this.company?.num_jobs ?? 0) / amt) : 0;
14
+ const pageCount = amt ? Math.ceil((this.company?.num_jobs ?? 0) / amt) : 1;
19
15
  let completed = 0;
20
16
  const promises = Array.from({ length: pageCount }, (_, i) => this.fetchJobs({ offset: i * amt, amt }));
21
17
  const trackedPromises = promises.map((promise) => promise.then((result) => {
@@ -117,6 +113,7 @@ AvroQueryClient.prototype.useCreateJob = function () {
117
113
  const { id: jobId } = data ?? {};
118
114
  queryClient.invalidateQueries({ queryKey: ['jobs'] });
119
115
  queryClient.invalidateQueries({ queryKey: ['job', jobId] });
116
+ queryClient.invalidateQueries({ queryKey: ['company'] });
120
117
  },
121
118
  });
122
119
  };
@@ -87,6 +87,7 @@ AvroQueryClient.prototype.useUpdateMonths = function () {
87
87
  onSettled: () => {
88
88
  queryClient.invalidateQueries({ queryKey: ['months'] });
89
89
  queryClient.invalidateQueries({ queryKey: ['month'] });
90
+ queryClient.invalidateQueries({ queryKey: ['company'] });
90
91
  },
91
92
  });
92
93
  };
@@ -8,7 +8,7 @@ AvroQueryClient.prototype.useGetRoutes = function (body, total, onProgress) {
8
8
  return this.fetchRoutes({ ...body, offset: 0 });
9
9
  }
10
10
  onProgress?.(0);
11
- const pageCount = body.amt ? Math.ceil(total / body.amt) : 0;
11
+ const pageCount = body.amt ? Math.ceil(total / body.amt) : 1;
12
12
  let completed = 0;
13
13
  const promises = Array.from({ length: pageCount }, (_, i) => this.fetchRoutes({
14
14
  ...body,
@@ -71,7 +71,7 @@ AvroQueryClient.prototype.useCreateRoute = function () {
71
71
  queryClient.invalidateQueries({ queryKey: ['routes'] });
72
72
  queryClient.invalidateQueries({ queryKey: ['jobs'] });
73
73
  queryClient.invalidateQueries({ queryKey: ['job'] });
74
- queryClient.invalidateQueries({ queryKey: ['company', this.companyId] });
74
+ queryClient.invalidateQueries({ queryKey: ['company'] });
75
75
  },
76
76
  });
77
77
  };
@@ -9,7 +9,8 @@ AvroQueryClient.prototype.useCreateSkill = function () {
9
9
  });
10
10
  },
11
11
  onSettled: () => {
12
- queryClient.invalidateQueries({ queryKey: ['teams'] });
12
+ queryClient.invalidateQueries({ queryKey: ['company'] });
13
+ queryClient.invalidateQueries({ queryKey: ['skills'] });
13
14
  },
14
15
  });
15
16
  };
@@ -21,7 +22,7 @@ AvroQueryClient.prototype.useGetSkills = function (body, total, onProgress) {
21
22
  return this.fetchSkills({ ...body, offset: 0 });
22
23
  }
23
24
  onProgress?.(0);
24
- const pageCount = body.amt ? Math.ceil(total / body.amt) : 0;
25
+ const pageCount = body.amt ? Math.ceil(total / body.amt) : 1;
25
26
  let completed = 0;
26
27
  const promises = Array.from({ length: pageCount }, (_, i) => this.fetchSkills({
27
28
  ...body,
@@ -8,7 +8,7 @@ AvroQueryClient.prototype.useGetTeams = function (body, total, onProgress) {
8
8
  return this.fetchTeams({ ...body, offset: 0 });
9
9
  }
10
10
  onProgress?.(0);
11
- const pageCount = body.amt ? Math.ceil(total / body.amt) : 0;
11
+ const pageCount = body.amt ? Math.ceil(total / body.amt) : 1;
12
12
  let completed = 0;
13
13
  const promises = Array.from({ length: pageCount }, (_, i) => this.fetchTeams({
14
14
  ...body,
@@ -33,6 +33,7 @@ AvroQueryClient.prototype.useCreateTeam = function () {
33
33
  return this.post(`/company/${this.companyId}/team`, JSON.stringify(teamData), undefined, { "Content-Type": "application/json" });
34
34
  },
35
35
  onSettled: () => {
36
+ queryClient.invalidateQueries({ queryKey: ['company'] });
36
37
  queryClient.invalidateQueries({ queryKey: ['teams'] });
37
38
  },
38
39
  });
@@ -380,6 +380,7 @@ export interface Company {
380
380
  num_jobs: number;
381
381
  num_routes: number;
382
382
  num_teams: number;
383
+ num_skills: number;
383
384
  bills: Bill[];
384
385
  enabled_payment_methods: string[];
385
386
  sessions: Session[];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@go-avro/avro-js",
3
- "version": "0.0.2-beta.130",
3
+ "version": "0.0.2-beta.132",
4
4
  "description": "JS client for Avro backend integration.",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",