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

plexiform-build-apicmds

Package Overview
Dependencies
Maintainers
2
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

plexiform-build-apicmds - npm Package Compare versions

Comparing version 0.2.0 to 0.2.1

43

index.js

@@ -5,2 +5,3 @@ /* jshint esversion: 6, laxcomma: true */

const config_processor = require("plexiform-config-api").process;
const config_expander = require("plexiform-config-api").expand;

@@ -13,3 +14,3 @@ module.exports.process = mddom => config_processor(mddom);

name: "plexiform-build-apicmds",
version: "0.2.0",
version: "0.2.1",
author: "Raith"

@@ -20,12 +21,4 @@ };

Object.assign(utils, {
entitiesThatReferToEntity: name => config.entities.filter(e => (e.refs || []).filter(r => r.entity === name).length > 0)
,
childCollections: name => [].concat(...config.entities.map(e => (e.refs || []).filter(r => r.entity === name)))
,
data: () => config.data[config.data.use]
,
dataProviderSupportsSchema: name => ["SqlServer"].includes(name || utils.data().provider)
,
toCamelCase: txt => txt ? txt[0].toLowerCase() + txt.substr(1) : ""
,
entity: name => config.entities.find(e => e.name === name)

@@ -35,37 +28,9 @@ ,

,
paramList: (params, includeOptional = false, addFromBody = false) => params.map(p => `${addFromBody && utils.paramIsObject(p) ? "[FromBody] " : ""}${config.types[p.type] ? config.types[p.type].cs : p.type} ${p.name}${includeOptional && p.optional ? ` = ${p.optional}` : ""}`).join(", ")
,
hash2list: (hash, keyProperty, filterKeys) => Object.keys(hash).filter(k => !filterKeys || filterKeys.contains(k)).map(k => Object.assign(hash[k], keyProperty ? { [keyProperty]: k } : null))
,
list2hash: (list, keyProperty) => list.reduce((o, i) => Object.assign(o, { [i[keyProperty]]: i }), {})
,
paramIsObject: (prm => !(prm.type in config.types))
});
// Add reciprocal refs...
// Expand config
// Api: Add parent Area ref to each Query and Command
(config.api || []).forEach(area => {
(area.queries || []).forEach(query => { query.area = area; });
(area.commands || []).forEach(comm => { comm.area = area; });
});
config_expander(config);
// List of namespaces
config.list_namespaces = Object.keys(config.namespaces).map(k => config.namespaces[k]);
// Dictionary of entities by name
config.dict_entities = (config.entities || []).reduce((o, i) => Object.assign(o, { [i.name]: i }), {});
// Dictionary of api by name
config.dict_api = config.api.reduce((o, i) => Object.assign(o, { [i.name]: i }), {});
// Dictionaries of properties and refs by name per entity
(config.entities || []).forEach(e => {
e.dict_properties = (e.properties || []).reduce((o, i) => Object.assign(o, { [i.name]: i }), {});
e.dict_refs = (e.refs || []).reduce((o, i) => Object.assign(o, { [i.name]: i }), {});
e.dict_childRefs = (e.childRefs || []).reduce((o, i) => Object.assign(o, { [i.collection]: i }), {});
});
// Flattened collection of all api Commands
config.api.flat_commands = config.api.reduce((commands, area) => [...commands, ...area.commands], []);
// -------------------------------------------------------------------------------------------
// Import templates

@@ -72,0 +37,0 @@

4

package.json
{
"name": "plexiform-build-apicmds",
"version": "0.2.0",
"version": "0.2.1",
"description": "A plexiform build script for generating a class library of Commands implementations for a back-end api",

@@ -12,4 +12,4 @@ "main": "index.js",

"dependencies": {
"plexiform-config-api": "^0.3.0"
"plexiform-config-api": "^1.0.0"
}
}
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