Skip to content

Commit

Permalink
change plugin definitions
Browse files Browse the repository at this point in the history
  • Loading branch information
Quéau Jean Pierre authored and Quéau Jean Pierre committed Dec 8, 2018
1 parent c3f7217 commit 56386fb
Show file tree
Hide file tree
Showing 12 changed files with 293 additions and 197 deletions.
2 changes: 1 addition & 1 deletion CapacitorDataStorageSqlite.podspec
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@

Pod::Spec.new do |s|
s.name = 'CapacitorDataStorageSqlite'
s.version = '0.0.8-1'
s.version = '0.0.9'
s.summary = 'Capacitor data storage on SQLite plugin'
s.license = 'MIT'
s.homepage = 'https://github.com/jepiqueau/capacitor-data-storage-sqlite.git'
Expand Down
205 changes: 105 additions & 100 deletions android/.idea/workspace.xml

Large diffs are not rendered by default.

110 changes: 77 additions & 33 deletions dist/esm/definitions.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,37 +4,81 @@ declare global {
}
}
export interface CapacitorDataStorageSqlitePlugin {
set(options: {
key: string;
value: string;
}): Promise<{
result: boolean;
}>;
get(options: {
key: string;
}): Promise<{
value: string;
}>;
remove(options: {
key: string;
}): Promise<{
result: boolean;
}>;
clear(): Promise<{
result: boolean;
}>;
iskey(options: {
key: string;
}): Promise<{
result: boolean;
}>;
keys(): Promise<{
keys: Array<string>;
}>;
values(): Promise<{
values: Array<string>;
}>;
keysvalues(): Promise<{
keysvalues: Array<any>;
}>;
/**
* Store a data with given key and value
* @param {capDataStorageOptions} options
* @returns {Promise<capDataStorageResult>} {result:boolean}
*/
set(options: capDataStorageOptions): Promise<capDataStorageResult>;
/**
* Retrieve a data value for a given data key
* @param {capDataStorageOptions} options
* @returns {Promise<capDataStorageResult>} {value:string}
*/
get(options: capDataStorageOptions): Promise<capDataStorageResult>;
/**
* Remove a data with given key
* @param {capDataStorageOptions} options
* @returns {Promise<capDataStorageResult>} {result:boolean}
*/
remove(options: capDataStorageOptions): Promise<capDataStorageResult>;
/**
* Clear the Data Store (delete all keys)
* @returns {Promise<capDataStorageResult>} {result:boolean}
*/
clear(): Promise<capDataStorageResult>;
/**
* Check if a data key exists
* @param {capDataStorageOptions} options
* @returns {Promise<capDataStorageResult>} {result:boolean}
*/
iskey(options: capDataStorageOptions): Promise<capDataStorageResult>;
remove(options: capDataStorageOptions): Promise<capDataStorageResult>;
/**
* Get the data key list
* @returns {Promise<capDataStorageResult>} {keys:Array<string>}
*/
keys(): Promise<capDataStorageResult>;
/**
* Get the data value list
* @returns {Promise<capDataStorageResult>} {values:Array<string>}
*/
values(): Promise<capDataStorageResult>;
/**
* Get the data key/value pair list
* @returns {Promise<capDataStorageResult>} {keysvalues:Array<{key:string,value:string}>}
*/
keysvalues(): Promise<capDataStorageResult>;
}
export interface capDataStorageOptions {
/**
* The data name
*/
key: string;
/**
* The data value when required
*/
value?: string;
}
export interface capDataStorageResult {
/**
* result set to true when successful else false
*/
result?: boolean;
/**
* the data value for a given data key
*/
value?: string;
/**
* the data key list as an Array
*/
keys?: Array<string>;
/**
* the data values list as an Array
*/
values?: Array<string>;
/**
* the data keys/values list as an Array of {key:string,value:string}
*/
keysvalues?: Array<any>;
}
47 changes: 11 additions & 36 deletions dist/esm/web.d.ts
Original file line number Diff line number Diff line change
@@ -1,42 +1,17 @@
import { WebPlugin } from '@capacitor/core';
import { StorageDatabaseHelper } from './web-utils/StorageDatabaseHelper';
import { CapacitorDataStorageSqlitePlugin } from './definitions';
export declare class CapacitorDataStorageIdbWeb extends WebPlugin implements CapacitorDataStorageSqlitePlugin {
import { CapacitorDataStorageSqlitePlugin, capDataStorageOptions, capDataStorageResult } from './definitions';
export declare class CapacitorDataStorageSqlitePluginWeb extends WebPlugin implements CapacitorDataStorageSqlitePlugin {
mDb: StorageDatabaseHelper;
constructor();
set(options: {
key: string;
value: string;
}): Promise<{
result: boolean;
}>;
get(options: {
key: string;
}): Promise<{
value: string;
}>;
remove(options: {
key: string;
}): Promise<{
result: boolean;
}>;
clear(): Promise<{
result: boolean;
}>;
iskey(options: {
key: string;
}): Promise<{
result: boolean;
}>;
keys(): Promise<{
keys: Array<string>;
}>;
values(): Promise<{
values: Array<string>;
}>;
keysvalues(): Promise<{
keysvalues: Array<any>;
}>;
set(options: capDataStorageOptions): Promise<capDataStorageResult>;
get(options: capDataStorageOptions): Promise<capDataStorageResult>;
remove(options: capDataStorageOptions): Promise<capDataStorageResult>;
clear(): Promise<capDataStorageResult>;
iskey(options: capDataStorageOptions): Promise<capDataStorageResult>;
keys(): Promise<capDataStorageResult>;
values(): Promise<capDataStorageResult>;
keysvalues(): Promise<capDataStorageResult>;
}
declare const CapacitorDataStorageSqlite: CapacitorDataStorageIdbWeb;
declare const CapacitorDataStorageSqlite: CapacitorDataStorageSqlitePluginWeb;
export { CapacitorDataStorageSqlite };
4 changes: 2 additions & 2 deletions dist/esm/web.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/esm/web.js.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Binary file not shown.
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "capacitor-data-storage-sqlite",
"version": "0.0.8-1",
"version": "0.0.9",
"description": "Capacitor data storage on SQLite plugin",
"main": "dist/esm/index.js",
"types": "dist/esm/index.d.ts",
Expand Down
7 changes: 4 additions & 3 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ As capacitor provides fisrt-class Progressive Web App support so you can use thi

Capacitor Data Storage SQlite Plugin provides a key-value store for simple data of type string only, so JSON object can be stored, you should manage conversion through JSON.stringify before storing and JSON.parse when retrieving the data, use the same procedure for number through number.toString() and Number().

WARNING NEVER USE VERSION 0.0.5.11 TO 0.0.5.17

## View Me
[capacitor-data-storage-sqlite](https://ionicpwacapacitorstorage.firebaseapp.com)
Expand All @@ -27,12 +26,14 @@ npm install --save capacitor-data-storage-sqlite@latest

Ionic App showing an integration of [capacitor-data-storage-sqlite plugin](https://github.com/jepiqueau/ionic-capacitor-data-storage-sqlite)

Vue App showing an integration of [capacitor-data-storage-sqlite plugin](https://github.com/jepiqueau/vue-capacitor-data-storage-sqlite)

PWA App showing an integration of
[capacitor-data-storage-sqlite plugin] (https://github.com/jepiqueau/ionicpwacapacitorstorage.git)
[capacitor-data-storage-sqlite plugin](https://github.com/jepiqueau/ionicpwacapacitorstorage.git)


## Remarks
The third release of the plugin includes the Native IOS code (Objective-C/Swift),the Native Android code (Java) and the Web code (Typescript) using Capacitor v1.0.0-beta.11
This release of the plugin includes the Native IOS code (Objective-C/Swift),the Native Android code (Java) and the Web code (Typescript) using Capacitor v1.0.0-beta.11

## Dependencies
The IOS code is based on SQLite.swift as wrapper for SQLite, the Web code has been implemented with localforage as wrapper for indexDB.
Expand Down
87 changes: 79 additions & 8 deletions src/definitions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,83 @@ declare global {
}

export interface CapacitorDataStorageSqlitePlugin {
set(options: { key: string, value: string }): Promise<{result: boolean}>;
get(options: { key: string}): Promise<{value: string}>;
remove(options: {key:string}): Promise<{result: boolean}>;
clear(): Promise<{result: boolean}>;
iskey(options: {key:string}): Promise<{result: boolean}>;
keys(): Promise<{keys: Array<string>}>;
values(): Promise<{values: Array<string>}>;
keysvalues(): Promise<{keysvalues: Array<any>}>;
/**
* Store a data with given key and value
* @param {capDataStorageOptions} options
* @returns {Promise<capDataStorageResult>} {result:boolean}
*/
set(options: capDataStorageOptions): Promise<capDataStorageResult>;
/**
* Retrieve a data value for a given data key
* @param {capDataStorageOptions} options
* @returns {Promise<capDataStorageResult>} {value:string}
*/
get(options: capDataStorageOptions): Promise<capDataStorageResult>;
/**
* Remove a data with given key
* @param {capDataStorageOptions} options
* @returns {Promise<capDataStorageResult>} {result:boolean}
*/
remove(options: capDataStorageOptions): Promise<capDataStorageResult>;
/**
* Clear the Data Store (delete all keys)
* @returns {Promise<capDataStorageResult>} {result:boolean}
*/
clear(): Promise<capDataStorageResult>;
/**
* Check if a data key exists
* @param {capDataStorageOptions} options
* @returns {Promise<capDataStorageResult>} {result:boolean}
*/
iskey(options: capDataStorageOptions): Promise<capDataStorageResult>;
remove(options: capDataStorageOptions): Promise<capDataStorageResult>;
/**
* Get the data key list
* @returns {Promise<capDataStorageResult>} {keys:Array<string>}
*/
keys(): Promise<capDataStorageResult>;
/**
* Get the data value list
* @returns {Promise<capDataStorageResult>} {values:Array<string>}
*/
values(): Promise<capDataStorageResult>;
/**
* Get the data key/value pair list
* @returns {Promise<capDataStorageResult>} {keysvalues:Array<{key:string,value:string}>}
*/
keysvalues(): Promise<capDataStorageResult>;
}

export interface capDataStorageOptions {
/**
* The data name
*/
key: string;
/**
* The data value when required
*/
value?: string;
}

export interface capDataStorageResult {
/**
* result set to true when successful else false
*/
result?: boolean;
/**
* the data value for a given data key
*/
value?: string;
/**
* the data key list as an Array
*/
keys?: Array<string>;
/**
* the data values list as an Array
*/
values?: Array<string>;
/**
* the data keys/values list as an Array of {key:string,value:string}
*/
keysvalues?: Array<any>;
}
Loading

0 comments on commit 56386fb

Please sign in to comment.