Fixed webpack configuration issue and updated webpack
This commit is contained in:
parent
494cd97442
commit
fa986fcdc9
356
lib/pawsqlite.js
356
lib/pawsqlite.js
@ -1,102 +1,17 @@
|
|||||||
module.exports =
|
/******/ (() => { // webpackBootstrap
|
||||||
/******/ (function(modules) { // webpackBootstrap
|
/******/ "use strict";
|
||||||
/******/ // The module cache
|
/******/ var __webpack_modules__ = ({
|
||||||
/******/ var installedModules = {};
|
|
||||||
/******/
|
|
||||||
/******/ // The require function
|
|
||||||
/******/ function __webpack_require__(moduleId) {
|
|
||||||
/******/
|
|
||||||
/******/ // Check if module is in cache
|
|
||||||
/******/ if(installedModules[moduleId]) {
|
|
||||||
/******/ return installedModules[moduleId].exports;
|
|
||||||
/******/ }
|
|
||||||
/******/ // Create a new module (and put it into the cache)
|
|
||||||
/******/ var module = installedModules[moduleId] = {
|
|
||||||
/******/ i: moduleId,
|
|
||||||
/******/ l: false,
|
|
||||||
/******/ exports: {}
|
|
||||||
/******/ };
|
|
||||||
/******/
|
|
||||||
/******/ // Execute the module function
|
|
||||||
/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
|
|
||||||
/******/
|
|
||||||
/******/ // Flag the module as loaded
|
|
||||||
/******/ module.l = true;
|
|
||||||
/******/
|
|
||||||
/******/ // Return the exports of the module
|
|
||||||
/******/ return module.exports;
|
|
||||||
/******/ }
|
|
||||||
/******/
|
|
||||||
/******/
|
|
||||||
/******/ // expose the modules object (__webpack_modules__)
|
|
||||||
/******/ __webpack_require__.m = modules;
|
|
||||||
/******/
|
|
||||||
/******/ // expose the module cache
|
|
||||||
/******/ __webpack_require__.c = installedModules;
|
|
||||||
/******/
|
|
||||||
/******/ // define getter function for harmony exports
|
|
||||||
/******/ __webpack_require__.d = function(exports, name, getter) {
|
|
||||||
/******/ if(!__webpack_require__.o(exports, name)) {
|
|
||||||
/******/ Object.defineProperty(exports, name, { enumerable: true, get: getter });
|
|
||||||
/******/ }
|
|
||||||
/******/ };
|
|
||||||
/******/
|
|
||||||
/******/ // define __esModule on exports
|
|
||||||
/******/ __webpack_require__.r = function(exports) {
|
|
||||||
/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
|
|
||||||
/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
||||||
/******/ }
|
|
||||||
/******/ Object.defineProperty(exports, '__esModule', { value: true });
|
|
||||||
/******/ };
|
|
||||||
/******/
|
|
||||||
/******/ // create a fake namespace object
|
|
||||||
/******/ // mode & 1: value is a module id, require it
|
|
||||||
/******/ // mode & 2: merge all properties of value into the ns
|
|
||||||
/******/ // mode & 4: return value when already ns object
|
|
||||||
/******/ // mode & 8|1: behave like require
|
|
||||||
/******/ __webpack_require__.t = function(value, mode) {
|
|
||||||
/******/ if(mode & 1) value = __webpack_require__(value);
|
|
||||||
/******/ if(mode & 8) return value;
|
|
||||||
/******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;
|
|
||||||
/******/ var ns = Object.create(null);
|
|
||||||
/******/ __webpack_require__.r(ns);
|
|
||||||
/******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value });
|
|
||||||
/******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));
|
|
||||||
/******/ return ns;
|
|
||||||
/******/ };
|
|
||||||
/******/
|
|
||||||
/******/ // getDefaultExport function for compatibility with non-harmony modules
|
|
||||||
/******/ __webpack_require__.n = function(module) {
|
|
||||||
/******/ var getter = module && module.__esModule ?
|
|
||||||
/******/ function getDefault() { return module['default']; } :
|
|
||||||
/******/ function getModuleExports() { return module; };
|
|
||||||
/******/ __webpack_require__.d(getter, 'a', getter);
|
|
||||||
/******/ return getter;
|
|
||||||
/******/ };
|
|
||||||
/******/
|
|
||||||
/******/ // Object.prototype.hasOwnProperty.call
|
|
||||||
/******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
|
|
||||||
/******/
|
|
||||||
/******/ // __webpack_public_path__
|
|
||||||
/******/ __webpack_require__.p = "";
|
|
||||||
/******/
|
|
||||||
/******/
|
|
||||||
/******/ // Load entry module and return exports
|
|
||||||
/******/ return __webpack_require__(__webpack_require__.s = "./src/pawsqlite.mjs");
|
|
||||||
/******/ })
|
|
||||||
/************************************************************************/
|
|
||||||
/******/ ({
|
|
||||||
|
|
||||||
/***/ "./src/adapter_wrapper.mjs":
|
/***/ "./src/adapter_wrapper.mjs":
|
||||||
/*!*********************************!*\
|
/*!*********************************!*\
|
||||||
!*** ./src/adapter_wrapper.mjs ***!
|
!*** ./src/adapter_wrapper.mjs ***!
|
||||||
\*********************************/
|
\*********************************/
|
||||||
/*! exports provided: wrapAdapter */
|
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||||||
/***/ (function(__webpack_module__, __webpack_exports__, __webpack_require__) {
|
|
||||||
|
|
||||||
"use strict";
|
|
||||||
__webpack_require__.r(__webpack_exports__);
|
__webpack_require__.r(__webpack_exports__);
|
||||||
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "wrapAdapter", function() { return wrapAdapter; });
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
||||||
|
/* harmony export */ "wrapAdapter": () => (/* binding */ wrapAdapter)
|
||||||
|
/* harmony export */ });
|
||||||
/* harmony import */ var _pawsqlite_error_mjs__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./pawsqlite_error.mjs */ "./src/pawsqlite_error.mjs");
|
/* harmony import */ var _pawsqlite_error_mjs__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./pawsqlite_error.mjs */ "./src/pawsqlite_error.mjs");
|
||||||
|
|
||||||
|
|
||||||
@ -106,7 +21,7 @@ function wrapAdapter(adapter) {
|
|||||||
|
|
||||||
["name", "open", "close", "delete", "sql"].forEach((prop) => {
|
["name", "open", "close", "delete", "sql"].forEach((prop) => {
|
||||||
if (!(prop in adapter)) {
|
if (!(prop in adapter)) {
|
||||||
throw new _pawsqlite_error_mjs__WEBPACK_IMPORTED_MODULE_0__["PawSQLiteError"](`Invalid adapter: missing property: ${ prop }`);
|
throw new _pawsqlite_error_mjs__WEBPACK_IMPORTED_MODULE_0__.PawSQLiteError(`Invalid adapter: missing property: ${ prop }`);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (
|
if (
|
||||||
@ -118,7 +33,7 @@ function wrapAdapter(adapter) {
|
|||||||
typeof adapter[prop] !== "function"
|
typeof adapter[prop] !== "function"
|
||||||
)
|
)
|
||||||
) {
|
) {
|
||||||
throw new _pawsqlite_error_mjs__WEBPACK_IMPORTED_MODULE_0__["PawSQLiteError"]("Invalid adapter: invalid type for property: " +
|
throw new _pawsqlite_error_mjs__WEBPACK_IMPORTED_MODULE_0__.PawSQLiteError("Invalid adapter: invalid type for property: " +
|
||||||
prop);
|
prop);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -127,7 +42,7 @@ function wrapAdapter(adapter) {
|
|||||||
try {
|
try {
|
||||||
return await adapter[prop](...args);
|
return await adapter[prop](...args);
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
throw _pawsqlite_error_mjs__WEBPACK_IMPORTED_MODULE_0__["PawSQLiteError"].from(err);
|
throw _pawsqlite_error_mjs__WEBPACK_IMPORTED_MODULE_0__.PawSQLiteError.from(err);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
} else {
|
} else {
|
||||||
@ -144,12 +59,12 @@ function wrapAdapter(adapter) {
|
|||||||
/*!**************************!*\
|
/*!**************************!*\
|
||||||
!*** ./src/database.mjs ***!
|
!*** ./src/database.mjs ***!
|
||||||
\**************************/
|
\**************************/
|
||||||
/*! exports provided: Database */
|
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||||||
/***/ (function(__webpack_module__, __webpack_exports__, __webpack_require__) {
|
|
||||||
|
|
||||||
"use strict";
|
|
||||||
__webpack_require__.r(__webpack_exports__);
|
__webpack_require__.r(__webpack_exports__);
|
||||||
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Database", function() { return Database; });
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
||||||
|
/* harmony export */ "Database": () => (/* binding */ Database)
|
||||||
|
/* harmony export */ });
|
||||||
/* harmony import */ var _transaction_manager_mjs__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./transaction_manager.mjs */ "./src/transaction_manager.mjs");
|
/* harmony import */ var _transaction_manager_mjs__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./transaction_manager.mjs */ "./src/transaction_manager.mjs");
|
||||||
|
|
||||||
|
|
||||||
@ -161,7 +76,7 @@ class Database {
|
|||||||
this.version = null;
|
this.version = null;
|
||||||
this.path = null;
|
this.path = null;
|
||||||
|
|
||||||
this.transactionManager = new _transaction_manager_mjs__WEBPACK_IMPORTED_MODULE_0__["TransactionManager"](dbName, this.adapter);
|
this.transactionManager = new _transaction_manager_mjs__WEBPACK_IMPORTED_MODULE_0__.TransactionManager(dbName, this.adapter);
|
||||||
}
|
}
|
||||||
|
|
||||||
async open() {
|
async open() {
|
||||||
@ -222,13 +137,13 @@ class Database {
|
|||||||
/*!*********************!*\
|
/*!*********************!*\
|
||||||
!*** ./src/log.mjs ***!
|
!*** ./src/log.mjs ***!
|
||||||
\*********************/
|
\*********************/
|
||||||
/*! exports provided: log, enableDebug */
|
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||||||
/***/ (function(__webpack_module__, __webpack_exports__, __webpack_require__) {
|
|
||||||
|
|
||||||
"use strict";
|
|
||||||
__webpack_require__.r(__webpack_exports__);
|
__webpack_require__.r(__webpack_exports__);
|
||||||
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "log", function() { return log; });
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
||||||
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "enableDebug", function() { return enableDebug; });
|
/* harmony export */ "log": () => (/* binding */ log),
|
||||||
|
/* harmony export */ "enableDebug": () => (/* binding */ enableDebug)
|
||||||
|
/* harmony export */ });
|
||||||
let DEBUG = false;
|
let DEBUG = false;
|
||||||
|
|
||||||
function log(...args) {
|
function log(...args) {
|
||||||
@ -249,79 +164,16 @@ function enableDebug(active) {
|
|||||||
|
|
||||||
/***/ }),
|
/***/ }),
|
||||||
|
|
||||||
/***/ "./src/pawsqlite.mjs":
|
|
||||||
/*!***************************!*\
|
|
||||||
!*** ./src/pawsqlite.mjs ***!
|
|
||||||
\***************************/
|
|
||||||
/*! exports provided: default */
|
|
||||||
/***/ (function(__webpack_module__, __webpack_exports__, __webpack_require__) {
|
|
||||||
|
|
||||||
"use strict";
|
|
||||||
__webpack_require__.r(__webpack_exports__);
|
|
||||||
/* harmony import */ var _database_mjs__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./database.mjs */ "./src/database.mjs");
|
|
||||||
/* harmony import */ var _adapter_wrapper_mjs__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./adapter_wrapper.mjs */ "./src/adapter_wrapper.mjs");
|
|
||||||
/* harmony import */ var _pawsqlite_error_mjs__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./pawsqlite_error.mjs */ "./src/pawsqlite_error.mjs");
|
|
||||||
/* harmony import */ var _log_mjs__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./log.mjs */ "./src/log.mjs");
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
const adapters = [];
|
|
||||||
|
|
||||||
|
|
||||||
/* harmony default export */ __webpack_exports__["default"] = ({
|
|
||||||
open: async function(dbName, options = {}) {
|
|
||||||
const adapter = getAdapter(options.adapter);
|
|
||||||
|
|
||||||
let db = new _database_mjs__WEBPACK_IMPORTED_MODULE_0__["Database"](dbName, adapter);
|
|
||||||
await db.open();
|
|
||||||
return db;
|
|
||||||
},
|
|
||||||
delete: function(dbName, options = {}) {
|
|
||||||
const adapter = getAdapter(options.adapter);
|
|
||||||
|
|
||||||
return adapter.delete(dbName);
|
|
||||||
},
|
|
||||||
registerAdapter: function(adapter) {
|
|
||||||
const wrapped = Object(_adapter_wrapper_mjs__WEBPACK_IMPORTED_MODULE_1__["wrapAdapter"])(adapter);
|
|
||||||
|
|
||||||
if (getAdapter(wrapped.name)) {
|
|
||||||
throw new _pawsqlite_error_mjs__WEBPACK_IMPORTED_MODULE_2__["PawSQLiteError"](`An adapter with the name: ${ wrapped.name } ` +
|
|
||||||
`Already exists`);
|
|
||||||
}
|
|
||||||
|
|
||||||
adapters.push(wrapped);
|
|
||||||
},
|
|
||||||
debug: _log_mjs__WEBPACK_IMPORTED_MODULE_3__["enableDebug"],
|
|
||||||
Error: _pawsqlite_error_mjs__WEBPACK_IMPORTED_MODULE_2__["PawSQLiteError"]
|
|
||||||
});
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
function getAdapter(adapterName, silent=false) {
|
|
||||||
const adapter = adapters.find((a) => a.name === adapterName);
|
|
||||||
|
|
||||||
if (!(silent || adapter)) {
|
|
||||||
throw new _pawsqlite_error_mjs__WEBPACK_IMPORTED_MODULE_2__["PawSQLiteError"](`Unknown Adapter: ${adapterName}`);
|
|
||||||
}
|
|
||||||
|
|
||||||
return adapter;
|
|
||||||
}
|
|
||||||
|
|
||||||
/***/ }),
|
|
||||||
|
|
||||||
/***/ "./src/pawsqlite_error.mjs":
|
/***/ "./src/pawsqlite_error.mjs":
|
||||||
/*!*********************************!*\
|
/*!*********************************!*\
|
||||||
!*** ./src/pawsqlite_error.mjs ***!
|
!*** ./src/pawsqlite_error.mjs ***!
|
||||||
\*********************************/
|
\*********************************/
|
||||||
/*! exports provided: PawSQLiteError */
|
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||||||
/***/ (function(__webpack_module__, __webpack_exports__, __webpack_require__) {
|
|
||||||
|
|
||||||
"use strict";
|
|
||||||
__webpack_require__.r(__webpack_exports__);
|
__webpack_require__.r(__webpack_exports__);
|
||||||
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "PawSQLiteError", function() { return PawSQLiteError; });
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
||||||
|
/* harmony export */ "PawSQLiteError": () => (/* binding */ PawSQLiteError)
|
||||||
|
/* harmony export */ });
|
||||||
class PawSQLiteError extends Error {
|
class PawSQLiteError extends Error {
|
||||||
static from(err) {
|
static from(err) {
|
||||||
const p_err = new PawSQLiteError(err.toString());
|
const p_err = new PawSQLiteError(err.toString());
|
||||||
@ -341,12 +193,12 @@ class PawSQLiteError extends Error {
|
|||||||
/*!************************!*\
|
/*!************************!*\
|
||||||
!*** ./src/result.mjs ***!
|
!*** ./src/result.mjs ***!
|
||||||
\************************/
|
\************************/
|
||||||
/*! exports provided: Result */
|
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||||||
/***/ (function(__webpack_module__, __webpack_exports__, __webpack_require__) {
|
|
||||||
|
|
||||||
"use strict";
|
|
||||||
__webpack_require__.r(__webpack_exports__);
|
__webpack_require__.r(__webpack_exports__);
|
||||||
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Result", function() { return Result; });
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
||||||
|
/* harmony export */ "Result": () => (/* binding */ Result)
|
||||||
|
/* harmony export */ });
|
||||||
/* harmony import */ var _pawsqlite_error_mjs__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./pawsqlite_error.mjs */ "./src/pawsqlite_error.mjs");
|
/* harmony import */ var _pawsqlite_error_mjs__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./pawsqlite_error.mjs */ "./src/pawsqlite_error.mjs");
|
||||||
|
|
||||||
|
|
||||||
@ -374,12 +226,12 @@ class Result extends Array {
|
|||||||
/*!*****************************!*\
|
/*!*****************************!*\
|
||||||
!*** ./src/transaction.mjs ***!
|
!*** ./src/transaction.mjs ***!
|
||||||
\*****************************/
|
\*****************************/
|
||||||
/*! exports provided: Transaction */
|
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||||||
/***/ (function(__webpack_module__, __webpack_exports__, __webpack_require__) {
|
|
||||||
|
|
||||||
"use strict";
|
|
||||||
__webpack_require__.r(__webpack_exports__);
|
__webpack_require__.r(__webpack_exports__);
|
||||||
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Transaction", function() { return Transaction; });
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
||||||
|
/* harmony export */ "Transaction": () => (/* binding */ Transaction)
|
||||||
|
/* harmony export */ });
|
||||||
/* harmony import */ var _result_mjs__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./result.mjs */ "./src/result.mjs");
|
/* harmony import */ var _result_mjs__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./result.mjs */ "./src/result.mjs");
|
||||||
/* harmony import */ var _pawsqlite_error_mjs__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./pawsqlite_error.mjs */ "./src/pawsqlite_error.mjs");
|
/* harmony import */ var _pawsqlite_error_mjs__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./pawsqlite_error.mjs */ "./src/pawsqlite_error.mjs");
|
||||||
|
|
||||||
@ -402,7 +254,7 @@ class Transaction {
|
|||||||
|
|
||||||
async sql(sql, ...args) {
|
async sql(sql, ...args) {
|
||||||
if (this._finalized) {
|
if (this._finalized) {
|
||||||
throw new _pawsqlite_error_mjs__WEBPACK_IMPORTED_MODULE_1__["PawSQLiteError"]("Transaction has already completed");
|
throw new _pawsqlite_error_mjs__WEBPACK_IMPORTED_MODULE_1__.PawSQLiteError("Transaction has already completed");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!this._ready) {
|
if (!this._ready) {
|
||||||
@ -430,7 +282,7 @@ class Transaction {
|
|||||||
.filter(Array.isArray)
|
.filter(Array.isArray)
|
||||||
.map((a) => a.length);
|
.map((a) => a.length);
|
||||||
if (parts.length !== subParamLengths.length + 1) {
|
if (parts.length !== subParamLengths.length + 1) {
|
||||||
throw new _pawsqlite_error_mjs__WEBPACK_IMPORTED_MODULE_1__["PawSQLiteError"]("Unable to build query: sub-" +
|
throw new _pawsqlite_error_mjs__WEBPACK_IMPORTED_MODULE_1__.PawSQLiteError("Unable to build query: sub-" +
|
||||||
"paramters do not match sub-paramters in query");
|
"paramters do not match sub-paramters in query");
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -476,14 +328,14 @@ class Transaction {
|
|||||||
const match = reg.exec(sql);
|
const match = reg.exec(sql);
|
||||||
if (match) {
|
if (match) {
|
||||||
const statement = match[1].toUpperCase();
|
const statement = match[1].toUpperCase();
|
||||||
throw new _pawsqlite_error_mjs__WEBPACK_IMPORTED_MODULE_1__["PawSQLiteError"]("Manually managing transactions is " +
|
throw new _pawsqlite_error_mjs__WEBPACK_IMPORTED_MODULE_1__.PawSQLiteError("Manually managing transactions is " +
|
||||||
"forbidden. Found: \"" + statement + "\" statement.");
|
"forbidden. Found: \"" + statement + "\" statement.");
|
||||||
}
|
}
|
||||||
|
|
||||||
const result = await this.adapter.sql(this.dbName,
|
const result = await this.adapter.sql(this.dbName,
|
||||||
...this.buildQuery(sql, ...args));
|
...this.buildQuery(sql, ...args));
|
||||||
|
|
||||||
return new _result_mjs__WEBPACK_IMPORTED_MODULE_0__["Result"](result);
|
return new _result_mjs__WEBPACK_IMPORTED_MODULE_0__.Result(result);
|
||||||
}
|
}
|
||||||
|
|
||||||
async _begin() {
|
async _begin() {
|
||||||
@ -492,7 +344,7 @@ class Transaction {
|
|||||||
|
|
||||||
async _complete(sql) {
|
async _complete(sql) {
|
||||||
if (this._finalized) {
|
if (this._finalized) {
|
||||||
throw new _pawsqlite_error_mjs__WEBPACK_IMPORTED_MODULE_1__["PawSQLiteError"]("Transaction has already completed");
|
throw new _pawsqlite_error_mjs__WEBPACK_IMPORTED_MODULE_1__.PawSQLiteError("Transaction has already completed");
|
||||||
}
|
}
|
||||||
this._finalized = true;
|
this._finalized = true;
|
||||||
|
|
||||||
@ -517,7 +369,7 @@ class Transaction {
|
|||||||
throw error;
|
throw error;
|
||||||
}
|
}
|
||||||
|
|
||||||
return new _result_mjs__WEBPACK_IMPORTED_MODULE_0__["Result"](result);
|
return new _result_mjs__WEBPACK_IMPORTED_MODULE_0__.Result(result);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -527,12 +379,12 @@ class Transaction {
|
|||||||
/*!*************************************!*\
|
/*!*************************************!*\
|
||||||
!*** ./src/transaction_manager.mjs ***!
|
!*** ./src/transaction_manager.mjs ***!
|
||||||
\*************************************/
|
\*************************************/
|
||||||
/*! exports provided: TransactionManager */
|
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||||||
/***/ (function(__webpack_module__, __webpack_exports__, __webpack_require__) {
|
|
||||||
|
|
||||||
"use strict";
|
|
||||||
__webpack_require__.r(__webpack_exports__);
|
__webpack_require__.r(__webpack_exports__);
|
||||||
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "TransactionManager", function() { return TransactionManager; });
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
||||||
|
/* harmony export */ "TransactionManager": () => (/* binding */ TransactionManager)
|
||||||
|
/* harmony export */ });
|
||||||
/* harmony import */ var _transaction_mjs__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./transaction.mjs */ "./src/transaction.mjs");
|
/* harmony import */ var _transaction_mjs__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./transaction.mjs */ "./src/transaction.mjs");
|
||||||
|
|
||||||
|
|
||||||
@ -545,7 +397,7 @@ class TransactionManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
transaction() {
|
transaction() {
|
||||||
return new _transaction_mjs__WEBPACK_IMPORTED_MODULE_0__["Transaction"](this.dbName, this.adapter,
|
return new _transaction_mjs__WEBPACK_IMPORTED_MODULE_0__.Transaction(this.dbName, this.adapter,
|
||||||
this.enqueue.bind(this));
|
this.enqueue.bind(this));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -592,5 +444,125 @@ class TransactionManager {
|
|||||||
|
|
||||||
/***/ })
|
/***/ })
|
||||||
|
|
||||||
/******/ })["default"];
|
/******/ });
|
||||||
|
/************************************************************************/
|
||||||
|
/******/ // 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/pawsqlite.mjs ***!
|
||||||
|
\***************************/
|
||||||
|
__webpack_require__.r(__webpack_exports__);
|
||||||
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
||||||
|
/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)
|
||||||
|
/* harmony export */ });
|
||||||
|
/* harmony import */ var _database_mjs__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./database.mjs */ "./src/database.mjs");
|
||||||
|
/* harmony import */ var _adapter_wrapper_mjs__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./adapter_wrapper.mjs */ "./src/adapter_wrapper.mjs");
|
||||||
|
/* harmony import */ var _pawsqlite_error_mjs__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./pawsqlite_error.mjs */ "./src/pawsqlite_error.mjs");
|
||||||
|
/* harmony import */ var _log_mjs__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./log.mjs */ "./src/log.mjs");
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
const adapters = [];
|
||||||
|
|
||||||
|
|
||||||
|
/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = ({
|
||||||
|
open: async function(dbName, options = {}) {
|
||||||
|
const adapter = getAdapter(options.adapter);
|
||||||
|
|
||||||
|
let db = new _database_mjs__WEBPACK_IMPORTED_MODULE_0__.Database(dbName, adapter);
|
||||||
|
await db.open();
|
||||||
|
return db;
|
||||||
|
},
|
||||||
|
delete: function(dbName, options = {}) {
|
||||||
|
const adapter = getAdapter(options.adapter);
|
||||||
|
|
||||||
|
return adapter.delete(dbName);
|
||||||
|
},
|
||||||
|
registerAdapter: function(adapter) {
|
||||||
|
const wrapped = (0,_adapter_wrapper_mjs__WEBPACK_IMPORTED_MODULE_1__.wrapAdapter)(adapter);
|
||||||
|
|
||||||
|
if (getAdapter(wrapped.name)) {
|
||||||
|
throw new _pawsqlite_error_mjs__WEBPACK_IMPORTED_MODULE_2__.PawSQLiteError(`An adapter with the name: ${ wrapped.name } ` +
|
||||||
|
`Already exists`);
|
||||||
|
}
|
||||||
|
|
||||||
|
adapters.push(wrapped);
|
||||||
|
},
|
||||||
|
debug: _log_mjs__WEBPACK_IMPORTED_MODULE_3__.enableDebug,
|
||||||
|
Error: _pawsqlite_error_mjs__WEBPACK_IMPORTED_MODULE_2__.PawSQLiteError
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
function getAdapter(adapterName, silent=false) {
|
||||||
|
const adapter = adapters.find((a) => a.name === adapterName);
|
||||||
|
|
||||||
|
if (!(silent || adapter)) {
|
||||||
|
throw new _pawsqlite_error_mjs__WEBPACK_IMPORTED_MODULE_2__.PawSQLiteError(`Unknown Adapter: ${adapterName}`);
|
||||||
|
}
|
||||||
|
|
||||||
|
return adapter;
|
||||||
|
}
|
||||||
|
})();
|
||||||
|
|
||||||
|
module.exports = __webpack_exports__.default;
|
||||||
|
/******/ })()
|
||||||
|
;
|
||||||
//# sourceMappingURL=pawsqlite.js.map
|
//# sourceMappingURL=pawsqlite.js.map
|
File diff suppressed because one or more lines are too long
3704
package-lock.json
generated
3704
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@ -15,7 +15,7 @@
|
|||||||
"author": "Ben Ashton",
|
"author": "Ben Ashton",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"webpack": "^4.44.1",
|
"webpack": "5.x",
|
||||||
"webpack-cli": "^3.3.12"
|
"webpack-cli": "4.x"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -9,7 +9,6 @@ var config = {
|
|||||||
output: {
|
output: {
|
||||||
path: __dirname + '/lib',
|
path: __dirname + '/lib',
|
||||||
filename: outputFile,
|
filename: outputFile,
|
||||||
library: libraryName,
|
|
||||||
libraryExport: 'default',
|
libraryExport: 'default',
|
||||||
libraryTarget: 'commonjs2',
|
libraryTarget: 'commonjs2',
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user