Creating private helper functions in actions folder
Is it recommended to export private helper functions for encryption and decryption in a file in the actions folder?
I'd like to use this across my other actions but wasn't sure if it's best practice
3 Replies
That sounds fine — helpers won't become Convex functions callable from the client unless they use
action()
or mutation()
or query()
wrappers. Any other functions you write in the convex/ directory (including the actions folder) are just JavaScript code, even if you export them.awesome thanks for the clarification
it just creates an API on the api.d.ts so wanted to double check
ah yeah, the codegen does the absolute minimum of analysis, it just makes a list of all the files. But the TypeScript types of the exports without wrappers will keep them from showing up in autocompletion in
useQuery
etc., and more importantly the lack of wrappers will keep them from becoming endpoints on the server