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

rubriqflow-core

v1.4.1

Published

Core business logic and implementations for RubriqFlow applications

Readme

@rubriqflow/core

npm version TypeScript License: MIT

Business logic and utilities for RubriqFlow applications.

🎯 Purpose

This package provides shared business logic implementations that can be used across v2 and FileDrop applications. It contains database-agnostic utilities, validation logic, and common functionality.

✨ Key Features

  • 🔐 Password Validation: Comprehensive password strength validation with FileDrop requirements
  • 📧 Email Validation: Email format validation and darkware domain detection
  • 🔑 Access Code Generation: 6-character alphanumeric codes for FileDrop portfolios
  • 🆔 ID Generation: Unique ID generation for users, organizations, portfolios, and files
  • 🧪 100% Test Coverage: Comprehensive test suite with TDD approach
  • 📚 Full Documentation: TSDoc comments for all functions

📦 Installation

npm install @rubriqflow/core
# or
yarn add @rubriqflow/core
# or
pnpm add @rubriqflow/core

🚀 Quick Start

import { PasswordValidator, EmailValidator } from '@rubriqflow/core';

// Password validation
const passwordValidator = new PasswordValidator();
const result = passwordValidator.validatePasswordStrength('Password123');
console.log(result.isValid); // true
console.log(result.score); // 100

// Email validation
const emailValidator = new EmailValidator();
const isValid = emailValidator.validateEmail('[email protected]');
console.log(isValid); // true

// Darkware email detection (for testing)
const isDarkware = emailValidator.isDarkwareEmail('[email protected]');
console.log(isDarkware); // true

// Access code generation
const accessCode = passwordValidator.generateAccessCode();
console.log(accessCode); // "ABC123"

📋 Available Utilities

🔐 PasswordValidator

Comprehensive password validation and hashing utilities.

import { PasswordValidator } from '@rubriqflow/core';

const validator = new PasswordValidator();

// Validate password strength
const result = validator.validatePasswordStrength('Password123');
// Returns: { isValid: boolean, score: number, feedback: string[], requirements: {...} }

// Hash password
const hash = await validator.hashPassword('Password123');

// Verify password
const isValid = await validator.verifyPassword('Password123', hash);

// Generate access codes
const code = validator.generateAccessCode(); // "ABC123"
const isValidCode = validator.validateAccessCode('ABC123'); // true

// Generate unique IDs
const userId = validator.generateUserId(); // "user_1234567890_abc123"
const orgId = validator.generateOrganizationId(); // "org_1234567890_abc123"

Password Requirements:

  • Minimum 10 characters
  • At least 1 number
  • At least 1 uppercase letter
  • At least 1 lowercase letter

📧 EmailValidator

Email validation and normalization utilities.

import { EmailValidator } from '@rubriqflow/core';

const validator = new EmailValidator();

// Validate email format
const isValid = validator.validateEmail('[email protected]');

// Check for darkware domain (testing)
const isDarkware = validator.isDarkwareEmail('[email protected]');

// Extract domain
const domain = validator.extractDomain('[email protected]'); // "example.com"

// Normalize email
const normalized = validator.normalizeEmail('[email protected]'); // "[email protected]"

// Comprehensive validation for registration
const result = validator.validateEmailForRegistration('[email protected]');
// Returns: { isValid: boolean, isDarkware: boolean, normalizedEmail: string, domain: string | null }

// Token generation and validation
const verifyToken = validator.generateEmailVerificationToken();
const resetToken = validator.generatePasswordResetToken();
const isExpired = validator.isTokenExpired(token);

🧪 Testing

The core library includes comprehensive tests:

# Run all tests
npm test

# Run tests in watch mode
npm run test:watch

# Generate coverage report
npm run test:coverage

Test Categories

  1. Password Validation Tests - Verify password strength requirements
  2. Email Validation Tests - Test email format and darkware detection
  3. Access Code Tests - Verify 6-character code generation
  4. ID Generation Tests - Ensure unique ID generation
  5. Edge Case Tests - Handle null/undefined inputs gracefully

📊 Current Coverage

  • Statements: 60.54%
  • Branches: 67.5%
  • Functions: 52.17%
  • Lines: 60.13%

🏗️ Architecture

The core library follows these principles:

1. Database Agnostic

All utilities work without database dependencies, making them reusable across different storage backends.

2. Pure Functions

Most functions are pure and stateless, making them easy to test and reason about.

3. Error Handling

Comprehensive error handling with meaningful error messages.

4. Type Safety

Full TypeScript support with strict type checking.

🔄 Versioning

This package follows Semantic Versioning:

  • MAJOR (1.0.0 → 2.0.0): Breaking changes to public APIs
  • MINOR (1.0.0 → 1.1.0): New features, backward compatible
  • PATCH (1.0.0 → 1.0.1): Bug fixes, backward compatible

🏢 Usage in Applications

RubriqFlow v2

// v2/lib/implementations/services/AuthService.ts
import { PasswordValidator, EmailValidator } from '@rubriqflow/core';

export class AuthService implements IAuthService {
  private passwordValidator = new PasswordValidator();
  private emailValidator = new EmailValidator();

  async validatePasswordStrength(password: string) {
    return this.passwordValidator.validatePasswordStrength(password);
  }

  async hashPassword(password: string) {
    return this.passwordValidator.hashPassword(password);
  }
}

FileDrop MVP

// filedrop/lib/implementations/services/FileDropService.ts
import { PasswordValidator, EmailValidator } from '@rubriqflow/core';

export class FileDropService implements IFileDropService {
  private passwordValidator = new PasswordValidator();
  private emailValidator = new EmailValidator();

  generateAccessCode() {
    return this.passwordValidator.generateAccessCode();
  }

  validateEmail(email: string) {
    return this.emailValidator.validateEmail(email);
  }
}

🤝 Contributing

  1. Write Tests First: Follow TDD approach
  2. Document Everything: Add TSDoc comments
  3. Maintain Coverage: Keep test coverage above 60%
  4. Follow Patterns: Use existing code patterns
  5. Type Safety: Ensure full TypeScript compliance

📄 License

MIT License - see LICENSE file for details.

🔗 Related Packages

  • @rubriqflow/contracts - Interface contracts (dependency)
  • @rubriqflow/database - Database schema and utilities
  • @rubriqflow/ui-components - React component library

📊 Package Statistics

  • Utilities: 2 main classes
  • Test Coverage: 60%+ across all metrics
  • Dependencies: @rubriqflow/contracts, bcryptjs
  • Bundle Size: ~50KB (including bcryptjs)
  • TypeScript: Full support with strict mode

Built with ❤️ by the RubriqFlow Team