Skip to content

Documentation · IGNIS

Statuses - Full Reference ​

Exhaustive reference for Statuses, its specialized subclasses, and the BindingNamespaces/CoreBindings constant catalogs. For an introduction and the common tasks, start with the Statuses overview.

Files:

Statuses ​

A static class of 'NNN_NAME' status code constants, grouped by an HTTP-inspired numeric prefix, plus Set groupings and validator methods.

Source -> packages/kernel/src/common/statuses/

A browser bundle imports Statuses and CommonStatuses from @venizia/ignis-kernel/statuses: the entry holds those two classes and imports nothing else. The root export is unchanged.

Status code scheme ​

PrefixCategoryMeaningReversibility
0xxInitialEntity creation/draft stateN/A
1xxPendingAwaiting action or decisionReversible
2xxActiveIn progress or runningReversible
3xxCompletedPositive terminal stateTerminal
4xxInactiveNegative but reversibleReversible
5xxFailedNegative terminal stateTerminal

0xx - Initial states ​

ConstantValueDescription
UNKNOWN'000_UNKNOWN'Unknown or uninitialized state
DRAFT'001_DRAFT'Draft state, not yet finalized

1xx - Pending/waiting states ​

ConstantValueDescription
NEW'100_NEW'Newly created, not yet processed
QUEUED'101_QUEUED'Queued for processing
SCHEDULED'102_SCHEDULED'Scheduled for future execution
PENDING'103_PENDING'Awaiting action or decision
IN_REVIEW'104_IN_REVIEW'Under review or approval process
OPEN'105_OPEN'Open for work, unlike NEW, which was only just created
SUBMITTED'106_SUBMITTED'Handed in by its author and waiting for the next step, unlike PENDING, which waits for no one in particular

2xx - Active/running states ​

ConstantValueDescription
ENABLED'200_ENABLED'Feature or entity is enabled
ACTIVATED'201_ACTIVATED'Account or service is active
RUNNING'202_RUNNING'Process is currently running
PROCESSING'203_PROCESSING'Being actively processed
SENT'204_SENT'Message/item has been sent
RECEIVED'205_RECEIVED'Message/item has been received
READY'206_READY'Prepared and able to start, unlike ENABLED, which only says it is switched on
PUBLISHED'207_PUBLISHED'Made visible to its audience
ISSUED'208_ISSUED'Formally issued, such as an invoice or a ticket, and in force

3xx - Completed states ​

Positive terminal states.

ConstantValueDescription
PARTIAL'300_PARTIAL'Partially completed
APPROVED'301_APPROVED'Approved by reviewer
SUCCESS'302_SUCCESS'Successfully completed
COMPLETED'303_COMPLETED'Fully completed
SETTLED'304_SETTLED'Finalized or settled
CONFIRMED'305_CONFIRMED'Confirmed by user or system
RESOLVED'306_RESOLVED'The problem or request is dealt with, unlike COMPLETED, which finishes a piece of work

4xx - Inactive states ​

Negative but reversible - the entity can be reactivated.

ConstantValueDescription
DISABLED'400_DISABLED'Feature or entity is disabled
DEACTIVATED'401_DEACTIVATED'Account or service is deactivated
SUSPENDED'402_SUSPENDED'Temporarily suspended
BLOCKED'403_BLOCKED'Access blocked (e.g. banned user)
CLOSED'404_CLOSED'Closed but can be reopened
ARCHIVED'405_ARCHIVED'Archived for record keeping
PAUSED'406_PAUSED'Paused, can be resumed
REVOKED'407_REVOKED'Permission or access revoked
REFUNDED'408_REFUNDED'Payment or transaction refunded

5xx - Failed/error states ​

Negative terminal states - permanent failure or cancellation.

ConstantValueDescription
FAIL'500_FAIL'General failure
EXPIRED'501_EXPIRED'Expired and no longer valid
TIMEOUT'502_TIMEOUT'Operation timed out
SKIPPED'503_SKIPPED'Intentionally skipped
ABORTED'504_ABORTED'Aborted by system
CANCELLED'505_CANCELLED'Cancelled by user/admin
DELETED'506_DELETED'Soft deleted
REJECTED'507_REJECTED'Rejected by reviewer
VOIDED'508_VOIDED'An issued document made void, unlike CANCELLED, which is stopped before it finishes

Group sets ​

Each phase has a static Set<string> of its member statuses, plus SCHEME_SET, the union of all six.

SetMembers
INITIAL_SCHEME_SETUNKNOWN, DRAFT
PENDING_SCHEME_SETNEW, QUEUED, SCHEDULED, PENDING, IN_REVIEW, OPEN, SUBMITTED
ACTIVE_SCHEME_SETENABLED, ACTIVATED, RUNNING, PROCESSING, SENT, RECEIVED, READY, PUBLISHED, ISSUED
COMPLETED_SCHEME_SETCOMPLETED, SUCCESS, PARTIAL, SETTLED, APPROVED, CONFIRMED, RESOLVED
INACTIVE_SCHEME_SETDISABLED, DEACTIVATED, SUSPENDED, BLOCKED, CLOSED, ARCHIVED, PAUSED, REVOKED, REFUNDED
FAILED_SCHEME_SETFAIL, EXPIRED, TIMEOUT, SKIPPED, ABORTED, CANCELLED, DELETED, REJECTED, VOIDED
SCHEME_SETAll statuses across all six sets combined
typescript
import { Statuses } from '@venizia/ignis';

// Membership check
Statuses.ACTIVE_SCHEME_SET.has(order.status);

// Spread into a query operator
await jobRepository.find({
  filter: { where: { status: { inq: [...Statuses.FAILED_SCHEME_SET] } } },
});

Validation methods ​

The leading digit of a code is its phase, so a category check reads the digit and not a list. All methods take a string and return boolean.

MethodTrue when
isInitial(status)the code starts with 0
isPending(status)the code starts with 1
isActive(status)the code starts with 2
isCompleted(status)the code starts with 3
isInactive(status)the code starts with 4
isFailed(status)the code starts with 5
isValid(status)the code has the shape NNN_NAME: a digit 0-5, two digits, an underscore, then upper-case letters, digits and underscores

The leading-digit rule belongs to Statuses and the classes that extend it. A domain class whose NNN_ prefix is an ordinal step number, such as a ticket workflow that counts up to 900, must not use these checks: its 9xx codes mean nothing to them.

isValid checks the shape, not membership of the built-in list. Statuses.SCHEME_SET and the group sets stay the list of the built-in statuses.

typescript
export class Statuses {
  static isInitial(status: string): boolean;
  static isPending(status: string): boolean;
  static isActive(status: string): boolean;
  static isCompleted(status: string): boolean;
  static isInactive(status: string): boolean;
  static isFailed(status: string): boolean;
  static isValid(status: string): boolean;
}

Your own statuses ​

Extend Statuses and add codes with the prefix of their phase. The built-in constants are inherited, and the checks work on the new codes:

typescript
import { Statuses } from '@venizia/ignis-kernel/statuses';

class OrderStatuses extends Statuses {
  static readonly SHIPPING = '209_SHIPPING';
}

OrderStatuses.isActive(OrderStatuses.SHIPPING); // true
OrderStatuses.isValid(OrderStatuses.SHIPPING); // true
OrderStatuses.ACTIVATED; // '201_ACTIVATED'

Specialized status classes ​

Each specialized class references Statuses values directly - it does not define new status strings, only a named subset plus its own SCHEME_SET and isValid().

MigrationStatuses ​

Database migration tracking.

typescript
export class MigrationStatuses {
  static readonly UNKNOWN = Statuses.UNKNOWN; // '000_UNKNOWN'
  static readonly SUCCESS = Statuses.SUCCESS; // '302_SUCCESS'
  static readonly FAIL = Statuses.FAIL;       // '500_FAIL'

  static readonly SCHEME_SET = new Set([this.UNKNOWN, this.SUCCESS, this.FAIL]);

  static isValid(scheme: string): boolean;
}

CommonStatuses ​

Shared statuses reused across entity types.

typescript
export class CommonStatuses {
  static readonly UNKNOWN = Statuses.UNKNOWN;             // '000_UNKNOWN'
  static readonly ACTIVATED = Statuses.ACTIVATED;         // '201_ACTIVATED'
  static readonly DEACTIVATED = Statuses.DEACTIVATED;     // '401_DEACTIVATED'
  static readonly BLOCKED = Statuses.BLOCKED;             // '403_BLOCKED'
  static readonly ARCHIVED = Statuses.ARCHIVED;           // '405_ARCHIVED'

  static readonly SCHEME_SET = new Set([
    this.UNKNOWN,
    this.ACTIVATED,
    this.DEACTIVATED,
    this.BLOCKED,
    this.ARCHIVED,
  ]);

  static isValid(scheme: string): boolean;
}

UserStatuses / RoleStatuses ​

Both classes extend CommonStatuses with an empty body - they add no members of their own, inheriting every constant, SCHEME_SET, and isValid() unchanged. They exist as distinct, named types for user- and role-domain statuses.

typescript
export class UserStatuses extends CommonStatuses {}
export class RoleStatuses extends CommonStatuses {}

UserTypes ​

Not a status class - a separate classification of user origin. Unrelated to lifecycle phase.

typescript
export class UserTypes {
  static readonly SYSTEM = 'SYSTEM'; // System-generated users
  static readonly LINKED = 'LINKED'; // External auth (OAuth, SAML, etc.)

  static readonly SCHEME_SET = new Set([this.SYSTEM, this.LINKED]);

  static isValid(orgType: string): boolean;
}

Binding namespaces ​

Organizes dependency-injection binding keys by artifact type. Distinct from Statuses - not a lifecycle catalog.

Source -> packages/kernel/src/common/bindings.ts

BindingNamespaces ​

typescript
export class BindingNamespaces {
  static readonly COMPONENT = 'components';
  static readonly DATASOURCE = 'datasources';
  static readonly REPOSITORY = 'repositories';
  static readonly MODEL = 'models';
  static readonly SERVICE = 'services';
  static readonly MIDDLEWARE = 'middlewares';
  static readonly PROVIDER = 'providers';
  static readonly CONTROLLER = 'controllers';
  static readonly CONFIGURATION = 'configurations';

  static createNamespace(opts: { name: string }): string;
}

Each namespace constant is built via createNamespace(), and the method is public so an application can mint its own.

A namespace is the leading segment of a binding key, and a binding is tagged with that segment alone. createNamespace throws when the name would break that rule:

NameResult
'components', 'x-tenants', '@app'returned unchanged
'acme.services'throws - only acme would become the tag
'' or a missing valuethrows - the key would carry no namespace and no tag
'my services'throws - whitespace in a key

TBindingNamespace is TConstValue<typeof BindingNamespaces>. Since createNamespace returns string, the alias widens to string rather than narrowing to the nine values.

CoreBindings ​

Application-level binding keys. Extends BindingKeys from @venizia/ignis-inversion.

typescript
export class CoreBindings extends BindingKeys {
  static readonly APPLICATION_INSTANCE = '@app/instance';
  static readonly APPLICATION_SERVER = '@app/server';
  static readonly APPLICATION_CONFIG = '@app/config';
  static readonly APPLICATION_PROJECT_ROOT = '@app/project_root';
  static readonly APPLICATION_ROOT_ROUTER = '@app/router/root';
  static readonly APPLICATION_ENVIRONMENTS = '@app/environments';
  static readonly APPLICATION_MIDDLEWARE_OPTIONS = '@app/middleware_options';
}
ConstantValueDescription
APPLICATION_INSTANCE'@app/instance'The running application instance
APPLICATION_SERVER'@app/server'The underlying HTTP server
APPLICATION_CONFIG'@app/config'Resolved application configuration
APPLICATION_PROJECT_ROOT'@app/project_root'Absolute path to the project root
APPLICATION_ROOT_ROUTER'@app/router/root'The root Hono router
APPLICATION_ENVIRONMENTS'@app/environments'Loaded environment variables
APPLICATION_MIDDLEWARE_OPTIONS'@app/middleware_options'Global middleware configuration
typescript
import { CoreBindings } from '@venizia/ignis';

const app = container.get(CoreBindings.APPLICATION_INSTANCE);
const config = container.get(CoreBindings.APPLICATION_CONFIG);

Usage patterns ​

Entity lifecycle in a service ​

typescript
import { Statuses } from '@venizia/ignis';

class OrderService extends BaseService {
  async createOrder(data: CreateOrderDto) {
    return this.orderRepository.create({ data: { ...data, status: Statuses.NEW } });
  }

  async processOrder(orderId: string) {
    await this.orderRepository.updateById({
      id: orderId,
      data: { status: Statuses.PROCESSING, startedAt: new Date() },
    });

    try {
      await this.paymentService.charge(orderId);
      await this.orderRepository.updateById({
        id: orderId,
        data: { status: Statuses.COMPLETED, completedAt: new Date() },
      });
    } catch (error) {
      await this.orderRepository.updateById({
        id: orderId,
        data: { status: Statuses.FAIL, failedAt: new Date() },
      });
      throw error;
    }
  }

  async cancelOrder(orderId: string) {
    const order = await this.orderRepository.findById({ id: orderId });
    if (Statuses.isCompleted(order.status) || Statuses.isFailed(order.status)) {
      throw getError({ message: 'Cannot cancel a completed or failed order' });
    }
    await this.orderRepository.updateById({
      id: orderId,
      data: { status: Statuses.CANCELLED },
    });
  }
}

Validating a status transition ​

typescript
import { Statuses } from '@venizia/ignis';

function validateStatusTransition(from: string, to: string) {
  if (!Statuses.isValid(to)) {
    throw getError({ message: `Invalid status: ${to}` });
  }
  if (Statuses.isCompleted(from) || Statuses.isFailed(from)) {
    throw getError({ message: 'Cannot transition from a terminal state' });
  }
  return true;
}

Best practices ​

  • Use the constants, not magic strings. Statuses.COMPLETED, never '303_COMPLETED' - typos in a raw string pass type checking silently.
  • Validate before writing. Call Statuses.isValid() on any status that originates outside the constant catalog (request body, external system) before persisting it. It rejects a malformed code and accepts any well-formed one; to accept only the built-in statuses, check Statuses.SCHEME_SET.has(status).
  • Prefer the is* helpers over raw set checks. Statuses.isActive(x) reads better than Statuses.ACTIVE_SCHEME_SET.has(x), and it is true for your own 2xx codes too, which the set is not.
  • Check terminal states before mutating. isCompleted() and isFailed() both signal a terminal status - guard state-changing operations against both.

See also ​