1.3.3 • Published 1 year ago

@windingtree/sdk-db v1.3.3

Weekly downloads
-
License
MIT
Repository
github
Last release
1 year ago

@windingtree/sdk-db

This package provides convenient abstraction and interaction with storage for the Winding Tree SDK. It includes functionalities for managing users and deals data in a secure and effective way. The package uses bcrypt hashing for password management and offers utilities for pagination.

Installation

pnpm i @windingtree/sdk-db

Key Concepts

  • UsersDb: Provides methods for adding, getting, setting, and deleting users in the database. It also includes a method for comparing passwords.
  • DealsDb: Provides methods for adding, getting, and retrieving all deals in the database.
  • Both UsersDb and DealsDb require a storage instance and prefix for their constructor, which are used to manage their data in a common storage solution.
  • Passwords in UsersDb are hashed using bcrypt-ts. This ensures that even if the user data were compromised, the passwords would still be safe.
  • Pagination is supported in DealsDb for fetching multiple deals.

Usage

import { UsersDb, DealsDb } from '@windingtree/sdk-db';
import { memoryStorage } from '@windingtree/sdk-storage'; // localStorage, etc

const storageInitializer =
  memoryStorage.createInitializer(/* storage configuration */);
const prefix = 'winding_tree';

// Instantiate UsersDb
const usersDb = new UsersDb({ storage: await storageInitializer(), prefix });

// Use methods to interact with the users database
usersDb.add(/* parameters */);
usersDb.get(/* parameters */);
// and other methods...

// Instantiate DealsDb
const dealsDb = new DealsDb({ storage: await storageInitializer(), prefix });

// Use methods to interact with the deals database
dealsDb.set(/* parameters */);
dealsDb.get(/* parameters */);
dealsDb.getAll(/* parameters */);

Documentation

For full documentation and examples, visit windingtree.github.io/sdk

Testing

pnpm test

Contributing

Contribution guidelines

1.3.3

1 year ago

1.3.2

1 year ago

1.3.1

1 year ago

1.3.0

1 year ago

1.2.8

1 year ago

1.2.7

1 year ago

1.2.6-beta.0

1 year ago

1.2.6

1 year ago

1.2.5

1 year ago

1.2.4

2 years ago

1.2.3

2 years ago

1.2.2

2 years ago

1.2.1

2 years ago

1.2.0

2 years ago

1.2.0-beta.1

2 years ago

1.2.0-beta.0

2 years ago

1.1.0

2 years ago

1.1.0-beta.3

2 years ago

1.1.0-beta.2

2 years ago

1.1.0-beta.1

2 years ago

1.1.0-beta.0

2 years ago