Skip to content

Public Guards

@nhtio/lucid-resourceful-vue-components/guards

Type guards that validate runtime shapes and narrow types across validation, HTTP responses/progress, Resourceful Record events, and Resourceful Index actions.

Validation

  • isValidationError — Checks if a value matches a Joi ValidationError instance or compatible plain-object shape. Useful when catching/handling schema validation errors.

Common

  • isObject — True for plain objects (not null, not arrays). Handy for generic payload checks.
  • isHTMLElement - True for HTMLElement objects in browser contexts. Returns false automatically in SSR contexts.

Resourceful Record & HTTP

  • isValues — Values bag used by record forms and hooks; ensures a plain object.
  • isResourceResourcefulRecordResponse — Validates a Resourceful Record success payload shape (generic object).
  • isResourcefulHttpResponse — Validates normalized HTTP responses: { data, status, headers, url }.
  • isResourcefulHttpProgress — Validates progress payloads: { percent (0–100), transferredBytes, totalBytes }.

Resourceful Record event helpers

Boolean helpers that verify the tuple of arguments passed to record lifecycle hooks/events.

  • isResourcefulRecordPreventedEvent(values, error) — Values bag plus a Joi ValidationError.
  • isResourcefulRecordSubmittedEvent(values) — Values bag at submission.
  • isResourcefulRecordProcessingEvent(progress, values) — HTTP progress plus values.
  • isResourcefulRecordSuccessEvent(response, values) — Resourceful record success response plus values.
  • isResourcefulRecordFailureEvent(response, values) — HTTP failure response plus values.

Resourceful Index actions

Guards that validate action configuration objects for ResourcefulIndex.

  • isResourcefulIndexUrlAction — Link-style action that opens a URL (static or computed).
  • isResourcefulIndexFunctionAction — Function-style action that executes logic and reports a ternary result.
  • ResourcefulIndexActionCallback — Single-record action function returning a ternary result.
  • ResourcefulIndexActionIsActionableValidator — Predicate to enable/disable actions per record.
  • ResourcefulIndexBulkActionCallback — Batch action over multiple records with progress updates.
  • ResourcefulIndexProgressCallback(completed, total) progress notifier for actions.
  • ResourcefulIndexSuccessCallback — Called when all results are true.
  • ResourcefulIndexUndeterminedCallback — Called when any result is null.
  • ResourcefulIndexFailureCallback — Called when any result is false.
  • ResourcefulIndexCompleteCallback — Always called after success/undetermined/failure callbacks.