libpg-query
Advanced tools
Comparing version 15.1.3 to 15.2.0-deparse
@@ -6,4 +6,6 @@ import { ParseResult } from "@pgsql/types"; | ||
export function parsePlPgSQLSync(funcsSql: string): any; | ||
export function deparse(parseTree: any): Promise<string>; | ||
export function deparseSync(parseTree: any): any; | ||
export function fingerprint(sql: string): Promise<string>; | ||
export function fingerprintSync(sql: string): string; | ||
export * from '@pgsql/types'; |
20
index.js
@@ -1,3 +0,5 @@ | ||
const PgQuery = require('./build/Release/queryparser.node'); | ||
const PgQuery = require('./build/Release/queryparser'); | ||
const { pg_query } = require('./proto'); | ||
module.exports = { | ||
@@ -12,2 +14,12 @@ parseQuery(query) { | ||
deparse(parseTree) { | ||
const msg = pg_query.ParseResult.fromObject(parseTree); | ||
const data = pg_query.ParseResult.encode(msg).finish(); | ||
return new Promise((resolve, reject) => { | ||
PgQuery.deparseAsync(data, (err, result) => { | ||
err ? reject(err) : resolve(result); | ||
}); | ||
}); | ||
}, | ||
parsePlPgSQL(query) { | ||
@@ -25,2 +37,8 @@ return new Promise((resolve, reject) => { | ||
deparseSync(parseTree) { | ||
const msg = pg_query.ParseResult.fromObject(parseTree); | ||
const data = pg_query.ParseResult.encode(msg).finish(); | ||
return PgQuery.deparseSync(data); | ||
}, | ||
parsePlPgSQLSync(query) { | ||
@@ -27,0 +45,0 @@ return JSON.parse(PgQuery.parsePlPgSQLSync(query)); |
{ | ||
"name": "libpg-query", | ||
"version": "15.1.3", | ||
"version": "15.2.0-deparse", | ||
"description": "The real PostgreSQL query parser", | ||
@@ -33,2 +33,3 @@ "homepage": "https://github.com/launchql/libpg-query-node", | ||
"scripts": { | ||
"protogen": "node ./script/protogen.js 15-latest", | ||
"clean": "rimraf build", | ||
@@ -47,3 +48,3 @@ "configure": "node-pre-gyp configure", | ||
"binary:publish": "AWS_PROFILE=supabase-dev node-pre-gyp publish" | ||
}, | ||
}, | ||
"author": "Dan Lynch <pyramation@gmail.com> (http://github.com/pyramation)", | ||
@@ -56,2 +57,3 @@ "license": "LICENSE IN LICENSE", | ||
"devDependencies": { | ||
"@launchql/proto-cli": "1.25.0", | ||
"@yamlize/cli": "^0.8.0", | ||
@@ -66,4 +68,5 @@ "chai": "^3.5.0", | ||
"@emnapi/runtime": "^0.43.1", | ||
"@launchql/protobufjs": "7.2.6", | ||
"@mapbox/node-pre-gyp": "^1.0.8", | ||
"@pgsql/types": "^15.0.0", | ||
"@pgsql/types": "^15.0.1", | ||
"node-addon-api": "^7.0.0", | ||
@@ -70,0 +73,0 @@ "node-gyp": "^10.0.1" |
@@ -21,3 +21,2 @@ # libpg-query | ||
</a> | ||
</p> | ||
@@ -24,0 +23,0 @@ |
import { getDefaultContext } from '@emnapi/runtime'; | ||
import { pg_query } from '../proto.js'; | ||
import PgQueryModule from './libpg-query.js'; | ||
@@ -33,2 +34,12 @@ | ||
export const deparse = awaitInit((parseTree) => { | ||
const msg = pg_query.ParseResult.fromObject(parseTree); | ||
const data = pg_query.ParseResult.encode(msg).finish(); | ||
return new Promise((resolve, reject) => { | ||
PgQuery.deparseAsync(data, (err, result) => { | ||
err ? reject(err) : resolve(result); | ||
}); | ||
}); | ||
}); | ||
export const parsePlPgSQL = awaitInit((query) => { | ||
@@ -35,0 +46,0 @@ return new Promise(async (resolve, reject) => { |
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
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 too big to display
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Network access
Supply chain riskThis module accesses the network.
Found 1 instance in 1 package
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
Found 1 instance in 1 package
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
29416601
29
568
6
7
1
109
1
11
+ Added@launchql/protobufjs@7.2.6
+ Added@launchql/protobufjs@7.2.6(transitive)
+ Added@protobufjs/aspromise@1.1.2(transitive)
+ Added@protobufjs/base64@1.1.2(transitive)
+ Added@protobufjs/codegen@2.0.4(transitive)
+ Added@protobufjs/eventemitter@1.1.0(transitive)
+ Added@protobufjs/fetch@1.1.0(transitive)
+ Added@protobufjs/float@1.0.2(transitive)
+ Added@protobufjs/inquire@1.1.0(transitive)
+ Added@protobufjs/path@1.1.2(transitive)
+ Added@protobufjs/pool@1.1.0(transitive)
+ Added@protobufjs/utf8@1.1.0(transitive)
+ Added@types/node@22.7.6(transitive)
+ Addedlong@5.2.3(transitive)
+ Addedundici-types@6.19.8(transitive)
Updated@pgsql/types@^15.0.1