@go-avro/avro-js 0.0.115 → 0.0.117
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.
- package/dist/client/QueryClient.js +11 -1
- package/dist/client/hooks/routes.js +11 -0
- package/dist/types/api/Task.d.ts +3 -0
- package/dist/types/api/Task.js +8 -2
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/package.json +1 -1
|
@@ -155,12 +155,16 @@ const SOCKET_EVENT_CONFIG = {
|
|
|
155
155
|
update_jobs: { invalidateKeys: [['jobs'], ['infinite', 'jobs']] },
|
|
156
156
|
delete_jobs: { invalidateKeys: [['jobs'], ['infinite', 'jobs']] },
|
|
157
157
|
// ── Routes ──
|
|
158
|
+
// Route membership lives on jobs too (task.route_ids), so every
|
|
159
|
+
// route mutation must refresh the jobs caches or unrouted/routed
|
|
160
|
+
// state goes stale.
|
|
158
161
|
create_route: {
|
|
159
162
|
entityKey: 'routes',
|
|
160
163
|
action: 'create',
|
|
161
164
|
fetchPath: (id) => `/route/${id}`,
|
|
162
165
|
construct: (d) => new Route(d),
|
|
163
166
|
matchesQuery: matchesRoutesListQuery,
|
|
167
|
+
alsoInvalidate: [['jobs'], ['infinite', 'jobs']],
|
|
164
168
|
},
|
|
165
169
|
update_route: {
|
|
166
170
|
entityKey: 'routes',
|
|
@@ -168,8 +172,14 @@ const SOCKET_EVENT_CONFIG = {
|
|
|
168
172
|
fetchPath: (id) => `/route/${id}`,
|
|
169
173
|
construct: (d) => new Route(d),
|
|
170
174
|
matchesQuery: matchesRoutesListQuery,
|
|
175
|
+
alsoInvalidate: [['jobs'], ['infinite', 'jobs']],
|
|
176
|
+
},
|
|
177
|
+
delete_route: {
|
|
178
|
+
entityKey: 'routes',
|
|
179
|
+
action: 'delete',
|
|
180
|
+
fetchPath: null,
|
|
181
|
+
alsoInvalidate: [['jobs'], ['infinite', 'jobs']],
|
|
171
182
|
},
|
|
172
|
-
delete_route: { entityKey: 'routes', action: 'delete', fetchPath: null },
|
|
173
183
|
// ── Events (also refetch parent job — overdueness, last_event, etc.) ──
|
|
174
184
|
create_event: {
|
|
175
185
|
entityKey: 'events',
|
|
@@ -95,6 +95,9 @@ AvroQueryClient.prototype.useCreateRoute = function () {
|
|
|
95
95
|
fetchPath: `/route/${result.id}`,
|
|
96
96
|
construct: (d) => new Route(d),
|
|
97
97
|
});
|
|
98
|
+
// task.route_ids lives in the jobs caches
|
|
99
|
+
queryClient.invalidateQueries({ queryKey: ['jobs'] });
|
|
100
|
+
queryClient.invalidateQueries({ queryKey: ['infinite', 'jobs'] });
|
|
98
101
|
},
|
|
99
102
|
onError: (_err, _variables, context) => {
|
|
100
103
|
if (context?.previousRoutes) {
|
|
@@ -179,6 +182,9 @@ AvroQueryClient.prototype.useUpdateRoute = function () {
|
|
|
179
182
|
fetchPath: `/route/${routeId}`,
|
|
180
183
|
construct: (d) => new Route(d),
|
|
181
184
|
});
|
|
185
|
+
// task.route_ids lives in the jobs caches
|
|
186
|
+
queryClient.invalidateQueries({ queryKey: ['jobs'] });
|
|
187
|
+
queryClient.invalidateQueries({ queryKey: ['infinite', 'jobs'] });
|
|
182
188
|
},
|
|
183
189
|
onError: (_err, variables, context) => {
|
|
184
190
|
const { routeId } = variables;
|
|
@@ -223,6 +229,11 @@ AvroQueryClient.prototype.useDeleteRoute = function () {
|
|
|
223
229
|
entityKey: 'routes',
|
|
224
230
|
id: routeId,
|
|
225
231
|
});
|
|
232
|
+
// task.route_ids lives in the jobs caches — without this,
|
|
233
|
+
// freed tasks still look routed and get excluded from the
|
|
234
|
+
// next scheduling attempt.
|
|
235
|
+
queryClient.invalidateQueries({ queryKey: ['jobs'] });
|
|
236
|
+
queryClient.invalidateQueries({ queryKey: ['infinite', 'jobs'] });
|
|
226
237
|
},
|
|
227
238
|
onError: (_err, variables, context) => {
|
|
228
239
|
const { routeId } = variables;
|
package/dist/types/api/Task.d.ts
CHANGED
|
@@ -18,8 +18,11 @@ export declare const UnroutedReason: {
|
|
|
18
18
|
readonly DEPENDENCY_UNMET: "DEPENDENCY_UNMET";
|
|
19
19
|
readonly MISSING_SKILLS: "MISSING_SKILLS";
|
|
20
20
|
readonly OVER_CAPACITY: "OVER_CAPACITY";
|
|
21
|
+
readonly OWN_TIME_WINDOW: "OWN_TIME_WINDOW";
|
|
21
22
|
readonly TRAVEL_TIME: "TRAVEL_TIME";
|
|
22
23
|
readonly LOW_PRIORITY: "LOW_PRIORITY";
|
|
24
|
+
readonly DISPLACED_BY_CHEAPER: "DISPLACED_BY_CHEAPER";
|
|
25
|
+
readonly SCHEDULE_FULL: "SCHEDULE_FULL";
|
|
23
26
|
readonly DID_NOT_FIT: "DID_NOT_FIT";
|
|
24
27
|
};
|
|
25
28
|
export type UnroutedReason = (typeof UnroutedReason)[keyof typeof UnroutedReason];
|
package/dist/types/api/Task.js
CHANGED
|
@@ -13,8 +13,11 @@ export const UnroutedReason = {
|
|
|
13
13
|
DEPENDENCY_UNMET: 'DEPENDENCY_UNMET',
|
|
14
14
|
MISSING_SKILLS: 'MISSING_SKILLS',
|
|
15
15
|
OVER_CAPACITY: 'OVER_CAPACITY',
|
|
16
|
+
OWN_TIME_WINDOW: 'OWN_TIME_WINDOW',
|
|
16
17
|
TRAVEL_TIME: 'TRAVEL_TIME',
|
|
17
18
|
LOW_PRIORITY: 'LOW_PRIORITY',
|
|
19
|
+
DISPLACED_BY_CHEAPER: 'DISPLACED_BY_CHEAPER',
|
|
20
|
+
SCHEDULE_FULL: 'SCHEDULE_FULL',
|
|
18
21
|
DID_NOT_FIT: 'DID_NOT_FIT',
|
|
19
22
|
};
|
|
20
23
|
export const UNROUTED_REASON_LABELS = {
|
|
@@ -22,8 +25,11 @@ export const UNROUTED_REASON_LABELS = {
|
|
|
22
25
|
DEPENDENCY_UNMET: 'Depends on an unrouted task',
|
|
23
26
|
MISSING_SKILLS: 'No available team has the required skills',
|
|
24
27
|
OVER_CAPACITY: 'Exceeds remaining team capacity',
|
|
25
|
-
|
|
26
|
-
|
|
28
|
+
OWN_TIME_WINDOW: 'Time window conflicts with team hours',
|
|
29
|
+
TRAVEL_TIME: 'Cannot be reached within the day',
|
|
30
|
+
LOW_PRIORITY: 'Crowded out by more urgent tasks',
|
|
31
|
+
DISPLACED_BY_CHEAPER: 'Lost its spot to a quicker-to-reach job',
|
|
32
|
+
SCHEDULE_FULL: 'No room left in the schedule',
|
|
27
33
|
DID_NOT_FIT: 'Did not fit any schedule',
|
|
28
34
|
};
|
|
29
35
|
export class Task {
|
package/dist/version.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const AVRO_JS_VERSION = "0.0.
|
|
1
|
+
export declare const AVRO_JS_VERSION = "0.0.117";
|
package/dist/version.js
CHANGED