@go-avro/avro-js 0.0.116 → 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.
@@ -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/version.d.ts CHANGED
@@ -1 +1 @@
1
- export declare const AVRO_JS_VERSION = "0.0.116";
1
+ export declare const AVRO_JS_VERSION = "0.0.117";
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.116';
3
+ export const AVRO_JS_VERSION = '0.0.117';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@go-avro/avro-js",
3
- "version": "0.0.116",
3
+ "version": "0.0.117",
4
4
  "description": "JS client for Avro backend integration.",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",