When you look at an action not backed by a Function, there is a ‘Covert TypeScript Function Code’ (Experimental) feature that suggests the equivalent TS code as a starting point for perhaps making a more complex function.
In that suggestion the public keyword is missing before the async functionName(input a, input b). One colleague was, we think, caught out by this, as without the public keyword, it doesn’t look like the Action that’s backed by this function is visible in Foundry, even if it’s correctly published. After we added public and created a new tagged version it was visible. Even without the public it worked in the function preview etc.
All the examples in the docs use the public prefix, but I couldn’t actually see anywhere where it says this is mandatory for the publishing to work. Is it mandatory, and an omission in this conversion suggestion, or is the public not essential to have a function published?
TypeScript marks a member or function of a class as public by default, so this is likely why you are not getting any errors when omitting it.
However, in order for the function to be released, it must explicitly be marked as public in your code. This is a design choice, but one likely made to not expose any functions that aren’t explicitly marked as public.
So to answer your question: It’s mandatory for the publishing, but not required by the language, and it’s not mentioned in the documentation (AFAIK).