# @appveen/data.stack-utils

> General utility functions for appveen data.stack/datanimbus.io

Latest version **7.1.0** (published 2026-10-22) · MIT license · 0 weekly downloads

## Install

```sh
npm install @appveen/data.stack-utils
pnpm add @appveen/data.stack-utils
yarn add @appveen/data.stack-utils
bun add @appveen/data.stack-utils
```

## Health

**Score 55/100 (C)** — status: active.

Positive: no vulnerabilities; recently updated; high maintenance score.

Warnings: low downloads; no types; no esm support.

## Facts

| | |
|---|---|
| Version | 7.1.0 |
| Published | 2026-10-22 |
| First published | 2021-01-28 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 10 |
| Unpacked size | 101.2 KB |
| Known vulnerabilities | 0 (+1 in 1 direct dependencies) |
| Install scripts | no |
| GitHub stars | 0 |
| Maintainers | appveen |

## Links

- npm: https://www.npmjs.com/package/@appveen/data.stack-utils
- Repository: https://github.com/appveen/data.stack-utils
- Homepage: https://github.com/appveen/data.stack-utils#readme
- Issues: https://github.com/appveen/data.stack-utils/issues
- npm.io page: https://npm.io/package/@appveen/data.stack-utils

## Dependencies (10)

- [got](https://npm.io/package/got.md) ^11.8.6
- [axios](https://npm.io/package/axios.md) ^1.9.0
- [bullmq](https://npm.io/package/bullmq.md) ^5.66.4
- [lodash](https://npm.io/package/lodash.md) ^4.17.21
- [log4js](https://npm.io/package/log4js.md) ^6.7.1
- [aws-sdk](https://npm.io/package/aws-sdk.md) ^2.1364.0
- [ioredis](https://npm.io/package/ioredis.md) ^5.9.0
- [@azure/storage-blob](https://npm.io/package/@azure/storage-blob.md) ^12.14.0
- [@datanimbus/mongoose](https://npm.io/package/@datanimbus/mongoose.md) ^6.13.10
- [@google-cloud/storage](https://npm.io/package/@google-cloud/storage.md) ^6.9.1

## Recent versions

- 7.1.0 (latest) — 2026-10-22
- 7.0.1 — 2026-03-16
- 7.0.0 — 2026-02-23
- 6.13.10 — 2025-10-13
- 2.1.1 — 2025-03-05
- 2.1.0 — 2024-10-28
- 2.0.1 — 2023-10-16
- 2.0.0 — 2023-10-16
- 1.0.22 — 2023-07-11
- 1.0.21 — 2022-11-24
- 1.0.20 — 2022-11-24
- 1.0.19 — 2022-04-03
- 1.0.18 — 2022-01-17
- 1.0.17 — 2021-06-08
- 1.0.16 — 2021-04-06
- … 16 more at https://npm.io/package/@appveen/data.stack-utils/versions

## README

# data.stack-utils
Common utils for appveen data.stack

## Audit Trail
This lib contain hooks to create audit logs in a specific DB. This DB will store all the logs of data change.

To store the logs, the node service should invoke the following hooks provided by the lib.

1. getAuditPreSaveHook: This will return hook for pre save. collectionName(where the document is stored) has to be passed as an argument.

2. getAuditPostSaveHook: This will return hook for post save. collectionName(where the audit log should be stored) has to be passed as an argument.

3. getAuditPreRemoveHook: This will return hook for pre remove. No argument needed.

4. getAuditPostRemoveHook: This will return hook for post remove. collectionName(where the audit log should be stored) has to be passed as an argument.

To record txnId and username in the audit log, one has to pass req object in the save method at the time of document creation. 

## KubeUtils: Kubernetes API and Docker Client

### Kubernetes APIs

The following Kubernetes services have been implemented

* Namespace
* Deployment
* Services

#### Setting up the environment

The following environment variables must be set, 

* MDM_KEY - User key file to be used for the Kubernetes connection.
* MDM_CRT - User certificate file to be used for the Kubernetes connection.
* KUBERNETES_SERVICE_HOST - Hostname/IP of the Kubernetes server.
* KUBERNETES_SERVICE_PORT - Port to access the Kubernetes server.

#### APIs

__Namespace__

```js
ns.getAllNamespaces()
ns.getNamespace("capiot")
ns.createNamespace("test")
ns.getAllNamespaces()
ns.deleteNamespace("test")
ns.getAllNamespaces()
```

__Deployment__

```js
deployment.getAllDeployments()
deployment.getAllDeploymentsForNamespace("capiot")
deployment.getDeployment("capiot", "x")
deployment.createDeployment("capiot", "x", "x:2", 8080, [{"name": "ENV_VAR", "value": "value"}])
deployment.updateDeployment("capiot", "x", "x:2");
deployment.deleteDeployment("capiot", "x");
```

__Service__

```js
service.getAllServices()
service.getAllServicesForNamespace("capiot").then(_d => console.log(_d)
service.getService("capiot", "x")
service.createService("capiot", "x", 20001)
service.updateService("capiot", "x", 8001)
service.getAllServicesForNamespace("capiot")
service.deleteService("capiot", "x");
```

## Docker

Only one API is exposed. This is to push the image into a private registry

### Setting-up the environment

* REGISTRY - The AWS ECR URL
* AWS_ACCESS_KEY_ID - AWS access key.
* AWS_SECRET_ACCESS_KEY - AWS secret
* AWS_DEFAULT_REGION - AWS region

### APIs

```js
docker.pushImage("mdm:x2")
```

---
_Source: https://npm.io/package/@appveen/data.stack-utils · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
