@cloudbase/js-sdk 3.6.7 → 3.6.8-beta.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/app/dist/index.esm.js +1 -1
- package/app/dist/index.esm.js.map +1 -1
- package/app/dist/index.js +1 -1
- package/app/dist/index.js.map +1 -1
- package/app/dist/index.node.esm.js +1 -1
- package/app/dist/index.node.esm.js.map +1 -1
- package/app/dist/index.node.js +1 -1
- package/app/dist/index.node.js.map +1 -1
- package/auth/dist/index.esm.js.map +1 -1
- package/auth/dist/index.js.map +1 -1
- package/database/dist/index.d.ts +3 -0
- package/database/dist/index.esm.js +2 -0
- package/database/dist/index.esm.js.map +1 -0
- package/database/dist/index.js +2 -0
- package/database/dist/index.js.map +1 -0
- package/dist/index.cjs.js +1 -1
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.esm.js +1 -1
- package/dist/index.esm.js.map +1 -1
- package/dist/index.node.cjs.js +1 -1
- package/dist/index.node.cjs.js.map +1 -1
- package/dist/index.node.esm.js +1 -1
- package/dist/index.node.esm.js.map +1 -1
- package/miniprogram_dist/index.js +1 -1
- package/oauth/dist/index.esm.js.map +1 -1
- package/oauth/dist/index.js.map +1 -1
- package/package.json +2 -2
- package/types/package.json +1 -1
- package/utilities/package.json +2 -2
- package/database/dist/commonjs/aggregate.d.ts +0 -29
- package/database/dist/commonjs/aggregate.js +0 -156
- package/database/dist/commonjs/collection.d.ts +0 -9
- package/database/dist/commonjs/collection.js +0 -49
- package/database/dist/commonjs/command.d.ts +0 -175
- package/database/dist/commonjs/command.js +0 -299
- package/database/dist/commonjs/commands/logic.d.ts +0 -24
- package/database/dist/commonjs/commands/logic.js +0 -89
- package/database/dist/commonjs/commands/query.d.ts +0 -68
- package/database/dist/commonjs/commands/query.js +0 -160
- package/database/dist/commonjs/commands/update.d.ts +0 -29
- package/database/dist/commonjs/commands/update.js +0 -51
- package/database/dist/commonjs/config/app.config.d.ts +0 -6
- package/database/dist/commonjs/config/app.config.js +0 -7
- package/database/dist/commonjs/config/error.config.d.ts +0 -3
- package/database/dist/commonjs/config/error.config.js +0 -16
- package/database/dist/commonjs/const/code.d.ts +0 -30
- package/database/dist/commonjs/const/code.js +0 -33
- package/database/dist/commonjs/constant.d.ts +0 -51
- package/database/dist/commonjs/constant.js +0 -75
- package/database/dist/commonjs/document.d.ts +0 -11
- package/database/dist/commonjs/document.js +0 -260
- package/database/dist/commonjs/geo/index.d.ts +0 -6
- package/database/dist/commonjs/geo/index.js +0 -22
- package/database/dist/commonjs/geo/interface.d.ts +0 -24
- package/database/dist/commonjs/geo/interface.js +0 -2
- package/database/dist/commonjs/geo/lineString.d.ts +0 -19
- package/database/dist/commonjs/geo/lineString.js +0 -86
- package/database/dist/commonjs/geo/multiLineString.d.ts +0 -18
- package/database/dist/commonjs/geo/multiLineString.js +0 -95
- package/database/dist/commonjs/geo/multiPoint.d.ts +0 -18
- package/database/dist/commonjs/geo/multiPoint.js +0 -79
- package/database/dist/commonjs/geo/multiPolygon.d.ts +0 -18
- package/database/dist/commonjs/geo/multiPolygon.js +0 -122
- package/database/dist/commonjs/geo/point.d.ts +0 -19
- package/database/dist/commonjs/geo/point.js +0 -50
- package/database/dist/commonjs/geo/polygon.d.ts +0 -19
- package/database/dist/commonjs/geo/polygon.js +0 -109
- package/database/dist/commonjs/helper/symbol.d.ts +0 -14
- package/database/dist/commonjs/helper/symbol.js +0 -31
- package/database/dist/commonjs/index.d.ts +0 -40
- package/database/dist/commonjs/index.js +0 -61
- package/database/dist/commonjs/lib/util.d.ts +0 -1
- package/database/dist/commonjs/lib/util.js +0 -26
- package/database/dist/commonjs/operator-map.d.ts +0 -4
- package/database/dist/commonjs/operator-map.js +0 -24
- package/database/dist/commonjs/query.d.ts +0 -22
- package/database/dist/commonjs/query.js +0 -252
- package/database/dist/commonjs/regexp/index.d.ts +0 -14
- package/database/dist/commonjs/regexp/index.js +0 -33
- package/database/dist/commonjs/serializer/common.d.ts +0 -11
- package/database/dist/commonjs/serializer/common.js +0 -127
- package/database/dist/commonjs/serializer/datatype.d.ts +0 -7
- package/database/dist/commonjs/serializer/datatype.js +0 -132
- package/database/dist/commonjs/serializer/query.d.ts +0 -7
- package/database/dist/commonjs/serializer/query.js +0 -232
- package/database/dist/commonjs/serializer/update.d.ts +0 -15
- package/database/dist/commonjs/serializer/update.js +0 -142
- package/database/dist/commonjs/serverDate/index.d.ts +0 -13
- package/database/dist/commonjs/serverDate/index.js +0 -30
- package/database/dist/commonjs/transaction/collection.d.ts +0 -7
- package/database/dist/commonjs/transaction/collection.js +0 -49
- package/database/dist/commonjs/transaction/document.d.ts +0 -27
- package/database/dist/commonjs/transaction/document.js +0 -205
- package/database/dist/commonjs/transaction/index.d.ts +0 -30
- package/database/dist/commonjs/transaction/index.js +0 -215
- package/database/dist/commonjs/transaction/query.d.ts +0 -43
- package/database/dist/commonjs/transaction/query.js +0 -261
- package/database/dist/commonjs/typings/index.d.ts +0 -40
- package/database/dist/commonjs/typings/index.js +0 -2
- package/database/dist/commonjs/typings/realtime.d.ts +0 -219
- package/database/dist/commonjs/typings/realtime.js +0 -2
- package/database/dist/commonjs/util.d.ts +0 -9
- package/database/dist/commonjs/util.js +0 -145
- package/database/dist/commonjs/utils/error.d.ts +0 -38
- package/database/dist/commonjs/utils/error.js +0 -91
- package/database/dist/commonjs/utils/msg.d.ts +0 -0
- package/database/dist/commonjs/utils/msg.js +0 -0
- package/database/dist/commonjs/utils/symbol.d.ts +0 -8
- package/database/dist/commonjs/utils/symbol.js +0 -58
- package/database/dist/commonjs/utils/type.d.ts +0 -13
- package/database/dist/commonjs/utils/type.js +0 -34
- package/database/dist/commonjs/utils/utils.d.ts +0 -4
- package/database/dist/commonjs/utils/utils.js +0 -39
- package/database/dist/commonjs/validate.d.ts +0 -1
- package/database/dist/commonjs/validate.js +0 -60
- package/database/dist/esm/aggregate.d.ts +0 -29
- package/database/dist/esm/aggregate.js +0 -154
- package/database/dist/esm/collection.d.ts +0 -9
- package/database/dist/esm/collection.js +0 -46
- package/database/dist/esm/command.d.ts +0 -175
- package/database/dist/esm/command.js +0 -296
- package/database/dist/esm/commands/logic.d.ts +0 -24
- package/database/dist/esm/commands/logic.js +0 -84
- package/database/dist/esm/commands/query.d.ts +0 -68
- package/database/dist/esm/commands/query.js +0 -154
- package/database/dist/esm/commands/update.d.ts +0 -29
- package/database/dist/esm/commands/update.js +0 -46
- package/database/dist/esm/config/app.config.d.ts +0 -6
- package/database/dist/esm/config/app.config.js +0 -5
- package/database/dist/esm/config/error.config.d.ts +0 -3
- package/database/dist/esm/config/error.config.js +0 -13
- package/database/dist/esm/const/code.d.ts +0 -30
- package/database/dist/esm/const/code.js +0 -30
- package/database/dist/esm/constant.d.ts +0 -51
- package/database/dist/esm/constant.js +0 -65
- package/database/dist/esm/document.d.ts +0 -11
- package/database/dist/esm/document.js +0 -257
- package/database/dist/esm/geo/index.d.ts +0 -6
- package/database/dist/esm/geo/index.js +0 -6
- package/database/dist/esm/geo/interface.d.ts +0 -24
- package/database/dist/esm/geo/interface.js +0 -1
- package/database/dist/esm/geo/lineString.d.ts +0 -19
- package/database/dist/esm/geo/lineString.js +0 -83
- package/database/dist/esm/geo/multiLineString.d.ts +0 -18
- package/database/dist/esm/geo/multiLineString.js +0 -92
- package/database/dist/esm/geo/multiPoint.d.ts +0 -18
- package/database/dist/esm/geo/multiPoint.js +0 -76
- package/database/dist/esm/geo/multiPolygon.d.ts +0 -18
- package/database/dist/esm/geo/multiPolygon.js +0 -119
- package/database/dist/esm/geo/point.d.ts +0 -19
- package/database/dist/esm/geo/point.js +0 -47
- package/database/dist/esm/geo/polygon.d.ts +0 -19
- package/database/dist/esm/geo/polygon.js +0 -106
- package/database/dist/esm/helper/symbol.d.ts +0 -14
- package/database/dist/esm/helper/symbol.js +0 -14
- package/database/dist/esm/index.d.ts +0 -40
- package/database/dist/esm/index.js +0 -55
- package/database/dist/esm/lib/util.d.ts +0 -1
- package/database/dist/esm/lib/util.js +0 -22
- package/database/dist/esm/operator-map.d.ts +0 -4
- package/database/dist/esm/operator-map.js +0 -20
- package/database/dist/esm/query.d.ts +0 -22
- package/database/dist/esm/query.js +0 -249
- package/database/dist/esm/regexp/index.d.ts +0 -14
- package/database/dist/esm/regexp/index.js +0 -29
- package/database/dist/esm/serializer/common.d.ts +0 -11
- package/database/dist/esm/serializer/common.js +0 -118
- package/database/dist/esm/serializer/datatype.d.ts +0 -7
- package/database/dist/esm/serializer/datatype.js +0 -127
- package/database/dist/esm/serializer/query.d.ts +0 -7
- package/database/dist/esm/serializer/query.js +0 -229
- package/database/dist/esm/serializer/update.d.ts +0 -15
- package/database/dist/esm/serializer/update.js +0 -139
- package/database/dist/esm/serverDate/index.d.ts +0 -13
- package/database/dist/esm/serverDate/index.js +0 -26
- package/database/dist/esm/transaction/collection.d.ts +0 -7
- package/database/dist/esm/transaction/collection.js +0 -46
- package/database/dist/esm/transaction/document.d.ts +0 -27
- package/database/dist/esm/transaction/document.js +0 -202
- package/database/dist/esm/transaction/index.d.ts +0 -30
- package/database/dist/esm/transaction/index.js +0 -210
- package/database/dist/esm/transaction/query.d.ts +0 -43
- package/database/dist/esm/transaction/query.js +0 -258
- package/database/dist/esm/typings/index.d.ts +0 -40
- package/database/dist/esm/typings/index.js +0 -1
- package/database/dist/esm/typings/realtime.d.ts +0 -219
- package/database/dist/esm/typings/realtime.js +0 -1
- package/database/dist/esm/util.d.ts +0 -9
- package/database/dist/esm/util.js +0 -142
- package/database/dist/esm/utils/error.d.ts +0 -38
- package/database/dist/esm/utils/error.js +0 -84
- package/database/dist/esm/utils/msg.d.ts +0 -0
- package/database/dist/esm/utils/msg.js +0 -0
- package/database/dist/esm/utils/symbol.d.ts +0 -8
- package/database/dist/esm/utils/symbol.js +0 -55
- package/database/dist/esm/utils/type.d.ts +0 -13
- package/database/dist/esm/utils/type.js +0 -20
- package/database/dist/esm/utils/utils.d.ts +0 -4
- package/database/dist/esm/utils/utils.js +0 -33
- package/database/dist/esm/validate.d.ts +0 -1
- package/database/dist/esm/validate.js +0 -57
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
!function(){"use strict";var t={198:function(t,e,n){var r,o=this&&this.__extends||(r=function(t,e){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])},r(t,e)},function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function n(){this.constructor=t}r(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)}),i=this&&this.__assign||function(){return i=Object.assign||function(t){for(var e,n=1,r=arguments.length;n<r;n++)for(var o in e=arguments[n])Object.prototype.hasOwnProperty.call(e,o)&&(t[o]=e[o]);return t},i.apply(this,arguments)},a=this&&this.__awaiter||function(t,e,n,r){return new(n||(n=Promise))(function(o,i){function a(t){try{c(r.next(t))}catch(t){i(t)}}function u(t){try{c(r.throw(t))}catch(t){i(t)}}function c(t){var e;t.done?o(t.value):(e=t.value,e instanceof n?e:new n(function(t){t(e)})).then(a,u)}c((r=r.apply(t,e||[])).next())})},u=this&&this.__generator||function(t,e){var n,r,o,i,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:u(0),throw:u(1),return:u(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function u(u){return function(c){return function(u){if(n)throw new TypeError("Generator is already executing.");for(;i&&(i=0,u[0]&&(a=0)),a;)try{if(n=1,r&&(o=2&u[0]?r.return:u[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,u[1])).done)return o;switch(r=0,o&&(u=[2&u[0],o.value]),u[0]){case 0:case 1:o=u;break;case 4:return a.label++,{value:u[1],done:!1};case 5:a.label++,r=u[1],u=[0];continue;case 7:u=a.ops.pop(),a.trys.pop();continue;default:if(!((o=(o=a.trys).length>0&&o[o.length-1])||6!==u[0]&&2!==u[0])){a=0;continue}if(3===u[0]&&(!o||u[1]>o[0]&&u[1]<o[3])){a.label=u[1];break}if(6===u[0]&&a.label<o[1]){a.label=o[1],o=u;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(u);break}o[2]&&a.ops.pop(),a.trys.pop();continue}u=e.call(t,a)}catch(t){u=[6,t],r=0}finally{n=o=0}if(5&u[0])throw u[1];return{value:u[0]?u[1]:void 0,done:!0}}([u,c])}}};Object.defineProperty(e,"__esModule",{value:!0}),e.registerDatabase=void 0;var c=n(543),s=n(701),l={filterRes:function(t){return delete t.header,delete t.statusCode,t},flattenResData:function(t){if("object"==typeof t.data&&null!==t.data){var e=i(i({},t),t.data);return delete e.data,e}return t},safeParseEJSON:function(t){if("string"!=typeof t)return t;try{return s.EJSON.parse(t)}catch(e){return t}},buildQueryParams:function(t){return Object.entries(t).filter(function(t){t[0];var e=t[1];return null!=e&&""!==e}).map(function(t){var e=t[0],n=t[1],r="object"==typeof n?JSON.stringify(n):String(n);return"".concat(encodeURIComponent(e),"=").concat(encodeURIComponent(r))}).join("&")},getUrlPrefix:function(t){var e=(null==t?void 0:t.instance)||"(default)",n=(null==t?void 0:t.database)||"(default)";return"/database/instances/".concat(e,"/databases/").concat(n)},"database.queryDocument":function(t){var e,n,r,o,c,f,d,p;return a(this,void 0,Promise,function(){var a,h,y,m;return u(this,function(u){switch(u.label){case 0:return a=!!(null===(n=null===(e=t.query)||void 0===e?void 0:e._id)||void 0===n?void 0:n.$eq),h=l.buildQueryParams(i({projection:t.projection,transactionId:t.transactionId},a?{}:{offset:null!==(r=t.offset)&&void 0!==r?r:0,limit:null!==(o=t.limit)&&void 0!==o?o:100,order:t.order,query:t.query?s.EJSON.stringify(t.query,{relaxed:!1}):void 0})),y="".concat(l.getUrlPrefix(t),"/collections/").concat(t.collectionName,"/documents?").concat(h),a&&(y="".concat(l.getUrlPrefix(t),"/collections/").concat(t.collectionName,"/documents/").concat((null===(c=t.query._id)||void 0===c?void 0:c.$eq)||t.query._id,"?").concat(h)),[4,this.gateWay({url:y,method:"GET"})];case 1:return(m=u.sent()).data=l.safeParseEJSON(JSON.stringify(m.data)),!a||m.code||(null===(f=m.data)||void 0===f?void 0:f.code)?(m.code||(null===(d=m.data)||void 0===d?void 0:d.code)?m=i(i({},m),{code:m.code||(null===(p=m.data)||void 0===p?void 0:p.code),data:i(i({},m.data),{list:[]})}):Array.isArray(m.data)?m=i(i({},m),{data:{list:m.data}}):m.data&&!Array.isArray(m.data.list)&&(m=i(i({},m),{data:i(i({},m.data),{list:[]})})),[2,l.filterRes(m)]):[2,i(i({},m),{data:{list:[m.data]}})]}})})},"database.addDocument":function(t){var e,n,r;return a(this,void 0,Promise,function(){var o;return u(this,function(a){switch(a.label){case 0:return[4,this.gateWay({url:"".concat(l.getUrlPrefix(t),"/collections/").concat(t.collectionName,"/documents"),method:"POST",data:i({data:Array.isArray(t.data)?t.data:[t.data]},t.transactionId&&{transactionId:t.transactionId})})];case 1:return o=a.sent(),Array.isArray(t.data)?o=i(i({},o),{data:i({ids:(null===(e=o.data)||void 0===e?void 0:e.insertedIds)||[]},o.data)}):(null===(r=null===(n=o.data)||void 0===n?void 0:n.insertedIds)||void 0===r?void 0:r[0])&&(o=i(i({},o),{data:i({_id:o.data.insertedIds[0]},o.data)})),[2,l.filterRes(o)]}})})},"database.updateDocument":function(t){return a(this,void 0,Promise,function(){var e;return u(this,function(n){switch(n.label){case 0:return[4,this.gateWay({url:"".concat(l.getUrlPrefix(t),"/collections/").concat(t.collectionName,"/documents"),method:"PATCH",data:i({query:t.query,data:t.data,multi:!!t.multi,upsert:!!t.upsert,replaceMode:!!t.replaceMode},t.transactionId&&{transactionId:t.transactionId})})];case 1:return e=n.sent(),[2,l.filterRes(e)]}})})},"database.deleteDocument":function(t){return a(this,void 0,Promise,function(){var e;return u(this,function(n){switch(n.label){case 0:return[4,this.gateWay({url:"".concat(l.getUrlPrefix(t),"/collections/").concat(t.collectionName,"/documents/remove"),method:"POST",data:i({query:t.query,multi:!!t.multi},t.transactionId&&{transactionId:t.transactionId})})];case 1:return e=n.sent(),[2,l.filterRes(e)]}})})},"database.countDocument":function(t){return a(this,void 0,Promise,function(){var e,n;return u(this,function(r){switch(r.label){case 0:return e=l.buildQueryParams({count:!0,query:t.query?s.EJSON.stringify(t.query,{relaxed:!1}):void 0}),[4,this.gateWay({url:"".concat(l.getUrlPrefix(t),"/collections/").concat(t.collectionName,"/documents?").concat(e),method:"GET"})];case 1:return n=r.sent(),[2,l.filterRes(n)]}})})},"database.addCollection":function(t){return a(this,void 0,Promise,function(){var e;return u(this,function(n){switch(n.label){case 0:return[4,this.gateWay({url:"".concat(l.getUrlPrefix(t),"/collections"),method:"POST",data:{collectionName:t.collectionName}})];case 1:return e=n.sent(),[2,l.filterRes(e)]}})})},"database.aggregate":function(t){var e;return a(this,void 0,Promise,function(){var n,r;return u(this,function(o){switch(o.label){case 0:return n=t.stages.map(function(t){var e,n;try{var r="string"==typeof t.stageValue?JSON.parse(t.stageValue):t.stageValue;return(e={})[t.stageKey]=s.EJSON.serialize(r),e}catch(e){return(n={})[t.stageKey]=t.stageValue,n}}),[4,this.gateWay({url:"".concat(l.getUrlPrefix(t),"/collections/").concat(t.collectionName,"/documents/aggregations"),method:"POST",data:{pipeline:n}})];case 1:return r=o.sent(),Array.isArray(null===(e=r.data)||void 0===e?void 0:e.list)&&(r.data.list=JSON.stringify(r.data.list.map(function(t){return JSON.stringify(t)}))),[2,l.filterRes(r)]}})})},"database.startTransaction":function(t){return a(this,void 0,void 0,function(){var e;return u(this,function(n){switch(n.label){case 0:return[4,this.gateWay({url:"".concat(l.getUrlPrefix(t),"/transactions"),method:"POST"})];case 1:return e=n.sent(),[2,l.filterRes(l.flattenResData(e))]}})})},"database.commitTransaction":function(t){return a(this,void 0,void 0,function(){var e;return u(this,function(n){switch(n.label){case 0:return[4,this.gateWay({url:"".concat(l.getUrlPrefix(t),"/transactions/").concat(t.transactionId,"/commit"),method:"POST"})];case 1:return e=n.sent(),[2,l.filterRes(e)]}})})},"database.abortTransaction":function(t){return a(this,void 0,void 0,function(){var e;return u(this,function(n){switch(n.label){case 0:return[4,this.gateWay({url:"".concat(l.getUrlPrefix(t),"/transactions/").concat(t.transactionId,"/rollback"),method:"POST"})];case 1:return e=n.sent(),[2,l.filterRes(e)]}})})},"database.getInTransaction":function(t){var e;return a(this,void 0,void 0,function(){var n;return u(this,function(r){switch(r.label){case 0:return[4,l["database.queryDocument"].call(this,t)];case 1:return"object"==typeof(n=r.sent()).data&&null!==n.data?(null===(e=n.data)||void 0===e?void 0:e.code)?[2,l.flattenResData(n)]:[2,i(i({},n),{data:JSON.stringify(n.data)})]:[2,n]}})})},"database.updateDocInTransaction":function(t){return a(this,void 0,void 0,function(){var e;return u(this,function(n){switch(n.label){case 0:return t.data=l.safeParseEJSON(t.data),[4,l["database.updateDocument"].call(this,t)];case 1:return e=n.sent(),[2,l.flattenResData(e)]}})})},"database.deleteDocInTransaction":function(t){return a(this,void 0,void 0,function(){var e;return u(this,function(n){switch(n.label){case 0:return[4,l["database.deleteDocument"].call(this,t)];case 1:return e=n.sent(),[2,l.flattenResData(e)]}})})},"database.insertDocInTransaction":function(t){var e;return a(this,void 0,Promise,function(){var n,r;return u(this,function(o){switch(o.label){case 0:return t.data=l.safeParseEJSON(t.data),[4,l["database.addDocument"].call(this,t)];case 1:return"object"==typeof(n=o.sent()).data&&null!==n.data?(r=!!(null===(e=n.data)||void 0===e?void 0:e._id),n=i(i(i({},n),{inserted:r?1:0,ok:r?1:0}),n.data)):n=i({inserted:0,ok:0},n),delete n.data,[2,n]}})})},"database.runCommands":function(t){return a(this,void 0,Promise,function(){var e;return u(this,function(n){switch(n.label){case 0:return[4,this.gateWay({url:"".concat(l.getUrlPrefix(t),"/commands"),method:"POST",data:i({commands:s.EJSON.serialize(t.commands)},t.transactionId&&{transactionId:t.transactionId})})];case 1:"object"==typeof(e=n.sent()).data&&null!==e.data&&(delete(e=i(i({},e),e.data)).data,delete e.request_id);try{e=s.EJSON.deserialize(e)}catch(t){}return[2,l.filterRes(e)]}})})}},f={name:"database",entity:{database:function(t){var e=this.platform,n=e.adapter,r=e.runtime,s=function(t){function e(e){return t.call(this,e)||this}return o(e,t),e.prototype.send=function(e,n){return a(this,void 0,void 0,function(){var r;return u(this,function(o){switch(o.label){case 0:return r=null,"GATEWAY"===this.config.endPointMode&&l[e]?[4,l[e].call(this,n)]:[3,2];case 1:return r=o.sent(),[3,4];case 2:return[4,t.prototype.send.call(this,e,n)];case 3:r=o.sent(),o.label=4;case 4:return[2,r]}})})},e}(this.request.constructor);return c.Db.reqClass=s,c.Db.getAccessToken=this.authInstance?this.authInstance.getAccessToken.bind(this.authInstance):function(){return""},c.Db.runtime=r,this.wsClientClass&&(c.Db.wsClass=n.wsClass,c.Db.wsClientClass=this.wsClientClass),c.Db.ws||(c.Db.ws=null),new(function(t){function e(e){return t.call(this,e)||this}return o(e,t),e.prototype.runCommands=function(t){return a(this,void 0,Promise,function(){return u(this,function(e){return[2,c.Db.createRequest(this.config).send("database.runCommands",t)]})})},e}(c.Db))(i(i(i({},this.config),{_fromApp:this}),t))}}};try{cloudbase.registerComponent(f)}catch(t){}function d(t){try{t.registerComponent(f)}catch(t){console.warn(t)}}e.registerDatabase=d;try{window.registerDatabase=d}catch(t){}},543:function(t,e,n){n.r(e),n.d(e,{CollectionReference:function(){return Qt},Db:function(){return me},DocumentReference:function(){return Lt},Query:function(){return kt}});var r,o,i={};n.r(i),n.d(i,{LineString:function(){return W},MultiLineString:function(){return Y},MultiPoint:function(){return B},MultiPolygon:function(){return X},Point:function(){return ot},Polygon:function(){return H}}),function(t){t.DocIDError="文档ID不合法",t.CollNameError="集合名称不合法",t.OpStrError="操作符不合法",t.DirectionError="排序字符不合法",t.IntergerError="must be integer",t.QueryParamTypeError="查询参数必须为对象",t.QueryParamValueError="查询参数对象值不能均为undefined"}(o||(o={}));var a,u,c="Object",s="GeoPoint",l="GeoLineString",f="GeoPolygon",d="GeoMultiPoint",p="GeoMultiLineString",h="GeoMultiPolygon",y="Date",m="ServerDate",v=["desc","asc"],w=["<","<=","==",">=",">"];!function(t){t.lt="<",t.gt=">",t.lte="<=",t.gte=">=",t.eq="=="}(a||(a={})),(r={})[a.eq]="$eq",r[a.lt]="$lt",r[a.lte]="$lte",r[a.gt]="$gt",r[a.gte]="$gte",function(t){t.WHERE="WHERE",t.DOC="DOC"}(u||(u={}));var b,g=(b=function(t,e){return b=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])},b(t,e)},function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function n(){this.constructor=t}b(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)}),_=[],O={},E=function(t){function e(e,n){if(n!==O)throw new TypeError("InternalSymbol cannot be constructed with new operator");return t.call(this,e)||this}return g(e,t),e.for=function(t){for(var n=0,r=_.length;n<r;n++)if(_[n].target===t)return _[n].instance;var o=new e(t,O);return _.push({target:t,instance:o}),o},e}(function(t){Object.defineProperties(this,{target:{enumerable:!1,writable:!1,configurable:!1,value:t}})}),N=E,S=N.for("UNSET_FIELD_NAME"),I=N.for("UPDATE_COMMAND"),T=N.for("QUERY_COMMAND"),P=N.for("LOGIC_COMMAND"),q=N.for("GEO_POINT"),A=N.for("SYMBOL_GEO_LINE_STRING"),D=N.for("SYMBOL_GEO_POLYGON"),x=N.for("SYMBOL_GEO_MULTI_POINT"),j=N.for("SYMBOL_GEO_MULTI_LINE_STRING"),C=N.for("SYMBOL_GEO_MULTI_POLYGON"),R=N.for("SERVER_DATE"),L=N.for("REGEXP"),M=function(t){return Object.prototype.toString.call(t).slice(8,-1).toLowerCase()},$=function(t){return"object"===M(t)},F=function(t){return"number"===M(t)},k=function(t){return Array.isArray(t)},J=function(t){return"date"===M(t)},U=function(t){return"regexp"===M(t)},G=function(t){return t&&t._internalType instanceof E},W=function(){function t(t){if(!k(t))throw new TypeError('"points" must be of type Point[]. Received type '.concat(typeof t));if(t.length<2)throw new Error('"points" must contain 2 points at least');t.forEach(function(t){if(!(t instanceof ot))throw new TypeError('"points" must be of type Point[]. Received type '.concat(typeof t,"[]"))}),this.points=t}return t.prototype.parse=function(t){var e;return(e={})[t]={type:"LineString",coordinates:this.points.map(function(t){return t.toJSON().coordinates})},e},t.prototype.toJSON=function(){return{type:"LineString",coordinates:this.points.map(function(t){return t.toJSON().coordinates})}},t.validate=function(t){var e,n;if("LineString"!==t.type||!k(t.coordinates))return!1;try{for(var r=function(t){var e="function"==typeof Symbol&&Symbol.iterator,n=e&&t[e],r=0;if(n)return n.call(t);if(t&&"number"==typeof t.length)return{next:function(){return t&&r>=t.length&&(t=void 0),{value:t&&t[r++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")}(t.coordinates),o=r.next();!o.done;o=r.next()){var i=o.value;if(!F(i[0])||!F(i[1]))return!1}}catch(t){e={error:t}}finally{try{o&&!o.done&&(n=r.return)&&n.call(r)}finally{if(e)throw e.error}}return!0},t.isClosed=function(t){var e=t.points[0],n=t.points[t.points.length-1];if(e.latitude===n.latitude&&e.longitude===n.longitude)return!0},Object.defineProperty(t.prototype,"_internalType",{get:function(){return A},enumerable:!1,configurable:!0}),t}(),Q=function(t){var e="function"==typeof Symbol&&Symbol.iterator,n=e&&t[e],r=0;if(n)return n.call(t);if(t&&"number"==typeof t.length)return{next:function(){return t&&r>=t.length&&(t=void 0),{value:t&&t[r++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")},H=function(){function t(t){if(!k(t))throw new TypeError('"lines" must be of type LineString[]. Received type '.concat(typeof t));if(0===t.length)throw new Error("Polygon must contain 1 linestring at least");t.forEach(function(t){if(!(t instanceof W))throw new TypeError('"lines" must be of type LineString[]. Received type '.concat(typeof t,"[]"));if(!W.isClosed(t))throw new Error("LineString ".concat(t.points.map(function(t){return t.toReadableString()})," is not a closed cycle"))}),this.lines=t}return t.prototype.parse=function(t){var e;return(e={})[t]={type:"Polygon",coordinates:this.lines.map(function(t){return t.points.map(function(t){return[t.longitude,t.latitude]})})},e},t.prototype.toJSON=function(){return{type:"Polygon",coordinates:this.lines.map(function(t){return t.points.map(function(t){return[t.longitude,t.latitude]})})}},t.validate=function(t){var e,n,r,o;if("Polygon"!==t.type||!k(t.coordinates))return!1;try{for(var i=Q(t.coordinates),a=i.next();!a.done;a=i.next()){var u=a.value;if(!this.isCloseLineString(u))return!1;try{for(var c=(r=void 0,Q(u)),s=c.next();!s.done;s=c.next()){var l=s.value;if(!F(l[0])||!F(l[1]))return!1}}catch(t){r={error:t}}finally{try{s&&!s.done&&(o=c.return)&&o.call(c)}finally{if(r)throw r.error}}}}catch(t){e={error:t}}finally{try{a&&!a.done&&(n=i.return)&&n.call(i)}finally{if(e)throw e.error}}return!0},t.isCloseLineString=function(t){var e=t[0],n=t[t.length-1];return e[0]===n[0]&&e[1]===n[1]},Object.defineProperty(t.prototype,"_internalType",{get:function(){return C},enumerable:!1,configurable:!0}),t}(),B=function(){function t(t){if(!k(t))throw new TypeError('"points" must be of type Point[]. Received type '.concat(typeof t));if(0===t.length)throw new Error('"points" must contain 1 point at least');t.forEach(function(t){if(!(t instanceof ot))throw new TypeError('"points" must be of type Point[]. Received type '.concat(typeof t,"[]"))}),this.points=t}return t.prototype.parse=function(t){var e;return(e={})[t]={type:"MultiPoint",coordinates:this.points.map(function(t){return t.toJSON().coordinates})},e},t.prototype.toJSON=function(){return{type:"MultiPoint",coordinates:this.points.map(function(t){return t.toJSON().coordinates})}},t.validate=function(t){var e,n;if("MultiPoint"!==t.type||!k(t.coordinates))return!1;try{for(var r=function(t){var e="function"==typeof Symbol&&Symbol.iterator,n=e&&t[e],r=0;if(n)return n.call(t);if(t&&"number"==typeof t.length)return{next:function(){return t&&r>=t.length&&(t=void 0),{value:t&&t[r++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")}(t.coordinates),o=r.next();!o.done;o=r.next()){var i=o.value;if(!F(i[0])||!F(i[1]))return!1}}catch(t){e={error:t}}finally{try{o&&!o.done&&(n=r.return)&&n.call(r)}finally{if(e)throw e.error}}return!0},Object.defineProperty(t.prototype,"_internalType",{get:function(){return x},enumerable:!1,configurable:!0}),t}(),V=function(t){var e="function"==typeof Symbol&&Symbol.iterator,n=e&&t[e],r=0;if(n)return n.call(t);if(t&&"number"==typeof t.length)return{next:function(){return t&&r>=t.length&&(t=void 0),{value:t&&t[r++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")},Y=function(){function t(t){if(!k(t))throw new TypeError('"lines" must be of type LineString[]. Received type '.concat(typeof t));if(0===t.length)throw new Error("Polygon must contain 1 linestring at least");t.forEach(function(t){if(!(t instanceof W))throw new TypeError('"lines" must be of type LineString[]. Received type '.concat(typeof t,"[]"))}),this.lines=t}return t.prototype.parse=function(t){var e;return(e={})[t]={type:"MultiLineString",coordinates:this.lines.map(function(t){return t.points.map(function(t){return[t.longitude,t.latitude]})})},e},t.prototype.toJSON=function(){return{type:"MultiLineString",coordinates:this.lines.map(function(t){return t.points.map(function(t){return[t.longitude,t.latitude]})})}},t.validate=function(t){var e,n,r,o;if("MultiLineString"!==t.type||!k(t.coordinates))return!1;try{for(var i=V(t.coordinates),a=i.next();!a.done;a=i.next()){var u=a.value;try{for(var c=(r=void 0,V(u)),s=c.next();!s.done;s=c.next()){var l=s.value;if(!F(l[0])||!F(l[1]))return!1}}catch(t){r={error:t}}finally{try{s&&!s.done&&(o=c.return)&&o.call(c)}finally{if(r)throw r.error}}}}catch(t){e={error:t}}finally{try{a&&!a.done&&(n=i.return)&&n.call(i)}finally{if(e)throw e.error}}return!0},Object.defineProperty(t.prototype,"_internalType",{get:function(){return j},enumerable:!1,configurable:!0}),t}(),z=function(t){var e="function"==typeof Symbol&&Symbol.iterator,n=e&&t[e],r=0;if(n)return n.call(t);if(t&&"number"==typeof t.length)return{next:function(){return t&&r>=t.length&&(t=void 0),{value:t&&t[r++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")},X=function(){function t(t){var e,n;if(!k(t))throw new TypeError('"polygons" must be of type Polygon[]. Received type '.concat(typeof t));if(0===t.length)throw new Error("MultiPolygon must contain 1 polygon at least");try{for(var r=z(t),o=r.next();!o.done;o=r.next()){var i=o.value;if(!(i instanceof H))throw new TypeError('"polygon" must be of type Polygon[]. Received type '.concat(typeof i,"[]"))}}catch(t){e={error:t}}finally{try{o&&!o.done&&(n=r.return)&&n.call(r)}finally{if(e)throw e.error}}this.polygons=t}return t.prototype.parse=function(t){var e;return(e={})[t]={type:"MultiPolygon",coordinates:this.polygons.map(function(t){return t.lines.map(function(t){return t.points.map(function(t){return[t.longitude,t.latitude]})})})},e},t.prototype.toJSON=function(){return{type:"MultiPolygon",coordinates:this.polygons.map(function(t){return t.lines.map(function(t){return t.points.map(function(t){return[t.longitude,t.latitude]})})})}},t.validate=function(t){var e,n,r,o,i,a;if("MultiPolygon"!==t.type||!k(t.coordinates))return!1;try{for(var u=z(t.coordinates),c=u.next();!c.done;c=u.next()){var s=c.value;try{for(var l=(r=void 0,z(s)),f=l.next();!f.done;f=l.next()){var d=f.value;try{for(var p=(i=void 0,z(d)),h=p.next();!h.done;h=p.next()){var y=h.value;if(!F(y[0])||!F(y[1]))return!1}}catch(t){i={error:t}}finally{try{h&&!h.done&&(a=p.return)&&a.call(p)}finally{if(i)throw i.error}}}}catch(t){r={error:t}}finally{try{f&&!f.done&&(o=l.return)&&o.call(l)}finally{if(r)throw r.error}}}}catch(t){e={error:t}}finally{try{c&&!c.done&&(n=u.return)&&n.call(u)}finally{if(e)throw e.error}}return!0},Object.defineProperty(t.prototype,"_internalType",{get:function(){return D},enumerable:!1,configurable:!0}),t}(),Z=function(){function t(t){var e=(void 0===t?{}:t).offset,n=void 0===e?0:e;this.offset=n}return Object.defineProperty(t.prototype,"_internalType",{get:function(){return R},enumerable:!1,configurable:!0}),t.prototype.parse=function(){return{$date:{offset:this.offset}}},t}();function K(t){return new Z(t)}var tt,et=function(t,e){var n="function"==typeof Symbol&&t[Symbol.iterator];if(!n)return t;var r,o,i=n.call(t),a=[];try{for(;(void 0===e||e-- >0)&&!(r=i.next()).done;)a.push(r.value)}catch(t){o={error:t}}finally{try{r&&!r.done&&(n=i.return)&&n.call(i)}finally{if(o)throw o.error}}return a},nt=function(){function t(){}return t.formatResDocumentData=function(e){return e.map(function(e){return t.formatField(e)})},t.formatField=function(e){var n=Object.keys(e),r={};return Array.isArray(e)&&(r=[]),n.forEach(function(n){var o,i=e[n];switch(t.whichType(i)){case s:o=new ot(i.coordinates[0],i.coordinates[1]);break;case l:o=new W(i.coordinates.map(function(t){return new ot(t[0],t[1])}));break;case f:o=new H(i.coordinates.map(function(t){return new W(t.map(function(t){var e=et(t,2),n=e[0],r=e[1];return new ot(n,r)}))}));break;case d:o=new B(i.coordinates.map(function(t){return new ot(t[0],t[1])}));break;case p:o=new Y(i.coordinates.map(function(t){return new W(t.map(function(t){var e=et(t,2),n=e[0],r=e[1];return new ot(n,r)}))}));break;case h:o=new X(i.coordinates.map(function(t){return new H(t.map(function(t){return new W(t.map(function(t){var e=et(t,2),n=e[0],r=e[1];return new ot(n,r)}))}))}));break;case y:o=new Date(1e3*i.$timestamp);break;case c:case"Array":o=t.formatField(i);break;case m:o=new Date(i.$date);break;default:o=i}Array.isArray(r)?r.push(o):r[n]=o}),r},t.whichType=function(t){var e=Object.prototype.toString.call(t).slice(8,-1);if(e===y)return"BsonDate";if(e===c){if(t instanceof ot)return s;if(t instanceof Date)return y;if(t instanceof Z)return m;t.$timestamp?e=y:t.$date?e=m:ot.validate(t)?e=s:W.validate(t)?e=l:H.validate(t)?e=f:B.validate(t)?e=d:Y.validate(t)?e=p:X.validate(t)&&(e=h)}return e},t.generateDocId=function(){for(var t="",e=0;e<24;e++)t+="ABCDEFabcdef0123456789".charAt(Math.floor(22*Math.random()));return t},t}(),rt=function(){function t(){}return t.isGeopoint=function(t,e){if("Number"!==nt.whichType(e))throw new Error("Geo Point must be number type");var n=Math.abs(e);if("latitude"===t&&n>90)throw new Error("latitude should be a number ranges from -90 to 90");if("longitude"===t&&n>180)throw new Error("longitude should be a number ranges from -180 to 180");return!0},t.isInteger=function(t,e){if(!Number.isInteger(e))throw new Error(t+o.IntergerError);return!0},t.isFieldOrder=function(t){if(-1===v.indexOf(t))throw new Error(o.DirectionError);return!0},t.isFieldPath=function(t){if(!/^[a-zA-Z0-9-_\.]/.test(t))throw new Error;return!0},t.isOperator=function(t){if(-1===w.indexOf(t))throw new Error(o.OpStrError);return!0},t.isCollName=function(t){if(!/^[a-zA-Z0-9]([a-zA-Z0-9-_]){1,32}$/.test(t))throw new Error(o.CollNameError);return!0},t.isDocID=function(t){if(!/^([a-fA-F0-9]){24}$/.test(t))throw new Error(o.DocIDError);return!0},t}(),ot=function(){function t(t,e){rt.isGeopoint("longitude",t),rt.isGeopoint("latitude",e),this.longitude=t,this.latitude=e}return t.prototype.parse=function(t){var e;return(e={})[t]={type:"Point",coordinates:[this.longitude,this.latitude]},e},t.prototype.toJSON=function(){return{type:"Point",coordinates:[this.longitude,this.latitude]}},t.prototype.toReadableString=function(){return"[".concat(this.longitude,",").concat(this.latitude,"]")},t.validate=function(t){return"Point"===t.type&&k(t.coordinates)&&rt.isGeopoint("longitude",t.coordinates[0])&&rt.isGeopoint("latitude",t.coordinates[1])},Object.defineProperty(t.prototype,"_internalType",{get:function(){return q},enumerable:!1,configurable:!0}),t}(),it=function(){var t=function(){};if(!Promise){t.promise={};var e=function(){throw new Error('Your Node runtime does support ES6 Promises. Set "global.Promise" to your preferred implementation of promises.')};return Object.defineProperty(t.promise,"then",{get:e}),Object.defineProperty(t.promise,"catch",{get:e}),t}var n=new Promise(function(e,n){t=function(t,r){return t?n(t):e(r)}});return t.promise=n,t};!function(t){t.SET="set",t.REMOVE="remove",t.INC="inc",t.MUL="mul",t.PUSH="push",t.PULL="pull",t.PULL_ALL="pullAll",t.POP="pop",t.SHIFT="shift",t.UNSHIFT="unshift",t.ADD_TO_SET="addToSet",t.BIT="bit",t.RENAME="rename",t.MAX="max",t.MIN="min"}(tt||(tt={}));var at,ut=function(){function t(t,e,n){this._internalType=I,Object.defineProperties(this,{_internalType:{enumerable:!1,configurable:!1}}),this.operator=t,this.operands=e,this.fieldName=n||S}return t.prototype._setFieldName=function(e){return new t(this.operator,this.operands,e)},t}();function ct(t){return t&&t instanceof ut&&t._internalType===I}!function(t){t.AND="and",t.OR="or",t.NOT="not",t.NOR="nor"}(at||(at={}));var st=function(){function t(t,e,n){if(this._internalType=P,Object.defineProperties(this,{_internalType:{enumerable:!1,configurable:!1}}),this.operator=t,this.operands=e,this.fieldName=n||S,this.fieldName!==S)if(Array.isArray(e)){e=e.slice(),this.operands=e;for(var r=0,o=e.length;r<o;r++)(lt(i=e[r])||ht(i))&&(e[r]=i._setFieldName(this.fieldName))}else{var i;(lt(i=e)||ht(i))&&(e=i._setFieldName(this.fieldName))}}return t.prototype._setFieldName=function(e){var n=this.operands.map(function(n){return n instanceof t?n._setFieldName(e):n});return new t(this.operator,n,e)},t.prototype.and=function(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];var r=Array.isArray(arguments[0])?arguments[0]:Array.from(arguments);return r.unshift(this),new t(at.AND,r,this.fieldName)},t.prototype.or=function(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];var r=Array.isArray(arguments[0])?arguments[0]:Array.from(arguments);return r.unshift(this),new t(at.OR,r,this.fieldName)},t}();function lt(t){return t&&t instanceof st&&t._internalType===P}var ft,dt=function(){var t=function(e,n){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])},t(e,n)};return function(e,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function r(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}();!function(t){t.EQ="eq",t.NEQ="neq",t.GT="gt",t.GTE="gte",t.LT="lt",t.LTE="lte",t.IN="in",t.NIN="nin",t.ALL="all",t.ELEM_MATCH="elemMatch",t.EXISTS="exists",t.SIZE="size",t.MOD="mod",t.GEO_NEAR="geoNear",t.GEO_WITHIN="geoWithin",t.GEO_INTERSECTS="geoIntersects"}(ft||(ft={}));var pt=function(t){function e(e,n,r){var o=t.call(this,e,n,r)||this;return o.operator=e,o._internalType=T,o}return dt(e,t),e.prototype.toJSON=function(){var t,e;switch(this.operator){case ft.IN:case ft.NIN:return(t={})["$"+this.operator]=this.operands,t;default:return(e={})["$"+this.operator]=this.operands[0],e}},e.prototype._setFieldName=function(t){return new e(this.operator,this.operands,t)},e.prototype.eq=function(t){var n=new e(ft.EQ,[t],this.fieldName);return this.and(n)},e.prototype.neq=function(t){var n=new e(ft.NEQ,[t],this.fieldName);return this.and(n)},e.prototype.gt=function(t){var n=new e(ft.GT,[t],this.fieldName);return this.and(n)},e.prototype.gte=function(t){var n=new e(ft.GTE,[t],this.fieldName);return this.and(n)},e.prototype.lt=function(t){var n=new e(ft.LT,[t],this.fieldName);return this.and(n)},e.prototype.lte=function(t){var n=new e(ft.LTE,[t],this.fieldName);return this.and(n)},e.prototype.in=function(t){var n=new e(ft.IN,t,this.fieldName);return this.and(n)},e.prototype.nin=function(t){var n=new e(ft.NIN,t,this.fieldName);return this.and(n)},e.prototype.geoNear=function(t){if(!(t.geometry instanceof ot))throw new TypeError('"geometry" must be of type Point. Received type '.concat(typeof t.geometry));if(void 0!==t.maxDistance&&!F(t.maxDistance))throw new TypeError('"maxDistance" must be of type Number. Received type '.concat(typeof t.maxDistance));if(void 0!==t.minDistance&&!F(t.minDistance))throw new TypeError('"minDistance" must be of type Number. Received type '.concat(typeof t.minDistance));var n=new e(ft.GEO_NEAR,[t],this.fieldName);return this.and(n)},e.prototype.geoWithin=function(t){if(!(t.geometry instanceof X||t.geometry instanceof H))throw new TypeError('"geometry" must be of type Polygon or MultiPolygon. Received type '.concat(typeof t.geometry));var n=new e(ft.GEO_WITHIN,[t],this.fieldName);return this.and(n)},e.prototype.geoIntersects=function(t){if(!(t.geometry instanceof ot||t.geometry instanceof W||t.geometry instanceof H||t.geometry instanceof B||t.geometry instanceof Y||t.geometry instanceof X))throw new TypeError('"geometry" must be of type Point, LineString, Polygon, MultiPoint, MultiLineString or MultiPolygon. Received type '.concat(typeof t.geometry));var n=new e(ft.GEO_INTERSECTS,[t],this.fieldName);return this.and(n)},e}(st);function ht(t){return t&&t instanceof pt&&t._internalType===T}function yt(t){return ht(t)}var mt={};for(var vt in ft)mt[vt]="$"+vt;for(var vt in at)mt[vt]="$"+vt;for(var vt in tt)mt[vt]="$"+vt;function wt(t){return mt[t]||"$"+t}mt[ft.NEQ]="$ne",mt[tt.REMOVE]="$unset",mt[tt.SHIFT]="$pop",mt[tt.UNSHIFT]="$push";var bt=function(){return bt=Object.assign||function(t){for(var e,n=1,r=arguments.length;n<r;n++)for(var o in e=arguments[n])Object.prototype.hasOwnProperty.call(e,o)&&(t[o]=e[o]);return t},bt.apply(this,arguments)},gt=function(t,e){var n="function"==typeof Symbol&&t[Symbol.iterator];if(!n)return t;var r,o,i=n.call(t),a=[];try{for(;(void 0===e||e-- >0)&&!(r=i.next()).done;)a.push(r.value)}catch(t){o={error:t}}finally{try{r&&!r.done&&(n=i.return)&&n.call(i)}finally{if(o)throw o.error}}return a},_t=function(t,e,n){if(n||2===arguments.length)for(var r,o=0,i=e.length;o<i;o++)!r&&o in e||(r||(r=Array.prototype.slice.call(e,0,o)),r[o]=e[o]);return t.concat(r||Array.prototype.slice.call(e))};function Ot(t){return Et(t,[t])}function Et(t,e){if(!G(t)){if(J(t))return{$date:+t};if(U(t))return{$regex:t.source,$options:t.flags};if(k(t))return t.map(function(t){if(e.indexOf(t)>-1)throw new Error("Cannot convert circular structure to JSON");return Et(t,_t(_t([],gt(e),!1),[t],!1))});if($(t)){var n=bt({},t);for(var r in n){if(e.indexOf(n[r])>-1)throw new Error("Cannot convert circular structure to JSON");n[r]=Et(n[r],_t(_t([],gt(e),!1),[n[r]],!1))}return n}return t}switch(t._internalType){case q:return t.toJSON();case R:case L:return t.parse();default:return t.toJSON?t.toJSON():t}}var Nt=function(){return Nt=Object.assign||function(t){for(var e,n=1,r=arguments.length;n<r;n++)for(var o in e=arguments[n])Object.prototype.hasOwnProperty.call(e,o)&&(t[o]=e[o]);return t},Nt.apply(this,arguments)},St=function(t,e){var n="function"==typeof Symbol&&t[Symbol.iterator];if(!n)return t;var r,o,i=n.call(t),a=[];try{for(;(void 0===e||e-- >0)&&!(r=i.next()).done;)a.push(r.value)}catch(t){o={error:t}}finally{try{r&&!r.done&&(n=i.return)&&n.call(i)}finally{if(o)throw o.error}}return a},It=function(t,e,n){if(n||2===arguments.length)for(var r,o=0,i=e.length;o<i;o++)!r&&o in e||(r||(r=Array.prototype.slice.call(e,0,o)),r[o]=e[o]);return t.concat(r||Array.prototype.slice.call(e))};function Tt(t,e,n,r){var o=Nt({},t);for(var i in t)if(!/^\$/.test(i)){var a=t[i];if(a&&$(a)&&!e(a)){if(r.indexOf(a)>-1)throw new Error("Cannot convert circular structure to JSON");var u=Tt(a,e,It(It([],St(n),!1),[i],!1),It(It([],St(r),!1),[a],!1));o[i]=u;var c=!1;for(var s in u)/^\$/.test(s)?c=!0:(o["".concat(i,".").concat(s)]=u[s],delete o[i][s]);c||delete o[i]}}return o}function Pt(t){return Tt(t,At,[],[t])}function qt(t,e,n){for(var r in e[n]||delete t[n],e)t[r]?k(t[r])?t[r].push(e[r]):$(t[r])?$(e[r])?Object.assign(t[r],e[r]):(console.warn("unmergable condition, query is object but condition is ".concat(M(e),", can only overwrite"),e,n),t[r]=e[r]):(console.warn("to-merge query is of type ".concat(M(t),", can only overwrite"),t,e,n),t[r]=e[r]):t[r]=e[r]}function At(t){return G(t)||J(t)||U(t)}function Dt(t){return Ot(t)}var xt=function(){function t(){}return t.encode=function(e){return(new t).encodeUpdate(e)},t.prototype.encodeUpdate=function(t){return ct(t)?this.encodeUpdateCommand(t):"object"===M(t)?this.encodeUpdateObject(t):t},t.prototype.encodeUpdateCommand=function(t){if(t.fieldName===S)throw new Error("Cannot encode a comparison command with unset field name");switch(t.operator){case tt.PUSH:case tt.PULL:case tt.PULL_ALL:case tt.POP:case tt.SHIFT:case tt.UNSHIFT:case tt.ADD_TO_SET:return this.encodeArrayUpdateCommand(t);default:return this.encodeFieldUpdateCommand(t)}},t.prototype.encodeFieldUpdateCommand=function(t){var e,n,r,o,i=wt(t.operator);return t.operator===tt.REMOVE?((e={})[i]=((n={})[t.fieldName]="",n),e):((r={})[i]=((o={})[t.fieldName]=t.operands[0],o),r)},t.prototype.encodeArrayUpdateCommand=function(t){var e,n,r,o,i,a,u,c,s,l,f=wt(t.operator);switch(t.operator){case tt.PUSH:var d=void 0;return d=k(t.operands)?{$each:t.operands.map(Dt)}:t.operands,(e={})[f]=((n={})[t.fieldName]=d,n),e;case tt.UNSHIFT:return d={$each:t.operands.map(Dt),$position:0},(r={})[f]=((o={})[t.fieldName]=d,o),r;case tt.POP:return(i={})[f]=((a={})[t.fieldName]=1,a),i;case tt.SHIFT:return(u={})[f]=((c={})[t.fieldName]=-1,c),u;default:return(s={})[f]=((l={})[t.fieldName]=Dt(t.operands),l),s}},t.prototype.encodeUpdateObject=function(t){var e=Pt(t);for(var n in e)if(!/^\$/.test(n)){var r=e[n];if(ct(r))e[n]=r._setFieldName(n),qt(e,this.encodeUpdateCommand(e[n]),n);else{e[n]=r=Dt(r);var o=new ut(tt.SET,[r],n);qt(e,this.encodeUpdateCommand(o),n)}}return e},t}(),jt={};function Ct(t){if(!me.wsClientClass)throw new Error("to use realtime you must import realtime module first");var e=t.config.env;return jt[e]||(jt[e]=new me.wsClientClass({context:{appConfig:{docSizeLimit:1e3,realtimePingInterval:1e4,realtimePongWaitTimeout:5e3,request:me.createRequest(t.config)}}})),jt[e]}var Rt=function(){return Rt=Object.assign||function(t){for(var e,n=1,r=arguments.length;n<r;n++)for(var o in e=arguments[n])Object.prototype.hasOwnProperty.call(e,o)&&(t[o]=e[o]);return t},Rt.apply(this,arguments)},Lt=function(){function t(t,e,n,r){void 0===r&&(r={});var o=this;this.watch=function(t){return Ct(o._db).watch(Rt(Rt({},t),{envId:o._db.config.env,collectionName:o._coll,query:JSON.stringify({_id:o.id})}))},this._db=t,this._coll=e,this.id=n,this.request=me.createRequest(this._db.config),this.projection=r}return t.prototype.create=function(t,e){e=e||it();var n=Array.isArray(t),r={collectionName:this._coll,data:n?t.map(function(t){return Ot(t)}):Ot(t)};return!n&&this.id&&(r._id=this.id),this.request.send("database.addDocument",r).then(function(t){var r;t.code?e(0,t):e(0,n?{ids:(null===(r=t.data)||void 0===r?void 0:r.insertedIds)||[],requestId:t.requestId}:{id:t.data._id,requestId:t.requestId})}).catch(function(t){e(t)}),e.promise},t.prototype.set=function(t,e){if(e=e||it(),!this.id)return Promise.resolve({code:"INVALID_PARAM",message:"docId不能为空"});if(!t||"object"!=typeof t)return Promise.resolve({code:"INVALID_PARAM",message:"参数必需是非空对象"});if(t.hasOwnProperty("_id"))return Promise.resolve({code:"INVALID_PARAM",message:"不能更新_id的值"});var n=!1,r=function(t){if("object"==typeof t)for(var e in t)t[e]instanceof ut?n=!0:"object"==typeof t[e]&&r(t[e])};if(r(t),n)return Promise.resolve({code:"DATABASE_REQUEST_FAILED",message:"update operator complicit"});var o={collectionName:this._coll,queryType:u.DOC,data:Ot(t),multi:!1,merge:!1,upsert:!0};return this.id&&(o.query={_id:this.id}),this.request.send("database.updateDocument",o).then(function(t){t.code?e(0,t):e(0,{updated:t.data.updated,upsertedId:t.data.upserted_id,requestId:t.requestId})}).catch(function(t){e(t)}),e.promise},t.prototype.update=function(t,e){if(e=e||it(),!t||"object"!=typeof t)return Promise.resolve({code:"INVALID_PARAM",message:"参数必需是非空对象"});if(t.hasOwnProperty("_id"))return Promise.resolve({code:"INVALID_PARAM",message:"不能更新_id的值"});var n={_id:this.id},r={collectionName:this._coll,data:xt.encode(t),query:n,queryType:u.DOC,multi:!1,merge:!0,upsert:!1};return this.request.send("database.updateDocument",r).then(function(t){t.code?e(0,t):e(0,{updated:t.data.updated,upsertedId:t.data.upserted_id,requestId:t.requestId})}).catch(function(t){e(t)}),e.promise},t.prototype.remove=function(t){t=t||it();var e={_id:this.id},n={collectionName:this._coll,query:e,queryType:u.DOC,multi:!1};return this.request.send("database.deleteDocument",n).then(function(e){e.code?t(0,e):t(0,{deleted:e.data.deleted,requestId:e.requestId})}).catch(function(e){t(e)}),t.promise},t.prototype.get=function(t){t=t||it();var e={_id:this.id},n={collectionName:this._coll,query:e,queryType:u.DOC,multi:!1,projection:this.projection};return this.request.send("database.queryDocument",n).then(function(e){if(e.code)t(0,e);else{var n=nt.formatResDocumentData(e.data.list);t(0,{data:n,requestId:e.requestId})}}).catch(function(e){t(e)}),t.promise},t.prototype.field=function(e){for(var n in e)e[n]?e[n]=1:e[n]=0;return new t(this._db,this._coll,this.id,e)},t}(),Mt=function(){function t(){}return t.encode=function(t){return(new $t).encodeQuery(t)},t}(),$t=function(){function t(){}return t.prototype.encodeQuery=function(t,e){var n;return At(t)?lt(t)?this.encodeLogicCommand(t):ht(t)?this.encodeQueryCommand(t):((n={})[e]=this.encodeQueryObject(t),n):$(t)?this.encodeQueryObject(t):t},t.prototype.encodeRegExp=function(t){return{$regex:t.source,$options:t.flags}},t.prototype.encodeLogicCommand=function(t){var e,n,r,o,i,a,u,c=this;switch(t.operator){case at.NOR:case at.AND:case at.OR:var s=wt(t.operator),l=t.operands.map(function(e){return c.encodeQuery(e,t.fieldName)});return(e={})[s]=l,e;case at.NOT:s=wt(t.operator);var f=t.operands[0];return U(f)?((n={})[t.fieldName]=((r={})[s]=this.encodeRegExp(f),r),n):(l=this.encodeQuery(f)[t.fieldName],(o={})[t.fieldName]=((i={})[s]=l,i),o);default:if(s=wt(t.operator),1===t.operands.length){var d=this.encodeQuery(t.operands[0]);return(a={})[s]=d,a}return l=t.operands.map(this.encodeQuery.bind(this)),(u={})[s]=l,u}},t.prototype.encodeQueryCommand=function(t){return yt(t),this.encodeComparisonCommand(t)},t.prototype.encodeComparisonCommand=function(t){var e,n,r,o,i,a,u,c,s;if(t.fieldName===S)throw new Error("Cannot encode a comparison command with unset field name");var l=wt(t.operator);switch(t.operator){case ft.EQ:case ft.NEQ:case ft.LT:case ft.LTE:case ft.GT:case ft.GTE:case ft.ELEM_MATCH:case ft.EXISTS:case ft.SIZE:case ft.MOD:return(e={})[t.fieldName]=((n={})[l]=Dt(t.operands[0]),n),e;case ft.IN:case ft.NIN:case ft.ALL:return(r={})[t.fieldName]=((o={})[l]=Dt(t.operands),o),r;case ft.GEO_NEAR:var f=t.operands[0];return(i={})[t.fieldName]={$nearSphere:{$geometry:f.geometry.toJSON(),$maxDistance:f.maxDistance,$minDistance:f.minDistance}},i;case ft.GEO_WITHIN:return f=t.operands[0],(a={})[t.fieldName]={$geoWithin:{$geometry:f.geometry.toJSON()}},a;case ft.GEO_INTERSECTS:return f=t.operands[0],(u={})[t.fieldName]={$geoIntersects:{$geometry:f.geometry.toJSON()}},u;default:return(c={})[t.fieldName]=((s={})[l]=Dt(t.operands[0]),s),c}},t.prototype.encodeQueryObject=function(t){var e=Pt(t);for(var n in e){var r=e[n];if(lt(r)){e[n]=r._setFieldName(n);var o=this.encodeLogicCommand(e[n]);this.mergeConditionAfterEncode(e,o,n)}else yt(r)?(e[n]=r._setFieldName(n),o=this.encodeComparisonCommand(e[n]),this.mergeConditionAfterEncode(e,o,n)):At(r)&&(e[n]=Dt(r))}return e},t.prototype.mergeConditionAfterEncode=function(t,e,n){for(var r in e[n]||delete t[n],e)t[r]?k(t[r])?t[r]=t[r].concat(e[r]):$(t[r])?$(e[r])?Object.assign(t,e):(console.warn("unmergable condition, query is object but condition is ".concat(M(e),", can only overwrite"),e,n),t[r]=e[r]):(console.warn("to-merge query is of type ".concat(M(t),", can only overwrite"),t,e,n),t[r]=e[r]):t[r]=e[r]},t}(),Ft=function(){return Ft=Object.assign||function(t){for(var e,n=1,r=arguments.length;n<r;n++)for(var o in e=arguments[n])Object.prototype.hasOwnProperty.call(e,o)&&(t[o]=e[o]);return t},Ft.apply(this,arguments)},kt=function(){function t(t,e,n,r,o){var i=this;this.watch=function(t){return Ct(i._db).watch(Ft(Ft({},t),{envId:i._db.config.env,collectionName:i._coll,query:JSON.stringify(i._fieldFilters||{}),limit:i._queryOptions.limit,orderBy:i._fieldOrders?i._fieldOrders.reduce(function(t,e){return t[e.field]=e.direction,t},{}):void 0}))},this._db=t,this._coll=e,this._fieldFilters=n,this._fieldOrders=r||[],this._queryOptions=o||{},this._request=me.createRequest(this._db.config)}return t.prototype.get=function(t){t=t||it();var e=[];this._fieldOrders&&this._fieldOrders.forEach(function(t){e.push(t)});var n={collectionName:this._coll,queryType:u.WHERE};return this._fieldFilters&&(n.query=this._fieldFilters),e.length>0&&(n.order=e),this._queryOptions.offset&&(n.offset=this._queryOptions.offset),this._queryOptions.limit?n.limit=this._queryOptions.limit<1e3?this._queryOptions.limit:1e3:n.limit=100,this._queryOptions.projection&&(n.projection=this._queryOptions.projection),this._request.send("database.queryDocument",n).then(function(e){if(e.code)t(0,e);else{var n={data:nt.formatResDocumentData(e.data.list),requestId:e.requestId};void 0!==e.total&&(n.total=e.total),void 0!==e.limit&&(n.limit=e.limit),void 0!==e.offset&&(n.offset=e.offset),t(0,n)}}).catch(function(e){t(e)}),t.promise},t.prototype.count=function(t){t=t||it();var e={collectionName:this._coll,queryType:u.WHERE};return this._fieldFilters&&(e.query=this._fieldFilters),this._request.send("database.countDocument",e).then(function(e){e.code?t(0,e):t(0,{requestId:e.requestId,total:e.data.total})}).catch(function(e){t(e)}),t.promise},t.prototype.where=function(e){if("Object"!==Object.prototype.toString.call(e).slice(8,-1))throw Error(o.QueryParamTypeError);var n=Object.keys(e),r=n.some(function(t){return void 0!==e[t]});if(n.length&&!r)throw Error(o.QueryParamValueError);return new t(this._db,this._coll,Mt.encode(e),this._fieldOrders,this._queryOptions)},t.prototype.orderBy=function(e,n){rt.isFieldPath(e),rt.isFieldOrder(n);var r={field:e,direction:n},o=this._fieldOrders.concat(r);return new t(this._db,this._coll,this._fieldFilters,o,this._queryOptions)},t.prototype.limit=function(e){rt.isInteger("limit",e);var n=Ft({},this._queryOptions);return n.limit=e,new t(this._db,this._coll,this._fieldFilters,this._fieldOrders,n)},t.prototype.skip=function(e){rt.isInteger("offset",e);var n=Ft({},this._queryOptions);return n.offset=e,new t(this._db,this._coll,this._fieldFilters,this._fieldOrders,n)},t.prototype.update=function(t,e){if(e=e||it(),!t||"object"!=typeof t)return Promise.resolve({code:"INVALID_PARAM",message:"参数必需是非空对象"});if(t.hasOwnProperty("_id"))return Promise.resolve({code:"INVALID_PARAM",message:"不能更新_id的值"});var n={collectionName:this._coll,query:this._fieldFilters,queryType:u.WHERE,multi:!0,merge:!0,upsert:!1,data:xt.encode(t)};return this._request.send("database.updateDocument",n).then(function(t){t.code?e(0,t):e(0,{requestId:t.requestId,updated:t.data.updated,upsertId:t.data.upsert_id})}).catch(function(t){e(t)}),e.promise},t.prototype.field=function(e){for(var n in e)e[n]?"object"!=typeof e[n]&&(e[n]=1):e[n]=0;var r=Ft({},this._queryOptions);return r.projection=e,new t(this._db,this._coll,this._fieldFilters,this._fieldOrders,r)},t.prototype.remove=function(t){t=t||it(),Object.keys(this._queryOptions).length>0&&console.warn("`offset`, `limit` and `projection` are not supported in remove() operation"),this._fieldOrders.length>0&&console.warn("`orderBy` is not supported in remove() operation");var e={collectionName:this._coll,query:Mt.encode(this._fieldFilters),queryType:u.WHERE,multi:!0};return this._request.send("database.deleteDocument",e).then(function(e){e.code?t(0,e):t(0,{requestId:e.requestId,deleted:e.data.deleted})}).catch(function(e){t(e)}),t.promise},t}(),Jt=n(701),Ut=function(){function t(t,e){this._stages=[],t&&e&&(this._db=t,this._request=me.createRequest(this._db.config),this._collectionName=e)}return t.prototype.end=function(){return t=this,e=void 0,r=function(){var t;return function(t,e){var n,r,o,i,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:u(0),throw:u(1),return:u(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function u(u){return function(c){return function(u){if(n)throw new TypeError("Generator is already executing.");for(;i&&(i=0,u[0]&&(a=0)),a;)try{if(n=1,r&&(o=2&u[0]?r.return:u[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,u[1])).done)return o;switch(r=0,o&&(u=[2&u[0],o.value]),u[0]){case 0:case 1:o=u;break;case 4:return a.label++,{value:u[1],done:!1};case 5:a.label++,r=u[1],u=[0];continue;case 7:u=a.ops.pop(),a.trys.pop();continue;default:if(!((o=(o=a.trys).length>0&&o[o.length-1])||6!==u[0]&&2!==u[0])){a=0;continue}if(3===u[0]&&(!o||u[1]>o[0]&&u[1]<o[3])){a.label=u[1];break}if(6===u[0]&&a.label<o[1]){a.label=o[1],o=u;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(u);break}o[2]&&a.ops.pop(),a.trys.pop();continue}u=e.call(t,a)}catch(t){u=[6,t],r=0}finally{n=o=0}if(5&u[0])throw u[1];return{value:u[0]?u[1]:void 0,done:!0}}([u,c])}}}(this,function(e){switch(e.label){case 0:if(!this._collectionName||!this._db)throw new Error("Aggregation pipeline cannot send request");return[4,this._request.send("database.aggregate",{collectionName:this._collectionName,stages:this._stages})];case 1:return(t=e.sent())&&t.data&&t.data.list?[2,{requestId:t.requestId,data:JSON.parse(t.data.list).map(Jt.EJSON.parse)}]:[2,t]}})},new((n=void 0)||(n=Promise))(function(o,i){function a(t){try{c(r.next(t))}catch(t){i(t)}}function u(t){try{c(r.throw(t))}catch(t){i(t)}}function c(t){var e;t.done?o(t.value):(e=t.value,e instanceof n?e:new n(function(t){t(e)})).then(a,u)}c((r=r.apply(t,e||[])).next())});var t,e,n,r},t.prototype.unwrap=function(){return this._stages},t.prototype.done=function(){return this._stages.map(function(t){var e,n=t.stageKey,r=t.stageValue;return(e={})[n]=JSON.parse(r),e})},t.prototype._pipe=function(t,e){return this._stages.push({stageKey:"$".concat(t),stageValue:JSON.stringify(e)}),this},t.prototype.addFields=function(t){return this._pipe("addFields",t)},t.prototype.bucket=function(t){return this._pipe("bucket",t)},t.prototype.bucketAuto=function(t){return this._pipe("bucketAuto",t)},t.prototype.count=function(t){return this._pipe("count",t)},t.prototype.geoNear=function(t){return t.query&&(t.query=Mt.encode(t.query)),t.distanceMultiplier&&"number"==typeof t.distanceMultiplier&&(t.distanceMultiplier=t.distanceMultiplier),t.near&&(t.near=new ot(t.near.longitude,t.near.latitude).toJSON()),this._pipe("geoNear",t)},t.prototype.group=function(t){return this._pipe("group",t)},t.prototype.limit=function(t){return this._pipe("limit",t)},t.prototype.match=function(t){return this._pipe("match",Mt.encode(t))},t.prototype.project=function(t){return this._pipe("project",t)},t.prototype.lookup=function(t){return this._pipe("lookup",t)},t.prototype.replaceRoot=function(t){return this._pipe("replaceRoot",t)},t.prototype.sample=function(t){return this._pipe("sample",t)},t.prototype.skip=function(t){return this._pipe("skip",t)},t.prototype.sort=function(t){return this._pipe("sort",t)},t.prototype.sortByCount=function(t){return this._pipe("sortByCount",t)},t.prototype.unwind=function(t){return this._pipe("unwind",t)},t}(),Gt=Ut,Wt=function(){var t=function(e,n){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])},t(e,n)};return function(e,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function r(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}(),Qt=function(t){function e(e,n){return t.call(this,e,n)||this}return Wt(e,t),Object.defineProperty(e.prototype,"name",{get:function(){return this._coll},enumerable:!1,configurable:!0}),e.prototype.doc=function(t){if("string"!=typeof t&&"number"!=typeof t)throw new Error("docId必须为字符串或数字");return new Lt(this._db,this._coll,t)},e.prototype.add=function(t,e){return new Lt(this._db,this._coll,void 0).create(t,e)},e.prototype.aggregate=function(){return new Gt(this._db,this._coll)},e}(kt),Ht={eq:function(t){return new pt(ft.EQ,[t])},neq:function(t){return new pt(ft.NEQ,[t])},lt:function(t){return new pt(ft.LT,[t])},lte:function(t){return new pt(ft.LTE,[t])},gt:function(t){return new pt(ft.GT,[t])},gte:function(t){return new pt(ft.GTE,[t])},in:function(t){return new pt(ft.IN,t)},nin:function(t){return new pt(ft.NIN,t)},all:function(t){return new pt(ft.ALL,t)},elemMatch:function(t){return new pt(ft.ELEM_MATCH,[t])},exists:function(t){return new pt(ft.EXISTS,[t])},size:function(t){return new pt(ft.SIZE,[t])},mod:function(t){return new pt(ft.MOD,[t])},geoNear:function(t){return new pt(ft.GEO_NEAR,[t])},geoWithin:function(t){return new pt(ft.GEO_WITHIN,[t])},geoIntersects:function(t){return new pt(ft.GEO_INTERSECTS,[t])},and:function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];var n=k(arguments[0])?arguments[0]:Array.from(arguments);return new st(at.AND,n)},nor:function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];var n=k(arguments[0])?arguments[0]:Array.from(arguments);return new st(at.NOR,n)},or:function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];var n=k(arguments[0])?arguments[0]:Array.from(arguments);return new st(at.OR,n)},not:function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];var n=k(arguments[0])?arguments[0]:Array.from(arguments);return new st(at.NOT,n)},set:function(t){return new ut(tt.SET,[t])},remove:function(){return new ut(tt.REMOVE,[])},inc:function(t){return new ut(tt.INC,[t])},mul:function(t){return new ut(tt.MUL,[t])},push:function(){for(var t,e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];if($(e[0])&&e[0].hasOwnProperty("each")){var r=e[0];t={$each:r.each,$position:r.position,$sort:r.sort,$slice:r.slice}}else t=k(e[0])?e[0]:Array.from(e);return new ut(tt.PUSH,t)},pull:function(t){return new ut(tt.PULL,t)},pullAll:function(t){return new ut(tt.PULL_ALL,t)},pop:function(){return new ut(tt.POP,[])},shift:function(){return new ut(tt.SHIFT,[])},unshift:function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];var n=k(arguments[0])?arguments[0]:Array.from(arguments);return new ut(tt.UNSHIFT,n)},addToSet:function(t){return new ut(tt.ADD_TO_SET,t)},rename:function(t){return new ut(tt.RENAME,[t])},bit:function(t){return new ut(tt.BIT,[t])},max:function(t){return new ut(tt.MAX,[t])},min:function(t){return new ut(tt.MIN,[t])},expr:function(t){return{$expr:t}},jsonSchema:function(t){return{$jsonSchema:t}},text:function(t){return"string"===M(t)?{$search:t.search}:{$search:t.search,$language:t.language,$caseSensitive:t.caseSensitive,$diacriticSensitive:t.diacriticSensitive}},aggregate:{pipeline:function(){return new Gt},abs:function(t){return new Bt("abs",t)},add:function(t){return new Bt("add",t)},ceil:function(t){return new Bt("ceil",t)},divide:function(t){return new Bt("divide",t)},exp:function(t){return new Bt("exp",t)},floor:function(t){return new Bt("floor",t)},ln:function(t){return new Bt("ln",t)},log:function(t){return new Bt("log",t)},log10:function(t){return new Bt("log10",t)},mod:function(t){return new Bt("mod",t)},multiply:function(t){return new Bt("multiply",t)},pow:function(t){return new Bt("pow",t)},sqrt:function(t){return new Bt("sqrt",t)},subtract:function(t){return new Bt("subtract",t)},trunc:function(t){return new Bt("trunc",t)},arrayElemAt:function(t){return new Bt("arrayElemAt",t)},arrayToObject:function(t){return new Bt("arrayToObject",t)},concatArrays:function(t){return new Bt("concatArrays",t)},filter:function(t){return new Bt("filter",t)},in:function(t){return new Bt("in",t)},indexOfArray:function(t){return new Bt("indexOfArray",t)},isArray:function(t){return new Bt("isArray",t)},map:function(t){return new Bt("map",t)},range:function(t){return new Bt("range",t)},reduce:function(t){return new Bt("reduce",t)},reverseArray:function(t){return new Bt("reverseArray",t)},size:function(t){return new Bt("size",t)},slice:function(t){return new Bt("slice",t)},zip:function(t){return new Bt("zip",t)},and:function(t){return new Bt("and",t)},not:function(t){return new Bt("not",t)},or:function(t){return new Bt("or",t)},cmp:function(t){return new Bt("cmp",t)},eq:function(t){return new Bt("eq",t)},gt:function(t){return new Bt("gt",t)},gte:function(t){return new Bt("gte",t)},lt:function(t){return new Bt("lt",t)},lte:function(t){return new Bt("lte",t)},neq:function(t){return new Bt("ne",t)},cond:function(t){return new Bt("cond",t)},ifNull:function(t){return new Bt("ifNull",t)},switch:function(t){return new Bt("switch",t)},dateFromParts:function(t){return new Bt("dateFromParts",t)},dateFromString:function(t){return new Bt("dateFromString",t)},dayOfMonth:function(t){return new Bt("dayOfMonth",t)},dayOfWeek:function(t){return new Bt("dayOfWeek",t)},dayOfYear:function(t){return new Bt("dayOfYear",t)},isoDayOfWeek:function(t){return new Bt("isoDayOfWeek",t)},isoWeek:function(t){return new Bt("isoWeek",t)},isoWeekYear:function(t){return new Bt("isoWeekYear",t)},millisecond:function(t){return new Bt("millisecond",t)},minute:function(t){return new Bt("minute",t)},month:function(t){return new Bt("month",t)},second:function(t){return new Bt("second",t)},hour:function(t){return new Bt("hour",t)},week:function(t){return new Bt("week",t)},year:function(t){return new Bt("year",t)},literal:function(t){return new Bt("literal",t)},mergeObjects:function(t){return new Bt("mergeObjects",t)},objectToArray:function(t){return new Bt("objectToArray",t)},allElementsTrue:function(t){return new Bt("allElementsTrue",t)},anyElementTrue:function(t){return new Bt("anyElementTrue",t)},setDifference:function(t){return new Bt("setDifference",t)},setEquals:function(t){return new Bt("setEquals",t)},setIntersection:function(t){return new Bt("setIntersection",t)},setIsSubset:function(t){return new Bt("setIsSubset",t)},setUnion:function(t){return new Bt("setUnion",t)},concat:function(t){return new Bt("concat",t)},dateToString:function(t){return new Bt("dateToString",t)},indexOfBytes:function(t){return new Bt("indexOfBytes",t)},indexOfCP:function(t){return new Bt("indexOfCP",t)},split:function(t){return new Bt("split",t)},strLenBytes:function(t){return new Bt("strLenBytes",t)},strLenCP:function(t){return new Bt("strLenCP",t)},strcasecmp:function(t){return new Bt("strcasecmp",t)},substr:function(t){return new Bt("substr",t)},substrBytes:function(t){return new Bt("substrBytes",t)},substrCP:function(t){return new Bt("substrCP",t)},toLower:function(t){return new Bt("toLower",t)},toUpper:function(t){return new Bt("toUpper",t)},meta:function(t){return new Bt("meta",t)},addToSet:function(t){return new Bt("addToSet",t)},avg:function(t){return new Bt("avg",t)},first:function(t){return new Bt("first",t)},last:function(t){return new Bt("last",t)},max:function(t){return new Bt("max",t)},min:function(t){return new Bt("min",t)},push:function(t){return new Bt("push",t)},stdDevPop:function(t){return new Bt("stdDevPop",t)},stdDevSamp:function(t){return new Bt("stdDevSamp",t)},sum:function(t){return new Bt("sum",t)},let:function(t){return new Bt("let",t)}},project:{slice:function(t){return new Vt("slice",t)},elemMatch:function(t){return new Vt("elemMatch",t)}}},Bt=function(t,e){this["$"+t]=e},Vt=function(t,e){this["$"+t]=e},Yt=function(){function t(t){var e=t.regexp,n=t.options;if(!e)throw new TypeError("regexp must be a string");this.$regex=e,this.$options=n}return t.prototype.parse=function(){return{$regex:this.$regex,$options:this.$options}},Object.defineProperty(t.prototype,"_internalType",{get:function(){return L},enumerable:!1,configurable:!0}),t}();function zt(t){return new Yt(t)}var Xt="insert document failed",Zt="DATABASE_TRANSACTION_CONFLICT",Kt=function(){return Kt=Object.assign||function(t){for(var e,n=1,r=arguments.length;n<r;n++)for(var o in e=arguments[n])Object.prototype.hasOwnProperty.call(e,o)&&(t[o]=e[o]);return t},Kt.apply(this,arguments)},te=function(t,e,n,r){return new(n||(n=Promise))(function(o,i){function a(t){try{c(r.next(t))}catch(t){i(t)}}function u(t){try{c(r.throw(t))}catch(t){i(t)}}function c(t){var e;t.done?o(t.value):(e=t.value,e instanceof n?e:new n(function(t){t(e)})).then(a,u)}c((r=r.apply(t,e||[])).next())})},ee=function(t,e){var n,r,o,i,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:u(0),throw:u(1),return:u(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function u(u){return function(c){return function(u){if(n)throw new TypeError("Generator is already executing.");for(;i&&(i=0,u[0]&&(a=0)),a;)try{if(n=1,r&&(o=2&u[0]?r.return:u[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,u[1])).done)return o;switch(r=0,o&&(u=[2&u[0],o.value]),u[0]){case 0:case 1:o=u;break;case 4:return a.label++,{value:u[1],done:!1};case 5:a.label++,r=u[1],u=[0];continue;case 7:u=a.ops.pop(),a.trys.pop();continue;default:if(!((o=(o=a.trys).length>0&&o[o.length-1])||6!==u[0]&&2!==u[0])){a=0;continue}if(3===u[0]&&(!o||u[1]>o[0]&&u[1]<o[3])){a.label=u[1];break}if(6===u[0]&&a.label<o[1]){a.label=o[1],o=u;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(u);break}o[2]&&a.ops.pop(),a.trys.pop();continue}u=e.call(t,a)}catch(t){u=[6,t],r=0}finally{n=o=0}if(5&u[0])throw u[1];return{value:u[0]?u[1]:void 0,done:!0}}([u,c])}}},ne="database.updateDocInTransaction",re=function(){function t(t,e,n){this._coll=e,this.id=n,this._transaction=t,this._request=this._transaction.getRequestMethod(),this._transactionId=this._transaction.getTransactionId()}return t.prototype.create=function(t){return te(this,void 0,void 0,function(){var e,n,r,o;return ee(this,function(i){switch(i.label){case 0:return e={collectionName:this._coll,transactionId:this._transactionId,data:Jt.EJSON.stringify(Ot(t),{relaxed:!1})},this.id&&(e._id=this.id),[4,this._request.send("database.insertDocInTransaction",e)];case 1:if((n=i.sent()).code)throw n;if(r=Jt.EJSON.parse(n.inserted),1==(o=Jt.EJSON.parse(n.ok))&&1==r)return[2,Kt(Kt({},n),{ok:o,inserted:r})];throw new Error(Xt)}})})},t.prototype.get=function(){return te(this,void 0,void 0,function(){var t,e;return ee(this,function(n){switch(n.label){case 0:return t={collectionName:this._coll,transactionId:this._transactionId,query:{_id:{$eq:this.id}}},[4,this._request.send("database.getInTransaction",t)];case 1:if((e=n.sent()).code)throw e;return[2,{data:"null"!==e.data?nt.formatField(Jt.EJSON.parse(e.data)):Jt.EJSON.parse(e.data),requestId:e.requestId}]}})})},t.prototype.set=function(t){return te(this,void 0,void 0,function(){var e,n;return ee(this,function(r){switch(r.label){case 0:return e={collectionName:this._coll,transactionId:this._transactionId,query:{_id:{$eq:this.id}},data:Jt.EJSON.stringify(Ot(t),{relaxed:!1}),upsert:!0},[4,this._request.send(ne,e)];case 1:if((n=r.sent()).code)throw n;return[2,Kt(Kt({},n),{updated:Jt.EJSON.parse(n.updated),upserted:n.upserted?JSON.parse(n.upserted):null})]}})})},t.prototype.update=function(t){return te(this,void 0,void 0,function(){var e,n;return ee(this,function(r){switch(r.label){case 0:return e={collectionName:this._coll,transactionId:this._transactionId,query:{_id:{$eq:this.id}},data:Jt.EJSON.stringify(xt.encode(t),{relaxed:!1})},[4,this._request.send(ne,e)];case 1:if((n=r.sent()).code)throw n;return[2,Kt(Kt({},n),{updated:Jt.EJSON.parse(n.updated)})]}})})},t.prototype.delete=function(){return te(this,void 0,void 0,function(){var t,e;return ee(this,function(n){switch(n.label){case 0:return t={collectionName:this._coll,transactionId:this._transactionId,query:{_id:{$eq:this.id}}},[4,this._request.send("database.deleteDocInTransaction",t)];case 1:if((e=n.sent()).code)throw e;return[2,Kt(Kt({},e),{deleted:Jt.EJSON.parse(e.deleted)})]}})})},t}(),oe=function(){return oe=Object.assign||function(t){for(var e,n=1,r=arguments.length;n<r;n++)for(var o in e=arguments[n])Object.prototype.hasOwnProperty.call(e,o)&&(t[o]=e[o]);return t},oe.apply(this,arguments)},ie=function(t,e,n,r){return new(n||(n=Promise))(function(o,i){function a(t){try{c(r.next(t))}catch(t){i(t)}}function u(t){try{c(r.throw(t))}catch(t){i(t)}}function c(t){var e;t.done?o(t.value):(e=t.value,e instanceof n?e:new n(function(t){t(e)})).then(a,u)}c((r=r.apply(t,e||[])).next())})},ae=function(t,e){var n,r,o,i,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:u(0),throw:u(1),return:u(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function u(u){return function(c){return function(u){if(n)throw new TypeError("Generator is already executing.");for(;i&&(i=0,u[0]&&(a=0)),a;)try{if(n=1,r&&(o=2&u[0]?r.return:u[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,u[1])).done)return o;switch(r=0,o&&(u=[2&u[0],o.value]),u[0]){case 0:case 1:o=u;break;case 4:return a.label++,{value:u[1],done:!1};case 5:a.label++,r=u[1],u=[0];continue;case 7:u=a.ops.pop(),a.trys.pop();continue;default:if(!((o=(o=a.trys).length>0&&o[o.length-1])||6!==u[0]&&2!==u[0])){a=0;continue}if(3===u[0]&&(!o||u[1]>o[0]&&u[1]<o[3])){a.label=u[1];break}if(6===u[0]&&a.label<o[1]){a.label=o[1],o=u;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(u);break}o[2]&&a.ops.pop(),a.trys.pop();continue}u=e.call(t,a)}catch(t){u=[6,t],r=0}finally{n=o=0}if(5&u[0])throw u[1];return{value:u[0]?u[1]:void 0,done:!0}}([u,c])}}},ue="database.getInTransaction",ce=function(){function t(t,e,n,r,o){this._coll=e,this._transaction=t,this._fieldFilters=n,this._fieldOrders=r||[],this._queryOptions=o||{},this._request=this._transaction.getRequestMethod(),this._transactionId=this._transaction.getTransactionId()}return t.prototype.where=function(e){if("Object"!==Object.prototype.toString.call(e).slice(8,-1))throw Error(o.QueryParamTypeError);var n=Object.keys(e),r=n.some(function(t){return void 0!==e[t]});if(n.length&&!r)throw Error(o.QueryParamValueError);return new t(this._transaction,this._coll,Mt.encode(e),this._fieldOrders,this._queryOptions)},t.prototype.orderBy=function(e,n){rt.isFieldPath(e),rt.isFieldOrder(n);var r={field:e,direction:n},o=this._fieldOrders.concat(r);return new t(this._transaction,this._coll,this._fieldFilters,o,this._queryOptions)},t.prototype.limit=function(e){rt.isInteger("limit",e);var n=oe({},this._queryOptions);return n.limit=e,new t(this._transaction,this._coll,this._fieldFilters,this._fieldOrders,n)},t.prototype.skip=function(e){rt.isInteger("offset",e);var n=oe({},this._queryOptions);return n.offset=e,new t(this._transaction,this._coll,this._fieldFilters,this._fieldOrders,n)},t.prototype.field=function(e){for(var n in e)e[n]?"object"!=typeof e[n]&&(e[n]=1):e[n]=0;var r=oe({},this._queryOptions);return r.projection=e,new t(this._transaction,this._coll,this._fieldFilters,this._fieldOrders,r)},t.prototype.get=function(){return ie(this,void 0,void 0,function(){var t,e,n,r,o,i;return ae(this,function(a){switch(a.label){case 0:return t=[],this._fieldOrders&&this._fieldOrders.forEach(function(e){t.push(e)}),e={collectionName:this._coll,transactionId:this._transactionId},this._fieldFilters&&(e.query=this._fieldFilters),t.length>0&&(e.order=t),this._queryOptions.offset&&(e.offset=this._queryOptions.offset),this._queryOptions.limit?e.limit=this._queryOptions.limit<1e3?this._queryOptions.limit:1e3:e.limit=100,this._queryOptions.projection&&(e.projection=this._queryOptions.projection),[4,this._request.send(ue,e)];case 1:if((n=a.sent()).code)throw n;return r="null"!==n.data?Jt.EJSON.parse(n.data):null,o=r?Array.isArray(r)?nt.formatResDocumentData(r):[nt.formatField(r)]:[],i={data:o,requestId:n.requestId},void 0!==n.total&&(i.total=n.total),void 0!==n.limit&&(i.limit=n.limit),void 0!==n.offset&&(i.offset=n.offset),[2,i]}})})},t.prototype.count=function(){return ie(this,void 0,void 0,function(){var t,e,n,r;return ae(this,function(o){switch(o.label){case 0:return t={collectionName:this._coll,transactionId:this._transactionId},this._fieldFilters&&(t.query=this._fieldFilters),[4,this._request.send(ue,t)];case 1:if((e=o.sent()).code)throw e;return n="null"!==e.data?Jt.EJSON.parse(e.data):null,r=Array.isArray(n)?n.length:n?1:0,[2,{requestId:e.requestId,total:void 0!==e.total?e.total:r}]}})})},t.prototype.update=function(t){return ie(this,void 0,void 0,function(){var e,n;return ae(this,function(r){switch(r.label){case 0:if(!t||"object"!=typeof t)throw new Error("参数必需是非空对象");if(t.hasOwnProperty("_id"))throw new Error("不能更新_id的值");return e={collectionName:this._coll,transactionId:this._transactionId,query:this._fieldFilters,data:Jt.EJSON.stringify(xt.encode(t),{relaxed:!1})},[4,this._request.send("database.updateDocInTransaction",e)];case 1:if((n=r.sent()).code)throw n;return[2,oe(oe({},n),{updated:Jt.EJSON.parse(n.updated)})]}})})},t.prototype.remove=function(){return ie(this,void 0,void 0,function(){var t,e;return ae(this,function(n){switch(n.label){case 0:return Object.keys(this._queryOptions).length>0&&console.warn("`offset`, `limit` and `projection` are not supported in remove() operation"),this._fieldOrders.length>0&&console.warn("`orderBy` is not supported in remove() operation"),t={collectionName:this._coll,transactionId:this._transactionId,query:this._fieldFilters},[4,this._request.send("database.deleteDocInTransaction",t)];case 1:if((e=n.sent()).code)throw e;return[2,oe(oe({},e),{deleted:Jt.EJSON.parse(e.deleted)})]}})})},t}(),se=function(){var t=function(e,n){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])},t(e,n)};return function(e,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function r(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}(),le=function(t){function e(e,n){return t.call(this,e,n)||this}return se(e,t),Object.defineProperty(e.prototype,"name",{get:function(){return this._coll},enumerable:!1,configurable:!0}),e.prototype.doc=function(t){if("string"!=typeof t&&"number"!=typeof t)throw new Error("docId必须为字符串或数字");return new re(this._transaction,this._coll,t)},e.prototype.add=function(t){var e;return void 0!==t._id&&(e=t._id),new re(this._transaction,this._coll,e).create(t)},e}(ce),fe=function(t,e,n,r){return new(n||(n=Promise))(function(o,i){function a(t){try{c(r.next(t))}catch(t){i(t)}}function u(t){try{c(r.throw(t))}catch(t){i(t)}}function c(t){var e;t.done?o(t.value):(e=t.value,e instanceof n?e:new n(function(t){t(e)})).then(a,u)}c((r=r.apply(t,e||[])).next())})},de=function(t,e){var n,r,o,i,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:u(0),throw:u(1),return:u(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function u(u){return function(c){return function(u){if(n)throw new TypeError("Generator is already executing.");for(;i&&(i=0,u[0]&&(a=0)),a;)try{if(n=1,r&&(o=2&u[0]?r.return:u[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,u[1])).done)return o;switch(r=0,o&&(u=[2&u[0],o.value]),u[0]){case 0:case 1:o=u;break;case 4:return a.label++,{value:u[1],done:!1};case 5:a.label++,r=u[1],u=[0];continue;case 7:u=a.ops.pop(),a.trys.pop();continue;default:if(!((o=(o=a.trys).length>0&&o[o.length-1])||6!==u[0]&&2!==u[0])){a=0;continue}if(3===u[0]&&(!o||u[1]>o[0]&&u[1]<o[3])){a.label=u[1];break}if(6===u[0]&&a.label<o[1]){a.label=o[1],o=u;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(u);break}o[2]&&a.ops.pop(),a.trys.pop();continue}u=e.call(t,a)}catch(t){u=[6,t],r=0}finally{n=o=0}if(5&u[0])throw u[1];return{value:u[0]?u[1]:void 0,done:!0}}([u,c])}}},pe=function(){function t(t){this._db=t,this._request=me.createRequest(this._db.config),this.aborted=!1,this.commited=!1,this.inited=!1}return t.prototype.init=function(){return fe(this,void 0,void 0,function(){var t;return de(this,function(e){switch(e.label){case 0:return[4,this._request.send("database.startTransaction")];case 1:if((t=e.sent()).code)throw t;return this.inited=!0,this._id=t.transactionId,[2]}})})},t.prototype.collection=function(t){if(!t)throw new Error("Collection name is required");return new le(this,t)},t.prototype.getTransactionId=function(){return this._id},t.prototype.getRequestMethod=function(){return this._request},t.prototype.commit=function(){return fe(this,void 0,void 0,function(){var t,e;return de(this,function(n){switch(n.label){case 0:return t={transactionId:this._id},[4,this._request.send("database.commitTransaction",t)];case 1:if((e=n.sent()).code)throw e;return this.commited=!0,[2,e]}})})},t.prototype.rollback=function(t){return fe(this,void 0,void 0,function(){var e,n;return de(this,function(r){switch(r.label){case 0:return e={transactionId:this._id},[4,this._request.send("database.abortTransaction",e)];case 1:if((n=r.sent()).code)throw n;return this.aborted=!0,this.abortReason=t,[2,n]}})})},t}();function he(){return fe(this,void 0,void 0,function(){var t;return de(this,function(e){switch(e.label){case 0:return[4,(t=new pe(this)).init()];case 1:return e.sent(),[2,t]}})})}function ye(t,e){return void 0===e&&(e=3),fe(this,void 0,void 0,function(){var n,r,o,i,a=this;return de(this,function(u){switch(u.label){case 0:return u.trys.push([0,4,,10]),[4,(n=new pe(this)).init()];case 1:return u.sent(),[4,t(n)];case 2:if(r=u.sent(),!0===n.aborted)throw n.abortReason;return[4,n.commit()];case 3:return u.sent(),[2,r];case 4:if(o=u.sent(),!1===n.inited)throw o;return i=function(t){return fe(a,void 0,void 0,function(){return de(this,function(e){switch(e.label){case 0:if(n.aborted||n.commited)return[3,5];e.label=1;case 1:return e.trys.push([1,3,,4]),[4,n.rollback()];case 2:case 3:return e.sent(),[3,4];case 4:throw t;case 5:if(!0===n.aborted)throw n.abortReason;throw t}})})},e<=0?[4,i(o)]:[3,6];case 5:u.sent(),u.label=6;case 6:return o&&o.code===Zt?[4,ye.bind(this)(t,--e)]:[3,8];case 7:return[2,u.sent()];case 8:return[4,i(o)];case 9:return u.sent(),[3,10];case 10:return[2]}})})}var me=function(){function t(t){this.config=t,this.Geo=i,this.serverDate=K,this.command=Ht,this.RegExp=zt,this.startTransaction=he,this.runTransaction=ye,this.logicCommand=st,this.updateCommand=ut,this.queryCommand=pt}return t.createRequest=function(e){var n=new t.reqClass(e),r=n.send;return n.send=function(t,n){return e.instance&&(n.instance=e.instance),e.database&&(n.database=e.database),r.call(this,t,n)},n},t.prototype.collection=function(t){if(!t)throw new Error("Collection name is required");return new Qt(this,t)},t.prototype.createCollection=function(e){var n={collectionName:e};return t.createRequest(this.config).send("database.addCollection",n)},t}()},701:function(t){t.exports=require("bson")}},e={};function n(r){var o=e[r];if(void 0!==o)return o.exports;var i=e[r]={exports:{}};return t[r].call(i.exports,i,i.exports,n),i.exports}n.d=function(t,e){for(var r in e)n.o(e,r)&&!n.o(t,r)&&Object.defineProperty(t,r,{enumerable:!0,get:e[r]})},n.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},n.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})};var r=n(198);module.exports=r}();
|
|
2
|
+
//# sourceMappingURL=index.js.map
|