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

@digitowl/backend-cores

v4.4.7

Published

==========================================

Downloads

326

Readme

DIGITOWL Backend Core

==========================================

A Typescript core backend in Typescript with services such as:

Language

This project uses Typescript for consistent and strict-typed code.

Project Structure

Initialize App

  1. The Project requires 2 config files needed in order to run.
  • Please setup the all the project variables as listed on /core/configs/index.ts.
  • Put the variable values on a .env file inside the root folder so the code can consume it when it runs.

DO NOT include .env in the git repository under any circumstances.

  1. Run npm start to prepare generated files from gql schemas and run the server.

Bind the dependencies

import { CoresDependencies } from "@digitowl/backend-cores";

const newContainer = new Container();

const registrationList = [
    // ...Other dependencies
    CoresDependencies,
];

for (const reg of registrationList) {
    new reg().register(newContainer);
}

export const container = newContainer;

Bind the dependency types

import { CoresDependencyTypes } from "@digitowl/backend-cores";

export const types = {
    // ...Other dependency types
    ...CoresDependencyTypes
}

Map errors

src/features/errors/failures/exceptionToFailure/index.ts

export class ExceptionToFailure {
    public failureMap = new Map<string, Map<string, boolean>>([
        [CoreFailureEnums.UPSTREAM_FAILURES, new Map<string, boolean>([
            ...CoreExceptionToFailure.failureMap.get(CoreFailureEnums.UPSTREAM_FAILURES),
        ])],

        [CoreFailureEnums.DUPLICATE_OBJECT_EXIST, new Map<string, boolean>([
            ...CoreExceptionToFailure.failureMap.get(CoreFailureEnums.DUPLICATE_OBJECT_EXIST)
        ])],

        [CoreFailureEnums.AUTHENTICATION_TOKEN_FAILED, new Map<string, boolean>([
            ...CoreExceptionToFailure.failureMap.get(CoreFailureEnums.AUTHENTICATION_TOKEN_FAILED),
        ])],

        [CoreFailureEnums.OBJECT_NOT_FOUND, new Map<string, boolean>([
            ...CoreExceptionToFailure.failureMap.get(CoreFailureEnums.OBJECT_NOT_FOUND),
        ])]
    ]);

    // ...Converter function
}

$~~~~~~~~~~~$

Functions

SendGridMailServiceOperation

The SendGridMailServiceOperation class provides functionality for sending emails using SendGrid's email service. It supports sending templated emails with dynamic data fields.

Example

@inject(types.iSendGridMailServiceOperation)
private sendGridMailServiceOperation: iSendGridMailServiceOperation

const emailData = {
    receiver: "[email protected]",
    templateId: "d-1234567890abcdef1234567890abcdef",
    actionUrl: "https://example.com/verify",
    receiverName: "John Doe",
};

await this.sendGridMailServiceOperation.sendEmail(emailData)

FirebaseMessagingOperation

The FirebaseMessagingOperation class provides functionality for sending multicast push notifications using Firebase Cloud Messaging (FCM). It interacts with the Firebase messaging client to handle message delivery to multiple devices.

Example

@inject(types.iFirebaseMessagingOperation)
private firebaseMessagingOperation: iFirebaseMessagingOperation

const message = {
    tokens: ["token1", "token2"],
    notification: {
        title: "Sample Notification",
        body: "This is a sample message.",
    },
};

await this.firebaseMessagingOperation.sendMulticast(message, false)

WhatsAppMessagingMessagesOperation

The WhatsAppMessagingMessagesOperation class provides functionality for sending messages via the WhatsApp Business API. It uses an injected client to manage configurations like the access token and business phone number ID, and it sends HTTP requests to the WhatsApp Graph API to dispatch messages.

Example

@inject(types.iWhatsAppMessagingMessagesOperation)
private whatsAppMessagingMessagesOperation: iWhatsAppMessagingMessagesOperation

const messageRequest = {
    messaging_product: "whatsapp",
    to: "recipient-phone-number",
    type: "text",
    text: {
        body: "Hello, this is a message from the WhatsApp Business API!",
    },
};

await this.whatsAppMessagingMessagesOperation.sendMessage(messageRequest)

MidTransSnapPaymentGatewayOperation

The MidTransSnapPaymentGatewayOperation class provides functionality for interacting with the MidTrans Snap payment gateway. It supports creating payment transactions and verifying transaction notifications. This class integrates with a client that communicates with the MidTrans Snap API and handles upstream exceptions gracefully.

Example

@inject(types.iMidTransSnapPaymentGatewayOperation)
private midTransSnapPaymentGatewayOperation: iMidTransSnapPaymentGatewayOperation

// Example: Create a transaction
const transactionParameter = {
    transaction_details: {
        order_id: "ORDER-12345",
        gross_amount: 100000,
    },
    credit_card: {
        secure: true,
    },
};

await this.midTransSnapPaymentGatewayOperation.createTransaction(transactionParameter)

// Example: Verify a notification
const notificationRequest = {
    order_id: "ORDER-12345",
    transaction_status: "settlement",
};

await this.midTransSnapPaymentGatewayOperation.verifyNotification(notificationRequest)

BiteShipShipmentMapsAPIOperation

This class handles operations related to the BiteShip API for shipment maps. It includes methods to search for areas by keyword and to perform a detailed search of areas by their ID.

Example

@inject(types.iBiteShipShipmentMapsAPIOperation)
private biteShipShipmentMapsAPIOperation: iBiteShipShipmentMapsAPIOperation

const searchParams = {
  input: "Jakarta",
  type: "single"
};

await this.biteShipShipmentMapsAPIOperation.searchAreasByKeywordRequest(searchParam)

const detailParams = {
  areaId: "some-area-id",  // The ID of the area for which detailed information is needed
};

await this.biteShipShipmentMapsAPIOperation.doubleSearchAreasSecondRequest(detailParams)

BiteShipShipmentRatesAPIOperation

The BiteShipShipmentRatesAPIOperation class is responsible for interacting with the BiteShip API to fetch shipment rates based on specified criteria such as origin and destination area IDs, selected couriers, and item details. It provides methods to retrieve rates based on the areas and couriers for a shipment, allowing you to calculate the costs associated with different delivery services.

Example

@inject(types.iBiteShipShipmentRatesAPIOperation)
private biteShipShipmentRatesAPIOperation: iBiteShipShipmentRatesAPIOperation

const rateRequest = {
  origin_area_id: "origin-area-id", // The ID of the origin area
  destination_area_id: "destination-area-id", // The ID of the destination area
  couriers: "jne", // The couriers selected for shipment (comma-separated)
  items: [
    {
      weight: 1.5, // Item weight in kg
      length: 40,  // Item length in cm
      width: 30,   // Item width in cm
      height: 20,  // Item height in cm
      quantity: 1, // Number of items
      value: 100   // Value of the item (in the currency of the area)
    }
  ]
};

await this.biteShipShipmentRatesAPIOperation.getRatesByAreaId(rateRequest)

BiteShipShipmentTrackingsAPIOperation

The BiteShipShipmentTrackingsAPIOperation class retrieves real-time tracking info for shipments using the waybill_id and courier_code from the BiteShip API.

Example

@inject(types.iBiteShipShipmentTrackingsAPIOperation)
private biteShipShipmentTrackingsAPIOperation: iBiteShipShipmentTrackingsAPIOperation

const trackingRequest = {
  waybill_id: "your-waybill-id", // The unique identifier for the shipment
  courier_code: "courier-code",  // The code of the courier responsible for the shipment
};

await this.biteShipShipmentTrackingsAPIOperation.getTrackingsByWayBillID(trackingRequest)

GoogleCloudStorageFileOperation

This class provides file operations (upload and delete) for Google Cloud Storage. It uses an injected Google Cloud Storage client to interact with the storage bucket.

Example

@inject(types.iGoogleCloudStorageFileOperation)
private googleCloudStorageFileOperation: iGoogleCloudStorageFileOperation

const buffer = fs.readFileSync("example.jpg");
const folder = "uploads";
const storageId = "user123";
const filenameWithExtension = "example.jpg";

// Upload file
const fileUrl = await this.googleCloudStorageFileOperation.uploadFile(
    buffer,
    folder,
    storageId,
    filenameWithExtension
);

// Delete file
await this.googleCloudStorageFileOperation.deleteFile(fileUrl);

GoogleCloudStorageImageOperation

This class provides methods for interacting with Google Cloud Storage to handle image upload and deletion operations. It uses a dependency-injected client to interface with Google Cloud Storage.

Example

@inject(types.iGoogleCloudStorageImageOperation)
private googleCloudStorageImageOperation: iGoogleCloudStorageImageOperation

const imageBuffer = fs.readFileSync("example.jpg")
const category = "profile-pictures";

// Uplaod Image
const imageUrl = await this.googleCloudStorageImageOperation.uploadImage(imageBuffer, category)

// Delete image
await this.googleCloudStorageImageOperation.deleteImage(imageUrl)