@go-avro/avro-js 0.0.5 → 0.0.6-beta.0

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.
@@ -51,6 +51,7 @@ declare module '../../types/api/Task' {
51
51
  }
52
52
  export declare class Task {
53
53
  constructor(init?: Partial<Task>);
54
+ getNextDue: () => number | null;
54
55
  computeNextTaskState: (isCustomer: boolean, action: "accept" | "modify" | "reject") => TaskStatus;
55
56
  getPrepaidEventsRemaining: () => number;
56
57
  getPrepaidMonthsRemaining: () => number;
@@ -10,6 +10,13 @@ export const TaskStatus = {
10
10
  };
11
11
  export class Task {
12
12
  constructor(init) {
13
+ this.getNextDue = () => {
14
+ if (this.frequency > 0) {
15
+ const lastEventTime = this.last_completed_event?.time_ended ?? this.time_created;
16
+ return lastEventTime + this.delay + this.frequency;
17
+ }
18
+ return null;
19
+ };
13
20
  this.computeNextTaskState = (isCustomer, action) => {
14
21
  if (action === "accept") {
15
22
  if (this.status === TaskStatus.PENDING_CUSTOMER || this.status === TaskStatus.PENDING_COMPANY) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@go-avro/avro-js",
3
- "version": "0.0.5",
3
+ "version": "0.0.6-beta.0",
4
4
  "description": "JS client for Avro backend integration.",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",