Skip to content

Releases: Adedoyin-Emmanuel/tsfluent

v1.5.0

13 Feb 20:04
Compare
Choose a tag to compare

TsFluent v1.5.2 Release Notes 🎉

Major Features 🌟

CommonJS and ESM Support

  • Added dual module support for both CommonJS and ES Modules
  • Improved package configuration for better module compatibility
  • Enhanced TypeScript configuration for broader project support

Package Configuration Updates

  • Fixed module resolution issues
  • Improved compatibility with different project setups
  • Better support for various import methods

Module System Support 📦

CommonJS Usage

// Using require
const { Result } = require("tsfluent");

// Using dynamic import
const { Result } = await import("tsfluent");

ES Modules Usage

// Using ES Module import
import { Result } from "tsfluent";

Configuration Examples 🛠️

For CommonJS Projects

// tsconfig.json
{
  "compilerOptions": {
    "module": "CommonJS",
    "esModuleInterop": true
  }
}

For ES Module Projects

// package.json
{
  "type": "module"
}

// tsconfig.json
{
  "compilerOptions": {
    "module": "ESNext",
    "moduleResolution": "bundler"
  }
}

Breaking Changes ⚠️

  • No breaking changes in this release
  • Maintains backward compatibility with v1.3.x
  • All existing APIs remain unchanged

Bug Fixes 🐛

  • Fixed package configuration issues
  • Resolved module resolution conflicts
  • Improved TypeScript type definitions

Documentation Updates 📚

  • Added clear examples for different module systems
  • Updated installation and usage instructions
  • Enhanced API documentation clarity

Migration Guide 🔄

Updating from v1.3.x

No migration steps required! This release is fully backward compatible.

For optimal usage:

  1. Update to the latest version:

    npm install tsfluent@latest
    # or
    yarn add tsfluent@latest
    # or
    pnpm add tsfluent@latest
    # or
    bun add tsfluent@latest
  2. Choose your preferred import style:

    // ES Modules
    import { Result } from "tsfluent";
    
    // CommonJS
    const { Result } = require("tsfluent");

Performance Improvements ⚡

  • Optimized module loading
  • Improved type checking performance
  • Better tree-shaking support

What's Next? 🔮

We're planning several exciting features for upcoming releases:

  • Enhanced error handling patterns
  • Additional utility functions
  • More convenience methods
  • Performance optimizations

Feedback and Support 💬

We welcome your feedback and contributions! Please:

Contributors 👥

Special thanks to all contributors who helped make this release possible! Your contributions are greatly appreciated.

License 📄

TsFluent is released under the MIT License. See the LICENSE file for details.

v1.3.0

13 Feb 11:07
Compare
Choose a tag to compare

TsFluent v1.3.0 Release Notes 🎉

Major Features 🌟

Generic Context Support

  • Added TContext generic parameter to both Result and ResultAsync classes
  • Type-safe context handling in metadata and error objects
  • Improved type inference in chaining operations
  • Better IDE support with accurate type hints

Property-Based Access

  • Introduced direct property access for better developer experience:
    • result.errors instead of getErrors()
    • result.metadata instead of getMetadata()
    • Deprecated method-based access in favor of properties

Enhanced Error Handling

  • Improved error context preservation across transformations
  • Better retry information in AsyncUtils error context
  • Rich metadata support with timestamps and custom contexts

API Improvements

  • Enhanced ResultAsync.from() for better Promise handling
  • Improved AsyncUtils.tryAsync() with configurable retries and timeouts
  • Added comprehensive type safety across all operations

Breaking Changes ⚠️

Deprecated Methods

  • getErrors() → use errors property instead
  • getMetadata() → use metadata property instead

Type Changes

  • ResultAsync.from<T>() now only accepts one generic type parameter
  • AsyncUtils.tryAsync<T>() simplified to one generic type parameter
  • Context types must extend Record<string, unknown>

New Features in Detail 📝

Result Class

// New context support
interface UserContext {
  userId: string;
  environment: "dev" | "prod";
}

const result = Result.ok<number, UserContext>(42)
  .withMetadata({
    context: {
      userId: "123",
      environment: "prod"
    }
  });

ResultAsync Class

// Improved Promise handling
const result = await ResultAsync.from<Response>(
  fetch("https://api.example.com/data")
);

// Type-safe metadata
result.withMetadata({
  context: {
    requestId: "123",
    endpoint: "/data"
  }
});

AsyncUtils

// Enhanced retry configuration
const result = await AsyncUtils.tryAsync(
  async () => {
    // async operation
  },
  3,    // maxAttempts
  1000, // delayMs
  2000  // timeoutMs
);

Bug Fixes 🐛

  • Fixed type compatibility issues between Result and ResultAsync
  • Corrected metadata propagation in transformation methods
  • Resolved context type preservation in chaining operations
  • Fixed error context handling in retry operations

Performance Improvements ⚡

  • Optimized error handling chain
  • Improved type inference performance
  • Better memory usage in retry operations

Documentation Updates 📚

  • Added comprehensive examples for all new features
  • Updated API reference with accurate type information
  • Improved code samples with real-world use cases
  • Added detailed error handling scenarios

Migration Guide 🔄

Updating from v1.1.x

  1. Replace method calls with property access:

    // Old
    result.getErrors();
    result.getMetadata();
    
    // New
    result.errors;
    result.metadata;
  2. Update generic type parameters:

    // Old
    ResultAsync.from<T, Context>();
    
    // New
    ResultAsync.from<T>();
  3. Review context types:

    // Ensure context types extend Record<string, unknown>
    interface YourContext extends Record<string, unknown> {
      // your context properties
    }

Contributors 👥

Special thanks to all contributors who helped make this release possible!

What's Next? 🔮

We're planning several exciting features for upcoming releases:

  • Enhanced error categorization
  • More utility functions for common patterns
  • Additional convenience methods for error handling
  • Performance optimizations

Feedback and Support 💬

We welcome your feedback and contributions! Please:

License 📄

TsFluent is released under the MIT License. See the LICENSE file for details.

v1.2.0

13 Feb 09:25
Compare
Choose a tag to compare

TsFluent v1.2.0 🎉

This release introduces powerful type-safe context support and enhanced metadata handling, making TsFluent even more robust and developer-friendly.

🌟 Key Features

Generic Context Support

  • Added TContext generic parameter to both Result and ResultAsync
  • Type-safe context handling in metadata
  • Improved type inference in chaining operations

Enhanced API

  • New property-based access for better DX:
    • result.errors instead of getErrors()
    • result.metadata instead of getMetadata()
  • Improved metadata propagation in transformations
  • Better type safety across all operations

Developer Experience

  • Comprehensive documentation with TypeScript examples
  • Enhanced type safety in method chaining
  • Better error handling with context preservation

🔥 Example Usage

interface ApiContext {
    requestId: string;
    endpoint: string;
}

const result = await ResultAsync
        .from<Response, ApiContext>(fetch("https://api.example.com/data"))
        .withMetadata({
        context: {
            requestId: "req-123",
            endpoint: "/data"
       }
});

// Type-safe access to context
const context = result.metadata?.context; // Type is ApiContext | undefined

🔧 Breaking Changes

  • Deprecated getErrors() in favor of errors property
  • Deprecated getMetadata() in favor of metadata property

📝 Documentation

Full documentation and examples available in the README

v1.1.0

13 Feb 08:18
Compare
Choose a tag to compare

v1.1.0 - API Enhancement

Breaking Changes

  • Changed method-style accessors to properties for better ergonomics:
    • isSuccess()isSuccess
    • isFailure()isFailure
    • getValue()value
    • getErrors()errors

Improvements

  • More intuitive property-based API that aligns with TypeScript best practices
  • Simplified access to result states and values
  • Improved type safety and reduced verbosity in code
  • Updated all internal utilities and extensions to use the new property-based API

Migration Guide

Replace all method calls with property access:

v1.0.5

13 Feb 04:10
Compare
Choose a tag to compare

v1.0.5 - Documentation Update 📚

Changes

  • 📝 Updated README with correct method names and signatures
  • 🔧 Fixed incorrect API examples to match actual implementation
  • 📚 Added proper ResultAsync documentation
  • 🎯 Updated code examples with accurate usage patterns
  • 🔄 Fixed repository URLs in documentation

v1.0.4

13 Feb 04:07
Compare
Choose a tag to compare

v1.0.4 - Documentation Update 📚

Changes

  • 📝 Updated README with correct method names and signatures
  • 🔧 Fixed incorrect API examples to match actual implementation
  • 📚 Added proper ResultAsync documentation
  • 🎯 Updated code examples with accurate usage patterns
  • 🔄 Fixed repository URLs in documentation

v1.0.3

12 Feb 21:26
Compare
Choose a tag to compare

v1.0.2 - Package Configuration Updates 🔧

Changes

  • 📝 Updated repository URL from tsresult to tsfluent to match npm package name
  • 🛠️ Fixed module and types paths to correctly point to ./dist/src/index.js and ./dist/src/index.d.ts

v1.0.2

12 Feb 21:06
Compare
Choose a tag to compare

v1.0.2 - Repository URL Update 🔧

Changes

  • 📝 Updated repository URL from tsresult to tsfluent to match npm package name
  • Updated related URLs in package.json (homepage, bugs)

v1.0.1

12 Feb 20:53
Compare
Choose a tag to compare

v1.0.1 - Package Metadata Update 🔧

Changes

  • 📝 Updated repository URL in package.json to reflect the correct GitHub repository

v1.0.0

12 Feb 20:46
Compare
Choose a tag to compare

v1.0.0 - Initial Release 🎉

A powerful and fluent Result type implementation for TypeScript, providing a clean way to handle success and failure states.

Features

  • 🎯 Type-safe Result handling with Result<T> and ResultAsync<T>
  • 🔄 Chainable fluent API with map, bind, and tap operations
  • ⚡ Async support with built-in timeout and retry functionality
  • 🛡️ Comprehensive error handling with detailed error context
  • 📦 Zero dependencies