# @aliatech/loopback-component-traceability

> Loopback component that provides functionality to keep a traceability of custom operations over models

Latest version **1.1.0** (published 2020-04-19) · MIT license · 0 weekly downloads

## Install

```sh
npm install @aliatech/loopback-component-traceability
pnpm add @aliatech/loopback-component-traceability
yarn add @aliatech/loopback-component-traceability
bun add @aliatech/loopback-component-traceability
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

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

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.1.0 |
| Published | 2020-04-19 |
| First published | 2019-11-06 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 5 |
| Unpacked size | 39 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | Juan Costa |
| Maintainers | akeri |
| Keywords | node, loopback, component, traceability, historical, registry, events, logs |

## Links

- npm: https://www.npmjs.com/package/@aliatech/loopback-component-traceability
- Repository: https://github.com/aliatech/loopback-component-traceability
- Homepage: https://github.com/aliatech/loopback-component-traceability#readme
- Issues: https://github.com/aliatech/loopback-component-traceability/issues
- npm.io page: https://npm.io/package/@aliatech/loopback-component-traceability

## Dependencies (5)

- [lodash](https://npm.io/package/lodash.md) ^4.17.11
- [bluebird](https://npm.io/package/bluebird.md) ^3.5.3
- [polygoat](https://npm.io/package/polygoat.md) ^1.1.4
- [sprintf-js](https://npm.io/package/sprintf-js.md) ^1.1.2
- [loopback-ds-timestamp-mixin](https://npm.io/package/loopback-ds-timestamp-mixin.md) ^3.4.1

## Alternatives

- [@expo/fingerprint](https://npm.io/package/@expo/fingerprint.md) — 6.2M weekly downloads
- [@azure/monitor-opentelemetry-exporter](https://npm.io/package/@azure/monitor-opentelemetry-exporter.md) — 850.0K weekly downloads
- [@azure/monitor-opentelemetry](https://npm.io/package/@azure/monitor-opentelemetry.md) — 624.0K weekly downloads
- [@posthog/ai](https://npm.io/package/@posthog/ai.md) — 423.3K weekly downloads
- [fakefilter](https://npm.io/package/fakefilter.md) — 63.9K weekly downloads

## Recent versions

- 1.1.0 (latest) — 2020-04-19
- 1.0.1 — 2019-12-25
- 1.0.0 — 2019-11-06

## README

# Loopback Component Traceability

Module for Loopback Framework that allows to keep a persisted traceability of custom operations over models

## Installation

```
npm i -S github:aliatech/loopback-component-traceability.git#develop
```

Enable and configure component in *component-config.json*

```
"loopback-component-traceability": {
  "userModel": "User" // Model to use as events' author 
}
```

Enable model files in *model-config.json*:

```
"models": [
  ...,
  "../node_modules/@aliatech7loopback-component-traceability/models"
]
```

Enable mixin files in *model-config.json*:

```
"mixins": [
  ...,
  "../node_modules/@aliatech/loopback-component-traceability/mixins"
]
```

Configure models in *model-config.json*:

```
...
"ModelEvent": {
  "dataSource": "db",
  "public": false
},
...
```

> Example: Change collection name in MongoDB

```
"ModelEvent": {
  "dataSource": "db",
  "public": true,
  "options": {
    "mongodb": {
      "collection": "Event"
    }
  }
},
```

### Notes

Enable ACL in your Loopback project if you haven't yet.
To achieve it, create the file *server/boot/authentication.js* with the following code:

```
'use strict';

module.exports = function enableAuthentication(server) {
  // enable authentication
  server.enableAuth();
};

```

### Development

Install development dependences from module root directory only if you want to execute module tests

```
cd node_modules/@aliatech/loopback-component-traceability
npm i --only=dev
```

## Usage

Configure the Traceable mixin in those models that require a traceability.
Add this in the model json file, under "mixins":

```
"mixins": [
  ...,
  "Traceable": true
]
```  

You also can set options:

```
"mixins": [
  ...,
  "Traceable": {
    "displayProperty": "name", // Property used as display of the object
    "events": {
      "create": true, // Enables automatic event create
      "update": true, // Enables automatic event update
      "remove": true // Enables automatic event remove
    }
  }
]
```

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