feat(engine): add private NDC nodes and ontology bridge
This commit is contained in:
+24
-3
@@ -467,9 +467,27 @@ function normalizeTypeName(value) {
|
||||
function fullNodeType(value) {
|
||||
const raw = cleanString(value, 240)
|
||||
if (!raw) return ''
|
||||
if (isPackageQualifiedNodeType(raw)) return raw
|
||||
return raw.startsWith('n8n-nodes-base.') ? raw : `n8n-nodes-base.${raw}`
|
||||
}
|
||||
|
||||
function isPackageQualifiedNodeType(value) {
|
||||
return /^(?:@[a-z0-9._-]+\/)?n8n-nodes-[a-z0-9._-]+\.[a-z0-9._-]+$/i.test(cleanString(value, 240))
|
||||
}
|
||||
|
||||
function catalogNodeRuntimeType(node) {
|
||||
const explicit = [node?.runtimeType, node?.fullType, node?.publicType, node?.type]
|
||||
.map((value) => cleanString(value, 240))
|
||||
.find(isPackageQualifiedNodeType)
|
||||
if (explicit) return explicit
|
||||
const packageName = cleanString(node?.packageName || node?.package, 160)
|
||||
const name = cleanString(node?.name, 160)
|
||||
if (name && /^(?:@[a-z0-9._-]+\/)?n8n-nodes-[a-z0-9._-]+$/i.test(packageName)) {
|
||||
return `${packageName}.${name}`
|
||||
}
|
||||
return fullNodeType(node?.publicType || name)
|
||||
}
|
||||
|
||||
function cleanWebhookSegment(value, fallback) {
|
||||
const out = cleanString(value, 240)
|
||||
.toLowerCase()
|
||||
@@ -538,7 +556,8 @@ function compactNodeDefinition(node, maxProperties = 80) {
|
||||
const properties = Array.isArray(node?.properties) ? node.properties.slice(0, maxProperties) : []
|
||||
return {
|
||||
name: node?.name || '',
|
||||
fullType: fullNodeType(node?.name || ''),
|
||||
publicType: node?.publicType || node?.name || '',
|
||||
fullType: catalogNodeRuntimeType(node),
|
||||
displayName: node?.displayName || node?.name || '',
|
||||
description: node?.description || '',
|
||||
group: node?.group || [],
|
||||
@@ -722,7 +741,8 @@ async function handleSearchNodes(args) {
|
||||
.slice(0, limit)
|
||||
.map(({ node }) => ({
|
||||
name: node?.name || '',
|
||||
fullType: fullNodeType(node?.name || ''),
|
||||
publicType: node?.publicType || node?.name || '',
|
||||
fullType: catalogNodeRuntimeType(node),
|
||||
displayName: node?.displayName || node?.name || '',
|
||||
description: node?.description || '',
|
||||
group: node?.group || [],
|
||||
@@ -737,7 +757,8 @@ async function handleGetNodeDefinition(args) {
|
||||
const catalog = await loadNodeCatalog(args.schemaVersion)
|
||||
const node = catalog.find((item) => (
|
||||
String(item?.name || '') === nodeType ||
|
||||
fullNodeType(item?.name || '') === cleanString(args.nodeType || args.type || args.name)
|
||||
String(item?.publicType || '') === nodeType ||
|
||||
catalogNodeRuntimeType(item) === cleanString(args.nodeType || args.type || args.name)
|
||||
))
|
||||
if (!node) throw new Error(`node_not_found:${nodeType}`)
|
||||
return { ok: true, node: compactNodeDefinition(node, Number(args.maxProperties || 80) || 80) }
|
||||
|
||||
Reference in New Issue
Block a user