Generic scope-aware MetaSchema module resolution for constructive-functions.
Queries metaschema_modules_public.*_module tables to resolve schema/table locations dynamically. No hardcoded defaults — throws explicitly if a module is not provisioned.
import { ModuleLoader } from '@constructive-io/module-loader';
const loader = new ModuleLoader({ pool });
// Resolve function module config for a database
const fnConfig = await loader.function.load(databaseId);
// → { scope, publicSchema, privateSchema, definitionsTable, secretDefinitionsTable }
// With explicit scope (when multiple instances exist)
const orgConfig = await loader.function.load(databaseId, 'org');
// Enumerate all instances
const all = await loader.function.loadAll(databaseId);scopeprovided → filter by it; throwModuleNotProvisionedErrorif not foundscopenull + 1 instance → return it (unambiguous)scopenull + 0 instances → throwModuleNotProvisionedErrorscopenull + 2+ instances → throwAmbiguousScopeError