@myfunc/nest-utils
v1.0.1
Published
Nest utils by Myfunc
Readme
nest-utils
All modules are covered with tests.
Run Tests
All modules are covered with tests.
npm i
npm run testPublishing to NPM
This package is automatically published to NPM when a new tag is pushed to GitHub.
Setup
Create NPM Token:
- Go to npmjs.com and login
- Go to your profile → Access Tokens
- Create a new token with "Automation" type
- Copy the token
Setup GitHub Environment "Release":
- Go to your GitHub repository
- Go to Settings → Environments
- Create a new environment named "Release"
- Add the
NPM_TOKENsecret to this environment - Paste your NPM token as the value
Publish a new version:
# Build and test npm run build npm test # Create and push a new tag git tag v1.0.1 git push origin v1.0.1
The GitHub Actions workflow will automatically:
- Run tests
- Build the package
- Publish to NPM
Note: The workflow uses the "Release" environment for enhanced security and requires the NPM_TOKEN to be configured there.
Manual Publishing
If you need to publish manually:
npm run build
npm test
npm publishAvailable modules
SystemModule- includes 3 core sharable modules:StorageModule- Stable module for interacting with Redis (memory storage is supported inLocalCacheService). Fully compatible with @type-cachebleCacheModule- Stable module for setup https://github.com/joshuaslate/type-cacheable decorator using “Storage module”SyncModule- Mutex docs (RU) Stable module with Mutex and WaitMutex decorators that use “Storage module” for synchronization. Mutex is used for code synchronization, and guarantees that code will be executed only once at the same moment. Includes decorators:@Mutex,@WaitMutex,@IdempotencyLock,@IdempotencyRelease.
EosModule- For fetching data from EOS blockchain with a focus on security.MyLogger- MyLogger docs (RU) Enforces logging approach in projects. Supports error parsing, request meta injections (userId/requestId/sessionId etc). Can be used with no Nest injection.FeatureFlagModule- FeatureFlagModule docs (EN) Feature flag module base onUnleashlibrary. Fully compatible with GitLab.
Utils
WaitAsync- Stable util for async waitingFairness- Provides utils for hashing validationg and generating random numbers and hashes according to the Provably Fair requirements. Includes Sync and Async versions of all methods.JsonSerializer- JsonSerializer docs (RU) Custom serializer. Also can be used inStorageModuleandCacheModule. SupportsBigInt,Buffer,DecimalandDatetypes.
