Socket
Socket
Sign inDemoInstall

@capacitor-community/sqlite

Package Overview
Dependencies
Maintainers
22
Versions
241
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@capacitor-community/sqlite - npm Package Compare versions

Comparing version 2.9.0 to 2.9.1

electron/.DS_Store

7

CHANGELOG.md

@@ -0,1 +1,8 @@

## 2.9.1 (2021-01-14) REFACTOR
### Bug Fixes
- Fix issue#63 by removing encryption for Windows
- update README and CHANGELOG
## 2.9.0 (2021-01-14) REFACTOR

@@ -2,0 +9,0 @@

6

electron/dist/esm/electron/src/electron-utils/utilsFile.d.ts

@@ -6,4 +6,6 @@ export declare class UtilsFile {

Os: any;
AppName: String;
HomeDir: String;
AppName: string;
HomeDir: string;
appPath: string;
osType: string;
constructor();

@@ -10,0 +12,0 @@ /**

@@ -10,2 +10,3 @@ import { __awaiter } from "tslib";

this.HomeDir = '';
this.appPath = null;
this.Path = require('path');

@@ -15,3 +16,11 @@ this.NodeFs = require('fs');

this.HomeDir = this.Os.homedir();
this.AppName = require('../../package.json').name;
const app = require('electron').remote.app;
this.appPath = app.getAppPath();
let sep = '/';
const idx = this.appPath.indexOf('\\');
if (idx != -1)
sep = '\\';
const mypath = this.appPath.substring(0, this.appPath.indexOf("electron") - 1);
this.AppName = mypath.substring(mypath.lastIndexOf(sep) + 1);
this.osType = this.Os.type();
}

@@ -62,3 +71,3 @@ /**

const dbFolder = this.pathDB;
if (this.AppName == null) {
if (this.AppName == null || this.AppName.length === 0) {
let sep = '/';

@@ -65,0 +74,0 @@ const idx = __dirname.indexOf('\\');

import { __awaiter } from "tslib";
//1234567890123456789012345678901234567890123456789012345678901234567890
export class UtilsSQLite {

@@ -4,0 +3,0 @@ constructor() {

@@ -8,2 +8,3 @@ import { WebPlugin } from '@capacitor/core';

private _uJson;
private _osType;
private _versionUpgrades;

@@ -10,0 +11,0 @@ constructor();

@@ -21,2 +21,3 @@ import { __awaiter } from "tslib";

this.RemoteRef = remote;
this._osType = this._uFile.osType;
}

@@ -34,4 +35,4 @@ createConnection(options) {

const version = options.version ? options.version : 1;
const encrypted = options.encrypted ? options.encrypted : false;
const inMode = options.mode ? options.mode : 'no-encryption';
const encrypted = options.encrypted && this._osType === "Darwin" ? options.encrypted : false;
const inMode = options.mode && this._osType === "Darwin" ? options.mode : 'no-encryption';
let upgDict = {};

@@ -38,0 +39,0 @@ const vUpgKeys = Object.keys(this._versionUpgrades);

@@ -6,4 +6,6 @@ export class UtilsFile {

Os: any = null;
AppName: String = '';
HomeDir: String = '';
AppName: string = '';
HomeDir: string = '';
appPath: string = null;
osType: string;

@@ -15,3 +17,13 @@ constructor() {

this.HomeDir = this.Os.homedir();
this.AppName = require('../../package.json').name;
const app = require('electron').remote.app;
this.appPath = app.getAppPath();
let sep: string = '/';
const idx: number = this.appPath.indexOf('\\');
if (idx != -1) sep = '\\';
const mypath = this.appPath.substring(
0,
this.appPath.indexOf('electron') - 1,
);
this.AppName = mypath.substring(mypath.lastIndexOf(sep) + 1);
this.osType = this.Os.type();
}

@@ -62,3 +74,3 @@ /**

const dbFolder: string = this.pathDB;
if (this.AppName == null) {
if (this.AppName == null || this.AppName.length === 0) {
let sep: string = '/';

@@ -65,0 +77,0 @@ const idx: number = __dirname.indexOf('\\');

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

//1234567890123456789012345678901234567890123456789012345678901234567890
export class UtilsSQLite {

@@ -57,3 +56,3 @@ public JSQlite: any;

mDB.run('PRAGMA cipher_compatibility = 4');
mDB.run(`PRAGMA key = '${password}'`, (err: Error) => {
mDB.run(`PRAGMA key = '${password}'`, (err: any) => {
if (err) {

@@ -81,3 +80,3 @@ reject(new Error('SetForeignKey: ' + `${err.message}`));

}
mDB.run(`PRAGMA foreign_keys = '${key}'`, (err: Error) => {
mDB.run(`PRAGMA foreign_keys = '${key}'`, (err: any) => {
if (err) {

@@ -98,3 +97,3 @@ reject(new Error(`SetForeignKey: ${err.message}`));

const SELECT_VERSION: string = 'PRAGMA user_version;';
mDB.get(SELECT_VERSION, [], (err: Error, row: any) => {
mDB.get(SELECT_VERSION, [], (err: any, row: any) => {
// process the row here

@@ -122,3 +121,3 @@ if (err) {

return new Promise(async (resolve, reject) => {
mDB.run(`PRAGMA user_version = ${version}`, (err: Error) => {
mDB.run(`PRAGMA user_version = ${version}`, (err: any) => {
if (err) {

@@ -148,3 +147,3 @@ reject(new Error('setVersion failed: ' + `${err.message}`));

mDB.run(`PRAGMA key = '${password}'`);
mDB.run(`PRAGMA rekey = '${newpassword}'`, (err: Error) => {
mDB.run(`PRAGMA rekey = '${newpassword}'`, (err: any) => {
if (err) {

@@ -195,3 +194,3 @@ mDB.close();

const sql: string = 'ROLLBACK TRANSACTION;';
db.run(sql, (err: Error) => {
db.run(sql, (err: any) => {
if (err) {

@@ -216,3 +215,3 @@ reject(new Error(`${msg}${err.message}`));

const sql: string = 'COMMIT TRANSACTION;';
db.run(sql, (err: Error) => {
db.run(sql, (err: any) => {
if (err) {

@@ -235,3 +234,3 @@ reject(new Error(`${msg}${err.message}`));

db.get(SELECT_CHANGE, [], (err: Error, row: any) => {
db.get(SELECT_CHANGE, [], (err: any, row: any) => {
// process the row here

@@ -260,3 +259,3 @@ if (err) {

let lastId: number = -1;
db.get(SELECT_LAST_ID, [], (err: Error, row: any) => {
db.get(SELECT_LAST_ID, [], (err: any, row: any) => {
// process the row here

@@ -290,3 +289,3 @@ if (err) {

}
mDB.exec(sql, async (err: Error) => {
mDB.exec(sql, async (err: any) => {
if (err) {

@@ -352,3 +351,3 @@ const msg: string = err.message;

let lastId: number = -1;
db.run(statement, values, async (err: Error) => {
db.run(statement, values, async (err: any) => {
if (err) {

@@ -380,3 +379,3 @@ let msg: string = `PrepareRun: run `;

mDB.serialize(() => {
mDB.all(sql, values, (err: Error, rows: any[]) => {
mDB.all(sql, values, (err: any, rows: any[]) => {
if (err) {

@@ -383,0 +382,0 @@ reject(new Error(`QueryAll: ${err.message}`));

@@ -38,2 +38,3 @@ import { WebPlugin } from '@capacitor/core';

private _uJson: UtilsJson = new UtilsJson();
private _osType: string;
private _versionUpgrades: Record<

@@ -51,2 +52,3 @@ string,

this.RemoteRef = remote;
this._osType = this._uFile.osType;
}

@@ -65,4 +67,10 @@ async createConnection(

const version: number = options.version ? options.version : 1;
const encrypted: boolean = options.encrypted ? options.encrypted : false;
const inMode: string = options.mode ? options.mode : 'no-encryption';
const encrypted: boolean =
options.encrypted && this._osType === 'Darwin'
? options.encrypted
: false;
const inMode: string =
options.mode && this._osType === 'Darwin'
? options.mode
: 'no-encryption';
let upgDict: Record<number, capSQLiteVersionUpgrade> = {};

@@ -69,0 +77,0 @@ const vUpgKeys: string[] = Object.keys(this._versionUpgrades);

{
"name": "@capacitor-community/sqlite",
"version": "2.9.0",
"version": "2.9.1",
"description": "Capacitor SQLite Plugin",

@@ -5,0 +5,0 @@ "homepage": "https://github.com/capacitor-community/sqlite",

@@ -39,3 +39,3 @@ <p align="center"><br><img src="https://user-images.githubusercontent.com/236501/85893648-1c92e880-b7a8-11ea-926d-95355b8175c7.png" width="128" height="128" /></p>

- moving to the latest `androidx.sqlite.db.xxx`
- offering encryption for Electron platform by using `@journeyapps/sqlcipher`
- offering encryption for Electron platform by using `@journeyapps/sqlcipher` on MacOs, !!! NOT ON WINDOWS !!!
- cleaning and aligning the code between platforms

@@ -152,23 +152,24 @@ - allowing developers to develop `typeorm` or `spatialite` drivers.

| Name | Android | iOS | Electron | Web |
| :---------------------- | :------ | :-- | :------- | :-- |
| createConnection | ✅ | ✅ | ✅ | ❌ |
| closeConnection | ✅ | ✅ | ✅ | ❌ |
| open (non-encrypted DB) | ✅ | ✅ | ✅ | ❌ |
| open (encrypted DB) | ✅ | ✅ | ✅ | ❌ |
| close | ✅ | ✅ | ✅ | ❌ |
| execute | ✅ | ✅ | ✅ | ❌ |
| executeSet | ✅ | ✅ | ✅ | ❌ |
| run | ✅ | ✅ | ✅ | ❌ |
| query | ✅ | ✅ | ✅ | ❌ |
| deleteDatabase | ✅ | ✅ | ✅ | ❌ |
| importFromJson | ✅ | ✅ | ✅ | ❌ |
| exportToJson | ✅ | ✅ | ✅ | ❌ |
| createSyncTable | ✅ | ✅ | ✅ | ❌ |
| setSyncDate | ✅ | ✅ | ✅ | ❌ |
| getSyncDate | ✅ | ✅ | ✅ | ❌ |
| isJsonValid | ✅ | ✅ | ✅ | ❌ |
| isDBExists | ✅ | ✅ | ✅ | ❌ |
| addUpgradeStatement | ✅ | ✅ | ✅ | ❌ |
| copyFromAssets | ✅ | ✅ | ✅ | ❌ |
| Name | Android | iOS | Electron | Web |
| | | | MacOs | Windows | |
| :---------------------- | :------ | :-- | :-------------- | :-- |
| createConnection | ✅ | ✅ | ✅ | ✅ | ❌ |
| closeConnection | ✅ | ✅ | ✅ | ✅ | ❌ |
| open (non-encrypted DB) | ✅ | ✅ | ✅ | ✅ | ❌ |
| open (encrypted DB) | ✅ | ✅ | ✅ | ❌ | ❌ |
| close | ✅ | ✅ | ✅ | ✅ | ❌ |
| execute | ✅ | ✅ | ✅ | ✅ | ❌ |
| executeSet | ✅ | ✅ | ✅ | ✅ | ❌ |
| run | ✅ | ✅ | ✅ | ✅ | ❌ |
| query | ✅ | ✅ | ✅ | ✅ | ❌ |
| deleteDatabase | ✅ | ✅ | ✅ | ✅ | ❌ |
| importFromJson | ✅ | ✅ | ✅ | ✅ | ❌ |
| exportToJson | ✅ | ✅ | ✅ | ✅ | ❌ |
| createSyncTable | ✅ | ✅ | ✅ | ✅ | ❌ |
| setSyncDate | ✅ | ✅ | ✅ | ✅ | ❌ |
| getSyncDate | ✅ | ✅ | ✅ | ✅ | ❌ |
| isJsonValid | ✅ | ✅ | ✅ | ✅ | ❌ |
| isDBExists | ✅ | ✅ | ✅ | ✅ | ❌ |
| addUpgradeStatement | ✅ | ✅ | ✅ | ✅ | ❌ |
| copyFromAssets | ✅ | ✅ | ✅ | ✅ | ❌ |

@@ -175,0 +176,0 @@ ## Documentation

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

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