@welldot/utils

getPermitStatus

Derives the status of a permit (.well v2.3), evaluated on today (a local calendar date at the well site), in order:

getPermitStatus(well, permit, today?): PermitStatus | undefined

Derives the status of a permit (.well v2.3), evaluated on today (a local calendar date at the well site), in order:

  1. A stored administrative status other than granted (requested, suspended, revoked, denied, withdrawn) is returned as-is.
  2. Another permit supersedes it → superseded.
  3. today is before its start date → not_yet_valid.
  4. valid_until is absent, or today is on or before it → active.
  5. renewal_requested_at is on or before valid_until → active_pending_renewal.
  6. Otherwise → expired.

Returns undefined when permit is an id that does not resolve.

Parameters

well

Well

permit

string | Permit

today?

string = ...

Returns

PermitStatus | undefined