# loopback-advancedmodel

> Loopback 3.x advanced promisified model with Object-oriented API descriptor

Latest version **1.13.0** (published 2019-09-13) · MIT license · 0 weekly downloads

> **Deprecated.** This package is deprecated.

## Install

```sh
npm install loopback-advancedmodel
pnpm add loopback-advancedmodel
yarn add loopback-advancedmodel
bun add loopback-advancedmodel
```

## Health

**Score 10/100 (F)** — status: deprecated.

Negative: deprecated.

## Facts

| | |
|---|---|
| Version | 1.13.0 |
| Published | 2019-09-13 |
| First published | 2017-11-04 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 1 |
| Unpacked size | 28.6 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 3 |
| Author | GENTILHOMME Thomas |
| Maintainers | fraxken |
| Keywords | loopback, model, async |

## Links

- npm: https://www.npmjs.com/package/loopback-advancedmodel
- Repository: https://github.com/fraxken/loopback-advancedmodel
- Homepage: https://github.com/fraxken/loopback-advancedmodel#readme
- Issues: https://github.com/fraxken/loopback-advancedmodel/issues
- npm.io page: https://npm.io/package/loopback-advancedmodel

## Dependencies (1)

- [lodash.clonedeep](https://npm.io/package/lodash.clonedeep.md) ^4.5.0

## Alternatives

- [promise-throttle](https://npm.io/package/promise-throttle.md) — 44.2K weekly downloads
- [@commercetools/sync-actions](https://npm.io/package/@commercetools/sync-actions.md) — 25.1K weekly downloads
- [cwait](https://npm.io/package/cwait.md) — 21.4K weekly downloads
- [@ledgerhq/hw-app-cosmos](https://npm.io/package/@ledgerhq/hw-app-cosmos.md) — 4.2K weekly downloads
- [@financial-times/o-loading](https://npm.io/package/@financial-times/o-loading.md) — 2.8K weekly downloads

## Recent versions

- 1.13.0 (latest) — 2019-09-13
- 1.12.1 — 2019-04-11
- 1.12.0 — 2018-03-08
- 1.11.1 — 2018-02-27
- 1.11.0 — 2017-11-18
- 1.10.0 — 2017-11-18
- 1.9.0 — 2017-11-09
- 1.8.2 — 2017-11-07
- 1.8.0 — 2017-11-07
- 1.7.0 — 2017-11-07
- 1.6.0 — 2017-11-07
- 1.5.1 — 2017-11-07
- 1.5.0 — 2017-11-06
- 1.4.1 — 2017-11-06
- 1.4.0 — 2017-11-06
- … 7 more at https://npm.io/package/loopback-advancedmodel/versions

## README

# Loopback-advancedmodel
![version](https://img.shields.io/badge/dynamic/json.svg?url=https://raw.githubusercontent.com/fraxken/loopback-advancedmodel/master/package.json&query=$.version&label=Version)
[![Maintenance](https://img.shields.io/badge/Maintained%3F-yes-green.svg)](https://github.com/fraxken/loopback-advancedmodel/commit-activity)
![MIT](https://img.shields.io/github/license/mashape/apistatus.svg)
![dep](https://img.shields.io/david/fraxken/loopback-advancedmodel)
![size](https://img.shields.io/bundlephobia/min/loopback-advancedmodel)
[![Known Vulnerabilities](https://snyk.io//test/github/fraxken/loopback-advancedmodel/badge.svg?targetFile=package.json)](https://snyk.io//test/github/fraxken/loopback-advancedmodel?targetFile=package.json)

Improved model component for Loopback version 3.x

## Features

- Async & Await support
- Register multiple validators on one property at once.
- Better generic errors handler.
- Object-oriented descriptor for OpenAPI (Swagger 2.0).
- Basic ACLs management support

## Getting Started

This package is available in the Node Package Repository and can be easily installed with [npm](https://docs.npmjs.com/getting-started/what-is-npm) or [yarn](https://yarnpkg.com).

```bash
$ npm i loopback-advancedmodel
# or
$ yarn add loopback-advancedmodel
``` 

## Usage example
Setup your loopback project as usual and then start writing a new model (for example User).

Require the advancedmodel `class` from the package and use it as follow :

```javascript
const advancedmodel = require('loopback-advancedmodel');

// Create your User Model
const User = new advancedmodel().disableAllMethods();

async function sayHello() {
    return "hello world!";
}
// Register the Asynchronous method sayHello on User model and Get the OpenAPI Descriptor Object.
const OpenAPIDescriptor = User.registerRemoteMethod(sayHello);

// Setup classical OpenAPI informations about our REST Endpoint.
OpenAPIDescriptor.get('/sayHello').returns({ type: 'string' });

// Export the User model
module.exports = User.export();
``` 

## API
Find all documentation on the wiki section right [here](https://github.com/fraxken/loopback-advancedmodel/wiki)

## License
MIT

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