@compas/code-gen
Advanced tools
Comparing version 0.0.134 to 0.0.135
{ | ||
"name": "@compas/code-gen", | ||
"version": "0.0.134", | ||
"version": "0.0.135", | ||
"description": "Generate various boring parts of your server", | ||
@@ -18,4 +18,4 @@ "main": "./index.js", | ||
"dependencies": { | ||
"@compas/cli": "0.0.134", | ||
"@compas/stdlib": "0.0.134" | ||
"@compas/cli": "0.0.135", | ||
"@compas/stdlib": "0.0.135" | ||
}, | ||
@@ -43,3 +43,3 @@ "maintainers": [ | ||
}, | ||
"gitHead": "64810914b304fdf3466b64b40a001ee481c47980" | ||
"gitHead": "82a88d24e5ae2b9e092be1d33101abf37bbc20d6" | ||
} |
@@ -34,8 +34,3 @@ import { dirnameForModule, isNil, pathJoin } from "@compas/stdlib"; | ||
const contents = executeTemplate("routerGroupFile", { | ||
routeTrie, | ||
routeTags, | ||
extension: context.extension, | ||
importExtension: context.extension, | ||
groupStructure, | ||
options: context.options, | ||
groupName: group, | ||
@@ -42,0 +37,0 @@ }); |
@@ -13,5 +13,8 @@ const RoutePrio = { | ||
if (item.type === "route") { | ||
const fullPath = item.path.endsWith("/") | ||
? `${item.path}${item.method}` | ||
: `${item.path}/${item.method}`; | ||
routeTrieInput.push({ | ||
uniqueName: item.uniqueName, | ||
fullPath: `${item.method}/${item.path}`, | ||
fullPath, | ||
}); | ||
@@ -30,3 +33,2 @@ } | ||
const trie = createNode(""); | ||
addHttpMethods(trie); | ||
@@ -41,12 +43,4 @@ for (const r of input) { | ||
// Don't collapse top level | ||
for (const child of trie.children) { | ||
cleanTrieAndCollapse(child); | ||
} | ||
cleanTrieAndCollapse(trie); | ||
// Remove unneeded 'HTTP-method' children | ||
trie.children = trie.children.filter( | ||
(it) => it.children.length > 0 || it.uniqueName !== undefined, | ||
); | ||
sortTrie(trie); | ||
@@ -114,17 +108,2 @@ | ||
* @param trie | ||
*/ | ||
function addHttpMethods(trie) { | ||
addChildNodes( | ||
trie, | ||
createNode("GET"), | ||
createNode("POST"), | ||
createNode("PUT"), | ||
createNode("PATCH"), | ||
createNode("DELETE"), | ||
createNode("HEAD"), | ||
); | ||
} | ||
/** | ||
* @param trie | ||
* @param path | ||
@@ -131,0 +110,0 @@ * @param uniqueName |
@@ -444,4 +444,4 @@ import { isNil } from "@compas/stdlib"; | ||
"(SELECT value::${sqlCastType} FROM(values (", | ||
...builder.where.${ownKey}In.map( | ||
() => "").join("), ("), | ||
...Array.from({ length: builder.where.${ownKey}In.length - 1 }).map( | ||
() => "), ("), | ||
")) as ids(value)) INTERSECT " | ||
@@ -448,0 +448,0 @@ ], ...builder.where.${ownKey}In) |
Sorry, the diff of this file is not supported yet
414209
13390
+ Added@compas/cli@0.0.135(transitive)
+ Added@compas/stdlib@0.0.135(transitive)
+ Added@types/node@15.3.0(transitive)
- Removed@compas/cli@0.0.134(transitive)
- Removed@compas/stdlib@0.0.134(transitive)
- Removed@types/node@15.0.2(transitive)
Updated@compas/cli@0.0.135
Updated@compas/stdlib@0.0.135