type Faunadb = {
region: string;
secret: string;
};
export async function main(
auth: Faunadb,
query: string,
variables?: Record<string, any>,
operationName?: string,
) {
const region = ["us", "eu"].includes(auth.region) ? auth.region : "";
const response = await fetch(`https://graphql.${region}.fauna.com/graphql`, {
method: "POST",
headers: {
Authorization: "Bearer " + auth.secret,
},
body: JSON.stringify({
query,
variables: variables || {},
operationName: operationName || null,
}),
});
return await response.json();
}
Submitted by admin 497 days ago
type Faunadb = {
region: string;
secret: string;
};
export async function main(
auth: Faunadb,
query: string,
variables?: Record<string, any>,
operationName?: string
) {
const region = ['us', 'eu'].includes(auth.region) ? auth.region : '';
const response = await fetch(`https://graphql.${region}.fauna.com/graphql`, {
method: 'POST',
headers: {
Authorization: 'Bearer ' + auth.secret
},
body: JSON.stringify({
query,
variables: variables || {},
operationName: operationName || null
})
});
return await response.json();
}
Submitted by admin 500 days ago
import { Resource } from "https://deno.land/x/windmill@v1.85.0/mod.ts"
export async function main(
auth: Resource<'faunadb'>,
query: string,
variables?: Record<string, any>,
operationName?: string
) {
const region = ['us', 'eu'].includes(auth.region) ? auth.region : '';
const response = await fetch(`https://graphql.${region}.fauna.com/graphql`, {
method: 'POST',
headers: {
Authorization: 'Bearer ' + auth.secret
},
body: JSON.stringify({
query,
variables: variables || {},
operationName: operationName || null
})
});
return await response.json();
}
Submitted by adam186 628 days ago
import { Resource } from "https://deno.land/x/windmill@v1.70.1/mod.ts"
export async function main(
auth: Resource<'faunadb'>,
query: string,
variables?: Record<string, any>,
operationName?: string
) {
const region = ['us', 'eu'].includes(auth.region) ? auth.region : '';
const response = await fetch(`https://graphql.${region}.fauna.com/graphql`, {
method: 'POST',
headers: {
Authorization: 'Bearer ' + auth.secret
},
body: JSON.stringify({
query,
variables: variables || {},
operationName: operationName || null
})
});
return await response.json();
}
Submitted by adam186 663 days ago
import { Resource } from "https://deno.land/x/windmill@v1.55.0/mod.ts"
export async function main(
auth: Resource<'faunadb'>,
query: string,
variables?: Record<string, any>,
operationName?: string
) {
const region = ['us', 'eu'].includes(auth.region) ? auth.region : '';
const response = await fetch(`https://graphql.${region}.fauna.com/graphql`, {
method: 'POST',
headers: {
Authorization: 'Bearer ' + auth.secret
},
body: JSON.stringify({
query,
variables: variables || {},
operationName: operationName || null
})
});
return await response.json();
}
Submitted by adam186 731 days ago