Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

loopback-component-meta

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

loopback-component-meta

LoopBack component for retrieving meta data about the API Models

  • 1.1.0
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
86
increased by1.18%
Maintainers
1
Weekly downloads
 
Created
Source

loopback-component-meta

CircleCI Dependencies Coverage Status

Component for LoopBack 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

[{
	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

{
	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: []
}

Keywords

FAQs

Package last updated on 06 Jun 2017

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc