
Security News
Attackers Are Hunting High-Impact Node.js Maintainers in a Coordinated Social Engineering Campaign
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.
topsyde-utils
Advanced tools
A comprehensive bundle of TypeScript utility classes and functions designed to simplify common programming tasks.
npm install topsyde-utils
# or
yarn add topsyde-utils
# or
bun add topsyde-utils
Throwable for expected errors that shouldn't trigger retriesGuards classLib classimport { Throwable, Lib } from 'topsyde-utils';
// Basic usage
throw new Throwable("This operation failed but it's expected");
// With context
throw new Throwable("User not found", {
context: { userId: 123, operation: "fetch" }
});
// Using with RetryHandler
await Lib.RetryHandler(async () => {
// If this throws a Throwable, RetryHandler won't retry
const result = await someOperation();
if (!result) {
throw new Throwable("Expected failure condition");
}
return result;
});
import { Guards } from 'topsyde-utils';
if (Guards.IsString(value)) {
// value is guaranteed to be a string
console.log(value.toUpperCase());
}
if (Guards.IsNumber(value, true)) {
// value is guaranteed to be a non-null number
console.log(value.toFixed(2));
}
import { Lib } from 'topsyde-utils';
// Date formatting
const formattedDate = Lib.FormatDate(new Date(), "DD/MM/YYYY");
// Retry mechanism
const result = await Lib.RetryHandler(
async () => await fetchData(),
3 // number of retries
);
// UUID generation
const id = Lib.UUID();
import { Singleton } from 'topsyde-utils';
class Database extends Singleton {
connect() {
// Connect to database
}
}
// Get the singleton instance
const db = Database.getInstance();
db.connect();
The package supports two ways to import modules:
// Import from the root package
import { Router } from 'topsyde-utils';
// Use directly without namespace
Router.SetRoutes(routes);
// Import directly from a subdirectory
import { Router, Routes } from 'topsyde-utils/router';
import { Controller } from 'topsyde-utils/server';
// Use the imported classes directly
Router.SetRoutes(routes);
const controller = new Controller();
This approach provides more flexibility and cleaner imports, especially when you only need specific components from a subdirectory.
Custom error class for errors that are expected to be thrown and should not trigger retry mechanisms or be reported to error monitoring services.
new Throwable(message, options);
message: Error message or existing Error object to wrapoptions: Configuration options
logError: Whether to log this error to console (default: true)context: Additional context data to attach to the errorType guard utilities for safe type checking.
IsString(value, excludeNull?): Check if value is a stringIsNumber(value, excludeNull?): Check if value is a numberIsBoolean(value, excludeNull?): Check if value is a booleanIsArray(value, excludeNull?): Check if value is an arrayIsObject(value, excludeNull?): Check if value is an objectIsFunction(value, excludeNull?): Check if value is a functionIsNil(value): Check if value is null or undefinedIsType<T>(obj, keys?): Check if object matches a typeExtensive utility library with various helper functions.
This package includes a script to automatically generate index files based on the contents of the src directory and its subdirectories. This makes it easier to maintain the package as you add or modify files.
The script:
To generate the index files:
bun run generate-indexes
bun run clean - Remove the dist directorybun run format - Format all TypeScript files with Prettier (using cache)bun run format:generated - Format only generated index filesbun run lint - Lint TypeScript files with ESLint (using cache)bun run test - Run tests with Jestbun run generate-indexes - Generate index files onlybun run build:ts - Compile TypeScript filesbun run build:types - Generate TypeScript declaration filesbun run build:prepare - Clean, generate indexes, and format generated filesbun run build - Complete build process (prepare, compile, generate types)bun run version:bump - Bump version without creating git tagsTo publish a new version of the package, use the optimized release script:
# Using the script directly
./scripts/release.sh [patch|minor|major] [tag]
# Or using npm/bun scripts
bun run release [patch|minor|major] [tag]
Examples:
bun run release # Increment patch version (default)
bun run release patch # Same as above
bun run release minor # Increment minor version (e.g., 1.0.0 -> 1.1.0)
bun run release major # Increment major version (e.g., 1.0.0 -> 2.0.0)
bun run release minor beta # Increment minor version with 'beta' tag
The release script will:
The script includes robust error handling and will exit on any failure, ensuring that the package is only published when all steps complete successfully.
You can test the release process without actually publishing to npm using these commands:
# Test the release process without building or publishing
bun run release:dry-run [patch|minor|major] [tag]
# Test the full release process including building but without publishing to npm
bun run release:test [patch|minor|major] [tag]
These test options are useful for:
MIT
FAQs
A bundle of TypeScript utility classes and functions
We found that topsyde-utils demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.

Security News
Axios compromise traced to social engineering, showing how attacks on maintainers can bypass controls and expose the broader software supply chain.

Security News
Node.js has paused its bug bounty program after funding ended, removing payouts for vulnerability reports but keeping its security process unchanged.