You don't need an inverter since you can just use a clever combination of raising bridges, retracting bridges and doors/floodgates.
In brief, a raising bridge obstructs passage when it is raised, but a retracting bridge over ramps allows passage when it is retracted. Also doors and floodgates operate in the opposite phase to raising bridges so you could use doors on the fortress side, and a raising bridge on the outdoors side. Hatches and retracting bridges operate in the same phase so do not complement each other.
You can actually use retracting bridges exclusively as well by requiring a change in z-level. A retracting bridge allows horizontal passage over a pit/water/magma moat when it is extended, it allows vertical passage up/down ramps when it is retracted. Retracted bridges never kill, which is nice if you're not building a death trap. They also cannot be obstructed from extending over empty space although a heavy creature can stop them retracting, this typically makes them more secure for lock-down than raising bridges, you might get stuck in lockdown, but wont be prevented from locking down.
So you could for example have the depot separated from the fortress by a pit (make sure it's wider than 1-z to prevent easy jumping, and use smooth walls to prevent climbing), the depot should be connected to the surface by ramps, with a retracting bridge over the ramps. With both bridges linked to the same lever, when the bridges are open, the caravan can enter the depot from outside but things in the depot can't enter the fortress. With the bridges extended, nothing can enter the depot from outside, and the dwarves can come in from inside.