Socket
Socket
Sign inDemoInstall

@capacitor-community/sqlite

Package Overview
Dependencies
20
Maintainers
42
Versions
238
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 5.0.5-2 to 5.0.5

29

dist/esm/definitions.d.ts

@@ -495,2 +495,10 @@ /**

readonly?: boolean;
/**
* return mode
* default 'no'
* value 'all'
* value 'one' for Electron platform
* @since 5.0.5-3
*/
returnMode?: string;
}

@@ -522,2 +530,10 @@ export interface capSQLiteRunOptions {

readonly?: boolean;
/**
* return mode
* default 'no'
* value 'all'
* value 'one' for Electron platform
* @since 5.0.5-3
*/
returnMode?: string;
}

@@ -711,2 +727,6 @@ export interface capSQLiteQueryOptions {

lastId?: number;
/**
* values when RETURNING
*/
values?: any[];
}

@@ -1271,3 +1291,3 @@ export interface capSQLiteValues {

*/
run(statement: string, values?: any[], transaction?: boolean): Promise<capSQLiteChanges>;
run(statement: string, values?: any[], transaction?: boolean, returnMode?: string): Promise<capSQLiteChanges>;
/**

@@ -1279,3 +1299,3 @@ * Execute SQLite DB Connection Set

*/
executeSet(set: capSQLiteSet[], transaction?: boolean): Promise<capSQLiteChanges>;
executeSet(set: capSQLiteSet[], transaction?: boolean, returnMode?: string): Promise<capSQLiteChanges>;
/**

@@ -1370,4 +1390,4 @@ * Check if a SQLite DB Connection exists

query(statement: string, values?: any[]): Promise<DBSQLiteValues>;
run(statement: string, values?: any[], transaction?: boolean): Promise<capSQLiteChanges>;
executeSet(set: capSQLiteSet[], transaction?: boolean): Promise<capSQLiteChanges>;
run(statement: string, values?: any[], transaction?: boolean, returnMode?: string): Promise<capSQLiteChanges>;
executeSet(set: capSQLiteSet[], transaction?: boolean, returnMode?: string): Promise<capSQLiteChanges>;
isExists(): Promise<capSQLiteResult>;

@@ -1386,2 +1406,3 @@ isTable(table: string): Promise<capSQLiteResult>;

}[]): Promise<void>;
private reorderRows;
}

61

dist/esm/definitions.js

@@ -545,18 +545,4 @@ //import { Capacitor } from '@capacitor/core';

}
if (res && typeof res.values[0] === 'object') {
if (Object.keys(res.values[0]).includes('ios_columns')) {
const columnList = res.values[0]['ios_columns'];
const iosRes = [];
for (let i = 1; i < res.values.length; i++) {
const rowJson = res.values[i];
const resRowJson = {};
for (const item of columnList) {
resRowJson[item] = rowJson[item];
}
iosRes.push(resRowJson);
}
res = {};
res['values'] = iosRes;
}
}
// reorder rows for ios
res = await this.reorderRows(res);
return Promise.resolve(res);

@@ -568,3 +554,3 @@ }

}
async run(statement, values, transaction = true) {
async run(statement, values, transaction = true, returnMode = 'no') {
let res;

@@ -574,2 +560,5 @@ try {

if (values && values.length > 0) {
const mRetMode = statement.toUpperCase().includes('RETURNING')
? returnMode
: 'no';
res = await this.sqlite.run({

@@ -581,2 +570,3 @@ database: this.dbName,

readonly: false,
returnMode: mRetMode,
});

@@ -586,2 +576,5 @@ // }

else {
const mRetMode = statement.toUpperCase().includes('RETURNING')
? returnMode
: 'no';
res = await this.sqlite.run({

@@ -593,4 +586,7 @@ database: this.dbName,

readonly: false,
returnMode: mRetMode,
});
}
// reorder rows for ios
res.changes = await this.reorderRows(res.changes);
return Promise.resolve(res);

@@ -606,6 +602,7 @@ }

}
async executeSet(set, transaction = true) {
async executeSet(set, transaction = true, returnMode = 'no') {
let res;
try {
if (!this.readonly) {
const res = await this.sqlite.executeSet({
res = await this.sqlite.executeSet({
database: this.dbName,

@@ -615,4 +612,7 @@ set: set,

readonly: false,
returnMode: returnMode,
});
// }
// reorder rows for ios
res.changes = await this.reorderRows(res.changes);
return Promise.resolve(res);

@@ -775,2 +775,5 @@ }

if (task.values && task.values.length > 0) {
const retMode = task.statement.toUpperCase().includes('RETURNING')
? 'all'
: 'no';
const ret = await this.sqlite.run({

@@ -782,2 +785,3 @@ database: this.dbName,

readonly: false,
returnMode: retMode,
});

@@ -829,3 +833,22 @@ if (ret.changes.lastId === -1) {

}
async reorderRows(res) {
const retRes = res;
if (res?.values && typeof res.values[0] === 'object') {
if (Object.keys(res.values[0]).includes('ios_columns')) {
const columnList = res.values[0]['ios_columns'];
const iosRes = [];
for (let i = 1; i < res.values.length; i++) {
const rowJson = res.values[i];
const resRowJson = {};
for (const item of columnList) {
resRowJson[item] = rowJson[item];
}
iosRes.push(resRowJson);
}
retRes['values'] = iosRes;
}
}
return Promise.resolve(retRes);
}
}
//# sourceMappingURL=definitions.js.map

@@ -551,18 +551,4 @@ 'use strict';

}
if (res && typeof res.values[0] === 'object') {
if (Object.keys(res.values[0]).includes('ios_columns')) {
const columnList = res.values[0]['ios_columns'];
const iosRes = [];
for (let i = 1; i < res.values.length; i++) {
const rowJson = res.values[i];
const resRowJson = {};
for (const item of columnList) {
resRowJson[item] = rowJson[item];
}
iosRes.push(resRowJson);
}
res = {};
res['values'] = iosRes;
}
}
// reorder rows for ios
res = await this.reorderRows(res);
return Promise.resolve(res);

@@ -574,3 +560,3 @@ }

}
async run(statement, values, transaction = true) {
async run(statement, values, transaction = true, returnMode = 'no') {
let res;

@@ -580,2 +566,5 @@ try {

if (values && values.length > 0) {
const mRetMode = statement.toUpperCase().includes('RETURNING')
? returnMode
: 'no';
res = await this.sqlite.run({

@@ -587,2 +576,3 @@ database: this.dbName,

readonly: false,
returnMode: mRetMode,
});

@@ -592,2 +582,5 @@ // }

else {
const mRetMode = statement.toUpperCase().includes('RETURNING')
? returnMode
: 'no';
res = await this.sqlite.run({

@@ -599,4 +592,7 @@ database: this.dbName,

readonly: false,
returnMode: mRetMode,
});
}
// reorder rows for ios
res.changes = await this.reorderRows(res.changes);
return Promise.resolve(res);

@@ -612,6 +608,7 @@ }

}
async executeSet(set, transaction = true) {
async executeSet(set, transaction = true, returnMode = 'no') {
let res;
try {
if (!this.readonly) {
const res = await this.sqlite.executeSet({
res = await this.sqlite.executeSet({
database: this.dbName,

@@ -621,4 +618,7 @@ set: set,

readonly: false,
returnMode: returnMode,
});
// }
// reorder rows for ios
res.changes = await this.reorderRows(res.changes);
return Promise.resolve(res);

@@ -781,2 +781,5 @@ }

if (task.values && task.values.length > 0) {
const retMode = task.statement.toUpperCase().includes('RETURNING')
? 'all'
: 'no';
const ret = await this.sqlite.run({

@@ -788,2 +791,3 @@ database: this.dbName,

readonly: false,
returnMode: retMode,
});

@@ -835,2 +839,21 @@ if (ret.changes.lastId === -1) {

}
async reorderRows(res) {
const retRes = res;
if (res?.values && typeof res.values[0] === 'object') {
if (Object.keys(res.values[0]).includes('ios_columns')) {
const columnList = res.values[0]['ios_columns'];
const iosRes = [];
for (let i = 1; i < res.values.length; i++) {
const rowJson = res.values[i];
const resRowJson = {};
for (const item of columnList) {
resRowJson[item] = rowJson[item];
}
iosRes.push(resRowJson);
}
retRes['values'] = iosRes;
}
}
return Promise.resolve(retRes);
}
}

@@ -837,0 +860,0 @@

@@ -548,18 +548,4 @@ var capacitorCapacitorSQLite = (function (exports, core) {

}
if (res && typeof res.values[0] === 'object') {
if (Object.keys(res.values[0]).includes('ios_columns')) {
const columnList = res.values[0]['ios_columns'];
const iosRes = [];
for (let i = 1; i < res.values.length; i++) {
const rowJson = res.values[i];
const resRowJson = {};
for (const item of columnList) {
resRowJson[item] = rowJson[item];
}
iosRes.push(resRowJson);
}
res = {};
res['values'] = iosRes;
}
}
// reorder rows for ios
res = await this.reorderRows(res);
return Promise.resolve(res);

@@ -571,3 +557,3 @@ }

}
async run(statement, values, transaction = true) {
async run(statement, values, transaction = true, returnMode = 'no') {
let res;

@@ -577,2 +563,5 @@ try {

if (values && values.length > 0) {
const mRetMode = statement.toUpperCase().includes('RETURNING')
? returnMode
: 'no';
res = await this.sqlite.run({

@@ -584,2 +573,3 @@ database: this.dbName,

readonly: false,
returnMode: mRetMode,
});

@@ -589,2 +579,5 @@ // }

else {
const mRetMode = statement.toUpperCase().includes('RETURNING')
? returnMode
: 'no';
res = await this.sqlite.run({

@@ -596,4 +589,7 @@ database: this.dbName,

readonly: false,
returnMode: mRetMode,
});
}
// reorder rows for ios
res.changes = await this.reorderRows(res.changes);
return Promise.resolve(res);

@@ -609,6 +605,7 @@ }

}
async executeSet(set, transaction = true) {
async executeSet(set, transaction = true, returnMode = 'no') {
let res;
try {
if (!this.readonly) {
const res = await this.sqlite.executeSet({
res = await this.sqlite.executeSet({
database: this.dbName,

@@ -618,4 +615,7 @@ set: set,

readonly: false,
returnMode: returnMode,
});
// }
// reorder rows for ios
res.changes = await this.reorderRows(res.changes);
return Promise.resolve(res);

@@ -778,2 +778,5 @@ }

if (task.values && task.values.length > 0) {
const retMode = task.statement.toUpperCase().includes('RETURNING')
? 'all'
: 'no';
const ret = await this.sqlite.run({

@@ -785,2 +788,3 @@ database: this.dbName,

readonly: false,
returnMode: retMode,
});

@@ -832,2 +836,21 @@ if (ret.changes.lastId === -1) {

}
async reorderRows(res) {
const retRes = res;
if (res?.values && typeof res.values[0] === 'object') {
if (Object.keys(res.values[0]).includes('ios_columns')) {
const columnList = res.values[0]['ios_columns'];
const iosRes = [];
for (let i = 1; i < res.values.length; i++) {
const rowJson = res.values[i];
const resRowJson = {};
for (const item of columnList) {
resRowJson[item] = rowJson[item];
}
iosRes.push(resRowJson);
}
retRes['values'] = iosRes;
}
}
return Promise.resolve(retRes);
}
}

@@ -834,0 +857,0 @@

{
"name": "@capacitor-community/sqlite",
"version": "5.0.5-2",
"version": "5.0.5",
"description": "Community plugin for native & electron SQLite databases",

@@ -98,4 +98,4 @@ "main": "dist/plugin.cjs.js",

"dependencies": {
"jeep-sqlite": "^2.3.6"
"jeep-sqlite": "^2.3.8"
}
}

@@ -509,2 +509,10 @@ //import { Capacitor } from '@capacitor/core';

readonly?: boolean;
/**
* return mode
* default 'no'
* value 'all'
* value 'one' for Electron platform
* @since 5.0.5-3
*/
returnMode?: string;
}

@@ -536,2 +544,10 @@ export interface capSQLiteRunOptions {

readonly?: boolean;
/**
* return mode
* default 'no'
* value 'all'
* value 'one' for Electron platform
* @since 5.0.5-3
*/
returnMode?: string;
}

@@ -726,2 +742,6 @@ export interface capSQLiteQueryOptions {

lastId?: number;
/**
* values when RETURNING
*/
values?: any[];
}

@@ -1578,3 +1598,3 @@ export interface capSQLiteValues {

values.sort();
const ret = {values: values};
const ret = { values: values };
return Promise.resolve(ret);

@@ -1712,2 +1732,3 @@ } catch (err) {

transaction?: boolean,
returnMode?: string,
): Promise<capSQLiteChanges>;

@@ -1723,2 +1744,3 @@ /**

transaction?: boolean,
returnMode?: string,
): Promise<capSQLiteChanges>;

@@ -1907,18 +1929,5 @@ /**

}
if (res && typeof res.values[0] === 'object') {
if (Object.keys(res.values[0]).includes('ios_columns')) {
const columnList: string[] = res.values[0]['ios_columns'];
const iosRes: any[] = [];
for (let i = 1; i < res.values.length; i++) {
const rowJson: any = res.values[i];
const resRowJson: any = {};
for (const item of columnList) {
resRowJson[item] = rowJson[item];
}
iosRes.push(resRowJson);
}
res = {};
res['values'] = iosRes;
}
}
// reorder rows for ios
res = await this.reorderRows(res);
return Promise.resolve(res);

@@ -1933,2 +1942,3 @@ } catch (err) {

transaction = true,
returnMode = 'no',
): Promise<capSQLiteChanges> {

@@ -1939,2 +1949,5 @@ let res: any;

if (values && values.length > 0) {
const mRetMode = statement.toUpperCase().includes('RETURNING')
? returnMode
: 'no';
res = await this.sqlite.run({

@@ -1946,5 +1959,9 @@ database: this.dbName,

readonly: false,
returnMode: mRetMode,
});
// }
} else {
const mRetMode = statement.toUpperCase().includes('RETURNING')
? returnMode
: 'no';
res = await this.sqlite.run({

@@ -1956,4 +1973,7 @@ database: this.dbName,

readonly: false,
returnMode: mRetMode,
});
}
// reorder rows for ios
res.changes = await this.reorderRows(res.changes);
return Promise.resolve(res);

@@ -1970,6 +1990,8 @@ } else {

transaction = true,
returnMode = 'no',
): Promise<capSQLiteChanges> {
let res: any;
try {
if (!this.readonly) {
const res: any = await this.sqlite.executeSet({
res = await this.sqlite.executeSet({
database: this.dbName,

@@ -1979,4 +2001,7 @@ set: set,

readonly: false,
returnMode: returnMode,
});
// }
// reorder rows for ios
res.changes = await this.reorderRows(res.changes);
return Promise.resolve(res);

@@ -2127,2 +2152,5 @@ } else {

if (task.values && task.values.length > 0) {
const retMode = task.statement.toUpperCase().includes('RETURNING')
? 'all'
: 'no';
const ret = await this.sqlite.run({

@@ -2134,2 +2162,3 @@ database: this.dbName,

readonly: false,
returnMode: retMode,
});

@@ -2178,2 +2207,22 @@ if (ret.changes.lastId === -1) {

}
private async reorderRows(res: any): Promise<any> {
const retRes: any = res;
if (res?.values && typeof res.values[0] === 'object') {
if (Object.keys(res.values[0]).includes('ios_columns')) {
const columnList: string[] = res.values[0]['ios_columns'];
const iosRes: any[] = [];
for (let i = 1; i < res.values.length; i++) {
const rowJson: any = res.values[i];
const resRowJson: any = {};
for (const item of columnList) {
resRowJson[item] = rowJson[item];
}
iosRes.push(resRowJson);
}
retRes['values'] = iosRes;
}
}
return Promise.resolve(retRes);
}
}

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

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc