Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

workdesk-common-module

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

workdesk-common-module

npm install --save ../common-module

  • 1.0.1
  • latest
  • npm
  • Socket score

Version published
Weekly downloads
1
Maintainers
1
Weekly downloads
 
Created
Source

npm install --save ../common-module

Examples util

import { isEmptyObject } from "common-module/util"; console.log(isEmptyObject({}));

logger

import { Logger } from "common-module/util/logger"; Logger.info("This is my info", null, true);

bcrypt

import { Bcrypt } from "common-module/util/bcrypt"; console.log(Bcrypt.createHash("sanjay"));

jwt

import { Jwt } from "common-module/util/jwt"; console.log(Jwt.createToken({ id: 11 }));

crypto

import { Crypto } from "common-module/util/crypto"; const d1 = Crypto.encrypt("sanjay"); console.log(d1); const d2 = Crypto.decrypt(d1); console.log(d2);

email

import { sendMail, MailArg } from "common-module/util/mail"; let mailData = new MailArg( "sanjay.mscit7@gmail.com", "Test mail", "test by sanjay" ); sendMail(mailData, function (error, info) { if (error) { console.error(error); } if (info) console.log("Mail email sent successfully, messageId => ", info.messageId); });

push notification

import { DeviceType, NotificationBodyArg, sendPushNotification, } from "common-module/util/notification"; let notificationData = new NotificationBodyArg( "Test notification", "test by sanjay", 1, "profile", { name: "sanjay" }, 2 ); sendPushNotification( "qwertyuiopasdfghjklzxcvbnm", DeviceType.IOS, notificationData, function (error, info) { if (error) { console.error(error); } if (info) { console.log("Notification sent successfully, messageId => "); console.log(info); } } );

sms

import { sendSms } from "common-module/util/sms"; sendSms("+917778899848", "this is test", function (error, info) { if (error) { console.log("error => ", error); } if (info) { console.log("info => ", info); } });

Examples middleware

import apiAuthMiddleware from "common-module/middleware/api-auth"; import decryptRequestMiddleware from "common-module/middleware/decrypt-request"; import encryptResponseMiddleware from "common-module/middleware/encrypt-response";

app.use(apiAuthMiddleware); app.use(encryptResponseMiddleware); app.use(decryptRequestMiddleware);

Examples Handler

error handling

import {encryptErrorHandler,errorHandler,InternalServerError} from "common-module/handler/error-handler";

Example Response

http response

import {HttpResponse} from "common-module/response/http-response";

encrypt http response

import { EncryptHttpResponse } from "common-module/response/encrypt-http-response";

FAQs

Package last updated on 17 Apr 2023

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc