@compas/code-gen
Advanced tools
Comparing version 0.0.124 to 0.0.125
{ | ||
"name": "@compas/code-gen", | ||
"version": "0.0.124", | ||
"version": "0.0.125", | ||
"description": "Generate various boring parts of your server", | ||
@@ -18,5 +18,5 @@ "main": "./index.js", | ||
"dependencies": { | ||
"@compas/cli": "0.0.124", | ||
"@compas/insight": "0.0.124", | ||
"@compas/stdlib": "0.0.124" | ||
"@compas/cli": "0.0.125", | ||
"@compas/insight": "0.0.125", | ||
"@compas/stdlib": "0.0.125" | ||
}, | ||
@@ -44,3 +44,3 @@ "maintainers": [ | ||
}, | ||
"gitHead": "11f6c1b6b808aa80ee6746db8f489ab4f2ef03cc" | ||
"gitHead": "a44a773801f5fd21f6b92a751cef57d3e3e563c6" | ||
} |
@@ -48,6 +48,13 @@ import { isPlainObject } from "@compas/stdlib"; | ||
return new ObjectType().keys(value).build(); | ||
} else if (Array.isArray(value) && value.length !== 0) { | ||
} else if (Array.isArray(value) && value.length === 1) { | ||
return new ArrayType().values(value[0]).build(); | ||
} | ||
if (Array.isArray(value) && value.length !== 1) { | ||
throw new Error( | ||
`Inferred arrays can only have a single element. Found '${value}' which has ${value.length} elements.`, | ||
); | ||
} | ||
throw new Error(`Could not infer type of '${value}'`); | ||
} |
@@ -22,3 +22,3 @@ import { js } from "./tag/tag.js"; | ||
contents: generateCommonReactQueryFile(), | ||
relativePath: `./common/reactQuery${context.extension}`, | ||
relativePath: `./common/reactQuery${context.extension}x`, | ||
}); | ||
@@ -25,0 +25,0 @@ } |
@@ -142,2 +142,26 @@ const RoutePrio = { | ||
if (path.length === 1) { | ||
if (child.uniqueName) { | ||
let fullPath = `${path[0]}`; | ||
if (!trie.parent) { | ||
// The root path is POST / so handle that case | ||
fullPath += ` /`; | ||
} | ||
let _trie = trie; | ||
while (_trie.parent) { | ||
_trie = _trie.parent; | ||
if (!_trie.parent?.parent) { | ||
// The root is `POST` or `GET` so handle that case | ||
fullPath = `${_trie.path} /${fullPath}`; | ||
break; | ||
} else { | ||
fullPath = `${_trie.path}/${fullPath}`; | ||
} | ||
} | ||
throw new Error( | ||
`Duplicate route for path '${fullPath}'. Both '${child.uniqueName}' and '${uniqueName}' have the same route path.`, | ||
); | ||
} | ||
child.uniqueName = uniqueName; | ||
@@ -144,0 +168,0 @@ } else { |
400646
12966
+ Added@compas/cli@0.0.125(transitive)
+ Added@compas/insight@0.0.125(transitive)
+ Added@compas/stdlib@0.0.125(transitive)
- Removed@compas/cli@0.0.124(transitive)
- Removed@compas/insight@0.0.124(transitive)
- Removed@compas/stdlib@0.0.124(transitive)
Updated@compas/cli@0.0.125
Updated@compas/insight@0.0.125
Updated@compas/stdlib@0.0.125