New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@platformatic/sql-openapi

Package Overview
Dependencies
Maintainers
5
Versions
331
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@platformatic/sql-openapi - npm Package Compare versions

Comparing version 0.6.1 to 0.7.0

test/tap-snapshots/updateMany-openapi-1.cjs

61

lib/entity-to-routes.js

@@ -64,3 +64,3 @@ 'use strict'

const key = baseKey + modifier
acc[key] = { type: mapSQLTypeToOpenAPIType(field.sqlType) }
acc[key] = { type: mapSQLTypeToOpenAPIType(field.sqlType), enum: field.enum }
}

@@ -389,2 +389,61 @@

app.put('/', {
schema: {
body: entitySchema,
querystring: {
type: 'object',
properties: {
fields,
...whereArgs
},
additionalProperties: false
},
response: {
200: {
type: 'array',
items: entitySchema
}
}
},
links: {
200: entityLinks
},
async handler (request, reply) {
const ctx = { app: this, reply }
const query = request.query
const queryKeys = Object.keys(query)
const where = {}
for (let i = 0; i < queryKeys.length; i++) {
const key = queryKeys[i]
if (key.startsWith('where.')) {
const [, field, modifier] = key.split('.')
where[field] ||= {}
let value = query[key]
if (modifier === 'in' || modifier === 'nin') {
// TODO handle escaping of ,
value = query[key].split(',')
if (mapSQLTypeToOpenAPIType(entity.fields[field].sqlType) === 'integer') {
value = value.map((v) => parseInt(v))
}
}
where[field][modifier] = value
}
}
const res = await entity.updateMany({
input: {
...request.body
},
where,
fields: request.query.fields,
ctx
})
// TODO: Should find a way to test this line
// if (!res) return reply.callNotFound()
reply.header('location', `${app.prefix}`)
return res
}
})
app.delete(`/:${primaryKeyCamelcase}`, {

@@ -391,0 +450,0 @@ schema: {

12

package.json
{
"name": "@platformatic/sql-openapi",
"version": "0.6.1",
"version": "0.7.0",
"description": "Map a SQL database to OpenAPI, for Fastify",

@@ -8,3 +8,3 @@ "main": "index.js",

"type": "git",
"url": "git+https://github.com/plaformatic/platformatic.git"
"url": "git+https://github.com/platformatic/platformatic.git"
},

@@ -14,7 +14,7 @@ "author": "Matteo Collina <hello@matteocollina.com>",

"bugs": {
"url": "https://github.com/plaformatic/platformatic/issues"
"url": "https://github.com/platformatic/platformatic/issues"
},
"homepage": "https://github.com/plaformatic/platformatic#readme",
"homepage": "https://github.com/platformatic/platformatic#readme",
"devDependencies": {
"@platformatic/sql-mapper": "0.6.1",
"@platformatic/sql-mapper": "0.7.0",
"fastify": "^4.6.0",

@@ -29,3 +29,3 @@ "mercurius": "^11.0.0",

"dependencies": {
"@platformatic/sql-json-schema-mapper": "0.6.1",
"@platformatic/sql-json-schema-mapper": "0.7.0",
"@fastify/deepmerge": "^1.1.0",

@@ -32,0 +32,0 @@ "@fastify/swagger": "^8.0.0",

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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