Allow functions to be added to collection script domain

Often one does repetitive things in the script domain, e.g. create a unique validator that one wishes to reuse, or a simple function that needs to be done on almost all collections, so this commit allows the users of deployd create generic functions they can inject into the script domain.