MCPcopy Create free account
hub / github.com/ShipSecAI/studio / comparePortTypes

Function comparePortTypes

frontend/src/utils/portUtils.ts:70–92  ·  view source on GitHub ↗
(source: ConnectionType, target: ConnectionType)

Source from the content-addressed store, hash-verified

68};
69
70const comparePortTypes = (source: ConnectionType, target: ConnectionType): boolean => {
71 if (target.kind === 'any' || source.kind === 'any') {
72 return true;
73 }
74
75 if (isPrimitive(source) && isPrimitive(target)) {
76 return canCoercePrimitive(source, target);
77 }
78
79 if (isContract(source) && isContract(target)) {
80 return source.name === target.name && source.credential === target.credential;
81 }
82
83 if (isList(source) && isList(target)) {
84 return comparePortTypes(normalizePortType(source.element), normalizePortType(target.element));
85 }
86
87 if (isMap(source) && isMap(target)) {
88 return comparePortTypes(normalizePortType(source.element), normalizePortType(target.element));
89 }
90
91 return false;
92};
93
94export const arePortTypesCompatible = (source: PortLike, target: PortLike): boolean =>
95 comparePortTypes(normalizePortType(source), normalizePortType(target));

Callers 1

arePortTypesCompatibleFunction · 0.85

Calls 6

isPrimitiveFunction · 0.85
isContractFunction · 0.85
isListFunction · 0.85
normalizePortTypeFunction · 0.85
isMapFunction · 0.85
canCoercePrimitiveFunction · 0.70

Tested by

no test coverage detected