Wondering what’s next for npm?Check out our public roadmap! »

    avatarbox.sdk
    TypeScript icon, indicating that this package has built-in type declarations

    1.0.1 • Public • Published

    avatarbox.sdk

    nodejs sdk for avatarbox.io


    Build Status Coverage Status GitHub tag (latest SemVer) license

    NPM

    Description

    avatarbox.sdk is a specialized library designed to facilitate the development of internal application components such as avatarbox.publisher, avatarbox.worker, avatarbox.app and avatarbox.api. Unlike a general-purpose library, avatarbox.sdk is tailored to back-end resources situated within the AvatarBox Virtual Private Cloud (VPC) hosted on Amazon Web Services (AWS).

    Checklist

    • DynamoDB table: Gravatars
      • partition key: email
      • Global Secondary Index
        • name: index-id-email
        • partition key: id (Number)
        • sort key: email (String)
    • KMS Symmetric Key
    • MySQL table: gravatar.users a.
    • SQS Queue

    SQS Queue Setup:

    Setting Description
    Lambda Triggers avbx-worker b.
    Name avbx-worker-queue
    Type Standard

    a. This table establishes a database connection that supports the Auth0 Integration.
    b. Use avatarbox.worker to define this Lambda function.

    Installation

    # clone repo
    $ git clone https://github.com/mrtillman/avatarbox.sdk.git
    
    # install dependencies
    $ cd avatarbox.sdk && npm install

    Next, find demo.env, rename it to .env and modify:

    KMS_KEY_ID={YOUR-KMS-KEY-ID}
    REGION=us-east-1
    QUEUE_URL={YOUR-SQS-QUEUE-URL}
    MYSQL_HOST=127.0.0.1
    MYSQL_PORT=3306
    MYSQL_USER=mrtillman
    MYSQL_PASSWORD=letmein
    MYSQL_DATABASE=gravatar
    SALT={BCRYPT-SALT}

    Usage

    import { AvbxGravatarClient } from 'avatarbox.sdk';
    
    const client = new AvbxGravatarClient();

    Client Methods

    Method Description
    login(email,password) authenticates a Gravatar user and returns an instance of GravatarClient
    fetch(id|email) finds a Gravatar user by id or email and returns an instance of GravatarClient
    isActive(id|email) returns a boolean value indicating whether or not auto updates are enabled
    on(email) enable auto updates for a Gravatar user
    off(email) disable auto updates for a Gravatar user
    delete(users) deletes one or more GravatarUsers
    collect() returns a list of all icons in the Ready State
    peek() returns a list of all icons in the Fresh State
    dig() returns a list of all icons in the Cold State
    sweep() deletes all GravatarUsers in the Cold State
    touch(id|email) sends an SQS message to avatarbox.worker
    reset(icon) resets the timestamp indicating when the GravatarIcon was last updated

    License

    MIT

    Install

    npm i avatarbox.sdk

    DownloadsWeekly Downloads

    1

    Version

    1.0.1

    License

    MIT

    Unpacked Size

    109 kB

    Total Files

    62

    Last publish

    Collaborators

    • avatar