# ambisis_node_helper

> Ambisis helper, funções úteis utilizadas em vários projetos do Ambisis

Latest version **1.10.2** (published 2026-11-27) · ISC license · 0 weekly downloads

## Install

```sh
npm install ambisis_node_helper
pnpm add ambisis_node_helper
yarn add ambisis_node_helper
bun add ambisis_node_helper
```

## Health

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

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

Warnings: low downloads; no esm support.

## Facts

| | |
|---|---|
| Version | 1.10.2 |
| Published | 2026-11-27 |
| First published | 2022-07-11 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 5 |
| Unpacked size | 49.6 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | ambisis |
| Maintainers | cunha-ambisis, felipe-flohr-ambisis |
| Keywords | ambisis |

## Links

- npm: https://www.npmjs.com/package/ambisis_node_helper
- Repository: https://github.com/cunha-ambisis/ambisis_node_helper
- Homepage: https://github.com/cunha-ambisis/ambisis_node_helper#readme
- Issues: https://github.com/cunha-ambisis/ambisis_node_helper/issues
- npm.io page: https://npm.io/package/ambisis_node_helper

## Dependencies (5)

- [helmet](https://npm.io/package/helmet.md) ^5.1.0
- [express](https://npm.io/package/express.md) ^4.22.2
- [cross-fetch](https://npm.io/package/cross-fetch.md) ^3.1.5
- [express-validator](https://npm.io/package/express-validator.md) ^6.14.2
- [express-rate-limit](https://npm.io/package/express-rate-limit.md) ^6.4.0

## Recent versions

- 1.10.2 (latest) — 2026-11-27
- 1.10.1 — 2024-09-20
- 1.10.0 — 2023-10-26
- 1.9.0 — 2023-10-26
- 1.8.0 — 2023-06-23
- 1.7.1 — 2023-01-13
- 1.7.0 — 2023-01-13
- 1.6.0 — 2022-09-28
- 1.5.1 — 2022-09-16
- 1.4.1 — 2022-08-31
- 1.4.0 — 2022-08-31
- 1.3.10 — 2022-08-19
- 1.3.9 — 2022-08-19
- 1.3.8 — 2022-08-19
- 1.3.7 — 2022-08-19
- … 29 more at https://npm.io/package/ambisis_node_helper/versions

## README

# ambisis_node_helper

## service integrator
Use it to comunicate with other services using private or public keys
```typescript
import { ServiceIntegrator } from 'ambisis_node_helper';

const { integration } = EnvironmentSettings.instance;

export const mailServiceIntegrator = new ServiceIntegrator({
	serviceHost: "localhost:3035",
	privateKey: "12345",
});

await mailServiceIntegrator.post('/daily_report', {
	foo: 'foo'
});

response = await mailServiceIntegrator.get('/foo?bar=123')

response.status

body = response.json()
console.log(body)
{
	"code": 200,
	"message": "SUCCESS"
}

```

## validate_format

```typescript
import { Application } from 'express';
import { body } from 'express-validator';
import { root } from '../../controllers/daily_report/POST';
import { validate_format } from 'ambisis_node_helper';

export default (app: Application) => {
	app.post(
		'/foo',
		body('foo').isString().notEmpty(),
		body('bar').isString().notEmpty(),
		validate_format,
		root
	);
};
```

## middleware package
```typescript
import { Application } from 'express';
import { ambisisMiddlewarePackage } from 'ambisis_node_helper';

export default (app: Application) => {
	ambisisMiddlewarePackage(app, {
		privateKey: "12345",
		
	});
};
```

## Ambisis response
```typescript
// Non error, without data
return ambisisResponse(res, 200, 'SUCCESS');
{
	"code": 200,
	"error": "SUCCESS"
}


// Non error, with data
return ambisisResponse(res, 200, 'SUCCESS', {id: 123});
{
	"code": 200,
	"error": "SUCCESS",
	"data": {id: 123}
}

// Error
return ambisisResponse(res, 400, 'BAD_REQUEST');
{
	"code": 400,
	"error": "BAD_REQUEST"
}


// Error with data
return ambisisResponse(res, 422, 'BAD_REQUEST', {reason: "because you are dumb"});
{
	"code": 422,
	"error": "BAD_REQUEST",
	"data": {reason: "because you are dumb"}
}

```

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