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

@saltcorn/sqlite

Package Overview
Dependencies
Maintainers
1
Versions
351
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@saltcorn/sqlite - npm Package Compare versions

Comparing version 0.6.2-beta.1 to 0.6.2-beta.2

42

dist/sqlite.js

@@ -12,3 +12,3 @@ "use strict";

const promises_1 = require("fs/promises");
const { sqlsanitize, mkWhere, mkSelectOptions } = require("@saltcorn/db-common/internal");
const internal_1 = require("@saltcorn/db-common/internal");
let sqliteDatabase = null;

@@ -132,4 +132,4 @@ let connectObj = null;

const select = async (tbl, whereObj, selectopts = {}) => {
const { where, values } = mkWhere(whereObj, true);
const sql = `SELECT * FROM "${sqlsanitize(tbl)}" ${where} ${mkSelectOptions(selectopts)}`;
const { where, values } = (0, internal_1.mkWhere)(whereObj, true);
const sql = `SELECT * FROM "${(0, internal_1.sqlsanitize)(tbl)}" ${where} ${(0, internal_1.mkSelectOptions)(selectopts)}`;
const tq = await query(sql, values);

@@ -154,3 +154,3 @@ return tq.rows;

*/
const mkVal = ([k, v]) => ((0, exports.reprAsJson)(v) ? JSON.stringify(v) : v);
const mkVal = ([k, v]) => (0, exports.reprAsJson)(v) ? JSON.stringify(v) : v;
exports.mkVal = mkVal;

@@ -167,6 +167,6 @@ /**

const kvs = Object.entries(obj);
const assigns = kvs.map(([k, v], ix) => `"${sqlsanitize(k)}"=?`).join();
const assigns = kvs.map(([k, v], ix) => `"${(0, internal_1.sqlsanitize)(k)}"=?`).join();
let valList = kvs.map(exports.mkVal);
valList.push(id);
const q = `update "${sqlsanitize(tbl)}" set ${assigns} where id=?`;
const q = `update "${(0, internal_1.sqlsanitize)(tbl)}" set ${assigns} where id=?`;
await query(q, valList);

@@ -183,4 +183,4 @@ };

const deleteWhere = async (tbl, whereObj) => {
const { where, values } = mkWhere(whereObj, true);
const sql = `delete FROM "${sqlsanitize(tbl)}" ${where}`;
const { where, values } = (0, internal_1.mkWhere)(whereObj, true);
const sql = `delete FROM "${(0, internal_1.sqlsanitize)(tbl)}" ${where}`;
const tq = await query(sql, values);

@@ -199,6 +199,8 @@ };

const kvs = Object.entries(obj);
const fnameList = kvs.map(([k, v]) => `"${sqlsanitize(k)}"`).join();
const fnameList = kvs
.map(([k, v]) => `"${(0, internal_1.sqlsanitize)(k)}"`)
.join();
const valPosList = kvs
.map(([k, v], ix) => v && v.next_version_by_id
? `coalesce((select max(_version) from "${sqlsanitize(tbl)}" where id=${+v.next_version_by_id}), 0)+1`
? `coalesce((select max(_version) from "${(0, internal_1.sqlsanitize)(tbl)}" where id=${+v.next_version_by_id}), 0)+1`
: (0, exports.reprAsJson)(v)

@@ -211,3 +213,3 @@ ? "json(?)"

.map(exports.mkVal);
const sql = `insert into "${sqlsanitize(tbl)}"(${fnameList}) values(${valPosList})`;
const sql = `insert into "${(0, internal_1.sqlsanitize)(tbl)}"(${fnameList}) values(${valPosList})`;
await query(sql, valList);

@@ -232,3 +234,3 @@ if (opts.noid)

if (rows.length === 0) {
const w = mkWhere(where, true);
const w = (0, internal_1.mkWhere)(where, true);
throw new Error(`no ${tbl} ${w.where} are ${w.values}`);

@@ -263,4 +265,4 @@ }

const count = async (tbl, whereObj) => {
const { where, values } = mkWhere(whereObj, true);
const sql = `SELECT COUNT(*) FROM "${sqlsanitize(tbl)}" ${where}`;
const { where, values } = (0, internal_1.mkWhere)(whereObj, true);
const sql = `SELECT COUNT(*) FROM "${(0, internal_1.sqlsanitize)(tbl)}" ${where}`;
const tq = await query(sql, values);

@@ -305,6 +307,6 @@ return parseInt(tq.rows[0]["COUNT(*)"]);

const add_unique_constraint = async (table_name, field_names) => {
const sql = `create unique index ${sqlsanitize(table_name)}_${field_names
.map((f) => sqlsanitize(f))
.join("_")}_unique on "${sqlsanitize(table_name)}"(${field_names
.map((f) => `"${sqlsanitize(f)}"`)
const sql = `create unique index ${(0, internal_1.sqlsanitize)(table_name)}_${field_names
.map((f) => (0, internal_1.sqlsanitize)(f))
.join("_")}_unique on "${(0, internal_1.sqlsanitize)(table_name)}"(${field_names
.map((f) => `"${(0, internal_1.sqlsanitize)(f)}"`)
.join(",")});`;

@@ -323,4 +325,4 @@ sql_log(sql);

const drop_unique_constraint = async (table_name, field_names) => {
const sql = `drop index ${sqlsanitize(table_name)}_${field_names
.map((f) => sqlsanitize(f))
const sql = `drop index ${(0, internal_1.sqlsanitize)(table_name)}_${field_names
.map((f) => (0, internal_1.sqlsanitize)(f))
.join("_")}_unique;`;

@@ -327,0 +329,0 @@ sql_log(sql);

{
"name": "@saltcorn/sqlite",
"version": "0.6.2-beta.1",
"version": "0.6.2-beta.2",
"description": "Sqlite structures for Saltcorn, open-source no-code platform",

@@ -28,3 +28,3 @@ "homepage": "https://saltcorn.com",

"dependencies": {
"@saltcorn/db-common": "0.6.2-beta.1",
"@saltcorn/db-common": "0.6.2-beta.2",
"sqlite3": "^5.0.2"

@@ -31,0 +31,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

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