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

stellasvenue-baseservice

v1.0.8

Published

Base service for AWS SDK integrations

Downloads

26

Readme

Here’s a sample README.md file for your BaseService class.

BaseService Class

The BaseService class provides a utility layer for working with AWS services, including DynamoDB, S3, EventBridge, and Lambda. It is designed to handle common operations such as CRUD actions, event publishing, file uploads, and utility functions.

Features • DynamoDB Operations: • Create, Read, Update, and Delete items. • Query by primary key, sort key prefix, and secondary indexes (GSIs). • S3 Operations: • Upload JSON objects or readable streams to S3. • Retrieve files from S3. • EventBridge Integration: • Publish custom events to EventBridge. • Lambda Invocation: • Invoke AWS Lambda functions asynchronously. • Utility Functions: • Data sanitization. • Date and time utilities. • Reserved keyword validation.

Installation

Prerequisites • Node.js (v14 or higher) • AWS SDK for JavaScript v3 (@aws-sdk/client-s3, @aws-sdk/client-dynamodb, etc.)

Install Dependencies

Run the following command in your project directory:

npm install @aws-sdk/client-s3 @aws-sdk/client-dynamodb @aws-sdk/lib-dynamodb @aws-sdk/client-eventbridge @aws-sdk/client-lambda @aws-sdk/lib-storage

Usage

Import the Class

const BaseService = require('./BaseService'); const service = new BaseService();

Example Usage

Store an Item in DynamoDB

await service.storeDB('User#123', 'Profile', { name: 'John Doe', age: 30 });

Query Items by Sort Key Prefix

const items = await service.getDBBySKPrefix('User#123', 'Order#'); console.log(items);

Publish an Event to EventBridge

await service.putEvents('UserRegistered', { userId: '123', email: '[email protected]' });

Upload a File to S3

await service.logObject('user-logs.json', { action: 'login', timestamp: new Date() });

Configuration

The BaseService class relies on the following environment variables:

Variable Name Description SYSTEMTABLE DynamoDB table name. MESSAGE_BUCKET S3 bucket name for storing files.

Methods

DynamoDB Methods • storeDB(PK, SK, data): Stores an item in DynamoDB. • getDB(PK, SK): Retrieves an item by its primary key. • getDBBySKPrefix(PK, SKPrefix): Queries items by Sort Key prefix. • getDbGSI2PK(GSI2PKValue): Queries items using the GSI2PK secondary index. • updateDB(PK, SK, data, optionalKeys): Updates an item, optionally updating GSIs. • deleteDBItem(PK, SK): Deletes an item by primary key.

S3 Methods • logObject(fileName, data): Uploads a JSON object to S3. • uploadReadableStream(fileName, readableStream): Uploads a file from a readable stream.

EventBridge Methods • putEvents(eventName, data): Publishes an event to EventBridge.

Lambda Methods • invokeStep(functionName, payload): Invokes a Lambda function asynchronously.

Utility Methods • sanitizeData(data): Converts dates to ISO strings and removes undefined values. • isWeekend(dateStr): Determines if a given date is a weekend. • subtractOneHour(time): Subtracts one hour from a given time string (HH:mm).

Error Handling

All methods include basic error logging and rethrow the error for higher-level handling.

License

This project is licensed under the MIT License. See the LICENSE file for details.

Author

Developed by Jermaine Watkins.

For any inquiries or suggestions, feel free to reach out!

You can adjust the content as needed for your specific project context.