Security News
Fluent Assertions Faces Backlash After Abandoning Open Source Licensing
Fluent Assertions is facing backlash after dropping the Apache license for a commercial model, leaving users blindsided and questioning contributor rights.
faunadb-graphql-schema-loader
Advanced tools
Package to simplify uploading GraphQL Schema to FaunaDB
A lib with some helper functions to make uploading a schema to FaunaDB easier.
It allows you to combine multiple SDL strings and use extend type
.
const { importSchema } = require('faunadb-graphql-schema-loader')
const secret = process.env.FAUNADB_ADMIN_KEY
const schema = `
type Budget {
name: String!
owner: User! @relation
}
type User {
budget: Budget! @relation
name: String!
}
`
importSchema(secret, schema).then((res) => console.log(res))
importSchema
importSchema = (
faunadbKey: string,
schema: string,
mode: 'merge' | 'override' = 'merge'
) => Promise<string>
Takes a schema string and uploads that to the database with the provided Admin Key.
Parameters
faunadbKey
An Admin key for your databaseschema
An SDL schema stringmode
Import mode. Defaults to merge
.Returns a Promise for the response.body
from the http request.
See basic example
makeSchema
makeSchema = (typeDefs: string[]) => string
Takes a list of SDL schema strings and combines them. This allows for using extends
in your type definitions.
Parameters
typeDefs
Array of SDL schema stringsReturns A single SDL schema string.
getTypeDefsFromFiles
getTypeDefsFromFiles = (paths: string[]) => string[]
Takes a list of relative file paths (from current working directory) and synchronously reads them.
Parameters
paths
Array of relative file paths.Returns An array of strings containing contents of the files indicated. Hopefully SDL schemas!
See files example
This package is quite small, and a bit opinionated on how to read in SDL files. Rather than add this as a project dependancy, I would actually recommend (at this point) just copying the source or the basics of it to your own code.
However, any feedback is appreciated, and if folks see ways to make this into a useful and viable package, I will work to make it so! Please fill out a Github Issue if you see anything.
Thanks!
The MIT License (MIT)
FAQs
Package to simplify uploading GraphQL Schema to FaunaDB
The npm package faunadb-graphql-schema-loader receives a total of 0 weekly downloads. As such, faunadb-graphql-schema-loader popularity was classified as not popular.
We found that faunadb-graphql-schema-loader demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Fluent Assertions is facing backlash after dropping the Apache license for a commercial model, leaving users blindsided and questioning contributor rights.
Research
Security News
Socket researchers uncover the risks of a malicious Python package targeting Discord developers.
Security News
The UK is proposing a bold ban on ransomware payments by public entities to disrupt cybercrime, protect critical services, and lead global cybersecurity efforts.