Skip to content

Commit

Permalink
release v - 3.11.0
Browse files Browse the repository at this point in the history
  • Loading branch information
ujjwalguptaofficial committed Nov 1, 2020
1 parent 164d001 commit 7c6a106
Show file tree
Hide file tree
Showing 15 changed files with 100 additions and 149 deletions.
98 changes: 38 additions & 60 deletions dist/jsstore.commonjs2.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/jsstore.commonjs2.js.map

Large diffs are not rendered by default.

111 changes: 43 additions & 68 deletions dist/jsstore.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*!
* @license :jsstore - V3.10.4 - 10/10/2020
* @license :jsstore - V3.11.0 - 01/11/2020
* https://github.com/ujjwalguptaofficial/JsStore
* Copyright (c) 2020 @Ujjwal Gupta; Licensed MIT
*/
Expand Down Expand Up @@ -295,13 +295,6 @@ function (module, __webpack_exports__, __webpack_require__) {
);
});

__webpack_require__.d(__webpack_exports__, "useSqlWeb", function () {
return (
/* reexport */
useSqlWeb
);
});

__webpack_require__.d(__webpack_exports__, "DATA_TYPE", function () {
return (
/* reexport */
Expand Down Expand Up @@ -532,7 +525,8 @@ function (module, __webpack_exports__, __webpack_require__) {
this.requestQueue_ = [];
this.isCodeExecuting_ = false;
this.inactivityTimer_ = -1000;
this.eventQueue = []; // these apis have special permissions. These apis dont wait for database open.
this.eventQueue = [];
this.middlewares = []; // these apis have special permissions. These apis dont wait for database open.

this.whiteListApi_ = [API.InitDb, API.IsDbExist, API.GetDbVersion, API.GetDbList, API.OpenDb, API.GetDbSchema, API.Get, API.Set, API.ChangeLogStatus, API.Terminate, API.InitKeyStore];

Expand Down Expand Up @@ -617,31 +611,47 @@ function (module, __webpack_exports__, __webpack_require__) {
}, 1);
};

ConnectionHelper.prototype.pushApi = function (request) {
ConnectionHelper.prototype.executeMiddleware_ = function (input) {
var _this = this;

return new Promise(function (resolve, reject) {
request.onSuccess = function (result) {
resolve(result);
};
return new Promise(function (res) {
var index = 0;
var lastIndex = _this.middlewares.length - 1;

request.onError = function (error) {
reject(error);
var callNextMiddleware = function () {
if (index <= lastIndex) {
_this.middlewares[index++](input, callNextMiddleware);
} else {
res();
}
};

if (_this.requestQueue_.length === 0) {
_this.callEvent(EVENT.RequestQueueFilled, []);
callNextMiddleware();
});
};

ConnectionHelper.prototype.pushApi = function (request) {
var _this = this;

if (_this.isDbIdle_ === true && _this.isDbOpened_ === true) {
_this.openDb_();
} else {
clearTimeout(_this.inactivityTimer_);
return new Promise(function (resolve, reject) {
_this.executeMiddleware_(request).then(function () {
request.onSuccess = resolve;
request.onError = reject;

_this.initKeyStore_();
if (_this.requestQueue_.length === 0) {
_this.callEvent(EVENT.RequestQueueFilled, []);

if (_this.isDbIdle_ === true && _this.isDbOpened_ === true) {
_this.openDb_();
} else {
clearTimeout(_this.inactivityTimer_);

_this.initKeyStore_();
}
}
}

_this.prcoessExecutionOfQry_(request);
_this.prcoessExecutionOfQry_(request);
}).catch(reject);
});
};

Expand Down Expand Up @@ -716,25 +726,6 @@ function (module, __webpack_exports__, __webpack_require__) {
};

return ConnectionHelper;
}(); // CONCATENATED MODULE: ./src/main/util.ts


var Util =
/** @class */
function () {
function Util() {}

Object.defineProperty(Util, "sqlWeb", {
get: function () {
return Util.sqlWeb_ == null ? self['SqlWeb'] : Util.sqlWeb_;
},
set: function (value) {
Util.sqlWeb_ = value;
},
enumerable: false,
configurable: true
});
return Util;
}(); // CONCATENATED MODULE: ./src/main/connection.ts


Expand Down Expand Up @@ -1048,19 +1039,6 @@ function (module, __webpack_exports__, __webpack_require__) {
query: query
});
};
/**
* run sql code
*
* @param {(string | object)} query
* @returns {Promise<any>}
* @memberof Instance
*/


Connection.prototype.runSql = function (query) {
var result = Util.sqlWeb.parseSql(query);
return this[result.api](result.data);
};

Connection.prototype.on = function (event, eventCallBack) {
this.eventQueue.push({
Expand Down Expand Up @@ -1096,6 +1074,14 @@ function (module, __webpack_exports__, __webpack_require__) {
});
};

Connection.prototype.addPlugin = function (plugin, params) {
plugin.setup(this, params);
};

Connection.prototype.addMiddleware = function (middleware) {
this.middlewares.push(middleware);
};

return Connection;
}(connection_helper_ConnectionHelper); // CONCATENATED MODULE: ./src/main/instance.ts

Expand All @@ -1117,17 +1103,6 @@ function (module, __webpack_exports__, __webpack_require__) {

var enableLog = function () {
Config.isLogEnabled = true;
}; // CONCATENATED MODULE: ./src/main/global.ts

/**
*
* supply sqlweb
* @param {*} value
*/


var useSqlWeb = function (value) {
Util.sqlWeb = value;
}; // CONCATENATED MODULE: ./src/main/index.ts

/***/
Expand Down
2 changes: 1 addition & 1 deletion dist/jsstore.js.map

Large diffs are not rendered by default.

Loading

0 comments on commit 7c6a106

Please sign in to comment.