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

sql-parser-cst

Package Overview
Dependencies
Maintainers
1
Versions
55
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

sql-parser-cst - npm Package Compare versions

Comparing version 0.1.1 to 0.1.2

lib/dialects/dialects/mysql.d.ts

2

lib/cstTransformer.d.ts

@@ -1,2 +0,2 @@

import { Node } from "../pegjs/sql";
import { Node } from "./sql";
/**

@@ -3,0 +3,0 @@ * A map with a transform function for each Node type, like:

@@ -1,2 +0,2 @@

import { Program } from "../../pegjs/sql";
import { Program } from "../sql";
export declare function format(node: Program): string;

@@ -1,2 +0,2 @@

import { Node } from "../../pegjs/sql";
import { Node } from "../sql";
export declare type Layout = Line | string | Layout[];

@@ -3,0 +3,0 @@ export declare type Line = {

@@ -1,4 +0,4 @@

import { Node, ParserOptions, Program } from "../pegjs/sql";
export { parse as mysql } from "../pegjs/dialects/mysql";
export { parse as sqlite } from "../pegjs/dialects/sqlite";
import { Node, ParserOptions, Program } from "./sql";
export { parse as mysql } from "./dialects/mysql";
export { parse as sqlite } from "./dialects/sqlite";
export { format } from "./format/format";

@@ -5,0 +5,0 @@ export declare type DialectFn = (str: string, options: ParserOptions) => Program;

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.show = exports.parse = exports.format = exports.sqlite = exports.mysql = void 0;
var mysql_1 = require("../pegjs/dialects/mysql");
var mysql_1 = require("./dialects/mysql");
Object.defineProperty(exports, "mysql", { enumerable: true, get: function () { return mysql_1.parse; } });
var sqlite_1 = require("../pegjs/dialects/sqlite");
var sqlite_1 = require("./dialects/sqlite");
Object.defineProperty(exports, "sqlite", { enumerable: true, get: function () { return sqlite_1.parse; } });

@@ -8,0 +8,0 @@ const show_1 = require("./show");

@@ -1,4 +0,4 @@

import { Node } from "../pegjs/sql";
import { Node } from "./sql";
declare type NodeArray = (Node | NodeArray | string | undefined)[];
export declare function show(node: Node | NodeArray | string, joinString?: string): string;
export {};

@@ -96,14 +96,25 @@ "use strict";

]),
constraint_nullable: (node) => show(node.kw),
constraint_auto_increment: (node) => show(node.kw),
constraint_key: (node) => show(node.kw),
constraint_default: (node) => show([node.kw, node.expr]),
constraint_comment: (node) => show([node.kw, node.value]),
// constraints
constraint: (node) => show([node.name, node.constraint, node.deferrable]),
constraint_name: (node) => show([node.constraintKw, node.name]),
table_constraint_primary_key: (node) => show([node.name, node.primaryKeyKw, node.columns]),
table_constraint_foreign_key: (node) => show([node.name, node.foreignKeyKw, node.columns, node.reference]),
foreign_key_reference: (node) => show([node.referencesKw, node.table, node.columns, node.actions]),
reference_action: (node) => show([node.onKw, node.eventKw, node.actionKw]),
table_constraint_unique: (node) => show([node.name, node.uniqueKw, node.columns]),
table_constraint_check: (node) => show([node.name, node.checkKw, node.expr]),
constraint_deferrable: (node) => show([node.deferrableKw, node.initiallyKw]),
constraint_null: (node) => show(node.nullKw),
constraint_not_null: (node) => show(node.notNullKw),
constraint_auto_increment: (node) => show(node.autoIncrementKw),
constraint_default: (node) => show([node.defaultKw, node.expr]),
constraint_comment: (node) => show([node.commentKw, node.value]),
constraint_primary_key: (node) => show([node.primaryKeyKw, node.columns]),
constraint_foreign_key: (node) => show([node.foreignKeyKw, node.columns, node.references]),
references_specification: (node) => show([node.referencesKw, node.table, node.columns, node.options]),
referential_action: (node) => show([node.onKw, node.eventKw, node.actionKw]),
referential_match: (node) => show([node.matchKw, node.typeKw]),
constraint_unique: (node) => show([node.uniqueKw, node.columns]),
constraint_check: (node) => show([node.checkKw, node.expr]),
constraint_index: (node) => show([node.indexTypeKw, node.indexKw, node.columns]),
constraint_generated: (node) => show([node.generatedKw, node.asKw, node.expr, node.storageKw]),
constraint_collate: (node) => show([node.collateKw, node.collation]),
constraint_visible: (node) => show(node.visibleKw),
constraint_column_format: (node) => show([node.columnFormatKw, node.formatKw]),
constraint_storage: (node) => show([node.storageKw, node.typeKw]),
constraint_engine_attribute: (node) => show([node.engineAttributeKw, node.hasEq ? "=" : undefined, node.value]),
// DROP TABLE statement

@@ -110,0 +121,0 @@ drop_table_statement: (node) => show([

@@ -5,3 +5,3 @@ {

"license": "GPL-2.0-or-later",
"version": "0.1.1",
"version": "0.1.2",
"main": "lib/parser.js",

@@ -23,8 +23,9 @@ "types": "lib/parser.d.ts",

"pretty": "prettier --write .",
"generate": "ts-node pegjs/generate.ts",
"generate": "ts-node ./generate.ts",
"watch:generate": "npm-watch",
"build": "yarn generate && tsc",
"test:mysql": "yarn generate mysql && jest --config test/config/mysql.json",
"test:sqlite": "yarn generate sqlite && jest --config test/config/sqlite.json",
"test": "yarn test:mysql && yarn test:sqlite"
"copy": "cp -R src/keywords lib/keywords && cp -R src/dialects lib/dialects && cp src/sql.d.ts lib/sql.d.ts",
"build": "yarn generate && tsc && yarn copy",
"test:mysql": "jest --config test/config/mysql.json",
"test:sqlite": "jest --config test/config/sqlite.json",
"test": "yarn generate && yarn test:mysql && yarn test:sqlite"
},

@@ -31,0 +32,0 @@ "devDependencies": {

@@ -1,2 +0,2 @@

# SQL Parser CST
# SQL Parser CST [![npm version](https://img.shields.io/npm/v/sql-parser-cst)](https://www.npmjs.com/package/sql-parser-cst) ![example workflow](https://github.com/nene/sql-parser-cst/actions/workflows/build.yml/badge.svg)

@@ -3,0 +3,0 @@ SQL Parser which produces a **Concrete Syntax Tree** (CST).

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