Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@platformatic/sql-graphql

Package Overview
Dependencies
Maintainers
6
Versions
287
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@platformatic/sql-graphql - npm Package Compare versions

Comparing version 0.31.1 to 0.32.0

test/array.test.js

45

lib/entity-to-type.js

@@ -50,4 +50,8 @@ 'use strict'

// sqlite doesn't support enums
// PG does support Arrays as columns
/* istanbul ignore next */
if (field.enum) {
if (field.isArray) {
const listType = sqlTypeToGraphQL(field.sqlType)
meta.type = new graphql.GraphQLList(listType)
} else if (field.enum) {
const enumValues = field.enum.reduce((acc, enumValue, index) => {

@@ -104,16 +108,26 @@ let key = enumValue.replace(/[^\w\s]/g, '_')

const whereFields = Object.keys(fields).reduce((acc, field) => {
let graphqlFields
/* istanbul ignore else */
if (!fields[field].field.isArray) {
graphqlFields = {
eq: { type: fields[field].type },
neq: { type: fields[field].type },
gt: { type: fields[field].type },
gte: { type: fields[field].type },
lt: { type: fields[field].type },
lte: { type: fields[field].type },
like: { type: fields[field].type },
in: { type: new graphql.GraphQLList(fields[field].type) },
nin: { type: new graphql.GraphQLList(fields[field].type) }
}
} else {
graphqlFields = {
any: { type: fields[field].type.ofType },
all: { type: fields[field].type.ofType }
}
}
acc[field] = {
type: new graphql.GraphQLInputObjectType({
name: `${entityName}WhereArguments${field}`,
fields: {
eq: { type: fields[field].type },
neq: { type: fields[field].type },
gt: { type: fields[field].type },
gte: { type: fields[field].type },
lt: { type: fields[field].type },
lte: { type: fields[field].type },
like: { type: fields[field].type },
in: { type: new graphql.GraphQLList(fields[field].type) },
nin: { type: new graphql.GraphQLList(fields[field].type) }
}
fields: graphqlFields
})

@@ -168,4 +182,7 @@ }

values: Object.keys(fields).reduce((acc, field) => {
acc[field] = {
value: field
/* istanbul ignore else */
if (!fields[field].isArray) {
acc[field] = {
value: field
}
}

@@ -172,0 +189,0 @@ return acc

{
"name": "@platformatic/sql-graphql",
"version": "0.31.1",
"version": "0.32.0",
"description": "Map SQL dbs to GraphQL",

@@ -25,4 +25,4 @@ "main": "index.js",

"ws": "^8.13.0",
"@platformatic/sql-events": "0.31.1",
"@platformatic/sql-mapper": "0.31.1"
"@platformatic/sql-events": "0.32.0",
"@platformatic/sql-mapper": "0.32.0"
},

@@ -29,0 +29,0 @@ "dependencies": {

# @platformatic/sql-graphql
Check out the full documentation on [our website](https://oss.platformatic.dev/docs/reference/sql-graphql/queries).
Check out the full documentation on [our website](https://docs.platformatic.dev/docs/reference/sql-graphql/queries).

@@ -5,0 +5,0 @@ ## Install

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc