New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@thinkmill/keystone-mosql-yaml-gen

Package Overview
Dependencies
Maintainers
11
Versions
11
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@thinkmill/keystone-mosql-yaml-gen

A basic and somewhat crappy generator of a MoSQL YAML config from KeystoneJS models

  • 2.0.2
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
4
increased by33.33%
Maintainers
11
Weekly downloads
 
Created
Source

MoSQL Yaml Generator for Keystone

Tools for generating a MoSQL-compatible YAML document describing the lists and models configured for your Keystone instance.

Usage

Require the package like always:

const mosqlYaml = require('@thinkmill/keystone-mosql-yaml-gen');

Drop in Endpoint

The simplest way to use is to drop the included endpoint in your routes, like this:

app.get('/api/keystoneListsYaml', mosqlYaml.createMosqlYamlEndpoint(keystone));

Or, if there isn't already middleware restricting access, maybe closer to this:

app.get('/api/keystoneListsYaml', bsMiddleware.buildUserFlagValidator('isAdmin'), mosqlYaml.createMosqlYamlEndpoint(keystone));

Here we've use the blueshyft middleware package to restrict access to admins.

DIY Endpoint

If you wanted to create your own endpoint, here's a reasonable starting point:

'use strict';

const keystone = require('keystone');
const mosqlYaml = require('@thinkmill/keystone-mosql-yaml-gen');

module.exports = function (req, res, next) {
	const yamlGen = new mosqlYaml.YamlGenerator(keystone);

	res.set('content-disposition', `attachment; filename="${yamlGen.getFilename()}"`);
	res.set('content-Type', 'application/x-yaml');
	res.send(yamlGen.generateYaml());
};

FAQs

Package last updated on 07 Dec 2016

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