@go-avro/avro-js 1.6.6-rc15 → 1.6.6-rc16

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.
@@ -122,8 +122,6 @@ export declare class Task {
122
122
  computeNextTaskState: (isCustomer: boolean, action: "accept" | "modify" | "reject") => TaskStatus;
123
123
  getPrepaidEventsRemaining: () => number;
124
124
  getPrepaidMonthsRemaining: () => number;
125
- /** Local midnight starting the day of the route's current occurrence. */
126
- private routeDayStart;
127
125
  isDone: (route: Route) => boolean;
128
126
  /**
129
127
  * Whether this visit of `route` should do the task: it's active and
@@ -66,6 +66,12 @@ export const getTaskOverdueness = (task, now = Date.now() / 1000) => {
66
66
  }
67
67
  return overdueTime / (86400 * (task.priority ? 1 : 7));
68
68
  };
69
+ /** Local midnight starting the day of the route's current occurrence. */
70
+ function routeDayStart(route) {
71
+ const day = new Date((route.start_time ?? 0) * 1000);
72
+ day.setHours(0, 0, 0, 0);
73
+ return day;
74
+ }
69
75
  export class Task {
70
76
  constructor(init) {
71
77
  this.getStatusLabel = () => {
@@ -173,12 +179,6 @@ export class Task {
173
179
  return acc;
174
180
  }, 0);
175
181
  };
176
- /** Local midnight starting the day of the route's current occurrence. */
177
- this.routeDayStart = (route) => {
178
- const day = new Date((route.start_time ?? 0) * 1000);
179
- day.setHours(0, 0, 0, 0);
180
- return day;
181
- };
182
182
  this.isDone = (route) => {
183
183
  if (!this.status || this.status !== TaskStatus.ACTIVE) {
184
184
  return true;
@@ -188,7 +188,7 @@ export class Task {
188
188
  // an early-started visit that finishes a few minutes before
189
189
  // route.start_time) while still rejecting stale events from previous
190
190
  // occurrences. Applies to both recurring and one-shot tasks.
191
- const cutoff = Math.floor(this.routeDayStart(route).getTime() / 1000);
191
+ const cutoff = Math.floor(routeDayStart(route).getTime() / 1000);
192
192
  return (this.last_completed_event?.time_ended ?? 0) >= cutoff;
193
193
  };
194
194
  /**
@@ -206,7 +206,7 @@ export class Task {
206
206
  const nextDue = this.getNextDue();
207
207
  if (nextDue == null)
208
208
  return true;
209
- const routeDayEnd = this.routeDayStart(route);
209
+ const routeDayEnd = routeDayStart(route);
210
210
  routeDayEnd.setDate(routeDayEnd.getDate() + 1);
211
211
  const nextVisit = route.getNextOccurrence(routeDayEnd);
212
212
  // One-off routes have no next visit: then only the route's day counts.
package/dist/version.d.ts CHANGED
@@ -1 +1 @@
1
- export declare const AVRO_JS_VERSION = "1.6.6-rc15";
1
+ export declare const AVRO_JS_VERSION = "1.6.6-rc16";
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 = '1.6.6-rc15';
3
+ export const AVRO_JS_VERSION = '1.6.6-rc16';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@go-avro/avro-js",
3
- "version": "1.6.6-rc15",
3
+ "version": "1.6.6-rc16",
4
4
  "description": "JS client for Avro backend integration.",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",