Skip to content

Package: @venizia/ignis-helpers

Helpers Package Directory: Detailed Breakdown

The @venizia/ignis-helpers package consolidates a wide array of reusable helper classes and utility functions designed to support various cross-cutting concerns within the Ignis framework. This package promotes modularity by extracting common functionalities into a standalone, easily consumable library.

Project Structure Overview

Here's the top-level breakdown of the src directory within @packages/helpers/:

FolderPurpose
__tests__Contains unit and integration tests for the helper utilities.
baseProvides foundational helper classes, such as BaseHelper.
commonStores shared constants and types used across the helpers.
helpersA collection of specialized helper modules for various functionalities (e.g., cron, crypto, network, queue).
utilitiesContains pure, standalone utility functions for common tasks (e.g., parsing, date manipulation).

Detailed Sections

__tests__

This directory is dedicated to the test suite for the @venizia/ignis-helpers package.

File/FolderPurpose/Key Details
index.tsEntry point for running tests within the helpers package.
jwt/Contains test cases specifically for JWT-related helper functions, if any.
jwt/test-cases/jwt.tsExample: defines TestCase001 to check JWT creation in a helper context.

base

This foundational layer provides base classes that other helpers extend.

base/helpers

File/FolderPurpose/Key Details
base.tsDefines BaseHelper, a generic base class providing common utilities like a logger instance and scope management for all other helpers.

common

This directory holds various shared definitions and constants used throughout the helpers package.

File/FolderPurpose/Key Details
constants/Contains application-wide constants such as HTTP methods and status codes, MimeTypes, RuntimeModules (Bun, Node.js), and DataTypes.
types.tsContains general TypeScript utility types like ValueOrPromise, AnyObject, IClass, TMixinTarget, and IProvider.

helpers

This directory groups specialized helper modules by their functionality.

helpers/cron/

File/FolderPurpose/Key Details
cron.helper.tsCronHelper for scheduling and managing cron jobs using the cron library.

helpers/crypto/

Cryptographic utilities.

File/FolderPurpose/Key Details
algorithms/AES and RSA encryption/decryption algorithms.
common/Common types and constants for crypto operations.

helpers/env/

File/FolderPurpose/Key Details
app-env.tsApplicationEnvironment for structured access to environment variables.

helpers/error/

File/FolderPurpose/Key Details
app-error.tsApplicationError class for standardized error handling.

helpers/inversion/

Application-enhanced Dependency Injection (DI) module that extends @venizia/ignis-inversion.

Note: The core DI functionality (Container, Binding, MetadataRegistry base classes) has been extracted to the standalone @venizia/ignis-inversion package. This module extends and re-exports that functionality with application-specific enhancements.

File/FolderPurpose/Key Details
container.tsExtended Container class with ApplicationLogger integration.
registry.tsExtended MetadataRegistry with framework-specific metadata (controllers, models, repositories, datasources).
common/keys.tsFramework-specific MetadataKeys (CONTROLLER, MODEL, REPOSITORY, etc.) merged with base keys.
common/types.tsFramework-specific interfaces (IControllerMetadata, IModelMetadata, IRepositoryMetadata, etc.).
index.tsRe-exports core classes from @venizia/ignis-inversion plus application extensions.

Re-exported from @venizia/ignis-inversion:

  • Binding, BindingKeys, BindingScopes, BindingValueTypes

Application-specific additions:

  • Container with ApplicationLogger integration
  • MetadataRegistry with setControllerMetadata, setModelMetadata, setRepositoryMetadata, etc.
  • Framework metadata interfaces for controllers, models, repositories, and data sources

For standalone DI usage without framework features, import directly from @venizia/ignis-inversion.

helpers/logger/

Logging solution built on Winston.

File/FolderPurpose/Key Details
application-logger.tsApplicationLogger for structured logging with scopes.
default-logger.tsDefault Winston logger configuration with console and file transports.
factory.tsLoggerFactory for obtaining logger instances.
transports/dgram.transport.tsUDP transport for log aggregation.
types.tsLog level definitions.

helpers/network/

Utilities for network communication.

File/FolderPurpose/Key Details
http-request/HTTP client implementations (AxiosNetworkRequest, NodeFetchNetworkRequest).
tcp-socket/TCP and TLS socket client/server helpers.
udp-socket/UDP client helper.

helpers/queue/

Message queuing solutions.

File/FolderPurpose/Key Details
bullmq/BullMQHelper for Redis-backed message queues.
mqtt/MQTTClientHelper for MQTT broker interaction.
internal/QueueHelper for simple in-memory queues.
common/Common types for queue operations.

helpers/redis/

Redis client helpers.

File/FolderPurpose/Key Details
cluster.helper.tsRedisClusterHelper for Redis cluster connections.
default.helper.tsDefaultRedisHelper providing a unified API for Redis operations.
single.helper.tsRedisHelper for single Redis instance connections.
types.tsInterfaces and types for Redis helpers.

helpers/socket-io/

Socket.IO client and server helpers.

File/FolderPurpose/Key Details
client/SocketIOClientHelper for client-side Socket.IO connections.
server/SocketIOServerHelper for server-side Socket.IO management.
common/Common types and constants for Socket.IO.

helpers/storage/

Storage utilities.

File/FolderPurpose/Key Details
in-memory/MemoryStorageHelper for in-memory key-value storage.
minio/MinioHelper for S3-compatible object storage.

helpers/testing/

Framework for writing and executing tests using node:test.

File/FolderPurpose/Key Details
base-test-plan.tsAbstract base for test plans.
common/Common types and constants for testing utilities.
describe.tsTestDescribe integrates with node:test lifecycle hooks.
test-case.tsDefines individual test cases.
test-handler.tsBase class for test case handlers.
test-plan.tsTestPlan for organizing test suites.

helpers/worker-thread/

Utilities for Node.js worker threads.

File/FolderPurpose/Key Details
base.tsBase classes for workers and worker threads.
types.tsInterfaces and types for worker threads.
worker-bus.tsHelpers for inter-thread communication using MessagePort.
worker-pool.tsWorkerPoolHelper for managing a pool of worker threads.

utilities

This directory contains pure, standalone utility functions that perform common, stateless operations.

File/FolderPurpose/Key Details
crypto.utility.tsProvides a hash() function for cryptographic hashing (SHA256, MD5).
date.utility.tsDate and time manipulation functions (dayjs integration, sleep, isWeekday, getDateTz, hrTime).
module.utility.tsvalidateModule() to check for module existence at runtime.
parse.utility.tsFunctions for type checking (isInt, isFloat), type conversion (int, float, toBoolean), string/object transformation (toCamel, keysToCamel), array transformations (parseArrayToRecordWithKey, parseArrayToMapWithKey), and getUID() for unique IDs.
performance.utility.tsUtilities for measuring code execution time (executeWithPerformanceMeasure, getPerformanceCheckpoint, getExecutedPerformance).
promise.utility.tsHelper functions for Promises (executePromiseWithLimit, isPromiseLike, transformValueOrPromise, getDeepProperty).
request.utility.tsUtilities for handling HTTP request data, such as parseMultipartBody for multipart form data.
schema.utility.tsHelper functions and predefined schemas for zod and @hono/zod-openapi (jsonContent, jsonResponse, requiredString, AnyObjectSchema, IdParamsSchema, UUIDParamsSchema).

This detailed breakdown illustrates the modular and layered design of the Ignis framework, emphasizing its extensibility and adherence to robust architectural patterns.