@capacitor-community/sqlite
Advanced tools
Comparing version 3.1.3-3 to 3.1.3-web.1
@@ -0,1 +1,7 @@ | ||
## 3.1.3-web.1 (2021-07-29) | ||
### Added Features | ||
- start web implementation based on `jeep-sqlite` Stencil component | ||
## 3.1.3-3 (2021-07-28) | ||
@@ -2,0 +8,0 @@ |
import { WebPlugin } from '@capacitor/core'; | ||
import type { CapacitorSQLitePlugin, capEchoOptions, capSQLiteOptions, capSQLiteExecuteOptions, capSQLiteSetOptions, capSQLiteRunOptions, capSQLiteQueryOptions, capSQLiteImportOptions, capSQLiteExportOptions, capSQLiteSyncDateOptions, capSQLiteUpgradeOptions, capSQLiteTableOptions, capSQLitePathOptions, capEchoResult, capSQLiteResult, capSQLiteChanges, capSQLiteValues, capSQLiteJson, capSQLiteSyncDate, capAllConnectionsOptions, capSetSecretOptions, capChangeSecretOptions } from './definitions'; | ||
export declare class CapacitorSQLiteWeb extends WebPlugin implements CapacitorSQLitePlugin { | ||
private jeepSqlite; | ||
private isStoreOpen; | ||
constructor(); | ||
echo(options: capEchoOptions): Promise<capEchoResult>; | ||
@@ -5,0 +8,0 @@ isSecretStored(): Promise<capSQLiteResult>; |
import { WebPlugin } from '@capacitor/core'; | ||
export class CapacitorSQLiteWeb extends WebPlugin { | ||
constructor() { | ||
super(); | ||
this.jeepSqlite = null; | ||
this.isStoreOpen = false; | ||
this.jeepSqlite = document.querySelector('jeep-sqlite'); | ||
} | ||
async echo(options) { | ||
console.log('ECHO in Web plugin', options); | ||
return options; | ||
if (this.jeepSqlite != null) { | ||
console.log('ECHO in Web plugin', options); | ||
return options; | ||
} | ||
else { | ||
throw this.unimplemented('Not implemented on web.'); | ||
} | ||
} | ||
@@ -20,12 +31,56 @@ async isSecretStored() { | ||
async createConnection(options) { | ||
console.log('createConnection', options); | ||
throw this.unimplemented('Not implemented on web.'); | ||
if (this.jeepSqlite != null) { | ||
if (!this.isStoreOpen) | ||
this.isStoreOpen = await this.jeepSqlite.isStoreOpen(); | ||
if (this.isStoreOpen) { | ||
try { | ||
await this.jeepSqlite.createConnection(options); | ||
} | ||
catch (err) { | ||
return Promise.reject(`${err}`); | ||
} | ||
} | ||
else { | ||
return Promise.reject(`Store "jeepSqliteStore" failed to open`); | ||
} | ||
} | ||
else { | ||
throw this.unimplemented('Not implemented on web.'); | ||
} | ||
} | ||
async open(options) { | ||
console.log('open', options); | ||
throw this.unimplemented('Not implemented on web.'); | ||
if (this.jeepSqlite != null) { | ||
if (this.isStoreOpen) { | ||
try { | ||
await this.jeepSqlite.open(options); | ||
} | ||
catch (err) { | ||
return Promise.reject(`${err}`); | ||
} | ||
} | ||
else { | ||
return Promise.reject(`Store "jeepSqliteStore" failed to open`); | ||
} | ||
} | ||
else { | ||
throw this.unimplemented('Not implemented on web.'); | ||
} | ||
} | ||
async closeConnection(options) { | ||
console.log('closeConnection', options); | ||
throw this.unimplemented('Not implemented on web.'); | ||
if (this.jeepSqlite != null) { | ||
if (this.isStoreOpen) { | ||
try { | ||
await this.jeepSqlite.closeConnection(options); | ||
} | ||
catch (err) { | ||
return Promise.reject(`${err}`); | ||
} | ||
} | ||
else { | ||
return Promise.reject(`Store "jeepSqliteStore" failed to open`); | ||
} | ||
} | ||
else { | ||
throw this.unimplemented('Not implemented on web.'); | ||
} | ||
} | ||
@@ -37,8 +92,37 @@ async checkConnectionsConsistency(options) { | ||
async close(options) { | ||
console.log('close', options); | ||
throw this.unimplemented('Not implemented on web.'); | ||
if (this.jeepSqlite != null) { | ||
if (this.isStoreOpen) { | ||
try { | ||
await this.jeepSqlite.close(options); | ||
} | ||
catch (err) { | ||
return Promise.reject(`${err}`); | ||
} | ||
} | ||
else { | ||
return Promise.reject(`Store "jeepSqliteStore" failed to open`); | ||
} | ||
} | ||
else { | ||
throw this.unimplemented('Not implemented on web.'); | ||
} | ||
} | ||
async execute(options) { | ||
console.log('execute', options); | ||
throw this.unimplemented('Not implemented on web.'); | ||
if (this.jeepSqlite != null) { | ||
if (this.isStoreOpen) { | ||
try { | ||
const ret = await this.jeepSqlite.execute(options); | ||
return Promise.resolve(ret); | ||
} | ||
catch (err) { | ||
return Promise.reject(`${err}`); | ||
} | ||
} | ||
else { | ||
return Promise.reject(`Store "jeepSqliteStore" failed to open`); | ||
} | ||
} | ||
else { | ||
throw this.unimplemented('Not implemented on web.'); | ||
} | ||
} | ||
@@ -50,16 +134,76 @@ async executeSet(options) { | ||
async run(options) { | ||
console.log('run', options); | ||
throw this.unimplemented('Not implemented on web.'); | ||
if (this.jeepSqlite != null) { | ||
if (this.isStoreOpen) { | ||
try { | ||
const ret = await this.jeepSqlite.run(options); | ||
return Promise.resolve(ret); | ||
} | ||
catch (err) { | ||
return Promise.reject(`${err}`); | ||
} | ||
} | ||
else { | ||
return Promise.reject(`Store "jeepSqliteStore" failed to open`); | ||
} | ||
} | ||
else { | ||
throw this.unimplemented('Not implemented on web.'); | ||
} | ||
} | ||
async query(options) { | ||
console.log('query', options); | ||
throw this.unimplemented('Not implemented on web.'); | ||
if (this.jeepSqlite != null) { | ||
if (this.isStoreOpen) { | ||
try { | ||
const ret = await this.jeepSqlite.query(options); | ||
return Promise.resolve(ret); | ||
} | ||
catch (err) { | ||
return Promise.reject(`${err}`); | ||
} | ||
} | ||
else { | ||
return Promise.reject(`Store "jeepSqliteStore" failed to open`); | ||
} | ||
} | ||
else { | ||
throw this.unimplemented('Not implemented on web.'); | ||
} | ||
} | ||
async isDBExists(options) { | ||
console.log('in Web isDBExists', options); | ||
throw this.unimplemented('Not implemented on web.'); | ||
if (this.jeepSqlite != null) { | ||
if (this.isStoreOpen) { | ||
try { | ||
const ret = await this.jeepSqlite.isDBExists(options); | ||
return Promise.resolve(ret); | ||
} | ||
catch (err) { | ||
return Promise.reject(`${err}`); | ||
} | ||
} | ||
else { | ||
return Promise.reject(`Store "jeepSqliteStore" failed to open`); | ||
} | ||
} | ||
else { | ||
throw this.unimplemented('Not implemented on web.'); | ||
} | ||
} | ||
async isDBOpen(options) { | ||
console.log('in Web isDBOpen', options); | ||
throw this.unimplemented('Not implemented on web.'); | ||
if (this.jeepSqlite != null) { | ||
if (this.isStoreOpen) { | ||
try { | ||
const ret = await this.jeepSqlite.isDBOpen(options); | ||
return Promise.resolve(ret); | ||
} | ||
catch (err) { | ||
return Promise.reject(`${err}`); | ||
} | ||
} | ||
else { | ||
return Promise.reject(`Store "jeepSqliteStore" failed to open`); | ||
} | ||
} | ||
else { | ||
throw this.unimplemented('Not implemented on web.'); | ||
} | ||
} | ||
@@ -75,4 +219,18 @@ async isDatabase(options) { | ||
async deleteDatabase(options) { | ||
console.log('deleteDatabase', options); | ||
throw this.unimplemented('Not implemented on web.'); | ||
if (this.jeepSqlite != null) { | ||
if (this.isStoreOpen) { | ||
try { | ||
await this.jeepSqlite.deleteDatabase(options); | ||
} | ||
catch (err) { | ||
return Promise.reject(`${err}`); | ||
} | ||
} | ||
else { | ||
return Promise.reject(`Store "jeepSqliteStore" failed to open`); | ||
} | ||
} | ||
else { | ||
throw this.unimplemented('Not implemented on web.'); | ||
} | ||
} | ||
@@ -79,0 +237,0 @@ async isJsonValid(options) { |
@@ -476,5 +476,16 @@ 'use strict'; | ||
class CapacitorSQLiteWeb extends core.WebPlugin { | ||
constructor() { | ||
super(); | ||
this.jeepSqlite = null; | ||
this.isStoreOpen = false; | ||
this.jeepSqlite = document.querySelector('jeep-sqlite'); | ||
} | ||
async echo(options) { | ||
console.log('ECHO in Web plugin', options); | ||
return options; | ||
if (this.jeepSqlite != null) { | ||
console.log('ECHO in Web plugin', options); | ||
return options; | ||
} | ||
else { | ||
throw this.unimplemented('Not implemented on web.'); | ||
} | ||
} | ||
@@ -494,12 +505,56 @@ async isSecretStored() { | ||
async createConnection(options) { | ||
console.log('createConnection', options); | ||
throw this.unimplemented('Not implemented on web.'); | ||
if (this.jeepSqlite != null) { | ||
if (!this.isStoreOpen) | ||
this.isStoreOpen = await this.jeepSqlite.isStoreOpen(); | ||
if (this.isStoreOpen) { | ||
try { | ||
await this.jeepSqlite.createConnection(options); | ||
} | ||
catch (err) { | ||
return Promise.reject(`${err}`); | ||
} | ||
} | ||
else { | ||
return Promise.reject(`Store "jeepSqliteStore" failed to open`); | ||
} | ||
} | ||
else { | ||
throw this.unimplemented('Not implemented on web.'); | ||
} | ||
} | ||
async open(options) { | ||
console.log('open', options); | ||
throw this.unimplemented('Not implemented on web.'); | ||
if (this.jeepSqlite != null) { | ||
if (this.isStoreOpen) { | ||
try { | ||
await this.jeepSqlite.open(options); | ||
} | ||
catch (err) { | ||
return Promise.reject(`${err}`); | ||
} | ||
} | ||
else { | ||
return Promise.reject(`Store "jeepSqliteStore" failed to open`); | ||
} | ||
} | ||
else { | ||
throw this.unimplemented('Not implemented on web.'); | ||
} | ||
} | ||
async closeConnection(options) { | ||
console.log('closeConnection', options); | ||
throw this.unimplemented('Not implemented on web.'); | ||
if (this.jeepSqlite != null) { | ||
if (this.isStoreOpen) { | ||
try { | ||
await this.jeepSqlite.closeConnection(options); | ||
} | ||
catch (err) { | ||
return Promise.reject(`${err}`); | ||
} | ||
} | ||
else { | ||
return Promise.reject(`Store "jeepSqliteStore" failed to open`); | ||
} | ||
} | ||
else { | ||
throw this.unimplemented('Not implemented on web.'); | ||
} | ||
} | ||
@@ -511,8 +566,37 @@ async checkConnectionsConsistency(options) { | ||
async close(options) { | ||
console.log('close', options); | ||
throw this.unimplemented('Not implemented on web.'); | ||
if (this.jeepSqlite != null) { | ||
if (this.isStoreOpen) { | ||
try { | ||
await this.jeepSqlite.close(options); | ||
} | ||
catch (err) { | ||
return Promise.reject(`${err}`); | ||
} | ||
} | ||
else { | ||
return Promise.reject(`Store "jeepSqliteStore" failed to open`); | ||
} | ||
} | ||
else { | ||
throw this.unimplemented('Not implemented on web.'); | ||
} | ||
} | ||
async execute(options) { | ||
console.log('execute', options); | ||
throw this.unimplemented('Not implemented on web.'); | ||
if (this.jeepSqlite != null) { | ||
if (this.isStoreOpen) { | ||
try { | ||
const ret = await this.jeepSqlite.execute(options); | ||
return Promise.resolve(ret); | ||
} | ||
catch (err) { | ||
return Promise.reject(`${err}`); | ||
} | ||
} | ||
else { | ||
return Promise.reject(`Store "jeepSqliteStore" failed to open`); | ||
} | ||
} | ||
else { | ||
throw this.unimplemented('Not implemented on web.'); | ||
} | ||
} | ||
@@ -524,16 +608,76 @@ async executeSet(options) { | ||
async run(options) { | ||
console.log('run', options); | ||
throw this.unimplemented('Not implemented on web.'); | ||
if (this.jeepSqlite != null) { | ||
if (this.isStoreOpen) { | ||
try { | ||
const ret = await this.jeepSqlite.run(options); | ||
return Promise.resolve(ret); | ||
} | ||
catch (err) { | ||
return Promise.reject(`${err}`); | ||
} | ||
} | ||
else { | ||
return Promise.reject(`Store "jeepSqliteStore" failed to open`); | ||
} | ||
} | ||
else { | ||
throw this.unimplemented('Not implemented on web.'); | ||
} | ||
} | ||
async query(options) { | ||
console.log('query', options); | ||
throw this.unimplemented('Not implemented on web.'); | ||
if (this.jeepSqlite != null) { | ||
if (this.isStoreOpen) { | ||
try { | ||
const ret = await this.jeepSqlite.query(options); | ||
return Promise.resolve(ret); | ||
} | ||
catch (err) { | ||
return Promise.reject(`${err}`); | ||
} | ||
} | ||
else { | ||
return Promise.reject(`Store "jeepSqliteStore" failed to open`); | ||
} | ||
} | ||
else { | ||
throw this.unimplemented('Not implemented on web.'); | ||
} | ||
} | ||
async isDBExists(options) { | ||
console.log('in Web isDBExists', options); | ||
throw this.unimplemented('Not implemented on web.'); | ||
if (this.jeepSqlite != null) { | ||
if (this.isStoreOpen) { | ||
try { | ||
const ret = await this.jeepSqlite.isDBExists(options); | ||
return Promise.resolve(ret); | ||
} | ||
catch (err) { | ||
return Promise.reject(`${err}`); | ||
} | ||
} | ||
else { | ||
return Promise.reject(`Store "jeepSqliteStore" failed to open`); | ||
} | ||
} | ||
else { | ||
throw this.unimplemented('Not implemented on web.'); | ||
} | ||
} | ||
async isDBOpen(options) { | ||
console.log('in Web isDBOpen', options); | ||
throw this.unimplemented('Not implemented on web.'); | ||
if (this.jeepSqlite != null) { | ||
if (this.isStoreOpen) { | ||
try { | ||
const ret = await this.jeepSqlite.isDBOpen(options); | ||
return Promise.resolve(ret); | ||
} | ||
catch (err) { | ||
return Promise.reject(`${err}`); | ||
} | ||
} | ||
else { | ||
return Promise.reject(`Store "jeepSqliteStore" failed to open`); | ||
} | ||
} | ||
else { | ||
throw this.unimplemented('Not implemented on web.'); | ||
} | ||
} | ||
@@ -549,4 +693,18 @@ async isDatabase(options) { | ||
async deleteDatabase(options) { | ||
console.log('deleteDatabase', options); | ||
throw this.unimplemented('Not implemented on web.'); | ||
if (this.jeepSqlite != null) { | ||
if (this.isStoreOpen) { | ||
try { | ||
await this.jeepSqlite.deleteDatabase(options); | ||
} | ||
catch (err) { | ||
return Promise.reject(`${err}`); | ||
} | ||
} | ||
else { | ||
return Promise.reject(`Store "jeepSqliteStore" failed to open`); | ||
} | ||
} | ||
else { | ||
throw this.unimplemented('Not implemented on web.'); | ||
} | ||
} | ||
@@ -553,0 +711,0 @@ async isJsonValid(options) { |
@@ -473,5 +473,16 @@ var capacitorCapacitorSQLite = (function (exports, core) { | ||
class CapacitorSQLiteWeb extends core.WebPlugin { | ||
constructor() { | ||
super(); | ||
this.jeepSqlite = null; | ||
this.isStoreOpen = false; | ||
this.jeepSqlite = document.querySelector('jeep-sqlite'); | ||
} | ||
async echo(options) { | ||
console.log('ECHO in Web plugin', options); | ||
return options; | ||
if (this.jeepSqlite != null) { | ||
console.log('ECHO in Web plugin', options); | ||
return options; | ||
} | ||
else { | ||
throw this.unimplemented('Not implemented on web.'); | ||
} | ||
} | ||
@@ -491,12 +502,56 @@ async isSecretStored() { | ||
async createConnection(options) { | ||
console.log('createConnection', options); | ||
throw this.unimplemented('Not implemented on web.'); | ||
if (this.jeepSqlite != null) { | ||
if (!this.isStoreOpen) | ||
this.isStoreOpen = await this.jeepSqlite.isStoreOpen(); | ||
if (this.isStoreOpen) { | ||
try { | ||
await this.jeepSqlite.createConnection(options); | ||
} | ||
catch (err) { | ||
return Promise.reject(`${err}`); | ||
} | ||
} | ||
else { | ||
return Promise.reject(`Store "jeepSqliteStore" failed to open`); | ||
} | ||
} | ||
else { | ||
throw this.unimplemented('Not implemented on web.'); | ||
} | ||
} | ||
async open(options) { | ||
console.log('open', options); | ||
throw this.unimplemented('Not implemented on web.'); | ||
if (this.jeepSqlite != null) { | ||
if (this.isStoreOpen) { | ||
try { | ||
await this.jeepSqlite.open(options); | ||
} | ||
catch (err) { | ||
return Promise.reject(`${err}`); | ||
} | ||
} | ||
else { | ||
return Promise.reject(`Store "jeepSqliteStore" failed to open`); | ||
} | ||
} | ||
else { | ||
throw this.unimplemented('Not implemented on web.'); | ||
} | ||
} | ||
async closeConnection(options) { | ||
console.log('closeConnection', options); | ||
throw this.unimplemented('Not implemented on web.'); | ||
if (this.jeepSqlite != null) { | ||
if (this.isStoreOpen) { | ||
try { | ||
await this.jeepSqlite.closeConnection(options); | ||
} | ||
catch (err) { | ||
return Promise.reject(`${err}`); | ||
} | ||
} | ||
else { | ||
return Promise.reject(`Store "jeepSqliteStore" failed to open`); | ||
} | ||
} | ||
else { | ||
throw this.unimplemented('Not implemented on web.'); | ||
} | ||
} | ||
@@ -508,8 +563,37 @@ async checkConnectionsConsistency(options) { | ||
async close(options) { | ||
console.log('close', options); | ||
throw this.unimplemented('Not implemented on web.'); | ||
if (this.jeepSqlite != null) { | ||
if (this.isStoreOpen) { | ||
try { | ||
await this.jeepSqlite.close(options); | ||
} | ||
catch (err) { | ||
return Promise.reject(`${err}`); | ||
} | ||
} | ||
else { | ||
return Promise.reject(`Store "jeepSqliteStore" failed to open`); | ||
} | ||
} | ||
else { | ||
throw this.unimplemented('Not implemented on web.'); | ||
} | ||
} | ||
async execute(options) { | ||
console.log('execute', options); | ||
throw this.unimplemented('Not implemented on web.'); | ||
if (this.jeepSqlite != null) { | ||
if (this.isStoreOpen) { | ||
try { | ||
const ret = await this.jeepSqlite.execute(options); | ||
return Promise.resolve(ret); | ||
} | ||
catch (err) { | ||
return Promise.reject(`${err}`); | ||
} | ||
} | ||
else { | ||
return Promise.reject(`Store "jeepSqliteStore" failed to open`); | ||
} | ||
} | ||
else { | ||
throw this.unimplemented('Not implemented on web.'); | ||
} | ||
} | ||
@@ -521,16 +605,76 @@ async executeSet(options) { | ||
async run(options) { | ||
console.log('run', options); | ||
throw this.unimplemented('Not implemented on web.'); | ||
if (this.jeepSqlite != null) { | ||
if (this.isStoreOpen) { | ||
try { | ||
const ret = await this.jeepSqlite.run(options); | ||
return Promise.resolve(ret); | ||
} | ||
catch (err) { | ||
return Promise.reject(`${err}`); | ||
} | ||
} | ||
else { | ||
return Promise.reject(`Store "jeepSqliteStore" failed to open`); | ||
} | ||
} | ||
else { | ||
throw this.unimplemented('Not implemented on web.'); | ||
} | ||
} | ||
async query(options) { | ||
console.log('query', options); | ||
throw this.unimplemented('Not implemented on web.'); | ||
if (this.jeepSqlite != null) { | ||
if (this.isStoreOpen) { | ||
try { | ||
const ret = await this.jeepSqlite.query(options); | ||
return Promise.resolve(ret); | ||
} | ||
catch (err) { | ||
return Promise.reject(`${err}`); | ||
} | ||
} | ||
else { | ||
return Promise.reject(`Store "jeepSqliteStore" failed to open`); | ||
} | ||
} | ||
else { | ||
throw this.unimplemented('Not implemented on web.'); | ||
} | ||
} | ||
async isDBExists(options) { | ||
console.log('in Web isDBExists', options); | ||
throw this.unimplemented('Not implemented on web.'); | ||
if (this.jeepSqlite != null) { | ||
if (this.isStoreOpen) { | ||
try { | ||
const ret = await this.jeepSqlite.isDBExists(options); | ||
return Promise.resolve(ret); | ||
} | ||
catch (err) { | ||
return Promise.reject(`${err}`); | ||
} | ||
} | ||
else { | ||
return Promise.reject(`Store "jeepSqliteStore" failed to open`); | ||
} | ||
} | ||
else { | ||
throw this.unimplemented('Not implemented on web.'); | ||
} | ||
} | ||
async isDBOpen(options) { | ||
console.log('in Web isDBOpen', options); | ||
throw this.unimplemented('Not implemented on web.'); | ||
if (this.jeepSqlite != null) { | ||
if (this.isStoreOpen) { | ||
try { | ||
const ret = await this.jeepSqlite.isDBOpen(options); | ||
return Promise.resolve(ret); | ||
} | ||
catch (err) { | ||
return Promise.reject(`${err}`); | ||
} | ||
} | ||
else { | ||
return Promise.reject(`Store "jeepSqliteStore" failed to open`); | ||
} | ||
} | ||
else { | ||
throw this.unimplemented('Not implemented on web.'); | ||
} | ||
} | ||
@@ -546,4 +690,18 @@ async isDatabase(options) { | ||
async deleteDatabase(options) { | ||
console.log('deleteDatabase', options); | ||
throw this.unimplemented('Not implemented on web.'); | ||
if (this.jeepSqlite != null) { | ||
if (this.isStoreOpen) { | ||
try { | ||
await this.jeepSqlite.deleteDatabase(options); | ||
} | ||
catch (err) { | ||
return Promise.reject(`${err}`); | ||
} | ||
} | ||
else { | ||
return Promise.reject(`Store "jeepSqliteStore" failed to open`); | ||
} | ||
} | ||
else { | ||
throw this.unimplemented('Not implemented on web.'); | ||
} | ||
} | ||
@@ -550,0 +708,0 @@ async isJsonValid(options) { |
{ | ||
"name": "@capacitor-community/sqlite", | ||
"version": "3.1.3-3", | ||
"version": "3.1.3-web.1", | ||
"description": "Community plugin for native & electron SQLite databases", | ||
@@ -5,0 +5,0 @@ "main": "dist/plugin.cjs.js", |
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
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
729953
3308