forked from webcss/angular-indexedDB
-
Notifications
You must be signed in to change notification settings - Fork 49
/
angular-indexed-db.min.js.map
1 lines (1 loc) · 40.6 KB
/
angular-indexed-db.min.js.map
1
{"version":3,"sources":["angular-indexed-db.js"],"names":["__slice","slice","angular","module","provider","IDBKeyRange","allTransactions","apiDirection","appendResultsToPromise","applyNeededUpgrades","cursorDirection","db","dbMode","dbName","dbPromise","dbVersion","defaultQueryOptions","errorMessageFor","indexedDB","readyState","upgradesByVersion","window","mozIndexedDB","webkitIndexedDB","msIndexedDB","shimIndexedDB","mozIDBKeyRange","webkitIDBKeyRange","msIDBKeyRange","readonly","readwrite","pending","next","nextunique","prev","prevunique","ascending","descending","useIndex","keyRange","direction","oldVersion","event","tx","$log","version","hasOwnProperty","log","e","target","webkitErrorMessage","error","message","name","errorCode","promise","results","then","this","connection","databaseName","upgradeDatabase","newVersion","callback","Math","max","apply","Object","keys","$get","$q","$rootScope","DbQ","ObjectStore","Query","Transaction","addTransaction","closeDatabase","createDatabaseConnection","keyRangeForOptions","openDatabase","openTransaction","rejectWithError","validateStoreNames","deferred","$apply","reject","dbReq","defer","open","parseInt","onsuccess","result","resolve","onblocked","onerror","onupgradeneeded","oldVer","pow","transaction","close","storeNames","found","storeName","_i","_len","length","objectStoreNames","contains","mode","options","beginKey","endKey","bound","push","index","indexOf","splice","setupCallbacks","prototype","oncomplete","_this","onabort","title","objectStore","abort","q","args","arguments","call","_ref","rejectWith","req","notify","dbErrorFunction","resolveWith","store","_mapCursor","mapFunc","openCursor","cursor","_arrayOperation","data","item","isArray","when","getAllKeys","key","clear","upsert","put","insert","add","getAll","value","eachWhere","query","indexName","findWhere","each","eachBy","count","find","get","findBy","$lt","upperBound","$gt","lowerBound","$lte","$gte","$eq","only","$between","low","hi","exLow","exHi","$desc","unique","$asc","$index","openStore","callBack","openStores","objectStores","_results","openAllStores","Array","deleteDatabase","queryDirection","flush","all","databaseInfo","stores","keyPath","autoIncrement","indices","indexNames"],"mappings":"CAQA,WACE,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indexedDBProvider\n (c) 2014 Bram Whillock (bramski)\n Forked from original work by clements Capitan (webcss)\n License: MIT\n */\n\n(function() {\n 'use strict';\n var __slice = [].slice;\n\n angular.module('indexedDB', []).provider('$indexedDB', function() {\n var IDBKeyRange, allTransactions, apiDirection, appendResultsToPromise, applyNeededUpgrades, cursorDirection, db, dbMode, dbName, dbPromise, dbVersion, defaultQueryOptions, errorMessageFor, indexedDB, readyState, upgradesByVersion;\n indexedDB = window.indexedDB || window.mozIndexedDB || window.webkitIndexedDB || window.msIndexedDB || window.shimIndexedDB;\n IDBKeyRange = window.IDBKeyRange || window.mozIDBKeyRange || window.webkitIDBKeyRange || window.msIDBKeyRange;\n dbMode = {\n readonly: \"readonly\",\n readwrite: \"readwrite\"\n };\n readyState = {\n pending: \"pending\"\n };\n cursorDirection = {\n next: \"next\",\n nextunique: \"nextunique\",\n prev: \"prev\",\n prevunique: \"prevunique\"\n };\n apiDirection = {\n ascending: cursorDirection.next,\n descending: cursorDirection.prev\n };\n dbName = '';\n dbVersion = 1;\n db = null;\n upgradesByVersion = {};\n dbPromise = null;\n allTransactions = [];\n defaultQueryOptions = {\n useIndex: void 0,\n keyRange: null,\n direction: cursorDirection.next\n };\n applyNeededUpgrades = function(oldVersion, event, db, tx, $log) {\n var version;\n for (version in upgradesByVersion) {\n if (!upgradesByVersion.hasOwnProperty(version) || version <= oldVersion) {\n continue;\n }\n $log.log(\"$indexedDB: Running upgrade : \" + version + \" from \" + oldVersion);\n upgradesByVersion[version](event, db, tx);\n }\n };\n errorMessageFor = function(e) {\n if (e.target.readyState === readyState.pending) {\n return \"Error: Operation pending\";\n } else {\n return e.target.webkitErrorMessage || e.target.error.message || e.target.error.name || e.target.errorCode;\n }\n };\n appendResultsToPromise = function(promise, results) {\n if (results !== void 0) {\n return promise.then(function() {\n return results;\n });\n } else {\n return promise;\n }\n };\n\n /**\n @ngdoc function\n @name $indexedDBProvider.connection\n @function\n \n @description\n sets the name of the database to use\n \n @param {string} databaseName database name.\n @returns {object} this\n */\n this.connection = function(databaseName) {\n dbName = databaseName;\n return this;\n };\n\n /**\n @ngdoc function\n @name $indexedDBProvider.upgradeDatabase\n @function\n \n @description provides version number and steps to upgrade the database wrapped in a\n callback function\n \n @param {number} newVersion new version number for the database.\n @param {function} callback the callback which proceeds the upgrade\n @returns {object} this\n */\n this.upgradeDatabase = function(newVersion, callback) {\n upgradesByVersion[newVersion] = callback;\n dbVersion = Math.max.apply(null, Object.keys(upgradesByVersion));\n return this;\n };\n this.$get = [\n '$q', '$rootScope', '$log', function($q, $rootScope, $log) {\n var DbQ, ObjectStore, Query, Transaction, addTransaction, closeDatabase, createDatabaseConnection, keyRangeForOptions, openDatabase, openTransaction, rejectWithError, validateStoreNames;\n rejectWithError = function(deferred) {\n return function(error) {\n return $rootScope.$apply(function() {\n return deferred.reject(errorMessageFor(error));\n });\n };\n };\n createDatabaseConnection = function() {\n var dbReq, deferred;\n deferred = $q.defer();\n dbReq = indexedDB.open(dbName, parseInt(dbVersion) || 1);\n dbReq.onsuccess = function() {\n db = dbReq.result;\n $rootScope.$apply(function() {\n deferred.resolve(db);\n });\n };\n dbReq.onblocked = dbReq.onerror = rejectWithError(deferred);\n dbReq.onupgradeneeded = function(event) {\n var oldVer, tx;\n oldVer = event.oldVersion;\n if (oldVer > Math.pow(2, 62)) {\n oldVer = 0;\n }\n db = event.target.result;\n tx = event.target.transaction;\n $log.log(\"$indexedDB: Upgrading database '\" + db.name + \"' from version \" + oldVer + \" to version \" + event.newVersion + \" ...\");\n applyNeededUpgrades(oldVer, event, db, tx, $log);\n };\n return deferred.promise;\n };\n openDatabase = function() {\n return dbPromise || (dbPromise = createDatabaseConnection());\n };\n closeDatabase = function() {\n return openDatabase().then(function() {\n db.close();\n db = null;\n return dbPromise = null;\n });\n };\n validateStoreNames = function(storeNames) {\n var found, storeName, _i, _len;\n found = true;\n for (_i = 0, _len = storeNames.length; _i < _len; _i++) {\n storeName = storeNames[_i];\n found = found & db.objectStoreNames.contains(storeName);\n }\n return found;\n };\n openTransaction = function(storeNames, mode) {\n if (mode == null) {\n mode = dbMode.readonly;\n }\n return openDatabase().then(function() {\n if (!validateStoreNames(storeNames)) {\n return $q.reject(\"Object stores \" + storeNames + \" do not exist.\");\n }\n return new Transaction(storeNames, mode);\n });\n };\n keyRangeForOptions = function(options) {\n if (options.beginKey && options.endKey) {\n return IDBKeyRange.bound(options.beginKey, options.endKey);\n }\n };\n addTransaction = function(transaction) {\n allTransactions.push(transaction.promise);\n return transaction.promise[\"finally\"](function() {\n var index;\n index = allTransactions.indexOf(transaction.promise);\n if (index > -1) {\n return allTransactions.splice(index, 1);\n }\n });\n };\n Transaction = (function() {\n function Transaction(storeNames, mode) {\n if (mode == null) {\n mode = dbMode.readonly;\n }\n this.transaction = db.transaction(storeNames, mode);\n this.defer = $q.defer();\n this.promise = this.defer.promise;\n this.setupCallbacks();\n }\n\n Transaction.prototype.setupCallbacks = function() {\n this.transaction.oncomplete = (function(_this) {\n return function() {\n return $rootScope.$apply(function() {\n return _this.defer.resolve(\"Transaction Completed\");\n });\n };\n })(this);\n this.transaction.onabort = (function(_this) {\n return function(error) {\n return $rootScope.$apply(function() {\n return _this.defer.reject({\n title: \"Transaction Aborted\",\n error: error\n });\n });\n };\n })(this);\n this.transaction.onerror = (function(_this) {\n return function(error) {\n return $rootScope.$apply(function() {\n return _this.defer.reject({\n title: \"Transaction Error\",\n error: error\n });\n });\n };\n })(this);\n return addTransaction(this);\n };\n\n Transaction.prototype.objectStore = function(storeName) {\n return this.transaction.objectStore(storeName);\n };\n\n Transaction.prototype.abort = function() {\n return this.transaction.abort();\n };\n\n return Transaction;\n\n })();\n DbQ = (function() {\n function DbQ() {\n this.q = $q.defer();\n this.promise = this.q.promise;\n }\n\n DbQ.prototype.reject = function() {\n var args;\n args = 1 <= arguments.length ? __slice.call(arguments, 0) : [];\n return $rootScope.$apply((function(_this) {\n return function() {\n var _ref;\n return (_ref = _this.q).reject.apply(_ref, args);\n };\n })(this));\n };\n\n DbQ.prototype.rejectWith = function(req) {\n return req.onerror = req.onblocked = (function(_this) {\n return function(e) {\n return _this.reject(errorMessageFor(e));\n };\n })(this);\n };\n\n DbQ.prototype.resolve = function() {\n var args;\n args = 1 <= arguments.length ? __slice.call(arguments, 0) : [];\n return $rootScope.$apply((function(_this) {\n return function() {\n var _ref;\n return (_ref = _this.q).resolve.apply(_ref, args);\n };\n })(this));\n };\n\n DbQ.prototype.notify = function() {\n var args;\n args = 1 <= arguments.length ? __slice.call(arguments, 0) : [];\n return $rootScope.$apply((function(_this) {\n return function() {\n var _ref;\n return (_ref = _this.q).notify.apply(_ref, args);\n };\n })(this));\n };\n\n DbQ.prototype.dbErrorFunction = function() {\n return (function(_this) {\n return function(error) {\n return $rootScope.$apply(function() {\n return _this.q.reject(errorMessageFor(error));\n });\n };\n })(this);\n };\n\n DbQ.prototype.resolveWith = function(req) {\n this.rejectWith(req);\n return req.onsuccess = (function(_this) {\n return function(e) {\n return _this.resolve(e.target.result);\n };\n })(this);\n };\n\n return DbQ;\n\n })();\n ObjectStore = (function() {\n function ObjectStore(storeName, transaction) {\n this.storeName = storeName;\n this.store = transaction.objectStore(storeName);\n this.transaction = transaction;\n }\n\n ObjectStore.prototype.defer = function() {\n return new DbQ();\n };\n\n ObjectStore.prototype._mapCursor = function(defer, mapFunc, req) {\n var results;\n if (req == null) {\n req = this.store.openCursor();\n }\n results = [];\n defer.rejectWith(req);\n return req.onsuccess = function(e) {\n var cursor;\n if (cursor = e.target.result) {\n results.push(mapFunc(cursor));\n defer.notify(mapFunc(cursor));\n return cursor[\"continue\"]();\n } else {\n return defer.resolve(results);\n }\n };\n };\n\n ObjectStore.prototype._arrayOperation = function(data, mapFunc) {\n var defer, item, req, results, _i, _len;\n defer = this.defer();\n if (!angular.isArray(data)) {\n data = [data];\n }\n for (_i = 0, _len = data.length; _i < _len; _i++) {\n item = data[_i];\n req = mapFunc(item);\n results = [];\n defer.rejectWith(req);\n req.onsuccess = function(e) {\n results.push(e.target.result);\n defer.notify(e.target.result);\n if (results.length >= data.length) {\n return defer.resolve(results);\n }\n };\n }\n if (data.length === 0) {\n return $q.when([]);\n }\n return defer.promise;\n };\n\n\n /**\n @ngdoc function\n @name $indexedDBProvider.store.getAllKeys\n @function\n \n @description\n gets all the keys\n \n @returns {Q} A promise which will result with all the keys\n */\n\n ObjectStore.prototype.getAllKeys = function() {\n var defer, req;\n defer = this.defer();\n if (this.store.getAllKeys) {\n req = this.store.getAllKeys();\n defer.resolveWith(req);\n } else {\n this._mapCursor(defer, function(cursor) {\n return cursor.key;\n });\n }\n return defer.promise;\n };\n\n\n /**\n @ngdoc function\n @name $indexedDBProvider.store.clear\n @function\n \n @description\n clears all objects from this store\n \n @returns {Q} A promise that this can be done successfully.\n */\n\n ObjectStore.prototype.clear = function() {\n var defer, req;\n defer = this.defer();\n req = this.store.clear();\n defer.resolveWith(req);\n return defer.promise;\n };\n\n\n /**\n @ngdoc function\n @name $indexedDBProvider.store.delete\n @function\n \n @description\n Deletes the item at the key. The operation is ignored if the item does not exist.\n \n @param {key} The key of the object to delete.\n @returns {Q} A promise that this can be done successfully.\n */\n\n ObjectStore.prototype[\"delete\"] = function(key) {\n var defer;\n defer = this.defer();\n defer.resolveWith(this.store[\"delete\"](key));\n return defer.promise;\n };\n\n\n /**\n @ngdoc function\n @name $indexedDBProvider.store.upsert\n @function\n \n @description\n Updates the given item\n \n @param {data} Details of the item or items to update or insert\n @returns {Q} A promise that this can be done successfully.\n */\n\n ObjectStore.prototype.upsert = function(data) {\n return this._arrayOperation(data, (function(_this) {\n return function(item) {\n return _this.store.put(item);\n };\n })(this));\n };\n\n\n /**\n @ngdoc function\n @name $indexedDBProvider.store.insert\n @function\n \n @description\n Updates the given item\n \n @param {data} Details of the item or items to insert\n @returns {Q} A promise that this can be done successfully.\n */\n\n ObjectStore.prototype.insert = function(data) {\n return this._arrayOperation(data, (function(_this) {\n return function(item) {\n return _this.store.add(item);\n };\n })(this));\n };\n\n\n /**\n @ngdoc function\n @name $indexedDBProvider.store.getAll\n @function\n \n @description\n Fetches all items from the store\n \n @returns {Q} A promise which resolves with copies of all items in the store\n */\n\n ObjectStore.prototype.getAll = function() {\n var defer;\n defer = this.defer();\n if (this.store.getAll) {\n defer.resolveWith(this.store.getAll());\n } else {\n this._mapCursor(defer, function(cursor) {\n return cursor.value;\n });\n }\n return defer.promise;\n };\n\n ObjectStore.prototype.eachWhere = function(query) {\n var defer, direction, indexName, keyRange, req;\n defer = this.defer();\n indexName = query.indexName;\n keyRange = query.keyRange;\n direction = query.direction;\n req = indexName ? this.store.index(indexName).openCursor(keyRange, direction) : this.store.openCursor(keyRange, direction);\n this._mapCursor(defer, (function(cursor) {\n return cursor.value;\n }), req);\n return defer.promise;\n };\n\n ObjectStore.prototype.findWhere = function(query) {\n return this.eachWhere(query);\n };\n\n\n /**\n @ngdoc function\n @name $indexedDBProvider.store.each\n @function\n \n @description\n Iterates through the items in the store\n \n @param {options.beginKey} the key to start iterating from\n @param {options.endKey} the key to stop iterating at\n @param {options.direction} Direction to iterate in\n @returns {Q} A promise which notifies with each individual item and resolves with all of them.\n */\n\n ObjectStore.prototype.each = function(options) {\n if (options == null) {\n options = {};\n }\n return this.eachBy(void 0, options);\n };\n\n\n /**\n @ngdoc function\n @name $indexedDBProvider.store.eachBy\n @function\n \n @description\n Iterates through the items in the store using an index\n \n @param {indexName} name of the index to use instead of the primary\n @param {options.beginKey} the key to start iterating from\n @param {options.endKey} the key to stop iterating at\n @param {options.direction} Direction to iterate in\n @returns {Q} A promise which notifies with each individual item and resolves with all of them.\n */\n\n ObjectStore.prototype.eachBy = function(indexName, options) {\n var q;\n if (indexName == null) {\n indexName = void 0;\n }\n if (options == null) {\n options = {};\n }\n q = new Query();\n q.indexName = indexName;\n q.keyRange = keyRangeForOptions(options);\n q.direction = options.direction || defaultQueryOptions.direction;\n return this.eachWhere(q);\n };\n\n\n /**\n @ngdoc function\n @name $indexedDBProvider.store.count\n @function\n \n @description\n Returns a count of the items in the store\n \n @returns {Q} A promise which resolves with the count of all the items in the store.\n */\n\n ObjectStore.prototype.count = function() {\n var defer;\n defer = this.defer();\n defer.resolveWith(this.store.count());\n return defer.promise;\n };\n\n\n /**\n @ngdoc function\n @name $indexedDBProvider.store.find\n @function\n \n @description\n Fetches an item from the store\n \n @returns {Q} A promise which resolves with the item from the store\n */\n\n ObjectStore.prototype.find = function(key) {\n var defer, req;\n defer = this.defer();\n req = this.store.get(key);\n defer.rejectWith(req);\n req.onsuccess = (function(_this) {\n return function(e) {\n if (e.target.result) {\n return defer.resolve(e.target.result);\n } else {\n return defer.reject(\"\" + _this.storeName + \":\" + key + \" not found.\");\n }\n };\n })(this);\n return defer.promise;\n };\n\n\n /**\n @ngdoc function\n @name $indexedDBProvider.store.findBy\n @function\n \n @description\n Fetches an item from the store using a named index.\n \n @returns {Q} A promise which resolves with the item from the store.\n */\n\n ObjectStore.prototype.findBy = function(index, key) {\n var defer;\n defer = this.defer();\n defer.resolveWith(this.store.index(index).get(key));\n return defer.promise;\n };\n\n ObjectStore.prototype.query = function() {\n return new Query();\n };\n\n return ObjectStore;\n\n })();\n Query = (function() {\n function Query() {\n this.indexName = void 0;\n this.keyRange = void 0;\n this.direction = cursorDirection.next;\n }\n\n Query.prototype.$lt = function(value) {\n this.keyRange = IDBKeyRange.upperBound(value, true);\n return this;\n };\n\n Query.prototype.$gt = function(value) {\n this.keyRange = IDBKeyRange.lowerBound(value, true);\n return this;\n };\n\n Query.prototype.$lte = function(value) {\n this.keyRange = IDBKeyRange.upperBound(value);\n return this;\n };\n\n Query.prototype.$gte = function(value) {\n this.keyRange = IDBKeyRange.lowerBound(value);\n return this;\n };\n\n Query.prototype.$eq = function(value) {\n this.keyRange = IDBKeyRange.only(value);\n return this;\n };\n\n Query.prototype.$between = function(low, hi, exLow, exHi) {\n if (exLow == null) {\n exLow = false;\n }\n if (exHi == null) {\n exHi = false;\n }\n this.keyRange = IDBKeyRange.bound(low, hi, exLow, exHi);\n return this;\n };\n\n Query.prototype.$desc = function(unique) {\n this.direction = unique ? cursorDirection.prevunique : cursorDirection.prev;\n return this;\n };\n\n Query.prototype.$asc = function(unique) {\n this.direction = unique ? cursorDirection.nextunique : cursorDirection.next;\n return this;\n };\n\n Query.prototype.$index = function(indexName) {\n this.indexName = indexName;\n return this;\n };\n\n return Query;\n\n })();\n return {\n\n /**\n @ngdoc method\n @name $indexedDB.objectStore\n @function\n \n @description an IDBObjectStore to use\n \n @params {string} storeName the name of the objectstore to use\n @returns {object} ObjectStore\n */\n openStore: function(storeName, callBack, mode) {\n if (mode == null) {\n mode = dbMode.readwrite;\n }\n return openTransaction([storeName], mode).then(function(transaction) {\n var results;\n results = callBack(new ObjectStore(storeName, transaction));\n return appendResultsToPromise(transaction.promise, results);\n });\n },\n openStores: function(storeNames, callback, mode) {\n if (mode == null) {\n mode = dbMode.readwrite;\n }\n return openTransaction(storeNames, mode).then(function(transaction) {\n var objectStores, results, storeName;\n objectStores = (function() {\n var _i, _len, _results;\n _results = [];\n for (_i = 0, _len = storeNames.length; _i < _len; _i++) {\n storeName = storeNames[_i];\n _results.push(new ObjectStore(storeName, transaction));\n }\n return _results;\n })();\n results = callback.apply(null, objectStores);\n return appendResultsToPromise(transaction.promise, results);\n });\n },\n openAllStores: function(callback, mode) {\n if (mode == null) {\n mode = dbMode.readwrite;\n }\n return openDatabase().then((function(_this) {\n return function() {\n var objectStores, results, storeName, storeNames, transaction;\n storeNames = Array.prototype.slice.apply(db.objectStoreNames);\n transaction = new Transaction(storeNames, mode);\n objectStores = (function() {\n var _i, _len, _results;\n _results = [];\n for (_i = 0, _len = storeNames.length; _i < _len; _i++) {\n storeName = storeNames[_i];\n _results.push(new ObjectStore(storeName, transaction));\n }\n return _results;\n })();\n results = callback.apply(null, objectStores);\n return appendResultsToPromise(transaction.promise, results);\n };\n })(this));\n },\n\n /**\n @ngdoc method\n @name $indexedDB.closeDatabase\n @function\n \n @description Closes the database for use and completes all transactions.\n */\n closeDatabase: function() {\n return closeDatabase();\n },\n\n /**\n @ngdoc method\n @name $indexedDB.deleteDatabase\n @function\n \n @description Closes and then destroys the current database. Returns a promise that resolves when this is persisted.\n */\n deleteDatabase: function() {\n return closeDatabase().then(function() {\n var defer;\n defer = new DbQ();\n defer.resolveWith(indexedDB.deleteDatabase(dbName));\n return defer.promise;\n })[\"finally\"](function() {\n return $log.log(\"$indexedDB: \" + dbName + \" database deleted.\");\n });\n },\n queryDirection: apiDirection,\n flush: function() {\n if (allTransactions.length > 0) {\n return $q.all(allTransactions);\n } else {\n return $q.when([]);\n }\n },\n\n /**\n @ngdoc method\n @name $indexedDB.databaseInfo\n @function\n \n @description Returns information about this database.\n */\n databaseInfo: function() {\n return openDatabase().then(function() {\n var storeNames, transaction;\n transaction = null;\n storeNames = Array.prototype.slice.apply(db.objectStoreNames);\n return openTransaction(storeNames, dbMode.readonly).then(function(transaction) {\n var store, storeName, stores;\n stores = (function() {\n var _i, _len, _results;\n _results = [];\n for (_i = 0, _len = storeNames.length; _i < _len; _i++) {\n storeName = storeNames[_i];\n store = transaction.objectStore(storeName);\n _results.push({\n name: storeName,\n keyPath: store.keyPath,\n autoIncrement: store.autoIncrement,\n indices: Array.prototype.slice.apply(store.indexNames)\n });\n }\n return _results;\n })();\n return transaction.promise.then(function() {\n return {\n name: db.name,\n version: db.version,\n objectStores: stores\n };\n });\n });\n });\n }\n };\n }\n ];\n });\n\n}).call(this);\n\n//# sourceMappingURL=angular-indexed-db.js.map\n"]}