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

sqlite-replication

Package Overview
Dependencies
Maintainers
1
Versions
25
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

sqlite-replication - npm Package Compare versions

Comparing version 0.0.25-b to 0.0.26-b

3

dist/SQLHelpers.d.ts
export declare class SQLHelpers {
static safeValue(value: any): any;
static getSafeSQLMapping(document: any, option?: {
excludeUndefinedProperties: boolean;
}): string;
static getUpsertStatement(collectionName: string, document: any, option?: {

@@ -7,0 +4,0 @@ excludeUndefinedProperties: boolean;

@@ -22,9 +22,2 @@ export class SQLHelpers {

}
static getSafeSQLMapping(document, option = { excludeUndefinedProperties: true }) {
if (!document)
throw Error('undefined document');
const keys = Object.keys(document).filter((key) => typeof document[key] !== 'undefined' || !option.excludeUndefinedProperties);
const values = keys.map((key) => SQLHelpers.safeValue(document[key])).join();
return `(${keys.map((key) => `"${key}"`).join()}) values (${values})`;
}
static getUpsertStatement(collectionName, document, option = { excludeUndefinedProperties: true }) {

@@ -31,0 +24,0 @@ if (!document)

2

package.json
{
"name": "sqlite-replication",
"version": "0.0.25b",
"version": "0.0.26b",
"description": "A Typescript module to replicate SQLite DB with server.",

@@ -5,0 +5,0 @@ "scripts": {

@@ -48,9 +48,2 @@ import { SQLHelpers } from './SQLHelpers';

});
describe('getSafeSQLMapping', () => {
it('should build the SQL mapping for insert/update query', async () => {
expect(
SQLHelpers.getSafeSQLMapping({ prop1: 'value', prop2: [1, 2, 3], prop3: "Hi all' WHERE true" }),
).toEqual(`("prop1","prop2","prop3") values ('value','[1,2,3]','Hi all'' WHERE true')`);
});
});
describe('upsert', () => {

@@ -57,0 +50,0 @@ it('should generate SQL from random object', () => {

@@ -17,13 +17,2 @@ export class SQLHelpers {

}
static getSafeSQLMapping(
document: any,
option: { excludeUndefinedProperties: boolean } = { excludeUndefinedProperties: true },
) {
if (!document) throw Error('undefined document');
const keys = Object.keys(document).filter(
(key) => typeof document[key] !== 'undefined' || !option.excludeUndefinedProperties,
);
const values = keys.map((key) => SQLHelpers.safeValue(document[key])).join();
return `(${keys.map((key) => `"${key}"`).join()}) values (${values})`;
}

@@ -30,0 +19,0 @@ static getUpsertStatement(

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