178 lines
6.0 KiB
JavaScript
178 lines
6.0 KiB
JavaScript
|
/******/ (() => { // webpackBootstrap
|
||
|
/******/ "use strict";
|
||
|
/******/ var __webpack_modules__ = ({
|
||
|
|
||
|
/***/ "./src/log.mjs":
|
||
|
/*!*********************!*\
|
||
|
!*** ./src/log.mjs ***!
|
||
|
\*********************/
|
||
|
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
|
||
|
__webpack_require__.r(__webpack_exports__);
|
||
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
||
|
/* harmony export */ "log": () => (/* binding */ log),
|
||
|
/* harmony export */ "enableDebug": () => (/* binding */ enableDebug)
|
||
|
/* harmony export */ });
|
||
|
let DEBUG = false;
|
||
|
|
||
|
function log(...args) {
|
||
|
if (DEBUG) {
|
||
|
console.log(...args);
|
||
|
}
|
||
|
}
|
||
|
|
||
|
function enableDebug(active) {
|
||
|
DEBUG = !!active;
|
||
|
log("PawSQLite-Cordova-Adapter: debugging " + (
|
||
|
DEBUG ? "enabled" : "disabled")
|
||
|
);
|
||
|
}
|
||
|
|
||
|
/***/ }),
|
||
|
|
||
|
/***/ "./src/psql_adapter_error.mjs":
|
||
|
/*!************************************!*\
|
||
|
!*** ./src/psql_adapter_error.mjs ***!
|
||
|
\************************************/
|
||
|
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
|
||
|
__webpack_require__.r(__webpack_exports__);
|
||
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
||
|
/* harmony export */ "PSQLAdapterError": () => (/* binding */ PSQLAdapterError)
|
||
|
/* harmony export */ });
|
||
|
class PSQLAdapterError extends Error {
|
||
|
constructor(response) {
|
||
|
if (response.hasOwnProperty("message")) {
|
||
|
super(response.message);
|
||
|
} else {
|
||
|
super();
|
||
|
}
|
||
|
if (response.hasOwnProperty("name")) {
|
||
|
this.name = response.name;
|
||
|
} else {
|
||
|
this.name = "PSQLAdapterError";
|
||
|
}
|
||
|
if (response.hasOwnProperty("trace")) {
|
||
|
this.trace = response.trace;
|
||
|
}
|
||
|
}
|
||
|
|
||
|
toString() {
|
||
|
let str = this.name;
|
||
|
if (this.hasOwnProperty("message")) {
|
||
|
str += ": " + this.message;
|
||
|
}
|
||
|
if (this.hasOwnProperty("trace")) {
|
||
|
str += "\n" + this.trace;
|
||
|
}
|
||
|
return str;
|
||
|
}
|
||
|
}
|
||
|
|
||
|
/***/ })
|
||
|
|
||
|
/******/ });
|
||
|
/************************************************************************/
|
||
|
/******/ // The module cache
|
||
|
/******/ var __webpack_module_cache__ = {};
|
||
|
/******/
|
||
|
/******/ // The require function
|
||
|
/******/ function __webpack_require__(moduleId) {
|
||
|
/******/ // Check if module is in cache
|
||
|
/******/ if(__webpack_module_cache__[moduleId]) {
|
||
|
/******/ return __webpack_module_cache__[moduleId].exports;
|
||
|
/******/ }
|
||
|
/******/ // Create a new module (and put it into the cache)
|
||
|
/******/ var module = __webpack_module_cache__[moduleId] = {
|
||
|
/******/ // no module.id needed
|
||
|
/******/ // no module.loaded needed
|
||
|
/******/ exports: {}
|
||
|
/******/ };
|
||
|
/******/
|
||
|
/******/ // Execute the module function
|
||
|
/******/ __webpack_modules__[moduleId](module, module.exports, __webpack_require__);
|
||
|
/******/
|
||
|
/******/ // Return the exports of the module
|
||
|
/******/ return module.exports;
|
||
|
/******/ }
|
||
|
/******/
|
||
|
/************************************************************************/
|
||
|
/******/ /* webpack/runtime/define property getters */
|
||
|
/******/ (() => {
|
||
|
/******/ // define getter functions for harmony exports
|
||
|
/******/ __webpack_require__.d = (exports, definition) => {
|
||
|
/******/ for(var key in definition) {
|
||
|
/******/ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {
|
||
|
/******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] });
|
||
|
/******/ }
|
||
|
/******/ }
|
||
|
/******/ };
|
||
|
/******/ })();
|
||
|
/******/
|
||
|
/******/ /* webpack/runtime/hasOwnProperty shorthand */
|
||
|
/******/ (() => {
|
||
|
/******/ __webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))
|
||
|
/******/ })();
|
||
|
/******/
|
||
|
/******/ /* webpack/runtime/make namespace object */
|
||
|
/******/ (() => {
|
||
|
/******/ // define __esModule on exports
|
||
|
/******/ __webpack_require__.r = (exports) => {
|
||
|
/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
|
||
|
/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
||
|
/******/ }
|
||
|
/******/ Object.defineProperty(exports, '__esModule', { value: true });
|
||
|
/******/ };
|
||
|
/******/ })();
|
||
|
/******/
|
||
|
/************************************************************************/
|
||
|
var __webpack_exports__ = {};
|
||
|
// This entry need to be wrapped in an IIFE because it need to be isolated against other modules in the chunk.
|
||
|
(() => {
|
||
|
/*!******************************!*\
|
||
|
!*** ./src/psql_adapter.mjs ***!
|
||
|
\******************************/
|
||
|
__webpack_require__.r(__webpack_exports__);
|
||
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
||
|
/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)
|
||
|
/* harmony export */ });
|
||
|
/* harmony import */ var _psql_adapter_error_mjs__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./psql_adapter_error.mjs */ "./src/psql_adapter_error.mjs");
|
||
|
/* harmony import */ var _log_mjs__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./log.mjs */ "./src/log.mjs");
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = ({
|
||
|
name: "PawSQLiteCordovaAdapter",
|
||
|
|
||
|
open: (dbName) => new Promise((resolve, reject) => {
|
||
|
cordova.exec(resolve, (e) => {
|
||
|
reject(new _psql_adapter_error_mjs__WEBPACK_IMPORTED_MODULE_0__.PSQLAdapterError(e));
|
||
|
}, "PawSQLite", "open", [dbName]);
|
||
|
}),
|
||
|
close: (dbName) => new Promise((resolve, reject) => {
|
||
|
cordova.exec(resolve, (e) => {
|
||
|
reject(new _psql_adapter_error_mjs__WEBPACK_IMPORTED_MODULE_0__.PSQLAdapterError(e));
|
||
|
}, "PawSQLite", "close", [dbName]);
|
||
|
}),
|
||
|
sql: (dbName, sql, ...args) => new Promise((resolve, reject) => {
|
||
|
(0,_log_mjs__WEBPACK_IMPORTED_MODULE_1__.log)(sql);
|
||
|
cordova.exec(resolve, (e) => {
|
||
|
reject(new _psql_adapter_error_mjs__WEBPACK_IMPORTED_MODULE_0__.PSQLAdapterError(e));
|
||
|
}, "PawSQLite", "sql", [dbName, sql, ...args]);
|
||
|
}),
|
||
|
delete: (dbName) => new Promise((resolve, reject) => {
|
||
|
cordova.exec(resolve, (e) => {
|
||
|
reject(new _psql_adapter_error_mjs__WEBPACK_IMPORTED_MODULE_0__.PSQLAdapterError(e));
|
||
|
}, "PawSQLite", "delete", [dbName]);
|
||
|
}),
|
||
|
|
||
|
debug: _log_mjs__WEBPACK_IMPORTED_MODULE_1__.enableDebug
|
||
|
});
|
||
|
|
||
|
})();
|
||
|
|
||
|
module.exports = __webpack_exports__.default;
|
||
|
/******/ })()
|
||
|
;
|
||
|
//# sourceMappingURL=pawsqlite-cordova-adapter.js.map
|