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 🙏

© 2024 – Pkg Stats / Ryan Hefner

@pillarwallet/common-services

v4.7.148

Published

A module that provides access to common services.

Downloads

7

Readme

common-services

A module that provides access to common services.

Updating this README.md

Run npm run generateReadme to parse the code for JSDoc comment blocks and recreate this README.md file.

Install

Run npm i @pillarwallet/common-services

Examples

Instantiate a badges service: @param - (loggerPath - optional) Specify the file path to which log records are written @param - (logToFile - optional - default false). Set true to enable logging to a file and file rotation @param - (dbModels - optional) Pass the Badge and BadgeAward mongoose objects (need for the backend integration)

const { Badge, BadgeAward } = require('@pillarwallet/common-models').platform;
const { buildBadgeService } = require('@pillarwallet/common-services');

const BadgeService = buildBadgeService({
  loggerPath: '',
  logToFile: false,
  dbModels: { Badge, BadgeAward },
});

Instantiate a notification service: @param - (sqsConfiguration - required) Pass the SQS configuration object @param - (dbModels - optional) Pass the Badge mongoose object (need for the backend integration)

const config = require('../../src/config');
const { Badge } = require('@pillarwallet/common-models').platform;
const { buildNotificationService } = require('@pillarwallet/common-services');

const notificationService = buildNotificationService({
  sqsConfiguration: { region: 'us-east-1', queueUrl: 'https://sqs.us-east-1.amazonaws.com/testing/test.fifo', fifoQueue: true },
  dbModels: { Badge },
});

API

Members

Constructor ⇒

This is the constructor of the BadgeService instance. It allows to set the Configuration keys:

Kind: global variable
Returns: Object

| Param | Type | Description | | --- | --- | --- | | [loggerPath] | String | Specify the file path to which log records are written | | [logToFile] | Boolean | Enables logging to a file and file rotation | | [dbModels] | Object | Pass the Badge and BadgeAward mongoose objects |

onUserRegistered ⇒

Method that awards user with a badge for the registration

Kind: global variable
Returns: Promise

| Param | Type | Description | | --- | --- | --- | | [walletId] | String | Wallet ID | | [userId] | String | User ID |

onWalletImported ⇒

Method that awards user with a badge for the imported wallet

Kind: global variable
Returns: Promise

| Param | Type | Description | | --- | --- | --- | | [walletId] | String | Wallet ID | | [userId] | String | User ID |

onConnectionEstablished ⇒

Method that awards user with a badge for the first connection

Kind: global variable
Returns: Promise

| Param | Type | Description | | --- | --- | --- | | [walletId] | String | Wallet ID | | [userId] | String | User ID |

onTransactionMade ⇒

Method that awards user with a badge for the first transaction made

Kind: global variable
Returns: Promise

| Param | Type | Description | | --- | --- | --- | | [walletId] | String | Wallet ID | | [userId] | String | User ID |

onTransactionReceived ⇒

Method that awards user with a badge for the first transaction received

Kind: global variable
Returns: Promise

| Param | Type | Description | | --- | --- | --- | | [walletId] | String | Wallet ID | | [userId] | String | User ID |

selfAward ⇒

Method to award yourself with a badge

Kind: global variable
Returns: Promise

| Param | Type | Description | | --- | --- | --- | | [badgeType] | String | Badge name | | [walletId] | String | Wallet ID | | [userId] | String | User ID |

Constructor ⇒

This is the constructor of the NotificationService instance.

Kind: global variable
Returns: Object

| Param | Type | Description | | --- | --- | --- | | [sqsConfiguration] | Object | SQS configuration object | | [dbModels] | Object | Pass the Badge mongoose object |

retryMessage

Method to log error and call method sendMessage if corresponds

Kind: global variable

sendMessage

Method to send a message to SQS

Kind: global variable

| Param | Type | Description | | --- | --- | --- | | [message] | Object | The message object |

createBadgesNotification

Method that creates a Badge notification and put the message in SQS

Kind: global variable

| Param | Type | Description | | --- | --- | --- | | [wallet] | Object | The wallet object from the recipient user |

onUserRegisteredBadgeNotification

Method that creates badge notification with type: wallet-created

Kind: global variable

| Param | Type | Description | | --- | --- | --- | | [wallet] | Object | The wallet object from the recipient user |

onWalletImportedBadgeNotification

Method that creates badge notification with type: wallet-imported

Kind: global variable

| Param | Type | Description | | --- | --- | --- | | [wallet] | Object | The wallet object from the recipient user |

onConnectionEstablishedBadgeNotification

Method that creates badge notification with type: first-connection-established

Kind: global variable

| Param | Type | Description | | --- | --- | --- | | [wallet] | Object | The wallet object from the recipient user |

onTransactionMadeBadgeNotification

Method that creates badge notification with type: first-transaction-made

Kind: global variable

| Param | Type | Description | | --- | --- | --- | | [wallet] | Object | The wallet object from the recipient user |

onTransactionReceivedBadgeNotification

Method that creates badge notification with type: first-transaction-received

Kind: global variable

| Param | Type | Description | | --- | --- | --- | | [wallet] | Object | The wallet object from the recipient user |