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

@bernierllc/task-manager

v0.3.2

Published

Pure task business logic and management utilities for @bernierllc packages

Downloads

125

Readme

@bernierllc/task-manager

Pure task business logic and management utilities for @bernierllc packages.

Installation

npm install @bernierllc/task-manager

Usage

import { TaskManager, CreateTaskRequest } from '@bernierllc/task-manager';

const taskManager = new TaskManager();

// Create a new task
const createRequest: CreateTaskRequest = {
  userId: '123e4567-e89b-12d3-a456-426614174000',
  type: 'review',
  title: 'Review pull request',
  description: 'Review the new authentication feature PR',
  priority: 'high'
};

const result = taskManager.createTask(createRequest);
if (result.success) {
  console.log('Task created:', result.data);
} else {
  console.error('Error:', result.error);
}

// Get all tasks
const tasksResult = taskManager.getTasks();
if (tasksResult.success) {
  console.log('All tasks:', tasksResult.data);
}

// Filter tasks
const filteredResult = taskManager.getTasks({
  userId: '123e4567-e89b-12d3-a456-426614174000',
  status: 'pending',
  priority: 'urgent'
});

// Complete a task
const completionResult = taskManager.completeTask(result.data!.id, {
  completedBy: '123e4567-e89b-12d3-a456-426614174000',
  notes: 'Completed successfully'
});

// Get analytics
const analyticsResult = taskManager.getTaskAnalytics();
if (analyticsResult.success) {
  console.log('Completion rate:', analyticsResult.data!.completionRate);
}

API Reference

TaskManager

Core Methods

  • createTask(request: CreateTaskRequest): TaskOperationResult<Task>
  • getTasks(filters?: TaskFilters): TaskOperationResult<Task[]>
  • getTask(id: string): TaskOperationResult<Task | null>
  • updateTask(id: string, request: UpdateTaskRequest, userId: string): TaskOperationResult<Task>
  • completeTask(id: string, request: TaskCompletionRequest): TaskOperationResult<Task>
  • deleteTask(id: string, userId: string): TaskOperationResult<void>

Task Type Management

  • getTaskTypes(): TaskOperationResult<TaskType[]>
  • createTaskType(taskType: TaskType): TaskOperationResult<TaskType>
  • updateTaskType(id: string, updates: Partial<TaskType>): TaskOperationResult<TaskType>
  • deleteTaskType(id: string): TaskOperationResult<void>

Analytics & History

  • getTaskAnalytics(filters?: TaskFilters): TaskOperationResult<TaskAnalytics>
  • getTaskHistory(taskId?: string): TaskOperationResult<TaskHistoryItem[]>

Validation

  • validateTask(task: Partial<Task>): TaskValidationResult

Utilities

  • getTaskCount(): number
  • getTaskTypeCount(): number
  • clearTasks(): void (for testing)
  • clearTaskTypes(): void (for testing)

Types

Task

interface Task {
  readonly id: string;
  readonly userId: string;
  readonly groupId?: string;
  readonly type: TaskType;
  readonly title: string;
  readonly description: string;
  readonly priority: TaskPriority;
  readonly dueDate?: string;
  readonly status: TaskStatus;
  readonly relatedId?: string;
  readonly actionUrl?: string;
  readonly canCompleteDirectly: boolean;
  readonly createdAt: string;
  readonly updatedAt: string;
  readonly completedAt?: string;
  readonly completedBy?: string;
}

TaskType

interface TaskType {
  readonly id: string;
  readonly name: string;
  readonly description: string;
  readonly icon: string;
  readonly defaultPriority: TaskPriority;
}

TaskPriority

type TaskPriority = 'urgent' | 'high' | 'normal';

TaskStatus

type TaskStatus = 'pending' | 'in-progress' | 'completed';

Default Task Types

The TaskManager comes with 4 built-in task types:

  • review - Review Required (high priority)
  • approval - Approval Needed (urgent priority)
  • update - Update Required (normal priority)
  • notification - Notification (normal priority)

Configuration

All requests are validated using Zod schemas. Invalid data will result in operation failure with descriptive error messages.

Validation Rules

  • Task titles: Required, 1-255 characters
  • Task descriptions: Required, 1-1000 characters
  • User IDs: Must be valid UUIDs
  • Due dates: Must be valid ISO datetime strings
  • Action URLs: Must be valid URL format

Error Handling

All methods return TaskOperationResult<T> with consistent structure:

interface TaskOperationResult<T = void> {
  readonly success: boolean;
  readonly data?: T;
  readonly error?: string;
}

Always check the success property before accessing data.

Features

  • Pure Business Logic - No UI or external dependencies
  • Type Safety - Full TypeScript support with strict typing
  • Validation - Comprehensive input validation using Zod
  • Filtering & Sorting - Flexible task filtering and priority-based sorting
  • Analytics - Built-in analytics and completion metrics
  • Audit Trail - Complete history tracking for all operations
  • Task Types - Flexible task categorization system
  • Error Handling - Consistent error handling with descriptive messages

Integration Status

Logger Integration

Status: Not Applicable

As a core business logic package, @bernierllc/task-manager does not directly integrate with @bernierllc/logger. This package focuses on pure task management logic without side effects. Higher-level services like @bernierllc/task-service are responsible for logger integration and can wrap this package's functionality with appropriate logging.

NeverHub Integration

Status: Not Applicable

This is a core package providing pure business logic. NeverHub integration is handled at the service layer (@bernierllc/task-service) which orchestrates task operations with distributed system awareness. Core packages maintain minimal dependencies for maximum reusability.

Graceful Degradation

This package operates as a self-contained unit with no external service dependencies. All operations are synchronous and deterministic, ensuring consistent behavior regardless of environment.

See Also

License

Copyright (c) 2025 Bernier LLC. All rights reserved.