@go-avro/avro-js 0.0.9-beta.2 → 0.0.9

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.
@@ -52,6 +52,7 @@ declare module '../../types/api/Task' {
52
52
  export declare class Task {
53
53
  constructor(init?: Partial<Task>);
54
54
  getStatusLabel: () => "Active" | "Draft" | "Archived" | "Pending Customer Approval" | "Pending Company Approval" | "Pending Payment" | "Pending Activation";
55
+ getOverdueLabel: () => string;
55
56
  getNextDue: () => number | null;
56
57
  computeNextTaskState: (isCustomer: boolean, action: "accept" | "modify" | "reject") => TaskStatus;
57
58
  getPrepaidEventsRemaining: () => number;
@@ -30,9 +30,20 @@ export class Task {
30
30
  return this.status;
31
31
  }
32
32
  };
33
+ this.getOverdueLabel = () => {
34
+ if (this.overdueness === null || this.status !== TaskStatus.ACTIVE) {
35
+ return "N/A";
36
+ }
37
+ else if (this.overdueness <= 0) {
38
+ return "On Time";
39
+ }
40
+ else {
41
+ return `${Math.floor(this.overdueness / 86400)}d overdue`;
42
+ }
43
+ };
33
44
  this.getNextDue = () => {
34
- if (this.frequency > 0) {
35
- const lastEventTime = this.last_completed_event?.time_ended ?? this.time_created;
45
+ if (this.frequency > 0 && (this.status === TaskStatus.ACTIVE)) {
46
+ const lastEventTime = this.last_completed_event?.time_ended ?? this.activate_on ?? this.time_created;
36
47
  return lastEventTime + this.delay + this.frequency;
37
48
  }
38
49
  return null;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@go-avro/avro-js",
3
- "version": "0.0.9-beta.2",
3
+ "version": "0.0.9",
4
4
  "description": "JS client for Avro backend integration.",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",