import { DataResource , Resource , ResourceType , UploadResourcesOptions } from "../types" ; import createOrUpdateData from "./createOrUpdateData" ; import createOrUpdateStandardResources from "./createOrUpdateStandardResources" ; import createFunctionsWithoutRoles from "./createFunctionsWithoutRoles" ; param { object [ ] } resources param { "data" | "functions" | "roles" | "indexes" } type param { { fnsWithRoles : boolean } } options export default async function createOrUpdateResources ( resources , type , { fnsWithRoles = true } = { } ) { const resourcesArray = resources ; if ( type === "data" ) { return createOrUpdateData ( resourcesArray as DataResource [ ] ) ; } if ( type === "functions" && ! fnsWithRoles ) { return createFunctionsWithoutRoles ( resourcesArray ) ; } return createOrUpdateStandardResources ( resourcesArray , type ) ; }