Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@ionic/storage

Package Overview
Dependencies
Maintainers
8
Versions
32
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@ionic/storage - npm Package Compare versions

Comparing version 1.1.9 to 2.0.0-0

es2015/index.metadata.json

8

es2015/index.d.ts

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

import { Storage } from './storage';
export { Storage };
import { ModuleWithProviders } from '@angular/core';
import { Storage, StorageConfig, StorageConfigToken } from './storage';
export { Storage, StorageConfig, StorageConfigToken };
export declare class IonicStorageModule {
static forRoot(storageConfig?: StorageConfig): ModuleWithProviders;
}

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

import { Storage } from './storage';
export { Storage };
import { NgModule } from '@angular/core';
import { provideStorage, Storage, StorageConfigToken } from './storage';
export { Storage, StorageConfigToken };
export var IonicStorageModule = (function () {
function IonicStorageModule() {
}
IonicStorageModule.forRoot = function (storageConfig) {
if (storageConfig === void 0) { storageConfig = null; }
return {
ngModule: IonicStorageModule,
providers: [
{ provide: StorageConfigToken, useValue: storageConfig },
{ provide: Storage, useFactory: provideStorage, deps: [StorageConfigToken] },
]
};
};
IonicStorageModule.decorators = [
{ type: NgModule, args: [{},] },
];
/** @nocollapse */
IonicStorageModule.ctorParameters = function () { return []; };
return IonicStorageModule;
}());
/// <reference types="localforage" />
import { OpaqueToken } from '@angular/core';
/**

@@ -76,2 +77,3 @@ * Storage is an easy way to store key/value pairs and JSON objects.

*
* Note: Any custom configurations will be merged with the default configuration
*

@@ -82,3 +84,3 @@ * ```typescript

* export function provideStorage() {
* return new Storage(['sqlite', 'websql', 'indexeddb'], { name: '__mydb' });
* return new Storage({ name: '__mydb' });
* }

@@ -108,3 +110,3 @@ *

*/
constructor(driverOrder?: [string], config?: any);
constructor(config?: any);
/**

@@ -160,1 +162,13 @@ * Get the name of the driver being used.

}
export declare function getDefaultConfig(): {
name: string;
storeName: string;
driverOrder: string[];
};
export interface StorageConfig {
name?: string;
storeName?: string;
driverOrder?: string[];
}
export declare function provideStorage(storageConfig?: StorageConfig): Storage;
export declare const StorageConfigToken: OpaqueToken;

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

var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
return c > 3 && r && Object.defineProperty(target, key, r), r;
};
import { Injectable } from '@angular/core';
import { Injectable, OpaqueToken, Optional } from '@angular/core';
import LocalForage from 'localforage';

@@ -84,2 +78,3 @@ import CordovaSQLiteDriver from 'localforage-cordovasqlitedriver';

*
* Note: Any custom configurations will be merged with the default configuration
*

@@ -90,3 +85,3 @@ * ```typescript

* export function provideStorage() {
* return new Storage(['sqlite', 'websql', 'indexeddb'], { name: '__mydb' });
* return new Storage({ name: '__mydb' });
* }

@@ -114,22 +109,13 @@ *

*/
function Storage(driverOrder, config) {
function Storage(config) {
var _this = this;
if (driverOrder === void 0) { driverOrder = ['sqlite', 'indexeddb', 'websql', 'localstorage']; }
this._driver = null;
this._dbPromise = new Promise(function (resolve, reject) {
var db;
var dbConfig = {
name: '_ionicstorage',
storeName: '_ionickv'
};
// Merge any custom config options they have
if (config) {
for (var k in config) {
dbConfig[k] = config[k];
}
}
var defaultConfig = getDefaultConfig();
var actualConfig = Object.assign(defaultConfig, config || {});
LocalForage.defineDriver(CordovaSQLiteDriver).then(function () {
db = LocalForage.createInstance(dbConfig);
db = LocalForage.createInstance(actualConfig);
})
.then(function () { return db.setDriver(_this._getDriverOrder(driverOrder)); })
.then(function () { return db.setDriver(_this._getDriverOrder(actualConfig.driverOrder)); })
.then(function () {

@@ -226,6 +212,23 @@ _this._driver = db.driver();

};
Storage = __decorate([
Injectable()
], Storage);
Storage.decorators = [
{ type: Injectable },
];
/** @nocollapse */
Storage.ctorParameters = function () { return [
{ type: undefined, decorators: [{ type: Optional },] },
]; };
return Storage;
}());
export function getDefaultConfig() {
return {
name: '_ionicstorage',
storeName: '_ionickv',
driverOrder: ['sqlite', 'indexeddb', 'websql', 'localstorage']
};
}
;
export function provideStorage(storageConfig) {
var config = !!storageConfig ? storageConfig : getDefaultConfig();
return new Storage(config);
}
export var StorageConfigToken = new OpaqueToken('STORAGE_CONFIG_TOKEN');

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

import { Storage } from './storage';
export { Storage };
import { ModuleWithProviders } from '@angular/core';
import { Storage, StorageConfig, StorageConfigToken } from './storage';
export { Storage, StorageConfig, StorageConfigToken };
export declare class IonicStorageModule {
static forRoot(storageConfig?: StorageConfig): ModuleWithProviders;
}
"use strict";
var core_1 = require('@angular/core');
var storage_1 = require('./storage');
exports.Storage = storage_1.Storage;
exports.StorageConfigToken = storage_1.StorageConfigToken;
var IonicStorageModule = (function () {
function IonicStorageModule() {
}
IonicStorageModule.forRoot = function (storageConfig) {
if (storageConfig === void 0) { storageConfig = null; }
return {
ngModule: IonicStorageModule,
providers: [
{ provide: storage_1.StorageConfigToken, useValue: storageConfig },
{ provide: storage_1.Storage, useFactory: storage_1.provideStorage, deps: [storage_1.StorageConfigToken] },
]
};
};
IonicStorageModule.decorators = [
{ type: core_1.NgModule, args: [{},] },
];
/** @nocollapse */
IonicStorageModule.ctorParameters = function () { return []; };
return IonicStorageModule;
}());
exports.IonicStorageModule = IonicStorageModule;
/// <reference types="localforage" />
import { OpaqueToken } from '@angular/core';
/**

@@ -76,2 +77,3 @@ * Storage is an easy way to store key/value pairs and JSON objects.

*
* Note: Any custom configurations will be merged with the default configuration
*

@@ -82,3 +84,3 @@ * ```typescript

* export function provideStorage() {
* return new Storage(['sqlite', 'websql', 'indexeddb'], { name: '__mydb' });
* return new Storage({ name: '__mydb' });
* }

@@ -108,3 +110,3 @@ *

*/
constructor(driverOrder?: [string], config?: any);
constructor(config?: any);
/**

@@ -160,1 +162,13 @@ * Get the name of the driver being used.

}
export declare function getDefaultConfig(): {
name: string;
storeName: string;
driverOrder: string[];
};
export interface StorageConfig {
name?: string;
storeName?: string;
driverOrder?: string[];
}
export declare function provideStorage(storageConfig?: StorageConfig): Storage;
export declare const StorageConfigToken: OpaqueToken;
"use strict";
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
return c > 3 && r && Object.defineProperty(target, key, r), r;
};
var core_1 = require('@angular/core');

@@ -85,2 +79,3 @@ var localforage_1 = require('localforage');

*
* Note: Any custom configurations will be merged with the default configuration
*

@@ -91,3 +86,3 @@ * ```typescript

* export function provideStorage() {
* return new Storage(['sqlite', 'websql', 'indexeddb'], { name: '__mydb' });
* return new Storage({ name: '__mydb' });
* }

@@ -115,22 +110,13 @@ *

*/
function Storage(driverOrder, config) {
function Storage(config) {
var _this = this;
if (driverOrder === void 0) { driverOrder = ['sqlite', 'indexeddb', 'websql', 'localstorage']; }
this._driver = null;
this._dbPromise = new Promise(function (resolve, reject) {
var db;
var dbConfig = {
name: '_ionicstorage',
storeName: '_ionickv'
};
// Merge any custom config options they have
if (config) {
for (var k in config) {
dbConfig[k] = config[k];
}
}
var defaultConfig = getDefaultConfig();
var actualConfig = Object.assign(defaultConfig, config || {});
localforage_1.default.defineDriver(localforage_cordovasqlitedriver_1.default).then(function () {
db = localforage_1.default.createInstance(dbConfig);
db = localforage_1.default.createInstance(actualConfig);
})
.then(function () { return db.setDriver(_this._getDriverOrder(driverOrder)); })
.then(function () { return db.setDriver(_this._getDriverOrder(actualConfig.driverOrder)); })
.then(function () {

@@ -227,7 +213,26 @@ _this._driver = db.driver();

};
Storage = __decorate([
core_1.Injectable()
], Storage);
Storage.decorators = [
{ type: core_1.Injectable },
];
/** @nocollapse */
Storage.ctorParameters = function () { return [
{ type: undefined, decorators: [{ type: core_1.Optional },] },
]; };
return Storage;
}());
exports.Storage = Storage;
function getDefaultConfig() {
return {
name: '_ionicstorage',
storeName: '_ionickv',
driverOrder: ['sqlite', 'indexeddb', 'websql', 'localstorage']
};
}
exports.getDefaultConfig = getDefaultConfig;
;
function provideStorage(storageConfig) {
var config = !!storageConfig ? storageConfig : getDefaultConfig();
return new Storage(config);
}
exports.provideStorage = provideStorage;
exports.StorageConfigToken = new core_1.OpaqueToken('STORAGE_CONFIG_TOKEN');
{
"name": "@ionic/storage",
"version": "1.1.9",
"version": "2.0.0-0",
"description": "Ionic Storage utility",

@@ -10,6 +10,7 @@ "main": "es2015/index.js",

"clean": "rm -rf dist",
"build-cjs": "tsc -p .",
"build-es2015": "tsc -p ./tsconfig-es2015.json",
"clean-generated": "rm -rf src/*.ngfactory.ts && rm -rf src/*.ngsummary.json",
"build-cjs": "ngc -p .",
"build-es2015": "ngc -p ./tsconfig-es2015.json",
"preparePackage": "node ./scripts/copy-package",
"build": "npm run clean && npm run build-cjs && npm run build-es2015 && npm run preparePackage",
"build": "npm run clean && npm run build-cjs && npm run build-es2015 && npm run preparePackage && npm run clean-generated",
"publishPackage": "npm run build && cd dist && npm publish"

@@ -16,0 +17,0 @@ },

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