Security News
RubyGems.org Adds New Maintainer Role
RubyGems.org has added a new "maintainer" role that allows for publishing new versions of gems. This new permission type is aimed at improving security for gem owners and the service overall.
prisma-datamodel
Advanced tools
The Prisma Datamodel package forms the foundation of all datamodel related tasks in the CLI.
ISDL
, IGQLType
, IGQLField
. These data structures are documented inline. The data structures might be self referencing, and all operations in this library guarantee to keep the references valid.TypeIdentifier
, TypeIdentifiers
Parser
, with the factory classDefaultParser
Renderer
, with the factory class Default Renderer
cloneSchema
to safely clone an ISDL
structure, toposort
to sort a datamodel in topological order.When creating a parser or renderer, a flag that indicates the database type has to be passed. The internal representation is guaranteed to be consistent between different databases. It is possible to parse a mongo schema and render a postgres schema without any transformations in between.
The parser is capable of parsing both datamodel formats, and even models with mixed directives from both standards. For rendering, a flag can be passed which indicates the datamodel format to follow.
The types ISDL
, IGQLType
and IGQLField
are designed to allow convenient analysis and transformation. Most notably, they may contain circular references (for representing related types and indexes). Therefor, these types are mutable, and care has to be taken when modifying them, for example by cloning them using cloneSchema
.
When adding or removing a type, it is important to also update all referring fields or indexes, otherwise other transformations or the rendering process might break.
Basic example:
const parser = DefaultParser.create(DatabaseType.mongo)
const model = parser.parse(datamodelAsString)
// Do something with the model
for (const type of model.types) {
console.log(
`${type.name} has ${type.fields.length} fields and ${
type.indices.length
} indexes`,
)
}
const enableDatamodel1_1 = true
const renderer = DefaultRenderer.create(
DatabaseType.postgres,
enableDatamodel1_1,
)
const renderedAsString = renderer.render(model)
FAQs
Transform prisma datamodel SDL into graphql-js SDL
We found that prisma-datamodel 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
RubyGems.org has added a new "maintainer" role that allows for publishing new versions of gems. This new permission type is aimed at improving security for gem owners and the service overall.
Security News
Node.js will be enforcing stricter semver-major PR policies a month before major releases to enhance stability and ensure reliable release candidates.
Security News
Research
Socket's threat research team has detected five malicious npm packages targeting Roblox developers, deploying malware to steal credentials and personal data.