Created by daltonmcdxxix 291 days ago Viewed 54 times 0 Points
No comments yet
import { Resource } from "https://deno.land/x/windmill@v1.70.1/mod.ts"
/**
* Learn more at
* https://docs.fauna.com/fauna/current/api/graphql/endpoints#import
*/
export async function main(
auth: Resource<'faunadb'>,
schema: string,
mode: 'merge' | 'replace' | 'override' = 'merge'
) {
const region = ['us', 'eu'].includes(auth.region) ? auth.region : '';
const response = await fetch(`https://graphql.${region}.fauna.com/import?mode=${mode}`, {
method: 'POST',
headers: {
Authorization: 'Bearer ' + auth.secret
},
body: schema
});
return await response.text();
}
No comments yet