kinvey-html5-sdk
Advanced tools
Comparing version 3.3.3 to 3.3.4
# Changelog | ||
## [v3.3.4](https://github.com/Kinvey/html5-sdk/tree/v3.3.4) (2016-01-12) | ||
[Full Changelog](https://github.com/Kinvey/html5-sdk/compare/v3.3.3...v3.3.4)<br/> | ||
**Changes** | ||
- Prevent popup from being shown to allow an application to store 10mb of data with WebSQL when it hasn't stored more then 5mb of data. [#7](https://github.com/Kinvey/html5-sdk/pull/7) | ||
- Increase the size of a WebSQL database as needed. [#8](https://github.com/Kinvey/html5-sdk/pull/8) | ||
**Updated packages:** | ||
- Updated `kinvey-node-sdk` to `v3.3.4`. | ||
## [v3.3.3](https://github.com/Kinvey/html5-sdk/tree/v3.3.3) (2016-12-16) | ||
[Full Changelog](https://github.com/Kinvey/html5-sdk/compare/v3.3.2...v3.3.3)<br/> | ||
**Merged pull requests:** | ||
**Changes** | ||
- Added support for aggregations against the local cache. [#6](https://github.com/Kinvey/html5-sdk/pull/6) | ||
@@ -14,3 +24,2 @@ | ||
**Packages:** | ||
- Update `kinvey-node-sdk` to `v3.3.2`. | ||
@@ -17,0 +26,0 @@ |
@@ -1,15 +0,27 @@ | ||
## Contributing | ||
# Contributing | ||
### Reporting Issues | ||
## Reporting Issues | ||
We recommend the following guidelines for reporting bugs - | ||
We recommend the following guidelines for reporting bugs - | ||
- For faster response, we recommend using [Kinvey support](https://support.kinvey.com/support/home). | ||
- For bugs and enhancements specific to the JS library that are not time critical, developers may [file a GitHub issue](https://github.com/Kinvey/html5-sdk/issues). | ||
- For bugs and enhancements specific to the library that are not time critical, please [file a GitHub issue](https://github.com/Kinvey/html5-sdk/issues). | ||
### Contributing Code | ||
### Filing a bug | ||
When contributing to the repository, please follow these guidelines - | ||
When filing a bug, please provide as much of the following information as possible - | ||
- All contributions must be in the form of a pull request, with the `master` branch as the base. | ||
- Steps to reproduce | ||
- Expected result | ||
- Actual result | ||
- Sample code that demonstrates the issue | ||
- Version of Kinvey / Device and toolset information | ||
- Kinvey app ID (**never post your app secrets publicly**) | ||
## Contributing Code | ||
When contributing to the repository, please follow these guidelines - | ||
- All contributions must be in the form of a pull request, with the `develop` branch as the base. | ||
- Pull requests must pass the unit tests in the codebase. Whenever possible, new code should also add unit tests. | ||
@@ -19,2 +31,2 @@ - Each commit should include a commit message describing the change; and each pull request should include a high level summary of the bug or enhancement being addressed by the pull request. | ||
We require that all contributors sign a [CLA](https://docs.google.com/document/d/1_PqkVpqgCL7psLuGCzZ6_OHbOS567E1JZ1hNMpfvZ-M/edit?usp=sharing) prior to making a contribution. Please download, sign and submit the CLA so we can accept your contributions. If you have questions, you can email mobile@kinvey.com. | ||
We require that all contributors sign a [CLA](https://goo.gl/forms/spZb2rXhC6I6zOxw1) prior to making a contribution. Please fill out the CLA so we can accept your contributions. If you have questions, you can email mobile@kinvey.com. |
@@ -15,2 +15,4 @@ 'use strict'; | ||
var _utils = require('kinvey-node-sdk/dist/utils'); | ||
var _indexeddb = require('./src/indexeddb'); | ||
@@ -48,20 +50,20 @@ | ||
return _websql2.default.isSupported().then(function (isWebSQLSupported) { | ||
if (isWebSQLSupported) { | ||
return new _websql2.default(_this2.name); | ||
return _websql2.default.loadAdapter(this.name).then(function (adapter) { | ||
if ((0, _utils.isDefined)(adapter) === false) { | ||
return _indexeddb2.default.loadAdapter(_this2.name); | ||
} | ||
return _indexeddb2.default.isSupported().then(function (isIndexedDBSupported) { | ||
if (isIndexedDBSupported) { | ||
return new _indexeddb2.default(_this2.name); | ||
} | ||
return adapter; | ||
}).then(function (adapter) { | ||
if ((0, _utils.isDefined)(adapter) === false) { | ||
return _webstorage.LocalStorage.loadAdapter(_this2.name); | ||
} | ||
return _webstorage.LocalStorage.isSupported().then(function (isLocalStorageSupported) { | ||
if (isLocalStorageSupported) { | ||
return new _webstorage.LocalStorage(_this2.name); | ||
} | ||
return adapter; | ||
}).then(function (adapter) { | ||
if ((0, _utils.isDefined)(adapter) === false) { | ||
return _get(Storage.prototype.__proto__ || Object.getPrototypeOf(Storage.prototype), 'getAdapter', _this2).call(_this2); | ||
} | ||
return _get(Storage.prototype.__proto__ || Object.getPrototypeOf(Storage.prototype), 'getAdapter', _this2).call(_this2); | ||
}); | ||
}); | ||
return adapter; | ||
}); | ||
@@ -68,0 +70,0 @@ } |
@@ -36,3 +36,3 @@ 'use strict'; | ||
var dbCache = {}; | ||
var _isSupported = undefined; | ||
var isSupported = void 0; | ||
@@ -322,24 +322,26 @@ var TransactionMode = { | ||
}], [{ | ||
key: 'isSupported', | ||
value: function isSupported() { | ||
var name = 'testIndexedDBSupport'; | ||
key: 'loadAdapter', | ||
value: function loadAdapter(name) { | ||
var indexedDB = global.indexedDB || global.webkitIndexedDB || global.mozIndexedDB || global.msIndexedDB; | ||
var db = new IndexedDB(name); | ||
if (typeof indexedDB === 'undefined') { | ||
return _es6Promise2.default.resolve(false); | ||
if (typeof isSupported !== 'undefined') { | ||
if (isSupported) { | ||
return _es6Promise2.default.resolve(db); | ||
} | ||
return _es6Promise2.default.resolve(undefined); | ||
} | ||
if (typeof _isSupported !== 'undefined') { | ||
return _es6Promise2.default.resolve(_isSupported); | ||
if (typeof indexedDB === 'undefined') { | ||
isSupported = false; | ||
return _es6Promise2.default.resolve(undefined); | ||
} | ||
var db = new IndexedDB(name); | ||
return db.save(name, { _id: '1' }).then(function () { | ||
return db.clear(); | ||
}).then(function () { | ||
_isSupported = true; | ||
return true; | ||
return db.save('__testSupport', { _id: '1' }).then(function () { | ||
isSupported = true; | ||
return db; | ||
}).catch(function () { | ||
_isSupported = false; | ||
return false; | ||
isSupported = false; | ||
return undefined; | ||
}); | ||
@@ -346,0 +348,0 @@ } |
@@ -41,5 +41,5 @@ 'use strict'; | ||
var masterCollectionName = 'sqlite_master'; | ||
var size = 5 * 1000 * 1000; // Database size in bytes | ||
var dbCache = {}; | ||
var _isSupported = undefined; | ||
var isSupported = void 0; | ||
var SIZE = 5 * 1000 * 1000; // 5mb | ||
@@ -61,3 +61,3 @@ var WebSQL = function () { | ||
if (!db) { | ||
db = global.openDatabase(this.name, 1, '', size); | ||
db = global.openDatabase(this.name, 1, '', SIZE); | ||
dbCache[this.name] = db; | ||
@@ -127,2 +127,9 @@ } | ||
// Safari calls this function regardless if user permits more quota or not. | ||
// And there's no way for a developer to know user's reaction. | ||
if (error && typeof SQLError !== 'undefined' && error.code === SQLError.QUOTA_ERR) { | ||
// Start over the transaction again to check if user permitted or not. | ||
return _this.openTransaction(collection, query, parameters, write); | ||
} | ||
if (error && error.indexOf('no such table') === -1) { | ||
@@ -132,6 +139,6 @@ return reject(new _errors.NotFoundError('The ' + collection + ' collection was not found on' + (' the ' + _this.name + ' WebSQL database.'))); | ||
var query = 'SELECT name AS value from #{collection} WHERE type = ? AND name = ?'; | ||
var parameters = ['table', collection]; | ||
var checkQuery = 'SELECT name AS value from #{collection} WHERE type = ? AND name = ?'; | ||
var checkParameters = ['table', collection]; | ||
return _this.openTransaction(masterCollectionName, query, parameters).then(function (response) { | ||
return _this.openTransaction(masterCollectionName, checkQuery, checkParameters).then(function (response) { | ||
if (response.result.length === 0) { | ||
@@ -233,3 +240,3 @@ return reject(new _errors.NotFoundError('The ' + collection + ' collection was not found on' + (' the ' + _this.name + ' WebSQL database.'))); | ||
var queries = tables.filter(function (table) { | ||
return (/^[a-zA-Z0-9\-]{1,128}/.test(table) | ||
return (/^[a-zA-Z0-9-]{1,128}/.test(table) | ||
); | ||
@@ -246,23 +253,25 @@ }).map(function (table) { | ||
}], [{ | ||
key: 'isSupported', | ||
value: function isSupported() { | ||
var name = 'testWebSQLSupport'; | ||
key: 'loadAdapter', | ||
value: function loadAdapter(name) { | ||
var db = new WebSQL(name); | ||
if (typeof global.openDatabase === 'undefined') { | ||
return _es6Promise2.default.resolve(false); | ||
if (typeof isSupported !== 'undefined') { | ||
if (isSupported) { | ||
return _es6Promise2.default.resolve(db); | ||
} | ||
return _es6Promise2.default.resolve(undefined); | ||
} | ||
if (typeof _isSupported !== 'undefined') { | ||
return _es6Promise2.default.resolve(_isSupported); | ||
if (typeof global.openDatabase === 'undefined') { | ||
isSupported = false; | ||
return _es6Promise2.default.resolve(undefined); | ||
} | ||
var db = new WebSQL(name); | ||
return db.save(name, { _id: '1' }).then(function () { | ||
return db.clear(); | ||
}).then(function () { | ||
_isSupported = true; | ||
return true; | ||
return db.save('__testSupport', { _id: '1' }).then(function () { | ||
isSupported = true; | ||
return db; | ||
}).catch(function () { | ||
_isSupported = false; | ||
return false; | ||
isSupported = false; | ||
return undefined; | ||
}); | ||
@@ -269,0 +278,0 @@ } |
@@ -201,2 +201,19 @@ 'use strict'; | ||
} | ||
}, { | ||
key: 'loadAdapter', | ||
value: function loadAdapter(name) { | ||
if (global.localStorage) { | ||
var item = '__testSupport'; | ||
try { | ||
global.localStorage.setItem(item, item); | ||
global.localStorage.getItem(item); | ||
global.localStorage.removeItem(item); | ||
return _es6Promise2.default.resolve(new LocalStorage(name)); | ||
} catch (e) { | ||
return _es6Promise2.default.resolve(undefined); | ||
} | ||
} | ||
return _es6Promise2.default.resolve(undefined); | ||
} | ||
}]); | ||
@@ -320,17 +337,17 @@ | ||
}], [{ | ||
key: 'isSupported', | ||
value: function isSupported() { | ||
key: 'loadAdapter', | ||
value: function loadAdapter(name) { | ||
if (global.sessionStorage) { | ||
var item = 'testSessionStorageSupport'; | ||
var item = '__testSupport'; | ||
try { | ||
global.sessionStorage.setItem(item, item); | ||
gloabl.sessionStorage.getItem(item); | ||
global.sessionStorage.getItem(item); | ||
global.sessionStorage.removeItem(item); | ||
return _es6Promise2.default.resolve(true); | ||
return _es6Promise2.default.resolve(new LocalStorage(name)); | ||
} catch (e) { | ||
return _es6Promise2.default.resolve(false); | ||
return _es6Promise2.default.resolve(undefined); | ||
} | ||
} | ||
return _es6Promise2.default.resolve(false); | ||
return _es6Promise2.default.resolve(undefined); | ||
} | ||
@@ -469,2 +486,11 @@ }]); | ||
} | ||
}, { | ||
key: 'loadAdapter', | ||
value: function loadAdapter(name) { | ||
if (typeof global.document.cookie === 'undefined') { | ||
return _es6Promise2.default.resolve(undefined); | ||
} | ||
return _es6Promise2.default.resolve(new CookieStorage(name)); | ||
} | ||
}]); | ||
@@ -471,0 +497,0 @@ |
{ | ||
"name": "kinvey-html5-sdk", | ||
"version": "3.3.3", | ||
"version": "3.3.4", | ||
"description": "Kinvey JavaScript SDK for HTML5.", | ||
@@ -33,3 +33,3 @@ "homepage": "http://www.kinvey.com", | ||
"lint:test": "eslint test/unit/**", | ||
"preversion": "npm test", | ||
"preversion": "del node_modules && npm install && npm test", | ||
"postversion": "git push && git push --tags", | ||
@@ -45,3 +45,3 @@ "s3": "npm run build && shjs ./scripts/s3.js", | ||
"es6-promise": "^4.0.3", | ||
"kinvey-node-sdk": "3.3.3", | ||
"kinvey-node-sdk": "3.3.4", | ||
"lodash": "^4.16.2" | ||
@@ -48,0 +48,0 @@ }, |
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
129300
1358
+ Addedkinvey-node-sdk@3.3.4(transitive)
- Removedkinvey-node-sdk@3.3.3(transitive)
Updatedkinvey-node-sdk@3.3.4