Socket
Socket
Sign inDemoInstall

@jovijovi/pedro.js

Package Overview
Dependencies
44
Maintainers
1
Versions
34
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    @jovijovi/pedro.js

Pedro.js is a microservice toolkit written in TypeScript


Version published
Weekly downloads
0
decreased by-100%
Maintainers
1
Created
Weekly downloads
 

Changelog

Source

v1.2.2

Features

  • (common/context): get context chain head; rename params of Born()

Build

  • Bump node version from 16.18 to 18.12
  • Bump typescript from 4.8.4 to 4.9.3
  • Bump packages

Readme

Source

Pedro.js

npm GitHub Actions Coverage FOSSA Status

https://github.com/jovijovi/pedro.js

Pedro.js is a microservice toolkit written in TypeScript.

Philosophy

Go home early from work, spend more time with family and friends, enjoy your life.

Features

  • HTTP/HTTPS 1.1

    • Based on express

    • Task Handler

      • API authorization based on 2FA

      • Health check

        Get health and version info

      • Metrics check

        Get simple metrics info

      • RequestId

  • JSON-RPC

  • WebSocket

    • Heartbeat

      Based on ws

  • Cache

  • Message Queue

    • AWS SQS
  • Database Helper

    • Dgraph

      • HTTP client helper
    • LevelDB

    • MongoDB

    • MySQL

    • PostgreSQL

    • Redis

    • SQLite

  • Logger

    • Asynchronous logging

    • Advanced logger

  • Certificate

  • Configuration

    • Custom config items
  • Security Suite

    • Crypto

      • Sign/Verify message by ECDSA

      • Encrypt/Decrypt message by AES

      • Get the digest by specified hash function

      • Get fingerprint by specified algorithm

      • Generate random salt

      • Encrypt/Verify password by pbkdf2

  • System

    • System signals handler
  • Utilities

    • Converter

      • Stream to Buffer

      • Stream to String

    • File

      • Read dedupe line from file to map
    • NanoID

    • Queue

      • A queue (FIFO), not async safe
    • Random

      • Random int
      • Random boolean
      • Random case
      • Random seed
    • Retry

      • Retry running the function m times with n seconds interval
    • Stack

      • A stack (LIFO), not async safe
    • Time

    • UUID

  • Simple Event

    • Sign/Verify signature

    • Marshal/Unmarshal

  • Expend Types

  • FSM

    • Simple FSM (sync)
  • Object Storage

    • S3 Client helper
  • Auditor

    • Simple assert
  • Tracing

  • Context

    • Context chain (parent/child)
  • Options

    • An easy-to-use options
  • IPFS

Development

Env

Node version manager nvm will helpful.

  • node v18.12.1
  • yarn v1.22.19
  • ts-node v10.9.1
  • typescript 4.9.3

Quick Guide

  • Install dependency

    yarn
    
  • Build

    yarn build
    
  • Run

    yarn dist-run --config ./conf/app.config.yaml
    
  • Clean

    yarn clean
    

Makefile

  • Build
make build
  • Make docker images
make docker

UnitTest with ts-jest

Install ts-jest
  • Step 1: install packages
yarn add --dev jest typescript ts-jest @types/jest
  • Step 2: Init ts-jest config
yarn ts-jest config:init
  • Step 3: Config package.json

Add below to package.json

  "scripts": {
    "test": "jest"
  },
  • Step 4: Run test
yarn test
  • Step 5: You will get response like this
yarn run v1.22.18
$ jest
 PASS  test/common/common.log.test.ts
  ● Console

    console.log
      logger closed

      at test/common/common.log.test.ts:39:11

......

Test Suites: 39 passed, 39 total
Tests:       104 passed, 104 total
Snapshots:   0 total
Time:        25.455 s, estimated 30 s
Ran all test suites.
Done in 26.21s.

Roadmap

  • Documents

  • Task Handler

    • Support CORS by config

    • Real remote IP

  • WebSocket

  • GRPC

  • TLS

    • Mutual TLS
  • Message Queue

    • RabbitMQ

    • Aliyun MNS

    • NSQ

  • Database Helper

    • Elasticsearch
  • Certificate

  • Service Discovery

  • Security Suite

    • Crypto

      • Encrypt/Decrypt message by RSA

      • Encrypt/Decrypt message by SM4

    • Simple dongle

    • Desensitization

      • Desensitize by rules
  • Utilities

    • Execute command

    • Path

    • Smart String

  • Job Scheduler

    • Workflow-based job scheduler

    • Storage adapter

  • Distributed Lock

    • etcd
  • Object Storage

    • OSS Helper

    • S3 Helper

Contributors

jovijovi

License

MIT

FOSSA Status

Keywords

FAQs

Last updated on 05 Dec 2022

Did you know?

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc