npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@forwardslashns/taskit-validation-messages

v1.10.16

Published

Validation messages for Taskit and mechanism for reading these messages dynamically.

Readme

Taskit Validation Messages

This package provides a centralized list of validation messages used across both frontend and backend of the project. It ensures consistent error display and simplifies maintenance by keeping all validation messages in one place, without altering code in development repositories.

✨ Features

  • Centralized validation messages across all features
  • Type-safe message retrieval with TypeScript
  • Feature name constants to eliminate magic strings (v1.3.0+)
  • Message key constants to eliminate magic strings for error aliases (v1.3.1+)
  • Dynamic parameter substitution for contextual messages
  • Affected fields tracking for better frontend UX (v1.1.0+)

VALIDATION_FEATURES (v1.3.0+)

To avoid using magic strings and improve type safety, the package now exports VALIDATION_FEATURES constants:

import { getValidationMessage, VALIDATION_FEATURES } from '@forwardslashns/taskit-validation-messages';

// ✅ Recommended: Use constants
const result = getValidationMessage(VALIDATION_FEATURES.CLIENT_CURRENT_ENTITY_STATUS, 'NAME_ALREADY_EXISTS', {
  name: 'Client Name',
});

// ❌ Not recommended: Using string literals
const result = getValidationMessage('CLIENT_CURRENT_ENTITY_STATUS', 'NAME_ALREADY_EXISTS', { name: 'Client Name' });

Available Feature Constants

VALIDATION_FEATURES.ACCOUNT_CATEGORY;
VALIDATION_FEATURES.ACCOUNT_ID;
VALIDATION_FEATURES.CLIENT_RECORD_ADDRESS;
VALIDATION_FEATURES.BUSINESS_ACTIVITY;
VALIDATION_FEATURES.CLIENT_RECORD_BANK_AND_CREDIT_CARD;
VALIDATION_FEATURES.CLIENT_RECORD_CONTACT;
VALIDATION_FEATURES.CLIENT_RECORD_COMISSION_DETAIL;
VALIDATION_FEATURES.CLIENT_CURRENT_ENTITY_STATUS;
VALIDATION_FEATURES.CLIENT_RECORD_ENTITY_TYPE_HISTORY;
VALIDATION_FEATURES.CLIENT_RECORD_FILING_STATUS_HISTORY;
VALIDATION_FEATURES.CLIENT_RECORD_ENTITY_STATE_HISTORY;
VALIDATION_FEATURES.CLIENT_RELATIONSHIP;
VALIDATION_FEATURES.FILING_CATEGORY;
VALIDATION_FEATURES.STATE;
VALIDATION_FEATURES.USER;
VALIDATION_FEATURES.ROLE_AND_PERMISSION;
VALIDATION_FEATURES.DATA_FILTER;
VALIDATION_FEATURES.USER_PREFERENCE;
VALIDATION_FEATURES.CLIENT_RECORD_OUTSIDE_PROVIDER;

VALIDATION_MESSAGES

The package exposes validation messages that can be retrieved using specific aliases. These messages are organized by the features they belong to, making it easier to manage and update them.

getValidationMessage

This mechanism allows for the retrieval and dynamic creation of validation messages by passing their aliases and any required parameters. Parameters are optional and passed as objects, following the structure defined within each validation message itself.

Return Value (v1.1.0+)

getValidationMessage now returns a ValidationMessageResult object:

{
  content: string;          // The formatted validation message
  affectedFields: string[]; // Array of field identifiers affected by this validation error
}

Usage

import { getValidationMessage, VALIDATION_FEATURES } from '@forwardslashns/taskit-validation-messages';

// ✅ Best practice: Use feature constants (v1.3.0+)
const result = getValidationMessage(VALIDATION_FEATURES.ACCOUNT_CATEGORY, 'NAME_ALREADY_EXISTS', { name: 'Marketing' });

// Also works: String literals (backward compatible)
const result2 = getValidationMessage('ACCOUNT_CATEGORY', 'NAME_ALREADY_EXISTS', {
  name: 'Marketing',
});

console.log(result.content); // "Account category with the same name 'Marketing' already exists"
console.log(result.affectedFields); // ['name']

// In API responses
return reply.status(400).send({
  message: result.content,
  affectedFields: result.affectedFields,
});

Migration from v1.0.x

See MIGRATION_GUIDE.md for detailed migration instructions.

Quick update:

// Old (v1.0.x)
const message = getValidationMessage('FEATURE', 'ERROR');

// New (v1.1.0+)
const { content, affectedFields } = getValidationMessage('FEATURE', 'ERROR');

Documentation