-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathindex.js
1 lines (1 loc) · 26.8 KB
/
index.js
1
!function(e,n){if("object"==typeof exports&&"object"==typeof module)module.exports=n();else if("function"==typeof define&&define.amd)define([],n);else{var t=n();for(var r in t)("object"==typeof exports?exports:e)[r]=t[r]}}(window,(function(){return function(e){var n={};function t(r){if(n[r])return n[r].exports;var o=n[r]={i:r,l:!1,exports:{}};return e[r].call(o.exports,o,o.exports,t),o.l=!0,o.exports}return t.m=e,t.c=n,t.d=function(e,n,r){t.o(e,n)||Object.defineProperty(e,n,{enumerable:!0,get:r})},t.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},t.t=function(e,n){if(1&n&&(e=t(e)),8&n)return e;if(4&n&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(t.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&n&&"string"!=typeof e)for(var o in e)t.d(r,o,function(n){return e[n]}.bind(null,o));return r},t.n=function(e){var n=e&&e.__esModule?function(){return e.default}:function(){return e};return t.d(n,"a",n),n},t.o=function(e,n){return Object.prototype.hasOwnProperty.call(e,n)},t.p="",t(t.s=6)}([function(e,n,t){"use strict";Object.defineProperty(n,"__esModule",{value:!0}),n.ColumnType=void 0,function(e){e[e.BOOLEAN=2]="BOOLEAN",e[e.NUMBER=4]="NUMBER",e[e.STRING=8]="STRING",e[e.ARRAY=16]="ARRAY",e[e.DATE=32]="DATE",e[e.ANY=64]="ANY",e[e.PRIMARY=128]="PRIMARY"}(n.ColumnType||(n.ColumnType={}))},function(e,n,t){"use strict";Object.defineProperty(n,"__esModule",{value:!0}),n.EnvConfig=void 0;var r=function(){function e(){}return e.debug=function(e){this.enableDebugLog&&console.log(e)},e.dateFormatRemoveMillisecond=!1,e}();n.EnvConfig=r},function(e,n,t){"use strict";var r=this&&this.__awaiter||function(e,n,t,r){return new(t||(t=Promise))((function(o,i){function u(e){try{a(r.next(e))}catch(e){i(e)}}function c(e){try{a(r.throw(e))}catch(e){i(e)}}function a(e){var n;e.done?o(e.value):(n=e.value,n instanceof t?n:new t((function(e){e(n)}))).then(u,c)}a((r=r.apply(e,n||[])).next())}))},o=this&&this.__generator||function(e,n){var t,r,o,i,u={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:c(0),throw:c(1),return:c(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function c(i){return function(c){return function(i){if(t)throw new TypeError("Generator is already executing.");for(;u;)try{if(t=1,r&&(o=2&i[0]?r.return:i[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,i[1])).done)return o;switch(r=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return u.label++,{value:i[1],done:!1};case 5:u.label++,r=i[1],i=[0];continue;case 7:i=u.ops.pop(),u.trys.pop();continue;default:if(!(o=u.trys,(o=o.length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){u=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){u.label=i[1];break}if(6===i[0]&&u.label<o[1]){u.label=o[1],o=i;break}if(o&&u.label<o[2]){u.label=o[2],u.ops.push(i);break}o[2]&&u.ops.pop(),u.trys.pop();continue}i=n.call(e,u)}catch(e){i=[6,e],r=0}finally{t=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,c])}}};Object.defineProperty(n,"__esModule",{value:!0}),n.DbContext=void 0;var i=t(1),u=t(3),c=t(0),a=function(){function e(e){this.objClass=e,this.gSql=new u.GenerateSql,this.__tableName=this.objClass.__table_name__,this.dbName=this.objClass.__db_name__,this.__columnsDef=this.objClass.__columns__,this.__referencesDef=this.objClass.__references__,this.isTrace=!0,i.EnvConfig.useCordovaSqliteStorage?this.db=window.sqlitePlugin.openDatabase({name:this.dbName,location:"default"}):this.db=window.openDatabase(this.dbName,"1.0.0","",10485760)}return e.prototype.fromSql=function(n,t){return r(this,void 0,void 0,(function(){var u;return o(this,(function(c){switch(c.label){case 0:return u=this,[4,this.init()];case 1:return c.sent(),i.EnvConfig.debug("fromSql:"),i.EnvConfig.debug(n),i.EnvConfig.debug(t),[2,new Promise((function(c){u.db.transaction((function(a){var s=this;a.executeSql(n,t,(function(n,t){return r(s,void 0,void 0,(function(){var n,r,a,s,l,f,h,p,d;return o(this,(function(b){switch(b.label){case 0:if(n=[],i.EnvConfig.debug(t),null!=t.rows&&t.rows.length>0)for(a=0;a<t.rows.length;a++)r=t.rows.item(a),n.push(u.convertToMetadata(r));if(!(u.isTrace&&null!=u.__referencesDef&&u.__referencesDef.length>0&&null!=n&&n.length>0))return[3,6];a=0,b.label=1;case 1:if(!(a<n.length))return[3,6];for(h in s=n[a],l=function(n){var t,r,i,c,a,l;return o(this,(function(o){switch(o.label){case 0:if(!s.hasOwnProperty(n))return[3,4];if(t=s[n],!(null!=(r=u.__referencesDef.filter((function(e){return e.foreignKeyName==n})))&&r.length>0))return[3,4];i=0,o.label=1;case 1:return i<r.length?null==(c=r[i])?[3,3]:((a={})[c.refKeyName]=t,[4,new e(c.refTableInstance.constructor).query(a)]):[3,4];case 2:l=o.sent(),null!=c.filter?s[c.propertyName]=l.filter(c.filter):s[c.propertyName]=l,o.label=3;case 3:return i++,[3,1];case 4:return[2]}}))},f=[],s)f.push(h);p=0,b.label=2;case 2:return p<f.length?(d=f[p],[5,l(d)]):[3,5];case 3:b.sent(),b.label=4;case 4:return p++,[3,2];case 5:return a++,[3,1];case 6:return c(n),[2]}}))}))}),u.fail)}))}))]}}))}))},e.prototype.query=function(e){return r(this,void 0,void 0,(function(){var n,t,r,i;return o(this,(function(o){switch(o.label){case 0:return[4,this.init()];case 1:for(r in o.sent(),n="select * from `"+this.__tableName+"` where",t=[],e)e.hasOwnProperty(r)&&(i=e[r],n+=" "+r+"=? and",t.push(i));return n=n.substr(0,n.length-3),[4,this.fromSql(n,t)];case 2:return[2,o.sent()]}}))}))},e.prototype.exist=function(e){return r(this,void 0,void 0,(function(){var n,t,r;return o(this,(function(o){switch(o.label){case 0:return n=this,[4,this.init()];case 1:return o.sent(),t=this.__columnsDef.find((function(e){return(e.type&c.ColumnType.PRIMARY)==c.ColumnType.PRIMARY})),r="select * from `"+this.__tableName+"` where `"+t.name+"` = ? ;",[2,new Promise((function(t){n.db.transaction((function(o){o.executeSql(r,[e],(function(e,n){t(null!=n.rows&&n.rows.length>0)}),n.fail)}))}))]}}))}))},e.prototype.delete=function(e){return r(this,void 0,void 0,(function(){var n,t,r;return o(this,(function(o){switch(o.label){case 0:return n=this,[4,this.init()];case 1:return o.sent(),t=this.__columnsDef.find((function(e){return(e.type&c.ColumnType.PRIMARY)==c.ColumnType.PRIMARY})),r="delete from "+this.__tableName+" where "+t.name+" = ? ;",[2,new Promise((function(t){n.db.transaction((function(n){n.executeSql(r,[e],(function(e,n){i.EnvConfig.debug("delete result: "+n.rowsAffected),t(n.rowsAffected>0)}),(function(e,n){return t(!1),!0}))}))}))]}}))}))},e.prototype.save=function(e){return r(this,void 0,void 0,(function(){var n;return o(this,(function(t){switch(t.label){case 0:return[4,this.init()];case 1:return t.sent(),n=this.__columnsDef.find((function(e){return(e.type&c.ColumnType.PRIMARY)==c.ColumnType.PRIMARY})),[4,this.exist(e[n.name])];case 2:return t.sent()?[2,this.update(e)]:[2,this.insert(e)]}}))}))},e.prototype.insert=function(e){return r(this,void 0,void 0,(function(){var n,t=this;return o(this,(function(u){return n=this,[2,new Promise((function(u){return r(t,void 0,void 0,(function(){var t,r;return o(this,(function(o){switch(o.label){case 0:return[4,n.init()];case 1:return o.sent(),e instanceof Array&&e.length>0?(t=e.length,n.db.transaction((function(t){for(var r=0;r<e.length;r++)try{var o=e[r],i=n.gSql.gInsertSql(n.__tableName,n.objClass.__columns__,o);t.executeSql(i[0],i[1])}catch(e){console.error(e)}}),(function(e){i.EnvConfig.debug("insert result: "+e),u(0)}),(function(){i.EnvConfig.debug("insert result: "+t),u(t)})),[2]):(r=n.gSql.gInsertSql(n.__tableName,n.objClass.__columns__,e),n.db.transaction((function(e){e.executeSql(r[0],r[1],(function(e,n){i.EnvConfig.debug("insert result: "+n.rowsAffected),u(n.rowsAffected)}),(function(e,t){return n.fail(e,t),u(0),!0}))})),[2])}}))}))}))]}))}))},e.prototype.update=function(e){return r(this,void 0,void 0,(function(){var n,t,r;return o(this,(function(o){switch(o.label){case 0:return n=this,[4,this.init()];case 1:return o.sent(),t=this.__columnsDef.find((function(e){return(e.type&c.ColumnType.PRIMARY)==c.ColumnType.PRIMARY})),r=this.gSql.gUpdateSql(this.__tableName,t.name,e[t.name],e),[2,new Promise((function(e){n.db.transaction((function(t){t.executeSql(r[0],r[1],(function(n,t){i.EnvConfig.debug("update result: "+t.rowsAffected),e(t.rowsAffected)}),(function(t,r){return n.fail(t,r),e(0),!0}))}))}))]}}))}))},e.prototype.execSql=function(e,n){return r(this,void 0,void 0,(function(){var t;return o(this,(function(r){switch(r.label){case 0:return t=this,[4,this.init()];case 1:return r.sent(),[2,new Promise((function(r){t.db.transaction((function(o){o.executeSql(e,n,(function(e,n){i.EnvConfig.debug("execSql result: "+n.rowsAffected),r(n.rowsAffected)}),t.fail)}))}))]}}))}))},e.prototype.fail=function(e,n){return i.EnvConfig.debug(n),console.error(n.message),!0},e.prototype.init=function(){return r(this,void 0,void 0,(function(){return o(this,(function(e){switch(e.label){case 0:return[4,this.createTable(this.__columnsDef)];case 1:return e.sent(),[2]}}))}))},e.prototype.createTable=function(e){return r(this,void 0,void 0,(function(){var n;return o(this,(function(t){return n=this,[2,new Promise((function(t){n.db.transaction((function(r){r.executeSql(n.gSql.gCreateTableSql(n.__tableName,e),[],(function(e,n){t(1==n.insertId)}),(function(e,r){return n.fail(e,r),t(!1),!0}))}))}))]}))}))},e.prototype.convertToMetadata=function(e){var n=new this.objClass;n.__diff__={};var t,r=function(r){if(e.hasOwnProperty(r)){var i=e[r],u=n.__columnsDef.find((function(e){return e.name==r}));t=o.convertToColType(i,u),n.__diff__[r]=t,n[r]=t}},o=this;for(var u in e)r(u);return i.EnvConfig.debug("convertToMetadata:"),i.EnvConfig.debug(n),n},e.prototype.convertToColType=function(e,n){i.EnvConfig.debug("convertToColType:"),i.EnvConfig.debug(e),i.EnvConfig.debug(n);try{if((n.type&c.ColumnType.NUMBER)===c.ColumnType.NUMBER)return parseFloat(e);if((n.type&c.ColumnType.ANY)===c.ColumnType.ANY)return"string"==typeof e?JSON.parse(e.toString()):e;if((n.type&c.ColumnType.BOOLEAN)===c.ColumnType.BOOLEAN){if(""==e||null==e)return null;if("true"===e)return!0;if("false"===e)return!1;if("number"==typeof e)return!!e}if((n.type&c.ColumnType.DATE)===c.ColumnType.DATE){if("string"==typeof e)return new Date(e.toString());if("number"==typeof e){var t=e.toString().length,r=e.toString();if(t<13)for(var o=0;o<13-t;o++)r+="0";return new Date(parseInt(r))}return null}if((n.type&c.ColumnType.STRING)===c.ColumnType.STRING)return null!=e?e.toString():null;if((n.type&c.ColumnType.ARRAY)===c.ColumnType.ARRAY)try{return JSON.parse(e.toString())}catch(e){return null}}catch(e){return console.error(e),null}},e}();n.DbContext=a},function(e,n,t){"use strict";Object.defineProperty(n,"__esModule",{value:!0}),n.GenerateSql=void 0;var r=t(1),o=t(0),i=function(){function e(){}return e.prototype.gCreateTableSql=function(e,n){var t="CREATE TABLE IF NOT EXISTS `"+e+"`",i=[];if(n instanceof Array&&n.length>0)for(var u=0;u<n.length;u++){var c=n[u],a=void 0;a="TEXT",(c.type&o.ColumnType.STRING)===o.ColumnType.STRING&&(a="TEXT"),(c.type&o.ColumnType.NUMBER)===o.ColumnType.NUMBER&&(a="NUMERIC"),(c.type&o.ColumnType.BOOLEAN)===o.ColumnType.BOOLEAN&&(a="INTEGER"),(c.type&o.ColumnType.ARRAY)===o.ColumnType.ARRAY&&(a="TEXT"),(c.type&o.ColumnType.ANY)===o.ColumnType.ANY&&(a="TEXT"),(c.type&o.ColumnType.PRIMARY)===o.ColumnType.PRIMARY&&((c.type&o.ColumnType.NUMBER)===o.ColumnType.NUMBER?a=" INTEGER PRIMARY KEY autoincrement":a+=" PRIMARY KEY NOT NULL"),i.push("`"+c.name+"` "+a)}return t=t+" ("+i.join(", ")+")",r.EnvConfig.debug(t),t},e.prototype.gInsertSql=function(e,n,t){var o="insert into `"+e+"` ",i=[],u=[];if(n instanceof Array&&n.length>0){for(var c=[],a=0;a<n.length;a++){var s=n[a];i.push("`"+s.name+"`"),u.push("?"),null!=t[s.name]?t[s.name]instanceof Date?r.EnvConfig.dateFormatRemoveMillisecond?c.push(t[s.name].toISOString().replace(/\.\d\d\dZ/,".000Z")):c.push(t[s.name].toISOString()):"object"==typeof t[s.name]?c.push(JSON.stringify(t[s.name])):c.push(t[s.name]):c.push(null)}return o+=" ("+i.join(",")+") values ("+u.join(",")+")",r.EnvConfig.debug(o),r.EnvConfig.debug(c),[o,c]}return null},e.prototype.gUpdateSql=function(e,n,t,o){var i="update "+e+" set ",u=[],c=[];if(null!=o){var a=function(e){if(o.hasOwnProperty(e)){if(e==n)return"continue";if("__columnsDef"==e||"__primaryColDef"==e||"__tableName"==e||"__diff__"==e||"__refsDef"==e)return"continue";if(null!=o&&null!=o.__columnsDef&&null==o.__columnsDef.find((function(n){return n.name==e})))return"continue";var t=o[e];u.push("`"+e+"`"),null!=t?t instanceof Date?r.EnvConfig.dateFormatRemoveMillisecond?c.push(t.toISOString().replace(/\.\d\d\dZ/,".000Z")):c.push(t.toISOString()):"object"==typeof t?c.push(JSON.stringify(t)):c.push(t):c.push(null)}};for(var s in o)a(s)}i+=u.join(" = ? , ")+" = ? where "+n+" = ? ;",c.push(t);var l=[i,c];return r.EnvConfig.debug(i),r.EnvConfig.debug(c),l},e}();n.GenerateSql=i},function(e,n,t){"use strict";Object.defineProperty(n,"__esModule",{value:!0}),n.reference=n.database=n.table=n.column=void 0,n.column=function(e){return function(n,t){var r={name:t,type:e},o=n.constructor;o.__columns__||(o.__columns__=new Array),o.__columns__.push(r)}},n.table=function(e){return void 0===e&&(e=null),console.warn("@table is about to be deprecated, please use @database(dbName) decorator instead. \r\n @table 即将废弃,请改用 @database(dbName) 装饰器"),function(n){n.__db_name__=e,n.__table_name__=n.name}},n.database=function(e,n){return function(t){t.__db_name__=e,t.__table_name__=n}},n.reference=function(e,n,t,r){return void 0===r&&(r=null),function(o,i){var u={refTableInstance:n,refKeyName:t,foreignKeyName:e,propertyName:i,filter:r},c=o.constructor;c.__references__||(c.__references__=new Array),c.__references__.push(u)}}},function(e,n,t){"use strict";var r=this&&this.__awaiter||function(e,n,t,r){return new(t||(t=Promise))((function(o,i){function u(e){try{a(r.next(e))}catch(e){i(e)}}function c(e){try{a(r.throw(e))}catch(e){i(e)}}function a(e){var n;e.done?o(e.value):(n=e.value,n instanceof t?n:new t((function(e){e(n)}))).then(u,c)}a((r=r.apply(e,n||[])).next())}))},o=this&&this.__generator||function(e,n){var t,r,o,i,u={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:c(0),throw:c(1),return:c(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function c(i){return function(c){return function(i){if(t)throw new TypeError("Generator is already executing.");for(;u;)try{if(t=1,r&&(o=2&i[0]?r.return:i[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,i[1])).done)return o;switch(r=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return u.label++,{value:i[1],done:!1};case 5:u.label++,r=i[1],i=[0];continue;case 7:i=u.ops.pop(),u.trys.pop();continue;default:if(!(o=u.trys,(o=o.length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){u=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){u.label=i[1];break}if(6===i[0]&&u.label<o[1]){u.label=o[1],o=i;break}if(o&&u.label<o[2]){u.label=o[2],u.ops.push(i);break}o[2]&&u.ops.pop(),u.trys.pop();continue}i=n.call(e,u)}catch(e){i=[6,e],r=0}finally{t=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,c])}}};Object.defineProperty(n,"__esModule",{value:!0}),n.Table=void 0;var i=t(0),u=t(2),c=t(3),a=function(){function e(){if(this.__columnsDef=this.constructor.__columns__,this.__primaryColDef=this.__columnsDef.find((function(e){return(e.type&i.ColumnType.PRIMARY)==i.ColumnType.PRIMARY})),this.__tableName=this.constructor.__table_name__,this.__refsDef=this.constructor.__references__,null==this.__primaryColDef)throw this.__tableName+" 实体未定义主键,\b\b每个实体必须定义一个主键,且只有一个,例如:@column(ColumnType.STRING | ColumnType.PRIMARY)"}return e.prototype.save=function(){return r(this,void 0,void 0,(function(){var e,n,t,r,i;return o(this,(function(o){switch(o.label){case 0:return e=this.queryChange(),[4,(n=new u.DbContext(this.constructor)).exist(this[this.__primaryColDef.name])];case 1:if((t=o.sent())&&null==e)throw"请调用 sqlite.formSql 等方法,从返回的值中修改相应的字段,再调用save()";return r=new c.GenerateSql,i=t&&null!=e?r.gUpdateSql(this.__tableName,this.__primaryColDef.name,this[this.__primaryColDef.name],e):r.gInsertSql(this.__tableName,this.__columnsDef,this),[4,n.execSql(i[0],i[1])];case 2:return[2,o.sent()>0]}}))}))},e.prototype.queryChange=function(){var e={},n=this.__diff__;if(null!=n){for(var t in n)if(n.hasOwnProperty(t)){var r=n[t];this[t]!=r&&(e[t]=this[t])}return e}return null},e.prototype.checkColDef=function(){if(null!=this.__columnsDef&&this.__columnsDef.length>0)for(var e=0;e<this.__columnsDef.length;e++){var n=this.__columnsDef[e],t=this[n.name];if(null!=t){if((n.type&i.ColumnType.NUMBER)===i.ColumnType.NUMBER&&"number"!=typeof t)throw"表实体"+this.__tableName+"中的字段"+n.name+"类型与@column定义的不一致,应为number类型";if((n.type&i.ColumnType.BOOLEAN)===i.ColumnType.BOOLEAN&&"boolean"!=typeof t)throw"表实体"+this.__tableName+"中的字段"+n.name+"类型与@column定义的不一致,应为boolean类型";if((n.type&i.ColumnType.DATE)===i.ColumnType.DATE&&!(t instanceof Date))throw"表实体"+this.__tableName+"中的字段"+n.name+"类型与@column定义的不一致,应为Date类型";if((n.type&i.ColumnType.STRING)===i.ColumnType.STRING&&"string"!=typeof t)throw"表实体"+this.__tableName+"中的字段"+n.name+"类型与@column定义的不一致,应为string类型";if((n.type&i.ColumnType.ARRAY)===i.ColumnType.ARRAY&&!(t instanceof Array))throw"表实体"+this.__tableName+"中的字段"+n.name+"类型与@column定义的不一致,应为Array<T> 或 [] 类型"}}},e}();n.Table=a},function(e,n,t){"use strict";var r=this&&this.__createBinding||(Object.create?function(e,n,t,r){void 0===r&&(r=t),Object.defineProperty(e,r,{enumerable:!0,get:function(){return n[t]}})}:function(e,n,t,r){void 0===r&&(r=t),e[r]=n[t]}),o=this&&this.__exportStar||function(e,n){for(var t in e)"default"===t||n.hasOwnProperty(t)||r(n,e,t)};Object.defineProperty(n,"__esModule",{value:!0}),o(t(4),n),o(t(7),n),o(t(8),n),o(t(0),n),o(t(2),n),o(t(3),n),o(t(5),n),o(t(9),n),o(t(1),n),o(t(10),n)},function(e,n,t){"use strict";var r,o=this&&this.__extends||(r=function(e,n){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,n){e.__proto__=n}||function(e,n){for(var t in n)n.hasOwnProperty(t)&&(e[t]=n[t])})(e,n)},function(e,n){function t(){this.constructor=e}r(e,n),e.prototype=null===n?Object.create(n):(t.prototype=n.prototype,new t)}),i=this&&this.__decorate||function(e,n,t,r){var o,i=arguments.length,u=i<3?n:null===r?r=Object.getOwnPropertyDescriptor(n,t):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)u=Reflect.decorate(e,n,t,r);else for(var c=e.length-1;c>=0;c--)(o=e[c])&&(u=(i<3?o(u):i>3?o(n,t,u):o(n,t))||u);return i>3&&u&&Object.defineProperty(n,t,u),u},u=this&&this.__metadata||function(e,n){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,n)};Object.defineProperty(n,"__esModule",{value:!0}),n.a4a87f28374792e6a550e84b71419e688e254741cedae57c8cb0fc0f0a895dbf=void 0;var c=t(4),a=t(5),s=t(0),l=function(e){function n(){return null!==e&&e.apply(this,arguments)||this}return o(n,e),i([c.column(s.ColumnType.STRING|s.ColumnType.PRIMARY),u("design:type",String)],n.prototype,"cbf0eebae0e30afd50bc051d7d56e51e43fa323d8550e84b4b4f6702",void 0),i([c.column(s.ColumnType.STRING),u("design:type",String)],n.prototype,"a9dd99d4d4cfd5ab89cf6005caedb6e6307d4743c40953bf9abe0fdd",void 0),n=i([c.table("a4a87f28374792e6a550e84b71419e688e254741cedae57c8cb0fc0f0a895dbf")],n)}(a.Table);n.a4a87f28374792e6a550e84b71419e688e254741cedae57c8cb0fc0f0a895dbf=l},function(e,n,t){"use strict";Object.defineProperty(n,"__esModule",{value:!0}),n.ColumnInfo=void 0;var r=function(){};n.ColumnInfo=r},function(e,n,t){"use strict";var r=this&&this.__awaiter||function(e,n,t,r){return new(t||(t=Promise))((function(o,i){function u(e){try{a(r.next(e))}catch(e){i(e)}}function c(e){try{a(r.throw(e))}catch(e){i(e)}}function a(e){var n;e.done?o(e.value):(n=e.value,n instanceof t?n:new t((function(e){e(n)}))).then(u,c)}a((r=r.apply(e,n||[])).next())}))},o=this&&this.__generator||function(e,n){var t,r,o,i,u={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:c(0),throw:c(1),return:c(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function c(i){return function(c){return function(i){if(t)throw new TypeError("Generator is already executing.");for(;u;)try{if(t=1,r&&(o=2&i[0]?r.return:i[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,i[1])).done)return o;switch(r=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return u.label++,{value:i[1],done:!1};case 5:u.label++,r=i[1],i=[0];continue;case 7:i=u.ops.pop(),u.trys.pop();continue;default:if(!(o=u.trys,(o=o.length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){u=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){u.label=i[1];break}if(6===i[0]&&u.label<o[1]){u.label=o[1],o=i;break}if(o&&u.label<o[2]){u.label=o[2],u.ops.push(i);break}o[2]&&u.ops.pop(),u.trys.pop();continue}i=n.call(e,u)}catch(e){i=[6,e],r=0}finally{t=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,c])}}};Object.defineProperty(n,"__esModule",{value:!0}),n.sqlite=void 0;var i=t(2),u=t(1),c=function(){function e(){}return e.fromSql=function(e,n,t,u){return void 0===u&&(u=!0),r(this,void 0,void 0,(function(){var r;return o(this,(function(o){return(r=new i.DbContext(e.constructor)).isTrace=u,[2,r.fromSql(n,t)]}))}))},e.fromSqlFirst=function(e,n,t,u){return void 0===u&&(u=!0),r(this,void 0,void 0,(function(){var r,c;return o(this,(function(o){switch(o.label){case 0:return(r=new i.DbContext(e.constructor)).isTrace=u,[4,r.fromSql(n,t)];case 1:return null!=(c=o.sent())&&c.length>0?[2,c[0]]:[2,null]}}))}))},e.exist=function(e,n){return r(this,void 0,void 0,(function(){return o(this,(function(t){return[2,new i.DbContext(e.constructor).exist(n)]}))}))},e.delete=function(e,n){return r(this,void 0,void 0,(function(){return o(this,(function(t){return[2,new i.DbContext(e.constructor).delete(n)]}))}))},e.insert=function(e){return r(this,void 0,void 0,(function(){var n;return o(this,(function(t){if(e instanceof Array&&e.length>0){for(n=0;n<e.length;n++)e[n].checkColDef();return[2,new i.DbContext(e[0].constructor).insert(e)]}return e.checkColDef(),[2,new i.DbContext(e.constructor).insert(e)]}))}))},e.update=function(e){return r(this,void 0,void 0,(function(){return o(this,(function(n){return e.checkColDef(),[2,new i.DbContext(e.constructor).update(e)]}))}))},e.execSql=function(e,n,t){return r(this,void 0,void 0,(function(){return o(this,(function(r){return[2,new i.DbContext(e.constructor).execSql(n,t)]}))}))},e.query=function(e,n,t){return void 0===t&&(t=!0),r(this,void 0,void 0,(function(){var r;return o(this,(function(o){return(r=new i.DbContext(e.constructor)).isTrace=t,[2,r.query(n)]}))}))},e.queryFirst=function(e,n,t){return void 0===t&&(t=!0),r(this,void 0,void 0,(function(){var r,u;return o(this,(function(o){switch(o.label){case 0:return(r=new i.DbContext(e.constructor)).isTrace=t,[4,r.query(n)];case 1:return null!=(u=o.sent())?[2,u[0]]:[2,null]}}))}))},e.save=function(e){return r(this,void 0,void 0,(function(){return o(this,(function(n){return[2,new i.DbContext(e.constructor).save(e)]}))}))},e.init=function(e){return r(this,void 0,void 0,(function(){return o(this,(function(n){return[2,new i.DbContext(e.constructor).init()]}))}))},e.fromSqlByJs=function(e,n,t){return r(this,void 0,void 0,(function(){return o(this,(function(i){return[2,new Promise((function(i){(u.EnvConfig.useCordovaSqliteStorage?window.sqlitePlugin.openDatabase({name:e,location:"default"}):window.openDatabase(e,"1.0.0","",10485760)).transaction((function(e){var c=this;e.executeSql(n,t,(function(e,n){return r(c,void 0,void 0,(function(){var e,t,r;return o(this,(function(o){if(e=[],u.EnvConfig.debug(n),null!=n.rows&&n.rows.length>0)for(t=0;t<n.rows.length;t++)r=n.rows.item(t),e.push(r);return i(e),[2]}))}))}),(function(e,n){return u.EnvConfig.debug(n),console.error(n.message),!0}))}))}))]}))}))},e.fromSqlFirstByJs=function(e,n,t){return r(this,void 0,void 0,(function(){var r;return o(this,(function(o){switch(o.label){case 0:return[4,this.fromSqlByJs(e,n,t)];case 1:return null!=(r=o.sent())&&r.length>0?[2,r[0]]:[2,null]}}))}))},e}();n.sqlite=c},function(e,n,t){"use strict";var r=this&&this.__awaiter||function(e,n,t,r){return new(t||(t=Promise))((function(o,i){function u(e){try{a(r.next(e))}catch(e){i(e)}}function c(e){try{a(r.throw(e))}catch(e){i(e)}}function a(e){var n;e.done?o(e.value):(n=e.value,n instanceof t?n:new t((function(e){e(n)}))).then(u,c)}a((r=r.apply(e,n||[])).next())}))},o=this&&this.__generator||function(e,n){var t,r,o,i,u={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:c(0),throw:c(1),return:c(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function c(i){return function(c){return function(i){if(t)throw new TypeError("Generator is already executing.");for(;u;)try{if(t=1,r&&(o=2&i[0]?r.return:i[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,i[1])).done)return o;switch(r=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return u.label++,{value:i[1],done:!1};case 5:u.label++,r=i[1],i=[0];continue;case 7:i=u.ops.pop(),u.trys.pop();continue;default:if(!(o=u.trys,(o=o.length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){u=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){u.label=i[1];break}if(6===i[0]&&u.label<o[1]){u.label=o[1],o=i;break}if(o&&u.label<o[2]){u.label=o[2],u.ops.push(i);break}o[2]&&u.ops.pop(),u.trys.pop();continue}i=n.call(e,u)}catch(e){i=[6,e],r=0}finally{t=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,c])}}};Object.defineProperty(n,"__esModule",{value:!0}),n.SqliteJs=void 0;var i=t(1),u=function(){function e(e){this.dbName=e}return e.prototype.fromSql=function(e,n){return r(this,void 0,void 0,(function(){var t=this;return o(this,(function(u){return[2,new Promise((function(u){(i.EnvConfig.useCordovaSqliteStorage?window.sqlitePlugin.openDatabase({name:t.dbName,location:"default"}):window.openDatabase(t.dbName,"1.0.0","",10485760)).transaction((function(t){var c=this;t.executeSql(e,n,(function(e,n){return r(c,void 0,void 0,(function(){var e,t,r;return o(this,(function(o){if(e=[],i.EnvConfig.debug(n),null!=n.rows&&n.rows.length>0)for(t=0;t<n.rows.length;t++)r=n.rows.item(t),e.push(r);return u(e),[2]}))}))}),(function(e,n){return i.EnvConfig.debug(n),console.error(n.message),!0}))}))}))]}))}))},e.prototype.fromSqlFirst=function(e,n){return r(this,void 0,void 0,(function(){var t;return o(this,(function(r){switch(r.label){case 0:return[4,this.fromSql(e,n)];case 1:return null!=(t=r.sent())&&t.length>0?[2,t[0]]:[2,null]}}))}))},e.prototype.execSql=function(e,n){return r(this,void 0,void 0,(function(){return o(this,(function(t){return[2,new Promise((function(t){(void 0).transaction((function(r){r.executeSql(e,n,(function(e,n){i.EnvConfig.debug("execSql result: "+n.rowsAffected),t(n.rowsAffected)}),(function(e,n){return i.EnvConfig.debug(n),console.error(n.message),!0}))}))}))]}))}))},e}();n.SqliteJs=u}])}));