plexiform-build-apicmds
Advanced tools
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 @@ |
{ | ||
"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" | ||
} | ||
} |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
0
9208
193
+ Addedplexiform-config-api@1.0.0(transitive)
- Removedplexiform-config-api@0.3.0(transitive)
Updatedplexiform-config-api@^1.0.0