# loopback-component-meta

> LoopBack component for retrieving meta data about the API Models

Latest version **1.1.2** (published 2017-06-06) · MIT license · 0 weekly downloads

## Install

```sh
npm install loopback-component-meta
pnpm add loopback-component-meta
yarn add loopback-component-meta
bun add loopback-component-meta
```

## 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.2 |
| Published | 2017-06-06 |
| First published | 2016-07-11 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 2 |
| Known vulnerabilities | 0 (+12 in 2 direct dependencies) |
| Install scripts | no |
| GitHub stars | 7 |
| Author | Bram Borggreve |
| Maintainers | mrfelton |
| Keywords | StrongLoop, LoopBack, meta, metadata |

## Links

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

## Dependencies (2)

- [debug](https://npm.io/package/debug.md) 2.6.8
- [lodash](https://npm.io/package/lodash.md) 4.17.4

## Recent versions

- 1.1.2 (latest) — 2017-06-06
- 1.1.1 — 2017-06-06
- 1.1.0 — 2017-06-06
- 1.0.0 — 2016-07-11

## README

# loopback-component-meta

[![Greenkeeper badge](https://badges.greenkeeper.io/fullcube/loopback-component-meta.svg)](https://greenkeeper.io/)

[![CircleCI](https://circleci.com/gh/fullcube/loopback-component-meta.svg?style=svg)](https://circleci.com/gh/fullcube/loopback-component-meta) [![Dependencies](http://img.shields.io/david/fullcube/loopback-component-meta.svg?style=flat)](https://david-dm.org/fullcube/loopback-component-meta) [![Coverage Status](https://coveralls.io/repos/github/fullcube/loopback-component-meta/badge.svg?branch=master)](https://coveralls.io/github/fullcube/loopback-component-meta?branch=master)

Component for [LoopBack](https://loopback.io) that adds a Meta model that can be used to retrieve meta data about the model definitions.

# Installation

Install the module

    $ npm install --save loopback-component-meta

Configure the module in `server/component-config.json`

```
{
  "loopback-component-meta": {
    "enableRest": true,
    "filter": [
      "ACL",
      "AccessToken",
      "RoleMapping",
      "Role",
      "User"
    ],
    "acls": [{
      "accessType": "*",
      "principalType": "ROLE",
      "principalId": "$unauthenticated",
      "permission": "ALLOW"
    }]
  }
}
```


# Usage

After installation you should be able to retrieve data about your models through the `Meta` endpoint on your API:

## Retrieve all models:

[http://0.0.0.0:3000/api/Meta](http://0.0.0.0:3000/api/Meta)


```
[{
	id: "Category",
	name: "Category",
	properties: {
		name: {
			type: "String",
			required: true
		}
	},
	acls: [],
	base: "BaseModel",
	idInjection: true,
	methods: {},
	mixins: {
		ModifiedTimestamp: {}
	},
	relations: {
		products: {
			type: "hasMany",
			model: "Product",
			foreignKey: ""
		}
	},
	strict: false,
	validations: []
}, {
	id: "Product",
	name: "Product",
	properties: {
		name: {
			type: "String",
			required: true
		}
	},
	acls: [],
	base: "BaseModel",
	idInjection: true,
	methods: {},
	mixins: {
		ModifiedTimestamp: {}
	},
	relations: {
		category: {
			type: "belongsTo",
			model: "Category",
			foreignKey: ""
		}
	},
	strict: false,
	validations: []
}]
```


## Retrieve one model:


[http://0.0.0.0:3000/api/Meta/Category](http://0.0.0.0:3000/api/Meta/Category)

```
{
	id: "Category",
	name: "Category",
	properties: {
		name: {
			type: "String",
			required: true
		}
	},
	acls: [],
	base: "BaseModel",
	idInjection: true,
	methods: {},
	mixins: {
		ModifiedTimestamp: {}
	},
	relations: {
		products: {
			type: "hasMany",
			model: "Product",
			foreignKey: ""
		}
	},
	strict: false,
	validations: []
}
```

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