I am not the original maintainer of Arjuna. This package is merely a hack to satisfy NPM Audit results, since the original package is not updated for a long time. Do not expect any bug fixes or new features out of this package.
Death simple Node.js boilerplate & utility wrapper
- Provide easy to use interfaces for nodejs application
- Standarize coding style among teams and applications
- Decrease repeatable things, write once run everywhere (DRY)
- Increase software quality by using well tested utility library
Using npm
npm install arjunaIn NodeJS
/** file: app.js **/
const { Text } = require('arjuna');
const randomText2 = Text.random(30); //ifjaok89ewsmapxbgiodkap75nnmkvcComplete documentations are available here
Legends:
- ✔️ Available with test
⚠️ Available without test (Use with your own risk 😆)- ❌ Unavailable yet
- ❓ Ideation/request
| Status | Facade | Method | Description | |
|---|---|---|---|---|
| Datastore Package | ||||
| ✔️ | Redis | get | supported: redis | |
| ✔️ | set | |||
| ✔️ | del | |||
| ✔️ | expire | |||
| ✔️ | increment | |||
| ✔️ | decrement | |||
| ✔️ | resetCounter | |||
| ✔️ | flushCurrentDb | |||
| ✔️ | Config | set | Set object data by a unique key into file | |
| ✔️ | get | get object data by a unique key from a file | ||
| ✔️ | all | get all object data from file | ||
| Log Package | ||||
| ✔️ | Log | report | supported: slack | |
| ✔️ | consoleReport | |||
| ✔️ | localReport | |||
| ✔️ | onlineReport | |||
| ❓ | setConfig | |||
| Manipulator Package | ||||
| ✔️ | Date | getFullDate | get date (Format: YYYY-MM-DD HH:mm:ss, Default: Current Date) | |
| ✔️ | getOnlyDate | get date (Format: YYYY-MM-DD, Default: Current Date) | ||
| ✔️ | moment | return moment instance | ||
| ✔️ | wait | |||
| ✔️ | Html | encode | encode html tag into html entity | |
| ✔️ | decode | decode html entity into html tag | ||
| ✔️ | toText | convert html tag into plain text | ||
| ✔️ | Number | random | ||
| ✔️ | currency | |||
| ✔️ | Text | random | ||
| ✔️ | isValidYoutubeUrl | |||
| ✔️ | getYoutubeVideoId | |||
| ✔️ | slugify | |||
| ✔️ | uuid | |||
| ✔️ | isValidUuid | |||
| ✔️ | getUuidVersion | |||
| ✔️ | mask | |||
| ✔️ | Security | createRandomKey | ||
| ✔️ | createRandomSecret | |||
| ✔️ | encrypt | |||
| ✔️ | decrypt | |||
| ✔️ | Object | renameKey | ||
| Network Package | ||||
| ✔️ | Event | publish | supported: rabbitmq | |
| ✔️ | subscribe | |||
| ✔️ | enqueue | |||
| ✔️ | dequeue | |||
| ✔️ | Request | get | perform http get request | |
| ✔️ | post | perform http post request | ||
| ✔️ | put | perform http put request | ||
| ✔️ | patch | perform http patch request | ||
| ✔️ | delete | perform http delete request | ||
| ✔️ | multiple | perform multiple http request | ||
| ✔️ | Response | setCode | ||
| ✔️ | setStatus | |||
| ✔️ | setMessage | |||
| ✔️ | setData | |||
| ✔️ | setError | |||
| ✔️ | toObject | |||
| ✔️ | toJson | |||
| ✔️ | success | |||
| ✔️ | error | |||
| ✔️ | invalid | |||
| ✔️ | forbidden | |||
| ✔️ | notFound | |||
| ✔️ | unauthenticate | |||
| ✔️ | badGateway | |||
| ✔️ | requestTimeout | |||
| Pattern Package | ||||
| ✔️ | Command | execute | ||
| ✔️ | Query | get | ||
| ✔️ | Factory | create | ||
| ✔️ | Operation | run | ||
| ✔️ | Provider | register | ||
| ✔️ | Repository | all | ||
| ✔️ | get | |||
| ✔️ | create | |||
| ✔️ | first | |||
| ✔️ | update | |||
| ✔️ | delete | |||
| ✔️ | insert | |||
| ✔️ | findByIdentifier | |||
| ✔️ | generateQueryFromParams | |||
| ✔️ | getTransactionFromParams | |||
| ✔️ | registerStaticFunctions | |||
| ✔️ | registerStaticFunction | |||
| ✔️ | getMethodNames | |||
| ❓ | last | |||
| Serialization Package | ||||
| ✔️ | Protobuf | encode | ||
| ✔️ | decode | |||
| ✔️ | verify | |||
| ✔️ | createSchema | |||
| ✔️ | Base64 | encode | ||
| ✔️ | decode | |||
| Structure Package | ||||
| ✔️ | Entity | setParams | set entity property from an object | |
| ✔️ | SqlModel | instance | ||
| ✔️ | registerDefaultStaticFunctions | |||
| ✔️ | registerStaticFunctions | |||
| ✔️ | createSqlModel | |||
| ✔️ | getOption | |||
| ✔️ | ViewModel | setParams | ||
| ✔️ | toObject | |||
| ✔️ | toJson | |||
| Unavailable packages - coming soon, maybe? | ||||
| ❌ | Controller | constructor | supported: express req/res | |
| ❌ | Middleware | validation | supported: express req/res | |
| ❌ | logger | |||
| ❌ | monitoring | supported: prometheus | ||
| ❌ | Builder | build | ||
| ❌ | toObject | |||
| ❌ | toJson |
Running test without coverage + watchers
npm run test-minimalRunning test with coverage
npm run testRunning unit test
npm run test-unitRunning integration test (make sure you setup .env.test, check .env.example for more info)
npm run test-integrationTest Coverages
1. Utility: moment, numeral, uuid, nodemon, lodash, body-parser, dotenv, protobufjs, slugify, html-entities, html-to-text
2. ORM: sequelize, mysql2, mongoose
3. Networking: axios
4. Messaging: amqplib
5. Security: bcryptjs, jsonwebtoken
6. Logging: morgan, rotating-file-stream
7. Testing: mocha, nyc, chai, chai-like, chai-things, supertestFeel free to contribute
This is open source project feel free to contributes and supporting us through: Idaman
MIT